From: support Date: Thu, 4 May 2023 13:33:23 +0000 (+0000) Subject: Built motion from commit 0d14f64c.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=a02990eaa0730b2ca540b4b0a0ff875949192676;p=motion2.git Built motion from commit 0d14f64c.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cd84a2d..eff039b 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-04-18T14:08:07.326Z", + "time": "2023-05-04T13:23:07.638Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 41ce622..3702cb0 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-04-18T14:08:07.326Z", + "time": "2023-05-04T13:23:07.638Z", "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 61697b5..8f3b435 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 _0x5d96=['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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING','integration'];(function(_0x3174d2,_0x4dbb8a){var _0x28519a=function(_0x4e0fb9){while(--_0x4e0fb9){_0x3174d2['push'](_0x3174d2['shift']());}};_0x28519a(++_0x4dbb8a);}(_0x5d96,0xdf));var _0x65d9=function(_0x414584,_0x1a1da6){_0x414584=_0x414584-0x0;var _0x50b255=_0x5d96[_0x414584];return _0x50b255;};'use strict';var Sequelize=require('sequelize');module[_0x65d9('0x0')]={'name':{'type':Sequelize[_0x65d9('0x1')],'get':function(_0x464f34){return this[_0x65d9('0x2')]('action');}},'action':{'type':Sequelize[_0x65d9('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x65d9('0x4'),'motionbar',_0x65d9('0x5'),_0x65d9('0x6'),_0x65d9('0x7'),_0x65d9('0x8'),_0x65d9('0x9')]],'msg':_0x65d9('0xa')}},'comment':_0x65d9('0xa')},'data1':{'type':Sequelize[_0x65d9('0x3')](0x1000),'comment':_0x65d9('0xb')},'data2':{'type':Sequelize[_0x65d9('0x3')](0x1000),'comment':_0x65d9('0xc')},'data3':{'type':Sequelize[_0x65d9('0x3')](0x1000),'comment':_0x65d9('0xd')},'data4':{'type':Sequelize[_0x65d9('0x3')](0x1000),'comments':_0x65d9('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x65d9('0xf')},'data6':{'type':Sequelize[_0x65d9('0x3')],'comments':_0x65d9('0x10')},'data7':{'type':Sequelize[_0x65d9('0x11')],'comments':_0x65d9('0x12')}}; \ No newline at end of file +var _0xaf50=['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]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot'];(function(_0x208e19,_0x2696aa){var _0x42f5eb=function(_0x3e1644){while(--_0x3e1644){_0x208e19['push'](_0x208e19['shift']());}};_0x42f5eb(++_0x2696aa);}(_0xaf50,0x186));var _0x0af5=function(_0x24373c,_0x88fa8e){_0x24373c=_0x24373c-0x0;var _0x15ef73=_0xaf50[_0x24373c];return _0x15ef73;};'use strict';var Sequelize=require('sequelize');module[_0x0af5('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3de0ad){return this[_0x0af5('0x1')](_0x0af5('0x2'));}},'action':{'type':Sequelize[_0x0af5('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0af5('0x4'),_0x0af5('0x5'),_0x0af5('0x6'),_0x0af5('0x7'),_0x0af5('0x8'),'browser',_0x0af5('0x9'),'script']],'msg':_0x0af5('0xa')}},'comment':_0x0af5('0xa')},'data1':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comment':_0x0af5('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0af5('0xc')},'data3':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x0af5('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x0af5('0x3')],'comments':_0x0af5('0xd')},'data7':{'type':Sequelize[_0x0af5('0xe')],'comments':_0x0af5('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1b36ba9..9a0edba 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 _0x1dd3=['undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset'];(function(_0x4c0544,_0x1fa6bc){var _0xf979f2=function(_0x379992){while(--_0x379992){_0x4c0544['push'](_0x4c0544['shift']());}};_0xf979f2(++_0x1fa6bc);}(_0x1dd3,0x102));var _0x31dd=function(_0x17ca23,_0x11c7d3){_0x17ca23=_0x17ca23-0x0;var _0x385e5c=_0x1dd3[_0x17ca23];return _0x385e5c;};'use strict';var emlformat=require(_0x31dd('0x0'));var rimraf=require(_0x31dd('0x1'));var zipdir=require(_0x31dd('0x2'));var jsonpatch=require(_0x31dd('0x3'));var rp=require(_0x31dd('0x4'));var moment=require('moment');var BPromise=require(_0x31dd('0x5'));var Mustache=require('mustache');var util=require(_0x31dd('0x6'));var path=require(_0x31dd('0x7'));var sox=require(_0x31dd('0x8'));var csv=require(_0x31dd('0x9'));var ejs=require(_0x31dd('0xa'));var fs=require('fs');var fs_extra=require(_0x31dd('0xb'));var _=require(_0x31dd('0xc'));var squel=require(_0x31dd('0xd'));var crypto=require(_0x31dd('0xe'));var jsforce=require(_0x31dd('0xf'));var deskjs=require(_0x31dd('0x10'));var toCsv=require(_0x31dd('0x9'));var querystring=require(_0x31dd('0x11'));var Papa=require(_0x31dd('0x12'));var Redis=require(_0x31dd('0x13'));var authService=require(_0x31dd('0x14'));var qs=require(_0x31dd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31dd('0x16'));var logger=require('../../config/logger')(_0x31dd('0x17'));var utils=require(_0x31dd('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b037e,_0x3db4b1){_0x3db4b1=_0x3db4b1||0xcc;return function(_0x243109){if(_0x243109){return _0x4b037e[_0x31dd('0x19')](_0x3db4b1);}return _0x4b037e[_0x31dd('0x1a')](_0x3db4b1)[_0x31dd('0x1b')]();};}function respondWithResult(_0x19b40c,_0x4da1ce){_0x4da1ce=_0x4da1ce||0xc8;return function(_0x49862e){if(_0x49862e){return _0x19b40c[_0x31dd('0x1a')](_0x4da1ce)[_0x31dd('0x1c')](_0x49862e);}};}function respondWithFilteredResult(_0x40c1f4,_0x4d08ff){return function(_0x3933cb){if(_0x3933cb){var _0x12cf31=typeof _0x4d08ff[_0x31dd('0x1d')]===_0x31dd('0x1e')&&typeof _0x4d08ff[_0x31dd('0x1f')]===_0x31dd('0x1e');var _0x254c19=_0x3933cb[_0x31dd('0x20')];var _0x12f1f4=_0x12cf31?0x0:_0x4d08ff[_0x31dd('0x1d')];var _0x5cd67a=_0x12cf31?_0x3933cb['count']:_0x4d08ff[_0x31dd('0x1d')]+_0x4d08ff[_0x31dd('0x1f')];var _0x3ccd84;if(_0x5cd67a>=_0x254c19){_0x5cd67a=_0x254c19;_0x3ccd84=0xc8;}else{_0x3ccd84=0xce;}_0x40c1f4[_0x31dd('0x1a')](_0x3ccd84);return _0x40c1f4[_0x31dd('0x21')]('Content-Range',_0x12f1f4+'-'+_0x5cd67a+'/'+_0x254c19)[_0x31dd('0x1c')](_0x3933cb);}return null;};}function patchUpdates(_0x4f3bf4){return function(_0x19c381){try{jsonpatch[_0x31dd('0x22')](_0x19c381,_0x4f3bf4,!![]);}catch(_0xfbed2f){return BPromise[_0x31dd('0x23')](_0xfbed2f);}return _0x19c381[_0x31dd('0x24')]();};}function saveUpdates(_0x69c67a,_0x17db2c){return function(_0x18ef82){if(_0x18ef82){return _0x18ef82[_0x31dd('0x25')](_0x69c67a)[_0x31dd('0x26')](function(_0x3a7bed){return _0x3a7bed;});}return null;};}function removeEntity(_0x4f66c5,_0x3901d1){return function(_0x4d423d){if(_0x4d423d){return _0x4d423d[_0x31dd('0x27')]()[_0x31dd('0x26')](function(){_0x4f66c5[_0x31dd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38568c,_0x145589){return function(_0x14ffd9){if(!_0x14ffd9){_0x38568c[_0x31dd('0x19')](0x194);}return _0x14ffd9;};}function handleError(_0x5aaf48,_0x4beb9a){_0x4beb9a=_0x4beb9a||0x1f4;return function(_0x3628d2){logger[_0x31dd('0x28')](_0x3628d2[_0x31dd('0x29')]);if(_0x3628d2[_0x31dd('0x2a')]){delete _0x3628d2['name'];}_0x5aaf48[_0x31dd('0x1a')](_0x4beb9a)[_0x31dd('0x2b')](_0x3628d2);};}exports[_0x31dd('0x25')]=function(_0x25f0f4,_0x4cd58e){if(_0x25f0f4['body']['id']){delete _0x25f0f4[_0x31dd('0x2c')]['id'];}return db['Action'][_0x31dd('0x2d')]({'where':{'id':_0x25f0f4[_0x31dd('0x2e')]['id']}})[_0x31dd('0x26')](handleEntityNotFound(_0x4cd58e,null))[_0x31dd('0x26')](saveUpdates(_0x25f0f4[_0x31dd('0x2c')],null))['then'](respondWithResult(_0x4cd58e,null))['catch'](handleError(_0x4cd58e,null));};exports[_0x31dd('0x27')]=function(_0x45baa9,_0x590138){return db['Action']['find']({'where':{'id':_0x45baa9['params']['id']}})[_0x31dd('0x26')](handleEntityNotFound(_0x590138,null))['then'](removeEntity(_0x590138,null))[_0x31dd('0x2f')](handleError(_0x590138,null));}; \ No newline at end of file +var _0xda24=['../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','update','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api'];(function(_0x14db0a,_0xea5e2c){var _0x1eae4d=function(_0x395612){while(--_0x395612){_0x14db0a['push'](_0x14db0a['shift']());}};_0x1eae4d(++_0xea5e2c);}(_0xda24,0x1ac));var _0x4da2=function(_0x5e5ad9,_0x18845f){_0x5e5ad9=_0x5e5ad9-0x0;var _0x396036=_0xda24[_0x5e5ad9];return _0x396036;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4da2('0x0'));var zipdir=require(_0x4da2('0x1'));var jsonpatch=require(_0x4da2('0x2'));var rp=require(_0x4da2('0x3'));var moment=require(_0x4da2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4da2('0x5'));var util=require(_0x4da2('0x6'));var path=require('path');var sox=require(_0x4da2('0x7'));var csv=require(_0x4da2('0x8'));var ejs=require(_0x4da2('0x9'));var fs=require('fs');var fs_extra=require(_0x4da2('0xa'));var _=require(_0x4da2('0xb'));var squel=require(_0x4da2('0xc'));var crypto=require(_0x4da2('0xd'));var jsforce=require(_0x4da2('0xe'));var deskjs=require(_0x4da2('0xf'));var toCsv=require(_0x4da2('0x8'));var querystring=require(_0x4da2('0x10'));var Papa=require(_0x4da2('0x11'));var Redis=require(_0x4da2('0x12'));var authService=require(_0x4da2('0x13'));var qs=require(_0x4da2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4da2('0x15'));var utils=require(_0x4da2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2547e7,_0xe653fa){_0xe653fa=_0xe653fa||0xcc;return function(_0x5955a5){if(_0x5955a5){return _0x2547e7[_0x4da2('0x17')](_0xe653fa);}return _0x2547e7[_0x4da2('0x18')](_0xe653fa)[_0x4da2('0x19')]();};}function respondWithResult(_0x50c848,_0x487144){_0x487144=_0x487144||0xc8;return function(_0x4168c5){if(_0x4168c5){return _0x50c848[_0x4da2('0x18')](_0x487144)[_0x4da2('0x1a')](_0x4168c5);}};}function respondWithFilteredResult(_0x453ac0,_0x4aedf1){return function(_0x878eb0){if(_0x878eb0){var _0x3ec2e7=typeof _0x4aedf1[_0x4da2('0x1b')]===_0x4da2('0x1c')&&typeof _0x4aedf1[_0x4da2('0x1d')]===_0x4da2('0x1c');var _0x6024cc=_0x878eb0[_0x4da2('0x1e')];var _0x53c7ae=_0x3ec2e7?0x0:_0x4aedf1[_0x4da2('0x1b')];var _0x3bd46f=_0x3ec2e7?_0x878eb0[_0x4da2('0x1e')]:_0x4aedf1[_0x4da2('0x1b')]+_0x4aedf1['limit'];var _0x2e21e5;if(_0x3bd46f>=_0x6024cc){_0x3bd46f=_0x6024cc;_0x2e21e5=0xc8;}else{_0x2e21e5=0xce;}_0x453ac0[_0x4da2('0x18')](_0x2e21e5);return _0x453ac0[_0x4da2('0x1f')](_0x4da2('0x20'),_0x53c7ae+'-'+_0x3bd46f+'/'+_0x6024cc)['json'](_0x878eb0);}return null;};}function patchUpdates(_0x1e329f){return function(_0x649f7a){try{jsonpatch['apply'](_0x649f7a,_0x1e329f,!![]);}catch(_0x51db90){return BPromise['reject'](_0x51db90);}return _0x649f7a[_0x4da2('0x21')]();};}function saveUpdates(_0x1d3dfa,_0x52ef96){return function(_0x47ec2d){if(_0x47ec2d){return _0x47ec2d['update'](_0x1d3dfa)[_0x4da2('0x22')](function(_0x3563ae){return _0x3563ae;});}return null;};}function removeEntity(_0x40f5ad,_0x18c754){return function(_0x1888de){if(_0x1888de){return _0x1888de[_0x4da2('0x23')]()[_0x4da2('0x22')](function(){_0x40f5ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2672fb,_0x59442e){return function(_0x279c8b){if(!_0x279c8b){_0x2672fb[_0x4da2('0x17')](0x194);}return _0x279c8b;};}function handleError(_0x157335,_0x1dff39){_0x1dff39=_0x1dff39||0x1f4;return function(_0x330670){logger[_0x4da2('0x24')](_0x330670[_0x4da2('0x25')]);if(_0x330670[_0x4da2('0x26')]){delete _0x330670[_0x4da2('0x26')];}_0x157335['status'](_0x1dff39)['send'](_0x330670);};}exports[_0x4da2('0x27')]=function(_0x53edf2,_0x1345b6){if(_0x53edf2[_0x4da2('0x28')]['id']){delete _0x53edf2[_0x4da2('0x28')]['id'];}return db[_0x4da2('0x29')][_0x4da2('0x2a')]({'where':{'id':_0x53edf2[_0x4da2('0x2b')]['id']}})[_0x4da2('0x22')](handleEntityNotFound(_0x1345b6,null))[_0x4da2('0x22')](saveUpdates(_0x53edf2[_0x4da2('0x28')],null))[_0x4da2('0x22')](respondWithResult(_0x1345b6,null))[_0x4da2('0x2c')](handleError(_0x1345b6,null));};exports[_0x4da2('0x23')]=function(_0x2eb25e,_0x24de9b){return db[_0x4da2('0x29')]['find']({'where':{'id':_0x2eb25e[_0x4da2('0x2b')]['id']}})[_0x4da2('0x22')](handleEntityNotFound(_0x24de9b,null))[_0x4da2('0x22')](removeEntity(_0x24de9b,null))[_0x4da2('0x2c')](handleError(_0x24de9b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 80d2ef7..1f0c5a9 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 _0x8b89=['moment','bluebird','request-promise','path','rimraf','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api'];(function(_0x47b074,_0x18252c){var _0x5d3a9d=function(_0x5c6076){while(--_0x5c6076){_0x47b074['push'](_0x47b074['shift']());}};_0x5d3a9d(++_0x18252c);}(_0x8b89,0x7e));var _0x98b8=function(_0x2dfac5,_0x37514a){_0x2dfac5=_0x2dfac5-0x0;var _0x5f2cf2=_0x8b89[_0x2dfac5];return _0x5f2cf2;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var logger=require(_0x98b8('0x2'))(_0x98b8('0x3'));var moment=require(_0x98b8('0x4'));var BPromise=require(_0x98b8('0x5'));var rp=require(_0x98b8('0x6'));var fs=require('fs');var path=require(_0x98b8('0x7'));var rimraf=require(_0x98b8('0x8'));var config=require('../../config/environment');var attributes=require(_0x98b8('0x9'));module[_0x98b8('0xa')]=function(_0x41fa2f,_0x48868c){return _0x41fa2f[_0x98b8('0xb')](_0x98b8('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ec1=['../../config/logger','api','request-promise','rimraf','../../config/environment','./action.attributes','Action','lodash'];(function(_0x1875cf,_0x1c26e5){var _0x133ea2=function(_0x502bea){while(--_0x502bea){_0x1875cf['push'](_0x1875cf['shift']());}};_0x133ea2(++_0x1c26e5);}(_0x9ec1,0xe7));var _0x19ec=function(_0x2ae2cd,_0xb42c96){_0x2ae2cd=_0x2ae2cd-0x0;var _0xc52725=_0x9ec1[_0x2ae2cd];return _0xc52725;};'use strict';var _=require(_0x19ec('0x0'));var util=require('util');var logger=require(_0x19ec('0x1'))(_0x19ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x19ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19ec('0x4'));var config=require(_0x19ec('0x5'));var attributes=require(_0x19ec('0x6'));module['exports']=function(_0x1035ba,_0xba0219){return _0x1035ba['define'](_0x19ec('0x7'),attributes,{'tableName':'tools_actions','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 4da5f70..d8eac64 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b6909,_0xe6c49d){var _0x41475f=function(_0x3340ee){while(--_0x3340ee){_0x5b6909['push'](_0x5b6909['shift']());}};_0x41475f(++_0xe6c49d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5650b4,_0x2723ba){_0x5650b4=_0x5650b4-0x0;var _0x297a62=_0x7fbe[_0x5650b4];return _0x297a62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a0c8f,_0x512b1a){var _0x2bdadc=function(_0x605443){while(--_0x605443){_0x2a0c8f['push'](_0x2a0c8f['shift']());}};_0x2bdadc(++_0x512b1a);}(_0x326f,0xd1));var _0xf326=function(_0x22e3a8,_0x2eb8e8){_0x22e3a8=_0x22e3a8-0x0;var _0x56e9b4=_0x326f[_0x22e3a8];return _0x56e9b4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 35330b0..39a4301 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 _0x63cb=['isAuthenticated','delete','exports','multer','path','connect-timeout','Router','../../config/environment','./action.controller','put','/:id'];(function(_0x547b59,_0x3e8d99){var _0x255e97=function(_0x27c866){while(--_0x27c866){_0x547b59['push'](_0x547b59['shift']());}};_0x255e97(++_0x3e8d99);}(_0x63cb,0x19a));var _0xb63c=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x63cb[_0x166d93];return _0xba708;};'use strict';var multer=require(_0xb63c('0x0'));var util=require('util');var path=require(_0xb63c('0x1'));var timeout=require(_0xb63c('0x2'));var express=require('express');var router=express[_0xb63c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb63c('0x4'));var controller=require(_0xb63c('0x5'));router[_0xb63c('0x6')](_0xb63c('0x7'),auth[_0xb63c('0x8')](),controller['update']);router[_0xb63c('0x9')](_0xb63c('0x7'),auth[_0xb63c('0x8')](),controller['destroy']);module[_0xb63c('0xa')]=router; \ No newline at end of file +var _0xca25=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca25,0x14f));var _0x5ca2=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0xca25[_0x3c6c1b];return _0x15170e;};'use strict';var multer=require(_0x5ca2('0x0'));var util=require('util');var path=require(_0x5ca2('0x1'));var timeout=require(_0x5ca2('0x2'));var express=require(_0x5ca2('0x3'));var router=express[_0x5ca2('0x4')]();var fs_extra=require(_0x5ca2('0x5'));var auth=require(_0x5ca2('0x6'));var interaction=require(_0x5ca2('0x7'));var config=require(_0x5ca2('0x8'));var controller=require(_0x5ca2('0x9'));router[_0x5ca2('0xa')](_0x5ca2('0xb'),auth['isAuthenticated'](),controller[_0x5ca2('0xc')]);router['delete']('/:id',auth[_0x5ca2('0xd')](),controller[_0x5ca2('0xe')]);module[_0x5ca2('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c24c2e0..d9d573a 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 _0xc4aa=['STRING','sequelize','exports'];(function(_0x58b472,_0x28dceb){var _0x35f78b=function(_0x5ea4bb){while(--_0x5ea4bb){_0x58b472['push'](_0x58b472['shift']());}};_0x35f78b(++_0x28dceb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x124fb0,_0x4addf2){var _0x2265d6=function(_0xd03631){while(--_0xd03631){_0x124fb0['push'](_0x124fb0['shift']());}};_0x2265d6(++_0x4addf2);}(_0xda19,0xd5));var _0x9da1=function(_0x5b25f1,_0x21d1ee){_0x5b25f1=_0x5b25f1-0x0;var _0x5a269f=_0xda19[_0x5b25f1];return _0x5a269f;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e27ef04..f7ada88 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 _0x5c57=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','replace','function','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','format','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(%s)','MAX(%s)','MIN(%s)','SEC_TO_TIME(%s)','HOUR(%s)','operator','AnalyticMetric','from','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','IS\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','CustomReports','UserProfileResource','then','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x4b5cec,_0x2df8a8){var _0x20681b=function(_0x2fd072){while(--_0x2fd072){_0x4b5cec['push'](_0x4b5cec['shift']());}};_0x20681b(++_0x2df8a8);}(_0x5c57,0x116));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x75c5('0x0'));var rimraf=require(_0x75c5('0x1'));var zipdir=require(_0x75c5('0x2'));var jsonpatch=require(_0x75c5('0x3'));var rp=require(_0x75c5('0x4'));var moment=require(_0x75c5('0x5'));var BPromise=require(_0x75c5('0x6'));var Mustache=require('mustache');var util=require(_0x75c5('0x7'));var path=require('path');var sox=require(_0x75c5('0x8'));var csv=require('to-csv');var ejs=require(_0x75c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x75c5('0xa'));var jsforce=require(_0x75c5('0xb'));var deskjs=require(_0x75c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x75c5('0xd'));var Papa=require(_0x75c5('0xe'));var Redis=require(_0x75c5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x75c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75c5('0x11'));var logger=require(_0x75c5('0x12'))('api');var utils=require(_0x75c5('0x13'));var config=require(_0x75c5('0x14'));var licenseUtil=require(_0x75c5('0x15'));var db=require(_0x75c5('0x16'))['db'];var dbH=require(_0x75c5('0x16'))[_0x75c5('0x17')];function respondWithStatusCode(_0x4f3588,_0x4ff62b){_0x4ff62b=_0x4ff62b||0xcc;return function(_0x1b7b5a){if(_0x1b7b5a){return _0x4f3588[_0x75c5('0x18')](_0x4ff62b);}return _0x4f3588['status'](_0x4ff62b)[_0x75c5('0x19')]();};}function respondWithResult(_0x5be150,_0x43bf34){_0x43bf34=_0x43bf34||0xc8;return function(_0x25379c){if(_0x25379c){return _0x5be150[_0x75c5('0x1a')](_0x43bf34)[_0x75c5('0x1b')](_0x25379c);}};}function respondWithFilteredResult(_0x411bfd,_0x3fcd7d){return function(_0x1145f6){if(_0x1145f6){var _0x32fdec=typeof _0x3fcd7d['offset']==='undefined'&&typeof _0x3fcd7d[_0x75c5('0x1c')]===_0x75c5('0x1d');var _0x234914=_0x1145f6[_0x75c5('0x1e')];var _0x405b66=_0x32fdec?0x0:_0x3fcd7d[_0x75c5('0x1f')];var _0x558596=_0x32fdec?_0x1145f6[_0x75c5('0x1e')]:_0x3fcd7d[_0x75c5('0x1f')]+_0x3fcd7d[_0x75c5('0x1c')];var _0x3e018d;if(_0x558596>=_0x234914){_0x558596=_0x234914;_0x3e018d=0xc8;}else{_0x3e018d=0xce;}_0x411bfd[_0x75c5('0x1a')](_0x3e018d);return _0x411bfd[_0x75c5('0x20')](_0x75c5('0x21'),_0x405b66+'-'+_0x558596+'/'+_0x234914)[_0x75c5('0x1b')](_0x1145f6);}return null;};}function patchUpdates(_0x1a8c30){return function(_0x21fbcb){try{jsonpatch[_0x75c5('0x22')](_0x21fbcb,_0x1a8c30,!![]);}catch(_0x577a29){return BPromise[_0x75c5('0x23')](_0x577a29);}return _0x21fbcb[_0x75c5('0x24')]();};}function saveUpdates(_0x5a3de7,_0xfc9f1a){return function(_0x470ef5){if(_0x470ef5){return _0x470ef5[_0x75c5('0x25')](_0x5a3de7)['then'](function(_0x23941f){return _0x23941f;});}return null;};}function removeEntity(_0x263cbc,_0x4d4cbe){return function(_0x361864){if(_0x361864){return _0x361864[_0x75c5('0x26')]()['then'](function(){var _0x4eb28d=_0x361864['get']({'plain':!![]});var _0x34d965=_0x75c5('0x27');return db[_0x75c5('0x28')][_0x75c5('0x26')]({'where':{'type':_0x34d965,'resourceId':_0x4eb28d['id']}})[_0x75c5('0x29')](function(){return _0x361864;});})['then'](function(){_0x263cbc[_0x75c5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22498b,_0x1db692){return function(_0x1353c5){if(!_0x1353c5){_0x22498b[_0x75c5('0x18')](0x194);}return _0x1353c5;};}function handleError(_0x322f23,_0x4c2510){_0x4c2510=_0x4c2510||0x1f4;return function(_0x56a12b){logger[_0x75c5('0x2a')](_0x56a12b[_0x75c5('0x2b')]);if(_0x56a12b[_0x75c5('0x2c')]){delete _0x56a12b[_0x75c5('0x2c')];}_0x322f23[_0x75c5('0x1a')](_0x4c2510)[_0x75c5('0x2d')](_0x56a12b);};}exports['index']=function(_0x4921ac,_0x607cd5){var _0xfa864d={},_0x5b432c={},_0x3f9260={'count':0x0,'rows':[]};var _0x1cd722=_[_0x75c5('0x2e')](db[_0x75c5('0x2f')][_0x75c5('0x30')],function(_0x151f14){return{'name':_0x151f14[_0x75c5('0x31')],'type':_0x151f14[_0x75c5('0x32')][_0x75c5('0x33')]};});_0x5b432c[_0x75c5('0x34')]=_['map'](_0x1cd722,'name');_0x5b432c[_0x75c5('0x35')]=_['keys'](_0x4921ac[_0x75c5('0x35')]);_0x5b432c[_0x75c5('0x36')]=_[_0x75c5('0x37')](_0x5b432c['model'],_0x5b432c[_0x75c5('0x35')]);_0xfa864d[_0x75c5('0x38')]=_[_0x75c5('0x37')](_0x5b432c[_0x75c5('0x34')],qs[_0x75c5('0x39')](_0x4921ac['query'][_0x75c5('0x39')]));_0xfa864d[_0x75c5('0x38')]=_0xfa864d[_0x75c5('0x38')][_0x75c5('0x3a')]?_0xfa864d[_0x75c5('0x38')]:_0x5b432c[_0x75c5('0x34')];if(!_0x4921ac['query'][_0x75c5('0x3b')](_0x75c5('0x3c'))){_0xfa864d[_0x75c5('0x1c')]=qs[_0x75c5('0x1c')](_0x4921ac[_0x75c5('0x35')][_0x75c5('0x1c')]);_0xfa864d[_0x75c5('0x1f')]=qs['offset'](_0x4921ac[_0x75c5('0x35')]['offset']);}_0xfa864d[_0x75c5('0x3d')]=qs[_0x75c5('0x3e')](_0x4921ac[_0x75c5('0x35')][_0x75c5('0x3e')]);_0xfa864d[_0x75c5('0x3f')]=qs[_0x75c5('0x36')](_[_0x75c5('0x40')](_0x4921ac[_0x75c5('0x35')],_0x5b432c['filters']),_0x1cd722);if(_0x4921ac[_0x75c5('0x35')]['filter']){_0xfa864d['where']=_[_0x75c5('0x41')](_0xfa864d[_0x75c5('0x3f')],{'$or':_[_0x75c5('0x2e')](_0x1cd722,function(_0x27527b){if(_0x27527b[_0x75c5('0x32')]!==_0x75c5('0x42')){var _0x1e216e={};_0x1e216e[_0x27527b[_0x75c5('0x2c')]]={'$like':'%'+_0x4921ac[_0x75c5('0x35')][_0x75c5('0x43')]+'%'};return _0x1e216e;}})});}_0xfa864d=_['merge']({},_0xfa864d,_0x4921ac[_0x75c5('0x44')]);var _0x52905c={'where':_0xfa864d[_0x75c5('0x3f')]};return db[_0x75c5('0x2f')]['count'](_0x52905c)['then'](function(_0x11119c){_0x3f9260[_0x75c5('0x1e')]=_0x11119c;if(_0x4921ac[_0x75c5('0x35')][_0x75c5('0x45')]){_0xfa864d[_0x75c5('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x75c5('0x47')](_0xfa864d);})[_0x75c5('0x29')](function(_0x43e64c){_0x3f9260['rows']=_0x43e64c;return _0x3f9260;})['then'](respondWithFilteredResult(_0x607cd5,_0xfa864d))[_0x75c5('0x48')](handleError(_0x607cd5,null));};exports[_0x75c5('0x49')]=function(_0x1818b7,_0x4dfe42){var _0x279e6f={'raw':![],'where':{'id':_0x1818b7[_0x75c5('0x4a')]['id']}},_0x138bf0={};_0x138bf0['model']=_['keys'](db['AnalyticCustomReport'][_0x75c5('0x30')]);_0x138bf0[_0x75c5('0x35')]=_[_0x75c5('0x4b')](_0x1818b7['query']);_0x138bf0[_0x75c5('0x36')]=_['intersection'](_0x138bf0[_0x75c5('0x34')],_0x138bf0[_0x75c5('0x35')]);_0x279e6f['attributes']=_['intersection'](_0x138bf0[_0x75c5('0x34')],qs[_0x75c5('0x39')](_0x1818b7[_0x75c5('0x35')][_0x75c5('0x39')]));_0x279e6f[_0x75c5('0x38')]=_0x279e6f[_0x75c5('0x38')][_0x75c5('0x3a')]?_0x279e6f[_0x75c5('0x38')]:_0x138bf0[_0x75c5('0x34')];if(_0x1818b7[_0x75c5('0x35')][_0x75c5('0x45')]){_0x279e6f['include']=[{'all':!![]}];}_0x279e6f=_[_0x75c5('0x41')]({},_0x279e6f,_0x1818b7[_0x75c5('0x44')]);return db[_0x75c5('0x2f')]['find'](_0x279e6f)[_0x75c5('0x29')](handleEntityNotFound(_0x4dfe42,null))['then'](respondWithResult(_0x4dfe42,null))[_0x75c5('0x48')](handleError(_0x4dfe42,null));};exports[_0x75c5('0x4c')]=function(_0x1aff2c,_0x243cd1){return db[_0x75c5('0x2f')]['create'](_0x1aff2c[_0x75c5('0x4d')],{})[_0x75c5('0x29')](function(_0x236027){var _0x77bb0a=_0x1aff2c[_0x75c5('0x4e')][_0x75c5('0x4f')]({'plain':!![]});if(!_0x77bb0a)throw new Error(_0x75c5('0x50'));if(_0x77bb0a[_0x75c5('0x51')]==='user'){var _0x35d1eb=_0x236027[_0x75c5('0x4f')]({'plain':!![]});var _0x47f3e7=_0x75c5('0x52');return db['UserProfileSection'][_0x75c5('0x53')]({'where':{'name':_0x47f3e7,'userProfileId':_0x77bb0a[_0x75c5('0x54')]},'raw':!![]})[_0x75c5('0x29')](function(_0xad2a8e){if(_0xad2a8e&&_0xad2a8e['autoAssociation']===0x0){return db[_0x75c5('0x28')][_0x75c5('0x4c')]({'name':_0x35d1eb[_0x75c5('0x2c')],'resourceId':_0x35d1eb['id'],'type':'CustomReports','sectionId':_0xad2a8e['id']},{})[_0x75c5('0x29')](function(){return _0x236027;});}else{return _0x236027;}})[_0x75c5('0x48')](function(_0x50e202){logger[_0x75c5('0x2a')](_0x75c5('0x55'),_0x50e202);throw _0x50e202;});}return _0x236027;})[_0x75c5('0x29')](respondWithResult(_0x243cd1,0xc9))[_0x75c5('0x48')](handleError(_0x243cd1,null));};exports[_0x75c5('0x25')]=function(_0x2abe8f,_0x21df14){if(_0x2abe8f['body']['id']){delete _0x2abe8f[_0x75c5('0x4d')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x2abe8f[_0x75c5('0x4a')]['id']}})[_0x75c5('0x29')](handleEntityNotFound(_0x21df14,null))['then'](saveUpdates(_0x2abe8f[_0x75c5('0x4d')],null))[_0x75c5('0x29')](respondWithResult(_0x21df14,null))[_0x75c5('0x48')](handleError(_0x21df14,null));};exports['destroy']=function(_0x2d1c2a,_0x4445ec){return db['AnalyticCustomReport'][_0x75c5('0x53')]({'where':{'id':_0x2d1c2a[_0x75c5('0x4a')]['id']}})[_0x75c5('0x29')](handleEntityNotFound(_0x4445ec,null))['then'](removeEntity(_0x4445ec,null))[_0x75c5('0x48')](handleError(_0x4445ec,null));};exports['preview']=function(_0x455bd4,_0x3254ed){var _0xf297d6=0xa;var _0x1d5ecd=[_0x75c5('0x56'),_0x75c5('0x57'),_0x75c5('0x58'),_0x75c5('0x59')];var _0xdb2bed={'SUM':_0x75c5('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x75c5('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x75c5('0x5c'),'GROUP_CONCAT':_0x75c5('0x5d'),'GROUP_CONCAT ASC':_0x75c5('0x5e'),'GROUP_CONCAT DESC':_0x75c5('0x5f')};var _0x44452c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x75c5('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x75c5('0x61'),'UNIX_TIMESTAMP':_0x75c5('0x62')};var _0x36e2b1=function(_0x584695){return!_[_0x75c5('0x63')]([_0x75c5('0x64'),_0x75c5('0x65'),'IS\x20EMPTY',_0x75c5('0x66')],_0x584695);};var _0x569561=function(_0x5b210f){if(!_0x5b210f||!_0x5b210f[_0x75c5('0x67')]['length']){return'';}for(var _0xe71071='(',_0x57f356=0x0;_0x57f356<_0x5b210f['rules'][_0x75c5('0x3a')];_0x57f356+=0x1){_0x57f356>0x0&&(_0xe71071+='\x20'+_0x5b210f['operator']+'\x20');_0xe71071+=_0x5b210f[_0x75c5('0x67')][_0x57f356][_0x75c5('0x68')]?_0x569561(_0x5b210f[_0x75c5('0x67')][_0x57f356][_0x75c5('0x68')]):_0x5b210f['rules'][_0x57f356][_0x75c5('0x69')]+'\x20'+_0x5b210f[_0x75c5('0x67')][_0x57f356][_0x75c5('0x6a')]+(_0x36e2b1(_0x5b210f[_0x75c5('0x67')][_0x57f356][_0x75c5('0x6a')])?'\x20'+_0x5b210f[_0x75c5('0x67')][_0x57f356][_0x75c5('0x6b')]:'');}return _0xe71071+')';};var _0x2d2850={'where':{'id':_0x455bd4[_0x75c5('0x4a')]['id']}},_0x2e3ef3,_0x87fa6e,_0x4fee83,_0x277aae,_0x54c8dc;_0x2d2850=_[_0x75c5('0x41')]({},_0x2d2850,_0x455bd4[_0x75c5('0x44')]);return db[_0x75c5('0x2f')][_0x75c5('0x53')](_0x2d2850)[_0x75c5('0x29')](function(_0x59afe7){if(_0x59afe7){_0x2e3ef3=_0x59afe7;return _0x59afe7[_0x75c5('0x6c')]();}return null;})[_0x75c5('0x29')](function(_0x1a41b7){if(_0x1a41b7){if(!_0x1a41b7[_0x75c5('0x3a')]){throw new db[(_0x75c5('0x6d'))][(_0x75c5('0x6e'))](_0x75c5('0x6f'),0x193);}_0x87fa6e=_0x1a41b7;return db['AnalyticMetric'][_0x75c5('0x47')]({'raw':!![]});}return null;})['then'](function(_0x198c71){if(_0x198c71){_0x4fee83=_[_0x75c5('0x70')](_0x198c71,'id');var _0x706962;var _0x5bd733=squel[_0x75c5('0x71')]();_0x5bd733['from'](_0x2e3ef3[_0x75c5('0x72')]);for(var _0x39d724=0x0;_0x39d724<_0x87fa6e['length'];_0x39d724+=0x1){_0x706962=_0x87fa6e[_0x39d724][_0x75c5('0x73')]?_0x4fee83[_0x87fa6e[_0x39d724][_0x75c5('0x73')]][_0x75c5('0x74')]:_0x87fa6e[_0x39d724][_0x75c5('0x69')];_0x706962=_0x87fa6e[_0x39d724]['function']?_[_0x75c5('0x75')](_0xdb2bed[_0x87fa6e[_0x39d724][_0x75c5('0x76')]],'%s',_0x706962):_0x706962;_0x706962=_0x87fa6e[_0x39d724]['format']?_[_0x75c5('0x75')](_0x44452c[_0x87fa6e[_0x39d724]['format']],'%s',_0x706962):_0x706962;if(_0x87fa6e[_0x39d724][_0x75c5('0x77')]){_0x5bd733[_0x75c5('0x68')](_0x706962);}_0x87fa6e[_0x39d724][_0x75c5('0x78')]&&_0x5bd733[_0x75c5('0x3d')](_0x706962,_0x87fa6e[_0x39d724]['orderBy']===_0x75c5('0x79')?![]:!![]);_0x5bd733['field'](_0x706962,_0x87fa6e[_0x39d724][_0x75c5('0x7a')]||_0x706962);}if(_0x2e3ef3[_0x75c5('0x7b')]){_0x2e3ef3[_0x75c5('0x7b')]=JSON[_0x75c5('0x7c')](_0x2e3ef3[_0x75c5('0x7b')]);for(var _0x5e552a=0x0;_0x5e552a<_0x2e3ef3[_0x75c5('0x7b')][_0x75c5('0x3a')];_0x5e552a+=0x1){if(_0x2e3ef3['joins'][_0x5e552a]['type']&&_[_0x75c5('0x63')](_0x1d5ecd,_0x2e3ef3['joins'][_0x5e552a][_0x75c5('0x32')])&&_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a][_0x75c5('0x7d')]&&_0x2e3ef3['joins'][_0x5e552a][_0x75c5('0x7e')]&&_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a]['foreignKey']){_0x5bd733[_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a][_0x75c5('0x32')]](_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a][_0x75c5('0x7e')],null,util[_0x75c5('0x7f')](_0x75c5('0x80'),_0x2e3ef3[_0x75c5('0x72')],_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a][_0x75c5('0x7d')],_0x2e3ef3['joins'][_0x5e552a][_0x75c5('0x7e')],_0x2e3ef3[_0x75c5('0x7b')][_0x5e552a][_0x75c5('0x81')]));}}}if(_0x2e3ef3['conditions']){_0x2e3ef3[_0x75c5('0x82')]=JSON['parse'](_0x2e3ef3[_0x75c5('0x82')]);_0x5bd733['where'](_0x569561(_0x2e3ef3[_0x75c5('0x82')][_0x75c5('0x68')]));}_0x54c8dc=_0x5bd733[_0x75c5('0x83')]();_0x5bd733[_0x75c5('0x1c')](_0xf297d6);_0x5bd733[_0x75c5('0x1f')](0x0);logger[_0x75c5('0x84')](_0x75c5('0x85'),_0x5bd733['toString']());return dbH[_0x75c5('0x86')][_0x75c5('0x35')](_0x5bd733[_0x75c5('0x87')](),{'type':dbH[_0x75c5('0x86')][_0x75c5('0x88')]['SELECT']});}})[_0x75c5('0x29')](respondWithResult(_0x3254ed,null))['catch'](handleError(_0x3254ed,null));};function runReport(_0x2d3f6f,_0x380182,_0x4da75f){var _0x5181f0=_0x380182[_0x75c5('0x2c')];var _0x488e67=0xa;var _0x1ab574=['join','left_join',_0x75c5('0x58'),_0x75c5('0x59')];var _0x593eb0={'SUM':_0x75c5('0x5a'),'COUNT':_0x75c5('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x75c5('0x8a'),'MIN':_0x75c5('0x8b'),'AVG':_0x75c5('0x5c'),'GROUP_CONCAT':_0x75c5('0x5d'),'GROUP_CONCAT ASC':_0x75c5('0x5e'),'GROUP_CONCAT DESC':_0x75c5('0x5f')};var _0x1b3be4={'SEC_TO_TIME':_0x75c5('0x8c'),'DATE':_0x75c5('0x60'),'HOUR':_0x75c5('0x8d'),'ROUND':_0x75c5('0x61'),'UNIX_TIMESTAMP':_0x75c5('0x62')};var _0x28f5d8=function(_0x269102){return!_['includes'](['IS\x20NULL',_0x75c5('0x65'),'IS\x20EMPTY',_0x75c5('0x66')],_0x269102);};var _0x4c378d=function(_0x1f39db){if(!_0x1f39db||!_0x1f39db[_0x75c5('0x67')][_0x75c5('0x3a')]){return'';}for(var _0x29414c='(',_0x29ac54=0x0;_0x29ac54<_0x1f39db[_0x75c5('0x67')]['length'];_0x29ac54+=0x1){_0x29ac54>0x0&&(_0x29414c+='\x20'+_0x1f39db[_0x75c5('0x8e')]+'\x20');_0x29414c+=_0x1f39db[_0x75c5('0x67')][_0x29ac54][_0x75c5('0x68')]?_0x4c378d(_0x1f39db['rules'][_0x29ac54]['group']):_0x1f39db[_0x75c5('0x67')][_0x29ac54][_0x75c5('0x69')]+'\x20'+_0x1f39db[_0x75c5('0x67')][_0x29ac54]['condition']+(_0x28f5d8(_0x1f39db[_0x75c5('0x67')][_0x29ac54]['condition'])?'\x20'+_0x1f39db[_0x75c5('0x67')][_0x29ac54][_0x75c5('0x6b')]:'');}return _0x29414c+')';};var _0x46f56d={'where':{'id':_0x2d3f6f['id']}},_0xe8dc14,_0x3ce61b,_0x4605de,_0x4557c8,_0x25245a;_0x46f56d=_[_0x75c5('0x41')]({},_0x46f56d,_0x4da75f);return db[_0x75c5('0x2f')][_0x75c5('0x53')](_0x46f56d)['then'](function(_0x92080e){if(_0x92080e){_0xe8dc14=_0x92080e;return _0x92080e[_0x75c5('0x6c')]();}return null;})[_0x75c5('0x29')](function(_0x4400d8){if(_0x4400d8){if(!_0x4400d8['length']){throw new db['Sequelize'][(_0x75c5('0x6e'))](_0x75c5('0x6f'),0x193);}_0x3ce61b=_0x4400d8;return db[_0x75c5('0x8f')][_0x75c5('0x47')]({'raw':!![]});}return null;})[_0x75c5('0x29')](function(_0x375e2c){if(_0x375e2c){_0x4605de=_[_0x75c5('0x70')](_0x375e2c,'id');var _0x250d08;var _0x1a2662=squel['select']();_0x1a2662[_0x75c5('0x90')](_0xe8dc14['table']);for(var _0x19a282=0x0;_0x19a282<_0x3ce61b[_0x75c5('0x3a')];_0x19a282+=0x1){_0x250d08=_0x3ce61b[_0x19a282][_0x75c5('0x73')]?_0x4605de[_0x3ce61b[_0x19a282][_0x75c5('0x73')]][_0x75c5('0x74')]:_0x3ce61b[_0x19a282][_0x75c5('0x69')];_0x250d08=_0x3ce61b[_0x19a282]['function']?_['replace'](_0x593eb0[_0x3ce61b[_0x19a282][_0x75c5('0x76')]],'%s',_0x250d08):_0x250d08;_0x250d08=_0x3ce61b[_0x19a282][_0x75c5('0x7f')]?_[_0x75c5('0x75')](_0x1b3be4[_0x3ce61b[_0x19a282][_0x75c5('0x7f')]],'%s',_0x250d08):_0x250d08;if(_0x3ce61b[_0x19a282][_0x75c5('0x77')]){_0x1a2662['group'](_0x250d08);}_0x3ce61b[_0x19a282]['orderBy']&&_0x1a2662['order'](_0x250d08,_0x3ce61b[_0x19a282][_0x75c5('0x78')]===_0x75c5('0x79')?![]:!![]);_0x1a2662['field'](_0x250d08,_0x3ce61b[_0x19a282][_0x75c5('0x7a')]||_0x250d08);}if(_0xe8dc14['joins']){_0xe8dc14[_0x75c5('0x7b')]=JSON['parse'](_0xe8dc14[_0x75c5('0x7b')]);for(var _0x3fe894=0x0;_0x3fe894<_0xe8dc14['joins'][_0x75c5('0x3a')];_0x3fe894+=0x1){if(_0xe8dc14['joins'][_0x3fe894][_0x75c5('0x32')]&&_[_0x75c5('0x63')](_0x1ab574,_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x32')])&&_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x7d')]&&_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x7e')]&&_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x81')]){_0x1a2662[_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x32')]](_0xe8dc14['joins'][_0x3fe894][_0x75c5('0x7e')],null,util[_0x75c5('0x7f')](_0x75c5('0x80'),_0xe8dc14[_0x75c5('0x72')],_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x7d')],_0xe8dc14[_0x75c5('0x7b')][_0x3fe894][_0x75c5('0x7e')],_0xe8dc14[_0x75c5('0x7b')][_0x3fe894]['foreignKey']));}}}if(_0xe8dc14[_0x75c5('0x82')]){_0xe8dc14[_0x75c5('0x82')]=JSON[_0x75c5('0x7c')](_0xe8dc14[_0x75c5('0x82')]);_0x1a2662[_0x75c5('0x3f')](_0x4c378d(_0xe8dc14['conditions'][_0x75c5('0x68')]));}_0x25245a=_0x1a2662[_0x75c5('0x83')]();_0x1a2662[_0x75c5('0x1c')](_0x488e67);_0x1a2662[_0x75c5('0x1f')](0x0);return;}})['then'](function(){if(_0x380182['output']===_0x75c5('0x91')){return null;}var _0x4bfa96=_['merge'](_0x380182,{'name':_0x380182[_0x75c5('0x92')]||_0x380182[_0x75c5('0x2c')]||_0xe8dc14['name'],'basename':_0x5181f0,'savename':util[_0x75c5('0x7f')](_0x75c5('0x93'),_0x380182[_0x75c5('0x2c')]||_0xe8dc14['name'],require(_0x75c5('0x94'))[_0x75c5('0x95')](0x4),_0x380182[_0x75c5('0x96')]||_0x75c5('0x97')),'reportId':_0xe8dc14['id'],'reportType':_0x75c5('0x98')});return db[_0x75c5('0x99')][_0x75c5('0x4c')](_0x4bfa96,{'raw':!![]});})[_0x75c5('0x29')](function(_0x10f22b){if(_0xe8dc14[_0x75c5('0x72')]===_0x75c5('0x9a')){_0x25245a['where'](_0xe8dc14[_0x75c5('0x72')]+_0x75c5('0x9b'),_0x380182[_0x75c5('0x9c')],_0x380182[_0x75c5('0x9d')]);}else{_0x25245a[_0x75c5('0x3f')](_0xe8dc14['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x380182['startDate'],_0x380182['endDate']);}if(_0x10f22b){logger[_0x75c5('0x9e')]('Run\x20Query:',_0x25245a['toString']());require(_0x75c5('0x9f'))['fork'](path[_0x75c5('0x56')](__dirname,_0x75c5('0xa0'),_0x10f22b['output']),[_0x10f22b['id'],_0x25245a[_0x75c5('0x87')](),path[_0x75c5('0x56')](__dirname,_0x75c5('0xa1'),_0x10f22b[_0x75c5('0xa2')]),_0x5181f0]);return _0x10f22b;}else{var _0x4e06c8=squel[_0x75c5('0x71')]();_0x4e06c8[_0x75c5('0x90')]('('+_0x25245a['toString']()+')',_0x75c5('0xa3'));_0x4e06c8[_0x75c5('0x69')](_0x75c5('0xa4'),_0x75c5('0x1e'));_0x25245a[_0x75c5('0x1c')](_0x380182['limit']||_0x488e67);_0x25245a[_0x75c5('0x1f')](_0x380182['offset']||0x0);return dbH[_0x75c5('0x86')]['query'](_0x4e06c8[_0x75c5('0x87')](),{'type':dbH['sequelize'][_0x75c5('0x88')]['SELECT']})[_0x75c5('0x29')](function(_0x3fde54){if(!_0x3fde54[_0x75c5('0x3a')]){_0x4557c8=0x0;}else{_0x4557c8=_0x3fde54[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x25245a['toString'](),{'type':dbH[_0x75c5('0x86')][_0x75c5('0x88')][_0x75c5('0xa5')]});})[_0x75c5('0x29')](function(_0x27ea5f){return{'rows':_0x27ea5f||[],'count':_0x4557c8};});}});}exports[_0x75c5('0xa6')]=function(_0x5b08fe,_0x205097){return runReport(_0x5b08fe['params'],_0x5b08fe[_0x75c5('0x35')],_0x5b08fe[_0x75c5('0x44')])[_0x75c5('0x29')](respondWithResult(_0x205097,null))[_0x75c5('0x48')](handleError(_0x205097,null));};exports['runReport']=runReport;exports[_0x75c5('0x35')]=function(_0xf8a985,_0x5cc756){var _0x14697d=0xa;var _0x116f0c=['join','left_join','right_join',_0x75c5('0x59')];var _0x41f126={'SUM':'SUM(%s)','COUNT':_0x75c5('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x75c5('0x8a'),'MIN':_0x75c5('0x8b'),'AVG':_0x75c5('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x75c5('0x5f')};var _0x2ab2a8={'SEC_TO_TIME':_0x75c5('0x8c'),'DATE':_0x75c5('0x60'),'HOUR':_0x75c5('0x8d'),'ROUND':_0x75c5('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1910b9=function(_0x172eb0){return!_['includes']([_0x75c5('0x64'),_0x75c5('0x65'),_0x75c5('0xa7'),_0x75c5('0x66')],_0x172eb0);};var _0x3e8d54=function(_0x242683){if(!_0x242683||!_0x242683[_0x75c5('0x67')][_0x75c5('0x3a')]){return'';}for(var _0xa30da4='(',_0x51718d=0x0;_0x51718d<_0x242683[_0x75c5('0x67')][_0x75c5('0x3a')];_0x51718d+=0x1){_0x51718d>0x0&&(_0xa30da4+='\x20'+_0x242683[_0x75c5('0x8e')]+'\x20');_0xa30da4+=_0x242683[_0x75c5('0x67')][_0x51718d][_0x75c5('0x68')]?_0x3e8d54(_0x242683[_0x75c5('0x67')][_0x51718d][_0x75c5('0x68')]):_0x242683['rules'][_0x51718d][_0x75c5('0x69')]+'\x20'+_0x242683[_0x75c5('0x67')][_0x51718d][_0x75c5('0x6a')]+(_0x1910b9(_0x242683[_0x75c5('0x67')][_0x51718d]['condition'])?'\x20'+_0x242683['rules'][_0x51718d]['value']:'');}return _0xa30da4+')';};var _0x4e53aa={'where':{'id':_0xf8a985['params']['id']}},_0x447008,_0x48ba61,_0x49c9dc,_0x36a907,_0x14847a;_0x4e53aa=_[_0x75c5('0x41')]({},_0x4e53aa,_0xf8a985['options']);return db[_0x75c5('0x2f')][_0x75c5('0x53')](_0x4e53aa)[_0x75c5('0x29')](function(_0x5f0000){if(_0x5f0000){_0x447008=_0x5f0000;return _0x5f0000['getFields']();}return null;})[_0x75c5('0x29')](function(_0x259bd2){if(_0x259bd2){if(!_0x259bd2[_0x75c5('0x3a')]){throw new db['Sequelize'][(_0x75c5('0x6e'))](_0x75c5('0x6f'),0x193);}_0x48ba61=_0x259bd2;return db[_0x75c5('0x8f')][_0x75c5('0x47')]({'raw':!![]});}return null;})[_0x75c5('0x29')](function(_0x81b61f){if(_0x81b61f){_0x49c9dc=_[_0x75c5('0x70')](_0x81b61f,'id');var _0x79e9ad;var _0xf47670=squel['select']();_0xf47670['from'](_0x447008[_0x75c5('0x72')]);for(var _0x3a7f43=0x0;_0x3a7f43<_0x48ba61[_0x75c5('0x3a')];_0x3a7f43+=0x1){_0x79e9ad=_0x48ba61[_0x3a7f43]['MetricId']?_0x49c9dc[_0x48ba61[_0x3a7f43][_0x75c5('0x73')]][_0x75c5('0x74')]:_0x48ba61[_0x3a7f43][_0x75c5('0x69')];_0x79e9ad=_0x48ba61[_0x3a7f43]['function']?_[_0x75c5('0x75')](_0x41f126[_0x48ba61[_0x3a7f43][_0x75c5('0x76')]],'%s',_0x79e9ad):_0x79e9ad;_0x79e9ad=_0x48ba61[_0x3a7f43][_0x75c5('0x7f')]?_['replace'](_0x2ab2a8[_0x48ba61[_0x3a7f43][_0x75c5('0x7f')]],'%s',_0x79e9ad):_0x79e9ad;if(_0x48ba61[_0x3a7f43][_0x75c5('0x77')]){_0xf47670[_0x75c5('0x68')](_0x79e9ad);}_0x48ba61[_0x3a7f43][_0x75c5('0x78')]&&_0xf47670['order'](_0x79e9ad,_0x48ba61[_0x3a7f43]['orderBy']===_0x75c5('0x79')?![]:!![]);_0xf47670['field'](_0x79e9ad,_0x48ba61[_0x3a7f43][_0x75c5('0x7a')]||_0x79e9ad);}if(_0x447008[_0x75c5('0x7b')]){_0x447008[_0x75c5('0x7b')]=JSON[_0x75c5('0x7c')](_0x447008[_0x75c5('0x7b')]);for(var _0x1caa80=0x0;_0x1caa80<_0x447008[_0x75c5('0x7b')][_0x75c5('0x3a')];_0x1caa80+=0x1){if(_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x32')]&&_[_0x75c5('0x63')](_0x116f0c,_0x447008[_0x75c5('0x7b')][_0x1caa80]['type'])&&_0x447008['joins'][_0x1caa80][_0x75c5('0x7d')]&&_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x7e')]&&_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x81')]){_0xf47670[_0x447008[_0x75c5('0x7b')][_0x1caa80]['type']](_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x7e')],null,util[_0x75c5('0x7f')](_0x75c5('0x80'),_0x447008[_0x75c5('0x72')],_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x7d')],_0x447008['joins'][_0x1caa80][_0x75c5('0x7e')],_0x447008[_0x75c5('0x7b')][_0x1caa80][_0x75c5('0x81')]));}}}if(_0x447008[_0x75c5('0x82')]){_0x447008[_0x75c5('0x82')]=JSON['parse'](_0x447008['conditions']);_0xf47670[_0x75c5('0x3f')](_0x3e8d54(_0x447008[_0x75c5('0x82')][_0x75c5('0x68')]));}_0x14847a=_0xf47670['clone']();_0xf47670['limit'](_0x14697d);_0xf47670[_0x75c5('0x1f')](0x0);logger[_0x75c5('0x84')](_0x75c5('0x85'),_0xf47670[_0x75c5('0x87')]());return dbH[_0x75c5('0x86')][_0x75c5('0x35')](_0xf47670[_0x75c5('0x87')](),{'type':dbH[_0x75c5('0x86')][_0x75c5('0x88')][_0x75c5('0xa5')]});}})['then'](function(){return{'sql':_0x14847a[_0x75c5('0x87')]()};})['then'](respondWithResult(_0x5cc756,null))['catch'](handleError(_0x5cc756,null));}; \ No newline at end of file +var _0x6890=['body','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','AVG(%s)','DATE(%s)','IS\x20EMPTY','getFields','from','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','join','../../components/export/','savename','countTable','COUNT(*)','run','clone','SELECT','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','CustomReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','findAll','rows','catch','params','length','include','find','create','user','get','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5b7ef6,_0x3e5212){var _0x27d038=function(_0x3db34e){while(--_0x3db34e){_0x5b7ef6['push'](_0x5b7ef6['shift']());}};_0x27d038(++_0x3e5212);}(_0x6890,0xf7));var _0x0689=function(_0x3482da,_0x347b50){_0x3482da=_0x3482da-0x0;var _0x27adfe=_0x6890[_0x3482da];return _0x27adfe;};'use strict';var emlformat=require(_0x0689('0x0'));var rimraf=require(_0x0689('0x1'));var zipdir=require(_0x0689('0x2'));var jsonpatch=require(_0x0689('0x3'));var rp=require('request-promise');var moment=require(_0x0689('0x4'));var BPromise=require(_0x0689('0x5'));var Mustache=require(_0x0689('0x6'));var util=require(_0x0689('0x7'));var path=require('path');var sox=require(_0x0689('0x8'));var csv=require(_0x0689('0x9'));var ejs=require(_0x0689('0xa'));var fs=require('fs');var fs_extra=require(_0x0689('0xb'));var _=require(_0x0689('0xc'));var squel=require(_0x0689('0xd'));var crypto=require(_0x0689('0xe'));var jsforce=require(_0x0689('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0689('0x9'));var querystring=require(_0x0689('0x10'));var Papa=require(_0x0689('0x11'));var Redis=require(_0x0689('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0689('0x13'));var as=require(_0x0689('0x14'));var hardwareService=require(_0x0689('0x15'));var logger=require('../../config/logger')(_0x0689('0x16'));var utils=require(_0x0689('0x17'));var config=require(_0x0689('0x18'));var licenseUtil=require(_0x0689('0x19'));var db=require(_0x0689('0x1a'))['db'];var dbH=require(_0x0689('0x1a'))[_0x0689('0x1b')];function respondWithStatusCode(_0x51b527,_0x17bef7){_0x17bef7=_0x17bef7||0xcc;return function(_0x491cbb){if(_0x491cbb){return _0x51b527[_0x0689('0x1c')](_0x17bef7);}return _0x51b527[_0x0689('0x1d')](_0x17bef7)[_0x0689('0x1e')]();};}function respondWithResult(_0x3ffc37,_0x433d17){_0x433d17=_0x433d17||0xc8;return function(_0x49a1d5){if(_0x49a1d5){return _0x3ffc37[_0x0689('0x1d')](_0x433d17)[_0x0689('0x1f')](_0x49a1d5);}};}function respondWithFilteredResult(_0x14eed3,_0x1d1de6){return function(_0x48f2f1){if(_0x48f2f1){var _0x391897=typeof _0x1d1de6[_0x0689('0x20')]===_0x0689('0x21')&&typeof _0x1d1de6[_0x0689('0x22')]==='undefined';var _0x25a124=_0x48f2f1['count'];var _0x376b66=_0x391897?0x0:_0x1d1de6[_0x0689('0x20')];var _0x87b6a0=_0x391897?_0x48f2f1[_0x0689('0x23')]:_0x1d1de6[_0x0689('0x20')]+_0x1d1de6['limit'];var _0x258e63;if(_0x87b6a0>=_0x25a124){_0x87b6a0=_0x25a124;_0x258e63=0xc8;}else{_0x258e63=0xce;}_0x14eed3[_0x0689('0x1d')](_0x258e63);return _0x14eed3['set'](_0x0689('0x24'),_0x376b66+'-'+_0x87b6a0+'/'+_0x25a124)[_0x0689('0x1f')](_0x48f2f1);}return null;};}function patchUpdates(_0x2431ab){return function(_0x11b668){try{jsonpatch[_0x0689('0x25')](_0x11b668,_0x2431ab,!![]);}catch(_0x11623d){return BPromise[_0x0689('0x26')](_0x11623d);}return _0x11b668['save']();};}function saveUpdates(_0x414a5f,_0x341978){return function(_0x58846f){if(_0x58846f){return _0x58846f[_0x0689('0x27')](_0x414a5f)['then'](function(_0x25765c){return _0x25765c;});}return null;};}function removeEntity(_0x3926d8,_0x3c648f){return function(_0x73113e){if(_0x73113e){return _0x73113e[_0x0689('0x28')]()[_0x0689('0x29')](function(){var _0x3e5c95=_0x73113e['get']({'plain':!![]});var _0x4bdf11=_0x0689('0x2a');return db[_0x0689('0x2b')][_0x0689('0x28')]({'where':{'type':_0x4bdf11,'resourceId':_0x3e5c95['id']}})[_0x0689('0x29')](function(){return _0x73113e;});})[_0x0689('0x29')](function(){_0x3926d8[_0x0689('0x1d')](0xcc)[_0x0689('0x1e')]();});}};}function handleEntityNotFound(_0x16f459,_0x47c840){return function(_0x34a21f){if(!_0x34a21f){_0x16f459['sendStatus'](0x194);}return _0x34a21f;};}function handleError(_0x5381f7,_0x4acef0){_0x4acef0=_0x4acef0||0x1f4;return function(_0x417b9e){logger[_0x0689('0x2c')](_0x417b9e[_0x0689('0x2d')]);if(_0x417b9e[_0x0689('0x2e')]){delete _0x417b9e[_0x0689('0x2e')];}_0x5381f7[_0x0689('0x1d')](_0x4acef0)[_0x0689('0x2f')](_0x417b9e);};}exports[_0x0689('0x30')]=function(_0x4a7be4,_0x1e2208){var _0x436327={},_0xa8a557={},_0x5a4e0a={'count':0x0,'rows':[]};var _0x3dbe57=_[_0x0689('0x31')](db['AnalyticCustomReport'][_0x0689('0x32')],function(_0x23cca4){return{'name':_0x23cca4[_0x0689('0x33')],'type':_0x23cca4[_0x0689('0x34')][_0x0689('0x35')]};});_0xa8a557[_0x0689('0x36')]=_[_0x0689('0x31')](_0x3dbe57,_0x0689('0x2e'));_0xa8a557[_0x0689('0x37')]=_[_0x0689('0x38')](_0x4a7be4[_0x0689('0x37')]);_0xa8a557['filters']=_[_0x0689('0x39')](_0xa8a557[_0x0689('0x36')],_0xa8a557[_0x0689('0x37')]);_0x436327[_0x0689('0x3a')]=_[_0x0689('0x39')](_0xa8a557[_0x0689('0x36')],qs[_0x0689('0x3b')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x3b')]));_0x436327[_0x0689('0x3a')]=_0x436327[_0x0689('0x3a')]['length']?_0x436327[_0x0689('0x3a')]:_0xa8a557[_0x0689('0x36')];if(!_0x4a7be4['query'][_0x0689('0x3c')](_0x0689('0x3d'))){_0x436327[_0x0689('0x22')]=qs[_0x0689('0x22')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x22')]);_0x436327['offset']=qs[_0x0689('0x20')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x20')]);}_0x436327['order']=qs[_0x0689('0x3e')](_0x4a7be4[_0x0689('0x37')][_0x0689('0x3e')]);_0x436327['where']=qs[_0x0689('0x3f')](_[_0x0689('0x40')](_0x4a7be4[_0x0689('0x37')],_0xa8a557['filters']),_0x3dbe57);if(_0x4a7be4[_0x0689('0x37')][_0x0689('0x41')]){_0x436327[_0x0689('0x42')]=_[_0x0689('0x43')](_0x436327[_0x0689('0x42')],{'$or':_['map'](_0x3dbe57,function(_0x32e27c){if(_0x32e27c[_0x0689('0x34')]!==_0x0689('0x44')){var _0xac3ddb={};_0xac3ddb[_0x32e27c[_0x0689('0x2e')]]={'$like':'%'+_0x4a7be4[_0x0689('0x37')][_0x0689('0x41')]+'%'};return _0xac3ddb;}})});}_0x436327=_[_0x0689('0x43')]({},_0x436327,_0x4a7be4[_0x0689('0x45')]);var _0x6f56b0={'where':_0x436327[_0x0689('0x42')]};return db[_0x0689('0x46')][_0x0689('0x23')](_0x6f56b0)[_0x0689('0x29')](function(_0xd7116d){_0x5a4e0a['count']=_0xd7116d;if(_0x4a7be4['query'][_0x0689('0x47')]){_0x436327['include']=[{'all':!![]}];}return db[_0x0689('0x46')][_0x0689('0x48')](_0x436327);})['then'](function(_0x1ece44){_0x5a4e0a[_0x0689('0x49')]=_0x1ece44;return _0x5a4e0a;})[_0x0689('0x29')](respondWithFilteredResult(_0x1e2208,_0x436327))[_0x0689('0x4a')](handleError(_0x1e2208,null));};exports['show']=function(_0x116897,_0x108267){var _0x4bf869={'raw':![],'where':{'id':_0x116897[_0x0689('0x4b')]['id']}},_0x56990c={};_0x56990c[_0x0689('0x36')]=_[_0x0689('0x38')](db[_0x0689('0x46')]['rawAttributes']);_0x56990c[_0x0689('0x37')]=_[_0x0689('0x38')](_0x116897[_0x0689('0x37')]);_0x56990c[_0x0689('0x3f')]=_['intersection'](_0x56990c[_0x0689('0x36')],_0x56990c['query']);_0x4bf869[_0x0689('0x3a')]=_[_0x0689('0x39')](_0x56990c[_0x0689('0x36')],qs[_0x0689('0x3b')](_0x116897[_0x0689('0x37')][_0x0689('0x3b')]));_0x4bf869['attributes']=_0x4bf869[_0x0689('0x3a')][_0x0689('0x4c')]?_0x4bf869['attributes']:_0x56990c[_0x0689('0x36')];if(_0x116897['query'][_0x0689('0x47')]){_0x4bf869[_0x0689('0x4d')]=[{'all':!![]}];}_0x4bf869=_[_0x0689('0x43')]({},_0x4bf869,_0x116897['options']);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x4bf869)[_0x0689('0x29')](handleEntityNotFound(_0x108267,null))[_0x0689('0x29')](respondWithResult(_0x108267,null))['catch'](handleError(_0x108267,null));};exports[_0x0689('0x4f')]=function(_0x2c36bf,_0x200195){return db[_0x0689('0x46')][_0x0689('0x4f')](_0x2c36bf['body'],{})[_0x0689('0x29')](function(_0x3d2c64){var _0x456f36=_0x2c36bf[_0x0689('0x50')][_0x0689('0x51')]({'plain':!![]});if(!_0x456f36)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456f36[_0x0689('0x52')]===_0x0689('0x50')){var _0x1808a3=_0x3d2c64[_0x0689('0x51')]({'plain':!![]});var _0x2ee3e5=_0x0689('0x53');return db[_0x0689('0x54')][_0x0689('0x4e')]({'where':{'name':_0x2ee3e5,'userProfileId':_0x456f36[_0x0689('0x55')]},'raw':!![]})[_0x0689('0x29')](function(_0x9155af){if(_0x9155af&&_0x9155af['autoAssociation']===0x0){return db[_0x0689('0x2b')]['create']({'name':_0x1808a3[_0x0689('0x2e')],'resourceId':_0x1808a3['id'],'type':'CustomReports','sectionId':_0x9155af['id']},{})[_0x0689('0x29')](function(){return _0x3d2c64;});}else{return _0x3d2c64;}})['catch'](function(_0x34a7eb){logger['error'](_0x0689('0x56'),_0x34a7eb);throw _0x34a7eb;});}return _0x3d2c64;})[_0x0689('0x29')](respondWithResult(_0x200195,0xc9))[_0x0689('0x4a')](handleError(_0x200195,null));};exports[_0x0689('0x27')]=function(_0x2fb8fa,_0xf666c7){if(_0x2fb8fa[_0x0689('0x57')]['id']){delete _0x2fb8fa['body']['id'];}return db['AnalyticCustomReport'][_0x0689('0x4e')]({'where':{'id':_0x2fb8fa[_0x0689('0x4b')]['id']}})[_0x0689('0x29')](handleEntityNotFound(_0xf666c7,null))[_0x0689('0x29')](saveUpdates(_0x2fb8fa[_0x0689('0x57')],null))[_0x0689('0x29')](respondWithResult(_0xf666c7,null))[_0x0689('0x4a')](handleError(_0xf666c7,null));};exports[_0x0689('0x28')]=function(_0x42543b,_0x3ca834){return db['AnalyticCustomReport'][_0x0689('0x4e')]({'where':{'id':_0x42543b[_0x0689('0x4b')]['id']}})[_0x0689('0x29')](handleEntityNotFound(_0x3ca834,null))['then'](removeEntity(_0x3ca834,null))[_0x0689('0x4a')](handleError(_0x3ca834,null));};exports['preview']=function(_0x8412ed,_0x3caec0){var _0x5a7884=0xa;var _0x196a1d=['join',_0x0689('0x58'),_0x0689('0x59'),_0x0689('0x5a')];var _0xb66604={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':'MAX(%s)','MIN':_0x0689('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':_0x0689('0x60')};var _0x4b4723={'SEC_TO_TIME':_0x0689('0x61'),'DATE':'DATE(%s)','HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x3e3f32=function(_0x6a5f5a){return!_[_0x0689('0x65')]([_0x0689('0x66'),_0x0689('0x67'),'IS\x20EMPTY',_0x0689('0x68')],_0x6a5f5a);};var _0x5489eb=function(_0x3db2c1){if(!_0x3db2c1||!_0x3db2c1[_0x0689('0x69')][_0x0689('0x4c')]){return'';}for(var _0x58b3eb='(',_0x90ca1f=0x0;_0x90ca1f<_0x3db2c1['rules']['length'];_0x90ca1f+=0x1){_0x90ca1f>0x0&&(_0x58b3eb+='\x20'+_0x3db2c1[_0x0689('0x6a')]+'\x20');_0x58b3eb+=_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6b')]?_0x5489eb(_0x3db2c1['rules'][_0x90ca1f][_0x0689('0x6b')]):_0x3db2c1['rules'][_0x90ca1f][_0x0689('0x6c')]+'\x20'+_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6d')]+(_0x3e3f32(_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6d')])?'\x20'+_0x3db2c1[_0x0689('0x69')][_0x90ca1f][_0x0689('0x6e')]:'');}return _0x58b3eb+')';};var _0x56cad={'where':{'id':_0x8412ed[_0x0689('0x4b')]['id']}},_0x9bddef,_0x4492e5,_0x58bd66,_0x210fe9,_0x3439a8;_0x56cad=_[_0x0689('0x43')]({},_0x56cad,_0x8412ed['options']);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x56cad)['then'](function(_0xa55db9){if(_0xa55db9){_0x9bddef=_0xa55db9;return _0xa55db9['getFields']();}return null;})['then'](function(_0x4b070b){if(_0x4b070b){if(!_0x4b070b[_0x0689('0x4c')]){throw new db['Sequelize'][(_0x0689('0x6f'))](_0x0689('0x70'),0x193);}_0x4492e5=_0x4b070b;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x3e8a69){if(_0x3e8a69){_0x58bd66=_[_0x0689('0x72')](_0x3e8a69,'id');var _0x2c0694;var _0x93d21e=squel[_0x0689('0x73')]();_0x93d21e['from'](_0x9bddef[_0x0689('0x74')]);for(var _0x23de56=0x0;_0x23de56<_0x4492e5[_0x0689('0x4c')];_0x23de56+=0x1){_0x2c0694=_0x4492e5[_0x23de56]['MetricId']?_0x58bd66[_0x4492e5[_0x23de56][_0x0689('0x75')]][_0x0689('0x76')]:_0x4492e5[_0x23de56][_0x0689('0x6c')];_0x2c0694=_0x4492e5[_0x23de56][_0x0689('0x77')]?_['replace'](_0xb66604[_0x4492e5[_0x23de56]['function']],'%s',_0x2c0694):_0x2c0694;_0x2c0694=_0x4492e5[_0x23de56][_0x0689('0x78')]?_[_0x0689('0x79')](_0x4b4723[_0x4492e5[_0x23de56][_0x0689('0x78')]],'%s',_0x2c0694):_0x2c0694;if(_0x4492e5[_0x23de56][_0x0689('0x7a')]){_0x93d21e['group'](_0x2c0694);}_0x4492e5[_0x23de56][_0x0689('0x7b')]&&_0x93d21e[_0x0689('0x7c')](_0x2c0694,_0x4492e5[_0x23de56][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0x93d21e[_0x0689('0x6c')](_0x2c0694,_0x4492e5[_0x23de56][_0x0689('0x7e')]||_0x2c0694);}if(_0x9bddef['joins']){_0x9bddef[_0x0689('0x7f')]=JSON[_0x0689('0x80')](_0x9bddef[_0x0689('0x7f')]);for(var _0x46eff7=0x0;_0x46eff7<_0x9bddef['joins'][_0x0689('0x4c')];_0x46eff7+=0x1){if(_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x34')]&&_[_0x0689('0x65')](_0x196a1d,_0x9bddef['joins'][_0x46eff7][_0x0689('0x34')])&&_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x81')]&&_0x9bddef[_0x0689('0x7f')][_0x46eff7]['foreignTable']&&_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x82')]){_0x93d21e[_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x34')]](_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x9bddef[_0x0689('0x74')],_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x81')],_0x9bddef[_0x0689('0x7f')][_0x46eff7][_0x0689('0x83')],_0x9bddef['joins'][_0x46eff7]['foreignKey']));}}}if(_0x9bddef['conditions']){_0x9bddef[_0x0689('0x85')]=JSON[_0x0689('0x80')](_0x9bddef['conditions']);_0x93d21e['where'](_0x5489eb(_0x9bddef[_0x0689('0x85')][_0x0689('0x6b')]));}_0x3439a8=_0x93d21e['clone']();_0x93d21e[_0x0689('0x22')](_0x5a7884);_0x93d21e[_0x0689('0x20')](0x0);logger[_0x0689('0x86')](_0x0689('0x87'),_0x93d21e[_0x0689('0x88')]());return dbH[_0x0689('0x89')][_0x0689('0x37')](_0x93d21e[_0x0689('0x88')](),{'type':dbH['sequelize'][_0x0689('0x8a')]['SELECT']});}})[_0x0689('0x29')](respondWithResult(_0x3caec0,null))[_0x0689('0x4a')](handleError(_0x3caec0,null));};function runReport(_0x2c68d7,_0x39ffcb,_0x30af2c){var _0x1823f5=_0x39ffcb[_0x0689('0x2e')];var _0x369bb3=0xa;var _0x108596=['join',_0x0689('0x58'),'right_join',_0x0689('0x5a')];var _0x1a368e={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':_0x0689('0x8b'),'MIN':_0x0689('0x5d'),'AVG':_0x0689('0x8c'),'GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':_0x0689('0x60')};var _0x5d4245={'SEC_TO_TIME':_0x0689('0x61'),'DATE':_0x0689('0x8d'),'HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x230388=function(_0x3fcf08){return!_['includes']([_0x0689('0x66'),_0x0689('0x67'),_0x0689('0x8e'),_0x0689('0x68')],_0x3fcf08);};var _0x1932d9=function(_0x12fb77){if(!_0x12fb77||!_0x12fb77['rules'][_0x0689('0x4c')]){return'';}for(var _0x13995d='(',_0x2d8285=0x0;_0x2d8285<_0x12fb77[_0x0689('0x69')][_0x0689('0x4c')];_0x2d8285+=0x1){_0x2d8285>0x0&&(_0x13995d+='\x20'+_0x12fb77['operator']+'\x20');_0x13995d+=_0x12fb77[_0x0689('0x69')][_0x2d8285]['group']?_0x1932d9(_0x12fb77[_0x0689('0x69')][_0x2d8285][_0x0689('0x6b')]):_0x12fb77[_0x0689('0x69')][_0x2d8285]['field']+'\x20'+_0x12fb77[_0x0689('0x69')][_0x2d8285]['condition']+(_0x230388(_0x12fb77[_0x0689('0x69')][_0x2d8285]['condition'])?'\x20'+_0x12fb77['rules'][_0x2d8285][_0x0689('0x6e')]:'');}return _0x13995d+')';};var _0x55a112={'where':{'id':_0x2c68d7['id']}},_0x5dc22c,_0x4a5f01,_0x180184,_0x2f7678,_0x39ff2f;_0x55a112=_['merge']({},_0x55a112,_0x30af2c);return db[_0x0689('0x46')][_0x0689('0x4e')](_0x55a112)[_0x0689('0x29')](function(_0x4f264a){if(_0x4f264a){_0x5dc22c=_0x4f264a;return _0x4f264a[_0x0689('0x8f')]();}return null;})['then'](function(_0x366c61){if(_0x366c61){if(!_0x366c61[_0x0689('0x4c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x0689('0x70'),0x193);}_0x4a5f01=_0x366c61;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x44ea35){if(_0x44ea35){_0x180184=_[_0x0689('0x72')](_0x44ea35,'id');var _0x342404;var _0x6331dc=squel[_0x0689('0x73')]();_0x6331dc[_0x0689('0x90')](_0x5dc22c[_0x0689('0x74')]);for(var _0x10d9a6=0x0;_0x10d9a6<_0x4a5f01[_0x0689('0x4c')];_0x10d9a6+=0x1){_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x75')]?_0x180184[_0x4a5f01[_0x10d9a6][_0x0689('0x75')]][_0x0689('0x76')]:_0x4a5f01[_0x10d9a6][_0x0689('0x6c')];_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x77')]?_[_0x0689('0x79')](_0x1a368e[_0x4a5f01[_0x10d9a6]['function']],'%s',_0x342404):_0x342404;_0x342404=_0x4a5f01[_0x10d9a6][_0x0689('0x78')]?_['replace'](_0x5d4245[_0x4a5f01[_0x10d9a6][_0x0689('0x78')]],'%s',_0x342404):_0x342404;if(_0x4a5f01[_0x10d9a6][_0x0689('0x7a')]){_0x6331dc[_0x0689('0x6b')](_0x342404);}_0x4a5f01[_0x10d9a6][_0x0689('0x7b')]&&_0x6331dc[_0x0689('0x7c')](_0x342404,_0x4a5f01[_0x10d9a6][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0x6331dc[_0x0689('0x6c')](_0x342404,_0x4a5f01[_0x10d9a6][_0x0689('0x7e')]||_0x342404);}if(_0x5dc22c[_0x0689('0x7f')]){_0x5dc22c[_0x0689('0x7f')]=JSON['parse'](_0x5dc22c[_0x0689('0x7f')]);for(var _0x4c77fd=0x0;_0x4c77fd<_0x5dc22c['joins'][_0x0689('0x4c')];_0x4c77fd+=0x1){if(_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')]&&_['includes'](_0x108596,_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')])&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x81')]&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd]['foreignTable']&&_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x82')]){_0x6331dc[_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x34')]](_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x5dc22c[_0x0689('0x74')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x81')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x83')],_0x5dc22c[_0x0689('0x7f')][_0x4c77fd][_0x0689('0x82')]));}}}if(_0x5dc22c[_0x0689('0x85')]){_0x5dc22c['conditions']=JSON[_0x0689('0x80')](_0x5dc22c[_0x0689('0x85')]);_0x6331dc[_0x0689('0x42')](_0x1932d9(_0x5dc22c['conditions']['group']));}_0x39ff2f=_0x6331dc['clone']();_0x6331dc[_0x0689('0x22')](_0x369bb3);_0x6331dc[_0x0689('0x20')](0x0);return;}})[_0x0689('0x29')](function(){if(_0x39ffcb[_0x0689('0x91')]===_0x0689('0x92')){return null;}var _0x5f4fc0=_['merge'](_0x39ffcb,{'name':_0x39ffcb[_0x0689('0x93')]||_0x39ffcb[_0x0689('0x2e')]||_0x5dc22c[_0x0689('0x2e')],'basename':_0x1823f5,'savename':util[_0x0689('0x78')](_0x0689('0x94'),_0x39ffcb['name']||_0x5dc22c[_0x0689('0x2e')],require(_0x0689('0x95'))[_0x0689('0x96')](0x4),_0x39ffcb['output']||'csv'),'reportId':_0x5dc22c['id'],'reportType':_0x0689('0x97')});return db[_0x0689('0x98')][_0x0689('0x4f')](_0x5f4fc0,{'raw':!![]});})[_0x0689('0x29')](function(_0x4f20fe){if(_0x5dc22c[_0x0689('0x74')]==='cdr'){_0x39ff2f[_0x0689('0x42')](_0x5dc22c[_0x0689('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x39ffcb[_0x0689('0x99')],_0x39ffcb[_0x0689('0x9a')]);}else{_0x39ff2f[_0x0689('0x42')](_0x5dc22c[_0x0689('0x74')]+_0x0689('0x9b'),_0x39ffcb[_0x0689('0x99')],_0x39ffcb[_0x0689('0x9a')]);}if(_0x4f20fe){logger[_0x0689('0x9c')](_0x0689('0x9d'),_0x39ff2f[_0x0689('0x88')]());require(_0x0689('0x9e'))['fork'](path[_0x0689('0x9f')](__dirname,_0x0689('0xa0'),_0x4f20fe['output']),[_0x4f20fe['id'],_0x39ff2f[_0x0689('0x88')](),path[_0x0689('0x9f')](__dirname,'../../files/reports',_0x4f20fe[_0x0689('0xa1')]),_0x1823f5]);return _0x4f20fe;}else{var _0x4d3847=squel['select']();_0x4d3847[_0x0689('0x90')]('('+_0x39ff2f['toString']()+')',_0x0689('0xa2'));_0x4d3847['field'](_0x0689('0xa3'),'count');_0x39ff2f['limit'](_0x39ffcb['limit']||_0x369bb3);_0x39ff2f[_0x0689('0x20')](_0x39ffcb['offset']||0x0);return dbH[_0x0689('0x89')][_0x0689('0x37')](_0x4d3847[_0x0689('0x88')](),{'type':dbH[_0x0689('0x89')][_0x0689('0x8a')]['SELECT']})['then'](function(_0x2c263b){if(!_0x2c263b[_0x0689('0x4c')]){_0x2f7678=0x0;}else{_0x2f7678=_0x2c263b[0x0][_0x0689('0x23')]||0x0;}return dbH[_0x0689('0x89')]['query'](_0x39ff2f['toString'](),{'type':dbH['sequelize'][_0x0689('0x8a')]['SELECT']});})[_0x0689('0x29')](function(_0x5914dc){return{'rows':_0x5914dc||[],'count':_0x2f7678};});}});}exports[_0x0689('0xa4')]=function(_0x1c17a5,_0x57009f){return runReport(_0x1c17a5['params'],_0x1c17a5[_0x0689('0x37')],_0x1c17a5[_0x0689('0x45')])[_0x0689('0x29')](respondWithResult(_0x57009f,null))[_0x0689('0x4a')](handleError(_0x57009f,null));};exports['runReport']=runReport;exports[_0x0689('0x37')]=function(_0x3d3333,_0x4dd34){var _0x459b51=0xa;var _0x505499=[_0x0689('0x9f'),_0x0689('0x58'),'right_join',_0x0689('0x5a')];var _0x203e84={'SUM':_0x0689('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0689('0x5c'),'MAX':_0x0689('0x8b'),'MIN':_0x0689('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0689('0x5e'),'GROUP_CONCAT ASC':_0x0689('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xef506b={'SEC_TO_TIME':_0x0689('0x61'),'DATE':_0x0689('0x8d'),'HOUR':_0x0689('0x62'),'ROUND':_0x0689('0x63'),'UNIX_TIMESTAMP':_0x0689('0x64')};var _0x12d0a6=function(_0x44e7d0){return!_['includes']([_0x0689('0x66'),_0x0689('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x44e7d0);};var _0x4702b8=function(_0x333441){if(!_0x333441||!_0x333441[_0x0689('0x69')][_0x0689('0x4c')]){return'';}for(var _0x5d7128='(',_0x29c2ac=0x0;_0x29c2ac<_0x333441[_0x0689('0x69')][_0x0689('0x4c')];_0x29c2ac+=0x1){_0x29c2ac>0x0&&(_0x5d7128+='\x20'+_0x333441[_0x0689('0x6a')]+'\x20');_0x5d7128+=_0x333441['rules'][_0x29c2ac][_0x0689('0x6b')]?_0x4702b8(_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6b')]):_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6c')]+'\x20'+_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6d')]+(_0x12d0a6(_0x333441[_0x0689('0x69')][_0x29c2ac][_0x0689('0x6d')])?'\x20'+_0x333441[_0x0689('0x69')][_0x29c2ac]['value']:'');}return _0x5d7128+')';};var _0x47d1c6={'where':{'id':_0x3d3333[_0x0689('0x4b')]['id']}},_0x5d70b8,_0x290f1a,_0xda2413,_0x86943a,_0x2619e2;_0x47d1c6=_['merge']({},_0x47d1c6,_0x3d3333[_0x0689('0x45')]);return db[_0x0689('0x46')]['find'](_0x47d1c6)[_0x0689('0x29')](function(_0x57b80f){if(_0x57b80f){_0x5d70b8=_0x57b80f;return _0x57b80f['getFields']();}return null;})[_0x0689('0x29')](function(_0x1a8e34){if(_0x1a8e34){if(!_0x1a8e34[_0x0689('0x4c')]){throw new db['Sequelize'][(_0x0689('0x6f'))](_0x0689('0x70'),0x193);}_0x290f1a=_0x1a8e34;return db[_0x0689('0x71')][_0x0689('0x48')]({'raw':!![]});}return null;})[_0x0689('0x29')](function(_0x3fd0fe){if(_0x3fd0fe){_0xda2413=_[_0x0689('0x72')](_0x3fd0fe,'id');var _0x1121fb;var _0xbebfe5=squel[_0x0689('0x73')]();_0xbebfe5[_0x0689('0x90')](_0x5d70b8[_0x0689('0x74')]);for(var _0x13f589=0x0;_0x13f589<_0x290f1a['length'];_0x13f589+=0x1){_0x1121fb=_0x290f1a[_0x13f589][_0x0689('0x75')]?_0xda2413[_0x290f1a[_0x13f589]['MetricId']][_0x0689('0x76')]:_0x290f1a[_0x13f589][_0x0689('0x6c')];_0x1121fb=_0x290f1a[_0x13f589]['function']?_[_0x0689('0x79')](_0x203e84[_0x290f1a[_0x13f589][_0x0689('0x77')]],'%s',_0x1121fb):_0x1121fb;_0x1121fb=_0x290f1a[_0x13f589][_0x0689('0x78')]?_[_0x0689('0x79')](_0xef506b[_0x290f1a[_0x13f589]['format']],'%s',_0x1121fb):_0x1121fb;if(_0x290f1a[_0x13f589]['groupBy']){_0xbebfe5['group'](_0x1121fb);}_0x290f1a[_0x13f589][_0x0689('0x7b')]&&_0xbebfe5[_0x0689('0x7c')](_0x1121fb,_0x290f1a[_0x13f589][_0x0689('0x7b')]===_0x0689('0x7d')?![]:!![]);_0xbebfe5[_0x0689('0x6c')](_0x1121fb,_0x290f1a[_0x13f589][_0x0689('0x7e')]||_0x1121fb);}if(_0x5d70b8[_0x0689('0x7f')]){_0x5d70b8[_0x0689('0x7f')]=JSON[_0x0689('0x80')](_0x5d70b8[_0x0689('0x7f')]);for(var _0x1e95cb=0x0;_0x1e95cb<_0x5d70b8[_0x0689('0x7f')]['length'];_0x1e95cb+=0x1){if(_0x5d70b8['joins'][_0x1e95cb][_0x0689('0x34')]&&_[_0x0689('0x65')](_0x505499,_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x34')])&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x81')]&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')]&&_0x5d70b8[_0x0689('0x7f')][_0x1e95cb]['foreignKey']){_0xbebfe5[_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x34')]](_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')],null,util[_0x0689('0x78')](_0x0689('0x84'),_0x5d70b8[_0x0689('0x74')],_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x81')],_0x5d70b8[_0x0689('0x7f')][_0x1e95cb][_0x0689('0x83')],_0x5d70b8['joins'][_0x1e95cb][_0x0689('0x82')]));}}}if(_0x5d70b8[_0x0689('0x85')]){_0x5d70b8[_0x0689('0x85')]=JSON[_0x0689('0x80')](_0x5d70b8[_0x0689('0x85')]);_0xbebfe5['where'](_0x4702b8(_0x5d70b8[_0x0689('0x85')][_0x0689('0x6b')]));}_0x2619e2=_0xbebfe5[_0x0689('0xa5')]();_0xbebfe5[_0x0689('0x22')](_0x459b51);_0xbebfe5['offset'](0x0);logger['debug'](_0x0689('0x87'),_0xbebfe5[_0x0689('0x88')]());return dbH[_0x0689('0x89')][_0x0689('0x37')](_0xbebfe5[_0x0689('0x88')](),{'type':dbH[_0x0689('0x89')][_0x0689('0x8a')][_0x0689('0xa6')]});}})[_0x0689('0x29')](function(){return{'sql':_0x2619e2['toString']()};})['then'](respondWithResult(_0x4dd34,null))[_0x0689('0x4a')](handleError(_0x4dd34,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5244a8e..f41ab07 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 _0x6856=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6856,0x1cb));var _0x6685=function(_0x14e486,_0x1d52ec){_0x14e486=_0x14e486-0x0;var _0x36a23f=_0x6856[_0x14e486];return _0x36a23f;};'use strict';var _=require(_0x6685('0x0'));var util=require(_0x6685('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6685('0x2'));var BPromise=require('bluebird');var rp=require(_0x6685('0x3'));var fs=require('fs');var path=require(_0x6685('0x4'));var rimraf=require(_0x6685('0x5'));var config=require(_0x6685('0x6'));var attributes=require(_0x6685('0x7'));module[_0x6685('0x8')]=function(_0x1a6108,_0x4f073e){return _0x1a6108[_0x6685('0x9')](_0x6685('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa72b=['request-promise','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment'];(function(_0x40030f,_0x97cd95){var _0x31d4c5=function(_0xe9eef1){while(--_0xe9eef1){_0x40030f['push'](_0x40030f['shift']());}};_0x31d4c5(++_0x97cd95);}(_0xa72b,0xce));var _0xba72=function(_0x1f5763,_0x3ed2c8){_0x1f5763=_0x1f5763-0x0;var _0x221aa4=_0xa72b[_0x1f5763];return _0x221aa4;};'use strict';var _=require(_0xba72('0x0'));var util=require(_0xba72('0x1'));var logger=require('../../config/logger')(_0xba72('0x2'));var moment=require(_0xba72('0x3'));var BPromise=require('bluebird');var rp=require(_0xba72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba72('0x5'));var attributes=require(_0xba72('0x6'));module['exports']=function(_0x179bf3,_0x342769){return _0x179bf3[_0xba72('0x7')](_0xba72('0x8'),attributes,{'tableName':_0xba72('0x9'),'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 cff7876..3f55c0a 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 _0x368b=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59b83a,_0x3af449){var _0x4eeefc=function(_0x52efb0){while(--_0x52efb0){_0x59b83a['push'](_0x59b83a['shift']());}};_0x4eeefc(++_0x3af449);}(_0x368b,0x1dd));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb368('0x0'));var util=require(_0xb368('0x1'));var moment=require(_0xb368('0x2'));var BPromise=require(_0xb368('0x3'));var rs=require(_0xb368('0x4'));var fs=require('fs');var Redis=require(_0xb368('0x5'));var db=require(_0xb368('0x6'))['db'];var utils=require(_0xb368('0x7'));var logger=require(_0xb368('0x8'))(_0xb368('0x9'));var config=require('../../config/environment');var jayson=require(_0xb368('0xa'));var client=jayson[_0xb368('0xb')][_0xb368('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e87f3,_0x3a2f33,_0xd0ec98){return new BPromise(function(_0x5c375e,_0x278c82){return client[_0xb368('0xd')](_0x5e87f3,_0xd0ec98)[_0xb368('0xe')](function(_0x30ef5f){logger[_0xb368('0xf')](_0xb368('0x10'),_0x3a2f33,_0xb368('0x11'));logger[_0xb368('0x12')](_0xb368('0x13'),_0x3a2f33,_0xb368('0x11'),JSON[_0xb368('0x14')](_0x30ef5f));if(_0x30ef5f[_0xb368('0x15')]){if(_0x30ef5f['error'][_0xb368('0x16')]===0x1f4){logger[_0xb368('0x15')](_0xb368('0x10'),_0x3a2f33,_0x30ef5f[_0xb368('0x15')][_0xb368('0x17')]);return _0x278c82(_0x30ef5f[_0xb368('0x15')][_0xb368('0x17')]);}logger[_0xb368('0x15')](_0xb368('0x10'),_0x3a2f33,_0x30ef5f[_0xb368('0x15')][_0xb368('0x17')]);return _0x5c375e(_0x30ef5f['error'][_0xb368('0x17')]);}else{logger[_0xb368('0xf')](_0xb368('0x10'),_0x3a2f33,'request\x20sent');_0x5c375e(_0x30ef5f['result'][_0xb368('0x17')]);}})[_0xb368('0x18')](function(_0xd48825){logger['error'](_0xb368('0x10'),_0x3a2f33,_0xd48825);_0x278c82(_0xd48825);});});} \ No newline at end of file +var _0x5add=['../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4f5b11,_0x41741e){var _0x2ec258=function(_0x523247){while(--_0x523247){_0x4f5b11['push'](_0x4f5b11['shift']());}};_0x2ec258(++_0x41741e);}(_0x5add,0x1e8));var _0xd5ad=function(_0x634b8e,_0x4840e9){_0x634b8e=_0x634b8e-0x0;var _0x35f155=_0x5add[_0x634b8e];return _0x35f155;};'use strict';var _=require(_0xd5ad('0x0'));var util=require('util');var moment=require(_0xd5ad('0x1'));var BPromise=require(_0xd5ad('0x2'));var rs=require(_0xd5ad('0x3'));var fs=require('fs');var Redis=require(_0xd5ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5ad('0x5'));var logger=require(_0xd5ad('0x6'))(_0xd5ad('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5ad('0x8'));var client=jayson[_0xd5ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f717,_0x5c33c8,_0x171f16){return new BPromise(function(_0xf3796d,_0x4903a8){return client[_0xd5ad('0xa')](_0x38f717,_0x171f16)[_0xd5ad('0xb')](function(_0x2eb269){logger[_0xd5ad('0xc')](_0xd5ad('0xd'),_0x5c33c8,_0xd5ad('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5c33c8,_0xd5ad('0xe'),JSON[_0xd5ad('0xf')](_0x2eb269));if(_0x2eb269[_0xd5ad('0x10')]){if(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x11')]===0x1f4){logger[_0xd5ad('0x10')](_0xd5ad('0xd'),_0x5c33c8,_0x2eb269['error']['message']);return _0x4903a8(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);}logger[_0xd5ad('0x10')](_0xd5ad('0xd'),_0x5c33c8,_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);return _0xf3796d(_0x2eb269[_0xd5ad('0x10')][_0xd5ad('0x12')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5c33c8,_0xd5ad('0xe'));_0xf3796d(_0x2eb269['result'][_0xd5ad('0x12')]);}})['catch'](function(_0x2ca78d){logger[_0xd5ad('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5c33c8,_0x2ca78d);_0x4903a8(_0x2ca78d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2423b24..eeabd2d 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 _0x380c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','destroy'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x380c,0x91));var _0xc380=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x380c[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xc380('0x0'));var util=require(_0xc380('0x1'));var path=require(_0xc380('0x2'));var timeout=require(_0xc380('0x3'));var express=require(_0xc380('0x4'));var router=express['Router']();var fs_extra=require(_0xc380('0x5'));var auth=require(_0xc380('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc380('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xc380('0x8')]('/',auth[_0xc380('0x9')](),controller[_0xc380('0xa')]);router[_0xc380('0x8')](_0xc380('0xb'),auth[_0xc380('0x9')](),controller[_0xc380('0xc')]);router['get'](_0xc380('0xd'),auth['isAuthenticated'](),controller[_0xc380('0xe')]);router[_0xc380('0x8')](_0xc380('0xf'),auth['isAuthenticated'](),controller[_0xc380('0x10')]);router[_0xc380('0x8')](_0xc380('0x11'),auth[_0xc380('0x9')](),controller[_0xc380('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc380('0x13')]);router[_0xc380('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc380('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc380('0x16')]);module[_0xc380('0x17')]=router; \ No newline at end of file +var _0xa092=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','delete','destroy'];(function(_0x1cb0dc,_0x264c1d){var _0x42db69=function(_0x503cf7){while(--_0x503cf7){_0x1cb0dc['push'](_0x1cb0dc['shift']());}};_0x42db69(++_0x264c1d);}(_0xa092,0x79));var _0x2a09=function(_0x1b1365,_0x205568){_0x1b1365=_0x1b1365-0x0;var _0x5edfd8=_0xa092[_0x1b1365];return _0x5edfd8;};'use strict';var multer=require('multer');var util=require(_0x2a09('0x0'));var path=require(_0x2a09('0x1'));var timeout=require(_0x2a09('0x2'));var express=require(_0x2a09('0x3'));var router=express[_0x2a09('0x4')]();var fs_extra=require(_0x2a09('0x5'));var auth=require(_0x2a09('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a09('0x7'));var controller=require(_0x2a09('0x8'));router[_0x2a09('0x9')]('/',auth[_0x2a09('0xa')](),controller[_0x2a09('0xb')]);router[_0x2a09('0x9')](_0x2a09('0xc'),auth[_0x2a09('0xa')](),controller[_0x2a09('0xd')]);router[_0x2a09('0x9')](_0x2a09('0xe'),auth[_0x2a09('0xa')](),controller[_0x2a09('0xf')]);router[_0x2a09('0x9')](_0x2a09('0x10'),auth[_0x2a09('0xa')](),controller[_0x2a09('0x11')]);router[_0x2a09('0x9')](_0x2a09('0x12'),auth['isAuthenticated'](),controller[_0x2a09('0x13')]);router[_0x2a09('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2a09('0xc'),auth[_0x2a09('0xa')](),controller['update']);router[_0x2a09('0x15')]('/:id',auth[_0x2a09('0xa')](),controller[_0x2a09('0x16')]);module[_0x2a09('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 44700df..63b5f33 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x5fd1,0x155));var _0x15fd=function(_0x45b7ea,_0x3f5bc7){_0x45b7ea=_0x45b7ea-0x0;var _0x3a8ca3=_0x5fd1[_0x45b7ea];return _0x3a8ca3;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x27999e,_0x1cbbd2){var _0x19498d=function(_0x2bd9ab){while(--_0x2bd9ab){_0x27999e['push'](_0x27999e['shift']());}};_0x19498d(++_0x1cbbd2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x24ca[_0x22431e];return _0xd978e9;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f36e51e..30db908 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','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','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x44335d,_0x22b2d5){var _0x205412=function(_0x26db0f){while(--_0x26db0f){_0x44335d['push'](_0x44335d['shift']());}};_0x205412(++_0x22b2d5);}(_0x1967,0x173));var _0x7196=function(_0x527a1e,_0x1d5b7e){_0x527a1e=_0x527a1e-0x0;var _0x377b45=_0x1967[_0x527a1e];return _0x377b45;};'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'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x3d7562,_0x36eb1e){var _0x276c53=function(_0x376feb){while(--_0x376feb){_0x3d7562['push'](_0x3d7562['shift']());}};_0x276c53(++_0x36eb1e);}(_0x53ec,0x192));var _0xc53e=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0x53ec[_0x641f18];return _0x16eefe;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 54a482b..599306f 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 _0x206b=['request-promise','path','rimraf','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x6fc393,_0x5c5a66){var _0x4c198f=function(_0x4fcd32){while(--_0x4fcd32){_0x6fc393['push'](_0x6fc393['shift']());}};_0x4c198f(++_0x5c5a66);}(_0x206b,0x166));var _0xb206=function(_0x4b19e3,_0x2b63c3){_0x4b19e3=_0x4b19e3-0x0;var _0x2ce22a=_0x206b[_0x4b19e3];return _0x2ce22a;};'use strict';var _=require(_0xb206('0x0'));var util=require(_0xb206('0x1'));var logger=require(_0xb206('0x2'))(_0xb206('0x3'));var moment=require(_0xb206('0x4'));var BPromise=require(_0xb206('0x5'));var rp=require(_0xb206('0x6'));var fs=require('fs');var path=require(_0xb206('0x7'));var rimraf=require(_0xb206('0x8'));var config=require(_0xb206('0x9'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x4ba0a6,_0x17a957){return _0x4ba0a6[_0xb206('0xa')](_0xb206('0xb'),attributes,{'tableName':_0xb206('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14f=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0xe14f,0x160));var _0xfe14=function(_0x517da2,_0x3be777){_0x517da2=_0x517da2-0x0;var _0x2c1acc=_0xe14f[_0x517da2];return _0x2c1acc;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var logger=require(_0xfe14('0x2'))(_0xfe14('0x3'));var moment=require(_0xfe14('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe14('0x5'));var fs=require('fs');var path=require(_0xfe14('0x6'));var rimraf=require('rimraf');var config=require(_0xfe14('0x7'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0xca5420,_0x38c228){return _0xca5420[_0xfe14('0x8')](_0xfe14('0x9'),attributes,{'tableName':_0xfe14('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 7117661..65e1463 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 _0xd82d=['randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird'];(function(_0x5b49b5,_0xe5b574){var _0x2c87d1=function(_0x3253a6){while(--_0x3253a6){_0x5b49b5['push'](_0x5b49b5['shift']());}};_0x2c87d1(++_0xe5b574);}(_0xd82d,0x1a0));var _0xdd82=function(_0x49242f,_0x469aa1){_0x49242f=_0x49242f-0x0;var _0x395478=_0xd82d[_0x49242f];return _0x395478;};'use strict';var _=require(_0xdd82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdd82('0x1'));var rs=require(_0xdd82('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd82('0x3'))(_0xdd82('0x4'));var config=require(_0xdd82('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdd82('0x6')][_0xdd82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x350c78,_0x31fefa,_0x140118){return new BPromise(function(_0xa2852f,_0x523d8b){return client[_0xdd82('0x8')](_0x350c78,_0x140118)[_0xdd82('0x9')](function(_0x4e64ef){logger[_0xdd82('0xa')](_0xdd82('0xb'),_0x31fefa,_0xdd82('0xc'));logger['debug'](_0xdd82('0xd'),_0x31fefa,_0xdd82('0xc'),JSON[_0xdd82('0xe')](_0x4e64ef));if(_0x4e64ef[_0xdd82('0xf')]){if(_0x4e64ef[_0xdd82('0xf')]['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x31fefa,_0x4e64ef[_0xdd82('0xf')][_0xdd82('0x10')]);return _0x523d8b(_0x4e64ef[_0xdd82('0xf')]['message']);}logger[_0xdd82('0xf')](_0xdd82('0xb'),_0x31fefa,_0x4e64ef[_0xdd82('0xf')][_0xdd82('0x10')]);return _0xa2852f(_0x4e64ef[_0xdd82('0xf')][_0xdd82('0x10')]);}else{logger[_0xdd82('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x31fefa,_0xdd82('0xc'));_0xa2852f(_0x4e64ef[_0xdd82('0x11')]['message']);}})[_0xdd82('0x12')](function(_0x12226f){logger['error'](_0xdd82('0xb'),_0x31fefa,_0x12226f);_0x523d8b(_0x12226f);});});} \ No newline at end of file +var _0x96d7=['http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x355103,_0x4a0357){var _0x85c59f=function(_0x4fa6ec){while(--_0x4fa6ec){_0x355103['push'](_0x355103['shift']());}};_0x85c59f(++_0x4a0357);}(_0x96d7,0x97));var _0x796d=function(_0x46e9f8,_0x890cc9){_0x46e9f8=_0x46e9f8-0x0;var _0x70660b=_0x96d7[_0x46e9f8];return _0x70660b;};'use strict';var _=require(_0x796d('0x0'));var util=require(_0x796d('0x1'));var moment=require('moment');var BPromise=require(_0x796d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x796d('0x3'));var db=require(_0x796d('0x4'))['db'];var utils=require(_0x796d('0x5'));var logger=require(_0x796d('0x6'))(_0x796d('0x7'));var config=require(_0x796d('0x8'));var jayson=require(_0x796d('0x9'));var client=jayson['client'][_0x796d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ca77,_0x4de054,_0x29d977){return new BPromise(function(_0x39cb8a,_0x176880){return client[_0x796d('0xb')](_0x33ca77,_0x29d977)[_0x796d('0xc')](function(_0x526f87){logger[_0x796d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0x796d('0xe'));logger[_0x796d('0xf')](_0x796d('0x10'),_0x4de054,_0x796d('0xe'),JSON[_0x796d('0x11')](_0x526f87));if(_0x526f87[_0x796d('0x12')]){if(_0x526f87[_0x796d('0x12')][_0x796d('0x13')]===0x1f4){logger[_0x796d('0x12')](_0x796d('0x14'),_0x4de054,_0x526f87[_0x796d('0x12')][_0x796d('0x15')]);return _0x176880(_0x526f87[_0x796d('0x12')]['message']);}logger[_0x796d('0x12')](_0x796d('0x14'),_0x4de054,_0x526f87[_0x796d('0x12')][_0x796d('0x15')]);return _0x39cb8a(_0x526f87[_0x796d('0x12')]['message']);}else{logger[_0x796d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0x796d('0xe'));_0x39cb8a(_0x526f87['result'][_0x796d('0x15')]);}})[_0x796d('0x16')](function(_0xb61624){logger[_0x796d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4de054,_0xb61624);_0x176880(_0xb61624);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3028edf..4674dc6 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 _0xea7e=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','run','/:id/query','query','post','create','put','delete','destroy'];(function(_0x1e003b,_0x3e4ded){var _0x268789=function(_0x559062){while(--_0x559062){_0x1e003b['push'](_0x1e003b['shift']());}};_0x268789(++_0x3e4ded);}(_0xea7e,0x143));var _0xeea7=function(_0x2c0911,_0x2175a3){_0x2c0911=_0x2c0911-0x0;var _0x23adb2=_0xea7e[_0x2c0911];return _0x23adb2;};'use strict';var multer=require('multer');var util=require(_0xeea7('0x0'));var path=require(_0xeea7('0x1'));var timeout=require('connect-timeout');var express=require(_0xeea7('0x2'));var router=express[_0xeea7('0x3')]();var fs_extra=require(_0xeea7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeea7('0x5'));var config=require(_0xeea7('0x6'));var controller=require(_0xeea7('0x7'));router[_0xeea7('0x8')]('/',auth[_0xeea7('0x9')](),controller[_0xeea7('0xa')]);router[_0xeea7('0x8')](_0xeea7('0xb'),auth[_0xeea7('0x9')](),controller[_0xeea7('0xc')]);router[_0xeea7('0x8')]('/:id/preview',auth[_0xeea7('0x9')](),controller[_0xeea7('0xd')]);router[_0xeea7('0x8')]('/:id/run',auth[_0xeea7('0x9')](),controller[_0xeea7('0xe')]);router['get'](_0xeea7('0xf'),auth[_0xeea7('0x9')](),controller[_0xeea7('0x10')]);router[_0xeea7('0x11')]('/',auth[_0xeea7('0x9')](),controller[_0xeea7('0x12')]);router[_0xeea7('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeea7('0x14')](_0xeea7('0xb'),auth['isAuthenticated'](),controller[_0xeea7('0x15')]);module[_0xeea7('0x16')]=router; \ No newline at end of file +var _0x242e=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','index','get','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','/:id','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x425a95,_0x2743b6){var _0x270c10=function(_0x5a18ed){while(--_0x5a18ed){_0x425a95['push'](_0x425a95['shift']());}};_0x270c10(++_0x2743b6);}(_0x242e,0x12f));var _0xe242=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x242e[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xe242('0x0'));var util=require('util');var path=require(_0xe242('0x1'));var timeout=require(_0xe242('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe242('0x3'));var auth=require(_0xe242('0x4'));var interaction=require(_0xe242('0x5'));var config=require(_0xe242('0x6'));var controller=require(_0xe242('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe242('0x8')]);router[_0xe242('0x9')]('/:id',auth[_0xe242('0xa')](),controller[_0xe242('0xb')]);router[_0xe242('0x9')](_0xe242('0xc'),auth[_0xe242('0xa')](),controller['preview']);router[_0xe242('0x9')](_0xe242('0xd'),auth[_0xe242('0xa')](),controller[_0xe242('0xe')]);router[_0xe242('0x9')](_0xe242('0xf'),auth[_0xe242('0xa')](),controller[_0xe242('0x10')]);router['post']('/',auth[_0xe242('0xa')](),controller[_0xe242('0x11')]);router[_0xe242('0x12')](_0xe242('0x13'),auth[_0xe242('0xa')](),controller['update']);router[_0xe242('0x14')](_0xe242('0x13'),auth[_0xe242('0xa')](),controller[_0xe242('0x15')]);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 a4d0762..0126f7b 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 _0x0e10=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','xlsx','DATE','Loading'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0e10,0x7c));var _0x00e1=function(_0x561070,_0x5ea1ad){_0x561070=_0x561070-0x0;var _0x5a85f0=_0x0e10[_0x561070];return _0x5a85f0;};'use strict';var Sequelize=require(_0x00e1('0x0'));var moment=require(_0x00e1('0x1'));module['exports']={'name':{'type':Sequelize[_0x00e1('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x00e1('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x00e1('0x3')](_0x00e1('0x4'),'pdf',_0x00e1('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x00e1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x00e1('0x6')]},'endDate':{'type':Sequelize[_0x00e1('0x6')]},'status':{'type':Sequelize[_0x00e1('0x2')],'defaultValue':_0x00e1('0x7')},'type':{'type':Sequelize[_0x00e1('0x3')](_0x00e1('0x8'),_0x00e1('0x9')),'allowNull':![],'defaultValue':_0x00e1('0x8')},'reportId':{'type':Sequelize[_0x00e1('0xa')](0xb)[_0x00e1('0xb')]},'reportType':{'type':Sequelize[_0x00e1('0x2')]}}; \ No newline at end of file +var _0xe278=['pdf','xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xe278,0x156));var _0x8e27=function(_0x4c4287,_0x3ab735){_0x4c4287=_0x4c4287-0x0;var _0x561a27=_0xe278[_0x4c4287];return _0x561a27;};'use strict';var Sequelize=require(_0x8e27('0x0'));var moment=require(_0x8e27('0x1'));module[_0x8e27('0x2')]={'name':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8e27('0x4')](_0x8e27('0x5'),_0x8e27('0x6'),_0x8e27('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8e27('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8e27('0x8')]},'endDate':{'type':Sequelize[_0x8e27('0x8')]},'status':{'type':Sequelize[_0x8e27('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x8e27('0x4')](_0x8e27('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8e27('0x9')},'reportId':{'type':Sequelize[_0x8e27('0xa')](0xb)[_0x8e27('0xb')]},'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 da2a24e..f2aecbe 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 _0xea88=['update','then','destroy','get','ExtractedReports','UserProfileResource','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','AnalyticExtractedReport','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','params','basename','savename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','sendStatus','download','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set'];(function(_0x305117,_0x289f1a){var _0x184cb7=function(_0x48887c){while(--_0x48887c){_0x305117['push'](_0x305117['shift']());}};_0x184cb7(++_0x289f1a);}(_0xea88,0x14c));var _0x8ea8=function(_0x4e228a,_0x145d30){_0x4e228a=_0x4e228a-0x0;var _0x274e4c=_0xea88[_0x4e228a];return _0x274e4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ea8('0x0'));var zipdir=require(_0x8ea8('0x1'));var jsonpatch=require(_0x8ea8('0x2'));var rp=require(_0x8ea8('0x3'));var moment=require('moment');var BPromise=require(_0x8ea8('0x4'));var Mustache=require(_0x8ea8('0x5'));var util=require(_0x8ea8('0x6'));var path=require('path');var sox=require(_0x8ea8('0x7'));var csv=require(_0x8ea8('0x8'));var ejs=require(_0x8ea8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ea8('0xa'));var squel=require('squel');var crypto=require(_0x8ea8('0xb'));var jsforce=require(_0x8ea8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8ea8('0x8'));var querystring=require(_0x8ea8('0xd'));var Papa=require(_0x8ea8('0xe'));var Redis=require('ioredis');var authService=require(_0x8ea8('0xf'));var qs=require(_0x8ea8('0x10'));var as=require(_0x8ea8('0x11'));var hardwareService=require(_0x8ea8('0x12'));var logger=require(_0x8ea8('0x13'))(_0x8ea8('0x14'));var utils=require(_0x8ea8('0x15'));var config=require(_0x8ea8('0x16'));var licenseUtil=require(_0x8ea8('0x17'));var db=require(_0x8ea8('0x18'))['db'];function respondWithStatusCode(_0x192b50,_0x43b27d){_0x43b27d=_0x43b27d||0xcc;return function(_0x266576){if(_0x266576){return _0x192b50['sendStatus'](_0x43b27d);}return _0x192b50['status'](_0x43b27d)[_0x8ea8('0x19')]();};}function respondWithResult(_0x2b7b53,_0xfa6cb0){_0xfa6cb0=_0xfa6cb0||0xc8;return function(_0x269f23){if(_0x269f23){return _0x2b7b53[_0x8ea8('0x1a')](_0xfa6cb0)[_0x8ea8('0x1b')](_0x269f23);}};}function respondWithFilteredResult(_0xc4544d,_0x3fbeb1){return function(_0x583207){if(_0x583207){var _0x461612=typeof _0x3fbeb1[_0x8ea8('0x1c')]==='undefined'&&typeof _0x3fbeb1[_0x8ea8('0x1d')]==='undefined';var _0x5bfd72=_0x583207['count'];var _0x49a7ec=_0x461612?0x0:_0x3fbeb1[_0x8ea8('0x1c')];var _0x1a7ee5=_0x461612?_0x583207[_0x8ea8('0x1e')]:_0x3fbeb1[_0x8ea8('0x1c')]+_0x3fbeb1[_0x8ea8('0x1d')];var _0x16763c;if(_0x1a7ee5>=_0x5bfd72){_0x1a7ee5=_0x5bfd72;_0x16763c=0xc8;}else{_0x16763c=0xce;}_0xc4544d[_0x8ea8('0x1a')](_0x16763c);return _0xc4544d[_0x8ea8('0x1f')]('Content-Range',_0x49a7ec+'-'+_0x1a7ee5+'/'+_0x5bfd72)['json'](_0x583207);}return null;};}function patchUpdates(_0x101a5f){return function(_0x5c33bb){try{jsonpatch['apply'](_0x5c33bb,_0x101a5f,!![]);}catch(_0x18f989){return BPromise['reject'](_0x18f989);}return _0x5c33bb['save']();};}function saveUpdates(_0x411305,_0x2235be){return function(_0x4df1a2){if(_0x4df1a2){return _0x4df1a2[_0x8ea8('0x20')](_0x411305)[_0x8ea8('0x21')](function(_0x5a18e2){return _0x5a18e2;});}return null;};}function removeEntity(_0x28d88a,_0x5725b4){return function(_0x56a743){if(_0x56a743){return _0x56a743[_0x8ea8('0x22')]()[_0x8ea8('0x21')](function(){var _0x41001d=_0x56a743[_0x8ea8('0x23')]({'plain':!![]});var _0x1f9451=_0x8ea8('0x24');return db[_0x8ea8('0x25')][_0x8ea8('0x22')]({'where':{'type':_0x1f9451,'resourceId':_0x41001d['id']}})['then'](function(){return _0x56a743;});})[_0x8ea8('0x21')](function(){_0x28d88a['status'](0xcc)[_0x8ea8('0x19')]();});}};}function handleEntityNotFound(_0x1ea1e1,_0xdca11b){return function(_0x5a2d8e){if(!_0x5a2d8e){_0x1ea1e1['sendStatus'](0x194);}return _0x5a2d8e;};}function handleError(_0x158708,_0x5c100f){_0x5c100f=_0x5c100f||0x1f4;return function(_0x195509){logger['error'](_0x195509[_0x8ea8('0x26')]);if(_0x195509['name']){delete _0x195509['name'];}_0x158708[_0x8ea8('0x1a')](_0x5c100f)[_0x8ea8('0x27')](_0x195509);};}exports['index']=function(_0x35481b,_0x25aa78){var _0x9fd70a={},_0x1ac2cb={},_0x1375be={'count':0x0,'rows':[]};var _0x258d45=_[_0x8ea8('0x28')](db['AnalyticExtractedReport'][_0x8ea8('0x29')],function(_0x124ac1){return{'name':_0x124ac1[_0x8ea8('0x2a')],'type':_0x124ac1[_0x8ea8('0x2b')][_0x8ea8('0x2c')]};});_0x1ac2cb[_0x8ea8('0x2d')]=_[_0x8ea8('0x28')](_0x258d45,_0x8ea8('0x2e'));_0x1ac2cb['query']=_['keys'](_0x35481b['query']);_0x1ac2cb[_0x8ea8('0x2f')]=_[_0x8ea8('0x30')](_0x1ac2cb['model'],_0x1ac2cb[_0x8ea8('0x31')]);_0x9fd70a['attributes']=_['intersection'](_0x1ac2cb['model'],qs[_0x8ea8('0x32')](_0x35481b[_0x8ea8('0x31')]['fields']));_0x9fd70a[_0x8ea8('0x33')]=_0x9fd70a[_0x8ea8('0x33')][_0x8ea8('0x34')]?_0x9fd70a[_0x8ea8('0x33')]:_0x1ac2cb[_0x8ea8('0x2d')];if(!_0x35481b[_0x8ea8('0x31')][_0x8ea8('0x35')](_0x8ea8('0x36'))){_0x9fd70a['limit']=qs[_0x8ea8('0x1d')](_0x35481b['query'][_0x8ea8('0x1d')]);_0x9fd70a[_0x8ea8('0x1c')]=qs[_0x8ea8('0x1c')](_0x35481b['query']['offset']);}_0x9fd70a[_0x8ea8('0x37')]=qs[_0x8ea8('0x38')](_0x35481b[_0x8ea8('0x31')][_0x8ea8('0x38')]);_0x9fd70a[_0x8ea8('0x39')]=qs[_0x8ea8('0x2f')](_[_0x8ea8('0x3a')](_0x35481b['query'],_0x1ac2cb[_0x8ea8('0x2f')]),_0x258d45);if(_0x35481b[_0x8ea8('0x31')][_0x8ea8('0x3b')]){_0x9fd70a[_0x8ea8('0x39')]=_[_0x8ea8('0x3c')](_0x9fd70a['where'],{'$or':_[_0x8ea8('0x28')](_0x258d45,function(_0x37948c){if(_0x37948c[_0x8ea8('0x2b')]!=='VIRTUAL'){var _0x3012c6={};_0x3012c6[_0x37948c[_0x8ea8('0x2e')]]={'$like':'%'+_0x35481b[_0x8ea8('0x31')][_0x8ea8('0x3b')]+'%'};return _0x3012c6;}})});}_0x9fd70a=_[_0x8ea8('0x3c')]({},_0x9fd70a,_0x35481b[_0x8ea8('0x3d')]);var _0x5e8d15={'where':_0x9fd70a[_0x8ea8('0x39')]};return db['AnalyticExtractedReport']['count'](_0x5e8d15)[_0x8ea8('0x21')](function(_0x104d8a){_0x1375be[_0x8ea8('0x1e')]=_0x104d8a;if(_0x35481b[_0x8ea8('0x31')][_0x8ea8('0x3e')]){_0x9fd70a[_0x8ea8('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8ea8('0x40')](_0x9fd70a);})[_0x8ea8('0x21')](function(_0x518ef4){_0x1375be[_0x8ea8('0x41')]=_0x518ef4;return _0x1375be;})['then'](respondWithFilteredResult(_0x25aa78,_0x9fd70a))[_0x8ea8('0x42')](handleError(_0x25aa78,null));};exports[_0x8ea8('0x43')]=function(_0x580f24,_0xc090d3){var _0x3b5f71={'raw':!![],'where':{'id':_0x580f24['params']['id']}},_0x187d1e={};_0x187d1e[_0x8ea8('0x2d')]=_['keys'](db[_0x8ea8('0x44')][_0x8ea8('0x29')]);_0x187d1e[_0x8ea8('0x31')]=_[_0x8ea8('0x45')](_0x580f24[_0x8ea8('0x31')]);_0x187d1e[_0x8ea8('0x2f')]=_[_0x8ea8('0x30')](_0x187d1e[_0x8ea8('0x2d')],_0x187d1e['query']);_0x3b5f71[_0x8ea8('0x33')]=_['intersection'](_0x187d1e['model'],qs['fields'](_0x580f24['query']['fields']));_0x3b5f71[_0x8ea8('0x33')]=_0x3b5f71[_0x8ea8('0x33')]['length']?_0x3b5f71[_0x8ea8('0x33')]:_0x187d1e['model'];if(_0x580f24[_0x8ea8('0x31')][_0x8ea8('0x3e')]){_0x3b5f71[_0x8ea8('0x3f')]=[{'all':!![]}];}_0x3b5f71=_[_0x8ea8('0x3c')]({},_0x3b5f71,_0x580f24[_0x8ea8('0x3d')]);return db[_0x8ea8('0x44')][_0x8ea8('0x46')](_0x3b5f71)['then'](handleEntityNotFound(_0xc090d3,null))[_0x8ea8('0x21')](respondWithResult(_0xc090d3,null))[_0x8ea8('0x42')](handleError(_0xc090d3,null));};exports[_0x8ea8('0x47')]=function(_0xaf85bd,_0x3434b0){return db[_0x8ea8('0x44')]['create'](_0xaf85bd[_0x8ea8('0x48')],{})[_0x8ea8('0x21')](function(_0x1ecabb){var _0x1dd961=_0xaf85bd[_0x8ea8('0x49')][_0x8ea8('0x23')]({'plain':!![]});if(!_0x1dd961)throw new Error(_0x8ea8('0x4a'));if(_0x1dd961[_0x8ea8('0x4b')]===_0x8ea8('0x49')){var _0x3b1a67=_0x1ecabb[_0x8ea8('0x23')]({'plain':!![]});var _0x2003f5=_0x8ea8('0x24');return db[_0x8ea8('0x4c')]['find']({'where':{'name':_0x2003f5,'userProfileId':_0x1dd961[_0x8ea8('0x4d')]},'raw':!![]})['then'](function(_0x239a4e){if(_0x239a4e&&_0x239a4e['autoAssociation']===0x0){return db[_0x8ea8('0x25')]['create']({'name':_0x3b1a67[_0x8ea8('0x2e')],'resourceId':_0x3b1a67['id'],'type':_0x239a4e[_0x8ea8('0x2e')],'sectionId':_0x239a4e['id']},{})[_0x8ea8('0x21')](function(){return _0x1ecabb;});}else{return _0x1ecabb;}})[_0x8ea8('0x42')](function(_0x2f9569){logger[_0x8ea8('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f9569);throw _0x2f9569;});}return _0x1ecabb;})[_0x8ea8('0x21')](respondWithResult(_0x3434b0,0xc9))['catch'](handleError(_0x3434b0,null));};exports[_0x8ea8('0x20')]=function(_0x17a0ac,_0x5aa11b){if(_0x17a0ac['body']['id']){delete _0x17a0ac['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x17a0ac[_0x8ea8('0x4f')]['id']}})[_0x8ea8('0x21')](handleEntityNotFound(_0x5aa11b,null))[_0x8ea8('0x21')](saveUpdates(_0x17a0ac[_0x8ea8('0x48')],null))[_0x8ea8('0x21')](respondWithResult(_0x5aa11b,null))[_0x8ea8('0x42')](handleError(_0x5aa11b,null));};exports[_0x8ea8('0x22')]=function(_0x28400c,_0x500290){return db[_0x8ea8('0x44')]['find']({'where':{'id':_0x28400c['params']['id']}})[_0x8ea8('0x21')](handleEntityNotFound(_0x500290,null))['then'](removeEntity(_0x500290,null))[_0x8ea8('0x42')](handleError(_0x500290,null));};exports['download']=function(_0x266ea7,_0x5e7874,_0x32d161){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x266ea7['params']['id']},'attributes':[_0x8ea8('0x2e'),_0x8ea8('0x50'),_0x8ea8('0x51'),_0x8ea8('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x5e7874,null))[_0x8ea8('0x21')](function(_0x186608){if(_0x186608){if(!fs[_0x8ea8('0x53')](path[_0x8ea8('0x54')](config[_0x8ea8('0x55')],_0x8ea8('0x56'),_0x186608['savename']))){throw new db['Sequelize']['ValidationError'](_0x8ea8('0x57'));}if(_0x266ea7[_0x8ea8('0x31')]['exists']){return _0x5e7874[_0x8ea8('0x58')](0xc8);}return _0x5e7874[_0x8ea8('0x59')](path[_0x8ea8('0x54')](config[_0x8ea8('0x55')],_0x8ea8('0x56'),_0x186608[_0x8ea8('0x51')]),util['format']('%s.%s',_0x186608[_0x8ea8('0x50')]||_0x186608['name'],_0x186608[_0x8ea8('0x52')][_0x8ea8('0x5a')]()));}})[_0x8ea8('0x42')](handleError(_0x5e7874,null));}; \ No newline at end of file +var _0xb806=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','include','findAll','catch','show','params','keys','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x517fa8,_0x3adce0){var _0x5409f4=function(_0x501e80){while(--_0x501e80){_0x517fa8['push'](_0x517fa8['shift']());}};_0x5409f4(++_0x3adce0);}(_0xb806,0x1e7));var _0x6b80=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xb806[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x6b80('0x0'));var rimraf=require(_0x6b80('0x1'));var zipdir=require(_0x6b80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b80('0x3'));var moment=require(_0x6b80('0x4'));var BPromise=require(_0x6b80('0x5'));var Mustache=require(_0x6b80('0x6'));var util=require(_0x6b80('0x7'));var path=require(_0x6b80('0x8'));var sox=require(_0x6b80('0x9'));var csv=require('to-csv');var ejs=require(_0x6b80('0xa'));var fs=require('fs');var fs_extra=require(_0x6b80('0xb'));var _=require('lodash');var squel=require(_0x6b80('0xc'));var crypto=require(_0x6b80('0xd'));var jsforce=require(_0x6b80('0xe'));var deskjs=require(_0x6b80('0xf'));var toCsv=require(_0x6b80('0x10'));var querystring=require(_0x6b80('0x11'));var Papa=require('papaparse');var Redis=require(_0x6b80('0x12'));var authService=require(_0x6b80('0x13'));var qs=require(_0x6b80('0x14'));var as=require(_0x6b80('0x15'));var hardwareService=require(_0x6b80('0x16'));var logger=require(_0x6b80('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6b80('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b80('0x19'))['db'];function respondWithStatusCode(_0x5d4acc,_0x24ba8b){_0x24ba8b=_0x24ba8b||0xcc;return function(_0xa2ff66){if(_0xa2ff66){return _0x5d4acc[_0x6b80('0x1a')](_0x24ba8b);}return _0x5d4acc[_0x6b80('0x1b')](_0x24ba8b)[_0x6b80('0x1c')]();};}function respondWithResult(_0x29aa5e,_0x3d0714){_0x3d0714=_0x3d0714||0xc8;return function(_0x2fbc14){if(_0x2fbc14){return _0x29aa5e[_0x6b80('0x1b')](_0x3d0714)[_0x6b80('0x1d')](_0x2fbc14);}};}function respondWithFilteredResult(_0xe7bb1c,_0x2b935f){return function(_0x520a5a){if(_0x520a5a){var _0x100504=typeof _0x2b935f[_0x6b80('0x1e')]===_0x6b80('0x1f')&&typeof _0x2b935f['limit']===_0x6b80('0x1f');var _0x1779ed=_0x520a5a[_0x6b80('0x20')];var _0x2c0bda=_0x100504?0x0:_0x2b935f['offset'];var _0x568fc0=_0x100504?_0x520a5a[_0x6b80('0x20')]:_0x2b935f[_0x6b80('0x1e')]+_0x2b935f[_0x6b80('0x21')];var _0x1b8a80;if(_0x568fc0>=_0x1779ed){_0x568fc0=_0x1779ed;_0x1b8a80=0xc8;}else{_0x1b8a80=0xce;}_0xe7bb1c[_0x6b80('0x1b')](_0x1b8a80);return _0xe7bb1c[_0x6b80('0x22')](_0x6b80('0x23'),_0x2c0bda+'-'+_0x568fc0+'/'+_0x1779ed)[_0x6b80('0x1d')](_0x520a5a);}return null;};}function patchUpdates(_0x326f10){return function(_0x409663){try{jsonpatch[_0x6b80('0x24')](_0x409663,_0x326f10,!![]);}catch(_0x103f62){return BPromise[_0x6b80('0x25')](_0x103f62);}return _0x409663[_0x6b80('0x26')]();};}function saveUpdates(_0x2d0086,_0x4b31a4){return function(_0x12045c){if(_0x12045c){return _0x12045c[_0x6b80('0x27')](_0x2d0086)[_0x6b80('0x28')](function(_0x4eae3a){return _0x4eae3a;});}return null;};}function removeEntity(_0x50637e,_0x46e3a0){return function(_0x47d59e){if(_0x47d59e){return _0x47d59e[_0x6b80('0x29')]()[_0x6b80('0x28')](function(){var _0x21b694=_0x47d59e[_0x6b80('0x2a')]({'plain':!![]});var _0x3f85df=_0x6b80('0x2b');return db[_0x6b80('0x2c')]['destroy']({'where':{'type':_0x3f85df,'resourceId':_0x21b694['id']}})[_0x6b80('0x28')](function(){return _0x47d59e;});})[_0x6b80('0x28')](function(){_0x50637e['status'](0xcc)[_0x6b80('0x1c')]();});}};}function handleEntityNotFound(_0x1e066d,_0x21f2ee){return function(_0x471809){if(!_0x471809){_0x1e066d[_0x6b80('0x1a')](0x194);}return _0x471809;};}function handleError(_0x5aa160,_0x41d737){_0x41d737=_0x41d737||0x1f4;return function(_0x3d6724){logger[_0x6b80('0x2d')](_0x3d6724[_0x6b80('0x2e')]);if(_0x3d6724[_0x6b80('0x2f')]){delete _0x3d6724[_0x6b80('0x2f')];}_0x5aa160[_0x6b80('0x1b')](_0x41d737)[_0x6b80('0x30')](_0x3d6724);};}exports['index']=function(_0x3932c7,_0x2e4859){var _0x4364b5={},_0x2f205b={},_0x4785ed={'count':0x0,'rows':[]};var _0x18143d=_[_0x6b80('0x31')](db['AnalyticExtractedReport'][_0x6b80('0x32')],function(_0x275a6f){return{'name':_0x275a6f[_0x6b80('0x33')],'type':_0x275a6f[_0x6b80('0x34')]['key']};});_0x2f205b['model']=_[_0x6b80('0x31')](_0x18143d,_0x6b80('0x2f'));_0x2f205b[_0x6b80('0x35')]=_['keys'](_0x3932c7[_0x6b80('0x35')]);_0x2f205b[_0x6b80('0x36')]=_[_0x6b80('0x37')](_0x2f205b[_0x6b80('0x38')],_0x2f205b[_0x6b80('0x35')]);_0x4364b5[_0x6b80('0x39')]=_['intersection'](_0x2f205b[_0x6b80('0x38')],qs[_0x6b80('0x3a')](_0x3932c7['query']['fields']));_0x4364b5[_0x6b80('0x39')]=_0x4364b5[_0x6b80('0x39')]['length']?_0x4364b5[_0x6b80('0x39')]:_0x2f205b[_0x6b80('0x38')];if(!_0x3932c7[_0x6b80('0x35')][_0x6b80('0x3b')](_0x6b80('0x3c'))){_0x4364b5[_0x6b80('0x21')]=qs[_0x6b80('0x21')](_0x3932c7[_0x6b80('0x35')]['limit']);_0x4364b5[_0x6b80('0x1e')]=qs[_0x6b80('0x1e')](_0x3932c7[_0x6b80('0x35')][_0x6b80('0x1e')]);}_0x4364b5[_0x6b80('0x3d')]=qs['sort'](_0x3932c7['query'][_0x6b80('0x3e')]);_0x4364b5[_0x6b80('0x3f')]=qs[_0x6b80('0x36')](_[_0x6b80('0x40')](_0x3932c7[_0x6b80('0x35')],_0x2f205b[_0x6b80('0x36')]),_0x18143d);if(_0x3932c7[_0x6b80('0x35')][_0x6b80('0x41')]){_0x4364b5[_0x6b80('0x3f')]=_[_0x6b80('0x42')](_0x4364b5[_0x6b80('0x3f')],{'$or':_['map'](_0x18143d,function(_0x27b768){if(_0x27b768[_0x6b80('0x34')]!==_0x6b80('0x43')){var _0x2d82bb={};_0x2d82bb[_0x27b768[_0x6b80('0x2f')]]={'$like':'%'+_0x3932c7[_0x6b80('0x35')][_0x6b80('0x41')]+'%'};return _0x2d82bb;}})});}_0x4364b5=_[_0x6b80('0x42')]({},_0x4364b5,_0x3932c7[_0x6b80('0x44')]);var _0x631fc0={'where':_0x4364b5['where']};return db[_0x6b80('0x45')][_0x6b80('0x20')](_0x631fc0)[_0x6b80('0x28')](function(_0x1065da){_0x4785ed[_0x6b80('0x20')]=_0x1065da;if(_0x3932c7[_0x6b80('0x35')]['includeAll']){_0x4364b5[_0x6b80('0x46')]=[{'all':!![]}];}return db[_0x6b80('0x45')][_0x6b80('0x47')](_0x4364b5);})[_0x6b80('0x28')](function(_0x435471){_0x4785ed['rows']=_0x435471;return _0x4785ed;})[_0x6b80('0x28')](respondWithFilteredResult(_0x2e4859,_0x4364b5))[_0x6b80('0x48')](handleError(_0x2e4859,null));};exports[_0x6b80('0x49')]=function(_0x58e11f,_0x1e1cb0){var _0x777d11={'raw':!![],'where':{'id':_0x58e11f[_0x6b80('0x4a')]['id']}},_0x47894b={};_0x47894b[_0x6b80('0x38')]=_['keys'](db[_0x6b80('0x45')]['rawAttributes']);_0x47894b['query']=_[_0x6b80('0x4b')](_0x58e11f[_0x6b80('0x35')]);_0x47894b[_0x6b80('0x36')]=_['intersection'](_0x47894b[_0x6b80('0x38')],_0x47894b[_0x6b80('0x35')]);_0x777d11[_0x6b80('0x39')]=_[_0x6b80('0x37')](_0x47894b[_0x6b80('0x38')],qs[_0x6b80('0x3a')](_0x58e11f[_0x6b80('0x35')][_0x6b80('0x3a')]));_0x777d11[_0x6b80('0x39')]=_0x777d11[_0x6b80('0x39')][_0x6b80('0x4c')]?_0x777d11[_0x6b80('0x39')]:_0x47894b['model'];if(_0x58e11f[_0x6b80('0x35')][_0x6b80('0x4d')]){_0x777d11[_0x6b80('0x46')]=[{'all':!![]}];}_0x777d11=_[_0x6b80('0x42')]({},_0x777d11,_0x58e11f[_0x6b80('0x44')]);return db['AnalyticExtractedReport'][_0x6b80('0x4e')](_0x777d11)[_0x6b80('0x28')](handleEntityNotFound(_0x1e1cb0,null))[_0x6b80('0x28')](respondWithResult(_0x1e1cb0,null))[_0x6b80('0x48')](handleError(_0x1e1cb0,null));};exports[_0x6b80('0x4f')]=function(_0x1dba91,_0x1ee506){return db[_0x6b80('0x45')][_0x6b80('0x4f')](_0x1dba91['body'],{})[_0x6b80('0x28')](function(_0x40069b){var _0x12e10c=_0x1dba91[_0x6b80('0x50')][_0x6b80('0x2a')]({'plain':!![]});if(!_0x12e10c)throw new Error(_0x6b80('0x51'));if(_0x12e10c['role']===_0x6b80('0x50')){var _0x5edd98=_0x40069b[_0x6b80('0x2a')]({'plain':!![]});var _0x236c81=_0x6b80('0x2b');return db[_0x6b80('0x52')][_0x6b80('0x4e')]({'where':{'name':_0x236c81,'userProfileId':_0x12e10c[_0x6b80('0x53')]},'raw':!![]})[_0x6b80('0x28')](function(_0x4aa8b1){if(_0x4aa8b1&&_0x4aa8b1[_0x6b80('0x54')]===0x0){return db[_0x6b80('0x2c')][_0x6b80('0x4f')]({'name':_0x5edd98[_0x6b80('0x2f')],'resourceId':_0x5edd98['id'],'type':_0x4aa8b1[_0x6b80('0x2f')],'sectionId':_0x4aa8b1['id']},{})['then'](function(){return _0x40069b;});}else{return _0x40069b;}})['catch'](function(_0x162399){logger['error'](_0x6b80('0x55'),_0x162399);throw _0x162399;});}return _0x40069b;})[_0x6b80('0x28')](respondWithResult(_0x1ee506,0xc9))[_0x6b80('0x48')](handleError(_0x1ee506,null));};exports[_0x6b80('0x27')]=function(_0x55f499,_0x391405){if(_0x55f499[_0x6b80('0x56')]['id']){delete _0x55f499[_0x6b80('0x56')]['id'];}return db[_0x6b80('0x45')]['find']({'where':{'id':_0x55f499[_0x6b80('0x4a')]['id']}})[_0x6b80('0x28')](handleEntityNotFound(_0x391405,null))['then'](saveUpdates(_0x55f499[_0x6b80('0x56')],null))[_0x6b80('0x28')](respondWithResult(_0x391405,null))[_0x6b80('0x48')](handleError(_0x391405,null));};exports['destroy']=function(_0x3f19ea,_0x36ac28){return db[_0x6b80('0x45')][_0x6b80('0x4e')]({'where':{'id':_0x3f19ea[_0x6b80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36ac28,null))[_0x6b80('0x28')](removeEntity(_0x36ac28,null))[_0x6b80('0x48')](handleError(_0x36ac28,null));};exports['download']=function(_0xa9806b,_0x27ad1d,_0x3b43d8){return db[_0x6b80('0x45')][_0x6b80('0x4e')]({'where':{'id':_0xa9806b[_0x6b80('0x4a')]['id']},'attributes':['name',_0x6b80('0x57'),_0x6b80('0x58'),_0x6b80('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x27ad1d,null))[_0x6b80('0x28')](function(_0x413c9b){if(_0x413c9b){if(!fs['existsSync'](path[_0x6b80('0x5a')](config[_0x6b80('0x5b')],_0x6b80('0x5c'),_0x413c9b['savename']))){throw new db[(_0x6b80('0x5d'))][(_0x6b80('0x5e'))](_0x6b80('0x5f'));}if(_0xa9806b[_0x6b80('0x35')][_0x6b80('0x60')]){return _0x27ad1d['sendStatus'](0xc8);}return _0x27ad1d['download'](path[_0x6b80('0x5a')](config[_0x6b80('0x5b')],_0x6b80('0x5c'),_0x413c9b['savename']),util['format'](_0x6b80('0x61'),_0x413c9b['basename']||_0x413c9b[_0x6b80('0x2f')],_0x413c9b[_0x6b80('0x59')][_0x6b80('0x62')]()));}})[_0x6b80('0x48')](handleError(_0x27ad1d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b5d3a1f..c680b5f 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 _0x5bac=['define','AnalyticExtractedReport','analytics_extracted_reports','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0xa29e3f,_0x477875){var _0x588233=function(_0x186ead){while(--_0x186ead){_0xa29e3f['push'](_0xa29e3f['shift']());}};_0x588233(++_0x477875);}(_0x5bac,0x1a7));var _0xc5ba=function(_0x3741a8,_0x5a39b2){_0x3741a8=_0x3741a8-0x0;var _0xd552a4=_0x5bac[_0x3741a8];return _0xd552a4;};'use strict';var _=require('lodash');var util=require(_0xc5ba('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc5ba('0x1'));var BPromise=require(_0xc5ba('0x2'));var rp=require(_0xc5ba('0x3'));var fs=require('fs');var path=require(_0xc5ba('0x4'));var rimraf=require(_0xc5ba('0x5'));var config=require(_0xc5ba('0x6'));var attributes=require(_0xc5ba('0x7'));module[_0xc5ba('0x8')]=function(_0x4b290d,_0x45a251){return _0x4b290d[_0xc5ba('0x9')](_0xc5ba('0xa'),attributes,{'tableName':_0xc5ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb57=['api','moment','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0xcb57,0x148));var _0x7cb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xcb57[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7cb5('0x0'));var util=require('util');var logger=require(_0x7cb5('0x1'))(_0x7cb5('0x2'));var moment=require(_0x7cb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb5('0x4'));var rimraf=require(_0x7cb5('0x5'));var config=require('../../config/environment');var attributes=require(_0x7cb5('0x6'));module[_0x7cb5('0x7')]=function(_0x145556,_0x364005){return _0x145556[_0x7cb5('0x8')](_0x7cb5('0x9'),attributes,{'tableName':_0x7cb5('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 ed79588..bd2c982 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 _0x579a=['../../config/utils','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x4ef200,_0x5f0422){var _0x5ac761=function(_0x15488b){while(--_0x15488b){_0x4ef200['push'](_0x4ef200['shift']());}};_0x5ac761(++_0x5f0422);}(_0x579a,0x9d));var _0xa579=function(_0x592188,_0x565c67){_0x592188=_0x592188-0x0;var _0x535ae3=_0x579a[_0x592188];return _0x535ae3;};'use strict';var _=require(_0xa579('0x0'));var util=require(_0xa579('0x1'));var moment=require(_0xa579('0x2'));var BPromise=require(_0xa579('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa579('0x4'))['db'];var utils=require(_0xa579('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa579('0x6'));var client=jayson['client'][_0xa579('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14a544,_0x770152,_0x2aeb20){return new BPromise(function(_0x27e490,_0x4418fd){return client[_0xa579('0x8')](_0x14a544,_0x2aeb20)[_0xa579('0x9')](function(_0x51f0a0){logger[_0xa579('0xa')](_0xa579('0xb'),_0x770152,_0xa579('0xc'));logger[_0xa579('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x770152,_0xa579('0xc'),JSON[_0xa579('0xe')](_0x51f0a0));if(_0x51f0a0[_0xa579('0xf')]){if(_0x51f0a0[_0xa579('0xf')]['code']===0x1f4){logger[_0xa579('0xf')](_0xa579('0xb'),_0x770152,_0x51f0a0[_0xa579('0xf')][_0xa579('0x10')]);return _0x4418fd(_0x51f0a0[_0xa579('0xf')][_0xa579('0x10')]);}logger['error'](_0xa579('0xb'),_0x770152,_0x51f0a0['error'][_0xa579('0x10')]);return _0x27e490(_0x51f0a0[_0xa579('0xf')][_0xa579('0x10')]);}else{logger[_0xa579('0xa')](_0xa579('0xb'),_0x770152,_0xa579('0xc'));_0x27e490(_0x51f0a0[_0xa579('0x11')][_0xa579('0x10')]);}})['catch'](function(_0x567224){logger['error'](_0xa579('0xb'),_0x770152,_0x567224);_0x4418fd(_0x567224);});});} \ No newline at end of file +var _0x61c7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x51ee4b,_0x1a1bed){var _0x57904d=function(_0x34602){while(--_0x34602){_0x51ee4b['push'](_0x51ee4b['shift']());}};_0x57904d(++_0x1a1bed);}(_0x61c7,0x127));var _0x761c=function(_0x2edb70,_0x12a185){_0x2edb70=_0x2edb70-0x0;var _0x36ebd4=_0x61c7[_0x2edb70];return _0x36ebd4;};'use strict';var _=require(_0x761c('0x0'));var util=require(_0x761c('0x1'));var moment=require(_0x761c('0x2'));var BPromise=require(_0x761c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x761c('0x4'));var db=require(_0x761c('0x5'))['db'];var utils=require(_0x761c('0x6'));var logger=require(_0x761c('0x7'))(_0x761c('0x8'));var config=require(_0x761c('0x9'));var jayson=require(_0x761c('0xa'));var client=jayson[_0x761c('0xb')][_0x761c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12db27,_0x46d11e,_0x534de7){return new BPromise(function(_0x3211b7,_0x399d57){return client[_0x761c('0xd')](_0x12db27,_0x534de7)['then'](function(_0x47f1f6){logger[_0x761c('0xe')](_0x761c('0xf'),_0x46d11e,'request\x20sent');logger[_0x761c('0x10')](_0x761c('0x11'),_0x46d11e,_0x761c('0x12'),JSON[_0x761c('0x13')](_0x47f1f6));if(_0x47f1f6[_0x761c('0x14')]){if(_0x47f1f6[_0x761c('0x14')][_0x761c('0x15')]===0x1f4){logger[_0x761c('0x14')](_0x761c('0xf'),_0x46d11e,_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);return _0x399d57(_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);}logger[_0x761c('0x14')](_0x761c('0xf'),_0x46d11e,_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);return _0x3211b7(_0x47f1f6[_0x761c('0x14')][_0x761c('0x16')]);}else{logger[_0x761c('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46d11e,'request\x20sent');_0x3211b7(_0x47f1f6['result'][_0x761c('0x16')]);}})['catch'](function(_0x3e19ed){logger['error'](_0x761c('0xf'),_0x46d11e,_0x3e19ed);_0x399d57(_0x3e19ed);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2dacc3e..d7989c8 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 _0x3095=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x3095,0x14c));var _0x5309=function(_0x2d2f1a,_0x57b966){_0x2d2f1a=_0x2d2f1a-0x0;var _0x55d9db=_0x3095[_0x2d2f1a];return _0x55d9db;};'use strict';var multer=require(_0x5309('0x0'));var util=require(_0x5309('0x1'));var path=require('path');var timeout=require(_0x5309('0x2'));var express=require(_0x5309('0x3'));var router=express[_0x5309('0x4')]();var fs_extra=require(_0x5309('0x5'));var auth=require(_0x5309('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5309('0x7'));var controller=require(_0x5309('0x8'));router[_0x5309('0x9')]('/',auth[_0x5309('0xa')](),controller[_0x5309('0xb')]);router[_0x5309('0x9')](_0x5309('0xc'),auth[_0x5309('0xa')](),controller[_0x5309('0xd')]);router[_0x5309('0x9')](_0x5309('0xe'),auth[_0x5309('0xa')](),controller[_0x5309('0xf')]);router[_0x5309('0x10')]('/',auth[_0x5309('0xa')](),controller[_0x5309('0x11')]);router['put'](_0x5309('0xc'),auth[_0x5309('0xa')](),controller[_0x5309('0x12')]);router[_0x5309('0x13')](_0x5309('0xc'),auth[_0x5309('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6880=['index','/:id','show','get','/:id/download','download','post','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x2bb5b3,_0x29373f){var _0x1e0d91=function(_0x5bcb7d){while(--_0x5bcb7d){_0x2bb5b3['push'](_0x2bb5b3['shift']());}};_0x1e0d91(++_0x29373f);}(_0x6880,0x8a));var _0x0688=function(_0x5adc07,_0x326d9e){_0x5adc07=_0x5adc07-0x0;var _0x4e677e=_0x6880[_0x5adc07];return _0x4e677e;};'use strict';var multer=require('multer');var util=require(_0x0688('0x0'));var path=require(_0x0688('0x1'));var timeout=require(_0x0688('0x2'));var express=require(_0x0688('0x3'));var router=express['Router']();var fs_extra=require(_0x0688('0x4'));var auth=require(_0x0688('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0688('0x6'));var controller=require(_0x0688('0x7'));router['get']('/',auth[_0x0688('0x8')](),controller[_0x0688('0x9')]);router['get'](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0xb')]);router[_0x0688('0xc')](_0x0688('0xd'),auth['isAuthenticated'](),controller[_0x0688('0xe')]);router[_0x0688('0xf')]('/',auth['isAuthenticated'](),controller[_0x0688('0x10')]);router[_0x0688('0x11')](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0x12')]);router['delete'](_0x0688('0xa'),auth['isAuthenticated'](),controller[_0x0688('0x13')]);module[_0x0688('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ab7ce6f..9b783ad 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 _0xb5cd=['TEXT','STRING'];(function(_0x3eff4a,_0x409014){var _0x2b68d9=function(_0x14e638){while(--_0x14e638){_0x3eff4a['push'](_0x3eff4a['shift']());}};_0x2b68d9(++_0x409014);}(_0xb5cd,0x1ca));var _0xdb5c=function(_0x64789b,_0x142eb0){_0x64789b=_0x64789b-0x0;var _0x2ddd86=_0xb5cd[_0x64789b];return _0x2ddd86;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0xdb5c('0x0')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xdb5c('0x1')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd560=['BOOLEAN','STRING'];(function(_0x5a7242,_0x5bc9e7){var _0x15d862=function(_0x30ea0a){while(--_0x30ea0a){_0x5a7242['push'](_0x5a7242['shift']());}};_0x15d862(++_0x5bc9e7);}(_0xd560,0x69));var _0x0d56=function(_0x34105a,_0xb17783){_0x34105a=_0x34105a-0x0;var _0x3c53f9=_0xd560[_0x34105a];return _0x3c53f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x0d56('0x0')]},'function':{'type':Sequelize[_0x0d56('0x0')]},'format':{'type':Sequelize[_0x0d56('0x0')]},'groupBy':{'type':Sequelize[_0x0d56('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0d56('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b71985d..ba30db7 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 _0x98d4=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','catch','show','params','rawAttributes','keys','intersection','length','find','create','body','bulkCreate','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','CustomReportId','findAll','eml-format','rimraf','fast-json-patch'];(function(_0x12410c,_0x4d5d6b){var _0x3e3320=function(_0x494107){while(--_0x494107){_0x12410c['push'](_0x12410c['shift']());}};_0x3e3320(++_0x4d5d6b);}(_0x98d4,0xf6));var _0x498d=function(_0x4cc1ac,_0x4a1520){_0x4cc1ac=_0x4cc1ac-0x0;var _0x5494d8=_0x98d4[_0x4cc1ac];return _0x5494d8;};'use strict';var emlformat=require(_0x498d('0x0'));var rimraf=require(_0x498d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x498d('0x2'));var rp=require(_0x498d('0x3'));var moment=require(_0x498d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x498d('0x5'));var util=require(_0x498d('0x6'));var path=require(_0x498d('0x7'));var sox=require(_0x498d('0x8'));var csv=require(_0x498d('0x9'));var ejs=require(_0x498d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x498d('0xb'));var squel=require(_0x498d('0xc'));var crypto=require(_0x498d('0xd'));var jsforce=require(_0x498d('0xe'));var deskjs=require(_0x498d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x498d('0x10'));var Papa=require(_0x498d('0x11'));var Redis=require(_0x498d('0x12'));var authService=require(_0x498d('0x13'));var qs=require(_0x498d('0x14'));var as=require(_0x498d('0x15'));var hardwareService=require(_0x498d('0x16'));var logger=require(_0x498d('0x17'))(_0x498d('0x18'));var utils=require(_0x498d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x498d('0x1a'));var db=require(_0x498d('0x1b'))['db'];function respondWithStatusCode(_0x238ff9,_0x327af8){_0x327af8=_0x327af8||0xcc;return function(_0x1100a2){if(_0x1100a2){return _0x238ff9['sendStatus'](_0x327af8);}return _0x238ff9[_0x498d('0x1c')](_0x327af8)['end']();};}function respondWithResult(_0x1104a8,_0xe902cb){_0xe902cb=_0xe902cb||0xc8;return function(_0x5a08b5){if(_0x5a08b5){return _0x1104a8[_0x498d('0x1c')](_0xe902cb)[_0x498d('0x1d')](_0x5a08b5);}};}function respondWithFilteredResult(_0x3825b4,_0x412407){return function(_0x3c06c6){if(_0x3c06c6){var _0x4b6787=typeof _0x412407[_0x498d('0x1e')]===_0x498d('0x1f')&&typeof _0x412407[_0x498d('0x20')]===_0x498d('0x1f');var _0x3e9d45=_0x3c06c6['count'];var _0x3b6e2b=_0x4b6787?0x0:_0x412407[_0x498d('0x1e')];var _0x53882f=_0x4b6787?_0x3c06c6[_0x498d('0x21')]:_0x412407['offset']+_0x412407[_0x498d('0x20')];var _0x1b815d;if(_0x53882f>=_0x3e9d45){_0x53882f=_0x3e9d45;_0x1b815d=0xc8;}else{_0x1b815d=0xce;}_0x3825b4['status'](_0x1b815d);return _0x3825b4[_0x498d('0x22')]('Content-Range',_0x3b6e2b+'-'+_0x53882f+'/'+_0x3e9d45)[_0x498d('0x1d')](_0x3c06c6);}return null;};}function patchUpdates(_0xaa318a){return function(_0x5841db){try{jsonpatch[_0x498d('0x23')](_0x5841db,_0xaa318a,!![]);}catch(_0x28582f){return BPromise[_0x498d('0x24')](_0x28582f);}return _0x5841db['save']();};}function saveUpdates(_0x16a81c,_0x4f2144){return function(_0x4f341f){if(_0x4f341f){return _0x4f341f[_0x498d('0x25')](_0x16a81c)[_0x498d('0x26')](function(_0x5f48aa){return _0x5f48aa;});}return null;};}function removeEntity(_0xa0d462,_0x5dcea5){return function(_0x27c32e){if(_0x27c32e){return _0x27c32e['destroy']()[_0x498d('0x26')](function(){_0xa0d462[_0x498d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b4c29,_0x2a618a){return function(_0x5eca3c){if(!_0x5eca3c){_0x9b4c29[_0x498d('0x27')](0x194);}return _0x5eca3c;};}function handleError(_0x4015cb,_0x2cc1bd){_0x2cc1bd=_0x2cc1bd||0x1f4;return function(_0x1d659f){logger['error'](_0x1d659f[_0x498d('0x28')]);if(_0x1d659f[_0x498d('0x29')]){delete _0x1d659f['name'];}_0x4015cb[_0x498d('0x1c')](_0x2cc1bd)[_0x498d('0x2a')](_0x1d659f);};}exports[_0x498d('0x2b')]=function(_0x3fd2bc,_0x5412ce){var _0x246e07={},_0x19c37b={},_0x47b9c5={'count':0x0,'rows':[]};var _0x47b8ce=_[_0x498d('0x2c')](db['AnalyticFieldReport']['rawAttributes'],function(_0x1edfca){return{'name':_0x1edfca[_0x498d('0x2d')],'type':_0x1edfca[_0x498d('0x2e')][_0x498d('0x2f')]};});_0x19c37b[_0x498d('0x30')]=_['map'](_0x47b8ce,_0x498d('0x29'));_0x19c37b[_0x498d('0x31')]=_['keys'](_0x3fd2bc[_0x498d('0x31')]);_0x19c37b[_0x498d('0x32')]=_['intersection'](_0x19c37b[_0x498d('0x30')],_0x19c37b[_0x498d('0x31')]);_0x246e07[_0x498d('0x33')]=_['intersection'](_0x19c37b['model'],qs['fields'](_0x3fd2bc[_0x498d('0x31')][_0x498d('0x34')]));_0x246e07['attributes']=_0x246e07[_0x498d('0x33')]['length']?_0x246e07[_0x498d('0x33')]:_0x19c37b['model'];if(!_0x3fd2bc['query'][_0x498d('0x35')](_0x498d('0x36'))){_0x246e07[_0x498d('0x20')]=qs['limit'](_0x3fd2bc['query'][_0x498d('0x20')]);_0x246e07[_0x498d('0x1e')]=qs[_0x498d('0x1e')](_0x3fd2bc[_0x498d('0x31')][_0x498d('0x1e')]);}_0x246e07['order']=qs[_0x498d('0x37')](_0x3fd2bc['query'][_0x498d('0x37')]);_0x246e07[_0x498d('0x38')]=qs[_0x498d('0x32')](_[_0x498d('0x39')](_0x3fd2bc[_0x498d('0x31')],_0x19c37b[_0x498d('0x32')]),_0x47b8ce);if(_0x3fd2bc[_0x498d('0x31')]['filter']){_0x246e07['where']=_[_0x498d('0x3a')](_0x246e07[_0x498d('0x38')],{'$or':_[_0x498d('0x2c')](_0x47b8ce,function(_0x227169){if(_0x227169[_0x498d('0x2e')]!==_0x498d('0x3b')){var _0x28c14f={};_0x28c14f[_0x227169[_0x498d('0x29')]]={'$like':'%'+_0x3fd2bc['query'][_0x498d('0x3c')]+'%'};return _0x28c14f;}})});}_0x246e07=_[_0x498d('0x3a')]({},_0x246e07,_0x3fd2bc[_0x498d('0x3d')]);var _0x57ef37={'where':_0x246e07[_0x498d('0x38')]};return db[_0x498d('0x3e')][_0x498d('0x21')](_0x57ef37)['then'](function(_0x10e8ad){_0x47b9c5[_0x498d('0x21')]=_0x10e8ad;if(_0x3fd2bc[_0x498d('0x31')][_0x498d('0x3f')]){_0x246e07[_0x498d('0x40')]=[{'all':!![]}];}return db[_0x498d('0x3e')]['findAll'](_0x246e07);})[_0x498d('0x26')](function(_0x25d513){_0x47b9c5['rows']=_0x25d513;return _0x47b9c5;})[_0x498d('0x26')](respondWithFilteredResult(_0x5412ce,_0x246e07))[_0x498d('0x41')](handleError(_0x5412ce,null));};exports[_0x498d('0x42')]=function(_0x3ba881,_0x2471f8){var _0x210fac={'raw':![],'where':{'id':_0x3ba881[_0x498d('0x43')]['id']}},_0x23d050={};_0x23d050[_0x498d('0x30')]=_['keys'](db[_0x498d('0x3e')][_0x498d('0x44')]);_0x23d050[_0x498d('0x31')]=_[_0x498d('0x45')](_0x3ba881['query']);_0x23d050[_0x498d('0x32')]=_[_0x498d('0x46')](_0x23d050['model'],_0x23d050[_0x498d('0x31')]);_0x210fac[_0x498d('0x33')]=_['intersection'](_0x23d050[_0x498d('0x30')],qs['fields'](_0x3ba881[_0x498d('0x31')][_0x498d('0x34')]));_0x210fac['attributes']=_0x210fac[_0x498d('0x33')][_0x498d('0x47')]?_0x210fac['attributes']:_0x23d050[_0x498d('0x30')];if(_0x3ba881['query'][_0x498d('0x3f')]){_0x210fac[_0x498d('0x40')]=[{'all':!![]}];}_0x210fac=_['merge']({},_0x210fac,_0x3ba881[_0x498d('0x3d')]);return db['AnalyticFieldReport'][_0x498d('0x48')](_0x210fac)[_0x498d('0x26')](handleEntityNotFound(_0x2471f8,null))[_0x498d('0x26')](respondWithResult(_0x2471f8,null))[_0x498d('0x41')](handleError(_0x2471f8,null));};exports[_0x498d('0x49')]=function(_0x11d8e5,_0x2ec9ff){return db[_0x498d('0x3e')][_0x498d('0x49')](_0x11d8e5[_0x498d('0x4a')],{})[_0x498d('0x26')](respondWithResult(_0x2ec9ff,0xc9))[_0x498d('0x41')](handleError(_0x2ec9ff,null));};exports['bulkCreate']=function(_0x5376c7,_0x5f24da){return db[_0x498d('0x3e')][_0x498d('0x4b')](_0x5376c7[_0x498d('0x4a')],{'raw':![],'individualHooks':!![]})[_0x498d('0x26')](respondWithResult(_0x5f24da,0xc9))['catch'](handleError(_0x5f24da,null));};exports[_0x498d('0x25')]=function(_0x291acf,_0x2fdfbd){if(_0x291acf['body']['id']){delete _0x291acf[_0x498d('0x4a')]['id'];}return db[_0x498d('0x3e')][_0x498d('0x48')]({'where':{'id':_0x291acf[_0x498d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fdfbd,null))[_0x498d('0x26')](saveUpdates(_0x291acf[_0x498d('0x4a')],null))['then'](respondWithResult(_0x2fdfbd,null))['catch'](handleError(_0x2fdfbd,null));};exports['destroy']=function(_0x1c3d90,_0x14cfdd){return db[_0x498d('0x3e')][_0x498d('0x48')]({'where':{'id':_0x1c3d90[_0x498d('0x43')]['id']}})['then'](handleEntityNotFound(_0x14cfdd,null))['then'](removeEntity(_0x14cfdd,null))['catch'](handleError(_0x14cfdd,null));};exports[_0x498d('0x4c')]=function(_0x4e7671,_0x240ae3){return db[_0x498d('0x3e')][_0x498d('0x4d')]({'where':{'id':_0x4e7671[_0x498d('0x31')][_0x498d('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x498d('0x26')](respondWithResult(_0x240ae3,0xcc))[_0x498d('0x41')](handleError(_0x240ae3,null));};exports[_0x498d('0x4f')]=function(_0x29e8e9,_0x94c0af,_0x5ecd55){return db[_0x498d('0x50')]['findOne']({'where':{'id':_0x29e8e9['params']['id']}})[_0x498d('0x26')](handleEntityNotFound(_0x94c0af,null))['then'](function(_0x2ca35a){if(_0x2ca35a){return db['sequelize']['transaction'](function(_0x157087){return db[_0x498d('0x3e')]['destroy']({'where':{'CustomReportId':_0x29e8e9[_0x498d('0x43')]['id']},'transaction':_0x157087})[_0x498d('0x26')](function(_0x2e2191){var _0x4b9982=_['map'](_0x29e8e9['body'],function(_0x598d89){delete _0x598d89['id'];_0x598d89[_0x498d('0x51')]=_0x29e8e9['params']['id'];return _0x598d89;});return db[_0x498d('0x3e')][_0x498d('0x4b')](_0x4b9982,{'transaction':_0x157087});});})[_0x498d('0x26')](function(){return db['AnalyticFieldReport'][_0x498d('0x52')]({'where':{'CustomReportId':_0x29e8e9[_0x498d('0x43')]['id']}});});}})[_0x498d('0x26')](respondWithResult(_0x94c0af,null))[_0x498d('0x41')](handleError(_0x94c0af,null));}; \ No newline at end of file +var _0x5d6c=['mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','where','AnalyticFieldReport','include','findAll','rows','show','params','length','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x458ff5,_0x3584f1){var _0x535703=function(_0x5a961e){while(--_0x5a961e){_0x458ff5['push'](_0x458ff5['shift']());}};_0x535703(++_0x3584f1);}(_0x5d6c,0x184));var _0xc5d6=function(_0x2bcbc3,_0x5b509e){_0x2bcbc3=_0x2bcbc3-0x0;var _0x5c1c86=_0x5d6c[_0x2bcbc3];return _0x5c1c86;};'use strict';var emlformat=require(_0xc5d6('0x0'));var rimraf=require(_0xc5d6('0x1'));var zipdir=require(_0xc5d6('0x2'));var jsonpatch=require(_0xc5d6('0x3'));var rp=require(_0xc5d6('0x4'));var moment=require(_0xc5d6('0x5'));var BPromise=require(_0xc5d6('0x6'));var Mustache=require(_0xc5d6('0x7'));var util=require(_0xc5d6('0x8'));var path=require(_0xc5d6('0x9'));var sox=require(_0xc5d6('0xa'));var csv=require(_0xc5d6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5d6('0xc'));var _=require('lodash');var squel=require(_0xc5d6('0xd'));var crypto=require(_0xc5d6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc5d6('0xb'));var querystring=require(_0xc5d6('0xf'));var Papa=require(_0xc5d6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5d6('0x11'));var hardwareService=require(_0xc5d6('0x12'));var logger=require(_0xc5d6('0x13'))('api');var utils=require(_0xc5d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc5d6('0x15'));var db=require(_0xc5d6('0x16'))['db'];function respondWithStatusCode(_0xbbc447,_0x1b500e){_0x1b500e=_0x1b500e||0xcc;return function(_0x2e34e9){if(_0x2e34e9){return _0xbbc447[_0xc5d6('0x17')](_0x1b500e);}return _0xbbc447['status'](_0x1b500e)[_0xc5d6('0x18')]();};}function respondWithResult(_0x2365cc,_0x28ced0){_0x28ced0=_0x28ced0||0xc8;return function(_0x27c824){if(_0x27c824){return _0x2365cc[_0xc5d6('0x19')](_0x28ced0)['json'](_0x27c824);}};}function respondWithFilteredResult(_0x19c654,_0x4b1a94){return function(_0x3d7a5c){if(_0x3d7a5c){var _0x3ce415=typeof _0x4b1a94[_0xc5d6('0x1a')]==='undefined'&&typeof _0x4b1a94[_0xc5d6('0x1b')]==='undefined';var _0x204d41=_0x3d7a5c[_0xc5d6('0x1c')];var _0x3cff82=_0x3ce415?0x0:_0x4b1a94[_0xc5d6('0x1a')];var _0x3e0c57=_0x3ce415?_0x3d7a5c[_0xc5d6('0x1c')]:_0x4b1a94[_0xc5d6('0x1a')]+_0x4b1a94['limit'];var _0x3d332c;if(_0x3e0c57>=_0x204d41){_0x3e0c57=_0x204d41;_0x3d332c=0xc8;}else{_0x3d332c=0xce;}_0x19c654[_0xc5d6('0x19')](_0x3d332c);return _0x19c654['set'](_0xc5d6('0x1d'),_0x3cff82+'-'+_0x3e0c57+'/'+_0x204d41)[_0xc5d6('0x1e')](_0x3d7a5c);}return null;};}function patchUpdates(_0x323edf){return function(_0x3e8e96){try{jsonpatch[_0xc5d6('0x1f')](_0x3e8e96,_0x323edf,!![]);}catch(_0x109287){return BPromise['reject'](_0x109287);}return _0x3e8e96[_0xc5d6('0x20')]();};}function saveUpdates(_0x138fc5,_0x2f3587){return function(_0x266eb8){if(_0x266eb8){return _0x266eb8['update'](_0x138fc5)[_0xc5d6('0x21')](function(_0x1f7beb){return _0x1f7beb;});}return null;};}function removeEntity(_0x268b76,_0x2de5ee){return function(_0x2b6dc6){if(_0x2b6dc6){return _0x2b6dc6[_0xc5d6('0x22')]()['then'](function(){_0x268b76[_0xc5d6('0x19')](0xcc)[_0xc5d6('0x18')]();});}};}function handleEntityNotFound(_0x2f7055,_0x371e51){return function(_0x3e2328){if(!_0x3e2328){_0x2f7055[_0xc5d6('0x17')](0x194);}return _0x3e2328;};}function handleError(_0x541bff,_0x2758ba){_0x2758ba=_0x2758ba||0x1f4;return function(_0x5aa726){logger['error'](_0x5aa726[_0xc5d6('0x23')]);if(_0x5aa726['name']){delete _0x5aa726[_0xc5d6('0x24')];}_0x541bff[_0xc5d6('0x19')](_0x2758ba)[_0xc5d6('0x25')](_0x5aa726);};}exports[_0xc5d6('0x26')]=function(_0x40cb75,_0x303247){var _0x5695a4={},_0x325ac7={},_0x4c2b51={'count':0x0,'rows':[]};var _0x5b048f=_[_0xc5d6('0x27')](db['AnalyticFieldReport'][_0xc5d6('0x28')],function(_0x2178c4){return{'name':_0x2178c4[_0xc5d6('0x29')],'type':_0x2178c4[_0xc5d6('0x2a')][_0xc5d6('0x2b')]};});_0x325ac7[_0xc5d6('0x2c')]=_[_0xc5d6('0x27')](_0x5b048f,_0xc5d6('0x24'));_0x325ac7[_0xc5d6('0x2d')]=_[_0xc5d6('0x2e')](_0x40cb75['query']);_0x325ac7['filters']=_[_0xc5d6('0x2f')](_0x325ac7['model'],_0x325ac7[_0xc5d6('0x2d')]);_0x5695a4[_0xc5d6('0x30')]=_[_0xc5d6('0x2f')](_0x325ac7[_0xc5d6('0x2c')],qs[_0xc5d6('0x31')](_0x40cb75['query'][_0xc5d6('0x31')]));_0x5695a4[_0xc5d6('0x30')]=_0x5695a4['attributes']['length']?_0x5695a4[_0xc5d6('0x30')]:_0x325ac7[_0xc5d6('0x2c')];if(!_0x40cb75['query']['hasOwnProperty'](_0xc5d6('0x32'))){_0x5695a4['limit']=qs[_0xc5d6('0x1b')](_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x1b')]);_0x5695a4['offset']=qs[_0xc5d6('0x1a')](_0x40cb75['query'][_0xc5d6('0x1a')]);}_0x5695a4[_0xc5d6('0x33')]=qs['sort'](_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x34')]);_0x5695a4['where']=qs['filters'](_['pick'](_0x40cb75[_0xc5d6('0x2d')],_0x325ac7[_0xc5d6('0x35')]),_0x5b048f);if(_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x36')]){_0x5695a4['where']=_[_0xc5d6('0x37')](_0x5695a4['where'],{'$or':_['map'](_0x5b048f,function(_0x390ca9){if(_0x390ca9[_0xc5d6('0x2a')]!==_0xc5d6('0x38')){var _0x57cb4b={};_0x57cb4b[_0x390ca9[_0xc5d6('0x24')]]={'$like':'%'+_0x40cb75[_0xc5d6('0x2d')][_0xc5d6('0x36')]+'%'};return _0x57cb4b;}})});}_0x5695a4=_[_0xc5d6('0x37')]({},_0x5695a4,_0x40cb75[_0xc5d6('0x39')]);var _0x25ae1e={'where':_0x5695a4[_0xc5d6('0x3a')]};return db[_0xc5d6('0x3b')][_0xc5d6('0x1c')](_0x25ae1e)['then'](function(_0x5b101f){_0x4c2b51['count']=_0x5b101f;if(_0x40cb75[_0xc5d6('0x2d')]['includeAll']){_0x5695a4[_0xc5d6('0x3c')]=[{'all':!![]}];}return db[_0xc5d6('0x3b')][_0xc5d6('0x3d')](_0x5695a4);})[_0xc5d6('0x21')](function(_0x1f785c){_0x4c2b51[_0xc5d6('0x3e')]=_0x1f785c;return _0x4c2b51;})[_0xc5d6('0x21')](respondWithFilteredResult(_0x303247,_0x5695a4))['catch'](handleError(_0x303247,null));};exports[_0xc5d6('0x3f')]=function(_0x5e8a28,_0x5d510d){var _0x295f77={'raw':![],'where':{'id':_0x5e8a28[_0xc5d6('0x40')]['id']}},_0x135c97={};_0x135c97[_0xc5d6('0x2c')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x135c97[_0xc5d6('0x2d')]=_[_0xc5d6('0x2e')](_0x5e8a28[_0xc5d6('0x2d')]);_0x135c97['filters']=_['intersection'](_0x135c97['model'],_0x135c97[_0xc5d6('0x2d')]);_0x295f77[_0xc5d6('0x30')]=_['intersection'](_0x135c97[_0xc5d6('0x2c')],qs[_0xc5d6('0x31')](_0x5e8a28[_0xc5d6('0x2d')][_0xc5d6('0x31')]));_0x295f77['attributes']=_0x295f77[_0xc5d6('0x30')][_0xc5d6('0x41')]?_0x295f77[_0xc5d6('0x30')]:_0x135c97['model'];if(_0x5e8a28[_0xc5d6('0x2d')]['includeAll']){_0x295f77[_0xc5d6('0x3c')]=[{'all':!![]}];}_0x295f77=_[_0xc5d6('0x37')]({},_0x295f77,_0x5e8a28[_0xc5d6('0x39')]);return db['AnalyticFieldReport'][_0xc5d6('0x42')](_0x295f77)[_0xc5d6('0x21')](handleEntityNotFound(_0x5d510d,null))[_0xc5d6('0x21')](respondWithResult(_0x5d510d,null))[_0xc5d6('0x43')](handleError(_0x5d510d,null));};exports['create']=function(_0x1eab83,_0xc80268){return db[_0xc5d6('0x3b')][_0xc5d6('0x44')](_0x1eab83[_0xc5d6('0x45')],{})[_0xc5d6('0x21')](respondWithResult(_0xc80268,0xc9))[_0xc5d6('0x43')](handleError(_0xc80268,null));};exports[_0xc5d6('0x46')]=function(_0x361bca,_0x6e2550){return db[_0xc5d6('0x3b')][_0xc5d6('0x46')](_0x361bca[_0xc5d6('0x45')],{'raw':![],'individualHooks':!![]})[_0xc5d6('0x21')](respondWithResult(_0x6e2550,0xc9))[_0xc5d6('0x43')](handleError(_0x6e2550,null));};exports[_0xc5d6('0x47')]=function(_0x3a7c85,_0xe14025){if(_0x3a7c85['body']['id']){delete _0x3a7c85[_0xc5d6('0x45')]['id'];}return db[_0xc5d6('0x3b')][_0xc5d6('0x42')]({'where':{'id':_0x3a7c85[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0xe14025,null))[_0xc5d6('0x21')](saveUpdates(_0x3a7c85[_0xc5d6('0x45')],null))[_0xc5d6('0x21')](respondWithResult(_0xe14025,null))[_0xc5d6('0x43')](handleError(_0xe14025,null));};exports[_0xc5d6('0x22')]=function(_0x2c5e3d,_0x31526b){return db[_0xc5d6('0x3b')][_0xc5d6('0x42')]({'where':{'id':_0x2c5e3d[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0x31526b,null))[_0xc5d6('0x21')](removeEntity(_0x31526b,null))['catch'](handleError(_0x31526b,null));};exports[_0xc5d6('0x48')]=function(_0x472368,_0x3f05ac){return db['AnalyticFieldReport'][_0xc5d6('0x22')]({'where':{'id':_0x472368['query'][_0xc5d6('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3f05ac,0xcc))[_0xc5d6('0x43')](handleError(_0x3f05ac,null));};exports[_0xc5d6('0x4a')]=function(_0x4bcd03,_0xa5da21,_0x4e5d7e){return db[_0xc5d6('0x4b')]['findOne']({'where':{'id':_0x4bcd03[_0xc5d6('0x40')]['id']}})[_0xc5d6('0x21')](handleEntityNotFound(_0xa5da21,null))[_0xc5d6('0x21')](function(_0xf9070a){if(_0xf9070a){return db[_0xc5d6('0x4c')][_0xc5d6('0x4d')](function(_0x3808e4){return db[_0xc5d6('0x3b')]['destroy']({'where':{'CustomReportId':_0x4bcd03[_0xc5d6('0x40')]['id']},'transaction':_0x3808e4})[_0xc5d6('0x21')](function(_0x45cbd){var _0x43a07c=_[_0xc5d6('0x27')](_0x4bcd03[_0xc5d6('0x45')],function(_0x17f5bd){delete _0x17f5bd['id'];_0x17f5bd[_0xc5d6('0x4e')]=_0x4bcd03[_0xc5d6('0x40')]['id'];return _0x17f5bd;});return db[_0xc5d6('0x3b')][_0xc5d6('0x46')](_0x43a07c,{'transaction':_0x3808e4});});})[_0xc5d6('0x21')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4bcd03[_0xc5d6('0x40')]['id']}});});}})[_0xc5d6('0x21')](respondWithResult(_0xa5da21,null))['catch'](handleError(_0xa5da21,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9046f8a..668f8a3 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 _0x2866=['moment','bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','lodash','api'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x2866,0xce));var _0x6286=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0x2866[_0x4b33d1];return _0x9e7221;};'use strict';var _=require(_0x6286('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6286('0x1'));var moment=require(_0x6286('0x2'));var BPromise=require(_0x6286('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6286('0x4'));var config=require(_0x6286('0x5'));var attributes=require(_0x6286('0x6'));module['exports']=function(_0xacb9b9,_0x445f04){return _0xacb9b9['define'](_0x6286('0x7'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67ba=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x67ba,0xf0));var _0xa67b=function(_0x112fc4,_0x9381f0){_0x112fc4=_0x112fc4-0x0;var _0x36cd0d=_0x67ba[_0x112fc4];return _0x36cd0d;};'use strict';var _=require(_0xa67b('0x0'));var util=require('util');var logger=require(_0xa67b('0x1'))(_0xa67b('0x2'));var moment=require(_0xa67b('0x3'));var BPromise=require(_0xa67b('0x4'));var rp=require(_0xa67b('0x5'));var fs=require('fs');var path=require(_0xa67b('0x6'));var rimraf=require(_0xa67b('0x7'));var config=require(_0xa67b('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xa67b('0x9')]=function(_0x30b83e,_0x3c41ac){return _0x30b83e[_0xa67b('0xa')](_0xa67b('0xb'),attributes,{'tableName':'analytics_report_fields','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 bb78497..a7b357e 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 _0x20a6=['error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0x20a6,0x158));var _0x620a=function(_0x211e5e,_0x53c06b){_0x211e5e=_0x211e5e-0x0;var _0x1f297b=_0x20a6[_0x211e5e];return _0x1f297b;};'use strict';var _=require(_0x620a('0x0'));var util=require(_0x620a('0x1'));var moment=require(_0x620a('0x2'));var BPromise=require(_0x620a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620a('0x4'));var db=require(_0x620a('0x5'))['db'];var utils=require(_0x620a('0x6'));var logger=require('../../config/logger')(_0x620a('0x7'));var config=require('../../config/environment');var jayson=require(_0x620a('0x8'));var client=jayson['client'][_0x620a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33b63f,_0x4f8ee5,_0x4e8562){return new BPromise(function(_0xce1ceb,_0x2d1728){return client[_0x620a('0xa')](_0x33b63f,_0x4e8562)['then'](function(_0x47c930){logger[_0x620a('0xb')](_0x620a('0xc'),_0x4f8ee5,_0x620a('0xd'));logger[_0x620a('0xe')](_0x620a('0xf'),_0x4f8ee5,_0x620a('0xd'),JSON[_0x620a('0x10')](_0x47c930));if(_0x47c930[_0x620a('0x11')]){if(_0x47c930[_0x620a('0x11')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x4f8ee5,_0x47c930[_0x620a('0x11')][_0x620a('0x12')]);return _0x2d1728(_0x47c930['error'][_0x620a('0x12')]);}logger['error'](_0x620a('0xc'),_0x4f8ee5,_0x47c930[_0x620a('0x11')]['message']);return _0xce1ceb(_0x47c930[_0x620a('0x11')][_0x620a('0x12')]);}else{logger['info'](_0x620a('0xc'),_0x4f8ee5,_0x620a('0xd'));_0xce1ceb(_0x47c930['result'][_0x620a('0x12')]);}})['catch'](function(_0x3b4379){logger[_0x620a('0x11')](_0x620a('0xc'),_0x4f8ee5,_0x3b4379);_0x2d1728(_0x3b4379);});});} \ No newline at end of file +var _0x249e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x249e,0x140));var _0xe249=function(_0x3d16a5,_0x1e4c3c){_0x3d16a5=_0x3d16a5-0x0;var _0x558613=_0x249e[_0x3d16a5];return _0x558613;};'use strict';var _=require(_0xe249('0x0'));var util=require(_0xe249('0x1'));var moment=require(_0xe249('0x2'));var BPromise=require('bluebird');var rs=require(_0xe249('0x3'));var fs=require('fs');var Redis=require(_0xe249('0x4'));var db=require(_0xe249('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe249('0x6'))('rpc');var config=require(_0xe249('0x7'));var jayson=require(_0xe249('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2abb96,_0x2b8647,_0x5bf29f){return new BPromise(function(_0x3c674c,_0xd1ca7d){return client['request'](_0x2abb96,_0x5bf29f)[_0xe249('0x9')](function(_0x31adcd){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2b8647,_0xe249('0xa'));logger[_0xe249('0xb')](_0xe249('0xc'),_0x2b8647,_0xe249('0xa'),JSON[_0xe249('0xd')](_0x31adcd));if(_0x31adcd[_0xe249('0xe')]){if(_0x31adcd[_0xe249('0xe')][_0xe249('0xf')]===0x1f4){logger[_0xe249('0xe')](_0xe249('0x10'),_0x2b8647,_0x31adcd[_0xe249('0xe')]['message']);return _0xd1ca7d(_0x31adcd[_0xe249('0xe')][_0xe249('0x11')]);}logger[_0xe249('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2b8647,_0x31adcd[_0xe249('0xe')][_0xe249('0x11')]);return _0x3c674c(_0x31adcd[_0xe249('0xe')]['message']);}else{logger['info'](_0xe249('0x10'),_0x2b8647,_0xe249('0xa'));_0x3c674c(_0x31adcd[_0xe249('0x12')][_0xe249('0x11')]);}})[_0xe249('0x13')](function(_0xc49e62){logger[_0xe249('0xe')](_0xe249('0x10'),_0x2b8647,_0xc49e62);_0xd1ca7d(_0xc49e62);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e8df023..137b692 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(_0x1d5a62,_0x416319){var _0x59f074=function(_0x375fd4){while(--_0x375fd4){_0x1d5a62['push'](_0x1d5a62['shift']());}};_0x59f074(++_0x416319);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x4b3fe3,_0x194dad){var _0x476091=function(_0x5cf290){while(--_0x5cf290){_0x4b3fe3['push'](_0x4b3fe3['shift']());}};_0x476091(++_0x194dad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 6919aaf..92af735 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 _0xfaa4=['exports','STRING','name','TEXT','sequelize'];(function(_0x1627dd,_0x51eb83){var _0x22a654=function(_0x11234b){while(--_0x11234b){_0x1627dd['push'](_0x1627dd['shift']());}};_0x22a654(++_0x51eb83);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x8b0bbb,_0x3b17ea){_0x8b0bbb=_0x8b0bbb-0x0;var _0x43c308=_0xfaa4[_0x8b0bbb];return _0x43c308;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'name':{'type':Sequelize[_0x4faa('0x2')],'allowNull':![],'unique':_0x4faa('0x3')},'table':{'type':Sequelize[_0x4faa('0x2')]},'metric':{'type':Sequelize[_0x4faa('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2746=['TEXT','STRING','name'];(function(_0x30b53a,_0x5ebc30){var _0x51c395=function(_0x527bba){while(--_0x527bba){_0x30b53a['push'](_0x30b53a['shift']());}};_0x51c395(++_0x5ebc30);}(_0x2746,0x19c));var _0x6274=function(_0x970579,_0x515788){_0x970579=_0x970579-0x0;var _0x1dcc78=_0x2746[_0x970579];return _0x1dcc78;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6274('0x0')],'allowNull':![],'unique':_0x6274('0x1')},'table':{'type':Sequelize[_0x6274('0x0')]},'metric':{'type':Sequelize[_0x6274('0x2')]},'description':{'type':Sequelize[_0x6274('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5269e3b..c1a2d29 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1ca5a3,_0x40b024){var _0xc8acbf=function(_0x5b50df){while(--_0x5b50df){_0x1ca5a3['push'](_0x1ca5a3['shift']());}};_0xc8acbf(++_0x40b024);}(_0x008c,0x188));var _0xc008=function(_0x462150,_0x48ac37){_0x462150=_0x462150-0x0;var _0x28a15c=_0x008c[_0x462150];return _0x28a15c;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x3ac1f3,_0x8ba690){var _0x1f96ca=function(_0x16b072){while(--_0x16b072){_0x3ac1f3['push'](_0x3ac1f3['shift']());}};_0x1f96ca(++_0x8ba690);}(_0xe5b3,0x133));var _0x3e5b=function(_0x243c94,_0x156778){_0x243c94=_0x243c94-0x0;var _0x33624f=_0xe5b3[_0x243c94];return _0x33624f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index dae1235..a1365f2 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 _0xbdb9=['analytics_metrics','lodash','util','../../config/logger','api','moment','request-promise','exports','AnalyticMetric'];(function(_0x272e18,_0x75e43c){var _0x572ca9=function(_0xf2b51a){while(--_0xf2b51a){_0x272e18['push'](_0x272e18['shift']());}};_0x572ca9(++_0x75e43c);}(_0xbdb9,0xac));var _0x9bdb=function(_0x2ecb35,_0xcba482){_0x2ecb35=_0x2ecb35-0x0;var _0x2f0e95=_0xbdb9[_0x2ecb35];return _0x2f0e95;};'use strict';var _=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var logger=require(_0x9bdb('0x2'))(_0x9bdb('0x3'));var moment=require(_0x9bdb('0x4'));var BPromise=require('bluebird');var rp=require(_0x9bdb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x9bdb('0x6')]=function(_0x4f9fbe,_0x225a66){return _0x4f9fbe['define'](_0x9bdb('0x7'),attributes,{'tableName':_0x9bdb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f1=['path','./analyticMetric.attributes','exports','analytics_metrics','lodash','util','api','moment','request-promise'];(function(_0x1ced88,_0x477e93){var _0x4eafbd=function(_0xc92d8e){while(--_0xc92d8e){_0x1ced88['push'](_0x1ced88['shift']());}};_0x4eafbd(++_0x477e93);}(_0xb2f1,0xee));var _0x1b2f=function(_0xbcb777,_0xb0960){_0xbcb777=_0xbcb777-0x0;var _0x5aafed=_0xb2f1[_0xbcb777];return _0x5aafed;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require('../../config/logger')(_0x1b2f('0x2'));var moment=require(_0x1b2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b2f('0x6'));module[_0x1b2f('0x7')]=function(_0xad728b,_0x4326ba){return _0xad728b['define']('AnalyticMetric',attributes,{'tableName':_0x1b2f('0x8'),'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 b38a92c..1fc786e 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 _0x0351=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x408d56,_0x417b8f){var _0x3a0769=function(_0x489380){while(--_0x489380){_0x408d56['push'](_0x408d56['shift']());}};_0x3a0769(++_0x417b8f);}(_0x0351,0xe2));var _0x1035=function(_0x373441,_0x546ec5){_0x373441=_0x373441-0x0;var _0x478ec1=_0x0351[_0x373441];return _0x478ec1;};'use strict';var _=require(_0x1035('0x0'));var util=require(_0x1035('0x1'));var moment=require(_0x1035('0x2'));var BPromise=require(_0x1035('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1035('0x4'));var db=require(_0x1035('0x5'))['db'];var utils=require(_0x1035('0x6'));var logger=require(_0x1035('0x7'))(_0x1035('0x8'));var config=require(_0x1035('0x9'));var jayson=require(_0x1035('0xa'));var client=jayson[_0x1035('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6e74,_0x3cf5f4,_0x12db6a){return new BPromise(function(_0x5b5c9a,_0x8bf34b){return client['request'](_0x3b6e74,_0x12db6a)[_0x1035('0xc')](function(_0x579581){logger[_0x1035('0xd')](_0x1035('0xe'),_0x3cf5f4,_0x1035('0xf'));logger[_0x1035('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3cf5f4,_0x1035('0xf'),JSON[_0x1035('0x11')](_0x579581));if(_0x579581['error']){if(_0x579581['error'][_0x1035('0x12')]===0x1f4){logger[_0x1035('0x13')](_0x1035('0xe'),_0x3cf5f4,_0x579581[_0x1035('0x13')]['message']);return _0x8bf34b(_0x579581[_0x1035('0x13')][_0x1035('0x14')]);}logger[_0x1035('0x13')](_0x1035('0xe'),_0x3cf5f4,_0x579581[_0x1035('0x13')][_0x1035('0x14')]);return _0x5b5c9a(_0x579581[_0x1035('0x13')][_0x1035('0x14')]);}else{logger[_0x1035('0xd')](_0x1035('0xe'),_0x3cf5f4,_0x1035('0xf'));_0x5b5c9a(_0x579581[_0x1035('0x15')]['message']);}})[_0x1035('0x16')](function(_0x4736f4){logger[_0x1035('0x13')](_0x1035('0xe'),_0x3cf5f4,_0x4736f4);_0x8bf34b(_0x4736f4);});});} \ No newline at end of file +var _0xff86=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticMetric,\x20%s,\x20%s','message'];(function(_0x386306,_0x1363c9){var _0xcb23d=function(_0x1fc525){while(--_0x1fc525){_0x386306['push'](_0x386306['shift']());}};_0xcb23d(++_0x1363c9);}(_0xff86,0x151));var _0x6ff8=function(_0x187324,_0x284da5){_0x187324=_0x187324-0x0;var _0x2c2081=_0xff86[_0x187324];return _0x2c2081;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ff8('0x0'));var BPromise=require(_0x6ff8('0x1'));var rs=require(_0x6ff8('0x2'));var fs=require('fs');var Redis=require(_0x6ff8('0x3'));var db=require(_0x6ff8('0x4'))['db'];var utils=require(_0x6ff8('0x5'));var logger=require('../../config/logger')(_0x6ff8('0x6'));var config=require(_0x6ff8('0x7'));var jayson=require(_0x6ff8('0x8'));var client=jayson[_0x6ff8('0x9')][_0x6ff8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d902,_0x508e92,_0x750a03){return new BPromise(function(_0x32e62e,_0x452d1b){return client[_0x6ff8('0xb')](_0x10d902,_0x750a03)['then'](function(_0x581549){logger[_0x6ff8('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x508e92,'request\x20sent');logger[_0x6ff8('0xd')](_0x6ff8('0xe'),_0x508e92,_0x6ff8('0xf'),JSON['stringify'](_0x581549));if(_0x581549[_0x6ff8('0x10')]){if(_0x581549['error'][_0x6ff8('0x11')]===0x1f4){logger[_0x6ff8('0x10')](_0x6ff8('0x12'),_0x508e92,_0x581549['error'][_0x6ff8('0x13')]);return _0x452d1b(_0x581549[_0x6ff8('0x10')]['message']);}logger[_0x6ff8('0x10')](_0x6ff8('0x12'),_0x508e92,_0x581549[_0x6ff8('0x10')][_0x6ff8('0x13')]);return _0x32e62e(_0x581549[_0x6ff8('0x10')][_0x6ff8('0x13')]);}else{logger[_0x6ff8('0xc')](_0x6ff8('0x12'),_0x508e92,'request\x20sent');_0x32e62e(_0x581549[_0x6ff8('0x14')][_0x6ff8('0x13')]);}})['catch'](function(_0x3b5c79){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x508e92,_0x3b5c79);_0x452d1b(_0x3b5c79);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 793a66d..61f1b91 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 _0x723e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','put','delete','exports','util','path','connect-timeout'];(function(_0x2ba4fa,_0x7dec3e){var _0x2cab3d=function(_0x28682e){while(--_0x28682e){_0x2ba4fa['push'](_0x2ba4fa['shift']());}};_0x2cab3d(++_0x7dec3e);}(_0x723e,0x179));var _0xe723=function(_0x15e634,_0x28558e){_0x15e634=_0x15e634-0x0;var _0x4d5d95=_0x723e[_0x15e634];return _0x4d5d95;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xf')]('/',auth[_0xe723('0xa')](),controller['create']);router[_0xe723('0x10')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['update']);router[_0xe723('0x11')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['destroy']);module[_0xe723('0x12')]=router; \ No newline at end of file +var _0x1dcc=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','put','update'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x34e0db,_0x6be33b){_0x34e0db=_0x34e0db-0x0;var _0x1202d8=_0x1dcc[_0x34e0db];return _0x1202d8;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/:id',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['post']('/',auth[_0xc1dc('0x8')](),controller['create']);router[_0xc1dc('0xc')]('/:id',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xd')]);router[_0xc1dc('0xe')](_0xc1dc('0xf'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x10')]);module[_0xc1dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 32b68ef..f05079c 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 _0xd41f=['TEXT','exports'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xfd41('0x0')]={'tree':{'type':Sequelize[_0xfd41('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8835=['exports','TEXT'];(function(_0x3ab4c8,_0x1e05a4){var _0x59f1e2=function(_0x51afc0){while(--_0x51afc0){_0x3ab4c8['push'](_0x3ab4c8['shift']());}};_0x59f1e2(++_0x1e05a4);}(_0x8835,0xc0));var _0x5883=function(_0xdfa37a,_0x5ac389){_0xdfa37a=_0xdfa37a-0x0;var _0x440926=_0x8835[_0xdfa37a];return _0x440926;};'use strict';var Sequelize=require('sequelize');module[_0x5883('0x0')]={'tree':{'type':Sequelize[_0x5883('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 931d2a4..320f80f 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 _0x613d=['name','map','AnalyticTreeReport','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x613d,0x199));var _0xd613=function(_0x132887,_0x8a429e){_0x132887=_0x132887-0x0;var _0x4edd79=_0x613d[_0x132887];return _0x4edd79;};'use strict';var emlformat=require(_0xd613('0x0'));var rimraf=require(_0xd613('0x1'));var zipdir=require(_0xd613('0x2'));var jsonpatch=require(_0xd613('0x3'));var rp=require(_0xd613('0x4'));var moment=require(_0xd613('0x5'));var BPromise=require(_0xd613('0x6'));var Mustache=require('mustache');var util=require(_0xd613('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd613('0x8'));var fs=require('fs');var fs_extra=require(_0xd613('0x9'));var _=require('lodash');var squel=require(_0xd613('0xa'));var crypto=require(_0xd613('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd613('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd613('0xd'));var authService=require(_0xd613('0xe'));var qs=require(_0xd613('0xf'));var as=require(_0xd613('0x10'));var hardwareService=require(_0xd613('0x11'));var logger=require(_0xd613('0x12'))(_0xd613('0x13'));var utils=require(_0xd613('0x14'));var config=require(_0xd613('0x15'));var licenseUtil=require(_0xd613('0x16'));var db=require(_0xd613('0x17'))['db'];function respondWithStatusCode(_0x9ddf63,_0x398027){_0x398027=_0x398027||0xcc;return function(_0x14299d){if(_0x14299d){return _0x9ddf63['sendStatus'](_0x398027);}return _0x9ddf63[_0xd613('0x18')](_0x398027)[_0xd613('0x19')]();};}function respondWithResult(_0x1197a8,_0x355c18){_0x355c18=_0x355c18||0xc8;return function(_0x307843){if(_0x307843){return _0x1197a8[_0xd613('0x18')](_0x355c18)['json'](_0x307843);}};}function respondWithFilteredResult(_0x103975,_0x1edc1d){return function(_0x5c5cf9){if(_0x5c5cf9){var _0x5dda47=typeof _0x1edc1d['offset']===_0xd613('0x1a')&&typeof _0x1edc1d['limit']===_0xd613('0x1a');var _0x480ab3=_0x5c5cf9[_0xd613('0x1b')];var _0x73b210=_0x5dda47?0x0:_0x1edc1d[_0xd613('0x1c')];var _0x4a7f7d=_0x5dda47?_0x5c5cf9[_0xd613('0x1b')]:_0x1edc1d[_0xd613('0x1c')]+_0x1edc1d[_0xd613('0x1d')];var _0x35b19a;if(_0x4a7f7d>=_0x480ab3){_0x4a7f7d=_0x480ab3;_0x35b19a=0xc8;}else{_0x35b19a=0xce;}_0x103975[_0xd613('0x18')](_0x35b19a);return _0x103975[_0xd613('0x1e')](_0xd613('0x1f'),_0x73b210+'-'+_0x4a7f7d+'/'+_0x480ab3)[_0xd613('0x20')](_0x5c5cf9);}return null;};}function patchUpdates(_0x1e267c){return function(_0x48c307){try{jsonpatch[_0xd613('0x21')](_0x48c307,_0x1e267c,!![]);}catch(_0xc7d001){return BPromise[_0xd613('0x22')](_0xc7d001);}return _0x48c307[_0xd613('0x23')]();};}function saveUpdates(_0x3648ab,_0x2de7f8){return function(_0x3774b3){if(_0x3774b3){return _0x3774b3['update'](_0x3648ab)[_0xd613('0x24')](function(_0x4e7570){return _0x4e7570;});}return null;};}function removeEntity(_0x1f60a3,_0x1435b5){return function(_0x3f146f){if(_0x3f146f){return _0x3f146f[_0xd613('0x25')]()['then'](function(){_0x1f60a3['status'](0xcc)[_0xd613('0x19')]();});}};}function handleEntityNotFound(_0x3ea747,_0x836f72){return function(_0x268ec4){if(!_0x268ec4){_0x3ea747[_0xd613('0x26')](0x194);}return _0x268ec4;};}function handleError(_0x1a6060,_0x189258){_0x189258=_0x189258||0x1f4;return function(_0x565d1f){logger[_0xd613('0x27')](_0x565d1f[_0xd613('0x28')]);if(_0x565d1f[_0xd613('0x29')]){delete _0x565d1f['name'];}_0x1a6060[_0xd613('0x18')](_0x189258)['send'](_0x565d1f);};}exports['index']=function(_0xe916ca,_0x212961){var _0x295532={},_0x11ec8d={},_0x1fd7a8={'count':0x0,'rows':[]};var _0x53144a=_[_0xd613('0x2a')](db[_0xd613('0x2b')]['rawAttributes'],function(_0xe5c34e){return{'name':_0xe5c34e[_0xd613('0x2c')],'type':_0xe5c34e['type']['key']};});_0x11ec8d[_0xd613('0x2d')]=_[_0xd613('0x2a')](_0x53144a,_0xd613('0x29'));_0x11ec8d[_0xd613('0x2e')]=_['keys'](_0xe916ca['query']);_0x11ec8d[_0xd613('0x2f')]=_[_0xd613('0x30')](_0x11ec8d[_0xd613('0x2d')],_0x11ec8d[_0xd613('0x2e')]);_0x295532[_0xd613('0x31')]=_['intersection'](_0x11ec8d[_0xd613('0x2d')],qs[_0xd613('0x32')](_0xe916ca[_0xd613('0x2e')][_0xd613('0x32')]));_0x295532['attributes']=_0x295532['attributes']['length']?_0x295532[_0xd613('0x31')]:_0x11ec8d[_0xd613('0x2d')];if(!_0xe916ca[_0xd613('0x2e')][_0xd613('0x33')]('nolimit')){_0x295532[_0xd613('0x1d')]=qs[_0xd613('0x1d')](_0xe916ca['query'][_0xd613('0x1d')]);_0x295532['offset']=qs['offset'](_0xe916ca[_0xd613('0x2e')][_0xd613('0x1c')]);}_0x295532[_0xd613('0x34')]=qs['sort'](_0xe916ca['query'][_0xd613('0x35')]);_0x295532[_0xd613('0x36')]=qs['filters'](_[_0xd613('0x37')](_0xe916ca['query'],_0x11ec8d[_0xd613('0x2f')]),_0x53144a);if(_0xe916ca[_0xd613('0x2e')][_0xd613('0x38')]){_0x295532[_0xd613('0x36')]=_[_0xd613('0x39')](_0x295532[_0xd613('0x36')],{'$or':_['map'](_0x53144a,function(_0x4e10c9){if(_0x4e10c9[_0xd613('0x3a')]!==_0xd613('0x3b')){var _0x1842de={};_0x1842de[_0x4e10c9[_0xd613('0x29')]]={'$like':'%'+_0xe916ca[_0xd613('0x2e')]['filter']+'%'};return _0x1842de;}})});}_0x295532=_[_0xd613('0x39')]({},_0x295532,_0xe916ca[_0xd613('0x3c')]);var _0x1ba2dd={'where':_0x295532['where']};return db[_0xd613('0x2b')][_0xd613('0x1b')](_0x1ba2dd)[_0xd613('0x24')](function(_0x55db9e){_0x1fd7a8[_0xd613('0x1b')]=_0x55db9e;if(_0xe916ca['query'][_0xd613('0x3d')]){_0x295532[_0xd613('0x3e')]=[{'all':!![]}];}return db[_0xd613('0x2b')][_0xd613('0x3f')](_0x295532);})['then'](function(_0x7f3255){_0x1fd7a8[_0xd613('0x40')]=_0x7f3255;return _0x1fd7a8;})['then'](respondWithFilteredResult(_0x212961,_0x295532))[_0xd613('0x41')](handleError(_0x212961,null));};exports[_0xd613('0x42')]=function(_0x423762,_0x496783){var _0x56e613={'raw':!![],'where':{'id':_0x423762['params']['id']}},_0x3deeff={};_0x3deeff[_0xd613('0x2d')]=_[_0xd613('0x43')](db[_0xd613('0x2b')][_0xd613('0x44')]);_0x3deeff[_0xd613('0x2e')]=_['keys'](_0x423762[_0xd613('0x2e')]);_0x3deeff['filters']=_[_0xd613('0x30')](_0x3deeff[_0xd613('0x2d')],_0x3deeff['query']);_0x56e613[_0xd613('0x31')]=_[_0xd613('0x30')](_0x3deeff[_0xd613('0x2d')],qs[_0xd613('0x32')](_0x423762['query'][_0xd613('0x32')]));_0x56e613[_0xd613('0x31')]=_0x56e613['attributes'][_0xd613('0x45')]?_0x56e613[_0xd613('0x31')]:_0x3deeff[_0xd613('0x2d')];if(_0x423762[_0xd613('0x2e')][_0xd613('0x3d')]){_0x56e613[_0xd613('0x3e')]=[{'all':!![]}];}_0x56e613=_[_0xd613('0x39')]({},_0x56e613,_0x423762[_0xd613('0x3c')]);return db['AnalyticTreeReport'][_0xd613('0x46')](_0x56e613)['then'](handleEntityNotFound(_0x496783,null))[_0xd613('0x24')](respondWithResult(_0x496783,null))[_0xd613('0x41')](handleError(_0x496783,null));};exports[_0xd613('0x47')]=function(_0x16fb04,_0x3643ca){return db['AnalyticTreeReport'][_0xd613('0x47')](_0x16fb04[_0xd613('0x48')],{})[_0xd613('0x24')](respondWithResult(_0x3643ca,0xc9))[_0xd613('0x41')](handleError(_0x3643ca,null));};exports[_0xd613('0x49')]=function(_0x51892e,_0xa0e5fb){if(_0x51892e[_0xd613('0x48')]['id']){delete _0x51892e[_0xd613('0x48')]['id'];}return db['AnalyticTreeReport'][_0xd613('0x46')]({'where':{'id':_0x51892e[_0xd613('0x4a')]['id']}})[_0xd613('0x24')](handleEntityNotFound(_0xa0e5fb,null))['then'](saveUpdates(_0x51892e[_0xd613('0x48')],null))[_0xd613('0x24')](respondWithResult(_0xa0e5fb,null))[_0xd613('0x41')](handleError(_0xa0e5fb,null));};exports[_0xd613('0x25')]=function(_0x3bb593,_0x54fbff){return db['AnalyticTreeReport']['find']({'where':{'id':_0x3bb593['params']['id']}})[_0xd613('0x24')](handleEntityNotFound(_0x54fbff,null))[_0xd613('0x24')](removeEntity(_0x54fbff,null))['catch'](handleError(_0x54fbff,null));}; \ No newline at end of file +var _0x94b3=['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','api','../../config/environment','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','AnalyticTreeReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','include','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x94b3,0x1f2));var _0x394b=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x94b3[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x394b('0x0'));var rp=require(_0x394b('0x1'));var moment=require(_0x394b('0x2'));var BPromise=require(_0x394b('0x3'));var Mustache=require(_0x394b('0x4'));var util=require(_0x394b('0x5'));var path=require(_0x394b('0x6'));var sox=require(_0x394b('0x7'));var csv=require(_0x394b('0x8'));var ejs=require(_0x394b('0x9'));var fs=require('fs');var fs_extra=require(_0x394b('0xa'));var _=require(_0x394b('0xb'));var squel=require(_0x394b('0xc'));var crypto=require(_0x394b('0xd'));var jsforce=require(_0x394b('0xe'));var deskjs=require(_0x394b('0xf'));var toCsv=require(_0x394b('0x8'));var querystring=require('querystring');var Papa=require(_0x394b('0x10'));var Redis=require(_0x394b('0x11'));var authService=require(_0x394b('0x12'));var qs=require(_0x394b('0x13'));var as=require(_0x394b('0x14'));var hardwareService=require(_0x394b('0x15'));var logger=require('../../config/logger')(_0x394b('0x16'));var utils=require('../../config/utils');var config=require(_0x394b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13832b,_0x5de9cf){_0x5de9cf=_0x5de9cf||0xcc;return function(_0x206429){if(_0x206429){return _0x13832b['sendStatus'](_0x5de9cf);}return _0x13832b[_0x394b('0x18')](_0x5de9cf)['end']();};}function respondWithResult(_0x582bc2,_0x29ed86){_0x29ed86=_0x29ed86||0xc8;return function(_0x3ec1d1){if(_0x3ec1d1){return _0x582bc2[_0x394b('0x18')](_0x29ed86)[_0x394b('0x19')](_0x3ec1d1);}};}function respondWithFilteredResult(_0x37d056,_0x50a984){return function(_0x4dc0e9){if(_0x4dc0e9){var _0x4dd99f=typeof _0x50a984[_0x394b('0x1a')]===_0x394b('0x1b')&&typeof _0x50a984['limit']==='undefined';var _0x5cbb7a=_0x4dc0e9[_0x394b('0x1c')];var _0x26f694=_0x4dd99f?0x0:_0x50a984[_0x394b('0x1a')];var _0x1e2fa2=_0x4dd99f?_0x4dc0e9['count']:_0x50a984[_0x394b('0x1a')]+_0x50a984[_0x394b('0x1d')];var _0x578062;if(_0x1e2fa2>=_0x5cbb7a){_0x1e2fa2=_0x5cbb7a;_0x578062=0xc8;}else{_0x578062=0xce;}_0x37d056[_0x394b('0x18')](_0x578062);return _0x37d056['set'](_0x394b('0x1e'),_0x26f694+'-'+_0x1e2fa2+'/'+_0x5cbb7a)[_0x394b('0x19')](_0x4dc0e9);}return null;};}function patchUpdates(_0x148ab3){return function(_0x13ba7c){try{jsonpatch[_0x394b('0x1f')](_0x13ba7c,_0x148ab3,!![]);}catch(_0x56db78){return BPromise[_0x394b('0x20')](_0x56db78);}return _0x13ba7c['save']();};}function saveUpdates(_0x32bd6a,_0x15e91c){return function(_0x22cbf2){if(_0x22cbf2){return _0x22cbf2[_0x394b('0x21')](_0x32bd6a)['then'](function(_0x1a8b3b){return _0x1a8b3b;});}return null;};}function removeEntity(_0x2c434b,_0xf336fa){return function(_0x2d3770){if(_0x2d3770){return _0x2d3770[_0x394b('0x22')]()[_0x394b('0x23')](function(){_0x2c434b[_0x394b('0x18')](0xcc)[_0x394b('0x24')]();});}};}function handleEntityNotFound(_0x13d66f,_0x4f78ca){return function(_0x2a2e94){if(!_0x2a2e94){_0x13d66f['sendStatus'](0x194);}return _0x2a2e94;};}function handleError(_0x5699da,_0x4c9272){_0x4c9272=_0x4c9272||0x1f4;return function(_0x4282a7){logger[_0x394b('0x25')](_0x4282a7[_0x394b('0x26')]);if(_0x4282a7[_0x394b('0x27')]){delete _0x4282a7['name'];}_0x5699da[_0x394b('0x18')](_0x4c9272)[_0x394b('0x28')](_0x4282a7);};}exports[_0x394b('0x29')]=function(_0x19212a,_0x2c5bcd){var _0x556396={},_0x3223b3={},_0x3b06ab={'count':0x0,'rows':[]};var _0x353160=_['map'](db[_0x394b('0x2a')]['rawAttributes'],function(_0x8de99d){return{'name':_0x8de99d[_0x394b('0x2b')],'type':_0x8de99d[_0x394b('0x2c')]['key']};});_0x3223b3[_0x394b('0x2d')]=_[_0x394b('0x2e')](_0x353160,_0x394b('0x27'));_0x3223b3['query']=_['keys'](_0x19212a[_0x394b('0x2f')]);_0x3223b3[_0x394b('0x30')]=_[_0x394b('0x31')](_0x3223b3[_0x394b('0x2d')],_0x3223b3[_0x394b('0x2f')]);_0x556396[_0x394b('0x32')]=_[_0x394b('0x31')](_0x3223b3['model'],qs['fields'](_0x19212a[_0x394b('0x2f')][_0x394b('0x33')]));_0x556396['attributes']=_0x556396[_0x394b('0x32')][_0x394b('0x34')]?_0x556396[_0x394b('0x32')]:_0x3223b3['model'];if(!_0x19212a[_0x394b('0x2f')][_0x394b('0x35')](_0x394b('0x36'))){_0x556396[_0x394b('0x1d')]=qs[_0x394b('0x1d')](_0x19212a['query']['limit']);_0x556396[_0x394b('0x1a')]=qs['offset'](_0x19212a['query'][_0x394b('0x1a')]);}_0x556396[_0x394b('0x37')]=qs[_0x394b('0x38')](_0x19212a['query'][_0x394b('0x38')]);_0x556396[_0x394b('0x39')]=qs[_0x394b('0x30')](_[_0x394b('0x3a')](_0x19212a['query'],_0x3223b3[_0x394b('0x30')]),_0x353160);if(_0x19212a[_0x394b('0x2f')][_0x394b('0x3b')]){_0x556396[_0x394b('0x39')]=_['merge'](_0x556396['where'],{'$or':_[_0x394b('0x2e')](_0x353160,function(_0x5cfe5b){if(_0x5cfe5b[_0x394b('0x2c')]!==_0x394b('0x3c')){var _0x297a7e={};_0x297a7e[_0x5cfe5b['name']]={'$like':'%'+_0x19212a[_0x394b('0x2f')][_0x394b('0x3b')]+'%'};return _0x297a7e;}})});}_0x556396=_[_0x394b('0x3d')]({},_0x556396,_0x19212a[_0x394b('0x3e')]);var _0x2c4eca={'where':_0x556396[_0x394b('0x39')]};return db[_0x394b('0x2a')]['count'](_0x2c4eca)[_0x394b('0x23')](function(_0x1eaf33){_0x3b06ab['count']=_0x1eaf33;if(_0x19212a['query'][_0x394b('0x3f')]){_0x556396['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x394b('0x40')](_0x556396);})[_0x394b('0x23')](function(_0x3f714f){_0x3b06ab['rows']=_0x3f714f;return _0x3b06ab;})[_0x394b('0x23')](respondWithFilteredResult(_0x2c5bcd,_0x556396))[_0x394b('0x41')](handleError(_0x2c5bcd,null));};exports['show']=function(_0xeb489b,_0x41c992){var _0x11b43e={'raw':!![],'where':{'id':_0xeb489b[_0x394b('0x42')]['id']}},_0x23b3bb={};_0x23b3bb['model']=_[_0x394b('0x43')](db[_0x394b('0x2a')]['rawAttributes']);_0x23b3bb[_0x394b('0x2f')]=_[_0x394b('0x43')](_0xeb489b[_0x394b('0x2f')]);_0x23b3bb['filters']=_['intersection'](_0x23b3bb[_0x394b('0x2d')],_0x23b3bb['query']);_0x11b43e[_0x394b('0x32')]=_[_0x394b('0x31')](_0x23b3bb['model'],qs[_0x394b('0x33')](_0xeb489b['query']['fields']));_0x11b43e[_0x394b('0x32')]=_0x11b43e[_0x394b('0x32')][_0x394b('0x34')]?_0x11b43e[_0x394b('0x32')]:_0x23b3bb[_0x394b('0x2d')];if(_0xeb489b['query'][_0x394b('0x3f')]){_0x11b43e[_0x394b('0x44')]=[{'all':!![]}];}_0x11b43e=_[_0x394b('0x3d')]({},_0x11b43e,_0xeb489b[_0x394b('0x3e')]);return db[_0x394b('0x2a')]['find'](_0x11b43e)[_0x394b('0x23')](handleEntityNotFound(_0x41c992,null))[_0x394b('0x23')](respondWithResult(_0x41c992,null))['catch'](handleError(_0x41c992,null));};exports['create']=function(_0x23162f,_0x244086){return db[_0x394b('0x2a')][_0x394b('0x45')](_0x23162f[_0x394b('0x46')],{})[_0x394b('0x23')](respondWithResult(_0x244086,0xc9))[_0x394b('0x41')](handleError(_0x244086,null));};exports[_0x394b('0x21')]=function(_0x121932,_0x4c84f3){if(_0x121932[_0x394b('0x46')]['id']){delete _0x121932['body']['id'];}return db[_0x394b('0x2a')][_0x394b('0x47')]({'where':{'id':_0x121932[_0x394b('0x42')]['id']}})[_0x394b('0x23')](handleEntityNotFound(_0x4c84f3,null))[_0x394b('0x23')](saveUpdates(_0x121932['body'],null))[_0x394b('0x23')](respondWithResult(_0x4c84f3,null))[_0x394b('0x41')](handleError(_0x4c84f3,null));};exports[_0x394b('0x22')]=function(_0xa6d49,_0x3fdcdb){return db[_0x394b('0x2a')][_0x394b('0x47')]({'where':{'id':_0xa6d49[_0x394b('0x42')]['id']}})[_0x394b('0x23')](handleEntityNotFound(_0x3fdcdb,null))[_0x394b('0x23')](removeEntity(_0x3fdcdb,null))[_0x394b('0x41')](handleError(_0x3fdcdb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 322c5b7..2c88be3 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 _0x8f3a=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8f3a,0xf4));var _0xa8f3=function(_0x2e35db,_0x5d79b5){_0x2e35db=_0x2e35db-0x0;var _0xd37845=_0x8f3a[_0x2e35db];return _0xd37845;};'use strict';var _=require(_0xa8f3('0x0'));var util=require('util');var logger=require(_0xa8f3('0x1'))(_0xa8f3('0x2'));var moment=require(_0xa8f3('0x3'));var BPromise=require(_0xa8f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8f3('0x5'));var rimraf=require(_0xa8f3('0x6'));var config=require(_0xa8f3('0x7'));var attributes=require(_0xa8f3('0x8'));module[_0xa8f3('0x9')]=function(_0x2716ee,_0x99cfd0){return _0x2716ee[_0xa8f3('0xa')](_0xa8f3('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3831=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x108a63,_0x350742){var _0x4d4254=function(_0x1427de){while(--_0x1427de){_0x108a63['push'](_0x108a63['shift']());}};_0x4d4254(++_0x350742);}(_0x3831,0xc3));var _0x1383=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x3831[_0x45ee03];return _0x13d535;};'use strict';var _=require(_0x1383('0x0'));var util=require(_0x1383('0x1'));var logger=require(_0x1383('0x2'))(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var rp=require(_0x1383('0x6'));var fs=require('fs');var path=require(_0x1383('0x7'));var rimraf=require(_0x1383('0x8'));var config=require(_0x1383('0x9'));var attributes=require(_0x1383('0xa'));module[_0x1383('0xb')]=function(_0x1d9c52,_0x586289){return _0x1d9c52[_0x1383('0xc')](_0x1383('0xd'),attributes,{'tableName':_0x1383('0xe'),'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 1508aef..ecde24c 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1ba131,_0x161afe){_0x1ba131=_0x1ba131-0x0;var _0x481c61=_0x7a54[_0x1ba131];return _0x481c61;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x558a6b,_0x43532e){var _0x35e4c2=function(_0x40a747){while(--_0x40a747){_0x558a6b['push'](_0x558a6b['shift']());}};_0x35e4c2(++_0x43532e);}(_0x1261,0x144));var _0x1126=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x1261[_0x28089e];return _0x46a73c;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 40f1b36..74d00c3 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 _0x6249=['put','exports','util','path','connect-timeout','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5a08a2,_0x355b94){var _0x1944cd=function(_0x4b4b8d){while(--_0x4b4b8d){_0x5a08a2['push'](_0x5a08a2['shift']());}};_0x1944cd(++_0x355b94);}(_0x6249,0x188));var _0x9624=function(_0x59e7fd,_0x33ca94){_0x59e7fd=_0x59e7fd-0x0;var _0x5e238b=_0x6249[_0x59e7fd];return _0x5e238b;};'use strict';var multer=require('multer');var util=require(_0x9624('0x0'));var path=require(_0x9624('0x1'));var timeout=require(_0x9624('0x2'));var express=require('express');var router=express[_0x9624('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9624('0x4'));var controller=require(_0x9624('0x5'));router[_0x9624('0x6')]('/',auth[_0x9624('0x7')](),controller[_0x9624('0x8')]);router['get'](_0x9624('0x9'),auth[_0x9624('0x7')](),controller[_0x9624('0xa')]);router[_0x9624('0xb')]('/',auth['isAuthenticated'](),controller[_0x9624('0xc')]);router[_0x9624('0xd')]('/:id',auth[_0x9624('0x7')](),controller['update']);router['delete'](_0x9624('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9624('0xe')]=router; \ No newline at end of file +var _0xe781=['destroy','exports','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x8a22de,_0x1fbd75){var _0x273eea=function(_0x55a01d){while(--_0x55a01d){_0x8a22de['push'](_0x8a22de['shift']());}};_0x273eea(++_0x1fbd75);}(_0xe781,0x1e8));var _0x1e78=function(_0x277b05,_0x2dc697){_0x277b05=_0x277b05-0x0;var _0x5bc781=_0xe781[_0x277b05];return _0x5bc781;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e78('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e78('0x1'));var auth=require(_0x1e78('0x2'));var interaction=require(_0x1e78('0x3'));var config=require(_0x1e78('0x4'));var controller=require(_0x1e78('0x5'));router[_0x1e78('0x6')]('/',auth[_0x1e78('0x7')](),controller[_0x1e78('0x8')]);router['get'](_0x1e78('0x9'),auth[_0x1e78('0x7')](),controller[_0x1e78('0xa')]);router[_0x1e78('0xb')]('/',auth['isAuthenticated'](),controller[_0x1e78('0xc')]);router[_0x1e78('0xd')]('/:id',auth[_0x1e78('0x7')](),controller[_0x1e78('0xe')]);router[_0x1e78('0xf')](_0x1e78('0x9'),auth[_0x1e78('0x7')](),controller[_0x1e78('0x10')]);module[_0x1e78('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 13064cf..1cb888f 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 _0x0cd6=['exports','STRING','sequelize'];(function(_0x4e0bb5,_0x307f58){var _0xc89f95=function(_0x199ed3){while(--_0x199ed3){_0x4e0bb5['push'](_0x4e0bb5['shift']());}};_0xc89f95(++_0x307f58);}(_0x0cd6,0x113));var _0x60cd=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x0cd6[_0x21c2c8];return _0x4dd745;};'use strict';var Sequelize=require(_0x60cd('0x0'));module[_0x60cd('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x60cd('0x2')]},'type':{'type':Sequelize[_0x60cd('0x2')]}}; \ No newline at end of file +var _0x1f63=['exports','STRING','sequelize'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x1f63,0x7a));var _0x31f6=function(_0x57f602,_0x1efb27){_0x57f602=_0x57f602-0x0;var _0x1fb86a=_0x1f63[_0x57f602];return _0x1fb86a;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x31f6('0x2')]},'type':{'type':Sequelize[_0x31f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0de5644..efc04c1 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 _0x401e=['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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','Attachment','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','clone','include','get','omit','updatedAt','body','createdAt','create','update','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x401e,0x1cf));var _0xe401=function(_0xdc4a97,_0x2b2ff5){_0xdc4a97=_0xdc4a97-0x0;var _0xaafd2f=_0x401e[_0xdc4a97];return _0xaafd2f;};'use strict';var emlformat=require(_0xe401('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe401('0x1'));var jsonpatch=require(_0xe401('0x2'));var rp=require(_0xe401('0x3'));var moment=require('moment');var BPromise=require(_0xe401('0x4'));var Mustache=require(_0xe401('0x5'));var util=require(_0xe401('0x6'));var path=require(_0xe401('0x7'));var sox=require(_0xe401('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe401('0x9'));var _=require(_0xe401('0xa'));var squel=require(_0xe401('0xb'));var crypto=require(_0xe401('0xc'));var jsforce=require(_0xe401('0xd'));var deskjs=require(_0xe401('0xe'));var toCsv=require(_0xe401('0xf'));var querystring=require(_0xe401('0x10'));var Papa=require(_0xe401('0x11'));var Redis=require(_0xe401('0x12'));var authService=require(_0xe401('0x13'));var qs=require(_0xe401('0x14'));var as=require(_0xe401('0x15'));var hardwareService=require(_0xe401('0x16'));var logger=require(_0xe401('0x17'))(_0xe401('0x18'));var utils=require(_0xe401('0x19'));var config=require(_0xe401('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c48e8,_0xded4fd){_0xded4fd=_0xded4fd||0xcc;return function(_0x59f070){if(_0x59f070){return _0x4c48e8[_0xe401('0x1b')](_0xded4fd);}return _0x4c48e8[_0xe401('0x1c')](_0xded4fd)[_0xe401('0x1d')]();};}function respondWithResult(_0x954721,_0xfc4b76){_0xfc4b76=_0xfc4b76||0xc8;return function(_0xc690ee){if(_0xc690ee){return _0x954721[_0xe401('0x1c')](_0xfc4b76)[_0xe401('0x1e')](_0xc690ee);}};}function respondWithFilteredResult(_0x21a950,_0x49c2cf){return function(_0x20bc23){if(_0x20bc23){var _0x32e148=typeof _0x49c2cf['offset']===_0xe401('0x1f')&&typeof _0x49c2cf[_0xe401('0x20')]===_0xe401('0x1f');var _0x4e53a6=_0x20bc23[_0xe401('0x21')];var _0x5037bd=_0x32e148?0x0:_0x49c2cf['offset'];var _0x31123c=_0x32e148?_0x20bc23['count']:_0x49c2cf[_0xe401('0x22')]+_0x49c2cf[_0xe401('0x20')];var _0x5f15ec;if(_0x31123c>=_0x4e53a6){_0x31123c=_0x4e53a6;_0x5f15ec=0xc8;}else{_0x5f15ec=0xce;}_0x21a950[_0xe401('0x1c')](_0x5f15ec);return _0x21a950[_0xe401('0x23')](_0xe401('0x24'),_0x5037bd+'-'+_0x31123c+'/'+_0x4e53a6)[_0xe401('0x1e')](_0x20bc23);}return null;};}function patchUpdates(_0x2d2df6){return function(_0x344405){try{jsonpatch['apply'](_0x344405,_0x2d2df6,!![]);}catch(_0x265d86){return BPromise[_0xe401('0x25')](_0x265d86);}return _0x344405[_0xe401('0x26')]();};}function saveUpdates(_0x25e207,_0x50e372){return function(_0x1977a0){if(_0x1977a0){return _0x1977a0['update'](_0x25e207)[_0xe401('0x27')](function(_0x243ebf){return _0x243ebf;});}return null;};}function removeEntity(_0x2b3936,_0x595201){return function(_0x479c6b){if(_0x479c6b){return _0x479c6b[_0xe401('0x28')]()[_0xe401('0x27')](function(){_0x2b3936[_0xe401('0x1c')](0xcc)[_0xe401('0x1d')]();});}};}function handleEntityNotFound(_0x146d6b,_0x4e859b){return function(_0x35eb8a){if(!_0x35eb8a){_0x146d6b[_0xe401('0x1b')](0x194);}return _0x35eb8a;};}function handleError(_0x20b41a,_0x326e4c){_0x326e4c=_0x326e4c||0x1f4;return function(_0x56330a){logger[_0xe401('0x29')](_0x56330a[_0xe401('0x2a')]);if(_0x56330a[_0xe401('0x2b')]){delete _0x56330a[_0xe401('0x2b')];}_0x20b41a[_0xe401('0x1c')](_0x326e4c)[_0xe401('0x2c')](_0x56330a);};}exports[_0xe401('0x2d')]=function(_0x5080e0,_0x11c165){var _0x29988f={},_0xb7ea28={},_0x5f3c1f={'count':0x0,'rows':[]};var _0xb60cb0=_['map'](db[_0xe401('0x2e')][_0xe401('0x2f')],function(_0x1e4ab9){return{'name':_0x1e4ab9['fieldName'],'type':_0x1e4ab9['type'][_0xe401('0x30')]};});_0xb7ea28[_0xe401('0x31')]=_[_0xe401('0x32')](_0xb60cb0,_0xe401('0x2b'));_0xb7ea28[_0xe401('0x33')]=_[_0xe401('0x34')](_0x5080e0['query']);_0xb7ea28[_0xe401('0x35')]=_[_0xe401('0x36')](_0xb7ea28['model'],_0xb7ea28[_0xe401('0x33')]);_0x29988f[_0xe401('0x37')]=_[_0xe401('0x36')](_0xb7ea28[_0xe401('0x31')],qs[_0xe401('0x38')](_0x5080e0[_0xe401('0x33')][_0xe401('0x38')]));_0x29988f['attributes']=_0x29988f[_0xe401('0x37')][_0xe401('0x39')]?_0x29988f[_0xe401('0x37')]:_0xb7ea28[_0xe401('0x31')];if(!_0x5080e0[_0xe401('0x33')]['hasOwnProperty'](_0xe401('0x3a'))){_0x29988f[_0xe401('0x20')]=qs[_0xe401('0x20')](_0x5080e0[_0xe401('0x33')][_0xe401('0x20')]);_0x29988f[_0xe401('0x22')]=qs['offset'](_0x5080e0[_0xe401('0x33')][_0xe401('0x22')]);}_0x29988f[_0xe401('0x3b')]=qs[_0xe401('0x3c')](_0x5080e0[_0xe401('0x33')][_0xe401('0x3c')]);_0x29988f[_0xe401('0x3d')]=qs['filters'](_[_0xe401('0x3e')](_0x5080e0['query'],_0xb7ea28[_0xe401('0x35')]),_0xb60cb0);if(_0x5080e0['query'][_0xe401('0x3f')]){_0x29988f[_0xe401('0x3d')]=_[_0xe401('0x40')](_0x29988f[_0xe401('0x3d')],{'$or':_[_0xe401('0x32')](_0xb60cb0,function(_0x198a10){if(_0x198a10['type']!==_0xe401('0x41')){var _0x315a3d={};_0x315a3d[_0x198a10['name']]={'$like':'%'+_0x5080e0[_0xe401('0x33')][_0xe401('0x3f')]+'%'};return _0x315a3d;}})});}_0x29988f=_[_0xe401('0x40')]({},_0x29988f,_0x5080e0[_0xe401('0x42')]);var _0x457fe7={'where':_0x29988f[_0xe401('0x3d')]};return db[_0xe401('0x2e')][_0xe401('0x21')](_0x457fe7)[_0xe401('0x27')](function(_0xb9cc78){_0x5f3c1f['count']=_0xb9cc78;if(_0x5080e0[_0xe401('0x33')]['includeAll']){_0x29988f['include']=[{'all':!![]}];}return db[_0xe401('0x2e')][_0xe401('0x43')](_0x29988f);})[_0xe401('0x27')](function(_0x117f95){_0x5f3c1f[_0xe401('0x44')]=_0x117f95;return _0x5f3c1f;})['then'](respondWithFilteredResult(_0x11c165,_0x29988f))[_0xe401('0x45')](handleError(_0x11c165,null));};exports[_0xe401('0x46')]=function(_0x179c9a,_0x3e46aa){var _0x33c43d={'raw':!![],'where':{'id':_0x179c9a[_0xe401('0x47')]['id']}},_0x202346={};_0x202346[_0xe401('0x31')]=_['keys'](db[_0xe401('0x2e')][_0xe401('0x2f')]);_0x202346[_0xe401('0x33')]=_[_0xe401('0x34')](_0x179c9a[_0xe401('0x33')]);_0x202346[_0xe401('0x35')]=_[_0xe401('0x36')](_0x202346[_0xe401('0x31')],_0x202346[_0xe401('0x33')]);_0x33c43d['attributes']=_[_0xe401('0x36')](_0x202346[_0xe401('0x31')],qs['fields'](_0x179c9a[_0xe401('0x33')][_0xe401('0x38')]));_0x33c43d[_0xe401('0x37')]=_0x33c43d['attributes'][_0xe401('0x39')]?_0x33c43d[_0xe401('0x37')]:_0x202346[_0xe401('0x31')];if(_0x179c9a['query'][_0xe401('0x48')]){_0x33c43d['include']=[{'all':!![]}];}_0x33c43d=_['merge']({},_0x33c43d,_0x179c9a['options']);return db['Attachment'][_0xe401('0x49')](_0x33c43d)[_0xe401('0x27')](handleEntityNotFound(_0x3e46aa,null))[_0xe401('0x27')](respondWithResult(_0x3e46aa,null))[_0xe401('0x45')](handleError(_0x3e46aa,null));};exports[_0xe401('0x4a')]=function(_0x1ca658,_0x29515a){var _0x5c47bd={'where':{'id':_0x1ca658[_0xe401('0x47')]['id']}},_0x4d9754={};_0x4d9754['model']=_[_0xe401('0x34')](db['Attachment'][_0xe401('0x2f')]);_0x5c47bd[_0xe401('0x37')]=_['intersection'](_0x4d9754[_0xe401('0x31')],qs['fields'](_0x1ca658[_0xe401('0x33')][_0xe401('0x38')]));_0x5c47bd['attributes']=_0x5c47bd[_0xe401('0x37')][_0xe401('0x39')]?_0x5c47bd[_0xe401('0x37')]:_0x4d9754[_0xe401('0x31')];if(_0x1ca658[_0xe401('0x33')]['includeAll']){_0x5c47bd[_0xe401('0x4b')]=[{'all':!![]}];}_0x5c47bd=_['merge']({},_0x5c47bd,_0x1ca658[_0xe401('0x42')]);return db[_0xe401('0x2e')][_0xe401('0x49')](_0x5c47bd)[_0xe401('0x27')](handleEntityNotFound(_0x29515a,null))['then'](function(_0x35c4d8){if(_0x35c4d8){var _0x3105eb=_0x35c4d8[_0xe401('0x4c')]({'plain':!![]});_0x3105eb=qs[_0xe401('0x4d')](_0x3105eb,['id','createdAt',_0xe401('0x4e')]);_0x1ca658[_0xe401('0x4f')]=_[_0xe401('0x4d')](_0x1ca658[_0xe401('0x4f')],['id',_0xe401('0x50'),_0xe401('0x4e')]);return db['Attachment'][_0xe401('0x51')](_[_0xe401('0x40')](_0x3105eb,_0x1ca658[_0xe401('0x4f')]),{'include':_0x1ca658[_0xe401('0x33')][_0xe401('0x48')]?[{'all':!![]}]:undefined});}})[_0xe401('0x27')](respondWithResult(_0x29515a,0xc9))[_0xe401('0x45')](handleError(_0x29515a,null));};exports[_0xe401('0x52')]=function(_0x6c6140,_0x3f8b8b){if(_0x6c6140[_0xe401('0x4f')]['id']){delete _0x6c6140[_0xe401('0x4f')]['id'];}return db['Attachment'][_0xe401('0x49')]({'where':{'id':_0x6c6140[_0xe401('0x47')]['id']}})[_0xe401('0x27')](handleEntityNotFound(_0x3f8b8b,null))[_0xe401('0x27')](saveUpdates(_0x6c6140[_0xe401('0x4f')],null))[_0xe401('0x27')](respondWithResult(_0x3f8b8b,null))['catch'](handleError(_0x3f8b8b,null));};exports[_0xe401('0x28')]=function(_0x55298e,_0x401b73){return db[_0xe401('0x2e')][_0xe401('0x49')]({'where':{'id':_0x55298e[_0xe401('0x47')]['id']}})[_0xe401('0x27')](handleEntityNotFound(_0x401b73,null))[_0xe401('0x27')](removeEntity(_0x401b73,null))[_0xe401('0x45')](handleError(_0x401b73,null));};exports[_0xe401('0x51')]=function(_0x59dd88,_0xef48ae,_0x31a72b){_0x59dd88[_0xe401('0x4f')][_0xe401('0x2b')]=_0x59dd88[_0xe401('0x53')][_0xe401('0x54')];_0x59dd88['body'][_0xe401('0x55')]=_0x59dd88[_0xe401('0x53')][_0xe401('0x56')];_0x59dd88[_0xe401('0x4f')][_0xe401('0x57')]=_0x59dd88[_0xe401('0x53')][_0xe401('0x58')];return db['Attachment'][_0xe401('0x51')](_0x59dd88[_0xe401('0x4f')])[_0xe401('0x27')](respondWithResult(_0xef48ae,0xc9))[_0xe401('0x45')](handleError(_0xef48ae,null));};exports[_0xe401('0x59')]=function(_0x552f62,_0x5f3f6c,_0x387cea){return db['Attachment'][_0xe401('0x5a')]({'where':{'id':_0x552f62[_0xe401('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5f3f6c,null))['then'](function(_0x5e8704){if(_0x5e8704){var _0x4f3326=_0x5e8704[_0xe401('0x5b')]!==null;var _0x3ee7d4=path[_0xe401('0x5c')](config['root'],_0xe401('0x5d'));if(_0x4f3326){_0x3ee7d4=path[_0xe401('0x5c')](_0x3ee7d4,_0xe401('0x5e'));}var _0x4ab19f=path[_0xe401('0x5c')](_0x3ee7d4,_0x5e8704['basename']);return _0x5f3f6c['download'](_0x4ab19f);}})['catch'](handleError(_0x5f3f6c,null));}; \ No newline at end of file +var _0xbc70=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','keys','find','clone','params','get','omit','updatedAt','body','createdAt','create','destroy','originalname','basename','file','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x150de7,_0x3e1c6b){var _0x3c2a16=function(_0x11324a){while(--_0x11324a){_0x150de7['push'](_0x150de7['shift']());}};_0x3c2a16(++_0x3e1c6b);}(_0xbc70,0x168));var _0x0bc7=function(_0x110338,_0x2b36f8){_0x110338=_0x110338-0x0;var _0x16bdcb=_0xbc70[_0x110338];return _0x16bdcb;};'use strict';var emlformat=require(_0x0bc7('0x0'));var rimraf=require(_0x0bc7('0x1'));var zipdir=require(_0x0bc7('0x2'));var jsonpatch=require(_0x0bc7('0x3'));var rp=require(_0x0bc7('0x4'));var moment=require(_0x0bc7('0x5'));var BPromise=require(_0x0bc7('0x6'));var Mustache=require(_0x0bc7('0x7'));var util=require(_0x0bc7('0x8'));var path=require(_0x0bc7('0x9'));var sox=require('sox');var csv=require(_0x0bc7('0xa'));var ejs=require(_0x0bc7('0xb'));var fs=require('fs');var fs_extra=require(_0x0bc7('0xc'));var _=require('lodash');var squel=require(_0x0bc7('0xd'));var crypto=require(_0x0bc7('0xe'));var jsforce=require(_0x0bc7('0xf'));var deskjs=require(_0x0bc7('0x10'));var toCsv=require(_0x0bc7('0xa'));var querystring=require(_0x0bc7('0x11'));var Papa=require(_0x0bc7('0x12'));var Redis=require(_0x0bc7('0x13'));var authService=require(_0x0bc7('0x14'));var qs=require(_0x0bc7('0x15'));var as=require(_0x0bc7('0x16'));var hardwareService=require(_0x0bc7('0x17'));var logger=require('../../config/logger')(_0x0bc7('0x18'));var utils=require(_0x0bc7('0x19'));var config=require(_0x0bc7('0x1a'));var licenseUtil=require(_0x0bc7('0x1b'));var db=require(_0x0bc7('0x1c'))['db'];function respondWithStatusCode(_0x435f19,_0x4cd51e){_0x4cd51e=_0x4cd51e||0xcc;return function(_0x42583b){if(_0x42583b){return _0x435f19['sendStatus'](_0x4cd51e);}return _0x435f19[_0x0bc7('0x1d')](_0x4cd51e)[_0x0bc7('0x1e')]();};}function respondWithResult(_0x2d4b1d,_0x191222){_0x191222=_0x191222||0xc8;return function(_0x49c66b){if(_0x49c66b){return _0x2d4b1d[_0x0bc7('0x1d')](_0x191222)[_0x0bc7('0x1f')](_0x49c66b);}};}function respondWithFilteredResult(_0x43daeb,_0x40bac2){return function(_0x53030d){if(_0x53030d){var _0x12c674=typeof _0x40bac2[_0x0bc7('0x20')]===_0x0bc7('0x21')&&typeof _0x40bac2[_0x0bc7('0x22')]===_0x0bc7('0x21');var _0x4260ce=_0x53030d[_0x0bc7('0x23')];var _0x4341e2=_0x12c674?0x0:_0x40bac2[_0x0bc7('0x20')];var _0x17dddb=_0x12c674?_0x53030d[_0x0bc7('0x23')]:_0x40bac2[_0x0bc7('0x20')]+_0x40bac2[_0x0bc7('0x22')];var _0x32b026;if(_0x17dddb>=_0x4260ce){_0x17dddb=_0x4260ce;_0x32b026=0xc8;}else{_0x32b026=0xce;}_0x43daeb['status'](_0x32b026);return _0x43daeb['set'](_0x0bc7('0x24'),_0x4341e2+'-'+_0x17dddb+'/'+_0x4260ce)['json'](_0x53030d);}return null;};}function patchUpdates(_0x37d90c){return function(_0x25f071){try{jsonpatch['apply'](_0x25f071,_0x37d90c,!![]);}catch(_0x2b56d4){return BPromise[_0x0bc7('0x25')](_0x2b56d4);}return _0x25f071[_0x0bc7('0x26')]();};}function saveUpdates(_0x3ee70f,_0x5690ba){return function(_0x4fa5d0){if(_0x4fa5d0){return _0x4fa5d0[_0x0bc7('0x27')](_0x3ee70f)[_0x0bc7('0x28')](function(_0x19839d){return _0x19839d;});}return null;};}function removeEntity(_0x59b92b,_0x213d0f){return function(_0x1a7fe5){if(_0x1a7fe5){return _0x1a7fe5['destroy']()['then'](function(){_0x59b92b[_0x0bc7('0x1d')](0xcc)[_0x0bc7('0x1e')]();});}};}function handleEntityNotFound(_0x2a2225,_0x5a17dc){return function(_0x5180bc){if(!_0x5180bc){_0x2a2225[_0x0bc7('0x29')](0x194);}return _0x5180bc;};}function handleError(_0x34ab06,_0x54bdab){_0x54bdab=_0x54bdab||0x1f4;return function(_0x397389){logger['error'](_0x397389[_0x0bc7('0x2a')]);if(_0x397389[_0x0bc7('0x2b')]){delete _0x397389[_0x0bc7('0x2b')];}_0x34ab06[_0x0bc7('0x1d')](_0x54bdab)[_0x0bc7('0x2c')](_0x397389);};}exports['index']=function(_0x223a32,_0x308ee3){var _0x391b94={},_0x4910fb={},_0xd71ee8={'count':0x0,'rows':[]};var _0x5a64c1=_[_0x0bc7('0x2d')](db['Attachment'][_0x0bc7('0x2e')],function(_0x2ec7ce){return{'name':_0x2ec7ce[_0x0bc7('0x2f')],'type':_0x2ec7ce['type'][_0x0bc7('0x30')]};});_0x4910fb[_0x0bc7('0x31')]=_[_0x0bc7('0x2d')](_0x5a64c1,'name');_0x4910fb[_0x0bc7('0x32')]=_['keys'](_0x223a32['query']);_0x4910fb[_0x0bc7('0x33')]=_[_0x0bc7('0x34')](_0x4910fb[_0x0bc7('0x31')],_0x4910fb[_0x0bc7('0x32')]);_0x391b94['attributes']=_[_0x0bc7('0x34')](_0x4910fb[_0x0bc7('0x31')],qs[_0x0bc7('0x35')](_0x223a32[_0x0bc7('0x32')]['fields']));_0x391b94['attributes']=_0x391b94[_0x0bc7('0x36')][_0x0bc7('0x37')]?_0x391b94[_0x0bc7('0x36')]:_0x4910fb[_0x0bc7('0x31')];if(!_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x38')]('nolimit')){_0x391b94[_0x0bc7('0x22')]=qs['limit'](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x22')]);_0x391b94[_0x0bc7('0x20')]=qs[_0x0bc7('0x20')](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x20')]);}_0x391b94[_0x0bc7('0x39')]=qs[_0x0bc7('0x3a')](_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3a')]);_0x391b94[_0x0bc7('0x3b')]=qs[_0x0bc7('0x33')](_[_0x0bc7('0x3c')](_0x223a32[_0x0bc7('0x32')],_0x4910fb[_0x0bc7('0x33')]),_0x5a64c1);if(_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3d')]){_0x391b94['where']=_[_0x0bc7('0x3e')](_0x391b94['where'],{'$or':_['map'](_0x5a64c1,function(_0x38cf0d){if(_0x38cf0d['type']!==_0x0bc7('0x3f')){var _0x4b7a74={};_0x4b7a74[_0x38cf0d[_0x0bc7('0x2b')]]={'$like':'%'+_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x3d')]+'%'};return _0x4b7a74;}})});}_0x391b94=_[_0x0bc7('0x3e')]({},_0x391b94,_0x223a32[_0x0bc7('0x40')]);var _0x4d10f2={'where':_0x391b94[_0x0bc7('0x3b')]};return db[_0x0bc7('0x41')]['count'](_0x4d10f2)[_0x0bc7('0x28')](function(_0x86ba75){_0xd71ee8[_0x0bc7('0x23')]=_0x86ba75;if(_0x223a32[_0x0bc7('0x32')][_0x0bc7('0x42')]){_0x391b94[_0x0bc7('0x43')]=[{'all':!![]}];}return db[_0x0bc7('0x41')][_0x0bc7('0x44')](_0x391b94);})[_0x0bc7('0x28')](function(_0x265925){_0xd71ee8[_0x0bc7('0x45')]=_0x265925;return _0xd71ee8;})[_0x0bc7('0x28')](respondWithFilteredResult(_0x308ee3,_0x391b94))[_0x0bc7('0x46')](handleError(_0x308ee3,null));};exports[_0x0bc7('0x47')]=function(_0x42541f,_0x5d71f0){var _0x5b29cd={'raw':!![],'where':{'id':_0x42541f['params']['id']}},_0x1b7930={};_0x1b7930['model']=_[_0x0bc7('0x48')](db['Attachment'][_0x0bc7('0x2e')]);_0x1b7930['query']=_['keys'](_0x42541f['query']);_0x1b7930[_0x0bc7('0x33')]=_[_0x0bc7('0x34')](_0x1b7930[_0x0bc7('0x31')],_0x1b7930[_0x0bc7('0x32')]);_0x5b29cd[_0x0bc7('0x36')]=_[_0x0bc7('0x34')](_0x1b7930[_0x0bc7('0x31')],qs[_0x0bc7('0x35')](_0x42541f['query']['fields']));_0x5b29cd[_0x0bc7('0x36')]=_0x5b29cd[_0x0bc7('0x36')]['length']?_0x5b29cd[_0x0bc7('0x36')]:_0x1b7930[_0x0bc7('0x31')];if(_0x42541f[_0x0bc7('0x32')]['includeAll']){_0x5b29cd[_0x0bc7('0x43')]=[{'all':!![]}];}_0x5b29cd=_[_0x0bc7('0x3e')]({},_0x5b29cd,_0x42541f[_0x0bc7('0x40')]);return db[_0x0bc7('0x41')][_0x0bc7('0x49')](_0x5b29cd)[_0x0bc7('0x28')](handleEntityNotFound(_0x5d71f0,null))['then'](respondWithResult(_0x5d71f0,null))[_0x0bc7('0x46')](handleError(_0x5d71f0,null));};exports[_0x0bc7('0x4a')]=function(_0x486f32,_0x50cd85){var _0x29506d={'where':{'id':_0x486f32[_0x0bc7('0x4b')]['id']}},_0x440b10={};_0x440b10[_0x0bc7('0x31')]=_[_0x0bc7('0x48')](db[_0x0bc7('0x41')]['rawAttributes']);_0x29506d[_0x0bc7('0x36')]=_[_0x0bc7('0x34')](_0x440b10[_0x0bc7('0x31')],qs['fields'](_0x486f32['query'][_0x0bc7('0x35')]));_0x29506d[_0x0bc7('0x36')]=_0x29506d['attributes'][_0x0bc7('0x37')]?_0x29506d[_0x0bc7('0x36')]:_0x440b10[_0x0bc7('0x31')];if(_0x486f32[_0x0bc7('0x32')][_0x0bc7('0x42')]){_0x29506d['include']=[{'all':!![]}];}_0x29506d=_[_0x0bc7('0x3e')]({},_0x29506d,_0x486f32[_0x0bc7('0x40')]);return db[_0x0bc7('0x41')][_0x0bc7('0x49')](_0x29506d)[_0x0bc7('0x28')](handleEntityNotFound(_0x50cd85,null))['then'](function(_0x3427ad){if(_0x3427ad){var _0x3ae442=_0x3427ad[_0x0bc7('0x4c')]({'plain':!![]});_0x3ae442=qs[_0x0bc7('0x4d')](_0x3ae442,['id','createdAt',_0x0bc7('0x4e')]);_0x486f32['body']=_[_0x0bc7('0x4d')](_0x486f32[_0x0bc7('0x4f')],['id',_0x0bc7('0x50'),_0x0bc7('0x4e')]);return db[_0x0bc7('0x41')][_0x0bc7('0x51')](_['merge'](_0x3ae442,_0x486f32[_0x0bc7('0x4f')]),{'include':_0x486f32[_0x0bc7('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x0bc7('0x28')](respondWithResult(_0x50cd85,0xc9))[_0x0bc7('0x46')](handleError(_0x50cd85,null));};exports[_0x0bc7('0x27')]=function(_0x15ab16,_0x3c85d9){if(_0x15ab16['body']['id']){delete _0x15ab16[_0x0bc7('0x4f')]['id'];}return db['Attachment'][_0x0bc7('0x49')]({'where':{'id':_0x15ab16[_0x0bc7('0x4b')]['id']}})[_0x0bc7('0x28')](handleEntityNotFound(_0x3c85d9,null))['then'](saveUpdates(_0x15ab16[_0x0bc7('0x4f')],null))['then'](respondWithResult(_0x3c85d9,null))[_0x0bc7('0x46')](handleError(_0x3c85d9,null));};exports[_0x0bc7('0x52')]=function(_0x49f8fc,_0x585ed0){return db[_0x0bc7('0x41')][_0x0bc7('0x49')]({'where':{'id':_0x49f8fc[_0x0bc7('0x4b')]['id']}})[_0x0bc7('0x28')](handleEntityNotFound(_0x585ed0,null))[_0x0bc7('0x28')](removeEntity(_0x585ed0,null))[_0x0bc7('0x46')](handleError(_0x585ed0,null));};exports[_0x0bc7('0x51')]=function(_0x30db02,_0x4ce7fb,_0x466322){_0x30db02[_0x0bc7('0x4f')][_0x0bc7('0x2b')]=_0x30db02['file'][_0x0bc7('0x53')];_0x30db02['body'][_0x0bc7('0x54')]=_0x30db02[_0x0bc7('0x55')][_0x0bc7('0x56')];_0x30db02['body'][_0x0bc7('0x57')]=_0x30db02['file'][_0x0bc7('0x58')];return db[_0x0bc7('0x41')][_0x0bc7('0x51')](_0x30db02[_0x0bc7('0x4f')])[_0x0bc7('0x28')](respondWithResult(_0x4ce7fb,0xc9))[_0x0bc7('0x46')](handleError(_0x4ce7fb,null));};exports[_0x0bc7('0x59')]=function(_0x443f67,_0x43ba9a,_0x79d23f){return db[_0x0bc7('0x41')][_0x0bc7('0x5a')]({'where':{'id':_0x443f67[_0x0bc7('0x4b')]['id']},'raw':!![]})[_0x0bc7('0x28')](handleEntityNotFound(_0x43ba9a,null))[_0x0bc7('0x28')](function(_0x510bf5){if(_0x510bf5){var _0x29904e=_0x510bf5[_0x0bc7('0x5b')]!==null;var _0x1a02d4=path['join'](config[_0x0bc7('0x5c')],_0x0bc7('0x5d'));if(_0x29904e){_0x1a02d4=path[_0x0bc7('0x5e')](_0x1a02d4,_0x0bc7('0x5f'));}var _0x14ce39=path[_0x0bc7('0x5e')](_0x1a02d4,_0x510bf5[_0x0bc7('0x54')]);return _0x43ba9a[_0x0bc7('0x59')](_0x14ce39);}})[_0x0bc7('0x46')](handleError(_0x43ba9a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b2d6679..21ed8eb 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 _0x9ee8=['path','rimraf','../../config/environment','exports','define','attachments','lodash','../../config/logger','api','moment'];(function(_0x4777c1,_0x53bfce){var _0x1ad838=function(_0x40d0bf){while(--_0x40d0bf){_0x4777c1['push'](_0x4777c1['shift']());}};_0x1ad838(++_0x53bfce);}(_0x9ee8,0x1aa));var _0x89ee=function(_0x50376e,_0x4455e0){_0x50376e=_0x50376e-0x0;var _0x42917f=_0x9ee8[_0x50376e];return _0x42917f;};'use strict';var _=require(_0x89ee('0x0'));var util=require('util');var logger=require(_0x89ee('0x1'))(_0x89ee('0x2'));var moment=require(_0x89ee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ee('0x4'));var rimraf=require(_0x89ee('0x5'));var config=require(_0x89ee('0x6'));var attributes=require('./attachment.attributes');module[_0x89ee('0x7')]=function(_0x27f8c0,_0x37900a){return _0x27f8c0[_0x89ee('0x8')]('Attachment',attributes,{'tableName':_0x89ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb3c=['moment','bluebird','path','rimraf','../../config/environment','exports','Attachment','attachments','lodash','util','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb3c,0x1e1));var _0xcdb3=function(_0x22ea49,_0x4a785c){_0x22ea49=_0x22ea49-0x0;var _0x580ac8=_0xdb3c[_0x22ea49];return _0x580ac8;};'use strict';var _=require(_0xcdb3('0x0'));var util=require(_0xcdb3('0x1'));var logger=require('../../config/logger')(_0xcdb3('0x2'));var moment=require(_0xcdb3('0x3'));var BPromise=require(_0xcdb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdb3('0x5'));var rimraf=require(_0xcdb3('0x6'));var config=require(_0xcdb3('0x7'));var attributes=require('./attachment.attributes');module[_0xcdb3('0x8')]=function(_0x3efe3a,_0x1d7408){return _0x3efe3a['define'](_0xcdb3('0x9'),attributes,{'tableName':_0xcdb3('0xa'),'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 d97e881..9fc134d 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 _0x984b=['ioredis','../../config/logger','rpc','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0x2738af,_0x3c662a){var _0x35b01d=function(_0x39a525){while(--_0x39a525){_0x2738af['push'](_0x2738af['shift']());}};_0x35b01d(++_0x3c662a);}(_0x984b,0xee));var _0xb984=function(_0x30f36e,_0xea6c4f){_0x30f36e=_0x30f36e-0x0;var _0x18d978=_0x984b[_0x30f36e];return _0x18d978;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['CreateAttachment']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')](_0x396c36['body'],{'raw':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![]})[_0xb984('0x7')](function(_0x32831b){logger[_0xb984('0x8')]('CreateAttachment',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x17'),_0x396c36,JSON['stringify'](_0x32831b));_0x3a5c96(_0x32831b);})[_0xb984('0x12')](function(_0x97af5c){logger[_0xb984('0xe')](_0xb984('0x17'),_0x97af5c[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75[_0xb984('0xe')](0x1f4,_0x97af5c[_0xb984('0x10')]));});});}; \ No newline at end of file +var _0x49e9=['request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'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')]('Attachment,\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);});});}exports[_0x949e('0x16')]=function(_0x43498d){var _0x868913=this;return new Promise(function(_0x20333c,_0x5caac9){return db[_0x949e('0x17')][_0x949e('0x18')](_0x43498d[_0x949e('0x19')],{'raw':_0x43498d[_0x949e('0x1a')]?_0x43498d[_0x949e('0x1a')][_0x949e('0x1b')]===undefined?!![]:![]:!![]})[_0x949e('0xa')](function(_0x2f21bd){logger[_0x949e('0xb')](_0x949e('0x16'),_0x43498d);logger[_0x949e('0xd')](_0x949e('0x16'),_0x43498d,JSON[_0x949e('0xf')](_0x2f21bd));_0x20333c(_0x2f21bd);})[_0x949e('0x15')](function(_0x199d53){logger[_0x949e('0x10')]('CreateAttachment',_0x199d53[_0x949e('0x13')],_0x43498d);_0x5caac9(_0x868913[_0x949e('0x10')](0x1f4,_0x199d53['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 2a9f98b..c97805c 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x384d39,_0xf060fc){_0x384d39=_0x384d39-0x0;var _0x13bf22=_0x0b0e[_0x384d39];return _0x13bf22;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index deb070f..4594775 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 _0x33ec=['status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','role','disabled','blocked','blockedAt','online','admin','user','agent','add','clearBlockUser','getLicense','catch'];(function(_0x2ffe1f,_0x38ff16){var _0xaa79fa=function(_0x2e14eb){while(--_0x2e14eb){_0x2ffe1f['push'](_0x2ffe1f['shift']());}};_0xaa79fa(++_0x38ff16);}(_0x33ec,0x96));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xc33e('0x0'))[_0xc33e('0x1')];var moment=require(_0xc33e('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xc33e('0x3'));var util=require(_0xc33e('0x4'));var db=require(_0xc33e('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc33e('0x6'));var config=require(_0xc33e('0x7'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x3d2a98){var _0x1d6fbc=![];if(typeof _0x3d2a98[_0xc33e('0x8')]!==_0xc33e('0x9')){_0x1d6fbc=_0x3d2a98['activedirectory'][_0xc33e('0xa')]&&_0x3d2a98[_0xc33e('0x8')]['url']&&_0x3d2a98[_0xc33e('0x8')][_0xc33e('0xb')];}return _0x1d6fbc;}function adAuthenticate(_0x549913,_0x5def2d,_0x436962){return new BPromise(function(_0x538fdd,_0x3b0f98){try{var _0x236532=new ActiveDirectory(_0x549913);_0x236532[_0xc33e('0xc')](_0x5def2d,_0x436962,function(_0x1da1a1,_0x1037ad){if(_0x1da1a1){logger[_0xc33e('0xd')](_0xc33e('0xe'),_0x5def2d,util[_0xc33e('0xf')](_0x1da1a1,{'showHidden':![],'depth':null}));_0x3b0f98('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x1037ad){logger['error'](_0xc33e('0x10'),_0x5def2d);_0x3b0f98(_0xc33e('0x11'));}else{_0x538fdd(_0x1037ad);}});}catch(_0x5041f2){_0x3b0f98(_0x5041f2);}});}function ActiveDirectoryAuthenticate(_0x15ac7b,_0x41924f,_0x218d9a,_0x25e2c6){var _0x16e525,_0x26f832;if(!isActiveDirectoryConfigured(config)){logger[_0xc33e('0xd')](_0xc33e('0x12'),_0x41924f);return _0x25e2c6(null,![],{'message':_0xc33e('0x11')});}return db[_0xc33e('0x13')][_0xc33e('0x14')]({'where':{'id':0x1},'attributes':[_0xc33e('0x15'),_0xc33e('0x16')],'raw':!![]})[_0xc33e('0x17')](function(_0x21dcff){_0x16e525=_0x21dcff;if(!_0x16e525[_0xc33e('0x15')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x41924f);throw new Error(_0xc33e('0x11'));}return _0x15ac7b[_0xc33e('0x14')]({'attributes':['id',_0xc33e('0x18'),_0xc33e('0x19'),'salt',_0xc33e('0x1a'),_0xc33e('0x1b'),_0xc33e('0x1c'),_0xc33e('0x1d'),_0xc33e('0x1e')],'where':{'name':_0x41924f,'role':{'$or':[_0xc33e('0x1f'),_0xc33e('0x20'),_0xc33e('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x5bf8bd){if(!_0x5bf8bd||_0x5bf8bd&&_0x5bf8bd[_0xc33e('0x18')]!==_0x41924f){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x26f832=_0x5bf8bd;var _0x5c5329=_0x26f832[_0xc33e('0x18')]+'@'+config['activedirectory'][_0xc33e('0xb')];return adAuthenticate(config[_0xc33e('0x8')],_0x5c5329,_0x218d9a);})[_0xc33e('0x17')](function(_0x3ff8ba){if(_0x26f832[_0xc33e('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x16e525['blockDuration']>0x0){if(_0x26f832[_0xc33e('0x1c')]){if(moment(_0x26f832[_0xc33e('0x1d')])[_0xc33e('0x22')](_0x16e525[_0xc33e('0x16')],'minutes')>moment()){throw new Error(_0xc33e('0x11'));}return utils[_0xc33e('0x23')](_0x26f832,0x0,![],null)[_0xc33e('0x17')](function(){return utils['getLicense'](_0x26f832);})['then'](function(){return _0x25e2c6(null,_0x26f832);});}else{return utils[_0xc33e('0x24')](_0x26f832)['then'](function(){return _0x25e2c6(null,_0x26f832);});}}else{return utils[_0xc33e('0x24')](_0x26f832)['then'](function(){return _0x25e2c6(null,_0x26f832);});}})[_0xc33e('0x25')](function(_0x47bb34){return _0x25e2c6(null,![],_0x47bb34);});}function handleError(_0x650c43,_0x5e6f11,_0xf7d513){return _0x650c43[_0xc33e('0x26')](_0x5e6f11||0x1f4)[_0xc33e('0x27')]({'message':_0xf7d513?_0xf7d513[_0xc33e('0x28')]||_0xf7d513:''});}exports[_0xc33e('0x29')]=function(_0x30833f,_0x44adfa,_0x3022e2){passport[_0xc33e('0xc')](_0xc33e('0x2a'),function(_0xf9fc92,_0x4aa68e,_0x41aac0){var _0x229ba0=_0xf9fc92||_0x41aac0;if(_0x229ba0){return handleError(_0x44adfa,0x191,_0x229ba0);}if(!_0x4aa68e){return handleError(_0x44adfa,0x194,{'message':_0xc33e('0x2b')});}else{var _0x2e4307={'payload':{'id':_0x4aa68e['id'],'role':_0x4aa68e['role']},'options':{'expiresIn':0x15180}};return authService[_0xc33e('0x2c')](_0x2e4307)[_0xc33e('0x17')](function(_0x529247){_0x44adfa[_0xc33e('0x2d')]({'id':_0x4aa68e['id'],'token':_0x529247,'statusCall':'','isAlreadyLogged':_0x4aa68e['online']});});}})(_0x30833f,_0x44adfa,_0x3022e2);};passport[_0xc33e('0x2e')](_0xc33e('0x2a'),new LocalStrategy({'usernameField':_0xc33e('0x18'),'passwordField':_0xc33e('0x19')},function(_0x138990,_0x9911ae,_0x24dbb3){return ActiveDirectoryAuthenticate(db['User'],_0x138990,_0x9911ae,_0x24dbb3);})); \ No newline at end of file +var _0xf324=['blocked','online','user','agent','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled'];(function(_0x206971,_0x49148c){var _0x39fce2=function(_0x4776a9){while(--_0x4776a9){_0x206971['push'](_0x206971['shift']());}};_0x39fce2(++_0x49148c);}(_0xf324,0xa6));var _0x4f32=function(_0x769fd9,_0x1d699e){_0x769fd9=_0x769fd9-0x0;var _0x1202b6=_0xf324[_0x769fd9];return _0x1202b6;};'use strict';var passport=require(_0x4f32('0x0'));var LocalStrategy=require(_0x4f32('0x1'))[_0x4f32('0x2')];var moment=require(_0x4f32('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x4f32('0x4'));var util=require(_0x4f32('0x5'));var db=require(_0x4f32('0x6'))['db'];var authService=require(_0x4f32('0x7'));var utils=require(_0x4f32('0x8'));var config=require(_0x4f32('0x9'));var logger=require(_0x4f32('0xa'))('api');function isActiveDirectoryConfigured(_0x5051e2){var _0x238d8a=![];if(typeof _0x5051e2[_0x4f32('0xb')]!==_0x4f32('0xc')){_0x238d8a=_0x5051e2[_0x4f32('0xb')]['baseDN']&&_0x5051e2[_0x4f32('0xb')][_0x4f32('0xd')]&&_0x5051e2[_0x4f32('0xb')][_0x4f32('0xe')];}return _0x238d8a;}function adAuthenticate(_0x1c1faf,_0x27c803,_0x13dc39){return new BPromise(function(_0x24d01c,_0x2a3e88){try{var _0x491cf0=new ActiveDirectory(_0x1c1faf);_0x491cf0['authenticate'](_0x27c803,_0x13dc39,function(_0x44f4d3,_0xaf3917){if(_0x44f4d3){logger['error'](_0x4f32('0xf'),_0x27c803,util[_0x4f32('0x10')](_0x44f4d3,{'showHidden':![],'depth':null}));_0x2a3e88(_0x4f32('0x11'));}else if(!_0xaf3917){logger[_0x4f32('0x12')](_0x4f32('0x13'),_0x27c803);_0x2a3e88(_0x4f32('0x11'));}else{_0x24d01c(_0xaf3917);}});}catch(_0x3c6daf){_0x2a3e88(_0x3c6daf);}});}function ActiveDirectoryAuthenticate(_0x25aad3,_0xda352a,_0x48a827,_0x194ad4){var _0x1bc483,_0x192461;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4f32('0x14'),_0xda352a);return _0x194ad4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x4f32('0x15')][_0x4f32('0x16')]({'where':{'id':0x1},'attributes':[_0x4f32('0x17'),'blockDuration'],'raw':!![]})[_0x4f32('0x18')](function(_0x5ceba9){_0x1bc483=_0x5ceba9;if(!_0x1bc483[_0x4f32('0x17')]){logger[_0x4f32('0x12')](_0x4f32('0x19'),_0xda352a);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x25aad3[_0x4f32('0x16')]({'attributes':['id',_0x4f32('0x1a'),'password',_0x4f32('0x1b'),_0x4f32('0x1c'),_0x4f32('0x1d'),_0x4f32('0x1e'),'blockedAt',_0x4f32('0x1f')],'where':{'name':_0xda352a,'role':{'$or':['admin',_0x4f32('0x20'),_0x4f32('0x21')]},'adSsoEnabled':!![]}});})[_0x4f32('0x18')](function(_0x4ce898){if(!_0x4ce898||_0x4ce898&&_0x4ce898[_0x4f32('0x1a')]!==_0xda352a){throw new Error(_0x4f32('0x11'));}_0x192461=_0x4ce898;var _0x62be60=_0x192461['name']+'@'+config[_0x4f32('0xb')][_0x4f32('0xe')];return adAuthenticate(config[_0x4f32('0xb')],_0x62be60,_0x48a827);})['then'](function(_0x21b023){if(_0x192461[_0x4f32('0x1d')]){throw new Error(_0x4f32('0x11'));}if(_0x1bc483[_0x4f32('0x22')]>0x0){if(_0x192461[_0x4f32('0x1e')]){if(moment(_0x192461[_0x4f32('0x23')])[_0x4f32('0x24')](_0x1bc483[_0x4f32('0x22')],_0x4f32('0x25'))>moment()){throw new Error(_0x4f32('0x11'));}return utils[_0x4f32('0x26')](_0x192461,0x0,![],null)[_0x4f32('0x18')](function(){return utils['getLicense'](_0x192461);})['then'](function(){return _0x194ad4(null,_0x192461);});}else{return utils[_0x4f32('0x27')](_0x192461)[_0x4f32('0x18')](function(){return _0x194ad4(null,_0x192461);});}}else{return utils[_0x4f32('0x27')](_0x192461)[_0x4f32('0x18')](function(){return _0x194ad4(null,_0x192461);});}})[_0x4f32('0x28')](function(_0x302017){return _0x194ad4(null,![],_0x302017);});}function handleError(_0x31fcb5,_0x2fc04a,_0x357c25){return _0x31fcb5[_0x4f32('0x29')](_0x2fc04a||0x1f4)[_0x4f32('0x2a')]({'message':_0x357c25?_0x357c25[_0x4f32('0x2b')]||_0x357c25:''});}exports[_0x4f32('0x2c')]=function(_0x490698,_0x2c9666,_0x4f8242){passport['authenticate'](_0x4f32('0x2d'),function(_0x82c280,_0x16e0f1,_0x420c80){var _0x5c1669=_0x82c280||_0x420c80;if(_0x5c1669){return handleError(_0x2c9666,0x191,_0x5c1669);}if(!_0x16e0f1){return handleError(_0x2c9666,0x194,{'message':_0x4f32('0x2e')});}else{var _0x37af02={'payload':{'id':_0x16e0f1['id'],'role':_0x16e0f1[_0x4f32('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x37af02)['then'](function(_0x30da38){_0x2c9666[_0x4f32('0x2f')]({'id':_0x16e0f1['id'],'token':_0x30da38,'statusCall':'','isAlreadyLogged':_0x16e0f1['online']});});}})(_0x490698,_0x2c9666,_0x4f8242);};passport['use'](_0x4f32('0x2d'),new LocalStrategy({'usernameField':_0x4f32('0x1a'),'passwordField':'password'},function(_0x2ca8e2,_0x17b0ec,_0x3d657e){return ActiveDirectoryAuthenticate(db[_0x4f32('0x30')],_0x2ca8e2,_0x17b0ec,_0x3d657e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4590eda..0e2555d 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 _0x2c79=['login','exports','Router','./authActiveDirectory.controller','post'];(function(_0x307d2b,_0x3796e0){var _0xe82587=function(_0x3c9b26){while(--_0x3c9b26){_0x307d2b['push'](_0x307d2b['shift']());}};_0xe82587(++_0x3796e0);}(_0x2c79,0xac));var _0x92c7=function(_0x97d0fe,_0x2efd1f){_0x97d0fe=_0x97d0fe-0x0;var _0x5d1d86=_0x2c79[_0x97d0fe];return _0x5d1d86;};'use strict';var express=require('express');var router=express[_0x92c7('0x0')]();var controller=require(_0x92c7('0x1'));router[_0x92c7('0x2')]('/',controller[_0x92c7('0x3')]);module[_0x92c7('0x4')]=router; \ No newline at end of file +var _0x95dc=['login','exports','express','./authActiveDirectory.controller'];(function(_0x4ceb9d,_0x5d172c){var _0x4b35f7=function(_0x316c9a){while(--_0x316c9a){_0x4ceb9d['push'](_0x4ceb9d['shift']());}};_0x4b35f7(++_0x5d172c);}(_0x95dc,0x8a));var _0xc95d=function(_0x1e1f45,_0x24bda0){_0x1e1f45=_0x1e1f45-0x0;var _0x4df2b7=_0x95dc[_0x1e1f45];return _0x4df2b7;};'use strict';var express=require(_0xc95d('0x0'));var router=express['Router']();var controller=require(_0xc95d('0x1'));router['post']('/',controller[_0xc95d('0x2')]);module[_0xc95d('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index ac6e8a4..e07a5ba 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(_0x17348b,_0x1a42ba){var _0x3a9762=function(_0x654285){while(--_0x654285){_0x17348b['push'](_0x17348b['shift']());}};_0x3a9762(++_0x1a42ba);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x7a54,0x106));var _0x47a5=function(_0x39182c,_0x2810a3){_0x39182c=_0x39182c-0x0;var _0x2dedcd=_0x7a54[_0x39182c];return _0x2dedcd;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 06f84f7..f6e79d4 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 _0xc113=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','login','setTokenCookie','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc113,0x6e));var _0x3c11=function(_0x167796,_0x5536f6){_0x167796=_0x167796-0x0;var _0x131681=_0xc113[_0x167796];return _0x131681;};'use strict';var express=require(_0x3c11('0x0'));var passport=require(_0x3c11('0x1'));var router=express[_0x3c11('0x2')]();var controller=require(_0x3c11('0x3'));var userController=require(_0x3c11('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x3c11('0x5')](_0x3c11('0x6'),controller[_0x3c11('0x7')],authService['isMiddleware'],userController[_0x3c11('0x8')],authService[_0x3c11('0x9')]);module[_0x3c11('0xa')]=router; \ No newline at end of file +var _0x151d=['callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','login','get','/callback'];(function(_0x3d9732,_0x3d37cd){var _0x13f6b1=function(_0xb1a2de){while(--_0xb1a2de){_0x3d9732['push'](_0x3d9732['shift']());}};_0x13f6b1(++_0x3d37cd);}(_0x151d,0x1e7));var _0xd151=function(_0x776d43,_0x15a958){_0x776d43=_0x776d43-0x0;var _0x10fce5=_0x151d[_0x776d43];return _0x10fce5;};'use strict';var express=require(_0xd151('0x0'));var passport=require(_0xd151('0x1'));var router=express[_0xd151('0x2')]();var controller=require(_0xd151('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xd151('0x4'));router['get']('/',controller[_0xd151('0x5')]);router[_0xd151('0x6')](_0xd151('0x7'),controller[_0xd151('0x8')],authService[_0xd151('0x9')],userController[_0xd151('0x5')],authService['setTokenCookie']);module[_0xd151('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 16a671d..247e177 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 _0xc157=['agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','blocked','add','allowedLoginAttempts','clearBlockUser','getLicense','catch','MailAccount','find','email','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordExpires','send','Password\x20reset!','util','passport','passport-local','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','blockDuration','then','name','password','salt','role','blockedAt','loginAttempts','admin','user'];(function(_0x5e94ab,_0x528d62){var _0x3e6f2e=function(_0x599b32){while(--_0x599b32){_0x5e94ab['push'](_0x5e94ab['shift']());}};_0x3e6f2e(++_0x528d62);}(_0xc157,0xd7));var _0x7c15=function(_0x5c5999,_0x1c18ed){_0x5c5999=_0x5c5999-0x0;var _0x3983d8=_0xc157[_0x5c5999];return _0x3983d8;};'use strict';var util=require(_0x7c15('0x0'));var passport=require(_0x7c15('0x1'));var LocalStrategy=require(_0x7c15('0x2'))[_0x7c15('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x7c15('0x4'));var moment=require(_0x7c15('0x5'));var db=require(_0x7c15('0x6'))['db'];var authService=require(_0x7c15('0x7'));var utils=require(_0x7c15('0x8'));var client=jayson['client'][_0x7c15('0x9')]({'port':0x232b});function localAuthenticate(_0x5bf981,_0x35100b,_0x57db1f,_0x3aa370){var _0x20b989,_0x18ed79;return db[_0x7c15('0xa')][_0x7c15('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7c15('0xc')],'raw':!![]})[_0x7c15('0xd')](function(_0x1a5360){_0x20b989=_0x1a5360;return _0x5bf981[_0x7c15('0xb')]({'attributes':['id',_0x7c15('0xe'),_0x7c15('0xf'),_0x7c15('0x10'),_0x7c15('0x11'),'disabled','blocked',_0x7c15('0x12'),_0x7c15('0x13')],'where':{'name':_0x35100b,'role':{'$or':[_0x7c15('0x14'),_0x7c15('0x15'),_0x7c15('0x16')]}}});})[_0x7c15('0xd')](function(_0x404709){if(!_0x404709||_0x404709&&_0x404709[_0x7c15('0xe')]!==_0x35100b){throw new Error(_0x7c15('0x17'));}else{_0x18ed79=_0x404709;return _0x18ed79;}})[_0x7c15('0xd')](function(){_0x18ed79['authenticate'](_0x57db1f,function(_0x36d947,_0x190d55){var _0x1c120d=_0x18ed79['loginAttempts']+0x1;if(_0x36d947){return _0x3aa370(_0x36d947);}else if(!_0x190d55){if(_0x18ed79[_0x7c15('0x18')]){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}else if(_0x20b989['allowedLoginAttempts']>0x0){if(_0x18ed79[_0x7c15('0x19')]){if(_0x20b989[_0x7c15('0xc')]>0x0){if(moment(_0x18ed79['blockedAt'])[_0x7c15('0x1a')](_0x20b989[_0x7c15('0xc')],'minutes')>moment()){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}else{return utils['clearBlockUser'](_0x18ed79,_0x1c120d,![],null)[_0x7c15('0xd')](function(){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});});}}else{return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}}else{if(_0x1c120d>=_0x20b989[_0x7c15('0x1b')]){return utils['clearBlockUser'](_0x18ed79,0x0,!![],moment())['then'](function(){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});});}else{return utils['clearBlockUser'](_0x18ed79,_0x1c120d,![],null)[_0x7c15('0xd')](function(){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});});}}}else{return _0x3aa370(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x18ed79[_0x7c15('0x18')]){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}else if(_0x20b989[_0x7c15('0x1b')]>0x0){if(_0x18ed79['blocked']){if(_0x20b989[_0x7c15('0xc')]>0x0){if(moment(_0x18ed79[_0x7c15('0x12')])['add'](_0x20b989[_0x7c15('0xc')],'minutes')>moment()){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}else{return utils[_0x7c15('0x1c')](_0x18ed79,0x0,![],null)[_0x7c15('0xd')](function(){return utils[_0x7c15('0x1d')](_0x18ed79);})[_0x7c15('0xd')](function(){return _0x3aa370(null,_0x18ed79);});}}else{return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}}else{return utils[_0x7c15('0x1c')](_0x18ed79,0x0,![],null)[_0x7c15('0xd')](function(){return utils[_0x7c15('0x1d')](_0x18ed79);})['then'](function(){return _0x3aa370(null,_0x18ed79);})[_0x7c15('0x1e')](function(_0x14675f){return _0x3aa370(null,![],_0x14675f);});}}else{if(_0x18ed79['blocked']){return _0x3aa370(null,![],{'message':_0x7c15('0x17')});}else{return utils['getLicense'](_0x18ed79)[_0x7c15('0xd')](function(){return _0x3aa370(null,_0x18ed79);});}}}});})[_0x7c15('0x1e')](function(_0x178580){return _0x3aa370(null,![],_0x178580);});}function sendServiceMail(_0xbde0a5){return db[_0x7c15('0x1f')][_0x7c15('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x7c15('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x7c15('0x22')],'as':'CloudProvider'}]}]})[_0x7c15('0xd')](function(_0x2d351b){if(!_0x2d351b){throw new Error(_0x7c15('0x23'));}var _0x51378b=_0x2d351b[_0x7c15('0x24')]();var _0x1ebb88={'account':_0x51378b,'message':_['merge']({'from':util[_0x7c15('0x25')](_0x7c15('0x26'),_0x2d351b['name'],_0x2d351b[_0x7c15('0x21')]||_0x2d351b['Smtp'][_0x7c15('0x15')])},_0xbde0a5)};return client[_0x7c15('0x27')]('SendMail',_0x1ebb88);})[_0x7c15('0xd')](function(_0x2d0f74){if(_0x2d0f74[_0x7c15('0x28')]){throw new Error(util[_0x7c15('0x25')](_0x7c15('0x29'),_0x2d0f74['error'][_0x7c15('0x2a')]||JSON[_0x7c15('0x2b')](_0x2d0f74[_0x7c15('0x28')])));}return!![];});}function handleError(_0x3709b7,_0x1b0c5a,_0x3a8499){return _0x3709b7[_0x7c15('0x2c')](_0x1b0c5a||0x1f4)['send']({'message':_0x3a8499?_0x3a8499[_0x7c15('0x2a')]||_0x3a8499:''});}exports[_0x7c15('0x2d')]=function(_0xd710d0,_0x535233,_0xdd1582){passport[_0x7c15('0x2e')](_0x7c15('0x2f'),function(_0x27d3de,_0x48e441,_0x463102){var _0x940f9d=_0x27d3de||_0x463102;if(_0x940f9d){return handleError(_0x535233,0x191,_0x940f9d);}if(!_0x48e441){return handleError(_0x535233,0x194,{'message':_0x7c15('0x30')});}else{var _0x601f72={'payload':{'id':_0x48e441['id'],'role':_0x48e441[_0x7c15('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x7c15('0x31')](_0x601f72)[_0x7c15('0xd')](function(_0x47c5dd){_0x535233[_0x7c15('0x32')]({'id':_0x48e441['id'],'token':_0x47c5dd,'statusCall':'','isAlreadyLogged':_0x48e441['online']});});}})(_0xd710d0,_0x535233,_0xdd1582);};exports['forgot']=function(_0x1b0daf,_0x2dc8a4){if(!_0x1b0daf[_0x7c15('0x33')][_0x7c15('0x21')]){return handleError(_0x2dc8a4,0x1f4,{'message':_0x7c15('0x34')});}var _0x4c8a6a=rs[_0x7c15('0x35')]();_0x1b0daf[_0x7c15('0x33')]['email']=_0x1b0daf[_0x7c15('0x33')][_0x7c15('0x21')][_0x7c15('0x36')]()[_0x7c15('0x37')]();var _0x5f491f;return db[_0x7c15('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x7c15('0x1b'),_0x7c15('0xc')],'raw':!![]})[_0x7c15('0xd')](function(_0x44f0e1){_0x5f491f=_0x44f0e1;return db[_0x7c15('0x38')][_0x7c15('0x20')]({'where':{'email':_0x1b0daf[_0x7c15('0x33')][_0x7c15('0x21')]}});})[_0x7c15('0xd')](function(_0x290b7e){if(!_0x290b7e){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x290b7e[_0x7c15('0x18')]){throw new Error(_0x7c15('0x39'));}if(_0x290b7e[_0x7c15('0x19')]){if(moment(_0x290b7e['blockedAt'])[_0x7c15('0x1a')](_0x5f491f['blockDuration'],_0x7c15('0x3a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x290b7e[_0x7c15('0x19')]=![];_0x290b7e[_0x7c15('0x12')]=null;}}_0x290b7e[_0x7c15('0x3b')]=_0x4c8a6a;_0x290b7e['resetPasswordExpires']=Date[_0x7c15('0x3c')]()+0x36ee80;return _0x290b7e[_0x7c15('0x3d')]();})[_0x7c15('0xd')](function(){return sendServiceMail({'to':_0x1b0daf[_0x7c15('0x33')]['email'],'subject':_0x7c15('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7c15('0x3f')+_0x7c15('0x40')+_0x1b0daf['headers']['host']+_0x7c15('0x41')+_0x4c8a6a+'\x0a\x0a'+_0x7c15('0x42')});})[_0x7c15('0xd')](function(){_0x2dc8a4[_0x7c15('0x2c')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x7c15('0x1e')](function(_0x342572){return handleError(_0x2dc8a4,0x1f4,_0x342572);});};exports[_0x7c15('0x43')]=function(_0x24a0f2,_0x180a15){return db[_0x7c15('0x38')][_0x7c15('0x20')]({'where':{'resetPasswordToken':_0x24a0f2[_0x7c15('0x44')]['token'],'resetPasswordExpires':{'$gt':Date[_0x7c15('0x3c')]()}}})[_0x7c15('0xd')](function(_0x52f0db){if(!_0x52f0db){throw new Error(_0x7c15('0x45'));}return db[_0x7c15('0xa')][_0x7c15('0xb')]({'attributes':['id',_0x7c15('0x46'),_0x7c15('0x47'),_0x7c15('0x48')]})[_0x7c15('0xd')](function(_0x35d53e){if(_0x35d53e[_0x7c15('0x46')])authService[_0x7c15('0x49')](_0x24a0f2[_0x7c15('0x33')][_0x7c15('0xf')]);if(!_0x35d53e[_0x7c15('0x47')]||!_0x52f0db['previousPasswords'])return _0x52f0db;authService[_0x7c15('0x4a')](_0x24a0f2['body'][_0x7c15('0xf')],_0x52f0db[_0x7c15('0x4b')],_0x35d53e[_0x7c15('0x48')]);return _0x52f0db;})[_0x7c15('0xd')](function(){_0x52f0db[_0x7c15('0xf')]=_0x24a0f2['body'][_0x7c15('0xf')];_0x52f0db[_0x7c15('0x3b')]=null;_0x52f0db[_0x7c15('0x4c')]=null;return _0x52f0db['save']();});})[_0x7c15('0xd')](function(){_0x180a15[_0x7c15('0x2c')](0xc8)[_0x7c15('0x4d')]({'message':_0x7c15('0x4e')});})[_0x7c15('0x1e')](function(_0x27a2d7){return handleError(_0x180a15,0x1f4,_0x27a2d7);});};passport['use'](_0x7c15('0x2f'),new LocalStrategy({'usernameField':_0x7c15('0xe'),'passwordField':_0x7c15('0xf')},function(_0x5d3c1d,_0x4a1956,_0x10de64){return localAuthenticate(db[_0x7c15('0x38')],_0x5d3c1d,_0x4a1956,_0x10de64);})); \ No newline at end of file +var _0x1270=['signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','disabled','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockedAt','minutes','clearBlockUser','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1270,0x1b4));var _0x0127=function(_0x5a0cd1,_0x3f524f){_0x5a0cd1=_0x5a0cd1-0x0;var _0x2d1564=_0x1270[_0x5a0cd1];return _0x2d1564;};'use strict';var util=require('util');var passport=require(_0x0127('0x0'));var LocalStrategy=require(_0x0127('0x1'))[_0x0127('0x2')];var jayson=require(_0x0127('0x3'));var _=require(_0x0127('0x4'));var rs=require(_0x0127('0x5'));var moment=require('moment');var db=require(_0x0127('0x6'))['db'];var authService=require(_0x0127('0x7'));var utils=require(_0x0127('0x8'));var client=jayson['client'][_0x0127('0x9')]({'port':0x232b});function localAuthenticate(_0x35bf63,_0x351b23,_0x4f3608,_0x308183){var _0x291989,_0x4d0b29;return db[_0x0127('0xa')][_0x0127('0xb')]({'where':{'id':0x1},'attributes':[_0x0127('0xc'),_0x0127('0xd')],'raw':!![]})['then'](function(_0x393d74){_0x291989=_0x393d74;return _0x35bf63[_0x0127('0xb')]({'attributes':['id',_0x0127('0xe'),_0x0127('0xf'),'salt','role',_0x0127('0x10'),'blocked','blockedAt',_0x0127('0x11')],'where':{'name':_0x351b23,'role':{'$or':[_0x0127('0x12'),_0x0127('0x13'),_0x0127('0x14')]}}});})[_0x0127('0x15')](function(_0x3ded0d){if(!_0x3ded0d||_0x3ded0d&&_0x3ded0d['name']!==_0x351b23){throw new Error(_0x0127('0x16'));}else{_0x4d0b29=_0x3ded0d;return _0x4d0b29;}})[_0x0127('0x15')](function(){_0x4d0b29[_0x0127('0x17')](_0x4f3608,function(_0x3f633a,_0x31e56c){var _0x5c2f7d=_0x4d0b29[_0x0127('0x11')]+0x1;if(_0x3f633a){return _0x308183(_0x3f633a);}else if(!_0x31e56c){if(_0x4d0b29['disabled']){return _0x308183(null,![],{'message':_0x0127('0x16')});}else if(_0x291989[_0x0127('0xc')]>0x0){if(_0x4d0b29[_0x0127('0x18')]){if(_0x291989[_0x0127('0xd')]>0x0){if(moment(_0x4d0b29[_0x0127('0x19')])['add'](_0x291989[_0x0127('0xd')],_0x0127('0x1a'))>moment()){return _0x308183(null,![],{'message':_0x0127('0x16')});}else{return utils[_0x0127('0x1b')](_0x4d0b29,_0x5c2f7d,![],null)[_0x0127('0x15')](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}}else{return _0x308183(null,![],{'message':_0x0127('0x16')});}}else{if(_0x5c2f7d>=_0x291989['allowedLoginAttempts']){return utils[_0x0127('0x1b')](_0x4d0b29,0x0,!![],moment())['then'](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}else{return utils[_0x0127('0x1b')](_0x4d0b29,_0x5c2f7d,![],null)[_0x0127('0x15')](function(){return _0x308183(null,![],{'message':_0x0127('0x16')});});}}}else{return _0x308183(null,![],{'message':_0x0127('0x16')});}}else{if(_0x4d0b29[_0x0127('0x10')]){return _0x308183(null,![],{'message':_0x0127('0x16')});}else if(_0x291989[_0x0127('0xc')]>0x0){if(_0x4d0b29[_0x0127('0x18')]){if(_0x291989['blockDuration']>0x0){if(moment(_0x4d0b29[_0x0127('0x19')])[_0x0127('0x1c')](_0x291989[_0x0127('0xd')],'minutes')>moment()){return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0127('0x1b')](_0x4d0b29,0x0,![],null)[_0x0127('0x15')](function(){return utils['getLicense'](_0x4d0b29);})[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);});}}else{return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0127('0x1b')](_0x4d0b29,0x0,![],null)[_0x0127('0x15')](function(){return utils[_0x0127('0x1d')](_0x4d0b29);})[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);})['catch'](function(_0x2b2450){return _0x308183(null,![],_0x2b2450);});}}else{if(_0x4d0b29['blocked']){return _0x308183(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x4d0b29)[_0x0127('0x15')](function(){return _0x308183(null,_0x4d0b29);});}}}});})[_0x0127('0x1e')](function(_0x3042be){return _0x308183(null,![],_0x3042be);});}function sendServiceMail(_0x55dd87){return db['MailAccount'][_0x0127('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x0127('0xe'),_0x0127('0x20')],'include':[{'model':db[_0x0127('0x21')],'as':_0x0127('0x22'),'include':[{'model':db[_0x0127('0x23')],'as':_0x0127('0x23')}]}]})[_0x0127('0x15')](function(_0x46c199){if(!_0x46c199){throw new Error(_0x0127('0x24'));}var _0x506f0d=_0x46c199['getSmtpOptions']();var _0x51118e={'account':_0x506f0d,'message':_[_0x0127('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x46c199[_0x0127('0xe')],_0x46c199['email']||_0x46c199[_0x0127('0x22')][_0x0127('0x13')])},_0x55dd87)};return client['request'](_0x0127('0x26'),_0x51118e);})[_0x0127('0x15')](function(_0xf2ebfd){if(_0xf2ebfd[_0x0127('0x27')]){throw new Error(util[_0x0127('0x28')](_0x0127('0x29'),_0xf2ebfd['error'][_0x0127('0x2a')]||JSON[_0x0127('0x2b')](_0xf2ebfd[_0x0127('0x27')])));}return!![];});}function handleError(_0x439030,_0x5d26a1,_0x42866b){return _0x439030[_0x0127('0x2c')](_0x5d26a1||0x1f4)[_0x0127('0x2d')]({'message':_0x42866b?_0x42866b[_0x0127('0x2a')]||_0x42866b:''});}exports[_0x0127('0x2e')]=function(_0x1b9771,_0x190f32,_0x307dfc){passport[_0x0127('0x17')](_0x0127('0x2f'),function(_0x370fac,_0x1bffd7,_0x124f28){var _0x294a35=_0x370fac||_0x124f28;if(_0x294a35){return handleError(_0x190f32,0x191,_0x294a35);}if(!_0x1bffd7){return handleError(_0x190f32,0x194,{'message':_0x0127('0x30')});}else{var _0x5933a1={'payload':{'id':_0x1bffd7['id'],'role':_0x1bffd7[_0x0127('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x0127('0x32')](_0x5933a1)[_0x0127('0x15')](function(_0x279d68){_0x190f32[_0x0127('0x33')]({'id':_0x1bffd7['id'],'token':_0x279d68,'statusCall':'','isAlreadyLogged':_0x1bffd7['online']});});}})(_0x1b9771,_0x190f32,_0x307dfc);};exports[_0x0127('0x34')]=function(_0x4ffaf3,_0xe97016){if(!_0x4ffaf3[_0x0127('0x35')][_0x0127('0x20')]){return handleError(_0xe97016,0x1f4,{'message':_0x0127('0x36')});}var _0x4f6fc3=rs[_0x0127('0x37')]();_0x4ffaf3[_0x0127('0x35')][_0x0127('0x20')]=_0x4ffaf3[_0x0127('0x35')]['email'][_0x0127('0x38')]()[_0x0127('0x39')]();var _0x3ece2c;return db[_0x0127('0xa')][_0x0127('0xb')]({'where':{'id':0x1},'attributes':[_0x0127('0xc'),_0x0127('0xd')],'raw':!![]})[_0x0127('0x15')](function(_0x22286d){_0x3ece2c=_0x22286d;return db[_0x0127('0x3a')][_0x0127('0x1f')]({'where':{'email':_0x4ffaf3[_0x0127('0x35')]['email']}});})[_0x0127('0x15')](function(_0xcf51c2){if(!_0xcf51c2){throw new Error(_0x0127('0x3b'));}if(_0xcf51c2['disabled']){throw new Error(_0x0127('0x3c'));}if(_0xcf51c2['blocked']){if(moment(_0xcf51c2['blockedAt'])[_0x0127('0x1c')](_0x3ece2c['blockDuration'],_0x0127('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xcf51c2[_0x0127('0x18')]=![];_0xcf51c2[_0x0127('0x19')]=null;}}_0xcf51c2[_0x0127('0x3d')]=_0x4f6fc3;_0xcf51c2[_0x0127('0x3e')]=Date[_0x0127('0x3f')]()+0x36ee80;return _0xcf51c2[_0x0127('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x4ffaf3['body']['email'],'subject':_0x0127('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x0127('0x42')+_0x0127('0x43')+_0x4ffaf3[_0x0127('0x44')]['host']+_0x0127('0x45')+_0x4f6fc3+'\x0a\x0a'+_0x0127('0x46')});})[_0x0127('0x15')](function(){_0xe97016['status'](0xc8)[_0x0127('0x2d')]({'message':_0x0127('0x47')});})[_0x0127('0x1e')](function(_0x472e2b){return handleError(_0xe97016,0x1f4,_0x472e2b);});};exports[_0x0127('0x48')]=function(_0x5754da,_0x305c9d){return db[_0x0127('0x3a')][_0x0127('0x1f')]({'where':{'resetPasswordToken':_0x5754da[_0x0127('0x49')][_0x0127('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x0127('0x3f')]()}}})[_0x0127('0x15')](function(_0x44fff7){if(!_0x44fff7){throw new Error(_0x0127('0x4b'));}return db[_0x0127('0xa')][_0x0127('0xb')]({'attributes':['id',_0x0127('0x4c'),_0x0127('0x4d'),_0x0127('0x4e')]})[_0x0127('0x15')](function(_0x580603){if(_0x580603['securePassword'])authService['validatePasswordPattern'](_0x5754da['body'][_0x0127('0xf')]);if(!_0x580603[_0x0127('0x4d')]||!_0x44fff7[_0x0127('0x4f')])return _0x44fff7;authService['validatePasswordHistory'](_0x5754da[_0x0127('0x35')][_0x0127('0xf')],_0x44fff7[_0x0127('0x4f')],_0x580603['passwordHistoryLimit']);return _0x44fff7;})['then'](function(){_0x44fff7[_0x0127('0xf')]=_0x5754da[_0x0127('0x35')][_0x0127('0xf')];_0x44fff7[_0x0127('0x3d')]=null;_0x44fff7['resetPasswordExpires']=null;return _0x44fff7['save']();});})[_0x0127('0x15')](function(){_0x305c9d[_0x0127('0x2c')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x0127('0x1e')](function(_0x4fdf1d){return handleError(_0x305c9d,0x1f4,_0x4fdf1d);});};passport[_0x0127('0x50')](_0x0127('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0x0127('0xf')},function(_0x13d023,_0x265ad1,_0x75c844){return localAuthenticate(db['User'],_0x13d023,_0x265ad1,_0x75c844);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index bac304b..0d54a41 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 _0x9034=['exports','express','Router','post','login','/forgot','forgot','/reset/:token'];(function(_0x59f7ce,_0x5b3bd3){var _0x2e9cce=function(_0xad5439){while(--_0xad5439){_0x59f7ce['push'](_0x59f7ce['shift']());}};_0x2e9cce(++_0x5b3bd3);}(_0x9034,0x1c1));var _0x4903=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9034[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x4903('0x0'));var router=express[_0x4903('0x1')]();var controller=require('./authLocal.controller');router[_0x4903('0x2')]('/',controller[_0x4903('0x3')]);router[_0x4903('0x2')](_0x4903('0x4'),controller[_0x4903('0x5')]);router[_0x4903('0x2')](_0x4903('0x6'),controller['reset']);module[_0x4903('0x7')]=router; \ No newline at end of file +var _0xbf4b=['post','login','forgot','express','Router','./authLocal.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbf4b,0xe1));var _0xbbf4=function(_0xf9e76,_0x2e6b9a){_0xf9e76=_0xf9e76-0x0;var _0x119a9b=_0xbf4b[_0xf9e76];return _0x119a9b;};'use strict';var express=require(_0xbbf4('0x0'));var router=express[_0xbbf4('0x1')]();var controller=require(_0xbbf4('0x2'));router[_0xbbf4('0x3')]('/',controller[_0xbbf4('0x4')]);router[_0xbbf4('0x3')]('/forgot',controller[_0xbbf4('0x5')]);router[_0xbbf4('0x3')]('/reset/:token',controller['reset']);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 e88969c..5ab52a4 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 _0xbe17=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x2959ad,_0x472e27){var _0x50df2c=function(_0x35c0c1){while(--_0x35c0c1){_0x2959ad['push'](_0x2959ad['shift']());}};_0x50df2c(++_0x472e27);}(_0xbe17,0x10c));var _0x7be1=function(_0x595e2a,_0xb0a923){_0x595e2a=_0x595e2a-0x0;var _0x122421=_0xbe17[_0x595e2a];return _0x122421;};'use strict';var Sequelize=require('sequelize');module[_0x7be1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7be1('0x1')]},'description':{'type':Sequelize[_0x7be1('0x1')]},'status':{'type':Sequelize[_0x7be1('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7be1('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0ce6=['INTEGER','exports','STRING'];(function(_0x434969,_0x3ef4fe){var _0xac29d7=function(_0x30ef6c){while(--_0x30ef6c){_0x434969['push'](_0x434969['shift']());}};_0xac29d7(++_0x3ef4fe);}(_0x0ce6,0x100));var _0x60ce=function(_0x272e68,_0x49f8c4){_0x272e68=_0x272e68-0x0;var _0x532fc7=_0x0ce6[_0x272e68];return _0x532fc7;};'use strict';var Sequelize=require('sequelize');module[_0x60ce('0x0')]={'name':{'type':Sequelize[_0x60ce('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60ce('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x60ce('0x2')],'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 4cd2c60..b285e56 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 _0xc219=['index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','Automation','includeAll','catch','show','include','find','create','body','params','addConditions','Condition','ids','findOne','order','pick','getConditions','Action','addActions','getActions','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc219,0x1c7));var _0x9c21=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xc219[_0x5f1617];return _0x3af5da;};'use strict';var emlformat=require(_0x9c21('0x0'));var rimraf=require(_0x9c21('0x1'));var zipdir=require(_0x9c21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c21('0x3'));var BPromise=require(_0x9c21('0x4'));var Mustache=require('mustache');var util=require(_0x9c21('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9c21('0x6'));var ejs=require(_0x9c21('0x7'));var fs=require('fs');var fs_extra=require(_0x9c21('0x8'));var _=require('lodash');var squel=require(_0x9c21('0x9'));var crypto=require(_0x9c21('0xa'));var jsforce=require(_0x9c21('0xb'));var deskjs=require(_0x9c21('0xc'));var toCsv=require(_0x9c21('0x6'));var querystring=require(_0x9c21('0xd'));var Papa=require(_0x9c21('0xe'));var Redis=require(_0x9c21('0xf'));var authService=require(_0x9c21('0x10'));var qs=require(_0x9c21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c21('0x12'));var utils=require(_0x9c21('0x13'));var config=require(_0x9c21('0x14'));var licenseUtil=require(_0x9c21('0x15'));var db=require(_0x9c21('0x16'))['db'];function respondWithStatusCode(_0x255497,_0x554f8e){_0x554f8e=_0x554f8e||0xcc;return function(_0x432ad9){if(_0x432ad9){return _0x255497['sendStatus'](_0x554f8e);}return _0x255497[_0x9c21('0x17')](_0x554f8e)[_0x9c21('0x18')]();};}function respondWithResult(_0x4b4501,_0x5267ff){_0x5267ff=_0x5267ff||0xc8;return function(_0x5403a6){if(_0x5403a6){return _0x4b4501[_0x9c21('0x17')](_0x5267ff)[_0x9c21('0x19')](_0x5403a6);}};}function respondWithFilteredResult(_0x1cffda,_0x3d074c){return function(_0x38df70){if(_0x38df70){var _0x282dba=typeof _0x3d074c[_0x9c21('0x1a')]===_0x9c21('0x1b')&&typeof _0x3d074c['limit']===_0x9c21('0x1b');var _0x18df58=_0x38df70['count'];var _0x4a45a4=_0x282dba?0x0:_0x3d074c['offset'];var _0x3f401b=_0x282dba?_0x38df70[_0x9c21('0x1c')]:_0x3d074c[_0x9c21('0x1a')]+_0x3d074c[_0x9c21('0x1d')];var _0x354ea3;if(_0x3f401b>=_0x18df58){_0x3f401b=_0x18df58;_0x354ea3=0xc8;}else{_0x354ea3=0xce;}_0x1cffda[_0x9c21('0x17')](_0x354ea3);return _0x1cffda[_0x9c21('0x1e')](_0x9c21('0x1f'),_0x4a45a4+'-'+_0x3f401b+'/'+_0x18df58)[_0x9c21('0x19')](_0x38df70);}return null;};}function patchUpdates(_0x27d655){return function(_0x477cab){try{jsonpatch[_0x9c21('0x20')](_0x477cab,_0x27d655,!![]);}catch(_0x127833){return BPromise[_0x9c21('0x21')](_0x127833);}return _0x477cab[_0x9c21('0x22')]();};}function saveUpdates(_0x359765,_0x3dedc7){return function(_0xd162fd){if(_0xd162fd){return _0xd162fd[_0x9c21('0x23')](_0x359765)[_0x9c21('0x24')](function(_0x2e43de){return _0x2e43de;});}return null;};}function removeEntity(_0x29830e,_0x4a002b){return function(_0x4db19e){if(_0x4db19e){return _0x4db19e[_0x9c21('0x25')]()[_0x9c21('0x24')](function(){_0x29830e[_0x9c21('0x17')](0xcc)[_0x9c21('0x18')]();});}};}function handleEntityNotFound(_0x3c38ec,_0x4ebcae){return function(_0x26d41d){if(!_0x26d41d){_0x3c38ec[_0x9c21('0x26')](0x194);}return _0x26d41d;};}function handleError(_0x20fdb2,_0x57beb5){_0x57beb5=_0x57beb5||0x1f4;return function(_0x2362fe){logger[_0x9c21('0x27')](_0x2362fe[_0x9c21('0x28')]);if(_0x2362fe[_0x9c21('0x29')]){delete _0x2362fe['name'];}_0x20fdb2[_0x9c21('0x17')](_0x57beb5)[_0x9c21('0x2a')](_0x2362fe);};}exports[_0x9c21('0x2b')]=function(_0x1593f7,_0xaf2ebc){var _0xe379d0={},_0x1f79f4={},_0x43fea1={'count':0x0,'rows':[]};var _0x37c617=_[_0x9c21('0x2c')](db['Automation'][_0x9c21('0x2d')],function(_0x4dd440){return{'name':_0x4dd440[_0x9c21('0x2e')],'type':_0x4dd440[_0x9c21('0x2f')]['key']};});_0x1f79f4['model']=_[_0x9c21('0x2c')](_0x37c617,_0x9c21('0x29'));_0x1f79f4[_0x9c21('0x30')]=_[_0x9c21('0x31')](_0x1593f7['query']);_0x1f79f4[_0x9c21('0x32')]=_[_0x9c21('0x33')](_0x1f79f4['model'],_0x1f79f4['query']);_0xe379d0['attributes']=_[_0x9c21('0x33')](_0x1f79f4[_0x9c21('0x34')],qs[_0x9c21('0x35')](_0x1593f7[_0x9c21('0x30')][_0x9c21('0x35')]));_0xe379d0[_0x9c21('0x36')]=_0xe379d0[_0x9c21('0x36')][_0x9c21('0x37')]?_0xe379d0[_0x9c21('0x36')]:_0x1f79f4['model'];if(!_0x1593f7[_0x9c21('0x30')][_0x9c21('0x38')](_0x9c21('0x39'))){_0xe379d0[_0x9c21('0x1d')]=qs[_0x9c21('0x1d')](_0x1593f7[_0x9c21('0x30')][_0x9c21('0x1d')]);_0xe379d0[_0x9c21('0x1a')]=qs[_0x9c21('0x1a')](_0x1593f7[_0x9c21('0x30')]['offset']);}_0xe379d0['order']=qs[_0x9c21('0x3a')](_0x1593f7['query']['sort']);_0xe379d0[_0x9c21('0x3b')]=qs[_0x9c21('0x32')](_['pick'](_0x1593f7[_0x9c21('0x30')],_0x1f79f4[_0x9c21('0x32')]),_0x37c617);if(_0x1593f7[_0x9c21('0x30')]['filter']){_0xe379d0[_0x9c21('0x3b')]=_[_0x9c21('0x3c')](_0xe379d0[_0x9c21('0x3b')],{'$or':_['map'](_0x37c617,function(_0x39475d){if(_0x39475d[_0x9c21('0x2f')]!==_0x9c21('0x3d')){var _0x59cb8d={};_0x59cb8d[_0x39475d[_0x9c21('0x29')]]={'$like':'%'+_0x1593f7[_0x9c21('0x30')][_0x9c21('0x3e')]+'%'};return _0x59cb8d;}})});}_0xe379d0=_[_0x9c21('0x3c')]({},_0xe379d0,_0x1593f7[_0x9c21('0x3f')]);var _0x47173a={'where':_0xe379d0[_0x9c21('0x3b')]};return db[_0x9c21('0x40')][_0x9c21('0x1c')](_0x47173a)[_0x9c21('0x24')](function(_0x1bf52a){_0x43fea1[_0x9c21('0x1c')]=_0x1bf52a;if(_0x1593f7[_0x9c21('0x30')][_0x9c21('0x41')]){_0xe379d0['include']=[{'all':!![]}];}return db[_0x9c21('0x40')]['findAll'](_0xe379d0);})['then'](function(_0x3d638b){_0x43fea1['rows']=_0x3d638b;return _0x43fea1;})['then'](respondWithFilteredResult(_0xaf2ebc,_0xe379d0))[_0x9c21('0x42')](handleError(_0xaf2ebc,null));};exports[_0x9c21('0x43')]=function(_0x119663,_0x35faf3){var _0x15499e={'raw':![],'where':{'id':_0x119663['params']['id']}},_0x5f4df2={};_0x5f4df2[_0x9c21('0x34')]=_['keys'](db[_0x9c21('0x40')][_0x9c21('0x2d')]);_0x5f4df2[_0x9c21('0x30')]=_['keys'](_0x119663['query']);_0x5f4df2['filters']=_[_0x9c21('0x33')](_0x5f4df2[_0x9c21('0x34')],_0x5f4df2[_0x9c21('0x30')]);_0x15499e['attributes']=_[_0x9c21('0x33')](_0x5f4df2[_0x9c21('0x34')],qs[_0x9c21('0x35')](_0x119663['query'][_0x9c21('0x35')]));_0x15499e['attributes']=_0x15499e[_0x9c21('0x36')][_0x9c21('0x37')]?_0x15499e[_0x9c21('0x36')]:_0x5f4df2['model'];if(_0x119663[_0x9c21('0x30')][_0x9c21('0x41')]){_0x15499e[_0x9c21('0x44')]=[{'all':!![]}];}_0x15499e=_[_0x9c21('0x3c')]({},_0x15499e,_0x119663[_0x9c21('0x3f')]);return db[_0x9c21('0x40')][_0x9c21('0x45')](_0x15499e)[_0x9c21('0x24')](handleEntityNotFound(_0x35faf3,null))['then'](respondWithResult(_0x35faf3,null))['catch'](handleError(_0x35faf3,null));};exports[_0x9c21('0x46')]=function(_0x53e106,_0x366a25){return db['Automation'][_0x9c21('0x46')](_0x53e106['body'],{})['then'](respondWithResult(_0x366a25,0xc9))[_0x9c21('0x42')](handleError(_0x366a25,null));};exports[_0x9c21('0x23')]=function(_0x1616fb,_0x54836b){if(_0x1616fb[_0x9c21('0x47')]['id']){delete _0x1616fb[_0x9c21('0x47')]['id'];}return db[_0x9c21('0x40')][_0x9c21('0x45')]({'where':{'id':_0x1616fb['params']['id']}})['then'](handleEntityNotFound(_0x54836b,null))[_0x9c21('0x24')](saveUpdates(_0x1616fb[_0x9c21('0x47')],null))[_0x9c21('0x24')](respondWithResult(_0x54836b,null))['catch'](handleError(_0x54836b,null));};exports[_0x9c21('0x25')]=function(_0x4470d2,_0x5d7109){return db['Automation']['find']({'where':{'id':_0x4470d2[_0x9c21('0x48')]['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x5d7109,null))[_0x9c21('0x24')](removeEntity(_0x5d7109,null))[_0x9c21('0x42')](handleError(_0x5d7109,null));};exports[_0x9c21('0x49')]=function(_0x45edef,_0x3282b6,_0x2926f3){return db[_0x9c21('0x4a')][_0x9c21('0x45')]({'where':{'id':_0x45edef[_0x9c21('0x48')]['id']}})['then'](handleEntityNotFound(_0x3282b6,null))[_0x9c21('0x24')](function(_0x457431){if(_0x457431){return _0x457431['addConditions'](_0x45edef[_0x9c21('0x47')][_0x9c21('0x4b')],_['omit'](_0x45edef[_0x9c21('0x47')],['ids','id'])||{});}})[_0x9c21('0x24')](respondWithResult(_0x3282b6,null))['catch'](handleError(_0x3282b6,null));};exports['getConditions']=function(_0x68c090,_0x28c5bd,_0x4ff085){var _0x4b53f1={};var _0x2f9703={};var _0x18fcf4;var _0x209c5e;return db[_0x9c21('0x40')][_0x9c21('0x4c')]({'where':{'id':_0x68c090['params']['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x28c5bd,null))[_0x9c21('0x24')](function(_0x214eee){if(_0x214eee){_0x18fcf4=_0x214eee;_0x2f9703[_0x9c21('0x34')]=_[_0x9c21('0x31')](db[_0x9c21('0x4a')][_0x9c21('0x2d')]);_0x2f9703[_0x9c21('0x30')]=_[_0x9c21('0x31')](_0x68c090[_0x9c21('0x30')]);_0x2f9703[_0x9c21('0x32')]=_[_0x9c21('0x33')](_0x2f9703[_0x9c21('0x34')],_0x2f9703[_0x9c21('0x30')]);_0x4b53f1[_0x9c21('0x36')]=_[_0x9c21('0x33')](_0x2f9703['model'],qs[_0x9c21('0x35')](_0x68c090[_0x9c21('0x30')][_0x9c21('0x35')]));_0x4b53f1[_0x9c21('0x36')]=_0x4b53f1['attributes'][_0x9c21('0x37')]?_0x4b53f1[_0x9c21('0x36')]:_0x2f9703['model'];_0x4b53f1[_0x9c21('0x4d')]=qs[_0x9c21('0x3a')](_0x68c090[_0x9c21('0x30')]['sort']);_0x4b53f1['where']=qs[_0x9c21('0x32')](_[_0x9c21('0x4e')](_0x68c090[_0x9c21('0x30')],_0x2f9703[_0x9c21('0x32')]));if(_0x68c090[_0x9c21('0x30')][_0x9c21('0x3e')]){_0x4b53f1['where']=_[_0x9c21('0x3c')](_0x4b53f1[_0x9c21('0x3b')],{'$or':_[_0x9c21('0x2c')](_0x4b53f1[_0x9c21('0x36')],function(_0x3d23ea){var _0x4fc2c1={};_0x4fc2c1[_0x3d23ea]={'$like':'%'+_0x68c090[_0x9c21('0x30')]['filter']+'%'};return _0x4fc2c1;})});}_0x4b53f1=_[_0x9c21('0x3c')]({},_0x4b53f1,_0x68c090[_0x9c21('0x3f')]);return _0x18fcf4[_0x9c21('0x4f')](_0x4b53f1);}})['then'](function(_0x31068c){if(_0x31068c){_0x209c5e=_0x31068c[_0x9c21('0x37')];if(!_0x68c090['query']['hasOwnProperty']('nolimit')){_0x4b53f1[_0x9c21('0x1d')]=qs[_0x9c21('0x1d')](_0x68c090[_0x9c21('0x30')]['limit']);_0x4b53f1[_0x9c21('0x1a')]=qs[_0x9c21('0x1a')](_0x68c090[_0x9c21('0x30')][_0x9c21('0x1a')]);}return _0x18fcf4['getConditions'](_0x4b53f1);}})[_0x9c21('0x24')](function(_0xa07490){if(_0xa07490){return _0xa07490?{'count':_0x209c5e,'rows':_0xa07490}:null;}})['then'](respondWithResult(_0x28c5bd,null))[_0x9c21('0x42')](handleError(_0x28c5bd,null));};exports['addActions']=function(_0x1cbb6d,_0x1e7dcd,_0x212e2c){return db[_0x9c21('0x50')][_0x9c21('0x45')]({'where':{'id':_0x1cbb6d['params']['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x1e7dcd,null))[_0x9c21('0x24')](function(_0x4dfc2f){if(_0x4dfc2f){return _0x4dfc2f[_0x9c21('0x51')](_0x1cbb6d[_0x9c21('0x47')]['ids'],_['omit'](_0x1cbb6d[_0x9c21('0x47')],[_0x9c21('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x1e7dcd,null))[_0x9c21('0x42')](handleError(_0x1e7dcd,null));};exports[_0x9c21('0x52')]=function(_0x3871a4,_0x350130,_0x54a8a3){var _0x215f93={};var _0x3dff64={};var _0x26fc83;var _0x600dc1;return db[_0x9c21('0x40')]['findOne']({'where':{'id':_0x3871a4[_0x9c21('0x48')]['id']}})[_0x9c21('0x24')](handleEntityNotFound(_0x350130,null))[_0x9c21('0x24')](function(_0x31a7c0){if(_0x31a7c0){_0x26fc83=_0x31a7c0;_0x3dff64[_0x9c21('0x34')]=_[_0x9c21('0x31')](db[_0x9c21('0x50')][_0x9c21('0x2d')]);_0x3dff64['query']=_[_0x9c21('0x31')](_0x3871a4[_0x9c21('0x30')]);_0x3dff64['filters']=_[_0x9c21('0x33')](_0x3dff64['model'],_0x3dff64[_0x9c21('0x30')]);_0x215f93[_0x9c21('0x36')]=_[_0x9c21('0x33')](_0x3dff64[_0x9c21('0x34')],qs[_0x9c21('0x35')](_0x3871a4[_0x9c21('0x30')][_0x9c21('0x35')]));_0x215f93[_0x9c21('0x36')]=_0x215f93[_0x9c21('0x36')][_0x9c21('0x37')]?_0x215f93[_0x9c21('0x36')]:_0x3dff64[_0x9c21('0x34')];_0x215f93['order']=qs[_0x9c21('0x3a')](_0x3871a4[_0x9c21('0x30')][_0x9c21('0x3a')]);_0x215f93[_0x9c21('0x3b')]=qs[_0x9c21('0x32')](_[_0x9c21('0x4e')](_0x3871a4[_0x9c21('0x30')],_0x3dff64[_0x9c21('0x32')]));if(_0x3871a4['query'][_0x9c21('0x3e')]){_0x215f93[_0x9c21('0x3b')]=_[_0x9c21('0x3c')](_0x215f93[_0x9c21('0x3b')],{'$or':_[_0x9c21('0x2c')](_0x215f93[_0x9c21('0x36')],function(_0x5a451f){var _0x5e5a47={};_0x5e5a47[_0x5a451f]={'$like':'%'+_0x3871a4[_0x9c21('0x30')][_0x9c21('0x3e')]+'%'};return _0x5e5a47;})});}_0x215f93=_['merge']({},_0x215f93,_0x3871a4['options']);return _0x26fc83[_0x9c21('0x52')](_0x215f93);}})[_0x9c21('0x24')](function(_0x336282){if(_0x336282){_0x600dc1=_0x336282[_0x9c21('0x37')];if(!_0x3871a4[_0x9c21('0x30')]['hasOwnProperty'](_0x9c21('0x39'))){_0x215f93['limit']=qs[_0x9c21('0x1d')](_0x3871a4['query'][_0x9c21('0x1d')]);_0x215f93[_0x9c21('0x1a')]=qs[_0x9c21('0x1a')](_0x3871a4[_0x9c21('0x30')]['offset']);}return _0x26fc83['getActions'](_0x215f93);}})['then'](function(_0x522705){if(_0x522705){return _0x522705?{'count':_0x600dc1,'rows':_0x522705}:null;}})[_0x9c21('0x24')](respondWithResult(_0x350130,null))[_0x9c21('0x42')](handleError(_0x350130,null));}; \ No newline at end of file +var _0x2787=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','map','Automation','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','addConditions','omit','ids','getConditions','Condition','nolimit','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x2787,0x18a));var _0x7278=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2787[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7278('0x0'));var rimraf=require(_0x7278('0x1'));var zipdir=require(_0x7278('0x2'));var jsonpatch=require(_0x7278('0x3'));var rp=require('request-promise');var moment=require(_0x7278('0x4'));var BPromise=require(_0x7278('0x5'));var Mustache=require(_0x7278('0x6'));var util=require('util');var path=require(_0x7278('0x7'));var sox=require(_0x7278('0x8'));var csv=require(_0x7278('0x9'));var ejs=require(_0x7278('0xa'));var fs=require('fs');var fs_extra=require(_0x7278('0xb'));var _=require(_0x7278('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7278('0xd'));var deskjs=require(_0x7278('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7278('0xf'));var Papa=require(_0x7278('0x10'));var Redis=require(_0x7278('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7278('0x12'));var as=require(_0x7278('0x13'));var hardwareService=require(_0x7278('0x14'));var logger=require('../../config/logger')(_0x7278('0x15'));var utils=require('../../config/utils');var config=require(_0x7278('0x16'));var licenseUtil=require(_0x7278('0x17'));var db=require(_0x7278('0x18'))['db'];function respondWithStatusCode(_0x404b51,_0x424548){_0x424548=_0x424548||0xcc;return function(_0x4788a4){if(_0x4788a4){return _0x404b51['sendStatus'](_0x424548);}return _0x404b51[_0x7278('0x19')](_0x424548)['end']();};}function respondWithResult(_0x21b9ea,_0x4c431b){_0x4c431b=_0x4c431b||0xc8;return function(_0x4b5356){if(_0x4b5356){return _0x21b9ea[_0x7278('0x19')](_0x4c431b)[_0x7278('0x1a')](_0x4b5356);}};}function respondWithFilteredResult(_0x3c10ae,_0x44f6b8){return function(_0x3c55c9){if(_0x3c55c9){var _0x368641=typeof _0x44f6b8['offset']===_0x7278('0x1b')&&typeof _0x44f6b8[_0x7278('0x1c')]===_0x7278('0x1b');var _0x5283f4=_0x3c55c9[_0x7278('0x1d')];var _0x919d62=_0x368641?0x0:_0x44f6b8['offset'];var _0x4188ff=_0x368641?_0x3c55c9[_0x7278('0x1d')]:_0x44f6b8[_0x7278('0x1e')]+_0x44f6b8[_0x7278('0x1c')];var _0x5d7b85;if(_0x4188ff>=_0x5283f4){_0x4188ff=_0x5283f4;_0x5d7b85=0xc8;}else{_0x5d7b85=0xce;}_0x3c10ae[_0x7278('0x19')](_0x5d7b85);return _0x3c10ae[_0x7278('0x1f')](_0x7278('0x20'),_0x919d62+'-'+_0x4188ff+'/'+_0x5283f4)[_0x7278('0x1a')](_0x3c55c9);}return null;};}function patchUpdates(_0x258853){return function(_0x595b6b){try{jsonpatch[_0x7278('0x21')](_0x595b6b,_0x258853,!![]);}catch(_0x380a35){return BPromise[_0x7278('0x22')](_0x380a35);}return _0x595b6b[_0x7278('0x23')]();};}function saveUpdates(_0x4fc0d4,_0x3ea92a){return function(_0x4289eb){if(_0x4289eb){return _0x4289eb['update'](_0x4fc0d4)['then'](function(_0x4daa96){return _0x4daa96;});}return null;};}function removeEntity(_0x982ae2,_0x9f3a3a){return function(_0x31be59){if(_0x31be59){return _0x31be59[_0x7278('0x24')]()['then'](function(){_0x982ae2[_0x7278('0x19')](0xcc)[_0x7278('0x25')]();});}};}function handleEntityNotFound(_0x57bcb1,_0x2f6804){return function(_0x1f9213){if(!_0x1f9213){_0x57bcb1[_0x7278('0x26')](0x194);}return _0x1f9213;};}function handleError(_0x13ffc4,_0x161a9f){_0x161a9f=_0x161a9f||0x1f4;return function(_0x2c3403){logger['error'](_0x2c3403[_0x7278('0x27')]);if(_0x2c3403[_0x7278('0x28')]){delete _0x2c3403['name'];}_0x13ffc4[_0x7278('0x19')](_0x161a9f)['send'](_0x2c3403);};}exports['index']=function(_0x4309b6,_0x10f11d){var _0x32f534={},_0x2e94bd={},_0x1cca94={'count':0x0,'rows':[]};var _0x2d0b18=_[_0x7278('0x29')](db[_0x7278('0x2a')][_0x7278('0x2b')],function(_0x10604e){return{'name':_0x10604e[_0x7278('0x2c')],'type':_0x10604e['type']['key']};});_0x2e94bd[_0x7278('0x2d')]=_[_0x7278('0x29')](_0x2d0b18,'name');_0x2e94bd[_0x7278('0x2e')]=_[_0x7278('0x2f')](_0x4309b6[_0x7278('0x2e')]);_0x2e94bd[_0x7278('0x30')]=_[_0x7278('0x31')](_0x2e94bd[_0x7278('0x2d')],_0x2e94bd['query']);_0x32f534['attributes']=_['intersection'](_0x2e94bd[_0x7278('0x2d')],qs['fields'](_0x4309b6[_0x7278('0x2e')]['fields']));_0x32f534[_0x7278('0x32')]=_0x32f534[_0x7278('0x32')][_0x7278('0x33')]?_0x32f534['attributes']:_0x2e94bd['model'];if(!_0x4309b6['query'][_0x7278('0x34')]('nolimit')){_0x32f534[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x1c')]);_0x32f534[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x1e')]);}_0x32f534[_0x7278('0x35')]=qs[_0x7278('0x36')](_0x4309b6[_0x7278('0x2e')][_0x7278('0x36')]);_0x32f534[_0x7278('0x37')]=qs[_0x7278('0x30')](_[_0x7278('0x38')](_0x4309b6[_0x7278('0x2e')],_0x2e94bd['filters']),_0x2d0b18);if(_0x4309b6['query'][_0x7278('0x39')]){_0x32f534[_0x7278('0x37')]=_[_0x7278('0x3a')](_0x32f534[_0x7278('0x37')],{'$or':_['map'](_0x2d0b18,function(_0x3f6621){if(_0x3f6621[_0x7278('0x3b')]!==_0x7278('0x3c')){var _0x530a92={};_0x530a92[_0x3f6621['name']]={'$like':'%'+_0x4309b6[_0x7278('0x2e')]['filter']+'%'};return _0x530a92;}})});}_0x32f534=_[_0x7278('0x3a')]({},_0x32f534,_0x4309b6[_0x7278('0x3d')]);var _0x4250dc={'where':_0x32f534[_0x7278('0x37')]};return db[_0x7278('0x2a')][_0x7278('0x1d')](_0x4250dc)[_0x7278('0x3e')](function(_0x2b5e26){_0x1cca94['count']=_0x2b5e26;if(_0x4309b6[_0x7278('0x2e')][_0x7278('0x3f')]){_0x32f534[_0x7278('0x40')]=[{'all':!![]}];}return db[_0x7278('0x2a')][_0x7278('0x41')](_0x32f534);})[_0x7278('0x3e')](function(_0xfa247a){_0x1cca94[_0x7278('0x42')]=_0xfa247a;return _0x1cca94;})['then'](respondWithFilteredResult(_0x10f11d,_0x32f534))[_0x7278('0x43')](handleError(_0x10f11d,null));};exports['show']=function(_0x363aca,_0x4caea1){var _0x58d882={'raw':![],'where':{'id':_0x363aca[_0x7278('0x44')]['id']}},_0x202faa={};_0x202faa[_0x7278('0x2d')]=_[_0x7278('0x2f')](db['Automation'][_0x7278('0x2b')]);_0x202faa[_0x7278('0x2e')]=_[_0x7278('0x2f')](_0x363aca[_0x7278('0x2e')]);_0x202faa[_0x7278('0x30')]=_[_0x7278('0x31')](_0x202faa[_0x7278('0x2d')],_0x202faa[_0x7278('0x2e')]);_0x58d882[_0x7278('0x32')]=_[_0x7278('0x31')](_0x202faa[_0x7278('0x2d')],qs[_0x7278('0x45')](_0x363aca[_0x7278('0x2e')][_0x7278('0x45')]));_0x58d882[_0x7278('0x32')]=_0x58d882['attributes'][_0x7278('0x33')]?_0x58d882[_0x7278('0x32')]:_0x202faa[_0x7278('0x2d')];if(_0x363aca[_0x7278('0x2e')][_0x7278('0x3f')]){_0x58d882['include']=[{'all':!![]}];}_0x58d882=_[_0x7278('0x3a')]({},_0x58d882,_0x363aca[_0x7278('0x3d')]);return db[_0x7278('0x2a')][_0x7278('0x46')](_0x58d882)['then'](handleEntityNotFound(_0x4caea1,null))[_0x7278('0x3e')](respondWithResult(_0x4caea1,null))[_0x7278('0x43')](handleError(_0x4caea1,null));};exports[_0x7278('0x47')]=function(_0x226a41,_0x2a50da){return db[_0x7278('0x2a')][_0x7278('0x47')](_0x226a41[_0x7278('0x48')],{})[_0x7278('0x3e')](respondWithResult(_0x2a50da,0xc9))['catch'](handleError(_0x2a50da,null));};exports[_0x7278('0x49')]=function(_0x515457,_0x2aaee5){if(_0x515457[_0x7278('0x48')]['id']){delete _0x515457['body']['id'];}return db[_0x7278('0x2a')][_0x7278('0x46')]({'where':{'id':_0x515457['params']['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x2aaee5,null))['then'](saveUpdates(_0x515457['body'],null))[_0x7278('0x3e')](respondWithResult(_0x2aaee5,null))['catch'](handleError(_0x2aaee5,null));};exports['destroy']=function(_0x1b3655,_0x146f9a){return db[_0x7278('0x2a')]['find']({'where':{'id':_0x1b3655[_0x7278('0x44')]['id']}})['then'](handleEntityNotFound(_0x146f9a,null))[_0x7278('0x3e')](removeEntity(_0x146f9a,null))[_0x7278('0x43')](handleError(_0x146f9a,null));};exports[_0x7278('0x4a')]=function(_0xf62cfe,_0x2c011b,_0x373af0){return db['Condition'][_0x7278('0x46')]({'where':{'id':_0xf62cfe['params']['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x2c011b,null))['then'](function(_0xe480c2){if(_0xe480c2){return _0xe480c2[_0x7278('0x4a')](_0xf62cfe[_0x7278('0x48')]['ids'],_[_0x7278('0x4b')](_0xf62cfe[_0x7278('0x48')],[_0x7278('0x4c'),'id'])||{});}})[_0x7278('0x3e')](respondWithResult(_0x2c011b,null))[_0x7278('0x43')](handleError(_0x2c011b,null));};exports[_0x7278('0x4d')]=function(_0x16913c,_0x339501,_0x59f7a4){var _0x2f85ca={};var _0x1ba7b4={};var _0xf93bc7;var _0x310ad3;return db[_0x7278('0x2a')]['findOne']({'where':{'id':_0x16913c[_0x7278('0x44')]['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x339501,null))['then'](function(_0x28b84e){if(_0x28b84e){_0xf93bc7=_0x28b84e;_0x1ba7b4[_0x7278('0x2d')]=_[_0x7278('0x2f')](db[_0x7278('0x4e')]['rawAttributes']);_0x1ba7b4['query']=_[_0x7278('0x2f')](_0x16913c['query']);_0x1ba7b4[_0x7278('0x30')]=_[_0x7278('0x31')](_0x1ba7b4[_0x7278('0x2d')],_0x1ba7b4['query']);_0x2f85ca[_0x7278('0x32')]=_[_0x7278('0x31')](_0x1ba7b4['model'],qs[_0x7278('0x45')](_0x16913c[_0x7278('0x2e')][_0x7278('0x45')]));_0x2f85ca[_0x7278('0x32')]=_0x2f85ca[_0x7278('0x32')][_0x7278('0x33')]?_0x2f85ca[_0x7278('0x32')]:_0x1ba7b4[_0x7278('0x2d')];_0x2f85ca[_0x7278('0x35')]=qs[_0x7278('0x36')](_0x16913c[_0x7278('0x2e')][_0x7278('0x36')]);_0x2f85ca[_0x7278('0x37')]=qs[_0x7278('0x30')](_[_0x7278('0x38')](_0x16913c['query'],_0x1ba7b4[_0x7278('0x30')]));if(_0x16913c[_0x7278('0x2e')][_0x7278('0x39')]){_0x2f85ca['where']=_[_0x7278('0x3a')](_0x2f85ca[_0x7278('0x37')],{'$or':_[_0x7278('0x29')](_0x2f85ca[_0x7278('0x32')],function(_0xabe7e9){var _0x3c22e4={};_0x3c22e4[_0xabe7e9]={'$like':'%'+_0x16913c[_0x7278('0x2e')][_0x7278('0x39')]+'%'};return _0x3c22e4;})});}_0x2f85ca=_[_0x7278('0x3a')]({},_0x2f85ca,_0x16913c['options']);return _0xf93bc7['getConditions'](_0x2f85ca);}})['then'](function(_0x358486){if(_0x358486){_0x310ad3=_0x358486[_0x7278('0x33')];if(!_0x16913c[_0x7278('0x2e')]['hasOwnProperty'](_0x7278('0x4f'))){_0x2f85ca[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x16913c['query']['limit']);_0x2f85ca[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x16913c['query'][_0x7278('0x1e')]);}return _0xf93bc7[_0x7278('0x4d')](_0x2f85ca);}})[_0x7278('0x3e')](function(_0xf1945){if(_0xf1945){return _0xf1945?{'count':_0x310ad3,'rows':_0xf1945}:null;}})['then'](respondWithResult(_0x339501,null))[_0x7278('0x43')](handleError(_0x339501,null));};exports[_0x7278('0x50')]=function(_0x2bc5b1,_0x1cc45e,_0x30e527){return db[_0x7278('0x51')][_0x7278('0x46')]({'where':{'id':_0x2bc5b1[_0x7278('0x44')]['id']}})[_0x7278('0x3e')](handleEntityNotFound(_0x1cc45e,null))[_0x7278('0x3e')](function(_0x41b79d){if(_0x41b79d){return _0x41b79d[_0x7278('0x50')](_0x2bc5b1[_0x7278('0x48')][_0x7278('0x4c')],_[_0x7278('0x4b')](_0x2bc5b1[_0x7278('0x48')],[_0x7278('0x4c'),'id'])||{});}})[_0x7278('0x3e')](respondWithResult(_0x1cc45e,null))[_0x7278('0x43')](handleError(_0x1cc45e,null));};exports[_0x7278('0x52')]=function(_0x5318ac,_0x1fc564,_0x24bb5a){var _0x32cf55={};var _0x4999fe={};var _0x34695e;var _0x18c740;return db[_0x7278('0x2a')][_0x7278('0x53')]({'where':{'id':_0x5318ac[_0x7278('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fc564,null))[_0x7278('0x3e')](function(_0x2c1217){if(_0x2c1217){_0x34695e=_0x2c1217;_0x4999fe[_0x7278('0x2d')]=_['keys'](db[_0x7278('0x51')]['rawAttributes']);_0x4999fe['query']=_['keys'](_0x5318ac[_0x7278('0x2e')]);_0x4999fe[_0x7278('0x30')]=_[_0x7278('0x31')](_0x4999fe['model'],_0x4999fe[_0x7278('0x2e')]);_0x32cf55['attributes']=_[_0x7278('0x31')](_0x4999fe[_0x7278('0x2d')],qs[_0x7278('0x45')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x45')]));_0x32cf55[_0x7278('0x32')]=_0x32cf55[_0x7278('0x32')][_0x7278('0x33')]?_0x32cf55[_0x7278('0x32')]:_0x4999fe['model'];_0x32cf55['order']=qs[_0x7278('0x36')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x36')]);_0x32cf55[_0x7278('0x37')]=qs[_0x7278('0x30')](_['pick'](_0x5318ac[_0x7278('0x2e')],_0x4999fe[_0x7278('0x30')]));if(_0x5318ac[_0x7278('0x2e')][_0x7278('0x39')]){_0x32cf55[_0x7278('0x37')]=_['merge'](_0x32cf55['where'],{'$or':_[_0x7278('0x29')](_0x32cf55['attributes'],function(_0x58ec93){var _0x1a4d63={};_0x1a4d63[_0x58ec93]={'$like':'%'+_0x5318ac[_0x7278('0x2e')][_0x7278('0x39')]+'%'};return _0x1a4d63;})});}_0x32cf55=_[_0x7278('0x3a')]({},_0x32cf55,_0x5318ac[_0x7278('0x3d')]);return _0x34695e[_0x7278('0x52')](_0x32cf55);}})[_0x7278('0x3e')](function(_0x5ab7af){if(_0x5ab7af){_0x18c740=_0x5ab7af['length'];if(!_0x5318ac['query'][_0x7278('0x34')](_0x7278('0x4f'))){_0x32cf55[_0x7278('0x1c')]=qs[_0x7278('0x1c')](_0x5318ac[_0x7278('0x2e')]['limit']);_0x32cf55[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x5318ac[_0x7278('0x2e')][_0x7278('0x1e')]);}return _0x34695e['getActions'](_0x32cf55);}})[_0x7278('0x3e')](function(_0x3d6693){if(_0x3d6693){return _0x3d6693?{'count':_0x18c740,'rows':_0x3d6693}:null;}})[_0x7278('0x3e')](respondWithResult(_0x1fc564,null))[_0x7278('0x43')](handleError(_0x1fc564,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 499d299..57c2682 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 _0xbe9d=['request-promise','path','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger'];(function(_0x12b580,_0xb50037){var _0x2b7809=function(_0x306334){while(--_0x306334){_0x12b580['push'](_0x12b580['shift']());}};_0x2b7809(++_0xb50037);}(_0xbe9d,0x1da));var _0xdbe9=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xbe9d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var logger=require(_0xdbe9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdbe9('0x3'));var fs=require('fs');var path=require(_0xdbe9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdbe9('0x5'));module[_0xdbe9('0x6')]=function(_0x174735,_0x5145ce){return _0x174735[_0xdbe9('0x7')](_0xdbe9('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb37a=['exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes'];(function(_0x35bf7c,_0x3b27bc){var _0x2c9413=function(_0x547185){while(--_0x547185){_0x35bf7c['push'](_0x35bf7c['shift']());}};_0x2c9413(++_0x3b27bc);}(_0xb37a,0x12f));var _0xab37=function(_0x2a8811,_0x281afa){_0x2a8811=_0x2a8811-0x0;var _0x312324=_0xb37a[_0x2a8811];return _0x312324;};'use strict';var _=require(_0xab37('0x0'));var util=require(_0xab37('0x1'));var logger=require('../../config/logger')(_0xab37('0x2'));var moment=require(_0xab37('0x3'));var BPromise=require(_0xab37('0x4'));var rp=require(_0xab37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab37('0x6'));var config=require(_0xab37('0x7'));var attributes=require(_0xab37('0x8'));module[_0xab37('0x9')]=function(_0x212896,_0x1e3df6){return _0x212896[_0xab37('0xa')](_0xab37('0xb'),attributes,{'tableName':_0xab37('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 5d7b46e..f4341be 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 _0x6302=['moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0x6302,0x109));var _0x2630=function(_0x3cfd46,_0x51c2eb){_0x3cfd46=_0x3cfd46-0x0;var _0x2e182c=_0x6302[_0x3cfd46];return _0x2e182c;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2867f8,_0x19231a,_0x2e1867){return new BPromise(function(_0x353f73,_0x581f4d){return client['request'](_0x2867f8,_0x2e1867)[_0x2630('0x9')](function(_0x10ffdf){logger['info'](_0x2630('0xa'),_0x19231a,'request\x20sent');logger[_0x2630('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x19231a,_0x2630('0xc'),JSON[_0x2630('0xd')](_0x10ffdf));if(_0x10ffdf[_0x2630('0xe')]){if(_0x10ffdf[_0x2630('0xe')][_0x2630('0xf')]===0x1f4){logger[_0x2630('0xe')]('Automation,\x20%s,\x20%s',_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x581f4d(_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);}logger['error'](_0x2630('0xa'),_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x353f73(_0x10ffdf['error'][_0x2630('0x10')]);}else{logger['info'](_0x2630('0xa'),_0x19231a,_0x2630('0xc'));_0x353f73(_0x10ffdf[_0x2630('0x11')][_0x2630('0x10')]);}})[_0x2630('0x12')](function(_0x18b2b0){logger[_0x2630('0xe')](_0x2630('0xa'),_0x19231a,_0x18b2b0);_0x581f4d(_0x18b2b0);});});} \ No newline at end of file +var _0x866a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x278e39,_0x379ba4){var _0x211e88=function(_0x38bdfa){while(--_0x38bdfa){_0x278e39['push'](_0x278e39['shift']());}};_0x211e88(++_0x379ba4);}(_0x866a,0x156));var _0xa866=function(_0x1b3a9e,_0x3b6e29){_0x1b3a9e=_0x1b3a9e-0x0;var _0x53cdc2=_0x866a[_0x1b3a9e];return _0x53cdc2;};'use strict';var _=require('lodash');var util=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));var BPromise=require(_0xa866('0x2'));var rs=require(_0xa866('0x3'));var fs=require('fs');var Redis=require(_0xa866('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa866('0x5'));var logger=require(_0xa866('0x6'))(_0xa866('0x7'));var config=require('../../config/environment');var jayson=require(_0xa866('0x8'));var client=jayson[_0xa866('0x9')][_0xa866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288582,_0x3d1380,_0x2c7278){return new BPromise(function(_0x41a92a,_0x208625){return client[_0xa866('0xb')](_0x288582,_0x2c7278)[_0xa866('0xc')](function(_0x525ce6){logger[_0xa866('0xd')](_0xa866('0xe'),_0x3d1380,_0xa866('0xf'));logger['debug'](_0xa866('0x10'),_0x3d1380,_0xa866('0xf'),JSON[_0xa866('0x11')](_0x525ce6));if(_0x525ce6[_0xa866('0x12')]){if(_0x525ce6[_0xa866('0x12')][_0xa866('0x13')]===0x1f4){logger['error'](_0xa866('0xe'),_0x3d1380,_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);return _0x208625(_0x525ce6[_0xa866('0x12')]['message']);}logger[_0xa866('0x12')]('Automation,\x20%s,\x20%s',_0x3d1380,_0x525ce6[_0xa866('0x12')]['message']);return _0x41a92a(_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);}else{logger[_0xa866('0xd')]('Automation,\x20%s,\x20%s',_0x3d1380,_0xa866('0xf'));_0x41a92a(_0x525ce6[_0xa866('0x15')][_0xa866('0x14')]);}})[_0xa866('0x16')](function(_0x1e2211){logger[_0xa866('0x12')](_0xa866('0xe'),_0x3d1380,_0x1e2211);_0x208625(_0x1e2211);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0702503..dbdb30f 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 _0x1a6b=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','addConditions','/:id/actions','put','delete','/:id'];(function(_0x54128a,_0x128d4d){var _0x6b9354=function(_0x21e0b8){while(--_0x21e0b8){_0x54128a['push'](_0x54128a['shift']());}};_0x6b9354(++_0x128d4d);}(_0x1a6b,0x94));var _0xb1a6=function(_0x2d6cf6,_0xb6ac1f){_0x2d6cf6=_0x2d6cf6-0x0;var _0x50078e=_0x1a6b[_0x2d6cf6];return _0x50078e;};'use strict';var multer=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var path=require(_0xb1a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1a6('0x3'));var router=express[_0xb1a6('0x4')]();var fs_extra=require(_0xb1a6('0x5'));var auth=require(_0xb1a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1a6('0x7'));var controller=require('./automation.controller');router[_0xb1a6('0x8')]('/',auth[_0xb1a6('0x9')](),controller['index']);router[_0xb1a6('0x8')]('/:id',auth[_0xb1a6('0x9')](),controller[_0xb1a6('0xa')]);router['get'](_0xb1a6('0xb'),auth[_0xb1a6('0x9')](),controller[_0xb1a6('0xc')]);router[_0xb1a6('0x8')]('/:id/actions',auth[_0xb1a6('0x9')](),controller[_0xb1a6('0xd')]);router[_0xb1a6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/conditions',auth[_0xb1a6('0x9')](),controller[_0xb1a6('0xf')]);router['post'](_0xb1a6('0x10'),auth['isAuthenticated'](),controller['addActions']);router[_0xb1a6('0x11')]('/:id',auth[_0xb1a6('0x9')](),controller['update']);router[_0xb1a6('0x12')](_0xb1a6('0x13'),auth[_0xb1a6('0x9')](),controller['destroy']);module[_0xb1a6('0x14')]=router; \ No newline at end of file +var _0xd730=['get','/:id/actions','post','create','/:id/conditions','addConditions','addActions','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id','show'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xd730,0xfd));var _0x0d73=function(_0x26a846,_0x261438){_0x26a846=_0x26a846-0x0;var _0x286a31=_0xd730[_0x26a846];return _0x286a31;};'use strict';var multer=require('multer');var util=require(_0x0d73('0x0'));var path=require('path');var timeout=require(_0x0d73('0x1'));var express=require('express');var router=express[_0x0d73('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0d73('0x3'));var interaction=require(_0x0d73('0x4'));var config=require(_0x0d73('0x5'));var controller=require(_0x0d73('0x6'));router['get']('/',auth[_0x0d73('0x7')](),controller[_0x0d73('0x8')]);router['get'](_0x0d73('0x9'),auth['isAuthenticated'](),controller[_0x0d73('0xa')]);router['get']('/:id/conditions',auth[_0x0d73('0x7')](),controller['getConditions']);router[_0x0d73('0xb')](_0x0d73('0xc'),auth[_0x0d73('0x7')](),controller['getActions']);router[_0x0d73('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d73('0xe')]);router[_0x0d73('0xd')](_0x0d73('0xf'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x10')]);router[_0x0d73('0xd')](_0x0d73('0xc'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x11')]);router[_0x0d73('0x12')](_0x0d73('0x9'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x13')]);router['delete'](_0x0d73('0x9'),auth[_0x0d73('0x7')](),controller[_0x0d73('0x14')]);module[_0x0d73('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index b3d332a..e44c451 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 _0x353f=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','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)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x353f,0x1d7));var _0xf353=function(_0xe5742c,_0x11503e){_0xe5742c=_0xe5742c-0x0;var _0x3db329=_0x353f[_0xe5742c];return _0x3db329;};'use strict';var Sequelize=require('sequelize');module[_0xf353('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf353('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf353('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xf353('0x3')},'description':{'type':Sequelize[_0xf353('0x4')]},'active':{'type':Sequelize[_0xf353('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xf353('0x6')](0x4)[_0xf353('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf353('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf353('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf353('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf353('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf353('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf353('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf353('0x6')](0x3)[_0xf353('0x7')],'defaultValue':0x3,'comment':_0xf353('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf353('0x6')](0x3)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf353('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf353('0x4')],'defaultValue':_0xf353('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xf353('0x2')](_0xf353('0x10'),_0xf353('0x11'),_0xf353('0x12')),'defaultValue':_0xf353('0x10')},'dialAMDActive':{'type':Sequelize[_0xf353('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf353('0x6')](0x9)[_0xf353('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf353('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xf353('0x6')](0x9)[_0xf353('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf353('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf353('0x6')](0x9)[_0xf353('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf353('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf353('0x6')](0x9)[_0xf353('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf353('0x6')](0x9)[_0xf353('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf353('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf353('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf353('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf353('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xf353('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf353('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf353('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf353('0x19'),_0xf353('0x1a')),'defaultValue':_0xf353('0x19')},'dialPrefix':{'type':Sequelize[_0xf353('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf353('0x6')](0x3)[_0xf353('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf353('0x1b')},'dialCutDigit':{'type':Sequelize[_0xf353('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf353('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf353('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf353('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf353('0x6')](0x3)[_0xf353('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf353('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xf353('0x6')](0x3)[_0xf353('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf353('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf353('0x6')](0x5)[_0xf353('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf353('0x22')}}; \ No newline at end of file +var _0x1071=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\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'];(function(_0xb113d7,_0x2fc306){var _0xd5a08d=function(_0x873634){while(--_0x873634){_0xb113d7['push'](_0xb113d7['shift']());}};_0xd5a08d(++_0x2fc306);}(_0x1071,0xde));var _0x1107=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1071[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x1107('0x0')]={'name':{'type':Sequelize[_0x1107('0x1')],'unique':_0x1107('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1107('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x1107('0x4')},'description':{'type':Sequelize[_0x1107('0x1')]},'active':{'type':Sequelize[_0x1107('0x5')],'defaultValue':0x0,'comment':_0x1107('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1107('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1107('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1107('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'comment':_0x1107('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1107('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1107('0x1')],'defaultValue':_0x1107('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1107('0x3')](_0x1107('0xf'),_0x1107('0x10'),_0x1107('0x11')),'defaultValue':_0x1107('0xf')},'dialAMDActive':{'type':Sequelize[_0x1107('0x5')],'defaultValue':0x0,'comment':_0x1107('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x1107('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1107('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1107('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1107('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1107('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1107('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1107('0x9')](0x9)[_0x1107('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1107('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1107('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1107('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1107('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1107('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1107('0x3')](_0x1107('0x1b'),_0x1107('0x1c')),'defaultValue':_0x1107('0x1b')},'dialPrefix':{'type':Sequelize[_0x1107('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1107('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1107('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1107('0x9')](0x3)[_0x1107('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1107('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1107('0x9')](0x5)[_0x1107('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1107('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c141de8..bbe467c 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 _0x173d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','get','name','send','index','map','Campaign','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','options','include','findAll','rows','catch','params','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','updatedAt','createdAt','user','UserProfileSection','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','onlyIfOpen','ContactId','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','cmHopperId','ci.OrderBY','OrderBy','cm_contact_has_items','h.ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3418cf,_0x24b5b9){var _0x323adc=function(_0x92fe0b){while(--_0x92fe0b){_0x3418cf['push'](_0x3418cf['shift']());}};_0x323adc(++_0x24b5b9);}(_0x173d,0x108));var _0xd173=function(_0x3c54e4,_0x20a60d){_0x3c54e4=_0x3c54e4-0x0;var _0x207495=_0x173d[_0x3c54e4];return _0x207495;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd173('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd173('0x1'));var moment=require('moment');var BPromise=require(_0xd173('0x2'));var Mustache=require(_0xd173('0x3'));var util=require(_0xd173('0x4'));var path=require(_0xd173('0x5'));var sox=require(_0xd173('0x6'));var csv=require('to-csv');var ejs=require(_0xd173('0x7'));var fs=require('fs');var fs_extra=require(_0xd173('0x8'));var _=require(_0xd173('0x9'));var squel=require('squel');var crypto=require(_0xd173('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd173('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd173('0xc'));var Redis=require(_0xd173('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd173('0xe'));var as=require(_0xd173('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd173('0x10'))(_0xd173('0x11'));var utils=require(_0xd173('0x12'));var config=require(_0xd173('0x13'));var licenseUtil=require(_0xd173('0x14'));var db=require(_0xd173('0x15'))['db'];function respondWithStatusCode(_0x2a7c1d,_0x37b65a){_0x37b65a=_0x37b65a||0xcc;return function(_0x371826){if(_0x371826){return _0x2a7c1d[_0xd173('0x16')](_0x37b65a);}return _0x2a7c1d[_0xd173('0x17')](_0x37b65a)[_0xd173('0x18')]();};}function respondWithResult(_0x57d8f7,_0x29ddae){_0x29ddae=_0x29ddae||0xc8;return function(_0x5e4a79){if(_0x5e4a79){return _0x57d8f7[_0xd173('0x17')](_0x29ddae)[_0xd173('0x19')](_0x5e4a79);}};}function respondWithFilteredResult(_0x5cf801,_0x1093dc){return function(_0x26859a){if(_0x26859a){var _0x100602=typeof _0x1093dc[_0xd173('0x1a')]==='undefined'&&typeof _0x1093dc['limit']===_0xd173('0x1b');var _0x18a0c6=_0x26859a[_0xd173('0x1c')];var _0x58d7d8=_0x100602?0x0:_0x1093dc[_0xd173('0x1a')];var _0x352d17=_0x100602?_0x26859a[_0xd173('0x1c')]:_0x1093dc[_0xd173('0x1a')]+_0x1093dc['limit'];var _0x4aef50;if(_0x352d17>=_0x18a0c6){_0x352d17=_0x18a0c6;_0x4aef50=0xc8;}else{_0x4aef50=0xce;}_0x5cf801[_0xd173('0x17')](_0x4aef50);return _0x5cf801[_0xd173('0x1d')](_0xd173('0x1e'),_0x58d7d8+'-'+_0x352d17+'/'+_0x18a0c6)[_0xd173('0x19')](_0x26859a);}return null;};}function patchUpdates(_0x58e9ff){return function(_0x55727c){try{jsonpatch[_0xd173('0x1f')](_0x55727c,_0x58e9ff,!![]);}catch(_0xbe4fb4){return BPromise['reject'](_0xbe4fb4);}return _0x55727c[_0xd173('0x20')]();};}function saveUpdates(_0x3b30f7,_0x5164c2){return function(_0xb729d9){if(_0xb729d9){return _0xb729d9[_0xd173('0x21')](_0x3b30f7)['then'](function(_0xc23357){return _0xc23357;});}return null;};}function removeEntity(_0x115975,_0x564127){return function(_0x4396ad){if(_0x4396ad){return _0x4396ad[_0xd173('0x22')]()[_0xd173('0x23')](function(){var _0x42d140=_0x4396ad[_0xd173('0x24')]({'plain':!![]});var _0x10e966='IvrCampaigns';return db['UserProfileResource'][_0xd173('0x22')]({'where':{'type':_0x10e966,'resourceId':_0x42d140['id']}})[_0xd173('0x23')](function(){return _0x4396ad;});})[_0xd173('0x23')](function(){_0x115975[_0xd173('0x17')](0xcc)[_0xd173('0x18')]();});}};}function handleEntityNotFound(_0x378a07,_0x240e01){return function(_0x4191e2){if(!_0x4191e2){_0x378a07['sendStatus'](0x194);}return _0x4191e2;};}function handleError(_0x54ab40,_0xffaa27){_0xffaa27=_0xffaa27||0x1f4;return function(_0x15035c){logger['error'](_0x15035c['stack']);if(_0x15035c[_0xd173('0x25')]){delete _0x15035c[_0xd173('0x25')];}_0x54ab40[_0xd173('0x17')](_0xffaa27)[_0xd173('0x26')](_0x15035c);};}exports[_0xd173('0x27')]=function(_0x9bd71a,_0x5172be){var _0x5a56e0={},_0x142273={},_0x3b034b={'count':0x0,'rows':[]};var _0x49c73b=_[_0xd173('0x28')](db[_0xd173('0x29')][_0xd173('0x2a')],function(_0x2705e7){return{'name':_0x2705e7[_0xd173('0x2b')],'type':_0x2705e7['type'][_0xd173('0x2c')]};});_0x142273['model']=_[_0xd173('0x28')](_0x49c73b,_0xd173('0x25'));_0x142273['query']=_[_0xd173('0x2d')](_0x9bd71a[_0xd173('0x2e')]);_0x142273[_0xd173('0x2f')]=_[_0xd173('0x30')](_0x142273[_0xd173('0x31')],_0x142273['query']);_0x5a56e0[_0xd173('0x32')]=_[_0xd173('0x30')](_0x142273[_0xd173('0x31')],qs[_0xd173('0x33')](_0x9bd71a[_0xd173('0x2e')][_0xd173('0x33')]));_0x5a56e0['attributes']=_0x5a56e0[_0xd173('0x32')][_0xd173('0x34')]?_0x5a56e0[_0xd173('0x32')]:_0x142273['model'];if(!_0x9bd71a['query'][_0xd173('0x35')](_0xd173('0x36'))){_0x5a56e0[_0xd173('0x37')]=qs['limit'](_0x9bd71a[_0xd173('0x2e')][_0xd173('0x37')]);_0x5a56e0[_0xd173('0x1a')]=qs[_0xd173('0x1a')](_0x9bd71a[_0xd173('0x2e')]['offset']);}_0x5a56e0[_0xd173('0x38')]=qs['sort'](_0x9bd71a[_0xd173('0x2e')][_0xd173('0x39')]);_0x5a56e0[_0xd173('0x3a')]=qs['filters'](_['pick'](_0x9bd71a[_0xd173('0x2e')],_0x142273['filters']),_0x49c73b);if(_0x9bd71a[_0xd173('0x2e')][_0xd173('0x3b')]){_0x5a56e0['where']=_['merge'](_0x5a56e0[_0xd173('0x3a')],{'$or':_[_0xd173('0x28')](_0x49c73b,function(_0x3d469a){if(_0x3d469a[_0xd173('0x3c')]!==_0xd173('0x3d')){var _0x17696a={};_0x17696a[_0x3d469a[_0xd173('0x25')]]={'$like':'%'+_0x9bd71a[_0xd173('0x2e')][_0xd173('0x3b')]+'%'};return _0x17696a;}})});}_0x5a56e0=_['merge']({},_0x5a56e0,_0x9bd71a[_0xd173('0x3e')]);var _0x563dd9={'where':_0x5a56e0[_0xd173('0x3a')]};return db[_0xd173('0x29')][_0xd173('0x1c')](_0x563dd9)[_0xd173('0x23')](function(_0x4610ad){_0x3b034b['count']=_0x4610ad;if(_0x9bd71a['query']['includeAll']){_0x5a56e0[_0xd173('0x3f')]=[{'all':!![]}];}return db[_0xd173('0x29')][_0xd173('0x40')](_0x5a56e0);})[_0xd173('0x23')](function(_0x38907d){_0x3b034b[_0xd173('0x41')]=_0x38907d;return _0x3b034b;})[_0xd173('0x23')](respondWithFilteredResult(_0x5172be,_0x5a56e0))[_0xd173('0x42')](handleError(_0x5172be,null));};exports['show']=function(_0x47fe20,_0x2716cb){var _0x240c47={'raw':![],'where':{'id':_0x47fe20[_0xd173('0x43')]['id']}},_0x2c1421={};_0x2c1421[_0xd173('0x31')]=_[_0xd173('0x2d')](db[_0xd173('0x29')][_0xd173('0x2a')]);_0x2c1421['query']=_[_0xd173('0x2d')](_0x47fe20['query']);_0x2c1421[_0xd173('0x2f')]=_['intersection'](_0x2c1421[_0xd173('0x31')],_0x2c1421[_0xd173('0x2e')]);_0x240c47['attributes']=_[_0xd173('0x30')](_0x2c1421[_0xd173('0x31')],qs[_0xd173('0x33')](_0x47fe20[_0xd173('0x2e')][_0xd173('0x33')]));_0x240c47[_0xd173('0x32')]=_0x240c47[_0xd173('0x32')]['length']?_0x240c47['attributes']:_0x2c1421[_0xd173('0x31')];if(_0x47fe20[_0xd173('0x2e')]['includeAll']){_0x240c47[_0xd173('0x3f')]=[{'all':!![]}];}_0x240c47=_[_0xd173('0x44')]({},_0x240c47,_0x47fe20[_0xd173('0x3e')]);return db[_0xd173('0x29')][_0xd173('0x45')](_0x240c47)['then'](handleEntityNotFound(_0x2716cb,null))[_0xd173('0x23')](respondWithResult(_0x2716cb,null))[_0xd173('0x42')](handleError(_0x2716cb,null));};exports[_0xd173('0x46')]=function(_0xdf7c4f,_0x350944){return db['Campaign'][_0xd173('0x46')](_0xdf7c4f[_0xd173('0x47')],{})['then'](function(_0x385c91){var _0x45338a=_0xdf7c4f['user'][_0xd173('0x24')]({'plain':!![]});if(!_0x45338a)throw new Error(_0xd173('0x48'));if(_0x45338a[_0xd173('0x49')]==='user'){var _0x26f369=_0x385c91[_0xd173('0x24')]({'plain':!![]});var _0x4c871c=_0xd173('0x4a');return db['UserProfileSection'][_0xd173('0x45')]({'where':{'name':_0x4c871c,'userProfileId':_0x45338a[_0xd173('0x4b')]},'raw':!![]})[_0xd173('0x23')](function(_0x472b57){if(_0x472b57&&_0x472b57[_0xd173('0x4c')]===0x0){return db[_0xd173('0x4d')][_0xd173('0x46')]({'name':_0x26f369[_0xd173('0x25')],'resourceId':_0x26f369['id'],'type':_0x472b57[_0xd173('0x25')],'sectionId':_0x472b57['id']},{})[_0xd173('0x23')](function(){return _0x385c91;});}else{return _0x385c91;}})[_0xd173('0x42')](function(_0x29988b){logger[_0xd173('0x4e')](_0xd173('0x4f'),_0x29988b);throw _0x29988b;});}return _0x385c91;})[_0xd173('0x23')](respondWithResult(_0x350944,0xc9))[_0xd173('0x42')](handleError(_0x350944,null));};exports[_0xd173('0x50')]=function(_0x30e863,_0x1c5be7){var _0x3861a4={'where':{'id':_0x30e863[_0xd173('0x43')]['id']}},_0x401ac5={};_0x401ac5[_0xd173('0x31')]=_['keys'](db[_0xd173('0x29')][_0xd173('0x2a')]);_0x3861a4['attributes']=_[_0xd173('0x30')](_0x401ac5['model'],qs[_0xd173('0x33')](_0x30e863[_0xd173('0x2e')][_0xd173('0x33')]));_0x3861a4[_0xd173('0x32')]=_0x3861a4[_0xd173('0x32')][_0xd173('0x34')]?_0x3861a4[_0xd173('0x32')]:_0x401ac5['model'];if(_0x30e863['query'][_0xd173('0x51')]){_0x3861a4[_0xd173('0x3f')]=[{'all':!![]}];}_0x3861a4=_[_0xd173('0x44')]({},_0x3861a4,_0x30e863['options']);return db[_0xd173('0x29')][_0xd173('0x45')](_0x3861a4)[_0xd173('0x23')](handleEntityNotFound(_0x1c5be7,null))[_0xd173('0x23')](function(_0x3789b8){if(_0x3789b8){var _0x36b2a8=_0x3789b8[_0xd173('0x24')]({'plain':!![]});_0x36b2a8=qs[_0xd173('0x52')](_0x36b2a8,['id','createdAt',_0xd173('0x53')]);_0x30e863[_0xd173('0x47')]=_[_0xd173('0x52')](_0x30e863[_0xd173('0x47')],['id',_0xd173('0x54'),_0xd173('0x53')]);return db[_0xd173('0x29')]['create'](_[_0xd173('0x44')](_0x36b2a8,_0x30e863[_0xd173('0x47')]),{'include':_0x30e863[_0xd173('0x2e')][_0xd173('0x51')]?[{'all':!![]}]:undefined})[_0xd173('0x23')](function(_0x1b7b77){var _0x13ad8b=_0x30e863[_0xd173('0x55')]['get']({'plain':!![]});if(!_0x13ad8b)throw new Error(_0xd173('0x48'));if(_0x13ad8b['role']===_0xd173('0x55')){var _0x23c8c3=_0x1b7b77[_0xd173('0x24')]({'plain':!![]});var _0x49cfb4=_0xd173('0x4a');return db[_0xd173('0x56')][_0xd173('0x45')]({'where':{'name':_0x49cfb4,'userProfileId':_0x13ad8b[_0xd173('0x4b')]},'raw':!![]})[_0xd173('0x23')](function(_0x3336aa){if(_0x3336aa&&_0x3336aa['autoAssociation']===0x0){return db[_0xd173('0x4d')][_0xd173('0x46')]({'name':_0x23c8c3[_0xd173('0x25')],'resourceId':_0x23c8c3['id'],'type':_0x3336aa[_0xd173('0x25')],'sectionId':_0x3336aa['id']},{})['then'](function(){return _0x1b7b77;});}else{return _0x1b7b77;}})[_0xd173('0x42')](function(_0xecdf04){logger[_0xd173('0x4e')](_0xd173('0x4f'),_0xecdf04);throw _0xecdf04;});}return _0x1b7b77;});}})[_0xd173('0x23')](respondWithResult(_0x1c5be7,0xc9))[_0xd173('0x42')](handleError(_0x1c5be7,null));};exports[_0xd173('0x21')]=function(_0x521421,_0x4256aa){if(_0x521421[_0xd173('0x47')]['id']){delete _0x521421[_0xd173('0x47')]['id'];}return db[_0xd173('0x29')][_0xd173('0x45')]({'where':{'id':_0x521421[_0xd173('0x43')]['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x4256aa,null))[_0xd173('0x23')](saveUpdates(_0x521421['body'],null))[_0xd173('0x23')](respondWithResult(_0x4256aa,null))['catch'](handleError(_0x4256aa,null));};exports['destroy']=function(_0x49faac,_0x345cb3){return db[_0xd173('0x29')][_0xd173('0x45')]({'where':{'id':_0x49faac[_0xd173('0x43')]['id']}})['then'](handleEntityNotFound(_0x345cb3,null))['then'](removeEntity(_0x345cb3,null))[_0xd173('0x42')](handleError(_0x345cb3,null));};exports['getHoppers']=function(_0x3d6111,_0x393cb8,_0x502d0b){var _0x21902b={'raw':!![],'where':{}};var _0xf70f06={};var _0x1d06d4={'count':0x0,'rows':[]};return db[_0xd173('0x29')][_0xd173('0x57')]({'where':{'id':_0x3d6111[_0xd173('0x43')]['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x393cb8,null))[_0xd173('0x23')](function(_0x3a0126){if(_0x3a0126){_0xf70f06[_0xd173('0x31')]=_[_0xd173('0x2d')](db[_0xd173('0x58')][_0xd173('0x2a')]);_0xf70f06[_0xd173('0x2e')]=_[_0xd173('0x2d')](_0x3d6111[_0xd173('0x2e')]);_0xf70f06[_0xd173('0x2f')]=_[_0xd173('0x30')](_0xf70f06[_0xd173('0x31')],_0xf70f06[_0xd173('0x2e')]);_0x21902b[_0xd173('0x32')]=_[_0xd173('0x30')](_0xf70f06[_0xd173('0x31')],qs['fields'](_0x3d6111[_0xd173('0x2e')][_0xd173('0x33')]));_0x21902b[_0xd173('0x32')]=_0x21902b[_0xd173('0x32')]['length']?_0x21902b[_0xd173('0x32')]:_0xf70f06[_0xd173('0x31')];if(!_0x3d6111[_0xd173('0x2e')]['hasOwnProperty']('nolimit')){_0x21902b['limit']=qs[_0xd173('0x37')](_0x3d6111[_0xd173('0x2e')][_0xd173('0x37')]);_0x21902b[_0xd173('0x1a')]=qs[_0xd173('0x1a')](_0x3d6111['query'][_0xd173('0x1a')]);}_0x21902b[_0xd173('0x38')]=qs[_0xd173('0x39')](_0x3d6111[_0xd173('0x2e')][_0xd173('0x39')]);_0x21902b[_0xd173('0x3a')]=qs[_0xd173('0x2f')](_[_0xd173('0x59')](_0x3d6111[_0xd173('0x2e')],_0xf70f06[_0xd173('0x2f')]));_0x21902b[_0xd173('0x3a')][_0xd173('0x5a')]=_0x3a0126['id'];if(_0x3d6111['query'][_0xd173('0x3b')]){_0x21902b[_0xd173('0x3a')]=_[_0xd173('0x44')](_0x21902b[_0xd173('0x3a')],{'$or':_['map'](_0x21902b[_0xd173('0x32')],function(_0x11a019){var _0x2fbd96={};_0x2fbd96[_0x11a019]={'$like':'%'+_0x3d6111[_0xd173('0x2e')][_0xd173('0x3b')]+'%'};return _0x2fbd96;})});}_0x21902b=_['merge']({},_0x21902b,_0x3d6111[_0xd173('0x3e')]);return db[_0xd173('0x58')][_0xd173('0x1c')]({'where':_0x21902b['where']})['then'](function(_0x45388f){_0x1d06d4[_0xd173('0x1c')]=_0x45388f;if(_0x3d6111[_0xd173('0x2e')]['includeAll']){_0x21902b[_0xd173('0x3f')]=[{'all':!![]}];}return db[_0xd173('0x58')][_0xd173('0x40')](_0x21902b);})[_0xd173('0x23')](function(_0x33d9c6){_0x1d06d4['rows']=_0x33d9c6;return _0x1d06d4;});}})[_0xd173('0x23')](respondWithFilteredResult(_0x393cb8,_0x21902b))[_0xd173('0x42')](handleError(_0x393cb8,null));};exports[_0xd173('0x5b')]=function(_0xa4e543,_0x6667ed,_0x287536){var _0x50c957={'raw':!![],'where':{}};var _0x38c3ad={};var _0x386c51={'count':0x0,'rows':[]};return db[_0xd173('0x29')][_0xd173('0x57')]({'where':{'id':_0xa4e543[_0xd173('0x43')]['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x6667ed,null))['then'](function(_0x2733a3){if(_0x2733a3){_0x38c3ad['model']=_[_0xd173('0x2d')](db[_0xd173('0x5c')][_0xd173('0x2a')]);_0x38c3ad['query']=_['keys'](_0xa4e543[_0xd173('0x2e')]);_0x38c3ad['filters']=_['intersection'](_0x38c3ad['model'],_0x38c3ad[_0xd173('0x2e')]);_0x50c957[_0xd173('0x32')]=_[_0xd173('0x30')](_0x38c3ad[_0xd173('0x31')],qs[_0xd173('0x33')](_0xa4e543['query'][_0xd173('0x33')]));_0x50c957['attributes']=_0x50c957[_0xd173('0x32')][_0xd173('0x34')]?_0x50c957[_0xd173('0x32')]:_0x38c3ad[_0xd173('0x31')];if(!_0xa4e543[_0xd173('0x2e')][_0xd173('0x35')](_0xd173('0x36'))){_0x50c957['limit']=qs[_0xd173('0x37')](_0xa4e543[_0xd173('0x2e')][_0xd173('0x37')]);_0x50c957[_0xd173('0x1a')]=qs['offset'](_0xa4e543['query'][_0xd173('0x1a')]);}_0x50c957[_0xd173('0x38')]=qs['sort'](_0xa4e543[_0xd173('0x2e')][_0xd173('0x39')]);_0x50c957[_0xd173('0x3a')]=qs['filters'](_['pick'](_0xa4e543[_0xd173('0x2e')],_0x38c3ad[_0xd173('0x2f')]));_0x50c957[_0xd173('0x3a')]['CampaignId']=_0x2733a3['id'];if(_0xa4e543[_0xd173('0x2e')][_0xd173('0x3b')]){_0x50c957[_0xd173('0x3a')]=_[_0xd173('0x44')](_0x50c957[_0xd173('0x3a')],{'$or':_[_0xd173('0x28')](_0x50c957[_0xd173('0x32')],function(_0x55625a){var _0x352616={};_0x352616[_0x55625a]={'$like':'%'+_0xa4e543[_0xd173('0x2e')][_0xd173('0x3b')]+'%'};return _0x352616;})});}_0x50c957=_[_0xd173('0x44')]({},_0x50c957,_0xa4e543['options']);return db[_0xd173('0x5c')][_0xd173('0x1c')]({'where':_0x50c957['where']})['then'](function(_0x7e300f){_0x386c51[_0xd173('0x1c')]=_0x7e300f;if(_0xa4e543[_0xd173('0x2e')][_0xd173('0x51')]){_0x50c957['include']=[{'all':!![]}];}return db[_0xd173('0x5c')][_0xd173('0x40')](_0x50c957);})[_0xd173('0x23')](function(_0x50e22c){_0x386c51[_0xd173('0x41')]=_0x50e22c;return _0x386c51;});}})[_0xd173('0x23')](respondWithFilteredResult(_0x6667ed,_0x50c957))[_0xd173('0x42')](handleError(_0x6667ed,null));};exports[_0xd173('0x5d')]=function(_0x2b805a,_0x83f733,_0x267f3c){var _0x556b5a={'raw':!![],'where':{}};var _0x3548e6={};var _0x3a2da9={'count':0x0,'rows':[]};return db[_0xd173('0x29')][_0xd173('0x57')]({'where':{'id':_0x2b805a['params']['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x83f733,null))['then'](function(_0x56f610){if(_0x56f610){_0x3548e6[_0xd173('0x31')]=_['keys'](db['CmHopperFinal'][_0xd173('0x2a')]);_0x3548e6['query']=_[_0xd173('0x2d')](_0x2b805a[_0xd173('0x2e')]);_0x3548e6[_0xd173('0x2f')]=_['intersection'](_0x3548e6[_0xd173('0x31')],_0x3548e6[_0xd173('0x2e')]);_0x556b5a[_0xd173('0x32')]=_[_0xd173('0x30')](_0x3548e6[_0xd173('0x31')],qs[_0xd173('0x33')](_0x2b805a[_0xd173('0x2e')][_0xd173('0x33')]));_0x556b5a[_0xd173('0x32')]=_0x556b5a[_0xd173('0x32')][_0xd173('0x34')]?_0x556b5a[_0xd173('0x32')]:_0x3548e6['model'];if(!_0x2b805a[_0xd173('0x2e')][_0xd173('0x35')](_0xd173('0x36'))){_0x556b5a[_0xd173('0x37')]=qs['limit'](_0x2b805a['query'][_0xd173('0x37')]);_0x556b5a[_0xd173('0x1a')]=qs[_0xd173('0x1a')](_0x2b805a[_0xd173('0x2e')][_0xd173('0x1a')]);}_0x556b5a[_0xd173('0x38')]=qs[_0xd173('0x39')](_0x2b805a['query']['sort']);_0x556b5a['where']=qs[_0xd173('0x2f')](_[_0xd173('0x59')](_0x2b805a[_0xd173('0x2e')],_0x3548e6[_0xd173('0x2f')]));_0x556b5a[_0xd173('0x3a')]['CampaignId']=_0x56f610['id'];if(_0x2b805a[_0xd173('0x2e')][_0xd173('0x3b')]){_0x556b5a[_0xd173('0x3a')]=_[_0xd173('0x44')](_0x556b5a['where'],{'$or':_['map'](_0x556b5a[_0xd173('0x32')],function(_0x3648c4){var _0x511f2f={};_0x511f2f[_0x3648c4]={'$like':'%'+_0x2b805a[_0xd173('0x2e')][_0xd173('0x3b')]+'%'};return _0x511f2f;})});}_0x556b5a=_[_0xd173('0x44')]({},_0x556b5a,_0x2b805a[_0xd173('0x3e')]);return db[_0xd173('0x5e')][_0xd173('0x1c')]({'where':_0x556b5a['where']})[_0xd173('0x23')](function(_0x3c1dac){_0x3a2da9['count']=_0x3c1dac;if(_0x2b805a[_0xd173('0x2e')][_0xd173('0x51')]){_0x556b5a[_0xd173('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd173('0x40')](_0x556b5a);})[_0xd173('0x23')](function(_0x2766e9){_0x3a2da9[_0xd173('0x41')]=_0x2766e9;return _0x3a2da9;});}})['then'](respondWithFilteredResult(_0x83f733,_0x556b5a))[_0xd173('0x42')](handleError(_0x83f733,null));};exports[_0xd173('0x5f')]=function(_0x3a4837,_0x578986,_0x3dcbd3){var _0xaed917={'raw':!![],'where':{}};var _0x2993d6={};var _0x6b3212={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3a4837['params']['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x578986,null))['then'](function(_0x5dc71d){if(_0x5dc71d){_0x2993d6[_0xd173('0x31')]=_[_0xd173('0x2d')](db[_0xd173('0x60')][_0xd173('0x2a')]);_0x2993d6[_0xd173('0x2e')]=_['keys'](_0x3a4837[_0xd173('0x2e')]);_0x2993d6['filters']=_['intersection'](_0x2993d6[_0xd173('0x31')],_0x2993d6[_0xd173('0x2e')]);_0xaed917['attributes']=_[_0xd173('0x30')](_0x2993d6[_0xd173('0x31')],qs[_0xd173('0x33')](_0x3a4837[_0xd173('0x2e')]['fields']));_0xaed917[_0xd173('0x32')]=_0xaed917['attributes']['length']?_0xaed917['attributes']:_0x2993d6[_0xd173('0x31')];if(!_0x3a4837[_0xd173('0x2e')][_0xd173('0x35')]('nolimit')){_0xaed917[_0xd173('0x37')]=qs[_0xd173('0x37')](_0x3a4837[_0xd173('0x2e')][_0xd173('0x37')]);_0xaed917[_0xd173('0x1a')]=qs[_0xd173('0x1a')](_0x3a4837[_0xd173('0x2e')][_0xd173('0x1a')]);}_0xaed917[_0xd173('0x38')]=qs[_0xd173('0x39')](_0x3a4837['query']['sort']);_0xaed917[_0xd173('0x3a')]=qs[_0xd173('0x2f')](_[_0xd173('0x59')](_0x3a4837[_0xd173('0x2e')],_0x2993d6[_0xd173('0x2f')]));_0xaed917[_0xd173('0x3a')][_0xd173('0x5a')]=_0x5dc71d['id'];if(_0x3a4837[_0xd173('0x2e')][_0xd173('0x3b')]){_0xaed917[_0xd173('0x3a')]=_[_0xd173('0x44')](_0xaed917['where'],{'$or':_[_0xd173('0x28')](_0xaed917[_0xd173('0x32')],function(_0x213f10){var _0x48f92f={};_0x48f92f[_0x213f10]={'$like':'%'+_0x3a4837['query'][_0xd173('0x3b')]+'%'};return _0x48f92f;})});}_0xaed917=_[_0xd173('0x44')]({},_0xaed917,_0x3a4837[_0xd173('0x3e')]);return db[_0xd173('0x60')]['count']({'where':_0xaed917[_0xd173('0x3a')]})[_0xd173('0x23')](function(_0x4e6927){_0x6b3212['count']=_0x4e6927;if(_0x3a4837[_0xd173('0x2e')]['includeAll']){_0xaed917[_0xd173('0x3f')]=[{'all':!![]}];}return db[_0xd173('0x60')][_0xd173('0x40')](_0xaed917);})[_0xd173('0x23')](function(_0x49d7f2){_0x6b3212[_0xd173('0x41')]=_0x49d7f2;return _0x6b3212;});}})['then'](respondWithFilteredResult(_0x578986,_0xaed917))[_0xd173('0x42')](handleError(_0x578986,null));};exports[_0xd173('0x61')]=function(_0x52e42f,_0x1bd35e,_0xec4aac){var _0x116b04={};var _0xd86a9e={};var _0x5ca7a8;var _0x50052c;return db[_0xd173('0x29')]['findOne']({'where':{'id':_0x52e42f[_0xd173('0x43')]['id']}})['then'](handleEntityNotFound(_0x1bd35e,null))['then'](function(_0x4115e8){if(_0x4115e8){_0x5ca7a8=_0x4115e8;_0xd86a9e['model']=_[_0xd173('0x2d')](db[_0xd173('0x62')][_0xd173('0x2a')]);_0xd86a9e[_0xd173('0x2e')]=_[_0xd173('0x2d')](_0x52e42f[_0xd173('0x2e')]);_0xd86a9e['filters']=_[_0xd173('0x30')](_0xd86a9e[_0xd173('0x31')],_0xd86a9e['query']);_0x116b04['attributes']=_[_0xd173('0x30')](_0xd86a9e[_0xd173('0x31')],qs[_0xd173('0x33')](_0x52e42f[_0xd173('0x2e')][_0xd173('0x33')]));_0x116b04[_0xd173('0x32')]=_0x116b04['attributes']['length']?_0x116b04[_0xd173('0x32')]:_0xd86a9e['model'];_0x116b04[_0xd173('0x38')]=qs['sort'](_0x52e42f[_0xd173('0x2e')][_0xd173('0x39')]);_0x116b04['where']=qs[_0xd173('0x2f')](_[_0xd173('0x59')](_0x52e42f[_0xd173('0x2e')],_0xd86a9e[_0xd173('0x2f')]));if(_0x52e42f[_0xd173('0x2e')]['filter']){_0x116b04[_0xd173('0x3a')]=_[_0xd173('0x44')](_0x116b04[_0xd173('0x3a')],{'$or':_['map'](_0x116b04[_0xd173('0x32')],function(_0x2b9388){var _0x536d02={};_0x536d02[_0x2b9388]={'$like':'%'+_0x52e42f[_0xd173('0x2e')][_0xd173('0x3b')]+'%'};return _0x536d02;})});}_0x116b04=_[_0xd173('0x44')]({},_0x116b04,_0x52e42f[_0xd173('0x3e')]);return _0x5ca7a8['getLists'](_0x116b04);}})[_0xd173('0x23')](function(_0xc51e6e){if(_0xc51e6e){_0x50052c=_0xc51e6e['length'];if(!_0x52e42f[_0xd173('0x2e')][_0xd173('0x35')](_0xd173('0x36'))){_0x116b04['limit']=qs['limit'](_0x52e42f['query']['limit']);_0x116b04['offset']=qs[_0xd173('0x1a')](_0x52e42f[_0xd173('0x2e')][_0xd173('0x1a')]);}return _0x5ca7a8[_0xd173('0x61')](_0x116b04);}})[_0xd173('0x23')](function(_0x5d2618){if(_0x5d2618){return _0x5d2618?{'count':_0x50052c,'rows':_0x5d2618}:null;}})[_0xd173('0x23')](respondWithResult(_0x1bd35e,null))[_0xd173('0x42')](handleError(_0x1bd35e,null));};exports[_0xd173('0x63')]=function(_0x45d8b9,_0x240548,_0x2a62f9){var _0x4e9d6c,_0x11174f;var _0x36eb9d=[];var _0x3e606a=moment()[_0xd173('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xd173('0x29')][_0xd173('0x45')]({'where':{'id':_0x45d8b9['params']['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x240548,null))[_0xd173('0x23')](function(_0x2dbd81){if(_0x2dbd81){_0x11174f=_0x2dbd81;return _0x2dbd81[_0xd173('0x63')](_0x45d8b9[_0xd173('0x47')][_0xd173('0x65')],_[_0xd173('0x52')](_0x45d8b9[_0xd173('0x47')],['ids','id'])||{});}return null;})[_0xd173('0x66')](function(_0x7a5119){var _0x1e5165;var _0x406930;_0x4e9d6c=_0x7a5119||[];var _0x36f4a5=[];if(_0x7a5119){for(var _0x2e7763=0x0;_0x2e7763<_0x7a5119[_0xd173('0x34')];_0x2e7763+=0x1){var _0x67eab9=_0x7a5119[_0x2e7763][_0xd173('0x24')]({'plain':!![]});_0x11174f[_0xd173('0x67')]=_0x45d8b9[_0xd173('0x47')][_0xd173('0x67')]?_0x45d8b9[_0xd173('0x47')][_0xd173('0x67')]:_0x11174f[_0xd173('0x67')];switch(_0x11174f[_0xd173('0x67')]){case _0xd173('0x68'):_0x1e5165=squel[_0xd173('0x69')]()[_0xd173('0x6a')](_0xd173('0x6b'))[_0xd173('0x6c')]([_0xd173('0x6d'),'scheduledAt','ContactId',_0xd173('0x6e'),_0xd173('0x5a'),_0xd173('0x54'),_0xd173('0x53')],squel[_0xd173('0x6f')]()[_0xd173('0x70')]('phone',_0xd173('0x6d'))[_0xd173('0x70')](_0xd173('0x71'),_0xd173('0x72'))[_0xd173('0x70')]('id','ContactId')[_0xd173('0x70')](_0x67eab9['CmListId'][_0xd173('0x73')](),_0xd173('0x6e'))['field'](_0x45d8b9['params']['id'][_0xd173('0x73')](),_0xd173('0x5a'))[_0xd173('0x70')]('\x27'+_0x3e606a+'\x27','createdAt')[_0xd173('0x70')]('\x27'+_0x3e606a+'\x27','updatedAt')['from'](_0xd173('0x74'))[_0xd173('0x3a')](_0xd173('0x75'))[_0xd173('0x3a')](_0xd173('0x76'),_0x67eab9[_0xd173('0x77')][_0xd173('0x73')]())[_0xd173('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xd173('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd173('0x6f')]()[_0xd173('0x70')](_0xd173('0x78'))['from'](_0xd173('0x79'))[_0xd173('0x3a')](_0xd173('0x7a'),_0x45d8b9['params']['id'][_0xd173('0x73')]()))[_0xd173('0x3a')](_0xd173('0x7b'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xd173('0x7c')](_0xd173('0x6b'))['where']('CampaignId\x20=\x20?',_0x45d8b9[_0xd173('0x43')]['id'][_0xd173('0x73')]())))[_0xd173('0x73')]();break;case _0xd173('0x7d'):_0x1e5165=squel['insert']()['into'](_0xd173('0x6b'))[_0xd173('0x6c')]([_0xd173('0x6d'),'scheduledAt',_0xd173('0x7e'),_0xd173('0x6e'),_0xd173('0x5a'),_0xd173('0x54'),_0xd173('0x53')],squel[_0xd173('0x6f')]()[_0xd173('0x70')]('phone',_0xd173('0x6d'))['field']('NOW()',_0xd173('0x72'))['field']('id','ContactId')['field'](_0x67eab9[_0xd173('0x77')]['toString'](),_0xd173('0x6e'))[_0xd173('0x70')](_0x45d8b9[_0xd173('0x43')]['id'][_0xd173('0x73')](),'CampaignId')['field']('\x27'+_0x3e606a+'\x27',_0xd173('0x54'))['field']('\x27'+_0x3e606a+'\x27',_0xd173('0x53'))[_0xd173('0x7c')](_0xd173('0x74'))[_0xd173('0x3a')](_0xd173('0x75'))['where'](_0xd173('0x76'),_0x67eab9[_0xd173('0x77')]['toString']())[_0xd173('0x3a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd173('0x7b'),squel[_0xd173('0x6f')]()[_0xd173('0x70')](_0xd173('0x7f'))[_0xd173('0x7c')](_0xd173('0x6b'))[_0xd173('0x3a')](_0xd173('0x7a'),_0x45d8b9[_0xd173('0x43')]['id'][_0xd173('0x73')]())))[_0xd173('0x73')]();break;default:_0x1e5165=squel[_0xd173('0x69')]()[_0xd173('0x6a')](_0xd173('0x6b'))[_0xd173('0x6c')]([_0xd173('0x6d'),_0xd173('0x72'),_0xd173('0x7e'),_0xd173('0x6e'),_0xd173('0x5a'),_0xd173('0x54'),_0xd173('0x53')],squel[_0xd173('0x6f')]()[_0xd173('0x70')](_0xd173('0x6d'),_0xd173('0x6d'))[_0xd173('0x70')]('NOW()','scheduledAt')[_0xd173('0x70')]('id',_0xd173('0x7e'))[_0xd173('0x70')](_0x67eab9[_0xd173('0x77')][_0xd173('0x73')](),_0xd173('0x6e'))['field'](_0x45d8b9[_0xd173('0x43')]['id'][_0xd173('0x73')](),_0xd173('0x5a'))['field']('\x27'+_0x3e606a+'\x27',_0xd173('0x54'))[_0xd173('0x70')]('\x27'+_0x3e606a+'\x27',_0xd173('0x53'))['from'](_0xd173('0x74'))[_0xd173('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xd173('0x76'),_0x67eab9[_0xd173('0x77')][_0xd173('0x73')]())[_0xd173('0x3a')](_0xd173('0x80')))['toString']();}_0x406930=squel[_0xd173('0x69')]()[_0xd173('0x6a')]('cm_hopper_additional_phones')['fromQuery']([_0xd173('0x81'),'scheduledAt','phone','OrderBy',_0xd173('0x54'),_0xd173('0x53')],squel[_0xd173('0x6f')]()[_0xd173('0x70')]('h.id','id')['field'](_0xd173('0x71'),_0xd173('0x72'))['field']('ci.item','phone')[_0xd173('0x70')](_0xd173('0x82'),_0xd173('0x83'))[_0xd173('0x70')]('\x27'+_0x3e606a+'\x27','createdAt')[_0xd173('0x70')]('\x27'+_0x3e606a+'\x27',_0xd173('0x53'))[_0xd173('0x7c')](_0xd173('0x84'),'ci')['join'](_0xd173('0x6b'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0xd173('0x85'),_0x67eab9[_0xd173('0x77')][_0xd173('0x73')]())[_0xd173('0x3a')]('h.CampaignId=?',_0x45d8b9[_0xd173('0x43')]['id']['toString']())[_0xd173('0x3a')]('h.createdAt\x20=\x20?',_0x3e606a))[_0xd173('0x73')]();_0x36f4a5[_0xd173('0x86')](db[_0xd173('0x87')][_0xd173('0x2e')](_0x1e5165));_0x36eb9d[_0xd173('0x86')](db[_0xd173('0x87')][_0xd173('0x2e')](_0x406930));}return BPromise[_0xd173('0x88')](_0x36f4a5);}})[_0xd173('0x23')](function(){return BPromise[_0xd173('0x88')](_0x36eb9d);})['then'](function(){return _0x4e9d6c;})[_0xd173('0x23')](respondWithResult(_0x240548,null))[_0xd173('0x42')](handleError(_0x240548,null));};exports[_0xd173('0x89')]=function(_0x3bf455,_0x10c8a7,_0x48e5e5){return db[_0xd173('0x29')][_0xd173('0x45')]({'where':{'id':_0x3bf455[_0xd173('0x43')]['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x10c8a7,null))[_0xd173('0x23')](function(_0x256161){if(_0x256161){return _0x256161[_0xd173('0x89')](_0x3bf455[_0xd173('0x2e')][_0xd173('0x65')]);}})[_0xd173('0x23')](function(_0x341d39){if(_0x341d39){return db['CmHopper'][_0xd173('0x22')]({'where':{'ListId':_0x3bf455[_0xd173('0x2e')][_0xd173('0x65')],'CampaignId':_0x3bf455[_0xd173('0x43')]['id']}})[_0xd173('0x23')](function(){return _0x341d39;});}})[_0xd173('0x23')](respondWithStatusCode(_0x10c8a7,null))[_0xd173('0x42')](handleError(_0x10c8a7,null));};exports[_0xd173('0x8a')]=function(_0x377fee,_0x1a7f5f,_0x587b1c){var _0x495447={};var _0x51eb57={};var _0x1fc6ee;var _0x29d938;return db[_0xd173('0x29')]['findOne']({'where':{'id':_0x377fee['params']['id']}})['then'](handleEntityNotFound(_0x1a7f5f,null))[_0xd173('0x23')](function(_0x4397c4){if(_0x4397c4){_0x1fc6ee=_0x4397c4;_0x51eb57[_0xd173('0x31')]=_['keys'](db['CmList'][_0xd173('0x2a')]);_0x51eb57[_0xd173('0x2e')]=_['keys'](_0x377fee['query']);_0x51eb57[_0xd173('0x2f')]=_[_0xd173('0x30')](_0x51eb57['model'],_0x51eb57[_0xd173('0x2e')]);_0x495447[_0xd173('0x32')]=_[_0xd173('0x30')](_0x51eb57['model'],qs['fields'](_0x377fee[_0xd173('0x2e')][_0xd173('0x33')]));_0x495447[_0xd173('0x32')]=_0x495447[_0xd173('0x32')]['length']?_0x495447[_0xd173('0x32')]:_0x51eb57['model'];_0x495447[_0xd173('0x38')]=qs['sort'](_0x377fee[_0xd173('0x2e')]['sort']);_0x495447[_0xd173('0x3a')]=qs[_0xd173('0x2f')](_[_0xd173('0x59')](_0x377fee[_0xd173('0x2e')],_0x51eb57[_0xd173('0x2f')]));if(_0x377fee[_0xd173('0x2e')][_0xd173('0x3b')]){_0x495447[_0xd173('0x3a')]=_[_0xd173('0x44')](_0x495447[_0xd173('0x3a')],{'$or':_[_0xd173('0x28')](_0x495447[_0xd173('0x32')],function(_0x17d9d5){var _0x429cd5={};_0x429cd5[_0x17d9d5]={'$like':'%'+_0x377fee[_0xd173('0x2e')]['filter']+'%'};return _0x429cd5;})});}_0x495447=_[_0xd173('0x44')]({},_0x495447,_0x377fee[_0xd173('0x3e')]);return _0x1fc6ee[_0xd173('0x8a')](_0x495447);}})[_0xd173('0x23')](function(_0x2aca2d){if(_0x2aca2d){_0x29d938=_0x2aca2d[_0xd173('0x34')];if(!_0x377fee[_0xd173('0x2e')][_0xd173('0x35')]('nolimit')){_0x495447[_0xd173('0x37')]=qs[_0xd173('0x37')](_0x377fee[_0xd173('0x2e')][_0xd173('0x37')]);_0x495447[_0xd173('0x1a')]=qs[_0xd173('0x1a')](_0x377fee['query'][_0xd173('0x1a')]);}return _0x1fc6ee[_0xd173('0x8a')](_0x495447);}})[_0xd173('0x23')](function(_0x4b59d5){if(_0x4b59d5){return _0x4b59d5?{'count':_0x29d938,'rows':_0x4b59d5}:null;}})['then'](respondWithResult(_0x1a7f5f,null))[_0xd173('0x42')](handleError(_0x1a7f5f,null));};exports['addBlackLists']=function(_0x1e4ee3,_0x4754f5,_0x20d1b8){var _0x1b2c08,_0xc0187b;var _0x46506a=[];var _0x2e8d97=moment()[_0xd173('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xd173('0x29')]['find']({'where':{'id':_0x1e4ee3['params']['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x4754f5,null))['then'](function(_0x21b3bf){if(_0x21b3bf){_0xc0187b=_0x21b3bf;return _0x21b3bf[_0xd173('0x8b')](_0x1e4ee3[_0xd173('0x47')]['ids'],_[_0xd173('0x52')](_0x1e4ee3[_0xd173('0x47')],[_0xd173('0x65'),'id'])||{});}return null;})['spread'](function(_0x40e44a){var _0x4c74f4;var _0x5f1f5a;_0x1b2c08=_0x40e44a||[];var _0x371be8=[];if(_0x40e44a){for(var _0x20e84f=0x0;_0x20e84f<_0x40e44a[_0xd173('0x34')];_0x20e84f+=0x1){var _0xe28dd6=_0x40e44a[_0x20e84f][_0xd173('0x24')]({'plain':!![]});_0x4c74f4=squel[_0xd173('0x69')]()[_0xd173('0x6a')](_0xd173('0x8c'))[_0xd173('0x6c')]([_0xd173('0x6d'),'ContactId',_0xd173('0x6e'),_0xd173('0x5a'),_0xd173('0x54'),_0xd173('0x53')],squel['select']()[_0xd173('0x70')](_0xd173('0x6d'),'phone')[_0xd173('0x70')]('id','ContactId')[_0xd173('0x70')](_0xe28dd6[_0xd173('0x77')][_0xd173('0x73')](),_0xd173('0x6e'))['field'](_0x1e4ee3[_0xd173('0x43')]['id'][_0xd173('0x73')](),_0xd173('0x5a'))['field'](_0xd173('0x71'),_0xd173('0x54'))['field'](_0xd173('0x71'),_0xd173('0x53'))[_0xd173('0x7c')](_0xd173('0x74'))[_0xd173('0x3a')]('deletedAt\x20IS\x20NULL')[_0xd173('0x3a')](_0xd173('0x76'),_0xe28dd6[_0xd173('0x77')]['toString']())[_0xd173('0x3a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x371be8[_0xd173('0x86')](db[_0xd173('0x87')][_0xd173('0x2e')](_0x4c74f4));}return BPromise[_0xd173('0x88')](_0x371be8);}})['then'](function(){return _0x1b2c08;})['then'](respondWithResult(_0x4754f5,null))[_0xd173('0x42')](handleError(_0x4754f5,null));};exports[_0xd173('0x8d')]=function(_0xbe68cb,_0x565273,_0x8d6249){return db['Campaign'][_0xd173('0x45')]({'where':{'id':_0xbe68cb[_0xd173('0x43')]['id']}})[_0xd173('0x23')](handleEntityNotFound(_0x565273,null))[_0xd173('0x23')](function(_0x3347bd){if(_0x3347bd){return _0x3347bd['removeBlackLists'](_0xbe68cb['query']['ids']);}})[_0xd173('0x23')](function(_0x3101fa){if(_0x3101fa){return db[_0xd173('0x60')][_0xd173('0x22')]({'where':{'ListId':_0xbe68cb['query'][_0xd173('0x65')],'CampaignId':_0xbe68cb[_0xd173('0x43')]['id']}})[_0xd173('0x23')](function(){return _0x3101fa;});}})[_0xd173('0x23')](respondWithStatusCode(_0x565273,null))[_0xd173('0x42')](handleError(_0x565273,null));}; \ No newline at end of file +var _0x58c4=['field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','CampaignId\x20=\x20?','cm_hopper_additional_phones','OrderBy','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','filter','merge','options','Campaign','rows','catch','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','userProfileId','error','includeAll','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','nolimit','order','pick','findAll','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x58c4,0x135));var _0x458c=function(_0x32eb00,_0x428dc0){_0x32eb00=_0x32eb00-0x0;var _0x4447ce=_0x58c4[_0x32eb00];return _0x4447ce;};'use strict';var emlformat=require(_0x458c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x458c('0x1'));var jsonpatch=require(_0x458c('0x2'));var rp=require(_0x458c('0x3'));var moment=require(_0x458c('0x4'));var BPromise=require(_0x458c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x458c('0x6'));var sox=require(_0x458c('0x7'));var csv=require(_0x458c('0x8'));var ejs=require(_0x458c('0x9'));var fs=require('fs');var fs_extra=require(_0x458c('0xa'));var _=require(_0x458c('0xb'));var squel=require(_0x458c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x458c('0xd'));var toCsv=require(_0x458c('0x8'));var querystring=require(_0x458c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x458c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x458c('0x10'))(_0x458c('0x11'));var utils=require(_0x458c('0x12'));var config=require(_0x458c('0x13'));var licenseUtil=require(_0x458c('0x14'));var db=require(_0x458c('0x15'))['db'];function respondWithStatusCode(_0xdbfe9e,_0x5ea16d){_0x5ea16d=_0x5ea16d||0xcc;return function(_0x13249c){if(_0x13249c){return _0xdbfe9e[_0x458c('0x16')](_0x5ea16d);}return _0xdbfe9e['status'](_0x5ea16d)[_0x458c('0x17')]();};}function respondWithResult(_0x385e15,_0x4dd1bb){_0x4dd1bb=_0x4dd1bb||0xc8;return function(_0x4096fb){if(_0x4096fb){return _0x385e15[_0x458c('0x18')](_0x4dd1bb)[_0x458c('0x19')](_0x4096fb);}};}function respondWithFilteredResult(_0x4ab110,_0x4d85bf){return function(_0x586048){if(_0x586048){var _0x54cc0c=typeof _0x4d85bf['offset']==='undefined'&&typeof _0x4d85bf[_0x458c('0x1a')]==='undefined';var _0x108b97=_0x586048[_0x458c('0x1b')];var _0x2aac1b=_0x54cc0c?0x0:_0x4d85bf['offset'];var _0x52674a=_0x54cc0c?_0x586048[_0x458c('0x1b')]:_0x4d85bf[_0x458c('0x1c')]+_0x4d85bf[_0x458c('0x1a')];var _0x484804;if(_0x52674a>=_0x108b97){_0x52674a=_0x108b97;_0x484804=0xc8;}else{_0x484804=0xce;}_0x4ab110[_0x458c('0x18')](_0x484804);return _0x4ab110[_0x458c('0x1d')](_0x458c('0x1e'),_0x2aac1b+'-'+_0x52674a+'/'+_0x108b97)['json'](_0x586048);}return null;};}function patchUpdates(_0x7b4338){return function(_0x1e88ee){try{jsonpatch[_0x458c('0x1f')](_0x1e88ee,_0x7b4338,!![]);}catch(_0x13fcd6){return BPromise[_0x458c('0x20')](_0x13fcd6);}return _0x1e88ee[_0x458c('0x21')]();};}function saveUpdates(_0x1adc6b,_0x5d325d){return function(_0x4f0ac){if(_0x4f0ac){return _0x4f0ac['update'](_0x1adc6b)[_0x458c('0x22')](function(_0x24da99){return _0x24da99;});}return null;};}function removeEntity(_0x4e0572,_0x311496){return function(_0x55c116){if(_0x55c116){return _0x55c116[_0x458c('0x23')]()[_0x458c('0x22')](function(){var _0x2039fc=_0x55c116[_0x458c('0x24')]({'plain':!![]});var _0x26d037='IvrCampaigns';return db[_0x458c('0x25')][_0x458c('0x23')]({'where':{'type':_0x26d037,'resourceId':_0x2039fc['id']}})[_0x458c('0x22')](function(){return _0x55c116;});})[_0x458c('0x22')](function(){_0x4e0572[_0x458c('0x18')](0xcc)[_0x458c('0x17')]();});}};}function handleEntityNotFound(_0xb3135e,_0x125eff){return function(_0x33ec76){if(!_0x33ec76){_0xb3135e[_0x458c('0x16')](0x194);}return _0x33ec76;};}function handleError(_0x4841ba,_0x2403fd){_0x2403fd=_0x2403fd||0x1f4;return function(_0x25a965){logger['error'](_0x25a965['stack']);if(_0x25a965[_0x458c('0x26')]){delete _0x25a965[_0x458c('0x26')];}_0x4841ba[_0x458c('0x18')](_0x2403fd)[_0x458c('0x27')](_0x25a965);};}exports[_0x458c('0x28')]=function(_0x579630,_0x360fd0){var _0x43093e={},_0xf7a600={},_0x485faa={'count':0x0,'rows':[]};var _0x4b1de4=_['map'](db['Campaign'][_0x458c('0x29')],function(_0x12f4f0){return{'name':_0x12f4f0[_0x458c('0x2a')],'type':_0x12f4f0['type'][_0x458c('0x2b')]};});_0xf7a600['model']=_[_0x458c('0x2c')](_0x4b1de4,'name');_0xf7a600[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x579630[_0x458c('0x2d')]);_0xf7a600[_0x458c('0x2f')]=_[_0x458c('0x30')](_0xf7a600[_0x458c('0x31')],_0xf7a600[_0x458c('0x2d')]);_0x43093e[_0x458c('0x32')]=_['intersection'](_0xf7a600['model'],qs[_0x458c('0x33')](_0x579630[_0x458c('0x2d')][_0x458c('0x33')]));_0x43093e['attributes']=_0x43093e[_0x458c('0x32')]['length']?_0x43093e[_0x458c('0x32')]:_0xf7a600[_0x458c('0x31')];if(!_0x579630['query'][_0x458c('0x34')]('nolimit')){_0x43093e[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x579630['query'][_0x458c('0x1a')]);_0x43093e[_0x458c('0x1c')]=qs['offset'](_0x579630[_0x458c('0x2d')]['offset']);}_0x43093e['order']=qs[_0x458c('0x35')](_0x579630[_0x458c('0x2d')][_0x458c('0x35')]);_0x43093e[_0x458c('0x36')]=qs[_0x458c('0x2f')](_['pick'](_0x579630[_0x458c('0x2d')],_0xf7a600[_0x458c('0x2f')]),_0x4b1de4);if(_0x579630[_0x458c('0x2d')][_0x458c('0x37')]){_0x43093e['where']=_[_0x458c('0x38')](_0x43093e[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x4b1de4,function(_0x2125ad){if(_0x2125ad['type']!=='VIRTUAL'){var _0x31066b={};_0x31066b[_0x2125ad[_0x458c('0x26')]]={'$like':'%'+_0x579630['query'][_0x458c('0x37')]+'%'};return _0x31066b;}})});}_0x43093e=_[_0x458c('0x38')]({},_0x43093e,_0x579630[_0x458c('0x39')]);var _0x1e1aa3={'where':_0x43093e[_0x458c('0x36')]};return db[_0x458c('0x3a')]['count'](_0x1e1aa3)[_0x458c('0x22')](function(_0x1992b0){_0x485faa['count']=_0x1992b0;if(_0x579630[_0x458c('0x2d')]['includeAll']){_0x43093e['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x43093e);})['then'](function(_0x2e9ebd){_0x485faa[_0x458c('0x3b')]=_0x2e9ebd;return _0x485faa;})[_0x458c('0x22')](respondWithFilteredResult(_0x360fd0,_0x43093e))[_0x458c('0x3c')](handleError(_0x360fd0,null));};exports['show']=function(_0x3b856c,_0x237348){var _0x25ca5c={'raw':![],'where':{'id':_0x3b856c[_0x458c('0x3d')]['id']}},_0x2ce446={};_0x2ce446['model']=_[_0x458c('0x2e')](db['Campaign'][_0x458c('0x29')]);_0x2ce446[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x3b856c['query']);_0x2ce446[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2ce446[_0x458c('0x31')],_0x2ce446[_0x458c('0x2d')]);_0x25ca5c[_0x458c('0x32')]=_['intersection'](_0x2ce446['model'],qs[_0x458c('0x33')](_0x3b856c[_0x458c('0x2d')][_0x458c('0x33')]));_0x25ca5c[_0x458c('0x32')]=_0x25ca5c[_0x458c('0x32')][_0x458c('0x3e')]?_0x25ca5c[_0x458c('0x32')]:_0x2ce446[_0x458c('0x31')];if(_0x3b856c[_0x458c('0x2d')]['includeAll']){_0x25ca5c[_0x458c('0x3f')]=[{'all':!![]}];}_0x25ca5c=_[_0x458c('0x38')]({},_0x25ca5c,_0x3b856c[_0x458c('0x39')]);return db[_0x458c('0x3a')][_0x458c('0x40')](_0x25ca5c)[_0x458c('0x22')](handleEntityNotFound(_0x237348,null))['then'](respondWithResult(_0x237348,null))['catch'](handleError(_0x237348,null));};exports['create']=function(_0x365903,_0x45f949){return db['Campaign'][_0x458c('0x41')](_0x365903[_0x458c('0x42')],{})[_0x458c('0x22')](function(_0x3637bd){var _0x5bc35c=_0x365903['user'][_0x458c('0x24')]({'plain':!![]});if(!_0x5bc35c)throw new Error(_0x458c('0x43'));if(_0x5bc35c[_0x458c('0x44')]===_0x458c('0x45')){var _0x3cee04=_0x3637bd['get']({'plain':!![]});var _0x36a25e=_0x458c('0x46');return db['UserProfileSection']['find']({'where':{'name':_0x36a25e,'userProfileId':_0x5bc35c[_0x458c('0x47')]},'raw':!![]})[_0x458c('0x22')](function(_0x30f82e){if(_0x30f82e&&_0x30f82e['autoAssociation']===0x0){return db['UserProfileResource'][_0x458c('0x41')]({'name':_0x3cee04[_0x458c('0x26')],'resourceId':_0x3cee04['id'],'type':_0x30f82e[_0x458c('0x26')],'sectionId':_0x30f82e['id']},{})[_0x458c('0x22')](function(){return _0x3637bd;});}else{return _0x3637bd;}})[_0x458c('0x3c')](function(_0x3a0105){logger[_0x458c('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a0105);throw _0x3a0105;});}return _0x3637bd;})[_0x458c('0x22')](respondWithResult(_0x45f949,0xc9))[_0x458c('0x3c')](handleError(_0x45f949,null));};exports['clone']=function(_0x4f8b67,_0x28eef2){var _0x66760={'where':{'id':_0x4f8b67[_0x458c('0x3d')]['id']}},_0x30d7ec={};_0x30d7ec[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x3a')]['rawAttributes']);_0x66760[_0x458c('0x32')]=_['intersection'](_0x30d7ec[_0x458c('0x31')],qs['fields'](_0x4f8b67[_0x458c('0x2d')][_0x458c('0x33')]));_0x66760[_0x458c('0x32')]=_0x66760['attributes']['length']?_0x66760[_0x458c('0x32')]:_0x30d7ec[_0x458c('0x31')];if(_0x4f8b67[_0x458c('0x2d')][_0x458c('0x49')]){_0x66760[_0x458c('0x3f')]=[{'all':!![]}];}_0x66760=_[_0x458c('0x38')]({},_0x66760,_0x4f8b67['options']);return db['Campaign'][_0x458c('0x40')](_0x66760)[_0x458c('0x22')](handleEntityNotFound(_0x28eef2,null))[_0x458c('0x22')](function(_0xc99888){if(_0xc99888){var _0x57311c=_0xc99888[_0x458c('0x24')]({'plain':!![]});_0x57311c=qs[_0x458c('0x4a')](_0x57311c,['id',_0x458c('0x4b'),'updatedAt']);_0x4f8b67['body']=_[_0x458c('0x4a')](_0x4f8b67[_0x458c('0x42')],['id','createdAt',_0x458c('0x4c')]);return db['Campaign'][_0x458c('0x41')](_['merge'](_0x57311c,_0x4f8b67['body']),{'include':_0x4f8b67['query'][_0x458c('0x49')]?[{'all':!![]}]:undefined})[_0x458c('0x22')](function(_0x3ce854){var _0x35d6f1=_0x4f8b67[_0x458c('0x45')][_0x458c('0x24')]({'plain':!![]});if(!_0x35d6f1)throw new Error(_0x458c('0x43'));if(_0x35d6f1[_0x458c('0x44')]===_0x458c('0x45')){var _0x3e183e=_0x3ce854[_0x458c('0x24')]({'plain':!![]});var _0x569099=_0x458c('0x46');return db[_0x458c('0x4d')][_0x458c('0x40')]({'where':{'name':_0x569099,'userProfileId':_0x35d6f1['userProfileId']},'raw':!![]})[_0x458c('0x22')](function(_0x3fec3c){if(_0x3fec3c&&_0x3fec3c[_0x458c('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e183e[_0x458c('0x26')],'resourceId':_0x3e183e['id'],'type':_0x3fec3c['name'],'sectionId':_0x3fec3c['id']},{})[_0x458c('0x22')](function(){return _0x3ce854;});}else{return _0x3ce854;}})[_0x458c('0x3c')](function(_0x51248c){logger['error'](_0x458c('0x4f'),_0x51248c);throw _0x51248c;});}return _0x3ce854;});}})[_0x458c('0x22')](respondWithResult(_0x28eef2,0xc9))[_0x458c('0x3c')](handleError(_0x28eef2,null));};exports[_0x458c('0x50')]=function(_0x26a68d,_0x5b746c){if(_0x26a68d['body']['id']){delete _0x26a68d['body']['id'];}return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x26a68d[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x5b746c,null))['then'](saveUpdates(_0x26a68d[_0x458c('0x42')],null))[_0x458c('0x22')](respondWithResult(_0x5b746c,null))[_0x458c('0x3c')](handleError(_0x5b746c,null));};exports[_0x458c('0x23')]=function(_0x53c4e0,_0x290a65){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x53c4e0[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x290a65,null))[_0x458c('0x22')](removeEntity(_0x290a65,null))[_0x458c('0x3c')](handleError(_0x290a65,null));};exports['getHoppers']=function(_0x2b8a61,_0x212dba,_0x3b9df2){var _0x1a2123={'raw':!![],'where':{}};var _0xb07f74={};var _0x52025c={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x2b8a61[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x212dba,null))['then'](function(_0x282c5e){if(_0x282c5e){_0xb07f74[_0x458c('0x31')]=_['keys'](db[_0x458c('0x52')]['rawAttributes']);_0xb07f74[_0x458c('0x2d')]=_['keys'](_0x2b8a61[_0x458c('0x2d')]);_0xb07f74['filters']=_[_0x458c('0x30')](_0xb07f74[_0x458c('0x31')],_0xb07f74[_0x458c('0x2d')]);_0x1a2123[_0x458c('0x32')]=_[_0x458c('0x30')](_0xb07f74[_0x458c('0x31')],qs[_0x458c('0x33')](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x33')]));_0x1a2123['attributes']=_0x1a2123[_0x458c('0x32')][_0x458c('0x3e')]?_0x1a2123[_0x458c('0x32')]:_0xb07f74[_0x458c('0x31')];if(!_0x2b8a61[_0x458c('0x2d')][_0x458c('0x34')](_0x458c('0x53'))){_0x1a2123[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x1a')]);_0x1a2123[_0x458c('0x1c')]=qs['offset'](_0x2b8a61[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x1a2123[_0x458c('0x54')]=qs[_0x458c('0x35')](_0x2b8a61[_0x458c('0x2d')]['sort']);_0x1a2123['where']=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0x2b8a61[_0x458c('0x2d')],_0xb07f74['filters']));_0x1a2123[_0x458c('0x36')]['CampaignId']=_0x282c5e['id'];if(_0x2b8a61[_0x458c('0x2d')][_0x458c('0x37')]){_0x1a2123[_0x458c('0x36')]=_[_0x458c('0x38')](_0x1a2123[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x1a2123[_0x458c('0x32')],function(_0x4ddece){var _0x348535={};_0x348535[_0x4ddece]={'$like':'%'+_0x2b8a61[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x348535;})});}_0x1a2123=_['merge']({},_0x1a2123,_0x2b8a61[_0x458c('0x39')]);return db[_0x458c('0x52')][_0x458c('0x1b')]({'where':_0x1a2123[_0x458c('0x36')]})['then'](function(_0x2b7f63){_0x52025c[_0x458c('0x1b')]=_0x2b7f63;if(_0x2b8a61[_0x458c('0x2d')][_0x458c('0x49')]){_0x1a2123[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x52')][_0x458c('0x56')](_0x1a2123);})[_0x458c('0x22')](function(_0x1471c1){_0x52025c[_0x458c('0x3b')]=_0x1471c1;return _0x52025c;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x212dba,_0x1a2123))['catch'](handleError(_0x212dba,null));};exports['getHopperHistories']=function(_0x9b0359,_0x23070a,_0x24837d){var _0x55bd9e={'raw':!![],'where':{}};var _0x24856e={};var _0x1f0aa3={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x9b0359['params']['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x23070a,null))[_0x458c('0x22')](function(_0x4ff8cb){if(_0x4ff8cb){_0x24856e[_0x458c('0x31')]=_[_0x458c('0x2e')](db['CmHopperHistory'][_0x458c('0x29')]);_0x24856e[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x9b0359['query']);_0x24856e['filters']=_[_0x458c('0x30')](_0x24856e[_0x458c('0x31')],_0x24856e['query']);_0x55bd9e['attributes']=_[_0x458c('0x30')](_0x24856e[_0x458c('0x31')],qs[_0x458c('0x33')](_0x9b0359['query']['fields']));_0x55bd9e[_0x458c('0x32')]=_0x55bd9e[_0x458c('0x32')]['length']?_0x55bd9e[_0x458c('0x32')]:_0x24856e[_0x458c('0x31')];if(!_0x9b0359[_0x458c('0x2d')][_0x458c('0x34')]('nolimit')){_0x55bd9e[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x9b0359[_0x458c('0x2d')][_0x458c('0x1a')]);_0x55bd9e[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x9b0359[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x55bd9e['order']=qs[_0x458c('0x35')](_0x9b0359[_0x458c('0x2d')]['sort']);_0x55bd9e['where']=qs[_0x458c('0x2f')](_['pick'](_0x9b0359[_0x458c('0x2d')],_0x24856e['filters']));_0x55bd9e[_0x458c('0x36')][_0x458c('0x57')]=_0x4ff8cb['id'];if(_0x9b0359[_0x458c('0x2d')][_0x458c('0x37')]){_0x55bd9e[_0x458c('0x36')]=_[_0x458c('0x38')](_0x55bd9e[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x55bd9e[_0x458c('0x32')],function(_0x2a0105){var _0x4b5dbd={};_0x4b5dbd[_0x2a0105]={'$like':'%'+_0x9b0359[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x4b5dbd;})});}_0x55bd9e=_[_0x458c('0x38')]({},_0x55bd9e,_0x9b0359[_0x458c('0x39')]);return db[_0x458c('0x58')]['count']({'where':_0x55bd9e['where']})['then'](function(_0x1b7b07){_0x1f0aa3['count']=_0x1b7b07;if(_0x9b0359[_0x458c('0x2d')]['includeAll']){_0x55bd9e[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x58')][_0x458c('0x56')](_0x55bd9e);})[_0x458c('0x22')](function(_0x140f29){_0x1f0aa3[_0x458c('0x3b')]=_0x140f29;return _0x1f0aa3;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x23070a,_0x55bd9e))[_0x458c('0x3c')](handleError(_0x23070a,null));};exports[_0x458c('0x59')]=function(_0x5cfbc5,_0x400d44,_0x5143b3){var _0x2c70c3={'raw':!![],'where':{}};var _0x2a4e96={};var _0x5297a9={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x5cfbc5[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x400d44,null))['then'](function(_0x3af8dc){if(_0x3af8dc){_0x2a4e96[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5a')][_0x458c('0x29')]);_0x2a4e96[_0x458c('0x2d')]=_['keys'](_0x5cfbc5[_0x458c('0x2d')]);_0x2a4e96[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2a4e96[_0x458c('0x31')],_0x2a4e96[_0x458c('0x2d')]);_0x2c70c3[_0x458c('0x32')]=_['intersection'](_0x2a4e96[_0x458c('0x31')],qs[_0x458c('0x33')](_0x5cfbc5['query']['fields']));_0x2c70c3[_0x458c('0x32')]=_0x2c70c3[_0x458c('0x32')]['length']?_0x2c70c3[_0x458c('0x32')]:_0x2a4e96[_0x458c('0x31')];if(!_0x5cfbc5['query'][_0x458c('0x34')](_0x458c('0x53'))){_0x2c70c3['limit']=qs[_0x458c('0x1a')](_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x1a')]);_0x2c70c3[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x2c70c3['order']=qs[_0x458c('0x35')](_0x5cfbc5[_0x458c('0x2d')]['sort']);_0x2c70c3['where']=qs[_0x458c('0x2f')](_['pick'](_0x5cfbc5['query'],_0x2a4e96[_0x458c('0x2f')]));_0x2c70c3[_0x458c('0x36')]['CampaignId']=_0x3af8dc['id'];if(_0x5cfbc5[_0x458c('0x2d')]['filter']){_0x2c70c3[_0x458c('0x36')]=_[_0x458c('0x38')](_0x2c70c3[_0x458c('0x36')],{'$or':_['map'](_0x2c70c3['attributes'],function(_0x2dd9c2){var _0x31fc1c={};_0x31fc1c[_0x2dd9c2]={'$like':'%'+_0x5cfbc5[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x31fc1c;})});}_0x2c70c3=_['merge']({},_0x2c70c3,_0x5cfbc5[_0x458c('0x39')]);return db[_0x458c('0x5a')][_0x458c('0x1b')]({'where':_0x2c70c3[_0x458c('0x36')]})[_0x458c('0x22')](function(_0x5ba396){_0x5297a9[_0x458c('0x1b')]=_0x5ba396;if(_0x5cfbc5['query']['includeAll']){_0x2c70c3[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x5a')][_0x458c('0x56')](_0x2c70c3);})['then'](function(_0x8b4e9d){_0x5297a9[_0x458c('0x3b')]=_0x8b4e9d;return _0x5297a9;});}})['then'](respondWithFilteredResult(_0x400d44,_0x2c70c3))['catch'](handleError(_0x400d44,null));};exports[_0x458c('0x5b')]=function(_0x184494,_0x456a61,_0x2f679c){var _0x4c8d43={'raw':!![],'where':{}};var _0x5a6fcd={};var _0x1c7023={'count':0x0,'rows':[]};return db[_0x458c('0x3a')][_0x458c('0x51')]({'where':{'id':_0x184494[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x456a61,null))[_0x458c('0x22')](function(_0x57d2db){if(_0x57d2db){_0x5a6fcd[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5c')][_0x458c('0x29')]);_0x5a6fcd[_0x458c('0x2d')]=_['keys'](_0x184494[_0x458c('0x2d')]);_0x5a6fcd['filters']=_[_0x458c('0x30')](_0x5a6fcd[_0x458c('0x31')],_0x5a6fcd[_0x458c('0x2d')]);_0x4c8d43[_0x458c('0x32')]=_[_0x458c('0x30')](_0x5a6fcd[_0x458c('0x31')],qs[_0x458c('0x33')](_0x184494[_0x458c('0x2d')]['fields']));_0x4c8d43[_0x458c('0x32')]=_0x4c8d43['attributes'][_0x458c('0x3e')]?_0x4c8d43[_0x458c('0x32')]:_0x5a6fcd[_0x458c('0x31')];if(!_0x184494[_0x458c('0x2d')][_0x458c('0x34')]('nolimit')){_0x4c8d43[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x184494[_0x458c('0x2d')][_0x458c('0x1a')]);_0x4c8d43[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x184494[_0x458c('0x2d')][_0x458c('0x1c')]);}_0x4c8d43[_0x458c('0x54')]=qs[_0x458c('0x35')](_0x184494[_0x458c('0x2d')][_0x458c('0x35')]);_0x4c8d43['where']=qs['filters'](_[_0x458c('0x55')](_0x184494[_0x458c('0x2d')],_0x5a6fcd['filters']));_0x4c8d43[_0x458c('0x36')][_0x458c('0x57')]=_0x57d2db['id'];if(_0x184494[_0x458c('0x2d')][_0x458c('0x37')]){_0x4c8d43['where']=_[_0x458c('0x38')](_0x4c8d43[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x4c8d43[_0x458c('0x32')],function(_0x532758){var _0x389ed0={};_0x389ed0[_0x532758]={'$like':'%'+_0x184494[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x389ed0;})});}_0x4c8d43=_[_0x458c('0x38')]({},_0x4c8d43,_0x184494[_0x458c('0x39')]);return db['CmHopperBlack'][_0x458c('0x1b')]({'where':_0x4c8d43[_0x458c('0x36')]})[_0x458c('0x22')](function(_0x4dd870){_0x1c7023['count']=_0x4dd870;if(_0x184494['query'][_0x458c('0x49')]){_0x4c8d43[_0x458c('0x3f')]=[{'all':!![]}];}return db[_0x458c('0x5c')][_0x458c('0x56')](_0x4c8d43);})[_0x458c('0x22')](function(_0xadcbc1){_0x1c7023[_0x458c('0x3b')]=_0xadcbc1;return _0x1c7023;});}})[_0x458c('0x22')](respondWithFilteredResult(_0x456a61,_0x4c8d43))[_0x458c('0x3c')](handleError(_0x456a61,null));};exports[_0x458c('0x5d')]=function(_0xd3e523,_0x3efc5c,_0x5c17f4){var _0x227fc5={};var _0x2e4bc4={};var _0x2c5822;var _0x1c3b95;return db[_0x458c('0x3a')]['findOne']({'where':{'id':_0xd3e523[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x3efc5c,null))[_0x458c('0x22')](function(_0x51d4e1){if(_0x51d4e1){_0x2c5822=_0x51d4e1;_0x2e4bc4[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5e')][_0x458c('0x29')]);_0x2e4bc4['query']=_[_0x458c('0x2e')](_0xd3e523['query']);_0x2e4bc4[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x2e4bc4['model'],_0x2e4bc4[_0x458c('0x2d')]);_0x227fc5[_0x458c('0x32')]=_[_0x458c('0x30')](_0x2e4bc4['model'],qs['fields'](_0xd3e523[_0x458c('0x2d')][_0x458c('0x33')]));_0x227fc5[_0x458c('0x32')]=_0x227fc5['attributes'][_0x458c('0x3e')]?_0x227fc5[_0x458c('0x32')]:_0x2e4bc4[_0x458c('0x31')];_0x227fc5[_0x458c('0x54')]=qs['sort'](_0xd3e523['query'][_0x458c('0x35')]);_0x227fc5[_0x458c('0x36')]=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0xd3e523[_0x458c('0x2d')],_0x2e4bc4[_0x458c('0x2f')]));if(_0xd3e523['query'][_0x458c('0x37')]){_0x227fc5[_0x458c('0x36')]=_[_0x458c('0x38')](_0x227fc5[_0x458c('0x36')],{'$or':_[_0x458c('0x2c')](_0x227fc5[_0x458c('0x32')],function(_0x98206f){var _0x2955ef={};_0x2955ef[_0x98206f]={'$like':'%'+_0xd3e523[_0x458c('0x2d')][_0x458c('0x37')]+'%'};return _0x2955ef;})});}_0x227fc5=_[_0x458c('0x38')]({},_0x227fc5,_0xd3e523['options']);return _0x2c5822[_0x458c('0x5d')](_0x227fc5);}})['then'](function(_0x5664b6){if(_0x5664b6){_0x1c3b95=_0x5664b6['length'];if(!_0xd3e523[_0x458c('0x2d')][_0x458c('0x34')](_0x458c('0x53'))){_0x227fc5[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0xd3e523['query'][_0x458c('0x1a')]);_0x227fc5[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0xd3e523[_0x458c('0x2d')][_0x458c('0x1c')]);}return _0x2c5822[_0x458c('0x5d')](_0x227fc5);}})[_0x458c('0x22')](function(_0x478a51){if(_0x478a51){return _0x478a51?{'count':_0x1c3b95,'rows':_0x478a51}:null;}})[_0x458c('0x22')](respondWithResult(_0x3efc5c,null))[_0x458c('0x3c')](handleError(_0x3efc5c,null));};exports[_0x458c('0x5f')]=function(_0x3e7910,_0x14336c,_0x4765eb){var _0x386b1a,_0x518898;var _0x4a895d=[];var _0x31087c=moment()[_0x458c('0x60')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x3e7910['params']['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x14336c,null))[_0x458c('0x22')](function(_0x21269d){if(_0x21269d){_0x518898=_0x21269d;return _0x21269d[_0x458c('0x5f')](_0x3e7910[_0x458c('0x42')][_0x458c('0x61')],_[_0x458c('0x4a')](_0x3e7910[_0x458c('0x42')],[_0x458c('0x61'),'id'])||{});}return null;})[_0x458c('0x62')](function(_0xef131e){var _0x46ad33;var _0x529e04;_0x386b1a=_0xef131e||[];var _0x3d03fa=[];if(_0xef131e){for(var _0x200187=0x0;_0x200187<_0xef131e['length'];_0x200187+=0x1){var _0x563921=_0xef131e[_0x200187]['get']({'plain':!![]});_0x518898[_0x458c('0x63')]=_0x3e7910[_0x458c('0x42')][_0x458c('0x63')]?_0x3e7910['body'][_0x458c('0x63')]:_0x518898[_0x458c('0x63')];switch(_0x518898[_0x458c('0x63')]){case _0x458c('0x64'):_0x46ad33=squel[_0x458c('0x65')]()['into'](_0x458c('0x66'))[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),_0x458c('0x6a'),_0x458c('0x6b'),_0x458c('0x57'),_0x458c('0x4b'),_0x458c('0x4c')],squel['select']()[_0x458c('0x6c')](_0x458c('0x68'),'phone')['field'](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')][_0x458c('0x6f')](),_0x458c('0x6b'))['field'](_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),_0x458c('0x57'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')](_0x458c('0x72'))['where'](_0x458c('0x73'),_0x563921['CmListId']['toString']())[_0x458c('0x36')](_0x458c('0x74'))[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()[_0x458c('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0x458c('0x70')](_0x458c('0x77'))['where']('CampaignId\x20=\x20?',_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]()))[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()['field'](_0x458c('0x78'))[_0x458c('0x70')](_0x458c('0x66'))['where']('CampaignId\x20=\x20?',_0x3e7910[_0x458c('0x3d')]['id']['toString']())))[_0x458c('0x6f')]();break;case _0x458c('0x79'):_0x46ad33=squel[_0x458c('0x65')]()[_0x458c('0x7a')](_0x458c('0x66'))[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),'ContactId',_0x458c('0x6b'),_0x458c('0x57'),'createdAt','updatedAt'],squel['select']()['field'](_0x458c('0x68'),_0x458c('0x68'))['field'](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')]['toString'](),'ListId')[_0x458c('0x6c')](_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),'CampaignId')[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')]('cm_contacts')['where'](_0x458c('0x72'))[_0x458c('0x36')]('ListId\x20=\x20?',_0x563921[_0x458c('0x6e')][_0x458c('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x458c('0x36')](_0x458c('0x75'),squel[_0x458c('0x76')]()[_0x458c('0x6c')](_0x458c('0x78'))['from'](_0x458c('0x66'))[_0x458c('0x36')](_0x458c('0x7b'),_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]())))[_0x458c('0x6f')]();break;default:_0x46ad33=squel[_0x458c('0x65')]()['into']('cm_hopper')[_0x458c('0x67')]([_0x458c('0x68'),_0x458c('0x69'),_0x458c('0x6a'),'ListId','CampaignId',_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()[_0x458c('0x6c')](_0x458c('0x68'),_0x458c('0x68'))[_0x458c('0x6c')](_0x458c('0x6d'),_0x458c('0x69'))[_0x458c('0x6c')]('id','ContactId')[_0x458c('0x6c')](_0x563921[_0x458c('0x6e')][_0x458c('0x6f')](),'ListId')[_0x458c('0x6c')](_0x3e7910['params']['id'][_0x458c('0x6f')](),_0x458c('0x57'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))[_0x458c('0x6c')]('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')]('deletedAt\x20IS\x20NULL')[_0x458c('0x36')](_0x458c('0x73'),_0x563921[_0x458c('0x6e')]['toString']())[_0x458c('0x36')](_0x458c('0x74')))[_0x458c('0x6f')]();}_0x529e04=squel['insert']()['into'](_0x458c('0x7c'))['fromQuery'](['cmHopperId',_0x458c('0x69'),_0x458c('0x68'),_0x458c('0x7d'),_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()[_0x458c('0x6c')]('h.id','id')[_0x458c('0x6c')](_0x458c('0x6d'),'scheduledAt')[_0x458c('0x6c')](_0x458c('0x7e'),_0x458c('0x68'))['field']('ci.OrderBY',_0x458c('0x7d'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4b'))['field']('\x27'+_0x31087c+'\x27',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x7f'),'ci')['join'](_0x458c('0x66'),'h',_0x458c('0x80'))[_0x458c('0x36')]('h.ListId\x20=\x20?',_0x563921[_0x458c('0x6e')]['toString']())['where']('h.CampaignId=?',_0x3e7910[_0x458c('0x3d')]['id'][_0x458c('0x6f')]())[_0x458c('0x36')](_0x458c('0x81'),_0x31087c))[_0x458c('0x6f')]();_0x3d03fa[_0x458c('0x82')](db[_0x458c('0x83')]['query'](_0x46ad33));_0x4a895d['push'](db['sequelize'][_0x458c('0x2d')](_0x529e04));}return BPromise[_0x458c('0x84')](_0x3d03fa);}})[_0x458c('0x22')](function(){return BPromise[_0x458c('0x84')](_0x4a895d);})['then'](function(){return _0x386b1a;})[_0x458c('0x22')](respondWithResult(_0x14336c,null))[_0x458c('0x3c')](handleError(_0x14336c,null));};exports['removeLists']=function(_0x3029c2,_0x5414a4,_0x2fa7b3){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x3029c2[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x5414a4,null))[_0x458c('0x22')](function(_0x4cf5d5){if(_0x4cf5d5){return _0x4cf5d5[_0x458c('0x85')](_0x3029c2['query'][_0x458c('0x61')]);}})['then'](function(_0xba9d38){if(_0xba9d38){return db[_0x458c('0x52')][_0x458c('0x23')]({'where':{'ListId':_0x3029c2['query']['ids'],'CampaignId':_0x3029c2[_0x458c('0x3d')]['id']}})['then'](function(){return _0xba9d38;});}})[_0x458c('0x22')](respondWithStatusCode(_0x5414a4,null))['catch'](handleError(_0x5414a4,null));};exports['getBlackLists']=function(_0x496fed,_0x4f6924,_0x31f215){var _0x42067f={};var _0x140bca={};var _0x2386a8;var _0x438edd;return db['Campaign'][_0x458c('0x51')]({'where':{'id':_0x496fed[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x4f6924,null))['then'](function(_0x3320fc){if(_0x3320fc){_0x2386a8=_0x3320fc;_0x140bca[_0x458c('0x31')]=_[_0x458c('0x2e')](db[_0x458c('0x5e')][_0x458c('0x29')]);_0x140bca[_0x458c('0x2d')]=_[_0x458c('0x2e')](_0x496fed[_0x458c('0x2d')]);_0x140bca[_0x458c('0x2f')]=_[_0x458c('0x30')](_0x140bca['model'],_0x140bca[_0x458c('0x2d')]);_0x42067f[_0x458c('0x32')]=_[_0x458c('0x30')](_0x140bca[_0x458c('0x31')],qs[_0x458c('0x33')](_0x496fed['query'][_0x458c('0x33')]));_0x42067f[_0x458c('0x32')]=_0x42067f[_0x458c('0x32')][_0x458c('0x3e')]?_0x42067f['attributes']:_0x140bca['model'];_0x42067f['order']=qs[_0x458c('0x35')](_0x496fed[_0x458c('0x2d')][_0x458c('0x35')]);_0x42067f['where']=qs[_0x458c('0x2f')](_[_0x458c('0x55')](_0x496fed['query'],_0x140bca[_0x458c('0x2f')]));if(_0x496fed['query'][_0x458c('0x37')]){_0x42067f[_0x458c('0x36')]=_['merge'](_0x42067f[_0x458c('0x36')],{'$or':_['map'](_0x42067f['attributes'],function(_0x13fcff){var _0x55fcf7={};_0x55fcf7[_0x13fcff]={'$like':'%'+_0x496fed['query'][_0x458c('0x37')]+'%'};return _0x55fcf7;})});}_0x42067f=_[_0x458c('0x38')]({},_0x42067f,_0x496fed['options']);return _0x2386a8[_0x458c('0x86')](_0x42067f);}})[_0x458c('0x22')](function(_0x8914b){if(_0x8914b){_0x438edd=_0x8914b['length'];if(!_0x496fed['query'][_0x458c('0x34')]('nolimit')){_0x42067f[_0x458c('0x1a')]=qs[_0x458c('0x1a')](_0x496fed[_0x458c('0x2d')]['limit']);_0x42067f[_0x458c('0x1c')]=qs[_0x458c('0x1c')](_0x496fed[_0x458c('0x2d')][_0x458c('0x1c')]);}return _0x2386a8['getBlackLists'](_0x42067f);}})[_0x458c('0x22')](function(_0x574380){if(_0x574380){return _0x574380?{'count':_0x438edd,'rows':_0x574380}:null;}})[_0x458c('0x22')](respondWithResult(_0x4f6924,null))[_0x458c('0x3c')](handleError(_0x4f6924,null));};exports[_0x458c('0x87')]=function(_0x5b9701,_0x59bc3a,_0x1244d1){var _0x4ff89f,_0x4f009b;var _0x576ba1=[];var _0x4ccdd6=moment()[_0x458c('0x60')](_0x458c('0x88'));return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x5b9701[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0x59bc3a,null))[_0x458c('0x22')](function(_0xd0ab84){if(_0xd0ab84){_0x4f009b=_0xd0ab84;return _0xd0ab84[_0x458c('0x87')](_0x5b9701[_0x458c('0x42')]['ids'],_['omit'](_0x5b9701[_0x458c('0x42')],[_0x458c('0x61'),'id'])||{});}return null;})['spread'](function(_0x4a88fd){var _0x39a128;var _0x429ba2;_0x4ff89f=_0x4a88fd||[];var _0x5e06dd=[];if(_0x4a88fd){for(var _0x146162=0x0;_0x146162<_0x4a88fd[_0x458c('0x3e')];_0x146162+=0x1){var _0x4c45df=_0x4a88fd[_0x146162][_0x458c('0x24')]({'plain':!![]});_0x39a128=squel['insert']()[_0x458c('0x7a')](_0x458c('0x89'))[_0x458c('0x67')](['phone','ContactId',_0x458c('0x6b'),_0x458c('0x57'),_0x458c('0x4b'),_0x458c('0x4c')],squel[_0x458c('0x76')]()['field']('phone',_0x458c('0x68'))[_0x458c('0x6c')]('id',_0x458c('0x6a'))[_0x458c('0x6c')](_0x4c45df[_0x458c('0x6e')]['toString'](),'ListId')['field'](_0x5b9701[_0x458c('0x3d')]['id'][_0x458c('0x6f')](),_0x458c('0x57'))[_0x458c('0x6c')](_0x458c('0x6d'),'createdAt')['field']('NOW()',_0x458c('0x4c'))[_0x458c('0x70')](_0x458c('0x71'))[_0x458c('0x36')](_0x458c('0x72'))['where'](_0x458c('0x73'),_0x4c45df['CmListId'][_0x458c('0x6f')]())[_0x458c('0x36')](_0x458c('0x74')))['toString']();_0x5e06dd[_0x458c('0x82')](db['sequelize'][_0x458c('0x2d')](_0x39a128));}return BPromise[_0x458c('0x84')](_0x5e06dd);}})['then'](function(){return _0x4ff89f;})[_0x458c('0x22')](respondWithResult(_0x59bc3a,null))[_0x458c('0x3c')](handleError(_0x59bc3a,null));};exports['removeBlackLists']=function(_0x45d7bc,_0xbf348,_0x11c432){return db[_0x458c('0x3a')][_0x458c('0x40')]({'where':{'id':_0x45d7bc[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](handleEntityNotFound(_0xbf348,null))[_0x458c('0x22')](function(_0x43dc50){if(_0x43dc50){return _0x43dc50[_0x458c('0x8a')](_0x45d7bc[_0x458c('0x2d')][_0x458c('0x61')]);}})[_0x458c('0x22')](function(_0x561ee0){if(_0x561ee0){return db[_0x458c('0x5c')][_0x458c('0x23')]({'where':{'ListId':_0x45d7bc['query']['ids'],'CampaignId':_0x45d7bc[_0x458c('0x3d')]['id']}})[_0x458c('0x22')](function(){return _0x561ee0;});}})['then'](respondWithStatusCode(_0xbf348,null))[_0x458c('0x3c')](handleError(_0xbf348,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fd3958d..378243e 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2ce447,_0x2b3f3b){var _0x564b8b=function(_0x49a3ef){while(--_0x49a3ef){_0x2ce447['push'](_0x2ce447['shift']());}};_0x564b8b(++_0x2b3f3b);}(_0x7a54,0x106));var _0x47a5=function(_0xadfdc9,_0x526eb5){_0xadfdc9=_0xadfdc9-0x0;var _0xc49bad=_0x7a54[_0xadfdc9];return _0xc49bad;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index febf351..dfb82ab 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 _0xc524=['message','info','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc524,0x1bf));var _0x4c52=function(_0x4b8f15,_0x2ac633){_0x4b8f15=_0x4b8f15-0x0;var _0x5b554c=_0xc524[_0x4b8f15];return _0x5b554c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c52('0x0'));var BPromise=require(_0x4c52('0x1'));var rs=require(_0x4c52('0x2'));var fs=require('fs');var Redis=require(_0x4c52('0x3'));var db=require(_0x4c52('0x4'))['db'];var utils=require(_0x4c52('0x5'));var logger=require(_0x4c52('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c52('0x7'));var client=jayson[_0x4c52('0x8')][_0x4c52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4756e3,_0x5378d3,_0x4ea85e){return new BPromise(function(_0x39591b,_0x212216){return client['request'](_0x4756e3,_0x4ea85e)[_0x4c52('0xa')](function(_0x231cda){logger['info'](_0x4c52('0xb'),_0x5378d3,_0x4c52('0xc'));logger[_0x4c52('0xd')](_0x4c52('0xe'),_0x5378d3,_0x4c52('0xc'),JSON[_0x4c52('0xf')](_0x231cda));if(_0x231cda[_0x4c52('0x10')]){if(_0x231cda[_0x4c52('0x10')][_0x4c52('0x11')]===0x1f4){logger['error'](_0x4c52('0xb'),_0x5378d3,_0x231cda[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x212216(_0x231cda['error']['message']);}logger[_0x4c52('0x10')]('Campaign,\x20%s,\x20%s',_0x5378d3,_0x231cda[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x39591b(_0x231cda['error'][_0x4c52('0x12')]);}else{logger[_0x4c52('0x13')](_0x4c52('0xb'),_0x5378d3,_0x4c52('0xc'));_0x39591b(_0x231cda[_0x4c52('0x14')][_0x4c52('0x12')]);}})[_0x4c52('0x15')](function(_0x1dabe0){logger[_0x4c52('0x10')](_0x4c52('0xb'),_0x5378d3,_0x1dabe0);_0x212216(_0x1dabe0);});});}exports[_0x4c52('0x16')]=function(_0x1f036c){var _0x35cffb=this;return new Promise(function(_0x2a498c,_0x146c35){return db[_0x4c52('0x17')]['findAll']({'raw':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x19')]===undefined?!![]:![]:!![],'where':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1a')]||null:null,'attributes':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1b')]||null:null,'limit':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1c')]||null:null,'include':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')]['include']?_['map'](_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1d')],function(_0x13cf34){return{'model':db[_0x13cf34[_0x4c52('0x1e')]],'as':_0x13cf34['as'],'attributes':_0x13cf34[_0x4c52('0x1b')],'include':_0x13cf34[_0x4c52('0x1d')]?_['map'](_0x13cf34[_0x4c52('0x1d')],function(_0x19e4b9){return{'model':db[_0x19e4b9['model']],'as':_0x19e4b9['as'],'attributes':_0x19e4b9[_0x4c52('0x1b')],'include':_0x19e4b9[_0x4c52('0x1d')]?_['map'](_0x19e4b9[_0x4c52('0x1d')],function(_0x2385a9){return{'model':db[_0x2385a9[_0x4c52('0x1e')]],'as':_0x2385a9['as'],'attributes':_0x2385a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c52('0xa')](function(_0x3500aa){logger[_0x4c52('0x13')](_0x4c52('0x16'),_0x1f036c);logger[_0x4c52('0xd')](_0x4c52('0x16'),_0x1f036c,JSON[_0x4c52('0xf')](_0x3500aa));_0x2a498c(_0x3500aa);})[_0x4c52('0x15')](function(_0x74eae1){logger[_0x4c52('0x10')]('GetCampaign',_0x74eae1[_0x4c52('0x12')],_0x1f036c);_0x146c35(_0x35cffb[_0x4c52('0x10')](0x1f4,_0x74eae1[_0x4c52('0x12')]));});});}; \ No newline at end of file +var _0xf6fb=['map','model','debug','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','include'];(function(_0x271b53,_0x48386e){var _0x8660ef=function(_0x3f8886){while(--_0x3f8886){_0x271b53['push'](_0x271b53['shift']());}};_0x8660ef(++_0x48386e);}(_0xf6fb,0x111));var _0xbf6f=function(_0x3d62c4,_0x134b8c){_0x3d62c4=_0x3d62c4-0x0;var _0x114fef=_0xf6fb[_0x3d62c4];return _0x114fef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf6f('0x0'));var BPromise=require(_0xbf6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf6f('0x2'));var db=require(_0xbf6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf6f('0x4'))('rpc');var config=require(_0xbf6f('0x5'));var jayson=require(_0xbf6f('0x6'));var client=jayson[_0xbf6f('0x7')][_0xbf6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d8ecf,_0x26bc7b,_0x9d0c63){return new BPromise(function(_0x43d56b,_0x5948cf){return client[_0xbf6f('0x9')](_0x3d8ecf,_0x9d0c63)[_0xbf6f('0xa')](function(_0x2ac2f8){logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,'request\x20sent');logger['debug'](_0xbf6f('0xd'),_0x26bc7b,_0xbf6f('0xe'),JSON[_0xbf6f('0xf')](_0x2ac2f8));if(_0x2ac2f8['error']){if(_0x2ac2f8[_0xbf6f('0x10')]['code']===0x1f4){logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')]['message']);return _0x5948cf(_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);}logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);return _0x43d56b(_0x2ac2f8['error'][_0xbf6f('0x11')]);}else{logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,_0xbf6f('0xe'));_0x43d56b(_0x2ac2f8[_0xbf6f('0x12')][_0xbf6f('0x11')]);}})[_0xbf6f('0x13')](function(_0x586f33){logger['error'](_0xbf6f('0xc'),_0x26bc7b,_0x586f33);_0x5948cf(_0x586f33);});});}exports[_0xbf6f('0x14')]=function(_0x21b485){var _0x4b3c33=this;return new Promise(function(_0x56b4da,_0x2a0537){return db[_0xbf6f('0x15')][_0xbf6f('0x16')]({'raw':_0x21b485[_0xbf6f('0x17')]?_0x21b485[_0xbf6f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x21b485['options']?_0x21b485[_0xbf6f('0x17')]['where']||null:null,'attributes':_0x21b485[_0xbf6f('0x17')]?_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x18')]||null:null,'limit':_0x21b485['options']?_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x19')]||null:null,'include':_0x21b485[_0xbf6f('0x17')]?_0x21b485['options'][_0xbf6f('0x1a')]?_['map'](_0x21b485[_0xbf6f('0x17')][_0xbf6f('0x1a')],function(_0xba4b6a){return{'model':db[_0xba4b6a['model']],'as':_0xba4b6a['as'],'attributes':_0xba4b6a[_0xbf6f('0x18')],'include':_0xba4b6a[_0xbf6f('0x1a')]?_[_0xbf6f('0x1b')](_0xba4b6a[_0xbf6f('0x1a')],function(_0x44d47f){return{'model':db[_0x44d47f[_0xbf6f('0x1c')]],'as':_0x44d47f['as'],'attributes':_0x44d47f['attributes'],'include':_0x44d47f[_0xbf6f('0x1a')]?_[_0xbf6f('0x1b')](_0x44d47f['include'],function(_0x506302){return{'model':db[_0x506302['model']],'as':_0x506302['as'],'attributes':_0x506302[_0xbf6f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3588c0){logger[_0xbf6f('0xb')](_0xbf6f('0x14'),_0x21b485);logger[_0xbf6f('0x1d')](_0xbf6f('0x14'),_0x21b485,JSON[_0xbf6f('0xf')](_0x3588c0));_0x56b4da(_0x3588c0);})[_0xbf6f('0x13')](function(_0x58c120){logger['error'](_0xbf6f('0x14'),_0x58c120[_0xbf6f('0x11')],_0x21b485);_0x2a0537(_0x4b3c33['error'](0x1f4,_0x58c120[_0xbf6f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e2d7d95..43d9e87 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 _0xaf85=['isAuthenticated','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','put','update','removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','/:id','show','get','/:id/hoppers'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xaf85,0x1e3));var _0x5af8=function(_0x5568ed,_0x61f3be){_0x5568ed=_0x5568ed-0x0;var _0x406c98=_0xaf85[_0x5568ed];return _0x406c98;};'use strict';var multer=require('multer');var util=require(_0x5af8('0x0'));var path=require('path');var timeout=require(_0x5af8('0x1'));var express=require(_0x5af8('0x2'));var router=express[_0x5af8('0x3')]();var fs_extra=require(_0x5af8('0x4'));var auth=require(_0x5af8('0x5'));var interaction=require(_0x5af8('0x6'));var config=require(_0x5af8('0x7'));var controller=require(_0x5af8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5af8('0x9'),auth['isAuthenticated'](),controller[_0x5af8('0xa')]);router[_0x5af8('0xb')](_0x5af8('0xc'),auth[_0x5af8('0xd')](),controller[_0x5af8('0xe')]);router[_0x5af8('0xb')]('/:id/hopper_histories',auth[_0x5af8('0xd')](),controller['getHopperHistories']);router[_0x5af8('0xb')](_0x5af8('0xf'),auth['isAuthenticated'](),controller[_0x5af8('0x10')]);router['get'](_0x5af8('0x11'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x12')]);router[_0x5af8('0xb')](_0x5af8('0x13'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x14')]);router[_0x5af8('0xb')](_0x5af8('0x15'),auth[_0x5af8('0xd')](),controller['getBlackLists']);router[_0x5af8('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5af8('0x17'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x18')]);router[_0x5af8('0x16')](_0x5af8('0x13'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x19')]);router[_0x5af8('0x16')](_0x5af8('0x15'),auth[_0x5af8('0xd')](),controller['addBlackLists']);router[_0x5af8('0x1a')](_0x5af8('0x9'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x1b')]);router['delete']('/:id',auth[_0x5af8('0xd')](),controller['destroy']);router['delete'](_0x5af8('0x13'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x1c')]);router['delete'](_0x5af8('0x15'),auth[_0x5af8('0xd')](),controller[_0x5af8('0x1d')]);module[_0x5af8('0x1e')]=router; \ No newline at end of file +var _0xf07a=['connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util'];(function(_0x2d2029,_0x30582b){var _0x575839=function(_0x5ed7de){while(--_0x5ed7de){_0x2d2029['push'](_0x2d2029['shift']());}};_0x575839(++_0x30582b);}(_0xf07a,0x86));var _0xaf07=function(_0x11fe8d,_0x19aba4){_0x11fe8d=_0x11fe8d-0x0;var _0x356099=_0xf07a[_0x11fe8d];return _0x356099;};'use strict';var multer=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var path=require('path');var timeout=require(_0xaf07('0x2'));var express=require(_0xaf07('0x3'));var router=express[_0xaf07('0x4')]();var fs_extra=require(_0xaf07('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf07('0x6'));var controller=require('./campaign.controller');router[_0xaf07('0x7')]('/',auth['isAuthenticated'](),controller[_0xaf07('0x8')]);router['get'](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xb')]);router[_0xaf07('0x7')](_0xaf07('0xc'),auth[_0xaf07('0xa')](),controller['getHoppers']);router[_0xaf07('0x7')](_0xaf07('0xd'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xe')]);router[_0xaf07('0x7')]('/:id/hopper_finals',auth[_0xaf07('0xa')](),controller[_0xaf07('0xf')]);router[_0xaf07('0x7')](_0xaf07('0x10'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x11')]);router['get']('/:id/lists',auth[_0xaf07('0xa')](),controller[_0xaf07('0x12')]);router['get']('/:id/blacklists',auth[_0xaf07('0xa')](),controller[_0xaf07('0x13')]);router[_0xaf07('0x14')]('/',auth[_0xaf07('0xa')](),controller[_0xaf07('0x15')]);router[_0xaf07('0x14')]('/:id/clone',auth[_0xaf07('0xa')](),controller[_0xaf07('0x16')]);router[_0xaf07('0x14')](_0xaf07('0x17'),auth['isAuthenticated'](),controller[_0xaf07('0x18')]);router['post'](_0xaf07('0x19'),auth['isAuthenticated'](),controller[_0xaf07('0x1a')]);router[_0xaf07('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xaf07('0x1c')]);router[_0xaf07('0x1d')](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x1e')]);router[_0xaf07('0x1d')](_0xaf07('0x17'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x1f')]);router[_0xaf07('0x1d')](_0xaf07('0x19'),auth[_0xaf07('0xa')](),controller[_0xaf07('0x20')]);module[_0xaf07('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index cd4a3a4..c9765fa 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 _0xc287=['sequelize','exports','STRING','medium','VIRTUAL','getDataValue','key'];(function(_0x9cd801,_0x3bc478){var _0x10a3f8=function(_0x4bba52){while(--_0x4bba52){_0x9cd801['push'](_0x9cd801['shift']());}};_0x10a3f8(++_0x3bc478);}(_0xc287,0xe0));var _0x7c28=function(_0x334578,_0x4f68f1){_0x334578=_0x334578-0x0;var _0x11d272=_0xc287[_0x334578];return _0x11d272;};'use strict';var Sequelize=require(_0x7c28('0x0'));module[_0x7c28('0x1')]={'key':{'type':Sequelize[_0x7c28('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x7c28('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7c28('0x4')],'get':function(){return this[_0x7c28('0x5')](_0x7c28('0x6'));}}}; \ No newline at end of file +var _0x1a31=['exports','STRING','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x15fef7,_0xbc02c5){var _0x13bb57=function(_0x488ce0){while(--_0x488ce0){_0x15fef7['push'](_0x15fef7['shift']());}};_0x13bb57(++_0xbc02c5);}(_0x1a31,0x16f));var _0x11a3=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1a31[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x11a3('0x0'));module[_0x11a3('0x1')]={'key':{'type':Sequelize[_0x11a3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x11a3('0x3')],'length':_0x11a3('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x11a3('0x5')],'get':function(){return this[_0x11a3('0x6')](_0x11a3('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2597cc9..13869f1 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 _0x47d4=['sort','where','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47d4,0x17e));var _0x447d=function(_0x451e65,_0x4efdd8){_0x451e65=_0x451e65-0x0;var _0x45fbec=_0x47d4[_0x451e65];return _0x45fbec;};'use strict';var emlformat=require(_0x447d('0x0'));var rimraf=require(_0x447d('0x1'));var zipdir=require(_0x447d('0x2'));var jsonpatch=require(_0x447d('0x3'));var rp=require(_0x447d('0x4'));var moment=require(_0x447d('0x5'));var BPromise=require(_0x447d('0x6'));var Mustache=require('mustache');var util=require(_0x447d('0x7'));var path=require(_0x447d('0x8'));var sox=require('sox');var csv=require(_0x447d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x447d('0xa'));var _=require(_0x447d('0xb'));var squel=require(_0x447d('0xc'));var crypto=require('crypto');var jsforce=require(_0x447d('0xd'));var deskjs=require(_0x447d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x447d('0xf'));var Papa=require(_0x447d('0x10'));var Redis=require(_0x447d('0x11'));var authService=require(_0x447d('0x12'));var qs=require(_0x447d('0x13'));var as=require(_0x447d('0x14'));var hardwareService=require(_0x447d('0x15'));var logger=require('../../config/logger')(_0x447d('0x16'));var utils=require(_0x447d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x447d('0x18'));var db=require(_0x447d('0x19'))['db'];function respondWithStatusCode(_0x1a9970,_0x1d50d9){_0x1d50d9=_0x1d50d9||0xcc;return function(_0x5c661d){if(_0x5c661d){return _0x1a9970[_0x447d('0x1a')](_0x1d50d9);}return _0x1a9970[_0x447d('0x1b')](_0x1d50d9)[_0x447d('0x1c')]();};}function respondWithResult(_0x3e31be,_0x203997){_0x203997=_0x203997||0xc8;return function(_0x3fd43f){if(_0x3fd43f){return _0x3e31be['status'](_0x203997)[_0x447d('0x1d')](_0x3fd43f);}};}function respondWithFilteredResult(_0x510aa7,_0x36439f){return function(_0x18a407){if(_0x18a407){var _0x3e6c26=typeof _0x36439f[_0x447d('0x1e')]===_0x447d('0x1f')&&typeof _0x36439f[_0x447d('0x20')]===_0x447d('0x1f');var _0x2fde2c=_0x18a407[_0x447d('0x21')];var _0x79f191=_0x3e6c26?0x0:_0x36439f[_0x447d('0x1e')];var _0x1260c2=_0x3e6c26?_0x18a407['count']:_0x36439f[_0x447d('0x1e')]+_0x36439f[_0x447d('0x20')];var _0x17025e;if(_0x1260c2>=_0x2fde2c){_0x1260c2=_0x2fde2c;_0x17025e=0xc8;}else{_0x17025e=0xce;}_0x510aa7[_0x447d('0x1b')](_0x17025e);return _0x510aa7[_0x447d('0x22')](_0x447d('0x23'),_0x79f191+'-'+_0x1260c2+'/'+_0x2fde2c)[_0x447d('0x1d')](_0x18a407);}return null;};}function patchUpdates(_0x2c2d69){return function(_0x35775a){try{jsonpatch[_0x447d('0x24')](_0x35775a,_0x2c2d69,!![]);}catch(_0x3c34f0){return BPromise['reject'](_0x3c34f0);}return _0x35775a[_0x447d('0x25')]();};}function saveUpdates(_0x2b48a4,_0x582420){return function(_0x4f681c){if(_0x4f681c){return _0x4f681c[_0x447d('0x26')](_0x2b48a4)[_0x447d('0x27')](function(_0x387252){return _0x387252;});}return null;};}function removeEntity(_0x5a8c8f,_0x1d4560){return function(_0x523be0){if(_0x523be0){return _0x523be0[_0x447d('0x28')]()[_0x447d('0x27')](function(){var _0x3f203e=_0x523be0[_0x447d('0x29')]({'plain':!![]});var _0x236a29='CannedAnswers';return db[_0x447d('0x2a')][_0x447d('0x28')]({'where':{'type':_0x236a29,'resourceId':_0x3f203e['id']}})[_0x447d('0x27')](function(){return _0x523be0;});})[_0x447d('0x27')](function(){_0x5a8c8f[_0x447d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0783,_0x4c5f3b){return function(_0x12b5f6){if(!_0x12b5f6){_0x5a0783[_0x447d('0x1a')](0x194);}return _0x12b5f6;};}function handleError(_0x583e2c,_0x4bea99){_0x4bea99=_0x4bea99||0x1f4;return function(_0x32d87b){logger[_0x447d('0x2b')](_0x32d87b['stack']);if(_0x32d87b[_0x447d('0x2c')]){delete _0x32d87b[_0x447d('0x2c')];}_0x583e2c[_0x447d('0x1b')](_0x4bea99)[_0x447d('0x2d')](_0x32d87b);};}exports[_0x447d('0x2e')]=function(_0x3fddf2,_0x2fe076){var _0x3173a0={},_0xabf36e={},_0x2bfe83={'count':0x0,'rows':[]};var _0x15cfc1=_[_0x447d('0x2f')](db[_0x447d('0x30')][_0x447d('0x31')],function(_0x418ade){return{'name':_0x418ade[_0x447d('0x32')],'type':_0x418ade[_0x447d('0x33')][_0x447d('0x34')]};});_0xabf36e[_0x447d('0x35')]=_[_0x447d('0x2f')](_0x15cfc1,_0x447d('0x2c'));_0xabf36e[_0x447d('0x36')]=_[_0x447d('0x37')](_0x3fddf2['query']);_0xabf36e[_0x447d('0x38')]=_[_0x447d('0x39')](_0xabf36e[_0x447d('0x35')],_0xabf36e[_0x447d('0x36')]);_0x3173a0['attributes']=_[_0x447d('0x39')](_0xabf36e[_0x447d('0x35')],qs[_0x447d('0x3a')](_0x3fddf2[_0x447d('0x36')]['fields']));_0x3173a0[_0x447d('0x3b')]=_0x3173a0['attributes'][_0x447d('0x3c')]?_0x3173a0[_0x447d('0x3b')]:_0xabf36e[_0x447d('0x35')];if(!_0x3fddf2['query'][_0x447d('0x3d')](_0x447d('0x3e'))){_0x3173a0[_0x447d('0x20')]=qs[_0x447d('0x20')](_0x3fddf2[_0x447d('0x36')]['limit']);_0x3173a0[_0x447d('0x1e')]=qs[_0x447d('0x1e')](_0x3fddf2[_0x447d('0x36')]['offset']);}_0x3173a0['order']=qs[_0x447d('0x3f')](_0x3fddf2['query'][_0x447d('0x3f')]);_0x3173a0[_0x447d('0x40')]=qs[_0x447d('0x38')](_['pick'](_0x3fddf2[_0x447d('0x36')],_0xabf36e[_0x447d('0x38')]),_0x15cfc1);if(_0x3fddf2[_0x447d('0x36')][_0x447d('0x41')]){_0x3173a0[_0x447d('0x40')]=_[_0x447d('0x42')](_0x3173a0[_0x447d('0x40')],{'$or':[{'key':{'$like':'%'+_0x3fddf2[_0x447d('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x3fddf2[_0x447d('0x36')][_0x447d('0x41')]+'%'}}]});}_0x3173a0=_['merge']({},_0x3173a0,_0x3fddf2[_0x447d('0x43')]);var _0x485a13={'where':_0x3173a0[_0x447d('0x40')]};return db[_0x447d('0x30')][_0x447d('0x21')](_0x485a13)[_0x447d('0x27')](function(_0x2b8968){_0x2bfe83[_0x447d('0x21')]=_0x2b8968;if(_0x3fddf2[_0x447d('0x36')][_0x447d('0x44')]){_0x3173a0[_0x447d('0x45')]=[{'all':!![]}];}return db[_0x447d('0x30')][_0x447d('0x46')](_0x3173a0);})[_0x447d('0x27')](function(_0x4367e4){_0x2bfe83['rows']=_0x4367e4;return _0x2bfe83;})[_0x447d('0x27')](respondWithFilteredResult(_0x2fe076,_0x3173a0))[_0x447d('0x47')](handleError(_0x2fe076,null));};exports['show']=function(_0x5bc2dc,_0x2ad35d){var _0x70d493={'raw':!![],'where':{'id':_0x5bc2dc[_0x447d('0x48')]['id']}},_0x5ca593={};_0x5ca593[_0x447d('0x35')]=_['keys'](db[_0x447d('0x30')][_0x447d('0x31')]);_0x5ca593[_0x447d('0x36')]=_['keys'](_0x5bc2dc[_0x447d('0x36')]);_0x5ca593['filters']=_[_0x447d('0x39')](_0x5ca593[_0x447d('0x35')],_0x5ca593[_0x447d('0x36')]);_0x70d493[_0x447d('0x3b')]=_[_0x447d('0x39')](_0x5ca593['model'],qs[_0x447d('0x3a')](_0x5bc2dc[_0x447d('0x36')][_0x447d('0x3a')]));_0x70d493['attributes']=_0x70d493['attributes'][_0x447d('0x3c')]?_0x70d493[_0x447d('0x3b')]:_0x5ca593[_0x447d('0x35')];if(_0x5bc2dc[_0x447d('0x36')][_0x447d('0x44')]){_0x70d493[_0x447d('0x45')]=[{'all':!![]}];}_0x70d493=_[_0x447d('0x42')]({},_0x70d493,_0x5bc2dc['options']);return db[_0x447d('0x30')][_0x447d('0x49')](_0x70d493)[_0x447d('0x27')](handleEntityNotFound(_0x2ad35d,null))[_0x447d('0x27')](respondWithResult(_0x2ad35d,null))[_0x447d('0x47')](handleError(_0x2ad35d,null));};exports[_0x447d('0x26')]=function(_0x36cf8a,_0xb65c09){if(_0x36cf8a['body']['id']){delete _0x36cf8a['body']['id'];}return db[_0x447d('0x30')][_0x447d('0x49')]({'where':{'id':_0x36cf8a[_0x447d('0x48')]['id']}})[_0x447d('0x27')](handleEntityNotFound(_0xb65c09,null))[_0x447d('0x27')](saveUpdates(_0x36cf8a['body'],null))['then'](respondWithResult(_0xb65c09,null))[_0x447d('0x47')](handleError(_0xb65c09,null));};exports[_0x447d('0x28')]=function(_0x2eb5a2,_0x48d62e){return db[_0x447d('0x30')][_0x447d('0x49')]({'where':{'id':_0x2eb5a2[_0x447d('0x48')]['id']}})['then'](handleEntityNotFound(_0x48d62e,null))[_0x447d('0x27')](removeEntity(_0x48d62e,null))[_0x447d('0x47')](handleError(_0x48d62e,null));};exports[_0x447d('0x4a')]=function(_0x313f26,_0x43ee42){var _0x273ef3={'key':_0x313f26[_0x447d('0x4b')][_0x447d('0x34')]};if(_0x313f26[_0x447d('0x4b')]['MailAccountId']){_0x273ef3[_0x447d('0x4c')]=_0x313f26[_0x447d('0x4b')]['MailAccountId'];}else if(_0x313f26['body'][_0x447d('0x4d')]){_0x273ef3[_0x447d('0x4d')]=_0x313f26[_0x447d('0x4b')][_0x447d('0x4d')];}else if(_0x313f26[_0x447d('0x4b')][_0x447d('0x4e')]){_0x273ef3[_0x447d('0x4e')]=_0x313f26[_0x447d('0x4b')][_0x447d('0x4e')];}else if(_0x313f26[_0x447d('0x4b')][_0x447d('0x4f')]){_0x273ef3[_0x447d('0x4f')]=_0x313f26[_0x447d('0x4b')][_0x447d('0x4f')];}return db[_0x447d('0x30')][_0x447d('0x49')]({'where':_0x273ef3})[_0x447d('0x27')](function(_0x1cddf7){if(_0x1cddf7){throw new db['Sequelize'][(_0x447d('0x50'))](_0x447d('0x51'));}return db[_0x447d('0x30')][_0x447d('0x4a')](_0x313f26[_0x447d('0x4b')]);})['then'](function(_0x26d642){var _0x33de39=_0x313f26[_0x447d('0x52')][_0x447d('0x29')]({'plain':!![]});if(!_0x33de39)throw new Error(_0x447d('0x53'));if(_0x33de39[_0x447d('0x54')]==='user'){var _0x323091=_0x26d642[_0x447d('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x447d('0x49')]({'where':{'name':_0x447d('0x55'),'userProfileId':_0x33de39[_0x447d('0x56')]},'raw':!![]})['then'](function(_0x320f53){if(_0x320f53&&_0x320f53[_0x447d('0x57')]===0x0){return db[_0x447d('0x2a')][_0x447d('0x4a')]({'name':_0x323091['name'],'resourceId':_0x323091['id'],'type':_0x320f53[_0x447d('0x2c')],'sectionId':_0x320f53['id']},{})['then'](function(){return _0x26d642;});}else{return _0x26d642;}})['catch'](function(_0x2ec3ba){logger[_0x447d('0x2b')](_0x447d('0x58'),_0x2ec3ba);throw _0x2ec3ba;});}return _0x26d642;})[_0x447d('0x27')](respondWithResult(_0x43ee42,0xc9))[_0x447d('0x47')](handleError(_0x43ee42,null));}; \ No newline at end of file +var _0xb875=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x180b9b,_0x2121e2){var _0x1dae04=function(_0xbe5c27){while(--_0xbe5c27){_0x180b9b['push'](_0x180b9b['shift']());}};_0x1dae04(++_0x2121e2);}(_0xb875,0xf4));var _0x5b87=function(_0x4be53d,_0x1f1c6e){_0x4be53d=_0x4be53d-0x0;var _0x1ae3dd=_0xb875[_0x4be53d];return _0x1ae3dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b87('0x0'));var jsonpatch=require(_0x5b87('0x1'));var rp=require('request-promise');var moment=require(_0x5b87('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5b87('0x3'));var util=require(_0x5b87('0x4'));var path=require('path');var sox=require(_0x5b87('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b87('0x6'));var _=require(_0x5b87('0x7'));var squel=require(_0x5b87('0x8'));var crypto=require('crypto');var jsforce=require(_0x5b87('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5b87('0xa'));var querystring=require(_0x5b87('0xb'));var Papa=require(_0x5b87('0xc'));var Redis=require(_0x5b87('0xd'));var authService=require(_0x5b87('0xe'));var qs=require(_0x5b87('0xf'));var as=require(_0x5b87('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b87('0x11'))(_0x5b87('0x12'));var utils=require('../../config/utils');var config=require(_0x5b87('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b87('0x14'))['db'];function respondWithStatusCode(_0x384d77,_0x203279){_0x203279=_0x203279||0xcc;return function(_0x58638f){if(_0x58638f){return _0x384d77[_0x5b87('0x15')](_0x203279);}return _0x384d77['status'](_0x203279)['end']();};}function respondWithResult(_0x38750a,_0xcd3bc0){_0xcd3bc0=_0xcd3bc0||0xc8;return function(_0xb6d39d){if(_0xb6d39d){return _0x38750a[_0x5b87('0x16')](_0xcd3bc0)[_0x5b87('0x17')](_0xb6d39d);}};}function respondWithFilteredResult(_0x10f9d4,_0x328fb1){return function(_0x2c6032){if(_0x2c6032){var _0x563b1c=typeof _0x328fb1[_0x5b87('0x18')]===_0x5b87('0x19')&&typeof _0x328fb1[_0x5b87('0x1a')]===_0x5b87('0x19');var _0x558d0a=_0x2c6032[_0x5b87('0x1b')];var _0x475804=_0x563b1c?0x0:_0x328fb1[_0x5b87('0x18')];var _0x2af69d=_0x563b1c?_0x2c6032['count']:_0x328fb1[_0x5b87('0x18')]+_0x328fb1[_0x5b87('0x1a')];var _0x42a8c6;if(_0x2af69d>=_0x558d0a){_0x2af69d=_0x558d0a;_0x42a8c6=0xc8;}else{_0x42a8c6=0xce;}_0x10f9d4[_0x5b87('0x16')](_0x42a8c6);return _0x10f9d4['set'](_0x5b87('0x1c'),_0x475804+'-'+_0x2af69d+'/'+_0x558d0a)['json'](_0x2c6032);}return null;};}function patchUpdates(_0x581a2f){return function(_0x4ae8d5){try{jsonpatch[_0x5b87('0x1d')](_0x4ae8d5,_0x581a2f,!![]);}catch(_0x417deb){return BPromise[_0x5b87('0x1e')](_0x417deb);}return _0x4ae8d5[_0x5b87('0x1f')]();};}function saveUpdates(_0x493814,_0x14dc58){return function(_0x10e4cc){if(_0x10e4cc){return _0x10e4cc['update'](_0x493814)[_0x5b87('0x20')](function(_0x5d6d72){return _0x5d6d72;});}return null;};}function removeEntity(_0xf3d360,_0x75fcb9){return function(_0x129b40){if(_0x129b40){return _0x129b40[_0x5b87('0x21')]()[_0x5b87('0x20')](function(){var _0x488986=_0x129b40[_0x5b87('0x22')]({'plain':!![]});var _0x1170b8=_0x5b87('0x23');return db[_0x5b87('0x24')][_0x5b87('0x21')]({'where':{'type':_0x1170b8,'resourceId':_0x488986['id']}})[_0x5b87('0x20')](function(){return _0x129b40;});})[_0x5b87('0x20')](function(){_0xf3d360[_0x5b87('0x16')](0xcc)[_0x5b87('0x25')]();});}};}function handleEntityNotFound(_0x524ad8,_0x3c3c65){return function(_0x3e3616){if(!_0x3e3616){_0x524ad8[_0x5b87('0x15')](0x194);}return _0x3e3616;};}function handleError(_0x3c1095,_0x181615){_0x181615=_0x181615||0x1f4;return function(_0x31b619){logger[_0x5b87('0x26')](_0x31b619['stack']);if(_0x31b619['name']){delete _0x31b619[_0x5b87('0x27')];}_0x3c1095[_0x5b87('0x16')](_0x181615)[_0x5b87('0x28')](_0x31b619);};}exports[_0x5b87('0x29')]=function(_0x5d46de,_0x474c91){var _0x39d825={},_0x17a1bb={},_0x4c519a={'count':0x0,'rows':[]};var _0x3a63df=_[_0x5b87('0x2a')](db[_0x5b87('0x2b')]['rawAttributes'],function(_0x375d37){return{'name':_0x375d37[_0x5b87('0x2c')],'type':_0x375d37[_0x5b87('0x2d')][_0x5b87('0x2e')]};});_0x17a1bb[_0x5b87('0x2f')]=_['map'](_0x3a63df,_0x5b87('0x27'));_0x17a1bb[_0x5b87('0x30')]=_['keys'](_0x5d46de[_0x5b87('0x30')]);_0x17a1bb[_0x5b87('0x31')]=_[_0x5b87('0x32')](_0x17a1bb[_0x5b87('0x2f')],_0x17a1bb[_0x5b87('0x30')]);_0x39d825['attributes']=_[_0x5b87('0x32')](_0x17a1bb[_0x5b87('0x2f')],qs[_0x5b87('0x33')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x33')]));_0x39d825[_0x5b87('0x34')]=_0x39d825[_0x5b87('0x34')]['length']?_0x39d825[_0x5b87('0x34')]:_0x17a1bb[_0x5b87('0x2f')];if(!_0x5d46de[_0x5b87('0x30')]['hasOwnProperty'](_0x5b87('0x35'))){_0x39d825[_0x5b87('0x1a')]=qs[_0x5b87('0x1a')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x1a')]);_0x39d825['offset']=qs[_0x5b87('0x18')](_0x5d46de[_0x5b87('0x30')][_0x5b87('0x18')]);}_0x39d825[_0x5b87('0x36')]=qs[_0x5b87('0x37')](_0x5d46de['query']['sort']);_0x39d825[_0x5b87('0x38')]=qs[_0x5b87('0x31')](_[_0x5b87('0x39')](_0x5d46de['query'],_0x17a1bb[_0x5b87('0x31')]),_0x3a63df);if(_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]){_0x39d825[_0x5b87('0x38')]=_[_0x5b87('0x3b')](_0x39d825[_0x5b87('0x38')],{'$or':[{'key':{'$like':'%'+_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]+'%'}},{'value':{'$like':'%'+_0x5d46de[_0x5b87('0x30')][_0x5b87('0x3a')]+'%'}}]});}_0x39d825=_['merge']({},_0x39d825,_0x5d46de['options']);var _0x405833={'where':_0x39d825[_0x5b87('0x38')]};return db[_0x5b87('0x2b')][_0x5b87('0x1b')](_0x405833)['then'](function(_0x420950){_0x4c519a['count']=_0x420950;if(_0x5d46de['query'][_0x5b87('0x3c')]){_0x39d825[_0x5b87('0x3d')]=[{'all':!![]}];}return db[_0x5b87('0x2b')][_0x5b87('0x3e')](_0x39d825);})[_0x5b87('0x20')](function(_0x152d5e){_0x4c519a[_0x5b87('0x3f')]=_0x152d5e;return _0x4c519a;})['then'](respondWithFilteredResult(_0x474c91,_0x39d825))[_0x5b87('0x40')](handleError(_0x474c91,null));};exports[_0x5b87('0x41')]=function(_0x5b0bc2,_0x1c8e57){var _0x361bcd={'raw':!![],'where':{'id':_0x5b0bc2[_0x5b87('0x42')]['id']}},_0x2f7c94={};_0x2f7c94[_0x5b87('0x2f')]=_['keys'](db[_0x5b87('0x2b')][_0x5b87('0x43')]);_0x2f7c94['query']=_['keys'](_0x5b0bc2['query']);_0x2f7c94[_0x5b87('0x31')]=_[_0x5b87('0x32')](_0x2f7c94['model'],_0x2f7c94[_0x5b87('0x30')]);_0x361bcd['attributes']=_[_0x5b87('0x32')](_0x2f7c94[_0x5b87('0x2f')],qs['fields'](_0x5b0bc2[_0x5b87('0x30')]['fields']));_0x361bcd['attributes']=_0x361bcd['attributes'][_0x5b87('0x44')]?_0x361bcd[_0x5b87('0x34')]:_0x2f7c94['model'];if(_0x5b0bc2['query'][_0x5b87('0x3c')]){_0x361bcd[_0x5b87('0x3d')]=[{'all':!![]}];}_0x361bcd=_['merge']({},_0x361bcd,_0x5b0bc2[_0x5b87('0x45')]);return db['CannedAnswer'][_0x5b87('0x46')](_0x361bcd)['then'](handleEntityNotFound(_0x1c8e57,null))[_0x5b87('0x20')](respondWithResult(_0x1c8e57,null))[_0x5b87('0x40')](handleError(_0x1c8e57,null));};exports[_0x5b87('0x47')]=function(_0x297371,_0x1bd417){if(_0x297371[_0x5b87('0x48')]['id']){delete _0x297371[_0x5b87('0x48')]['id'];}return db['CannedAnswer'][_0x5b87('0x46')]({'where':{'id':_0x297371['params']['id']}})[_0x5b87('0x20')](handleEntityNotFound(_0x1bd417,null))[_0x5b87('0x20')](saveUpdates(_0x297371[_0x5b87('0x48')],null))['then'](respondWithResult(_0x1bd417,null))[_0x5b87('0x40')](handleError(_0x1bd417,null));};exports['destroy']=function(_0x3a0791,_0x2f9197){return db[_0x5b87('0x2b')]['find']({'where':{'id':_0x3a0791[_0x5b87('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f9197,null))[_0x5b87('0x20')](removeEntity(_0x2f9197,null))['catch'](handleError(_0x2f9197,null));};exports[_0x5b87('0x49')]=function(_0x3da522,_0x2ffb55){var _0x3b6b6b={'key':_0x3da522[_0x5b87('0x48')][_0x5b87('0x2e')]};if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4a')]){_0x3b6b6b[_0x5b87('0x4a')]=_0x3da522[_0x5b87('0x48')][_0x5b87('0x4a')];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4b')]){_0x3b6b6b[_0x5b87('0x4b')]=_0x3da522['body']['SmsAccountId'];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4c')]){_0x3b6b6b[_0x5b87('0x4c')]=_0x3da522[_0x5b87('0x48')]['OpenchannelAccountId'];}else if(_0x3da522[_0x5b87('0x48')][_0x5b87('0x4d')]){_0x3b6b6b[_0x5b87('0x4d')]=_0x3da522['body'][_0x5b87('0x4d')];}return db[_0x5b87('0x2b')][_0x5b87('0x46')]({'where':_0x3b6b6b})[_0x5b87('0x20')](function(_0x23ae71){if(_0x23ae71){throw new db[(_0x5b87('0x4e'))][(_0x5b87('0x4f'))](_0x5b87('0x50'));}return db['CannedAnswer'][_0x5b87('0x49')](_0x3da522[_0x5b87('0x48')]);})['then'](function(_0x533d13){var _0xe45281=_0x3da522[_0x5b87('0x51')][_0x5b87('0x22')]({'plain':!![]});if(!_0xe45281)throw new Error(_0x5b87('0x52'));if(_0xe45281[_0x5b87('0x53')]===_0x5b87('0x51')){var _0x3d563b=_0x533d13[_0x5b87('0x22')]({'plain':!![]});return db[_0x5b87('0x54')][_0x5b87('0x46')]({'where':{'name':_0x5b87('0x23'),'userProfileId':_0xe45281[_0x5b87('0x55')]},'raw':!![]})['then'](function(_0x23fe18){if(_0x23fe18&&_0x23fe18[_0x5b87('0x56')]===0x0){return db[_0x5b87('0x24')][_0x5b87('0x49')]({'name':_0x3d563b['name'],'resourceId':_0x3d563b['id'],'type':_0x23fe18[_0x5b87('0x27')],'sectionId':_0x23fe18['id']},{})[_0x5b87('0x20')](function(){return _0x533d13;});}else{return _0x533d13;}})[_0x5b87('0x40')](function(_0x12e2d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12e2d7);throw _0x12e2d7;});}return _0x533d13;})[_0x5b87('0x20')](respondWithResult(_0x2ffb55,0xc9))[_0x5b87('0x40')](handleError(_0x2ffb55,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 271f80d..b17230f 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 _0x13ba=['request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','../../config/logger','moment','bluebird'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x13ba,0x1bf));var _0xa13b=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0x13ba[_0x1d0764];return _0x423f49;};'use strict';var _=require(_0xa13b('0x0'));var util=require('util');var logger=require(_0xa13b('0x1'))('api');var moment=require(_0xa13b('0x2'));var BPromise=require(_0xa13b('0x3'));var rp=require(_0xa13b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa13b('0x5'));var config=require('../../config/environment');var attributes=require(_0xa13b('0x6'));module[_0xa13b('0x7')]=function(_0x491ba3,_0x3875c5){return _0x491ba3[_0xa13b('0x8')](_0xa13b('0x9'),attributes,{'tableName':_0xa13b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7728=['define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x17953f,_0x115870){var _0x4e3a07=function(_0x482004){while(--_0x482004){_0x17953f['push'](_0x17953f['shift']());}};_0x4e3a07(++_0x115870);}(_0x7728,0xd5));var _0x8772=function(_0x2f8000,_0x37c02b){_0x2f8000=_0x2f8000-0x0;var _0x25cfee=_0x7728[_0x2f8000];return _0x25cfee;};'use strict';var _=require('lodash');var util=require(_0x8772('0x0'));var logger=require(_0x8772('0x1'))(_0x8772('0x2'));var moment=require(_0x8772('0x3'));var BPromise=require(_0x8772('0x4'));var rp=require(_0x8772('0x5'));var fs=require('fs');var path=require(_0x8772('0x6'));var rimraf=require(_0x8772('0x7'));var config=require(_0x8772('0x8'));var attributes=require(_0x8772('0x9'));module[_0x8772('0xa')]=function(_0x1897a2,_0x1b10e8){return _0x1897a2[_0x8772('0xb')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8772('0xc'),'collate':_0x8772('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 59d8efc..8fc2cf7 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(_0x35ac5c,_0x378842){var _0x15ef45=function(_0x1aed4b){while(--_0x1aed4b){_0x35ac5c['push'](_0x35ac5c['shift']());}};_0x15ef45(++_0x378842);}(_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 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(_0x26a6c7,_0x3a9b26){var _0xbbb3c2=function(_0x3eaf2d){while(--_0x3eaf2d){_0x26a6c7['push'](_0x26a6c7['shift']());}};_0xbbb3c2(++_0x3a9b26);}(_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 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 c17b0f7..f1060f1 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 _0x774e=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x2bb46a,_0x9d01d8){var _0x5ae321=function(_0x8c3a1e){while(--_0x8c3a1e){_0x2bb46a['push'](_0x2bb46a['shift']());}};_0x5ae321(++_0x9d01d8);}(_0x774e,0x1a6));var _0xe774=function(_0x5c3f97,_0x2ae323){_0x5c3f97=_0x5c3f97-0x0;var _0x48f58a=_0x774e[_0x5c3f97];return _0x48f58a;};'use strict';var multer=require(_0xe774('0x0'));var util=require(_0xe774('0x1'));var path=require(_0xe774('0x2'));var timeout=require(_0xe774('0x3'));var express=require(_0xe774('0x4'));var router=express[_0xe774('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe774('0x6'));var interaction=require(_0xe774('0x7'));var config=require(_0xe774('0x8'));var controller=require(_0xe774('0x9'));router[_0xe774('0xa')]('/',auth[_0xe774('0xb')](),controller[_0xe774('0xc')]);router[_0xe774('0xa')](_0xe774('0xd'),auth[_0xe774('0xb')](),controller[_0xe774('0xe')]);router[_0xe774('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe774('0x10')](_0xe774('0xd'),auth[_0xe774('0xb')](),controller[_0xe774('0x11')]);router[_0xe774('0x12')](_0xe774('0xd'),auth[_0xe774('0xb')](),controller[_0xe774('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8cf0=['isAuthenticated','index','show','post','create','put','/:id','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x205abb,_0x130e47){var _0x390baa=function(_0x309536){while(--_0x309536){_0x205abb['push'](_0x205abb['shift']());}};_0x390baa(++_0x130e47);}(_0x8cf0,0x1a7));var _0x08cf=function(_0x4f6e90,_0x1f15e0){_0x4f6e90=_0x4f6e90-0x0;var _0x11cc0c=_0x8cf0[_0x4f6e90];return _0x11cc0c;};'use strict';var multer=require(_0x08cf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x08cf('0x1'));var router=express[_0x08cf('0x2')]();var fs_extra=require(_0x08cf('0x3'));var auth=require(_0x08cf('0x4'));var interaction=require(_0x08cf('0x5'));var config=require(_0x08cf('0x6'));var controller=require(_0x08cf('0x7'));router[_0x08cf('0x8')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0xa')]);router['get']('/:id',auth[_0x08cf('0x9')](),controller[_0x08cf('0xb')]);router[_0x08cf('0xc')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0xd')]);router[_0x08cf('0xe')](_0x08cf('0xf'),auth[_0x08cf('0x9')](),controller['update']);router[_0x08cf('0x10')](_0x08cf('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x08cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d26601c..e191e2a 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 _0xed8a=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x430241,_0x46f153){var _0x5db5b3=function(_0x56880d){while(--_0x56880d){_0x430241['push'](_0x430241['shift']());}};_0x5db5b3(++_0x46f153);}(_0xed8a,0xc5));var _0xaed8=function(_0x5f25a4,_0x529f81){_0x5f25a4=_0x5f25a4-0x0;var _0xeb455=_0xed8a[_0x5f25a4];return _0xeb455;};'use strict';var Sequelize=require(_0xaed8('0x0'));module[_0xaed8('0x1')]={'calldate':{'type':Sequelize[_0xaed8('0x2')],'allowNull':![],'defaultValue':_0xaed8('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xaed8('0x4')]},'dst':{'type':Sequelize[_0xaed8('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaed8('0x4')]},'dstchannel':{'type':Sequelize[_0xaed8('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xaed8('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xaed8('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaed8('0x4')]},'amaflags':{'type':Sequelize[_0xaed8('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaed8('0x4')]},'userfield':{'type':Sequelize[_0xaed8('0x4')]},'uniqueid':{'type':Sequelize[_0xaed8('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xaed8('0x4')]},'peeraccount':{'type':Sequelize[_0xaed8('0x4')]},'type':{'type':Sequelize[_0xaed8('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cb3=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2273ad,_0x4effd6){var _0x3f6622=function(_0x5d8df9){while(--_0x5d8df9){_0x2273ad['push'](_0x2273ad['shift']());}};_0x3f6622(++_0x4effd6);}(_0x3cb3,0x156));var _0x33cb=function(_0x872e48,_0x21c55f){_0x872e48=_0x872e48-0x0;var _0x4cb0ff=_0x3cb3[_0x872e48];return _0x4cb0ff;};'use strict';var Sequelize=require(_0x33cb('0x0'));module[_0x33cb('0x1')]={'calldate':{'type':Sequelize[_0x33cb('0x2')],'allowNull':![],'defaultValue':_0x33cb('0x3')},'clid':{'type':Sequelize[_0x33cb('0x4')]},'src':{'type':Sequelize[_0x33cb('0x4')]},'dst':{'type':Sequelize[_0x33cb('0x4')]},'dcontext':{'type':Sequelize[_0x33cb('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x33cb('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x33cb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x33cb('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x33cb('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x33cb('0x4')]},'linkedid':{'type':Sequelize[_0x33cb('0x4')]},'sequence':{'type':Sequelize[_0x33cb('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x33cb('0x4')]},'tag':{'type':Sequelize[_0x33cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e227bd0..63a1b5c 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 _0x4b84=['save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Cdr','includeAll','include','findAll','catch','show','find','create','body','params','describe','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','status','end','json','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4b84,0x1cc));var _0x44b8=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x4b84[_0xed5f9c];return _0x3a1c43;};'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'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['Cdr'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_0x5a544c,_0x44b8('0x23'));_0x4a182d[_0x44b8('0x2b')]=_[_0x44b8('0x2c')](_0x242342[_0x44b8('0x2b')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2b')]);_0x2e0174['attributes']=_[_0x44b8('0x2e')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x2f')](_0x242342[_0x44b8('0x2b')][_0x44b8('0x2f')]));_0x2e0174['attributes']=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x31')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d[_0x44b8('0x29')];if(!_0x242342[_0x44b8('0x2b')]['hasOwnProperty'](_0x44b8('0x32'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2b')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2b')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x33')]=qs[_0x44b8('0x34')](_0x242342[_0x44b8('0x2b')][_0x44b8('0x34')]);_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x2d')](_[_0x44b8('0x36')](_0x242342[_0x44b8('0x2b')],_0x4a182d[_0x44b8('0x2d')]),_0x5a544c);if(_0x242342[_0x44b8('0x2b')][_0x44b8('0x37')]){_0x2e0174[_0x44b8('0x35')]=_[_0x44b8('0x38')](_0x2e0174['where'],{'$or':_[_0x44b8('0x2a')](_0x5a544c,function(_0xd61f14){if(_0xd61f14['type']!==_0x44b8('0x39')){var _0x2b9139={};_0x2b9139[_0xd61f14[_0x44b8('0x23')]]={'$like':'%'+_0x242342[_0x44b8('0x2b')]['filter']+'%'};return _0x2b9139;}})});}_0x2e0174=_[_0x44b8('0x38')]({},_0x2e0174,_0x242342[_0x44b8('0x3a')]);var _0x3611b4={'where':_0x2e0174[_0x44b8('0x35')]};return db[_0x44b8('0x3b')][_0x44b8('0x18')](_0x3611b4)[_0x44b8('0x20')](function(_0x3581b8){_0xfb0028[_0x44b8('0x18')]=_0x3581b8;if(_0x242342[_0x44b8('0x2b')][_0x44b8('0x3c')]){_0x2e0174[_0x44b8('0x3d')]=[{'all':!![]}];}return db[_0x44b8('0x3b')][_0x44b8('0x3e')](_0x2e0174);})[_0x44b8('0x20')](function(_0x29b43f){_0xfb0028['rows']=_0x29b43f;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))[_0x44b8('0x3f')](handleError(_0x53d9c7,null));};exports[_0x44b8('0x40')]=function(_0x57f3b9,_0xd424f8){var _0x1054c5={'raw':!![],'where':{'id':_0x57f3b9['params']['id']}},_0x229cc9={};_0x229cc9[_0x44b8('0x29')]=_[_0x44b8('0x2c')](db[_0x44b8('0x3b')][_0x44b8('0x25')]);_0x229cc9[_0x44b8('0x2b')]=_['keys'](_0x57f3b9['query']);_0x229cc9[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x229cc9[_0x44b8('0x29')],_0x229cc9[_0x44b8('0x2b')]);_0x1054c5[_0x44b8('0x30')]=_[_0x44b8('0x2e')](_0x229cc9[_0x44b8('0x29')],qs[_0x44b8('0x2f')](_0x57f3b9[_0x44b8('0x2b')][_0x44b8('0x2f')]));_0x1054c5[_0x44b8('0x30')]=_0x1054c5[_0x44b8('0x30')][_0x44b8('0x31')]?_0x1054c5[_0x44b8('0x30')]:_0x229cc9[_0x44b8('0x29')];if(_0x57f3b9[_0x44b8('0x2b')][_0x44b8('0x3c')]){_0x1054c5[_0x44b8('0x3d')]=[{'all':!![]}];}_0x1054c5=_[_0x44b8('0x38')]({},_0x1054c5,_0x57f3b9['options']);return db['Cdr'][_0x44b8('0x41')](_0x1054c5)[_0x44b8('0x20')](handleEntityNotFound(_0xd424f8,null))[_0x44b8('0x20')](respondWithResult(_0xd424f8,null))[_0x44b8('0x3f')](handleError(_0xd424f8,null));};exports[_0x44b8('0x42')]=function(_0x1bbf1e,_0x411ed6){return db['Cdr'][_0x44b8('0x42')](_0x1bbf1e['body'],{})[_0x44b8('0x20')](respondWithResult(_0x411ed6,0xc9))[_0x44b8('0x3f')](handleError(_0x411ed6,null));};exports[_0x44b8('0x1f')]=function(_0x9207bf,_0x103d57){if(_0x9207bf[_0x44b8('0x43')]['id']){delete _0x9207bf['body']['id'];}return db[_0x44b8('0x3b')][_0x44b8('0x41')]({'where':{'id':_0x9207bf[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x103d57,null))['then'](saveUpdates(_0x9207bf[_0x44b8('0x43')],null))[_0x44b8('0x20')](respondWithResult(_0x103d57,null))[_0x44b8('0x3f')](handleError(_0x103d57,null));};exports[_0x44b8('0x21')]=function(_0x44ec23,_0x470ebb){return db['Cdr'][_0x44b8('0x41')]({'where':{'id':_0x44ec23[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x470ebb,null))[_0x44b8('0x20')](removeEntity(_0x470ebb,null))[_0x44b8('0x3f')](handleError(_0x470ebb,null));};exports['describe']=function(_0x493840,_0x2516fc){return db['Cdr'][_0x44b8('0x45')]()['then'](respondWithResult(_0x2516fc,null))[_0x44b8('0x3f')](handleError(_0x2516fc,null));}; \ No newline at end of file +var _0xca9e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','Cdr','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','fields','find','create','body','describe','eml-format','rimraf'];(function(_0x3db102,_0x281787){var _0x3be7da=function(_0x3ca143){while(--_0x3ca143){_0x3db102['push'](_0x3db102['shift']());}};_0x3be7da(++_0x281787);}(_0xca9e,0x136));var _0xeca9=function(_0x3d99d8,_0x32e0c5){_0x3d99d8=_0x3d99d8-0x0;var _0x46f0b1=_0xca9e[_0x3d99d8];return _0x46f0b1;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var jsonpatch=require(_0xeca9('0x3'));var rp=require(_0xeca9('0x4'));var moment=require(_0xeca9('0x5'));var BPromise=require(_0xeca9('0x6'));var Mustache=require(_0xeca9('0x7'));var util=require(_0xeca9('0x8'));var path=require(_0xeca9('0x9'));var sox=require(_0xeca9('0xa'));var csv=require(_0xeca9('0xb'));var ejs=require(_0xeca9('0xc'));var fs=require('fs');var fs_extra=require(_0xeca9('0xd'));var _=require('lodash');var squel=require(_0xeca9('0xe'));var crypto=require(_0xeca9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeca9('0xb'));var querystring=require(_0xeca9('0x10'));var Papa=require(_0xeca9('0x11'));var Redis=require('ioredis');var authService=require(_0xeca9('0x12'));var qs=require(_0xeca9('0x13'));var as=require(_0xeca9('0x14'));var hardwareService=require(_0xeca9('0x15'));var logger=require(_0xeca9('0x16'))(_0xeca9('0x17'));var utils=require('../../config/utils');var config=require(_0xeca9('0x18'));var licenseUtil=require(_0xeca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ca6f,_0x4b2ae1){_0x4b2ae1=_0x4b2ae1||0xcc;return function(_0x3c6cc7){if(_0x3c6cc7){return _0x27ca6f[_0xeca9('0x1a')](_0x4b2ae1);}return _0x27ca6f['status'](_0x4b2ae1)[_0xeca9('0x1b')]();};}function respondWithResult(_0x384ae2,_0x1ba9e9){_0x1ba9e9=_0x1ba9e9||0xc8;return function(_0x4d65ee){if(_0x4d65ee){return _0x384ae2[_0xeca9('0x1c')](_0x1ba9e9)[_0xeca9('0x1d')](_0x4d65ee);}};}function respondWithFilteredResult(_0x910814,_0x6e9fd4){return function(_0x551393){if(_0x551393){var _0x520411=typeof _0x6e9fd4[_0xeca9('0x1e')]===_0xeca9('0x1f')&&typeof _0x6e9fd4['limit']===_0xeca9('0x1f');var _0x11bf78=_0x551393['count'];var _0x517060=_0x520411?0x0:_0x6e9fd4['offset'];var _0x132008=_0x520411?_0x551393[_0xeca9('0x20')]:_0x6e9fd4[_0xeca9('0x1e')]+_0x6e9fd4['limit'];var _0xf1ef9f;if(_0x132008>=_0x11bf78){_0x132008=_0x11bf78;_0xf1ef9f=0xc8;}else{_0xf1ef9f=0xce;}_0x910814['status'](_0xf1ef9f);return _0x910814['set'](_0xeca9('0x21'),_0x517060+'-'+_0x132008+'/'+_0x11bf78)['json'](_0x551393);}return null;};}function patchUpdates(_0x31720b){return function(_0x1c4dd6){try{jsonpatch['apply'](_0x1c4dd6,_0x31720b,!![]);}catch(_0x5a2cca){return BPromise[_0xeca9('0x22')](_0x5a2cca);}return _0x1c4dd6['save']();};}function saveUpdates(_0x3647ed,_0x5279d0){return function(_0x3a3608){if(_0x3a3608){return _0x3a3608[_0xeca9('0x23')](_0x3647ed)[_0xeca9('0x24')](function(_0x5c3495){return _0x5c3495;});}return null;};}function removeEntity(_0x3fcfb8,_0x466883){return function(_0x515e63){if(_0x515e63){return _0x515e63[_0xeca9('0x25')]()[_0xeca9('0x24')](function(){_0x3fcfb8[_0xeca9('0x1c')](0xcc)[_0xeca9('0x1b')]();});}};}function handleEntityNotFound(_0x498f4a,_0x32699b){return function(_0x57e190){if(!_0x57e190){_0x498f4a[_0xeca9('0x1a')](0x194);}return _0x57e190;};}function handleError(_0x251ce4,_0x1702fb){_0x1702fb=_0x1702fb||0x1f4;return function(_0x3e41df){logger[_0xeca9('0x26')](_0x3e41df[_0xeca9('0x27')]);if(_0x3e41df[_0xeca9('0x28')]){delete _0x3e41df[_0xeca9('0x28')];}_0x251ce4[_0xeca9('0x1c')](_0x1702fb)[_0xeca9('0x29')](_0x3e41df);};}exports[_0xeca9('0x2a')]=function(_0x3b0aab,_0x424f7b){var _0x1436d0={},_0x8d9a8d={},_0x4910a3={'count':0x0,'rows':[]};var _0x4db3e2=_['map'](db[_0xeca9('0x2b')]['rawAttributes'],function(_0x2ca943){return{'name':_0x2ca943[_0xeca9('0x2c')],'type':_0x2ca943[_0xeca9('0x2d')][_0xeca9('0x2e')]};});_0x8d9a8d[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x4db3e2,'name');_0x8d9a8d[_0xeca9('0x31')]=_['keys'](_0x3b0aab[_0xeca9('0x31')]);_0x8d9a8d[_0xeca9('0x32')]=_[_0xeca9('0x33')](_0x8d9a8d['model'],_0x8d9a8d[_0xeca9('0x31')]);_0x1436d0[_0xeca9('0x34')]=_[_0xeca9('0x33')](_0x8d9a8d[_0xeca9('0x2f')],qs['fields'](_0x3b0aab[_0xeca9('0x31')]['fields']));_0x1436d0[_0xeca9('0x34')]=_0x1436d0[_0xeca9('0x34')][_0xeca9('0x35')]?_0x1436d0[_0xeca9('0x34')]:_0x8d9a8d[_0xeca9('0x2f')];if(!_0x3b0aab[_0xeca9('0x31')]['hasOwnProperty'](_0xeca9('0x36'))){_0x1436d0[_0xeca9('0x37')]=qs[_0xeca9('0x37')](_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x37')]);_0x1436d0[_0xeca9('0x1e')]=qs[_0xeca9('0x1e')](_0x3b0aab['query'][_0xeca9('0x1e')]);}_0x1436d0[_0xeca9('0x38')]=qs[_0xeca9('0x39')](_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x39')]);_0x1436d0[_0xeca9('0x3a')]=qs['filters'](_[_0xeca9('0x3b')](_0x3b0aab['query'],_0x8d9a8d[_0xeca9('0x32')]),_0x4db3e2);if(_0x3b0aab['query'][_0xeca9('0x3c')]){_0x1436d0[_0xeca9('0x3a')]=_['merge'](_0x1436d0[_0xeca9('0x3a')],{'$or':_['map'](_0x4db3e2,function(_0x2a249b){if(_0x2a249b['type']!==_0xeca9('0x3d')){var _0x5aa0b1={};_0x5aa0b1[_0x2a249b[_0xeca9('0x28')]]={'$like':'%'+_0x3b0aab[_0xeca9('0x31')]['filter']+'%'};return _0x5aa0b1;}})});}_0x1436d0=_[_0xeca9('0x3e')]({},_0x1436d0,_0x3b0aab[_0xeca9('0x3f')]);var _0x4e8080={'where':_0x1436d0[_0xeca9('0x3a')]};return db[_0xeca9('0x2b')][_0xeca9('0x20')](_0x4e8080)[_0xeca9('0x24')](function(_0xb1f2fc){_0x4910a3[_0xeca9('0x20')]=_0xb1f2fc;if(_0x3b0aab[_0xeca9('0x31')][_0xeca9('0x40')]){_0x1436d0[_0xeca9('0x41')]=[{'all':!![]}];}return db['Cdr'][_0xeca9('0x42')](_0x1436d0);})[_0xeca9('0x24')](function(_0x15ef4e){_0x4910a3[_0xeca9('0x43')]=_0x15ef4e;return _0x4910a3;})[_0xeca9('0x24')](respondWithFilteredResult(_0x424f7b,_0x1436d0))[_0xeca9('0x44')](handleError(_0x424f7b,null));};exports[_0xeca9('0x45')]=function(_0x5cb0d1,_0x1d3338){var _0x388943={'raw':!![],'where':{'id':_0x5cb0d1[_0xeca9('0x46')]['id']}},_0x188ebc={};_0x188ebc[_0xeca9('0x2f')]=_['keys'](db[_0xeca9('0x2b')][_0xeca9('0x47')]);_0x188ebc[_0xeca9('0x31')]=_[_0xeca9('0x48')](_0x5cb0d1['query']);_0x188ebc[_0xeca9('0x32')]=_[_0xeca9('0x33')](_0x188ebc['model'],_0x188ebc[_0xeca9('0x31')]);_0x388943[_0xeca9('0x34')]=_[_0xeca9('0x33')](_0x188ebc[_0xeca9('0x2f')],qs[_0xeca9('0x49')](_0x5cb0d1[_0xeca9('0x31')][_0xeca9('0x49')]));_0x388943[_0xeca9('0x34')]=_0x388943[_0xeca9('0x34')][_0xeca9('0x35')]?_0x388943[_0xeca9('0x34')]:_0x188ebc[_0xeca9('0x2f')];if(_0x5cb0d1[_0xeca9('0x31')][_0xeca9('0x40')]){_0x388943[_0xeca9('0x41')]=[{'all':!![]}];}_0x388943=_['merge']({},_0x388943,_0x5cb0d1[_0xeca9('0x3f')]);return db[_0xeca9('0x2b')][_0xeca9('0x4a')](_0x388943)[_0xeca9('0x24')](handleEntityNotFound(_0x1d3338,null))['then'](respondWithResult(_0x1d3338,null))[_0xeca9('0x44')](handleError(_0x1d3338,null));};exports[_0xeca9('0x4b')]=function(_0x548fab,_0x5e6dc2){return db[_0xeca9('0x2b')][_0xeca9('0x4b')](_0x548fab[_0xeca9('0x4c')],{})[_0xeca9('0x24')](respondWithResult(_0x5e6dc2,0xc9))['catch'](handleError(_0x5e6dc2,null));};exports[_0xeca9('0x23')]=function(_0xa4faf9,_0x346c62){if(_0xa4faf9[_0xeca9('0x4c')]['id']){delete _0xa4faf9[_0xeca9('0x4c')]['id'];}return db[_0xeca9('0x2b')][_0xeca9('0x4a')]({'where':{'id':_0xa4faf9[_0xeca9('0x46')]['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x346c62,null))['then'](saveUpdates(_0xa4faf9['body'],null))[_0xeca9('0x24')](respondWithResult(_0x346c62,null))[_0xeca9('0x44')](handleError(_0x346c62,null));};exports['destroy']=function(_0x283d2d,_0x315f54){return db[_0xeca9('0x2b')][_0xeca9('0x4a')]({'where':{'id':_0x283d2d[_0xeca9('0x46')]['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x315f54,null))[_0xeca9('0x24')](removeEntity(_0x315f54,null))[_0xeca9('0x44')](handleError(_0x315f54,null));};exports[_0xeca9('0x4d')]=function(_0x56a212,_0x5cd84d){return db['Cdr']['describe']()[_0xeca9('0x24')](respondWithResult(_0x5cd84d,null))['catch'](handleError(_0x5cd84d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ee0e085..662f6e6 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3dba51,_0x16fc4c){var _0x2d7352=function(_0x21a91a){while(--_0x21a91a){_0x3dba51['push'](_0x3dba51['shift']());}};_0x2d7352(++_0x16fc4c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4b84df,_0x21d1ce){var _0x4d31fe=function(_0xbf78dc){while(--_0xbf78dc){_0x4b84df['push'](_0x4b84df['shift']());}};_0x4d31fe(++_0x21d1ce);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 092fc1f..3392427 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 _0x30e2=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s'];(function(_0x3dcef0,_0x3d3a95){var _0x194d53=function(_0x5743e2){while(--_0x5743e2){_0x3dcef0['push'](_0x3dcef0['shift']());}};_0x194d53(++_0x3d3a95);}(_0x30e2,0x198));var _0x230e=function(_0x3261db,_0x5ca0a){_0x3261db=_0x3261db-0x0;var _0x8c0bf3=_0x30e2[_0x3261db];return _0x8c0bf3;};'use strict';var _=require(_0x230e('0x0'));var util=require(_0x230e('0x1'));var moment=require(_0x230e('0x2'));var BPromise=require('bluebird');var rs=require(_0x230e('0x3'));var fs=require('fs');var Redis=require(_0x230e('0x4'));var db=require(_0x230e('0x5'))['db'];var utils=require(_0x230e('0x6'));var logger=require(_0x230e('0x7'))(_0x230e('0x8'));var config=require(_0x230e('0x9'));var jayson=require(_0x230e('0xa'));var client=jayson[_0x230e('0xb')][_0x230e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52a0e6,_0x546f90,_0x3e71b1){return new BPromise(function(_0x332d35,_0xde786c){return client[_0x230e('0xd')](_0x52a0e6,_0x3e71b1)[_0x230e('0xe')](function(_0x2b44ea){logger[_0x230e('0xf')](_0x230e('0x10'),_0x546f90,'request\x20sent');logger['debug'](_0x230e('0x11'),_0x546f90,'request\x20sent',JSON[_0x230e('0x12')](_0x2b44ea));if(_0x2b44ea[_0x230e('0x13')]){if(_0x2b44ea['error'][_0x230e('0x14')]===0x1f4){logger[_0x230e('0x13')](_0x230e('0x10'),_0x546f90,_0x2b44ea['error'][_0x230e('0x15')]);return _0xde786c(_0x2b44ea[_0x230e('0x13')][_0x230e('0x15')]);}logger[_0x230e('0x13')](_0x230e('0x10'),_0x546f90,_0x2b44ea['error'][_0x230e('0x15')]);return _0x332d35(_0x2b44ea[_0x230e('0x13')][_0x230e('0x15')]);}else{logger[_0x230e('0xf')]('Cdr,\x20%s,\x20%s',_0x546f90,_0x230e('0x16'));_0x332d35(_0x2b44ea[_0x230e('0x17')][_0x230e('0x15')]);}})[_0x230e('0x18')](function(_0x135e9b){logger[_0x230e('0x13')](_0x230e('0x10'),_0x546f90,_0x135e9b);_0xde786c(_0x135e9b);});});} \ No newline at end of file +var _0x7732=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Cdr,\x20%s,\x20%s'];(function(_0x10aec2,_0x1b346f){var _0x5b69ab=function(_0xe8505a){while(--_0xe8505a){_0x10aec2['push'](_0x10aec2['shift']());}};_0x5b69ab(++_0x1b346f);}(_0x7732,0x173));var _0x2773=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x7732[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0x2773('0x0'));var util=require('util');var moment=require(_0x2773('0x1'));var BPromise=require(_0x2773('0x2'));var rs=require(_0x2773('0x3'));var fs=require('fs');var Redis=require(_0x2773('0x4'));var db=require(_0x2773('0x5'))['db'];var utils=require(_0x2773('0x6'));var logger=require('../../config/logger')(_0x2773('0x7'));var config=require(_0x2773('0x8'));var jayson=require(_0x2773('0x9'));var client=jayson['client'][_0x2773('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440dac,_0xd3e2b9,_0x1134c7){return new BPromise(function(_0x2bb392,_0x5c8256){return client[_0x2773('0xb')](_0x440dac,_0x1134c7)[_0x2773('0xc')](function(_0x211ae5){logger[_0x2773('0xd')]('Cdr,\x20%s,\x20%s',_0xd3e2b9,'request\x20sent');logger[_0x2773('0xe')](_0x2773('0xf'),_0xd3e2b9,_0x2773('0x10'),JSON['stringify'](_0x211ae5));if(_0x211ae5['error']){if(_0x211ae5[_0x2773('0x11')][_0x2773('0x12')]===0x1f4){logger['error'](_0x2773('0x13'),_0xd3e2b9,_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);return _0x5c8256(_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);}logger[_0x2773('0x11')](_0x2773('0x13'),_0xd3e2b9,_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);return _0x2bb392(_0x211ae5[_0x2773('0x11')][_0x2773('0x14')]);}else{logger[_0x2773('0xd')]('Cdr,\x20%s,\x20%s',_0xd3e2b9,'request\x20sent');_0x2bb392(_0x211ae5[_0x2773('0x15')][_0x2773('0x14')]);}})[_0x2773('0x16')](function(_0x1f5ce3){logger[_0x2773('0x11')](_0x2773('0x13'),_0xd3e2b9,_0x1f5ce3);_0x5c8256(_0x1f5ce3);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 87bd6a0..39399ec 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(_0xa20971,_0x1bf32c){var _0x4f4271=function(_0x299c14){while(--_0x299c14){_0xa20971['push'](_0xa20971['shift']());}};_0x4f4271(++_0x1bf32c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 0bd85f2..f050dec 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 _0xa226=['STRING','sequelize','exports','INTEGER','noop'];(function(_0x670775,_0x3e8bbd){var _0x2fc8c8=function(_0x2f163e){while(--_0x2f163e){_0x670775['push'](_0x670775['shift']());}};_0x2fc8c8(++_0x3e8bbd);}(_0xa226,0x169));var _0x6a22=function(_0x5eb5fd,_0x1807d7){_0x5eb5fd=_0x5eb5fd-0x0;var _0x49db91=_0xa226[_0x5eb5fd];return _0x49db91;};'use strict';var Sequelize=require(_0x6a22('0x0'));module[_0x6a22('0x1')]={'priority':{'type':Sequelize[_0x6a22('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a22('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6a22('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1bf0=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1bf0,0x116));var _0x01bf=function(_0x248c1e,_0x3468f6){_0x248c1e=_0x248c1e-0x0;var _0x330688=_0x1bf0[_0x248c1e];return _0x330688;};'use strict';var Sequelize=require(_0x01bf('0x0'));module[_0x01bf('0x1')]={'priority':{'type':Sequelize[_0x01bf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x01bf('0x3')],'allowNull':![],'defaultValue':_0x01bf('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x01bf('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x01bf('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a37b0d0..10f6be2 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 _0x1339=['rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','include','merge','find','body','catch','params','eml-format'];(function(_0x45bd84,_0x4a61bb){var _0x551b62=function(_0x3b03cf){while(--_0x3b03cf){_0x45bd84['push'](_0x45bd84['shift']());}};_0x551b62(++_0x4a61bb);}(_0x1339,0x1bf));var _0x9133=function(_0x21d046,_0xf4fba9){_0x21d046=_0x21d046-0x0;var _0x477fe1=_0x1339[_0x21d046];return _0x477fe1;};'use strict';var emlformat=require(_0x9133('0x0'));var rimraf=require(_0x9133('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9133('0x4'));var util=require(_0x9133('0x5'));var path=require('path');var sox=require(_0x9133('0x6'));var csv=require(_0x9133('0x7'));var ejs=require(_0x9133('0x8'));var fs=require('fs');var fs_extra=require(_0x9133('0x9'));var _=require(_0x9133('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9133('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9133('0x7'));var querystring=require('querystring');var Papa=require(_0x9133('0xc'));var Redis=require('ioredis');var authService=require(_0x9133('0xd'));var qs=require(_0x9133('0xe'));var as=require(_0x9133('0xf'));var hardwareService=require(_0x9133('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9133('0x11'));var licenseUtil=require(_0x9133('0x12'));var db=require(_0x9133('0x13'))['db'];function respondWithStatusCode(_0x54bfc7,_0x3048a5){_0x3048a5=_0x3048a5||0xcc;return function(_0x177239){if(_0x177239){return _0x54bfc7[_0x9133('0x14')](_0x3048a5);}return _0x54bfc7[_0x9133('0x15')](_0x3048a5)[_0x9133('0x16')]();};}function respondWithResult(_0x35edae,_0x8e9362){_0x8e9362=_0x8e9362||0xc8;return function(_0xb05b1c){if(_0xb05b1c){return _0x35edae[_0x9133('0x15')](_0x8e9362)['json'](_0xb05b1c);}};}function respondWithFilteredResult(_0x18c203,_0x57f4d9){return function(_0x555651){if(_0x555651){var _0x8e3461=typeof _0x57f4d9[_0x9133('0x17')]===_0x9133('0x18')&&typeof _0x57f4d9[_0x9133('0x19')]===_0x9133('0x18');var _0x26b12a=_0x555651[_0x9133('0x1a')];var _0x4aa4be=_0x8e3461?0x0:_0x57f4d9['offset'];var _0x3d5506=_0x8e3461?_0x555651[_0x9133('0x1a')]:_0x57f4d9[_0x9133('0x17')]+_0x57f4d9['limit'];var _0x5f4d4d;if(_0x3d5506>=_0x26b12a){_0x3d5506=_0x26b12a;_0x5f4d4d=0xc8;}else{_0x5f4d4d=0xce;}_0x18c203[_0x9133('0x15')](_0x5f4d4d);return _0x18c203[_0x9133('0x1b')](_0x9133('0x1c'),_0x4aa4be+'-'+_0x3d5506+'/'+_0x26b12a)[_0x9133('0x1d')](_0x555651);}return null;};}function patchUpdates(_0x307671){return function(_0x21720){try{jsonpatch[_0x9133('0x1e')](_0x21720,_0x307671,!![]);}catch(_0x24cce0){return BPromise[_0x9133('0x1f')](_0x24cce0);}return _0x21720[_0x9133('0x20')]();};}function saveUpdates(_0x2f5e77,_0x2219d7){return function(_0xeb79c1){if(_0xeb79c1){return _0xeb79c1[_0x9133('0x21')](_0x2f5e77)['then'](function(_0xdb994d){return _0xdb994d;});}return null;};}function removeEntity(_0xdc20d9,_0x4bf1ed){return function(_0x4f6c6a){if(_0x4f6c6a){return _0x4f6c6a[_0x9133('0x22')]()[_0x9133('0x23')](function(){_0xdc20d9[_0x9133('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc4f92,_0x3a7c70){return function(_0x50d1da){if(!_0x50d1da){_0xbc4f92[_0x9133('0x14')](0x194);}return _0x50d1da;};}function handleError(_0x58907c,_0x552011){_0x552011=_0x552011||0x1f4;return function(_0x5a83e0){logger[_0x9133('0x24')](_0x5a83e0[_0x9133('0x25')]);if(_0x5a83e0['name']){delete _0x5a83e0[_0x9133('0x26')];}_0x58907c[_0x9133('0x15')](_0x552011)[_0x9133('0x27')](_0x5a83e0);};}exports[_0x9133('0x28')]=function(_0x52d0af,_0x276583){var _0x3f8b9b={'raw':!![],'where':{'id':_0x52d0af['params']['id']}},_0x3c8081={};_0x3c8081[_0x9133('0x29')]=_[_0x9133('0x2a')](db[_0x9133('0x2b')][_0x9133('0x2c')]);_0x3c8081[_0x9133('0x2d')]=_['keys'](_0x52d0af[_0x9133('0x2d')]);_0x3c8081['filters']=_[_0x9133('0x2e')](_0x3c8081[_0x9133('0x29')],_0x3c8081[_0x9133('0x2d')]);_0x3f8b9b[_0x9133('0x2f')]=_['intersection'](_0x3c8081[_0x9133('0x29')],qs[_0x9133('0x30')](_0x52d0af[_0x9133('0x2d')][_0x9133('0x30')]));_0x3f8b9b['attributes']=_0x3f8b9b[_0x9133('0x2f')][_0x9133('0x31')]?_0x3f8b9b[_0x9133('0x2f')]:_0x3c8081[_0x9133('0x29')];if(_0x52d0af[_0x9133('0x2d')]['includeAll']){_0x3f8b9b[_0x9133('0x32')]=[{'all':!![]}];}_0x3f8b9b=_[_0x9133('0x33')]({},_0x3f8b9b,_0x52d0af['options']);return db[_0x9133('0x2b')][_0x9133('0x34')](_0x3f8b9b)[_0x9133('0x23')](handleEntityNotFound(_0x276583,null))[_0x9133('0x23')](respondWithResult(_0x276583,null))['catch'](handleError(_0x276583,null));};exports[_0x9133('0x21')]=function(_0x55a860,_0x70d666){if(_0x55a860[_0x9133('0x35')]['id']){delete _0x55a860['body']['id'];}return db[_0x9133('0x2b')][_0x9133('0x34')]({'where':{'id':_0x55a860['params']['id']}})[_0x9133('0x23')](handleEntityNotFound(_0x70d666,null))[_0x9133('0x23')](saveUpdates(_0x55a860['body'],null))['then'](respondWithResult(_0x70d666,null))[_0x9133('0x36')](handleError(_0x70d666,null));};exports['destroy']=function(_0x31331b,_0x3f52ea){return db['ChatApplication'][_0x9133('0x34')]({'where':{'id':_0x31331b[_0x9133('0x37')]['id']}})['then'](handleEntityNotFound(_0x3f52ea,null))[_0x9133('0x23')](removeEntity(_0x3f52ea,null))[_0x9133('0x36')](handleError(_0x3f52ea,null));}; \ No newline at end of file +var _0x7229=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','params','keys','ChatApplication','query','filters','intersection','model','fields','attributes','length','include','merge','options','find','catch','body','eml-format','rimraf'];(function(_0x1f07a8,_0x407446){var _0x23cabd=function(_0x357c38){while(--_0x357c38){_0x1f07a8['push'](_0x1f07a8['shift']());}};_0x23cabd(++_0x407446);}(_0x7229,0x76));var _0x9722=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7229[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x9722('0x0'));var rimraf=require(_0x9722('0x1'));var zipdir=require(_0x9722('0x2'));var jsonpatch=require(_0x9722('0x3'));var rp=require(_0x9722('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9722('0x5'));var util=require(_0x9722('0x6'));var path=require(_0x9722('0x7'));var sox=require(_0x9722('0x8'));var csv=require(_0x9722('0x9'));var ejs=require(_0x9722('0xa'));var fs=require('fs');var fs_extra=require(_0x9722('0xb'));var _=require('lodash');var squel=require(_0x9722('0xc'));var crypto=require('crypto');var jsforce=require(_0x9722('0xd'));var deskjs=require(_0x9722('0xe'));var toCsv=require(_0x9722('0x9'));var querystring=require(_0x9722('0xf'));var Papa=require(_0x9722('0x10'));var Redis=require(_0x9722('0x11'));var authService=require(_0x9722('0x12'));var qs=require(_0x9722('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9722('0x14'))(_0x9722('0x15'));var utils=require(_0x9722('0x16'));var config=require(_0x9722('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9722('0x18'))['db'];function respondWithStatusCode(_0x32fd25,_0x11942f){_0x11942f=_0x11942f||0xcc;return function(_0x124bfc){if(_0x124bfc){return _0x32fd25['sendStatus'](_0x11942f);}return _0x32fd25[_0x9722('0x19')](_0x11942f)[_0x9722('0x1a')]();};}function respondWithResult(_0x256348,_0x248bdf){_0x248bdf=_0x248bdf||0xc8;return function(_0x2f1c3b){if(_0x2f1c3b){return _0x256348['status'](_0x248bdf)[_0x9722('0x1b')](_0x2f1c3b);}};}function respondWithFilteredResult(_0x203db5,_0x2f2f96){return function(_0x482ad4){if(_0x482ad4){var _0xc802f7=typeof _0x2f2f96[_0x9722('0x1c')]==='undefined'&&typeof _0x2f2f96[_0x9722('0x1d')]===_0x9722('0x1e');var _0x38e179=_0x482ad4['count'];var _0x43b3fa=_0xc802f7?0x0:_0x2f2f96[_0x9722('0x1c')];var _0x38112a=_0xc802f7?_0x482ad4[_0x9722('0x1f')]:_0x2f2f96[_0x9722('0x1c')]+_0x2f2f96[_0x9722('0x1d')];var _0x2481f5;if(_0x38112a>=_0x38e179){_0x38112a=_0x38e179;_0x2481f5=0xc8;}else{_0x2481f5=0xce;}_0x203db5[_0x9722('0x19')](_0x2481f5);return _0x203db5[_0x9722('0x20')](_0x9722('0x21'),_0x43b3fa+'-'+_0x38112a+'/'+_0x38e179)[_0x9722('0x1b')](_0x482ad4);}return null;};}function patchUpdates(_0x23e9d0){return function(_0x451ce8){try{jsonpatch[_0x9722('0x22')](_0x451ce8,_0x23e9d0,!![]);}catch(_0x3b094d){return BPromise[_0x9722('0x23')](_0x3b094d);}return _0x451ce8['save']();};}function saveUpdates(_0x22a3e2,_0x3ab4d4){return function(_0x3abf4b){if(_0x3abf4b){return _0x3abf4b[_0x9722('0x24')](_0x22a3e2)[_0x9722('0x25')](function(_0x392d59){return _0x392d59;});}return null;};}function removeEntity(_0x4aeea7,_0x73c303){return function(_0x1aff40){if(_0x1aff40){return _0x1aff40[_0x9722('0x26')]()[_0x9722('0x25')](function(){_0x4aeea7[_0x9722('0x19')](0xcc)[_0x9722('0x1a')]();});}};}function handleEntityNotFound(_0x3b3ce9,_0x1f2ad8){return function(_0x4aab4e){if(!_0x4aab4e){_0x3b3ce9[_0x9722('0x27')](0x194);}return _0x4aab4e;};}function handleError(_0x5bf6f2,_0x141c7d){_0x141c7d=_0x141c7d||0x1f4;return function(_0x19a7b6){logger[_0x9722('0x28')](_0x19a7b6[_0x9722('0x29')]);if(_0x19a7b6[_0x9722('0x2a')]){delete _0x19a7b6[_0x9722('0x2a')];}_0x5bf6f2[_0x9722('0x19')](_0x141c7d)[_0x9722('0x2b')](_0x19a7b6);};}exports['show']=function(_0x19ffa8,_0x4805be){var _0x568ddc={'raw':!![],'where':{'id':_0x19ffa8[_0x9722('0x2c')]['id']}},_0x18fa43={};_0x18fa43['model']=_[_0x9722('0x2d')](db[_0x9722('0x2e')]['rawAttributes']);_0x18fa43['query']=_[_0x9722('0x2d')](_0x19ffa8[_0x9722('0x2f')]);_0x18fa43[_0x9722('0x30')]=_[_0x9722('0x31')](_0x18fa43[_0x9722('0x32')],_0x18fa43[_0x9722('0x2f')]);_0x568ddc['attributes']=_[_0x9722('0x31')](_0x18fa43[_0x9722('0x32')],qs[_0x9722('0x33')](_0x19ffa8[_0x9722('0x2f')]['fields']));_0x568ddc[_0x9722('0x34')]=_0x568ddc[_0x9722('0x34')][_0x9722('0x35')]?_0x568ddc['attributes']:_0x18fa43['model'];if(_0x19ffa8[_0x9722('0x2f')]['includeAll']){_0x568ddc[_0x9722('0x36')]=[{'all':!![]}];}_0x568ddc=_[_0x9722('0x37')]({},_0x568ddc,_0x19ffa8[_0x9722('0x38')]);return db[_0x9722('0x2e')][_0x9722('0x39')](_0x568ddc)[_0x9722('0x25')](handleEntityNotFound(_0x4805be,null))[_0x9722('0x25')](respondWithResult(_0x4805be,null))[_0x9722('0x3a')](handleError(_0x4805be,null));};exports[_0x9722('0x24')]=function(_0x463dd8,_0x427244){if(_0x463dd8[_0x9722('0x3b')]['id']){delete _0x463dd8['body']['id'];}return db['ChatApplication'][_0x9722('0x39')]({'where':{'id':_0x463dd8[_0x9722('0x2c')]['id']}})[_0x9722('0x25')](handleEntityNotFound(_0x427244,null))[_0x9722('0x25')](saveUpdates(_0x463dd8[_0x9722('0x3b')],null))[_0x9722('0x25')](respondWithResult(_0x427244,null))[_0x9722('0x3a')](handleError(_0x427244,null));};exports[_0x9722('0x26')]=function(_0x519368,_0x44b9f4){return db['ChatApplication']['find']({'where':{'id':_0x519368[_0x9722('0x2c')]['id']}})[_0x9722('0x25')](handleEntityNotFound(_0x44b9f4,null))[_0x9722('0x25')](removeEntity(_0x44b9f4,null))['catch'](handleError(_0x44b9f4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2b7479c..9fca96e 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 _0x3f91=['api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x1ae379,_0x5b581e){var _0x57ad43=function(_0x100a97){while(--_0x100a97){_0x1ae379['push'](_0x1ae379['shift']());}};_0x57ad43(++_0x5b581e);}(_0x3f91,0x99));var _0x13f9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x3f91[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13f9('0x0'))(_0x13f9('0x1'));var moment=require(_0x13f9('0x2'));var BPromise=require('bluebird');var rp=require(_0x13f9('0x3'));var fs=require('fs');var path=require(_0x13f9('0x4'));var rimraf=require(_0x13f9('0x5'));var config=require(_0x13f9('0x6'));var attributes=require(_0x13f9('0x7'));module[_0x13f9('0x8')]=function(_0x5b6ad9,_0x537190){return _0x5b6ad9[_0x13f9('0x9')](_0x13f9('0xa'),attributes,{'tableName':_0x13f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13f9('0xc'),'collate':_0x13f9('0xd')});}; \ No newline at end of file +var _0xdb6e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','lodash'];(function(_0x2ae255,_0x41e53a){var _0x43e3f8=function(_0x1943ff){while(--_0x1943ff){_0x2ae255['push'](_0x2ae255['shift']());}};_0x43e3f8(++_0x41e53a);}(_0xdb6e,0x179));var _0xedb6=function(_0x54f072,_0x39e1fd){_0x54f072=_0x54f072-0x0;var _0x42e317=_0xdb6e[_0x54f072];return _0x42e317;};'use strict';var _=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var logger=require(_0xedb6('0x2'))(_0xedb6('0x3'));var moment=require(_0xedb6('0x4'));var BPromise=require(_0xedb6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedb6('0x6'));var rimraf=require(_0xedb6('0x7'));var config=require(_0xedb6('0x8'));var attributes=require(_0xedb6('0x9'));module[_0xedb6('0xa')]=function(_0x30de0d,_0x35f987){return _0x30de0d['define'](_0xedb6('0xb'),attributes,{'tableName':_0xedb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedb6('0xd'),'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 8eb2060..39a8af2 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 _0x9cdf=['then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x2d32ab,_0x5da037){var _0x4ee4f4=function(_0x4f916c){while(--_0x4f916c){_0x2d32ab['push'](_0x2d32ab['shift']());}};_0x4ee4f4(++_0x5da037);}(_0x9cdf,0x9e));var _0xf9cd=function(_0xafab2c,_0x5e7eee){_0xafab2c=_0xafab2c-0x0;var _0x2c16f1=_0x9cdf[_0xafab2c];return _0x2c16f1;};'use strict';var _=require('lodash');var util=require(_0xf9cd('0x0'));var moment=require(_0xf9cd('0x1'));var BPromise=require(_0xf9cd('0x2'));var rs=require(_0xf9cd('0x3'));var fs=require('fs');var Redis=require(_0xf9cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9cd('0x5'));var logger=require('../../config/logger')(_0xf9cd('0x6'));var config=require('../../config/environment');var jayson=require(_0xf9cd('0x7'));var client=jayson['client'][_0xf9cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36c1d1,_0x2cafe2,_0x498122){return new BPromise(function(_0x1b51b1,_0x2d468e){return client[_0xf9cd('0x9')](_0x36c1d1,_0x498122)[_0xf9cd('0xa')](function(_0x3929af){logger['info'](_0xf9cd('0xb'),_0x2cafe2,_0xf9cd('0xc'));logger['debug'](_0xf9cd('0xd'),_0x2cafe2,_0xf9cd('0xc'),JSON[_0xf9cd('0xe')](_0x3929af));if(_0x3929af['error']){if(_0x3929af['error'][_0xf9cd('0xf')]===0x1f4){logger['error'](_0xf9cd('0xb'),_0x2cafe2,_0x3929af[_0xf9cd('0x10')]['message']);return _0x2d468e(_0x3929af[_0xf9cd('0x10')][_0xf9cd('0x11')]);}logger[_0xf9cd('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2cafe2,_0x3929af['error'][_0xf9cd('0x11')]);return _0x1b51b1(_0x3929af[_0xf9cd('0x10')]['message']);}else{logger[_0xf9cd('0x12')](_0xf9cd('0xb'),_0x2cafe2,_0xf9cd('0xc'));_0x1b51b1(_0x3929af[_0xf9cd('0x13')][_0xf9cd('0x11')]);}})[_0xf9cd('0x14')](function(_0x29a9e9){logger[_0xf9cd('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2cafe2,_0x29a9e9);_0x2d468e(_0x29a9e9);});});} \ No newline at end of file +var _0x4142=['stringify','error','code','message','ChatApplication,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4142,0x1f4));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2414('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2414('0x1'));var db=require(_0x2414('0x2'))['db'];var utils=require(_0x2414('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2414('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2414('0x5')][_0x2414('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58895f,_0x321050,_0x50c5ad){return new BPromise(function(_0x43a54f,_0x36e886){return client[_0x2414('0x7')](_0x58895f,_0x50c5ad)[_0x2414('0x8')](function(_0x3d6b06){logger[_0x2414('0x9')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x2414('0xa'));logger[_0x2414('0xb')](_0x2414('0xc'),_0x321050,'request\x20sent',JSON[_0x2414('0xd')](_0x3d6b06));if(_0x3d6b06[_0x2414('0xe')]){if(_0x3d6b06[_0x2414('0xe')][_0x2414('0xf')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')][_0x2414('0x10')]);return _0x36e886(_0x3d6b06[_0x2414('0xe')]['message']);}logger[_0x2414('0xe')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')]['message']);return _0x43a54f(_0x3d6b06['error'][_0x2414('0x10')]);}else{logger[_0x2414('0x9')](_0x2414('0x11'),_0x321050,'request\x20sent');_0x43a54f(_0x3d6b06['result']['message']);}})[_0x2414('0x12')](function(_0x8cca88){logger['error'](_0x2414('0x11'),_0x321050,_0x8cca88);_0x36e886(_0x8cca88);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4fb509f..dd3f83f 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 _0xc629=['get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller'];(function(_0x40bfd6,_0x22e7f9){var _0x17dcbe=function(_0x18e394){while(--_0x18e394){_0x40bfd6['push'](_0x40bfd6['shift']());}};_0x17dcbe(++_0x22e7f9);}(_0xc629,0x128));var _0x9c62=function(_0x154094,_0x7f9ace){_0x154094=_0x154094-0x0;var _0x4907b2=_0xc629[_0x154094];return _0x4907b2;};'use strict';var multer=require(_0x9c62('0x0'));var util=require(_0x9c62('0x1'));var path=require(_0x9c62('0x2'));var timeout=require(_0x9c62('0x3'));var express=require(_0x9c62('0x4'));var router=express[_0x9c62('0x5')]();var fs_extra=require(_0x9c62('0x6'));var auth=require(_0x9c62('0x7'));var interaction=require(_0x9c62('0x8'));var config=require('../../config/environment');var controller=require(_0x9c62('0x9'));router[_0x9c62('0xa')](_0x9c62('0xb'),auth[_0x9c62('0xc')](),controller['show']);router[_0x9c62('0xd')](_0x9c62('0xb'),auth[_0x9c62('0xc')](),controller[_0x9c62('0xe')]);router[_0x9c62('0xf')]('/:id',auth[_0x9c62('0xc')](),controller[_0x9c62('0x10')]);module[_0x9c62('0x11')]=router; \ No newline at end of file +var _0x33b5=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x33b5,0x1e1));var _0x533b=function(_0x4d57a6,_0x4555ec){_0x4d57a6=_0x4d57a6-0x0;var _0x250376=_0x33b5[_0x4d57a6];return _0x250376;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require(_0x533b('0x2'));var timeout=require(_0x533b('0x3'));var express=require(_0x533b('0x4'));var router=express[_0x533b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x533b('0x6'));var interaction=require(_0x533b('0x7'));var config=require('../../config/environment');var controller=require(_0x533b('0x8'));router[_0x533b('0x9')](_0x533b('0xa'),auth[_0x533b('0xb')](),controller['show']);router[_0x533b('0xc')](_0x533b('0xa'),auth['isAuthenticated'](),controller[_0x533b('0xd')]);router[_0x533b('0xe')](_0x533b('0xa'),auth[_0x533b('0xb')](),controller[_0x533b('0xf')]);module[_0x533b('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e684c92..4101069 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 _0x1caa=['STRING','BOOLEAN','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1caa,0xbf));var _0xa1ca=function(_0x3d56f5,_0x2d51a7){_0x3d56f5=_0x3d56f5-0x0;var _0x3ad5c5=_0x1caa[_0x3d56f5];return _0x3ad5c5;};'use strict';var Sequelize=require(_0xa1ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1ca('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa1ca('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6fb2=['sequelize','exports','STRING'];(function(_0x1dabba,_0xde90f7){var _0x368044=function(_0x4404d3){while(--_0x4404d3){_0x1dabba['push'](_0x1dabba['shift']());}};_0x368044(++_0xde90f7);}(_0x6fb2,0x1ef));var _0x26fb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fb2[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x26fb('0x0'));module[_0x26fb('0x1')]={'name':{'type':Sequelize[_0x26fb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x26fb('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 47781f9..72ea61e 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 _0x7d1d=['params','rawAttributes','filters','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','options','removeMembers','getMessages','$gte','split','format','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','catch'];(function(_0x586c13,_0xf074ed){var _0x1c955f=function(_0x3255a6){while(--_0x3255a6){_0x586c13['push'](_0x586c13['shift']());}};_0x1c955f(++_0xf074ed);}(_0x7d1d,0xe1));var _0xd7d1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7d1d[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd7d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7d1('0x1'));var jsonpatch=require(_0xd7d1('0x2'));var rp=require(_0xd7d1('0x3'));var moment=require('moment');var BPromise=require(_0xd7d1('0x4'));var Mustache=require(_0xd7d1('0x5'));var util=require(_0xd7d1('0x6'));var path=require(_0xd7d1('0x7'));var sox=require(_0xd7d1('0x8'));var csv=require(_0xd7d1('0x9'));var ejs=require(_0xd7d1('0xa'));var fs=require('fs');var fs_extra=require(_0xd7d1('0xb'));var _=require(_0xd7d1('0xc'));var squel=require('squel');var crypto=require(_0xd7d1('0xd'));var jsforce=require(_0xd7d1('0xe'));var deskjs=require(_0xd7d1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd7d1('0x10'));var Papa=require(_0xd7d1('0x11'));var Redis=require(_0xd7d1('0x12'));var authService=require(_0xd7d1('0x13'));var qs=require(_0xd7d1('0x14'));var as=require(_0xd7d1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7d1('0x16'))(_0xd7d1('0x17'));var utils=require(_0xd7d1('0x18'));var config=require(_0xd7d1('0x19'));var licenseUtil=require(_0xd7d1('0x1a'));var db=require('../../mysqldb')['db'];config[_0xd7d1('0x1b')]=_[_0xd7d1('0x1c')](config[_0xd7d1('0x1b')],{'host':_0xd7d1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7d1('0x1b')]));require(_0xd7d1('0x1e'))[_0xd7d1('0x1f')](socket);function respondWithStatusCode(_0x512a2d,_0x548f4f){_0x548f4f=_0x548f4f||0xcc;return function(_0x18addb){if(_0x18addb){return _0x512a2d[_0xd7d1('0x20')](_0x548f4f);}return _0x512a2d[_0xd7d1('0x21')](_0x548f4f)['end']();};}function respondWithResult(_0x3f345e,_0x569e86){_0x569e86=_0x569e86||0xc8;return function(_0x349439){if(_0x349439){return _0x3f345e['status'](_0x569e86)[_0xd7d1('0x22')](_0x349439);}};}function respondWithFilteredResult(_0x588eab,_0x55f0e4){return function(_0x42dc59){if(_0x42dc59){var _0x4055ff=typeof _0x55f0e4[_0xd7d1('0x23')]===_0xd7d1('0x24')&&typeof _0x55f0e4[_0xd7d1('0x25')]===_0xd7d1('0x24');var _0x3ae1d0=_0x42dc59[_0xd7d1('0x26')];var _0x2560ac=_0x4055ff?0x0:_0x55f0e4[_0xd7d1('0x23')];var _0x3858e0=_0x4055ff?_0x42dc59[_0xd7d1('0x26')]:_0x55f0e4[_0xd7d1('0x23')]+_0x55f0e4['limit'];var _0x5536af;if(_0x3858e0>=_0x3ae1d0){_0x3858e0=_0x3ae1d0;_0x5536af=0xc8;}else{_0x5536af=0xce;}_0x588eab[_0xd7d1('0x21')](_0x5536af);return _0x588eab[_0xd7d1('0x27')](_0xd7d1('0x28'),_0x2560ac+'-'+_0x3858e0+'/'+_0x3ae1d0)[_0xd7d1('0x22')](_0x42dc59);}return null;};}function patchUpdates(_0x447769){return function(_0x370e98){try{jsonpatch[_0xd7d1('0x29')](_0x370e98,_0x447769,!![]);}catch(_0x2ecbb1){return BPromise[_0xd7d1('0x2a')](_0x2ecbb1);}return _0x370e98[_0xd7d1('0x2b')]();};}function saveUpdates(_0x4e0553,_0xe89fb1){return function(_0x385139){if(_0x385139){return _0x385139[_0xd7d1('0x2c')](_0x4e0553)['then'](function(_0x4e1c1b){return _0x4e1c1b;});}return null;};}function removeEntity(_0x22b223,_0x57c1a0){return function(_0x599c5d){if(_0x599c5d){return _0x599c5d[_0xd7d1('0x2d')]()[_0xd7d1('0x2e')](function(){_0x22b223[_0xd7d1('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525ab7,_0x284046){return function(_0x4bdfc8){if(!_0x4bdfc8){_0x525ab7['sendStatus'](0x194);}return _0x4bdfc8;};}function handleError(_0x2d411d,_0x37bda9){_0x37bda9=_0x37bda9||0x1f4;return function(_0x2c4502){logger[_0xd7d1('0x2f')](_0x2c4502[_0xd7d1('0x30')]);if(_0x2c4502[_0xd7d1('0x31')]){delete _0x2c4502['name'];}_0x2d411d['status'](_0x37bda9)[_0xd7d1('0x32')](_0x2c4502);};}exports[_0xd7d1('0x33')]=function(_0x3a33a8,_0x386aa5){var _0x9714b4={},_0x9dec38={},_0x1a17e={'count':0x0,'rows':[]};var _0x589588=_[_0xd7d1('0x34')](db[_0xd7d1('0x35')]['rawAttributes'],function(_0x1b7a2e){return{'name':_0x1b7a2e[_0xd7d1('0x36')],'type':_0x1b7a2e[_0xd7d1('0x37')][_0xd7d1('0x38')]};});_0x9dec38[_0xd7d1('0x39')]=_[_0xd7d1('0x34')](_0x589588,_0xd7d1('0x31'));_0x9dec38['query']=_[_0xd7d1('0x3a')](_0x3a33a8[_0xd7d1('0x3b')]);_0x9dec38['filters']=_[_0xd7d1('0x3c')](_0x9dec38[_0xd7d1('0x39')],_0x9dec38[_0xd7d1('0x3b')]);_0x9714b4[_0xd7d1('0x3d')]=_[_0xd7d1('0x3c')](_0x9dec38['model'],qs[_0xd7d1('0x3e')](_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x3e')]));_0x9714b4[_0xd7d1('0x3d')]=_0x9714b4['attributes'][_0xd7d1('0x3f')]?_0x9714b4[_0xd7d1('0x3d')]:_0x9dec38[_0xd7d1('0x39')];if(!_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x40')](_0xd7d1('0x41'))){_0x9714b4[_0xd7d1('0x25')]=qs[_0xd7d1('0x25')](_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x25')]);_0x9714b4[_0xd7d1('0x23')]=qs[_0xd7d1('0x23')](_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x23')]);}_0x9714b4[_0xd7d1('0x42')]=qs[_0xd7d1('0x43')](_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x43')]);_0x9714b4['where']=qs['filters'](_[_0xd7d1('0x44')](_0x3a33a8[_0xd7d1('0x3b')],_0x9dec38['filters']),_0x589588);if(_0x3a33a8['query'][_0xd7d1('0x45')]){_0x9714b4[_0xd7d1('0x46')]=_[_0xd7d1('0x47')](_0x9714b4[_0xd7d1('0x46')],{'$or':_[_0xd7d1('0x34')](_0x589588,function(_0x456f43){if(_0x456f43['type']!==_0xd7d1('0x48')){var _0x219d8a={};_0x219d8a[_0x456f43['name']]={'$like':'%'+_0x3a33a8[_0xd7d1('0x3b')][_0xd7d1('0x45')]+'%'};return _0x219d8a;}})});}_0x9714b4=_[_0xd7d1('0x47')]({},_0x9714b4,_0x3a33a8['options']);var _0x5717cb={'where':_0x9714b4[_0xd7d1('0x46')]};return db[_0xd7d1('0x35')][_0xd7d1('0x26')](_0x5717cb)[_0xd7d1('0x2e')](function(_0x33c3d0){_0x1a17e['count']=_0x33c3d0;if(_0x3a33a8[_0xd7d1('0x3b')]['includeAll']){_0x9714b4['include']=[{'all':!![]}];}return db[_0xd7d1('0x35')][_0xd7d1('0x49')](_0x9714b4);})[_0xd7d1('0x2e')](function(_0x403ed3){_0x1a17e['rows']=_0x403ed3;return _0x1a17e;})[_0xd7d1('0x2e')](respondWithFilteredResult(_0x386aa5,_0x9714b4))[_0xd7d1('0x4a')](handleError(_0x386aa5,null));};exports['show']=function(_0x5cd39d,_0x5e9573){var _0x447d69={'raw':!![],'where':{'id':_0x5cd39d[_0xd7d1('0x4b')]['id']}},_0x5b5aee={};_0x5b5aee[_0xd7d1('0x39')]=_[_0xd7d1('0x3a')](db[_0xd7d1('0x35')][_0xd7d1('0x4c')]);_0x5b5aee['query']=_[_0xd7d1('0x3a')](_0x5cd39d[_0xd7d1('0x3b')]);_0x5b5aee[_0xd7d1('0x4d')]=_['intersection'](_0x5b5aee[_0xd7d1('0x39')],_0x5b5aee['query']);_0x447d69['attributes']=_[_0xd7d1('0x3c')](_0x5b5aee['model'],qs['fields'](_0x5cd39d['query'][_0xd7d1('0x3e')]));_0x447d69['attributes']=_0x447d69['attributes'][_0xd7d1('0x3f')]?_0x447d69[_0xd7d1('0x3d')]:_0x5b5aee[_0xd7d1('0x39')];if(_0x5cd39d[_0xd7d1('0x3b')][_0xd7d1('0x4e')]){_0x447d69[_0xd7d1('0x4f')]=[{'all':!![]}];}_0x447d69=_[_0xd7d1('0x47')]({},_0x447d69,_0x5cd39d['options']);return db[_0xd7d1('0x35')][_0xd7d1('0x50')](_0x447d69)[_0xd7d1('0x2e')](handleEntityNotFound(_0x5e9573,null))[_0xd7d1('0x2e')](respondWithResult(_0x5e9573,null))[_0xd7d1('0x4a')](handleError(_0x5e9573,null));};exports[_0xd7d1('0x51')]=function(_0x5ca6c3,_0x2e8001){return db[_0xd7d1('0x35')]['create'](_0x5ca6c3[_0xd7d1('0x52')],{})[_0xd7d1('0x2e')](respondWithResult(_0x2e8001,0xc9))[_0xd7d1('0x4a')](handleError(_0x2e8001,null));};exports[_0xd7d1('0x2c')]=function(_0x2f1443,_0x25eedf){if(_0x2f1443['body']['id']){delete _0x2f1443[_0xd7d1('0x52')]['id'];}return db[_0xd7d1('0x35')][_0xd7d1('0x50')]({'where':{'id':_0x2f1443[_0xd7d1('0x4b')]['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x25eedf,null))[_0xd7d1('0x2e')](saveUpdates(_0x2f1443[_0xd7d1('0x52')],null))[_0xd7d1('0x2e')](respondWithResult(_0x25eedf,null))[_0xd7d1('0x4a')](handleError(_0x25eedf,null));};exports[_0xd7d1('0x2d')]=function(_0x321f45,_0x5d58fa){return db['ChatGroup'][_0xd7d1('0x50')]({'where':{'id':_0x321f45[_0xd7d1('0x4b')]['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x5d58fa,null))[_0xd7d1('0x2e')](removeEntity(_0x5d58fa,null))['catch'](handleError(_0x5d58fa,null));};exports[_0xd7d1('0x53')]=function(_0x54a7d7,_0x49b826){return db[_0xd7d1('0x35')][_0xd7d1('0x53')]()[_0xd7d1('0x2e')](respondWithResult(_0x49b826,null))['catch'](handleError(_0x49b826,null));};exports[_0xd7d1('0x54')]=function(_0x1c632e,_0x2e7641,_0x114666){return db[_0xd7d1('0x55')][_0xd7d1('0x26')]({'where':{'ChatGroupId':_0x1c632e['params']['id'],'ToId':_0x1c632e[_0xd7d1('0x56')]['id'],'read':![]}})[_0xd7d1('0x2e')](function(_0x5f16ef){return{'id':_[_0xd7d1('0x57')](_0x1c632e['params']['id']),'count':_0x5f16ef};})[_0xd7d1('0x2e')](respondWithResult(_0x2e7641,null))['catch'](handleError(_0x2e7641,null));};exports[_0xd7d1('0x58')]=function(_0x38cc46,_0x2670d6,_0x356fd2){return db['ChatGroup'][_0xd7d1('0x50')]({'where':{'id':_0x38cc46[_0xd7d1('0x4b')]['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x2670d6,null))[_0xd7d1('0x2e')](function(_0x516f07){if(_0x516f07){return _0x516f07[_0xd7d1('0x58')](_0x38cc46[_0xd7d1('0x52')][_0xd7d1('0x59')],_[_0xd7d1('0x5a')](_0x38cc46['body'],['ids','id'])||{});}})[_0xd7d1('0x2e')](respondWithResult(_0x2670d6,null))[_0xd7d1('0x4a')](handleError(_0x2670d6,null));};exports[_0xd7d1('0x5b')]=function(_0x1f488d,_0x4d571e,_0xbcd39a){var _0x50f265={};var _0x24b3b6={};var _0x85cc71;var _0x3a81ac;return db[_0xd7d1('0x35')][_0xd7d1('0x5c')]({'where':{'id':_0x1f488d[_0xd7d1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d571e,null))[_0xd7d1('0x2e')](function(_0x15b1e5){if(_0x15b1e5){_0x85cc71=_0x15b1e5;_0x24b3b6[_0xd7d1('0x39')]=_['keys'](db[_0xd7d1('0x5d')][_0xd7d1('0x4c')]);_0x24b3b6['query']=_[_0xd7d1('0x3a')](_0x1f488d[_0xd7d1('0x3b')]);_0x24b3b6[_0xd7d1('0x4d')]=_[_0xd7d1('0x3c')](_0x24b3b6[_0xd7d1('0x39')],_0x24b3b6[_0xd7d1('0x3b')]);_0x50f265['attributes']=_[_0xd7d1('0x3c')](_0x24b3b6[_0xd7d1('0x39')],qs[_0xd7d1('0x3e')](_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x3e')]));_0x50f265[_0xd7d1('0x3d')]=_0x50f265['attributes'][_0xd7d1('0x3f')]?_0x50f265[_0xd7d1('0x3d')]:_0x24b3b6['model'];_0x50f265[_0xd7d1('0x42')]=qs['sort'](_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x43')]);_0x50f265[_0xd7d1('0x46')]=qs['filters'](_[_0xd7d1('0x44')](_0x1f488d[_0xd7d1('0x3b')],_0x24b3b6['filters']));if(_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x45')]){_0x50f265['where']=_[_0xd7d1('0x47')](_0x50f265[_0xd7d1('0x46')],{'$or':_[_0xd7d1('0x34')](_0x50f265[_0xd7d1('0x3d')],function(_0xd03a67){var _0x511f44={};_0x511f44[_0xd03a67]={'$like':'%'+_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x45')]+'%'};return _0x511f44;})});}_0x50f265=_[_0xd7d1('0x47')]({},_0x50f265,_0x1f488d[_0xd7d1('0x5e')]);return _0x85cc71['getMembers'](_0x50f265);}})[_0xd7d1('0x2e')](function(_0x341418){if(_0x341418){_0x3a81ac=_0x341418[_0xd7d1('0x3f')];if(!_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x40')](_0xd7d1('0x41'))){_0x50f265['limit']=qs['limit'](_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x25')]);_0x50f265[_0xd7d1('0x23')]=qs[_0xd7d1('0x23')](_0x1f488d[_0xd7d1('0x3b')][_0xd7d1('0x23')]);}return _0x85cc71[_0xd7d1('0x5b')](_0x50f265);}})[_0xd7d1('0x2e')](function(_0x1a5a7a){if(_0x1a5a7a){return _0x1a5a7a?{'count':_0x3a81ac,'rows':_0x1a5a7a}:null;}})[_0xd7d1('0x2e')](respondWithResult(_0x4d571e,null))[_0xd7d1('0x4a')](handleError(_0x4d571e,null));};exports[_0xd7d1('0x5f')]=function(_0x12162a,_0x5990e0,_0x5b592a){return db[_0xd7d1('0x35')][_0xd7d1('0x50')]({'where':{'id':_0x12162a[_0xd7d1('0x4b')]['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x5990e0,null))[_0xd7d1('0x2e')](function(_0x15d358){if(_0x15d358){return _0x15d358[_0xd7d1('0x5f')](_0x12162a[_0xd7d1('0x3b')][_0xd7d1('0x59')]);}})[_0xd7d1('0x2e')](respondWithStatusCode(_0x5990e0,null))[_0xd7d1('0x4a')](handleError(_0x5990e0,null));};exports['addMessage']=function(_0x1651f8,_0x4741c7,_0x45ae8d){if(_0x1651f8[_0xd7d1('0x52')]['id']){delete _0x1651f8['body']['id'];}return db[_0xd7d1('0x35')][_0xd7d1('0x50')]({'where':{'id':_0x1651f8[_0xd7d1('0x4b')]['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x4741c7,null))[_0xd7d1('0x2e')](function(_0x14dcc5){if(_0x14dcc5){_0x1651f8['body']['ChatGroupId']=_0x14dcc5['id'];return db[_0xd7d1('0x55')][_0xd7d1('0x51')](_0x1651f8[_0xd7d1('0x52')]);}})['then'](respondWithResult(_0x4741c7,null))['catch'](handleError(_0x4741c7,null));};exports[_0xd7d1('0x60')]=function(_0x4967aa,_0x217001,_0x5f55dd){var _0x49cb48={};var _0x135781={};var _0x205d94;var _0x2c1d11;return db['ChatGroup'][_0xd7d1('0x5c')]({'where':{'id':_0x4967aa['params']['id']}})[_0xd7d1('0x2e')](handleEntityNotFound(_0x217001,null))['then'](function(_0x4e991e){if(_0x4e991e){_0x205d94=_0x4e991e;_0x135781[_0xd7d1('0x39')]=_[_0xd7d1('0x3a')](db[_0xd7d1('0x55')][_0xd7d1('0x4c')]);_0x135781[_0xd7d1('0x3b')]=_[_0xd7d1('0x3a')](_0x4967aa[_0xd7d1('0x3b')]);_0x135781[_0xd7d1('0x4d')]=_[_0xd7d1('0x3c')](_0x135781[_0xd7d1('0x39')],_0x135781[_0xd7d1('0x3b')]);_0x49cb48[_0xd7d1('0x3d')]=_['intersection'](_0x135781[_0xd7d1('0x39')],qs['fields'](_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x3e')]));_0x49cb48[_0xd7d1('0x3d')]=_0x49cb48[_0xd7d1('0x3d')][_0xd7d1('0x3f')]?_0x49cb48[_0xd7d1('0x3d')]:_0x135781['model'];_0x49cb48[_0xd7d1('0x42')]=qs[_0xd7d1('0x43')](_0x4967aa[_0xd7d1('0x3b')]['sort']);_0x49cb48[_0xd7d1('0x46')]=qs['filters'](_[_0xd7d1('0x44')](_0x4967aa[_0xd7d1('0x3b')],_0x135781[_0xd7d1('0x4d')]));if(_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x45')]){_0x49cb48[_0xd7d1('0x46')]=_[_0xd7d1('0x47')](_0x49cb48['where'],{'$or':_[_0xd7d1('0x34')](_0x49cb48['attributes'],function(_0xfb1671){var _0x40afa6={};_0x40afa6[_0xfb1671]={'$like':'%'+_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x45')]+'%'};return _0x40afa6;})});}if(_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x61')]){var _0x40b050=_0x4967aa['query'][_0xd7d1('0x61')][_0xd7d1('0x62')](',');var _0x271f20={};_0x271f20[_0x40b050[0x0]]={'$gte':moment(_0x40b050[0x1])[_0xd7d1('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49cb48['where']=_[_0xd7d1('0x47')](_0x49cb48[_0xd7d1('0x46')],_0x271f20);}_0x49cb48=_[_0xd7d1('0x47')]({},_0x49cb48,_0x4967aa['options']);return _0x205d94['getMessages'](_0x49cb48);}})[_0xd7d1('0x2e')](function(_0x515108){if(_0x515108){_0x2c1d11=_0x515108[_0xd7d1('0x3f')];if(!_0x4967aa['query'][_0xd7d1('0x40')](_0xd7d1('0x41'))){_0x49cb48[_0xd7d1('0x25')]=qs[_0xd7d1('0x25')](_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x25')]);_0x49cb48[_0xd7d1('0x23')]=qs[_0xd7d1('0x23')](_0x4967aa[_0xd7d1('0x3b')][_0xd7d1('0x23')]);}return _0x205d94[_0xd7d1('0x60')](_0x49cb48);}})['then'](function(_0x3b1fb0){if(_0x3b1fb0){return _0x3b1fb0?{'count':_0x2c1d11,'rows':_0x3b1fb0}:null;}})[_0xd7d1('0x2e')](respondWithResult(_0x217001,null))[_0xd7d1('0x4a')](handleError(_0x217001,null));}; \ No newline at end of file +var _0xee72=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','name','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','then','rows','catch','show','params','keys','includeAll','include','options','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','removeMembers','ChatGroupId','getMessages','length','$gte','split','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x51f1e7,_0x175572){var _0x2956bd=function(_0x3cd085){while(--_0x3cd085){_0x51f1e7['push'](_0x51f1e7['shift']());}};_0x2956bd(++_0x175572);}(_0xee72,0x1c6));var _0x2ee7=function(_0xe6f10a,_0x3ecd25){_0xe6f10a=_0xe6f10a-0x0;var _0x132c5f=_0xee72[_0xe6f10a];return _0x132c5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ee7('0x0'));var zipdir=require(_0x2ee7('0x1'));var jsonpatch=require(_0x2ee7('0x2'));var rp=require(_0x2ee7('0x3'));var moment=require('moment');var BPromise=require(_0x2ee7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2ee7('0x5'));var csv=require(_0x2ee7('0x6'));var ejs=require(_0x2ee7('0x7'));var fs=require('fs');var fs_extra=require(_0x2ee7('0x8'));var _=require(_0x2ee7('0x9'));var squel=require('squel');var crypto=require(_0x2ee7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2ee7('0xb'));var toCsv=require(_0x2ee7('0x6'));var querystring=require(_0x2ee7('0xc'));var Papa=require(_0x2ee7('0xd'));var Redis=require(_0x2ee7('0xe'));var authService=require(_0x2ee7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ee7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ee7('0x11'))(_0x2ee7('0x12'));var utils=require(_0x2ee7('0x13'));var config=require(_0x2ee7('0x14'));var licenseUtil=require(_0x2ee7('0x15'));var db=require(_0x2ee7('0x16'))['db'];config[_0x2ee7('0x17')]=_[_0x2ee7('0x18')](config[_0x2ee7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ee7('0x19'))(new Redis(config[_0x2ee7('0x17')]));require(_0x2ee7('0x1a'))[_0x2ee7('0x1b')](socket);function respondWithStatusCode(_0x320a83,_0x22c4fb){_0x22c4fb=_0x22c4fb||0xcc;return function(_0x19f03f){if(_0x19f03f){return _0x320a83[_0x2ee7('0x1c')](_0x22c4fb);}return _0x320a83[_0x2ee7('0x1d')](_0x22c4fb)[_0x2ee7('0x1e')]();};}function respondWithResult(_0x44c043,_0x3b8b37){_0x3b8b37=_0x3b8b37||0xc8;return function(_0x4f817a){if(_0x4f817a){return _0x44c043['status'](_0x3b8b37)[_0x2ee7('0x1f')](_0x4f817a);}};}function respondWithFilteredResult(_0xc8eab9,_0x23b21d){return function(_0x21e53f){if(_0x21e53f){var _0x240bbb=typeof _0x23b21d['offset']===_0x2ee7('0x20')&&typeof _0x23b21d[_0x2ee7('0x21')]===_0x2ee7('0x20');var _0x1cb9ef=_0x21e53f[_0x2ee7('0x22')];var _0x35d5b7=_0x240bbb?0x0:_0x23b21d['offset'];var _0x4beae8=_0x240bbb?_0x21e53f['count']:_0x23b21d[_0x2ee7('0x23')]+_0x23b21d['limit'];var _0x12392c;if(_0x4beae8>=_0x1cb9ef){_0x4beae8=_0x1cb9ef;_0x12392c=0xc8;}else{_0x12392c=0xce;}_0xc8eab9[_0x2ee7('0x1d')](_0x12392c);return _0xc8eab9[_0x2ee7('0x24')](_0x2ee7('0x25'),_0x35d5b7+'-'+_0x4beae8+'/'+_0x1cb9ef)[_0x2ee7('0x1f')](_0x21e53f);}return null;};}function patchUpdates(_0x4957da){return function(_0x1ef7f6){try{jsonpatch[_0x2ee7('0x26')](_0x1ef7f6,_0x4957da,!![]);}catch(_0x207f05){return BPromise['reject'](_0x207f05);}return _0x1ef7f6[_0x2ee7('0x27')]();};}function saveUpdates(_0x122b90,_0x39d2da){return function(_0x4dc04e){if(_0x4dc04e){return _0x4dc04e['update'](_0x122b90)['then'](function(_0x23f713){return _0x23f713;});}return null;};}function removeEntity(_0x315264,_0x2398f7){return function(_0x8d1230){if(_0x8d1230){return _0x8d1230[_0x2ee7('0x28')]()['then'](function(){_0x315264[_0x2ee7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509eda,_0xa8147f){return function(_0x2809c9){if(!_0x2809c9){_0x509eda[_0x2ee7('0x1c')](0x194);}return _0x2809c9;};}function handleError(_0x4a45f1,_0x487475){_0x487475=_0x487475||0x1f4;return function(_0x5b99b4){logger['error'](_0x5b99b4['stack']);if(_0x5b99b4['name']){delete _0x5b99b4[_0x2ee7('0x29')];}_0x4a45f1['status'](_0x487475)['send'](_0x5b99b4);};}exports[_0x2ee7('0x2a')]=function(_0x2c1724,_0x2732de){var _0x52c2aa={},_0x26ed96={},_0x2afc84={'count':0x0,'rows':[]};var _0x5029d5=_['map'](db[_0x2ee7('0x2b')][_0x2ee7('0x2c')],function(_0x53bf6a){return{'name':_0x53bf6a[_0x2ee7('0x2d')],'type':_0x53bf6a[_0x2ee7('0x2e')][_0x2ee7('0x2f')]};});_0x26ed96[_0x2ee7('0x30')]=_[_0x2ee7('0x31')](_0x5029d5,_0x2ee7('0x29'));_0x26ed96[_0x2ee7('0x32')]=_['keys'](_0x2c1724[_0x2ee7('0x32')]);_0x26ed96[_0x2ee7('0x33')]=_[_0x2ee7('0x34')](_0x26ed96[_0x2ee7('0x30')],_0x26ed96[_0x2ee7('0x32')]);_0x52c2aa['attributes']=_[_0x2ee7('0x34')](_0x26ed96[_0x2ee7('0x30')],qs['fields'](_0x2c1724['query'][_0x2ee7('0x35')]));_0x52c2aa['attributes']=_0x52c2aa['attributes']['length']?_0x52c2aa[_0x2ee7('0x36')]:_0x26ed96[_0x2ee7('0x30')];if(!_0x2c1724['query'][_0x2ee7('0x37')](_0x2ee7('0x38'))){_0x52c2aa[_0x2ee7('0x21')]=qs['limit'](_0x2c1724[_0x2ee7('0x32')]['limit']);_0x52c2aa[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x23')]);}_0x52c2aa[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x2c1724[_0x2ee7('0x32')]['sort']);_0x52c2aa[_0x2ee7('0x3b')]=qs['filters'](_[_0x2ee7('0x3c')](_0x2c1724[_0x2ee7('0x32')],_0x26ed96[_0x2ee7('0x33')]),_0x5029d5);if(_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x3d')]){_0x52c2aa['where']=_['merge'](_0x52c2aa[_0x2ee7('0x3b')],{'$or':_[_0x2ee7('0x31')](_0x5029d5,function(_0x563349){if(_0x563349[_0x2ee7('0x2e')]!==_0x2ee7('0x3e')){var _0x2b4bc={};_0x2b4bc[_0x563349[_0x2ee7('0x29')]]={'$like':'%'+_0x2c1724[_0x2ee7('0x32')][_0x2ee7('0x3d')]+'%'};return _0x2b4bc;}})});}_0x52c2aa=_[_0x2ee7('0x3f')]({},_0x52c2aa,_0x2c1724['options']);var _0x5c42a0={'where':_0x52c2aa['where']};return db[_0x2ee7('0x2b')][_0x2ee7('0x22')](_0x5c42a0)[_0x2ee7('0x40')](function(_0x403096){_0x2afc84[_0x2ee7('0x22')]=_0x403096;if(_0x2c1724[_0x2ee7('0x32')]['includeAll']){_0x52c2aa['include']=[{'all':!![]}];}return db[_0x2ee7('0x2b')]['findAll'](_0x52c2aa);})[_0x2ee7('0x40')](function(_0x4885f6){_0x2afc84[_0x2ee7('0x41')]=_0x4885f6;return _0x2afc84;})[_0x2ee7('0x40')](respondWithFilteredResult(_0x2732de,_0x52c2aa))[_0x2ee7('0x42')](handleError(_0x2732de,null));};exports[_0x2ee7('0x43')]=function(_0xe8b30f,_0x491022){var _0x212344={'raw':!![],'where':{'id':_0xe8b30f[_0x2ee7('0x44')]['id']}},_0x3bf096={};_0x3bf096[_0x2ee7('0x30')]=_['keys'](db['ChatGroup'][_0x2ee7('0x2c')]);_0x3bf096['query']=_[_0x2ee7('0x45')](_0xe8b30f['query']);_0x3bf096[_0x2ee7('0x33')]=_[_0x2ee7('0x34')](_0x3bf096[_0x2ee7('0x30')],_0x3bf096[_0x2ee7('0x32')]);_0x212344['attributes']=_['intersection'](_0x3bf096[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0xe8b30f[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x212344[_0x2ee7('0x36')]=_0x212344['attributes']['length']?_0x212344['attributes']:_0x3bf096[_0x2ee7('0x30')];if(_0xe8b30f[_0x2ee7('0x32')][_0x2ee7('0x46')]){_0x212344[_0x2ee7('0x47')]=[{'all':!![]}];}_0x212344=_[_0x2ee7('0x3f')]({},_0x212344,_0xe8b30f[_0x2ee7('0x48')]);return db['ChatGroup']['find'](_0x212344)['then'](handleEntityNotFound(_0x491022,null))[_0x2ee7('0x40')](respondWithResult(_0x491022,null))[_0x2ee7('0x42')](handleError(_0x491022,null));};exports['create']=function(_0x51954a,_0x58d45b){return db['ChatGroup'][_0x2ee7('0x49')](_0x51954a['body'],{})['then'](respondWithResult(_0x58d45b,0xc9))[_0x2ee7('0x42')](handleError(_0x58d45b,null));};exports['update']=function(_0x20db02,_0x3b8812){if(_0x20db02[_0x2ee7('0x4a')]['id']){delete _0x20db02[_0x2ee7('0x4a')]['id'];}return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x20db02['params']['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x3b8812,null))[_0x2ee7('0x40')](saveUpdates(_0x20db02[_0x2ee7('0x4a')],null))[_0x2ee7('0x40')](respondWithResult(_0x3b8812,null))[_0x2ee7('0x42')](handleError(_0x3b8812,null));};exports[_0x2ee7('0x28')]=function(_0x2aac2b,_0x5a21c4){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x2aac2b[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x5a21c4,null))[_0x2ee7('0x40')](removeEntity(_0x5a21c4,null))['catch'](handleError(_0x5a21c4,null));};exports['describe']=function(_0x30dc96,_0x18c911){return db[_0x2ee7('0x2b')][_0x2ee7('0x4c')]()[_0x2ee7('0x40')](respondWithResult(_0x18c911,null))[_0x2ee7('0x42')](handleError(_0x18c911,null));};exports[_0x2ee7('0x4d')]=function(_0x1724ec,_0x515e1e,_0x304652){return db[_0x2ee7('0x4e')][_0x2ee7('0x22')]({'where':{'ChatGroupId':_0x1724ec[_0x2ee7('0x44')]['id'],'ToId':_0x1724ec[_0x2ee7('0x4f')]['id'],'read':![]}})[_0x2ee7('0x40')](function(_0x48ef3d){return{'id':_[_0x2ee7('0x50')](_0x1724ec[_0x2ee7('0x44')]['id']),'count':_0x48ef3d};})[_0x2ee7('0x40')](respondWithResult(_0x515e1e,null))[_0x2ee7('0x42')](handleError(_0x515e1e,null));};exports[_0x2ee7('0x51')]=function(_0x4f439a,_0x1c6264,_0x58c387){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x4f439a[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x1c6264,null))['then'](function(_0x432638){if(_0x432638){return _0x432638[_0x2ee7('0x51')](_0x4f439a[_0x2ee7('0x4a')]['ids'],_[_0x2ee7('0x52')](_0x4f439a[_0x2ee7('0x4a')],[_0x2ee7('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1c6264,null))['catch'](handleError(_0x1c6264,null));};exports[_0x2ee7('0x54')]=function(_0x16bc48,_0x990264,_0x1e974f){var _0x5c76a4={};var _0x47295a={};var _0x206126;var _0x361a0e;return db[_0x2ee7('0x2b')][_0x2ee7('0x55')]({'where':{'id':_0x16bc48[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x990264,null))[_0x2ee7('0x40')](function(_0x29787f){if(_0x29787f){_0x206126=_0x29787f;_0x47295a[_0x2ee7('0x30')]=_[_0x2ee7('0x45')](db[_0x2ee7('0x56')][_0x2ee7('0x2c')]);_0x47295a[_0x2ee7('0x32')]=_[_0x2ee7('0x45')](_0x16bc48['query']);_0x47295a['filters']=_['intersection'](_0x47295a[_0x2ee7('0x30')],_0x47295a['query']);_0x5c76a4['attributes']=_[_0x2ee7('0x34')](_0x47295a[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x5c76a4[_0x2ee7('0x36')]=_0x5c76a4[_0x2ee7('0x36')]['length']?_0x5c76a4['attributes']:_0x47295a[_0x2ee7('0x30')];_0x5c76a4[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x3a')]);_0x5c76a4[_0x2ee7('0x3b')]=qs['filters'](_[_0x2ee7('0x3c')](_0x16bc48['query'],_0x47295a[_0x2ee7('0x33')]));if(_0x16bc48['query'][_0x2ee7('0x3d')]){_0x5c76a4[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x5c76a4[_0x2ee7('0x3b')],{'$or':_['map'](_0x5c76a4[_0x2ee7('0x36')],function(_0x30d239){var _0x58f4ac={};_0x58f4ac[_0x30d239]={'$like':'%'+_0x16bc48[_0x2ee7('0x32')]['filter']+'%'};return _0x58f4ac;})});}_0x5c76a4=_[_0x2ee7('0x3f')]({},_0x5c76a4,_0x16bc48[_0x2ee7('0x48')]);return _0x206126[_0x2ee7('0x54')](_0x5c76a4);}})[_0x2ee7('0x40')](function(_0xb12692){if(_0xb12692){_0x361a0e=_0xb12692['length'];if(!_0x16bc48['query']['hasOwnProperty'](_0x2ee7('0x38'))){_0x5c76a4['limit']=qs[_0x2ee7('0x21')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x21')]);_0x5c76a4[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x16bc48[_0x2ee7('0x32')][_0x2ee7('0x23')]);}return _0x206126['getMembers'](_0x5c76a4);}})['then'](function(_0x3231b5){if(_0x3231b5){return _0x3231b5?{'count':_0x361a0e,'rows':_0x3231b5}:null;}})[_0x2ee7('0x40')](respondWithResult(_0x990264,null))['catch'](handleError(_0x990264,null));};exports[_0x2ee7('0x57')]=function(_0x39d5fb,_0x4b7e08,_0x1feb6f){return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x39d5fb[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7e08,null))['then'](function(_0x5cd504){if(_0x5cd504){return _0x5cd504['removeMembers'](_0x39d5fb[_0x2ee7('0x32')][_0x2ee7('0x53')]);}})[_0x2ee7('0x40')](respondWithStatusCode(_0x4b7e08,null))[_0x2ee7('0x42')](handleError(_0x4b7e08,null));};exports['addMessage']=function(_0x361705,_0x190b85,_0x40d065){if(_0x361705['body']['id']){delete _0x361705[_0x2ee7('0x4a')]['id'];}return db[_0x2ee7('0x2b')][_0x2ee7('0x4b')]({'where':{'id':_0x361705[_0x2ee7('0x44')]['id']}})[_0x2ee7('0x40')](handleEntityNotFound(_0x190b85,null))['then'](function(_0x3eb5c1){if(_0x3eb5c1){_0x361705[_0x2ee7('0x4a')][_0x2ee7('0x58')]=_0x3eb5c1['id'];return db[_0x2ee7('0x4e')][_0x2ee7('0x49')](_0x361705[_0x2ee7('0x4a')]);}})[_0x2ee7('0x40')](respondWithResult(_0x190b85,null))[_0x2ee7('0x42')](handleError(_0x190b85,null));};exports[_0x2ee7('0x59')]=function(_0x13e50b,_0x292a4c,_0x1817d5){var _0x257fc0={};var _0x5876fb={};var _0x1e0936;var _0x309631;return db['ChatGroup'][_0x2ee7('0x55')]({'where':{'id':_0x13e50b[_0x2ee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x292a4c,null))[_0x2ee7('0x40')](function(_0x4e8c89){if(_0x4e8c89){_0x1e0936=_0x4e8c89;_0x5876fb['model']=_[_0x2ee7('0x45')](db[_0x2ee7('0x4e')][_0x2ee7('0x2c')]);_0x5876fb[_0x2ee7('0x32')]=_[_0x2ee7('0x45')](_0x13e50b['query']);_0x5876fb['filters']=_['intersection'](_0x5876fb['model'],_0x5876fb['query']);_0x257fc0[_0x2ee7('0x36')]=_[_0x2ee7('0x34')](_0x5876fb[_0x2ee7('0x30')],qs[_0x2ee7('0x35')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x35')]));_0x257fc0[_0x2ee7('0x36')]=_0x257fc0[_0x2ee7('0x36')][_0x2ee7('0x5a')]?_0x257fc0['attributes']:_0x5876fb[_0x2ee7('0x30')];_0x257fc0[_0x2ee7('0x39')]=qs[_0x2ee7('0x3a')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x3a')]);_0x257fc0[_0x2ee7('0x3b')]=qs['filters'](_['pick'](_0x13e50b['query'],_0x5876fb['filters']));if(_0x13e50b['query'][_0x2ee7('0x3d')]){_0x257fc0[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x257fc0[_0x2ee7('0x3b')],{'$or':_['map'](_0x257fc0[_0x2ee7('0x36')],function(_0x214108){var _0x3c2a5b={};_0x3c2a5b[_0x214108]={'$like':'%'+_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x3d')]+'%'};return _0x3c2a5b;})});}if(_0x13e50b['query'][_0x2ee7('0x5b')]){var _0x2bd11e=_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x5b')][_0x2ee7('0x5c')](',');var _0x38e560={};_0x38e560[_0x2bd11e[0x0]]={'$gte':moment(_0x2bd11e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x257fc0[_0x2ee7('0x3b')]=_[_0x2ee7('0x3f')](_0x257fc0[_0x2ee7('0x3b')],_0x38e560);}_0x257fc0=_[_0x2ee7('0x3f')]({},_0x257fc0,_0x13e50b['options']);return _0x1e0936[_0x2ee7('0x59')](_0x257fc0);}})[_0x2ee7('0x40')](function(_0x54f7a3){if(_0x54f7a3){_0x309631=_0x54f7a3[_0x2ee7('0x5a')];if(!_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x37')]('nolimit')){_0x257fc0['limit']=qs[_0x2ee7('0x21')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x21')]);_0x257fc0[_0x2ee7('0x23')]=qs[_0x2ee7('0x23')](_0x13e50b[_0x2ee7('0x32')][_0x2ee7('0x23')]);}return _0x1e0936['getMessages'](_0x257fc0);}})[_0x2ee7('0x40')](function(_0x5b8f70){if(_0x5b8f70){return _0x5b8f70?{'count':_0x309631,'rows':_0x5b8f70}:null;}})[_0x2ee7('0x40')](respondWithResult(_0x292a4c,null))[_0x2ee7('0x42')](handleError(_0x292a4c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6741bbb..a5c1178 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 _0xeab3=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xeab3,0x143));var _0x3eab=function(_0x1644e5,_0x31ac5f){_0x1644e5=_0x1644e5-0x0;var _0x5bc914=_0xeab3[_0x1644e5];return _0x5bc914;};'use strict';var EventEmitter=require(_0x3eab('0x0'));var ChatGroup=require(_0x3eab('0x1'))['db'][_0x3eab('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3eab('0x3')](0x0);var events={'afterCreate':_0x3eab('0x4'),'afterUpdate':_0x3eab('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d3c53){return function(_0x417520,_0x44addd,_0x13ba56){ChatGroupEvents['emit'](_0x4d3c53+':'+_0x417520['id'],_0x417520);ChatGroupEvents['emit'](_0x4d3c53,_0x417520);_0x13ba56(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x3eab('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x83d4=['hasOwnProperty','hook','exports','events','setMaxListeners','update','emit'];(function(_0x20115d,_0x1a193f){var _0x49958b=function(_0x14b604){while(--_0x14b604){_0x20115d['push'](_0x20115d['shift']());}};_0x49958b(++_0x1a193f);}(_0x83d4,0xf1));var _0x483d=function(_0x4f92eb,_0x1237a4){_0x4f92eb=_0x4f92eb-0x0;var _0x2e7f4f=_0x83d4[_0x4f92eb];return _0x2e7f4f;};'use strict';var EventEmitter=require(_0x483d('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x483d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x483d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x838b4c){return function(_0x447f73,_0x224829,_0x1e1c37){ChatGroupEvents[_0x483d('0x3')](_0x838b4c+':'+_0x447f73['id'],_0x447f73);ChatGroupEvents['emit'](_0x838b4c,_0x447f73);_0x1e1c37(null);};}for(var e in events){if(events[_0x483d('0x4')](e)){var event=events[e];ChatGroup[_0x483d('0x5')](e,emitEvent(event));}}module[_0x483d('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7d299ed..c19b10c 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 _0xe057=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup'];(function(_0x4074ff,_0x16e982){var _0x525d72=function(_0x41d69f){while(--_0x41d69f){_0x4074ff['push'](_0x4074ff['shift']());}};_0x525d72(++_0x16e982);}(_0xe057,0xf2));var _0x7e05=function(_0x900331,_0x17212b){_0x900331=_0x900331-0x0;var _0x557c3b=_0xe057[_0x900331];return _0x557c3b;};'use strict';var _=require(_0x7e05('0x0'));var util=require('util');var logger=require(_0x7e05('0x1'))(_0x7e05('0x2'));var moment=require(_0x7e05('0x3'));var BPromise=require(_0x7e05('0x4'));var rp=require(_0x7e05('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e05('0x6'));var config=require(_0x7e05('0x7'));var attributes=require(_0x7e05('0x8'));module[_0x7e05('0x9')]=function(_0x4c138a,_0x5e167d){return _0x4c138a['define'](_0x7e05('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7918=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup'];(function(_0x5bee28,_0x1dc7e2){var _0x395d1d=function(_0x33af90){while(--_0x33af90){_0x5bee28['push'](_0x5bee28['shift']());}};_0x395d1d(++_0x1dc7e2);}(_0x7918,0x11e));var _0x8791=function(_0x10bc04,_0x669fa5){_0x10bc04=_0x10bc04-0x0;var _0x1fd6de=_0x7918[_0x10bc04];return _0x1fd6de;};'use strict';var _=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var logger=require('../../config/logger')(_0x8791('0x2'));var moment=require(_0x8791('0x3'));var BPromise=require(_0x8791('0x4'));var rp=require(_0x8791('0x5'));var fs=require('fs');var path=require(_0x8791('0x6'));var rimraf=require(_0x8791('0x7'));var config=require('../../config/environment');var attributes=require(_0x8791('0x8'));module['exports']=function(_0x354f76,_0x81d64){return _0x354f76[_0x8791('0x9')](_0x8791('0xa'),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 53cf9c3..3c206ef 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 _0x8ebc=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','ioredis'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x8ebc,0x18c));var _0xc8eb=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x8ebc[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0xc8eb('0x0'));var util=require('util');var moment=require(_0xc8eb('0x1'));var BPromise=require(_0xc8eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8eb('0x3'));var db=require(_0xc8eb('0x4'))['db'];var utils=require(_0xc8eb('0x5'));var logger=require(_0xc8eb('0x6'))('rpc');var config=require(_0xc8eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc8eb('0x8')][_0xc8eb('0x9')]({'port':0x232a});config['redis']=_[_0xc8eb('0xa')](config[_0xc8eb('0xb')],{'host':_0xc8eb('0xc'),'port':0x18eb});var socket=require(_0xc8eb('0xd'))(new Redis(config[_0xc8eb('0xb')]));require('./chatGroup.socket')[_0xc8eb('0xe')](socket);function respondWithRpcPromise(_0xcceb64,_0x29564c,_0x108ad1){return new BPromise(function(_0xd91865,_0x54348e){return client[_0xc8eb('0xf')](_0xcceb64,_0x108ad1)['then'](function(_0x32aec8){logger['info'](_0xc8eb('0x10'),_0x29564c,_0xc8eb('0x11'));logger[_0xc8eb('0x12')](_0xc8eb('0x13'),_0x29564c,_0xc8eb('0x11'),JSON[_0xc8eb('0x14')](_0x32aec8));if(_0x32aec8[_0xc8eb('0x15')]){if(_0x32aec8[_0xc8eb('0x15')]['code']===0x1f4){logger['error'](_0xc8eb('0x10'),_0x29564c,_0x32aec8[_0xc8eb('0x15')][_0xc8eb('0x16')]);return _0x54348e(_0x32aec8[_0xc8eb('0x15')][_0xc8eb('0x16')]);}logger['error'](_0xc8eb('0x10'),_0x29564c,_0x32aec8[_0xc8eb('0x15')][_0xc8eb('0x16')]);return _0xd91865(_0x32aec8['error']['message']);}else{logger[_0xc8eb('0x17')](_0xc8eb('0x10'),_0x29564c,_0xc8eb('0x11'));_0xd91865(_0x32aec8[_0xc8eb('0x18')]['message']);}})['catch'](function(_0x4c001a){logger['error'](_0xc8eb('0x10'),_0x29564c,_0x4c001a);_0x54348e(_0x4c001a);});});} \ No newline at end of file +var _0x1134=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x3bba57,_0x440aad){var _0x1f13b7=function(_0x8ec7f6){while(--_0x8ec7f6){_0x3bba57['push'](_0x3bba57['shift']());}};_0x1f13b7(++_0x440aad);}(_0x1134,0x19c));var _0x4113=function(_0x342386,_0x369070){_0x342386=_0x342386-0x0;var _0x29616c=_0x1134[_0x342386];return _0x29616c;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var moment=require('moment');var BPromise=require(_0x4113('0x2'));var rs=require(_0x4113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4113('0x4'))['db'];var utils=require(_0x4113('0x5'));var logger=require('../../config/logger')(_0x4113('0x6'));var config=require('../../config/environment');var jayson=require(_0x4113('0x7'));var client=jayson['client'][_0x4113('0x8')]({'port':0x232a});config['redis']=_[_0x4113('0x9')](config[_0x4113('0xa')],{'host':_0x4113('0xb'),'port':0x18eb});var socket=require(_0x4113('0xc'))(new Redis(config[_0x4113('0xa')]));require(_0x4113('0xd'))[_0x4113('0xe')](socket);function respondWithRpcPromise(_0x19b6f2,_0x5e635c,_0x85a9dd){return new BPromise(function(_0x207442,_0x29c7f9){return client[_0x4113('0xf')](_0x19b6f2,_0x85a9dd)[_0x4113('0x10')](function(_0x30f02a){logger[_0x4113('0x11')](_0x4113('0x12'),_0x5e635c,_0x4113('0x13'));logger[_0x4113('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5e635c,'request\x20sent',JSON['stringify'](_0x30f02a));if(_0x30f02a[_0x4113('0x15')]){if(_0x30f02a[_0x4113('0x15')]['code']===0x1f4){logger['error'](_0x4113('0x12'),_0x5e635c,_0x30f02a['error'][_0x4113('0x16')]);return _0x29c7f9(_0x30f02a['error']['message']);}logger[_0x4113('0x15')](_0x4113('0x12'),_0x5e635c,_0x30f02a[_0x4113('0x15')][_0x4113('0x16')]);return _0x207442(_0x30f02a[_0x4113('0x15')][_0x4113('0x16')]);}else{logger[_0x4113('0x11')](_0x4113('0x12'),_0x5e635c,_0x4113('0x13'));_0x207442(_0x30f02a[_0x4113('0x17')]['message']);}})[_0x4113('0x18')](function(_0x287efd){logger[_0x4113('0x15')](_0x4113('0x12'),_0x5e635c,_0x287efd);_0x29c7f9(_0x287efd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6f51f91..487832d 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 _0x0433=['length','chatGroup:','remove','update','removeListener','register'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0x0433,0x15e));var _0x3043=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0433[_0x51020b];return _0x371e47;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x3043('0x0'),_0x3043('0x1')];function createListener(_0x3bd562,_0x3b5072){return function(_0x4d2175){_0x3b5072['emit'](_0x3bd562,_0x4d2175);};}function removeListener(_0x558c89,_0x8f816c){return function(){ChatGroupEvents[_0x3043('0x2')](_0x558c89,_0x8f816c);};}exports[_0x3043('0x3')]=function(_0x24818b){for(var _0x21baff=0x0,_0x2acbbd=events[_0x3043('0x4')];_0x21baff<_0x2acbbd;_0x21baff++){var _0x216d11=events[_0x21baff];var _0x57a698=createListener(_0x3043('0x5')+_0x216d11,_0x24818b);ChatGroupEvents['on'](_0x216d11,_0x57a698);}}; \ No newline at end of file +var _0x7581=['./chatGroup.events','remove','update','emit','removeListener','length','chatGroup:'];(function(_0x34368f,_0x27ca25){var _0x3ffc70=function(_0x5c27c5){while(--_0x5c27c5){_0x34368f['push'](_0x34368f['shift']());}};_0x3ffc70(++_0x27ca25);}(_0x7581,0x1ce));var _0x1758=function(_0x24a819,_0x33eb25){_0x24a819=_0x24a819-0x0;var _0xbd47fd=_0x7581[_0x24a819];return _0xbd47fd;};'use strict';var ChatGroupEvents=require(_0x1758('0x0'));var events=['save',_0x1758('0x1'),_0x1758('0x2')];function createListener(_0x556d20,_0x2fe42f){return function(_0x5433b9){_0x2fe42f[_0x1758('0x3')](_0x556d20,_0x5433b9);};}function removeListener(_0x3d7937,_0xb78f3f){return function(){ChatGroupEvents[_0x1758('0x4')](_0x3d7937,_0xb78f3f);};}exports['register']=function(_0x3f329d){for(var _0x4fb467=0x0,_0x1f9dd3=events[_0x1758('0x5')];_0x4fb467<_0x1f9dd3;_0x4fb467++){var _0x311198=events[_0x4fb467];var _0x672a73=createListener(_0x1758('0x6')+_0x311198,_0x3f329d);ChatGroupEvents['on'](_0x311198,_0x672a73);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5a2f3dd..40e4a0d 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 _0x96c8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','destroy','exports','multer'];(function(_0x2cc817,_0x35a8cb){var _0x5f2e1b=function(_0x1d6182){while(--_0x1d6182){_0x2cc817['push'](_0x2cc817['shift']());}};_0x5f2e1b(++_0x35a8cb);}(_0x96c8,0xa7));var _0x896c=function(_0x27cbbb,_0x3d3b3a){_0x27cbbb=_0x27cbbb-0x0;var _0xc29985=_0x96c8[_0x27cbbb];return _0xc29985;};'use strict';var multer=require(_0x896c('0x0'));var util=require('util');var path=require(_0x896c('0x1'));var timeout=require(_0x896c('0x2'));var express=require('express');var router=express[_0x896c('0x3')]();var fs_extra=require(_0x896c('0x4'));var auth=require(_0x896c('0x5'));var interaction=require(_0x896c('0x6'));var config=require('../../config/environment');var controller=require(_0x896c('0x7'));router['get']('/',auth[_0x896c('0x8')](),controller[_0x896c('0x9')]);router[_0x896c('0xa')]('/describe',auth[_0x896c('0x8')](),controller[_0x896c('0xb')]);router['get'](_0x896c('0xc'),auth['isAuthenticated'](),controller[_0x896c('0xd')]);router[_0x896c('0xa')](_0x896c('0xe'),auth[_0x896c('0x8')](),controller[_0x896c('0xf')]);router[_0x896c('0xa')](_0x896c('0x10'),auth[_0x896c('0x8')](),controller[_0x896c('0x11')]);router[_0x896c('0xa')](_0x896c('0x12'),auth[_0x896c('0x8')](),controller[_0x896c('0x13')]);router[_0x896c('0x14')]('/',auth['isAuthenticated'](),controller[_0x896c('0x15')]);router[_0x896c('0x14')](_0x896c('0x10'),auth[_0x896c('0x8')](),controller[_0x896c('0x16')]);router[_0x896c('0x14')](_0x896c('0x12'),auth[_0x896c('0x8')](),controller[_0x896c('0x17')]);router[_0x896c('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x896c('0x19')](_0x896c('0xc'),auth[_0x896c('0x8')](),controller[_0x896c('0x1a')]);router['delete'](_0x896c('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x896c('0x1b')]=router; \ No newline at end of file +var _0xe729=['isAuthenticated','/:id','show','/:id/unread','/:id/members','/:id/messages','post','create','addMembers','addMessage','put','delete','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe729,0x160));var _0x9e72=function(_0xb65eb5,_0x5601db){_0xb65eb5=_0xb65eb5-0x0;var _0x41359b=_0xe729[_0xb65eb5];return _0x41359b;};'use strict';var multer=require(_0x9e72('0x0'));var util=require(_0x9e72('0x1'));var path=require(_0x9e72('0x2'));var timeout=require(_0x9e72('0x3'));var express=require(_0x9e72('0x4'));var router=express['Router']();var fs_extra=require(_0x9e72('0x5'));var auth=require(_0x9e72('0x6'));var interaction=require(_0x9e72('0x7'));var config=require(_0x9e72('0x8'));var controller=require(_0x9e72('0x9'));router[_0x9e72('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e72('0xb')]);router[_0x9e72('0xa')]('/describe',auth[_0x9e72('0xc')](),controller['describe']);router[_0x9e72('0xa')](_0x9e72('0xd'),auth[_0x9e72('0xc')](),controller[_0x9e72('0xe')]);router[_0x9e72('0xa')](_0x9e72('0xf'),auth[_0x9e72('0xc')](),controller['getUnread']);router[_0x9e72('0xa')](_0x9e72('0x10'),auth[_0x9e72('0xc')](),controller['getMembers']);router[_0x9e72('0xa')](_0x9e72('0x11'),auth[_0x9e72('0xc')](),controller['getMessages']);router[_0x9e72('0x12')]('/',auth[_0x9e72('0xc')](),controller[_0x9e72('0x13')]);router[_0x9e72('0x12')]('/:id/members',auth[_0x9e72('0xc')](),controller[_0x9e72('0x14')]);router['post'](_0x9e72('0x11'),auth[_0x9e72('0xc')](),controller[_0x9e72('0x15')]);router[_0x9e72('0x16')]('/:id',auth[_0x9e72('0xc')](),controller['update']);router[_0x9e72('0x17')](_0x9e72('0xd'),auth[_0x9e72('0xc')](),controller['destroy']);router['delete'](_0x9e72('0x10'),auth[_0x9e72('0xc')](),controller[_0x9e72('0x18')]);module[_0x9e72('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 242c6dd..43da563 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 _0xd02a=['out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x451659,_0xbe141d){var _0x5565ef=function(_0xcd388c){while(--_0xcd388c){_0x451659['push'](_0x451659['shift']());}};_0x5565ef(++_0xbe141d);}(_0xd02a,0x123));var _0xad02=function(_0xd4a5,_0x12a607){_0xd4a5=_0xd4a5-0x0;var _0x4c99f6=_0xd02a[_0xd4a5];return _0x4c99f6;};'use strict';var Sequelize=require(_0xad02('0x0'));module[_0xad02('0x1')]={'closed':{'type':Sequelize[_0xad02('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xad02('0x3')](_0xad02('0x4'),_0xad02('0x5')),'defaultValue':_0xad02('0x4')},'ratingMessage':{'type':Sequelize[_0xad02('0x6')]},'pathTranscript':{'type':Sequelize[_0xad02('0x6')]},'mailTranscript':{'type':Sequelize[_0xad02('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xad02('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xad02('0x7')]},'thirdDisposition':{'type':Sequelize[_0xad02('0x7')]},'note':{'type':Sequelize[_0xad02('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xad02('0x7')]},'osVersion':{'type':Sequelize[_0xad02('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xad02('0x7')]},'referer':{'type':Sequelize[_0xad02('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xad02('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xad02('0x8')]},'lastMsgAt':{'type':Sequelize[_0xad02('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xad02('0x3')]('in',_0xad02('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xad02('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xad02('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xad02('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x12e5=['star','TEXT','DATE','STRING','long','out','exports','BOOLEAN','INTEGER','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x12e5,0x100));var _0x512e=function(_0x45212,_0xa6803){_0x45212=_0x45212-0x0;var _0x42437a=_0x12e5[_0x45212];return _0x42437a;};'use strict';var Sequelize=require('sequelize');module[_0x512e('0x0')]={'closed':{'type':Sequelize[_0x512e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x512e('0x2')]},'ratingType':{'type':Sequelize[_0x512e('0x3')]('star','thumb'),'defaultValue':_0x512e('0x4')},'ratingMessage':{'type':Sequelize[_0x512e('0x5')]},'pathTranscript':{'type':Sequelize[_0x512e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x512e('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x512e('0x7')]},'thirdDisposition':{'type':Sequelize[_0x512e('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x512e('0x7')]},'browserVersion':{'type':Sequelize[_0x512e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x512e('0x7')]},'deviceModel':{'type':Sequelize[_0x512e('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x512e('0x7')]},'referer':{'type':Sequelize[_0x512e('0x5')]},'customerIp':{'type':Sequelize[_0x512e('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x512e('0x8'))},'read1stAt':{'type':Sequelize[_0x512e('0x6')]},'lastMsgAt':{'type':Sequelize[_0x512e('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x512e('0x3')]('in',_0x512e('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x512e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x512e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x512e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x512e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 515bf1a..84c4d4f 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 _0xc38d=['Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','ids','omit','getMessages','hasOwnProperty','nolimit','limit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','push','Tag','color','emit','unix','toString','root','server','tmp','files','transcript-%d-%s.zip','lastName','attachments','read','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','out','firstName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','destroy','then','stack','name','send','render','merge','body','contact','agent','interaction','map','ChatInteraction','fieldName','key','getOptions','findAll','chat','query','user','params','model','rawAttributes','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','describe','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xc38d,0x76));var _0xdc38=function(_0x412279,_0x4eaa84){_0x412279=_0x412279-0x0;var _0x5a0443=_0xc38d[_0x412279];return _0x5a0443;};'use strict';var rimraf=require(_0xdc38('0x0'));var zipdir=require(_0xdc38('0x1'));var rp=require(_0xdc38('0x2'));var moment=require(_0xdc38('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc38('0x4'));var util=require(_0xdc38('0x5'));var path=require('path');var ejs=require(_0xdc38('0x6'));var fs=require('fs');var _=require(_0xdc38('0x7'));var Redis=require(_0xdc38('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xdc38('0x9'));var pdf=require(_0xdc38('0xa'));var logger=require('../../config/logger')(_0xdc38('0xb'));var config=require(_0xdc38('0xc'));var db=require('../../mysqldb')['db'];config[_0xdc38('0xd')]=_['defaults'](config[_0xdc38('0xd')],{'host':_0xdc38('0xe'),'port':0x18eb});var socket=require(_0xdc38('0xf'))(new Redis(config[_0xdc38('0xd')]));require(_0xdc38('0x10'))[_0xdc38('0x11')](socket);var jayson=require(_0xdc38('0x12'));var client=jayson['client'][_0xdc38('0x13')]({'port':0x232b});var client9004=jayson[_0xdc38('0x14')][_0xdc38('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x4ff884,_0x26a517,_0x874454,_0x3e6486){return new BPromise(function(_0x433e81,_0x24b341){var _0x501477=_0x3e6486||client;return _0x501477[_0xdc38('0x15')](_0x4ff884,_0x874454)['then'](function(_0x5d201e){logger[_0xdc38('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x26a517,'request\x20sent');logger['debug'](_0xdc38('0x17'),_0x26a517,_0xdc38('0x18'),JSON[_0xdc38('0x19')](_0x5d201e));if(_0x5d201e[_0xdc38('0x1a')]){if(_0x5d201e[_0xdc38('0x1a')]['code']===0x1f4){logger[_0xdc38('0x1a')](_0xdc38('0x1b'),_0x26a517,_0x5d201e[_0xdc38('0x1a')]['message']);return _0x24b341(_0x5d201e['error'][_0xdc38('0x1c')]);}logger[_0xdc38('0x1a')](_0xdc38('0x1b'),_0x26a517,_0x5d201e[_0xdc38('0x1a')][_0xdc38('0x1c')]);return _0x433e81(_0x5d201e[_0xdc38('0x1a')]['message']);}else{logger[_0xdc38('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x26a517,_0xdc38('0x18'));_0x433e81(_0x5d201e[_0xdc38('0x1d')]['message']);}})[_0xdc38('0x1e')](function(_0x32e86e){logger[_0xdc38('0x1a')](_0xdc38('0x1b'),_0x26a517,_0x32e86e);_0x24b341(_0x32e86e);});});}function respondWithStatusCode(_0xbbea48,_0x43f977){_0x43f977=_0x43f977||0xcc;return function(_0x2904ac){if(_0x2904ac){return _0xbbea48[_0xdc38('0x1f')](_0x43f977);}return _0xbbea48[_0xdc38('0x20')](_0x43f977)[_0xdc38('0x21')]();};}function respondWithResult(_0x59cdc4,_0x4240cd){_0x4240cd=_0x4240cd||0xc8;return function(_0x5de647){if(_0x5de647){return _0x59cdc4[_0xdc38('0x20')](_0x4240cd)['json'](_0x5de647);}};}function respondWithFilteredResult(_0x5416ba,_0x29938c){return function(_0x1cefb5){if(_0x1cefb5){var _0x4646f0=typeof _0x29938c[_0xdc38('0x22')]===_0xdc38('0x23')&&typeof _0x29938c['limit']===_0xdc38('0x23');var _0x3e90a7=_0x1cefb5['count'];var _0x41a920=_0x4646f0?0x0:_0x29938c[_0xdc38('0x22')];var _0x4c5a36=_0x4646f0?_0x1cefb5[_0xdc38('0x24')]:_0x29938c[_0xdc38('0x22')]+_0x29938c['limit'];var _0x340428;if(_0x4c5a36>=_0x3e90a7){_0x4c5a36=_0x3e90a7;_0x340428=0xc8;}else{_0x340428=0xce;}_0x5416ba[_0xdc38('0x20')](_0x340428);return _0x5416ba[_0xdc38('0x25')](_0xdc38('0x26'),_0x41a920+'-'+_0x4c5a36+'/'+_0x3e90a7)[_0xdc38('0x27')](_0x1cefb5);}return null;};}function saveUpdates(_0x154bd9){return function(_0x59ef49){if(_0x59ef49){return _0x59ef49[_0xdc38('0x28')](_0x154bd9)['then'](function(_0x3714e6){return _0x3714e6;});}return null;};}function removeEntity(_0x20a6cd){return function(_0x3e8610){if(_0x3e8610){return _0x3e8610[_0xdc38('0x29')]()[_0xdc38('0x2a')](function(){_0x20a6cd[_0xdc38('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ea3cf){return function(_0x149110){if(!_0x149110){_0x5ea3cf[_0xdc38('0x1f')](0x194);}return _0x149110;};}function handleError(_0x18da20,_0x166093){_0x166093=_0x166093||0x1f4;return function(_0x251f68){logger[_0xdc38('0x1a')](_0x251f68[_0xdc38('0x2b')]);if(_0x251f68[_0xdc38('0x2c')]){delete _0x251f68[_0xdc38('0x2c')];}_0x18da20[_0xdc38('0x20')](_0x166093)[_0xdc38('0x2d')](_0x251f68);};}function getMustacheRender(_0x25d9f9,_0xbf4d13){return Mustache[_0xdc38('0x2e')](_0x25d9f9,_[_0xdc38('0x2f')](_0xbf4d13[_0xdc38('0x30')],{'contact':_0xbf4d13[_0xdc38('0x31')],'message':_0xbf4d13[_0xdc38('0x1c')],'agent':_0xbf4d13[_0xdc38('0x32')],'interaction':_0xbf4d13[_0xdc38('0x33')],'account':_0xbf4d13['account']}))||'';}exports['index']=function(_0x17adae,_0x4e85a2){var _0x4886c8={};var _0x30c5c4=_[_0xdc38('0x34')](db[_0xdc38('0x35')]['rawAttributes'],function(_0x3c8307){return{'name':_0x3c8307[_0xdc38('0x36')],'type':_0x3c8307['type'][_0xdc38('0x37')]};});_0x4886c8=qs[_0xdc38('0x38')](_0x30c5c4,_0x17adae);return interaction[_0xdc38('0x39')](_0xdc38('0x3a'),_0x17adae[_0xdc38('0x3b')],_0x17adae[_0xdc38('0x3c')],_0x4886c8,_0x30c5c4)[_0xdc38('0x2a')](respondWithFilteredResult(_0x4e85a2,_0x4886c8))[_0xdc38('0x1e')](handleError(_0x4e85a2,null));};exports['show']=function(_0x5b0b38,_0x5dc65a){var _0x3f9994={'raw':![],'where':{'id':_0x5b0b38[_0xdc38('0x3d')]['id']}},_0x137436={};_0x137436[_0xdc38('0x3e')]=_['keys'](db[_0xdc38('0x35')][_0xdc38('0x3f')]);_0x137436[_0xdc38('0x3b')]=_[_0xdc38('0x40')](_0x5b0b38[_0xdc38('0x3b')]);_0x137436[_0xdc38('0x41')]=_[_0xdc38('0x42')](_0x137436[_0xdc38('0x3e')],_0x137436['query']);_0x3f9994[_0xdc38('0x43')]=_[_0xdc38('0x42')](_0x137436[_0xdc38('0x3e')],qs[_0xdc38('0x44')](_0x5b0b38[_0xdc38('0x3b')][_0xdc38('0x44')]));_0x3f9994[_0xdc38('0x43')]=_0x3f9994['attributes']['length']?_0x3f9994['attributes']:_0x137436[_0xdc38('0x3e')];if(_0x5b0b38[_0xdc38('0x3b')][_0xdc38('0x45')]){_0x3f9994[_0xdc38('0x46')]=[{'all':!![]}];}_0x3f9994=_[_0xdc38('0x2f')]({},_0x3f9994,_0x5b0b38[_0xdc38('0x47')]);return db[_0xdc38('0x35')][_0xdc38('0x48')](_0x3f9994)['then'](handleEntityNotFound(_0x5dc65a,null))[_0xdc38('0x2a')](respondWithResult(_0x5dc65a,null))['catch'](handleError(_0x5dc65a,null));};exports[_0xdc38('0x49')]=function(_0x3be6f7,_0x1fff33){return db['ChatInteraction'][_0xdc38('0x49')](_0x3be6f7[_0xdc38('0x30')],{})[_0xdc38('0x2a')](respondWithResult(_0x1fff33,0xc9))['catch'](handleError(_0x1fff33,null));};exports['update']=function(_0x548c95,_0x1dd44e){if(_0x548c95[_0xdc38('0x30')]['id']){delete _0x548c95[_0xdc38('0x30')]['id'];}return db[_0xdc38('0x35')][_0xdc38('0x48')]({'where':{'id':_0x548c95[_0xdc38('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1dd44e,null))[_0xdc38('0x2a')](saveUpdates(_0x548c95[_0xdc38('0x30')],null))[_0xdc38('0x2a')](respondWithResult(_0x1dd44e,null))[_0xdc38('0x1e')](handleError(_0x1dd44e,null));};exports[_0xdc38('0x29')]=function(_0x1c40a4,_0x5df30b){return db[_0xdc38('0x35')][_0xdc38('0x48')]({'where':{'id':_0x1c40a4[_0xdc38('0x3d')]['id']}})[_0xdc38('0x2a')](handleEntityNotFound(_0x5df30b,null))['then'](removeEntity(_0x5df30b,null))['catch'](handleError(_0x5df30b,null));};exports[_0xdc38('0x4a')]=function(_0x40c45d,_0x275c57){return db[_0xdc38('0x35')][_0xdc38('0x4a')]()['then'](respondWithResult(_0x275c57,null))[_0xdc38('0x1e')](handleError(_0x275c57,null));};exports['createVidaooSession']=function(_0x6dbbc4,_0x4f274c){var _0xb7e1a2=_0x6dbbc4[_0xdc38('0x3d')]['id'];var _0x4545bd;var _0x37c7fe;var _0xd47e33;return db[_0xdc38('0x35')][_0xdc38('0x4b')]({'where':{'id':_0xb7e1a2}})['then'](function(_0xf55b09){_0x4545bd=_0xf55b09;return db[_0xdc38('0x4c')][_0xdc38('0x4b')]({'where':{'id':_0xf55b09['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xdc38('0x4d'),_0xdc38('0x4e'),_0xdc38('0x4f'),_0xdc38('0x50')],'raw':!![]});})['then'](function(_0x1ddea8){if(_0x1ddea8&&_0x1ddea8[_0xdc38('0x51')]&&_0x1ddea8[_0xdc38('0x4d')]){_0x37c7fe=_0x1ddea8;var _0x1feb91={'interaction':{'id':_0xb7e1a2},'agent':{'id':_0x6dbbc4[_0xdc38('0x3c')]['id'],'name':_0x6dbbc4[_0xdc38('0x3c')]['name'],'fullname':_0x6dbbc4['user']['fullname'],'email':_0x6dbbc4['user'][_0xdc38('0x52')]},'contact':_0x6dbbc4[_0xdc38('0x30')][_0xdc38('0x31')],'account':_0x6dbbc4['body']['account']};var _0x2e7331={'rejectUnauthorized':![],'method':'POST','url':_0xdc38('0x53'),'headers':{'X-APIKEY':_0x1ddea8[_0xdc38('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x6dbbc4['user'][_0xdc38('0x52')]],'buttons':null,'topic':_0x37c7fe[_0xdc38('0x4e')],'note':_[_0xdc38('0x54')](_0x37c7fe[_0xdc38('0x4f')])?null:getMustacheRender(_0x37c7fe[_0xdc38('0x4f')],_0x1feb91),'metadata':null},'redirect':_0xdc38('0x55'),'json':!![]};try{if(!_[_0xdc38('0x54')](_0x37c7fe[_0xdc38('0x50')])){var _0x4ed460=getMustacheRender(_0x37c7fe[_0xdc38('0x50')],_0x1feb91);var _0x351dc2=JSON['parse'](_0x4ed460);_0x2e7331[_0xdc38('0x30')][_0xdc38('0x56')]=_0x351dc2;}}catch(_0x3cdf9c){throw new db[(_0xdc38('0x57'))][(_0xdc38('0x58'))](_0xdc38('0x59'));}return rp(_0x2e7331);}else{throw new db['Sequelize'][(_0xdc38('0x58'))](_0xdc38('0x5a'));}})['then'](function(_0x4425e9){_0xd47e33=_0x4425e9;if(_0xd47e33['id']){var _0x3fb42c={'body':_0xd47e33[_0xdc38('0x5b')],'ChatWebsiteId':_0x37c7fe['id'],'ChatInteractionId':_0x4545bd['id'],'direction':'out','UserId':_0x6dbbc4[_0xdc38('0x3c')]['id']};return db[_0xdc38('0x5c')]['create'](_0x3fb42c,{});}else{throw new db['Sequelize'][(_0xdc38('0x58'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xdc38('0x2a')](function(){return _0x4545bd[_0xdc38('0x5d')]({'vidaooSessionId':_0xd47e33['id']});})[_0xdc38('0x2a')](respondWithResult(_0x4f274c,null))[_0xdc38('0x1e')](handleError(_0x4f274c,null));};exports['customUpdate']=function(_0x1c6bac,_0x13f51f){if(_0x1c6bac['body']['id']){delete _0x1c6bac[_0xdc38('0x30')]['id'];}return db['ChatInteraction'][_0xdc38('0x48')]({'where':{'id':_0x1c6bac[_0xdc38('0x3d')]['id']},'include':[{'model':db[_0xdc38('0x5e')],'as':_0xdc38('0x5f')}]})[_0xdc38('0x2a')](handleEntityNotFound(_0x13f51f,null))[_0xdc38('0x2a')](saveUpdates(_0x1c6bac[_0xdc38('0x30')],null))[_0xdc38('0x2a')](respondWithResult(_0x13f51f,null))['catch'](handleError(_0x13f51f,null));};exports['abandon']=function(_0xc7b6e5,_0x426835){if(_0xc7b6e5[_0xdc38('0x30')]['id']){delete _0xc7b6e5[_0xdc38('0x30')]['id'];}return db[_0xdc38('0x35')][_0xdc38('0x48')]({'where':{'id':_0xc7b6e5[_0xdc38('0x3d')]['id']}})[_0xdc38('0x2a')](function(_0x6e721b){if(!_0x6e721b){logger['error'](_0xdc38('0x60'),_0xdc38('0x61'),0x194,'entity\x20not\x20found');_0x426835[_0xdc38('0x1f')](0x194);}else{if(_0x6e721b[_0xdc38('0x62')]){throw new db[(_0xdc38('0x57'))]['ValidationError'](_0xdc38('0x63'));}}return _0x6e721b;})[_0xdc38('0x2a')](function(_0x5f29c1){if(_0x5f29c1){return _0x5f29c1[_0xdc38('0x28')]({'closed':_0xc7b6e5[_0xdc38('0x30')][_0xdc38('0x64')],'disposition':_0xc7b6e5[_0xdc38('0x30')]['disposition']})['then'](function(_0x171972){return _0x171972;});}})['then'](function(){return respondWithRpcPromise(_0xdc38('0x65'),'abandon',_0xc7b6e5[_0xdc38('0x30')],client9004);})[_0xdc38('0x2a')](respondWithResult(_0x426835,null))[_0xdc38('0x1e')](handleError(_0x426835,null));};exports[_0xdc38('0x66')]=function(_0x5acc35,_0x2d0039){_0x5acc35[_0xdc38('0x30')][_0xdc38('0x2c')]=_0x5acc35[_0xdc38('0x67')][_0xdc38('0x68')];_0x5acc35[_0xdc38('0x30')][_0xdc38('0x69')]=_0x5acc35[_0xdc38('0x67')][_0xdc38('0x6a')];_0x5acc35[_0xdc38('0x30')][_0xdc38('0x6b')]=_0x5acc35[_0xdc38('0x67')][_0xdc38('0x6c')];return db['Attachment']['create'](_0x5acc35[_0xdc38('0x30')])['then'](respondWithResult(_0x2d0039,0xc9))[_0xdc38('0x1e')](handleError(_0x2d0039,null));};exports[_0xdc38('0x6d')]=function(_0x4cbdb5,_0x562665){return db['ChatInteraction'][_0xdc38('0x4b')]({'where':{'id':_0x4cbdb5['params']['id']},'raw':!![]})[_0xdc38('0x2a')](handleEntityNotFound(_0x562665,null))['then'](function(_0x22f3b2){if(_0x22f3b2){if(_0x22f3b2[_0xdc38('0x64')]){return _0x562665[_0xdc38('0x20')](0x193)[_0xdc38('0x27')]({'status':0x193,'message':_0xdc38('0x6e')});}return db[_0xdc38('0x6f')]['findOne']({'where':{'id':_0x4cbdb5[_0xdc38('0x3b')][_0xdc38('0x70')]},'raw':!![]})[_0xdc38('0x2a')](handleEntityNotFound(_0x562665,null));}})[_0xdc38('0x2a')](function(_0x5a1023){if(_0x5a1023){var _0x52519a=_0x5a1023[_0xdc38('0x71')]!==null;var _0x3a7c0a=path[_0xdc38('0x72')](config['root'],_0xdc38('0x73'));if(_0x52519a){_0x3a7c0a=path[_0xdc38('0x72')](_0x3a7c0a,_0xdc38('0x74'));}var _0x2a8e01=path[_0xdc38('0x72')](_0x3a7c0a,_0x5a1023[_0xdc38('0x69')]);return _0x562665[_0xdc38('0x75')](_0x2a8e01);}})[_0xdc38('0x1e')](handleError(_0x562665,null));};exports['close']=function(_0x4a9f25,_0x26bbaf){var _0x127677=null;var _0x3d8ea7=null;var _0x51f96b=null;if(_0x4a9f25[_0xdc38('0x30')]['id']){delete _0x4a9f25[_0xdc38('0x30')]['id'];}if(_0x4a9f25['body'][_0xdc38('0x76')]){_0x51f96b=path[_0xdc38('0x72')](config['root'],_0xdc38('0x77'),util[_0xdc38('0x78')](_0xdc38('0x79'),Date[_0xdc38('0x7a')]()));_0x4a9f25[_0xdc38('0x30')][_0xdc38('0x7b')]=_0x51f96b;}return db[_0xdc38('0x35')][_0xdc38('0x48')]({'where':{'id':_0x4a9f25[_0xdc38('0x3d')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xdc38('0x7c'),'include':[{'model':db[_0xdc38('0x7d')],'as':'User'}]}]})[_0xdc38('0x2a')](handleEntityNotFound(_0x26bbaf,null))[_0xdc38('0x2a')](saveUpdates(_0x4a9f25[_0xdc38('0x30')],null))[_0xdc38('0x2a')](function(_0x289966){if(_0x289966){_0x127677=_0x289966;return db[_0xdc38('0x4c')][_0xdc38('0x48')]({'where':{'id':_0x127677['ChatWebsiteId']}});}})[_0xdc38('0x2a')](function(_0x1b43bb){if(_0x1b43bb){_0x3d8ea7=_0x1b43bb;return db[_0xdc38('0x5e')]['find']({'where':{'id':_0x127677[_0xdc38('0x7e')]}});}})['then'](function(_0x30ccc8){if(_0x30ccc8){if(_0x51f96b){var _0x4a90ea=null;for(var _0xa5f772=0x1;_0xa5f772<_0x127677[_0xdc38('0x7c')][_0xdc38('0x7f')];++_0xa5f772){_0x4a90ea=_0x127677[_0xdc38('0x7c')][_0xa5f772];var _0x3f5e73=_0x4a90ea[_0xdc38('0x62')]?util['format'](_0xdc38('0x80'),_0x3d8ea7[_0xdc38('0x81')],_0x4a90ea[_0xdc38('0x62')]):_0xdc38('0x82');var _0x520d04=_0x4a9f25[_0xdc38('0x30')][_0xdc38('0x83')]||util[_0xdc38('0x78')](_0xdc38('0x80'),_0xdc38('0x84'),_0x4a90ea['ContactId']);switch(_0x3d8ea7[_0xdc38('0x85')]){case _0xdc38('0x86'):_0x3f5e73=_0x4a90ea[_0xdc38('0x62')]?util[_0xdc38('0x78')](_0xdc38('0x80'),_0x3d8ea7[_0xdc38('0x81')],_0x4a90ea['UserId']):_0xdc38('0x82');break;case _0xdc38('0x87'):_0x3f5e73=_0x4a90ea[_0xdc38('0x62')]?_0x4a90ea['User'][_0xdc38('0x88')]||_0x4a90ea[_0xdc38('0x7d')][_0xdc38('0x89')]:_0xdc38('0x82');break;case'agent_fullname':_0x3f5e73=_0x4a90ea[_0xdc38('0x62')]?_0x4a90ea[_0xdc38('0x7d')][_0xdc38('0x89')]:_0xdc38('0x82');break;default:_0x3f5e73=_0x4a90ea[_0xdc38('0x62')]?util['format']('%s%d',_0x3d8ea7[_0xdc38('0x81')],_0x4a90ea[_0xdc38('0x62')]):_0xdc38('0x82');}var _0x765978=util[_0xdc38('0x78')](_0xdc38('0x8a'),moment(_0x4a90ea[_0xdc38('0x8b')])[_0xdc38('0x78')](_0xdc38('0x8c')),_0x4a90ea[_0xdc38('0x8d')]==='in'?_0x520d04:_0x3f5e73,_0x4a90ea[_0xdc38('0x30')]);if(!_0x4a90ea[_0xdc38('0x8e')]){fs[_0xdc38('0x8f')](_0x51f96b,_0x765978);}}return db['MailAccount'][_0xdc38('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0xdc38('0x90')],'as':_0xdc38('0x91'),'raw':!![],'include':[{'model':db[_0xdc38('0x92')],'as':_0xdc38('0x92'),'raw':!![]}]}]});}}})[_0xdc38('0x2a')](function(_0x556dbf){if(!_0x556dbf||!_0x556dbf[_0xdc38('0x91')]||!_0x4a9f25[_0xdc38('0x30')])return _0x127677;var _0x59e52e=_0x556dbf[_0xdc38('0x93')]();return respondWithRpcPromise(_0xdc38('0x94'),'sendMail',{'account':_0x59e52e,'message':{'from':util[_0xdc38('0x78')](_0xdc38('0x95'),_0x556dbf['name'],_0x556dbf[_0xdc38('0x52')]||_0x556dbf[_0xdc38('0x91')][_0xdc38('0x3c')]),'to':_0x4a9f25['body'][_0xdc38('0x76')],'subject':_0xdc38('0x96'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4a9f25['body'][_0xdc38('0x76')]),'attachments':[{'path':_0x51f96b}]}})[_0xdc38('0x2a')](function(){return _0x127677;})[_0xdc38('0x1e')](function(_0x54f98f){logger[_0xdc38('0x1a')](_0x54f98f);});})[_0xdc38('0x2a')](respondWithStatusCode(_0x26bbaf,0xc8))[_0xdc38('0x1e')](handleError(_0x26bbaf,null));};exports['addMessage']=function(_0x5c8873,_0x279192){return db['ChatMessage'][_0xdc38('0x48')]({'where':{'id':_0x5c8873[_0xdc38('0x3d')]['id']}})[_0xdc38('0x2a')](handleEntityNotFound(_0x279192,null))[_0xdc38('0x2a')](function(_0x1c1c54){if(_0x1c1c54){return _0x1c1c54['addMessage'](_0x5c8873['body'][_0xdc38('0x97')],_[_0xdc38('0x98')](_0x5c8873[_0xdc38('0x30')],[_0xdc38('0x97'),'id'])||{});}})['then'](respondWithResult(_0x279192,null))[_0xdc38('0x1e')](handleError(_0x279192,null));};exports[_0xdc38('0x99')]=function(_0x2b2685,_0x3f5c15){var _0x379b69={'raw':![],'where':{}};var _0x4fcb5f={};var _0x347ebc={'count':0x0,'rows':[]};return db[_0xdc38('0x35')][_0xdc38('0x4b')]({'where':{'id':_0x2b2685[_0xdc38('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3f5c15,null))[_0xdc38('0x2a')](function(_0x344f87){if(_0x344f87){_0x4fcb5f['model']=_[_0xdc38('0x40')](db[_0xdc38('0x5c')]['rawAttributes']);_0x4fcb5f[_0xdc38('0x3b')]=_['keys'](_0x2b2685[_0xdc38('0x3b')]);_0x4fcb5f[_0xdc38('0x41')]=_[_0xdc38('0x42')](_0x4fcb5f[_0xdc38('0x3e')],_0x4fcb5f[_0xdc38('0x3b')]);_0x379b69['attributes']=_['intersection'](_0x4fcb5f['model'],qs[_0xdc38('0x44')](_0x2b2685['query'][_0xdc38('0x44')]));_0x379b69[_0xdc38('0x43')]=_0x379b69[_0xdc38('0x43')][_0xdc38('0x7f')]?_0x379b69[_0xdc38('0x43')]:_0x4fcb5f['model'];if(!_0x2b2685[_0xdc38('0x3b')][_0xdc38('0x9a')](_0xdc38('0x9b'))){_0x379b69[_0xdc38('0x9c')]=qs[_0xdc38('0x9c')](_0x2b2685['query'][_0xdc38('0x9c')]);_0x379b69[_0xdc38('0x22')]=qs['offset'](_0x2b2685['query'][_0xdc38('0x22')]);}_0x379b69[_0xdc38('0x9d')]=qs[_0xdc38('0x9e')](_0x2b2685[_0xdc38('0x3b')][_0xdc38('0x9e')]);_0x379b69[_0xdc38('0x9f')]=qs['filters'](_[_0xdc38('0xa0')](_0x2b2685[_0xdc38('0x3b')],_0x4fcb5f[_0xdc38('0x41')]));_0x379b69[_0xdc38('0x9f')][_0xdc38('0xa1')]=_0x344f87['id'];if(_0x2b2685['query'][_0xdc38('0xa2')]){_0x379b69['where']=_['merge'](_0x379b69['where'],{'$or':_[_0xdc38('0x34')](_0x379b69[_0xdc38('0x43')],function(_0x11d089){var _0x38da3d={};_0x38da3d[_0x11d089]={'$like':'%'+_0x2b2685['query'][_0xdc38('0xa2')]+'%'};return _0x38da3d;})});}if(_0x2b2685['query'][_0xdc38('0xa3')]){var _0x4ffe29=_0x2b2685['query'][_0xdc38('0xa3')][_0xdc38('0xa4')](',');var _0x1c7f49={};_0x1c7f49[_0x4ffe29[0x0]]={'$gte':moment(_0x4ffe29[0x1])[_0xdc38('0x78')](_0xdc38('0xa5'))};_0x379b69[_0xdc38('0x9f')]=_[_0xdc38('0x2f')](_0x379b69[_0xdc38('0x9f')],_0x1c7f49);}_0x379b69=_['merge']({},_0x379b69,_0x2b2685[_0xdc38('0x47')]);return db[_0xdc38('0x5c')]['count']({'where':_0x379b69[_0xdc38('0x9f')]})[_0xdc38('0x2a')](function(_0x157865){_0x347ebc['count']=_0x157865;if(_0x2b2685[_0xdc38('0x3b')][_0xdc38('0x45')]){_0x379b69[_0xdc38('0x46')]=[{'all':!![]}];}return db[_0xdc38('0x5c')]['findAll'](_0x379b69);})['then'](function(_0x11556b){_0x347ebc[_0xdc38('0xa6')]=_0x11556b;return _0x347ebc;});}})[_0xdc38('0x2a')](respondWithFilteredResult(_0x3f5c15,_0x379b69))[_0xdc38('0x1e')](handleError(_0x3f5c15,null));};exports[_0xdc38('0xa7')]=function(_0x355b9f,_0x954cb7){var _0x15880f={'where':{}},_0x1802f1={},_0x3a8f80={'count':0x0,'rows':[]};return db[_0xdc38('0x35')]['findOne']({'where':{'id':_0x355b9f[_0xdc38('0x3d')]['id']}})[_0xdc38('0x2a')](handleEntityNotFound(_0x954cb7,null))[_0xdc38('0x2a')](function(_0x24a908){if(_0x24a908){_0x1802f1['model']=_[_0xdc38('0x40')](db['ChatMessage']['rawAttributes']);_0x1802f1['query']=_[_0xdc38('0x40')](_0x355b9f[_0xdc38('0x3b')]);_0x1802f1[_0xdc38('0x41')]=_[_0xdc38('0x42')](_0x1802f1['model'],_0x1802f1['query']);_0x15880f[_0xdc38('0x43')]=_[_0xdc38('0x42')](_0x1802f1[_0xdc38('0x3e')],qs[_0xdc38('0x44')](_0x355b9f[_0xdc38('0x3b')][_0xdc38('0x44')]));_0x15880f[_0xdc38('0x43')]=_0x15880f[_0xdc38('0x43')][_0xdc38('0x7f')]?_0x15880f[_0xdc38('0x43')]:_0x1802f1[_0xdc38('0x3e')];if(!_0x355b9f['query'][_0xdc38('0x9a')](_0xdc38('0x9b'))){_0x15880f['limit']=qs[_0xdc38('0x9c')](_0x355b9f[_0xdc38('0x3b')][_0xdc38('0x9c')]);_0x15880f[_0xdc38('0x22')]=qs['offset'](_0x355b9f[_0xdc38('0x3b')][_0xdc38('0x22')]);}_0x15880f[_0xdc38('0x9d')]=qs[_0xdc38('0x9e')](_0x355b9f[_0xdc38('0x3b')][_0xdc38('0x9e')]);_0x15880f['where']=qs['filters'](_[_0xdc38('0xa0')](_0x355b9f['query'],_0x1802f1['filters']));_0x15880f[_0xdc38('0x9f')][_0xdc38('0xa1')]=_0x24a908['id'];if(_0x355b9f['query'][_0xdc38('0xa2')]){_0x15880f[_0xdc38('0x9f')]=_[_0xdc38('0x2f')](_0x15880f[_0xdc38('0x9f')],{'$or':_[_0xdc38('0x34')](_0x15880f[_0xdc38('0x43')],function(_0x2a817a){var _0x57b586={};_0x57b586[_0x2a817a]={'$like':'%'+_0x355b9f[_0xdc38('0x3b')]['filter']+'%'};return _0x57b586;})});}_0x15880f[_0xdc38('0x9f')][_0xdc38('0x8e')]=![];if(_0x355b9f['query']['id']){_0x15880f[_0xdc38('0x9f')]['id']={'$gt':_0x355b9f[_0xdc38('0x3b')]['id']};}_0x15880f=_['merge']({},_0x15880f,_0x355b9f[_0xdc38('0x47')]);return db[_0xdc38('0x5c')][_0xdc38('0x24')]({'where':_0x15880f[_0xdc38('0x9f')]})[_0xdc38('0x2a')](function(_0x2f93ed){_0x3a8f80['count']=_0x2f93ed;_0x15880f[_0xdc38('0x46')]=[];if(_0x355b9f[_0xdc38('0x3b')][_0xdc38('0xa8')]){_0x15880f['include'][_0xdc38('0xa9')]({'model':db[_0xdc38('0x7d')],'as':'User','attributes':['id',_0xdc38('0x89'),'alias']});}if(_0x355b9f['query'][_0xdc38('0x45')]){_0x15880f['include']=[{'all':!![]}];}return db[_0xdc38('0x5c')][_0xdc38('0x39')](_0x15880f);})[_0xdc38('0x2a')](function(_0x3c2d21){_0x3a8f80[_0xdc38('0xa6')]=_0x3c2d21;return _0x3a8f80;});}})[_0xdc38('0x2a')](respondWithFilteredResult(_0x954cb7,_0x15880f))[_0xdc38('0x1e')](handleError(_0x954cb7,null));};exports['addTags']=function(_0x3ac46f,_0x1a5d87){return db['ChatInteraction'][_0xdc38('0x48')]({'where':{'id':_0x3ac46f[_0xdc38('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1a5d87,null))[_0xdc38('0x2a')](function(_0x29f146){if(_0x29f146){return _0x29f146['setTags'](_0x3ac46f[_0xdc38('0x30')]['ids'],_[_0xdc38('0x98')](_0x3ac46f[_0xdc38('0x30')],[_0xdc38('0x97'),'id'])||{})['spread'](function(){return db[_0xdc38('0xaa')][_0xdc38('0x39')]({'attributes':['id',_0xdc38('0x2c'),_0xdc38('0xab')],'where':{'id':_0x3ac46f[_0xdc38('0x30')][_0xdc38('0x97')]}});})[_0xdc38('0x2a')](function(_0xda8e30){socket[_0xdc38('0xac')]('chatInteractionTags:save',{'id':Number(_0x3ac46f[_0xdc38('0x3d')]['id']),'tags':_0xda8e30||[]});return{'id':Number(_0x3ac46f[_0xdc38('0x3d')]['id']),'tags':_0xda8e30||[]};});}})[_0xdc38('0x2a')](respondWithResult(_0x1a5d87,null))['catch'](handleError(_0x1a5d87,null));};exports['removeTags']=function(_0x18ebf3,_0x3c11ae){return db[_0xdc38('0x35')]['find']({'where':{'id':_0x18ebf3['params']['id']}})[_0xdc38('0x2a')](handleEntityNotFound(_0x3c11ae,null))[_0xdc38('0x2a')](function(_0x2e0eed){if(_0x2e0eed){return _0x2e0eed['removeTags'](_0x18ebf3[_0xdc38('0x3b')][_0xdc38('0x97')]);}})[_0xdc38('0x2a')](respondWithStatusCode(_0x3c11ae,null))[_0xdc38('0x1e')](handleError(_0x3c11ae,null));};exports[_0xdc38('0x75')]=function(_0x338a7f,_0x4ee8d2){var _0x46271b=moment()[_0xdc38('0xad')]()[_0xdc38('0xae')]();var _0x5c98c6=path[_0xdc38('0x72')](config[_0xdc38('0xaf')],_0xdc38('0xb0'),'files',_0xdc38('0xb1'));var _0x2dfccb=path[_0xdc38('0x72')](config[_0xdc38('0xaf')],_0xdc38('0xb0'),_0xdc38('0xb2'),'attachments');var _0x5631fd=path[_0xdc38('0x72')](_0x5c98c6,_0x46271b);var _0x330e44=util[_0xdc38('0x78')](_0xdc38('0xb3'),_0x338a7f[_0xdc38('0x3d')]['id'],_0x46271b);var _0x1f7d79=path[_0xdc38('0x72')](_0x5c98c6,_0x330e44);var _0x437e14=[];_0x437e14['push']({'model':db[_0xdc38('0x7d')],'as':_0xdc38('0x7d'),'attributes':['id',_0xdc38('0x89')],'raw':!![]});_0x437e14[_0xdc38('0xa9')]({'model':db[_0xdc38('0x5e')],'as':_0xdc38('0x5f'),'attributes':['id','firstName',_0xdc38('0xb4')],'raw':!![]});if(_0x338a7f[_0xdc38('0x3b')][_0xdc38('0xb5')]){_0x437e14['push']({'model':db[_0xdc38('0x6f')],'as':_0xdc38('0x6f'),'raw':!![]});}var _0x18f37b=[{'model':db[_0xdc38('0x5c')],'as':'Messages','attributes':['id',_0xdc38('0x30'),_0xdc38('0x8b'),'direction',_0xdc38('0x8e'),_0xdc38('0xb6')],'include':_0x437e14}];_0x18f37b[_0xdc38('0xa9')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xdc38('0x2c')]});_0x18f37b[_0xdc38('0xa9')]({'model':db[_0xdc38('0x7d')],'as':_0xdc38('0xb7'),'attributes':['id',_0xdc38('0x89')]});return db[_0xdc38('0x35')][_0xdc38('0x48')]({'where':{'id':_0x338a7f[_0xdc38('0x3d')]['id']},'include':_0x18f37b})[_0xdc38('0x2a')](handleEntityNotFound(_0x4ee8d2,null))['then'](function(_0x5a7e3b){if(_0x5a7e3b){var _0x13a09f=_0x5a7e3b[_0xdc38('0xb8')]({'plain':!![]});fs[_0xdc38('0xb9')](_0x5631fd);var _0x5a2c73={'channel':_0xdc38('0xba'),'account':_0x13a09f['Account'][_0xdc38('0x2c')],'agent':_0x13a09f[_0xdc38('0xb7')]?_0x13a09f[_0xdc38('0xb7')]['fullname']:_0xdc38('0xbb'),'createdAt':moment(_0x13a09f[_0xdc38('0x8b')])[_0xdc38('0x78')](_0xdc38('0xa5'))[_0xdc38('0xae')](),'closedAt':_0x13a09f['closed']?moment(_0x13a09f[_0xdc38('0xbc')])[_0xdc38('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdc38('0xae')]():'','disposition':_0x13a09f[_0xdc38('0xbd')],'chatInfo':{'browser':_0x13a09f[_0xdc38('0xbe')],'os':_0x13a09f[_0xdc38('0xbf')],'referer':_0x13a09f[_0xdc38('0xc0')],'customerIp':_0x13a09f[_0xdc38('0xc1')],'customerPort':_0x13a09f[_0xdc38('0xc2')]?_0x13a09f[_0xdc38('0xc2')]:'N.A.'},'messages':_(_0x13a09f[_0xdc38('0x7c')])[_0xdc38('0xc3')]()[_0xdc38('0xa2')]({'secret':![]})['map'](function(_0xc0c555){if(_0xc0c555[_0xdc38('0x6f')]){var _0x255e57=path[_0xdc38('0x72')](_0x2dfccb,_0xc0c555[_0xdc38('0x6f')][_0xdc38('0x69')]);if(fs['existsSync'](_0x255e57)){fs[_0xdc38('0xc4')](_0x255e57)[_0xdc38('0xc5')](fs[_0xdc38('0xc6')](path[_0xdc38('0x72')](_0x5631fd,_0xc0c555[_0xdc38('0x6f')][_0xdc38('0x69')])));}}return{'date':moment(_0xc0c555[_0xdc38('0x8b')])[_0xdc38('0x78')](_0xdc38('0xa5'))[_0xdc38('0xae')](),'sender':_0xc0c555[_0xdc38('0x8d')]===_0xdc38('0xc7')?_0xc0c555[_0xdc38('0x7d')]?_0xc0c555['User'][_0xdc38('0x89')]:'System':_0xc0c555[_0xdc38('0x5f')][_0xdc38('0xc8')]+(_0xc0c555[_0xdc38('0x5f')][_0xdc38('0xb4')]?'\x20'+_0xc0c555[_0xdc38('0x5f')][_0xdc38('0xb4')]:''),'body':_0xc0c555[_0xdc38('0x6f')]?_0xc0c555[_0xdc38('0x6f')][_0xdc38('0x69')]:_0xc0c555[_0xdc38('0x30')],'direction':_0xc0c555[_0xdc38('0x8d')]===_0xdc38('0xc7')?'A':'C','secret':_0xc0c555[_0xdc38('0x8e')],'read':_0xc0c555['read'],'attachment':_0xc0c555[_0xdc38('0x6f')]};})['value']()};return ejs['renderFile'](path['join'](config[_0xdc38('0xaf')],_0xdc38('0xb0'),_0xdc38('0xc9'),_0xdc38('0xca')),{'interaction':_0x5a2c73})[_0xdc38('0x2a')](function(_0x14f966){var _0x426a78=path['join'](_0x5631fd,_0xdc38('0xcb')+_0x13a09f['id']+'-'+_0x46271b+_0xdc38('0xcc'));var _0x4eb343={'path':_0x426a78,'channel':_0xdc38('0xba'),'interactionId':_0x13a09f['id']};return pdf[_0xdc38('0xcd')](_0x14f966,_0x4eb343);})[_0xdc38('0x2a')](function(){return new Promise(function(_0x1ad245,_0x3befce){zipdir(_0x5631fd,{'saveTo':_0x1f7d79},function(_0x151113,_0x130f4a){if(_0x151113)return _0x3befce(_0x151113);return _0x1ad245(_0x130f4a);});})[_0xdc38('0x2a')](function(){return new BPromise(function(_0x330601,_0x407ac3){rimraf(_0x5631fd,function(_0x20156d){if(_0x20156d)_0x407ac3(_0x20156d);return _0x330601();});});})[_0xdc38('0x2a')](function(){return _0x4ee8d2[_0xdc38('0x75')](_0x1f7d79,_0x330e44,function(_0x25f5f3){if(_0x25f5f3){logger['error'](_0xdc38('0xce'),_0x25f5f3);}else{fs[_0xdc38('0xcf')](_0x1f7d79);}});});});}else{return _0x4ee8d2[_0xdc38('0x1f')](0xc8);}})[_0xdc38('0x1e')](handleError(_0x4ee8d2,null));}; \ No newline at end of file +var _0x2e9b=['query','model','keys','filters','intersection','fields','attributes','length','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','User','UserId','format','%s%d','agentAlias','Visitor','ContactId','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','hasOwnProperty','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','nolimit','include','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','firstName','lastName','secret','read','Account','get','mkdirSync','Chat','Owner','N.A.','disposition','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','index','map','ChatInteraction','rawAttributes','type','getOptions','findAll','chat'];(function(_0x36765e,_0x14ed23){var _0x5e33b8=function(_0x3a84d3){while(--_0x3a84d3){_0x36765e['push'](_0x36765e['shift']());}};_0x5e33b8(++_0x14ed23);}(_0x2e9b,0x167));var _0xb2e9=function(_0x37a7e9,_0x4bb5aa){_0x37a7e9=_0x37a7e9-0x0;var _0x50e838=_0x2e9b[_0x37a7e9];return _0x50e838;};'use strict';var rimraf=require(_0xb2e9('0x0'));var zipdir=require(_0xb2e9('0x1'));var rp=require('request-promise');var moment=require(_0xb2e9('0x2'));var BPromise=require(_0xb2e9('0x3'));var Mustache=require(_0xb2e9('0x4'));var util=require(_0xb2e9('0x5'));var path=require(_0xb2e9('0x6'));var ejs=require(_0xb2e9('0x7'));var fs=require('fs');var _=require(_0xb2e9('0x8'));var Redis=require(_0xb2e9('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0xb2e9('0xa'));var pdf=require(_0xb2e9('0xb'));var logger=require(_0xb2e9('0xc'))('api');var config=require(_0xb2e9('0xd'));var db=require(_0xb2e9('0xe'))['db'];config[_0xb2e9('0xf')]=_[_0xb2e9('0x10')](config[_0xb2e9('0xf')],{'host':_0xb2e9('0x11'),'port':0x18eb});var socket=require(_0xb2e9('0x12'))(new Redis(config[_0xb2e9('0xf')]));require(_0xb2e9('0x13'))[_0xb2e9('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb2e9('0x15')]({'port':0x232b});var client9004=jayson[_0xb2e9('0x16')][_0xb2e9('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x97e466,_0xce9ee3,_0x1fc6ef,_0x5801ca){return new BPromise(function(_0x472c35,_0x3ee37a){var _0x235ba9=_0x5801ca||client;return _0x235ba9[_0xb2e9('0x17')](_0x97e466,_0x1fc6ef)[_0xb2e9('0x18')](function(_0x25c06f){logger[_0xb2e9('0x19')](_0xb2e9('0x1a'),_0xce9ee3,'request\x20sent');logger[_0xb2e9('0x1b')](_0xb2e9('0x1c'),_0xce9ee3,_0xb2e9('0x1d'),JSON[_0xb2e9('0x1e')](_0x25c06f));if(_0x25c06f[_0xb2e9('0x1f')]){if(_0x25c06f['error'][_0xb2e9('0x20')]===0x1f4){logger[_0xb2e9('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0xce9ee3,_0x25c06f['error'][_0xb2e9('0x21')]);return _0x3ee37a(_0x25c06f[_0xb2e9('0x1f')]['message']);}logger[_0xb2e9('0x1f')](_0xb2e9('0x1a'),_0xce9ee3,_0x25c06f[_0xb2e9('0x1f')][_0xb2e9('0x21')]);return _0x472c35(_0x25c06f[_0xb2e9('0x1f')][_0xb2e9('0x21')]);}else{logger['info'](_0xb2e9('0x1a'),_0xce9ee3,_0xb2e9('0x1d'));_0x472c35(_0x25c06f[_0xb2e9('0x22')][_0xb2e9('0x21')]);}})[_0xb2e9('0x23')](function(_0x33dd15){logger['error'](_0xb2e9('0x1a'),_0xce9ee3,_0x33dd15);_0x3ee37a(_0x33dd15);});});}function respondWithStatusCode(_0x4c165b,_0x2e5980){_0x2e5980=_0x2e5980||0xcc;return function(_0x2290d9){if(_0x2290d9){return _0x4c165b[_0xb2e9('0x24')](_0x2e5980);}return _0x4c165b[_0xb2e9('0x25')](_0x2e5980)['end']();};}function respondWithResult(_0x4b683d,_0x5e3db7){_0x5e3db7=_0x5e3db7||0xc8;return function(_0x546717){if(_0x546717){return _0x4b683d['status'](_0x5e3db7)[_0xb2e9('0x26')](_0x546717);}};}function respondWithFilteredResult(_0x3268e9,_0x3056bd){return function(_0x43b51c){if(_0x43b51c){var _0x59d56e=typeof _0x3056bd[_0xb2e9('0x27')]===_0xb2e9('0x28')&&typeof _0x3056bd[_0xb2e9('0x29')]===_0xb2e9('0x28');var _0x588b30=_0x43b51c[_0xb2e9('0x2a')];var _0x36c836=_0x59d56e?0x0:_0x3056bd['offset'];var _0x2c11f3=_0x59d56e?_0x43b51c['count']:_0x3056bd['offset']+_0x3056bd[_0xb2e9('0x29')];var _0x38e55e;if(_0x2c11f3>=_0x588b30){_0x2c11f3=_0x588b30;_0x38e55e=0xc8;}else{_0x38e55e=0xce;}_0x3268e9['status'](_0x38e55e);return _0x3268e9[_0xb2e9('0x2b')](_0xb2e9('0x2c'),_0x36c836+'-'+_0x2c11f3+'/'+_0x588b30)[_0xb2e9('0x26')](_0x43b51c);}return null;};}function saveUpdates(_0x2b1813){return function(_0x3b8562){if(_0x3b8562){return _0x3b8562[_0xb2e9('0x2d')](_0x2b1813)[_0xb2e9('0x18')](function(_0x1a3421){return _0x1a3421;});}return null;};}function removeEntity(_0x1c5b55){return function(_0x5677b2){if(_0x5677b2){return _0x5677b2[_0xb2e9('0x2e')]()['then'](function(){_0x1c5b55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0fb4){return function(_0x362d4f){if(!_0x362d4f){_0x5f0fb4['sendStatus'](0x194);}return _0x362d4f;};}function handleError(_0x1a7dea,_0x59ca76){_0x59ca76=_0x59ca76||0x1f4;return function(_0x3e8f3f){logger[_0xb2e9('0x1f')](_0x3e8f3f[_0xb2e9('0x2f')]);if(_0x3e8f3f[_0xb2e9('0x30')]){delete _0x3e8f3f[_0xb2e9('0x30')];}_0x1a7dea[_0xb2e9('0x25')](_0x59ca76)[_0xb2e9('0x31')](_0x3e8f3f);};}function getMustacheRender(_0x585a53,_0xf3c192){return Mustache[_0xb2e9('0x32')](_0x585a53,_[_0xb2e9('0x33')](_0xf3c192[_0xb2e9('0x34')],{'contact':_0xf3c192[_0xb2e9('0x35')],'message':_0xf3c192[_0xb2e9('0x21')],'agent':_0xf3c192[_0xb2e9('0x36')],'interaction':_0xf3c192['interaction'],'account':_0xf3c192['account']}))||'';}exports[_0xb2e9('0x37')]=function(_0x9faa4d,_0x6b25f7){var _0x400c47={};var _0x4ac7f3=_[_0xb2e9('0x38')](db[_0xb2e9('0x39')][_0xb2e9('0x3a')],function(_0x5b4e0f){return{'name':_0x5b4e0f['fieldName'],'type':_0x5b4e0f[_0xb2e9('0x3b')]['key']};});_0x400c47=qs[_0xb2e9('0x3c')](_0x4ac7f3,_0x9faa4d);return interaction[_0xb2e9('0x3d')](_0xb2e9('0x3e'),_0x9faa4d[_0xb2e9('0x3f')],_0x9faa4d['user'],_0x400c47,_0x4ac7f3)['then'](respondWithFilteredResult(_0x6b25f7,_0x400c47))['catch'](handleError(_0x6b25f7,null));};exports['show']=function(_0xb6a505,_0x8b7807){var _0x2a8dbc={'raw':![],'where':{'id':_0xb6a505['params']['id']}},_0x4f5164={};_0x4f5164[_0xb2e9('0x40')]=_[_0xb2e9('0x41')](db[_0xb2e9('0x39')][_0xb2e9('0x3a')]);_0x4f5164[_0xb2e9('0x3f')]=_['keys'](_0xb6a505[_0xb2e9('0x3f')]);_0x4f5164[_0xb2e9('0x42')]=_['intersection'](_0x4f5164[_0xb2e9('0x40')],_0x4f5164[_0xb2e9('0x3f')]);_0x2a8dbc['attributes']=_[_0xb2e9('0x43')](_0x4f5164[_0xb2e9('0x40')],qs[_0xb2e9('0x44')](_0xb6a505[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x2a8dbc[_0xb2e9('0x45')]=_0x2a8dbc[_0xb2e9('0x45')][_0xb2e9('0x46')]?_0x2a8dbc['attributes']:_0x4f5164[_0xb2e9('0x40')];if(_0xb6a505[_0xb2e9('0x3f')]['includeAll']){_0x2a8dbc['include']=[{'all':!![]}];}_0x2a8dbc=_[_0xb2e9('0x33')]({},_0x2a8dbc,_0xb6a505['options']);return db[_0xb2e9('0x39')][_0xb2e9('0x47')](_0x2a8dbc)['then'](handleEntityNotFound(_0x8b7807,null))[_0xb2e9('0x18')](respondWithResult(_0x8b7807,null))['catch'](handleError(_0x8b7807,null));};exports[_0xb2e9('0x48')]=function(_0x13b005,_0x4c12b9){return db[_0xb2e9('0x39')][_0xb2e9('0x48')](_0x13b005[_0xb2e9('0x34')],{})[_0xb2e9('0x18')](respondWithResult(_0x4c12b9,0xc9))[_0xb2e9('0x23')](handleError(_0x4c12b9,null));};exports[_0xb2e9('0x2d')]=function(_0x4f2f66,_0x2ea643){if(_0x4f2f66[_0xb2e9('0x34')]['id']){delete _0x4f2f66[_0xb2e9('0x34')]['id'];}return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x4f2f66['params']['id']}})['then'](handleEntityNotFound(_0x2ea643,null))[_0xb2e9('0x18')](saveUpdates(_0x4f2f66['body'],null))[_0xb2e9('0x18')](respondWithResult(_0x2ea643,null))[_0xb2e9('0x23')](handleError(_0x2ea643,null));};exports[_0xb2e9('0x2e')]=function(_0x567068,_0x1de1b4){return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x567068[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x1de1b4,null))[_0xb2e9('0x18')](removeEntity(_0x1de1b4,null))['catch'](handleError(_0x1de1b4,null));};exports[_0xb2e9('0x4a')]=function(_0x55617b,_0x11ec59){return db[_0xb2e9('0x39')]['describe']()[_0xb2e9('0x18')](respondWithResult(_0x11ec59,null))[_0xb2e9('0x23')](handleError(_0x11ec59,null));};exports[_0xb2e9('0x4b')]=function(_0x34a111,_0x39e289){var _0x3244e5=_0x34a111['params']['id'];var _0xfd36ae;var _0x7b0d00;var _0x459cc6;return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x3244e5}})[_0xb2e9('0x18')](function(_0xfbcb2b){_0xfd36ae=_0xfbcb2b;return db[_0xb2e9('0x4d')][_0xb2e9('0x4c')]({'where':{'id':_0xfbcb2b['ChatWebsiteId']},'attributes':['id',_0xb2e9('0x4e'),_0xb2e9('0x4f'),_0xb2e9('0x50'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xb2e9('0x18')](function(_0x3accb8){if(_0x3accb8&&_0x3accb8['vidaooApiKey']&&_0x3accb8[_0xb2e9('0x4f')]){_0x7b0d00=_0x3accb8;var _0x5b3b7d={'interaction':{'id':_0x3244e5},'agent':{'id':_0x34a111['user']['id'],'name':_0x34a111[_0xb2e9('0x51')][_0xb2e9('0x30')],'fullname':_0x34a111['user'][_0xb2e9('0x52')],'email':_0x34a111[_0xb2e9('0x51')][_0xb2e9('0x53')]},'contact':_0x34a111[_0xb2e9('0x34')][_0xb2e9('0x35')],'account':_0x34a111[_0xb2e9('0x34')][_0xb2e9('0x54')]};var _0x35dbcb={'rejectUnauthorized':![],'method':_0xb2e9('0x55'),'url':_0xb2e9('0x56'),'headers':{'X-APIKEY':_0x3accb8[_0xb2e9('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34a111[_0xb2e9('0x51')]['email']],'buttons':null,'topic':_0x7b0d00[_0xb2e9('0x50')],'note':_[_0xb2e9('0x57')](_0x7b0d00[_0xb2e9('0x58')])?null:getMustacheRender(_0x7b0d00[_0xb2e9('0x58')],_0x5b3b7d),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb2e9('0x57')](_0x7b0d00[_0xb2e9('0x59')])){var _0xaa2a2e=getMustacheRender(_0x7b0d00['vidaooMetadata'],_0x5b3b7d);var _0x199d4a=JSON[_0xb2e9('0x5a')](_0xaa2a2e);_0x35dbcb[_0xb2e9('0x34')][_0xb2e9('0x5b')]=_0x199d4a;}}catch(_0x642bf4){throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35dbcb);}else{throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))](_0xb2e9('0x5e'));}})[_0xb2e9('0x18')](function(_0x558ad0){_0x459cc6=_0x558ad0;if(_0x459cc6['id']){var _0x326f89={'body':_0x459cc6[_0xb2e9('0x5f')],'ChatWebsiteId':_0x7b0d00['id'],'ChatInteractionId':_0xfd36ae['id'],'direction':_0xb2e9('0x60'),'UserId':_0x34a111[_0xb2e9('0x51')]['id']};return db[_0xb2e9('0x61')][_0xb2e9('0x48')](_0x326f89,{});}else{throw new db[(_0xb2e9('0x5c'))]['ValidationError'](_0xb2e9('0x62'));}})['then'](function(){return _0xfd36ae[_0xb2e9('0x63')]({'vidaooSessionId':_0x459cc6['id']});})[_0xb2e9('0x18')](respondWithResult(_0x39e289,null))[_0xb2e9('0x23')](handleError(_0x39e289,null));};exports[_0xb2e9('0x64')]=function(_0x352e92,_0xd1e6c0){if(_0x352e92[_0xb2e9('0x34')]['id']){delete _0x352e92[_0xb2e9('0x34')]['id'];}return db[_0xb2e9('0x39')][_0xb2e9('0x47')]({'where':{'id':_0x352e92['params']['id']},'include':[{'model':db[_0xb2e9('0x65')],'as':_0xb2e9('0x66')}]})[_0xb2e9('0x18')](handleEntityNotFound(_0xd1e6c0,null))[_0xb2e9('0x18')](saveUpdates(_0x352e92[_0xb2e9('0x34')],null))['then'](respondWithResult(_0xd1e6c0,null))[_0xb2e9('0x23')](handleError(_0xd1e6c0,null));};exports['abandon']=function(_0x801a87,_0x373cdc){if(_0x801a87['body']['id']){delete _0x801a87[_0xb2e9('0x34')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x801a87[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](function(_0x344939){if(!_0x344939){logger[_0xb2e9('0x1f')](_0xb2e9('0x67'),_0xb2e9('0x68'),0x194,'entity\x20not\x20found');_0x373cdc[_0xb2e9('0x24')](0x194);}else{if(_0x344939['UserId']){throw new db[(_0xb2e9('0x5c'))][(_0xb2e9('0x5d'))]('Interaction\x20already\x20assigned');}}return _0x344939;})[_0xb2e9('0x18')](function(_0x3ec097){if(_0x3ec097){return _0x3ec097[_0xb2e9('0x2d')]({'closed':_0x801a87[_0xb2e9('0x34')][_0xb2e9('0x69')],'disposition':_0x801a87[_0xb2e9('0x34')]['disposition']})[_0xb2e9('0x18')](function(_0x41420d){return _0x41420d;});}})[_0xb2e9('0x18')](function(){return respondWithRpcPromise(_0xb2e9('0x6a'),_0xb2e9('0x68'),_0x801a87[_0xb2e9('0x34')],client9004);})[_0xb2e9('0x18')](respondWithResult(_0x373cdc,null))[_0xb2e9('0x23')](handleError(_0x373cdc,null));};exports[_0xb2e9('0x6b')]=function(_0x43dc11,_0x4219c0){_0x43dc11['body'][_0xb2e9('0x30')]=_0x43dc11[_0xb2e9('0x6c')][_0xb2e9('0x6d')];_0x43dc11['body'][_0xb2e9('0x6e')]=_0x43dc11[_0xb2e9('0x6c')][_0xb2e9('0x6f')];_0x43dc11[_0xb2e9('0x34')][_0xb2e9('0x3b')]=_0x43dc11['file'][_0xb2e9('0x70')];return db['Attachment'][_0xb2e9('0x48')](_0x43dc11[_0xb2e9('0x34')])[_0xb2e9('0x18')](respondWithResult(_0x4219c0,0xc9))['catch'](handleError(_0x4219c0,null));};exports[_0xb2e9('0x71')]=function(_0x3649d0,_0x3d93c9){return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x3649d0[_0xb2e9('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d93c9,null))['then'](function(_0x2ce906){if(_0x2ce906){if(_0x2ce906[_0xb2e9('0x69')]){return _0x3d93c9[_0xb2e9('0x25')](0x193)[_0xb2e9('0x26')]({'status':0x193,'message':_0xb2e9('0x72')});}return db[_0xb2e9('0x73')][_0xb2e9('0x4c')]({'where':{'id':_0x3649d0[_0xb2e9('0x3f')][_0xb2e9('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x3d93c9,null));}})[_0xb2e9('0x18')](function(_0x4555cc){if(_0x4555cc){var _0x228f63=_0x4555cc['ChatOfflineMessageId']!==null;var _0x6c3b20=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0x77'));if(_0x228f63){_0x6c3b20=path[_0xb2e9('0x75')](_0x6c3b20,_0xb2e9('0x78'));}var _0x4fd5e1=path['join'](_0x6c3b20,_0x4555cc[_0xb2e9('0x6e')]);return _0x3d93c9[_0xb2e9('0x79')](_0x4fd5e1);}})['catch'](handleError(_0x3d93c9,null));};exports[_0xb2e9('0x7a')]=function(_0x49fac9,_0x9a3c3a){var _0x1b75a4=null;var _0x163ff7=null;var _0x294a34=null;if(_0x49fac9[_0xb2e9('0x34')]['id']){delete _0x49fac9[_0xb2e9('0x34')]['id'];}if(_0x49fac9[_0xb2e9('0x34')][_0xb2e9('0x7b')]){_0x294a34=path[_0xb2e9('0x75')](config['root'],'server/files/chat/upload/',util['format'](_0xb2e9('0x7c'),Date[_0xb2e9('0x7d')]()));_0x49fac9[_0xb2e9('0x34')][_0xb2e9('0x7e')]=_0x294a34;}return db['ChatInteraction'][_0xb2e9('0x47')]({'where':{'id':_0x49fac9['params']['id']},'include':[{'model':db[_0xb2e9('0x61')],'as':_0xb2e9('0x7f'),'include':[{'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80')}]}]})[_0xb2e9('0x18')](handleEntityNotFound(_0x9a3c3a,null))[_0xb2e9('0x18')](saveUpdates(_0x49fac9[_0xb2e9('0x34')],null))[_0xb2e9('0x18')](function(_0x3cd648){if(_0x3cd648){_0x1b75a4=_0x3cd648;return db['ChatWebsite'][_0xb2e9('0x47')]({'where':{'id':_0x1b75a4['ChatWebsiteId']}});}})[_0xb2e9('0x18')](function(_0x4ad4b6){if(_0x4ad4b6){_0x163ff7=_0x4ad4b6;return db['CmContact'][_0xb2e9('0x47')]({'where':{'id':_0x1b75a4['ContactId']}});}})[_0xb2e9('0x18')](function(_0x1bc550){if(_0x1bc550){if(_0x294a34){var _0x457cc7=null;for(var _0x463cc5=0x1;_0x463cc5<_0x1b75a4[_0xb2e9('0x7f')][_0xb2e9('0x46')];++_0x463cc5){_0x457cc7=_0x1b75a4[_0xb2e9('0x7f')][_0x463cc5];var _0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')](_0xb2e9('0x83'),_0x163ff7[_0xb2e9('0x84')],_0x457cc7['UserId']):'System';var _0x24bff2=_0x49fac9[_0xb2e9('0x34')]['customer']||util['format'](_0xb2e9('0x83'),_0xb2e9('0x85'),_0x457cc7[_0xb2e9('0x86')]);switch(_0x163ff7[_0xb2e9('0x87')]){case _0xb2e9('0x88'):_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')](_0xb2e9('0x83'),_0x163ff7[_0xb2e9('0x84')],_0x457cc7[_0xb2e9('0x81')]):_0xb2e9('0x89');break;case _0xb2e9('0x8a'):_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?_0x457cc7[_0xb2e9('0x80')][_0xb2e9('0x8b')]||_0x457cc7['User'][_0xb2e9('0x52')]:_0xb2e9('0x89');break;case'agent_fullname':_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?_0x457cc7['User'][_0xb2e9('0x52')]:_0xb2e9('0x89');break;default:_0x18ba3a=_0x457cc7[_0xb2e9('0x81')]?util[_0xb2e9('0x82')]('%s%d',_0x163ff7[_0xb2e9('0x84')],_0x457cc7['UserId']):_0xb2e9('0x89');}var _0x5e0b7f=util[_0xb2e9('0x82')](_0xb2e9('0x8c'),moment(_0x457cc7[_0xb2e9('0x8d')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x457cc7[_0xb2e9('0x8e')]==='in'?_0x24bff2:_0x18ba3a,_0x457cc7[_0xb2e9('0x34')]);if(!_0x457cc7['secret']){fs[_0xb2e9('0x8f')](_0x294a34,_0x5e0b7f);}}return db[_0xb2e9('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb2e9('0x91'),'raw':!![],'include':[{'model':db[_0xb2e9('0x92')],'as':_0xb2e9('0x92'),'raw':!![]}]}]});}}})[_0xb2e9('0x18')](function(_0x30b2b6){if(!_0x30b2b6||!_0x30b2b6[_0xb2e9('0x91')]||!_0x49fac9[_0xb2e9('0x34')])return _0x1b75a4;var _0x2151af=_0x30b2b6[_0xb2e9('0x93')]();return respondWithRpcPromise('SendMail',_0xb2e9('0x94'),{'account':_0x2151af,'message':{'from':util[_0xb2e9('0x82')](_0xb2e9('0x95'),_0x30b2b6[_0xb2e9('0x30')],_0x30b2b6[_0xb2e9('0x53')]||_0x30b2b6[_0xb2e9('0x91')]['user']),'to':_0x49fac9[_0xb2e9('0x34')]['mailTranscript'],'subject':_0xb2e9('0x96'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x49fac9['body'][_0xb2e9('0x7b')]),'attachments':[{'path':_0x294a34}]}})[_0xb2e9('0x18')](function(){return _0x1b75a4;})['catch'](function(_0xb3f0ee){logger['error'](_0xb3f0ee);});})[_0xb2e9('0x18')](respondWithStatusCode(_0x9a3c3a,0xc8))[_0xb2e9('0x23')](handleError(_0x9a3c3a,null));};exports['addMessage']=function(_0x3d455a,_0x28701c){return db[_0xb2e9('0x61')][_0xb2e9('0x47')]({'where':{'id':_0x3d455a[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x28701c,null))[_0xb2e9('0x18')](function(_0x6a34a6){if(_0x6a34a6){return _0x6a34a6[_0xb2e9('0x97')](_0x3d455a['body'][_0xb2e9('0x98')],_[_0xb2e9('0x99')](_0x3d455a[_0xb2e9('0x34')],['ids','id'])||{});}})[_0xb2e9('0x18')](respondWithResult(_0x28701c,null))[_0xb2e9('0x23')](handleError(_0x28701c,null));};exports['getMessages']=function(_0x22bf3e,_0x3b815f){var _0x2f62a3={'raw':![],'where':{}};var _0x5d2e8f={};var _0x56ac35={'count':0x0,'rows':[]};return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x22bf3e[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b815f,null))[_0xb2e9('0x18')](function(_0x38741e){if(_0x38741e){_0x5d2e8f['model']=_[_0xb2e9('0x41')](db[_0xb2e9('0x61')][_0xb2e9('0x3a')]);_0x5d2e8f[_0xb2e9('0x3f')]=_[_0xb2e9('0x41')](_0x22bf3e[_0xb2e9('0x3f')]);_0x5d2e8f[_0xb2e9('0x42')]=_[_0xb2e9('0x43')](_0x5d2e8f[_0xb2e9('0x40')],_0x5d2e8f['query']);_0x2f62a3['attributes']=_[_0xb2e9('0x43')](_0x5d2e8f['model'],qs[_0xb2e9('0x44')](_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x2f62a3[_0xb2e9('0x45')]=_0x2f62a3['attributes']['length']?_0x2f62a3[_0xb2e9('0x45')]:_0x5d2e8f[_0xb2e9('0x40')];if(!_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x9a')]('nolimit')){_0x2f62a3[_0xb2e9('0x29')]=qs[_0xb2e9('0x29')](_0x22bf3e[_0xb2e9('0x3f')]['limit']);_0x2f62a3[_0xb2e9('0x27')]=qs['offset'](_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0x27')]);}_0x2f62a3[_0xb2e9('0x9b')]=qs[_0xb2e9('0x9c')](_0x22bf3e[_0xb2e9('0x3f')]['sort']);_0x2f62a3['where']=qs[_0xb2e9('0x42')](_[_0xb2e9('0x9d')](_0x22bf3e['query'],_0x5d2e8f[_0xb2e9('0x42')]));_0x2f62a3[_0xb2e9('0x9e')][_0xb2e9('0x9f')]=_0x38741e['id'];if(_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa0')]){_0x2f62a3[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x2f62a3[_0xb2e9('0x9e')],{'$or':_['map'](_0x2f62a3[_0xb2e9('0x45')],function(_0x314bc1){var _0x11f231={};_0x11f231[_0x314bc1]={'$like':'%'+_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa0')]+'%'};return _0x11f231;})});}if(_0x22bf3e['query'][_0xb2e9('0xa1')]){var _0x575132=_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa1')][_0xb2e9('0xa2')](',');var _0x34f032={};_0x34f032[_0x575132[0x0]]={'$gte':moment(_0x575132[0x1])[_0xb2e9('0x82')](_0xb2e9('0xa3'))};_0x2f62a3[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x2f62a3[_0xb2e9('0x9e')],_0x34f032);}_0x2f62a3=_[_0xb2e9('0x33')]({},_0x2f62a3,_0x22bf3e[_0xb2e9('0xa4')]);return db[_0xb2e9('0x61')][_0xb2e9('0x2a')]({'where':_0x2f62a3[_0xb2e9('0x9e')]})[_0xb2e9('0x18')](function(_0x3767ca){_0x56ac35[_0xb2e9('0x2a')]=_0x3767ca;if(_0x22bf3e[_0xb2e9('0x3f')][_0xb2e9('0xa5')]){_0x2f62a3['include']=[{'all':!![]}];}return db[_0xb2e9('0x61')]['findAll'](_0x2f62a3);})['then'](function(_0xf74c0){_0x56ac35['rows']=_0xf74c0;return _0x56ac35;});}})[_0xb2e9('0x18')](respondWithFilteredResult(_0x3b815f,_0x2f62a3))[_0xb2e9('0x23')](handleError(_0x3b815f,null));};exports['getMyMessages']=function(_0x5ddaa6,_0x59bed0){var _0x399b5a={'where':{}},_0x11b7a1={},_0x1cd41a={'count':0x0,'rows':[]};return db[_0xb2e9('0x39')][_0xb2e9('0x4c')]({'where':{'id':_0x5ddaa6[_0xb2e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x59bed0,null))[_0xb2e9('0x18')](function(_0x259588){if(_0x259588){_0x11b7a1[_0xb2e9('0x40')]=_[_0xb2e9('0x41')](db[_0xb2e9('0x61')][_0xb2e9('0x3a')]);_0x11b7a1['query']=_[_0xb2e9('0x41')](_0x5ddaa6[_0xb2e9('0x3f')]);_0x11b7a1[_0xb2e9('0x42')]=_[_0xb2e9('0x43')](_0x11b7a1['model'],_0x11b7a1[_0xb2e9('0x3f')]);_0x399b5a[_0xb2e9('0x45')]=_[_0xb2e9('0x43')](_0x11b7a1[_0xb2e9('0x40')],qs['fields'](_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x44')]));_0x399b5a['attributes']=_0x399b5a[_0xb2e9('0x45')][_0xb2e9('0x46')]?_0x399b5a[_0xb2e9('0x45')]:_0x11b7a1['model'];if(!_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x9a')](_0xb2e9('0xa6'))){_0x399b5a[_0xb2e9('0x29')]=qs[_0xb2e9('0x29')](_0x5ddaa6['query'][_0xb2e9('0x29')]);_0x399b5a['offset']=qs[_0xb2e9('0x27')](_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0x27')]);}_0x399b5a[_0xb2e9('0x9b')]=qs[_0xb2e9('0x9c')](_0x5ddaa6['query']['sort']);_0x399b5a['where']=qs[_0xb2e9('0x42')](_['pick'](_0x5ddaa6[_0xb2e9('0x3f')],_0x11b7a1[_0xb2e9('0x42')]));_0x399b5a[_0xb2e9('0x9e')][_0xb2e9('0x9f')]=_0x259588['id'];if(_0x5ddaa6['query'][_0xb2e9('0xa0')]){_0x399b5a[_0xb2e9('0x9e')]=_[_0xb2e9('0x33')](_0x399b5a[_0xb2e9('0x9e')],{'$or':_[_0xb2e9('0x38')](_0x399b5a['attributes'],function(_0x240d39){var _0x4af753={};_0x4af753[_0x240d39]={'$like':'%'+_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa0')]+'%'};return _0x4af753;})});}_0x399b5a[_0xb2e9('0x9e')]['secret']=![];if(_0x5ddaa6[_0xb2e9('0x3f')]['id']){_0x399b5a[_0xb2e9('0x9e')]['id']={'$gt':_0x5ddaa6[_0xb2e9('0x3f')]['id']};}_0x399b5a=_['merge']({},_0x399b5a,_0x5ddaa6['options']);return db[_0xb2e9('0x61')][_0xb2e9('0x2a')]({'where':_0x399b5a[_0xb2e9('0x9e')]})['then'](function(_0x2a29bb){_0x1cd41a['count']=_0x2a29bb;_0x399b5a[_0xb2e9('0xa7')]=[];if(_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa8')]){_0x399b5a[_0xb2e9('0xa7')][_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80'),'attributes':['id','fullname',_0xb2e9('0x8b')]});}if(_0x5ddaa6[_0xb2e9('0x3f')][_0xb2e9('0xa5')]){_0x399b5a[_0xb2e9('0xa7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb2e9('0x3d')](_0x399b5a);})['then'](function(_0x2f6394){_0x1cd41a[_0xb2e9('0xaa')]=_0x2f6394;return _0x1cd41a;});}})[_0xb2e9('0x18')](respondWithFilteredResult(_0x59bed0,_0x399b5a))[_0xb2e9('0x23')](handleError(_0x59bed0,null));};exports[_0xb2e9('0xab')]=function(_0x170022,_0x22c476){return db[_0xb2e9('0x39')]['find']({'where':{'id':_0x170022['params']['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x22c476,null))[_0xb2e9('0x18')](function(_0x55923c){if(_0x55923c){return _0x55923c[_0xb2e9('0xac')](_0x170022[_0xb2e9('0x34')][_0xb2e9('0x98')],_['omit'](_0x170022[_0xb2e9('0x34')],[_0xb2e9('0x98'),'id'])||{})[_0xb2e9('0xad')](function(){return db[_0xb2e9('0xae')][_0xb2e9('0x3d')]({'attributes':['id',_0xb2e9('0x30'),_0xb2e9('0xaf')],'where':{'id':_0x170022[_0xb2e9('0x34')]['ids']}});})[_0xb2e9('0x18')](function(_0x302114){socket[_0xb2e9('0xb0')](_0xb2e9('0xb1'),{'id':Number(_0x170022[_0xb2e9('0x49')]['id']),'tags':_0x302114||[]});return{'id':Number(_0x170022['params']['id']),'tags':_0x302114||[]};});}})[_0xb2e9('0x18')](respondWithResult(_0x22c476,null))[_0xb2e9('0x23')](handleError(_0x22c476,null));};exports[_0xb2e9('0xb2')]=function(_0x552e8a,_0x950e56){return db[_0xb2e9('0x39')][_0xb2e9('0x47')]({'where':{'id':_0x552e8a[_0xb2e9('0x49')]['id']}})[_0xb2e9('0x18')](handleEntityNotFound(_0x950e56,null))['then'](function(_0xc09714){if(_0xc09714){return _0xc09714[_0xb2e9('0xb2')](_0x552e8a[_0xb2e9('0x3f')][_0xb2e9('0x98')]);}})[_0xb2e9('0x18')](respondWithStatusCode(_0x950e56,null))[_0xb2e9('0x23')](handleError(_0x950e56,null));};exports[_0xb2e9('0x79')]=function(_0x24b5dd,_0x4e4bf3){var _0x174740=moment()[_0xb2e9('0xb3')]()[_0xb2e9('0xb4')]();var _0x13178a=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xb6'),_0xb2e9('0xb7'));var _0x2bbcb9=path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xb6'),_0xb2e9('0xb8'));var _0xec07ae=path[_0xb2e9('0x75')](_0x13178a,_0x174740);var _0x4f763b=util[_0xb2e9('0x82')]('transcript-%d-%s.zip',_0x24b5dd[_0xb2e9('0x49')]['id'],_0x174740);var _0x12b98=path[_0xb2e9('0x75')](_0x13178a,_0x4f763b);var _0x114401=[];_0x114401['push']({'model':db[_0xb2e9('0x80')],'as':_0xb2e9('0x80'),'attributes':['id',_0xb2e9('0x52')],'raw':!![]});_0x114401[_0xb2e9('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xb2e9('0xb9'),_0xb2e9('0xba')],'raw':!![]});if(_0x24b5dd[_0xb2e9('0x3f')][_0xb2e9('0xb8')]){_0x114401['push']({'model':db[_0xb2e9('0x73')],'as':'Attachment','raw':!![]});}var _0x318619=[{'model':db[_0xb2e9('0x61')],'as':'Messages','attributes':['id',_0xb2e9('0x34'),_0xb2e9('0x8d'),_0xb2e9('0x8e'),_0xb2e9('0xbb'),_0xb2e9('0xbc')],'include':_0x114401}];_0x318619[_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x4d')],'as':_0xb2e9('0xbd'),'attributes':['id',_0xb2e9('0x30')]});_0x318619[_0xb2e9('0xa9')]({'model':db[_0xb2e9('0x80')],'as':'Owner','attributes':['id',_0xb2e9('0x52')]});return db[_0xb2e9('0x39')]['find']({'where':{'id':_0x24b5dd[_0xb2e9('0x49')]['id']},'include':_0x318619})[_0xb2e9('0x18')](handleEntityNotFound(_0x4e4bf3,null))[_0xb2e9('0x18')](function(_0x23455b){if(_0x23455b){var _0x283c89=_0x23455b[_0xb2e9('0xbe')]({'plain':!![]});fs[_0xb2e9('0xbf')](_0xec07ae);var _0xdc8a07={'channel':_0xb2e9('0xc0'),'account':_0x283c89[_0xb2e9('0xbd')][_0xb2e9('0x30')],'agent':_0x283c89[_0xb2e9('0xc1')]?_0x283c89[_0xb2e9('0xc1')][_0xb2e9('0x52')]:_0xb2e9('0xc2'),'createdAt':moment(_0x283c89[_0xb2e9('0x8d')])[_0xb2e9('0x82')](_0xb2e9('0xa3'))['toString'](),'closedAt':_0x283c89[_0xb2e9('0x69')]?moment(_0x283c89['closedAt'])[_0xb2e9('0x82')](_0xb2e9('0xa3'))[_0xb2e9('0xb4')]():'','disposition':_0x283c89[_0xb2e9('0xc3')],'chatInfo':{'browser':_0x283c89[_0xb2e9('0xc4')],'os':_0x283c89['osName'],'referer':_0x283c89[_0xb2e9('0xc5')],'customerIp':_0x283c89[_0xb2e9('0xc6')],'customerPort':_0x283c89['customerPort']?_0x283c89[_0xb2e9('0xc7')]:_0xb2e9('0xc2')},'messages':_(_0x283c89[_0xb2e9('0x7f')])[_0xb2e9('0xc8')]()[_0xb2e9('0xa0')]({'secret':![]})[_0xb2e9('0x38')](function(_0x750ada){if(_0x750ada['Attachment']){var _0x173c39=path[_0xb2e9('0x75')](_0x2bbcb9,_0x750ada[_0xb2e9('0x73')]['basename']);if(fs[_0xb2e9('0xc9')](_0x173c39)){fs[_0xb2e9('0xca')](_0x173c39)[_0xb2e9('0xcb')](fs['createWriteStream'](path[_0xb2e9('0x75')](_0xec07ae,_0x750ada[_0xb2e9('0x73')][_0xb2e9('0x6e')])));}}return{'date':moment(_0x750ada[_0xb2e9('0x8d')])[_0xb2e9('0x82')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb2e9('0xb4')](),'sender':_0x750ada['direction']==='out'?_0x750ada[_0xb2e9('0x80')]?_0x750ada[_0xb2e9('0x80')][_0xb2e9('0x52')]:_0xb2e9('0x89'):_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xb9')]+(_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xba')]?'\x20'+_0x750ada[_0xb2e9('0x66')][_0xb2e9('0xba')]:''),'body':_0x750ada['Attachment']?_0x750ada['Attachment'][_0xb2e9('0x6e')]:_0x750ada['body'],'direction':_0x750ada[_0xb2e9('0x8e')]===_0xb2e9('0x60')?'A':'C','secret':_0x750ada[_0xb2e9('0xbb')],'read':_0x750ada['read'],'attachment':_0x750ada['Attachment']};})['value']()};return ejs[_0xb2e9('0xcc')](path[_0xb2e9('0x75')](config[_0xb2e9('0x76')],_0xb2e9('0xb5'),_0xb2e9('0xcd'),_0xb2e9('0xce')),{'interaction':_0xdc8a07})[_0xb2e9('0x18')](function(_0x425ccc){var _0x268102=path[_0xb2e9('0x75')](_0xec07ae,_0xb2e9('0xcf')+_0x283c89['id']+'-'+_0x174740+_0xb2e9('0xd0'));var _0x954165={'path':_0x268102,'channel':_0xb2e9('0xc0'),'interactionId':_0x283c89['id']};return pdf[_0xb2e9('0xd1')](_0x425ccc,_0x954165);})[_0xb2e9('0x18')](function(){return new Promise(function(_0xfbea79,_0x2d9b98){zipdir(_0xec07ae,{'saveTo':_0x12b98},function(_0x3d7ba1,_0x358925){if(_0x3d7ba1)return _0x2d9b98(_0x3d7ba1);return _0xfbea79(_0x358925);});})[_0xb2e9('0x18')](function(){return new BPromise(function(_0x299d57,_0x454325){rimraf(_0xec07ae,function(_0x4841be){if(_0x4841be)_0x454325(_0x4841be);return _0x299d57();});});})[_0xb2e9('0x18')](function(){return _0x4e4bf3[_0xb2e9('0x79')](_0x12b98,_0x4f763b,function(_0x2e9e7c){if(_0x2e9e7c){logger[_0xb2e9('0x1f')](_0xb2e9('0xd2'),_0x2e9e7c);}else{fs['unlinkSync'](_0x12b98);}});});});}else{return _0x4e4bf3[_0xb2e9('0x24')](0xc8);}})[_0xb2e9('0x23')](handleError(_0x4e4bf3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 01d2b30..deab900 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 _0x61f6=['update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x61f6,0x10b));var _0x661f=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x61f6[_0x307bf6];return _0x2878fc;};'use strict';var EventEmitter=require(_0x661f('0x0'));var ChatInteraction=require(_0x661f('0x1'))['db'][_0x661f('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x661f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x661f('0x4'),'afterUpdate':_0x661f('0x5'),'afterDestroy':_0x661f('0x6')};function emitEvent(_0xf53fa3){return function(_0x17af9d,_0x479257,_0x4b8bf4){_0x17af9d[_0x661f('0x7')]({'attributes':['id'],'raw':!![]})[_0x661f('0x8')](function(_0x11bc95){_0x17af9d[_0x661f('0x9')]('Users',_0x11bc95[_0x661f('0xa')](function(_0x182136){return{'id':_0x182136['id']};}));return ChatMessage[_0x661f('0xb')]({'where':{'ChatInteractionId':_0x17af9d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x661f('0x8')](function(_0x1c0881){_0x17af9d[_0x661f('0x9')](_0x661f('0xc'),_0x1c0881['length']);ChatInteractionEvents[_0x661f('0xd')](_0xf53fa3+':'+_0x17af9d['id'],_0x17af9d);ChatInteractionEvents[_0x661f('0xd')](_0xf53fa3,_0x17af9d);_0x4b8bf4(null);})[_0x661f('0xe')](_0x4b8bf4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x661f('0xf')](e,emitEvent(event));}}module[_0x661f('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x8a9d=['hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a9d,0x162));var _0xd8a9=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0x8a9d[_0x4250b4];return _0x8a4807;};'use strict';var EventEmitter=require(_0xd8a9('0x0'));var ChatInteraction=require(_0xd8a9('0x1'))['db'][_0xd8a9('0x2')];var ChatMessage=require(_0xd8a9('0x1'))['db'][_0xd8a9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd8a9('0x4')](0x0);var events={'afterCreate':_0xd8a9('0x5'),'afterUpdate':'update','afterDestroy':_0xd8a9('0x6')};function emitEvent(_0x2b0e2a){return function(_0x153529,_0x3d24b7,_0x18d4eb){_0x153529['getUsers']({'attributes':['id'],'raw':!![]})[_0xd8a9('0x7')](function(_0x14351d){_0x153529[_0xd8a9('0x8')]('Users',_0x14351d['map'](function(_0x311012){return{'id':_0x311012['id']};}));return ChatMessage[_0xd8a9('0x9')]({'where':{'ChatInteractionId':_0x153529['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd8a9('0x7')](function(_0x3294dd){_0x153529[_0xd8a9('0x8')](_0xd8a9('0xa'),_0x3294dd['length']);ChatInteractionEvents[_0xd8a9('0xb')](_0x2b0e2a+':'+_0x153529['id'],_0x153529);ChatInteractionEvents[_0xd8a9('0xb')](_0x2b0e2a,_0x153529);_0x18d4eb(null);})[_0xd8a9('0xc')](_0x18d4eb(null));};}for(var e in events){if(events[_0xd8a9('0xd')](e)){var event=events[e];ChatInteraction[_0xd8a9('0xe')](e,emitEvent(event));}}module[_0xd8a9('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c41deda..4846e76 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 _0x0463=['../../config/environment','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1fe7bf,_0x24493f){var _0x340e1f=function(_0x4e13df){while(--_0x4e13df){_0x1fe7bf['push'](_0x1fe7bf['shift']());}};_0x340e1f(++_0x24493f);}(_0x0463,0x114));var _0x3046=function(_0x4ff41b,_0x434fa6){_0x4ff41b=_0x4ff41b-0x0;var _0x188ea0=_0x0463[_0x4ff41b];return _0x188ea0;};'use strict';var _=require(_0x3046('0x0'));var util=require(_0x3046('0x1'));var logger=require(_0x3046('0x2'))(_0x3046('0x3'));var moment=require(_0x3046('0x4'));var BPromise=require(_0x3046('0x5'));var rp=require(_0x3046('0x6'));var fs=require('fs');var path=require(_0x3046('0x7'));var rimraf=require(_0x3046('0x8'));var config=require(_0x3046('0x9'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0xdb6961,_0x814e58){return _0xdb6961['define'](_0x3046('0xa'),attributes,{'tableName':_0x3046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18a418,_0x123c4e,_0x27405d){if(_0x18a418[_0x3046('0xc')](_0x3046('0xd'))){_0x18a418[_0x3046('0xe')]=moment()[_0x3046('0xf')](_0x3046('0x10'));}_0x27405d(null,_0x18a418);}},'charset':_0x3046('0x11'),'collate':_0x3046('0x12')});}; \ No newline at end of file +var _0xbb38=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4'];(function(_0x22b0cb,_0x5a764a){var _0x444178=function(_0x5aed3d){while(--_0x5aed3d){_0x22b0cb['push'](_0x22b0cb['shift']());}};_0x444178(++_0x5a764a);}(_0xbb38,0x177));var _0x8bb3=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xbb38[_0x1c8c07];return _0x4aa88f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8bb3('0x0'));var BPromise=require(_0x8bb3('0x1'));var rp=require(_0x8bb3('0x2'));var fs=require('fs');var path=require(_0x8bb3('0x3'));var rimraf=require(_0x8bb3('0x4'));var config=require(_0x8bb3('0x5'));var attributes=require(_0x8bb3('0x6'));module['exports']=function(_0x3bfa50,_0x5efe7e){return _0x3bfa50[_0x8bb3('0x7')](_0x8bb3('0x8'),attributes,{'tableName':_0x8bb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50c67d,_0x2acbe3,_0x31547b){if(_0x50c67d[_0x8bb3('0xa')](_0x8bb3('0xb'))){_0x50c67d[_0x8bb3('0xc')]=moment()[_0x8bb3('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31547b(null,_0x50c67d);}},'charset':_0x8bb3('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 80fb47b..d5cc615 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 _0xa720=['../../config/environment','client','http','redis','defaults','socket.io-emitter','register','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','UpdateChatInteraction','update','body','options','raw','where','limit','catch','AddTagsToChatInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0xa720,0x122));var _0x0a72=function(_0x49d3f0,_0x1391d0){_0x49d3f0=_0x49d3f0-0x0;var _0x2539b7=_0xa720[_0x49d3f0];return _0x2539b7;};'use strict';var _=require(_0x0a72('0x0'));var util=require(_0x0a72('0x1'));var moment=require(_0x0a72('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a72('0x4'))['db'];var utils=require(_0x0a72('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a72('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0a72('0x7')][_0x0a72('0x8')]({'port':0x232a});config[_0x0a72('0x9')]=_[_0x0a72('0xa')](config[_0x0a72('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a72('0xb'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x0a72('0xc')](socket);function respondWithRpcPromise(_0x16a420,_0x447b1f,_0x1f0609){return new BPromise(function(_0x2615f2,_0x13ea23){return client['request'](_0x16a420,_0x1f0609)[_0x0a72('0xd')](function(_0x47afa5){logger[_0x0a72('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x447b1f,'request\x20sent');logger[_0x0a72('0xf')](_0x0a72('0x10'),_0x447b1f,_0x0a72('0x11'),JSON[_0x0a72('0x12')](_0x47afa5));if(_0x47afa5['error']){if(_0x47afa5[_0x0a72('0x13')][_0x0a72('0x14')]===0x1f4){logger[_0x0a72('0x13')](_0x0a72('0x15'),_0x447b1f,_0x47afa5['error']['message']);return _0x13ea23(_0x47afa5[_0x0a72('0x13')][_0x0a72('0x16')]);}logger['error'](_0x0a72('0x15'),_0x447b1f,_0x47afa5[_0x0a72('0x13')][_0x0a72('0x16')]);return _0x2615f2(_0x47afa5[_0x0a72('0x13')][_0x0a72('0x16')]);}else{logger['info'](_0x0a72('0x15'),_0x447b1f,_0x0a72('0x11'));_0x2615f2(_0x47afa5['result']['message']);}})['catch'](function(_0x4e6740){logger['error'](_0x0a72('0x15'),_0x447b1f,_0x4e6740);_0x13ea23(_0x4e6740);});});}exports[_0x0a72('0x17')]=function(_0x2930ce){var _0x53afa4=this;return new Promise(function(_0x24f9a9,_0x4a957c){return db['ChatInteraction'][_0x0a72('0x18')](_0x2930ce[_0x0a72('0x19')],{'raw':_0x2930ce['options']?_0x2930ce[_0x0a72('0x1a')][_0x0a72('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2930ce['options']?_0x2930ce['options'][_0x0a72('0x1c')]||null:null,'attributes':_0x2930ce[_0x0a72('0x1a')]?_0x2930ce['options']['attributes']||null:null,'limit':_0x2930ce['options']?_0x2930ce['options'][_0x0a72('0x1d')]||null:null})[_0x0a72('0xd')](function(_0xca99a7){logger[_0x0a72('0xe')](_0x0a72('0x17'),_0x2930ce);logger[_0x0a72('0xf')](_0x0a72('0x17'),_0x2930ce,JSON[_0x0a72('0x12')](_0xca99a7));_0x24f9a9(_0xca99a7);})[_0x0a72('0x1e')](function(_0x4e8f23){logger[_0x0a72('0x13')](_0x0a72('0x17'),_0x4e8f23[_0x0a72('0x16')],_0x2930ce);_0x4a957c(_0x53afa4['error'](0x1f4,_0x4e8f23[_0x0a72('0x16')]));});});};exports[_0x0a72('0x1f')]=function(_0x548773){return new Promise(function(_0x5ded43,_0x5627a4){return db['ChatInteraction'][_0x0a72('0x20')]({'where':_0x548773[_0x0a72('0x1a')]?_0x548773[_0x0a72('0x1a')][_0x0a72('0x1c')]||null:null})[_0x0a72('0xd')](function(_0x1f128c){if(_0x1f128c){return _0x1f128c[_0x0a72('0x21')](_0x548773[_0x0a72('0x19')]['ids'],_[_0x0a72('0x22')](_0x548773['body'],[_0x0a72('0x23'),'id'])||{});}})['spread'](function(_0x23530f){logger[_0x0a72('0xe')](_0x0a72('0x24'),_0x548773);logger[_0x0a72('0xf')](_0x0a72('0x24'),_0x548773,JSON[_0x0a72('0x12')](_0x23530f));_0x5ded43(_0x23530f);})[_0x0a72('0x1e')](function(_0x6c3d66){logger[_0x0a72('0x13')](_0x0a72('0x24'),_0x6c3d66['message'],_0x548773);_0x5627a4(_this[_0x0a72('0x13')](0x1f4,_0x6c3d66[_0x0a72('0x16')]));});});}; \ No newline at end of file +var _0x786f=['info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then'];(function(_0x2b74c8,_0x82f97f){var _0x339692=function(_0x5d07f4){while(--_0x5d07f4){_0x2b74c8['push'](_0x2b74c8['shift']());}};_0x339692(++_0x82f97f);}(_0x786f,0x9c));var _0xf786=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x786f[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0xf786('0x0'));var util=require(_0xf786('0x1'));var moment=require(_0xf786('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf786('0x3'));var db=require(_0xf786('0x4'))['db'];var utils=require(_0xf786('0x5'));var logger=require(_0xf786('0x6'))(_0xf786('0x7'));var config=require(_0xf786('0x8'));var jayson=require(_0xf786('0x9'));var client=jayson[_0xf786('0xa')][_0xf786('0xb')]({'port':0x232a});config[_0xf786('0xc')]=_[_0xf786('0xd')](config[_0xf786('0xc')],{'host':_0xf786('0xe'),'port':0x18eb});var socket=require(_0xf786('0xf'))(new Redis(config[_0xf786('0xc')]));require(_0xf786('0x10'))[_0xf786('0x11')](socket);function respondWithRpcPromise(_0x4340c2,_0xbd312,_0x48d823){return new BPromise(function(_0x444796,_0x2ec530){return client[_0xf786('0x12')](_0x4340c2,_0x48d823)[_0xf786('0x13')](function(_0x2c3b55){logger[_0xf786('0x14')](_0xf786('0x15'),_0xbd312,'request\x20sent');logger[_0xf786('0x16')](_0xf786('0x17'),_0xbd312,'request\x20sent',JSON[_0xf786('0x18')](_0x2c3b55));if(_0x2c3b55[_0xf786('0x19')]){if(_0x2c3b55[_0xf786('0x19')]['code']===0x1f4){logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x2c3b55[_0xf786('0x19')]['message']);return _0x2ec530(_0x2c3b55[_0xf786('0x19')][_0xf786('0x1a')]);}logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x2c3b55[_0xf786('0x19')]['message']);return _0x444796(_0x2c3b55[_0xf786('0x19')]['message']);}else{logger[_0xf786('0x14')](_0xf786('0x15'),_0xbd312,'request\x20sent');_0x444796(_0x2c3b55['result'][_0xf786('0x1a')]);}})['catch'](function(_0x12bd62){logger[_0xf786('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xbd312,_0x12bd62);_0x2ec530(_0x12bd62);});});}exports[_0xf786('0x1b')]=function(_0x47d546){var _0x126d59=this;return new Promise(function(_0x34bd2f,_0x1345ee){return db[_0xf786('0x1c')][_0xf786('0x1d')](_0x47d546[_0xf786('0x1e')],{'raw':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x21')]||null:null,'attributes':_0x47d546['options']?_0x47d546[_0xf786('0x1f')][_0xf786('0x22')]||null:null,'limit':_0x47d546[_0xf786('0x1f')]?_0x47d546[_0xf786('0x1f')][_0xf786('0x23')]||null:null})[_0xf786('0x13')](function(_0x3dfb89){logger[_0xf786('0x14')](_0xf786('0x1b'),_0x47d546);logger['debug'](_0xf786('0x1b'),_0x47d546,JSON[_0xf786('0x18')](_0x3dfb89));_0x34bd2f(_0x3dfb89);})[_0xf786('0x24')](function(_0x4c19b9){logger['error'](_0xf786('0x1b'),_0x4c19b9[_0xf786('0x1a')],_0x47d546);_0x1345ee(_0x126d59['error'](0x1f4,_0x4c19b9[_0xf786('0x1a')]));});});};exports[_0xf786('0x25')]=function(_0x1dae8d){return new Promise(function(_0x525e8f,_0x4d6f69){return db['ChatInteraction'][_0xf786('0x26')]({'where':_0x1dae8d['options']?_0x1dae8d[_0xf786('0x1f')][_0xf786('0x21')]||null:null})[_0xf786('0x13')](function(_0x564d11){if(_0x564d11){return _0x564d11[_0xf786('0x27')](_0x1dae8d[_0xf786('0x1e')][_0xf786('0x28')],_[_0xf786('0x29')](_0x1dae8d[_0xf786('0x1e')],['ids','id'])||{});}})[_0xf786('0x2a')](function(_0x24146c){logger['info'](_0xf786('0x2b'),_0x1dae8d);logger[_0xf786('0x16')](_0xf786('0x2b'),_0x1dae8d,JSON[_0xf786('0x18')](_0x24146c));_0x525e8f(_0x24146c);})[_0xf786('0x24')](function(_0x21eafb){logger[_0xf786('0x19')](_0xf786('0x2b'),_0x21eafb[_0xf786('0x1a')],_0x1dae8d);_0x4d6f69(_this[_0xf786('0x19')](0x1f4,_0x21eafb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 14ce563..2110e44 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 _0x6732=['./chatInteraction.events','save','remove','update','length','chatInteraction:'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x2673('0x0'));var events=[_0x2673('0x1'),_0x2673('0x2'),_0x2673('0x3')];function createListener(_0x56629a,_0x3b698e){return function(_0x36e1ba){_0x3b698e['emit'](_0x56629a,_0x36e1ba);};}function removeListener(_0xfef746,_0x3ac2c4){return function(){ChatInteractionEvents['removeListener'](_0xfef746,_0x3ac2c4);};}exports['register']=function(_0x90d6e5){for(var _0x2ec408=0x0,_0x513795=events[_0x2673('0x4')];_0x2ec408<_0x513795;_0x2ec408++){var _0x5fe50=events[_0x2ec408];var _0xc1ed83=createListener(_0x2673('0x5')+_0x5fe50,_0x90d6e5);ChatInteractionEvents['on'](_0x5fe50,_0xc1ed83);}}; \ No newline at end of file +var _0x8388=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8388,0x18d));var _0x8838=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x8388[_0x1057a3];return _0x131cdb;};'use strict';var ChatInteractionEvents=require(_0x8838('0x0'));var events=[_0x8838('0x1'),_0x8838('0x2'),_0x8838('0x3')];function createListener(_0x5307bd,_0x140ee6){return function(_0x3dbcd4){_0x140ee6[_0x8838('0x4')](_0x5307bd,_0x3dbcd4);};}function removeListener(_0x20a813,_0xd474f2){return function(){ChatInteractionEvents['removeListener'](_0x20a813,_0xd474f2);};}exports[_0x8838('0x5')]=function(_0x471568){for(var _0x49cac2=0x0,_0xca2d0f=events[_0x8838('0x6')];_0x49cac2<_0xca2d0f;_0x49cac2++){var _0x27707c=events[_0x49cac2];var _0x56596f=createListener(_0x8838('0x7')+_0x27707c,_0x471568);ChatInteractionEvents['on'](_0x27707c,_0x56596f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 780d8d4..44f4111 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 _0x736d=['attachmentUpload','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file'];(function(_0x1f26fe,_0x7a66b8){var _0x14a6b3=function(_0x1c5e15){while(--_0x1c5e15){_0x1f26fe['push'](_0x1f26fe['shift']());}};_0x14a6b3(++_0x7a66b8);}(_0x736d,0x7b));var _0xd736=function(_0x2db472,_0x491e06){_0x2db472=_0x2db472-0x0;var _0x54c245=_0x736d[_0x2db472];return _0x54c245;};'use strict';var multer=require(_0xd736('0x0'));var util=require(_0xd736('0x1'));var path=require(_0xd736('0x2'));var timeout=require(_0xd736('0x3'));var express=require(_0xd736('0x4'));var router=express[_0xd736('0x5')]();var fs_extra=require(_0xd736('0x6'));var auth=require(_0xd736('0x7'));var interaction=require(_0xd736('0x8'));var config=require(_0xd736('0x9'));var controller=require(_0xd736('0xa'));router[_0xd736('0xb')]('/',auth[_0xd736('0xc')](),controller[_0xd736('0xd')]);router[_0xd736('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xd736('0xe')]);router[_0xd736('0xb')](_0xd736('0xf'),auth[_0xd736('0x10')](),controller['show']);router[_0xd736('0xb')]('/:id/attachment_download',auth[_0xd736('0x10')](),controller[_0xd736('0x11')]);router['get'](_0xd736('0x12'),auth['isAuthenticated'](),controller[_0xd736('0x13')]);router[_0xd736('0xb')]('/:id/my_messages',auth[_0xd736('0x10')](),controller['getMyMessages']);router[_0xd736('0xb')](_0xd736('0x14'),auth[_0xd736('0xc')](),controller[_0xd736('0x15')]);router[_0xd736('0x16')]('/',auth[_0xd736('0xc')](),controller[_0xd736('0x17')]);router['post'](_0xd736('0x18'),auth['isAuthenticated'](),controller[_0xd736('0x19')]);var upload=multer({'storage':multer[_0xd736('0x1a')]({'destination':function(_0x2fccd4,_0x7f6cb4,_0x46ba24){_0x46ba24(null,path[_0xd736('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x2b610a,_0x3cd6bd,_0x446249){_0x446249(null,util[_0xd736('0x1c')](_0xd736('0x1d'),Date[_0xd736('0x1e')](),_0x3cd6bd[_0xd736('0x1f')][_0xd736('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xd736('0x21'),upload[_0xd736('0x22')](_0xd736('0x23')),controller[_0xd736('0x24')]);router['post'](_0xd736('0x12'),auth[_0xd736('0x10')](),controller['addMessage']);router[_0xd736('0x16')]('/:id/tags',auth[_0xd736('0xc')](),interaction[_0xd736('0x25')](_0xd736('0x26'),_0xd736('0x27')),controller['addTags']);router[_0xd736('0x28')](_0xd736('0xf'),auth[_0xd736('0xc')](),interaction[_0xd736('0x25')](_0xd736('0x26'),_0xd736('0x29')),controller[_0xd736('0x2a')]);router['put'](_0xd736('0x2b'),controller[_0xd736('0x2c')]);router[_0xd736('0x28')]('/:id/abandon',auth[_0xd736('0x10')](),controller[_0xd736('0x2d')]);router[_0xd736('0x28')](_0xd736('0x2e'),controller[_0xd736('0x2f')]);router['delete']('/:id',auth[_0xd736('0xc')](),interaction[_0xd736('0x25')](_0xd736('0x26'),_0xd736('0x30')),controller[_0xd736('0x31')]);router[_0xd736('0x32')](_0xd736('0x33'),auth[_0xd736('0xc')](),controller[_0xd736('0x34')]);module['exports']=router; \ No newline at end of file +var _0x0c99=['diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession'];(function(_0x2529a6,_0x45598a){var _0x515326=function(_0xf5824b){while(--_0xf5824b){_0x2529a6['push'](_0x2529a6['shift']());}};_0x515326(++_0x45598a);}(_0x0c99,0x8a));var _0x90c9=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x0c99[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require(_0x90c9('0x0'));var util=require(_0x90c9('0x1'));var path=require(_0x90c9('0x2'));var timeout=require(_0x90c9('0x3'));var express=require(_0x90c9('0x4'));var router=express[_0x90c9('0x5')]();var fs_extra=require(_0x90c9('0x6'));var auth=require(_0x90c9('0x7'));var interaction=require(_0x90c9('0x8'));var config=require(_0x90c9('0x9'));var controller=require('./chatInteraction.controller');router[_0x90c9('0xa')]('/',auth[_0x90c9('0xb')](),controller[_0x90c9('0xc')]);router[_0x90c9('0xa')](_0x90c9('0xd'),auth[_0x90c9('0xb')](),controller['describe']);router[_0x90c9('0xa')](_0x90c9('0xe'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x10')]);router[_0x90c9('0xa')](_0x90c9('0x11'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x12')]);router[_0x90c9('0xa')](_0x90c9('0x13'),auth[_0x90c9('0xb')](),controller[_0x90c9('0x14')]);router['get']('/:id/my_messages',auth[_0x90c9('0xf')](),controller[_0x90c9('0x15')]);router[_0x90c9('0xa')](_0x90c9('0x16'),auth[_0x90c9('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x90c9('0x17')]);router[_0x90c9('0x18')](_0x90c9('0x19'),auth['isAuthenticated'](),controller[_0x90c9('0x1a')]);var upload=multer({'storage':multer[_0x90c9('0x1b')]({'destination':function(_0x1c8faa,_0x44f184,_0x40aa87){_0x40aa87(null,path[_0x90c9('0x1c')](config['root'],_0x90c9('0x1d')));},'filename':function(_0xddd9f1,_0x410920,_0x16fb6f){_0x16fb6f(null,util[_0x90c9('0x1e')](_0x90c9('0x1f'),Date[_0x90c9('0x20')](),_0x410920[_0x90c9('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x90c9('0x18')](_0x90c9('0x22'),upload[_0x90c9('0x23')]('file'),controller[_0x90c9('0x24')]);router[_0x90c9('0x18')](_0x90c9('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x90c9('0x25')]);router[_0x90c9('0x18')]('/:id/tags',auth[_0x90c9('0xb')](),interaction[_0x90c9('0x26')](_0x90c9('0x27'),_0x90c9('0x28')),controller['addTags']);router[_0x90c9('0x29')]('/:id',auth['isAuthenticated'](),interaction[_0x90c9('0x26')](_0x90c9('0x27'),_0x90c9('0x2a')),controller[_0x90c9('0x2b')]);router[_0x90c9('0x29')]('/:id/custom_update',controller[_0x90c9('0x2c')]);router[_0x90c9('0x29')](_0x90c9('0x2d'),auth[_0x90c9('0xf')](),controller[_0x90c9('0x2e')]);router[_0x90c9('0x29')](_0x90c9('0x2f'),controller[_0x90c9('0x30')]);router[_0x90c9('0x31')](_0x90c9('0xe'),auth[_0x90c9('0xb')](),interaction['tracked'](_0x90c9('0x27'),_0x90c9('0x32')),controller[_0x90c9('0x33')]);router[_0x90c9('0x31')](_0x90c9('0x34'),auth[_0x90c9('0xb')](),controller[_0x90c9('0x35')]);module[_0x90c9('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 52d4095..0d9d6c4 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 _0x3b70=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3b70,0x1bb));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x03b7('0x0'));module[_0x03b7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x03b7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x03b7('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x03b7('0x4')]}}; \ No newline at end of file +var _0x6866=['BOOLEAN','sequelize','medium'];(function(_0x5e92b6,_0x23219a){var _0x487171=function(_0x1ac1dc){while(--_0x1ac1dc){_0x5e92b6['push'](_0x5e92b6['shift']());}};_0x487171(++_0x23219a);}(_0x6866,0x14e));var _0x6686=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x6866[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x6686('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6686('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6686('0x2')],'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 50a9000..b8605df 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 _0x86a0=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','destroy','find','describe','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','length','resourceId','push','messages','FromId','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x3f0db3,_0x601ff9){var _0x3e10b7=function(_0x158db9){while(--_0x158db9){_0x3f0db3['push'](_0x3f0db3['shift']());}};_0x3e10b7(++_0x601ff9);}(_0x86a0,0xce));var _0x086a=function(_0x40b1e7,_0x382a5e){_0x40b1e7=_0x40b1e7-0x0;var _0x596b75=_0x86a0[_0x40b1e7];return _0x596b75;};'use strict';var emlformat=require(_0x086a('0x0'));var rimraf=require(_0x086a('0x1'));var zipdir=require(_0x086a('0x2'));var jsonpatch=require(_0x086a('0x3'));var rp=require(_0x086a('0x4'));var moment=require(_0x086a('0x5'));var BPromise=require(_0x086a('0x6'));var Mustache=require(_0x086a('0x7'));var util=require(_0x086a('0x8'));var path=require(_0x086a('0x9'));var sox=require('sox');var csv=require(_0x086a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x086a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x086a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x086a('0xd'));var Redis=require(_0x086a('0xe'));var authService=require(_0x086a('0xf'));var qs=require(_0x086a('0x10'));var as=require(_0x086a('0x11'));var hardwareService=require(_0x086a('0x12'));var logger=require('../../config/logger')(_0x086a('0x13'));var utils=require(_0x086a('0x14'));var config=require(_0x086a('0x15'));var licenseUtil=require(_0x086a('0x16'));var db=require(_0x086a('0x17'))['db'];config[_0x086a('0x18')]=_[_0x086a('0x19')](config[_0x086a('0x18')],{'host':_0x086a('0x1a'),'port':0x18eb});var socket=require(_0x086a('0x1b'))(new Redis(config[_0x086a('0x18')]));require(_0x086a('0x1c'))[_0x086a('0x1d')](socket);function respondWithStatusCode(_0x2c226b,_0x386984){_0x386984=_0x386984||0xcc;return function(_0x1ad77b){if(_0x1ad77b){return _0x2c226b[_0x086a('0x1e')](_0x386984);}return _0x2c226b[_0x086a('0x1f')](_0x386984)[_0x086a('0x20')]();};}function respondWithResult(_0x120bf4,_0x31830c){_0x31830c=_0x31830c||0xc8;return function(_0x343384){if(_0x343384){return _0x120bf4[_0x086a('0x1f')](_0x31830c)[_0x086a('0x21')](_0x343384);}};}function respondWithFilteredResult(_0x3326dc,_0x9e37b4){return function(_0x1f71fd){if(_0x1f71fd){var _0xc89921=typeof _0x9e37b4[_0x086a('0x22')]===_0x086a('0x23')&&typeof _0x9e37b4[_0x086a('0x24')]===_0x086a('0x23');var _0x52422d=_0x1f71fd[_0x086a('0x25')];var _0x4c8b7d=_0xc89921?0x0:_0x9e37b4['offset'];var _0x3e3295=_0xc89921?_0x1f71fd[_0x086a('0x25')]:_0x9e37b4[_0x086a('0x22')]+_0x9e37b4[_0x086a('0x24')];var _0xc8b5e1;if(_0x3e3295>=_0x52422d){_0x3e3295=_0x52422d;_0xc8b5e1=0xc8;}else{_0xc8b5e1=0xce;}_0x3326dc['status'](_0xc8b5e1);return _0x3326dc[_0x086a('0x26')](_0x086a('0x27'),_0x4c8b7d+'-'+_0x3e3295+'/'+_0x52422d)[_0x086a('0x21')](_0x1f71fd);}return null;};}function patchUpdates(_0x2c4e58){return function(_0x56111e){try{jsonpatch[_0x086a('0x28')](_0x56111e,_0x2c4e58,!![]);}catch(_0x51838d){return BPromise[_0x086a('0x29')](_0x51838d);}return _0x56111e['save']();};}function saveUpdates(_0x329e7d,_0x2b7860){return function(_0x1d021d){if(_0x1d021d){return _0x1d021d[_0x086a('0x2a')](_0x329e7d)[_0x086a('0x2b')](function(_0x4fe415){return _0x4fe415;});}return null;};}function removeEntity(_0xf2ea12,_0x46794a){return function(_0x5a73e3){if(_0x5a73e3){return _0x5a73e3['destroy']()[_0x086a('0x2b')](function(){_0xf2ea12['status'](0xcc)[_0x086a('0x20')]();});}};}function handleEntityNotFound(_0x52ef1f,_0x2a1d7c){return function(_0x24b59a){if(!_0x24b59a){_0x52ef1f['sendStatus'](0x194);}return _0x24b59a;};}function handleError(_0x14a464,_0x28b52e){_0x28b52e=_0x28b52e||0x1f4;return function(_0x32abfd){logger[_0x086a('0x2c')](_0x32abfd[_0x086a('0x2d')]);if(_0x32abfd['name']){delete _0x32abfd['name'];}_0x14a464[_0x086a('0x1f')](_0x28b52e)['send'](_0x32abfd);};}exports[_0x086a('0x2e')]=function(_0xf57709,_0xd3801a){var _0x32da3f={},_0x240bb8={},_0x422863={'count':0x0,'rows':[]};var _0xfed6c6=_['map'](db[_0x086a('0x2f')][_0x086a('0x30')],function(_0x19625e){return{'name':_0x19625e[_0x086a('0x31')],'type':_0x19625e[_0x086a('0x32')][_0x086a('0x33')]};});_0x240bb8[_0x086a('0x34')]=_['map'](_0xfed6c6,_0x086a('0x35'));_0x240bb8[_0x086a('0x36')]=_[_0x086a('0x37')](_0xf57709[_0x086a('0x36')]);_0x240bb8[_0x086a('0x38')]=_[_0x086a('0x39')](_0x240bb8[_0x086a('0x34')],_0x240bb8[_0x086a('0x36')]);_0x32da3f[_0x086a('0x3a')]=_[_0x086a('0x39')](_0x240bb8[_0x086a('0x34')],qs['fields'](_0xf57709[_0x086a('0x36')][_0x086a('0x3b')]));_0x32da3f[_0x086a('0x3a')]=_0x32da3f[_0x086a('0x3a')]['length']?_0x32da3f[_0x086a('0x3a')]:_0x240bb8['model'];if(!_0xf57709[_0x086a('0x36')][_0x086a('0x3c')]('nolimit')){_0x32da3f[_0x086a('0x24')]=qs[_0x086a('0x24')](_0xf57709[_0x086a('0x36')][_0x086a('0x24')]);_0x32da3f['offset']=qs['offset'](_0xf57709['query'][_0x086a('0x22')]);}_0x32da3f[_0x086a('0x3d')]=qs[_0x086a('0x3e')](_0xf57709['query'][_0x086a('0x3e')]);_0x32da3f[_0x086a('0x3f')]=qs[_0x086a('0x38')](_['pick'](_0xf57709[_0x086a('0x36')],_0x240bb8[_0x086a('0x38')]),_0xfed6c6);if(_0xf57709[_0x086a('0x36')][_0x086a('0x40')]){_0x32da3f['where']=_[_0x086a('0x41')](_0x32da3f[_0x086a('0x3f')],{'$or':_[_0x086a('0x42')](_0xfed6c6,function(_0x3d8da2){if(_0x3d8da2['type']!==_0x086a('0x43')){var _0x3e4369={};_0x3e4369[_0x3d8da2[_0x086a('0x35')]]={'$like':'%'+_0xf57709[_0x086a('0x36')]['filter']+'%'};return _0x3e4369;}})});}_0x32da3f=_[_0x086a('0x41')]({},_0x32da3f,_0xf57709[_0x086a('0x44')]);var _0x263e5b={'where':_0x32da3f[_0x086a('0x3f')]};return db[_0x086a('0x2f')][_0x086a('0x25')](_0x263e5b)[_0x086a('0x2b')](function(_0x4d7570){_0x422863[_0x086a('0x25')]=_0x4d7570;if(_0xf57709['query'][_0x086a('0x45')]){_0x32da3f[_0x086a('0x46')]=[{'all':!![]}];}return db[_0x086a('0x2f')]['findAll'](_0x32da3f);})[_0x086a('0x2b')](function(_0x8ce9c0){_0x422863[_0x086a('0x47')]=_0x8ce9c0;return _0x422863;})[_0x086a('0x2b')](respondWithFilteredResult(_0xd3801a,_0x32da3f))[_0x086a('0x48')](handleError(_0xd3801a,null));};exports[_0x086a('0x49')]=function(_0x4267ad,_0x5e89c9){var _0x165a44={'raw':!![],'where':{'id':_0x4267ad[_0x086a('0x4a')]['id']}},_0x25b41e={};_0x25b41e[_0x086a('0x34')]=_[_0x086a('0x37')](db[_0x086a('0x2f')]['rawAttributes']);_0x25b41e[_0x086a('0x36')]=_[_0x086a('0x37')](_0x4267ad['query']);_0x25b41e[_0x086a('0x38')]=_[_0x086a('0x39')](_0x25b41e['model'],_0x25b41e[_0x086a('0x36')]);_0x165a44[_0x086a('0x3a')]=_[_0x086a('0x39')](_0x25b41e['model'],qs[_0x086a('0x3b')](_0x4267ad['query'][_0x086a('0x3b')]));_0x165a44[_0x086a('0x3a')]=_0x165a44[_0x086a('0x3a')]['length']?_0x165a44[_0x086a('0x3a')]:_0x25b41e[_0x086a('0x34')];if(_0x4267ad[_0x086a('0x36')][_0x086a('0x45')]){_0x165a44[_0x086a('0x46')]=[{'all':!![]}];}_0x165a44=_[_0x086a('0x41')]({},_0x165a44,_0x4267ad[_0x086a('0x44')]);return db[_0x086a('0x2f')]['find'](_0x165a44)[_0x086a('0x2b')](handleEntityNotFound(_0x5e89c9,null))[_0x086a('0x2b')](respondWithResult(_0x5e89c9,null))['catch'](handleError(_0x5e89c9,null));};exports[_0x086a('0x4b')]=function(_0x4993a9,_0x2a1f42){return db[_0x086a('0x2f')][_0x086a('0x4b')](_0x4993a9[_0x086a('0x4c')],{})['then'](respondWithResult(_0x2a1f42,0xc9))[_0x086a('0x48')](handleError(_0x2a1f42,null));};exports[_0x086a('0x2a')]=function(_0x1e1e64,_0x54ebc5){if(_0x1e1e64['body']['id']){delete _0x1e1e64[_0x086a('0x4c')]['id'];}return db[_0x086a('0x2f')]['find']({'where':{'id':_0x1e1e64[_0x086a('0x4a')]['id']}})[_0x086a('0x2b')](handleEntityNotFound(_0x54ebc5,null))[_0x086a('0x2b')](saveUpdates(_0x1e1e64[_0x086a('0x4c')],null))[_0x086a('0x2b')](respondWithResult(_0x54ebc5,null))[_0x086a('0x48')](handleError(_0x54ebc5,null));};exports[_0x086a('0x4d')]=function(_0x2b0e32,_0x9e20b6){return db[_0x086a('0x2f')][_0x086a('0x4e')]({'where':{'id':_0x2b0e32['params']['id']}})[_0x086a('0x2b')](handleEntityNotFound(_0x9e20b6,null))['then'](removeEntity(_0x9e20b6,null))[_0x086a('0x48')](handleError(_0x9e20b6,null));};exports[_0x086a('0x4f')]=function(_0x2f6dba,_0x4de2a7){return db[_0x086a('0x2f')]['describe']()[_0x086a('0x2b')](respondWithResult(_0x4de2a7,null))[_0x086a('0x48')](handleError(_0x4de2a7,null));};function wrapUser(_0x189c6a){return function(_0x5173c5){var _0x3320ad=_0x189c6a['get']({'plain':!![]});_0x3320ad['messages']=[];if(_0x5173c5){_0x3320ad[_0x086a('0x50')]=_0x5173c5[_0x086a('0x51')];_0x3320ad[_0x086a('0x52')]=_0x5173c5;}else{_0x3320ad[_0x086a('0x50')]=moment(0x0)['format'](_0x086a('0x53'));_0x3320ad[_0x086a('0x52')]={};}return _0x3320ad;};}exports[_0x086a('0x54')]=function(_0x129ca1,_0x5ad4fa,_0x3455c8){var _0x574d6c=[];return db[_0x086a('0x55')][_0x086a('0x56')]({'where':{'role':['agent',_0x086a('0x57'),_0x086a('0x58')]},'attributes':['id',_0x086a('0x59'),'name','role',_0x086a('0x5a'),_0x086a('0x5b'),_0x086a('0x5c'),_0x086a('0x5d'),_0x086a('0x5e'),_0x086a('0x5f')],'order':qs['sort'](_0x086a('0x60')),'include':[{'model':db[_0x086a('0x61')],'as':_0x086a('0x62'),'attributes':['id',_0x086a('0x35'),'type'],'through':{'attributes':[]}}]})[_0x086a('0x2b')](function(_0x512fc2){if(_0x512fc2){var _0xaf6d6b=_0x129ca1[_0x086a('0x58')]['get']({'plain':!![]});if(!_0xaf6d6b)throw new Error(_0x086a('0x63'));if(_0xaf6d6b[_0x086a('0x64')]===_0x086a('0x58')){return db[_0x086a('0x65')][_0x086a('0x4e')]({'where':{'name':_0x086a('0x66'),'userProfileId':_0xaf6d6b[_0x086a('0x67')]},'raw':!![]})['then'](function(_0x4f19fc){if(_0x4f19fc){if(_0x4f19fc[_0x086a('0x68')]===0x0){return db[_0x086a('0x69')][_0x086a('0x56')]({'where':{'sectionId':_0x4f19fc['id']},'raw':!![]})[_0x086a('0x2b')](function(_0x33d58a){var _0x51837c=[];if(_[_0x086a('0x6a')](_0x33d58a)){_0x51837c=_[_0x086a('0x40')](_0x512fc2,function(_0x142c5f){if(_0x142c5f[_0x086a('0x64')]!==_0x086a('0x6b')){return _0x142c5f;}});return _0x51837c;}else{for(var _0x3b96b9=0x0;_0x3b96b9<_0x512fc2[_0x086a('0x6c')];_0x3b96b9++){var _0x33a468=_0x512fc2[_0x3b96b9];if(_0x33a468[_0x086a('0x64')]===_0x086a('0x6b')){var _0x339ec7=_[_0x086a('0x4e')](_0x33d58a,function(_0x4d64b4){return _0x4d64b4[_0x086a('0x6d')]===_0x33a468['id'];});if(_0x339ec7)_0x51837c[_0x086a('0x6e')](_0x33a468);}else{_0x51837c[_0x086a('0x6e')](_0x33a468);}}return _0x51837c;}});}else{return _0x512fc2;}}else{var _0x29ab02=_[_0x086a('0x40')](_0x512fc2,function(_0x8c1d5b){if(_0x8c1d5b[_0x086a('0x64')]!=='agent'){return _0x8c1d5b;}});return _0x29ab02;}});}else{return _0x512fc2;}}})['then'](function(_0x149ff8){var _0x40f3ae=[];if(_0x149ff8){_0x574d6c=_0x149ff8;for(var _0x31fddf=0x0;_0x31fddf<_0x149ff8[_0x086a('0x6c')];_0x31fddf+=0x1){_0x574d6c[_0x31fddf][_0x086a('0x6f')]=[];_0x40f3ae[_0x086a('0x6e')](db[_0x086a('0x2f')][_0x086a('0x4e')]({'where':{'FromId':[_0x129ca1[_0x086a('0x58')]['id'],_0x149ff8[_0x31fddf]['id']],'ToId':[_0x129ca1['user']['id'],_0x149ff8[_0x31fddf]['id']],'ChatGroupId':null},'attributes':['id',_0x086a('0x51'),_0x086a('0x70'),'ToId',_0x086a('0x71'),_0x086a('0x4c')],'order':qs[_0x086a('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x086a('0x2b')](wrapUser(_0x149ff8[_0x31fddf])));}return BPromise['all'](_0x40f3ae);}return[];})[_0x086a('0x2b')](function(_0x3eddc8){return{'rows':_0x3eddc8,'count':_0x3eddc8[_0x086a('0x6c')]};})[_0x086a('0x2b')](respondWithResult(_0x5ad4fa,null))['catch'](handleError(_0x5ad4fa,null));}; \ No newline at end of file +var _0x3b71=['./chatInternalMessage.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','send','index','map','ChatInternalMessage','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','find','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b71,0x181));var _0x13b7=function(_0x4949e2,_0x1bf3be){_0x4949e2=_0x4949e2-0x0;var _0x1e45d8=_0x3b71[_0x4949e2];return _0x1e45d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13b7('0x0'));var zipdir=require(_0x13b7('0x1'));var jsonpatch=require(_0x13b7('0x2'));var rp=require(_0x13b7('0x3'));var moment=require(_0x13b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13b7('0x5'));var util=require(_0x13b7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x13b7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b7('0x8'));var _=require(_0x13b7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13b7('0xa'));var deskjs=require(_0x13b7('0xb'));var toCsv=require(_0x13b7('0x7'));var querystring=require(_0x13b7('0xc'));var Papa=require(_0x13b7('0xd'));var Redis=require('ioredis');var authService=require(_0x13b7('0xe'));var qs=require(_0x13b7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13b7('0x10'));var logger=require('../../config/logger')(_0x13b7('0x11'));var utils=require(_0x13b7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x13b7('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x13b7('0x14')](config[_0x13b7('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x13b7('0x16'))(new Redis(config[_0x13b7('0x15')]));require(_0x13b7('0x17'))['register'](socket);function respondWithStatusCode(_0x26fa4b,_0x2822b9){_0x2822b9=_0x2822b9||0xcc;return function(_0x4f93fd){if(_0x4f93fd){return _0x26fa4b[_0x13b7('0x18')](_0x2822b9);}return _0x26fa4b['status'](_0x2822b9)[_0x13b7('0x19')]();};}function respondWithResult(_0x2d9f9f,_0x1f51c3){_0x1f51c3=_0x1f51c3||0xc8;return function(_0x84f408){if(_0x84f408){return _0x2d9f9f[_0x13b7('0x1a')](_0x1f51c3)[_0x13b7('0x1b')](_0x84f408);}};}function respondWithFilteredResult(_0xd4144a,_0x3c4cba){return function(_0x3dc345){if(_0x3dc345){var _0x3fb14c=typeof _0x3c4cba[_0x13b7('0x1c')]===_0x13b7('0x1d')&&typeof _0x3c4cba[_0x13b7('0x1e')]==='undefined';var _0xec09d9=_0x3dc345[_0x13b7('0x1f')];var _0x2e4f15=_0x3fb14c?0x0:_0x3c4cba[_0x13b7('0x1c')];var _0x346bc0=_0x3fb14c?_0x3dc345[_0x13b7('0x1f')]:_0x3c4cba['offset']+_0x3c4cba[_0x13b7('0x1e')];var _0x4b1b73;if(_0x346bc0>=_0xec09d9){_0x346bc0=_0xec09d9;_0x4b1b73=0xc8;}else{_0x4b1b73=0xce;}_0xd4144a[_0x13b7('0x1a')](_0x4b1b73);return _0xd4144a[_0x13b7('0x20')]('Content-Range',_0x2e4f15+'-'+_0x346bc0+'/'+_0xec09d9)[_0x13b7('0x1b')](_0x3dc345);}return null;};}function patchUpdates(_0xff9324){return function(_0x13246b){try{jsonpatch[_0x13b7('0x21')](_0x13246b,_0xff9324,!![]);}catch(_0x2a85a5){return BPromise[_0x13b7('0x22')](_0x2a85a5);}return _0x13246b[_0x13b7('0x23')]();};}function saveUpdates(_0x21d474,_0x3ac2e1){return function(_0x55144b){if(_0x55144b){return _0x55144b[_0x13b7('0x24')](_0x21d474)[_0x13b7('0x25')](function(_0x21e8a1){return _0x21e8a1;});}return null;};}function removeEntity(_0x584f76,_0x2cfc5c){return function(_0x265b61){if(_0x265b61){return _0x265b61[_0x13b7('0x26')]()[_0x13b7('0x25')](function(){_0x584f76[_0x13b7('0x1a')](0xcc)[_0x13b7('0x19')]();});}};}function handleEntityNotFound(_0x231cee,_0xa51bd1){return function(_0x21ece9){if(!_0x21ece9){_0x231cee[_0x13b7('0x18')](0x194);}return _0x21ece9;};}function handleError(_0x5e4723,_0x366b47){_0x366b47=_0x366b47||0x1f4;return function(_0x1ab4c8){logger['error'](_0x1ab4c8[_0x13b7('0x27')]);if(_0x1ab4c8['name']){delete _0x1ab4c8['name'];}_0x5e4723[_0x13b7('0x1a')](_0x366b47)[_0x13b7('0x28')](_0x1ab4c8);};}exports[_0x13b7('0x29')]=function(_0x190e60,_0x54e634){var _0x5a3bc4={},_0x4a88b1={},_0x38df97={'count':0x0,'rows':[]};var _0x5214f5=_[_0x13b7('0x2a')](db[_0x13b7('0x2b')]['rawAttributes'],function(_0x4c4bdd){return{'name':_0x4c4bdd[_0x13b7('0x2c')],'type':_0x4c4bdd[_0x13b7('0x2d')]['key']};});_0x4a88b1[_0x13b7('0x2e')]=_[_0x13b7('0x2a')](_0x5214f5,_0x13b7('0x2f'));_0x4a88b1[_0x13b7('0x30')]=_[_0x13b7('0x31')](_0x190e60[_0x13b7('0x30')]);_0x4a88b1[_0x13b7('0x32')]=_[_0x13b7('0x33')](_0x4a88b1['model'],_0x4a88b1[_0x13b7('0x30')]);_0x5a3bc4[_0x13b7('0x34')]=_[_0x13b7('0x33')](_0x4a88b1[_0x13b7('0x2e')],qs[_0x13b7('0x35')](_0x190e60[_0x13b7('0x30')]['fields']));_0x5a3bc4[_0x13b7('0x34')]=_0x5a3bc4[_0x13b7('0x34')][_0x13b7('0x36')]?_0x5a3bc4[_0x13b7('0x34')]:_0x4a88b1[_0x13b7('0x2e')];if(!_0x190e60['query']['hasOwnProperty']('nolimit')){_0x5a3bc4[_0x13b7('0x1e')]=qs[_0x13b7('0x1e')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x1e')]);_0x5a3bc4[_0x13b7('0x1c')]=qs[_0x13b7('0x1c')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x1c')]);}_0x5a3bc4['order']=qs[_0x13b7('0x37')](_0x190e60[_0x13b7('0x30')][_0x13b7('0x37')]);_0x5a3bc4[_0x13b7('0x38')]=qs[_0x13b7('0x32')](_['pick'](_0x190e60['query'],_0x4a88b1['filters']),_0x5214f5);if(_0x190e60[_0x13b7('0x30')]['filter']){_0x5a3bc4[_0x13b7('0x38')]=_[_0x13b7('0x39')](_0x5a3bc4[_0x13b7('0x38')],{'$or':_[_0x13b7('0x2a')](_0x5214f5,function(_0x36b60b){if(_0x36b60b[_0x13b7('0x2d')]!=='VIRTUAL'){var _0x123c61={};_0x123c61[_0x36b60b['name']]={'$like':'%'+_0x190e60[_0x13b7('0x30')][_0x13b7('0x3a')]+'%'};return _0x123c61;}})});}_0x5a3bc4=_[_0x13b7('0x39')]({},_0x5a3bc4,_0x190e60[_0x13b7('0x3b')]);var _0x4e9a4a={'where':_0x5a3bc4[_0x13b7('0x38')]};return db[_0x13b7('0x2b')][_0x13b7('0x1f')](_0x4e9a4a)['then'](function(_0x1008cb){_0x38df97[_0x13b7('0x1f')]=_0x1008cb;if(_0x190e60[_0x13b7('0x30')][_0x13b7('0x3c')]){_0x5a3bc4['include']=[{'all':!![]}];}return db[_0x13b7('0x2b')][_0x13b7('0x3d')](_0x5a3bc4);})['then'](function(_0x23271b){_0x38df97['rows']=_0x23271b;return _0x38df97;})[_0x13b7('0x25')](respondWithFilteredResult(_0x54e634,_0x5a3bc4))[_0x13b7('0x3e')](handleError(_0x54e634,null));};exports[_0x13b7('0x3f')]=function(_0x256a3e,_0x168705){var _0x1c6ed1={'raw':!![],'where':{'id':_0x256a3e[_0x13b7('0x40')]['id']}},_0x491af1={};_0x491af1[_0x13b7('0x2e')]=_['keys'](db[_0x13b7('0x2b')][_0x13b7('0x41')]);_0x491af1['query']=_[_0x13b7('0x31')](_0x256a3e['query']);_0x491af1[_0x13b7('0x32')]=_['intersection'](_0x491af1[_0x13b7('0x2e')],_0x491af1[_0x13b7('0x30')]);_0x1c6ed1[_0x13b7('0x34')]=_[_0x13b7('0x33')](_0x491af1[_0x13b7('0x2e')],qs[_0x13b7('0x35')](_0x256a3e['query'][_0x13b7('0x35')]));_0x1c6ed1[_0x13b7('0x34')]=_0x1c6ed1[_0x13b7('0x34')][_0x13b7('0x36')]?_0x1c6ed1['attributes']:_0x491af1[_0x13b7('0x2e')];if(_0x256a3e[_0x13b7('0x30')][_0x13b7('0x3c')]){_0x1c6ed1[_0x13b7('0x42')]=[{'all':!![]}];}_0x1c6ed1=_[_0x13b7('0x39')]({},_0x1c6ed1,_0x256a3e['options']);return db['ChatInternalMessage']['find'](_0x1c6ed1)['then'](handleEntityNotFound(_0x168705,null))[_0x13b7('0x25')](respondWithResult(_0x168705,null))[_0x13b7('0x3e')](handleError(_0x168705,null));};exports['create']=function(_0x2a4172,_0x202623){return db[_0x13b7('0x2b')][_0x13b7('0x43')](_0x2a4172[_0x13b7('0x44')],{})['then'](respondWithResult(_0x202623,0xc9))[_0x13b7('0x3e')](handleError(_0x202623,null));};exports['update']=function(_0x403b0c,_0x1c725b){if(_0x403b0c[_0x13b7('0x44')]['id']){delete _0x403b0c[_0x13b7('0x44')]['id'];}return db[_0x13b7('0x2b')][_0x13b7('0x45')]({'where':{'id':_0x403b0c[_0x13b7('0x40')]['id']}})[_0x13b7('0x25')](handleEntityNotFound(_0x1c725b,null))[_0x13b7('0x25')](saveUpdates(_0x403b0c[_0x13b7('0x44')],null))[_0x13b7('0x25')](respondWithResult(_0x1c725b,null))[_0x13b7('0x3e')](handleError(_0x1c725b,null));};exports['destroy']=function(_0x35bd5b,_0x43055f){return db[_0x13b7('0x2b')][_0x13b7('0x45')]({'where':{'id':_0x35bd5b['params']['id']}})[_0x13b7('0x25')](handleEntityNotFound(_0x43055f,null))[_0x13b7('0x25')](removeEntity(_0x43055f,null))[_0x13b7('0x3e')](handleError(_0x43055f,null));};exports['describe']=function(_0x1144ed,_0x3e491){return db[_0x13b7('0x2b')]['describe']()[_0x13b7('0x25')](respondWithResult(_0x3e491,null))[_0x13b7('0x3e')](handleError(_0x3e491,null));};function wrapUser(_0x134df3){return function(_0x5886ef){var _0x39a720=_0x134df3['get']({'plain':!![]});_0x39a720[_0x13b7('0x46')]=[];if(_0x5886ef){_0x39a720[_0x13b7('0x47')]=_0x5886ef[_0x13b7('0x48')];_0x39a720[_0x13b7('0x49')]=_0x5886ef;}else{_0x39a720[_0x13b7('0x47')]=moment(0x0)[_0x13b7('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x39a720[_0x13b7('0x49')]={};}return _0x39a720;};}exports[_0x13b7('0x4b')]=function(_0x3135da,_0x54af24,_0x5a0022){var _0x125c24=[];return db[_0x13b7('0x4c')]['findAll']({'where':{'role':[_0x13b7('0x4d'),_0x13b7('0x4e'),_0x13b7('0x4f')]},'attributes':['id',_0x13b7('0x50'),_0x13b7('0x2f'),_0x13b7('0x51'),_0x13b7('0x52'),_0x13b7('0x53'),_0x13b7('0x54'),_0x13b7('0x55'),_0x13b7('0x56'),_0x13b7('0x57')],'order':qs[_0x13b7('0x37')](_0x13b7('0x58')),'include':[{'model':db['VoiceQueue'],'as':_0x13b7('0x59'),'attributes':['id',_0x13b7('0x2f'),_0x13b7('0x2d')],'through':{'attributes':[]}}]})[_0x13b7('0x25')](function(_0x434552){if(_0x434552){var _0x1b8215=_0x3135da[_0x13b7('0x4f')][_0x13b7('0x5a')]({'plain':!![]});if(!_0x1b8215)throw new Error(_0x13b7('0x5b'));if(_0x1b8215['role']===_0x13b7('0x4f')){return db['UserProfileSection'][_0x13b7('0x45')]({'where':{'name':_0x13b7('0x5c'),'userProfileId':_0x1b8215[_0x13b7('0x5d')]},'raw':!![]})[_0x13b7('0x25')](function(_0x31329d){if(_0x31329d){if(_0x31329d['autoAssociation']===0x0){return db[_0x13b7('0x5e')][_0x13b7('0x3d')]({'where':{'sectionId':_0x31329d['id']},'raw':!![]})['then'](function(_0xb0d3f4){var _0x3489c8=[];if(_[_0x13b7('0x5f')](_0xb0d3f4)){_0x3489c8=_['filter'](_0x434552,function(_0x47730f){if(_0x47730f[_0x13b7('0x51')]!=='agent'){return _0x47730f;}});return _0x3489c8;}else{for(var _0x2c6a3f=0x0;_0x2c6a3f<_0x434552[_0x13b7('0x36')];_0x2c6a3f++){var _0x3fdaf6=_0x434552[_0x2c6a3f];if(_0x3fdaf6[_0x13b7('0x51')]===_0x13b7('0x4d')){var _0xf78590=_[_0x13b7('0x45')](_0xb0d3f4,function(_0x2a78cb){return _0x2a78cb[_0x13b7('0x60')]===_0x3fdaf6['id'];});if(_0xf78590)_0x3489c8[_0x13b7('0x61')](_0x3fdaf6);}else{_0x3489c8['push'](_0x3fdaf6);}}return _0x3489c8;}});}else{return _0x434552;}}else{var _0x41e938=_['filter'](_0x434552,function(_0x2a27c1){if(_0x2a27c1[_0x13b7('0x51')]!==_0x13b7('0x4d')){return _0x2a27c1;}});return _0x41e938;}});}else{return _0x434552;}}})[_0x13b7('0x25')](function(_0x2d3bec){var _0x1309d5=[];if(_0x2d3bec){_0x125c24=_0x2d3bec;for(var _0x2822d4=0x0;_0x2822d4<_0x2d3bec['length'];_0x2822d4+=0x1){_0x125c24[_0x2822d4]['messages']=[];_0x1309d5[_0x13b7('0x61')](db[_0x13b7('0x2b')]['find']({'where':{'FromId':[_0x3135da['user']['id'],_0x2d3bec[_0x2822d4]['id']],'ToId':[_0x3135da[_0x13b7('0x4f')]['id'],_0x2d3bec[_0x2822d4]['id']],'ChatGroupId':null},'attributes':['id',_0x13b7('0x48'),_0x13b7('0x62'),_0x13b7('0x63'),_0x13b7('0x64'),_0x13b7('0x44')],'order':qs['sort'](_0x13b7('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x13b7('0x25')](wrapUser(_0x2d3bec[_0x2822d4])));}return BPromise['all'](_0x1309d5);}return[];})['then'](function(_0x10ed99){return{'rows':_0x10ed99,'count':_0x10ed99['length']};})['then'](respondWithResult(_0x54af24,null))[_0x13b7('0x3e')](handleError(_0x54af24,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f08073a..7cc8b68 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 _0xc1bd=['emit','hasOwnProperty','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x3f7671,_0x5b7c64){var _0x299eb9=function(_0x50f07a){while(--_0x50f07a){_0x3f7671['push'](_0x3f7671['shift']());}};_0x299eb9(++_0x5b7c64);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x534deb,_0x21de0c){_0x534deb=_0x534deb-0x0;var _0x1b3238=_0xc1bd[_0x534deb];return _0x1b3238;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xdc1b('0x0'))['db'][_0xdc1b('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdc1b('0x2')](0x0);var events={'afterCreate':_0xdc1b('0x3'),'afterUpdate':_0xdc1b('0x4'),'afterDestroy':_0xdc1b('0x5')};function emitEvent(_0x5ad3b0){return function(_0x359884,_0x465095,_0x516d1f){ChatInternalMessageEvents[_0xdc1b('0x6')](_0x5ad3b0+':'+_0x359884['id'],_0x359884);ChatInternalMessageEvents[_0xdc1b('0x6')](_0x5ad3b0,_0x359884);_0x516d1f(null);};}for(var e in events){if(events[_0xdc1b('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xdc1b('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe003=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dca5f,_0x3bf609){var _0x2ad290=function(_0x35ca60){while(--_0x35ca60){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x2ad290(++_0x3bf609);}(_0xe003,0x1c4));var _0x3e00=function(_0x5bfb3e,_0x4975ca){_0x5bfb3e=_0x5bfb3e-0x0;var _0x58e6cd=_0xe003[_0x5bfb3e];return _0x58e6cd;};'use strict';var EventEmitter=require(_0x3e00('0x0'));var ChatInternalMessage=require(_0x3e00('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3e00('0x2')](0x0);var events={'afterCreate':_0x3e00('0x3'),'afterUpdate':_0x3e00('0x4'),'afterDestroy':_0x3e00('0x5')};function emitEvent(_0x19e0a4){return function(_0x4f3d98,_0x3705d5,_0x2c75a3){ChatInternalMessageEvents['emit'](_0x19e0a4+':'+_0x4f3d98['id'],_0x4f3d98);ChatInternalMessageEvents[_0x3e00('0x6')](_0x19e0a4,_0x4f3d98);_0x2c75a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x3e00('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index dac30ca..c827db9 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 _0xd66a=['path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x2678c7,_0x7f49f0){var _0x221a4c=function(_0x47673e){while(--_0x47673e){_0x2678c7['push'](_0x2678c7['shift']());}};_0x221a4c(++_0x7f49f0);}(_0xd66a,0xf3));var _0xad66=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0xd66a[_0x1943d9];return _0x4b4f3f;};'use strict';var _=require('lodash');var util=require(_0xad66('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xad66('0x1'));var BPromise=require(_0xad66('0x2'));var rp=require(_0xad66('0x3'));var fs=require('fs');var path=require(_0xad66('0x4'));var rimraf=require(_0xad66('0x5'));var config=require('../../config/environment');var attributes=require(_0xad66('0x6'));module[_0xad66('0x7')]=function(_0x4de33b,_0x1260eb){return _0x4de33b[_0xad66('0x8')](_0xad66('0x9'),attributes,{'tableName':_0xad66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad66('0xb'),'collate':_0xad66('0xc')});}; \ No newline at end of file +var _0x69f1=['moment','request-promise','path','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69f1,0x6b));var _0x169f=function(_0x59ff13,_0x2a91c1){_0x59ff13=_0x59ff13-0x0;var _0x4f3045=_0x69f1[_0x59ff13];return _0x4f3045;};'use strict';var _=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var logger=require(_0x169f('0x2'))('api');var moment=require(_0x169f('0x3'));var BPromise=require('bluebird');var rp=require(_0x169f('0x4'));var fs=require('fs');var path=require(_0x169f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x169f('0x6'));module[_0x169f('0x7')]=function(_0x3d6092,_0x2f58a0){return _0x3d6092[_0x169f('0x8')](_0x169f('0x9'),attributes,{'tableName':_0x169f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 5434fcc..1daa473 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 _0x92a4=['./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x228745,_0x59705f){var _0x48ae57=function(_0x499a82){while(--_0x499a82){_0x228745['push'](_0x228745['shift']());}};_0x48ae57(++_0x59705f);}(_0x92a4,0xb4));var _0x492a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x92a4[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x492a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x492a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x492a('0x2'));var db=require(_0x492a('0x3'))['db'];var utils=require(_0x492a('0x4'));var logger=require(_0x492a('0x5'))(_0x492a('0x6'));var config=require(_0x492a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x492a('0x8')][_0x492a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x492a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x492a('0xb'))(new Redis(config[_0x492a('0xa')]));require(_0x492a('0xc'))[_0x492a('0xd')](socket);function respondWithRpcPromise(_0x453876,_0x352903,_0x342545){return new BPromise(function(_0x1684a1,_0x26611e){return client['request'](_0x453876,_0x342545)['then'](function(_0x41ebdc){logger[_0x492a('0xe')](_0x492a('0xf'),_0x352903,'request\x20sent');logger[_0x492a('0x10')](_0x492a('0x11'),_0x352903,_0x492a('0x12'),JSON[_0x492a('0x13')](_0x41ebdc));if(_0x41ebdc[_0x492a('0x14')]){if(_0x41ebdc[_0x492a('0x14')][_0x492a('0x15')]===0x1f4){logger[_0x492a('0x14')](_0x492a('0xf'),_0x352903,_0x41ebdc[_0x492a('0x14')]['message']);return _0x26611e(_0x41ebdc[_0x492a('0x14')][_0x492a('0x16')]);}logger[_0x492a('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x352903,_0x41ebdc['error'][_0x492a('0x16')]);return _0x1684a1(_0x41ebdc['error'][_0x492a('0x16')]);}else{logger['info'](_0x492a('0xf'),_0x352903,'request\x20sent');_0x1684a1(_0x41ebdc['result'][_0x492a('0x16')]);}})[_0x492a('0x17')](function(_0x84a543){logger[_0x492a('0x14')](_0x492a('0xf'),_0x352903,_0x84a543);_0x26611e(_0x84a543);});});} \ No newline at end of file +var _0x5d53=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x52171e,_0x45804b){var _0x4bcaa5=function(_0x1aa4c8){while(--_0x1aa4c8){_0x52171e['push'](_0x52171e['shift']());}};_0x4bcaa5(++_0x45804b);}(_0x5d53,0x81));var _0x35d5=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0x5d53[_0x69a451];return _0x3d6ef5;};'use strict';var _=require('lodash');var util=require(_0x35d5('0x0'));var moment=require(_0x35d5('0x1'));var BPromise=require(_0x35d5('0x2'));var rs=require(_0x35d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35d5('0x4'))['db'];var utils=require(_0x35d5('0x5'));var logger=require('../../config/logger')(_0x35d5('0x6'));var config=require(_0x35d5('0x7'));var jayson=require(_0x35d5('0x8'));var client=jayson[_0x35d5('0x9')]['http']({'port':0x232a});config[_0x35d5('0xa')]=_['defaults'](config[_0x35d5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35d5('0xa')]));require('./chatInternalMessage.socket')[_0x35d5('0xb')](socket);function respondWithRpcPromise(_0x3a6018,_0x4a5f1b,_0x241f6e){return new BPromise(function(_0x292ef3,_0xbd56a1){return client[_0x35d5('0xc')](_0x3a6018,_0x241f6e)[_0x35d5('0xd')](function(_0x5eb042){logger['info'](_0x35d5('0xe'),_0x4a5f1b,_0x35d5('0xf'));logger[_0x35d5('0x10')](_0x35d5('0x11'),_0x4a5f1b,'request\x20sent',JSON[_0x35d5('0x12')](_0x5eb042));if(_0x5eb042[_0x35d5('0x13')]){if(_0x5eb042[_0x35d5('0x13')][_0x35d5('0x14')]===0x1f4){logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x5eb042[_0x35d5('0x13')][_0x35d5('0x15')]);return _0xbd56a1(_0x5eb042['error'][_0x35d5('0x15')]);}logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x5eb042[_0x35d5('0x13')][_0x35d5('0x15')]);return _0x292ef3(_0x5eb042['error'][_0x35d5('0x15')]);}else{logger[_0x35d5('0x16')](_0x35d5('0xe'),_0x4a5f1b,_0x35d5('0xf'));_0x292ef3(_0x5eb042['result'][_0x35d5('0x15')]);}})[_0x35d5('0x17')](function(_0x912809){logger[_0x35d5('0x13')](_0x35d5('0xe'),_0x4a5f1b,_0x912809);_0xbd56a1(_0x912809);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 37d5521..a4af659 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 _0x0fe8=['save','update','removeListener','register','length'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0fe8,0xc8));var _0x80fe=function(_0x18713d,_0x53e935){_0x18713d=_0x18713d-0x0;var _0x30adbd=_0x0fe8[_0x18713d];return _0x30adbd;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x80fe('0x0'),'remove',_0x80fe('0x1')];function createListener(_0x55058,_0x50e383){return function(_0x1dfe67){_0x50e383['emit'](_0x55058,_0x1dfe67);};}function removeListener(_0x83c177,_0xd1555c){return function(){ChatInternalMessageEvents[_0x80fe('0x2')](_0x83c177,_0xd1555c);};}exports[_0x80fe('0x3')]=function(_0x559481){for(var _0x271e2f=0x0,_0x50cd87=events[_0x80fe('0x4')];_0x271e2f<_0x50cd87;_0x271e2f++){var _0x3c9462=events[_0x271e2f];var _0x4ed03e=createListener('chatInternalMessage:'+_0x3c9462,_0x559481);ChatInternalMessageEvents['on'](_0x3c9462,_0x4ed03e);}}; \ No newline at end of file +var _0x2e4f=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','register','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2e4f,0x1a5));var _0xf2e4=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x2e4f[_0x98db33];return _0x5ae63a;};'use strict';var ChatInternalMessageEvents=require(_0xf2e4('0x0'));var events=[_0xf2e4('0x1'),'remove','update'];function createListener(_0x11c359,_0x5ea72a){return function(_0x36a9a6){_0x5ea72a[_0xf2e4('0x2')](_0x11c359,_0x36a9a6);};}function removeListener(_0x185a9b,_0x447f79){return function(){ChatInternalMessageEvents[_0xf2e4('0x3')](_0x185a9b,_0x447f79);};}exports[_0xf2e4('0x4')]=function(_0x5a072b){for(var _0xa0c128=0x0,_0x53ea9b=events[_0xf2e4('0x5')];_0xa0c128<_0x53ea9b;_0xa0c128++){var _0x29d4a3=events[_0xa0c128];var _0x269685=createListener(_0xf2e4('0x6')+_0x29d4a3,_0x5a072b);ChatInternalMessageEvents['on'](_0x29d4a3,_0x269685);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f4ed771..4acab42 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 _0x14b0=['get','isAuthenticated','index','describe','getUsers','/:id','show','post','create','put','update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x14b0,0x189));var _0x014b=function(_0x103d99,_0x217361){_0x103d99=_0x103d99-0x0;var _0x2e838d=_0x14b0[_0x103d99];return _0x2e838d;};'use strict';var multer=require(_0x014b('0x0'));var util=require('util');var path=require(_0x014b('0x1'));var timeout=require('connect-timeout');var express=require(_0x014b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x014b('0x3'));var interaction=require(_0x014b('0x4'));var config=require(_0x014b('0x5'));var controller=require(_0x014b('0x6'));router[_0x014b('0x7')]('/',auth[_0x014b('0x8')](),controller[_0x014b('0x9')]);router[_0x014b('0x7')]('/describe',auth[_0x014b('0x8')](),controller[_0x014b('0xa')]);router['get']('/users',auth['isAuthenticated'](),controller[_0x014b('0xb')]);router[_0x014b('0x7')](_0x014b('0xc'),auth[_0x014b('0x8')](),controller[_0x014b('0xd')]);router[_0x014b('0xe')]('/',auth[_0x014b('0x8')](),controller[_0x014b('0xf')]);router[_0x014b('0x10')](_0x014b('0xc'),controller[_0x014b('0x11')]);router[_0x014b('0x12')](_0x014b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x014b('0x13')]=router; \ No newline at end of file +var _0xa0de=['isAuthenticated','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','fs-extra','../../config/environment','./chatInternalMessage.controller'];(function(_0x49f59e,_0x3b3fce){var _0x1786a0=function(_0x5d51e8){while(--_0x5d51e8){_0x49f59e['push'](_0x49f59e['shift']());}};_0x1786a0(++_0x3b3fce);}(_0xa0de,0x1c3));var _0xea0d=function(_0x2ad159,_0x22b591){_0x2ad159=_0x2ad159-0x0;var _0x507651=_0xa0de[_0x2ad159];return _0x507651;};'use strict';var multer=require(_0xea0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea0d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xea0d('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea0d('0x3'));var controller=require(_0xea0d('0x4'));router['get']('/',auth[_0xea0d('0x5')](),controller['index']);router[_0xea0d('0x6')](_0xea0d('0x7'),auth['isAuthenticated'](),controller[_0xea0d('0x8')]);router['get'](_0xea0d('0x9'),auth[_0xea0d('0x5')](),controller[_0xea0d('0xa')]);router[_0xea0d('0x6')](_0xea0d('0xb'),auth['isAuthenticated'](),controller[_0xea0d('0xc')]);router[_0xea0d('0xd')]('/',auth[_0xea0d('0x5')](),controller[_0xea0d('0xe')]);router[_0xea0d('0xf')](_0xea0d('0xb'),controller[_0xea0d('0x10')]);router[_0xea0d('0x11')](_0xea0d('0xb'),auth[_0xea0d('0x5')](),controller['destroy']);module[_0xea0d('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 82b8d19..8d87eed 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 _0x73a1=['medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x73a1,0x161));var _0x173a=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0x73a1[_0x393500];return _0x120d3b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x173a('0x0')](_0x173a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x173a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x173a('0x3')]('in',_0x173a('0x4')),'defaultValue':_0x173a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x173a('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file +var _0x0cfa=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0xc7a446,_0x555b8b){var _0x37ab03=function(_0x327204){while(--_0x327204){_0xc7a446['push'](_0xc7a446['shift']());}};_0x37ab03(++_0x555b8b);}(_0x0cfa,0x73));var _0xa0cf=function(_0x43317b,_0xc88025){_0x43317b=_0x43317b-0x0;var _0xaee277=_0x0cfa[_0x43317b];return _0xaee277;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'body':{'type':Sequelize[_0xa0cf('0x2')](_0xa0cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa0cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa0cf('0x6')]},'providerName':{'type':Sequelize[_0xa0cf('0x7')]},'providerResponse':{'type':Sequelize[_0xa0cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6747f3a..3ab387c 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 _0x37a8=['motionChannel','event','EventManager','rejectmessage','formData','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','../../config/logger','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','order','where','pick','merge','VIRTUAL','filter','options','ChatMessage','rows','rawAttributes','length','include','catch','create','body','find','params','describe','acceptMessage','reject','chat','UserId','user','get','ChatInteraction','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','User','agent','email','interface','channel'];(function(_0x20e72d,_0x4519f9){var _0x5504d1=function(_0x122e2a){while(--_0x122e2a){_0x20e72d['push'](_0x20e72d['shift']());}};_0x5504d1(++_0x4519f9);}(_0x37a8,0x1d6));var _0x837a=function(_0x397127,_0x31429d){_0x397127=_0x397127-0x0;var _0x1d5516=_0x37a8[_0x397127];return _0x1d5516;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x837a('0x0'));var interactionService=require('../../components/interaction/service');var qs=require(_0x837a('0x1'));var logger=require('../../config/logger')(_0x837a('0x2'));var config=require('../../config/environment');var db=require(_0x837a('0x3'))['db'];config['redis']=_[_0x837a('0x4')](config[_0x837a('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x837a('0x6'))(new Redis(config['redis']));require(_0x837a('0x7'))[_0x837a('0x8')](socket);var jayson=require(_0x837a('0x9'));var client=jayson[_0x837a('0xa')][_0x837a('0xb')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x837a('0xc'))('chat-interactions');function respondWithRpcPromise(_0x46b4c3,_0x1d618d,_0x56a3d8,_0x5ed626){return new Promise(function(_0x29c649,_0x34a97e){var _0x886de7=_0x5ed626||client;return _0x886de7[_0x837a('0xd')](_0x46b4c3,_0x56a3d8)[_0x837a('0xe')](function(_0x226d0b){logger[_0x837a('0xf')]('ChatMessage,\x20%s,\x20%s',_0x1d618d,_0x837a('0x10'));logger[_0x837a('0x11')](_0x837a('0x12'),_0x1d618d,_0x837a('0x10'),JSON['stringify'](_0x226d0b));if(_0x226d0b[_0x837a('0x13')]){if(_0x226d0b[_0x837a('0x13')][_0x837a('0x14')]===0x1f4){logger[_0x837a('0x13')](_0x837a('0x15'),_0x1d618d,_0x226d0b['error'][_0x837a('0x16')]);return _0x34a97e(_0x226d0b[_0x837a('0x13')][_0x837a('0x16')]);}logger[_0x837a('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1d618d,_0x226d0b[_0x837a('0x13')][_0x837a('0x16')]);return _0x29c649(_0x226d0b[_0x837a('0x13')][_0x837a('0x16')]);}else{logger['info'](_0x837a('0x15'),_0x1d618d,_0x837a('0x10'));_0x29c649(_0x226d0b[_0x837a('0x17')]['message']);}})['catch'](function(_0x1cdad4){logger[_0x837a('0x13')](_0x837a('0x15'),_0x1d618d,_0x1cdad4);_0x34a97e(_0x1cdad4);});});}function respondWithResult(_0x26aeee,_0x4f3233){_0x4f3233=_0x4f3233||0xc8;return function(_0x4c57ac){if(_0x4c57ac){return _0x26aeee[_0x837a('0x18')](_0x4f3233)[_0x837a('0x19')](_0x4c57ac);}};}function respondWithFilteredResult(_0x567b79,_0x897b37){return function(_0x506ed0){if(_0x506ed0){var _0x1d666c=typeof _0x897b37[_0x837a('0x1a')]===_0x837a('0x1b')&&typeof _0x897b37[_0x837a('0x1c')]===_0x837a('0x1b');var _0x5a7212=_0x506ed0[_0x837a('0x1d')];var _0x513344=_0x1d666c?0x0:_0x897b37[_0x837a('0x1a')];var _0x3051d2=_0x1d666c?_0x506ed0['count']:_0x897b37[_0x837a('0x1a')]+_0x897b37['limit'];var _0x3bf6f4;if(_0x3051d2>=_0x5a7212){_0x3051d2=_0x5a7212;_0x3bf6f4=0xc8;}else{_0x3bf6f4=0xce;}_0x567b79[_0x837a('0x18')](_0x3bf6f4);return _0x567b79[_0x837a('0x1e')]('Content-Range',_0x513344+'-'+_0x3051d2+'/'+_0x5a7212)[_0x837a('0x19')](_0x506ed0);}return null;};}function saveUpdates(_0xf6dfdd){return function(_0x478768){if(_0x478768){return _0x478768[_0x837a('0x1f')](_0xf6dfdd)[_0x837a('0xe')](function(_0x49ac47){return _0x49ac47;});}return null;};}function removeEntity(_0x2884ec){return function(_0x272679){if(_0x272679){return _0x272679[_0x837a('0x20')]()['then'](function(){_0x2884ec[_0x837a('0x18')](0xcc)[_0x837a('0x21')]();});}};}function handleEntityNotFound(_0x174695){return function(_0x367896){if(!_0x367896){_0x174695[_0x837a('0x22')](0x194);}return _0x367896;};}function handleError(_0x5e7ca6,_0x3c0977){_0x3c0977=_0x3c0977||0x1f4;return function(_0x357f09){logger[_0x837a('0x13')](_0x357f09[_0x837a('0x23')]);if(_0x357f09['name']){delete _0x357f09[_0x837a('0x24')];}_0x5e7ca6[_0x837a('0x18')](_0x3c0977)[_0x837a('0x25')](_0x357f09);};}exports['index']=function(_0x193489,_0x5d8ce1){var _0x5860df={},_0x3481bc={},_0x27325d={'count':0x0,'rows':[]};var _0x2ed694=_[_0x837a('0x26')](db['ChatMessage']['rawAttributes'],function(_0x391714){return{'name':_0x391714[_0x837a('0x27')],'type':_0x391714[_0x837a('0x28')]['key']};});_0x3481bc['model']=_[_0x837a('0x26')](_0x2ed694,_0x837a('0x24'));_0x3481bc[_0x837a('0x29')]=_[_0x837a('0x2a')](_0x193489['query']);_0x3481bc[_0x837a('0x2b')]=_[_0x837a('0x2c')](_0x3481bc[_0x837a('0x2d')],_0x3481bc[_0x837a('0x29')]);_0x5860df[_0x837a('0x2e')]=_[_0x837a('0x2c')](_0x3481bc[_0x837a('0x2d')],qs[_0x837a('0x2f')](_0x193489[_0x837a('0x29')]['fields']));_0x5860df[_0x837a('0x2e')]=_0x5860df['attributes']['length']?_0x5860df[_0x837a('0x2e')]:_0x3481bc['model'];if(!_0x193489[_0x837a('0x29')]['hasOwnProperty']('nolimit')){_0x5860df[_0x837a('0x1c')]=qs[_0x837a('0x1c')](_0x193489['query'][_0x837a('0x1c')]);_0x5860df[_0x837a('0x1a')]=qs[_0x837a('0x1a')](_0x193489[_0x837a('0x29')][_0x837a('0x1a')]);}_0x5860df[_0x837a('0x30')]=qs['sort'](_0x193489[_0x837a('0x29')]['sort']);_0x5860df[_0x837a('0x31')]=qs[_0x837a('0x2b')](_[_0x837a('0x32')](_0x193489[_0x837a('0x29')],_0x3481bc['filters']),_0x2ed694);if(_0x193489['query']['filter']){_0x5860df[_0x837a('0x31')]=_[_0x837a('0x33')](_0x5860df[_0x837a('0x31')],{'$or':_['map'](_0x2ed694,function(_0x197755){if(_0x197755[_0x837a('0x28')]!==_0x837a('0x34')){var _0x57f556={};_0x57f556[_0x197755['name']]={'$like':'%'+_0x193489[_0x837a('0x29')][_0x837a('0x35')]+'%'};return _0x57f556;}})});}_0x5860df=_['merge']({},_0x5860df,_0x193489[_0x837a('0x36')]);var _0x4106e2={'where':_0x5860df['where']};return db[_0x837a('0x37')][_0x837a('0x1d')](_0x4106e2)[_0x837a('0xe')](function(_0x2c3808){_0x27325d['count']=_0x2c3808;if(_0x193489[_0x837a('0x29')]['includeAll']){_0x5860df['include']=[{'all':!![]}];}return db[_0x837a('0x37')]['findAll'](_0x5860df);})[_0x837a('0xe')](function(_0x100da6){_0x27325d[_0x837a('0x38')]=_0x100da6;return _0x27325d;})[_0x837a('0xe')](respondWithFilteredResult(_0x5d8ce1,_0x5860df))['catch'](handleError(_0x5d8ce1,null));};exports['show']=function(_0x5a2066,_0x18064b){var _0x49df49={'raw':!![],'where':{'id':_0x5a2066['params']['id']}},_0x19b8d4={};_0x19b8d4['model']=_[_0x837a('0x2a')](db[_0x837a('0x37')][_0x837a('0x39')]);_0x19b8d4[_0x837a('0x29')]=_[_0x837a('0x2a')](_0x5a2066[_0x837a('0x29')]);_0x19b8d4[_0x837a('0x2b')]=_[_0x837a('0x2c')](_0x19b8d4[_0x837a('0x2d')],_0x19b8d4[_0x837a('0x29')]);_0x49df49[_0x837a('0x2e')]=_[_0x837a('0x2c')](_0x19b8d4[_0x837a('0x2d')],qs[_0x837a('0x2f')](_0x5a2066['query'][_0x837a('0x2f')]));_0x49df49[_0x837a('0x2e')]=_0x49df49['attributes'][_0x837a('0x3a')]?_0x49df49[_0x837a('0x2e')]:_0x19b8d4[_0x837a('0x2d')];if(_0x5a2066[_0x837a('0x29')]['includeAll']){_0x49df49[_0x837a('0x3b')]=[{'all':!![]}];}_0x49df49=_['merge']({},_0x49df49,_0x5a2066['options']);return db[_0x837a('0x37')]['find'](_0x49df49)[_0x837a('0xe')](handleEntityNotFound(_0x18064b,null))[_0x837a('0xe')](respondWithResult(_0x18064b,null))[_0x837a('0x3c')](handleError(_0x18064b,null));};exports['create']=function(_0x26ce49,_0x36b654){return db[_0x837a('0x37')][_0x837a('0x3d')](_0x26ce49[_0x837a('0x3e')],{})['then'](respondWithResult(_0x36b654,0xc9))[_0x837a('0x3c')](handleError(_0x36b654,null));};exports['update']=function(_0x198cc6,_0x627a04){if(_0x198cc6[_0x837a('0x3e')]['id']){delete _0x198cc6['body']['id'];}return db['ChatMessage'][_0x837a('0x3f')]({'where':{'id':_0x198cc6[_0x837a('0x40')]['id']}})[_0x837a('0xe')](handleEntityNotFound(_0x627a04,null))[_0x837a('0xe')](saveUpdates(_0x198cc6[_0x837a('0x3e')],null))[_0x837a('0xe')](respondWithResult(_0x627a04,null))[_0x837a('0x3c')](handleError(_0x627a04,null));};exports[_0x837a('0x20')]=function(_0x1365d6,_0x443b9c){return db[_0x837a('0x37')][_0x837a('0x3f')]({'where':{'id':_0x1365d6[_0x837a('0x40')]['id']}})[_0x837a('0xe')](handleEntityNotFound(_0x443b9c,null))[_0x837a('0xe')](removeEntity(_0x443b9c,null))[_0x837a('0x3c')](handleError(_0x443b9c,null));};exports['describe']=function(_0x3e6fcf,_0x5f411d){return db[_0x837a('0x37')][_0x837a('0x41')]()[_0x837a('0xe')](respondWithResult(_0x5f411d,null))['catch'](handleError(_0x5f411d,null));};exports['accept']=function(_0x5702ab,_0x460e7e){var _0x4052dd='chat';return interactionService[_0x837a('0x42')](_0x5702ab,_0x4052dd)['then'](respondWithResult(_0x460e7e,null))['catch'](handleError(_0x460e7e,null));};exports[_0x837a('0x43')]=function(_0x293b71,_0x5deca4){var _0x4da61f={'agent':{},'channel':_0x837a('0x44')};if(_0x293b71[_0x837a('0x3e')]['id']){delete _0x293b71[_0x837a('0x3e')]['id'];}_0x293b71['body']['UserId']=_0x293b71[_0x837a('0x3e')][_0x837a('0x45')]||_0x293b71[_0x837a('0x46')]['id'];_0x4da61f['agent']['id']=_0x293b71[_0x837a('0x3e')][_0x837a('0x45')];return db['ChatMessage']['find']({'where':{'id':_0x293b71[_0x837a('0x40')]['id'],'UserId':null}})[_0x837a('0xe')](handleEntityNotFound(_0x5deca4,null))['then'](function(_0x5421c1){if(_0x5421c1){_0x4da61f[_0x837a('0x16')]=_0x5421c1[_0x837a('0x47')]({'plain':!![]});return db[_0x837a('0x48')][_0x837a('0x3f')]({'where':{'id':_0x5421c1['ChatInteractionId']}});}return null;})[_0x837a('0xe')](handleEntityNotFound(_0x5deca4,null))['then'](function(_0x215b91){if(_0x215b91){_0x4da61f[_0x837a('0x49')]=_0x215b91[_0x837a('0x47')]({'plain':!![]});interaction_log[_0x837a('0xf')](_0x837a('0x4a'),_0x293b71[_0x837a('0x46')]['id'],_0x293b71['user'][_0x837a('0x24')],_0x293b71['user'][_0x837a('0x4b')],_0x4da61f['interaction']['id'],_0x293b71[_0x837a('0x3e')]?JSON[_0x837a('0x4c')](_0x293b71['body']):'null');return respondWithRpcPromise(_0x837a('0x4d'),_0x837a('0x4e'),_0x4da61f);}return null;})[_0x837a('0xe')](function(_0x1123c5){var _0x5544d3=_0x837a('0x4f')+_0x1123c5[_0x837a('0x16')]['ContactId'];return db['sequelize']['query'](_0x5544d3,{'type':db[_0x837a('0x50')]['QueryTypes'][_0x837a('0x51')],'raw':!![]})[_0x837a('0xe')](function(_0x29982e){return _0x29982e;});})['then'](function(_0x46ed40){if(_0x46ed40){_0x4da61f['message'][_0x837a('0x52')]=_0x46ed40[0x0];if(!_0x293b71[_0x837a('0x3e')][_0x837a('0x45')])return;return db[_0x837a('0x53')][_0x837a('0x3f')]({'where':{'id':_0x293b71[_0x837a('0x3e')][_0x837a('0x45')],'role':_0x837a('0x54')},'attributes':['id',_0x837a('0x24'),'fullname',_0x837a('0x55'),'internal'],'raw':!![]});}return null;})[_0x837a('0xe')](function(_0x472be4){if(!_0x472be4)return null;_0x4da61f[_0x837a('0x16')][_0x837a('0x54')]=_0x472be4;return _0x4da61f;})[_0x837a('0xe')](function(_0xfdf6f6){if(_0xfdf6f6){_0xfdf6f6[_0x837a('0x16')][_0x837a('0x56')]=util['format']('SIP/%s',_0x293b71[_0x837a('0x46')][_0x837a('0x24')]);_0xfdf6f6[_0x837a('0x16')]['channel']=_0x4da61f[_0x837a('0x57')];_0xfdf6f6[_0x837a('0x16')][_0x837a('0x58')]=_0x4da61f['channel'];_0xfdf6f6[_0x837a('0x16')][_0x837a('0x59')]=_0x837a('0x43');respondWithRpcPromise(_0x837a('0x5a'),_0x837a('0x5a'),{'event':_0x837a('0x5b'),'message':_[_0x837a('0x33')](_0x4da61f[_0x837a('0x16')],JSON['parse'](_0x4da61f['interaction'][_0x837a('0x5c')]))},client9002);return _0x4da61f;}return null;})[_0x837a('0xe')](respondWithResult(_0x5deca4,null))['catch'](handleError(_0x5deca4,null));}; \ No newline at end of file +var _0x8e74=['fullname','email','internal','interface','channel','motionChannel','event','EventManager','formData','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','update','destroy','end','sendStatus','stack','name','index','ChatMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','describe','accept','chat','reject','UserId','user','agent','get','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8e74,0x189));var _0x48e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e74[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0x48e7('0x0'));var Redis=require(_0x48e7('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x48e7('0x2'));var logger=require(_0x48e7('0x3'))('api');var config=require(_0x48e7('0x4'));var db=require(_0x48e7('0x5'))['db'];config[_0x48e7('0x6')]=_['defaults'](config[_0x48e7('0x6')],{'host':_0x48e7('0x7'),'port':0x18eb});var socket=require(_0x48e7('0x8'))(new Redis(config[_0x48e7('0x6')]));require(_0x48e7('0x9'))[_0x48e7('0xa')](socket);var jayson=require(_0x48e7('0xb'));var client=jayson[_0x48e7('0xc')][_0x48e7('0xd')]({'port':0x232c});var client9002=jayson[_0x48e7('0xc')][_0x48e7('0xd')]({'port':0x232a});var interaction_log=require(_0x48e7('0x3'))('chat-interactions');function respondWithRpcPromise(_0x3b0136,_0x4a7240,_0x48f10e,_0x279cba){return new Promise(function(_0x2ed224,_0x528b51){var _0x5ce0f8=_0x279cba||client;return _0x5ce0f8[_0x48e7('0xe')](_0x3b0136,_0x48f10e)[_0x48e7('0xf')](function(_0x3b0610){logger[_0x48e7('0x10')]('ChatMessage,\x20%s,\x20%s',_0x4a7240,_0x48e7('0x11'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4a7240,'request\x20sent',JSON['stringify'](_0x3b0610));if(_0x3b0610[_0x48e7('0x12')]){if(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x13')]===0x1f4){logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);return _0x528b51(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);}logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);return _0x2ed224(_0x3b0610[_0x48e7('0x12')][_0x48e7('0x15')]);}else{logger['info'](_0x48e7('0x14'),_0x4a7240,'request\x20sent');_0x2ed224(_0x3b0610[_0x48e7('0x16')][_0x48e7('0x15')]);}})[_0x48e7('0x17')](function(_0x3a2bb3){logger[_0x48e7('0x12')](_0x48e7('0x14'),_0x4a7240,_0x3a2bb3);_0x528b51(_0x3a2bb3);});});}function respondWithResult(_0x7cae1f,_0x38f21c){_0x38f21c=_0x38f21c||0xc8;return function(_0x59649f){if(_0x59649f){return _0x7cae1f[_0x48e7('0x18')](_0x38f21c)[_0x48e7('0x19')](_0x59649f);}};}function respondWithFilteredResult(_0x4d05ed,_0x472eea){return function(_0xbee7b4){if(_0xbee7b4){var _0x89b571=typeof _0x472eea[_0x48e7('0x1a')]===_0x48e7('0x1b')&&typeof _0x472eea['limit']==='undefined';var _0x445d0e=_0xbee7b4[_0x48e7('0x1c')];var _0x26da01=_0x89b571?0x0:_0x472eea[_0x48e7('0x1a')];var _0x513a3f=_0x89b571?_0xbee7b4[_0x48e7('0x1c')]:_0x472eea[_0x48e7('0x1a')]+_0x472eea[_0x48e7('0x1d')];var _0x2421c2;if(_0x513a3f>=_0x445d0e){_0x513a3f=_0x445d0e;_0x2421c2=0xc8;}else{_0x2421c2=0xce;}_0x4d05ed[_0x48e7('0x18')](_0x2421c2);return _0x4d05ed['set']('Content-Range',_0x26da01+'-'+_0x513a3f+'/'+_0x445d0e)[_0x48e7('0x19')](_0xbee7b4);}return null;};}function saveUpdates(_0x2f35e8){return function(_0x5b6b51){if(_0x5b6b51){return _0x5b6b51[_0x48e7('0x1e')](_0x2f35e8)['then'](function(_0x2cdf75){return _0x2cdf75;});}return null;};}function removeEntity(_0xf1b55b){return function(_0x6a7a7f){if(_0x6a7a7f){return _0x6a7a7f[_0x48e7('0x1f')]()[_0x48e7('0xf')](function(){_0xf1b55b[_0x48e7('0x18')](0xcc)[_0x48e7('0x20')]();});}};}function handleEntityNotFound(_0x1a6591){return function(_0x3ca412){if(!_0x3ca412){_0x1a6591[_0x48e7('0x21')](0x194);}return _0x3ca412;};}function handleError(_0x197274,_0x763e05){_0x763e05=_0x763e05||0x1f4;return function(_0x4acec0){logger['error'](_0x4acec0[_0x48e7('0x22')]);if(_0x4acec0['name']){delete _0x4acec0[_0x48e7('0x23')];}_0x197274['status'](_0x763e05)['send'](_0x4acec0);};}exports[_0x48e7('0x24')]=function(_0x5ffc66,_0x339a56){var _0x505923={},_0xb98a10={},_0x38a495={'count':0x0,'rows':[]};var _0x552061=_['map'](db[_0x48e7('0x25')]['rawAttributes'],function(_0x561e38){return{'name':_0x561e38[_0x48e7('0x26')],'type':_0x561e38[_0x48e7('0x27')][_0x48e7('0x28')]};});_0xb98a10[_0x48e7('0x29')]=_[_0x48e7('0x2a')](_0x552061,_0x48e7('0x23'));_0xb98a10[_0x48e7('0x2b')]=_[_0x48e7('0x2c')](_0x5ffc66['query']);_0xb98a10[_0x48e7('0x2d')]=_[_0x48e7('0x2e')](_0xb98a10[_0x48e7('0x29')],_0xb98a10[_0x48e7('0x2b')]);_0x505923[_0x48e7('0x2f')]=_[_0x48e7('0x2e')](_0xb98a10[_0x48e7('0x29')],qs[_0x48e7('0x30')](_0x5ffc66['query'][_0x48e7('0x30')]));_0x505923[_0x48e7('0x2f')]=_0x505923[_0x48e7('0x2f')]['length']?_0x505923[_0x48e7('0x2f')]:_0xb98a10['model'];if(!_0x5ffc66[_0x48e7('0x2b')]['hasOwnProperty'](_0x48e7('0x31'))){_0x505923['limit']=qs['limit'](_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x1d')]);_0x505923[_0x48e7('0x1a')]=qs[_0x48e7('0x1a')](_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x1a')]);}_0x505923[_0x48e7('0x32')]=qs[_0x48e7('0x33')](_0x5ffc66['query'][_0x48e7('0x33')]);_0x505923[_0x48e7('0x34')]=qs[_0x48e7('0x2d')](_[_0x48e7('0x35')](_0x5ffc66['query'],_0xb98a10[_0x48e7('0x2d')]),_0x552061);if(_0x5ffc66['query'][_0x48e7('0x36')]){_0x505923[_0x48e7('0x34')]=_[_0x48e7('0x37')](_0x505923[_0x48e7('0x34')],{'$or':_[_0x48e7('0x2a')](_0x552061,function(_0x395dad){if(_0x395dad[_0x48e7('0x27')]!=='VIRTUAL'){var _0x59b2b2={};_0x59b2b2[_0x395dad[_0x48e7('0x23')]]={'$like':'%'+_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x36')]+'%'};return _0x59b2b2;}})});}_0x505923=_['merge']({},_0x505923,_0x5ffc66['options']);var _0x52117d={'where':_0x505923['where']};return db['ChatMessage'][_0x48e7('0x1c')](_0x52117d)[_0x48e7('0xf')](function(_0x3a7128){_0x38a495[_0x48e7('0x1c')]=_0x3a7128;if(_0x5ffc66[_0x48e7('0x2b')][_0x48e7('0x38')]){_0x505923[_0x48e7('0x39')]=[{'all':!![]}];}return db['ChatMessage'][_0x48e7('0x3a')](_0x505923);})[_0x48e7('0xf')](function(_0x561876){_0x38a495[_0x48e7('0x3b')]=_0x561876;return _0x38a495;})[_0x48e7('0xf')](respondWithFilteredResult(_0x339a56,_0x505923))[_0x48e7('0x17')](handleError(_0x339a56,null));};exports[_0x48e7('0x3c')]=function(_0x412f3f,_0x3c8219){var _0xe0bddb={'raw':!![],'where':{'id':_0x412f3f['params']['id']}},_0x5120e7={};_0x5120e7[_0x48e7('0x29')]=_[_0x48e7('0x2c')](db[_0x48e7('0x25')][_0x48e7('0x3d')]);_0x5120e7['query']=_['keys'](_0x412f3f[_0x48e7('0x2b')]);_0x5120e7['filters']=_[_0x48e7('0x2e')](_0x5120e7[_0x48e7('0x29')],_0x5120e7[_0x48e7('0x2b')]);_0xe0bddb[_0x48e7('0x2f')]=_[_0x48e7('0x2e')](_0x5120e7['model'],qs[_0x48e7('0x30')](_0x412f3f[_0x48e7('0x2b')]['fields']));_0xe0bddb[_0x48e7('0x2f')]=_0xe0bddb['attributes']['length']?_0xe0bddb[_0x48e7('0x2f')]:_0x5120e7[_0x48e7('0x29')];if(_0x412f3f[_0x48e7('0x2b')][_0x48e7('0x38')]){_0xe0bddb[_0x48e7('0x39')]=[{'all':!![]}];}_0xe0bddb=_[_0x48e7('0x37')]({},_0xe0bddb,_0x412f3f['options']);return db[_0x48e7('0x25')][_0x48e7('0x3e')](_0xe0bddb)['then'](handleEntityNotFound(_0x3c8219,null))[_0x48e7('0xf')](respondWithResult(_0x3c8219,null))[_0x48e7('0x17')](handleError(_0x3c8219,null));};exports[_0x48e7('0x3f')]=function(_0x31bfd7,_0x2e4eb0){return db[_0x48e7('0x25')][_0x48e7('0x3f')](_0x31bfd7['body'],{})[_0x48e7('0xf')](respondWithResult(_0x2e4eb0,0xc9))['catch'](handleError(_0x2e4eb0,null));};exports[_0x48e7('0x1e')]=function(_0x21e58d,_0x4a1ab0){if(_0x21e58d[_0x48e7('0x40')]['id']){delete _0x21e58d[_0x48e7('0x40')]['id'];}return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x21e58d[_0x48e7('0x41')]['id']}})[_0x48e7('0xf')](handleEntityNotFound(_0x4a1ab0,null))[_0x48e7('0xf')](saveUpdates(_0x21e58d[_0x48e7('0x40')],null))[_0x48e7('0xf')](respondWithResult(_0x4a1ab0,null))[_0x48e7('0x17')](handleError(_0x4a1ab0,null));};exports[_0x48e7('0x1f')]=function(_0x3a6aa0,_0x599fd3){return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x3a6aa0[_0x48e7('0x41')]['id']}})[_0x48e7('0xf')](handleEntityNotFound(_0x599fd3,null))[_0x48e7('0xf')](removeEntity(_0x599fd3,null))['catch'](handleError(_0x599fd3,null));};exports[_0x48e7('0x42')]=function(_0x28859e,_0x2a9e03){return db[_0x48e7('0x25')][_0x48e7('0x42')]()['then'](respondWithResult(_0x2a9e03,null))['catch'](handleError(_0x2a9e03,null));};exports[_0x48e7('0x43')]=function(_0x473a16,_0x3ca4c9){var _0x4191c9=_0x48e7('0x44');return interactionService['acceptMessage'](_0x473a16,_0x4191c9)[_0x48e7('0xf')](respondWithResult(_0x3ca4c9,null))[_0x48e7('0x17')](handleError(_0x3ca4c9,null));};exports[_0x48e7('0x45')]=function(_0x4eeeee,_0x596ffd){var _0x26dfc7={'agent':{},'channel':_0x48e7('0x44')};if(_0x4eeeee[_0x48e7('0x40')]['id']){delete _0x4eeeee[_0x48e7('0x40')]['id'];}_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')]=_0x4eeeee[_0x48e7('0x40')]['UserId']||_0x4eeeee[_0x48e7('0x47')]['id'];_0x26dfc7[_0x48e7('0x48')]['id']=_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')];return db['ChatMessage'][_0x48e7('0x3e')]({'where':{'id':_0x4eeeee[_0x48e7('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x596ffd,null))['then'](function(_0x4d7a55){if(_0x4d7a55){_0x26dfc7[_0x48e7('0x15')]=_0x4d7a55[_0x48e7('0x49')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x4d7a55[_0x48e7('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0x596ffd,null))[_0x48e7('0xf')](function(_0x3e818b){if(_0x3e818b){_0x26dfc7[_0x48e7('0x4b')]=_0x3e818b['get']({'plain':!![]});interaction_log[_0x48e7('0x10')](_0x48e7('0x4c'),_0x4eeeee[_0x48e7('0x47')]['id'],_0x4eeeee[_0x48e7('0x47')][_0x48e7('0x23')],_0x4eeeee['user'][_0x48e7('0x4d')],_0x26dfc7[_0x48e7('0x4b')]['id'],_0x4eeeee[_0x48e7('0x40')]?JSON[_0x48e7('0x4e')](_0x4eeeee[_0x48e7('0x40')]):'null');return respondWithRpcPromise(_0x48e7('0x4f'),_0x48e7('0x50'),_0x26dfc7);}return null;})[_0x48e7('0xf')](function(_0x5b91b8){var _0x5a95a8=_0x48e7('0x51')+_0x5b91b8[_0x48e7('0x15')][_0x48e7('0x52')];return db[_0x48e7('0x53')][_0x48e7('0x2b')](_0x5a95a8,{'type':db['Sequelize'][_0x48e7('0x54')][_0x48e7('0x55')],'raw':!![]})['then'](function(_0x2b7913){return _0x2b7913;});})[_0x48e7('0xf')](function(_0x23b6b8){if(_0x23b6b8){_0x26dfc7[_0x48e7('0x15')]['contact']=_0x23b6b8[0x0];if(!_0x4eeeee[_0x48e7('0x40')]['UserId'])return;return db[_0x48e7('0x56')][_0x48e7('0x3e')]({'where':{'id':_0x4eeeee[_0x48e7('0x40')][_0x48e7('0x46')],'role':_0x48e7('0x48')},'attributes':['id','name',_0x48e7('0x57'),_0x48e7('0x58'),_0x48e7('0x59')],'raw':!![]});}return null;})[_0x48e7('0xf')](function(_0x30a8c7){if(!_0x30a8c7)return null;_0x26dfc7['message'][_0x48e7('0x48')]=_0x30a8c7;return _0x26dfc7;})[_0x48e7('0xf')](function(_0x1625b1){if(_0x1625b1){_0x1625b1['message'][_0x48e7('0x5a')]=util['format']('SIP/%s',_0x4eeeee[_0x48e7('0x47')][_0x48e7('0x23')]);_0x1625b1['message'][_0x48e7('0x5b')]=_0x26dfc7[_0x48e7('0x5b')];_0x1625b1[_0x48e7('0x15')][_0x48e7('0x5c')]=_0x26dfc7['channel'];_0x1625b1[_0x48e7('0x15')][_0x48e7('0x5d')]=_0x48e7('0x45');respondWithRpcPromise(_0x48e7('0x5e'),'EventManager',{'event':'rejectmessage','message':_[_0x48e7('0x37')](_0x26dfc7[_0x48e7('0x15')],JSON['parse'](_0x26dfc7['interaction'][_0x48e7('0x5f')]))},client9002);return _0x26dfc7;}return null;})[_0x48e7('0xf')](respondWithResult(_0x596ffd,null))[_0x48e7('0x17')](handleError(_0x596ffd,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 458046f..fc04452 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 _0x1525=['events','ChatMessage','save','emit','hasOwnProperty','exports'];(function(_0x916a95,_0x3655d2){var _0x5b94b0=function(_0x49055e){while(--_0x49055e){_0x916a95['push'](_0x916a95['shift']());}};_0x5b94b0(++_0x3655d2);}(_0x1525,0x96));var _0x5152=function(_0x23b8ff,_0x1866d0){_0x23b8ff=_0x23b8ff-0x0;var _0x5c6247=_0x1525[_0x23b8ff];return _0x5c6247;};'use strict';var EventEmitter=require(_0x5152('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x5152('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5152('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4157aa){return function(_0x254f30,_0x4e63f8,_0x5e9f96){ChatMessageEvents[_0x5152('0x3')](_0x4157aa+':'+_0x254f30['id'],_0x254f30);ChatMessageEvents[_0x5152('0x3')](_0x4157aa,_0x254f30);_0x5e9f96(null);};}for(var e in events){if(events[_0x5152('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x5152('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x0769=['hook','exports','events','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0769,0xda));var _0x9076=function(_0x204587,_0x3e40c2){_0x204587=_0x204587-0x0;var _0x224eb0=_0x0769[_0x204587];return _0x224eb0;};'use strict';var EventEmitter=require(_0x9076('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x9076('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9076('0x2')](0x0);var events={'afterCreate':_0x9076('0x3'),'afterUpdate':_0x9076('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e3b88){return function(_0x55b70b,_0x4215e4,_0x2c435a){ChatMessageEvents[_0x9076('0x5')](_0x2e3b88+':'+_0x55b70b['id'],_0x55b70b);ChatMessageEvents[_0x9076('0x5')](_0x2e3b88,_0x55b70b);_0x2c435a(null);};}for(var e in events){if(events[_0x9076('0x6')](e)){var event=events[e];ChatMessage[_0x9076('0x7')](e,emitEvent(event));}}module[_0x9076('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9209438..005794c 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 _0x02ef=['models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','catch','utf8mb4','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT'];(function(_0x5ebb4d,_0x3180ec){var _0x7e1980=function(_0x1ec1dd){while(--_0x1ec1dd){_0x5ebb4d['push'](_0x5ebb4d['shift']());}};_0x7e1980(++_0x3180ec);}(_0x02ef,0x11a));var _0xf02e=function(_0x3cef2a,_0x48bc9d){_0x3cef2a=_0x3cef2a-0x0;var _0x4a303b=_0x02ef[_0x3cef2a];return _0x4a303b;};'use strict';var _=require(_0xf02e('0x0'));var util=require('util');var logger=require(_0xf02e('0x1'))('api');var moment=require(_0xf02e('0x2'));var BPromise=require(_0xf02e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf02e('0x4'));var rimraf=require(_0xf02e('0x5'));var config=require(_0xf02e('0x6'));var attributes=require(_0xf02e('0x7'));module[_0xf02e('0x8')]=function(_0x511257,_0x332c29){return _0x511257[_0xf02e('0x9')](_0xf02e('0xa'),attributes,{'tableName':_0xf02e('0xb'),'paranoid':![],'indexes':[{'name':_0xf02e('0xc'),'fields':[_0xf02e('0xd')],'type':_0xf02e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x277f1f,_0x22a384,_0x338043){var _0x29d81c=_0x511257[_0xf02e('0xf')];var _0x58f9ec=_0x277f1f['get']({'plain':!![]});if(_0x58f9ec[_0xf02e('0x10')][_0xf02e('0x11')]()==='in'||_0x58f9ec['direction']['toLowerCase']()==='out'&&!_0x58f9ec[_0xf02e('0x12')]&&!_[_0xf02e('0x13')](_0x58f9ec[_0xf02e('0x14')])){_0x29d81c[_0xf02e('0x15')][_0xf02e('0x16')]({'where':{'id':_0x58f9ec[_0xf02e('0x17')]}})['then'](function(_0x46f22b){if(_0x46f22b){_0x46f22b['update']({'lastMsgAt':_0x58f9ec[_0xf02e('0x18')],'lastMsgDirection':_0x58f9ec[_0xf02e('0x10')]['toLowerCase']()});}})[_0xf02e('0x19')](function(_0x322e2a){console['error'](_0x322e2a);});}_0x338043();}},'charset':_0xf02e('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd772=['../../config/logger','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util'];(function(_0x4b7c2a,_0x3de9a8){var _0x405fe6=function(_0x56a583){while(--_0x56a583){_0x4b7c2a['push'](_0x4b7c2a['shift']());}};_0x405fe6(++_0x3de9a8);}(_0xd772,0xd7));var _0x2d77=function(_0x4f0853,_0x13791a){_0x4f0853=_0x4f0853-0x0;var _0x59c809=_0xd772[_0x4f0853];return _0x59c809;};'use strict';var _=require('lodash');var util=require(_0x2d77('0x0'));var logger=require(_0x2d77('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d77('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d77('0x3'));var rimraf=require(_0x2d77('0x4'));var config=require(_0x2d77('0x5'));var attributes=require(_0x2d77('0x6'));module['exports']=function(_0x2a7860,_0x1ad986){return _0x2a7860[_0x2d77('0x7')]('ChatMessage',attributes,{'tableName':_0x2d77('0x8'),'paranoid':![],'indexes':[{'name':_0x2d77('0x9'),'fields':['body'],'type':_0x2d77('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f8ad,_0x27f698,_0x1b798a){var _0x559bbc=_0x2a7860[_0x2d77('0xb')];var _0x4b78c=_0x20f8ad[_0x2d77('0xc')]({'plain':!![]});if(_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()==='in'||_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()===_0x2d77('0xf')&&!_0x4b78c['secret']&&!_[_0x2d77('0x10')](_0x4b78c[_0x2d77('0x11')])){_0x559bbc[_0x2d77('0x12')][_0x2d77('0x13')]({'where':{'id':_0x4b78c[_0x2d77('0x14')]}})[_0x2d77('0x15')](function(_0x431d5c){if(_0x431d5c){_0x431d5c[_0x2d77('0x16')]({'lastMsgAt':_0x4b78c[_0x2d77('0x17')],'lastMsgDirection':_0x4b78c[_0x2d77('0xd')][_0x2d77('0xe')]()});}})[_0x2d77('0x18')](function(_0x29d308){console[_0x2d77('0x19')](_0x29d308);});}_0x1b798a();}},'charset':_0x2d77('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 17871c6..7c9b380 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 _0x3c54=['raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','message','result','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x3c54,0x14d));var _0x43c5=function(_0x3c253c,_0x4c67ff){_0x3c253c=_0x3c253c-0x0;var _0x34c520=_0x3c54[_0x3c253c];return _0x34c520;};'use strict';var _=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var moment=require(_0x43c5('0x2'));var BPromise=require(_0x43c5('0x3'));var rs=require(_0x43c5('0x4'));var fs=require('fs');var Redis=require(_0x43c5('0x5'));var db=require(_0x43c5('0x6'))['db'];var utils=require(_0x43c5('0x7'));var logger=require(_0x43c5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43c5('0x9'));var client=jayson['client'][_0x43c5('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x43c5('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43c5('0xb')]));require(_0x43c5('0xc'))[_0x43c5('0xd')](socket);function respondWithRpcPromise(_0x3b40bd,_0x15d246,_0x11c36c){return new BPromise(function(_0x4d485e,_0x1ccca8){return client[_0x43c5('0xe')](_0x3b40bd,_0x11c36c)[_0x43c5('0xf')](function(_0x4b5b67){logger[_0x43c5('0x10')](_0x43c5('0x11'),_0x15d246,_0x43c5('0x12'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x15d246,_0x43c5('0x12'),JSON['stringify'](_0x4b5b67));if(_0x4b5b67[_0x43c5('0x13')]){if(_0x4b5b67[_0x43c5('0x13')]['code']===0x1f4){logger[_0x43c5('0x13')]('ChatMessage,\x20%s,\x20%s',_0x15d246,_0x4b5b67[_0x43c5('0x13')]['message']);return _0x1ccca8(_0x4b5b67['error'][_0x43c5('0x14')]);}logger[_0x43c5('0x13')](_0x43c5('0x11'),_0x15d246,_0x4b5b67[_0x43c5('0x13')][_0x43c5('0x14')]);return _0x4d485e(_0x4b5b67[_0x43c5('0x13')][_0x43c5('0x14')]);}else{logger['info'](_0x43c5('0x11'),_0x15d246,'request\x20sent');_0x4d485e(_0x4b5b67[_0x43c5('0x15')][_0x43c5('0x14')]);}})['catch'](function(_0x503d2b){logger[_0x43c5('0x13')](_0x43c5('0x11'),_0x15d246,_0x503d2b);_0x1ccca8(_0x503d2b);});});}exports[_0x43c5('0x16')]=function(_0x3f5378){var _0x30a435=this;return new Promise(function(_0x1859fd,_0x1bb433){return db[_0x43c5('0x17')][_0x43c5('0x18')](_0x3f5378[_0x43c5('0x19')],{'raw':_0x3f5378[_0x43c5('0x1a')]?_0x3f5378[_0x43c5('0x1a')][_0x43c5('0x1b')]===undefined?!![]:![]:!![]})[_0x43c5('0xf')](function(_0x4ff391){logger['info'](_0x43c5('0x16'),_0x3f5378);logger[_0x43c5('0x1c')](_0x43c5('0x16'),_0x3f5378,JSON[_0x43c5('0x1d')](_0x4ff391));_0x1859fd(_0x4ff391);})['catch'](function(_0x1684c5){logger[_0x43c5('0x13')]('CreateChatMessage',_0x1684c5[_0x43c5('0x14')],_0x3f5378);_0x1bb433(_0x30a435[_0x43c5('0x13')](0x1f4,_0x1684c5[_0x43c5('0x14')]));});});}; \ No newline at end of file +var _0x18e9=['http','defaults','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x59747c,_0x4de5fc){var _0x5b7e3a=function(_0x58741c){while(--_0x58741c){_0x59747c['push'](_0x59747c['shift']());}};_0x5b7e3a(++_0x4de5fc);}(_0x18e9,0x1e5));var _0x918e=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x18e9[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var moment=require(_0x918e('0x2'));var BPromise=require(_0x918e('0x3'));var rs=require(_0x918e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x918e('0x5'))['db'];var utils=require(_0x918e('0x6'));var logger=require('../../config/logger')(_0x918e('0x7'));var config=require('../../config/environment');var jayson=require(_0x918e('0x8'));var client=jayson[_0x918e('0x9')][_0x918e('0xa')]({'port':0x232a});config['redis']=_[_0x918e('0xb')](config[_0x918e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x918e('0xd'))(new Redis(config[_0x918e('0xc')]));require(_0x918e('0xe'))[_0x918e('0xf')](socket);function respondWithRpcPromise(_0x2a7a5a,_0x335f8b,_0x403dd2){return new BPromise(function(_0x11510a,_0x545ed1){return client[_0x918e('0x10')](_0x2a7a5a,_0x403dd2)[_0x918e('0x11')](function(_0x5a8390){logger[_0x918e('0x12')]('ChatMessage,\x20%s,\x20%s',_0x335f8b,_0x918e('0x13'));logger[_0x918e('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x335f8b,_0x918e('0x13'),JSON[_0x918e('0x15')](_0x5a8390));if(_0x5a8390[_0x918e('0x16')]){if(_0x5a8390[_0x918e('0x16')][_0x918e('0x17')]===0x1f4){logger[_0x918e('0x16')](_0x918e('0x18'),_0x335f8b,_0x5a8390['error']['message']);return _0x545ed1(_0x5a8390[_0x918e('0x16')][_0x918e('0x19')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x335f8b,_0x5a8390[_0x918e('0x16')][_0x918e('0x19')]);return _0x11510a(_0x5a8390[_0x918e('0x16')]['message']);}else{logger[_0x918e('0x12')](_0x918e('0x18'),_0x335f8b,'request\x20sent');_0x11510a(_0x5a8390[_0x918e('0x1a')]['message']);}})[_0x918e('0x1b')](function(_0x38a621){logger[_0x918e('0x16')](_0x918e('0x18'),_0x335f8b,_0x38a621);_0x545ed1(_0x38a621);});});}exports['CreateChatMessage']=function(_0x2aa152){var _0x218862=this;return new Promise(function(_0x6f2728,_0x1d8777){return db['ChatMessage'][_0x918e('0x1c')](_0x2aa152[_0x918e('0x1d')],{'raw':_0x2aa152[_0x918e('0x1e')]?_0x2aa152[_0x918e('0x1e')][_0x918e('0x1f')]===undefined?!![]:![]:!![]})[_0x918e('0x11')](function(_0x41968e){logger[_0x918e('0x12')](_0x918e('0x20'),_0x2aa152);logger[_0x918e('0x14')](_0x918e('0x20'),_0x2aa152,JSON[_0x918e('0x15')](_0x41968e));_0x6f2728(_0x41968e);})[_0x918e('0x1b')](function(_0x3b7e92){logger[_0x918e('0x16')](_0x918e('0x20'),_0x3b7e92[_0x918e('0x19')],_0x2aa152);_0x1d8777(_0x218862[_0x918e('0x16')](0x1f4,_0x3b7e92[_0x918e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8eb8cb0..d96d231 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 _0x0faf=['update','emit','removeListener','length','chatMessage:','./chatMessage.events','remove'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x0faf,0x132));var _0xf0fa=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0x0faf[_0x177cc9];return _0x2fe577;};'use strict';var ChatMessageEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatMessageEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatMessageEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file +var _0x1c3b=['removeListener','./chatMessage.events','save','remove','emit'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1c3b,0xab));var _0xb1c3=function(_0x514c64,_0x29a704){_0x514c64=_0x514c64-0x0;var _0x5b0287=_0x1c3b[_0x514c64];return _0x5b0287;};'use strict';var ChatMessageEvents=require(_0xb1c3('0x0'));var events=[_0xb1c3('0x1'),_0xb1c3('0x2'),'update'];function createListener(_0x4eeac2,_0x28a375){return function(_0x89ce0b){_0x28a375[_0xb1c3('0x3')](_0x4eeac2,_0x89ce0b);};}function removeListener(_0x34dbb5,_0x24d4c0){return function(){ChatMessageEvents[_0xb1c3('0x4')](_0x34dbb5,_0x24d4c0);};}exports['register']=function(_0x472813){for(var _0x62da34=0x0,_0x211254=events['length'];_0x62da34<_0x211254;_0x62da34++){var _0x504fc9=events[_0x62da34];var _0x4ed6cf=createListener('chatMessage:'+_0x504fc9,_0x472813);ChatMessageEvents['on'](_0x504fc9,_0x4ed6cf);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ab035d6..013c146 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 _0x4192=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','exports','util','path','../../components/interaction/service'];(function(_0x41f720,_0x32db46){var _0x582237=function(_0x371ba3){while(--_0x371ba3){_0x41f720['push'](_0x41f720['shift']());}};_0x582237(++_0x32db46);}(_0x4192,0x97));var _0x2419=function(_0x11a287,_0x57df55){_0x11a287=_0x11a287-0x0;var _0x111e64=_0x4192[_0x11a287];return _0x111e64;};'use strict';var multer=require('multer');var util=require(_0x2419('0x0'));var path=require(_0x2419('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2419('0x2'));var config=require(_0x2419('0x3'));var controller=require(_0x2419('0x4'));router[_0x2419('0x5')]('/',auth[_0x2419('0x6')](),controller[_0x2419('0x7')]);router['get'](_0x2419('0x8'),auth[_0x2419('0x6')](),controller[_0x2419('0x9')]);router[_0x2419('0x5')](_0x2419('0xa'),auth[_0x2419('0x6')](),controller[_0x2419('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2419('0xc')](_0x2419('0xd'),_0x2419('0xe')),controller['create']);router[_0x2419('0xf')](_0x2419('0xa'),controller[_0x2419('0x10')]);router[_0x2419('0xf')](_0x2419('0x11'),auth[_0x2419('0x6')](),controller[_0x2419('0x12')]);router[_0x2419('0xf')](_0x2419('0x13'),auth[_0x2419('0x6')](),controller['reject']);router[_0x2419('0x14')](_0x2419('0xa'),auth[_0x2419('0x6')](),controller['destroy']);module[_0x2419('0x15')]=router; \ No newline at end of file +var _0x57a6=['../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','reject','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x310ab4,_0x525c3e){var _0x28dfbb=function(_0x18820a){while(--_0x18820a){_0x310ab4['push'](_0x310ab4['shift']());}};_0x28dfbb(++_0x525c3e);}(_0x57a6,0x172));var _0x657a=function(_0x2ba9aa,_0x2cdb8f){_0x2ba9aa=_0x2ba9aa-0x0;var _0x4b753b=_0x57a6[_0x2ba9aa];return _0x4b753b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x657a('0x0'));var express=require(_0x657a('0x1'));var router=express[_0x657a('0x2')]();var fs_extra=require(_0x657a('0x3'));var auth=require(_0x657a('0x4'));var interaction=require(_0x657a('0x5'));var config=require(_0x657a('0x6'));var controller=require(_0x657a('0x7'));router['get']('/',auth[_0x657a('0x8')](),controller[_0x657a('0x9')]);router[_0x657a('0xa')](_0x657a('0xb'),auth['isAuthenticated'](),controller[_0x657a('0xc')]);router[_0x657a('0xa')](_0x657a('0xd'),auth[_0x657a('0x8')](),controller[_0x657a('0xe')]);router['post']('/',auth[_0x657a('0x8')](),interaction[_0x657a('0xf')](_0x657a('0x10'),_0x657a('0x11')),controller['create']);router[_0x657a('0x12')](_0x657a('0xd'),controller[_0x657a('0x13')]);router[_0x657a('0x12')](_0x657a('0x14'),auth[_0x657a('0x8')](),controller[_0x657a('0x15')]);router[_0x657a('0x12')]('/:id/reject',auth[_0x657a('0x8')](),controller[_0x657a('0x16')]);router[_0x657a('0x17')](_0x657a('0xd'),auth[_0x657a('0x8')](),controller[_0x657a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b15b234..1b27ca6 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 _0x2032=['medium','exports','TEXT'];(function(_0x2554b6,_0x22e703){var _0x4b23b9=function(_0x1b025c){while(--_0x1b025c){_0x2554b6['push'](_0x2554b6['shift']());}};_0x4b23b9(++_0x22e703);}(_0x2032,0xd9));var _0x2203=function(_0x279944,_0x34ad4c){_0x279944=_0x279944-0x0;var _0x16ae3c=_0x2032[_0x279944];return _0x16ae3c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x267bc6,_0x1843a7){var _0x14856c=function(_0x37e51f){while(--_0x37e51f){_0x267bc6['push'](_0x267bc6['shift']());}};_0x14856c(++_0x1843a7);}(_0xdb28,0x106));var _0x8db2=function(_0x294136,_0xf5c874){_0x294136=_0x294136-0x0;var _0x1498a4=_0xdb28[_0x294136];return _0x1498a4;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 27e3319..55c88d1 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(_0x3cb6f4,_0x48578e){var _0x45d68c=function(_0xc3f49f){while(--_0xc3f49f){_0x3cb6f4['push'](_0x3cb6f4['shift']());}};_0x45d68c(++_0x48578e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x27e8c4,_0x1b4f89){var _0x519f5a=function(_0x34d70b){while(--_0x34d70b){_0x27e8c4['push'](_0x27e8c4['shift']());}};_0x519f5a(++_0x1b4f89);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 7d49a99..7a5c352 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 _0xa527=['exports','../../mysqldb','ChatOfflineMessage','update','remove','hasOwnProperty','hook'];(function(_0x18a529,_0x2bea53){var _0x216fb8=function(_0x537d25){while(--_0x537d25){_0x18a529['push'](_0x18a529['shift']());}};_0x216fb8(++_0x2bea53);}(_0xa527,0x182));var _0x7a52=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xa527[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x7a52('0x0'))['db'][_0x7a52('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a52('0x2'),'afterDestroy':_0x7a52('0x3')};function emitEvent(_0x2a02cb){return function(_0x4ca128,_0x53b7bf,_0x57db35){ChatOfflineMessageEvents['emit'](_0x2a02cb+':'+_0x4ca128['id'],_0x4ca128);ChatOfflineMessageEvents['emit'](_0x2a02cb,_0x4ca128);_0x57db35(null);};}for(var e in events){if(events[_0x7a52('0x4')](e)){var event=events[e];ChatOfflineMessage[_0x7a52('0x5')](e,emitEvent(event));}}module[_0x7a52('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x26e9=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','save'];(function(_0xa84996,_0x16c698){var _0x1b9325=function(_0x4f2a31){while(--_0x4f2a31){_0xa84996['push'](_0xa84996['shift']());}};_0x1b9325(++_0x16c698);}(_0x26e9,0x1a2));var _0x926e=function(_0x3113b1,_0x42646c){_0x3113b1=_0x3113b1-0x0;var _0x4d45a8=_0x26e9[_0x3113b1];return _0x4d45a8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x926e('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x926e('0x1'),'afterUpdate':_0x926e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x37c0ca){return function(_0x2308af,_0x1e2798,_0x554f3a){ChatOfflineMessageEvents[_0x926e('0x3')](_0x37c0ca+':'+_0x2308af['id'],_0x2308af);ChatOfflineMessageEvents[_0x926e('0x3')](_0x37c0ca,_0x2308af);_0x554f3a(null);};}for(var e in events){if(events[_0x926e('0x4')](e)){var event=events[e];ChatOfflineMessage[_0x926e('0x5')](e,emitEvent(event));}}module[_0x926e('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 28804ed..394a0fe 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 _0x0d3b=['utf8mb4','utf8mb4_unicode_ci','ChatOfflineMessage','chat_offline_messages'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0d3b,0x9a));var _0xb0d3=function(_0x19d845,_0x5e7bf1){_0x19d845=_0x19d845-0x0;var _0x34651e=_0x0d3b[_0x19d845];return _0x34651e;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x3a2c31){return _0x3a2c31['define'](_0xb0d3('0x0'),attributes,{'tableName':_0xb0d3('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb0d3('0x2'),'collate':_0xb0d3('0x3')});}; \ No newline at end of file +var _0x8099=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x487eeb,_0x120b41){var _0x34917b=function(_0x4d0ab0){while(--_0x4d0ab0){_0x487eeb['push'](_0x487eeb['shift']());}};_0x34917b(++_0x120b41);}(_0x8099,0x91));var _0x9809=function(_0x2e010c,_0x1819a2){_0x2e010c=_0x2e010c-0x0;var _0x1b19d9=_0x8099[_0x2e010c];return _0x1b19d9;};'use strict';var attributes=require(_0x9809('0x0'));module[_0x9809('0x1')]=function(_0x29969e){return _0x29969e['define'](_0x9809('0x2'),attributes,{'tableName':_0x9809('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9809('0x4'),'collate':_0x9809('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 58ad043..7710cc1 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 _0x0c34=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug'];(function(_0x789179,_0x455e5f){var _0x10878f=function(_0x450629){while(--_0x450629){_0x789179['push'](_0x789179['shift']());}};_0x10878f(++_0x455e5f);}(_0x0c34,0x153));var _0x40c3=function(_0x2da87b,_0x569fcd){_0x2da87b=_0x2da87b-0x0;var _0x1931e4=_0x0c34[_0x2da87b];return _0x1931e4;};'use strict';var _=require('lodash');var util=require(_0x40c3('0x0'));var moment=require('moment');var BPromise=require(_0x40c3('0x1'));var rs=require(_0x40c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40c3('0x3'))['db'];var utils=require(_0x40c3('0x4'));var logger=require(_0x40c3('0x5'))(_0x40c3('0x6'));var config=require(_0x40c3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x40c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216fe1,_0x95df97,_0x361b3b){return new BPromise(function(_0x45ad06,_0x12f26a){return client[_0x40c3('0x9')](_0x216fe1,_0x361b3b)[_0x40c3('0xa')](function(_0x513d7d){logger['info'](_0x40c3('0xb'),_0x95df97,'request\x20sent');logger[_0x40c3('0xc')](_0x40c3('0xd'),_0x95df97,_0x40c3('0xe'),JSON[_0x40c3('0xf')](_0x513d7d));if(_0x513d7d[_0x40c3('0x10')]){if(_0x513d7d['error'][_0x40c3('0x11')]===0x1f4){logger['error'](_0x40c3('0xb'),_0x95df97,_0x513d7d['error'][_0x40c3('0x12')]);return _0x12f26a(_0x513d7d[_0x40c3('0x10')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x95df97,_0x513d7d['error'][_0x40c3('0x12')]);return _0x45ad06(_0x513d7d[_0x40c3('0x10')][_0x40c3('0x12')]);}else{logger[_0x40c3('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x95df97,_0x40c3('0xe'));_0x45ad06(_0x513d7d[_0x40c3('0x14')][_0x40c3('0x12')]);}})[_0x40c3('0x15')](function(_0x331fc5){logger[_0x40c3('0x10')](_0x40c3('0xb'),_0x95df97,_0x331fc5);_0x12f26a(_0x331fc5);});});} \ No newline at end of file +var _0x39c7=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x39c7,0x85));var _0x739c=function(_0xb5b557,_0x4a4eae){_0xb5b557=_0xb5b557-0x0;var _0x4a1090=_0x39c7[_0xb5b557];return _0x4a1090;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0af1,_0x5df5d3,_0x480159){return new BPromise(function(_0x27c5a4,_0x3475f2){return client['request'](_0x3c0af1,_0x480159)[_0x739c('0xa')](function(_0x277f61){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5df5d3,_0x739c('0xb'));logger[_0x739c('0xc')](_0x739c('0xd'),_0x5df5d3,_0x739c('0xb'),JSON[_0x739c('0xe')](_0x277f61));if(_0x277f61[_0x739c('0xf')]){if(_0x277f61[_0x739c('0xf')][_0x739c('0x10')]===0x1f4){logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x3475f2(_0x277f61['error'][_0x739c('0x12')]);}logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x27c5a4(_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);}else{logger[_0x739c('0x13')](_0x739c('0x11'),_0x5df5d3,_0x739c('0xb'));_0x27c5a4(_0x277f61['result']['message']);}})[_0x739c('0x14')](function(_0x23888d){logger[_0x739c('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5df5d3,_0x23888d);_0x3475f2(_0x23888d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 404a5d0..cde7695 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 _0x8438=['get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x2c9d6c,_0xd79778){var _0x2d0e58=function(_0x2fd3a1){while(--_0x2fd3a1){_0x2c9d6c['push'](_0x2c9d6c['shift']());}};_0x2d0e58(++_0xd79778);}(_0x8438,0x1bf));var _0x8843=function(_0x4c859a,_0xc09b66){_0x4c859a=_0x4c859a-0x0;var _0x23cd47=_0x8438[_0x4c859a];return _0x23cd47;};'use strict';var multer=require(_0x8843('0x0'));var util=require(_0x8843('0x1'));var path=require(_0x8843('0x2'));var timeout=require(_0x8843('0x3'));var express=require(_0x8843('0x4'));var router=express['Router']();var fs_extra=require(_0x8843('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8843('0x6'));var config=require(_0x8843('0x7'));var controller=require(_0x8843('0x8'));router[_0x8843('0x9')]('/',auth['isAuthenticated'](),controller[_0x8843('0xa')]);router[_0x8843('0x9')]('/describe',auth[_0x8843('0xb')](),controller['describe']);router['get']('/:id',auth[_0x8843('0xb')](),controller[_0x8843('0xc')]);router[_0x8843('0xd')]('/',auth[_0x8843('0xb')](),controller[_0x8843('0xe')]);router[_0x8843('0xf')](_0x8843('0x10'),auth[_0x8843('0xb')](),controller['update']);router[_0x8843('0x11')](_0x8843('0x10'),auth[_0x8843('0xb')](),controller[_0x8843('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0274=['delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update'];(function(_0x577247,_0x269bff){var _0x5e07d2=function(_0x625269){while(--_0x625269){_0x577247['push'](_0x577247['shift']());}};_0x5e07d2(++_0x269bff);}(_0x0274,0x10c));var _0x4027=function(_0x1c924c,_0x425bb3){_0x1c924c=_0x1c924c-0x0;var _0x30909d=_0x0274[_0x1c924c];return _0x30909d;};'use strict';var multer=require(_0x4027('0x0'));var util=require('util');var path=require(_0x4027('0x1'));var timeout=require(_0x4027('0x2'));var express=require('express');var router=express[_0x4027('0x3')]();var fs_extra=require(_0x4027('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4027('0x5'));var config=require(_0x4027('0x6'));var controller=require(_0x4027('0x7'));router[_0x4027('0x8')]('/',auth[_0x4027('0x9')](),controller[_0x4027('0xa')]);router[_0x4027('0x8')](_0x4027('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4027('0xc'),auth[_0x4027('0x9')](),controller[_0x4027('0xd')]);router[_0x4027('0xe')]('/',auth[_0x4027('0x9')](),controller['create']);router[_0x4027('0xf')]('/:id',auth[_0x4027('0x9')](),controller[_0x4027('0x10')]);router[_0x4027('0x11')](_0x4027('0xc'),auth[_0x4027('0x9')](),controller[_0x4027('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1dd7d76..5160aa8 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 _0x244c=['ENUM','mouseOver','timeout','sequelize','exports','STRING'];(function(_0x11d883,_0x3f04e1){var _0xb4ad6a=function(_0x41be5c){while(--_0x41be5c){_0x11d883['push'](_0x11d883['shift']());}};_0xb4ad6a(++_0x3f04e1);}(_0x244c,0xb7));var _0xc244=function(_0x37b9e7,_0x2bfa2e){_0x37b9e7=_0x37b9e7-0x0;var _0x451f9c=_0x244c[_0x37b9e7];return _0x451f9c;};'use strict';var Sequelize=require(_0xc244('0x0'));module[_0xc244('0x1')]={'name':{'type':Sequelize[_0xc244('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc244('0x3')](_0xc244('0x4'),_0xc244('0x5')),'defaultValue':_0xc244('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdeb8=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0xbbc40e,_0x4297ea){var _0x2abd33=function(_0x4f7ea5){while(--_0x4f7ea5){_0xbbc40e['push'](_0xbbc40e['shift']());}};_0x2abd33(++_0x4297ea);}(_0xdeb8,0xef));var _0x8deb=function(_0x5632d3,_0x2eed0b){_0x5632d3=_0x5632d3-0x0;var _0x2c4ba8=_0xdeb8[_0x5632d3];return _0x2c4ba8;};'use strict';var Sequelize=require(_0x8deb('0x0'));module[_0x8deb('0x1')]={'name':{'type':Sequelize[_0x8deb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8deb('0x3')](_0x8deb('0x4'),_0x8deb('0x5')),'defaultValue':_0x8deb('0x4')},'selector':{'type':Sequelize[_0x8deb('0x2')]},'timeout':{'type':Sequelize[_0x8deb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 683b172..44b6930 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 _0xb91a=['find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options'];(function(_0x473199,_0x17bb65){var _0xf740c4=function(_0x259a1b){while(--_0x259a1b){_0x473199['push'](_0x473199['shift']());}};_0xf740c4(++_0x17bb65);}(_0xb91a,0xf4));var _0xab91=function(_0x50a180,_0x3b8ce3){_0x50a180=_0x50a180-0x0;var _0x53511c=_0xb91a[_0x50a180];return _0x53511c;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab91('0x3'));var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require(_0xab91('0x6'));var path=require(_0xab91('0x7'));var sox=require(_0xab91('0x8'));var csv=require(_0xab91('0x9'));var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require(_0xab91('0xc'));var squel=require('squel');var crypto=require(_0xab91('0xd'));var jsforce=require(_0xab91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab91('0xf'));var Redis=require(_0xab91('0x10'));var authService=require(_0xab91('0x11'));var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];function respondWithStatusCode(_0x283c91,_0x542d3f){_0x542d3f=_0x542d3f||0xcc;return function(_0x4f2af6){if(_0x4f2af6){return _0x283c91[_0xab91('0x1b')](_0x542d3f);}return _0x283c91[_0xab91('0x1c')](_0x542d3f)[_0xab91('0x1d')]();};}function respondWithResult(_0x14bded,_0x14b304){_0x14b304=_0x14b304||0xc8;return function(_0xaa6e77){if(_0xaa6e77){return _0x14bded['status'](_0x14b304)['json'](_0xaa6e77);}};}function respondWithFilteredResult(_0x3c102a,_0x3565c0){return function(_0x1b0d61){if(_0x1b0d61){var _0x2d2699=typeof _0x3565c0[_0xab91('0x1e')]===_0xab91('0x1f')&&typeof _0x3565c0[_0xab91('0x20')]===_0xab91('0x1f');var _0x499daf=_0x1b0d61['count'];var _0x1a0b66=_0x2d2699?0x0:_0x3565c0['offset'];var _0x609b8c=_0x2d2699?_0x1b0d61[_0xab91('0x21')]:_0x3565c0[_0xab91('0x1e')]+_0x3565c0['limit'];var _0xe80258;if(_0x609b8c>=_0x499daf){_0x609b8c=_0x499daf;_0xe80258=0xc8;}else{_0xe80258=0xce;}_0x3c102a['status'](_0xe80258);return _0x3c102a[_0xab91('0x22')]('Content-Range',_0x1a0b66+'-'+_0x609b8c+'/'+_0x499daf)['json'](_0x1b0d61);}return null;};}function patchUpdates(_0x13f065){return function(_0x4c5595){try{jsonpatch[_0xab91('0x23')](_0x4c5595,_0x13f065,!![]);}catch(_0x1f5def){return BPromise[_0xab91('0x24')](_0x1f5def);}return _0x4c5595['save']();};}function saveUpdates(_0x49f4d5,_0x40d29a){return function(_0xdedffe){if(_0xdedffe){return _0xdedffe[_0xab91('0x25')](_0x49f4d5)[_0xab91('0x26')](function(_0x1518e4){return _0x1518e4;});}return null;};}function removeEntity(_0xf8db06,_0x57a7e9){return function(_0x5eca53){if(_0x5eca53){return _0x5eca53[_0xab91('0x27')]()['then'](function(){_0xf8db06['status'](0xcc)[_0xab91('0x1d')]();});}};}function handleEntityNotFound(_0x1a0bc2,_0x5586cd){return function(_0x425d39){if(!_0x425d39){_0x1a0bc2['sendStatus'](0x194);}return _0x425d39;};}function handleError(_0x3fe2fc,_0x400134){_0x400134=_0x400134||0x1f4;return function(_0x5a3c05){logger[_0xab91('0x28')](_0x5a3c05[_0xab91('0x29')]);if(_0x5a3c05[_0xab91('0x2a')]){delete _0x5a3c05[_0xab91('0x2a')];}_0x3fe2fc[_0xab91('0x1c')](_0x400134)[_0xab91('0x2b')](_0x5a3c05);};}exports['show']=function(_0x281ede,_0x4c7a87){var _0x152c51={'raw':!![],'where':{'id':_0x281ede[_0xab91('0x2c')]['id']}},_0x197d0c={};_0x197d0c[_0xab91('0x2d')]=_[_0xab91('0x2e')](db[_0xab91('0x2f')]['rawAttributes']);_0x197d0c[_0xab91('0x30')]=_[_0xab91('0x2e')](_0x281ede[_0xab91('0x30')]);_0x197d0c[_0xab91('0x31')]=_[_0xab91('0x32')](_0x197d0c[_0xab91('0x2d')],_0x197d0c['query']);_0x152c51[_0xab91('0x33')]=_[_0xab91('0x32')](_0x197d0c[_0xab91('0x2d')],qs[_0xab91('0x34')](_0x281ede['query'][_0xab91('0x34')]));_0x152c51[_0xab91('0x33')]=_0x152c51[_0xab91('0x33')]['length']?_0x152c51[_0xab91('0x33')]:_0x197d0c['model'];if(_0x281ede[_0xab91('0x30')][_0xab91('0x35')]){_0x152c51['include']=[{'all':!![]}];}_0x152c51=_[_0xab91('0x36')]({},_0x152c51,_0x281ede[_0xab91('0x37')]);return db[_0xab91('0x2f')][_0xab91('0x38')](_0x152c51)[_0xab91('0x26')](handleEntityNotFound(_0x4c7a87,null))[_0xab91('0x26')](respondWithResult(_0x4c7a87,null))[_0xab91('0x39')](handleError(_0x4c7a87,null));};exports['create']=function(_0x584702,_0x17e5bd){return db[_0xab91('0x2f')][_0xab91('0x3a')](_0x584702[_0xab91('0x3b')],{})[_0xab91('0x26')](respondWithResult(_0x17e5bd,0xc9))[_0xab91('0x39')](handleError(_0x17e5bd,null));};exports[_0xab91('0x25')]=function(_0x6ad869,_0x4787f0){if(_0x6ad869[_0xab91('0x3b')]['id']){delete _0x6ad869[_0xab91('0x3b')]['id'];}return db['ChatProactiveAction'][_0xab91('0x38')]({'where':{'id':_0x6ad869['params']['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x4787f0,null))[_0xab91('0x26')](saveUpdates(_0x6ad869[_0xab91('0x3b')],null))[_0xab91('0x26')](respondWithResult(_0x4787f0,null))['catch'](handleError(_0x4787f0,null));};exports['destroy']=function(_0x4de946,_0x427f27){return db[_0xab91('0x2f')]['find']({'where':{'id':_0x4de946[_0xab91('0x2c')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x427f27,null))[_0xab91('0x26')](removeEntity(_0x427f27,null))[_0xab91('0x39')](handleError(_0x427f27,null));}; \ No newline at end of file +var _0x3d9f=['undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','query','length','includeAll','include','merge','find','catch','create','body','ChatProactiveAction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3d9f[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0xf3d9('0x0'));var rimraf=require(_0xf3d9('0x1'));var zipdir=require(_0xf3d9('0x2'));var jsonpatch=require(_0xf3d9('0x3'));var rp=require(_0xf3d9('0x4'));var moment=require(_0xf3d9('0x5'));var BPromise=require(_0xf3d9('0x6'));var Mustache=require(_0xf3d9('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf3d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3d9('0x9'));var _=require(_0xf3d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3d9('0xb'));var deskjs=require(_0xf3d9('0xc'));var toCsv=require(_0xf3d9('0x8'));var querystring=require(_0xf3d9('0xd'));var Papa=require(_0xf3d9('0xe'));var Redis=require(_0xf3d9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf3d9('0x10'));var hardwareService=require(_0xf3d9('0x11'));var logger=require(_0xf3d9('0x12'))(_0xf3d9('0x13'));var utils=require(_0xf3d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf3d9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b08c8,_0x2eb42c){_0x2eb42c=_0x2eb42c||0xcc;return function(_0x5b91a7){if(_0x5b91a7){return _0x1b08c8['sendStatus'](_0x2eb42c);}return _0x1b08c8[_0xf3d9('0x16')](_0x2eb42c)[_0xf3d9('0x17')]();};}function respondWithResult(_0x898431,_0x15a74e){_0x15a74e=_0x15a74e||0xc8;return function(_0x55e310){if(_0x55e310){return _0x898431[_0xf3d9('0x16')](_0x15a74e)[_0xf3d9('0x18')](_0x55e310);}};}function respondWithFilteredResult(_0x1f3f9b,_0x4a8e70){return function(_0x4033a6){if(_0x4033a6){var _0x1508f2=typeof _0x4a8e70[_0xf3d9('0x19')]===_0xf3d9('0x1a')&&typeof _0x4a8e70[_0xf3d9('0x1b')]==='undefined';var _0x18393a=_0x4033a6[_0xf3d9('0x1c')];var _0x3e2206=_0x1508f2?0x0:_0x4a8e70[_0xf3d9('0x19')];var _0x3386cb=_0x1508f2?_0x4033a6[_0xf3d9('0x1c')]:_0x4a8e70[_0xf3d9('0x19')]+_0x4a8e70[_0xf3d9('0x1b')];var _0x473085;if(_0x3386cb>=_0x18393a){_0x3386cb=_0x18393a;_0x473085=0xc8;}else{_0x473085=0xce;}_0x1f3f9b[_0xf3d9('0x16')](_0x473085);return _0x1f3f9b[_0xf3d9('0x1d')]('Content-Range',_0x3e2206+'-'+_0x3386cb+'/'+_0x18393a)['json'](_0x4033a6);}return null;};}function patchUpdates(_0x3d4945){return function(_0x2145b3){try{jsonpatch[_0xf3d9('0x1e')](_0x2145b3,_0x3d4945,!![]);}catch(_0x22d2f6){return BPromise[_0xf3d9('0x1f')](_0x22d2f6);}return _0x2145b3[_0xf3d9('0x20')]();};}function saveUpdates(_0x207cea,_0x269890){return function(_0x7770dc){if(_0x7770dc){return _0x7770dc[_0xf3d9('0x21')](_0x207cea)[_0xf3d9('0x22')](function(_0x36e868){return _0x36e868;});}return null;};}function removeEntity(_0x3aeec9,_0x5aecca){return function(_0x168ca6){if(_0x168ca6){return _0x168ca6[_0xf3d9('0x23')]()[_0xf3d9('0x22')](function(){_0x3aeec9['status'](0xcc)[_0xf3d9('0x17')]();});}};}function handleEntityNotFound(_0x289d62,_0x26f206){return function(_0x21c846){if(!_0x21c846){_0x289d62[_0xf3d9('0x24')](0x194);}return _0x21c846;};}function handleError(_0x3e1c4d,_0x41a6ac){_0x41a6ac=_0x41a6ac||0x1f4;return function(_0x240c44){logger[_0xf3d9('0x25')](_0x240c44['stack']);if(_0x240c44[_0xf3d9('0x26')]){delete _0x240c44['name'];}_0x3e1c4d[_0xf3d9('0x16')](_0x41a6ac)[_0xf3d9('0x27')](_0x240c44);};}exports[_0xf3d9('0x28')]=function(_0x3d9c23,_0x4e336a){var _0x1d51ce={'raw':!![],'where':{'id':_0x3d9c23[_0xf3d9('0x29')]['id']}},_0x367b60={};_0x367b60['model']=_[_0xf3d9('0x2a')](db['ChatProactiveAction'][_0xf3d9('0x2b')]);_0x367b60['query']=_[_0xf3d9('0x2a')](_0x3d9c23['query']);_0x367b60[_0xf3d9('0x2c')]=_[_0xf3d9('0x2d')](_0x367b60[_0xf3d9('0x2e')],_0x367b60['query']);_0x1d51ce[_0xf3d9('0x2f')]=_['intersection'](_0x367b60[_0xf3d9('0x2e')],qs[_0xf3d9('0x30')](_0x3d9c23[_0xf3d9('0x31')][_0xf3d9('0x30')]));_0x1d51ce[_0xf3d9('0x2f')]=_0x1d51ce[_0xf3d9('0x2f')][_0xf3d9('0x32')]?_0x1d51ce[_0xf3d9('0x2f')]:_0x367b60[_0xf3d9('0x2e')];if(_0x3d9c23[_0xf3d9('0x31')][_0xf3d9('0x33')]){_0x1d51ce[_0xf3d9('0x34')]=[{'all':!![]}];}_0x1d51ce=_[_0xf3d9('0x35')]({},_0x1d51ce,_0x3d9c23['options']);return db['ChatProactiveAction'][_0xf3d9('0x36')](_0x1d51ce)[_0xf3d9('0x22')](handleEntityNotFound(_0x4e336a,null))[_0xf3d9('0x22')](respondWithResult(_0x4e336a,null))[_0xf3d9('0x37')](handleError(_0x4e336a,null));};exports[_0xf3d9('0x38')]=function(_0x3b98b5,_0x14fa3c){return db['ChatProactiveAction'][_0xf3d9('0x38')](_0x3b98b5[_0xf3d9('0x39')],{})['then'](respondWithResult(_0x14fa3c,0xc9))[_0xf3d9('0x37')](handleError(_0x14fa3c,null));};exports['update']=function(_0x25ef2d,_0x164c27){if(_0x25ef2d[_0xf3d9('0x39')]['id']){delete _0x25ef2d[_0xf3d9('0x39')]['id'];}return db[_0xf3d9('0x3a')]['find']({'where':{'id':_0x25ef2d[_0xf3d9('0x29')]['id']}})[_0xf3d9('0x22')](handleEntityNotFound(_0x164c27,null))[_0xf3d9('0x22')](saveUpdates(_0x25ef2d[_0xf3d9('0x39')],null))['then'](respondWithResult(_0x164c27,null))[_0xf3d9('0x37')](handleError(_0x164c27,null));};exports[_0xf3d9('0x23')]=function(_0x3f6b21,_0x43d598){return db['ChatProactiveAction'][_0xf3d9('0x36')]({'where':{'id':_0x3f6b21['params']['id']}})[_0xf3d9('0x22')](handleEntityNotFound(_0x43d598,null))[_0xf3d9('0x22')](removeEntity(_0x43d598,null))[_0xf3d9('0x37')](handleError(_0x43d598,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 70b0d70..bd913f9 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 _0x444e=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x444e,0x113));var _0xe444=function(_0x11487c,_0x3bc8bd){_0x11487c=_0x11487c-0x0;var _0x400d0a=_0x444e[_0x11487c];return _0x400d0a;};'use strict';var _=require(_0xe444('0x0'));var util=require(_0xe444('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe444('0x2'));var BPromise=require(_0xe444('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe444('0x4'));var rimraf=require(_0xe444('0x5'));var config=require(_0xe444('0x6'));var attributes=require(_0xe444('0x7'));module[_0xe444('0x8')]=function(_0x59b39e,_0x54dbcd){return _0x59b39e['define'](_0xe444('0x9'),attributes,{'tableName':_0xe444('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd447=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path','./chatProactiveAction.attributes','exports','define'];(function(_0x41b4e9,_0x51a253){var _0x36d5ca=function(_0x5db9d0){while(--_0x5db9d0){_0x41b4e9['push'](_0x41b4e9['shift']());}};_0x36d5ca(++_0x51a253);}(_0xd447,0x1e1));var _0x7d44=function(_0x41a12c,_0x362888){_0x41a12c=_0x41a12c-0x0;var _0x13d8d0=_0xd447[_0x41a12c];return _0x13d8d0;};'use strict';var _=require('lodash');var util=require(_0x7d44('0x0'));var logger=require(_0x7d44('0x1'))(_0x7d44('0x2'));var moment=require(_0x7d44('0x3'));var BPromise=require(_0x7d44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d44('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d44('0x6'));module[_0x7d44('0x7')]=function(_0x4b7b6d,_0x2fed56){return _0x4b7b6d[_0x7d44('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x7d44('0x9'),'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 c97ca95..2ed3127 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 _0xb65a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','code','error','message','lodash','util','bluebird','randomstring'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0xb65a,0xce));var _0xab65=function(_0x206aca,_0x13b8c0){_0x206aca=_0x206aca-0x0;var _0x55a3d8=_0xb65a[_0x206aca];return _0x55a3d8;};'use strict';var _=require(_0xab65('0x0'));var util=require(_0xab65('0x1'));var moment=require('moment');var BPromise=require(_0xab65('0x2'));var rs=require(_0xab65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab65('0x4'))['db'];var utils=require(_0xab65('0x5'));var logger=require(_0xab65('0x6'))(_0xab65('0x7'));var config=require(_0xab65('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xab65('0x9')][_0xab65('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57cd52,_0x2d77c5,_0x29b3cc){return new BPromise(function(_0x254f09,_0x10b225){return client[_0xab65('0xb')](_0x57cd52,_0x29b3cc)[_0xab65('0xc')](function(_0x51c602){logger[_0xab65('0xd')](_0xab65('0xe'),_0x2d77c5,_0xab65('0xf'));logger[_0xab65('0x10')](_0xab65('0x11'),_0x2d77c5,_0xab65('0xf'),JSON['stringify'](_0x51c602));if(_0x51c602['error']){if(_0x51c602['error'][_0xab65('0x12')]===0x1f4){logger[_0xab65('0x13')](_0xab65('0xe'),_0x2d77c5,_0x51c602[_0xab65('0x13')][_0xab65('0x14')]);return _0x10b225(_0x51c602['error'][_0xab65('0x14')]);}logger[_0xab65('0x13')](_0xab65('0xe'),_0x2d77c5,_0x51c602[_0xab65('0x13')][_0xab65('0x14')]);return _0x254f09(_0x51c602[_0xab65('0x13')][_0xab65('0x14')]);}else{logger[_0xab65('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d77c5,_0xab65('0xf'));_0x254f09(_0x51c602['result'][_0xab65('0x14')]);}})['catch'](function(_0x5dd672){logger[_0xab65('0x13')](_0xab65('0xe'),_0x2d77c5,_0x5dd672);_0x10b225(_0x5dd672);});});} \ No newline at end of file +var _0x1e50=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5076e9,_0x22454a){var _0x2a0de1=function(_0x5b6895){while(--_0x5b6895){_0x5076e9['push'](_0x5076e9['shift']());}};_0x2a0de1(++_0x22454a);}(_0x1e50,0x1d4));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x01e5('0x0'));var util=require(_0x01e5('0x1'));var moment=require(_0x01e5('0x2'));var BPromise=require(_0x01e5('0x3'));var rs=require(_0x01e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01e5('0x6'))('rpc');var config=require(_0x01e5('0x7'));var jayson=require(_0x01e5('0x8'));var client=jayson[_0x01e5('0x9')][_0x01e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43284e,_0x32d502,_0x19af63){return new BPromise(function(_0x5860cd,_0x5257f5){return client[_0x01e5('0xb')](_0x43284e,_0x19af63)[_0x01e5('0xc')](function(_0x511973){logger[_0x01e5('0xd')](_0x01e5('0xe'),_0x32d502,_0x01e5('0xf'));logger[_0x01e5('0x10')](_0x01e5('0x11'),_0x32d502,_0x01e5('0xf'),JSON['stringify'](_0x511973));if(_0x511973[_0x01e5('0x12')]){if(_0x511973[_0x01e5('0x12')][_0x01e5('0x13')]===0x1f4){logger[_0x01e5('0x12')](_0x01e5('0xe'),_0x32d502,_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);return _0x5257f5(_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);}logger['error'](_0x01e5('0xe'),_0x32d502,_0x511973[_0x01e5('0x12')][_0x01e5('0x14')]);return _0x5860cd(_0x511973[_0x01e5('0x12')]['message']);}else{logger['info'](_0x01e5('0xe'),_0x32d502,_0x01e5('0xf'));_0x5860cd(_0x511973[_0x01e5('0x15')][_0x01e5('0x14')]);}})['catch'](function(_0x494cf7){logger[_0x01e5('0x12')](_0x01e5('0xe'),_0x32d502,_0x494cf7);_0x5257f5(_0x494cf7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 81a2c99..917b28c 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 _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x506c19,_0x349cac){var _0x2b6cd6=function(_0x3734a2){while(--_0x3734a2){_0x506c19['push'](_0x506c19['shift']());}};_0x2b6cd6(++_0x349cac);}(_0x53ec,0x192));var _0xc53e=function(_0x1daaa4,_0x2a13f8){_0x1daaa4=_0x1daaa4-0x0;var _0x4d6a11=_0x53ec[_0x1daaa4];return _0x4d6a11;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x179c19,_0x43a64a){var _0x3cdfa0=function(_0x5d40d4){while(--_0x5d40d4){_0x179c19['push'](_0x179c19['shift']());}};_0x3cdfa0(++_0x43a64a);}(_0x032e,0x124));var _0xe032=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x032e[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 51d6aae..95e9fa2 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 _0x0875=['exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x2f54e5,_0x217602){var _0x5dc4ff=function(_0x4db1d4){while(--_0x4db1d4){_0x2f54e5['push'](_0x2f54e5['shift']());}};_0x5dc4ff(++_0x217602);}(_0x0875,0x1a4));var _0x5087=function(_0x53c746,_0x6fd40a){_0x53c746=_0x53c746-0x0;var _0x313923=_0x0875[_0x53c746];return _0x313923;};'use strict';var Sequelize=require('sequelize');module[_0x5087('0x0')]={'name':{'type':Sequelize[_0x5087('0x1')],'unique':_0x5087('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5087('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5087('0x3')](_0x5087('0x4'),_0x5087('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xe611=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x353627,_0xf01069){var _0x426c5b=function(_0x3d1428){while(--_0x3d1428){_0x353627['push'](_0x353627['shift']());}};_0x426c5b(++_0xf01069);}(_0xe611,0x135));var _0x1e61=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe611[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x1e61('0x0'));module[_0x1e61('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e61('0x2')]},'timeout':{'type':Sequelize[_0x1e61('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1e61('0x4'),_0x1e61('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 22017eb..d052e5d 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 _0xebcf=['removeTeams','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','update','then','destroy','get','ChatQueues','UserProfileResource','end','name','send','map','rawAttributes','fieldName','key','getOptions','ChatQueue','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','where','ChatQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','Team','pick','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction'];(function(_0x245f27,_0x5ba472){var _0x3b33df=function(_0x5a10ca){while(--_0x5a10ca){_0x245f27['push'](_0x245f27['shift']());}};_0x3b33df(++_0x5ba472);}(_0xebcf,0x17c));var _0xfebc=function(_0x5066c9,_0x15bd53){_0x5066c9=_0x5066c9-0x0;var _0x581f44=_0xebcf[_0x5066c9];return _0x581f44;};'use strict';var BPromise=require(_0xfebc('0x0'));var util=require('util');var _=require(_0xfebc('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xfebc('0x2'));var logger=require(_0xfebc('0x3'))(_0xfebc('0x4'));var config=require(_0xfebc('0x5'));var db=require(_0xfebc('0x6'))['db'];config['redis']=_['defaults'](config[_0xfebc('0x7')],{'host':_0xfebc('0x8'),'port':0x18eb});var socket=require(_0xfebc('0x9'))(new Redis(config['redis']));require(_0xfebc('0xa'))[_0xfebc('0xb')](socket);function respondWithStatusCode(_0x48b8f8,_0x8aad22){_0x8aad22=_0x8aad22||0xcc;return function(_0x341351){if(_0x341351){return _0x48b8f8[_0xfebc('0xc')](_0x8aad22);}return _0x48b8f8[_0xfebc('0xd')](_0x8aad22)['end']();};}function respondWithResult(_0x52a4f9,_0x43585e){_0x43585e=_0x43585e||0xc8;return function(_0x23b27f){if(_0x23b27f){return _0x52a4f9['status'](_0x43585e)[_0xfebc('0xe')](_0x23b27f);}};}function respondWithFilteredResult(_0x54b18c,_0x3f9c1c){return function(_0x1430b2){if(_0x1430b2){var _0x22a034=typeof _0x3f9c1c[_0xfebc('0xf')]==='undefined'&&typeof _0x3f9c1c[_0xfebc('0x10')]===_0xfebc('0x11');var _0x1aa068=_0x1430b2[_0xfebc('0x12')];var _0x224ef1=_0x22a034?0x0:_0x3f9c1c[_0xfebc('0xf')];var _0x45ec32=_0x22a034?_0x1430b2[_0xfebc('0x12')]:_0x3f9c1c[_0xfebc('0xf')]+_0x3f9c1c['limit'];var _0x5e28c3;if(_0x45ec32>=_0x1aa068){_0x45ec32=_0x1aa068;_0x5e28c3=0xc8;}else{_0x5e28c3=0xce;}_0x54b18c['status'](_0x5e28c3);return _0x54b18c[_0xfebc('0x13')]('Content-Range',_0x224ef1+'-'+_0x45ec32+'/'+_0x1aa068)[_0xfebc('0xe')](_0x1430b2);}return null;};}function saveUpdates(_0xae898){return function(_0x1b4923){if(_0x1b4923){return _0x1b4923[_0xfebc('0x14')](_0xae898)[_0xfebc('0x15')](function(_0x218ade){return _0x218ade;});}return null;};}function removeEntity(_0x4f0ad5){return function(_0x8030fa){if(_0x8030fa){return _0x8030fa[_0xfebc('0x16')]()[_0xfebc('0x15')](function(){var _0x5e78fc=_0x8030fa[_0xfebc('0x17')]({'plain':!![]});var _0xd91267=_0xfebc('0x18');return db[_0xfebc('0x19')][_0xfebc('0x16')]({'where':{'type':_0xd91267,'resourceId':_0x5e78fc['id']}})[_0xfebc('0x15')](function(){return _0x8030fa;});})[_0xfebc('0x15')](function(){_0x4f0ad5[_0xfebc('0xd')](0xcc)[_0xfebc('0x1a')]();});}};}function handleEntityNotFound(_0x5d2cfb){return function(_0x8772f3){if(!_0x8772f3){_0x5d2cfb['sendStatus'](0x194);}return _0x8772f3;};}function handleError(_0x47ff13,_0x4fe36e){_0x4fe36e=_0x4fe36e||0x1f4;return function(_0xfecb79){logger['error'](_0xfecb79['stack']);if(_0xfecb79[_0xfebc('0x1b')]){delete _0xfecb79[_0xfebc('0x1b')];}_0x47ff13[_0xfebc('0xd')](_0x4fe36e)[_0xfebc('0x1c')](_0xfecb79);};}exports['index']=function(_0xfe0a39,_0x499233){var _0x27df3e={};var _0xb1b884={'count':0x0,'rows':[]};var _0x33094e=_[_0xfebc('0x1d')](db['ChatQueue'][_0xfebc('0x1e')],function(_0x239f29){return{'name':_0x239f29[_0xfebc('0x1f')],'type':_0x239f29['type'][_0xfebc('0x20')]};});_0x27df3e=qs[_0xfebc('0x21')](_0x33094e,_0xfe0a39);var _0x5202cd={'where':_0x27df3e['where']};return db[_0xfebc('0x22')][_0xfebc('0x12')](_0x5202cd)['then'](function(_0x2fb864){_0xb1b884[_0xfebc('0x12')]=_0x2fb864;_0x27df3e[_0xfebc('0x23')]=qs[_0xfebc('0x23')](_0xfe0a39[_0xfebc('0x24')]);return db['ChatQueue'][_0xfebc('0x25')](_0x27df3e);})[_0xfebc('0x15')](function(_0x37ee43){_0xb1b884[_0xfebc('0x26')]=_0x37ee43;return _0xb1b884;})[_0xfebc('0x15')](respondWithFilteredResult(_0x499233,_0x27df3e))[_0xfebc('0x27')](handleError(_0x499233,null));};exports[_0xfebc('0x28')]=function(_0x1e4f16,_0x2aaf25){var _0x215335={'raw':!![],'where':{'id':_0x1e4f16[_0xfebc('0x29')]['id']}},_0x327562={};_0x327562['model']=_['keys'](db['ChatQueue']['rawAttributes']);_0x327562['query']=_[_0xfebc('0x2a')](_0x1e4f16[_0xfebc('0x24')]);_0x327562[_0xfebc('0x2b')]=_[_0xfebc('0x2c')](_0x327562[_0xfebc('0x2d')],_0x327562[_0xfebc('0x24')]);_0x215335[_0xfebc('0x2e')]=_[_0xfebc('0x2c')](_0x327562['model'],qs[_0xfebc('0x2f')](_0x1e4f16['query']['fields']));_0x215335['attributes']=_0x215335['attributes'][_0xfebc('0x30')]?_0x215335[_0xfebc('0x2e')]:_0x327562[_0xfebc('0x2d')];if(_0x1e4f16['query'][_0xfebc('0x31')]){_0x215335[_0xfebc('0x23')]=[{'all':!![]}];}_0x215335=_[_0xfebc('0x32')]({},_0x215335,_0x1e4f16[_0xfebc('0x33')]);return db[_0xfebc('0x22')][_0xfebc('0x34')](_0x215335)['then'](handleEntityNotFound(_0x2aaf25,null))[_0xfebc('0x15')](respondWithResult(_0x2aaf25,null))[_0xfebc('0x27')](handleError(_0x2aaf25,null));};exports[_0xfebc('0x35')]=function(_0x3f183c,_0x58cc8b){return db[_0xfebc('0x22')]['create'](_0x3f183c[_0xfebc('0x36')],{})[_0xfebc('0x15')](function(_0x3bc30e){var _0x4197cc=_0x3f183c['user'][_0xfebc('0x17')]({'plain':!![]});if(!_0x4197cc)throw new Error(_0xfebc('0x37'));if(_0x4197cc[_0xfebc('0x38')]==='user'){var _0x2e97ed=_0x3bc30e[_0xfebc('0x17')]({'plain':!![]});var _0x2c77f7=_0xfebc('0x18');return db['UserProfileSection'][_0xfebc('0x34')]({'where':{'name':_0x2c77f7,'userProfileId':_0x4197cc[_0xfebc('0x39')]},'raw':!![]})[_0xfebc('0x15')](function(_0x8a8078){if(_0x8a8078&&_0x8a8078[_0xfebc('0x3a')]===0x0){return db[_0xfebc('0x19')][_0xfebc('0x35')]({'name':_0x2e97ed['name'],'resourceId':_0x2e97ed['id'],'type':_0x8a8078[_0xfebc('0x1b')],'sectionId':_0x8a8078['id']},{})[_0xfebc('0x15')](function(){return _0x3bc30e;});}else{return _0x3bc30e;}})['catch'](function(_0x17bbdc){logger[_0xfebc('0x3b')](_0xfebc('0x3c'),_0x17bbdc);throw _0x17bbdc;});}return _0x3bc30e;})[_0xfebc('0x15')](respondWithResult(_0x58cc8b,0xc9))[_0xfebc('0x27')](handleError(_0x58cc8b,null));};exports[_0xfebc('0x14')]=function(_0x4fa230,_0x56c255){if(_0x4fa230[_0xfebc('0x36')]['id']){delete _0x4fa230[_0xfebc('0x36')]['id'];}return db[_0xfebc('0x22')][_0xfebc('0x34')]({'where':{'id':_0x4fa230[_0xfebc('0x29')]['id']}})['then'](handleEntityNotFound(_0x56c255,null))[_0xfebc('0x15')](saveUpdates(_0x4fa230[_0xfebc('0x36')],null))[_0xfebc('0x15')](respondWithResult(_0x56c255,null))[_0xfebc('0x27')](handleError(_0x56c255,null));};exports[_0xfebc('0x16')]=function(_0x23d911,_0x38a0e5){return db['ChatQueue'][_0xfebc('0x34')]({'where':{'id':_0x23d911['params']['id']}})['then'](handleEntityNotFound(_0x38a0e5,null))[_0xfebc('0x15')](removeEntity(_0x38a0e5,null))[_0xfebc('0x27')](handleError(_0x38a0e5,null));};exports[_0xfebc('0x3d')]=function(_0x187792,_0x320084){return db['ChatQueue'][_0xfebc('0x3d')]()[_0xfebc('0x15')](respondWithResult(_0x320084,null))['catch'](handleError(_0x320084,null));};exports[_0xfebc('0x3e')]=function(_0x447881,_0x4fc550){var _0x601c83={'raw':!![],'where':{}},_0x5cc1b0={},_0x2d06be;return db[_0xfebc('0x22')][_0xfebc('0x3f')]({'where':{'id':_0x447881[_0xfebc('0x29')]['id']}})[_0xfebc('0x15')](handleEntityNotFound(_0x4fc550,null))[_0xfebc('0x15')](function(_0x10a83b){if(_0x10a83b){_0x2d06be=_0x10a83b[_0xfebc('0x17')]({'plain':!![]});_0x5cc1b0[_0xfebc('0x2d')]=_[_0xfebc('0x2a')](db[_0xfebc('0x40')]['rawAttributes']);_0x5cc1b0[_0xfebc('0x24')]=_[_0xfebc('0x2a')](_0x447881[_0xfebc('0x24')]);_0x5cc1b0['filters']=_[_0xfebc('0x2c')](_0x5cc1b0[_0xfebc('0x2d')],_0x5cc1b0[_0xfebc('0x24')]);_0x601c83['attributes']=_['intersection'](_0x5cc1b0[_0xfebc('0x2d')],qs[_0xfebc('0x2f')](_0x447881[_0xfebc('0x24')][_0xfebc('0x2f')]));_0x601c83[_0xfebc('0x2e')]=_0x601c83[_0xfebc('0x2e')]['length']?_0x601c83[_0xfebc('0x2e')]:_0x5cc1b0[_0xfebc('0x2d')];if(!_0x447881[_0xfebc('0x24')][_0xfebc('0x41')](_0xfebc('0x42'))){_0x601c83[_0xfebc('0x10')]=qs[_0xfebc('0x10')](_0x447881['query']['limit']);_0x601c83[_0xfebc('0xf')]=qs[_0xfebc('0xf')](_0x447881[_0xfebc('0x24')]['offset']);}_0x601c83[_0xfebc('0x43')]=qs[_0xfebc('0x44')](_0x447881[_0xfebc('0x24')]['sort']);_0x601c83[_0xfebc('0x45')]=qs['filters'](_['pick'](_0x447881['query'],_0x5cc1b0['filters']));_0x601c83['where'][_0xfebc('0x46')]=_0x10a83b['id'];if(_0x447881[_0xfebc('0x24')][_0xfebc('0x47')]){_0x601c83[_0xfebc('0x45')]=_['merge'](_0x601c83['where'],{'$or':_[_0xfebc('0x1d')](_0x601c83['attributes'],function(_0xdfd2af){var _0x3d11ac={};_0x3d11ac[_0xdfd2af]={'$like':'%'+_0x447881['query'][_0xfebc('0x47')]+'%'};return _0x3d11ac;})});}_0x601c83=_[_0xfebc('0x32')]({},_0x601c83,_0x447881[_0xfebc('0x33')]);return db['UserChatQueue'][_0xfebc('0x25')](_0x601c83);}})[_0xfebc('0x15')](function(_0x343878){if(_0x343878){return db[_0xfebc('0x48')][_0xfebc('0x49')]({'where':{'id':_[_0xfebc('0x1d')](_0x343878,_0xfebc('0x4a')),'role':_0xfebc('0x4b')},'attributes':['id',_0xfebc('0x1b'),'chatPause',_0xfebc('0x4c'),_0xfebc('0x4d')]});}})[_0xfebc('0x15')](function(_0x135550){if(_0x135550){return{'count':_0x135550['count'],'rows':_[_0xfebc('0x1d')](_0x135550[_0xfebc('0x26')],function(_0x374846){return{'membername':_0x374846[_0xfebc('0x1b')],'UserId':_0x374846['id'],'queue_name':_0x2d06be[_0xfebc('0x1b')],'ChatQueueId':_0x2d06be['id'],'interface':util['format'](_0xfebc('0x4e'),_0xfebc('0x4f'),_0x374846[_0xfebc('0x1b')]),'penalty':0x0,'paused':_0x374846[_0xfebc('0x50')],'createdAt':_0x374846[_0xfebc('0x4d')],'updatedAt':_0x374846['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4fc550,_0x601c83))[_0xfebc('0x27')](handleError(_0x4fc550,null));};exports[_0xfebc('0x51')]=function(_0x5a7dbc,_0x360e04){var _0x44f1db={};var _0x50ef82={};var _0xe4bf50;var _0x5652a0;return db[_0xfebc('0x22')][_0xfebc('0x3f')]({'where':{'id':_0x5a7dbc[_0xfebc('0x29')]['id']}})['then'](handleEntityNotFound(_0x360e04,null))[_0xfebc('0x15')](function(_0x3250d8){if(_0x3250d8){_0xe4bf50=_0x3250d8;_0x50ef82[_0xfebc('0x2d')]=_['keys'](db[_0xfebc('0x52')][_0xfebc('0x1e')]);_0x50ef82[_0xfebc('0x24')]=_[_0xfebc('0x2a')](_0x5a7dbc['query']);_0x50ef82[_0xfebc('0x2b')]=_[_0xfebc('0x2c')](_0x50ef82[_0xfebc('0x2d')],_0x50ef82['query']);_0x44f1db[_0xfebc('0x2e')]=_['intersection'](_0x50ef82[_0xfebc('0x2d')],qs['fields'](_0x5a7dbc[_0xfebc('0x24')][_0xfebc('0x2f')]));_0x44f1db[_0xfebc('0x2e')]=_0x44f1db[_0xfebc('0x2e')][_0xfebc('0x30')]?_0x44f1db['attributes']:_0x50ef82['model'];_0x44f1db['order']=qs[_0xfebc('0x44')](_0x5a7dbc[_0xfebc('0x24')][_0xfebc('0x44')]);_0x44f1db[_0xfebc('0x45')]=qs[_0xfebc('0x2b')](_[_0xfebc('0x53')](_0x5a7dbc[_0xfebc('0x24')],_0x50ef82[_0xfebc('0x2b')]));if(_0x5a7dbc[_0xfebc('0x24')][_0xfebc('0x47')]){_0x44f1db[_0xfebc('0x45')]=_[_0xfebc('0x32')](_0x44f1db[_0xfebc('0x45')],{'$or':_[_0xfebc('0x1d')](_0x44f1db['attributes'],function(_0x2932ca){var _0x1a72fd={};_0x1a72fd[_0x2932ca]={'$like':'%'+_0x5a7dbc[_0xfebc('0x24')][_0xfebc('0x47')]+'%'};return _0x1a72fd;})});}_0x44f1db=_[_0xfebc('0x32')]({},_0x44f1db,_0x5a7dbc[_0xfebc('0x33')]);return _0xe4bf50[_0xfebc('0x51')](_0x44f1db);}})[_0xfebc('0x15')](function(_0x530c6d){if(_0x530c6d){_0x5652a0=_0x530c6d[_0xfebc('0x30')];if(!_0x5a7dbc[_0xfebc('0x24')]['hasOwnProperty'](_0xfebc('0x42'))){_0x44f1db['limit']=qs[_0xfebc('0x10')](_0x5a7dbc[_0xfebc('0x24')][_0xfebc('0x10')]);_0x44f1db['offset']=qs[_0xfebc('0xf')](_0x5a7dbc['query'][_0xfebc('0xf')]);}return _0xe4bf50[_0xfebc('0x51')](_0x44f1db);}})[_0xfebc('0x15')](function(_0x191812){if(_0x191812){return _0x191812?{'count':_0x5652a0,'rows':_0x191812}:null;}})['then'](respondWithResult(_0x360e04,null))[_0xfebc('0x27')](handleError(_0x360e04,null));};exports['addTeams']=function(_0x2a9309,_0x3df1a5){var _0x4d12a0=_0x2a9309['body'][_0xfebc('0x54')];return db['Team'][_0xfebc('0x25')]({'where':{'id':_0x4d12a0},'attributes':['id'],'include':[{'model':db[_0xfebc('0x48')],'as':_0xfebc('0x55'),'attributes':['id',_0xfebc('0x1b'),'online',_0xfebc('0x56'),_0xfebc('0x57')],'raw':!![]}]})[_0xfebc('0x15')](function(_0x2c5726){if(_0x2c5726){var _0x288ed5=_[_0xfebc('0x58')](_0x2c5726,function(_0x2c4a9f){var _0x4ee7e4=_0x2c4a9f[_0xfebc('0x17')]({'plain':!![]});return _0x4ee7e4['Agents'];});return db[_0xfebc('0x22')][_0xfebc('0x34')]({'where':{'id':_0x2a9309[_0xfebc('0x29')]['id']}})[_0xfebc('0x15')](function(_0x3f3e31){return db[_0xfebc('0x59')]['transaction'](function(_0x43542a){return _0x3f3e31[_0xfebc('0x5a')](_0x4d12a0,{'transaction':_0x43542a})[_0xfebc('0x15')](function(){return BPromise[_0xfebc('0x5b')](_0x288ed5,function(_0x3e46c1){return db['UserChatQueue'][_0xfebc('0x5c')]({'where':{'UserId':_0x3e46c1['id'],'ChatQueueId':_0x2a9309[_0xfebc('0x29')]['id']},'transaction':_0x43542a});});})[_0xfebc('0x15')](function(){_0x288ed5[_0xfebc('0x5d')](function(_0x5da2e9){socket[_0xfebc('0x5e')](_0xfebc('0x5f'),{'UserId':_0x5da2e9['id'],'ChatQueueId':_0x3f3e31['id']});});});});});}})['then'](respondWithStatusCode(_0x3df1a5,null))['catch'](handleError(_0x3df1a5,null));};exports['removeTeams']=function(_0x17f13a,_0x3ec549){return db[_0xfebc('0x52')]['findAll']({'where':{'id':_0x17f13a[_0xfebc('0x24')][_0xfebc('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfebc('0x55'),'attributes':['id'],'raw':!![]}]})[_0xfebc('0x15')](handleEntityNotFound(_0x3ec549,null))[_0xfebc('0x15')](function(_0x3e2958){var _0x5d66cd=_[_0xfebc('0x1d')](_0x3e2958,'id');var _0x106b5d=[];var _0x28a836=[];var _0x508aef=squel[_0xfebc('0x60')]();_0x508aef[_0xfebc('0x61')](_0xfebc('0x62'))['from'](_0xfebc('0x63'),'tq')[_0xfebc('0x64')](_0xfebc('0x65'),'ut',_0xfebc('0x66'))[_0xfebc('0x45')](_0xfebc('0x67'),_0x17f13a[_0xfebc('0x29')]['id']);for(var _0x246c21=0x0;_0x246c21<_0x3e2958['length'];_0x246c21+=0x1){let _0x49d54c=_0x3e2958[_0x246c21];for(var _0x39a03a=0x0;_0x39a03a<_0x49d54c[_0xfebc('0x55')][_0xfebc('0x30')];_0x39a03a+=0x1){let _0x202f8e=_0x49d54c['Agents'][_0x39a03a];var _0x5b7fff=_0x508aef[_0xfebc('0x68')]();_0x5b7fff[_0xfebc('0x45')](_0xfebc('0x69'),_0x202f8e['id']);_0x28a836[_0xfebc('0x6a')](db[_0xfebc('0x59')][_0xfebc('0x24')](_0x5b7fff['toString'](),{'type':db[_0xfebc('0x59')][_0xfebc('0x6b')][_0xfebc('0x6c')]})[_0xfebc('0x15')](function(_0x89fcca){if(_0x89fcca[_0xfebc('0x30')]===0x1){return _0x202f8e['id'];}else{var _0xff9c22=_[_0xfebc('0x6d')](_['map'](_0x89fcca,_0xfebc('0x6e')),function(_0xc79ba9){return _[_0xfebc('0x6f')](_0x5d66cd,_0xc79ba9);});if(_0xff9c22){return _0x202f8e['id'];}}}));}}return BPromise['all'](_0x28a836)[_0xfebc('0x15')](function(_0x14c099){_0x106b5d=_(_0x106b5d)[_0xfebc('0x70')](_0x14c099)[_0xfebc('0x71')]()[_0xfebc('0x72')]();return db[_0xfebc('0x22')][_0xfebc('0x34')]({'where':{'id':_0x17f13a[_0xfebc('0x29')]['id']}})[_0xfebc('0x15')](function(_0x5996b6){return db[_0xfebc('0x59')][_0xfebc('0x73')](function(_0x5ba916){return _0x5996b6[_0xfebc('0x74')](_0x17f13a['query'][_0xfebc('0x54')],{'transaction':_0x5ba916})[_0xfebc('0x15')](function(){if(!_['isEmpty'](_0x106b5d)){return _0x5996b6['removeAgents'](_0x106b5d,{'transaction':_0x5ba916});}})['then'](function(){_0x106b5d['forEach'](function(_0x5a323c){socket[_0xfebc('0x5e')]('userChatQueue:remove',{'UserId':_0x5a323c,'ChatQueueId':_0x5996b6['id']});});});});});});})[_0xfebc('0x15')](respondWithStatusCode(_0x3ec549,null))[_0xfebc('0x27')](handleError(_0x3ec549,null));};exports[_0xfebc('0x75')]=function(_0x35e7c4,_0x57140a){return db[_0xfebc('0x22')][_0xfebc('0x34')]({'where':{'id':_0x35e7c4[_0xfebc('0x29')]['id']}})[_0xfebc('0x15')](handleEntityNotFound(_0x57140a,null))[_0xfebc('0x15')](function(_0x5b3a3f){if(_0x5b3a3f){return _0x5b3a3f['addAgents'](_0x35e7c4['body'][_0xfebc('0x54')],_[_0xfebc('0x76')](_0x35e7c4[_0xfebc('0x36')],[_0xfebc('0x54'),'id'])||{})[_0xfebc('0x77')](function(_0x5f30d5){for(var _0x462be2=0x0;_0x462be2<_0x35e7c4['body']['ids']['length'];_0x462be2+=0x1){socket['emit'](_0xfebc('0x5f'),{'UserId':Number(_0x35e7c4[_0xfebc('0x36')][_0xfebc('0x54')][_0x462be2]),'ChatQueueId':Number(_0x35e7c4[_0xfebc('0x29')]['id'])});}return _0x5f30d5;});}})['then'](respondWithResult(_0x57140a,null))[_0xfebc('0x27')](handleError(_0x57140a,null));};exports[_0xfebc('0x78')]=function(_0x4b0a7b,_0x42c894){return db[_0xfebc('0x22')][_0xfebc('0x34')]({'where':{'id':_0x4b0a7b[_0xfebc('0x29')]['id']}})['then'](handleEntityNotFound(_0x42c894,null))[_0xfebc('0x15')](function(_0x4e54f0){if(_0x4e54f0){return _0x4e54f0[_0xfebc('0x78')](_0x4b0a7b[_0xfebc('0x24')][_0xfebc('0x54')])[_0xfebc('0x15')](function(){if(_[_0xfebc('0x79')](_0x4b0a7b[_0xfebc('0x24')][_0xfebc('0x54')])){for(var _0x4c3de3=0x0;_0x4c3de3<_0x4b0a7b[_0xfebc('0x24')]['ids'][_0xfebc('0x30')];_0x4c3de3+=0x1){socket[_0xfebc('0x5e')](_0xfebc('0x7a'),{'UserId':Number(_0x4b0a7b[_0xfebc('0x24')]['ids'][_0x4c3de3]),'ChatQueueId':Number(_0x4b0a7b[_0xfebc('0x29')]['id'])});}}else{socket[_0xfebc('0x5e')](_0xfebc('0x7a'),{'UserId':Number(_0x4b0a7b['query'][_0xfebc('0x54')]),'ChatQueueId':Number(_0x4b0a7b[_0xfebc('0x29')]['id'])});}});}})[_0xfebc('0x15')](respondWithStatusCode(_0x42c894,null))[_0xfebc('0x27')](handleError(_0x42c894,null));};exports[_0xfebc('0x7b')]=function(_0x59a2c1,_0x2ffb46){var _0x81d0ac={};var _0xde0ed2={};var _0x3a0bac;var _0xe98918;return db[_0xfebc('0x22')][_0xfebc('0x3f')]({'where':{'id':_0x59a2c1['params']['id']}})[_0xfebc('0x15')](handleEntityNotFound(_0x2ffb46,null))[_0xfebc('0x15')](function(_0x34496d){if(_0x34496d){_0x3a0bac=_0x34496d;_0xde0ed2[_0xfebc('0x2d')]=_['keys'](db[_0xfebc('0x48')][_0xfebc('0x1e')]);_0xde0ed2[_0xfebc('0x24')]=_[_0xfebc('0x2a')](_0x59a2c1[_0xfebc('0x24')]);_0xde0ed2[_0xfebc('0x2b')]=_[_0xfebc('0x2c')](_0xde0ed2[_0xfebc('0x2d')],_0xde0ed2[_0xfebc('0x24')]);_0x81d0ac[_0xfebc('0x2e')]=_['intersection'](_0xde0ed2['model'],qs[_0xfebc('0x2f')](_0x59a2c1[_0xfebc('0x24')][_0xfebc('0x2f')]));_0x81d0ac[_0xfebc('0x2e')]=_0x81d0ac[_0xfebc('0x2e')][_0xfebc('0x30')]?_0x81d0ac['attributes']:_0xde0ed2[_0xfebc('0x2d')];_0x81d0ac[_0xfebc('0x43')]=qs['sort'](_0x59a2c1[_0xfebc('0x24')]['sort']);_0x81d0ac[_0xfebc('0x45')]=qs[_0xfebc('0x2b')](_[_0xfebc('0x53')](_0x59a2c1[_0xfebc('0x24')],_0xde0ed2[_0xfebc('0x2b')]));if(_0x59a2c1['query']['filter']){_0x81d0ac[_0xfebc('0x45')]=_[_0xfebc('0x32')](_0x81d0ac['where'],{'$or':_['map'](_0x81d0ac[_0xfebc('0x2e')],function(_0x1fa1c2){var _0x39ad36={};_0x39ad36[_0x1fa1c2]={'$like':'%'+_0x59a2c1['query'][_0xfebc('0x47')]+'%'};return _0x39ad36;})});}_0x81d0ac=_[_0xfebc('0x32')]({},_0x81d0ac,_0x59a2c1[_0xfebc('0x33')]);return _0x3a0bac[_0xfebc('0x7b')](_0x81d0ac);}})['then'](function(_0x527d18){if(_0x527d18){_0xe98918=_0x527d18['length'];if(!_0x59a2c1['query'][_0xfebc('0x41')](_0xfebc('0x42'))){_0x81d0ac[_0xfebc('0x10')]=qs[_0xfebc('0x10')](_0x59a2c1[_0xfebc('0x24')][_0xfebc('0x10')]);_0x81d0ac[_0xfebc('0xf')]=qs['offset'](_0x59a2c1[_0xfebc('0x24')][_0xfebc('0xf')]);}return _0x3a0bac['getAgents'](_0x81d0ac);}})[_0xfebc('0x15')](function(_0x49f43c){if(_0x49f43c){return _0x49f43c?{'count':_0xe98918,'rows':_0x49f43c}:null;}})[_0xfebc('0x15')](respondWithResult(_0x2ffb46,null))[_0xfebc('0x27')](handleError(_0x2ffb46,null));}; \ No newline at end of file +var _0x289a=['params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','find','create','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./chatQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','get','ChatQueues','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x289a,0x156));var _0xa289=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x289a[_0x3c22e0];return _0x215811;};'use strict';var BPromise=require('bluebird');var util=require(_0xa289('0x0'));var _=require(_0xa289('0x1'));var squel=require(_0xa289('0x2'));var Redis=require(_0xa289('0x3'));var qs=require(_0xa289('0x4'));var logger=require(_0xa289('0x5'))(_0xa289('0x6'));var config=require(_0xa289('0x7'));var db=require(_0xa289('0x8'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa289('0x9'))(new Redis(config[_0xa289('0xa')]));require(_0xa289('0xb'))[_0xa289('0xc')](socket);function respondWithStatusCode(_0x451c6f,_0x475932){_0x475932=_0x475932||0xcc;return function(_0x57b220){if(_0x57b220){return _0x451c6f[_0xa289('0xd')](_0x475932);}return _0x451c6f[_0xa289('0xe')](_0x475932)[_0xa289('0xf')]();};}function respondWithResult(_0x3bc67a,_0x2512ef){_0x2512ef=_0x2512ef||0xc8;return function(_0x4bcfaa){if(_0x4bcfaa){return _0x3bc67a[_0xa289('0xe')](_0x2512ef)['json'](_0x4bcfaa);}};}function respondWithFilteredResult(_0x34fc45,_0x53a3f1){return function(_0x1e75e5){if(_0x1e75e5){var _0x3c9556=typeof _0x53a3f1['offset']===_0xa289('0x10')&&typeof _0x53a3f1['limit']===_0xa289('0x10');var _0x397e8b=_0x1e75e5[_0xa289('0x11')];var _0x569d8b=_0x3c9556?0x0:_0x53a3f1[_0xa289('0x12')];var _0x5ed4dd=_0x3c9556?_0x1e75e5[_0xa289('0x11')]:_0x53a3f1[_0xa289('0x12')]+_0x53a3f1[_0xa289('0x13')];var _0x107610;if(_0x5ed4dd>=_0x397e8b){_0x5ed4dd=_0x397e8b;_0x107610=0xc8;}else{_0x107610=0xce;}_0x34fc45['status'](_0x107610);return _0x34fc45[_0xa289('0x14')](_0xa289('0x15'),_0x569d8b+'-'+_0x5ed4dd+'/'+_0x397e8b)[_0xa289('0x16')](_0x1e75e5);}return null;};}function saveUpdates(_0xd96b86){return function(_0x45ff1b){if(_0x45ff1b){return _0x45ff1b[_0xa289('0x17')](_0xd96b86)[_0xa289('0x18')](function(_0x3e738e){return _0x3e738e;});}return null;};}function removeEntity(_0x536e01){return function(_0x5a1d20){if(_0x5a1d20){return _0x5a1d20[_0xa289('0x19')]()['then'](function(){var _0x50d32e=_0x5a1d20[_0xa289('0x1a')]({'plain':!![]});var _0x365897=_0xa289('0x1b');return db['UserProfileResource']['destroy']({'where':{'type':_0x365897,'resourceId':_0x50d32e['id']}})[_0xa289('0x18')](function(){return _0x5a1d20;});})[_0xa289('0x18')](function(){_0x536e01[_0xa289('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a8c20){return function(_0x75bf34){if(!_0x75bf34){_0x7a8c20['sendStatus'](0x194);}return _0x75bf34;};}function handleError(_0x965927,_0x440689){_0x440689=_0x440689||0x1f4;return function(_0x3f0a7f){logger[_0xa289('0x1c')](_0x3f0a7f['stack']);if(_0x3f0a7f[_0xa289('0x1d')]){delete _0x3f0a7f[_0xa289('0x1d')];}_0x965927[_0xa289('0xe')](_0x440689)[_0xa289('0x1e')](_0x3f0a7f);};}exports[_0xa289('0x1f')]=function(_0x3cec16,_0x159645){var _0x48036d={};var _0x3defa8={'count':0x0,'rows':[]};var _0xe677d9=_[_0xa289('0x20')](db[_0xa289('0x21')][_0xa289('0x22')],function(_0x107440){return{'name':_0x107440[_0xa289('0x23')],'type':_0x107440[_0xa289('0x24')][_0xa289('0x25')]};});_0x48036d=qs[_0xa289('0x26')](_0xe677d9,_0x3cec16);var _0x23cc3d={'where':_0x48036d[_0xa289('0x27')]};return db['ChatQueue'][_0xa289('0x11')](_0x23cc3d)[_0xa289('0x18')](function(_0x40b19c){_0x3defa8['count']=_0x40b19c;_0x48036d[_0xa289('0x28')]=qs[_0xa289('0x28')](_0x3cec16[_0xa289('0x29')]);return db['ChatQueue'][_0xa289('0x2a')](_0x48036d);})['then'](function(_0x2b5f4b){_0x3defa8[_0xa289('0x2b')]=_0x2b5f4b;return _0x3defa8;})['then'](respondWithFilteredResult(_0x159645,_0x48036d))[_0xa289('0x2c')](handleError(_0x159645,null));};exports['show']=function(_0x227988,_0x1b4fb0){var _0x357f5c={'raw':!![],'where':{'id':_0x227988[_0xa289('0x2d')]['id']}},_0x727adf={};_0x727adf[_0xa289('0x2e')]=_[_0xa289('0x2f')](db[_0xa289('0x21')][_0xa289('0x22')]);_0x727adf['query']=_[_0xa289('0x2f')](_0x227988[_0xa289('0x29')]);_0x727adf[_0xa289('0x30')]=_['intersection'](_0x727adf[_0xa289('0x2e')],_0x727adf[_0xa289('0x29')]);_0x357f5c[_0xa289('0x31')]=_[_0xa289('0x32')](_0x727adf['model'],qs[_0xa289('0x33')](_0x227988[_0xa289('0x29')][_0xa289('0x33')]));_0x357f5c[_0xa289('0x31')]=_0x357f5c[_0xa289('0x31')]['length']?_0x357f5c[_0xa289('0x31')]:_0x727adf[_0xa289('0x2e')];if(_0x227988[_0xa289('0x29')][_0xa289('0x34')]){_0x357f5c['include']=[{'all':!![]}];}_0x357f5c=_[_0xa289('0x35')]({},_0x357f5c,_0x227988[_0xa289('0x36')]);return db['ChatQueue'][_0xa289('0x37')](_0x357f5c)[_0xa289('0x18')](handleEntityNotFound(_0x1b4fb0,null))[_0xa289('0x18')](respondWithResult(_0x1b4fb0,null))[_0xa289('0x2c')](handleError(_0x1b4fb0,null));};exports[_0xa289('0x38')]=function(_0x3bbc47,_0x5b0c35){return db['ChatQueue'][_0xa289('0x38')](_0x3bbc47['body'],{})['then'](function(_0x247b54){var _0x5d7c66=_0x3bbc47[_0xa289('0x39')][_0xa289('0x1a')]({'plain':!![]});if(!_0x5d7c66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d7c66[_0xa289('0x3a')]===_0xa289('0x39')){var _0x388c7b=_0x247b54['get']({'plain':!![]});var _0x3a521c=_0xa289('0x1b');return db[_0xa289('0x3b')][_0xa289('0x37')]({'where':{'name':_0x3a521c,'userProfileId':_0x5d7c66['userProfileId']},'raw':!![]})[_0xa289('0x18')](function(_0x485b11){if(_0x485b11&&_0x485b11[_0xa289('0x3c')]===0x0){return db[_0xa289('0x3d')][_0xa289('0x38')]({'name':_0x388c7b[_0xa289('0x1d')],'resourceId':_0x388c7b['id'],'type':_0x485b11[_0xa289('0x1d')],'sectionId':_0x485b11['id']},{})[_0xa289('0x18')](function(){return _0x247b54;});}else{return _0x247b54;}})['catch'](function(_0x4e809b){logger[_0xa289('0x1c')](_0xa289('0x3e'),_0x4e809b);throw _0x4e809b;});}return _0x247b54;})[_0xa289('0x18')](respondWithResult(_0x5b0c35,0xc9))['catch'](handleError(_0x5b0c35,null));};exports[_0xa289('0x17')]=function(_0x183be3,_0xb47c14){if(_0x183be3['body']['id']){delete _0x183be3['body']['id'];}return db[_0xa289('0x21')]['find']({'where':{'id':_0x183be3[_0xa289('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb47c14,null))[_0xa289('0x18')](saveUpdates(_0x183be3[_0xa289('0x3f')],null))[_0xa289('0x18')](respondWithResult(_0xb47c14,null))[_0xa289('0x2c')](handleError(_0xb47c14,null));};exports['destroy']=function(_0x3e2f0a,_0x4d0633){return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x3e2f0a[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x4d0633,null))[_0xa289('0x18')](removeEntity(_0x4d0633,null))[_0xa289('0x2c')](handleError(_0x4d0633,null));};exports[_0xa289('0x40')]=function(_0x1eda3c,_0x582e99){return db[_0xa289('0x21')][_0xa289('0x40')]()['then'](respondWithResult(_0x582e99,null))[_0xa289('0x2c')](handleError(_0x582e99,null));};exports[_0xa289('0x41')]=function(_0x3cafc4,_0x5b950e){var _0x20a443={'raw':!![],'where':{}},_0x48aff1={},_0x37b2c4;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x3cafc4[_0xa289('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5b950e,null))[_0xa289('0x18')](function(_0x50a1aa){if(_0x50a1aa){_0x37b2c4=_0x50a1aa['get']({'plain':!![]});_0x48aff1['model']=_[_0xa289('0x2f')](db[_0xa289('0x43')]['rawAttributes']);_0x48aff1[_0xa289('0x29')]=_[_0xa289('0x2f')](_0x3cafc4[_0xa289('0x29')]);_0x48aff1['filters']=_[_0xa289('0x32')](_0x48aff1['model'],_0x48aff1[_0xa289('0x29')]);_0x20a443['attributes']=_[_0xa289('0x32')](_0x48aff1[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x3cafc4[_0xa289('0x29')]['fields']));_0x20a443[_0xa289('0x31')]=_0x20a443[_0xa289('0x31')][_0xa289('0x44')]?_0x20a443['attributes']:_0x48aff1['model'];if(!_0x3cafc4[_0xa289('0x29')][_0xa289('0x45')](_0xa289('0x46'))){_0x20a443[_0xa289('0x13')]=qs[_0xa289('0x13')](_0x3cafc4[_0xa289('0x29')]['limit']);_0x20a443['offset']=qs[_0xa289('0x12')](_0x3cafc4['query']['offset']);}_0x20a443[_0xa289('0x47')]=qs[_0xa289('0x48')](_0x3cafc4[_0xa289('0x29')][_0xa289('0x48')]);_0x20a443[_0xa289('0x27')]=qs[_0xa289('0x30')](_[_0xa289('0x49')](_0x3cafc4['query'],_0x48aff1[_0xa289('0x30')]));_0x20a443[_0xa289('0x27')][_0xa289('0x4a')]=_0x50a1aa['id'];if(_0x3cafc4['query']['filter']){_0x20a443['where']=_[_0xa289('0x35')](_0x20a443['where'],{'$or':_['map'](_0x20a443[_0xa289('0x31')],function(_0x2da4c6){var _0x5d9cef={};_0x5d9cef[_0x2da4c6]={'$like':'%'+_0x3cafc4[_0xa289('0x29')][_0xa289('0x4b')]+'%'};return _0x5d9cef;})});}_0x20a443=_[_0xa289('0x35')]({},_0x20a443,_0x3cafc4[_0xa289('0x36')]);return db[_0xa289('0x43')]['findAll'](_0x20a443);}})['then'](function(_0xb779c9){if(_0xb779c9){return db['User'][_0xa289('0x4c')]({'where':{'id':_[_0xa289('0x20')](_0xb779c9,'UserId'),'role':_0xa289('0x4d')},'attributes':['id','name',_0xa289('0x4e'),_0xa289('0x4f'),'createdAt']});}})[_0xa289('0x18')](function(_0xd4562f){if(_0xd4562f){return{'count':_0xd4562f['count'],'rows':_[_0xa289('0x20')](_0xd4562f[_0xa289('0x2b')],function(_0x5952da){return{'membername':_0x5952da[_0xa289('0x1d')],'UserId':_0x5952da['id'],'queue_name':_0x37b2c4[_0xa289('0x1d')],'ChatQueueId':_0x37b2c4['id'],'interface':util[_0xa289('0x50')](_0xa289('0x51'),_0xa289('0x52'),_0x5952da['name']),'penalty':0x0,'paused':_0x5952da[_0xa289('0x4e')],'createdAt':_0x5952da[_0xa289('0x53')],'updatedAt':_0x5952da['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa289('0x18')](respondWithFilteredResult(_0x5b950e,_0x20a443))[_0xa289('0x2c')](handleError(_0x5b950e,null));};exports['getTeams']=function(_0x53ca40,_0x5d24b6){var _0x20a94f={};var _0x38d015={};var _0xf4e0aa;var _0xb41e4c;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x53ca40[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x5d24b6,null))[_0xa289('0x18')](function(_0x4622b7){if(_0x4622b7){_0xf4e0aa=_0x4622b7;_0x38d015[_0xa289('0x2e')]=_['keys'](db[_0xa289('0x54')]['rawAttributes']);_0x38d015[_0xa289('0x29')]=_[_0xa289('0x2f')](_0x53ca40[_0xa289('0x29')]);_0x38d015[_0xa289('0x30')]=_['intersection'](_0x38d015[_0xa289('0x2e')],_0x38d015[_0xa289('0x29')]);_0x20a94f[_0xa289('0x31')]=_['intersection'](_0x38d015[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x53ca40[_0xa289('0x29')][_0xa289('0x33')]));_0x20a94f[_0xa289('0x31')]=_0x20a94f[_0xa289('0x31')][_0xa289('0x44')]?_0x20a94f[_0xa289('0x31')]:_0x38d015[_0xa289('0x2e')];_0x20a94f[_0xa289('0x47')]=qs[_0xa289('0x48')](_0x53ca40[_0xa289('0x29')][_0xa289('0x48')]);_0x20a94f[_0xa289('0x27')]=qs['filters'](_[_0xa289('0x49')](_0x53ca40[_0xa289('0x29')],_0x38d015['filters']));if(_0x53ca40[_0xa289('0x29')]['filter']){_0x20a94f[_0xa289('0x27')]=_[_0xa289('0x35')](_0x20a94f[_0xa289('0x27')],{'$or':_[_0xa289('0x20')](_0x20a94f[_0xa289('0x31')],function(_0x4bd070){var _0x4051fe={};_0x4051fe[_0x4bd070]={'$like':'%'+_0x53ca40[_0xa289('0x29')][_0xa289('0x4b')]+'%'};return _0x4051fe;})});}_0x20a94f=_[_0xa289('0x35')]({},_0x20a94f,_0x53ca40[_0xa289('0x36')]);return _0xf4e0aa['getTeams'](_0x20a94f);}})[_0xa289('0x18')](function(_0x3ad149){if(_0x3ad149){_0xb41e4c=_0x3ad149[_0xa289('0x44')];if(!_0x53ca40['query'][_0xa289('0x45')](_0xa289('0x46'))){_0x20a94f[_0xa289('0x13')]=qs[_0xa289('0x13')](_0x53ca40[_0xa289('0x29')][_0xa289('0x13')]);_0x20a94f[_0xa289('0x12')]=qs[_0xa289('0x12')](_0x53ca40[_0xa289('0x29')][_0xa289('0x12')]);}return _0xf4e0aa[_0xa289('0x55')](_0x20a94f);}})['then'](function(_0x44b164){if(_0x44b164){return _0x44b164?{'count':_0xb41e4c,'rows':_0x44b164}:null;}})['then'](respondWithResult(_0x5d24b6,null))['catch'](handleError(_0x5d24b6,null));};exports[_0xa289('0x56')]=function(_0x22cd62,_0x5a0151){var _0x316c60=_0x22cd62[_0xa289('0x3f')][_0xa289('0x57')];return db[_0xa289('0x54')][_0xa289('0x2a')]({'where':{'id':_0x316c60},'attributes':['id'],'include':[{'model':db[_0xa289('0x58')],'as':_0xa289('0x59'),'attributes':['id',_0xa289('0x1d'),_0xa289('0x5a'),_0xa289('0x5b'),_0xa289('0x5c')],'raw':!![]}]})[_0xa289('0x18')](function(_0x48716c){if(_0x48716c){var _0x40ae46=_[_0xa289('0x5d')](_0x48716c,function(_0x4f3b4d){var _0x32370c=_0x4f3b4d['get']({'plain':!![]});return _0x32370c[_0xa289('0x59')];});return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x22cd62['params']['id']}})[_0xa289('0x18')](function(_0x4b0eb1){return db[_0xa289('0x5e')][_0xa289('0x5f')](function(_0x519969){return _0x4b0eb1[_0xa289('0x56')](_0x316c60,{'transaction':_0x519969})[_0xa289('0x18')](function(){return BPromise[_0xa289('0x60')](_0x40ae46,function(_0x79151d){return db['UserChatQueue'][_0xa289('0x61')]({'where':{'UserId':_0x79151d['id'],'ChatQueueId':_0x22cd62[_0xa289('0x2d')]['id']},'transaction':_0x519969});});})[_0xa289('0x18')](function(){_0x40ae46[_0xa289('0x62')](function(_0x4514e2){socket['emit'](_0xa289('0x63'),{'UserId':_0x4514e2['id'],'ChatQueueId':_0x4b0eb1['id']});});});});});}})[_0xa289('0x18')](respondWithStatusCode(_0x5a0151,null))[_0xa289('0x2c')](handleError(_0x5a0151,null));};exports[_0xa289('0x64')]=function(_0x363ec7,_0x2ba687){return db[_0xa289('0x54')][_0xa289('0x2a')]({'where':{'id':_0x363ec7[_0xa289('0x29')][_0xa289('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa289('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ba687,null))['then'](function(_0x2dbd1b){var _0x43a7ef=_[_0xa289('0x20')](_0x2dbd1b,'id');var _0x3adf86=[];var _0x563b8f=[];var _0x1aaaad=squel[_0xa289('0x65')]();_0x1aaaad['field'](_0xa289('0x66'))[_0xa289('0x67')](_0xa289('0x68'),'tq')[_0xa289('0x69')](_0xa289('0x6a'),'ut',_0xa289('0x6b'))[_0xa289('0x27')](_0xa289('0x6c'),_0x363ec7[_0xa289('0x2d')]['id']);for(var _0x1458f7=0x0;_0x1458f7<_0x2dbd1b[_0xa289('0x44')];_0x1458f7+=0x1){let _0x389831=_0x2dbd1b[_0x1458f7];for(var _0x572403=0x0;_0x572403<_0x389831[_0xa289('0x59')][_0xa289('0x44')];_0x572403+=0x1){let _0x4521fe=_0x389831['Agents'][_0x572403];var _0x31124b=_0x1aaaad[_0xa289('0x6d')]();_0x31124b[_0xa289('0x27')](_0xa289('0x6e'),_0x4521fe['id']);_0x563b8f[_0xa289('0x6f')](db[_0xa289('0x5e')][_0xa289('0x29')](_0x31124b[_0xa289('0x70')](),{'type':db[_0xa289('0x5e')][_0xa289('0x71')]['SELECT']})[_0xa289('0x18')](function(_0x413c22){if(_0x413c22[_0xa289('0x44')]===0x1){return _0x4521fe['id'];}else{var _0x2a539c=_[_0xa289('0x72')](_[_0xa289('0x20')](_0x413c22,_0xa289('0x73')),function(_0x4a95d9){return _[_0xa289('0x74')](_0x43a7ef,_0x4a95d9);});if(_0x2a539c){return _0x4521fe['id'];}}}));}}return BPromise[_0xa289('0x75')](_0x563b8f)[_0xa289('0x18')](function(_0x50c32a){_0x3adf86=_(_0x3adf86)['union'](_0x50c32a)[_0xa289('0x76')]()[_0xa289('0x77')]();return db['ChatQueue'][_0xa289('0x37')]({'where':{'id':_0x363ec7[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](function(_0x3430ce){return db[_0xa289('0x5e')]['transaction'](function(_0x331cf8){return _0x3430ce[_0xa289('0x64')](_0x363ec7['query'][_0xa289('0x57')],{'transaction':_0x331cf8})[_0xa289('0x18')](function(){if(!_[_0xa289('0x78')](_0x3adf86)){return _0x3430ce[_0xa289('0x79')](_0x3adf86,{'transaction':_0x331cf8});}})[_0xa289('0x18')](function(){_0x3adf86['forEach'](function(_0x2c9ad3){socket[_0xa289('0x7a')](_0xa289('0x7b'),{'UserId':_0x2c9ad3,'ChatQueueId':_0x3430ce['id']});});});});});});})[_0xa289('0x18')](respondWithStatusCode(_0x2ba687,null))[_0xa289('0x2c')](handleError(_0x2ba687,null));};exports[_0xa289('0x7c')]=function(_0x3b6d46,_0x5d4f64){return db[_0xa289('0x21')][_0xa289('0x37')]({'where':{'id':_0x3b6d46[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x5d4f64,null))['then'](function(_0x1d003f){if(_0x1d003f){return _0x1d003f[_0xa289('0x7c')](_0x3b6d46[_0xa289('0x3f')]['ids'],_[_0xa289('0x7d')](_0x3b6d46[_0xa289('0x3f')],[_0xa289('0x57'),'id'])||{})[_0xa289('0x7e')](function(_0x251f37){for(var _0x412fc5=0x0;_0x412fc5<_0x3b6d46[_0xa289('0x3f')]['ids'][_0xa289('0x44')];_0x412fc5+=0x1){socket[_0xa289('0x7a')](_0xa289('0x63'),{'UserId':Number(_0x3b6d46[_0xa289('0x3f')][_0xa289('0x57')][_0x412fc5]),'ChatQueueId':Number(_0x3b6d46[_0xa289('0x2d')]['id'])});}return _0x251f37;});}})[_0xa289('0x18')](respondWithResult(_0x5d4f64,null))[_0xa289('0x2c')](handleError(_0x5d4f64,null));};exports[_0xa289('0x79')]=function(_0x100916,_0x586472){return db['ChatQueue'][_0xa289('0x37')]({'where':{'id':_0x100916[_0xa289('0x2d')]['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x586472,null))[_0xa289('0x18')](function(_0x373442){if(_0x373442){return _0x373442[_0xa289('0x79')](_0x100916[_0xa289('0x29')]['ids'])['then'](function(){if(_[_0xa289('0x7f')](_0x100916[_0xa289('0x29')][_0xa289('0x57')])){for(var _0x20791c=0x0;_0x20791c<_0x100916[_0xa289('0x29')][_0xa289('0x57')]['length'];_0x20791c+=0x1){socket['emit'](_0xa289('0x7b'),{'UserId':Number(_0x100916[_0xa289('0x29')]['ids'][_0x20791c]),'ChatQueueId':Number(_0x100916[_0xa289('0x2d')]['id'])});}}else{socket[_0xa289('0x7a')](_0xa289('0x7b'),{'UserId':Number(_0x100916[_0xa289('0x29')][_0xa289('0x57')]),'ChatQueueId':Number(_0x100916[_0xa289('0x2d')]['id'])});}});}})[_0xa289('0x18')](respondWithStatusCode(_0x586472,null))[_0xa289('0x2c')](handleError(_0x586472,null));};exports[_0xa289('0x80')]=function(_0x8d57fc,_0x2b2f0a){var _0x41a758={};var _0x3006e3={};var _0x92294d;var _0x3eef5f;return db[_0xa289('0x21')][_0xa289('0x42')]({'where':{'id':_0x8d57fc['params']['id']}})[_0xa289('0x18')](handleEntityNotFound(_0x2b2f0a,null))[_0xa289('0x18')](function(_0x484d00){if(_0x484d00){_0x92294d=_0x484d00;_0x3006e3[_0xa289('0x2e')]=_['keys'](db[_0xa289('0x58')]['rawAttributes']);_0x3006e3['query']=_[_0xa289('0x2f')](_0x8d57fc['query']);_0x3006e3[_0xa289('0x30')]=_[_0xa289('0x32')](_0x3006e3['model'],_0x3006e3['query']);_0x41a758['attributes']=_[_0xa289('0x32')](_0x3006e3[_0xa289('0x2e')],qs[_0xa289('0x33')](_0x8d57fc[_0xa289('0x29')]['fields']));_0x41a758[_0xa289('0x31')]=_0x41a758[_0xa289('0x31')]['length']?_0x41a758[_0xa289('0x31')]:_0x3006e3['model'];_0x41a758['order']=qs[_0xa289('0x48')](_0x8d57fc['query'][_0xa289('0x48')]);_0x41a758[_0xa289('0x27')]=qs[_0xa289('0x30')](_[_0xa289('0x49')](_0x8d57fc[_0xa289('0x29')],_0x3006e3[_0xa289('0x30')]));if(_0x8d57fc[_0xa289('0x29')][_0xa289('0x4b')]){_0x41a758[_0xa289('0x27')]=_[_0xa289('0x35')](_0x41a758[_0xa289('0x27')],{'$or':_[_0xa289('0x20')](_0x41a758[_0xa289('0x31')],function(_0x41425f){var _0x1f72e7={};_0x1f72e7[_0x41425f]={'$like':'%'+_0x8d57fc['query'][_0xa289('0x4b')]+'%'};return _0x1f72e7;})});}_0x41a758=_['merge']({},_0x41a758,_0x8d57fc['options']);return _0x92294d[_0xa289('0x80')](_0x41a758);}})['then'](function(_0xa86769){if(_0xa86769){_0x3eef5f=_0xa86769[_0xa289('0x44')];if(!_0x8d57fc['query'][_0xa289('0x45')](_0xa289('0x46'))){_0x41a758[_0xa289('0x13')]=qs['limit'](_0x8d57fc[_0xa289('0x29')]['limit']);_0x41a758[_0xa289('0x12')]=qs['offset'](_0x8d57fc[_0xa289('0x29')][_0xa289('0x12')]);}return _0x92294d[_0xa289('0x80')](_0x41a758);}})[_0xa289('0x18')](function(_0x3ea82c){if(_0x3ea82c){return _0x3ea82c?{'count':_0x3eef5f,'rows':_0x3ea82c}:null;}})[_0xa289('0x18')](respondWithResult(_0x2b2f0a,null))['catch'](handleError(_0x2b2f0a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1387c30..de4a0ae 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 _0xe678=['hasOwnProperty','hook','exports','events','ChatQueue','setMaxListeners','emit'];(function(_0x53973c,_0x1f910a){var _0x2fe204=function(_0x4f4817){while(--_0x4f4817){_0x53973c['push'](_0x53973c['shift']());}};_0x2fe204(++_0x1f910a);}(_0xe678,0x13e));var _0x8e67=function(_0x22a3b7,_0xac8090){_0x22a3b7=_0x22a3b7-0x0;var _0x30845c=_0xe678[_0x22a3b7];return _0x30845c;};'use strict';var EventEmitter=require(_0x8e67('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x8e67('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8e67('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x504f83){return function(_0x3cffb6,_0xd08dd0,_0x53cf8e){ChatQueueEvents['emit'](_0x504f83+':'+_0x3cffb6['id'],_0x3cffb6);ChatQueueEvents[_0x8e67('0x3')](_0x504f83,_0x3cffb6);_0x53cf8e(null);};}for(var e in events){if(events[_0x8e67('0x4')](e)){var event=events[e];ChatQueue[_0x8e67('0x5')](e,emitEvent(event));}}module[_0x8e67('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x6108=['ChatQueue','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x4b0733,_0x2324ed){var _0x1d5fdc=function(_0x2fb672){while(--_0x2fb672){_0x4b0733['push'](_0x4b0733['shift']());}};_0x1d5fdc(++_0x2324ed);}(_0x6108,0xbc));var _0x8610=function(_0x3fc430,_0x17dcdf){_0x3fc430=_0x3fc430-0x0;var _0x59a28d=_0x6108[_0x3fc430];return _0x59a28d;};'use strict';var EventEmitter=require(_0x8610('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x8610('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8610('0x2')](0x0);var events={'afterCreate':_0x8610('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x142cb5){return function(_0x42741d,_0x54802f,_0x4aa00f){ChatQueueEvents[_0x8610('0x4')](_0x142cb5+':'+_0x42741d['id'],_0x42741d);ChatQueueEvents[_0x8610('0x4')](_0x142cb5,_0x42741d);_0x4aa00f(null);};}for(var e in events){if(events[_0x8610('0x5')](e)){var event=events[e];ChatQueue[_0x8610('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 264e22c..869899e 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 _0x9992=['api','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x4d37b5,_0x57ed54){var _0x53d9fa=function(_0x1841ff){while(--_0x1841ff){_0x4d37b5['push'](_0x4d37b5['shift']());}};_0x53d9fa(++_0x57ed54);}(_0x9992,0x19d));var _0x2999=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x9992[_0x3c6dce];return _0x1450e9;};'use strict';var _=require(_0x2999('0x0'));var util=require(_0x2999('0x1'));var logger=require(_0x2999('0x2'))(_0x2999('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2999('0x4'));var fs=require('fs');var path=require(_0x2999('0x5'));var rimraf=require(_0x2999('0x6'));var config=require(_0x2999('0x7'));var attributes=require(_0x2999('0x8'));module[_0x2999('0x9')]=function(_0x455af9,_0xff07c8){return _0x455af9[_0x2999('0xa')](_0x2999('0xb'),attributes,{'tableName':_0x2999('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2a6=['./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x241ec1,_0x2fac9e){var _0x3de936=function(_0x5f3ce5){while(--_0x5f3ce5){_0x241ec1['push'](_0x241ec1['shift']());}};_0x3de936(++_0x2fac9e);}(_0xe2a6,0xcb));var _0x6e2a=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xe2a6[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0x6e2a('0x0'));var util=require(_0x6e2a('0x1'));var logger=require(_0x6e2a('0x2'))('api');var moment=require(_0x6e2a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e2a('0x4'));var fs=require('fs');var path=require(_0x6e2a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e2a('0x6'));module[_0x6e2a('0x7')]=function(_0x21c8c9,_0x5a7340){return _0x21c8c9[_0x6e2a('0x8')](_0x6e2a('0x9'),attributes,{'tableName':_0x6e2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 8876221..dabf809 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 _0x129f=['client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','findAll','raw','options','where','attributes','limit','map','include','model','catch','ShowChatQueue','ChatQueue','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2567c9,_0x473e4b){var _0x486b55=function(_0x43a6ed){while(--_0x43a6ed){_0x2567c9['push'](_0x2567c9['shift']());}};_0x486b55(++_0x473e4b);}(_0x129f,0x13f));var _0xf129=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x129f[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xf129('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf129('0x1'));var rs=require(_0xf129('0x2'));var fs=require('fs');var Redis=require(_0xf129('0x3'));var db=require(_0xf129('0x4'))['db'];var utils=require(_0xf129('0x5'));var logger=require(_0xf129('0x6'))(_0xf129('0x7'));var config=require(_0xf129('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf129('0x9')][_0xf129('0xa')]({'port':0x232a});config[_0xf129('0xb')]=_[_0xf129('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf129('0xd'))(new Redis(config['redis']));require(_0xf129('0xe'))[_0xf129('0xf')](socket);function respondWithRpcPromise(_0x31f877,_0x200e06,_0x6171ed){return new BPromise(function(_0x4fed21,_0x3e5859){return client[_0xf129('0x10')](_0x31f877,_0x6171ed)[_0xf129('0x11')](function(_0x5d721f){logger[_0xf129('0x12')](_0xf129('0x13'),_0x200e06,_0xf129('0x14'));logger['debug'](_0xf129('0x15'),_0x200e06,_0xf129('0x14'),JSON[_0xf129('0x16')](_0x5d721f));if(_0x5d721f['error']){if(_0x5d721f[_0xf129('0x17')][_0xf129('0x18')]===0x1f4){logger['error'](_0xf129('0x13'),_0x200e06,_0x5d721f['error'][_0xf129('0x19')]);return _0x3e5859(_0x5d721f[_0xf129('0x17')]['message']);}logger['error'](_0xf129('0x13'),_0x200e06,_0x5d721f[_0xf129('0x17')]['message']);return _0x4fed21(_0x5d721f[_0xf129('0x17')][_0xf129('0x19')]);}else{logger['info'](_0xf129('0x13'),_0x200e06,_0xf129('0x14'));_0x4fed21(_0x5d721f[_0xf129('0x1a')][_0xf129('0x19')]);}})['catch'](function(_0x54f122){logger[_0xf129('0x17')](_0xf129('0x13'),_0x200e06,_0x54f122);_0x3e5859(_0x54f122);});});}exports[_0xf129('0x1b')]=function(_0xbaa68c){var _0x3620b9=this;return new Promise(function(_0x336dbc,_0xbd9489){return db['ChatQueue'][_0xf129('0x1c')]({'raw':_0xbaa68c['options']?_0xbaa68c['options'][_0xf129('0x1d')]===undefined?!![]:![]:!![],'where':_0xbaa68c[_0xf129('0x1e')]?_0xbaa68c[_0xf129('0x1e')][_0xf129('0x1f')]||null:null,'attributes':_0xbaa68c[_0xf129('0x1e')]?_0xbaa68c[_0xf129('0x1e')][_0xf129('0x20')]||null:null,'limit':_0xbaa68c[_0xf129('0x1e')]?_0xbaa68c['options'][_0xf129('0x21')]||null:null,'include':_0xbaa68c[_0xf129('0x1e')]?_0xbaa68c[_0xf129('0x1e')]['include']?_[_0xf129('0x22')](_0xbaa68c[_0xf129('0x1e')][_0xf129('0x23')],function(_0x4ec979){return{'model':db[_0x4ec979[_0xf129('0x24')]],'as':_0x4ec979['as'],'attributes':_0x4ec979['attributes'],'include':_0x4ec979['include']?_[_0xf129('0x22')](_0x4ec979[_0xf129('0x23')],function(_0x259555){return{'model':db[_0x259555[_0xf129('0x24')]],'as':_0x259555['as'],'attributes':_0x259555[_0xf129('0x20')],'include':_0x259555[_0xf129('0x23')]?_[_0xf129('0x22')](_0x259555[_0xf129('0x23')],function(_0x3aa38f){return{'model':db[_0x3aa38f[_0xf129('0x24')]],'as':_0x3aa38f['as'],'attributes':_0x3aa38f[_0xf129('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf129('0x11')](function(_0xaf4806){logger[_0xf129('0x12')]('GetChatQueue',_0xbaa68c);logger['debug'](_0xf129('0x1b'),_0xbaa68c,JSON['stringify'](_0xaf4806));_0x336dbc(_0xaf4806);})[_0xf129('0x25')](function(_0x5978e2){logger[_0xf129('0x17')](_0xf129('0x1b'),_0x5978e2[_0xf129('0x19')],_0xbaa68c);_0xbd9489(_0x3620b9[_0xf129('0x17')](0x1f4,_0x5978e2[_0xf129('0x19')]));});});};exports[_0xf129('0x26')]=function(_0x3c591d){var _0x2a6c6d=this;return new Promise(function(_0x3defbc,_0x54ea04){return db[_0xf129('0x27')]['find']({'raw':_0x3c591d[_0xf129('0x1e')]?_0x3c591d[_0xf129('0x1e')][_0xf129('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c591d['options']?_0x3c591d[_0xf129('0x1e')][_0xf129('0x1f')]||null:null,'attributes':_0x3c591d[_0xf129('0x1e')]?_0x3c591d[_0xf129('0x1e')]['attributes']||null:null,'include':_0x3c591d['options']?_0x3c591d['options'][_0xf129('0x23')]?_['map'](_0x3c591d[_0xf129('0x1e')][_0xf129('0x23')],function(_0x16e89d){return{'model':db[_0x16e89d[_0xf129('0x24')]],'as':_0x16e89d['as'],'attributes':_0x16e89d[_0xf129('0x20')],'include':_0x16e89d[_0xf129('0x23')]?_['map'](_0x16e89d['include'],function(_0x41ca80){return{'model':db[_0x41ca80['model']],'as':_0x41ca80['as'],'attributes':_0x41ca80[_0xf129('0x20')],'include':_0x41ca80[_0xf129('0x23')]?_['map'](_0x41ca80[_0xf129('0x23')],function(_0x18ca15){return{'model':db[_0x18ca15[_0xf129('0x24')]],'as':_0x18ca15['as'],'attributes':_0x18ca15[_0xf129('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf129('0x11')](function(_0x58494a){logger[_0xf129('0x12')](_0xf129('0x26'),_0x3c591d);logger[_0xf129('0x28')](_0xf129('0x26'),_0x3c591d,JSON[_0xf129('0x16')](_0x58494a));_0x3defbc(_0x58494a);})[_0xf129('0x25')](function(_0x869ff5){logger[_0xf129('0x17')](_0xf129('0x26'),_0x869ff5[_0xf129('0x19')],_0x3c591d);_0x54ea04(_0x2a6c6d[_0xf129('0x17')](0x1f4,_0x869ff5[_0xf129('0x19')]));});});}; \ No newline at end of file +var _0xafcd=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','map','include','model','stringify','ShowChatQueue'];(function(_0x9bcc0b,_0x120f6c){var _0x195399=function(_0x5be8b9){while(--_0x5be8b9){_0x9bcc0b['push'](_0x9bcc0b['shift']());}};_0x195399(++_0x120f6c);}(_0xafcd,0x157));var _0xdafc=function(_0x292380,_0x2c9565){_0x292380=_0x292380-0x0;var _0x148f5d=_0xafcd[_0x292380];return _0x148f5d;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});config[_0xdafc('0xc')]=_['defaults'](config[_0xdafc('0xc')],{'host':_0xdafc('0xd'),'port':0x18eb});var socket=require(_0xdafc('0xe'))(new Redis(config[_0xdafc('0xc')]));require(_0xdafc('0xf'))[_0xdafc('0x10')](socket);function respondWithRpcPromise(_0x3df5fb,_0x312e69,_0x1f87c5){return new BPromise(function(_0x2fdc39,_0x39561b){return client['request'](_0x3df5fb,_0x1f87c5)['then'](function(_0x2a1a6b){logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x312e69,_0xdafc('0x13'));logger[_0xdafc('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x312e69,'request\x20sent',JSON['stringify'](_0x2a1a6b));if(_0x2a1a6b[_0xdafc('0x15')]){if(_0x2a1a6b['error'][_0xdafc('0x16')]===0x1f4){logger['error'](_0xdafc('0x12'),_0x312e69,_0x2a1a6b[_0xdafc('0x15')][_0xdafc('0x17')]);return _0x39561b(_0x2a1a6b[_0xdafc('0x15')]['message']);}logger['error'](_0xdafc('0x12'),_0x312e69,_0x2a1a6b[_0xdafc('0x15')][_0xdafc('0x17')]);return _0x2fdc39(_0x2a1a6b['error']['message']);}else{logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x312e69,_0xdafc('0x13'));_0x2fdc39(_0x2a1a6b[_0xdafc('0x18')][_0xdafc('0x17')]);}})[_0xdafc('0x19')](function(_0x1ff505){logger[_0xdafc('0x15')]('ChatQueue,\x20%s,\x20%s',_0x312e69,_0x1ff505);_0x39561b(_0x1ff505);});});}exports[_0xdafc('0x1a')]=function(_0x10258f){var _0x5f4d1d=this;return new Promise(function(_0x239908,_0xb825df){return db[_0xdafc('0x1b')][_0xdafc('0x1c')]({'raw':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10258f['options']?_0x10258f['options'][_0xdafc('0x1e')]||null:null,'attributes':_0x10258f['options']?_0x10258f[_0xdafc('0x1d')][_0xdafc('0x1f')]||null:null,'limit':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['limit']||null:null,'include':_0x10258f[_0xdafc('0x1d')]?_0x10258f[_0xdafc('0x1d')]['include']?_[_0xdafc('0x20')](_0x10258f[_0xdafc('0x1d')][_0xdafc('0x21')],function(_0x3d3f06){return{'model':db[_0x3d3f06[_0xdafc('0x22')]],'as':_0x3d3f06['as'],'attributes':_0x3d3f06[_0xdafc('0x1f')],'include':_0x3d3f06[_0xdafc('0x21')]?_['map'](_0x3d3f06[_0xdafc('0x21')],function(_0x2d8bb0){return{'model':db[_0x2d8bb0['model']],'as':_0x2d8bb0['as'],'attributes':_0x2d8bb0[_0xdafc('0x1f')],'include':_0x2d8bb0['include']?_['map'](_0x2d8bb0[_0xdafc('0x21')],function(_0x56a820){return{'model':db[_0x56a820[_0xdafc('0x22')]],'as':_0x56a820['as'],'attributes':_0x56a820[_0xdafc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2752bd){logger['info']('GetChatQueue',_0x10258f);logger['debug'](_0xdafc('0x1a'),_0x10258f,JSON[_0xdafc('0x23')](_0x2752bd));_0x239908(_0x2752bd);})[_0xdafc('0x19')](function(_0x219e1e){logger[_0xdafc('0x15')](_0xdafc('0x1a'),_0x219e1e[_0xdafc('0x17')],_0x10258f);_0xb825df(_0x5f4d1d['error'](0x1f4,_0x219e1e[_0xdafc('0x17')]));});});};exports[_0xdafc('0x24')]=function(_0x51f59f){var _0x5e1f4c=this;return new Promise(function(_0x3d91b5,_0x727050){return db['ChatQueue']['find']({'raw':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f[_0xdafc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x51f59f['options']?_0x51f59f['options']['where']||null:null,'attributes':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f['options'][_0xdafc('0x1f')]||null:null,'include':_0x51f59f[_0xdafc('0x1d')]?_0x51f59f[_0xdafc('0x1d')][_0xdafc('0x21')]?_['map'](_0x51f59f[_0xdafc('0x1d')][_0xdafc('0x21')],function(_0x25ee4c){return{'model':db[_0x25ee4c[_0xdafc('0x22')]],'as':_0x25ee4c['as'],'attributes':_0x25ee4c[_0xdafc('0x1f')],'include':_0x25ee4c[_0xdafc('0x21')]?_['map'](_0x25ee4c[_0xdafc('0x21')],function(_0x413862){return{'model':db[_0x413862[_0xdafc('0x22')]],'as':_0x413862['as'],'attributes':_0x413862['attributes'],'include':_0x413862[_0xdafc('0x21')]?_['map'](_0x413862[_0xdafc('0x21')],function(_0x4a1591){return{'model':db[_0x4a1591[_0xdafc('0x22')]],'as':_0x4a1591['as'],'attributes':_0x4a1591[_0xdafc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdafc('0x25')](function(_0x52ff5b){logger[_0xdafc('0x11')](_0xdafc('0x24'),_0x51f59f);logger[_0xdafc('0x14')]('ShowChatQueue',_0x51f59f,JSON[_0xdafc('0x23')](_0x52ff5b));_0x3d91b5(_0x52ff5b);})['catch'](function(_0x13fc41){logger[_0xdafc('0x15')](_0xdafc('0x24'),_0x13fc41['message'],_0x51f59f);_0x727050(_0x5e1f4c['error'](0x1f4,_0x13fc41[_0xdafc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0f3ac7a..6f4bb2c 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 _0xb4e6=['removeListener','register','./chatQueue.events','remove','update','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xb4e6[_0x3dc68d];return _0xdf7f94;};'use strict';var ChatQueueEvents=require(_0x6b4e('0x0'));var events=['save',_0x6b4e('0x1'),_0x6b4e('0x2')];function createListener(_0x365912,_0x25ffcb){return function(_0x44e781){_0x25ffcb[_0x6b4e('0x3')](_0x365912,_0x44e781);};}function removeListener(_0x1929b8,_0x52313b){return function(){ChatQueueEvents[_0x6b4e('0x4')](_0x1929b8,_0x52313b);};}exports[_0x6b4e('0x5')]=function(_0x1f67a2){for(var _0x49de51=0x0,_0xd3138f=events['length'];_0x49de51<_0xd3138f;_0x49de51++){var _0x4f00be=events[_0x49de51];var _0x2311d9=createListener('chatQueue:'+_0x4f00be,_0x1f67a2);ChatQueueEvents['on'](_0x4f00be,_0x2311d9);}}; \ No newline at end of file +var _0x04de=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x04de,0x107));var _0xe04d=function(_0x376ca9,_0x3754dd){_0x376ca9=_0x376ca9-0x0;var _0xeda94=_0x04de[_0x376ca9];return _0xeda94;};'use strict';var ChatQueueEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatQueueEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatQueueEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f9775d7..e895da3 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5b8aa9,_0xf9e326){var _0x4afc73=function(_0x9b90fe){while(--_0x9b90fe){_0x5b8aa9['push'](_0x5b8aa9['shift']());}};_0x4afc73(++_0xf9e326);}(_0xe14b,0x93));var _0xbe14=function(_0x1121bc,_0x438708){_0x1121bc=_0x1121bc-0x0;var _0x2d9d34=_0xe14b[_0x1121bc];return _0x2d9d34;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x3d6fb8,_0x1cb6e5){var _0xf21d8a=function(_0x1f9429){while(--_0x1f9429){_0x3d6fb8['push'](_0x3d6fb8['shift']());}};_0xf21d8a(++_0x1cb6e5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 84e6f78..710ef8d 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 _0x5793=['STRING','DATE','moment','sequelize','exports'];(function(_0x305416,_0x160423){var _0x2254a4=function(_0x1ad48b){while(--_0x1ad48b){_0x305416['push'](_0x305416['shift']());}};_0x2254a4(++_0x160423);}(_0x5793,0xb1));var _0x3579=function(_0x544f2b,_0x2ffa89){_0x544f2b=_0x544f2b-0x0;var _0x51a440=_0x5793[_0x544f2b];return _0x51a440;};'use strict';var moment=require(_0x3579('0x0'));var Sequelize=require(_0x3579('0x1'));module[_0x3579('0x2')]={'uniqueid':{'type':Sequelize[_0x3579('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3579('0x4')]},'exitAt':{'type':Sequelize[_0x3579('0x4')]},'reason':{'type':Sequelize[_0x3579('0x3')]}}; \ No newline at end of file +var _0x3739=['DATE','moment','exports','STRING'];(function(_0x177135,_0x156a57){var _0x356eee=function(_0x59a61f){while(--_0x59a61f){_0x177135['push'](_0x177135['shift']());}};_0x356eee(++_0x156a57);}(_0x3739,0x1f1));var _0x9373=function(_0x415ac5,_0x663a59){_0x415ac5=_0x415ac5-0x0;var _0x2fb770=_0x3739[_0x415ac5];return _0x2fb770;};'use strict';var moment=require(_0x9373('0x0'));var Sequelize=require('sequelize');module[_0x9373('0x1')]={'uniqueid':{'type':Sequelize[_0x9373('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9373('0x2')]},'joinAt':{'type':Sequelize[_0x9373('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9373('0x3')]},'reason':{'type':Sequelize[_0x9373('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index eee0be3..d39a477 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 _0x8b8e=['json','apply','reject','save','update','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','then','rows','params','includeAll','catch','create','body','find','describe','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x40b0b7,_0xf53ae5){var _0x5dfb0b=function(_0x5a9c9e){while(--_0x5a9c9e){_0x40b0b7['push'](_0x40b0b7['shift']());}};_0x5dfb0b(++_0xf53ae5);}(_0x8b8e,0x108));var _0xe8b8=function(_0x4ae4a0,_0x24585e){_0x4ae4a0=_0x4ae4a0-0x0;var _0x34fdc9=_0x8b8e[_0x4ae4a0];return _0x34fdc9;};'use strict';var emlformat=require(_0xe8b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8b8('0x3'));var util=require(_0xe8b8('0x4'));var path=require(_0xe8b8('0x5'));var sox=require(_0xe8b8('0x6'));var csv=require(_0xe8b8('0x7'));var ejs=require(_0xe8b8('0x8'));var fs=require('fs');var fs_extra=require(_0xe8b8('0x9'));var _=require(_0xe8b8('0xa'));var squel=require(_0xe8b8('0xb'));var crypto=require(_0xe8b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8b8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8b8('0xf'));var qs=require(_0xe8b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8b8('0x11'))(_0xe8b8('0x12'));var utils=require(_0xe8b8('0x13'));var config=require(_0xe8b8('0x14'));var licenseUtil=require(_0xe8b8('0x15'));var db=require(_0xe8b8('0x16'))['db'];function respondWithStatusCode(_0x3de76b,_0x11fb1a){_0x11fb1a=_0x11fb1a||0xcc;return function(_0x151e09){if(_0x151e09){return _0x3de76b[_0xe8b8('0x17')](_0x11fb1a);}return _0x3de76b[_0xe8b8('0x18')](_0x11fb1a)[_0xe8b8('0x19')]();};}function respondWithResult(_0x30bfc7,_0x43698d){_0x43698d=_0x43698d||0xc8;return function(_0x4a3e9f){if(_0x4a3e9f){return _0x30bfc7[_0xe8b8('0x18')](_0x43698d)['json'](_0x4a3e9f);}};}function respondWithFilteredResult(_0x282ea8,_0x290c30){return function(_0x288699){if(_0x288699){var _0x36df40=typeof _0x290c30[_0xe8b8('0x1a')]===_0xe8b8('0x1b')&&typeof _0x290c30[_0xe8b8('0x1c')]===_0xe8b8('0x1b');var _0x4110b6=_0x288699[_0xe8b8('0x1d')];var _0x504738=_0x36df40?0x0:_0x290c30[_0xe8b8('0x1a')];var _0xaba717=_0x36df40?_0x288699['count']:_0x290c30[_0xe8b8('0x1a')]+_0x290c30[_0xe8b8('0x1c')];var _0x2b2b80;if(_0xaba717>=_0x4110b6){_0xaba717=_0x4110b6;_0x2b2b80=0xc8;}else{_0x2b2b80=0xce;}_0x282ea8[_0xe8b8('0x18')](_0x2b2b80);return _0x282ea8[_0xe8b8('0x1e')](_0xe8b8('0x1f'),_0x504738+'-'+_0xaba717+'/'+_0x4110b6)[_0xe8b8('0x20')](_0x288699);}return null;};}function patchUpdates(_0x36c273){return function(_0x29e96){try{jsonpatch[_0xe8b8('0x21')](_0x29e96,_0x36c273,!![]);}catch(_0x3fdc80){return BPromise[_0xe8b8('0x22')](_0x3fdc80);}return _0x29e96[_0xe8b8('0x23')]();};}function saveUpdates(_0x15abeb,_0x35dc1d){return function(_0x838cd4){if(_0x838cd4){return _0x838cd4[_0xe8b8('0x24')](_0x15abeb)['then'](function(_0x57faf7){return _0x57faf7;});}return null;};}function removeEntity(_0x566721,_0x4769fe){return function(_0x51297e){if(_0x51297e){return _0x51297e[_0xe8b8('0x25')]()['then'](function(){_0x566721[_0xe8b8('0x18')](0xcc)[_0xe8b8('0x19')]();});}};}function handleEntityNotFound(_0x5e3fa2,_0x5ac435){return function(_0x19f7b3){if(!_0x19f7b3){_0x5e3fa2[_0xe8b8('0x17')](0x194);}return _0x19f7b3;};}function handleError(_0x56f459,_0x3ce9b2){_0x3ce9b2=_0x3ce9b2||0x1f4;return function(_0x32141f){logger[_0xe8b8('0x26')](_0x32141f[_0xe8b8('0x27')]);if(_0x32141f[_0xe8b8('0x28')]){delete _0x32141f['name'];}_0x56f459[_0xe8b8('0x18')](_0x3ce9b2)['send'](_0x32141f);};}exports[_0xe8b8('0x29')]=function(_0x402e6c,_0x28d703){var _0x390154={},_0x589877={},_0x50c1f6={'count':0x0,'rows':[]};var _0xc98ea8=_[_0xe8b8('0x2a')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')],function(_0x2f92a5){return{'name':_0x2f92a5['fieldName'],'type':_0x2f92a5[_0xe8b8('0x2d')][_0xe8b8('0x2e')]};});_0x589877[_0xe8b8('0x2f')]=_[_0xe8b8('0x2a')](_0xc98ea8,_0xe8b8('0x28'));_0x589877[_0xe8b8('0x30')]=_[_0xe8b8('0x31')](_0x402e6c[_0xe8b8('0x30')]);_0x589877[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],_0x589877['query']);_0x390154[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],qs['fields'](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x35')]));_0x390154[_0xe8b8('0x34')]=_0x390154[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x390154[_0xe8b8('0x34')]:_0x589877[_0xe8b8('0x2f')];if(!_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x37')]('nolimit')){_0x390154[_0xe8b8('0x1c')]=qs[_0xe8b8('0x1c')](_0x402e6c['query'][_0xe8b8('0x1c')]);_0x390154[_0xe8b8('0x1a')]=qs[_0xe8b8('0x1a')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x1a')]);}_0x390154['order']=qs[_0xe8b8('0x38')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x38')]);_0x390154[_0xe8b8('0x39')]=qs[_0xe8b8('0x32')](_[_0xe8b8('0x3a')](_0x402e6c['query'],_0x589877[_0xe8b8('0x32')]),_0xc98ea8);if(_0x402e6c['query'][_0xe8b8('0x3b')]){_0x390154[_0xe8b8('0x39')]=_['merge'](_0x390154['where'],{'$or':_[_0xe8b8('0x2a')](_0xc98ea8,function(_0x1ae916){if(_0x1ae916[_0xe8b8('0x2d')]!==_0xe8b8('0x3c')){var _0x53a18d={};_0x53a18d[_0x1ae916[_0xe8b8('0x28')]]={'$like':'%'+_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x3b')]+'%'};return _0x53a18d;}})});}_0x390154=_[_0xe8b8('0x3d')]({},_0x390154,_0x402e6c[_0xe8b8('0x3e')]);var _0xecddc8={'where':_0x390154[_0xe8b8('0x39')]};return db[_0xe8b8('0x2b')]['count'](_0xecddc8)['then'](function(_0x2086fa){_0x50c1f6[_0xe8b8('0x1d')]=_0x2086fa;if(_0x402e6c[_0xe8b8('0x30')]['includeAll']){_0x390154[_0xe8b8('0x3f')]=[{'all':!![]}];}return db[_0xe8b8('0x2b')][_0xe8b8('0x40')](_0x390154);})[_0xe8b8('0x41')](function(_0x3fa8b2){_0x50c1f6[_0xe8b8('0x42')]=_0x3fa8b2;return _0x50c1f6;})[_0xe8b8('0x41')](respondWithFilteredResult(_0x28d703,_0x390154))['catch'](handleError(_0x28d703,null));};exports['show']=function(_0x4a851f,_0x16480b){var _0x1b553e={'raw':!![],'where':{'id':_0x4a851f[_0xe8b8('0x43')]['id']}},_0x1068eb={};_0x1068eb['model']=_[_0xe8b8('0x31')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')]);_0x1068eb[_0xe8b8('0x30')]=_['keys'](_0x4a851f['query']);_0x1068eb[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],_0x1068eb['query']);_0x1b553e[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],qs[_0xe8b8('0x35')](_0x4a851f['query'][_0xe8b8('0x35')]));_0x1b553e[_0xe8b8('0x34')]=_0x1b553e[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x1b553e[_0xe8b8('0x34')]:_0x1068eb[_0xe8b8('0x2f')];if(_0x4a851f[_0xe8b8('0x30')][_0xe8b8('0x44')]){_0x1b553e[_0xe8b8('0x3f')]=[{'all':!![]}];}_0x1b553e=_[_0xe8b8('0x3d')]({},_0x1b553e,_0x4a851f[_0xe8b8('0x3e')]);return db[_0xe8b8('0x2b')]['find'](_0x1b553e)['then'](handleEntityNotFound(_0x16480b,null))[_0xe8b8('0x41')](respondWithResult(_0x16480b,null))[_0xe8b8('0x45')](handleError(_0x16480b,null));};exports[_0xe8b8('0x46')]=function(_0x340880,_0xb78cdb){return db[_0xe8b8('0x2b')][_0xe8b8('0x46')](_0x340880['body'],{})['then'](respondWithResult(_0xb78cdb,0xc9))[_0xe8b8('0x45')](handleError(_0xb78cdb,null));};exports[_0xe8b8('0x24')]=function(_0x5f1e0c,_0x41a1d1){if(_0x5f1e0c[_0xe8b8('0x47')]['id']){delete _0x5f1e0c[_0xe8b8('0x47')]['id'];}return db[_0xe8b8('0x2b')][_0xe8b8('0x48')]({'where':{'id':_0x5f1e0c[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x41a1d1,null))[_0xe8b8('0x41')](saveUpdates(_0x5f1e0c[_0xe8b8('0x47')],null))[_0xe8b8('0x41')](respondWithResult(_0x41a1d1,null))[_0xe8b8('0x45')](handleError(_0x41a1d1,null));};exports[_0xe8b8('0x25')]=function(_0x5a5322,_0x39f11e){return db['ChatQueueReport'][_0xe8b8('0x48')]({'where':{'id':_0x5a5322[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x39f11e,null))[_0xe8b8('0x41')](removeEntity(_0x39f11e,null))['catch'](handleError(_0x39f11e,null));};exports[_0xe8b8('0x49')]=function(_0x250a2c,_0x536908){return db[_0xe8b8('0x2b')][_0xe8b8('0x49')]()[_0xe8b8('0x41')](respondWithResult(_0x536908,null))[_0xe8b8('0x45')](handleError(_0x536908,null));}; \ No newline at end of file +var _0xc677=['ChatQueueReport','includeAll','include','catch','show','params','filters','intersection','find','create','update','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','end','name','send','index','map','rawAttributes','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options'];(function(_0x4c7e96,_0xc2c958){var _0x1a021c=function(_0x1b693c){while(--_0x1b693c){_0x4c7e96['push'](_0x4c7e96['shift']());}};_0x1a021c(++_0xc2c958);}(_0xc677,0x16c));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c67('0x0'));var zipdir=require(_0x7c67('0x1'));var jsonpatch=require(_0x7c67('0x2'));var rp=require(_0x7c67('0x3'));var moment=require(_0x7c67('0x4'));var BPromise=require(_0x7c67('0x5'));var Mustache=require(_0x7c67('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7c67('0x7'));var fs=require('fs');var fs_extra=require(_0x7c67('0x8'));var _=require('lodash');var squel=require(_0x7c67('0x9'));var crypto=require('crypto');var jsforce=require(_0x7c67('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7c67('0xb'));var querystring=require(_0x7c67('0xc'));var Papa=require(_0x7c67('0xd'));var Redis=require(_0x7c67('0xe'));var authService=require(_0x7c67('0xf'));var qs=require(_0x7c67('0x10'));var as=require(_0x7c67('0x11'));var hardwareService=require(_0x7c67('0x12'));var logger=require(_0x7c67('0x13'))(_0x7c67('0x14'));var utils=require(_0x7c67('0x15'));var config=require(_0x7c67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c67('0x17'))['db'];function respondWithStatusCode(_0x449661,_0x26fa55){_0x26fa55=_0x26fa55||0xcc;return function(_0x52f65b){if(_0x52f65b){return _0x449661[_0x7c67('0x18')](_0x26fa55);}return _0x449661['status'](_0x26fa55)['end']();};}function respondWithResult(_0x31355e,_0x2935eb){_0x2935eb=_0x2935eb||0xc8;return function(_0x3bf387){if(_0x3bf387){return _0x31355e[_0x7c67('0x19')](_0x2935eb)[_0x7c67('0x1a')](_0x3bf387);}};}function respondWithFilteredResult(_0x3c21c9,_0xd9743c){return function(_0x3a01ad){if(_0x3a01ad){var _0x336bb3=typeof _0xd9743c[_0x7c67('0x1b')]==='undefined'&&typeof _0xd9743c[_0x7c67('0x1c')]===_0x7c67('0x1d');var _0x2a4936=_0x3a01ad[_0x7c67('0x1e')];var _0x35d227=_0x336bb3?0x0:_0xd9743c[_0x7c67('0x1b')];var _0x197de0=_0x336bb3?_0x3a01ad[_0x7c67('0x1e')]:_0xd9743c[_0x7c67('0x1b')]+_0xd9743c[_0x7c67('0x1c')];var _0x30ed2c;if(_0x197de0>=_0x2a4936){_0x197de0=_0x2a4936;_0x30ed2c=0xc8;}else{_0x30ed2c=0xce;}_0x3c21c9[_0x7c67('0x19')](_0x30ed2c);return _0x3c21c9[_0x7c67('0x1f')](_0x7c67('0x20'),_0x35d227+'-'+_0x197de0+'/'+_0x2a4936)[_0x7c67('0x1a')](_0x3a01ad);}return null;};}function patchUpdates(_0x271f4e){return function(_0x307bd0){try{jsonpatch['apply'](_0x307bd0,_0x271f4e,!![]);}catch(_0x17d523){return BPromise['reject'](_0x17d523);}return _0x307bd0[_0x7c67('0x21')]();};}function saveUpdates(_0x1a05aa,_0x2af1fd){return function(_0x3f19ce){if(_0x3f19ce){return _0x3f19ce['update'](_0x1a05aa)['then'](function(_0x35b9c8){return _0x35b9c8;});}return null;};}function removeEntity(_0x11170e,_0x42a3d3){return function(_0x5ebfaf){if(_0x5ebfaf){return _0x5ebfaf['destroy']()[_0x7c67('0x22')](function(){_0x11170e[_0x7c67('0x19')](0xcc)[_0x7c67('0x23')]();});}};}function handleEntityNotFound(_0x670d50,_0xe1863a){return function(_0xf09e83){if(!_0xf09e83){_0x670d50['sendStatus'](0x194);}return _0xf09e83;};}function handleError(_0x250848,_0x11dd8d){_0x11dd8d=_0x11dd8d||0x1f4;return function(_0x52bc2b){logger['error'](_0x52bc2b['stack']);if(_0x52bc2b['name']){delete _0x52bc2b[_0x7c67('0x24')];}_0x250848['status'](_0x11dd8d)[_0x7c67('0x25')](_0x52bc2b);};}exports[_0x7c67('0x26')]=function(_0x2d67d5,_0x42ed09){var _0x2d03ef={},_0x51b48f={},_0x20e77c={'count':0x0,'rows':[]};var _0x42926d=_[_0x7c67('0x27')](db['ChatQueueReport'][_0x7c67('0x28')],function(_0x207846){return{'name':_0x207846['fieldName'],'type':_0x207846[_0x7c67('0x29')][_0x7c67('0x2a')]};});_0x51b48f['model']=_['map'](_0x42926d,_0x7c67('0x24'));_0x51b48f[_0x7c67('0x2b')]=_[_0x7c67('0x2c')](_0x2d67d5[_0x7c67('0x2b')]);_0x51b48f['filters']=_['intersection'](_0x51b48f[_0x7c67('0x2d')],_0x51b48f[_0x7c67('0x2b')]);_0x2d03ef[_0x7c67('0x2e')]=_['intersection'](_0x51b48f[_0x7c67('0x2d')],qs[_0x7c67('0x2f')](_0x2d67d5['query'][_0x7c67('0x2f')]));_0x2d03ef[_0x7c67('0x2e')]=_0x2d03ef[_0x7c67('0x2e')]['length']?_0x2d03ef[_0x7c67('0x2e')]:_0x51b48f[_0x7c67('0x2d')];if(!_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x30')](_0x7c67('0x31'))){_0x2d03ef[_0x7c67('0x1c')]=qs[_0x7c67('0x1c')](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x1c')]);_0x2d03ef['offset']=qs[_0x7c67('0x1b')](_0x2d67d5['query'][_0x7c67('0x1b')]);}_0x2d03ef[_0x7c67('0x32')]=qs['sort'](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x33')]);_0x2d03ef[_0x7c67('0x34')]=qs['filters'](_['pick'](_0x2d67d5[_0x7c67('0x2b')],_0x51b48f['filters']),_0x42926d);if(_0x2d67d5[_0x7c67('0x2b')]['filter']){_0x2d03ef[_0x7c67('0x34')]=_['merge'](_0x2d03ef[_0x7c67('0x34')],{'$or':_[_0x7c67('0x27')](_0x42926d,function(_0x30543d){if(_0x30543d['type']!==_0x7c67('0x35')){var _0x378006={};_0x378006[_0x30543d['name']]={'$like':'%'+_0x2d67d5[_0x7c67('0x2b')]['filter']+'%'};return _0x378006;}})});}_0x2d03ef=_[_0x7c67('0x36')]({},_0x2d03ef,_0x2d67d5[_0x7c67('0x37')]);var _0x2f7f28={'where':_0x2d03ef['where']};return db[_0x7c67('0x38')][_0x7c67('0x1e')](_0x2f7f28)['then'](function(_0x45245b){_0x20e77c['count']=_0x45245b;if(_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2d03ef[_0x7c67('0x3a')]=[{'all':!![]}];}return db[_0x7c67('0x38')]['findAll'](_0x2d03ef);})[_0x7c67('0x22')](function(_0x36d344){_0x20e77c['rows']=_0x36d344;return _0x20e77c;})[_0x7c67('0x22')](respondWithFilteredResult(_0x42ed09,_0x2d03ef))[_0x7c67('0x3b')](handleError(_0x42ed09,null));};exports[_0x7c67('0x3c')]=function(_0x3ee63c,_0x3aaa82){var _0x2695c8={'raw':!![],'where':{'id':_0x3ee63c[_0x7c67('0x3d')]['id']}},_0x45da99={};_0x45da99[_0x7c67('0x2d')]=_[_0x7c67('0x2c')](db[_0x7c67('0x38')][_0x7c67('0x28')]);_0x45da99[_0x7c67('0x2b')]=_['keys'](_0x3ee63c[_0x7c67('0x2b')]);_0x45da99[_0x7c67('0x3e')]=_[_0x7c67('0x3f')](_0x45da99[_0x7c67('0x2d')],_0x45da99['query']);_0x2695c8[_0x7c67('0x2e')]=_[_0x7c67('0x3f')](_0x45da99['model'],qs[_0x7c67('0x2f')](_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x2f')]));_0x2695c8[_0x7c67('0x2e')]=_0x2695c8[_0x7c67('0x2e')]['length']?_0x2695c8['attributes']:_0x45da99['model'];if(_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2695c8[_0x7c67('0x3a')]=[{'all':!![]}];}_0x2695c8=_[_0x7c67('0x36')]({},_0x2695c8,_0x3ee63c['options']);return db[_0x7c67('0x38')][_0x7c67('0x40')](_0x2695c8)[_0x7c67('0x22')](handleEntityNotFound(_0x3aaa82,null))[_0x7c67('0x22')](respondWithResult(_0x3aaa82,null))['catch'](handleError(_0x3aaa82,null));};exports[_0x7c67('0x41')]=function(_0x3840b5,_0x20428e){return db[_0x7c67('0x38')][_0x7c67('0x41')](_0x3840b5['body'],{})[_0x7c67('0x22')](respondWithResult(_0x20428e,0xc9))[_0x7c67('0x3b')](handleError(_0x20428e,null));};exports[_0x7c67('0x42')]=function(_0x1e07bf,_0x26e374){if(_0x1e07bf[_0x7c67('0x43')]['id']){delete _0x1e07bf[_0x7c67('0x43')]['id'];}return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1e07bf[_0x7c67('0x3d')]['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x26e374,null))[_0x7c67('0x22')](saveUpdates(_0x1e07bf['body'],null))[_0x7c67('0x22')](respondWithResult(_0x26e374,null))[_0x7c67('0x3b')](handleError(_0x26e374,null));};exports[_0x7c67('0x44')]=function(_0x1b766d,_0x156c5a){return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1b766d['params']['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x156c5a,null))['then'](removeEntity(_0x156c5a,null))[_0x7c67('0x3b')](handleError(_0x156c5a,null));};exports['describe']=function(_0x12c471,_0x23883f){return db[_0x7c67('0x38')][_0x7c67('0x45')]()['then'](respondWithResult(_0x23883f,null))['catch'](handleError(_0x23883f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a7226e8..598970b 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(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_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(_0x4dc3c6,_0x541ba2){var _0x1f4f81=function(_0x1206e4){while(--_0x1206e4){_0x4dc3c6['push'](_0x4dc3c6['shift']());}};_0x1f4f81(++_0x541ba2);}(_0x757a,0xde));var _0xa757=function(_0x1ad8bc,_0x3fe383){_0x1ad8bc=_0x1ad8bc-0x0;var _0x2a30c7=_0x757a[_0x1ad8bc];return _0x2a30c7;};'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 8a347c6..eb80812 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 _0x27c0=['then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2cee59,_0x10c76e){var _0x216c09=function(_0x3242c9){while(--_0x3242c9){_0x2cee59['push'](_0x2cee59['shift']());}};_0x216c09(++_0x10c76e);}(_0x27c0,0xad));var _0x027c=function(_0x33f742,_0x36bf03){_0x33f742=_0x33f742-0x0;var _0x15e17e=_0x27c0[_0x33f742];return _0x15e17e;};'use strict';var _=require(_0x027c('0x0'));var util=require(_0x027c('0x1'));var moment=require(_0x027c('0x2'));var BPromise=require(_0x027c('0x3'));var rs=require(_0x027c('0x4'));var fs=require('fs');var Redis=require(_0x027c('0x5'));var db=require(_0x027c('0x6'))['db'];var utils=require(_0x027c('0x7'));var logger=require(_0x027c('0x8'))(_0x027c('0x9'));var config=require('../../config/environment');var jayson=require(_0x027c('0xa'));var client=jayson[_0x027c('0xb')][_0x027c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x414dda,_0x2c5dc1,_0x1a48bd){return new BPromise(function(_0x1de467,_0x5ea5a1){return client['request'](_0x414dda,_0x1a48bd)[_0x027c('0xd')](function(_0x114c0e){logger[_0x027c('0xe')](_0x027c('0xf'),_0x2c5dc1,'request\x20sent');logger[_0x027c('0x10')](_0x027c('0x11'),_0x2c5dc1,'request\x20sent',JSON[_0x027c('0x12')](_0x114c0e));if(_0x114c0e[_0x027c('0x13')]){if(_0x114c0e['error']['code']===0x1f4){logger[_0x027c('0x13')](_0x027c('0xf'),_0x2c5dc1,_0x114c0e[_0x027c('0x13')][_0x027c('0x14')]);return _0x5ea5a1(_0x114c0e['error'][_0x027c('0x14')]);}logger[_0x027c('0x13')](_0x027c('0xf'),_0x2c5dc1,_0x114c0e[_0x027c('0x13')][_0x027c('0x14')]);return _0x1de467(_0x114c0e['error'][_0x027c('0x14')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x2c5dc1,'request\x20sent');_0x1de467(_0x114c0e['result'][_0x027c('0x14')]);}})[_0x027c('0x15')](function(_0x5ed0f0){logger[_0x027c('0x13')](_0x027c('0xf'),_0x2c5dc1,_0x5ed0f0);_0x5ea5a1(_0x5ed0f0);});});}exports['CreateChatQueueReport']=function(_0x5d0907){var _0x1f084a=this;return new Promise(function(_0x19fe48,_0x5dd503){return db[_0x027c('0x16')][_0x027c('0x17')](_0x5d0907['body'],{'raw':_0x5d0907[_0x027c('0x18')]?_0x5d0907[_0x027c('0x18')][_0x027c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x282f3f){logger[_0x027c('0xe')](_0x027c('0x1a'),_0x5d0907);logger[_0x027c('0x10')](_0x027c('0x1a'),_0x5d0907,JSON[_0x027c('0x12')](_0x282f3f));_0x19fe48(_0x282f3f);})[_0x027c('0x15')](function(_0x471569){logger[_0x027c('0x13')](_0x027c('0x1a'),_0x471569[_0x027c('0x14')],_0x5d0907);_0x5dd503(_0x1f084a[_0x027c('0x13')](0x1f4,_0x471569[_0x027c('0x14')]));});});};exports[_0x027c('0x1b')]=function(_0x5c85f5){var _0x2e55a6=this;return new Promise(function(_0x14d30c,_0x408463){return db[_0x027c('0x16')][_0x027c('0x1c')](_0x5c85f5[_0x027c('0x1d')],{'raw':_0x5c85f5[_0x027c('0x18')]?_0x5c85f5[_0x027c('0x18')][_0x027c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c85f5['options']?_0x5c85f5[_0x027c('0x18')]['where']||null:null,'attributes':_0x5c85f5[_0x027c('0x18')]?_0x5c85f5[_0x027c('0x18')]['attributes']||null:null,'limit':_0x5c85f5[_0x027c('0x18')]?_0x5c85f5[_0x027c('0x18')][_0x027c('0x1e')]||null:null})['then'](function(_0x3a2d21){logger[_0x027c('0xe')](_0x027c('0x1b'),_0x5c85f5);logger[_0x027c('0x10')]('UpdateChatQueueReport',_0x5c85f5,JSON[_0x027c('0x12')](_0x3a2d21));_0x14d30c(_0x3a2d21);})[_0x027c('0x15')](function(_0x17e9ba){logger[_0x027c('0x13')](_0x027c('0x1b'),_0x17e9ba[_0x027c('0x14')],_0x5c85f5);_0x408463(_0x2e55a6[_0x027c('0x13')](0x1f4,_0x17e9ba['message']));});});}; \ No newline at end of file +var _0xe021=['ChatQueueReport','create','options','raw','debug','body','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport'];(function(_0xecdf7,_0x29ecda){var _0x25c15c=function(_0x1cef05){while(--_0x1cef05){_0xecdf7['push'](_0xecdf7['shift']());}};_0x25c15c(++_0x29ecda);}(_0xe021,0x10e));var _0x1e02=function(_0x407b70,_0x5f254c){_0x407b70=_0x407b70-0x0;var _0x5b7a85=_0xe021[_0x407b70];return _0x5b7a85;};'use strict';var _=require(_0x1e02('0x0'));var util=require(_0x1e02('0x1'));var moment=require(_0x1e02('0x2'));var BPromise=require(_0x1e02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e02('0x4'));var logger=require('../../config/logger')(_0x1e02('0x5'));var config=require(_0x1e02('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6f4c4c,_0x49be38,_0x198301){return new BPromise(function(_0x3b960e,_0x1ebc80){return client['request'](_0x6f4c4c,_0x198301)[_0x1e02('0x8')](function(_0x3d1db1){logger[_0x1e02('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x49be38,'request\x20sent');logger['debug'](_0x1e02('0xa'),_0x49be38,_0x1e02('0xb'),JSON[_0x1e02('0xc')](_0x3d1db1));if(_0x3d1db1[_0x1e02('0xd')]){if(_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xe')]===0x1f4){logger[_0x1e02('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x49be38,_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xf')]);return _0x1ebc80(_0x3d1db1[_0x1e02('0xd')][_0x1e02('0xf')]);}logger[_0x1e02('0xd')](_0x1e02('0x10'),_0x49be38,_0x3d1db1['error'][_0x1e02('0xf')]);return _0x3b960e(_0x3d1db1['error'][_0x1e02('0xf')]);}else{logger[_0x1e02('0x9')](_0x1e02('0x10'),_0x49be38,_0x1e02('0xb'));_0x3b960e(_0x3d1db1[_0x1e02('0x11')][_0x1e02('0xf')]);}})[_0x1e02('0x12')](function(_0x4bc062){logger[_0x1e02('0xd')](_0x1e02('0x10'),_0x49be38,_0x4bc062);_0x1ebc80(_0x4bc062);});});}exports[_0x1e02('0x13')]=function(_0x31f37f){var _0x426ea2=this;return new Promise(function(_0x432b5d,_0x5b009f){return db[_0x1e02('0x14')][_0x1e02('0x15')](_0x31f37f['body'],{'raw':_0x31f37f[_0x1e02('0x16')]?_0x31f37f[_0x1e02('0x16')][_0x1e02('0x17')]===undefined?!![]:![]:!![]})[_0x1e02('0x8')](function(_0xe36577){logger[_0x1e02('0x9')](_0x1e02('0x13'),_0x31f37f);logger[_0x1e02('0x18')](_0x1e02('0x13'),_0x31f37f,JSON['stringify'](_0xe36577));_0x432b5d(_0xe36577);})[_0x1e02('0x12')](function(_0x3b222b){logger[_0x1e02('0xd')](_0x1e02('0x13'),_0x3b222b[_0x1e02('0xf')],_0x31f37f);_0x5b009f(_0x426ea2['error'](0x1f4,_0x3b222b[_0x1e02('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x149764){var _0x5df68a=this;return new Promise(function(_0x3d4ff8,_0x2b6d80){return db[_0x1e02('0x14')]['update'](_0x149764[_0x1e02('0x19')],{'raw':_0x149764['options']?_0x149764[_0x1e02('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149764[_0x1e02('0x16')]?_0x149764[_0x1e02('0x16')]['where']||null:null,'attributes':_0x149764['options']?_0x149764[_0x1e02('0x16')][_0x1e02('0x1a')]||null:null,'limit':_0x149764['options']?_0x149764[_0x1e02('0x16')][_0x1e02('0x1b')]||null:null})[_0x1e02('0x8')](function(_0x199c15){logger['info'](_0x1e02('0x1c'),_0x149764);logger['debug'](_0x1e02('0x1c'),_0x149764,JSON['stringify'](_0x199c15));_0x3d4ff8(_0x199c15);})[_0x1e02('0x12')](function(_0x587aa9){logger[_0x1e02('0xd')](_0x1e02('0x1c'),_0x587aa9[_0x1e02('0xf')],_0x149764);_0x2b6d80(_0x5df68a[_0x1e02('0xd')](0x1f4,_0x587aa9[_0x1e02('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8f92b94..4618398 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 _0xe2b8=['multer','util','path','express','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe2b8,0x168));var _0x8e2b=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xe2b8[_0x1ae4a9];return _0x54d0b0;};'use strict';var multer=require(_0x8e2b('0x0'));var util=require(_0x8e2b('0x1'));var path=require(_0x8e2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e2b('0x3'));var router=express['Router']();var fs_extra=require(_0x8e2b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8e2b('0x5'));var config=require('../../config/environment');var controller=require(_0x8e2b('0x6'));router[_0x8e2b('0x7')]('/',auth[_0x8e2b('0x8')](),controller[_0x8e2b('0x9')]);router['get']('/describe',auth[_0x8e2b('0x8')](),controller['describe']);router[_0x8e2b('0x7')](_0x8e2b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8e2b('0xb')]('/',auth['isAuthenticated'](),controller[_0x8e2b('0xc')]);router['put'](_0x8e2b('0xa'),auth[_0x8e2b('0x8')](),controller[_0x8e2b('0xd')]);router['delete']('/:id',auth[_0x8e2b('0x8')](),controller[_0x8e2b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0871=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf74f46,_0x1a49d4){var _0x5ea729=function(_0x73e853){while(--_0x73e853){_0xf74f46['push'](_0xf74f46['shift']());}};_0x5ea729(++_0x1a49d4);}(_0x0871,0xdc));var _0x1087=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0871[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0x1087('0x0'));var util=require(_0x1087('0x1'));var path=require(_0x1087('0x2'));var timeout=require(_0x1087('0x3'));var express=require(_0x1087('0x4'));var router=express[_0x1087('0x5')]();var fs_extra=require(_0x1087('0x6'));var auth=require(_0x1087('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1087('0x8'));var controller=require('./chatQueueReport.controller');router[_0x1087('0x9')]('/',auth[_0x1087('0xa')](),controller[_0x1087('0xb')]);router[_0x1087('0x9')]('/describe',auth[_0x1087('0xa')](),controller[_0x1087('0xc')]);router[_0x1087('0x9')](_0x1087('0xd'),auth[_0x1087('0xa')](),controller[_0x1087('0xe')]);router['post']('/',auth[_0x1087('0xa')](),controller['create']);router[_0x1087('0xf')]('/:id',auth[_0x1087('0xa')](),controller[_0x1087('0x10')]);router['delete'](_0x1087('0xd'),auth['isAuthenticated'](),controller[_0x1087('0x11')]);module[_0x1087('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9d7de56..3aded91 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3db50e,_0x452e95){var _0x372396=function(_0x428b18){while(--_0x428b18){_0x3db50e['push'](_0x3db50e['shift']());}};_0x372396(++_0x452e95);}(_0xedd9,0xfc));var _0x9edd=function(_0x66495,_0x40446c){_0x66495=_0x66495-0x0;var _0x9cfe81=_0xedd9[_0x66495];return _0x9cfe81;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0x54ef,0x112));var _0xf54e=function(_0x23013,_0x55eaa7){_0x23013=_0x23013-0x0;var _0x52479a=_0x54ef[_0x23013];return _0x52479a;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6b71385..38350a5 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 _0x0af9=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','error','stack','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','destroy','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xcef3a,_0x55454b){var _0x3e573a=function(_0x2de0a8){while(--_0x2de0a8){_0xcef3a['push'](_0xcef3a['shift']());}};_0x3e573a(++_0x55454b);}(_0x0af9,0x161));var _0x90af=function(_0x97a0fd,_0x54c22e){_0x97a0fd=_0x97a0fd-0x0;var _0x542f59=_0x0af9[_0x97a0fd];return _0x542f59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90af('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90af('0x1'));var moment=require(_0x90af('0x2'));var BPromise=require(_0x90af('0x3'));var Mustache=require(_0x90af('0x4'));var util=require(_0x90af('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x90af('0x6'));var ejs=require(_0x90af('0x7'));var fs=require('fs');var fs_extra=require(_0x90af('0x8'));var _=require(_0x90af('0x9'));var squel=require(_0x90af('0xa'));var crypto=require(_0x90af('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x90af('0x6'));var querystring=require(_0x90af('0xc'));var Papa=require(_0x90af('0xd'));var Redis=require('ioredis');var authService=require(_0x90af('0xe'));var qs=require(_0x90af('0xf'));var as=require(_0x90af('0x10'));var hardwareService=require(_0x90af('0x11'));var logger=require(_0x90af('0x12'))(_0x90af('0x13'));var utils=require('../../config/utils');var config=require(_0x90af('0x14'));var licenseUtil=require(_0x90af('0x15'));var db=require(_0x90af('0x16'))['db'];function respondWithStatusCode(_0x4ddeb4,_0x189f7b){_0x189f7b=_0x189f7b||0xcc;return function(_0x7c41c0){if(_0x7c41c0){return _0x4ddeb4[_0x90af('0x17')](_0x189f7b);}return _0x4ddeb4[_0x90af('0x18')](_0x189f7b)[_0x90af('0x19')]();};}function respondWithResult(_0x1f9a88,_0xb9d109){_0xb9d109=_0xb9d109||0xc8;return function(_0x3e9b6b){if(_0x3e9b6b){return _0x1f9a88['status'](_0xb9d109)['json'](_0x3e9b6b);}};}function respondWithFilteredResult(_0x5703cb,_0x3a797f){return function(_0x37e3fa){if(_0x37e3fa){var _0x18c881=typeof _0x3a797f[_0x90af('0x1a')]===_0x90af('0x1b')&&typeof _0x3a797f[_0x90af('0x1c')]===_0x90af('0x1b');var _0x9efb5c=_0x37e3fa[_0x90af('0x1d')];var _0x2663ff=_0x18c881?0x0:_0x3a797f[_0x90af('0x1a')];var _0x41e631=_0x18c881?_0x37e3fa[_0x90af('0x1d')]:_0x3a797f['offset']+_0x3a797f[_0x90af('0x1c')];var _0x535bc9;if(_0x41e631>=_0x9efb5c){_0x41e631=_0x9efb5c;_0x535bc9=0xc8;}else{_0x535bc9=0xce;}_0x5703cb[_0x90af('0x18')](_0x535bc9);return _0x5703cb['set'](_0x90af('0x1e'),_0x2663ff+'-'+_0x41e631+'/'+_0x9efb5c)[_0x90af('0x1f')](_0x37e3fa);}return null;};}function patchUpdates(_0x269f4b){return function(_0x2f1a81){try{jsonpatch[_0x90af('0x20')](_0x2f1a81,_0x269f4b,!![]);}catch(_0x46eeae){return BPromise[_0x90af('0x21')](_0x46eeae);}return _0x2f1a81[_0x90af('0x22')]();};}function saveUpdates(_0x5816a0,_0x169b15){return function(_0x33b887){if(_0x33b887){return _0x33b887[_0x90af('0x23')](_0x5816a0)['then'](function(_0x4be6d8){return _0x4be6d8;});}return null;};}function removeEntity(_0x20089e,_0x415483){return function(_0x5242ec){if(_0x5242ec){return _0x5242ec['destroy']()['then'](function(){_0x20089e['status'](0xcc)[_0x90af('0x19')]();});}};}function handleEntityNotFound(_0x2cd914,_0x171ca2){return function(_0x48da1d){if(!_0x48da1d){_0x2cd914[_0x90af('0x17')](0x194);}return _0x48da1d;};}function handleError(_0x2927ff,_0x8b7246){_0x8b7246=_0x8b7246||0x1f4;return function(_0x53b2e2){logger[_0x90af('0x24')](_0x53b2e2[_0x90af('0x25')]);if(_0x53b2e2['name']){delete _0x53b2e2[_0x90af('0x26')];}_0x2927ff[_0x90af('0x18')](_0x8b7246)['send'](_0x53b2e2);};}exports['index']=function(_0x5bbce6,_0x4c6876){var _0x4a2180={},_0x4d685a={},_0x4f4078={'count':0x0,'rows':[]};var _0x12f236=_[_0x90af('0x27')](db[_0x90af('0x28')][_0x90af('0x29')],function(_0x101bcf){return{'name':_0x101bcf[_0x90af('0x2a')],'type':_0x101bcf[_0x90af('0x2b')][_0x90af('0x2c')]};});_0x4d685a[_0x90af('0x2d')]=_[_0x90af('0x27')](_0x12f236,_0x90af('0x26'));_0x4d685a[_0x90af('0x2e')]=_[_0x90af('0x2f')](_0x5bbce6['query']);_0x4d685a[_0x90af('0x30')]=_[_0x90af('0x31')](_0x4d685a[_0x90af('0x2d')],_0x4d685a['query']);_0x4a2180[_0x90af('0x32')]=_['intersection'](_0x4d685a['model'],qs['fields'](_0x5bbce6[_0x90af('0x2e')][_0x90af('0x33')]));_0x4a2180[_0x90af('0x32')]=_0x4a2180[_0x90af('0x32')][_0x90af('0x34')]?_0x4a2180[_0x90af('0x32')]:_0x4d685a[_0x90af('0x2d')];if(!_0x5bbce6[_0x90af('0x2e')][_0x90af('0x35')]('nolimit')){_0x4a2180[_0x90af('0x1c')]=qs[_0x90af('0x1c')](_0x5bbce6[_0x90af('0x2e')][_0x90af('0x1c')]);_0x4a2180[_0x90af('0x1a')]=qs[_0x90af('0x1a')](_0x5bbce6[_0x90af('0x2e')]['offset']);}_0x4a2180[_0x90af('0x36')]=qs[_0x90af('0x37')](_0x5bbce6[_0x90af('0x2e')][_0x90af('0x37')]);_0x4a2180[_0x90af('0x38')]=qs[_0x90af('0x30')](_[_0x90af('0x39')](_0x5bbce6[_0x90af('0x2e')],_0x4d685a[_0x90af('0x30')]),_0x12f236);if(_0x5bbce6['query'][_0x90af('0x3a')]){_0x4a2180[_0x90af('0x38')]=_['merge'](_0x4a2180[_0x90af('0x38')],{'$or':_[_0x90af('0x27')](_0x12f236,function(_0x3c35fe){if(_0x3c35fe['type']!==_0x90af('0x3b')){var _0x29dfff={};_0x29dfff[_0x3c35fe['name']]={'$like':'%'+_0x5bbce6['query']['filter']+'%'};return _0x29dfff;}})});}_0x4a2180=_['merge']({},_0x4a2180,_0x5bbce6[_0x90af('0x3c')]);var _0x5d6fa5={'where':_0x4a2180['where']};return db['ChatTransferReport'][_0x90af('0x1d')](_0x5d6fa5)[_0x90af('0x3d')](function(_0x134f46){_0x4f4078[_0x90af('0x1d')]=_0x134f46;if(_0x5bbce6[_0x90af('0x2e')][_0x90af('0x3e')]){_0x4a2180['include']=[{'all':!![]}];}return db[_0x90af('0x28')][_0x90af('0x3f')](_0x4a2180);})[_0x90af('0x3d')](function(_0x15caae){_0x4f4078[_0x90af('0x40')]=_0x15caae;return _0x4f4078;})['then'](respondWithFilteredResult(_0x4c6876,_0x4a2180))[_0x90af('0x41')](handleError(_0x4c6876,null));};exports[_0x90af('0x42')]=function(_0x261f0f,_0x5cd7fb){var _0x5212de={'raw':!![],'where':{'id':_0x261f0f[_0x90af('0x43')]['id']}},_0x6f4d9b={};_0x6f4d9b['model']=_[_0x90af('0x2f')](db[_0x90af('0x28')][_0x90af('0x29')]);_0x6f4d9b[_0x90af('0x2e')]=_['keys'](_0x261f0f[_0x90af('0x2e')]);_0x6f4d9b[_0x90af('0x30')]=_[_0x90af('0x31')](_0x6f4d9b[_0x90af('0x2d')],_0x6f4d9b[_0x90af('0x2e')]);_0x5212de[_0x90af('0x32')]=_[_0x90af('0x31')](_0x6f4d9b[_0x90af('0x2d')],qs[_0x90af('0x33')](_0x261f0f['query'][_0x90af('0x33')]));_0x5212de['attributes']=_0x5212de['attributes'][_0x90af('0x34')]?_0x5212de[_0x90af('0x32')]:_0x6f4d9b[_0x90af('0x2d')];if(_0x261f0f[_0x90af('0x2e')]['includeAll']){_0x5212de[_0x90af('0x44')]=[{'all':!![]}];}_0x5212de=_[_0x90af('0x45')]({},_0x5212de,_0x261f0f[_0x90af('0x3c')]);return db[_0x90af('0x28')][_0x90af('0x46')](_0x5212de)[_0x90af('0x3d')](handleEntityNotFound(_0x5cd7fb,null))[_0x90af('0x3d')](respondWithResult(_0x5cd7fb,null))[_0x90af('0x41')](handleError(_0x5cd7fb,null));};exports[_0x90af('0x47')]=function(_0x57c482,_0x27a9ed){return db['ChatTransferReport'][_0x90af('0x47')](_0x57c482[_0x90af('0x48')],{})[_0x90af('0x3d')](respondWithResult(_0x27a9ed,0xc9))[_0x90af('0x41')](handleError(_0x27a9ed,null));};exports[_0x90af('0x23')]=function(_0x584268,_0x16cffc){if(_0x584268[_0x90af('0x48')]['id']){delete _0x584268[_0x90af('0x48')]['id'];}return db[_0x90af('0x28')][_0x90af('0x46')]({'where':{'id':_0x584268[_0x90af('0x43')]['id']}})[_0x90af('0x3d')](handleEntityNotFound(_0x16cffc,null))[_0x90af('0x3d')](saveUpdates(_0x584268['body'],null))[_0x90af('0x3d')](respondWithResult(_0x16cffc,null))[_0x90af('0x41')](handleError(_0x16cffc,null));};exports[_0x90af('0x49')]=function(_0x25eb0a,_0x9e0080){return db['ChatTransferReport']['find']({'where':{'id':_0x25eb0a[_0x90af('0x43')]['id']}})['then'](handleEntityNotFound(_0x9e0080,null))[_0x90af('0x3d')](removeEntity(_0x9e0080,null))[_0x90af('0x41')](handleError(_0x9e0080,null));};exports['describe']=function(_0x30c0ad,_0x359912){return db['ChatTransferReport']['describe']()[_0x90af('0x3d')](respondWithResult(_0x359912,null))[_0x90af('0x41')](handleError(_0x359912,null));}; \ No newline at end of file +var _0x1826=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','save','update','then','sendStatus','error','name','index','map','ChatTransferReport','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x51ffc3,_0x5f03b2){var _0x14da54=function(_0x36eb4a){while(--_0x36eb4a){_0x51ffc3['push'](_0x51ffc3['shift']());}};_0x14da54(++_0x5f03b2);}(_0x1826,0x1da));var _0x6182=function(_0x46dc29,_0x18c45a){_0x46dc29=_0x46dc29-0x0;var _0x4bbb8d=_0x1826[_0x46dc29];return _0x4bbb8d;};'use strict';var emlformat=require(_0x6182('0x0'));var rimraf=require(_0x6182('0x1'));var zipdir=require(_0x6182('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6182('0x3'));var moment=require('moment');var BPromise=require(_0x6182('0x4'));var Mustache=require(_0x6182('0x5'));var util=require(_0x6182('0x6'));var path=require('path');var sox=require(_0x6182('0x7'));var csv=require(_0x6182('0x8'));var ejs=require(_0x6182('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6182('0xa'));var squel=require(_0x6182('0xb'));var crypto=require(_0x6182('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6182('0xd'));var toCsv=require(_0x6182('0x8'));var querystring=require('querystring');var Papa=require(_0x6182('0xe'));var Redis=require(_0x6182('0xf'));var authService=require(_0x6182('0x10'));var qs=require(_0x6182('0x11'));var as=require(_0x6182('0x12'));var hardwareService=require(_0x6182('0x13'));var logger=require(_0x6182('0x14'))(_0x6182('0x15'));var utils=require('../../config/utils');var config=require(_0x6182('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6182('0x17'))['db'];function respondWithStatusCode(_0xc5959e,_0x72f907){_0x72f907=_0x72f907||0xcc;return function(_0x3a8a0e){if(_0x3a8a0e){return _0xc5959e['sendStatus'](_0x72f907);}return _0xc5959e['status'](_0x72f907)[_0x6182('0x18')]();};}function respondWithResult(_0x4ca7a5,_0x16a30d){_0x16a30d=_0x16a30d||0xc8;return function(_0x5ef8f9){if(_0x5ef8f9){return _0x4ca7a5[_0x6182('0x19')](_0x16a30d)[_0x6182('0x1a')](_0x5ef8f9);}};}function respondWithFilteredResult(_0x3db03c,_0x53d456){return function(_0x3eb0f8){if(_0x3eb0f8){var _0x464c54=typeof _0x53d456[_0x6182('0x1b')]===_0x6182('0x1c')&&typeof _0x53d456[_0x6182('0x1d')]===_0x6182('0x1c');var _0x3a961e=_0x3eb0f8[_0x6182('0x1e')];var _0x3bd4f8=_0x464c54?0x0:_0x53d456[_0x6182('0x1b')];var _0x3876e5=_0x464c54?_0x3eb0f8['count']:_0x53d456[_0x6182('0x1b')]+_0x53d456['limit'];var _0x4c48f2;if(_0x3876e5>=_0x3a961e){_0x3876e5=_0x3a961e;_0x4c48f2=0xc8;}else{_0x4c48f2=0xce;}_0x3db03c[_0x6182('0x19')](_0x4c48f2);return _0x3db03c[_0x6182('0x1f')]('Content-Range',_0x3bd4f8+'-'+_0x3876e5+'/'+_0x3a961e)['json'](_0x3eb0f8);}return null;};}function patchUpdates(_0x2230cd){return function(_0x2995ee){try{jsonpatch['apply'](_0x2995ee,_0x2230cd,!![]);}catch(_0x2b92ad){return BPromise['reject'](_0x2b92ad);}return _0x2995ee[_0x6182('0x20')]();};}function saveUpdates(_0x373df2,_0xd722cb){return function(_0x5251ae){if(_0x5251ae){return _0x5251ae[_0x6182('0x21')](_0x373df2)[_0x6182('0x22')](function(_0x1e3e23){return _0x1e3e23;});}return null;};}function removeEntity(_0x1ab12f,_0x43c2be){return function(_0x94c7d0){if(_0x94c7d0){return _0x94c7d0['destroy']()['then'](function(){_0x1ab12f[_0x6182('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f84ce,_0xe29c0c){return function(_0x1fc60d){if(!_0x1fc60d){_0x1f84ce[_0x6182('0x23')](0x194);}return _0x1fc60d;};}function handleError(_0xb3656e,_0x34e2ae){_0x34e2ae=_0x34e2ae||0x1f4;return function(_0x282b36){logger[_0x6182('0x24')](_0x282b36['stack']);if(_0x282b36[_0x6182('0x25')]){delete _0x282b36[_0x6182('0x25')];}_0xb3656e[_0x6182('0x19')](_0x34e2ae)['send'](_0x282b36);};}exports[_0x6182('0x26')]=function(_0x3bf9c9,_0x340ba3){var _0x4dcae9={},_0x52ddea={},_0x479cb9={'count':0x0,'rows':[]};var _0x5ed5f2=_[_0x6182('0x27')](db[_0x6182('0x28')]['rawAttributes'],function(_0x418ba7){return{'name':_0x418ba7[_0x6182('0x29')],'type':_0x418ba7[_0x6182('0x2a')][_0x6182('0x2b')]};});_0x52ddea[_0x6182('0x2c')]=_[_0x6182('0x27')](_0x5ed5f2,_0x6182('0x25'));_0x52ddea['query']=_[_0x6182('0x2d')](_0x3bf9c9[_0x6182('0x2e')]);_0x52ddea[_0x6182('0x2f')]=_['intersection'](_0x52ddea[_0x6182('0x2c')],_0x52ddea['query']);_0x4dcae9['attributes']=_[_0x6182('0x30')](_0x52ddea[_0x6182('0x2c')],qs[_0x6182('0x31')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x31')]));_0x4dcae9['attributes']=_0x4dcae9['attributes'][_0x6182('0x32')]?_0x4dcae9[_0x6182('0x33')]:_0x52ddea[_0x6182('0x2c')];if(!_0x3bf9c9[_0x6182('0x2e')]['hasOwnProperty'](_0x6182('0x34'))){_0x4dcae9['limit']=qs[_0x6182('0x1d')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x1d')]);_0x4dcae9['offset']=qs[_0x6182('0x1b')](_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x1b')]);}_0x4dcae9[_0x6182('0x35')]=qs[_0x6182('0x36')](_0x3bf9c9[_0x6182('0x2e')]['sort']);_0x4dcae9[_0x6182('0x37')]=qs[_0x6182('0x2f')](_[_0x6182('0x38')](_0x3bf9c9[_0x6182('0x2e')],_0x52ddea[_0x6182('0x2f')]),_0x5ed5f2);if(_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x39')]){_0x4dcae9[_0x6182('0x37')]=_[_0x6182('0x3a')](_0x4dcae9[_0x6182('0x37')],{'$or':_['map'](_0x5ed5f2,function(_0x296a12){if(_0x296a12[_0x6182('0x2a')]!==_0x6182('0x3b')){var _0xbce622={};_0xbce622[_0x296a12[_0x6182('0x25')]]={'$like':'%'+_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x39')]+'%'};return _0xbce622;}})});}_0x4dcae9=_[_0x6182('0x3a')]({},_0x4dcae9,_0x3bf9c9['options']);var _0xa0bc8d={'where':_0x4dcae9[_0x6182('0x37')]};return db[_0x6182('0x28')][_0x6182('0x1e')](_0xa0bc8d)[_0x6182('0x22')](function(_0x37c5ad){_0x479cb9[_0x6182('0x1e')]=_0x37c5ad;if(_0x3bf9c9[_0x6182('0x2e')][_0x6182('0x3c')]){_0x4dcae9[_0x6182('0x3d')]=[{'all':!![]}];}return db[_0x6182('0x28')][_0x6182('0x3e')](_0x4dcae9);})[_0x6182('0x22')](function(_0x131bb8){_0x479cb9[_0x6182('0x3f')]=_0x131bb8;return _0x479cb9;})['then'](respondWithFilteredResult(_0x340ba3,_0x4dcae9))['catch'](handleError(_0x340ba3,null));};exports['show']=function(_0x235ff6,_0x5f5ba1){var _0x1b9e08={'raw':!![],'where':{'id':_0x235ff6['params']['id']}},_0x258797={};_0x258797[_0x6182('0x2c')]=_[_0x6182('0x2d')](db['ChatTransferReport'][_0x6182('0x40')]);_0x258797[_0x6182('0x2e')]=_[_0x6182('0x2d')](_0x235ff6[_0x6182('0x2e')]);_0x258797[_0x6182('0x2f')]=_['intersection'](_0x258797[_0x6182('0x2c')],_0x258797['query']);_0x1b9e08[_0x6182('0x33')]=_['intersection'](_0x258797[_0x6182('0x2c')],qs['fields'](_0x235ff6[_0x6182('0x2e')]['fields']));_0x1b9e08[_0x6182('0x33')]=_0x1b9e08[_0x6182('0x33')][_0x6182('0x32')]?_0x1b9e08[_0x6182('0x33')]:_0x258797[_0x6182('0x2c')];if(_0x235ff6[_0x6182('0x2e')]['includeAll']){_0x1b9e08[_0x6182('0x3d')]=[{'all':!![]}];}_0x1b9e08=_[_0x6182('0x3a')]({},_0x1b9e08,_0x235ff6['options']);return db['ChatTransferReport'][_0x6182('0x41')](_0x1b9e08)[_0x6182('0x22')](handleEntityNotFound(_0x5f5ba1,null))[_0x6182('0x22')](respondWithResult(_0x5f5ba1,null))[_0x6182('0x42')](handleError(_0x5f5ba1,null));};exports['create']=function(_0x15315b,_0x5b8ab6){return db[_0x6182('0x28')][_0x6182('0x43')](_0x15315b[_0x6182('0x44')],{})[_0x6182('0x22')](respondWithResult(_0x5b8ab6,0xc9))[_0x6182('0x42')](handleError(_0x5b8ab6,null));};exports[_0x6182('0x21')]=function(_0x12e5c9,_0x49c251){if(_0x12e5c9['body']['id']){delete _0x12e5c9[_0x6182('0x44')]['id'];}return db['ChatTransferReport'][_0x6182('0x41')]({'where':{'id':_0x12e5c9[_0x6182('0x45')]['id']}})[_0x6182('0x22')](handleEntityNotFound(_0x49c251,null))[_0x6182('0x22')](saveUpdates(_0x12e5c9['body'],null))[_0x6182('0x22')](respondWithResult(_0x49c251,null))[_0x6182('0x42')](handleError(_0x49c251,null));};exports['destroy']=function(_0x298228,_0x18eaf4){return db['ChatTransferReport']['find']({'where':{'id':_0x298228[_0x6182('0x45')]['id']}})['then'](handleEntityNotFound(_0x18eaf4,null))[_0x6182('0x22')](removeEntity(_0x18eaf4,null))[_0x6182('0x42')](handleError(_0x18eaf4,null));};exports['describe']=function(_0x218246,_0x2ef36e){return db[_0x6182('0x28')][_0x6182('0x46')]()[_0x6182('0x22')](respondWithResult(_0x2ef36e,null))[_0x6182('0x42')](handleError(_0x2ef36e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a5b150e..401b278 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 _0x2124=['ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x136d07,_0x5327b9){var _0x221820=function(_0x20979c){while(--_0x20979c){_0x136d07['push'](_0x136d07['shift']());}};_0x221820(++_0x5327b9);}(_0x2124,0x1ed));var _0x4212=function(_0x586a84,_0x473acb){_0x586a84=_0x586a84-0x0;var _0xc936a1=_0x2124[_0x586a84];return _0xc936a1;};'use strict';var _=require('lodash');var util=require(_0x4212('0x0'));var logger=require(_0x4212('0x1'))(_0x4212('0x2'));var moment=require(_0x4212('0x3'));var BPromise=require('bluebird');var rp=require(_0x4212('0x4'));var fs=require('fs');var path=require(_0x4212('0x5'));var rimraf=require(_0x4212('0x6'));var config=require(_0x4212('0x7'));var attributes=require(_0x4212('0x8'));module[_0x4212('0x9')]=function(_0x1ac6c8,_0x1fd0a4){return _0x1ac6c8[_0x4212('0xa')](_0x4212('0xb'),attributes,{'tableName':_0x4212('0xc'),'paranoid':![],'indexes':[{'name':_0x4212('0xd'),'fields':[_0x4212('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c7d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7d,0x186));var _0xd8c7=function(_0x1a94a9,_0x61a77d){_0x1a94a9=_0x1a94a9-0x0;var _0x2118f2=_0x8c7d[_0x1a94a9];return _0x2118f2;};'use strict';var _=require(_0xd8c7('0x0'));var util=require(_0xd8c7('0x1'));var logger=require(_0xd8c7('0x2'))(_0xd8c7('0x3'));var moment=require(_0xd8c7('0x4'));var BPromise=require(_0xd8c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c7('0x6'));var rimraf=require(_0xd8c7('0x7'));var config=require(_0xd8c7('0x8'));var attributes=require(_0xd8c7('0x9'));module['exports']=function(_0x1e77c6,_0x1eeba3){return _0x1e77c6[_0xd8c7('0xa')](_0xd8c7('0xb'),attributes,{'tableName':_0xd8c7('0xc'),'paranoid':![],'indexes':[{'name':_0xd8c7('0xd'),'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 abd8a8e..e934727 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 _0x24db=['http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x867d54,_0x5ce02d){var _0x57daa1=function(_0x190199){while(--_0x190199){_0x867d54['push'](_0x867d54['shift']());}};_0x57daa1(++_0x5ce02d);}(_0x24db,0x195));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var util=require(_0xb24d('0x1'));var moment=require(_0xb24d('0x2'));var BPromise=require('bluebird');var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require(_0xb24d('0x4'));var db=require(_0xb24d('0x5'))['db'];var utils=require(_0xb24d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb24d('0x7'));var jayson=require(_0xb24d('0x8'));var client=jayson['client'][_0xb24d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf29342,_0x775165,_0x289872){return new BPromise(function(_0x10d755,_0x432428){return client[_0xb24d('0xa')](_0xf29342,_0x289872)[_0xb24d('0xb')](function(_0x36a2c5){logger[_0xb24d('0xc')](_0xb24d('0xd'),_0x775165,'request\x20sent');logger[_0xb24d('0xe')](_0xb24d('0xf'),_0x775165,_0xb24d('0x10'),JSON[_0xb24d('0x11')](_0x36a2c5));if(_0x36a2c5['error']){if(_0x36a2c5[_0xb24d('0x12')][_0xb24d('0x13')]===0x1f4){logger[_0xb24d('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x775165,_0x36a2c5['error'][_0xb24d('0x14')]);return _0x432428(_0x36a2c5[_0xb24d('0x12')][_0xb24d('0x14')]);}logger[_0xb24d('0x12')](_0xb24d('0xd'),_0x775165,_0x36a2c5[_0xb24d('0x12')][_0xb24d('0x14')]);return _0x10d755(_0x36a2c5[_0xb24d('0x12')][_0xb24d('0x14')]);}else{logger[_0xb24d('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x775165,_0xb24d('0x10'));_0x10d755(_0x36a2c5[_0xb24d('0x15')][_0xb24d('0x14')]);}})[_0xb24d('0x16')](function(_0x31b192){logger[_0xb24d('0x12')](_0xb24d('0xd'),_0x775165,_0x31b192);_0x432428(_0x31b192);});});} \ No newline at end of file +var _0xcbd8=['request\x20sent','debug','error','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcbd8,0x1c7));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8cbd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8cbd('0x1'));var fs=require('fs');var Redis=require(_0x8cbd('0x2'));var db=require(_0x8cbd('0x3'))['db'];var utils=require(_0x8cbd('0x4'));var logger=require(_0x8cbd('0x5'))(_0x8cbd('0x6'));var config=require(_0x8cbd('0x7'));var jayson=require(_0x8cbd('0x8'));var client=jayson['client'][_0x8cbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238fa5,_0x32f493,_0x2d6267){return new BPromise(function(_0x4f1194,_0x48726a){return client[_0x8cbd('0xa')](_0x238fa5,_0x2d6267)['then'](function(_0x5864cb){logger[_0x8cbd('0xb')](_0x8cbd('0xc'),_0x32f493,_0x8cbd('0xd'));logger[_0x8cbd('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x32f493,'request\x20sent',JSON['stringify'](_0x5864cb));if(_0x5864cb['error']){if(_0x5864cb[_0x8cbd('0xf')]['code']===0x1f4){logger['error'](_0x8cbd('0xc'),_0x32f493,_0x5864cb['error']['message']);return _0x48726a(_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);}logger['error'](_0x8cbd('0xc'),_0x32f493,_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);return _0x4f1194(_0x5864cb[_0x8cbd('0xf')][_0x8cbd('0x10')]);}else{logger[_0x8cbd('0xb')](_0x8cbd('0xc'),_0x32f493,_0x8cbd('0xd'));_0x4f1194(_0x5864cb['result']['message']);}})[_0x8cbd('0x11')](function(_0x4eef43){logger[_0x8cbd('0xf')](_0x8cbd('0xc'),_0x32f493,_0x4eef43);_0x48726a(_0x4eef43);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fcb4740..bb8c8d0 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 _0xd224=['/describe','isAuthenticated','show','create','put','/:id','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','index'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd224,0x68));var _0x4d22=function(_0x6c849e,_0xa46b3e){_0x6c849e=_0x6c849e-0x0;var _0x350b9e=_0xd224[_0x6c849e];return _0x350b9e;};'use strict';var multer=require(_0x4d22('0x0'));var util=require(_0x4d22('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d22('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4d22('0x3'));var interaction=require(_0x4d22('0x4'));var config=require('../../config/environment');var controller=require(_0x4d22('0x5'));router[_0x4d22('0x6')]('/',auth['isAuthenticated'](),controller[_0x4d22('0x7')]);router[_0x4d22('0x6')](_0x4d22('0x8'),auth[_0x4d22('0x9')](),controller['describe']);router[_0x4d22('0x6')]('/:id',auth[_0x4d22('0x9')](),controller[_0x4d22('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4d22('0xb')]);router[_0x4d22('0xc')](_0x4d22('0xd'),auth[_0x4d22('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4d22('0xe')]);module[_0x4d22('0xf')]=router; \ No newline at end of file +var _0xf583=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','isAuthenticated','show','put','/:id','update','exports','multer','util'];(function(_0x325dee,_0xb67e1f){var _0xc05924=function(_0x41ef66){while(--_0x41ef66){_0x325dee['push'](_0x325dee['shift']());}};_0xc05924(++_0xb67e1f);}(_0xf583,0x12a));var _0x3f58=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xf583[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f58('0x2'));var router=express['Router']();var fs_extra=require(_0x3f58('0x3'));var auth=require(_0x3f58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f58('0x5'));var controller=require(_0x3f58('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3f58('0x7')]);router[_0x3f58('0x8')]('/describe',auth[_0x3f58('0x9')](),controller['describe']);router['get']('/:id',auth[_0x3f58('0x9')](),controller[_0x3f58('0xa')]);router['post']('/',auth[_0x3f58('0x9')](),controller['create']);router[_0x3f58('0xb')](_0x3f58('0xc'),auth['isAuthenticated'](),controller[_0x3f58('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3f58('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 78b2902..9c51e61 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 _0x7d2a=['rounded','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x7d2a,0x1d5));var _0xa7d2=function(_0x508b30,_0x3c7062){_0x508b30=_0x508b30-0x0;var _0x636427=_0x7d2a[_0x508b30];return _0x636427;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa7d2('0x0'));module[_0xa7d2('0x1')]={'name':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'unique':_0xa7d2('0x3')},'description':{'type':Sequelize[_0xa7d2('0x2')]},'mapKey':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x4')},'key':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa7d2('0x5')},'customerAlias':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'defaultValue':_0xa7d2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa7d2('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'defaultValue':_0xa7d2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa7d2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa7d2('0x2')]},'animation':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa7d2('0xa')]('rounded','squared'),'defaultValue':_0xa7d2('0xb')},'header_online':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0xc')},'header_offline':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0xd')},'download_transcript':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa7d2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa7d2('0xf')]},'closingQuestion':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa7d2('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa7d2('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x14')},'conditionAgreement':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0xa7d2('0x16'),_0xa7d2('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa7d2('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa7d2('0x18'),'variable':null,'config':{'placeholder':_0xa7d2('0x19'),'type':_0xa7d2('0x1a'),'required':!![]},'props':{'title':_0xa7d2('0x19'),'helpText':''}},{'type':_0xa7d2('0x18'),'props':{'title':_0xa7d2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa7d2('0x4'),'type':_0xa7d2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa7d2('0x1b')](_0xa7d2('0x1c'))?JSON[_0xa7d2('0x1d')](this['getDataValue'](_0xa7d2('0x1c'))):{};},'set':function(_0x2c15b9){return this[_0xa7d2('0x1e')](_0xa7d2('0x1c'),JSON[_0xa7d2('0x1f')](_0x2c15b9));}},'offlineForm':{'type':Sequelize[_0xa7d2('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa7d2('0x18'),'props':{'title':_0xa7d2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xa7d2('0x4')},'variable':null},{'type':_0xa7d2('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0xa7d2('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xa7d2('0x22'))?JSON[_0xa7d2('0x1d')](this['getDataValue'](_0xa7d2('0x22'))):{};},'set':function(_0x48b587){return this[_0xa7d2('0x1e')](_0xa7d2('0x22'),JSON['stringify'](_0x48b587));}},'token':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':function(){return rs[_0xa7d2('0x23')]();}},'autoclose':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa7d2('0x2')]},'waitingTitle':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x24')},'waitingMessage':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x26')},'offlineMessageBody':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x27')},'skipUnmanaged':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa7d2('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa7d2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa7d2('0x28');}},'notificationSound':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa7d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa7d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':_0xa7d2('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xa7d2('0x2a')},'defaultTitle':{'type':Sequelize[_0xa7d2('0x2')]},'customerAvatar':{'type':Sequelize[_0xa7d2('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa7d2('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'defaultValue':_0xa7d2('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xa7d2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7d2('0x8')],'comment':_0xa7d2('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b6b40){if(!_0x4b6b40)this[_0xa7d2('0x1e')](_0xa7d2('0x2d'),null);this[_0xa7d2('0x1e')](_0xa7d2('0x2e'),_0x4b6b40);}},'vidaooEscalation':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa7d2('0x2')]},'vidaooTopic':{'type':Sequelize[_0xa7d2('0x2')],'allowNull':![],'defaultValue':_0xa7d2('0x2f')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xa7d2('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa7d2('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa7d2('0xf')]}}; \ No newline at end of file +var _0xab74=['Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','INTEGER','stringify','input','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x48ed9a,_0x3ebf20){var _0x69bc41=function(_0x2b7208){while(--_0x2b7208){_0x48ed9a['push'](_0x48ed9a['shift']());}};_0x69bc41(++_0x3ebf20);}(_0xab74,0x85));var _0x4ab7=function(_0x3bebeb,_0x3d9919){_0x3bebeb=_0x3bebeb-0x0;var _0x3e81c4=_0xab74[_0x3bebeb];return _0x3e81c4;};'use strict';var Sequelize=require(_0x4ab7('0x0'));var rs=require(_0x4ab7('0x1'));module['exports']={'name':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'unique':_0x4ab7('0x3')},'description':{'type':Sequelize[_0x4ab7('0x2')]},'mapKey':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x4')},'key':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4ab7('0x2')]},'animation':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4ab7('0x7')](_0x4ab7('0x8'),_0x4ab7('0x9')),'defaultValue':_0x4ab7('0x8')},'header_online':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xa')},'start_chat_button':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xb')},'offline_chat_button':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'header_offline':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4ab7('0xf')]},'closingQuestion':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x10')},'placeholderMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x11')},'closingMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x12')},'closingMessageButton':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'skipMessageButton':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4ab7('0x13')},'ratingType':{'type':Sequelize[_0x4ab7('0x7')]('star','thumb'),'defaultValue':_0x4ab7('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return JSON[_0x4ab7('0x16')]({'items':[{'type':_0x4ab7('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x4ab7('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x4ab7('0x17'),'props':{'title':_0x4ab7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4ab7('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4ab7('0x19')](_0x4ab7('0x1a'))?JSON['parse'](this['getDataValue'](_0x4ab7('0x1a'))):{};},'set':function(_0xb71604){return this['setDataValue'](_0x4ab7('0x1a'),JSON[_0x4ab7('0x16')](_0xb71604));}},'offlineForm':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x4ab7('0x17'),'props':{'title':_0x4ab7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4ab7('0x4'),'type':'email'},'variable':null},{'type':_0x4ab7('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0x4ab7('0x1c'),'helpText':_0x4ab7('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x4ab7('0x19')](_0x4ab7('0x1e'))?JSON[_0x4ab7('0x1f')](this['getDataValue'](_0x4ab7('0x1e'))):{};},'set':function(_0x3c6570){return this[_0x4ab7('0x20')](_0x4ab7('0x1e'),JSON[_0x4ab7('0x16')](_0x3c6570));}},'token':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':function(){return rs[_0x4ab7('0x21')]();}},'autoclose':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4ab7('0x2')]},'forwardOffline':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4ab7('0x2')]},'waitingTitle':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x23')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x24')},'sendUnmanaged':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4ab7('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':function(){return _0x4ab7('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x27')},'messagesAlignment':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x28')},'defaultTitle':{'type':Sequelize[_0x4ab7('0x2')]},'customerAvatar':{'type':Sequelize[_0x4ab7('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4ab7('0x15')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4ab7('0x2')],'allowNull':![],'defaultValue':_0x4ab7('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4ab7('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4ab7('0x2')],'defaultValue':_0x4ab7('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ab7('0x15')],'comment':_0x4ab7('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![],'comment':_0x4ab7('0x2c'),'set':function(_0x533e52){if(!_0x533e52)this['setDataValue'](_0x4ab7('0x2d'),null);this[_0x4ab7('0x20')](_0x4ab7('0x2e'),_0x533e52);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4ab7('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x4ab7('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4ab7('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0e060e8..c9e24fc 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 _0x81bd=['autoclose','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','CompanyId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','Smtp','mimetype','subjectOffline','mapValues','offlineMessageSubject','Chat','MailAccountId','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','UserProfileResource','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','params','Pause','options','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','ids','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','createdAt','includes','updatedAt','ListId','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','contact','threadId','closed','externalUrl','ContactId','interaction','ChatInteraction','Writing\x20on\x20closed\x20interaction','messageId','created'];(function(_0x4a7486,_0x52ad56){var _0xf7db41=function(_0x40a0bd){while(--_0x40a0bd){_0x4a7486['push'](_0x4a7486['shift']());}};_0xf7db41(++_0x52ad56);}(_0x81bd,0x7c));var _0xd81b=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x81bd[_0x49258d];return _0x2a9044;};'use strict';var Mustache=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var ejs=require(_0xd81b('0x3'));var fs=require('fs');var fs_extra=require(_0xd81b('0x4'));var _=require(_0xd81b('0x5'));var querystring=require(_0xd81b('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xd81b('0x7'));var jayson=require(_0xd81b('0x8'));var qs=require(_0xd81b('0x9'));var logger=require('../../config/logger')(_0xd81b('0xa'));var config=require(_0xd81b('0xb'));var APIBadRequestError=require(_0xd81b('0xc'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xd81b('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0xd81b('0xe')];var APIHandleError=require(_0xd81b('0xc'))[_0xd81b('0xf')];var APIConflictError=require(_0xd81b('0xc'))[_0xd81b('0x10')];var wildcardUtils=require(_0xd81b('0x11'));var URL=require(_0xd81b('0x12'))[_0xd81b('0x13')];var db=require(_0xd81b('0x14'))['db'];config[_0xd81b('0x15')]=_[_0xd81b('0x16')](config[_0xd81b('0x15')],{'host':_0xd81b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0x15')]));require('./chatWebsite.socket')[_0xd81b('0x18')](socket);var client=jayson[_0xd81b('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xd81b('0x19')]['http']({'port':0x232a});var client9003=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x232b});var client9001=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x128162,_0x552215,_0x1c620d,_0x27b7a0){return new Promise(function(_0x5c2863,_0x2abef4){var _0x26df61=_0x27b7a0||client;return _0x26df61[_0xd81b('0x1b')](_0x128162,_0x1c620d)[_0xd81b('0x1c')](function(_0x5f7db6){logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));logger[_0xd81b('0x20')](_0xd81b('0x21'),_0x552215,_0xd81b('0x1f'),JSON[_0xd81b('0x22')](_0x5f7db6));if(_0x5f7db6[_0xd81b('0x23')]){if(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x24')]===0x1f4){logger[_0xd81b('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x552215,_0x5f7db6['error'][_0xd81b('0x25')]);return _0x2abef4(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}logger['error'](_0xd81b('0x1e'),_0x552215,_0x5f7db6[_0xd81b('0x23')]['message']);return _0x5c2863(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}else{logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));_0x5c2863(_0x5f7db6[_0xd81b('0x26')][_0xd81b('0x25')]);}})[_0xd81b('0x27')](function(_0x341aec){logger[_0xd81b('0x23')](_0xd81b('0x1e'),_0x552215,_0x341aec);_0x2abef4(_0x341aec);});});}function respondWithStatusCode(_0x1bf351,_0x596389){_0x596389=_0x596389||0xcc;return function(_0x28768f){if(_0x28768f){return _0x1bf351[_0xd81b('0x28')](_0x596389);}return _0x1bf351[_0xd81b('0x29')](_0x596389)[_0xd81b('0x2a')]();};}function respondWithResult(_0x3266c2,_0x2d0d02){_0x2d0d02=_0x2d0d02||0xc8;return function(_0x3e28dd){if(_0x3e28dd){return _0x3266c2[_0xd81b('0x29')](_0x2d0d02)[_0xd81b('0x2b')](_0x3e28dd);}};}function respondWithFilteredResult(_0x483a3d,_0x469cc4){return function(_0x4e2eff){if(_0x4e2eff){var _0x5c8aee=typeof _0x469cc4[_0xd81b('0x2c')]===_0xd81b('0x2d')&&typeof _0x469cc4['limit']==='undefined';var _0x4093c8=_0x4e2eff[_0xd81b('0x2e')];var _0x1b1434=_0x5c8aee?0x0:_0x469cc4[_0xd81b('0x2c')];var _0x1a1572=_0x5c8aee?_0x4e2eff[_0xd81b('0x2e')]:_0x469cc4['offset']+_0x469cc4[_0xd81b('0x2f')];var _0x26f629;if(_0x1a1572>=_0x4093c8){_0x1a1572=_0x4093c8;_0x26f629=0xc8;}else{_0x26f629=0xce;}_0x483a3d['status'](_0x26f629);return _0x483a3d['set'](_0xd81b('0x30'),_0x1b1434+'-'+_0x1a1572+'/'+_0x4093c8)[_0xd81b('0x2b')](_0x4e2eff);}return null;};}function saveUpdates(_0x50472a){return function(_0x50ce25){if(_0x50ce25){return _0x50ce25['update'](_0x50472a)[_0xd81b('0x1c')](function(_0x3ead68){return _0x3ead68;});}return null;};}function removeEntity(_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x31')]()[_0xd81b('0x1c')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='ChatWebsites';return db[_0xd81b('0x32')][_0xd81b('0x31')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1c')](function(){return _0x1c4cf7;});})[_0xd81b('0x1c')](function(){_0x1d2f46[_0xd81b('0x29')](0xcc)[_0xd81b('0x2a')]();});}};}function handleEntityNotFound(_0x1c20d3){return function(_0x2d23b9){if(!_0x2d23b9){_0x1c20d3[_0xd81b('0x28')](0x194);}return _0x2d23b9;};}function handleError(_0xe88a33,_0x1be4e2){_0x1be4e2=_0x1be4e2||0x1f4;return function(_0x3c8371){logger[_0xd81b('0x23')](_0x3c8371['stack']);if(_0x3c8371['name']){delete _0x3c8371[_0xd81b('0x33')];}_0xe88a33[_0xd81b('0x29')](_0x1be4e2)[_0xd81b('0x34')](_0x3c8371);};}function createInteractionObject(_0x59c066,_0x362ebc,_0x37ba34,_0x5a236a){var _0x46f058=require(_0xd81b('0x35'));var _0x512e39=new _0x46f058();var _0xed5272=_0x512e39['setUA'](_0x37ba34[_0xd81b('0x36')])[_0xd81b('0x37')]();var _0x203365=_0x362ebc[_0xd81b('0x38')];if(_0x37ba34['cf-connecting-ip']){_0x203365=_0x37ba34[_0xd81b('0x39')];}else if(_0x37ba34[_0xd81b('0x3a')]){_0x203365=_[_0xd81b('0x3b')](_0x37ba34[_0xd81b('0x3a')][_0xd81b('0x3c')](','));}return{'ContactId':_0x5a236a['id'],'ChatWebsiteId':_0x59c066,'from':(_0x5a236a[_0xd81b('0x3d')]||'')+'\x20'+(_0x5a236a[_0xd81b('0x3e')]||''),'customerIp':_0x203365,'customerPort':_0x37ba34['x-real-port']?_0x37ba34[_0xd81b('0x3f')]:null,'referer':_0x362ebc[_0xd81b('0x40')],'browserName':_0xed5272[_0xd81b('0x41')]['name']&&_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]?util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272[_0xd81b('0x41')]['name'],_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]):_0xd81b('0x45'),'browserVersion':_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]||_0xd81b('0x45'),'osName':util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272['os'][_0xd81b('0x33')],_0xed5272['os'][_0xd81b('0x42')]),'osVersion':_0xed5272['os'][_0xd81b('0x42')],'deviceModel':_0xed5272['device'][_0xd81b('0x46')]&&_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')]?util[_0xd81b('0x43')](_0xd81b('0x49'),_0xed5272[_0xd81b('0x47')][_0xd81b('0x46')],_0xed5272[_0xd81b('0x47')]['vendor'],_0xed5272['device'][_0xd81b('0x4a')]):null,'deviceVendor':_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')],'deviceType':_0xed5272[_0xd81b('0x47')][_0xd81b('0x4a')],'formData':JSON[_0xd81b('0x22')](_0x362ebc)};}exports[_0xd81b('0x4b')]=function(_0x2e44f3,_0x2fa588){var _0xcfbbc2={'include':[{'model':db['Pause'],'as':_0xd81b('0x4c')}]},_0x41e2e6={},_0x38e436={'count':0x0,'rows':[]};var _0x2b61fc=_[_0xd81b('0x4d')](db[_0xd81b('0x4e')][_0xd81b('0x4f')],function(_0x410ef3){return{'name':_0x410ef3[_0xd81b('0x50')],'type':_0x410ef3[_0xd81b('0x4a')][_0xd81b('0x51')]};});_0x41e2e6['model']=_[_0xd81b('0x4d')](_0x2b61fc,_0xd81b('0x33'));_0x41e2e6[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x2e44f3['query']);_0x41e2e6[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],_0x41e2e6[_0xd81b('0x52')]);_0xcfbbc2[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x2e44f3[_0xd81b('0x52')]['fields']));_0xcfbbc2['attributes']=_0xcfbbc2[_0xd81b('0x56')][_0xd81b('0x58')]?_0xcfbbc2[_0xd81b('0x56')]:_0x41e2e6[_0xd81b('0x46')];if(!_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0xcfbbc2[_0xd81b('0x2f')]=qs['limit'](_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x2f')]);_0xcfbbc2[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x2e44f3[_0xd81b('0x52')]['offset']);}_0xcfbbc2[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x2e44f3['query'][_0xd81b('0x5c')]);_0xcfbbc2[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x2e44f3[_0xd81b('0x52')],_0x41e2e6[_0xd81b('0x54')]),_0x2b61fc);if(_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]){_0xcfbbc2[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0xcfbbc2[_0xd81b('0x5d')],{'$or':_['map'](_0x2b61fc,function(_0x285e82){if(_0x285e82['type']!==_0xd81b('0x61')){var _0x7b438c={};_0x7b438c[_0x285e82[_0xd81b('0x33')]]={'$like':'%'+_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x7b438c;}})});}_0xcfbbc2=_[_0xd81b('0x60')]({},_0xcfbbc2,_0x2e44f3['options']);var _0x2d978d={'where':_0xcfbbc2[_0xd81b('0x5d')]};return db['ChatWebsite']['count'](_0x2d978d)[_0xd81b('0x1c')](function(_0x59e018){_0x38e436[_0xd81b('0x2e')]=_0x59e018;if(_0x2e44f3['query'][_0xd81b('0x62')]){_0xcfbbc2[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x4e')]['findAll'](_0xcfbbc2);})[_0xd81b('0x1c')](function(_0x10ed99){_0x38e436['rows']=_0x10ed99;return _0x38e436;})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2fa588,_0xcfbbc2))[_0xd81b('0x27')](handleError(_0x2fa588,null));};exports['show']=function(_0x1ba5d6,_0x5e1cd7){var _0x3c9264={'raw':![],'where':{'id':_0x1ba5d6[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':_0xd81b('0x4c')}]},_0x31553e={};_0x31553e[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x4e')][_0xd81b('0x4f')]);_0x31553e[_0xd81b('0x52')]=_['keys'](_0x1ba5d6[_0xd81b('0x52')]);_0x31553e[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x31553e[_0xd81b('0x46')],_0x31553e[_0xd81b('0x52')]);_0x3c9264[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x31553e['model'],qs['fields'](_0x1ba5d6['query'][_0xd81b('0x57')]));_0x3c9264[_0xd81b('0x56')]=_0x3c9264[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3c9264[_0xd81b('0x56')]:_0x31553e[_0xd81b('0x46')];if(_0x1ba5d6[_0xd81b('0x52')]['includeAll']){_0x3c9264[_0xd81b('0x63')]=[{'all':!![]}];}_0x3c9264=_[_0xd81b('0x60')]({},_0x3c9264,_0x1ba5d6[_0xd81b('0x66')]);return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x3c9264)[_0xd81b('0x1c')](handleEntityNotFound(_0x5e1cd7,null))[_0xd81b('0x1c')](respondWithResult(_0x5e1cd7,null))['catch'](handleError(_0x5e1cd7,null));};exports[_0xd81b('0x68')]=function(_0x15f003,_0x12b2a7){var _0x8cf25d=null;_0x15f003[_0xd81b('0x69')][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x8fa8cd=>{if(_0x8fa8cd[_0xd81b('0x6c')]()!==''&&!wildcardUtils[_0xd81b('0x6d')](_0x8fa8cd[_0xd81b('0x6c')]())){_0x8cf25d=new APIBadRequestError('\x22'+_0x8fa8cd['trim']()+_0xd81b('0x6e'));}});if(_0x8cf25d){return handleError(_0x12b2a7,null)(_0x8cf25d);}return db['ChatWebsite'][_0xd81b('0x68')](_0x15f003[_0xd81b('0x69')],{})[_0xd81b('0x1c')](function(_0xc3c117){var _0xb94a69=_0x15f003[_0xd81b('0x6f')][_0xd81b('0x70')]({'plain':!![]});if(!_0xb94a69)throw new Error(_0xd81b('0x71'));if(_0xb94a69[_0xd81b('0x72')]===_0xd81b('0x6f')){var _0x5bcfd7=_0xc3c117[_0xd81b('0x70')]({'plain':!![]});var _0x344c32=_0xd81b('0x73');return db[_0xd81b('0x74')][_0xd81b('0x67')]({'where':{'name':_0x344c32,'userProfileId':_0xb94a69['userProfileId']},'raw':!![]})['then'](function(_0x3274d2){if(_0x3274d2&&_0x3274d2[_0xd81b('0x75')]===0x0){return db[_0xd81b('0x32')][_0xd81b('0x68')]({'name':_0x5bcfd7[_0xd81b('0x33')],'resourceId':_0x5bcfd7['id'],'type':_0x3274d2[_0xd81b('0x33')],'sectionId':_0x3274d2['id']},{})[_0xd81b('0x1c')](function(){return _0xc3c117;});}else{return _0xc3c117;}})['catch'](function(_0x2190df){logger[_0xd81b('0x23')](_0xd81b('0x76'),_0x2190df);throw _0x2190df;});}return _0xc3c117;})[_0xd81b('0x1c')](respondWithResult(_0x12b2a7,0xc9))[_0xd81b('0x27')](handleError(_0x12b2a7,null));};exports[_0xd81b('0x77')]=function(_0x1e0da3,_0x185f28){var _0x2315db=null;_0x1e0da3['body'][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x9c30e7=>{if(_0x9c30e7[_0xd81b('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x9c30e7[_0xd81b('0x6c')]())){_0x2315db=new APIBadRequestError('\x22'+_0x9c30e7[_0xd81b('0x6c')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2315db){return handleError(_0x185f28,null)(_0x2315db);}if(_0x1e0da3[_0xd81b('0x69')]['id']){delete _0x1e0da3[_0xd81b('0x69')]['id'];}return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x1e0da3[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':'mandatoryDispositionPause'}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x185f28,null))[_0xd81b('0x1c')](saveUpdates(_0x1e0da3[_0xd81b('0x69')],null))['then'](respondWithResult(_0x185f28,null))['catch'](handleError(_0x185f28,null));};exports[_0xd81b('0x31')]=function(_0x950cc3,_0x36c694){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x950cc3[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x36c694,null))[_0xd81b('0x1c')](removeEntity(_0x36c694,null))['catch'](handleError(_0x36c694,null));};exports['describe']=function(_0x42ae01,_0x256696){return db[_0xd81b('0x4e')][_0xd81b('0x78')]()['then'](respondWithResult(_0x256696,null))[_0xd81b('0x27')](handleError(_0x256696,null));};exports[_0xd81b('0x79')]=function(_0x4b8294,_0x46e36b){if(_0x4b8294['body']['id']){delete _0x4b8294[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x4b8294[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x46e36b,null))[_0xd81b('0x1c')](function(_0x2490f1){if(_0x2490f1){_0x4b8294[_0xd81b('0x69')]['ChatWebsiteId']=_0x2490f1['id'];return db[_0xd81b('0x7a')][_0xd81b('0x68')](_0x4b8294[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x46e36b,null))[_0xd81b('0x27')](handleError(_0x46e36b,null));};exports[_0xd81b('0x7b')]=function(_0x579052,_0x5c8ea0){var _0x31509d={'raw':![],'where':{}};var _0x3023d9={};var _0x97bd3e={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x579052[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x5c8ea0,null))[_0xd81b('0x1c')](function(_0x195f1c){if(_0x195f1c){_0x3023d9[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0x7a')][_0xd81b('0x4f')]);_0x3023d9[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x579052[_0xd81b('0x52')]);_0x3023d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x3023d9['model'],_0x3023d9[_0xd81b('0x52')]);_0x31509d[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x3023d9[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x579052[_0xd81b('0x52')]['fields']));_0x31509d[_0xd81b('0x56')]=_0x31509d['attributes'][_0xd81b('0x58')]?_0x31509d[_0xd81b('0x56')]:_0x3023d9[_0xd81b('0x46')];if(!_0x579052['query'][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31509d[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x579052[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x31509d['offset']=qs[_0xd81b('0x2c')](_0x579052['query']['offset']);}_0x31509d[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x579052[_0xd81b('0x52')]['sort']);_0x31509d[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x579052[_0xd81b('0x52')],_0x3023d9[_0xd81b('0x54')]));_0x31509d[_0xd81b('0x5d')]['ChatWebsiteId']=_0x195f1c['id'];if(_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31509d[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31509d[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x31509d[_0xd81b('0x56')],function(_0x270d82){var _0x380951={};_0x380951[_0x270d82]={'$like':'%'+_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x380951;})});}_0x31509d=_[_0xd81b('0x60')]({},_0x31509d,_0x579052[_0xd81b('0x66')]);return db[_0xd81b('0x7a')][_0xd81b('0x2e')]({'where':_0x31509d['where']})[_0xd81b('0x1c')](function(_0x47f90e){_0x97bd3e[_0xd81b('0x2e')]=_0x47f90e;if(_0x579052[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31509d[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x7a')][_0xd81b('0x7c')](_0x31509d);})['then'](function(_0x3a41e6){_0x97bd3e[_0xd81b('0x7d')]=_0x3a41e6;return _0x97bd3e;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x5c8ea0,_0x31509d))[_0xd81b('0x27')](handleError(_0x5c8ea0,null));};exports[_0xd81b('0x7e')]=function(_0x6e4c25,_0x2481e9){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x6e4c25[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2481e9,null))[_0xd81b('0x1c')](function(_0x5a02f7){if(_0x5a02f7){return _0x5a02f7[_0xd81b('0x7e')](_0x6e4c25[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x2481e9,null))[_0xd81b('0x27')](handleError(_0x2481e9,null));};exports['addAnswer']=function(_0x421c2b,_0x1e61d8){if(_0x421c2b[_0xd81b('0x69')]['id']){delete _0x421c2b[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x421c2b['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x1e61d8,null))['then'](function(_0x4461f3){if(_0x4461f3){_0x421c2b[_0xd81b('0x69')][_0xd81b('0x80')]=_0x4461f3['id'];return db[_0xd81b('0x81')]['create'](_0x421c2b[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x1e61d8,null))['catch'](handleError(_0x1e61d8,null));};exports[_0xd81b('0x82')]=function(_0x142d78,_0x2c1a0e){var _0x1c6291={'raw':![],'where':{}};var _0x2f9a9f={};var _0x4c8925={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x83')]({'where':{'id':_0x142d78['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2c1a0e,null))['then'](function(_0x509001){if(_0x509001){_0x2f9a9f[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['CannedAnswer']['rawAttributes']);_0x2f9a9f[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x142d78['query']);_0x2f9a9f[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],_0x2f9a9f[_0xd81b('0x52')]);_0x1c6291['attributes']=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x142d78['query']['fields']));_0x1c6291[_0xd81b('0x56')]=_0x1c6291[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c6291[_0xd81b('0x56')]:_0x2f9a9f[_0xd81b('0x46')];if(!_0x142d78['query']['hasOwnProperty'](_0xd81b('0x5a'))){_0x1c6291[_0xd81b('0x2f')]=qs['limit'](_0x142d78['query'][_0xd81b('0x2f')]);_0x1c6291[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x1c6291[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c6291[_0xd81b('0x5d')]=qs['filters'](_['pick'](_0x142d78[_0xd81b('0x52')],_0x2f9a9f[_0xd81b('0x54')]));_0x1c6291[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x509001['id'];if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c6291[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x1c6291[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x1c6291[_0xd81b('0x56')],function(_0x32e484){var _0x30fb62={};_0x30fb62[_0x32e484]={'$like':'%'+_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x30fb62;})});}_0x1c6291=_['merge']({},_0x1c6291,_0x142d78[_0xd81b('0x66')]);return db[_0xd81b('0x81')][_0xd81b('0x2e')]({'where':_0x1c6291['where']})[_0xd81b('0x1c')](function(_0x3bd28c){_0x4c8925[_0xd81b('0x2e')]=_0x3bd28c;if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x62')]){_0x1c6291['include']=[{'all':!![]}];}return db[_0xd81b('0x81')][_0xd81b('0x7c')](_0x1c6291);})[_0xd81b('0x1c')](function(_0x30fe56){_0x4c8925[_0xd81b('0x7d')]=_0x30fe56;return _0x4c8925;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2c1a0e,_0x1c6291))[_0xd81b('0x27')](handleError(_0x2c1a0e,null));};exports[_0xd81b('0x84')]=function(_0x1c3ea4,_0x282e83){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x1c3ea4['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x282e83,null))[_0xd81b('0x1c')](function(_0x15d52d){if(_0x15d52d){return _0x15d52d['removeAnswers'](_0x1c3ea4[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x282e83,null))[_0xd81b('0x27')](handleError(_0x282e83,null));};exports['addLogo']=function(_0x1e5f94,_0x4e037b){_0x1e5f94['body'][_0xd81b('0x85')]=_0x1e5f94[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x1e5f94['params']['id']}})['then'](handleEntityNotFound(_0x4e037b,null))[_0xd81b('0x1c')](saveUpdates(_0x1e5f94[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x4e037b,null))[_0xd81b('0x27')](handleError(_0x4e037b,null));};exports[_0xd81b('0x88')]=function(_0x36611b,_0x368fc6){_0x36611b[_0xd81b('0x69')][_0xd81b('0x89')]=_0x36611b[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x36611b[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x368fc6,null))[_0xd81b('0x1c')](saveUpdates(_0x36611b[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x368fc6,null))[_0xd81b('0x27')](handleError(_0x368fc6,null));};exports[_0xd81b('0x8a')]=function(_0x4c6848,_0x1162c0){_0x4c6848[_0xd81b('0x69')][_0xd81b('0x8b')]=_0x4c6848[_0xd81b('0x86')][_0xd81b('0x87')];return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x4c6848[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x1162c0,null))[_0xd81b('0x1c')](saveUpdates(_0x4c6848[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x1162c0,null))[_0xd81b('0x27')](handleError(_0x1162c0,null));};exports[_0xd81b('0x8c')]=function(_0x11b49d,_0x22e808){_0x11b49d[_0xd81b('0x69')][_0xd81b('0x8d')]=_0x11b49d[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x11b49d[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x22e808,null))[_0xd81b('0x1c')](saveUpdates(_0x11b49d['body'],null))[_0xd81b('0x1c')](respondWithResult(_0x22e808,null))[_0xd81b('0x27')](handleError(_0x22e808,null));};exports[_0xd81b('0x8e')]=function(_0x478b92,_0xf13081){var _0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/default_logo.svg');var _0x2a6dcb={'where':{'id':_0x478b92[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x85')],'raw':!![]};var _0xf2e1b5=![];return require(_0xd81b('0x91'))[_0xd81b('0x92')]()[_0xd81b('0x1c')](function(_0x55384e){if(_0x55384e){_0xf2e1b5=_0x55384e['custom'];}})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x2a6dcb);})['then'](handleEntityNotFound(_0xf13081,null))[_0xd81b('0x1c')](function(_0x5189b8){if(_0x5189b8){if(!_[_0xd81b('0x93')](_0x5189b8[_0xd81b('0x85')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x95'),_0x5189b8[_0xd81b('0x85')]))&&_0xf2e1b5){_0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/',_0x5189b8[_0xd81b('0x85')]);}}return _0xf13081[_0xd81b('0x96')](_0x3069d1);}})[_0xd81b('0x27')](handleError(_0xf13081,null));};exports['getAvatar']=function(_0x4b2b45,_0x4d44d7){var _0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x97'));var _0x175d02={'where':{'id':_0x4b2b45[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x89')],'raw':!![]};return db['ChatWebsite'][_0xd81b('0x67')](_0x175d02)[_0xd81b('0x1c')](handleEntityNotFound(_0x4d44d7,null))[_0xd81b('0x1c')](function(_0x361d5a){if(_0x361d5a){if(!_['isNil'](_0x361d5a[_0xd81b('0x89')])){if(fs['existsSync'](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x361d5a['agentAvatar']))){_0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x361d5a[_0xd81b('0x89')]);}}return _0x4d44d7['download'](_0x3c5ea6);}})[_0xd81b('0x27')](handleError(_0x4d44d7,null));};exports[_0xd81b('0x99')]=function(_0x10449f,_0x539668){var _0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9a'));var _0x1e2612={'where':{'id':_0x10449f[_0xd81b('0x64')]['id']},'attributes':['id','customerAvatar',_0xd81b('0x9b')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x1e2612)['then'](handleEntityNotFound(_0x539668,null))[_0xd81b('0x1c')](function(_0xc9bdfe){if(_0xc9bdfe){if(!_[_0xd81b('0x93')](_0xc9bdfe[_0xd81b('0x8b')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe['customerAvatar']))&&_0xc9bdfe['showCustomerAvatar']){_0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe[_0xd81b('0x8b')]);}}return _0x539668['download'](_0x277379);}})['catch'](handleError(_0x539668,null));};exports[_0xd81b('0x9c')]=function(_0x397d26,_0x335713){var _0x1b18ef=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9d'));var _0x13e25f={'where':{'id':_0x397d26[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x8d')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x13e25f)[_0xd81b('0x1c')](handleEntityNotFound(_0x335713,null))[_0xd81b('0x1c')](function(_0x4283bd){if(_0x4283bd){if(!_['isNil'](_0x4283bd[_0xd81b('0x8d')])){if(fs[_0xd81b('0x94')](path['join'](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x4283bd[_0xd81b('0x8d')]))){_0x1b18ef=path['join'](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x4283bd[_0xd81b('0x8d')]);}}return _0x335713[_0xd81b('0x96')](_0x1b18ef);}})[_0xd81b('0x27')](handleError(_0x335713,null));};function checkWebsiteInterval(_0x2164d4){var _0x7e3d22=_0x2164d4[_0xd81b('0x9e')];if(!_0x7e3d22){return Promise[_0xd81b('0x9f')](_0x2164d4);}var _0x1b0156=_0x2164d4[_0xd81b('0xa0')]||undefined;return _0x7e3d22[_0xd81b('0xa1')](_0x1b0156)['then'](function(_0x8cda4b){if(!_0x8cda4b){throw new APIOutOfIntervalError();}return _0x2164d4;});}exports[_0xd81b('0xa2')]=function(_0x22dd20,_0x2ea321){var _0x305014={'body':_0x22dd20[_0xd81b('0x69')],'channel':_0xd81b('0xa3')};var _0x10382d=[];var _0x282942=[];var _0x24a88b={};var _0x48e6ba=![];if(_0x22dd20[_0xd81b('0x69')]['id']){delete _0x22dd20[_0xd81b('0x69')]['id'];}if(_['isNil'](_0x22dd20[_0xd81b('0x69')]['from'])){throw new APIBadRequestError(_0xd81b('0xa4'));}if(_[_0xd81b('0x93')](_0x22dd20['body'][_0xd81b('0xa5')])){throw new APIBadRequestError(_0xd81b('0xa6'));}if(_[_0xd81b('0xa7')](_0x22dd20[_0xd81b('0x69')]['body'])){throw new APIBadRequestError(_0xd81b('0xa8'));}var _0x3a248d=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];return db['CmContact'][_0xd81b('0x78')]()[_0xd81b('0x1c')](function(_0x14a219){if(!_0x14a219){throw new Error('No\x20available\x20attributes');}_0x10382d=Object['keys'](_0x14a219)[_0xd81b('0x5f')](function(_0x322771){return![_0xd81b('0xa9'),'updatedAt'][_0xd81b('0xaa')](_0x322771);});_0x282942=Object[_0xd81b('0x53')](_0x14a219)[_0xd81b('0x5f')](function(_0x4719f3){return![_0xd81b('0xa9'),_0xd81b('0xab'),'CompanyId',_0xd81b('0xac')][_0xd81b('0xaa')](_0x4719f3);});if(!_['includes'](_0x282942,_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x282942[_0xd81b('0x8f')](',\x20'));}_0x24a88b[_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')]]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xad')];})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x22dd20[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':'List','include':[{'model':db[_0xd81b('0xaf')],'as':_0xd81b('0xb0'),'where':_0x24a88b,'limit':0x1,'order':[['updatedAt',_0xd81b('0xb1')]]}]},{'model':db[_0xd81b('0xb2')],'as':_0xd81b('0xb3')},{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db['Interval'],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')],'raw':!![]}]}]});})[_0xd81b('0x1c')](function(_0x9658e){if(!_0x9658e){throw new APINotFoundError(util[_0xd81b('0x43')](_0xd81b('0xb6'),_0x22dd20[_0xd81b('0x64')]['id']));}if(_0x3a248d){return checkWebsiteInterval(_0x9658e);}return _0x9658e;})[_0xd81b('0x1c')](function(_0x44d405){_0x305014[_0xd81b('0xb7')]=_0x44d405;_0x305014[_0xd81b('0xb8')]=_['orderBy'](_0x44d405['Applications'],[_0xd81b('0xb9')],[_0xd81b('0xba')]);if(_0x305014[_0xd81b('0xb7')]['Applications']){delete _0x305014[_0xd81b('0xb7')][_0xd81b('0xb3')];}_0x305014[_0xd81b('0xbb')]=_0x44d405['List']||{'id':_0x44d405[_0xd81b('0xac')]};if(_0x305014[_0xd81b('0xbb')]&&_0x305014['list'][_0xd81b('0xb0')][_0xd81b('0x58')]){return _0x305014[_0xd81b('0xbb')][_0xd81b('0xb0')][0x0];}var _0x8026d7=_[_0xd81b('0x16')](_0x22dd20[_0xd81b('0x69')],{'firstName':_0x22dd20['body'][_0xd81b('0xad')],'ListId':_0x44d405[_0xd81b('0xac')]});_0x8026d7[_0x22dd20['body'][_0xd81b('0xa5')]]=_0x22dd20['body'][_0xd81b('0xad')];return db[_0xd81b('0xaf')][_0xd81b('0x68')](_0x8026d7,{'fields':_0x10382d,'raw':!![]});})[_0xd81b('0x1c')](function(_0x3a6e15){_0x305014[_0xd81b('0xbc')]=_0x3a6e15;var _0x87b315=createInteractionObject(_0x22dd20['params']['id'],_0x22dd20[_0xd81b('0x69')],_0x22dd20['headers'],_0x3a6e15);var _0x48073b={'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id']};if(_0x22dd20['body'][_0xd81b('0xbd')]){_0x48073b[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x48073b['closed']=![];return db['ChatInteraction'][_0xd81b('0x67')]({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x50529b){var _0x2ec729=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20['body'][_0xd81b('0x40')];if(_0x50529b){_0x48e6ba=!![];return _0x50529b;}else if(!_0x2ec729&&_0x50529b&&_0x50529b[_0xd81b('0xbe')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x87b315[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x87b315[_0xd81b('0xbf')]=_0x22dd20[_0xd81b('0x69')]['externalUrl'];return db['ChatInteraction'][_0xd81b('0x68')](_0x87b315);});}_0x48073b[_0xd81b('0xc0')]=_0x3a6e15['id'];if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xc1')]&&_0x22dd20['body'][_0xd81b('0xc1')]['id']){_0x48073b['id']=_0x22dd20['body'][_0xd81b('0xc1')]['id'];return db[_0xd81b('0xc2')]['find']({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x264d72){var _0x1d5dac=_0x22dd20['body'][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];if(!_0x1d5dac&&_0x264d72&&_0x264d72['closed']){throw new APIConflictError(_0xd81b('0xc3'));}else if(_0x264d72){_0x48e6ba=!![];return _0x264d72;}else{return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);}});}return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);})['then'](function(_0x5c3dce){if(!_0x48e6ba){return _0x5c3dce;}var _0x105735={'from':(_0x305014[_0xd81b('0xbc')][_0xd81b('0x3d')]||'')+'\x20'+(_0x305014[_0xd81b('0xbc')]['lastName']||'')};if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]&&_0x22dd20[_0xd81b('0x69')]['messageId']&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]!=_0x22dd20[_0xd81b('0x69')]['messageId']){_0x105735['threadId']=_0x22dd20['body'][_0xd81b('0xc4')];}return _0x5c3dce['update'](_0x105735);})[_0xd81b('0x1c')](function(_0x3d7a57){_0x305014[_0xd81b('0xc1')]=_0x3d7a57['get']({'plain':!![]});_0x305014['interaction'][_0xd81b('0xc5')]=!_0x48e6ba;if(_0x305014['interaction'][_0xd81b('0xc5')]){if(_0x305014[_0xd81b('0xb7')][_0xd81b('0xc6')]){_0x305014[_0xd81b('0xb8')]['push']({'id':0x0,'priority':_0x305014[_0xd81b('0xb8')][_0xd81b('0x58')]+0x1,'app':_0xd81b('0xc7'),'appdata':'unmanaged','interval':_0xd81b('0xc8')});}}return db['ChatMessage'][_0xd81b('0x68')]({'body':_0x22dd20[_0xd81b('0x69')]['body'],'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id'],'ChatInteractionId':_0x3d7a57['id'],'direction':'in','ContactId':_0x305014[_0xd81b('0xbc')]['id'],'AttachmentId':_0x22dd20[_0xd81b('0x69')]['AttachmentId']});})['then'](function(_0x1c10da){_0x305014[_0xd81b('0x25')]=_0x1c10da;if(!_0x305014[_0xd81b('0xc1')][_0xd81b('0xc9')]){return;}return db[_0xd81b('0xca')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014['interaction']['UserId']}});})[_0xd81b('0x1c')](function(_0x10f27c){if(_0x10f27c){_0x305014[_0xd81b('0xb8')][_0xd81b('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f27c[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xcc')]||0xa),'interval':_0xd81b('0xc8')});_0x305014[_0xd81b('0xcd')]=!![];}if(!_0x305014['interaction']['queueId']){return;}return db[_0xd81b('0xce')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014[_0xd81b('0xc1')][_0xd81b('0xcf')]}});})['then'](function(_0x49e5dd){if(_0x49e5dd){_0x305014[_0xd81b('0xb8')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd81b('0xd0'),'appdata':_0x49e5dd[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xd1')]||0x12c),'interval':_0xd81b('0xc8')});}return respondWithRpcPromise(_0xd81b('0xd2'),_0xd81b('0xd3'),_0x305014);})[_0xd81b('0x1c')](function(_0x538cc2){respondWithRpcPromise(_0xd81b('0xd4'),_0xd81b('0xd4'),{'event':_0xd81b('0xa2'),'message':_0x538cc2},client9002);return _0x538cc2;})[_0xd81b('0x1c')](respondWithResult(_0x2ea321,null))[_0xd81b('0x27')](APIHandleError(_0x2ea321));};exports[_0xd81b('0xd5')]=function(_0x2f4b2b,_0x59779e){var _0x1e184c,_0x5d6b18,_0x19eef8;var _0x520762=[];var _0x36650d={};var _0x1c5923=_0x2f4b2b['files']||[];var _0x16865b=[];var _0x522616;return db[_0xd81b('0xaf')][_0xd81b('0x78')]()['then'](function(_0x98f92e){if(!_0x98f92e){throw new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xd7'));}_0x520762=_[_0xd81b('0xd8')](_[_0xd81b('0x53')](_0x98f92e),[_0xd81b('0xa9'),_0xd81b('0xab'),_0xd81b('0xd9'),_0xd81b('0xac')]);if(_0x2f4b2b[_0xd81b('0x69')]['id']){delete _0x2f4b2b[_0xd81b('0x69')]['id'];}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')]['from'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdb')));}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')])||_0x2f4b2b[_0xd81b('0x69')]['body']===''){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))]['ValidationError'](_0xd81b('0xdc')));}if(_['isNil'](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xdd')])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xde')+_0x520762));}if(!_['includes'](_0x520762,_0x2f4b2b['body']['mapKeyOffline'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdf')+_0x520762));}_0x36650d[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b['body'][_0xd81b('0xad')];})['then'](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x2f4b2b[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':_0xd81b('0xe0')},{'model':db[_0xd81b('0xe1')],'as':_0xd81b('0xe1')}]});})[_0xd81b('0x1c')](handleEntityNotFound(_0x59779e,null))[_0xd81b('0x1c')](function(_0x28cbe7){if(_0x28cbe7&&_0x28cbe7[_0xd81b('0xe0')]){_0x5d6b18=_0x28cbe7;var _0x30abaf=_[_0xd81b('0x16')](_0x2f4b2b[_0xd81b('0x69')],{'firstName':_0x2f4b2b['body'][_0xd81b('0xad')],'phone':_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xad')],'ListId':_0x28cbe7[_0xd81b('0xac')]});_0x30abaf[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b[_0xd81b('0x69')]['from'];return db['CmContact'][_0xd81b('0xe2')]({'where':_0x36650d,'defaults':_0x30abaf});}})['spread'](function(_0x126aaa){if(_0x126aaa){_0x19eef8=_0x126aaa;var _0x3e8623=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0xe4')),_0xd81b('0xe5'));var _0x576d9d=ejs[_0xd81b('0xe6')](_0x3e8623,{'body':_[_0xd81b('0xe7')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')]),'bodyTitle':_0x5d6b18[_0xd81b('0xe8')]});return db[_0xd81b('0xe9')]['create']({'body':_0x576d9d,'plainBody':htmlToText[_0xd81b('0xea')](_0x576d9d),'ContactId':_0x126aaa['id'],'ChatWebsiteId':_0x5d6b18['id']});}})[_0xd81b('0x1c')](function(_0x3b6ed5){_0x522616=_0x3b6ed5;if(_0x1c5923[_0xd81b('0x58')]){var _0x11b997=_0x1c5923[_0xd81b('0x4d')](function(_0x3ec25d){return{'name':_0x3ec25d[_0xd81b('0xeb')],'basename':_0x3ec25d[_0xd81b('0x87')],'type':_0x3ec25d['mimetype'],'ChatOfflineMessageId':_0x3b6ed5['id']};});_0x16865b=_0x11b997[_0xd81b('0x4d')](_0x10a82f=>{var _0x255f26={'filename':_0x10a82f[_0xd81b('0x33')],'path':path['join'](config[_0xd81b('0x90')],_0xd81b('0xec'),_0xd81b('0xed'),'attachments',_0xd81b('0xee'),_0x10a82f[_0xd81b('0xef')])};return _0x255f26;});if(!_0x5d6b18[_0xd81b('0xf0')]){return db[_0xd81b('0xf1')][_0xd81b('0xf2')](function(_0x4f1d2b){return db[_0xd81b('0xf3')][_0xd81b('0xf4')](_0x11b997,{'transaction':_0x4f1d2b});});}}})[_0xd81b('0x1c')](function(){if(_0x522616){_0x1e184c=_0x522616;return db['MailAccount'][_0xd81b('0x83')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd81b('0xf5')],'as':_0xd81b('0xf5'),'raw':!![]}]}]});}})['then'](function(_0x2e4523){if(_0x2e4523&&_0x2e4523['Smtp']&&_0x5d6b18[_0xd81b('0xf6')]&&_0x5d6b18[_0xd81b('0xf7')]){var _0x3a10ac=_0x2e4523[_0xd81b('0xf8')]();return respondWithRpcPromise('SendMail',_0xd81b('0xf9'),{'account':_0x3a10ac,'message':{'from':util[_0xd81b('0x43')](_0xd81b('0xfa'),_0x2e4523[_0xd81b('0x33')],_0x2e4523[_0xd81b('0xfb')]||_0x2e4523[_0xd81b('0xfc')]['user']),'to':_0x5d6b18[_0xd81b('0xf7')],'subject':_0x5d6b18['offlineMessageSubject'],'html':_0x1e184c['body'],'attachments':_0x16865b}},client9003)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0xb2d684){logger['error'](_0xb2d684);});}})[_0xd81b('0x1c')](function(){if(_0x5d6b18&&_0x5d6b18[_0xd81b('0xf0')]&&_0x5d6b18['MailAccountId']){var _0x50fbfd=[];if(_0x1c5923[_0xd81b('0x58')]){_0x50fbfd=_0x1c5923[_0xd81b('0x4d')](function(_0x44e2a8){return{'name':_0x44e2a8[_0xd81b('0xeb')],'basename':_0x44e2a8[_0xd81b('0x87')],'type':_0x44e2a8[_0xd81b('0xfd')],'ChatOfflineMessageId':_0x522616['id']};});}var _0x462925;if(!_[_0xd81b('0x93')](_0x5d6b18[_0xd81b('0xfe')])){var _0x41d12a=_[_0xd81b('0x4d')](_0x2f4b2b[_0xd81b('0x69')],function(_0x2f3170){return _0x2f3170;});var _0xfc4221=_['toPairsIn'](_0x41d12a)[0x0];var _0x25939f=_[_0xd81b('0xff')](_0xfc4221,function(_0x5a7cb8){return _0x5a7cb8;});_0x462925=_0x25939f[0x1][_0x5d6b18[_0xd81b('0xfe')]];}var _0x250cd7={'from':_0x19eef8[_0xd81b('0xfb')],'firstName':_0x19eef8[_0xd81b('0x3d')],'lastName':_0x19eef8['lastName'],'mapKey':_0xd81b('0xfb'),'message':{'from':_0x19eef8[_0xd81b('0xfb')],'to':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')],'cc':'','subject':_[_0xd81b('0x93')](_0x462925)?_0x5d6b18[_0xd81b('0x100')]:_0x462925,'messageId':'','sentAt':new Date(),'attach':_0x50fbfd['length'],'attachments':_0x50fbfd,'originChannel':_0xd81b('0x101'),'ChatWebsiteId':_0x5d6b18['id'],'ChatOfflineMessageId':_0x1e184c['id'],'originTo':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')]},'body':_0x1e184c[_0xd81b('0x69')]};var _0x35320d={'account':{'id':_0x5d6b18[_0xd81b('0x102')]},'body':_0x250cd7,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd81b('0x103'),_0x35320d,client9001)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0x3c329e){logger['error'](_0x3c329e);});}return;})[_0xd81b('0x1c')](function(){if(_0x1e184c){return _0x1e184c;}})[_0xd81b('0x1c')](respondWithResult(_0x59779e,null))[_0xd81b('0x27')](function(){for(var _0x468794 of _0x1c5923){var _0x1c3473=path['join'](config[_0xd81b('0x90')],'server',_0xd81b('0xed'),_0xd81b('0x104'),'offline-chat',_0x468794['filename']);fs_extra[_0xd81b('0x105')](_0x1c3473)['catch'](function(_0x5f1c6b){logger[_0xd81b('0x23')](_0xd81b('0x106'),_0x1c3473,_0x5f1c6b);});}});};exports[_0xd81b('0x107')]=function(_0x56195b,_0x584698){return db[_0xd81b('0xc2')][_0xd81b('0x67')]({'where':{'id':_0x56195b[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x584698,null))[_0xd81b('0x1c')](function(_0xae9cb8){if(_0xae9cb8){return _0xae9cb8['addInteraction'](_0x56195b['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x56195b[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x584698,null))[_0xd81b('0x27')](handleError(_0x584698,null));};exports['getInteractions']=function(_0x22e159,_0x3d3ee1){var _0x31e7f7={'raw':![],'where':{}};var _0x4850d8={};var _0x51c975={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x22e159[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x3d3ee1,null))[_0xd81b('0x1c')](function(_0x525220){if(_0x525220){_0x4850d8[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['ChatInteraction'][_0xd81b('0x4f')]);_0x4850d8[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x22e159['query']);_0x4850d8[_0xd81b('0x54')]=_['intersection'](_0x4850d8[_0xd81b('0x46')],_0x4850d8['query']);_0x31e7f7[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x4850d8[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x57')]));_0x31e7f7['attributes']=_0x31e7f7['attributes'][_0xd81b('0x58')]?_0x31e7f7[_0xd81b('0x56')]:_0x4850d8[_0xd81b('0x46')];if(!_0x22e159[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31e7f7[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x22e159['query'][_0xd81b('0x2f')]);_0x31e7f7[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x22e159[_0xd81b('0x52')]['offset']);}_0x31e7f7[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x31e7f7['where']=qs[_0xd81b('0x54')](_['pick'](_0x22e159['query'],_0x4850d8[_0xd81b('0x54')]));_0x31e7f7[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x525220['id'];if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31e7f7[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31e7f7['where'],{'$or':_[_0xd81b('0x4d')](_0x31e7f7[_0xd81b('0x56')],function(_0x16ef58){var _0x3b4240={};_0x3b4240[_0x16ef58]={'$like':'%'+_0x22e159['query'][_0xd81b('0x5f')]+'%'};return _0x3b4240;})});}_0x31e7f7=_[_0xd81b('0x60')]({},_0x31e7f7,_0x22e159['options']);return db[_0xd81b('0xc2')]['count']({'where':_0x31e7f7[_0xd81b('0x5d')]})['then'](function(_0x54062e){_0x51c975[_0xd81b('0x2e')]=_0x54062e;if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31e7f7[_0xd81b('0x63')]=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db['User'],'as':_0xd81b('0x10a'),'attributes':[_0xd81b('0x33'),_0xd81b('0x10b'),_0xd81b('0x10c')],'required':![]},{'model':db[_0xd81b('0x10d')],'as':_0xd81b('0x10e'),'attributes':['id',_0xd81b('0x33'),_0xd81b('0x10f')],'where':_0x22e159[_0xd81b('0x52')]['tag']?{'id':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]}:undefined,'required':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]?!![]:![]}];}return db[_0xd81b('0xc2')][_0xd81b('0x7c')](_0x31e7f7);})[_0xd81b('0x1c')](function(_0x23139c){_0x51c975[_0xd81b('0x7d')]=_0x23139c;return _0x51c975;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x3d3ee1,_0x31e7f7))['catch'](handleError(_0x3d3ee1,null));};exports[_0xd81b('0x111')]=function(_0x432b04,_0x2ff8f6){var _0x30a57a=0x0;var _0x25f776=0x0;var _0x1313da=![];var _0x115026;var _0x202316;return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x432b04[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')]}]}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x2ff8f6,null))['then'](function(_0x16ccac){if(_0x16ccac){_0x115026=_0x16ccac;return _0x16ccac['getProactiveActions']({'raw':!![]});}})[_0xd81b('0x1c')](function(_0x1c3879){if(_0x115026){if(_0x1c3879){_0x202316=_0x1c3879;}}return require(_0xd81b('0x91'))[_0xd81b('0x92')]();})[_0xd81b('0x1c')](function(_0x4e6c6d){if(_0x4e6c6d){_0x25f776=_0x4e6c6d[_0xd81b('0x112')];_0x1313da=_0x4e6c6d[_0xd81b('0x113')];}})[_0xd81b('0x1c')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xd81b('0x1c')](function(_0x366808){_0x30a57a=_0x366808;if(_0x25f776&&_0x366808>_0x25f776){return db['License'][_0xd81b('0x83')]({'where':{'id':0x1}})[_0xd81b('0x1c')](function(_0x2ac7d3){if(_0x2ac7d3){_0x2ac7d3[_0xd81b('0x114')](_0xd81b('0x115'));}});}})[_0xd81b('0x1c')](function(){var _0x203fbe=_0x115026[_0xd81b('0x9e')];var _0xf1f6f2=_0x115026[_0xd81b('0xa0')]||undefined;return _0x203fbe?_0x203fbe[_0xd81b('0xa1')](_0xf1f6f2):!![];})[_0xd81b('0x1c')](function(_0xe0b626){var _0x5a187a=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0x116')),_0xd81b('0xe5'));var _0x4cb573=_0xd81b('0x117');var _0x53d707=![];var _0x480fab,_0x1685e6;if(_0x432b04[_0xd81b('0x118')]['referer']){_0x480fab=new URL(_0x432b04['headers'][_0xd81b('0x40')])[_0xd81b('0x119')];}else if(_0x432b04[_0xd81b('0x118')][_0xd81b('0x119')]){_0x480fab=new URL(_0x432b04[_0xd81b('0x118')]['origin'])[_0xd81b('0x119')];}else{_0x480fab=_0xd81b('0x11a');}_0x1685e6=typeof _0x115026[_0xd81b('0x6a')][_0xd81b('0x3c')](',')['find'](function(_0x549d83){return wildcardUtils[_0xd81b('0x11b')](_0x549d83,_0x480fab);})!==_0xd81b('0x2d');var _0x39eb20={'chatVersion':_0x4cb573,'chatWebsiteAddressOrigin':_0x1685e6?_0x480fab:_0x115026[_0xd81b('0x6a')],'remote':_0x115026[_0xd81b('0x11c')],'query':querystring[_0xd81b('0x22')](_['merge'](_0x115026[_0xd81b('0x70')]({'plain':!![]}),{'customerIp':_0x432b04[_0xd81b('0x118')]['x-forwarded-for']||_0x432b04[_0xd81b('0x118')][_0xd81b('0x11d')]||_0x432b04[_0xd81b('0x11e')][_0xd81b('0x11f')]||_0x432b04['ip'],'referer':_0x432b04['headers'][_0xd81b('0x40')],'openedInteractions':_0x30a57a,'maxInteractions':_0x25f776,'virtual':_0x1313da[_0xd81b('0x112')],'online':_0xe0b626,'custom':_0x1313da,'address':_0x1685e6?_0x480fab:null}))[_0xd81b('0x120')](/'/g,'\x5c\x27')};_0x2ff8f6[_0xd81b('0x34')](ejs[_0xd81b('0xe6')](Mustache[_0xd81b('0xe6')](_0x5a187a,_0x39eb20),{'proactiveActions':_0x202316,'alignment':_0x115026[_0xd81b('0x121')],'verticalAlignment':_0x115026[_0xd81b('0x122')],'div_color':_0x115026[_0xd81b('0x10f')],'labelText':_0x115026[_0xd81b('0x123')],'text_color':_0x115026[_0xd81b('0x124')],'text_button_color':_0x115026['textButtonColor'],'button_color':_0x115026[_0xd81b('0x125')],'background_color':_0x115026[_0xd81b('0x126')],'hideWhenOffline':_0x115026[_0xd81b('0x127')],'intervalId':_0x115026[_0xd81b('0x128')],'isDevelopment':_0x53d707,'chatVersion':_0x4cb573}));})[_0xd81b('0x27')](handleError(_0x2ff8f6,null));};exports[_0xd81b('0x129')]=function(_0x2eefbd,_0x2883fe){var _0x34cf85=_0x2eefbd[_0xd81b('0x64')]['id'];var _0x4eae4a=_0x2eefbd[_0xd81b('0x69')];var _0x388752=0xc8;var _0x580b1f=null;return db[_0xd81b('0xf1')][_0xd81b('0xf2')]({'isolationLevel':db[_0xd81b('0xf1')][_0xd81b('0x12a')]['ISOLATION_LEVELS'][_0xd81b('0x12b')]},function(_0x33d580){return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(_0x386b39){if(_0x386b39){return db[_0xd81b('0xb2')][_0xd81b('0x31')]({'where':{'ChatWebsiteId':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(){var _0x3c839c=_[_0xd81b('0x4d')](_0x4eae4a,function(_0x9bbfea){_0x9bbfea[_0xd81b('0x80')]=_0x34cf85;return _0x9bbfea;});return db[_0xd81b('0xb2')][_0xd81b('0xf4')](_0x3c839c,{'transaction':_0x33d580});});}else{_0x388752=0x194;_0x580b1f=[];}});})['then'](function(){if(_0x388752!==0x194){return db[_0xd81b('0xb2')][_0xd81b('0x12c')]({'where':{'ChatWebsiteId':_0x34cf85},'order':_0xd81b('0xb9')})['then'](function(_0x5ae954){_0x580b1f=_0x5ae954;});}})[_0xd81b('0x27')](function(_0x5ab098){_0x388752=0x1f4;logger[_0xd81b('0x23')](_0x5ab098['stack']);if(_0x5ab098[_0xd81b('0x33')]){delete _0x5ab098[_0xd81b('0x33')];}_0x580b1f=_0x5ab098;})[_0xd81b('0x12d')](function(){if(_0x580b1f===null){_0x2883fe[_0xd81b('0x28')](_0x388752);}else{if(_0x388752===0x1f4){_0x2883fe['status'](_0x388752)['send'](_0x580b1f);}else{_0x2883fe[_0xd81b('0x29')](_0x388752)[_0xd81b('0x2b')](_0x580b1f);}}});};exports[_0xd81b('0x12e')]=function(_0x1e841d,_0x6121cf){var _0x15ce6c={};var _0x29e6d9={};var _0x57ef3b;var _0xf7cefc;return db['ChatWebsite']['findOne']({'where':{'id':_0x1e841d[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x6121cf,null))['then'](function(_0x28e08c){if(_0x28e08c){_0x57ef3b=_0x28e08c;_0x29e6d9[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xb2')][_0xd81b('0x4f')]);_0x29e6d9[_0xd81b('0x52')]=_['keys'](_0x1e841d['query']);_0x29e6d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x29e6d9['model'],_0x29e6d9['query']);_0x15ce6c[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x29e6d9['model'],qs[_0xd81b('0x57')](_0x1e841d[_0xd81b('0x52')]['fields']));_0x15ce6c[_0xd81b('0x56')]=_0x15ce6c[_0xd81b('0x56')][_0xd81b('0x58')]?_0x15ce6c['attributes']:_0x29e6d9[_0xd81b('0x46')];_0x15ce6c[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x15ce6c['where']=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x1e841d[_0xd81b('0x52')],_0x29e6d9[_0xd81b('0x54')]));if(_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x15ce6c[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x15ce6c[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x15ce6c['attributes'],function(_0x407136){var _0x3b5455={};_0x3b5455[_0x407136]={'$like':'%'+_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x3b5455;})});}_0x15ce6c=_[_0xd81b('0x60')]({},_0x15ce6c,_0x1e841d[_0xd81b('0x66')]);return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})['then'](function(_0x5b1898){if(_0x5b1898){_0xf7cefc=_0x5b1898[_0xd81b('0x58')];if(!_0x1e841d[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x15ce6c[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x15ce6c[_0xd81b('0x2c')]=qs['offset'](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})[_0xd81b('0x1c')](function(_0x89764a){if(_0x89764a){return _0x89764a?{'count':_0xf7cefc,'rows':_0x89764a}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x6121cf,null))[_0xd81b('0x27')](handleError(_0x6121cf,null));};exports['addProactiveActions']=function(_0x5a8445,_0x47a903){return db['chatProactiveAction']['find']({'where':{'id':_0x5a8445[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x47a903,null))[_0xd81b('0x1c')](function(_0x4d4feb){if(_0x4d4feb){return _0x4d4feb[_0xd81b('0x12f')](_0x5a8445['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x5a8445[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x47a903,null))[_0xd81b('0x27')](handleError(_0x47a903,null));};exports[_0xd81b('0x130')]=function(_0xd09d12,_0x251bf4){var _0x3682e4={};var _0x49f9d1={};var _0x5c97b9;var _0x1e4634;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xd09d12[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x251bf4,null))[_0xd81b('0x1c')](function(_0x4e3323){if(_0x4e3323){_0x5c97b9=_0x4e3323;_0x49f9d1[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x131')][_0xd81b('0x4f')]);_0x49f9d1['query']=_['keys'](_0xd09d12[_0xd81b('0x52')]);_0x49f9d1[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x49f9d1[_0xd81b('0x46')],_0x49f9d1[_0xd81b('0x52')]);_0x3682e4[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x49f9d1['model'],qs[_0xd81b('0x57')](_0xd09d12['query']['fields']));_0x3682e4['attributes']=_0x3682e4[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3682e4[_0xd81b('0x56')]:_0x49f9d1[_0xd81b('0x46')];_0x3682e4[_0xd81b('0x5b')]=qs['sort'](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x3682e4[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_['pick'](_0xd09d12['query'],_0x49f9d1[_0xd81b('0x54')]));if(_0xd09d12[_0xd81b('0x52')]['filter']){_0x3682e4[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x3682e4[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x3682e4[_0xd81b('0x56')],function(_0x111dd0){var _0x37301b={};_0x37301b[_0x111dd0]={'$like':'%'+_0xd09d12['query']['filter']+'%'};return _0x37301b;})});}_0x3682e4=_[_0xd81b('0x60')]({},_0x3682e4,_0xd09d12['options']);return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x222acd){if(_0x222acd){_0x1e4634=_0x222acd[_0xd81b('0x58')];if(!_0xd09d12[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x3682e4[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xd09d12[_0xd81b('0x52')]['limit']);_0x3682e4[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x3c96d4){if(_0x3c96d4){return _0x3c96d4?{'count':_0x1e4634,'rows':_0x3c96d4}:null;}})['then'](respondWithResult(_0x251bf4,null))[_0xd81b('0x27')](handleError(_0x251bf4,null));};exports[_0xd81b('0x132')]=function(_0x4387a7,_0x24fc43){var _0x498cc0=_0x4387a7[_0xd81b('0x52')][_0xd81b('0x133')]===_0xd81b('0x134')?_0xd81b('0x135'):_0xd81b('0x136');return db[_0xd81b('0x4e')]['find']({'attributes':['id',_0x498cc0],'where':{'id':_0x4387a7[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x24fc43,null))[_0xd81b('0x1c')](function(_0x597c54){if(_0x597c54){var _0x4e792e=_0x597c54[_0x498cc0];var _0x58e782=_0x4e792e&&_0x4e792e[_0xd81b('0x137')]?_0x4e792e['items']:[];_0x24fc43[_0xd81b('0x34')]({'fromKey':_[_0xd81b('0x93')](_0x4e792e['fromKey'])?undefined:_0x4e792e[_0xd81b('0x138')],'count':_0x58e782[_0xd81b('0x58')],'rows':_0x58e782});}})[_0xd81b('0x27')](handleError(_0x24fc43,null));};exports['getOfflineMessages']=function(_0x5f10b0,_0x19ff30){var _0x398e61={'raw':![],'where':{}};var _0xcb2433={};var _0x32573b={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x5f10b0['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x19ff30,null))[_0xd81b('0x1c')](function(_0x1eea94){if(_0x1eea94){_0xcb2433[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xe9')]['rawAttributes']);_0xcb2433['query']=_[_0xd81b('0x53')](_0x5f10b0[_0xd81b('0x52')]);_0xcb2433[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0xcb2433['model'],_0xcb2433[_0xd81b('0x52')]);_0x398e61['attributes']=_[_0xd81b('0x55')](_0xcb2433['model'],qs[_0xd81b('0x57')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x57')]));_0x398e61['attributes']=_0x398e61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x398e61[_0xd81b('0x56')]:_0xcb2433[_0xd81b('0x46')];if(!_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x398e61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x5f10b0['query'][_0xd81b('0x2f')]);_0x398e61[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x398e61[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x398e61[_0xd81b('0x5d')]=qs['filters'](_[_0xd81b('0x5e')](_0x5f10b0[_0xd81b('0x52')],_0xcb2433[_0xd81b('0x54')]));_0x398e61[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x1eea94['id'];if(_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x398e61[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x398e61['where'],{'$or':_['map'](_0x398e61[_0xd81b('0x56')],function(_0x56f4c8){var _0xa5dd60={};_0xa5dd60[_0x56f4c8]={'$like':'%'+_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0xa5dd60;})});}_0x398e61=_[_0xd81b('0x60')]({},_0x398e61,_0x5f10b0[_0xd81b('0x66')]);return db[_0xd81b('0xe9')][_0xd81b('0x2e')]({'where':_0x398e61[_0xd81b('0x5d')]})['then'](function(_0x443a17){_0x32573b[_0xd81b('0x2e')]=_0x443a17;if(_0x5f10b0['query'][_0xd81b('0x62')]){_0x398e61[_0xd81b('0x63')]=[{'all':!![]}];}else{_0x398e61['include']=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db[_0xd81b('0xf3')],'as':_0xd81b('0x139'),'required':![]}];}return db[_0xd81b('0xe9')][_0xd81b('0x7c')](_0x398e61);})[_0xd81b('0x1c')](function(_0x57da47){_0x32573b[_0xd81b('0x7d')]=_0x57da47;return _0x32573b;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x19ff30,_0x398e61))['catch'](handleError(_0x19ff30,null));};exports[_0xd81b('0x13a')]=function(_0x207681,_0x212f03){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x207681[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x212f03,null))[_0xd81b('0x1c')](function(_0x3ea155){if(_0x3ea155){return _0x3ea155[_0xd81b('0x13a')](_0x207681['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x207681[_0xd81b('0x69')],[_0xd81b('0x7f'),'id'])||{})[_0xd81b('0x13b')](function(_0x3b393b){for(var _0xd6d130=0x0;_0xd6d130<_0x207681['body'][_0xd81b('0x7f')][_0xd81b('0x58')];_0xd6d130+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x13d'),{'UserId':Number(_0x207681['body'][_0xd81b('0x7f')][_0xd6d130]),'ChatWebsiteId':Number(_0x207681[_0xd81b('0x64')]['id'])});}return _0x3b393b;});}})['then'](respondWithResult(_0x212f03,null))['catch'](handleError(_0x212f03,null));};exports[_0xd81b('0x13e')]=function(_0x44a9e1,_0x26d2c2){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x44a9e1['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x26d2c2,null))[_0xd81b('0x1c')](function(_0x4c684a){if(_0x4c684a){return _0x4c684a[_0xd81b('0x13e')](_0x44a9e1['query'][_0xd81b('0x7f')])['then'](function(){if(_[_0xd81b('0x13f')](_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')])){for(var _0x56d986=0x0;_0x56d986<_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0xd81b('0x58')];_0x56d986+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0x56d986]),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}}else{socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1['query']['ids']),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}});}})[_0xd81b('0x1c')](respondWithStatusCode(_0x26d2c2,null))[_0xd81b('0x27')](handleError(_0x26d2c2,null));};exports[_0xd81b('0x141')]=function(_0xb7102c,_0x2b1519){var _0x1c5a61={};var _0x4c1201={};var _0x1f76aa;var _0x36fa37;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xb7102c[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b1519,null))[_0xd81b('0x1c')](function(_0x4fc360){if(_0x4fc360){_0x1f76aa=_0x4fc360;_0x4c1201[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0xca')]['rawAttributes']);_0x4c1201[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0xb7102c[_0xd81b('0x52')]);_0x4c1201['filters']=_[_0xd81b('0x55')](_0x4c1201[_0xd81b('0x46')],_0x4c1201[_0xd81b('0x52')]);_0x1c5a61['attributes']=_[_0xd81b('0x55')](_0x4c1201['model'],qs[_0xd81b('0x57')](_0xb7102c['query'][_0xd81b('0x57')]));_0x1c5a61[_0xd81b('0x56')]=_0x1c5a61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c5a61[_0xd81b('0x56')]:_0x4c1201[_0xd81b('0x46')];_0x1c5a61['order']=qs[_0xd81b('0x5c')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c5a61[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0xb7102c[_0xd81b('0x52')],_0x4c1201[_0xd81b('0x54')]));if(_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c5a61['where']=_[_0xd81b('0x60')](_0x1c5a61['where'],{'$or':_[_0xd81b('0x4d')](_0x1c5a61['attributes'],function(_0x45bf7e){var _0x29464b={};_0x29464b[_0x45bf7e]={'$like':'%'+_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x29464b;})});}_0x1c5a61=_[_0xd81b('0x60')]({},_0x1c5a61,_0xb7102c[_0xd81b('0x66')]);return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})['then'](function(_0xec700e){if(_0xec700e){_0x36fa37=_0xec700e[_0xd81b('0x58')];if(!_0xb7102c[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x1c5a61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x1c5a61['offset']=qs['offset'](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})[_0xd81b('0x1c')](function(_0x450634){if(_0x450634){return _0x450634?{'count':_0x36fa37,'rows':_0x450634}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x2b1519,null))[_0xd81b('0x27')](handleError(_0x2b1519,null));}; \ No newline at end of file +var _0xf3cd=['split','firstName','lastName','x-real-port','referer','browser','name','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','length','find','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','create','update','addDisposition','Disposition','pick','ChatWebsiteId','options','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','list','ListId','contact','headers','threadId','closed','ChatInteraction','customerIp','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','Start','startRouting','EventManager','offline','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','server','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','Tag','color','tag','getProactiveActions','virtual','License','chatLicenseExceeded','timezone','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','bulkCreate','findAndCountAll','priority','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','get','UserProfileResource','destroy','stack','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for'];(function(_0x148cab,_0xe10466){var _0x4df904=function(_0x53d14d){while(--_0x53d14d){_0x148cab['push'](_0x148cab['shift']());}};_0x4df904(++_0xe10466);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xf3cd[_0x5da0d9];return _0x4b6d2f;};'use strict';var Mustache=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var ejs=require(_0xdf3c('0x3'));var fs=require('fs');var fs_extra=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var querystring=require('querystring');var htmlToText=require(_0xdf3c('0x6'));var Redis=require(_0xdf3c('0x7'));var jayson=require(_0xdf3c('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x9'))(_0xdf3c('0xa'));var config=require(_0xdf3c('0xb'));var APIBadRequestError=require(_0xdf3c('0xc'))[_0xdf3c('0xd')];var APINotFoundError=require(_0xdf3c('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xdf3c('0xc'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xdf3c('0xe')];var APIConflictError=require(_0xdf3c('0xc'))['APIConflictError'];var wildcardUtils=require(_0xdf3c('0xf'));var URL=require(_0xdf3c('0x10'))[_0xdf3c('0x11')];var db=require(_0xdf3c('0x12'))['db'];config[_0xdf3c('0x13')]=_[_0xdf3c('0x14')](config[_0xdf3c('0x13')],{'host':_0xdf3c('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x13')]));require(_0xdf3c('0x16'))[_0xdf3c('0x17')](socket);var client=jayson[_0xdf3c('0x18')]['http']({'port':0x232c});var client9002=jayson[_0xdf3c('0x18')][_0xdf3c('0x19')]({'port':0x232a});var client9003=jayson[_0xdf3c('0x18')]['http']({'port':0x232b});var client9001=jayson[_0xdf3c('0x18')][_0xdf3c('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x173041,_0x4274fd,_0x21e587,_0x1a7a5a){return new Promise(function(_0x305ea5,_0x92008b){var _0x2986d0=_0x1a7a5a||client;return _0x2986d0[_0xdf3c('0x1a')](_0x173041,_0x21e587)['then'](function(_0x13b0e6){logger[_0xdf3c('0x1b')](_0xdf3c('0x1c'),_0x4274fd,_0xdf3c('0x1d'));logger[_0xdf3c('0x1e')](_0xdf3c('0x1f'),_0x4274fd,_0xdf3c('0x1d'),JSON[_0xdf3c('0x20')](_0x13b0e6));if(_0x13b0e6[_0xdf3c('0x21')]){if(_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x22')]===0x1f4){logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x13b0e6['error']['message']);return _0x92008b(_0x13b0e6[_0xdf3c('0x21')]['message']);}logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x23')]);return _0x305ea5(_0x13b0e6[_0xdf3c('0x21')][_0xdf3c('0x23')]);}else{logger['info'](_0xdf3c('0x1c'),_0x4274fd,_0xdf3c('0x1d'));_0x305ea5(_0x13b0e6[_0xdf3c('0x24')][_0xdf3c('0x23')]);}})[_0xdf3c('0x25')](function(_0x3b5371){logger[_0xdf3c('0x21')](_0xdf3c('0x1c'),_0x4274fd,_0x3b5371);_0x92008b(_0x3b5371);});});}function respondWithStatusCode(_0x18cb46,_0x1adee4){_0x1adee4=_0x1adee4||0xcc;return function(_0x4c076c){if(_0x4c076c){return _0x18cb46[_0xdf3c('0x26')](_0x1adee4);}return _0x18cb46[_0xdf3c('0x27')](_0x1adee4)['end']();};}function respondWithResult(_0xdc8962,_0x59659e){_0x59659e=_0x59659e||0xc8;return function(_0x4eaced){if(_0x4eaced){return _0xdc8962['status'](_0x59659e)[_0xdf3c('0x28')](_0x4eaced);}};}function respondWithFilteredResult(_0x186bba,_0x52b8f6){return function(_0x5c3b5a){if(_0x5c3b5a){var _0x37ecfd=typeof _0x52b8f6[_0xdf3c('0x29')]===_0xdf3c('0x2a')&&typeof _0x52b8f6[_0xdf3c('0x2b')]==='undefined';var _0x43ce06=_0x5c3b5a[_0xdf3c('0x2c')];var _0x5386bf=_0x37ecfd?0x0:_0x52b8f6['offset'];var _0x1f1d8a=_0x37ecfd?_0x5c3b5a[_0xdf3c('0x2c')]:_0x52b8f6[_0xdf3c('0x29')]+_0x52b8f6['limit'];var _0x2355f6;if(_0x1f1d8a>=_0x43ce06){_0x1f1d8a=_0x43ce06;_0x2355f6=0xc8;}else{_0x2355f6=0xce;}_0x186bba[_0xdf3c('0x27')](_0x2355f6);return _0x186bba[_0xdf3c('0x2d')](_0xdf3c('0x2e'),_0x5386bf+'-'+_0x1f1d8a+'/'+_0x43ce06)['json'](_0x5c3b5a);}return null;};}function saveUpdates(_0xda0de0){return function(_0x46b445){if(_0x46b445){return _0x46b445['update'](_0xda0de0)[_0xdf3c('0x2f')](function(_0x3daeda){return _0x3daeda;});}return null;};}function removeEntity(_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x2f')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x30')]({'plain':!![]});var _0x3b9ce8='ChatWebsites';return db[_0xdf3c('0x31')][_0xdf3c('0x32')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x217a65[_0xdf3c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115){return function(_0x5e8130){if(!_0x5e8130){_0x216115['sendStatus'](0x194);}return _0x5e8130;};}function handleError(_0x52f0c3,_0x44a478){_0x44a478=_0x44a478||0x1f4;return function(_0x2ee9ad){logger[_0xdf3c('0x21')](_0x2ee9ad[_0xdf3c('0x33')]);if(_0x2ee9ad['name']){delete _0x2ee9ad['name'];}_0x52f0c3[_0xdf3c('0x27')](_0x44a478)['send'](_0x2ee9ad);};}function createInteractionObject(_0x46e40f,_0x17b502,_0x3628ae,_0xcdd731){var _0x1004e9=require(_0xdf3c('0x34'));var _0x1c7335=new _0x1004e9();var _0x809f3d=_0x1c7335[_0xdf3c('0x35')](_0x3628ae['user-agent'])[_0xdf3c('0x36')]();var _0x54e689=_0x17b502['customerIp'];if(_0x3628ae[_0xdf3c('0x37')]){_0x54e689=_0x3628ae['cf-connecting-ip'];}else if(_0x3628ae[_0xdf3c('0x38')]){_0x54e689=_['first'](_0x3628ae[_0xdf3c('0x38')][_0xdf3c('0x39')](','));}return{'ContactId':_0xcdd731['id'],'ChatWebsiteId':_0x46e40f,'from':(_0xcdd731[_0xdf3c('0x3a')]||'')+'\x20'+(_0xcdd731[_0xdf3c('0x3b')]||''),'customerIp':_0x54e689,'customerPort':_0x3628ae[_0xdf3c('0x3c')]?_0x3628ae[_0xdf3c('0x3c')]:null,'referer':_0x17b502[_0xdf3c('0x3d')],'browserName':_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x3f')]&&_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x40')]?util[_0xdf3c('0x41')]('%s\x20%s',_0x809f3d['browser'][_0xdf3c('0x3f')],_0x809f3d['browser'][_0xdf3c('0x40')]):_0xdf3c('0x42'),'browserVersion':_0x809f3d[_0xdf3c('0x3e')][_0xdf3c('0x40')]||'unknown','osName':util['format'](_0xdf3c('0x43'),_0x809f3d['os'][_0xdf3c('0x3f')],_0x809f3d['os'][_0xdf3c('0x40')]),'osVersion':_0x809f3d['os']['version'],'deviceModel':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x45')]&&_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')]?util['format'](_0xdf3c('0x47'),_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x45')],_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')],_0x809f3d['device'][_0xdf3c('0x48')]):null,'deviceVendor':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x46')],'deviceType':_0x809f3d[_0xdf3c('0x44')][_0xdf3c('0x48')],'formData':JSON[_0xdf3c('0x20')](_0x17b502)};}exports['index']=function(_0x4d6349,_0x2c6c6d){var _0x2be86d={'include':[{'model':db[_0xdf3c('0x49')],'as':_0xdf3c('0x4a')}]},_0x5a4443={},_0x5c9885={'count':0x0,'rows':[]};var _0x46b2bd=_[_0xdf3c('0x4b')](db[_0xdf3c('0x4c')][_0xdf3c('0x4d')],function(_0x466ea1){return{'name':_0x466ea1[_0xdf3c('0x4e')],'type':_0x466ea1[_0xdf3c('0x48')]['key']};});_0x5a4443[_0xdf3c('0x45')]=_[_0xdf3c('0x4b')](_0x46b2bd,_0xdf3c('0x3f'));_0x5a4443[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x4d6349[_0xdf3c('0x4f')]);_0x5a4443[_0xdf3c('0x51')]=_['intersection'](_0x5a4443[_0xdf3c('0x45')],_0x5a4443['query']);_0x2be86d[_0xdf3c('0x52')]=_['intersection'](_0x5a4443[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x2be86d['attributes']=_0x2be86d['attributes']['length']?_0x2be86d[_0xdf3c('0x52')]:_0x5a4443['model'];if(!_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x2be86d[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x4d6349['query']['limit']);_0x2be86d[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x4d6349['query'][_0xdf3c('0x29')]);}_0x2be86d[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x2be86d[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_['pick'](_0x4d6349['query'],_0x5a4443[_0xdf3c('0x51')]),_0x46b2bd);if(_0x4d6349[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x2be86d[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x2be86d[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x46b2bd,function(_0x2aace4){if(_0x2aace4[_0xdf3c('0x48')]!==_0xdf3c('0x5b')){var _0x393ad2={};_0x393ad2[_0x2aace4['name']]={'$like':'%'+_0x4d6349[_0xdf3c('0x4f')]['filter']+'%'};return _0x393ad2;}})});}_0x2be86d=_['merge']({},_0x2be86d,_0x4d6349['options']);var _0x58fcbf={'where':_0x2be86d['where']};return db[_0xdf3c('0x4c')][_0xdf3c('0x2c')](_0x58fcbf)['then'](function(_0x4257c4){_0x5c9885[_0xdf3c('0x2c')]=_0x4257c4;if(_0x4d6349['query'][_0xdf3c('0x5c')]){_0x2be86d[_0xdf3c('0x5d')]=[{'all':!![]}];}return db[_0xdf3c('0x4c')][_0xdf3c('0x5e')](_0x2be86d);})[_0xdf3c('0x2f')](function(_0x28f387){_0x5c9885[_0xdf3c('0x5f')]=_0x28f387;return _0x5c9885;})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x2c6c6d,_0x2be86d))[_0xdf3c('0x25')](handleError(_0x2c6c6d,null));};exports[_0xdf3c('0x60')]=function(_0x55e29b,_0x503d94){var _0x1ed898={'raw':![],'where':{'id':_0x55e29b[_0xdf3c('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0xdf3c('0x4a')}]},_0x158932={};_0x158932[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['ChatWebsite'][_0xdf3c('0x4d')]);_0x158932[_0xdf3c('0x4f')]=_['keys'](_0x55e29b[_0xdf3c('0x4f')]);_0x158932['filters']=_[_0xdf3c('0x62')](_0x158932[_0xdf3c('0x45')],_0x158932[_0xdf3c('0x4f')]);_0x1ed898[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x158932[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x55e29b[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x1ed898[_0xdf3c('0x52')]=_0x1ed898[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x1ed898[_0xdf3c('0x52')]:_0x158932[_0xdf3c('0x45')];if(_0x55e29b[_0xdf3c('0x4f')][_0xdf3c('0x5c')]){_0x1ed898[_0xdf3c('0x5d')]=[{'all':!![]}];}_0x1ed898=_['merge']({},_0x1ed898,_0x55e29b['options']);return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x1ed898)[_0xdf3c('0x2f')](handleEntityNotFound(_0x503d94,null))['then'](respondWithResult(_0x503d94,null))[_0xdf3c('0x25')](handleError(_0x503d94,null));};exports['create']=function(_0x574852,_0x184952){var _0x399db6=null;_0x574852[_0xdf3c('0x65')][_0xdf3c('0x66')][_0xdf3c('0x39')](',')[_0xdf3c('0x67')](_0x1a31d7=>{if(_0x1a31d7[_0xdf3c('0x68')]()!==''&&!wildcardUtils[_0xdf3c('0x69')](_0x1a31d7[_0xdf3c('0x68')]())){_0x399db6=new APIBadRequestError('\x22'+_0x1a31d7[_0xdf3c('0x68')]()+_0xdf3c('0x6a'));}});if(_0x399db6){return handleError(_0x184952,null)(_0x399db6);}return db[_0xdf3c('0x4c')]['create'](_0x574852[_0xdf3c('0x65')],{})[_0xdf3c('0x2f')](function(_0x149cd5){var _0x16d6ea=_0x574852[_0xdf3c('0x6b')]['get']({'plain':!![]});if(!_0x16d6ea)throw new Error(_0xdf3c('0x6c'));if(_0x16d6ea[_0xdf3c('0x6d')]===_0xdf3c('0x6b')){var _0x12d791=_0x149cd5[_0xdf3c('0x30')]({'plain':!![]});var _0x50805c=_0xdf3c('0x6e');return db[_0xdf3c('0x6f')][_0xdf3c('0x64')]({'where':{'name':_0x50805c,'userProfileId':_0x16d6ea[_0xdf3c('0x70')]},'raw':!![]})['then'](function(_0xb867a1){if(_0xb867a1&&_0xb867a1[_0xdf3c('0x71')]===0x0){return db[_0xdf3c('0x31')][_0xdf3c('0x72')]({'name':_0x12d791[_0xdf3c('0x3f')],'resourceId':_0x12d791['id'],'type':_0xb867a1[_0xdf3c('0x3f')],'sectionId':_0xb867a1['id']},{})[_0xdf3c('0x2f')](function(){return _0x149cd5;});}else{return _0x149cd5;}})['catch'](function(_0x2b6069){logger[_0xdf3c('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6069);throw _0x2b6069;});}return _0x149cd5;})['then'](respondWithResult(_0x184952,0xc9))[_0xdf3c('0x25')](handleError(_0x184952,null));};exports[_0xdf3c('0x73')]=function(_0x3064de,_0x1e6529){var _0x87f730=null;_0x3064de[_0xdf3c('0x65')][_0xdf3c('0x66')][_0xdf3c('0x39')](',')['forEach'](_0x14cd72=>{if(_0x14cd72[_0xdf3c('0x68')]()!==''&&!wildcardUtils[_0xdf3c('0x69')](_0x14cd72['trim']())){_0x87f730=new APIBadRequestError('\x22'+_0x14cd72[_0xdf3c('0x68')]()+_0xdf3c('0x6a'));}});if(_0x87f730){return handleError(_0x1e6529,null)(_0x87f730);}if(_0x3064de[_0xdf3c('0x65')]['id']){delete _0x3064de['body']['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3064de[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0x49')],'as':_0xdf3c('0x4a')}]})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1e6529,null))['then'](saveUpdates(_0x3064de['body'],null))['then'](respondWithResult(_0x1e6529,null))['catch'](handleError(_0x1e6529,null));};exports['destroy']=function(_0x2a4e4c,_0x3f43a0){return db[_0xdf3c('0x4c')]['find']({'where':{'id':_0x2a4e4c[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3f43a0,null))[_0xdf3c('0x2f')](removeEntity(_0x3f43a0,null))['catch'](handleError(_0x3f43a0,null));};exports['describe']=function(_0x233718,_0x4e3517){return db[_0xdf3c('0x4c')]['describe']()[_0xdf3c('0x2f')](respondWithResult(_0x4e3517,null))[_0xdf3c('0x25')](handleError(_0x4e3517,null));};exports[_0xdf3c('0x74')]=function(_0x31f023,_0x5316ef){if(_0x31f023['body']['id']){delete _0x31f023[_0xdf3c('0x65')]['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x31f023[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x5316ef,null))[_0xdf3c('0x2f')](function(_0x4eb295){if(_0x4eb295){_0x31f023[_0xdf3c('0x65')]['ChatWebsiteId']=_0x4eb295['id'];return db[_0xdf3c('0x75')][_0xdf3c('0x72')](_0x31f023[_0xdf3c('0x65')]);}})[_0xdf3c('0x2f')](respondWithResult(_0x5316ef,null))[_0xdf3c('0x25')](handleError(_0x5316ef,null));};exports['getDispositions']=function(_0x45e4e0,_0x5c27cc){var _0x332041={'raw':![],'where':{}};var _0x4fabda={};var _0x591578={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x45e4e0[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x5c27cc,null))[_0xdf3c('0x2f')](function(_0x391042){if(_0x391042){_0x4fabda[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['Disposition'][_0xdf3c('0x4d')]);_0x4fabda['query']=_[_0xdf3c('0x50')](_0x45e4e0[_0xdf3c('0x4f')]);_0x4fabda[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x4fabda[_0xdf3c('0x45')],_0x4fabda[_0xdf3c('0x4f')]);_0x332041[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x4fabda[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x332041[_0xdf3c('0x52')]=_0x332041[_0xdf3c('0x52')]['length']?_0x332041[_0xdf3c('0x52')]:_0x4fabda[_0xdf3c('0x45')];if(!_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x54')]('nolimit')){_0x332041[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x45e4e0['query']['limit']);_0x332041[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x332041[_0xdf3c('0x56')]=qs['sort'](_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x332041[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x45e4e0[_0xdf3c('0x4f')],_0x4fabda['filters']));_0x332041[_0xdf3c('0x58')][_0xdf3c('0x77')]=_0x391042['id'];if(_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x332041[_0xdf3c('0x58')]=_['merge'](_0x332041['where'],{'$or':_['map'](_0x332041[_0xdf3c('0x52')],function(_0x2cdc6d){var _0x2d4ece={};_0x2d4ece[_0x2cdc6d]={'$like':'%'+_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x2d4ece;})});}_0x332041=_[_0xdf3c('0x5a')]({},_0x332041,_0x45e4e0[_0xdf3c('0x78')]);return db[_0xdf3c('0x75')]['count']({'where':_0x332041[_0xdf3c('0x58')]})[_0xdf3c('0x2f')](function(_0x1cb9fd){_0x591578[_0xdf3c('0x2c')]=_0x1cb9fd;if(_0x45e4e0[_0xdf3c('0x4f')][_0xdf3c('0x5c')]){_0x332041['include']=[{'all':!![]}];}return db[_0xdf3c('0x75')][_0xdf3c('0x5e')](_0x332041);})['then'](function(_0x5115ea){_0x591578[_0xdf3c('0x5f')]=_0x5115ea;return _0x591578;});}})['then'](respondWithFilteredResult(_0x5c27cc,_0x332041))[_0xdf3c('0x25')](handleError(_0x5c27cc,null));};exports[_0xdf3c('0x79')]=function(_0x4e917f,_0x2b4084){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4e917f[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2b4084,null))[_0xdf3c('0x2f')](function(_0x498882){if(_0x498882){return _0x498882[_0xdf3c('0x79')](_0x4e917f[_0xdf3c('0x4f')][_0xdf3c('0x7a')]);}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x2b4084,null))[_0xdf3c('0x25')](handleError(_0x2b4084,null));};exports[_0xdf3c('0x7b')]=function(_0x3deacb,_0x48b892){if(_0x3deacb['body']['id']){delete _0x3deacb[_0xdf3c('0x65')]['id'];}return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3deacb['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x48b892,null))['then'](function(_0x56a655){if(_0x56a655){_0x3deacb[_0xdf3c('0x65')][_0xdf3c('0x77')]=_0x56a655['id'];return db['CannedAnswer'][_0xdf3c('0x72')](_0x3deacb['body']);}})[_0xdf3c('0x2f')](respondWithResult(_0x48b892,null))['catch'](handleError(_0x48b892,null));};exports[_0xdf3c('0x7c')]=function(_0x3676a2,_0x284635){var _0xb91d51={'raw':![],'where':{}};var _0x8da8b8={};var _0x87e942={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x3676a2[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x284635,null))[_0xdf3c('0x2f')](function(_0x404761){if(_0x404761){_0x8da8b8[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db['CannedAnswer'][_0xdf3c('0x4d')]);_0x8da8b8[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x3676a2['query']);_0x8da8b8[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x8da8b8[_0xdf3c('0x45')],_0x8da8b8[_0xdf3c('0x4f')]);_0xb91d51[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x8da8b8[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0xb91d51[_0xdf3c('0x52')]=_0xb91d51['attributes'][_0xdf3c('0x63')]?_0xb91d51[_0xdf3c('0x52')]:_0x8da8b8[_0xdf3c('0x45')];if(!_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0xb91d51[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0xb91d51[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x3676a2['query'][_0xdf3c('0x29')]);}_0xb91d51[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0xb91d51[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_['pick'](_0x3676a2[_0xdf3c('0x4f')],_0x8da8b8[_0xdf3c('0x51')]));_0xb91d51[_0xdf3c('0x58')][_0xdf3c('0x77')]=_0x404761['id'];if(_0x3676a2['query'][_0xdf3c('0x59')]){_0xb91d51[_0xdf3c('0x58')]=_['merge'](_0xb91d51[_0xdf3c('0x58')],{'$or':_['map'](_0xb91d51[_0xdf3c('0x52')],function(_0x1b2363){var _0x5e6cc1={};_0x5e6cc1[_0x1b2363]={'$like':'%'+_0x3676a2[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x5e6cc1;})});}_0xb91d51=_[_0xdf3c('0x5a')]({},_0xb91d51,_0x3676a2['options']);return db['CannedAnswer'][_0xdf3c('0x2c')]({'where':_0xb91d51['where']})[_0xdf3c('0x2f')](function(_0x82225d){_0x87e942[_0xdf3c('0x2c')]=_0x82225d;if(_0x3676a2[_0xdf3c('0x4f')]['includeAll']){_0xb91d51[_0xdf3c('0x5d')]=[{'all':!![]}];}return db[_0xdf3c('0x7e')]['findAll'](_0xb91d51);})[_0xdf3c('0x2f')](function(_0x545e1c){_0x87e942[_0xdf3c('0x5f')]=_0x545e1c;return _0x87e942;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x284635,_0xb91d51))['catch'](handleError(_0x284635,null));};exports['removeAnswers']=function(_0x243fbf,_0x4e01ca){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x243fbf[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x4e01ca,null))[_0xdf3c('0x2f')](function(_0x12bd07){if(_0x12bd07){return _0x12bd07[_0xdf3c('0x7f')](_0x243fbf[_0xdf3c('0x4f')][_0xdf3c('0x7a')]);}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x4e01ca,null))[_0xdf3c('0x25')](handleError(_0x4e01ca,null));};exports['addLogo']=function(_0x4299d1,_0x132c27){_0x4299d1['body'][_0xdf3c('0x80')]=_0x4299d1[_0xdf3c('0x81')][_0xdf3c('0x82')];return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4299d1[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x132c27,null))[_0xdf3c('0x2f')](saveUpdates(_0x4299d1['body'],null))[_0xdf3c('0x2f')](respondWithResult(_0x132c27,null))[_0xdf3c('0x25')](handleError(_0x132c27,null));};exports[_0xdf3c('0x83')]=function(_0x2dafff,_0x2a934a){_0x2dafff[_0xdf3c('0x65')]['agentAvatar']=_0x2dafff[_0xdf3c('0x81')][_0xdf3c('0x82')];return db['ChatWebsite'][_0xdf3c('0x64')]({'where':{'id':_0x2dafff[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2a934a,null))[_0xdf3c('0x2f')](saveUpdates(_0x2dafff[_0xdf3c('0x65')],null))[_0xdf3c('0x2f')](respondWithResult(_0x2a934a,null))[_0xdf3c('0x25')](handleError(_0x2a934a,null));};exports[_0xdf3c('0x84')]=function(_0x59cfce,_0x50b470){_0x59cfce[_0xdf3c('0x65')][_0xdf3c('0x85')]=_0x59cfce[_0xdf3c('0x81')][_0xdf3c('0x82')];return db['ChatWebsite']['find']({'where':{'id':_0x59cfce[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x50b470,null))[_0xdf3c('0x2f')](saveUpdates(_0x59cfce['body'],null))[_0xdf3c('0x2f')](respondWithResult(_0x50b470,null))[_0xdf3c('0x25')](handleError(_0x50b470,null));};exports[_0xdf3c('0x86')]=function(_0x53555a,_0x292798){_0x53555a[_0xdf3c('0x65')]['systemAvatar']=_0x53555a['file'][_0xdf3c('0x82')];return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x53555a[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x292798,null))[_0xdf3c('0x2f')](saveUpdates(_0x53555a[_0xdf3c('0x65')],null))['then'](respondWithResult(_0x292798,null))['catch'](handleError(_0x292798,null));};exports[_0xdf3c('0x87')]=function(_0x39c993,_0x2efe5b){var _0x140e5e=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x8a'));var _0x828c9c={'where':{'id':_0x39c993[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x80')],'raw':!![]};var _0x3e4a0e=![];return require(_0xdf3c('0x8b'))[_0xdf3c('0x8c')]()[_0xdf3c('0x2f')](function(_0x434b1b){if(_0x434b1b){_0x3e4a0e=_0x434b1b[_0xdf3c('0x8d')];}})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x828c9c);})['then'](handleEntityNotFound(_0x2efe5b,null))['then'](function(_0x7cf0de){if(_0x7cf0de){if(!_['isNil'](_0x7cf0de['sitepic'])){if(fs[_0xdf3c('0x8e')](path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x8f'),_0x7cf0de['sitepic']))&&_0x3e4a0e){_0x140e5e=path['join'](config['root'],_0xdf3c('0x8f'),_0x7cf0de[_0xdf3c('0x80')]);}}return _0x2efe5b[_0xdf3c('0x90')](_0x140e5e);}})['catch'](handleError(_0x2efe5b,null));};exports[_0xdf3c('0x91')]=function(_0x51f4b6,_0x37b921){var _0x4ba88f=path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x92'));var _0x3ff959={'where':{'id':_0x51f4b6[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x93')],'raw':!![]};return db[_0xdf3c('0x4c')]['find'](_0x3ff959)['then'](handleEntityNotFound(_0x37b921,null))[_0xdf3c('0x2f')](function(_0x57484a){if(_0x57484a){if(!_[_0xdf3c('0x94')](_0x57484a[_0xdf3c('0x93')])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x57484a[_0xdf3c('0x93')]))){_0x4ba88f=path['join'](config['root'],_0xdf3c('0x95'),_0x57484a[_0xdf3c('0x93')]);}}return _0x37b921[_0xdf3c('0x90')](_0x4ba88f);}})[_0xdf3c('0x25')](handleError(_0x37b921,null));};exports['getCustomerAvatar']=function(_0xe14463,_0x364b5e){var _0x32ec3c=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x96'));var _0x524482={'where':{'id':_0xe14463[_0xdf3c('0x61')]['id']},'attributes':['id',_0xdf3c('0x85'),'showCustomerAvatar'],'raw':!![]};return db[_0xdf3c('0x4c')][_0xdf3c('0x64')](_0x524482)[_0xdf3c('0x2f')](handleEntityNotFound(_0x364b5e,null))['then'](function(_0x87ec92){if(_0x87ec92){if(!_[_0xdf3c('0x94')](_0x87ec92[_0xdf3c('0x85')])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x87ec92[_0xdf3c('0x85')]))&&_0x87ec92[_0xdf3c('0x97')]){_0x32ec3c=path['join'](config[_0xdf3c('0x89')],'server/files/images/avatars/',_0x87ec92[_0xdf3c('0x85')]);}}return _0x364b5e[_0xdf3c('0x90')](_0x32ec3c);}})[_0xdf3c('0x25')](handleError(_0x364b5e,null));};exports[_0xdf3c('0x98')]=function(_0x90c66,_0x34344b){var _0x1e2f88=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x99'));var _0x3a90f4={'where':{'id':_0x90c66['params']['id']},'attributes':['id',_0xdf3c('0x9a')],'raw':!![]};return db[_0xdf3c('0x4c')]['find'](_0x3a90f4)[_0xdf3c('0x2f')](handleEntityNotFound(_0x34344b,null))[_0xdf3c('0x2f')](function(_0x367cd3){if(_0x367cd3){if(!_[_0xdf3c('0x94')](_0x367cd3['systemAvatar'])){if(fs[_0xdf3c('0x8e')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],'server/files/images/avatars/',_0x367cd3['systemAvatar']))){_0x1e2f88=path['join'](config[_0xdf3c('0x89')],_0xdf3c('0x95'),_0x367cd3[_0xdf3c('0x9a')]);}}return _0x34344b[_0xdf3c('0x90')](_0x1e2f88);}})[_0xdf3c('0x25')](handleError(_0x34344b,null));};function checkWebsiteInterval(_0x33132b){var _0x18a7ac=_0x33132b[_0xdf3c('0x9b')];if(!_0x18a7ac){return Promise['resolve'](_0x33132b);}var _0x1a0613=_0x33132b['timezone']||undefined;return _0x18a7ac[_0xdf3c('0x9c')](_0x1a0613)[_0xdf3c('0x2f')](function(_0x1b2e93){if(!_0x1b2e93){throw new APIOutOfIntervalError();}return _0x33132b;});}exports[_0xdf3c('0x9d')]=function(_0x3cb8a7,_0x440c7c){var _0x4e5569={'body':_0x3cb8a7[_0xdf3c('0x65')],'channel':_0xdf3c('0x9e')};var _0x4d3059=[];var _0x28337a=[];var _0x270353={};var _0x5926b6=![];if(_0x3cb8a7[_0xdf3c('0x65')]['id']){delete _0x3cb8a7['body']['id'];}if(_[_0xdf3c('0x94')](_0x3cb8a7['body'][_0xdf3c('0x9f')])){throw new APIBadRequestError(_0xdf3c('0xa0'));}if(_[_0xdf3c('0x94')](_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xa1')])){throw new APIBadRequestError(_0xdf3c('0xa2'));}if(_['isEmpty'](_0x3cb8a7['body']['body'])){throw new APIBadRequestError(_0xdf3c('0xa3'));}var _0x18f52c=_0x3cb8a7['body']['customerIp']&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];return db['CmContact']['describe']()[_0xdf3c('0x2f')](function(_0x242b95){if(!_0x242b95){throw new Error(_0xdf3c('0xa4'));}_0x4d3059=Object['keys'](_0x242b95)[_0xdf3c('0x59')](function(_0x51d880){return![_0xdf3c('0xa5'),_0xdf3c('0xa6')][_0xdf3c('0xa7')](_0x51d880);});_0x28337a=Object[_0xdf3c('0x50')](_0x242b95)[_0xdf3c('0x59')](function(_0x467090){return![_0xdf3c('0xa5'),_0xdf3c('0xa6'),_0xdf3c('0xa8'),'ListId'][_0xdf3c('0xa7')](_0x467090);});if(!_[_0xdf3c('0xa7')](_0x28337a,_0x3cb8a7['body'][_0xdf3c('0xa1')])){throw new APIBadRequestError(_0xdf3c('0xa9')+_0x28337a['join'](',\x20'));}_0x270353[_0x3cb8a7[_0xdf3c('0x65')]['mapKey']]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')];})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3cb8a7[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0xaa')],'as':_0xdf3c('0xab'),'include':[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0xad'),'where':_0x270353,'limit':0x1,'order':[[_0xdf3c('0xa6'),_0xdf3c('0xae')]]}]},{'model':db[_0xdf3c('0xaf')],'as':_0xdf3c('0xb0')},{'model':db[_0xdf3c('0x9b')],'as':_0xdf3c('0x9b'),'include':[{'model':db['Interval'],'as':_0xdf3c('0xb1'),'attributes':['id',_0xdf3c('0xb2')],'raw':!![]}]}]});})['then'](function(_0x518292){if(!_0x518292){throw new APINotFoundError(util[_0xdf3c('0x41')](_0xdf3c('0xb3'),_0x3cb8a7[_0xdf3c('0x61')]['id']));}if(_0x18f52c){return checkWebsiteInterval(_0x518292);}return _0x518292;})['then'](function(_0x5c3767){_0x4e5569[_0xdf3c('0xb4')]=_0x5c3767;_0x4e5569['applications']=_[_0xdf3c('0xb5')](_0x5c3767[_0xdf3c('0xb0')],['priority'],['asc']);if(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xb0')]){delete _0x4e5569[_0xdf3c('0xb4')]['Applications'];}_0x4e5569[_0xdf3c('0xb6')]=_0x5c3767['List']||{'id':_0x5c3767[_0xdf3c('0xb7')]};if(_0x4e5569[_0xdf3c('0xb6')]&&_0x4e5569[_0xdf3c('0xb6')][_0xdf3c('0xad')][_0xdf3c('0x63')]){return _0x4e5569[_0xdf3c('0xb6')]['Contacts'][0x0];}var _0x16ae87=_['defaults'](_0x3cb8a7[_0xdf3c('0x65')],{'firstName':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')],'ListId':_0x5c3767['ListId']});_0x16ae87[_0x3cb8a7[_0xdf3c('0x65')]['mapKey']]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x9f')];return db['CmContact'][_0xdf3c('0x72')](_0x16ae87,{'fields':_0x4d3059,'raw':!![]});})[_0xdf3c('0x2f')](function(_0x2c3655){_0x4e5569[_0xdf3c('0xb8')]=_0x2c3655;var _0x55969c=createInteractionObject(_0x3cb8a7[_0xdf3c('0x61')]['id'],_0x3cb8a7[_0xdf3c('0x65')],_0x3cb8a7[_0xdf3c('0xb9')],_0x2c3655);var _0x393d06={'ChatWebsiteId':_0x3cb8a7[_0xdf3c('0x61')]['id']};if(_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')]){_0x393d06['threadId']=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')];_0x393d06[_0xdf3c('0xbb')]=![];return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':_0x393d06})[_0xdf3c('0x2f')](function(_0x282f44){var _0x6e0498=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xbd')]&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];if(_0x282f44){_0x5926b6=!![];return _0x282f44;}else if(!_0x6e0498&&_0x282f44&&_0x282f44[_0xdf3c('0xbb')]){throw new APIConflictError(_0xdf3c('0xbe'));}_0x55969c[_0xdf3c('0xba')]=_0x3cb8a7['body'][_0xdf3c('0xba')];_0x55969c[_0xdf3c('0xbf')]=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xbf')];return db[_0xdf3c('0xbc')]['create'](_0x55969c);});}_0x393d06[_0xdf3c('0xc0')]=_0x2c3655['id'];if(_0x3cb8a7[_0xdf3c('0x65')]['interaction']&&_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc1')]['id']){_0x393d06['id']=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc1')]['id'];return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':_0x393d06})[_0xdf3c('0x2f')](function(_0x3d9041){var _0x16564c=_0x3cb8a7['body'][_0xdf3c('0xbd')]&&_0x3cb8a7[_0xdf3c('0x65')]['referer'];if(!_0x16564c&&_0x3d9041&&_0x3d9041[_0xdf3c('0xbb')]){throw new APIConflictError(_0xdf3c('0xbe'));}else if(_0x3d9041){_0x5926b6=!![];return _0x3d9041;}else{return db['ChatInteraction']['create'](_0x55969c);}});}return db[_0xdf3c('0xbc')][_0xdf3c('0x72')](_0x55969c);})[_0xdf3c('0x2f')](function(_0x2bf92d){if(!_0x5926b6){return _0x2bf92d;}var _0x1f5c1b={'from':(_0x4e5569[_0xdf3c('0xb8')][_0xdf3c('0x3a')]||'')+'\x20'+(_0x4e5569[_0xdf3c('0xb8')]['lastName']||'')};if(_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xba')]&&_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc2')]&&_0x3cb8a7['body'][_0xdf3c('0xba')]!=_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xc2')]){_0x1f5c1b[_0xdf3c('0xba')]=_0x3cb8a7['body'][_0xdf3c('0xc2')];}return _0x2bf92d[_0xdf3c('0x73')](_0x1f5c1b);})[_0xdf3c('0x2f')](function(_0x58bc3a){_0x4e5569['interaction']=_0x58bc3a[_0xdf3c('0x30')]({'plain':!![]});_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xc3')]=!_0x5926b6;if(_0x4e5569['interaction'][_0xdf3c('0xc3')]){if(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xc4')]){_0x4e5569[_0xdf3c('0xc5')][_0xdf3c('0xc6')]({'id':0x0,'priority':_0x4e5569['applications']['length']+0x1,'app':_0xdf3c('0xc7'),'appdata':'unmanaged','interval':_0xdf3c('0xc8')});}}return db[_0xdf3c('0xc9')][_0xdf3c('0x72')]({'body':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0x65')],'ChatWebsiteId':_0x3cb8a7[_0xdf3c('0x61')]['id'],'ChatInteractionId':_0x58bc3a['id'],'direction':'in','ContactId':_0x4e5569['contact']['id'],'AttachmentId':_0x3cb8a7[_0xdf3c('0x65')][_0xdf3c('0xca')]});})[_0xdf3c('0x2f')](function(_0x5fcc1){_0x4e5569['message']=_0x5fcc1;if(!_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xcb')]){return;}return db[_0xdf3c('0xcc')]['find']({'attributes':['id','name'],'where':{'id':_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xcb')]}});})['then'](function(_0x20af56){if(_0x20af56){_0x4e5569['applications'][_0xdf3c('0xcd')]({'id':0x0,'priority':0x0,'app':_0xdf3c('0xce'),'appdata':_0x20af56[_0xdf3c('0x3f')]+','+(_0x4e5569[_0xdf3c('0xb4')][_0xdf3c('0xcf')]||0xa),'interval':_0xdf3c('0xc8')});_0x4e5569['forcedOwnership']=!![];}if(!_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xd0')]){return;}return db[_0xdf3c('0xd1')][_0xdf3c('0x64')]({'attributes':['id',_0xdf3c('0x3f')],'where':{'id':_0x4e5569[_0xdf3c('0xc1')][_0xdf3c('0xd0')]}});})[_0xdf3c('0x2f')](function(_0x43ce1f){if(_0x43ce1f){_0x4e5569[_0xdf3c('0xc5')][_0xdf3c('0xcd')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43ce1f[_0xdf3c('0x3f')]+','+(_0x4e5569[_0xdf3c('0xb4')]['waitForTheAssignedQueue']||0x12c),'interval':_0xdf3c('0xc8')});}return respondWithRpcPromise(_0xdf3c('0xd2'),_0xdf3c('0xd3'),_0x4e5569);})[_0xdf3c('0x2f')](function(_0xa316ce){respondWithRpcPromise('EventManager',_0xdf3c('0xd4'),{'event':_0xdf3c('0x9d'),'message':_0xa316ce},client9002);return _0xa316ce;})[_0xdf3c('0x2f')](respondWithResult(_0x440c7c,null))[_0xdf3c('0x25')](APIHandleError(_0x440c7c));};exports[_0xdf3c('0xd5')]=function(_0x31391d,_0x158c75){var _0x7554e2,_0xdc8438,_0x4727f2;var _0x299dc3=[];var _0x4c3c70={};var _0x352c54=_0x31391d['files']||[];var _0x40c59b=[];var _0x11a887;return db['CmContact'][_0xdf3c('0xd6')]()[_0xdf3c('0x2f')](function(_0x44388c){if(!_0x44388c){throw new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xd9'));}_0x299dc3=_[_0xdf3c('0xda')](_[_0xdf3c('0x50')](_0x44388c),[_0xdf3c('0xa5'),_0xdf3c('0xa6'),'CompanyId',_0xdf3c('0xb7')]);if(_0x31391d[_0xdf3c('0x65')]['id']){delete _0x31391d['body']['id'];}if(_[_0xdf3c('0x94')](_0x31391d['body'][_0xdf3c('0x9f')])){throw _0x158c75['status'](0x1f4)[_0xdf3c('0xdb')](new db['Sequelize'][(_0xdf3c('0xd8'))](_0xdf3c('0xdc')));}if(_[_0xdf3c('0x94')](_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x65')])||_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x65')]===''){throw _0x158c75[_0xdf3c('0x27')](0x1f4)['send'](new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xdd')));}if(_['isNil'](_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')])){throw _0x158c75[_0xdf3c('0x27')](0x1f4)[_0xdf3c('0xdb')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x299dc3));}if(!_['includes'](_0x299dc3,_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')])){throw _0x158c75[_0xdf3c('0x27')](0x1f4)[_0xdf3c('0xdb')](new db[(_0xdf3c('0xd7'))][(_0xdf3c('0xd8'))](_0xdf3c('0xdf')+_0x299dc3));}_0x4c3c70[_0x31391d['body'][_0xdf3c('0xde')]]=_0x31391d['body'][_0xdf3c('0x9f')];})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x31391d[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0xaa')],'as':_0xdf3c('0xab')},{'model':db[_0xdf3c('0xe0')],'as':'MailAccount'}]});})[_0xdf3c('0x2f')](handleEntityNotFound(_0x158c75,null))[_0xdf3c('0x2f')](function(_0x474e78){if(_0x474e78&&_0x474e78[_0xdf3c('0xab')]){_0xdc8438=_0x474e78;var _0x25bc5a=_['defaults'](_0x31391d['body'],{'firstName':_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')],'phone':_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')],'ListId':_0x474e78[_0xdf3c('0xb7')]});_0x25bc5a[_0x31391d[_0xdf3c('0x65')][_0xdf3c('0xde')]]=_0x31391d[_0xdf3c('0x65')][_0xdf3c('0x9f')];return db[_0xdf3c('0xac')][_0xdf3c('0xe1')]({'where':_0x4c3c70,'defaults':_0x25bc5a});}})['spread'](function(_0x345a7b){if(_0x345a7b){_0x4727f2=_0x345a7b;var _0x14a995=fs[_0xdf3c('0xe2')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0xe3')),_0xdf3c('0xe4'));var _0x4e8ad8=ejs[_0xdf3c('0xe5')](_0x14a995,{'body':_['toPairs'](_0x31391d[_0xdf3c('0x65')]['body']),'bodyTitle':_0xdc8438[_0xdf3c('0xe6')]});return db[_0xdf3c('0xe7')]['create']({'body':_0x4e8ad8,'plainBody':htmlToText['fromString'](_0x4e8ad8),'ContactId':_0x345a7b['id'],'ChatWebsiteId':_0xdc8438['id']});}})[_0xdf3c('0x2f')](function(_0x10b2d9){_0x11a887=_0x10b2d9;if(_0x352c54[_0xdf3c('0x63')]){var _0x31d7d7=_0x352c54[_0xdf3c('0x4b')](function(_0x50e6e7){return{'name':_0x50e6e7[_0xdf3c('0xe8')],'basename':_0x50e6e7[_0xdf3c('0x82')],'type':_0x50e6e7[_0xdf3c('0xe9')],'ChatOfflineMessageId':_0x10b2d9['id']};});_0x40c59b=_0x31d7d7[_0xdf3c('0x4b')](_0x40944d=>{var _0x5b6c9a={'filename':_0x40944d[_0xdf3c('0x3f')],'path':path['join'](config[_0xdf3c('0x89')],'server','files',_0xdf3c('0xea'),_0xdf3c('0xeb'),_0x40944d[_0xdf3c('0xec')])};return _0x5b6c9a;});if(!_0xdc8438[_0xdf3c('0xed')]){return db[_0xdf3c('0xee')]['transaction'](function(_0xd3d760){return db[_0xdf3c('0xef')]['bulkCreate'](_0x31d7d7,{'transaction':_0xd3d760});});}}})[_0xdf3c('0x2f')](function(){if(_0x11a887){_0x7554e2=_0x11a887;return db[_0xdf3c('0xe0')][_0xdf3c('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0xdf3c('0xf0')],'as':_0xdf3c('0xf1'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xdf3c('0xf2'),'raw':!![]}]}]});}})[_0xdf3c('0x2f')](function(_0x25ed77){if(_0x25ed77&&_0x25ed77[_0xdf3c('0xf1')]&&_0xdc8438[_0xdf3c('0xf3')]&&_0xdc8438['forwardOfflineAddress']){var _0x2cf46=_0x25ed77[_0xdf3c('0xf4')]();return respondWithRpcPromise(_0xdf3c('0xf5'),_0xdf3c('0xf6'),{'account':_0x2cf46,'message':{'from':util[_0xdf3c('0x41')](_0xdf3c('0xf7'),_0x25ed77[_0xdf3c('0x3f')],_0x25ed77[_0xdf3c('0xf8')]||_0x25ed77[_0xdf3c('0xf1')][_0xdf3c('0x6b')]),'to':_0xdc8438[_0xdf3c('0xf9')],'subject':_0xdc8438[_0xdf3c('0xfa')],'html':_0x7554e2[_0xdf3c('0x65')],'attachments':_0x40c59b}},client9003)[_0xdf3c('0x2f')](function(){return _0x7554e2;})[_0xdf3c('0x25')](function(_0x2be6c7){logger[_0xdf3c('0x21')](_0x2be6c7);});}})[_0xdf3c('0x2f')](function(){if(_0xdc8438&&_0xdc8438['openNewInteraction']&&_0xdc8438[_0xdf3c('0xfb')]){var _0x350e07=[];if(_0x352c54[_0xdf3c('0x63')]){_0x350e07=_0x352c54['map'](function(_0xb9f71c){return{'name':_0xb9f71c['originalname'],'basename':_0xb9f71c[_0xdf3c('0x82')],'type':_0xb9f71c['mimetype'],'ChatOfflineMessageId':_0x11a887['id']};});}var _0x425ddb;if(!_[_0xdf3c('0x94')](_0xdc8438[_0xdf3c('0xfc')])){var _0xd9aaa5=_[_0xdf3c('0x4b')](_0x31391d[_0xdf3c('0x65')],function(_0xd8be1){return _0xd8be1;});var _0x4642ca=_[_0xdf3c('0xfd')](_0xd9aaa5)[0x0];var _0x4e3a41=_[_0xdf3c('0xfe')](_0x4642ca,function(_0x3e3d63){return _0x3e3d63;});_0x425ddb=_0x4e3a41[0x1][_0xdc8438[_0xdf3c('0xfc')]];}var _0x2964ed={'from':_0x4727f2['email'],'firstName':_0x4727f2['firstName'],'lastName':_0x4727f2[_0xdf3c('0x3b')],'mapKey':_0xdf3c('0xf8'),'message':{'from':_0x4727f2[_0xdf3c('0xf8')],'to':_0xdc8438[_0xdf3c('0xe0')]['email'],'cc':'','subject':_[_0xdf3c('0x94')](_0x425ddb)?_0xdc8438['offlineMessageSubject']:_0x425ddb,'messageId':'','sentAt':new Date(),'attach':_0x350e07['length'],'attachments':_0x350e07,'originChannel':_0xdf3c('0xff'),'ChatWebsiteId':_0xdc8438['id'],'ChatOfflineMessageId':_0x7554e2['id'],'originTo':_0xdc8438[_0xdf3c('0xe0')]['email']},'body':_0x7554e2[_0xdf3c('0x65')]};var _0x19024e={'account':{'id':_0xdc8438['MailAccountId']},'body':_0x2964ed,'log':_0xdf3c('0x100')};return respondWithRpcPromise(_0xdf3c('0x100'),'notifyMail',_0x19024e,client9001)[_0xdf3c('0x2f')](function(){return _0x7554e2;})[_0xdf3c('0x25')](function(_0x119524){logger[_0xdf3c('0x21')](_0x119524);});}return;})[_0xdf3c('0x2f')](function(){if(_0x7554e2){return _0x7554e2;}})[_0xdf3c('0x2f')](respondWithResult(_0x158c75,null))['catch'](function(){for(var _0x5291d8 of _0x352c54){var _0x1a79a1=path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],_0xdf3c('0x101'),_0xdf3c('0x102'),_0xdf3c('0xea'),'offline-chat',_0x5291d8[_0xdf3c('0x82')]);fs_extra[_0xdf3c('0x103')](_0x1a79a1)[_0xdf3c('0x25')](function(_0xb25239){logger['error'](_0xdf3c('0x104'),_0x1a79a1,_0xb25239);});}});};exports[_0xdf3c('0x105')]=function(_0x50d59a,_0x112e4){return db[_0xdf3c('0xbc')][_0xdf3c('0x64')]({'where':{'id':_0x50d59a[_0xdf3c('0x61')]['id']}})['then'](handleEntityNotFound(_0x112e4,null))[_0xdf3c('0x2f')](function(_0xcb362a){if(_0xcb362a){return _0xcb362a[_0xdf3c('0x105')](_0x50d59a[_0xdf3c('0x65')]['ids'],_['omit'](_0x50d59a[_0xdf3c('0x65')],[_0xdf3c('0x7a'),'id'])||{});}})[_0xdf3c('0x2f')](respondWithResult(_0x112e4,null))[_0xdf3c('0x25')](handleError(_0x112e4,null));};exports[_0xdf3c('0x106')]=function(_0x3eb7b2,_0x3fec35){var _0x2fefc1={'raw':![],'where':{}};var _0x5b8dc4={};var _0x375d8d={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')]['findOne']({'where':{'id':_0x3eb7b2[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3fec35,null))['then'](function(_0x3d497d){if(_0x3d497d){_0x5b8dc4['model']=_[_0xdf3c('0x50')](db[_0xdf3c('0xbc')][_0xdf3c('0x4d')]);_0x5b8dc4[_0xdf3c('0x4f')]=_['keys'](_0x3eb7b2['query']);_0x5b8dc4['filters']=_[_0xdf3c('0x62')](_0x5b8dc4[_0xdf3c('0x45')],_0x5b8dc4[_0xdf3c('0x4f')]);_0x2fefc1[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0x5b8dc4[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3eb7b2['query'][_0xdf3c('0x53')]));_0x2fefc1[_0xdf3c('0x52')]=_0x2fefc1['attributes'][_0xdf3c('0x63')]?_0x2fefc1['attributes']:_0x5b8dc4[_0xdf3c('0x45')];if(!_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x54')]('nolimit')){_0x2fefc1[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x2fefc1[_0xdf3c('0x29')]=qs['offset'](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x2fefc1[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x2fefc1[_0xdf3c('0x58')]=qs['filters'](_[_0xdf3c('0x76')](_0x3eb7b2[_0xdf3c('0x4f')],_0x5b8dc4[_0xdf3c('0x51')]));_0x2fefc1['where'][_0xdf3c('0x77')]=_0x3d497d['id'];if(_0x3eb7b2['query'][_0xdf3c('0x59')]){_0x2fefc1[_0xdf3c('0x58')]=_['merge'](_0x2fefc1[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x2fefc1[_0xdf3c('0x52')],function(_0x27a534){var _0x45a467={};_0x45a467[_0x27a534]={'$like':'%'+_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x45a467;})});}_0x2fefc1=_[_0xdf3c('0x5a')]({},_0x2fefc1,_0x3eb7b2[_0xdf3c('0x78')]);return db[_0xdf3c('0xbc')][_0xdf3c('0x2c')]({'where':_0x2fefc1[_0xdf3c('0x58')]})['then'](function(_0x2888e3){_0x375d8d['count']=_0x2888e3;if(_0x3eb7b2['query']['includeAll']){_0x2fefc1['include']=[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0x107'),'required':![]},{'model':db[_0xdf3c('0xcc')],'as':_0xdf3c('0x108'),'attributes':[_0xdf3c('0x3f'),_0xdf3c('0x109'),'internal'],'required':![]},{'model':db[_0xdf3c('0x10a')],'as':'Tags','attributes':['id',_0xdf3c('0x3f'),_0xdf3c('0x10b')],'where':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]?{'id':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]}:undefined,'required':_0x3eb7b2[_0xdf3c('0x4f')][_0xdf3c('0x10c')]?!![]:![]}];}return db[_0xdf3c('0xbc')]['findAll'](_0x2fefc1);})[_0xdf3c('0x2f')](function(_0x258b2d){_0x375d8d[_0xdf3c('0x5f')]=_0x258b2d;return _0x375d8d;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x3fec35,_0x2fefc1))['catch'](handleError(_0x3fec35,null));};exports['getSnippet']=function(_0x1a1ac0,_0x22d16f){var _0x427a90=0x0;var _0x5f557c=0x0;var _0x559e83=![];var _0x2fc1d8;var _0x2c2775;return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x1a1ac0[_0xdf3c('0x61')]['id']},'include':[{'model':db[_0xdf3c('0x9b')],'as':_0xdf3c('0x9b'),'include':[{'model':db['Interval'],'as':_0xdf3c('0xb1'),'attributes':['id',_0xdf3c('0xb2')]}]}]})[_0xdf3c('0x2f')](handleEntityNotFound(_0x22d16f,null))[_0xdf3c('0x2f')](function(_0x367df9){if(_0x367df9){_0x2fc1d8=_0x367df9;return _0x367df9[_0xdf3c('0x10d')]({'raw':!![]});}})['then'](function(_0x4cfc67){if(_0x2fc1d8){if(_0x4cfc67){_0x2c2775=_0x4cfc67;}}return require(_0xdf3c('0x8b'))[_0xdf3c('0x8c')]();})[_0xdf3c('0x2f')](function(_0x1b2961){if(_0x1b2961){_0x5f557c=_0x1b2961[_0xdf3c('0x10e')];_0x559e83=_0x1b2961['custom'];}})[_0xdf3c('0x2f')](function(){return db[_0xdf3c('0xbc')][_0xdf3c('0x2c')]({'where':{'closed':![]}});})[_0xdf3c('0x2f')](function(_0x2cab31){_0x427a90=_0x2cab31;if(_0x5f557c&&_0x2cab31>_0x5f557c){return db[_0xdf3c('0x10f')]['findOne']({'where':{'id':0x1}})[_0xdf3c('0x2f')](function(_0x462195){if(_0x462195){_0x462195['increment'](_0xdf3c('0x110'));}});}})['then'](function(){var _0x32c476=_0x2fc1d8[_0xdf3c('0x9b')];var _0xa6fa19=_0x2fc1d8[_0xdf3c('0x111')]||undefined;return _0x32c476?_0x32c476['ifTime'](_0xa6fa19):!![];})['then'](function(_0xa523c8){var _0x52ae27=fs[_0xdf3c('0xe2')](path[_0xdf3c('0x88')](config[_0xdf3c('0x89')],'server/files/chat/iframe.ejs'),_0xdf3c('0xe4'));var _0x148785=_0xdf3c('0x112');var _0x2b0e64=![];var _0x479252,_0x5696dd;if(_0x1a1ac0[_0xdf3c('0xb9')]['referer']){_0x479252=new URL(_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x3d')])[_0xdf3c('0x113')];}else if(_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x113')]){_0x479252=new URL(_0x1a1ac0['headers'][_0xdf3c('0x113')])[_0xdf3c('0x113')];}else{_0x479252=_0xdf3c('0x114');}_0x5696dd=typeof _0x2fc1d8['address'][_0xdf3c('0x39')](',')[_0xdf3c('0x64')](function(_0x8f769e){return wildcardUtils[_0xdf3c('0x115')](_0x8f769e,_0x479252);})!==_0xdf3c('0x2a');var _0xc2306c={'chatVersion':_0x148785,'chatWebsiteAddressOrigin':_0x5696dd?_0x479252:_0x2fc1d8[_0xdf3c('0x66')],'remote':_0x2fc1d8['remote'],'query':querystring['stringify'](_[_0xdf3c('0x5a')](_0x2fc1d8['get']({'plain':!![]}),{'customerIp':_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x38')]||_0x1a1ac0[_0xdf3c('0xb9')][_0xdf3c('0x116')]||_0x1a1ac0['connection'][_0xdf3c('0x117')]||_0x1a1ac0['ip'],'referer':_0x1a1ac0['headers'][_0xdf3c('0x3d')],'openedInteractions':_0x427a90,'maxInteractions':_0x5f557c,'virtual':_0x559e83['virtual'],'online':_0xa523c8,'custom':_0x559e83,'address':_0x5696dd?_0x479252:null}))[_0xdf3c('0x118')](/'/g,'\x5c\x27')};_0x22d16f[_0xdf3c('0xdb')](ejs[_0xdf3c('0xe5')](Mustache[_0xdf3c('0xe5')](_0x52ae27,_0xc2306c),{'proactiveActions':_0x2c2775,'alignment':_0x2fc1d8[_0xdf3c('0x119')],'verticalAlignment':_0x2fc1d8[_0xdf3c('0x11a')],'div_color':_0x2fc1d8[_0xdf3c('0x10b')],'labelText':_0x2fc1d8['labelText'],'text_color':_0x2fc1d8[_0xdf3c('0x11b')],'text_button_color':_0x2fc1d8[_0xdf3c('0x11c')],'button_color':_0x2fc1d8[_0xdf3c('0x11d')],'background_color':_0x2fc1d8[_0xdf3c('0x11e')],'hideWhenOffline':_0x2fc1d8['hideWhenOffline'],'intervalId':_0x2fc1d8[_0xdf3c('0x11f')],'isDevelopment':_0x2b0e64,'chatVersion':_0x148785}));})[_0xdf3c('0x25')](handleError(_0x22d16f,null));};exports[_0xdf3c('0x120')]=function(_0x2ac5c7,_0x361143){var _0x526533=_0x2ac5c7['params']['id'];var _0x54a06b=_0x2ac5c7[_0xdf3c('0x65')];var _0x47bef6=0xc8;var _0x3ff664=null;return db['sequelize'][_0xdf3c('0x121')]({'isolationLevel':db[_0xdf3c('0xee')][_0xdf3c('0x122')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4dd133){return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x526533},'transaction':_0x4dd133})['then'](function(_0x3819cd){if(_0x3819cd){return db[_0xdf3c('0xaf')][_0xdf3c('0x32')]({'where':{'ChatWebsiteId':_0x526533},'transaction':_0x4dd133})[_0xdf3c('0x2f')](function(){var _0xa729d1=_[_0xdf3c('0x4b')](_0x54a06b,function(_0x2e0bf3){_0x2e0bf3[_0xdf3c('0x77')]=_0x526533;return _0x2e0bf3;});return db['ChatApplication'][_0xdf3c('0x123')](_0xa729d1,{'transaction':_0x4dd133});});}else{_0x47bef6=0x194;_0x3ff664=[];}});})[_0xdf3c('0x2f')](function(){if(_0x47bef6!==0x194){return db[_0xdf3c('0xaf')][_0xdf3c('0x124')]({'where':{'ChatWebsiteId':_0x526533},'order':_0xdf3c('0x125')})['then'](function(_0x461212){_0x3ff664=_0x461212;});}})[_0xdf3c('0x25')](function(_0x41f47a){_0x47bef6=0x1f4;logger[_0xdf3c('0x21')](_0x41f47a[_0xdf3c('0x33')]);if(_0x41f47a[_0xdf3c('0x3f')]){delete _0x41f47a['name'];}_0x3ff664=_0x41f47a;})[_0xdf3c('0x126')](function(){if(_0x3ff664===null){_0x361143['sendStatus'](_0x47bef6);}else{if(_0x47bef6===0x1f4){_0x361143[_0xdf3c('0x27')](_0x47bef6)[_0xdf3c('0xdb')](_0x3ff664);}else{_0x361143[_0xdf3c('0x27')](_0x47bef6)[_0xdf3c('0x28')](_0x3ff664);}}});};exports[_0xdf3c('0x127')]=function(_0x2724b6,_0x3c1a8a){var _0x3b0c07={};var _0x40506e={};var _0x4b46cf;var _0x31cdad;return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x2724b6['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3c1a8a,null))['then'](function(_0xddf03e){if(_0xddf03e){_0x4b46cf=_0xddf03e;_0x40506e[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0xaf')][_0xdf3c('0x4d')]);_0x40506e[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x2724b6[_0xdf3c('0x4f')]);_0x40506e[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x40506e[_0xdf3c('0x45')],_0x40506e[_0xdf3c('0x4f')]);_0x3b0c07['attributes']=_['intersection'](_0x40506e['model'],qs[_0xdf3c('0x53')](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x3b0c07[_0xdf3c('0x52')]=_0x3b0c07[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x3b0c07[_0xdf3c('0x52')]:_0x40506e[_0xdf3c('0x45')];_0x3b0c07[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x57')]);_0x3b0c07[_0xdf3c('0x58')]=qs['filters'](_['pick'](_0x2724b6[_0xdf3c('0x4f')],_0x40506e[_0xdf3c('0x51')]));if(_0x2724b6[_0xdf3c('0x4f')]['filter']){_0x3b0c07[_0xdf3c('0x58')]=_['merge'](_0x3b0c07[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x3b0c07['attributes'],function(_0xabf05c){var _0x2e4a90={};_0x2e4a90[_0xabf05c]={'$like':'%'+_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x2e4a90;})});}_0x3b0c07=_[_0xdf3c('0x5a')]({},_0x3b0c07,_0x2724b6[_0xdf3c('0x78')]);return _0x4b46cf[_0xdf3c('0x127')](_0x3b0c07);}})[_0xdf3c('0x2f')](function(_0x5e6a87){if(_0x5e6a87){_0x31cdad=_0x5e6a87[_0xdf3c('0x63')];if(!_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x3b0c07['limit']=qs['limit'](_0x2724b6[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x3b0c07[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x2724b6['query']['offset']);}return _0x4b46cf[_0xdf3c('0x127')](_0x3b0c07);}})[_0xdf3c('0x2f')](function(_0x381d88){if(_0x381d88){return _0x381d88?{'count':_0x31cdad,'rows':_0x381d88}:null;}})['then'](respondWithResult(_0x3c1a8a,null))[_0xdf3c('0x25')](handleError(_0x3c1a8a,null));};exports['addProactiveActions']=function(_0x10bdce,_0x3cb78b){return db[_0xdf3c('0x128')]['find']({'where':{'id':_0x10bdce['params']['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x3cb78b,null))[_0xdf3c('0x2f')](function(_0x3c0d93){if(_0x3c0d93){return _0x3c0d93['addProactiveActions'](_0x10bdce[_0xdf3c('0x65')][_0xdf3c('0x7a')],_['omit'](_0x10bdce[_0xdf3c('0x65')],[_0xdf3c('0x7a'),'id'])||{});}})[_0xdf3c('0x2f')](respondWithResult(_0x3cb78b,null))[_0xdf3c('0x25')](handleError(_0x3cb78b,null));};exports[_0xdf3c('0x10d')]=function(_0x3e8060,_0x1d61c5){var _0x7d5fda={};var _0x9f1875={};var _0x21e823;var _0xd66ea7;return db['ChatWebsite'][_0xdf3c('0x7d')]({'where':{'id':_0x3e8060[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1d61c5,null))['then'](function(_0x6cce5f){if(_0x6cce5f){_0x21e823=_0x6cce5f;_0x9f1875[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0x129')]['rawAttributes']);_0x9f1875[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x3e8060[_0xdf3c('0x4f')]);_0x9f1875[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0x9f1875[_0xdf3c('0x45')],_0x9f1875['query']);_0x7d5fda[_0xdf3c('0x52')]=_['intersection'](_0x9f1875[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x3e8060[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x7d5fda[_0xdf3c('0x52')]=_0x7d5fda[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x7d5fda[_0xdf3c('0x52')]:_0x9f1875['model'];_0x7d5fda[_0xdf3c('0x56')]=qs['sort'](_0x3e8060[_0xdf3c('0x4f')]['sort']);_0x7d5fda['where']=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x3e8060['query'],_0x9f1875[_0xdf3c('0x51')]));if(_0x3e8060['query']['filter']){_0x7d5fda[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x7d5fda[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x7d5fda[_0xdf3c('0x52')],function(_0x4280ac){var _0x2a2447={};_0x2a2447[_0x4280ac]={'$like':'%'+_0x3e8060[_0xdf3c('0x4f')]['filter']+'%'};return _0x2a2447;})});}_0x7d5fda=_[_0xdf3c('0x5a')]({},_0x7d5fda,_0x3e8060[_0xdf3c('0x78')]);return _0x21e823[_0xdf3c('0x10d')](_0x7d5fda);}})[_0xdf3c('0x2f')](function(_0x69233c){if(_0x69233c){_0xd66ea7=_0x69233c[_0xdf3c('0x63')];if(!_0x3e8060['query'][_0xdf3c('0x54')](_0xdf3c('0x55'))){_0x7d5fda[_0xdf3c('0x2b')]=qs[_0xdf3c('0x2b')](_0x3e8060['query']['limit']);_0x7d5fda[_0xdf3c('0x29')]=qs['offset'](_0x3e8060[_0xdf3c('0x4f')]['offset']);}return _0x21e823[_0xdf3c('0x10d')](_0x7d5fda);}})[_0xdf3c('0x2f')](function(_0x58d739){if(_0x58d739){return _0x58d739?{'count':_0xd66ea7,'rows':_0x58d739}:null;}})[_0xdf3c('0x2f')](respondWithResult(_0x1d61c5,null))[_0xdf3c('0x25')](handleError(_0x1d61c5,null));};exports[_0xdf3c('0x12a')]=function(_0x346270,_0x2c732e){var _0x396f50=_0x346270['query']['online']===_0xdf3c('0x12b')?'offlineForm':_0xdf3c('0x12c');return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'attributes':['id',_0x396f50],'where':{'id':_0x346270[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x2c732e,null))[_0xdf3c('0x2f')](function(_0x5ef7a6){if(_0x5ef7a6){var _0x54acce=_0x5ef7a6[_0x396f50];var _0x58a7b7=_0x54acce&&_0x54acce[_0xdf3c('0x12d')]?_0x54acce['items']:[];_0x2c732e[_0xdf3c('0xdb')]({'fromKey':_[_0xdf3c('0x94')](_0x54acce['fromKey'])?undefined:_0x54acce[_0xdf3c('0x12e')],'count':_0x58a7b7[_0xdf3c('0x63')],'rows':_0x58a7b7});}})[_0xdf3c('0x25')](handleError(_0x2c732e,null));};exports[_0xdf3c('0x12f')]=function(_0x2beff1,_0x4264e6){var _0x26dbe6={'raw':![],'where':{}};var _0xdb9eb4={};var _0x5adb7b={'count':0x0,'rows':[]};return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x2beff1[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x4264e6,null))[_0xdf3c('0x2f')](function(_0x120f66){if(_0x120f66){_0xdb9eb4[_0xdf3c('0x45')]=_[_0xdf3c('0x50')](db[_0xdf3c('0xe7')][_0xdf3c('0x4d')]);_0xdb9eb4[_0xdf3c('0x4f')]=_[_0xdf3c('0x50')](_0x2beff1[_0xdf3c('0x4f')]);_0xdb9eb4[_0xdf3c('0x51')]=_[_0xdf3c('0x62')](_0xdb9eb4['model'],_0xdb9eb4[_0xdf3c('0x4f')]);_0x26dbe6['attributes']=_[_0xdf3c('0x62')](_0xdb9eb4[_0xdf3c('0x45')],qs['fields'](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x26dbe6['attributes']=_0x26dbe6[_0xdf3c('0x52')][_0xdf3c('0x63')]?_0x26dbe6[_0xdf3c('0x52')]:_0xdb9eb4[_0xdf3c('0x45')];if(!_0x2beff1['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x26dbe6[_0xdf3c('0x2b')]=qs['limit'](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x2b')]);_0x26dbe6[_0xdf3c('0x29')]=qs[_0xdf3c('0x29')](_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x29')]);}_0x26dbe6[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x2beff1['query'][_0xdf3c('0x57')]);_0x26dbe6[_0xdf3c('0x58')]=qs[_0xdf3c('0x51')](_[_0xdf3c('0x76')](_0x2beff1[_0xdf3c('0x4f')],_0xdb9eb4[_0xdf3c('0x51')]));_0x26dbe6[_0xdf3c('0x58')]['ChatWebsiteId']=_0x120f66['id'];if(_0x2beff1[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x26dbe6[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x26dbe6[_0xdf3c('0x58')],{'$or':_[_0xdf3c('0x4b')](_0x26dbe6[_0xdf3c('0x52')],function(_0x14d34d){var _0x367cf0={};_0x367cf0[_0x14d34d]={'$like':'%'+_0x2beff1[_0xdf3c('0x4f')]['filter']+'%'};return _0x367cf0;})});}_0x26dbe6=_[_0xdf3c('0x5a')]({},_0x26dbe6,_0x2beff1[_0xdf3c('0x78')]);return db[_0xdf3c('0xe7')][_0xdf3c('0x2c')]({'where':_0x26dbe6[_0xdf3c('0x58')]})[_0xdf3c('0x2f')](function(_0x82b7ee){_0x5adb7b[_0xdf3c('0x2c')]=_0x82b7ee;if(_0x2beff1['query']['includeAll']){_0x26dbe6[_0xdf3c('0x5d')]=[{'all':!![]}];}else{_0x26dbe6['include']=[{'model':db[_0xdf3c('0xac')],'as':_0xdf3c('0x107'),'required':![]},{'model':db[_0xdf3c('0xef')],'as':_0xdf3c('0x130'),'required':![]}];}return db[_0xdf3c('0xe7')]['findAll'](_0x26dbe6);})[_0xdf3c('0x2f')](function(_0xf864e2){_0x5adb7b[_0xdf3c('0x5f')]=_0xf864e2;return _0x5adb7b;});}})[_0xdf3c('0x2f')](respondWithFilteredResult(_0x4264e6,_0x26dbe6))[_0xdf3c('0x25')](handleError(_0x4264e6,null));};exports['addAgents']=function(_0x4fcf64,_0x471f69){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x4fcf64[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x471f69,null))[_0xdf3c('0x2f')](function(_0x4fe59c){if(_0x4fe59c){return _0x4fe59c[_0xdf3c('0x131')](_0x4fcf64[_0xdf3c('0x65')][_0xdf3c('0x7a')],_['omit'](_0x4fcf64['body'],[_0xdf3c('0x7a'),'id'])||{})['spread'](function(_0x4dc604){for(var _0x136935=0x0;_0x136935<_0x4fcf64[_0xdf3c('0x65')]['ids'][_0xdf3c('0x63')];_0x136935+=0x1){socket[_0xdf3c('0x132')](_0xdf3c('0x133'),{'UserId':Number(_0x4fcf64[_0xdf3c('0x65')][_0xdf3c('0x7a')][_0x136935]),'ChatWebsiteId':Number(_0x4fcf64[_0xdf3c('0x61')]['id'])});}return _0x4dc604;});}})[_0xdf3c('0x2f')](respondWithResult(_0x471f69,null))['catch'](handleError(_0x471f69,null));};exports['removeAgents']=function(_0x3dc2da,_0x413aa3){return db[_0xdf3c('0x4c')][_0xdf3c('0x64')]({'where':{'id':_0x3dc2da[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x413aa3,null))[_0xdf3c('0x2f')](function(_0x20e6b0){if(_0x20e6b0){return _0x20e6b0[_0xdf3c('0x134')](_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')])[_0xdf3c('0x2f')](function(){if(_['isArray'](_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')])){for(var _0x20d58c=0x0;_0x20d58c<_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')][_0xdf3c('0x63')];_0x20d58c+=0x1){socket[_0xdf3c('0x132')](_0xdf3c('0x135'),{'UserId':Number(_0x3dc2da[_0xdf3c('0x4f')][_0xdf3c('0x7a')][_0x20d58c]),'ChatWebsiteId':Number(_0x3dc2da['params']['id'])});}}else{socket[_0xdf3c('0x132')](_0xdf3c('0x135'),{'UserId':Number(_0x3dc2da[_0xdf3c('0x4f')]['ids']),'ChatWebsiteId':Number(_0x3dc2da[_0xdf3c('0x61')]['id'])});}});}})[_0xdf3c('0x2f')](respondWithStatusCode(_0x413aa3,null))[_0xdf3c('0x25')](handleError(_0x413aa3,null));};exports[_0xdf3c('0x136')]=function(_0x5226da,_0x1c9417){var _0x5e7070={};var _0xd096c7={};var _0x2af066;var _0x4a9157;return db[_0xdf3c('0x4c')][_0xdf3c('0x7d')]({'where':{'id':_0x5226da[_0xdf3c('0x61')]['id']}})[_0xdf3c('0x2f')](handleEntityNotFound(_0x1c9417,null))['then'](function(_0x5b59e6){if(_0x5b59e6){_0x2af066=_0x5b59e6;_0xd096c7[_0xdf3c('0x45')]=_['keys'](db[_0xdf3c('0xcc')]['rawAttributes']);_0xd096c7[_0xdf3c('0x4f')]=_['keys'](_0x5226da[_0xdf3c('0x4f')]);_0xd096c7[_0xdf3c('0x51')]=_['intersection'](_0xd096c7[_0xdf3c('0x45')],_0xd096c7['query']);_0x5e7070[_0xdf3c('0x52')]=_[_0xdf3c('0x62')](_0xd096c7[_0xdf3c('0x45')],qs[_0xdf3c('0x53')](_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x53')]));_0x5e7070['attributes']=_0x5e7070['attributes'][_0xdf3c('0x63')]?_0x5e7070['attributes']:_0xd096c7[_0xdf3c('0x45')];_0x5e7070[_0xdf3c('0x56')]=qs[_0xdf3c('0x57')](_0x5226da['query'][_0xdf3c('0x57')]);_0x5e7070[_0xdf3c('0x58')]=qs['filters'](_['pick'](_0x5226da[_0xdf3c('0x4f')],_0xd096c7['filters']));if(_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x59')]){_0x5e7070[_0xdf3c('0x58')]=_[_0xdf3c('0x5a')](_0x5e7070['where'],{'$or':_['map'](_0x5e7070[_0xdf3c('0x52')],function(_0xc5ad19){var _0x275ac3={};_0x275ac3[_0xc5ad19]={'$like':'%'+_0x5226da[_0xdf3c('0x4f')][_0xdf3c('0x59')]+'%'};return _0x275ac3;})});}_0x5e7070=_['merge']({},_0x5e7070,_0x5226da[_0xdf3c('0x78')]);return _0x2af066[_0xdf3c('0x136')](_0x5e7070);}})[_0xdf3c('0x2f')](function(_0x17a760){if(_0x17a760){_0x4a9157=_0x17a760[_0xdf3c('0x63')];if(!_0x5226da[_0xdf3c('0x4f')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x5e7070['limit']=qs[_0xdf3c('0x2b')](_0x5226da['query'][_0xdf3c('0x2b')]);_0x5e7070[_0xdf3c('0x29')]=qs['offset'](_0x5226da[_0xdf3c('0x4f')]['offset']);}return _0x2af066[_0xdf3c('0x136')](_0x5e7070);}})[_0xdf3c('0x2f')](function(_0x241f9d){if(_0x241f9d){return _0x241f9d?{'count':_0x4a9157,'rows':_0x241f9d}:null;}})[_0xdf3c('0x2f')](respondWithResult(_0x1c9417,null))[_0xdf3c('0x25')](handleError(_0x1c9417,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 539a5c4..3e250b6 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 _0x1159=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2a9d67,_0x57758f){var _0x30ed3f=function(_0x55f792){while(--_0x55f792){_0x2a9d67['push'](_0x2a9d67['shift']());}};_0x30ed3f(++_0x57758f);}(_0x1159,0xf3));var _0x9115=function(_0x352a71,_0x1041d4){_0x352a71=_0x352a71-0x0;var _0xb43935=_0x1159[_0x352a71];return _0xb43935;};'use strict';var EventEmitter=require(_0x9115('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9115('0x1')](0x0);var events={'afterCreate':_0x9115('0x2'),'afterUpdate':_0x9115('0x3'),'afterDestroy':_0x9115('0x4')};function emitEvent(_0x4554f6){return function(_0x4661fc,_0xe754b3,_0x45234e){ChatWebsiteEvents['emit'](_0x4554f6+':'+_0x4661fc['id'],_0x4661fc);ChatWebsiteEvents[_0x9115('0x5')](_0x4554f6,_0x4661fc);_0x45234e(null);};}for(var e in events){if(events[_0x9115('0x6')](e)){var event=events[e];ChatWebsite[_0x9115('0x7')](e,emitEvent(event));}}module[_0x9115('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x87df=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x12813f,_0x38ae10){var _0x313ce3=function(_0x4006fe){while(--_0x4006fe){_0x12813f['push'](_0x12813f['shift']());}};_0x313ce3(++_0x38ae10);}(_0x87df,0x167));var _0xf87d=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x87df[_0x3fc287];return _0x33af9f;};'use strict';var EventEmitter=require(_0xf87d('0x0'));var ChatWebsite=require(_0xf87d('0x1'))['db'][_0xf87d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf87d('0x3')](0x0);var events={'afterCreate':_0xf87d('0x4'),'afterUpdate':_0xf87d('0x5'),'afterDestroy':_0xf87d('0x6')};function emitEvent(_0xb0fb5a){return function(_0x25290a,_0x1d4ff6,_0x4fbca2){ChatWebsiteEvents['emit'](_0xb0fb5a+':'+_0x25290a['id'],_0x25290a);ChatWebsiteEvents[_0xf87d('0x7')](_0xb0fb5a,_0x25290a);_0x4fbca2(null);};}for(var e in events){if(events[_0xf87d('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xf87d('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 130aa5f..7ea285b 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 _0x2b92=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2b92,0x1a6));var _0x22b9=function(_0x5e6c8f,_0x16b75f){_0x5e6c8f=_0x5e6c8f-0x0;var _0x2f27ee=_0x2b92[_0x5e6c8f];return _0x2f27ee;};'use strict';var _=require(_0x22b9('0x0'));var util=require(_0x22b9('0x1'));var logger=require(_0x22b9('0x2'))(_0x22b9('0x3'));var moment=require(_0x22b9('0x4'));var BPromise=require(_0x22b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22b9('0x6'));var rimraf=require(_0x22b9('0x7'));var config=require(_0x22b9('0x8'));var attributes=require(_0x22b9('0x9'));module[_0x22b9('0xa')]=function(_0x1590bc,_0x3aa4f4){return _0x1590bc['define'](_0x22b9('0xb'),attributes,{'tableName':_0x22b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa9e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xaa9e,0xa8));var _0xeaa9=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xaa9e[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xeaa9('0x0'));var util=require('util');var logger=require(_0xeaa9('0x1'))(_0xeaa9('0x2'));var moment=require(_0xeaa9('0x3'));var BPromise=require(_0xeaa9('0x4'));var rp=require(_0xeaa9('0x5'));var fs=require('fs');var path=require(_0xeaa9('0x6'));var rimraf=require(_0xeaa9('0x7'));var config=require(_0xeaa9('0x8'));var attributes=require(_0xeaa9('0x9'));module[_0xeaa9('0xa')]=function(_0x5cb17c,_0x3d2e78){return _0x5cb17c[_0xeaa9('0xb')](_0xeaa9('0xc'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 53a23bd..b32b52f 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 _0x91bd=['then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x91bd,0x1a2));var _0xd91b=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x91bd[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require(_0xd91b('0x0'));var util=require(_0xd91b('0x1'));var moment=require(_0xd91b('0x2'));var BPromise=require(_0xd91b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd91b('0x4'));var db=require(_0xd91b('0x5'))['db'];var utils=require(_0xd91b('0x6'));var logger=require(_0xd91b('0x7'))(_0xd91b('0x8'));var config=require(_0xd91b('0x9'));var jayson=require(_0xd91b('0xa'));var client=jayson['client'][_0xd91b('0xb')]({'port':0x232a});config[_0xd91b('0xc')]=_[_0xd91b('0xd')](config[_0xd91b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd91b('0xe'))(new Redis(config['redis']));require(_0xd91b('0xf'))[_0xd91b('0x10')](socket);function respondWithRpcPromise(_0x523173,_0x22f9c4,_0x975551){return new BPromise(function(_0xe06605,_0x190334){return client['request'](_0x523173,_0x975551)[_0xd91b('0x11')](function(_0x5171f7){logger[_0xd91b('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x22f9c4,_0xd91b('0x13'));logger[_0xd91b('0x14')](_0xd91b('0x15'),_0x22f9c4,_0xd91b('0x13'),JSON[_0xd91b('0x16')](_0x5171f7));if(_0x5171f7[_0xd91b('0x17')]){if(_0x5171f7['error'][_0xd91b('0x18')]===0x1f4){logger[_0xd91b('0x17')](_0xd91b('0x19'),_0x22f9c4,_0x5171f7[_0xd91b('0x17')][_0xd91b('0x1a')]);return _0x190334(_0x5171f7[_0xd91b('0x17')]['message']);}logger[_0xd91b('0x17')](_0xd91b('0x19'),_0x22f9c4,_0x5171f7[_0xd91b('0x17')]['message']);return _0xe06605(_0x5171f7['error'][_0xd91b('0x1a')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x22f9c4,_0xd91b('0x13'));_0xe06605(_0x5171f7[_0xd91b('0x1b')]['message']);}})[_0xd91b('0x1c')](function(_0xb1450d){logger[_0xd91b('0x17')](_0xd91b('0x19'),_0x22f9c4,_0xb1450d);_0x190334(_0xb1450d);});});} \ No newline at end of file +var _0x32e0=['stringify','error','ChatWebsite,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x32e0,0xc5));var _0x032e=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x32e0[_0x39ffd1];return _0x31267e;};'use strict';var _=require('lodash');var util=require(_0x032e('0x0'));var moment=require(_0x032e('0x1'));var BPromise=require(_0x032e('0x2'));var rs=require(_0x032e('0x3'));var fs=require('fs');var Redis=require(_0x032e('0x4'));var db=require(_0x032e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x032e('0x6'));var config=require(_0x032e('0x7'));var jayson=require(_0x032e('0x8'));var client=jayson[_0x032e('0x9')][_0x032e('0xa')]({'port':0x232a});config[_0x032e('0xb')]=_['defaults'](config[_0x032e('0xb')],{'host':_0x032e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x032e('0xb')]));require('./chatWebsite.socket')[_0x032e('0xd')](socket);function respondWithRpcPromise(_0x1d2214,_0x1a7922,_0x175402){return new BPromise(function(_0xefcdf1,_0x34e439){return client[_0x032e('0xe')](_0x1d2214,_0x175402)['then'](function(_0xabef99){logger[_0x032e('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x032e('0x10'));logger[_0x032e('0x11')](_0x032e('0x12'),_0x1a7922,'request\x20sent',JSON[_0x032e('0x13')](_0xabef99));if(_0xabef99[_0x032e('0x14')]){if(_0xabef99['error']['code']===0x1f4){logger[_0x032e('0x14')](_0x032e('0x15'),_0x1a7922,_0xabef99['error']['message']);return _0x34e439(_0xabef99[_0x032e('0x14')][_0x032e('0x16')]);}logger[_0x032e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0xabef99['error'][_0x032e('0x16')]);return _0xefcdf1(_0xabef99[_0x032e('0x14')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x032e('0x10'));_0xefcdf1(_0xabef99['result'][_0x032e('0x16')]);}})[_0x032e('0x17')](function(_0x529d96){logger[_0x032e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1a7922,_0x529d96);_0x34e439(_0x529d96);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e1bdc11..de3c021 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 _0xcb12=['removeListener','register','chatWebsite:','./chatWebsite.events','save','update','emit'];(function(_0x3a79ac,_0x48bcad){var _0x226927=function(_0x58f337){while(--_0x58f337){_0x3a79ac['push'](_0x3a79ac['shift']());}};_0x226927(++_0x48bcad);}(_0xcb12,0x137));var _0x2cb1=function(_0x3359d2,_0x58da40){_0x3359d2=_0x3359d2-0x0;var _0x56c09c=_0xcb12[_0x3359d2];return _0x56c09c;};'use strict';var ChatWebsiteEvents=require(_0x2cb1('0x0'));var events=[_0x2cb1('0x1'),'remove',_0x2cb1('0x2')];function createListener(_0x5f3645,_0x93eae1){return function(_0x5e31d6){_0x93eae1[_0x2cb1('0x3')](_0x5f3645,_0x5e31d6);};}function removeListener(_0x3176da,_0x31f776){return function(){ChatWebsiteEvents[_0x2cb1('0x4')](_0x3176da,_0x31f776);};}exports[_0x2cb1('0x5')]=function(_0x3405ab){for(var _0x21fbda=0x0,_0xead3ca=events['length'];_0x21fbda<_0xead3ca;_0x21fbda++){var _0x308c81=events[_0x21fbda];var _0x3297f3=createListener(_0x2cb1('0x6')+_0x308c81,_0x3405ab);ChatWebsiteEvents['on'](_0x308c81,_0x3297f3);}}; \ No newline at end of file +var _0x13d9=['removeListener','register','chatWebsite:','./chatWebsite.events','save','update','emit'];(function(_0x4b9a64,_0x3c3a2a){var _0xdb31de=function(_0x35d4f5){while(--_0x35d4f5){_0x4b9a64['push'](_0x4b9a64['shift']());}};_0xdb31de(++_0x3c3a2a);}(_0x13d9,0xa4));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var ChatWebsiteEvents=require(_0x913d('0x0'));var events=[_0x913d('0x1'),'remove',_0x913d('0x2')];function createListener(_0x5136a7,_0x13e669){return function(_0x106c03){_0x13e669[_0x913d('0x3')](_0x5136a7,_0x106c03);};}function removeListener(_0x332464,_0x295b1e){return function(){ChatWebsiteEvents[_0x913d('0x4')](_0x332464,_0x295b1e);};}exports[_0x913d('0x5')]=function(_0x3c1e0d){for(var _0x33dee8=0x0,_0x15bcc3=events['length'];_0x33dee8<_0x15bcc3;_0x33dee8++){var _0x5606dd=events[_0x33dee8];var _0x38257e=createListener(_0x913d('0x6')+_0x5606dd,_0x3c1e0d);ChatWebsiteEvents['on'](_0x5606dd,_0x38257e);}}; \ 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 9161cd2..81e2755 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 _0xba37=['test','exports','../../../utils/misc','url','replace','localhost'];(function(_0x12f5f7,_0xa58b52){var _0x345c1b=function(_0x306035){while(--_0x306035){_0x12f5f7['push'](_0x12f5f7['shift']());}};_0x345c1b(++_0xa58b52);}(_0xba37,0xb6));var _0x7ba3=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xba37[_0x2dadb9];return _0x2f0097;};var escapeRegExp=require(_0x7ba3('0x0'))['escapeRegExp'];var URL=require(_0x7ba3('0x1'))['URL'];function testWildcardValidity(_0x13791e){var _0x4fba12=!![];try{new URL(_0x13791e[_0x7ba3('0x2')]('*',_0x7ba3('0x3')));}catch(_0x318802){_0x4fba12=![];}return _0x4fba12&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x7ba3('0x4')](_0x13791e);}function testWebsiteWithWildcard(_0x1ad964,_0x58b96a){var _0x401c33;var _0x47b38c=escapeRegExp(_0x1ad964['trim']()[_0x7ba3('0x2')](/\/$/,''))[_0x7ba3('0x2')]('\x5c*','([\x5cw]+)');try{new URL(_0x1ad964[_0x7ba3('0x2')]('\x5c*',_0x7ba3('0x3')));_0x401c33=new RegExp(_0x47b38c)[_0x7ba3('0x4')](_0x58b96a);}catch(_0x108326){_0x401c33=![];}return _0x401c33;}module[_0x7ba3('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x66fa=['escapeRegExp','URL','replace','localhost','test','trim','exports','../../../utils/misc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66fa,0x117));var _0xa66f=function(_0x152330,_0x2c86d1){_0x152330=_0x152330-0x0;var _0xc44ae3=_0x66fa[_0x152330];return _0xc44ae3;};var escapeRegExp=require(_0xa66f('0x0'))[_0xa66f('0x1')];var URL=require('url')[_0xa66f('0x2')];function testWildcardValidity(_0x2dcf24){var _0x234f2d=!![];try{new URL(_0x2dcf24[_0xa66f('0x3')]('*',_0xa66f('0x4')));}catch(_0x2a2abf){_0x234f2d=![];}return _0x234f2d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xa66f('0x5')](_0x2dcf24);}function testWebsiteWithWildcard(_0x5ebea5,_0x4fd9d0){var _0x2239d3;var _0x20a150=escapeRegExp(_0x5ebea5[_0xa66f('0x6')]()[_0xa66f('0x3')](/\/$/,''))[_0xa66f('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x5ebea5[_0xa66f('0x3')]('\x5c*','localhost'));_0x2239d3=new RegExp(_0x20a150)[_0xa66f('0x5')](_0x4fd9d0);}catch(_0x597c7c){_0x2239d3=![];}return _0x2239d3;}module[_0xa66f('0x7')]={'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 1b8e4af..cfbdf0c 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 _0x61ad=['addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAgents','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','extname','/:id/offline','any','offline','addApplications'];(function(_0x153595,_0x31e73d){var _0x50db91=function(_0x3fabea){while(--_0x3fabea){_0x153595['push'](_0x153595['shift']());}};_0x50db91(++_0x31e73d);}(_0x61ad,0x1dc));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd61a('0x0'));var util=require(_0xd61a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd61a('0x2')]();var fs_extra=require(_0xd61a('0x3'));var auth=require(_0xd61a('0x4'));var interaction=require(_0xd61a('0x5'));var config=require('../../config/environment');var controller=require(_0xd61a('0x6'));router[_0xd61a('0x7')]('/',auth['isAuthenticated'](),controller[_0xd61a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd61a('0x9')]);router['get'](_0xd61a('0xa'),auth[_0xd61a('0xb')](),controller[_0xd61a('0xc')]);router[_0xd61a('0x7')](_0xd61a('0xd'),auth['isAuthenticated'](),controller[_0xd61a('0xe')]);router[_0xd61a('0x7')](_0xd61a('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd61a('0x7')](_0xd61a('0x10'),controller['getLogo']);router[_0xd61a('0x7')](_0xd61a('0x11'),controller['getAvatar']);router['get'](_0xd61a('0x12'),controller[_0xd61a('0x13')]);router[_0xd61a('0x7')](_0xd61a('0x14'),controller[_0xd61a('0x15')]);router[_0xd61a('0x7')](_0xd61a('0x16'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x17')]);router[_0xd61a('0x7')]('/:id/snippet',controller['getSnippet']);router[_0xd61a('0x7')](_0xd61a('0x18'),auth['isAuthenticated'](),controller[_0xd61a('0x19')]);router[_0xd61a('0x7')](_0xd61a('0x1a'),auth[_0xd61a('0xb')](),controller['getProactiveActions']);router[_0xd61a('0x7')](_0xd61a('0x1b'),controller[_0xd61a('0x1c')]);router[_0xd61a('0x7')](_0xd61a('0x1d'),auth[_0xd61a('0xb')](),controller['getOfflineMessages']);router['get'](_0xd61a('0x1e'),auth['isAuthenticated'](),controller[_0xd61a('0x1f')]);router[_0xd61a('0x20')]('/',auth[_0xd61a('0xb')](),controller[_0xd61a('0x21')]);router[_0xd61a('0x20')](_0xd61a('0xd'),auth['isAuthenticated'](),controller[_0xd61a('0x22')]);router['post']('/:id/canned_answers',auth[_0xd61a('0xb')](),controller[_0xd61a('0x23')]);var upload=multer({'storage':multer[_0xd61a('0x24')]({'destination':function(_0x17aef1,_0x24eb0a,_0x2d68b0){_0x2d68b0(null,path[_0xd61a('0x25')](config[_0xd61a('0x26')],'server/files/images/logos/'));},'filename':function(_0x3e69c0,_0x4e9cff,_0x45eeb4){_0x45eeb4(null,util[_0xd61a('0x27')]('%s-%s',Date[_0xd61a('0x28')](),_0x4e9cff[_0xd61a('0x29')]));}})});router[_0xd61a('0x20')]('/:id/logo',upload[_0xd61a('0x2a')](_0xd61a('0x2b')),controller[_0xd61a('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e4a44,_0x13ceba,_0x4c02ef){_0x4c02ef(null,path[_0xd61a('0x25')](config[_0xd61a('0x26')],_0xd61a('0x2d')));},'filename':function(_0x2c3703,_0x4fcd1a,_0x2a8ef3){_0x2a8ef3(null,util[_0xd61a('0x27')](_0xd61a('0x2e'),Date[_0xd61a('0x28')](),_0x4fcd1a[_0xd61a('0x29')]));}})});router[_0xd61a('0x20')](_0xd61a('0x11'),upload[_0xd61a('0x2a')](_0xd61a('0x2b')),controller[_0xd61a('0x2f')]);var upload=multer({'storage':multer[_0xd61a('0x24')]({'destination':function(_0x30b3b1,_0x393423,_0x1407c5){_0x1407c5(null,path['join'](config[_0xd61a('0x26')],_0xd61a('0x2d')));},'filename':function(_0x21565b,_0x157cb2,_0x28b182){_0x28b182(null,util['format'](_0xd61a('0x2e'),Date[_0xd61a('0x28')](),_0x157cb2[_0xd61a('0x29')]));}})});router[_0xd61a('0x20')](_0xd61a('0x12'),upload[_0xd61a('0x2a')]('file'),controller[_0xd61a('0x30')]);var upload=multer({'storage':multer[_0xd61a('0x24')]({'destination':function(_0x109190,_0x4f7a33,_0x4fb904){_0x4fb904(null,path[_0xd61a('0x25')](config[_0xd61a('0x26')],_0xd61a('0x2d')));},'filename':function(_0x2a12cb,_0x185c9,_0x1b257e){_0x1b257e(null,util[_0xd61a('0x27')](_0xd61a('0x2e'),Date['now'](),_0x185c9[_0xd61a('0x29')]));}})});router[_0xd61a('0x20')]('/:id/system_avatar',upload['single'](_0xd61a('0x2b')),controller[_0xd61a('0x31')]);router[_0xd61a('0x20')](_0xd61a('0x32'),controller[_0xd61a('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x55761f,_0x224289,_0x611a1a){const _0xa16b3b=path[_0xd61a('0x25')](config['root'],_0xd61a('0x34'),_0xd61a('0x35'),_0xd61a('0x36'));fs_extra['ensureDir'](_0xa16b3b,function(){_0x611a1a(null,_0xa16b3b);});},'filename':function(_0x3f4b71,_0xd30f32,_0x13b0b3){const _0x4f38c4=_0xd30f32[_0xd61a('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x37c8ba=path[_0xd61a('0x37')](_0x4f38c4);const _0x340905=Date[_0xd61a('0x28')]()+'-'+_0x4f38c4['replace'](_0x37c8ba,'')+_0x37c8ba;_0x13b0b3(null,_0x340905);}})});router[_0xd61a('0x20')](_0xd61a('0x38'),offlineUploadMulter[_0xd61a('0x39')](),controller[_0xd61a('0x3a')]);router['post'](_0xd61a('0x16'),auth[_0xd61a('0xb')](),controller['addInteraction']);router[_0xd61a('0x20')](_0xd61a('0x18'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x3b')]);router['post'](_0xd61a('0x1a'),auth['isAuthenticated'](),controller[_0xd61a('0x3c')]);router[_0xd61a('0x20')](_0xd61a('0x1e'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x3d')]);router[_0xd61a('0x3e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd61a('0x3f')](_0xd61a('0xa'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x40')]);router['delete'](_0xd61a('0xd'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x41')]);router[_0xd61a('0x3f')]('/:id/canned_answers',auth[_0xd61a('0xb')](),controller['removeAnswers']);router[_0xd61a('0x3f')](_0xd61a('0x1e'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x42')]);module['exports']=router; \ No newline at end of file +var _0x8fe9=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/fields','getFields','/:id/users','post','diskStorage','join','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','root','server/files/images/avatars/','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','originalname','addSystemAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addAgents','put','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x522c1a,_0x1299ed){var _0x5807ee=function(_0x4e5601){while(--_0x4e5601){_0x522c1a['push'](_0x522c1a['shift']());}};_0x5807ee(++_0x1299ed);}(_0x8fe9,0x122));var _0x98fe=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x8fe9[_0xd1a252];return _0x560ee1;};'use strict';var multer=require('multer');var util=require(_0x98fe('0x0'));var path=require(_0x98fe('0x1'));var timeout=require(_0x98fe('0x2'));var express=require(_0x98fe('0x3'));var router=express[_0x98fe('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98fe('0x5'));var controller=require('./chatWebsite.controller');router[_0x98fe('0x6')]('/',auth[_0x98fe('0x7')](),controller['index']);router[_0x98fe('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x98fe('0x6')](_0x98fe('0x8'),auth['isAuthenticated'](),controller[_0x98fe('0x9')]);router['get'](_0x98fe('0xa'),auth[_0x98fe('0x7')](),controller[_0x98fe('0xb')]);router[_0x98fe('0x6')](_0x98fe('0xc'),auth[_0x98fe('0x7')](),controller[_0x98fe('0xd')]);router['get'](_0x98fe('0xe'),controller['getLogo']);router[_0x98fe('0x6')]('/:id/avatar',controller[_0x98fe('0xf')]);router[_0x98fe('0x6')]('/:id/customer_avatar',controller[_0x98fe('0x10')]);router[_0x98fe('0x6')](_0x98fe('0x11'),controller['getSystemAvatar']);router['get'](_0x98fe('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x98fe('0x6')](_0x98fe('0x13'),controller[_0x98fe('0x14')]);router[_0x98fe('0x6')]('/:id/applications',auth[_0x98fe('0x7')](),controller[_0x98fe('0x15')]);router[_0x98fe('0x6')]('/:id/proactive_actions',auth[_0x98fe('0x7')](),controller['getProactiveActions']);router[_0x98fe('0x6')](_0x98fe('0x16'),controller[_0x98fe('0x17')]);router[_0x98fe('0x6')]('/:id/offline_messages',auth[_0x98fe('0x7')](),controller['getOfflineMessages']);router['get'](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller['getAgents']);router[_0x98fe('0x19')]('/',auth[_0x98fe('0x7')](),controller['create']);router[_0x98fe('0x19')](_0x98fe('0xa'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x98fe('0x19')](_0x98fe('0xc'),auth[_0x98fe('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x521f99,_0x486414,_0xbcbff0){_0xbcbff0(null,path[_0x98fe('0x1b')](config['root'],_0x98fe('0x1c')));},'filename':function(_0x1d1090,_0x472f9e,_0x44dacf){_0x44dacf(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date[_0x98fe('0x1f')](),_0x472f9e['originalname']));}})});router[_0x98fe('0x19')]('/:id/logo',upload[_0x98fe('0x20')](_0x98fe('0x21')),controller[_0x98fe('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb9789e,_0x1d502e,_0x1ec6c){_0x1ec6c(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x9ae7d4,_0x216259,_0xefd76){_0xefd76(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date['now'](),_0x216259['originalname']));}})});router[_0x98fe('0x19')](_0x98fe('0x25'),upload['single'](_0x98fe('0x21')),controller[_0x98fe('0x26')]);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x1e3cb6,_0x6f1275,_0x131193){_0x131193(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x399684,_0x40af93,_0x5bf1b3){_0x5bf1b3(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date[_0x98fe('0x1f')](),_0x40af93['originalname']));}})});router[_0x98fe('0x19')](_0x98fe('0x27'),upload[_0x98fe('0x20')](_0x98fe('0x21')),controller[_0x98fe('0x28')]);var upload=multer({'storage':multer[_0x98fe('0x1a')]({'destination':function(_0x5ab2b1,_0x49530a,_0x34b923){_0x34b923(null,path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x24')));},'filename':function(_0x2b0690,_0x44b513,_0xfc29ed){_0xfc29ed(null,util[_0x98fe('0x1d')](_0x98fe('0x1e'),Date['now'](),_0x44b513[_0x98fe('0x29')]));}})});router[_0x98fe('0x19')](_0x98fe('0x11'),upload[_0x98fe('0x20')]('file'),controller[_0x98fe('0x2a')]);router[_0x98fe('0x19')](_0x98fe('0x2b'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x41ab90,_0x2dd6ee,_0xe1d93f){const _0x1a2a56=path[_0x98fe('0x1b')](config[_0x98fe('0x23')],_0x98fe('0x2c'),'attachments',_0x98fe('0x2d'));fs_extra[_0x98fe('0x2e')](_0x1a2a56,function(){_0xe1d93f(null,_0x1a2a56);});},'filename':function(_0x5b4f24,_0x7f0023,_0x519bad){const _0x3bb170=_0x7f0023[_0x98fe('0x29')][_0x98fe('0x2f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3bd8ca=path[_0x98fe('0x30')](_0x3bb170);const _0xf85f0=Date[_0x98fe('0x1f')]()+'-'+_0x3bb170['replace'](_0x3bd8ca,'')+_0x3bd8ca;_0x519bad(null,_0xf85f0);}})});router['post']('/:id/offline',offlineUploadMulter[_0x98fe('0x31')](),controller[_0x98fe('0x32')]);router['post']('/:id/interactions',auth[_0x98fe('0x7')](),controller[_0x98fe('0x33')]);router[_0x98fe('0x19')](_0x98fe('0x34'),auth[_0x98fe('0x7')](),controller['addApplications']);router[_0x98fe('0x19')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x98fe('0x19')](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller[_0x98fe('0x35')]);router[_0x98fe('0x36')](_0x98fe('0x8'),auth['isAuthenticated'](),controller[_0x98fe('0x37')]);router[_0x98fe('0x38')](_0x98fe('0x8'),auth[_0x98fe('0x7')](),controller[_0x98fe('0x39')]);router[_0x98fe('0x38')](_0x98fe('0xa'),auth['isAuthenticated'](),controller[_0x98fe('0x3a')]);router[_0x98fe('0x38')]('/:id/canned_answers',auth[_0x98fe('0x7')](),controller['removeAnswers']);router[_0x98fe('0x38')](_0x98fe('0x18'),auth[_0x98fe('0x7')](),controller['removeAgents']);module[_0x98fe('0x3b')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c8ef81d..11bbcd0 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 _0x4a38=['Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','env','app','client-side-logger'];(function(_0x57ef0c,_0x3b1843){var _0x487929=function(_0x5dcd97){while(--_0x5dcd97){_0x57ef0c['push'](_0x57ef0c['shift']());}};_0x487929(++_0x3b1843);}(_0x4a38,0x1de));var _0x84a3=function(_0x5a2161,_0x249604){_0x5a2161=_0x5a2161-0x0;var _0x5378da=_0x4a38[_0x5a2161];return _0x5378da;};var beaverLogger=require(_0x84a3('0x0'));var express=require(_0x84a3('0x1'));var auth=require('../components/auth/service');var config=require(_0x84a3('0x2'));var router=express['Router']();var isProduction=config[_0x84a3('0x3')]==='production'||![];function clientSideLogs(_0x2e01c7,_0x34b981,_0x4d4b98){var _0x383779=_0x2e01c7[_0x84a3('0x4')]['get'](_0x84a3('0x5'));if(!_0x383779){throw new Error(_0x84a3('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x84a3('0x7'),'logger':_0x383779,'enableCors':!isProduction})(_0x2e01c7,_0x34b981,_0x4d4b98);}router[_0x84a3('0x8')](auth[_0x84a3('0x9')](),clientSideLogs);module[_0x84a3('0xa')]=router; \ No newline at end of file +var _0x9c00=['/client-logs','isAuthenticated','exports','beaver-logger/server','../components/auth/service','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x368590,_0x48ad74){var _0x5ceb60=function(_0x322b8e){while(--_0x322b8e){_0x368590['push'](_0x368590['shift']());}};_0x5ceb60(++_0x48ad74);}(_0x9c00,0x13b));var _0x09c0=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c00[_0x3511d3];return _0x5d6321;};var beaverLogger=require(_0x09c0('0x0'));var express=require('express');var auth=require(_0x09c0('0x1'));var config=require('../config/environment');var router=express[_0x09c0('0x2')]();var isProduction=config[_0x09c0('0x3')]===_0x09c0('0x4')||![];function clientSideLogs(_0x927b75,_0x456dbc,_0x433146){var _0x1838a5=_0x927b75[_0x09c0('0x5')]['get'](_0x09c0('0x6'));if(!_0x1838a5){throw new Error(_0x09c0('0x7'));}return beaverLogger[_0x09c0('0x8')]({'uri':_0x09c0('0x9'),'logger':_0x1838a5,'enableCors':!isProduction})(_0x927b75,_0x456dbc,_0x433146);}router['use'](auth[_0x09c0('0xa')](),clientSideLogs);module[_0x09c0('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9223f17..e45ef78 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 _0x9d3e=['STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365'];(function(_0x17df36,_0x583870){var _0x31ac82=function(_0x52c660){while(--_0x52c660){_0x17df36['push'](_0x17df36['shift']());}};_0x31ac82(++_0x583870);}(_0x9d3e,0xf1));var _0xe9d3=function(_0x18b1c5,_0x345a75){_0x18b1c5=_0x18b1c5-0x0;var _0x44bd52=_0x9d3e[_0x18b1c5];return _0x44bd52;};'use strict';var Sequelize=require('sequelize');module[_0xe9d3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe9d3('0x1')](_0xe9d3('0x2'),_0xe9d3('0x3'),_0xe9d3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe9d3('0x1')]('Outlook365',_0xe9d3('0x5'))},'data1':{'type':Sequelize[_0xe9d3('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe9d3('0x6')],'comment':_0xe9d3('0x7')},'data3':{'type':Sequelize[_0xe9d3('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xe9d3('0x6')],'comment':_0xe9d3('0x8')},'data5':{'type':Sequelize['TEXT'],'comment':_0xe9d3('0x9')},'data6':{'type':Sequelize[_0xe9d3('0xa')],'comment':_0xe9d3('0xb')},'data7':{'type':Sequelize[_0xe9d3('0xa')],'comment':_0xe9d3('0xc')}}; \ No newline at end of file +var _0x6c9f=['STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x20dbe8,_0x3998af){var _0x2c06c6=function(_0x4d6b02){while(--_0x4d6b02){_0x20dbe8['push'](_0x20dbe8['shift']());}};_0x2c06c6(++_0x3998af);}(_0x6c9f,0xe8));var _0xf6c9=function(_0x3aa2d3,_0x550bbe){_0x3aa2d3=_0x3aa2d3-0x0;var _0x3daba8=_0x6c9f[_0x3aa2d3];return _0x3daba8;};'use strict';var Sequelize=require(_0xf6c9('0x0'));module[_0xf6c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf6c9('0x2')](_0xf6c9('0x3'),_0xf6c9('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf6c9('0x2')](_0xf6c9('0x5'),_0xf6c9('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xf6c9('0x7')},'data2':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0x9')},'data3':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0xa')},'data4':{'type':Sequelize[_0xf6c9('0x8')],'comment':_0xf6c9('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xf6c9('0xc')},'data6':{'type':Sequelize[_0xf6c9('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xf6c9('0xd')],'comment':_0xf6c9('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 7995498..b2b88a6 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 _0x2b18=['filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','find','create','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','params','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','parse','from','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','access_token','data6','refresh_token','data5','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','CloudProvider','rawAttributes','key','model','keys'];(function(_0x22d487,_0x4cb4dd){var _0x391c06=function(_0x30034c){while(--_0x30034c){_0x22d487['push'](_0x22d487['shift']());}};_0x391c06(++_0x4cb4dd);}(_0x2b18,0x157));var _0x82b1=function(_0x11c3ca,_0x18c151){_0x11c3ca=_0x11c3ca-0x0;var _0x8133bc=_0x2b18[_0x11c3ca];return _0x8133bc;};'use strict';var _=require(_0x82b1('0x0'));var Redis=require(_0x82b1('0x1'));var qs=require(_0x82b1('0x2'));var encryptor=require(_0x82b1('0x3'));var config=require(_0x82b1('0x4'));var logger=require(_0x82b1('0x5'))(_0x82b1('0x6'));var db=require(_0x82b1('0x7'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x82b1('0x8')]=_[_0x82b1('0x9')](config[_0x82b1('0x8')],{'host':_0x82b1('0xa'),'port':0x18eb});var socket=require(_0x82b1('0xb'))(new Redis(config[_0x82b1('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x49ba6b,_0x4d2b7a){_0x4d2b7a=_0x4d2b7a||0xcc;return function(_0x30de07){if(_0x30de07){return _0x49ba6b[_0x82b1('0xc')](_0x4d2b7a);}return _0x49ba6b[_0x82b1('0xd')](_0x4d2b7a)[_0x82b1('0xe')]();};}function respondWithResult(_0x563339,_0x46b2f2){_0x46b2f2=_0x46b2f2||0xc8;return function(_0x13a82e){if(_0x13a82e){return _0x563339[_0x82b1('0xd')](_0x46b2f2)[_0x82b1('0xf')](_0x13a82e);}};}function respondWithFilteredResult(_0x3a1126,_0x51b30e){return function(_0x2e5ac4){if(_0x2e5ac4){var _0x15da2f=typeof _0x51b30e[_0x82b1('0x10')]===_0x82b1('0x11')&&typeof _0x51b30e[_0x82b1('0x12')]===_0x82b1('0x11');var _0x58b045=_0x2e5ac4[_0x82b1('0x13')];var _0x1f3f88=_0x15da2f?0x0:_0x51b30e[_0x82b1('0x10')];var _0xad2c8c=_0x15da2f?_0x2e5ac4[_0x82b1('0x13')]:_0x51b30e[_0x82b1('0x10')]+_0x51b30e['limit'];var _0x3f55a5;if(_0xad2c8c>=_0x58b045){_0xad2c8c=_0x58b045;_0x3f55a5=0xc8;}else{_0x3f55a5=0xce;}_0x3a1126[_0x82b1('0xd')](_0x3f55a5);return _0x3a1126[_0x82b1('0x14')](_0x82b1('0x15'),_0x1f3f88+'-'+_0xad2c8c+'/'+_0x58b045)[_0x82b1('0xf')](_0x2e5ac4);}return null;};}function saveUpdates(_0x4424e0){return function(_0x408602){if(_0x408602){return _0x408602[_0x82b1('0x16')](_0x4424e0)['then'](function(_0x2f2ddb){return _0x2f2ddb;});}return null;};}function removeEntity(_0x182a2b){return function(_0x1b73c2){if(_0x1b73c2){return _0x1b73c2['destroy']()[_0x82b1('0x17')](function(){_0x182a2b['status'](0xcc)[_0x82b1('0xe')]();});}};}function handleEntityNotFound(_0x3f8586){return function(_0x2101ad){if(!_0x2101ad){_0x3f8586[_0x82b1('0xc')](0x194);}return _0x2101ad;};}function handleError(_0x53d411,_0x2a5a60){_0x2a5a60=_0x2a5a60||0x1f4;return function(_0x3e5225){logger[_0x82b1('0x18')](_0x3e5225[_0x82b1('0x19')]);if(_0x3e5225[_0x82b1('0x1a')]){delete _0x3e5225['name'];}_0x53d411[_0x82b1('0xd')](_0x2a5a60)[_0x82b1('0x1b')](_0x3e5225);};}function maskClientSecret(_0x3354cb){return _['padEnd'](_0x3354cb['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x3a8505,_0x5d35c9){var _0x26c624={},_0x4f414c={},_0x3b61f2={'count':0x0,'rows':[]};var _0x111716=_['map'](db[_0x82b1('0x1c')][_0x82b1('0x1d')],function(_0x1b8e97){return{'name':_0x1b8e97['fieldName'],'type':_0x1b8e97['type'][_0x82b1('0x1e')]};});_0x4f414c[_0x82b1('0x1f')]=_['map'](_0x111716,_0x82b1('0x1a'));_0x4f414c['query']=_[_0x82b1('0x20')](_0x3a8505['query']);_0x4f414c[_0x82b1('0x21')]=_['intersection'](_0x4f414c[_0x82b1('0x1f')],_0x4f414c[_0x82b1('0x22')]);_0x26c624['attributes']=_[_0x82b1('0x23')](_0x4f414c[_0x82b1('0x1f')],qs[_0x82b1('0x24')](_0x3a8505[_0x82b1('0x22')][_0x82b1('0x24')]));_0x26c624[_0x82b1('0x25')]=_0x26c624['attributes'][_0x82b1('0x26')]?_0x26c624['attributes']:_0x4f414c[_0x82b1('0x1f')];if(!_0x3a8505[_0x82b1('0x22')][_0x82b1('0x27')](_0x82b1('0x28'))){_0x26c624[_0x82b1('0x12')]=qs[_0x82b1('0x12')](_0x3a8505[_0x82b1('0x22')][_0x82b1('0x12')]);_0x26c624[_0x82b1('0x10')]=qs[_0x82b1('0x10')](_0x3a8505[_0x82b1('0x22')]['offset']);}_0x26c624[_0x82b1('0x29')]=qs[_0x82b1('0x2a')](_0x3a8505[_0x82b1('0x22')]['sort']);_0x26c624['where']=qs[_0x82b1('0x21')](_[_0x82b1('0x2b')](_0x3a8505['query'],_0x4f414c[_0x82b1('0x21')]),_0x111716);if(_0x3a8505['query'][_0x82b1('0x2c')]){_0x26c624[_0x82b1('0x2d')]=_[_0x82b1('0x2e')](_0x26c624[_0x82b1('0x2d')],{'$or':_[_0x82b1('0x2f')](_0x111716,function(_0x13f299){if(_0x13f299['type']!=='VIRTUAL'){var _0x10336a={};_0x10336a[_0x13f299[_0x82b1('0x1a')]]={'$like':'%'+_0x3a8505[_0x82b1('0x22')]['filter']+'%'};return _0x10336a;}})});}_0x26c624=_[_0x82b1('0x2e')]({},_0x26c624,_0x3a8505[_0x82b1('0x30')]);var _0x515205={'where':_0x26c624[_0x82b1('0x2d')]};return db['CloudProvider'][_0x82b1('0x13')](_0x515205)[_0x82b1('0x17')](function(_0x3f731c){_0x3b61f2[_0x82b1('0x13')]=_0x3f731c;if(_0x3a8505[_0x82b1('0x22')][_0x82b1('0x31')]){_0x26c624[_0x82b1('0x32')]=[{'all':!![]}];}return db[_0x82b1('0x1c')]['findAll'](_0x26c624);})[_0x82b1('0x17')](function(_0x1a4eba){_0x3b61f2[_0x82b1('0x33')]=_[_0x82b1('0x2f')](_0x1a4eba,function(_0x36ff08){if(_0x36ff08[_0x82b1('0x34')]===_0x82b1('0x35')){var _0x36a89c=encryptor[_0x82b1('0x36')](_0x36ff08[_0x82b1('0x37')]);_0x36ff08[_0x82b1('0x37')]=maskClientSecret(_0x36a89c);}return _0x36ff08;});return _0x3b61f2;})[_0x82b1('0x17')](respondWithFilteredResult(_0x5d35c9,_0x26c624))[_0x82b1('0x38')](handleError(_0x5d35c9,null));};exports[_0x82b1('0x39')]=function(_0x3db5bf,_0x437e2d){var _0x11ce20={'raw':!![],'where':{'id':_0x3db5bf['params']['id']}},_0x32c6b7={};_0x32c6b7[_0x82b1('0x1f')]=_['keys'](db['CloudProvider'][_0x82b1('0x1d')]);_0x32c6b7['query']=_[_0x82b1('0x20')](_0x3db5bf[_0x82b1('0x22')]);_0x32c6b7['filters']=_[_0x82b1('0x23')](_0x32c6b7[_0x82b1('0x1f')],_0x32c6b7[_0x82b1('0x22')]);_0x11ce20[_0x82b1('0x25')]=_[_0x82b1('0x23')](_0x32c6b7['model'],qs['fields'](_0x3db5bf[_0x82b1('0x22')]['fields']));_0x11ce20['attributes']=_0x11ce20['attributes'][_0x82b1('0x26')]?_0x11ce20[_0x82b1('0x25')]:_0x32c6b7[_0x82b1('0x1f')];if(_0x3db5bf[_0x82b1('0x22')][_0x82b1('0x31')]){_0x11ce20[_0x82b1('0x32')]=[{'all':!![]}];}_0x11ce20=_[_0x82b1('0x2e')]({},_0x11ce20,_0x3db5bf[_0x82b1('0x30')]);return db[_0x82b1('0x1c')][_0x82b1('0x3a')](_0x11ce20)[_0x82b1('0x17')](handleEntityNotFound(_0x437e2d,null))['then'](function(_0x391065){if(_0x391065[_0x82b1('0x34')]==='MicrosoftAzure'){var _0x2045cc=encryptor[_0x82b1('0x36')](_0x391065['data3']);_0x391065[_0x82b1('0x37')]=maskClientSecret(_0x2045cc);}return _0x391065;})[_0x82b1('0x17')](respondWithResult(_0x437e2d,null))[_0x82b1('0x38')](handleError(_0x437e2d,null));};exports[_0x82b1('0x3b')]=function(_0x5798c2,_0x158939){if(!_0x5798c2['body'][_0x82b1('0x1a')])throw new Error(_0x82b1('0x3c'));if(!_0x5798c2[_0x82b1('0x3d')][_0x82b1('0x34')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x38f3be=db[_0x82b1('0x1c')]['rawAttributes']['service'][_0x82b1('0x3e')];if(!_0x38f3be[_0x82b1('0x3f')](_0x5798c2[_0x82b1('0x3d')]['service']))throw new Error(_0x82b1('0x40')+_0x38f3be['join'](',\x20'));if(_0x5798c2[_0x82b1('0x3d')][_0x82b1('0x34')]===_0x82b1('0x35')&&_0x5798c2[_0x82b1('0x3d')][_0x82b1('0x37')]){_0x5798c2[_0x82b1('0x3d')][_0x82b1('0x37')]=encryptor[_0x82b1('0x41')](_0x5798c2['body'][_0x82b1('0x37')]);}return db[_0x82b1('0x1c')][_0x82b1('0x3b')](_0x5798c2['body'],{})[_0x82b1('0x17')](respondWithResult(_0x158939,0xc9))['catch'](handleError(_0x158939,null));};exports['update']=function(_0x1f7d7b,_0x20f4d9){if(_0x1f7d7b[_0x82b1('0x3d')]['id']){delete _0x1f7d7b['body']['id'];}return db[_0x82b1('0x1c')]['find']({'where':{'id':_0x1f7d7b[_0x82b1('0x42')]['id']}})[_0x82b1('0x17')](handleEntityNotFound(_0x20f4d9,null))['then'](function(_0x53b628){if(_0x53b628[_0x82b1('0x34')]===_0x82b1('0x35')&&_0x1f7d7b[_0x82b1('0x3d')][_0x82b1('0x37')]){_0x1f7d7b[_0x82b1('0x3d')][_0x82b1('0x37')]=encryptor[_0x82b1('0x41')](_0x1f7d7b[_0x82b1('0x3d')]['data3']);}return _0x53b628;})[_0x82b1('0x17')](saveUpdates(_0x1f7d7b['body'],null))[_0x82b1('0x17')](respondWithResult(_0x20f4d9,null))[_0x82b1('0x38')](handleError(_0x20f4d9,null));};exports[_0x82b1('0x43')]=function(_0x5aeee1,_0x4ab75f){return db['CloudProvider']['find']({'where':{'id':_0x5aeee1[_0x82b1('0x42')]['id']}})[_0x82b1('0x17')](handleEntityNotFound(_0x4ab75f,null))[_0x82b1('0x17')](removeEntity(_0x4ab75f,null))[_0x82b1('0x38')](handleError(_0x4ab75f,null));};exports[_0x82b1('0x44')]=function(_0x456ed5,_0x604ac1){return db[_0x82b1('0x1c')][_0x82b1('0x45')]({'where':{'id':_0x456ed5['params']['id']},'raw':!![]})['then'](function(_0x4f0e07){if(!_0x4f0e07)return _0x604ac1[_0x82b1('0xc')](0x194);return{'url':oauth[_0x82b1('0x46')](_0x4f0e07,_0x456ed5[_0x82b1('0x47')]['id'])};})[_0x82b1('0x17')](respondWithResult(_0x604ac1,null))['catch'](handleError(_0x604ac1,null));};exports[_0x82b1('0x48')]=function(_0x2c66ec,_0x38eda4){var _0x67fe69=_0x2c66ec['body'];var _0x224d45;var _0x107d50;if(_0x67fe69[_0x82b1('0x18')])throw _0x67fe69;redis[_0x82b1('0x49')](_0x67fe69[_0x82b1('0x4a')])[_0x82b1('0x17')](function(_0x521d81){if(!_0x521d81)throw new Error('Invalid\x20state\x20parameter');_0x224d45=JSON[_0x82b1('0x4b')](_0x521d81);var _0x300d67=Buffer[_0x82b1('0x4c')](_0x67fe69['state'],_0x82b1('0x4d'))[_0x82b1('0x4e')](_0x82b1('0x4f'));_0x107d50=JSON[_0x82b1('0x4b')](_0x300d67);if(!oauth['isValidIdToken'](_0x67fe69[_0x82b1('0x50')],_0x224d45[_0x82b1('0x51')]))throw new Error(_0x82b1('0x52'));redis['del'](_0x67fe69['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x67fe69['code'],_0x224d45);})[_0x82b1('0x17')](function(_0x37a00c){_0x224d45['data5']=_0x37a00c[_0x82b1('0x53')];_0x224d45[_0x82b1('0x54')]=_0x37a00c[_0x82b1('0x55')];return db[_0x82b1('0x1c')]['update']({'data5':_0x224d45[_0x82b1('0x56')],'data6':_0x224d45[_0x82b1('0x54')]},{'where':{'id':_0x224d45['id']}});})[_0x82b1('0x17')](function(){oauth[_0x82b1('0x57')](_0x224d45);socket['emit'](_0x82b1('0x58'),{'id':_0x107d50['id']});return;})[_0x82b1('0x17')](respondWithStatusCode(_0x38eda4,null))['catch'](function(_0x2b5ccd){if(_0x107d50){socket[_0x82b1('0x59')](_0x82b1('0x5a'),{'id':_0x107d50['id']});}if(!_0x224d45){logger[_0x82b1('0x18')]('Invalid\x20authentication\x20state\x20parameter',_0x2b5ccd);return _0x38eda4[_0x82b1('0xd')](0x1f4)[_0x82b1('0x1b')](_0x2b5ccd[_0x82b1('0x5b')]);}logger[_0x82b1('0x18')](_0x82b1('0x5c'),_0x224d45['id'],JSON[_0x82b1('0x5d')](_0x2b5ccd));});}; \ No newline at end of file +var _0x80fd=['create','body','Name\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','catch','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','from','base64','toString','ascii','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','end','stack','name','padEnd','slice','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','CloudProvider','includeAll','find'];(function(_0x1d4481,_0x305c65){var _0x1f3cc6=function(_0x33c5cf){while(--_0x33c5cf){_0x1d4481['push'](_0x1d4481['shift']());}};_0x1f3cc6(++_0x305c65);}(_0x80fd,0xde));var _0xd80f=function(_0x4fccaf,_0x139397){_0x4fccaf=_0x4fccaf-0x0;var _0x2256b0=_0x80fd[_0x4fccaf];return _0x2256b0;};'use strict';var _=require(_0xd80f('0x0'));var Redis=require(_0xd80f('0x1'));var qs=require(_0xd80f('0x2'));var encryptor=require(_0xd80f('0x3'));var config=require(_0xd80f('0x4'));var logger=require(_0xd80f('0x5'))('api');var db=require(_0xd80f('0x6'))['db'];var oauth=require(_0xd80f('0x7'));config[_0xd80f('0x8')]=_[_0xd80f('0x9')](config[_0xd80f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd80f('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1d5bb7,_0x48a3e2){_0x48a3e2=_0x48a3e2||0xcc;return function(_0x16ba71){if(_0x16ba71){return _0x1d5bb7[_0xd80f('0xb')](_0x48a3e2);}return _0x1d5bb7[_0xd80f('0xc')](_0x48a3e2)['end']();};}function respondWithResult(_0x2004be,_0x1857b6){_0x1857b6=_0x1857b6||0xc8;return function(_0x49e315){if(_0x49e315){return _0x2004be['status'](_0x1857b6)['json'](_0x49e315);}};}function respondWithFilteredResult(_0x34840a,_0x5349d6){return function(_0x22620b){if(_0x22620b){var _0x568395=typeof _0x5349d6[_0xd80f('0xd')]===_0xd80f('0xe')&&typeof _0x5349d6[_0xd80f('0xf')]===_0xd80f('0xe');var _0x134546=_0x22620b['count'];var _0x29603f=_0x568395?0x0:_0x5349d6[_0xd80f('0xd')];var _0x5f57d2=_0x568395?_0x22620b[_0xd80f('0x10')]:_0x5349d6['offset']+_0x5349d6[_0xd80f('0xf')];var _0x213987;if(_0x5f57d2>=_0x134546){_0x5f57d2=_0x134546;_0x213987=0xc8;}else{_0x213987=0xce;}_0x34840a[_0xd80f('0xc')](_0x213987);return _0x34840a[_0xd80f('0x11')]('Content-Range',_0x29603f+'-'+_0x5f57d2+'/'+_0x134546)[_0xd80f('0x12')](_0x22620b);}return null;};}function saveUpdates(_0x545269){return function(_0x206185){if(_0x206185){return _0x206185[_0xd80f('0x13')](_0x545269)[_0xd80f('0x14')](function(_0x5740f5){return _0x5740f5;});}return null;};}function removeEntity(_0x523421){return function(_0x47fe4a){if(_0x47fe4a){return _0x47fe4a[_0xd80f('0x15')]()[_0xd80f('0x14')](function(){_0x523421['status'](0xcc)[_0xd80f('0x16')]();});}};}function handleEntityNotFound(_0x1d53e0){return function(_0x59dac2){if(!_0x59dac2){_0x1d53e0['sendStatus'](0x194);}return _0x59dac2;};}function handleError(_0x5b0b31,_0x345f31){_0x345f31=_0x345f31||0x1f4;return function(_0x311465){logger['error'](_0x311465[_0xd80f('0x17')]);if(_0x311465[_0xd80f('0x18')]){delete _0x311465[_0xd80f('0x18')];}_0x5b0b31['status'](_0x345f31)['send'](_0x311465);};}function maskClientSecret(_0x9f45a9){return _[_0xd80f('0x19')](_0x9f45a9[_0xd80f('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x54ca50,_0x38283b){var _0x1f9e67={},_0x1b2eb3={},_0x19f852={'count':0x0,'rows':[]};var _0x19465c=_[_0xd80f('0x1b')](db['CloudProvider'][_0xd80f('0x1c')],function(_0x4ea83d){return{'name':_0x4ea83d[_0xd80f('0x1d')],'type':_0x4ea83d[_0xd80f('0x1e')][_0xd80f('0x1f')]};});_0x1b2eb3['model']=_['map'](_0x19465c,_0xd80f('0x18'));_0x1b2eb3[_0xd80f('0x20')]=_['keys'](_0x54ca50[_0xd80f('0x20')]);_0x1b2eb3[_0xd80f('0x21')]=_[_0xd80f('0x22')](_0x1b2eb3[_0xd80f('0x23')],_0x1b2eb3[_0xd80f('0x20')]);_0x1f9e67[_0xd80f('0x24')]=_[_0xd80f('0x22')](_0x1b2eb3[_0xd80f('0x23')],qs[_0xd80f('0x25')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0x25')]));_0x1f9e67[_0xd80f('0x24')]=_0x1f9e67[_0xd80f('0x24')][_0xd80f('0x26')]?_0x1f9e67[_0xd80f('0x24')]:_0x1b2eb3[_0xd80f('0x23')];if(!_0x54ca50[_0xd80f('0x20')][_0xd80f('0x27')](_0xd80f('0x28'))){_0x1f9e67[_0xd80f('0xf')]=qs[_0xd80f('0xf')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0xf')]);_0x1f9e67[_0xd80f('0xd')]=qs[_0xd80f('0xd')](_0x54ca50['query'][_0xd80f('0xd')]);}_0x1f9e67[_0xd80f('0x29')]=qs[_0xd80f('0x2a')](_0x54ca50[_0xd80f('0x20')][_0xd80f('0x2a')]);_0x1f9e67['where']=qs['filters'](_[_0xd80f('0x2b')](_0x54ca50[_0xd80f('0x20')],_0x1b2eb3[_0xd80f('0x21')]),_0x19465c);if(_0x54ca50[_0xd80f('0x20')]['filter']){_0x1f9e67[_0xd80f('0x2c')]=_['merge'](_0x1f9e67['where'],{'$or':_[_0xd80f('0x1b')](_0x19465c,function(_0x38bfb8){if(_0x38bfb8[_0xd80f('0x1e')]!=='VIRTUAL'){var _0x22e845={};_0x22e845[_0x38bfb8['name']]={'$like':'%'+_0x54ca50[_0xd80f('0x20')][_0xd80f('0x2d')]+'%'};return _0x22e845;}})});}_0x1f9e67=_[_0xd80f('0x2e')]({},_0x1f9e67,_0x54ca50[_0xd80f('0x2f')]);var _0x175baf={'where':_0x1f9e67[_0xd80f('0x2c')]};return db['CloudProvider'][_0xd80f('0x10')](_0x175baf)[_0xd80f('0x14')](function(_0x800f98){_0x19f852[_0xd80f('0x10')]=_0x800f98;if(_0x54ca50[_0xd80f('0x20')]['includeAll']){_0x1f9e67[_0xd80f('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0xd80f('0x31')](_0x1f9e67);})[_0xd80f('0x14')](function(_0x5bacde){_0x19f852[_0xd80f('0x32')]=_[_0xd80f('0x1b')](_0x5bacde,function(_0x1a4cc0){if(_0x1a4cc0[_0xd80f('0x33')]===_0xd80f('0x34')){var _0x5b7cbb=encryptor[_0xd80f('0x35')](_0x1a4cc0[_0xd80f('0x36')]);_0x1a4cc0[_0xd80f('0x36')]=maskClientSecret(_0x5b7cbb);}return _0x1a4cc0;});return _0x19f852;})[_0xd80f('0x14')](respondWithFilteredResult(_0x38283b,_0x1f9e67))['catch'](handleError(_0x38283b,null));};exports[_0xd80f('0x37')]=function(_0x70fe41,_0x1dceda){var _0x403c0f={'raw':!![],'where':{'id':_0x70fe41[_0xd80f('0x38')]['id']}},_0x398f70={};_0x398f70[_0xd80f('0x23')]=_['keys'](db[_0xd80f('0x39')][_0xd80f('0x1c')]);_0x398f70[_0xd80f('0x20')]=_['keys'](_0x70fe41[_0xd80f('0x20')]);_0x398f70[_0xd80f('0x21')]=_[_0xd80f('0x22')](_0x398f70[_0xd80f('0x23')],_0x398f70['query']);_0x403c0f['attributes']=_[_0xd80f('0x22')](_0x398f70[_0xd80f('0x23')],qs[_0xd80f('0x25')](_0x70fe41[_0xd80f('0x20')][_0xd80f('0x25')]));_0x403c0f[_0xd80f('0x24')]=_0x403c0f[_0xd80f('0x24')][_0xd80f('0x26')]?_0x403c0f[_0xd80f('0x24')]:_0x398f70[_0xd80f('0x23')];if(_0x70fe41[_0xd80f('0x20')][_0xd80f('0x3a')]){_0x403c0f['include']=[{'all':!![]}];}_0x403c0f=_[_0xd80f('0x2e')]({},_0x403c0f,_0x70fe41[_0xd80f('0x2f')]);return db[_0xd80f('0x39')][_0xd80f('0x3b')](_0x403c0f)['then'](handleEntityNotFound(_0x1dceda,null))[_0xd80f('0x14')](function(_0x10dd7f){if(_0x10dd7f[_0xd80f('0x33')]===_0xd80f('0x34')){var _0x42cc90=encryptor['decryptString'](_0x10dd7f['data3']);_0x10dd7f[_0xd80f('0x36')]=maskClientSecret(_0x42cc90);}return _0x10dd7f;})[_0xd80f('0x14')](respondWithResult(_0x1dceda,null))['catch'](handleError(_0x1dceda,null));};exports[_0xd80f('0x3c')]=function(_0xeb33bf,_0x2abed9){if(!_0xeb33bf[_0xd80f('0x3d')][_0xd80f('0x18')])throw new Error(_0xd80f('0x3e'));if(!_0xeb33bf[_0xd80f('0x3d')][_0xd80f('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x277f98=db[_0xd80f('0x39')]['rawAttributes'][_0xd80f('0x33')]['values'];if(!_0x277f98[_0xd80f('0x3f')](_0xeb33bf['body'][_0xd80f('0x33')]))throw new Error(_0xd80f('0x40')+_0x277f98[_0xd80f('0x41')](',\x20'));if(_0xeb33bf['body'][_0xd80f('0x33')]===_0xd80f('0x34')&&_0xeb33bf['body'][_0xd80f('0x36')]){_0xeb33bf[_0xd80f('0x3d')]['data3']=encryptor['encryptString'](_0xeb33bf[_0xd80f('0x3d')]['data3']);}return db[_0xd80f('0x39')][_0xd80f('0x3c')](_0xeb33bf['body'],{})[_0xd80f('0x14')](respondWithResult(_0x2abed9,0xc9))['catch'](handleError(_0x2abed9,null));};exports[_0xd80f('0x13')]=function(_0x36ae4f,_0x24caa4){if(_0x36ae4f[_0xd80f('0x3d')]['id']){delete _0x36ae4f[_0xd80f('0x3d')]['id'];}return db[_0xd80f('0x39')][_0xd80f('0x3b')]({'where':{'id':_0x36ae4f[_0xd80f('0x38')]['id']}})[_0xd80f('0x14')](handleEntityNotFound(_0x24caa4,null))[_0xd80f('0x14')](function(_0x4f2e10){if(_0x4f2e10[_0xd80f('0x33')]===_0xd80f('0x34')&&_0x36ae4f[_0xd80f('0x3d')]['data3']){_0x36ae4f[_0xd80f('0x3d')][_0xd80f('0x36')]=encryptor['encryptString'](_0x36ae4f[_0xd80f('0x3d')]['data3']);}return _0x4f2e10;})[_0xd80f('0x14')](saveUpdates(_0x36ae4f[_0xd80f('0x3d')],null))[_0xd80f('0x14')](respondWithResult(_0x24caa4,null))[_0xd80f('0x42')](handleError(_0x24caa4,null));};exports['destroy']=function(_0x1999b2,_0x5d8f32){return db[_0xd80f('0x39')][_0xd80f('0x3b')]({'where':{'id':_0x1999b2[_0xd80f('0x38')]['id']}})[_0xd80f('0x14')](handleEntityNotFound(_0x5d8f32,null))[_0xd80f('0x14')](removeEntity(_0x5d8f32,null))['catch'](handleError(_0x5d8f32,null));};exports[_0xd80f('0x43')]=function(_0x3ea796,_0x413b65){return db[_0xd80f('0x39')][_0xd80f('0x44')]({'where':{'id':_0x3ea796[_0xd80f('0x38')]['id']},'raw':!![]})['then'](function(_0x23a38f){if(!_0x23a38f)return _0x413b65[_0xd80f('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x23a38f,_0x3ea796[_0xd80f('0x45')]['id'])};})['then'](respondWithResult(_0x413b65,null))[_0xd80f('0x42')](handleError(_0x413b65,null));};exports[_0xd80f('0x46')]=function(_0x801a33,_0x546a70){var _0x2ba6f5=_0x801a33[_0xd80f('0x3d')];var _0x3835ca;var _0x4e5a27;if(_0x2ba6f5['error'])throw _0x2ba6f5;redis[_0xd80f('0x47')](_0x2ba6f5[_0xd80f('0x48')])[_0xd80f('0x14')](function(_0x418b9c){if(!_0x418b9c)throw new Error('Invalid\x20state\x20parameter');_0x3835ca=JSON['parse'](_0x418b9c);var _0x21c4fc=Buffer[_0xd80f('0x49')](_0x2ba6f5[_0xd80f('0x48')],_0xd80f('0x4a'))[_0xd80f('0x4b')](_0xd80f('0x4c'));_0x4e5a27=JSON['parse'](_0x21c4fc);if(!oauth['isValidIdToken'](_0x2ba6f5[_0xd80f('0x4d')],_0x3835ca[_0xd80f('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xd80f('0x4f')](_0x2ba6f5[_0xd80f('0x48')]);return oauth[_0xd80f('0x50')](_0x2ba6f5[_0xd80f('0x51')],_0x3835ca);})[_0xd80f('0x14')](function(_0x462ee5){_0x3835ca[_0xd80f('0x52')]=_0x462ee5['access_token'];_0x3835ca[_0xd80f('0x53')]=_0x462ee5[_0xd80f('0x54')];return db[_0xd80f('0x39')][_0xd80f('0x13')]({'data5':_0x3835ca[_0xd80f('0x52')],'data6':_0x3835ca[_0xd80f('0x53')]},{'where':{'id':_0x3835ca['id']}});})[_0xd80f('0x14')](function(){oauth[_0xd80f('0x55')](_0x3835ca);socket[_0xd80f('0x56')](_0xd80f('0x57'),{'id':_0x4e5a27['id']});return;})[_0xd80f('0x14')](respondWithStatusCode(_0x546a70,null))['catch'](function(_0x3f9b70){if(_0x4e5a27){socket[_0xd80f('0x56')](_0xd80f('0x58'),{'id':_0x4e5a27['id']});}if(!_0x3835ca){logger[_0xd80f('0x59')](_0xd80f('0x5a'),_0x3f9b70);return _0x546a70[_0xd80f('0xc')](0x1f4)[_0xd80f('0x5b')](_0x3f9b70['message']);}logger[_0xd80f('0x59')](_0xd80f('0x5c'),_0x3835ca['id'],JSON[_0xd80f('0x5d')](_0x3f9b70));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 04af9e1..2fad96f 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 _0xa916=['bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','lodash','moment'];(function(_0x486dbe,_0x1f86b9){var _0x38f1c8=function(_0x5f7ac6){while(--_0x5f7ac6){_0x486dbe['push'](_0x486dbe['shift']());}};_0x38f1c8(++_0x1f86b9);}(_0xa916,0xf1));var _0x6a91=function(_0x5626d2,_0x380970){_0x5626d2=_0x5626d2-0x0;var _0x4213a0=_0xa916[_0x5626d2];return _0x4213a0;};'use strict';var _=require(_0x6a91('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6a91('0x1'));var BPromise=require(_0x6a91('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a91('0x3'));var rimraf=require(_0x6a91('0x4'));var config=require(_0x6a91('0x5'));var attributes=require(_0x6a91('0x6'));module[_0x6a91('0x7')]=function(_0x3098b5,_0x1ebbe2){return _0x3098b5['define'](_0x6a91('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x944b=['rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','lodash','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x944b,0x191));var _0xb944=function(_0x3e69cd,_0x4d3233){_0x3e69cd=_0x3e69cd-0x0;var _0x209c12=_0x944b[_0x3e69cd];return _0x209c12;};'use strict';var _=require(_0xb944('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb944('0x1'));var moment=require('moment');var BPromise=require(_0xb944('0x2'));var rp=require(_0xb944('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb944('0x4'));var config=require(_0xb944('0x5'));var attributes=require(_0xb944('0x6'));module['exports']=function(_0x268bce,_0x4c17ae){return _0x268bce[_0xb944('0x7')](_0xb944('0x8'),attributes,{'tableName':'cloud_providers','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 d5d53a6..28aa472 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 _0xd4a9=['https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','push','/.default','join','Outlook365','Dynamics365','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','response_mode','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','issuer','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','data4','decryptString','POST','{TENANT_ID}','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data1','intervals','bind','all','inspect','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xd4a9,0x179));var _0x9d4a=function(_0x2cd72a,_0x5d2754){_0x2cd72a=_0x2cd72a-0x0;var _0x5e19bd=_0xd4a9[_0x2cd72a];return _0x5e19bd;};'use strict';var _=require(_0x9d4a('0x0'));var crypto=require(_0x9d4a('0x1'));var jwt=require(_0x9d4a('0x2'));var moment=require('moment');var Redis=require(_0x9d4a('0x3'));var rp=require(_0x9d4a('0x4'));var util=require(_0x9d4a('0x5'));var encryptor=require(_0x9d4a('0x6'));var config=require(_0x9d4a('0x7'));var logger=require('../../config/logger')(_0x9d4a('0x8'));var schedule=require(_0x9d4a('0x9'));var db=require(_0x9d4a('0xa'))['db'];config['redis']=_[_0x9d4a('0xb')](config[_0x9d4a('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x9d4a('0xc')]);var MICROSOFT_AUTH_URL=_0x9d4a('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0x9d4a('0xe'),_0x9d4a('0xf'),_0x9d4a('0x10'),_0x9d4a('0x11'),_0x9d4a('0x12')],'Dynamics365':[_0x9d4a('0x13'),_0x9d4a('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x9d4a('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x9d4a('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d31fb){var _0x4aead1=_[_0x9d4a('0x16')](AZURE_AUTH_SCOPES[_0x2d31fb[_0x9d4a('0x17')]]);if(_0x2d31fb[_0x9d4a('0x17')]==='Dynamics365')_0x4aead1[_0x9d4a('0x18')](_0x2d31fb['data7']+_0x9d4a('0x19'));return _0x4aead1[_0x9d4a('0x1a')]('\x20');}function getAccessTokenScope(_0x328aa6){if(_0x328aa6[_0x9d4a('0x17')]===_0x9d4a('0x1b'))return _0x9d4a('0x10');if(_0x328aa6[_0x9d4a('0x17')]===_0x9d4a('0x1c'))return _0x328aa6['data7']+_0x9d4a('0x19');}function generateMicrosoftAuthorizationUrl(_0x28d7a6,_0x31aaf0){var _0x372171=MICROSOFT_AUTH_URL[_0x9d4a('0x1d')]('{TENANT_ID}',_0x28d7a6[_0x9d4a('0x1e')]);var _0x1c0f24=[_0x9d4a('0x1f'),_0x9d4a('0x20')];var _0xf7f3ed=Buffer[_0x9d4a('0x21')](JSON[_0x9d4a('0x22')]({'id':_0x31aaf0}))[_0x9d4a('0x23')](_0x9d4a('0x24'));var _0x3c0686=crypto[_0x9d4a('0x25')](0x10)[_0x9d4a('0x23')]('hex');var _0x3c073d=getAuthorizationScopes(_0x28d7a6);var _0x289963=[{'key':_0x9d4a('0x26'),'value':_0x28d7a6['data1']},{'key':'response_type','value':encodeURIComponent(_0x1c0f24['join']('\x20'))},{'key':'redirect_uri','value':_0x28d7a6['data4']},{'key':_0x9d4a('0x27'),'value':'form_post'},{'key':_0x9d4a('0x28'),'value':encodeURIComponent(_0x3c073d)},{'key':_0x9d4a('0x29'),'value':_0xf7f3ed},{'key':_0x9d4a('0x2a'),'value':_0x3c0686},{'key':_0x9d4a('0x2b'),'value':_0x9d4a('0x2c')}];var _0x5a54a5=_0x372171+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x289963,function(_0x307f86){return _0x307f86[_0x9d4a('0x2d')]+'='+_0x307f86[_0x9d4a('0x2e')];})[_0x9d4a('0x1a')]('&');_0x28d7a6[_0x9d4a('0x2f')]={'issuer':_0x372171[_0x9d4a('0x1d')](_0x9d4a('0x30'),''),'audience':_0x28d7a6['data1'],'state':_0xf7f3ed,'nonce':_0x3c0686};redis[_0x9d4a('0x31')](_0xf7f3ed,JSON[_0x9d4a('0x22')](_0x28d7a6));return _0x5a54a5;}function isValidIdToken(_0x32b6f8,_0x156fb1){try{var _0x39c8f1=jwt[_0x9d4a('0x32')](_0x32b6f8,{'complete':!![]});var _0x590513=_0x39c8f1[_0x9d4a('0x33')];if(_0x590513['iss']!==_0x156fb1[_0x9d4a('0x34')])return![];if(_0x590513['aud']!==_0x156fb1[_0x9d4a('0x35')])return![];if(_0x590513[_0x9d4a('0x2a')]!==_0x156fb1[_0x9d4a('0x2a')])return![];if(moment()[_0x9d4a('0x36')](moment[_0x9d4a('0x37')](_0x590513[_0x9d4a('0x38')])))return![];return!![];}catch(_0x3d0179){throw _0x3d0179;}}function refreshOauth2MicrosoftAccessToken(_0x3b726c){return Promise[_0x9d4a('0x39')]()['then'](function(){if(_0x3b726c[_0x9d4a('0x3a')])return _0x3b726c;return db[_0x9d4a('0x3b')][_0x9d4a('0x3c')]({'where':{'id':_0x3b726c['id']},'raw':!![]});})[_0x9d4a('0x3d')](function(_0x256e80){var _0x28e03f={'grant_type':_0x9d4a('0x3e'),'refresh_token':_0x256e80[_0x9d4a('0x3f')],'scope':getAccessTokenScope(_0x256e80),'redirect_uri':_0x256e80[_0x9d4a('0x40')],'client_id':_0x256e80['data1'],'client_secret':encryptor[_0x9d4a('0x41')](_0x256e80[_0x9d4a('0x3a')])};var _0x21a2dc={'method':_0x9d4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0x9d4a('0x1d')](_0x9d4a('0x43'),_0x256e80[_0x9d4a('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28e03f,'json':!![]};return rp(_0x21a2dc);})[_0x9d4a('0x3d')](function(_0x50e104){_0x3b726c[_0x9d4a('0x44')]=_0x50e104[_0x9d4a('0x45')];_0x3b726c[_0x9d4a('0x3f')]=_0x50e104[_0x9d4a('0x3e')];return db['CloudProvider'][_0x9d4a('0x46')]({'data5':_0x3b726c[_0x9d4a('0x44')],'data6':_0x3b726c['data6']},{'where':{'id':_0x3b726c['id']}});})[_0x9d4a('0x3d')](function(){return _0x3b726c;})[_0x9d4a('0x47')](function(_0x522522){logger[_0x9d4a('0x48')](_0x9d4a('0x49'),_0x3b726c['id'],_0x522522);});}function getOauth2MicrosoftAccessToken(_0x29211c,_0x14b3cf){var _0x22972f={'grant_type':'authorization_code','code':_0x29211c,'scope':getAccessTokenScope(_0x14b3cf),'redirect_uri':_0x14b3cf[_0x9d4a('0x40')],'client_id':_0x14b3cf[_0x9d4a('0x4a')],'client_secret':encryptor[_0x9d4a('0x41')](_0x14b3cf[_0x9d4a('0x3a')])};var _0x5dcdb3={'method':_0x9d4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0x9d4a('0x1d')](_0x9d4a('0x43'),_0x14b3cf[_0x9d4a('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x22972f,'json':!![]};return rp(_0x5dcdb3);}function startRefreshInterval(_0x3df5e5){var _0x375ae0=schedule[_0x9d4a('0x4b')];if(_0x375ae0[_0x3df5e5['id']])clearInterval(_0x375ae0[_0x3df5e5['id']]);_0x375ae0[_0x3df5e5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9d4a('0x4c')](this,{'id':_0x3df5e5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x375ae0;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9d4a('0x3d')](function(_0x44971c){var _0x47e548=_0x44971c['map'](function(_0x558268){return refreshOauth2MicrosoftAccessToken(_0x558268)[_0x9d4a('0x3d')](function(_0x3aec08){startRefreshInterval(_0x3aec08);});});return Promise[_0x9d4a('0x4d')](_0x47e548);})[_0x9d4a('0x47')](function(_0x2f3962){var _0x4d7c8e=_0x2f3962?util[_0x9d4a('0x4e')](_0x2f3962,{'showHidden':![],'depth':null}):'';logger[_0x9d4a('0x48')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4d7c8e);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4c2a=['code','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','iss','issuer','aud','isAfter','exp','resolve','findOne','then','refresh_token','data6','data4','decryptString','data3','POST','access_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365','{TENANT_ID}','data2'];(function(_0x214330,_0x266cac){var _0x4d408f=function(_0x49e5be){while(--_0x49e5be){_0x214330['push'](_0x214330['shift']());}};_0x4d408f(++_0x266cac);}(_0x4c2a,0x11c));var _0xa4c2=function(_0x367ede,_0x834347){_0x367ede=_0x367ede-0x0;var _0x3d0da0=_0x4c2a[_0x367ede];return _0x3d0da0;};'use strict';var _=require(_0xa4c2('0x0'));var crypto=require('crypto');var jwt=require(_0xa4c2('0x1'));var moment=require(_0xa4c2('0x2'));var Redis=require('ioredis');var rp=require(_0xa4c2('0x3'));var util=require(_0xa4c2('0x4'));var encryptor=require(_0xa4c2('0x5'));var config=require('../../config/environment');var logger=require(_0xa4c2('0x6'))(_0xa4c2('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xa4c2('0x8')]=_[_0xa4c2('0x9')](config[_0xa4c2('0x8')],{'host':_0xa4c2('0xa'),'port':0x18eb});var redis=new Redis(config[_0xa4c2('0x8')]);var MICROSOFT_AUTH_URL=_0xa4c2('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa4c2('0xc'),'profile',_0xa4c2('0xd'),_0xa4c2('0xe'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xa4c2('0xf'),_0xa4c2('0x10')],'Dynamics365':[_0xa4c2('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa4c2('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5e907f){var _0x389fdd=_['map'](AZURE_AUTH_SCOPES[_0x5e907f['type']]);if(_0x5e907f[_0xa4c2('0x12')]==='Dynamics365')_0x389fdd[_0xa4c2('0x13')](_0x5e907f[_0xa4c2('0x14')]+_0xa4c2('0x15'));return _0x389fdd[_0xa4c2('0x16')]('\x20');}function getAccessTokenScope(_0x19cbce){if(_0x19cbce[_0xa4c2('0x12')]===_0xa4c2('0x17'))return _0xa4c2('0x18');if(_0x19cbce[_0xa4c2('0x12')]===_0xa4c2('0x19'))return _0x19cbce[_0xa4c2('0x14')]+_0xa4c2('0x15');}function generateMicrosoftAuthorizationUrl(_0x5e3833,_0x12316e){var _0x58fc26=MICROSOFT_AUTH_URL['replace'](_0xa4c2('0x1a'),_0x5e3833[_0xa4c2('0x1b')]);var _0x5a2c4a=[_0xa4c2('0x1c'),'id_token'];var _0x5ab07f=Buffer['from'](JSON[_0xa4c2('0x1d')]({'id':_0x12316e}))[_0xa4c2('0x1e')]('base64');var _0x5855=crypto[_0xa4c2('0x1f')](0x10)['toString'](_0xa4c2('0x20'));var _0x207a79=getAuthorizationScopes(_0x5e3833);var _0x59cd50=[{'key':_0xa4c2('0x21'),'value':_0x5e3833[_0xa4c2('0x22')]},{'key':_0xa4c2('0x23'),'value':encodeURIComponent(_0x5a2c4a[_0xa4c2('0x16')]('\x20'))},{'key':_0xa4c2('0x24'),'value':_0x5e3833['data4']},{'key':_0xa4c2('0x25'),'value':_0xa4c2('0x26')},{'key':_0xa4c2('0x27'),'value':encodeURIComponent(_0x207a79)},{'key':_0xa4c2('0x28'),'value':_0x5ab07f},{'key':_0xa4c2('0x29'),'value':_0x5855},{'key':_0xa4c2('0x2a'),'value':_0xa4c2('0x2b')}];var _0x1c17dc=_0x58fc26+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x59cd50,function(_0x152757){return _0x152757[_0xa4c2('0x2c')]+'='+_0x152757[_0xa4c2('0x2d')];})['join']('&');_0x5e3833[_0xa4c2('0x2e')]={'issuer':_0x58fc26[_0xa4c2('0x2f')](_0xa4c2('0x30'),''),'audience':_0x5e3833[_0xa4c2('0x22')],'state':_0x5ab07f,'nonce':_0x5855};redis[_0xa4c2('0x31')](_0x5ab07f,JSON[_0xa4c2('0x1d')](_0x5e3833));return _0x1c17dc;}function isValidIdToken(_0x4a7156,_0x3dfa21){try{var _0x45aaeb=jwt[_0xa4c2('0x32')](_0x4a7156,{'complete':!![]});var _0x183ba0=_0x45aaeb['payload'];if(_0x183ba0[_0xa4c2('0x33')]!==_0x3dfa21[_0xa4c2('0x34')])return![];if(_0x183ba0[_0xa4c2('0x35')]!==_0x3dfa21['audience'])return![];if(_0x183ba0[_0xa4c2('0x29')]!==_0x3dfa21[_0xa4c2('0x29')])return![];if(moment()[_0xa4c2('0x36')](moment['unix'](_0x183ba0[_0xa4c2('0x37')])))return![];return!![];}catch(_0x436c0f){throw _0x436c0f;}}function refreshOauth2MicrosoftAccessToken(_0x55fd68){return Promise[_0xa4c2('0x38')]()['then'](function(){if(_0x55fd68['data3'])return _0x55fd68;return db['CloudProvider'][_0xa4c2('0x39')]({'where':{'id':_0x55fd68['id']},'raw':!![]});})[_0xa4c2('0x3a')](function(_0x1ac8d2){var _0x1bf55f={'grant_type':_0xa4c2('0x3b'),'refresh_token':_0x1ac8d2[_0xa4c2('0x3c')],'scope':getAccessTokenScope(_0x1ac8d2),'redirect_uri':_0x1ac8d2[_0xa4c2('0x3d')],'client_id':_0x1ac8d2[_0xa4c2('0x22')],'client_secret':encryptor[_0xa4c2('0x3e')](_0x1ac8d2[_0xa4c2('0x3f')])};var _0x1d856d={'method':_0xa4c2('0x40'),'uri':MICROSOFT_AUTH_URL[_0xa4c2('0x2f')](_0xa4c2('0x1a'),_0x1ac8d2[_0xa4c2('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1bf55f,'json':!![]};return rp(_0x1d856d);})[_0xa4c2('0x3a')](function(_0x4d634b){_0x55fd68['data5']=_0x4d634b[_0xa4c2('0x41')];_0x55fd68[_0xa4c2('0x3c')]=_0x4d634b['refresh_token'];return db[_0xa4c2('0x42')][_0xa4c2('0x43')]({'data5':_0x55fd68['data5'],'data6':_0x55fd68[_0xa4c2('0x3c')]},{'where':{'id':_0x55fd68['id']}});})[_0xa4c2('0x3a')](function(){return _0x55fd68;})[_0xa4c2('0x44')](function(_0xe0ac77){logger[_0xa4c2('0x45')](_0xa4c2('0x46'),_0x55fd68['id'],_0xe0ac77);});}function getOauth2MicrosoftAccessToken(_0x21f4ed,_0x494d66){var _0x438bac={'grant_type':_0xa4c2('0x47'),'code':_0x21f4ed,'scope':getAccessTokenScope(_0x494d66),'redirect_uri':_0x494d66[_0xa4c2('0x3d')],'client_id':_0x494d66['data1'],'client_secret':encryptor[_0xa4c2('0x3e')](_0x494d66[_0xa4c2('0x3f')])};var _0x5587ee={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa4c2('0x2f')]('{TENANT_ID}',_0x494d66[_0xa4c2('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x438bac,'json':!![]};return rp(_0x5587ee);}function startRefreshInterval(_0xc902d3){var _0x5a4a6d=schedule['intervals'];if(_0x5a4a6d[_0xc902d3['id']])clearInterval(_0x5a4a6d[_0xc902d3['id']]);_0x5a4a6d[_0xc902d3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa4c2('0x48')](this,{'id':_0xc902d3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa4c2('0x49')]=_0x5a4a6d;}function startAllRefreshIntervals(){return db[_0xa4c2('0x42')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa4c2('0x3a')](function(_0x143f2b){var _0x5f0849=_0x143f2b['map'](function(_0x3f1b56){return refreshOauth2MicrosoftAccessToken(_0x3f1b56)[_0xa4c2('0x3a')](function(_0x162d47){startRefreshInterval(_0x162d47);});});return Promise[_0xa4c2('0x4a')](_0x5f0849);})[_0xa4c2('0x44')](function(_0x37efd6){var _0x46bc14=_0x37efd6?util[_0xa4c2('0x4b')](_0x37efd6,{'showHidden':![],'depth':null}):'';logger['error'](_0xa4c2('0x4c'),_0x46bc14);});}module[_0xa4c2('0x4d')]={'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 dc681b2..71d0be8 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 _0x543b=['http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21e696,_0x4a67b0){var _0x2c5b3f=function(_0x450162){while(--_0x450162){_0x21e696['push'](_0x21e696['shift']());}};_0x2c5b3f(++_0x4a67b0);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208c95,_0x338142,_0x21bb48){return new BPromise(function(_0x307a74,_0x2a2c1f){return client[_0xb543('0xc')](_0x208c95,_0x21bb48)['then'](function(_0xa94776){logger['info'](_0xb543('0xd'),_0x338142,_0xb543('0xe'));logger[_0xb543('0xf')](_0xb543('0x10'),_0x338142,_0xb543('0xe'),JSON[_0xb543('0x11')](_0xa94776));if(_0xa94776['error']){if(_0xa94776[_0xb543('0x12')][_0xb543('0x13')]===0x1f4){logger[_0xb543('0x12')]('CloudProvider,\x20%s,\x20%s',_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x2a2c1f(_0xa94776[_0xb543('0x12')]['message']);}logger['error'](_0xb543('0xd'),_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x307a74(_0xa94776[_0xb543('0x12')]['message']);}else{logger[_0xb543('0x15')](_0xb543('0xd'),_0x338142,_0xb543('0xe'));_0x307a74(_0xa94776[_0xb543('0x16')]['message']);}})[_0xb543('0x17')](function(_0x5230df){logger[_0xb543('0x12')](_0xb543('0xd'),_0x338142,_0x5230df);_0x2a2c1f(_0x5230df);});});} \ No newline at end of file +var _0x4813=['lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x431360,_0x436708){var _0x561365=function(_0x10796c){while(--_0x10796c){_0x431360['push'](_0x431360['shift']());}};_0x561365(++_0x436708);}(_0x4813,0xdc));var _0x3481=function(_0x494322,_0x1e6e02){_0x494322=_0x494322-0x0;var _0x2cc75d=_0x4813[_0x494322];return _0x2cc75d;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var moment=require(_0x3481('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3481('0x2'));var db=require(_0x3481('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x4'))(_0x3481('0x5'));var config=require(_0x3481('0x6'));var jayson=require(_0x3481('0x7'));var client=jayson[_0x3481('0x8')][_0x3481('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x369c3b,_0x54a2c8,_0x4d23ef){return new BPromise(function(_0x41592f,_0x527c3c){return client[_0x3481('0xa')](_0x369c3b,_0x4d23ef)[_0x3481('0xb')](function(_0x39b6c4){logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));logger[_0x3481('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x54a2c8,'request\x20sent',JSON[_0x3481('0x10')](_0x39b6c4));if(_0x39b6c4[_0x3481('0x11')]){if(_0x39b6c4[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')]('CloudProvider,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);return _0x527c3c(_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);}logger[_0x3481('0x11')]('CloudProvider,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4['error'][_0x3481('0x13')]);return _0x41592f(_0x39b6c4[_0x3481('0x11')]['message']);}else{logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));_0x41592f(_0x39b6c4[_0x3481('0x14')][_0x3481('0x13')]);}})[_0x3481('0x15')](function(_0x2a3981){logger['error'](_0x3481('0xd'),_0x54a2c8,_0x2a3981);_0x527c3c(_0x2a3981);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6044a3d..7088e67 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x2b94e9,_0x36e1d2){var _0xb4473d=function(_0x365db2){while(--_0x365db2){_0x2b94e9['push'](_0x2b94e9['shift']());}};_0xb4473d(++_0x36e1d2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=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(_0x3cbada,_0x41fa40){var _0x3e31e5=function(_0x30d7bc){while(--_0x30d7bc){_0x3cbada['push'](_0x3cbada['shift']());}};_0x3e31e5(++_0x41fa40);}(_0xdb28,0x106));var _0x8db2=function(_0x150ff2,_0x30f506){_0x150ff2=_0x150ff2-0x0;var _0xba3f80=_0xdb28[_0x150ff2];return _0xba3f80;};'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 44e4ea9..816f9f2 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 _0x9fbb=['STRING','sequelize'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0x9fbb,0x1eb));var _0xb9fb=function(_0x19c348,_0x372110){_0x19c348=_0x19c348-0x0;var _0x3f0f8b=_0x9fbb[_0x19c348];return _0x3f0f8b;};'use strict';var Sequelize=require(_0xb9fb('0x0'));module['exports']={'name':{'type':Sequelize[_0xb9fb('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb9fb('0x1')]},'companyId':{'type':Sequelize[_0xb9fb('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb9fb('0x1')]},'fax':{'type':Sequelize[_0xb9fb('0x1')]},'type':{'type':Sequelize[_0xb9fb('0x1')]},'street':{'type':Sequelize[_0xb9fb('0x1')]},'postalCode':{'type':Sequelize[_0xb9fb('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb9fb('0x1')]},'email':{'type':Sequelize[_0xb9fb('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb9fb('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xb9fb('0x1')]},'description':{'type':Sequelize[_0xb9fb('0x1')]}}; \ No newline at end of file +var _0x2b68=['STRING','exports'];(function(_0x261992,_0x31cfbb){var _0x356f3b=function(_0x5ce0d7){while(--_0x5ce0d7){_0x261992['push'](_0x261992['shift']());}};_0x356f3b(++_0x31cfbb);}(_0x2b68,0x99));var _0x82b6=function(_0x237fd6,_0x59d931){_0x237fd6=_0x237fd6-0x0;var _0x253f77=_0x2b68[_0x237fd6];return _0x253f77;};'use strict';var Sequelize=require('sequelize');module[_0x82b6('0x0')]={'name':{'type':Sequelize[_0x82b6('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x82b6('0x1')]},'companyId':{'type':Sequelize[_0x82b6('0x1')]},'website':{'type':Sequelize[_0x82b6('0x1')]},'phone':{'type':Sequelize[_0x82b6('0x1')]},'fax':{'type':Sequelize[_0x82b6('0x1')]},'type':{'type':Sequelize[_0x82b6('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x82b6('0x1')]},'city':{'type':Sequelize[_0x82b6('0x1')]},'country':{'type':Sequelize[_0x82b6('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x82b6('0x1')]},'sPostalCode':{'type':Sequelize[_0x82b6('0x1')]},'sCity':{'type':Sequelize[_0x82b6('0x1')]},'sCountry':{'type':Sequelize[_0x82b6('0x1')]},'description':{'type':Sequelize[_0x82b6('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1f826d2..f0e49f2 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 _0xae75=['status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addContacts','ids','omit','findOne','CmContact','sort','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4be563,_0x371f7d){var _0xa7d890=function(_0xe80d67){while(--_0xe80d67){_0x4be563['push'](_0x4be563['shift']());}};_0xa7d890(++_0x371f7d);}(_0xae75,0x9a));var _0x5ae7=function(_0x1a1e6e,_0x2155cc){_0x1a1e6e=_0x1a1e6e-0x0;var _0x311ad6=_0xae75[_0x1a1e6e];return _0x311ad6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ae7('0x0'));var zipdir=require(_0x5ae7('0x1'));var jsonpatch=require(_0x5ae7('0x2'));var rp=require(_0x5ae7('0x3'));var moment=require(_0x5ae7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ae7('0x5'));var util=require(_0x5ae7('0x6'));var path=require(_0x5ae7('0x7'));var sox=require(_0x5ae7('0x8'));var csv=require('to-csv');var ejs=require(_0x5ae7('0x9'));var fs=require('fs');var fs_extra=require(_0x5ae7('0xa'));var _=require('lodash');var squel=require(_0x5ae7('0xb'));var crypto=require(_0x5ae7('0xc'));var jsforce=require(_0x5ae7('0xd'));var deskjs=require(_0x5ae7('0xe'));var toCsv=require(_0x5ae7('0xf'));var querystring=require('querystring');var Papa=require(_0x5ae7('0x10'));var Redis=require(_0x5ae7('0x11'));var authService=require(_0x5ae7('0x12'));var qs=require(_0x5ae7('0x13'));var as=require(_0x5ae7('0x14'));var hardwareService=require(_0x5ae7('0x15'));var logger=require(_0x5ae7('0x16'))(_0x5ae7('0x17'));var utils=require('../../config/utils');var config=require(_0x5ae7('0x18'));var licenseUtil=require(_0x5ae7('0x19'));var db=require(_0x5ae7('0x1a'))['db'];function respondWithStatusCode(_0x1ad294,_0x3cb10a){_0x3cb10a=_0x3cb10a||0xcc;return function(_0x3ec136){if(_0x3ec136){return _0x1ad294[_0x5ae7('0x1b')](_0x3cb10a);}return _0x1ad294[_0x5ae7('0x1c')](_0x3cb10a)[_0x5ae7('0x1d')]();};}function respondWithResult(_0x34ebd4,_0x2c6ef8){_0x2c6ef8=_0x2c6ef8||0xc8;return function(_0x52b4db){if(_0x52b4db){return _0x34ebd4[_0x5ae7('0x1c')](_0x2c6ef8)[_0x5ae7('0x1e')](_0x52b4db);}};}function respondWithFilteredResult(_0x20ff4a,_0x306398){return function(_0x7558e7){if(_0x7558e7){var _0x31909e=typeof _0x306398[_0x5ae7('0x1f')]===_0x5ae7('0x20')&&typeof _0x306398[_0x5ae7('0x21')]===_0x5ae7('0x20');var _0xd82adf=_0x7558e7[_0x5ae7('0x22')];var _0x220e87=_0x31909e?0x0:_0x306398[_0x5ae7('0x1f')];var _0x15ab8a=_0x31909e?_0x7558e7[_0x5ae7('0x22')]:_0x306398['offset']+_0x306398[_0x5ae7('0x21')];var _0x4a2043;if(_0x15ab8a>=_0xd82adf){_0x15ab8a=_0xd82adf;_0x4a2043=0xc8;}else{_0x4a2043=0xce;}_0x20ff4a[_0x5ae7('0x1c')](_0x4a2043);return _0x20ff4a['set'](_0x5ae7('0x23'),_0x220e87+'-'+_0x15ab8a+'/'+_0xd82adf)[_0x5ae7('0x1e')](_0x7558e7);}return null;};}function patchUpdates(_0x24ab52){return function(_0x10ed99){try{jsonpatch[_0x5ae7('0x24')](_0x10ed99,_0x24ab52,!![]);}catch(_0x1da844){return BPromise['reject'](_0x1da844);}return _0x10ed99[_0x5ae7('0x25')]();};}function saveUpdates(_0x795410,_0x2334d5){return function(_0x4857b9){if(_0x4857b9){return _0x4857b9[_0x5ae7('0x26')](_0x795410)[_0x5ae7('0x27')](function(_0x15e142){return _0x15e142;});}return null;};}function removeEntity(_0x57f9fd,_0x20b89c){return function(_0x4623bb){if(_0x4623bb){return _0x4623bb[_0x5ae7('0x28')]()[_0x5ae7('0x27')](function(){var _0xd614ca=_0x4623bb[_0x5ae7('0x29')]({'plain':!![]});var _0x2db3c1=_0x5ae7('0x2a');return db[_0x5ae7('0x2b')][_0x5ae7('0x28')]({'where':{'type':_0x2db3c1,'resourceId':_0xd614ca['id']}})[_0x5ae7('0x27')](function(){return _0x4623bb;});})[_0x5ae7('0x27')](function(){_0x57f9fd[_0x5ae7('0x1c')](0xcc)[_0x5ae7('0x1d')]();});}};}function handleEntityNotFound(_0x22d679,_0xa5b870){return function(_0x250494){if(!_0x250494){_0x22d679[_0x5ae7('0x1b')](0x194);}return _0x250494;};}function handleError(_0x192aec,_0x4881fe){_0x4881fe=_0x4881fe||0x1f4;return function(_0x2463f1){logger[_0x5ae7('0x2c')](_0x2463f1[_0x5ae7('0x2d')]);if(_0x2463f1[_0x5ae7('0x2e')]){delete _0x2463f1['name'];}_0x192aec['status'](_0x4881fe)[_0x5ae7('0x2f')](_0x2463f1);};}exports['index']=function(_0x59a2ae,_0x2c6f35){var _0x4391a7={},_0x1ee3c7={},_0x4a3b79={'count':0x0,'rows':[]};return db[_0x5ae7('0x30')]['describe']()[_0x5ae7('0x27')](function(_0x2c1cd5){_0x1ee3c7['model']=_[_0x5ae7('0x31')](_0x2c1cd5);_0x1ee3c7['query']=_['keys'](_0x59a2ae[_0x5ae7('0x32')]);_0x1ee3c7[_0x5ae7('0x33')]=_[_0x5ae7('0x34')](_0x1ee3c7[_0x5ae7('0x35')],_0x1ee3c7[_0x5ae7('0x32')]);_0x4391a7[_0x5ae7('0x36')]=_[_0x5ae7('0x34')](_0x1ee3c7[_0x5ae7('0x35')],qs[_0x5ae7('0x37')](_0x59a2ae[_0x5ae7('0x32')][_0x5ae7('0x37')]));_0x4391a7[_0x5ae7('0x36')]=_0x4391a7[_0x5ae7('0x36')][_0x5ae7('0x38')]?_0x4391a7['attributes']:_0x1ee3c7[_0x5ae7('0x35')];if(!_0x59a2ae['query'][_0x5ae7('0x39')](_0x5ae7('0x3a'))){_0x4391a7['limit']=qs[_0x5ae7('0x21')](_0x59a2ae[_0x5ae7('0x32')]['limit']);_0x4391a7[_0x5ae7('0x1f')]=qs[_0x5ae7('0x1f')](_0x59a2ae[_0x5ae7('0x32')][_0x5ae7('0x1f')]);}_0x4391a7[_0x5ae7('0x3b')]=qs['sort'](_0x59a2ae['query']['sort']);_0x4391a7['where']=qs['filters'](_[_0x5ae7('0x3c')](_0x59a2ae[_0x5ae7('0x32')],_0x1ee3c7['filters']),_0x2c1cd5);if(_0x59a2ae['query'][_0x5ae7('0x3d')]){_0x4391a7[_0x5ae7('0x3e')]=_[_0x5ae7('0x3f')](_0x4391a7['where'],{'$or':_[_0x5ae7('0x40')](_0x4391a7[_0x5ae7('0x36')],function(_0x57574f){var _0x52b273={};_0x52b273[_0x57574f]={'$like':'%'+_0x59a2ae[_0x5ae7('0x32')][_0x5ae7('0x3d')]+'%'};return _0x52b273;})});}_0x4391a7=_[_0x5ae7('0x3f')]({},_0x4391a7,_0x59a2ae[_0x5ae7('0x41')]);var _0x5959ec={'where':_0x4391a7[_0x5ae7('0x3e')]};return db[_0x5ae7('0x30')][_0x5ae7('0x22')](_0x5959ec)[_0x5ae7('0x27')](function(_0x5db497){_0x4a3b79[_0x5ae7('0x22')]=_0x5db497;if(_0x59a2ae['query'][_0x5ae7('0x42')]){_0x4391a7['include']=[{'all':!![]}];}return db[_0x5ae7('0x30')][_0x5ae7('0x43')](_0x4391a7);})['then'](function(_0x5a865a){_0x4a3b79[_0x5ae7('0x44')]=_0x5a865a;return _0x4a3b79;})[_0x5ae7('0x27')](respondWithFilteredResult(_0x2c6f35,_0x4391a7))[_0x5ae7('0x45')](handleError(_0x2c6f35,null));})[_0x5ae7('0x45')](handleError(_0x2c6f35,null));};exports[_0x5ae7('0x46')]=function(_0x3ad393,_0x1dd75c){var _0x14fe38={'raw':![],'where':{'id':_0x3ad393[_0x5ae7('0x47')]['id']}},_0x539864={};_0x539864[_0x5ae7('0x35')]=_[_0x5ae7('0x31')](db['CmCompany'][_0x5ae7('0x48')]);_0x539864[_0x5ae7('0x32')]=_['keys'](_0x3ad393['query']);_0x539864[_0x5ae7('0x33')]=_[_0x5ae7('0x34')](_0x539864[_0x5ae7('0x35')],_0x539864[_0x5ae7('0x32')]);_0x14fe38[_0x5ae7('0x36')]=_[_0x5ae7('0x34')](_0x539864[_0x5ae7('0x35')],qs['fields'](_0x3ad393[_0x5ae7('0x32')][_0x5ae7('0x37')]));_0x14fe38['attributes']=_0x14fe38[_0x5ae7('0x36')][_0x5ae7('0x38')]?_0x14fe38['attributes']:_0x539864[_0x5ae7('0x35')];if(_0x3ad393[_0x5ae7('0x32')][_0x5ae7('0x42')]){_0x14fe38[_0x5ae7('0x49')]=[{'all':!![]}];}_0x14fe38=_[_0x5ae7('0x3f')]({},_0x14fe38,_0x3ad393['options']);return db[_0x5ae7('0x30')][_0x5ae7('0x4a')](_0x14fe38)[_0x5ae7('0x27')](handleEntityNotFound(_0x1dd75c,null))['then'](respondWithResult(_0x1dd75c,null))[_0x5ae7('0x45')](handleError(_0x1dd75c,null));};exports[_0x5ae7('0x4b')]=function(_0x3f36a0,_0x2819c5){return db['CmCompany'][_0x5ae7('0x4b')](_0x3f36a0[_0x5ae7('0x4c')],{})[_0x5ae7('0x27')](function(_0x31d9d2){var _0x5c0c05=_0x3f36a0[_0x5ae7('0x4d')][_0x5ae7('0x29')]({'plain':!![]});if(!_0x5c0c05)throw new Error(_0x5ae7('0x4e'));if(_0x5c0c05[_0x5ae7('0x4f')]===_0x5ae7('0x4d')){var _0x5ddb9d=_0x31d9d2[_0x5ae7('0x29')]({'plain':!![]});var _0x77a3c2='Companies';return db[_0x5ae7('0x50')]['find']({'where':{'name':_0x77a3c2,'userProfileId':_0x5c0c05[_0x5ae7('0x51')]},'raw':!![]})['then'](function(_0x30a75c){if(_0x30a75c&&_0x30a75c[_0x5ae7('0x52')]===0x0){return db[_0x5ae7('0x2b')][_0x5ae7('0x4b')]({'name':_0x5ddb9d[_0x5ae7('0x2e')],'resourceId':_0x5ddb9d['id'],'type':_0x30a75c['name'],'sectionId':_0x30a75c['id']},{})[_0x5ae7('0x27')](function(){return _0x31d9d2;});}else{return _0x31d9d2;}})['catch'](function(_0x1e9dc0){logger[_0x5ae7('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e9dc0);throw _0x1e9dc0;});}return _0x31d9d2;})[_0x5ae7('0x27')](respondWithResult(_0x2819c5,0xc9))[_0x5ae7('0x45')](handleError(_0x2819c5,null));};exports['update']=function(_0x63fda8,_0x587dd3){if(_0x63fda8[_0x5ae7('0x4c')]['id']){delete _0x63fda8[_0x5ae7('0x4c')]['id'];}return db['CmCompany'][_0x5ae7('0x4a')]({'where':{'id':_0x63fda8[_0x5ae7('0x47')]['id']}})['then'](handleEntityNotFound(_0x587dd3,null))[_0x5ae7('0x27')](saveUpdates(_0x63fda8[_0x5ae7('0x4c')],null))[_0x5ae7('0x27')](respondWithResult(_0x587dd3,null))[_0x5ae7('0x45')](handleError(_0x587dd3,null));};exports[_0x5ae7('0x28')]=function(_0x5a7479,_0x43b4a9){return db[_0x5ae7('0x30')][_0x5ae7('0x4a')]({'where':{'id':_0x5a7479[_0x5ae7('0x47')]['id']}})[_0x5ae7('0x27')](handleEntityNotFound(_0x43b4a9,null))[_0x5ae7('0x27')](removeEntity(_0x43b4a9,null))[_0x5ae7('0x45')](handleError(_0x43b4a9,null));};exports['describe']=function(_0x50dcbd,_0x527fd5){return db[_0x5ae7('0x30')][_0x5ae7('0x53')]()[_0x5ae7('0x27')](respondWithResult(_0x527fd5,null))[_0x5ae7('0x45')](handleError(_0x527fd5,null));};exports[_0x5ae7('0x54')]=function(_0x12a85b,_0x2719d2,_0x9c8283){return db['CmContact'][_0x5ae7('0x4a')]({'where':{'id':_0x12a85b[_0x5ae7('0x47')]['id']}})[_0x5ae7('0x27')](handleEntityNotFound(_0x2719d2,null))['then'](function(_0xf4a92a){if(_0xf4a92a){return _0xf4a92a[_0x5ae7('0x54')](_0x12a85b[_0x5ae7('0x4c')][_0x5ae7('0x55')],_[_0x5ae7('0x56')](_0x12a85b[_0x5ae7('0x4c')],[_0x5ae7('0x55'),'id'])||{});}})['then'](respondWithResult(_0x2719d2,null))['catch'](handleError(_0x2719d2,null));};exports['getContacts']=function(_0x360b16,_0xeae609,_0x3969ac){var _0x47bc4e={};var _0x3b1326={};var _0x144163;var _0x3a9211;return db[_0x5ae7('0x30')][_0x5ae7('0x57')]({'where':{'id':_0x360b16['params']['id']}})['then'](handleEntityNotFound(_0xeae609,null))[_0x5ae7('0x27')](function(_0x489eaf){if(_0x489eaf){_0x144163=_0x489eaf;_0x3b1326[_0x5ae7('0x35')]=_['keys'](db[_0x5ae7('0x58')][_0x5ae7('0x48')]);_0x3b1326[_0x5ae7('0x32')]=_[_0x5ae7('0x31')](_0x360b16[_0x5ae7('0x32')]);_0x3b1326[_0x5ae7('0x33')]=_['intersection'](_0x3b1326[_0x5ae7('0x35')],_0x3b1326[_0x5ae7('0x32')]);_0x47bc4e['attributes']=_['intersection'](_0x3b1326[_0x5ae7('0x35')],qs[_0x5ae7('0x37')](_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x37')]));_0x47bc4e[_0x5ae7('0x36')]=_0x47bc4e[_0x5ae7('0x36')][_0x5ae7('0x38')]?_0x47bc4e[_0x5ae7('0x36')]:_0x3b1326[_0x5ae7('0x35')];_0x47bc4e[_0x5ae7('0x3b')]=qs[_0x5ae7('0x59')](_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x59')]);_0x47bc4e['where']=qs['filters'](_[_0x5ae7('0x3c')](_0x360b16['query'],_0x3b1326[_0x5ae7('0x33')]));if(_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x3d')]){_0x47bc4e[_0x5ae7('0x3e')]=_[_0x5ae7('0x3f')](_0x47bc4e[_0x5ae7('0x3e')],{'$or':_[_0x5ae7('0x40')](_0x47bc4e[_0x5ae7('0x36')],function(_0x41315e){var _0x127e92={};_0x127e92[_0x41315e]={'$like':'%'+_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x3d')]+'%'};return _0x127e92;})});}_0x47bc4e=_[_0x5ae7('0x3f')]({},_0x47bc4e,_0x360b16[_0x5ae7('0x41')]);return _0x144163[_0x5ae7('0x5a')](_0x47bc4e);}})[_0x5ae7('0x27')](function(_0x5b98f4){if(_0x5b98f4){_0x3a9211=_0x5b98f4[_0x5ae7('0x38')];if(!_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x39')](_0x5ae7('0x3a'))){_0x47bc4e[_0x5ae7('0x21')]=qs[_0x5ae7('0x21')](_0x360b16['query']['limit']);_0x47bc4e[_0x5ae7('0x1f')]=qs[_0x5ae7('0x1f')](_0x360b16[_0x5ae7('0x32')][_0x5ae7('0x1f')]);}return _0x144163['getContacts'](_0x47bc4e);}})[_0x5ae7('0x27')](function(_0x1f8894){if(_0x1f8894){return _0x1f8894?{'count':_0x3a9211,'rows':_0x1f8894}:null;}})[_0x5ae7('0x27')](respondWithResult(_0xeae609,null))['catch'](handleError(_0xeae609,null));}; \ No newline at end of file +var _0x274f=['pick','getContacts','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','destroy','get','Companies','UserProfileResource','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','findOne'];(function(_0x584da3,_0x388a44){var _0x37aeb9=function(_0x1f5b77){while(--_0x1f5b77){_0x584da3['push'](_0x584da3['shift']());}};_0x37aeb9(++_0x388a44);}(_0x274f,0x102));var _0xf274=function(_0x745c75,_0x3ddc96){_0x745c75=_0x745c75-0x0;var _0x15d6c2=_0x274f[_0x745c75];return _0x15d6c2;};'use strict';var emlformat=require(_0xf274('0x0'));var rimraf=require(_0xf274('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf274('0x2'));var rp=require(_0xf274('0x3'));var moment=require(_0xf274('0x4'));var BPromise=require(_0xf274('0x5'));var Mustache=require(_0xf274('0x6'));var util=require(_0xf274('0x7'));var path=require('path');var sox=require(_0xf274('0x8'));var csv=require(_0xf274('0x9'));var ejs=require(_0xf274('0xa'));var fs=require('fs');var fs_extra=require(_0xf274('0xb'));var _=require(_0xf274('0xc'));var squel=require(_0xf274('0xd'));var crypto=require(_0xf274('0xe'));var jsforce=require(_0xf274('0xf'));var deskjs=require(_0xf274('0x10'));var toCsv=require(_0xf274('0x9'));var querystring=require(_0xf274('0x11'));var Papa=require('papaparse');var Redis=require(_0xf274('0x12'));var authService=require(_0xf274('0x13'));var qs=require(_0xf274('0x14'));var as=require(_0xf274('0x15'));var hardwareService=require(_0xf274('0x16'));var logger=require(_0xf274('0x17'))(_0xf274('0x18'));var utils=require(_0xf274('0x19'));var config=require(_0xf274('0x1a'));var licenseUtil=require(_0xf274('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f773b,_0x2e9fd7){_0x2e9fd7=_0x2e9fd7||0xcc;return function(_0x515974){if(_0x515974){return _0x2f773b[_0xf274('0x1c')](_0x2e9fd7);}return _0x2f773b[_0xf274('0x1d')](_0x2e9fd7)[_0xf274('0x1e')]();};}function respondWithResult(_0x3ff324,_0x3d8dfb){_0x3d8dfb=_0x3d8dfb||0xc8;return function(_0x1c2178){if(_0x1c2178){return _0x3ff324['status'](_0x3d8dfb)[_0xf274('0x1f')](_0x1c2178);}};}function respondWithFilteredResult(_0x5248cb,_0x3cabeb){return function(_0x30cb68){if(_0x30cb68){var _0x556594=typeof _0x3cabeb[_0xf274('0x20')]===_0xf274('0x21')&&typeof _0x3cabeb['limit']===_0xf274('0x21');var _0x34de73=_0x30cb68[_0xf274('0x22')];var _0xf246ed=_0x556594?0x0:_0x3cabeb[_0xf274('0x20')];var _0x3522fd=_0x556594?_0x30cb68[_0xf274('0x22')]:_0x3cabeb[_0xf274('0x20')]+_0x3cabeb['limit'];var _0x3f48a5;if(_0x3522fd>=_0x34de73){_0x3522fd=_0x34de73;_0x3f48a5=0xc8;}else{_0x3f48a5=0xce;}_0x5248cb[_0xf274('0x1d')](_0x3f48a5);return _0x5248cb['set'](_0xf274('0x23'),_0xf246ed+'-'+_0x3522fd+'/'+_0x34de73)['json'](_0x30cb68);}return null;};}function patchUpdates(_0x3fdbd5){return function(_0x554b4e){try{jsonpatch['apply'](_0x554b4e,_0x3fdbd5,!![]);}catch(_0x147dbe){return BPromise[_0xf274('0x24')](_0x147dbe);}return _0x554b4e['save']();};}function saveUpdates(_0x85c31a,_0x14087e){return function(_0x1b62f9){if(_0x1b62f9){return _0x1b62f9[_0xf274('0x25')](_0x85c31a)[_0xf274('0x26')](function(_0x35cec0){return _0x35cec0;});}return null;};}function removeEntity(_0x3b0ae4,_0x22cc8b){return function(_0x1e8b12){if(_0x1e8b12){return _0x1e8b12[_0xf274('0x27')]()[_0xf274('0x26')](function(){var _0x137cbc=_0x1e8b12[_0xf274('0x28')]({'plain':!![]});var _0x3f93f4=_0xf274('0x29');return db[_0xf274('0x2a')]['destroy']({'where':{'type':_0x3f93f4,'resourceId':_0x137cbc['id']}})['then'](function(){return _0x1e8b12;});})[_0xf274('0x26')](function(){_0x3b0ae4[_0xf274('0x1d')](0xcc)[_0xf274('0x1e')]();});}};}function handleEntityNotFound(_0x5ead3d,_0x423d89){return function(_0x6f3fe0){if(!_0x6f3fe0){_0x5ead3d[_0xf274('0x1c')](0x194);}return _0x6f3fe0;};}function handleError(_0x39898a,_0x4fd345){_0x4fd345=_0x4fd345||0x1f4;return function(_0x6f706d){logger['error'](_0x6f706d['stack']);if(_0x6f706d['name']){delete _0x6f706d['name'];}_0x39898a[_0xf274('0x1d')](_0x4fd345)['send'](_0x6f706d);};}exports['index']=function(_0x44ecaf,_0x263d00){var _0x5809f1={},_0x31a470={},_0x455637={'count':0x0,'rows':[]};return db[_0xf274('0x2b')][_0xf274('0x2c')]()[_0xf274('0x26')](function(_0xfc6bf5){_0x31a470[_0xf274('0x2d')]=_[_0xf274('0x2e')](_0xfc6bf5);_0x31a470[_0xf274('0x2f')]=_[_0xf274('0x2e')](_0x44ecaf[_0xf274('0x2f')]);_0x31a470['filters']=_[_0xf274('0x30')](_0x31a470[_0xf274('0x2d')],_0x31a470[_0xf274('0x2f')]);_0x5809f1[_0xf274('0x31')]=_[_0xf274('0x30')](_0x31a470[_0xf274('0x2d')],qs[_0xf274('0x32')](_0x44ecaf['query'][_0xf274('0x32')]));_0x5809f1['attributes']=_0x5809f1[_0xf274('0x31')][_0xf274('0x33')]?_0x5809f1[_0xf274('0x31')]:_0x31a470[_0xf274('0x2d')];if(!_0x44ecaf[_0xf274('0x2f')]['hasOwnProperty'](_0xf274('0x34'))){_0x5809f1[_0xf274('0x35')]=qs[_0xf274('0x35')](_0x44ecaf[_0xf274('0x2f')]['limit']);_0x5809f1[_0xf274('0x20')]=qs[_0xf274('0x20')](_0x44ecaf['query'][_0xf274('0x20')]);}_0x5809f1[_0xf274('0x36')]=qs[_0xf274('0x37')](_0x44ecaf[_0xf274('0x2f')][_0xf274('0x37')]);_0x5809f1[_0xf274('0x38')]=qs[_0xf274('0x39')](_['pick'](_0x44ecaf[_0xf274('0x2f')],_0x31a470[_0xf274('0x39')]),_0xfc6bf5);if(_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3a')]){_0x5809f1[_0xf274('0x38')]=_[_0xf274('0x3b')](_0x5809f1[_0xf274('0x38')],{'$or':_[_0xf274('0x3c')](_0x5809f1['attributes'],function(_0xfe6ab8){var _0x1ad012={};_0x1ad012[_0xfe6ab8]={'$like':'%'+_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3a')]+'%'};return _0x1ad012;})});}_0x5809f1=_[_0xf274('0x3b')]({},_0x5809f1,_0x44ecaf[_0xf274('0x3d')]);var _0x13496c={'where':_0x5809f1[_0xf274('0x38')]};return db[_0xf274('0x2b')][_0xf274('0x22')](_0x13496c)['then'](function(_0xe8e622){_0x455637[_0xf274('0x22')]=_0xe8e622;if(_0x44ecaf[_0xf274('0x2f')][_0xf274('0x3e')]){_0x5809f1[_0xf274('0x3f')]=[{'all':!![]}];}return db[_0xf274('0x2b')][_0xf274('0x40')](_0x5809f1);})[_0xf274('0x26')](function(_0x3b6faa){_0x455637[_0xf274('0x41')]=_0x3b6faa;return _0x455637;})[_0xf274('0x26')](respondWithFilteredResult(_0x263d00,_0x5809f1))['catch'](handleError(_0x263d00,null));})['catch'](handleError(_0x263d00,null));};exports['show']=function(_0x2c26fd,_0x1f3416){var _0x420219={'raw':![],'where':{'id':_0x2c26fd[_0xf274('0x42')]['id']}},_0x43b17f={};_0x43b17f[_0xf274('0x2d')]=_[_0xf274('0x2e')](db[_0xf274('0x2b')][_0xf274('0x43')]);_0x43b17f[_0xf274('0x2f')]=_['keys'](_0x2c26fd[_0xf274('0x2f')]);_0x43b17f['filters']=_[_0xf274('0x30')](_0x43b17f[_0xf274('0x2d')],_0x43b17f[_0xf274('0x2f')]);_0x420219['attributes']=_[_0xf274('0x30')](_0x43b17f['model'],qs[_0xf274('0x32')](_0x2c26fd[_0xf274('0x2f')]['fields']));_0x420219[_0xf274('0x31')]=_0x420219[_0xf274('0x31')][_0xf274('0x33')]?_0x420219[_0xf274('0x31')]:_0x43b17f[_0xf274('0x2d')];if(_0x2c26fd['query']['includeAll']){_0x420219[_0xf274('0x3f')]=[{'all':!![]}];}_0x420219=_['merge']({},_0x420219,_0x2c26fd[_0xf274('0x3d')]);return db['CmCompany'][_0xf274('0x44')](_0x420219)[_0xf274('0x26')](handleEntityNotFound(_0x1f3416,null))['then'](respondWithResult(_0x1f3416,null))['catch'](handleError(_0x1f3416,null));};exports[_0xf274('0x45')]=function(_0x181594,_0x1904a7){return db['CmCompany']['create'](_0x181594[_0xf274('0x46')],{})[_0xf274('0x26')](function(_0x2b230a){var _0x1616c8=_0x181594['user'][_0xf274('0x28')]({'plain':!![]});if(!_0x1616c8)throw new Error(_0xf274('0x47'));if(_0x1616c8['role']===_0xf274('0x48')){var _0x34e0c8=_0x2b230a[_0xf274('0x28')]({'plain':!![]});var _0x4b68ae=_0xf274('0x29');return db[_0xf274('0x49')][_0xf274('0x44')]({'where':{'name':_0x4b68ae,'userProfileId':_0x1616c8['userProfileId']},'raw':!![]})[_0xf274('0x26')](function(_0x24f4bf){if(_0x24f4bf&&_0x24f4bf[_0xf274('0x4a')]===0x0){return db['UserProfileResource'][_0xf274('0x45')]({'name':_0x34e0c8[_0xf274('0x4b')],'resourceId':_0x34e0c8['id'],'type':_0x24f4bf[_0xf274('0x4b')],'sectionId':_0x24f4bf['id']},{})[_0xf274('0x26')](function(){return _0x2b230a;});}else{return _0x2b230a;}})[_0xf274('0x4c')](function(_0x2711a5){logger['error'](_0xf274('0x4d'),_0x2711a5);throw _0x2711a5;});}return _0x2b230a;})[_0xf274('0x26')](respondWithResult(_0x1904a7,0xc9))[_0xf274('0x4c')](handleError(_0x1904a7,null));};exports[_0xf274('0x25')]=function(_0xad1e2f,_0x31b06a){if(_0xad1e2f[_0xf274('0x46')]['id']){delete _0xad1e2f[_0xf274('0x46')]['id'];}return db[_0xf274('0x2b')][_0xf274('0x44')]({'where':{'id':_0xad1e2f[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x31b06a,null))[_0xf274('0x26')](saveUpdates(_0xad1e2f[_0xf274('0x46')],null))[_0xf274('0x26')](respondWithResult(_0x31b06a,null))[_0xf274('0x4c')](handleError(_0x31b06a,null));};exports['destroy']=function(_0x53a4ae,_0x343ff7){return db[_0xf274('0x2b')][_0xf274('0x44')]({'where':{'id':_0x53a4ae['params']['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x343ff7,null))['then'](removeEntity(_0x343ff7,null))[_0xf274('0x4c')](handleError(_0x343ff7,null));};exports[_0xf274('0x2c')]=function(_0x4f6f8b,_0xd9b1a7){return db[_0xf274('0x2b')]['describe']()[_0xf274('0x26')](respondWithResult(_0xd9b1a7,null))[_0xf274('0x4c')](handleError(_0xd9b1a7,null));};exports[_0xf274('0x4e')]=function(_0x57c003,_0x5bf5ce,_0x4e4cf6){return db[_0xf274('0x4f')][_0xf274('0x44')]({'where':{'id':_0x57c003[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x5bf5ce,null))[_0xf274('0x26')](function(_0x590764){if(_0x590764){return _0x590764[_0xf274('0x4e')](_0x57c003[_0xf274('0x46')]['ids'],_['omit'](_0x57c003[_0xf274('0x46')],[_0xf274('0x50'),'id'])||{});}})[_0xf274('0x26')](respondWithResult(_0x5bf5ce,null))[_0xf274('0x4c')](handleError(_0x5bf5ce,null));};exports['getContacts']=function(_0x45e3a5,_0x2b8626,_0x6ef802){var _0x4fe88f={};var _0x4473e5={};var _0x4a9d1e;var _0x1e86a5;return db[_0xf274('0x2b')][_0xf274('0x51')]({'where':{'id':_0x45e3a5[_0xf274('0x42')]['id']}})[_0xf274('0x26')](handleEntityNotFound(_0x2b8626,null))[_0xf274('0x26')](function(_0x1c423b){if(_0x1c423b){_0x4a9d1e=_0x1c423b;_0x4473e5[_0xf274('0x2d')]=_[_0xf274('0x2e')](db['CmContact'][_0xf274('0x43')]);_0x4473e5[_0xf274('0x2f')]=_[_0xf274('0x2e')](_0x45e3a5['query']);_0x4473e5[_0xf274('0x39')]=_[_0xf274('0x30')](_0x4473e5['model'],_0x4473e5[_0xf274('0x2f')]);_0x4fe88f[_0xf274('0x31')]=_[_0xf274('0x30')](_0x4473e5[_0xf274('0x2d')],qs[_0xf274('0x32')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x32')]));_0x4fe88f[_0xf274('0x31')]=_0x4fe88f[_0xf274('0x31')]['length']?_0x4fe88f[_0xf274('0x31')]:_0x4473e5['model'];_0x4fe88f['order']=qs[_0xf274('0x37')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x37')]);_0x4fe88f[_0xf274('0x38')]=qs[_0xf274('0x39')](_[_0xf274('0x52')](_0x45e3a5[_0xf274('0x2f')],_0x4473e5['filters']));if(_0x45e3a5[_0xf274('0x2f')]['filter']){_0x4fe88f[_0xf274('0x38')]=_[_0xf274('0x3b')](_0x4fe88f['where'],{'$or':_['map'](_0x4fe88f['attributes'],function(_0x25ed71){var _0x4f4a00={};_0x4f4a00[_0x25ed71]={'$like':'%'+_0x45e3a5[_0xf274('0x2f')]['filter']+'%'};return _0x4f4a00;})});}_0x4fe88f=_[_0xf274('0x3b')]({},_0x4fe88f,_0x45e3a5[_0xf274('0x3d')]);return _0x4a9d1e[_0xf274('0x53')](_0x4fe88f);}})[_0xf274('0x26')](function(_0x5976bc){if(_0x5976bc){_0x1e86a5=_0x5976bc[_0xf274('0x33')];if(!_0x45e3a5['query'][_0xf274('0x54')](_0xf274('0x34'))){_0x4fe88f[_0xf274('0x35')]=qs[_0xf274('0x35')](_0x45e3a5[_0xf274('0x2f')]['limit']);_0x4fe88f[_0xf274('0x20')]=qs[_0xf274('0x20')](_0x45e3a5[_0xf274('0x2f')][_0xf274('0x20')]);}return _0x4a9d1e[_0xf274('0x53')](_0x4fe88f);}})[_0xf274('0x26')](function(_0x383f37){if(_0x383f37){return _0x383f37?{'count':_0x1e86a5,'rows':_0x383f37}:null;}})[_0xf274('0x26')](respondWithResult(_0x2b8626,null))[_0xf274('0x4c')](handleError(_0x2b8626,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d34ed6a..a604de5 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 _0xab3f=['../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0xab3f,0x11c));var _0xfab3=function(_0x4537c0,_0x4c1f04){_0x4537c0=_0x4537c0-0x0;var _0x13e9f8=_0xab3f[_0x4537c0];return _0x13e9f8;};'use strict';var _=require(_0xfab3('0x0'));var util=require('util');var logger=require(_0xfab3('0x1'))('api');var moment=require(_0xfab3('0x2'));var BPromise=require(_0xfab3('0x3'));var rp=require(_0xfab3('0x4'));var fs=require('fs');var path=require(_0xfab3('0x5'));var rimraf=require('rimraf');var config=require(_0xfab3('0x6'));var attributes=require(_0xfab3('0x7'));module['exports']=function(_0xf4555a,_0x431c6d){return _0xf4555a['define'](_0xfab3('0x8'),attributes,{'tableName':_0xfab3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c89=['request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','util','api','moment','bluebird'];(function(_0x4d2aea,_0x4a8f11){var _0x1715b8=function(_0x50aadc){while(--_0x50aadc){_0x4d2aea['push'](_0x4d2aea['shift']());}};_0x1715b8(++_0x4a8f11);}(_0x2c89,0x193));var _0x92c8=function(_0x578eb4,_0x657262){_0x578eb4=_0x578eb4-0x0;var _0x49eca8=_0x2c89[_0x578eb4];return _0x49eca8;};'use strict';var _=require('lodash');var util=require(_0x92c8('0x0'));var logger=require('../../config/logger')(_0x92c8('0x1'));var moment=require(_0x92c8('0x2'));var BPromise=require(_0x92c8('0x3'));var rp=require(_0x92c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92c8('0x5'));var config=require(_0x92c8('0x6'));var attributes=require('./cmCompany.attributes');module[_0x92c8('0x7')]=function(_0x5c7cdc,_0x522f04){return _0x5c7cdc[_0x92c8('0x8')](_0x92c8('0x9'),attributes,{'tableName':_0x92c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 59b793f..f4f8bf3 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 _0xadd0=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x551d47,_0x1e545a){var _0x4e5066=function(_0x4b989d){while(--_0x4b989d){_0x551d47['push'](_0x551d47['shift']());}};_0x4e5066(++_0x1e545a);}(_0xadd0,0x178));var _0x0add=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xadd0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0add('0x0'));var util=require(_0x0add('0x1'));var moment=require(_0x0add('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0add('0x3'));var db=require(_0x0add('0x4'))['db'];var utils=require(_0x0add('0x5'));var logger=require(_0x0add('0x6'))(_0x0add('0x7'));var config=require('../../config/environment');var jayson=require(_0x0add('0x8'));var client=jayson[_0x0add('0x9')][_0x0add('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x500f3e,_0x15f724,_0xedbccb){return new BPromise(function(_0x3919b0,_0x152322){return client[_0x0add('0xb')](_0x500f3e,_0xedbccb)['then'](function(_0x4e1f0d){logger[_0x0add('0xc')](_0x0add('0xd'),_0x15f724,'request\x20sent');logger['debug'](_0x0add('0xe'),_0x15f724,_0x0add('0xf'),JSON[_0x0add('0x10')](_0x4e1f0d));if(_0x4e1f0d[_0x0add('0x11')]){if(_0x4e1f0d[_0x0add('0x11')][_0x0add('0x12')]===0x1f4){logger['error'](_0x0add('0xd'),_0x15f724,_0x4e1f0d['error'][_0x0add('0x13')]);return _0x152322(_0x4e1f0d[_0x0add('0x11')][_0x0add('0x13')]);}logger['error'](_0x0add('0xd'),_0x15f724,_0x4e1f0d[_0x0add('0x11')][_0x0add('0x13')]);return _0x3919b0(_0x4e1f0d[_0x0add('0x11')][_0x0add('0x13')]);}else{logger[_0x0add('0xc')]('CmCompany,\x20%s,\x20%s',_0x15f724,_0x0add('0xf'));_0x3919b0(_0x4e1f0d[_0x0add('0x14')][_0x0add('0x13')]);}})['catch'](function(_0x1f57a5){logger['error']('CmCompany,\x20%s,\x20%s',_0x15f724,_0x1f57a5);_0x152322(_0x1f57a5);});});} \ No newline at end of file +var _0xadf6=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xadf6,0xb0));var _0x6adf=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xadf6[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x6adf('0x0'));var util=require(_0x6adf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6adf('0x2'));var fs=require('fs');var Redis=require(_0x6adf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6adf('0x4'));var logger=require(_0x6adf('0x5'))(_0x6adf('0x6'));var config=require(_0x6adf('0x7'));var jayson=require(_0x6adf('0x8'));var client=jayson[_0x6adf('0x9')][_0x6adf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ccce7,_0x4bfb5f,_0x194109){return new BPromise(function(_0x3d61c7,_0x51cc1b){return client[_0x6adf('0xb')](_0x6ccce7,_0x194109)[_0x6adf('0xc')](function(_0x52351c){logger[_0x6adf('0xd')](_0x6adf('0xe'),_0x4bfb5f,_0x6adf('0xf'));logger[_0x6adf('0x10')](_0x6adf('0x11'),_0x4bfb5f,_0x6adf('0xf'),JSON[_0x6adf('0x12')](_0x52351c));if(_0x52351c[_0x6adf('0x13')]){if(_0x52351c[_0x6adf('0x13')][_0x6adf('0x14')]===0x1f4){logger['error'](_0x6adf('0xe'),_0x4bfb5f,_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);return _0x51cc1b(_0x52351c[_0x6adf('0x13')]['message']);}logger[_0x6adf('0x13')]('CmCompany,\x20%s,\x20%s',_0x4bfb5f,_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);return _0x3d61c7(_0x52351c[_0x6adf('0x13')][_0x6adf('0x15')]);}else{logger[_0x6adf('0xd')](_0x6adf('0xe'),_0x4bfb5f,_0x6adf('0xf'));_0x3d61c7(_0x52351c[_0x6adf('0x16')][_0x6adf('0x15')]);}})[_0x6adf('0x17')](function(_0x425dcb){logger['error'](_0x6adf('0xe'),_0x4bfb5f,_0x425dcb);_0x51cc1b(_0x425dcb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8316f94..5d75bb0 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 _0xbc06=['describe','/:id','show','/:id/contacts','create','addContacts','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xbc06,0x16d));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6bc0('0x0'));var path=require(_0x6bc0('0x1'));var timeout=require(_0x6bc0('0x2'));var express=require(_0x6bc0('0x3'));var router=express[_0x6bc0('0x4')]();var fs_extra=require(_0x6bc0('0x5'));var auth=require(_0x6bc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6bc0('0x7'));var controller=require(_0x6bc0('0x8'));router[_0x6bc0('0x9')]('/',auth[_0x6bc0('0xa')](),controller[_0x6bc0('0xb')]);router[_0x6bc0('0x9')](_0x6bc0('0xc'),auth[_0x6bc0('0xa')](),controller[_0x6bc0('0xd')]);router[_0x6bc0('0x9')](_0x6bc0('0xe'),auth[_0x6bc0('0xa')](),controller[_0x6bc0('0xf')]);router[_0x6bc0('0x9')](_0x6bc0('0x10'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0x6bc0('0xa')](),controller[_0x6bc0('0x11')]);router['post'](_0x6bc0('0x10'),auth[_0x6bc0('0xa')](),controller[_0x6bc0('0x12')]);router['put'](_0x6bc0('0xe'),auth[_0x6bc0('0xa')](),controller['update']);router[_0x6bc0('0x13')](_0x6bc0('0xe'),auth[_0x6bc0('0xa')](),controller[_0x6bc0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa5ff=['put','/:id','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','getContacts','post','create','/:id/contacts','addContacts'];(function(_0x5ef3cf,_0x334435){var _0x126707=function(_0x363908){while(--_0x363908){_0x5ef3cf['push'](_0x5ef3cf['shift']());}};_0x126707(++_0x334435);}(_0xa5ff,0xa4));var _0xfa5f=function(_0x1fa463,_0x460713){_0x1fa463=_0x1fa463-0x0;var _0x1ec77b=_0xa5ff[_0x1fa463];return _0x1ec77b;};'use strict';var multer=require(_0xfa5f('0x0'));var util=require(_0xfa5f('0x1'));var path=require(_0xfa5f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa5f('0x3')]();var fs_extra=require(_0xfa5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfa5f('0x5'));var config=require(_0xfa5f('0x6'));var controller=require('./cmCompany.controller');router[_0xfa5f('0x7')]('/',auth['isAuthenticated'](),controller[_0xfa5f('0x8')]);router[_0xfa5f('0x7')]('/describe',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xa')]);router[_0xfa5f('0x7')]('/:id',auth[_0xfa5f('0x9')](),controller['show']);router[_0xfa5f('0x7')]('/:id/contacts',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xb')]);router[_0xfa5f('0xc')]('/',auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xd')]);router[_0xfa5f('0xc')](_0xfa5f('0xe'),auth[_0xfa5f('0x9')](),controller[_0xfa5f('0xf')]);router[_0xfa5f('0x10')](_0xfa5f('0x11'),auth[_0xfa5f('0x9')](),controller['update']);router[_0xfa5f('0x12')](_0xfa5f('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa5f('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9c10637..b6423ec 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 _0xdadd=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x458012,_0x4049a3){var _0x2ed3e4=function(_0x3cbbb7){while(--_0x3cbbb7){_0x458012['push'](_0x458012['shift']());}};_0x2ed3e4(++_0x4049a3);}(_0xdadd,0xc2));var _0xddad=function(_0x4618da,_0x27c024){_0x4618da=_0x4618da-0x0;var _0xede04a=_0xdadd[_0x4618da];return _0xede04a;};'use strict';var _=require(_0xddad('0x0'));var Sequelize=require(_0xddad('0x1'));module[_0xddad('0x2')]={'firstName':{'type':Sequelize[_0xddad('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xddad('0x3')]},'street':{'type':Sequelize[_0xddad('0x3')]},'postalCode':{'type':Sequelize[_0xddad('0x3')]},'city':{'type':Sequelize[_0xddad('0x3')]},'country':{'type':Sequelize[_0xddad('0x3')]},'dateOfBirth':{'type':Sequelize[_0xddad('0x3')]},'description':{'type':Sequelize[_0xddad('0x4')]},'phone':{'type':Sequelize[_0xddad('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xddad('0x3')]},'email':{'type':Sequelize[_0xddad('0x3')]},'url':{'type':Sequelize[_0xddad('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xddad('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xddad('0x3')]},'teams':{'type':Sequelize[_0xddad('0x3')]},'viber':{'type':Sequelize[_0xddad('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xddad('0x3')]},'telegram':{'type':Sequelize[_0xddad('0x3')]},'UserId':{'type':Sequelize[_0xddad('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xddad('0x3')]},'priority':{'type':Sequelize[_0xddad('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xddad('0x6')],'defaultValue':Sequelize[_0xddad('0x7')]},'dialTimezone':{'type':Sequelize[_0xddad('0x3')]},'utcOffset':{'type':Sequelize[_0xddad('0x5')]}}; \ No newline at end of file +var _0x6d26=['DATE','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x2dda1a,_0x1d9ba8){var _0x33dacb=function(_0x333139){while(--_0x333139){_0x2dda1a['push'](_0x2dda1a['shift']());}};_0x33dacb(++_0x1d9ba8);}(_0x6d26,0xa3));var _0x66d2=function(_0x3db4d2,_0x4a7632){_0x3db4d2=_0x3db4d2-0x0;var _0x53dbbb=_0x6d26[_0x3db4d2];return _0x53dbbb;};'use strict';var _=require(_0x66d2('0x0'));var Sequelize=require(_0x66d2('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x66d2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x66d2('0x2')]},'street':{'type':Sequelize[_0x66d2('0x2')]},'postalCode':{'type':Sequelize[_0x66d2('0x2')]},'city':{'type':Sequelize[_0x66d2('0x2')]},'country':{'type':Sequelize[_0x66d2('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66d2('0x3')]},'phone':{'type':Sequelize[_0x66d2('0x2')]},'mobile':{'type':Sequelize[_0x66d2('0x2')]},'fax':{'type':Sequelize[_0x66d2('0x2')]},'email':{'type':Sequelize[_0x66d2('0x2')]},'url':{'type':Sequelize[_0x66d2('0x2')]},'facebook':{'type':Sequelize[_0x66d2('0x2')]},'fb_data':{'type':Sequelize[_0x66d2('0x2')]},'twitter':{'type':Sequelize[_0x66d2('0x2')]},'skype':{'type':Sequelize[_0x66d2('0x2')]},'teams':{'type':Sequelize[_0x66d2('0x2')]},'viber':{'type':Sequelize[_0x66d2('0x2')]},'line':{'type':Sequelize[_0x66d2('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x66d2('0x2')]},'UserId':{'type':Sequelize[_0x66d2('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x66d2('0x2')]},'priority':{'type':Sequelize[_0x66d2('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x66d2('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x66d2('0x2')]},'utcOffset':{'type':Sequelize[_0x66d2('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 56a60c8..d566c24 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 _0x55ad=['isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','ListId','findOrCreate','contact','all','show','Tag','Tags','color','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','where','$and','map','format','omit','pickBy','cf_%d','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','sort','pick','filter','nolimit','limit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','order','ContactId','options','include','rows','getHopperHistories','includeAll','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','createReadStream','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','start\x20child\x20process\x20correctly!','getJourney','sms','openchannel','fax','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','DESC','browserName','customerPort','osName','ratingMessage','ratingValue','subject','substatus','externalUrl','Interaction','Owner','sortBy','reverse','value','slice','bluebird','util','path','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','count','set','Content-Range','json','then','destroy','end','error','stack','name','describe','getOptions','findAll','query','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x55ad,0x1cd));var _0xd55a=function(_0x554096,_0x397ac1){_0x554096=_0x554096-0x0;var _0xcd02bb=_0x55ad[_0x554096];return _0xcd02bb;};'use strict';var moment=require('moment');var BPromise=require(_0xd55a('0x0'));var util=require(_0xd55a('0x1'));var path=require(_0xd55a('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd55a('0x3'));var Papa=require(_0xd55a('0x4'));var Redis=require(_0xd55a('0x5'));var contacts=require('../../components/contacts');var qs=require(_0xd55a('0x6'));var logger=require(_0xd55a('0x7'))(_0xd55a('0x8'));var config=require(_0xd55a('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0xd55a('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd55a('0xb'))(new Redis(config['redis']));require(_0xd55a('0xc'))[_0xd55a('0xd')](socket);function respondWithResult(_0xd0f68c,_0x41bcd4){_0x41bcd4=_0x41bcd4||0xc8;return function(_0x22152d){if(_0x22152d){return _0xd0f68c[_0xd55a('0xe')](_0x41bcd4)['json'](_0x22152d);}};}function respondWithFilteredResult(_0x14d53c,_0x5997a9){return function(_0x226521){if(_0x226521){var _0x27d8da=typeof _0x5997a9[_0xd55a('0xf')]===_0xd55a('0x10')&&typeof _0x5997a9['limit']===_0xd55a('0x10');var _0x1d5c32=_0x226521[_0xd55a('0x11')];var _0x315a16=_0x27d8da?0x0:_0x5997a9[_0xd55a('0xf')];var _0x102cec=_0x27d8da?_0x226521[_0xd55a('0x11')]:_0x5997a9[_0xd55a('0xf')]+_0x5997a9['limit'];var _0x3b0800;if(_0x102cec>=_0x1d5c32){_0x102cec=_0x1d5c32;_0x3b0800=0xc8;}else{_0x3b0800=0xce;}_0x14d53c[_0xd55a('0xe')](_0x3b0800);return _0x14d53c[_0xd55a('0x12')](_0xd55a('0x13'),_0x315a16+'-'+_0x102cec+'/'+_0x1d5c32)[_0xd55a('0x14')](_0x226521);}return null;};}function saveUpdates(_0x23474c){return function(_0x5a27a6){if(_0x5a27a6){return _0x5a27a6['update'](_0x23474c)[_0xd55a('0x15')](function(_0x1e68af){return _0x1e68af;});}return null;};}function removeEntity(_0x446c6c){return function(_0x219a98){if(_0x219a98){return _0x219a98[_0xd55a('0x16')]()[_0xd55a('0x15')](function(){_0x446c6c[_0xd55a('0xe')](0xcc)[_0xd55a('0x17')]();});}};}function handleEntityNotFound(_0x50206c){return function(_0x395b95){if(!_0x395b95){_0x50206c['sendStatus'](0x194);}return _0x395b95;};}function handleError(_0x892b10,_0x179817){_0x179817=_0x179817||0x1f4;return function(_0x21759d){logger[_0xd55a('0x18')](_0x21759d[_0xd55a('0x19')]);if(_0x21759d['name']){delete _0x21759d[_0xd55a('0x1a')];}_0x892b10[_0xd55a('0xe')](_0x179817)['send'](_0x21759d);};}exports['index']=function(_0x2d6850,_0x467e21){var _0x4fe87b={};return contacts[_0xd55a('0x1b')]()[_0xd55a('0x15')](function(_0x5599b8){_0x4fe87b=qs[_0xd55a('0x1c')](_0x5599b8,_0x2d6850);return contacts[_0xd55a('0x1d')](_0x2d6850[_0xd55a('0x1e')],_0x2d6850['user'],_0x4fe87b,_0x5599b8);})[_0xd55a('0x15')](respondWithFilteredResult(_0x467e21,_0x4fe87b))[_0xd55a('0x1f')](handleError(_0x467e21,null));};exports[_0xd55a('0x16')]=function(_0x2d0cab,_0x4ce29b){return db[_0xd55a('0x20')][_0xd55a('0x21')]({'where':{'id':_0x2d0cab[_0xd55a('0x22')]['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x4ce29b,null))[_0xd55a('0x15')](removeEntity(_0x4ce29b,null))[_0xd55a('0x1f')](handleError(_0x4ce29b,null));};exports[_0xd55a('0x1b')]=function(_0x5f1bcf,_0x499c49){return db[_0xd55a('0x20')]['describe']()[_0xd55a('0x15')](function(_0x591842){delete _0x591842[_0xd55a('0x23')];for(var _0xf7df9a=0x0;_0xf7df9a0x0){return new Promise(function(_0x20a3ed){var _0x38c6a0=[];for(var _0x19320f=0x0;_0x19320f<_0x721e3c[_0xd55a('0x25')];_0x19320f++){_0x38c6a0[_0xd55a('0x5b')](insertAdditionalPhones(_0x721e3c[_0x19320f][_0xd55a('0x5e')],_0x721e3c[_0x19320f][_0xd55a('0x56')]));}Promise[_0xd55a('0x5f')](_0x38c6a0)['then'](function(){_0x20a3ed(0x1);});})[_0xd55a('0x15')](function(){return{'success':_0x215afc,'failure':_0x1435a6,'duplicates':_0x29c1a7};});}else{return{'success':_0x215afc,'failure':_0x1435a6,'duplicates':_0x29c1a7};}}})[_0xd55a('0x15')](respondWithResult(_0xe0aafc,0xc9))['catch'](handleError(_0xe0aafc,null));};exports[_0xd55a('0x60')]=function(_0x20827a,_0x32528d){var _0x454fb8;return db[_0xd55a('0x20')][_0xd55a('0x1b')]()[_0xd55a('0x15')](function(_0x223259){return db['CmContact'][_0xd55a('0x21')]({'where':{'id':_0x20827a[_0xd55a('0x22')]['id']},'include':[{'model':db[_0xd55a('0x61')],'as':_0xd55a('0x62'),'attributes':['id','name',_0xd55a('0x63')],'required':_0x20827a[_0xd55a('0x1e')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xd55a('0x64'),'where':{'CmContactId':_0x20827a[_0xd55a('0x22')]['id']},'required':![],'include':[{'model':db[_0xd55a('0x65')],'as':'ItemType'}]}],'order':[db[_0xd55a('0x66')][_0xd55a('0x67')](_0xd55a('0x68'))],'attributes':_['keys'](_0x223259)});})['then'](function(_0x46dd75){if(!_['isNil'](_0x46dd75)){_0x454fb8=_0x46dd75['get']({'plain':!![]});var _0x713f38={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x46dd75&&_0x46dd75['ListId']){if(_0x46dd75[_0xd55a('0x5c')]){_0x713f38[_0xd55a('0x69')][_0xd55a('0x6a')]['push']({'ListId':{'$ne':_0x46dd75[_0xd55a('0x5c')]}});}}return db[_0xd55a('0x2a')][_0xd55a('0x1d')](_0x713f38);}})[_0xd55a('0x15')](function(_0x4b4e5f){if(!_[_0xd55a('0x52')](_0x4b4e5f)){return _['omit'](_0x454fb8,_[_0xd55a('0x6b')](_0x4b4e5f,function(_0x205ad5){return util[_0xd55a('0x6c')]('cf_%d',_0x205ad5['id']);}));}})[_0xd55a('0x15')](handleEntityNotFound(_0x32528d,null))[_0xd55a('0x15')](respondWithResult(_0x32528d,null))[_0xd55a('0x1f')](handleError(_0x32528d,null));};exports[_0xd55a('0x3c')]=function(_0x52b50b,_0x1ee929){var _0x285def;if(_0x52b50b['body']['id']){delete _0x52b50b['body']['id'];}if(!_[_0xd55a('0x52')](_0x52b50b['body']['dialTimezone'])){var _0x3edc88=_0x52b50b[_0xd55a('0x32')][_0xd55a('0x53')];if(!_[_0xd55a('0x52')](shared[_0xd55a('0x54')][_0x3edc88]))_0x52b50b[_0xd55a('0x32')][_0xd55a('0x55')]=shared[_0xd55a('0x54')][_0x3edc88][_0xd55a('0x55')];}return db[_0xd55a('0x20')][_0xd55a('0x21')]({'where':{'id':_0x52b50b['params']['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x1ee929,null))['then'](saveUpdates(_0x52b50b[_0xd55a('0x32')],null))['then'](function(_0x51e00b){_0x285def=_0x51e00b;var _0x59b00f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x51e00b&&_0x51e00b[_0xd55a('0x5c')]){if(_0x51e00b[_0xd55a('0x5c')]){_0x59b00f[_0xd55a('0x69')][_0xd55a('0x6a')][_0xd55a('0x5b')]({'ListId':{'$ne':_0x51e00b['ListId']}});}}return db[_0xd55a('0x2a')]['findAll'](_0x59b00f);})[_0xd55a('0x15')](function(_0x58be17){if(_0x58be17){return _[_0xd55a('0x6d')](_[_0xd55a('0x6e')](_0x52b50b[_0xd55a('0x32')],function(_0x16bcd7,_0x27eaf4){return _['startsWith'](_0x27eaf4,_0xd55a('0x27'));}),_[_0xd55a('0x6b')](_0x58be17,function(_0x4c2362){return util[_0xd55a('0x6c')](_0xd55a('0x6f'),_0x4c2362['id']);}));}})[_0xd55a('0x15')](function(_0x52cf6c){if(_0x52cf6c&&!_[_0xd55a('0x70')](_0x52cf6c)){var _0x2ac24f=squel[_0xd55a('0x3c')]()[_0xd55a('0x71')](_0xd55a('0x72'))[_0xd55a('0x73')](_0x52cf6c)[_0xd55a('0x69')](_0xd55a('0x74'),_0x52b50b[_0xd55a('0x22')]['id'])[_0xd55a('0x75')]();return db[_0xd55a('0x66')][_0xd55a('0x1e')](_0x2ac24f[_0xd55a('0x76')],{'replacements':_0x2ac24f[_0xd55a('0x77')]});}})['then'](function(){if(_0x52b50b['body'][_0xd55a('0x78')]&&_0x285def){return db[_0xd55a('0x38')][_0xd55a('0x3c')]({'phone':_0x52b50b[_0xd55a('0x32')][_0xd55a('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x285def['id']}});}})[_0xd55a('0x15')](function(){return _0x285def;})[_0xd55a('0x15')](respondWithResult(_0x1ee929,null))['catch'](handleError(_0x1ee929,null));};exports[_0xd55a('0x79')]=function(_0x57ebeb,_0x254137){var _0x14f0ab={};var _0x136fa8={};var _0xc36cae;var _0x4d7c5d;return db[_0xd55a('0x20')][_0xd55a('0x7a')]({'where':{'id':_0x57ebeb['params']['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x254137,null))[_0xd55a('0x15')](function(_0x5e04b6){if(_0x5e04b6){_0xc36cae=_0x5e04b6;_0x136fa8[_0xd55a('0x7b')]=_[_0xd55a('0x24')](db['Tag'][_0xd55a('0x7c')]);_0x136fa8[_0xd55a('0x1e')]=_[_0xd55a('0x24')](_0x57ebeb[_0xd55a('0x1e')]);_0x136fa8[_0xd55a('0x7d')]=_[_0xd55a('0x7e')](_0x136fa8[_0xd55a('0x7b')],_0x136fa8[_0xd55a('0x1e')]);_0x14f0ab[_0xd55a('0x7f')]=_['intersection'](_0x136fa8[_0xd55a('0x7b')],qs[_0xd55a('0x80')](_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0x80')]));_0x14f0ab[_0xd55a('0x7f')]=_0x14f0ab[_0xd55a('0x7f')][_0xd55a('0x25')]?_0x14f0ab[_0xd55a('0x7f')]:_0x136fa8[_0xd55a('0x7b')];_0x14f0ab['order']=qs[_0xd55a('0x81')](_0x57ebeb['query']['sort']);_0x14f0ab[_0xd55a('0x69')]=qs[_0xd55a('0x7d')](_[_0xd55a('0x82')](_0x57ebeb[_0xd55a('0x1e')],_0x136fa8[_0xd55a('0x7d')]));if(_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0x83')]){_0x14f0ab[_0xd55a('0x69')]=_[_0xd55a('0x31')](_0x14f0ab['where'],{'$or':_[_0xd55a('0x6b')](_0x14f0ab['attributes'],function(_0x180e09){var _0x3ba1b6={};_0x3ba1b6[_0x180e09]={'$like':'%'+_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0x83')]+'%'};return _0x3ba1b6;})});}_0x14f0ab=_[_0xd55a('0x31')]({},_0x14f0ab,_0x57ebeb['options']);return _0xc36cae[_0xd55a('0x79')](_0x14f0ab);}})[_0xd55a('0x15')](function(_0x2e5c98){if(_0x2e5c98){_0x4d7c5d=_0x2e5c98[_0xd55a('0x25')];if(!_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0x30')](_0xd55a('0x84'))){_0x14f0ab[_0xd55a('0x85')]=qs[_0xd55a('0x85')](_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0x85')]);_0x14f0ab['offset']=qs[_0xd55a('0xf')](_0x57ebeb[_0xd55a('0x1e')][_0xd55a('0xf')]);}return _0xc36cae['getTags'](_0x14f0ab);}})[_0xd55a('0x15')](function(_0x30e3df){if(_0x30e3df){return _0x30e3df?{'count':_0x4d7c5d,'rows':_0x30e3df}:null;}})[_0xd55a('0x15')](respondWithResult(_0x254137,null))[_0xd55a('0x1f')](handleError(_0x254137,null));};exports['setTags']=function(_0x48a268,_0x2b0702){if(_0x48a268['body']['id']){delete _0x48a268[_0xd55a('0x32')]['id'];}return db[_0xd55a('0x20')][_0xd55a('0x7a')]({'where':{'id':_0x48a268[_0xd55a('0x22')]['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x2b0702,null))[_0xd55a('0x15')](function(_0x12e208){if(_0x12e208){return _0x12e208[_0xd55a('0x86')](_0x48a268['body'][_0xd55a('0x87')]||[]);}return null;})[_0xd55a('0x15')](respondWithResult(_0x2b0702,null))[_0xd55a('0x1f')](handleError(_0x2b0702,null));};exports[_0xd55a('0x88')]=function(_0x15fdde,_0x1e5cb0){var _0x39d4d8=[];_0x39d4d8[_0xd55a('0x5b')](addAdditionalPhones(_0x15fdde[_0xd55a('0x32')]));Promise[_0xd55a('0x5f')](_0x39d4d8)[_0xd55a('0x15')](function(){_0x39d4d8=[];_0x39d4d8['push'](deleteCmHopperPhones(_0x15fdde[_0xd55a('0x32')]['id']));_0x39d4d8['push'](addCmHopperPhones(_0x15fdde['body']['id']));Promise[_0xd55a('0x5f')](_0x39d4d8)[_0xd55a('0x15')](function(){return[0x1];})[_0xd55a('0x15')](respondWithResult(_0x1e5cb0,null));});};function addAdditionalPhones(_0xa4c970){var _0x5e5b40;return new Promise(function(_0x8055f2){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0xa4c970['id']}})[_0xd55a('0x15')](function(){db[_0xd55a('0x65')][_0xd55a('0x1d')]({'raw':!![],'attributes':['id',_0xd55a('0x89')]})[_0xd55a('0x15')](function(_0x97ea76){var _0x4bacbf=[];for(var _0x5b9996=0x0;_0x5b9996<_0xa4c970[_0xd55a('0x8a')][_0xd55a('0x25')];_0x5b9996++){var _0x310156=_0xa4c970[_0xd55a('0x8b')]?_[_0xd55a('0x52')](_0xa4c970[_0xd55a('0x8b')][_0x5b9996])?'':_0xa4c970[_0xd55a('0x8b')][_0x5b9996]:_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x8c')]?_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x8c')]:'';var _0x512128=_['isNil'](_0xa4c970['items'][_0x5b9996]['description'])?'':_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x8d')];var _0x47e4f9=_0x310156+':'+_0xa4c970['items'][_0x5b9996]['phone']+'§'+_0x512128;if(_[_0xd55a('0x52')](_0x5e5b40))_0x5e5b40=_0x47e4f9;else _0x5e5b40+=';'+_0x47e4f9;var _0x1546c2=null;var _0xd8f662=null;if(_0xa4c970['item_types']){if(!_[_0xd55a('0x52')](_0xa4c970[_0xd55a('0x8b')][_0x5b9996])){_0xd8f662=_['find'](_0x97ea76,function(_0x583bb3){return _0x583bb3['id']===_0xa4c970[_0xd55a('0x8b')][_0x5b9996];});if(!_[_0xd55a('0x52')](_0xd8f662)){_0x1546c2=_0xd8f662['OrderBy'];}}}else{if(!_[_0xd55a('0x52')](_0xa4c970[_0xd55a('0x8a')][_0x5b9996])){_0xd8f662=_[_0xd55a('0x21')](_0x97ea76,function(_0x10b093){return _0x10b093['id']===_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x8c')];});if(!_[_0xd55a('0x52')](_0xd8f662)){_0x1546c2=_0x5b9996;}}}if(_[_0xd55a('0x52')](_0x1546c2)){_0x1546c2=0x64;}_0x4bacbf[_0xd55a('0x5b')](addAdditionalPhone(_0xa4c970['id'],_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x78')],_0xa4c970['item_types']?_[_0xd55a('0x52')](_0xa4c970['item_types'][_0x5b9996])?null:_0xa4c970[_0xd55a('0x8b')][_0x5b9996]:_0xa4c970[_0xd55a('0x8a')][_0x5b9996]['ItemTypeId']?_0xa4c970[_0xd55a('0x8a')][_0x5b9996][_0xd55a('0x8c')]:null,_0x1546c2,_0x512128));}Promise[_0xd55a('0x5f')](_0x4bacbf)['then'](function(){db[_0xd55a('0x20')][_0xd55a('0x3c')]({'AdditionalPhones':_0x5e5b40},{'where':{'id':_0xa4c970['id']}})[_0xd55a('0x15')](function(){_0x8055f2(0x1);});});});});});}function addAdditionalPhone(_0x5ec5d7,_0x74c18c,_0x29d3e2,_0x35a530,_0x23d94e){return db[_0xd55a('0x46')][_0xd55a('0x21')]({'where':{'CmContactId':_0x5ec5d7,'item':_0x74c18c}})['then'](function(_0x33368f){if(_0x33368f)logger[_0xd55a('0x2d')](_0xd55a('0x8e'),_0x33368f);else{db[_0xd55a('0x46')]['create']({'CmContactId':_0x5ec5d7,'item':_0x74c18c,'ItemTypeId':_0x29d3e2,'OrderBy':_0x35a530,'ItemClass':'PHONE','description':_0x23d94e});}});}function deleteCmHopperPhones(_0x1dcf35){return new Promise(function(_0x5438ef){return db[_0xd55a('0x38')][_0xd55a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1dcf35}})['then'](function(_0x416718){db[_0xd55a('0x8f')][_0xd55a('0x16')]({'where':{'CmHopperId':{'$in':_['map'](_0x416718,'id')}}});})[_0xd55a('0x15')](function(){_0x5438ef(0x1);});});}function addCmHopperPhones(_0xfc61bc){return new Promise(function(_0x4a284e){return db['CmHopper'][_0xd55a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xfc61bc}})['then'](function(_0x406bff){var _0x328f6b=[];_[_0xd55a('0x6b')](_0x406bff,function(_0x1b4cd1){_0x328f6b[_0xd55a('0x5b')](createCmHopperPhone(_0xfc61bc,_0x1b4cd1['id']));});Promise[_0xd55a('0x5f')](_0x328f6b)[_0xd55a('0x15')](function(){_0x4a284e(0x1);});});});}function createCmHopperPhone(_0x535443,_0x2b9a3b){return new Promise(function(_0x45184c){db[_0xd55a('0x46')][_0xd55a('0x1d')]({'raw':!![],'attributes':[_0xd55a('0x90'),_0xd55a('0x89')],'where':{'CmContactId':_0x535443,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0xd55a('0x89')],'as':_0xd55a('0x91')}],'order':[_0xd55a('0x89'),db[_0xd55a('0x66')][_0xd55a('0x67')](_0xd55a('0x92'))]})[_0xd55a('0x15')](function(_0xb7127){var _0x5e0414=0x1;var _0x2d724c=_[_0xd55a('0x6b')](_0xb7127,function(_0x64ae59){_0x64ae59[_0xd55a('0x93')]=_0x2b9a3b;_0x64ae59[_0xd55a('0x78')]=_0x64ae59[_0xd55a('0x90')];_0x64ae59['OrderBy']=_0x5e0414;delete _0x64ae59[_0xd55a('0x94')];_0x5e0414=_0x5e0414+0x1;return _0x64ae59;});return db[_0xd55a('0x8f')][_0xd55a('0x57')](_0x2d724c,{});})[_0xd55a('0x15')](function(){_0x45184c(0x1);});});}function insertAdditionalPhones(_0x516d99,_0x70cab4){return new Promise(function(_0x406463){var _0x26bf20=[];for(var _0x3ae102=0x0;_0x3ae102<_0x70cab4[_0xd55a('0x25')];_0x3ae102++){var _0x5a2f70=_0x70cab4[_0x3ae102];_0x26bf20[_0xd55a('0x5b')](parseContactItemType(_0x5a2f70));}Promise[_0xd55a('0x5f')](_0x26bf20)[_0xd55a('0x15')](function(){var _0x1cb008={'id':_0x516d99['id'],'items':_0x70cab4};return addAdditionalPhones(_0x1cb008)[_0xd55a('0x15')](function(){return addCmHopperPhones(_0x516d99['id']);});})[_0xd55a('0x15')](function(){_0x406463(_0x516d99);});});}function parseContactItemType(_0x2becbd){return new Promise(function(_0x5cee92){if(_0x2becbd['hasOwnProperty']('ItemTypeId')){_0x5cee92(_0x2becbd);}else{return db[_0xd55a('0x65')]['find']({'where':{'name':_0x2becbd[_0xd55a('0x91')]}})[_0xd55a('0x15')](function(_0x1383da){if(_[_0xd55a('0x52')](_0x1383da))_0x2becbd[_0xd55a('0x8c')]=null;else _0x2becbd[_0xd55a('0x8c')]=_0x1383da['id'];_0x5cee92(_0x2becbd);});}});}exports[_0xd55a('0x95')]=function(_0xf7f574,_0x588fc3){return db[_0xd55a('0x46')][_0xd55a('0x1d')]({'raw':!![],'where':{'CmContactId':_0xf7f574[_0xd55a('0x22')]['id'],'ItemClass':_0xd55a('0x96')},'include':[{'model':db[_0xd55a('0x65')],'as':_0xd55a('0x91')}],'order':[['OrderBy'],[db[_0xd55a('0x66')][_0xd55a('0x67')]('`ItemType`.OrderBy')]]})['then'](function(_0x21fc12){return _0x21fc12;})[_0xd55a('0x15')](respondWithResult(_0x588fc3,null))[_0xd55a('0x1f')](handleError(_0x588fc3,null));};exports[_0xd55a('0x97')]=function(_0x3374f3,_0x343e02){return db[_0xd55a('0x46')][_0xd55a('0x1d')]({'raw':!![],'where':{'CmContactId':_0x3374f3[_0xd55a('0x32')][_0xd55a('0x98')]}})['then'](function(_0x381987){var _0x200735=_['map'](_0x381987,function(_0xb7866a){_0xb7866a[_0xd55a('0x99')]=_0x3374f3[_0xd55a('0x32')][_0xd55a('0x9a')];return _0xb7866a;});return db['CmContactHasItem'][_0xd55a('0x57')](_0x200735,{});})[_0xd55a('0x15')](function(){return addCmHopperPhones(_0x3374f3[_0xd55a('0x32')][_0xd55a('0x9a')]);})[_0xd55a('0x15')](function(){return['ok'];})['then'](respondWithResult(_0x343e02,null))[_0xd55a('0x1f')](handleError(_0x343e02,null));};exports[_0xd55a('0x9b')]=function(_0x266aa7,_0xacb9e4){var _0x57d41b=[];_0x57d41b[_0xd55a('0x5b')](createCmHopperPhone(_0x266aa7[_0xd55a('0x32')]['id'],_0x266aa7[_0xd55a('0x32')]['hopperId']));Promise[_0xd55a('0x5f')](_0x57d41b)[_0xd55a('0x15')](function(){return[0x1];})[_0xd55a('0x15')](respondWithResult(_0xacb9e4,null));};exports['getHoppers']=function(_0x226c30,_0x257bca){var _0x319be2={'raw':![],'where':{}};var _0x3fb3e3={};var _0x25f695={'count':0x0,'rows':[]};return db[_0xd55a('0x20')][_0xd55a('0x7a')]({'where':{'id':_0x226c30[_0xd55a('0x22')]['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x257bca,null))[_0xd55a('0x15')](function(_0x15288f){if(_0x15288f){_0x3fb3e3[_0xd55a('0x7b')]=_[_0xd55a('0x24')](db[_0xd55a('0x38')][_0xd55a('0x7c')]);_0x3fb3e3[_0xd55a('0x1e')]=_[_0xd55a('0x24')](_0x226c30['query']);_0x3fb3e3[_0xd55a('0x7d')]=_['intersection'](_0x3fb3e3[_0xd55a('0x7b')],_0x3fb3e3[_0xd55a('0x1e')]);_0x319be2[_0xd55a('0x7f')]=_[_0xd55a('0x7e')](_0x3fb3e3['model'],qs['fields'](_0x226c30['query'][_0xd55a('0x80')]));_0x319be2[_0xd55a('0x7f')]=_0x319be2[_0xd55a('0x7f')][_0xd55a('0x25')]?_0x319be2[_0xd55a('0x7f')]:_0x3fb3e3[_0xd55a('0x7b')];if(!_0x226c30['query'][_0xd55a('0x30')]('nolimit')){_0x319be2['limit']=qs[_0xd55a('0x85')](_0x226c30['query'][_0xd55a('0x85')]);_0x319be2['offset']=qs[_0xd55a('0xf')](_0x226c30[_0xd55a('0x1e')]['offset']);}_0x319be2[_0xd55a('0x9c')]=qs['sort'](_0x226c30[_0xd55a('0x1e')]['sort']);_0x319be2[_0xd55a('0x69')]=qs[_0xd55a('0x7d')](_[_0xd55a('0x82')](_0x226c30['query'],_0x3fb3e3[_0xd55a('0x7d')]));_0x319be2[_0xd55a('0x69')][_0xd55a('0x9d')]=_0x15288f['id'];if(_0x226c30[_0xd55a('0x1e')][_0xd55a('0x83')]){_0x319be2[_0xd55a('0x69')]=_['merge'](_0x319be2['where'],{'$or':_[_0xd55a('0x6b')](_0x319be2['attributes'],function(_0x133226){var _0x4cc1b5={};_0x4cc1b5[_0x133226]={'$like':'%'+_0x226c30[_0xd55a('0x1e')][_0xd55a('0x83')]+'%'};return _0x4cc1b5;})});}_0x319be2=_[_0xd55a('0x31')]({},_0x319be2,_0x226c30[_0xd55a('0x9e')]);return db[_0xd55a('0x38')][_0xd55a('0x11')]({'where':_0x319be2['where']})['then'](function(_0x170b7b){_0x25f695['count']=_0x170b7b;if(_0x226c30[_0xd55a('0x1e')]['includeAll']){_0x319be2[_0xd55a('0x9f')]=[{'all':!![]}];}return db[_0xd55a('0x38')][_0xd55a('0x1d')](_0x319be2);})[_0xd55a('0x15')](function(_0x22d210){_0x25f695[_0xd55a('0xa0')]=_0x22d210;return _0x25f695;});}})[_0xd55a('0x15')](respondWithFilteredResult(_0x257bca,_0x319be2))[_0xd55a('0x1f')](handleError(_0x257bca,null));};exports[_0xd55a('0xa1')]=function(_0x465b14,_0x42c084){var _0x15a057={'raw':!![],'where':{}};var _0x509e6a={};var _0x173e33={'count':0x0,'rows':[]};return db[_0xd55a('0x20')]['findOne']({'where':{'id':_0x465b14['params']['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x42c084,null))[_0xd55a('0x15')](function(_0x5e7d00){if(_0x5e7d00){_0x509e6a[_0xd55a('0x7b')]=_[_0xd55a('0x24')](db['CmHopperHistory'][_0xd55a('0x7c')]);_0x509e6a[_0xd55a('0x1e')]=_[_0xd55a('0x24')](_0x465b14[_0xd55a('0x1e')]);_0x509e6a[_0xd55a('0x7d')]=_[_0xd55a('0x7e')](_0x509e6a[_0xd55a('0x7b')],_0x509e6a[_0xd55a('0x1e')]);_0x15a057[_0xd55a('0x7f')]=_['intersection'](_0x509e6a[_0xd55a('0x7b')],qs[_0xd55a('0x80')](_0x465b14[_0xd55a('0x1e')][_0xd55a('0x80')]));_0x15a057[_0xd55a('0x7f')]=_0x15a057[_0xd55a('0x7f')][_0xd55a('0x25')]?_0x15a057[_0xd55a('0x7f')]:_0x509e6a[_0xd55a('0x7b')];if(!_0x465b14['query'][_0xd55a('0x30')](_0xd55a('0x84'))){_0x15a057[_0xd55a('0x85')]=qs[_0xd55a('0x85')](_0x465b14['query'][_0xd55a('0x85')]);_0x15a057['offset']=qs[_0xd55a('0xf')](_0x465b14[_0xd55a('0x1e')][_0xd55a('0xf')]);}_0x15a057['order']=qs[_0xd55a('0x81')](_0x465b14[_0xd55a('0x1e')][_0xd55a('0x81')]);_0x15a057[_0xd55a('0x69')]=qs['filters'](_[_0xd55a('0x82')](_0x465b14['query'],_0x509e6a[_0xd55a('0x7d')]));_0x15a057[_0xd55a('0x69')][_0xd55a('0x9d')]=_0x5e7d00['id'];if(_0x465b14[_0xd55a('0x1e')][_0xd55a('0x83')]){_0x15a057[_0xd55a('0x69')]=_[_0xd55a('0x31')](_0x15a057[_0xd55a('0x69')],{'$or':_[_0xd55a('0x6b')](_0x15a057[_0xd55a('0x7f')],function(_0x4ad472){var _0x245d5c={};_0x245d5c[_0x4ad472]={'$like':'%'+_0x465b14[_0xd55a('0x1e')][_0xd55a('0x83')]+'%'};return _0x245d5c;})});}_0x15a057=_[_0xd55a('0x31')]({},_0x15a057,_0x465b14['options']);return db[_0xd55a('0x48')][_0xd55a('0x11')]({'where':_0x15a057[_0xd55a('0x69')]})['then'](function(_0x3cf2a2){_0x173e33['count']=_0x3cf2a2;if(_0x465b14['query'][_0xd55a('0xa2')]){_0x15a057[_0xd55a('0x9f')]=[{'all':!![]}];}return db[_0xd55a('0x48')]['findAll'](_0x15a057);})[_0xd55a('0x15')](function(_0xbcf9d1){_0x173e33[_0xd55a('0xa0')]=_0xbcf9d1;return _0x173e33;});}})['then'](respondWithFilteredResult(_0x42c084,_0x15a057))[_0xd55a('0x1f')](handleError(_0x42c084,null));};exports[_0xd55a('0xa3')]=function(_0x39ad44,_0x5bc498){var _0x4bd288={'raw':!![],'where':{}};var _0x57aa0f={};var _0x5e2933={'count':0x0,'rows':[]};return db[_0xd55a('0x20')][_0xd55a('0x7a')]({'where':{'id':_0x39ad44[_0xd55a('0x22')]['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x5bc498,null))[_0xd55a('0x15')](function(_0x3d6384){if(_0x3d6384){_0x57aa0f['model']=_[_0xd55a('0x24')](db['CmHopperFinal']['rawAttributes']);_0x57aa0f[_0xd55a('0x1e')]=_['keys'](_0x39ad44[_0xd55a('0x1e')]);_0x57aa0f[_0xd55a('0x7d')]=_[_0xd55a('0x7e')](_0x57aa0f['model'],_0x57aa0f[_0xd55a('0x1e')]);_0x4bd288[_0xd55a('0x7f')]=_[_0xd55a('0x7e')](_0x57aa0f[_0xd55a('0x7b')],qs['fields'](_0x39ad44[_0xd55a('0x1e')][_0xd55a('0x80')]));_0x4bd288['attributes']=_0x4bd288['attributes']['length']?_0x4bd288[_0xd55a('0x7f')]:_0x57aa0f[_0xd55a('0x7b')];if(!_0x39ad44[_0xd55a('0x1e')][_0xd55a('0x30')]('nolimit')){_0x4bd288[_0xd55a('0x85')]=qs[_0xd55a('0x85')](_0x39ad44['query'][_0xd55a('0x85')]);_0x4bd288[_0xd55a('0xf')]=qs[_0xd55a('0xf')](_0x39ad44[_0xd55a('0x1e')][_0xd55a('0xf')]);}_0x4bd288[_0xd55a('0x9c')]=qs[_0xd55a('0x81')](_0x39ad44[_0xd55a('0x1e')]['sort']);_0x4bd288['where']=qs[_0xd55a('0x7d')](_[_0xd55a('0x82')](_0x39ad44[_0xd55a('0x1e')],_0x57aa0f['filters']));_0x4bd288[_0xd55a('0x69')][_0xd55a('0x9d')]=_0x3d6384['id'];if(_0x39ad44[_0xd55a('0x1e')]['filter']){_0x4bd288[_0xd55a('0x69')]=_[_0xd55a('0x31')](_0x4bd288[_0xd55a('0x69')],{'$or':_['map'](_0x4bd288[_0xd55a('0x7f')],function(_0xfaaaf6){var _0x9b0333={};_0x9b0333[_0xfaaaf6]={'$like':'%'+_0x39ad44[_0xd55a('0x1e')][_0xd55a('0x83')]+'%'};return _0x9b0333;})});}_0x4bd288=_[_0xd55a('0x31')]({},_0x4bd288,_0x39ad44[_0xd55a('0x9e')]);return db['CmHopperFinal'][_0xd55a('0x11')]({'where':_0x4bd288['where']})[_0xd55a('0x15')](function(_0x507833){_0x5e2933['count']=_0x507833;if(_0x39ad44[_0xd55a('0x1e')][_0xd55a('0xa2')]){_0x4bd288[_0xd55a('0x9f')]=[{'all':!![]}];}return db[_0xd55a('0x47')][_0xd55a('0x1d')](_0x4bd288);})[_0xd55a('0x15')](function(_0x5b470d){_0x5e2933[_0xd55a('0xa0')]=_0x5b470d;return _0x5e2933;});}})['then'](respondWithFilteredResult(_0x5bc498,_0x4bd288))[_0xd55a('0x1f')](handleError(_0x5bc498,null));};exports[_0xd55a('0xa4')]=function(_0x50fb07,_0x418429){var _0x37ed86={'raw':!![],'where':{}};var _0x4fa548={};var _0x4dd2d1={'count':0x0,'rows':[]};return db[_0xd55a('0x20')][_0xd55a('0x7a')]({'where':{'id':_0x50fb07[_0xd55a('0x22')]['id']}})[_0xd55a('0x15')](handleEntityNotFound(_0x418429,null))['then'](function(_0x48143a){if(_0x48143a){_0x4fa548[_0xd55a('0x7b')]=_[_0xd55a('0x24')](db[_0xd55a('0xa5')][_0xd55a('0x7c')]);_0x4fa548[_0xd55a('0x1e')]=_[_0xd55a('0x24')](_0x50fb07['query']);_0x4fa548['filters']=_[_0xd55a('0x7e')](_0x4fa548[_0xd55a('0x7b')],_0x4fa548[_0xd55a('0x1e')]);_0x37ed86[_0xd55a('0x7f')]=_[_0xd55a('0x7e')](_0x4fa548['model'],qs[_0xd55a('0x80')](_0x50fb07['query'][_0xd55a('0x80')]));_0x37ed86[_0xd55a('0x7f')]=_0x37ed86[_0xd55a('0x7f')][_0xd55a('0x25')]?_0x37ed86[_0xd55a('0x7f')]:_0x4fa548[_0xd55a('0x7b')];if(!_0x50fb07[_0xd55a('0x1e')][_0xd55a('0x30')](_0xd55a('0x84'))){_0x37ed86[_0xd55a('0x85')]=qs[_0xd55a('0x85')](_0x50fb07[_0xd55a('0x1e')][_0xd55a('0x85')]);_0x37ed86[_0xd55a('0xf')]=qs[_0xd55a('0xf')](_0x50fb07[_0xd55a('0x1e')][_0xd55a('0xf')]);}_0x37ed86[_0xd55a('0x9c')]=qs['sort'](_0x50fb07[_0xd55a('0x1e')][_0xd55a('0x81')]);_0x37ed86['where']=qs[_0xd55a('0x7d')](_[_0xd55a('0x82')](_0x50fb07[_0xd55a('0x1e')],_0x4fa548[_0xd55a('0x7d')]));_0x37ed86[_0xd55a('0x69')][_0xd55a('0x9d')]=_0x48143a['id'];if(_0x50fb07[_0xd55a('0x1e')][_0xd55a('0x83')]){_0x37ed86[_0xd55a('0x69')]=_[_0xd55a('0x31')](_0x37ed86[_0xd55a('0x69')],{'$or':_['map'](_0x37ed86[_0xd55a('0x7f')],function(_0x11dc1b){var _0x5f5871={};_0x5f5871[_0x11dc1b]={'$like':'%'+_0x50fb07[_0xd55a('0x1e')][_0xd55a('0x83')]+'%'};return _0x5f5871;})});}_0x37ed86=_[_0xd55a('0x31')]({},_0x37ed86,_0x50fb07['options']);return db['JscriptySessionReport'][_0xd55a('0x11')]({'where':_0x37ed86[_0xd55a('0x69')]})[_0xd55a('0x15')](function(_0x2a39a9){_0x4dd2d1[_0xd55a('0x11')]=_0x2a39a9;if(_0x50fb07[_0xd55a('0x1e')]['includeAll']){_0x37ed86[_0xd55a('0x9f')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x37ed86);})[_0xd55a('0x15')](function(_0x48055e){_0x4dd2d1[_0xd55a('0xa0')]=_0x48055e;return _0x4dd2d1;});}})[_0xd55a('0x15')](respondWithFilteredResult(_0x418429,_0x37ed86))[_0xd55a('0x1f')](handleError(_0x418429,null));};exports[_0xd55a('0xa6')]=function(_0x494a8b,_0x4732b0){try{if(!_0x494a8b[_0xd55a('0x32')][_0xd55a('0x5c')]){throw new Error(_0xd55a('0xa7'));}if(!_0x494a8b[_0xd55a('0x32')][_0xd55a('0xa8')]){throw new Error(_0xd55a('0xa9'));}if(!_0x494a8b[_0xd55a('0x32')]['binding_values']){throw new Error(_0xd55a('0xaa'));}if(!_0x494a8b[_0xd55a('0x32')][_0xd55a('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4f8fce=_0x494a8b['body'][_0xd55a('0xa8')][_0xd55a('0xac')](',');var _0x4ff642=_0x494a8b['body'][_0xd55a('0xad')]['split'](',');if(!_0x4f8fce[_0xd55a('0x25')]||!_0x4ff642['length']||_0x4f8fce[_0xd55a('0x25')]!==_0x4ff642[_0xd55a('0x25')]){throw new Error(_0xd55a('0xae'));}_0x494a8b[_0xd55a('0x32')][_0xd55a('0x80')]=_[_0xd55a('0xaf')](_0x4f8fce,_0x4ff642);if(!_0x494a8b[_0xd55a('0x32')][_0xd55a('0x80')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x494a8b[_0xd55a('0x32')][_0xd55a('0x80')][_0xd55a('0xb0')]){throw new Error(_0xd55a('0xb1'));}var _0x2c89ca=path[_0xd55a('0x36')](config[_0xd55a('0xb2')],_0xd55a('0xb3'),_0x494a8b[_0xd55a('0xb4')]['filename']);fs[_0xd55a('0xb5')](_0x2c89ca,parseInt('0777',0x8));var _0x17b12d=require(_0xd55a('0xb6'))[_0xd55a('0xb7')](path[_0xd55a('0x36')](__dirname,_0xd55a('0xb8')),[_0x2c89ca,_0x494a8b[_0xd55a('0x32')][_0xd55a('0xa8')],_0x494a8b['body'][_0xd55a('0xad')],_0x494a8b[_0xd55a('0x32')][_0xd55a('0x5c')],_0x494a8b[_0xd55a('0x32')][_0xd55a('0xb9')],_0x494a8b[_0xd55a('0x32')][_0xd55a('0x59')],_0x494a8b['body'][_0xd55a('0xab')]]);return _0x4732b0['status'](0xc8)[_0xd55a('0x14')]({'message':'File\x20uploaded\x20correctly!','pid':_0x17b12d[_0xd55a('0xba')]});}catch(_0x4c083a){return _0x4732b0['status'](0x1f4)[_0xd55a('0xbb')](_0x4c083a);}};exports['upload']=function(_0x2b9500,_0x307360){var _0x3670b1=fs[_0xd55a('0xbc')](_0x2b9500[_0xd55a('0xb4')][_0xd55a('0x2')]);Papa[_0xd55a('0xbd')](_0x3670b1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x327dc3){return _0x307360[_0xd55a('0xe')](0xc8)[_0xd55a('0x14')]({'file':_0x2b9500[_0xd55a('0xb4')],'fields':_0x327dc3[_0xd55a('0xbe')][_0xd55a('0x80')]});}});};exports[_0xd55a('0xbf')]=function(_0x45f719,_0x19eea8){return db[_0xd55a('0xc0')][_0xd55a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd55a('0xc1')}})[_0xd55a('0x15')](function(_0x278afa){var _0x5db403=![];if(!_0x45f719[_0xd55a('0x32')][_0xd55a('0x5c')]){throw new Error(_0xd55a('0xa7'));}if(!_0x45f719[_0xd55a('0x32')][_0xd55a('0xc2')][_0xd55a('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x45f719[_0xd55a('0x32')]['binding'][_0xd55a('0xb0')]){throw new Error(_0xd55a('0xb1'));}if(!_0x45f719[_0xd55a('0x32')][_0xd55a('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xd09666=require(_0xd55a('0xb6'))[_0xd55a('0xb7')](path[_0xd55a('0x36')](__dirname,_0xd55a('0xc3')),[_0x45f719[_0xd55a('0x22')]['id'],JSON[_0xd55a('0xc4')](_0x45f719['body']),JSON[_0xd55a('0xc4')](_0x278afa)]);_0xd09666['on'](_0xd55a('0xc5'),function(){_0x5db403=!![];return _0x19eea8['status'](0xc8)[_0xd55a('0x14')]({'message':'start\x20child\x20process\x20correctly!','pid':_0xd09666[_0xd55a('0xba')]});});_0xd09666['on'](_0xd55a('0xc6'),function(_0x40bb7e){if(_0x40bb7e&&!_0x5db403){return _0x19eea8[_0xd55a('0xe')](0x1f4)[_0xd55a('0x14')]({'message':_0xd55a('0xc7'),'pid':_0xd09666[_0xd55a('0xba')]});}});})[_0xd55a('0x1f')](handleError(_0x19eea8,null));};exports['importUpdates']=function(_0x532933,_0x22f366){return db[_0xd55a('0xc0')][_0xd55a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd55a('0xc1')}})['then'](function(_0x444ce7){var _0x41f958=![];if(!_0x532933['body'][_0xd55a('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x532933[_0xd55a('0x32')][_0xd55a('0xc2')]['phone']){throw new Error(_0xd55a('0xc8'));}if(!_0x532933[_0xd55a('0x32')][_0xd55a('0xc2')][_0xd55a('0xb0')]){throw new Error(_0xd55a('0xb1'));}if(!_0x532933[_0xd55a('0x32')][_0xd55a('0xab')]){throw new Error(_0xd55a('0xc9'));}var _0x5f547d=require(_0xd55a('0xb6'))['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x532933[_0xd55a('0x22')]['id'],JSON[_0xd55a('0xc4')](_0x532933[_0xd55a('0x32')]),JSON['stringify'](_0x444ce7)]);_0x5f547d['on'](_0xd55a('0xc5'),function(){_0x41f958=!![];return _0x22f366[_0xd55a('0xe')](0xc8)[_0xd55a('0x14')]({'message':_0xd55a('0xca'),'pid':_0x5f547d[_0xd55a('0xba')]});});_0x5f547d['on']('exit',function(_0x184428){if(_0x184428&&!_0x41f958){return _0x22f366['status'](0x1f4)[_0xd55a('0x14')]({'message':_0xd55a('0xc7'),'pid':_0x5f547d[_0xd55a('0xba')]});}});})[_0xd55a('0x1f')](handleError(_0x22f366,null));};exports[_0xd55a('0xcb')]=function(_0x26b85f,_0x133fc6){var _0x156a9c=['mail','chat',_0xd55a('0xcc'),_0xd55a('0xcd'),_0xd55a('0xce'),'whatsapp',_0xd55a('0xcf')];var _0x824219={'offset':0x0,'order':qs[_0xd55a('0x81')]('-createdAt')},_0x22cb10={'count':0x0,'rows':[]};Promise[_0xd55a('0xd0')]()['then'](function(){if(_0x26b85f[_0xd55a('0x1e')][_0xd55a('0xd1')]){if(!_[_0xd55a('0xd2')](_0x156a9c,_0x26b85f[_0xd55a('0x1e')][_0xd55a('0xd1')][_0xd55a('0xd3')]())){throw new Error(_0xd55a('0xd4'));}_0x156a9c=[_0x26b85f[_0xd55a('0x1e')][_0xd55a('0xd1')][_0xd55a('0xd3')]()];}if(_0x26b85f[_0xd55a('0x1e')][_0xd55a('0xd5')]){try{var _0x132ba8=JSON[_0xd55a('0xbd')](_0x26b85f['query'][_0xd55a('0xd5')]);if(!moment(_0x132ba8['from'])[_0xd55a('0xd6')]()){throw new Error(_0xd55a('0xd7'));}if(!moment(_0x132ba8['to'])['isValid']()){throw new Error(_0xd55a('0xd8'));}}catch(_0x5e723c){throw new Error(_0xd55a('0xd9'));}}if(!_0x26b85f[_0xd55a('0x1e')][_0xd55a('0x30')](_0xd55a('0x84'))){_0x824219[_0xd55a('0x85')]=qs['limit'](_0x26b85f[_0xd55a('0x1e')][_0xd55a('0x85')]||0xa);_0x824219[_0xd55a('0xf')]=qs[_0xd55a('0xf')](_0x26b85f[_0xd55a('0x1e')][_0xd55a('0xf')]);}var _0x115c78=_0x156a9c[_0xd55a('0x6b')](function(_0x5a56f6){if(_0x5a56f6===_0xd55a('0xcf')){var _0x4d3cc8={'attributes':['id',_0xd55a('0xda'),_0xd55a('0x2c'),_0xd55a('0xdb'),_0xd55a('0xdc'),_0xd55a('0xdd'),_0xd55a('0xde'),_0xd55a('0xdf'),_0xd55a('0xe0'),_0xd55a('0xe1'),_0xd55a('0xe2'),_0xd55a('0xe3'),_0xd55a('0xe4'),_0xd55a('0xe5'),_0xd55a('0xe6')],'where':{'ContactId':_0x26b85f[_0xd55a('0x22')]['id']},'include':[{'model':db[_0xd55a('0xc0')],'as':_0xd55a('0xc0'),'attributes':['id','name',_0xd55a('0xe7'),_0xd55a('0xe8')]}],'order':[[_0xd55a('0xe2'),'DESC']]};if(_0x26b85f['query']['range']){_0x4d3cc8[_0xd55a('0x69')][_0xd55a('0xe2')]={'$gte':_0x132ba8[_0xd55a('0x33')],'$lte':_0x132ba8['to']};}return db[_0xd55a('0x4a')][_0xd55a('0xe9')](_0x4d3cc8)['then'](function(_0x46b556){_0x22cb10[_0xd55a('0x11')]+=_0x46b556[_0xd55a('0x11')];return _['map'](_0x46b556[_0xd55a('0xa0')],function(_0x587a1e){var _0x43f861=_0x587a1e[_0xd55a('0x34')]({'plain':!![]});_0x43f861[_0xd55a('0xd1')]=_0x5a56f6;if(_0x43f861[_0xd55a('0xc0')]){_0x43f861[_0xd55a('0xc0')]={'id':_0x43f861[_0xd55a('0xc0')]['id'],'name':_0x43f861[_0xd55a('0xc0')][_0xd55a('0x1a')],'fullname':_0x43f861[_0xd55a('0xc0')][_0xd55a('0xe7')],'alias':_0x43f861['User'][_0xd55a('0xe8')]};}return _0x43f861;});});}else{var _0x4439ba=_[_0xd55a('0xea')](_0x5a56f6)+(_0x5a56f6===_0xd55a('0xeb')?_0xd55a('0xec'):_0xd55a('0xed'));var _0x5e2b8a={'attributes':['id',_0xd55a('0xee'),_0xd55a('0xef'),_0xd55a('0xe2'),_0xd55a('0xe1'),_0xd55a('0xf0'),_0xd55a('0xf1'),'thirdDisposition','UserId',_0x4439ba+'Id'],'where':{'ContactId':_0x26b85f[_0xd55a('0x22')]['id']},'include':[{'model':db[_0x4439ba],'as':_0xd55a('0xed'),'attributes':['id',_0xd55a('0x1a'),'key']},{'model':db[_0xd55a('0xc0')],'as':'Owner','attributes':['id',_0xd55a('0x1a'),_0xd55a('0xe7')]},{'model':db[_0xd55a('0x61')],'as':'Tags','attributes':['id',_0xd55a('0x1a'),_0xd55a('0x63')],'through':{'attributes':[]}}],'order':[['createdAt',_0xd55a('0xf2')]]};if(_0x26b85f['query'][_0xd55a('0xd5')]){_0x5e2b8a['where']['createdAt']={'$gte':_0x132ba8['from'],'$lte':_0x132ba8['to']};}switch(_0x5a56f6){case _0xd55a('0xeb'):_0x5e2b8a[_0xd55a('0x7f')][_0xd55a('0x5b')](_0xd55a('0xf3'),'customerIp',_0xd55a('0xf4'),'deviceModel',_0xd55a('0xf5'),_0xd55a('0xf6'),'ratingType',_0xd55a('0xf7'),'referer');break;case'mail':_0x5e2b8a['attributes'][_0xd55a('0x5b')](_0xd55a('0xf8'),_0xd55a('0xf9'));break;case _0xd55a('0xcd'):_0x5e2b8a[_0xd55a('0x7f')][_0xd55a('0x5b')](_0xd55a('0xfa'),'threadId');break;}return db[_['startCase'](_0x5a56f6)+_0xd55a('0xfb')][_0xd55a('0xe9')](_0x5e2b8a)[_0xd55a('0x15')](function(_0xf41b29){_0x22cb10[_0xd55a('0x11')]+=_0xf41b29[_0xd55a('0x11')];return _['map'](_0xf41b29['rows'],function(_0x277c8c){var _0x4afe8c=_0x277c8c[_0xd55a('0x34')]({'plain':!![]});_0x4afe8c[_0xd55a('0xd1')]=_0x5a56f6;if(_0x4afe8c[_0xd55a('0xfc')]){_0x4afe8c['Owner']={'id':_0x4afe8c[_0xd55a('0xfc')]['id'],'name':_0x4afe8c[_0xd55a('0xfc')][_0xd55a('0x1a')],'fullname':_0x4afe8c[_0xd55a('0xfc')][_0xd55a('0xe7')]};}return _0x4afe8c;});});}});return Promise['all'](_0x115c78);})['then'](function(_0x48b16b){return _(_0x48b16b)['flatten']()[_0xd55a('0xfd')]('createdAt')[_0xd55a('0xfe')]()[_0xd55a('0xff')]();})[_0xd55a('0x15')](function(_0x27d9e0){_0x22cb10[_0xd55a('0xa0')]=_0x824219[_0xd55a('0x85')]?_0x27d9e0[_0xd55a('0x100')](_0x824219[_0xd55a('0xf')],_0x824219[_0xd55a('0xf')]+_0x824219[_0xd55a('0x85')]):_0x27d9e0;return _0x22cb10;})[_0xd55a('0x15')](respondWithFilteredResult(_0x133fc6,_0x824219))[_0xd55a('0x1f')](handleError(_0x133fc6,null));}; \ No newline at end of file +var _0xbf3e=['get','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','spread','contact','all','show','Tags','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','findOne','Tag','filters','model','attributes','intersection','fields','order','sort','pick','filter','map','hasOwnProperty','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopper','item','PHONE','CmHopperId','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','rawAttributes','nolimit','ContactId','options','include','rows','CmHopperHistory','getHopperFinals','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','mail','chat','fax','whatsapp','voice','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','fullname','DESC','startCase','Account','closed','closedAt','disposition','secondDisposition','UserId','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Owner','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','name','send','describe','findAll','user','catch','CmContact','find','params','keys','startsWith','cf_','query','CmCustomField','length','columnName','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from'];(function(_0x57207d,_0x1edb04){var _0x35166a=function(_0x57067a){while(--_0x57067a){_0x57207d['push'](_0x57207d['shift']());}};_0x35166a(++_0x1edb04);}(_0xbf3e,0xc0));var _0xebf3=function(_0x1bd1c3,_0x1ed2d9){_0x1bd1c3=_0x1bd1c3-0x0;var _0x5a1e76=_0xbf3e[_0x1bd1c3];return _0x5a1e76;};'use strict';var moment=require(_0xebf3('0x0'));var BPromise=require('bluebird');var util=require(_0xebf3('0x1'));var path=require(_0xebf3('0x2'));var fs=require('fs');var _=require(_0xebf3('0x3'));var squel=require(_0xebf3('0x4'));var Papa=require(_0xebf3('0x5'));var Redis=require(_0xebf3('0x6'));var contacts=require(_0xebf3('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xebf3('0x8'));var shared=require('../../config/environment/shared');var db=require(_0xebf3('0x9'))['db'];config['redis']=_['defaults'](config[_0xebf3('0xa')],{'host':_0xebf3('0xb'),'port':0x18eb});var socket=require(_0xebf3('0xc'))(new Redis(config[_0xebf3('0xa')]));require(_0xebf3('0xd'))['register'](socket);function respondWithResult(_0x476b21,_0x24348f){_0x24348f=_0x24348f||0xc8;return function(_0x3578e1){if(_0x3578e1){return _0x476b21[_0xebf3('0xe')](_0x24348f)[_0xebf3('0xf')](_0x3578e1);}};}function respondWithFilteredResult(_0x2c0d1f,_0x12da59){return function(_0x2c7b9e){if(_0x2c7b9e){var _0x300e30=typeof _0x12da59[_0xebf3('0x10')]===_0xebf3('0x11')&&typeof _0x12da59['limit']===_0xebf3('0x11');var _0x420daf=_0x2c7b9e['count'];var _0x26e2a2=_0x300e30?0x0:_0x12da59[_0xebf3('0x10')];var _0xe2f0db=_0x300e30?_0x2c7b9e[_0xebf3('0x12')]:_0x12da59[_0xebf3('0x10')]+_0x12da59[_0xebf3('0x13')];var _0x2a64c2;if(_0xe2f0db>=_0x420daf){_0xe2f0db=_0x420daf;_0x2a64c2=0xc8;}else{_0x2a64c2=0xce;}_0x2c0d1f[_0xebf3('0xe')](_0x2a64c2);return _0x2c0d1f[_0xebf3('0x14')](_0xebf3('0x15'),_0x26e2a2+'-'+_0xe2f0db+'/'+_0x420daf)[_0xebf3('0xf')](_0x2c7b9e);}return null;};}function saveUpdates(_0xbb562a){return function(_0x3c4d83){if(_0x3c4d83){return _0x3c4d83[_0xebf3('0x16')](_0xbb562a)[_0xebf3('0x17')](function(_0x154799){return _0x154799;});}return null;};}function removeEntity(_0x3fa349){return function(_0x2140ce){if(_0x2140ce){return _0x2140ce[_0xebf3('0x18')]()[_0xebf3('0x17')](function(){_0x3fa349[_0xebf3('0xe')](0xcc)[_0xebf3('0x19')]();});}};}function handleEntityNotFound(_0x2c2db9){return function(_0x3e57fe){if(!_0x3e57fe){_0x2c2db9['sendStatus'](0x194);}return _0x3e57fe;};}function handleError(_0x1c9622,_0x29e7fb){_0x29e7fb=_0x29e7fb||0x1f4;return function(_0x2e1dfa){logger[_0xebf3('0x1a')](_0x2e1dfa[_0xebf3('0x1b')]);if(_0x2e1dfa[_0xebf3('0x1c')]){delete _0x2e1dfa[_0xebf3('0x1c')];}_0x1c9622[_0xebf3('0xe')](_0x29e7fb)[_0xebf3('0x1d')](_0x2e1dfa);};}exports['index']=function(_0x391861,_0x2d43cf){var _0x2c9dc9={};return contacts[_0xebf3('0x1e')]()[_0xebf3('0x17')](function(_0x2d4bf3){_0x2c9dc9=qs['getOptions'](_0x2d4bf3,_0x391861);return contacts[_0xebf3('0x1f')](_0x391861['query'],_0x391861[_0xebf3('0x20')],_0x2c9dc9,_0x2d4bf3);})['then'](respondWithFilteredResult(_0x2d43cf,_0x2c9dc9))[_0xebf3('0x21')](handleError(_0x2d43cf,null));};exports[_0xebf3('0x18')]=function(_0x333671,_0x253276){return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x333671[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x253276,null))[_0xebf3('0x17')](removeEntity(_0x253276,null))[_0xebf3('0x21')](handleError(_0x253276,null));};exports['describe']=function(_0x31592d,_0x2c72cc){return db[_0xebf3('0x22')][_0xebf3('0x1e')]()[_0xebf3('0x17')](function(_0x1d607d){delete _0x1d607d['tags'];for(var _0x4c2e52=0x0;_0x4c2e520x0){return new Promise(function(_0x234073){var _0x5d0656=[];for(var _0x255466=0x0;_0x255466<_0x11f7ca[_0xebf3('0x2a')];_0x255466++){_0x5d0656['push'](insertAdditionalPhones(_0x11f7ca[_0x255466][_0xebf3('0x5d')],_0x11f7ca[_0x255466]['additionalPhones']));}Promise[_0xebf3('0x5e')](_0x5d0656)[_0xebf3('0x17')](function(){_0x234073(0x1);});})[_0xebf3('0x17')](function(){return{'success':_0x9bc837,'failure':_0x482460,'duplicates':_0x2e3718};});}else{return{'success':_0x9bc837,'failure':_0x482460,'duplicates':_0x2e3718};}}})[_0xebf3('0x17')](respondWithResult(_0x1bf9c8,0xc9))[_0xebf3('0x21')](handleError(_0x1bf9c8,null));};exports[_0xebf3('0x5f')]=function(_0x24bbbc,_0x4c66aa){var _0x47f210;return db[_0xebf3('0x22')][_0xebf3('0x1e')]()['then'](function(_0x3349c9){return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x24bbbc[_0xebf3('0x24')]['id']},'include':[{'model':db['Tag'],'as':_0xebf3('0x60'),'attributes':['id',_0xebf3('0x1c'),'color'],'required':_0x24bbbc[_0xebf3('0x28')][_0xebf3('0x61')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x24bbbc[_0xebf3('0x24')]['id']},'required':![],'include':[{'model':db[_0xebf3('0x62')],'as':_0xebf3('0x63')}]}],'order':[db[_0xebf3('0x64')][_0xebf3('0x65')](_0xebf3('0x66'))],'attributes':_['keys'](_0x3349c9)});})[_0xebf3('0x17')](function(_0x34f7d6){if(!_['isNil'](_0x34f7d6)){_0x47f210=_0x34f7d6['get']({'plain':!![]});var _0x4bba2a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x34f7d6&&_0x34f7d6[_0xebf3('0x5b')]){if(_0x34f7d6[_0xebf3('0x5b')]){_0x4bba2a[_0xebf3('0x58')][_0xebf3('0x67')][_0xebf3('0x5a')]({'ListId':{'$ne':_0x34f7d6[_0xebf3('0x5b')]}});}}return db[_0xebf3('0x29')][_0xebf3('0x1f')](_0x4bba2a);}})[_0xebf3('0x17')](function(_0x18b2b7){if(!_[_0xebf3('0x51')](_0x18b2b7)){return _[_0xebf3('0x68')](_0x47f210,_['map'](_0x18b2b7,function(_0x162dac){return util[_0xebf3('0x69')](_0xebf3('0x6a'),_0x162dac['id']);}));}})['then'](handleEntityNotFound(_0x4c66aa,null))[_0xebf3('0x17')](respondWithResult(_0x4c66aa,null))[_0xebf3('0x21')](handleError(_0x4c66aa,null));};exports[_0xebf3('0x16')]=function(_0x10f860,_0x5145bb){var _0x1d6b10;if(_0x10f860['body']['id']){delete _0x10f860['body']['id'];}if(!_[_0xebf3('0x51')](_0x10f860[_0xebf3('0x35')][_0xebf3('0x52')])){var _0x28db14=_0x10f860['body'][_0xebf3('0x52')];if(!_[_0xebf3('0x51')](shared[_0xebf3('0x53')][_0x28db14]))_0x10f860[_0xebf3('0x35')][_0xebf3('0x54')]=shared[_0xebf3('0x53')][_0x28db14]['utcOffset'];}return db[_0xebf3('0x22')][_0xebf3('0x23')]({'where':{'id':_0x10f860[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5145bb,null))[_0xebf3('0x17')](saveUpdates(_0x10f860[_0xebf3('0x35')],null))[_0xebf3('0x17')](function(_0x10b42f){_0x1d6b10=_0x10b42f;var _0x3693b0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x10b42f&&_0x10b42f[_0xebf3('0x5b')]){if(_0x10b42f[_0xebf3('0x5b')]){_0x3693b0[_0xebf3('0x58')][_0xebf3('0x67')][_0xebf3('0x5a')]({'ListId':{'$ne':_0x10b42f['ListId']}});}}return db[_0xebf3('0x29')]['findAll'](_0x3693b0);})[_0xebf3('0x17')](function(_0xd26603){if(_0xd26603){return _['omit'](_[_0xebf3('0x6b')](_0x10f860['body'],function(_0x423417,_0x73f8bf){return _[_0xebf3('0x26')](_0x73f8bf,_0xebf3('0x27'));}),_['map'](_0xd26603,function(_0x1fc970){return util[_0xebf3('0x69')](_0xebf3('0x6a'),_0x1fc970['id']);}));}})['then'](function(_0x3cc70a){if(_0x3cc70a&&!_[_0xebf3('0x6c')](_0x3cc70a)){var _0x316625=squel[_0xebf3('0x16')]()['table'](_0xebf3('0x6d'))['setFields'](_0x3cc70a)['where'](_0xebf3('0x6e'),_0x10f860[_0xebf3('0x24')]['id'])[_0xebf3('0x6f')]();return db['sequelize']['query'](_0x316625[_0xebf3('0x70')],{'replacements':_0x316625['values']});}})['then'](function(){if(_0x10f860[_0xebf3('0x35')][_0xebf3('0x71')]&&_0x1d6b10){return db['CmHopper'][_0xebf3('0x16')]({'phone':_0x10f860[_0xebf3('0x35')][_0xebf3('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x1d6b10['id']}});}})[_0xebf3('0x17')](function(){return _0x1d6b10;})[_0xebf3('0x17')](respondWithResult(_0x5145bb,null))[_0xebf3('0x21')](handleError(_0x5145bb,null));};exports[_0xebf3('0x72')]=function(_0x11b5c0,_0x7e1dd2){var _0x4a971d={};var _0x3fabd6={};var _0x45f6c5;var _0x4b443e;return db[_0xebf3('0x22')][_0xebf3('0x73')]({'where':{'id':_0x11b5c0[_0xebf3('0x24')]['id']}})['then'](handleEntityNotFound(_0x7e1dd2,null))['then'](function(_0x50761c){if(_0x50761c){_0x45f6c5=_0x50761c;_0x3fabd6['model']=_[_0xebf3('0x25')](db[_0xebf3('0x74')]['rawAttributes']);_0x3fabd6[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x11b5c0[_0xebf3('0x28')]);_0x3fabd6[_0xebf3('0x75')]=_['intersection'](_0x3fabd6[_0xebf3('0x76')],_0x3fabd6['query']);_0x4a971d[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x3fabd6['model'],qs['fields'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x79')]));_0x4a971d['attributes']=_0x4a971d['attributes'][_0xebf3('0x2a')]?_0x4a971d[_0xebf3('0x77')]:_0x3fabd6[_0xebf3('0x76')];_0x4a971d[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x4a971d[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x11b5c0['query'],_0x3fabd6[_0xebf3('0x75')]));if(_0x11b5c0['query'][_0xebf3('0x7d')]){_0x4a971d[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x4a971d['where'],{'$or':_[_0xebf3('0x7e')](_0x4a971d[_0xebf3('0x77')],function(_0x1ca5fa){var _0x39cb10={};_0x39cb10[_0x1ca5fa]={'$like':'%'+_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x7d')]+'%'};return _0x39cb10;})});}_0x4a971d=_['merge']({},_0x4a971d,_0x11b5c0['options']);return _0x45f6c5[_0xebf3('0x72')](_0x4a971d);}})['then'](function(_0xfb3866){if(_0xfb3866){_0x4b443e=_0xfb3866['length'];if(!_0x11b5c0['query'][_0xebf3('0x7f')]('nolimit')){_0x4a971d[_0xebf3('0x13')]=qs['limit'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x13')]);_0x4a971d['offset']=qs['offset'](_0x11b5c0[_0xebf3('0x28')][_0xebf3('0x10')]);}return _0x45f6c5[_0xebf3('0x72')](_0x4a971d);}})[_0xebf3('0x17')](function(_0x160e52){if(_0x160e52){return _0x160e52?{'count':_0x4b443e,'rows':_0x160e52}:null;}})[_0xebf3('0x17')](respondWithResult(_0x7e1dd2,null))[_0xebf3('0x21')](handleError(_0x7e1dd2,null));};exports['setTags']=function(_0x4ba4cb,_0x57e1bd){if(_0x4ba4cb[_0xebf3('0x35')]['id']){delete _0x4ba4cb['body']['id'];}return db[_0xebf3('0x22')]['findOne']({'where':{'id':_0x4ba4cb[_0xebf3('0x24')]['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x57e1bd,null))[_0xebf3('0x17')](function(_0x282f3f){if(_0x282f3f){return _0x282f3f['setTags'](_0x4ba4cb[_0xebf3('0x35')][_0xebf3('0x80')]||[]);}return null;})['then'](respondWithResult(_0x57e1bd,null))['catch'](handleError(_0x57e1bd,null));};exports['setAdditionalPhones']=function(_0x5be720,_0x3d5f27){var _0x160fdb=[];_0x160fdb[_0xebf3('0x5a')](addAdditionalPhones(_0x5be720[_0xebf3('0x35')]));Promise[_0xebf3('0x5e')](_0x160fdb)['then'](function(){_0x160fdb=[];_0x160fdb[_0xebf3('0x5a')](deleteCmHopperPhones(_0x5be720[_0xebf3('0x35')]['id']));_0x160fdb['push'](addCmHopperPhones(_0x5be720['body']['id']));Promise[_0xebf3('0x5e')](_0x160fdb)[_0xebf3('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x3d5f27,null));});};function addAdditionalPhones(_0x41b366){var _0x3e04ab;return new Promise(function(_0x31321a){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x41b366['id']}})[_0xebf3('0x17')](function(){db['ContactItemType'][_0xebf3('0x1f')]({'raw':!![],'attributes':['id',_0xebf3('0x81')]})[_0xebf3('0x17')](function(_0x263a16){var _0x28ed2d=[];for(var _0x3052f8=0x0;_0x3052f8<_0x41b366[_0xebf3('0x82')][_0xebf3('0x2a')];_0x3052f8++){var _0x126d7d=_0x41b366[_0xebf3('0x83')]?_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x83')][_0x3052f8])?'':_0x41b366['item_types'][_0x3052f8]:_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x84')]?_0x41b366['items'][_0x3052f8][_0xebf3('0x84')]:'';var _0x4759ec=_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x82')][_0x3052f8]['description'])?'':_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x85')];var _0x8c6f04=_0x126d7d+':'+_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x71')]+'§'+_0x4759ec;if(_['isNil'](_0x3e04ab))_0x3e04ab=_0x8c6f04;else _0x3e04ab+=';'+_0x8c6f04;var _0x4b1280=null;var _0x4f8b0b=null;if(_0x41b366[_0xebf3('0x83')]){if(!_['isNil'](_0x41b366[_0xebf3('0x83')][_0x3052f8])){_0x4f8b0b=_['find'](_0x263a16,function(_0xbe4eec){return _0xbe4eec['id']===_0x41b366[_0xebf3('0x83')][_0x3052f8];});if(!_[_0xebf3('0x51')](_0x4f8b0b)){_0x4b1280=_0x4f8b0b[_0xebf3('0x81')];}}}else{if(!_['isNil'](_0x41b366['items'][_0x3052f8])){_0x4f8b0b=_[_0xebf3('0x23')](_0x263a16,function(_0x508922){return _0x508922['id']===_0x41b366[_0xebf3('0x82')][_0x3052f8]['ItemTypeId'];});if(!_[_0xebf3('0x51')](_0x4f8b0b)){_0x4b1280=_0x3052f8;}}}if(_[_0xebf3('0x51')](_0x4b1280)){_0x4b1280=0x64;}_0x28ed2d[_0xebf3('0x5a')](addAdditionalPhone(_0x41b366['id'],_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x71')],_0x41b366[_0xebf3('0x83')]?_[_0xebf3('0x51')](_0x41b366[_0xebf3('0x83')][_0x3052f8])?null:_0x41b366[_0xebf3('0x83')][_0x3052f8]:_0x41b366['items'][_0x3052f8]['ItemTypeId']?_0x41b366[_0xebf3('0x82')][_0x3052f8][_0xebf3('0x84')]:null,_0x4b1280,_0x4759ec));}Promise['all'](_0x28ed2d)[_0xebf3('0x17')](function(){db[_0xebf3('0x22')]['update']({'AdditionalPhones':_0x3e04ab},{'where':{'id':_0x41b366['id']}})[_0xebf3('0x17')](function(){_0x31321a(0x1);});});});});});}function addAdditionalPhone(_0x56fec0,_0x505b7e,_0x17a396,_0x2a2d78,_0x12d455){return db[_0xebf3('0x47')][_0xebf3('0x23')]({'where':{'CmContactId':_0x56fec0,'item':_0x505b7e}})['then'](function(_0x1d24d7){if(_0x1d24d7)logger[_0xebf3('0x31')](_0xebf3('0x86'),_0x1d24d7);else{db['CmContactHasItem'][_0xebf3('0x3e')]({'CmContactId':_0x56fec0,'item':_0x505b7e,'ItemTypeId':_0x17a396,'OrderBy':_0x2a2d78,'ItemClass':'PHONE','description':_0x12d455});}});}function deleteCmHopperPhones(_0x3a3095){return new Promise(function(_0x5213b1){return db[_0xebf3('0x87')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3a3095}})[_0xebf3('0x17')](function(_0x429c2f){db['CmHopperAdditionalPhone'][_0xebf3('0x18')]({'where':{'CmHopperId':{'$in':_[_0xebf3('0x7e')](_0x429c2f,'id')}}});})[_0xebf3('0x17')](function(){_0x5213b1(0x1);});});}function addCmHopperPhones(_0x2490ea){return new Promise(function(_0x389ce0){return db[_0xebf3('0x87')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2490ea}})[_0xebf3('0x17')](function(_0x44180f){var _0x1172dd=[];_[_0xebf3('0x7e')](_0x44180f,function(_0x2ac68d){_0x1172dd[_0xebf3('0x5a')](createCmHopperPhone(_0x2490ea,_0x2ac68d['id']));});Promise[_0xebf3('0x5e')](_0x1172dd)['then'](function(){_0x389ce0(0x1);});});});}function createCmHopperPhone(_0x1891da,_0x1d912a){return new Promise(function(_0x16991d){db['CmContactHasItem'][_0xebf3('0x1f')]({'raw':!![],'attributes':[_0xebf3('0x88'),'OrderBy'],'where':{'CmContactId':_0x1891da,'ItemClass':_0xebf3('0x89')},'include':[{'model':db[_0xebf3('0x62')],'attributes':[_0xebf3('0x81')],'as':'ItemType'}],'order':[_0xebf3('0x81'),db['sequelize'][_0xebf3('0x65')]('`ItemType`.OrderBy')]})[_0xebf3('0x17')](function(_0x3272de){var _0x5e0cb8=0x1;var _0x39955b=_[_0xebf3('0x7e')](_0x3272de,function(_0x4f296b){_0x4f296b[_0xebf3('0x8a')]=_0x1d912a;_0x4f296b[_0xebf3('0x71')]=_0x4f296b['item'];_0x4f296b['OrderBy']=_0x5e0cb8;delete _0x4f296b['ItemType.OrderBy'];_0x5e0cb8=_0x5e0cb8+0x1;return _0x4f296b;});return db[_0xebf3('0x8b')]['bulkCreate'](_0x39955b,{});})[_0xebf3('0x17')](function(){_0x16991d(0x1);});});}function insertAdditionalPhones(_0x2d51b5,_0xc12da6){return new Promise(function(_0x56e2bc){var _0x4c7458=[];for(var _0x42ce6c=0x0;_0x42ce6c<_0xc12da6[_0xebf3('0x2a')];_0x42ce6c++){var _0x5546d3=_0xc12da6[_0x42ce6c];_0x4c7458[_0xebf3('0x5a')](parseContactItemType(_0x5546d3));}Promise[_0xebf3('0x5e')](_0x4c7458)[_0xebf3('0x17')](function(){var _0x2e9c23={'id':_0x2d51b5['id'],'items':_0xc12da6};return addAdditionalPhones(_0x2e9c23)['then'](function(){return addCmHopperPhones(_0x2d51b5['id']);});})['then'](function(){_0x56e2bc(_0x2d51b5);});});}function parseContactItemType(_0x25f420){return new Promise(function(_0x4be31b){if(_0x25f420[_0xebf3('0x7f')](_0xebf3('0x84'))){_0x4be31b(_0x25f420);}else{return db['ContactItemType'][_0xebf3('0x23')]({'where':{'name':_0x25f420['ItemType']}})[_0xebf3('0x17')](function(_0x42ac1d){if(_[_0xebf3('0x51')](_0x42ac1d))_0x25f420['ItemTypeId']=null;else _0x25f420[_0xebf3('0x84')]=_0x42ac1d['id'];_0x4be31b(_0x25f420);});}});}exports[_0xebf3('0x8c')]=function(_0x489ba9,_0x1333a0){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x489ba9[_0xebf3('0x24')]['id'],'ItemClass':_0xebf3('0x89')},'include':[{'model':db[_0xebf3('0x62')],'as':_0xebf3('0x63')}],'order':[[_0xebf3('0x81')],[db[_0xebf3('0x64')][_0xebf3('0x65')]('`ItemType`.OrderBy')]]})[_0xebf3('0x17')](function(_0xc9a1fe){return _0xc9a1fe;})[_0xebf3('0x17')](respondWithResult(_0x1333a0,null))[_0xebf3('0x21')](handleError(_0x1333a0,null));};exports[_0xebf3('0x8d')]=function(_0xdd79e4,_0x191873){return db[_0xebf3('0x47')]['findAll']({'raw':!![],'where':{'CmContactId':_0xdd79e4[_0xebf3('0x35')]['fromContactId']}})[_0xebf3('0x17')](function(_0x4cb69d){var _0x4b1a66=_['map'](_0x4cb69d,function(_0x1fe493){_0x1fe493[_0xebf3('0x8e')]=_0xdd79e4['body'][_0xebf3('0x8f')];return _0x1fe493;});return db[_0xebf3('0x47')][_0xebf3('0x90')](_0x4b1a66,{});})[_0xebf3('0x17')](function(){return addCmHopperPhones(_0xdd79e4[_0xebf3('0x35')][_0xebf3('0x8f')]);})[_0xebf3('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x191873,null))[_0xebf3('0x21')](handleError(_0x191873,null));};exports[_0xebf3('0x91')]=function(_0x4906ff,_0x2ad800){var _0x1b53cb=[];_0x1b53cb['push'](createCmHopperPhone(_0x4906ff['body']['id'],_0x4906ff[_0xebf3('0x35')][_0xebf3('0x92')]));Promise[_0xebf3('0x5e')](_0x1b53cb)['then'](function(){return[0x1];})[_0xebf3('0x17')](respondWithResult(_0x2ad800,null));};exports['getHoppers']=function(_0x1093dc,_0x5a0b54){var _0x35c9ad={'raw':![],'where':{}};var _0x28af37={};var _0x23bc4d={'count':0x0,'rows':[]};return db['CmContact'][_0xebf3('0x73')]({'where':{'id':_0x1093dc['params']['id']}})['then'](handleEntityNotFound(_0x5a0b54,null))[_0xebf3('0x17')](function(_0x5a1da8){if(_0x5a1da8){_0x28af37[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x87')][_0xebf3('0x93')]);_0x28af37[_0xebf3('0x28')]=_['keys'](_0x1093dc[_0xebf3('0x28')]);_0x28af37[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x28af37[_0xebf3('0x76')],_0x28af37[_0xebf3('0x28')]);_0x35c9ad[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x28af37[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x79')]));_0x35c9ad['attributes']=_0x35c9ad[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x35c9ad[_0xebf3('0x77')]:_0x28af37[_0xebf3('0x76')];if(!_0x1093dc[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x35c9ad['limit']=qs['limit'](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x13')]);_0x35c9ad[_0xebf3('0x10')]=qs['offset'](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x10')]);}_0x35c9ad[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x1093dc[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x35c9ad[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x1093dc[_0xebf3('0x28')],_0x28af37[_0xebf3('0x75')]));_0x35c9ad[_0xebf3('0x58')][_0xebf3('0x95')]=_0x5a1da8['id'];if(_0x1093dc['query'][_0xebf3('0x7d')]){_0x35c9ad[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x35c9ad['where'],{'$or':_[_0xebf3('0x7e')](_0x35c9ad['attributes'],function(_0x1489c8){var _0xc23d8e={};_0xc23d8e[_0x1489c8]={'$like':'%'+_0x1093dc['query'][_0xebf3('0x7d')]+'%'};return _0xc23d8e;})});}_0x35c9ad=_[_0xebf3('0x34')]({},_0x35c9ad,_0x1093dc[_0xebf3('0x96')]);return db[_0xebf3('0x87')][_0xebf3('0x12')]({'where':_0x35c9ad[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0xfdba86){_0x23bc4d['count']=_0xfdba86;if(_0x1093dc[_0xebf3('0x28')]['includeAll']){_0x35c9ad[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x87')]['findAll'](_0x35c9ad);})[_0xebf3('0x17')](function(_0x2e60a7){_0x23bc4d[_0xebf3('0x98')]=_0x2e60a7;return _0x23bc4d;});}})[_0xebf3('0x17')](respondWithFilteredResult(_0x5a0b54,_0x35c9ad))['catch'](handleError(_0x5a0b54,null));};exports['getHopperHistories']=function(_0x32151b,_0x54ae7d){var _0x304b37={'raw':!![],'where':{}};var _0x2728fc={};var _0x2a6e80={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x32151b['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x54ae7d,null))['then'](function(_0x307c27){if(_0x307c27){_0x2728fc[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x99')][_0xebf3('0x93')]);_0x2728fc[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x32151b[_0xebf3('0x28')]);_0x2728fc[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x2728fc[_0xebf3('0x76')],_0x2728fc[_0xebf3('0x28')]);_0x304b37[_0xebf3('0x77')]=_[_0xebf3('0x78')](_0x2728fc[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x32151b['query'][_0xebf3('0x79')]));_0x304b37[_0xebf3('0x77')]=_0x304b37[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x304b37[_0xebf3('0x77')]:_0x2728fc['model'];if(!_0x32151b['query'][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x304b37['limit']=qs['limit'](_0x32151b[_0xebf3('0x28')]['limit']);_0x304b37[_0xebf3('0x10')]=qs[_0xebf3('0x10')](_0x32151b['query'][_0xebf3('0x10')]);}_0x304b37[_0xebf3('0x7a')]=qs['sort'](_0x32151b[_0xebf3('0x28')]['sort']);_0x304b37[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x32151b[_0xebf3('0x28')],_0x2728fc[_0xebf3('0x75')]));_0x304b37[_0xebf3('0x58')]['ContactId']=_0x307c27['id'];if(_0x32151b[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x304b37[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x304b37[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x304b37[_0xebf3('0x77')],function(_0x459132){var _0x11e055={};_0x11e055[_0x459132]={'$like':'%'+_0x32151b['query'][_0xebf3('0x7d')]+'%'};return _0x11e055;})});}_0x304b37=_[_0xebf3('0x34')]({},_0x304b37,_0x32151b[_0xebf3('0x96')]);return db['CmHopperHistory'][_0xebf3('0x12')]({'where':_0x304b37[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0x5b97bf){_0x2a6e80[_0xebf3('0x12')]=_0x5b97bf;if(_0x32151b[_0xebf3('0x28')]['includeAll']){_0x304b37[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x99')][_0xebf3('0x1f')](_0x304b37);})['then'](function(_0x39a8a3){_0x2a6e80[_0xebf3('0x98')]=_0x39a8a3;return _0x2a6e80;});}})[_0xebf3('0x17')](respondWithFilteredResult(_0x54ae7d,_0x304b37))[_0xebf3('0x21')](handleError(_0x54ae7d,null));};exports[_0xebf3('0x9a')]=function(_0x4ca533,_0x5db1a8){var _0x5edda2={'raw':!![],'where':{}};var _0x3f0de8={};var _0x13306d={'count':0x0,'rows':[]};return db[_0xebf3('0x22')][_0xebf3('0x73')]({'where':{'id':_0x4ca533['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5db1a8,null))['then'](function(_0x14b493){if(_0x14b493){_0x3f0de8[_0xebf3('0x76')]=_[_0xebf3('0x25')](db['CmHopperFinal'][_0xebf3('0x93')]);_0x3f0de8[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x4ca533[_0xebf3('0x28')]);_0x3f0de8[_0xebf3('0x75')]=_[_0xebf3('0x78')](_0x3f0de8[_0xebf3('0x76')],_0x3f0de8[_0xebf3('0x28')]);_0x5edda2['attributes']=_['intersection'](_0x3f0de8[_0xebf3('0x76')],qs[_0xebf3('0x79')](_0x4ca533[_0xebf3('0x28')][_0xebf3('0x79')]));_0x5edda2['attributes']=_0x5edda2[_0xebf3('0x77')]['length']?_0x5edda2[_0xebf3('0x77')]:_0x3f0de8['model'];if(!_0x4ca533['query']['hasOwnProperty']('nolimit')){_0x5edda2[_0xebf3('0x13')]=qs['limit'](_0x4ca533[_0xebf3('0x28')]['limit']);_0x5edda2[_0xebf3('0x10')]=qs['offset'](_0x4ca533['query']['offset']);}_0x5edda2['order']=qs[_0xebf3('0x7b')](_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7b')]);_0x5edda2['where']=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x4ca533[_0xebf3('0x28')],_0x3f0de8[_0xebf3('0x75')]));_0x5edda2[_0xebf3('0x58')][_0xebf3('0x95')]=_0x14b493['id'];if(_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x5edda2[_0xebf3('0x58')]=_['merge'](_0x5edda2[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x5edda2[_0xebf3('0x77')],function(_0x205e57){var _0x2dab82={};_0x2dab82[_0x205e57]={'$like':'%'+_0x4ca533[_0xebf3('0x28')][_0xebf3('0x7d')]+'%'};return _0x2dab82;})});}_0x5edda2=_[_0xebf3('0x34')]({},_0x5edda2,_0x4ca533[_0xebf3('0x96')]);return db[_0xebf3('0x48')][_0xebf3('0x12')]({'where':_0x5edda2['where']})[_0xebf3('0x17')](function(_0x39656d){_0x13306d[_0xebf3('0x12')]=_0x39656d;if(_0x4ca533[_0xebf3('0x28')][_0xebf3('0x9b')]){_0x5edda2[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x48')][_0xebf3('0x1f')](_0x5edda2);})['then'](function(_0x265cba){_0x13306d['rows']=_0x265cba;return _0x13306d;});}})['then'](respondWithFilteredResult(_0x5db1a8,_0x5edda2))['catch'](handleError(_0x5db1a8,null));};exports[_0xebf3('0x9c')]=function(_0x5e29e8,_0x5df7cb){var _0x3068b1={'raw':!![],'where':{}};var _0x9db397={};var _0x4deab6={'count':0x0,'rows':[]};return db['CmContact'][_0xebf3('0x73')]({'where':{'id':_0x5e29e8['params']['id']}})[_0xebf3('0x17')](handleEntityNotFound(_0x5df7cb,null))[_0xebf3('0x17')](function(_0x2ae5ba){if(_0x2ae5ba){_0x9db397[_0xebf3('0x76')]=_[_0xebf3('0x25')](db[_0xebf3('0x4e')][_0xebf3('0x93')]);_0x9db397[_0xebf3('0x28')]=_[_0xebf3('0x25')](_0x5e29e8[_0xebf3('0x28')]);_0x9db397['filters']=_[_0xebf3('0x78')](_0x9db397['model'],_0x9db397[_0xebf3('0x28')]);_0x3068b1[_0xebf3('0x77')]=_['intersection'](_0x9db397['model'],qs[_0xebf3('0x79')](_0x5e29e8[_0xebf3('0x28')]['fields']));_0x3068b1[_0xebf3('0x77')]=_0x3068b1[_0xebf3('0x77')][_0xebf3('0x2a')]?_0x3068b1[_0xebf3('0x77')]:_0x9db397['model'];if(!_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x3068b1[_0xebf3('0x13')]=qs[_0xebf3('0x13')](_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x13')]);_0x3068b1[_0xebf3('0x10')]=qs[_0xebf3('0x10')](_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x10')]);}_0x3068b1[_0xebf3('0x7a')]=qs[_0xebf3('0x7b')](_0x5e29e8['query'][_0xebf3('0x7b')]);_0x3068b1[_0xebf3('0x58')]=qs[_0xebf3('0x75')](_[_0xebf3('0x7c')](_0x5e29e8[_0xebf3('0x28')],_0x9db397[_0xebf3('0x75')]));_0x3068b1[_0xebf3('0x58')][_0xebf3('0x95')]=_0x2ae5ba['id'];if(_0x5e29e8[_0xebf3('0x28')][_0xebf3('0x7d')]){_0x3068b1[_0xebf3('0x58')]=_[_0xebf3('0x34')](_0x3068b1[_0xebf3('0x58')],{'$or':_[_0xebf3('0x7e')](_0x3068b1[_0xebf3('0x77')],function(_0x56db5f){var _0x399904={};_0x399904[_0x56db5f]={'$like':'%'+_0x5e29e8['query'][_0xebf3('0x7d')]+'%'};return _0x399904;})});}_0x3068b1=_[_0xebf3('0x34')]({},_0x3068b1,_0x5e29e8[_0xebf3('0x96')]);return db[_0xebf3('0x4e')][_0xebf3('0x12')]({'where':_0x3068b1[_0xebf3('0x58')]})[_0xebf3('0x17')](function(_0x1f1058){_0x4deab6[_0xebf3('0x12')]=_0x1f1058;if(_0x5e29e8[_0xebf3('0x28')]['includeAll']){_0x3068b1[_0xebf3('0x97')]=[{'all':!![]}];}return db[_0xebf3('0x4e')][_0xebf3('0x1f')](_0x3068b1);})[_0xebf3('0x17')](function(_0x5ea7d8){_0x4deab6[_0xebf3('0x98')]=_0x5ea7d8;return _0x4deab6;});}})['then'](respondWithFilteredResult(_0x5df7cb,_0x3068b1))[_0xebf3('0x21')](handleError(_0x5df7cb,null));};exports[_0xebf3('0x9d')]=function(_0x286b76,_0x2d0e9e){try{if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x5b')]){throw new Error(_0xebf3('0x9e'));}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x9f')]){throw new Error(_0xebf3('0xa0'));}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0xa1')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2a0095=_0x286b76[_0xebf3('0x35')][_0xebf3('0x9f')]['split'](',');var _0x36e72c=_0x286b76[_0xebf3('0x35')][_0xebf3('0xa1')]['split'](',');if(!_0x2a0095[_0xebf3('0x2a')]||!_0x36e72c['length']||_0x2a0095[_0xebf3('0x2a')]!==_0x36e72c[_0xebf3('0x2a')]){throw new Error(_0xebf3('0xa3'));}_0x286b76[_0xebf3('0x35')][_0xebf3('0x79')]=_[_0xebf3('0xa4')](_0x2a0095,_0x36e72c);if(!_0x286b76[_0xebf3('0x35')]['fields'][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x286b76[_0xebf3('0x35')][_0xebf3('0x79')][_0xebf3('0xa5')]){throw new Error(_0xebf3('0xa6'));}var _0x5aaa77=path[_0xebf3('0xa7')](config[_0xebf3('0xa8')],_0xebf3('0xa9'),_0x286b76[_0xebf3('0xaa')]['filename']);fs[_0xebf3('0xab')](_0x5aaa77,parseInt(_0xebf3('0xac'),0x8));var _0x4025fb=require(_0xebf3('0xad'))[_0xebf3('0xae')](path[_0xebf3('0xa7')](__dirname,'../../components/import/cm/csv'),[_0x5aaa77,_0x286b76['body'][_0xebf3('0x9f')],_0x286b76[_0xebf3('0x35')]['binding_values'],_0x286b76[_0xebf3('0x35')][_0xebf3('0x5b')],_0x286b76[_0xebf3('0x35')][_0xebf3('0xaf')],_0x286b76[_0xebf3('0x35')][_0xebf3('0x57')],_0x286b76[_0xebf3('0x35')]['socket_timestamp']]);return _0x2d0e9e['status'](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xb0'),'pid':_0x4025fb[_0xebf3('0xb1')]});}catch(_0x58aaa4){return _0x2d0e9e['status'](0x1f4)['send'](_0x58aaa4);}};exports[_0xebf3('0xb2')]=function(_0x36871f,_0x37918a){var _0x5f2ab1=fs[_0xebf3('0xb3')](_0x36871f[_0xebf3('0xaa')]['path']);Papa[_0xebf3('0xb4')](_0x5f2ab1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5d57e6){return _0x37918a[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'file':_0x36871f[_0xebf3('0xaa')],'fields':_0x5d57e6[_0xebf3('0xb5')]['fields']});}});};exports[_0xebf3('0xb6')]=function(_0x4d0805,_0x4853c8){return db[_0xebf3('0xb7')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xebf3('0xb8')}})[_0xebf3('0x17')](function(_0x2c7fd0){var _0x32d992=![];if(!_0x4d0805[_0xebf3('0x35')]['ListId']){throw new Error(_0xebf3('0x9e'));}if(!_0x4d0805[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4d0805[_0xebf3('0x35')][_0xebf3('0xb9')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x4d0805['body'][_0xebf3('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x46050f=require(_0xebf3('0xad'))[_0xebf3('0xae')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x4d0805[_0xebf3('0x24')]['id'],JSON[_0xebf3('0xba')](_0x4d0805[_0xebf3('0x35')]),JSON['stringify'](_0x2c7fd0)]);_0x46050f['on'](_0xebf3('0xbb'),function(){_0x32d992=!![];return _0x4853c8[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xbc'),'pid':_0x46050f[_0xebf3('0xb1')]});});_0x46050f['on'](_0xebf3('0xbd'),function(_0x5a1753){if(_0x5a1753&&!_0x32d992){return _0x4853c8[_0xebf3('0xe')](0x1f4)[_0xebf3('0xf')]({'message':_0xebf3('0xbe'),'pid':_0x46050f[_0xebf3('0xb1')]});}});})[_0xebf3('0x21')](handleError(_0x4853c8,null));};exports[_0xebf3('0xbf')]=function(_0x21bb14,_0xf322fb){return db[_0xebf3('0xb7')][_0xebf3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xebf3('0xb8')}})[_0xebf3('0x17')](function(_0x52e0d9){var _0x1eec61=![];if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0x5b')]){throw new Error(_0xebf3('0x9e'));}if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x21bb14[_0xebf3('0x35')][_0xebf3('0xb9')][_0xebf3('0xa5')]){throw new Error(_0xebf3('0xa6'));}if(!_0x21bb14['body']['socket_timestamp']){throw new Error(_0xebf3('0xc0'));}var _0x23666d=require(_0xebf3('0xad'))[_0xebf3('0xae')](path[_0xebf3('0xa7')](__dirname,_0xebf3('0xc1')),[_0x21bb14[_0xebf3('0x24')]['id'],JSON[_0xebf3('0xba')](_0x21bb14[_0xebf3('0x35')]),JSON['stringify'](_0x52e0d9)]);_0x23666d['on'](_0xebf3('0xbb'),function(){_0x1eec61=!![];return _0xf322fb[_0xebf3('0xe')](0xc8)[_0xebf3('0xf')]({'message':_0xebf3('0xbc'),'pid':_0x23666d[_0xebf3('0xb1')]});});_0x23666d['on']('exit',function(_0x25cfb3){if(_0x25cfb3&&!_0x1eec61){return _0xf322fb[_0xebf3('0xe')](0x1f4)['json']({'message':_0xebf3('0xbe'),'pid':_0x23666d[_0xebf3('0xb1')]});}});})['catch'](handleError(_0xf322fb,null));};exports['getJourney']=function(_0x4a1b07,_0x16c6b5){var _0x185b60=[_0xebf3('0xc2'),_0xebf3('0xc3'),'sms','openchannel',_0xebf3('0xc4'),_0xebf3('0xc5'),_0xebf3('0xc6')];var _0x585a6a={'offset':0x0,'order':qs[_0xebf3('0x7b')]('-createdAt')},_0x2864a0={'count':0x0,'rows':[]};Promise[_0xebf3('0xc7')]()[_0xebf3('0x17')](function(){if(_0x4a1b07[_0xebf3('0x28')]['channel']){if(!_[_0xebf3('0xc8')](_0x185b60,_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xc9')][_0xebf3('0xca')]())){throw new Error(_0xebf3('0xcb'));}_0x185b60=[_0x4a1b07[_0xebf3('0x28')]['channel'][_0xebf3('0xca')]()];}if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){try{var _0x47c45b=JSON[_0xebf3('0xb4')](_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]);if(!moment(_0x47c45b[_0xebf3('0x36')])[_0xebf3('0xcd')]()){throw new Error(_0xebf3('0xce'));}if(!moment(_0x47c45b['to'])[_0xebf3('0xcd')]()){throw new Error(_0xebf3('0xcf'));}}catch(_0x29f57a){throw new Error(_0xebf3('0xd0'));}}if(!_0x4a1b07[_0xebf3('0x28')][_0xebf3('0x7f')](_0xebf3('0x94'))){_0x585a6a[_0xebf3('0x13')]=qs[_0xebf3('0x13')](_0x4a1b07[_0xebf3('0x28')]['limit']||0xa);_0x585a6a[_0xebf3('0x10')]=qs['offset'](_0x4a1b07[_0xebf3('0x28')]['offset']);}var _0x39ac4d=_0x185b60[_0xebf3('0x7e')](function(_0x18ac83){if(_0x18ac83===_0xebf3('0xc6')){var _0x8f2072={'attributes':['id','uniqueid',_0xebf3('0x2f'),'source',_0xebf3('0xd1'),_0xebf3('0xd2'),_0xebf3('0xd3'),_0xebf3('0xd4'),_0xebf3('0xd5'),_0xebf3('0xd6'),_0xebf3('0xd7'),_0xebf3('0xd8'),_0xebf3('0xd9'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x4a1b07[_0xebf3('0x24')]['id']},'include':[{'model':db[_0xebf3('0xb7')],'as':'User','attributes':['id',_0xebf3('0x1c'),_0xebf3('0xda'),_0xebf3('0x2d')]}],'order':[[_0xebf3('0xd7'),_0xebf3('0xdb')]]};if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){_0x8f2072[_0xebf3('0x58')][_0xebf3('0xd7')]={'$gte':_0x47c45b[_0xebf3('0x36')],'$lte':_0x47c45b['to']};}return db[_0xebf3('0x4a')]['findAndCountAll'](_0x8f2072)['then'](function(_0x36dff8){_0x2864a0['count']+=_0x36dff8[_0xebf3('0x12')];return _['map'](_0x36dff8['rows'],function(_0x5bd19d){var _0x4ea1eb=_0x5bd19d['get']({'plain':!![]});_0x4ea1eb[_0xebf3('0xc9')]=_0x18ac83;if(_0x4ea1eb[_0xebf3('0xb7')]){_0x4ea1eb[_0xebf3('0xb7')]={'id':_0x4ea1eb['User']['id'],'name':_0x4ea1eb['User']['name'],'fullname':_0x4ea1eb['User'][_0xebf3('0xda')],'alias':_0x4ea1eb['User'][_0xebf3('0x2d')]};}return _0x4ea1eb;});});}else{var _0x135e5f=_[_0xebf3('0xdc')](_0x18ac83)+(_0x18ac83===_0xebf3('0xc3')?'Website':_0xebf3('0xdd'));var _0x30c511={'attributes':['id',_0xebf3('0xde'),_0xebf3('0xdf'),_0xebf3('0xd7'),_0xebf3('0xd6'),_0xebf3('0xe0'),_0xebf3('0xe1'),'thirdDisposition',_0xebf3('0xe2'),_0x135e5f+'Id'],'where':{'ContactId':_0x4a1b07[_0xebf3('0x24')]['id']},'include':[{'model':db[_0x135e5f],'as':_0xebf3('0xdd'),'attributes':['id',_0xebf3('0x1c'),_0xebf3('0xe3')]},{'model':db[_0xebf3('0xb7')],'as':'Owner','attributes':['id',_0xebf3('0x1c'),_0xebf3('0xda')]},{'model':db[_0xebf3('0x74')],'as':_0xebf3('0x60'),'attributes':['id',_0xebf3('0x1c'),'color'],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x4a1b07[_0xebf3('0x28')][_0xebf3('0xcc')]){_0x30c511[_0xebf3('0x58')][_0xebf3('0xd7')]={'$gte':_0x47c45b[_0xebf3('0x36')],'$lte':_0x47c45b['to']};}switch(_0x18ac83){case _0xebf3('0xc3'):_0x30c511[_0xebf3('0x77')][_0xebf3('0x5a')](_0xebf3('0xe4'),_0xebf3('0xe5'),_0xebf3('0xe6'),_0xebf3('0xe7'),_0xebf3('0xe8'),_0xebf3('0xe9'),'ratingType',_0xebf3('0xea'),_0xebf3('0xeb'));break;case _0xebf3('0xc2'):_0x30c511[_0xebf3('0x77')][_0xebf3('0x5a')](_0xebf3('0xec'),_0xebf3('0xed'));break;case _0xebf3('0xee'):_0x30c511['attributes'][_0xebf3('0x5a')](_0xebf3('0xef'),_0xebf3('0xf0'));break;}return db[_[_0xebf3('0xdc')](_0x18ac83)+'Interaction']['findAndCountAll'](_0x30c511)[_0xebf3('0x17')](function(_0x4fadc8){_0x2864a0[_0xebf3('0x12')]+=_0x4fadc8[_0xebf3('0x12')];return _[_0xebf3('0x7e')](_0x4fadc8[_0xebf3('0x98')],function(_0x543952){var _0x3e0077=_0x543952[_0xebf3('0x37')]({'plain':!![]});_0x3e0077[_0xebf3('0xc9')]=_0x18ac83;if(_0x3e0077[_0xebf3('0xf1')]){_0x3e0077[_0xebf3('0xf1')]={'id':_0x3e0077['Owner']['id'],'name':_0x3e0077['Owner'][_0xebf3('0x1c')],'fullname':_0x3e0077[_0xebf3('0xf1')]['fullname']};}return _0x3e0077;});});}});return Promise['all'](_0x39ac4d);})[_0xebf3('0x17')](function(_0x58486c){return _(_0x58486c)[_0xebf3('0xf2')]()[_0xebf3('0xf3')](_0xebf3('0xd7'))[_0xebf3('0xf4')]()[_0xebf3('0xf5')]();})[_0xebf3('0x17')](function(_0x581fa3){_0x2864a0[_0xebf3('0x98')]=_0x585a6a[_0xebf3('0x13')]?_0x581fa3[_0xebf3('0xf6')](_0x585a6a['offset'],_0x585a6a[_0xebf3('0x10')]+_0x585a6a[_0xebf3('0x13')]):_0x581fa3;return _0x2864a0;})[_0xebf3('0x17')](respondWithFilteredResult(_0x16c6b5,_0x585a6a))[_0xebf3('0x21')](handleError(_0x16c6b5,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index deca707..ad75704 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 _0x6787=['events','../../mysqldb','CmContact','save','emit','hasOwnProperty','hook'];(function(_0x270e4c,_0x492eb7){var _0x39f84c=function(_0x7060da){while(--_0x7060da){_0x270e4c['push'](_0x270e4c['shift']());}};_0x39f84c(++_0x492eb7);}(_0x6787,0x1f1));var _0x7678=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6787[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x7678('0x0'));var CmContact=require(_0x7678('0x1'))['db'][_0x7678('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7678('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x597f43){return function(_0x3cae9c,_0x36c137,_0x1891f0){CmContactEvents[_0x7678('0x4')](_0x597f43+':'+_0x3cae9c['id'],_0x3cae9c);CmContactEvents['emit'](_0x597f43,_0x3cae9c);_0x1891f0(null);};}for(var e in events){if(events[_0x7678('0x5')](e)){var event=events[e];CmContact[_0x7678('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x80c3=['events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4b33bf,_0x2654f9){var _0x46fa97=function(_0x44e4f0){while(--_0x44e4f0){_0x4b33bf['push'](_0x4b33bf['shift']());}};_0x46fa97(++_0x2654f9);}(_0x80c3,0x1e6));var _0x380c=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x80c3[_0x336376];return _0x1d2a8e;};'use strict';var EventEmitter=require(_0x380c('0x0'));var CmContact=require(_0x380c('0x1'))['db'][_0x380c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x380c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x4'),'afterDestroy':_0x380c('0x5')};function emitEvent(_0xd88c27){return function(_0x29f3b1,_0x24ff82,_0x2f9131){CmContactEvents[_0x380c('0x6')](_0xd88c27+':'+_0x29f3b1['id'],_0x29f3b1);CmContactEvents[_0x380c('0x6')](_0xd88c27,_0x29f3b1);_0x2f9131(null);};}for(var e in events){if(events[_0x380c('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x380c('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a0ab457..0238623 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 _0xa638=['catch','message','get','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','isNil','resolve','findOne','then','dialTimezone','utcOffset','minutes','phone','ListId','YYYY-MM-DD\x20HH:mm:ss','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','firstName','lastName','fax','utf8mb4','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'];(function(_0xbd195a,_0x40d50b){var _0x3ef489=function(_0x341179){while(--_0x341179){_0xbd195a['push'](_0xbd195a['shift']());}};_0x3ef489(++_0x40d50b);}(_0xa638,0x103));var _0x8a63=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa638[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x8a63('0x0'));var logger=require(_0x8a63('0x1'))(_0x8a63('0x2'));var moment=require('moment');var shared=require(_0x8a63('0x3'));var attributes=require(_0x8a63('0x4'));function getTimezoneCallbackAt(_0x582b79,_0x5abb6e,_0x418da4,_0x28d5e2){var _0xb80ff3=_0x28d5e2?_0x8a63('0x5'):_0x8a63('0x6');var _0x3b3319=_0x418da4[_0x8a63('0x7')]?_0x418da4[_0x8a63('0x7')]:moment()[_0x8a63('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x8a63('0x9')](_0x418da4['dialTimezone'])){return Promise[_0x8a63('0xa')](_0x3b3319);}return _0x582b79[_0xb80ff3][_0x8a63('0xb')]({'where':{'id':_0x5abb6e}})[_0x8a63('0xc')](function(_0x53ed3e){if(_['isNil'](_0x53ed3e)||_[_0x8a63('0x9')](_0x53ed3e[_0x8a63('0xd')])){return Promise[_0x8a63('0xa')](_0x3b3319);}var _0x3c32f1=shared['timezones'];var _0x3f857c=_0x3c32f1[_0x53ed3e[_0x8a63('0xd')]];var _0x2538e5=_0x3c32f1[_0x418da4[_0x8a63('0xd')]];if(_['isNil'](_0x3f857c)&&_[_0x8a63('0x9')](_0x2538e5)){return Promise[_0x8a63('0xa')](_0x3b3319);}var _0x27b6d9=_0x3f857c[_0x8a63('0xe')]-_0x2538e5[_0x8a63('0xe')];var _0x4e3548=_0x418da4[_0x8a63('0x7')]?_0x418da4['scheduledat']:moment();_0x3b3319=moment(_0x4e3548)['add'](_0x27b6d9,_0x8a63('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss');return Promise['resolve'](_0x3b3319);});}function getNewHopperPayload(_0x265f19){return{'phone':_0x265f19[_0x8a63('0x10')],'ContactId':_0x265f19['id'],'ListId':_0x265f19[_0x8a63('0x11')],'scheduledat':_0x265f19[_0x8a63('0x7')]?_0x265f19['scheduledat']:moment()[_0x8a63('0x8')](_0x8a63('0x12')),'priority':_0x265f19[_0x8a63('0x13')]?_0x265f19[_0x8a63('0x13')]:0x2,'callback':_0x265f19[_0x8a63('0x14')]?!![]:![],'callbackuniqueid':_0x265f19[_0x8a63('0x14')]?_0x265f19[_0x8a63('0x14')]:undefined,'callbackat':_0x265f19[_0x8a63('0x14')]?moment()[_0x8a63('0x8')](_0x8a63('0x12')):undefined};}function handleAlwaysCheckDuplicate(_0x1453a6,_0x537b04,_0x279121,_0xf9aefa){var _0x2bcd49={'phone':_0x279121[_0x8a63('0x10')]};var _0x4df0dd={'calleridnum':_0x279121['phone']};if(_0xf9aefa){Object[_0x8a63('0x15')](_0x2bcd49,{'CampaignId':_0x537b04['id']});Object[_0x8a63('0x15')](_0x4df0dd,{'CampaignId':_0x537b04['id']});}else{Object[_0x8a63('0x15')](_0x2bcd49,{'VoiceQueueId':_0x537b04['id']});Object[_0x8a63('0x15')](_0x4df0dd,{'VoiceQueueId':_0x537b04['id']});}return _0x1453a6[_0x8a63('0x16')][_0x8a63('0xb')]({'where':_0x2bcd49})[_0x8a63('0xc')](function(_0x10acda){if(_0x10acda){throw new Error(_0x8a63('0x17')+_0x279121[_0x8a63('0x10')]+_0x8a63('0x18')+_0x537b04['id']);}return _0x1453a6['CmHopperFinal'][_0x8a63('0xb')]({'where':_0x4df0dd});})['then'](function(_0x36a997){if(_0x36a997){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x279121[_0x8a63('0x10')]+_0x8a63('0x18')+_0x537b04['id']);}var _0x167ad0=getNewHopperPayload(_0x279121);if(_0xf9aefa){_0x167ad0[_0x8a63('0x19')]=_0x537b04['id'];}else{_0x167ad0[_0x8a63('0x1a')]=_0x537b04['id'];}return _0x1453a6['CmHopper'][_0x8a63('0x1b')](_0x167ad0);});}function handleOnlyIfOpenCheckDuplicate(_0xb6bc20,_0x140fd8,_0x4947f7,_0x5b93b6){var _0x43e00a={'phone':_0x4947f7[_0x8a63('0x10')]};if(_0x5b93b6){Object[_0x8a63('0x15')](_0x43e00a,{'CampaignId':_0x140fd8['id']});}else{Object['assign'](_0x43e00a,{'VoiceQueueId':_0x140fd8['id']});}return _0xb6bc20[_0x8a63('0x16')][_0x8a63('0xb')]({'where':_0x43e00a})[_0x8a63('0xc')](function(_0x46f160){if(_0x46f160){throw new Error(_0x8a63('0x1c')+_0x4947f7[_0x8a63('0x10')]+_0x8a63('0x18')+_0x140fd8['id']);}var _0x5d2c07=getNewHopperPayload(_0x4947f7);if(_0x5b93b6){_0x5d2c07[_0x8a63('0x19')]=_0x140fd8['id'];}else{_0x5d2c07[_0x8a63('0x1a')]=_0x140fd8['id'];}return _0xb6bc20[_0x8a63('0x16')][_0x8a63('0x1b')](_0x5d2c07);});}function handleNeverCheckDuplicate(_0x51880d,_0x40f99f,_0x5f4e91){var _0x2e8dab=getNewHopperPayload(_0x5f4e91);_0x2e8dab[_0x8a63('0x1a')]=_0x40f99f['id'];return _0x51880d[_0x8a63('0x16')]['create'](_0x2e8dab);}function handleCheckDuplicate(_0x48808f,_0x3187cc,_0x4b6c5e,_0x5d89ce){return getTimezoneCallbackAt(_0x48808f,_0x3187cc,_0x4b6c5e,_0x5d89ce)[_0x8a63('0xc')](function(_0x48444e){_0x4b6c5e[_0x8a63('0x7')]=_0x48444e;switch(_0x3187cc[_0x8a63('0x1d')]){case _0x8a63('0x1e'):return handleAlwaysCheckDuplicate(_0x48808f,_0x3187cc,_0x4b6c5e,_0x5d89ce);case _0x8a63('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x48808f,_0x3187cc,_0x4b6c5e,_0x5d89ce);default:return handleNeverCheckDuplicate(_0x48808f,_0x3187cc,_0x4b6c5e);}});}function createHopperForVoiceQueues(_0x55fc91,_0x322e9d){return _0x55fc91['VoiceQueue'][_0x8a63('0x20')]({'where':{'type':_0x8a63('0x21')},'attributes':['id',_0x8a63('0x1d'),_0x8a63('0xd')],'include':[{'model':_0x55fc91[_0x8a63('0x22')],'as':_0x8a63('0x23'),'where':{'id':_0x322e9d['ListId']}}],'raw':!![]})['then'](function(_0x631821){var _0x5c00a8=_0x631821[_0x8a63('0x24')](function(_0x24ab31){return handleCheckDuplicate(_0x55fc91,_0x24ab31,_0x322e9d,![]);});return Promise[_0x8a63('0x25')](_0x5c00a8);});}function createHopperForCampaigns(_0x1af82a,_0x926e2c){return _0x1af82a[_0x8a63('0x5')][_0x8a63('0x20')]({'attributes':['id',_0x8a63('0x1d'),'dialTimezone'],'include':[{'model':_0x1af82a[_0x8a63('0x22')],'as':'Lists','where':{'id':_0x926e2c['ListId']}}],'raw':!![]})[_0x8a63('0xc')](function(_0xcbf713){var _0x3c6e5c=_0xcbf713['map'](function(_0x354b78){return handleCheckDuplicate(_0x1af82a,_0x354b78,_0x926e2c,!![]);});return Promise['all'](_0x3c6e5c);});}function createHopperBlackForVoiceQueues(_0x32b039,_0x13adb4){return _0x32b039[_0x8a63('0x6')][_0x8a63('0x20')]({'where':{'type':_0x8a63('0x21')},'attributes':['id'],'include':[{'model':_0x32b039[_0x8a63('0x22')],'as':_0x8a63('0x26'),'where':{'id':_0x13adb4[_0x8a63('0x11')]}}],'raw':!![]})[_0x8a63('0xc')](function(_0x5cf25b){var _0x3f8911=_0x5cf25b[_0x8a63('0x24')](function(_0x3f6755){return _0x32b039[_0x8a63('0x27')]['create']({'phone':_0x13adb4[_0x8a63('0x10')],'ContactId':_0x13adb4['id'],'ListId':_0x13adb4['ListId'],'VoiceQueueId':_0x3f6755['id']});});return Promise[_0x8a63('0x25')](_0x3f8911);});}function createHopperBlackForCampaigns(_0x4fec18,_0x1f7f3e){return _0x4fec18[_0x8a63('0x5')]['findAll']({'attributes':['id'],'include':[{'model':_0x4fec18[_0x8a63('0x22')],'as':_0x8a63('0x26'),'where':{'id':_0x1f7f3e[_0x8a63('0x11')]}}],'raw':!![]})[_0x8a63('0xc')](function(_0x5cd3e2){var _0x3182aa=_0x5cd3e2[_0x8a63('0x24')](function(_0x35859f){return _0x4fec18[_0x8a63('0x27')][_0x8a63('0x1b')]({'phone':_0x1f7f3e['phone'],'ContactId':_0x1f7f3e['id'],'ListId':_0x1f7f3e[_0x8a63('0x11')],'CampaignId':_0x35859f['id']});});return Promise[_0x8a63('0x25')](_0x3182aa);});}module[_0x8a63('0x28')]=function(_0x93d8c5){return _0x93d8c5[_0x8a63('0x29')](_0x8a63('0x2a'),attributes,{'tableName':_0x8a63('0x2b'),'paranoid':!![],'indexes':[{'name':_0x8a63('0x10'),'fields':[_0x8a63('0x10')]},{'name':'fti_cm_contacts','fields':[_0x8a63('0x2c'),_0x8a63('0x2d'),_0x8a63('0x10'),'mobile',_0x8a63('0x2e'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x8a63('0x2f'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x5cc8fc,_0xfc98f,_0x1de064){var _0x11c95f=_0x93d8c5[_0x8a63('0x30')];var _0x564cc1=_0x5cc8fc['get']({'plain':!![]});if(!_0x564cc1[_0x8a63('0x11')]){logger[_0x8a63('0x31')](_0x8a63('0x32')+_0x564cc1['id']);return _0x1de064();}if(!_0x564cc1['phone']){return _0x1de064();}return createHopperForVoiceQueues(_0x11c95f,_0x564cc1)[_0x8a63('0xc')](function(){return createHopperBlackForVoiceQueues(_0x11c95f,_0x564cc1);})[_0x8a63('0xc')](function(){return createHopperForCampaigns(_0x11c95f,_0x564cc1);})[_0x8a63('0xc')](function(){return createHopperBlackForCampaigns(_0x11c95f,_0x564cc1);})[_0x8a63('0xc')](function(){return _0x1de064();})[_0x8a63('0x33')](function(_0x128739){logger[_0x8a63('0x31')]('[cmContact][afterCreate]',_0x128739[_0x8a63('0x34')]);_0x1de064();});},'afterDestroy':function(_0x35863a,_0x50c4d8,_0xd06737){var _0x2ddd9c=_0x93d8c5[_0x8a63('0x30')];var _0x3f6356=_0x35863a[_0x8a63('0x35')]({'plain':!![]});return _0x2ddd9c[_0x8a63('0x16')][_0x8a63('0x20')]({'raw':!![],'where':{'ListId':_0x3f6356['ListId'],'ContactId':_0x3f6356['id']}})[_0x8a63('0xc')](function(_0x56b564){if(!_[_0x8a63('0x36')](_0x56b564)){var _0x2821db=[];for(var _0x1b7308=0x0;_0x1b7308<_0x56b564[_0x8a63('0x37')];_0x1b7308+=0x1){var _0x31af5d=_0x2ddd9c[_0x8a63('0x16')][_0x8a63('0x38')]({'where':{'ListId':_0x56b564[_0x1b7308][_0x8a63('0x11')],'ContactId':_0x56b564[_0x1b7308][_0x8a63('0x39')],'VoiceQueueId':_0x56b564[_0x1b7308][_0x8a63('0x1a')],'CampaignId':_0x56b564[_0x1b7308]['CampaignId']}});_0x2821db[_0x8a63('0x3a')](_0x31af5d);}return Promise[_0x8a63('0x25')](_0x2821db);}})[_0x8a63('0xc')](function(_0x2d2e26){logger[_0x8a63('0x3b')](_0x8a63('0x3c'),util[_0x8a63('0x3d')](_0x2d2e26,{'showHidden':![],'depth':null}));_0xd06737();})[_0x8a63('0x33')](function(_0x2e6741){logger[_0x8a63('0x31')]('[CmContact][afterDestroy][Error]',util[_0x8a63('0x3d')](_0x2e6741,{'showHidden':![],'depth':null}));_0xd06737(_0x2e6741);});}}});}; \ No newline at end of file +var _0x2174=['CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','findAll','outbound','CmList','Lists','ListId','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','email','utf8mb4','utf8mb4_unicode_ci','models','error','catch','message','get','isEmpty','length','destroy','ContactId','[CmContact][afterDestroy][Succesfull]','inspect','lodash','util','api','moment','./cmContact.attributes','Campaign','VoiceQueue','isNil','dialTimezone','findOne','then','resolve','utcOffset','scheduledat','minutes','format','YYYY-MM-DD\x20HH:mm:ss','phone','priority','callbackUniqueid','assign'];(function(_0x517eef,_0x213a63){var _0x2ef919=function(_0x401322){while(--_0x401322){_0x517eef['push'](_0x517eef['shift']());}};_0x2ef919(++_0x213a63);}(_0x2174,0x121));var _0x4217=function(_0x3503c2,_0x43699b){_0x3503c2=_0x3503c2-0x0;var _0x59ec02=_0x2174[_0x3503c2];return _0x59ec02;};'use strict';var _=require(_0x4217('0x0'));var util=require(_0x4217('0x1'));var logger=require('../../config/logger')(_0x4217('0x2'));var moment=require(_0x4217('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x4217('0x4'));function getTimezoneCallbackAt(_0x2fc7a6,_0x28523a,_0x1c7048,_0x4e59c3){var _0x401609=_0x4e59c3?_0x4217('0x5'):_0x4217('0x6');var _0x56bf01=_0x1c7048['scheduledat']?_0x1c7048['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x4217('0x7')](_0x1c7048[_0x4217('0x8')])){return Promise['resolve'](_0x56bf01);}return _0x2fc7a6[_0x401609][_0x4217('0x9')]({'where':{'id':_0x28523a}})[_0x4217('0xa')](function(_0x30d758){if(_[_0x4217('0x7')](_0x30d758)||_[_0x4217('0x7')](_0x30d758['dialTimezone'])){return Promise[_0x4217('0xb')](_0x56bf01);}var _0x75b857=shared['timezones'];var _0x5a2204=_0x75b857[_0x30d758[_0x4217('0x8')]];var _0x2ae12d=_0x75b857[_0x1c7048['dialTimezone']];if(_[_0x4217('0x7')](_0x5a2204)&&_[_0x4217('0x7')](_0x2ae12d)){return Promise[_0x4217('0xb')](_0x56bf01);}var _0x1e64af=_0x5a2204[_0x4217('0xc')]-_0x2ae12d[_0x4217('0xc')];var _0x2fd26a=_0x1c7048[_0x4217('0xd')]?_0x1c7048[_0x4217('0xd')]:moment();_0x56bf01=moment(_0x2fd26a)['add'](_0x1e64af,_0x4217('0xe'))[_0x4217('0xf')](_0x4217('0x10'));return Promise[_0x4217('0xb')](_0x56bf01);});}function getNewHopperPayload(_0x568548){return{'phone':_0x568548[_0x4217('0x11')],'ContactId':_0x568548['id'],'ListId':_0x568548['ListId'],'scheduledat':_0x568548[_0x4217('0xd')]?_0x568548[_0x4217('0xd')]:moment()['format'](_0x4217('0x10')),'priority':_0x568548[_0x4217('0x12')]?_0x568548[_0x4217('0x12')]:0x2,'callback':_0x568548[_0x4217('0x13')]?!![]:![],'callbackuniqueid':_0x568548[_0x4217('0x13')]?_0x568548[_0x4217('0x13')]:undefined,'callbackat':_0x568548[_0x4217('0x13')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x4f3671,_0x5062e1,_0x284357,_0x303d49){var _0x306740={'phone':_0x284357['phone']};var _0x553459={'calleridnum':_0x284357[_0x4217('0x11')]};if(_0x303d49){Object['assign'](_0x306740,{'CampaignId':_0x5062e1['id']});Object[_0x4217('0x14')](_0x553459,{'CampaignId':_0x5062e1['id']});}else{Object[_0x4217('0x14')](_0x306740,{'VoiceQueueId':_0x5062e1['id']});Object[_0x4217('0x14')](_0x553459,{'VoiceQueueId':_0x5062e1['id']});}return _0x4f3671[_0x4217('0x15')][_0x4217('0x9')]({'where':_0x306740})[_0x4217('0xa')](function(_0x2d8b9a){if(_0x2d8b9a){throw new Error(_0x4217('0x16')+_0x284357[_0x4217('0x11')]+_0x4217('0x17')+_0x5062e1['id']);}return _0x4f3671[_0x4217('0x18')][_0x4217('0x9')]({'where':_0x553459});})['then'](function(_0x208cfc){if(_0x208cfc){throw new Error(_0x4217('0x19')+_0x284357[_0x4217('0x11')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5062e1['id']);}var _0xedda27=getNewHopperPayload(_0x284357);if(_0x303d49){_0xedda27[_0x4217('0x1a')]=_0x5062e1['id'];}else{_0xedda27['VoiceQueueId']=_0x5062e1['id'];}return _0x4f3671[_0x4217('0x15')][_0x4217('0x1b')](_0xedda27);});}function handleOnlyIfOpenCheckDuplicate(_0x2a8248,_0x49e60d,_0x36fa2f,_0x14c490){var _0x2592e9={'phone':_0x36fa2f[_0x4217('0x11')]};if(_0x14c490){Object[_0x4217('0x14')](_0x2592e9,{'CampaignId':_0x49e60d['id']});}else{Object[_0x4217('0x14')](_0x2592e9,{'VoiceQueueId':_0x49e60d['id']});}return _0x2a8248[_0x4217('0x15')]['findOne']({'where':_0x2592e9})[_0x4217('0xa')](function(_0x384031){if(_0x384031){throw new Error(_0x4217('0x1c')+_0x36fa2f['phone']+_0x4217('0x17')+_0x49e60d['id']);}var _0x39cd25=getNewHopperPayload(_0x36fa2f);if(_0x14c490){_0x39cd25[_0x4217('0x1a')]=_0x49e60d['id'];}else{_0x39cd25[_0x4217('0x1d')]=_0x49e60d['id'];}return _0x2a8248[_0x4217('0x15')][_0x4217('0x1b')](_0x39cd25);});}function handleNeverCheckDuplicate(_0x323242,_0x6007ea,_0x1360b2){var _0x39c7e0=getNewHopperPayload(_0x1360b2);_0x39c7e0[_0x4217('0x1d')]=_0x6007ea['id'];return _0x323242['CmHopper']['create'](_0x39c7e0);}function handleCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7){return getTimezoneCallbackAt(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7)[_0x4217('0xa')](function(_0x4ec76c){_0x9846af['scheduledat']=_0x4ec76c;switch(_0x29d44d[_0x4217('0x1e')]){case _0x4217('0x1f'):return handleAlwaysCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af,_0x55d1f7);default:return handleNeverCheckDuplicate(_0x220e60,_0x29d44d,_0x9846af);}});}function createHopperForVoiceQueues(_0x50b586,_0xa0ff9f){return _0x50b586[_0x4217('0x6')][_0x4217('0x20')]({'where':{'type':_0x4217('0x21')},'attributes':['id','dialCheckDuplicateType',_0x4217('0x8')],'include':[{'model':_0x50b586[_0x4217('0x22')],'as':_0x4217('0x23'),'where':{'id':_0xa0ff9f[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x20d3fa){var _0x5a5d83=_0x20d3fa[_0x4217('0x25')](function(_0x562f5d){return handleCheckDuplicate(_0x50b586,_0x562f5d,_0xa0ff9f,![]);});return Promise[_0x4217('0x26')](_0x5a5d83);});}function createHopperForCampaigns(_0x24f2ba,_0x5dc7b3){return _0x24f2ba[_0x4217('0x5')]['findAll']({'attributes':['id',_0x4217('0x1e'),_0x4217('0x8')],'include':[{'model':_0x24f2ba[_0x4217('0x22')],'as':_0x4217('0x23'),'where':{'id':_0x5dc7b3[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x5a7984){var _0x5d1a7e=_0x5a7984[_0x4217('0x25')](function(_0x5abda5){return handleCheckDuplicate(_0x24f2ba,_0x5abda5,_0x5dc7b3,!![]);});return Promise[_0x4217('0x26')](_0x5d1a7e);});}function createHopperBlackForVoiceQueues(_0x258ea8,_0x31833f){return _0x258ea8[_0x4217('0x6')][_0x4217('0x20')]({'where':{'type':_0x4217('0x21')},'attributes':['id'],'include':[{'model':_0x258ea8[_0x4217('0x22')],'as':_0x4217('0x27'),'where':{'id':_0x31833f[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x43bd88){var _0xedfbd3=_0x43bd88[_0x4217('0x25')](function(_0x5d088b){return _0x258ea8[_0x4217('0x28')]['create']({'phone':_0x31833f[_0x4217('0x11')],'ContactId':_0x31833f['id'],'ListId':_0x31833f[_0x4217('0x24')],'VoiceQueueId':_0x5d088b['id']});});return Promise[_0x4217('0x26')](_0xedfbd3);});}function createHopperBlackForCampaigns(_0x4d4fa5,_0x3ff089){return _0x4d4fa5['Campaign'][_0x4217('0x20')]({'attributes':['id'],'include':[{'model':_0x4d4fa5['CmList'],'as':'BlackLists','where':{'id':_0x3ff089[_0x4217('0x24')]}}],'raw':!![]})[_0x4217('0xa')](function(_0x1950a1){var _0x1ef8e9=_0x1950a1[_0x4217('0x25')](function(_0x1630f0){return _0x4d4fa5[_0x4217('0x28')]['create']({'phone':_0x3ff089['phone'],'ContactId':_0x3ff089['id'],'ListId':_0x3ff089[_0x4217('0x24')],'CampaignId':_0x1630f0['id']});});return Promise[_0x4217('0x26')](_0x1ef8e9);});}module[_0x4217('0x29')]=function(_0xc9a00c){return _0xc9a00c[_0x4217('0x2a')](_0x4217('0x2b'),attributes,{'tableName':_0x4217('0x2c'),'paranoid':!![],'indexes':[{'name':_0x4217('0x11'),'fields':[_0x4217('0x11')]},{'name':_0x4217('0x2d'),'fields':[_0x4217('0x2e'),_0x4217('0x2f'),'phone','mobile','fax',_0x4217('0x30')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x4217('0x31'),'collate':_0x4217('0x32'),'hooks':{'afterCreate':function(_0x5100f8,_0xf785b3,_0x1b0c60){var _0x56a217=_0xc9a00c[_0x4217('0x33')];var _0x20e164=_0x5100f8['get']({'plain':!![]});if(!_0x20e164[_0x4217('0x24')]){logger[_0x4217('0x34')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x20e164['id']);return _0x1b0c60();}if(!_0x20e164[_0x4217('0x11')]){return _0x1b0c60();}return createHopperForVoiceQueues(_0x56a217,_0x20e164)[_0x4217('0xa')](function(){return createHopperBlackForVoiceQueues(_0x56a217,_0x20e164);})['then'](function(){return createHopperForCampaigns(_0x56a217,_0x20e164);})[_0x4217('0xa')](function(){return createHopperBlackForCampaigns(_0x56a217,_0x20e164);})['then'](function(){return _0x1b0c60();})[_0x4217('0x35')](function(_0x492ed8){logger[_0x4217('0x34')]('[cmContact][afterCreate]',_0x492ed8[_0x4217('0x36')]);_0x1b0c60();});},'afterDestroy':function(_0x23bc7b,_0x32bea9,_0x1f9457){var _0x59dfbe=_0xc9a00c['models'];var _0x429680=_0x23bc7b[_0x4217('0x37')]({'plain':!![]});return _0x59dfbe[_0x4217('0x15')][_0x4217('0x20')]({'raw':!![],'where':{'ListId':_0x429680[_0x4217('0x24')],'ContactId':_0x429680['id']}})['then'](function(_0x5b5347){if(!_[_0x4217('0x38')](_0x5b5347)){var _0x412e4e=[];for(var _0xd9acda=0x0;_0xd9acda<_0x5b5347[_0x4217('0x39')];_0xd9acda+=0x1){var _0x495881=_0x59dfbe[_0x4217('0x15')][_0x4217('0x3a')]({'where':{'ListId':_0x5b5347[_0xd9acda][_0x4217('0x24')],'ContactId':_0x5b5347[_0xd9acda][_0x4217('0x3b')],'VoiceQueueId':_0x5b5347[_0xd9acda][_0x4217('0x1d')],'CampaignId':_0x5b5347[_0xd9acda][_0x4217('0x1a')]}});_0x412e4e['push'](_0x495881);}return Promise[_0x4217('0x26')](_0x412e4e);}})[_0x4217('0xa')](function(_0x232e43){logger['info'](_0x4217('0x3c'),util[_0x4217('0x3d')](_0x232e43,{'showHidden':![],'depth':null}));_0x1f9457();})['catch'](function(_0x3db7da){logger[_0x4217('0x34')]('[CmContact][afterDestroy][Error]',util[_0x4217('0x3d')](_0x3db7da,{'showHidden':![],'depth':null}));_0x1f9457(_0x3db7da);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 24f0def..40fd83e 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(_0x3aea4c,_0x1c31fa){var _0x316158=function(_0x468232){while(--_0x468232){_0x3aea4c['push'](_0x3aea4c['shift']());}};_0x316158(++_0x1c31fa);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x5bdf28,_0x2c0b15){var _0x139d2c=function(_0x404522){while(--_0x404522){_0x5bdf28['push'](_0x5bdf28['shift']());}};_0x139d2c(++_0x2c0b15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 ad7bde5..de1fe36 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 _0xca8d=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x338a26,_0xb9ef20){var _0x25cfc8=function(_0x267c3f){while(--_0x267c3f){_0x338a26['push'](_0x338a26['shift']());}};_0x25cfc8(++_0xb9ef20);}(_0xca8d,0x172));var _0xdca8=function(_0x3227c2,_0x22390f){_0x3227c2=_0x3227c2-0x0;var _0x1dc977=_0xca8d[_0x3227c2];return _0x1dc977;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'CmContactId':{'type':Sequelize[_0xdca8('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':_0xdca8('0x4')},'OrderBy':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x40ca=['PHONE','sequelize','STRING','INTEGER'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x40ca,0x1a1));var _0xa40c=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x40ca[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa40c('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa40c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa40c('0x1')],'defaultValue':_0xa40c('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xa40c('0x1')],'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 5bcd471..7cedfc4 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 _0xca44=['type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','fieldName'];(function(_0x2e9f6f,_0x551d9e){var _0x5ae7cc=function(_0x754900){while(--_0x754900){_0x2e9f6f['push'](_0x2e9f6f['shift']());}};_0x5ae7cc(++_0x551d9e);}(_0xca44,0x79));var _0x4ca4=function(_0x547f42,_0x428dec){_0x547f42=_0x547f42-0x0;var _0x3a1641=_0xca44[_0x547f42];return _0x3a1641;};'use strict';var emlformat=require(_0x4ca4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4ca4('0x1'));var rp=require(_0x4ca4('0x2'));var moment=require('moment');var BPromise=require(_0x4ca4('0x3'));var Mustache=require('mustache');var util=require(_0x4ca4('0x4'));var path=require('path');var sox=require(_0x4ca4('0x5'));var csv=require(_0x4ca4('0x6'));var ejs=require(_0x4ca4('0x7'));var fs=require('fs');var fs_extra=require(_0x4ca4('0x8'));var _=require('lodash');var squel=require(_0x4ca4('0x9'));var crypto=require(_0x4ca4('0xa'));var jsforce=require(_0x4ca4('0xb'));var deskjs=require(_0x4ca4('0xc'));var toCsv=require(_0x4ca4('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ca4('0xd'));var as=require(_0x4ca4('0xe'));var hardwareService=require(_0x4ca4('0xf'));var logger=require(_0x4ca4('0x10'))(_0x4ca4('0x11'));var utils=require('../../config/utils');var config=require(_0x4ca4('0x12'));var licenseUtil=require(_0x4ca4('0x13'));var db=require(_0x4ca4('0x14'))['db'];function respondWithStatusCode(_0x411dc8,_0x5d9153){_0x5d9153=_0x5d9153||0xcc;return function(_0x2e14a3){if(_0x2e14a3){return _0x411dc8['sendStatus'](_0x5d9153);}return _0x411dc8[_0x4ca4('0x15')](_0x5d9153)[_0x4ca4('0x16')]();};}function respondWithResult(_0x581c28,_0x596aca){_0x596aca=_0x596aca||0xc8;return function(_0x33cf48){if(_0x33cf48){return _0x581c28[_0x4ca4('0x15')](_0x596aca)[_0x4ca4('0x17')](_0x33cf48);}};}function respondWithFilteredResult(_0x143579,_0x211919){return function(_0x5dcd8e){if(_0x5dcd8e){var _0x3afbcb=typeof _0x211919[_0x4ca4('0x18')]==='undefined'&&typeof _0x211919[_0x4ca4('0x19')]===_0x4ca4('0x1a');var _0x2bfb73=_0x5dcd8e[_0x4ca4('0x1b')];var _0x5d7b69=_0x3afbcb?0x0:_0x211919[_0x4ca4('0x18')];var _0x23589f=_0x3afbcb?_0x5dcd8e[_0x4ca4('0x1b')]:_0x211919[_0x4ca4('0x18')]+_0x211919['limit'];var _0x2ae630;if(_0x23589f>=_0x2bfb73){_0x23589f=_0x2bfb73;_0x2ae630=0xc8;}else{_0x2ae630=0xce;}_0x143579[_0x4ca4('0x15')](_0x2ae630);return _0x143579[_0x4ca4('0x1c')]('Content-Range',_0x5d7b69+'-'+_0x23589f+'/'+_0x2bfb73)[_0x4ca4('0x17')](_0x5dcd8e);}return null;};}function patchUpdates(_0x92cb79){return function(_0x1b38d7){try{jsonpatch['apply'](_0x1b38d7,_0x92cb79,!![]);}catch(_0x3e705d){return BPromise['reject'](_0x3e705d);}return _0x1b38d7[_0x4ca4('0x1d')]();};}function saveUpdates(_0x30e469,_0x139dc3){return function(_0xac4881){if(_0xac4881){return _0xac4881[_0x4ca4('0x1e')](_0x30e469)[_0x4ca4('0x1f')](function(_0x50e45f){return _0x50e45f;});}return null;};}function removeEntity(_0x28e576,_0x46d700){return function(_0x167f4f){if(_0x167f4f){return _0x167f4f[_0x4ca4('0x20')]()[_0x4ca4('0x1f')](function(){var _0x340814=_0x167f4f[_0x4ca4('0x21')]({'plain':!![]});var _0x21aaab=_0x4ca4('0x22');return db[_0x4ca4('0x23')]['destroy']({'where':{'type':_0x21aaab,'resourceId':_0x340814['id']}})[_0x4ca4('0x1f')](function(){return _0x167f4f;});})[_0x4ca4('0x1f')](function(){_0x28e576[_0x4ca4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22da40,_0x4dd0ec){return function(_0x1cabe0){if(!_0x1cabe0){_0x22da40[_0x4ca4('0x24')](0x194);}return _0x1cabe0;};}function handleError(_0x34b4f7,_0x3f6968){_0x3f6968=_0x3f6968||0x1f4;return function(_0x361136){logger[_0x4ca4('0x25')](_0x361136[_0x4ca4('0x26')]);if(_0x361136[_0x4ca4('0x27')]){delete _0x361136[_0x4ca4('0x27')];}_0x34b4f7[_0x4ca4('0x15')](_0x3f6968)[_0x4ca4('0x28')](_0x361136);};}exports[_0x4ca4('0x29')]=function(_0x1b8284,_0x49d352){var _0x15c34d={},_0x5634ec={},_0x41fe16={'count':0x0,'rows':[]};var _0x5372e9=_[_0x4ca4('0x2a')](db[_0x4ca4('0x2b')]['rawAttributes'],function(_0x26c26e){return{'name':_0x26c26e[_0x4ca4('0x2c')],'type':_0x26c26e[_0x4ca4('0x2d')][_0x4ca4('0x2e')]};});_0x5634ec['model']=_[_0x4ca4('0x2a')](_0x5372e9,_0x4ca4('0x27'));_0x5634ec['query']=_[_0x4ca4('0x2f')](_0x1b8284[_0x4ca4('0x30')]);_0x5634ec[_0x4ca4('0x31')]=_[_0x4ca4('0x32')](_0x5634ec['model'],_0x5634ec[_0x4ca4('0x30')]);_0x15c34d['attributes']=_[_0x4ca4('0x32')](_0x5634ec[_0x4ca4('0x33')],qs[_0x4ca4('0x34')](_0x1b8284[_0x4ca4('0x30')]['fields']));_0x15c34d[_0x4ca4('0x35')]=_0x15c34d[_0x4ca4('0x35')][_0x4ca4('0x36')]?_0x15c34d['attributes']:_0x5634ec[_0x4ca4('0x33')];if(!_0x1b8284[_0x4ca4('0x30')][_0x4ca4('0x37')](_0x4ca4('0x38'))){_0x15c34d[_0x4ca4('0x19')]=qs[_0x4ca4('0x19')](_0x1b8284[_0x4ca4('0x30')]['limit']);_0x15c34d[_0x4ca4('0x18')]=qs[_0x4ca4('0x18')](_0x1b8284[_0x4ca4('0x30')][_0x4ca4('0x18')]);}_0x15c34d[_0x4ca4('0x39')]=qs[_0x4ca4('0x3a')](_0x1b8284[_0x4ca4('0x30')][_0x4ca4('0x3a')]);_0x15c34d['where']=qs[_0x4ca4('0x31')](_[_0x4ca4('0x3b')](_0x1b8284['query'],_0x5634ec[_0x4ca4('0x31')]),_0x5372e9);if(_0x1b8284[_0x4ca4('0x30')][_0x4ca4('0x3c')]){_0x15c34d['where']=_['merge'](_0x15c34d[_0x4ca4('0x3d')],{'$or':_[_0x4ca4('0x2a')](_0x5372e9,function(_0x2d748e){if(_0x2d748e[_0x4ca4('0x2d')]!==_0x4ca4('0x3e')){var _0x51b9e2={};_0x51b9e2[_0x2d748e[_0x4ca4('0x27')]]={'$like':'%'+_0x1b8284[_0x4ca4('0x30')][_0x4ca4('0x3c')]+'%'};return _0x51b9e2;}})});}_0x15c34d=_['merge']({},_0x15c34d,_0x1b8284[_0x4ca4('0x3f')]);var _0x576510={'where':_0x15c34d['where']};return db[_0x4ca4('0x2b')][_0x4ca4('0x1b')](_0x576510)['then'](function(_0x4ddde9){_0x41fe16[_0x4ca4('0x1b')]=_0x4ddde9;if(_0x1b8284[_0x4ca4('0x30')]['includeAll']){_0x15c34d[_0x4ca4('0x40')]=[{'all':!![]}];}return db[_0x4ca4('0x2b')][_0x4ca4('0x41')](_0x15c34d);})[_0x4ca4('0x1f')](function(_0x3fd1a0){_0x41fe16[_0x4ca4('0x42')]=_0x3fd1a0;return _0x41fe16;})[_0x4ca4('0x1f')](respondWithFilteredResult(_0x49d352,_0x15c34d))[_0x4ca4('0x43')](handleError(_0x49d352,null));};exports[_0x4ca4('0x44')]=function(_0x31c922,_0x134de6){var _0x2405f6={'raw':!![],'where':{'id':_0x31c922[_0x4ca4('0x45')]['id']}},_0x58772b={};_0x58772b['model']=_[_0x4ca4('0x2f')](db[_0x4ca4('0x2b')][_0x4ca4('0x46')]);_0x58772b[_0x4ca4('0x30')]=_[_0x4ca4('0x2f')](_0x31c922[_0x4ca4('0x30')]);_0x58772b['filters']=_[_0x4ca4('0x32')](_0x58772b[_0x4ca4('0x33')],_0x58772b[_0x4ca4('0x30')]);_0x2405f6[_0x4ca4('0x35')]=_[_0x4ca4('0x32')](_0x58772b[_0x4ca4('0x33')],qs[_0x4ca4('0x34')](_0x31c922[_0x4ca4('0x30')][_0x4ca4('0x34')]));_0x2405f6['attributes']=_0x2405f6[_0x4ca4('0x35')]['length']?_0x2405f6[_0x4ca4('0x35')]:_0x58772b[_0x4ca4('0x33')];if(_0x31c922[_0x4ca4('0x30')][_0x4ca4('0x47')]){_0x2405f6[_0x4ca4('0x40')]=[{'all':!![]}];}_0x2405f6=_[_0x4ca4('0x48')]({},_0x2405f6,_0x31c922[_0x4ca4('0x3f')]);return db['CmContactHasItem'][_0x4ca4('0x49')](_0x2405f6)['then'](handleEntityNotFound(_0x134de6,null))['then'](respondWithResult(_0x134de6,null))[_0x4ca4('0x43')](handleError(_0x134de6,null));};exports[_0x4ca4('0x4a')]=function(_0x18a241,_0x88a0b4){return db[_0x4ca4('0x2b')]['create'](_0x18a241[_0x4ca4('0x4b')],{})['then'](function(_0x4e6144){var _0x368056=_0x18a241['user'][_0x4ca4('0x21')]({'plain':!![]});if(!_0x368056)throw new Error(_0x4ca4('0x4c'));if(_0x368056[_0x4ca4('0x4d')]===_0x4ca4('0x4e')){var _0x36cba2=_0x4e6144['get']({'plain':!![]});var _0x285e7c=_0x4ca4('0x22');return db[_0x4ca4('0x4f')][_0x4ca4('0x49')]({'where':{'name':_0x285e7c,'userProfileId':_0x368056[_0x4ca4('0x50')]},'raw':!![]})[_0x4ca4('0x1f')](function(_0x457c0e){if(_0x457c0e&&_0x457c0e[_0x4ca4('0x51')]===0x0){return db[_0x4ca4('0x23')][_0x4ca4('0x4a')]({'name':_0x36cba2[_0x4ca4('0x27')],'resourceId':_0x36cba2['id'],'type':_0x457c0e[_0x4ca4('0x27')],'sectionId':_0x457c0e['id']},{})['then'](function(){return _0x4e6144;});}else{return _0x4e6144;}})['catch'](function(_0x5647a5){logger['error'](_0x4ca4('0x52'),_0x5647a5);throw _0x5647a5;});}return _0x4e6144;})[_0x4ca4('0x1f')](respondWithResult(_0x88a0b4,0xc9))[_0x4ca4('0x43')](handleError(_0x88a0b4,null));};exports['update']=function(_0x51619d,_0x3b4e71){if(_0x51619d['body']['id']){delete _0x51619d[_0x4ca4('0x4b')]['id'];}return db[_0x4ca4('0x2b')][_0x4ca4('0x49')]({'where':{'id':_0x51619d[_0x4ca4('0x45')]['id']}})[_0x4ca4('0x1f')](handleEntityNotFound(_0x3b4e71,null))[_0x4ca4('0x1f')](saveUpdates(_0x51619d['body'],null))[_0x4ca4('0x1f')](respondWithResult(_0x3b4e71,null))['catch'](handleError(_0x3b4e71,null));};exports['destroy']=function(_0x52dd34,_0x909eb9){return db[_0x4ca4('0x2b')][_0x4ca4('0x49')]({'where':{'id':_0x52dd34[_0x4ca4('0x45')]['id']}})['then'](handleEntityNotFound(_0x909eb9,null))['then'](removeEntity(_0x909eb9,null))[_0x4ca4('0x43')](handleError(_0x909eb9,null));}; \ No newline at end of file +var _0x9a68=['get','CmContactHasItems','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','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','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a68,0x127));var _0x89a6=function(_0x533db0,_0x5685c5){_0x533db0=_0x533db0-0x0;var _0x5d8e1f=_0x9a68[_0x533db0];return _0x5d8e1f;};'use strict';var emlformat=require(_0x89a6('0x0'));var rimraf=require(_0x89a6('0x1'));var zipdir=require(_0x89a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89a6('0x3'));var moment=require('moment');var BPromise=require(_0x89a6('0x4'));var Mustache=require(_0x89a6('0x5'));var util=require(_0x89a6('0x6'));var path=require('path');var sox=require(_0x89a6('0x7'));var csv=require('to-csv');var ejs=require(_0x89a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89a6('0x9'));var squel=require(_0x89a6('0xa'));var crypto=require(_0x89a6('0xb'));var jsforce=require(_0x89a6('0xc'));var deskjs=require(_0x89a6('0xd'));var toCsv=require(_0x89a6('0xe'));var querystring=require(_0x89a6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89a6('0x10'));var qs=require(_0x89a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89a6('0x12'));var logger=require(_0x89a6('0x13'))('api');var utils=require(_0x89a6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a5a76,_0x26745a){_0x26745a=_0x26745a||0xcc;return function(_0x158c2e){if(_0x158c2e){return _0x5a5a76[_0x89a6('0x15')](_0x26745a);}return _0x5a5a76[_0x89a6('0x16')](_0x26745a)[_0x89a6('0x17')]();};}function respondWithResult(_0x5a0731,_0x5411b6){_0x5411b6=_0x5411b6||0xc8;return function(_0x70e845){if(_0x70e845){return _0x5a0731[_0x89a6('0x16')](_0x5411b6)[_0x89a6('0x18')](_0x70e845);}};}function respondWithFilteredResult(_0x108a95,_0x30429f){return function(_0x387fee){if(_0x387fee){var _0x452cba=typeof _0x30429f['offset']===_0x89a6('0x19')&&typeof _0x30429f[_0x89a6('0x1a')]===_0x89a6('0x19');var _0x4a20b0=_0x387fee[_0x89a6('0x1b')];var _0x588e66=_0x452cba?0x0:_0x30429f['offset'];var _0x20fde7=_0x452cba?_0x387fee[_0x89a6('0x1b')]:_0x30429f[_0x89a6('0x1c')]+_0x30429f[_0x89a6('0x1a')];var _0x3663e6;if(_0x20fde7>=_0x4a20b0){_0x20fde7=_0x4a20b0;_0x3663e6=0xc8;}else{_0x3663e6=0xce;}_0x108a95[_0x89a6('0x16')](_0x3663e6);return _0x108a95[_0x89a6('0x1d')](_0x89a6('0x1e'),_0x588e66+'-'+_0x20fde7+'/'+_0x4a20b0)['json'](_0x387fee);}return null;};}function patchUpdates(_0x45ddc3){return function(_0x2b8b62){try{jsonpatch[_0x89a6('0x1f')](_0x2b8b62,_0x45ddc3,!![]);}catch(_0x3a8a56){return BPromise[_0x89a6('0x20')](_0x3a8a56);}return _0x2b8b62[_0x89a6('0x21')]();};}function saveUpdates(_0x43e125,_0x26d27f){return function(_0x5e76c4){if(_0x5e76c4){return _0x5e76c4[_0x89a6('0x22')](_0x43e125)[_0x89a6('0x23')](function(_0x395bd7){return _0x395bd7;});}return null;};}function removeEntity(_0x168398,_0x3a6f0a){return function(_0x55f1b7){if(_0x55f1b7){return _0x55f1b7[_0x89a6('0x24')]()[_0x89a6('0x23')](function(){var _0x5807ff=_0x55f1b7[_0x89a6('0x25')]({'plain':!![]});var _0x321d4d=_0x89a6('0x26');return db['UserProfileResource'][_0x89a6('0x24')]({'where':{'type':_0x321d4d,'resourceId':_0x5807ff['id']}})['then'](function(){return _0x55f1b7;});})[_0x89a6('0x23')](function(){_0x168398[_0x89a6('0x16')](0xcc)[_0x89a6('0x17')]();});}};}function handleEntityNotFound(_0x7314fb,_0x52f4a9){return function(_0x5e192c){if(!_0x5e192c){_0x7314fb[_0x89a6('0x15')](0x194);}return _0x5e192c;};}function handleError(_0x302d20,_0x49c21e){_0x49c21e=_0x49c21e||0x1f4;return function(_0x3ffb9f){logger[_0x89a6('0x27')](_0x3ffb9f[_0x89a6('0x28')]);if(_0x3ffb9f[_0x89a6('0x29')]){delete _0x3ffb9f[_0x89a6('0x29')];}_0x302d20['status'](_0x49c21e)[_0x89a6('0x2a')](_0x3ffb9f);};}exports['index']=function(_0x3e0df8,_0x977a5c){var _0x193feb={},_0x5ad477={},_0x2c3a9b={'count':0x0,'rows':[]};var _0x3fcd5c=_[_0x89a6('0x2b')](db[_0x89a6('0x2c')][_0x89a6('0x2d')],function(_0x66b6ad){return{'name':_0x66b6ad[_0x89a6('0x2e')],'type':_0x66b6ad[_0x89a6('0x2f')][_0x89a6('0x30')]};});_0x5ad477[_0x89a6('0x31')]=_['map'](_0x3fcd5c,'name');_0x5ad477[_0x89a6('0x32')]=_[_0x89a6('0x33')](_0x3e0df8[_0x89a6('0x32')]);_0x5ad477[_0x89a6('0x34')]=_['intersection'](_0x5ad477[_0x89a6('0x31')],_0x5ad477[_0x89a6('0x32')]);_0x193feb[_0x89a6('0x35')]=_[_0x89a6('0x36')](_0x5ad477[_0x89a6('0x31')],qs['fields'](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x37')]));_0x193feb['attributes']=_0x193feb['attributes'][_0x89a6('0x38')]?_0x193feb[_0x89a6('0x35')]:_0x5ad477[_0x89a6('0x31')];if(!_0x3e0df8['query'][_0x89a6('0x39')](_0x89a6('0x3a'))){_0x193feb[_0x89a6('0x1a')]=qs[_0x89a6('0x1a')](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x1a')]);_0x193feb[_0x89a6('0x1c')]=qs[_0x89a6('0x1c')](_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x1c')]);}_0x193feb[_0x89a6('0x3b')]=qs['sort'](_0x3e0df8[_0x89a6('0x32')]['sort']);_0x193feb[_0x89a6('0x3c')]=qs[_0x89a6('0x34')](_[_0x89a6('0x3d')](_0x3e0df8[_0x89a6('0x32')],_0x5ad477[_0x89a6('0x34')]),_0x3fcd5c);if(_0x3e0df8['query'][_0x89a6('0x3e')]){_0x193feb[_0x89a6('0x3c')]=_['merge'](_0x193feb['where'],{'$or':_[_0x89a6('0x2b')](_0x3fcd5c,function(_0x45e007){if(_0x45e007['type']!==_0x89a6('0x3f')){var _0x2f5342={};_0x2f5342[_0x45e007['name']]={'$like':'%'+_0x3e0df8[_0x89a6('0x32')]['filter']+'%'};return _0x2f5342;}})});}_0x193feb=_[_0x89a6('0x40')]({},_0x193feb,_0x3e0df8['options']);var _0x26c557={'where':_0x193feb[_0x89a6('0x3c')]};return db['CmContactHasItem'][_0x89a6('0x1b')](_0x26c557)[_0x89a6('0x23')](function(_0x2567cd){_0x2c3a9b[_0x89a6('0x1b')]=_0x2567cd;if(_0x3e0df8[_0x89a6('0x32')][_0x89a6('0x41')]){_0x193feb[_0x89a6('0x42')]=[{'all':!![]}];}return db[_0x89a6('0x2c')][_0x89a6('0x43')](_0x193feb);})[_0x89a6('0x23')](function(_0x353ad5){_0x2c3a9b[_0x89a6('0x44')]=_0x353ad5;return _0x2c3a9b;})[_0x89a6('0x23')](respondWithFilteredResult(_0x977a5c,_0x193feb))[_0x89a6('0x45')](handleError(_0x977a5c,null));};exports[_0x89a6('0x46')]=function(_0x28ad8a,_0x23a56d){var _0x18ca68={'raw':!![],'where':{'id':_0x28ad8a[_0x89a6('0x47')]['id']}},_0x4e8820={};_0x4e8820[_0x89a6('0x31')]=_[_0x89a6('0x33')](db['CmContactHasItem'][_0x89a6('0x2d')]);_0x4e8820[_0x89a6('0x32')]=_[_0x89a6('0x33')](_0x28ad8a[_0x89a6('0x32')]);_0x4e8820[_0x89a6('0x34')]=_[_0x89a6('0x36')](_0x4e8820['model'],_0x4e8820[_0x89a6('0x32')]);_0x18ca68[_0x89a6('0x35')]=_[_0x89a6('0x36')](_0x4e8820['model'],qs[_0x89a6('0x37')](_0x28ad8a[_0x89a6('0x32')][_0x89a6('0x37')]));_0x18ca68[_0x89a6('0x35')]=_0x18ca68[_0x89a6('0x35')]['length']?_0x18ca68['attributes']:_0x4e8820[_0x89a6('0x31')];if(_0x28ad8a['query'][_0x89a6('0x41')]){_0x18ca68['include']=[{'all':!![]}];}_0x18ca68=_[_0x89a6('0x40')]({},_0x18ca68,_0x28ad8a[_0x89a6('0x48')]);return db['CmContactHasItem'][_0x89a6('0x49')](_0x18ca68)[_0x89a6('0x23')](handleEntityNotFound(_0x23a56d,null))[_0x89a6('0x23')](respondWithResult(_0x23a56d,null))[_0x89a6('0x45')](handleError(_0x23a56d,null));};exports[_0x89a6('0x4a')]=function(_0xbdd893,_0x48a85d){return db['CmContactHasItem'][_0x89a6('0x4a')](_0xbdd893[_0x89a6('0x4b')],{})[_0x89a6('0x23')](function(_0x110b5a){var _0x46a4bf=_0xbdd893[_0x89a6('0x4c')][_0x89a6('0x25')]({'plain':!![]});if(!_0x46a4bf)throw new Error(_0x89a6('0x4d'));if(_0x46a4bf[_0x89a6('0x4e')]===_0x89a6('0x4c')){var _0x355420=_0x110b5a[_0x89a6('0x25')]({'plain':!![]});var _0x2bc0f2=_0x89a6('0x26');return db[_0x89a6('0x4f')][_0x89a6('0x49')]({'where':{'name':_0x2bc0f2,'userProfileId':_0x46a4bf[_0x89a6('0x50')]},'raw':!![]})[_0x89a6('0x23')](function(_0x49628e){if(_0x49628e&&_0x49628e['autoAssociation']===0x0){return db[_0x89a6('0x51')][_0x89a6('0x4a')]({'name':_0x355420[_0x89a6('0x29')],'resourceId':_0x355420['id'],'type':_0x49628e[_0x89a6('0x29')],'sectionId':_0x49628e['id']},{})[_0x89a6('0x23')](function(){return _0x110b5a;});}else{return _0x110b5a;}})[_0x89a6('0x45')](function(_0x187223){logger[_0x89a6('0x27')](_0x89a6('0x52'),_0x187223);throw _0x187223;});}return _0x110b5a;})[_0x89a6('0x23')](respondWithResult(_0x48a85d,0xc9))['catch'](handleError(_0x48a85d,null));};exports[_0x89a6('0x22')]=function(_0x4d43ae,_0x4bae0a){if(_0x4d43ae[_0x89a6('0x4b')]['id']){delete _0x4d43ae[_0x89a6('0x4b')]['id'];}return db[_0x89a6('0x2c')][_0x89a6('0x49')]({'where':{'id':_0x4d43ae[_0x89a6('0x47')]['id']}})[_0x89a6('0x23')](handleEntityNotFound(_0x4bae0a,null))[_0x89a6('0x23')](saveUpdates(_0x4d43ae[_0x89a6('0x4b')],null))[_0x89a6('0x23')](respondWithResult(_0x4bae0a,null))[_0x89a6('0x45')](handleError(_0x4bae0a,null));};exports[_0x89a6('0x24')]=function(_0x2b3e30,_0x1ce68f){return db[_0x89a6('0x2c')]['find']({'where':{'id':_0x2b3e30[_0x89a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ce68f,null))[_0x89a6('0x23')](removeEntity(_0x1ce68f,null))[_0x89a6('0x45')](handleError(_0x1ce68f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7e6fd82..843a134 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 _0xbc24=['../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xbc24,0x101));var _0x4bc2=function(_0x24a5b4,_0x216992){_0x24a5b4=_0x24a5b4-0x0;var _0x2e2f19=_0xbc24[_0x24a5b4];return _0x2e2f19;};'use strict';var _=require(_0x4bc2('0x0'));var util=require(_0x4bc2('0x1'));var logger=require(_0x4bc2('0x2'))(_0x4bc2('0x3'));var moment=require('moment');var BPromise=require(_0x4bc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc2('0x5'));var rimraf=require(_0x4bc2('0x6'));var config=require(_0x4bc2('0x7'));var attributes=require(_0x4bc2('0x8'));module['exports']=function(_0x82dd20,_0xe3f0de){return _0x82dd20[_0x4bc2('0x9')](_0x4bc2('0xa'),attributes,{'tableName':_0x4bc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9f7=['CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x4aeff0,_0x2b74d3){var _0x155e6c=function(_0x46c91f){while(--_0x46c91f){_0x4aeff0['push'](_0x4aeff0['shift']());}};_0x155e6c(++_0x2b74d3);}(_0xc9f7,0x1bb));var _0x7c9f=function(_0x5ad37a,_0x231adc){_0x5ad37a=_0x5ad37a-0x0;var _0x10f0b7=_0xc9f7[_0x5ad37a];return _0x10f0b7;};'use strict';var _=require(_0x7c9f('0x0'));var util=require(_0x7c9f('0x1'));var logger=require(_0x7c9f('0x2'))(_0x7c9f('0x3'));var moment=require(_0x7c9f('0x4'));var BPromise=require(_0x7c9f('0x5'));var rp=require(_0x7c9f('0x6'));var fs=require('fs');var path=require(_0x7c9f('0x7'));var rimraf=require(_0x7c9f('0x8'));var config=require(_0x7c9f('0x9'));var attributes=require(_0x7c9f('0xa'));module[_0x7c9f('0xb')]=function(_0x81509f,_0x6a51e4){return _0x81509f['define'](_0x7c9f('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 081391e..327919a 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 _0xaca4=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x5373df,_0x46c4f3){var _0x42a58f=function(_0xce854){while(--_0xce854){_0x5373df['push'](_0x5373df['shift']());}};_0x42a58f(++_0x46c4f3);}(_0xaca4,0x130));var _0x4aca=function(_0x3a26bd,_0x5f4fcc){_0x3a26bd=_0x3a26bd-0x0;var _0x3c9d42=_0xaca4[_0x3a26bd];return _0x3c9d42;};'use strict';var _=require(_0x4aca('0x0'));var util=require(_0x4aca('0x1'));var moment=require('moment');var BPromise=require(_0x4aca('0x2'));var rs=require(_0x4aca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4aca('0x4'))['db'];var utils=require(_0x4aca('0x5'));var logger=require(_0x4aca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4aca('0x7'));var client=jayson[_0x4aca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4519a4,_0xcf1d9d,_0x330a3d){return new BPromise(function(_0x311120,_0x424c66){return client[_0x4aca('0x9')](_0x4519a4,_0x330a3d)[_0x4aca('0xa')](function(_0x3ebb63){logger[_0x4aca('0xb')](_0x4aca('0xc'),_0xcf1d9d,_0x4aca('0xd'));logger['debug'](_0x4aca('0xe'),_0xcf1d9d,'request\x20sent',JSON[_0x4aca('0xf')](_0x3ebb63));if(_0x3ebb63[_0x4aca('0x10')]){if(_0x3ebb63[_0x4aca('0x10')][_0x4aca('0x11')]===0x1f4){logger[_0x4aca('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0xcf1d9d,_0x3ebb63[_0x4aca('0x10')][_0x4aca('0x12')]);return _0x424c66(_0x3ebb63[_0x4aca('0x10')][_0x4aca('0x12')]);}logger[_0x4aca('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0xcf1d9d,_0x3ebb63['error']['message']);return _0x311120(_0x3ebb63[_0x4aca('0x10')][_0x4aca('0x12')]);}else{logger[_0x4aca('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0xcf1d9d,'request\x20sent');_0x311120(_0x3ebb63[_0x4aca('0x13')][_0x4aca('0x12')]);}})[_0x4aca('0x14')](function(_0x4a4cbf){logger[_0x4aca('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0xcf1d9d,_0x4a4cbf);_0x424c66(_0x4a4cbf);});});} \ No newline at end of file +var _0x7e70=['request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x1d5e03,_0x1320ca){var _0x17be65=function(_0xd5fd8a){while(--_0xd5fd8a){_0x1d5e03['push'](_0x1d5e03['shift']());}};_0x17be65(++_0x1320ca);}(_0x7e70,0x178));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07e7('0x0'));var moment=require(_0x07e7('0x1'));var BPromise=require(_0x07e7('0x2'));var rs=require(_0x07e7('0x3'));var fs=require('fs');var Redis=require(_0x07e7('0x4'));var db=require(_0x07e7('0x5'))['db'];var utils=require(_0x07e7('0x6'));var logger=require(_0x07e7('0x7'))(_0x07e7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x07e7('0x9')][_0x07e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574764,_0x122a9f,_0x39ba04){return new BPromise(function(_0x518cfc,_0x2e061a){return client[_0x07e7('0xb')](_0x574764,_0x39ba04)[_0x07e7('0xc')](function(_0x156b67){logger[_0x07e7('0xd')](_0x07e7('0xe'),_0x122a9f,_0x07e7('0xf'));logger['debug'](_0x07e7('0x10'),_0x122a9f,_0x07e7('0xf'),JSON[_0x07e7('0x11')](_0x156b67));if(_0x156b67[_0x07e7('0x12')]){if(_0x156b67['error'][_0x07e7('0x13')]===0x1f4){logger['error'](_0x07e7('0xe'),_0x122a9f,_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);return _0x2e061a(_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);}logger[_0x07e7('0x12')](_0x07e7('0xe'),_0x122a9f,_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);return _0x518cfc(_0x156b67[_0x07e7('0x12')][_0x07e7('0x14')]);}else{logger[_0x07e7('0xd')](_0x07e7('0xe'),_0x122a9f,_0x07e7('0xf'));_0x518cfc(_0x156b67[_0x07e7('0x15')][_0x07e7('0x14')]);}})[_0x07e7('0x16')](function(_0x482c69){logger[_0x07e7('0x12')](_0x07e7('0xe'),_0x122a9f,_0x482c69);_0x2e061a(_0x482c69);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 310d0c2..eeb2c93 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 _0x68b1=['isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x21cc30,_0x3b0ab3){var _0x45ec17=function(_0x338cd3){while(--_0x338cd3){_0x21cc30['push'](_0x21cc30['shift']());}};_0x45ec17(++_0x3b0ab3);}(_0x68b1,0x13a));var _0x168b=function(_0x2e513b,_0x25fbf1){_0x2e513b=_0x2e513b-0x0;var _0x15b04c=_0x68b1[_0x2e513b];return _0x15b04c;};'use strict';var multer=require(_0x168b('0x0'));var util=require(_0x168b('0x1'));var path=require(_0x168b('0x2'));var timeout=require(_0x168b('0x3'));var express=require(_0x168b('0x4'));var router=express[_0x168b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x168b('0x6'));var config=require(_0x168b('0x7'));var controller=require(_0x168b('0x8'));router[_0x168b('0x9')]('/',auth[_0x168b('0xa')](),controller[_0x168b('0xb')]);router['get'](_0x168b('0xc'),auth[_0x168b('0xa')](),controller[_0x168b('0xd')]);router[_0x168b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x168b('0xf')](_0x168b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x168b('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x168b('0x11')]=router; \ No newline at end of file +var _0x609a=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1cf6b7,_0x3f6638){var _0x1438a3=function(_0x54754a){while(--_0x54754a){_0x1cf6b7['push'](_0x1cf6b7['shift']());}};_0x1438a3(++_0x3f6638);}(_0x609a,0x11c));var _0xa609=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x609a[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require('path');var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express['Router']();var fs_extra=require(_0xa609('0x4'));var auth=require(_0xa609('0x5'));var interaction=require(_0xa609('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0xc')]('/',auth['isAuthenticated'](),controller[_0xa609('0xd')]);router[_0xa609('0xe')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xf')]);router[_0xa609('0x10')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0x11')]);module[_0xa609('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8379b7c..703327a 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 _0x87d5=['lodash','exports','alias','STRING','setDataValue','getDataValue','name','long','type','select','parse','values','stringify','BOOLEAN','ENUM'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x87d5,0x11d));var _0x587d=function(_0x5ae8c0,_0x50ccd0){_0x5ae8c0=_0x5ae8c0-0x0;var _0x48716e=_0x87d5[_0x5ae8c0];return _0x48716e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x587d('0x0'));module[_0x587d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3e8438){return this['getDataValue'](_0x587d('0x2'));}},'alias':{'type':Sequelize[_0x587d('0x3')],'allowNull':![],'set':function(_0x2b05be){this[_0x587d('0x4')]('alias',_0x2b05be?_0x2b05be:this[_0x587d('0x5')](_0x587d('0x6')));}},'type':{'type':Sequelize[_0x587d('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x587d('0x7')),'get':function(){if(this['getDataValue'](_0x587d('0x8'))===_0x587d('0x9')){return JSON[_0x587d('0xa')](this[_0x587d('0x5')](_0x587d('0xb')));}else{return this[_0x587d('0x5')](_0x587d('0xb'));}},'set':function(_0xb501c3){if(Array['isArray'](_0xb501c3)){this[_0x587d('0x4')](_0x587d('0xb'),JSON[_0x587d('0xc')](_0xb501c3));}else{this[_0x587d('0x4')](_0x587d('0xb'),_0xb501c3);}}},'required':{'type':Sequelize[_0x587d('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x587d('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x587d('0xe')]('voice')}}; \ No newline at end of file +var _0xd33e=['stringify','BOOLEAN','ENUM','voice','exports','getDataValue','alias','setDataValue','STRING','TEXT','type','select','parse','values','isArray'];(function(_0x5ae969,_0x4c3483){var _0x44c4fc=function(_0x4a607b){while(--_0x4a607b){_0x5ae969['push'](_0x5ae969['shift']());}};_0x44c4fc(++_0x4c3483);}(_0xd33e,0x1b7));var _0xed33=function(_0x317722,_0x58fba2){_0x317722=_0x317722-0x0;var _0xa152ad=_0xd33e[_0x317722];return _0xa152ad;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xed33('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x458a78){return this[_0xed33('0x1')](_0xed33('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x900bac){this[_0xed33('0x3')]('alias',_0x900bac?_0x900bac:this[_0xed33('0x1')]('name'));}},'type':{'type':Sequelize[_0xed33('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xed33('0x5')]('long'),'get':function(){if(this[_0xed33('0x1')](_0xed33('0x6'))===_0xed33('0x7')){return JSON[_0xed33('0x8')](this[_0xed33('0x1')](_0xed33('0x9')));}else{return this['getDataValue'](_0xed33('0x9'));}},'set':function(_0x476422){if(Array[_0xed33('0xa')](_0x476422)){this[_0xed33('0x3')](_0xed33('0x9'),JSON[_0xed33('0xb')](_0x476422));}else{this['setDataValue'](_0xed33('0x9'),_0x476422);}}},'required':{'type':Sequelize[_0xed33('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xed33('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xed33('0xd')](_0xed33('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 497789e..c63a71b 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 _0x791a=['attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','addColumn','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','status','apply','reject','update','destroy','then','end','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x791a,0xc8));var _0xa791=function(_0x4076de,_0x52252e){_0x4076de=_0x4076de-0x0;var _0x1d555b=_0x791a[_0x4076de];return _0x1d555b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa791('0x0'));var jsonpatch=require(_0xa791('0x1'));var rp=require(_0xa791('0x2'));var moment=require(_0xa791('0x3'));var BPromise=require(_0xa791('0x4'));var Mustache=require(_0xa791('0x5'));var util=require(_0xa791('0x6'));var path=require(_0xa791('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa791('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa791('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa791('0xa'));var toCsv=require(_0xa791('0xb'));var querystring=require(_0xa791('0xc'));var Papa=require(_0xa791('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa791('0xe'));var as=require(_0xa791('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa791('0x10'))(_0xa791('0x11'));var utils=require(_0xa791('0x12'));var config=require(_0xa791('0x13'));var licenseUtil=require(_0xa791('0x14'));var db=require(_0xa791('0x15'))['db'];function respondWithStatusCode(_0x2fcff6,_0x5532af){_0x5532af=_0x5532af||0xcc;return function(_0x13c973){if(_0x13c973){return _0x2fcff6[_0xa791('0x16')](_0x5532af);}return _0x2fcff6['status'](_0x5532af)['end']();};}function respondWithResult(_0x4cc9f0,_0xa9337c){_0xa9337c=_0xa9337c||0xc8;return function(_0x43ec58){if(_0x43ec58){return _0x4cc9f0['status'](_0xa9337c)[_0xa791('0x17')](_0x43ec58);}};}function respondWithFilteredResult(_0x45acea,_0x4072dc){return function(_0x5b466c){if(_0x5b466c){var _0x18a3e7=typeof _0x4072dc[_0xa791('0x18')]===_0xa791('0x19')&&typeof _0x4072dc['limit']==='undefined';var _0x4af951=_0x5b466c['count'];var _0x4fa63d=_0x18a3e7?0x0:_0x4072dc[_0xa791('0x18')];var _0x4789b7=_0x18a3e7?_0x5b466c[_0xa791('0x1a')]:_0x4072dc[_0xa791('0x18')]+_0x4072dc['limit'];var _0x52f23d;if(_0x4789b7>=_0x4af951){_0x4789b7=_0x4af951;_0x52f23d=0xc8;}else{_0x52f23d=0xce;}_0x45acea[_0xa791('0x1b')](_0x52f23d);return _0x45acea['set']('Content-Range',_0x4fa63d+'-'+_0x4789b7+'/'+_0x4af951)[_0xa791('0x17')](_0x5b466c);}return null;};}function patchUpdates(_0x15a472){return function(_0x336acb){try{jsonpatch[_0xa791('0x1c')](_0x336acb,_0x15a472,!![]);}catch(_0x58f7af){return BPromise[_0xa791('0x1d')](_0x58f7af);}return _0x336acb['save']();};}function saveUpdates(_0x3b8f6c,_0x732eda){return function(_0x125870){if(_0x125870){return _0x125870[_0xa791('0x1e')](_0x3b8f6c)['then'](function(_0x22f647){return _0x22f647;});}return null;};}function removeEntity(_0x48eef8,_0x7baed4){return function(_0x47ff49){if(_0x47ff49){return _0x47ff49[_0xa791('0x1f')]()[_0xa791('0x20')](function(){_0x48eef8[_0xa791('0x1b')](0xcc)[_0xa791('0x21')]();});}};}function handleEntityNotFound(_0x4da6e7,_0x72b2ab){return function(_0x2806be){if(!_0x2806be){_0x4da6e7['sendStatus'](0x194);}return _0x2806be;};}function handleError(_0x180271,_0x13b830){_0x13b830=_0x13b830||0x1f4;return function(_0x3ad810){logger[_0xa791('0x22')](_0x3ad810[_0xa791('0x23')]);if(_0x3ad810[_0xa791('0x24')]){delete _0x3ad810[_0xa791('0x24')];}_0x180271[_0xa791('0x1b')](_0x13b830)['send'](_0x3ad810);};}exports[_0xa791('0x25')]=function(_0x40dd9f,_0x5f2f64){var _0x5360ee={},_0x20863e={},_0x54c2a5={'count':0x0,'rows':[]};var _0x964c47=_[_0xa791('0x26')](db[_0xa791('0x27')][_0xa791('0x28')],function(_0x443b45){return{'name':_0x443b45[_0xa791('0x29')],'type':_0x443b45[_0xa791('0x2a')][_0xa791('0x2b')]};});_0x20863e['model']=_[_0xa791('0x2c')](_['map'](_0x964c47,_0xa791('0x24')),[_0xa791('0x24')]);_0x20863e['query']=_[_0xa791('0x2d')](_0x40dd9f[_0xa791('0x2e')]);_0x20863e[_0xa791('0x2f')]=_[_0xa791('0x30')](_0x20863e['model'],_0x20863e[_0xa791('0x2e')]);_0x5360ee[_0xa791('0x31')]=_['intersection'](_0x20863e[_0xa791('0x32')],qs['fields'](_0x40dd9f['query'][_0xa791('0x33')]));_0x5360ee[_0xa791('0x31')]=_0x5360ee[_0xa791('0x31')][_0xa791('0x34')]?_0x5360ee[_0xa791('0x31')]:_0x20863e[_0xa791('0x32')];if(!_0x40dd9f[_0xa791('0x2e')][_0xa791('0x35')](_0xa791('0x36'))){_0x5360ee['limit']=qs['limit'](_0x40dd9f[_0xa791('0x2e')][_0xa791('0x37')]);_0x5360ee[_0xa791('0x18')]=qs[_0xa791('0x18')](_0x40dd9f[_0xa791('0x2e')][_0xa791('0x18')]);}_0x5360ee[_0xa791('0x38')]=qs[_0xa791('0x39')](_0x40dd9f[_0xa791('0x2e')]['sort']);_0x5360ee[_0xa791('0x3a')]=qs[_0xa791('0x2f')](_['pick'](_0x40dd9f[_0xa791('0x2e')],_0x20863e[_0xa791('0x2f')]),_0x964c47);if(_0x40dd9f['query'][_0xa791('0x3b')]){_0x5360ee[_0xa791('0x3a')]=_[_0xa791('0x3c')](_0x5360ee[_0xa791('0x3a')],{'$or':_[_0xa791('0x26')](_0x964c47,function(_0x52d609){if(_0x52d609[_0xa791('0x2a')]!=='VIRTUAL'){var _0x251b4c={};_0x251b4c[_0x52d609[_0xa791('0x24')]]={'$like':'%'+_0x40dd9f[_0xa791('0x2e')][_0xa791('0x3b')]+'%'};return _0x251b4c;}})});}_0x5360ee=_[_0xa791('0x3c')]({},_0x5360ee,_0x40dd9f[_0xa791('0x3d')]);var _0x53fc5e={'where':_0x5360ee[_0xa791('0x3a')]};return db[_0xa791('0x27')][_0xa791('0x1a')](_0x53fc5e)['then'](function(_0x54d174){_0x54c2a5[_0xa791('0x1a')]=_0x54d174;if(_0x40dd9f[_0xa791('0x2e')][_0xa791('0x3e')]){_0x5360ee[_0xa791('0x3f')]=[{'all':!![]}];}return db[_0xa791('0x27')][_0xa791('0x40')](_0x5360ee);})[_0xa791('0x20')](function(_0x39b7c7){_0x54c2a5['rows']=_0x39b7c7;return _0x54c2a5;})[_0xa791('0x20')](respondWithFilteredResult(_0x5f2f64,_0x5360ee))[_0xa791('0x41')](handleError(_0x5f2f64,null));};exports[_0xa791('0x42')]=function(_0x596522,_0x20edde){var _0x40d9d2={'raw':!![],'where':{'id':_0x596522[_0xa791('0x43')]['id']}},_0x54e39c={};_0x54e39c[_0xa791('0x32')]=_[_0xa791('0x2d')](db[_0xa791('0x27')][_0xa791('0x28')]);_0x54e39c[_0xa791('0x2e')]=_[_0xa791('0x2d')](_0x596522['query']);_0x54e39c['filters']=_[_0xa791('0x30')](_0x54e39c[_0xa791('0x32')],_0x54e39c[_0xa791('0x2e')]);_0x40d9d2[_0xa791('0x31')]=_[_0xa791('0x30')](_0x54e39c['model'],qs[_0xa791('0x33')](_0x596522[_0xa791('0x2e')][_0xa791('0x33')]));_0x40d9d2['attributes']=_0x40d9d2[_0xa791('0x31')][_0xa791('0x34')]?_0x40d9d2[_0xa791('0x31')]:_0x54e39c[_0xa791('0x32')];if(_0x596522[_0xa791('0x2e')][_0xa791('0x3e')]){_0x40d9d2['include']=[{'all':!![]}];}_0x40d9d2=_[_0xa791('0x3c')]({},_0x40d9d2,_0x596522[_0xa791('0x3d')]);return db[_0xa791('0x27')]['find'](_0x40d9d2)[_0xa791('0x20')](handleEntityNotFound(_0x20edde,null))['then'](respondWithResult(_0x20edde,null))[_0xa791('0x41')](handleError(_0x20edde,null));};exports[_0xa791('0x1e')]=function(_0xf5624c,_0x164430){if(_0xf5624c[_0xa791('0x44')]['id']){delete _0xf5624c[_0xa791('0x44')]['id'];}return db[_0xa791('0x27')][_0xa791('0x45')]({'where':{'id':_0xf5624c[_0xa791('0x43')]['id']}})[_0xa791('0x20')](handleEntityNotFound(_0x164430,null))['then'](saveUpdates(_0xf5624c['body'],null))[_0xa791('0x20')](respondWithResult(_0x164430,null))[_0xa791('0x41')](handleError(_0x164430,null));};exports[_0xa791('0x1f')]=function(_0x35b278,_0x10e278){return db[_0xa791('0x27')][_0xa791('0x45')]({'where':{'id':_0x35b278[_0xa791('0x43')]['id']}})[_0xa791('0x20')](handleEntityNotFound(_0x10e278,null))[_0xa791('0x20')](removeEntity(_0x10e278,null))[_0xa791('0x41')](handleError(_0x10e278,null));};exports[_0xa791('0x46')]=function(_0x4d8132,_0x12a554){var _0x315848;return db[_0xa791('0x47')][_0xa791('0x48')](function(_0x6106b){return db[_0xa791('0x27')][_0xa791('0x46')](_0x4d8132[_0xa791('0x44')],{'transaction':_0x6106b})[_0xa791('0x20')](function(_0x12a6ce){_0x315848=_0x12a6ce;var _0x48c5fa={'type':db[_0xa791('0x49')][_0xa791('0x4a')],'transaction':_0x6106b};switch(_0x4d8132['body']['type']){case _0xa791('0x4b'):_0x48c5fa[_0xa791('0x2a')]=db[_0xa791('0x49')]['TEXT'];break;case _0xa791('0x4c'):_0x48c5fa[_0xa791('0x2a')]=db[_0xa791('0x49')][_0xa791('0x4d')];break;case _0xa791('0x4e'):_0x48c5fa[_0xa791('0x2a')]=db['Sequelize']['BOOLEAN'];_0x48c5fa[_0xa791('0x4f')]=![];break;default:}return db[_0xa791('0x47')]['queryInterface'][_0xa791('0x50')]('cm_contacts',util[_0xa791('0x51')](_0xa791('0x52'),_0x315848['id']),_0x48c5fa);})['then'](function(){return _0x315848;});})['then'](respondWithResult(_0x12a554,0xc9))[_0xa791('0x41')](handleError(_0x12a554,null));}; \ No newline at end of file +var _0x5379=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','differenceBy','map','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','CmCustomField','rows','catch','params','keys','intersection','length','find','body','create','sequelize','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5379,0xf3));var _0x9537=function(_0x57d484,_0x28f564){_0x57d484=_0x57d484-0x0;var _0x29937e=_0x5379[_0x57d484];return _0x29937e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9537('0x0'));var zipdir=require(_0x9537('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9537('0x2'));var moment=require(_0x9537('0x3'));var BPromise=require(_0x9537('0x4'));var Mustache=require(_0x9537('0x5'));var util=require(_0x9537('0x6'));var path=require(_0x9537('0x7'));var sox=require(_0x9537('0x8'));var csv=require(_0x9537('0x9'));var ejs=require(_0x9537('0xa'));var fs=require('fs');var fs_extra=require(_0x9537('0xb'));var _=require('lodash');var squel=require(_0x9537('0xc'));var crypto=require(_0x9537('0xd'));var jsforce=require(_0x9537('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9537('0x9'));var querystring=require(_0x9537('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9537('0x10'));var hardwareService=require(_0x9537('0x11'));var logger=require(_0x9537('0x12'))('api');var utils=require(_0x9537('0x13'));var config=require(_0x9537('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9537('0x15'))['db'];function respondWithStatusCode(_0x1b1005,_0x5136d0){_0x5136d0=_0x5136d0||0xcc;return function(_0x58a21c){if(_0x58a21c){return _0x1b1005[_0x9537('0x16')](_0x5136d0);}return _0x1b1005['status'](_0x5136d0)[_0x9537('0x17')]();};}function respondWithResult(_0x268bc4,_0x172c85){_0x172c85=_0x172c85||0xc8;return function(_0x343177){if(_0x343177){return _0x268bc4[_0x9537('0x18')](_0x172c85)[_0x9537('0x19')](_0x343177);}};}function respondWithFilteredResult(_0x5328d7,_0x3da0b2){return function(_0x23d03b){if(_0x23d03b){var _0x1f4a50=typeof _0x3da0b2[_0x9537('0x1a')]===_0x9537('0x1b')&&typeof _0x3da0b2[_0x9537('0x1c')]===_0x9537('0x1b');var _0x5d932a=_0x23d03b[_0x9537('0x1d')];var _0xf48715=_0x1f4a50?0x0:_0x3da0b2[_0x9537('0x1a')];var _0x4fd44f=_0x1f4a50?_0x23d03b[_0x9537('0x1d')]:_0x3da0b2[_0x9537('0x1a')]+_0x3da0b2[_0x9537('0x1c')];var _0x1b37a1;if(_0x4fd44f>=_0x5d932a){_0x4fd44f=_0x5d932a;_0x1b37a1=0xc8;}else{_0x1b37a1=0xce;}_0x5328d7[_0x9537('0x18')](_0x1b37a1);return _0x5328d7['set'](_0x9537('0x1e'),_0xf48715+'-'+_0x4fd44f+'/'+_0x5d932a)[_0x9537('0x19')](_0x23d03b);}return null;};}function patchUpdates(_0x285c16){return function(_0x4e2a65){try{jsonpatch[_0x9537('0x1f')](_0x4e2a65,_0x285c16,!![]);}catch(_0x48d570){return BPromise[_0x9537('0x20')](_0x48d570);}return _0x4e2a65[_0x9537('0x21')]();};}function saveUpdates(_0x310d95,_0x1ea66a){return function(_0x475a7e){if(_0x475a7e){return _0x475a7e[_0x9537('0x22')](_0x310d95)[_0x9537('0x23')](function(_0x51658a){return _0x51658a;});}return null;};}function removeEntity(_0x226b61,_0x583c9f){return function(_0x277469){if(_0x277469){return _0x277469['destroy']()[_0x9537('0x23')](function(){_0x226b61[_0x9537('0x18')](0xcc)[_0x9537('0x17')]();});}};}function handleEntityNotFound(_0x396b69,_0x48f515){return function(_0x1f83ae){if(!_0x1f83ae){_0x396b69[_0x9537('0x16')](0x194);}return _0x1f83ae;};}function handleError(_0x5985a2,_0x14ef11){_0x14ef11=_0x14ef11||0x1f4;return function(_0x4dcbfe){logger[_0x9537('0x24')](_0x4dcbfe[_0x9537('0x25')]);if(_0x4dcbfe[_0x9537('0x26')]){delete _0x4dcbfe[_0x9537('0x26')];}_0x5985a2[_0x9537('0x18')](_0x14ef11)[_0x9537('0x27')](_0x4dcbfe);};}exports[_0x9537('0x28')]=function(_0xb53b59,_0x49f657){var _0x150ae1={},_0x2baee8={},_0xb730f1={'count':0x0,'rows':[]};var _0x48e8f2=_['map'](db['CmCustomField'][_0x9537('0x29')],function(_0x570b00){return{'name':_0x570b00['fieldName'],'type':_0x570b00['type']['key']};});_0x2baee8['model']=_[_0x9537('0x2a')](_[_0x9537('0x2b')](_0x48e8f2,_0x9537('0x26')),[_0x9537('0x26')]);_0x2baee8[_0x9537('0x2c')]=_['keys'](_0xb53b59[_0x9537('0x2c')]);_0x2baee8['filters']=_['intersection'](_0x2baee8['model'],_0x2baee8['query']);_0x150ae1[_0x9537('0x2d')]=_['intersection'](_0x2baee8[_0x9537('0x2e')],qs['fields'](_0xb53b59['query'][_0x9537('0x2f')]));_0x150ae1[_0x9537('0x2d')]=_0x150ae1[_0x9537('0x2d')]['length']?_0x150ae1[_0x9537('0x2d')]:_0x2baee8[_0x9537('0x2e')];if(!_0xb53b59['query'][_0x9537('0x30')](_0x9537('0x31'))){_0x150ae1['limit']=qs[_0x9537('0x1c')](_0xb53b59[_0x9537('0x2c')][_0x9537('0x1c')]);_0x150ae1[_0x9537('0x1a')]=qs[_0x9537('0x1a')](_0xb53b59[_0x9537('0x2c')]['offset']);}_0x150ae1[_0x9537('0x32')]=qs[_0x9537('0x33')](_0xb53b59[_0x9537('0x2c')][_0x9537('0x33')]);_0x150ae1[_0x9537('0x34')]=qs[_0x9537('0x35')](_[_0x9537('0x36')](_0xb53b59[_0x9537('0x2c')],_0x2baee8[_0x9537('0x35')]),_0x48e8f2);if(_0xb53b59[_0x9537('0x2c')][_0x9537('0x37')]){_0x150ae1[_0x9537('0x34')]=_[_0x9537('0x38')](_0x150ae1['where'],{'$or':_[_0x9537('0x2b')](_0x48e8f2,function(_0x5c450f){if(_0x5c450f[_0x9537('0x39')]!==_0x9537('0x3a')){var _0x1581df={};_0x1581df[_0x5c450f[_0x9537('0x26')]]={'$like':'%'+_0xb53b59[_0x9537('0x2c')][_0x9537('0x37')]+'%'};return _0x1581df;}})});}_0x150ae1=_[_0x9537('0x38')]({},_0x150ae1,_0xb53b59[_0x9537('0x3b')]);var _0x2a1c80={'where':_0x150ae1['where']};return db['CmCustomField'][_0x9537('0x1d')](_0x2a1c80)[_0x9537('0x23')](function(_0x5dabbe){_0xb730f1[_0x9537('0x1d')]=_0x5dabbe;if(_0xb53b59['query'][_0x9537('0x3c')]){_0x150ae1[_0x9537('0x3d')]=[{'all':!![]}];}return db[_0x9537('0x3e')]['findAll'](_0x150ae1);})['then'](function(_0xa3f728){_0xb730f1[_0x9537('0x3f')]=_0xa3f728;return _0xb730f1;})['then'](respondWithFilteredResult(_0x49f657,_0x150ae1))[_0x9537('0x40')](handleError(_0x49f657,null));};exports['show']=function(_0xfde682,_0x5b72ad){var _0x412875={'raw':!![],'where':{'id':_0xfde682[_0x9537('0x41')]['id']}},_0x19408f={};_0x19408f[_0x9537('0x2e')]=_[_0x9537('0x42')](db[_0x9537('0x3e')][_0x9537('0x29')]);_0x19408f[_0x9537('0x2c')]=_['keys'](_0xfde682[_0x9537('0x2c')]);_0x19408f[_0x9537('0x35')]=_[_0x9537('0x43')](_0x19408f[_0x9537('0x2e')],_0x19408f[_0x9537('0x2c')]);_0x412875['attributes']=_[_0x9537('0x43')](_0x19408f['model'],qs['fields'](_0xfde682[_0x9537('0x2c')][_0x9537('0x2f')]));_0x412875[_0x9537('0x2d')]=_0x412875[_0x9537('0x2d')][_0x9537('0x44')]?_0x412875[_0x9537('0x2d')]:_0x19408f['model'];if(_0xfde682['query'][_0x9537('0x3c')]){_0x412875[_0x9537('0x3d')]=[{'all':!![]}];}_0x412875=_['merge']({},_0x412875,_0xfde682['options']);return db[_0x9537('0x3e')][_0x9537('0x45')](_0x412875)[_0x9537('0x23')](handleEntityNotFound(_0x5b72ad,null))['then'](respondWithResult(_0x5b72ad,null))[_0x9537('0x40')](handleError(_0x5b72ad,null));};exports['update']=function(_0x1a322a,_0x51c1fe){if(_0x1a322a[_0x9537('0x46')]['id']){delete _0x1a322a['body']['id'];}return db['CmCustomField'][_0x9537('0x45')]({'where':{'id':_0x1a322a['params']['id']}})[_0x9537('0x23')](handleEntityNotFound(_0x51c1fe,null))[_0x9537('0x23')](saveUpdates(_0x1a322a[_0x9537('0x46')],null))[_0x9537('0x23')](respondWithResult(_0x51c1fe,null))[_0x9537('0x40')](handleError(_0x51c1fe,null));};exports['destroy']=function(_0x446b3c,_0x1c9ed5){return db['CmCustomField'][_0x9537('0x45')]({'where':{'id':_0x446b3c['params']['id']}})['then'](handleEntityNotFound(_0x1c9ed5,null))[_0x9537('0x23')](removeEntity(_0x1c9ed5,null))[_0x9537('0x40')](handleError(_0x1c9ed5,null));};exports[_0x9537('0x47')]=function(_0x10ecb4,_0x3d718a){var _0x12f74f;return db[_0x9537('0x48')]['transaction'](function(_0x192173){return db[_0x9537('0x3e')]['create'](_0x10ecb4[_0x9537('0x46')],{'transaction':_0x192173})[_0x9537('0x23')](function(_0x1afa1d){_0x12f74f=_0x1afa1d;var _0x25d688={'type':db[_0x9537('0x49')]['TEXT'],'transaction':_0x192173};switch(_0x10ecb4[_0x9537('0x46')][_0x9537('0x39')]){case'text':_0x25d688['type']=db[_0x9537('0x49')][_0x9537('0x4a')];break;case _0x9537('0x4b'):_0x25d688['type']=db[_0x9537('0x49')][_0x9537('0x4c')];break;case _0x9537('0x4d'):_0x25d688[_0x9537('0x39')]=db[_0x9537('0x49')][_0x9537('0x4e')];_0x25d688['defaultValue']=![];break;default:}return db[_0x9537('0x48')][_0x9537('0x4f')][_0x9537('0x50')]('cm_contacts',util[_0x9537('0x51')](_0x9537('0x52'),_0x12f74f['id']),_0x25d688);})['then'](function(){return _0x12f74f;});})[_0x9537('0x23')](respondWithResult(_0x3d718a,0xc9))[_0x9537('0x40')](handleError(_0x3d718a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2f58273..3a9b69e 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 _0x0149=['exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x0149,0x157));var _0x9014=function(_0x45af51,_0x534abe){_0x45af51=_0x45af51-0x0;var _0x566e23=_0x0149[_0x45af51];return _0x566e23;};'use strict';var _=require(_0x9014('0x0'));var util=require('util');var logger=require(_0x9014('0x1'))('api');var moment=require(_0x9014('0x2'));var BPromise=require(_0x9014('0x3'));var rp=require(_0x9014('0x4'));var fs=require('fs');var path=require(_0x9014('0x5'));var rimraf=require(_0x9014('0x6'));var config=require(_0x9014('0x7'));var attributes=require(_0x9014('0x8'));module[_0x9014('0x9')]=function(_0x306c61,_0x28cbc4){return _0x306c61[_0x9014('0xa')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dc0=['api','moment','bluebird','path','rimraf','./cmCustomField.attributes','define','CmCustomField','util','../../config/logger'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6dc0,0x1e8));var _0x06dc=function(_0x2ea59c,_0xc3b86){_0x2ea59c=_0x2ea59c-0x0;var _0x42cbe2=_0x6dc0[_0x2ea59c];return _0x42cbe2;};'use strict';var _=require('lodash');var util=require(_0x06dc('0x0'));var logger=require(_0x06dc('0x1'))(_0x06dc('0x2'));var moment=require(_0x06dc('0x3'));var BPromise=require(_0x06dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06dc('0x5'));var rimraf=require(_0x06dc('0x6'));var config=require('../../config/environment');var attributes=require(_0x06dc('0x7'));module['exports']=function(_0x36a747,_0x322049){return _0x36a747[_0x06dc('0x8')](_0x06dc('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 421d2c0..d09c74f 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 _0xd162=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment'];(function(_0x5b2cd5,_0x126ca7){var _0x4b8e1b=function(_0x461931){while(--_0x461931){_0x5b2cd5['push'](_0x5b2cd5['shift']());}};_0x4b8e1b(++_0x126ca7);}(_0xd162,0x96));var _0x2d16=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xd162[_0x55821d];return _0x58ea8a;};'use strict';var _=require(_0x2d16('0x0'));var util=require('util');var moment=require(_0x2d16('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d16('0x2'))['db'];var utils=require(_0x2d16('0x3'));var logger=require(_0x2d16('0x4'))(_0x2d16('0x5'));var config=require(_0x2d16('0x6'));var jayson=require(_0x2d16('0x7'));var client=jayson['client'][_0x2d16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33b8cd,_0x192634,_0x236ccf){return new BPromise(function(_0x10e1fc,_0x408e29){return client[_0x2d16('0x9')](_0x33b8cd,_0x236ccf)[_0x2d16('0xa')](function(_0x2dddab){logger[_0x2d16('0xb')](_0x2d16('0xc'),_0x192634,'request\x20sent');logger[_0x2d16('0xd')](_0x2d16('0xe'),_0x192634,_0x2d16('0xf'),JSON['stringify'](_0x2dddab));if(_0x2dddab[_0x2d16('0x10')]){if(_0x2dddab[_0x2d16('0x10')]['code']===0x1f4){logger[_0x2d16('0x10')]('CmCustomField,\x20%s,\x20%s',_0x192634,_0x2dddab[_0x2d16('0x10')][_0x2d16('0x11')]);return _0x408e29(_0x2dddab[_0x2d16('0x10')]['message']);}logger[_0x2d16('0x10')](_0x2d16('0xc'),_0x192634,_0x2dddab[_0x2d16('0x10')][_0x2d16('0x11')]);return _0x10e1fc(_0x2dddab['error'][_0x2d16('0x11')]);}else{logger['info'](_0x2d16('0xc'),_0x192634,'request\x20sent');_0x10e1fc(_0x2dddab[_0x2d16('0x12')][_0x2d16('0x11')]);}})['catch'](function(_0xde5f32){logger[_0x2d16('0x10')](_0x2d16('0xc'),_0x192634,_0xde5f32);_0x408e29(_0xde5f32);});});} \ No newline at end of file +var _0xea79=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x3a0a7c,_0x4483b7){var _0x52a0a3=function(_0x31e253){while(--_0x31e253){_0x3a0a7c['push'](_0x3a0a7c['shift']());}};_0x52a0a3(++_0x4483b7);}(_0xea79,0x162));var _0x9ea7=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xea79[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ea7('0x0'));var BPromise=require(_0x9ea7('0x1'));var rs=require(_0x9ea7('0x2'));var fs=require('fs');var Redis=require(_0x9ea7('0x3'));var db=require(_0x9ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea7('0x5'))(_0x9ea7('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ea7('0x7'));var client=jayson[_0x9ea7('0x8')][_0x9ea7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26462b,_0x9cd535,_0x527f09){return new BPromise(function(_0x1ef059,_0x9ae1f5){return client[_0x9ea7('0xa')](_0x26462b,_0x527f09)['then'](function(_0x3be103){logger[_0x9ea7('0xb')]('CmCustomField,\x20%s,\x20%s',_0x9cd535,_0x9ea7('0xc'));logger[_0x9ea7('0xd')](_0x9ea7('0xe'),_0x9cd535,_0x9ea7('0xc'),JSON[_0x9ea7('0xf')](_0x3be103));if(_0x3be103[_0x9ea7('0x10')]){if(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x11')]===0x1f4){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);return _0x9ae1f5(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3be103[_0x9ea7('0x10')]['message']);return _0x1ef059(_0x3be103[_0x9ea7('0x10')][_0x9ea7('0x13')]);}else{logger[_0x9ea7('0xb')](_0x9ea7('0x12'),_0x9cd535,'request\x20sent');_0x1ef059(_0x3be103[_0x9ea7('0x14')][_0x9ea7('0x13')]);}})['catch'](function(_0x3e22fc){logger[_0x9ea7('0x10')](_0x9ea7('0x12'),_0x9cd535,_0x3e22fc);_0x9ae1f5(_0x3e22fc);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3e77423..dc3b772 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 _0x83c8=['isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x83c8,0x8a));var _0x883c=function(_0x5139bb,_0x3fb5f4){_0x5139bb=_0x5139bb-0x0;var _0x306e2a=_0x83c8[_0x5139bb];return _0x306e2a;};'use strict';var multer=require(_0x883c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x883c('0x1'));var express=require('express');var router=express[_0x883c('0x2')]();var fs_extra=require(_0x883c('0x3'));var auth=require(_0x883c('0x4'));var interaction=require(_0x883c('0x5'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x883c('0x6')](),controller[_0x883c('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x883c('0x8')]);router['post']('/',auth[_0x883c('0x6')](),controller[_0x883c('0x9')]);router[_0x883c('0xa')]('/:id',auth[_0x883c('0x6')](),controller[_0x883c('0xb')]);router[_0x883c('0xc')](_0x883c('0xd'),auth['isAuthenticated'](),controller[_0x883c('0xe')]);module[_0x883c('0xf')]=router; \ No newline at end of file +var _0xa423=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3fa8b4,_0x502307){var _0x30fed7=function(_0x39ff17){while(--_0x39ff17){_0x3fa8b4['push'](_0x3fa8b4['shift']());}};_0x30fed7(++_0x502307);}(_0xa423,0x16c));var _0x3a42=function(_0x1e3128,_0x44f7b6){_0x1e3128=_0x1e3128-0x0;var _0x55755f=_0xa423[_0x1e3128];return _0x55755f;};'use strict';var multer=require(_0x3a42('0x0'));var util=require(_0x3a42('0x1'));var path=require(_0x3a42('0x2'));var timeout=require(_0x3a42('0x3'));var express=require(_0x3a42('0x4'));var router=express['Router']();var fs_extra=require(_0x3a42('0x5'));var auth=require(_0x3a42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a42('0x7'));var controller=require(_0x3a42('0x8'));router[_0x3a42('0x9')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xb')]);router['get'](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0xd')]);router[_0x3a42('0xe')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xf')]);router[_0x3a42('0x10')](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0x11')]);router[_0x3a42('0x12')]('/:id',auth[_0x3a42('0xa')](),controller[_0x3a42('0x13')]);module[_0x3a42('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index e2c4d40..0328917 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 _0xe31e=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','DATE','moment','sequelize'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe31e,0x13e));var _0xee31=function(_0x44f09e,_0x405bfb){_0x44f09e=_0x44f09e-0x0;var _0x3744f7=_0xe31e[_0x44f09e];return _0x3744f7;};'use strict';var moment=require(_0xee31('0x0'));var Sequelize=require(_0xee31('0x1'));module[_0xee31('0x2')]={'phone':{'type':Sequelize[_0xee31('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xee31('0x4')](_0xee31('0x5'))},'countbusyretry':{'type':Sequelize[_0xee31('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee31('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xee31('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee31('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xee31('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xee31('0x6')],'unique':_0xee31('0x8')},'ListId':{'type':Sequelize[_0xee31('0x6')],'unique':_0xee31('0x8')},'UserId':{'type':Sequelize[_0xee31('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xee31('0x6')],'unique':_0xee31('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xee31('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee31('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee31('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xee31('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xee31('0x9')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xbbe3=['sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x450695,_0x4f9c8a){var _0x36188f=function(_0x2a12e1){while(--_0x2a12e1){_0x450695['push'](_0x450695['shift']());}};_0x36188f(++_0x4f9c8a);}(_0xbbe3,0x132));var _0x3bbe=function(_0xfc4247,_0x2ecea5){_0xfc4247=_0xfc4247-0x0;var _0x1fd11f=_0xbbe3[_0xfc4247];return _0x1fd11f;};'use strict';var moment=require('moment');var Sequelize=require(_0x3bbe('0x0'));module['exports']={'phone':{'type':Sequelize[_0x3bbe('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3bbe('0x3')],'defaultValue':moment()[_0x3bbe('0x4')](_0x3bbe('0x5'))},'countbusyretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3bbe('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x3bbe('0x6')](0x2)[_0x3bbe('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3bbe('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3bbe('0x6')],'unique':_0x3bbe('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x3bbe('0x6')],'unique':_0x3bbe('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3bbe('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3bbe('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3bbe('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3bbe('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index d98b576..4c5e7cb 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 _0xcb66=['Company','CmList','List','getVoiceQueues','preview','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','update','then','sendStatus','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','rows','show','params','include','options','create','body','find','catch','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','outbound','dialOrderByScheduledAt','sequelize','transaction','value','direction','prev','isEmpty','priority','ASC','scheduledAt','DESC','literal','hopperIds','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','VoiceQueue','Queue','dialActive','getPreviewRecall','Contact'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0xcb66,0x19f));var _0x6cb6=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xcb66[_0x549278];return _0x1ea9a1;};'use strict';var moment=require('moment');var _=require(_0x6cb6('0x0'));var qs=require(_0x6cb6('0x1'));var logger=require(_0x6cb6('0x2'))(_0x6cb6('0x3'));var shared=require(_0x6cb6('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0xe996ed,_0x2d7dbb){_0x2d7dbb=_0x2d7dbb||0xc8;return function(_0x24660c){if(_0x24660c){return _0xe996ed[_0x6cb6('0x5')](_0x2d7dbb)[_0x6cb6('0x6')](_0x24660c);}};}function respondWithFilteredResult(_0x506d14,_0x53078d){return function(_0x174f39){if(_0x174f39){var _0x1595c9=typeof _0x53078d[_0x6cb6('0x7')]===_0x6cb6('0x8')&&typeof _0x53078d[_0x6cb6('0x9')]===_0x6cb6('0x8');var _0x3a5927=_0x174f39[_0x6cb6('0xa')];var _0x332bce=_0x1595c9?0x0:_0x53078d[_0x6cb6('0x7')];var _0x3aa2b5=_0x1595c9?_0x174f39[_0x6cb6('0xa')]:_0x53078d[_0x6cb6('0x7')]+_0x53078d['limit'];var _0x4923a2;if(_0x3aa2b5>=_0x3a5927){_0x3aa2b5=_0x3a5927;_0x4923a2=0xc8;}else{_0x4923a2=0xce;}_0x506d14['status'](_0x4923a2);return _0x506d14['set'](_0x6cb6('0xb'),_0x332bce+'-'+_0x3aa2b5+'/'+_0x3a5927)[_0x6cb6('0x6')](_0x174f39);}return null;};}function saveUpdates(_0xad49d9,_0x2604e7){return function(_0x585233){if(_0x585233){return _0x585233[_0x6cb6('0xc')](_0xad49d9)[_0x6cb6('0xd')](function(_0x57ee3b){return _0x57ee3b;});}return null;};}function handleEntityNotFound(_0x1e5468,_0x14a581){return function(_0x5af476){if(!_0x5af476){_0x1e5468[_0x6cb6('0xe')](0x194);}return _0x5af476;};}function handleError(_0x26b46b,_0x492629){_0x492629=_0x492629||0x1f4;return function(_0x5ab865){logger['error'](_0x5ab865['stack']);if(_0x5ab865[_0x6cb6('0xf')]){delete _0x5ab865[_0x6cb6('0xf')];}_0x26b46b[_0x6cb6('0x5')](_0x492629)[_0x6cb6('0x10')](_0x5ab865);};}exports[_0x6cb6('0x11')]=function(_0x40d445,_0x5b8a17){var _0x1e8b7e={},_0xc0bdea={},_0x57c4f4={'count':0x0,'rows':[]};var _0x4b9da5=_['map'](db['CmHopper']['rawAttributes'],function(_0x5e5349){return{'name':_0x5e5349[_0x6cb6('0x12')],'type':_0x5e5349[_0x6cb6('0x13')][_0x6cb6('0x14')]};});_0xc0bdea[_0x6cb6('0x15')]=_[_0x6cb6('0x16')](_0x4b9da5,'name');_0xc0bdea['query']=_[_0x6cb6('0x17')](_0x40d445[_0x6cb6('0x18')]);_0xc0bdea[_0x6cb6('0x19')]=_[_0x6cb6('0x1a')](_0xc0bdea['model'],_0xc0bdea[_0x6cb6('0x18')]);_0xc0bdea[_0x6cb6('0x19')]=_['concat'](_0xc0bdea['filters'],[_0x6cb6('0x1b'),'$or',_0x6cb6('0x1c'),_0x6cb6('0x1d'),_0x6cb6('0x1e'),_0x6cb6('0x1f'),_0x6cb6('0x20'),_0x6cb6('0x21'),_0x6cb6('0x22'),_0x6cb6('0x23'),_0x6cb6('0x24'),_0x6cb6('0x25'),'$notIn','$like','$notLike',_0x6cb6('0x26'),_0x6cb6('0x27'),_0x6cb6('0x28'),_0x6cb6('0x29'),_0x6cb6('0x2a'),_0x6cb6('0x2b'),'$any']);_0x1e8b7e[_0x6cb6('0x2c')]=_['intersection'](_0xc0bdea[_0x6cb6('0x15')],qs['fields'](_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x2d')]));_0x1e8b7e[_0x6cb6('0x2c')]=_0x1e8b7e['attributes'][_0x6cb6('0x2e')]?_0x1e8b7e[_0x6cb6('0x2c')]:_0xc0bdea[_0x6cb6('0x15')];if(!_0x40d445['query'][_0x6cb6('0x2f')](_0x6cb6('0x30'))){_0x1e8b7e[_0x6cb6('0x9')]=qs['limit'](_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x9')]);_0x1e8b7e['offset']=qs[_0x6cb6('0x7')](_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x7')]);}_0x1e8b7e[_0x6cb6('0x31')]=qs[_0x6cb6('0x32')](_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x32')]);_0x1e8b7e[_0x6cb6('0x33')]=qs[_0x6cb6('0x19')](_[_0x6cb6('0x34')](_0x40d445['query'],_0xc0bdea[_0x6cb6('0x19')]),_0x4b9da5);if(_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x35')]){_0x1e8b7e[_0x6cb6('0x33')]=_['merge'](_0x1e8b7e['where'],{'$or':_['map'](_0x4b9da5,function(_0x3504ef){if(_0x3504ef[_0x6cb6('0x13')]!==_0x6cb6('0x36')){var _0x39b543={};_0x39b543[_0x3504ef[_0x6cb6('0xf')]]={'$like':'%'+_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x35')]+'%'};return _0x39b543;}})});}_0x1e8b7e=_[_0x6cb6('0x37')]({},_0x1e8b7e,_0x40d445['options']);var _0x44d970={'where':_0x1e8b7e['where']};return db[_0x6cb6('0x38')][_0x6cb6('0xa')](_0x44d970)[_0x6cb6('0xd')](function(_0x20a881){_0x57c4f4[_0x6cb6('0xa')]=_0x20a881;if(_0x40d445[_0x6cb6('0x18')][_0x6cb6('0x39')]){_0x1e8b7e['include']=[{'all':!![]}];}return db[_0x6cb6('0x38')]['findAll'](_0x1e8b7e);})[_0x6cb6('0xd')](function(_0x18a4a1){_0x57c4f4[_0x6cb6('0x3a')]=_0x18a4a1;return _0x57c4f4;})['then'](respondWithFilteredResult(_0x5b8a17,_0x1e8b7e))['catch'](handleError(_0x5b8a17,null));};exports[_0x6cb6('0x3b')]=function(_0x55c9c4,_0x1d8157){var _0x296a3b={'raw':!![],'where':{'id':_0x55c9c4[_0x6cb6('0x3c')]['id']}},_0xac22c9={};_0xac22c9[_0x6cb6('0x15')]=_[_0x6cb6('0x17')](db[_0x6cb6('0x38')]['rawAttributes']);_0xac22c9[_0x6cb6('0x18')]=_[_0x6cb6('0x17')](_0x55c9c4['query']);_0xac22c9[_0x6cb6('0x19')]=_[_0x6cb6('0x1a')](_0xac22c9[_0x6cb6('0x15')],_0xac22c9[_0x6cb6('0x18')]);_0x296a3b[_0x6cb6('0x2c')]=_[_0x6cb6('0x1a')](_0xac22c9['model'],qs['fields'](_0x55c9c4[_0x6cb6('0x18')]['fields']));_0x296a3b['attributes']=_0x296a3b[_0x6cb6('0x2c')]['length']?_0x296a3b[_0x6cb6('0x2c')]:_0xac22c9[_0x6cb6('0x15')];if(_0x55c9c4['query']['includeAll']){_0x296a3b[_0x6cb6('0x3d')]=[{'all':!![]}];}_0x296a3b=_['merge']({},_0x296a3b,_0x55c9c4[_0x6cb6('0x3e')]);return db[_0x6cb6('0x38')]['find'](_0x296a3b)[_0x6cb6('0xd')](handleEntityNotFound(_0x1d8157,null))[_0x6cb6('0xd')](respondWithResult(_0x1d8157,null))['catch'](handleError(_0x1d8157,null));};exports[_0x6cb6('0x3f')]=function(_0x5b560d,_0x111046){return db[_0x6cb6('0x38')]['create'](_0x5b560d[_0x6cb6('0x40')],{})[_0x6cb6('0xd')](respondWithResult(_0x111046,0xc9))['catch'](handleError(_0x111046,null));};exports['update']=function(_0x165f0e,_0x22dcc5){if(_0x165f0e[_0x6cb6('0x40')]['id']){delete _0x165f0e['body']['id'];}return db[_0x6cb6('0x38')][_0x6cb6('0x41')]({'where':{'id':_0x165f0e['params']['id']}})[_0x6cb6('0xd')](handleEntityNotFound(_0x22dcc5,null))[_0x6cb6('0xd')](saveUpdates(_0x165f0e[_0x6cb6('0x40')],null))['then'](respondWithResult(_0x22dcc5,null))[_0x6cb6('0x42')](handleError(_0x22dcc5,null));};exports[_0x6cb6('0x43')]=function(_0x42dc72,_0x12bd7f){return db[_0x6cb6('0x38')][_0x6cb6('0x43')]()['then'](respondWithResult(_0x12bd7f,null))[_0x6cb6('0x42')](handleError(_0x12bd7f,null));};exports['destroy']=function(_0x4c3a3a,_0x29cb39){var _0x3eb117;var _0x4b4137=_0x4c3a3a[_0x6cb6('0x3c')]['id'];return db['CmHopper'][_0x6cb6('0x41')]({'where':{'id':_0x4c3a3a[_0x6cb6('0x3c')]['id']}})[_0x6cb6('0xd')](handleEntityNotFound(_0x29cb39,null))['then'](function(_0x394f72){if(_0x394f72){return _0x394f72[_0x6cb6('0x44')]()[_0x6cb6('0xd')](function(_0x567d52){return _0x567d52;});}})[_0x6cb6('0xd')](function(_0x5b9a06){_0x3eb117=_0x5b9a06;if(_0x5b9a06){if(_0x5b9a06[_0x6cb6('0x45')]||_0x5b9a06[_0x6cb6('0x46')]){return db[_0x5b9a06[_0x6cb6('0x45')]?'VoiceQueue':'Campaign'][_0x6cb6('0x41')]({'where':{'id':_0x5b9a06[_0x6cb6('0x45')]?_0x5b9a06[_0x6cb6('0x45')]:_0x5b9a06['CampaignId']},'attributes':['id',_0x6cb6('0xf')],'raw':!![]});}}})[_0x6cb6('0xd')](function(_0x4567ae){var _0x486b3e={};if(_0x4567ae){_[_0x6cb6('0x37')](_0x486b3e,_[_0x6cb6('0x47')](_0x3eb117[_0x6cb6('0x48')],['createdAt',_0x6cb6('0x49'),'id']));_0x486b3e[_0x6cb6('0x4a')]=0x15;_0x486b3e[_0x6cb6('0x4b')]=_0x6cb6('0x4c');_0x486b3e[_0x6cb6('0x4d')]=_0x4567ae[_0x6cb6('0xf')];_0x486b3e[_0x6cb6('0x4e')]=_0x4c3a3a[_0x6cb6('0x4f')][_0x6cb6('0xf')];_0x486b3e[_0x6cb6('0x50')]=_0x4c3a3a[_0x6cb6('0x4f')]['id'];_0x486b3e[_0x6cb6('0x4c')]=!![];_0x486b3e['deletedat']=moment()[_0x6cb6('0x51')](_0x6cb6('0x52'));_0x486b3e['calleridnum']=_0x3eb117[_0x6cb6('0x53')];_0x486b3e[_0x6cb6('0x54')]=_0x3eb117['VoiceQueueId']?_0x6cb6('0x55'):_0x6cb6('0x56');return db[_0x6cb6('0x57')]['find']({'where':{'id':_0x486b3e[_0x6cb6('0x58')]},'attributes':[_0x6cb6('0x59'),_0x6cb6('0x5a')]})[_0x6cb6('0xd')](function(_0x27ec34){if(!_[_0x6cb6('0x5b')](_0x29cb39)&&!_[_0x6cb6('0x5b')](_0x27ec34[_0x6cb6('0x59')])){_0x486b3e[_0x6cb6('0x5c')]=_0x27ec34[_0x6cb6('0x59')];if(!_['isNil'](_0x27ec34[_0x6cb6('0x5a')])){_0x486b3e[_0x6cb6('0x5c')]+='\x20'+_0x27ec34['lastName'];}}})[_0x6cb6('0x5d')](function(){return db['CmHopperFinal']['create'](_0x486b3e);});}})[_0x6cb6('0xd')](function(_0x28096c){return db[_0x6cb6('0x5e')][_0x6cb6('0x44')]({'where':{'CmHopperId':_0x4b4137}});})[_0x6cb6('0xd')](function(){return _0x29cb39['status'](0xcc)[_0x6cb6('0x5f')]();})[_0x6cb6('0x42')](handleError(_0x29cb39,null));};exports['getPreview']=function(_0x2e9ff9,_0x43084b){var _0x39b7c8=[];return db['CmContact'][_0x6cb6('0x43')]()[_0x6cb6('0xd')](function(_0x2b80cc){_0x39b7c8=_[_0x6cb6('0x17')](_0x2b80cc);return _0x2e9ff9[_0x6cb6('0x4f')]['getVoiceQueues']({'where':{'type':_0x6cb6('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x6cb6('0x61'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x6cb6('0xd')](function(_0x4730b0){if(_0x4730b0&&_0x4730b0[_0x6cb6('0x2e')]){return db[_0x6cb6('0x62')][_0x6cb6('0x63')](function(_0x5b7de3){var _0x38a57b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6cb6('0x51')](_0x6cb6('0x52'))},'VoiceQueueId':{'$in':_[_0x6cb6('0x16')](_0x4730b0,'id')},'$or':[{'UserId':null},{'UserId':_0x2e9ff9[_0x6cb6('0x4f')]['id']}]};var _0x342bf0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4730b0)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x6cb6('0x16')]('id')[_0x6cb6('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x2e9ff9[_0x6cb6('0x4f')]['id']}]};var _0x5280aa={'$or':[_0x38a57b,_0x342bf0]};var _0x29e6ee=[];if(_0x2e9ff9[_0x6cb6('0x40')][_0x6cb6('0x65')]&&_0x2e9ff9['body'][_0x6cb6('0x65')]===_0x6cb6('0x66')){if(!_[_0x6cb6('0x67')](_0x2e9ff9[_0x6cb6('0x40')]['hopperIds'])){_0x5280aa['id']={'$in':_0x2e9ff9[_0x6cb6('0x40')]['hopperIds']};}_0x29e6ee=[[_0x6cb6('0x68'),_0x6cb6('0x69')],[_0x6cb6('0x6a'),_0x4730b0[0x0]['dialOrderByScheduledAt']==='ASC'?_0x6cb6('0x6b'):_0x6cb6('0x69')],db['sequelize'][_0x6cb6('0x6c')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x6cb6('0x6b')]];}else{if(!_['isEmpty'](_0x2e9ff9['body']['hopperIds'])){_0x5280aa['id']={'$notIn':_0x2e9ff9[_0x6cb6('0x40')][_0x6cb6('0x6d')]};}_0x29e6ee=[[_0x6cb6('0x68'),_0x6cb6('0x6b')],['scheduledAt',_0x4730b0[0x0]['dialOrderByScheduledAt']],db[_0x6cb6('0x62')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6cb6('0x69')]];}return db[_0x6cb6('0x38')][_0x6cb6('0x6e')]({'attributes':['id',_0x6cb6('0x6f'),'phone',_0x6cb6('0x70')],'where':_0x5280aa,'order':_0x29e6ee,'transaction':_0x5b7de3,'lock':_0x5b7de3[_0x6cb6('0x71')][_0x6cb6('0x72')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x39b7c8,'include':[{'model':db[_0x6cb6('0x73')],'as':'Company','attributes':['id',_0x6cb6('0xf')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6cb6('0xf')]},{'model':db[_0x6cb6('0x74')],'as':_0x6cb6('0x75'),'attributes':['id',_0x6cb6('0xf'),_0x6cb6('0x76')]}]})[_0x6cb6('0xd')](function(_0xd2db31){if(_0xd2db31){return _0xd2db31[_0x6cb6('0xc')]({'UserId':_0x2e9ff9['user']['id']},{'transaction':_0x5b7de3});}});});}})[_0x6cb6('0xd')](handleEntityNotFound(_0x43084b,null))[_0x6cb6('0xd')](respondWithResult(_0x43084b,null))[_0x6cb6('0x42')](handleError(_0x43084b,null));};exports[_0x6cb6('0x77')]=function(_0x2525da,_0x1282c4,_0x27b851){var _0xeaa6ab=[];var _0x285c9b=_0x2525da['params']['id'];var _0x5bfcc8=_0x2525da['user']['id'];return db['CmContact'][_0x6cb6('0x43')]()['then'](function(_0x3d30d0){_0xeaa6ab=_[_0x6cb6('0x17')](_0x3d30d0);return db[_0x6cb6('0x62')][_0x6cb6('0x63')](function(_0x11c027){const _0x33fef3={'id':_0x285c9b};return db[_0x6cb6('0x38')][_0x6cb6('0x6e')]({'attributes':['id',_0x6cb6('0x6f'),_0x6cb6('0x70')],'where':_0x33fef3,'transaction':_0x11c027,'lock':_0x11c027[_0x6cb6('0x71')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6cb6('0x78'),'attributes':_0xeaa6ab,'include':[{'model':db[_0x6cb6('0x73')],'as':_0x6cb6('0x79'),'attributes':['id',_0x6cb6('0xf')]}]},{'model':db[_0x6cb6('0x7a')],'as':_0x6cb6('0x7b'),'attributes':['id','name']},{'model':db[_0x6cb6('0x74')],'as':'Queue','attributes':['id',_0x6cb6('0xf'),_0x6cb6('0x76')]}]})[_0x6cb6('0xd')](function(_0x12a9c1){if(_0x12a9c1){return _0x12a9c1[_0x6cb6('0xc')]({'UserId':_0x5bfcc8},{'transaction':_0x11c027});}});});})[_0x6cb6('0xd')](handleEntityNotFound(_0x1282c4,null))[_0x6cb6('0xd')](respondWithResult(_0x1282c4,null))['catch'](handleError(_0x1282c4,null));};exports['getOpenContacts']=function(_0x527665,_0x3c28a3){return _0x527665[_0x6cb6('0x4f')][_0x6cb6('0x7c')]({'where':{'type':_0x6cb6('0x60'),'dialActive':!![],'dialMethod':_0x6cb6('0x7d')},'attributes':['id'],'raw':!![]})[_0x6cb6('0xd')](function(_0x2b00ad){if(_0x2b00ad&&_0x2b00ad[_0x6cb6('0x2e')]){return db[_0x6cb6('0x38')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6cb6('0x51')](_0x6cb6('0x52'))},'VoiceQueueId':{'$in':_[_0x6cb6('0x16')](_0x2b00ad,'id')},'$or':[{'UserId':null},{'UserId':_0x527665[_0x6cb6('0x4f')]['id']}]}});}return 0x0;})[_0x6cb6('0xd')](function(_0x5ff586){if(!_[_0x6cb6('0x5b')](_0x5ff586)&&_['isNumber'](_0x5ff586)){return _0x3c28a3[_0x6cb6('0x5')](0xc8)[_0x6cb6('0x6')]({'contacts':_0x5ff586});}else{logger[_0x6cb6('0x7e')](_0x6cb6('0x7f'),_0x6cb6('0x80'),0x194,'entity\x20not\x20found');_0x3c28a3[_0x6cb6('0xe')](0x194);}})[_0x6cb6('0x42')](handleError(_0x3c28a3,null));};exports[_0x6cb6('0x81')]=function(_0x13e1e2,_0x208f7b){var _0x53e4e3=shared[_0x6cb6('0x82')];var _0x39d662=[];_[_0x6cb6('0x16')](_0x53e4e3,function(_0x187fcc){_0x39d662[_0x6cb6('0x83')]({'id':_0x187fcc[_0x6cb6('0xf')],'name':_0x187fcc[_0x6cb6('0xf')],'utcOffset':_0x187fcc[_0x6cb6('0x84')]});});return _0x208f7b[_0x6cb6('0x5')](0xc8)[_0x6cb6('0x6')]({'tz':_0x39d662});};exports[_0x6cb6('0x85')]=function(_0x1321d4,_0x4c3672){var _0x3bdddb=shared['timezones'];var _0x49a7b7={};if(!_['isNil'](_0x3bdddb[_0x1321d4[_0x6cb6('0x40')]['id']]))_0x49a7b7=_0x3bdddb[_0x1321d4['body']['id']];return _0x4c3672[_0x6cb6('0x5')](0xc8)[_0x6cb6('0x6')](_0x49a7b7);}; \ No newline at end of file +var _0x86f4=['$notIn','$like','$notLike','$iLike','$notILike','$any','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','getPreviewRecall','LOCK','CmList','dialActive','getOpenContacts','getVoiceQueues','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','limit','undefined','count','status','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in'];(function(_0x3e7623,_0x131adc){var _0x29b12a=function(_0x1a4437){while(--_0x1a4437){_0x3e7623['push'](_0x3e7623['shift']());}};_0x29b12a(++_0x131adc);}(_0x86f4,0x18a));var _0x486f=function(_0x47e0d9,_0x193567){_0x47e0d9=_0x47e0d9-0x0;var _0x5ea6e3=_0x86f4[_0x47e0d9];return _0x5ea6e3;};'use strict';var moment=require(_0x486f('0x0'));var _=require(_0x486f('0x1'));var qs=require(_0x486f('0x2'));var logger=require(_0x486f('0x3'))(_0x486f('0x4'));var shared=require(_0x486f('0x5'));var db=require(_0x486f('0x6'))['db'];function respondWithResult(_0x53305d,_0xf8d50f){_0xf8d50f=_0xf8d50f||0xc8;return function(_0x1539b1){if(_0x1539b1){return _0x53305d['status'](_0xf8d50f)[_0x486f('0x7')](_0x1539b1);}};}function respondWithFilteredResult(_0x1adb27,_0x39f767){return function(_0x207201){if(_0x207201){var _0x3c6469=typeof _0x39f767[_0x486f('0x8')]==='undefined'&&typeof _0x39f767[_0x486f('0x9')]===_0x486f('0xa');var _0x37975a=_0x207201[_0x486f('0xb')];var _0x377d09=_0x3c6469?0x0:_0x39f767[_0x486f('0x8')];var _0x19ccdd=_0x3c6469?_0x207201[_0x486f('0xb')]:_0x39f767[_0x486f('0x8')]+_0x39f767[_0x486f('0x9')];var _0xb57b8c;if(_0x19ccdd>=_0x37975a){_0x19ccdd=_0x37975a;_0xb57b8c=0xc8;}else{_0xb57b8c=0xce;}_0x1adb27[_0x486f('0xc')](_0xb57b8c);return _0x1adb27[_0x486f('0xd')](_0x486f('0xe'),_0x377d09+'-'+_0x19ccdd+'/'+_0x37975a)[_0x486f('0x7')](_0x207201);}return null;};}function saveUpdates(_0x4312fb,_0x1c4e55){return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4eb4f9[_0x486f('0xf')](_0x4312fb)['then'](function(_0x46d0a9){return _0x46d0a9;});}return null;};}function handleEntityNotFound(_0x2cc608,_0x1ac871){return function(_0x50bee8){if(!_0x50bee8){_0x2cc608['sendStatus'](0x194);}return _0x50bee8;};}function handleError(_0x11c2af,_0x3a4fef){_0x3a4fef=_0x3a4fef||0x1f4;return function(_0x51334f){logger[_0x486f('0x10')](_0x51334f[_0x486f('0x11')]);if(_0x51334f[_0x486f('0x12')]){delete _0x51334f['name'];}_0x11c2af['status'](_0x3a4fef)[_0x486f('0x13')](_0x51334f);};}exports[_0x486f('0x14')]=function(_0x360cb7,_0x39bfac){var _0x4e68d1={},_0x59deb8={},_0x268eb9={'count':0x0,'rows':[]};var _0x9518=_[_0x486f('0x15')](db[_0x486f('0x16')][_0x486f('0x17')],function(_0x243dbf){return{'name':_0x243dbf[_0x486f('0x18')],'type':_0x243dbf[_0x486f('0x19')][_0x486f('0x1a')]};});_0x59deb8[_0x486f('0x1b')]=_[_0x486f('0x15')](_0x9518,_0x486f('0x12'));_0x59deb8[_0x486f('0x1c')]=_[_0x486f('0x1d')](_0x360cb7[_0x486f('0x1c')]);_0x59deb8[_0x486f('0x1e')]=_['intersection'](_0x59deb8[_0x486f('0x1b')],_0x59deb8[_0x486f('0x1c')]);_0x59deb8[_0x486f('0x1e')]=_[_0x486f('0x1f')](_0x59deb8[_0x486f('0x1e')],[_0x486f('0x20'),_0x486f('0x21'),_0x486f('0x22'),_0x486f('0x23'),_0x486f('0x24'),_0x486f('0x25'),_0x486f('0x26'),_0x486f('0x27'),_0x486f('0x28'),_0x486f('0x29'),_0x486f('0x2a'),_0x486f('0x2b'),_0x486f('0x2c'),_0x486f('0x2d'),_0x486f('0x2e'),_0x486f('0x2f'),_0x486f('0x30'),'$like','$overlap','$contains','$contained',_0x486f('0x31')]);_0x4e68d1['attributes']=_[_0x486f('0x32')](_0x59deb8[_0x486f('0x1b')],qs['fields'](_0x360cb7[_0x486f('0x1c')]['fields']));_0x4e68d1[_0x486f('0x33')]=_0x4e68d1[_0x486f('0x33')][_0x486f('0x34')]?_0x4e68d1[_0x486f('0x33')]:_0x59deb8[_0x486f('0x1b')];if(!_0x360cb7[_0x486f('0x1c')]['hasOwnProperty'](_0x486f('0x35'))){_0x4e68d1[_0x486f('0x9')]=qs[_0x486f('0x9')](_0x360cb7[_0x486f('0x1c')][_0x486f('0x9')]);_0x4e68d1[_0x486f('0x8')]=qs[_0x486f('0x8')](_0x360cb7[_0x486f('0x1c')]['offset']);}_0x4e68d1[_0x486f('0x36')]=qs[_0x486f('0x37')](_0x360cb7['query'][_0x486f('0x37')]);_0x4e68d1[_0x486f('0x38')]=qs[_0x486f('0x1e')](_[_0x486f('0x39')](_0x360cb7[_0x486f('0x1c')],_0x59deb8['filters']),_0x9518);if(_0x360cb7[_0x486f('0x1c')][_0x486f('0x3a')]){_0x4e68d1[_0x486f('0x38')]=_[_0x486f('0x3b')](_0x4e68d1[_0x486f('0x38')],{'$or':_[_0x486f('0x15')](_0x9518,function(_0x2bbcd4){if(_0x2bbcd4['type']!==_0x486f('0x3c')){var _0x219e8a={};_0x219e8a[_0x2bbcd4[_0x486f('0x12')]]={'$like':'%'+_0x360cb7['query']['filter']+'%'};return _0x219e8a;}})});}_0x4e68d1=_[_0x486f('0x3b')]({},_0x4e68d1,_0x360cb7[_0x486f('0x3d')]);var _0x4b80f8={'where':_0x4e68d1[_0x486f('0x38')]};return db['CmHopper'][_0x486f('0xb')](_0x4b80f8)[_0x486f('0x3e')](function(_0x5ca543){_0x268eb9['count']=_0x5ca543;if(_0x360cb7[_0x486f('0x1c')][_0x486f('0x3f')]){_0x4e68d1[_0x486f('0x40')]=[{'all':!![]}];}return db[_0x486f('0x16')][_0x486f('0x41')](_0x4e68d1);})[_0x486f('0x3e')](function(_0x901b9){_0x268eb9[_0x486f('0x42')]=_0x901b9;return _0x268eb9;})[_0x486f('0x3e')](respondWithFilteredResult(_0x39bfac,_0x4e68d1))[_0x486f('0x43')](handleError(_0x39bfac,null));};exports[_0x486f('0x44')]=function(_0x737fee,_0x849116){var _0x43d9be={'raw':!![],'where':{'id':_0x737fee[_0x486f('0x45')]['id']}},_0x4f657e={};_0x4f657e[_0x486f('0x1b')]=_['keys'](db[_0x486f('0x16')][_0x486f('0x17')]);_0x4f657e[_0x486f('0x1c')]=_[_0x486f('0x1d')](_0x737fee[_0x486f('0x1c')]);_0x4f657e[_0x486f('0x1e')]=_[_0x486f('0x32')](_0x4f657e[_0x486f('0x1b')],_0x4f657e[_0x486f('0x1c')]);_0x43d9be['attributes']=_['intersection'](_0x4f657e[_0x486f('0x1b')],qs[_0x486f('0x46')](_0x737fee[_0x486f('0x1c')][_0x486f('0x46')]));_0x43d9be[_0x486f('0x33')]=_0x43d9be[_0x486f('0x33')][_0x486f('0x34')]?_0x43d9be[_0x486f('0x33')]:_0x4f657e[_0x486f('0x1b')];if(_0x737fee['query'][_0x486f('0x3f')]){_0x43d9be[_0x486f('0x40')]=[{'all':!![]}];}_0x43d9be=_[_0x486f('0x3b')]({},_0x43d9be,_0x737fee[_0x486f('0x3d')]);return db['CmHopper'][_0x486f('0x47')](_0x43d9be)['then'](handleEntityNotFound(_0x849116,null))[_0x486f('0x3e')](respondWithResult(_0x849116,null))[_0x486f('0x43')](handleError(_0x849116,null));};exports[_0x486f('0x48')]=function(_0x1fe73f,_0xa57bd6){return db[_0x486f('0x16')]['create'](_0x1fe73f['body'],{})[_0x486f('0x3e')](respondWithResult(_0xa57bd6,0xc9))[_0x486f('0x43')](handleError(_0xa57bd6,null));};exports[_0x486f('0xf')]=function(_0xefe4e4,_0x4dbf30){if(_0xefe4e4[_0x486f('0x49')]['id']){delete _0xefe4e4[_0x486f('0x49')]['id'];}return db[_0x486f('0x16')]['find']({'where':{'id':_0xefe4e4[_0x486f('0x45')]['id']}})[_0x486f('0x3e')](handleEntityNotFound(_0x4dbf30,null))[_0x486f('0x3e')](saveUpdates(_0xefe4e4[_0x486f('0x49')],null))[_0x486f('0x3e')](respondWithResult(_0x4dbf30,null))[_0x486f('0x43')](handleError(_0x4dbf30,null));};exports[_0x486f('0x4a')]=function(_0x21f222,_0x51ca91){return db[_0x486f('0x16')]['describe']()[_0x486f('0x3e')](respondWithResult(_0x51ca91,null))[_0x486f('0x43')](handleError(_0x51ca91,null));};exports[_0x486f('0x4b')]=function(_0x1055cf,_0x34033e){var _0x2e5746;var _0x4d2902=_0x1055cf[_0x486f('0x45')]['id'];return db[_0x486f('0x16')][_0x486f('0x47')]({'where':{'id':_0x1055cf[_0x486f('0x45')]['id']}})[_0x486f('0x3e')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x3e')](function(_0x1bc683){if(_0x1bc683){return _0x1bc683[_0x486f('0x4b')]()[_0x486f('0x3e')](function(_0x5cd989){return _0x5cd989;});}})[_0x486f('0x3e')](function(_0x39f90b){_0x2e5746=_0x39f90b;if(_0x39f90b){if(_0x39f90b[_0x486f('0x4c')]||_0x39f90b['CampaignId']){return db[_0x39f90b[_0x486f('0x4c')]?_0x486f('0x4d'):_0x486f('0x4e')]['find']({'where':{'id':_0x39f90b[_0x486f('0x4c')]?_0x39f90b[_0x486f('0x4c')]:_0x39f90b[_0x486f('0x4f')]},'attributes':['id',_0x486f('0x12')],'raw':!![]});}}})['then'](function(_0x57aac0){var _0x16228a={};if(_0x57aac0){_[_0x486f('0x3b')](_0x16228a,_[_0x486f('0x50')](_0x2e5746[_0x486f('0x51')],[_0x486f('0x52'),_0x486f('0x53'),'id']));_0x16228a[_0x486f('0x54')]=0x15;_0x16228a[_0x486f('0x55')]='deleted';_0x16228a[_0x486f('0x56')]=_0x57aac0['name'];_0x16228a[_0x486f('0x57')]=_0x1055cf[_0x486f('0x58')][_0x486f('0x12')];_0x16228a[_0x486f('0x59')]=_0x1055cf['user']['id'];_0x16228a[_0x486f('0x5a')]=!![];_0x16228a[_0x486f('0x5b')]=moment()[_0x486f('0x5c')](_0x486f('0x5d'));_0x16228a['calleridnum']=_0x2e5746[_0x486f('0x5e')];_0x16228a[_0x486f('0x5f')]=_0x2e5746[_0x486f('0x4c')]?_0x486f('0x60'):_0x486f('0x61');return db[_0x486f('0x62')][_0x486f('0x47')]({'where':{'id':_0x16228a[_0x486f('0x63')]},'attributes':['firstName',_0x486f('0x64')]})[_0x486f('0x3e')](function(_0x5fa282){if(!_[_0x486f('0x65')](_0x34033e)&&!_['isNil'](_0x5fa282[_0x486f('0x66')])){_0x16228a['calleridname']=_0x5fa282[_0x486f('0x66')];if(!_[_0x486f('0x65')](_0x5fa282[_0x486f('0x64')])){_0x16228a[_0x486f('0x67')]+='\x20'+_0x5fa282['lastName'];}}})[_0x486f('0x68')](function(){return db[_0x486f('0x69')][_0x486f('0x48')](_0x16228a);});}})[_0x486f('0x3e')](function(_0x5cf926){return db[_0x486f('0x6a')][_0x486f('0x4b')]({'where':{'CmHopperId':_0x4d2902}});})[_0x486f('0x3e')](function(){return _0x34033e[_0x486f('0xc')](0xcc)[_0x486f('0x6b')]();})[_0x486f('0x43')](handleError(_0x34033e,null));};exports[_0x486f('0x6c')]=function(_0xc78ac9,_0x63c750){var _0x88dbac=[];return db[_0x486f('0x62')][_0x486f('0x4a')]()[_0x486f('0x3e')](function(_0x286141){_0x88dbac=_['keys'](_0x286141);return _0xc78ac9[_0x486f('0x58')]['getVoiceQueues']({'where':{'type':_0x486f('0x6d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x486f('0x6e'),_0x486f('0x6f')],'raw':!![]});})['then'](function(_0x565e9d){if(_0x565e9d&&_0x565e9d[_0x486f('0x34')]){return db['sequelize'][_0x486f('0x70')](function(_0x3648c0){var _0x587fb1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x486f('0x5c')](_0x486f('0x5d'))},'VoiceQueueId':{'$in':_[_0x486f('0x15')](_0x565e9d,'id')},'$or':[{'UserId':null},{'UserId':_0xc78ac9[_0x486f('0x58')]['id']}]};var _0x5118e5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x565e9d)[_0x486f('0x3a')](['dialPreviewAutoRecallMe',0x0])[_0x486f('0x15')]('id')[_0x486f('0x71')]()},'$or':[{'UserId':null},{'UserId':_0xc78ac9[_0x486f('0x58')]['id']}]};var _0x5a1406={'$or':[_0x587fb1,_0x5118e5]};var _0x3c8b40=[];if(_0xc78ac9['body'][_0x486f('0x72')]&&_0xc78ac9['body'][_0x486f('0x72')]===_0x486f('0x73')){if(!_[_0x486f('0x74')](_0xc78ac9[_0x486f('0x49')]['hopperIds'])){_0x5a1406['id']={'$in':_0xc78ac9[_0x486f('0x49')][_0x486f('0x75')]};}_0x3c8b40=[[_0x486f('0x76'),'ASC'],[_0x486f('0x77'),_0x565e9d[0x0][_0x486f('0x6e')]===_0x486f('0x78')?_0x486f('0x79'):'ASC'],db[_0x486f('0x7a')][_0x486f('0x7b')](_0x486f('0x7c')),['id','DESC']];}else{if(!_[_0x486f('0x74')](_0xc78ac9[_0x486f('0x49')][_0x486f('0x75')])){_0x5a1406['id']={'$notIn':_0xc78ac9['body'][_0x486f('0x75')]};}_0x3c8b40=[[_0x486f('0x76'),'DESC'],['scheduledAt',_0x565e9d[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x486f('0x7b')](_0x486f('0x7d')),['id',_0x486f('0x78')]];}return db[_0x486f('0x16')][_0x486f('0x7e')]({'attributes':['id',_0x486f('0x7f'),_0x486f('0x5e'),_0x486f('0x80')],'where':_0x5a1406,'order':_0x3c8b40,'transaction':_0x3648c0,'lock':_0x3648c0['LOCK'][_0x486f('0x81')],'include':[{'model':db[_0x486f('0x62')],'as':_0x486f('0x82'),'attributes':_0x88dbac,'include':[{'model':db[_0x486f('0x83')],'as':_0x486f('0x84'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x486f('0x85'),'attributes':['id',_0x486f('0x12')]},{'model':db['VoiceQueue'],'as':_0x486f('0x86'),'attributes':['id',_0x486f('0x12'),'dialActive']}]})['then'](function(_0x25e5c9){if(_0x25e5c9){return _0x25e5c9[_0x486f('0xf')]({'UserId':_0xc78ac9[_0x486f('0x58')]['id']},{'transaction':_0x3648c0});}});});}})[_0x486f('0x3e')](handleEntityNotFound(_0x63c750,null))[_0x486f('0x3e')](respondWithResult(_0x63c750,null))[_0x486f('0x43')](handleError(_0x63c750,null));};exports[_0x486f('0x87')]=function(_0x5bff5d,_0x4d4b67,_0x63ab8a){var _0x48cb52=[];var _0xdef0af=_0x5bff5d['params']['id'];var _0xcf9385=_0x5bff5d['user']['id'];return db['CmContact'][_0x486f('0x4a')]()['then'](function(_0x4fc8bd){_0x48cb52=_[_0x486f('0x1d')](_0x4fc8bd);return db['sequelize'][_0x486f('0x70')](function(_0x5961c3){const _0x1d1eb4={'id':_0xdef0af};return db[_0x486f('0x16')][_0x486f('0x7e')]({'attributes':['id',_0x486f('0x7f'),'recallme'],'where':_0x1d1eb4,'transaction':_0x5961c3,'lock':_0x5961c3[_0x486f('0x88')][_0x486f('0x81')],'include':[{'model':db['CmContact'],'as':_0x486f('0x82'),'attributes':_0x48cb52,'include':[{'model':db['CmCompany'],'as':_0x486f('0x84'),'attributes':['id','name']}]},{'model':db[_0x486f('0x89')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x486f('0x86'),'attributes':['id',_0x486f('0x12'),_0x486f('0x8a')]}]})[_0x486f('0x3e')](function(_0x22a426){if(_0x22a426){return _0x22a426[_0x486f('0xf')]({'UserId':_0xcf9385},{'transaction':_0x5961c3});}});});})[_0x486f('0x3e')](handleEntityNotFound(_0x4d4b67,null))[_0x486f('0x3e')](respondWithResult(_0x4d4b67,null))[_0x486f('0x43')](handleError(_0x4d4b67,null));};exports[_0x486f('0x8b')]=function(_0x4f2213,_0x1022de){return _0x4f2213[_0x486f('0x58')][_0x486f('0x8c')]({'where':{'type':_0x486f('0x6d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x486f('0x3e')](function(_0x5c2d46){if(_0x5c2d46&&_0x5c2d46[_0x486f('0x34')]){return db[_0x486f('0x16')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x486f('0x15')](_0x5c2d46,'id')},'$or':[{'UserId':null},{'UserId':_0x4f2213[_0x486f('0x58')]['id']}]}});}return 0x0;})[_0x486f('0x3e')](function(_0x4a0510){if(!_['isNil'](_0x4a0510)&&_['isNumber'](_0x4a0510)){return _0x1022de[_0x486f('0xc')](0xc8)['json']({'contacts':_0x4a0510});}else{logger[_0x486f('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x486f('0x8b'),0x194,'entity\x20not\x20found');_0x1022de[_0x486f('0x8d')](0x194);}})[_0x486f('0x43')](handleError(_0x1022de,null));};exports[_0x486f('0x8e')]=function(_0x13832f,_0x196437){var _0x157976=shared[_0x486f('0x8f')];var _0x201541=[];_['map'](_0x157976,function(_0xd42cf4){_0x201541['push']({'id':_0xd42cf4[_0x486f('0x12')],'name':_0xd42cf4['name'],'utcOffset':_0xd42cf4[_0x486f('0x90')]});});return _0x196437[_0x486f('0xc')](0xc8)['json']({'tz':_0x201541});};exports[_0x486f('0x91')]=function(_0x345490,_0x140d8d){var _0x58f864=shared[_0x486f('0x8f')];var _0x294127={};if(!_[_0x486f('0x65')](_0x58f864[_0x345490['body']['id']]))_0x294127=_0x58f864[_0x345490['body']['id']];return _0x140d8d[_0x486f('0xc')](0xc8)[_0x486f('0x7')](_0x294127);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2d04dca..286d9fa 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 _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x520f81,_0x4add9a){var _0x35a95a=function(_0x532f81){while(--_0x532f81){_0x520f81['push'](_0x520f81['shift']());}};_0x35a95a(++_0x4add9a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'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':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xd117,0x182));var _0x7d11=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xd117[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 08f9924..8196ecc 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 _0xa5c9=['\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','all','Contact','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','stringify','catch','message','error','ShowCmHopper','then','CreateCmHopper','create','body','info','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','describe','sequelize','order','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4af2c0,_0xb89b7a){var _0x237d00=function(_0x25f8bd){while(--_0x25f8bd){_0x4af2c0['push'](_0x4af2c0['shift']());}};_0x237d00(++_0xb89b7a);}(_0xa5c9,0x143));var _0x9a5c=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa5c9[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var moment=require(_0x9a5c('0x2'));var BPromise=require(_0x9a5c('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x9a5c('0x4'));exports[_0x9a5c('0x5')]=function(_0x55bcf5){var _0x5f1811=this;return new Promise(function(_0x54c477,_0x2fef4c){return db[_0x9a5c('0x6')][_0x9a5c('0x7')]({'raw':_0x55bcf5[_0x9a5c('0x8')]?_0x55bcf5['options'][_0x9a5c('0x9')]===undefined?!![]:![]:!![],'where':_0x55bcf5['options']?_0x55bcf5[_0x9a5c('0x8')][_0x9a5c('0xa')]||null:null,'attributes':_0x55bcf5['options']?_0x55bcf5[_0x9a5c('0x8')][_0x9a5c('0xb')]||null:null,'limit':_0x55bcf5[_0x9a5c('0x8')]?_0x55bcf5['options']['limit']||null:null,'include':_0x55bcf5[_0x9a5c('0x8')]?_0x55bcf5[_0x9a5c('0x8')][_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x55bcf5[_0x9a5c('0x8')][_0x9a5c('0xc')],function(_0xa1c7d5){return{'model':db[_0xa1c7d5[_0x9a5c('0xe')]],'as':_0xa1c7d5['as'],'attributes':_0xa1c7d5[_0x9a5c('0xb')],'include':_0xa1c7d5[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0xa1c7d5[_0x9a5c('0xc')],function(_0x546c0b){return{'model':db[_0x546c0b[_0x9a5c('0xe')]],'as':_0x546c0b['as'],'attributes':_0x546c0b[_0x9a5c('0xb')],'include':_0x546c0b[_0x9a5c('0xc')]?_['map'](_0x546c0b[_0x9a5c('0xc')],function(_0x1f008e){return{'model':db[_0x1f008e['model']],'as':_0x1f008e['as'],'attributes':_0x1f008e[_0x9a5c('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x350bd5){logger['info'](_0x9a5c('0x5'),_0x55bcf5);logger[_0x9a5c('0xf')]('GetCmHopper',_0x55bcf5,JSON[_0x9a5c('0x10')](_0x350bd5));_0x54c477(_0x350bd5);})[_0x9a5c('0x11')](function(_0x39fbea){logger['error'](_0x9a5c('0x5'),_0x39fbea[_0x9a5c('0x12')],_0x55bcf5);_0x2fef4c(_0x5f1811[_0x9a5c('0x13')](0x1f4,_0x39fbea['message']));});});};exports[_0x9a5c('0x14')]=function(_0x1a7152){var _0x4a7627=this;return new Promise(function(_0x165c0f,_0x41283c){return db[_0x9a5c('0x6')]['find']({'raw':_0x1a7152[_0x9a5c('0x8')]?_0x1a7152[_0x9a5c('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7152[_0x9a5c('0x8')]?_0x1a7152[_0x9a5c('0x8')]['where']||null:null,'attributes':_0x1a7152[_0x9a5c('0x8')]?_0x1a7152[_0x9a5c('0x8')][_0x9a5c('0xb')]||null:null,'include':_0x1a7152['options']?_0x1a7152[_0x9a5c('0x8')][_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x1a7152[_0x9a5c('0x8')][_0x9a5c('0xc')],function(_0x3c3112){return{'model':db[_0x3c3112['model']],'as':_0x3c3112['as'],'attributes':_0x3c3112['attributes'],'include':_0x3c3112[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x3c3112[_0x9a5c('0xc')],function(_0x3713fd){return{'model':db[_0x3713fd['model']],'as':_0x3713fd['as'],'attributes':_0x3713fd[_0x9a5c('0xb')],'include':_0x3713fd[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x3713fd[_0x9a5c('0xc')],function(_0x439e6b){return{'model':db[_0x439e6b[_0x9a5c('0xe')]],'as':_0x439e6b['as'],'attributes':_0x439e6b[_0x9a5c('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9a5c('0x15')](function(_0x3d3356){logger['info'](_0x9a5c('0x14'),_0x1a7152);logger['debug']('ShowCmHopper',_0x1a7152,JSON['stringify'](_0x3d3356));_0x165c0f(_0x3d3356);})[_0x9a5c('0x11')](function(_0x190943){logger[_0x9a5c('0x13')](_0x9a5c('0x14'),_0x190943[_0x9a5c('0x12')],_0x1a7152);_0x41283c(_0x4a7627[_0x9a5c('0x13')](0x1f4,_0x190943['message']));});});};exports[_0x9a5c('0x16')]=function(_0x3321a7){var _0x39344c=this;return new Promise(function(_0x539c07,_0x39945c){return db[_0x9a5c('0x6')][_0x9a5c('0x17')](_0x3321a7[_0x9a5c('0x18')],{'raw':_0x3321a7['options']?_0x3321a7[_0x9a5c('0x8')]['raw']===undefined?!![]:![]:!![]})[_0x9a5c('0x15')](function(_0x5b30d9){logger[_0x9a5c('0x19')](_0x9a5c('0x16'),_0x3321a7);logger[_0x9a5c('0xf')](_0x9a5c('0x16'),_0x3321a7,JSON[_0x9a5c('0x10')](_0x5b30d9));_0x539c07(_0x5b30d9);})[_0x9a5c('0x11')](function(_0x5695a5){logger[_0x9a5c('0x13')](_0x9a5c('0x16'),_0x5695a5[_0x9a5c('0x12')],_0x3321a7);_0x39945c(_0x39344c[_0x9a5c('0x13')](0x1f4,_0x5695a5['message']));});});};exports[_0x9a5c('0x1a')]=function(_0xe3feef){var _0x5f545c=this;return new Promise(function(_0x2329ba,_0x2d02cf){return db['CmHopper'][_0x9a5c('0x1b')](_0xe3feef['body'],{'raw':_0xe3feef[_0x9a5c('0x8')]?_0xe3feef[_0x9a5c('0x8')][_0x9a5c('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3feef[_0x9a5c('0x8')]?_0xe3feef[_0x9a5c('0x8')]['where']||null:null,'attributes':_0xe3feef['options']?_0xe3feef['options']['attributes']||null:null,'limit':_0xe3feef[_0x9a5c('0x8')]?_0xe3feef[_0x9a5c('0x8')][_0x9a5c('0x1c')]||null:null})[_0x9a5c('0x15')](function(_0x27de82){logger[_0x9a5c('0x19')](_0x9a5c('0x1a'),_0xe3feef);logger[_0x9a5c('0x19')](_0x9a5c('0x1d'),JSON[_0x9a5c('0x10')](_0xe3feef[_0x9a5c('0x8')]['where']),_0xe3feef[_0x9a5c('0x18')][_0x9a5c('0x1e')]);logger[_0x9a5c('0xf')](_0x9a5c('0x1a'),_0xe3feef,JSON['stringify'](_0x27de82));_0x2329ba(_0x27de82);})[_0x9a5c('0x11')](function(_0x3394a8){logger['error'](_0x9a5c('0x1a'),_0x3394a8[_0x9a5c('0x12')],_0xe3feef);_0x2d02cf(_0x5f545c[_0x9a5c('0x13')](0x1f4,_0x3394a8[_0x9a5c('0x12')]));});});};exports[_0x9a5c('0x1f')]=function(_0x1af820){var _0xd61373=this;return new Promise(function(_0x2518e0,_0x3f3dbb){return db[_0x9a5c('0x6')]['destroy']({'where':_0x1af820['options']?_0x1af820[_0x9a5c('0x8')][_0x9a5c('0xa')]||null:null})[_0x9a5c('0x15')](function(_0xe6e36d){logger[_0x9a5c('0x19')](_0x9a5c('0x1f'),_0x1af820);logger[_0x9a5c('0xf')](_0x9a5c('0x1f'),_0x1af820,JSON[_0x9a5c('0x10')](_0xe6e36d));_0x2518e0(_0xe6e36d);})[_0x9a5c('0x11')](function(_0x718265){logger[_0x9a5c('0x13')]('DestroyCmHopper',_0x718265['message'],_0x1af820);_0x3f3dbb(_0xd61373[_0x9a5c('0x13')](0x1f4,_0x718265[_0x9a5c('0x12')]));});});};exports['GetContactDialer']=function(_0x5bb590){var _0x311524=this;return new Promise(function(_0x5f0297,_0x5ab2cd){return db['CmContact'][_0x9a5c('0x20')]()['then'](function(_0x3523e9){return db[_0x9a5c('0x21')]['transaction'](function(_0x373df2){return db[_0x9a5c('0x6')]['findAll']({'where':_0x5bb590[_0x9a5c('0x8')]?_0x5bb590[_0x9a5c('0x8')]['where']||null:null,'attributes':_0x5bb590['options']?_0x5bb590[_0x9a5c('0x8')][_0x9a5c('0xb')]||null:null,'limit':_0x5bb590[_0x9a5c('0x8')]?_0x5bb590['options'][_0x9a5c('0x1c')]||null:null,'order':_0x5bb590[_0x9a5c('0x8')]?_0x5bb590[_0x9a5c('0x8')][_0x9a5c('0x22')]||null:null,'transaction':_0x373df2,'lock':_0x373df2['LOCK'][_0x9a5c('0x23')],'include':[{'model':db[_0x9a5c('0x24')],'as':'Contact','attributes':_[_0x9a5c('0x25')](_0x3523e9)},{'model':db[_0x9a5c('0x26')],'as':_0x9a5c('0x27'),'attributes':['id',_0x9a5c('0x28'),_0x9a5c('0x29')]}]})[_0x9a5c('0x15')](function(_0xc5cbca){var _0x5e0297=[];var _0x2782c4=[];for(var _0x57f53a=0x0;_0x57f53a<_0xc5cbca[_0x9a5c('0x2a')];_0x57f53a+=0x1){var _0x4e3b47=_0xc5cbca[_0x57f53a][_0x9a5c('0x2b')];if(_0x4e3b47===null){_0x5e0297[_0x9a5c('0x2c')](_0xc5cbca[_0x57f53a]['update'](_0x5bb590[_0x9a5c('0x18')],{'transaction':_0x373df2}));}else if(!_0x2782c4['includes'](_0x4e3b47)){_0x2782c4['push'](_0x4e3b47);_0x5e0297[_0x9a5c('0x2c')](_0xc5cbca[_0x57f53a][_0x9a5c('0x1b')](_0x5bb590[_0x9a5c('0x18')],{'transaction':_0x373df2}));}}return BPromise['all'](_0x5e0297);});})[_0x9a5c('0x15')](function(_0x21d941){logger[_0x9a5c('0x19')](_0x9a5c('0x2d'),_0x5bb590);if(_0x21d941[_0x9a5c('0x2a')]>0x0){logger[_0x9a5c('0x19')](_0x9a5c('0x2e'),_0x21d941[0x0][_0x9a5c('0x2f')]['id'],_0x21d941[0x0][_0x9a5c('0x2f')][_0x9a5c('0x30')],_0x21d941[0x0]['dataValues']['active']);}logger[_0x9a5c('0xf')](_0x9a5c('0x2d'),_0x5bb590,JSON[_0x9a5c('0x10')](_0x21d941));_0x5f0297(_0x21d941);})[_0x9a5c('0x11')](function(_0x4a6e7d){logger['error'](_0x9a5c('0x2d'),_0x4a6e7d[_0x9a5c('0x12')],_0x5bb590);_0x5ab2cd(_0x311524[_0x9a5c('0x13')](0x1f4,_0x4a6e7d[_0x9a5c('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x35ba8c){var _0x22f70b=this;return new Promise(function(_0x5d8806,_0x32fa49){return db[_0x9a5c('0x21')][_0x9a5c('0x31')](function(_0x32d852){return db['CmHopperFinal']['create'](_0x35ba8c['body'],{'raw':_0x35ba8c[_0x9a5c('0x8')]?_0x35ba8c[_0x9a5c('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x32d852})[_0x9a5c('0x15')](function(){logger[_0x9a5c('0x19')](_0x9a5c('0x32'),JSON['stringify'](_0x35ba8c[_0x9a5c('0x8')][_0x9a5c('0xa')]),_0x35ba8c[_0x9a5c('0x8')][_0x9a5c('0xa')][_0x9a5c('0x1e')]);return db[_0x9a5c('0x6')]['destroy']({'where':_0x35ba8c[_0x9a5c('0x8')]?_0x35ba8c[_0x9a5c('0x8')][_0x9a5c('0xa')]||null:null,'transaction':_0x32d852});});})[_0x9a5c('0x15')](function(_0x29c80d){logger[_0x9a5c('0x19')]('MoveContactManagedDialer',_0x35ba8c);logger[_0x9a5c('0xf')](_0x9a5c('0x33'),_0x35ba8c,JSON[_0x9a5c('0x10')](_0x29c80d));_0x5d8806(_0x29c80d);})[_0x9a5c('0x11')](function(_0x536efb){logger[_0x9a5c('0x13')](_0x9a5c('0x33'),_0x536efb[_0x9a5c('0x12')],_0x35ba8c);_0x32fa49(_0x22f70b[_0x9a5c('0x13')](0x1f4,_0x536efb[_0x9a5c('0x12')]));});});};exports['CountReScheduled']=function(_0x80e8c4){var _0x44adf0=this;return new Promise(function(_0x200159,_0x33a39f){return db[_0x9a5c('0x6')][_0x9a5c('0x7')]({'raw':_0x80e8c4[_0x9a5c('0x8')]?_0x80e8c4[_0x9a5c('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x80e8c4[_0x9a5c('0x8')]?_0x80e8c4[_0x9a5c('0x8')]['where']||null:null,'attributes':[[db[_0x9a5c('0x21')]['fn']('COUNT',db[_0x9a5c('0x21')]['fn']('IF',db['sequelize'][_0x9a5c('0x34')](_0x9a5c('0x35')+util['format'](_0x9a5c('0x36'),moment()[_0x9a5c('0x37')](_0x9a5c('0x38')))+_0x9a5c('0x39')))),_0x9a5c('0x3a')]]})[_0x9a5c('0x15')](function(_0xfca83b){logger[_0x9a5c('0x19')](_0x9a5c('0x3b'),_0x80e8c4);logger[_0x9a5c('0xf')](_0x9a5c('0x3b'),_0x80e8c4,JSON[_0x9a5c('0x10')](_0xfca83b));_0x200159(_0xfca83b);})['catch'](function(_0x12960d){logger[_0x9a5c('0x13')](_0x9a5c('0x3b'),_0x12960d[_0x9a5c('0x12')],_0x80e8c4);_0x33a39f(_0x44adf0[_0x9a5c('0x13')](0x1f4,_0x12960d[_0x9a5c('0x12')]));});});};exports[_0x9a5c('0x3c')]=function(_0x339b53){var _0x20f2f7=this;return new Promise(function(_0x288267,_0x2d4d5c){return db[_0x9a5c('0x24')]['describe']()[_0x9a5c('0x15')](function(){return db[_0x9a5c('0x21')]['transaction'](function(_0x32b8f4){return db['CmHopper'][_0x9a5c('0x7')]({'where':_0x339b53[_0x9a5c('0x8')]?_0x339b53[_0x9a5c('0x8')][_0x9a5c('0xa')]||null:null,'attributes':_0x339b53[_0x9a5c('0x8')]?_0x339b53['options'][_0x9a5c('0xb')]||null:null,'limit':0x1,'order':_0x339b53[_0x9a5c('0x8')]?_0x339b53[_0x9a5c('0x8')][_0x9a5c('0x22')]||null:null,'group':db[_0x9a5c('0x6')][_0x9a5c('0x2b')],'transaction':_0x32b8f4,'lock':_0x32b8f4['LOCK'][_0x9a5c('0x23')],'include':_0x339b53[_0x9a5c('0x8')]?_0x339b53[_0x9a5c('0x8')]['include']?_[_0x9a5c('0xd')](_0x339b53['options'][_0x9a5c('0xc')],function(_0x56eae2){return{'model':db[_0x56eae2[_0x9a5c('0xe')]],'as':_0x56eae2['as'],'attributes':_0x56eae2['attributes'],'include':_0x56eae2[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x56eae2['include'],function(_0x43745f){return{'model':db[_0x43745f[_0x9a5c('0xe')]],'as':_0x43745f['as'],'attributes':_0x43745f['attributes'],'include':_0x43745f[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x43745f['include'],function(_0x3f36e5){return{'model':db[_0x3f36e5[_0x9a5c('0xe')]],'as':_0x3f36e5['as'],'attributes':_0x3f36e5[_0x9a5c('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9a5c('0x15')](function(_0x2916ba){var _0xd6c540=[];for(var _0x35f68c=0x0;_0x35f68c<_0x2916ba[_0x9a5c('0x2a')];_0x35f68c+=0x1){_0xd6c540[_0x9a5c('0x2c')](_0x2916ba[_0x35f68c][_0x9a5c('0x1b')](_0x339b53[_0x9a5c('0x18')],{'transaction':_0x32b8f4}));}return BPromise[_0x9a5c('0x3d')](_0xd6c540);});})['then'](function(_0x37de52){logger[_0x9a5c('0x19')](_0x9a5c('0x3c'),_0x339b53);logger[_0x9a5c('0xf')](_0x9a5c('0x3c'),_0x339b53,JSON[_0x9a5c('0x10')](_0x37de52));_0x288267(_0x37de52);})[_0x9a5c('0x11')](function(_0x1fd33b){logger[_0x9a5c('0x13')]('GetContactRecallMe',_0x1fd33b['message'],_0x339b53);_0x2d4d5c(_0x20f2f7[_0x9a5c('0x13')](0x1f4,_0x1fd33b['message']));});});});};exports['GetCmHopperPreview']=function(_0x40f20c){var _0x116a5b=this;return new Promise(function(_0x1b378b,_0x25b3d1){db[_0x9a5c('0x24')][_0x9a5c('0x20')]()[_0x9a5c('0x15')](function(_0x210368){return db[_0x9a5c('0x6')][_0x9a5c('0x7')]({'raw':_0x40f20c['options']?_0x40f20c['options'][_0x9a5c('0x9')]===undefined?!![]:![]:!![],'where':_0x40f20c[_0x9a5c('0x8')]?_0x40f20c[_0x9a5c('0x8')]['where']||null:null,'attributes':_0x40f20c[_0x9a5c('0x8')]?_0x40f20c[_0x9a5c('0x8')]['attributes']||null:null,'limit':_0x40f20c[_0x9a5c('0x8')]?_0x40f20c['options'][_0x9a5c('0x1c')]||null:null,'include':_0x40f20c[_0x9a5c('0x8')]?_0x40f20c['options'][_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x40f20c[_0x9a5c('0x8')][_0x9a5c('0xc')],function(_0x52fc97){return{'model':db[_0x52fc97[_0x9a5c('0xe')]],'as':_0x52fc97['as'],'attributes':_0x52fc97['as']===_0x9a5c('0x3e')?_[_0x9a5c('0x25')](_0x210368):_0x52fc97['attributes'],'include':_0x52fc97['include']?_[_0x9a5c('0xd')](_0x52fc97['include'],function(_0x497c78){return{'model':db[_0x497c78['model']],'as':_0x497c78['as'],'attributes':_0x497c78[_0x9a5c('0xb')],'include':_0x497c78[_0x9a5c('0xc')]?_[_0x9a5c('0xd')](_0x497c78[_0x9a5c('0xc')],function(_0x3ccac6){return{'model':db[_0x3ccac6[_0x9a5c('0xe')]],'as':_0x3ccac6['as'],'attributes':_0x3ccac6[_0x9a5c('0xb')]};}):[]};}):[]};}):[]:[]})[_0x9a5c('0x15')](function(_0x199917){logger[_0x9a5c('0x19')]('GetCmHopper',_0x40f20c);logger[_0x9a5c('0xf')](_0x9a5c('0x5'),_0x40f20c,JSON[_0x9a5c('0x10')](_0x199917));_0x1b378b(_0x199917);})['catch'](function(_0x56b648){logger[_0x9a5c('0x13')](_0x9a5c('0x5'),_0x56b648[_0x9a5c('0x12')],_0x40f20c);_0x25b3d1(_0x116a5b[_0x9a5c('0x13')](0x1f4,_0x56b648[_0x9a5c('0x12')]));});});});};exports[_0x9a5c('0x3f')]=function(_0x165b3a){var _0x124cd3=this;return new Promise(function(_0x1f5737,_0x511e77){return db[_0x9a5c('0x24')][_0x9a5c('0x40')]({'raw':!![],'where':{'phone':_0x165b3a['options'][_0x9a5c('0xa')][_0x9a5c('0x41')]},'attributes':['id',_0x9a5c('0x42')],'order':[['id','DESC']]})['then'](function(_0x321590){logger['info'](_0x9a5c('0x43'),_0x165b3a);logger[_0x9a5c('0xf')]('getContactByPhone',_0x165b3a,JSON[_0x9a5c('0x10')](_0x321590));_0x1f5737(_0x321590);})[_0x9a5c('0x11')](function(_0x50568a){logger[_0x9a5c('0x13')](_0x9a5c('0x43'),_0x50568a[_0x9a5c('0x12')],_0x165b3a);_0x511e77(_0x124cd3['error'](0x1f4,_0x50568a['message']));});});};exports[_0x9a5c('0x44')]=function(_0x42772f){var _0x537a96=this;return new Promise(function(_0x35908f,_0x2ff2d0){return db[_0x9a5c('0x21')][_0x9a5c('0x31')](function(_0x1049e9){var _0x8c5ebc=_0x42772f['options']&&_0x42772f['options']['where']?_0x42772f[_0x9a5c('0x8')]['where']:{};return db[_0x9a5c('0x6')][_0x9a5c('0x1b')](_0x42772f[_0x9a5c('0x18')],{'where':_0x8c5ebc,'transaction':_0x1049e9})[_0x9a5c('0x15')](function(_0x2813f7){logger[_0x9a5c('0x19')](_0x9a5c('0x44'),_0x42772f);logger[_0x9a5c('0xf')](_0x9a5c('0x44'),_0x42772f,JSON[_0x9a5c('0x10')](_0x2813f7));_0x35908f(_0x2813f7);})[_0x9a5c('0x11')](function(_0x381690){logger[_0x9a5c('0x13')]('ResetActiveCalls',_0x381690[_0x9a5c('0x12')],_0x42772f);_0x2ff2d0(_0x537a96['error'](0x1f4,_0x381690[_0x9a5c('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4ed020){var _0x1f7279=this;var _0x19194c=_0x4ed020[_0x9a5c('0x18')][_0x9a5c('0xa')][_0x9a5c('0x45')];var _0x46848a=_0x4ed020[_0x9a5c('0x18')][_0x9a5c('0xa')][_0x9a5c('0x46')];var _0xe41f89=_0x4ed020[_0x9a5c('0x18')][_0x9a5c('0xa')][_0x9a5c('0x47')];return new Promise(function(_0x52a555,_0x56dc26){return db[_0x9a5c('0x6')][_0x9a5c('0x7')]({'where':{'voiceQueueId':{'$in':_0x19194c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9a5c('0x21')][_0x9a5c('0x34')]('NOW()\x20+\x20INTERVAL\x20'+_0x46848a+_0x9a5c('0x48')),'$gt':db[_0x9a5c('0x21')][_0x9a5c('0x34')](_0x9a5c('0x49'))}},'UserId':{'$in':_0xe41f89}},'include':[{'model':db['CmContact'],'as':_0x9a5c('0x3e')},{'model':db[_0x9a5c('0x26')],'as':_0x9a5c('0x27'),'attributes':['id',_0x9a5c('0x28'),_0x9a5c('0x29')]},{'model':db[_0x9a5c('0x4a')],'as':'List'}]})[_0x9a5c('0x15')](function(_0x441607){if(_0x441607[_0x9a5c('0x2a')]>0x0){return db[_0x9a5c('0x21')][_0x9a5c('0x31')](function(_0x1b6ca9){return db[_0x9a5c('0x6')][_0x9a5c('0x1b')]({'recallmeNotifiedDate':db[_0x9a5c('0x21')]['literal'](_0x9a5c('0x49'))},{'where':{'id':{'$in':_[_0x9a5c('0xd')](_0x441607,'id')}},'transaction':_0x1b6ca9})[_0x9a5c('0x15')](function(){_0x52a555(_0x441607);})[_0x9a5c('0x11')](function(_0x1b0618){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1b0618[_0x9a5c('0x12')],_0x4ed020);_0x56dc26(_0x1f7279[_0x9a5c('0x13')](0x1f4,_0x1b0618['message']));});})[_0x9a5c('0x11')](function(_0x26bbd0){logger[_0x9a5c('0x13')](_0x9a5c('0x4b'),_0x26bbd0['message'],_0x4ed020);_0x56dc26(_0x1f7279[_0x9a5c('0x13')](0x1f4,_0x26bbd0[_0x9a5c('0x12')]));});}else{_0x52a555(_0x441607);}});});}; \ No newline at end of file +var _0x1179=['GetContactDialer','transaction','order','LOCK','CmContact','Contact','keys','User','Agent','length','UserId','includes','push','all','dataValues','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','voicePause','CmList','List','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','limit','map','model','attributes','include','then','catch','error','message','ShowCmHopper','stringify','CreateCmHopper','body','info','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','where','active','debug','DestroyCmHopper'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1179,0x7e));var _0x9117=function(_0x142276,_0x8029bf){_0x142276=_0x142276-0x0;var _0x1ecd95=_0x1179[_0x142276];return _0x1ecd95;};'use strict';var _=require(_0x9117('0x0'));var util=require(_0x9117('0x1'));var moment=require(_0x9117('0x2'));var BPromise=require('bluebird');var db=require(_0x9117('0x3'))['db'];var logger=require(_0x9117('0x4'))(_0x9117('0x5'));exports[_0x9117('0x6')]=function(_0x258c31){var _0x426feb=this;return new Promise(function(_0x425894,_0x212cf5){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x258c31[_0x9117('0x9')]?_0x258c31['options'][_0x9117('0xa')]===undefined?!![]:![]:!![],'where':_0x258c31[_0x9117('0x9')]?_0x258c31['options']['where']||null:null,'attributes':_0x258c31['options']?_0x258c31[_0x9117('0x9')]['attributes']||null:null,'limit':_0x258c31[_0x9117('0x9')]?_0x258c31[_0x9117('0x9')][_0x9117('0xb')]||null:null,'include':_0x258c31[_0x9117('0x9')]?_0x258c31['options']['include']?_[_0x9117('0xc')](_0x258c31[_0x9117('0x9')]['include'],function(_0x1d36e1){return{'model':db[_0x1d36e1[_0x9117('0xd')]],'as':_0x1d36e1['as'],'attributes':_0x1d36e1[_0x9117('0xe')],'include':_0x1d36e1[_0x9117('0xf')]?_['map'](_0x1d36e1[_0x9117('0xf')],function(_0x4ec3b3){return{'model':db[_0x4ec3b3[_0x9117('0xd')]],'as':_0x4ec3b3['as'],'attributes':_0x4ec3b3[_0x9117('0xe')],'include':_0x4ec3b3[_0x9117('0xf')]?_[_0x9117('0xc')](_0x4ec3b3[_0x9117('0xf')],function(_0x3175e2){return{'model':db[_0x3175e2['model']],'as':_0x3175e2['as'],'attributes':_0x3175e2[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x3f71fd){logger['info']('GetCmHopper',_0x258c31);logger['debug'](_0x9117('0x6'),_0x258c31,JSON['stringify'](_0x3f71fd));_0x425894(_0x3f71fd);})[_0x9117('0x11')](function(_0xc44031){logger[_0x9117('0x12')](_0x9117('0x6'),_0xc44031[_0x9117('0x13')],_0x258c31);_0x212cf5(_0x426feb[_0x9117('0x12')](0x1f4,_0xc44031[_0x9117('0x13')]));});});};exports['ShowCmHopper']=function(_0x3f404c){var _0x47543c=this;return new Promise(function(_0x1436bd,_0x413260){return db[_0x9117('0x7')]['find']({'raw':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![],'where':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')]['where']||null:null,'attributes':_0x3f404c[_0x9117('0x9')]?_0x3f404c['options'][_0x9117('0xe')]||null:null,'include':_0x3f404c[_0x9117('0x9')]?_0x3f404c[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x3f404c[_0x9117('0x9')][_0x9117('0xf')],function(_0x414ed6){return{'model':db[_0x414ed6['model']],'as':_0x414ed6['as'],'attributes':_0x414ed6[_0x9117('0xe')],'include':_0x414ed6[_0x9117('0xf')]?_[_0x9117('0xc')](_0x414ed6['include'],function(_0x26844c){return{'model':db[_0x26844c[_0x9117('0xd')]],'as':_0x26844c['as'],'attributes':_0x26844c[_0x9117('0xe')],'include':_0x26844c['include']?_[_0x9117('0xc')](_0x26844c['include'],function(_0x5bc372){return{'model':db[_0x5bc372[_0x9117('0xd')]],'as':_0x5bc372['as'],'attributes':_0x5bc372[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x4d9367){logger['info']('ShowCmHopper',_0x3f404c);logger['debug'](_0x9117('0x14'),_0x3f404c,JSON[_0x9117('0x15')](_0x4d9367));_0x1436bd(_0x4d9367);})[_0x9117('0x11')](function(_0x16e354){logger[_0x9117('0x12')]('ShowCmHopper',_0x16e354[_0x9117('0x13')],_0x3f404c);_0x413260(_0x47543c[_0x9117('0x12')](0x1f4,_0x16e354['message']));});});};exports[_0x9117('0x16')]=function(_0xdf5025){var _0x1633a9=this;return new Promise(function(_0x51c730,_0x2e7b2b){return db[_0x9117('0x7')]['create'](_0xdf5025[_0x9117('0x17')],{'raw':_0xdf5025['options']?_0xdf5025[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x3d6ce5){logger[_0x9117('0x18')](_0x9117('0x16'),_0xdf5025);logger['debug'](_0x9117('0x16'),_0xdf5025,JSON[_0x9117('0x15')](_0x3d6ce5));_0x51c730(_0x3d6ce5);})[_0x9117('0x11')](function(_0x2b5b79){logger['error'](_0x9117('0x16'),_0x2b5b79[_0x9117('0x13')],_0xdf5025);_0x2e7b2b(_0x1633a9[_0x9117('0x12')](0x1f4,_0x2b5b79[_0x9117('0x13')]));});});};exports[_0x9117('0x19')]=function(_0x4c558b){var _0x18ba6d=this;return new Promise(function(_0x5f3b77,_0xd93b5f){return db[_0x9117('0x7')][_0x9117('0x1a')](_0x4c558b[_0x9117('0x17')],{'raw':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')][_0x9117('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')]['where']||null:null,'attributes':_0x4c558b[_0x9117('0x9')]?_0x4c558b[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x4c558b['options']?_0x4c558b['options'][_0x9117('0xb')]||null:null})[_0x9117('0x10')](function(_0x4de4d3){logger[_0x9117('0x18')](_0x9117('0x19'),_0x4c558b);logger['info'](_0x9117('0x1b'),JSON[_0x9117('0x15')](_0x4c558b[_0x9117('0x9')][_0x9117('0x1c')]),_0x4c558b[_0x9117('0x17')][_0x9117('0x1d')]);logger[_0x9117('0x1e')]('UpdateCmHopper',_0x4c558b,JSON[_0x9117('0x15')](_0x4de4d3));_0x5f3b77(_0x4de4d3);})[_0x9117('0x11')](function(_0x3ca222){logger[_0x9117('0x12')](_0x9117('0x19'),_0x3ca222[_0x9117('0x13')],_0x4c558b);_0xd93b5f(_0x18ba6d[_0x9117('0x12')](0x1f4,_0x3ca222[_0x9117('0x13')]));});});};exports[_0x9117('0x1f')]=function(_0x49ebde){var _0xf6c18=this;return new Promise(function(_0x44f7c0,_0x24982f){return db[_0x9117('0x7')]['destroy']({'where':_0x49ebde[_0x9117('0x9')]?_0x49ebde[_0x9117('0x9')][_0x9117('0x1c')]||null:null})['then'](function(_0x31b9c8){logger[_0x9117('0x18')]('DestroyCmHopper',_0x49ebde);logger['debug'](_0x9117('0x1f'),_0x49ebde,JSON[_0x9117('0x15')](_0x31b9c8));_0x44f7c0(_0x31b9c8);})['catch'](function(_0x3b4437){logger[_0x9117('0x12')]('DestroyCmHopper',_0x3b4437[_0x9117('0x13')],_0x49ebde);_0x24982f(_0xf6c18[_0x9117('0x12')](0x1f4,_0x3b4437[_0x9117('0x13')]));});});};exports[_0x9117('0x20')]=function(_0x5c0ef6){var _0x4364de=this;return new Promise(function(_0x2bc3f4,_0x44abf2){return db['CmContact']['describe']()['then'](function(_0x4b30cf){return db['sequelize'][_0x9117('0x21')](function(_0x5ef0a3){return db[_0x9117('0x7')][_0x9117('0x8')]({'where':_0x5c0ef6['options']?_0x5c0ef6[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'attributes':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6['options'][_0x9117('0xb')]||null:null,'order':_0x5c0ef6[_0x9117('0x9')]?_0x5c0ef6['options'][_0x9117('0x22')]||null:null,'transaction':_0x5ef0a3,'lock':_0x5ef0a3[_0x9117('0x23')]['UPDATE'],'include':[{'model':db[_0x9117('0x24')],'as':_0x9117('0x25'),'attributes':_[_0x9117('0x26')](_0x4b30cf)},{'model':db[_0x9117('0x27')],'as':_0x9117('0x28'),'attributes':['id','name','voicePause']}]})['then'](function(_0x50a7d7){var _0x5dc2c9=[];var _0x46e7de=[];for(var _0x3ddc58=0x0;_0x3ddc58<_0x50a7d7[_0x9117('0x29')];_0x3ddc58+=0x1){var _0x18646b=_0x50a7d7[_0x3ddc58][_0x9117('0x2a')];if(_0x18646b===null){_0x5dc2c9['push'](_0x50a7d7[_0x3ddc58]['update'](_0x5c0ef6['body'],{'transaction':_0x5ef0a3}));}else if(!_0x46e7de[_0x9117('0x2b')](_0x18646b)){_0x46e7de['push'](_0x18646b);_0x5dc2c9[_0x9117('0x2c')](_0x50a7d7[_0x3ddc58]['update'](_0x5c0ef6[_0x9117('0x17')],{'transaction':_0x5ef0a3}));}}return BPromise[_0x9117('0x2d')](_0x5dc2c9);});})['then'](function(_0x53dcee){logger['info'](_0x9117('0x20'),_0x5c0ef6);if(_0x53dcee[_0x9117('0x29')]>0x0){logger[_0x9117('0x18')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x53dcee[0x0][_0x9117('0x2e')]['id'],_0x53dcee[0x0][_0x9117('0x2e')]['ContactId'],_0x53dcee[0x0][_0x9117('0x2e')][_0x9117('0x1d')]);}logger['debug']('GetContactDialer',_0x5c0ef6,JSON[_0x9117('0x15')](_0x53dcee));_0x2bc3f4(_0x53dcee);})[_0x9117('0x11')](function(_0x6fd754){logger[_0x9117('0x12')](_0x9117('0x20'),_0x6fd754[_0x9117('0x13')],_0x5c0ef6);_0x44abf2(_0x4364de[_0x9117('0x12')](0x1f4,_0x6fd754[_0x9117('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x51bd02){var _0x3823c7=this;return new Promise(function(_0x36dd12,_0x16f627){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x198182){return db['CmHopperFinal']['create'](_0x51bd02['body'],{'raw':_0x51bd02[_0x9117('0x9')]?_0x51bd02['options'][_0x9117('0xa')]===undefined?!![]:![]:!![],'transaction':_0x198182})['then'](function(){logger[_0x9117('0x18')](_0x9117('0x30'),JSON[_0x9117('0x15')](_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')]),_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')][_0x9117('0x1d')]);return db[_0x9117('0x7')][_0x9117('0x31')]({'where':_0x51bd02[_0x9117('0x9')]?_0x51bd02[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'transaction':_0x198182});});})[_0x9117('0x10')](function(_0x623f29){logger[_0x9117('0x18')](_0x9117('0x32'),_0x51bd02);logger[_0x9117('0x1e')](_0x9117('0x32'),_0x51bd02,JSON['stringify'](_0x623f29));_0x36dd12(_0x623f29);})[_0x9117('0x11')](function(_0x5a080a){logger[_0x9117('0x12')]('MoveContactManagedDialer',_0x5a080a['message'],_0x51bd02);_0x16f627(_0x3823c7['error'](0x1f4,_0x5a080a[_0x9117('0x13')]));});});};exports[_0x9117('0x33')]=function(_0x357e98){var _0x285f18=this;return new Promise(function(_0x150e9c,_0x3b0a6){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x357e98['options']?_0x357e98[_0x9117('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x357e98[_0x9117('0x9')]?_0x357e98[_0x9117('0x9')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9117('0x34'),db[_0x9117('0x2f')]['fn']('IF',db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x36')+util[_0x9117('0x37')](_0x9117('0x38'),moment()['format'](_0x9117('0x39')))+_0x9117('0x3a')))),_0x9117('0x3b')]]})[_0x9117('0x10')](function(_0x54233c){logger[_0x9117('0x18')](_0x9117('0x33'),_0x357e98);logger[_0x9117('0x1e')](_0x9117('0x33'),_0x357e98,JSON[_0x9117('0x15')](_0x54233c));_0x150e9c(_0x54233c);})['catch'](function(_0x6593b0){logger[_0x9117('0x12')](_0x9117('0x33'),_0x6593b0['message'],_0x357e98);_0x3b0a6(_0x285f18['error'](0x1f4,_0x6593b0[_0x9117('0x13')]));});});};exports[_0x9117('0x3c')]=function(_0x58d2de){var _0x33f762=this;return new Promise(function(_0x5083fe,_0x3ce21f){return db['CmContact'][_0x9117('0x3d')]()[_0x9117('0x10')](function(){return db['sequelize']['transaction'](function(_0x454d30){return db[_0x9117('0x7')][_0x9117('0x8')]({'where':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')]['where']||null:null,'attributes':_0x58d2de['options']?_0x58d2de[_0x9117('0x9')]['attributes']||null:null,'limit':0x1,'order':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')]['order']||null:null,'group':db['CmHopper'][_0x9117('0x2a')],'transaction':_0x454d30,'lock':_0x454d30['LOCK'][_0x9117('0x3e')],'include':_0x58d2de[_0x9117('0x9')]?_0x58d2de[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x58d2de[_0x9117('0x9')][_0x9117('0xf')],function(_0x5a5f47){return{'model':db[_0x5a5f47[_0x9117('0xd')]],'as':_0x5a5f47['as'],'attributes':_0x5a5f47[_0x9117('0xe')],'include':_0x5a5f47[_0x9117('0xf')]?_[_0x9117('0xc')](_0x5a5f47['include'],function(_0x480c8e){return{'model':db[_0x480c8e[_0x9117('0xd')]],'as':_0x480c8e['as'],'attributes':_0x480c8e[_0x9117('0xe')],'include':_0x480c8e[_0x9117('0xf')]?_[_0x9117('0xc')](_0x480c8e[_0x9117('0xf')],function(_0x38b221){return{'model':db[_0x38b221[_0x9117('0xd')]],'as':_0x38b221['as'],'attributes':_0x38b221[_0x9117('0xe')]};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x469cbf){var _0x5bcb3c=[];for(var _0xe0f84c=0x0;_0xe0f84c<_0x469cbf[_0x9117('0x29')];_0xe0f84c+=0x1){_0x5bcb3c['push'](_0x469cbf[_0xe0f84c][_0x9117('0x1a')](_0x58d2de['body'],{'transaction':_0x454d30}));}return BPromise['all'](_0x5bcb3c);});})[_0x9117('0x10')](function(_0xd308b5){logger['info'](_0x9117('0x3c'),_0x58d2de);logger[_0x9117('0x1e')]('GetContactRecallMe',_0x58d2de,JSON['stringify'](_0xd308b5));_0x5083fe(_0xd308b5);})[_0x9117('0x11')](function(_0x448ad8){logger[_0x9117('0x12')](_0x9117('0x3c'),_0x448ad8[_0x9117('0x13')],_0x58d2de);_0x3ce21f(_0x33f762[_0x9117('0x12')](0x1f4,_0x448ad8[_0x9117('0x13')]));});});});};exports[_0x9117('0x3f')]=function(_0x1aa302){var _0x10e7c8=this;return new Promise(function(_0x79a5d9,_0x35b290){db[_0x9117('0x24')][_0x9117('0x3d')]()[_0x9117('0x10')](function(_0x276320){return db[_0x9117('0x7')][_0x9117('0x8')]({'raw':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0x1c')]||null:null,'attributes':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0xe')]||null:null,'limit':_0x1aa302['options']?_0x1aa302[_0x9117('0x9')]['limit']||null:null,'include':_0x1aa302[_0x9117('0x9')]?_0x1aa302[_0x9117('0x9')][_0x9117('0xf')]?_[_0x9117('0xc')](_0x1aa302[_0x9117('0x9')][_0x9117('0xf')],function(_0x198530){return{'model':db[_0x198530[_0x9117('0xd')]],'as':_0x198530['as'],'attributes':_0x198530['as']===_0x9117('0x25')?_['keys'](_0x276320):_0x198530[_0x9117('0xe')],'include':_0x198530[_0x9117('0xf')]?_[_0x9117('0xc')](_0x198530[_0x9117('0xf')],function(_0x137d31){return{'model':db[_0x137d31[_0x9117('0xd')]],'as':_0x137d31['as'],'attributes':_0x137d31[_0x9117('0xe')],'include':_0x137d31['include']?_[_0x9117('0xc')](_0x137d31['include'],function(_0x3af284){return{'model':db[_0x3af284[_0x9117('0xd')]],'as':_0x3af284['as'],'attributes':_0x3af284['attributes']};}):[]};}):[]};}):[]:[]})[_0x9117('0x10')](function(_0x22d9e0){logger['info'](_0x9117('0x6'),_0x1aa302);logger['debug'](_0x9117('0x6'),_0x1aa302,JSON[_0x9117('0x15')](_0x22d9e0));_0x79a5d9(_0x22d9e0);})[_0x9117('0x11')](function(_0x417d55){logger[_0x9117('0x12')](_0x9117('0x6'),_0x417d55['message'],_0x1aa302);_0x35b290(_0x10e7c8[_0x9117('0x12')](0x1f4,_0x417d55['message']));});});});};exports[_0x9117('0x40')]=function(_0x54a1e8){var _0x4d3c00=this;return new Promise(function(_0x5aee2d,_0x51dd43){return db[_0x9117('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x54a1e8[_0x9117('0x9')][_0x9117('0x1c')][_0x9117('0x41')]},'attributes':['id','dialTimezone'],'order':[['id',_0x9117('0x42')]]})[_0x9117('0x10')](function(_0x44293c){logger['info']('getContactByPhone',_0x54a1e8);logger[_0x9117('0x1e')]('getContactByPhone',_0x54a1e8,JSON[_0x9117('0x15')](_0x44293c));_0x5aee2d(_0x44293c);})['catch'](function(_0x1b7437){logger[_0x9117('0x12')](_0x9117('0x43'),_0x1b7437[_0x9117('0x13')],_0x54a1e8);_0x51dd43(_0x4d3c00['error'](0x1f4,_0x1b7437[_0x9117('0x13')]));});});};exports['ResetActiveCalls']=function(_0x3bd355){var _0x605085=this;return new Promise(function(_0x10df32,_0x37718e){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x2de9c0){var _0x434f15=_0x3bd355[_0x9117('0x9')]&&_0x3bd355[_0x9117('0x9')][_0x9117('0x1c')]?_0x3bd355[_0x9117('0x9')][_0x9117('0x1c')]:{};return db[_0x9117('0x7')][_0x9117('0x1a')](_0x3bd355[_0x9117('0x17')],{'where':_0x434f15,'transaction':_0x2de9c0})[_0x9117('0x10')](function(_0x187403){logger[_0x9117('0x18')]('ResetActiveCalls',_0x3bd355);logger['debug'](_0x9117('0x44'),_0x3bd355,JSON[_0x9117('0x15')](_0x187403));_0x10df32(_0x187403);})['catch'](function(_0x316a10){logger[_0x9117('0x12')](_0x9117('0x44'),_0x316a10[_0x9117('0x13')],_0x3bd355);_0x37718e(_0x605085['error'](0x1f4,_0x316a10[_0x9117('0x13')]));});});});};exports[_0x9117('0x45')]=function(_0x31fd3b){var _0x10862e=this;var _0x9e68cc=_0x31fd3b[_0x9117('0x17')][_0x9117('0x1c')][_0x9117('0x46')];var _0xb26940=_0x31fd3b[_0x9117('0x17')][_0x9117('0x1c')]['interval'];var _0x174780=_0x31fd3b[_0x9117('0x17')]['where'][_0x9117('0x47')];return new Promise(function(_0x4f608e,_0x51b07c){return db[_0x9117('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x9e68cc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x48')+_0xb26940+_0x9117('0x49')),'$gt':db[_0x9117('0x2f')][_0x9117('0x35')](_0x9117('0x4a'))}},'UserId':{'$in':_0x174780}},'include':[{'model':db['CmContact'],'as':_0x9117('0x25')},{'model':db[_0x9117('0x27')],'as':_0x9117('0x28'),'attributes':['id',_0x9117('0x4b'),_0x9117('0x4c')]},{'model':db[_0x9117('0x4d')],'as':_0x9117('0x4e')}]})['then'](function(_0x20e386){if(_0x20e386['length']>0x0){return db[_0x9117('0x2f')][_0x9117('0x21')](function(_0x13586a){return db[_0x9117('0x7')]['update']({'recallmeNotifiedDate':db[_0x9117('0x2f')]['literal'](_0x9117('0x4a'))},{'where':{'id':{'$in':_['map'](_0x20e386,'id')}},'transaction':_0x13586a})[_0x9117('0x10')](function(){_0x4f608e(_0x20e386);})['catch'](function(_0x2871f1){logger[_0x9117('0x12')](_0x9117('0x45'),_0x2871f1['message'],_0x31fd3b);_0x51b07c(_0x10862e['error'](0x1f4,_0x2871f1[_0x9117('0x13')]));});})[_0x9117('0x11')](function(_0x1df5c8){logger[_0x9117('0x12')](_0x9117('0x45'),_0x1df5c8[_0x9117('0x13')],_0x31fd3b);_0x51b07c(_0x10862e[_0x9117('0x12')](0x1f4,_0x1df5c8['message']));});}else{_0x4f608e(_0x20e386);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ff9998b..914295a 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 _0x2dbc=['/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','create','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','Router','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x318666,_0x58de8f){var _0x251b10=function(_0x43d92f){while(--_0x43d92f){_0x318666['push'](_0x318666['shift']());}};_0x251b10(++_0x58de8f);}(_0x2dbc,0xa3));var _0xc2db=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x2dbc[_0x421eeb];return _0x2c7371;};'use strict';var express=require('express');var router=express[_0xc2db('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc2db('0x1'));router[_0xc2db('0x2')]('/',auth[_0xc2db('0x3')](),controller[_0xc2db('0x4')]);router['get'](_0xc2db('0x5'),auth[_0xc2db('0x3')](),controller[_0xc2db('0x6')]);router[_0xc2db('0x2')](_0xc2db('0x7'),auth[_0xc2db('0x3')](),controller[_0xc2db('0x8')]);router['get']('/timezones',auth[_0xc2db('0x3')](),controller[_0xc2db('0x9')]);router[_0xc2db('0x2')](_0xc2db('0xa'),auth[_0xc2db('0x3')](),controller[_0xc2db('0xb')]);router['get']('/:id/previewrecall',auth[_0xc2db('0x3')](),controller[_0xc2db('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc2db('0xd')]);router[_0xc2db('0xe')](_0xc2db('0xf'),auth[_0xc2db('0x3')](),controller[_0xc2db('0x10')]);router[_0xc2db('0xe')](_0xc2db('0x11'),auth[_0xc2db('0x3')](),controller[_0xc2db('0x12')]);router[_0xc2db('0x13')](_0xc2db('0xa'),auth['isAuthenticated'](),controller[_0xc2db('0x14')]);router[_0xc2db('0x15')](_0xc2db('0xa'),auth['isAuthenticated'](),controller[_0xc2db('0x16')]);module[_0xc2db('0x17')]=router; \ No newline at end of file +var _0xc58e=['describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/preview','post','getTimezone','put','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0xc58e,0x1c1));var _0xec58=function(_0x2d01c5,_0x3fa4ef){_0x2d01c5=_0x2d01c5-0x0;var _0x422634=_0xc58e[_0x2d01c5];return _0x422634;};'use strict';var express=require(_0xec58('0x0'));var router=express[_0xec58('0x1')]();var auth=require(_0xec58('0x2'));var controller=require('./cmHopper.controller');router[_0xec58('0x3')]('/',auth[_0xec58('0x4')](),controller[_0xec58('0x5')]);router[_0xec58('0x3')](_0xec58('0x6'),auth[_0xec58('0x4')](),controller[_0xec58('0x7')]);router['get'](_0xec58('0x8'),auth[_0xec58('0x4')](),controller[_0xec58('0x9')]);router[_0xec58('0x3')]('/timezones',auth[_0xec58('0x4')](),controller[_0xec58('0xa')]);router['get'](_0xec58('0xb'),auth[_0xec58('0x4')](),controller[_0xec58('0xc')]);router[_0xec58('0x3')]('/:id/previewrecall',auth[_0xec58('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0xec58('0x4')](),controller['create']);router['post'](_0xec58('0xd'),auth[_0xec58('0x4')](),controller['getPreview']);router[_0xec58('0xe')]('/timezone',auth[_0xec58('0x4')](),controller[_0xec58('0xf')]);router[_0xec58('0x10')](_0xec58('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xec58('0xb'),auth[_0xec58('0x4')](),controller[_0xec58('0x11')]);module[_0xec58('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 74e0d7a..0c81341 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 _0xe09e=['exports','INTEGER','STRING','DATE','moment','sequelize'];(function(_0x192bc9,_0x4408c7){var _0x48397b=function(_0x2e03e6){while(--_0x2e03e6){_0x192bc9['push'](_0x192bc9['shift']());}};_0x48397b(++_0x4408c7);}(_0xe09e,0x166));var _0xee09=function(_0x3b94c3,_0x7f0fc6){_0x3b94c3=_0x3b94c3-0x0;var _0x1134e0=_0xe09e[_0x3b94c3];return _0x1134e0;};'use strict';var moment=require(_0xee09('0x0'));var Sequelize=require(_0xee09('0x1'));module[_0xee09('0x2')]={'CmHopperId':{'type':Sequelize[_0xee09('0x3')]},'phone':{'type':Sequelize[_0xee09('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xee09('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xee09('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x85d2=['moment','sequelize','exports','STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x11789a,_0x50facd){var _0x214efd=function(_0x34c0f7){while(--_0x34c0f7){_0x11789a['push'](_0x11789a['shift']());}};_0x214efd(++_0x50facd);}(_0x85d2,0xaf));var _0x285d=function(_0x5d322f,_0x422208){_0x5d322f=_0x5d322f-0x0;var _0x3dd201=_0x85d2[_0x5d322f];return _0x3dd201;};'use strict';var moment=require(_0x285d('0x0'));var Sequelize=require(_0x285d('0x1'));module[_0x285d('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x285d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x285d('0x5')],'defaultValue':moment()['format'](_0x285d('0x6'))},'countbusyretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x285d('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d015dae..5637cc5 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 _0xfe61=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','index','map','CmHopperAdditionalPhone','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x282092,_0x3ee12e){var _0x3febaa=function(_0x6fd9e9){while(--_0x6fd9e9){_0x282092['push'](_0x282092['shift']());}};_0x3febaa(++_0x3ee12e);}(_0xfe61,0x14b));var _0x1fe6=function(_0xc20b6c,_0x94fa54){_0xc20b6c=_0xc20b6c-0x0;var _0x33b172=_0xfe61[_0xc20b6c];return _0x33b172;};'use strict';var emlformat=require(_0x1fe6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fe6('0x1'));var jsonpatch=require(_0x1fe6('0x2'));var rp=require('request-promise');var moment=require(_0x1fe6('0x3'));var BPromise=require(_0x1fe6('0x4'));var Mustache=require('mustache');var util=require(_0x1fe6('0x5'));var path=require(_0x1fe6('0x6'));var sox=require(_0x1fe6('0x7'));var csv=require(_0x1fe6('0x8'));var ejs=require(_0x1fe6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fe6('0xa'));var squel=require(_0x1fe6('0xb'));var crypto=require(_0x1fe6('0xc'));var jsforce=require(_0x1fe6('0xd'));var deskjs=require(_0x1fe6('0xe'));var toCsv=require(_0x1fe6('0x8'));var querystring=require('querystring');var Papa=require(_0x1fe6('0xf'));var Redis=require(_0x1fe6('0x10'));var authService=require(_0x1fe6('0x11'));var qs=require(_0x1fe6('0x12'));var as=require(_0x1fe6('0x13'));var hardwareService=require(_0x1fe6('0x14'));var logger=require(_0x1fe6('0x15'))(_0x1fe6('0x16'));var utils=require(_0x1fe6('0x17'));var config=require(_0x1fe6('0x18'));var licenseUtil=require(_0x1fe6('0x19'));var db=require(_0x1fe6('0x1a'))['db'];function respondWithStatusCode(_0x27e710,_0x46d324){_0x46d324=_0x46d324||0xcc;return function(_0x51b82d){if(_0x51b82d){return _0x27e710['sendStatus'](_0x46d324);}return _0x27e710[_0x1fe6('0x1b')](_0x46d324)[_0x1fe6('0x1c')]();};}function respondWithResult(_0x37a980,_0x264b06){_0x264b06=_0x264b06||0xc8;return function(_0x51c209){if(_0x51c209){return _0x37a980['status'](_0x264b06)[_0x1fe6('0x1d')](_0x51c209);}};}function respondWithFilteredResult(_0x460f78,_0xe9dff7){return function(_0x3f7f49){if(_0x3f7f49){var _0x4867d6=typeof _0xe9dff7[_0x1fe6('0x1e')]===_0x1fe6('0x1f')&&typeof _0xe9dff7[_0x1fe6('0x20')]===_0x1fe6('0x1f');var _0x4f85a7=_0x3f7f49[_0x1fe6('0x21')];var _0x3e9dd7=_0x4867d6?0x0:_0xe9dff7[_0x1fe6('0x1e')];var _0x31d5e0=_0x4867d6?_0x3f7f49[_0x1fe6('0x21')]:_0xe9dff7[_0x1fe6('0x1e')]+_0xe9dff7[_0x1fe6('0x20')];var _0x2ffb2e;if(_0x31d5e0>=_0x4f85a7){_0x31d5e0=_0x4f85a7;_0x2ffb2e=0xc8;}else{_0x2ffb2e=0xce;}_0x460f78['status'](_0x2ffb2e);return _0x460f78[_0x1fe6('0x22')](_0x1fe6('0x23'),_0x3e9dd7+'-'+_0x31d5e0+'/'+_0x4f85a7)['json'](_0x3f7f49);}return null;};}function patchUpdates(_0x433b0f){return function(_0x3a94ad){try{jsonpatch[_0x1fe6('0x24')](_0x3a94ad,_0x433b0f,!![]);}catch(_0x4cb7a2){return BPromise['reject'](_0x4cb7a2);}return _0x3a94ad[_0x1fe6('0x25')]();};}function saveUpdates(_0x5b0724,_0x460d29){return function(_0x33ea63){if(_0x33ea63){return _0x33ea63[_0x1fe6('0x26')](_0x5b0724)['then'](function(_0x59dd84){return _0x59dd84;});}return null;};}function removeEntity(_0x216560,_0x409dae){return function(_0x448bff){if(_0x448bff){return _0x448bff[_0x1fe6('0x27')]()[_0x1fe6('0x28')](function(){var _0x336bc0=_0x448bff[_0x1fe6('0x29')]({'plain':!![]});var _0x1b3968=_0x1fe6('0x2a');return db[_0x1fe6('0x2b')]['destroy']({'where':{'type':_0x1b3968,'resourceId':_0x336bc0['id']}})['then'](function(){return _0x448bff;});})['then'](function(){_0x216560[_0x1fe6('0x1b')](0xcc)[_0x1fe6('0x1c')]();});}};}function handleEntityNotFound(_0x22a395,_0x4dde9e){return function(_0x4200e3){if(!_0x4200e3){_0x22a395[_0x1fe6('0x2c')](0x194);}return _0x4200e3;};}function handleError(_0x4f7479,_0x200de8){_0x200de8=_0x200de8||0x1f4;return function(_0x2c8d92){logger[_0x1fe6('0x2d')](_0x2c8d92[_0x1fe6('0x2e')]);if(_0x2c8d92[_0x1fe6('0x2f')]){delete _0x2c8d92[_0x1fe6('0x2f')];}_0x4f7479[_0x1fe6('0x1b')](_0x200de8)['send'](_0x2c8d92);};}exports[_0x1fe6('0x30')]=function(_0x29c08f,_0x55aede){var _0x13b288={},_0x3bc03f={},_0x12dd15={'count':0x0,'rows':[]};var _0x5b83b0=_[_0x1fe6('0x31')](db[_0x1fe6('0x32')]['rawAttributes'],function(_0x127805){return{'name':_0x127805['fieldName'],'type':_0x127805[_0x1fe6('0x33')][_0x1fe6('0x34')]};});_0x3bc03f[_0x1fe6('0x35')]=_['map'](_0x5b83b0,_0x1fe6('0x2f'));_0x3bc03f[_0x1fe6('0x36')]=_[_0x1fe6('0x37')](_0x29c08f[_0x1fe6('0x36')]);_0x3bc03f['filters']=_[_0x1fe6('0x38')](_0x3bc03f[_0x1fe6('0x35')],_0x3bc03f[_0x1fe6('0x36')]);_0x13b288[_0x1fe6('0x39')]=_['intersection'](_0x3bc03f['model'],qs[_0x1fe6('0x3a')](_0x29c08f['query'][_0x1fe6('0x3a')]));_0x13b288[_0x1fe6('0x39')]=_0x13b288[_0x1fe6('0x39')][_0x1fe6('0x3b')]?_0x13b288[_0x1fe6('0x39')]:_0x3bc03f[_0x1fe6('0x35')];if(!_0x29c08f['query']['hasOwnProperty'](_0x1fe6('0x3c'))){_0x13b288[_0x1fe6('0x20')]=qs[_0x1fe6('0x20')](_0x29c08f[_0x1fe6('0x36')][_0x1fe6('0x20')]);_0x13b288[_0x1fe6('0x1e')]=qs[_0x1fe6('0x1e')](_0x29c08f[_0x1fe6('0x36')][_0x1fe6('0x1e')]);}_0x13b288[_0x1fe6('0x3d')]=qs[_0x1fe6('0x3e')](_0x29c08f[_0x1fe6('0x36')]['sort']);_0x13b288[_0x1fe6('0x3f')]=qs[_0x1fe6('0x40')](_[_0x1fe6('0x41')](_0x29c08f[_0x1fe6('0x36')],_0x3bc03f['filters']),_0x5b83b0);if(_0x29c08f['query'][_0x1fe6('0x42')]){_0x13b288[_0x1fe6('0x3f')]=_[_0x1fe6('0x43')](_0x13b288[_0x1fe6('0x3f')],{'$or':_[_0x1fe6('0x31')](_0x5b83b0,function(_0x1ac011){if(_0x1ac011[_0x1fe6('0x33')]!==_0x1fe6('0x44')){var _0x816ef5={};_0x816ef5[_0x1ac011['name']]={'$like':'%'+_0x29c08f[_0x1fe6('0x36')][_0x1fe6('0x42')]+'%'};return _0x816ef5;}})});}_0x13b288=_['merge']({},_0x13b288,_0x29c08f[_0x1fe6('0x45')]);var _0x157e82={'where':_0x13b288[_0x1fe6('0x3f')]};return db[_0x1fe6('0x32')][_0x1fe6('0x21')](_0x157e82)[_0x1fe6('0x28')](function(_0xca29ac){_0x12dd15[_0x1fe6('0x21')]=_0xca29ac;if(_0x29c08f[_0x1fe6('0x36')][_0x1fe6('0x46')]){_0x13b288['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x1fe6('0x47')](_0x13b288);})[_0x1fe6('0x28')](function(_0x2b2a81){_0x12dd15[_0x1fe6('0x48')]=_0x2b2a81;return _0x12dd15;})['then'](respondWithFilteredResult(_0x55aede,_0x13b288))[_0x1fe6('0x49')](handleError(_0x55aede,null));};exports[_0x1fe6('0x4a')]=function(_0x25ad30,_0x46b3ab){var _0x446593={'raw':!![],'where':{'id':_0x25ad30['params']['id']}},_0x108c2b={};_0x108c2b[_0x1fe6('0x35')]=_['keys'](db['CmHopperAdditionalPhone']['rawAttributes']);_0x108c2b[_0x1fe6('0x36')]=_[_0x1fe6('0x37')](_0x25ad30['query']);_0x108c2b['filters']=_[_0x1fe6('0x38')](_0x108c2b[_0x1fe6('0x35')],_0x108c2b[_0x1fe6('0x36')]);_0x446593[_0x1fe6('0x39')]=_[_0x1fe6('0x38')](_0x108c2b[_0x1fe6('0x35')],qs['fields'](_0x25ad30[_0x1fe6('0x36')][_0x1fe6('0x3a')]));_0x446593[_0x1fe6('0x39')]=_0x446593[_0x1fe6('0x39')]['length']?_0x446593['attributes']:_0x108c2b['model'];if(_0x25ad30[_0x1fe6('0x36')][_0x1fe6('0x46')]){_0x446593[_0x1fe6('0x4b')]=[{'all':!![]}];}_0x446593=_[_0x1fe6('0x43')]({},_0x446593,_0x25ad30['options']);return db['CmHopperAdditionalPhone']['find'](_0x446593)[_0x1fe6('0x28')](handleEntityNotFound(_0x46b3ab,null))[_0x1fe6('0x28')](respondWithResult(_0x46b3ab,null))[_0x1fe6('0x49')](handleError(_0x46b3ab,null));};exports[_0x1fe6('0x4c')]=function(_0x599803,_0x54a3f3){return db[_0x1fe6('0x32')][_0x1fe6('0x4c')](_0x599803[_0x1fe6('0x4d')],{})[_0x1fe6('0x28')](function(_0x32f5cf){var _0x2920d0=_0x599803[_0x1fe6('0x4e')][_0x1fe6('0x29')]({'plain':!![]});if(!_0x2920d0)throw new Error(_0x1fe6('0x4f'));if(_0x2920d0['role']===_0x1fe6('0x4e')){var _0x150b0b=_0x32f5cf[_0x1fe6('0x29')]({'plain':!![]});var _0x4856ed=_0x1fe6('0x2a');return db[_0x1fe6('0x50')]['find']({'where':{'name':_0x4856ed,'userProfileId':_0x2920d0[_0x1fe6('0x51')]},'raw':!![]})[_0x1fe6('0x28')](function(_0x5e5e53){if(_0x5e5e53&&_0x5e5e53[_0x1fe6('0x52')]===0x0){return db['UserProfileResource'][_0x1fe6('0x4c')]({'name':_0x150b0b[_0x1fe6('0x2f')],'resourceId':_0x150b0b['id'],'type':_0x5e5e53[_0x1fe6('0x2f')],'sectionId':_0x5e5e53['id']},{})['then'](function(){return _0x32f5cf;});}else{return _0x32f5cf;}})[_0x1fe6('0x49')](function(_0x5944a6){logger[_0x1fe6('0x2d')](_0x1fe6('0x53'),_0x5944a6);throw _0x5944a6;});}return _0x32f5cf;})[_0x1fe6('0x28')](respondWithResult(_0x54a3f3,0xc9))['catch'](handleError(_0x54a3f3,null));};exports['update']=function(_0x4ef67d,_0x4ed94f){if(_0x4ef67d[_0x1fe6('0x4d')]['id']){delete _0x4ef67d['body']['id'];}return db[_0x1fe6('0x32')][_0x1fe6('0x54')]({'where':{'id':_0x4ef67d[_0x1fe6('0x55')]['id']}})[_0x1fe6('0x28')](handleEntityNotFound(_0x4ed94f,null))[_0x1fe6('0x28')](saveUpdates(_0x4ef67d[_0x1fe6('0x4d')],null))[_0x1fe6('0x28')](respondWithResult(_0x4ed94f,null))[_0x1fe6('0x49')](handleError(_0x4ed94f,null));};exports[_0x1fe6('0x27')]=function(_0x13b270,_0x1d291e){return db[_0x1fe6('0x32')]['find']({'where':{'id':_0x13b270[_0x1fe6('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d291e,null))[_0x1fe6('0x28')](removeEntity(_0x1d291e,null))[_0x1fe6('0x49')](handleError(_0x1d291e,null));}; \ No newline at end of file +var _0x77a1=['error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','CmHopperAdditionalPhone','includeAll','include','catch','show','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','CmHopperAdditionalPhones'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x77a1,0x114));var _0x177a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x77a1[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x177a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x177a('0x1'));var rp=require('request-promise');var moment=require(_0x177a('0x2'));var BPromise=require(_0x177a('0x3'));var Mustache=require(_0x177a('0x4'));var util=require(_0x177a('0x5'));var path=require(_0x177a('0x6'));var sox=require(_0x177a('0x7'));var csv=require(_0x177a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x177a('0x9'));var _=require(_0x177a('0xa'));var squel=require('squel');var crypto=require(_0x177a('0xb'));var jsforce=require(_0x177a('0xc'));var deskjs=require(_0x177a('0xd'));var toCsv=require(_0x177a('0x8'));var querystring=require('querystring');var Papa=require(_0x177a('0xe'));var Redis=require(_0x177a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x177a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x177a('0x11'));var utils=require(_0x177a('0x12'));var config=require(_0x177a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x177a('0x14'))['db'];function respondWithStatusCode(_0x164e5d,_0x2d478a){_0x2d478a=_0x2d478a||0xcc;return function(_0x26b70b){if(_0x26b70b){return _0x164e5d[_0x177a('0x15')](_0x2d478a);}return _0x164e5d[_0x177a('0x16')](_0x2d478a)[_0x177a('0x17')]();};}function respondWithResult(_0x4468f6,_0x16ac10){_0x16ac10=_0x16ac10||0xc8;return function(_0x498937){if(_0x498937){return _0x4468f6[_0x177a('0x16')](_0x16ac10)[_0x177a('0x18')](_0x498937);}};}function respondWithFilteredResult(_0x5c066d,_0x2c5d56){return function(_0x57dca0){if(_0x57dca0){var _0x3d62d7=typeof _0x2c5d56[_0x177a('0x19')]===_0x177a('0x1a')&&typeof _0x2c5d56['limit']===_0x177a('0x1a');var _0x263da3=_0x57dca0['count'];var _0x29b418=_0x3d62d7?0x0:_0x2c5d56[_0x177a('0x19')];var _0x217aaa=_0x3d62d7?_0x57dca0[_0x177a('0x1b')]:_0x2c5d56[_0x177a('0x19')]+_0x2c5d56[_0x177a('0x1c')];var _0x404df4;if(_0x217aaa>=_0x263da3){_0x217aaa=_0x263da3;_0x404df4=0xc8;}else{_0x404df4=0xce;}_0x5c066d[_0x177a('0x16')](_0x404df4);return _0x5c066d['set'](_0x177a('0x1d'),_0x29b418+'-'+_0x217aaa+'/'+_0x263da3)[_0x177a('0x18')](_0x57dca0);}return null;};}function patchUpdates(_0x32fa17){return function(_0x2c3e86){try{jsonpatch[_0x177a('0x1e')](_0x2c3e86,_0x32fa17,!![]);}catch(_0x20ac00){return BPromise[_0x177a('0x1f')](_0x20ac00);}return _0x2c3e86['save']();};}function saveUpdates(_0x5bcef9,_0x55d2bc){return function(_0x397abd){if(_0x397abd){return _0x397abd['update'](_0x5bcef9)[_0x177a('0x20')](function(_0xaffc7){return _0xaffc7;});}return null;};}function removeEntity(_0x4bfa80,_0x4ebeaf){return function(_0x56668e){if(_0x56668e){return _0x56668e[_0x177a('0x21')]()['then'](function(){var _0x4df279=_0x56668e[_0x177a('0x22')]({'plain':!![]});var _0x9e672b=_0x177a('0x23');return db['UserProfileResource'][_0x177a('0x21')]({'where':{'type':_0x9e672b,'resourceId':_0x4df279['id']}})[_0x177a('0x20')](function(){return _0x56668e;});})['then'](function(){_0x4bfa80[_0x177a('0x16')](0xcc)[_0x177a('0x17')]();});}};}function handleEntityNotFound(_0x43e721,_0x1d6f9e){return function(_0x27c5aa){if(!_0x27c5aa){_0x43e721[_0x177a('0x15')](0x194);}return _0x27c5aa;};}function handleError(_0x578f83,_0xb0c8ba){_0xb0c8ba=_0xb0c8ba||0x1f4;return function(_0x239b70){logger[_0x177a('0x24')](_0x239b70[_0x177a('0x25')]);if(_0x239b70[_0x177a('0x26')]){delete _0x239b70['name'];}_0x578f83[_0x177a('0x16')](_0xb0c8ba)[_0x177a('0x27')](_0x239b70);};}exports[_0x177a('0x28')]=function(_0x4f4d8e,_0x4b7c15){var _0x2c6f02={},_0x58c3e0={},_0x1ef918={'count':0x0,'rows':[]};var _0x14a0c5=_[_0x177a('0x29')](db['CmHopperAdditionalPhone'][_0x177a('0x2a')],function(_0x11344a){return{'name':_0x11344a[_0x177a('0x2b')],'type':_0x11344a['type'][_0x177a('0x2c')]};});_0x58c3e0[_0x177a('0x2d')]=_[_0x177a('0x29')](_0x14a0c5,_0x177a('0x26'));_0x58c3e0[_0x177a('0x2e')]=_['keys'](_0x4f4d8e[_0x177a('0x2e')]);_0x58c3e0['filters']=_['intersection'](_0x58c3e0[_0x177a('0x2d')],_0x58c3e0[_0x177a('0x2e')]);_0x2c6f02[_0x177a('0x2f')]=_[_0x177a('0x30')](_0x58c3e0[_0x177a('0x2d')],qs['fields'](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x31')]));_0x2c6f02[_0x177a('0x2f')]=_0x2c6f02[_0x177a('0x2f')][_0x177a('0x32')]?_0x2c6f02['attributes']:_0x58c3e0['model'];if(!_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x33')](_0x177a('0x34'))){_0x2c6f02[_0x177a('0x1c')]=qs[_0x177a('0x1c')](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x1c')]);_0x2c6f02[_0x177a('0x19')]=qs[_0x177a('0x19')](_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x19')]);}_0x2c6f02[_0x177a('0x35')]=qs[_0x177a('0x36')](_0x4f4d8e['query'][_0x177a('0x36')]);_0x2c6f02[_0x177a('0x37')]=qs[_0x177a('0x38')](_[_0x177a('0x39')](_0x4f4d8e['query'],_0x58c3e0[_0x177a('0x38')]),_0x14a0c5);if(_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x3a')]){_0x2c6f02[_0x177a('0x37')]=_[_0x177a('0x3b')](_0x2c6f02[_0x177a('0x37')],{'$or':_[_0x177a('0x29')](_0x14a0c5,function(_0x58cf1d){if(_0x58cf1d[_0x177a('0x3c')]!=='VIRTUAL'){var _0x563ddd={};_0x563ddd[_0x58cf1d['name']]={'$like':'%'+_0x4f4d8e['query']['filter']+'%'};return _0x563ddd;}})});}_0x2c6f02=_[_0x177a('0x3b')]({},_0x2c6f02,_0x4f4d8e['options']);var _0x435580={'where':_0x2c6f02[_0x177a('0x37')]};return db[_0x177a('0x3d')][_0x177a('0x1b')](_0x435580)['then'](function(_0xc54d9){_0x1ef918[_0x177a('0x1b')]=_0xc54d9;if(_0x4f4d8e[_0x177a('0x2e')][_0x177a('0x3e')]){_0x2c6f02[_0x177a('0x3f')]=[{'all':!![]}];}return db[_0x177a('0x3d')]['findAll'](_0x2c6f02);})['then'](function(_0x4d935c){_0x1ef918['rows']=_0x4d935c;return _0x1ef918;})['then'](respondWithFilteredResult(_0x4b7c15,_0x2c6f02))[_0x177a('0x40')](handleError(_0x4b7c15,null));};exports[_0x177a('0x41')]=function(_0x32baaa,_0x56898d){var _0x234414={'raw':!![],'where':{'id':_0x32baaa[_0x177a('0x42')]['id']}},_0xd2cf38={};_0xd2cf38[_0x177a('0x2d')]=_[_0x177a('0x43')](db['CmHopperAdditionalPhone'][_0x177a('0x2a')]);_0xd2cf38[_0x177a('0x2e')]=_['keys'](_0x32baaa[_0x177a('0x2e')]);_0xd2cf38[_0x177a('0x38')]=_[_0x177a('0x30')](_0xd2cf38[_0x177a('0x2d')],_0xd2cf38[_0x177a('0x2e')]);_0x234414['attributes']=_[_0x177a('0x30')](_0xd2cf38[_0x177a('0x2d')],qs[_0x177a('0x31')](_0x32baaa['query'][_0x177a('0x31')]));_0x234414[_0x177a('0x2f')]=_0x234414[_0x177a('0x2f')][_0x177a('0x32')]?_0x234414[_0x177a('0x2f')]:_0xd2cf38[_0x177a('0x2d')];if(_0x32baaa[_0x177a('0x2e')]['includeAll']){_0x234414['include']=[{'all':!![]}];}_0x234414=_[_0x177a('0x3b')]({},_0x234414,_0x32baaa[_0x177a('0x44')]);return db[_0x177a('0x3d')]['find'](_0x234414)['then'](handleEntityNotFound(_0x56898d,null))['then'](respondWithResult(_0x56898d,null))['catch'](handleError(_0x56898d,null));};exports['create']=function(_0x4a3caf,_0x3ab5d8){return db[_0x177a('0x3d')][_0x177a('0x45')](_0x4a3caf[_0x177a('0x46')],{})['then'](function(_0x3c11e3){var _0x2d6bd2=_0x4a3caf['user'][_0x177a('0x22')]({'plain':!![]});if(!_0x2d6bd2)throw new Error(_0x177a('0x47'));if(_0x2d6bd2['role']===_0x177a('0x48')){var _0x40387c=_0x3c11e3[_0x177a('0x22')]({'plain':!![]});var _0x2315ab=_0x177a('0x23');return db[_0x177a('0x49')][_0x177a('0x4a')]({'where':{'name':_0x2315ab,'userProfileId':_0x2d6bd2[_0x177a('0x4b')]},'raw':!![]})[_0x177a('0x20')](function(_0x249798){if(_0x249798&&_0x249798['autoAssociation']===0x0){return db[_0x177a('0x4c')][_0x177a('0x45')]({'name':_0x40387c[_0x177a('0x26')],'resourceId':_0x40387c['id'],'type':_0x249798[_0x177a('0x26')],'sectionId':_0x249798['id']},{})[_0x177a('0x20')](function(){return _0x3c11e3;});}else{return _0x3c11e3;}})[_0x177a('0x40')](function(_0x955d9c){logger[_0x177a('0x24')](_0x177a('0x4d'),_0x955d9c);throw _0x955d9c;});}return _0x3c11e3;})[_0x177a('0x20')](respondWithResult(_0x3ab5d8,0xc9))[_0x177a('0x40')](handleError(_0x3ab5d8,null));};exports['update']=function(_0x5cde70,_0x211dbb){if(_0x5cde70[_0x177a('0x46')]['id']){delete _0x5cde70['body']['id'];}return db['CmHopperAdditionalPhone'][_0x177a('0x4a')]({'where':{'id':_0x5cde70[_0x177a('0x42')]['id']}})['then'](handleEntityNotFound(_0x211dbb,null))['then'](saveUpdates(_0x5cde70[_0x177a('0x46')],null))[_0x177a('0x20')](respondWithResult(_0x211dbb,null))[_0x177a('0x40')](handleError(_0x211dbb,null));};exports[_0x177a('0x21')]=function(_0x51d0cd,_0x187251){return db['CmHopperAdditionalPhone'][_0x177a('0x4a')]({'where':{'id':_0x51d0cd[_0x177a('0x42')]['id']}})['then'](handleEntityNotFound(_0x187251,null))[_0x177a('0x20')](removeEntity(_0x187251,null))[_0x177a('0x40')](handleError(_0x187251,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 96dc472..107d4c1 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 _0x96b2=['./cmHopperAdditionalPhone.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5ebe66,_0xd9ec7b){var _0x396d55=function(_0x2abf61){while(--_0x2abf61){_0x5ebe66['push'](_0x5ebe66['shift']());}};_0x396d55(++_0xd9ec7b);}(_0x96b2,0x1cf));var _0x296b=function(_0xe47424,_0x2ae860){_0xe47424=_0xe47424-0x0;var _0x41572f=_0x96b2[_0xe47424];return _0x41572f;};'use strict';var _=require('lodash');var util=require(_0x296b('0x0'));var logger=require(_0x296b('0x1'))(_0x296b('0x2'));var moment=require('moment');var BPromise=require(_0x296b('0x3'));var rp=require(_0x296b('0x4'));var fs=require('fs');var path=require(_0x296b('0x5'));var rimraf=require('rimraf');var config=require(_0x296b('0x6'));var attributes=require(_0x296b('0x7'));module[_0x296b('0x8')]=function(_0x1a97b7,_0x57cba3){return _0x1a97b7[_0x296b('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb757=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x342153,_0x5819c6){var _0x4dfa15=function(_0x41a4fb){while(--_0x41a4fb){_0x342153['push'](_0x342153['shift']());}};_0x4dfa15(++_0x5819c6);}(_0xb757,0x1d9));var _0x7b75=function(_0x30f697,_0x3c6248){_0x30f697=_0x30f697-0x0;var _0x46cab7=_0xb757[_0x30f697];return _0x46cab7;};'use strict';var _=require(_0x7b75('0x0'));var util=require(_0x7b75('0x1'));var logger=require(_0x7b75('0x2'))('api');var moment=require(_0x7b75('0x3'));var BPromise=require(_0x7b75('0x4'));var rp=require(_0x7b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b75('0x6'));var config=require(_0x7b75('0x7'));var attributes=require(_0x7b75('0x8'));module['exports']=function(_0x49a7cd,_0x26665b){return _0x49a7cd[_0x7b75('0x9')](_0x7b75('0xa'),attributes,{'tableName':_0x7b75('0xb'),'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 1b50820..d50fc0f 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 _0x9edd=['OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','SwapAdditionalPhones','findOne','duration','waitTime','isNil','scheduledat','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone'];(function(_0x51f3d5,_0x52cedb){var _0x2b5335=function(_0x844175){while(--_0x844175){_0x51f3d5['push'](_0x51f3d5['shift']());}};_0x2b5335(++_0x52cedb);}(_0x9edd,0x137));var _0xd9ed=function(_0x478e52,_0x683fc8){_0x478e52=_0x478e52-0x0;var _0x577fac=_0x9edd[_0x478e52];return _0x577fac;};'use strict';var _=require(_0xd9ed('0x0'));var util=require(_0xd9ed('0x1'));var moment=require(_0xd9ed('0x2'));var BPromise=require(_0xd9ed('0x3'));var rs=require(_0xd9ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9ed('0x5'))['db'];var utils=require(_0xd9ed('0x6'));var logger=require(_0xd9ed('0x7'))('rpc');var config=require(_0xd9ed('0x8'));var jayson=require(_0xd9ed('0x9'));var client=jayson['client'][_0xd9ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274549,_0x52728b,_0xd2eda1){return new BPromise(function(_0x1f4df2,_0xbefe44){return client[_0xd9ed('0xb')](_0x274549,_0xd2eda1)['then'](function(_0x117e7d){logger[_0xd9ed('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52728b,_0xd9ed('0xd'));logger[_0xd9ed('0xe')](_0xd9ed('0xf'),_0x52728b,_0xd9ed('0xd'),JSON[_0xd9ed('0x10')](_0x117e7d));if(_0x117e7d[_0xd9ed('0x11')]){if(_0x117e7d[_0xd9ed('0x11')][_0xd9ed('0x12')]===0x1f4){logger[_0xd9ed('0x11')](_0xd9ed('0x13'),_0x52728b,_0x117e7d[_0xd9ed('0x11')][_0xd9ed('0x14')]);return _0xbefe44(_0x117e7d[_0xd9ed('0x11')][_0xd9ed('0x14')]);}logger['error'](_0xd9ed('0x13'),_0x52728b,_0x117e7d[_0xd9ed('0x11')][_0xd9ed('0x14')]);return _0x1f4df2(_0x117e7d[_0xd9ed('0x11')][_0xd9ed('0x14')]);}else{logger[_0xd9ed('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52728b,_0xd9ed('0xd'));_0x1f4df2(_0x117e7d['result'][_0xd9ed('0x14')]);}})[_0xd9ed('0x15')](function(_0x4eb87a){logger[_0xd9ed('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52728b,_0x4eb87a);_0xbefe44(_0x4eb87a);});});}exports[_0xd9ed('0x16')]=function(_0x332401){var _0x4ccb90=this;return new Promise(function(_0x3a66d5,_0x4cab47){return db[_0xd9ed('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x332401['body'][_0xd9ed('0x18')],'ListId':_0x332401[_0xd9ed('0x19')][_0xd9ed('0x1a')],'VoiceQueueId':_0x332401[_0xd9ed('0x19')][_0xd9ed('0x1b')]===undefined?null:_0x332401[_0xd9ed('0x19')]['VoiceQueueId'],'CampaignId':_0x332401[_0xd9ed('0x19')][_0xd9ed('0x1c')]===undefined?null:_0x332401[_0xd9ed('0x19')]['CampaignId']}})[_0xd9ed('0x1d')](function(_0x31d58d){if(_0x31d58d!=null){return db[_0xd9ed('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31d58d['id'],'OrderBy':{'$gt':_0x31d58d[_0xd9ed('0x1f')]}},'order':[[_0xd9ed('0x1f'),_0xd9ed('0x20')]]})['then'](function(_0x4a4034){var _0x1d0306=0x0;if(_0x4a4034){if(_0x4a4034[_0xd9ed('0x21')]+_0x4a4034[_0xd9ed('0x22')]+_0x4a4034[_0xd9ed('0x23')]+_0x4a4034['countnosuchnumberretry']+_0x4a4034[_0xd9ed('0x24')]+_0x4a4034[_0xd9ed('0x25')]+_0x4a4034[_0xd9ed('0x26')]+_0x4a4034[_0xd9ed('0x27')]<_0x332401[_0xd9ed('0x28')][_0xd9ed('0x29')])_0x1d0306=0x1;_0x3a66d5({'additional':_0x1d0306});}else{return db[_0xd9ed('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31d58d['id']},'order':[['OrderBy',_0xd9ed('0x20')]]})[_0xd9ed('0x1d')](function(_0x25d82e){var _0x338e7a=0x0;if(_0x25d82e){if(_0x25d82e[_0xd9ed('0x21')]+_0x25d82e[_0xd9ed('0x22')]+_0x25d82e[_0xd9ed('0x23')]+_0x25d82e[_0xd9ed('0x2a')]+_0x25d82e[_0xd9ed('0x24')]+_0x25d82e[_0xd9ed('0x25')]+_0x25d82e['countmachineretry']+_0x25d82e['countagentrejectretry']<_0x332401[_0xd9ed('0x28')][_0xd9ed('0x29')])_0x338e7a=0x1;_0x3a66d5({'additional':_0x338e7a});}else{_0x3a66d5({'additional':0x0});}})[_0xd9ed('0x15')](function(_0x4c5e2d){logger[_0xd9ed('0x11')](_0xd9ed('0x16'),_0x4c5e2d[_0xd9ed('0x14')]);_0x4cab47(_0x4ccb90[_0xd9ed('0x11')](0x1f4,_0x4c5e2d[_0xd9ed('0x14')]));});}})['catch'](function(_0x3f2534){logger['error'](_0xd9ed('0x16'),_0x3f2534[_0xd9ed('0x14')]);_0x4cab47(_0x4ccb90[_0xd9ed('0x11')](0x1f4,_0x3f2534[_0xd9ed('0x14')]));});}else _0x3a66d5({'additional':0x0});});});};exports[_0xd9ed('0x2b')]=function(_0x5474fb){var _0x3dea7b=this;return new Promise(function(_0x5bcfa6,_0x16ffa5){return db['CmHopper'][_0xd9ed('0x2c')]({'raw':!![],'where':{'ContactId':_0x5474fb['body'][_0xd9ed('0x18')],'ListId':_0x5474fb['body'][_0xd9ed('0x1a')],'VoiceQueueId':_0x5474fb['body'][_0xd9ed('0x1b')]===undefined?null:_0x5474fb[_0xd9ed('0x19')]['VoiceQueueId'],'CampaignId':_0x5474fb[_0xd9ed('0x19')][_0xd9ed('0x1c')]===undefined?null:_0x5474fb['body']['CampaignId']}})[_0xd9ed('0x1d')](function(_0x181cd4){if(_0x181cd4!=null){return db[_0xd9ed('0x1e')][_0xd9ed('0x2c')]({'raw':!![],'where':{'CmHopperId':_0x181cd4['id'],'OrderBy':{'$gte':_0x181cd4['OrderBy']}},'order':[[_0xd9ed('0x1f'),_0xd9ed('0x20')]]})[_0xd9ed('0x1d')](function(_0x58bd6b){if(_0x58bd6b)return activateAdditionalPhone(_0x181cd4,_0x5474fb['body'],_0x58bd6b,_0x5474fb[_0xd9ed('0x2d')],_0x5474fb['waitTime'])['then'](function(_0x66daa6){_0x5bcfa6(_0x66daa6);});else{return db[_0xd9ed('0x1e')][_0xd9ed('0x2c')]({'raw':!![],'where':{'CmHopperId':_0x181cd4['id']},'order':[[_0xd9ed('0x1f'),_0xd9ed('0x20')]]})[_0xd9ed('0x1d')](function(_0x3b140a){if(_0x3b140a)return activateAdditionalPhone(_0x181cd4,_0x5474fb['body'],_0x3b140a,_0x5474fb[_0xd9ed('0x2d')],_0x5474fb[_0xd9ed('0x2e')])[_0xd9ed('0x1d')](function(_0x4b7dd9){_0x5bcfa6(_0x4b7dd9);});else{_0x5bcfa6({'id':_0x181cd4['id'],'phone':''});}})['catch'](function(_0x48b7c9){logger[_0xd9ed('0x11')]('VerifyAdditionalPhones',_0x48b7c9[_0xd9ed('0x14')]);_0x16ffa5(_0x3dea7b[_0xd9ed('0x11')](0x1f4,_0x48b7c9[_0xd9ed('0x14')]));});}})[_0xd9ed('0x15')](function(_0x5a1c78){logger[_0xd9ed('0x11')](_0xd9ed('0x16'),_0x5a1c78[_0xd9ed('0x14')]);_0x16ffa5(_0x3dea7b[_0xd9ed('0x11')](0x1f4,_0x5a1c78['message']));});}else _0x5bcfa6(0x1);});});};function activateAdditionalPhone(_0x1a64f6,_0x2414fb,_0x30c213,_0x594344,_0x4bb17c){return new Promise(function(_0x1e22ff,_0x3dd27d){var _0x4d67e2;if(_[_0xd9ed('0x2f')](_0x30c213[_0xd9ed('0x30')])){_0x30c213['scheduledat']=moment();}if(moment()>moment(_0x30c213['scheduledat'])){_0x4d67e2=moment()['add'](_0x4bb17c||0x3,_0xd9ed('0x31'));}else{if(_0x30c213[_0xd9ed('0x1f')]==0x0){_0x4d67e2=moment(_0x30c213[_0xd9ed('0x30')]);}else{_0x4d67e2=moment()['add'](_0x4bb17c||0x3,_0xd9ed('0x31'));}}if(_[_0xd9ed('0x2f')](_0x4d67e2)){_0x4d67e2=moment()['add'](_0x4bb17c||0x3,_0xd9ed('0x31'));}var _0x38def1={'phone':_0x1a64f6[_0xd9ed('0x32')],'active':0x0,'OrderBy':_[_0xd9ed('0x2f')](_0x1a64f6[_0xd9ed('0x1f')])?0x0:_0x1a64f6['OrderBy'],'scheduledat':moment()['add'](_0x594344||0x1,'minutes'),'countbusyretry':_0x2414fb[_0xd9ed('0x21')],'countcongestionretry':_0x2414fb['countcongestionretry'],'countnoanswerretry':_0x2414fb[_0xd9ed('0x23')],'countnosuchnumberretry':_0x2414fb[_0xd9ed('0x2a')],'countdropretry':_0x2414fb['countdropretry'],'countabandonedretry':_0x2414fb['countabandonedretry'],'countmachineretry':_0x2414fb[_0xd9ed('0x26')],'countagentrejectretry':_0x2414fb[_0xd9ed('0x27')],'createdAt':_0x2414fb[_0xd9ed('0x33')],'updatedAt':_0x2414fb['updatedAt']};var _0x2a3076={'CmHopperId':_0x1a64f6['id'],'phone':_0x30c213['phone'],'active':0x0,'OrderBy':_['isNil'](_0x30c213[_0xd9ed('0x1f')])?0x0:_0x30c213[_0xd9ed('0x1f')],'scheduledat':_0x4d67e2,'countbusyretry':_0x30c213[_0xd9ed('0x21')],'countcongestionretry':_0x30c213[_0xd9ed('0x22')],'countnoanswerretry':_0x30c213[_0xd9ed('0x23')],'countnosuchnumberretry':_0x30c213[_0xd9ed('0x2a')],'countdropretry':_0x30c213[_0xd9ed('0x24')],'countabandonedretry':_0x30c213[_0xd9ed('0x25')],'countmachineretry':_0x30c213['countmachineretry'],'countagentrejectretry':_0x30c213['countagentrejectretry'],'createdAt':_0x30c213[_0xd9ed('0x33')],'updatedAt':_0x30c213[_0xd9ed('0x34')]};return db[_0xd9ed('0x35')]['transaction'](function(_0x2863d0){return db['CmHopperAdditionalPhone'][_0xd9ed('0x36')](_0x38def1,{'where':{'id':_0x30c213['id']}},{'transaction':_0x2863d0})[_0xd9ed('0x1d')](function(){return db[_0xd9ed('0x17')][_0xd9ed('0x36')](_0x2a3076,{'where':{'id':_0x1a64f6['id']}},{'transaction':_0x2863d0});});})[_0xd9ed('0x1d')](function(_0x3ebc59){_0x1e22ff({'id':_0x1a64f6['id'],'phone':_0x30c213[_0xd9ed('0x32')]});})[_0xd9ed('0x15')](function(_0xbb0c87){logger[_0xd9ed('0x11')](_0xd9ed('0x37'),_0xbb0c87[_0xd9ed('0x14')]);_0x3dd27d({'error':_0xbb0c87['message']});});});}exports[_0xd9ed('0x38')]=function(_0x1ad291){var _0x2e2b63=this;return new Promise(function(_0x45df13,_0x27c01d){return db[_0xd9ed('0x17')][_0xd9ed('0x36')](_0x1ad291[_0xd9ed('0x19')]['field'],{'where':{'id':_0x1ad291[_0xd9ed('0x19')]['id']}})['then'](function(_0x353eee){_0x45df13(_0x353eee);})[_0xd9ed('0x15')](function(_0x32f2e1){logger[_0xd9ed('0x11')](_0xd9ed('0x38'),_0x32f2e1[_0xd9ed('0x14')]);_0x27c01d(_0x2e2b63['error'](0x1f4,_0x32f2e1['message']));});});}; \ No newline at end of file +var _0xf85a=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countcongestionretry','entity','waitTime','duration','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf85a,0x197));var _0xaf85=function(_0x466718,_0x445cb5){_0x466718=_0x466718-0x0;var _0x38208d=_0xf85a[_0x466718];return _0x38208d;};'use strict';var _=require(_0xaf85('0x0'));var util=require(_0xaf85('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf85('0x2'));var logger=require(_0xaf85('0x3'))(_0xaf85('0x4'));var config=require(_0xaf85('0x5'));var jayson=require(_0xaf85('0x6'));var client=jayson[_0xaf85('0x7')][_0xaf85('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x142be6,_0x2e8a44,_0x3da29c){return new BPromise(function(_0x16f2e0,_0x1b416e){return client[_0xaf85('0x9')](_0x142be6,_0x3da29c)[_0xaf85('0xa')](function(_0x4fcf16){logger[_0xaf85('0xb')](_0xaf85('0xc'),_0x2e8a44,_0xaf85('0xd'));logger[_0xaf85('0xe')](_0xaf85('0xf'),_0x2e8a44,_0xaf85('0xd'),JSON[_0xaf85('0x10')](_0x4fcf16));if(_0x4fcf16['error']){if(_0x4fcf16[_0xaf85('0x11')]['code']===0x1f4){logger[_0xaf85('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2e8a44,_0x4fcf16['error'][_0xaf85('0x12')]);return _0x1b416e(_0x4fcf16[_0xaf85('0x11')]['message']);}logger[_0xaf85('0x11')](_0xaf85('0xc'),_0x2e8a44,_0x4fcf16[_0xaf85('0x11')][_0xaf85('0x12')]);return _0x16f2e0(_0x4fcf16[_0xaf85('0x11')][_0xaf85('0x12')]);}else{logger[_0xaf85('0xb')](_0xaf85('0xc'),_0x2e8a44,_0xaf85('0xd'));_0x16f2e0(_0x4fcf16[_0xaf85('0x13')][_0xaf85('0x12')]);}})[_0xaf85('0x14')](function(_0x2b9156){logger[_0xaf85('0x11')](_0xaf85('0xc'),_0x2e8a44,_0x2b9156);_0x1b416e(_0x2b9156);});});}exports[_0xaf85('0x15')]=function(_0x49f0ce){var _0x2e929c=this;return new Promise(function(_0x3026b5,_0x1e8c5b){return db[_0xaf85('0x16')][_0xaf85('0x17')]({'raw':!![],'where':{'ContactId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x19')],'ListId':_0x49f0ce['body'][_0xaf85('0x1a')],'VoiceQueueId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1b')]===undefined?null:_0x49f0ce['body'][_0xaf85('0x1b')],'CampaignId':_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1c')]===undefined?null:_0x49f0ce[_0xaf85('0x18')][_0xaf85('0x1c')]}})[_0xaf85('0xa')](function(_0x1c11df){if(_0x1c11df!=null){return db[_0xaf85('0x1d')][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1c11df['id'],'OrderBy':{'$gt':_0x1c11df[_0xaf85('0x1e')]}},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x853046){var _0x1046d2=0x0;if(_0x853046){if(_0x853046[_0xaf85('0x20')]+_0x853046['countcongestionretry']+_0x853046[_0xaf85('0x21')]+_0x853046[_0xaf85('0x22')]+_0x853046[_0xaf85('0x23')]+_0x853046[_0xaf85('0x24')]+_0x853046[_0xaf85('0x25')]+_0x853046[_0xaf85('0x26')]<_0x49f0ce['entity']['dialGlobalMaxRetry'])_0x1046d2=0x1;_0x3026b5({'additional':_0x1046d2});}else{return db[_0xaf85('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1c11df['id']},'order':[['OrderBy',_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x223568){var _0x210f97=0x0;if(_0x223568){if(_0x223568[_0xaf85('0x20')]+_0x223568[_0xaf85('0x27')]+_0x223568[_0xaf85('0x21')]+_0x223568['countnosuchnumberretry']+_0x223568[_0xaf85('0x23')]+_0x223568[_0xaf85('0x24')]+_0x223568[_0xaf85('0x25')]+_0x223568[_0xaf85('0x26')]<_0x49f0ce[_0xaf85('0x28')]['dialGlobalMaxRetry'])_0x210f97=0x1;_0x3026b5({'additional':_0x210f97});}else{_0x3026b5({'additional':0x0});}})['catch'](function(_0xe04900){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0xe04900[_0xaf85('0x12')]);_0x1e8c5b(_0x2e929c[_0xaf85('0x11')](0x1f4,_0xe04900[_0xaf85('0x12')]));});}})[_0xaf85('0x14')](function(_0x2927a6){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0x2927a6[_0xaf85('0x12')]);_0x1e8c5b(_0x2e929c[_0xaf85('0x11')](0x1f4,_0x2927a6[_0xaf85('0x12')]));});}else _0x3026b5({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x172993){var _0xd636c7=this;return new Promise(function(_0xa7f5,_0x33c57f){return db['CmHopper'][_0xaf85('0x17')]({'raw':!![],'where':{'ContactId':_0x172993['body'][_0xaf85('0x19')],'ListId':_0x172993['body'][_0xaf85('0x1a')],'VoiceQueueId':_0x172993['body'][_0xaf85('0x1b')]===undefined?null:_0x172993['body'][_0xaf85('0x1b')],'CampaignId':_0x172993[_0xaf85('0x18')][_0xaf85('0x1c')]===undefined?null:_0x172993[_0xaf85('0x18')][_0xaf85('0x1c')]}})[_0xaf85('0xa')](function(_0x366f90){if(_0x366f90!=null){return db['CmHopperAdditionalPhone'][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x366f90['id'],'OrderBy':{'$gte':_0x366f90['OrderBy']}},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x524cbf){if(_0x524cbf)return activateAdditionalPhone(_0x366f90,_0x172993[_0xaf85('0x18')],_0x524cbf,_0x172993['duration'],_0x172993[_0xaf85('0x29')])[_0xaf85('0xa')](function(_0x144976){_0xa7f5(_0x144976);});else{return db[_0xaf85('0x1d')][_0xaf85('0x17')]({'raw':!![],'where':{'CmHopperId':_0x366f90['id']},'order':[[_0xaf85('0x1e'),_0xaf85('0x1f')]]})[_0xaf85('0xa')](function(_0x565823){if(_0x565823)return activateAdditionalPhone(_0x366f90,_0x172993[_0xaf85('0x18')],_0x565823,_0x172993[_0xaf85('0x2a')],_0x172993[_0xaf85('0x29')])[_0xaf85('0xa')](function(_0xe9a6c7){_0xa7f5(_0xe9a6c7);});else{_0xa7f5({'id':_0x366f90['id'],'phone':''});}})['catch'](function(_0x224e94){logger['error'](_0xaf85('0x15'),_0x224e94[_0xaf85('0x12')]);_0x33c57f(_0xd636c7['error'](0x1f4,_0x224e94[_0xaf85('0x12')]));});}})['catch'](function(_0x1944a2){logger[_0xaf85('0x11')](_0xaf85('0x15'),_0x1944a2[_0xaf85('0x12')]);_0x33c57f(_0xd636c7[_0xaf85('0x11')](0x1f4,_0x1944a2[_0xaf85('0x12')]));});}else _0xa7f5(0x1);});});};function activateAdditionalPhone(_0x5550f5,_0x4259f3,_0x40cf13,_0x4c3691,_0x436ca5){return new Promise(function(_0x546f90,_0x51923b){var _0x406eef;if(_[_0xaf85('0x2b')](_0x40cf13[_0xaf85('0x2c')])){_0x40cf13[_0xaf85('0x2c')]=moment();}if(moment()>moment(_0x40cf13[_0xaf85('0x2c')])){_0x406eef=moment()['add'](_0x436ca5||0x3,_0xaf85('0x2d'));}else{if(_0x40cf13[_0xaf85('0x1e')]==0x0){_0x406eef=moment(_0x40cf13[_0xaf85('0x2c')]);}else{_0x406eef=moment()[_0xaf85('0x2e')](_0x436ca5||0x3,_0xaf85('0x2d'));}}if(_['isNil'](_0x406eef)){_0x406eef=moment()[_0xaf85('0x2e')](_0x436ca5||0x3,_0xaf85('0x2d'));}var _0xbf70b3={'phone':_0x5550f5[_0xaf85('0x2f')],'active':0x0,'OrderBy':_[_0xaf85('0x2b')](_0x5550f5[_0xaf85('0x1e')])?0x0:_0x5550f5[_0xaf85('0x1e')],'scheduledat':moment()[_0xaf85('0x2e')](_0x4c3691||0x1,'minutes'),'countbusyretry':_0x4259f3[_0xaf85('0x20')],'countcongestionretry':_0x4259f3[_0xaf85('0x27')],'countnoanswerretry':_0x4259f3[_0xaf85('0x21')],'countnosuchnumberretry':_0x4259f3[_0xaf85('0x22')],'countdropretry':_0x4259f3['countdropretry'],'countabandonedretry':_0x4259f3[_0xaf85('0x24')],'countmachineretry':_0x4259f3[_0xaf85('0x25')],'countagentrejectretry':_0x4259f3[_0xaf85('0x26')],'createdAt':_0x4259f3[_0xaf85('0x30')],'updatedAt':_0x4259f3[_0xaf85('0x31')]};var _0x3d7d02={'CmHopperId':_0x5550f5['id'],'phone':_0x40cf13[_0xaf85('0x2f')],'active':0x0,'OrderBy':_[_0xaf85('0x2b')](_0x40cf13[_0xaf85('0x1e')])?0x0:_0x40cf13['OrderBy'],'scheduledat':_0x406eef,'countbusyretry':_0x40cf13[_0xaf85('0x20')],'countcongestionretry':_0x40cf13[_0xaf85('0x27')],'countnoanswerretry':_0x40cf13[_0xaf85('0x21')],'countnosuchnumberretry':_0x40cf13['countnosuchnumberretry'],'countdropretry':_0x40cf13[_0xaf85('0x23')],'countabandonedretry':_0x40cf13['countabandonedretry'],'countmachineretry':_0x40cf13['countmachineretry'],'countagentrejectretry':_0x40cf13[_0xaf85('0x26')],'createdAt':_0x40cf13[_0xaf85('0x30')],'updatedAt':_0x40cf13[_0xaf85('0x31')]};return db['sequelize'][_0xaf85('0x32')](function(_0x13f825){return db[_0xaf85('0x1d')]['update'](_0xbf70b3,{'where':{'id':_0x40cf13['id']}},{'transaction':_0x13f825})[_0xaf85('0xa')](function(){return db[_0xaf85('0x16')][_0xaf85('0x33')](_0x3d7d02,{'where':{'id':_0x5550f5['id']}},{'transaction':_0x13f825});});})[_0xaf85('0xa')](function(_0x2409a7){_0x546f90({'id':_0x5550f5['id'],'phone':_0x40cf13[_0xaf85('0x2f')]});})[_0xaf85('0x14')](function(_0x4cbece){logger['error'](_0xaf85('0x34'),_0x4cbece[_0xaf85('0x12')]);_0x51923b({'error':_0x4cbece[_0xaf85('0x12')]});});});}exports[_0xaf85('0x35')]=function(_0x59dae2){var _0x2efbca=this;return new Promise(function(_0x526ad3,_0x311b0b){return db[_0xaf85('0x16')][_0xaf85('0x33')](_0x59dae2[_0xaf85('0x18')][_0xaf85('0x36')],{'where':{'id':_0x59dae2['body']['id']}})['then'](function(_0x39baba){_0x526ad3(_0x39baba);})[_0xaf85('0x14')](function(_0x22392c){logger[_0xaf85('0x11')](_0xaf85('0x35'),_0x22392c[_0xaf85('0x12')]);_0x311b0b(_0x2efbca[_0xaf85('0x11')](0x1f4,_0x22392c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index fa990b6..94bc350 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 _0x7072=['show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x1155f4,_0x107a57){var _0x5da85b=function(_0x333064){while(--_0x333064){_0x1155f4['push'](_0x1155f4['shift']());}};_0x5da85b(++_0x107a57);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0xc')]('/',auth[_0x2707('0x8')](),controller['create']);router['put'](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xd')]);router[_0x2707('0xe')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xf')]);module[_0x2707('0x10')]=router; \ No newline at end of file +var _0x0fe8=['index','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get'];(function(_0x378738,_0x343a3f){var _0x5579a2=function(_0x56a2cf){while(--_0x56a2cf){_0x378738['push'](_0x378738['shift']());}};_0x5579a2(++_0x343a3f);}(_0x0fe8,0x89));var _0x80fe=function(_0x53106a,_0x32e0d8){_0x53106a=_0x53106a-0x0;var _0x554fbb=_0x0fe8[_0x53106a];return _0x554fbb;};'use strict';var multer=require(_0x80fe('0x0'));var util=require(_0x80fe('0x1'));var path=require(_0x80fe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80fe('0x3')]();var fs_extra=require(_0x80fe('0x4'));var auth=require(_0x80fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x80fe('0x6')]('/',auth['isAuthenticated'](),controller[_0x80fe('0x7')]);router['get']('/:id',auth[_0x80fe('0x8')](),controller[_0x80fe('0x9')]);router['post']('/',auth[_0x80fe('0x8')](),controller[_0x80fe('0xa')]);router[_0x80fe('0xb')](_0x80fe('0xc'),auth[_0x80fe('0x8')](),controller[_0x80fe('0xd')]);router[_0x80fe('0xe')]('/:id',auth[_0x80fe('0x8')](),controller['destroy']);module[_0x80fe('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fa7a918..2de97d1 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 _0xd2a3=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x1afb22,_0x431472){var _0x3d188a=function(_0x2aeb9c){while(--_0x2aeb9c){_0x1afb22['push'](_0x1afb22['shift']());}};_0x3d188a(++_0x431472);}(_0xd2a3,0x17f));var _0x3d2a=function(_0x3aa701,_0x30a6ce){_0x3aa701=_0x3aa701-0x0;var _0x29670c=_0xd2a3[_0x3aa701];return _0x29670c;};'use strict';var moment=require(_0x3d2a('0x0'));var Sequelize=require(_0x3d2a('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3d2a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3d2a('0x3')],'unique':_0x3d2a('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3d2a('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3d2a('0x3')],'unique':_0x3d2a('0x4')}}; \ No newline at end of file +var _0xb30f=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x42b87a,_0x40d7b7){var _0xe395b8=function(_0x30080c){while(--_0x30080c){_0x42b87a['push'](_0x42b87a['shift']());}};_0xe395b8(++_0x40d7b7);}(_0xb30f,0x109));var _0xfb30=function(_0x560e76,_0x13c70e){_0x560e76=_0x560e76-0x0;var _0x38c457=_0xb30f[_0x560e76];return _0x38c457;};'use strict';var moment=require(_0xfb30('0x0'));var Sequelize=require(_0xfb30('0x1'));module[_0xfb30('0x2')]={'phone':{'type':Sequelize[_0xfb30('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfb30('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfb30('0x4')],'unique':_0xfb30('0x5')},'VoiceQueueId':{'type':Sequelize[_0xfb30('0x4')],'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 4f94f45..fac06e4 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 _0x207e=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x207e,0x1e7));var _0xe207=function(_0x1cf884,_0x5b3b76){_0x1cf884=_0x1cf884-0x0;var _0x5c7b4e=_0x207e[_0x1cf884];return _0x5c7b4e;};'use strict';var emlformat=require(_0xe207('0x0'));var rimraf=require(_0xe207('0x1'));var zipdir=require(_0xe207('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe207('0x3'));var moment=require(_0xe207('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe207('0x5'));var util=require('util');var path=require(_0xe207('0x6'));var sox=require('sox');var csv=require(_0xe207('0x7'));var ejs=require(_0xe207('0x8'));var fs=require('fs');var fs_extra=require(_0xe207('0x9'));var _=require(_0xe207('0xa'));var squel=require(_0xe207('0xb'));var crypto=require(_0xe207('0xc'));var jsforce=require(_0xe207('0xd'));var deskjs=require(_0xe207('0xe'));var toCsv=require(_0xe207('0x7'));var querystring=require(_0xe207('0xf'));var Papa=require(_0xe207('0x10'));var Redis=require('ioredis');var authService=require(_0xe207('0x11'));var qs=require(_0xe207('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe207('0x13'))('api');var utils=require(_0xe207('0x14'));var config=require(_0xe207('0x15'));var licenseUtil=require(_0xe207('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xffe37c,_0x2c06c6){_0x2c06c6=_0x2c06c6||0xcc;return function(_0x1d90fa){if(_0x1d90fa){return _0xffe37c[_0xe207('0x17')](_0x2c06c6);}return _0xffe37c['status'](_0x2c06c6)[_0xe207('0x18')]();};}function respondWithResult(_0x337386,_0x4ab6e3){_0x4ab6e3=_0x4ab6e3||0xc8;return function(_0x3b5f16){if(_0x3b5f16){return _0x337386[_0xe207('0x19')](_0x4ab6e3)[_0xe207('0x1a')](_0x3b5f16);}};}function respondWithFilteredResult(_0x301474,_0x11cf27){return function(_0x22dbdc){if(_0x22dbdc){var _0x51264c=typeof _0x11cf27[_0xe207('0x1b')]===_0xe207('0x1c')&&typeof _0x11cf27[_0xe207('0x1d')]===_0xe207('0x1c');var _0x5d458a=_0x22dbdc['count'];var _0x29bdf9=_0x51264c?0x0:_0x11cf27[_0xe207('0x1b')];var _0x45bc73=_0x51264c?_0x22dbdc[_0xe207('0x1e')]:_0x11cf27[_0xe207('0x1b')]+_0x11cf27[_0xe207('0x1d')];var _0x252feb;if(_0x45bc73>=_0x5d458a){_0x45bc73=_0x5d458a;_0x252feb=0xc8;}else{_0x252feb=0xce;}_0x301474[_0xe207('0x19')](_0x252feb);return _0x301474[_0xe207('0x1f')](_0xe207('0x20'),_0x29bdf9+'-'+_0x45bc73+'/'+_0x5d458a)[_0xe207('0x1a')](_0x22dbdc);}return null;};}function patchUpdates(_0x3fa833){return function(_0x37fc27){try{jsonpatch[_0xe207('0x21')](_0x37fc27,_0x3fa833,!![]);}catch(_0x410b7c){return BPromise[_0xe207('0x22')](_0x410b7c);}return _0x37fc27[_0xe207('0x23')]();};}function saveUpdates(_0x3d85db,_0x568f4d){return function(_0x262656){if(_0x262656){return _0x262656[_0xe207('0x24')](_0x3d85db)[_0xe207('0x25')](function(_0x36fb54){return _0x36fb54;});}return null;};}function removeEntity(_0x211fd9,_0xe814a){return function(_0x3f086f){if(_0x3f086f){return _0x3f086f[_0xe207('0x26')]()[_0xe207('0x25')](function(){_0x211fd9[_0xe207('0x19')](0xcc)[_0xe207('0x18')]();});}};}function handleEntityNotFound(_0x7f8bdc,_0x2d5023){return function(_0x498dc5){if(!_0x498dc5){_0x7f8bdc[_0xe207('0x17')](0x194);}return _0x498dc5;};}function handleError(_0x38f70e,_0x290006){_0x290006=_0x290006||0x1f4;return function(_0x5e18f2){logger[_0xe207('0x27')](_0x5e18f2[_0xe207('0x28')]);if(_0x5e18f2['name']){delete _0x5e18f2[_0xe207('0x29')];}_0x38f70e[_0xe207('0x19')](_0x290006)[_0xe207('0x2a')](_0x5e18f2);};}exports[_0xe207('0x2b')]=function(_0x1b50e6,_0x69855){var _0x4cebc3={},_0x3bc0cd={},_0x4caa8d={'count':0x0,'rows':[]};var _0x49d108=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0x33876b){return{'name':_0x33876b['fieldName'],'type':_0x33876b[_0xe207('0x2c')][_0xe207('0x2d')]};});_0x3bc0cd[_0xe207('0x2e')]=_['map'](_0x49d108,_0xe207('0x29'));_0x3bc0cd['query']=_['keys'](_0x1b50e6['query']);_0x3bc0cd[_0xe207('0x2f')]=_[_0xe207('0x30')](_0x3bc0cd[_0xe207('0x2e')],_0x3bc0cd[_0xe207('0x31')]);_0x4cebc3[_0xe207('0x32')]=_[_0xe207('0x30')](_0x3bc0cd[_0xe207('0x2e')],qs[_0xe207('0x33')](_0x1b50e6[_0xe207('0x31')][_0xe207('0x33')]));_0x4cebc3[_0xe207('0x32')]=_0x4cebc3[_0xe207('0x32')][_0xe207('0x34')]?_0x4cebc3[_0xe207('0x32')]:_0x3bc0cd[_0xe207('0x2e')];if(!_0x1b50e6[_0xe207('0x31')][_0xe207('0x35')](_0xe207('0x36'))){_0x4cebc3[_0xe207('0x1d')]=qs[_0xe207('0x1d')](_0x1b50e6[_0xe207('0x31')][_0xe207('0x1d')]);_0x4cebc3[_0xe207('0x1b')]=qs[_0xe207('0x1b')](_0x1b50e6[_0xe207('0x31')][_0xe207('0x1b')]);}_0x4cebc3[_0xe207('0x37')]=qs[_0xe207('0x38')](_0x1b50e6[_0xe207('0x31')][_0xe207('0x38')]);_0x4cebc3[_0xe207('0x39')]=qs['filters'](_[_0xe207('0x3a')](_0x1b50e6[_0xe207('0x31')],_0x3bc0cd[_0xe207('0x2f')]),_0x49d108);if(_0x1b50e6[_0xe207('0x31')]['filter']){_0x4cebc3[_0xe207('0x39')]=_[_0xe207('0x3b')](_0x4cebc3[_0xe207('0x39')],{'$or':_[_0xe207('0x3c')](_0x49d108,function(_0x10538c){if(_0x10538c[_0xe207('0x2c')]!=='VIRTUAL'){var _0x3c6cd2={};_0x3c6cd2[_0x10538c['name']]={'$like':'%'+_0x1b50e6[_0xe207('0x31')][_0xe207('0x3d')]+'%'};return _0x3c6cd2;}})});}_0x4cebc3=_[_0xe207('0x3b')]({},_0x4cebc3,_0x1b50e6['options']);var _0x8a8919={'where':_0x4cebc3['where']};return db[_0xe207('0x3e')]['count'](_0x8a8919)[_0xe207('0x25')](function(_0x3d6c0f){_0x4caa8d[_0xe207('0x1e')]=_0x3d6c0f;if(_0x1b50e6[_0xe207('0x31')][_0xe207('0x3f')]){_0x4cebc3[_0xe207('0x40')]=[{'all':!![]}];}return db[_0xe207('0x3e')][_0xe207('0x41')](_0x4cebc3);})[_0xe207('0x25')](function(_0x25ffc3){_0x4caa8d[_0xe207('0x42')]=_0x25ffc3;return _0x4caa8d;})['then'](respondWithFilteredResult(_0x69855,_0x4cebc3))[_0xe207('0x43')](handleError(_0x69855,null));};exports[_0xe207('0x44')]=function(_0x1dae46,_0x38f9a1){var _0x433de5={'raw':!![],'where':{'id':_0x1dae46[_0xe207('0x45')]['id']}},_0x594da4={};_0x594da4[_0xe207('0x2e')]=_[_0xe207('0x46')](db[_0xe207('0x3e')]['rawAttributes']);_0x594da4[_0xe207('0x31')]=_[_0xe207('0x46')](_0x1dae46[_0xe207('0x31')]);_0x594da4[_0xe207('0x2f')]=_['intersection'](_0x594da4[_0xe207('0x2e')],_0x594da4[_0xe207('0x31')]);_0x433de5[_0xe207('0x32')]=_['intersection'](_0x594da4[_0xe207('0x2e')],qs['fields'](_0x1dae46[_0xe207('0x31')][_0xe207('0x33')]));_0x433de5[_0xe207('0x32')]=_0x433de5[_0xe207('0x32')][_0xe207('0x34')]?_0x433de5[_0xe207('0x32')]:_0x594da4['model'];if(_0x1dae46[_0xe207('0x31')][_0xe207('0x3f')]){_0x433de5[_0xe207('0x40')]=[{'all':!![]}];}_0x433de5=_[_0xe207('0x3b')]({},_0x433de5,_0x1dae46['options']);return db[_0xe207('0x3e')][_0xe207('0x47')](_0x433de5)[_0xe207('0x25')](handleEntityNotFound(_0x38f9a1,null))[_0xe207('0x25')](respondWithResult(_0x38f9a1,null))[_0xe207('0x43')](handleError(_0x38f9a1,null));};exports[_0xe207('0x24')]=function(_0x3486fb,_0x360f6d){if(_0x3486fb[_0xe207('0x48')]['id']){delete _0x3486fb[_0xe207('0x48')]['id'];}return db['CmHopperBlack'][_0xe207('0x47')]({'where':{'id':_0x3486fb[_0xe207('0x45')]['id']}})[_0xe207('0x25')](handleEntityNotFound(_0x360f6d,null))[_0xe207('0x25')](saveUpdates(_0x3486fb['body'],null))['then'](respondWithResult(_0x360f6d,null))[_0xe207('0x43')](handleError(_0x360f6d,null));};exports[_0xe207('0x26')]=function(_0x20a58f,_0x44d44d){return db['CmHopperBlack'][_0xe207('0x47')]({'where':{'id':_0x20a58f[_0xe207('0x45')]['id']}})['then'](handleEntityNotFound(_0x44d44d,null))[_0xe207('0x25')](removeEntity(_0x44d44d,null))[_0xe207('0x43')](handleError(_0x44d44d,null));};exports[_0xe207('0x49')]=function(_0x2ae55f,_0x32a5d3){return db[_0xe207('0x3e')][_0xe207('0x49')]()[_0xe207('0x25')](respondWithResult(_0x32a5d3,null))['catch'](handleError(_0x32a5d3,null));}; \ No newline at end of file +var _0xf019=['limit','count','set','Content-Range','apply','save','update','destroy','error','stack','send','index','map','CmHopperBlack','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','name','filter','merge','options','then','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf019,0x7b));var _0x9f01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf019[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9f01('0x0'));var rimraf=require(_0x9f01('0x1'));var zipdir=require(_0x9f01('0x2'));var jsonpatch=require(_0x9f01('0x3'));var rp=require('request-promise');var moment=require(_0x9f01('0x4'));var BPromise=require(_0x9f01('0x5'));var Mustache=require(_0x9f01('0x6'));var util=require(_0x9f01('0x7'));var path=require(_0x9f01('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f01('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f01('0xa'));var squel=require(_0x9f01('0xb'));var crypto=require(_0x9f01('0xc'));var jsforce=require(_0x9f01('0xd'));var deskjs=require(_0x9f01('0xe'));var toCsv=require(_0x9f01('0xf'));var querystring=require('querystring');var Papa=require(_0x9f01('0x10'));var Redis=require(_0x9f01('0x11'));var authService=require(_0x9f01('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9f01('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f01('0x14'))(_0x9f01('0x15'));var utils=require(_0x9f01('0x16'));var config=require(_0x9f01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f01('0x18'))['db'];function respondWithStatusCode(_0x5ab156,_0x59604d){_0x59604d=_0x59604d||0xcc;return function(_0x137f90){if(_0x137f90){return _0x5ab156[_0x9f01('0x19')](_0x59604d);}return _0x5ab156[_0x9f01('0x1a')](_0x59604d)[_0x9f01('0x1b')]();};}function respondWithResult(_0xbf8876,_0x3ef688){_0x3ef688=_0x3ef688||0xc8;return function(_0x315cdb){if(_0x315cdb){return _0xbf8876['status'](_0x3ef688)[_0x9f01('0x1c')](_0x315cdb);}};}function respondWithFilteredResult(_0x4988c8,_0x1e3717){return function(_0x40eb72){if(_0x40eb72){var _0x4eaa70=typeof _0x1e3717[_0x9f01('0x1d')]===_0x9f01('0x1e')&&typeof _0x1e3717[_0x9f01('0x1f')]===_0x9f01('0x1e');var _0xab6dbd=_0x40eb72[_0x9f01('0x20')];var _0x2fdcbf=_0x4eaa70?0x0:_0x1e3717[_0x9f01('0x1d')];var _0x31cfaf=_0x4eaa70?_0x40eb72[_0x9f01('0x20')]:_0x1e3717[_0x9f01('0x1d')]+_0x1e3717['limit'];var _0x284f13;if(_0x31cfaf>=_0xab6dbd){_0x31cfaf=_0xab6dbd;_0x284f13=0xc8;}else{_0x284f13=0xce;}_0x4988c8[_0x9f01('0x1a')](_0x284f13);return _0x4988c8[_0x9f01('0x21')](_0x9f01('0x22'),_0x2fdcbf+'-'+_0x31cfaf+'/'+_0xab6dbd)['json'](_0x40eb72);}return null;};}function patchUpdates(_0x132923){return function(_0x550a6c){try{jsonpatch[_0x9f01('0x23')](_0x550a6c,_0x132923,!![]);}catch(_0x176fc9){return BPromise['reject'](_0x176fc9);}return _0x550a6c[_0x9f01('0x24')]();};}function saveUpdates(_0x3b53dd,_0x565503){return function(_0x2620bc){if(_0x2620bc){return _0x2620bc[_0x9f01('0x25')](_0x3b53dd)['then'](function(_0x27d8b5){return _0x27d8b5;});}return null;};}function removeEntity(_0xd1f7bc,_0x8a9e3e){return function(_0x1fa2af){if(_0x1fa2af){return _0x1fa2af[_0x9f01('0x26')]()['then'](function(){_0xd1f7bc['status'](0xcc)[_0x9f01('0x1b')]();});}};}function handleEntityNotFound(_0x476bbb,_0xe0aca0){return function(_0x1a5e16){if(!_0x1a5e16){_0x476bbb[_0x9f01('0x19')](0x194);}return _0x1a5e16;};}function handleError(_0x336d78,_0x21519e){_0x21519e=_0x21519e||0x1f4;return function(_0x7600e0){logger[_0x9f01('0x27')](_0x7600e0[_0x9f01('0x28')]);if(_0x7600e0['name']){delete _0x7600e0['name'];}_0x336d78['status'](_0x21519e)[_0x9f01('0x29')](_0x7600e0);};}exports[_0x9f01('0x2a')]=function(_0xa44f35,_0x12da06){var _0x24a047={},_0x405eed={},_0x19acfc={'count':0x0,'rows':[]};var _0x4d9c85=_[_0x9f01('0x2b')](db[_0x9f01('0x2c')]['rawAttributes'],function(_0x76dae9){return{'name':_0x76dae9['fieldName'],'type':_0x76dae9[_0x9f01('0x2d')][_0x9f01('0x2e')]};});_0x405eed[_0x9f01('0x2f')]=_['map'](_0x4d9c85,'name');_0x405eed[_0x9f01('0x30')]=_['keys'](_0xa44f35[_0x9f01('0x30')]);_0x405eed[_0x9f01('0x31')]=_[_0x9f01('0x32')](_0x405eed['model'],_0x405eed[_0x9f01('0x30')]);_0x24a047[_0x9f01('0x33')]=_[_0x9f01('0x32')](_0x405eed[_0x9f01('0x2f')],qs['fields'](_0xa44f35['query'][_0x9f01('0x34')]));_0x24a047[_0x9f01('0x33')]=_0x24a047[_0x9f01('0x33')][_0x9f01('0x35')]?_0x24a047[_0x9f01('0x33')]:_0x405eed[_0x9f01('0x2f')];if(!_0xa44f35[_0x9f01('0x30')][_0x9f01('0x36')](_0x9f01('0x37'))){_0x24a047[_0x9f01('0x1f')]=qs[_0x9f01('0x1f')](_0xa44f35[_0x9f01('0x30')][_0x9f01('0x1f')]);_0x24a047['offset']=qs[_0x9f01('0x1d')](_0xa44f35[_0x9f01('0x30')]['offset']);}_0x24a047[_0x9f01('0x38')]=qs['sort'](_0xa44f35[_0x9f01('0x30')][_0x9f01('0x39')]);_0x24a047['where']=qs[_0x9f01('0x31')](_[_0x9f01('0x3a')](_0xa44f35[_0x9f01('0x30')],_0x405eed[_0x9f01('0x31')]),_0x4d9c85);if(_0xa44f35[_0x9f01('0x30')]['filter']){_0x24a047[_0x9f01('0x3b')]=_['merge'](_0x24a047[_0x9f01('0x3b')],{'$or':_[_0x9f01('0x2b')](_0x4d9c85,function(_0xea3d41){if(_0xea3d41[_0x9f01('0x2d')]!==_0x9f01('0x3c')){var _0x11da83={};_0x11da83[_0xea3d41[_0x9f01('0x3d')]]={'$like':'%'+_0xa44f35[_0x9f01('0x30')][_0x9f01('0x3e')]+'%'};return _0x11da83;}})});}_0x24a047=_[_0x9f01('0x3f')]({},_0x24a047,_0xa44f35[_0x9f01('0x40')]);var _0x29a383={'where':_0x24a047[_0x9f01('0x3b')]};return db[_0x9f01('0x2c')][_0x9f01('0x20')](_0x29a383)[_0x9f01('0x41')](function(_0x36e41c){_0x19acfc[_0x9f01('0x20')]=_0x36e41c;if(_0xa44f35[_0x9f01('0x30')][_0x9f01('0x42')]){_0x24a047[_0x9f01('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9f01('0x44')](_0x24a047);})[_0x9f01('0x41')](function(_0x2566c5){_0x19acfc[_0x9f01('0x45')]=_0x2566c5;return _0x19acfc;})[_0x9f01('0x41')](respondWithFilteredResult(_0x12da06,_0x24a047))['catch'](handleError(_0x12da06,null));};exports['show']=function(_0x502ca2,_0x4ec2db){var _0x50c494={'raw':!![],'where':{'id':_0x502ca2[_0x9f01('0x46')]['id']}},_0x5e87f2={};_0x5e87f2[_0x9f01('0x2f')]=_[_0x9f01('0x47')](db[_0x9f01('0x2c')][_0x9f01('0x48')]);_0x5e87f2[_0x9f01('0x30')]=_[_0x9f01('0x47')](_0x502ca2[_0x9f01('0x30')]);_0x5e87f2[_0x9f01('0x31')]=_['intersection'](_0x5e87f2['model'],_0x5e87f2['query']);_0x50c494['attributes']=_[_0x9f01('0x32')](_0x5e87f2[_0x9f01('0x2f')],qs[_0x9f01('0x34')](_0x502ca2[_0x9f01('0x30')][_0x9f01('0x34')]));_0x50c494[_0x9f01('0x33')]=_0x50c494[_0x9f01('0x33')]['length']?_0x50c494[_0x9f01('0x33')]:_0x5e87f2[_0x9f01('0x2f')];if(_0x502ca2[_0x9f01('0x30')]['includeAll']){_0x50c494['include']=[{'all':!![]}];}_0x50c494=_[_0x9f01('0x3f')]({},_0x50c494,_0x502ca2['options']);return db[_0x9f01('0x2c')][_0x9f01('0x49')](_0x50c494)['then'](handleEntityNotFound(_0x4ec2db,null))[_0x9f01('0x41')](respondWithResult(_0x4ec2db,null))[_0x9f01('0x4a')](handleError(_0x4ec2db,null));};exports[_0x9f01('0x25')]=function(_0x5569ac,_0x4ac3dc){if(_0x5569ac[_0x9f01('0x4b')]['id']){delete _0x5569ac[_0x9f01('0x4b')]['id'];}return db[_0x9f01('0x2c')]['find']({'where':{'id':_0x5569ac[_0x9f01('0x46')]['id']}})[_0x9f01('0x41')](handleEntityNotFound(_0x4ac3dc,null))['then'](saveUpdates(_0x5569ac[_0x9f01('0x4b')],null))[_0x9f01('0x41')](respondWithResult(_0x4ac3dc,null))[_0x9f01('0x4a')](handleError(_0x4ac3dc,null));};exports['destroy']=function(_0x1d0fba,_0x424192){return db[_0x9f01('0x2c')][_0x9f01('0x49')]({'where':{'id':_0x1d0fba[_0x9f01('0x46')]['id']}})[_0x9f01('0x41')](handleEntityNotFound(_0x424192,null))[_0x9f01('0x41')](removeEntity(_0x424192,null))[_0x9f01('0x4a')](handleError(_0x424192,null));};exports[_0x9f01('0x4c')]=function(_0x4c92da,_0x1c43dc){return db['CmHopperBlack'][_0x9f01('0x4c')]()['then'](respondWithResult(_0x1c43dc,null))[_0x9f01('0x4a')](handleError(_0x1c43dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6e1a10f..6d3d5f7 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 _0xba5f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util'];(function(_0x536d69,_0x43a3dd){var _0x564fd5=function(_0x4a4b54){while(--_0x4a4b54){_0x536d69['push'](_0x536d69['shift']());}};_0x564fd5(++_0x43a3dd);}(_0xba5f,0x172));var _0xfba5=function(_0x1bd5b7,_0x3080d1){_0x1bd5b7=_0x1bd5b7-0x0;var _0x3a7385=_0xba5f[_0x1bd5b7];return _0x3a7385;};'use strict';var _=require(_0xfba5('0x0'));var util=require(_0xfba5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfba5('0x2'));var BPromise=require(_0xfba5('0x3'));var rp=require(_0xfba5('0x4'));var fs=require('fs');var path=require(_0xfba5('0x5'));var rimraf=require(_0xfba5('0x6'));var config=require(_0xfba5('0x7'));var attributes=require(_0xfba5('0x8'));module[_0xfba5('0x9')]=function(_0x1fec63,_0x4fe233){return _0x1fec63[_0xfba5('0xa')]('CmHopperBlack',attributes,{'tableName':_0xfba5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ba=['path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fbf3d,_0x3a80f4){var _0x2ff7a8=function(_0x285f94){while(--_0x285f94){_0x3fbf3d['push'](_0x3fbf3d['shift']());}};_0x2ff7a8(++_0x3a80f4);}(_0x10ba,0x1c0));var _0xa10b=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x10ba[_0x872b02];return _0x1a6b24;};'use strict';var _=require(_0xa10b('0x0'));var util=require(_0xa10b('0x1'));var logger=require(_0xa10b('0x2'))(_0xa10b('0x3'));var moment=require(_0xa10b('0x4'));var BPromise=require(_0xa10b('0x5'));var rp=require(_0xa10b('0x6'));var fs=require('fs');var path=require(_0xa10b('0x7'));var rimraf=require(_0xa10b('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xa10b('0x9')]=function(_0xc13910,_0x3fc7f7){return _0xc13910[_0xa10b('0xa')](_0xa10b('0xb'),attributes,{'tableName':_0xa10b('0xc'),'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 48e2501..5678a3b 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 _0x56c8=['catch','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x551937,_0x3d2f4a){var _0x551aaa=function(_0x49c3d2){while(--_0x49c3d2){_0x551937['push'](_0x551937['shift']());}};_0x551aaa(++_0x3d2f4a);}(_0x56c8,0xd8));var _0x856c=function(_0x33e7de,_0x5c8dde){_0x33e7de=_0x33e7de-0x0;var _0x3e6bd9=_0x56c8[_0x33e7de];return _0x3e6bd9;};'use strict';var _=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var moment=require(_0x856c('0x2'));var BPromise=require(_0x856c('0x3'));var rs=require(_0x856c('0x4'));var fs=require('fs');var Redis=require(_0x856c('0x5'));var db=require(_0x856c('0x6'))['db'];var utils=require(_0x856c('0x7'));var logger=require('../../config/logger')(_0x856c('0x8'));var config=require(_0x856c('0x9'));var jayson=require(_0x856c('0xa'));var client=jayson[_0x856c('0xb')][_0x856c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3406a9,_0xea3097,_0x8215e3){return new BPromise(function(_0xc3e839,_0x1bed24){return client[_0x856c('0xd')](_0x3406a9,_0x8215e3)[_0x856c('0xe')](function(_0x544b7d){logger[_0x856c('0xf')](_0x856c('0x10'),_0xea3097,_0x856c('0x11'));logger[_0x856c('0x12')](_0x856c('0x13'),_0xea3097,_0x856c('0x11'),JSON[_0x856c('0x14')](_0x544b7d));if(_0x544b7d[_0x856c('0x15')]){if(_0x544b7d[_0x856c('0x15')][_0x856c('0x16')]===0x1f4){logger[_0x856c('0x15')](_0x856c('0x10'),_0xea3097,_0x544b7d[_0x856c('0x15')][_0x856c('0x17')]);return _0x1bed24(_0x544b7d[_0x856c('0x15')][_0x856c('0x17')]);}logger[_0x856c('0x15')](_0x856c('0x10'),_0xea3097,_0x544b7d['error'][_0x856c('0x17')]);return _0xc3e839(_0x544b7d[_0x856c('0x15')]['message']);}else{logger[_0x856c('0xf')](_0x856c('0x10'),_0xea3097,_0x856c('0x11'));_0xc3e839(_0x544b7d['result'][_0x856c('0x17')]);}})[_0x856c('0x18')](function(_0x3b417a){logger[_0x856c('0x15')](_0x856c('0x10'),_0xea3097,_0x3b417a);_0x1bed24(_0x3b417a);});});}exports[_0x856c('0x19')]=function(_0x206eb2){var _0x47071f=this;return new Promise(function(_0x2c53af,_0x2514d8){return db['CmHopperBlack'][_0x856c('0x1a')]({'raw':_0x206eb2[_0x856c('0x1b')]?_0x206eb2[_0x856c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x206eb2[_0x856c('0x1b')]?_0x206eb2[_0x856c('0x1b')][_0x856c('0x1c')]||null:null,'attributes':_0x206eb2['options']?_0x206eb2['options'][_0x856c('0x1d')]||null:null,'limit':_0x206eb2[_0x856c('0x1b')]?_0x206eb2['options'][_0x856c('0x1e')]||null:null,'include':_0x206eb2[_0x856c('0x1b')]?_0x206eb2[_0x856c('0x1b')][_0x856c('0x1f')]?_[_0x856c('0x20')](_0x206eb2[_0x856c('0x1b')]['include'],function(_0x3bd625){return{'model':db[_0x3bd625['model']],'as':_0x3bd625['as'],'attributes':_0x3bd625['attributes'],'include':_0x3bd625[_0x856c('0x1f')]?_[_0x856c('0x20')](_0x3bd625[_0x856c('0x1f')],function(_0x1ed810){return{'model':db[_0x1ed810[_0x856c('0x21')]],'as':_0x1ed810['as'],'attributes':_0x1ed810[_0x856c('0x1d')],'include':_0x1ed810[_0x856c('0x1f')]?_[_0x856c('0x20')](_0x1ed810[_0x856c('0x1f')],function(_0x4c937e){return{'model':db[_0x4c937e[_0x856c('0x21')]],'as':_0x4c937e['as'],'attributes':_0x4c937e[_0x856c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x856c('0xe')](function(_0x137764){logger[_0x856c('0xf')](_0x856c('0x19'),_0x206eb2);logger[_0x856c('0x12')]('GetCmHopperBlack',_0x206eb2,JSON[_0x856c('0x14')](_0x137764));_0x2c53af(_0x137764);})['catch'](function(_0x4cc6dd){logger[_0x856c('0x15')]('GetCmHopperBlack',_0x4cc6dd[_0x856c('0x17')],_0x206eb2);_0x2514d8(_0x47071f[_0x856c('0x15')](0x1f4,_0x4cc6dd[_0x856c('0x17')]));});});};exports[_0x856c('0x22')]=function(_0x81d76a){var _0x58bfc8=this;return new Promise(function(_0x4450b1,_0x5d8db9){return db[_0x856c('0x23')][_0x856c('0x24')](_0x81d76a[_0x856c('0x25')],{'raw':_0x81d76a[_0x856c('0x1b')]?_0x81d76a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81d76a[_0x856c('0x1b')]?_0x81d76a[_0x856c('0x1b')]['where']||null:null,'attributes':_0x81d76a[_0x856c('0x1b')]?_0x81d76a['options'][_0x856c('0x1d')]||null:null,'limit':_0x81d76a[_0x856c('0x1b')]?_0x81d76a[_0x856c('0x1b')][_0x856c('0x1e')]||null:null})[_0x856c('0xe')](function(_0x446eab){logger[_0x856c('0xf')](_0x856c('0x22'),_0x81d76a);logger['debug'](_0x856c('0x22'),_0x81d76a,JSON[_0x856c('0x14')](_0x446eab));_0x4450b1(_0x446eab);})[_0x856c('0x18')](function(_0x4839d5){logger['error'](_0x856c('0x22'),_0x4839d5['message'],_0x81d76a);_0x5d8db9(_0x58bfc8[_0x856c('0x15')](0x1f4,_0x4839d5[_0x856c('0x17')]));});});};exports[_0x856c('0x26')]=function(_0x44efbd){var _0x38ad7d=this;return new Promise(function(_0x515d84,_0x368731){return db['CmHopperBlack'][_0x856c('0x27')]({'where':_0x44efbd['options']?_0x44efbd['options']['where']||null:null})['then'](function(_0x2d377b){logger['info']('DestroyCmHopperBlack',_0x44efbd);logger['debug'](_0x856c('0x26'),_0x44efbd,JSON[_0x856c('0x14')](_0x2d377b));_0x515d84(_0x2d377b);})[_0x856c('0x18')](function(_0x1aa14d){logger[_0x856c('0x15')](_0x856c('0x26'),_0x1aa14d['message'],_0x44efbd);_0x368731(_0x38ad7d['error'](0x1f4,_0x1aa14d['message']));});});}; \ No newline at end of file +var _0x0674=['debug','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopperBlack','options','raw','where','include','map','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','body','limit'];(function(_0x3c4d17,_0xc90a69){var _0x1eba1b=function(_0x58ec8c){while(--_0x58ec8c){_0x3c4d17['push'](_0x3c4d17['shift']());}};_0x1eba1b(++_0xc90a69);}(_0x0674,0x1a7));var _0x4067=function(_0x9d9b50,_0x2ad89f){_0x9d9b50=_0x9d9b50-0x0;var _0x57191f=_0x0674[_0x9d9b50];return _0x57191f;};'use strict';var _=require(_0x4067('0x0'));var util=require(_0x4067('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4067('0x2'));var fs=require('fs');var Redis=require(_0x4067('0x3'));var db=require(_0x4067('0x4'))['db'];var utils=require(_0x4067('0x5'));var logger=require(_0x4067('0x6'))('rpc');var config=require(_0x4067('0x7'));var jayson=require(_0x4067('0x8'));var client=jayson[_0x4067('0x9')][_0x4067('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569050,_0x55b318,_0x4541af){return new BPromise(function(_0x45cead,_0xd1f22a){return client[_0x4067('0xb')](_0x569050,_0x4541af)[_0x4067('0xc')](function(_0x24012f){logger[_0x4067('0xd')](_0x4067('0xe'),_0x55b318,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x55b318,'request\x20sent',JSON[_0x4067('0xf')](_0x24012f));if(_0x24012f[_0x4067('0x10')]){if(_0x24012f['error'][_0x4067('0x11')]===0x1f4){logger[_0x4067('0x10')](_0x4067('0xe'),_0x55b318,_0x24012f[_0x4067('0x10')][_0x4067('0x12')]);return _0xd1f22a(_0x24012f[_0x4067('0x10')]['message']);}logger[_0x4067('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x55b318,_0x24012f[_0x4067('0x10')]['message']);return _0x45cead(_0x24012f['error'][_0x4067('0x12')]);}else{logger[_0x4067('0xd')](_0x4067('0xe'),_0x55b318,'request\x20sent');_0x45cead(_0x24012f['result'][_0x4067('0x12')]);}})[_0x4067('0x13')](function(_0x37a7cb){logger[_0x4067('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x55b318,_0x37a7cb);_0xd1f22a(_0x37a7cb);});});}exports['GetCmHopperBlack']=function(_0x5ab9e0){var _0x3d032e=this;return new Promise(function(_0x19c7dd,_0x3498cb){return db[_0x4067('0x14')]['findAll']({'raw':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x16')]===undefined?!![]:![]:!![],'where':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x17')]||null:null,'attributes':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0['options']['attributes']||null:null,'limit':_0x5ab9e0[_0x4067('0x15')]?_0x5ab9e0[_0x4067('0x15')]['limit']||null:null,'include':_0x5ab9e0['options']?_0x5ab9e0[_0x4067('0x15')][_0x4067('0x18')]?_[_0x4067('0x19')](_0x5ab9e0['options'][_0x4067('0x18')],function(_0x6fba18){return{'model':db[_0x6fba18[_0x4067('0x1a')]],'as':_0x6fba18['as'],'attributes':_0x6fba18[_0x4067('0x1b')],'include':_0x6fba18[_0x4067('0x18')]?_[_0x4067('0x19')](_0x6fba18[_0x4067('0x18')],function(_0x49ab9c){return{'model':db[_0x49ab9c[_0x4067('0x1a')]],'as':_0x49ab9c['as'],'attributes':_0x49ab9c['attributes'],'include':_0x49ab9c[_0x4067('0x18')]?_['map'](_0x49ab9c[_0x4067('0x18')],function(_0x13c6c1){return{'model':db[_0x13c6c1['model']],'as':_0x13c6c1['as'],'attributes':_0x13c6c1[_0x4067('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4067('0xc')](function(_0x275d87){logger[_0x4067('0xd')](_0x4067('0x1c'),_0x5ab9e0);logger['debug']('GetCmHopperBlack',_0x5ab9e0,JSON['stringify'](_0x275d87));_0x19c7dd(_0x275d87);})[_0x4067('0x13')](function(_0x28b19a){logger[_0x4067('0x10')]('GetCmHopperBlack',_0x28b19a[_0x4067('0x12')],_0x5ab9e0);_0x3498cb(_0x3d032e[_0x4067('0x10')](0x1f4,_0x28b19a[_0x4067('0x12')]));});});};exports[_0x4067('0x1d')]=function(_0x2624bb){var _0x5a34ba=this;return new Promise(function(_0x3eccce,_0x5ba4e0){return db[_0x4067('0x14')]['update'](_0x2624bb[_0x4067('0x1e')],{'raw':_0x2624bb[_0x4067('0x15')]?_0x2624bb['options'][_0x4067('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2624bb[_0x4067('0x15')]?_0x2624bb[_0x4067('0x15')][_0x4067('0x17')]||null:null,'attributes':_0x2624bb[_0x4067('0x15')]?_0x2624bb[_0x4067('0x15')][_0x4067('0x1b')]||null:null,'limit':_0x2624bb[_0x4067('0x15')]?_0x2624bb['options'][_0x4067('0x1f')]||null:null})[_0x4067('0xc')](function(_0x1455fb){logger[_0x4067('0xd')](_0x4067('0x1d'),_0x2624bb);logger[_0x4067('0x20')](_0x4067('0x1d'),_0x2624bb,JSON[_0x4067('0xf')](_0x1455fb));_0x3eccce(_0x1455fb);})[_0x4067('0x13')](function(_0xba66f0){logger[_0x4067('0x10')](_0x4067('0x1d'),_0xba66f0['message'],_0x2624bb);_0x5ba4e0(_0x5a34ba['error'](0x1f4,_0xba66f0['message']));});});};exports[_0x4067('0x21')]=function(_0xeec870){var _0x53d33f=this;return new Promise(function(_0x28a195,_0x129269){return db[_0x4067('0x14')][_0x4067('0x22')]({'where':_0xeec870[_0x4067('0x15')]?_0xeec870[_0x4067('0x15')][_0x4067('0x17')]||null:null})['then'](function(_0x94219f){logger['info']('DestroyCmHopperBlack',_0xeec870);logger[_0x4067('0x20')](_0x4067('0x21'),_0xeec870,JSON[_0x4067('0xf')](_0x94219f));_0x28a195(_0x94219f);})[_0x4067('0x13')](function(_0x424a71){logger[_0x4067('0x10')](_0x4067('0x21'),_0x424a71['message'],_0xeec870);_0x129269(_0x53d33f[_0x4067('0x10')](0x1f4,_0x424a71[_0x4067('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f0ebd44..c999e1b 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 _0xa456=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put','/:id','update','delete','destroy','exports','multer'];(function(_0x386e06,_0x50c3d7){var _0x44c550=function(_0x40946f){while(--_0x40946f){_0x386e06['push'](_0x386e06['shift']());}};_0x44c550(++_0x50c3d7);}(_0xa456,0x142));var _0x6a45=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa456[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0xd')](_0x6a45('0xe'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xf')]);router[_0x6a45('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6a45('0x11')]);module[_0x6a45('0x12')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','/:id','put','delete','destroy'];(function(_0x4b2b9a,_0x44c576){var _0x104cbf=function(_0x157924){while(--_0x157924){_0x4b2b9a['push'](_0x4b2b9a['shift']());}};_0x104cbf(++_0x44c576);}(_0x1261,0x144));var _0x1126=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0x1261[_0x4d770d];return _0x11dc7a;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['update']);router[_0x1126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 788e4ac..80fb038 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 _0x61ab=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','diff','BOOLEAN'];(function(_0x298192,_0x10a9cf){var _0x562800=function(_0x8ed600){while(--_0x8ed600){_0x298192['push'](_0x298192['shift']());}};_0x562800(++_0x10a9cf);}(_0x61ab,0x1b0));var _0xb61a=function(_0xf4f046,_0x3a22a8){_0xf4f046=_0xf4f046-0x0;var _0x36ef42=_0x61ab[_0xf4f046];return _0x36ef42;};'use strict';var Sequelize=require(_0xb61a('0x0'));var moment=require(_0xb61a('0x1'));module['exports']={'state':{'type':Sequelize[_0xb61a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb61a('0x3')]},'scheduledat':{'type':Sequelize[_0xb61a('0x4')]},'countbusyretry':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb61a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb61a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb61a('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb61a('0x3')]},'starttime':{'type':Sequelize[_0xb61a('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb61a('0x4')]},'droptime':{'type':Sequelize[_0xb61a('0x4')]},'endtime':{'type':Sequelize[_0xb61a('0x4')]},'ringtime':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb61a('0x3')]},'campaigntype':{'type':Sequelize[_0xb61a('0x3')]},'membername':{'type':Sequelize[_0xb61a('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb61a('0x3')]},'secondDisposition':{'type':Sequelize[_0xb61a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb61a('0x4')],'set':function(_0x2a926a){var _0x1c6360=this[_0xb61a('0x5')](_0xb61a('0x6'));if(_0x1c6360&&_0x2a926a){this['setDataValue']('followuptime',moment(_0x2a926a)[_0xb61a('0x7')](moment(_0x1c6360),'seconds'));}}},'amd':{'type':Sequelize[_0xb61a('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb61a('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb61a('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb61a('0x4')]},'callback':{'type':Sequelize[_0xb61a('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb61a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb61a('0x4')]},'recallme':{'type':Sequelize[_0xb61a('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb61a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb61a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeffb=['BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds'];(function(_0x13997b,_0x444387){var _0x159a69=function(_0x3244be){while(--_0x3244be){_0x13997b['push'](_0x13997b['shift']());}};_0x159a69(++_0x444387);}(_0xeffb,0x123));var _0xbeff=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xeffb[_0x2c5255];return _0x30d0ea;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xbeff('0x0')]={'state':{'type':Sequelize[_0xbeff('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbeff('0x2')]},'scheduledat':{'type':Sequelize[_0xbeff('0x3')]},'countbusyretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbeff('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbeff('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbeff('0x2')]},'calleridname':{'type':Sequelize[_0xbeff('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbeff('0x3')]},'answertime':{'type':Sequelize[_0xbeff('0x3')]},'droptime':{'type':Sequelize[_0xbeff('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbeff('0x2')]},'campaign':{'type':Sequelize[_0xbeff('0x2')]},'campaigntype':{'type':Sequelize[_0xbeff('0x2')]},'membername':{'type':Sequelize[_0xbeff('0x2')]},'reason':{'type':Sequelize[_0xbeff('0x2')]},'disposition':{'type':Sequelize[_0xbeff('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbeff('0x2')]},'dispositionat':{'type':Sequelize[_0xbeff('0x3')],'set':function(_0x32f9ca){var _0x48c30a=this[_0xbeff('0x4')](_0xbeff('0x5'));if(_0x48c30a&&_0x32f9ca){this['setDataValue'](_0xbeff('0x6'),moment(_0x32f9ca)[_0xbeff('0x7')](moment(_0x48c30a),_0xbeff('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbeff('0x3')]},'callback':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbeff('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbeff('0x3')]},'recallme':{'type':Sequelize[_0xbeff('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbeff('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index fa89940..ee51499 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0xa3e247,_0x3821db){var _0x338795=function(_0x482c62){while(--_0x482c62){_0xa3e247['push'](_0xa3e247['shift']());}};_0x338795(++_0x3821db);}(_0x7c09,0x102));var _0x97c0=function(_0x347904,_0x1ca9b4){_0x347904=_0x347904-0x0;var _0xa7b981=_0x7c09[_0x347904];return _0xa7b981;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x3bbb5c,_0x532333){var _0x1eac9c=function(_0x5ba8aa){while(--_0x5ba8aa){_0x3bbb5c['push'](_0x3bbb5c['shift']());}};_0x1eac9c(++_0x532333);}(_0x1261,0x144));var _0x1126=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x1261[_0x57a9e5];return _0x36d39e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index db6b326..4d49a37 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 _0x8553=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','define'];(function(_0x51acbc,_0x1b9ff3){var _0x3b1496=function(_0x38291e){while(--_0x38291e){_0x51acbc['push'](_0x51acbc['shift']());}};_0x3b1496(++_0x1b9ff3);}(_0x8553,0x10c));var _0x3855=function(_0x5d989c,_0xc49159){_0x5d989c=_0x5d989c-0x0;var _0x64e0bb=_0x8553[_0x5d989c];return _0x64e0bb;};'use strict';var _=require('lodash');var util=require(_0x3855('0x0'));var logger=require(_0x3855('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3855('0x2'));var rp=require(_0x3855('0x3'));var fs=require('fs');var path=require(_0x3855('0x4'));var rimraf=require(_0x3855('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x2c6190,_0x1c96e9){return _0x2c6190[_0x3855('0x6')](_0x3855('0x7'),attributes,{'tableName':_0x3855('0x8'),'paranoid':![],'indexes':[{'name':_0x3855('0x9'),'fields':[_0x3855('0x9')]},{'name':_0x3855('0xa'),'fields':[_0x3855('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50b5=['api','moment','bluebird','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger'];(function(_0x4c1b52,_0x2a7fdc){var _0x28b9db=function(_0x3de7cd){while(--_0x3de7cd){_0x4c1b52['push'](_0x4c1b52['shift']());}};_0x28b9db(++_0x2a7fdc);}(_0x50b5,0x1a2));var _0x550b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x50b5[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x550b('0x0'));var logger=require(_0x550b('0x1'))(_0x550b('0x2'));var moment=require(_0x550b('0x3'));var BPromise=require(_0x550b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x550b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x550b('0x6'));module[_0x550b('0x7')]=function(_0x25a20e,_0x3690d8){return _0x25a20e[_0x550b('0x8')](_0x550b('0x9'),attributes,{'tableName':_0x550b('0xa'),'paranoid':![],'indexes':[{'name':_0x550b('0xb'),'fields':[_0x550b('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ebcd5b6..61d9477 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x56f7d5,_0x34921a){var _0x110008=function(_0x123726){while(--_0x123726){_0x56f7d5['push'](_0x56f7d5['shift']());}};_0x110008(++_0x34921a);}(_0x7a54,0x106));var _0x47a5=function(_0x224d53,_0x249f1d){_0x224d53=_0x224d53-0x0;var _0x42fd86=_0x7a54[_0x224d53];return _0x42fd86;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x130120,_0x28ae1d){var _0x111389=function(_0x4cee3b){while(--_0x4cee3b){_0x130120['push'](_0x130120['shift']());}};_0x111389(++_0x28ae1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x115785,_0x4d16fa){_0x115785=_0x115785-0x0;var _0x35224b=_0xb10b[_0x115785];return _0x35224b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9c519c4..6f50e26 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 _0x8672=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','connect-timeout','express','Router','fs-extra'];(function(_0x4ced30,_0x219b91){var _0xeb7efc=function(_0x2efabd){while(--_0x2efabd){_0x4ced30['push'](_0x4ced30['shift']());}};_0xeb7efc(++_0x219b91);}(_0x8672,0xb8));var _0x2867=function(_0xcd9a7f,_0x52410a){_0xcd9a7f=_0xcd9a7f-0x0;var _0x4414d1=_0x8672[_0xcd9a7f];return _0x4414d1;};'use strict';var multer=require(_0x2867('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2867('0x1'));var express=require(_0x2867('0x2'));var router=express[_0x2867('0x3')]();var fs_extra=require(_0x2867('0x4'));var auth=require(_0x2867('0x5'));var interaction=require(_0x2867('0x6'));var config=require(_0x2867('0x7'));var controller=require(_0x2867('0x8'));router[_0x2867('0x9')]('/',auth['isAuthenticated'](),controller[_0x2867('0xa')]);router[_0x2867('0x9')]('/describe',auth[_0x2867('0xb')](),controller[_0x2867('0xc')]);router[_0x2867('0x9')](_0x2867('0xd'),auth[_0x2867('0xb')](),controller[_0x2867('0xe')]);router[_0x2867('0x9')](_0x2867('0xf'),auth[_0x2867('0xb')](),controller[_0x2867('0x10')]);router[_0x2867('0x9')](_0x2867('0x11'),auth[_0x2867('0xb')](),controller[_0x2867('0x12')]);router[_0x2867('0x13')]('/voice/queue/moveContacts/:id',auth[_0x2867('0xb')](),controller[_0x2867('0x14')]);router[_0x2867('0x13')](_0x2867('0x15'),auth[_0x2867('0xb')](),controller[_0x2867('0x16')]);router[_0x2867('0x13')](_0x2867('0x17'),auth[_0x2867('0xb')](),controller[_0x2867('0x18')]);router[_0x2867('0x19')](_0x2867('0xd'),auth[_0x2867('0xb')](),controller[_0x2867('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb784=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','exports','multer','util','path'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0xb784,0x16d));var _0x4b78=function(_0x2b8c61,_0x58f0ec){_0x2b8c61=_0x2b8c61-0x0;var _0x42f66d=_0xb784[_0x2b8c61];return _0x42f66d;};'use strict';var multer=require(_0x4b78('0x0'));var util=require(_0x4b78('0x1'));var path=require(_0x4b78('0x2'));var timeout=require(_0x4b78('0x3'));var express=require(_0x4b78('0x4'));var router=express[_0x4b78('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4b78('0x6'));var interaction=require(_0x4b78('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x4b78('0x8')]('/',auth[_0x4b78('0x9')](),controller[_0x4b78('0xa')]);router[_0x4b78('0x8')](_0x4b78('0xb'),auth[_0x4b78('0x9')](),controller[_0x4b78('0xc')]);router[_0x4b78('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b78('0x8')]('/voice/queue/countAttributes/:id',auth[_0x4b78('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x4b78('0xd'),auth[_0x4b78('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x4b78('0xe'),auth['isAuthenticated'](),controller[_0x4b78('0xf')]);router[_0x4b78('0x10')](_0x4b78('0x11'),auth[_0x4b78('0x9')](),controller[_0x4b78('0x12')]);router[_0x4b78('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x4b78('0x13')]);router[_0x4b78('0x14')](_0x4b78('0x15'),auth['isAuthenticated'](),controller['update']);module[_0x4b78('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 25667d6..010d711 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 _0x3f2b=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x1c8564,_0xcf39e0){var _0x25b178=function(_0x2d6605){while(--_0x2d6605){_0x1c8564['push'](_0x1c8564['shift']());}};_0x25b178(++_0xcf39e0);}(_0x3f2b,0x1be));var _0xb3f2=function(_0x42bfb1,_0x55ebb3){_0x42bfb1=_0x42bfb1-0x0;var _0x4e5349=_0x3f2b[_0x42bfb1];return _0x4e5349;};'use strict';var Sequelize=require(_0xb3f2('0x0'));module[_0xb3f2('0x1')]={'state':{'type':Sequelize[_0xb3f2('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb3f2('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb3f2('0x3')]},'calleridnum':{'type':Sequelize[_0xb3f2('0x3')]},'calleridname':{'type':Sequelize[_0xb3f2('0x3')]},'starttime':{'type':Sequelize[_0xb3f2('0x4')]},'responsetime':{'type':Sequelize[_0xb3f2('0x4')]},'answertime':{'type':Sequelize[_0xb3f2('0x4')]},'droptime':{'type':Sequelize[_0xb3f2('0x4')]},'endtime':{'type':Sequelize[_0xb3f2('0x4')]},'ringtime':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb3f2('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xb3f2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb3f2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb3f2('0x4')]},'edited':{'type':Sequelize[_0xb3f2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb3f2('0x3')]}}; \ No newline at end of file +var _0x7948=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x203a1e,_0x45f185){var _0x2a9516=function(_0x44e635){while(--_0x44e635){_0x203a1e['push'](_0x203a1e['shift']());}};_0x2a9516(++_0x45f185);}(_0x7948,0xc7));var _0x8794=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x7948[_0x4709c8];return _0x478cdd;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x8794('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x8794('0x1')]},'scheduledat':{'type':Sequelize[_0x8794('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8794('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8794('0x1')]},'calleridnum':{'type':Sequelize[_0x8794('0x1')]},'calleridname':{'type':Sequelize[_0x8794('0x1')]},'starttime':{'type':Sequelize[_0x8794('0x2')]},'responsetime':{'type':Sequelize[_0x8794('0x2')]},'answertime':{'type':Sequelize[_0x8794('0x2')]},'droptime':{'type':Sequelize[_0x8794('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8794('0x1')]},'campaign':{'type':Sequelize[_0x8794('0x1')]},'campaigntype':{'type':Sequelize[_0x8794('0x1')]},'membername':{'type':Sequelize[_0x8794('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8794('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8794('0x2')]},'edited':{'type':Sequelize[_0x8794('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8794('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8794('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0ff178a..23849d1 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 _0xb428=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','rows','show','model','intersection','find','catch','create','describe','uniqueid','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x55922d,_0x4573aa){var _0x2359f1=function(_0x2b9873){while(--_0x2b9873){_0x55922d['push'](_0x55922d['shift']());}};_0x2359f1(++_0x4573aa);}(_0xb428,0xdc));var _0x8b42=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xb428[_0x120bc2];return _0x454a41;};'use strict';var emlformat=require(_0x8b42('0x0'));var rimraf=require(_0x8b42('0x1'));var zipdir=require(_0x8b42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b42('0x3'));var moment=require(_0x8b42('0x4'));var BPromise=require(_0x8b42('0x5'));var Mustache=require('mustache');var util=require(_0x8b42('0x6'));var path=require(_0x8b42('0x7'));var sox=require(_0x8b42('0x8'));var csv=require(_0x8b42('0x9'));var ejs=require(_0x8b42('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b42('0xb'));var squel=require(_0x8b42('0xc'));var crypto=require(_0x8b42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8b42('0xe'));var toCsv=require(_0x8b42('0x9'));var querystring=require(_0x8b42('0xf'));var Papa=require(_0x8b42('0x10'));var Redis=require('ioredis');var authService=require(_0x8b42('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b42('0x12'));var hardwareService=require(_0x8b42('0x13'));var logger=require(_0x8b42('0x14'))(_0x8b42('0x15'));var utils=require(_0x8b42('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8b42('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x453915,_0x3a3b08){_0x3a3b08=_0x3a3b08||0xcc;return function(_0x2ebedd){if(_0x2ebedd){return _0x453915[_0x8b42('0x18')](_0x3a3b08);}return _0x453915['status'](_0x3a3b08)[_0x8b42('0x19')]();};}function respondWithResult(_0x39fc91,_0x349a14){_0x349a14=_0x349a14||0xc8;return function(_0x1fdca6){if(_0x1fdca6){return _0x39fc91[_0x8b42('0x1a')](_0x349a14)[_0x8b42('0x1b')](_0x1fdca6);}};}function respondWithFilteredResult(_0x5a34fe,_0x6908e0){return function(_0x29ad18){if(_0x29ad18){var _0x538fca=typeof _0x6908e0['offset']===_0x8b42('0x1c')&&typeof _0x6908e0['limit']===_0x8b42('0x1c');var _0x1ba840=_0x29ad18[_0x8b42('0x1d')];var _0x2bb678=_0x538fca?0x0:_0x6908e0[_0x8b42('0x1e')];var _0x5a31fd=_0x538fca?_0x29ad18[_0x8b42('0x1d')]:_0x6908e0[_0x8b42('0x1e')]+_0x6908e0[_0x8b42('0x1f')];var _0x2532ca;if(_0x5a31fd>=_0x1ba840){_0x5a31fd=_0x1ba840;_0x2532ca=0xc8;}else{_0x2532ca=0xce;}_0x5a34fe[_0x8b42('0x1a')](_0x2532ca);return _0x5a34fe['set'](_0x8b42('0x20'),_0x2bb678+'-'+_0x5a31fd+'/'+_0x1ba840)[_0x8b42('0x1b')](_0x29ad18);}return null;};}function patchUpdates(_0x1c9e1e){return function(_0x41a052){try{jsonpatch[_0x8b42('0x21')](_0x41a052,_0x1c9e1e,!![]);}catch(_0x3d6c16){return BPromise[_0x8b42('0x22')](_0x3d6c16);}return _0x41a052['save']();};}function saveUpdates(_0x55ada2,_0x222caa){return function(_0x2579e0){if(_0x2579e0){return _0x2579e0[_0x8b42('0x23')](_0x55ada2)[_0x8b42('0x24')](function(_0x268eb8){return _0x268eb8;});}return null;};}function removeEntity(_0x4b2e87,_0x2fef2a){return function(_0x28e163){if(_0x28e163){return _0x28e163[_0x8b42('0x25')]()[_0x8b42('0x24')](function(){_0x4b2e87[_0x8b42('0x1a')](0xcc)[_0x8b42('0x19')]();});}};}function handleEntityNotFound(_0x3c1bb5,_0x291aeb){return function(_0x440977){if(!_0x440977){_0x3c1bb5['sendStatus'](0x194);}return _0x440977;};}function handleError(_0x56bf4b,_0x344f86){_0x344f86=_0x344f86||0x1f4;return function(_0x579fd9){logger[_0x8b42('0x26')](_0x579fd9[_0x8b42('0x27')]);if(_0x579fd9[_0x8b42('0x28')]){delete _0x579fd9[_0x8b42('0x28')];}_0x56bf4b[_0x8b42('0x1a')](_0x344f86)[_0x8b42('0x29')](_0x579fd9);};}exports[_0x8b42('0x2a')]=function(_0xcb6c6,_0x5558c5){var _0x57b72c={},_0x6d3e21={},_0x5c947e={'count':0x0,'rows':[]};var _0x54c758=_[_0x8b42('0x2b')](db['CmHopperHistory'][_0x8b42('0x2c')],function(_0x27cae3){return{'name':_0x27cae3[_0x8b42('0x2d')],'type':_0x27cae3[_0x8b42('0x2e')]['key']};});_0x6d3e21['model']=_[_0x8b42('0x2b')](_0x54c758,'name');_0x6d3e21[_0x8b42('0x2f')]=_[_0x8b42('0x30')](_0xcb6c6[_0x8b42('0x2f')]);_0x6d3e21[_0x8b42('0x31')]=_['intersection'](_0x6d3e21['model'],_0x6d3e21['query']);_0x57b72c[_0x8b42('0x32')]=_['intersection'](_0x6d3e21['model'],qs[_0x8b42('0x33')](_0xcb6c6[_0x8b42('0x2f')]['fields']));_0x57b72c[_0x8b42('0x32')]=_0x57b72c[_0x8b42('0x32')][_0x8b42('0x34')]?_0x57b72c[_0x8b42('0x32')]:_0x6d3e21['model'];if(!_0xcb6c6[_0x8b42('0x2f')][_0x8b42('0x35')](_0x8b42('0x36'))){_0x57b72c[_0x8b42('0x1f')]=qs[_0x8b42('0x1f')](_0xcb6c6['query']['limit']);_0x57b72c['offset']=qs[_0x8b42('0x1e')](_0xcb6c6[_0x8b42('0x2f')]['offset']);}_0x57b72c[_0x8b42('0x37')]=qs[_0x8b42('0x38')](_0xcb6c6[_0x8b42('0x2f')][_0x8b42('0x38')]);_0x57b72c['where']=qs['filters'](_[_0x8b42('0x39')](_0xcb6c6[_0x8b42('0x2f')],_0x6d3e21[_0x8b42('0x31')]),_0x54c758);if(_0xcb6c6[_0x8b42('0x2f')][_0x8b42('0x3a')]){_0x57b72c[_0x8b42('0x3b')]=_[_0x8b42('0x3c')](_0x57b72c['where'],{'$or':_[_0x8b42('0x2b')](_0x54c758,function(_0xb22025){if(_0xb22025[_0x8b42('0x2e')]!==_0x8b42('0x3d')){var _0x4ae8ba={};_0x4ae8ba[_0xb22025['name']]={'$like':'%'+_0xcb6c6[_0x8b42('0x2f')][_0x8b42('0x3a')]+'%'};return _0x4ae8ba;}})});}_0x57b72c=_['merge']({},_0x57b72c,_0xcb6c6[_0x8b42('0x3e')]);var _0x42f262={'where':_0x57b72c[_0x8b42('0x3b')]};return db[_0x8b42('0x3f')][_0x8b42('0x1d')](_0x42f262)[_0x8b42('0x24')](function(_0x574fc8){_0x5c947e[_0x8b42('0x1d')]=_0x574fc8;if(_0xcb6c6[_0x8b42('0x2f')][_0x8b42('0x40')]){_0x57b72c[_0x8b42('0x41')]=[{'all':!![]}];}return db[_0x8b42('0x3f')]['findAll'](_0x57b72c);})[_0x8b42('0x24')](function(_0x34b4ec){_0x5c947e[_0x8b42('0x42')]=_0x34b4ec;return _0x5c947e;})[_0x8b42('0x24')](respondWithFilteredResult(_0x5558c5,_0x57b72c))['catch'](handleError(_0x5558c5,null));};exports[_0x8b42('0x43')]=function(_0x208c76,_0x29fa59){var _0x11d069={'raw':!![],'where':{'id':_0x208c76['params']['id']}},_0x3f549b={};_0x3f549b[_0x8b42('0x44')]=_[_0x8b42('0x30')](db['CmHopperHistory'][_0x8b42('0x2c')]);_0x3f549b[_0x8b42('0x2f')]=_[_0x8b42('0x30')](_0x208c76[_0x8b42('0x2f')]);_0x3f549b[_0x8b42('0x31')]=_[_0x8b42('0x45')](_0x3f549b[_0x8b42('0x44')],_0x3f549b['query']);_0x11d069[_0x8b42('0x32')]=_[_0x8b42('0x45')](_0x3f549b[_0x8b42('0x44')],qs[_0x8b42('0x33')](_0x208c76[_0x8b42('0x2f')][_0x8b42('0x33')]));_0x11d069[_0x8b42('0x32')]=_0x11d069[_0x8b42('0x32')][_0x8b42('0x34')]?_0x11d069[_0x8b42('0x32')]:_0x3f549b['model'];if(_0x208c76['query']['includeAll']){_0x11d069['include']=[{'all':!![]}];}_0x11d069=_['merge']({},_0x11d069,_0x208c76[_0x8b42('0x3e')]);return db[_0x8b42('0x3f')][_0x8b42('0x46')](_0x11d069)[_0x8b42('0x24')](handleEntityNotFound(_0x29fa59,null))[_0x8b42('0x24')](respondWithResult(_0x29fa59,null))[_0x8b42('0x47')](handleError(_0x29fa59,null));};exports[_0x8b42('0x48')]=function(_0x1b0b6c,_0x37511c){return db[_0x8b42('0x3f')]['create'](_0x1b0b6c['body'],{})[_0x8b42('0x24')](respondWithResult(_0x37511c,0xc9))['catch'](handleError(_0x37511c,null));};exports['describe']=function(_0x48c9e1,_0x3df4b5){return db['CmHopperHistory'][_0x8b42('0x49')]()['then'](respondWithResult(_0x3df4b5,null))[_0x8b42('0x47')](handleError(_0x3df4b5,null));};exports['update']=function(_0x58f02f,_0x25b205){if(_0x58f02f['body'][_0x8b42('0x4a')]){delete _0x58f02f[_0x8b42('0x4b')][_0x8b42('0x4a')];}return db[_0x8b42('0x3f')][_0x8b42('0x46')]({'where':{'uniqueid':_0x58f02f[_0x8b42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25b205,null))['then'](saveUpdates(_0x58f02f[_0x8b42('0x4b')],null))['then'](respondWithResult(_0x25b205,null))[_0x8b42('0x47')](handleError(_0x25b205,null));}; \ No newline at end of file +var _0x70b9=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','util','path','to-csv','fs-extra','lodash','squel'];(function(_0x239f93,_0x59d5c6){var _0x449fa8=function(_0x11cef3){while(--_0x11cef3){_0x239f93['push'](_0x239f93['shift']());}};_0x449fa8(++_0x59d5c6);}(_0x70b9,0x11b));var _0x970b=function(_0x2b886a,_0x128eb5){_0x2b886a=_0x2b886a-0x0;var _0x509878=_0x70b9[_0x2b886a];return _0x509878;};'use strict';var emlformat=require(_0x970b('0x0'));var rimraf=require(_0x970b('0x1'));var zipdir=require(_0x970b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x970b('0x3'));var path=require(_0x970b('0x4'));var sox=require('sox');var csv=require(_0x970b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x970b('0x6'));var _=require(_0x970b('0x7'));var squel=require(_0x970b('0x8'));var crypto=require(_0x970b('0x9'));var jsforce=require(_0x970b('0xa'));var deskjs=require(_0x970b('0xb'));var toCsv=require(_0x970b('0x5'));var querystring=require(_0x970b('0xc'));var Papa=require(_0x970b('0xd'));var Redis=require(_0x970b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x970b('0xf'));var as=require(_0x970b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x970b('0x11'))(_0x970b('0x12'));var utils=require(_0x970b('0x13'));var config=require(_0x970b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x970b('0x15'))['db'];function respondWithStatusCode(_0x146474,_0x4e8c0f){_0x4e8c0f=_0x4e8c0f||0xcc;return function(_0x4f2e31){if(_0x4f2e31){return _0x146474['sendStatus'](_0x4e8c0f);}return _0x146474[_0x970b('0x16')](_0x4e8c0f)[_0x970b('0x17')]();};}function respondWithResult(_0x28ef5d,_0x48e54d){_0x48e54d=_0x48e54d||0xc8;return function(_0x2b9efa){if(_0x2b9efa){return _0x28ef5d['status'](_0x48e54d)[_0x970b('0x18')](_0x2b9efa);}};}function respondWithFilteredResult(_0x4fceba,_0x214ce7){return function(_0x1714c2){if(_0x1714c2){var _0x21a4d7=typeof _0x214ce7[_0x970b('0x19')]==='undefined'&&typeof _0x214ce7[_0x970b('0x1a')]===_0x970b('0x1b');var _0x4797c8=_0x1714c2[_0x970b('0x1c')];var _0x536e10=_0x21a4d7?0x0:_0x214ce7[_0x970b('0x19')];var _0x54a947=_0x21a4d7?_0x1714c2[_0x970b('0x1c')]:_0x214ce7['offset']+_0x214ce7[_0x970b('0x1a')];var _0x4efe0e;if(_0x54a947>=_0x4797c8){_0x54a947=_0x4797c8;_0x4efe0e=0xc8;}else{_0x4efe0e=0xce;}_0x4fceba['status'](_0x4efe0e);return _0x4fceba[_0x970b('0x1d')]('Content-Range',_0x536e10+'-'+_0x54a947+'/'+_0x4797c8)[_0x970b('0x18')](_0x1714c2);}return null;};}function patchUpdates(_0x6c277e){return function(_0x1b50ea){try{jsonpatch[_0x970b('0x1e')](_0x1b50ea,_0x6c277e,!![]);}catch(_0x3aca5d){return BPromise[_0x970b('0x1f')](_0x3aca5d);}return _0x1b50ea[_0x970b('0x20')]();};}function saveUpdates(_0xb4652e,_0xadd4ac){return function(_0x21de5f){if(_0x21de5f){return _0x21de5f[_0x970b('0x21')](_0xb4652e)[_0x970b('0x22')](function(_0x53fbf3){return _0x53fbf3;});}return null;};}function removeEntity(_0x22dc9a,_0x1ffac8){return function(_0x397743){if(_0x397743){return _0x397743['destroy']()[_0x970b('0x22')](function(){_0x22dc9a[_0x970b('0x16')](0xcc)[_0x970b('0x17')]();});}};}function handleEntityNotFound(_0x104dc2,_0xe8e08f){return function(_0x3a002d){if(!_0x3a002d){_0x104dc2[_0x970b('0x23')](0x194);}return _0x3a002d;};}function handleError(_0x56f002,_0x196e42){_0x196e42=_0x196e42||0x1f4;return function(_0x513d5e){logger['error'](_0x513d5e[_0x970b('0x24')]);if(_0x513d5e[_0x970b('0x25')]){delete _0x513d5e[_0x970b('0x25')];}_0x56f002[_0x970b('0x16')](_0x196e42)['send'](_0x513d5e);};}exports['index']=function(_0x3fea6d,_0x385a5f){var _0x221a38={},_0x81d71a={},_0x116b4d={'count':0x0,'rows':[]};var _0x4d2f8b=_[_0x970b('0x26')](db[_0x970b('0x27')][_0x970b('0x28')],function(_0x3e7197){return{'name':_0x3e7197[_0x970b('0x29')],'type':_0x3e7197[_0x970b('0x2a')][_0x970b('0x2b')]};});_0x81d71a[_0x970b('0x2c')]=_[_0x970b('0x26')](_0x4d2f8b,_0x970b('0x25'));_0x81d71a[_0x970b('0x2d')]=_['keys'](_0x3fea6d[_0x970b('0x2d')]);_0x81d71a[_0x970b('0x2e')]=_[_0x970b('0x2f')](_0x81d71a[_0x970b('0x2c')],_0x81d71a[_0x970b('0x2d')]);_0x221a38[_0x970b('0x30')]=_[_0x970b('0x2f')](_0x81d71a['model'],qs[_0x970b('0x31')](_0x3fea6d[_0x970b('0x2d')][_0x970b('0x31')]));_0x221a38['attributes']=_0x221a38[_0x970b('0x30')][_0x970b('0x32')]?_0x221a38[_0x970b('0x30')]:_0x81d71a['model'];if(!_0x3fea6d[_0x970b('0x2d')][_0x970b('0x33')](_0x970b('0x34'))){_0x221a38['limit']=qs['limit'](_0x3fea6d[_0x970b('0x2d')][_0x970b('0x1a')]);_0x221a38[_0x970b('0x19')]=qs[_0x970b('0x19')](_0x3fea6d['query']['offset']);}_0x221a38[_0x970b('0x35')]=qs[_0x970b('0x36')](_0x3fea6d[_0x970b('0x2d')]['sort']);_0x221a38[_0x970b('0x37')]=qs[_0x970b('0x2e')](_[_0x970b('0x38')](_0x3fea6d[_0x970b('0x2d')],_0x81d71a['filters']),_0x4d2f8b);if(_0x3fea6d[_0x970b('0x2d')][_0x970b('0x39')]){_0x221a38['where']=_[_0x970b('0x3a')](_0x221a38['where'],{'$or':_['map'](_0x4d2f8b,function(_0x430679){if(_0x430679[_0x970b('0x2a')]!==_0x970b('0x3b')){var _0x5bdd52={};_0x5bdd52[_0x430679[_0x970b('0x25')]]={'$like':'%'+_0x3fea6d[_0x970b('0x2d')][_0x970b('0x39')]+'%'};return _0x5bdd52;}})});}_0x221a38=_[_0x970b('0x3a')]({},_0x221a38,_0x3fea6d[_0x970b('0x3c')]);var _0x497904={'where':_0x221a38[_0x970b('0x37')]};return db[_0x970b('0x27')][_0x970b('0x1c')](_0x497904)['then'](function(_0x57756c){_0x116b4d[_0x970b('0x1c')]=_0x57756c;if(_0x3fea6d[_0x970b('0x2d')][_0x970b('0x3d')]){_0x221a38[_0x970b('0x3e')]=[{'all':!![]}];}return db[_0x970b('0x27')][_0x970b('0x3f')](_0x221a38);})['then'](function(_0x31b9d5){_0x116b4d['rows']=_0x31b9d5;return _0x116b4d;})[_0x970b('0x22')](respondWithFilteredResult(_0x385a5f,_0x221a38))[_0x970b('0x40')](handleError(_0x385a5f,null));};exports[_0x970b('0x41')]=function(_0x416499,_0x53e71a){var _0x1dc5fd={'raw':!![],'where':{'id':_0x416499[_0x970b('0x42')]['id']}},_0x59fde7={};_0x59fde7['model']=_['keys'](db['CmHopperHistory'][_0x970b('0x28')]);_0x59fde7['query']=_[_0x970b('0x43')](_0x416499[_0x970b('0x2d')]);_0x59fde7[_0x970b('0x2e')]=_[_0x970b('0x2f')](_0x59fde7[_0x970b('0x2c')],_0x59fde7['query']);_0x1dc5fd[_0x970b('0x30')]=_[_0x970b('0x2f')](_0x59fde7[_0x970b('0x2c')],qs['fields'](_0x416499[_0x970b('0x2d')][_0x970b('0x31')]));_0x1dc5fd[_0x970b('0x30')]=_0x1dc5fd[_0x970b('0x30')][_0x970b('0x32')]?_0x1dc5fd[_0x970b('0x30')]:_0x59fde7[_0x970b('0x2c')];if(_0x416499[_0x970b('0x2d')][_0x970b('0x3d')]){_0x1dc5fd[_0x970b('0x3e')]=[{'all':!![]}];}_0x1dc5fd=_[_0x970b('0x3a')]({},_0x1dc5fd,_0x416499['options']);return db[_0x970b('0x27')]['find'](_0x1dc5fd)['then'](handleEntityNotFound(_0x53e71a,null))[_0x970b('0x22')](respondWithResult(_0x53e71a,null))[_0x970b('0x40')](handleError(_0x53e71a,null));};exports[_0x970b('0x44')]=function(_0x3a317c,_0x49fd54){return db[_0x970b('0x27')][_0x970b('0x44')](_0x3a317c[_0x970b('0x45')],{})[_0x970b('0x22')](respondWithResult(_0x49fd54,0xc9))[_0x970b('0x40')](handleError(_0x49fd54,null));};exports['describe']=function(_0xbe3cc1,_0x16c764){return db[_0x970b('0x27')][_0x970b('0x46')]()[_0x970b('0x22')](respondWithResult(_0x16c764,null))[_0x970b('0x40')](handleError(_0x16c764,null));};exports['update']=function(_0x1f1e5d,_0x4301c9){if(_0x1f1e5d[_0x970b('0x45')][_0x970b('0x47')]){delete _0x1f1e5d[_0x970b('0x45')][_0x970b('0x47')];}return db[_0x970b('0x27')][_0x970b('0x48')]({'where':{'uniqueid':_0x1f1e5d[_0x970b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4301c9,null))[_0x970b('0x22')](saveUpdates(_0x1f1e5d[_0x970b('0x45')],null))[_0x970b('0x22')](respondWithResult(_0x4301c9,null))[_0x970b('0x40')](handleError(_0x4301c9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3646451..b5a5ad1 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 _0xdeb3=['cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('CmHopperHistory',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[{'name':_0x3deb('0xa'),'fields':[_0x3deb('0xa')]},{'name':_0x3deb('0xb'),'fields':[_0x3deb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8325=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x85f66,_0x413558){var _0x27221c=function(_0x5825f7){while(--_0x5825f7){_0x85f66['push'](_0x85f66['shift']());}};_0x27221c(++_0x413558);}(_0x8325,0x1f1));var _0x5832=function(_0x4b17e4,_0x9f5bd3){_0x4b17e4=_0x4b17e4-0x0;var _0x1dd2a7=_0x8325[_0x4b17e4];return _0x1dd2a7;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var logger=require(_0x5832('0x1'))('api');var moment=require(_0x5832('0x2'));var BPromise=require('bluebird');var rp=require(_0x5832('0x3'));var fs=require('fs');var path=require(_0x5832('0x4'));var rimraf=require(_0x5832('0x5'));var config=require(_0x5832('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1c40ca,_0x2c7977){return _0x1c40ca[_0x5832('0x7')](_0x5832('0x8'),attributes,{'tableName':_0x5832('0x9'),'paranoid':![],'indexes':[{'name':_0x5832('0xa'),'fields':['endtime']},{'name':_0x5832('0xb'),'fields':[_0x5832('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 030904a..fd22a8c 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 _0x16d2=['debug','GetVoiceQueueHopperHistory','findAll','raw','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','AvgHandleTime','where','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime'];(function(_0x1069cf,_0x387fb8){var _0x40f27d=function(_0xfd08e3){while(--_0xfd08e3){_0x1069cf['push'](_0x1069cf['shift']());}};_0x40f27d(++_0x387fb8);}(_0x16d2,0x123));var _0x216d=function(_0x28b3d7,_0x17b41d){_0x28b3d7=_0x28b3d7-0x0;var _0x49619d=_0x16d2[_0x28b3d7];return _0x49619d;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});}exports[_0x216d('0x19')]=function(_0x53d464){var _0x3b60dd=this;return new Promise(function(_0x5124ab,_0x4ddc51){return db[_0x216d('0x1a')][_0x216d('0x1b')](_0x53d464['body'],{'raw':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x216d('0xe')](function(_0x13b8e0){logger[_0x216d('0xf')](_0x216d('0x19'),_0x53d464);logger['debug'](_0x216d('0x19'),_0x53d464,JSON[_0x216d('0x13')](_0x13b8e0));_0x5124ab(_0x13b8e0);})[_0x216d('0x18')](function(_0x438981){logger[_0x216d('0x14')]('CreateCmHopperHistory',_0x438981[_0x216d('0x16')],_0x53d464);_0x4ddc51(_0x3b60dd[_0x216d('0x14')](0x1f4,_0x438981[_0x216d('0x16')]));});});};exports[_0x216d('0x1d')]=function(_0x6fa4b3){var _0x54d96f=this;return new Promise(function(_0x68d7,_0xab672){return db[_0x216d('0x1a')]['findAll']({'raw':_0x6fa4b3['options']?_0x6fa4b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x6fa4b3['options']?_0x6fa4b3[_0x216d('0x1c')][_0x216d('0x1e')]||null:null,'attributes':[[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x216d('0x1f')]['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x22')))),_0x216d('0x23')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x24')))),_0x216d('0x25')],[db[_0x216d('0x1f')]['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x216d('0x26')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x27'),db[_0x216d('0x1f')]['fn']('IF',db['sequelize'][_0x216d('0x21')](_0x216d('0x28')))),_0x216d('0x29')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x27'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x2a')))),_0x216d('0x2b')]]})[_0x216d('0xe')](function(_0x4a2caa){logger[_0x216d('0xf')](_0x216d('0x1d'),_0x6fa4b3);logger[_0x216d('0x2c')]('AvgHandleTime',_0x6fa4b3,JSON[_0x216d('0x13')](_0x4a2caa));_0x68d7(_0x4a2caa);})[_0x216d('0x18')](function(_0x5701d2){logger[_0x216d('0x14')]('AvgHandleTime',_0x5701d2['message'],_0x6fa4b3);_0xab672(_0x54d96f[_0x216d('0x14')](0x1f4,_0x5701d2[_0x216d('0x16')]));});});};exports[_0x216d('0x2d')]=function(_0x2469e0){var _0x5c3f7c=this;return new Promise(function(_0x4fd477,_0x4e4c44){return db[_0x216d('0x1a')][_0x216d('0x2e')]({'raw':_0x2469e0['options']?_0x2469e0[_0x216d('0x1c')][_0x216d('0x2f')]===undefined?!![]:![]:!![],'where':_0x2469e0['options']?_0x2469e0[_0x216d('0x1c')][_0x216d('0x1e')]||null:null,'attributes':[[_0x216d('0x30'),_0x216d('0x31')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x216d('0x32')],[db[_0x216d('0x1f')]['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0x216d('0x33')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db['sequelize'][_0x216d('0x21')](_0x216d('0x22')))),'outboundAnswerCallsDay'],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x216d('0x21')](_0x216d('0x34')))),_0x216d('0x35')],[db['sequelize']['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x216d('0x21')](_0x216d('0x36')))),_0x216d('0x37')],[db['sequelize']['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x38')))),'outboundDropCallsDayTimeout'],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x39')))),_0x216d('0x3a')],[db[_0x216d('0x1f')]['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x3b')))),'outboundBlacklistCallsDay'],[db[_0x216d('0x1f')]['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x216d('0x1f')]['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x3d')))),_0x216d('0x3e')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db[_0x216d('0x1f')][_0x216d('0x21')](_0x216d('0x3f')))),'outboundReCallsDay']],'group':[_0x216d('0x30')]})[_0x216d('0xe')](function(_0x2c7c67){logger[_0x216d('0xf')]('GetVoiceQueueHopperHistory',_0x2469e0);logger[_0x216d('0x2c')](_0x216d('0x2d'),_0x2469e0,JSON[_0x216d('0x13')](_0x2c7c67));_0x4fd477(_0x2c7c67);})[_0x216d('0x18')](function(_0x4d7705){logger[_0x216d('0x14')](_0x216d('0x2d'),_0x4d7705['message'],_0x2469e0);_0x4e4c44(_0x5c3f7c[_0x216d('0x14')](0x1f4,_0x4d7705['message']));});});};exports[_0x216d('0x40')]=function(_0x40d07b){var _0x22e025=this;return new Promise(function(_0xe65193,_0x345196){return db[_0x216d('0x1a')][_0x216d('0x2e')]({'raw':_0x40d07b[_0x216d('0x1c')]?_0x40d07b[_0x216d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x40d07b[_0x216d('0x1c')]?_0x40d07b[_0x216d('0x1c')]['where']||null:null,'attributes':[[_0x216d('0x30'),_0x216d('0x31')],[db['sequelize']['fn']('COUNT',db[_0x216d('0x1f')]['col']('id')),_0x216d('0x41')],[db[_0x216d('0x1f')]['fn'](_0x216d('0x20'),db['sequelize']['fn']('IF',db[_0x216d('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x216d('0x42')]],'group':[_0x216d('0x30')]})['then'](function(_0x181b8a){logger[_0x216d('0xf')](_0x216d('0x40'),_0x40d07b);logger[_0x216d('0x2c')](_0x216d('0x40'),_0x40d07b,JSON[_0x216d('0x13')](_0x181b8a));_0xe65193(_0x181b8a);})['catch'](function(_0x5d324e){logger[_0x216d('0x14')](_0x216d('0x40'),_0x5d324e[_0x216d('0x16')],_0x40d07b);_0x345196(_0x22e025[_0x216d('0x14')](0x1f4,_0x5d324e[_0x216d('0x16')]));});});}; \ No newline at end of file +var _0x10bd=['`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','request\x20sent','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','catch','AvgHandleTime','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','raw','where','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay'];(function(_0x147cf7,_0x14dddf){var _0x4aec25=function(_0x1f8fa2){while(--_0x1f8fa2){_0x147cf7['push'](_0x147cf7['shift']());}};_0x4aec25(++_0x14dddf);}(_0x10bd,0x97));var _0xd10b=function(_0x2f6f3c,_0x2144f9){_0x2f6f3c=_0x2f6f3c-0x0;var _0x2565fc=_0x10bd[_0x2f6f3c];return _0x2565fc;};'use strict';var _=require('lodash');var util=require(_0xd10b('0x0'));var moment=require('moment');var BPromise=require(_0xd10b('0x1'));var rs=require(_0xd10b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd10b('0x3'));var logger=require(_0xd10b('0x4'))(_0xd10b('0x5'));var config=require(_0xd10b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd10b('0x7')][_0xd10b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xed7faa,_0x9f3ec1,_0x44c600){return new BPromise(function(_0x27aa3a,_0x18cdba){return client[_0xd10b('0x9')](_0xed7faa,_0x44c600)[_0xd10b('0xa')](function(_0x1fe7ec){logger[_0xd10b('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,'request\x20sent');logger['debug'](_0xd10b('0xc'),_0x9f3ec1,'request\x20sent',JSON[_0xd10b('0xd')](_0x1fe7ec));if(_0x1fe7ec['error']){if(_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0xf')]===0x1f4){logger[_0xd10b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);return _0x18cdba(_0x1fe7ec[_0xd10b('0xe')]['message']);}logger[_0xd10b('0xe')](_0xd10b('0x11'),_0x9f3ec1,_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);return _0x27aa3a(_0x1fe7ec[_0xd10b('0xe')][_0xd10b('0x10')]);}else{logger[_0xd10b('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0xd10b('0x12'));_0x27aa3a(_0x1fe7ec[_0xd10b('0x13')][_0xd10b('0x10')]);}})['catch'](function(_0x3383f1){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x9f3ec1,_0x3383f1);_0x18cdba(_0x3383f1);});});}exports[_0xd10b('0x14')]=function(_0xe0f7da){var _0x263770=this;return new Promise(function(_0x503dce,_0x326fd3){return db[_0xd10b('0x15')][_0xd10b('0x16')](_0xe0f7da[_0xd10b('0x17')],{'raw':_0xe0f7da[_0xd10b('0x18')]?_0xe0f7da['options']['raw']===undefined?!![]:![]:!![]})[_0xd10b('0xa')](function(_0x30768d){logger[_0xd10b('0xb')](_0xd10b('0x14'),_0xe0f7da);logger['debug']('CreateCmHopperHistory',_0xe0f7da,JSON[_0xd10b('0xd')](_0x30768d));_0x503dce(_0x30768d);})[_0xd10b('0x19')](function(_0x234a76){logger[_0xd10b('0xe')](_0xd10b('0x14'),_0x234a76[_0xd10b('0x10')],_0xe0f7da);_0x326fd3(_0x263770[_0xd10b('0xe')](0x1f4,_0x234a76[_0xd10b('0x10')]));});});};exports[_0xd10b('0x1a')]=function(_0x258d5c){var _0x111fd5=this;return new Promise(function(_0x6b6e03,_0x532fd7){return db[_0xd10b('0x15')]['findAll']({'raw':_0x258d5c[_0xd10b('0x18')]?_0x258d5c[_0xd10b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x258d5c[_0xd10b('0x18')]?_0x258d5c[_0xd10b('0x18')]['where']||null:null,'attributes':[[db[_0xd10b('0x1b')]['fn']('COUNT',db['sequelize']['col']('id')),_0xd10b('0x1c')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize'][_0xd10b('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xd10b('0x1f')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x20')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal'](_0xd10b('0x21')))),_0xd10b('0x22')],[db[_0xd10b('0x1b')]['fn']('AVG',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x23')))),_0xd10b('0x24')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x25'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x26')))),_0xd10b('0x27')]]})['then'](function(_0x3515e1){logger[_0xd10b('0xb')]('AvgHandleTime',_0x258d5c);logger[_0xd10b('0x28')]('AvgHandleTime',_0x258d5c,JSON[_0xd10b('0xd')](_0x3515e1));_0x6b6e03(_0x3515e1);})[_0xd10b('0x19')](function(_0x2cab89){logger[_0xd10b('0xe')]('AvgHandleTime',_0x2cab89[_0xd10b('0x10')],_0x258d5c);_0x532fd7(_0x111fd5[_0xd10b('0xe')](0x1f4,_0x2cab89[_0xd10b('0x10')]));});});};exports[_0xd10b('0x29')]=function(_0x3b347f){var _0x113047=this;return new Promise(function(_0x3baea2,_0x3f2c73){return db['CmHopperHistory']['findAll']({'raw':_0x3b347f[_0xd10b('0x18')]?_0x3b347f[_0xd10b('0x18')][_0xd10b('0x2a')]===undefined?!![]:![]:!![],'where':_0x3b347f[_0xd10b('0x18')]?_0x3b347f[_0xd10b('0x18')][_0xd10b('0x2b')]||null:null,'attributes':[[_0xd10b('0x2c'),'name'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xd10b('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x2f')))),_0xd10b('0x30')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x31')))),_0xd10b('0x32')],[db['sequelize']['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x33')))),_0xd10b('0x34')],[db[_0xd10b('0x1b')]['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x35')))),_0xd10b('0x36')],[db['sequelize']['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db['sequelize'][_0xd10b('0x1e')](_0xd10b('0x37')))),_0xd10b('0x38')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x39')))),_0xd10b('0x3a')],[db[_0xd10b('0x1b')]['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x3b')))),_0xd10b('0x3c')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x3d')))),_0xd10b('0x3e')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0xd10b('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xd10b('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')](_0xd10b('0x40')))),_0xd10b('0x3f')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['fn']('IF',db[_0xd10b('0x1b')][_0xd10b('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd10b('0x41')]],'group':[_0xd10b('0x2c')]})[_0xd10b('0xa')](function(_0x4f6110){logger['info'](_0xd10b('0x29'),_0x3b347f);logger[_0xd10b('0x28')](_0xd10b('0x29'),_0x3b347f,JSON[_0xd10b('0xd')](_0x4f6110));_0x3baea2(_0x4f6110);})[_0xd10b('0x19')](function(_0x31f685){logger['error'](_0xd10b('0x29'),_0x31f685[_0xd10b('0x10')],_0x3b347f);_0x3f2c73(_0x113047[_0xd10b('0xe')](0x1f4,_0x31f685['message']));});});};exports[_0xd10b('0x42')]=function(_0x1d41b5){var _0x266b1e=this;return new Promise(function(_0x36f95,_0xa8c602){return db[_0xd10b('0x15')][_0xd10b('0x43')]({'raw':_0x1d41b5['options']?_0x1d41b5[_0xd10b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d41b5['options']?_0x1d41b5[_0xd10b('0x18')]['where']||null:null,'attributes':[[_0xd10b('0x2c'),'name'],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db['sequelize']['col']('id')),_0xd10b('0x44')],[db[_0xd10b('0x1b')]['fn'](_0xd10b('0x1d'),db[_0xd10b('0x1b')]['fn']('IF',db[_0xd10b('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd10b('0x45')]],'group':[_0xd10b('0x2c')]})[_0xd10b('0xa')](function(_0x5e83fc){logger[_0xd10b('0xb')](_0xd10b('0x42'),_0x1d41b5);logger['debug'](_0xd10b('0x42'),_0x1d41b5,JSON[_0xd10b('0xd')](_0x5e83fc));_0x36f95(_0x5e83fc);})[_0xd10b('0x19')](function(_0x12154b){logger[_0xd10b('0xe')](_0xd10b('0x42'),_0x12154b[_0xd10b('0x10')],_0x1d41b5);_0xa8c602(_0x266b1e[_0xd10b('0xe')](0x1f4,_0x12154b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e474401..23febf2 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 _0x5b52=['isAuthenticated','describe','/:id','show','post','create','multer','path','connect-timeout','express','Router','../../config/environment','get','index','/describe'];(function(_0xfe3407,_0x2d93f9){var _0x2a86ba=function(_0x557e9e){while(--_0x557e9e){_0xfe3407['push'](_0xfe3407['shift']());}};_0x2a86ba(++_0x2d93f9);}(_0x5b52,0x123));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x25b5('0x0'));var util=require('util');var path=require(_0x25b5('0x1'));var timeout=require(_0x25b5('0x2'));var express=require(_0x25b5('0x3'));var router=express[_0x25b5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x25b5('0x5'));var controller=require('./cmHopperHistory.controller');router[_0x25b5('0x6')]('/',auth['isAuthenticated'](),controller[_0x25b5('0x7')]);router[_0x25b5('0x6')](_0x25b5('0x8'),auth[_0x25b5('0x9')](),controller[_0x25b5('0xa')]);router[_0x25b5('0x6')](_0x25b5('0xb'),auth[_0x25b5('0x9')](),controller[_0x25b5('0xc')]);router[_0x25b5('0xd')]('/',auth[_0x25b5('0x9')](),controller[_0x25b5('0xe')]);router['put'](_0x25b5('0xb'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x30e4=['/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','isAuthenticated','describe','show','post','create','put'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x30e4,0x193));var _0x430e=function(_0x473c99,_0x4a3b43){_0x473c99=_0x473c99-0x0;var _0x1e281a=_0x30e4[_0x473c99];return _0x1e281a;};'use strict';var multer=require('multer');var util=require(_0x430e('0x0'));var path=require(_0x430e('0x1'));var timeout=require(_0x430e('0x2'));var express=require(_0x430e('0x3'));var router=express[_0x430e('0x4')]();var fs_extra=require(_0x430e('0x5'));var auth=require(_0x430e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x430e('0x7'));var controller=require(_0x430e('0x8'));router[_0x430e('0x9')]('/',auth['isAuthenticated'](),controller[_0x430e('0xa')]);router[_0x430e('0x9')]('/describe',auth[_0x430e('0xb')](),controller[_0x430e('0xc')]);router[_0x430e('0x9')]('/:id',auth[_0x430e('0xb')](),controller[_0x430e('0xd')]);router[_0x430e('0xe')]('/',auth[_0x430e('0xb')](),controller[_0x430e('0xf')]);router[_0x430e('0x10')](_0x430e('0x11'),auth['isAuthenticated'](),controller[_0x430e('0x12')]);module[_0x430e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ca0651d..6a5f99a 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 _0xc090=['STRING','name','sequelize','exports'];(function(_0x5a9bba,_0x19138a){var _0x445aa1=function(_0x1c56be){while(--_0x1c56be){_0x5a9bba['push'](_0x5a9bba['shift']());}};_0x445aa1(++_0x19138a);}(_0xc090,0x112));var _0x0c09=function(_0x46a0da,_0x847d23){_0x46a0da=_0x46a0da-0x0;var _0x1dc814=_0xc090[_0x46a0da];return _0x1dc814;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'name':{'type':Sequelize[_0x0c09('0x2')],'unique':_0x0c09('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0c09('0x2')]},'dialPrefix':{'type':Sequelize[_0x0c09('0x2')]}}; \ No newline at end of file +var _0xbfe8=['exports','name','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0xcebd8f,_0x16b439){_0xcebd8f=_0xcebd8f-0x0;var _0x14769a=_0xbfe8[_0xcebd8f];return _0x14769a;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8bfe('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8bfe('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7bba2de..8bdaded 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 _0xf19e=['rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','hasOwnProperty','order','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','push','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','cf_%d','raw','OrderBy','CmCustomField','select','from','c.ListId\x20=\x20?','distinct','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','format','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','offset','undefined','limit','set','apply','update','then','destroy','get','Lists','error','name','index','map','CmList','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','keys'];(function(_0x517ee5,_0x46933d){var _0x5b7da6=function(_0x8d7f3a){while(--_0x8d7f3a){_0x517ee5['push'](_0x517ee5['shift']());}};_0x5b7da6(++_0x46933d);}(_0xf19e,0xf0));var _0xef19=function(_0x446bcf,_0x1c27ed){_0x446bcf=_0x446bcf-0x0;var _0x5dd243=_0xf19e[_0x446bcf];return _0x5dd243;};'use strict';var emlformat=require(_0xef19('0x0'));var rimraf=require(_0xef19('0x1'));var zipdir=require(_0xef19('0x2'));var jsonpatch=require(_0xef19('0x3'));var rp=require(_0xef19('0x4'));var moment=require('moment');var BPromise=require(_0xef19('0x5'));var Mustache=require(_0xef19('0x6'));var util=require(_0xef19('0x7'));var path=require(_0xef19('0x8'));var sox=require(_0xef19('0x9'));var csv=require(_0xef19('0xa'));var ejs=require(_0xef19('0xb'));var fs=require('fs');var fs_extra=require(_0xef19('0xc'));var _=require(_0xef19('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef19('0xe'));var deskjs=require(_0xef19('0xf'));var toCsv=require(_0xef19('0xa'));var querystring=require(_0xef19('0x10'));var Papa=require('papaparse');var Redis=require(_0xef19('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xef19('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef19('0x13'));var logger=require(_0xef19('0x14'))(_0xef19('0x15'));var utils=require(_0xef19('0x16'));var config=require(_0xef19('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0xef19('0x18')]=_[_0xef19('0x19')](config[_0xef19('0x18')],{'host':_0xef19('0x1a'),'port':0x18eb});var socket=require(_0xef19('0x1b'))(new Redis(config['redis']));require(_0xef19('0x1c'))['register'](socket);function respondWithStatusCode(_0x2264e5,_0x2a2aef){_0x2a2aef=_0x2a2aef||0xcc;return function(_0xfffaf0){if(_0xfffaf0){return _0x2264e5[_0xef19('0x1d')](_0x2a2aef);}return _0x2264e5[_0xef19('0x1e')](_0x2a2aef)[_0xef19('0x1f')]();};}function respondWithResult(_0x5ec5e5,_0x2f9bfb){_0x2f9bfb=_0x2f9bfb||0xc8;return function(_0x4379c2){if(_0x4379c2){return _0x5ec5e5[_0xef19('0x1e')](_0x2f9bfb)['json'](_0x4379c2);}};}function respondWithFilteredResult(_0x5ce390,_0x2fc048){return function(_0x33268a){if(_0x33268a){var _0x4ea96f=typeof _0x2fc048[_0xef19('0x20')]===_0xef19('0x21')&&typeof _0x2fc048[_0xef19('0x22')]===_0xef19('0x21');var _0x266b6f=_0x33268a['count'];var _0x3c3b16=_0x4ea96f?0x0:_0x2fc048['offset'];var _0x16a8a8=_0x4ea96f?_0x33268a['count']:_0x2fc048[_0xef19('0x20')]+_0x2fc048[_0xef19('0x22')];var _0x31431c;if(_0x16a8a8>=_0x266b6f){_0x16a8a8=_0x266b6f;_0x31431c=0xc8;}else{_0x31431c=0xce;}_0x5ce390[_0xef19('0x1e')](_0x31431c);return _0x5ce390[_0xef19('0x23')]('Content-Range',_0x3c3b16+'-'+_0x16a8a8+'/'+_0x266b6f)['json'](_0x33268a);}return null;};}function patchUpdates(_0x53231c){return function(_0x322a21){try{jsonpatch[_0xef19('0x24')](_0x322a21,_0x53231c,!![]);}catch(_0x451698){return BPromise['reject'](_0x451698);}return _0x322a21['save']();};}function saveUpdates(_0xea9976,_0x47ed95){return function(_0x27faa7){if(_0x27faa7){return _0x27faa7[_0xef19('0x25')](_0xea9976)[_0xef19('0x26')](function(_0x21c86f){return _0x21c86f;});}return null;};}function removeEntity(_0x194077,_0x38b827){return function(_0x59fc9){if(_0x59fc9){return _0x59fc9[_0xef19('0x27')]()['then'](function(){var _0x3b5744=_0x59fc9[_0xef19('0x28')]({'plain':!![]});var _0xd9814=_0xef19('0x29');return db['UserProfileResource'][_0xef19('0x27')]({'where':{'type':_0xd9814,'resourceId':_0x3b5744['id']}})[_0xef19('0x26')](function(){return _0x59fc9;});})[_0xef19('0x26')](function(){_0x194077[_0xef19('0x1e')](0xcc)[_0xef19('0x1f')]();});}};}function handleEntityNotFound(_0x58016b,_0x19db3d){return function(_0x27f764){if(!_0x27f764){_0x58016b['sendStatus'](0x194);}return _0x27f764;};}function handleError(_0x11a5cc,_0x1fec3a){_0x1fec3a=_0x1fec3a||0x1f4;return function(_0x55e881){logger[_0xef19('0x2a')](_0x55e881['stack']);if(_0x55e881[_0xef19('0x2b')]){delete _0x55e881[_0xef19('0x2b')];}_0x11a5cc[_0xef19('0x1e')](_0x1fec3a)['send'](_0x55e881);};}exports[_0xef19('0x2c')]=function(_0x2a47ab,_0x9e696b){var _0x18faaf={},_0x4edeb3={},_0x19fa61={'count':0x0,'rows':[]};var _0x4b7c33=_[_0xef19('0x2d')](db[_0xef19('0x2e')]['rawAttributes'],function(_0x2221ea){return{'name':_0x2221ea[_0xef19('0x2f')],'type':_0x2221ea[_0xef19('0x30')][_0xef19('0x31')]};});_0x4edeb3[_0xef19('0x32')]=_[_0xef19('0x2d')](_0x4b7c33,_0xef19('0x2b'));_0x4edeb3['query']=_['keys'](_0x2a47ab[_0xef19('0x33')]);_0x4edeb3[_0xef19('0x34')]=_['intersection'](_0x4edeb3[_0xef19('0x32')],_0x4edeb3[_0xef19('0x33')]);_0x18faaf[_0xef19('0x35')]=_[_0xef19('0x36')](_0x4edeb3[_0xef19('0x32')],qs[_0xef19('0x37')](_0x2a47ab[_0xef19('0x33')][_0xef19('0x37')]));_0x18faaf['attributes']=_0x18faaf[_0xef19('0x35')][_0xef19('0x38')]?_0x18faaf[_0xef19('0x35')]:_0x4edeb3[_0xef19('0x32')];if(!_0x2a47ab['query']['hasOwnProperty'](_0xef19('0x39'))){_0x18faaf['limit']=qs[_0xef19('0x22')](_0x2a47ab[_0xef19('0x33')][_0xef19('0x22')]);_0x18faaf[_0xef19('0x20')]=qs[_0xef19('0x20')](_0x2a47ab[_0xef19('0x33')][_0xef19('0x20')]);}_0x18faaf['order']=qs['sort'](_0x2a47ab[_0xef19('0x33')][_0xef19('0x3a')]);_0x18faaf[_0xef19('0x3b')]=qs['filters'](_[_0xef19('0x3c')](_0x2a47ab[_0xef19('0x33')],_0x4edeb3[_0xef19('0x34')]),_0x4b7c33);if(_0x2a47ab[_0xef19('0x33')][_0xef19('0x3d')]){_0x18faaf[_0xef19('0x3b')]=_[_0xef19('0x3e')](_0x18faaf['where'],{'$or':_['map'](_0x4b7c33,function(_0x3e5d27){if(_0x3e5d27[_0xef19('0x30')]!==_0xef19('0x3f')){var _0x1d0a47={};_0x1d0a47[_0x3e5d27[_0xef19('0x2b')]]={'$like':'%'+_0x2a47ab[_0xef19('0x33')][_0xef19('0x3d')]+'%'};return _0x1d0a47;}})});}_0x18faaf=_[_0xef19('0x3e')]({},_0x18faaf,_0x2a47ab[_0xef19('0x40')]);var _0x576b98={'where':_0x18faaf[_0xef19('0x3b')]};return db[_0xef19('0x2e')][_0xef19('0x41')](_0x576b98)['then'](function(_0x3ad491){_0x19fa61[_0xef19('0x41')]=_0x3ad491;if(_0x2a47ab[_0xef19('0x33')][_0xef19('0x42')]){_0x18faaf['include']=[{'all':!![]}];}return db['CmList'][_0xef19('0x43')](_0x18faaf);})[_0xef19('0x26')](function(_0x29b33a){_0x19fa61[_0xef19('0x44')]=_0x29b33a;return _0x19fa61;})[_0xef19('0x26')](respondWithFilteredResult(_0x9e696b,_0x18faaf))[_0xef19('0x45')](handleError(_0x9e696b,null));};exports['show']=function(_0x279050,_0x60854){var _0x472238={'raw':![],'where':{'id':_0x279050[_0xef19('0x46')]['id']}},_0x33b469={};_0x33b469[_0xef19('0x32')]=_[_0xef19('0x47')](db['CmList'][_0xef19('0x48')]);_0x33b469['query']=_[_0xef19('0x47')](_0x279050['query']);_0x33b469[_0xef19('0x34')]=_['intersection'](_0x33b469[_0xef19('0x32')],_0x33b469[_0xef19('0x33')]);_0x472238[_0xef19('0x35')]=_[_0xef19('0x36')](_0x33b469[_0xef19('0x32')],qs['fields'](_0x279050[_0xef19('0x33')][_0xef19('0x37')]));_0x472238[_0xef19('0x35')]=_0x472238[_0xef19('0x35')]['length']?_0x472238[_0xef19('0x35')]:_0x33b469[_0xef19('0x32')];if(_0x279050[_0xef19('0x33')][_0xef19('0x42')]){_0x472238[_0xef19('0x49')]=[{'all':!![]}];}_0x472238=_[_0xef19('0x3e')]({},_0x472238,_0x279050[_0xef19('0x40')]);return db[_0xef19('0x2e')][_0xef19('0x4a')](_0x472238)[_0xef19('0x26')](handleEntityNotFound(_0x60854,null))[_0xef19('0x26')](respondWithResult(_0x60854,null))[_0xef19('0x45')](handleError(_0x60854,null));};exports[_0xef19('0x4b')]=function(_0x10265e,_0x458e8){return db[_0xef19('0x2e')][_0xef19('0x4b')](_0x10265e[_0xef19('0x4c')],{})[_0xef19('0x26')](function(_0x5ce84a){var _0xf60b6b=_0x10265e[_0xef19('0x4d')][_0xef19('0x28')]({'plain':!![]});if(!_0xf60b6b)throw new Error(_0xef19('0x4e'));if(_0xf60b6b['role']===_0xef19('0x4d')){var _0x1a2799=_0x5ce84a[_0xef19('0x28')]({'plain':!![]});var _0x1a3dbd=_0xef19('0x29');return db[_0xef19('0x4f')][_0xef19('0x4a')]({'where':{'name':_0x1a3dbd,'userProfileId':_0xf60b6b['userProfileId']},'raw':!![]})[_0xef19('0x26')](function(_0x3c5fc3){if(_0x3c5fc3&&_0x3c5fc3[_0xef19('0x50')]===0x0){return db[_0xef19('0x51')][_0xef19('0x4b')]({'name':_0x1a2799[_0xef19('0x2b')],'resourceId':_0x1a2799['id'],'type':_0x3c5fc3[_0xef19('0x2b')],'sectionId':_0x3c5fc3['id']},{})[_0xef19('0x26')](function(){return _0x5ce84a;});}else{return _0x5ce84a;}})['catch'](function(_0x3e48dd){logger[_0xef19('0x2a')](_0xef19('0x52'),_0x3e48dd);throw _0x3e48dd;});}return _0x5ce84a;})[_0xef19('0x26')](respondWithResult(_0x458e8,0xc9))[_0xef19('0x45')](handleError(_0x458e8,null));};exports[_0xef19('0x25')]=function(_0x32523b,_0x494e03){if(_0x32523b[_0xef19('0x4c')]['id']){delete _0x32523b[_0xef19('0x4c')]['id'];}return db[_0xef19('0x2e')][_0xef19('0x4a')]({'where':{'id':_0x32523b['params']['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x494e03,null))['then'](saveUpdates(_0x32523b[_0xef19('0x4c')],null))['then'](respondWithResult(_0x494e03,null))['catch'](handleError(_0x494e03,null));};exports[_0xef19('0x27')]=function(_0x1f7e47,_0x2b2703){return db[_0xef19('0x2e')][_0xef19('0x4a')]({'where':{'id':_0x1f7e47[_0xef19('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b2703,null))[_0xef19('0x26')](removeEntity(_0x2b2703,null))['catch'](handleError(_0x2b2703,null));};exports[_0xef19('0x53')]=function(_0x35288d,_0x1086a2){return db['CmList'][_0xef19('0x53')]()['then'](respondWithResult(_0x1086a2,null))['catch'](handleError(_0x1086a2,null));};exports['addDisposition']=function(_0x3fb54f,_0x14d86b,_0x36835f){if(_0x3fb54f[_0xef19('0x4c')]['id']){delete _0x3fb54f[_0xef19('0x4c')]['id'];}return db[_0xef19('0x2e')]['find']({'where':{'id':_0x3fb54f['params']['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x14d86b,null))['then'](function(_0x48bed8){if(_0x48bed8){_0x3fb54f[_0xef19('0x4c')]['ListId']=_0x48bed8['id'];return db[_0xef19('0x54')][_0xef19('0x4b')](_0x3fb54f[_0xef19('0x4c')]);}})[_0xef19('0x26')](respondWithResult(_0x14d86b,null))[_0xef19('0x45')](handleError(_0x14d86b,null));};exports[_0xef19('0x55')]=function(_0x1445b4,_0x3872b6,_0x3edcb1){var _0x39ef06={'raw':![],'where':{}};var _0x181c8d={};var _0x13427a={'count':0x0,'rows':[]};return db[_0xef19('0x2e')][_0xef19('0x56')]({'where':{'id':_0x1445b4[_0xef19('0x46')]['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x3872b6,null))[_0xef19('0x26')](function(_0x513f78){if(_0x513f78){_0x181c8d[_0xef19('0x32')]=_[_0xef19('0x47')](db[_0xef19('0x54')]['rawAttributes']);_0x181c8d[_0xef19('0x33')]=_['keys'](_0x1445b4['query']);_0x181c8d[_0xef19('0x34')]=_[_0xef19('0x36')](_0x181c8d['model'],_0x181c8d[_0xef19('0x33')]);_0x39ef06['attributes']=_[_0xef19('0x36')](_0x181c8d[_0xef19('0x32')],qs[_0xef19('0x37')](_0x1445b4['query'][_0xef19('0x37')]));_0x39ef06[_0xef19('0x35')]=_0x39ef06[_0xef19('0x35')]['length']?_0x39ef06[_0xef19('0x35')]:_0x181c8d['model'];if(!_0x1445b4[_0xef19('0x33')][_0xef19('0x57')](_0xef19('0x39'))){_0x39ef06[_0xef19('0x22')]=qs[_0xef19('0x22')](_0x1445b4[_0xef19('0x33')][_0xef19('0x22')]);_0x39ef06['offset']=qs[_0xef19('0x20')](_0x1445b4['query'][_0xef19('0x20')]);}_0x39ef06[_0xef19('0x58')]=qs['sort'](_0x1445b4['query'][_0xef19('0x3a')]);_0x39ef06[_0xef19('0x3b')]=qs[_0xef19('0x34')](_[_0xef19('0x3c')](_0x1445b4[_0xef19('0x33')],_0x181c8d[_0xef19('0x34')]));_0x39ef06['where'][_0xef19('0x59')]=_0x513f78['id'];if(_0x1445b4[_0xef19('0x33')]['filter']){_0x39ef06[_0xef19('0x3b')]=_[_0xef19('0x3e')](_0x39ef06['where'],{'$or':_[_0xef19('0x2d')](_0x39ef06[_0xef19('0x35')],function(_0x3b8dbf){var _0x264f16={};_0x264f16[_0x3b8dbf]={'$like':'%'+_0x1445b4['query']['filter']+'%'};return _0x264f16;})});}_0x39ef06=_[_0xef19('0x3e')]({},_0x39ef06,_0x1445b4[_0xef19('0x40')]);return db[_0xef19('0x54')]['count']({'where':_0x39ef06[_0xef19('0x3b')]})[_0xef19('0x26')](function(_0x528893){_0x13427a[_0xef19('0x41')]=_0x528893;if(_0x1445b4[_0xef19('0x33')][_0xef19('0x42')]){_0x39ef06['include']=[{'all':!![]}];}return db['Disposition'][_0xef19('0x43')](_0x39ef06);})[_0xef19('0x26')](function(_0x4e3e88){_0x13427a[_0xef19('0x44')]=_0x4e3e88;return _0x13427a;});}})[_0xef19('0x26')](respondWithFilteredResult(_0x3872b6,_0x39ef06))[_0xef19('0x45')](handleError(_0x3872b6,null));};exports[_0xef19('0x5a')]=function(_0x37713d,_0x4248be,_0x139dde){return db['CmList']['find']({'where':{'id':_0x37713d[_0xef19('0x46')]['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x4248be,null))[_0xef19('0x26')](function(_0xf77e73){if(_0xf77e73){return _0xf77e73[_0xef19('0x5a')](_0x37713d[_0xef19('0x33')][_0xef19('0x5b')]);}})[_0xef19('0x26')](respondWithStatusCode(_0x4248be,null))[_0xef19('0x45')](handleError(_0x4248be,null));};exports[_0xef19('0x5c')]=function(_0x5347c9,_0x4c2bd9,_0x17530e){return db['CmList'][_0xef19('0x4a')]({'where':{'id':_0x5347c9['params']['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x4c2bd9,null))[_0xef19('0x26')](function(_0xdffc1f){if(_0xdffc1f){var _0x1bf4a4=[];var _0xc32a30={'success':[],'errors':[]};return db[_0xef19('0x5d')][_0xef19('0x53')]()[_0xef19('0x26')](function(_0x42ab2e){if(_0x5347c9[_0xef19('0x4c')][_0xef19('0x5e')]&&_[_0xef19('0x5f')](_0x5347c9[_0xef19('0x4c')]['tags'])){if(_0x5347c9[_0xef19('0x4c')][_0xef19('0x5e')][_0xef19('0x38')]){_0x5347c9[_0xef19('0x4c')]['tags']=_0x5347c9['body'][_0xef19('0x5e')][_0xef19('0x60')](';')+';';}else{_0x5347c9['body'][_0xef19('0x5e')]=null;}}else{_0x5347c9[_0xef19('0x4c')][_0xef19('0x5e')]=null;}if(_0x5347c9[_0xef19('0x4c')]&&_[_0xef19('0x5f')](_0x5347c9[_0xef19('0x4c')])){for(var _0x33697a=0x0;_0x33697a<_0x5347c9[_0xef19('0x4c')][_0xef19('0x38')];_0x33697a+=0x1){_0x5347c9[_0xef19('0x4c')][_0x33697a][_0xef19('0x59')]=_0x5347c9[_0xef19('0x46')]['id'];_0x1bf4a4['push'](_0x5347c9[_0xef19('0x4c')][_0x33697a]);}return BPromise[_0xef19('0x61')](_0x1bf4a4,function(_0x802535){return db[_0xef19('0x5d')]['create'](_[_0xef19('0x62')](_0x802535,[_0xef19('0x5b'),'id'])||{},{'fields':_['keys'](_0x42ab2e),'raw':!![]})[_0xef19('0x26')](function(_0x34b74c){_0xc32a30['success'][_0xef19('0x63')](_0x34b74c['dataValues']);})[_0xef19('0x45')](function(_0x28714f){_0xc32a30[_0xef19('0x64')][_0xef19('0x63')]({'data':_0x802535,'error':_0x28714f[_0xef19('0x65')]});});})['then'](function(_0x1afa6e){return _0xc32a30;})[_0xef19('0x45')](function(_0x2838f3){return _0x2838f3;});}else{_0x4c2bd9[_0xef19('0x1e')](0x190)['json']({'message':_0xef19('0x66')});}});}})[_0xef19('0x26')](respondWithResult(_0x4c2bd9,null))['catch'](handleError(_0x4c2bd9,null));};exports[_0xef19('0x67')]=function(_0x55cad5,_0x5adb4c,_0x5b63b9){var _0x1c7316;return db[_0xef19('0x2e')][_0xef19('0x4a')]({'where':{'id':_0x55cad5[_0xef19('0x46')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xef19('0x68')}]})[_0xef19('0x26')](handleEntityNotFound(_0x5adb4c,null))['then'](function(_0x1740e4){if(_0x1740e4){_0x1c7316=_0x1740e4;return db[_0xef19('0x5d')][_0xef19('0x48')];}})[_0xef19('0x26')](function(_0x4afc55){if(_0x4afc55){var _0x936e20={};var _0x391a6a={};_0x391a6a['model']=_['concat'](_['keys'](_0x4afc55),_[_0xef19('0x2d')](_0x1c7316[_0xef19('0x68')],function(_0xde3fa9){return util['format'](_0xef19('0x69'),_0xde3fa9['id']);}));_0x391a6a[_0xef19('0x33')]=_[_0xef19('0x47')](_0x55cad5[_0xef19('0x33')]);_0x391a6a[_0xef19('0x34')]=_[_0xef19('0x36')](_0x391a6a[_0xef19('0x32')],_0x391a6a[_0xef19('0x33')]);_0x936e20[_0xef19('0x35')]=_[_0xef19('0x36')](_0x391a6a[_0xef19('0x32')],qs['fields'](_0x55cad5[_0xef19('0x33')][_0xef19('0x37')]));_0x936e20[_0xef19('0x35')]=_0x936e20[_0xef19('0x35')][_0xef19('0x38')]?_0x936e20[_0xef19('0x35')]:_0x391a6a[_0xef19('0x32')];if(!_0x55cad5[_0xef19('0x33')][_0xef19('0x57')]('nolimit')){_0x936e20[_0xef19('0x22')]=qs[_0xef19('0x22')](_0x55cad5[_0xef19('0x33')]['limit']);_0x936e20[_0xef19('0x20')]=qs['offset'](_0x55cad5[_0xef19('0x33')][_0xef19('0x20')]);}_0x936e20['order']=qs[_0xef19('0x3a')](_0x55cad5['query'][_0xef19('0x3a')]);_0x936e20[_0xef19('0x3b')]=qs['filters'](_[_0xef19('0x3c')](_0x55cad5[_0xef19('0x33')],_0x391a6a[_0xef19('0x34')]));_0x936e20[_0xef19('0x6a')]=!![];if(_0x55cad5[_0xef19('0x33')][_0xef19('0x3d')]){_0x936e20[_0xef19('0x3b')]=_['merge'](_0x936e20['where'],{'$or':_[_0xef19('0x2d')](_0x936e20[_0xef19('0x35')],function(_0x4812b7){var _0xf2972={};_0xf2972[_0x4812b7]={'$like':'%'+_0x55cad5[_0xef19('0x33')][_0xef19('0x3d')]+'%'};return _0xf2972;})});}_0x936e20=_[_0xef19('0x3e')]({},_0x936e20,_0x55cad5[_0xef19('0x40')]);return _0x1c7316[_0xef19('0x67')](_0x936e20);}})[_0xef19('0x26')](respondWithResult(_0x5adb4c,null))['catch'](handleError(_0x5adb4c,null));};exports['getContactsCsv']=function(_0x3e882b,_0x2c7b8e,_0x563fec){var _0x181462;var _0x30172a;var _0x3a9adf;var _0x21b0cc=_0x3e882b[_0xef19('0x46')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0xef19('0x6b')]})[_0xef19('0x26')](function(_0x499cce){_0x181462=_0x499cce;var _0x274d7b=_[_0xef19('0x47')](db[_0xef19('0x5d')][_0xef19('0x48')]);return db[_0xef19('0x6c')][_0xef19('0x43')]({'raw':!![],'attributes':['id','alias']})[_0xef19('0x26')](function(_0x2d7ab0){_0x30172a=_0x2d7ab0;var _0x9021a9=squel[_0xef19('0x6d')]()[_0xef19('0x37')](_0x274d7b)[_0xef19('0x6e')]('cm_contacts','c')['where'](_0xef19('0x6f'),_0x21b0cc)[_0xef19('0x3b')]('c.deletedAt\x20is\x20null')[_0xef19('0x70')]();for(var _0x556c18=0x0;_0x556c18<_0x30172a[_0xef19('0x38')];_0x556c18++){_0x9021a9[_0xef19('0x71')]('c.cf_'+_0x30172a[_0x556c18]['id'],_0xef19('0x72')+_0x30172a[_0x556c18][_0xef19('0x73')]);}for(var _0x556c18=0x0;_0x556c18<_0x181462[_0xef19('0x38')];_0x556c18++){_0x9021a9[_0xef19('0x71')](squel[_0xef19('0x6d')]()[_0xef19('0x71')](_0xef19('0x74'))[_0xef19('0x6e')](_0xef19('0x75'))[_0xef19('0x3b')](_0xef19('0x76'),_0x181462[_0x556c18]['id'])[_0xef19('0x3b')](_0xef19('0x77')),_0xef19('0x78')+_0x181462[_0x556c18][_0xef19('0x2b')]);_0x9021a9[_0xef19('0x71')](squel[_0xef19('0x6d')]()[_0xef19('0x71')](_0xef19('0x79'))['from']('cm_contact_has_items')[_0xef19('0x3b')](_0xef19('0x76'),_0x181462[_0x556c18]['id'])[_0xef19('0x3b')](_0xef19('0x77')),'description_additionalPhone_'+_0x181462[_0x556c18][_0xef19('0x2b')]);}var _0x400c05=[];_0x400c05[_0xef19('0x63')](_0x9021a9[_0xef19('0x7a')]());BPromise['each'](_0x400c05,handleQuery)[_0xef19('0x26')](function(_0x42837d){handleQuery(_0x9021a9[_0xef19('0x7a')]());var _0x5dedbe=csv_results[0x0];if(!_['isEmpty'](_0x5dedbe)){var _0x3b5f84=toCsv(_0x5dedbe);var _0x17071d=Date[_0xef19('0x7b')]();fs[_0xef19('0x7c')](util['format'](_0xef19('0x7d'),_0x21b0cc,_0x17071d),_0x3b5f84);_0x2c7b8e[_0xef19('0x7e')](_0xef19('0x7f'),_0xef19('0x80')+util['format'](_0xef19('0x81'),_0x21b0cc,_0x17071d));_0x2c7b8e[_0xef19('0x7e')]('Content-type',_0xef19('0x82'));return _0x2c7b8e[_0xef19('0x83')](util[_0xef19('0x84')](_0xef19('0x7d'),_0x21b0cc,_0x17071d));}else{return _0x2c7b8e[_0xef19('0x1d')](0xcc);}});});});};exports['addCustomField']=function(_0x25ee5e,_0x1088e9,_0x55656d){var _0x27ed5c;delete _0x25ee5e['body']['id'];return db[_0xef19('0x2e')][_0xef19('0x56')]({'where':{'id':_0x25ee5e[_0xef19('0x46')]['id']}})['then'](handleEntityNotFound(_0x1088e9,null))['then'](function(_0x19ce58){if(_0x19ce58){return db[_0xef19('0x85')][_0xef19('0x86')](function(_0x456307){return db[_0xef19('0x6c')]['create'](_0x25ee5e[_0xef19('0x4c')],{'transaction':_0x456307})['then'](function(_0x51f6bb){_0x27ed5c=_0x51f6bb;return _0x19ce58[_0xef19('0x87')](_0x51f6bb,{'transaction':_0x456307});})['then'](function(){var _0x133918={'type':db[_0xef19('0x88')][_0xef19('0x89')],'transaction':_0x456307};switch(_0x25ee5e[_0xef19('0x4c')][_0xef19('0x30')]){case _0xef19('0x8a'):_0x133918[_0xef19('0x30')]=db[_0xef19('0x88')][_0xef19('0x89')];break;case _0xef19('0x8b'):_0x133918['type']=db[_0xef19('0x88')]['INTEGER'];break;case'switch':_0x133918[_0xef19('0x30')]=db['Sequelize'][_0xef19('0x8c')];_0x133918[_0xef19('0x8d')]=![];break;default:}return db[_0xef19('0x85')]['queryInterface'][_0xef19('0x8e')](_0xef19('0x8f'),util[_0xef19('0x84')](_0xef19('0x90'),_0x27ed5c['id']),_0x133918);})[_0xef19('0x26')](function(){return _0x27ed5c;});});}})[_0xef19('0x26')](respondWithResult(_0x1088e9,null))[_0xef19('0x45')](handleError(_0x1088e9,null));};exports[_0xef19('0x91')]=function(_0x15d725,_0x2978dc,_0x4a9e8b){var _0x3dc7de={};var _0x1831e5={};var _0x4a9280;var _0x445285;return db[_0xef19('0x2e')][_0xef19('0x56')]({'where':{'id':_0x15d725[_0xef19('0x46')]['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x2978dc,null))[_0xef19('0x26')](function(_0xc061fb){if(_0xc061fb){_0x4a9280=_0xc061fb;_0x1831e5['model']=_[_0xef19('0x47')](db['CmCustomField'][_0xef19('0x48')]);_0x1831e5['query']=_[_0xef19('0x47')](_0x15d725[_0xef19('0x33')]);_0x1831e5[_0xef19('0x34')]=_[_0xef19('0x36')](_0x1831e5[_0xef19('0x32')],_0x1831e5[_0xef19('0x33')]);_0x3dc7de['attributes']=_[_0xef19('0x36')](_0x1831e5[_0xef19('0x32')],qs[_0xef19('0x37')](_0x15d725[_0xef19('0x33')][_0xef19('0x37')]));_0x3dc7de['attributes']=_0x3dc7de[_0xef19('0x35')][_0xef19('0x38')]?_0x3dc7de[_0xef19('0x35')]:_0x1831e5['model'];_0x3dc7de[_0xef19('0x58')]=qs[_0xef19('0x3a')](_0x15d725[_0xef19('0x33')][_0xef19('0x3a')]);_0x3dc7de[_0xef19('0x3b')]=qs[_0xef19('0x34')](_[_0xef19('0x3c')](_0x15d725[_0xef19('0x33')],_0x1831e5[_0xef19('0x34')]));_0x3dc7de[_0xef19('0x3b')]=_[_0xef19('0x3e')](_0x3dc7de[_0xef19('0x3b')],{'$or':[{'ListId':_0xc061fb['id']},{'ListId':null}]});if(_0x15d725[_0xef19('0x33')][_0xef19('0x3d')]){_0x3dc7de['where']=_[_0xef19('0x3e')](_0x3dc7de['where'],{'$or':_['map'](_0x3dc7de[_0xef19('0x35')],function(_0x5baf62){var _0xc27ba={};_0xc27ba[_0x5baf62]={'$like':'%'+_0x15d725[_0xef19('0x33')][_0xef19('0x3d')]+'%'};return _0xc27ba;})});}_0x3dc7de=_['merge']({},_0x3dc7de,_0x15d725['options']);return db[_0xef19('0x6c')][_0xef19('0x92')](_0x3dc7de);}})['then'](respondWithResult(_0x2978dc,null))[_0xef19('0x45')](handleError(_0x2978dc,null));};exports['getGlobalCustomFields']=function(_0x4353ff,_0x1fd47f){return db['CmCustomField'][_0xef19('0x92')]({'where':{'ListId':null}})[_0xef19('0x26')](handleEntityNotFound(_0x1fd47f,null))[_0xef19('0x26')](function(_0x437fe5){return _0x437fe5;})[_0xef19('0x26')](respondWithResult(_0x1fd47f,null))[_0xef19('0x45')](handleError(_0x1fd47f,null));};exports[_0xef19('0x93')]=function(_0x5f2553,_0x56366b,_0x310521){return db[_0xef19('0x2e')][_0xef19('0x4a')]({'where':{'id':_0x5f2553[_0xef19('0x46')]['id']}})['then'](handleEntityNotFound(_0x56366b,null))[_0xef19('0x26')](function(_0x3b8cf3){if(_0x3b8cf3){return _0x3b8cf3[_0xef19('0x93')](_0x5f2553[_0xef19('0x4c')][_0xef19('0x5b')],_[_0xef19('0x62')](_0x5f2553[_0xef19('0x4c')],['ids','id'])||{})[_0xef19('0x94')](function(_0x88f9){for(var _0x1cd1d7=0x0;_0x1cd1d7<_0x5f2553['body'][_0xef19('0x5b')][_0xef19('0x38')];_0x1cd1d7+=0x1){socket[_0xef19('0x95')](_0xef19('0x96'),{'UserId':Number(_0x5f2553[_0xef19('0x4c')]['ids'][_0x1cd1d7]),'CmListId':Number(_0x5f2553['params']['id'])});}return _0x88f9;});}})[_0xef19('0x26')](respondWithResult(_0x56366b,null))[_0xef19('0x45')](handleError(_0x56366b,null));};exports[_0xef19('0x97')]=function(_0x42a0ee,_0x4d2e25,_0x470f6f){return db[_0xef19('0x2e')][_0xef19('0x4a')]({'where':{'id':_0x42a0ee[_0xef19('0x46')]['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x4d2e25,null))[_0xef19('0x26')](function(_0x202fba){if(_0x202fba){return _0x202fba['removeAgents'](_0x42a0ee[_0xef19('0x33')][_0xef19('0x5b')])[_0xef19('0x26')](function(){if(_['isArray'](_0x42a0ee[_0xef19('0x33')]['ids'])){for(var _0x167eae=0x0;_0x167eae<_0x42a0ee[_0xef19('0x33')][_0xef19('0x5b')][_0xef19('0x38')];_0x167eae+=0x1){socket[_0xef19('0x95')]('userCmList:remove',{'UserId':Number(_0x42a0ee[_0xef19('0x33')][_0xef19('0x5b')][_0x167eae]),'CmListId':Number(_0x42a0ee[_0xef19('0x46')]['id'])});}}else{socket[_0xef19('0x95')](_0xef19('0x98'),{'UserId':Number(_0x42a0ee['query'][_0xef19('0x5b')]),'CmListId':Number(_0x42a0ee['params']['id'])});}});}})[_0xef19('0x26')](respondWithStatusCode(_0x4d2e25,null))[_0xef19('0x45')](handleError(_0x4d2e25,null));};exports[_0xef19('0x99')]=function(_0x2084a3,_0x501d79,_0x6c6025){var _0x5d63e8={};var _0x2ff9f5={};var _0x578165;var _0x39a82e;return db[_0xef19('0x2e')][_0xef19('0x56')]({'where':{'id':_0x2084a3[_0xef19('0x46')]['id']}})[_0xef19('0x26')](handleEntityNotFound(_0x501d79,null))[_0xef19('0x26')](function(_0x39e4e6){if(_0x39e4e6){_0x578165=_0x39e4e6;_0x2ff9f5[_0xef19('0x32')]=_[_0xef19('0x47')](db[_0xef19('0x9a')][_0xef19('0x48')]);_0x2ff9f5['query']=_[_0xef19('0x47')](_0x2084a3[_0xef19('0x33')]);_0x2ff9f5[_0xef19('0x34')]=_[_0xef19('0x36')](_0x2ff9f5[_0xef19('0x32')],_0x2ff9f5[_0xef19('0x33')]);_0x5d63e8[_0xef19('0x35')]=_[_0xef19('0x36')](_0x2ff9f5[_0xef19('0x32')],qs[_0xef19('0x37')](_0x2084a3[_0xef19('0x33')][_0xef19('0x37')]));_0x5d63e8[_0xef19('0x35')]=_0x5d63e8[_0xef19('0x35')][_0xef19('0x38')]?_0x5d63e8[_0xef19('0x35')]:_0x2ff9f5[_0xef19('0x32')];_0x5d63e8['order']=qs[_0xef19('0x3a')](_0x2084a3[_0xef19('0x33')][_0xef19('0x3a')]);_0x5d63e8[_0xef19('0x3b')]=qs[_0xef19('0x34')](_['pick'](_0x2084a3[_0xef19('0x33')],_0x2ff9f5[_0xef19('0x34')]));if(_0x2084a3[_0xef19('0x33')]['filter']){_0x5d63e8[_0xef19('0x3b')]=_[_0xef19('0x3e')](_0x5d63e8[_0xef19('0x3b')],{'$or':_[_0xef19('0x2d')](_0x5d63e8['attributes'],function(_0x2123b3){var _0x32aeb8={};_0x32aeb8[_0x2123b3]={'$like':'%'+_0x2084a3[_0xef19('0x33')][_0xef19('0x3d')]+'%'};return _0x32aeb8;})});}_0x5d63e8=_[_0xef19('0x3e')]({},_0x5d63e8,_0x2084a3['options']);return _0x578165[_0xef19('0x99')](_0x5d63e8);}})[_0xef19('0x26')](function(_0xec58c5){if(_0xec58c5){_0x39a82e=_0xec58c5[_0xef19('0x38')];if(!_0x2084a3['query'][_0xef19('0x57')]('nolimit')){_0x5d63e8['limit']=qs[_0xef19('0x22')](_0x2084a3[_0xef19('0x33')][_0xef19('0x22')]);_0x5d63e8[_0xef19('0x20')]=qs['offset'](_0x2084a3[_0xef19('0x33')][_0xef19('0x20')]);}return _0x578165[_0xef19('0x99')](_0x5d63e8);}})[_0xef19('0x26')](function(_0x15e7b0){if(_0x15e7b0){return _0x15e7b0?{'count':_0x39a82e,'rows':_0x15e7b0}:null;}})[_0xef19('0x26')](respondWithResult(_0x501d79,null))[_0xef19('0x45')](handleError(_0x501d79,null));};function handleQuery(_0x3e4726){logger[_0xef19('0x9b')](_0x3e4726);return db[_0xef19('0x85')]['query'](_0x3e4726)['spread'](function(_0x37ff03){csv_results[_0xef19('0x63')](_0x37ff03);})[_0xef19('0x45')](function(_0x8fa184){logger[_0xef19('0x2a')](_0x8fa184['message']);});} \ No newline at end of file +var _0x37e4=['item','from','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','CmCustomField','Sequelize','TEXT','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field'];(function(_0x102001,_0x153c67){var _0x12b3bc=function(_0x5f4b66){while(--_0x5f4b66){_0x102001['push'](_0x102001['shift']());}};_0x12b3bc(++_0x153c67);}(_0x37e4,0x160));var _0x437e=function(_0x215e9b,_0x558396){_0x215e9b=_0x215e9b-0x0;var _0x20f4e7=_0x37e4[_0x215e9b];return _0x20f4e7;};'use strict';var emlformat=require(_0x437e('0x0'));var rimraf=require(_0x437e('0x1'));var zipdir=require(_0x437e('0x2'));var jsonpatch=require(_0x437e('0x3'));var rp=require(_0x437e('0x4'));var moment=require(_0x437e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x437e('0x6'));var util=require(_0x437e('0x7'));var path=require(_0x437e('0x8'));var sox=require(_0x437e('0x9'));var csv=require(_0x437e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x437e('0xb'));var _=require('lodash');var squel=require(_0x437e('0xc'));var crypto=require(_0x437e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x437e('0xe'));var toCsv=require(_0x437e('0xa'));var querystring=require('querystring');var Papa=require(_0x437e('0xf'));var Redis=require('ioredis');var authService=require(_0x437e('0x10'));var qs=require(_0x437e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x437e('0x12'));var logger=require(_0x437e('0x13'))(_0x437e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x437e('0x15'));var db=require(_0x437e('0x16'))['db'];var csv_results;config['redis']=_[_0x437e('0x17')](config[_0x437e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x437e('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x21051a,_0x200a43){_0x200a43=_0x200a43||0xcc;return function(_0x358dc9){if(_0x358dc9){return _0x21051a[_0x437e('0x19')](_0x200a43);}return _0x21051a[_0x437e('0x1a')](_0x200a43)[_0x437e('0x1b')]();};}function respondWithResult(_0x1401cc,_0x6ae64c){_0x6ae64c=_0x6ae64c||0xc8;return function(_0x5da0e1){if(_0x5da0e1){return _0x1401cc[_0x437e('0x1a')](_0x6ae64c)[_0x437e('0x1c')](_0x5da0e1);}};}function respondWithFilteredResult(_0x1c8dfe,_0xf3f2da){return function(_0x285d73){if(_0x285d73){var _0x126441=typeof _0xf3f2da[_0x437e('0x1d')]==='undefined'&&typeof _0xf3f2da[_0x437e('0x1e')]===_0x437e('0x1f');var _0x4e608c=_0x285d73[_0x437e('0x20')];var _0x9f2fc5=_0x126441?0x0:_0xf3f2da[_0x437e('0x1d')];var _0x467068=_0x126441?_0x285d73[_0x437e('0x20')]:_0xf3f2da[_0x437e('0x1d')]+_0xf3f2da['limit'];var _0x17d81b;if(_0x467068>=_0x4e608c){_0x467068=_0x4e608c;_0x17d81b=0xc8;}else{_0x17d81b=0xce;}_0x1c8dfe[_0x437e('0x1a')](_0x17d81b);return _0x1c8dfe['set'](_0x437e('0x21'),_0x9f2fc5+'-'+_0x467068+'/'+_0x4e608c)[_0x437e('0x1c')](_0x285d73);}return null;};}function patchUpdates(_0x3b1e58){return function(_0x2e12c8){try{jsonpatch[_0x437e('0x22')](_0x2e12c8,_0x3b1e58,!![]);}catch(_0x4e7710){return BPromise['reject'](_0x4e7710);}return _0x2e12c8[_0x437e('0x23')]();};}function saveUpdates(_0xb0d9d4,_0x393a4a){return function(_0x13009d){if(_0x13009d){return _0x13009d[_0x437e('0x24')](_0xb0d9d4)[_0x437e('0x25')](function(_0x48810e){return _0x48810e;});}return null;};}function removeEntity(_0x43aa8b,_0x184f97){return function(_0x503e22){if(_0x503e22){return _0x503e22['destroy']()['then'](function(){var _0x468d06=_0x503e22['get']({'plain':!![]});var _0x3487d5='Lists';return db['UserProfileResource'][_0x437e('0x26')]({'where':{'type':_0x3487d5,'resourceId':_0x468d06['id']}})['then'](function(){return _0x503e22;});})[_0x437e('0x25')](function(){_0x43aa8b[_0x437e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14cd59,_0x2feff3){return function(_0x39bf58){if(!_0x39bf58){_0x14cd59[_0x437e('0x19')](0x194);}return _0x39bf58;};}function handleError(_0x2c9436,_0xbf1df){_0xbf1df=_0xbf1df||0x1f4;return function(_0x3c8c57){logger[_0x437e('0x27')](_0x3c8c57[_0x437e('0x28')]);if(_0x3c8c57[_0x437e('0x29')]){delete _0x3c8c57[_0x437e('0x29')];}_0x2c9436['status'](_0xbf1df)[_0x437e('0x2a')](_0x3c8c57);};}exports[_0x437e('0x2b')]=function(_0x1499e7,_0xb452ba){var _0x1dfe5f={},_0x6a41b0={},_0x297b13={'count':0x0,'rows':[]};var _0x5c66ca=_[_0x437e('0x2c')](db[_0x437e('0x2d')][_0x437e('0x2e')],function(_0xbb0528){return{'name':_0xbb0528[_0x437e('0x2f')],'type':_0xbb0528[_0x437e('0x30')][_0x437e('0x31')]};});_0x6a41b0[_0x437e('0x32')]=_['map'](_0x5c66ca,_0x437e('0x29'));_0x6a41b0[_0x437e('0x33')]=_['keys'](_0x1499e7[_0x437e('0x33')]);_0x6a41b0[_0x437e('0x34')]=_[_0x437e('0x35')](_0x6a41b0[_0x437e('0x32')],_0x6a41b0['query']);_0x1dfe5f[_0x437e('0x36')]=_[_0x437e('0x35')](_0x6a41b0[_0x437e('0x32')],qs['fields'](_0x1499e7[_0x437e('0x33')][_0x437e('0x37')]));_0x1dfe5f['attributes']=_0x1dfe5f[_0x437e('0x36')][_0x437e('0x38')]?_0x1dfe5f['attributes']:_0x6a41b0[_0x437e('0x32')];if(!_0x1499e7['query'][_0x437e('0x39')](_0x437e('0x3a'))){_0x1dfe5f[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x1499e7[_0x437e('0x33')][_0x437e('0x1e')]);_0x1dfe5f[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0x1499e7[_0x437e('0x33')][_0x437e('0x1d')]);}_0x1dfe5f[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x1499e7[_0x437e('0x33')]['sort']);_0x1dfe5f[_0x437e('0x3d')]=qs['filters'](_[_0x437e('0x3e')](_0x1499e7[_0x437e('0x33')],_0x6a41b0[_0x437e('0x34')]),_0x5c66ca);if(_0x1499e7['query'][_0x437e('0x3f')]){_0x1dfe5f['where']=_[_0x437e('0x40')](_0x1dfe5f[_0x437e('0x3d')],{'$or':_[_0x437e('0x2c')](_0x5c66ca,function(_0x414a03){if(_0x414a03[_0x437e('0x30')]!==_0x437e('0x41')){var _0x5ac779={};_0x5ac779[_0x414a03[_0x437e('0x29')]]={'$like':'%'+_0x1499e7[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x5ac779;}})});}_0x1dfe5f=_[_0x437e('0x40')]({},_0x1dfe5f,_0x1499e7[_0x437e('0x42')]);var _0x49b627={'where':_0x1dfe5f[_0x437e('0x3d')]};return db['CmList'][_0x437e('0x20')](_0x49b627)[_0x437e('0x25')](function(_0xbe9aae){_0x297b13[_0x437e('0x20')]=_0xbe9aae;if(_0x1499e7['query'][_0x437e('0x43')]){_0x1dfe5f[_0x437e('0x44')]=[{'all':!![]}];}return db[_0x437e('0x2d')][_0x437e('0x45')](_0x1dfe5f);})[_0x437e('0x25')](function(_0x716e7f){_0x297b13[_0x437e('0x46')]=_0x716e7f;return _0x297b13;})[_0x437e('0x25')](respondWithFilteredResult(_0xb452ba,_0x1dfe5f))[_0x437e('0x47')](handleError(_0xb452ba,null));};exports[_0x437e('0x48')]=function(_0x9c4562,_0x3bd0c6){var _0x3d2bda={'raw':![],'where':{'id':_0x9c4562[_0x437e('0x49')]['id']}},_0x467e8b={};_0x467e8b[_0x437e('0x32')]=_[_0x437e('0x4a')](db['CmList'][_0x437e('0x2e')]);_0x467e8b[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x9c4562[_0x437e('0x33')]);_0x467e8b[_0x437e('0x34')]=_[_0x437e('0x35')](_0x467e8b[_0x437e('0x32')],_0x467e8b['query']);_0x3d2bda[_0x437e('0x36')]=_[_0x437e('0x35')](_0x467e8b[_0x437e('0x32')],qs[_0x437e('0x37')](_0x9c4562['query'][_0x437e('0x37')]));_0x3d2bda[_0x437e('0x36')]=_0x3d2bda[_0x437e('0x36')][_0x437e('0x38')]?_0x3d2bda['attributes']:_0x467e8b['model'];if(_0x9c4562[_0x437e('0x33')][_0x437e('0x43')]){_0x3d2bda[_0x437e('0x44')]=[{'all':!![]}];}_0x3d2bda=_['merge']({},_0x3d2bda,_0x9c4562[_0x437e('0x42')]);return db[_0x437e('0x2d')][_0x437e('0x4b')](_0x3d2bda)[_0x437e('0x25')](handleEntityNotFound(_0x3bd0c6,null))[_0x437e('0x25')](respondWithResult(_0x3bd0c6,null))[_0x437e('0x47')](handleError(_0x3bd0c6,null));};exports['create']=function(_0x11142b,_0x4314c4){return db[_0x437e('0x2d')]['create'](_0x11142b['body'],{})['then'](function(_0x562a4f){var _0x5d51bf=_0x11142b[_0x437e('0x4c')][_0x437e('0x4d')]({'plain':!![]});if(!_0x5d51bf)throw new Error(_0x437e('0x4e'));if(_0x5d51bf[_0x437e('0x4f')]===_0x437e('0x4c')){var _0xc066b4=_0x562a4f[_0x437e('0x4d')]({'plain':!![]});var _0x5b738e=_0x437e('0x50');return db[_0x437e('0x51')]['find']({'where':{'name':_0x5b738e,'userProfileId':_0x5d51bf['userProfileId']},'raw':!![]})[_0x437e('0x25')](function(_0x1d11c4){if(_0x1d11c4&&_0x1d11c4['autoAssociation']===0x0){return db['UserProfileResource'][_0x437e('0x52')]({'name':_0xc066b4['name'],'resourceId':_0xc066b4['id'],'type':_0x1d11c4[_0x437e('0x29')],'sectionId':_0x1d11c4['id']},{})[_0x437e('0x25')](function(){return _0x562a4f;});}else{return _0x562a4f;}})[_0x437e('0x47')](function(_0x546122){logger[_0x437e('0x27')](_0x437e('0x53'),_0x546122);throw _0x546122;});}return _0x562a4f;})['then'](respondWithResult(_0x4314c4,0xc9))[_0x437e('0x47')](handleError(_0x4314c4,null));};exports[_0x437e('0x24')]=function(_0x49ef09,_0x30463e){if(_0x49ef09['body']['id']){delete _0x49ef09[_0x437e('0x54')]['id'];}return db['CmList'][_0x437e('0x4b')]({'where':{'id':_0x49ef09['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x30463e,null))[_0x437e('0x25')](saveUpdates(_0x49ef09[_0x437e('0x54')],null))[_0x437e('0x25')](respondWithResult(_0x30463e,null))[_0x437e('0x47')](handleError(_0x30463e,null));};exports[_0x437e('0x26')]=function(_0x4664f6,_0x42a4d){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x4664f6[_0x437e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42a4d,null))['then'](removeEntity(_0x42a4d,null))[_0x437e('0x47')](handleError(_0x42a4d,null));};exports[_0x437e('0x55')]=function(_0x4709c8,_0x9519aa){return db[_0x437e('0x2d')][_0x437e('0x55')]()['then'](respondWithResult(_0x9519aa,null))[_0x437e('0x47')](handleError(_0x9519aa,null));};exports['addDisposition']=function(_0x18ef55,_0x4a5672,_0x1b7f11){if(_0x18ef55['body']['id']){delete _0x18ef55[_0x437e('0x54')]['id'];}return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x18ef55['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x4a5672,null))[_0x437e('0x25')](function(_0x568640){if(_0x568640){_0x18ef55[_0x437e('0x54')][_0x437e('0x56')]=_0x568640['id'];return db[_0x437e('0x57')]['create'](_0x18ef55[_0x437e('0x54')]);}})[_0x437e('0x25')](respondWithResult(_0x4a5672,null))['catch'](handleError(_0x4a5672,null));};exports[_0x437e('0x58')]=function(_0xb5a5f7,_0x459f0f,_0xe7b76f){var _0x3d9311={'raw':![],'where':{}};var _0x3d38ef={};var _0x12f0f5={'count':0x0,'rows':[]};return db[_0x437e('0x2d')][_0x437e('0x59')]({'where':{'id':_0xb5a5f7[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x459f0f,null))['then'](function(_0x4e935e){if(_0x4e935e){_0x3d38ef[_0x437e('0x32')]=_[_0x437e('0x4a')](db['Disposition'][_0x437e('0x2e')]);_0x3d38ef[_0x437e('0x33')]=_['keys'](_0xb5a5f7['query']);_0x3d38ef['filters']=_[_0x437e('0x35')](_0x3d38ef['model'],_0x3d38ef[_0x437e('0x33')]);_0x3d9311[_0x437e('0x36')]=_[_0x437e('0x35')](_0x3d38ef[_0x437e('0x32')],qs[_0x437e('0x37')](_0xb5a5f7[_0x437e('0x33')]['fields']));_0x3d9311[_0x437e('0x36')]=_0x3d9311['attributes'][_0x437e('0x38')]?_0x3d9311[_0x437e('0x36')]:_0x3d38ef[_0x437e('0x32')];if(!_0xb5a5f7[_0x437e('0x33')][_0x437e('0x39')](_0x437e('0x3a'))){_0x3d9311[_0x437e('0x1e')]=qs['limit'](_0xb5a5f7['query'][_0x437e('0x1e')]);_0x3d9311[_0x437e('0x1d')]=qs[_0x437e('0x1d')](_0xb5a5f7[_0x437e('0x33')]['offset']);}_0x3d9311[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0xb5a5f7['query'][_0x437e('0x3c')]);_0x3d9311[_0x437e('0x3d')]=qs[_0x437e('0x34')](_[_0x437e('0x3e')](_0xb5a5f7[_0x437e('0x33')],_0x3d38ef['filters']));_0x3d9311['where']['ListId']=_0x4e935e['id'];if(_0xb5a5f7['query']['filter']){_0x3d9311[_0x437e('0x3d')]=_[_0x437e('0x40')](_0x3d9311[_0x437e('0x3d')],{'$or':_[_0x437e('0x2c')](_0x3d9311[_0x437e('0x36')],function(_0xaf4596){var _0x47de93={};_0x47de93[_0xaf4596]={'$like':'%'+_0xb5a5f7[_0x437e('0x33')]['filter']+'%'};return _0x47de93;})});}_0x3d9311=_[_0x437e('0x40')]({},_0x3d9311,_0xb5a5f7[_0x437e('0x42')]);return db[_0x437e('0x57')][_0x437e('0x20')]({'where':_0x3d9311[_0x437e('0x3d')]})[_0x437e('0x25')](function(_0x1ca7ff){_0x12f0f5[_0x437e('0x20')]=_0x1ca7ff;if(_0xb5a5f7[_0x437e('0x33')][_0x437e('0x43')]){_0x3d9311[_0x437e('0x44')]=[{'all':!![]}];}return db[_0x437e('0x57')][_0x437e('0x45')](_0x3d9311);})['then'](function(_0x3455c9){_0x12f0f5[_0x437e('0x46')]=_0x3455c9;return _0x12f0f5;});}})['then'](respondWithFilteredResult(_0x459f0f,_0x3d9311))[_0x437e('0x47')](handleError(_0x459f0f,null));};exports['removeDispositions']=function(_0x4b9cc3,_0x580870,_0x1281d7){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x4b9cc3['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x580870,null))[_0x437e('0x25')](function(_0x58d0f){if(_0x58d0f){return _0x58d0f[_0x437e('0x5a')](_0x4b9cc3['query'][_0x437e('0x5b')]);}})[_0x437e('0x25')](respondWithStatusCode(_0x580870,null))['catch'](handleError(_0x580870,null));};exports[_0x437e('0x5c')]=function(_0x510a0b,_0x184014,_0x22b6c7){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x510a0b[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x184014,null))[_0x437e('0x25')](function(_0x473af0){if(_0x473af0){var _0x3868a1=[];var _0x60afc4={'success':[],'errors':[]};return db[_0x437e('0x5d')]['describe']()[_0x437e('0x25')](function(_0x4e59a1){if(_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')]&&_[_0x437e('0x5f')](_0x510a0b[_0x437e('0x54')]['tags'])){if(_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')]['length']){_0x510a0b[_0x437e('0x54')]['tags']=_0x510a0b[_0x437e('0x54')][_0x437e('0x5e')][_0x437e('0x60')](';')+';';}else{_0x510a0b[_0x437e('0x54')]['tags']=null;}}else{_0x510a0b['body'][_0x437e('0x5e')]=null;}if(_0x510a0b[_0x437e('0x54')]&&_[_0x437e('0x5f')](_0x510a0b[_0x437e('0x54')])){for(var _0x40d2e0=0x0;_0x40d2e0<_0x510a0b[_0x437e('0x54')]['length'];_0x40d2e0+=0x1){_0x510a0b[_0x437e('0x54')][_0x40d2e0][_0x437e('0x56')]=_0x510a0b[_0x437e('0x49')]['id'];_0x3868a1['push'](_0x510a0b[_0x437e('0x54')][_0x40d2e0]);}return BPromise[_0x437e('0x61')](_0x3868a1,function(_0x541637){return db[_0x437e('0x5d')]['create'](_[_0x437e('0x62')](_0x541637,[_0x437e('0x5b'),'id'])||{},{'fields':_[_0x437e('0x4a')](_0x4e59a1),'raw':!![]})[_0x437e('0x25')](function(_0x11a0c9){_0x60afc4[_0x437e('0x63')]['push'](_0x11a0c9[_0x437e('0x64')]);})[_0x437e('0x47')](function(_0x81b228){_0x60afc4[_0x437e('0x65')][_0x437e('0x66')]({'data':_0x541637,'error':_0x81b228[_0x437e('0x67')]});});})['then'](function(_0x4096f3){return _0x60afc4;})[_0x437e('0x47')](function(_0x1f33cb){return _0x1f33cb;});}else{_0x184014['status'](0x190)['json']({'message':_0x437e('0x68')});}});}})[_0x437e('0x25')](respondWithResult(_0x184014,null))['catch'](handleError(_0x184014,null));};exports[_0x437e('0x69')]=function(_0x38ef20,_0x589ad8,_0x356446){var _0x4a939f;return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x38ef20['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x437e('0x6a')}]})[_0x437e('0x25')](handleEntityNotFound(_0x589ad8,null))[_0x437e('0x25')](function(_0xee6d7){if(_0xee6d7){_0x4a939f=_0xee6d7;return db[_0x437e('0x5d')]['rawAttributes'];}})['then'](function(_0x520293){if(_0x520293){var _0x1255c9={};var _0x1c5024={};_0x1c5024['model']=_[_0x437e('0x6b')](_['keys'](_0x520293),_[_0x437e('0x2c')](_0x4a939f[_0x437e('0x6a')],function(_0x6faf6){return util[_0x437e('0x6c')](_0x437e('0x6d'),_0x6faf6['id']);}));_0x1c5024[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x38ef20[_0x437e('0x33')]);_0x1c5024[_0x437e('0x34')]=_[_0x437e('0x35')](_0x1c5024[_0x437e('0x32')],_0x1c5024['query']);_0x1255c9[_0x437e('0x36')]=_[_0x437e('0x35')](_0x1c5024[_0x437e('0x32')],qs['fields'](_0x38ef20[_0x437e('0x33')][_0x437e('0x37')]));_0x1255c9['attributes']=_0x1255c9[_0x437e('0x36')]['length']?_0x1255c9[_0x437e('0x36')]:_0x1c5024[_0x437e('0x32')];if(!_0x38ef20[_0x437e('0x33')]['hasOwnProperty'](_0x437e('0x3a'))){_0x1255c9[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x38ef20[_0x437e('0x33')][_0x437e('0x1e')]);_0x1255c9['offset']=qs[_0x437e('0x1d')](_0x38ef20['query']['offset']);}_0x1255c9[_0x437e('0x3b')]=qs[_0x437e('0x3c')](_0x38ef20[_0x437e('0x33')][_0x437e('0x3c')]);_0x1255c9[_0x437e('0x3d')]=qs['filters'](_[_0x437e('0x3e')](_0x38ef20[_0x437e('0x33')],_0x1c5024['filters']));_0x1255c9[_0x437e('0x6e')]=!![];if(_0x38ef20[_0x437e('0x33')][_0x437e('0x3f')]){_0x1255c9['where']=_[_0x437e('0x40')](_0x1255c9[_0x437e('0x3d')],{'$or':_['map'](_0x1255c9[_0x437e('0x36')],function(_0x635405){var _0x43f640={};_0x43f640[_0x635405]={'$like':'%'+_0x38ef20[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x43f640;})});}_0x1255c9=_[_0x437e('0x40')]({},_0x1255c9,_0x38ef20['options']);return _0x4a939f['getContacts'](_0x1255c9);}})[_0x437e('0x25')](respondWithResult(_0x589ad8,null))[_0x437e('0x47')](handleError(_0x589ad8,null));};exports[_0x437e('0x6f')]=function(_0x185ad4,_0x8ac378,_0x33b85b){var _0x43df2a;var _0x28caf3;var _0x2613a9;var _0x2aa66f=_0x185ad4['params']['id'];csv_results=[];return db[_0x437e('0x70')][_0x437e('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x437e('0x71')]})[_0x437e('0x25')](function(_0x350cb8){_0x43df2a=_0x350cb8;var _0x15cf5=_[_0x437e('0x4a')](db[_0x437e('0x5d')][_0x437e('0x2e')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x437e('0x72')]})[_0x437e('0x25')](function(_0x5c2b14){_0x28caf3=_0x5c2b14;var _0x1c9d86=squel[_0x437e('0x73')]()[_0x437e('0x37')](_0x15cf5)['from'](_0x437e('0x74'),'c')[_0x437e('0x3d')]('c.ListId\x20=\x20?',_0x2aa66f)[_0x437e('0x3d')](_0x437e('0x75'))[_0x437e('0x76')]();for(var _0xde7ddb=0x0;_0xde7ddb<_0x28caf3['length'];_0xde7ddb++){_0x1c9d86['field'](_0x437e('0x77')+_0x28caf3[_0xde7ddb]['id'],_0x437e('0x78')+_0x28caf3[_0xde7ddb][_0x437e('0x72')]);}for(var _0xde7ddb=0x0;_0xde7ddb<_0x43df2a[_0x437e('0x38')];_0xde7ddb++){_0x1c9d86['field'](squel[_0x437e('0x73')]()[_0x437e('0x79')](_0x437e('0x7a'))[_0x437e('0x7b')]('cm_contact_has_items')[_0x437e('0x3d')]('ItemTypeId\x20=\x20?',_0x43df2a[_0xde7ddb]['id'])['where']('CmContactId\x20=\x20c.id'),_0x437e('0x7c')+_0x43df2a[_0xde7ddb][_0x437e('0x29')]);_0x1c9d86[_0x437e('0x79')](squel['select']()[_0x437e('0x79')](_0x437e('0x7d'))[_0x437e('0x7b')](_0x437e('0x7e'))[_0x437e('0x3d')](_0x437e('0x7f'),_0x43df2a[_0xde7ddb]['id'])[_0x437e('0x3d')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x43df2a[_0xde7ddb]['name']);}var _0x1cfbff=[];_0x1cfbff[_0x437e('0x66')](_0x1c9d86[_0x437e('0x80')]());BPromise[_0x437e('0x61')](_0x1cfbff,handleQuery)['then'](function(_0x53078b){handleQuery(_0x1c9d86[_0x437e('0x80')]());var _0x485822=csv_results[0x0];if(!_[_0x437e('0x81')](_0x485822)){var _0x4e128c=toCsv(_0x485822);var _0x13a5b0=Date['now']();fs['writeFileSync'](util['format'](_0x437e('0x82'),_0x2aa66f,_0x13a5b0),_0x4e128c);_0x8ac378[_0x437e('0x83')](_0x437e('0x84'),_0x437e('0x85')+util[_0x437e('0x6c')](_0x437e('0x86'),_0x2aa66f,_0x13a5b0));_0x8ac378[_0x437e('0x83')](_0x437e('0x87'),_0x437e('0x88'));return _0x8ac378['download'](util['format']('/tmp/list_%d_%s.csv',_0x2aa66f,_0x13a5b0));}else{return _0x8ac378[_0x437e('0x19')](0xcc);}});});});};exports[_0x437e('0x89')]=function(_0x12844b,_0x38f8a4,_0x64b4f5){var _0x3fbad4;delete _0x12844b['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x12844b[_0x437e('0x49')]['id']}})['then'](handleEntityNotFound(_0x38f8a4,null))['then'](function(_0x439baa){if(_0x439baa){return db[_0x437e('0x8a')][_0x437e('0x8b')](function(_0x3fa467){return db[_0x437e('0x8c')][_0x437e('0x52')](_0x12844b[_0x437e('0x54')],{'transaction':_0x3fa467})['then'](function(_0x13b4fc){_0x3fbad4=_0x13b4fc;return _0x439baa['addCustomFields'](_0x13b4fc,{'transaction':_0x3fa467});})[_0x437e('0x25')](function(){var _0x5c371a={'type':db[_0x437e('0x8d')][_0x437e('0x8e')],'transaction':_0x3fa467};switch(_0x12844b[_0x437e('0x54')][_0x437e('0x30')]){case'text':_0x5c371a[_0x437e('0x30')]=db[_0x437e('0x8d')][_0x437e('0x8e')];break;case'number':_0x5c371a[_0x437e('0x30')]=db[_0x437e('0x8d')]['INTEGER'];break;case _0x437e('0x8f'):_0x5c371a[_0x437e('0x30')]=db['Sequelize'][_0x437e('0x90')];_0x5c371a[_0x437e('0x91')]=![];break;default:}return db[_0x437e('0x8a')][_0x437e('0x92')][_0x437e('0x93')](_0x437e('0x74'),util['format'](_0x437e('0x94'),_0x3fbad4['id']),_0x5c371a);})['then'](function(){return _0x3fbad4;});});}})[_0x437e('0x25')](respondWithResult(_0x38f8a4,null))[_0x437e('0x47')](handleError(_0x38f8a4,null));};exports['getCustomFields']=function(_0xd22916,_0x7ad062,_0x1e1412){var _0xe85fad={};var _0x5dd69a={};var _0x516bac;var _0x474bf1;return db['CmList'][_0x437e('0x59')]({'where':{'id':_0xd22916['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x7ad062,null))[_0x437e('0x25')](function(_0x3a104d){if(_0x3a104d){_0x516bac=_0x3a104d;_0x5dd69a[_0x437e('0x32')]=_[_0x437e('0x4a')](db['CmCustomField'][_0x437e('0x2e')]);_0x5dd69a['query']=_['keys'](_0xd22916['query']);_0x5dd69a['filters']=_[_0x437e('0x35')](_0x5dd69a[_0x437e('0x32')],_0x5dd69a[_0x437e('0x33')]);_0xe85fad[_0x437e('0x36')]=_[_0x437e('0x35')](_0x5dd69a['model'],qs['fields'](_0xd22916[_0x437e('0x33')][_0x437e('0x37')]));_0xe85fad[_0x437e('0x36')]=_0xe85fad[_0x437e('0x36')]['length']?_0xe85fad[_0x437e('0x36')]:_0x5dd69a[_0x437e('0x32')];_0xe85fad['order']=qs['sort'](_0xd22916[_0x437e('0x33')][_0x437e('0x3c')]);_0xe85fad['where']=qs[_0x437e('0x34')](_[_0x437e('0x3e')](_0xd22916[_0x437e('0x33')],_0x5dd69a[_0x437e('0x34')]));_0xe85fad[_0x437e('0x3d')]=_[_0x437e('0x40')](_0xe85fad[_0x437e('0x3d')],{'$or':[{'ListId':_0x3a104d['id']},{'ListId':null}]});if(_0xd22916[_0x437e('0x33')][_0x437e('0x3f')]){_0xe85fad[_0x437e('0x3d')]=_['merge'](_0xe85fad['where'],{'$or':_[_0x437e('0x2c')](_0xe85fad[_0x437e('0x36')],function(_0x3be94e){var _0x106050={};_0x106050[_0x3be94e]={'$like':'%'+_0xd22916[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x106050;})});}_0xe85fad=_[_0x437e('0x40')]({},_0xe85fad,_0xd22916[_0x437e('0x42')]);return db['CmCustomField'][_0x437e('0x95')](_0xe85fad);}})[_0x437e('0x25')](respondWithResult(_0x7ad062,null))[_0x437e('0x47')](handleError(_0x7ad062,null));};exports[_0x437e('0x96')]=function(_0x39eedd,_0x45583c){return db[_0x437e('0x8c')]['findAndCountAll']({'where':{'ListId':null}})[_0x437e('0x25')](handleEntityNotFound(_0x45583c,null))[_0x437e('0x25')](function(_0x39bfb4){return _0x39bfb4;})['then'](respondWithResult(_0x45583c,null))[_0x437e('0x47')](handleError(_0x45583c,null));};exports['addAgents']=function(_0x4c6094,_0x106184,_0x2b411f){return db[_0x437e('0x2d')]['find']({'where':{'id':_0x4c6094['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x106184,null))[_0x437e('0x25')](function(_0xce2695){if(_0xce2695){return _0xce2695[_0x437e('0x97')](_0x4c6094[_0x437e('0x54')][_0x437e('0x5b')],_[_0x437e('0x62')](_0x4c6094[_0x437e('0x54')],[_0x437e('0x5b'),'id'])||{})[_0x437e('0x98')](function(_0x2e5099){for(var _0x56edd2=0x0;_0x56edd2<_0x4c6094[_0x437e('0x54')]['ids']['length'];_0x56edd2+=0x1){socket[_0x437e('0x99')]('userCmList:save',{'UserId':Number(_0x4c6094['body'][_0x437e('0x5b')][_0x56edd2]),'CmListId':Number(_0x4c6094[_0x437e('0x49')]['id'])});}return _0x2e5099;});}})[_0x437e('0x25')](respondWithResult(_0x106184,null))[_0x437e('0x47')](handleError(_0x106184,null));};exports[_0x437e('0x9a')]=function(_0x17e3fd,_0x176fba,_0x4b66a1){return db[_0x437e('0x2d')][_0x437e('0x4b')]({'where':{'id':_0x17e3fd['params']['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x176fba,null))[_0x437e('0x25')](function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7[_0x437e('0x9a')](_0x17e3fd[_0x437e('0x33')][_0x437e('0x5b')])['then'](function(){if(_[_0x437e('0x5f')](_0x17e3fd[_0x437e('0x33')]['ids'])){for(var _0x238a57=0x0;_0x238a57<_0x17e3fd['query'][_0x437e('0x5b')][_0x437e('0x38')];_0x238a57+=0x1){socket[_0x437e('0x99')](_0x437e('0x9b'),{'UserId':Number(_0x17e3fd['query'][_0x437e('0x5b')][_0x238a57]),'CmListId':Number(_0x17e3fd[_0x437e('0x49')]['id'])});}}else{socket[_0x437e('0x99')](_0x437e('0x9b'),{'UserId':Number(_0x17e3fd[_0x437e('0x33')][_0x437e('0x5b')]),'CmListId':Number(_0x17e3fd[_0x437e('0x49')]['id'])});}});}})[_0x437e('0x25')](respondWithStatusCode(_0x176fba,null))[_0x437e('0x47')](handleError(_0x176fba,null));};exports[_0x437e('0x9c')]=function(_0x5f1816,_0x42d3b8,_0x185c0d){var _0x556b94={};var _0x392dc2={};var _0x3e73c4;var _0x2e971b;return db[_0x437e('0x2d')][_0x437e('0x59')]({'where':{'id':_0x5f1816[_0x437e('0x49')]['id']}})[_0x437e('0x25')](handleEntityNotFound(_0x42d3b8,null))[_0x437e('0x25')](function(_0x1110e3){if(_0x1110e3){_0x3e73c4=_0x1110e3;_0x392dc2[_0x437e('0x32')]=_[_0x437e('0x4a')](db[_0x437e('0x9d')][_0x437e('0x2e')]);_0x392dc2[_0x437e('0x33')]=_[_0x437e('0x4a')](_0x5f1816[_0x437e('0x33')]);_0x392dc2[_0x437e('0x34')]=_[_0x437e('0x35')](_0x392dc2['model'],_0x392dc2['query']);_0x556b94[_0x437e('0x36')]=_[_0x437e('0x35')](_0x392dc2[_0x437e('0x32')],qs[_0x437e('0x37')](_0x5f1816[_0x437e('0x33')][_0x437e('0x37')]));_0x556b94[_0x437e('0x36')]=_0x556b94[_0x437e('0x36')][_0x437e('0x38')]?_0x556b94[_0x437e('0x36')]:_0x392dc2[_0x437e('0x32')];_0x556b94[_0x437e('0x3b')]=qs['sort'](_0x5f1816[_0x437e('0x33')]['sort']);_0x556b94[_0x437e('0x3d')]=qs[_0x437e('0x34')](_['pick'](_0x5f1816[_0x437e('0x33')],_0x392dc2['filters']));if(_0x5f1816[_0x437e('0x33')][_0x437e('0x3f')]){_0x556b94[_0x437e('0x3d')]=_[_0x437e('0x40')](_0x556b94['where'],{'$or':_[_0x437e('0x2c')](_0x556b94[_0x437e('0x36')],function(_0x68098c){var _0x217123={};_0x217123[_0x68098c]={'$like':'%'+_0x5f1816[_0x437e('0x33')][_0x437e('0x3f')]+'%'};return _0x217123;})});}_0x556b94=_['merge']({},_0x556b94,_0x5f1816[_0x437e('0x42')]);return _0x3e73c4[_0x437e('0x9c')](_0x556b94);}})[_0x437e('0x25')](function(_0x104f79){if(_0x104f79){_0x2e971b=_0x104f79[_0x437e('0x38')];if(!_0x5f1816[_0x437e('0x33')][_0x437e('0x39')](_0x437e('0x3a'))){_0x556b94[_0x437e('0x1e')]=qs[_0x437e('0x1e')](_0x5f1816[_0x437e('0x33')]['limit']);_0x556b94[_0x437e('0x1d')]=qs['offset'](_0x5f1816[_0x437e('0x33')][_0x437e('0x1d')]);}return _0x3e73c4[_0x437e('0x9c')](_0x556b94);}})[_0x437e('0x25')](function(_0x2024ec){if(_0x2024ec){return _0x2024ec?{'count':_0x2e971b,'rows':_0x2024ec}:null;}})[_0x437e('0x25')](respondWithResult(_0x42d3b8,null))[_0x437e('0x47')](handleError(_0x42d3b8,null));};function handleQuery(_0x401bff){logger['info'](_0x401bff);return db[_0x437e('0x8a')][_0x437e('0x33')](_0x401bff)[_0x437e('0x98')](function(_0x1c3ac1){csv_results[_0x437e('0x66')](_0x1c3ac1);})['catch'](function(_0x164193){logger[_0x437e('0x27')](_0x164193[_0x437e('0x67')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d2b3e7c..f125b23 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x38a7ef,_0x23a104){var _0x488599=function(_0x24e193){while(--_0x24e193){_0x38a7ef['push'](_0x38a7ef['shift']());}};_0x488599(++_0x23a104);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x5fc3,0xa8));var _0x35fc=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x5fc3[_0xe896bf];return _0x4c7a8a;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 1ee7700..41cdee0 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(_0x154f21,_0x3c7f37){var _0x5ae16f=function(_0x214498){while(--_0x214498){_0x154f21['push'](_0x154f21['shift']());}};_0x5ae16f(++_0x3c7f37);}(_0x70e0,0x17b));var _0x070e=function(_0xc46965,_0x4707d6){_0xc46965=_0xc46965-0x0;var _0x21326d=_0x70e0[_0xc46965];return _0x21326d;};'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 _0x4483=['define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x4b3a18,_0x4869e0){var _0x18bdd2=function(_0x22141b){while(--_0x22141b){_0x4b3a18['push'](_0x4b3a18['shift']());}};_0x18bdd2(++_0x4869e0);}(_0x4483,0x1a3));var _0x3448=function(_0xff14d4,_0x1be33b){_0xff14d4=_0xff14d4-0x0;var _0x4a2ecd=_0x4483[_0xff14d4];return _0x4a2ecd;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'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 c656d56..f08c2c8 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 _0x8701=['CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8701,0x199));var _0x1870=function(_0x162875,_0x3007af){_0x162875=_0x162875-0x0;var _0x1e2803=_0x8701[_0x162875];return _0x1e2803;};'use strict';var _=require(_0x1870('0x0'));var util=require(_0x1870('0x1'));var moment=require(_0x1870('0x2'));var BPromise=require(_0x1870('0x3'));var rs=require(_0x1870('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1870('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1870('0x6'))('rpc');var config=require(_0x1870('0x7'));var jayson=require(_0x1870('0x8'));var client=jayson[_0x1870('0x9')][_0x1870('0xa')]({'port':0x232a});config['redis']=_[_0x1870('0xb')](config['redis'],{'host':_0x1870('0xc'),'port':0x18eb});var socket=require(_0x1870('0xd'))(new Redis(config['redis']));require(_0x1870('0xe'))[_0x1870('0xf')](socket);function respondWithRpcPromise(_0x32e21d,_0x2dee28,_0x4e655c){return new BPromise(function(_0x1b03d8,_0x3f9f17){return client[_0x1870('0x10')](_0x32e21d,_0x4e655c)['then'](function(_0x445029){logger[_0x1870('0x11')]('CmList,\x20%s,\x20%s',_0x2dee28,_0x1870('0x12'));logger[_0x1870('0x13')](_0x1870('0x14'),_0x2dee28,_0x1870('0x12'),JSON[_0x1870('0x15')](_0x445029));if(_0x445029['error']){if(_0x445029[_0x1870('0x16')]['code']===0x1f4){logger['error'](_0x1870('0x17'),_0x2dee28,_0x445029[_0x1870('0x16')]['message']);return _0x3f9f17(_0x445029[_0x1870('0x16')]['message']);}logger[_0x1870('0x16')](_0x1870('0x17'),_0x2dee28,_0x445029[_0x1870('0x16')]['message']);return _0x1b03d8(_0x445029[_0x1870('0x16')][_0x1870('0x18')]);}else{logger[_0x1870('0x11')]('CmList,\x20%s,\x20%s',_0x2dee28,_0x1870('0x12'));_0x1b03d8(_0x445029[_0x1870('0x19')][_0x1870('0x18')]);}})[_0x1870('0x1a')](function(_0x1765a6){logger[_0x1870('0x16')](_0x1870('0x17'),_0x2dee28,_0x1765a6);_0x3f9f17(_0x1765a6);});});} \ No newline at end of file +var _0x227c=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x48ce3d,_0x3fbdaf){var _0xff4f24=function(_0x3341b0){while(--_0x3341b0){_0x48ce3d['push'](_0x48ce3d['shift']());}};_0xff4f24(++_0x3fbdaf);}(_0x227c,0x166));var _0xc227=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0x227c[_0x526818];return _0x44c7e3;};'use strict';var _=require('lodash');var util=require(_0xc227('0x0'));var moment=require(_0xc227('0x1'));var BPromise=require(_0xc227('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc227('0x3'));var db=require(_0xc227('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc227('0x5'))(_0xc227('0x6'));var config=require('../../config/environment');var jayson=require(_0xc227('0x7'));var client=jayson[_0xc227('0x8')][_0xc227('0x9')]({'port':0x232a});config[_0xc227('0xa')]=_['defaults'](config[_0xc227('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc227('0xb'))(new Redis(config[_0xc227('0xa')]));require(_0xc227('0xc'))[_0xc227('0xd')](socket);function respondWithRpcPromise(_0xa4d954,_0xb6a902,_0x57a568){return new BPromise(function(_0x56b935,_0x41fb2a){return client[_0xc227('0xe')](_0xa4d954,_0x57a568)['then'](function(_0x550d8d){logger['info'](_0xc227('0xf'),_0xb6a902,_0xc227('0x10'));logger['debug'](_0xc227('0x11'),_0xb6a902,'request\x20sent',JSON[_0xc227('0x12')](_0x550d8d));if(_0x550d8d[_0xc227('0x13')]){if(_0x550d8d[_0xc227('0x13')][_0xc227('0x14')]===0x1f4){logger[_0xc227('0x13')](_0xc227('0xf'),_0xb6a902,_0x550d8d[_0xc227('0x13')]['message']);return _0x41fb2a(_0x550d8d[_0xc227('0x13')][_0xc227('0x15')]);}logger[_0xc227('0x13')]('CmList,\x20%s,\x20%s',_0xb6a902,_0x550d8d[_0xc227('0x13')]['message']);return _0x56b935(_0x550d8d[_0xc227('0x13')]['message']);}else{logger[_0xc227('0x16')](_0xc227('0xf'),_0xb6a902,_0xc227('0x10'));_0x56b935(_0x550d8d[_0xc227('0x17')][_0xc227('0x15')]);}})[_0xc227('0x18')](function(_0x1b4b5a){logger[_0xc227('0x13')](_0xc227('0xf'),_0xb6a902,_0x1b4b5a);_0x41fb2a(_0x1b4b5a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index dacd333..e1cb201 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 _0xd7b3=['removeListener','register','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x31c9a7,_0x3c1d66){var _0x3c08b1=function(_0x47ffb8){while(--_0x47ffb8){_0x31c9a7['push'](_0x31c9a7['shift']());}};_0x3c08b1(++_0x3c1d66);}(_0xd7b3,0xf3));var _0x3d7b=function(_0x4f2bc2,_0x1520ed){_0x4f2bc2=_0x4f2bc2-0x0;var _0x45e3e1=_0xd7b3[_0x4f2bc2];return _0x45e3e1;};'use strict';var CmListEvents=require(_0x3d7b('0x0'));var events=[_0x3d7b('0x1'),_0x3d7b('0x2'),_0x3d7b('0x3')];function createListener(_0x4a902d,_0x2cdcbb){return function(_0x50a46a){_0x2cdcbb[_0x3d7b('0x4')](_0x4a902d,_0x50a46a);};}function removeListener(_0x1dbc31,_0x102a09){return function(){CmListEvents[_0x3d7b('0x5')](_0x1dbc31,_0x102a09);};}exports[_0x3d7b('0x6')]=function(_0x2a5902){for(var _0x56d867=0x0,_0x3a458c=events['length'];_0x56d867<_0x3a458c;_0x56d867++){var _0x5b14da=events[_0x56d867];var _0x12d19f=createListener(_0x3d7b('0x7')+_0x5b14da,_0x2a5902);CmListEvents['on'](_0x5b14da,_0x12d19f);}}; \ No newline at end of file +var _0xba63=['emit','register','cmList:','./cmList.events','save'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0xba63,0xc1));var _0x3ba6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xba63[_0x502c7d];return _0x30b7ed;};'use strict';var CmListEvents=require(_0x3ba6('0x0'));var events=[_0x3ba6('0x1'),'remove','update'];function createListener(_0x378bf0,_0x3be90c){return function(_0x32730f){_0x3be90c[_0x3ba6('0x2')](_0x378bf0,_0x32730f);};}function removeListener(_0x4ba78b,_0x5bb23c){return function(){CmListEvents['removeListener'](_0x4ba78b,_0x5bb23c);};}exports[_0x3ba6('0x3')]=function(_0x31bc61){for(var _0x107102=0x0,_0x575d65=events['length'];_0x107102<_0x575d65;_0x107102++){var _0x4e3493=events[_0x107102];var _0x119bc7=createListener(_0x3ba6('0x4')+_0x4e3493,_0x31bc61);CmListEvents['on'](_0x4e3493,_0x119bc7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e11c66d..cdb216f 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 _0x68b0=['addAgents','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b0,0x11d));var _0x068b=function(_0x39985b,_0x18448a){_0x39985b=_0x39985b-0x0;var _0x4885d5=_0x68b0[_0x39985b];return _0x4885d5;};'use strict';var multer=require(_0x068b('0x0'));var util=require(_0x068b('0x1'));var path=require(_0x068b('0x2'));var timeout=require(_0x068b('0x3'));var express=require(_0x068b('0x4'));var router=express[_0x068b('0x5')]();var fs_extra=require(_0x068b('0x6'));var auth=require(_0x068b('0x7'));var interaction=require(_0x068b('0x8'));var config=require(_0x068b('0x9'));var controller=require(_0x068b('0xa'));router[_0x068b('0xb')]('/',auth['isAuthenticated'](),controller[_0x068b('0xc')]);router['get'](_0x068b('0xd'),auth[_0x068b('0xe')](),controller[_0x068b('0xf')]);router[_0x068b('0xb')](_0x068b('0x10'),auth[_0x068b('0xe')](),controller[_0x068b('0x11')]);router[_0x068b('0xb')](_0x068b('0x12'),auth['isAuthenticated'](),controller[_0x068b('0x13')]);router[_0x068b('0xb')]('/:id/dispositions',auth[_0x068b('0xe')](),controller[_0x068b('0x14')]);router[_0x068b('0xb')](_0x068b('0x15'),auth[_0x068b('0xe')](),controller[_0x068b('0x16')]);router[_0x068b('0xb')](_0x068b('0x17'),auth[_0x068b('0xe')](),controller[_0x068b('0x18')]);router['get'](_0x068b('0x19'),auth[_0x068b('0xe')](),controller[_0x068b('0x1a')]);router[_0x068b('0xb')](_0x068b('0x1b'),auth[_0x068b('0xe')](),controller[_0x068b('0x1c')]);router[_0x068b('0x1d')]('/',auth[_0x068b('0xe')](),controller[_0x068b('0x1e')]);router[_0x068b('0x1d')](_0x068b('0x1f'),auth[_0x068b('0xe')](),controller[_0x068b('0x20')]);router['post'](_0x068b('0x15'),auth['isAuthenticated'](),controller[_0x068b('0x21')]);router[_0x068b('0x1d')](_0x068b('0x19'),auth[_0x068b('0xe')](),controller[_0x068b('0x22')]);router[_0x068b('0x1d')](_0x068b('0x1b'),auth[_0x068b('0xe')](),controller[_0x068b('0x23')]);router['put'](_0x068b('0x12'),auth['isAuthenticated'](),controller[_0x068b('0x24')]);router['delete']('/:id',auth[_0x068b('0xe')](),controller['destroy']);router[_0x068b('0x25')](_0x068b('0x1f'),auth['isAuthenticated'](),controller[_0x068b('0x26')]);router[_0x068b('0x25')]('/:id/users',auth[_0x068b('0xe')](),controller['removeAgents']);module[_0x068b('0x27')]=router; \ No newline at end of file +var _0xd1a6=['index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','delete','removeDispositions','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x213aa8,_0x25a8c4){var _0x344e16=function(_0x6927d9){while(--_0x6927d9){_0x213aa8['push'](_0x213aa8['shift']());}};_0x344e16(++_0x25a8c4);}(_0xd1a6,0x176));var _0x6d1a=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0xd1a6[_0x546f9f];return _0x3513dd;};'use strict';var multer=require('multer');var util=require(_0x6d1a('0x0'));var path=require(_0x6d1a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d1a('0x2'));var router=express[_0x6d1a('0x3')]();var fs_extra=require(_0x6d1a('0x4'));var auth=require(_0x6d1a('0x5'));var interaction=require(_0x6d1a('0x6'));var config=require(_0x6d1a('0x7'));var controller=require(_0x6d1a('0x8'));router[_0x6d1a('0x9')]('/',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xb')]);router[_0x6d1a('0x9')](_0x6d1a('0xc'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xd')]);router[_0x6d1a('0x9')](_0x6d1a('0xe'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0xf')]);router['get'](_0x6d1a('0x10'),auth[_0x6d1a('0xa')](),controller['show']);router[_0x6d1a('0x9')](_0x6d1a('0x11'),auth['isAuthenticated'](),controller[_0x6d1a('0x12')]);router['get'](_0x6d1a('0x13'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x14')]);router['get'](_0x6d1a('0x15'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x16')]);router['get'](_0x6d1a('0x17'),auth[_0x6d1a('0xa')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x18')]);router[_0x6d1a('0x19')]('/',auth['isAuthenticated'](),controller[_0x6d1a('0x1a')]);router[_0x6d1a('0x19')](_0x6d1a('0x11'),auth['isAuthenticated'](),controller[_0x6d1a('0x1b')]);router[_0x6d1a('0x19')](_0x6d1a('0x13'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1c')]);router[_0x6d1a('0x19')](_0x6d1a('0x17'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1d')]);router[_0x6d1a('0x19')](_0x6d1a('0x1e'),auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x1f')]);router['put']('/:id',auth[_0x6d1a('0xa')](),controller['update']);router[_0x6d1a('0x20')](_0x6d1a('0x10'),auth[_0x6d1a('0xa')](),controller['destroy']);router[_0x6d1a('0x20')]('/:id/dispositions',auth[_0x6d1a('0xa')](),controller[_0x6d1a('0x21')]);router[_0x6d1a('0x20')](_0x6d1a('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6d1a('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 53384cf..7fd436e 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 _0xf618=['field','sequelize','exports','VIRTUAL'];(function(_0x4c0e4d,_0x2bb712){var _0x4785aa=function(_0x47a804){while(--_0x47a804){_0x4c0e4d['push'](_0x4c0e4d['shift']());}};_0x4785aa(++_0x2bb712);}(_0xf618,0x159));var _0x8f61=function(_0x37a1b1,_0x4dd9a2){_0x37a1b1=_0x37a1b1-0x0;var _0x3f83c3=_0xf618[_0x37a1b1];return _0x3f83c3;};'use strict';var Sequelize=require(_0x8f61('0x0'));module[_0x8f61('0x1')]={'name':{'type':Sequelize[_0x8f61('0x2')],'get':function(_0x5b6ab6){return this['getDataValue'](_0x8f61('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe35c=['sequelize','exports','VIRTUAL','STRING'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0xe35c,0x88));var _0xce35=function(_0x3f5c6f,_0x1ba96b){_0x3f5c6f=_0x3f5c6f-0x0;var _0x359666=_0xe35c[_0x3f5c6f];return _0x359666;};'use strict';var Sequelize=require(_0xce35('0x0'));module[_0xce35('0x1')]={'name':{'type':Sequelize[_0xce35('0x2')],'get':function(_0x420c5b){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xce35('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xce35('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ec8f8bb..06793bd 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(_0x4329c1,_0x506d77){var _0x42c98c=function(_0xfae1b7){while(--_0xfae1b7){_0x4329c1['push'](_0x4329c1['shift']());}};_0x42c98c(++_0x506d77);}(_0x7a54,0x106));var _0x47a5=function(_0x5c64d5,_0x5d7ab2){_0x5c64d5=_0x5c64d5-0x0;var _0x27d42a=_0x7a54[_0x5c64d5];return _0x27d42a;};'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(_0x2f738c,_0x3933b2){var _0x1b5263=function(_0x52738e){while(--_0x52738e){_0x2f738c['push'](_0x2f738c['shift']());}};_0x1b5263(++_0x3933b2);}(_0x7a54,0x106));var _0x47a5=function(_0x18c32c,_0x374d4d){_0x18c32c=_0x18c32c-0x0;var _0x370798=_0x7a54[_0x18c32c];return _0x370798;};'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 2958dff..600793f 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 _0x90ea=['define','Condition','tools_conditions','util','../../config/logger','api','bluebird','path','../../config/environment','./condition.attributes'];(function(_0x204507,_0x8f2d3c){var _0x2b5d17=function(_0x545f5a){while(--_0x545f5a){_0x204507['push'](_0x204507['shift']());}};_0x2b5d17(++_0x8f2d3c);}(_0x90ea,0xdf));var _0xa90e=function(_0x11f9a0,_0xf52f7a){_0x11f9a0=_0x11f9a0-0x0;var _0x32f2b7=_0x90ea[_0x11f9a0];return _0x32f2b7;};'use strict';var _=require('lodash');var util=require(_0xa90e('0x0'));var logger=require(_0xa90e('0x1'))(_0xa90e('0x2'));var moment=require('moment');var BPromise=require(_0xa90e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa90e('0x4'));var rimraf=require('rimraf');var config=require(_0xa90e('0x5'));var attributes=require(_0xa90e('0x6'));module['exports']=function(_0x4e27cb,_0x2c9931){return _0x4e27cb[_0xa90e('0x7')](_0xa90e('0x8'),attributes,{'tableName':_0xa90e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74da=['define','tools_conditions','lodash','../../config/logger','api','moment','path','rimraf','./condition.attributes','exports'];(function(_0x1d5b0e,_0x186685){var _0x397b16=function(_0x5e9d4e){while(--_0x5e9d4e){_0x1d5b0e['push'](_0x1d5b0e['shift']());}};_0x397b16(++_0x186685);}(_0x74da,0x1c4));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa74d('0x0'));var util=require('util');var logger=require(_0xa74d('0x1'))(_0xa74d('0x2'));var moment=require(_0xa74d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa74d('0x4'));var rimraf=require(_0xa74d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa74d('0x6'));module[_0xa74d('0x7')]=function(_0x1a7116,_0x5118ca){return _0x1a7116[_0xa74d('0x8')]('Condition',attributes,{'tableName':_0xa74d('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 d8bfe54..ce4dfb3 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 _0x3f00=['stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x3f00,0x1a5));var _0x03f0=function(_0x574824,_0x55c647){_0x574824=_0x574824-0x0;var _0x396508=_0x3f00[_0x574824];return _0x396508;};'use strict';var _=require(_0x03f0('0x0'));var util=require(_0x03f0('0x1'));var moment=require(_0x03f0('0x2'));var BPromise=require(_0x03f0('0x3'));var rs=require(_0x03f0('0x4'));var fs=require('fs');var Redis=require(_0x03f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x03f0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x03f0('0x7'));var jayson=require(_0x03f0('0x8'));var client=jayson[_0x03f0('0x9')][_0x03f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6e72ec,_0x3f6b0c,_0x2a6dcf){return new BPromise(function(_0x2ff27c,_0x1be89b){return client['request'](_0x6e72ec,_0x2a6dcf)[_0x03f0('0xb')](function(_0x1297d5){logger[_0x03f0('0xc')]('Condition,\x20%s,\x20%s',_0x3f6b0c,'request\x20sent');logger[_0x03f0('0xd')](_0x03f0('0xe'),_0x3f6b0c,_0x03f0('0xf'),JSON[_0x03f0('0x10')](_0x1297d5));if(_0x1297d5['error']){if(_0x1297d5[_0x03f0('0x11')][_0x03f0('0x12')]===0x1f4){logger[_0x03f0('0x11')](_0x03f0('0x13'),_0x3f6b0c,_0x1297d5['error'][_0x03f0('0x14')]);return _0x1be89b(_0x1297d5[_0x03f0('0x11')][_0x03f0('0x14')]);}logger['error'](_0x03f0('0x13'),_0x3f6b0c,_0x1297d5['error'][_0x03f0('0x14')]);return _0x2ff27c(_0x1297d5[_0x03f0('0x11')][_0x03f0('0x14')]);}else{logger[_0x03f0('0xc')](_0x03f0('0x13'),_0x3f6b0c,_0x03f0('0xf'));_0x2ff27c(_0x1297d5[_0x03f0('0x15')][_0x03f0('0x14')]);}})[_0x03f0('0x16')](function(_0x57753f){logger['error']('Condition,\x20%s,\x20%s',_0x3f6b0c,_0x57753f);_0x1be89b(_0x57753f);});});} \ No newline at end of file +var _0x8f0c=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x8f0c,0x199));var _0xc8f0=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x8f0c[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0xc8f0('0x0'));var util=require(_0xc8f0('0x1'));var moment=require(_0xc8f0('0x2'));var BPromise=require(_0xc8f0('0x3'));var rs=require(_0xc8f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8f0('0x5'))['db'];var utils=require(_0xc8f0('0x6'));var logger=require(_0xc8f0('0x7'))(_0xc8f0('0x8'));var config=require(_0xc8f0('0x9'));var jayson=require(_0xc8f0('0xa'));var client=jayson['client'][_0xc8f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566b74,_0x2ffe1,_0x3ccf36){return new BPromise(function(_0x532a9a,_0x5501c3){return client[_0xc8f0('0xc')](_0x566b74,_0x3ccf36)[_0xc8f0('0xd')](function(_0x349617){logger[_0xc8f0('0xe')](_0xc8f0('0xf'),_0x2ffe1,_0xc8f0('0x10'));logger[_0xc8f0('0x11')](_0xc8f0('0x12'),_0x2ffe1,_0xc8f0('0x10'),JSON['stringify'](_0x349617));if(_0x349617['error']){if(_0x349617[_0xc8f0('0x13')][_0xc8f0('0x14')]===0x1f4){logger[_0xc8f0('0x13')](_0xc8f0('0xf'),_0x2ffe1,_0x349617[_0xc8f0('0x13')]['message']);return _0x5501c3(_0x349617[_0xc8f0('0x13')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x2ffe1,_0x349617[_0xc8f0('0x13')][_0xc8f0('0x15')]);return _0x532a9a(_0x349617[_0xc8f0('0x13')][_0xc8f0('0x15')]);}else{logger[_0xc8f0('0xe')](_0xc8f0('0xf'),_0x2ffe1,_0xc8f0('0x10'));_0x532a9a(_0x349617[_0xc8f0('0x16')]['message']);}})[_0xc8f0('0x17')](function(_0x4cae0f){logger[_0xc8f0('0x13')]('Condition,\x20%s,\x20%s',_0x2ffe1,_0x4cae0f);_0x5501c3(_0x4cae0f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7fec223..cda79be 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 _0x26e4=['../../config/environment','put','/:id','isAuthenticated','update','destroy','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x40798d,_0x3d4bbb){var _0x6a942=function(_0x1ae3d1){while(--_0x1ae3d1){_0x40798d['push'](_0x40798d['shift']());}};_0x6a942(++_0x3d4bbb);}(_0x26e4,0x1be));var _0x426e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x26e4[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x426e('0x0'));var path=require('path');var timeout=require(_0x426e('0x1'));var express=require('express');var router=express[_0x426e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x426e('0x3'));var config=require(_0x426e('0x4'));var controller=require('./condition.controller');router[_0x426e('0x5')](_0x426e('0x6'),auth[_0x426e('0x7')](),controller[_0x426e('0x8')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x426e('0x9')]);module['exports']=router; \ No newline at end of file +var _0x6b1d=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x6b1d,0x16b));var _0xd6b1=function(_0x3bcb7c,_0x5af870){_0x3bcb7c=_0x3bcb7c-0x0;var _0x584411=_0x6b1d[_0x3bcb7c];return _0x584411;};'use strict';var multer=require(_0xd6b1('0x0'));var util=require(_0xd6b1('0x1'));var path=require('path');var timeout=require(_0xd6b1('0x2'));var express=require(_0xd6b1('0x3'));var router=express[_0xd6b1('0x4')]();var fs_extra=require(_0xd6b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6b1('0x6'));var config=require('../../config/environment');var controller=require(_0xd6b1('0x7'));router['put'](_0xd6b1('0x8'),auth[_0xd6b1('0x9')](),controller[_0xd6b1('0xa')]);router[_0xd6b1('0xb')](_0xd6b1('0x8'),auth[_0xd6b1('0x9')](),controller[_0xd6b1('0xc')]);module[_0xd6b1('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c2df739..993e886 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 _0x4766=['exports','STRING','INTEGER','sequelize'];(function(_0x1f904e,_0x4822a9){var _0x2d2fed=function(_0x326f68){while(--_0x326f68){_0x1f904e['push'](_0x1f904e['shift']());}};_0x2d2fed(++_0x4822a9);}(_0x4766,0x87));var _0x6476=function(_0x2f2c8f,_0x1ba87b){_0x2f2c8f=_0x2f2c8f-0x0;var _0x24d6ab=_0x4766[_0x2f2c8f];return _0x24d6ab;};'use strict';var Sequelize=require(_0x6476('0x0'));module[_0x6476('0x1')]={'name':{'type':Sequelize[_0x6476('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x6476('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6476('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4af4=['sequelize','exports','STRING','name','INTEGER'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4af4,0xb9));var _0x44af=function(_0x1ff60d,_0x5a661c){_0x1ff60d=_0x1ff60d-0x0;var _0x1cb108=_0x4af4[_0x1ff60d];return _0x1cb108;};'use strict';var Sequelize=require(_0x44af('0x0'));module[_0x44af('0x1')]={'name':{'type':Sequelize[_0x44af('0x2')],'allowNull':![],'unique':_0x44af('0x3')},'OrderBy':{'type':Sequelize[_0x44af('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x44af('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 0ac9c8f..1100ee3 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x7708,0x188));var _0x8770=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0x7708[_0x4c06a3];return _0x7ff53c;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file +var _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x63a5,0x18e));var _0x563a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x63a5[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index edbfafc..ae75119 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 _0x9518=['../../config/logger','api','moment','bluebird','path','rimraf','./contactItemType.attributes','exports','ContactItemType','lodash','util'];(function(_0x345687,_0x52da5c){var _0x3f9347=function(_0x2dacea){while(--_0x2dacea){_0x345687['push'](_0x345687['shift']());}};_0x3f9347(++_0x52da5c);}(_0x9518,0xc4));var _0x8951=function(_0x3550c7,_0x234800){_0x3550c7=_0x3550c7-0x0;var _0x60520b=_0x9518[_0x3550c7];return _0x60520b;};'use strict';var _=require(_0x8951('0x0'));var util=require(_0x8951('0x1'));var logger=require(_0x8951('0x2'))(_0x8951('0x3'));var moment=require(_0x8951('0x4'));var BPromise=require(_0x8951('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8951('0x6'));var rimraf=require(_0x8951('0x7'));var config=require('../../config/environment');var attributes=require(_0x8951('0x8'));module[_0x8951('0x9')]=function(_0x131a5b,_0x377c91){return _0x131a5b['define'](_0x8951('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf23c=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','lodash'];(function(_0x4c34de,_0x2deaaa){var _0x258bfb=function(_0x331445){while(--_0x331445){_0x4c34de['push'](_0x4c34de['shift']());}};_0x258bfb(++_0x2deaaa);}(_0xf23c,0xef));var _0xcf23=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xf23c[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))(_0xcf23('0x3'));var moment=require(_0xcf23('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf23('0x5'));var rimraf=require(_0xcf23('0x6'));var config=require(_0xcf23('0x7'));var attributes=require(_0xcf23('0x8'));module['exports']=function(_0x2447ca,_0x103388){return _0x2447ca['define'](_0xcf23('0x9'),attributes,{'tableName':'tools_contact_item_types','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 051af8e..660a1b3 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 _0x8ced=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','client','http','request','then'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8ced,0xc7));var _0xd8ce=function(_0x258d86,_0x2ac3f3){_0x258d86=_0x258d86-0x0;var _0x46ff28=_0x8ced[_0x258d86];return _0x46ff28;};'use strict';var _=require(_0xd8ce('0x0'));var util=require('util');var moment=require(_0xd8ce('0x1'));var BPromise=require(_0xd8ce('0x2'));var rs=require(_0xd8ce('0x3'));var fs=require('fs');var Redis=require(_0xd8ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8ce('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8ce('0x6')][_0xd8ce('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x184141,_0x5b5dd8,_0x514e10){return new BPromise(function(_0x3b58c1,_0x4bf1cb){return client[_0xd8ce('0x8')](_0x184141,_0x514e10)[_0xd8ce('0x9')](function(_0x498394){logger[_0xd8ce('0xa')](_0xd8ce('0xb'),_0x5b5dd8,_0xd8ce('0xc'));logger[_0xd8ce('0xd')](_0xd8ce('0xe'),_0x5b5dd8,_0xd8ce('0xc'),JSON['stringify'](_0x498394));if(_0x498394[_0xd8ce('0xf')]){if(_0x498394[_0xd8ce('0xf')]['code']===0x1f4){logger[_0xd8ce('0xf')](_0xd8ce('0xb'),_0x5b5dd8,_0x498394[_0xd8ce('0xf')][_0xd8ce('0x10')]);return _0x4bf1cb(_0x498394[_0xd8ce('0xf')][_0xd8ce('0x10')]);}logger[_0xd8ce('0xf')](_0xd8ce('0xb'),_0x5b5dd8,_0x498394[_0xd8ce('0xf')]['message']);return _0x3b58c1(_0x498394[_0xd8ce('0xf')]['message']);}else{logger[_0xd8ce('0xa')](_0xd8ce('0xb'),_0x5b5dd8,_0xd8ce('0xc'));_0x3b58c1(_0x498394[_0xd8ce('0x11')]['message']);}})[_0xd8ce('0x12')](function(_0x422cd1){logger['error'](_0xd8ce('0xb'),_0x5b5dd8,_0x422cd1);_0x4bf1cb(_0x422cd1);});});} \ No newline at end of file +var _0x4bec=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0x4bec,0xdc));var _0xc4be=function(_0xb792f9,_0x332d93){_0xb792f9=_0xb792f9-0x0;var _0x51b025=_0x4bec[_0xb792f9];return _0x51b025;};'use strict';var _=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var moment=require('moment');var BPromise=require(_0xc4be('0x2'));var rs=require(_0xc4be('0x3'));var fs=require('fs');var Redis=require(_0xc4be('0x4'));var db=require(_0xc4be('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4be('0x6'))(_0xc4be('0x7'));var config=require(_0xc4be('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc4be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x429177,_0x53a290,_0x26e86d){return new BPromise(function(_0x294e6c,_0x244d25){return client[_0xc4be('0xa')](_0x429177,_0x26e86d)['then'](function(_0x350ca4){logger[_0xc4be('0xb')](_0xc4be('0xc'),_0x53a290,_0xc4be('0xd'));logger['debug'](_0xc4be('0xe'),_0x53a290,_0xc4be('0xd'),JSON[_0xc4be('0xf')](_0x350ca4));if(_0x350ca4['error']){if(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x11')]===0x1f4){logger[_0xc4be('0x10')](_0xc4be('0xc'),_0x53a290,_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);return _0x244d25(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x53a290,_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);return _0x294e6c(_0x350ca4[_0xc4be('0x10')][_0xc4be('0x12')]);}else{logger[_0xc4be('0xb')](_0xc4be('0xc'),_0x53a290,'request\x20sent');_0x294e6c(_0x350ca4[_0xc4be('0x13')][_0xc4be('0x12')]);}})[_0xc4be('0x14')](function(_0x1fec0f){logger[_0xc4be('0x10')]('ContactItemType,\x20%s,\x20%s',_0x53a290,_0x1fec0f);_0x244d25(_0x1fec0f);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b10fd30..e4c98f5 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 _0x64c4=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy'];(function(_0x502e8b,_0x121c2c){var _0x1be77c=function(_0x4c7594){while(--_0x4c7594){_0x502e8b['push'](_0x502e8b['shift']());}};_0x1be77c(++_0x121c2c);}(_0x64c4,0x157));var _0x464c=function(_0x22bab8,_0x21f0c8){_0x22bab8=_0x22bab8-0x0;var _0xf92c41=_0x64c4[_0x22bab8];return _0xf92c41;};'use strict';var multer=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var path=require(_0x464c('0x2'));var timeout=require(_0x464c('0x3'));var express=require('express');var router=express[_0x464c('0x4')]();var fs_extra=require(_0x464c('0x5'));var auth=require(_0x464c('0x6'));var interaction=require(_0x464c('0x7'));var config=require('../../config/environment');var controller=require(_0x464c('0x8'));router[_0x464c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x464c('0x9')]('/:id',auth[_0x464c('0xa')](),controller[_0x464c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x464c('0xc')](_0x464c('0xd'),auth['isAuthenticated'](),controller[_0x464c('0xe')]);router[_0x464c('0xf')]('/:id',auth[_0x464c('0xa')](),controller[_0x464c('0x10')]);module[_0x464c('0x11')]=router; \ No newline at end of file +var _0x7d23=['isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x5d4a02,_0x354e94){var _0x3adf97=function(_0x3cb8a7){while(--_0x3cb8a7){_0x5d4a02['push'](_0x5d4a02['shift']());}};_0x3adf97(++_0x354e94);}(_0x7d23,0x74));var _0x37d2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x7d23[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x37d2('0x0'));var util=require(_0x37d2('0x1'));var path=require(_0x37d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x37d2('0x3'));var router=express[_0x37d2('0x4')]();var fs_extra=require(_0x37d2('0x5'));var auth=require(_0x37d2('0x6'));var interaction=require(_0x37d2('0x7'));var config=require(_0x37d2('0x8'));var controller=require(_0x37d2('0x9'));router['get']('/',auth[_0x37d2('0xa')](),controller[_0x37d2('0xb')]);router['get'](_0x37d2('0xc'),auth[_0x37d2('0xa')](),controller[_0x37d2('0xd')]);router[_0x37d2('0xe')]('/',auth[_0x37d2('0xa')](),controller[_0x37d2('0xf')]);router['put'](_0x37d2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x37d2('0x10')]('/:id',auth[_0x37d2('0xa')](),controller[_0x37d2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 06dc8ac..f8cea37 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 _0x0713=['STRING','name'];(function(_0x1c1372,_0x1c7f1c){var _0x12ee95=function(_0x37313f){while(--_0x37313f){_0x1c1372['push'](_0x1c1372['shift']());}};_0x12ee95(++_0x1c7f1c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 6df6bab..8d87397 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 _0x24e9=['omit','createdAt','updatedAt','update','iframe','attrUrl','value','https://','custom','attrPath','attrs','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','attrWhatsappAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x5974af,_0x5dfcf6){var _0x4d0e27=function(_0x2b97c1){while(--_0x2b97c1){_0x5974af['push'](_0x5974af['shift']());}};_0x4d0e27(++_0x5dfcf6);}(_0x24e9,0x135));var _0x924e=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x24e9[_0x308213];return _0x2e1619;};'use strict';var emlformat=require(_0x924e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x924e('0x1'));var jsonpatch=require(_0x924e('0x2'));var rp=require(_0x924e('0x3'));var moment=require(_0x924e('0x4'));var BPromise=require(_0x924e('0x5'));var Mustache=require(_0x924e('0x6'));var util=require('util');var path=require(_0x924e('0x7'));var sox=require(_0x924e('0x8'));var csv=require(_0x924e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x924e('0xa'));var _=require(_0x924e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x924e('0xc'));var deskjs=require(_0x924e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x924e('0xe'));var Papa=require('papaparse');var Redis=require(_0x924e('0xf'));var authService=require(_0x924e('0x10'));var qs=require(_0x924e('0x11'));var as=require(_0x924e('0x12'));var hardwareService=require(_0x924e('0x13'));var logger=require(_0x924e('0x14'))(_0x924e('0x15'));var utils=require('../../config/utils');var config=require(_0x924e('0x16'));var licenseUtil=require(_0x924e('0x17'));var db=require(_0x924e('0x18'))['db'];config[_0x924e('0x19')]=_[_0x924e('0x1a')](config[_0x924e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x924e('0x1b'))(new Redis(config[_0x924e('0x19')]));require(_0x924e('0x1c'))[_0x924e('0x1d')](socket);function respondWithStatusCode(_0x1b2357,_0x9d5545){_0x9d5545=_0x9d5545||0xcc;return function(_0x3e95b8){if(_0x3e95b8){return _0x1b2357[_0x924e('0x1e')](_0x9d5545);}return _0x1b2357[_0x924e('0x1f')](_0x9d5545)[_0x924e('0x20')]();};}function respondWithResult(_0x5e7151,_0x45b6b7){_0x45b6b7=_0x45b6b7||0xc8;return function(_0x289518){if(_0x289518){return _0x5e7151['status'](_0x45b6b7)[_0x924e('0x21')](_0x289518);}};}function respondWithFilteredResult(_0x56a080,_0x37a3be){return function(_0x44a9f5){if(_0x44a9f5){var _0x53ed89=typeof _0x37a3be[_0x924e('0x22')]==='undefined'&&typeof _0x37a3be[_0x924e('0x23')]===_0x924e('0x24');var _0x19393f=_0x44a9f5[_0x924e('0x25')];var _0x1aeb72=_0x53ed89?0x0:_0x37a3be[_0x924e('0x22')];var _0x29e045=_0x53ed89?_0x44a9f5[_0x924e('0x25')]:_0x37a3be[_0x924e('0x22')]+_0x37a3be[_0x924e('0x23')];var _0x853abd;if(_0x29e045>=_0x19393f){_0x29e045=_0x19393f;_0x853abd=0xc8;}else{_0x853abd=0xce;}_0x56a080[_0x924e('0x1f')](_0x853abd);return _0x56a080[_0x924e('0x26')](_0x924e('0x27'),_0x1aeb72+'-'+_0x29e045+'/'+_0x19393f)[_0x924e('0x21')](_0x44a9f5);}return null;};}function patchUpdates(_0x5306bb){return function(_0x52abe3){try{jsonpatch[_0x924e('0x28')](_0x52abe3,_0x5306bb,!![]);}catch(_0x1f8e94){return BPromise['reject'](_0x1f8e94);}return _0x52abe3['save']();};}function saveUpdates(_0x48d29c,_0x18d62d){return function(_0x17d4ef){if(_0x17d4ef){return _0x17d4ef['update'](_0x48d29c)[_0x924e('0x29')](function(_0x1393ef){return _0x1393ef;});}return null;};}function removeEntity(_0x7756ed,_0x5786c2){return function(_0x2a0bae){if(_0x2a0bae){return _0x2a0bae[_0x924e('0x2a')]()['then'](function(){var _0x4d79ec=_0x2a0bae[_0x924e('0x2b')]({'plain':!![]});var _0x4a2a9f=_0x924e('0x2c');return db[_0x924e('0x2d')][_0x924e('0x2a')]({'where':{'type':_0x4a2a9f,'resourceId':_0x4d79ec['id']}})[_0x924e('0x29')](function(){return _0x2a0bae;});})[_0x924e('0x29')](function(){_0x7756ed['status'](0xcc)[_0x924e('0x20')]();});}};}function handleEntityNotFound(_0x48d6c1,_0x64731c){return function(_0x36e850){if(!_0x36e850){_0x48d6c1[_0x924e('0x1e')](0x194);}return _0x36e850;};}function handleError(_0x93274c,_0x1545c1){_0x1545c1=_0x1545c1||0x1f4;return function(_0x49be20){logger[_0x924e('0x2e')](_0x49be20[_0x924e('0x2f')]);if(_0x49be20[_0x924e('0x30')]){delete _0x49be20[_0x924e('0x30')];}_0x93274c[_0x924e('0x1f')](_0x1545c1)[_0x924e('0x31')](_0x49be20);};}exports[_0x924e('0x32')]=function(_0xc60a83,_0x5a8861){var _0x5ca035={},_0x4318f3={},_0x47e983={'count':0x0,'rows':[]};var _0x1e6c96=_[_0x924e('0x33')](db[_0x924e('0x34')][_0x924e('0x35')],function(_0x4f3741){return{'name':_0x4f3741[_0x924e('0x36')],'type':_0x4f3741[_0x924e('0x37')]['key']};});_0x4318f3[_0x924e('0x38')]=_[_0x924e('0x33')](_0x1e6c96,'name');_0x4318f3[_0x924e('0x39')]=_['keys'](_0xc60a83[_0x924e('0x39')]);_0x4318f3[_0x924e('0x3a')]=_['intersection'](_0x4318f3[_0x924e('0x38')],_0x4318f3['query']);_0x5ca035[_0x924e('0x3b')]=_[_0x924e('0x3c')](_0x4318f3[_0x924e('0x38')],qs[_0x924e('0x3d')](_0xc60a83[_0x924e('0x39')]['fields']));_0x5ca035[_0x924e('0x3b')]=_0x5ca035['attributes'][_0x924e('0x3e')]?_0x5ca035[_0x924e('0x3b')]:_0x4318f3[_0x924e('0x38')];if(!_0xc60a83['query'][_0x924e('0x3f')]('nolimit')){_0x5ca035[_0x924e('0x23')]=qs[_0x924e('0x23')](_0xc60a83['query'][_0x924e('0x23')]);_0x5ca035[_0x924e('0x22')]=qs['offset'](_0xc60a83[_0x924e('0x39')][_0x924e('0x22')]);}_0x5ca035[_0x924e('0x40')]=qs[_0x924e('0x41')](_0xc60a83[_0x924e('0x39')][_0x924e('0x41')]);_0x5ca035[_0x924e('0x42')]=qs[_0x924e('0x3a')](_[_0x924e('0x43')](_0xc60a83[_0x924e('0x39')],_0x4318f3[_0x924e('0x3a')]),_0x1e6c96);if(_0xc60a83[_0x924e('0x39')][_0x924e('0x44')]){_0x5ca035[_0x924e('0x42')]=_[_0x924e('0x45')](_0x5ca035[_0x924e('0x42')],{'$or':_['map'](_0x1e6c96,function(_0x3a7f80){if(_0x3a7f80['type']!==_0x924e('0x46')){var _0x507c8a={};_0x507c8a[_0x3a7f80[_0x924e('0x30')]]={'$like':'%'+_0xc60a83[_0x924e('0x39')]['filter']+'%'};return _0x507c8a;}})});}_0x5ca035=_[_0x924e('0x45')]({},_0x5ca035,_0xc60a83[_0x924e('0x47')]);var _0x150530={'where':_0x5ca035[_0x924e('0x42')]};return db['Dashboard'][_0x924e('0x25')](_0x150530)[_0x924e('0x29')](function(_0x3466a7){_0x47e983[_0x924e('0x25')]=_0x3466a7;if(_0xc60a83['query'][_0x924e('0x48')]){_0x5ca035[_0x924e('0x49')]=[{'all':!![]}];}return db[_0x924e('0x34')][_0x924e('0x4a')](_0x5ca035);})[_0x924e('0x29')](function(_0x5b7f7d){_0x47e983['rows']=_0x5b7f7d;return _0x47e983;})['then'](respondWithFilteredResult(_0x5a8861,_0x5ca035))[_0x924e('0x4b')](handleError(_0x5a8861,null));};exports[_0x924e('0x4c')]=function(_0x5f3db3,_0x27f24d){var _0x3be4db={'raw':![],'where':{'id':_0x5f3db3[_0x924e('0x4d')]['id']}},_0x5cc2b7={};_0x5cc2b7[_0x924e('0x38')]=_[_0x924e('0x4e')](db[_0x924e('0x34')][_0x924e('0x35')]);_0x5cc2b7[_0x924e('0x39')]=_['keys'](_0x5f3db3[_0x924e('0x39')]);_0x5cc2b7[_0x924e('0x3a')]=_[_0x924e('0x3c')](_0x5cc2b7[_0x924e('0x38')],_0x5cc2b7[_0x924e('0x39')]);_0x3be4db['attributes']=_[_0x924e('0x3c')](_0x5cc2b7['model'],qs[_0x924e('0x3d')](_0x5f3db3['query']['fields']));_0x3be4db[_0x924e('0x3b')]=_0x3be4db[_0x924e('0x3b')][_0x924e('0x3e')]?_0x3be4db[_0x924e('0x3b')]:_0x5cc2b7[_0x924e('0x38')];if(_0x5f3db3[_0x924e('0x39')][_0x924e('0x48')]){_0x3be4db[_0x924e('0x49')]=[{'all':!![]}];}_0x3be4db=_[_0x924e('0x45')]({},_0x3be4db,_0x5f3db3[_0x924e('0x47')]);return db[_0x924e('0x34')][_0x924e('0x4f')](_0x3be4db)[_0x924e('0x29')](handleEntityNotFound(_0x27f24d,null))[_0x924e('0x29')](respondWithResult(_0x27f24d,null))[_0x924e('0x4b')](handleError(_0x27f24d,null));};exports['create']=function(_0x195846,_0x1a966a){return db[_0x924e('0x34')][_0x924e('0x50')](_0x195846[_0x924e('0x51')],{})[_0x924e('0x29')](function(_0xb2aed2){var _0x168a8a=_0x195846[_0x924e('0x52')][_0x924e('0x2b')]({'plain':!![]});if(!_0x168a8a)throw new Error(_0x924e('0x53'));if(_0x168a8a[_0x924e('0x54')]===_0x924e('0x52')){var _0x4fabf0=_0xb2aed2[_0x924e('0x2b')]({'plain':!![]});var _0x1a162b=_0x924e('0x2c');return db[_0x924e('0x55')][_0x924e('0x4f')]({'where':{'name':_0x1a162b,'userProfileId':_0x168a8a[_0x924e('0x56')]},'raw':!![]})[_0x924e('0x29')](function(_0x1ef39e){if(_0x1ef39e&&_0x1ef39e[_0x924e('0x57')]===0x0){return db[_0x924e('0x2d')][_0x924e('0x50')]({'name':_0x4fabf0['name'],'resourceId':_0x4fabf0['id'],'type':_0x1ef39e[_0x924e('0x30')],'sectionId':_0x1ef39e['id']},{})['then'](function(){return _0xb2aed2;});}else{return _0xb2aed2;}})[_0x924e('0x4b')](function(_0x4f1fcc){logger[_0x924e('0x2e')](_0x924e('0x58'),_0x4f1fcc);throw _0x4f1fcc;});}return _0xb2aed2;})[_0x924e('0x29')](respondWithResult(_0x1a966a,0xc9))['catch'](handleError(_0x1a966a,null));};exports[_0x924e('0x59')]=function(_0x383f95,_0x48b21e){var _0x271bcd={'where':{'id':_0x383f95[_0x924e('0x4d')]['id']}},_0x26020a={};_0x26020a[_0x924e('0x38')]=_[_0x924e('0x4e')](db['Dashboard'][_0x924e('0x35')]);_0x271bcd['attributes']=_['intersection'](_0x26020a[_0x924e('0x38')],qs[_0x924e('0x3d')](_0x383f95[_0x924e('0x39')]['fields']));_0x271bcd[_0x924e('0x3b')]=_0x271bcd[_0x924e('0x3b')][_0x924e('0x3e')]?_0x271bcd['attributes']:_0x26020a[_0x924e('0x38')];if(_0x383f95[_0x924e('0x39')][_0x924e('0x48')]){_0x271bcd['include']=[{'all':!![]}];}_0x271bcd=_[_0x924e('0x45')]({},_0x271bcd,_0x383f95[_0x924e('0x47')]);return db[_0x924e('0x34')][_0x924e('0x4f')](_0x271bcd)[_0x924e('0x29')](handleEntityNotFound(_0x48b21e,null))['then'](function(_0x2c99bd){if(_0x2c99bd){var _0x670ca2=_0x2c99bd['get']({'plain':!![]});_0x670ca2=qs[_0x924e('0x5a')](_0x670ca2,['id',_0x924e('0x5b'),_0x924e('0x5c')]);_0x383f95[_0x924e('0x51')]=_[_0x924e('0x5a')](_0x383f95[_0x924e('0x51')],['id','createdAt','updatedAt']);return db[_0x924e('0x34')][_0x924e('0x50')](_['merge'](_0x670ca2,_0x383f95[_0x924e('0x51')]),{'include':_0x383f95[_0x924e('0x39')][_0x924e('0x48')]?[{'all':!![]}]:undefined})[_0x924e('0x29')](function(_0x5c7ce8){var _0x53472d=_0x383f95[_0x924e('0x52')][_0x924e('0x2b')]({'plain':!![]});if(!_0x53472d)throw new Error(_0x924e('0x53'));if(_0x53472d[_0x924e('0x54')]===_0x924e('0x52')){var _0x500b97=_0x5c7ce8[_0x924e('0x2b')]({'plain':!![]});var _0x285235=_0x924e('0x2c');return db[_0x924e('0x55')]['find']({'where':{'name':_0x285235,'userProfileId':_0x53472d[_0x924e('0x56')]},'raw':!![]})[_0x924e('0x29')](function(_0x5a99f9){if(_0x5a99f9&&_0x5a99f9[_0x924e('0x57')]===0x0){return db[_0x924e('0x2d')][_0x924e('0x50')]({'name':_0x500b97[_0x924e('0x30')],'resourceId':_0x500b97['id'],'type':_0x5a99f9[_0x924e('0x30')],'sectionId':_0x5a99f9['id']},{})[_0x924e('0x29')](function(){return _0x5c7ce8;});}else{return _0x5c7ce8;}})[_0x924e('0x4b')](function(_0x1d1ed0){logger[_0x924e('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d1ed0);throw _0x1d1ed0;});}return _0x5c7ce8;});}})[_0x924e('0x29')](respondWithResult(_0x48b21e,0xc9))[_0x924e('0x4b')](handleError(_0x48b21e,null));};exports[_0x924e('0x5d')]=function(_0x1eb532,_0x478a78){if(_0x1eb532['body']['id']){delete _0x1eb532[_0x924e('0x51')]['id'];}return db[_0x924e('0x34')]['find']({'where':{'id':_0x1eb532[_0x924e('0x4d')]['id']}})[_0x924e('0x29')](handleEntityNotFound(_0x478a78,null))[_0x924e('0x29')](saveUpdates(_0x1eb532['body'],null))[_0x924e('0x29')](respondWithResult(_0x478a78,null))[_0x924e('0x4b')](handleError(_0x478a78,null));};exports['destroy']=function(_0x477bd4,_0x29af56){return db[_0x924e('0x34')]['find']({'where':{'id':_0x477bd4[_0x924e('0x4d')]['id']}})[_0x924e('0x29')](handleEntityNotFound(_0x29af56,null))[_0x924e('0x29')](removeEntity(_0x29af56,null))[_0x924e('0x4b')](handleError(_0x29af56,null));};function widgetAttributes(_0xda2979){try{switch(_0xda2979[_0x924e('0x37')]){case _0x924e('0x5e'):return[{'name':_0x924e('0x5f'),'value':_0xda2979[_0x924e('0x5f')]||(_0xda2979['attrs']&&_0xda2979['attrs'][0x0]?_0xda2979['attrs'][0x0][_0x924e('0x60')]:undefined)||_0x924e('0x61')}];case _0x924e('0x62'):return[{'name':_0x924e('0x63'),'value':_0xda2979[_0x924e('0x63')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x0]?_0xda2979[_0x924e('0x64')][0x0][_0x924e('0x60')]:undefined)||''}];case _0x924e('0x65'):return[{'name':'attrHourFormat','value':_0xda2979[_0x924e('0x66')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x0]?_0xda2979[_0x924e('0x64')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x924e('0x67'),'value':_0xda2979[_0x924e('0x67')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979['attrs'][0x1]?_0xda2979[_0x924e('0x64')][0x1][_0x924e('0x60')]:undefined)||_0x924e('0x68')},{'name':_0x924e('0x69'),'value':_0xda2979[_0x924e('0x69')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x2]?_0xda2979[_0x924e('0x64')][0x2][_0x924e('0x60')]:undefined)||0xc}];case _0x924e('0x6a'):return[{'name':_0x924e('0x6b'),'value':_0xda2979[_0x924e('0x6b')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x0]?_0xda2979[_0x924e('0x64')][0x0][_0x924e('0x60')]:undefined)||'total'},{'name':_0x924e('0x6c'),'value':_0xda2979['attrVoiceQueues']||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x1]?_0xda2979[_0x924e('0x64')][0x1][_0x924e('0x60')]:undefined)||[]},{'name':_0x924e('0x69'),'value':_0xda2979['attrFontSize']||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x2]?_0xda2979[_0x924e('0x64')][0x2][_0x924e('0x60')]:undefined)||0x14},{'name':_0x924e('0x6d'),'value':_0xda2979['attrChannel']||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x3]?_0xda2979[_0x924e('0x64')][0x3][_0x924e('0x60')]:undefined)||_0x924e('0x6e')},{'name':_0x924e('0x6f'),'value':_0xda2979[_0x924e('0x6f')]||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x4]?_0xda2979[_0x924e('0x64')][0x4]['value']:undefined)||''},{'name':_0x924e('0x70'),'value':_0xda2979[_0x924e('0x70')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x5]?_0xda2979[_0x924e('0x64')][0x5][_0x924e('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xda2979[_0x924e('0x71')]||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x6]?_0xda2979[_0x924e('0x64')][0x6][_0x924e('0x60')]:undefined)||''},{'name':_0x924e('0x72'),'value':_0xda2979[_0x924e('0x72')]||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x7]?_0xda2979[_0x924e('0x64')][0x7][_0x924e('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xda2979['attrWhatsappAccounts']||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x8]?_0xda2979[_0x924e('0x64')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xda2979[_0x924e('0x73')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x9]?_0xda2979[_0x924e('0x64')][0x9][_0x924e('0x60')]:undefined)||''}];case _0x924e('0x74'):case _0x924e('0x75'):return[{'name':_0x924e('0x76'),'value':_0xda2979[_0x924e('0x76')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979['attrs'][0x0]?_0xda2979[_0x924e('0x64')][0x0]['value']:undefined)||_0x924e('0x77')},{'name':'attrSerie2','value':_0xda2979['attrSerie2']||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x1]?_0xda2979[_0x924e('0x64')][0x1]['value']:undefined)||null},{'name':_0x924e('0x78'),'value':_0xda2979[_0x924e('0x78')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x2]?_0xda2979[_0x924e('0x64')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xda2979['attrVoiceQueues']||(_0xda2979[_0x924e('0x64')]&&_0xda2979['attrs'][0x3]?_0xda2979['attrs'][0x3][_0x924e('0x60')]:undefined)||[]},{'name':_0x924e('0x6d'),'value':_0xda2979[_0x924e('0x6d')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x4]?_0xda2979[_0x924e('0x64')][0x4][_0x924e('0x60')]:undefined)||_0x924e('0x6e')},{'name':_0x924e('0x6f'),'value':_0xda2979[_0x924e('0x6f')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979['attrs'][0x5]?_0xda2979[_0x924e('0x64')][0x5][_0x924e('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xda2979[_0x924e('0x70')]||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x6]?_0xda2979['attrs'][0x6][_0x924e('0x60')]:undefined)||''},{'name':_0x924e('0x71'),'value':_0xda2979['attrSmsAccounts']||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x7]?_0xda2979[_0x924e('0x64')][0x7][_0x924e('0x60')]:undefined)||''},{'name':_0x924e('0x72'),'value':_0xda2979[_0x924e('0x72')]||(_0xda2979['attrs']&&_0xda2979[_0x924e('0x64')][0x8]?_0xda2979[_0x924e('0x64')][0x8][_0x924e('0x60')]:undefined)||''},{'name':_0x924e('0x79'),'value':_0xda2979[_0x924e('0x79')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x9]?_0xda2979[_0x924e('0x64')][0x9][_0x924e('0x60')]:undefined)||''},{'name':_0x924e('0x73'),'value':_0xda2979[_0x924e('0x73')]||(_0xda2979['attrs']&&_0xda2979['attrs'][0xa]?_0xda2979[_0x924e('0x64')][0xa][_0x924e('0x60')]:undefined)||''}];case _0x924e('0x7a'):return[{'name':_0x924e('0x7b'),'type':_0xda2979['reportType']||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x0]?_0xda2979[_0x924e('0x64')][0x0][_0x924e('0x37')]:undefined)||null,'value':_0xda2979[_0x924e('0x7b')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979[_0x924e('0x64')][0x0]?_0xda2979['attrs'][0x0][_0x924e('0x60')]:undefined)||null},{'name':_0x924e('0x7c'),'value':_0xda2979[_0x924e('0x7c')]||(_0xda2979[_0x924e('0x64')]&&_0xda2979['attrs'][0x1]?_0xda2979[_0x924e('0x64')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1a790a){logger[_0x924e('0x2e')](_0x924e('0x7d'),JSON[_0x924e('0x7e')](_0x1a790a));return[];}}exports[_0x924e('0x7f')]=function(_0x51238a,_0x1d00e9,_0x388f42){if(_0x51238a[_0x924e('0x51')]['id']){delete _0x51238a[_0x924e('0x51')]['id'];}return db[_0x924e('0x34')]['find']({'where':{'id':_0x51238a[_0x924e('0x4d')]['id']}})[_0x924e('0x29')](handleEntityNotFound(_0x1d00e9,null))[_0x924e('0x29')](function(_0x396f3a){if(_0x396f3a){_0x51238a[_0x924e('0x51')][_0x924e('0x80')]=_0x396f3a['id'];_0x51238a['body'][_0x924e('0x64')]=widgetAttributes(_0x51238a[_0x924e('0x51')]);return db[_0x924e('0x81')][_0x924e('0x50')](_0x51238a[_0x924e('0x51')]);}})['then'](respondWithResult(_0x1d00e9,null))[_0x924e('0x4b')](handleError(_0x1d00e9,null));};exports[_0x924e('0x82')]=function(_0x1d606b,_0x165674,_0x40d909){var _0x308afb={};var _0x2b52ed={};var _0x4df120;var _0x55452c;return db[_0x924e('0x34')][_0x924e('0x83')]({'where':{'id':_0x1d606b[_0x924e('0x4d')]['id']}})[_0x924e('0x29')](handleEntityNotFound(_0x165674,null))[_0x924e('0x29')](function(_0x5b2910){if(_0x5b2910){_0x4df120=_0x5b2910;_0x2b52ed['model']=_['keys'](db[_0x924e('0x81')][_0x924e('0x35')]);_0x2b52ed[_0x924e('0x39')]=_['keys'](_0x1d606b[_0x924e('0x39')]);_0x2b52ed[_0x924e('0x3a')]=_['intersection'](_0x2b52ed[_0x924e('0x38')],_0x2b52ed['query']);_0x308afb[_0x924e('0x3b')]=_[_0x924e('0x3c')](_0x2b52ed['model'],qs[_0x924e('0x3d')](_0x1d606b[_0x924e('0x39')][_0x924e('0x3d')]));_0x308afb[_0x924e('0x3b')]=_0x308afb[_0x924e('0x3b')]['length']?_0x308afb[_0x924e('0x3b')]:_0x2b52ed[_0x924e('0x38')];_0x308afb[_0x924e('0x40')]=qs['sort'](_0x1d606b['query'][_0x924e('0x41')]);_0x308afb[_0x924e('0x42')]=qs['filters'](_[_0x924e('0x43')](_0x1d606b[_0x924e('0x39')],_0x2b52ed[_0x924e('0x3a')]));if(_0x1d606b[_0x924e('0x39')]['filter']){_0x308afb[_0x924e('0x42')]=_['merge'](_0x308afb[_0x924e('0x42')],{'$or':_[_0x924e('0x33')](_0x308afb[_0x924e('0x3b')],function(_0x663894){var _0x39155c={};_0x39155c[_0x663894]={'$like':'%'+_0x1d606b[_0x924e('0x39')][_0x924e('0x44')]+'%'};return _0x39155c;})});}_0x308afb=_[_0x924e('0x45')]({},_0x308afb,_0x1d606b[_0x924e('0x47')]);return _0x4df120['getItems'](_0x308afb);}})[_0x924e('0x29')](function(_0x41440a){if(_0x41440a){_0x55452c=_0x41440a[_0x924e('0x3e')];if(!_0x1d606b[_0x924e('0x39')]['hasOwnProperty'](_0x924e('0x84'))){_0x308afb[_0x924e('0x23')]=qs[_0x924e('0x23')](_0x1d606b['query'][_0x924e('0x23')]);_0x308afb[_0x924e('0x22')]=qs[_0x924e('0x22')](_0x1d606b[_0x924e('0x39')][_0x924e('0x22')]);}return _0x4df120[_0x924e('0x82')](_0x308afb);}})[_0x924e('0x29')](function(_0x17fab9){if(_0x17fab9){return _0x17fab9?{'count':_0x55452c,'rows':_0x17fab9}:null;}})['then'](respondWithResult(_0x165674,null))['catch'](handleError(_0x165674,null));}; \ No newline at end of file +var _0x1b12=['attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','then','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','https://','custom'];(function(_0x1eb7bd,_0x2e23e0){var _0x3068e1=function(_0x9eb2c3){while(--_0x9eb2c3){_0x1eb7bd['push'](_0x1eb7bd['shift']());}};_0x3068e1(++_0x2e23e0);}(_0x1b12,0xa3));var _0x21b1=function(_0x25113d,_0x1f3509){_0x25113d=_0x25113d-0x0;var _0x48fd45=_0x1b12[_0x25113d];return _0x48fd45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21b1('0x1'));var rp=require(_0x21b1('0x2'));var moment=require(_0x21b1('0x3'));var BPromise=require(_0x21b1('0x4'));var Mustache=require('mustache');var util=require(_0x21b1('0x5'));var path=require(_0x21b1('0x6'));var sox=require(_0x21b1('0x7'));var csv=require(_0x21b1('0x8'));var ejs=require(_0x21b1('0x9'));var fs=require('fs');var fs_extra=require(_0x21b1('0xa'));var _=require(_0x21b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21b1('0xc'));var deskjs=require(_0x21b1('0xd'));var toCsv=require(_0x21b1('0x8'));var querystring=require(_0x21b1('0xe'));var Papa=require(_0x21b1('0xf'));var Redis=require(_0x21b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x21b1('0x11'));var as=require(_0x21b1('0x12'));var hardwareService=require(_0x21b1('0x13'));var logger=require('../../config/logger')(_0x21b1('0x14'));var utils=require(_0x21b1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x21b1('0x16'));var db=require('../../mysqldb')['db'];config[_0x21b1('0x17')]=_[_0x21b1('0x18')](config[_0x21b1('0x17')],{'host':_0x21b1('0x19'),'port':0x18eb});var socket=require(_0x21b1('0x1a'))(new Redis(config[_0x21b1('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x42a600,_0x2dd43d){_0x2dd43d=_0x2dd43d||0xcc;return function(_0x4b7036){if(_0x4b7036){return _0x42a600[_0x21b1('0x1b')](_0x2dd43d);}return _0x42a600[_0x21b1('0x1c')](_0x2dd43d)[_0x21b1('0x1d')]();};}function respondWithResult(_0x4c50c4,_0x51e919){_0x51e919=_0x51e919||0xc8;return function(_0x398d40){if(_0x398d40){return _0x4c50c4[_0x21b1('0x1c')](_0x51e919)[_0x21b1('0x1e')](_0x398d40);}};}function respondWithFilteredResult(_0x25b612,_0x49d90c){return function(_0x2891d4){if(_0x2891d4){var _0x3a658e=typeof _0x49d90c[_0x21b1('0x1f')]===_0x21b1('0x20')&&typeof _0x49d90c[_0x21b1('0x21')]===_0x21b1('0x20');var _0x42cb4a=_0x2891d4['count'];var _0x31d0fc=_0x3a658e?0x0:_0x49d90c[_0x21b1('0x1f')];var _0x342fc8=_0x3a658e?_0x2891d4[_0x21b1('0x22')]:_0x49d90c[_0x21b1('0x1f')]+_0x49d90c[_0x21b1('0x21')];var _0x347e05;if(_0x342fc8>=_0x42cb4a){_0x342fc8=_0x42cb4a;_0x347e05=0xc8;}else{_0x347e05=0xce;}_0x25b612['status'](_0x347e05);return _0x25b612[_0x21b1('0x23')](_0x21b1('0x24'),_0x31d0fc+'-'+_0x342fc8+'/'+_0x42cb4a)['json'](_0x2891d4);}return null;};}function patchUpdates(_0x4bdad1){return function(_0x6d7959){try{jsonpatch[_0x21b1('0x25')](_0x6d7959,_0x4bdad1,!![]);}catch(_0x466eb9){return BPromise[_0x21b1('0x26')](_0x466eb9);}return _0x6d7959[_0x21b1('0x27')]();};}function saveUpdates(_0x5c4156,_0x1bf7d6){return function(_0x577f71){if(_0x577f71){return _0x577f71[_0x21b1('0x28')](_0x5c4156)['then'](function(_0x5578aa){return _0x5578aa;});}return null;};}function removeEntity(_0x2dbfdd,_0x2b2aeb){return function(_0xd497f1){if(_0xd497f1){return _0xd497f1[_0x21b1('0x29')]()['then'](function(){var _0x49df07=_0xd497f1[_0x21b1('0x2a')]({'plain':!![]});var _0x5cddb2='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x5cddb2,'resourceId':_0x49df07['id']}})[_0x21b1('0x2b')](function(){return _0xd497f1;});})[_0x21b1('0x2b')](function(){_0x2dbfdd[_0x21b1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5c28,_0x1c16b5){return function(_0x4cd122){if(!_0x4cd122){_0x3a5c28['sendStatus'](0x194);}return _0x4cd122;};}function handleError(_0xdaa036,_0x515b97){_0x515b97=_0x515b97||0x1f4;return function(_0xb7b6d3){logger[_0x21b1('0x2c')](_0xb7b6d3['stack']);if(_0xb7b6d3['name']){delete _0xb7b6d3[_0x21b1('0x2d')];}_0xdaa036[_0x21b1('0x1c')](_0x515b97)[_0x21b1('0x2e')](_0xb7b6d3);};}exports[_0x21b1('0x2f')]=function(_0x2d3f9b,_0x242d68){var _0x110d48={},_0x1074f8={},_0x3f8014={'count':0x0,'rows':[]};var _0x41563e=_[_0x21b1('0x30')](db[_0x21b1('0x31')]['rawAttributes'],function(_0x32b985){return{'name':_0x32b985[_0x21b1('0x32')],'type':_0x32b985[_0x21b1('0x33')][_0x21b1('0x34')]};});_0x1074f8[_0x21b1('0x35')]=_['map'](_0x41563e,_0x21b1('0x2d'));_0x1074f8[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x2d3f9b[_0x21b1('0x36')]);_0x1074f8[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x1074f8['model'],_0x1074f8[_0x21b1('0x36')]);_0x110d48['attributes']=_[_0x21b1('0x39')](_0x1074f8[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x2d3f9b[_0x21b1('0x36')]['fields']));_0x110d48[_0x21b1('0x3b')]=_0x110d48[_0x21b1('0x3b')][_0x21b1('0x3c')]?_0x110d48[_0x21b1('0x3b')]:_0x1074f8[_0x21b1('0x35')];if(!_0x2d3f9b['query']['hasOwnProperty'](_0x21b1('0x3d'))){_0x110d48['limit']=qs[_0x21b1('0x21')](_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x21')]);_0x110d48[_0x21b1('0x1f')]=qs[_0x21b1('0x1f')](_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x1f')]);}_0x110d48[_0x21b1('0x3e')]=qs[_0x21b1('0x3f')](_0x2d3f9b[_0x21b1('0x36')]['sort']);_0x110d48[_0x21b1('0x40')]=qs[_0x21b1('0x38')](_[_0x21b1('0x41')](_0x2d3f9b[_0x21b1('0x36')],_0x1074f8['filters']),_0x41563e);if(_0x2d3f9b['query'][_0x21b1('0x42')]){_0x110d48['where']=_[_0x21b1('0x43')](_0x110d48[_0x21b1('0x40')],{'$or':_[_0x21b1('0x30')](_0x41563e,function(_0xac77f5){if(_0xac77f5['type']!==_0x21b1('0x44')){var _0x2e7946={};_0x2e7946[_0xac77f5['name']]={'$like':'%'+_0x2d3f9b[_0x21b1('0x36')]['filter']+'%'};return _0x2e7946;}})});}_0x110d48=_['merge']({},_0x110d48,_0x2d3f9b[_0x21b1('0x45')]);var _0x5af826={'where':_0x110d48['where']};return db[_0x21b1('0x31')][_0x21b1('0x22')](_0x5af826)[_0x21b1('0x2b')](function(_0x41143e){_0x3f8014[_0x21b1('0x22')]=_0x41143e;if(_0x2d3f9b[_0x21b1('0x36')][_0x21b1('0x46')]){_0x110d48[_0x21b1('0x47')]=[{'all':!![]}];}return db[_0x21b1('0x31')][_0x21b1('0x48')](_0x110d48);})[_0x21b1('0x2b')](function(_0x5a0771){_0x3f8014[_0x21b1('0x49')]=_0x5a0771;return _0x3f8014;})[_0x21b1('0x2b')](respondWithFilteredResult(_0x242d68,_0x110d48))[_0x21b1('0x4a')](handleError(_0x242d68,null));};exports['show']=function(_0x23e5ae,_0x5d69eb){var _0x3868d4={'raw':![],'where':{'id':_0x23e5ae[_0x21b1('0x4b')]['id']}},_0x3559a8={};_0x3559a8[_0x21b1('0x35')]=_[_0x21b1('0x37')](db[_0x21b1('0x31')][_0x21b1('0x4c')]);_0x3559a8[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x23e5ae['query']);_0x3559a8['filters']=_[_0x21b1('0x39')](_0x3559a8['model'],_0x3559a8[_0x21b1('0x36')]);_0x3868d4['attributes']=_[_0x21b1('0x39')](_0x3559a8['model'],qs['fields'](_0x23e5ae[_0x21b1('0x36')][_0x21b1('0x3a')]));_0x3868d4['attributes']=_0x3868d4[_0x21b1('0x3b')][_0x21b1('0x3c')]?_0x3868d4['attributes']:_0x3559a8[_0x21b1('0x35')];if(_0x23e5ae[_0x21b1('0x36')][_0x21b1('0x46')]){_0x3868d4['include']=[{'all':!![]}];}_0x3868d4=_['merge']({},_0x3868d4,_0x23e5ae[_0x21b1('0x45')]);return db[_0x21b1('0x31')][_0x21b1('0x4d')](_0x3868d4)['then'](handleEntityNotFound(_0x5d69eb,null))['then'](respondWithResult(_0x5d69eb,null))[_0x21b1('0x4a')](handleError(_0x5d69eb,null));};exports[_0x21b1('0x4e')]=function(_0x43a9d7,_0x3702d2){return db[_0x21b1('0x31')][_0x21b1('0x4e')](_0x43a9d7[_0x21b1('0x4f')],{})[_0x21b1('0x2b')](function(_0x23c2e2){var _0x36856e=_0x43a9d7[_0x21b1('0x50')][_0x21b1('0x2a')]({'plain':!![]});if(!_0x36856e)throw new Error(_0x21b1('0x51'));if(_0x36856e[_0x21b1('0x52')]===_0x21b1('0x50')){var _0x2da509=_0x23c2e2[_0x21b1('0x2a')]({'plain':!![]});var _0x5083b4=_0x21b1('0x53');return db['UserProfileSection'][_0x21b1('0x4d')]({'where':{'name':_0x5083b4,'userProfileId':_0x36856e['userProfileId']},'raw':!![]})[_0x21b1('0x2b')](function(_0x3f7a6f){if(_0x3f7a6f&&_0x3f7a6f['autoAssociation']===0x0){return db[_0x21b1('0x54')][_0x21b1('0x4e')]({'name':_0x2da509['name'],'resourceId':_0x2da509['id'],'type':_0x3f7a6f['name'],'sectionId':_0x3f7a6f['id']},{})[_0x21b1('0x2b')](function(){return _0x23c2e2;});}else{return _0x23c2e2;}})[_0x21b1('0x4a')](function(_0x7ba88d){logger[_0x21b1('0x2c')](_0x21b1('0x55'),_0x7ba88d);throw _0x7ba88d;});}return _0x23c2e2;})[_0x21b1('0x2b')](respondWithResult(_0x3702d2,0xc9))[_0x21b1('0x4a')](handleError(_0x3702d2,null));};exports[_0x21b1('0x56')]=function(_0x180291,_0x397b57){var _0x2db53a={'where':{'id':_0x180291[_0x21b1('0x4b')]['id']}},_0x1b8a88={};_0x1b8a88['model']=_['keys'](db[_0x21b1('0x31')][_0x21b1('0x4c')]);_0x2db53a[_0x21b1('0x3b')]=_[_0x21b1('0x39')](_0x1b8a88[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x180291[_0x21b1('0x36')][_0x21b1('0x3a')]));_0x2db53a['attributes']=_0x2db53a['attributes'][_0x21b1('0x3c')]?_0x2db53a['attributes']:_0x1b8a88[_0x21b1('0x35')];if(_0x180291[_0x21b1('0x36')][_0x21b1('0x46')]){_0x2db53a[_0x21b1('0x47')]=[{'all':!![]}];}_0x2db53a=_[_0x21b1('0x43')]({},_0x2db53a,_0x180291[_0x21b1('0x45')]);return db[_0x21b1('0x31')][_0x21b1('0x4d')](_0x2db53a)[_0x21b1('0x2b')](handleEntityNotFound(_0x397b57,null))[_0x21b1('0x2b')](function(_0x463bfb){if(_0x463bfb){var _0x3f1a8b=_0x463bfb[_0x21b1('0x2a')]({'plain':!![]});_0x3f1a8b=qs[_0x21b1('0x57')](_0x3f1a8b,['id',_0x21b1('0x58'),_0x21b1('0x59')]);_0x180291[_0x21b1('0x4f')]=_[_0x21b1('0x57')](_0x180291[_0x21b1('0x4f')],['id',_0x21b1('0x58'),_0x21b1('0x59')]);return db['Dashboard'][_0x21b1('0x4e')](_['merge'](_0x3f1a8b,_0x180291[_0x21b1('0x4f')]),{'include':_0x180291[_0x21b1('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x21b1('0x2b')](function(_0x9ab9fa){var _0x2e438d=_0x180291['user'][_0x21b1('0x2a')]({'plain':!![]});if(!_0x2e438d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e438d[_0x21b1('0x52')]===_0x21b1('0x50')){var _0x88f6f9=_0x9ab9fa['get']({'plain':!![]});var _0x300a15='CustomDashboards';return db[_0x21b1('0x5a')][_0x21b1('0x4d')]({'where':{'name':_0x300a15,'userProfileId':_0x2e438d[_0x21b1('0x5b')]},'raw':!![]})[_0x21b1('0x2b')](function(_0x12a964){if(_0x12a964&&_0x12a964[_0x21b1('0x5c')]===0x0){return db[_0x21b1('0x54')][_0x21b1('0x4e')]({'name':_0x88f6f9['name'],'resourceId':_0x88f6f9['id'],'type':_0x12a964[_0x21b1('0x2d')],'sectionId':_0x12a964['id']},{})[_0x21b1('0x2b')](function(){return _0x9ab9fa;});}else{return _0x9ab9fa;}})[_0x21b1('0x4a')](function(_0x50ec05){logger['error'](_0x21b1('0x55'),_0x50ec05);throw _0x50ec05;});}return _0x9ab9fa;});}})['then'](respondWithResult(_0x397b57,0xc9))['catch'](handleError(_0x397b57,null));};exports[_0x21b1('0x28')]=function(_0x9cd71f,_0x188299){if(_0x9cd71f['body']['id']){delete _0x9cd71f['body']['id'];}return db[_0x21b1('0x31')]['find']({'where':{'id':_0x9cd71f[_0x21b1('0x4b')]['id']}})[_0x21b1('0x2b')](handleEntityNotFound(_0x188299,null))[_0x21b1('0x2b')](saveUpdates(_0x9cd71f[_0x21b1('0x4f')],null))[_0x21b1('0x2b')](respondWithResult(_0x188299,null))['catch'](handleError(_0x188299,null));};exports['destroy']=function(_0x42882b,_0x537295){return db[_0x21b1('0x31')][_0x21b1('0x4d')]({'where':{'id':_0x42882b[_0x21b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x537295,null))['then'](removeEntity(_0x537295,null))[_0x21b1('0x4a')](handleError(_0x537295,null));};function widgetAttributes(_0x9b14b8){try{switch(_0x9b14b8[_0x21b1('0x33')]){case _0x21b1('0x5d'):return[{'name':_0x21b1('0x5e'),'value':_0x9b14b8['attrUrl']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x61')}];case _0x21b1('0x62'):return[{'name':_0x21b1('0x63'),'value':_0x9b14b8['attrPath']||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||''}];case _0x21b1('0x64'):return[{'name':_0x21b1('0x65'),'value':_0x9b14b8[_0x21b1('0x65')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8['attrs'][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x66')},{'name':_0x21b1('0x67'),'value':_0x9b14b8['attrTimezone']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8['attrs'][0x1]['value']:undefined)||_0x21b1('0x68')},{'name':_0x21b1('0x69'),'value':_0x9b14b8[_0x21b1('0x69')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x21b1('0x6a'),'value':_0x9b14b8[_0x21b1('0x6a')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x6b')},{'name':_0x21b1('0x6c'),'value':_0x9b14b8[_0x21b1('0x6c')]||(_0x9b14b8['attrs']&&_0x9b14b8['attrs'][0x1]?_0x9b14b8['attrs'][0x1][_0x21b1('0x60')]:undefined)||[]},{'name':_0x21b1('0x69'),'value':_0x9b14b8[_0x21b1('0x69')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x9b14b8[_0x21b1('0x6d')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x3]?_0x9b14b8[_0x21b1('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0x21b1('0x6e'),'value':_0x9b14b8[_0x21b1('0x6e')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x4]?_0x9b14b8['attrs'][0x4][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x6f'),'value':_0x9b14b8[_0x21b1('0x6f')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x5]?_0x9b14b8[_0x21b1('0x5f')][0x5][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x70'),'value':_0x9b14b8['attrSmsAccounts']||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x6]?_0x9b14b8['attrs'][0x6][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x71'),'value':_0x9b14b8['attrOpenchannelAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x7]?_0x9b14b8['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x9b14b8[_0x21b1('0x72')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x8]?_0x9b14b8[_0x21b1('0x5f')][0x8][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x73'),'value':_0x9b14b8[_0x21b1('0x73')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8['attrs'][0x9]?_0x9b14b8[_0x21b1('0x5f')][0x9]['value']:undefined)||''}];case _0x21b1('0x74'):case _0x21b1('0x75'):return[{'name':_0x21b1('0x76'),'value':_0x9b14b8[_0x21b1('0x76')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||_0x21b1('0x6b')},{'name':_0x21b1('0x77'),'value':_0x9b14b8[_0x21b1('0x77')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8[_0x21b1('0x5f')][0x1][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x78'),'value':_0x9b14b8[_0x21b1('0x78')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x2]?_0x9b14b8[_0x21b1('0x5f')][0x2][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x6c'),'value':_0x9b14b8['attrVoiceQueues']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x3]?_0x9b14b8[_0x21b1('0x5f')][0x3][_0x21b1('0x60')]:undefined)||[]},{'name':_0x21b1('0x6d'),'value':_0x9b14b8[_0x21b1('0x6d')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x4]?_0x9b14b8['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x21b1('0x6e'),'value':_0x9b14b8[_0x21b1('0x6e')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x5]?_0x9b14b8[_0x21b1('0x5f')][0x5]['value']:undefined)||''},{'name':_0x21b1('0x6f'),'value':_0x9b14b8['attrFaxAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x6]?_0x9b14b8['attrs'][0x6][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x70'),'value':_0x9b14b8[_0x21b1('0x70')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x7]?_0x9b14b8[_0x21b1('0x5f')][0x7]['value']:undefined)||''},{'name':_0x21b1('0x71'),'value':_0x9b14b8[_0x21b1('0x71')]||(_0x9b14b8['attrs']&&_0x9b14b8[_0x21b1('0x5f')][0x8]?_0x9b14b8[_0x21b1('0x5f')][0x8][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x72'),'value':_0x9b14b8['attrWhatsappAccounts']||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x9]?_0x9b14b8[_0x21b1('0x5f')][0x9][_0x21b1('0x60')]:undefined)||''},{'name':_0x21b1('0x73'),'value':_0x9b14b8[_0x21b1('0x73')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0xa]?_0x9b14b8['attrs'][0xa][_0x21b1('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x21b1('0x79'),'type':_0x9b14b8[_0x21b1('0x7a')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8['attrs'][0x0]['type']:undefined)||null,'value':_0x9b14b8[_0x21b1('0x79')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x0]?_0x9b14b8[_0x21b1('0x5f')][0x0][_0x21b1('0x60')]:undefined)||null},{'name':_0x21b1('0x7b'),'value':_0x9b14b8[_0x21b1('0x7b')]||(_0x9b14b8[_0x21b1('0x5f')]&&_0x9b14b8[_0x21b1('0x5f')][0x1]?_0x9b14b8[_0x21b1('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x56dfcc){logger['error'](_0x21b1('0x7c'),JSON[_0x21b1('0x7d')](_0x56dfcc));return[];}}exports['addItem']=function(_0x2f356c,_0x467dde,_0x402397){if(_0x2f356c[_0x21b1('0x4f')]['id']){delete _0x2f356c[_0x21b1('0x4f')]['id'];}return db[_0x21b1('0x31')][_0x21b1('0x4d')]({'where':{'id':_0x2f356c[_0x21b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x467dde,null))[_0x21b1('0x2b')](function(_0x175e03){if(_0x175e03){_0x2f356c[_0x21b1('0x4f')][_0x21b1('0x7e')]=_0x175e03['id'];_0x2f356c['body']['attrs']=widgetAttributes(_0x2f356c[_0x21b1('0x4f')]);return db[_0x21b1('0x7f')][_0x21b1('0x4e')](_0x2f356c[_0x21b1('0x4f')]);}})['then'](respondWithResult(_0x467dde,null))[_0x21b1('0x4a')](handleError(_0x467dde,null));};exports[_0x21b1('0x80')]=function(_0x426ccb,_0x5aab28,_0x2ee81f){var _0x202608={};var _0x535220={};var _0x1e0c08;var _0x1de094;return db[_0x21b1('0x31')][_0x21b1('0x81')]({'where':{'id':_0x426ccb['params']['id']}})['then'](handleEntityNotFound(_0x5aab28,null))[_0x21b1('0x2b')](function(_0x399c53){if(_0x399c53){_0x1e0c08=_0x399c53;_0x535220['model']=_[_0x21b1('0x37')](db[_0x21b1('0x7f')][_0x21b1('0x4c')]);_0x535220[_0x21b1('0x36')]=_[_0x21b1('0x37')](_0x426ccb['query']);_0x535220[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x535220['model'],_0x535220['query']);_0x202608[_0x21b1('0x3b')]=_[_0x21b1('0x39')](_0x535220[_0x21b1('0x35')],qs[_0x21b1('0x3a')](_0x426ccb['query'][_0x21b1('0x3a')]));_0x202608[_0x21b1('0x3b')]=_0x202608[_0x21b1('0x3b')]['length']?_0x202608[_0x21b1('0x3b')]:_0x535220['model'];_0x202608[_0x21b1('0x3e')]=qs[_0x21b1('0x3f')](_0x426ccb['query']['sort']);_0x202608[_0x21b1('0x40')]=qs[_0x21b1('0x38')](_[_0x21b1('0x41')](_0x426ccb[_0x21b1('0x36')],_0x535220[_0x21b1('0x38')]));if(_0x426ccb['query'][_0x21b1('0x42')]){_0x202608[_0x21b1('0x40')]=_[_0x21b1('0x43')](_0x202608['where'],{'$or':_[_0x21b1('0x30')](_0x202608[_0x21b1('0x3b')],function(_0x2dc020){var _0x565709={};_0x565709[_0x2dc020]={'$like':'%'+_0x426ccb[_0x21b1('0x36')][_0x21b1('0x42')]+'%'};return _0x565709;})});}_0x202608=_[_0x21b1('0x43')]({},_0x202608,_0x426ccb['options']);return _0x1e0c08[_0x21b1('0x80')](_0x202608);}})[_0x21b1('0x2b')](function(_0x17d781){if(_0x17d781){_0x1de094=_0x17d781[_0x21b1('0x3c')];if(!_0x426ccb[_0x21b1('0x36')][_0x21b1('0x82')]('nolimit')){_0x202608['limit']=qs[_0x21b1('0x21')](_0x426ccb['query']['limit']);_0x202608[_0x21b1('0x1f')]=qs[_0x21b1('0x1f')](_0x426ccb[_0x21b1('0x36')][_0x21b1('0x1f')]);}return _0x1e0c08[_0x21b1('0x80')](_0x202608);}})[_0x21b1('0x2b')](function(_0x3576c3){if(_0x3576c3){return _0x3576c3?{'count':_0x1de094,'rows':_0x3576c3}:null;}})[_0x21b1('0x2b')](respondWithResult(_0x5aab28,null))[_0x21b1('0x4a')](handleError(_0x5aab28,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1e7c0fa..640aaf7 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 _0x6899=['update','remove','emit','hook','exports','events','../../mysqldb','Dashboard','save'];(function(_0x976998,_0x467c84){var _0xecef2b=function(_0x5e9144){while(--_0x5e9144){_0x976998['push'](_0x976998['shift']());}};_0xecef2b(++_0x467c84);}(_0x6899,0x15b));var _0x9689=function(_0x268584,_0x51475f){_0x268584=_0x268584-0x0;var _0x5b05b7=_0x6899[_0x268584];return _0x5b05b7;};'use strict';var EventEmitter=require(_0x9689('0x0'));var Dashboard=require(_0x9689('0x1'))['db'][_0x9689('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9689('0x3'),'afterUpdate':_0x9689('0x4'),'afterDestroy':_0x9689('0x5')};function emitEvent(_0x427d79){return function(_0x339acb,_0x577741,_0x3bcfb9){DashboardEvents['emit'](_0x427d79+':'+_0x339acb['id'],_0x339acb);DashboardEvents[_0x9689('0x6')](_0x427d79,_0x339acb);_0x3bcfb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9689('0x7')](e,emitEvent(event));}}module[_0x9689('0x8')]=DashboardEvents; \ No newline at end of file +var _0x9e71=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1b26c7,_0x351a99){var _0x3b2671=function(_0x384bcd){while(--_0x384bcd){_0x1b26c7['push'](_0x1b26c7['shift']());}};_0x3b2671(++_0x351a99);}(_0x9e71,0x1a8));var _0x19e7=function(_0x5ca83d,_0x193509){_0x5ca83d=_0x5ca83d-0x0;var _0x189f6a=_0x9e71[_0x5ca83d];return _0x189f6a;};'use strict';var EventEmitter=require(_0x19e7('0x0'));var Dashboard=require(_0x19e7('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19e7('0x2')](0x0);var events={'afterCreate':_0x19e7('0x3'),'afterUpdate':_0x19e7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2677e5){return function(_0x59fb78,_0x23c87f,_0x32a957){DashboardEvents[_0x19e7('0x5')](_0x2677e5+':'+_0x59fb78['id'],_0x59fb78);DashboardEvents['emit'](_0x2677e5,_0x59fb78);_0x32a957(null);};}for(var e in events){if(events[_0x19e7('0x6')](e)){var event=events[e];Dashboard[_0x19e7('0x7')](e,emitEvent(event));}}module[_0x19e7('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 638308a..1684ac1 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 _0x8b26=['util','../../config/logger','api','path','../../config/environment','exports','define','Dashboard','dashboards'];(function(_0x280399,_0x932f06){var _0x3e6a27=function(_0x2278f0){while(--_0x2278f0){_0x280399['push'](_0x280399['shift']());}};_0x3e6a27(++_0x932f06);}(_0x8b26,0x120));var _0x68b2=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x8b26[_0x55daf2];return _0x1c8500;};'use strict';var _=require('lodash');var util=require(_0x68b2('0x0'));var logger=require(_0x68b2('0x1'))(_0x68b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68b2('0x3'));var rimraf=require('rimraf');var config=require(_0x68b2('0x4'));var attributes=require('./dashboard.attributes');module[_0x68b2('0x5')]=function(_0x52b7e1,_0x8e1d5c){return _0x52b7e1[_0x68b2('0x6')](_0x68b2('0x7'),attributes,{'tableName':_0x68b2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7c=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','Dashboard'];(function(_0x4e4623,_0x361b8b){var _0x12ef4f=function(_0x39d171){while(--_0x39d171){_0x4e4623['push'](_0x4e4623['shift']());}};_0x12ef4f(++_0x361b8b);}(_0x3c7c,0xd8));var _0xc3c7=function(_0x27314d,_0x33c0f2){_0x27314d=_0x27314d-0x0;var _0x30a648=_0x3c7c[_0x27314d];return _0x30a648;};'use strict';var _=require('lodash');var util=require(_0xc3c7('0x0'));var logger=require(_0xc3c7('0x1'))(_0xc3c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c7('0x3'));var fs=require('fs');var path=require(_0xc3c7('0x4'));var rimraf=require(_0xc3c7('0x5'));var config=require(_0xc3c7('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x4e097e,_0x298ede){return _0x4e097e[_0xc3c7('0x7')](_0xc3c7('0x8'),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 3731cfd..05c898e 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 _0xc224=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc224,0x8c));var _0x4c22=function(_0x3e8d1a,_0x2a6c85){_0x3e8d1a=_0x3e8d1a-0x0;var _0x3a17cd=_0xc224[_0x3e8d1a];return _0x3a17cd;};'use strict';var _=require(_0x4c22('0x0'));var util=require('util');var moment=require(_0x4c22('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c22('0x2'));var fs=require('fs');var Redis=require(_0x4c22('0x3'));var db=require(_0x4c22('0x4'))['db'];var utils=require(_0x4c22('0x5'));var logger=require('../../config/logger')(_0x4c22('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c22('0x7'));var client=jayson[_0x4c22('0x8')][_0x4c22('0x9')]({'port':0x232a});config['redis']=_[_0x4c22('0xa')](config[_0x4c22('0xb')],{'host':_0x4c22('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c22('0xd'))['register'](socket);function respondWithRpcPromise(_0x1063d2,_0x35fb27,_0x24b265){return new BPromise(function(_0x50f95d,_0x40eb3d){return client['request'](_0x1063d2,_0x24b265)[_0x4c22('0xe')](function(_0x3baff6){logger[_0x4c22('0xf')](_0x4c22('0x10'),_0x35fb27,_0x4c22('0x11'));logger[_0x4c22('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x35fb27,_0x4c22('0x11'),JSON[_0x4c22('0x13')](_0x3baff6));if(_0x3baff6[_0x4c22('0x14')]){if(_0x3baff6[_0x4c22('0x14')][_0x4c22('0x15')]===0x1f4){logger[_0x4c22('0x14')](_0x4c22('0x10'),_0x35fb27,_0x3baff6['error'][_0x4c22('0x16')]);return _0x40eb3d(_0x3baff6[_0x4c22('0x14')]['message']);}logger['error'](_0x4c22('0x10'),_0x35fb27,_0x3baff6['error']['message']);return _0x50f95d(_0x3baff6[_0x4c22('0x14')][_0x4c22('0x16')]);}else{logger['info'](_0x4c22('0x10'),_0x35fb27,'request\x20sent');_0x50f95d(_0x3baff6['result'][_0x4c22('0x16')]);}})[_0x4c22('0x17')](function(_0x51401e){logger[_0x4c22('0x14')](_0x4c22('0x10'),_0x35fb27,_0x51401e);_0x40eb3d(_0x51401e);});});} \ No newline at end of file +var _0x2f6f=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x38cb17,_0x2e2929){var _0x36f2a2=function(_0x5ccacd){while(--_0x5ccacd){_0x38cb17['push'](_0x38cb17['shift']());}};_0x36f2a2(++_0x2e2929);}(_0x2f6f,0x102));var _0xf2f6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2f6f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf2f6('0x0'));var util=require('util');var moment=require(_0xf2f6('0x1'));var BPromise=require('bluebird');var rs=require(_0xf2f6('0x2'));var fs=require('fs');var Redis=require(_0xf2f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2f6('0x4'));var logger=require(_0xf2f6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf2f6('0x6'));var client=jayson['client'][_0xf2f6('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf2f6('0x8')],{'host':_0xf2f6('0x9'),'port':0x18eb});var socket=require(_0xf2f6('0xa'))(new Redis(config[_0xf2f6('0x8')]));require(_0xf2f6('0xb'))[_0xf2f6('0xc')](socket);function respondWithRpcPromise(_0x5e2459,_0x33bfe7,_0x3bc54f){return new BPromise(function(_0x339078,_0x17106b){return client[_0xf2f6('0xd')](_0x5e2459,_0x3bc54f)[_0xf2f6('0xe')](function(_0x222927){logger[_0xf2f6('0xf')](_0xf2f6('0x10'),_0x33bfe7,_0xf2f6('0x11'));logger[_0xf2f6('0x12')](_0xf2f6('0x13'),_0x33bfe7,'request\x20sent',JSON[_0xf2f6('0x14')](_0x222927));if(_0x222927[_0xf2f6('0x15')]){if(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x16')]===0x1f4){logger[_0xf2f6('0x15')](_0xf2f6('0x10'),_0x33bfe7,_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);return _0x17106b(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);}logger[_0xf2f6('0x15')]('Dashboard,\x20%s,\x20%s',_0x33bfe7,_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);return _0x339078(_0x222927[_0xf2f6('0x15')][_0xf2f6('0x17')]);}else{logger['info'](_0xf2f6('0x10'),_0x33bfe7,_0xf2f6('0x11'));_0x339078(_0x222927['result']['message']);}})[_0xf2f6('0x18')](function(_0x17b795){logger[_0xf2f6('0x15')](_0xf2f6('0x10'),_0x33bfe7,_0x17b795);_0x17106b(_0x17b795);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9065dc9..d9f2308 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 _0x9671=['save','emit','removeListener','register','length','dashboard:'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9671,0x72));var _0x1967=function(_0x1c963d,_0x2b8399){_0x1c963d=_0x1c963d-0x0;var _0x35a1d2=_0x9671[_0x1c963d];return _0x35a1d2;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x1967('0x0'),'remove','update'];function createListener(_0xe63936,_0x5eb8a8){return function(_0x35d704){_0x5eb8a8[_0x1967('0x1')](_0xe63936,_0x35d704);};}function removeListener(_0x45c677,_0x3db52d){return function(){DashboardEvents[_0x1967('0x2')](_0x45c677,_0x3db52d);};}exports[_0x1967('0x3')]=function(_0x2ecf7b){for(var _0x45cff2=0x0,_0x5d3a8d=events[_0x1967('0x4')];_0x45cff2<_0x5d3a8d;_0x45cff2++){var _0x5e0cc2=events[_0x45cff2];var _0x1d29f6=createListener(_0x1967('0x5')+_0x5e0cc2,_0x2ecf7b);DashboardEvents['on'](_0x5e0cc2,_0x1d29f6);}}; \ No newline at end of file +var _0x62c9=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x62c9,0xac));var _0x962c=function(_0x3e8ba5,_0x41c00a){_0x3e8ba5=_0x3e8ba5-0x0;var _0x210621=_0x62c9[_0x3e8ba5];return _0x210621;};'use strict';var DashboardEvents=require(_0x962c('0x0'));var events=[_0x962c('0x1'),_0x962c('0x2'),_0x962c('0x3')];function createListener(_0xb9228,_0x95f2d4){return function(_0x1a8b2a){_0x95f2d4['emit'](_0xb9228,_0x1a8b2a);};}function removeListener(_0x11fdfd,_0x23f62c){return function(){DashboardEvents[_0x962c('0x4')](_0x11fdfd,_0x23f62c);};}exports[_0x962c('0x5')]=function(_0x90274d){for(var _0x259836=0x0,_0x13a2a8=events[_0x962c('0x6')];_0x259836<_0x13a2a8;_0x259836++){var _0x306649=events[_0x259836];var _0x5643a0=createListener(_0x962c('0x7')+_0x306649,_0x90274d);DashboardEvents['on'](_0x306649,_0x5643a0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 03ba422..08df76d 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 _0x37f1=['exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','post','create','/:id/clone','clone','put','/:id','delete','destroy'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x37f1,0xd3));var _0x137f=function(_0x529045,_0x5dff91){_0x529045=_0x529045-0x0;var _0x3b584b=_0x37f1[_0x529045];return _0x3b584b;};'use strict';var multer=require(_0x137f('0x0'));var util=require(_0x137f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x137f('0x2'));var router=express[_0x137f('0x3')]();var fs_extra=require(_0x137f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x137f('0x5'));var config=require(_0x137f('0x6'));var controller=require(_0x137f('0x7'));router[_0x137f('0x8')]('/',auth[_0x137f('0x9')](),controller['index']);router[_0x137f('0x8')]('/:id',auth[_0x137f('0x9')](),controller[_0x137f('0xa')]);router['get'](_0x137f('0xb'),auth['isAuthenticated'](),controller['getItems']);router[_0x137f('0xc')]('/',auth['isAuthenticated'](),controller[_0x137f('0xd')]);router[_0x137f('0xc')](_0x137f('0xe'),auth[_0x137f('0x9')](),controller[_0x137f('0xf')]);router[_0x137f('0xc')](_0x137f('0xb'),auth['isAuthenticated'](),controller['addItem']);router[_0x137f('0x10')](_0x137f('0x11'),auth[_0x137f('0x9')](),controller['update']);router[_0x137f('0x12')](_0x137f('0x11'),auth[_0x137f('0x9')](),controller[_0x137f('0x13')]);module[_0x137f('0x14')]=router; \ No newline at end of file +var _0xf9b5=['put','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem'];(function(_0xc2b8c9,_0x2d42c1){var _0x185e7e=function(_0x8b3340){while(--_0x8b3340){_0xc2b8c9['push'](_0xc2b8c9['shift']());}};_0x185e7e(++_0x2d42c1);}(_0xf9b5,0x81));var _0x5f9b=function(_0x3ba748,_0x4b8fb9){_0x3ba748=_0x3ba748-0x0;var _0x5b04e2=_0xf9b5[_0x3ba748];return _0x5b04e2;};'use strict';var multer=require(_0x5f9b('0x0'));var util=require(_0x5f9b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f9b('0x2'));var router=express['Router']();var fs_extra=require(_0x5f9b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5f9b('0x4'));var config=require('../../config/environment');var controller=require(_0x5f9b('0x5'));router[_0x5f9b('0x6')]('/',auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x8')]);router['get'](_0x5f9b('0x9'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0xa')]);router[_0x5f9b('0x6')](_0x5f9b('0xb'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0xc')]);router[_0x5f9b('0xd')]('/',auth['isAuthenticated'](),controller[_0x5f9b('0xe')]);router['post'](_0x5f9b('0xf'),auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x10')]);router[_0x5f9b('0xd')](_0x5f9b('0xb'),auth['isAuthenticated'](),controller[_0x5f9b('0x11')]);router[_0x5f9b('0x12')](_0x5f9b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5f9b('0x13')]('/:id',auth[_0x5f9b('0x7')](),controller[_0x5f9b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 54c40d7..6ffb87e 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 _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x5d17,0x114));var _0x75d1=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x5d17[_0x3ef4f1];return _0x69953c;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x1261,0x144));var _0x1126=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x1261[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9627a16..262bd11 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 _0x7c09=['params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','stringify','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show'];(function(_0x5bf6bf,_0x45da79){var _0x253357=function(_0x14422f){while(--_0x14422f){_0x5bf6bf['push'](_0x5bf6bf['shift']());}};_0x253357(++_0x45da79);}(_0x7c09,0x102));var _0x97c0=function(_0x177425,_0x36f463){_0x177425=_0x177425-0x0;var _0x28937f=_0x7c09[_0x177425];return _0x28937f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];config[_0x97c0('0x18')]=_[_0x97c0('0x19')](config[_0x97c0('0x18')],{'host':_0x97c0('0x1a'),'port':0x18eb});var socket=require(_0x97c0('0x1b'))(new Redis(config[_0x97c0('0x18')]));require('./dashboardItem.socket')[_0x97c0('0x1c')](socket);function respondWithStatusCode(_0x15b336,_0xcac10b){_0xcac10b=_0xcac10b||0xcc;return function(_0x496017){if(_0x496017){return _0x15b336[_0x97c0('0x1d')](_0xcac10b);}return _0x15b336[_0x97c0('0x1e')](_0xcac10b)[_0x97c0('0x1f')]();};}function respondWithResult(_0x21e5f7,_0x482be5){_0x482be5=_0x482be5||0xc8;return function(_0x13d46e){if(_0x13d46e){return _0x21e5f7['status'](_0x482be5)[_0x97c0('0x20')](_0x13d46e);}};}function respondWithFilteredResult(_0x3ae7c4,_0x51180e){return function(_0x560ac0){if(_0x560ac0){var _0x16918b=typeof _0x51180e[_0x97c0('0x21')]===_0x97c0('0x22')&&typeof _0x51180e[_0x97c0('0x23')]===_0x97c0('0x22');var _0x4fed42=_0x560ac0[_0x97c0('0x24')];var _0x432705=_0x16918b?0x0:_0x51180e[_0x97c0('0x21')];var _0x4ca20a=_0x16918b?_0x560ac0['count']:_0x51180e[_0x97c0('0x21')]+_0x51180e[_0x97c0('0x23')];var _0x169f19;if(_0x4ca20a>=_0x4fed42){_0x4ca20a=_0x4fed42;_0x169f19=0xc8;}else{_0x169f19=0xce;}_0x3ae7c4['status'](_0x169f19);return _0x3ae7c4[_0x97c0('0x25')](_0x97c0('0x26'),_0x432705+'-'+_0x4ca20a+'/'+_0x4fed42)[_0x97c0('0x20')](_0x560ac0);}return null;};}function patchUpdates(_0x272314){return function(_0x30fba2){try{jsonpatch[_0x97c0('0x27')](_0x30fba2,_0x272314,!![]);}catch(_0x9dff60){return BPromise['reject'](_0x9dff60);}return _0x30fba2[_0x97c0('0x28')]();};}function saveUpdates(_0x29b3aa,_0x1f7adb){return function(_0x216785){if(_0x216785){return _0x216785['update'](_0x29b3aa)[_0x97c0('0x29')](function(_0x14cada){return _0x14cada;});}return null;};}function removeEntity(_0x52a429,_0x2ec9d6){return function(_0x2bb908){if(_0x2bb908){return _0x2bb908[_0x97c0('0x2a')]()['then'](function(){_0x52a429['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b8ad,_0x8e3ee7){return function(_0x3a744c){if(!_0x3a744c){_0x11b8ad[_0x97c0('0x1d')](0x194);}return _0x3a744c;};}function handleError(_0x26939e,_0x153b14){_0x153b14=_0x153b14||0x1f4;return function(_0x4a3645){logger[_0x97c0('0x2b')](_0x4a3645[_0x97c0('0x2c')]);if(_0x4a3645[_0x97c0('0x2d')]){delete _0x4a3645['name'];}_0x26939e[_0x97c0('0x1e')](_0x153b14)[_0x97c0('0x2e')](_0x4a3645);};}exports[_0x97c0('0x2f')]=function(_0x23d2af,_0x2a7b2b){var _0x5c4e4e={'raw':![],'where':{'id':_0x23d2af[_0x97c0('0x30')]['id']}},_0x59abbb={};_0x59abbb[_0x97c0('0x31')]=_[_0x97c0('0x32')](db['DashboardItem'][_0x97c0('0x33')]);_0x59abbb[_0x97c0('0x34')]=_['keys'](_0x23d2af[_0x97c0('0x34')]);_0x59abbb[_0x97c0('0x35')]=_[_0x97c0('0x36')](_0x59abbb[_0x97c0('0x31')],_0x59abbb[_0x97c0('0x34')]);_0x5c4e4e[_0x97c0('0x37')]=_[_0x97c0('0x36')](_0x59abbb[_0x97c0('0x31')],qs[_0x97c0('0x38')](_0x23d2af[_0x97c0('0x34')][_0x97c0('0x38')]));_0x5c4e4e[_0x97c0('0x37')]=_0x5c4e4e[_0x97c0('0x37')][_0x97c0('0x39')]?_0x5c4e4e[_0x97c0('0x37')]:_0x59abbb['model'];if(_0x23d2af[_0x97c0('0x34')][_0x97c0('0x3a')]){_0x5c4e4e[_0x97c0('0x3b')]=[{'all':!![]}];}_0x5c4e4e=_[_0x97c0('0x3c')]({},_0x5c4e4e,_0x23d2af[_0x97c0('0x3d')]);return db[_0x97c0('0x3e')][_0x97c0('0x3f')](_0x5c4e4e)[_0x97c0('0x29')](handleEntityNotFound(_0x2a7b2b,null))['then'](respondWithResult(_0x2a7b2b,null))[_0x97c0('0x40')](handleError(_0x2a7b2b,null));};exports['destroy']=function(_0x23e482,_0x20291){return db[_0x97c0('0x3e')][_0x97c0('0x3f')]({'where':{'id':_0x23e482[_0x97c0('0x30')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x20291,null))[_0x97c0('0x29')](removeEntity(_0x20291,null))[_0x97c0('0x40')](handleError(_0x20291,null));};function widgetAttributes(_0x38f37a){try{switch(_0x38f37a[_0x97c0('0x41')]){case _0x97c0('0x42'):return[{'name':'attrUrl','value':_0x38f37a[_0x97c0('0x43')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x46')}];case _0x97c0('0x47'):return[{'name':'attrPath','value':_0x38f37a[_0x97c0('0x48')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0]['value']:undefined)||''}];case _0x97c0('0x49'):return[{'name':_0x97c0('0x4a'),'value':_0x38f37a[_0x97c0('0x4a')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x4b')},{'name':_0x97c0('0x4c'),'value':_0x38f37a[_0x97c0('0x4c')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a[_0x97c0('0x44')][0x1]['value']:undefined)||_0x97c0('0x4d')},{'name':_0x97c0('0x4e'),'value':_0x38f37a[_0x97c0('0x4e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a[_0x97c0('0x44')][0x2][_0x97c0('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x38f37a[_0x97c0('0x4f')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x38f37a['attrVoiceQueues']||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x1]?_0x38f37a['attrs'][0x1][_0x97c0('0x45')]:undefined)||[]},{'name':_0x97c0('0x4e'),'value':_0x38f37a[_0x97c0('0x4e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a['attrs'][0x2][_0x97c0('0x45')]:undefined)||0x14},{'name':_0x97c0('0x50'),'value':_0x38f37a[_0x97c0('0x50')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x3]?_0x38f37a[_0x97c0('0x44')][0x3][_0x97c0('0x45')]:undefined)||_0x97c0('0x51')},{'name':_0x97c0('0x52'),'value':_0x38f37a[_0x97c0('0x52')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x4]?_0x38f37a[_0x97c0('0x44')][0x4][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x53'),'value':_0x38f37a['attrFaxAccounts']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x5]?_0x38f37a[_0x97c0('0x44')][0x5][_0x97c0('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38f37a[_0x97c0('0x54')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x6]?_0x38f37a[_0x97c0('0x44')][0x6][_0x97c0('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38f37a[_0x97c0('0x55')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x7]?_0x38f37a['attrs'][0x7]['value']:undefined)||''},{'name':_0x97c0('0x56'),'value':_0x38f37a['attrWhatsappAccounts']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x8]?_0x38f37a[_0x97c0('0x44')][0x8][_0x97c0('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x38f37a['attrChatWebsites']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x9]?_0x38f37a[_0x97c0('0x44')][0x9][_0x97c0('0x45')]:undefined)||''}];case _0x97c0('0x57'):case _0x97c0('0x58'):return[{'name':_0x97c0('0x59'),'value':_0x38f37a[_0x97c0('0x59')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x5a')},{'name':_0x97c0('0x5b'),'value':_0x38f37a[_0x97c0('0x5b')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a[_0x97c0('0x44')][0x1]['value']:undefined)||null},{'name':_0x97c0('0x5c'),'value':_0x38f37a[_0x97c0('0x5c')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a[_0x97c0('0x44')][0x2][_0x97c0('0x45')]:undefined)||null},{'name':_0x97c0('0x5d'),'value':_0x38f37a['attrVoiceQueues']||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x3]?_0x38f37a[_0x97c0('0x44')][0x3][_0x97c0('0x45')]:undefined)||[]},{'name':_0x97c0('0x50'),'value':_0x38f37a[_0x97c0('0x50')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x4]?_0x38f37a[_0x97c0('0x44')][0x4][_0x97c0('0x45')]:undefined)||_0x97c0('0x51')},{'name':_0x97c0('0x52'),'value':_0x38f37a[_0x97c0('0x52')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x5]?_0x38f37a[_0x97c0('0x44')][0x5][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x53'),'value':_0x38f37a[_0x97c0('0x53')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x6]?_0x38f37a[_0x97c0('0x44')][0x6][_0x97c0('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38f37a[_0x97c0('0x54')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x7]?_0x38f37a['attrs'][0x7][_0x97c0('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38f37a[_0x97c0('0x55')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x8]?_0x38f37a[_0x97c0('0x44')][0x8][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x56'),'value':_0x38f37a[_0x97c0('0x56')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x9]?_0x38f37a[_0x97c0('0x44')][0x9][_0x97c0('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x38f37a[_0x97c0('0x5e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0xa]?_0x38f37a[_0x97c0('0x44')][0xa]['value']:undefined)||''}];case _0x97c0('0x5f'):return[{'name':_0x97c0('0x60'),'type':_0x38f37a[_0x97c0('0x61')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x41')]:undefined)||null,'value':_0x38f37a[_0x97c0('0x60')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||null},{'name':_0x97c0('0x62'),'value':_0x38f37a[_0x97c0('0x62')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xeb4eb3){logger[_0x97c0('0x2b')]('widgetAttributes:\x20%s',JSON[_0x97c0('0x63')](_0xeb4eb3));return[];}}exports['create']=function(_0x5dc808,_0x3518fb){if(_0x5dc808['body']){_0x5dc808[_0x97c0('0x64')][_0x97c0('0x44')]=widgetAttributes(_0x5dc808['body']);}return db['DashboardItem']['create'](_0x5dc808[_0x97c0('0x64')],{})['then'](respondWithResult(_0x3518fb,0xc9))[_0x97c0('0x40')](handleError(_0x3518fb,null));};exports[_0x97c0('0x65')]=function(_0xdbadf4,_0x26bed6){if(_0xdbadf4[_0x97c0('0x64')]['id']){delete _0xdbadf4[_0x97c0('0x64')]['id'];}_0xdbadf4[_0x97c0('0x64')][_0x97c0('0x44')]=widgetAttributes(_0xdbadf4[_0x97c0('0x64')]);return db[_0x97c0('0x3e')][_0x97c0('0x3f')]({'where':{'id':_0xdbadf4['params']['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x26bed6,null))[_0x97c0('0x29')](saveUpdates(_0xdbadf4[_0x97c0('0x64')],null))[_0x97c0('0x29')](respondWithResult(_0x26bed6,null))[_0x97c0('0x40')](handleError(_0x26bed6,null));}; \ No newline at end of file +var _0x5334=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x5334,0x84));var _0x4533=function(_0x24ea15,_0x2c9d09){_0x24ea15=_0x24ea15-0x0;var _0x263466=_0x5334[_0x24ea15];return _0x263466;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];config[_0x4533('0x16')]=_[_0x4533('0x17')](config[_0x4533('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4533('0x18'))(new Redis(config[_0x4533('0x16')]));require(_0x4533('0x19'))[_0x4533('0x1a')](socket);function respondWithStatusCode(_0x533a26,_0xe47213){_0xe47213=_0xe47213||0xcc;return function(_0x573d84){if(_0x573d84){return _0x533a26['sendStatus'](_0xe47213);}return _0x533a26[_0x4533('0x1b')](_0xe47213)[_0x4533('0x1c')]();};}function respondWithResult(_0x5da8b8,_0x30c68c){_0x30c68c=_0x30c68c||0xc8;return function(_0x1e6a1a){if(_0x1e6a1a){return _0x5da8b8[_0x4533('0x1b')](_0x30c68c)['json'](_0x1e6a1a);}};}function respondWithFilteredResult(_0x3ed873,_0x4f732e){return function(_0x3ddb36){if(_0x3ddb36){var _0x3d16a2=typeof _0x4f732e['offset']===_0x4533('0x1d')&&typeof _0x4f732e['limit']==='undefined';var _0x1c5cdd=_0x3ddb36[_0x4533('0x1e')];var _0x49fb91=_0x3d16a2?0x0:_0x4f732e['offset'];var _0x1abe1d=_0x3d16a2?_0x3ddb36[_0x4533('0x1e')]:_0x4f732e[_0x4533('0x1f')]+_0x4f732e[_0x4533('0x20')];var _0x6766eb;if(_0x1abe1d>=_0x1c5cdd){_0x1abe1d=_0x1c5cdd;_0x6766eb=0xc8;}else{_0x6766eb=0xce;}_0x3ed873[_0x4533('0x1b')](_0x6766eb);return _0x3ed873[_0x4533('0x21')]('Content-Range',_0x49fb91+'-'+_0x1abe1d+'/'+_0x1c5cdd)[_0x4533('0x22')](_0x3ddb36);}return null;};}function patchUpdates(_0xd55c04){return function(_0x2901f1){try{jsonpatch['apply'](_0x2901f1,_0xd55c04,!![]);}catch(_0x513011){return BPromise[_0x4533('0x23')](_0x513011);}return _0x2901f1[_0x4533('0x24')]();};}function saveUpdates(_0x4c640c,_0x5dcfd2){return function(_0x307bdd){if(_0x307bdd){return _0x307bdd[_0x4533('0x25')](_0x4c640c)[_0x4533('0x26')](function(_0x4d8189){return _0x4d8189;});}return null;};}function removeEntity(_0x44786f,_0x39b261){return function(_0x43eaa8){if(_0x43eaa8){return _0x43eaa8[_0x4533('0x27')]()[_0x4533('0x26')](function(){_0x44786f[_0x4533('0x1b')](0xcc)[_0x4533('0x1c')]();});}};}function handleEntityNotFound(_0x27b653,_0x45ad98){return function(_0x5f16bb){if(!_0x5f16bb){_0x27b653['sendStatus'](0x194);}return _0x5f16bb;};}function handleError(_0xa2e602,_0x5aaf2d){_0x5aaf2d=_0x5aaf2d||0x1f4;return function(_0x3fd76a){logger['error'](_0x3fd76a[_0x4533('0x28')]);if(_0x3fd76a[_0x4533('0x29')]){delete _0x3fd76a[_0x4533('0x29')];}_0xa2e602[_0x4533('0x1b')](_0x5aaf2d)[_0x4533('0x2a')](_0x3fd76a);};}exports[_0x4533('0x2b')]=function(_0xe584a2,_0xa58dd1){var _0x130566={'raw':![],'where':{'id':_0xe584a2[_0x4533('0x2c')]['id']}},_0x43682f={};_0x43682f[_0x4533('0x2d')]=_[_0x4533('0x2e')](db['DashboardItem'][_0x4533('0x2f')]);_0x43682f['query']=_[_0x4533('0x2e')](_0xe584a2[_0x4533('0x30')]);_0x43682f[_0x4533('0x31')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],_0x43682f[_0x4533('0x30')]);_0x130566[_0x4533('0x33')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],qs[_0x4533('0x34')](_0xe584a2[_0x4533('0x30')][_0x4533('0x34')]));_0x130566['attributes']=_0x130566[_0x4533('0x33')][_0x4533('0x35')]?_0x130566[_0x4533('0x33')]:_0x43682f[_0x4533('0x2d')];if(_0xe584a2[_0x4533('0x30')]['includeAll']){_0x130566[_0x4533('0x36')]=[{'all':!![]}];}_0x130566=_[_0x4533('0x37')]({},_0x130566,_0xe584a2[_0x4533('0x38')]);return db[_0x4533('0x39')][_0x4533('0x3a')](_0x130566)[_0x4533('0x26')](handleEntityNotFound(_0xa58dd1,null))['then'](respondWithResult(_0xa58dd1,null))[_0x4533('0x3b')](handleError(_0xa58dd1,null));};exports[_0x4533('0x27')]=function(_0x5d21f2,_0x3b6f10){return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x5d21f2[_0x4533('0x2c')]['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x3b6f10,null))[_0x4533('0x26')](removeEntity(_0x3b6f10,null))[_0x4533('0x3b')](handleError(_0x3b6f10,null));};function widgetAttributes(_0x603753){try{switch(_0x603753[_0x4533('0x3c')]){case _0x4533('0x3d'):return[{'name':'attrUrl','value':_0x603753[_0x4533('0x3e')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x41')}];case _0x4533('0x42'):return[{'name':_0x4533('0x43'),'value':_0x603753[_0x4533('0x43')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x4533('0x44'),'value':_0x603753['attrHourFormat']||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x45')},{'name':_0x4533('0x46'),'value':_0x603753[_0x4533('0x46')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||_0x4533('0x47')},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4533('0x49'),'value':_0x603753[_0x4533('0x49')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753['attrs'][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x4a')},{'name':_0x4533('0x4b'),'value':_0x603753[_0x4533('0x4b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1]['value']:undefined)||[]},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x2]?_0x603753[_0x4533('0x3f')][0x2][_0x4533('0x40')]:undefined)||0x14},{'name':_0x4533('0x4c'),'value':_0x603753['attrChannel']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753['attrs'][0x3][_0x4533('0x40')]:undefined)||_0x4533('0x4d')},{'name':'attrEmailAccounts','value':_0x603753['attrEmailAccounts']||(_0x603753['attrs']&&_0x603753['attrs'][0x4]?_0x603753['attrs'][0x4][_0x4533('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753['attrs'][0x5]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753['attrSmsAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x6]?_0x603753[_0x4533('0x3f')][0x6][_0x4533('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x603753[_0x4533('0x51')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x8]?_0x603753[_0x4533('0x3f')][0x8][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x9]?_0x603753[_0x4533('0x3f')][0x9][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x53'):case _0x4533('0x54'):return[{'name':_0x4533('0x55'),'value':_0x603753[_0x4533('0x55')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||'total'},{'name':_0x4533('0x56'),'value':_0x603753['attrSerie2']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||null},{'name':_0x4533('0x57'),'value':_0x603753['attrSerie3']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2][_0x4533('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x603753[_0x4533('0x4b')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753[_0x4533('0x3f')][0x3][_0x4533('0x40')]:undefined)||[]},{'name':_0x4533('0x4c'),'value':_0x603753[_0x4533('0x4c')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x4]?_0x603753[_0x4533('0x3f')][0x4][_0x4533('0x40')]:undefined)||'voice'},{'name':_0x4533('0x58'),'value':_0x603753[_0x4533('0x58')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753[_0x4533('0x3f')][0x5][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x4e'),'value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x6]?_0x603753['attrs'][0x6]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753[_0x4533('0x4f')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x50'),'value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x8]?_0x603753[_0x4533('0x3f')][0x8]['value']:undefined)||''},{'name':_0x4533('0x51'),'value':_0x603753['attrWhatsappAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x9]?_0x603753[_0x4533('0x3f')][0x9]['value']:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0xa]?_0x603753[_0x4533('0x3f')][0xa][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x59'):return[{'name':_0x4533('0x5a'),'type':_0x603753['reportType']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['type']:undefined)||null,'value':_0x603753[_0x4533('0x5a')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x0]?_0x603753['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x603753[_0x4533('0x5b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xbf35f7){logger[_0x4533('0x5c')](_0x4533('0x5d'),JSON['stringify'](_0xbf35f7));return[];}}exports[_0x4533('0x5e')]=function(_0x1bd2da,_0x1b0414){if(_0x1bd2da[_0x4533('0x5f')]){_0x1bd2da['body']['attrs']=widgetAttributes(_0x1bd2da['body']);}return db[_0x4533('0x39')]['create'](_0x1bd2da[_0x4533('0x5f')],{})[_0x4533('0x26')](respondWithResult(_0x1b0414,0xc9))[_0x4533('0x3b')](handleError(_0x1b0414,null));};exports['update']=function(_0x31b10f,_0x50497f){if(_0x31b10f[_0x4533('0x5f')]['id']){delete _0x31b10f['body']['id'];}_0x31b10f[_0x4533('0x5f')][_0x4533('0x3f')]=widgetAttributes(_0x31b10f[_0x4533('0x5f')]);return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x31b10f['params']['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x50497f,null))['then'](saveUpdates(_0x31b10f[_0x4533('0x5f')],null))[_0x4533('0x26')](respondWithResult(_0x50497f,null))['catch'](handleError(_0x50497f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 372d781..2ce0ea6 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 _0xac60=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','DashboardItem'];(function(_0x2df277,_0x4122ff){var _0x36b83a=function(_0xaccf88){while(--_0xaccf88){_0x2df277['push'](_0x2df277['shift']());}};_0x36b83a(++_0x4122ff);}(_0xac60,0x137));var _0x0ac6=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xac60[_0x5447fd];return _0x15b28a;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x0ac6('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0ac6('0x1')](0x0);var events={'afterCreate':_0x0ac6('0x2'),'afterUpdate':_0x0ac6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5accd0){return function(_0x423b0a,_0x38af16,_0x3d8e06){DashboardItemEvents[_0x0ac6('0x4')](_0x5accd0+':'+_0x423b0a['id'],_0x423b0a);DashboardItemEvents['emit'](_0x5accd0,_0x423b0a);_0x3d8e06(null);};}for(var e in events){if(events[_0x0ac6('0x5')](e)){var event=events[e];DashboardItem[_0x0ac6('0x6')](e,emitEvent(event));}}module[_0x0ac6('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x1328=['setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1328,0x11d));var _0x8132=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x1328[_0x33032e];return _0x13316b;};'use strict';var EventEmitter=require(_0x8132('0x0'));var DashboardItem=require(_0x8132('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8132('0x2')](0x0);var events={'afterCreate':_0x8132('0x3'),'afterUpdate':_0x8132('0x4'),'afterDestroy':_0x8132('0x5')};function emitEvent(_0x20b1d7){return function(_0x438566,_0x52c498,_0x1b9957){DashboardItemEvents['emit'](_0x20b1d7+':'+_0x438566['id'],_0x438566);DashboardItemEvents['emit'](_0x20b1d7,_0x438566);_0x1b9957(null);};}for(var e in events){if(events[_0x8132('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 06ce955..24debc4 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 _0x4111=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define'];(function(_0x4408d4,_0x5ed395){var _0x58a151=function(_0x5a18ae){while(--_0x5a18ae){_0x4408d4['push'](_0x4408d4['shift']());}};_0x58a151(++_0x5ed395);}(_0x4111,0x91));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1411('0x0'));var util=require(_0x1411('0x1'));var logger=require(_0x1411('0x2'))(_0x1411('0x3'));var moment=require('moment');var BPromise=require(_0x1411('0x4'));var rp=require(_0x1411('0x5'));var fs=require('fs');var path=require(_0x1411('0x6'));var rimraf=require(_0x1411('0x7'));var config=require(_0x1411('0x8'));var attributes=require(_0x1411('0x9'));module['exports']=function(_0x5c58ed,_0x3d1a31){return _0x5c58ed[_0x1411('0xa')](_0x1411('0xb'),attributes,{'tableName':_0x1411('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6523=['DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define'];(function(_0x303fed,_0x5eecd3){var _0x1d9585=function(_0x5ab3b5){while(--_0x5ab3b5){_0x303fed['push'](_0x303fed['shift']());}};_0x1d9585(++_0x5eecd3);}(_0x6523,0x1a6));var _0x3652=function(_0x482e30,_0x11c205){_0x482e30=_0x482e30-0x0;var _0x59bf70=_0x6523[_0x482e30];return _0x59bf70;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var logger=require('../../config/logger')(_0x3652('0x2'));var moment=require(_0x3652('0x3'));var BPromise=require(_0x3652('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3652('0x5'));var rimraf=require(_0x3652('0x6'));var config=require(_0x3652('0x7'));var attributes=require(_0x3652('0x8'));module['exports']=function(_0x204f81,_0x18f1c3){return _0x204f81[_0x3652('0x9')](_0x3652('0xa'),attributes,{'tableName':_0x3652('0xb'),'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 cd47410..4bfc5c7 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 _0x5164=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x5164,0x1cd));var _0x4516=function(_0x114630,_0x465a96){_0x114630=_0x114630-0x0;var _0x539a99=_0x5164[_0x114630];return _0x539a99;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4516('0x0'));var BPromise=require(_0x4516('0x1'));var rs=require(_0x4516('0x2'));var fs=require('fs');var Redis=require(_0x4516('0x3'));var db=require(_0x4516('0x4'))['db'];var utils=require(_0x4516('0x5'));var logger=require(_0x4516('0x6'))(_0x4516('0x7'));var config=require('../../config/environment');var jayson=require(_0x4516('0x8'));var client=jayson[_0x4516('0x9')][_0x4516('0xa')]({'port':0x232a});config[_0x4516('0xb')]=_[_0x4516('0xc')](config[_0x4516('0xb')],{'host':_0x4516('0xd'),'port':0x18eb});var socket=require(_0x4516('0xe'))(new Redis(config['redis']));require(_0x4516('0xf'))[_0x4516('0x10')](socket);function respondWithRpcPromise(_0x31ac42,_0xa3dfad,_0x476f2a){return new BPromise(function(_0x36bd95,_0x5806f1){return client[_0x4516('0x11')](_0x31ac42,_0x476f2a)['then'](function(_0xbb3e72){logger[_0x4516('0x12')](_0x4516('0x13'),_0xa3dfad,_0x4516('0x14'));logger['debug'](_0x4516('0x15'),_0xa3dfad,_0x4516('0x14'),JSON['stringify'](_0xbb3e72));if(_0xbb3e72[_0x4516('0x16')]){if(_0xbb3e72['error'][_0x4516('0x17')]===0x1f4){logger[_0x4516('0x16')](_0x4516('0x13'),_0xa3dfad,_0xbb3e72['error'][_0x4516('0x18')]);return _0x5806f1(_0xbb3e72[_0x4516('0x16')][_0x4516('0x18')]);}logger['error'](_0x4516('0x13'),_0xa3dfad,_0xbb3e72[_0x4516('0x16')][_0x4516('0x18')]);return _0x36bd95(_0xbb3e72['error'][_0x4516('0x18')]);}else{logger[_0x4516('0x12')]('DashboardItem,\x20%s,\x20%s',_0xa3dfad,_0x4516('0x14'));_0x36bd95(_0xbb3e72[_0x4516('0x19')]['message']);}})[_0x4516('0x1a')](function(_0x31b593){logger[_0x4516('0x16')](_0x4516('0x13'),_0xa3dfad,_0x31b593);_0x5806f1(_0x31b593);});});} \ No newline at end of file +var _0xf1ce=['request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','DashboardItem,\x20%s,\x20%s'];(function(_0x50ec3e,_0x47bf99){var _0x41c2bc=function(_0x79e4ec){while(--_0x79e4ec){_0x50ec3e['push'](_0x50ec3e['shift']());}};_0x41c2bc(++_0x47bf99);}(_0xf1ce,0x166));var _0xef1c=function(_0x767c9c,_0x38a982){_0x767c9c=_0x767c9c-0x0;var _0x175a73=_0xf1ce[_0x767c9c];return _0x175a73;};'use strict';var _=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var moment=require(_0xef1c('0x2'));var BPromise=require(_0xef1c('0x3'));var rs=require(_0xef1c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef1c('0x5'))['db'];var utils=require(_0xef1c('0x6'));var logger=require('../../config/logger')(_0xef1c('0x7'));var config=require(_0xef1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef1c('0x9')][_0xef1c('0xa')]({'port':0x232a});config[_0xef1c('0xb')]=_['defaults'](config[_0xef1c('0xb')],{'host':_0xef1c('0xc'),'port':0x18eb});var socket=require(_0xef1c('0xd'))(new Redis(config[_0xef1c('0xb')]));require(_0xef1c('0xe'))['register'](socket);function respondWithRpcPromise(_0x2956a4,_0x337bd2,_0xab0185){return new BPromise(function(_0x1c9a7f,_0x192368){return client[_0xef1c('0xf')](_0x2956a4,_0xab0185)['then'](function(_0x415062){logger['info'](_0xef1c('0x10'),_0x337bd2,_0xef1c('0x11'));logger['debug'](_0xef1c('0x12'),_0x337bd2,_0xef1c('0x11'),JSON[_0xef1c('0x13')](_0x415062));if(_0x415062[_0xef1c('0x14')]){if(_0x415062[_0xef1c('0x14')][_0xef1c('0x15')]===0x1f4){logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);return _0x192368(_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);}logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0x415062[_0xef1c('0x14')][_0xef1c('0x16')]);return _0x1c9a7f(_0x415062['error'][_0xef1c('0x16')]);}else{logger[_0xef1c('0x17')](_0xef1c('0x10'),_0x337bd2,_0xef1c('0x11'));_0x1c9a7f(_0x415062['result']['message']);}})[_0xef1c('0x18')](function(_0xcfb95e){logger[_0xef1c('0x14')](_0xef1c('0x10'),_0x337bd2,_0xcfb95e);_0x192368(_0xcfb95e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6a402b6..d41738b 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 _0x2f51=['emit','removeListener','./dashboardItem.events','save','remove','update'];(function(_0x3f03e1,_0x56dd51){var _0x38e8fd=function(_0xe76703){while(--_0xe76703){_0x3f03e1['push'](_0x3f03e1['shift']());}};_0x38e8fd(++_0x56dd51);}(_0x2f51,0xbc));var _0x12f5=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x2f51[_0x5a26f5];return _0x2e9ef7;};'use strict';var DashboardItemEvents=require(_0x12f5('0x0'));var events=[_0x12f5('0x1'),_0x12f5('0x2'),_0x12f5('0x3')];function createListener(_0x7ec0dc,_0x1be619){return function(_0x1a43ea){_0x1be619[_0x12f5('0x4')](_0x7ec0dc,_0x1a43ea);};}function removeListener(_0x3307d7,_0x5d45c5){return function(){DashboardItemEvents[_0x12f5('0x5')](_0x3307d7,_0x5d45c5);};}exports['register']=function(_0x220541){for(var _0x5c2906=0x0,_0x154eca=events['length'];_0x5c2906<_0x154eca;_0x5c2906++){var _0x4022eb=events[_0x5c2906];var _0x590bb5=createListener('dashboardItem:'+_0x4022eb,_0x220541);DashboardItemEvents['on'](_0x4022eb,_0x590bb5);}}; \ No newline at end of file +var _0xd31e=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x1532b3,_0x119091){var _0x496061=function(_0x4c3fa3){while(--_0x4c3fa3){_0x1532b3['push'](_0x1532b3['shift']());}};_0x496061(++_0x119091);}(_0xd31e,0x9e));var _0xed31=function(_0x1c999a,_0xf8663a){_0x1c999a=_0x1c999a-0x0;var _0x7b159=_0xd31e[_0x1c999a];return _0x7b159;};'use strict';var DashboardItemEvents=require(_0xed31('0x0'));var events=[_0xed31('0x1'),'remove',_0xed31('0x2')];function createListener(_0x4e35cc,_0x10c2bd){return function(_0x503d67){_0x10c2bd[_0xed31('0x3')](_0x4e35cc,_0x503d67);};}function removeListener(_0x1e6c82,_0x4576a8){return function(){DashboardItemEvents[_0xed31('0x4')](_0x1e6c82,_0x4576a8);};}exports[_0xed31('0x5')]=function(_0x46ee0b){for(var _0x31ebbe=0x0,_0x309747=events[_0xed31('0x6')];_0x31ebbe<_0x309747;_0x31ebbe++){var _0x16c213=events[_0x31ebbe];var _0xac5d9a=createListener(_0xed31('0x7')+_0x16c213,_0x46ee0b);DashboardItemEvents['on'](_0x16c213,_0xac5d9a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4da6733..c27e5b5 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 _0x59dd=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','put','update','destroy','multer'];(function(_0x3b79b8,_0x44f181){var _0x4821ab=function(_0x5e0330){while(--_0x5e0330){_0x3b79b8['push'](_0x3b79b8['shift']());}};_0x4821ab(++_0x44f181);}(_0x59dd,0x1c1));var _0xd59d=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x59dd[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0xd59d('0x0'));var util=require(_0xd59d('0x1'));var path=require(_0xd59d('0x2'));var timeout=require('connect-timeout');var express=require(_0xd59d('0x3'));var router=express[_0xd59d('0x4')]();var fs_extra=require(_0xd59d('0x5'));var auth=require(_0xd59d('0x6'));var interaction=require(_0xd59d('0x7'));var config=require(_0xd59d('0x8'));var controller=require(_0xd59d('0x9'));router[_0xd59d('0xa')](_0xd59d('0xb'),auth['isAuthenticated'](),controller[_0xd59d('0xc')]);router[_0xd59d('0xd')]('/',auth[_0xd59d('0xe')](),controller['create']);router[_0xd59d('0xf')](_0xd59d('0xb'),auth[_0xd59d('0xe')](),controller[_0xd59d('0x10')]);router['delete'](_0xd59d('0xb'),auth[_0xd59d('0xe')](),controller[_0xd59d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc44c=['multer','express','fs-extra','../../config/environment','get','/:id','isAuthenticated','show','create','put','update','delete','exports'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xc44c,0x82));var _0xcc44=function(_0xe5324f,_0x4d3030){_0xe5324f=_0xe5324f-0x0;var _0x4ad17d=_0xc44c[_0xe5324f];return _0x4ad17d;};'use strict';var multer=require(_0xcc44('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc44('0x1'));var router=express['Router']();var fs_extra=require(_0xcc44('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc44('0x3'));var controller=require('./dashboardItem.controller');router[_0xcc44('0x4')](_0xcc44('0x5'),auth[_0xcc44('0x6')](),controller[_0xcc44('0x7')]);router['post']('/',auth[_0xcc44('0x6')](),controller[_0xcc44('0x8')]);router[_0xcc44('0x9')]('/:id',auth[_0xcc44('0x6')](),controller[_0xcc44('0xa')]);router[_0xcc44('0xb')](_0xcc44('0x5'),auth[_0xcc44('0x6')](),controller['destroy']);module[_0xcc44('0xc')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5e171fa..a534605 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 _0x2d46=['first','second','third','sequelize','exports','ENUM'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2d46,0xf9));var _0x62d4=function(_0x37b4a1,_0x583392){_0x37b4a1=_0x37b4a1-0x0;var _0x4e968d=_0x2d46[_0x37b4a1];return _0x4e968d;};'use strict';var Sequelize=require(_0x62d4('0x0'));module[_0x62d4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x62d4('0x2')](_0x62d4('0x3'),_0x62d4('0x4'),_0x62d4('0x5')),'allowNull':![],'defaultValue':_0x62d4('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x99e1=['ENUM','first','second','third','STRING'];(function(_0x395fea,_0x40a421){var _0x54b58c=function(_0xd48750){while(--_0xd48750){_0x395fea['push'](_0x395fea['shift']());}};_0x54b58c(++_0x40a421);}(_0x99e1,0x1df));var _0x199e=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x99e1[_0x238671];return _0x474844;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x199e('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x199e('0x1')](_0x199e('0x2'),_0x199e('0x3'),_0x199e('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x199e('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6797953..e99ed6b 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 _0xc765=['lodash','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0xab8706,_0x19237e){var _0x2c7f1d=function(_0x592fed){while(--_0x592fed){_0xab8706['push'](_0xab8706['shift']());}};_0x2c7f1d(++_0x19237e);}(_0xc765,0xf5));var _0x5c76=function(_0x564801,_0x2ff0e2){_0x564801=_0x564801-0x0;var _0x10bb38=_0xc765[_0x564801];return _0x10bb38;};'use strict';var emlformat=require(_0x5c76('0x0'));var rimraf=require(_0x5c76('0x1'));var zipdir=require(_0x5c76('0x2'));var jsonpatch=require(_0x5c76('0x3'));var rp=require(_0x5c76('0x4'));var moment=require(_0x5c76('0x5'));var BPromise=require(_0x5c76('0x6'));var Mustache=require(_0x5c76('0x7'));var util=require('util');var path=require(_0x5c76('0x8'));var sox=require(_0x5c76('0x9'));var csv=require(_0x5c76('0xa'));var ejs=require(_0x5c76('0xb'));var fs=require('fs');var fs_extra=require(_0x5c76('0xc'));var _=require(_0x5c76('0xd'));var squel=require(_0x5c76('0xe'));var crypto=require(_0x5c76('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5c76('0x10'));var toCsv=require(_0x5c76('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c76('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c76('0x12'));var logger=require(_0x5c76('0x13'))(_0x5c76('0x14'));var utils=require(_0x5c76('0x15'));var config=require(_0x5c76('0x16'));var licenseUtil=require(_0x5c76('0x17'));var db=require(_0x5c76('0x18'))['db'];function respondWithStatusCode(_0xed1589,_0x393bd1){_0x393bd1=_0x393bd1||0xcc;return function(_0x1ebfe6){if(_0x1ebfe6){return _0xed1589[_0x5c76('0x19')](_0x393bd1);}return _0xed1589['status'](_0x393bd1)['end']();};}function respondWithResult(_0x386723,_0x46b2b4){_0x46b2b4=_0x46b2b4||0xc8;return function(_0x50d350){if(_0x50d350){return _0x386723[_0x5c76('0x1a')](_0x46b2b4)['json'](_0x50d350);}};}function respondWithFilteredResult(_0x1f9002,_0x52e5ca){return function(_0x524111){if(_0x524111){var _0x42319a=typeof _0x52e5ca['offset']===_0x5c76('0x1b')&&typeof _0x52e5ca[_0x5c76('0x1c')]===_0x5c76('0x1b');var _0x4d2fa2=_0x524111[_0x5c76('0x1d')];var _0x7ddf25=_0x42319a?0x0:_0x52e5ca[_0x5c76('0x1e')];var _0x287603=_0x42319a?_0x524111[_0x5c76('0x1d')]:_0x52e5ca[_0x5c76('0x1e')]+_0x52e5ca[_0x5c76('0x1c')];var _0x3abe81;if(_0x287603>=_0x4d2fa2){_0x287603=_0x4d2fa2;_0x3abe81=0xc8;}else{_0x3abe81=0xce;}_0x1f9002[_0x5c76('0x1a')](_0x3abe81);return _0x1f9002[_0x5c76('0x1f')](_0x5c76('0x20'),_0x7ddf25+'-'+_0x287603+'/'+_0x4d2fa2)[_0x5c76('0x21')](_0x524111);}return null;};}function patchUpdates(_0x4d9ff){return function(_0x7a13f){try{jsonpatch[_0x5c76('0x22')](_0x7a13f,_0x4d9ff,!![]);}catch(_0x270fb1){return BPromise['reject'](_0x270fb1);}return _0x7a13f[_0x5c76('0x23')]();};}function saveUpdates(_0x55c63d,_0x101932){return function(_0x4470c1){if(_0x4470c1){return _0x4470c1[_0x5c76('0x24')](_0x55c63d)[_0x5c76('0x25')](function(_0x1894f5){return _0x1894f5;});}return null;};}function removeEntity(_0x4ddd87,_0x4e5ddc){return function(_0x3c68be){if(_0x3c68be){return _0x3c68be[_0x5c76('0x26')]()[_0x5c76('0x25')](function(){var _0x5e9249=_0x3c68be[_0x5c76('0x27')]({'plain':!![]});var _0x177bc6=_0x5c76('0x28');return db[_0x5c76('0x29')]['destroy']({'where':{'type':_0x177bc6,'resourceId':_0x5e9249['id']}})[_0x5c76('0x25')](function(){return _0x3c68be;});})['then'](function(){_0x4ddd87[_0x5c76('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285a4a,_0x3fa964){return function(_0x5976e1){if(!_0x5976e1){_0x285a4a[_0x5c76('0x19')](0x194);}return _0x5976e1;};}function handleError(_0x51d4d8,_0x523a3a){_0x523a3a=_0x523a3a||0x1f4;return function(_0x1384c4){logger['error'](_0x1384c4['stack']);if(_0x1384c4[_0x5c76('0x2a')]){delete _0x1384c4['name'];}_0x51d4d8[_0x5c76('0x1a')](_0x523a3a)[_0x5c76('0x2b')](_0x1384c4);};}exports[_0x5c76('0x2c')]=function(_0x212731,_0x527f3a){var _0x3feb7f={},_0x243e74={},_0x43821e={'count':0x0,'rows':[]};var _0x599883=_['map'](db[_0x5c76('0x2d')][_0x5c76('0x2e')],function(_0x1f5d23){return{'name':_0x1f5d23[_0x5c76('0x2f')],'type':_0x1f5d23[_0x5c76('0x30')][_0x5c76('0x31')]};});_0x243e74[_0x5c76('0x32')]=_['map'](_0x599883,_0x5c76('0x2a'));_0x243e74[_0x5c76('0x33')]=_[_0x5c76('0x34')](_0x212731[_0x5c76('0x33')]);_0x243e74['filters']=_['intersection'](_0x243e74[_0x5c76('0x32')],_0x243e74['query']);_0x3feb7f[_0x5c76('0x35')]=_[_0x5c76('0x36')](_0x243e74[_0x5c76('0x32')],qs['fields'](_0x212731[_0x5c76('0x33')]['fields']));_0x3feb7f[_0x5c76('0x35')]=_0x3feb7f[_0x5c76('0x35')][_0x5c76('0x37')]?_0x3feb7f[_0x5c76('0x35')]:_0x243e74[_0x5c76('0x32')];if(!_0x212731[_0x5c76('0x33')][_0x5c76('0x38')](_0x5c76('0x39'))){_0x3feb7f[_0x5c76('0x1c')]=qs[_0x5c76('0x1c')](_0x212731[_0x5c76('0x33')][_0x5c76('0x1c')]);_0x3feb7f[_0x5c76('0x1e')]=qs[_0x5c76('0x1e')](_0x212731['query']['offset']);}_0x3feb7f[_0x5c76('0x3a')]=qs[_0x5c76('0x3b')](_0x212731[_0x5c76('0x33')][_0x5c76('0x3b')]);_0x3feb7f[_0x5c76('0x3c')]=qs[_0x5c76('0x3d')](_[_0x5c76('0x3e')](_0x212731[_0x5c76('0x33')],_0x243e74[_0x5c76('0x3d')]),_0x599883);if(_0x212731[_0x5c76('0x33')][_0x5c76('0x3f')]){_0x3feb7f[_0x5c76('0x3c')]=_[_0x5c76('0x40')](_0x3feb7f[_0x5c76('0x3c')],{'$or':_[_0x5c76('0x41')](_0x599883,function(_0x6c9395){if(_0x6c9395[_0x5c76('0x30')]!==_0x5c76('0x42')){var _0x359bda={};_0x359bda[_0x6c9395[_0x5c76('0x2a')]]={'$like':'%'+_0x212731[_0x5c76('0x33')][_0x5c76('0x3f')]+'%'};return _0x359bda;}})});}_0x3feb7f=_[_0x5c76('0x40')]({},_0x3feb7f,_0x212731[_0x5c76('0x43')]);var _0x23a24a={'where':_0x3feb7f[_0x5c76('0x3c')]};return db[_0x5c76('0x2d')][_0x5c76('0x1d')](_0x23a24a)[_0x5c76('0x25')](function(_0x48c4b2){_0x43821e[_0x5c76('0x1d')]=_0x48c4b2;if(_0x212731[_0x5c76('0x33')][_0x5c76('0x44')]){_0x3feb7f[_0x5c76('0x45')]=[{'all':!![]}];}return db[_0x5c76('0x2d')][_0x5c76('0x46')](_0x3feb7f);})[_0x5c76('0x25')](function(_0x14a9d3){_0x43821e[_0x5c76('0x47')]=_0x14a9d3;return _0x43821e;})[_0x5c76('0x25')](respondWithFilteredResult(_0x527f3a,_0x3feb7f))[_0x5c76('0x48')](handleError(_0x527f3a,null));};exports[_0x5c76('0x49')]=function(_0x2bce4a,_0x5e205d){var _0x22254b={'raw':!![],'where':{'id':_0x2bce4a[_0x5c76('0x4a')]['id']}},_0x5c43d4={};_0x5c43d4[_0x5c76('0x32')]=_[_0x5c76('0x34')](db[_0x5c76('0x2d')][_0x5c76('0x2e')]);_0x5c43d4[_0x5c76('0x33')]=_[_0x5c76('0x34')](_0x2bce4a[_0x5c76('0x33')]);_0x5c43d4[_0x5c76('0x3d')]=_[_0x5c76('0x36')](_0x5c43d4['model'],_0x5c43d4['query']);_0x22254b['attributes']=_[_0x5c76('0x36')](_0x5c43d4['model'],qs[_0x5c76('0x4b')](_0x2bce4a[_0x5c76('0x33')][_0x5c76('0x4b')]));_0x22254b['attributes']=_0x22254b[_0x5c76('0x35')][_0x5c76('0x37')]?_0x22254b['attributes']:_0x5c43d4['model'];if(_0x2bce4a[_0x5c76('0x33')][_0x5c76('0x44')]){_0x22254b[_0x5c76('0x45')]=[{'all':!![]}];}_0x22254b=_['merge']({},_0x22254b,_0x2bce4a[_0x5c76('0x43')]);return db['Disposition'][_0x5c76('0x4c')](_0x22254b)[_0x5c76('0x25')](handleEntityNotFound(_0x5e205d,null))[_0x5c76('0x25')](respondWithResult(_0x5e205d,null))[_0x5c76('0x48')](handleError(_0x5e205d,null));};exports['create']=function(_0x76580e,_0x25722c){return db[_0x5c76('0x2d')]['create'](_0x76580e[_0x5c76('0x4d')],{})[_0x5c76('0x25')](function(_0x4a916b){var _0x29142a=_0x76580e[_0x5c76('0x4e')][_0x5c76('0x27')]({'plain':!![]});if(!_0x29142a)throw new Error(_0x5c76('0x4f'));if(_0x29142a['role']==='user'){var _0x2c0df0=_0x4a916b['get']({'plain':!![]});var _0x40eaa9=_0x5c76('0x28');return db[_0x5c76('0x50')][_0x5c76('0x4c')]({'where':{'name':_0x40eaa9,'userProfileId':_0x29142a[_0x5c76('0x51')]},'raw':!![]})[_0x5c76('0x25')](function(_0x3e1a1f){if(_0x3e1a1f&&_0x3e1a1f[_0x5c76('0x52')]===0x0){return db['UserProfileResource'][_0x5c76('0x53')]({'name':_0x2c0df0[_0x5c76('0x2a')],'resourceId':_0x2c0df0['id'],'type':_0x3e1a1f[_0x5c76('0x2a')],'sectionId':_0x3e1a1f['id']},{})[_0x5c76('0x25')](function(){return _0x4a916b;});}else{return _0x4a916b;}})[_0x5c76('0x48')](function(_0x5ab211){logger[_0x5c76('0x54')](_0x5c76('0x55'),_0x5ab211);throw _0x5ab211;});}return _0x4a916b;})['then'](respondWithResult(_0x25722c,0xc9))[_0x5c76('0x48')](handleError(_0x25722c,null));};exports[_0x5c76('0x24')]=function(_0x1b35da,_0x1f18ee){if(_0x1b35da[_0x5c76('0x4d')]['id']){delete _0x1b35da['body']['id'];}return db[_0x5c76('0x2d')][_0x5c76('0x4c')]({'where':{'id':_0x1b35da[_0x5c76('0x4a')]['id']}})[_0x5c76('0x25')](handleEntityNotFound(_0x1f18ee,null))[_0x5c76('0x25')](saveUpdates(_0x1b35da[_0x5c76('0x4d')],null))[_0x5c76('0x25')](respondWithResult(_0x1f18ee,null))[_0x5c76('0x48')](handleError(_0x1f18ee,null));};exports[_0x5c76('0x26')]=function(_0xe71441,_0x22671d){return db[_0x5c76('0x2d')]['find']({'where':{'id':_0xe71441[_0x5c76('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22671d,null))[_0x5c76('0x25')](removeEntity(_0x22671d,null))[_0x5c76('0x48')](handleError(_0x22671d,null));}; \ No newline at end of file +var _0x46aa=['type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','error','name','index','Disposition','rawAttributes','fieldName'];(function(_0x48ba18,_0xef974d){var _0x2b104f=function(_0x11c675){while(--_0x11c675){_0x48ba18['push'](_0x48ba18['shift']());}};_0x2b104f(++_0xef974d);}(_0x46aa,0xcb));var _0xa46a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x46aa[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa46a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa46a('0x1'));var rp=require(_0xa46a('0x2'));var moment=require(_0xa46a('0x3'));var BPromise=require(_0xa46a('0x4'));var Mustache=require(_0xa46a('0x5'));var util=require(_0xa46a('0x6'));var path=require(_0xa46a('0x7'));var sox=require(_0xa46a('0x8'));var csv=require(_0xa46a('0x9'));var ejs=require(_0xa46a('0xa'));var fs=require('fs');var fs_extra=require(_0xa46a('0xb'));var _=require(_0xa46a('0xc'));var squel=require('squel');var crypto=require(_0xa46a('0xd'));var jsforce=require(_0xa46a('0xe'));var deskjs=require(_0xa46a('0xf'));var toCsv=require(_0xa46a('0x9'));var querystring=require('querystring');var Papa=require(_0xa46a('0x10'));var Redis=require(_0xa46a('0x11'));var authService=require(_0xa46a('0x12'));var qs=require(_0xa46a('0x13'));var as=require(_0xa46a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa46a('0x15'))(_0xa46a('0x16'));var utils=require('../../config/utils');var config=require(_0xa46a('0x17'));var licenseUtil=require(_0xa46a('0x18'));var db=require(_0xa46a('0x19'))['db'];function respondWithStatusCode(_0x3f9fe1,_0x2720c4){_0x2720c4=_0x2720c4||0xcc;return function(_0x2eda0b){if(_0x2eda0b){return _0x3f9fe1[_0xa46a('0x1a')](_0x2720c4);}return _0x3f9fe1[_0xa46a('0x1b')](_0x2720c4)[_0xa46a('0x1c')]();};}function respondWithResult(_0x35d9ef,_0x447e77){_0x447e77=_0x447e77||0xc8;return function(_0x29577b){if(_0x29577b){return _0x35d9ef[_0xa46a('0x1b')](_0x447e77)[_0xa46a('0x1d')](_0x29577b);}};}function respondWithFilteredResult(_0x43626e,_0x16bff4){return function(_0x362b80){if(_0x362b80){var _0x1bdd55=typeof _0x16bff4[_0xa46a('0x1e')]===_0xa46a('0x1f')&&typeof _0x16bff4[_0xa46a('0x20')]===_0xa46a('0x1f');var _0x4867c1=_0x362b80[_0xa46a('0x21')];var _0x4fdc40=_0x1bdd55?0x0:_0x16bff4[_0xa46a('0x1e')];var _0x529921=_0x1bdd55?_0x362b80[_0xa46a('0x21')]:_0x16bff4['offset']+_0x16bff4[_0xa46a('0x20')];var _0x56bd73;if(_0x529921>=_0x4867c1){_0x529921=_0x4867c1;_0x56bd73=0xc8;}else{_0x56bd73=0xce;}_0x43626e[_0xa46a('0x1b')](_0x56bd73);return _0x43626e[_0xa46a('0x22')]('Content-Range',_0x4fdc40+'-'+_0x529921+'/'+_0x4867c1)[_0xa46a('0x1d')](_0x362b80);}return null;};}function patchUpdates(_0x379a08){return function(_0x5d1dfc){try{jsonpatch[_0xa46a('0x23')](_0x5d1dfc,_0x379a08,!![]);}catch(_0x1c6c8f){return BPromise[_0xa46a('0x24')](_0x1c6c8f);}return _0x5d1dfc[_0xa46a('0x25')]();};}function saveUpdates(_0x441837,_0x3d491e){return function(_0x24bc6a){if(_0x24bc6a){return _0x24bc6a['update'](_0x441837)['then'](function(_0x4c0500){return _0x4c0500;});}return null;};}function removeEntity(_0x668e0f,_0xe2f0b5){return function(_0x437dee){if(_0x437dee){return _0x437dee[_0xa46a('0x26')]()[_0xa46a('0x27')](function(){var _0x3eaa47=_0x437dee[_0xa46a('0x28')]({'plain':!![]});var _0x202f91=_0xa46a('0x29');return db[_0xa46a('0x2a')][_0xa46a('0x26')]({'where':{'type':_0x202f91,'resourceId':_0x3eaa47['id']}})['then'](function(){return _0x437dee;});})[_0xa46a('0x27')](function(){_0x668e0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec51a,_0x344924){return function(_0x1c3c04){if(!_0x1c3c04){_0x2ec51a[_0xa46a('0x1a')](0x194);}return _0x1c3c04;};}function handleError(_0x375f1e,_0x4079aa){_0x4079aa=_0x4079aa||0x1f4;return function(_0xfeb33d){logger[_0xa46a('0x2b')](_0xfeb33d['stack']);if(_0xfeb33d['name']){delete _0xfeb33d[_0xa46a('0x2c')];}_0x375f1e[_0xa46a('0x1b')](_0x4079aa)['send'](_0xfeb33d);};}exports[_0xa46a('0x2d')]=function(_0x4f7ba5,_0x28780c){var _0x5a4219={},_0xe807b6={},_0x350fec={'count':0x0,'rows':[]};var _0x9235cb=_['map'](db[_0xa46a('0x2e')][_0xa46a('0x2f')],function(_0x313f62){return{'name':_0x313f62[_0xa46a('0x30')],'type':_0x313f62[_0xa46a('0x31')]['key']};});_0xe807b6['model']=_['map'](_0x9235cb,_0xa46a('0x2c'));_0xe807b6[_0xa46a('0x32')]=_[_0xa46a('0x33')](_0x4f7ba5[_0xa46a('0x32')]);_0xe807b6[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],_0xe807b6[_0xa46a('0x32')]);_0x5a4219[_0xa46a('0x37')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],qs[_0xa46a('0x38')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x38')]));_0x5a4219[_0xa46a('0x37')]=_0x5a4219[_0xa46a('0x37')]['length']?_0x5a4219[_0xa46a('0x37')]:_0xe807b6['model'];if(!_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x39')](_0xa46a('0x3a'))){_0x5a4219[_0xa46a('0x20')]=qs[_0xa46a('0x20')](_0x4f7ba5['query'][_0xa46a('0x20')]);_0x5a4219['offset']=qs[_0xa46a('0x1e')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x1e')]);}_0x5a4219['order']=qs[_0xa46a('0x3b')](_0x4f7ba5[_0xa46a('0x32')]['sort']);_0x5a4219[_0xa46a('0x3c')]=qs['filters'](_[_0xa46a('0x3d')](_0x4f7ba5['query'],_0xe807b6[_0xa46a('0x34')]),_0x9235cb);if(_0x4f7ba5[_0xa46a('0x32')]['filter']){_0x5a4219[_0xa46a('0x3c')]=_[_0xa46a('0x3e')](_0x5a4219['where'],{'$or':_[_0xa46a('0x3f')](_0x9235cb,function(_0x3f48ba){if(_0x3f48ba[_0xa46a('0x31')]!==_0xa46a('0x40')){var _0x518732={};_0x518732[_0x3f48ba[_0xa46a('0x2c')]]={'$like':'%'+_0x4f7ba5[_0xa46a('0x32')]['filter']+'%'};return _0x518732;}})});}_0x5a4219=_[_0xa46a('0x3e')]({},_0x5a4219,_0x4f7ba5[_0xa46a('0x41')]);var _0x1bd8f2={'where':_0x5a4219[_0xa46a('0x3c')]};return db['Disposition'][_0xa46a('0x21')](_0x1bd8f2)['then'](function(_0x2ef5ef){_0x350fec[_0xa46a('0x21')]=_0x2ef5ef;if(_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x42')]){_0x5a4219[_0xa46a('0x43')]=[{'all':!![]}];}return db[_0xa46a('0x2e')][_0xa46a('0x44')](_0x5a4219);})[_0xa46a('0x27')](function(_0x27aca7){_0x350fec[_0xa46a('0x45')]=_0x27aca7;return _0x350fec;})[_0xa46a('0x27')](respondWithFilteredResult(_0x28780c,_0x5a4219))[_0xa46a('0x46')](handleError(_0x28780c,null));};exports[_0xa46a('0x47')]=function(_0x54bbfb,_0x1d5811){var _0x329015={'raw':!![],'where':{'id':_0x54bbfb['params']['id']}},_0x3cd4d1={};_0x3cd4d1[_0xa46a('0x36')]=_[_0xa46a('0x33')](db[_0xa46a('0x2e')]['rawAttributes']);_0x3cd4d1[_0xa46a('0x32')]=_['keys'](_0x54bbfb[_0xa46a('0x32')]);_0x3cd4d1[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0x3cd4d1[_0xa46a('0x36')],_0x3cd4d1['query']);_0x329015['attributes']=_[_0xa46a('0x35')](_0x3cd4d1['model'],qs[_0xa46a('0x38')](_0x54bbfb[_0xa46a('0x32')][_0xa46a('0x38')]));_0x329015[_0xa46a('0x37')]=_0x329015['attributes'][_0xa46a('0x48')]?_0x329015[_0xa46a('0x37')]:_0x3cd4d1[_0xa46a('0x36')];if(_0x54bbfb['query'][_0xa46a('0x42')]){_0x329015[_0xa46a('0x43')]=[{'all':!![]}];}_0x329015=_[_0xa46a('0x3e')]({},_0x329015,_0x54bbfb['options']);return db[_0xa46a('0x2e')][_0xa46a('0x49')](_0x329015)['then'](handleEntityNotFound(_0x1d5811,null))[_0xa46a('0x27')](respondWithResult(_0x1d5811,null))[_0xa46a('0x46')](handleError(_0x1d5811,null));};exports[_0xa46a('0x4a')]=function(_0x1d0265,_0x2ba18a){return db[_0xa46a('0x2e')][_0xa46a('0x4a')](_0x1d0265['body'],{})[_0xa46a('0x27')](function(_0x1b28ad){var _0x25f44c=_0x1d0265[_0xa46a('0x4b')][_0xa46a('0x28')]({'plain':!![]});if(!_0x25f44c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f44c[_0xa46a('0x4c')]===_0xa46a('0x4b')){var _0x2688b8=_0x1b28ad[_0xa46a('0x28')]({'plain':!![]});var _0x2609be=_0xa46a('0x29');return db[_0xa46a('0x4d')][_0xa46a('0x49')]({'where':{'name':_0x2609be,'userProfileId':_0x25f44c[_0xa46a('0x4e')]},'raw':!![]})[_0xa46a('0x27')](function(_0x2f1530){if(_0x2f1530&&_0x2f1530[_0xa46a('0x4f')]===0x0){return db[_0xa46a('0x2a')]['create']({'name':_0x2688b8[_0xa46a('0x2c')],'resourceId':_0x2688b8['id'],'type':_0x2f1530[_0xa46a('0x2c')],'sectionId':_0x2f1530['id']},{})['then'](function(){return _0x1b28ad;});}else{return _0x1b28ad;}})[_0xa46a('0x46')](function(_0x405b40){logger['error'](_0xa46a('0x50'),_0x405b40);throw _0x405b40;});}return _0x1b28ad;})[_0xa46a('0x27')](respondWithResult(_0x2ba18a,0xc9))[_0xa46a('0x46')](handleError(_0x2ba18a,null));};exports[_0xa46a('0x51')]=function(_0x1532d4,_0x223acd){if(_0x1532d4[_0xa46a('0x52')]['id']){delete _0x1532d4[_0xa46a('0x52')]['id'];}return db['Disposition']['find']({'where':{'id':_0x1532d4[_0xa46a('0x53')]['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x223acd,null))['then'](saveUpdates(_0x1532d4[_0xa46a('0x52')],null))[_0xa46a('0x27')](respondWithResult(_0x223acd,null))[_0xa46a('0x46')](handleError(_0x223acd,null));};exports[_0xa46a('0x26')]=function(_0x52971f,_0x33a255){return db['Disposition']['find']({'where':{'id':_0x52971f['params']['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x33a255,null))[_0xa46a('0x27')](removeEntity(_0x33a255,null))[_0xa46a('0x46')](handleError(_0x33a255,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index bff54b0..8c1a136 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 _0x16e9=['MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','path','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId'];(function(_0xb69212,_0x20e69b){var _0x475476=function(_0x96ab23){while(--_0x96ab23){_0xb69212['push'](_0xb69212['shift']());}};_0x475476(++_0x20e69b);}(_0x16e9,0x14b));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x916e('0x0'));var util=require(_0x916e('0x1'));var logger=require(_0x916e('0x2'))('api');var moment=require(_0x916e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x916e('0x4'));var rimraf=require('rimraf');var config=require(_0x916e('0x5'));var attributes=require(_0x916e('0x6'));module['exports']=function(_0x44f83f,_0x4e4b05){return _0x44f83f['define'](_0x916e('0x7'),attributes,{'tableName':_0x916e('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x916e('0x9'),'fields':['name',_0x916e('0xa')]},{'unique':!![],'name':_0x916e('0xb'),'fields':[_0x916e('0xc'),_0x916e('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x916e('0xc'),_0x916e('0xe')]},{'unique':!![],'name':_0x916e('0xf'),'fields':[_0x916e('0xc'),_0x916e('0x10')]},{'unique':!![],'name':_0x916e('0x11'),'fields':[_0x916e('0xc'),_0x916e('0x12')]},{'unique':!![],'name':_0x916e('0x13'),'fields':[_0x916e('0xc'),_0x916e('0x14')]},{'unique':!![],'name':_0x916e('0x15'),'fields':[_0x916e('0xc'),_0x916e('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b95=['./disposition.attributes','exports','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x2b95,0xa9));var _0x52b9=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x2b95[_0xae1a83];return _0xdb9da8;};'use strict';var _=require(_0x52b9('0x0'));var util=require(_0x52b9('0x1'));var logger=require(_0x52b9('0x2'))('api');var moment=require(_0x52b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x52b9('0x4'));var fs=require('fs');var path=require(_0x52b9('0x5'));var rimraf=require(_0x52b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x52b9('0x7'));module[_0x52b9('0x8')]=function(_0x20694d,_0xab50d5){return _0x20694d['define']('Disposition',attributes,{'tableName':_0x52b9('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x52b9('0xa'),_0x52b9('0xb')]},{'unique':!![],'name':_0x52b9('0xc'),'fields':[_0x52b9('0xa'),_0x52b9('0xd')]},{'unique':!![],'name':_0x52b9('0xe'),'fields':['name',_0x52b9('0xf')]},{'unique':!![],'name':_0x52b9('0x10'),'fields':[_0x52b9('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x52b9('0x11'),'fields':['name',_0x52b9('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x52b9('0xa'),_0x52b9('0x13')]},{'unique':!![],'name':_0x52b9('0x14'),'fields':[_0x52b9('0xa'),_0x52b9('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8454208..02987b5 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(_0x165dd1,_0x31c535){var _0x510ed5=function(_0x3c8bac){while(--_0x3c8bac){_0x165dd1['push'](_0x165dd1['shift']());}};_0x510ed5(++_0x31c535);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x56e0cf,_0x35e8c9){var _0x57ab04=function(_0x2f8bcf){while(--_0x2f8bcf){_0x56e0cf['push'](_0x56e0cf['shift']());}};_0x57ab04(++_0x35e8c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 e535b21..ed3fe3e 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 _0x04cc=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x25532a,_0x4d7b82){var _0x10e57d=function(_0x358f2a){while(--_0x358f2a){_0x25532a['push'](_0x25532a['shift']());}};_0x10e57d(++_0x4d7b82);}(_0x04cc,0x1c9));var _0xc04c=function(_0x30aa4d,_0x2b360f){_0x30aa4d=_0x30aa4d-0x0;var _0x16fc87=_0x04cc[_0x30aa4d];return _0x16fc87;};'use strict';var multer=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var path=require(_0xc04c('0x2'));var timeout=require('connect-timeout');var express=require(_0xc04c('0x3'));var router=express[_0xc04c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc04c('0x5'));var interaction=require(_0xc04c('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xc04c('0x7')]('/',auth[_0xc04c('0x8')](),controller['index']);router['get'](_0xc04c('0x9'),auth[_0xc04c('0x8')](),controller[_0xc04c('0xa')]);router[_0xc04c('0xb')]('/',auth[_0xc04c('0x8')](),controller['create']);router[_0xc04c('0xc')]('/:id',auth[_0xc04c('0x8')](),controller[_0xc04c('0xd')]);router[_0xc04c('0xe')](_0xc04c('0x9'),auth[_0xc04c('0x8')](),controller[_0xc04c('0xf')]);module[_0xc04c('0x10')]=router; \ No newline at end of file +var _0x4db8=['./disposition.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1b02ff,_0x3c0609){var _0x48f92d=function(_0x1fa867){while(--_0x1fa867){_0x1b02ff['push'](_0x1b02ff['shift']());}};_0x48f92d(++_0x3c0609);}(_0x4db8,0x10f));var _0x84db=function(_0x5230b4,_0x22faa4){_0x5230b4=_0x5230b4-0x0;var _0x286949=_0x4db8[_0x5230b4];return _0x286949;};'use strict';var multer=require(_0x84db('0x0'));var util=require(_0x84db('0x1'));var path=require(_0x84db('0x2'));var timeout=require(_0x84db('0x3'));var express=require(_0x84db('0x4'));var router=express[_0x84db('0x5')]();var fs_extra=require(_0x84db('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x84db('0x7'));var config=require(_0x84db('0x8'));var controller=require(_0x84db('0x9'));router[_0x84db('0xa')]('/',auth[_0x84db('0xb')](),controller[_0x84db('0xc')]);router[_0x84db('0xa')]('/:id',auth[_0x84db('0xb')](),controller[_0x84db('0xd')]);router[_0x84db('0xe')]('/',auth[_0x84db('0xb')](),controller[_0x84db('0xf')]);router[_0x84db('0x10')](_0x84db('0x11'),auth[_0x84db('0xb')](),controller[_0x84db('0x12')]);router[_0x84db('0x13')](_0x84db('0x11'),auth[_0x84db('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dad6210..62a3994 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 _0x13f5=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x321016,_0x21ca0c){var _0x153f70=function(_0x5a3da5){while(--_0x5a3da5){_0x321016['push'](_0x321016['shift']());}};_0x153f70(++_0x21ca0c);}(_0x13f5,0xc3));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x513f('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x513f('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x513f('0x4')},'localstationid':{'type':Sequelize[_0x513f('0x2')],'unique':_0x513f('0x5')},'minrate':{'type':Sequelize[_0x513f('0x6')](_0x513f('0x7'),_0x513f('0x8'),_0x513f('0x9'),_0x513f('0xa'),_0x513f('0xb'),_0x513f('0xc')),'defaultValue':_0x513f('0x8')},'maxrate':{'type':Sequelize[_0x513f('0x6')]('2400',_0x513f('0x8'),_0x513f('0x9'),_0x513f('0xa'),_0x513f('0xb'),_0x513f('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x513f('0x2')],'defaultValue':_0x513f('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x513f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x513f('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x513f('0x6')](_0x513f('0xf'),_0x513f('0x10'),_0x513f('0x11'),_0x513f('0x12')),'defaultValue':_0x513f('0xf')},'key':{'type':Sequelize[_0x513f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x513f('0x13')],'defaultValue':function(){return _0x513f('0x14');}},'notificationSound':{'type':Sequelize[_0x513f('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x513f('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x513f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x513f('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x513f('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x513f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x513f('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x513f('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x513f('0x15')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e7dd3){if(!_0x4e7dd3)this[_0x513f('0x17')]('mandatoryDispositionPauseId',null);this[_0x513f('0x17')]('mandatoryDisposition',_0x4e7dd3);}}}; \ No newline at end of file +var _0x4300=['SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','yes','STRING','xCALLY\x20Motion\x20Fax','ENUM','4800','9600','12000','14400','2400','7200','v17,v27,v29','INTEGER','DADHI','KHOMP'];(function(_0x470a8d,_0x1cacb6){var _0x4ee204=function(_0x3696b0){while(--_0x3696b0){_0x470a8d['push'](_0x470a8d['shift']());}};_0x4ee204(++_0x1cacb6);}(_0x4300,0x1a6));var _0x0430=function(_0x5b31cf,_0x464038){_0x5b31cf=_0x5b31cf-0x0;var _0x3647a4=_0x4300[_0x5b31cf];return _0x3647a4;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x0430('0x1'),'no'),'defaultValue':_0x0430('0x1')},'headerinfo':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0x3')},'localstationid':{'type':Sequelize[_0x0430('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x0430('0x4')]('2400',_0x0430('0x5'),'7200',_0x0430('0x6'),_0x0430('0x7'),_0x0430('0x8')),'defaultValue':_0x0430('0x5')},'maxrate':{'type':Sequelize[_0x0430('0x4')](_0x0430('0x9'),_0x0430('0x5'),_0x0430('0xa'),_0x0430('0x6'),'12000',_0x0430('0x8')),'defaultValue':_0x0430('0x8')},'modem':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0xb')},'gateway':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0430('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0430('0x4')]('SIP','IAX',_0x0430('0xd'),_0x0430('0xe')),'defaultValue':_0x0430('0xf')},'key':{'type':Sequelize[_0x0430('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0430('0x10')],'defaultValue':function(){return _0x0430('0x11');}},'notificationSound':{'type':Sequelize[_0x0430('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0430('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0430('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a3239){if(!_0x1a3239)this[_0x0430('0x14')](_0x0430('0x15'),null);this[_0x0430('0x14')](_0x0430('0x16'),_0x1a3239);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 21ab3f1..478f941 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 _0xec39=['t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','path','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','addAgents','omit','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','get','FaxAccounts','UserProfileResource','stack','name','send','index','FaxAccount','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','Pause','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','update','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','addApplications','transaction','sequelize','FaxApplication','findAndCountAll','priority','finally','sendStatus','getApplications','context','exten','app','system','description','appdata','push','CDR(type)=inbound-fax','ecm','faxdetect','maxrate','minrate'];(function(_0x4c3771,_0x430961){var _0x13da8d=function(_0x5ef2eb){while(--_0x5ef2eb){_0x4c3771['push'](_0x4c3771['shift']());}};_0x13da8d(++_0x430961);}(_0xec39,0xf3));var _0x9ec3=function(_0xc8c6fc,_0x491d66){_0xc8c6fc=_0xc8c6fc-0x0;var _0x21cca2=_0xec39[_0xc8c6fc];return _0x21cca2;};'use strict';var emlformat=require(_0x9ec3('0x0'));var rimraf=require(_0x9ec3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ec3('0x2'));var rp=require(_0x9ec3('0x3'));var moment=require(_0x9ec3('0x4'));var BPromise=require(_0x9ec3('0x5'));var Mustache=require(_0x9ec3('0x6'));var util=require(_0x9ec3('0x7'));var path=require('path');var sox=require(_0x9ec3('0x8'));var csv=require(_0x9ec3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ec3('0xa'));var _=require(_0x9ec3('0xb'));var squel=require(_0x9ec3('0xc'));var crypto=require(_0x9ec3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ec3('0xe'));var toCsv=require(_0x9ec3('0x9'));var querystring=require(_0x9ec3('0xf'));var Papa=require(_0x9ec3('0x10'));var Redis=require(_0x9ec3('0x11'));var authService=require(_0x9ec3('0x12'));var qs=require(_0x9ec3('0x13'));var as=require(_0x9ec3('0x14'));var hardwareService=require(_0x9ec3('0x15'));var logger=require(_0x9ec3('0x16'))(_0x9ec3('0x17'));var utils=require(_0x9ec3('0x18'));var config=require(_0x9ec3('0x19'));var licenseUtil=require(_0x9ec3('0x1a'));var db=require(_0x9ec3('0x1b'))['db'];config[_0x9ec3('0x1c')]=_[_0x9ec3('0x1d')](config[_0x9ec3('0x1c')],{'host':_0x9ec3('0x1e'),'port':0x18eb});var socket=require(_0x9ec3('0x1f'))(new Redis(config[_0x9ec3('0x1c')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x9ec3('0x20'));var client=jayson[_0x9ec3('0x21')][_0x9ec3('0x22')]({'port':0x232c});var client9002=jayson[_0x9ec3('0x21')][_0x9ec3('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2ac152,_0x10651e,_0x165aec,_0x2ec179){return new BPromise(function(_0x36a9fc,_0x562b5d){var _0x51b10e=_0x2ec179||client;return _0x51b10e[_0x9ec3('0x23')](_0x2ac152,_0x165aec)['then'](function(_0x8edb11){logger[_0x9ec3('0x24')](_0x9ec3('0x25'),_0x10651e,_0x9ec3('0x26'));logger[_0x9ec3('0x27')](_0x9ec3('0x28'),_0x10651e,_0x9ec3('0x26'),JSON['stringify'](_0x8edb11));if(_0x8edb11[_0x9ec3('0x29')]){if(_0x8edb11[_0x9ec3('0x29')][_0x9ec3('0x2a')]===0x1f4){logger[_0x9ec3('0x29')](_0x9ec3('0x25'),_0x10651e,_0x8edb11[_0x9ec3('0x29')][_0x9ec3('0x2b')]);return _0x562b5d(_0x8edb11['error'][_0x9ec3('0x2b')]);}logger['error'](_0x9ec3('0x25'),_0x10651e,_0x8edb11['error'][_0x9ec3('0x2b')]);return _0x36a9fc(_0x8edb11[_0x9ec3('0x29')][_0x9ec3('0x2b')]);}else{logger[_0x9ec3('0x24')](_0x9ec3('0x25'),_0x10651e,_0x9ec3('0x26'));_0x36a9fc(_0x8edb11[_0x9ec3('0x2c')][_0x9ec3('0x2b')]);}})['catch'](function(_0x573df8){logger[_0x9ec3('0x29')](_0x9ec3('0x25'),_0x10651e,_0x573df8);_0x562b5d(_0x573df8);});});}function respondWithStatusCode(_0x48a062,_0x27bfcd){_0x27bfcd=_0x27bfcd||0xcc;return function(_0x4669e8){if(_0x4669e8){return _0x48a062['sendStatus'](_0x27bfcd);}return _0x48a062[_0x9ec3('0x2d')](_0x27bfcd)[_0x9ec3('0x2e')]();};}function respondWithResult(_0x1fbc26,_0x3f8ccf){_0x3f8ccf=_0x3f8ccf||0xc8;return function(_0x10b4c6){if(_0x10b4c6){return _0x1fbc26[_0x9ec3('0x2d')](_0x3f8ccf)[_0x9ec3('0x2f')](_0x10b4c6);}};}function respondWithFilteredResult(_0x34ad2d,_0x265c96){return function(_0x4516fe){if(_0x4516fe){var _0x52adf7=typeof _0x265c96[_0x9ec3('0x30')]==='undefined'&&typeof _0x265c96['limit']===_0x9ec3('0x31');var _0x3b7de7=_0x4516fe[_0x9ec3('0x32')];var _0x491355=_0x52adf7?0x0:_0x265c96[_0x9ec3('0x30')];var _0x5bc594=_0x52adf7?_0x4516fe[_0x9ec3('0x32')]:_0x265c96['offset']+_0x265c96[_0x9ec3('0x33')];var _0x546211;if(_0x5bc594>=_0x3b7de7){_0x5bc594=_0x3b7de7;_0x546211=0xc8;}else{_0x546211=0xce;}_0x34ad2d[_0x9ec3('0x2d')](_0x546211);return _0x34ad2d[_0x9ec3('0x34')](_0x9ec3('0x35'),_0x491355+'-'+_0x5bc594+'/'+_0x3b7de7)[_0x9ec3('0x2f')](_0x4516fe);}return null;};}function patchUpdates(_0x3fbdd6){return function(_0x4e9b83){try{jsonpatch[_0x9ec3('0x36')](_0x4e9b83,_0x3fbdd6,!![]);}catch(_0x40eec1){return BPromise[_0x9ec3('0x37')](_0x40eec1);}return _0x4e9b83['save']();};}function saveUpdates(_0x5a5127,_0x5f1697){return function(_0xa93a23){if(_0xa93a23){return _0xa93a23['update'](_0x5a5127)['then'](function(_0x23faab){return _0x23faab;});}return null;};}function removeEntity(_0x1ca8d3,_0x21fc13){return function(_0x48ac91){if(_0x48ac91){return _0x48ac91[_0x9ec3('0x38')]()[_0x9ec3('0x39')](function(){var _0x554e38=_0x48ac91[_0x9ec3('0x3a')]({'plain':!![]});var _0x418f9b=_0x9ec3('0x3b');return db[_0x9ec3('0x3c')][_0x9ec3('0x38')]({'where':{'type':_0x418f9b,'resourceId':_0x554e38['id']}})[_0x9ec3('0x39')](function(){return _0x48ac91;});})['then'](function(){_0x1ca8d3[_0x9ec3('0x2d')](0xcc)[_0x9ec3('0x2e')]();});}};}function handleEntityNotFound(_0x4766e7,_0x118938){return function(_0xed8c56){if(!_0xed8c56){_0x4766e7['sendStatus'](0x194);}return _0xed8c56;};}function handleError(_0x27ece7,_0xd6385c){_0xd6385c=_0xd6385c||0x1f4;return function(_0x8f95f7){logger[_0x9ec3('0x29')](_0x8f95f7[_0x9ec3('0x3d')]);if(_0x8f95f7[_0x9ec3('0x3e')]){delete _0x8f95f7['name'];}_0x27ece7[_0x9ec3('0x2d')](_0xd6385c)[_0x9ec3('0x3f')](_0x8f95f7);};}exports[_0x9ec3('0x40')]=function(_0x113949,_0x50f768){var _0x3a5529={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5666a3={},_0x3578ea={'count':0x0,'rows':[]};var _0x293f49=_['map'](db[_0x9ec3('0x41')][_0x9ec3('0x42')],function(_0x2c5767){return{'name':_0x2c5767['fieldName'],'type':_0x2c5767[_0x9ec3('0x43')][_0x9ec3('0x44')]};});_0x5666a3[_0x9ec3('0x45')]=_[_0x9ec3('0x46')](_0x293f49,_0x9ec3('0x3e'));_0x5666a3[_0x9ec3('0x47')]=_['keys'](_0x113949[_0x9ec3('0x47')]);_0x5666a3['filters']=_[_0x9ec3('0x48')](_0x5666a3[_0x9ec3('0x45')],_0x5666a3[_0x9ec3('0x47')]);_0x3a5529['attributes']=_[_0x9ec3('0x48')](_0x5666a3[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x113949[_0x9ec3('0x47')][_0x9ec3('0x49')]));_0x3a5529['attributes']=_0x3a5529[_0x9ec3('0x4a')][_0x9ec3('0x4b')]?_0x3a5529['attributes']:_0x5666a3[_0x9ec3('0x45')];if(!_0x113949['query'][_0x9ec3('0x4c')](_0x9ec3('0x4d'))){_0x3a5529[_0x9ec3('0x33')]=qs['limit'](_0x113949[_0x9ec3('0x47')][_0x9ec3('0x33')]);_0x3a5529[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0x113949[_0x9ec3('0x47')][_0x9ec3('0x30')]);}_0x3a5529[_0x9ec3('0x4e')]=qs['sort'](_0x113949[_0x9ec3('0x47')][_0x9ec3('0x4f')]);_0x3a5529[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_[_0x9ec3('0x52')](_0x113949['query'],_0x5666a3['filters']),_0x293f49);if(_0x113949[_0x9ec3('0x47')][_0x9ec3('0x53')]){_0x3a5529['where']=_[_0x9ec3('0x54')](_0x3a5529['where'],{'$or':_[_0x9ec3('0x46')](_0x293f49,function(_0x44a72b){if(_0x44a72b[_0x9ec3('0x43')]!=='VIRTUAL'){var _0x351213={};_0x351213[_0x44a72b[_0x9ec3('0x3e')]]={'$like':'%'+_0x113949[_0x9ec3('0x47')]['filter']+'%'};return _0x351213;}})});}_0x3a5529=_[_0x9ec3('0x54')]({},_0x3a5529,_0x113949[_0x9ec3('0x55')]);var _0x453dc9={'where':_0x3a5529[_0x9ec3('0x50')]};return db['FaxAccount'][_0x9ec3('0x32')](_0x453dc9)[_0x9ec3('0x39')](function(_0x1a089c){_0x3578ea[_0x9ec3('0x32')]=_0x1a089c;if(_0x113949[_0x9ec3('0x47')]['includeAll']){_0x3a5529[_0x9ec3('0x56')]=[{'all':!![]}];}return db[_0x9ec3('0x41')][_0x9ec3('0x57')](_0x3a5529);})[_0x9ec3('0x39')](function(_0x5ded64){_0x3578ea[_0x9ec3('0x58')]=_0x5ded64;return _0x3578ea;})[_0x9ec3('0x39')](respondWithFilteredResult(_0x50f768,_0x3a5529))[_0x9ec3('0x59')](handleError(_0x50f768,null));};exports[_0x9ec3('0x5a')]=function(_0x4c5b67,_0x567351){var _0x288b71={'raw':![],'where':{'id':_0x4c5b67['params']['id']},'include':[{'model':db[_0x9ec3('0x5b')],'as':'mandatoryDispositionPause'}]},_0x3e42a4={};_0x3e42a4['model']=_[_0x9ec3('0x5c')](db['FaxAccount']['rawAttributes']);_0x3e42a4[_0x9ec3('0x47')]=_[_0x9ec3('0x5c')](_0x4c5b67[_0x9ec3('0x47')]);_0x3e42a4[_0x9ec3('0x51')]=_[_0x9ec3('0x48')](_0x3e42a4[_0x9ec3('0x45')],_0x3e42a4[_0x9ec3('0x47')]);_0x288b71[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x3e42a4[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x4c5b67[_0x9ec3('0x47')]['fields']));_0x288b71[_0x9ec3('0x4a')]=_0x288b71[_0x9ec3('0x4a')][_0x9ec3('0x4b')]?_0x288b71['attributes']:_0x3e42a4['model'];if(_0x4c5b67[_0x9ec3('0x47')][_0x9ec3('0x5d')]){_0x288b71[_0x9ec3('0x56')]=[{'all':!![]}];}_0x288b71=_[_0x9ec3('0x54')]({},_0x288b71,_0x4c5b67[_0x9ec3('0x55')]);return db['FaxAccount'][_0x9ec3('0x5e')](_0x288b71)[_0x9ec3('0x39')](handleEntityNotFound(_0x567351,null))[_0x9ec3('0x39')](respondWithResult(_0x567351,null))['catch'](handleError(_0x567351,null));};exports[_0x9ec3('0x5f')]=function(_0x357892,_0x4934df){return db[_0x9ec3('0x41')]['create'](_0x357892[_0x9ec3('0x60')],{})['then'](function(_0x48c799){var _0x570647=_0x357892['user']['get']({'plain':!![]});if(!_0x570647)throw new Error(_0x9ec3('0x61'));if(_0x570647[_0x9ec3('0x62')]===_0x9ec3('0x63')){var _0x4166e9=_0x48c799['get']({'plain':!![]});var _0x5c842b='FaxAccounts';return db[_0x9ec3('0x64')][_0x9ec3('0x5e')]({'where':{'name':_0x5c842b,'userProfileId':_0x570647['userProfileId']},'raw':!![]})[_0x9ec3('0x39')](function(_0x48d712){if(_0x48d712&&_0x48d712[_0x9ec3('0x65')]===0x0){return db[_0x9ec3('0x3c')][_0x9ec3('0x5f')]({'name':_0x4166e9[_0x9ec3('0x3e')],'resourceId':_0x4166e9['id'],'type':_0x48d712[_0x9ec3('0x3e')],'sectionId':_0x48d712['id']},{})[_0x9ec3('0x39')](function(){return _0x48c799;});}else{return _0x48c799;}})[_0x9ec3('0x59')](function(_0x95fc6a){logger[_0x9ec3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x95fc6a);throw _0x95fc6a;});}return _0x48c799;})[_0x9ec3('0x39')](respondWithResult(_0x4934df,0xc9))[_0x9ec3('0x59')](handleError(_0x4934df,null));};exports[_0x9ec3('0x66')]=function(_0x47b9f8,_0x4cf386){if(_0x47b9f8[_0x9ec3('0x60')]['id']){delete _0x47b9f8[_0x9ec3('0x60')]['id'];}return db['FaxAccount'][_0x9ec3('0x5e')]({'where':{'id':_0x47b9f8[_0x9ec3('0x67')]['id']},'include':[{'model':db[_0x9ec3('0x5b')],'as':'mandatoryDispositionPause'}]})[_0x9ec3('0x39')](handleEntityNotFound(_0x4cf386,null))[_0x9ec3('0x39')](saveUpdates(_0x47b9f8[_0x9ec3('0x60')],null))['then'](respondWithResult(_0x4cf386,null))[_0x9ec3('0x59')](handleError(_0x4cf386,null));};exports['destroy']=function(_0x38914b,_0xaa0a3f){return db['FaxAccount'][_0x9ec3('0x5e')]({'where':{'id':_0x38914b[_0x9ec3('0x67')]['id']}})['then'](handleEntityNotFound(_0xaa0a3f,null))[_0x9ec3('0x39')](removeEntity(_0xaa0a3f,null))[_0x9ec3('0x59')](handleError(_0xaa0a3f,null));};exports[_0x9ec3('0x68')]=function(_0x342fec,_0x9fc385){return db['FaxAccount'][_0x9ec3('0x68')]()['then'](respondWithResult(_0x9fc385,null))[_0x9ec3('0x59')](handleError(_0x9fc385,null));};exports[_0x9ec3('0x69')]=function(_0x74558e,_0xaa86be,_0x2763e7){if(_0x74558e[_0x9ec3('0x60')]['id']){delete _0x74558e[_0x9ec3('0x60')]['id'];}return db[_0x9ec3('0x41')]['find']({'where':{'id':_0x74558e[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0xaa86be,null))[_0x9ec3('0x39')](function(_0x271a8b){if(_0x271a8b){_0x74558e[_0x9ec3('0x60')][_0x9ec3('0x6a')]=_0x271a8b['id'];return db['Disposition'][_0x9ec3('0x5f')](_0x74558e[_0x9ec3('0x60')]);}})['then'](respondWithResult(_0xaa86be,null))[_0x9ec3('0x59')](handleError(_0xaa86be,null));};exports[_0x9ec3('0x6b')]=function(_0xc502d2,_0x562f51,_0x3da423){var _0x15b796={'raw':![],'where':{}};var _0x3d79bd={};var _0x4a6928={'count':0x0,'rows':[]};return db[_0x9ec3('0x41')][_0x9ec3('0x6c')]({'where':{'id':_0xc502d2[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x562f51,null))['then'](function(_0x367c03){if(_0x367c03){_0x3d79bd[_0x9ec3('0x45')]=_[_0x9ec3('0x5c')](db['Disposition'][_0x9ec3('0x42')]);_0x3d79bd['query']=_[_0x9ec3('0x5c')](_0xc502d2[_0x9ec3('0x47')]);_0x3d79bd['filters']=_[_0x9ec3('0x48')](_0x3d79bd[_0x9ec3('0x45')],_0x3d79bd[_0x9ec3('0x47')]);_0x15b796[_0x9ec3('0x4a')]=_['intersection'](_0x3d79bd[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0xc502d2[_0x9ec3('0x47')][_0x9ec3('0x49')]));_0x15b796['attributes']=_0x15b796[_0x9ec3('0x4a')]['length']?_0x15b796['attributes']:_0x3d79bd['model'];if(!_0xc502d2[_0x9ec3('0x47')][_0x9ec3('0x4c')]('nolimit')){_0x15b796[_0x9ec3('0x33')]=qs['limit'](_0xc502d2[_0x9ec3('0x47')][_0x9ec3('0x33')]);_0x15b796[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0xc502d2['query'][_0x9ec3('0x30')]);}_0x15b796['order']=qs['sort'](_0xc502d2[_0x9ec3('0x47')][_0x9ec3('0x4f')]);_0x15b796[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_['pick'](_0xc502d2['query'],_0x3d79bd[_0x9ec3('0x51')]));_0x15b796[_0x9ec3('0x50')][_0x9ec3('0x6a')]=_0x367c03['id'];if(_0xc502d2[_0x9ec3('0x47')]['filter']){_0x15b796[_0x9ec3('0x50')]=_['merge'](_0x15b796['where'],{'$or':_[_0x9ec3('0x46')](_0x15b796['attributes'],function(_0x3cb910){var _0x40d682={};_0x40d682[_0x3cb910]={'$like':'%'+_0xc502d2['query'][_0x9ec3('0x53')]+'%'};return _0x40d682;})});}_0x15b796=_[_0x9ec3('0x54')]({},_0x15b796,_0xc502d2[_0x9ec3('0x55')]);return db[_0x9ec3('0x6d')][_0x9ec3('0x32')]({'where':_0x15b796[_0x9ec3('0x50')]})[_0x9ec3('0x39')](function(_0x5949e1){_0x4a6928[_0x9ec3('0x32')]=_0x5949e1;if(_0xc502d2[_0x9ec3('0x47')]['includeAll']){_0x15b796['include']=[{'all':!![]}];}return db[_0x9ec3('0x6d')]['findAll'](_0x15b796);})[_0x9ec3('0x39')](function(_0x1b14ea){_0x4a6928[_0x9ec3('0x58')]=_0x1b14ea;return _0x4a6928;});}})[_0x9ec3('0x39')](respondWithFilteredResult(_0x562f51,_0x15b796))[_0x9ec3('0x59')](handleError(_0x562f51,null));};exports[_0x9ec3('0x6e')]=function(_0x4b5558,_0x431ab5,_0x51cde8){return db['FaxAccount']['find']({'where':{'id':_0x4b5558[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x431ab5,null))['then'](function(_0x576e06){if(_0x576e06){return _0x576e06[_0x9ec3('0x6e')](_0x4b5558[_0x9ec3('0x47')][_0x9ec3('0x6f')]);}})[_0x9ec3('0x39')](respondWithStatusCode(_0x431ab5,null))[_0x9ec3('0x59')](handleError(_0x431ab5,null));};exports[_0x9ec3('0x70')]=function(_0x30f250,_0x575e39,_0x51b002){if(_0x30f250[_0x9ec3('0x60')]['id']){delete _0x30f250[_0x9ec3('0x60')]['id'];}return db[_0x9ec3('0x41')][_0x9ec3('0x5e')]({'where':{'id':_0x30f250[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x575e39,null))[_0x9ec3('0x39')](function(_0x46f1ad){if(_0x46f1ad){_0x30f250[_0x9ec3('0x60')]['FaxAccountId']=_0x46f1ad['id'];return db['CannedAnswer'][_0x9ec3('0x5f')](_0x30f250[_0x9ec3('0x60')]);}})[_0x9ec3('0x39')](respondWithResult(_0x575e39,null))[_0x9ec3('0x59')](handleError(_0x575e39,null));};exports['getAnswers']=function(_0x1a1780,_0x3da04e,_0x53b3e1){var _0x55096a={'raw':![],'where':{}};var _0x945bca={};var _0x14075b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ec3('0x6c')]({'where':{'id':_0x1a1780[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x3da04e,null))[_0x9ec3('0x39')](function(_0x50b4b0){if(_0x50b4b0){_0x945bca['model']=_[_0x9ec3('0x5c')](db[_0x9ec3('0x71')]['rawAttributes']);_0x945bca['query']=_['keys'](_0x1a1780[_0x9ec3('0x47')]);_0x945bca['filters']=_[_0x9ec3('0x48')](_0x945bca[_0x9ec3('0x45')],_0x945bca[_0x9ec3('0x47')]);_0x55096a[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x945bca[_0x9ec3('0x45')],qs['fields'](_0x1a1780[_0x9ec3('0x47')]['fields']));_0x55096a[_0x9ec3('0x4a')]=_0x55096a[_0x9ec3('0x4a')][_0x9ec3('0x4b')]?_0x55096a[_0x9ec3('0x4a')]:_0x945bca['model'];if(!_0x1a1780['query'][_0x9ec3('0x4c')](_0x9ec3('0x4d'))){_0x55096a[_0x9ec3('0x33')]=qs[_0x9ec3('0x33')](_0x1a1780['query'][_0x9ec3('0x33')]);_0x55096a[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0x1a1780[_0x9ec3('0x47')][_0x9ec3('0x30')]);}_0x55096a['order']=qs[_0x9ec3('0x4f')](_0x1a1780[_0x9ec3('0x47')][_0x9ec3('0x4f')]);_0x55096a[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_['pick'](_0x1a1780[_0x9ec3('0x47')],_0x945bca['filters']));_0x55096a[_0x9ec3('0x50')][_0x9ec3('0x6a')]=_0x50b4b0['id'];if(_0x1a1780[_0x9ec3('0x47')][_0x9ec3('0x53')]){_0x55096a['where']=_[_0x9ec3('0x54')](_0x55096a[_0x9ec3('0x50')],{'$or':_['map'](_0x55096a[_0x9ec3('0x4a')],function(_0x490391){var _0x5f31fe={};_0x5f31fe[_0x490391]={'$like':'%'+_0x1a1780[_0x9ec3('0x47')][_0x9ec3('0x53')]+'%'};return _0x5f31fe;})});}_0x55096a=_[_0x9ec3('0x54')]({},_0x55096a,_0x1a1780[_0x9ec3('0x55')]);return db['CannedAnswer']['count']({'where':_0x55096a[_0x9ec3('0x50')]})[_0x9ec3('0x39')](function(_0x5c4b02){_0x14075b[_0x9ec3('0x32')]=_0x5c4b02;if(_0x1a1780[_0x9ec3('0x47')][_0x9ec3('0x5d')]){_0x55096a[_0x9ec3('0x56')]=[{'all':!![]}];}return db[_0x9ec3('0x71')][_0x9ec3('0x57')](_0x55096a);})['then'](function(_0x2bb1db){_0x14075b['rows']=_0x2bb1db;return _0x14075b;});}})[_0x9ec3('0x39')](respondWithFilteredResult(_0x3da04e,_0x55096a))[_0x9ec3('0x59')](handleError(_0x3da04e,null));};exports[_0x9ec3('0x72')]=function(_0x2396c3,_0x4e8d3e,_0x1df716){return db[_0x9ec3('0x41')][_0x9ec3('0x5e')]({'where':{'id':_0x2396c3['params']['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x4e8d3e,null))['then'](function(_0x3d7cbf){if(_0x3d7cbf){return _0x3d7cbf['removeAnswers'](_0x2396c3['query']['ids']);}})[_0x9ec3('0x39')](respondWithStatusCode(_0x4e8d3e,null))[_0x9ec3('0x59')](handleError(_0x4e8d3e,null));};exports['addInteraction']=function(_0x4fc6aa,_0x3b3a50,_0xad8f78){return db[_0x9ec3('0x73')][_0x9ec3('0x5e')]({'where':{'id':_0x4fc6aa['params']['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x3b3a50,null))[_0x9ec3('0x39')](function(_0x9c1607){if(_0x9c1607){return _0x9c1607['addInteraction'](_0x4fc6aa[_0x9ec3('0x60')]['ids'],_['omit'](_0x4fc6aa[_0x9ec3('0x60')],[_0x9ec3('0x6f'),'id'])||{});}})[_0x9ec3('0x39')](respondWithResult(_0x3b3a50,null))['catch'](handleError(_0x3b3a50,null));};exports['getInteractions']=function(_0x1f36cf,_0x1bd393,_0x5b4f00){var _0xd8c14f={'raw':![],'where':{}};var _0x3283cd={};var _0x3facce={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ec3('0x6c')]({'where':{'id':_0x1f36cf['params']['id']}})['then'](handleEntityNotFound(_0x1bd393,null))[_0x9ec3('0x39')](function(_0x5301e3){if(_0x5301e3){_0x3283cd[_0x9ec3('0x45')]=_[_0x9ec3('0x5c')](db['FaxInteraction'][_0x9ec3('0x42')]);_0x3283cd[_0x9ec3('0x47')]=_['keys'](_0x1f36cf[_0x9ec3('0x47')]);_0x3283cd[_0x9ec3('0x51')]=_[_0x9ec3('0x48')](_0x3283cd[_0x9ec3('0x45')],_0x3283cd[_0x9ec3('0x47')]);_0xd8c14f[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x3283cd[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x49')]));_0xd8c14f[_0x9ec3('0x4a')]=_0xd8c14f['attributes']['length']?_0xd8c14f[_0x9ec3('0x4a')]:_0x3283cd['model'];if(!_0x1f36cf['query'][_0x9ec3('0x4c')](_0x9ec3('0x4d'))){_0xd8c14f[_0x9ec3('0x33')]=qs['limit'](_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x33')]);_0xd8c14f[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x30')]);}_0xd8c14f[_0x9ec3('0x4e')]=qs[_0x9ec3('0x4f')](_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x4f')]);_0xd8c14f[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_[_0x9ec3('0x52')](_0x1f36cf[_0x9ec3('0x47')],_0x3283cd[_0x9ec3('0x51')]));_0xd8c14f[_0x9ec3('0x50')][_0x9ec3('0x6a')]=_0x5301e3['id'];if(_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x53')]){_0xd8c14f[_0x9ec3('0x50')]=_[_0x9ec3('0x54')](_0xd8c14f[_0x9ec3('0x50')],{'$or':_[_0x9ec3('0x46')](_0xd8c14f[_0x9ec3('0x4a')],function(_0x4f9e7e){var _0x4f32d0={};_0x4f32d0[_0x4f9e7e]={'$like':'%'+_0x1f36cf[_0x9ec3('0x47')][_0x9ec3('0x53')]+'%'};return _0x4f32d0;})});}_0xd8c14f=_[_0x9ec3('0x54')]({},_0xd8c14f,_0x1f36cf[_0x9ec3('0x55')]);return db[_0x9ec3('0x73')][_0x9ec3('0x32')]({'where':_0xd8c14f['where']})[_0x9ec3('0x39')](function(_0x547e07){_0x3facce[_0x9ec3('0x32')]=_0x547e07;if(_0x1f36cf[_0x9ec3('0x47')]['includeAll']){_0xd8c14f[_0x9ec3('0x56')]=[{'model':db[_0x9ec3('0x74')],'as':_0x9ec3('0x75'),'required':![]},{'model':db[_0x9ec3('0x76')],'as':_0x9ec3('0x77'),'attributes':[_0x9ec3('0x3e'),_0x9ec3('0x78'),_0x9ec3('0x79')],'required':![]},{'model':db[_0x9ec3('0x7a')],'as':_0x9ec3('0x7b'),'attributes':['id','name','color'],'where':_0x1f36cf[_0x9ec3('0x47')]['tag']?{'id':_0x1f36cf[_0x9ec3('0x47')]['tag']}:undefined,'required':_0x1f36cf[_0x9ec3('0x47')]['tag']?!![]:![]}];}return db[_0x9ec3('0x73')][_0x9ec3('0x57')](_0xd8c14f);})['then'](function(_0x43a1ec){_0x3facce['rows']=_0x43a1ec;return _0x3facce;});}})['then'](respondWithFilteredResult(_0x1bd393,_0xd8c14f))['catch'](handleError(_0x1bd393,null));};exports[_0x9ec3('0x7c')]=function(_0x36c03c,_0x36c5a7){var _0x54142f=_0x36c03c[_0x9ec3('0x67')]['id'];var _0x1f6ced=_0x36c03c[_0x9ec3('0x60')];var _0x55860f=0xc8;var _0x4b19ee=null;return db['sequelize'][_0x9ec3('0x7d')]({'isolationLevel':db[_0x9ec3('0x7e')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x196dcc){return db[_0x9ec3('0x41')][_0x9ec3('0x6c')]({'where':{'id':_0x54142f},'transaction':_0x196dcc})[_0x9ec3('0x39')](function(_0x58d164){if(_0x58d164){return db['FaxApplication'][_0x9ec3('0x38')]({'where':{'FaxAccountId':_0x54142f},'transaction':_0x196dcc})['then'](function(){var _0x2c8aff=_['map'](_0x1f6ced,function(_0x4ca423){_0x4ca423['FaxAccountId']=_0x54142f;return _0x4ca423;});return db[_0x9ec3('0x7f')]['bulkCreate'](_0x2c8aff,{'transaction':_0x196dcc});});}else{_0x55860f=0x194;_0x4b19ee=[];}});})[_0x9ec3('0x39')](function(){if(_0x55860f!==0x194){return db[_0x9ec3('0x7f')][_0x9ec3('0x80')]({'where':{'FaxAccountId':_0x54142f},'order':_0x9ec3('0x81')})['then'](function(_0x85a585){_0x4b19ee=_0x85a585;});}})[_0x9ec3('0x59')](function(_0x22c0fd){_0x55860f=0x1f4;logger[_0x9ec3('0x29')](_0x22c0fd[_0x9ec3('0x3d')]);if(_0x22c0fd['name']){delete _0x22c0fd[_0x9ec3('0x3e')];}_0x4b19ee=_0x22c0fd;})[_0x9ec3('0x82')](function(){if(_0x4b19ee===null){_0x36c5a7[_0x9ec3('0x83')](_0x55860f);}else{if(_0x55860f===0x1f4){_0x36c5a7[_0x9ec3('0x2d')](_0x55860f)['send'](_0x4b19ee);}else{_0x36c5a7['status'](_0x55860f)['json'](_0x4b19ee);}}});};exports[_0x9ec3('0x84')]=function(_0x563234,_0x376ff6,_0x4145bd){var _0x3d3841={};var _0x1c073e={};var _0x1f3d24;var _0x4895a4;return db[_0x9ec3('0x41')]['findOne']({'where':{'id':_0x563234[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x376ff6,null))[_0x9ec3('0x39')](function(_0x28b59c){if(_0x28b59c){_0x1f3d24=_0x28b59c;_0x1c073e[_0x9ec3('0x45')]=_[_0x9ec3('0x5c')](db[_0x9ec3('0x7f')][_0x9ec3('0x42')]);_0x1c073e['query']=_[_0x9ec3('0x5c')](_0x563234[_0x9ec3('0x47')]);_0x1c073e[_0x9ec3('0x51')]=_[_0x9ec3('0x48')](_0x1c073e[_0x9ec3('0x45')],_0x1c073e[_0x9ec3('0x47')]);_0x3d3841[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x1c073e[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x563234['query'][_0x9ec3('0x49')]));_0x3d3841[_0x9ec3('0x4a')]=_0x3d3841[_0x9ec3('0x4a')][_0x9ec3('0x4b')]?_0x3d3841[_0x9ec3('0x4a')]:_0x1c073e[_0x9ec3('0x45')];_0x3d3841['order']=qs[_0x9ec3('0x4f')](_0x563234[_0x9ec3('0x47')][_0x9ec3('0x4f')]);_0x3d3841[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_['pick'](_0x563234['query'],_0x1c073e['filters']));if(_0x563234[_0x9ec3('0x47')]['filter']){_0x3d3841['where']=_['merge'](_0x3d3841[_0x9ec3('0x50')],{'$or':_[_0x9ec3('0x46')](_0x3d3841['attributes'],function(_0x4a5955){var _0x1d974b={};_0x1d974b[_0x4a5955]={'$like':'%'+_0x563234[_0x9ec3('0x47')]['filter']+'%'};return _0x1d974b;})});}_0x3d3841=_[_0x9ec3('0x54')]({},_0x3d3841,_0x563234[_0x9ec3('0x55')]);return _0x1f3d24[_0x9ec3('0x84')](_0x3d3841);}})[_0x9ec3('0x39')](function(_0x3558e0){if(_0x3558e0){_0x4895a4=_0x3558e0[_0x9ec3('0x4b')];if(!_0x563234[_0x9ec3('0x47')]['hasOwnProperty']('nolimit')){_0x3d3841[_0x9ec3('0x33')]=qs[_0x9ec3('0x33')](_0x563234['query'][_0x9ec3('0x33')]);_0x3d3841['offset']=qs['offset'](_0x563234[_0x9ec3('0x47')][_0x9ec3('0x30')]);}return _0x1f3d24['getApplications'](_0x3d3841);}})[_0x9ec3('0x39')](function(_0x35505d){if(_0x35505d){return _0x35505d?{'count':_0x4895a4,'rows':_0x35505d}:null;}})[_0x9ec3('0x39')](respondWithResult(_0x376ff6,null))[_0x9ec3('0x59')](handleError(_0x376ff6,null));};function Extension(_0x35c2e3,_0x417cab,_0x4e16e8,_0x116265){this[_0x9ec3('0x85')]='from-voip-provider';this[_0x9ec3('0x86')]=_0x35c2e3['localstationid'];this[_0x9ec3('0x87')]=_0x116265;this[_0x9ec3('0x43')]=_0x9ec3('0x88');this[_0x9ec3('0x89')]='Fax\x20Extension';this['FaxAccountId']=_0x35c2e3['id'];this[_0x9ec3('0x81')]=_0x417cab;this[_0x9ec3('0x8a')]=_0x4e16e8;}function createExtensionsReciveFax(_0x3602ce){var _0x5aece9=0x1;var _0x29e494=[];_0x29e494[_0x9ec3('0x8b')](new Extension(_0x3602ce,_0x5aece9,'','Answer'));_0x5aece9+=0x1;_0x29e494[_0x9ec3('0x8b')](new Extension(_0x3602ce,_0x5aece9,_0x9ec3('0x8c'),'Set'));_0x5aece9+=0x1;for(var _0x12c8d6 in _0x3602ce){if(_0x3602ce[_0x9ec3('0x4c')](_0x12c8d6)&&(_0x12c8d6===_0x9ec3('0x8d')||_0x12c8d6==='localstationid'||_0x12c8d6==='gateway'||_0x12c8d6===_0x9ec3('0x8e')||_0x12c8d6==='headerinfo'||_0x12c8d6===_0x9ec3('0x8f')||_0x12c8d6===_0x9ec3('0x90')||_0x12c8d6==='modem'||_0x12c8d6===_0x9ec3('0x91'))){_0x29e494[_0x9ec3('0x8b')](new Extension(_0x3602ce,_0x5aece9,_0x9ec3('0x92')+_0x12c8d6+')='+_0x3602ce[_0x12c8d6],_0x9ec3('0x93')));_0x5aece9+=0x1;}}_0x29e494['push'](new Extension(_0x3602ce,_0x5aece9,'6',_0x9ec3('0x94')));_0x5aece9+=0x1;_0x29e494[_0x9ec3('0x8b')](new Extension(_0x3602ce,_0x5aece9,'/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',_0x9ec3('0x95')));_0x5aece9=0x0;return _0x29e494;}exports[_0x9ec3('0x96')]=function(_0x109096,_0x2c9941,_0x3d8140){var _0x301514;return db[_0x9ec3('0x7e')][_0x9ec3('0x7d')](function(_0xf0958a){return db[_0x9ec3('0x41')][_0x9ec3('0x5f')](_0x109096[_0x9ec3('0x60')],{'transaction':_0xf0958a})[_0x9ec3('0x39')](function(_0x3641d9){_0x301514=_0x3641d9[_0x9ec3('0x3a')]({'plain':!![]});return db[_0x9ec3('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x301514),{'transaction':_0xf0958a});});})['then'](function(){return _0x301514;})['then'](respondWithResult(_0x2c9941,null))[_0x9ec3('0x59')](handleError(_0x2c9941,null));};exports[_0x9ec3('0x98')]=function(_0x40b760,_0xc58559,_0x4b4c4b){var _0x1e165c;return db[_0x9ec3('0x7e')][_0x9ec3('0x7d')](function(_0x131cd6){return db[_0x9ec3('0x41')][_0x9ec3('0x66')](_0x40b760[_0x9ec3('0x60')],{'where':{'id':_0x40b760[_0x9ec3('0x60')]['id']},'transaction':_0x131cd6})[_0x9ec3('0x39')](function(_0x449720){return db[_0x9ec3('0x97')][_0x9ec3('0x38')]({'where':{'FaxAccountId':_0x40b760[_0x9ec3('0x60')]['id']},'transaction':_0x131cd6})[_0x9ec3('0x39')](function(_0x38d953){return db[_0x9ec3('0x97')][_0x9ec3('0x99')](createExtensionsReciveFax(_['omit'](_0x40b760['body'],[_0x9ec3('0x9a'),'key',_0x9ec3('0x9b'),_0x9ec3('0x9c'),_0x9ec3('0x9d'),_0x9ec3('0x9e')])),{'transaction':_0x131cd6});});});})[_0x9ec3('0x39')](function(){return db[_0x9ec3('0x41')][_0x9ec3('0x9f')](_0x40b760[_0x9ec3('0x60')]['id']);})[_0x9ec3('0x39')](respondWithResult(_0xc58559,null))[_0x9ec3('0x59')](handleError(_0xc58559,null));};exports['getMessages']=function(_0x1de530,_0xe3bac8,_0x23fc43){var _0x4e6307={'raw':!![],'where':{}};var _0x1ea858={};var _0x55b43d={'count':0x0,'rows':[]};return db[_0x9ec3('0x41')][_0x9ec3('0x6c')]({'where':{'id':_0x1de530['params']['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0xe3bac8,null))[_0x9ec3('0x39')](function(_0x1b0409){if(_0x1b0409){_0x1ea858[_0x9ec3('0x45')]=_[_0x9ec3('0x5c')](db[_0x9ec3('0xa0')][_0x9ec3('0x42')]);_0x1ea858['query']=_[_0x9ec3('0x5c')](_0x1de530[_0x9ec3('0x47')]);_0x1ea858[_0x9ec3('0x51')]=_[_0x9ec3('0x48')](_0x1ea858[_0x9ec3('0x45')],_0x1ea858[_0x9ec3('0x47')]);_0x4e6307[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x1ea858[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x1de530['query'][_0x9ec3('0x49')]));_0x4e6307['attributes']=_0x4e6307[_0x9ec3('0x4a')][_0x9ec3('0x4b')]?_0x4e6307['attributes']:_0x1ea858['model'];if(!_0x1de530[_0x9ec3('0x47')][_0x9ec3('0x4c')](_0x9ec3('0x4d'))){_0x4e6307['limit']=qs[_0x9ec3('0x33')](_0x1de530[_0x9ec3('0x47')]['limit']);_0x4e6307[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0x1de530[_0x9ec3('0x47')][_0x9ec3('0x30')]);}_0x4e6307[_0x9ec3('0x4e')]=qs[_0x9ec3('0x4f')](_0x1de530[_0x9ec3('0x47')]['sort']);_0x4e6307[_0x9ec3('0x50')]=qs[_0x9ec3('0x51')](_[_0x9ec3('0x52')](_0x1de530[_0x9ec3('0x47')],_0x1ea858[_0x9ec3('0x51')]));_0x4e6307[_0x9ec3('0x50')][_0x9ec3('0x6a')]=_0x1b0409['id'];if(_0x1de530['query'][_0x9ec3('0x53')]){_0x4e6307[_0x9ec3('0x50')]=_[_0x9ec3('0x54')](_0x4e6307['where'],{'$or':_[_0x9ec3('0x46')](_0x4e6307['attributes'],function(_0x5cf5d7){var _0x4d6b92={};_0x4d6b92[_0x5cf5d7]={'$like':'%'+_0x1de530[_0x9ec3('0x47')][_0x9ec3('0x53')]+'%'};return _0x4d6b92;})});}if(_0x1de530[_0x9ec3('0x47')][_0x9ec3('0xa1')]){var _0x16bf65=_0x1de530['query'][_0x9ec3('0xa1')][_0x9ec3('0xa2')](',');var _0x1e8b9c={};_0x1e8b9c[_0x16bf65[0x0]]={'$gte':moment(_0x16bf65[0x1])[_0x9ec3('0xa3')](_0x9ec3('0xa4'))};_0x4e6307[_0x9ec3('0x50')]=_['merge'](_0x4e6307[_0x9ec3('0x50')],_0x1e8b9c);}_0x4e6307=_[_0x9ec3('0x54')]({},_0x4e6307,_0x1de530[_0x9ec3('0x55')]);return db[_0x9ec3('0xa0')][_0x9ec3('0x32')]({'where':_0x4e6307[_0x9ec3('0x50')]})[_0x9ec3('0x39')](function(_0xf3c8ea){_0x55b43d[_0x9ec3('0x32')]=_0xf3c8ea;if(_0x1de530[_0x9ec3('0x47')][_0x9ec3('0x5d')]){_0x4e6307[_0x9ec3('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4e6307);})[_0x9ec3('0x39')](function(_0x3d4f5a){_0x55b43d[_0x9ec3('0x58')]=_0x3d4f5a;return _0x55b43d;});}})[_0x9ec3('0x39')](respondWithFilteredResult(_0xe3bac8,_0x4e6307))[_0x9ec3('0x59')](handleError(_0xe3bac8,null));};exports['send']=function(_0x109240,_0x493cee,_0x482376){var _0x507551,_0x1e361f={},_0x18a89c;if(_0x109240[_0x9ec3('0x60')]['to']){_0x18a89c=_0x109240[_0x9ec3('0x60')]['to'][0x0];}return db[_0x9ec3('0x41')][_0x9ec3('0x5e')]({'where':{'id':_0x109240['params']['id']},'include':[{'model':db[_0x9ec3('0xa5')],'as':_0x9ec3('0xa6'),'include':[{'model':db[_0x9ec3('0x74')],'as':_0x9ec3('0xa7'),'where':{'fax':_0x18a89c},'limit':0x1,'order':[[_0x9ec3('0x9c'),_0x9ec3('0xa8')]]}]}]})[_0x9ec3('0x39')](handleEntityNotFound(_0x493cee,null))[_0x9ec3('0x39')](function(_0x3b9ac8){_0x507551=_0x3b9ac8;if(_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')]&&_0x109240['body'][_0x9ec3('0xa9')][_0x9ec3('0x4b')]){for(var _0x1f64ce=0x0;_0x1f64ce<_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][_0x9ec3('0x4b')];_0x1f64ce+=0x1){_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][_0x1f64ce]={'filename':_0x109240[_0x9ec3('0x60')]['attachments'][_0x1f64ce][_0x9ec3('0x3e')],'id':_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][_0x1f64ce]['id'],'path':path['join'](config[_0x9ec3('0xaa')],_0x9ec3('0xab'),_0x109240[_0x9ec3('0x60')]['attachments'][_0x1f64ce]['basename'])};}}return respondWithRpcPromise(_0x9ec3('0xac'),'CheckAfterSend',{'FaxAccountId':_[_0x9ec3('0xad')](_0x109240['params']['id'])?undefined:_0x109240[_0x9ec3('0x67')]['id'],'path':_[_0x9ec3('0xad')](_0x109240[_0x9ec3('0x60')]['attachments'][0x0]['path'])?undefined:_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][0x0][_0x9ec3('0xae')],'fax':_[_0x9ec3('0xad')](_0x109240[_0x9ec3('0x60')]['to'][0x0])?undefined:_0x109240[_0x9ec3('0x60')]['to'][0x0]},client9002);})[_0x9ec3('0x39')](function(){if(_0x507551){if(_['isNil'](_0x109240[_0x9ec3('0x60')]['from'])){_0x109240[_0x9ec3('0x60')]['from']=util[_0x9ec3('0xa3')](_0x9ec3('0xaf'),_0x507551[_0x9ec3('0x3e')],_0x507551[_0x9ec3('0xb0')]);}if(_0x507551[_0x9ec3('0xa6')]){if(_0x507551[_0x9ec3('0xa6')][_0x9ec3('0xa7')][_0x9ec3('0x4b')]){return _0x507551['List'][_0x9ec3('0xa7')][0x0];}else{return db[_0x9ec3('0x74')]['create'](_['defaults'](_0x109240['body'],{'firstName':_0x109240[_0x9ec3('0x60')]['to'][0x0],'phone':_0x109240[_0x9ec3('0x60')]['to'][0x0],'fax':_0x109240[_0x9ec3('0x60')]['to'][0x0],'ListId':_0x507551[_0x9ec3('0x9e')]}));}}else{throw new Error(_0x9ec3('0xb1'));}}else{throw new Error(_0x9ec3('0xb2'));}})[_0x9ec3('0x39')](function(_0x40ff43){if(_0x40ff43){return db[_0x9ec3('0x73')][_0x9ec3('0x5e')]({'where':{'ContactId':_0x40ff43['id'],'closed':![],'FaxAccountId':_0x507551['id']}})[_0x9ec3('0x39')](function(_0x3242a5){if(_0x3242a5){return[_0x3242a5,![]];}return db['FaxInteraction']['create']({'UserId':_0x109240[_0x9ec3('0x63')]['id'],'ContactId':_0x40ff43['id'],'FaxAccountId':_0x507551['id'],'fax':_0x109240[_0x9ec3('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x109240['body'],{'read':![],'body':_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][0x0][_0x9ec3('0xb3')],'FaxAccountId':_0x507551['id'],'UserId':_0x109240[_0x9ec3('0x63')]['id'],'ContactId':_0x40ff43['id'],'AttachmentId':_0x109240['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x9ec3('0xa0')],'as':_0x9ec3('0xb4')}]})['then'](function(_0xcf5a3d){return[_0xcf5a3d,!![]];});});}else{throw new Error(_0x9ec3('0xb5'));}})['spread'](function(_0x3eda30,_0x2dcbc8){if(_0x2dcbc8){return _0x3eda30;}return db['FaxMessage'][_0x9ec3('0x5f')]({'direction':_0x9ec3('0xb6'),'read':![],'body':_0x109240[_0x9ec3('0x60')]['attachments'][0x0][_0x9ec3('0xb3')],'FaxAccountId':_0x507551['id'],'FaxInteractionId':_0x3eda30['id'],'UserId':_0x109240['user']['id'],'ContactId':_0x3eda30[_0x9ec3('0xb7')],'AttachmentId':_0x109240[_0x9ec3('0x60')][_0x9ec3('0xa9')][0x0]['id']})[_0x9ec3('0x39')](function(_0x420ddd){_0x3eda30[_0x9ec3('0xb8')][_0x9ec3('0xb4')]=[];_0x3eda30[_0x9ec3('0xb8')][_0x9ec3('0xb4')][_0x9ec3('0x8b')](_0x420ddd[_0x9ec3('0xb8')]);return _0x3eda30;});})[_0x9ec3('0x39')](function(_0x2267f5){respondWithRpcPromise(_0x9ec3('0xb9'),_0x9ec3('0xb9'),{'FaxAccountId':_[_0x9ec3('0xad')](_0x109240[_0x9ec3('0x67')]['id'])?undefined:_0x109240[_0x9ec3('0x67')]['id'],'path':_[_0x9ec3('0xad')](_0x109240[_0x9ec3('0x60')]['attachments'][0x0][_0x9ec3('0xae')])?undefined:_0x109240['body']['attachments'][0x0][_0x9ec3('0xae')],'fax':_[_0x9ec3('0xad')](_0x109240[_0x9ec3('0x60')]['to'][0x0])?undefined:_0x109240['body']['to'][0x0],'AttachmentId':_0x109240['body'][_0x9ec3('0xa9')][0x0]['id']},client9002)[_0x9ec3('0x39')](function(_0x14dcec){logger['info']('SendFaxRpc,\x20%s',_0x14dcec);})['catch'](function(_0x1df823){logger[_0x9ec3('0x24')]('SendFaxRpc,\x20%s',_0x1df823);});return _0x2267f5;})[_0x9ec3('0x39')](respondWithResult(_0x493cee,null))[_0x9ec3('0x59')](handleError(_0x493cee,null));};exports[_0x9ec3('0xba')]=function(_0x334747,_0x1cbecf,_0x3439f3){return db[_0x9ec3('0x41')]['find']({'where':{'id':_0x334747[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x1cbecf,null))['then'](function(_0x2492dc){if(_0x2492dc){return _0x2492dc[_0x9ec3('0xba')](_0x334747[_0x9ec3('0x60')][_0x9ec3('0x6f')],_[_0x9ec3('0xbb')](_0x334747['body'],[_0x9ec3('0x6f'),'id'])||{})[_0x9ec3('0xbc')](function(_0x350439){for(var _0x17843a=0x0;_0x17843a<_0x334747[_0x9ec3('0x60')][_0x9ec3('0x6f')][_0x9ec3('0x4b')];_0x17843a+=0x1){socket[_0x9ec3('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x334747['body'][_0x9ec3('0x6f')][_0x17843a]),'FaxAccountId':Number(_0x334747[_0x9ec3('0x67')]['id'])});}return _0x350439;});}})['then'](respondWithResult(_0x1cbecf,null))[_0x9ec3('0x59')](handleError(_0x1cbecf,null));};exports[_0x9ec3('0xbe')]=function(_0x21651a,_0x4830d6,_0x202b8a){return db[_0x9ec3('0x41')][_0x9ec3('0x5e')]({'where':{'id':_0x21651a[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x4830d6,null))[_0x9ec3('0x39')](function(_0x47ccef){if(_0x47ccef){return _0x47ccef[_0x9ec3('0xbe')](_0x21651a[_0x9ec3('0x47')]['ids'])[_0x9ec3('0x39')](function(){if(_[_0x9ec3('0xbf')](_0x21651a[_0x9ec3('0x47')]['ids'])){for(var _0x4198f7=0x0;_0x4198f7<_0x21651a[_0x9ec3('0x47')][_0x9ec3('0x6f')][_0x9ec3('0x4b')];_0x4198f7+=0x1){socket[_0x9ec3('0xbd')](_0x9ec3('0xc0'),{'UserId':Number(_0x21651a[_0x9ec3('0x47')]['ids'][_0x4198f7]),'FaxAccountId':Number(_0x21651a[_0x9ec3('0x67')]['id'])});}}else{socket['emit'](_0x9ec3('0xc0'),{'UserId':Number(_0x21651a['query'][_0x9ec3('0x6f')]),'FaxAccountId':Number(_0x21651a[_0x9ec3('0x67')]['id'])});}});}})[_0x9ec3('0x39')](respondWithStatusCode(_0x4830d6,null))[_0x9ec3('0x59')](handleError(_0x4830d6,null));};exports[_0x9ec3('0xc1')]=function(_0x4a5fc2,_0x177ff6,_0x325a2f){var _0x1a8a92={};var _0x27ff9a={};var _0x18ec15;var _0x2a79cf;return db['FaxAccount']['findOne']({'where':{'id':_0x4a5fc2[_0x9ec3('0x67')]['id']}})[_0x9ec3('0x39')](handleEntityNotFound(_0x177ff6,null))[_0x9ec3('0x39')](function(_0x58fbf5){if(_0x58fbf5){_0x18ec15=_0x58fbf5;_0x27ff9a[_0x9ec3('0x45')]=_['keys'](db[_0x9ec3('0x76')][_0x9ec3('0x42')]);_0x27ff9a[_0x9ec3('0x47')]=_['keys'](_0x4a5fc2[_0x9ec3('0x47')]);_0x27ff9a['filters']=_[_0x9ec3('0x48')](_0x27ff9a[_0x9ec3('0x45')],_0x27ff9a[_0x9ec3('0x47')]);_0x1a8a92[_0x9ec3('0x4a')]=_[_0x9ec3('0x48')](_0x27ff9a[_0x9ec3('0x45')],qs[_0x9ec3('0x49')](_0x4a5fc2[_0x9ec3('0x47')][_0x9ec3('0x49')]));_0x1a8a92[_0x9ec3('0x4a')]=_0x1a8a92['attributes'][_0x9ec3('0x4b')]?_0x1a8a92['attributes']:_0x27ff9a[_0x9ec3('0x45')];_0x1a8a92[_0x9ec3('0x4e')]=qs[_0x9ec3('0x4f')](_0x4a5fc2['query'][_0x9ec3('0x4f')]);_0x1a8a92['where']=qs[_0x9ec3('0x51')](_[_0x9ec3('0x52')](_0x4a5fc2['query'],_0x27ff9a[_0x9ec3('0x51')]));if(_0x4a5fc2['query'][_0x9ec3('0x53')]){_0x1a8a92[_0x9ec3('0x50')]=_[_0x9ec3('0x54')](_0x1a8a92[_0x9ec3('0x50')],{'$or':_[_0x9ec3('0x46')](_0x1a8a92[_0x9ec3('0x4a')],function(_0x169a68){var _0x3acae4={};_0x3acae4[_0x169a68]={'$like':'%'+_0x4a5fc2[_0x9ec3('0x47')][_0x9ec3('0x53')]+'%'};return _0x3acae4;})});}_0x1a8a92=_[_0x9ec3('0x54')]({},_0x1a8a92,_0x4a5fc2[_0x9ec3('0x55')]);return _0x18ec15[_0x9ec3('0xc1')](_0x1a8a92);}})['then'](function(_0xa58b12){if(_0xa58b12){_0x2a79cf=_0xa58b12[_0x9ec3('0x4b')];if(!_0x4a5fc2['query'][_0x9ec3('0x4c')]('nolimit')){_0x1a8a92[_0x9ec3('0x33')]=qs[_0x9ec3('0x33')](_0x4a5fc2[_0x9ec3('0x47')][_0x9ec3('0x33')]);_0x1a8a92[_0x9ec3('0x30')]=qs[_0x9ec3('0x30')](_0x4a5fc2[_0x9ec3('0x47')][_0x9ec3('0x30')]);}return _0x18ec15[_0x9ec3('0xc1')](_0x1a8a92);}})[_0x9ec3('0x39')](function(_0x485342){if(_0x485342){return _0x485342?{'count':_0x2a79cf,'rows':_0x485342}:null;}})['then'](respondWithResult(_0x177ff6,null))[_0x9ec3('0x59')](handleError(_0x177ff6,null));}; \ No newline at end of file +var _0xf00d=['debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','destroy','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','find','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','rows','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','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','transaction','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','register','client','http','request','then','request\x20sent'];(function(_0x29626e,_0x5c06c4){var _0xa446d5=function(_0x310d7c){while(--_0x310d7c){_0x29626e['push'](_0x29626e['shift']());}};_0xa446d5(++_0x5c06c4);}(_0xf00d,0xa6));var _0xdf00=function(_0xecd8a2,_0x1fb96b){_0xecd8a2=_0xecd8a2-0x0;var _0x1c9756=_0xf00d[_0xecd8a2];return _0x1c9756;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf00('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf00('0x1'));var moment=require('moment');var BPromise=require(_0xdf00('0x2'));var Mustache=require(_0xdf00('0x3'));var util=require(_0xdf00('0x4'));var path=require('path');var sox=require(_0xdf00('0x5'));var csv=require(_0xdf00('0x6'));var ejs=require(_0xdf00('0x7'));var fs=require('fs');var fs_extra=require(_0xdf00('0x8'));var _=require('lodash');var squel=require(_0xdf00('0x9'));var crypto=require(_0xdf00('0xa'));var jsforce=require(_0xdf00('0xb'));var deskjs=require(_0xdf00('0xc'));var toCsv=require(_0xdf00('0x6'));var querystring=require(_0xdf00('0xd'));var Papa=require(_0xdf00('0xe'));var Redis=require('ioredis');var authService=require(_0xdf00('0xf'));var qs=require(_0xdf00('0x10'));var as=require(_0xdf00('0x11'));var hardwareService=require(_0xdf00('0x12'));var logger=require('../../config/logger')(_0xdf00('0x13'));var utils=require('../../config/utils');var config=require(_0xdf00('0x14'));var licenseUtil=require(_0xdf00('0x15'));var db=require(_0xdf00('0x16'))['db'];config[_0xdf00('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xdf00('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf00('0x19')][_0xdf00('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7962,_0x2f9ad2,_0x3e8173,_0x482be6){return new BPromise(function(_0x15dc73,_0x292997){var _0x551d55=_0x482be6||client;return _0x551d55[_0xdf00('0x1b')](_0x4d7962,_0x3e8173)[_0xdf00('0x1c')](function(_0x41a80d){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2f9ad2,_0xdf00('0x1d'));logger[_0xdf00('0x1e')](_0xdf00('0x1f'),_0x2f9ad2,_0xdf00('0x1d'),JSON[_0xdf00('0x20')](_0x41a80d));if(_0x41a80d[_0xdf00('0x21')]){if(_0x41a80d['error']['code']===0x1f4){logger[_0xdf00('0x21')](_0xdf00('0x22'),_0x2f9ad2,_0x41a80d[_0xdf00('0x21')]['message']);return _0x292997(_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);}logger['error'](_0xdf00('0x22'),_0x2f9ad2,_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);return _0x15dc73(_0x41a80d[_0xdf00('0x21')][_0xdf00('0x23')]);}else{logger[_0xdf00('0x24')](_0xdf00('0x22'),_0x2f9ad2,_0xdf00('0x1d'));_0x15dc73(_0x41a80d[_0xdf00('0x25')][_0xdf00('0x23')]);}})[_0xdf00('0x26')](function(_0x29a0b2){logger['error'](_0xdf00('0x22'),_0x2f9ad2,_0x29a0b2);_0x292997(_0x29a0b2);});});}function respondWithStatusCode(_0x3f4692,_0x519e28){_0x519e28=_0x519e28||0xcc;return function(_0x2f4255){if(_0x2f4255){return _0x3f4692[_0xdf00('0x27')](_0x519e28);}return _0x3f4692[_0xdf00('0x28')](_0x519e28)['end']();};}function respondWithResult(_0x8b21a2,_0x3917b0){_0x3917b0=_0x3917b0||0xc8;return function(_0x3c9f3a){if(_0x3c9f3a){return _0x8b21a2[_0xdf00('0x28')](_0x3917b0)[_0xdf00('0x29')](_0x3c9f3a);}};}function respondWithFilteredResult(_0x4209b6,_0x4f3cb6){return function(_0x3ab4aa){if(_0x3ab4aa){var _0x1a9696=typeof _0x4f3cb6[_0xdf00('0x2a')]===_0xdf00('0x2b')&&typeof _0x4f3cb6[_0xdf00('0x2c')]===_0xdf00('0x2b');var _0x29bf88=_0x3ab4aa[_0xdf00('0x2d')];var _0x456fcd=_0x1a9696?0x0:_0x4f3cb6[_0xdf00('0x2a')];var _0x283293=_0x1a9696?_0x3ab4aa[_0xdf00('0x2d')]:_0x4f3cb6[_0xdf00('0x2a')]+_0x4f3cb6[_0xdf00('0x2c')];var _0x4b207b;if(_0x283293>=_0x29bf88){_0x283293=_0x29bf88;_0x4b207b=0xc8;}else{_0x4b207b=0xce;}_0x4209b6[_0xdf00('0x28')](_0x4b207b);return _0x4209b6['set']('Content-Range',_0x456fcd+'-'+_0x283293+'/'+_0x29bf88)['json'](_0x3ab4aa);}return null;};}function patchUpdates(_0x423cd5){return function(_0x38cd26){try{jsonpatch[_0xdf00('0x2e')](_0x38cd26,_0x423cd5,!![]);}catch(_0x49e884){return BPromise[_0xdf00('0x2f')](_0x49e884);}return _0x38cd26['save']();};}function saveUpdates(_0xe270d3,_0x59477d){return function(_0x2686c2){if(_0x2686c2){return _0x2686c2[_0xdf00('0x30')](_0xe270d3)[_0xdf00('0x1c')](function(_0x5e17b6){return _0x5e17b6;});}return null;};}function removeEntity(_0x5f0b6e,_0x50c375){return function(_0x2a8f86){if(_0x2a8f86){return _0x2a8f86[_0xdf00('0x31')]()[_0xdf00('0x1c')](function(){var _0x1b03c2=_0x2a8f86['get']({'plain':!![]});var _0x3ecc60='FaxAccounts';return db[_0xdf00('0x32')][_0xdf00('0x31')]({'where':{'type':_0x3ecc60,'resourceId':_0x1b03c2['id']}})[_0xdf00('0x1c')](function(){return _0x2a8f86;});})['then'](function(){_0x5f0b6e[_0xdf00('0x28')](0xcc)[_0xdf00('0x33')]();});}};}function handleEntityNotFound(_0x5364ee,_0x450675){return function(_0x2981aa){if(!_0x2981aa){_0x5364ee['sendStatus'](0x194);}return _0x2981aa;};}function handleError(_0x206af2,_0x5358db){_0x5358db=_0x5358db||0x1f4;return function(_0x484078){logger[_0xdf00('0x21')](_0x484078[_0xdf00('0x34')]);if(_0x484078[_0xdf00('0x35')]){delete _0x484078['name'];}_0x206af2['status'](_0x5358db)[_0xdf00('0x36')](_0x484078);};}exports[_0xdf00('0x37')]=function(_0x15d225,_0x3e36ea){var _0x4bcdc1={'include':[{'model':db['Pause'],'as':_0xdf00('0x38')}]},_0x536a30={},_0x32b7cd={'count':0x0,'rows':[]};var _0x2144f0=_[_0xdf00('0x39')](db[_0xdf00('0x3a')][_0xdf00('0x3b')],function(_0xc27352){return{'name':_0xc27352[_0xdf00('0x3c')],'type':_0xc27352[_0xdf00('0x3d')][_0xdf00('0x3e')]};});_0x536a30['model']=_[_0xdf00('0x39')](_0x2144f0,'name');_0x536a30[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x15d225[_0xdf00('0x3f')]);_0x536a30[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x536a30[_0xdf00('0x43')],_0x536a30[_0xdf00('0x3f')]);_0x4bcdc1[_0xdf00('0x44')]=_['intersection'](_0x536a30[_0xdf00('0x43')],qs['fields'](_0x15d225['query'][_0xdf00('0x45')]));_0x4bcdc1['attributes']=_0x4bcdc1['attributes'][_0xdf00('0x46')]?_0x4bcdc1[_0xdf00('0x44')]:_0x536a30[_0xdf00('0x43')];if(!_0x15d225[_0xdf00('0x3f')]['hasOwnProperty'](_0xdf00('0x47'))){_0x4bcdc1[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x15d225[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x4bcdc1['offset']=qs['offset'](_0x15d225[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x4bcdc1[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x15d225['query'][_0xdf00('0x49')]);_0x4bcdc1[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x15d225['query'],_0x536a30[_0xdf00('0x41')]),_0x2144f0);if(_0x15d225[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x4bcdc1[_0xdf00('0x4a')]=_['merge'](_0x4bcdc1['where'],{'$or':_['map'](_0x2144f0,function(_0x31226b){if(_0x31226b[_0xdf00('0x3d')]!=='VIRTUAL'){var _0x1b31fc={};_0x1b31fc[_0x31226b['name']]={'$like':'%'+_0x15d225[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x1b31fc;}})});}_0x4bcdc1=_[_0xdf00('0x4d')]({},_0x4bcdc1,_0x15d225[_0xdf00('0x4e')]);var _0x467b94={'where':_0x4bcdc1[_0xdf00('0x4a')]};return db[_0xdf00('0x3a')][_0xdf00('0x2d')](_0x467b94)['then'](function(_0x52bd3f){_0x32b7cd[_0xdf00('0x2d')]=_0x52bd3f;if(_0x15d225[_0xdf00('0x3f')]['includeAll']){_0x4bcdc1[_0xdf00('0x4f')]=[{'all':!![]}];}return db[_0xdf00('0x3a')][_0xdf00('0x50')](_0x4bcdc1);})['then'](function(_0x3fa555){_0x32b7cd['rows']=_0x3fa555;return _0x32b7cd;})[_0xdf00('0x1c')](respondWithFilteredResult(_0x3e36ea,_0x4bcdc1))[_0xdf00('0x26')](handleError(_0x3e36ea,null));};exports[_0xdf00('0x51')]=function(_0x40cc68,_0x39c7af){var _0x3d1d93={'raw':![],'where':{'id':_0x40cc68[_0xdf00('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xdf00('0x38')}]},_0x1ea156={};_0x1ea156[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x3a')][_0xdf00('0x3b')]);_0x1ea156[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x40cc68[_0xdf00('0x3f')]);_0x1ea156['filters']=_[_0xdf00('0x42')](_0x1ea156[_0xdf00('0x43')],_0x1ea156['query']);_0x3d1d93[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x1ea156[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x40cc68['query']['fields']));_0x3d1d93[_0xdf00('0x44')]=_0x3d1d93[_0xdf00('0x44')][_0xdf00('0x46')]?_0x3d1d93[_0xdf00('0x44')]:_0x1ea156[_0xdf00('0x43')];if(_0x40cc68[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x3d1d93[_0xdf00('0x4f')]=[{'all':!![]}];}_0x3d1d93=_[_0xdf00('0x4d')]({},_0x3d1d93,_0x40cc68[_0xdf00('0x4e')]);return db[_0xdf00('0x3a')]['find'](_0x3d1d93)[_0xdf00('0x1c')](handleEntityNotFound(_0x39c7af,null))[_0xdf00('0x1c')](respondWithResult(_0x39c7af,null))[_0xdf00('0x26')](handleError(_0x39c7af,null));};exports[_0xdf00('0x54')]=function(_0x1b2120,_0x4fa0ad){return db[_0xdf00('0x3a')][_0xdf00('0x54')](_0x1b2120[_0xdf00('0x55')],{})['then'](function(_0x5a5603){var _0x519188=_0x1b2120[_0xdf00('0x56')]['get']({'plain':!![]});if(!_0x519188)throw new Error(_0xdf00('0x57'));if(_0x519188['role']===_0xdf00('0x56')){var _0x25fdbd=_0x5a5603[_0xdf00('0x58')]({'plain':!![]});var _0x3feab5=_0xdf00('0x59');return db[_0xdf00('0x5a')]['find']({'where':{'name':_0x3feab5,'userProfileId':_0x519188[_0xdf00('0x5b')]},'raw':!![]})['then'](function(_0x5be972){if(_0x5be972&&_0x5be972['autoAssociation']===0x0){return db[_0xdf00('0x32')]['create']({'name':_0x25fdbd[_0xdf00('0x35')],'resourceId':_0x25fdbd['id'],'type':_0x5be972[_0xdf00('0x35')],'sectionId':_0x5be972['id']},{})[_0xdf00('0x1c')](function(){return _0x5a5603;});}else{return _0x5a5603;}})[_0xdf00('0x26')](function(_0x1b57b3){logger[_0xdf00('0x21')](_0xdf00('0x5c'),_0x1b57b3);throw _0x1b57b3;});}return _0x5a5603;})[_0xdf00('0x1c')](respondWithResult(_0x4fa0ad,0xc9))[_0xdf00('0x26')](handleError(_0x4fa0ad,null));};exports[_0xdf00('0x30')]=function(_0x44bc15,_0x5bb0f4){if(_0x44bc15[_0xdf00('0x55')]['id']){delete _0x44bc15[_0xdf00('0x55')]['id'];}return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x44bc15[_0xdf00('0x52')]['id']},'include':[{'model':db[_0xdf00('0x5d')],'as':'mandatoryDispositionPause'}]})[_0xdf00('0x1c')](handleEntityNotFound(_0x5bb0f4,null))[_0xdf00('0x1c')](saveUpdates(_0x44bc15[_0xdf00('0x55')],null))[_0xdf00('0x1c')](respondWithResult(_0x5bb0f4,null))[_0xdf00('0x26')](handleError(_0x5bb0f4,null));};exports['destroy']=function(_0x3d7da0,_0x217079){return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x3d7da0[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x217079,null))[_0xdf00('0x1c')](removeEntity(_0x217079,null))[_0xdf00('0x26')](handleError(_0x217079,null));};exports[_0xdf00('0x5e')]=function(_0x5015c9,_0x3fff4d){return db[_0xdf00('0x3a')][_0xdf00('0x5e')]()[_0xdf00('0x1c')](respondWithResult(_0x3fff4d,null))[_0xdf00('0x26')](handleError(_0x3fff4d,null));};exports[_0xdf00('0x5f')]=function(_0x222336,_0x21435e,_0x581599){if(_0x222336[_0xdf00('0x55')]['id']){delete _0x222336['body']['id'];}return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x222336[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x21435e,null))[_0xdf00('0x1c')](function(_0xb7c125){if(_0xb7c125){_0x222336[_0xdf00('0x55')][_0xdf00('0x61')]=_0xb7c125['id'];return db[_0xdf00('0x62')][_0xdf00('0x54')](_0x222336[_0xdf00('0x55')]);}})[_0xdf00('0x1c')](respondWithResult(_0x21435e,null))['catch'](handleError(_0x21435e,null));};exports[_0xdf00('0x63')]=function(_0x37c0bf,_0xeb3b8b,_0x2538d5){var _0x1454b2={'raw':![],'where':{}};var _0x4a0a22={};var _0x13e35e={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x37c0bf['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xeb3b8b,null))[_0xdf00('0x1c')](function(_0x41f2b0){if(_0x41f2b0){_0x4a0a22[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x62')]['rawAttributes']);_0x4a0a22[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x37c0bf[_0xdf00('0x3f')]);_0x4a0a22['filters']=_[_0xdf00('0x42')](_0x4a0a22[_0xdf00('0x43')],_0x4a0a22['query']);_0x1454b2['attributes']=_[_0xdf00('0x42')](_0x4a0a22['model'],qs[_0xdf00('0x45')](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x1454b2['attributes']=_0x1454b2['attributes']['length']?_0x1454b2['attributes']:_0x4a0a22['model'];if(!_0x37c0bf[_0xdf00('0x3f')]['hasOwnProperty']('nolimit')){_0x1454b2[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x1454b2['offset']=qs['offset'](_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x1454b2[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x37c0bf['query'][_0xdf00('0x49')]);_0x1454b2[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x37c0bf[_0xdf00('0x3f')],_0x4a0a22[_0xdf00('0x41')]));_0x1454b2[_0xdf00('0x4a')][_0xdf00('0x61')]=_0x41f2b0['id'];if(_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x1454b2[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x1454b2['where'],{'$or':_[_0xdf00('0x39')](_0x1454b2[_0xdf00('0x44')],function(_0x1e8561){var _0x285d2f={};_0x285d2f[_0x1e8561]={'$like':'%'+_0x37c0bf['query'][_0xdf00('0x4c')]+'%'};return _0x285d2f;})});}_0x1454b2=_[_0xdf00('0x4d')]({},_0x1454b2,_0x37c0bf[_0xdf00('0x4e')]);return db[_0xdf00('0x62')][_0xdf00('0x2d')]({'where':_0x1454b2['where']})[_0xdf00('0x1c')](function(_0x540feb){_0x13e35e[_0xdf00('0x2d')]=_0x540feb;if(_0x37c0bf[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x1454b2['include']=[{'all':!![]}];}return db['Disposition'][_0xdf00('0x50')](_0x1454b2);})[_0xdf00('0x1c')](function(_0x4650de){_0x13e35e['rows']=_0x4650de;return _0x13e35e;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0xeb3b8b,_0x1454b2))[_0xdf00('0x26')](handleError(_0xeb3b8b,null));};exports['removeDispositions']=function(_0xbd161e,_0x572c67,_0x42da6d){return db['FaxAccount'][_0xdf00('0x60')]({'where':{'id':_0xbd161e[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x572c67,null))[_0xdf00('0x1c')](function(_0x186158){if(_0x186158){return _0x186158[_0xdf00('0x65')](_0xbd161e[_0xdf00('0x3f')]['ids']);}})[_0xdf00('0x1c')](respondWithStatusCode(_0x572c67,null))['catch'](handleError(_0x572c67,null));};exports[_0xdf00('0x66')]=function(_0x586904,_0xa1db02,_0x53b950){if(_0x586904['body']['id']){delete _0x586904['body']['id'];}return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x586904[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xa1db02,null))['then'](function(_0x2c5d53){if(_0x2c5d53){_0x586904[_0xdf00('0x55')][_0xdf00('0x61')]=_0x2c5d53['id'];return db[_0xdf00('0x67')][_0xdf00('0x54')](_0x586904['body']);}})[_0xdf00('0x1c')](respondWithResult(_0xa1db02,null))[_0xdf00('0x26')](handleError(_0xa1db02,null));};exports[_0xdf00('0x68')]=function(_0x253f5f,_0x414bea,_0x2a1ae3){var _0x486273={'raw':![],'where':{}};var _0x3c6e01={};var _0x32d749={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x253f5f[_0xdf00('0x52')]['id']}})['then'](handleEntityNotFound(_0x414bea,null))['then'](function(_0x47e1b9){if(_0x47e1b9){_0x3c6e01['model']=_[_0xdf00('0x40')](db[_0xdf00('0x67')][_0xdf00('0x3b')]);_0x3c6e01[_0xdf00('0x3f')]=_['keys'](_0x253f5f[_0xdf00('0x3f')]);_0x3c6e01[_0xdf00('0x41')]=_['intersection'](_0x3c6e01[_0xdf00('0x43')],_0x3c6e01[_0xdf00('0x3f')]);_0x486273[_0xdf00('0x44')]=_['intersection'](_0x3c6e01[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x486273[_0xdf00('0x44')]=_0x486273[_0xdf00('0x44')][_0xdf00('0x46')]?_0x486273[_0xdf00('0x44')]:_0x3c6e01[_0xdf00('0x43')];if(!_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x69')]('nolimit')){_0x486273['limit']=qs[_0xdf00('0x2c')](_0x253f5f['query'][_0xdf00('0x2c')]);_0x486273[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x253f5f[_0xdf00('0x3f')]['offset']);}_0x486273[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x253f5f[_0xdf00('0x3f')]['sort']);_0x486273[_0xdf00('0x4a')]=qs['filters'](_[_0xdf00('0x4b')](_0x253f5f[_0xdf00('0x3f')],_0x3c6e01[_0xdf00('0x41')]));_0x486273['where']['FaxAccountId']=_0x47e1b9['id'];if(_0x253f5f[_0xdf00('0x3f')]['filter']){_0x486273[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x486273[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x486273[_0xdf00('0x44')],function(_0x23f687){var _0x36d38b={};_0x36d38b[_0x23f687]={'$like':'%'+_0x253f5f[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x36d38b;})});}_0x486273=_['merge']({},_0x486273,_0x253f5f[_0xdf00('0x4e')]);return db[_0xdf00('0x67')]['count']({'where':_0x486273['where']})[_0xdf00('0x1c')](function(_0x2becf2){_0x32d749[_0xdf00('0x2d')]=_0x2becf2;if(_0x253f5f[_0xdf00('0x3f')]['includeAll']){_0x486273[_0xdf00('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdf00('0x50')](_0x486273);})[_0xdf00('0x1c')](function(_0x50bf91){_0x32d749[_0xdf00('0x6a')]=_0x50bf91;return _0x32d749;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0x414bea,_0x486273))[_0xdf00('0x26')](handleError(_0x414bea,null));};exports['removeAnswers']=function(_0x53314d,_0x75696c,_0xb39e8c){return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x53314d[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x75696c,null))['then'](function(_0x469f4b){if(_0x469f4b){return _0x469f4b[_0xdf00('0x6b')](_0x53314d['query']['ids']);}})[_0xdf00('0x1c')](respondWithStatusCode(_0x75696c,null))[_0xdf00('0x26')](handleError(_0x75696c,null));};exports[_0xdf00('0x6c')]=function(_0x100989,_0xc64b3,_0x3603a1){return db[_0xdf00('0x6d')][_0xdf00('0x60')]({'where':{'id':_0x100989['params']['id']}})['then'](handleEntityNotFound(_0xc64b3,null))[_0xdf00('0x1c')](function(_0x2256b7){if(_0x2256b7){return _0x2256b7[_0xdf00('0x6c')](_0x100989['body'][_0xdf00('0x6e')],_[_0xdf00('0x6f')](_0x100989[_0xdf00('0x55')],['ids','id'])||{});}})[_0xdf00('0x1c')](respondWithResult(_0xc64b3,null))[_0xdf00('0x26')](handleError(_0xc64b3,null));};exports[_0xdf00('0x70')]=function(_0x2fa2bd,_0xd0a470,_0x1e31ae){var _0x2c5dee={'raw':![],'where':{}};var _0x20a25e={};var _0x2d207c={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')]['findOne']({'where':{'id':_0x2fa2bd['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xd0a470,null))[_0xdf00('0x1c')](function(_0x359466){if(_0x359466){_0x20a25e[_0xdf00('0x43')]=_[_0xdf00('0x40')](db[_0xdf00('0x6d')]['rawAttributes']);_0x20a25e[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x2fa2bd['query']);_0x20a25e[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x20a25e[_0xdf00('0x43')],_0x20a25e[_0xdf00('0x3f')]);_0x2c5dee['attributes']=_[_0xdf00('0x42')](_0x20a25e[_0xdf00('0x43')],qs['fields'](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x2c5dee[_0xdf00('0x44')]=_0x2c5dee[_0xdf00('0x44')]['length']?_0x2c5dee[_0xdf00('0x44')]:_0x20a25e[_0xdf00('0x43')];if(!_0x2fa2bd[_0xdf00('0x3f')]['hasOwnProperty'](_0xdf00('0x47'))){_0x2c5dee[_0xdf00('0x2c')]=qs[_0xdf00('0x2c')](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x2c5dee[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x2a')]);}_0x2c5dee[_0xdf00('0x48')]=qs['sort'](_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x49')]);_0x2c5dee[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_['pick'](_0x2fa2bd[_0xdf00('0x3f')],_0x20a25e[_0xdf00('0x41')]));_0x2c5dee[_0xdf00('0x4a')][_0xdf00('0x61')]=_0x359466['id'];if(_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x2c5dee[_0xdf00('0x4a')]=_['merge'](_0x2c5dee[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x2c5dee[_0xdf00('0x44')],function(_0x46c36a){var _0x42deca={};_0x42deca[_0x46c36a]={'$like':'%'+_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x4c')]+'%'};return _0x42deca;})});}_0x2c5dee=_[_0xdf00('0x4d')]({},_0x2c5dee,_0x2fa2bd[_0xdf00('0x4e')]);return db['FaxInteraction']['count']({'where':_0x2c5dee['where']})[_0xdf00('0x1c')](function(_0xdab503){_0x2d207c[_0xdf00('0x2d')]=_0xdab503;if(_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x53')]){_0x2c5dee[_0xdf00('0x4f')]=[{'model':db['CmContact'],'as':_0xdf00('0x71'),'required':![]},{'model':db[_0xdf00('0x72')],'as':_0xdf00('0x73'),'attributes':[_0xdf00('0x35'),_0xdf00('0x74'),'internal'],'required':![]},{'model':db[_0xdf00('0x75')],'as':_0xdf00('0x76'),'attributes':['id',_0xdf00('0x35'),_0xdf00('0x77')],'where':_0x2fa2bd[_0xdf00('0x3f')]['tag']?{'id':_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x78')]}:undefined,'required':_0x2fa2bd[_0xdf00('0x3f')][_0xdf00('0x78')]?!![]:![]}];}return db[_0xdf00('0x6d')][_0xdf00('0x50')](_0x2c5dee);})[_0xdf00('0x1c')](function(_0x241cd7){_0x2d207c[_0xdf00('0x6a')]=_0x241cd7;return _0x2d207c;});}})[_0xdf00('0x1c')](respondWithFilteredResult(_0xd0a470,_0x2c5dee))[_0xdf00('0x26')](handleError(_0xd0a470,null));};exports['addApplications']=function(_0x11a481,_0x40df2b){var _0x409c84=_0x11a481[_0xdf00('0x52')]['id'];var _0x4202b6=_0x11a481['body'];var _0x174435=0xc8;var _0x31a13d=null;return db[_0xdf00('0x79')]['transaction']({'isolationLevel':db[_0xdf00('0x79')][_0xdf00('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x42faee){return db['FaxAccount'][_0xdf00('0x64')]({'where':{'id':_0x409c84},'transaction':_0x42faee})[_0xdf00('0x1c')](function(_0x51f7fa){if(_0x51f7fa){return db[_0xdf00('0x7b')][_0xdf00('0x31')]({'where':{'FaxAccountId':_0x409c84},'transaction':_0x42faee})[_0xdf00('0x1c')](function(){var _0x47f99d=_[_0xdf00('0x39')](_0x4202b6,function(_0x218f2c){_0x218f2c['FaxAccountId']=_0x409c84;return _0x218f2c;});return db['FaxApplication'][_0xdf00('0x7c')](_0x47f99d,{'transaction':_0x42faee});});}else{_0x174435=0x194;_0x31a13d=[];}});})[_0xdf00('0x1c')](function(){if(_0x174435!==0x194){return db['FaxApplication'][_0xdf00('0x7d')]({'where':{'FaxAccountId':_0x409c84},'order':_0xdf00('0x7e')})[_0xdf00('0x1c')](function(_0x321127){_0x31a13d=_0x321127;});}})[_0xdf00('0x26')](function(_0x34df8f){_0x174435=0x1f4;logger[_0xdf00('0x21')](_0x34df8f['stack']);if(_0x34df8f[_0xdf00('0x35')]){delete _0x34df8f[_0xdf00('0x35')];}_0x31a13d=_0x34df8f;})[_0xdf00('0x7f')](function(){if(_0x31a13d===null){_0x40df2b[_0xdf00('0x27')](_0x174435);}else{if(_0x174435===0x1f4){_0x40df2b[_0xdf00('0x28')](_0x174435)[_0xdf00('0x36')](_0x31a13d);}else{_0x40df2b[_0xdf00('0x28')](_0x174435)[_0xdf00('0x29')](_0x31a13d);}}});};exports[_0xdf00('0x80')]=function(_0x2b6fe4,_0xb33f53,_0xb9712){var _0xa6917e={};var _0x275a11={};var _0x119569;var _0x56c4ac;return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x2b6fe4[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0xb33f53,null))[_0xdf00('0x1c')](function(_0xb3a675){if(_0xb3a675){_0x119569=_0xb3a675;_0x275a11[_0xdf00('0x43')]=_['keys'](db[_0xdf00('0x7b')]['rawAttributes']);_0x275a11['query']=_[_0xdf00('0x40')](_0x2b6fe4['query']);_0x275a11[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x275a11[_0xdf00('0x43')],_0x275a11[_0xdf00('0x3f')]);_0xa6917e[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x275a11[_0xdf00('0x43')],qs['fields'](_0x2b6fe4['query'][_0xdf00('0x45')]));_0xa6917e['attributes']=_0xa6917e[_0xdf00('0x44')]['length']?_0xa6917e['attributes']:_0x275a11[_0xdf00('0x43')];_0xa6917e['order']=qs[_0xdf00('0x49')](_0x2b6fe4[_0xdf00('0x3f')]['sort']);_0xa6917e[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x2b6fe4[_0xdf00('0x3f')],_0x275a11[_0xdf00('0x41')]));if(_0x2b6fe4[_0xdf00('0x3f')]['filter']){_0xa6917e[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0xa6917e['where'],{'$or':_['map'](_0xa6917e['attributes'],function(_0x17eaf5){var _0x3f1594={};_0x3f1594[_0x17eaf5]={'$like':'%'+_0x2b6fe4[_0xdf00('0x3f')]['filter']+'%'};return _0x3f1594;})});}_0xa6917e=_[_0xdf00('0x4d')]({},_0xa6917e,_0x2b6fe4[_0xdf00('0x4e')]);return _0x119569[_0xdf00('0x80')](_0xa6917e);}})[_0xdf00('0x1c')](function(_0x18c613){if(_0x18c613){_0x56c4ac=_0x18c613[_0xdf00('0x46')];if(!_0x2b6fe4[_0xdf00('0x3f')][_0xdf00('0x69')](_0xdf00('0x47'))){_0xa6917e[_0xdf00('0x2c')]=qs['limit'](_0x2b6fe4[_0xdf00('0x3f')]['limit']);_0xa6917e[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2b6fe4['query'][_0xdf00('0x2a')]);}return _0x119569[_0xdf00('0x80')](_0xa6917e);}})[_0xdf00('0x1c')](function(_0x4c3973){if(_0x4c3973){return _0x4c3973?{'count':_0x56c4ac,'rows':_0x4c3973}:null;}})[_0xdf00('0x1c')](respondWithResult(_0xb33f53,null))[_0xdf00('0x26')](handleError(_0xb33f53,null));};function Extension(_0xf2f8a0,_0xb319df,_0xdde7f9,_0x4ceaba){this['context']=_0xdf00('0x81');this[_0xdf00('0x82')]=_0xf2f8a0[_0xdf00('0x83')];this[_0xdf00('0x84')]=_0x4ceaba;this['type']=_0xdf00('0x85');this[_0xdf00('0x86')]=_0xdf00('0x87');this[_0xdf00('0x61')]=_0xf2f8a0['id'];this['priority']=_0xb319df;this[_0xdf00('0x88')]=_0xdde7f9;}function createExtensionsReciveFax(_0x1ecd27){var _0x168651=0x1;var _0xa2d6c8=[];_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,'',_0xdf00('0x8a')));_0x168651+=0x1;_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x8b'),_0xdf00('0x8c')));_0x168651+=0x1;for(var _0x24365e in _0x1ecd27){if(_0x1ecd27[_0xdf00('0x69')](_0x24365e)&&(_0x24365e==='ecm'||_0x24365e===_0xdf00('0x83')||_0x24365e===_0xdf00('0x8d')||_0x24365e===_0xdf00('0x8e')||_0x24365e===_0xdf00('0x8f')||_0x24365e===_0xdf00('0x90')||_0x24365e==='minrate'||_0x24365e==='modem'||_0x24365e==='t38timeout')){_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x91')+_0x24365e+')='+_0x1ecd27[_0x24365e],_0xdf00('0x8c')));_0x168651+=0x1;}}_0xa2d6c8[_0xdf00('0x89')](new Extension(_0x1ecd27,_0x168651,'6',_0xdf00('0x92')));_0x168651+=0x1;_0xa2d6c8['push'](new Extension(_0x1ecd27,_0x168651,_0xdf00('0x93'),_0xdf00('0x94')));_0x168651=0x0;return _0xa2d6c8;}exports[_0xdf00('0x95')]=function(_0x22b399,_0x14c985,_0x2e8479){var _0x4b04c7;return db[_0xdf00('0x79')][_0xdf00('0x96')](function(_0x28171e){return db[_0xdf00('0x3a')][_0xdf00('0x54')](_0x22b399[_0xdf00('0x55')],{'transaction':_0x28171e})['then'](function(_0x4fff8b){_0x4b04c7=_0x4fff8b[_0xdf00('0x58')]({'plain':!![]});return db[_0xdf00('0x97')][_0xdf00('0x7c')](createExtensionsReciveFax(_0x4b04c7),{'transaction':_0x28171e});});})[_0xdf00('0x1c')](function(){return _0x4b04c7;})[_0xdf00('0x1c')](respondWithResult(_0x14c985,null))['catch'](handleError(_0x14c985,null));};exports[_0xdf00('0x98')]=function(_0x473bfd,_0x54ccb6,_0x56bdfa){var _0x4a0746;return db['sequelize'][_0xdf00('0x96')](function(_0x6d6806){return db[_0xdf00('0x3a')]['update'](_0x473bfd[_0xdf00('0x55')],{'where':{'id':_0x473bfd[_0xdf00('0x55')]['id']},'transaction':_0x6d6806})[_0xdf00('0x1c')](function(_0x19250a){return db[_0xdf00('0x97')][_0xdf00('0x31')]({'where':{'FaxAccountId':_0x473bfd[_0xdf00('0x55')]['id']},'transaction':_0x6d6806})[_0xdf00('0x1c')](function(_0x968d80){return db['VoiceExtension'][_0xdf00('0x7c')](createExtensionsReciveFax(_[_0xdf00('0x6f')](_0x473bfd[_0xdf00('0x55')],['tech','key',_0xdf00('0x99'),_0xdf00('0x9a'),_0xdf00('0x9b'),_0xdf00('0x9c')])),{'transaction':_0x6d6806});});});})[_0xdf00('0x1c')](function(){return db[_0xdf00('0x3a')][_0xdf00('0x9d')](_0x473bfd['body']['id']);})[_0xdf00('0x1c')](respondWithResult(_0x54ccb6,null))[_0xdf00('0x26')](handleError(_0x54ccb6,null));};exports[_0xdf00('0x9e')]=function(_0x2717a6,_0x2369a8,_0xf38055){var _0x228783={'raw':!![],'where':{}};var _0x107230={};var _0x23f93c={'count':0x0,'rows':[]};return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x2717a6['params']['id']}})['then'](handleEntityNotFound(_0x2369a8,null))['then'](function(_0x47da89){if(_0x47da89){_0x107230['model']=_[_0xdf00('0x40')](db[_0xdf00('0x9f')][_0xdf00('0x3b')]);_0x107230[_0xdf00('0x3f')]=_[_0xdf00('0x40')](_0x2717a6[_0xdf00('0x3f')]);_0x107230[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0x107230[_0xdf00('0x43')],_0x107230['query']);_0x228783[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0x107230[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x2717a6[_0xdf00('0x3f')]['fields']));_0x228783['attributes']=_0x228783[_0xdf00('0x44')]['length']?_0x228783[_0xdf00('0x44')]:_0x107230[_0xdf00('0x43')];if(!_0x2717a6['query']['hasOwnProperty'](_0xdf00('0x47'))){_0x228783['limit']=qs[_0xdf00('0x2c')](_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x228783[_0xdf00('0x2a')]=qs[_0xdf00('0x2a')](_0x2717a6['query']['offset']);}_0x228783['order']=qs['sort'](_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x49')]);_0x228783[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x2717a6['query'],_0x107230[_0xdf00('0x41')]));_0x228783['where'][_0xdf00('0x61')]=_0x47da89['id'];if(_0x2717a6[_0xdf00('0x3f')][_0xdf00('0x4c')]){_0x228783['where']=_['merge'](_0x228783[_0xdf00('0x4a')],{'$or':_[_0xdf00('0x39')](_0x228783[_0xdf00('0x44')],function(_0xf0ab60){var _0x3ccf73={};_0x3ccf73[_0xf0ab60]={'$like':'%'+_0x2717a6['query'][_0xdf00('0x4c')]+'%'};return _0x3ccf73;})});}if(_0x2717a6[_0xdf00('0x3f')][_0xdf00('0xa0')]){var _0x47a24d=_0x2717a6[_0xdf00('0x3f')][_0xdf00('0xa0')]['split'](',');var _0x574f41={};_0x574f41[_0x47a24d[0x0]]={'$gte':moment(_0x47a24d[0x1])[_0xdf00('0xa1')](_0xdf00('0xa2'))};_0x228783['where']=_['merge'](_0x228783[_0xdf00('0x4a')],_0x574f41);}_0x228783=_[_0xdf00('0x4d')]({},_0x228783,_0x2717a6[_0xdf00('0x4e')]);return db['FaxMessage'][_0xdf00('0x2d')]({'where':_0x228783['where']})['then'](function(_0x21a5a8){_0x23f93c['count']=_0x21a5a8;if(_0x2717a6['query'][_0xdf00('0x53')]){_0x228783[_0xdf00('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x228783);})[_0xdf00('0x1c')](function(_0x1a5af1){_0x23f93c[_0xdf00('0x6a')]=_0x1a5af1;return _0x23f93c;});}})['then'](respondWithFilteredResult(_0x2369a8,_0x228783))[_0xdf00('0x26')](handleError(_0x2369a8,null));};exports[_0xdf00('0x36')]=function(_0x1945f7,_0x20a852,_0x5da303){var _0x24e7b5,_0xddc0da={},_0x12aac5;if(_0x1945f7[_0xdf00('0x55')]['to']){_0x12aac5=_0x1945f7['body']['to'][0x0];}return db[_0xdf00('0x3a')]['find']({'where':{'id':_0x1945f7[_0xdf00('0x52')]['id']},'include':[{'model':db[_0xdf00('0xa3')],'as':_0xdf00('0xa4'),'include':[{'model':db[_0xdf00('0xa5')],'as':'Contacts','where':{'fax':_0x12aac5},'limit':0x1,'order':[[_0xdf00('0x9a'),_0xdf00('0xa6')]]}]}]})[_0xdf00('0x1c')](handleEntityNotFound(_0x20a852,null))[_0xdf00('0x1c')](function(_0x257cfc){_0x24e7b5=_0x257cfc;if(_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')]&&_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][_0xdf00('0x46')]){for(var _0x543d44=0x0;_0x543d44<_0x1945f7[_0xdf00('0x55')]['attachments'][_0xdf00('0x46')];_0x543d44+=0x1){_0x1945f7['body'][_0xdf00('0xa7')][_0x543d44]={'filename':_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][_0x543d44][_0xdf00('0x35')],'id':_0x1945f7['body']['attachments'][_0x543d44]['id'],'path':path[_0xdf00('0xa8')](config[_0xdf00('0xa9')],_0xdf00('0xaa'),_0x1945f7['body'][_0xdf00('0xa7')][_0x543d44][_0xdf00('0xab')])};}}return respondWithRpcPromise(_0xdf00('0xac'),_0xdf00('0xac'),{'FaxAccountId':_[_0xdf00('0xad')](_0x1945f7['params']['id'])?undefined:_0x1945f7[_0xdf00('0x52')]['id'],'path':_['isNil'](_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')])?undefined:_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0]['path'],'fax':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x55')]['to'][0x0])?undefined:_0x1945f7[_0xdf00('0x55')]['to'][0x0]},client9002);})[_0xdf00('0x1c')](function(){if(_0x24e7b5){if(_['isNil'](_0x1945f7['body'][_0xdf00('0xaf')])){_0x1945f7[_0xdf00('0x55')]['from']=util[_0xdf00('0xa1')](_0xdf00('0xb0'),_0x24e7b5[_0xdf00('0x35')],_0x24e7b5[_0xdf00('0xb1')]);}if(_0x24e7b5[_0xdf00('0xa4')]){if(_0x24e7b5[_0xdf00('0xa4')]['Contacts'][_0xdf00('0x46')]){return _0x24e7b5[_0xdf00('0xa4')][_0xdf00('0xb2')][0x0];}else{return db[_0xdf00('0xa5')][_0xdf00('0x54')](_[_0xdf00('0xb3')](_0x1945f7[_0xdf00('0x55')],{'firstName':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'phone':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'fax':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'ListId':_0x24e7b5['ListId']}));}}else{throw new Error(_0xdf00('0xb4'));}}else{throw new Error(_0xdf00('0xb5'));}})[_0xdf00('0x1c')](function(_0xe22fdc){if(_0xe22fdc){return db[_0xdf00('0x6d')][_0xdf00('0x60')]({'where':{'ContactId':_0xe22fdc['id'],'closed':![],'FaxAccountId':_0x24e7b5['id']}})[_0xdf00('0x1c')](function(_0x1faf96){if(_0x1faf96){return[_0x1faf96,![]];}return db[_0xdf00('0x6d')][_0xdf00('0x54')]({'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0xe22fdc['id'],'FaxAccountId':_0x24e7b5['id'],'fax':_0x1945f7[_0xdf00('0x55')]['to'][0x0],'firstMsgDirection':_0xdf00('0xb6'),'Messages':[_[_0xdf00('0x4d')](_0x1945f7['body'],{'read':![],'body':_0x1945f7[_0xdf00('0x55')]['attachments'][0x0][_0xdf00('0xb7')],'FaxAccountId':_0x24e7b5['id'],'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0xe22fdc['id'],'AttachmentId':_0x1945f7[_0xdf00('0x55')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xdf00('0xb8')}]})['then'](function(_0x277e4b){return[_0x277e4b,!![]];});});}else{throw new Error(_0xdf00('0xb9'));}})[_0xdf00('0xba')](function(_0x404bd3,_0x11d751){if(_0x11d751){return _0x404bd3;}return db[_0xdf00('0x9f')][_0xdf00('0x54')]({'direction':'out','read':![],'body':_0x1945f7['body'][_0xdf00('0xa7')][0x0][_0xdf00('0xb7')],'FaxAccountId':_0x24e7b5['id'],'FaxInteractionId':_0x404bd3['id'],'UserId':_0x1945f7[_0xdf00('0x56')]['id'],'ContactId':_0x404bd3[_0xdf00('0xbb')],'AttachmentId':_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0]['id']})['then'](function(_0x1006d2){_0x404bd3[_0xdf00('0xbc')][_0xdf00('0xb8')]=[];_0x404bd3[_0xdf00('0xbc')][_0xdf00('0xb8')][_0xdf00('0x89')](_0x1006d2[_0xdf00('0xbc')]);return _0x404bd3;});})[_0xdf00('0x1c')](function(_0xf9b042){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x52')]['id'])?undefined:_0x1945f7[_0xdf00('0x52')]['id'],'path':_['isNil'](_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')])?undefined:_0x1945f7[_0xdf00('0x55')][_0xdf00('0xa7')][0x0][_0xdf00('0xae')],'fax':_[_0xdf00('0xad')](_0x1945f7[_0xdf00('0x55')]['to'][0x0])?undefined:_0x1945f7[_0xdf00('0x55')]['to'][0x0],'AttachmentId':_0x1945f7['body'][_0xdf00('0xa7')][0x0]['id']},client9002)['then'](function(_0x1d52d3){logger[_0xdf00('0x24')](_0xdf00('0xbd'),_0x1d52d3);})['catch'](function(_0xb29714){logger[_0xdf00('0x24')]('SendFaxRpc,\x20%s',_0xb29714);});return _0xf9b042;})['then'](respondWithResult(_0x20a852,null))[_0xdf00('0x26')](handleError(_0x20a852,null));};exports['addAgents']=function(_0x23d409,_0x1c2e56,_0x3c958b){return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x23d409[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x1c2e56,null))[_0xdf00('0x1c')](function(_0x1cde32){if(_0x1cde32){return _0x1cde32['addAgents'](_0x23d409[_0xdf00('0x55')][_0xdf00('0x6e')],_['omit'](_0x23d409[_0xdf00('0x55')],['ids','id'])||{})['spread'](function(_0x2a8b90){for(var _0x1d3809=0x0;_0x1d3809<_0x23d409['body'][_0xdf00('0x6e')]['length'];_0x1d3809+=0x1){socket[_0xdf00('0xbe')](_0xdf00('0xbf'),{'UserId':Number(_0x23d409[_0xdf00('0x55')]['ids'][_0x1d3809]),'FaxAccountId':Number(_0x23d409[_0xdf00('0x52')]['id'])});}return _0x2a8b90;});}})[_0xdf00('0x1c')](respondWithResult(_0x1c2e56,null))[_0xdf00('0x26')](handleError(_0x1c2e56,null));};exports[_0xdf00('0xc0')]=function(_0x168f6f,_0x4bf988,_0x40ebed){return db[_0xdf00('0x3a')][_0xdf00('0x60')]({'where':{'id':_0x168f6f['params']['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x4bf988,null))[_0xdf00('0x1c')](function(_0xbdbec9){if(_0xbdbec9){return _0xbdbec9[_0xdf00('0xc0')](_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')])['then'](function(){if(_[_0xdf00('0xc1')](_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')])){for(var _0x1e2b01=0x0;_0x1e2b01<_0x168f6f[_0xdf00('0x3f')]['ids']['length'];_0x1e2b01+=0x1){socket[_0xdf00('0xbe')](_0xdf00('0xc2'),{'UserId':Number(_0x168f6f[_0xdf00('0x3f')][_0xdf00('0x6e')][_0x1e2b01]),'FaxAccountId':Number(_0x168f6f[_0xdf00('0x52')]['id'])});}}else{socket[_0xdf00('0xbe')](_0xdf00('0xc2'),{'UserId':Number(_0x168f6f['query']['ids']),'FaxAccountId':Number(_0x168f6f[_0xdf00('0x52')]['id'])});}});}})[_0xdf00('0x1c')](respondWithStatusCode(_0x4bf988,null))['catch'](handleError(_0x4bf988,null));};exports[_0xdf00('0xc3')]=function(_0x3fba8a,_0x2e82ce,_0x4eedf0){var _0x1251f2={};var _0xc0def4={};var _0x4ac160;var _0x3d6daa;return db[_0xdf00('0x3a')][_0xdf00('0x64')]({'where':{'id':_0x3fba8a[_0xdf00('0x52')]['id']}})[_0xdf00('0x1c')](handleEntityNotFound(_0x2e82ce,null))[_0xdf00('0x1c')](function(_0x7de4fc){if(_0x7de4fc){_0x4ac160=_0x7de4fc;_0xc0def4['model']=_[_0xdf00('0x40')](db[_0xdf00('0x72')][_0xdf00('0x3b')]);_0xc0def4['query']=_[_0xdf00('0x40')](_0x3fba8a[_0xdf00('0x3f')]);_0xc0def4[_0xdf00('0x41')]=_[_0xdf00('0x42')](_0xc0def4[_0xdf00('0x43')],_0xc0def4[_0xdf00('0x3f')]);_0x1251f2[_0xdf00('0x44')]=_[_0xdf00('0x42')](_0xc0def4[_0xdf00('0x43')],qs[_0xdf00('0x45')](_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x45')]));_0x1251f2['attributes']=_0x1251f2[_0xdf00('0x44')][_0xdf00('0x46')]?_0x1251f2[_0xdf00('0x44')]:_0xc0def4[_0xdf00('0x43')];_0x1251f2[_0xdf00('0x48')]=qs[_0xdf00('0x49')](_0x3fba8a['query'][_0xdf00('0x49')]);_0x1251f2[_0xdf00('0x4a')]=qs[_0xdf00('0x41')](_[_0xdf00('0x4b')](_0x3fba8a[_0xdf00('0x3f')],_0xc0def4[_0xdf00('0x41')]));if(_0x3fba8a[_0xdf00('0x3f')]['filter']){_0x1251f2[_0xdf00('0x4a')]=_[_0xdf00('0x4d')](_0x1251f2[_0xdf00('0x4a')],{'$or':_['map'](_0x1251f2[_0xdf00('0x44')],function(_0x36ada3){var _0x446c0a={};_0x446c0a[_0x36ada3]={'$like':'%'+_0x3fba8a[_0xdf00('0x3f')]['filter']+'%'};return _0x446c0a;})});}_0x1251f2=_[_0xdf00('0x4d')]({},_0x1251f2,_0x3fba8a[_0xdf00('0x4e')]);return _0x4ac160[_0xdf00('0xc3')](_0x1251f2);}})[_0xdf00('0x1c')](function(_0x55ca83){if(_0x55ca83){_0x3d6daa=_0x55ca83[_0xdf00('0x46')];if(!_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x69')](_0xdf00('0x47'))){_0x1251f2[_0xdf00('0x2c')]=qs['limit'](_0x3fba8a[_0xdf00('0x3f')][_0xdf00('0x2c')]);_0x1251f2[_0xdf00('0x2a')]=qs['offset'](_0x3fba8a[_0xdf00('0x3f')]['offset']);}return _0x4ac160['getAgents'](_0x1251f2);}})[_0xdf00('0x1c')](function(_0x5e0d4a){if(_0x5e0d4a){return _0x5e0d4a?{'count':_0x3d6daa,'rows':_0x5e0d4a}:null;}})[_0xdf00('0x1c')](respondWithResult(_0x2e82ce,null))[_0xdf00('0x26')](handleError(_0x2e82ce,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2120814..3b69be7 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 _0xaa2c=['exports','events','../../mysqldb','FaxAccount','update','remove','emit','hook'];(function(_0x47398d,_0x45bcda){var _0xb3e6d3=function(_0x8684c3){while(--_0x8684c3){_0x47398d['push'](_0x47398d['shift']());}};_0xb3e6d3(++_0x45bcda);}(_0xaa2c,0x1d1));var _0xcaa2=function(_0x30e21d,_0x3f4507){_0x30e21d=_0x30e21d-0x0;var _0xe752c6=_0xaa2c[_0x30e21d];return _0xe752c6;};'use strict';var EventEmitter=require(_0xcaa2('0x0'));var FaxAccount=require(_0xcaa2('0x1'))['db'][_0xcaa2('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaa2('0x3'),'afterDestroy':_0xcaa2('0x4')};function emitEvent(_0x4c2111){return function(_0x26f1ce,_0x4b0566,_0xa95aee){FaxAccountEvents[_0xcaa2('0x5')](_0x4c2111+':'+_0x26f1ce['id'],_0x26f1ce);FaxAccountEvents[_0xcaa2('0x5')](_0x4c2111,_0x26f1ce);_0xa95aee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xcaa2('0x6')](e,emitEvent(event));}}module[_0xcaa2('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xa9fc=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','hasOwnProperty','exports','events'];(function(_0x425e87,_0xcebe07){var _0x3ffa86=function(_0x5beafb){while(--_0x5beafb){_0x425e87['push'](_0x425e87['shift']());}};_0x3ffa86(++_0xcebe07);}(_0xa9fc,0x19f));var _0xca9f=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xa9fc[_0x3de873];return _0x380b8c;};'use strict';var EventEmitter=require(_0xca9f('0x0'));var FaxAccount=require(_0xca9f('0x1'))['db'][_0xca9f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xca9f('0x3')](0x0);var events={'afterCreate':_0xca9f('0x4'),'afterUpdate':'update','afterDestroy':_0xca9f('0x5')};function emitEvent(_0x4dc099){return function(_0xe81cd,_0x32709b,_0x5d2ddf){FaxAccountEvents['emit'](_0x4dc099+':'+_0xe81cd['id'],_0xe81cd);FaxAccountEvents['emit'](_0x4dc099,_0xe81cd);_0x5d2ddf(null);};}for(var e in events){if(events[_0xca9f('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xca9f('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5ea8590..531772b 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 _0xac1a=['exports','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac1a,0x71));var _0xaac1=function(_0x9aea11,_0x48d0f0){_0x9aea11=_0x9aea11-0x0;var _0x15110c=_0xac1a[_0x9aea11];return _0x15110c;};'use strict';var _=require(_0xaac1('0x0'));var util=require('util');var logger=require(_0xaac1('0x1'))(_0xaac1('0x2'));var moment=require(_0xaac1('0x3'));var BPromise=require(_0xaac1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaac1('0x5'));var rimraf=require(_0xaac1('0x6'));var config=require(_0xaac1('0x7'));var attributes=require('./faxAccount.attributes');module[_0xaac1('0x8')]=function(_0x45913d,_0xa83a74){return _0x45913d['define'](_0xaac1('0x9'),attributes,{'tableName':_0xaac1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ab=['path','exports','define','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x238310,_0x50baad){var _0x95df5a=function(_0x1a6b3d){while(--_0x1a6b3d){_0x238310['push'](_0x238310['shift']());}};_0x95df5a(++_0x50baad);}(_0xe3ab,0xc2));var _0xbe3a=function(_0x3cbe0c,_0x4fe5ce){_0x3cbe0c=_0x3cbe0c-0x0;var _0x29294b=_0xe3ab[_0x3cbe0c];return _0x29294b;};'use strict';var _=require(_0xbe3a('0x0'));var util=require(_0xbe3a('0x1'));var logger=require(_0xbe3a('0x2'))('api');var moment=require(_0xbe3a('0x3'));var BPromise=require(_0xbe3a('0x4'));var rp=require(_0xbe3a('0x5'));var fs=require('fs');var path=require(_0xbe3a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xbe3a('0x7')]=function(_0x2fdb9a,_0x45d6c8){return _0x2fdb9a[_0xbe3a('0x8')]('FaxAccount',attributes,{'tableName':_0xbe3a('0x9'),'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 4a846da..6156de1 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 _0xb2d8=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','FaxAccount','findAll','options','raw','attributes','limit','include','model','map','then','GetFaxAccount','stringify','catch','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','Applications','account','list','orderBy','asc','length','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','find','name','applications','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x571449,_0x7353c2){var _0x305bf6=function(_0x3f575b){while(--_0x3f575b){_0x571449['push'](_0x571449['shift']());}};_0x305bf6(++_0x7353c2);}(_0xb2d8,0x163));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var moment=require(_0x8b2d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b2d('0x3'));var fs=require('fs');var Redis=require(_0x8b2d('0x4'));var db=require(_0x8b2d('0x5'))['db'];var utils=require(_0x8b2d('0x6'));var logger=require(_0x8b2d('0x7'))(_0x8b2d('0x8'));var config=require(_0x8b2d('0x9'));var jayson=require(_0x8b2d('0xa'));var client=jayson[_0x8b2d('0xb')]['http']({'port':0x232c});config[_0x8b2d('0xc')]=_[_0x8b2d('0xd')](config[_0x8b2d('0xc')],{'host':_0x8b2d('0xe'),'port':0x18eb});var socket=require(_0x8b2d('0xf'))(new Redis(config[_0x8b2d('0xc')]));require(_0x8b2d('0x10'))[_0x8b2d('0x11')](socket);function respondWithRpcPromise(_0x311c15,_0x2dda77,_0x4da0cd){return new BPromise(function(_0x353391,_0x5985df){return client['request'](_0x311c15,_0x4da0cd)['then'](function(_0x22e45a){logger['info'](_0x8b2d('0x12'),_0x2dda77,'request\x20sent');logger[_0x8b2d('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2dda77,_0x8b2d('0x14'),JSON['stringify'](_0x22e45a));if(_0x22e45a[_0x8b2d('0x15')]){if(_0x22e45a['error'][_0x8b2d('0x16')]===0x1f4){logger[_0x8b2d('0x15')](_0x8b2d('0x12'),_0x2dda77,_0x22e45a[_0x8b2d('0x15')][_0x8b2d('0x17')]);return _0x5985df(_0x22e45a[_0x8b2d('0x15')][_0x8b2d('0x17')]);}logger[_0x8b2d('0x15')](_0x8b2d('0x12'),_0x2dda77,_0x22e45a['error'][_0x8b2d('0x17')]);return _0x353391(_0x22e45a[_0x8b2d('0x15')]['message']);}else{logger['info'](_0x8b2d('0x12'),_0x2dda77,_0x8b2d('0x14'));_0x353391(_0x22e45a[_0x8b2d('0x18')][_0x8b2d('0x17')]);}})['catch'](function(_0x50dc11){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2dda77,_0x50dc11);_0x5985df(_0x50dc11);});});}exports['GetFaxAccount']=function(_0x38b216){var _0x44697e=this;return new Promise(function(_0x3c3950,_0x903fc0){return db[_0x8b2d('0x19')][_0x8b2d('0x1a')]({'raw':_0x38b216['options']?_0x38b216[_0x8b2d('0x1b')][_0x8b2d('0x1c')]===undefined?!![]:![]:!![],'where':_0x38b216['options']?_0x38b216['options']['where']||null:null,'attributes':_0x38b216[_0x8b2d('0x1b')]?_0x38b216[_0x8b2d('0x1b')][_0x8b2d('0x1d')]||null:null,'limit':_0x38b216['options']?_0x38b216['options'][_0x8b2d('0x1e')]||null:null,'include':_0x38b216['options']?_0x38b216[_0x8b2d('0x1b')]['include']?_['map'](_0x38b216[_0x8b2d('0x1b')][_0x8b2d('0x1f')],function(_0x3c9ba5){return{'model':db[_0x3c9ba5[_0x8b2d('0x20')]],'as':_0x3c9ba5['as'],'attributes':_0x3c9ba5[_0x8b2d('0x1d')],'include':_0x3c9ba5[_0x8b2d('0x1f')]?_['map'](_0x3c9ba5[_0x8b2d('0x1f')],function(_0x253136){return{'model':db[_0x253136['model']],'as':_0x253136['as'],'attributes':_0x253136['attributes'],'include':_0x253136[_0x8b2d('0x1f')]?_[_0x8b2d('0x21')](_0x253136[_0x8b2d('0x1f')],function(_0x3e637b){return{'model':db[_0x3e637b[_0x8b2d('0x20')]],'as':_0x3e637b['as'],'attributes':_0x3e637b[_0x8b2d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8b2d('0x22')](function(_0x3e6eda){logger['info'](_0x8b2d('0x23'),_0x38b216);logger[_0x8b2d('0x13')]('GetFaxAccount',_0x38b216,JSON[_0x8b2d('0x24')](_0x3e6eda));_0x3c3950(_0x3e6eda);})[_0x8b2d('0x25')](function(_0x368a8f){logger[_0x8b2d('0x15')]('GetFaxAccount',_0x368a8f[_0x8b2d('0x17')],_0x38b216);_0x903fc0(_0x44697e[_0x8b2d('0x15')](0x1f4,_0x368a8f[_0x8b2d('0x17')]));});});};exports[_0x8b2d('0x26')]=function(_0x1740fc,_0x3dc230,_0x5661a4){var _0x140ecd=this;return new Promise(function(_0xde39ab,_0x144894){var _0x5d02c0={'body':_0x1740fc[_0x8b2d('0x27')],'channel':_0x8b2d('0x28')};var _0x3d581f=[];var _0x5adab4=[];var _0x49a6d6={};return db[_0x8b2d('0x29')]['describe']()[_0x8b2d('0x22')](function(_0x1e8165){if(!_0x1e8165){throw new db[(_0x8b2d('0x2a'))][(_0x8b2d('0x2b'))]('no\x20available\x20attributes');}_0x3d581f=_[_0x8b2d('0x2c')](_['keys'](_0x1e8165),[_0x8b2d('0x2d'),_0x8b2d('0x2e')]);_0x5adab4=_[_0x8b2d('0x2c')](_[_0x8b2d('0x2f')](_0x1e8165),[_0x8b2d('0x2d'),_0x8b2d('0x2e'),_0x8b2d('0x30'),'ListId']);if(_0x1740fc['body']['id']){delete _0x1740fc[_0x8b2d('0x27')]['id'];}if(_[_0x8b2d('0x31')](_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x32')])){throw new db[(_0x8b2d('0x2a'))]['ValidationError'](_0x8b2d('0x33'));}if(_['isNil'](_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x27')])||_0x1740fc['body']['body']===''){throw new db[(_0x8b2d('0x2a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8b2d('0x31')](_0x1740fc[_0x8b2d('0x27')]['mapKey'])){throw new db[(_0x8b2d('0x2a'))]['ValidationError'](_0x8b2d('0x34')+_0x5adab4);}if(!_[_0x8b2d('0x35')](_0x5adab4,_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x36')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5adab4);}_0x49a6d6[_0x1740fc['body'][_0x8b2d('0x36')]]=_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x32')];})[_0x8b2d('0x22')](function(){return db['FaxAccount']['find']({'where':{'id':_0x1740fc['account']['id']},'include':[{'model':db[_0x8b2d('0x37')],'as':_0x8b2d('0x38'),'include':[{'model':db[_0x8b2d('0x29')],'as':_0x8b2d('0x39'),'where':_0x49a6d6,'limit':0x1,'order':[[_0x8b2d('0x2e'),_0x8b2d('0x3a')]]}]},{'model':db['FaxApplication'],'as':_0x8b2d('0x3b')}]});})[_0x8b2d('0x22')](function(_0x1bf65d){if(_0x1bf65d&&_0x1bf65d['List']){var _0x409dbd=_0x1bf65d['get']({'plain':!![]});_0x5d02c0[_0x8b2d('0x3c')]=_0x409dbd;_0x5d02c0['applications']=_0x409dbd[_0x8b2d('0x3b')];_0x5d02c0[_0x8b2d('0x3d')]=_0x409dbd[_0x8b2d('0x38')];_0x5d02c0['applications']=_[_0x8b2d('0x3e')](_0x5d02c0['applications'],['priority'],[_0x8b2d('0x3f')]);if(_0x5d02c0[_0x8b2d('0x3c')]['Applications']){delete _0x5d02c0[_0x8b2d('0x3c')]['Applications'];}if(_0x5d02c0[_0x8b2d('0x3c')]['List']&&_0x5d02c0[_0x8b2d('0x3c')][_0x8b2d('0x38')]['Contacts'][_0x8b2d('0x40')]){return _0x5d02c0[_0x8b2d('0x3c')][_0x8b2d('0x38')][_0x8b2d('0x39')][0x0];}var _0x3b4ee6=_[_0x8b2d('0xd')](_0x1740fc[_0x8b2d('0x27')],{'firstName':_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x32')],'ListId':_0x409dbd[_0x8b2d('0x41')]});_0x3b4ee6[_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x36')]]=_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x32')];return db[_0x8b2d('0x29')]['create'](_0x3b4ee6,{'fields':_0x3d581f,'raw':!![]});}})[_0x8b2d('0x22')](function(_0x25102f){_0x5d02c0[_0x8b2d('0x42')]=_0x25102f;if(_0x25102f){var _0x46556e={'ContactId':_0x25102f['id'],'FaxAccountId':_0x1740fc[_0x8b2d('0x3c')]['id'],'fax':_0x25102f[_0x8b2d('0x28')]};return db[_0x8b2d('0x43')]['find']({'where':{'ContactId':_0x25102f['id'],'closed':![],'FaxAccountId':_0x1740fc[_0x8b2d('0x3c')]['id']}})[_0x8b2d('0x22')](function(_0x378726){if(_0x378726){return[_0x378726,![]];}return db['FaxInteraction'][_0x8b2d('0x44')](_0x46556e)[_0x8b2d('0x22')](function(_0x15893b){return[_0x15893b,!![]];});});}else{throw new Error(_0x8b2d('0x45'));}})['spread'](function(_0x14bb3d,_0x367e5c){var _0x55941e=_0x14bb3d[_0x8b2d('0x46')]({'plain':!![]});if(_0x367e5c){if(_0x5d02c0['account'][_0x8b2d('0x47')]){_0x5d02c0['applications']['push']({'id':0x0,'priority':_0x5d02c0['applications'][_0x8b2d('0x40')]+0x1,'app':_0x8b2d('0x48'),'appdata':_0x8b2d('0x49'),'interval':_0x8b2d('0x4a')});}_0x55941e[_0x8b2d('0x4b')]=!![];}else{_0x55941e[_0x8b2d('0x4b')]=![];}_0x5d02c0[_0x8b2d('0x4c')]=_0x55941e;return db[_0x8b2d('0x4d')]['create']({'body':_0x1740fc[_0x8b2d('0x27')][_0x8b2d('0x27')],'FaxAccountId':_0x1740fc[_0x8b2d('0x3c')]['id'],'FaxInteractionId':_0x14bb3d['id'],'direction':'in','ContactId':_0x14bb3d[_0x8b2d('0x4e')],'AttachmentId':_0x1740fc[_0x8b2d('0x27')]['AttachmentId']});})['then'](function(_0x5a1ee1){_0x5d02c0[_0x8b2d('0x17')]=_0x5a1ee1;if(!_0x5d02c0['interaction'][_0x8b2d('0x4f')])return;return db[_0x8b2d('0x50')][_0x8b2d('0x51')]({'attributes':['id',_0x8b2d('0x52')],'where':{'id':_0x5d02c0[_0x8b2d('0x4c')]['UserId']}});})[_0x8b2d('0x22')](function(_0xc2cda){if(_0xc2cda){_0x5d02c0[_0x8b2d('0x53')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc2cda[_0x8b2d('0x52')]+','+(_0x5d02c0['account'][_0x8b2d('0x54')]||0xa),'interval':_0x8b2d('0x4a')});}if(!_0x5d02c0[_0x8b2d('0x4c')][_0x8b2d('0x55')])return;return db[_0x8b2d('0x56')][_0x8b2d('0x51')]({'attributes':['id',_0x8b2d('0x52')],'where':{'id':_0x5d02c0[_0x8b2d('0x4c')][_0x8b2d('0x55')]}});})['then'](function(_0x3a3802){if(_0x3a3802){_0x5d02c0[_0x8b2d('0x53')][_0x8b2d('0x57')]({'id':0x0,'priority':0x1,'app':_0x8b2d('0x58'),'appdata':_0x3a3802[_0x8b2d('0x52')]+','+(_0x5d02c0[_0x8b2d('0x3c')][_0x8b2d('0x59')]||0x12c),'interval':_0x8b2d('0x4a')});}return respondWithRpcPromise(_0x8b2d('0x5a'),_0x8b2d('0x5b'),_0x5d02c0);})[_0x8b2d('0x22')](function(_0x5cf423){_0xde39ab(_0x5cf423);})[_0x8b2d('0x25')](function(_0x7ee96f){_0x144894(_0x140ecd[_0x8b2d('0x15')](0x1f4,_0x7ee96f['message']));});});}; \ No newline at end of file +var _0xfe2d=['result','FaxAccount','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','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','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','interaction','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xfe2d,0x1eb));var _0xdfe2=function(_0x53e800,_0x11621d){_0x53e800=_0x53e800-0x0;var _0x538d29=_0xfe2d[_0x53e800];return _0x538d29;};'use strict';var _=require(_0xdfe2('0x0'));var util=require('util');var moment=require(_0xdfe2('0x1'));var BPromise=require(_0xdfe2('0x2'));var rs=require(_0xdfe2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfe2('0x4'));var logger=require(_0xdfe2('0x5'))('rpc');var config=require(_0xdfe2('0x6'));var jayson=require(_0xdfe2('0x7'));var client=jayson[_0xdfe2('0x8')]['http']({'port':0x232c});config[_0xdfe2('0x9')]=_[_0xdfe2('0xa')](config['redis'],{'host':_0xdfe2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfe2('0x9')]));require(_0xdfe2('0xc'))[_0xdfe2('0xd')](socket);function respondWithRpcPromise(_0x82815f,_0x1796a2,_0x25140a){return new BPromise(function(_0x441a1f,_0x2cc27c){return client[_0xdfe2('0xe')](_0x82815f,_0x25140a)[_0xdfe2('0xf')](function(_0x173034){logger[_0xdfe2('0x10')](_0xdfe2('0x11'),_0x1796a2,_0xdfe2('0x12'));logger[_0xdfe2('0x13')](_0xdfe2('0x14'),_0x1796a2,_0xdfe2('0x12'),JSON[_0xdfe2('0x15')](_0x173034));if(_0x173034[_0xdfe2('0x16')]){if(_0x173034['error'][_0xdfe2('0x17')]===0x1f4){logger['error'](_0xdfe2('0x11'),_0x1796a2,_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);return _0x2cc27c(_0x173034['error'][_0xdfe2('0x18')]);}logger[_0xdfe2('0x16')](_0xdfe2('0x11'),_0x1796a2,_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);return _0x441a1f(_0x173034[_0xdfe2('0x16')][_0xdfe2('0x18')]);}else{logger[_0xdfe2('0x10')](_0xdfe2('0x11'),_0x1796a2,_0xdfe2('0x12'));_0x441a1f(_0x173034[_0xdfe2('0x19')]['message']);}})['catch'](function(_0x50ef9d){logger[_0xdfe2('0x16')](_0xdfe2('0x11'),_0x1796a2,_0x50ef9d);_0x2cc27c(_0x50ef9d);});});}exports['GetFaxAccount']=function(_0xbd78d8){var _0x4282ba=this;return new Promise(function(_0x1e78b4,_0x1dee0a){return db[_0xdfe2('0x1a')][_0xdfe2('0x1b')]({'raw':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8['options'][_0xdfe2('0x1d')]===undefined?!![]:![]:!![],'where':_0xbd78d8['options']?_0xbd78d8['options'][_0xdfe2('0x1e')]||null:null,'attributes':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x1f')]||null:null,'limit':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')]['limit']||null:null,'include':_0xbd78d8[_0xdfe2('0x1c')]?_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x20')]?_[_0xdfe2('0x21')](_0xbd78d8[_0xdfe2('0x1c')][_0xdfe2('0x20')],function(_0x38331c){return{'model':db[_0x38331c[_0xdfe2('0x22')]],'as':_0x38331c['as'],'attributes':_0x38331c['attributes'],'include':_0x38331c[_0xdfe2('0x20')]?_['map'](_0x38331c['include'],function(_0x1bfcd1){return{'model':db[_0x1bfcd1[_0xdfe2('0x22')]],'as':_0x1bfcd1['as'],'attributes':_0x1bfcd1['attributes'],'include':_0x1bfcd1[_0xdfe2('0x20')]?_[_0xdfe2('0x21')](_0x1bfcd1[_0xdfe2('0x20')],function(_0x254560){return{'model':db[_0x254560[_0xdfe2('0x22')]],'as':_0x254560['as'],'attributes':_0x254560[_0xdfe2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e2e8){logger['info'](_0xdfe2('0x23'),_0xbd78d8);logger[_0xdfe2('0x13')](_0xdfe2('0x23'),_0xbd78d8,JSON[_0xdfe2('0x15')](_0x17e2e8));_0x1e78b4(_0x17e2e8);})[_0xdfe2('0x24')](function(_0x1350a1){logger[_0xdfe2('0x16')](_0xdfe2('0x23'),_0x1350a1[_0xdfe2('0x18')],_0xbd78d8);_0x1dee0a(_0x4282ba['error'](0x1f4,_0x1350a1['message']));});});};exports[_0xdfe2('0x25')]=function(_0x5044e0,_0x495eae,_0x39c3d7){var _0x5d5681=this;return new Promise(function(_0x45a2cc,_0x3f4d87){var _0x384b38={'body':_0x5044e0[_0xdfe2('0x26')],'channel':_0xdfe2('0x27')};var _0x317da7=[];var _0x309a0a=[];var _0x2f1963={};return db[_0xdfe2('0x28')][_0xdfe2('0x29')]()[_0xdfe2('0xf')](function(_0x50dc0c){if(!_0x50dc0c){throw new db['Sequelize'][(_0xdfe2('0x2a'))](_0xdfe2('0x2b'));}_0x317da7=_[_0xdfe2('0x2c')](_['keys'](_0x50dc0c),['createdAt','updatedAt']);_0x309a0a=_[_0xdfe2('0x2c')](_['keys'](_0x50dc0c),['createdAt',_0xdfe2('0x2d'),_0xdfe2('0x2e'),_0xdfe2('0x2f')]);if(_0x5044e0[_0xdfe2('0x26')]['id']){delete _0x5044e0[_0xdfe2('0x26')]['id'];}if(_[_0xdfe2('0x30')](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')])){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x26')])||_0x5044e0['body'][_0xdfe2('0x26')]===''){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))](_0xdfe2('0x33'));}if(_[_0xdfe2('0x30')](_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')])){throw new db['Sequelize'][(_0xdfe2('0x2a'))](_0xdfe2('0x35')+_0x309a0a);}if(!_[_0xdfe2('0x36')](_0x309a0a,_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')])){throw new db[(_0xdfe2('0x32'))][(_0xdfe2('0x2a'))](_0xdfe2('0x37')+_0x309a0a);}_0x2f1963[_0x5044e0['body'][_0xdfe2('0x34')]]=_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')];})['then'](function(){return db[_0xdfe2('0x1a')][_0xdfe2('0x38')]({'where':{'id':_0x5044e0[_0xdfe2('0x39')]['id']},'include':[{'model':db[_0xdfe2('0x3a')],'as':_0xdfe2('0x3b'),'include':[{'model':db['CmContact'],'as':_0xdfe2('0x3c'),'where':_0x2f1963,'limit':0x1,'order':[['updatedAt',_0xdfe2('0x3d')]]}]},{'model':db[_0xdfe2('0x3e')],'as':_0xdfe2('0x3f')}]});})[_0xdfe2('0xf')](function(_0xe3ccce){if(_0xe3ccce&&_0xe3ccce[_0xdfe2('0x3b')]){var _0x47616f=_0xe3ccce[_0xdfe2('0x40')]({'plain':!![]});_0x384b38['account']=_0x47616f;_0x384b38['applications']=_0x47616f['Applications'];_0x384b38[_0xdfe2('0x41')]=_0x47616f[_0xdfe2('0x3b')];_0x384b38[_0xdfe2('0x42')]=_[_0xdfe2('0x43')](_0x384b38['applications'],['priority'],['asc']);if(_0x384b38['account'][_0xdfe2('0x3f')]){delete _0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3f')];}if(_0x384b38[_0xdfe2('0x39')]['List']&&_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3b')]['Contacts']['length']){return _0x384b38[_0xdfe2('0x39')][_0xdfe2('0x3b')]['Contacts'][0x0];}var _0x29f7e0=_[_0xdfe2('0xa')](_0x5044e0[_0xdfe2('0x26')],{'firstName':_0x5044e0[_0xdfe2('0x26')]['from'],'ListId':_0x47616f['ListId']});_0x29f7e0[_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x34')]]=_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x31')];return db[_0xdfe2('0x28')][_0xdfe2('0x44')](_0x29f7e0,{'fields':_0x317da7,'raw':!![]});}})[_0xdfe2('0xf')](function(_0x4aff50){_0x384b38[_0xdfe2('0x45')]=_0x4aff50;if(_0x4aff50){var _0x2b5472={'ContactId':_0x4aff50['id'],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id'],'fax':_0x4aff50[_0xdfe2('0x27')]};return db[_0xdfe2('0x46')][_0xdfe2('0x38')]({'where':{'ContactId':_0x4aff50['id'],'closed':![],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id']}})['then'](function(_0x38797c){if(_0x38797c){return[_0x38797c,![]];}return db[_0xdfe2('0x46')][_0xdfe2('0x44')](_0x2b5472)[_0xdfe2('0xf')](function(_0x104d1a){return[_0x104d1a,!![]];});});}else{throw new Error(_0xdfe2('0x47'));}})[_0xdfe2('0x48')](function(_0x2f9262,_0x47953d){var _0x4c33d7=_0x2f9262[_0xdfe2('0x40')]({'plain':!![]});if(_0x47953d){if(_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x49')]){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x4a')]({'id':0x0,'priority':_0x384b38[_0xdfe2('0x42')]['length']+0x1,'app':_0xdfe2('0x4b'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x4c33d7['created']=!![];}else{_0x4c33d7['created']=![];}_0x384b38[_0xdfe2('0x4c')]=_0x4c33d7;return db['FaxMessage'][_0xdfe2('0x44')]({'body':_0x5044e0[_0xdfe2('0x26')][_0xdfe2('0x26')],'FaxAccountId':_0x5044e0[_0xdfe2('0x39')]['id'],'FaxInteractionId':_0x2f9262['id'],'direction':'in','ContactId':_0x2f9262[_0xdfe2('0x4d')],'AttachmentId':_0x5044e0['body'][_0xdfe2('0x4e')]});})[_0xdfe2('0xf')](function(_0x32ce47){_0x384b38[_0xdfe2('0x18')]=_0x32ce47;if(!_0x384b38[_0xdfe2('0x4c')][_0xdfe2('0x4f')])return;return db[_0xdfe2('0x50')][_0xdfe2('0x38')]({'attributes':['id',_0xdfe2('0x51')],'where':{'id':_0x384b38[_0xdfe2('0x4c')][_0xdfe2('0x4f')]}});})[_0xdfe2('0xf')](function(_0x53092e){if(_0x53092e){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x53092e['name']+','+(_0x384b38['account'][_0xdfe2('0x53')]||0xa),'interval':'*,*,*,*'});}if(!_0x384b38['interaction']['queueId'])return;return db['FaxQueue'][_0xdfe2('0x38')]({'attributes':['id',_0xdfe2('0x51')],'where':{'id':_0x384b38['interaction']['queueId']}});})['then'](function(_0x29c0d0){if(_0x29c0d0){_0x384b38[_0xdfe2('0x42')][_0xdfe2('0x52')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x29c0d0['name']+','+(_0x384b38[_0xdfe2('0x39')][_0xdfe2('0x54')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xdfe2('0x55'),_0x384b38);})[_0xdfe2('0xf')](function(_0x3f4059){_0x45a2cc(_0x3f4059);})[_0xdfe2('0x24')](function(_0x250189){_0x3f4d87(_0x5d5681['error'](0x1f4,_0x250189['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e28455f..ea9bf18 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 _0x64bd=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x376148,_0x27cbeb){var _0x30fe47=function(_0x5b3c99){while(--_0x5b3c99){_0x376148['push'](_0x376148['shift']());}};_0x30fe47(++_0x27cbeb);}(_0x64bd,0x184));var _0xd64b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x64bd[_0x3ab51d];return _0x29a04e;};'use strict';var FaxAccountEvents=require(_0xd64b('0x0'));var events=[_0xd64b('0x1'),_0xd64b('0x2'),_0xd64b('0x3')];function createListener(_0xf19c8a,_0x2c7abf){return function(_0x2a7992){_0x2c7abf['emit'](_0xf19c8a,_0x2a7992);};}function removeListener(_0x4a83f4,_0x1fe9a2){return function(){FaxAccountEvents[_0xd64b('0x4')](_0x4a83f4,_0x1fe9a2);};}exports['register']=function(_0x4f7985){for(var _0x2bcd7d=0x0,_0x357d53=events[_0xd64b('0x5')];_0x2bcd7d<_0x357d53;_0x2bcd7d++){var _0x370ba5=events[_0x2bcd7d];var _0x193b3c=createListener(_0xd64b('0x6')+_0x370ba5,_0x4f7985);FaxAccountEvents['on'](_0x370ba5,_0x193b3c);}}; \ No newline at end of file +var _0xf8f8=['register','length','faxAccount:','./faxAccount.events','save','update','removeListener'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xf8f8,0x7a));var _0x8f8f=function(_0x346822,_0x3ba342){_0x346822=_0x346822-0x0;var _0x43c594=_0xf8f8[_0x346822];return _0x43c594;};'use strict';var FaxAccountEvents=require(_0x8f8f('0x0'));var events=[_0x8f8f('0x1'),'remove',_0x8f8f('0x2')];function createListener(_0xd4a4a5,_0x4d5ccc){return function(_0xe72bce){_0x4d5ccc['emit'](_0xd4a4a5,_0xe72bce);};}function removeListener(_0x2b3da4,_0x5322dd){return function(){FaxAccountEvents[_0x8f8f('0x3')](_0x2b3da4,_0x5322dd);};}exports[_0x8f8f('0x4')]=function(_0x22685c){for(var _0x21147f=0x0,_0x4753e0=events[_0x8f8f('0x5')];_0x21147f<_0x4753e0;_0x21147f++){var _0x3b4b08=events[_0x21147f];var _0x852d57=createListener(_0x8f8f('0x6')+_0x3b4b08,_0x22685c);FaxAccountEvents['on'](_0x3b4b08,_0x852d57);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 31021d1..470c1ba 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 _0xac83=['getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','destroy','removeDispositions','/:id/users','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/canned_answers'];(function(_0x8423ec,_0x39bcab){var _0x2b8f59=function(_0x5dbf34){while(--_0x5dbf34){_0x8423ec['push'](_0x8423ec['shift']());}};_0x2b8f59(++_0x39bcab);}(_0xac83,0x103));var _0x3ac8=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xac83[_0x5f12fd];return _0x58bd80;};'use strict';var multer=require(_0x3ac8('0x0'));var util=require(_0x3ac8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ac8('0x2'));var router=express[_0x3ac8('0x3')]();var fs_extra=require(_0x3ac8('0x4'));var auth=require(_0x3ac8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ac8('0x6'));var controller=require(_0x3ac8('0x7'));router[_0x3ac8('0x8')]('/',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0xa')]);router['get']('/describe',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0xb')]);router[_0x3ac8('0x8')](_0x3ac8('0xc'),auth[_0x3ac8('0x9')](),controller['show']);router[_0x3ac8('0x8')]('/:id/dispositions',auth[_0x3ac8('0x9')](),controller['getDispositions']);router['get'](_0x3ac8('0xd'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0xe')]);router[_0x3ac8('0x8')](_0x3ac8('0xf'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x10')]);router[_0x3ac8('0x8')](_0x3ac8('0x11'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x12')]);router['get']('/:id/messages',auth[_0x3ac8('0x9')](),controller['getMessages']);router[_0x3ac8('0x8')]('/:id/users',auth[_0x3ac8('0x9')](),controller['getAgents']);router[_0x3ac8('0x13')]('/',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x14')]);router[_0x3ac8('0x13')](_0x3ac8('0x15'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x16')]);router[_0x3ac8('0x13')]('/:id/canned_answers',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x17')]);router[_0x3ac8('0x13')](_0x3ac8('0xf'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x18')]);router[_0x3ac8('0x13')](_0x3ac8('0x11'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x19')]);router[_0x3ac8('0x13')](_0x3ac8('0x1a'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x1b')]);router[_0x3ac8('0x13')](_0x3ac8('0x1c'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x1d')]);router[_0x3ac8('0x13')](_0x3ac8('0x1e'),auth[_0x3ac8('0x9')](),controller['send']);router['post']('/:id/users',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x1f')]);router[_0x3ac8('0x20')]('/:id',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x21')]);router[_0x3ac8('0x22')](_0x3ac8('0xc'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x23')]);router[_0x3ac8('0x22')]('/:id/dispositions',auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x24')]);router['delete'](_0x3ac8('0xd'),auth[_0x3ac8('0x9')](),controller['removeAnswers']);router[_0x3ac8('0x22')](_0x3ac8('0x25'),auth[_0x3ac8('0x9')](),controller[_0x3ac8('0x26')]);module['exports']=router; \ No newline at end of file +var _0x55f8=['addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','getDispositions','/:id/canned_answers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','addInteraction','addApplications','/addaccountapplications'];(function(_0x5b2094,_0xe7e1ec){var _0x54af16=function(_0x5a13a0){while(--_0x5a13a0){_0x5b2094['push'](_0x5b2094['shift']());}};_0x54af16(++_0xe7e1ec);}(_0x55f8,0x12a));var _0x855f=function(_0x10d394,_0x1e6d40){_0x10d394=_0x10d394-0x0;var _0xb75305=_0x55f8[_0x10d394];return _0xb75305;};'use strict';var multer=require(_0x855f('0x0'));var util=require('util');var path=require(_0x855f('0x1'));var timeout=require(_0x855f('0x2'));var express=require(_0x855f('0x3'));var router=express[_0x855f('0x4')]();var fs_extra=require(_0x855f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x855f('0x6'));var config=require(_0x855f('0x7'));var controller=require(_0x855f('0x8'));router[_0x855f('0x9')]('/',auth[_0x855f('0xa')](),controller[_0x855f('0xb')]);router['get']('/describe',auth[_0x855f('0xa')](),controller[_0x855f('0xc')]);router[_0x855f('0x9')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller['show']);router['get']('/:id/dispositions',auth[_0x855f('0xa')](),controller[_0x855f('0xe')]);router['get'](_0x855f('0xf'),auth[_0x855f('0xa')](),controller['getAnswers']);router[_0x855f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x855f('0x10')]);router['get'](_0x855f('0x11'),auth[_0x855f('0xa')](),controller[_0x855f('0x12')]);router[_0x855f('0x9')](_0x855f('0x13'),auth[_0x855f('0xa')](),controller[_0x855f('0x14')]);router[_0x855f('0x9')](_0x855f('0x15'),auth['isAuthenticated'](),controller[_0x855f('0x16')]);router[_0x855f('0x17')]('/',auth['isAuthenticated'](),controller[_0x855f('0x18')]);router[_0x855f('0x17')](_0x855f('0x19'),auth[_0x855f('0xa')](),controller['addDisposition']);router[_0x855f('0x17')](_0x855f('0xf'),auth['isAuthenticated'](),controller[_0x855f('0x1a')]);router[_0x855f('0x17')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x855f('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x855f('0x1c')]);router[_0x855f('0x17')](_0x855f('0x1d'),auth[_0x855f('0xa')](),controller[_0x855f('0x1e')]);router[_0x855f('0x17')](_0x855f('0x1f'),auth[_0x855f('0xa')](),controller[_0x855f('0x20')]);router['post']('/:id/send',auth[_0x855f('0xa')](),controller[_0x855f('0x21')]);router[_0x855f('0x17')](_0x855f('0x15'),auth[_0x855f('0xa')](),controller[_0x855f('0x22')]);router[_0x855f('0x23')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller[_0x855f('0x24')]);router[_0x855f('0x25')](_0x855f('0xd'),auth[_0x855f('0xa')](),controller[_0x855f('0x26')]);router[_0x855f('0x25')](_0x855f('0x19'),auth[_0x855f('0xa')](),controller[_0x855f('0x27')]);router[_0x855f('0x25')](_0x855f('0xf'),auth[_0x855f('0xa')](),controller['removeAnswers']);router[_0x855f('0x25')]('/:id/users',auth[_0x855f('0xa')](),controller['removeAgents']);module[_0x855f('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 9d63719..a62cde4 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 _0x57af=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x3a6bd9,_0x5ecb06){var _0x3a6d58=function(_0x1b0d5e){while(--_0x1b0d5e){_0x3a6bd9['push'](_0x3a6bd9['shift']());}};_0x3a6d58(++_0x5ecb06);}(_0x57af,0xf4));var _0xf57a=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x57af[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0xf57a('0x0')]={'priority':{'type':Sequelize[_0xf57a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf57a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf57a('0x3')]()},'description':{'type':Sequelize[_0xf57a('0x2')]},'interval':{'type':Sequelize[_0xf57a('0x2')],'defaultValue':_0xf57a('0x4')}}; \ No newline at end of file +var _0x3b10=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xf63cbd,_0x358aff){var _0x1fc9f2=function(_0x10368b){while(--_0x10368b){_0xf63cbd['push'](_0xf63cbd['shift']());}};_0x1fc9f2(++_0x358aff);}(_0x3b10,0x181));var _0x03b1=function(_0xffd797,_0x30fc14){_0xffd797=_0xffd797-0x0;var _0x3a39f5=_0x3b10[_0xffd797];return _0x3a39f5;};'use strict';var Sequelize=require(_0x03b1('0x0'));module[_0x03b1('0x1')]={'priority':{'type':Sequelize[_0x03b1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x03b1('0x3')],'allowNull':![],'defaultValue':_0x03b1('0x4')},'appdata':{'type':Sequelize[_0x03b1('0x5')]()},'description':{'type':Sequelize[_0x03b1('0x3')]},'interval':{'type':Sequelize[_0x03b1('0x3')],'defaultValue':_0x03b1('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4d88cad..f5c2ef5 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 _0x3e4e=['json','apply','reject','update','destroy','then','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x67acd3,_0x42113e){var _0x141812=function(_0x259bad){while(--_0x259bad){_0x67acd3['push'](_0x67acd3['shift']());}};_0x141812(++_0x42113e);}(_0x3e4e,0x77));var _0xe3e4=function(_0x4981fc,_0x33e60d){_0x4981fc=_0x4981fc-0x0;var _0x1b04f1=_0x3e4e[_0x4981fc];return _0x1b04f1;};'use strict';var emlformat=require(_0xe3e4('0x0'));var rimraf=require(_0xe3e4('0x1'));var zipdir=require(_0xe3e4('0x2'));var jsonpatch=require(_0xe3e4('0x3'));var rp=require(_0xe3e4('0x4'));var moment=require(_0xe3e4('0x5'));var BPromise=require(_0xe3e4('0x6'));var Mustache=require(_0xe3e4('0x7'));var util=require(_0xe3e4('0x8'));var path=require(_0xe3e4('0x9'));var sox=require(_0xe3e4('0xa'));var csv=require(_0xe3e4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3e4('0xc'));var _=require(_0xe3e4('0xd'));var squel=require(_0xe3e4('0xe'));var crypto=require(_0xe3e4('0xf'));var jsforce=require(_0xe3e4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe3e4('0xb'));var querystring=require('querystring');var Papa=require(_0xe3e4('0x11'));var Redis=require(_0xe3e4('0x12'));var authService=require(_0xe3e4('0x13'));var qs=require(_0xe3e4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e4('0x15'));var logger=require(_0xe3e4('0x16'))(_0xe3e4('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe3e4('0x18'));var db=require(_0xe3e4('0x19'))['db'];function respondWithStatusCode(_0xdac1cc,_0x2c390d){_0x2c390d=_0x2c390d||0xcc;return function(_0x3061fe){if(_0x3061fe){return _0xdac1cc[_0xe3e4('0x1a')](_0x2c390d);}return _0xdac1cc['status'](_0x2c390d)[_0xe3e4('0x1b')]();};}function respondWithResult(_0x5c60ef,_0x2c0692){_0x2c0692=_0x2c0692||0xc8;return function(_0x35574e){if(_0x35574e){return _0x5c60ef[_0xe3e4('0x1c')](_0x2c0692)['json'](_0x35574e);}};}function respondWithFilteredResult(_0x164811,_0x4603f8){return function(_0x50eaeb){if(_0x50eaeb){var _0x3abe52=typeof _0x4603f8[_0xe3e4('0x1d')]===_0xe3e4('0x1e')&&typeof _0x4603f8[_0xe3e4('0x1f')]===_0xe3e4('0x1e');var _0x4437ce=_0x50eaeb[_0xe3e4('0x20')];var _0x5c9bbc=_0x3abe52?0x0:_0x4603f8[_0xe3e4('0x1d')];var _0x46aaef=_0x3abe52?_0x50eaeb[_0xe3e4('0x20')]:_0x4603f8[_0xe3e4('0x1d')]+_0x4603f8[_0xe3e4('0x1f')];var _0x1aa57c;if(_0x46aaef>=_0x4437ce){_0x46aaef=_0x4437ce;_0x1aa57c=0xc8;}else{_0x1aa57c=0xce;}_0x164811[_0xe3e4('0x1c')](_0x1aa57c);return _0x164811[_0xe3e4('0x21')](_0xe3e4('0x22'),_0x5c9bbc+'-'+_0x46aaef+'/'+_0x4437ce)[_0xe3e4('0x23')](_0x50eaeb);}return null;};}function patchUpdates(_0x2d4ecb){return function(_0x3b65d9){try{jsonpatch[_0xe3e4('0x24')](_0x3b65d9,_0x2d4ecb,!![]);}catch(_0x2f7017){return BPromise[_0xe3e4('0x25')](_0x2f7017);}return _0x3b65d9['save']();};}function saveUpdates(_0x2fc565,_0x17a49c){return function(_0x77ffc7){if(_0x77ffc7){return _0x77ffc7[_0xe3e4('0x26')](_0x2fc565)['then'](function(_0x1e75e5){return _0x1e75e5;});}return null;};}function removeEntity(_0x2b0f77,_0x396376){return function(_0x1f554f){if(_0x1f554f){return _0x1f554f[_0xe3e4('0x27')]()[_0xe3e4('0x28')](function(){_0x2b0f77[_0xe3e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591c02,_0x3f471d){return function(_0x538862){if(!_0x538862){_0x591c02[_0xe3e4('0x1a')](0x194);}return _0x538862;};}function handleError(_0x524a0f,_0x14293b){_0x14293b=_0x14293b||0x1f4;return function(_0x2f2e2b){logger[_0xe3e4('0x29')](_0x2f2e2b[_0xe3e4('0x2a')]);if(_0x2f2e2b[_0xe3e4('0x2b')]){delete _0x2f2e2b[_0xe3e4('0x2b')];}_0x524a0f[_0xe3e4('0x1c')](_0x14293b)[_0xe3e4('0x2c')](_0x2f2e2b);};}exports[_0xe3e4('0x2d')]=function(_0x509f2c,_0x2b9e8e){var _0x29621c={},_0x19e30d={},_0x431247={'count':0x0,'rows':[]};var _0x23150d=_['map'](db[_0xe3e4('0x2e')][_0xe3e4('0x2f')],function(_0x208073){return{'name':_0x208073[_0xe3e4('0x30')],'type':_0x208073[_0xe3e4('0x31')][_0xe3e4('0x32')]};});_0x19e30d[_0xe3e4('0x33')]=_['map'](_0x23150d,_0xe3e4('0x2b'));_0x19e30d[_0xe3e4('0x34')]=_[_0xe3e4('0x35')](_0x509f2c[_0xe3e4('0x34')]);_0x19e30d[_0xe3e4('0x36')]=_['intersection'](_0x19e30d[_0xe3e4('0x33')],_0x19e30d[_0xe3e4('0x34')]);_0x29621c[_0xe3e4('0x37')]=_[_0xe3e4('0x38')](_0x19e30d[_0xe3e4('0x33')],qs[_0xe3e4('0x39')](_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x39')]));_0x29621c[_0xe3e4('0x37')]=_0x29621c[_0xe3e4('0x37')][_0xe3e4('0x3a')]?_0x29621c[_0xe3e4('0x37')]:_0x19e30d[_0xe3e4('0x33')];if(!_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x3b')](_0xe3e4('0x3c'))){_0x29621c[_0xe3e4('0x1f')]=qs[_0xe3e4('0x1f')](_0x509f2c[_0xe3e4('0x34')]['limit']);_0x29621c['offset']=qs[_0xe3e4('0x1d')](_0x509f2c['query']['offset']);}_0x29621c[_0xe3e4('0x3d')]=qs[_0xe3e4('0x3e')](_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x3e')]);_0x29621c['where']=qs[_0xe3e4('0x36')](_[_0xe3e4('0x3f')](_0x509f2c['query'],_0x19e30d['filters']),_0x23150d);if(_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x40')]){_0x29621c[_0xe3e4('0x41')]=_[_0xe3e4('0x42')](_0x29621c[_0xe3e4('0x41')],{'$or':_[_0xe3e4('0x43')](_0x23150d,function(_0x569d17){if(_0x569d17[_0xe3e4('0x31')]!==_0xe3e4('0x44')){var _0x3da069={};_0x3da069[_0x569d17[_0xe3e4('0x2b')]]={'$like':'%'+_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x40')]+'%'};return _0x3da069;}})});}_0x29621c=_[_0xe3e4('0x42')]({},_0x29621c,_0x509f2c['options']);var _0x41772d={'where':_0x29621c[_0xe3e4('0x41')]};return db[_0xe3e4('0x2e')]['count'](_0x41772d)[_0xe3e4('0x28')](function(_0x13c52d){_0x431247[_0xe3e4('0x20')]=_0x13c52d;if(_0x509f2c[_0xe3e4('0x34')][_0xe3e4('0x45')]){_0x29621c[_0xe3e4('0x46')]=[{'all':!![]}];}return db[_0xe3e4('0x2e')]['findAll'](_0x29621c);})[_0xe3e4('0x28')](function(_0x3564a0){_0x431247['rows']=_0x3564a0;return _0x431247;})[_0xe3e4('0x28')](respondWithFilteredResult(_0x2b9e8e,_0x29621c))[_0xe3e4('0x47')](handleError(_0x2b9e8e,null));};exports[_0xe3e4('0x48')]=function(_0x432f30,_0x2f9a6d){var _0xd568c9={'raw':!![],'where':{'id':_0x432f30[_0xe3e4('0x49')]['id']}},_0x3ad13a={};_0x3ad13a[_0xe3e4('0x33')]=_[_0xe3e4('0x35')](db[_0xe3e4('0x2e')][_0xe3e4('0x2f')]);_0x3ad13a['query']=_[_0xe3e4('0x35')](_0x432f30['query']);_0x3ad13a[_0xe3e4('0x36')]=_[_0xe3e4('0x38')](_0x3ad13a[_0xe3e4('0x33')],_0x3ad13a[_0xe3e4('0x34')]);_0xd568c9['attributes']=_[_0xe3e4('0x38')](_0x3ad13a[_0xe3e4('0x33')],qs[_0xe3e4('0x39')](_0x432f30[_0xe3e4('0x34')]['fields']));_0xd568c9[_0xe3e4('0x37')]=_0xd568c9[_0xe3e4('0x37')][_0xe3e4('0x3a')]?_0xd568c9['attributes']:_0x3ad13a[_0xe3e4('0x33')];if(_0x432f30[_0xe3e4('0x34')]['includeAll']){_0xd568c9[_0xe3e4('0x46')]=[{'all':!![]}];}_0xd568c9=_[_0xe3e4('0x42')]({},_0xd568c9,_0x432f30['options']);return db[_0xe3e4('0x2e')]['find'](_0xd568c9)[_0xe3e4('0x28')](handleEntityNotFound(_0x2f9a6d,null))[_0xe3e4('0x28')](respondWithResult(_0x2f9a6d,null))[_0xe3e4('0x47')](handleError(_0x2f9a6d,null));};exports[_0xe3e4('0x4a')]=function(_0x301c6e,_0x511d0b){return db[_0xe3e4('0x2e')][_0xe3e4('0x4a')](_0x301c6e[_0xe3e4('0x4b')],{})['then'](respondWithResult(_0x511d0b,0xc9))[_0xe3e4('0x47')](handleError(_0x511d0b,null));};exports[_0xe3e4('0x26')]=function(_0x38aafb,_0x50e1f6){if(_0x38aafb[_0xe3e4('0x4b')]['id']){delete _0x38aafb['body']['id'];}return db[_0xe3e4('0x2e')][_0xe3e4('0x4c')]({'where':{'id':_0x38aafb[_0xe3e4('0x49')]['id']}})[_0xe3e4('0x28')](handleEntityNotFound(_0x50e1f6,null))[_0xe3e4('0x28')](saveUpdates(_0x38aafb['body'],null))[_0xe3e4('0x28')](respondWithResult(_0x50e1f6,null))['catch'](handleError(_0x50e1f6,null));};exports['destroy']=function(_0x47c9d7,_0x27bc82){return db['FaxApplication'][_0xe3e4('0x4c')]({'where':{'id':_0x47c9d7['params']['id']}})['then'](handleEntityNotFound(_0x27bc82,null))[_0xe3e4('0x28')](removeEntity(_0x27bc82,null))[_0xe3e4('0x47')](handleError(_0x27bc82,null));}; \ No newline at end of file +var _0xfe27=['status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','FaxApplication','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xfe27,0xbf));var _0x7fe2=function(_0x427bae,_0x3a3fb0){_0x427bae=_0x427bae-0x0;var _0x4a38d4=_0xfe27[_0x427bae];return _0x4a38d4;};'use strict';var emlformat=require(_0x7fe2('0x0'));var rimraf=require(_0x7fe2('0x1'));var zipdir=require(_0x7fe2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fe2('0x4'));var util=require(_0x7fe2('0x5'));var path=require(_0x7fe2('0x6'));var sox=require(_0x7fe2('0x7'));var csv=require(_0x7fe2('0x8'));var ejs=require(_0x7fe2('0x9'));var fs=require('fs');var fs_extra=require(_0x7fe2('0xa'));var _=require(_0x7fe2('0xb'));var squel=require(_0x7fe2('0xc'));var crypto=require(_0x7fe2('0xd'));var jsforce=require(_0x7fe2('0xe'));var deskjs=require(_0x7fe2('0xf'));var toCsv=require(_0x7fe2('0x8'));var querystring=require(_0x7fe2('0x10'));var Papa=require(_0x7fe2('0x11'));var Redis=require('ioredis');var authService=require(_0x7fe2('0x12'));var qs=require(_0x7fe2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fe2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fe2('0x15'))['db'];function respondWithStatusCode(_0xbc67f3,_0x369f9e){_0x369f9e=_0x369f9e||0xcc;return function(_0x38713e){if(_0x38713e){return _0xbc67f3['sendStatus'](_0x369f9e);}return _0xbc67f3[_0x7fe2('0x16')](_0x369f9e)['end']();};}function respondWithResult(_0x3ef928,_0x292020){_0x292020=_0x292020||0xc8;return function(_0x473a83){if(_0x473a83){return _0x3ef928['status'](_0x292020)[_0x7fe2('0x17')](_0x473a83);}};}function respondWithFilteredResult(_0x8bda6d,_0x390d49){return function(_0x901422){if(_0x901422){var _0x3f9918=typeof _0x390d49[_0x7fe2('0x18')]==='undefined'&&typeof _0x390d49[_0x7fe2('0x19')]===_0x7fe2('0x1a');var _0x5bc318=_0x901422['count'];var _0x589260=_0x3f9918?0x0:_0x390d49[_0x7fe2('0x18')];var _0x3f7f32=_0x3f9918?_0x901422[_0x7fe2('0x1b')]:_0x390d49['offset']+_0x390d49[_0x7fe2('0x19')];var _0x4a3bec;if(_0x3f7f32>=_0x5bc318){_0x3f7f32=_0x5bc318;_0x4a3bec=0xc8;}else{_0x4a3bec=0xce;}_0x8bda6d[_0x7fe2('0x16')](_0x4a3bec);return _0x8bda6d[_0x7fe2('0x1c')]('Content-Range',_0x589260+'-'+_0x3f7f32+'/'+_0x5bc318)['json'](_0x901422);}return null;};}function patchUpdates(_0x306789){return function(_0x15cccf){try{jsonpatch[_0x7fe2('0x1d')](_0x15cccf,_0x306789,!![]);}catch(_0x42b32a){return BPromise[_0x7fe2('0x1e')](_0x42b32a);}return _0x15cccf[_0x7fe2('0x1f')]();};}function saveUpdates(_0x38bf34,_0x203b8a){return function(_0x36d9c3){if(_0x36d9c3){return _0x36d9c3[_0x7fe2('0x20')](_0x38bf34)[_0x7fe2('0x21')](function(_0x4bb775){return _0x4bb775;});}return null;};}function removeEntity(_0x1b380f,_0x46eec0){return function(_0x361a95){if(_0x361a95){return _0x361a95[_0x7fe2('0x22')]()['then'](function(){_0x1b380f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3f184,_0x4314db){return function(_0x451c8b){if(!_0x451c8b){_0xf3f184[_0x7fe2('0x23')](0x194);}return _0x451c8b;};}function handleError(_0x590983,_0x1e9cc2){_0x1e9cc2=_0x1e9cc2||0x1f4;return function(_0x4135fd){logger[_0x7fe2('0x24')](_0x4135fd[_0x7fe2('0x25')]);if(_0x4135fd[_0x7fe2('0x26')]){delete _0x4135fd[_0x7fe2('0x26')];}_0x590983[_0x7fe2('0x16')](_0x1e9cc2)['send'](_0x4135fd);};}exports['index']=function(_0x1c228b,_0xd166cf){var _0x1da23b={},_0xc31084={},_0x20cb87={'count':0x0,'rows':[]};var _0x200ea6=_[_0x7fe2('0x27')](db[_0x7fe2('0x28')]['rawAttributes'],function(_0x337b73){return{'name':_0x337b73[_0x7fe2('0x29')],'type':_0x337b73['type'][_0x7fe2('0x2a')]};});_0xc31084[_0x7fe2('0x2b')]=_['map'](_0x200ea6,_0x7fe2('0x26'));_0xc31084[_0x7fe2('0x2c')]=_[_0x7fe2('0x2d')](_0x1c228b[_0x7fe2('0x2c')]);_0xc31084['filters']=_[_0x7fe2('0x2e')](_0xc31084[_0x7fe2('0x2b')],_0xc31084[_0x7fe2('0x2c')]);_0x1da23b[_0x7fe2('0x2f')]=_[_0x7fe2('0x2e')](_0xc31084[_0x7fe2('0x2b')],qs[_0x7fe2('0x30')](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x30')]));_0x1da23b[_0x7fe2('0x2f')]=_0x1da23b[_0x7fe2('0x2f')][_0x7fe2('0x31')]?_0x1da23b[_0x7fe2('0x2f')]:_0xc31084['model'];if(!_0x1c228b['query'][_0x7fe2('0x32')](_0x7fe2('0x33'))){_0x1da23b['limit']=qs['limit'](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x19')]);_0x1da23b['offset']=qs[_0x7fe2('0x18')](_0x1c228b['query']['offset']);}_0x1da23b[_0x7fe2('0x34')]=qs[_0x7fe2('0x35')](_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x35')]);_0x1da23b[_0x7fe2('0x36')]=qs[_0x7fe2('0x37')](_[_0x7fe2('0x38')](_0x1c228b[_0x7fe2('0x2c')],_0xc31084[_0x7fe2('0x37')]),_0x200ea6);if(_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x39')]){_0x1da23b[_0x7fe2('0x36')]=_[_0x7fe2('0x3a')](_0x1da23b['where'],{'$or':_[_0x7fe2('0x27')](_0x200ea6,function(_0x4e149a){if(_0x4e149a[_0x7fe2('0x3b')]!==_0x7fe2('0x3c')){var _0x4ba8b9={};_0x4ba8b9[_0x4e149a[_0x7fe2('0x26')]]={'$like':'%'+_0x1c228b['query']['filter']+'%'};return _0x4ba8b9;}})});}_0x1da23b=_[_0x7fe2('0x3a')]({},_0x1da23b,_0x1c228b[_0x7fe2('0x3d')]);var _0x7e8850={'where':_0x1da23b['where']};return db[_0x7fe2('0x28')]['count'](_0x7e8850)[_0x7fe2('0x21')](function(_0x27baa6){_0x20cb87[_0x7fe2('0x1b')]=_0x27baa6;if(_0x1c228b[_0x7fe2('0x2c')][_0x7fe2('0x3e')]){_0x1da23b['include']=[{'all':!![]}];}return db[_0x7fe2('0x28')]['findAll'](_0x1da23b);})[_0x7fe2('0x21')](function(_0x26b8d3){_0x20cb87['rows']=_0x26b8d3;return _0x20cb87;})[_0x7fe2('0x21')](respondWithFilteredResult(_0xd166cf,_0x1da23b))[_0x7fe2('0x3f')](handleError(_0xd166cf,null));};exports[_0x7fe2('0x40')]=function(_0x45fbd9,_0x1e5a95){var _0x12386d={'raw':!![],'where':{'id':_0x45fbd9[_0x7fe2('0x41')]['id']}},_0x391f75={};_0x391f75[_0x7fe2('0x2b')]=_[_0x7fe2('0x2d')](db[_0x7fe2('0x28')][_0x7fe2('0x42')]);_0x391f75[_0x7fe2('0x2c')]=_[_0x7fe2('0x2d')](_0x45fbd9['query']);_0x391f75[_0x7fe2('0x37')]=_[_0x7fe2('0x2e')](_0x391f75[_0x7fe2('0x2b')],_0x391f75['query']);_0x12386d[_0x7fe2('0x2f')]=_[_0x7fe2('0x2e')](_0x391f75[_0x7fe2('0x2b')],qs['fields'](_0x45fbd9['query']['fields']));_0x12386d[_0x7fe2('0x2f')]=_0x12386d[_0x7fe2('0x2f')][_0x7fe2('0x31')]?_0x12386d[_0x7fe2('0x2f')]:_0x391f75[_0x7fe2('0x2b')];if(_0x45fbd9[_0x7fe2('0x2c')][_0x7fe2('0x3e')]){_0x12386d[_0x7fe2('0x43')]=[{'all':!![]}];}_0x12386d=_[_0x7fe2('0x3a')]({},_0x12386d,_0x45fbd9[_0x7fe2('0x3d')]);return db[_0x7fe2('0x28')]['find'](_0x12386d)[_0x7fe2('0x21')](handleEntityNotFound(_0x1e5a95,null))[_0x7fe2('0x21')](respondWithResult(_0x1e5a95,null))[_0x7fe2('0x3f')](handleError(_0x1e5a95,null));};exports[_0x7fe2('0x44')]=function(_0xf447c0,_0x545c3d){return db['FaxApplication'][_0x7fe2('0x44')](_0xf447c0[_0x7fe2('0x45')],{})['then'](respondWithResult(_0x545c3d,0xc9))[_0x7fe2('0x3f')](handleError(_0x545c3d,null));};exports['update']=function(_0x1f25c0,_0xaf6710){if(_0x1f25c0['body']['id']){delete _0x1f25c0['body']['id'];}return db[_0x7fe2('0x28')][_0x7fe2('0x46')]({'where':{'id':_0x1f25c0['params']['id']}})[_0x7fe2('0x21')](handleEntityNotFound(_0xaf6710,null))[_0x7fe2('0x21')](saveUpdates(_0x1f25c0[_0x7fe2('0x45')],null))[_0x7fe2('0x21')](respondWithResult(_0xaf6710,null))[_0x7fe2('0x3f')](handleError(_0xaf6710,null));};exports['destroy']=function(_0x194ccf,_0x1c8ae5){return db['FaxApplication'][_0x7fe2('0x46')]({'where':{'id':_0x194ccf[_0x7fe2('0x41')]['id']}})[_0x7fe2('0x21')](handleEntityNotFound(_0x1c8ae5,null))['then'](removeEntity(_0x1c8ae5,null))[_0x7fe2('0x3f')](handleError(_0x1c8ae5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c13f362..bd9eff0 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 _0xbd1c=['utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbd1c,0x1a5));var _0xcbd1=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xbd1c[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var logger=require(_0xcbd1('0x2'))(_0xcbd1('0x3'));var moment=require(_0xcbd1('0x4'));var BPromise=require('bluebird');var rp=require(_0xcbd1('0x5'));var fs=require('fs');var path=require(_0xcbd1('0x6'));var rimraf=require(_0xcbd1('0x7'));var config=require(_0xcbd1('0x8'));var attributes=require(_0xcbd1('0x9'));module['exports']=function(_0xbfa2c8,_0x4dea15){return _0xbfa2c8[_0xcbd1('0xa')](_0xcbd1('0xb'),attributes,{'tableName':_0xcbd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcbd1('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc5ed=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x2f1e01,_0x425231){var _0x45df55=function(_0x57a661){while(--_0x57a661){_0x2f1e01['push'](_0x2f1e01['shift']());}};_0x45df55(++_0x425231);}(_0xc5ed,0x8a));var _0xdc5e=function(_0x46b1b2,_0x3ec40c){_0x46b1b2=_0x46b1b2-0x0;var _0x56c41b=_0xc5ed[_0x46b1b2];return _0x56c41b;};'use strict';var _=require(_0xdc5e('0x0'));var util=require(_0xdc5e('0x1'));var logger=require(_0xdc5e('0x2'))(_0xdc5e('0x3'));var moment=require(_0xdc5e('0x4'));var BPromise=require(_0xdc5e('0x5'));var rp=require(_0xdc5e('0x6'));var fs=require('fs');var path=require(_0xdc5e('0x7'));var rimraf=require(_0xdc5e('0x8'));var config=require(_0xdc5e('0x9'));var attributes=require(_0xdc5e('0xa'));module['exports']=function(_0x2c2f09,_0x56fc9d){return _0x2c2f09[_0xdc5e('0xb')]('FaxApplication',attributes,{'tableName':_0xdc5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdc5e('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 726b725..166ff89 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 _0xb9dd=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','catch','FaxApplication','body','options','raw','attributes','UpdateFaxApplication'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb9dd,0x1f0));var _0xdb9d=function(_0x37ac38,_0x1aa42e){_0x37ac38=_0x37ac38-0x0;var _0x316efc=_0xb9dd[_0x37ac38];return _0x316efc;};'use strict';var _=require(_0xdb9d('0x0'));var util=require(_0xdb9d('0x1'));var moment=require(_0xdb9d('0x2'));var BPromise=require(_0xdb9d('0x3'));var rs=require(_0xdb9d('0x4'));var fs=require('fs');var Redis=require(_0xdb9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb9d('0x6'));var logger=require(_0xdb9d('0x7'))(_0xdb9d('0x8'));var config=require(_0xdb9d('0x9'));var jayson=require(_0xdb9d('0xa'));var client=jayson[_0xdb9d('0xb')][_0xdb9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe5e938,_0x40d475,_0x4fbc27){return new BPromise(function(_0x4a0ccd,_0x4eab61){return client[_0xdb9d('0xd')](_0xe5e938,_0x4fbc27)[_0xdb9d('0xe')](function(_0x4dad5a){logger[_0xdb9d('0xf')]('FaxApplication,\x20%s,\x20%s',_0x40d475,_0xdb9d('0x10'));logger[_0xdb9d('0x11')](_0xdb9d('0x12'),_0x40d475,'request\x20sent',JSON[_0xdb9d('0x13')](_0x4dad5a));if(_0x4dad5a[_0xdb9d('0x14')]){if(_0x4dad5a[_0xdb9d('0x14')][_0xdb9d('0x15')]===0x1f4){logger[_0xdb9d('0x14')]('FaxApplication,\x20%s,\x20%s',_0x40d475,_0x4dad5a['error']['message']);return _0x4eab61(_0x4dad5a['error'][_0xdb9d('0x16')]);}logger[_0xdb9d('0x14')](_0xdb9d('0x17'),_0x40d475,_0x4dad5a[_0xdb9d('0x14')][_0xdb9d('0x16')]);return _0x4a0ccd(_0x4dad5a[_0xdb9d('0x14')][_0xdb9d('0x16')]);}else{logger[_0xdb9d('0xf')](_0xdb9d('0x17'),_0x40d475,_0xdb9d('0x10'));_0x4a0ccd(_0x4dad5a['result'][_0xdb9d('0x16')]);}})[_0xdb9d('0x18')](function(_0x4865db){logger[_0xdb9d('0x14')](_0xdb9d('0x17'),_0x40d475,_0x4865db);_0x4eab61(_0x4865db);});});}exports['UpdateFaxApplication']=function(_0x57c4a5){var _0xb30c02=this;return new Promise(function(_0x4ff992,_0x11ea8a){return db[_0xdb9d('0x19')]['update'](_0x57c4a5[_0xdb9d('0x1a')],{'raw':_0x57c4a5[_0xdb9d('0x1b')]?_0x57c4a5['options'][_0xdb9d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c4a5[_0xdb9d('0x1b')]?_0x57c4a5[_0xdb9d('0x1b')]['where']||null:null,'attributes':_0x57c4a5[_0xdb9d('0x1b')]?_0x57c4a5[_0xdb9d('0x1b')][_0xdb9d('0x1d')]||null:null,'limit':_0x57c4a5[_0xdb9d('0x1b')]?_0x57c4a5[_0xdb9d('0x1b')]['limit']||null:null})[_0xdb9d('0xe')](function(_0x375fe9){logger[_0xdb9d('0xf')]('UpdateFaxApplication',_0x57c4a5);logger['debug'](_0xdb9d('0x1e'),_0x57c4a5,JSON[_0xdb9d('0x13')](_0x375fe9));_0x4ff992(_0x375fe9);})[_0xdb9d('0x18')](function(_0x59646e){logger[_0xdb9d('0x14')](_0xdb9d('0x1e'),_0x59646e[_0xdb9d('0x16')],_0x57c4a5);_0x11ea8a(_0xb30c02[_0xdb9d('0x14')](0x1f4,_0x59646e[_0xdb9d('0x16')]));});});}; \ No newline at end of file +var _0xe8bc=['body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxApplication,\x20%s,\x20%s','message','catch','update'];(function(_0x2539c6,_0x5a0687){var _0x3bad35=function(_0xbc9a1e){while(--_0xbc9a1e){_0x2539c6['push'](_0x2539c6['shift']());}};_0x3bad35(++_0x5a0687);}(_0xe8bc,0x15c));var _0xce8b=function(_0x43fb7f,_0xed547a){_0x43fb7f=_0x43fb7f-0x0;var _0x29ce4c=_0xe8bc[_0x43fb7f];return _0x29ce4c;};'use strict';var _=require(_0xce8b('0x0'));var util=require(_0xce8b('0x1'));var moment=require('moment');var BPromise=require(_0xce8b('0x2'));var rs=require(_0xce8b('0x3'));var fs=require('fs');var Redis=require(_0xce8b('0x4'));var db=require(_0xce8b('0x5'))['db'];var utils=require(_0xce8b('0x6'));var logger=require(_0xce8b('0x7'))(_0xce8b('0x8'));var config=require('../../config/environment');var jayson=require(_0xce8b('0x9'));var client=jayson[_0xce8b('0xa')][_0xce8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4348,_0x3c8fcc,_0x29975e){return new BPromise(function(_0xca742f,_0x37e633){return client['request'](_0x4f4348,_0x29975e)[_0xce8b('0xc')](function(_0x5f03a2){logger[_0xce8b('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3c8fcc,_0xce8b('0xe'));logger[_0xce8b('0xf')](_0xce8b('0x10'),_0x3c8fcc,_0xce8b('0xe'),JSON[_0xce8b('0x11')](_0x5f03a2));if(_0x5f03a2['error']){if(_0x5f03a2['error'][_0xce8b('0x12')]===0x1f4){logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5f03a2[_0xce8b('0x13')]['message']);return _0x37e633(_0x5f03a2['error'][_0xce8b('0x15')]);}logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5f03a2['error'][_0xce8b('0x15')]);return _0xca742f(_0x5f03a2[_0xce8b('0x13')][_0xce8b('0x15')]);}else{logger['info'](_0xce8b('0x14'),_0x3c8fcc,_0xce8b('0xe'));_0xca742f(_0x5f03a2['result'][_0xce8b('0x15')]);}})[_0xce8b('0x16')](function(_0x5d4453){logger[_0xce8b('0x13')](_0xce8b('0x14'),_0x3c8fcc,_0x5d4453);_0x37e633(_0x5d4453);});});}exports['UpdateFaxApplication']=function(_0x1f16f2){var _0x108e98=this;return new Promise(function(_0x2bf603,_0x32385a){return db['FaxApplication'][_0xce8b('0x17')](_0x1f16f2[_0xce8b('0x18')],{'raw':_0x1f16f2['options']?_0x1f16f2[_0xce8b('0x19')][_0xce8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2[_0xce8b('0x19')][_0xce8b('0x1b')]||null:null,'attributes':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2['options'][_0xce8b('0x1c')]||null:null,'limit':_0x1f16f2[_0xce8b('0x19')]?_0x1f16f2['options'][_0xce8b('0x1d')]||null:null})[_0xce8b('0xc')](function(_0x49e932){logger[_0xce8b('0xd')]('UpdateFaxApplication',_0x1f16f2);logger['debug'](_0xce8b('0x1e'),_0x1f16f2,JSON['stringify'](_0x49e932));_0x2bf603(_0x49e932);})[_0xce8b('0x16')](function(_0x310df0){logger[_0xce8b('0x13')](_0xce8b('0x1e'),_0x310df0[_0xce8b('0x15')],_0x1f16f2);_0x32385a(_0x108e98['error'](0x1f4,_0x310df0[_0xce8b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 408e6c8..6114670 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 _0x6cb4=['get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated'];(function(_0x593128,_0x306f40){var _0x5e4c2b=function(_0x4a13f2){while(--_0x4a13f2){_0x593128['push'](_0x593128['shift']());}};_0x5e4c2b(++_0x306f40);}(_0x6cb4,0xff));var _0x46cb=function(_0x4d8b16,_0x354772){_0x4d8b16=_0x4d8b16-0x0;var _0x422fa3=_0x6cb4[_0x4d8b16];return _0x422fa3;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xe')]('/',auth[_0x46cb('0xa')](),controller['create']);router[_0x46cb('0xf')](_0x46cb('0xc'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x11')]('/:id',auth[_0x46cb('0xa')](),controller[_0x46cb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0xe9d46,_0x2424ab){var _0x22648c=function(_0x68c2f7){while(--_0x68c2f7){_0xe9d46['push'](_0xe9d46['shift']());}};_0x22648c(++_0x2424ab);}(_0x5eb8,0xb0));var _0x85eb=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x5eb8[_0x34c4e1];return _0x5a11ef;};'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/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 54e1335..71e7cee 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 _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x2fd235,_0x375933){var _0x14848b=function(_0x14d37d){while(--_0x14d37d){_0x2fd235['push'](_0x2fd235['shift']());}};_0x14848b(++_0x375933);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3c6bfe,_0x170147){_0x3c6bfe=_0x3c6bfe-0x0;var _0x1c7769=_0xcaf2[_0x3c6bfe];return _0x1c7769;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}}; \ No newline at end of file +var _0xef0f=['ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xef0f,0x168));var _0xfef0=function(_0x4afde6,_0x28699a){_0x4afde6=_0x4afde6-0x0;var _0xc959cf=_0xef0f[_0x4afde6];return _0xc959cf;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfef0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfef0('0x2')]},'disposition':{'type':Sequelize[_0xfef0('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfef0('0x3')]},'note':{'type':Sequelize[_0xfef0('0x3')]},'read1stAt':{'type':Sequelize[_0xfef0('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xfef0('0x4')]('in',_0xfef0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfef0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfef0('0x4')]('in',_0xfef0('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xfef0('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f87ddb1..0d69a08 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 _0x65db=['color','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','join','format','transcript-%d-%s.zip','push','Messages','createdAt','get','mkdirSync','Attachment','basename','createReadStream','pipe','resolve','err','unlinkSync','zip-dir','moment','bluebird','path','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','undefined','limit','offset','count','set','json','update','destroy','then','sendStatus','error','stack','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','model','keys','attributes','intersection','fields','length','includeAll','include','options','find','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','filters','hasOwnProperty','order','sort','where','FaxInteractionId','filter','merge','$gte','rows','setTags','Tag'];(function(_0x5b5e81,_0x914652){var _0x6155c6=function(_0xef93ea){while(--_0xef93ea){_0x5b5e81['push'](_0x5b5e81['shift']());}};_0x6155c6(++_0x914652);}(_0x65db,0x199));var _0xb65d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x65db[_0x2a6809];return _0x11c371;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb65d('0x0'));var moment=require(_0xb65d('0x1'));var BPromise=require(_0xb65d('0x2'));var util=require('util');var path=require(_0xb65d('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb65d('0x4'));var qs=require(_0xb65d('0x5'));var logger=require('../../config/logger')(_0xb65d('0x6'));var config=require(_0xb65d('0x7'));var db=require(_0xb65d('0x8'))['db'];config[_0xb65d('0x9')]=_[_0xb65d('0xa')](config['redis'],{'host':_0xb65d('0xb'),'port':0x18eb});var socket=require(_0xb65d('0xc'))(new Redis(config[_0xb65d('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x57e17c,_0x34db33){_0x34db33=_0x34db33||0xcc;return function(_0x3c196f){if(_0x3c196f){return _0x57e17c['sendStatus'](_0x34db33);}return _0x57e17c[_0xb65d('0xd')](_0x34db33)[_0xb65d('0xe')]();};}function respondWithResult(_0x2bb280,_0x16c612){_0x16c612=_0x16c612||0xc8;return function(_0x17195a){if(_0x17195a){return _0x2bb280[_0xb65d('0xd')](_0x16c612)['json'](_0x17195a);}};}function respondWithFilteredResult(_0x4ed3ed,_0x7945b){return function(_0x39c33e){if(_0x39c33e){var _0x4ed005=typeof _0x7945b['offset']===_0xb65d('0xf')&&typeof _0x7945b[_0xb65d('0x10')]===_0xb65d('0xf');var _0x50b276=_0x39c33e['count'];var _0x417083=_0x4ed005?0x0:_0x7945b[_0xb65d('0x11')];var _0x279435=_0x4ed005?_0x39c33e[_0xb65d('0x12')]:_0x7945b[_0xb65d('0x11')]+_0x7945b['limit'];var _0x316163;if(_0x279435>=_0x50b276){_0x279435=_0x50b276;_0x316163=0xc8;}else{_0x316163=0xce;}_0x4ed3ed['status'](_0x316163);return _0x4ed3ed[_0xb65d('0x13')]('Content-Range',_0x417083+'-'+_0x279435+'/'+_0x50b276)[_0xb65d('0x14')](_0x39c33e);}return null;};}function saveUpdates(_0x2b3202){return function(_0x3c9272){if(_0x3c9272){return _0x3c9272[_0xb65d('0x15')](_0x2b3202)['then'](function(_0x28203d){return _0x28203d;});}return null;};}function removeEntity(_0x32cb9b){return function(_0x378748){if(_0x378748){return _0x378748[_0xb65d('0x16')]()[_0xb65d('0x17')](function(){_0x32cb9b['status'](0xcc)[_0xb65d('0xe')]();});}};}function handleEntityNotFound(_0x4af198){return function(_0x4c3bb2){if(!_0x4c3bb2){_0x4af198[_0xb65d('0x18')](0x194);}return _0x4c3bb2;};}function handleError(_0x27cb95,_0x419821){_0x419821=_0x419821||0x1f4;return function(_0x334e84){logger[_0xb65d('0x19')](_0x334e84[_0xb65d('0x1a')]);if(_0x334e84[_0xb65d('0x1b')]){delete _0x334e84[_0xb65d('0x1b')];}_0x27cb95['status'](_0x419821)[_0xb65d('0x1c')](_0x334e84);};}exports['index']=function(_0xa30b35,_0x2b17c1){var _0xc96f19={};var _0x3b246b=_[_0xb65d('0x1d')](db[_0xb65d('0x1e')][_0xb65d('0x1f')],function(_0x2f7a40){return{'name':_0x2f7a40[_0xb65d('0x20')],'type':_0x2f7a40[_0xb65d('0x21')][_0xb65d('0x22')]};});_0xc96f19=qs[_0xb65d('0x23')](_0x3b246b,_0xa30b35);return interaction[_0xb65d('0x24')]('fax',_0xa30b35[_0xb65d('0x25')],_0xa30b35[_0xb65d('0x26')],_0xc96f19,_0x3b246b)[_0xb65d('0x17')](respondWithFilteredResult(_0x2b17c1,_0xc96f19))[_0xb65d('0x27')](handleError(_0x2b17c1,null));};exports['show']=function(_0x4c9ad6,_0x4cedb5){var _0x1e9518={'raw':![],'where':{'id':_0x4c9ad6['params']['id']}},_0xe91f5={};_0xe91f5[_0xb65d('0x28')]=_[_0xb65d('0x29')](db[_0xb65d('0x1e')][_0xb65d('0x1f')]);_0xe91f5[_0xb65d('0x25')]=_[_0xb65d('0x29')](_0x4c9ad6[_0xb65d('0x25')]);_0xe91f5['filters']=_['intersection'](_0xe91f5[_0xb65d('0x28')],_0xe91f5[_0xb65d('0x25')]);_0x1e9518[_0xb65d('0x2a')]=_[_0xb65d('0x2b')](_0xe91f5[_0xb65d('0x28')],qs[_0xb65d('0x2c')](_0x4c9ad6[_0xb65d('0x25')]['fields']));_0x1e9518['attributes']=_0x1e9518['attributes'][_0xb65d('0x2d')]?_0x1e9518[_0xb65d('0x2a')]:_0xe91f5[_0xb65d('0x28')];if(_0x4c9ad6[_0xb65d('0x25')][_0xb65d('0x2e')]){_0x1e9518[_0xb65d('0x2f')]=[{'all':!![]}];}_0x1e9518=_['merge']({},_0x1e9518,_0x4c9ad6[_0xb65d('0x30')]);return db['FaxInteraction'][_0xb65d('0x31')](_0x1e9518)[_0xb65d('0x17')](handleEntityNotFound(_0x4cedb5,null))['then'](respondWithResult(_0x4cedb5,null))[_0xb65d('0x27')](handleError(_0x4cedb5,null));};exports[_0xb65d('0x32')]=function(_0x35b0ea,_0x21d770){return db[_0xb65d('0x1e')][_0xb65d('0x32')](_0x35b0ea['body'],{})['then'](respondWithResult(_0x21d770,0xc9))[_0xb65d('0x27')](handleError(_0x21d770,null));};exports[_0xb65d('0x15')]=function(_0x3ec5f5,_0x2f76d3){if(_0x3ec5f5[_0xb65d('0x33')]['id']){delete _0x3ec5f5[_0xb65d('0x33')]['id'];}return db[_0xb65d('0x1e')]['find']({'where':{'id':_0x3ec5f5[_0xb65d('0x34')]['id']}})[_0xb65d('0x17')](handleEntityNotFound(_0x2f76d3,null))['then'](saveUpdates(_0x3ec5f5[_0xb65d('0x33')],null))['then'](respondWithResult(_0x2f76d3,null))['catch'](handleError(_0x2f76d3,null));};exports[_0xb65d('0x16')]=function(_0x3ec783,_0x27e7b1){return db['FaxInteraction'][_0xb65d('0x31')]({'where':{'id':_0x3ec783[_0xb65d('0x34')]['id']}})['then'](handleEntityNotFound(_0x27e7b1,null))['then'](removeEntity(_0x27e7b1,null))[_0xb65d('0x27')](handleError(_0x27e7b1,null));};exports[_0xb65d('0x35')]=function(_0x5840a5,_0x45d7f5){return db['FaxInteraction'][_0xb65d('0x35')]()['then'](respondWithResult(_0x45d7f5,null))[_0xb65d('0x27')](handleError(_0x45d7f5,null));};exports[_0xb65d('0x36')]=function(_0x59d7bf,_0x50f0c7){return db[_0xb65d('0x37')][_0xb65d('0x31')]({'where':{'id':_0x59d7bf[_0xb65d('0x34')]['id']}})[_0xb65d('0x17')](handleEntityNotFound(_0x50f0c7,null))['then'](function(_0x3f0f5c){if(_0x3f0f5c){return _0x3f0f5c[_0xb65d('0x36')](_0x59d7bf[_0xb65d('0x33')][_0xb65d('0x38')],_[_0xb65d('0x39')](_0x59d7bf[_0xb65d('0x33')],[_0xb65d('0x38'),'id'])||{});}})[_0xb65d('0x17')](respondWithResult(_0x50f0c7,null))[_0xb65d('0x27')](handleError(_0x50f0c7,null));};exports[_0xb65d('0x3a')]=function(_0x5247c6,_0x51d389){var _0x5a9d86={'raw':![],'where':{}};var _0x1790bb={};var _0x57e735={'count':0x0,'rows':[]};return db[_0xb65d('0x1e')]['findOne']({'where':{'id':_0x5247c6[_0xb65d('0x34')]['id']}})[_0xb65d('0x17')](handleEntityNotFound(_0x51d389,null))['then'](function(_0xd1f0da){if(_0xd1f0da){_0x1790bb[_0xb65d('0x28')]=_[_0xb65d('0x29')](db[_0xb65d('0x37')][_0xb65d('0x1f')]);_0x1790bb[_0xb65d('0x25')]=_[_0xb65d('0x29')](_0x5247c6[_0xb65d('0x25')]);_0x1790bb[_0xb65d('0x3b')]=_[_0xb65d('0x2b')](_0x1790bb[_0xb65d('0x28')],_0x1790bb[_0xb65d('0x25')]);_0x5a9d86[_0xb65d('0x2a')]=_[_0xb65d('0x2b')](_0x1790bb[_0xb65d('0x28')],qs[_0xb65d('0x2c')](_0x5247c6['query']['fields']));_0x5a9d86['attributes']=_0x5a9d86[_0xb65d('0x2a')][_0xb65d('0x2d')]?_0x5a9d86['attributes']:_0x1790bb[_0xb65d('0x28')];if(!_0x5247c6[_0xb65d('0x25')][_0xb65d('0x3c')]('nolimit')){_0x5a9d86[_0xb65d('0x10')]=qs[_0xb65d('0x10')](_0x5247c6['query'][_0xb65d('0x10')]);_0x5a9d86['offset']=qs[_0xb65d('0x11')](_0x5247c6[_0xb65d('0x25')][_0xb65d('0x11')]);}_0x5a9d86[_0xb65d('0x3d')]=qs[_0xb65d('0x3e')](_0x5247c6['query'][_0xb65d('0x3e')]);_0x5a9d86['where']=qs[_0xb65d('0x3b')](_['pick'](_0x5247c6[_0xb65d('0x25')],_0x1790bb[_0xb65d('0x3b')]));_0x5a9d86[_0xb65d('0x3f')][_0xb65d('0x40')]=_0xd1f0da['id'];if(_0x5247c6[_0xb65d('0x25')][_0xb65d('0x41')]){_0x5a9d86[_0xb65d('0x3f')]=_[_0xb65d('0x42')](_0x5a9d86[_0xb65d('0x3f')],{'$or':_[_0xb65d('0x1d')](_0x5a9d86[_0xb65d('0x2a')],function(_0x4f2b5b){var _0x370dc1={};_0x370dc1[_0x4f2b5b]={'$like':'%'+_0x5247c6[_0xb65d('0x25')][_0xb65d('0x41')]+'%'};return _0x370dc1;})});}if(_0x5247c6[_0xb65d('0x25')][_0xb65d('0x43')]){var _0x312155=_0x5247c6[_0xb65d('0x25')][_0xb65d('0x43')]['split'](',');var _0x492fa9={};_0x492fa9[_0x312155[0x0]]={'$gte':moment(_0x312155[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5a9d86[_0xb65d('0x3f')]=_[_0xb65d('0x42')](_0x5a9d86['where'],_0x492fa9);}_0x5a9d86=_[_0xb65d('0x42')]({},_0x5a9d86,_0x5247c6[_0xb65d('0x30')]);return db[_0xb65d('0x37')]['count']({'where':_0x5a9d86[_0xb65d('0x3f')]})[_0xb65d('0x17')](function(_0x73c935){_0x57e735[_0xb65d('0x12')]=_0x73c935;if(_0x5247c6[_0xb65d('0x25')][_0xb65d('0x2e')]){_0x5a9d86[_0xb65d('0x2f')]=[{'all':!![]}];}return db[_0xb65d('0x37')][_0xb65d('0x24')](_0x5a9d86);})[_0xb65d('0x17')](function(_0x5a3063){_0x57e735[_0xb65d('0x44')]=_0x5a3063;return _0x57e735;});}})[_0xb65d('0x17')](respondWithFilteredResult(_0x51d389,_0x5a9d86))[_0xb65d('0x27')](handleError(_0x51d389,null));};exports['addTags']=function(_0x11089d,_0x8951dd){return db['FaxInteraction']['find']({'where':{'id':_0x11089d[_0xb65d('0x34')]['id']}})[_0xb65d('0x17')](handleEntityNotFound(_0x8951dd,null))['then'](function(_0x77d28c){if(_0x77d28c){return _0x77d28c[_0xb65d('0x45')](_0x11089d['body'][_0xb65d('0x38')],_[_0xb65d('0x39')](_0x11089d[_0xb65d('0x33')],[_0xb65d('0x38'),'id'])||{})['spread'](function(){return db[_0xb65d('0x46')][_0xb65d('0x24')]({'attributes':['id',_0xb65d('0x1b'),_0xb65d('0x47')],'where':{'id':_0x11089d[_0xb65d('0x33')][_0xb65d('0x38')]}});})[_0xb65d('0x17')](function(_0x2e9f4e){socket['emit'](_0xb65d('0x48'),{'id':Number(_0x11089d[_0xb65d('0x34')]['id']),'tags':_0x2e9f4e||[]});return{'id':Number(_0x11089d[_0xb65d('0x34')]['id']),'tags':_0x2e9f4e||[]};});}})[_0xb65d('0x17')](respondWithResult(_0x8951dd,null))[_0xb65d('0x27')](handleError(_0x8951dd,null));};exports[_0xb65d('0x49')]=function(_0x52134f,_0x267fc4){return db[_0xb65d('0x1e')][_0xb65d('0x31')]({'where':{'id':_0x52134f[_0xb65d('0x34')]['id']}})[_0xb65d('0x17')](handleEntityNotFound(_0x267fc4,null))[_0xb65d('0x17')](function(_0x2a195a){if(_0x2a195a){return _0x2a195a[_0xb65d('0x49')](_0x52134f[_0xb65d('0x25')]['ids']);}})[_0xb65d('0x17')](respondWithStatusCode(_0x267fc4,null))[_0xb65d('0x27')](handleError(_0x267fc4,null));};exports[_0xb65d('0x4a')]=function(_0x5e6441,_0x878b78){var _0x2528ab=moment()[_0xb65d('0x4b')]()['toString']();var _0x402d15=path['join'](config[_0xb65d('0x4c')],'server',_0xb65d('0x4d'),_0xb65d('0x4e'));var _0x1cacd1=path['join'](config['root'],_0xb65d('0x4f'),_0xb65d('0x4d'),_0xb65d('0x50'));var _0x2dc40e=path[_0xb65d('0x51')](_0x402d15,_0x2528ab);var _0x3e5d4a=util[_0xb65d('0x52')](_0xb65d('0x53'),_0x5e6441['params']['id'],_0x2528ab);var _0xf0196d=path[_0xb65d('0x51')](_0x402d15,_0x3e5d4a);var _0x169344=[];_0x169344[_0xb65d('0x54')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x3cdc24=[{'model':db[_0xb65d('0x37')],'as':_0xb65d('0x55'),'attributes':['id',_0xb65d('0x33'),_0xb65d('0x56')],'include':_0x169344}];return db[_0xb65d('0x1e')][_0xb65d('0x31')]({'where':{'id':_0x5e6441['params']['id']},'include':_0x3cdc24})[_0xb65d('0x17')](handleEntityNotFound(_0x878b78,null))[_0xb65d('0x17')](function(_0x42bcc2){if(_0x42bcc2&&_0x42bcc2[_0xb65d('0x55')]){var _0x12b40f=_0x42bcc2[_0xb65d('0x57')]({'plain':!![]});fs[_0xb65d('0x58')](_0x2dc40e);for(var _0x180b18=0x0;_0x180b18<_0x12b40f[_0xb65d('0x55')][_0xb65d('0x2d')];_0x180b18++){var _0x5e8616=_0x12b40f[_0xb65d('0x55')][_0x180b18][_0xb65d('0x59')];if(_0x5e8616){var _0x21601e=path[_0xb65d('0x51')](_0x1cacd1,_0x5e8616[_0xb65d('0x5a')]);if(fs['existsSync'](_0x21601e)){fs[_0xb65d('0x5b')](_0x21601e)[_0xb65d('0x5c')](fs['createWriteStream'](path['join'](_0x2dc40e,_0x5e8616['basename'])));}}}return BPromise[_0xb65d('0x5d')]()['then'](function(){return new BPromise(function(_0x558a2f,_0xdb0512){zipdir(_0x2dc40e,{'saveTo':_0xf0196d},function(_0x47aa2b,_0xac75ea){if(_0x47aa2b)return _0xdb0512(_0x47aa2b);return _0x558a2f(_0xac75ea);});})['then'](function(){return new BPromise(function(_0x319c9b,_0x37f157){rimraf(_0x2dc40e,function(_0x3578b0){if(_0x3578b0)_0x37f157(_0x3578b0);return _0x319c9b();});});})['then'](function(){return _0x878b78[_0xb65d('0x4a')](_0xf0196d,_0x3e5d4a,function(_0x3ec717){if(_0x3ec717){console['log'](_0xb65d('0x5e'),_0x3ec717);}else{fs[_0xb65d('0x5f')](_0xf0196d);}});});});}else{return _0x878b78[_0xb65d('0x18')](0xc8);}})[_0xb65d('0x27')](handleError(_0x878b78,null));}; \ No newline at end of file +var _0x63c4=['download','toString','root','server','files','tmp','attachments','join','push','Attachment','createdAt','get','mkdirSync','Messages','basename','createReadStream','pipe','createWriteStream','resolve','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','error','stack','name','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','query','user','then','show','params','keys','filters','intersection','model','attributes','fields','includeAll','include','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save'];(function(_0x2bf947,_0x1cbfe4){var _0x146738=function(_0x2cd6c9){while(--_0x2cd6c9){_0x2bf947['push'](_0x2bf947['shift']());}};_0x146738(++_0x1cbfe4);}(_0x63c4,0x76));var _0x463c=function(_0x1f22a0,_0x548697){_0x1f22a0=_0x1f22a0-0x0;var _0xa640d7=_0x63c4[_0x1f22a0];return _0xa640d7;};'use strict';var rimraf=require(_0x463c('0x0'));var zipdir=require(_0x463c('0x1'));var moment=require(_0x463c('0x2'));var BPromise=require(_0x463c('0x3'));var util=require(_0x463c('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x463c('0x5'));var Redis=require('ioredis');var interaction=require(_0x463c('0x6'));var qs=require(_0x463c('0x7'));var logger=require(_0x463c('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x463c('0x9')]=_['defaults'](config[_0x463c('0x9')],{'host':_0x463c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463c('0x9')]));require(_0x463c('0xb'))[_0x463c('0xc')](socket);function respondWithStatusCode(_0x39e280,_0xbe90ec){_0xbe90ec=_0xbe90ec||0xcc;return function(_0x4d1fee){if(_0x4d1fee){return _0x39e280[_0x463c('0xd')](_0xbe90ec);}return _0x39e280[_0x463c('0xe')](_0xbe90ec)[_0x463c('0xf')]();};}function respondWithResult(_0x56b1d8,_0x7173f9){_0x7173f9=_0x7173f9||0xc8;return function(_0x380541){if(_0x380541){return _0x56b1d8[_0x463c('0xe')](_0x7173f9)[_0x463c('0x10')](_0x380541);}};}function respondWithFilteredResult(_0x55c3bb,_0x28191b){return function(_0xf5975b){if(_0xf5975b){var _0x61ccca=typeof _0x28191b[_0x463c('0x11')]===_0x463c('0x12')&&typeof _0x28191b[_0x463c('0x13')]===_0x463c('0x12');var _0x5d5fa1=_0xf5975b['count'];var _0x411dc6=_0x61ccca?0x0:_0x28191b[_0x463c('0x11')];var _0x21d5c2=_0x61ccca?_0xf5975b[_0x463c('0x14')]:_0x28191b[_0x463c('0x11')]+_0x28191b[_0x463c('0x13')];var _0x18da07;if(_0x21d5c2>=_0x5d5fa1){_0x21d5c2=_0x5d5fa1;_0x18da07=0xc8;}else{_0x18da07=0xce;}_0x55c3bb[_0x463c('0xe')](_0x18da07);return _0x55c3bb['set'](_0x463c('0x15'),_0x411dc6+'-'+_0x21d5c2+'/'+_0x5d5fa1)[_0x463c('0x10')](_0xf5975b);}return null;};}function saveUpdates(_0x5d590a){return function(_0x35a615){if(_0x35a615){return _0x35a615[_0x463c('0x16')](_0x5d590a)['then'](function(_0x460650){return _0x460650;});}return null;};}function removeEntity(_0x565536){return function(_0x86141a){if(_0x86141a){return _0x86141a[_0x463c('0x17')]()['then'](function(){_0x565536[_0x463c('0xe')](0xcc)[_0x463c('0xf')]();});}};}function handleEntityNotFound(_0x2361f8){return function(_0x62cc2d){if(!_0x62cc2d){_0x2361f8[_0x463c('0xd')](0x194);}return _0x62cc2d;};}function handleError(_0x1e0385,_0x659a48){_0x659a48=_0x659a48||0x1f4;return function(_0x4639a7){logger[_0x463c('0x18')](_0x4639a7[_0x463c('0x19')]);if(_0x4639a7[_0x463c('0x1a')]){delete _0x4639a7['name'];}_0x1e0385[_0x463c('0xe')](_0x659a48)['send'](_0x4639a7);};}exports['index']=function(_0x3c73e4,_0x2e27ca){var _0x80f730={};var _0x51eae7=_[_0x463c('0x1b')](db[_0x463c('0x1c')][_0x463c('0x1d')],function(_0x42ac83){return{'name':_0x42ac83[_0x463c('0x1e')],'type':_0x42ac83[_0x463c('0x1f')][_0x463c('0x20')]};});_0x80f730=qs['getOptions'](_0x51eae7,_0x3c73e4);return interaction[_0x463c('0x21')](_0x463c('0x22'),_0x3c73e4[_0x463c('0x23')],_0x3c73e4[_0x463c('0x24')],_0x80f730,_0x51eae7)[_0x463c('0x25')](respondWithFilteredResult(_0x2e27ca,_0x80f730))['catch'](handleError(_0x2e27ca,null));};exports[_0x463c('0x26')]=function(_0x5b57a4,_0x1894ef){var _0x393a61={'raw':![],'where':{'id':_0x5b57a4[_0x463c('0x27')]['id']}},_0x3ee1f9={};_0x3ee1f9['model']=_[_0x463c('0x28')](db['FaxInteraction'][_0x463c('0x1d')]);_0x3ee1f9[_0x463c('0x23')]=_[_0x463c('0x28')](_0x5b57a4[_0x463c('0x23')]);_0x3ee1f9[_0x463c('0x29')]=_[_0x463c('0x2a')](_0x3ee1f9[_0x463c('0x2b')],_0x3ee1f9[_0x463c('0x23')]);_0x393a61[_0x463c('0x2c')]=_[_0x463c('0x2a')](_0x3ee1f9[_0x463c('0x2b')],qs[_0x463c('0x2d')](_0x5b57a4[_0x463c('0x23')]['fields']));_0x393a61[_0x463c('0x2c')]=_0x393a61[_0x463c('0x2c')]['length']?_0x393a61[_0x463c('0x2c')]:_0x3ee1f9[_0x463c('0x2b')];if(_0x5b57a4[_0x463c('0x23')][_0x463c('0x2e')]){_0x393a61[_0x463c('0x2f')]=[{'all':!![]}];}_0x393a61=_['merge']({},_0x393a61,_0x5b57a4[_0x463c('0x30')]);return db[_0x463c('0x1c')][_0x463c('0x31')](_0x393a61)[_0x463c('0x25')](handleEntityNotFound(_0x1894ef,null))[_0x463c('0x25')](respondWithResult(_0x1894ef,null))[_0x463c('0x32')](handleError(_0x1894ef,null));};exports[_0x463c('0x33')]=function(_0x2d4782,_0x4531dd){return db[_0x463c('0x1c')][_0x463c('0x33')](_0x2d4782[_0x463c('0x34')],{})[_0x463c('0x25')](respondWithResult(_0x4531dd,0xc9))[_0x463c('0x32')](handleError(_0x4531dd,null));};exports[_0x463c('0x16')]=function(_0x440608,_0x3fb858){if(_0x440608[_0x463c('0x34')]['id']){delete _0x440608['body']['id'];}return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x440608['params']['id']}})['then'](handleEntityNotFound(_0x3fb858,null))['then'](saveUpdates(_0x440608[_0x463c('0x34')],null))[_0x463c('0x25')](respondWithResult(_0x3fb858,null))[_0x463c('0x32')](handleError(_0x3fb858,null));};exports[_0x463c('0x17')]=function(_0x2e2bee,_0x19569f){return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x2e2bee[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x19569f,null))[_0x463c('0x25')](removeEntity(_0x19569f,null))[_0x463c('0x32')](handleError(_0x19569f,null));};exports[_0x463c('0x35')]=function(_0x35cf8e,_0x2842b7){return db[_0x463c('0x1c')][_0x463c('0x35')]()['then'](respondWithResult(_0x2842b7,null))[_0x463c('0x32')](handleError(_0x2842b7,null));};exports[_0x463c('0x36')]=function(_0x559bb1,_0x481b13){return db['FaxMessage']['find']({'where':{'id':_0x559bb1[_0x463c('0x27')]['id']}})['then'](handleEntityNotFound(_0x481b13,null))[_0x463c('0x25')](function(_0x2fc7ce){if(_0x2fc7ce){return _0x2fc7ce['addMessage'](_0x559bb1[_0x463c('0x34')][_0x463c('0x37')],_[_0x463c('0x38')](_0x559bb1[_0x463c('0x34')],[_0x463c('0x37'),'id'])||{});}})[_0x463c('0x25')](respondWithResult(_0x481b13,null))[_0x463c('0x32')](handleError(_0x481b13,null));};exports[_0x463c('0x39')]=function(_0x45dae1,_0x27b609){var _0x2b9cbb={'raw':![],'where':{}};var _0x8e3b48={};var _0xb9ed66={'count':0x0,'rows':[]};return db[_0x463c('0x1c')]['findOne']({'where':{'id':_0x45dae1['params']['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x27b609,null))[_0x463c('0x25')](function(_0x5020d2){if(_0x5020d2){_0x8e3b48['model']=_[_0x463c('0x28')](db['FaxMessage'][_0x463c('0x1d')]);_0x8e3b48[_0x463c('0x23')]=_[_0x463c('0x28')](_0x45dae1[_0x463c('0x23')]);_0x8e3b48[_0x463c('0x29')]=_['intersection'](_0x8e3b48['model'],_0x8e3b48[_0x463c('0x23')]);_0x2b9cbb[_0x463c('0x2c')]=_[_0x463c('0x2a')](_0x8e3b48[_0x463c('0x2b')],qs[_0x463c('0x2d')](_0x45dae1['query'][_0x463c('0x2d')]));_0x2b9cbb[_0x463c('0x2c')]=_0x2b9cbb[_0x463c('0x2c')][_0x463c('0x3a')]?_0x2b9cbb[_0x463c('0x2c')]:_0x8e3b48[_0x463c('0x2b')];if(!_0x45dae1[_0x463c('0x23')][_0x463c('0x3b')](_0x463c('0x3c'))){_0x2b9cbb[_0x463c('0x13')]=qs[_0x463c('0x13')](_0x45dae1[_0x463c('0x23')][_0x463c('0x13')]);_0x2b9cbb['offset']=qs[_0x463c('0x11')](_0x45dae1[_0x463c('0x23')]['offset']);}_0x2b9cbb['order']=qs['sort'](_0x45dae1[_0x463c('0x23')][_0x463c('0x3d')]);_0x2b9cbb[_0x463c('0x3e')]=qs['filters'](_[_0x463c('0x3f')](_0x45dae1[_0x463c('0x23')],_0x8e3b48['filters']));_0x2b9cbb[_0x463c('0x3e')]['FaxInteractionId']=_0x5020d2['id'];if(_0x45dae1[_0x463c('0x23')][_0x463c('0x40')]){_0x2b9cbb[_0x463c('0x3e')]=_[_0x463c('0x41')](_0x2b9cbb[_0x463c('0x3e')],{'$or':_[_0x463c('0x1b')](_0x2b9cbb[_0x463c('0x2c')],function(_0x5349bd){var _0x1dc8cd={};_0x1dc8cd[_0x5349bd]={'$like':'%'+_0x45dae1[_0x463c('0x23')][_0x463c('0x40')]+'%'};return _0x1dc8cd;})});}if(_0x45dae1['query'][_0x463c('0x42')]){var _0x1e2834=_0x45dae1['query'][_0x463c('0x42')]['split'](',');var _0xb5fe7f={};_0xb5fe7f[_0x1e2834[0x0]]={'$gte':moment(_0x1e2834[0x1])[_0x463c('0x43')](_0x463c('0x44'))};_0x2b9cbb['where']=_[_0x463c('0x41')](_0x2b9cbb[_0x463c('0x3e')],_0xb5fe7f);}_0x2b9cbb=_[_0x463c('0x41')]({},_0x2b9cbb,_0x45dae1['options']);return db[_0x463c('0x45')]['count']({'where':_0x2b9cbb['where']})[_0x463c('0x25')](function(_0x27a58d){_0xb9ed66['count']=_0x27a58d;if(_0x45dae1[_0x463c('0x23')]['includeAll']){_0x2b9cbb[_0x463c('0x2f')]=[{'all':!![]}];}return db[_0x463c('0x45')][_0x463c('0x21')](_0x2b9cbb);})[_0x463c('0x25')](function(_0x1e9deb){_0xb9ed66[_0x463c('0x46')]=_0x1e9deb;return _0xb9ed66;});}})[_0x463c('0x25')](respondWithFilteredResult(_0x27b609,_0x2b9cbb))[_0x463c('0x32')](handleError(_0x27b609,null));};exports[_0x463c('0x47')]=function(_0x14e5c7,_0x3e66c5){return db['FaxInteraction'][_0x463c('0x31')]({'where':{'id':_0x14e5c7[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x3e66c5,null))[_0x463c('0x25')](function(_0xc81f66){if(_0xc81f66){return _0xc81f66[_0x463c('0x48')](_0x14e5c7[_0x463c('0x34')]['ids'],_[_0x463c('0x38')](_0x14e5c7[_0x463c('0x34')],['ids','id'])||{})[_0x463c('0x49')](function(){return db[_0x463c('0x4a')][_0x463c('0x21')]({'attributes':['id','name',_0x463c('0x4b')],'where':{'id':_0x14e5c7['body'][_0x463c('0x37')]}});})['then'](function(_0x10fead){socket[_0x463c('0x4c')](_0x463c('0x4d'),{'id':Number(_0x14e5c7['params']['id']),'tags':_0x10fead||[]});return{'id':Number(_0x14e5c7[_0x463c('0x27')]['id']),'tags':_0x10fead||[]};});}})[_0x463c('0x25')](respondWithResult(_0x3e66c5,null))[_0x463c('0x32')](handleError(_0x3e66c5,null));};exports['removeTags']=function(_0x133aae,_0x30b274){return db['FaxInteraction'][_0x463c('0x31')]({'where':{'id':_0x133aae[_0x463c('0x27')]['id']}})[_0x463c('0x25')](handleEntityNotFound(_0x30b274,null))[_0x463c('0x25')](function(_0x33825f){if(_0x33825f){return _0x33825f['removeTags'](_0x133aae[_0x463c('0x23')]['ids']);}})['then'](respondWithStatusCode(_0x30b274,null))[_0x463c('0x32')](handleError(_0x30b274,null));};exports[_0x463c('0x4e')]=function(_0x482d9b,_0x2e88dc){var _0xfcfa22=moment()['unix']()[_0x463c('0x4f')]();var _0x391f5b=path['join'](config[_0x463c('0x50')],_0x463c('0x51'),_0x463c('0x52'),_0x463c('0x53'));var _0x1729a7=path['join'](config[_0x463c('0x50')],_0x463c('0x51'),_0x463c('0x52'),_0x463c('0x54'));var _0x57f023=path[_0x463c('0x55')](_0x391f5b,_0xfcfa22);var _0xb4de34=util[_0x463c('0x43')]('transcript-%d-%s.zip',_0x482d9b[_0x463c('0x27')]['id'],_0xfcfa22);var _0x5bb7b4=path['join'](_0x391f5b,_0xb4de34);var _0x21abb3=[];_0x21abb3[_0x463c('0x56')]({'model':db[_0x463c('0x57')],'as':_0x463c('0x57'),'raw':!![]});var _0x2e1266=[{'model':db[_0x463c('0x45')],'as':'Messages','attributes':['id',_0x463c('0x34'),_0x463c('0x58')],'include':_0x21abb3}];return db[_0x463c('0x1c')][_0x463c('0x31')]({'where':{'id':_0x482d9b[_0x463c('0x27')]['id']},'include':_0x2e1266})[_0x463c('0x25')](handleEntityNotFound(_0x2e88dc,null))[_0x463c('0x25')](function(_0x52bac5){if(_0x52bac5&&_0x52bac5['Messages']){var _0x3b673c=_0x52bac5[_0x463c('0x59')]({'plain':!![]});fs[_0x463c('0x5a')](_0x57f023);for(var _0x390d81=0x0;_0x390d81<_0x3b673c[_0x463c('0x5b')]['length'];_0x390d81++){var _0x52dab3=_0x3b673c['Messages'][_0x390d81][_0x463c('0x57')];if(_0x52dab3){var _0x20c0b5=path[_0x463c('0x55')](_0x1729a7,_0x52dab3[_0x463c('0x5c')]);if(fs['existsSync'](_0x20c0b5)){fs[_0x463c('0x5d')](_0x20c0b5)[_0x463c('0x5e')](fs[_0x463c('0x5f')](path[_0x463c('0x55')](_0x57f023,_0x52dab3[_0x463c('0x5c')])));}}}return BPromise[_0x463c('0x60')]()[_0x463c('0x25')](function(){return new BPromise(function(_0x275475,_0x230270){zipdir(_0x57f023,{'saveTo':_0x5bb7b4},function(_0x4ff803,_0x3c795c){if(_0x4ff803)return _0x230270(_0x4ff803);return _0x275475(_0x3c795c);});})[_0x463c('0x25')](function(){return new BPromise(function(_0x228878,_0x472132){rimraf(_0x57f023,function(_0x11708d){if(_0x11708d)_0x472132(_0x11708d);return _0x228878();});});})[_0x463c('0x25')](function(){return _0x2e88dc[_0x463c('0x4e')](_0x5bb7b4,_0xb4de34,function(_0x3608cc){if(_0x3608cc){console['log']('err',_0x3608cc);}else{fs[_0x463c('0x61')](_0x5bb7b4);}});});});}else{return _0x2e88dc[_0x463c('0xd')](0xc8);}})['catch'](handleError(_0x2e88dc,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 531b123..c756e55 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 _0x2862=['Users','map','findAll','then','unreadMessages','emit','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x3eea90,_0x22a3f7){var _0x19e6d5=function(_0x59852e){while(--_0x59852e){_0x3eea90['push'](_0x3eea90['shift']());}};_0x19e6d5(++_0x22a3f7);}(_0x2862,0x1ef));var _0x2286=function(_0x2bee7d,_0xf1e11e){_0x2bee7d=_0x2bee7d-0x0;var _0x487a9a=_0x2862[_0x2bee7d];return _0x487a9a;};'use strict';var EventEmitter=require(_0x2286('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x2286('0x1')];var FaxMessage=require(_0x2286('0x2'))['db'][_0x2286('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2286('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2286('0x5'),'afterDestroy':_0x2286('0x6')};function emitEvent(_0x4aad23){return function(_0x4d1b83,_0x320fc2,_0xca5016){_0x4d1b83[_0x2286('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1b1def){_0x4d1b83[_0x2286('0x8')](_0x2286('0x9'),_0x1b1def[_0x2286('0xa')](function(_0x4c0cab){return{'id':_0x4c0cab['id']};}));return FaxMessage[_0x2286('0xb')]({'where':{'FaxInteractionId':_0x4d1b83['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2286('0xc')](function(_0x125e85){_0x4d1b83[_0x2286('0x8')](_0x2286('0xd'),_0x125e85['length']);FaxInteractionEvents[_0x2286('0xe')](_0x4aad23+':'+_0x4d1b83['id'],_0x4d1b83);FaxInteractionEvents[_0x2286('0xe')](_0x4aad23,_0x4d1b83);_0xca5016(null);})['catch'](_0xca5016(null));};}for(var e in events){if(events[_0x2286('0xf')](e)){var event=events[e];FaxInteraction[_0x2286('0x10')](e,emitEvent(event));}}module[_0x2286('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x20c3=['unreadMessages','length','emit','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x4af0fc,_0x442dc4){var _0x44928c=function(_0x4ef937){while(--_0x4ef937){_0x4af0fc['push'](_0x4af0fc['shift']());}};_0x44928c(++_0x442dc4);}(_0x20c3,0x137));var _0x320c=function(_0x12c777,_0x5dfefb){_0x12c777=_0x12c777-0x0;var _0x38855f=_0x20c3[_0x12c777];return _0x38855f;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x320c('0x0'))['db'][_0x320c('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x320c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x320c('0x3'),'afterUpdate':_0x320c('0x4'),'afterDestroy':_0x320c('0x5')};function emitEvent(_0x4dc889){return function(_0xcc93d8,_0x726586,_0x24a66d){_0xcc93d8[_0x320c('0x6')]({'attributes':['id'],'raw':!![]})[_0x320c('0x7')](function(_0x1702d2){_0xcc93d8[_0x320c('0x8')](_0x320c('0x9'),_0x1702d2[_0x320c('0xa')](function(_0x5bd3b8){return{'id':_0x5bd3b8['id']};}));return FaxMessage[_0x320c('0xb')]({'where':{'FaxInteractionId':_0xcc93d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x320c('0x7')](function(_0x1db9a8){_0xcc93d8[_0x320c('0x8')](_0x320c('0xc'),_0x1db9a8[_0x320c('0xd')]);FaxInteractionEvents[_0x320c('0xe')](_0x4dc889+':'+_0xcc93d8['id'],_0xcc93d8);FaxInteractionEvents[_0x320c('0xe')](_0x4dc889,_0xcc93d8);_0x24a66d(null);})['catch'](_0x24a66d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x320c('0xf')](e,emitEvent(event));}}module[_0x320c('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 76c7f62..b6b396b 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 _0x594e=['request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x594e,0x11e));var _0xe594=function(_0x50863b,_0x363f9f){_0x50863b=_0x50863b-0x0;var _0x262dab=_0x594e[_0x50863b];return _0x262dab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe594('0x0'))('api');var moment=require(_0xe594('0x1'));var BPromise=require('bluebird');var rp=require(_0xe594('0x2'));var fs=require('fs');var path=require(_0xe594('0x3'));var rimraf=require(_0xe594('0x4'));var config=require(_0xe594('0x5'));var attributes=require('./faxInteraction.attributes');module[_0xe594('0x6')]=function(_0x48c301,_0x4b17bb){return _0x48c301[_0xe594('0x7')](_0xe594('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x198d88,_0x5179e2,_0x2cd530){if(_0x198d88['changed'](_0xe594('0x9'))){_0x198d88[_0xe594('0xa')]=moment()['format'](_0xe594('0xb'));}_0x2cd530(null,_0x198d88);}}});}; \ No newline at end of file +var _0x2c49=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format'];(function(_0x39c999,_0x1968b8){var _0x2044f=function(_0x5dc77b){while(--_0x5dc77b){_0x39c999['push'](_0x39c999['shift']());}};_0x2044f(++_0x1968b8);}(_0x2c49,0xc3));var _0x92c4=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x2c49[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x92c4('0x0'));var util=require(_0x92c4('0x1'));var logger=require(_0x92c4('0x2'))(_0x92c4('0x3'));var moment=require(_0x92c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x92c4('0x5'));var fs=require('fs');var path=require(_0x92c4('0x6'));var rimraf=require('rimraf');var config=require(_0x92c4('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x92c4('0x8')]=function(_0x2ec56a,_0x356a2e){return _0x2ec56a[_0x92c4('0x9')](_0x92c4('0xa'),attributes,{'tableName':_0x92c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1de6b9,_0x171906,_0x58c098){if(_0x1de6b9['changed'](_0x92c4('0xc'))){_0x1de6b9[_0x92c4('0xd')]=moment()[_0x92c4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x58c098(null,_0x1de6b9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fd367e0..0d261e8 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 _0x942f=['request','then','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','update','options','raw','where','attributes','limit','UpdateFaxInteraction','debug','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x1a0fad,_0x20321c){var _0x3bc8a4=function(_0x2f72c8){while(--_0x2f72c8){_0x1a0fad['push'](_0x1a0fad['shift']());}};_0x3bc8a4(++_0x20321c);}(_0x942f,0xbb));var _0xf942=function(_0x50b7ec,_0x31fc03){_0x50b7ec=_0x50b7ec-0x0;var _0x5d7d3a=_0x942f[_0x50b7ec];return _0x5d7d3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf942('0x0'));var BPromise=require(_0xf942('0x1'));var rs=require(_0xf942('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf942('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf942('0x4'))(_0xf942('0x5'));var config=require('../../config/environment');var jayson=require(_0xf942('0x6'));var client=jayson[_0xf942('0x7')][_0xf942('0x8')]({'port':0x232a});config[_0xf942('0x9')]=_['defaults'](config[_0xf942('0x9')],{'host':_0xf942('0xa'),'port':0x18eb});var socket=require(_0xf942('0xb'))(new Redis(config[_0xf942('0x9')]));require('./faxInteraction.socket')[_0xf942('0xc')](socket);function respondWithRpcPromise(_0x1e088a,_0x210627,_0x4ef756){return new BPromise(function(_0x24ae4a,_0x2bb126){return client[_0xf942('0xd')](_0x1e088a,_0x4ef756)[_0xf942('0xe')](function(_0x395b3e){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x210627,'request\x20sent');logger['debug'](_0xf942('0xf'),_0x210627,_0xf942('0x10'),JSON[_0xf942('0x11')](_0x395b3e));if(_0x395b3e[_0xf942('0x12')]){if(_0x395b3e[_0xf942('0x12')][_0xf942('0x13')]===0x1f4){logger[_0xf942('0x12')](_0xf942('0x14'),_0x210627,_0x395b3e[_0xf942('0x12')][_0xf942('0x15')]);return _0x2bb126(_0x395b3e[_0xf942('0x12')][_0xf942('0x15')]);}logger[_0xf942('0x12')](_0xf942('0x14'),_0x210627,_0x395b3e[_0xf942('0x12')][_0xf942('0x15')]);return _0x24ae4a(_0x395b3e[_0xf942('0x12')]['message']);}else{logger[_0xf942('0x16')](_0xf942('0x14'),_0x210627,_0xf942('0x10'));_0x24ae4a(_0x395b3e['result'][_0xf942('0x15')]);}})['catch'](function(_0x1c18da){logger[_0xf942('0x12')](_0xf942('0x14'),_0x210627,_0x1c18da);_0x2bb126(_0x1c18da);});});}exports['UpdateFaxInteraction']=function(_0x5110cb){var _0x526767=this;return new Promise(function(_0x4d1146,_0x112b8b){return db['FaxInteraction'][_0xf942('0x17')](_0x5110cb['body'],{'raw':_0x5110cb[_0xf942('0x18')]?_0x5110cb[_0xf942('0x18')][_0xf942('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5110cb[_0xf942('0x18')]?_0x5110cb['options'][_0xf942('0x1a')]||null:null,'attributes':_0x5110cb['options']?_0x5110cb[_0xf942('0x18')][_0xf942('0x1b')]||null:null,'limit':_0x5110cb[_0xf942('0x18')]?_0x5110cb[_0xf942('0x18')][_0xf942('0x1c')]||null:null})[_0xf942('0xe')](function(_0x5af1a4){logger[_0xf942('0x16')](_0xf942('0x1d'),_0x5110cb);logger[_0xf942('0x1e')](_0xf942('0x1d'),_0x5110cb,JSON[_0xf942('0x11')](_0x5af1a4));_0x4d1146(_0x5af1a4);})[_0xf942('0x1f')](function(_0x54c85c){logger[_0xf942('0x12')](_0xf942('0x1d'),_0x54c85c[_0xf942('0x15')],_0x5110cb);_0x112b8b(_0x526767[_0xf942('0x12')](0x1f4,_0x54c85c[_0xf942('0x15')]));});});};exports[_0xf942('0x20')]=function(_0x3edcaa){return new Promise(function(_0xff16ca,_0x5aeeaa){return db[_0xf942('0x21')][_0xf942('0x22')]({'where':_0x3edcaa[_0xf942('0x18')]?_0x3edcaa[_0xf942('0x18')][_0xf942('0x1a')]||null:null})[_0xf942('0xe')](function(_0x171026){if(_0x171026){return _0x171026[_0xf942('0x23')](_0x3edcaa[_0xf942('0x24')][_0xf942('0x25')],_['omit'](_0x3edcaa[_0xf942('0x24')],[_0xf942('0x25'),'id'])||{});}})[_0xf942('0x26')](function(_0x2daf8c){logger[_0xf942('0x16')]('AddTags',_0x3edcaa);logger[_0xf942('0x1e')]('AddTags',_0x3edcaa,JSON['stringify'](_0x2daf8c));_0xff16ca(_0x2daf8c);})[_0xf942('0x1f')](function(_0x554c34){logger['error'](_0xf942('0x27'),_0x554c34[_0xf942('0x15')],_0x3edcaa);_0x5aeeaa(_this[_0xf942('0x12')](0x1f4,_0x554c34['message']));});});}; \ No newline at end of file +var _0x9746=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','ids','spread','AddTags','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9746,0x74));var _0x6974=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9746[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x6974('0x0'));var moment=require(_0x6974('0x1'));var BPromise=require(_0x6974('0x2'));var rs=require(_0x6974('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6974('0x4'))(_0x6974('0x5'));var config=require(_0x6974('0x6'));var jayson=require(_0x6974('0x7'));var client=jayson[_0x6974('0x8')]['http']({'port':0x232a});config[_0x6974('0x9')]=_['defaults'](config[_0x6974('0x9')],{'host':_0x6974('0xa'),'port':0x18eb});var socket=require(_0x6974('0xb'))(new Redis(config['redis']));require(_0x6974('0xc'))[_0x6974('0xd')](socket);function respondWithRpcPromise(_0x5b7992,_0x28b9cb,_0x3010eb){return new BPromise(function(_0x226fd3,_0x4fc313){return client[_0x6974('0xe')](_0x5b7992,_0x3010eb)[_0x6974('0xf')](function(_0x270c9e){logger[_0x6974('0x10')](_0x6974('0x11'),_0x28b9cb,'request\x20sent');logger[_0x6974('0x12')](_0x6974('0x13'),_0x28b9cb,'request\x20sent',JSON['stringify'](_0x270c9e));if(_0x270c9e['error']){if(_0x270c9e[_0x6974('0x14')][_0x6974('0x15')]===0x1f4){logger[_0x6974('0x14')](_0x6974('0x11'),_0x28b9cb,_0x270c9e['error']['message']);return _0x4fc313(_0x270c9e[_0x6974('0x14')][_0x6974('0x16')]);}logger['error'](_0x6974('0x11'),_0x28b9cb,_0x270c9e[_0x6974('0x14')]['message']);return _0x226fd3(_0x270c9e['error'][_0x6974('0x16')]);}else{logger[_0x6974('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x28b9cb,_0x6974('0x17'));_0x226fd3(_0x270c9e[_0x6974('0x18')][_0x6974('0x16')]);}})[_0x6974('0x19')](function(_0x494b62){logger[_0x6974('0x14')](_0x6974('0x11'),_0x28b9cb,_0x494b62);_0x4fc313(_0x494b62);});});}exports[_0x6974('0x1a')]=function(_0x2eea0e){var _0x4fdd7c=this;return new Promise(function(_0x3c65fe,_0x5f0a51){return db[_0x6974('0x1b')]['update'](_0x2eea0e[_0x6974('0x1c')],{'raw':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x1f')]||null:null,'attributes':_0x2eea0e[_0x6974('0x1d')]?_0x2eea0e['options']['attributes']||null:null,'limit':_0x2eea0e['options']?_0x2eea0e[_0x6974('0x1d')][_0x6974('0x20')]||null:null})[_0x6974('0xf')](function(_0x97eec){logger[_0x6974('0x10')](_0x6974('0x1a'),_0x2eea0e);logger['debug']('UpdateFaxInteraction',_0x2eea0e,JSON[_0x6974('0x21')](_0x97eec));_0x3c65fe(_0x97eec);})[_0x6974('0x19')](function(_0x172363){logger['error'](_0x6974('0x1a'),_0x172363[_0x6974('0x16')],_0x2eea0e);_0x5f0a51(_0x4fdd7c[_0x6974('0x14')](0x1f4,_0x172363['message']));});});};exports[_0x6974('0x22')]=function(_0x418133){return new Promise(function(_0x365819,_0xf0b84){return db['FaxInteraction'][_0x6974('0x23')]({'where':_0x418133[_0x6974('0x1d')]?_0x418133[_0x6974('0x1d')][_0x6974('0x1f')]||null:null})[_0x6974('0xf')](function(_0x41ff3e){if(_0x41ff3e){return _0x41ff3e['addTags'](_0x418133[_0x6974('0x1c')][_0x6974('0x24')],_['omit'](_0x418133[_0x6974('0x1c')],[_0x6974('0x24'),'id'])||{});}})[_0x6974('0x25')](function(_0x10fafe){logger[_0x6974('0x10')](_0x6974('0x26'),_0x418133);logger['debug'](_0x6974('0x26'),_0x418133,JSON[_0x6974('0x21')](_0x10fafe));_0x365819(_0x10fafe);})[_0x6974('0x19')](function(_0x94c88d){logger[_0x6974('0x14')]('AddTags',_0x94c88d[_0x6974('0x16')],_0x418133);_0xf0b84(_this[_0x6974('0x14')](0x1f4,_0x94c88d[_0x6974('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b611a2d..a1d98ef 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 _0x179f=['faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x179f,0xc5));var _0xf179=function(_0x5e53e1,_0x2b23fb){_0x5e53e1=_0x5e53e1-0x0;var _0x3c8876=_0x179f[_0x5e53e1];return _0x3c8876;};'use strict';var FaxInteractionEvents=require(_0xf179('0x0'));var events=[_0xf179('0x1'),'remove',_0xf179('0x2')];function createListener(_0x1d3010,_0x597910){return function(_0xb59828){_0x597910[_0xf179('0x3')](_0x1d3010,_0xb59828);};}function removeListener(_0x890aca,_0x45ecd5){return function(){FaxInteractionEvents[_0xf179('0x4')](_0x890aca,_0x45ecd5);};}exports[_0xf179('0x5')]=function(_0x38c231){for(var _0x5c9382=0x0,_0x4bd762=events['length'];_0x5c9382<_0x4bd762;_0x5c9382++){var _0x5430a3=events[_0x5c9382];var _0x2e38ef=createListener(_0xf179('0x6')+_0x5430a3,_0x38c231);FaxInteractionEvents['on'](_0x5430a3,_0x2e38ef);}}; \ No newline at end of file +var _0x4047=['register','length','faxInteraction:','save','remove','update','emit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4047,0xe3));var _0x7404=function(_0x4c407d,_0x185b57){_0x4c407d=_0x4c407d-0x0;var _0xe3ca25=_0x4047[_0x4c407d];return _0xe3ca25;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7404('0x0'),_0x7404('0x1'),_0x7404('0x2')];function createListener(_0x4ce713,_0x2c4024){return function(_0x5a7744){_0x2c4024[_0x7404('0x3')](_0x4ce713,_0x5a7744);};}function removeListener(_0x369034,_0x59849){return function(){FaxInteractionEvents['removeListener'](_0x369034,_0x59849);};}exports[_0x7404('0x4')]=function(_0xf4ff3e){for(var _0x8fc8ef=0x0,_0x35539b=events[_0x7404('0x5')];_0x8fc8ef<_0x35539b;_0x8fc8ef++){var _0x52360c=events[_0x8fc8ef];var _0x34d170=createListener(_0x7404('0x6')+_0x52360c,_0xf4ff3e);FaxInteractionEvents['on'](_0x52360c,_0x34d170);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 758ef8e..9d3be6c 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 _0x45cf=['fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','tracked'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x45cf,0xca));var _0xf45c=function(_0x436e65,_0xd7bb10){_0x436e65=_0x436e65-0x0;var _0x534913=_0x45cf[_0x436e65];return _0x534913;};'use strict';var multer=require(_0xf45c('0x0'));var util=require(_0xf45c('0x1'));var path=require(_0xf45c('0x2'));var timeout=require(_0xf45c('0x3'));var express=require(_0xf45c('0x4'));var router=express['Router']();var fs_extra=require(_0xf45c('0x5'));var auth=require(_0xf45c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf45c('0x7'));var controller=require(_0xf45c('0x8'));router['get']('/',auth[_0xf45c('0x9')](),controller[_0xf45c('0xa')]);router[_0xf45c('0xb')](_0xf45c('0xc'),auth[_0xf45c('0x9')](),controller[_0xf45c('0xd')]);router[_0xf45c('0xb')](_0xf45c('0xe'),auth['isAuthenticated'](),controller[_0xf45c('0xf')]);router[_0xf45c('0xb')]('/:id/messages',auth[_0xf45c('0x9')](),controller[_0xf45c('0x10')]);router[_0xf45c('0xb')](_0xf45c('0x11'),auth['isAuthenticated'](),controller[_0xf45c('0x12')]);router[_0xf45c('0x13')]('/',auth[_0xf45c('0x9')](),controller[_0xf45c('0x14')]);router[_0xf45c('0x13')]('/:id/messages',auth[_0xf45c('0x9')](),controller['addMessage']);router[_0xf45c('0x13')]('/:id/tags',auth[_0xf45c('0x9')](),interaction[_0xf45c('0x15')](_0xf45c('0x16'),_0xf45c('0x17')),controller['addTags']);router[_0xf45c('0x18')](_0xf45c('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf45c('0x16'),_0xf45c('0x19')),controller[_0xf45c('0x1a')]);router[_0xf45c('0x1b')](_0xf45c('0xe'),auth['isAuthenticated'](),interaction[_0xf45c('0x15')](_0xf45c('0x16'),'faxinteraction:destroy'),controller[_0xf45c('0x1c')]);router['delete'](_0xf45c('0x1d'),auth[_0xf45c('0x9')](),controller[_0xf45c('0x1e')]);module[_0xf45c('0x1f')]=router; \ No newline at end of file +var _0xf23b=['faxinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','update'];(function(_0x362000,_0x463b23){var _0x38510d=function(_0x5a8319){while(--_0x5a8319){_0x362000['push'](_0x362000['shift']());}};_0x38510d(++_0x463b23);}(_0xf23b,0x1d6));var _0xbf23=function(_0x20eebf,_0xed0412){_0x20eebf=_0x20eebf-0x0;var _0x561a5c=_0xf23b[_0x20eebf];return _0x561a5c;};'use strict';var multer=require('multer');var util=require(_0xbf23('0x0'));var path=require(_0xbf23('0x1'));var timeout=require(_0xbf23('0x2'));var express=require(_0xbf23('0x3'));var router=express[_0xbf23('0x4')]();var fs_extra=require(_0xbf23('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf23('0x6'));var controller=require('./faxInteraction.controller');router[_0xbf23('0x7')]('/',auth[_0xbf23('0x8')](),controller[_0xbf23('0x9')]);router[_0xbf23('0x7')](_0xbf23('0xa'),auth[_0xbf23('0x8')](),controller['describe']);router[_0xbf23('0x7')](_0xbf23('0xb'),auth[_0xbf23('0x8')](),controller['show']);router[_0xbf23('0x7')](_0xbf23('0xc'),auth[_0xbf23('0x8')](),controller[_0xbf23('0xd')]);router[_0xbf23('0x7')]('/:id/download',auth[_0xbf23('0x8')](),controller[_0xbf23('0xe')]);router['post']('/',auth[_0xbf23('0x8')](),controller[_0xbf23('0xf')]);router[_0xbf23('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbf23('0x11')]);router[_0xbf23('0x10')](_0xbf23('0x12'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),'faxinteraction:addtags'),controller['addTags']);router[_0xbf23('0x15')](_0xbf23('0xb'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),_0xbf23('0x16')),controller[_0xbf23('0x17')]);router['delete'](_0xbf23('0xb'),auth[_0xbf23('0x8')](),interaction[_0xbf23('0x13')](_0xbf23('0x14'),_0xbf23('0x18')),controller['destroy']);router['delete'](_0xbf23('0x12'),auth['isAuthenticated'](),controller[_0xbf23('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index af4d6cf..0c8811a 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28a2=['exports','TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x228a('0x0'));module[_0x228a('0x1')]={'body':{'type':Sequelize[_0x228a('0x2')](_0x228a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x228a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x228a('0x5')]('in',_0x228a('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x228a('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0xb7cf,0xca));var _0xfb7c=function(_0x26c643,_0x2c784a){_0x26c643=_0x26c643-0x0;var _0xb49398=_0xb7cf[_0x26c643];return _0xb49398;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index eccc715..97f5199 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 _0xb445=['includeAll','options','body','find','params','describe','accept','acceptMessage','fax','reject','UserId','user','FaxInteraction','interaction','get','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','isNil','basename','root','server','files','attachments','Attachment','download','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','VIRTUAL','merge','include','findAll','show','keys'];(function(_0x454cc4,_0x49392e){var _0xfd2568=function(_0x36f9b6){while(--_0x36f9b6){_0x454cc4['push'](_0x454cc4['shift']());}};_0xfd2568(++_0x49392e);}(_0xb445,0x1f0));var _0x5b44=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xb445[_0xf31767];return _0x24bd0c;};'use strict';var util=require(_0x5b44('0x0'));var path=require(_0x5b44('0x1'));var _=require(_0x5b44('0x2'));var Redis=require(_0x5b44('0x3'));var interactionService=require(_0x5b44('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x5b44('0x5'))(_0x5b44('0x6'));var config=require(_0x5b44('0x7'));var db=require('../../mysqldb')['db'];config[_0x5b44('0x8')]=_[_0x5b44('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b44('0xa'))(new Redis(config[_0x5b44('0x8')]));require(_0x5b44('0xb'))[_0x5b44('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b44('0xd')][_0x5b44('0xe')]({'port':0x232c});var client9002=jayson[_0x5b44('0xd')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')('fax-interactions');function respondWithRpcPromise(_0x143f8f,_0x3f2dbd,_0x35ef22,_0x46cec1){return new Promise(function(_0x1bd52f,_0x3a57a3){var _0x369501=_0x46cec1||client;return _0x369501[_0x5b44('0xf')](_0x143f8f,_0x35ef22)[_0x5b44('0x10')](function(_0xeb8468){logger['info']('FaxMessage,\x20%s,\x20%s',_0x3f2dbd,'request\x20sent');logger[_0x5b44('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3f2dbd,_0x5b44('0x12'),JSON[_0x5b44('0x13')](_0xeb8468));if(_0xeb8468[_0x5b44('0x14')]){if(_0xeb8468[_0x5b44('0x14')][_0x5b44('0x15')]===0x1f4){logger['error'](_0x5b44('0x16'),_0x3f2dbd,_0xeb8468[_0x5b44('0x14')]['message']);return _0x3a57a3(_0xeb8468[_0x5b44('0x14')]['message']);}logger[_0x5b44('0x14')](_0x5b44('0x16'),_0x3f2dbd,_0xeb8468['error'][_0x5b44('0x17')]);return _0x1bd52f(_0xeb8468['error'][_0x5b44('0x17')]);}else{logger[_0x5b44('0x18')](_0x5b44('0x16'),_0x3f2dbd,_0x5b44('0x12'));_0x1bd52f(_0xeb8468['result'][_0x5b44('0x17')]);}})[_0x5b44('0x19')](function(_0x5f4e5b){logger[_0x5b44('0x14')](_0x5b44('0x16'),_0x3f2dbd,_0x5f4e5b);_0x3a57a3(_0x5f4e5b);});});}function respondWithResult(_0x2e6eb2,_0x125ef6){_0x125ef6=_0x125ef6||0xc8;return function(_0x569efa){if(_0x569efa){return _0x2e6eb2[_0x5b44('0x1a')](_0x125ef6)[_0x5b44('0x1b')](_0x569efa);}};}function respondWithFilteredResult(_0x428c87,_0x5ada30){return function(_0x334c08){if(_0x334c08){var _0x3774c6=typeof _0x5ada30[_0x5b44('0x1c')]===_0x5b44('0x1d')&&typeof _0x5ada30[_0x5b44('0x1e')]===_0x5b44('0x1d');var _0x2b27f4=_0x334c08['count'];var _0x42de83=_0x3774c6?0x0:_0x5ada30[_0x5b44('0x1c')];var _0x4a42e5=_0x3774c6?_0x334c08[_0x5b44('0x1f')]:_0x5ada30[_0x5b44('0x1c')]+_0x5ada30[_0x5b44('0x1e')];var _0x1fc654;if(_0x4a42e5>=_0x2b27f4){_0x4a42e5=_0x2b27f4;_0x1fc654=0xc8;}else{_0x1fc654=0xce;}_0x428c87['status'](_0x1fc654);return _0x428c87[_0x5b44('0x20')](_0x5b44('0x21'),_0x42de83+'-'+_0x4a42e5+'/'+_0x2b27f4)[_0x5b44('0x1b')](_0x334c08);}return null;};}function saveUpdates(_0x30ecc8){return function(_0x2a490a){if(_0x2a490a){return _0x2a490a[_0x5b44('0x22')](_0x30ecc8)[_0x5b44('0x10')](function(_0xdf102e){return _0xdf102e;});}return null;};}function removeEntity(_0x128d04){return function(_0x9fa024){if(_0x9fa024){return _0x9fa024[_0x5b44('0x23')]()[_0x5b44('0x10')](function(){_0x128d04[_0x5b44('0x1a')](0xcc)[_0x5b44('0x24')]();});}};}function handleEntityNotFound(_0x14134f){return function(_0x2c00ec){if(!_0x2c00ec){_0x14134f[_0x5b44('0x25')](0x194);}return _0x2c00ec;};}function handleError(_0x477401,_0x11b6e5){_0x11b6e5=_0x11b6e5||0x1f4;return function(_0x472724){logger[_0x5b44('0x14')](_0x472724[_0x5b44('0x26')]);if(_0x472724[_0x5b44('0x27')]){delete _0x472724['name'];}_0x477401[_0x5b44('0x1a')](_0x11b6e5)[_0x5b44('0x28')](_0x472724);};}exports[_0x5b44('0x29')]=function(_0x17507b,_0x1363e3){var _0x10213c={},_0x29bcab={},_0x459790={'count':0x0,'rows':[]};var _0x2d5c38=_[_0x5b44('0x2a')](db[_0x5b44('0x2b')][_0x5b44('0x2c')],function(_0x2773ad){return{'name':_0x2773ad['fieldName'],'type':_0x2773ad[_0x5b44('0x2d')][_0x5b44('0x2e')]};});_0x29bcab[_0x5b44('0x2f')]=_[_0x5b44('0x2a')](_0x2d5c38,_0x5b44('0x27'));_0x29bcab['query']=_['keys'](_0x17507b[_0x5b44('0x30')]);_0x29bcab[_0x5b44('0x31')]=_[_0x5b44('0x32')](_0x29bcab[_0x5b44('0x2f')],_0x29bcab[_0x5b44('0x30')]);_0x10213c['attributes']=_[_0x5b44('0x32')](_0x29bcab['model'],qs[_0x5b44('0x33')](_0x17507b['query']['fields']));_0x10213c[_0x5b44('0x34')]=_0x10213c[_0x5b44('0x34')][_0x5b44('0x35')]?_0x10213c['attributes']:_0x29bcab[_0x5b44('0x2f')];if(!_0x17507b[_0x5b44('0x30')]['hasOwnProperty']('nolimit')){_0x10213c[_0x5b44('0x1e')]=qs['limit'](_0x17507b[_0x5b44('0x30')][_0x5b44('0x1e')]);_0x10213c[_0x5b44('0x1c')]=qs[_0x5b44('0x1c')](_0x17507b[_0x5b44('0x30')]['offset']);}_0x10213c['order']=qs['sort'](_0x17507b['query'][_0x5b44('0x36')]);_0x10213c[_0x5b44('0x37')]=qs[_0x5b44('0x31')](_[_0x5b44('0x38')](_0x17507b[_0x5b44('0x30')],_0x29bcab['filters']),_0x2d5c38);if(_0x17507b[_0x5b44('0x30')][_0x5b44('0x39')]){_0x10213c[_0x5b44('0x37')]=_['merge'](_0x10213c[_0x5b44('0x37')],{'$or':_[_0x5b44('0x2a')](_0x2d5c38,function(_0x55c057){if(_0x55c057[_0x5b44('0x2d')]!==_0x5b44('0x3a')){var _0xcfa928={};_0xcfa928[_0x55c057['name']]={'$like':'%'+_0x17507b['query'][_0x5b44('0x39')]+'%'};return _0xcfa928;}})});}_0x10213c=_[_0x5b44('0x3b')]({},_0x10213c,_0x17507b['options']);var _0x1e4799={'where':_0x10213c[_0x5b44('0x37')]};return db['FaxMessage'][_0x5b44('0x1f')](_0x1e4799)[_0x5b44('0x10')](function(_0x59f978){_0x459790['count']=_0x59f978;if(_0x17507b['query']['includeAll']){_0x10213c[_0x5b44('0x3c')]=[{'all':!![]}];}return db[_0x5b44('0x2b')][_0x5b44('0x3d')](_0x10213c);})[_0x5b44('0x10')](function(_0x173bf6){_0x459790['rows']=_0x173bf6;return _0x459790;})[_0x5b44('0x10')](respondWithFilteredResult(_0x1363e3,_0x10213c))[_0x5b44('0x19')](handleError(_0x1363e3,null));};exports[_0x5b44('0x3e')]=function(_0x38d006,_0x157e05){var _0x3c1c95={'raw':!![],'where':{'id':_0x38d006['params']['id']}},_0x423cad={};_0x423cad[_0x5b44('0x2f')]=_[_0x5b44('0x3f')](db[_0x5b44('0x2b')][_0x5b44('0x2c')]);_0x423cad[_0x5b44('0x30')]=_[_0x5b44('0x3f')](_0x38d006[_0x5b44('0x30')]);_0x423cad[_0x5b44('0x31')]=_[_0x5b44('0x32')](_0x423cad[_0x5b44('0x2f')],_0x423cad['query']);_0x3c1c95[_0x5b44('0x34')]=_[_0x5b44('0x32')](_0x423cad[_0x5b44('0x2f')],qs['fields'](_0x38d006[_0x5b44('0x30')]['fields']));_0x3c1c95['attributes']=_0x3c1c95[_0x5b44('0x34')][_0x5b44('0x35')]?_0x3c1c95[_0x5b44('0x34')]:_0x423cad[_0x5b44('0x2f')];if(_0x38d006[_0x5b44('0x30')][_0x5b44('0x40')]){_0x3c1c95[_0x5b44('0x3c')]=[{'all':!![]}];}_0x3c1c95=_['merge']({},_0x3c1c95,_0x38d006[_0x5b44('0x41')]);return db[_0x5b44('0x2b')]['find'](_0x3c1c95)[_0x5b44('0x10')](handleEntityNotFound(_0x157e05,null))[_0x5b44('0x10')](respondWithResult(_0x157e05,null))[_0x5b44('0x19')](handleError(_0x157e05,null));};exports[_0x5b44('0x22')]=function(_0x126623,_0x2106b6){if(_0x126623[_0x5b44('0x42')]['id']){delete _0x126623[_0x5b44('0x42')]['id'];}return db[_0x5b44('0x2b')][_0x5b44('0x43')]({'where':{'id':_0x126623[_0x5b44('0x44')]['id']}})[_0x5b44('0x10')](handleEntityNotFound(_0x2106b6,null))[_0x5b44('0x10')](saveUpdates(_0x126623['body'],null))['then'](respondWithResult(_0x2106b6,null))[_0x5b44('0x19')](handleError(_0x2106b6,null));};exports[_0x5b44('0x23')]=function(_0x40c853,_0x193e50){return db['FaxMessage'][_0x5b44('0x43')]({'where':{'id':_0x40c853['params']['id']}})[_0x5b44('0x10')](handleEntityNotFound(_0x193e50,null))[_0x5b44('0x10')](removeEntity(_0x193e50,null))[_0x5b44('0x19')](handleError(_0x193e50,null));};exports[_0x5b44('0x45')]=function(_0x502aa2,_0x2bee9e){return db[_0x5b44('0x2b')][_0x5b44('0x45')]()[_0x5b44('0x10')](respondWithResult(_0x2bee9e,null))['catch'](handleError(_0x2bee9e,null));};exports[_0x5b44('0x46')]=function(_0x2457dd,_0x3ed2c6){var _0xfe7693='sms';return interactionService[_0x5b44('0x47')](_0x2457dd,_0xfe7693)['then'](respondWithResult(_0x3ed2c6,null))[_0x5b44('0x19')](handleError(_0x3ed2c6,null));};exports['accept']=function(_0x311fdd,_0x23faed){var _0x24ab5b=_0x5b44('0x48');return interactionService[_0x5b44('0x47')](_0x311fdd,_0x24ab5b)[_0x5b44('0x10')](respondWithResult(_0x23faed,null))[_0x5b44('0x19')](handleError(_0x23faed,null));};exports[_0x5b44('0x49')]=function(_0x3d1e44,_0x2e9bc0){var _0x4ff8b9={'agent':{},'channel':_0x5b44('0x48')};if(_0x3d1e44[_0x5b44('0x42')]['id']){delete _0x3d1e44['body']['id'];}_0x3d1e44[_0x5b44('0x42')]['UserId']=_0x3d1e44[_0x5b44('0x42')][_0x5b44('0x4a')]||_0x3d1e44[_0x5b44('0x4b')]['id'];_0x4ff8b9['agent']['id']=_0x3d1e44[_0x5b44('0x42')]['UserId'];return db[_0x5b44('0x2b')][_0x5b44('0x43')]({'where':{'id':_0x3d1e44['params']['id'],'UserId':null}})[_0x5b44('0x10')](handleEntityNotFound(_0x2e9bc0,null))[_0x5b44('0x10')](function(_0x2dcd1e){if(_0x2dcd1e){_0x4ff8b9[_0x5b44('0x17')]=_0x2dcd1e['get']({'plain':!![]});return db[_0x5b44('0x4c')][_0x5b44('0x43')]({'where':{'id':_0x2dcd1e['FaxInteractionId']}});}return null;})[_0x5b44('0x10')](handleEntityNotFound(_0x2e9bc0,null))[_0x5b44('0x10')](function(_0x2b2f89){if(_0x2b2f89){_0x4ff8b9[_0x5b44('0x4d')]=_0x2b2f89[_0x5b44('0x4e')]({'plain':!![]});interaction_log[_0x5b44('0x18')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d1e44['user']['id'],_0x3d1e44[_0x5b44('0x4b')]['name'],_0x3d1e44[_0x5b44('0x4b')][_0x5b44('0x4f')],_0x4ff8b9[_0x5b44('0x4d')]['id'],_0x3d1e44[_0x5b44('0x42')]?JSON[_0x5b44('0x13')](_0x3d1e44[_0x5b44('0x42')]):'null');return respondWithRpcPromise(_0x5b44('0x50'),_0x5b44('0x51'),_0x4ff8b9);}return null;})[_0x5b44('0x10')](function(_0x1873bb){var _0x3886ab=_0x5b44('0x52')+_0x1873bb[_0x5b44('0x17')][_0x5b44('0x53')];return db[_0x5b44('0x54')][_0x5b44('0x30')](_0x3886ab,{'type':db[_0x5b44('0x55')][_0x5b44('0x56')][_0x5b44('0x57')],'raw':!![]})[_0x5b44('0x10')](function(_0x130c16){return _0x130c16;});})[_0x5b44('0x10')](function(_0x399717){if(_0x399717){_0x4ff8b9[_0x5b44('0x17')][_0x5b44('0x58')]=_0x399717[0x0];if(!_0x3d1e44[_0x5b44('0x42')][_0x5b44('0x4a')])return;return db[_0x5b44('0x59')][_0x5b44('0x43')]({'where':{'id':_0x3d1e44[_0x5b44('0x42')][_0x5b44('0x4a')],'role':_0x5b44('0x5a')},'attributes':['id',_0x5b44('0x27'),_0x5b44('0x5b'),'email','internal'],'raw':!![]});}return null;})[_0x5b44('0x10')](function(_0x5cf069){if(!_0x5cf069)return null;_0x4ff8b9[_0x5b44('0x17')][_0x5b44('0x5a')]=_0x5cf069;return _0x4ff8b9;})['then'](function(_0x41d5b2){if(_0x41d5b2){_0x41d5b2[_0x5b44('0x17')][_0x5b44('0x5c')]=util[_0x5b44('0x5d')](_0x5b44('0x5e'),_0x3d1e44[_0x5b44('0x4b')]['name']);_0x41d5b2[_0x5b44('0x17')]['channel']=_0x4ff8b9[_0x5b44('0x5f')];_0x41d5b2[_0x5b44('0x17')][_0x5b44('0x60')]=_0x4ff8b9[_0x5b44('0x5f')];_0x41d5b2[_0x5b44('0x17')]['event']=_0x5b44('0x49');respondWithRpcPromise(_0x5b44('0x61'),_0x5b44('0x61'),{'event':_0x5b44('0x62'),'message':_0x41d5b2[_0x5b44('0x17')]},client9002);return _0x4ff8b9;}return null;})[_0x5b44('0x10')](respondWithResult(_0x2e9bc0,null))[_0x5b44('0x19')](handleError(_0x2e9bc0,null));};exports['create']=function(_0x34ce9a,_0x48e7cb){var _0x46ab9c;return db[_0x5b44('0x2b')][_0x5b44('0x63')](_0x34ce9a[_0x5b44('0x42')],{})['then'](function(_0x37f648){_0x46ab9c=_0x37f648;return db[_0x5b44('0x64')][_0x5b44('0x65')]({'where':{'id':_0x46ab9c[_0x5b44('0x53')]}});})[_0x5b44('0x10')](function(_0x3fab9f){if(_['isNil'](_0x3fab9f)){return;}else{_0x46ab9c[_0x5b44('0x48')]=_0x3fab9f[_0x5b44('0x48')];return db['Attachment'][_0x5b44('0x65')]({'where':{'id':_0x46ab9c[_0x5b44('0x66')]}});}})[_0x5b44('0x10')](function(_0x46020f){return respondWithRpcPromise(_0x5b44('0x67'),_0x5b44('0x67'),{'FaxAccountId':_[_0x5b44('0x68')](_0x34ce9a[_0x5b44('0x42')])?undefined:_0x34ce9a[_0x5b44('0x42')]['FaxAccountId'],'path':_['isNil'](_0x46020f)?undefined:util[_0x5b44('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x46020f[_0x5b44('0x69')]),'fax':_[_0x5b44('0x68')](_0x46ab9c[_0x5b44('0x48')])?undefined:_0x46ab9c[_0x5b44('0x48')],'AttachmentId':_0x46ab9c['AttachmentId']},client9002);})[_0x5b44('0x10')](respondWithResult(_0x48e7cb,0xc9))[_0x5b44('0x19')](handleError(_0x48e7cb,null));};exports['download']=function(_0x36c28d,_0x18c5a3){var _0xdf837d=path['join'](config[_0x5b44('0x6a')],_0x5b44('0x6b'),_0x5b44('0x6c'),_0x5b44('0x6d'));return db[_0x5b44('0x2b')]['find']({'where':{'id':_0x36c28d['params']['id']},'include':[{'model':db[_0x5b44('0x6e')],'as':'Attachment'}]})[_0x5b44('0x10')](handleEntityNotFound(_0x18c5a3,null))['then'](function(_0x170723){if(_0x170723){return _0x18c5a3[_0x5b44('0x6f')](path['join'](_0xdf837d,_0x170723[_0x5b44('0x6e')][_0x5b44('0x69')]));}})['catch'](handleError(_0x18c5a3,null));}; \ No newline at end of file +var _0xc235=['../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','fax-interactions','request','info','request\x20sent','error','FaxMessage,\x20%s,\x20%s','message','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','then','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','find','body','params','describe','accept','acceptMessage','fax','UserId','user','agent','FaxInteraction','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','sequelize','contact','email','internal','interface','format','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','basename','root','server','files','attachments','download','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc235,0xcf));var _0x5c23=function(_0x151188,_0x2e00b5){_0x151188=_0x151188-0x0;var _0xf86c2b=_0xc235[_0x151188];return _0xf86c2b;};'use strict';var util=require(_0x5c23('0x0'));var path=require(_0x5c23('0x1'));var _=require('lodash');var Redis=require(_0x5c23('0x2'));var interactionService=require(_0x5c23('0x3'));var qs=require(_0x5c23('0x4'));var logger=require(_0x5c23('0x5'))('api');var config=require(_0x5c23('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5c23('0x7')](config[_0x5c23('0x8')],{'host':_0x5c23('0x9'),'port':0x18eb});var socket=require(_0x5c23('0xa'))(new Redis(config[_0x5c23('0x8')]));require(_0x5c23('0xb'))[_0x5c23('0xc')](socket);var jayson=require(_0x5c23('0xd'));var client=jayson['client'][_0x5c23('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x5c23('0xe')]({'port':0x232a});var interaction_log=require(_0x5c23('0x5'))(_0x5c23('0xf'));function respondWithRpcPromise(_0x10af18,_0x2c0466,_0x10b953,_0x10e85b){return new Promise(function(_0x55a832,_0x208c38){var _0x51acaf=_0x10e85b||client;return _0x51acaf[_0x5c23('0x10')](_0x10af18,_0x10b953)['then'](function(_0x4381be){logger[_0x5c23('0x11')]('FaxMessage,\x20%s,\x20%s',_0x2c0466,_0x5c23('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2c0466,'request\x20sent',JSON['stringify'](_0x4381be));if(_0x4381be[_0x5c23('0x13')]){if(_0x4381be[_0x5c23('0x13')]['code']===0x1f4){logger['error'](_0x5c23('0x14'),_0x2c0466,_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);return _0x208c38(_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2c0466,_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);return _0x55a832(_0x4381be[_0x5c23('0x13')][_0x5c23('0x15')]);}else{logger[_0x5c23('0x11')](_0x5c23('0x14'),_0x2c0466,_0x5c23('0x12'));_0x55a832(_0x4381be['result']['message']);}})[_0x5c23('0x16')](function(_0x183120){logger['error'](_0x5c23('0x14'),_0x2c0466,_0x183120);_0x208c38(_0x183120);});});}function respondWithResult(_0x1d61f3,_0x1b87c6){_0x1b87c6=_0x1b87c6||0xc8;return function(_0x1f5fd3){if(_0x1f5fd3){return _0x1d61f3['status'](_0x1b87c6)[_0x5c23('0x17')](_0x1f5fd3);}};}function respondWithFilteredResult(_0x24cffc,_0x55a7ed){return function(_0x1b7b7c){if(_0x1b7b7c){var _0x12d53c=typeof _0x55a7ed[_0x5c23('0x18')]===_0x5c23('0x19')&&typeof _0x55a7ed[_0x5c23('0x1a')]==='undefined';var _0x2ef657=_0x1b7b7c['count'];var _0x3abcc3=_0x12d53c?0x0:_0x55a7ed[_0x5c23('0x18')];var _0x390618=_0x12d53c?_0x1b7b7c[_0x5c23('0x1b')]:_0x55a7ed[_0x5c23('0x18')]+_0x55a7ed[_0x5c23('0x1a')];var _0x291263;if(_0x390618>=_0x2ef657){_0x390618=_0x2ef657;_0x291263=0xc8;}else{_0x291263=0xce;}_0x24cffc[_0x5c23('0x1c')](_0x291263);return _0x24cffc[_0x5c23('0x1d')](_0x5c23('0x1e'),_0x3abcc3+'-'+_0x390618+'/'+_0x2ef657)[_0x5c23('0x17')](_0x1b7b7c);}return null;};}function saveUpdates(_0xf32d9d){return function(_0x4a3021){if(_0x4a3021){return _0x4a3021[_0x5c23('0x1f')](_0xf32d9d)[_0x5c23('0x20')](function(_0x10770e){return _0x10770e;});}return null;};}function removeEntity(_0x45d9c5){return function(_0x542be8){if(_0x542be8){return _0x542be8['destroy']()['then'](function(){_0x45d9c5[_0x5c23('0x1c')](0xcc)[_0x5c23('0x21')]();});}};}function handleEntityNotFound(_0x46c4ff){return function(_0x2b7d8b){if(!_0x2b7d8b){_0x46c4ff[_0x5c23('0x22')](0x194);}return _0x2b7d8b;};}function handleError(_0x1057ce,_0x4049dd){_0x4049dd=_0x4049dd||0x1f4;return function(_0x535781){logger[_0x5c23('0x13')](_0x535781['stack']);if(_0x535781[_0x5c23('0x23')]){delete _0x535781['name'];}_0x1057ce[_0x5c23('0x1c')](_0x4049dd)['send'](_0x535781);};}exports[_0x5c23('0x24')]=function(_0x3953ef,_0x376169){var _0x46aba1={},_0x3d7856={},_0x23a706={'count':0x0,'rows':[]};var _0x49a0b7=_[_0x5c23('0x25')](db['FaxMessage'][_0x5c23('0x26')],function(_0x21a855){return{'name':_0x21a855[_0x5c23('0x27')],'type':_0x21a855[_0x5c23('0x28')][_0x5c23('0x29')]};});_0x3d7856[_0x5c23('0x2a')]=_[_0x5c23('0x25')](_0x49a0b7,_0x5c23('0x23'));_0x3d7856[_0x5c23('0x2b')]=_[_0x5c23('0x2c')](_0x3953ef[_0x5c23('0x2b')]);_0x3d7856[_0x5c23('0x2d')]=_[_0x5c23('0x2e')](_0x3d7856[_0x5c23('0x2a')],_0x3d7856['query']);_0x46aba1[_0x5c23('0x2f')]=_['intersection'](_0x3d7856[_0x5c23('0x2a')],qs[_0x5c23('0x30')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x30')]));_0x46aba1['attributes']=_0x46aba1[_0x5c23('0x2f')][_0x5c23('0x31')]?_0x46aba1[_0x5c23('0x2f')]:_0x3d7856[_0x5c23('0x2a')];if(!_0x3953ef['query'][_0x5c23('0x32')]('nolimit')){_0x46aba1['limit']=qs[_0x5c23('0x1a')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x1a')]);_0x46aba1[_0x5c23('0x18')]=qs[_0x5c23('0x18')](_0x3953ef['query'][_0x5c23('0x18')]);}_0x46aba1[_0x5c23('0x33')]=qs[_0x5c23('0x34')](_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x34')]);_0x46aba1[_0x5c23('0x35')]=qs[_0x5c23('0x2d')](_[_0x5c23('0x36')](_0x3953ef[_0x5c23('0x2b')],_0x3d7856[_0x5c23('0x2d')]),_0x49a0b7);if(_0x3953ef[_0x5c23('0x2b')][_0x5c23('0x37')]){_0x46aba1[_0x5c23('0x35')]=_[_0x5c23('0x38')](_0x46aba1[_0x5c23('0x35')],{'$or':_[_0x5c23('0x25')](_0x49a0b7,function(_0x1c72a6){if(_0x1c72a6[_0x5c23('0x28')]!==_0x5c23('0x39')){var _0x10c0ad={};_0x10c0ad[_0x1c72a6[_0x5c23('0x23')]]={'$like':'%'+_0x3953ef[_0x5c23('0x2b')]['filter']+'%'};return _0x10c0ad;}})});}_0x46aba1=_[_0x5c23('0x38')]({},_0x46aba1,_0x3953ef[_0x5c23('0x3a')]);var _0x28f94a={'where':_0x46aba1[_0x5c23('0x35')]};return db[_0x5c23('0x3b')][_0x5c23('0x1b')](_0x28f94a)[_0x5c23('0x20')](function(_0x193438){_0x23a706[_0x5c23('0x1b')]=_0x193438;if(_0x3953ef['query'][_0x5c23('0x3c')]){_0x46aba1[_0x5c23('0x3d')]=[{'all':!![]}];}return db[_0x5c23('0x3b')]['findAll'](_0x46aba1);})[_0x5c23('0x20')](function(_0x19f2b3){_0x23a706['rows']=_0x19f2b3;return _0x23a706;})['then'](respondWithFilteredResult(_0x376169,_0x46aba1))[_0x5c23('0x16')](handleError(_0x376169,null));};exports['show']=function(_0x5875d9,_0x358a2d){var _0x2363bb={'raw':!![],'where':{'id':_0x5875d9['params']['id']}},_0x355225={};_0x355225[_0x5c23('0x2a')]=_[_0x5c23('0x2c')](db[_0x5c23('0x3b')]['rawAttributes']);_0x355225['query']=_[_0x5c23('0x2c')](_0x5875d9[_0x5c23('0x2b')]);_0x355225[_0x5c23('0x2d')]=_[_0x5c23('0x2e')](_0x355225[_0x5c23('0x2a')],_0x355225[_0x5c23('0x2b')]);_0x2363bb['attributes']=_[_0x5c23('0x2e')](_0x355225[_0x5c23('0x2a')],qs[_0x5c23('0x30')](_0x5875d9['query'][_0x5c23('0x30')]));_0x2363bb[_0x5c23('0x2f')]=_0x2363bb['attributes'][_0x5c23('0x31')]?_0x2363bb[_0x5c23('0x2f')]:_0x355225[_0x5c23('0x2a')];if(_0x5875d9[_0x5c23('0x2b')][_0x5c23('0x3c')]){_0x2363bb[_0x5c23('0x3d')]=[{'all':!![]}];}_0x2363bb=_[_0x5c23('0x38')]({},_0x2363bb,_0x5875d9[_0x5c23('0x3a')]);return db[_0x5c23('0x3b')][_0x5c23('0x3e')](_0x2363bb)[_0x5c23('0x20')](handleEntityNotFound(_0x358a2d,null))['then'](respondWithResult(_0x358a2d,null))[_0x5c23('0x16')](handleError(_0x358a2d,null));};exports[_0x5c23('0x1f')]=function(_0x2b5a75,_0x384731){if(_0x2b5a75[_0x5c23('0x3f')]['id']){delete _0x2b5a75['body']['id'];}return db[_0x5c23('0x3b')]['find']({'where':{'id':_0x2b5a75[_0x5c23('0x40')]['id']}})['then'](handleEntityNotFound(_0x384731,null))[_0x5c23('0x20')](saveUpdates(_0x2b5a75[_0x5c23('0x3f')],null))[_0x5c23('0x20')](respondWithResult(_0x384731,null))[_0x5c23('0x16')](handleError(_0x384731,null));};exports['destroy']=function(_0x831afd,_0x231b6c){return db[_0x5c23('0x3b')][_0x5c23('0x3e')]({'where':{'id':_0x831afd[_0x5c23('0x40')]['id']}})['then'](handleEntityNotFound(_0x231b6c,null))[_0x5c23('0x20')](removeEntity(_0x231b6c,null))[_0x5c23('0x16')](handleError(_0x231b6c,null));};exports[_0x5c23('0x41')]=function(_0x2650de,_0x1afd72){return db[_0x5c23('0x3b')][_0x5c23('0x41')]()[_0x5c23('0x20')](respondWithResult(_0x1afd72,null))[_0x5c23('0x16')](handleError(_0x1afd72,null));};exports[_0x5c23('0x42')]=function(_0x1b941e,_0x30df09){var _0x12fd19='sms';return interactionService[_0x5c23('0x43')](_0x1b941e,_0x12fd19)[_0x5c23('0x20')](respondWithResult(_0x30df09,null))[_0x5c23('0x16')](handleError(_0x30df09,null));};exports[_0x5c23('0x42')]=function(_0x40ce2a,_0x4343f7){var _0x48bfae=_0x5c23('0x44');return interactionService[_0x5c23('0x43')](_0x40ce2a,_0x48bfae)[_0x5c23('0x20')](respondWithResult(_0x4343f7,null))[_0x5c23('0x16')](handleError(_0x4343f7,null));};exports['reject']=function(_0x503559,_0x1e3baf){var _0x2a0353={'agent':{},'channel':_0x5c23('0x44')};if(_0x503559[_0x5c23('0x3f')]['id']){delete _0x503559['body']['id'];}_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')]=_0x503559['body']['UserId']||_0x503559[_0x5c23('0x46')]['id'];_0x2a0353[_0x5c23('0x47')]['id']=_0x503559['body']['UserId'];return db['FaxMessage'][_0x5c23('0x3e')]({'where':{'id':_0x503559['params']['id'],'UserId':null}})[_0x5c23('0x20')](handleEntityNotFound(_0x1e3baf,null))[_0x5c23('0x20')](function(_0x546ac7){if(_0x546ac7){_0x2a0353['message']=_0x546ac7['get']({'plain':!![]});return db[_0x5c23('0x48')][_0x5c23('0x3e')]({'where':{'id':_0x546ac7['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1e3baf,null))[_0x5c23('0x20')](function(_0x46ba4f){if(_0x46ba4f){_0x2a0353[_0x5c23('0x49')]=_0x46ba4f[_0x5c23('0x4a')]({'plain':!![]});interaction_log[_0x5c23('0x11')](_0x5c23('0x4b'),_0x503559['user']['id'],_0x503559[_0x5c23('0x46')][_0x5c23('0x23')],_0x503559['user'][_0x5c23('0x4c')],_0x2a0353[_0x5c23('0x49')]['id'],_0x503559[_0x5c23('0x3f')]?JSON['stringify'](_0x503559[_0x5c23('0x3f')]):'null');return respondWithRpcPromise('RejectMessage',_0x5c23('0x4d'),_0x2a0353);}return null;})[_0x5c23('0x20')](function(_0x592e07){var _0x598cea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x592e07[_0x5c23('0x15')][_0x5c23('0x4e')];return db[_0x5c23('0x4f')][_0x5c23('0x2b')](_0x598cea,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x5c23('0x20')](function(_0x4bcb69){return _0x4bcb69;});})['then'](function(_0x266480){if(_0x266480){_0x2a0353['message'][_0x5c23('0x50')]=_0x266480[0x0];if(!_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')])return;return db['User'][_0x5c23('0x3e')]({'where':{'id':_0x503559[_0x5c23('0x3f')][_0x5c23('0x45')],'role':_0x5c23('0x47')},'attributes':['id',_0x5c23('0x23'),'fullname',_0x5c23('0x51'),_0x5c23('0x52')],'raw':!![]});}return null;})[_0x5c23('0x20')](function(_0x5dc7d5){if(!_0x5dc7d5)return null;_0x2a0353[_0x5c23('0x15')][_0x5c23('0x47')]=_0x5dc7d5;return _0x2a0353;})[_0x5c23('0x20')](function(_0x3d6a5a){if(_0x3d6a5a){_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x53')]=util[_0x5c23('0x54')](_0x5c23('0x55'),_0x503559['user'][_0x5c23('0x23')]);_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x56')]=_0x2a0353[_0x5c23('0x56')];_0x3d6a5a[_0x5c23('0x15')][_0x5c23('0x57')]=_0x2a0353[_0x5c23('0x56')];_0x3d6a5a['message'][_0x5c23('0x58')]=_0x5c23('0x59');respondWithRpcPromise(_0x5c23('0x5a'),_0x5c23('0x5a'),{'event':_0x5c23('0x5b'),'message':_0x3d6a5a[_0x5c23('0x15')]},client9002);return _0x2a0353;}return null;})[_0x5c23('0x20')](respondWithResult(_0x1e3baf,null))[_0x5c23('0x16')](handleError(_0x1e3baf,null));};exports[_0x5c23('0x5c')]=function(_0x153466,_0x1831f1){var _0x3687eb;return db['FaxMessage'][_0x5c23('0x5c')](_0x153466[_0x5c23('0x3f')],{})['then'](function(_0x396196){_0x3687eb=_0x396196;return db[_0x5c23('0x5d')][_0x5c23('0x5e')]({'where':{'id':_0x3687eb[_0x5c23('0x4e')]}});})[_0x5c23('0x20')](function(_0x489609){if(_['isNil'](_0x489609)){return;}else{_0x3687eb[_0x5c23('0x44')]=_0x489609[_0x5c23('0x44')];return db[_0x5c23('0x5f')]['findOne']({'where':{'id':_0x3687eb[_0x5c23('0x60')]}});}})[_0x5c23('0x20')](function(_0x521320){return respondWithRpcPromise(_0x5c23('0x61'),_0x5c23('0x61'),{'FaxAccountId':_['isNil'](_0x153466[_0x5c23('0x3f')])?undefined:_0x153466[_0x5c23('0x3f')][_0x5c23('0x62')],'path':_[_0x5c23('0x63')](_0x521320)?undefined:util[_0x5c23('0x54')]('/var/opt/motion2/server/files/attachments/%s',_0x521320[_0x5c23('0x64')]),'fax':_[_0x5c23('0x63')](_0x3687eb[_0x5c23('0x44')])?undefined:_0x3687eb[_0x5c23('0x44')],'AttachmentId':_0x3687eb['AttachmentId']},client9002);})[_0x5c23('0x20')](respondWithResult(_0x1831f1,0xc9))[_0x5c23('0x16')](handleError(_0x1831f1,null));};exports['download']=function(_0x2d1170,_0x39d1cd){var _0x3462c6=path['join'](config[_0x5c23('0x65')],_0x5c23('0x66'),_0x5c23('0x67'),_0x5c23('0x68'));return db['FaxMessage'][_0x5c23('0x3e')]({'where':{'id':_0x2d1170[_0x5c23('0x40')]['id']},'include':[{'model':db['Attachment'],'as':_0x5c23('0x5f')}]})[_0x5c23('0x20')](handleEntityNotFound(_0x39d1cd,null))[_0x5c23('0x20')](function(_0x72177a){if(_0x72177a){return _0x39d1cd[_0x5c23('0x69')](path['join'](_0x3462c6,_0x72177a[_0x5c23('0x5f')][_0x5c23('0x64')]));}})[_0x5c23('0x16')](handleError(_0x39d1cd,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9504d4a..06d193d 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 _0x363e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x363e,0x179));var _0xe363=function(_0x442d00,_0x103133){_0x442d00=_0x442d00-0x0;var _0x1c1c84=_0x363e[_0x442d00];return _0x1c1c84;};'use strict';var EventEmitter=require(_0xe363('0x0'));var FaxMessage=require(_0xe363('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe363('0x2')](0x0);var events={'afterCreate':_0xe363('0x3'),'afterUpdate':_0xe363('0x4'),'afterDestroy':_0xe363('0x5')};function emitEvent(_0x179157){return function(_0x3809ea,_0x6e174a,_0x11775e){FaxMessageEvents[_0xe363('0x6')](_0x179157+':'+_0x3809ea['id'],_0x3809ea);FaxMessageEvents[_0xe363('0x6')](_0x179157,_0x3809ea);_0x11775e(null);};}for(var e in events){if(events[_0xe363('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xe363('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x2eba=['FaxMessage','setMaxListeners','save','emit','../../mysqldb'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x2eba,0xc7));var _0xa2eb=function(_0x36ef2c,_0x378575){_0x36ef2c=_0x36ef2c-0x0;var _0x345b23=_0x2eba[_0x36ef2c];return _0x345b23;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xa2eb('0x0'))['db'][_0xa2eb('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa2eb('0x2')](0x0);var events={'afterCreate':_0xa2eb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45ff67){return function(_0x51ebed,_0x1544ff,_0x3174a0){FaxMessageEvents[_0xa2eb('0x4')](_0x45ff67+':'+_0x51ebed['id'],_0x51ebed);FaxMessageEvents[_0xa2eb('0x4')](_0x45ff67,_0x51ebed);_0x3174a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3f58e17..7e21df5 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 _0x9dcd=['secret','isNil','UserId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0xef4309,_0x4c7c5b){var _0x353a12=function(_0x4dd38d){while(--_0x4dd38d){_0xef4309['push'](_0xef4309['shift']());}};_0x353a12(++_0x4c7c5b);}(_0x9dcd,0xf0));var _0xd9dc=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x9dcd[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xd9dc('0x0'));var util=require(_0xd9dc('0x1'));var logger=require(_0xd9dc('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd9dc('0x3'));var rp=require(_0xd9dc('0x4'));var fs=require('fs');var path=require(_0xd9dc('0x5'));var rimraf=require(_0xd9dc('0x6'));var config=require(_0xd9dc('0x7'));var attributes=require(_0xd9dc('0x8'));module[_0xd9dc('0x9')]=function(_0x154ac2,_0xc1b914){return _0x154ac2[_0xd9dc('0xa')](_0xd9dc('0xb'),attributes,{'tableName':_0xd9dc('0xc'),'paranoid':![],'indexes':[{'name':_0xd9dc('0xd'),'fields':[_0xd9dc('0xe')],'type':_0xd9dc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27e541,_0x3c3e49,_0x28ebe3){var _0x400342=_0x154ac2[_0xd9dc('0x10')];var _0x157f8e=_0x27e541[_0xd9dc('0x11')]({'plain':!![]});if(_0x157f8e[_0xd9dc('0x12')][_0xd9dc('0x13')]()==='in'||_0x157f8e[_0xd9dc('0x12')][_0xd9dc('0x13')]()===_0xd9dc('0x14')&&!_0x157f8e[_0xd9dc('0x15')]&&!_[_0xd9dc('0x16')](_0x157f8e[_0xd9dc('0x17')])){_0x400342['FaxInteraction']['findOne']({'where':{'id':_0x157f8e['FaxInteractionId']}})[_0xd9dc('0x18')](function(_0x9c1026){if(_0x9c1026){_0x9c1026[_0xd9dc('0x19')]({'lastMsgAt':_0x157f8e['createdAt'],'lastMsgDirection':_0x157f8e[_0xd9dc('0x12')][_0xd9dc('0x13')]()});}})[_0xd9dc('0x1a')](function(_0x1e6660){console[_0xd9dc('0x1b')](_0x1e6660);});}_0x28ebe3();}},'charset':_0xd9dc('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe3b9=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxMessage.attributes','exports','define'];(function(_0x3d3bd4,_0x3959a7){var _0x3062b7=function(_0x3c5ab8){while(--_0x3c5ab8){_0x3d3bd4['push'](_0x3d3bd4['shift']());}};_0x3062b7(++_0x3959a7);}(_0xe3b9,0x1c1));var _0x9e3b=function(_0x1edf7a,_0x53f918){_0x1edf7a=_0x1edf7a-0x0;var _0x20bc81=_0xe3b9[_0x1edf7a];return _0x20bc81;};'use strict';var _=require('lodash');var util=require(_0x9e3b('0x0'));var logger=require(_0x9e3b('0x1'))(_0x9e3b('0x2'));var moment=require(_0x9e3b('0x3'));var BPromise=require(_0x9e3b('0x4'));var rp=require(_0x9e3b('0x5'));var fs=require('fs');var path=require(_0x9e3b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e3b('0x7'));module[_0x9e3b('0x8')]=function(_0x1ef74b,_0x458a1c){return _0x1ef74b[_0x9e3b('0x9')](_0x9e3b('0xa'),attributes,{'tableName':_0x9e3b('0xb'),'paranoid':![],'indexes':[{'name':_0x9e3b('0xc'),'fields':[_0x9e3b('0xd')],'type':_0x9e3b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a919d,_0x2c84d3,_0x3f1eaf){var _0x183471=_0x1ef74b['models'];var _0x51a5ed=_0x3a919d[_0x9e3b('0xf')]({'plain':!![]});if(_0x51a5ed[_0x9e3b('0x10')][_0x9e3b('0x11')]()==='in'||_0x51a5ed[_0x9e3b('0x10')]['toLowerCase']()==='out'&&!_0x51a5ed['secret']&&!_[_0x9e3b('0x12')](_0x51a5ed[_0x9e3b('0x13')])){_0x183471['FaxInteraction'][_0x9e3b('0x14')]({'where':{'id':_0x51a5ed[_0x9e3b('0x15')]}})['then'](function(_0x3da5b6){if(_0x3da5b6){_0x3da5b6[_0x9e3b('0x16')]({'lastMsgAt':_0x51a5ed[_0x9e3b('0x17')],'lastMsgDirection':_0x51a5ed[_0x9e3b('0x10')][_0x9e3b('0x11')]()});}})[_0x9e3b('0x18')](function(_0x469549){console[_0x9e3b('0x19')](_0x469549);});}_0x3f1eaf();}},'charset':'utf8mb4','collate':_0x9e3b('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0bf8954..33ea948 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 _0xdace=['FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xdace,0xc5));var _0xedac=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xdace[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});config['redis']=_[_0xedac('0xb')](config[_0xedac('0xc')],{'host':_0xedac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedac('0xc')]));require(_0xedac('0xe'))[_0xedac('0xf')](socket);function respondWithRpcPromise(_0x4af030,_0x5e188c,_0x144368){return new BPromise(function(_0x2ea11d,_0x57e1bf){return client['request'](_0x4af030,_0x144368)[_0xedac('0x10')](function(_0x25395d){logger['info'](_0xedac('0x11'),_0x5e188c,'request\x20sent');logger[_0xedac('0x12')](_0xedac('0x13'),_0x5e188c,_0xedac('0x14'),JSON[_0xedac('0x15')](_0x25395d));if(_0x25395d[_0xedac('0x16')]){if(_0x25395d[_0xedac('0x16')][_0xedac('0x17')]===0x1f4){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);return _0x57e1bf(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')]['message']);return _0x2ea11d(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}else{logger[_0xedac('0x19')](_0xedac('0x11'),_0x5e188c,'request\x20sent');_0x2ea11d(_0x25395d['result'][_0xedac('0x18')]);}})[_0xedac('0x1a')](function(_0x25fe64){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25fe64);_0x57e1bf(_0x25fe64);});});}exports['CreateFaxMessage']=function(_0x2b2ae9){var _0x17766c=this;return new Promise(function(_0x23c609,_0xcc1605){return db[_0xedac('0x1b')][_0xedac('0x1c')](_0x2b2ae9[_0xedac('0x1d')],{'raw':_0x2b2ae9[_0xedac('0x1e')]?_0x2b2ae9['options'][_0xedac('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x29cd40){logger[_0xedac('0x19')]('CreateFaxMessage',_0x2b2ae9);logger[_0xedac('0x12')](_0xedac('0x20'),_0x2b2ae9,JSON[_0xedac('0x15')](_0x29cd40));_0x23c609(_0x29cd40);})[_0xedac('0x1a')](function(_0x6b13ca){logger[_0xedac('0x16')]('CreateFaxMessage',_0x6b13ca[_0xedac('0x18')],_0x2b2ae9);_0xcc1605(_0x17766c[_0xedac('0x16')](0x1f4,_0x6b13ca[_0xedac('0x18')]));});});};exports[_0xedac('0x21')]=function(_0x1ff33e){var _0x453a3c=this;return new Promise(function(_0x40ba53,_0x26c6f7){return db[_0xedac('0x1b')][_0xedac('0x22')](_0x1ff33e['body'],{'raw':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')]['where']||null:null,'attributes':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x23')]||null:null,'limit':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')]['limit']||null:null})['then'](function(_0xe813e6){logger[_0xedac('0x19')](_0xedac('0x21'),_0x1ff33e);logger[_0xedac('0x12')](_0xedac('0x21'),_0x1ff33e,JSON[_0xedac('0x15')](_0xe813e6));_0x40ba53(_0xe813e6);})[_0xedac('0x1a')](function(_0x483233){logger[_0xedac('0x16')](_0xedac('0x21'),_0x483233[_0xedac('0x18')],_0x1ff33e);_0x26c6f7(_0x453a3c['error'](0x1f4,_0x483233[_0xedac('0x18')]));});});}; \ No newline at end of file +var _0xd0bb=['CreateFaxMessage','FaxMessage','create','body','options','update','raw','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3517e5,_0x2c3608){_0x3517e5=_0x3517e5-0x0;var _0x15ba05=_0xd0bb[_0x3517e5];return _0x15ba05;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});config[_0xbd0b('0xa')]=_[_0xbd0b('0xb')](config['redis'],{'host':_0xbd0b('0xc'),'port':0x18eb});var socket=require(_0xbd0b('0xd'))(new Redis(config[_0xbd0b('0xa')]));require(_0xbd0b('0xe'))[_0xbd0b('0xf')](socket);function respondWithRpcPromise(_0x53d5e8,_0x51cf98,_0x14bc5b){return new BPromise(function(_0x110cf1,_0x4a69ff){return client[_0xbd0b('0x10')](_0x53d5e8,_0x14bc5b)[_0xbd0b('0x11')](function(_0x526258){logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));logger[_0xbd0b('0x15')](_0xbd0b('0x16'),_0x51cf98,_0xbd0b('0x14'),JSON[_0xbd0b('0x17')](_0x526258));if(_0x526258[_0xbd0b('0x18')]){if(_0x526258[_0xbd0b('0x18')][_0xbd0b('0x19')]===0x1f4){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x526258[_0xbd0b('0x18')]['message']);return _0x4a69ff(_0x526258['error'][_0xbd0b('0x1a')]);}logger[_0xbd0b('0x18')](_0xbd0b('0x13'),_0x51cf98,_0x526258[_0xbd0b('0x18')][_0xbd0b('0x1a')]);return _0x110cf1(_0x526258['error']['message']);}else{logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));_0x110cf1(_0x526258[_0xbd0b('0x1b')][_0xbd0b('0x1a')]);}})[_0xbd0b('0x1c')](function(_0x5aeb79){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x5aeb79);_0x4a69ff(_0x5aeb79);});});}exports[_0xbd0b('0x1d')]=function(_0x475801){var _0x2d02d0=this;return new Promise(function(_0x3053bb,_0x4b312d){return db[_0xbd0b('0x1e')][_0xbd0b('0x1f')](_0x475801[_0xbd0b('0x20')],{'raw':_0x475801['options']?_0x475801[_0xbd0b('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xbd0b('0x11')](function(_0x3c4938){logger[_0xbd0b('0x12')](_0xbd0b('0x1d'),_0x475801);logger[_0xbd0b('0x15')]('CreateFaxMessage',_0x475801,JSON[_0xbd0b('0x17')](_0x3c4938));_0x3053bb(_0x3c4938);})['catch'](function(_0x3e7e9c){logger[_0xbd0b('0x18')](_0xbd0b('0x1d'),_0x3e7e9c[_0xbd0b('0x1a')],_0x475801);_0x4b312d(_0x2d02d0[_0xbd0b('0x18')](0x1f4,_0x3e7e9c[_0xbd0b('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x382f76){var _0x1b46a3=this;return new Promise(function(_0x33b752,_0x1b5a00){return db[_0xbd0b('0x1e')][_0xbd0b('0x22')](_0x382f76['body'],{'raw':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382f76['options']?_0x382f76['options'][_0xbd0b('0x24')]||null:null,'attributes':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x25')]||null:null,'limit':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x26')]||null:null})['then'](function(_0x45f7d6){logger[_0xbd0b('0x12')]('UpdateFaxMessage',_0x382f76);logger['debug'](_0xbd0b('0x27'),_0x382f76,JSON[_0xbd0b('0x17')](_0x45f7d6));_0x33b752(_0x45f7d6);})['catch'](function(_0x31bdd3){logger[_0xbd0b('0x18')](_0xbd0b('0x27'),_0x31bdd3[_0xbd0b('0x1a')],_0x382f76);_0x1b5a00(_0x1b46a3[_0xbd0b('0x18')](0x1f4,_0x31bdd3[_0xbd0b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9f47c1b..db50384 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 _0xf2c5=['./faxMessage.events','save','update','emit','removeListener','register','faxMessage:'];(function(_0x4e4e93,_0x19494d){var _0x2c11f4=function(_0x1d752c){while(--_0x1d752c){_0x4e4e93['push'](_0x4e4e93['shift']());}};_0x2c11f4(++_0x19494d);}(_0xf2c5,0x85));var _0x5f2c=function(_0x10d580,_0x121db4){_0x10d580=_0x10d580-0x0;var _0x5b2bfe=_0xf2c5[_0x10d580];return _0x5b2bfe;};'use strict';var FaxMessageEvents=require(_0x5f2c('0x0'));var events=[_0x5f2c('0x1'),'remove',_0x5f2c('0x2')];function createListener(_0x383589,_0x562bf3){return function(_0x2bb4d3){_0x562bf3[_0x5f2c('0x3')](_0x383589,_0x2bb4d3);};}function removeListener(_0x52b6df,_0x2ef812){return function(){FaxMessageEvents[_0x5f2c('0x4')](_0x52b6df,_0x2ef812);};}exports[_0x5f2c('0x5')]=function(_0x573da4){for(var _0x5a9464=0x0,_0x240bbd=events['length'];_0x5a9464<_0x240bbd;_0x5a9464++){var _0x524c82=events[_0x5a9464];var _0x41e5fe=createListener(_0x5f2c('0x6')+_0x524c82,_0x573da4);FaxMessageEvents['on'](_0x524c82,_0x41e5fe);}}; \ No newline at end of file +var _0x20db=['faxMessage:','save','emit','removeListener','register'];(function(_0x353394,_0xc7c6c4){var _0x4b3a65=function(_0x32f09d){while(--_0x32f09d){_0x353394['push'](_0x353394['shift']());}};_0x4b3a65(++_0xc7c6c4);}(_0x20db,0x1dc));var _0xb20d=function(_0x4577e4,_0x34bc9d){_0x4577e4=_0x4577e4-0x0;var _0x1c7f34=_0x20db[_0x4577e4];return _0x1c7f34;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb20d('0x0'),'remove','update'];function createListener(_0x3adfc5,_0x353cf9){return function(_0x1d4ea3){_0x353cf9[_0xb20d('0x1')](_0x3adfc5,_0x1d4ea3);};}function removeListener(_0x2d5725,_0x1457ed){return function(){FaxMessageEvents[_0xb20d('0x2')](_0x2d5725,_0x1457ed);};}exports[_0xb20d('0x3')]=function(_0x3b3d70){for(var _0x19184f=0x0,_0x2ce0fb=events['length'];_0x19184f<_0x2ce0fb;_0x19184f++){var _0x2e0fdd=events[_0x19184f];var _0xa16811=createListener(_0xb20d('0x4')+_0x2e0fdd,_0x3b3d70);FaxMessageEvents['on'](_0x2e0fdd,_0xa16811);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 46c47e8..402da27 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 _0xb58b=['Router','fs-extra','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','reject','destroy','exports','util','path','connect-timeout'];(function(_0x1d5575,_0x135d79){var _0x7cd745=function(_0x220230){while(--_0x220230){_0x1d5575['push'](_0x1d5575['shift']());}};_0x7cd745(++_0x135d79);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5c46ed,_0x39d8f6){_0x5c46ed=_0x5c46ed-0x0;var _0x16731c=_0xb58b[_0x5c46ed];return _0x16731c;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['download']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),interaction[_0xbb58('0xf')](_0xbb58('0x10'),_0xbb58('0x11')),controller[_0xbb58('0x12')]);router['put'](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['update']);router[_0xbb58('0x13')](_0xbb58('0x14'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x15')]);router[_0xbb58('0x13')]('/:id/reject',auth[_0xbb58('0x8')](),controller[_0xbb58('0x16')]);router['delete']('/:id',auth[_0xbb58('0x8')](),controller[_0xbb58('0x17')]);module[_0xbb58('0x18')]=router; \ No newline at end of file +var _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x5860a3,_0x33b78a){var _0x1b193b=function(_0x4fe13e){while(--_0x4fe13e){_0x5860a3['push'](_0x5860a3['shift']());}};_0x1b193b(++_0x33b78a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x21ff62,_0x968e44){_0x21ff62=_0x21ff62-0x0;var _0xf1ff06=_0xee5b[_0x21ff62];return _0xf1ff06;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fea42bd..554baab 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 _0x04d5=['roundrobin','sequelize','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x1c2e6c,_0x230c0f){var _0x490ea6=function(_0x4eb3ea){while(--_0x4eb3ea){_0x1c2e6c['push'](_0x1c2e6c['shift']());}};_0x490ea6(++_0x230c0f);}(_0x04d5,0xe1));var _0x504d=function(_0x5628e7,_0x484dd9){_0x5628e7=_0x5628e7-0x0;var _0x432d58=_0x04d5[_0x5628e7];return _0x432d58;};'use strict';var Sequelize=require(_0x504d('0x0'));module[_0x504d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x504d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x504d('0x3')]},'timeout':{'type':Sequelize[_0x504d('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x504d('0x5'),_0x504d('0x6'),_0x504d('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x504d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd01d=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name'];(function(_0x416ff8,_0x39855b){var _0x461acd=function(_0x59c23f){while(--_0x59c23f){_0x416ff8['push'](_0x416ff8['shift']());}};_0x461acd(++_0x39855b);}(_0xd01d,0xbe));var _0xdd01=function(_0x3e29f9,_0xaba63){_0x3e29f9=_0x3e29f9-0x0;var _0x47afcc=_0xd01d[_0x3e29f9];return _0x47afcc;};'use strict';var Sequelize=require('sequelize');module[_0xdd01('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xdd01('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdd01('0x2')]},'timeout':{'type':Sequelize[_0xdd01('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdd01('0x4')](_0xdd01('0x5'),_0xdd01('0x6'),_0xdd01('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdd01('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index becd4e4..ec34bc9 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 _0xdf55=['forEach','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','bluebird','util','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','FaxQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','include','rows','catch','show','params','query','keys','filters','model','attributes','intersection','fields','length','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','merge','findAll','User','findAndCountAll','agent','createdAt','format','%s/%s','faxPause','updatedAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','clone','push','toString','QueryTypes','SELECT','includes','union','compact','value','removeTeams','isEmpty','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf55,0x83));var _0x5df5=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0xdf55[_0x28d7b5];return _0x1ed035;};'use strict';var BPromise=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var _=require('lodash');var squel=require(_0x5df5('0x2'));var Redis=require(_0x5df5('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x5df5('0x4'))(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var db=require('../../mysqldb')['db'];config[_0x5df5('0x7')]=_[_0x5df5('0x8')](config[_0x5df5('0x7')],{'host':_0x5df5('0x9'),'port':0x18eb});var socket=require(_0x5df5('0xa'))(new Redis(config[_0x5df5('0x7')]));require(_0x5df5('0xb'))[_0x5df5('0xc')](socket);function respondWithStatusCode(_0x4d43a3,_0x338f2b){_0x338f2b=_0x338f2b||0xcc;return function(_0x403d8b){if(_0x403d8b){return _0x4d43a3[_0x5df5('0xd')](_0x338f2b);}return _0x4d43a3['status'](_0x338f2b)['end']();};}function respondWithResult(_0x39711b,_0x4e80bd){_0x4e80bd=_0x4e80bd||0xc8;return function(_0x45ad13){if(_0x45ad13){return _0x39711b[_0x5df5('0xe')](_0x4e80bd)['json'](_0x45ad13);}};}function respondWithFilteredResult(_0x59d273,_0x40322d){return function(_0xba664a){if(_0xba664a){var _0x1d0b7e=typeof _0x40322d[_0x5df5('0xf')]===_0x5df5('0x10')&&typeof _0x40322d[_0x5df5('0x11')]===_0x5df5('0x10');var _0x463990=_0xba664a[_0x5df5('0x12')];var _0x956317=_0x1d0b7e?0x0:_0x40322d['offset'];var _0x30fd32=_0x1d0b7e?_0xba664a['count']:_0x40322d[_0x5df5('0xf')]+_0x40322d[_0x5df5('0x11')];var _0x5b0ad9;if(_0x30fd32>=_0x463990){_0x30fd32=_0x463990;_0x5b0ad9=0xc8;}else{_0x5b0ad9=0xce;}_0x59d273[_0x5df5('0xe')](_0x5b0ad9);return _0x59d273[_0x5df5('0x13')]('Content-Range',_0x956317+'-'+_0x30fd32+'/'+_0x463990)[_0x5df5('0x14')](_0xba664a);}return null;};}function saveUpdates(_0x457205){return function(_0x591a19){if(_0x591a19){return _0x591a19[_0x5df5('0x15')](_0x457205)[_0x5df5('0x16')](function(_0xb7e1c2){return _0xb7e1c2;});}return null;};}function removeEntity(_0x44f700){return function(_0x215d59){if(_0x215d59){return _0x215d59['destroy']()['then'](function(){var _0x48c824=_0x215d59['get']({'plain':!![]});var _0x58152a=_0x5df5('0x17');return db[_0x5df5('0x18')][_0x5df5('0x19')]({'where':{'type':_0x58152a,'resourceId':_0x48c824['id']}})[_0x5df5('0x16')](function(){return _0x215d59;});})['then'](function(){_0x44f700[_0x5df5('0xe')](0xcc)[_0x5df5('0x1a')]();});}};}function handleEntityNotFound(_0x3b41ec){return function(_0x34af1d){if(!_0x34af1d){_0x3b41ec[_0x5df5('0xd')](0x194);}return _0x34af1d;};}function handleError(_0x382999,_0x59ff67){_0x59ff67=_0x59ff67||0x1f4;return function(_0x2e99a1){logger[_0x5df5('0x1b')](_0x2e99a1[_0x5df5('0x1c')]);if(_0x2e99a1[_0x5df5('0x1d')]){delete _0x2e99a1['name'];}_0x382999[_0x5df5('0xe')](_0x59ff67)[_0x5df5('0x1e')](_0x2e99a1);};}exports[_0x5df5('0x1f')]=function(_0x4a544b,_0x52206d){var _0x532923={};var _0x357fb0={'count':0x0,'rows':[]};var _0x3ff82e=_[_0x5df5('0x20')](db[_0x5df5('0x21')][_0x5df5('0x22')],function(_0x1fd83c){return{'name':_0x1fd83c[_0x5df5('0x23')],'type':_0x1fd83c[_0x5df5('0x24')]['key']};});_0x532923=qs[_0x5df5('0x25')](_0x3ff82e,_0x4a544b);var _0x4fc1a1={'where':_0x532923[_0x5df5('0x26')]};return db[_0x5df5('0x21')]['count'](_0x4fc1a1)[_0x5df5('0x16')](function(_0x4945c6){_0x357fb0[_0x5df5('0x12')]=_0x4945c6;_0x532923['include']=qs[_0x5df5('0x27')](_0x4a544b['query']);return db[_0x5df5('0x21')]['findAll'](_0x532923);})[_0x5df5('0x16')](function(_0x47bebb){_0x357fb0[_0x5df5('0x28')]=_0x47bebb;return _0x357fb0;})['then'](respondWithFilteredResult(_0x52206d,_0x532923))[_0x5df5('0x29')](handleError(_0x52206d,null));};exports[_0x5df5('0x2a')]=function(_0x2c36ae,_0x2d53e5){var _0x41362f={'raw':!![],'where':{'id':_0x2c36ae[_0x5df5('0x2b')]['id']}},_0x22c00b={};_0x22c00b['model']=_['keys'](db[_0x5df5('0x21')][_0x5df5('0x22')]);_0x22c00b[_0x5df5('0x2c')]=_[_0x5df5('0x2d')](_0x2c36ae[_0x5df5('0x2c')]);_0x22c00b[_0x5df5('0x2e')]=_['intersection'](_0x22c00b[_0x5df5('0x2f')],_0x22c00b[_0x5df5('0x2c')]);_0x41362f[_0x5df5('0x30')]=_[_0x5df5('0x31')](_0x22c00b['model'],qs[_0x5df5('0x32')](_0x2c36ae['query'][_0x5df5('0x32')]));_0x41362f[_0x5df5('0x30')]=_0x41362f['attributes'][_0x5df5('0x33')]?_0x41362f['attributes']:_0x22c00b[_0x5df5('0x2f')];if(_0x2c36ae[_0x5df5('0x2c')][_0x5df5('0x34')]){_0x41362f[_0x5df5('0x27')]=[{'all':!![]}];}_0x41362f=_['merge']({},_0x41362f,_0x2c36ae[_0x5df5('0x35')]);return db[_0x5df5('0x21')][_0x5df5('0x36')](_0x41362f)[_0x5df5('0x16')](handleEntityNotFound(_0x2d53e5,null))['then'](respondWithResult(_0x2d53e5,null))[_0x5df5('0x29')](handleError(_0x2d53e5,null));};exports[_0x5df5('0x37')]=function(_0x4323f8,_0x18b597){return db[_0x5df5('0x21')][_0x5df5('0x37')](_0x4323f8[_0x5df5('0x38')],{})['then'](function(_0x33da21){var _0x3102c7=_0x4323f8['user'][_0x5df5('0x39')]({'plain':!![]});if(!_0x3102c7)throw new Error(_0x5df5('0x3a'));if(_0x3102c7['role']===_0x5df5('0x3b')){var _0x2ee3aa=_0x33da21[_0x5df5('0x39')]({'plain':!![]});var _0x3a7f40=_0x5df5('0x17');return db[_0x5df5('0x3c')][_0x5df5('0x36')]({'where':{'name':_0x3a7f40,'userProfileId':_0x3102c7[_0x5df5('0x3d')]},'raw':!![]})['then'](function(_0x5e6c93){if(_0x5e6c93&&_0x5e6c93[_0x5df5('0x3e')]===0x0){return db['UserProfileResource'][_0x5df5('0x37')]({'name':_0x2ee3aa[_0x5df5('0x1d')],'resourceId':_0x2ee3aa['id'],'type':_0x5e6c93['name'],'sectionId':_0x5e6c93['id']},{})[_0x5df5('0x16')](function(){return _0x33da21;});}else{return _0x33da21;}})[_0x5df5('0x29')](function(_0x23e592){logger[_0x5df5('0x1b')](_0x5df5('0x3f'),_0x23e592);throw _0x23e592;});}return _0x33da21;})[_0x5df5('0x16')](respondWithResult(_0x18b597,0xc9))[_0x5df5('0x29')](handleError(_0x18b597,null));};exports[_0x5df5('0x15')]=function(_0x5824c3,_0x42b562){if(_0x5824c3['body']['id']){delete _0x5824c3[_0x5df5('0x38')]['id'];}return db[_0x5df5('0x21')][_0x5df5('0x36')]({'where':{'id':_0x5824c3[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x42b562,null))['then'](saveUpdates(_0x5824c3[_0x5df5('0x38')],null))[_0x5df5('0x16')](respondWithResult(_0x42b562,null))[_0x5df5('0x29')](handleError(_0x42b562,null));};exports['destroy']=function(_0x3c9098,_0xe88093){return db['FaxQueue'][_0x5df5('0x36')]({'where':{'id':_0x3c9098[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0xe88093,null))[_0x5df5('0x16')](removeEntity(_0xe88093,null))['catch'](handleError(_0xe88093,null));};exports[_0x5df5('0x40')]=function(_0x337e20,_0x514fd8){return db[_0x5df5('0x21')][_0x5df5('0x40')]()[_0x5df5('0x16')](respondWithResult(_0x514fd8,null))['catch'](handleError(_0x514fd8,null));};exports[_0x5df5('0x41')]=function(_0x3842d0,_0x108916){var _0x2724e3={'raw':!![],'where':{}},_0x50bdf0={},_0x2e4590;return db[_0x5df5('0x21')][_0x5df5('0x42')]({'where':{'id':_0x3842d0[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x108916,null))['then'](function(_0x5c3dc0){if(_0x5c3dc0){_0x2e4590=_0x5c3dc0[_0x5df5('0x39')]({'plain':!![]});_0x50bdf0['model']=_[_0x5df5('0x2d')](db[_0x5df5('0x43')][_0x5df5('0x22')]);_0x50bdf0[_0x5df5('0x2c')]=_['keys'](_0x3842d0[_0x5df5('0x2c')]);_0x50bdf0[_0x5df5('0x2e')]=_[_0x5df5('0x31')](_0x50bdf0[_0x5df5('0x2f')],_0x50bdf0[_0x5df5('0x2c')]);_0x2724e3[_0x5df5('0x30')]=_['intersection'](_0x50bdf0[_0x5df5('0x2f')],qs['fields'](_0x3842d0[_0x5df5('0x2c')][_0x5df5('0x32')]));_0x2724e3[_0x5df5('0x30')]=_0x2724e3['attributes'][_0x5df5('0x33')]?_0x2724e3['attributes']:_0x50bdf0[_0x5df5('0x2f')];if(!_0x3842d0['query'][_0x5df5('0x44')](_0x5df5('0x45'))){_0x2724e3[_0x5df5('0x11')]=qs['limit'](_0x3842d0[_0x5df5('0x2c')][_0x5df5('0x11')]);_0x2724e3['offset']=qs[_0x5df5('0xf')](_0x3842d0[_0x5df5('0x2c')][_0x5df5('0xf')]);}_0x2724e3[_0x5df5('0x46')]=qs[_0x5df5('0x47')](_0x3842d0[_0x5df5('0x2c')][_0x5df5('0x47')]);_0x2724e3['where']=qs[_0x5df5('0x2e')](_['pick'](_0x3842d0[_0x5df5('0x2c')],_0x50bdf0[_0x5df5('0x2e')]));_0x2724e3[_0x5df5('0x26')][_0x5df5('0x48')]=_0x5c3dc0['id'];if(_0x3842d0[_0x5df5('0x2c')][_0x5df5('0x49')]){_0x2724e3[_0x5df5('0x26')]=_[_0x5df5('0x4a')](_0x2724e3['where'],{'$or':_[_0x5df5('0x20')](_0x2724e3[_0x5df5('0x30')],function(_0x151af5){var _0x134a28={};_0x134a28[_0x151af5]={'$like':'%'+_0x3842d0[_0x5df5('0x2c')]['filter']+'%'};return _0x134a28;})});}_0x2724e3=_[_0x5df5('0x4a')]({},_0x2724e3,_0x3842d0['options']);return db['UserFaxQueue'][_0x5df5('0x4b')](_0x2724e3);}})[_0x5df5('0x16')](function(_0xb452d6){if(_0xb452d6){return db[_0x5df5('0x4c')][_0x5df5('0x4d')]({'where':{'id':_[_0x5df5('0x20')](_0xb452d6,'UserId'),'role':_0x5df5('0x4e')},'attributes':['id',_0x5df5('0x1d'),'faxPause','updatedAt',_0x5df5('0x4f')]});}})[_0x5df5('0x16')](function(_0x9a168c){if(_0x9a168c){return{'count':_0x9a168c[_0x5df5('0x12')],'rows':_[_0x5df5('0x20')](_0x9a168c[_0x5df5('0x28')],function(_0x595ab8){return{'membername':_0x595ab8['name'],'UserId':_0x595ab8['id'],'queue_name':_0x2e4590['name'],'FaxQueueId':_0x2e4590['id'],'interface':util[_0x5df5('0x50')](_0x5df5('0x51'),'SIP',_0x595ab8[_0x5df5('0x1d')]),'penalty':0x0,'paused':_0x595ab8[_0x5df5('0x52')],'createdAt':_0x595ab8[_0x5df5('0x4f')],'updatedAt':_0x595ab8[_0x5df5('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5df5('0x16')](respondWithFilteredResult(_0x108916,_0x2724e3))[_0x5df5('0x29')](handleError(_0x108916,null));};exports[_0x5df5('0x54')]=function(_0x95e12,_0x463268){var _0x59ecf7={};var _0x302792={};var _0x10286e;var _0x113f9e;return db[_0x5df5('0x21')][_0x5df5('0x42')]({'where':{'id':_0x95e12[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x463268,null))[_0x5df5('0x16')](function(_0x2fdd43){if(_0x2fdd43){_0x10286e=_0x2fdd43;_0x302792[_0x5df5('0x2f')]=_[_0x5df5('0x2d')](db[_0x5df5('0x55')]['rawAttributes']);_0x302792[_0x5df5('0x2c')]=_[_0x5df5('0x2d')](_0x95e12['query']);_0x302792[_0x5df5('0x2e')]=_[_0x5df5('0x31')](_0x302792[_0x5df5('0x2f')],_0x302792[_0x5df5('0x2c')]);_0x59ecf7['attributes']=_[_0x5df5('0x31')](_0x302792[_0x5df5('0x2f')],qs['fields'](_0x95e12['query'][_0x5df5('0x32')]));_0x59ecf7[_0x5df5('0x30')]=_0x59ecf7[_0x5df5('0x30')]['length']?_0x59ecf7['attributes']:_0x302792[_0x5df5('0x2f')];_0x59ecf7[_0x5df5('0x46')]=qs['sort'](_0x95e12[_0x5df5('0x2c')][_0x5df5('0x47')]);_0x59ecf7[_0x5df5('0x26')]=qs[_0x5df5('0x2e')](_[_0x5df5('0x56')](_0x95e12['query'],_0x302792[_0x5df5('0x2e')]));if(_0x95e12[_0x5df5('0x2c')][_0x5df5('0x49')]){_0x59ecf7[_0x5df5('0x26')]=_['merge'](_0x59ecf7[_0x5df5('0x26')],{'$or':_['map'](_0x59ecf7[_0x5df5('0x30')],function(_0x34576d){var _0x50a296={};_0x50a296[_0x34576d]={'$like':'%'+_0x95e12[_0x5df5('0x2c')]['filter']+'%'};return _0x50a296;})});}_0x59ecf7=_[_0x5df5('0x4a')]({},_0x59ecf7,_0x95e12['options']);return _0x10286e[_0x5df5('0x54')](_0x59ecf7);}})[_0x5df5('0x16')](function(_0x37a40c){if(_0x37a40c){_0x113f9e=_0x37a40c[_0x5df5('0x33')];if(!_0x95e12[_0x5df5('0x2c')][_0x5df5('0x44')]('nolimit')){_0x59ecf7[_0x5df5('0x11')]=qs[_0x5df5('0x11')](_0x95e12[_0x5df5('0x2c')]['limit']);_0x59ecf7[_0x5df5('0xf')]=qs[_0x5df5('0xf')](_0x95e12[_0x5df5('0x2c')][_0x5df5('0xf')]);}return _0x10286e[_0x5df5('0x54')](_0x59ecf7);}})[_0x5df5('0x16')](function(_0x56d43e){if(_0x56d43e){return _0x56d43e?{'count':_0x113f9e,'rows':_0x56d43e}:null;}})['then'](respondWithResult(_0x463268,null))[_0x5df5('0x29')](handleError(_0x463268,null));};exports[_0x5df5('0x57')]=function(_0x3d1df1,_0x42953e){var _0x516e69=_0x3d1df1['body'][_0x5df5('0x58')];return db[_0x5df5('0x55')][_0x5df5('0x4b')]({'where':{'id':_0x516e69},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5df5('0x59'),'attributes':['id',_0x5df5('0x1d'),_0x5df5('0x5a'),_0x5df5('0x5b'),_0x5df5('0x5c')],'raw':!![]}]})[_0x5df5('0x16')](function(_0x31d7b4){if(_0x31d7b4){var _0xec54b7=_[_0x5df5('0x5d')](_0x31d7b4,function(_0x5d4c7e){var _0x12184c=_0x5d4c7e[_0x5df5('0x39')]({'plain':!![]});return _0x12184c[_0x5df5('0x59')];});return db['FaxQueue'][_0x5df5('0x36')]({'where':{'id':_0x3d1df1[_0x5df5('0x2b')]['id']}})['then'](function(_0x186e0d){return db[_0x5df5('0x5e')][_0x5df5('0x5f')](function(_0x5d37b3){return _0x186e0d[_0x5df5('0x57')](_0x516e69,{'transaction':_0x5d37b3})['then'](function(){return BPromise[_0x5df5('0x60')](_0xec54b7,function(_0x21f8a3){return db[_0x5df5('0x43')][_0x5df5('0x61')]({'where':{'UserId':_0x21f8a3['id'],'FaxQueueId':_0x3d1df1[_0x5df5('0x2b')]['id']},'transaction':_0x5d37b3});});})[_0x5df5('0x16')](function(){_0xec54b7['forEach'](function(_0x366972){socket[_0x5df5('0x62')]('userFaxQueue:save',{'UserId':_0x366972['id'],'FaxQueueId':_0x186e0d['id']});});});});});}})[_0x5df5('0x16')](respondWithStatusCode(_0x42953e,null))['catch'](handleError(_0x42953e,null));};exports['removeTeams']=function(_0x395b8e,_0x50c30c){return db[_0x5df5('0x55')][_0x5df5('0x4b')]({'where':{'id':_0x395b8e[_0x5df5('0x2c')][_0x5df5('0x58')]},'attributes':['id'],'include':[{'model':db[_0x5df5('0x4c')],'as':_0x5df5('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x50c30c,null))[_0x5df5('0x16')](function(_0x36d635){var _0x68cbcc=_['map'](_0x36d635,'id');var _0x3c755c=[];var _0x2d065b=[];var _0x51f5a5=squel[_0x5df5('0x63')]();_0x51f5a5[_0x5df5('0x64')](_0x5df5('0x65'))[_0x5df5('0x66')](_0x5df5('0x67'),'tq')['join'](_0x5df5('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5df5('0x26')]('FaxQueueId\x20=\x20?',_0x395b8e[_0x5df5('0x2b')]['id']);for(var _0x168289=0x0;_0x168289<_0x36d635[_0x5df5('0x33')];_0x168289+=0x1){let _0x42fa04=_0x36d635[_0x168289];for(var _0xbe8a8c=0x0;_0xbe8a8c<_0x42fa04['Agents']['length'];_0xbe8a8c+=0x1){let _0x3ce02d=_0x42fa04[_0x5df5('0x59')][_0xbe8a8c];var _0xb868bf=_0x51f5a5[_0x5df5('0x69')]();_0xb868bf[_0x5df5('0x26')]('ut.UserId\x20=\x20?',_0x3ce02d['id']);_0x2d065b[_0x5df5('0x6a')](db[_0x5df5('0x5e')][_0x5df5('0x2c')](_0xb868bf[_0x5df5('0x6b')](),{'type':db[_0x5df5('0x5e')][_0x5df5('0x6c')][_0x5df5('0x6d')]})[_0x5df5('0x16')](function(_0x349f5d){if(_0x349f5d[_0x5df5('0x33')]===0x1){return _0x3ce02d['id'];}else{var _0x1bff6c=_['every'](_['map'](_0x349f5d,'TeamId'),function(_0x322ad6){return _[_0x5df5('0x6e')](_0x68cbcc,_0x322ad6);});if(_0x1bff6c){return _0x3ce02d['id'];}}}));}}return BPromise['all'](_0x2d065b)[_0x5df5('0x16')](function(_0x11bb45){_0x3c755c=_(_0x3c755c)[_0x5df5('0x6f')](_0x11bb45)[_0x5df5('0x70')]()[_0x5df5('0x71')]();return db[_0x5df5('0x21')][_0x5df5('0x36')]({'where':{'id':_0x395b8e['params']['id']}})[_0x5df5('0x16')](function(_0x36c355){return db[_0x5df5('0x5e')][_0x5df5('0x5f')](function(_0x3a06ad){return _0x36c355[_0x5df5('0x72')](_0x395b8e[_0x5df5('0x2c')]['ids'],{'transaction':_0x3a06ad})[_0x5df5('0x16')](function(){if(!_[_0x5df5('0x73')](_0x3c755c)){return _0x36c355[_0x5df5('0x74')](_0x3c755c,{'transaction':_0x3a06ad});}})[_0x5df5('0x16')](function(){_0x3c755c[_0x5df5('0x75')](function(_0x41110a){socket[_0x5df5('0x62')](_0x5df5('0x76'),{'UserId':_0x41110a,'FaxQueueId':_0x36c355['id']});});});});});});})['then'](respondWithStatusCode(_0x50c30c,null))[_0x5df5('0x29')](handleError(_0x50c30c,null));};exports[_0x5df5('0x77')]=function(_0x508bc6,_0x2aaa13){return db[_0x5df5('0x21')][_0x5df5('0x36')]({'where':{'id':_0x508bc6[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x2aaa13,null))['then'](function(_0x19d854){if(_0x19d854){return _0x19d854[_0x5df5('0x77')](_0x508bc6[_0x5df5('0x38')]['ids'],_['omit'](_0x508bc6[_0x5df5('0x38')],[_0x5df5('0x58'),'id'])||{})[_0x5df5('0x78')](function(_0x2c1aae){for(var _0x19d901=0x0;_0x19d901<_0x508bc6[_0x5df5('0x38')]['ids']['length'];_0x19d901+=0x1){socket['emit'](_0x5df5('0x79'),{'UserId':Number(_0x508bc6[_0x5df5('0x38')][_0x5df5('0x58')][_0x19d901]),'FaxQueueId':Number(_0x508bc6['params']['id'])});}return _0x2c1aae;});}})[_0x5df5('0x16')](respondWithResult(_0x2aaa13,null))['catch'](handleError(_0x2aaa13,null));};exports[_0x5df5('0x74')]=function(_0x172f01,_0x530de6){return db[_0x5df5('0x21')][_0x5df5('0x36')]({'where':{'id':_0x172f01['params']['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x530de6,null))[_0x5df5('0x16')](function(_0x4367f5){if(_0x4367f5){return _0x4367f5[_0x5df5('0x74')](_0x172f01['query']['ids'])[_0x5df5('0x16')](function(){if(_[_0x5df5('0x7a')](_0x172f01[_0x5df5('0x2c')]['ids'])){for(var _0x30231a=0x0;_0x30231a<_0x172f01[_0x5df5('0x2c')][_0x5df5('0x58')][_0x5df5('0x33')];_0x30231a+=0x1){socket[_0x5df5('0x62')]('userFaxQueue:remove',{'UserId':Number(_0x172f01[_0x5df5('0x2c')][_0x5df5('0x58')][_0x30231a]),'FaxQueueId':Number(_0x172f01[_0x5df5('0x2b')]['id'])});}}else{socket[_0x5df5('0x62')](_0x5df5('0x76'),{'UserId':Number(_0x172f01[_0x5df5('0x2c')][_0x5df5('0x58')]),'FaxQueueId':Number(_0x172f01[_0x5df5('0x2b')]['id'])});}});}})[_0x5df5('0x16')](respondWithStatusCode(_0x530de6,null))[_0x5df5('0x29')](handleError(_0x530de6,null));};exports['getAgents']=function(_0x38bacb,_0x31b43c){var _0x4efacf={};var _0x35f908={};var _0x472703;var _0x47a0ed;return db[_0x5df5('0x21')][_0x5df5('0x42')]({'where':{'id':_0x38bacb[_0x5df5('0x2b')]['id']}})[_0x5df5('0x16')](handleEntityNotFound(_0x31b43c,null))['then'](function(_0xbc0b3c){if(_0xbc0b3c){_0x472703=_0xbc0b3c;_0x35f908[_0x5df5('0x2f')]=_[_0x5df5('0x2d')](db[_0x5df5('0x4c')]['rawAttributes']);_0x35f908[_0x5df5('0x2c')]=_[_0x5df5('0x2d')](_0x38bacb[_0x5df5('0x2c')]);_0x35f908[_0x5df5('0x2e')]=_[_0x5df5('0x31')](_0x35f908['model'],_0x35f908[_0x5df5('0x2c')]);_0x4efacf[_0x5df5('0x30')]=_[_0x5df5('0x31')](_0x35f908[_0x5df5('0x2f')],qs[_0x5df5('0x32')](_0x38bacb['query'][_0x5df5('0x32')]));_0x4efacf[_0x5df5('0x30')]=_0x4efacf[_0x5df5('0x30')]['length']?_0x4efacf['attributes']:_0x35f908[_0x5df5('0x2f')];_0x4efacf['order']=qs[_0x5df5('0x47')](_0x38bacb[_0x5df5('0x2c')]['sort']);_0x4efacf[_0x5df5('0x26')]=qs[_0x5df5('0x2e')](_['pick'](_0x38bacb[_0x5df5('0x2c')],_0x35f908[_0x5df5('0x2e')]));if(_0x38bacb[_0x5df5('0x2c')]['filter']){_0x4efacf[_0x5df5('0x26')]=_[_0x5df5('0x4a')](_0x4efacf[_0x5df5('0x26')],{'$or':_['map'](_0x4efacf['attributes'],function(_0x27fa56){var _0x430235={};_0x430235[_0x27fa56]={'$like':'%'+_0x38bacb['query'][_0x5df5('0x49')]+'%'};return _0x430235;})});}_0x4efacf=_[_0x5df5('0x4a')]({},_0x4efacf,_0x38bacb['options']);return _0x472703[_0x5df5('0x7b')](_0x4efacf);}})[_0x5df5('0x16')](function(_0x2a7c62){if(_0x2a7c62){_0x47a0ed=_0x2a7c62[_0x5df5('0x33')];if(!_0x38bacb[_0x5df5('0x2c')][_0x5df5('0x44')](_0x5df5('0x45'))){_0x4efacf[_0x5df5('0x11')]=qs[_0x5df5('0x11')](_0x38bacb[_0x5df5('0x2c')][_0x5df5('0x11')]);_0x4efacf[_0x5df5('0xf')]=qs['offset'](_0x38bacb[_0x5df5('0x2c')]['offset']);}return _0x472703[_0x5df5('0x7b')](_0x4efacf);}})[_0x5df5('0x16')](function(_0x106940){if(_0x106940){return _0x106940?{'count':_0x47a0ed,'rows':_0x106940}:null;}})[_0x5df5('0x16')](respondWithResult(_0x31b43c,null))[_0x5df5('0x29')](handleError(_0x31b43c,null));}; \ No newline at end of file +var _0x4ccb=['createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','options','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','Team','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','stack','send','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','rows','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','filter','map','findAll','User','agent','faxPause'];(function(_0x57d9d9,_0x40b94c){var _0xa4a00c=function(_0x435b6e){while(--_0x435b6e){_0x57d9d9['push'](_0x57d9d9['shift']());}};_0xa4a00c(++_0x40b94c);}(_0x4ccb,0x196));var _0xb4cc=function(_0x10bc30,_0x2c5ff1){_0x10bc30=_0x10bc30-0x0;var _0x19f32b=_0x4ccb[_0x10bc30];return _0x19f32b;};'use strict';var BPromise=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var _=require(_0xb4cc('0x2'));var squel=require('squel');var Redis=require(_0xb4cc('0x3'));var qs=require(_0xb4cc('0x4'));var logger=require('../../config/logger')(_0xb4cc('0x5'));var config=require(_0xb4cc('0x6'));var db=require(_0xb4cc('0x7'))['db'];config['redis']=_[_0xb4cc('0x8')](config[_0xb4cc('0x9')],{'host':_0xb4cc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4cc('0x9')]));require(_0xb4cc('0xb'))[_0xb4cc('0xc')](socket);function respondWithStatusCode(_0x5327a4,_0x7e4460){_0x7e4460=_0x7e4460||0xcc;return function(_0x475478){if(_0x475478){return _0x5327a4[_0xb4cc('0xd')](_0x7e4460);}return _0x5327a4[_0xb4cc('0xe')](_0x7e4460)[_0xb4cc('0xf')]();};}function respondWithResult(_0x55224b,_0x507d38){_0x507d38=_0x507d38||0xc8;return function(_0x19d43e){if(_0x19d43e){return _0x55224b['status'](_0x507d38)[_0xb4cc('0x10')](_0x19d43e);}};}function respondWithFilteredResult(_0x4a54a5,_0x1d7063){return function(_0x1e5a83){if(_0x1e5a83){var _0x277c2a=typeof _0x1d7063['offset']==='undefined'&&typeof _0x1d7063[_0xb4cc('0x11')]==='undefined';var _0x5cf92a=_0x1e5a83[_0xb4cc('0x12')];var _0x58b1c2=_0x277c2a?0x0:_0x1d7063['offset'];var _0xcfdeb9=_0x277c2a?_0x1e5a83[_0xb4cc('0x12')]:_0x1d7063[_0xb4cc('0x13')]+_0x1d7063['limit'];var _0x4096db;if(_0xcfdeb9>=_0x5cf92a){_0xcfdeb9=_0x5cf92a;_0x4096db=0xc8;}else{_0x4096db=0xce;}_0x4a54a5[_0xb4cc('0xe')](_0x4096db);return _0x4a54a5[_0xb4cc('0x14')](_0xb4cc('0x15'),_0x58b1c2+'-'+_0xcfdeb9+'/'+_0x5cf92a)[_0xb4cc('0x10')](_0x1e5a83);}return null;};}function saveUpdates(_0x506ef9){return function(_0x4d4546){if(_0x4d4546){return _0x4d4546[_0xb4cc('0x16')](_0x506ef9)[_0xb4cc('0x17')](function(_0x5b56b2){return _0x5b56b2;});}return null;};}function removeEntity(_0x490b1a){return function(_0x14d8b6){if(_0x14d8b6){return _0x14d8b6[_0xb4cc('0x18')]()[_0xb4cc('0x17')](function(){var _0xa99916=_0x14d8b6['get']({'plain':!![]});var _0x242272=_0xb4cc('0x19');return db[_0xb4cc('0x1a')][_0xb4cc('0x18')]({'where':{'type':_0x242272,'resourceId':_0xa99916['id']}})[_0xb4cc('0x17')](function(){return _0x14d8b6;});})['then'](function(){_0x490b1a[_0xb4cc('0xe')](0xcc)[_0xb4cc('0xf')]();});}};}function handleEntityNotFound(_0x442d86){return function(_0x1a9c91){if(!_0x1a9c91){_0x442d86[_0xb4cc('0xd')](0x194);}return _0x1a9c91;};}function handleError(_0x571793,_0xc9d835){_0xc9d835=_0xc9d835||0x1f4;return function(_0x2289f6){logger[_0xb4cc('0x1b')](_0x2289f6[_0xb4cc('0x1c')]);if(_0x2289f6['name']){delete _0x2289f6['name'];}_0x571793[_0xb4cc('0xe')](_0xc9d835)[_0xb4cc('0x1d')](_0x2289f6);};}exports['index']=function(_0x5b4a17,_0x1f1809){var _0xeb25e1={};var _0x2ee2d3={'count':0x0,'rows':[]};var _0x154002=_['map'](db['FaxQueue'][_0xb4cc('0x1e')],function(_0x4f47ed){return{'name':_0x4f47ed[_0xb4cc('0x1f')],'type':_0x4f47ed[_0xb4cc('0x20')][_0xb4cc('0x21')]};});_0xeb25e1=qs[_0xb4cc('0x22')](_0x154002,_0x5b4a17);var _0x6fb0fb={'where':_0xeb25e1[_0xb4cc('0x23')]};return db[_0xb4cc('0x24')][_0xb4cc('0x12')](_0x6fb0fb)[_0xb4cc('0x17')](function(_0x5baab6){_0x2ee2d3[_0xb4cc('0x12')]=_0x5baab6;_0xeb25e1[_0xb4cc('0x25')]=qs[_0xb4cc('0x25')](_0x5b4a17[_0xb4cc('0x26')]);return db[_0xb4cc('0x24')]['findAll'](_0xeb25e1);})[_0xb4cc('0x17')](function(_0x2957ee){_0x2ee2d3[_0xb4cc('0x27')]=_0x2957ee;return _0x2ee2d3;})[_0xb4cc('0x17')](respondWithFilteredResult(_0x1f1809,_0xeb25e1))['catch'](handleError(_0x1f1809,null));};exports[_0xb4cc('0x28')]=function(_0x3641d5,_0x4e8e5f){var _0x3a78ef={'raw':!![],'where':{'id':_0x3641d5['params']['id']}},_0x418c2d={};_0x418c2d[_0xb4cc('0x29')]=_[_0xb4cc('0x2a')](db[_0xb4cc('0x24')][_0xb4cc('0x1e')]);_0x418c2d[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x3641d5[_0xb4cc('0x26')]);_0x418c2d[_0xb4cc('0x2b')]=_[_0xb4cc('0x2c')](_0x418c2d['model'],_0x418c2d['query']);_0x3a78ef[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x418c2d[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x3641d5[_0xb4cc('0x26')]['fields']));_0x3a78ef[_0xb4cc('0x2d')]=_0x3a78ef[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x3a78ef['attributes']:_0x418c2d[_0xb4cc('0x29')];if(_0x3641d5[_0xb4cc('0x26')][_0xb4cc('0x30')]){_0x3a78ef['include']=[{'all':!![]}];}_0x3a78ef=_[_0xb4cc('0x31')]({},_0x3a78ef,_0x3641d5['options']);return db[_0xb4cc('0x24')][_0xb4cc('0x32')](_0x3a78ef)[_0xb4cc('0x17')](handleEntityNotFound(_0x4e8e5f,null))[_0xb4cc('0x17')](respondWithResult(_0x4e8e5f,null))['catch'](handleError(_0x4e8e5f,null));};exports[_0xb4cc('0x33')]=function(_0x5e7fd1,_0x8d6f09){return db[_0xb4cc('0x24')][_0xb4cc('0x33')](_0x5e7fd1[_0xb4cc('0x34')],{})[_0xb4cc('0x17')](function(_0x3f9b37){var _0x4214e5=_0x5e7fd1['user'][_0xb4cc('0x35')]({'plain':!![]});if(!_0x4214e5)throw new Error(_0xb4cc('0x36'));if(_0x4214e5[_0xb4cc('0x37')]==='user'){var _0x5f05fa=_0x3f9b37[_0xb4cc('0x35')]({'plain':!![]});var _0xc257a=_0xb4cc('0x19');return db[_0xb4cc('0x38')][_0xb4cc('0x32')]({'where':{'name':_0xc257a,'userProfileId':_0x4214e5['userProfileId']},'raw':!![]})[_0xb4cc('0x17')](function(_0x5d55fe){if(_0x5d55fe&&_0x5d55fe['autoAssociation']===0x0){return db[_0xb4cc('0x1a')][_0xb4cc('0x33')]({'name':_0x5f05fa[_0xb4cc('0x39')],'resourceId':_0x5f05fa['id'],'type':_0x5d55fe[_0xb4cc('0x39')],'sectionId':_0x5d55fe['id']},{})[_0xb4cc('0x17')](function(){return _0x3f9b37;});}else{return _0x3f9b37;}})['catch'](function(_0xda87d5){logger['error'](_0xb4cc('0x3a'),_0xda87d5);throw _0xda87d5;});}return _0x3f9b37;})[_0xb4cc('0x17')](respondWithResult(_0x8d6f09,0xc9))[_0xb4cc('0x3b')](handleError(_0x8d6f09,null));};exports[_0xb4cc('0x16')]=function(_0x428ef1,_0x35a6c8){if(_0x428ef1[_0xb4cc('0x34')]['id']){delete _0x428ef1[_0xb4cc('0x34')]['id'];}return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x428ef1[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x35a6c8,null))[_0xb4cc('0x17')](saveUpdates(_0x428ef1[_0xb4cc('0x34')],null))[_0xb4cc('0x17')](respondWithResult(_0x35a6c8,null))[_0xb4cc('0x3b')](handleError(_0x35a6c8,null));};exports['destroy']=function(_0x5be726,_0x2fe47b){return db[_0xb4cc('0x24')]['find']({'where':{'id':_0x5be726[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x2fe47b,null))[_0xb4cc('0x17')](removeEntity(_0x2fe47b,null))[_0xb4cc('0x3b')](handleError(_0x2fe47b,null));};exports['describe']=function(_0x1093bc,_0x94476f){return db[_0xb4cc('0x24')]['describe']()[_0xb4cc('0x17')](respondWithResult(_0x94476f,null))[_0xb4cc('0x3b')](handleError(_0x94476f,null));};exports[_0xb4cc('0x3d')]=function(_0x1490b6,_0xdbba1){var _0x439aa6={'raw':!![],'where':{}},_0x26caae={},_0x303efa;return db[_0xb4cc('0x24')]['findOne']({'where':{'id':_0x1490b6[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0xdbba1,null))[_0xb4cc('0x17')](function(_0x31a76a){if(_0x31a76a){_0x303efa=_0x31a76a[_0xb4cc('0x35')]({'plain':!![]});_0x26caae['model']=_[_0xb4cc('0x2a')](db[_0xb4cc('0x3e')][_0xb4cc('0x1e')]);_0x26caae[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x1490b6[_0xb4cc('0x26')]);_0x26caae[_0xb4cc('0x2b')]=_[_0xb4cc('0x2c')](_0x26caae['model'],_0x26caae[_0xb4cc('0x26')]);_0x439aa6[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x26caae[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x2e')]));_0x439aa6['attributes']=_0x439aa6[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x439aa6['attributes']:_0x26caae[_0xb4cc('0x29')];if(!_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x3f')](_0xb4cc('0x40'))){_0x439aa6['limit']=qs[_0xb4cc('0x11')](_0x1490b6['query'][_0xb4cc('0x11')]);_0x439aa6['offset']=qs['offset'](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x13')]);}_0x439aa6[_0xb4cc('0x41')]=qs['sort'](_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x439aa6[_0xb4cc('0x23')]=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x1490b6['query'],_0x26caae[_0xb4cc('0x2b')]));_0x439aa6[_0xb4cc('0x23')]['FaxQueueId']=_0x31a76a['id'];if(_0x1490b6[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x439aa6[_0xb4cc('0x23')]=_['merge'](_0x439aa6[_0xb4cc('0x23')],{'$or':_[_0xb4cc('0x45')](_0x439aa6['attributes'],function(_0x5c5a3e){var _0x6c1e81={};_0x6c1e81[_0x5c5a3e]={'$like':'%'+_0x1490b6['query'][_0xb4cc('0x44')]+'%'};return _0x6c1e81;})});}_0x439aa6=_[_0xb4cc('0x31')]({},_0x439aa6,_0x1490b6['options']);return db[_0xb4cc('0x3e')][_0xb4cc('0x46')](_0x439aa6);}})[_0xb4cc('0x17')](function(_0x191ca4){if(_0x191ca4){return db[_0xb4cc('0x47')]['findAndCountAll']({'where':{'id':_[_0xb4cc('0x45')](_0x191ca4,'UserId'),'role':_0xb4cc('0x48')},'attributes':['id',_0xb4cc('0x39'),_0xb4cc('0x49'),'updatedAt',_0xb4cc('0x4a')]});}})[_0xb4cc('0x17')](function(_0x3b4f28){if(_0x3b4f28){return{'count':_0x3b4f28['count'],'rows':_[_0xb4cc('0x45')](_0x3b4f28[_0xb4cc('0x27')],function(_0x290b4f){return{'membername':_0x290b4f['name'],'UserId':_0x290b4f['id'],'queue_name':_0x303efa[_0xb4cc('0x39')],'FaxQueueId':_0x303efa['id'],'interface':util[_0xb4cc('0x4b')](_0xb4cc('0x4c'),_0xb4cc('0x4d'),_0x290b4f[_0xb4cc('0x39')]),'penalty':0x0,'paused':_0x290b4f['faxPause'],'createdAt':_0x290b4f[_0xb4cc('0x4a')],'updatedAt':_0x290b4f[_0xb4cc('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4cc('0x17')](respondWithFilteredResult(_0xdbba1,_0x439aa6))[_0xb4cc('0x3b')](handleError(_0xdbba1,null));};exports[_0xb4cc('0x4f')]=function(_0x1e7798,_0xc2a99c){var _0x31d28c={};var _0x36537a={};var _0x491aaa;var _0x23bb10;return db['FaxQueue'][_0xb4cc('0x50')]({'where':{'id':_0x1e7798[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0xc2a99c,null))[_0xb4cc('0x17')](function(_0x4c02ba){if(_0x4c02ba){_0x491aaa=_0x4c02ba;_0x36537a[_0xb4cc('0x29')]=_[_0xb4cc('0x2a')](db['Team'][_0xb4cc('0x1e')]);_0x36537a[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x1e7798[_0xb4cc('0x26')]);_0x36537a[_0xb4cc('0x2b')]=_['intersection'](_0x36537a[_0xb4cc('0x29')],_0x36537a['query']);_0x31d28c[_0xb4cc('0x2d')]=_[_0xb4cc('0x2c')](_0x36537a[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x2e')]));_0x31d28c[_0xb4cc('0x2d')]=_0x31d28c[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x31d28c[_0xb4cc('0x2d')]:_0x36537a['model'];_0x31d28c['order']=qs[_0xb4cc('0x42')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x31d28c['where']=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x1e7798[_0xb4cc('0x26')],_0x36537a[_0xb4cc('0x2b')]));if(_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x31d28c[_0xb4cc('0x23')]=_[_0xb4cc('0x31')](_0x31d28c[_0xb4cc('0x23')],{'$or':_['map'](_0x31d28c[_0xb4cc('0x2d')],function(_0x5c1d89){var _0xd335f={};_0xd335f[_0x5c1d89]={'$like':'%'+_0x1e7798[_0xb4cc('0x26')]['filter']+'%'};return _0xd335f;})});}_0x31d28c=_[_0xb4cc('0x31')]({},_0x31d28c,_0x1e7798[_0xb4cc('0x51')]);return _0x491aaa['getTeams'](_0x31d28c);}})[_0xb4cc('0x17')](function(_0x196409){if(_0x196409){_0x23bb10=_0x196409['length'];if(!_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x3f')](_0xb4cc('0x40'))){_0x31d28c[_0xb4cc('0x11')]=qs[_0xb4cc('0x11')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x11')]);_0x31d28c[_0xb4cc('0x13')]=qs[_0xb4cc('0x13')](_0x1e7798[_0xb4cc('0x26')][_0xb4cc('0x13')]);}return _0x491aaa[_0xb4cc('0x4f')](_0x31d28c);}})[_0xb4cc('0x17')](function(_0x1ba8c0){if(_0x1ba8c0){return _0x1ba8c0?{'count':_0x23bb10,'rows':_0x1ba8c0}:null;}})[_0xb4cc('0x17')](respondWithResult(_0xc2a99c,null))['catch'](handleError(_0xc2a99c,null));};exports[_0xb4cc('0x52')]=function(_0x15fb52,_0x3632f3){var _0x17ea2e=_0x15fb52[_0xb4cc('0x34')][_0xb4cc('0x53')];return db['Team'][_0xb4cc('0x46')]({'where':{'id':_0x17ea2e},'attributes':['id'],'include':[{'model':db[_0xb4cc('0x47')],'as':'Agents','attributes':['id',_0xb4cc('0x39'),_0xb4cc('0x54'),_0xb4cc('0x55'),_0xb4cc('0x56')],'raw':!![]}]})[_0xb4cc('0x17')](function(_0x35fcca){if(_0x35fcca){var _0x405dd2=_[_0xb4cc('0x57')](_0x35fcca,function(_0x5592d3){var _0xfa6816=_0x5592d3[_0xb4cc('0x35')]({'plain':!![]});return _0xfa6816[_0xb4cc('0x58')];});return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x15fb52['params']['id']}})[_0xb4cc('0x17')](function(_0x27b9b){return db[_0xb4cc('0x59')][_0xb4cc('0x5a')](function(_0x46fd76){return _0x27b9b[_0xb4cc('0x52')](_0x17ea2e,{'transaction':_0x46fd76})[_0xb4cc('0x17')](function(){return BPromise[_0xb4cc('0x5b')](_0x405dd2,function(_0x51a63f){return db['UserFaxQueue'][_0xb4cc('0x5c')]({'where':{'UserId':_0x51a63f['id'],'FaxQueueId':_0x15fb52['params']['id']},'transaction':_0x46fd76});});})[_0xb4cc('0x17')](function(){_0x405dd2[_0xb4cc('0x5d')](function(_0x5e47a2){socket[_0xb4cc('0x5e')]('userFaxQueue:save',{'UserId':_0x5e47a2['id'],'FaxQueueId':_0x27b9b['id']});});});});});}})[_0xb4cc('0x17')](respondWithStatusCode(_0x3632f3,null))['catch'](handleError(_0x3632f3,null));};exports[_0xb4cc('0x5f')]=function(_0x5138c2,_0x1ce412){return db[_0xb4cc('0x60')][_0xb4cc('0x46')]({'where':{'id':_0x5138c2[_0xb4cc('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb4cc('0x47')],'as':_0xb4cc('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ce412,null))[_0xb4cc('0x17')](function(_0x3edef8){var _0x4d5531=_['map'](_0x3edef8,'id');var _0x5bdbab=[];var _0x5c6323=[];var _0x42b62d=squel[_0xb4cc('0x61')]();_0x42b62d['field'](_0xb4cc('0x62'))[_0xb4cc('0x63')](_0xb4cc('0x64'),'tq')[_0xb4cc('0x65')]('user_has_teams','ut',_0xb4cc('0x66'))[_0xb4cc('0x23')]('FaxQueueId\x20=\x20?',_0x5138c2[_0xb4cc('0x3c')]['id']);for(var _0x154f7a=0x0;_0x154f7a<_0x3edef8[_0xb4cc('0x2f')];_0x154f7a+=0x1){let _0x482de7=_0x3edef8[_0x154f7a];for(var _0x19f329=0x0;_0x19f329<_0x482de7[_0xb4cc('0x58')][_0xb4cc('0x2f')];_0x19f329+=0x1){let _0x403716=_0x482de7['Agents'][_0x19f329];var _0x44e9d0=_0x42b62d['clone']();_0x44e9d0[_0xb4cc('0x23')](_0xb4cc('0x67'),_0x403716['id']);_0x5c6323[_0xb4cc('0x68')](db[_0xb4cc('0x59')][_0xb4cc('0x26')](_0x44e9d0[_0xb4cc('0x69')](),{'type':db[_0xb4cc('0x59')]['QueryTypes'][_0xb4cc('0x6a')]})['then'](function(_0x23e30c){if(_0x23e30c[_0xb4cc('0x2f')]===0x1){return _0x403716['id'];}else{var _0x402743=_[_0xb4cc('0x6b')](_[_0xb4cc('0x45')](_0x23e30c,_0xb4cc('0x6c')),function(_0x3d2326){return _[_0xb4cc('0x6d')](_0x4d5531,_0x3d2326);});if(_0x402743){return _0x403716['id'];}}}));}}return BPromise[_0xb4cc('0x6e')](_0x5c6323)[_0xb4cc('0x17')](function(_0x4f2bc6){_0x5bdbab=_(_0x5bdbab)[_0xb4cc('0x6f')](_0x4f2bc6)[_0xb4cc('0x70')]()['value']();return db['FaxQueue'][_0xb4cc('0x32')]({'where':{'id':_0x5138c2[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](function(_0x363e75){return db[_0xb4cc('0x59')][_0xb4cc('0x5a')](function(_0x221307){return _0x363e75[_0xb4cc('0x5f')](_0x5138c2[_0xb4cc('0x26')][_0xb4cc('0x53')],{'transaction':_0x221307})[_0xb4cc('0x17')](function(){if(!_[_0xb4cc('0x71')](_0x5bdbab)){return _0x363e75['removeAgents'](_0x5bdbab,{'transaction':_0x221307});}})['then'](function(){_0x5bdbab[_0xb4cc('0x5d')](function(_0x31eda6){socket['emit'](_0xb4cc('0x72'),{'UserId':_0x31eda6,'FaxQueueId':_0x363e75['id']});});});});});});})['then'](respondWithStatusCode(_0x1ce412,null))[_0xb4cc('0x3b')](handleError(_0x1ce412,null));};exports[_0xb4cc('0x73')]=function(_0x1a211e,_0x3fadaf){return db[_0xb4cc('0x24')][_0xb4cc('0x32')]({'where':{'id':_0x1a211e[_0xb4cc('0x3c')]['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x3fadaf,null))[_0xb4cc('0x17')](function(_0x281118){if(_0x281118){return _0x281118[_0xb4cc('0x73')](_0x1a211e['body'][_0xb4cc('0x53')],_[_0xb4cc('0x74')](_0x1a211e[_0xb4cc('0x34')],[_0xb4cc('0x53'),'id'])||{})[_0xb4cc('0x75')](function(_0xa4abb8){for(var _0x36863e=0x0;_0x36863e<_0x1a211e[_0xb4cc('0x34')][_0xb4cc('0x53')][_0xb4cc('0x2f')];_0x36863e+=0x1){socket[_0xb4cc('0x5e')]('userFaxQueue:save',{'UserId':Number(_0x1a211e[_0xb4cc('0x34')][_0xb4cc('0x53')][_0x36863e]),'FaxQueueId':Number(_0x1a211e[_0xb4cc('0x3c')]['id'])});}return _0xa4abb8;});}})[_0xb4cc('0x17')](respondWithResult(_0x3fadaf,null))[_0xb4cc('0x3b')](handleError(_0x3fadaf,null));};exports[_0xb4cc('0x76')]=function(_0x598ac6,_0x236bc3){return db['FaxQueue']['find']({'where':{'id':_0x598ac6[_0xb4cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x236bc3,null))['then'](function(_0x486a1d){if(_0x486a1d){return _0x486a1d['removeAgents'](_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')])[_0xb4cc('0x17')](function(){if(_['isArray'](_0x598ac6[_0xb4cc('0x26')]['ids'])){for(var _0x4d6c67=0x0;_0x4d6c67<_0x598ac6[_0xb4cc('0x26')]['ids'][_0xb4cc('0x2f')];_0x4d6c67+=0x1){socket[_0xb4cc('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')][_0x4d6c67]),'FaxQueueId':Number(_0x598ac6[_0xb4cc('0x3c')]['id'])});}}else{socket[_0xb4cc('0x5e')](_0xb4cc('0x72'),{'UserId':Number(_0x598ac6[_0xb4cc('0x26')][_0xb4cc('0x53')]),'FaxQueueId':Number(_0x598ac6[_0xb4cc('0x3c')]['id'])});}});}})[_0xb4cc('0x17')](respondWithStatusCode(_0x236bc3,null))['catch'](handleError(_0x236bc3,null));};exports[_0xb4cc('0x77')]=function(_0x11c9dc,_0x11e57b){var _0x2092b3={};var _0x5cbdf8={};var _0x51061b;var _0x2c49f3;return db[_0xb4cc('0x24')]['findOne']({'where':{'id':_0x11c9dc['params']['id']}})[_0xb4cc('0x17')](handleEntityNotFound(_0x11e57b,null))[_0xb4cc('0x17')](function(_0x2894e1){if(_0x2894e1){_0x51061b=_0x2894e1;_0x5cbdf8[_0xb4cc('0x29')]=_['keys'](db[_0xb4cc('0x47')]['rawAttributes']);_0x5cbdf8[_0xb4cc('0x26')]=_[_0xb4cc('0x2a')](_0x11c9dc[_0xb4cc('0x26')]);_0x5cbdf8[_0xb4cc('0x2b')]=_['intersection'](_0x5cbdf8[_0xb4cc('0x29')],_0x5cbdf8[_0xb4cc('0x26')]);_0x2092b3['attributes']=_['intersection'](_0x5cbdf8[_0xb4cc('0x29')],qs[_0xb4cc('0x2e')](_0x11c9dc['query'][_0xb4cc('0x2e')]));_0x2092b3[_0xb4cc('0x2d')]=_0x2092b3[_0xb4cc('0x2d')][_0xb4cc('0x2f')]?_0x2092b3[_0xb4cc('0x2d')]:_0x5cbdf8[_0xb4cc('0x29')];_0x2092b3[_0xb4cc('0x41')]=qs[_0xb4cc('0x42')](_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x42')]);_0x2092b3[_0xb4cc('0x23')]=qs[_0xb4cc('0x2b')](_[_0xb4cc('0x43')](_0x11c9dc[_0xb4cc('0x26')],_0x5cbdf8[_0xb4cc('0x2b')]));if(_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x44')]){_0x2092b3['where']=_[_0xb4cc('0x31')](_0x2092b3[_0xb4cc('0x23')],{'$or':_['map'](_0x2092b3[_0xb4cc('0x2d')],function(_0x1fb015){var _0x55ee58={};_0x55ee58[_0x1fb015]={'$like':'%'+_0x11c9dc[_0xb4cc('0x26')]['filter']+'%'};return _0x55ee58;})});}_0x2092b3=_[_0xb4cc('0x31')]({},_0x2092b3,_0x11c9dc[_0xb4cc('0x51')]);return _0x51061b['getAgents'](_0x2092b3);}})[_0xb4cc('0x17')](function(_0x4121da){if(_0x4121da){_0x2c49f3=_0x4121da[_0xb4cc('0x2f')];if(!_0x11c9dc['query'][_0xb4cc('0x3f')]('nolimit')){_0x2092b3['limit']=qs['limit'](_0x11c9dc[_0xb4cc('0x26')]['limit']);_0x2092b3['offset']=qs['offset'](_0x11c9dc[_0xb4cc('0x26')][_0xb4cc('0x13')]);}return _0x51061b['getAgents'](_0x2092b3);}})['then'](function(_0x1ab8c2){if(_0x1ab8c2){return _0x1ab8c2?{'count':_0x2c49f3,'rows':_0x1ab8c2}:null;}})[_0xb4cc('0x17')](respondWithResult(_0x11e57b,null))['catch'](handleError(_0x11e57b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3b64993..6ce3dc9 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 _0x4dfa=['save','update','remove','emit','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x330dc7,_0x46e2fc){var _0x43ef82=function(_0x2c8ea6){while(--_0x2c8ea6){_0x330dc7['push'](_0x330dc7['shift']());}};_0x43ef82(++_0x46e2fc);}(_0x4dfa,0x12f));var _0xa4df=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4dfa[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xa4df('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xa4df('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa4df('0x2')](0x0);var events={'afterCreate':_0xa4df('0x3'),'afterUpdate':_0xa4df('0x4'),'afterDestroy':_0xa4df('0x5')};function emitEvent(_0x14e2be){return function(_0x3ffaad,_0x6b6f92,_0x297213){FaxQueueEvents[_0xa4df('0x6')](_0x14e2be+':'+_0x3ffaad['id'],_0x3ffaad);FaxQueueEvents[_0xa4df('0x6')](_0x14e2be,_0x3ffaad);_0x297213(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xa4df('0x7')](e,emitEvent(event));}}module[_0xa4df('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x408e=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','update'];(function(_0xb0e324,_0x16fb9){var _0xdf2335=function(_0x1cbbf7){while(--_0x1cbbf7){_0xb0e324['push'](_0xb0e324['shift']());}};_0xdf2335(++_0x16fb9);}(_0x408e,0xec));var _0xe408=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x408e[_0x2543d6];return _0x55213c;};'use strict';var EventEmitter=require(_0xe408('0x0'));var FaxQueue=require(_0xe408('0x1'))['db'][_0xe408('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe408('0x3'),'afterDestroy':_0xe408('0x4')};function emitEvent(_0x1b77a1){return function(_0x479d24,_0x5baf12,_0x268cd5){FaxQueueEvents['emit'](_0x1b77a1+':'+_0x479d24['id'],_0x479d24);FaxQueueEvents[_0xe408('0x5')](_0x1b77a1,_0x479d24);_0x268cd5(null);};}for(var e in events){if(events[_0xe408('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xe408('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9dc61c2..545055c 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 _0x8d52=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x8d52,0x124));var _0x28d5=function(_0x3c3db3,_0xeac6d8){_0x3c3db3=_0x3c3db3-0x0;var _0x156be2=_0x8d52[_0x3c3db3];return _0x156be2;};'use strict';var _=require(_0x28d5('0x0'));var util=require('util');var logger=require(_0x28d5('0x1'))(_0x28d5('0x2'));var moment=require(_0x28d5('0x3'));var BPromise=require(_0x28d5('0x4'));var rp=require(_0x28d5('0x5'));var fs=require('fs');var path=require(_0x28d5('0x6'));var rimraf=require(_0x28d5('0x7'));var config=require(_0x28d5('0x8'));var attributes=require(_0x28d5('0x9'));module[_0x28d5('0xa')]=function(_0x3cf1dd,_0x5f3ce8){return _0x3cf1dd[_0x28d5('0xb')]('FaxQueue',attributes,{'tableName':_0x28d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0984=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util'];(function(_0x3c9864,_0x488a3c){var _0x416dcd=function(_0x3f03d6){while(--_0x3f03d6){_0x3c9864['push'](_0x3c9864['shift']());}};_0x416dcd(++_0x488a3c);}(_0x0984,0x136));var _0x4098=function(_0x4b6314,_0x960a41){_0x4b6314=_0x4b6314-0x0;var _0x512faa=_0x0984[_0x4b6314];return _0x512faa;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var logger=require(_0x4098('0x2'))('api');var moment=require(_0x4098('0x3'));var BPromise=require(_0x4098('0x4'));var rp=require(_0x4098('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4098('0x6'));var config=require(_0x4098('0x7'));var attributes=require(_0x4098('0x8'));module[_0x4098('0x9')]=function(_0x1206b1,_0x1ce6a2){return _0x1206b1[_0x4098('0xa')]('FaxQueue',attributes,{'tableName':_0x4098('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index cbc7f12..a3b4d30 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 _0x78d3=['debug','error','code','message','catch','FaxQueue','findAll','options','raw','where','limit','include','attributes','map','model','GetFaxQueue','stringify','find','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3d7c86,_0x4df5ad){var _0x1f7a83=function(_0x1b988f){while(--_0x1b988f){_0x3d7c86['push'](_0x3d7c86['shift']());}};_0x1f7a83(++_0x4df5ad);}(_0x78d3,0x1cb));var _0x378d=function(_0x233025,_0x3244d8){_0x233025=_0x233025-0x0;var _0x3d1000=_0x78d3[_0x233025];return _0x3d1000;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require('moment');var BPromise=require(_0x378d('0x2'));var rs=require(_0x378d('0x3'));var fs=require('fs');var Redis=require(_0x378d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x378d('0x5'));var logger=require(_0x378d('0x6'))(_0x378d('0x7'));var config=require(_0x378d('0x8'));var jayson=require(_0x378d('0x9'));var client=jayson[_0x378d('0xa')][_0x378d('0xb')]({'port':0x232a});config[_0x378d('0xc')]=_['defaults'](config[_0x378d('0xc')],{'host':_0x378d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x378d('0xe'))[_0x378d('0xf')](socket);function respondWithRpcPromise(_0x3d7872,_0x21244b,_0x254cc8){return new BPromise(function(_0x34b2fd,_0x2d1d32){return client[_0x378d('0x10')](_0x3d7872,_0x254cc8)[_0x378d('0x11')](function(_0x1b5565){logger[_0x378d('0x12')](_0x378d('0x13'),_0x21244b,_0x378d('0x14'));logger[_0x378d('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x21244b,_0x378d('0x14'),JSON['stringify'](_0x1b5565));if(_0x1b5565['error']){if(_0x1b5565[_0x378d('0x16')][_0x378d('0x17')]===0x1f4){logger[_0x378d('0x16')]('FaxQueue,\x20%s,\x20%s',_0x21244b,_0x1b5565[_0x378d('0x16')][_0x378d('0x18')]);return _0x2d1d32(_0x1b5565['error']['message']);}logger[_0x378d('0x16')](_0x378d('0x13'),_0x21244b,_0x1b5565['error'][_0x378d('0x18')]);return _0x34b2fd(_0x1b5565[_0x378d('0x16')]['message']);}else{logger['info'](_0x378d('0x13'),_0x21244b,'request\x20sent');_0x34b2fd(_0x1b5565['result'][_0x378d('0x18')]);}})[_0x378d('0x19')](function(_0x21d957){logger[_0x378d('0x16')](_0x378d('0x13'),_0x21244b,_0x21d957);_0x2d1d32(_0x21d957);});});}exports['GetFaxQueue']=function(_0x40a045){var _0x2ccece=this;return new Promise(function(_0x13c9e3,_0x497ae4){return db[_0x378d('0x1a')][_0x378d('0x1b')]({'raw':_0x40a045[_0x378d('0x1c')]?_0x40a045['options'][_0x378d('0x1d')]===undefined?!![]:![]:!![],'where':_0x40a045[_0x378d('0x1c')]?_0x40a045[_0x378d('0x1c')][_0x378d('0x1e')]||null:null,'attributes':_0x40a045[_0x378d('0x1c')]?_0x40a045[_0x378d('0x1c')]['attributes']||null:null,'limit':_0x40a045[_0x378d('0x1c')]?_0x40a045[_0x378d('0x1c')][_0x378d('0x1f')]||null:null,'include':_0x40a045[_0x378d('0x1c')]?_0x40a045[_0x378d('0x1c')]['include']?_['map'](_0x40a045[_0x378d('0x1c')][_0x378d('0x20')],function(_0x1caa03){return{'model':db[_0x1caa03['model']],'as':_0x1caa03['as'],'attributes':_0x1caa03[_0x378d('0x21')],'include':_0x1caa03[_0x378d('0x20')]?_[_0x378d('0x22')](_0x1caa03['include'],function(_0x4e18cd){return{'model':db[_0x4e18cd[_0x378d('0x23')]],'as':_0x4e18cd['as'],'attributes':_0x4e18cd[_0x378d('0x21')],'include':_0x4e18cd[_0x378d('0x20')]?_['map'](_0x4e18cd[_0x378d('0x20')],function(_0x336252){return{'model':db[_0x336252['model']],'as':_0x336252['as'],'attributes':_0x336252[_0x378d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x378d('0x11')](function(_0x1b6825){logger[_0x378d('0x12')]('GetFaxQueue',_0x40a045);logger[_0x378d('0x15')](_0x378d('0x24'),_0x40a045,JSON[_0x378d('0x25')](_0x1b6825));_0x13c9e3(_0x1b6825);})[_0x378d('0x19')](function(_0x10e857){logger[_0x378d('0x16')]('GetFaxQueue',_0x10e857[_0x378d('0x18')],_0x40a045);_0x497ae4(_0x2ccece[_0x378d('0x16')](0x1f4,_0x10e857[_0x378d('0x18')]));});});};exports['ShowFaxQueue']=function(_0x43ed49){var _0x5485dd=this;return new Promise(function(_0xd000c5,_0x3f56fb){return db[_0x378d('0x1a')][_0x378d('0x26')]({'raw':_0x43ed49[_0x378d('0x1c')]?_0x43ed49['options'][_0x378d('0x1d')]===undefined?!![]:![]:!![],'where':_0x43ed49[_0x378d('0x1c')]?_0x43ed49[_0x378d('0x1c')][_0x378d('0x1e')]||null:null,'attributes':_0x43ed49['options']?_0x43ed49[_0x378d('0x1c')][_0x378d('0x21')]||null:null,'include':_0x43ed49[_0x378d('0x1c')]?_0x43ed49[_0x378d('0x1c')][_0x378d('0x20')]?_['map'](_0x43ed49[_0x378d('0x1c')]['include'],function(_0x47d4cf){return{'model':db[_0x47d4cf[_0x378d('0x23')]],'as':_0x47d4cf['as'],'attributes':_0x47d4cf['attributes'],'include':_0x47d4cf[_0x378d('0x20')]?_[_0x378d('0x22')](_0x47d4cf[_0x378d('0x20')],function(_0x5f33d7){return{'model':db[_0x5f33d7['model']],'as':_0x5f33d7['as'],'attributes':_0x5f33d7['attributes'],'include':_0x5f33d7[_0x378d('0x20')]?_[_0x378d('0x22')](_0x5f33d7[_0x378d('0x20')],function(_0x2d961b){return{'model':db[_0x2d961b[_0x378d('0x23')]],'as':_0x2d961b['as'],'attributes':_0x2d961b[_0x378d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x378d('0x11')](function(_0x121883){logger[_0x378d('0x12')](_0x378d('0x27'),_0x43ed49);logger['debug']('ShowFaxQueue',_0x43ed49,JSON[_0x378d('0x25')](_0x121883));_0xd000c5(_0x121883);})[_0x378d('0x19')](function(_0x525bf2){logger[_0x378d('0x16')](_0x378d('0x27'),_0x525bf2[_0x378d('0x18')],_0x43ed49);_0x3f56fb(_0x5485dd[_0x378d('0x16')](0x1f4,_0x525bf2[_0x378d('0x18')]));});});}; \ No newline at end of file +var _0x668c=['FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowFaxQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue'];(function(_0x89862e,_0x56c579){var _0x145f25=function(_0x285679){while(--_0x285679){_0x89862e['push'](_0x89862e['shift']());}};_0x145f25(++_0x56c579);}(_0x668c,0x163));var _0xc668=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x668c[_0x26393b];return _0x57230a;};'use strict';var _=require('lodash');var util=require(_0xc668('0x0'));var moment=require(_0xc668('0x1'));var BPromise=require(_0xc668('0x2'));var rs=require(_0xc668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc668('0x5'))('rpc');var config=require(_0xc668('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc668('0x7')][_0xc668('0x8')]({'port':0x232a});config[_0xc668('0x9')]=_['defaults'](config[_0xc668('0x9')],{'host':_0xc668('0xa'),'port':0x18eb});var socket=require(_0xc668('0xb'))(new Redis(config[_0xc668('0x9')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x342ca4,_0x5f2074,_0x1cf446){return new BPromise(function(_0x4318f8,_0x41f815){return client[_0xc668('0xc')](_0x342ca4,_0x1cf446)['then'](function(_0x122cec){logger[_0xc668('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5f2074,_0xc668('0xe'));logger[_0xc668('0xf')](_0xc668('0x10'),_0x5f2074,_0xc668('0xe'),JSON[_0xc668('0x11')](_0x122cec));if(_0x122cec[_0xc668('0x12')]){if(_0x122cec['error'][_0xc668('0x13')]===0x1f4){logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x122cec[_0xc668('0x12')][_0xc668('0x15')]);return _0x41f815(_0x122cec['error'][_0xc668('0x15')]);}logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x122cec[_0xc668('0x12')][_0xc668('0x15')]);return _0x4318f8(_0x122cec[_0xc668('0x12')]['message']);}else{logger[_0xc668('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5f2074,_0xc668('0xe'));_0x4318f8(_0x122cec[_0xc668('0x16')][_0xc668('0x15')]);}})[_0xc668('0x17')](function(_0x211a63){logger[_0xc668('0x12')](_0xc668('0x14'),_0x5f2074,_0x211a63);_0x41f815(_0x211a63);});});}exports[_0xc668('0x18')]=function(_0x197795){var _0x149811=this;return new Promise(function(_0x4905fc,_0x439546){return db[_0xc668('0x19')][_0xc668('0x1a')]({'raw':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1c')]===undefined?!![]:![]:!![],'where':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1d')]||null:null,'attributes':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1e')]||null:null,'limit':_0x197795[_0xc668('0x1b')]?_0x197795[_0xc668('0x1b')][_0xc668('0x1f')]||null:null,'include':_0x197795['options']?_0x197795[_0xc668('0x1b')][_0xc668('0x20')]?_['map'](_0x197795['options'][_0xc668('0x20')],function(_0x30f946){return{'model':db[_0x30f946[_0xc668('0x21')]],'as':_0x30f946['as'],'attributes':_0x30f946[_0xc668('0x1e')],'include':_0x30f946[_0xc668('0x20')]?_[_0xc668('0x22')](_0x30f946[_0xc668('0x20')],function(_0x18cf94){return{'model':db[_0x18cf94[_0xc668('0x21')]],'as':_0x18cf94['as'],'attributes':_0x18cf94[_0xc668('0x1e')],'include':_0x18cf94[_0xc668('0x20')]?_[_0xc668('0x22')](_0x18cf94['include'],function(_0x16467d){return{'model':db[_0x16467d[_0xc668('0x21')]],'as':_0x16467d['as'],'attributes':_0x16467d[_0xc668('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc668('0x23')](function(_0x56beda){logger[_0xc668('0xd')](_0xc668('0x18'),_0x197795);logger['debug'](_0xc668('0x18'),_0x197795,JSON[_0xc668('0x11')](_0x56beda));_0x4905fc(_0x56beda);})[_0xc668('0x17')](function(_0x304b92){logger[_0xc668('0x12')](_0xc668('0x18'),_0x304b92[_0xc668('0x15')],_0x197795);_0x439546(_0x149811['error'](0x1f4,_0x304b92[_0xc668('0x15')]));});});};exports[_0xc668('0x24')]=function(_0x4bee75){var _0x25ef70=this;return new Promise(function(_0x2571a4,_0x342bca){return db['FaxQueue'][_0xc668('0x25')]({'raw':_0x4bee75[_0xc668('0x1b')]?_0x4bee75[_0xc668('0x1b')][_0xc668('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bee75[_0xc668('0x1b')]?_0x4bee75[_0xc668('0x1b')][_0xc668('0x1d')]||null:null,'attributes':_0x4bee75[_0xc668('0x1b')]?_0x4bee75['options'][_0xc668('0x1e')]||null:null,'include':_0x4bee75['options']?_0x4bee75[_0xc668('0x1b')]['include']?_[_0xc668('0x22')](_0x4bee75[_0xc668('0x1b')][_0xc668('0x20')],function(_0x474548){return{'model':db[_0x474548[_0xc668('0x21')]],'as':_0x474548['as'],'attributes':_0x474548[_0xc668('0x1e')],'include':_0x474548[_0xc668('0x20')]?_[_0xc668('0x22')](_0x474548[_0xc668('0x20')],function(_0x49f9b5){return{'model':db[_0x49f9b5['model']],'as':_0x49f9b5['as'],'attributes':_0x49f9b5[_0xc668('0x1e')],'include':_0x49f9b5[_0xc668('0x20')]?_[_0xc668('0x22')](_0x49f9b5['include'],function(_0x13d740){return{'model':db[_0x13d740['model']],'as':_0x13d740['as'],'attributes':_0x13d740[_0xc668('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc668('0x23')](function(_0x41bfc3){logger[_0xc668('0xd')]('ShowFaxQueue',_0x4bee75);logger[_0xc668('0xf')](_0xc668('0x24'),_0x4bee75,JSON['stringify'](_0x41bfc3));_0x2571a4(_0x41bfc3);})[_0xc668('0x17')](function(_0x54d0ac){logger['error'](_0xc668('0x24'),_0x54d0ac[_0xc668('0x15')],_0x4bee75);_0x342bca(_0x25ef70['error'](0x1f4,_0x54d0ac[_0xc668('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 824b5e0..761dca0 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 _0x5eb7=['save','remove','emit','removeListener','register','faxQueue:','./faxQueue.events'];(function(_0x48adba,_0x223b3a){var _0x29f63a=function(_0x514c3b){while(--_0x514c3b){_0x48adba['push'](_0x48adba['shift']());}};_0x29f63a(++_0x223b3a);}(_0x5eb7,0xa0));var _0x75eb=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x5eb7[_0x503790];return _0x388092;};'use strict';var FaxQueueEvents=require(_0x75eb('0x0'));var events=[_0x75eb('0x1'),_0x75eb('0x2'),'update'];function createListener(_0x58c1dd,_0x38306b){return function(_0x29535d){_0x38306b[_0x75eb('0x3')](_0x58c1dd,_0x29535d);};}function removeListener(_0x47e2f0,_0x47be4e){return function(){FaxQueueEvents[_0x75eb('0x4')](_0x47e2f0,_0x47be4e);};}exports[_0x75eb('0x5')]=function(_0x14f91a){for(var _0x2229f3=0x0,_0x16e237=events['length'];_0x2229f3<_0x16e237;_0x2229f3++){var _0x1a73bc=events[_0x2229f3];var _0x2a9037=createListener(_0x75eb('0x6')+_0x1a73bc,_0x14f91a);FaxQueueEvents['on'](_0x1a73bc,_0x2a9037);}}; \ No newline at end of file +var _0x3568=['removeListener','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x2e4a30,_0x860b8f){var _0x183e66=function(_0x2c463a){while(--_0x2c463a){_0x2e4a30['push'](_0x2e4a30['shift']());}};_0x183e66(++_0x860b8f);}(_0x3568,0xc2));var _0x8356=function(_0x4452e,_0x308b80){_0x4452e=_0x4452e-0x0;var _0x1c685b=_0x3568[_0x4452e];return _0x1c685b;};'use strict';var FaxQueueEvents=require(_0x8356('0x0'));var events=[_0x8356('0x1'),'remove',_0x8356('0x2')];function createListener(_0xe25c72,_0x5d2807){return function(_0x2fa289){_0x5d2807[_0x8356('0x3')](_0xe25c72,_0x2fa289);};}function removeListener(_0x478eb1,_0x36c20f){return function(){FaxQueueEvents[_0x8356('0x4')](_0x478eb1,_0x36c20f);};}exports['register']=function(_0xa8c6c0){for(var _0x4abfe0=0x0,_0x40b996=events['length'];_0x4abfe0<_0x40b996;_0x4abfe0++){var _0x24494c=events[_0x4abfe0];var _0x4ec2f1=createListener(_0x8356('0x5')+_0x24494c,_0xa8c6c0);FaxQueueEvents['on'](_0x24494c,_0x4ec2f1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 198f563..ed49972 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 _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','getTeams','post','create','/:id/teams','/:id/users','addAgents','put','/:id','destroy','delete','removeTeams','exports','multer','util'];(function(_0x1c5ff2,_0x46a92b){var _0x383d2e=function(_0x3323c3){while(--_0x3323c3){_0x1c5ff2['push'](_0x1c5ff2['shift']());}};_0x383d2e(++_0x46a92b);}(_0xa456,0x142));var _0x6a45=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa456[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x6a45('0x10')]('/',auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x10')](_0x6a45('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6a45('0x10')](_0x6a45('0x13'),auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x15')](_0x6a45('0x16'),auth[_0x6a45('0xa')](),controller['update']);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x17')]);router[_0x6a45('0x18')]('/:id/teams',auth[_0x6a45('0xa')](),controller[_0x6a45('0x19')]);router[_0x6a45('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6a45('0x1a')]=router; \ No newline at end of file +var _0x9206=['getTeams','/:id/users','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','/:id/teams'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0x9206,0x176));var _0x6920=function(_0x590f81,_0x4c610c){_0x590f81=_0x590f81-0x0;var _0x55f060=_0x9206[_0x590f81];return _0x55f060;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x6920('0x8')](),controller['index']);router[_0x6920('0x9')](_0x6920('0xa'),auth[_0x6920('0x8')](),controller[_0x6920('0xb')]);router['get']('/:id',auth[_0x6920('0x8')](),controller[_0x6920('0xc')]);router[_0x6920('0x9')](_0x6920('0xd'),auth[_0x6920('0x8')](),controller[_0x6920('0xe')]);router[_0x6920('0x9')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x10')]);router[_0x6920('0x9')](_0x6920('0x11'),auth[_0x6920('0x8')](),controller['getAgents']);router['post']('/',auth[_0x6920('0x8')](),controller[_0x6920('0x12')]);router['post'](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x13')]);router[_0x6920('0x14')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x15')]);router[_0x6920('0x16')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x18')]);router[_0x6920('0x19')](_0x6920('0x17'),auth[_0x6920('0x8')](),controller[_0x6920('0x1a')]);router[_0x6920('0x19')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x1b')]);router[_0x6920('0x19')](_0x6920('0x11'),auth['isAuthenticated'](),controller[_0x6920('0x1c')]);module[_0x6920('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 69a89c4..dba1615 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 _0xd488=['DATE','moment','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd488,0xe1));var _0x8d48=function(_0x69c0c2,_0x2af0bf){_0x69c0c2=_0x69c0c2-0x0;var _0x3422f6=_0xd488[_0x69c0c2];return _0x3422f6;};'use strict';var moment=require(_0x8d48('0x0'));var Sequelize=require('sequelize');module[_0x8d48('0x1')]={'uniqueid':{'type':Sequelize[_0x8d48('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8d48('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8d48('0x3')]},'acceptAt':{'type':Sequelize[_0x8d48('0x3')]},'exitAt':{'type':Sequelize[_0x8d48('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe86f=['moment','exports','STRING','DATE'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xe86f,0x78));var _0xfe86=function(_0x2ce11b,_0x1855a4){_0x2ce11b=_0x2ce11b-0x0;var _0x32fdf7=_0xe86f[_0x2ce11b];return _0x32fdf7;};'use strict';var moment=require(_0xfe86('0x0'));var Sequelize=require('sequelize');module[_0xfe86('0x1')]={'uniqueid':{'type':Sequelize[_0xfe86('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfe86('0x2')]},'joinAt':{'type':Sequelize[_0xfe86('0x3')]},'leaveAt':{'type':Sequelize[_0xfe86('0x3')]},'acceptAt':{'type':Sequelize[_0xfe86('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfe86('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f73e401..8b1f078 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 _0x5bc5=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','json','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key'];(function(_0x4633ee,_0xc061fe){var _0x5c5ac0=function(_0x29ef60){while(--_0x29ef60){_0x4633ee['push'](_0x4633ee['shift']());}};_0x5c5ac0(++_0xc061fe);}(_0x5bc5,0xb2));var _0x55bc=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x5bc5[_0x29d623];return _0x242e59;};'use strict';var emlformat=require(_0x55bc('0x0'));var rimraf=require(_0x55bc('0x1'));var zipdir=require(_0x55bc('0x2'));var jsonpatch=require(_0x55bc('0x3'));var rp=require(_0x55bc('0x4'));var moment=require(_0x55bc('0x5'));var BPromise=require(_0x55bc('0x6'));var Mustache=require(_0x55bc('0x7'));var util=require(_0x55bc('0x8'));var path=require(_0x55bc('0x9'));var sox=require(_0x55bc('0xa'));var csv=require(_0x55bc('0xb'));var ejs=require(_0x55bc('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55bc('0xd'));var squel=require(_0x55bc('0xe'));var crypto=require(_0x55bc('0xf'));var jsforce=require(_0x55bc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x55bc('0xb'));var querystring=require(_0x55bc('0x11'));var Papa=require(_0x55bc('0x12'));var Redis=require(_0x55bc('0x13'));var authService=require(_0x55bc('0x14'));var qs=require(_0x55bc('0x15'));var as=require(_0x55bc('0x16'));var hardwareService=require(_0x55bc('0x17'));var logger=require('../../config/logger')(_0x55bc('0x18'));var utils=require(_0x55bc('0x19'));var config=require(_0x55bc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x55bc('0x1b'))['db'];function respondWithStatusCode(_0x59e38c,_0xd79ff5){_0xd79ff5=_0xd79ff5||0xcc;return function(_0x2d3bd1){if(_0x2d3bd1){return _0x59e38c[_0x55bc('0x1c')](_0xd79ff5);}return _0x59e38c['status'](_0xd79ff5)[_0x55bc('0x1d')]();};}function respondWithResult(_0x52d62b,_0x14ede1){_0x14ede1=_0x14ede1||0xc8;return function(_0x234576){if(_0x234576){return _0x52d62b[_0x55bc('0x1e')](_0x14ede1)['json'](_0x234576);}};}function respondWithFilteredResult(_0x2e4d9c,_0x201ddb){return function(_0x5679f9){if(_0x5679f9){var _0x5c0547=typeof _0x201ddb[_0x55bc('0x1f')]==='undefined'&&typeof _0x201ddb['limit']===_0x55bc('0x20');var _0x184518=_0x5679f9[_0x55bc('0x21')];var _0x4e1764=_0x5c0547?0x0:_0x201ddb[_0x55bc('0x1f')];var _0x10f68f=_0x5c0547?_0x5679f9[_0x55bc('0x21')]:_0x201ddb['offset']+_0x201ddb[_0x55bc('0x22')];var _0x5e7cae;if(_0x10f68f>=_0x184518){_0x10f68f=_0x184518;_0x5e7cae=0xc8;}else{_0x5e7cae=0xce;}_0x2e4d9c[_0x55bc('0x1e')](_0x5e7cae);return _0x2e4d9c['set']('Content-Range',_0x4e1764+'-'+_0x10f68f+'/'+_0x184518)[_0x55bc('0x23')](_0x5679f9);}return null;};}function patchUpdates(_0x390af6){return function(_0x2dbfaf){try{jsonpatch['apply'](_0x2dbfaf,_0x390af6,!![]);}catch(_0x5b1960){return BPromise['reject'](_0x5b1960);}return _0x2dbfaf[_0x55bc('0x24')]();};}function saveUpdates(_0x4647ca,_0x4da0b8){return function(_0x54a473){if(_0x54a473){return _0x54a473[_0x55bc('0x25')](_0x4647ca)[_0x55bc('0x26')](function(_0x1f2135){return _0x1f2135;});}return null;};}function removeEntity(_0x22c1f2,_0x4a565e){return function(_0x21a3be){if(_0x21a3be){return _0x21a3be['destroy']()['then'](function(){_0x22c1f2[_0x55bc('0x1e')](0xcc)[_0x55bc('0x1d')]();});}};}function handleEntityNotFound(_0x229834,_0x3a1c6e){return function(_0x293bee){if(!_0x293bee){_0x229834['sendStatus'](0x194);}return _0x293bee;};}function handleError(_0x11832f,_0x46c484){_0x46c484=_0x46c484||0x1f4;return function(_0xa649a3){logger[_0x55bc('0x27')](_0xa649a3[_0x55bc('0x28')]);if(_0xa649a3[_0x55bc('0x29')]){delete _0xa649a3['name'];}_0x11832f[_0x55bc('0x1e')](_0x46c484)[_0x55bc('0x2a')](_0xa649a3);};}exports[_0x55bc('0x2b')]=function(_0x2ddee7,_0x35384c){var _0x1dce47={},_0x1268ac={},_0x29cf97={'count':0x0,'rows':[]};var _0x1d840f=_[_0x55bc('0x2c')](db[_0x55bc('0x2d')][_0x55bc('0x2e')],function(_0x5850fd){return{'name':_0x5850fd[_0x55bc('0x2f')],'type':_0x5850fd[_0x55bc('0x30')][_0x55bc('0x31')]};});_0x1268ac[_0x55bc('0x32')]=_[_0x55bc('0x2c')](_0x1d840f,'name');_0x1268ac[_0x55bc('0x33')]=_[_0x55bc('0x34')](_0x2ddee7[_0x55bc('0x33')]);_0x1268ac[_0x55bc('0x35')]=_[_0x55bc('0x36')](_0x1268ac[_0x55bc('0x32')],_0x1268ac[_0x55bc('0x33')]);_0x1dce47[_0x55bc('0x37')]=_[_0x55bc('0x36')](_0x1268ac['model'],qs[_0x55bc('0x38')](_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x38')]));_0x1dce47[_0x55bc('0x37')]=_0x1dce47[_0x55bc('0x37')][_0x55bc('0x39')]?_0x1dce47[_0x55bc('0x37')]:_0x1268ac['model'];if(!_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x3a')]('nolimit')){_0x1dce47[_0x55bc('0x22')]=qs[_0x55bc('0x22')](_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x22')]);_0x1dce47[_0x55bc('0x1f')]=qs['offset'](_0x2ddee7['query'][_0x55bc('0x1f')]);}_0x1dce47[_0x55bc('0x3b')]=qs[_0x55bc('0x3c')](_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x3c')]);_0x1dce47[_0x55bc('0x3d')]=qs[_0x55bc('0x35')](_[_0x55bc('0x3e')](_0x2ddee7['query'],_0x1268ac[_0x55bc('0x35')]),_0x1d840f);if(_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x3f')]){_0x1dce47['where']=_['merge'](_0x1dce47[_0x55bc('0x3d')],{'$or':_[_0x55bc('0x2c')](_0x1d840f,function(_0x379e93){if(_0x379e93[_0x55bc('0x30')]!=='VIRTUAL'){var _0xdce598={};_0xdce598[_0x379e93[_0x55bc('0x29')]]={'$like':'%'+_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x3f')]+'%'};return _0xdce598;}})});}_0x1dce47=_[_0x55bc('0x40')]({},_0x1dce47,_0x2ddee7[_0x55bc('0x41')]);var _0x334e24={'where':_0x1dce47[_0x55bc('0x3d')]};return db['FaxQueueReport'][_0x55bc('0x21')](_0x334e24)[_0x55bc('0x26')](function(_0x3d74fb){_0x29cf97[_0x55bc('0x21')]=_0x3d74fb;if(_0x2ddee7[_0x55bc('0x33')][_0x55bc('0x42')]){_0x1dce47[_0x55bc('0x43')]=[{'all':!![]}];}return db[_0x55bc('0x2d')]['findAll'](_0x1dce47);})[_0x55bc('0x26')](function(_0x2eb814){_0x29cf97['rows']=_0x2eb814;return _0x29cf97;})[_0x55bc('0x26')](respondWithFilteredResult(_0x35384c,_0x1dce47))[_0x55bc('0x44')](handleError(_0x35384c,null));};exports[_0x55bc('0x45')]=function(_0xcee68f,_0x246a12){var _0x21a463={'raw':!![],'where':{'id':_0xcee68f['params']['id']}},_0x402053={};_0x402053[_0x55bc('0x32')]=_[_0x55bc('0x34')](db[_0x55bc('0x2d')]['rawAttributes']);_0x402053[_0x55bc('0x33')]=_[_0x55bc('0x34')](_0xcee68f[_0x55bc('0x33')]);_0x402053[_0x55bc('0x35')]=_['intersection'](_0x402053[_0x55bc('0x32')],_0x402053['query']);_0x21a463['attributes']=_[_0x55bc('0x36')](_0x402053['model'],qs[_0x55bc('0x38')](_0xcee68f[_0x55bc('0x33')][_0x55bc('0x38')]));_0x21a463[_0x55bc('0x37')]=_0x21a463['attributes']['length']?_0x21a463['attributes']:_0x402053['model'];if(_0xcee68f[_0x55bc('0x33')][_0x55bc('0x42')]){_0x21a463['include']=[{'all':!![]}];}_0x21a463=_[_0x55bc('0x40')]({},_0x21a463,_0xcee68f[_0x55bc('0x41')]);return db[_0x55bc('0x2d')][_0x55bc('0x46')](_0x21a463)['then'](handleEntityNotFound(_0x246a12,null))[_0x55bc('0x26')](respondWithResult(_0x246a12,null))[_0x55bc('0x44')](handleError(_0x246a12,null));};exports[_0x55bc('0x47')]=function(_0x3fa30b,_0x337056){return db['FaxQueueReport'][_0x55bc('0x47')](_0x3fa30b[_0x55bc('0x48')],{})[_0x55bc('0x26')](respondWithResult(_0x337056,0xc9))[_0x55bc('0x44')](handleError(_0x337056,null));};exports[_0x55bc('0x25')]=function(_0x44d617,_0x9ce80){if(_0x44d617['body']['id']){delete _0x44d617[_0x55bc('0x48')]['id'];}return db[_0x55bc('0x2d')][_0x55bc('0x46')]({'where':{'id':_0x44d617[_0x55bc('0x49')]['id']}})[_0x55bc('0x26')](handleEntityNotFound(_0x9ce80,null))[_0x55bc('0x26')](saveUpdates(_0x44d617[_0x55bc('0x48')],null))[_0x55bc('0x26')](respondWithResult(_0x9ce80,null))[_0x55bc('0x44')](handleError(_0x9ce80,null));};exports[_0x55bc('0x4a')]=function(_0x2966d6,_0x20435a){return db[_0x55bc('0x2d')][_0x55bc('0x46')]({'where':{'id':_0x2966d6['params']['id']}})['then'](handleEntityNotFound(_0x20435a,null))[_0x55bc('0x26')](removeEntity(_0x20435a,null))[_0x55bc('0x44')](handleError(_0x20435a,null));};exports[_0x55bc('0x4b')]=function(_0x4c161c,_0x42847b){return db['FaxQueueReport'][_0x55bc('0x4b')]()['then'](respondWithResult(_0x42847b,null))[_0x55bc('0x44')](handleError(_0x42847b,null));}; \ No newline at end of file +var _0x32c0=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x32c0,0x1f3));var _0x032c=function(_0x177acc,_0x22a677){_0x177acc=_0x177acc-0x0;var _0x4d3a4e=_0x32c0[_0x177acc];return _0x4d3a4e;};'use strict';var emlformat=require(_0x032c('0x0'));var rimraf=require(_0x032c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032c('0x2'));var rp=require(_0x032c('0x3'));var moment=require('moment');var BPromise=require(_0x032c('0x4'));var Mustache=require(_0x032c('0x5'));var util=require(_0x032c('0x6'));var path=require(_0x032c('0x7'));var sox=require('sox');var csv=require(_0x032c('0x8'));var ejs=require(_0x032c('0x9'));var fs=require('fs');var fs_extra=require(_0x032c('0xa'));var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af77,_0xc88e78){_0xc88e78=_0xc88e78||0xcc;return function(_0x364605){if(_0x364605){return _0x25af77[_0x032c('0x16')](_0xc88e78);}return _0x25af77['status'](_0xc88e78)[_0x032c('0x17')]();};}function respondWithResult(_0x2650d6,_0x1ec9d8){_0x1ec9d8=_0x1ec9d8||0xc8;return function(_0x216984){if(_0x216984){return _0x2650d6[_0x032c('0x18')](_0x1ec9d8)[_0x032c('0x19')](_0x216984);}};}function respondWithFilteredResult(_0x51266f,_0xb678d5){return function(_0x15ddb8){if(_0x15ddb8){var _0x3ebda8=typeof _0xb678d5[_0x032c('0x1a')]===_0x032c('0x1b')&&typeof _0xb678d5[_0x032c('0x1c')]==='undefined';var _0x1444bb=_0x15ddb8[_0x032c('0x1d')];var _0x4435ad=_0x3ebda8?0x0:_0xb678d5[_0x032c('0x1a')];var _0x2b2693=_0x3ebda8?_0x15ddb8[_0x032c('0x1d')]:_0xb678d5[_0x032c('0x1a')]+_0xb678d5[_0x032c('0x1c')];var _0x3a6f71;if(_0x2b2693>=_0x1444bb){_0x2b2693=_0x1444bb;_0x3a6f71=0xc8;}else{_0x3a6f71=0xce;}_0x51266f[_0x032c('0x18')](_0x3a6f71);return _0x51266f[_0x032c('0x1e')](_0x032c('0x1f'),_0x4435ad+'-'+_0x2b2693+'/'+_0x1444bb)[_0x032c('0x19')](_0x15ddb8);}return null;};}function patchUpdates(_0x515409){return function(_0x8a8f30){try{jsonpatch['apply'](_0x8a8f30,_0x515409,!![]);}catch(_0x5341e6){return BPromise['reject'](_0x5341e6);}return _0x8a8f30['save']();};}function saveUpdates(_0x2a24f7,_0x4c0c4b){return function(_0x2ce758){if(_0x2ce758){return _0x2ce758[_0x032c('0x20')](_0x2a24f7)[_0x032c('0x21')](function(_0x51ad8c){return _0x51ad8c;});}return null;};}function removeEntity(_0x135612,_0x16d40f){return function(_0x28ae24){if(_0x28ae24){return _0x28ae24[_0x032c('0x22')]()[_0x032c('0x21')](function(){_0x135612[_0x032c('0x18')](0xcc)[_0x032c('0x17')]();});}};}function handleEntityNotFound(_0x58894b,_0x16ed08){return function(_0x1a0881){if(!_0x1a0881){_0x58894b[_0x032c('0x16')](0x194);}return _0x1a0881;};}function handleError(_0x56d20d,_0x1350d1){_0x1350d1=_0x1350d1||0x1f4;return function(_0x19ed06){logger[_0x032c('0x23')](_0x19ed06[_0x032c('0x24')]);if(_0x19ed06['name']){delete _0x19ed06[_0x032c('0x25')];}_0x56d20d[_0x032c('0x18')](_0x1350d1)[_0x032c('0x26')](_0x19ed06);};}exports[_0x032c('0x27')]=function(_0x51d679,_0x119d8f){var _0x1de595={},_0x5cdd90={},_0x659bbf={'count':0x0,'rows':[]};var _0x306935=_[_0x032c('0x28')](db[_0x032c('0x29')]['rawAttributes'],function(_0x50a3f8){return{'name':_0x50a3f8[_0x032c('0x2a')],'type':_0x50a3f8['type'][_0x032c('0x2b')]};});_0x5cdd90[_0x032c('0x2c')]=_['map'](_0x306935,_0x032c('0x25'));_0x5cdd90[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x51d679[_0x032c('0x2d')]);_0x5cdd90['filters']=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],_0x5cdd90['query']);_0x1de595[_0x032c('0x30')]=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],qs[_0x032c('0x31')](_0x51d679[_0x032c('0x2d')]['fields']));_0x1de595[_0x032c('0x30')]=_0x1de595['attributes'][_0x032c('0x32')]?_0x1de595['attributes']:_0x5cdd90[_0x032c('0x2c')];if(!_0x51d679[_0x032c('0x2d')][_0x032c('0x33')](_0x032c('0x34'))){_0x1de595[_0x032c('0x1c')]=qs[_0x032c('0x1c')](_0x51d679['query'][_0x032c('0x1c')]);_0x1de595[_0x032c('0x1a')]=qs['offset'](_0x51d679[_0x032c('0x2d')][_0x032c('0x1a')]);}_0x1de595[_0x032c('0x35')]=qs['sort'](_0x51d679[_0x032c('0x2d')][_0x032c('0x36')]);_0x1de595[_0x032c('0x37')]=qs[_0x032c('0x38')](_[_0x032c('0x39')](_0x51d679[_0x032c('0x2d')],_0x5cdd90[_0x032c('0x38')]),_0x306935);if(_0x51d679['query'][_0x032c('0x3a')]){_0x1de595[_0x032c('0x37')]=_[_0x032c('0x3b')](_0x1de595[_0x032c('0x37')],{'$or':_[_0x032c('0x28')](_0x306935,function(_0xf27830){if(_0xf27830[_0x032c('0x3c')]!==_0x032c('0x3d')){var _0x4bba77={};_0x4bba77[_0xf27830[_0x032c('0x25')]]={'$like':'%'+_0x51d679['query'][_0x032c('0x3a')]+'%'};return _0x4bba77;}})});}_0x1de595=_['merge']({},_0x1de595,_0x51d679['options']);var _0x238291={'where':_0x1de595[_0x032c('0x37')]};return db['FaxQueueReport']['count'](_0x238291)[_0x032c('0x21')](function(_0x4c6c2b){_0x659bbf['count']=_0x4c6c2b;if(_0x51d679[_0x032c('0x2d')][_0x032c('0x3e')]){_0x1de595[_0x032c('0x3f')]=[{'all':!![]}];}return db[_0x032c('0x29')][_0x032c('0x40')](_0x1de595);})[_0x032c('0x21')](function(_0x49b83a){_0x659bbf[_0x032c('0x41')]=_0x49b83a;return _0x659bbf;})['then'](respondWithFilteredResult(_0x119d8f,_0x1de595))['catch'](handleError(_0x119d8f,null));};exports[_0x032c('0x42')]=function(_0x15ebeb,_0x2035d5){var _0x235ad6={'raw':!![],'where':{'id':_0x15ebeb['params']['id']}},_0x47360a={};_0x47360a['model']=_[_0x032c('0x2e')](db['FaxQueueReport'][_0x032c('0x43')]);_0x47360a[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x15ebeb[_0x032c('0x2d')]);_0x47360a[_0x032c('0x38')]=_[_0x032c('0x2f')](_0x47360a[_0x032c('0x2c')],_0x47360a[_0x032c('0x2d')]);_0x235ad6[_0x032c('0x30')]=_['intersection'](_0x47360a[_0x032c('0x2c')],qs['fields'](_0x15ebeb['query'][_0x032c('0x31')]));_0x235ad6[_0x032c('0x30')]=_0x235ad6[_0x032c('0x30')][_0x032c('0x32')]?_0x235ad6[_0x032c('0x30')]:_0x47360a['model'];if(_0x15ebeb['query']['includeAll']){_0x235ad6[_0x032c('0x3f')]=[{'all':!![]}];}_0x235ad6=_['merge']({},_0x235ad6,_0x15ebeb[_0x032c('0x44')]);return db[_0x032c('0x29')]['find'](_0x235ad6)[_0x032c('0x21')](handleEntityNotFound(_0x2035d5,null))[_0x032c('0x21')](respondWithResult(_0x2035d5,null))[_0x032c('0x45')](handleError(_0x2035d5,null));};exports[_0x032c('0x46')]=function(_0x3a877a,_0x26e988){return db[_0x032c('0x29')][_0x032c('0x46')](_0x3a877a[_0x032c('0x47')],{})['then'](respondWithResult(_0x26e988,0xc9))[_0x032c('0x45')](handleError(_0x26e988,null));};exports['update']=function(_0x367638,_0x13f1a7){if(_0x367638[_0x032c('0x47')]['id']){delete _0x367638[_0x032c('0x47')]['id'];}return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x367638[_0x032c('0x49')]['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x13f1a7,null))[_0x032c('0x21')](saveUpdates(_0x367638['body'],null))[_0x032c('0x21')](respondWithResult(_0x13f1a7,null))['catch'](handleError(_0x13f1a7,null));};exports[_0x032c('0x22')]=function(_0x2f1032,_0x4e8fd6){return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x2f1032['params']['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x4e8fd6,null))[_0x032c('0x21')](removeEntity(_0x4e8fd6,null))[_0x032c('0x45')](handleError(_0x4e8fd6,null));};exports['describe']=function(_0x43efaa,_0xf7d545){return db[_0x032c('0x29')][_0x032c('0x4a')]()[_0x032c('0x21')](respondWithResult(_0xf7d545,null))[_0x032c('0x45')](handleError(_0xf7d545,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 280ccba..f5a5637 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x74b077,_0x100da0){var _0xcea32d=function(_0x566b2f){while(--_0x566b2f){_0x74b077['push'](_0x74b077['shift']());}};_0xcea32d(++_0x100da0);}(_0x7a54,0x106));var _0x47a5=function(_0x2a4069,_0x3e1185){_0x2a4069=_0x2a4069-0x0;var _0x16679e=_0x7a54[_0x2a4069];return _0x16679e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x4488dc,_0x1a9033){var _0x37f653=function(_0x205972){while(--_0x205972){_0x4488dc['push'](_0x4488dc['shift']());}};_0x37f653(++_0x1a9033);}(_0xf494,0x1c6));var _0x4f49=function(_0x4f9610,_0x3fcaa4){_0x4f9610=_0x4f9610-0x0;var _0x24c209=_0xf494[_0x4f9610];return _0x24c209;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 93af3b0..96b88cc 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 _0xf9bb=['CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','catch','UpdateFaxQueueReport','update','where','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result'];(function(_0x562f51,_0x155f4d){var _0x43131c=function(_0x549b36){while(--_0x549b36){_0x562f51['push'](_0x562f51['shift']());}};_0x43131c(++_0x155f4d);}(_0xf9bb,0x184));var _0xbf9b=function(_0xbb4e02,_0x1cac95){_0xbb4e02=_0xbb4e02-0x0;var _0x50ac16=_0xf9bb[_0xbb4e02];return _0x50ac16;};'use strict';var _=require(_0xbf9b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf9b('0x1'));var rs=require(_0xbf9b('0x2'));var fs=require('fs');var Redis=require(_0xbf9b('0x3'));var db=require(_0xbf9b('0x4'))['db'];var utils=require(_0xbf9b('0x5'));var logger=require(_0xbf9b('0x6'))(_0xbf9b('0x7'));var config=require(_0xbf9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf9b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5345,_0x3d6db8,_0x287af5){return new BPromise(function(_0x202b7e,_0x281e92){return client[_0xbf9b('0xa')](_0x3d5345,_0x287af5)[_0xbf9b('0xb')](function(_0x31cc3f){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3d6db8,_0xbf9b('0xc'));logger['debug'](_0xbf9b('0xd'),_0x3d6db8,_0xbf9b('0xc'),JSON['stringify'](_0x31cc3f));if(_0x31cc3f[_0xbf9b('0xe')]){if(_0x31cc3f[_0xbf9b('0xe')][_0xbf9b('0xf')]===0x1f4){logger[_0xbf9b('0xe')](_0xbf9b('0x10'),_0x3d6db8,_0x31cc3f[_0xbf9b('0xe')][_0xbf9b('0x11')]);return _0x281e92(_0x31cc3f[_0xbf9b('0xe')][_0xbf9b('0x11')]);}logger[_0xbf9b('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x3d6db8,_0x31cc3f[_0xbf9b('0xe')][_0xbf9b('0x11')]);return _0x202b7e(_0x31cc3f[_0xbf9b('0xe')][_0xbf9b('0x11')]);}else{logger[_0xbf9b('0x12')](_0xbf9b('0x10'),_0x3d6db8,_0xbf9b('0xc'));_0x202b7e(_0x31cc3f[_0xbf9b('0x13')][_0xbf9b('0x11')]);}})['catch'](function(_0x3be6aa){logger[_0xbf9b('0xe')](_0xbf9b('0x10'),_0x3d6db8,_0x3be6aa);_0x281e92(_0x3be6aa);});});}exports[_0xbf9b('0x14')]=function(_0x398d8d){var _0x338fd9=this;return new Promise(function(_0x53a36b,_0x13711b){return db[_0xbf9b('0x15')][_0xbf9b('0x16')](_0x398d8d[_0xbf9b('0x17')],{'raw':_0x398d8d[_0xbf9b('0x18')]?_0x398d8d[_0xbf9b('0x18')][_0xbf9b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x132928){logger[_0xbf9b('0x12')]('CreateFaxQueueReport',_0x398d8d);logger[_0xbf9b('0x1a')](_0xbf9b('0x14'),_0x398d8d,JSON['stringify'](_0x132928));_0x53a36b(_0x132928);})[_0xbf9b('0x1b')](function(_0x22f99e){logger[_0xbf9b('0xe')]('CreateFaxQueueReport',_0x22f99e[_0xbf9b('0x11')],_0x398d8d);_0x13711b(_0x338fd9[_0xbf9b('0xe')](0x1f4,_0x22f99e[_0xbf9b('0x11')]));});});};exports[_0xbf9b('0x1c')]=function(_0x342d3f){var _0x505cd0=this;return new Promise(function(_0x230416,_0xf3dbcd){return db[_0xbf9b('0x15')][_0xbf9b('0x1d')](_0x342d3f['body'],{'raw':_0x342d3f[_0xbf9b('0x18')]?_0x342d3f['options'][_0xbf9b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342d3f['options']?_0x342d3f[_0xbf9b('0x18')][_0xbf9b('0x1e')]||null:null,'attributes':_0x342d3f[_0xbf9b('0x18')]?_0x342d3f[_0xbf9b('0x18')][_0xbf9b('0x1f')]||null:null,'limit':_0x342d3f['options']?_0x342d3f[_0xbf9b('0x18')][_0xbf9b('0x20')]||null:null})[_0xbf9b('0xb')](function(_0x4de53d){logger[_0xbf9b('0x12')](_0xbf9b('0x1c'),_0x342d3f);logger[_0xbf9b('0x1a')](_0xbf9b('0x1c'),_0x342d3f,JSON[_0xbf9b('0x21')](_0x4de53d));_0x230416(_0x4de53d);})[_0xbf9b('0x1b')](function(_0x2e62d2){logger[_0xbf9b('0xe')](_0xbf9b('0x1c'),_0x2e62d2[_0xbf9b('0x11')],_0x342d3f);_0xf3dbcd(_0x505cd0[_0xbf9b('0xe')](0x1f4,_0x2e62d2['message']));});});}; \ No newline at end of file +var _0x7335=['limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','attributes'];(function(_0x3c08f0,_0x1d75cf){var _0x580c0d=function(_0x2525ef){while(--_0x2525ef){_0x3c08f0['push'](_0x3c08f0['shift']());}};_0x580c0d(++_0x1d75cf);}(_0x7335,0x111));var _0x5733=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x7335[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x5733('0x0'));var moment=require(_0x5733('0x1'));var BPromise=require('bluebird');var rs=require(_0x5733('0x2'));var fs=require('fs');var Redis=require(_0x5733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5733('0x4'));var logger=require(_0x5733('0x5'))(_0x5733('0x6'));var config=require(_0x5733('0x7'));var jayson=require(_0x5733('0x8'));var client=jayson[_0x5733('0x9')][_0x5733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32f873,_0x4e1855,_0x5d8cf5){return new BPromise(function(_0x4396a1,_0x5bd6d6){return client['request'](_0x32f873,_0x5d8cf5)[_0x5733('0xb')](function(_0x2df540){logger[_0x5733('0xc')](_0x5733('0xd'),_0x4e1855,_0x5733('0xe'));logger[_0x5733('0xf')](_0x5733('0x10'),_0x4e1855,_0x5733('0xe'),JSON[_0x5733('0x11')](_0x2df540));if(_0x2df540[_0x5733('0x12')]){if(_0x2df540[_0x5733('0x12')][_0x5733('0x13')]===0x1f4){logger[_0x5733('0x12')](_0x5733('0xd'),_0x4e1855,_0x2df540['error']['message']);return _0x5bd6d6(_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);}logger[_0x5733('0x12')](_0x5733('0xd'),_0x4e1855,_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);return _0x4396a1(_0x2df540[_0x5733('0x12')][_0x5733('0x14')]);}else{logger[_0x5733('0xc')](_0x5733('0xd'),_0x4e1855,_0x5733('0xe'));_0x4396a1(_0x2df540[_0x5733('0x15')][_0x5733('0x14')]);}})[_0x5733('0x16')](function(_0x46e924){logger['error'](_0x5733('0xd'),_0x4e1855,_0x46e924);_0x5bd6d6(_0x46e924);});});}exports[_0x5733('0x17')]=function(_0x1449f6){var _0x43ac73=this;return new Promise(function(_0x2d8364,_0xedfaeb){return db[_0x5733('0x18')][_0x5733('0x19')](_0x1449f6['body'],{'raw':_0x1449f6[_0x5733('0x1a')]?_0x1449f6[_0x5733('0x1a')][_0x5733('0x1b')]===undefined?!![]:![]:!![]})[_0x5733('0xb')](function(_0x318664){logger['info'](_0x5733('0x17'),_0x1449f6);logger[_0x5733('0xf')]('CreateFaxQueueReport',_0x1449f6,JSON[_0x5733('0x11')](_0x318664));_0x2d8364(_0x318664);})[_0x5733('0x16')](function(_0xa17378){logger[_0x5733('0x12')](_0x5733('0x17'),_0xa17378[_0x5733('0x14')],_0x1449f6);_0xedfaeb(_0x43ac73[_0x5733('0x12')](0x1f4,_0xa17378[_0x5733('0x14')]));});});};exports[_0x5733('0x1c')]=function(_0x37dc8a){var _0x27c541=this;return new Promise(function(_0x1077c3,_0x1b1d91){return db[_0x5733('0x18')][_0x5733('0x1d')](_0x37dc8a[_0x5733('0x1e')],{'raw':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a['options'][_0x5733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37dc8a['options']?_0x37dc8a['options'][_0x5733('0x1f')]||null:null,'attributes':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a[_0x5733('0x1a')][_0x5733('0x20')]||null:null,'limit':_0x37dc8a[_0x5733('0x1a')]?_0x37dc8a[_0x5733('0x1a')][_0x5733('0x21')]||null:null})[_0x5733('0xb')](function(_0x214541){logger[_0x5733('0xc')]('UpdateFaxQueueReport',_0x37dc8a);logger[_0x5733('0xf')](_0x5733('0x1c'),_0x37dc8a,JSON[_0x5733('0x11')](_0x214541));_0x1077c3(_0x214541);})[_0x5733('0x16')](function(_0x5739d9){logger[_0x5733('0x12')]('UpdateFaxQueueReport',_0x5739d9[_0x5733('0x14')],_0x37dc8a);_0x1b1d91(_0x27c541[_0x5733('0x12')](0x1f4,_0x5739d9[_0x5733('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 09049f8..2186bf2 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 _0xf254=['../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','delete','exports','multer','connect-timeout','express'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0xf254,0x165));var _0x4f25=function(_0x490e0a,_0x1eca50){_0x490e0a=_0x490e0a-0x0;var _0x212ff2=_0xf254[_0x490e0a];return _0x212ff2;};'use strict';var multer=require(_0x4f25('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f25('0x1'));var express=require(_0x4f25('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f25('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4f25('0x4'));var controller=require(_0x4f25('0x5'));router[_0x4f25('0x6')]('/',auth[_0x4f25('0x7')](),controller[_0x4f25('0x8')]);router[_0x4f25('0x6')]('/describe',auth[_0x4f25('0x7')](),controller[_0x4f25('0x9')]);router[_0x4f25('0x6')](_0x4f25('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4f25('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f25('0xc')](_0x4f25('0xa'),auth[_0x4f25('0x7')](),controller['update']);router[_0x4f25('0xd')](_0x4f25('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f25('0xe')]=router; \ No newline at end of file +var _0xdcf8=['../../components/auth/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','post','create','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x3c4d82,_0x456bf3){var _0x3e69d5=function(_0x3d7c67){while(--_0x3d7c67){_0x3c4d82['push'](_0x3c4d82['shift']());}};_0x3e69d5(++_0x456bf3);}(_0xdcf8,0x1ab));var _0x8dcf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdcf8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8dcf('0x0'));var util=require(_0x8dcf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8dcf('0x2'));var router=express[_0x8dcf('0x3')]();var fs_extra=require(_0x8dcf('0x4'));var auth=require(_0x8dcf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8dcf('0x6'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8dcf('0x7'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0x9')]);router[_0x8dcf('0xa')](_0x8dcf('0xb'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xc')]);router[_0x8dcf('0xd')]('/',auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xe')]);router['put'](_0x8dcf('0xb'),auth[_0x8dcf('0x8')](),controller[_0x8dcf('0xf')]);router[_0x8dcf('0x10')](_0x8dcf('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8dcf('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c1e2fa2..7537529 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4528cf,_0x3b1892){var _0x4bca53=function(_0x47d77b){while(--_0x47d77b){_0x4528cf['push'](_0x4528cf['shift']());}};_0x4bca53(++_0x3b1892);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5d9cb7,_0x221b75){_0x5d9cb7=_0x5d9cb7-0x0;var _0xb6449=_0xb43b[_0x5d9cb7];return _0xb6449;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ee6563f..e354240 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 _0x9e22=['../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','apply','save','update','destroy','then','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1da407,_0xe685a8){var _0xb3605e=function(_0x20e0f6){while(--_0x20e0f6){_0x1da407['push'](_0x1da407['shift']());}};_0xb3605e(++_0xe685a8);}(_0x9e22,0x10c));var _0x29e2=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x9e22[_0x49aa7d];return _0xdd0d26;};'use strict';var emlformat=require(_0x29e2('0x0'));var rimraf=require(_0x29e2('0x1'));var zipdir=require(_0x29e2('0x2'));var jsonpatch=require(_0x29e2('0x3'));var rp=require(_0x29e2('0x4'));var moment=require(_0x29e2('0x5'));var BPromise=require(_0x29e2('0x6'));var Mustache=require(_0x29e2('0x7'));var util=require('util');var path=require(_0x29e2('0x8'));var sox=require(_0x29e2('0x9'));var csv=require(_0x29e2('0xa'));var ejs=require(_0x29e2('0xb'));var fs=require('fs');var fs_extra=require(_0x29e2('0xc'));var _=require(_0x29e2('0xd'));var squel=require('squel');var crypto=require(_0x29e2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x29e2('0xf'));var toCsv=require(_0x29e2('0xa'));var querystring=require(_0x29e2('0x10'));var Papa=require('papaparse');var Redis=require(_0x29e2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x29e2('0x12'));var as=require(_0x29e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29e2('0x14'))(_0x29e2('0x15'));var utils=require(_0x29e2('0x16'));var config=require(_0x29e2('0x17'));var licenseUtil=require(_0x29e2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131cf0,_0x5a043b){_0x5a043b=_0x5a043b||0xcc;return function(_0x355331){if(_0x355331){return _0x131cf0[_0x29e2('0x19')](_0x5a043b);}return _0x131cf0[_0x29e2('0x1a')](_0x5a043b)[_0x29e2('0x1b')]();};}function respondWithResult(_0x1be7d8,_0x3ca1c9){_0x3ca1c9=_0x3ca1c9||0xc8;return function(_0x57bff4){if(_0x57bff4){return _0x1be7d8['status'](_0x3ca1c9)[_0x29e2('0x1c')](_0x57bff4);}};}function respondWithFilteredResult(_0x14c268,_0x1a933f){return function(_0x37fc3d){if(_0x37fc3d){var _0x387987=typeof _0x1a933f['offset']==='undefined'&&typeof _0x1a933f[_0x29e2('0x1d')]===_0x29e2('0x1e');var _0x43302d=_0x37fc3d[_0x29e2('0x1f')];var _0x1b9d1b=_0x387987?0x0:_0x1a933f[_0x29e2('0x20')];var _0x4466ac=_0x387987?_0x37fc3d[_0x29e2('0x1f')]:_0x1a933f[_0x29e2('0x20')]+_0x1a933f['limit'];var _0x259e93;if(_0x4466ac>=_0x43302d){_0x4466ac=_0x43302d;_0x259e93=0xc8;}else{_0x259e93=0xce;}_0x14c268['status'](_0x259e93);return _0x14c268['set']('Content-Range',_0x1b9d1b+'-'+_0x4466ac+'/'+_0x43302d)['json'](_0x37fc3d);}return null;};}function patchUpdates(_0x259e89){return function(_0x184f6d){try{jsonpatch[_0x29e2('0x21')](_0x184f6d,_0x259e89,!![]);}catch(_0x3aee9f){return BPromise['reject'](_0x3aee9f);}return _0x184f6d[_0x29e2('0x22')]();};}function saveUpdates(_0x4ba52c,_0x508153){return function(_0x2af7f9){if(_0x2af7f9){return _0x2af7f9[_0x29e2('0x23')](_0x4ba52c)['then'](function(_0x3b62f9){return _0x3b62f9;});}return null;};}function removeEntity(_0x1ef4e3,_0x55cd39){return function(_0x393117){if(_0x393117){return _0x393117[_0x29e2('0x24')]()[_0x29e2('0x25')](function(){_0x1ef4e3[_0x29e2('0x1a')](0xcc)[_0x29e2('0x1b')]();});}};}function handleEntityNotFound(_0x621ef1,_0xb55df2){return function(_0x48a7cd){if(!_0x48a7cd){_0x621ef1[_0x29e2('0x19')](0x194);}return _0x48a7cd;};}function handleError(_0x3f72cc,_0x2e4f5d){_0x2e4f5d=_0x2e4f5d||0x1f4;return function(_0x3c9d37){logger['error'](_0x3c9d37[_0x29e2('0x26')]);if(_0x3c9d37[_0x29e2('0x27')]){delete _0x3c9d37[_0x29e2('0x27')];}_0x3f72cc[_0x29e2('0x1a')](_0x2e4f5d)[_0x29e2('0x28')](_0x3c9d37);};}exports[_0x29e2('0x29')]=function(_0x577d65,_0x5e5d79){var _0x4c1642={},_0x5625ed={},_0x18add4={'count':0x0,'rows':[]};var _0x319868=_[_0x29e2('0x2a')](db[_0x29e2('0x2b')][_0x29e2('0x2c')],function(_0x3eb8ac){return{'name':_0x3eb8ac['fieldName'],'type':_0x3eb8ac[_0x29e2('0x2d')][_0x29e2('0x2e')]};});_0x5625ed[_0x29e2('0x2f')]=_[_0x29e2('0x2a')](_0x319868,_0x29e2('0x27'));_0x5625ed[_0x29e2('0x30')]=_[_0x29e2('0x31')](_0x577d65[_0x29e2('0x30')]);_0x5625ed[_0x29e2('0x32')]=_['intersection'](_0x5625ed[_0x29e2('0x2f')],_0x5625ed[_0x29e2('0x30')]);_0x4c1642[_0x29e2('0x33')]=_[_0x29e2('0x34')](_0x5625ed['model'],qs['fields'](_0x577d65[_0x29e2('0x30')]['fields']));_0x4c1642[_0x29e2('0x33')]=_0x4c1642[_0x29e2('0x33')][_0x29e2('0x35')]?_0x4c1642[_0x29e2('0x33')]:_0x5625ed[_0x29e2('0x2f')];if(!_0x577d65[_0x29e2('0x30')][_0x29e2('0x36')](_0x29e2('0x37'))){_0x4c1642[_0x29e2('0x1d')]=qs['limit'](_0x577d65['query'][_0x29e2('0x1d')]);_0x4c1642[_0x29e2('0x20')]=qs[_0x29e2('0x20')](_0x577d65[_0x29e2('0x30')][_0x29e2('0x20')]);}_0x4c1642[_0x29e2('0x38')]=qs['sort'](_0x577d65[_0x29e2('0x30')][_0x29e2('0x39')]);_0x4c1642[_0x29e2('0x3a')]=qs[_0x29e2('0x32')](_[_0x29e2('0x3b')](_0x577d65[_0x29e2('0x30')],_0x5625ed[_0x29e2('0x32')]),_0x319868);if(_0x577d65[_0x29e2('0x30')][_0x29e2('0x3c')]){_0x4c1642['where']=_['merge'](_0x4c1642[_0x29e2('0x3a')],{'$or':_[_0x29e2('0x2a')](_0x319868,function(_0x1f38ad){if(_0x1f38ad[_0x29e2('0x2d')]!==_0x29e2('0x3d')){var _0xf154a3={};_0xf154a3[_0x1f38ad[_0x29e2('0x27')]]={'$like':'%'+_0x577d65[_0x29e2('0x30')]['filter']+'%'};return _0xf154a3;}})});}_0x4c1642=_[_0x29e2('0x3e')]({},_0x4c1642,_0x577d65[_0x29e2('0x3f')]);var _0x4cf376={'where':_0x4c1642[_0x29e2('0x3a')]};return db[_0x29e2('0x2b')]['count'](_0x4cf376)['then'](function(_0x456d8e){_0x18add4[_0x29e2('0x1f')]=_0x456d8e;if(_0x577d65[_0x29e2('0x30')][_0x29e2('0x40')]){_0x4c1642[_0x29e2('0x41')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x4c1642);})['then'](function(_0x2ecfe3){_0x18add4['rows']=_0x2ecfe3;return _0x18add4;})[_0x29e2('0x25')](respondWithFilteredResult(_0x5e5d79,_0x4c1642))[_0x29e2('0x42')](handleError(_0x5e5d79,null));};exports['show']=function(_0x1a5830,_0x1337d0){var _0x22d182={'raw':!![],'where':{'id':_0x1a5830['params']['id']}},_0x4ac682={};_0x4ac682[_0x29e2('0x2f')]=_[_0x29e2('0x31')](db[_0x29e2('0x2b')][_0x29e2('0x2c')]);_0x4ac682[_0x29e2('0x30')]=_[_0x29e2('0x31')](_0x1a5830[_0x29e2('0x30')]);_0x4ac682['filters']=_[_0x29e2('0x34')](_0x4ac682['model'],_0x4ac682[_0x29e2('0x30')]);_0x22d182[_0x29e2('0x33')]=_[_0x29e2('0x34')](_0x4ac682[_0x29e2('0x2f')],qs[_0x29e2('0x43')](_0x1a5830[_0x29e2('0x30')][_0x29e2('0x43')]));_0x22d182[_0x29e2('0x33')]=_0x22d182['attributes'][_0x29e2('0x35')]?_0x22d182['attributes']:_0x4ac682[_0x29e2('0x2f')];if(_0x1a5830['query']['includeAll']){_0x22d182[_0x29e2('0x41')]=[{'all':!![]}];}_0x22d182=_['merge']({},_0x22d182,_0x1a5830[_0x29e2('0x3f')]);return db[_0x29e2('0x2b')][_0x29e2('0x44')](_0x22d182)[_0x29e2('0x25')](handleEntityNotFound(_0x1337d0,null))[_0x29e2('0x25')](respondWithResult(_0x1337d0,null))[_0x29e2('0x42')](handleError(_0x1337d0,null));};exports[_0x29e2('0x45')]=function(_0x4cfcf2,_0x33f51d){return db[_0x29e2('0x2b')][_0x29e2('0x45')](_0x4cfcf2['body'],{})[_0x29e2('0x25')](respondWithResult(_0x33f51d,0xc9))[_0x29e2('0x42')](handleError(_0x33f51d,null));};exports['update']=function(_0x352ba8,_0x308ea3){if(_0x352ba8[_0x29e2('0x46')]['id']){delete _0x352ba8[_0x29e2('0x46')]['id'];}return db[_0x29e2('0x2b')][_0x29e2('0x44')]({'where':{'id':_0x352ba8[_0x29e2('0x47')]['id']}})[_0x29e2('0x25')](handleEntityNotFound(_0x308ea3,null))[_0x29e2('0x25')](saveUpdates(_0x352ba8[_0x29e2('0x46')],null))[_0x29e2('0x25')](respondWithResult(_0x308ea3,null))['catch'](handleError(_0x308ea3,null));};exports[_0x29e2('0x24')]=function(_0x3721f1,_0x229ec3){return db['FaxTransferReport'][_0x29e2('0x44')]({'where':{'id':_0x3721f1['params']['id']}})[_0x29e2('0x25')](handleEntityNotFound(_0x229ec3,null))['then'](removeEntity(_0x229ec3,null))[_0x29e2('0x42')](handleError(_0x229ec3,null));};exports[_0x29e2('0x48')]=function(_0x28837e,_0x48c355){return db['FaxTransferReport'][_0x29e2('0x48')]()[_0x29e2('0x25')](respondWithResult(_0x48c355,null))[_0x29e2('0x42')](handleError(_0x48c355,null));}; \ No newline at end of file +var _0xb295=['where','filters','filter','merge','VIRTUAL','options','FaxTransferReport','count','include','rows','catch','params','model','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2c50a6,_0x2a9854){var _0x3e6556=function(_0x3ad784){while(--_0x3ad784){_0x2c50a6['push'](_0x2c50a6['shift']());}};_0x3e6556(++_0x2a9854);}(_0xb295,0x1c1));var _0x5b29=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb295[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x5b29('0x0'));var rimraf=require(_0x5b29('0x1'));var zipdir=require(_0x5b29('0x2'));var jsonpatch=require(_0x5b29('0x3'));var rp=require('request-promise');var moment=require(_0x5b29('0x4'));var BPromise=require(_0x5b29('0x5'));var Mustache=require(_0x5b29('0x6'));var util=require(_0x5b29('0x7'));var path=require(_0x5b29('0x8'));var sox=require(_0x5b29('0x9'));var csv=require(_0x5b29('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b29('0xb'));var _=require(_0x5b29('0xc'));var squel=require(_0x5b29('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b29('0xe'));var deskjs=require(_0x5b29('0xf'));var toCsv=require(_0x5b29('0xa'));var querystring=require('querystring');var Papa=require(_0x5b29('0x10'));var Redis=require('ioredis');var authService=require(_0x5b29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b29('0x12'));var hardwareService=require(_0x5b29('0x13'));var logger=require(_0x5b29('0x14'))(_0x5b29('0x15'));var utils=require(_0x5b29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5b29('0x17'));var db=require(_0x5b29('0x18'))['db'];function respondWithStatusCode(_0x598192,_0xd39518){_0xd39518=_0xd39518||0xcc;return function(_0x529330){if(_0x529330){return _0x598192[_0x5b29('0x19')](_0xd39518);}return _0x598192[_0x5b29('0x1a')](_0xd39518)[_0x5b29('0x1b')]();};}function respondWithResult(_0xa1114a,_0xb41100){_0xb41100=_0xb41100||0xc8;return function(_0x5aed1c){if(_0x5aed1c){return _0xa1114a[_0x5b29('0x1a')](_0xb41100)['json'](_0x5aed1c);}};}function respondWithFilteredResult(_0x1c1689,_0xac9243){return function(_0x501d35){if(_0x501d35){var _0x739e5b=typeof _0xac9243['offset']===_0x5b29('0x1c')&&typeof _0xac9243[_0x5b29('0x1d')]==='undefined';var _0x5eb065=_0x501d35['count'];var _0x2059ad=_0x739e5b?0x0:_0xac9243[_0x5b29('0x1e')];var _0x1fd5c3=_0x739e5b?_0x501d35['count']:_0xac9243['offset']+_0xac9243[_0x5b29('0x1d')];var _0x1111b6;if(_0x1fd5c3>=_0x5eb065){_0x1fd5c3=_0x5eb065;_0x1111b6=0xc8;}else{_0x1111b6=0xce;}_0x1c1689[_0x5b29('0x1a')](_0x1111b6);return _0x1c1689['set']('Content-Range',_0x2059ad+'-'+_0x1fd5c3+'/'+_0x5eb065)['json'](_0x501d35);}return null;};}function patchUpdates(_0x11c9d7){return function(_0xf91707){try{jsonpatch[_0x5b29('0x1f')](_0xf91707,_0x11c9d7,!![]);}catch(_0x21a3b1){return BPromise[_0x5b29('0x20')](_0x21a3b1);}return _0xf91707[_0x5b29('0x21')]();};}function saveUpdates(_0x477aa6,_0xfe38fe){return function(_0x4adc27){if(_0x4adc27){return _0x4adc27[_0x5b29('0x22')](_0x477aa6)[_0x5b29('0x23')](function(_0x42aa3c){return _0x42aa3c;});}return null;};}function removeEntity(_0x5ed892,_0x2768ed){return function(_0x46417c){if(_0x46417c){return _0x46417c['destroy']()[_0x5b29('0x23')](function(){_0x5ed892[_0x5b29('0x1a')](0xcc)[_0x5b29('0x1b')]();});}};}function handleEntityNotFound(_0x232269,_0x4afedc){return function(_0x43a95d){if(!_0x43a95d){_0x232269['sendStatus'](0x194);}return _0x43a95d;};}function handleError(_0x4356c0,_0x4d1edf){_0x4d1edf=_0x4d1edf||0x1f4;return function(_0x47cc48){logger[_0x5b29('0x24')](_0x47cc48[_0x5b29('0x25')]);if(_0x47cc48[_0x5b29('0x26')]){delete _0x47cc48[_0x5b29('0x26')];}_0x4356c0[_0x5b29('0x1a')](_0x4d1edf)[_0x5b29('0x27')](_0x47cc48);};}exports[_0x5b29('0x28')]=function(_0x200795,_0x12f4bf){var _0x4c6754={},_0x2fa3b6={},_0x2a43ef={'count':0x0,'rows':[]};var _0xafaa=_['map'](db['FaxTransferReport'][_0x5b29('0x29')],function(_0x4bc0a7){return{'name':_0x4bc0a7[_0x5b29('0x2a')],'type':_0x4bc0a7[_0x5b29('0x2b')]['key']};});_0x2fa3b6['model']=_[_0x5b29('0x2c')](_0xafaa,_0x5b29('0x26'));_0x2fa3b6[_0x5b29('0x2d')]=_[_0x5b29('0x2e')](_0x200795['query']);_0x2fa3b6['filters']=_['intersection'](_0x2fa3b6['model'],_0x2fa3b6['query']);_0x4c6754[_0x5b29('0x2f')]=_[_0x5b29('0x30')](_0x2fa3b6['model'],qs[_0x5b29('0x31')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x31')]));_0x4c6754[_0x5b29('0x2f')]=_0x4c6754[_0x5b29('0x2f')][_0x5b29('0x32')]?_0x4c6754[_0x5b29('0x2f')]:_0x2fa3b6['model'];if(!_0x200795['query'][_0x5b29('0x33')](_0x5b29('0x34'))){_0x4c6754[_0x5b29('0x1d')]=qs[_0x5b29('0x1d')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x1d')]);_0x4c6754['offset']=qs[_0x5b29('0x1e')](_0x200795[_0x5b29('0x2d')]['offset']);}_0x4c6754[_0x5b29('0x35')]=qs[_0x5b29('0x36')](_0x200795[_0x5b29('0x2d')][_0x5b29('0x36')]);_0x4c6754[_0x5b29('0x37')]=qs['filters'](_['pick'](_0x200795[_0x5b29('0x2d')],_0x2fa3b6[_0x5b29('0x38')]),_0xafaa);if(_0x200795[_0x5b29('0x2d')][_0x5b29('0x39')]){_0x4c6754['where']=_[_0x5b29('0x3a')](_0x4c6754[_0x5b29('0x37')],{'$or':_['map'](_0xafaa,function(_0x33238a){if(_0x33238a[_0x5b29('0x2b')]!==_0x5b29('0x3b')){var _0xafbb20={};_0xafbb20[_0x33238a['name']]={'$like':'%'+_0x200795['query'][_0x5b29('0x39')]+'%'};return _0xafbb20;}})});}_0x4c6754=_[_0x5b29('0x3a')]({},_0x4c6754,_0x200795[_0x5b29('0x3c')]);var _0x41cc5b={'where':_0x4c6754['where']};return db[_0x5b29('0x3d')][_0x5b29('0x3e')](_0x41cc5b)['then'](function(_0x1ecda4){_0x2a43ef[_0x5b29('0x3e')]=_0x1ecda4;if(_0x200795[_0x5b29('0x2d')]['includeAll']){_0x4c6754[_0x5b29('0x3f')]=[{'all':!![]}];}return db[_0x5b29('0x3d')]['findAll'](_0x4c6754);})[_0x5b29('0x23')](function(_0x2c8611){_0x2a43ef[_0x5b29('0x40')]=_0x2c8611;return _0x2a43ef;})[_0x5b29('0x23')](respondWithFilteredResult(_0x12f4bf,_0x4c6754))[_0x5b29('0x41')](handleError(_0x12f4bf,null));};exports['show']=function(_0x5cfa9a,_0x92fc5a){var _0x1af81c={'raw':!![],'where':{'id':_0x5cfa9a[_0x5b29('0x42')]['id']}},_0x4c97e3={};_0x4c97e3[_0x5b29('0x43')]=_[_0x5b29('0x2e')](db['FaxTransferReport'][_0x5b29('0x29')]);_0x4c97e3[_0x5b29('0x2d')]=_[_0x5b29('0x2e')](_0x5cfa9a['query']);_0x4c97e3[_0x5b29('0x38')]=_[_0x5b29('0x30')](_0x4c97e3[_0x5b29('0x43')],_0x4c97e3[_0x5b29('0x2d')]);_0x1af81c[_0x5b29('0x2f')]=_['intersection'](_0x4c97e3[_0x5b29('0x43')],qs[_0x5b29('0x31')](_0x5cfa9a[_0x5b29('0x2d')]['fields']));_0x1af81c[_0x5b29('0x2f')]=_0x1af81c[_0x5b29('0x2f')][_0x5b29('0x32')]?_0x1af81c[_0x5b29('0x2f')]:_0x4c97e3['model'];if(_0x5cfa9a[_0x5b29('0x2d')]['includeAll']){_0x1af81c[_0x5b29('0x3f')]=[{'all':!![]}];}_0x1af81c=_[_0x5b29('0x3a')]({},_0x1af81c,_0x5cfa9a[_0x5b29('0x3c')]);return db[_0x5b29('0x3d')][_0x5b29('0x44')](_0x1af81c)[_0x5b29('0x23')](handleEntityNotFound(_0x92fc5a,null))[_0x5b29('0x23')](respondWithResult(_0x92fc5a,null))['catch'](handleError(_0x92fc5a,null));};exports[_0x5b29('0x45')]=function(_0x2418ea,_0x2eb123){return db[_0x5b29('0x3d')][_0x5b29('0x45')](_0x2418ea[_0x5b29('0x46')],{})[_0x5b29('0x23')](respondWithResult(_0x2eb123,0xc9))[_0x5b29('0x41')](handleError(_0x2eb123,null));};exports[_0x5b29('0x22')]=function(_0x175854,_0x100398){if(_0x175854[_0x5b29('0x46')]['id']){delete _0x175854[_0x5b29('0x46')]['id'];}return db[_0x5b29('0x3d')][_0x5b29('0x44')]({'where':{'id':_0x175854[_0x5b29('0x42')]['id']}})['then'](handleEntityNotFound(_0x100398,null))[_0x5b29('0x23')](saveUpdates(_0x175854[_0x5b29('0x46')],null))[_0x5b29('0x23')](respondWithResult(_0x100398,null))['catch'](handleError(_0x100398,null));};exports['destroy']=function(_0xb262dd,_0x44ce34){return db['FaxTransferReport']['find']({'where':{'id':_0xb262dd[_0x5b29('0x42')]['id']}})['then'](handleEntityNotFound(_0x44ce34,null))[_0x5b29('0x23')](removeEntity(_0x44ce34,null))['catch'](handleError(_0x44ce34,null));};exports[_0x5b29('0x47')]=function(_0xf9f5b3,_0x5802f2){return db[_0x5b29('0x3d')]['describe']()[_0x5b29('0x23')](respondWithResult(_0x5802f2,null))[_0x5b29('0x41')](handleError(_0x5802f2,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 8dfcf91..797eb7d 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 _0x1f81=['report_fax_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x408121,_0x3a5d7e){var _0x84a61b=function(_0x4faa78){while(--_0x4faa78){_0x408121['push'](_0x408121['shift']());}};_0x84a61b(++_0x3a5d7e);}(_0x1f81,0xab));var _0x11f8=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x1f81[_0x5d0609];return _0xaa3fd1;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var logger=require('../../config/logger')(_0x11f8('0x2'));var moment=require(_0x11f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x11f8('0x4'));var fs=require('fs');var path=require(_0x11f8('0x5'));var rimraf=require(_0x11f8('0x6'));var config=require(_0x11f8('0x7'));var attributes=require(_0x11f8('0x8'));module[_0x11f8('0x9')]=function(_0x1a16e9,_0xe63071){return _0x1a16e9['define'](_0x11f8('0xa'),attributes,{'tableName':_0x11f8('0xb'),'paranoid':![],'indexes':[{'name':_0x11f8('0xc'),'fields':[_0x11f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00f4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x17bf64,_0x2b0e29){var _0x1c7d7e=function(_0xef10f8){while(--_0xef10f8){_0x17bf64['push'](_0x17bf64['shift']());}};_0x1c7d7e(++_0x2b0e29);}(_0x00f4,0x137));var _0x400f=function(_0x3d056e,_0x2a2402){_0x3d056e=_0x3d056e-0x0;var _0x4f908d=_0x00f4[_0x3d056e];return _0x4f908d;};'use strict';var _=require(_0x400f('0x0'));var util=require('util');var logger=require(_0x400f('0x1'))(_0x400f('0x2'));var moment=require(_0x400f('0x3'));var BPromise=require(_0x400f('0x4'));var rp=require(_0x400f('0x5'));var fs=require('fs');var path=require(_0x400f('0x6'));var rimraf=require(_0x400f('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x400f('0x8')]=function(_0x4b5171,_0x119326){return _0x4b5171[_0x400f('0x9')](_0x400f('0xa'),attributes,{'tableName':_0x400f('0xb'),'paranoid':![],'indexes':[{'name':_0x400f('0xc'),'fields':[_0x400f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4e8b370..4948c67 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 _0x2f61=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x2f61,0x15c));var _0x12f6=function(_0x46e014,_0x4dc50a){_0x46e014=_0x46e014-0x0;var _0x2d18f3=_0x2f61[_0x46e014];return _0x2d18f3;};'use strict';var _=require(_0x12f6('0x0'));var util=require(_0x12f6('0x1'));var moment=require(_0x12f6('0x2'));var BPromise=require(_0x12f6('0x3'));var rs=require(_0x12f6('0x4'));var fs=require('fs');var Redis=require(_0x12f6('0x5'));var db=require(_0x12f6('0x6'))['db'];var utils=require(_0x12f6('0x7'));var logger=require(_0x12f6('0x8'))(_0x12f6('0x9'));var config=require('../../config/environment');var jayson=require(_0x12f6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47bc0a,_0xd1c8aa,_0x4b44d0){return new BPromise(function(_0x51f990,_0x463473){return client[_0x12f6('0xb')](_0x47bc0a,_0x4b44d0)[_0x12f6('0xc')](function(_0x3ca67a){logger[_0x12f6('0xd')](_0x12f6('0xe'),_0xd1c8aa,_0x12f6('0xf'));logger[_0x12f6('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xd1c8aa,_0x12f6('0xf'),JSON[_0x12f6('0x11')](_0x3ca67a));if(_0x3ca67a[_0x12f6('0x12')]){if(_0x3ca67a['error']['code']===0x1f4){logger[_0x12f6('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0xd1c8aa,_0x3ca67a['error'][_0x12f6('0x13')]);return _0x463473(_0x3ca67a['error'][_0x12f6('0x13')]);}logger[_0x12f6('0x12')](_0x12f6('0xe'),_0xd1c8aa,_0x3ca67a[_0x12f6('0x12')]['message']);return _0x51f990(_0x3ca67a[_0x12f6('0x12')]['message']);}else{logger['info'](_0x12f6('0xe'),_0xd1c8aa,_0x12f6('0xf'));_0x51f990(_0x3ca67a[_0x12f6('0x14')][_0x12f6('0x13')]);}})[_0x12f6('0x15')](function(_0x1ee324){logger[_0x12f6('0x12')](_0x12f6('0xe'),_0xd1c8aa,_0x1ee324);_0x463473(_0x1ee324);});});} \ No newline at end of file +var _0xd228=['../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49a97e,_0xd100c){var _0x10c37f=function(_0x4664bd){while(--_0x4664bd){_0x49a97e['push'](_0x49a97e['shift']());}};_0x10c37f(++_0xd100c);}(_0xd228,0x151));var _0x8d22=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0xd228[_0x577077];return _0x370769;};'use strict';var _=require(_0x8d22('0x0'));var util=require(_0x8d22('0x1'));var moment=require(_0x8d22('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d22('0x3'));var db=require(_0x8d22('0x4'))['db'];var utils=require(_0x8d22('0x5'));var logger=require(_0x8d22('0x6'))(_0x8d22('0x7'));var config=require(_0x8d22('0x8'));var jayson=require(_0x8d22('0x9'));var client=jayson[_0x8d22('0xa')][_0x8d22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3f56,_0x210bac,_0x14e66e){return new BPromise(function(_0x368df0,_0x3f01f0){return client[_0x8d22('0xc')](_0x4f3f56,_0x14e66e)[_0x8d22('0xd')](function(_0x1b77bf){logger['info'](_0x8d22('0xe'),_0x210bac,_0x8d22('0xf'));logger['debug'](_0x8d22('0x10'),_0x210bac,_0x8d22('0xf'),JSON[_0x8d22('0x11')](_0x1b77bf));if(_0x1b77bf['error']){if(_0x1b77bf['error'][_0x8d22('0x12')]===0x1f4){logger[_0x8d22('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x210bac,_0x1b77bf['error'][_0x8d22('0x14')]);return _0x3f01f0(_0x1b77bf[_0x8d22('0x13')][_0x8d22('0x14')]);}logger[_0x8d22('0x13')](_0x8d22('0xe'),_0x210bac,_0x1b77bf[_0x8d22('0x13')]['message']);return _0x368df0(_0x1b77bf['error'][_0x8d22('0x14')]);}else{logger['info'](_0x8d22('0xe'),_0x210bac,_0x8d22('0xf'));_0x368df0(_0x1b77bf[_0x8d22('0x15')][_0x8d22('0x14')]);}})[_0x8d22('0x16')](function(_0x50b0aa){logger['error'](_0x8d22('0xe'),_0x210bac,_0x50b0aa);_0x3f01f0(_0x50b0aa);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 18964d4..3573ec3 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 _0xba10=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','exports','util'];(function(_0x29714d,_0x3baf88){var _0x3234a6=function(_0x39d895){while(--_0x39d895){_0x29714d['push'](_0x29714d['shift']());}};_0x3234a6(++_0x3baf88);}(_0xba10,0x167));var _0x0ba1=function(_0x2a6ba2,_0x45c85d){_0x2a6ba2=_0x2a6ba2-0x0;var _0x326a1a=_0xba10[_0x2a6ba2];return _0x326a1a;};'use strict';var multer=require('multer');var util=require(_0x0ba1('0x0'));var path=require(_0x0ba1('0x1'));var timeout=require(_0x0ba1('0x2'));var express=require(_0x0ba1('0x3'));var router=express[_0x0ba1('0x4')]();var fs_extra=require(_0x0ba1('0x5'));var auth=require(_0x0ba1('0x6'));var interaction=require(_0x0ba1('0x7'));var config=require('../../config/environment');var controller=require(_0x0ba1('0x8'));router[_0x0ba1('0x9')]('/',auth[_0x0ba1('0xa')](),controller[_0x0ba1('0xb')]);router[_0x0ba1('0x9')](_0x0ba1('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0ba1('0x9')](_0x0ba1('0xd'),auth[_0x0ba1('0xa')](),controller[_0x0ba1('0xe')]);router[_0x0ba1('0xf')]('/',auth[_0x0ba1('0xa')](),controller[_0x0ba1('0x10')]);router['put'](_0x0ba1('0xd'),auth[_0x0ba1('0xa')](),controller['update']);router[_0x0ba1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0ba1('0x12')]);module[_0x0ba1('0x13')]=router; \ No newline at end of file +var _0xc68b=['get','isAuthenticated','/describe','describe','/:id','post','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x2d0086,_0x17dd17){var _0x5b1115=function(_0x256d59){while(--_0x256d59){_0x2d0086['push'](_0x2d0086['shift']());}};_0x5b1115(++_0x17dd17);}(_0xc68b,0x14e));var _0xbc68=function(_0x24f6f8,_0x3e51b6){_0x24f6f8=_0x24f6f8-0x0;var _0x16f779=_0xc68b[_0x24f6f8];return _0x16f779;};'use strict';var multer=require('multer');var util=require(_0xbc68('0x0'));var path=require(_0xbc68('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc68('0x2'));var router=express[_0xbc68('0x3')]();var fs_extra=require(_0xbc68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc68('0x5'));var config=require(_0xbc68('0x6'));var controller=require(_0xbc68('0x7'));router[_0xbc68('0x8')]('/',auth[_0xbc68('0x9')](),controller['index']);router['get'](_0xbc68('0xa'),auth[_0xbc68('0x9')](),controller[_0xbc68('0xb')]);router['get'](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller['show']);router[_0xbc68('0xd')]('/',auth[_0xbc68('0x9')](),controller['create']);router[_0xbc68('0xe')](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller['update']);router[_0xbc68('0xf')](_0xbc68('0xc'),auth[_0xbc68('0x9')](),controller[_0xbc68('0x10')]);module[_0xbc68('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index cf631b4..a026203 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 _0xed66=['show','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x2df689,_0x29792a){var _0x54e7b8=function(_0x21cfff){while(--_0x21cfff){_0x2df689['push'](_0x2df689['shift']());}};_0x54e7b8(++_0x29792a);}(_0xed66,0x104));var _0x6ed6=function(_0x2f0bf1,_0x183ef1){_0x2f0bf1=_0x2f0bf1-0x0;var _0xf1df38=_0xed66[_0x2f0bf1];return _0xf1df38;};'use strict';var multer=require(_0x6ed6('0x0'));var util=require(_0x6ed6('0x1'));var path=require(_0x6ed6('0x2'));var timeout=require(_0x6ed6('0x3'));var express=require(_0x6ed6('0x4'));var router=express[_0x6ed6('0x5')]();var fs_extra=require(_0x6ed6('0x6'));var auth=require(_0x6ed6('0x7'));var interaction=require(_0x6ed6('0x8'));var config=require(_0x6ed6('0x9'));var controller=require(_0x6ed6('0xa'));router[_0x6ed6('0xb')]('/',auth[_0x6ed6('0xc')](),controller[_0x6ed6('0xd')]);router[_0x6ed6('0xb')](_0x6ed6('0xe'),auth[_0x6ed6('0xc')](),controller[_0x6ed6('0xf')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6ed6('0xb')]('/:id/fields',auth[_0x6ed6('0xc')](),controller[_0x6ed6('0x10')]);router[_0x6ed6('0x11')]('/',auth[_0x6ed6('0xc')](),controller[_0x6ed6('0x12')]);router[_0x6ed6('0x11')](_0x6ed6('0x13'),auth[_0x6ed6('0xc')](),controller[_0x6ed6('0x14')]);router[_0x6ed6('0x15')](_0x6ed6('0xe'),auth[_0x6ed6('0xc')](),controller[_0x6ed6('0x16')]);router['delete'](_0x6ed6('0xe'),auth[_0x6ed6('0xc')](),controller[_0x6ed6('0x17')]);module[_0x6ed6('0x18')]=router; \ No newline at end of file +var _0x60f3=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x60f3,0x162));var _0x360f=function(_0x259c7e,_0x96223a){_0x259c7e=_0x259c7e-0x0;var _0x15d791=_0x60f3[_0x259c7e];return _0x15d791;};'use strict';var multer=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var path=require(_0x360f('0x2'));var timeout=require('connect-timeout');var express=require(_0x360f('0x3'));var router=express[_0x360f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x360f('0x5'));var interaction=require(_0x360f('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x360f('0x7')]('/',auth[_0x360f('0x8')](),controller['index']);router[_0x360f('0x7')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0xa')]);router['get'](_0x360f('0xb'),auth[_0x360f('0x8')](),controller[_0x360f('0xc')]);router[_0x360f('0x7')]('/:id/fields',auth[_0x360f('0x8')](),controller[_0x360f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x360f('0xe')]);router[_0x360f('0xf')](_0x360f('0xb'),auth[_0x360f('0x8')](),controller[_0x360f('0x10')]);router[_0x360f('0x11')]('/:id',auth[_0x360f('0x8')](),controller[_0x360f('0x12')]);router[_0x360f('0x13')](_0x360f('0x9'),auth['isAuthenticated'](),controller[_0x360f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8c4adb1..02901c3 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 _0x61d4=['STRING','ENUM','basic','integrationTab','exports'];(function(_0x5e512c,_0x4e45ad){var _0x2fb315=function(_0x1292cd){while(--_0x1292cd){_0x5e512c['push'](_0x5e512c['shift']());}};_0x2fb315(++_0x4e45ad);}(_0x61d4,0x1e9));var _0x461d=function(_0x529351,_0x3ac704){_0x529351=_0x529351-0x0;var _0x41cd56=_0x61d4[_0x529351];return _0x41cd56;};'use strict';var Sequelize=require('sequelize');module[_0x461d('0x0')]={'name':{'type':Sequelize[_0x461d('0x1')]},'description':{'type':Sequelize[_0x461d('0x1')]},'username':{'type':Sequelize[_0x461d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x461d('0x2')]('basic'),'defaultValue':_0x461d('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x461d('0x1')]},'token':{'type':Sequelize[_0x461d('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x461d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x461d('0x4')}}; \ No newline at end of file +var _0xd9ac=['basic','integrationTab','newTab','STRING','ENUM'];(function(_0x332be2,_0x30b2c1){var _0x31f25a=function(_0x528900){while(--_0x528900){_0x332be2['push'](_0x332be2['shift']());}};_0x31f25a(++_0x30b2c1);}(_0xd9ac,0x12f));var _0xcd9a=function(_0x4623ad,_0x30f369){_0x4623ad=_0x4623ad-0x0;var _0x3a9ba5=_0xd9ac[_0x4623ad];return _0x3a9ba5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd9a('0x0')]},'username':{'type':Sequelize[_0xcd9a('0x0')]},'remoteUri':{'type':Sequelize[_0xcd9a('0x0')]},'authType':{'type':Sequelize[_0xcd9a('0x1')]('basic'),'defaultValue':_0xcd9a('0x2')},'password':{'type':Sequelize[_0xcd9a('0x0')]},'consumerKey':{'type':Sequelize[_0xcd9a('0x0')]},'consumerSecret':{'type':Sequelize[_0xcd9a('0x0')]},'token':{'type':Sequelize[_0xcd9a('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcd9a('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcd9a('0x1')](_0xcd9a('0x3'),_0xcd9a('0x4')),'defaultValue':_0xcd9a('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 81f71d9..1cc8ef0 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 _0x6733=['GET','format','%s/custom_fields','application/json','Authorization','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','include','rows','show','params','length','includeAll','find','catch','create','body','update','getConfigurations','findOne','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','priority','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6733,0xf6));var _0x3673=function(_0x341835,_0x21ac23){_0x341835=_0x341835-0x0;var _0x4abfae=_0x6733[_0x341835];return _0x4abfae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3673('0x0'));var jsonpatch=require(_0x3673('0x1'));var rp=require(_0x3673('0x2'));var moment=require(_0x3673('0x3'));var BPromise=require(_0x3673('0x4'));var Mustache=require(_0x3673('0x5'));var util=require(_0x3673('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3673('0x7'));var ejs=require(_0x3673('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3673('0x9'));var squel=require(_0x3673('0xa'));var crypto=require(_0x3673('0xb'));var jsforce=require(_0x3673('0xc'));var deskjs=require(_0x3673('0xd'));var toCsv=require(_0x3673('0x7'));var querystring=require(_0x3673('0xe'));var Papa=require(_0x3673('0xf'));var Redis=require(_0x3673('0x10'));var authService=require(_0x3673('0x11'));var qs=require(_0x3673('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3673('0x13'))(_0x3673('0x14'));var utils=require(_0x3673('0x15'));var config=require(_0x3673('0x16'));var licenseUtil=require(_0x3673('0x17'));var db=require(_0x3673('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46ebd1,_0x49d6a5){_0x49d6a5=_0x49d6a5||0xcc;return function(_0x1fbec7){if(_0x1fbec7){return _0x46ebd1[_0x3673('0x19')](_0x49d6a5);}return _0x46ebd1['status'](_0x49d6a5)[_0x3673('0x1a')]();};}function respondWithResult(_0x1cf699,_0x221d91){_0x221d91=_0x221d91||0xc8;return function(_0x46642c){if(_0x46642c){return _0x1cf699[_0x3673('0x1b')](_0x221d91)[_0x3673('0x1c')](_0x46642c);}};}function respondWithFilteredResult(_0xe5c21c,_0x3482df){return function(_0x30bc3a){if(_0x30bc3a){var _0x4be36f=typeof _0x3482df['offset']===_0x3673('0x1d')&&typeof _0x3482df['limit']===_0x3673('0x1d');var _0x4e333e=_0x30bc3a[_0x3673('0x1e')];var _0x5a15cd=_0x4be36f?0x0:_0x3482df[_0x3673('0x1f')];var _0x29109f=_0x4be36f?_0x30bc3a[_0x3673('0x1e')]:_0x3482df[_0x3673('0x1f')]+_0x3482df[_0x3673('0x20')];var _0x49a7f2;if(_0x29109f>=_0x4e333e){_0x29109f=_0x4e333e;_0x49a7f2=0xc8;}else{_0x49a7f2=0xce;}_0xe5c21c[_0x3673('0x1b')](_0x49a7f2);return _0xe5c21c[_0x3673('0x21')](_0x3673('0x22'),_0x5a15cd+'-'+_0x29109f+'/'+_0x4e333e)[_0x3673('0x1c')](_0x30bc3a);}return null;};}function patchUpdates(_0x40f70a){return function(_0x14ac46){try{jsonpatch[_0x3673('0x23')](_0x14ac46,_0x40f70a,!![]);}catch(_0xc4f698){return BPromise[_0x3673('0x24')](_0xc4f698);}return _0x14ac46['save']();};}function saveUpdates(_0x318da2,_0x2e33db){return function(_0x274fba){if(_0x274fba){return _0x274fba['update'](_0x318da2)['then'](function(_0x4cd8dc){return _0x4cd8dc;});}return null;};}function removeEntity(_0x49b2a2,_0x26bc55){return function(_0x4714e1){if(_0x4714e1){return _0x4714e1[_0x3673('0x25')]()[_0x3673('0x26')](function(){_0x49b2a2[_0x3673('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb5ec3c,_0x96bc7c){return function(_0x241ed8){if(!_0x241ed8){_0xb5ec3c[_0x3673('0x19')](0x194);}return _0x241ed8;};}function handleError(_0x4bc5e9,_0xcbc65f){_0xcbc65f=_0xcbc65f||0x1f4;return function(_0x39b47f){logger[_0x3673('0x27')](_0x39b47f[_0x3673('0x28')]);if(_0x39b47f[_0x3673('0x29')]){delete _0x39b47f['name'];}_0x4bc5e9[_0x3673('0x1b')](_0xcbc65f)[_0x3673('0x2a')](_0x39b47f);};}exports[_0x3673('0x2b')]=function(_0x8cd034,_0x463c8e){var _0x172150={},_0x50a6a1={},_0xd4df79={'count':0x0,'rows':[]};var _0x394b9b=_[_0x3673('0x2c')](db[_0x3673('0x2d')][_0x3673('0x2e')],function(_0x9a87eb){return{'name':_0x9a87eb[_0x3673('0x2f')],'type':_0x9a87eb['type']['key']};});_0x50a6a1[_0x3673('0x30')]=_[_0x3673('0x2c')](_0x394b9b,_0x3673('0x29'));_0x50a6a1['query']=_[_0x3673('0x31')](_0x8cd034['query']);_0x50a6a1[_0x3673('0x32')]=_[_0x3673('0x33')](_0x50a6a1[_0x3673('0x30')],_0x50a6a1[_0x3673('0x34')]);_0x172150[_0x3673('0x35')]=_['intersection'](_0x50a6a1[_0x3673('0x30')],qs[_0x3673('0x36')](_0x8cd034['query'][_0x3673('0x36')]));_0x172150[_0x3673('0x35')]=_0x172150[_0x3673('0x35')]['length']?_0x172150[_0x3673('0x35')]:_0x50a6a1[_0x3673('0x30')];if(!_0x8cd034['query'][_0x3673('0x37')](_0x3673('0x38'))){_0x172150['limit']=qs['limit'](_0x8cd034[_0x3673('0x34')][_0x3673('0x20')]);_0x172150[_0x3673('0x1f')]=qs['offset'](_0x8cd034['query'][_0x3673('0x1f')]);}_0x172150[_0x3673('0x39')]=qs[_0x3673('0x3a')](_0x8cd034[_0x3673('0x34')]['sort']);_0x172150[_0x3673('0x3b')]=qs[_0x3673('0x32')](_[_0x3673('0x3c')](_0x8cd034[_0x3673('0x34')],_0x50a6a1['filters']),_0x394b9b);if(_0x8cd034[_0x3673('0x34')]['filter']){_0x172150['where']=_[_0x3673('0x3d')](_0x172150[_0x3673('0x3b')],{'$or':_[_0x3673('0x2c')](_0x394b9b,function(_0x143a9a){if(_0x143a9a[_0x3673('0x3e')]!=='VIRTUAL'){var _0x4cf67b={};_0x4cf67b[_0x143a9a[_0x3673('0x29')]]={'$like':'%'+_0x8cd034[_0x3673('0x34')]['filter']+'%'};return _0x4cf67b;}})});}_0x172150=_['merge']({},_0x172150,_0x8cd034[_0x3673('0x3f')]);var _0x5a63ab={'where':_0x172150[_0x3673('0x3b')]};return db[_0x3673('0x2d')]['count'](_0x5a63ab)[_0x3673('0x26')](function(_0x56ad52){_0xd4df79[_0x3673('0x1e')]=_0x56ad52;if(_0x8cd034['query']['includeAll']){_0x172150[_0x3673('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x172150);})[_0x3673('0x26')](function(_0x39c77){_0xd4df79[_0x3673('0x41')]=_0x39c77;return _0xd4df79;})[_0x3673('0x26')](respondWithFilteredResult(_0x463c8e,_0x172150))['catch'](handleError(_0x463c8e,null));};exports[_0x3673('0x42')]=function(_0x20648c,_0x230bc8){var _0x543cc3={'raw':![],'where':{'id':_0x20648c[_0x3673('0x43')]['id']}},_0x6b0d4={};_0x6b0d4[_0x3673('0x30')]=_[_0x3673('0x31')](db[_0x3673('0x2d')][_0x3673('0x2e')]);_0x6b0d4[_0x3673('0x34')]=_[_0x3673('0x31')](_0x20648c[_0x3673('0x34')]);_0x6b0d4[_0x3673('0x32')]=_[_0x3673('0x33')](_0x6b0d4[_0x3673('0x30')],_0x6b0d4[_0x3673('0x34')]);_0x543cc3['attributes']=_[_0x3673('0x33')](_0x6b0d4[_0x3673('0x30')],qs[_0x3673('0x36')](_0x20648c[_0x3673('0x34')][_0x3673('0x36')]));_0x543cc3['attributes']=_0x543cc3[_0x3673('0x35')][_0x3673('0x44')]?_0x543cc3['attributes']:_0x6b0d4[_0x3673('0x30')];if(_0x20648c[_0x3673('0x34')][_0x3673('0x45')]){_0x543cc3[_0x3673('0x40')]=[{'all':!![]}];}_0x543cc3=_[_0x3673('0x3d')]({},_0x543cc3,_0x20648c[_0x3673('0x3f')]);return db['DeskAccount'][_0x3673('0x46')](_0x543cc3)[_0x3673('0x26')](handleEntityNotFound(_0x230bc8,null))[_0x3673('0x26')](respondWithResult(_0x230bc8,null))[_0x3673('0x47')](handleError(_0x230bc8,null));};exports[_0x3673('0x48')]=function(_0x568a89,_0x1abdfc){return db[_0x3673('0x2d')]['create'](_0x568a89[_0x3673('0x49')],{})['then'](respondWithResult(_0x1abdfc,0xc9))['catch'](handleError(_0x1abdfc,null));};exports[_0x3673('0x4a')]=function(_0x5bf28b,_0x23a4c0){if(_0x5bf28b['body']['id']){delete _0x5bf28b['body']['id'];}return db[_0x3673('0x2d')][_0x3673('0x46')]({'where':{'id':_0x5bf28b[_0x3673('0x43')]['id']}})['then'](handleEntityNotFound(_0x23a4c0,null))['then'](saveUpdates(_0x5bf28b['body'],null))['then'](respondWithResult(_0x23a4c0,null))[_0x3673('0x47')](handleError(_0x23a4c0,null));};exports[_0x3673('0x25')]=function(_0x184c5c,_0x149296){return db[_0x3673('0x2d')][_0x3673('0x46')]({'where':{'id':_0x184c5c[_0x3673('0x43')]['id']}})[_0x3673('0x26')](handleEntityNotFound(_0x149296,null))[_0x3673('0x26')](removeEntity(_0x149296,null))[_0x3673('0x47')](handleError(_0x149296,null));};exports[_0x3673('0x4b')]=function(_0x2e883c,_0x507e04,_0xcd36e9){var _0x3eaa4f={};var _0x1d1ffd={};var _0x432470;var _0x38ed79;return db[_0x3673('0x2d')][_0x3673('0x4c')]({'where':{'id':_0x2e883c[_0x3673('0x43')]['id']}})['then'](handleEntityNotFound(_0x507e04,null))[_0x3673('0x26')](function(_0x5f2ddd){if(_0x5f2ddd){_0x432470=_0x5f2ddd;_0x1d1ffd[_0x3673('0x30')]=_[_0x3673('0x31')](db['DeskConfiguration'][_0x3673('0x2e')]);_0x1d1ffd[_0x3673('0x34')]=_[_0x3673('0x31')](_0x2e883c[_0x3673('0x34')]);_0x1d1ffd[_0x3673('0x32')]=_[_0x3673('0x33')](_0x1d1ffd[_0x3673('0x30')],_0x1d1ffd[_0x3673('0x34')]);_0x3eaa4f['attributes']=_[_0x3673('0x33')](_0x1d1ffd[_0x3673('0x30')],qs[_0x3673('0x36')](_0x2e883c[_0x3673('0x34')]['fields']));_0x3eaa4f[_0x3673('0x35')]=_0x3eaa4f[_0x3673('0x35')][_0x3673('0x44')]?_0x3eaa4f[_0x3673('0x35')]:_0x1d1ffd['model'];_0x3eaa4f[_0x3673('0x39')]=qs[_0x3673('0x3a')](_0x2e883c[_0x3673('0x34')]['sort']);_0x3eaa4f[_0x3673('0x3b')]=qs[_0x3673('0x32')](_[_0x3673('0x3c')](_0x2e883c[_0x3673('0x34')],_0x1d1ffd[_0x3673('0x32')]));if(_0x2e883c[_0x3673('0x34')][_0x3673('0x4d')]){_0x3eaa4f[_0x3673('0x3b')]=_['merge'](_0x3eaa4f[_0x3673('0x3b')],{'$or':_[_0x3673('0x2c')](_0x3eaa4f[_0x3673('0x35')],function(_0x3ab4a2){var _0xb47114={};_0xb47114[_0x3ab4a2]={'$like':'%'+_0x2e883c[_0x3673('0x34')][_0x3673('0x4d')]+'%'};return _0xb47114;})});}_0x3eaa4f=_['merge']({},_0x3eaa4f,_0x2e883c[_0x3673('0x3f')]);return _0x432470[_0x3673('0x4b')](_0x3eaa4f);}})[_0x3673('0x26')](function(_0x1e5b88){if(_0x1e5b88){_0x38ed79=_0x1e5b88[_0x3673('0x44')];if(!_0x2e883c[_0x3673('0x34')][_0x3673('0x37')]('nolimit')){_0x3eaa4f[_0x3673('0x20')]=qs[_0x3673('0x20')](_0x2e883c[_0x3673('0x34')][_0x3673('0x20')]);_0x3eaa4f[_0x3673('0x1f')]=qs['offset'](_0x2e883c[_0x3673('0x34')][_0x3673('0x1f')]);}return _0x432470[_0x3673('0x4b')](_0x3eaa4f);}})[_0x3673('0x26')](function(_0x3b10a3){if(_0x3b10a3){return _0x3b10a3?{'count':_0x38ed79,'rows':_0x3b10a3}:null;}})[_0x3673('0x26')](respondWithResult(_0x507e04,null))[_0x3673('0x47')](handleError(_0x507e04,null));};exports[_0x3673('0x4e')]=function(_0x6cd340,_0xef4b6e,_0x3a8968){if(_0x6cd340[_0x3673('0x49')]['id']){delete _0x6cd340[_0x3673('0x49')]['id'];}return db[_0x3673('0x2d')]['findOne']({'where':{'id':_0x6cd340[_0x3673('0x43')]['id']}})[_0x3673('0x26')](handleEntityNotFound(_0xef4b6e,null))[_0x3673('0x26')](function(_0xbc4f44){if(_0xbc4f44){_0x6cd340[_0x3673('0x49')][_0x3673('0x4f')]=_0xbc4f44['id'];_0x6cd340[_0x3673('0x49')]['Subjects']=integrations[_0x3673('0x50')](_0x6cd340[_0x3673('0x49')][_0x3673('0x51')],_0x6cd340[_0x3673('0x49')][_0x3673('0x3e')]);_0x6cd340[_0x3673('0x49')][_0x3673('0x52')]=integrations[_0x3673('0x53')](_0x6cd340[_0x3673('0x49')][_0x3673('0x51')],_0x6cd340[_0x3673('0x49')][_0x3673('0x3e')]);return db[_0x3673('0x54')][_0x3673('0x48')](_0x6cd340[_0x3673('0x49')],{'include':[{'model':db[_0x3673('0x55')],'as':_0x3673('0x56')},{'model':db[_0x3673('0x55')],'as':_0x3673('0x52')}]});}return null;})[_0x3673('0x26')](respondWithResult(_0xef4b6e,null))[_0x3673('0x47')](handleError(_0xef4b6e,null));};exports['getFields']=function(_0x109221,_0x3a6fd5,_0x12b9c8){var _0x5d631d=[{'name':_0x3673('0x57'),'label':_0x3673('0x57'),'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 _0x203665='';return db['DeskAccount'][_0x3673('0x4c')]({'where':{'id':_0x109221[_0x3673('0x43')]['id']},'attributes':['id',_0x3673('0x58'),'authType','username',_0x3673('0x59'),_0x3673('0x5a'),_0x3673('0x5b'),_0x3673('0x5c'),_0x3673('0x5d')]})['then'](handleEntityNotFound(_0x3a6fd5,null))[_0x3673('0x26')](function(_0x5adf8d){if(_0x5adf8d){_0x203665=_0x5adf8d[_0x3673('0x58')];var _0x81f768=_0x203665[_0x3673('0x5e')](-0x1);if(_0x81f768==='/'){_0x203665=_0x203665[_0x3673('0x5f')](0x0,_0x203665['lastIndexOf'](_0x81f768));}var _0x2e69df={'method':_0x3673('0x60'),'uri':util[_0x3673('0x61')](_0x3673('0x62'),_0x203665),'headers':{'Content-Type':_0x3673('0x63'),'Accept':_0x3673('0x63')},'json':!![]};if(_0x5adf8d['authType']==='basic'){_0x2e69df['headers'][_0x3673('0x64')]=util[_0x3673('0x61')]('Basic\x20%s',new Buffer(util[_0x3673('0x61')](_0x3673('0x65'),_0x5adf8d[_0x3673('0x66')],_0x5adf8d['password']))[_0x3673('0x67')](_0x3673('0x68')));}return rp(_0x2e69df)[_0x3673('0x26')](function(_0x5bafd1){return _0x5d631d[_0x3673('0x69')](_[_0x3673('0x2c')](_0x5bafd1[_0x3673('0x6a')][_0x3673('0x6b')],function(_0x35e042){return{'id':_0x35e042[_0x3673('0x29')],'name':_0x35e042['name'],'type':_0x35e042[_0x3673('0x3e')],'active':_0x35e042[_0x3673('0x6c')],'label':_0x35e042[_0x3673('0x6d')],'custom':!![]};}));});}})['then'](function(_0x9a5a1b){return{'count':_0x9a5a1b[_0x3673('0x44')],'rows':_0x9a5a1b};})[_0x3673('0x26')](respondWithResult(_0x3a6fd5,null))[_0x3673('0x47')](function(_0x51d423){var _0x262952=_0x109221[_0x3673('0x34')][_0x3673('0x6e')]?0x1f4:_0x51d423[_0x3673('0x6f')]||0x1f4;logger[_0x3673('0x27')](_0x3673('0x70'),'getFields',_0x262952,JSON['stringify'](_0x51d423));delete _0x51d423[_0x3673('0x29')];if(_0x262952===0x191){_0x262952=0x190;}_0x3a6fd5['status'](_0x262952)['send'](_0x109221[_0x3673('0x34')][_0x3673('0x6e')]?{'message':_0x3673('0x71'),'statusCode':_0x51d423[_0x3673('0x6f')]}:_0x51d423);});}; \ No newline at end of file +var _0x1f1d=['Descriptions','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','basic','format','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','undefined','limit','count','offset','status','set','save','update','then','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','getConfigurations','findOne','DeskConfiguration','Subjects','channel','getDescriptions'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x1f1d,0xe9));var _0xd1f1=function(_0x527be8,_0x58d688){_0x527be8=_0x527be8-0x0;var _0x1c7a3f=_0x1f1d[_0x527be8];return _0x1c7a3f;};'use strict';var emlformat=require(_0xd1f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1f1('0x1'));var jsonpatch=require(_0xd1f1('0x2'));var rp=require(_0xd1f1('0x3'));var moment=require('moment');var BPromise=require(_0xd1f1('0x4'));var Mustache=require(_0xd1f1('0x5'));var util=require(_0xd1f1('0x6'));var path=require('path');var sox=require(_0xd1f1('0x7'));var csv=require(_0xd1f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1f1('0x9'));var _=require('lodash');var squel=require(_0xd1f1('0xa'));var crypto=require(_0xd1f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd1f1('0xc'));var toCsv=require(_0xd1f1('0x8'));var querystring=require('querystring');var Papa=require(_0xd1f1('0xd'));var Redis=require(_0xd1f1('0xe'));var authService=require(_0xd1f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd1f1('0x10'));var hardwareService=require(_0xd1f1('0x11'));var logger=require(_0xd1f1('0x12'))('api');var utils=require(_0xd1f1('0x13'));var config=require(_0xd1f1('0x14'));var licenseUtil=require(_0xd1f1('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd1f1('0x16'));function respondWithStatusCode(_0x35c522,_0x1f8b2f){_0x1f8b2f=_0x1f8b2f||0xcc;return function(_0x3aea28){if(_0x3aea28){return _0x35c522[_0xd1f1('0x17')](_0x1f8b2f);}return _0x35c522['status'](_0x1f8b2f)['end']();};}function respondWithResult(_0x8bafaf,_0x3c1ccb){_0x3c1ccb=_0x3c1ccb||0xc8;return function(_0x30d637){if(_0x30d637){return _0x8bafaf['status'](_0x3c1ccb)[_0xd1f1('0x18')](_0x30d637);}};}function respondWithFilteredResult(_0x3698be,_0x5b42e1){return function(_0x4b3b47){if(_0x4b3b47){var _0x56f60c=typeof _0x5b42e1['offset']===_0xd1f1('0x19')&&typeof _0x5b42e1[_0xd1f1('0x1a')]===_0xd1f1('0x19');var _0x12ce4b=_0x4b3b47[_0xd1f1('0x1b')];var _0x4db5f8=_0x56f60c?0x0:_0x5b42e1[_0xd1f1('0x1c')];var _0x4a374b=_0x56f60c?_0x4b3b47[_0xd1f1('0x1b')]:_0x5b42e1[_0xd1f1('0x1c')]+_0x5b42e1[_0xd1f1('0x1a')];var _0x3b8a78;if(_0x4a374b>=_0x12ce4b){_0x4a374b=_0x12ce4b;_0x3b8a78=0xc8;}else{_0x3b8a78=0xce;}_0x3698be[_0xd1f1('0x1d')](_0x3b8a78);return _0x3698be[_0xd1f1('0x1e')]('Content-Range',_0x4db5f8+'-'+_0x4a374b+'/'+_0x12ce4b)[_0xd1f1('0x18')](_0x4b3b47);}return null;};}function patchUpdates(_0x28b6bf){return function(_0x54e126){try{jsonpatch['apply'](_0x54e126,_0x28b6bf,!![]);}catch(_0x390d8d){return BPromise['reject'](_0x390d8d);}return _0x54e126[_0xd1f1('0x1f')]();};}function saveUpdates(_0x1b0741,_0x1d7c18){return function(_0x46f55e){if(_0x46f55e){return _0x46f55e[_0xd1f1('0x20')](_0x1b0741)[_0xd1f1('0x21')](function(_0x42af0e){return _0x42af0e;});}return null;};}function removeEntity(_0x423f7b,_0x513978){return function(_0x5e54e9){if(_0x5e54e9){return _0x5e54e9[_0xd1f1('0x22')]()[_0xd1f1('0x21')](function(){_0x423f7b[_0xd1f1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f026,_0x8a3dbc){return function(_0x18cdc8){if(!_0x18cdc8){_0x58f026['sendStatus'](0x194);}return _0x18cdc8;};}function handleError(_0xfe281f,_0x13ac23){_0x13ac23=_0x13ac23||0x1f4;return function(_0xc75b8f){logger['error'](_0xc75b8f['stack']);if(_0xc75b8f[_0xd1f1('0x23')]){delete _0xc75b8f['name'];}_0xfe281f[_0xd1f1('0x1d')](_0x13ac23)[_0xd1f1('0x24')](_0xc75b8f);};}exports['index']=function(_0x3a8d0a,_0x324a9e){var _0x30218c={},_0x89be52={},_0x27d20c={'count':0x0,'rows':[]};var _0x197c78=_[_0xd1f1('0x25')](db[_0xd1f1('0x26')][_0xd1f1('0x27')],function(_0x5b13f6){return{'name':_0x5b13f6[_0xd1f1('0x28')],'type':_0x5b13f6[_0xd1f1('0x29')][_0xd1f1('0x2a')]};});_0x89be52[_0xd1f1('0x2b')]=_[_0xd1f1('0x25')](_0x197c78,_0xd1f1('0x23'));_0x89be52['query']=_['keys'](_0x3a8d0a[_0xd1f1('0x2c')]);_0x89be52[_0xd1f1('0x2d')]=_['intersection'](_0x89be52[_0xd1f1('0x2b')],_0x89be52[_0xd1f1('0x2c')]);_0x30218c[_0xd1f1('0x2e')]=_[_0xd1f1('0x2f')](_0x89be52[_0xd1f1('0x2b')],qs[_0xd1f1('0x30')](_0x3a8d0a[_0xd1f1('0x2c')]['fields']));_0x30218c['attributes']=_0x30218c[_0xd1f1('0x2e')]['length']?_0x30218c[_0xd1f1('0x2e')]:_0x89be52['model'];if(!_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x31')](_0xd1f1('0x32'))){_0x30218c['limit']=qs[_0xd1f1('0x1a')](_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x1a')]);_0x30218c[_0xd1f1('0x1c')]=qs[_0xd1f1('0x1c')](_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x1c')]);}_0x30218c[_0xd1f1('0x33')]=qs[_0xd1f1('0x34')](_0x3a8d0a['query'][_0xd1f1('0x34')]);_0x30218c[_0xd1f1('0x35')]=qs[_0xd1f1('0x2d')](_[_0xd1f1('0x36')](_0x3a8d0a[_0xd1f1('0x2c')],_0x89be52[_0xd1f1('0x2d')]),_0x197c78);if(_0x3a8d0a['query']['filter']){_0x30218c[_0xd1f1('0x35')]=_[_0xd1f1('0x37')](_0x30218c[_0xd1f1('0x35')],{'$or':_['map'](_0x197c78,function(_0x8f6269){if(_0x8f6269[_0xd1f1('0x29')]!==_0xd1f1('0x38')){var _0x35b29d={};_0x35b29d[_0x8f6269['name']]={'$like':'%'+_0x3a8d0a[_0xd1f1('0x2c')][_0xd1f1('0x39')]+'%'};return _0x35b29d;}})});}_0x30218c=_[_0xd1f1('0x37')]({},_0x30218c,_0x3a8d0a[_0xd1f1('0x3a')]);var _0x47cb21={'where':_0x30218c['where']};return db['DeskAccount']['count'](_0x47cb21)[_0xd1f1('0x21')](function(_0x554e23){_0x27d20c[_0xd1f1('0x1b')]=_0x554e23;if(_0x3a8d0a['query'][_0xd1f1('0x3b')]){_0x30218c['include']=[{'all':!![]}];}return db[_0xd1f1('0x26')][_0xd1f1('0x3c')](_0x30218c);})[_0xd1f1('0x21')](function(_0x32978b){_0x27d20c['rows']=_0x32978b;return _0x27d20c;})['then'](respondWithFilteredResult(_0x324a9e,_0x30218c))[_0xd1f1('0x3d')](handleError(_0x324a9e,null));};exports[_0xd1f1('0x3e')]=function(_0x3fd4af,_0x13ec7d){var _0x1d375d={'raw':![],'where':{'id':_0x3fd4af[_0xd1f1('0x3f')]['id']}},_0x230a02={};_0x230a02['model']=_[_0xd1f1('0x40')](db[_0xd1f1('0x26')]['rawAttributes']);_0x230a02[_0xd1f1('0x2c')]=_['keys'](_0x3fd4af[_0xd1f1('0x2c')]);_0x230a02[_0xd1f1('0x2d')]=_['intersection'](_0x230a02[_0xd1f1('0x2b')],_0x230a02[_0xd1f1('0x2c')]);_0x1d375d[_0xd1f1('0x2e')]=_['intersection'](_0x230a02[_0xd1f1('0x2b')],qs['fields'](_0x3fd4af[_0xd1f1('0x2c')][_0xd1f1('0x30')]));_0x1d375d[_0xd1f1('0x2e')]=_0x1d375d[_0xd1f1('0x2e')][_0xd1f1('0x41')]?_0x1d375d[_0xd1f1('0x2e')]:_0x230a02[_0xd1f1('0x2b')];if(_0x3fd4af[_0xd1f1('0x2c')][_0xd1f1('0x3b')]){_0x1d375d[_0xd1f1('0x42')]=[{'all':!![]}];}_0x1d375d=_[_0xd1f1('0x37')]({},_0x1d375d,_0x3fd4af[_0xd1f1('0x3a')]);return db['DeskAccount'][_0xd1f1('0x43')](_0x1d375d)[_0xd1f1('0x21')](handleEntityNotFound(_0x13ec7d,null))[_0xd1f1('0x21')](respondWithResult(_0x13ec7d,null))[_0xd1f1('0x3d')](handleError(_0x13ec7d,null));};exports[_0xd1f1('0x44')]=function(_0x16cab8,_0x5a5b41){return db['DeskAccount'][_0xd1f1('0x44')](_0x16cab8[_0xd1f1('0x45')],{})[_0xd1f1('0x21')](respondWithResult(_0x5a5b41,0xc9))[_0xd1f1('0x3d')](handleError(_0x5a5b41,null));};exports[_0xd1f1('0x20')]=function(_0x1c3be2,_0x164dbf){if(_0x1c3be2[_0xd1f1('0x45')]['id']){delete _0x1c3be2['body']['id'];}return db['DeskAccount'][_0xd1f1('0x43')]({'where':{'id':_0x1c3be2['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0x164dbf,null))[_0xd1f1('0x21')](saveUpdates(_0x1c3be2[_0xd1f1('0x45')],null))['then'](respondWithResult(_0x164dbf,null))[_0xd1f1('0x3d')](handleError(_0x164dbf,null));};exports[_0xd1f1('0x22')]=function(_0x16ce7b,_0xcedbe9){return db['DeskAccount'][_0xd1f1('0x43')]({'where':{'id':_0x16ce7b['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0xcedbe9,null))['then'](removeEntity(_0xcedbe9,null))[_0xd1f1('0x3d')](handleError(_0xcedbe9,null));};exports[_0xd1f1('0x46')]=function(_0x41e17f,_0x582d7a,_0x25294e){var _0x1c58f3={};var _0x144064={};var _0x4b0fbd;var _0x18238d;return db[_0xd1f1('0x26')][_0xd1f1('0x47')]({'where':{'id':_0x41e17f[_0xd1f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x582d7a,null))['then'](function(_0x5396ed){if(_0x5396ed){_0x4b0fbd=_0x5396ed;_0x144064[_0xd1f1('0x2b')]=_['keys'](db[_0xd1f1('0x48')][_0xd1f1('0x27')]);_0x144064['query']=_[_0xd1f1('0x40')](_0x41e17f[_0xd1f1('0x2c')]);_0x144064['filters']=_[_0xd1f1('0x2f')](_0x144064[_0xd1f1('0x2b')],_0x144064[_0xd1f1('0x2c')]);_0x1c58f3[_0xd1f1('0x2e')]=_[_0xd1f1('0x2f')](_0x144064[_0xd1f1('0x2b')],qs[_0xd1f1('0x30')](_0x41e17f[_0xd1f1('0x2c')]['fields']));_0x1c58f3[_0xd1f1('0x2e')]=_0x1c58f3[_0xd1f1('0x2e')]['length']?_0x1c58f3['attributes']:_0x144064[_0xd1f1('0x2b')];_0x1c58f3['order']=qs[_0xd1f1('0x34')](_0x41e17f['query'][_0xd1f1('0x34')]);_0x1c58f3['where']=qs[_0xd1f1('0x2d')](_[_0xd1f1('0x36')](_0x41e17f[_0xd1f1('0x2c')],_0x144064['filters']));if(_0x41e17f[_0xd1f1('0x2c')]['filter']){_0x1c58f3[_0xd1f1('0x35')]=_['merge'](_0x1c58f3[_0xd1f1('0x35')],{'$or':_['map'](_0x1c58f3[_0xd1f1('0x2e')],function(_0x5be045){var _0x4bf945={};_0x4bf945[_0x5be045]={'$like':'%'+_0x41e17f[_0xd1f1('0x2c')]['filter']+'%'};return _0x4bf945;})});}_0x1c58f3=_[_0xd1f1('0x37')]({},_0x1c58f3,_0x41e17f[_0xd1f1('0x3a')]);return _0x4b0fbd[_0xd1f1('0x46')](_0x1c58f3);}})[_0xd1f1('0x21')](function(_0x33d12c){if(_0x33d12c){_0x18238d=_0x33d12c[_0xd1f1('0x41')];if(!_0x41e17f['query'][_0xd1f1('0x31')]('nolimit')){_0x1c58f3[_0xd1f1('0x1a')]=qs[_0xd1f1('0x1a')](_0x41e17f[_0xd1f1('0x2c')][_0xd1f1('0x1a')]);_0x1c58f3[_0xd1f1('0x1c')]=qs[_0xd1f1('0x1c')](_0x41e17f[_0xd1f1('0x2c')][_0xd1f1('0x1c')]);}return _0x4b0fbd[_0xd1f1('0x46')](_0x1c58f3);}})['then'](function(_0x1bbc5){if(_0x1bbc5){return _0x1bbc5?{'count':_0x18238d,'rows':_0x1bbc5}:null;}})[_0xd1f1('0x21')](respondWithResult(_0x582d7a,null))['catch'](handleError(_0x582d7a,null));};exports['addConfiguration']=function(_0x2806b9,_0x2ee0f4,_0x54a769){if(_0x2806b9[_0xd1f1('0x45')]['id']){delete _0x2806b9[_0xd1f1('0x45')]['id'];}return db[_0xd1f1('0x26')][_0xd1f1('0x47')]({'where':{'id':_0x2806b9['params']['id']}})[_0xd1f1('0x21')](handleEntityNotFound(_0x2ee0f4,null))[_0xd1f1('0x21')](function(_0x2344b9){if(_0x2344b9){_0x2806b9[_0xd1f1('0x45')]['AccountId']=_0x2344b9['id'];_0x2806b9['body'][_0xd1f1('0x49')]=integrations['getSubjects'](_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x4a')],_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x29')]);_0x2806b9[_0xd1f1('0x45')]['Descriptions']=integrations[_0xd1f1('0x4b')](_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x4a')],_0x2806b9[_0xd1f1('0x45')][_0xd1f1('0x29')]);return db[_0xd1f1('0x48')]['create'](_0x2806b9[_0xd1f1('0x45')],{'include':[{'model':db['DeskField'],'as':_0xd1f1('0x49')},{'model':db['DeskField'],'as':_0xd1f1('0x4c')}]});}return null;})[_0xd1f1('0x21')](respondWithResult(_0x2ee0f4,null))[_0xd1f1('0x3d')](handleError(_0x2ee0f4,null));};exports['getFields']=function(_0x480f0c,_0xed52d7,_0x138ca6){var _0x54d87c=[{'name':_0xd1f1('0x4d'),'label':_0xd1f1('0x4d'),'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 _0x5202b8='';return db['DeskAccount'][_0xd1f1('0x47')]({'where':{'id':_0x480f0c['params']['id']},'attributes':['id',_0xd1f1('0x4e'),_0xd1f1('0x4f'),_0xd1f1('0x50'),'password','consumerKey',_0xd1f1('0x51'),_0xd1f1('0x52'),_0xd1f1('0x53')]})['then'](handleEntityNotFound(_0xed52d7,null))[_0xd1f1('0x21')](function(_0x19a2ba){if(_0x19a2ba){_0x5202b8=_0x19a2ba[_0xd1f1('0x4e')];var _0x1aeff2=_0x5202b8[_0xd1f1('0x54')](-0x1);if(_0x1aeff2==='/'){_0x5202b8=_0x5202b8[_0xd1f1('0x55')](0x0,_0x5202b8[_0xd1f1('0x56')](_0x1aeff2));}var _0x4f8ef5={'method':_0xd1f1('0x57'),'uri':util['format']('%s/custom_fields',_0x5202b8),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x19a2ba[_0xd1f1('0x4f')]===_0xd1f1('0x58')){_0x4f8ef5['headers']['Authorization']=util[_0xd1f1('0x59')]('Basic\x20%s',new Buffer(util['format'](_0xd1f1('0x5a'),_0x19a2ba[_0xd1f1('0x50')],_0x19a2ba[_0xd1f1('0x5b')]))[_0xd1f1('0x5c')](_0xd1f1('0x5d')));}return rp(_0x4f8ef5)[_0xd1f1('0x21')](function(_0x597d0e){return _0x54d87c[_0xd1f1('0x5e')](_[_0xd1f1('0x25')](_0x597d0e[_0xd1f1('0x5f')][_0xd1f1('0x60')],function(_0x385b64){return{'id':_0x385b64[_0xd1f1('0x23')],'name':_0x385b64[_0xd1f1('0x23')],'type':_0x385b64[_0xd1f1('0x29')],'active':_0x385b64[_0xd1f1('0x61')],'label':_0x385b64[_0xd1f1('0x62')],'custom':!![]};}));});}})[_0xd1f1('0x21')](function(_0x291402){return{'count':_0x291402[_0xd1f1('0x41')],'rows':_0x291402};})[_0xd1f1('0x21')](respondWithResult(_0xed52d7,null))[_0xd1f1('0x3d')](function(_0x1cad1b){var _0x12088b=_0x480f0c[_0xd1f1('0x2c')][_0xd1f1('0x63')]?0x1f4:_0x1cad1b[_0xd1f1('0x64')]||0x1f4;logger['error'](_0xd1f1('0x65'),_0xd1f1('0x66'),_0x12088b,JSON['stringify'](_0x1cad1b));delete _0x1cad1b[_0xd1f1('0x23')];if(_0x12088b===0x191){_0x12088b=0x190;}_0xed52d7['status'](_0x12088b)[_0xd1f1('0x24')](_0x480f0c[_0xd1f1('0x2c')][_0xd1f1('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x1cad1b[_0xd1f1('0x64')]}:_0x1cad1b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e10c5c8..ab7d74c 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 _0xf9dc=['DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xf9dc,0x120));var _0xcf9d=function(_0x264609,_0x7609b9){_0x264609=_0x264609-0x0;var _0x1f38b9=_0xf9dc[_0x264609];return _0x1f38b9;};'use strict';var _=require(_0xcf9d('0x0'));var util=require(_0xcf9d('0x1'));var logger=require('../../config/logger')(_0xcf9d('0x2'));var moment=require(_0xcf9d('0x3'));var BPromise=require(_0xcf9d('0x4'));var rp=require(_0xcf9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf9d('0x6'));var config=require(_0xcf9d('0x7'));var attributes=require(_0xcf9d('0x8'));var integrations=require(_0xcf9d('0x9'));module[_0xcf9d('0xa')]=function(_0x491429,_0x32b125){return _0x491429['define'](_0xcf9d('0xb'),attributes,{'tableName':_0xcf9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b66=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes'];(function(_0x376d5e,_0x10f273){var _0x259ae9=function(_0x5655b8){while(--_0x5655b8){_0x376d5e['push'](_0x376d5e['shift']());}};_0x259ae9(++_0x10f273);}(_0x5b66,0x1e1));var _0x65b6=function(_0xd123d8,_0x5a20be){_0xd123d8=_0xd123d8-0x0;var _0x3a48f8=_0x5b66[_0xd123d8];return _0x3a48f8;};'use strict';var _=require(_0x65b6('0x0'));var util=require(_0x65b6('0x1'));var logger=require('../../config/logger')(_0x65b6('0x2'));var moment=require(_0x65b6('0x3'));var BPromise=require(_0x65b6('0x4'));var rp=require(_0x65b6('0x5'));var fs=require('fs');var path=require(_0x65b6('0x6'));var rimraf=require('rimraf');var config=require(_0x65b6('0x7'));var attributes=require(_0x65b6('0x8'));var integrations=require(_0x65b6('0x9'));module[_0x65b6('0xa')]=function(_0x274913,_0x3c31ef){return _0x274913[_0x65b6('0xb')](_0x65b6('0xc'),attributes,{'tableName':_0x65b6('0xd'),'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 d828e77..3d4638d 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 _0xb33d=['client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowDeskAccount','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x144cca,_0x5ab682){var _0x5a5d0d=function(_0x7f16fb){while(--_0x7f16fb){_0x144cca['push'](_0x144cca['shift']());}};_0x5a5d0d(++_0x5ab682);}(_0xb33d,0x1ab));var _0xdb33=function(_0x381fa6,_0x5532d9){_0x381fa6=_0x381fa6-0x0;var _0x488bb5=_0xb33d[_0x381fa6];return _0x488bb5;};'use strict';var _=require(_0xdb33('0x0'));var util=require('util');var moment=require(_0xdb33('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb33('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb33('0x3'));var logger=require(_0xdb33('0x4'))(_0xdb33('0x5'));var config=require(_0xdb33('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb33('0x7')][_0xdb33('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd776bd,_0x3aa075,_0x14d16b){return new BPromise(function(_0x50b2fd,_0x2d6020){return client['request'](_0xd776bd,_0x14d16b)[_0xdb33('0x9')](function(_0x189770){logger[_0xdb33('0xa')]('DeskAccount,\x20%s,\x20%s',_0x3aa075,_0xdb33('0xb'));logger[_0xdb33('0xc')](_0xdb33('0xd'),_0x3aa075,'request\x20sent',JSON['stringify'](_0x189770));if(_0x189770[_0xdb33('0xe')]){if(_0x189770['error'][_0xdb33('0xf')]===0x1f4){logger[_0xdb33('0xe')](_0xdb33('0x10'),_0x3aa075,_0x189770[_0xdb33('0xe')]['message']);return _0x2d6020(_0x189770[_0xdb33('0xe')][_0xdb33('0x11')]);}logger['error'](_0xdb33('0x10'),_0x3aa075,_0x189770['error'][_0xdb33('0x11')]);return _0x50b2fd(_0x189770[_0xdb33('0xe')]['message']);}else{logger[_0xdb33('0xa')](_0xdb33('0x10'),_0x3aa075,_0xdb33('0xb'));_0x50b2fd(_0x189770['result'][_0xdb33('0x11')]);}})[_0xdb33('0x12')](function(_0x114739){logger['error'](_0xdb33('0x10'),_0x3aa075,_0x114739);_0x2d6020(_0x114739);});});}exports[_0xdb33('0x13')]=function(_0x5c9194){var _0x568ff8=this;return new Promise(function(_0x419844,_0xf3b6f6){return db[_0xdb33('0x14')]['findAll']({'raw':_0x5c9194[_0xdb33('0x15')]?_0x5c9194[_0xdb33('0x15')][_0xdb33('0x16')]===undefined?!![]:![]:!![],'where':_0x5c9194[_0xdb33('0x15')]?_0x5c9194['options'][_0xdb33('0x17')]||null:null,'attributes':_0x5c9194[_0xdb33('0x15')]?_0x5c9194[_0xdb33('0x15')][_0xdb33('0x18')]||null:null,'limit':_0x5c9194[_0xdb33('0x15')]?_0x5c9194[_0xdb33('0x15')][_0xdb33('0x19')]||null:null,'include':_0x5c9194[_0xdb33('0x15')]?_0x5c9194['options'][_0xdb33('0x1a')]?_[_0xdb33('0x1b')](_0x5c9194[_0xdb33('0x15')][_0xdb33('0x1a')],function(_0x42f203){return{'model':db[_0x42f203[_0xdb33('0x1c')]],'as':_0x42f203['as'],'attributes':_0x42f203[_0xdb33('0x18')],'include':_0x42f203[_0xdb33('0x1a')]?_[_0xdb33('0x1b')](_0x42f203[_0xdb33('0x1a')],function(_0x394ce2){return{'model':db[_0x394ce2['model']],'as':_0x394ce2['as'],'attributes':_0x394ce2['attributes'],'include':_0x394ce2[_0xdb33('0x1a')]?_[_0xdb33('0x1b')](_0x394ce2[_0xdb33('0x1a')],function(_0x56a0fd){return{'model':db[_0x56a0fd[_0xdb33('0x1c')]],'as':_0x56a0fd['as'],'attributes':_0x56a0fd[_0xdb33('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdb33('0x9')](function(_0x4f8b68){logger[_0xdb33('0xa')](_0xdb33('0x13'),_0x5c9194);logger[_0xdb33('0xc')](_0xdb33('0x13'),_0x5c9194,JSON[_0xdb33('0x1d')](_0x4f8b68));_0x419844(_0x4f8b68);})[_0xdb33('0x12')](function(_0x1debd1){logger[_0xdb33('0xe')](_0xdb33('0x13'),_0x1debd1[_0xdb33('0x11')],_0x5c9194);_0xf3b6f6(_0x568ff8['error'](0x1f4,_0x1debd1[_0xdb33('0x11')]));});});};exports[_0xdb33('0x1e')]=function(_0x367d3a){var _0xcd9bd2=this;return new Promise(function(_0x3da327,_0x224623){return db[_0xdb33('0x14')]['find']({'raw':_0x367d3a[_0xdb33('0x15')]?_0x367d3a['options']['raw']===undefined?!![]:![]:!![],'where':_0x367d3a['options']?_0x367d3a[_0xdb33('0x15')]['where']||null:null,'attributes':_0x367d3a[_0xdb33('0x15')]?_0x367d3a[_0xdb33('0x15')][_0xdb33('0x18')]||null:null,'include':_0x367d3a[_0xdb33('0x15')]?_0x367d3a[_0xdb33('0x15')]['include']?_[_0xdb33('0x1b')](_0x367d3a[_0xdb33('0x15')][_0xdb33('0x1a')],function(_0x5c5995){return{'model':db[_0x5c5995[_0xdb33('0x1c')]],'as':_0x5c5995['as'],'attributes':_0x5c5995['attributes'],'include':_0x5c5995['include']?_[_0xdb33('0x1b')](_0x5c5995[_0xdb33('0x1a')],function(_0x30bf18){return{'model':db[_0x30bf18[_0xdb33('0x1c')]],'as':_0x30bf18['as'],'attributes':_0x30bf18[_0xdb33('0x18')],'include':_0x30bf18['include']?_[_0xdb33('0x1b')](_0x30bf18[_0xdb33('0x1a')],function(_0xc5f4ee){return{'model':db[_0xc5f4ee[_0xdb33('0x1c')]],'as':_0xc5f4ee['as'],'attributes':_0xc5f4ee[_0xdb33('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdb33('0x9')](function(_0x34b053){logger[_0xdb33('0xa')]('ShowDeskAccount',_0x367d3a);logger['debug'](_0xdb33('0x1e'),_0x367d3a,JSON[_0xdb33('0x1d')](_0x34b053));_0x3da327(_0x34b053);})[_0xdb33('0x12')](function(_0xc6e33a){logger['error'](_0xdb33('0x1e'),_0xc6e33a[_0xdb33('0x11')],_0x367d3a);_0x224623(_0xcd9bd2[_0xdb33('0xe')](0x1f4,_0xc6e33a[_0xdb33('0x11')]));});});}; \ No newline at end of file +var _0xffaa=['rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','stringify','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x33928f,_0x147a47){var _0x470f03=function(_0x49234a){while(--_0x49234a){_0x33928f['push'](_0x33928f['shift']());}};_0x470f03(++_0x147a47);}(_0xffaa,0x1b4));var _0xaffa=function(_0xf89f09,_0x3dcc55){_0xf89f09=_0xf89f09-0x0;var _0x4c74c2=_0xffaa[_0xf89f09];return _0x4c74c2;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var moment=require(_0xaffa('0x2'));var BPromise=require(_0xaffa('0x3'));var rs=require(_0xaffa('0x4'));var fs=require('fs');var Redis=require(_0xaffa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaffa('0x6'));var logger=require(_0xaffa('0x7'))(_0xaffa('0x8'));var config=require('../../config/environment');var jayson=require(_0xaffa('0x9'));var client=jayson['client'][_0xaffa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5069de,_0xc461ac,_0x3e3872){return new BPromise(function(_0x316cec,_0x28ecbf){return client[_0xaffa('0xb')](_0x5069de,_0x3e3872)[_0xaffa('0xc')](function(_0x12fa16){logger[_0xaffa('0xd')](_0xaffa('0xe'),_0xc461ac,_0xaffa('0xf'));logger[_0xaffa('0x10')](_0xaffa('0x11'),_0xc461ac,_0xaffa('0xf'),JSON['stringify'](_0x12fa16));if(_0x12fa16[_0xaffa('0x12')]){if(_0x12fa16[_0xaffa('0x12')][_0xaffa('0x13')]===0x1f4){logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x12fa16['error'][_0xaffa('0x14')]);return _0x28ecbf(_0x12fa16[_0xaffa('0x12')]['message']);}logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x12fa16[_0xaffa('0x12')][_0xaffa('0x14')]);return _0x316cec(_0x12fa16[_0xaffa('0x12')][_0xaffa('0x14')]);}else{logger['info'](_0xaffa('0xe'),_0xc461ac,_0xaffa('0xf'));_0x316cec(_0x12fa16[_0xaffa('0x15')][_0xaffa('0x14')]);}})[_0xaffa('0x16')](function(_0x4a4528){logger[_0xaffa('0x12')](_0xaffa('0xe'),_0xc461ac,_0x4a4528);_0x28ecbf(_0x4a4528);});});}exports['GetDeskAccount']=function(_0x3e6cc5){var _0x524538=this;return new Promise(function(_0x402d43,_0x3d17fa){return db['DeskAccount'][_0xaffa('0x17')]({'raw':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x1a')]||null:null,'attributes':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5['options'][_0xaffa('0x1b')]||null:null,'limit':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')][_0xaffa('0x1c')]||null:null,'include':_0x3e6cc5[_0xaffa('0x18')]?_0x3e6cc5[_0xaffa('0x18')]['include']?_['map'](_0x3e6cc5['options'][_0xaffa('0x1d')],function(_0x19734c){return{'model':db[_0x19734c[_0xaffa('0x1e')]],'as':_0x19734c['as'],'attributes':_0x19734c[_0xaffa('0x1b')],'include':_0x19734c[_0xaffa('0x1d')]?_['map'](_0x19734c['include'],function(_0x2e0356){return{'model':db[_0x2e0356[_0xaffa('0x1e')]],'as':_0x2e0356['as'],'attributes':_0x2e0356[_0xaffa('0x1b')],'include':_0x2e0356['include']?_[_0xaffa('0x1f')](_0x2e0356[_0xaffa('0x1d')],function(_0x5b1169){return{'model':db[_0x5b1169[_0xaffa('0x1e')]],'as':_0x5b1169['as'],'attributes':_0x5b1169['attributes']};}):[]};}):[]};}):[]:[]})[_0xaffa('0xc')](function(_0x395399){logger[_0xaffa('0xd')](_0xaffa('0x20'),_0x3e6cc5);logger['debug'](_0xaffa('0x20'),_0x3e6cc5,JSON[_0xaffa('0x21')](_0x395399));_0x402d43(_0x395399);})[_0xaffa('0x16')](function(_0x488231){logger[_0xaffa('0x12')](_0xaffa('0x20'),_0x488231[_0xaffa('0x14')],_0x3e6cc5);_0x3d17fa(_0x524538[_0xaffa('0x12')](0x1f4,_0x488231[_0xaffa('0x14')]));});});};exports[_0xaffa('0x22')]=function(_0x3c005d){var _0x3d49f6=this;return new Promise(function(_0x4bec50,_0x398f93){return db[_0xaffa('0x23')][_0xaffa('0x24')]({'raw':_0x3c005d[_0xaffa('0x18')]?_0x3c005d[_0xaffa('0x18')][_0xaffa('0x19')]===undefined?!![]:![]:!![],'where':_0x3c005d['options']?_0x3c005d['options'][_0xaffa('0x1a')]||null:null,'attributes':_0x3c005d['options']?_0x3c005d['options'][_0xaffa('0x1b')]||null:null,'include':_0x3c005d[_0xaffa('0x18')]?_0x3c005d[_0xaffa('0x18')]['include']?_[_0xaffa('0x1f')](_0x3c005d[_0xaffa('0x18')][_0xaffa('0x1d')],function(_0x1cdaae){return{'model':db[_0x1cdaae[_0xaffa('0x1e')]],'as':_0x1cdaae['as'],'attributes':_0x1cdaae['attributes'],'include':_0x1cdaae[_0xaffa('0x1d')]?_['map'](_0x1cdaae[_0xaffa('0x1d')],function(_0x4c761a){return{'model':db[_0x4c761a['model']],'as':_0x4c761a['as'],'attributes':_0x4c761a['attributes'],'include':_0x4c761a['include']?_[_0xaffa('0x1f')](_0x4c761a['include'],function(_0x3fa1ce){return{'model':db[_0x3fa1ce[_0xaffa('0x1e')]],'as':_0x3fa1ce['as'],'attributes':_0x3fa1ce[_0xaffa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaffa('0xc')](function(_0x1c8139){logger[_0xaffa('0xd')](_0xaffa('0x22'),_0x3c005d);logger[_0xaffa('0x10')](_0xaffa('0x22'),_0x3c005d,JSON[_0xaffa('0x21')](_0x1c8139));_0x4bec50(_0x1c8139);})[_0xaffa('0x16')](function(_0x2e2c57){logger[_0xaffa('0x12')](_0xaffa('0x22'),_0x2e2c57[_0xaffa('0x14')],_0x3c005d);_0x398f93(_0x3d49f6[_0xaffa('0x12')](0x1f4,_0x2e2c57[_0xaffa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ae3e01f..ce57b22 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3358a3,_0x1025c6){var _0x3d10d4=function(_0x43fb0c){while(--_0x43fb0c){_0x3358a3['push'](_0x3358a3['shift']());}};_0x3d10d4(++_0x1025c6);}(_0x008c,0x188));var _0xc008=function(_0x3fbdf6,_0x47945b){_0x3fbdf6=_0x3fbdf6-0x0;var _0x1d948f=_0x008c[_0x3fbdf6];return _0x1d948f;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x5bee08,_0x2c0d63){var _0x39054b=function(_0x32bd07){while(--_0x32bd07){_0x5bee08['push'](_0x5bee08['shift']());}};_0x39054b(++_0x2c0d63);}(_0xedd9,0xfc));var _0x9edd=function(_0x178e67,_0x14fa99){_0x178e67=_0x178e67-0x0;var _0x44aef8=_0xedd9[_0x178e67];return _0x44aef8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c1471d6..03743c6 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 _0x2454=['sequelize','exports','STRING'];(function(_0x30adb2,_0x3073d4){var _0x4b1c4b=function(_0x1b82a4){while(--_0x1b82a4){_0x30adb2['push'](_0x30adb2['shift']());}};_0x4b1c4b(++_0x3073d4);}(_0x2454,0x11a));var _0x4245=function(_0x4052f6,_0x290b2c){_0x4052f6=_0x4052f6-0x0;var _0x59850=_0x2454[_0x4052f6];return _0x59850;};'use strict';var Sequelize=require(_0x4245('0x0'));module[_0x4245('0x1')]={'name':{'type':Sequelize[_0x4245('0x2')]},'description':{'type':Sequelize[_0x4245('0x2')]}}; \ No newline at end of file +var _0xa6fd=['STRING','sequelize'];(function(_0x2f800b,_0x54303d){var _0x55ca60=function(_0x5dd143){while(--_0x5dd143){_0x2f800b['push'](_0x2f800b['shift']());}};_0x55ca60(++_0x54303d);}(_0xa6fd,0x189));var _0xda6f=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xa6fd[_0x2e68db];return _0x12df4c;};'use strict';var Sequelize=require(_0xda6f('0x0'));module['exports']={'name':{'type':Sequelize[_0xda6f('0x1')]},'description':{'type':Sequelize[_0xda6f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1c0e27a..c7862d6 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 _0xab59=['includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','filter','nolimit','getFields','getSubjects','DeskField','getDescriptions','findOne','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','reject','update','then','destroy','error','stack','name','index','map','DeskConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge'];(function(_0x5c62,_0x5a8a0b){var _0x34f49d=function(_0x289ea5){while(--_0x289ea5){_0x5c62['push'](_0x5c62['shift']());}};_0x34f49d(++_0x5a8a0b);}(_0xab59,0xb6));var _0x9ab5=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xab59[_0x4a93bb];return _0x208468;};'use strict';var emlformat=require(_0x9ab5('0x0'));var rimraf=require(_0x9ab5('0x1'));var zipdir=require(_0x9ab5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ab5('0x3'));var moment=require(_0x9ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ab5('0x5'));var util=require(_0x9ab5('0x6'));var path=require('path');var sox=require(_0x9ab5('0x7'));var csv=require('to-csv');var ejs=require(_0x9ab5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ab5('0x9'));var squel=require(_0x9ab5('0xa'));var crypto=require(_0x9ab5('0xb'));var jsforce=require(_0x9ab5('0xc'));var deskjs=require(_0x9ab5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9ab5('0xe'));var Papa=require('papaparse');var Redis=require(_0x9ab5('0xf'));var authService=require(_0x9ab5('0x10'));var qs=require(_0x9ab5('0x11'));var as=require(_0x9ab5('0x12'));var hardwareService=require(_0x9ab5('0x13'));var logger=require(_0x9ab5('0x14'))(_0x9ab5('0x15'));var utils=require('../../config/utils');var config=require(_0x9ab5('0x16'));var licenseUtil=require(_0x9ab5('0x17'));var db=require(_0x9ab5('0x18'))['db'];function respondWithStatusCode(_0x5e186f,_0x489cf9){_0x489cf9=_0x489cf9||0xcc;return function(_0x146259){if(_0x146259){return _0x5e186f[_0x9ab5('0x19')](_0x489cf9);}return _0x5e186f[_0x9ab5('0x1a')](_0x489cf9)[_0x9ab5('0x1b')]();};}function respondWithResult(_0x9f2336,_0x128dab){_0x128dab=_0x128dab||0xc8;return function(_0x25dd28){if(_0x25dd28){return _0x9f2336[_0x9ab5('0x1a')](_0x128dab)[_0x9ab5('0x1c')](_0x25dd28);}};}function respondWithFilteredResult(_0x49e772,_0x452afa){return function(_0x1c2cb0){if(_0x1c2cb0){var _0x1672ea=typeof _0x452afa[_0x9ab5('0x1d')]==='undefined'&&typeof _0x452afa[_0x9ab5('0x1e')]==='undefined';var _0x3fc897=_0x1c2cb0[_0x9ab5('0x1f')];var _0x1f66b3=_0x1672ea?0x0:_0x452afa[_0x9ab5('0x1d')];var _0x1784f7=_0x1672ea?_0x1c2cb0[_0x9ab5('0x1f')]:_0x452afa[_0x9ab5('0x1d')]+_0x452afa[_0x9ab5('0x1e')];var _0xcfd1ca;if(_0x1784f7>=_0x3fc897){_0x1784f7=_0x3fc897;_0xcfd1ca=0xc8;}else{_0xcfd1ca=0xce;}_0x49e772[_0x9ab5('0x1a')](_0xcfd1ca);return _0x49e772['set']('Content-Range',_0x1f66b3+'-'+_0x1784f7+'/'+_0x3fc897)[_0x9ab5('0x1c')](_0x1c2cb0);}return null;};}function patchUpdates(_0xbc3587){return function(_0x5b37d3){try{jsonpatch[_0x9ab5('0x20')](_0x5b37d3,_0xbc3587,!![]);}catch(_0x4435e5){return BPromise[_0x9ab5('0x21')](_0x4435e5);}return _0x5b37d3['save']();};}function saveUpdates(_0x2905b6,_0x1f86b6){return function(_0x4c5958){if(_0x4c5958){return _0x4c5958[_0x9ab5('0x22')](_0x2905b6)[_0x9ab5('0x23')](function(_0x230cae){return _0x230cae;});}return null;};}function removeEntity(_0x1c047e,_0x290841){return function(_0x4b069e){if(_0x4b069e){return _0x4b069e[_0x9ab5('0x24')]()[_0x9ab5('0x23')](function(){_0x1c047e['status'](0xcc)[_0x9ab5('0x1b')]();});}};}function handleEntityNotFound(_0x2a3043,_0x4537c3){return function(_0x1ef746){if(!_0x1ef746){_0x2a3043[_0x9ab5('0x19')](0x194);}return _0x1ef746;};}function handleError(_0x5db2b6,_0x1b9016){_0x1b9016=_0x1b9016||0x1f4;return function(_0x32d122){logger[_0x9ab5('0x25')](_0x32d122[_0x9ab5('0x26')]);if(_0x32d122[_0x9ab5('0x27')]){delete _0x32d122[_0x9ab5('0x27')];}_0x5db2b6['status'](_0x1b9016)['send'](_0x32d122);};}exports[_0x9ab5('0x28')]=function(_0x53fd5b,_0x2da767){var _0x4340dd={},_0x36fe10={},_0x3e60b8={'count':0x0,'rows':[]};var _0x251354=_[_0x9ab5('0x29')](db[_0x9ab5('0x2a')]['rawAttributes'],function(_0x54e40d){return{'name':_0x54e40d[_0x9ab5('0x2b')],'type':_0x54e40d[_0x9ab5('0x2c')][_0x9ab5('0x2d')]};});_0x36fe10['model']=_[_0x9ab5('0x29')](_0x251354,_0x9ab5('0x27'));_0x36fe10[_0x9ab5('0x2e')]=_[_0x9ab5('0x2f')](_0x53fd5b[_0x9ab5('0x2e')]);_0x36fe10[_0x9ab5('0x30')]=_[_0x9ab5('0x31')](_0x36fe10[_0x9ab5('0x32')],_0x36fe10['query']);_0x4340dd[_0x9ab5('0x33')]=_['intersection'](_0x36fe10[_0x9ab5('0x32')],qs[_0x9ab5('0x34')](_0x53fd5b[_0x9ab5('0x2e')][_0x9ab5('0x34')]));_0x4340dd[_0x9ab5('0x33')]=_0x4340dd['attributes'][_0x9ab5('0x35')]?_0x4340dd[_0x9ab5('0x33')]:_0x36fe10[_0x9ab5('0x32')];if(!_0x53fd5b['query'][_0x9ab5('0x36')]('nolimit')){_0x4340dd[_0x9ab5('0x1e')]=qs[_0x9ab5('0x1e')](_0x53fd5b[_0x9ab5('0x2e')][_0x9ab5('0x1e')]);_0x4340dd[_0x9ab5('0x1d')]=qs[_0x9ab5('0x1d')](_0x53fd5b[_0x9ab5('0x2e')][_0x9ab5('0x1d')]);}_0x4340dd[_0x9ab5('0x37')]=qs[_0x9ab5('0x38')](_0x53fd5b[_0x9ab5('0x2e')]['sort']);_0x4340dd[_0x9ab5('0x39')]=qs[_0x9ab5('0x30')](_[_0x9ab5('0x3a')](_0x53fd5b[_0x9ab5('0x2e')],_0x36fe10[_0x9ab5('0x30')]),_0x251354);if(_0x53fd5b['query']['filter']){_0x4340dd[_0x9ab5('0x39')]=_['merge'](_0x4340dd[_0x9ab5('0x39')],{'$or':_['map'](_0x251354,function(_0x5389f9){if(_0x5389f9[_0x9ab5('0x2c')]!==_0x9ab5('0x3b')){var _0x2c935d={};_0x2c935d[_0x5389f9['name']]={'$like':'%'+_0x53fd5b[_0x9ab5('0x2e')]['filter']+'%'};return _0x2c935d;}})});}_0x4340dd=_[_0x9ab5('0x3c')]({},_0x4340dd,_0x53fd5b['options']);var _0x5d4086={'where':_0x4340dd[_0x9ab5('0x39')]};return db[_0x9ab5('0x2a')]['count'](_0x5d4086)[_0x9ab5('0x23')](function(_0x4d3eb6){_0x3e60b8[_0x9ab5('0x1f')]=_0x4d3eb6;if(_0x53fd5b[_0x9ab5('0x2e')][_0x9ab5('0x3d')]){_0x4340dd[_0x9ab5('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9ab5('0x3f')](_0x4340dd);})['then'](function(_0x2793f7){_0x3e60b8[_0x9ab5('0x40')]=_0x2793f7;return _0x3e60b8;})[_0x9ab5('0x23')](respondWithFilteredResult(_0x2da767,_0x4340dd))['catch'](handleError(_0x2da767,null));};exports['show']=function(_0x3cf40b,_0x559379){var _0x137e20={'raw':![],'where':{'id':_0x3cf40b[_0x9ab5('0x41')]['id']}},_0x397b25={};_0x397b25[_0x9ab5('0x32')]=_['keys'](db['DeskConfiguration'][_0x9ab5('0x42')]);_0x397b25['query']=_[_0x9ab5('0x2f')](_0x3cf40b[_0x9ab5('0x2e')]);_0x397b25[_0x9ab5('0x30')]=_[_0x9ab5('0x31')](_0x397b25[_0x9ab5('0x32')],_0x397b25[_0x9ab5('0x2e')]);_0x137e20['attributes']=_[_0x9ab5('0x31')](_0x397b25[_0x9ab5('0x32')],qs[_0x9ab5('0x34')](_0x3cf40b['query']['fields']));_0x137e20[_0x9ab5('0x33')]=_0x137e20[_0x9ab5('0x33')][_0x9ab5('0x35')]?_0x137e20[_0x9ab5('0x33')]:_0x397b25[_0x9ab5('0x32')];if(_0x3cf40b['query'][_0x9ab5('0x3d')]){_0x137e20[_0x9ab5('0x3e')]=[{'all':!![]}];}_0x137e20=_[_0x9ab5('0x3c')]({},_0x137e20,_0x3cf40b[_0x9ab5('0x43')]);return db[_0x9ab5('0x2a')][_0x9ab5('0x44')](_0x137e20)[_0x9ab5('0x23')](handleEntityNotFound(_0x559379,null))[_0x9ab5('0x23')](respondWithResult(_0x559379,null))[_0x9ab5('0x45')](handleError(_0x559379,null));};exports[_0x9ab5('0x46')]=function(_0x2bfe5a,_0x272f6a){return db[_0x9ab5('0x2a')][_0x9ab5('0x46')](_0x2bfe5a[_0x9ab5('0x47')],{})['then'](respondWithResult(_0x272f6a,0xc9))[_0x9ab5('0x45')](handleError(_0x272f6a,null));};exports[_0x9ab5('0x22')]=function(_0x37ce82,_0x24c032){if(_0x37ce82['body']['id']){delete _0x37ce82['body']['id'];}return db[_0x9ab5('0x2a')]['find']({'where':{'id':_0x37ce82[_0x9ab5('0x41')]['id']}})[_0x9ab5('0x23')](handleEntityNotFound(_0x24c032,null))[_0x9ab5('0x23')](saveUpdates(_0x37ce82[_0x9ab5('0x47')],null))['then'](respondWithResult(_0x24c032,null))[_0x9ab5('0x45')](handleError(_0x24c032,null));};exports['destroy']=function(_0x1ea13b,_0x195e9f){return db[_0x9ab5('0x2a')][_0x9ab5('0x44')]({'where':{'id':_0x1ea13b[_0x9ab5('0x41')]['id']}})['then'](handleEntityNotFound(_0x195e9f,null))[_0x9ab5('0x23')](removeEntity(_0x195e9f,null))[_0x9ab5('0x45')](handleError(_0x195e9f,null));};exports['getFields']=function(_0x4c60a2,_0xf1d9b6,_0x5b8708){var _0x59a46e={};var _0x6f40b4={};var _0xddf58;var _0x3b2b14;return db[_0x9ab5('0x2a')]['findOne']({'where':{'id':_0x4c60a2[_0x9ab5('0x41')]['id']}})[_0x9ab5('0x23')](handleEntityNotFound(_0xf1d9b6,null))[_0x9ab5('0x23')](function(_0x36afd3){if(_0x36afd3){_0xddf58=_0x36afd3;_0x6f40b4[_0x9ab5('0x32')]=_[_0x9ab5('0x2f')](db['DeskField'][_0x9ab5('0x42')]);_0x6f40b4['query']=_['keys'](_0x4c60a2['query']);_0x6f40b4['filters']=_[_0x9ab5('0x31')](_0x6f40b4[_0x9ab5('0x32')],_0x6f40b4[_0x9ab5('0x2e')]);_0x59a46e[_0x9ab5('0x33')]=_[_0x9ab5('0x31')](_0x6f40b4[_0x9ab5('0x32')],qs['fields'](_0x4c60a2[_0x9ab5('0x2e')]['fields']));_0x59a46e[_0x9ab5('0x33')]=_0x59a46e[_0x9ab5('0x33')][_0x9ab5('0x35')]?_0x59a46e['attributes']:_0x6f40b4['model'];_0x59a46e['order']=qs[_0x9ab5('0x38')](_0x4c60a2[_0x9ab5('0x2e')][_0x9ab5('0x38')]);_0x59a46e[_0x9ab5('0x39')]=qs[_0x9ab5('0x30')](_['pick'](_0x4c60a2['query'],_0x6f40b4[_0x9ab5('0x30')]));if(_0x4c60a2['query']['filter']){_0x59a46e[_0x9ab5('0x39')]=_['merge'](_0x59a46e[_0x9ab5('0x39')],{'$or':_[_0x9ab5('0x29')](_0x59a46e[_0x9ab5('0x33')],function(_0x4859b1){var _0xd90dd2={};_0xd90dd2[_0x4859b1]={'$like':'%'+_0x4c60a2[_0x9ab5('0x2e')][_0x9ab5('0x48')]+'%'};return _0xd90dd2;})});}_0x59a46e=_['merge']({},_0x59a46e,_0x4c60a2['options']);return _0xddf58['getFields'](_0x59a46e);}})[_0x9ab5('0x23')](function(_0x4a43f8){if(_0x4a43f8){_0x3b2b14=_0x4a43f8[_0x9ab5('0x35')];if(!_0x4c60a2[_0x9ab5('0x2e')]['hasOwnProperty'](_0x9ab5('0x49'))){_0x59a46e[_0x9ab5('0x1e')]=qs[_0x9ab5('0x1e')](_0x4c60a2[_0x9ab5('0x2e')][_0x9ab5('0x1e')]);_0x59a46e[_0x9ab5('0x1d')]=qs[_0x9ab5('0x1d')](_0x4c60a2[_0x9ab5('0x2e')][_0x9ab5('0x1d')]);}return _0xddf58[_0x9ab5('0x4a')](_0x59a46e);}})[_0x9ab5('0x23')](function(_0x157b6b){if(_0x157b6b){return _0x157b6b?{'count':_0x3b2b14,'rows':_0x157b6b}:null;}})[_0x9ab5('0x23')](respondWithResult(_0xf1d9b6,null))[_0x9ab5('0x45')](handleError(_0xf1d9b6,null));};exports[_0x9ab5('0x4b')]=function(_0x4d6903,_0x5ede4f,_0x322cab){var _0x1b664e={};var _0x37ce7c={};var _0x5173f5;var _0x2c8035;return db[_0x9ab5('0x2a')]['findOne']({'where':{'id':_0x4d6903[_0x9ab5('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ede4f,null))[_0x9ab5('0x23')](function(_0x5ce03a){if(_0x5ce03a){_0x5173f5=_0x5ce03a;_0x37ce7c[_0x9ab5('0x32')]=_[_0x9ab5('0x2f')](db[_0x9ab5('0x4c')][_0x9ab5('0x42')]);_0x37ce7c['query']=_[_0x9ab5('0x2f')](_0x4d6903[_0x9ab5('0x2e')]);_0x37ce7c['filters']=_['intersection'](_0x37ce7c['model'],_0x37ce7c[_0x9ab5('0x2e')]);_0x1b664e['attributes']=_[_0x9ab5('0x31')](_0x37ce7c['model'],qs[_0x9ab5('0x34')](_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x34')]));_0x1b664e[_0x9ab5('0x33')]=_0x1b664e[_0x9ab5('0x33')][_0x9ab5('0x35')]?_0x1b664e[_0x9ab5('0x33')]:_0x37ce7c[_0x9ab5('0x32')];_0x1b664e[_0x9ab5('0x37')]=qs[_0x9ab5('0x38')](_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x38')]);_0x1b664e[_0x9ab5('0x39')]=qs[_0x9ab5('0x30')](_[_0x9ab5('0x3a')](_0x4d6903['query'],_0x37ce7c['filters']));if(_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x48')]){_0x1b664e[_0x9ab5('0x39')]=_[_0x9ab5('0x3c')](_0x1b664e[_0x9ab5('0x39')],{'$or':_[_0x9ab5('0x29')](_0x1b664e[_0x9ab5('0x33')],function(_0x101d86){var _0x4f341f={};_0x4f341f[_0x101d86]={'$like':'%'+_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x48')]+'%'};return _0x4f341f;})});}_0x1b664e=_['merge']({},_0x1b664e,_0x4d6903['options']);return _0x5173f5['getSubjects'](_0x1b664e);}})[_0x9ab5('0x23')](function(_0x176ee4){if(_0x176ee4){_0x2c8035=_0x176ee4[_0x9ab5('0x35')];if(!_0x4d6903[_0x9ab5('0x2e')]['hasOwnProperty'](_0x9ab5('0x49'))){_0x1b664e[_0x9ab5('0x1e')]=qs[_0x9ab5('0x1e')](_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x1e')]);_0x1b664e[_0x9ab5('0x1d')]=qs['offset'](_0x4d6903[_0x9ab5('0x2e')][_0x9ab5('0x1d')]);}return _0x5173f5[_0x9ab5('0x4b')](_0x1b664e);}})[_0x9ab5('0x23')](function(_0x3cf537){if(_0x3cf537){return _0x3cf537?{'count':_0x2c8035,'rows':_0x3cf537}:null;}})[_0x9ab5('0x23')](respondWithResult(_0x5ede4f,null))['catch'](handleError(_0x5ede4f,null));};exports[_0x9ab5('0x4d')]=function(_0x42a2d7,_0x5c8588,_0x4a3e72){var _0x7922fc={};var _0xb46a8e={};var _0x1a2ee2;var _0x3cd32d;return db[_0x9ab5('0x2a')][_0x9ab5('0x4e')]({'where':{'id':_0x42a2d7[_0x9ab5('0x41')]['id']}})[_0x9ab5('0x23')](handleEntityNotFound(_0x5c8588,null))[_0x9ab5('0x23')](function(_0x525be2){if(_0x525be2){_0x1a2ee2=_0x525be2;_0xb46a8e[_0x9ab5('0x32')]=_['keys'](db[_0x9ab5('0x4c')][_0x9ab5('0x42')]);_0xb46a8e[_0x9ab5('0x2e')]=_[_0x9ab5('0x2f')](_0x42a2d7[_0x9ab5('0x2e')]);_0xb46a8e[_0x9ab5('0x30')]=_[_0x9ab5('0x31')](_0xb46a8e[_0x9ab5('0x32')],_0xb46a8e[_0x9ab5('0x2e')]);_0x7922fc[_0x9ab5('0x33')]=_['intersection'](_0xb46a8e['model'],qs['fields'](_0x42a2d7[_0x9ab5('0x2e')][_0x9ab5('0x34')]));_0x7922fc['attributes']=_0x7922fc[_0x9ab5('0x33')]['length']?_0x7922fc[_0x9ab5('0x33')]:_0xb46a8e[_0x9ab5('0x32')];_0x7922fc['order']=qs[_0x9ab5('0x38')](_0x42a2d7[_0x9ab5('0x2e')][_0x9ab5('0x38')]);_0x7922fc[_0x9ab5('0x39')]=qs[_0x9ab5('0x30')](_[_0x9ab5('0x3a')](_0x42a2d7['query'],_0xb46a8e[_0x9ab5('0x30')]));if(_0x42a2d7[_0x9ab5('0x2e')][_0x9ab5('0x48')]){_0x7922fc['where']=_[_0x9ab5('0x3c')](_0x7922fc[_0x9ab5('0x39')],{'$or':_['map'](_0x7922fc[_0x9ab5('0x33')],function(_0x46017c){var _0x338a8b={};_0x338a8b[_0x46017c]={'$like':'%'+_0x42a2d7['query']['filter']+'%'};return _0x338a8b;})});}_0x7922fc=_['merge']({},_0x7922fc,_0x42a2d7['options']);return _0x1a2ee2[_0x9ab5('0x4d')](_0x7922fc);}})[_0x9ab5('0x23')](function(_0x45a953){if(_0x45a953){_0x3cd32d=_0x45a953['length'];if(!_0x42a2d7[_0x9ab5('0x2e')]['hasOwnProperty'](_0x9ab5('0x49'))){_0x7922fc['limit']=qs['limit'](_0x42a2d7[_0x9ab5('0x2e')][_0x9ab5('0x1e')]);_0x7922fc['offset']=qs[_0x9ab5('0x1d')](_0x42a2d7['query'][_0x9ab5('0x1d')]);}return _0x1a2ee2[_0x9ab5('0x4d')](_0x7922fc);}})[_0x9ab5('0x23')](function(_0x1fa24a){if(_0x1fa24a){return _0x1fa24a?{'count':_0x3cd32d,'rows':_0x1fa24a}:null;}})[_0x9ab5('0x23')](respondWithResult(_0x5c8588,null))[_0x9ab5('0x45')](handleError(_0x5c8588,null));};exports[_0x9ab5('0x4f')]=function(_0x2a3828,_0x14b15e,_0x1ff6b2){var _0xfb727b={};var _0x57cf9d={};var _0x3c1286;var _0x265068;return db[_0x9ab5('0x2a')][_0x9ab5('0x4e')]({'where':{'id':_0x2a3828[_0x9ab5('0x41')]['id']}})[_0x9ab5('0x23')](handleEntityNotFound(_0x14b15e,null))[_0x9ab5('0x23')](function(_0x4580e6){if(_0x4580e6){_0x3c1286=_0x4580e6;_0x57cf9d[_0x9ab5('0x32')]=_[_0x9ab5('0x2f')](db['Tag'][_0x9ab5('0x42')]);_0x57cf9d[_0x9ab5('0x2e')]=_['keys'](_0x2a3828[_0x9ab5('0x2e')]);_0x57cf9d[_0x9ab5('0x30')]=_[_0x9ab5('0x31')](_0x57cf9d[_0x9ab5('0x32')],_0x57cf9d[_0x9ab5('0x2e')]);_0xfb727b['attributes']=_[_0x9ab5('0x31')](_0x57cf9d['model'],qs[_0x9ab5('0x34')](_0x2a3828['query'][_0x9ab5('0x34')]));_0xfb727b['attributes']=_0xfb727b['attributes'][_0x9ab5('0x35')]?_0xfb727b['attributes']:_0x57cf9d['model'];_0xfb727b['order']=qs[_0x9ab5('0x38')](_0x2a3828['query']['sort']);_0xfb727b[_0x9ab5('0x39')]=qs[_0x9ab5('0x30')](_[_0x9ab5('0x3a')](_0x2a3828[_0x9ab5('0x2e')],_0x57cf9d[_0x9ab5('0x30')]));if(_0x2a3828[_0x9ab5('0x2e')][_0x9ab5('0x48')]){_0xfb727b[_0x9ab5('0x39')]=_['merge'](_0xfb727b[_0x9ab5('0x39')],{'$or':_['map'](_0xfb727b[_0x9ab5('0x33')],function(_0x6b7c1e){var _0x284b06={};_0x284b06[_0x6b7c1e]={'$like':'%'+_0x2a3828[_0x9ab5('0x2e')]['filter']+'%'};return _0x284b06;})});}_0xfb727b=_[_0x9ab5('0x3c')]({},_0xfb727b,_0x2a3828['options']);return _0x3c1286[_0x9ab5('0x4f')](_0xfb727b);}})[_0x9ab5('0x23')](function(_0x1b7c55){if(_0x1b7c55){_0x265068=_0x1b7c55[_0x9ab5('0x35')];if(!_0x2a3828[_0x9ab5('0x2e')][_0x9ab5('0x36')](_0x9ab5('0x49'))){_0xfb727b['limit']=qs['limit'](_0x2a3828[_0x9ab5('0x2e')][_0x9ab5('0x1e')]);_0xfb727b[_0x9ab5('0x1d')]=qs['offset'](_0x2a3828['query'][_0x9ab5('0x1d')]);}return _0x3c1286[_0x9ab5('0x4f')](_0xfb727b);}})['then'](function(_0x27d4b6){if(_0x27d4b6){return _0x27d4b6?{'count':_0x265068,'rows':_0x27d4b6}:null;}})[_0x9ab5('0x23')](respondWithResult(_0x14b15e,null))['catch'](handleError(_0x14b15e,null));};exports[_0x9ab5('0x50')]=function(_0x3dcba0,_0xab1f8f,_0x40b399){if(_0x3dcba0['body']['id']){delete _0x3dcba0[_0x9ab5('0x47')]['id'];}return db[_0x9ab5('0x2a')][_0x9ab5('0x4e')]({'where':{'id':_0x3dcba0['params']['id']}})[_0x9ab5('0x23')](handleEntityNotFound(_0xab1f8f,null))['then'](function(_0x5c9b59){if(_0x5c9b59){return _0x5c9b59[_0x9ab5('0x50')](_0x3dcba0[_0x9ab5('0x47')]['ids']||[]);}return null;})['then'](respondWithResult(_0xab1f8f,null))[_0x9ab5('0x45')](handleError(_0xab1f8f,null));}; \ No newline at end of file +var _0x516d=['length','find','create','body','destroy','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','error','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x58c687,_0x3fec26){var _0x5e9c26=function(_0x25dac7){while(--_0x25dac7){_0x58c687['push'](_0x58c687['shift']());}};_0x5e9c26(++_0x3fec26);}(_0x516d,0x15e));var _0xd516=function(_0x29cb4f,_0x26a21d){_0x29cb4f=_0x29cb4f-0x0;var _0x51e06d=_0x516d[_0x29cb4f];return _0x51e06d;};'use strict';var emlformat=require(_0xd516('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd516('0x1'));var jsonpatch=require(_0xd516('0x2'));var rp=require('request-promise');var moment=require(_0xd516('0x3'));var BPromise=require(_0xd516('0x4'));var Mustache=require(_0xd516('0x5'));var util=require(_0xd516('0x6'));var path=require(_0xd516('0x7'));var sox=require(_0xd516('0x8'));var csv=require(_0xd516('0x9'));var ejs=require(_0xd516('0xa'));var fs=require('fs');var fs_extra=require(_0xd516('0xb'));var _=require(_0xd516('0xc'));var squel=require(_0xd516('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd516('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd516('0xf'));var Papa=require('papaparse');var Redis=require(_0xd516('0x10'));var authService=require(_0xd516('0x11'));var qs=require(_0xd516('0x12'));var as=require(_0xd516('0x13'));var hardwareService=require(_0xd516('0x14'));var logger=require(_0xd516('0x15'))('api');var utils=require(_0xd516('0x16'));var config=require(_0xd516('0x17'));var licenseUtil=require(_0xd516('0x18'));var db=require(_0xd516('0x19'))['db'];function respondWithStatusCode(_0x218469,_0x417ccf){_0x417ccf=_0x417ccf||0xcc;return function(_0x576f5a){if(_0x576f5a){return _0x218469[_0xd516('0x1a')](_0x417ccf);}return _0x218469[_0xd516('0x1b')](_0x417ccf)[_0xd516('0x1c')]();};}function respondWithResult(_0x5f568f,_0x249c0b){_0x249c0b=_0x249c0b||0xc8;return function(_0x180241){if(_0x180241){return _0x5f568f['status'](_0x249c0b)[_0xd516('0x1d')](_0x180241);}};}function respondWithFilteredResult(_0x35fa0,_0x2bc614){return function(_0x2dc7d3){if(_0x2dc7d3){var _0x52f320=typeof _0x2bc614['offset']===_0xd516('0x1e')&&typeof _0x2bc614[_0xd516('0x1f')]==='undefined';var _0x300950=_0x2dc7d3[_0xd516('0x20')];var _0x3838bb=_0x52f320?0x0:_0x2bc614['offset'];var _0xdf2179=_0x52f320?_0x2dc7d3[_0xd516('0x20')]:_0x2bc614['offset']+_0x2bc614[_0xd516('0x1f')];var _0x48e663;if(_0xdf2179>=_0x300950){_0xdf2179=_0x300950;_0x48e663=0xc8;}else{_0x48e663=0xce;}_0x35fa0[_0xd516('0x1b')](_0x48e663);return _0x35fa0['set']('Content-Range',_0x3838bb+'-'+_0xdf2179+'/'+_0x300950)[_0xd516('0x1d')](_0x2dc7d3);}return null;};}function patchUpdates(_0x2b7783){return function(_0x281689){try{jsonpatch[_0xd516('0x21')](_0x281689,_0x2b7783,!![]);}catch(_0x2f4d59){return BPromise[_0xd516('0x22')](_0x2f4d59);}return _0x281689[_0xd516('0x23')]();};}function saveUpdates(_0x2a52b1,_0x341da3){return function(_0x244121){if(_0x244121){return _0x244121[_0xd516('0x24')](_0x2a52b1)['then'](function(_0x438181){return _0x438181;});}return null;};}function removeEntity(_0x2cdb19,_0x172595){return function(_0x1c5ae6){if(_0x1c5ae6){return _0x1c5ae6['destroy']()[_0xd516('0x25')](function(){_0x2cdb19[_0xd516('0x1b')](0xcc)[_0xd516('0x1c')]();});}};}function handleEntityNotFound(_0x5771c1,_0x775a99){return function(_0x3c970f){if(!_0x3c970f){_0x5771c1[_0xd516('0x1a')](0x194);}return _0x3c970f;};}function handleError(_0x14029a,_0x134d76){_0x134d76=_0x134d76||0x1f4;return function(_0x4970b7){logger[_0xd516('0x26')](_0x4970b7['stack']);if(_0x4970b7[_0xd516('0x27')]){delete _0x4970b7['name'];}_0x14029a[_0xd516('0x1b')](_0x134d76)[_0xd516('0x28')](_0x4970b7);};}exports[_0xd516('0x29')]=function(_0x5e274d,_0x2da6c2){var _0x3d334b={},_0x83dc60={},_0x527c70={'count':0x0,'rows':[]};var _0x3826b1=_['map'](db[_0xd516('0x2a')][_0xd516('0x2b')],function(_0x420989){return{'name':_0x420989[_0xd516('0x2c')],'type':_0x420989['type'][_0xd516('0x2d')]};});_0x83dc60[_0xd516('0x2e')]=_[_0xd516('0x2f')](_0x3826b1,_0xd516('0x27'));_0x83dc60[_0xd516('0x30')]=_[_0xd516('0x31')](_0x5e274d[_0xd516('0x30')]);_0x83dc60[_0xd516('0x32')]=_[_0xd516('0x33')](_0x83dc60['model'],_0x83dc60[_0xd516('0x30')]);_0x3d334b[_0xd516('0x34')]=_[_0xd516('0x33')](_0x83dc60[_0xd516('0x2e')],qs[_0xd516('0x35')](_0x5e274d[_0xd516('0x30')][_0xd516('0x35')]));_0x3d334b[_0xd516('0x34')]=_0x3d334b[_0xd516('0x34')]['length']?_0x3d334b[_0xd516('0x34')]:_0x83dc60['model'];if(!_0x5e274d['query']['hasOwnProperty'](_0xd516('0x36'))){_0x3d334b[_0xd516('0x1f')]=qs['limit'](_0x5e274d[_0xd516('0x30')][_0xd516('0x1f')]);_0x3d334b[_0xd516('0x37')]=qs[_0xd516('0x37')](_0x5e274d[_0xd516('0x30')]['offset']);}_0x3d334b[_0xd516('0x38')]=qs['sort'](_0x5e274d[_0xd516('0x30')][_0xd516('0x39')]);_0x3d334b[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x5e274d[_0xd516('0x30')],_0x83dc60['filters']),_0x3826b1);if(_0x5e274d[_0xd516('0x30')][_0xd516('0x3c')]){_0x3d334b[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x3d334b['where'],{'$or':_[_0xd516('0x2f')](_0x3826b1,function(_0xdf739b){if(_0xdf739b['type']!==_0xd516('0x3e')){var _0xa0f938={};_0xa0f938[_0xdf739b[_0xd516('0x27')]]={'$like':'%'+_0x5e274d[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0xa0f938;}})});}_0x3d334b=_['merge']({},_0x3d334b,_0x5e274d[_0xd516('0x3f')]);var _0x4419d8={'where':_0x3d334b['where']};return db[_0xd516('0x2a')][_0xd516('0x20')](_0x4419d8)['then'](function(_0x1e722a){_0x527c70[_0xd516('0x20')]=_0x1e722a;if(_0x5e274d[_0xd516('0x30')][_0xd516('0x40')]){_0x3d334b[_0xd516('0x41')]=[{'all':!![]}];}return db[_0xd516('0x2a')][_0xd516('0x42')](_0x3d334b);})[_0xd516('0x25')](function(_0x43da71){_0x527c70[_0xd516('0x43')]=_0x43da71;return _0x527c70;})[_0xd516('0x25')](respondWithFilteredResult(_0x2da6c2,_0x3d334b))[_0xd516('0x44')](handleError(_0x2da6c2,null));};exports['show']=function(_0x293c50,_0x389407){var _0x352cd2={'raw':![],'where':{'id':_0x293c50[_0xd516('0x45')]['id']}},_0x48c34a={};_0x48c34a[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x2a')]['rawAttributes']);_0x48c34a[_0xd516('0x30')]=_[_0xd516('0x31')](_0x293c50[_0xd516('0x30')]);_0x48c34a['filters']=_[_0xd516('0x33')](_0x48c34a[_0xd516('0x2e')],_0x48c34a[_0xd516('0x30')]);_0x352cd2[_0xd516('0x34')]=_[_0xd516('0x33')](_0x48c34a['model'],qs['fields'](_0x293c50[_0xd516('0x30')]['fields']));_0x352cd2[_0xd516('0x34')]=_0x352cd2['attributes'][_0xd516('0x46')]?_0x352cd2['attributes']:_0x48c34a['model'];if(_0x293c50[_0xd516('0x30')][_0xd516('0x40')]){_0x352cd2[_0xd516('0x41')]=[{'all':!![]}];}_0x352cd2=_['merge']({},_0x352cd2,_0x293c50['options']);return db[_0xd516('0x2a')][_0xd516('0x47')](_0x352cd2)['then'](handleEntityNotFound(_0x389407,null))[_0xd516('0x25')](respondWithResult(_0x389407,null))[_0xd516('0x44')](handleError(_0x389407,null));};exports['create']=function(_0x140215,_0x1329cd){return db[_0xd516('0x2a')][_0xd516('0x48')](_0x140215[_0xd516('0x49')],{})[_0xd516('0x25')](respondWithResult(_0x1329cd,0xc9))['catch'](handleError(_0x1329cd,null));};exports[_0xd516('0x24')]=function(_0x1eb178,_0x29b02b){if(_0x1eb178[_0xd516('0x49')]['id']){delete _0x1eb178['body']['id'];}return db[_0xd516('0x2a')][_0xd516('0x47')]({'where':{'id':_0x1eb178['params']['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x29b02b,null))[_0xd516('0x25')](saveUpdates(_0x1eb178[_0xd516('0x49')],null))[_0xd516('0x25')](respondWithResult(_0x29b02b,null))[_0xd516('0x44')](handleError(_0x29b02b,null));};exports[_0xd516('0x4a')]=function(_0x5ee760,_0xbb69ac){return db[_0xd516('0x2a')][_0xd516('0x47')]({'where':{'id':_0x5ee760['params']['id']}})[_0xd516('0x25')](handleEntityNotFound(_0xbb69ac,null))['then'](removeEntity(_0xbb69ac,null))[_0xd516('0x44')](handleError(_0xbb69ac,null));};exports[_0xd516('0x4b')]=function(_0x4fea9b,_0x1b4360,_0x8273b9){var _0x75de9e={};var _0x277289={};var _0xa4d08a;var _0x1f7dee;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x4fea9b[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x1b4360,null))[_0xd516('0x25')](function(_0x54cd3a){if(_0x54cd3a){_0xa4d08a=_0x54cd3a;_0x277289['model']=_[_0xd516('0x31')](db[_0xd516('0x4d')][_0xd516('0x2b')]);_0x277289[_0xd516('0x30')]=_[_0xd516('0x31')](_0x4fea9b['query']);_0x277289[_0xd516('0x32')]=_['intersection'](_0x277289['model'],_0x277289[_0xd516('0x30')]);_0x75de9e[_0xd516('0x34')]=_[_0xd516('0x33')](_0x277289['model'],qs['fields'](_0x4fea9b['query']['fields']));_0x75de9e[_0xd516('0x34')]=_0x75de9e[_0xd516('0x34')][_0xd516('0x46')]?_0x75de9e[_0xd516('0x34')]:_0x277289[_0xd516('0x2e')];_0x75de9e[_0xd516('0x38')]=qs[_0xd516('0x39')](_0x4fea9b['query'][_0xd516('0x39')]);_0x75de9e[_0xd516('0x3a')]=qs['filters'](_[_0xd516('0x3b')](_0x4fea9b[_0xd516('0x30')],_0x277289[_0xd516('0x32')]));if(_0x4fea9b[_0xd516('0x30')]['filter']){_0x75de9e[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x75de9e[_0xd516('0x3a')],{'$or':_[_0xd516('0x2f')](_0x75de9e[_0xd516('0x34')],function(_0x1ac66d){var _0x3331ef={};_0x3331ef[_0x1ac66d]={'$like':'%'+_0x4fea9b[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x3331ef;})});}_0x75de9e=_[_0xd516('0x3d')]({},_0x75de9e,_0x4fea9b['options']);return _0xa4d08a[_0xd516('0x4b')](_0x75de9e);}})[_0xd516('0x25')](function(_0x5e8e88){if(_0x5e8e88){_0x1f7dee=_0x5e8e88['length'];if(!_0x4fea9b['query'][_0xd516('0x4e')](_0xd516('0x36'))){_0x75de9e[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0x4fea9b[_0xd516('0x30')][_0xd516('0x1f')]);_0x75de9e['offset']=qs[_0xd516('0x37')](_0x4fea9b[_0xd516('0x30')][_0xd516('0x37')]);}return _0xa4d08a[_0xd516('0x4b')](_0x75de9e);}})[_0xd516('0x25')](function(_0xec40ef){if(_0xec40ef){return _0xec40ef?{'count':_0x1f7dee,'rows':_0xec40ef}:null;}})[_0xd516('0x25')](respondWithResult(_0x1b4360,null))['catch'](handleError(_0x1b4360,null));};exports[_0xd516('0x4f')]=function(_0x5583b6,_0x14fe90,_0x140aa5){var _0x7d743e={};var _0x1c8a6f={};var _0x10b3bd;var _0x12b358;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x5583b6[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x14fe90,null))[_0xd516('0x25')](function(_0x2b9e1a){if(_0x2b9e1a){_0x10b3bd=_0x2b9e1a;_0x1c8a6f[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x4d')][_0xd516('0x2b')]);_0x1c8a6f['query']=_[_0xd516('0x31')](_0x5583b6[_0xd516('0x30')]);_0x1c8a6f[_0xd516('0x32')]=_[_0xd516('0x33')](_0x1c8a6f[_0xd516('0x2e')],_0x1c8a6f[_0xd516('0x30')]);_0x7d743e[_0xd516('0x34')]=_['intersection'](_0x1c8a6f[_0xd516('0x2e')],qs[_0xd516('0x35')](_0x5583b6[_0xd516('0x30')][_0xd516('0x35')]));_0x7d743e[_0xd516('0x34')]=_0x7d743e[_0xd516('0x34')][_0xd516('0x46')]?_0x7d743e[_0xd516('0x34')]:_0x1c8a6f[_0xd516('0x2e')];_0x7d743e[_0xd516('0x38')]=qs['sort'](_0x5583b6['query']['sort']);_0x7d743e[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x5583b6[_0xd516('0x30')],_0x1c8a6f[_0xd516('0x32')]));if(_0x5583b6[_0xd516('0x30')][_0xd516('0x3c')]){_0x7d743e[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x7d743e['where'],{'$or':_[_0xd516('0x2f')](_0x7d743e['attributes'],function(_0x158dc2){var _0x4a6d40={};_0x4a6d40[_0x158dc2]={'$like':'%'+_0x5583b6[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x4a6d40;})});}_0x7d743e=_[_0xd516('0x3d')]({},_0x7d743e,_0x5583b6[_0xd516('0x3f')]);return _0x10b3bd[_0xd516('0x4f')](_0x7d743e);}})[_0xd516('0x25')](function(_0x46d9a0){if(_0x46d9a0){_0x12b358=_0x46d9a0[_0xd516('0x46')];if(!_0x5583b6[_0xd516('0x30')][_0xd516('0x4e')]('nolimit')){_0x7d743e[_0xd516('0x1f')]=qs['limit'](_0x5583b6[_0xd516('0x30')][_0xd516('0x1f')]);_0x7d743e['offset']=qs[_0xd516('0x37')](_0x5583b6[_0xd516('0x30')][_0xd516('0x37')]);}return _0x10b3bd[_0xd516('0x4f')](_0x7d743e);}})['then'](function(_0x393a79){if(_0x393a79){return _0x393a79?{'count':_0x12b358,'rows':_0x393a79}:null;}})['then'](respondWithResult(_0x14fe90,null))[_0xd516('0x44')](handleError(_0x14fe90,null));};exports['getDescriptions']=function(_0xf0a691,_0x4778aa,_0x366af3){var _0x44cec6={};var _0x5224aa={};var _0x5af6b6;var _0x4996b8;return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0xf0a691[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x4778aa,null))[_0xd516('0x25')](function(_0x2b87bc){if(_0x2b87bc){_0x5af6b6=_0x2b87bc;_0x5224aa[_0xd516('0x2e')]=_[_0xd516('0x31')](db[_0xd516('0x4d')]['rawAttributes']);_0x5224aa['query']=_[_0xd516('0x31')](_0xf0a691['query']);_0x5224aa['filters']=_[_0xd516('0x33')](_0x5224aa[_0xd516('0x2e')],_0x5224aa['query']);_0x44cec6[_0xd516('0x34')]=_['intersection'](_0x5224aa[_0xd516('0x2e')],qs[_0xd516('0x35')](_0xf0a691[_0xd516('0x30')][_0xd516('0x35')]));_0x44cec6['attributes']=_0x44cec6[_0xd516('0x34')][_0xd516('0x46')]?_0x44cec6[_0xd516('0x34')]:_0x5224aa['model'];_0x44cec6[_0xd516('0x38')]=qs[_0xd516('0x39')](_0xf0a691[_0xd516('0x30')][_0xd516('0x39')]);_0x44cec6[_0xd516('0x3a')]=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0xf0a691[_0xd516('0x30')],_0x5224aa[_0xd516('0x32')]));if(_0xf0a691['query'][_0xd516('0x3c')]){_0x44cec6['where']=_[_0xd516('0x3d')](_0x44cec6[_0xd516('0x3a')],{'$or':_['map'](_0x44cec6[_0xd516('0x34')],function(_0x37a713){var _0x24d7c7={};_0x24d7c7[_0x37a713]={'$like':'%'+_0xf0a691[_0xd516('0x30')][_0xd516('0x3c')]+'%'};return _0x24d7c7;})});}_0x44cec6=_[_0xd516('0x3d')]({},_0x44cec6,_0xf0a691['options']);return _0x5af6b6['getDescriptions'](_0x44cec6);}})['then'](function(_0x3f7744){if(_0x3f7744){_0x4996b8=_0x3f7744[_0xd516('0x46')];if(!_0xf0a691[_0xd516('0x30')][_0xd516('0x4e')](_0xd516('0x36'))){_0x44cec6[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0xf0a691[_0xd516('0x30')][_0xd516('0x1f')]);_0x44cec6[_0xd516('0x37')]=qs[_0xd516('0x37')](_0xf0a691['query'][_0xd516('0x37')]);}return _0x5af6b6['getDescriptions'](_0x44cec6);}})['then'](function(_0x3c92c8){if(_0x3c92c8){return _0x3c92c8?{'count':_0x4996b8,'rows':_0x3c92c8}:null;}})[_0xd516('0x25')](respondWithResult(_0x4778aa,null))['catch'](handleError(_0x4778aa,null));};exports[_0xd516('0x50')]=function(_0x1f5e0e,_0x400d63,_0x5ae530){var _0x2c574a={};var _0x4e31ec={};var _0xb1237f;var _0xf66cc4;return db['DeskConfiguration'][_0xd516('0x4c')]({'where':{'id':_0x1f5e0e[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x400d63,null))[_0xd516('0x25')](function(_0x197653){if(_0x197653){_0xb1237f=_0x197653;_0x4e31ec[_0xd516('0x2e')]=_['keys'](db[_0xd516('0x51')][_0xd516('0x2b')]);_0x4e31ec[_0xd516('0x30')]=_['keys'](_0x1f5e0e['query']);_0x4e31ec[_0xd516('0x32')]=_[_0xd516('0x33')](_0x4e31ec[_0xd516('0x2e')],_0x4e31ec[_0xd516('0x30')]);_0x2c574a['attributes']=_[_0xd516('0x33')](_0x4e31ec[_0xd516('0x2e')],qs['fields'](_0x1f5e0e[_0xd516('0x30')][_0xd516('0x35')]));_0x2c574a['attributes']=_0x2c574a[_0xd516('0x34')][_0xd516('0x46')]?_0x2c574a['attributes']:_0x4e31ec['model'];_0x2c574a[_0xd516('0x38')]=qs[_0xd516('0x39')](_0x1f5e0e['query'][_0xd516('0x39')]);_0x2c574a['where']=qs[_0xd516('0x32')](_[_0xd516('0x3b')](_0x1f5e0e['query'],_0x4e31ec[_0xd516('0x32')]));if(_0x1f5e0e['query'][_0xd516('0x3c')]){_0x2c574a[_0xd516('0x3a')]=_[_0xd516('0x3d')](_0x2c574a[_0xd516('0x3a')],{'$or':_[_0xd516('0x2f')](_0x2c574a['attributes'],function(_0x10b83a){var _0x40294c={};_0x40294c[_0x10b83a]={'$like':'%'+_0x1f5e0e['query'][_0xd516('0x3c')]+'%'};return _0x40294c;})});}_0x2c574a=_[_0xd516('0x3d')]({},_0x2c574a,_0x1f5e0e[_0xd516('0x3f')]);return _0xb1237f[_0xd516('0x50')](_0x2c574a);}})['then'](function(_0x387013){if(_0x387013){_0xf66cc4=_0x387013[_0xd516('0x46')];if(!_0x1f5e0e[_0xd516('0x30')][_0xd516('0x4e')](_0xd516('0x36'))){_0x2c574a[_0xd516('0x1f')]=qs[_0xd516('0x1f')](_0x1f5e0e[_0xd516('0x30')][_0xd516('0x1f')]);_0x2c574a[_0xd516('0x37')]=qs[_0xd516('0x37')](_0x1f5e0e[_0xd516('0x30')]['offset']);}return _0xb1237f[_0xd516('0x50')](_0x2c574a);}})[_0xd516('0x25')](function(_0x331083){if(_0x331083){return _0x331083?{'count':_0xf66cc4,'rows':_0x331083}:null;}})[_0xd516('0x25')](respondWithResult(_0x400d63,null))['catch'](handleError(_0x400d63,null));};exports[_0xd516('0x52')]=function(_0x5386ad,_0x1e221e,_0x367d52){if(_0x5386ad[_0xd516('0x49')]['id']){delete _0x5386ad[_0xd516('0x49')]['id'];}return db[_0xd516('0x2a')][_0xd516('0x4c')]({'where':{'id':_0x5386ad[_0xd516('0x45')]['id']}})[_0xd516('0x25')](handleEntityNotFound(_0x1e221e,null))[_0xd516('0x25')](function(_0x2a603a){if(_0x2a603a){return _0x2a603a[_0xd516('0x52')](_0x5386ad[_0xd516('0x49')][_0xd516('0x53')]||[]);}return null;})[_0xd516('0x25')](respondWithResult(_0x1e221e,null))[_0xd516('0x44')](handleError(_0x1e221e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9147091..6fd6032 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 _0x5cbc=['api','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x5e3186,_0x465ab2){var _0x52e108=function(_0x1cc3c5){while(--_0x1cc3c5){_0x5e3186['push'](_0x5e3186['shift']());}};_0x52e108(++_0x465ab2);}(_0x5cbc,0xbb));var _0xc5cb=function(_0x50054e,_0x520750){_0x50054e=_0x50054e-0x0;var _0x36b414=_0x5cbc[_0x50054e];return _0x36b414;};'use strict';var _=require(_0xc5cb('0x0'));var util=require(_0xc5cb('0x1'));var logger=require(_0xc5cb('0x2'))(_0xc5cb('0x3'));var moment=require('moment');var BPromise=require(_0xc5cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc5cb('0x5'));var config=require(_0xc5cb('0x6'));var attributes=require(_0xc5cb('0x7'));module[_0xc5cb('0x8')]=function(_0x49080d,_0x2f6a64){return _0x49080d[_0xc5cb('0x9')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5127=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash'];(function(_0x15a6c4,_0x3d40ea){var _0x37f251=function(_0x258b93){while(--_0x258b93){_0x15a6c4['push'](_0x15a6c4['shift']());}};_0x37f251(++_0x3d40ea);}(_0x5127,0x18f));var _0x7512=function(_0x3de0d9,_0x2ccb8f){_0x3de0d9=_0x3de0d9-0x0;var _0x161cd9=_0x5127[_0x3de0d9];return _0x161cd9;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7512('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7512('0x5'));var config=require(_0x7512('0x6'));var attributes=require(_0x7512('0x7'));module[_0x7512('0x8')]=function(_0x35a3e5,_0x1a7239){return _0x35a3e5['define']('DeskConfiguration',attributes,{'tableName':_0x7512('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 769f5f1..d407241 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 _0x1af1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xbfe663,_0x4c1b1d){var _0x100ae2=function(_0x599b5b){while(--_0x599b5b){_0xbfe663['push'](_0xbfe663['shift']());}};_0x100ae2(++_0x4c1b1d);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rs=require(_0x11af('0x4'));var fs=require('fs');var Redis=require(_0x11af('0x5'));var db=require(_0x11af('0x6'))['db'];var utils=require(_0x11af('0x7'));var logger=require(_0x11af('0x8'))(_0x11af('0x9'));var config=require('../../config/environment');var jayson=require(_0x11af('0xa'));var client=jayson['client'][_0x11af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c4a2,_0x4bc2b4,_0x23706c){return new BPromise(function(_0x590e7d,_0x364f87){return client['request'](_0x47c4a2,_0x23706c)[_0x11af('0xc')](function(_0x23b31a){logger[_0x11af('0xd')](_0x11af('0xe'),_0x4bc2b4,'request\x20sent');logger[_0x11af('0xf')](_0x11af('0x10'),_0x4bc2b4,_0x11af('0x11'),JSON[_0x11af('0x12')](_0x23b31a));if(_0x23b31a[_0x11af('0x13')]){if(_0x23b31a[_0x11af('0x13')][_0x11af('0x14')]===0x1f4){logger[_0x11af('0x13')](_0x11af('0xe'),_0x4bc2b4,_0x23b31a[_0x11af('0x13')]['message']);return _0x364f87(_0x23b31a[_0x11af('0x13')][_0x11af('0x15')]);}logger[_0x11af('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4bc2b4,_0x23b31a[_0x11af('0x13')][_0x11af('0x15')]);return _0x590e7d(_0x23b31a['error'][_0x11af('0x15')]);}else{logger[_0x11af('0xd')](_0x11af('0xe'),_0x4bc2b4,_0x11af('0x11'));_0x590e7d(_0x23b31a[_0x11af('0x16')][_0x11af('0x15')]);}})[_0x11af('0x17')](function(_0x2313de){logger[_0x11af('0x13')](_0x11af('0xe'),_0x4bc2b4,_0x2313de);_0x364f87(_0x2313de);});});} \ No newline at end of file +var _0xcd2f=['stringify','error','message','DeskConfiguration,\x20%s,\x20%s','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x124578,_0x21ad88){var _0x230bc0=function(_0x507f16){while(--_0x507f16){_0x124578['push'](_0x124578['shift']());}};_0x230bc0(++_0x21ad88);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcd2f[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd2('0x0'));var rs=require(_0xfcd2('0x1'));var fs=require('fs');var Redis=require(_0xfcd2('0x2'));var db=require(_0xfcd2('0x3'))['db'];var utils=require(_0xfcd2('0x4'));var logger=require(_0xfcd2('0x5'))(_0xfcd2('0x6'));var config=require(_0xfcd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x8')][_0xfcd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41e836,_0x20ac59,_0x467e4f){return new BPromise(function(_0x13d9fa,_0xae2219){return client[_0xfcd2('0xa')](_0x41e836,_0x467e4f)[_0xfcd2('0xb')](function(_0x358fb4){logger[_0xfcd2('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0xfcd2('0xd'));logger[_0xfcd2('0xe')](_0xfcd2('0xf'),_0x20ac59,_0xfcd2('0xd'),JSON[_0xfcd2('0x10')](_0x358fb4));if(_0x358fb4['error']){if(_0x358fb4['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0xae2219(_0x358fb4['error'][_0xfcd2('0x12')]);}logger[_0xfcd2('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x20ac59,_0x358fb4['error'][_0xfcd2('0x12')]);return _0x13d9fa(_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);}else{logger[_0xfcd2('0xc')](_0xfcd2('0x13'),_0x20ac59,'request\x20sent');_0x13d9fa(_0x358fb4[_0xfcd2('0x14')][_0xfcd2('0x12')]);}})[_0xfcd2('0x15')](function(_0x34aa38){logger[_0xfcd2('0x11')](_0xfcd2('0x13'),_0x20ac59,_0x34aa38);_0xae2219(_0x34aa38);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c7513a0..d5ee4e7 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 _0x36f2=['./intDeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1614b6,_0x2c2cc9){var _0x10492c=function(_0x5c3a08){while(--_0x5c3a08){_0x1614b6['push'](_0x1614b6['shift']());}};_0x10492c(++_0x2c2cc9);}(_0x36f2,0x9b));var _0x236f=function(_0x4da518,_0x4f1225){_0x4da518=_0x4da518-0x0;var _0xa2608c=_0x36f2[_0x4da518];return _0xa2608c;};'use strict';var multer=require(_0x236f('0x0'));var util=require('util');var path=require(_0x236f('0x1'));var timeout=require('connect-timeout');var express=require(_0x236f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x236f('0x3'));var interaction=require(_0x236f('0x4'));var config=require('../../config/environment');var controller=require(_0x236f('0x5'));router[_0x236f('0x6')]('/',auth[_0x236f('0x7')](),controller['index']);router[_0x236f('0x6')]('/:id',auth[_0x236f('0x7')](),controller[_0x236f('0x8')]);router[_0x236f('0x9')]('/',auth[_0x236f('0x7')](),controller[_0x236f('0xa')]);router[_0x236f('0xb')](_0x236f('0xc'),auth[_0x236f('0x7')](),controller[_0x236f('0xd')]);router[_0x236f('0xe')]('/:id',auth[_0x236f('0x7')](),controller[_0x236f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1612=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer'];(function(_0x310736,_0x3eeed5){var _0x157784=function(_0x35b6b5){while(--_0x35b6b5){_0x310736['push'](_0x310736['shift']());}};_0x157784(++_0x3eeed5);}(_0x1612,0xcf));var _0x2161=function(_0x4d560a,_0x48d9dd){_0x4d560a=_0x4d560a-0x0;var _0x368b51=_0x1612[_0x4d560a];return _0x368b51;};'use strict';var multer=require(_0x2161('0x0'));var util=require(_0x2161('0x1'));var path=require(_0x2161('0x2'));var timeout=require(_0x2161('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2161('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2161('0x5'));var config=require(_0x2161('0x6'));var controller=require('./intDeskField.controller');router[_0x2161('0x7')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0x9')]);router[_0x2161('0x7')](_0x2161('0xa'),auth[_0x2161('0x8')](),controller[_0x2161('0xb')]);router[_0x2161('0xc')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0xd')]);router['put'](_0x2161('0xa'),auth[_0x2161('0x8')](),controller['update']);router[_0x2161('0xe')]('/:id',auth[_0x2161('0x8')](),controller[_0x2161('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 068f6f0..14faf08 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 _0xd4e2=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd4e2,0x154));var _0x2d4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2d4e('0x0'));module['exports']={'type':{'type':Sequelize[_0x2d4e('0x1')](_0x2d4e('0x2'),'variable',_0x2d4e('0x3'),_0x2d4e('0x4'),_0x2d4e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2d4e('0x6')]},'key':{'type':Sequelize[_0x2d4e('0x6')]},'keyType':{'type':Sequelize[_0x2d4e('0x1')](_0x2d4e('0x2'),_0x2d4e('0x7'),_0x2d4e('0x3'))},'keyContent':{'type':Sequelize[_0x2d4e('0x6')]},'idField':{'type':Sequelize[_0x2d4e('0x6')]},'nameField':{'type':Sequelize[_0x2d4e('0x6')]},'customField':{'type':Sequelize[_0x2d4e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d4e('0x6')]}}; \ No newline at end of file +var _0x329b=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x54ed00,_0x253ac2){var _0x2f9a44=function(_0x38bfb4){while(--_0x38bfb4){_0x54ed00['push'](_0x54ed00['shift']());}};_0x2f9a44(++_0x253ac2);}(_0x329b,0x9e));var _0xb329=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0x329b[_0x4849f6];return _0x1a3dcd;};'use strict';var Sequelize=require(_0xb329('0x0'));module[_0xb329('0x1')]={'type':{'type':Sequelize[_0xb329('0x2')](_0xb329('0x3'),_0xb329('0x4'),_0xb329('0x5'),_0xb329('0x6'),_0xb329('0x7')),'defaultValue':_0xb329('0x3')},'content':{'type':Sequelize[_0xb329('0x8')]},'key':{'type':Sequelize[_0xb329('0x8')]},'keyType':{'type':Sequelize[_0xb329('0x2')]('string',_0xb329('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb329('0x8')]},'idField':{'type':Sequelize[_0xb329('0x8')]},'nameField':{'type':Sequelize[_0xb329('0x8')]},'customField':{'type':Sequelize[_0xb329('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb329('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a824032..468eb51 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 _0x9206=['util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','DeskField','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9206,0x176));var _0x6920=function(_0x100ce0,_0x485cbb){_0x100ce0=_0x100ce0-0x0;var _0x21cb19=_0x9206[_0x100ce0];return _0x21cb19;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['DeskField']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['DeskField'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));}; \ No newline at end of file +var _0xbea5=['rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','error','name','index','map','DeskField'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xbea5,0x177));var _0x5bea=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xbea5[_0x650e11];return _0x1a9b47;};'use strict';var emlformat=require(_0x5bea('0x0'));var rimraf=require(_0x5bea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bea('0x2'));var rp=require(_0x5bea('0x3'));var moment=require(_0x5bea('0x4'));var BPromise=require(_0x5bea('0x5'));var Mustache=require(_0x5bea('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5bea('0x7'));var csv=require('to-csv');var ejs=require(_0x5bea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bea('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bea('0xa'));var toCsv=require(_0x5bea('0xb'));var querystring=require(_0x5bea('0xc'));var Papa=require('papaparse');var Redis=require(_0x5bea('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5bea('0xe'));var hardwareService=require(_0x5bea('0xf'));var logger=require(_0x5bea('0x10'))(_0x5bea('0x11'));var utils=require(_0x5bea('0x12'));var config=require(_0x5bea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bea('0x14'))['db'];function respondWithStatusCode(_0x1f49a0,_0x5aef2d){_0x5aef2d=_0x5aef2d||0xcc;return function(_0x289d99){if(_0x289d99){return _0x1f49a0[_0x5bea('0x15')](_0x5aef2d);}return _0x1f49a0['status'](_0x5aef2d)[_0x5bea('0x16')]();};}function respondWithResult(_0x229e09,_0x26cfca){_0x26cfca=_0x26cfca||0xc8;return function(_0xda336a){if(_0xda336a){return _0x229e09[_0x5bea('0x17')](_0x26cfca)[_0x5bea('0x18')](_0xda336a);}};}function respondWithFilteredResult(_0x14d46c,_0x5e0518){return function(_0x492190){if(_0x492190){var _0x1ad017=typeof _0x5e0518[_0x5bea('0x19')]===_0x5bea('0x1a')&&typeof _0x5e0518['limit']===_0x5bea('0x1a');var _0x18d13f=_0x492190[_0x5bea('0x1b')];var _0x49ba83=_0x1ad017?0x0:_0x5e0518[_0x5bea('0x19')];var _0x23fa96=_0x1ad017?_0x492190['count']:_0x5e0518[_0x5bea('0x19')]+_0x5e0518['limit'];var _0xd0f100;if(_0x23fa96>=_0x18d13f){_0x23fa96=_0x18d13f;_0xd0f100=0xc8;}else{_0xd0f100=0xce;}_0x14d46c[_0x5bea('0x17')](_0xd0f100);return _0x14d46c[_0x5bea('0x1c')]('Content-Range',_0x49ba83+'-'+_0x23fa96+'/'+_0x18d13f)['json'](_0x492190);}return null;};}function patchUpdates(_0x4169e5){return function(_0x2bf974){try{jsonpatch[_0x5bea('0x1d')](_0x2bf974,_0x4169e5,!![]);}catch(_0x52f12e){return BPromise[_0x5bea('0x1e')](_0x52f12e);}return _0x2bf974[_0x5bea('0x1f')]();};}function saveUpdates(_0x146177,_0xda92cf){return function(_0x595ee1){if(_0x595ee1){return _0x595ee1[_0x5bea('0x20')](_0x146177)[_0x5bea('0x21')](function(_0xcc0685){return _0xcc0685;});}return null;};}function removeEntity(_0x245c81,_0x5984f8){return function(_0x406ac8){if(_0x406ac8){return _0x406ac8['destroy']()[_0x5bea('0x21')](function(){_0x245c81['status'](0xcc)[_0x5bea('0x16')]();});}};}function handleEntityNotFound(_0x10282f,_0x37b196){return function(_0x5a8361){if(!_0x5a8361){_0x10282f['sendStatus'](0x194);}return _0x5a8361;};}function handleError(_0x4de13e,_0x57cde3){_0x57cde3=_0x57cde3||0x1f4;return function(_0x4c0821){logger[_0x5bea('0x22')](_0x4c0821['stack']);if(_0x4c0821['name']){delete _0x4c0821[_0x5bea('0x23')];}_0x4de13e[_0x5bea('0x17')](_0x57cde3)['send'](_0x4c0821);};}exports[_0x5bea('0x24')]=function(_0x5db06b,_0x577cf3){var _0x1a784b={},_0x2e773a={},_0x10b5e6={'count':0x0,'rows':[]};var _0x102ffb=_[_0x5bea('0x25')](db[_0x5bea('0x26')][_0x5bea('0x27')],function(_0x2d2308){return{'name':_0x2d2308[_0x5bea('0x28')],'type':_0x2d2308['type']['key']};});_0x2e773a[_0x5bea('0x29')]=_[_0x5bea('0x25')](_0x102ffb,_0x5bea('0x23'));_0x2e773a[_0x5bea('0x2a')]=_['keys'](_0x5db06b[_0x5bea('0x2a')]);_0x2e773a[_0x5bea('0x2b')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],_0x2e773a['query']);_0x1a784b[_0x5bea('0x2d')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],qs['fields'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x2e')]));_0x1a784b[_0x5bea('0x2d')]=_0x1a784b[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x1a784b[_0x5bea('0x2d')]:_0x2e773a['model'];if(!_0x5db06b['query'][_0x5bea('0x30')](_0x5bea('0x31'))){_0x1a784b['limit']=qs[_0x5bea('0x32')](_0x5db06b['query'][_0x5bea('0x32')]);_0x1a784b[_0x5bea('0x19')]=qs['offset'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x19')]);}_0x1a784b[_0x5bea('0x33')]=qs['sort'](_0x5db06b['query'][_0x5bea('0x34')]);_0x1a784b[_0x5bea('0x35')]=qs[_0x5bea('0x2b')](_[_0x5bea('0x36')](_0x5db06b[_0x5bea('0x2a')],_0x2e773a['filters']),_0x102ffb);if(_0x5db06b[_0x5bea('0x2a')]['filter']){_0x1a784b[_0x5bea('0x35')]=_[_0x5bea('0x37')](_0x1a784b[_0x5bea('0x35')],{'$or':_[_0x5bea('0x25')](_0x102ffb,function(_0x475307){if(_0x475307['type']!==_0x5bea('0x38')){var _0x439e27={};_0x439e27[_0x475307[_0x5bea('0x23')]]={'$like':'%'+_0x5db06b[_0x5bea('0x2a')]['filter']+'%'};return _0x439e27;}})});}_0x1a784b=_[_0x5bea('0x37')]({},_0x1a784b,_0x5db06b[_0x5bea('0x39')]);var _0x291d60={'where':_0x1a784b[_0x5bea('0x35')]};return db[_0x5bea('0x26')]['count'](_0x291d60)[_0x5bea('0x21')](function(_0x35e9f4){_0x10b5e6['count']=_0x35e9f4;if(_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x1a784b[_0x5bea('0x3b')]=[{'all':!![]}];}return db[_0x5bea('0x26')]['findAll'](_0x1a784b);})[_0x5bea('0x21')](function(_0x2e1976){_0x10b5e6[_0x5bea('0x3c')]=_0x2e1976;return _0x10b5e6;})[_0x5bea('0x21')](respondWithFilteredResult(_0x577cf3,_0x1a784b))[_0x5bea('0x3d')](handleError(_0x577cf3,null));};exports[_0x5bea('0x3e')]=function(_0x5610b2,_0x378bfb){var _0x52ce37={'raw':!![],'where':{'id':_0x5610b2[_0x5bea('0x3f')]['id']}},_0x1b6332={};_0x1b6332[_0x5bea('0x29')]=_[_0x5bea('0x40')](db['DeskField']['rawAttributes']);_0x1b6332['query']=_[_0x5bea('0x40')](_0x5610b2[_0x5bea('0x2a')]);_0x1b6332[_0x5bea('0x2b')]=_['intersection'](_0x1b6332[_0x5bea('0x29')],_0x1b6332[_0x5bea('0x2a')]);_0x52ce37[_0x5bea('0x2d')]=_['intersection'](_0x1b6332['model'],qs[_0x5bea('0x2e')](_0x5610b2['query'][_0x5bea('0x2e')]));_0x52ce37[_0x5bea('0x2d')]=_0x52ce37[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x52ce37['attributes']:_0x1b6332[_0x5bea('0x29')];if(_0x5610b2[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x52ce37[_0x5bea('0x3b')]=[{'all':!![]}];}_0x52ce37=_[_0x5bea('0x37')]({},_0x52ce37,_0x5610b2['options']);return db['DeskField'][_0x5bea('0x41')](_0x52ce37)[_0x5bea('0x21')](handleEntityNotFound(_0x378bfb,null))['then'](respondWithResult(_0x378bfb,null))[_0x5bea('0x3d')](handleError(_0x378bfb,null));};exports['create']=function(_0x2a6695,_0x455bcb){return db[_0x5bea('0x26')][_0x5bea('0x42')](_0x2a6695[_0x5bea('0x43')],{})[_0x5bea('0x21')](respondWithResult(_0x455bcb,0xc9))[_0x5bea('0x3d')](handleError(_0x455bcb,null));};exports[_0x5bea('0x20')]=function(_0x52af41,_0x4b6783){if(_0x52af41['body']['id']){delete _0x52af41[_0x5bea('0x43')]['id'];}return db[_0x5bea('0x26')]['find']({'where':{'id':_0x52af41[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b6783,null))[_0x5bea('0x21')](saveUpdates(_0x52af41[_0x5bea('0x43')],null))['then'](respondWithResult(_0x4b6783,null))[_0x5bea('0x3d')](handleError(_0x4b6783,null));};exports[_0x5bea('0x44')]=function(_0xaa37af,_0x11f275){return db[_0x5bea('0x26')][_0x5bea('0x41')]({'where':{'id':_0xaa37af[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11f275,null))[_0x5bea('0x21')](removeEntity(_0x11f275,null))[_0x5bea('0x3d')](handleError(_0x11f275,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e14ba35..9ab86f1 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 _0x3bea=['int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField'];(function(_0x17b7e8,_0x549983){var _0x593871=function(_0x4e5966){while(--_0x4e5966){_0x17b7e8['push'](_0x17b7e8['shift']());}};_0x593871(++_0x549983);}(_0x3bea,0x17b));var _0xa3be=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3bea[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xa3be('0x0'));var logger=require('../../config/logger')(_0xa3be('0x1'));var moment=require(_0xa3be('0x2'));var BPromise=require(_0xa3be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3be('0x4'));var rimraf=require(_0xa3be('0x5'));var config=require(_0xa3be('0x6'));var attributes=require(_0xa3be('0x7'));module[_0xa3be('0x8')]=function(_0x5b14db,_0x34859c){return _0x5b14db[_0xa3be('0x9')](_0xa3be('0xa'),attributes,{'tableName':_0xa3be('0xb'),'paranoid':![],'indexes':[{'name':_0xa3be('0xc'),'fields':[_0xa3be('0xd'),_0xa3be('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1006=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x2367db,_0x214b5a){var _0x3a1fc3=function(_0x2544a1){while(--_0x2544a1){_0x2367db['push'](_0x2367db['shift']());}};_0x3a1fc3(++_0x214b5a);}(_0x1006,0x147));var _0x6100=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x1006[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x6100('0x0'));var util=require(_0x6100('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6100('0x2'));var BPromise=require(_0x6100('0x3'));var rp=require(_0x6100('0x4'));var fs=require('fs');var path=require(_0x6100('0x5'));var rimraf=require(_0x6100('0x6'));var config=require(_0x6100('0x7'));var attributes=require(_0x6100('0x8'));module[_0x6100('0x9')]=function(_0x548daa,_0x388577){return _0x548daa[_0x6100('0xa')](_0x6100('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6100('0xc'),'fields':[_0x6100('0xd'),_0x6100('0xe')],'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 6baa070..a2d9a28 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 _0xc782=['request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc782,0xd2));var _0x2c78=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0xc782[_0x6899c7];return _0x5186ee;};'use strict';var _=require(_0x2c78('0x0'));var util=require(_0x2c78('0x1'));var moment=require(_0x2c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c78('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c78('0x4'))(_0x2c78('0x5'));var config=require(_0x2c78('0x6'));var jayson=require(_0x2c78('0x7'));var client=jayson[_0x2c78('0x8')][_0x2c78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x213cc5,_0x24f19a,_0x5a64c){return new BPromise(function(_0x1c87fd,_0x2c5431){return client[_0x2c78('0xa')](_0x213cc5,_0x5a64c)[_0x2c78('0xb')](function(_0x46111f){logger[_0x2c78('0xc')](_0x2c78('0xd'),_0x24f19a,'request\x20sent');logger[_0x2c78('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x24f19a,_0x2c78('0xf'),JSON[_0x2c78('0x10')](_0x46111f));if(_0x46111f[_0x2c78('0x11')]){if(_0x46111f['error'][_0x2c78('0x12')]===0x1f4){logger[_0x2c78('0x11')](_0x2c78('0xd'),_0x24f19a,_0x46111f[_0x2c78('0x11')][_0x2c78('0x13')]);return _0x2c5431(_0x46111f[_0x2c78('0x11')][_0x2c78('0x13')]);}logger[_0x2c78('0x11')](_0x2c78('0xd'),_0x24f19a,_0x46111f['error'][_0x2c78('0x13')]);return _0x1c87fd(_0x46111f[_0x2c78('0x11')][_0x2c78('0x13')]);}else{logger[_0x2c78('0xc')]('DeskField,\x20%s,\x20%s',_0x24f19a,_0x2c78('0xf'));_0x1c87fd(_0x46111f[_0x2c78('0x14')][_0x2c78('0x13')]);}})[_0x2c78('0x15')](function(_0x50ddac){logger[_0x2c78('0x11')](_0x2c78('0xd'),_0x24f19a,_0x50ddac);_0x2c5431(_0x50ddac);});});} \ No newline at end of file +var _0x2116=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x2116,0x1ce));var _0x6211=function(_0x317c00,_0x47ef74){_0x317c00=_0x317c00-0x0;var _0x5e15ff=_0x2116[_0x317c00];return _0x5e15ff;};'use strict';var _=require('lodash');var util=require(_0x6211('0x0'));var moment=require(_0x6211('0x1'));var BPromise=require(_0x6211('0x2'));var rs=require(_0x6211('0x3'));var fs=require('fs');var Redis=require(_0x6211('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6211('0x5'))(_0x6211('0x6'));var config=require(_0x6211('0x7'));var jayson=require(_0x6211('0x8'));var client=jayson['client'][_0x6211('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7d89,_0xdde17d,_0x262fe0){return new BPromise(function(_0x5cfb24,_0x3cd1d3){return client[_0x6211('0xa')](_0x3b7d89,_0x262fe0)[_0x6211('0xb')](function(_0x57c55f){logger[_0x6211('0xc')](_0x6211('0xd'),_0xdde17d,'request\x20sent');logger[_0x6211('0xe')](_0x6211('0xf'),_0xdde17d,_0x6211('0x10'),JSON[_0x6211('0x11')](_0x57c55f));if(_0x57c55f[_0x6211('0x12')]){if(_0x57c55f[_0x6211('0x12')][_0x6211('0x13')]===0x1f4){logger[_0x6211('0x12')]('DeskField,\x20%s,\x20%s',_0xdde17d,_0x57c55f[_0x6211('0x12')][_0x6211('0x14')]);return _0x3cd1d3(_0x57c55f['error']['message']);}logger[_0x6211('0x12')](_0x6211('0xd'),_0xdde17d,_0x57c55f['error'][_0x6211('0x14')]);return _0x5cfb24(_0x57c55f[_0x6211('0x12')][_0x6211('0x14')]);}else{logger[_0x6211('0xc')](_0x6211('0xd'),_0xdde17d,_0x6211('0x10'));_0x5cfb24(_0x57c55f[_0x6211('0x15')][_0x6211('0x14')]);}})[_0x6211('0x16')](function(_0x3dba03){logger[_0x6211('0x12')](_0x6211('0xd'),_0xdde17d,_0x3dba03);_0x3cd1d3(_0x3dba03);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c9189d1..191f790 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 _0x44ff=['update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put'];(function(_0xcefa6e,_0x39ba65){var _0x4808b7=function(_0x31d2b4){while(--_0x31d2b4){_0xcefa6e['push'](_0xcefa6e['shift']());}};_0x4808b7(++_0x39ba65);}(_0x44ff,0x95));var _0xf44f=function(_0x2ae30b,_0x50f7d6){_0x2ae30b=_0x2ae30b-0x0;var _0x489fcb=_0x44ff[_0x2ae30b];return _0x489fcb;};'use strict';var multer=require(_0xf44f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf44f('0x1'));var express=require(_0xf44f('0x2'));var router=express[_0xf44f('0x3')]();var fs_extra=require(_0xf44f('0x4'));var auth=require(_0xf44f('0x5'));var interaction=require(_0xf44f('0x6'));var config=require(_0xf44f('0x7'));var controller=require(_0xf44f('0x8'));router['get']('/',auth[_0xf44f('0x9')](),controller['index']);router[_0xf44f('0xa')](_0xf44f('0xb'),auth['isAuthenticated'](),controller[_0xf44f('0xc')]);router[_0xf44f('0xa')](_0xf44f('0xd'),auth['isAuthenticated'](),controller[_0xf44f('0xe')]);router[_0xf44f('0xa')](_0xf44f('0xf'),auth[_0xf44f('0x9')](),controller[_0xf44f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xf44f('0x9')](),controller[_0xf44f('0x11')]);router[_0xf44f('0x12')](_0xf44f('0xb'),auth[_0xf44f('0x9')](),controller[_0xf44f('0x13')]);router['delete'](_0xf44f('0xb'),auth[_0xf44f('0x9')](),controller[_0xf44f('0x14')]);module['exports']=router; \ No newline at end of file +var _0xec3e=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xec3e,0xdd));var _0xeec3=function(_0x569cc2,_0x348bf9){_0x569cc2=_0x569cc2-0x0;var _0x27af59=_0xec3e[_0x569cc2];return _0x27af59;};'use strict';var multer=require('multer');var util=require(_0xeec3('0x0'));var path=require(_0xeec3('0x1'));var timeout=require(_0xeec3('0x2'));var express=require(_0xeec3('0x3'));var router=express['Router']();var fs_extra=require(_0xeec3('0x4'));var auth=require(_0xeec3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeec3('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xeec3('0x7')]('/',auth[_0xeec3('0x8')](),controller['index']);router[_0xeec3('0x7')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0xa')]);router[_0xeec3('0x7')](_0xeec3('0xb'),auth[_0xeec3('0x8')](),controller[_0xeec3('0xc')]);router['get'](_0xeec3('0xd'),auth[_0xeec3('0x8')](),controller[_0xeec3('0xe')]);router[_0xeec3('0xf')]('/',auth['isAuthenticated'](),controller[_0xeec3('0x10')]);router[_0xeec3('0xf')]('/:id/configurations',auth[_0xeec3('0x8')](),controller['addConfiguration']);router[_0xeec3('0x11')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0x12')]);router[_0xeec3('0x13')](_0xeec3('0x9'),auth['isAuthenticated'](),controller[_0xeec3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b879d4b..271aafa 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 _0xac0a=['STRING','BOOLEAN'];(function(_0x588e08,_0x494086){var _0x2d1902=function(_0x54cbd6){while(--_0x54cbd6){_0x588e08['push'](_0x588e08['shift']());}};_0x2d1902(++_0x494086);}(_0xac0a,0x11e));var _0xaac0=function(_0x311dac,_0x4d1cee){_0x311dac=_0x311dac-0x0;var _0x375a9a=_0xac0a[_0x311dac];return _0x375a9a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaac0('0x0')]},'username':{'type':Sequelize[_0xaac0('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaac0('0x0')]},'tenantId':{'type':Sequelize[_0xaac0('0x0')]},'clientId':{'type':Sequelize[_0xaac0('0x0')]},'clientSecret':{'type':Sequelize[_0xaac0('0x0')]},'serverUrl':{'type':Sequelize[_0xaac0('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xaac0('0x0')]},'modernAuthentication':{'type':Sequelize[_0xaac0('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1224=['BOOLEAN','sequelize','exports','STRING'];(function(_0x310480,_0x189c0b){var _0x160f33=function(_0x805e0d){while(--_0x805e0d){_0x310480['push'](_0x310480['shift']());}};_0x160f33(++_0x189c0b);}(_0x1224,0x10d));var _0x4122=function(_0x55418e,_0x3fe1fc){_0x55418e=_0x55418e-0x0;var _0x634190=_0x1224[_0x55418e];return _0x634190;};'use strict';var Sequelize=require(_0x4122('0x0'));module[_0x4122('0x1')]={'name':{'type':Sequelize[_0x4122('0x2')]},'username':{'type':Sequelize[_0x4122('0x2')]},'password':{'type':Sequelize[_0x4122('0x2')]},'remoteUri':{'type':Sequelize[_0x4122('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4122('0x2')]},'clientSecret':{'type':Sequelize[_0x4122('0x2')]},'serverUrl':{'type':Sequelize[_0x4122('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4122('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f60f3bd..eceec75 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 _0x2539=['substring','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName','TrueOption','true','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','offset','undefined','limit','set','update','then','destroy','end','sendStatus','stack','name','send','index','Dynamics365Account','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2539,0x147));var _0x9253=function(_0x397f1e,_0x167fa9){_0x397f1e=_0x397f1e-0x0;var _0x1f6d6c=_0x2539[_0x397f1e];return _0x1f6d6c;};'use strict';var rp=require(_0x9253('0x0'));var util=require(_0x9253('0x1'));var _=require(_0x9253('0x2'));var qs=require(_0x9253('0x3'));var logger=require(_0x9253('0x4'))(_0x9253('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9253('0x6'));function respondWithResult(_0xecd5e9,_0x4cea82){_0x4cea82=_0x4cea82||0xc8;return function(_0x5db41e){if(_0x5db41e){return _0xecd5e9[_0x9253('0x7')](_0x4cea82)['json'](_0x5db41e);}};}function respondWithFilteredResult(_0x100bec,_0x5c251d){return function(_0x3a6dab){if(_0x3a6dab){var _0x3f2b2d=typeof _0x5c251d[_0x9253('0x8')]===_0x9253('0x9')&&typeof _0x5c251d[_0x9253('0xa')]===_0x9253('0x9');var _0x451032=_0x3a6dab['count'];var _0x2d42fb=_0x3f2b2d?0x0:_0x5c251d[_0x9253('0x8')];var _0x686566=_0x3f2b2d?_0x3a6dab['count']:_0x5c251d[_0x9253('0x8')]+_0x5c251d['limit'];var _0x2841eb;if(_0x686566>=_0x451032){_0x686566=_0x451032;_0x2841eb=0xc8;}else{_0x2841eb=0xce;}_0x100bec[_0x9253('0x7')](_0x2841eb);return _0x100bec[_0x9253('0xb')]('Content-Range',_0x2d42fb+'-'+_0x686566+'/'+_0x451032)['json'](_0x3a6dab);}return null;};}function saveUpdates(_0x44ca29){return function(_0x5d467d){if(_0x5d467d){return _0x5d467d[_0x9253('0xc')](_0x44ca29)[_0x9253('0xd')](function(_0x20d97a){return _0x20d97a;});}return null;};}function removeEntity(_0x4cbcbf){return function(_0x216b26){if(_0x216b26){return _0x216b26[_0x9253('0xe')]()[_0x9253('0xd')](function(){_0x4cbcbf[_0x9253('0x7')](0xcc)[_0x9253('0xf')]();});}};}function handleEntityNotFound(_0x509648){return function(_0x3ee459){if(!_0x3ee459){_0x509648[_0x9253('0x10')](0x194);}return _0x3ee459;};}function handleError(_0x422620,_0x163757){_0x163757=_0x163757||0x1f4;return function(_0x5eff2d){logger['error'](_0x5eff2d[_0x9253('0x11')]);if(_0x5eff2d[_0x9253('0x12')]){delete _0x5eff2d[_0x9253('0x12')];}_0x422620[_0x9253('0x7')](_0x163757)[_0x9253('0x13')](_0x5eff2d);};}exports[_0x9253('0x14')]=function(_0x2e3b9c,_0x653b78){var _0x455e94={},_0x4cb40a={},_0x409684={'count':0x0,'rows':[]};var _0x2762bb=_['map'](db[_0x9253('0x15')]['rawAttributes'],function(_0x1a3154){return{'name':_0x1a3154[_0x9253('0x16')],'type':_0x1a3154[_0x9253('0x17')]['key']};});_0x4cb40a[_0x9253('0x18')]=_[_0x9253('0x19')](_0x2762bb,_0x9253('0x12'));_0x4cb40a[_0x9253('0x1a')]=_[_0x9253('0x1b')](_0x2e3b9c[_0x9253('0x1a')]);_0x4cb40a[_0x9253('0x1c')]=_[_0x9253('0x1d')](_0x4cb40a[_0x9253('0x18')],_0x4cb40a[_0x9253('0x1a')]);_0x455e94[_0x9253('0x1e')]=_[_0x9253('0x1d')](_0x4cb40a['model'],qs['fields'](_0x2e3b9c['query'][_0x9253('0x1f')]));_0x455e94[_0x9253('0x1e')]=_0x455e94[_0x9253('0x1e')][_0x9253('0x20')]?_0x455e94['attributes']:_0x4cb40a['model'];if(!_0x2e3b9c[_0x9253('0x1a')]['hasOwnProperty'](_0x9253('0x21'))){_0x455e94[_0x9253('0xa')]=qs['limit'](_0x2e3b9c[_0x9253('0x1a')][_0x9253('0xa')]);_0x455e94[_0x9253('0x8')]=qs[_0x9253('0x8')](_0x2e3b9c['query'][_0x9253('0x8')]);}_0x455e94['order']=qs[_0x9253('0x22')](_0x2e3b9c[_0x9253('0x1a')]['sort']);_0x455e94[_0x9253('0x23')]=qs[_0x9253('0x1c')](_[_0x9253('0x24')](_0x2e3b9c[_0x9253('0x1a')],_0x4cb40a[_0x9253('0x1c')]),_0x2762bb);if(_0x2e3b9c[_0x9253('0x1a')]['filter']){_0x455e94['where']=_['merge'](_0x455e94['where'],{'$or':_[_0x9253('0x19')](_0x2762bb,function(_0x6e165c){if(_0x6e165c[_0x9253('0x17')]!==_0x9253('0x25')){var _0x518b6b={};_0x518b6b[_0x6e165c[_0x9253('0x12')]]={'$like':'%'+_0x2e3b9c[_0x9253('0x1a')][_0x9253('0x26')]+'%'};return _0x518b6b;}})});}_0x455e94=_[_0x9253('0x27')]({},_0x455e94,_0x2e3b9c[_0x9253('0x28')]);var _0x50b5b4={'where':_0x455e94[_0x9253('0x23')]};return db[_0x9253('0x15')][_0x9253('0x29')](_0x50b5b4)[_0x9253('0xd')](function(_0x5a38c3){_0x409684[_0x9253('0x29')]=_0x5a38c3;if(_0x2e3b9c[_0x9253('0x1a')][_0x9253('0x2a')]){_0x455e94[_0x9253('0x2b')]=[{'all':!![]}];}return db[_0x9253('0x15')][_0x9253('0x2c')](_0x455e94);})['then'](function(_0xb51150){_0x409684[_0x9253('0x2d')]=_0xb51150;return _0x409684;})[_0x9253('0xd')](respondWithFilteredResult(_0x653b78,_0x455e94))[_0x9253('0x2e')](handleError(_0x653b78,null));};exports[_0x9253('0x2f')]=function(_0x115148,_0x124e84){var _0x2612c7={'raw':![],'where':{'id':_0x115148[_0x9253('0x30')]['id']}},_0x257228={};_0x257228[_0x9253('0x18')]=_[_0x9253('0x1b')](db[_0x9253('0x15')][_0x9253('0x31')]);_0x257228[_0x9253('0x1a')]=_['keys'](_0x115148[_0x9253('0x1a')]);_0x257228[_0x9253('0x1c')]=_['intersection'](_0x257228[_0x9253('0x18')],_0x257228['query']);_0x2612c7[_0x9253('0x1e')]=_[_0x9253('0x1d')](_0x257228['model'],qs[_0x9253('0x1f')](_0x115148[_0x9253('0x1a')]['fields']));_0x2612c7[_0x9253('0x1e')]=_0x2612c7[_0x9253('0x1e')]['length']?_0x2612c7[_0x9253('0x1e')]:_0x257228[_0x9253('0x18')];if(_0x115148[_0x9253('0x1a')][_0x9253('0x2a')]){_0x2612c7[_0x9253('0x2b')]=[{'all':!![]}];}_0x2612c7=_[_0x9253('0x27')]({},_0x2612c7,_0x115148[_0x9253('0x28')]);return db[_0x9253('0x15')][_0x9253('0x32')](_0x2612c7)[_0x9253('0xd')](handleEntityNotFound(_0x124e84,null))[_0x9253('0xd')](respondWithResult(_0x124e84,null))[_0x9253('0x2e')](handleError(_0x124e84,null));};exports[_0x9253('0x33')]=function(_0x5ae7d7,_0x540584){return db[_0x9253('0x15')][_0x9253('0x33')](_0x5ae7d7['body'],{})[_0x9253('0xd')](respondWithResult(_0x540584,0xc9))['catch'](handleError(_0x540584,null));};exports[_0x9253('0xc')]=function(_0x369733,_0x54100d){if(_0x369733['body']['id']){delete _0x369733['body']['id'];}return db[_0x9253('0x15')]['find']({'where':{'id':_0x369733[_0x9253('0x30')]['id']}})[_0x9253('0xd')](handleEntityNotFound(_0x54100d,null))[_0x9253('0xd')](saveUpdates(_0x369733[_0x9253('0x34')],null))['then'](respondWithResult(_0x54100d,null))[_0x9253('0x2e')](handleError(_0x54100d,null));};exports['destroy']=function(_0x132581,_0x10694f){return db['Dynamics365Account'][_0x9253('0x32')]({'where':{'id':_0x132581[_0x9253('0x30')]['id']}})[_0x9253('0xd')](handleEntityNotFound(_0x10694f,null))['then'](removeEntity(_0x10694f,null))[_0x9253('0x2e')](handleError(_0x10694f,null));};exports['getConfigurations']=function(_0x58ebaf,_0x86ac99){var _0x28e1ca={};var _0x3c5ac1={};var _0x279d2d;var _0x18b87c;return db[_0x9253('0x15')][_0x9253('0x35')]({'where':{'id':_0x58ebaf[_0x9253('0x30')]['id']}})[_0x9253('0xd')](handleEntityNotFound(_0x86ac99,null))['then'](function(_0x51c086){if(_0x51c086){_0x279d2d=_0x51c086;_0x3c5ac1[_0x9253('0x18')]=_[_0x9253('0x1b')](db[_0x9253('0x36')][_0x9253('0x31')]);_0x3c5ac1[_0x9253('0x1a')]=_[_0x9253('0x1b')](_0x58ebaf[_0x9253('0x1a')]);_0x3c5ac1[_0x9253('0x1c')]=_[_0x9253('0x1d')](_0x3c5ac1['model'],_0x3c5ac1[_0x9253('0x1a')]);_0x28e1ca[_0x9253('0x1e')]=_[_0x9253('0x1d')](_0x3c5ac1['model'],qs[_0x9253('0x1f')](_0x58ebaf[_0x9253('0x1a')][_0x9253('0x1f')]));_0x28e1ca[_0x9253('0x1e')]=_0x28e1ca['attributes'][_0x9253('0x20')]?_0x28e1ca[_0x9253('0x1e')]:_0x3c5ac1[_0x9253('0x18')];_0x28e1ca['order']=qs[_0x9253('0x22')](_0x58ebaf[_0x9253('0x1a')]['sort']);_0x28e1ca[_0x9253('0x23')]=qs[_0x9253('0x1c')](_[_0x9253('0x24')](_0x58ebaf['query'],_0x3c5ac1[_0x9253('0x1c')]));if(_0x58ebaf[_0x9253('0x1a')][_0x9253('0x26')]){_0x28e1ca[_0x9253('0x23')]=_[_0x9253('0x27')](_0x28e1ca[_0x9253('0x23')],{'$or':_[_0x9253('0x19')](_0x28e1ca['attributes'],function(_0xd686c8){var _0xe247b9={};_0xe247b9[_0xd686c8]={'$like':'%'+_0x58ebaf['query'][_0x9253('0x26')]+'%'};return _0xe247b9;})});}_0x28e1ca=_[_0x9253('0x27')]({},_0x28e1ca,_0x58ebaf['options']);return _0x279d2d[_0x9253('0x37')](_0x28e1ca);}})[_0x9253('0xd')](function(_0x5822de){if(_0x5822de){_0x18b87c=_0x5822de[_0x9253('0x20')];if(!_0x58ebaf[_0x9253('0x1a')][_0x9253('0x38')](_0x9253('0x21'))){_0x28e1ca[_0x9253('0xa')]=qs['limit'](_0x58ebaf['query'][_0x9253('0xa')]);_0x28e1ca['offset']=qs[_0x9253('0x8')](_0x58ebaf[_0x9253('0x1a')][_0x9253('0x8')]);}return _0x279d2d['getConfigurations'](_0x28e1ca);}})[_0x9253('0xd')](function(_0x2dae6b){if(_0x2dae6b){return _0x2dae6b?{'count':_0x18b87c,'rows':_0x2dae6b}:null;}})['then'](respondWithResult(_0x86ac99,null))['catch'](handleError(_0x86ac99,null));};exports[_0x9253('0x39')]=function(_0xbe174e,_0x56faaa){if(_0xbe174e[_0x9253('0x34')]['id']){delete _0xbe174e['body']['id'];}return db[_0x9253('0x15')][_0x9253('0x35')]({'where':{'id':_0xbe174e[_0x9253('0x30')]['id']}})[_0x9253('0xd')](handleEntityNotFound(_0x56faaa,null))[_0x9253('0xd')](function(_0x14a9b9){if(_0x14a9b9){_0xbe174e[_0x9253('0x34')][_0x9253('0x3a')]=_0x14a9b9['id'];_0xbe174e['body'][_0x9253('0x3b')]=integrations[_0x9253('0x3c')](_0xbe174e[_0x9253('0x34')][_0x9253('0x3d')],_0xbe174e['body'][_0x9253('0x17')]);_0xbe174e[_0x9253('0x34')][_0x9253('0x3e')]=integrations[_0x9253('0x3f')](_0xbe174e['body']['channel'],_0xbe174e[_0x9253('0x34')][_0x9253('0x17')]);return db[_0x9253('0x36')][_0x9253('0x33')](_0xbe174e[_0x9253('0x34')],{'include':[{'model':db[_0x9253('0x40')],'as':'Subjects'},{'model':db[_0x9253('0x40')],'as':_0x9253('0x3e')}]});}return null;})['then'](respondWithResult(_0x56faaa,null))[_0x9253('0x2e')](handleError(_0x56faaa,null));};function sanitizeRemoteUri(_0x412882){var _0x36bed1=_0x412882['slice'](-0x1);if(_0x36bed1==='/')return _0x412882[_0x9253('0x41')](0x0,_0x412882['lastIndexOf'](_0x36bed1));return _0x412882;}function getWebApiUrl(_0xb5962e){return util[_0x9253('0x42')](_0x9253('0x43'),_0xb5962e);}exports[_0x9253('0x44')]=function(_0x4fda28,_0x1ad676){var _0x45fa89=_0x4fda28[_0x9253('0x1a')]['ticketType'];var _0x728960=_0x45fa89===_0x9253('0x45')?_0x9253('0x46'):_0x9253('0x47');var _0x4282b3='';var _0x8f4941='';var _0x2fd8e8='';var _0x21d8b8='';var _0x507fb6='';var _0x56c7da='';var _0x2ff84c='';var _0x173762='';var _0x33dd70=[_0x9253('0x48'),_0x9253('0x49'),_0x9253('0x4a'),_0x9253('0x4b'),_0x9253('0x4c'),_0x9253('0x4d'),_0x9253('0x4e'),_0x9253('0x4f'),_0x9253('0x50'),_0x9253('0x51')];var _0x45a7f8=[_0x9253('0x52'),'accountidyominame',_0x9253('0x53'),_0x9253('0x54'),'contactidname',_0x9253('0x55'),'contractdetailidname',_0x9253('0x56'),_0x9253('0x57'),_0x9253('0x58'),_0x9253('0x59'),_0x9253('0x5a'),_0x9253('0x5b'),'createdonbehalfbyname',_0x9253('0x5c'),_0x9253('0x5d'),_0x9253('0x5e'),_0x9253('0x5f'),_0x9253('0x60'),_0x9253('0x61'),_0x9253('0x62'),_0x9253('0x63'),_0x9253('0x64'),_0x9253('0x65'),_0x9253('0x66'),'followupby','importsequencenumber',_0x9253('0x67'),'kbarticleidname',_0x9253('0x68'),_0x9253('0x69'),_0x9253('0x6a'),_0x9253('0x6b'),'modifiedbyname','modifiedbyyominame',_0x9253('0x6c'),'modifiedonbehalfbyname',_0x9253('0x6d'),_0x9253('0x6e'),_0x9253('0x6f'),'numberofchildincidents',_0x9253('0x70'),_0x9253('0x71'),_0x9253('0x72'),_0x9253('0x73'),_0x9253('0x74'),_0x9253('0x75'),_0x9253('0x76'),_0x9253('0x77'),_0x9253('0x78'),'productidname',_0x9253('0x79'),_0x9253('0x7a'),_0x9253('0x7b'),_0x9253('0x7c'),_0x9253('0x7d'),'responsiblecontactidyominame',_0x9253('0x7e'),_0x9253('0x7f'),_0x9253('0x80'),_0x9253('0x81'),_0x9253('0x82'),_0x9253('0x83'),'subjectidname',_0x9253('0x84'),_0x9253('0x85'),_0x9253('0x86'),_0x9253('0x87'),_0x9253('0x88'),_0x9253('0x89')];var _0x7cc762=_0x33dd70[_0x9253('0x8a')](_0x45a7f8);return db[_0x9253('0x15')][_0x9253('0x35')]({'where':{'id':_0x4fda28['params']['id']},'attributes':['id',_0x9253('0x8b'),_0x9253('0x8c'),_0x9253('0x8d'),'tenantId',_0x9253('0x8e'),_0x9253('0x8f'),_0x9253('0x90')],'include':[{'model':db[_0x9253('0x91')],'as':'CloudProvider','attributes':['id',_0x9253('0x92'),'data7']}]})['then'](handleEntityNotFound(_0x1ad676,null))['then'](function(_0x40ac44){if(_0x40ac44){if(_0x40ac44[_0x9253('0x90')]){_0x40ac44[_0x9253('0x93')]=_0x40ac44[_0x9253('0x91')]['data5'];_0x173762=sanitizeRemoteUri(_0x40ac44[_0x9253('0x91')][_0x9253('0x94')]);_0x2ff84c=getWebApiUrl(_0x173762);return _0x40ac44;}_0x173762=sanitizeRemoteUri(_0x40ac44['remoteUri']);_0x2ff84c=getWebApiUrl(_0x173762);var _0x281a9a={'method':_0x9253('0x95'),'uri':'https://login.microsoftonline.com/'+_0x40ac44[_0x9253('0x96')]+_0x9253('0x97'),'form':{'client_id':_0x40ac44[_0x9253('0x8e')],'resource':_0x173762,'username':_0x40ac44[_0x9253('0x8b')],'password':_0x40ac44['password'],'grant_type':_0x9253('0x8c'),'client_secret':_0x40ac44[_0x9253('0x8f')]},'json':!![]};return rp(_0x281a9a);}})[_0x9253('0xd')](function(_0x35f184){_0x56c7da=_0x35f184[_0x9253('0x93')];var _0x46fa61={'method':_0x9253('0x98'),'uri':encodeURI(_0x2ff84c+_0x9253('0x99')+_0x728960+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x56c7da,'If-None-Match':null,'OData-Version':_0x9253('0x9a')},'json':!![]};return rp(_0x46fa61);})[_0x9253('0xd')](function(_0x1c3a9c){var _0x4fb45c=_0x1c3a9c[_0x9253('0x9b')][0x0];var _0xe60afe=_0x4fb45c[_0x9253('0x9c')];var _0x580b50={'method':_0x9253('0x98'),'uri':_0x2ff84c+_0x9253('0x9d')+_0xe60afe+_0x9253('0x9e'),'headers':{'Authorization':'Bearer\x20'+_0x56c7da,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x580b50);})[_0x9253('0xd')](function(_0x250667){_0x4282b3=_0x250667;_0x8f4941=_0x4282b3[_0x9253('0x9f')];_0x8f4941=_[_0x9253('0xa0')](_0x8f4941,function(_0x1ed87b){return!_0x7cc762[_0x9253('0xa1')](_0x1ed87b[_0x9253('0xa2')]);});var _0x2db692=[];var _0x3ed224=[];_0x8f4941[_0x9253('0xa3')](function(_0xe917fa){if(_0xe917fa[_0x9253('0xa4')]){var _0x21f2e1=_0xe917fa[_0x9253('0xa4')]['substring'](_0xe917fa[_0x9253('0xa4')][_0x9253('0xa5')]('.')+0x1);if(_0x21f2e1===_0x9253('0xa6')){_0x2db692[_0x9253('0xa7')](getSelectList(_0x2ff84c,_0x45fa89,_0x3ed224,_0x4282b3[_0x9253('0x9c')],_0xe917fa[_0x9253('0x9c')],_0x56c7da));}}});return Promise[_0x9253('0xa8')](_0x2db692);})[_0x9253('0xd')](function(_0x49c949){_0x2fd8e8=_0x49c949[0x0];var _0x3f242d=[];var _0x5117e7=[];_0x8f4941[_0x9253('0xa3')](function(_0x2366f5){if(!_[_0x9253('0xa9')](_0x2366f5[_0x9253('0xa4')])){var _0x3b208e=_0x2366f5[_0x9253('0xa4')][_0x9253('0x41')](_0x2366f5[_0x9253('0xa4')][_0x9253('0xa5')]('.')+0x1);if(_0x3b208e===_0x9253('0xaa')){_0x3f242d['push'](getBooleanList(_0x2ff84c,_0x45fa89,_0x5117e7,_0x4282b3[_0x9253('0x9c')],_0x2366f5['MetadataId'],_0x56c7da));}}});return Promise[_0x9253('0xa8')](_0x3f242d);})[_0x9253('0xd')](function(_0x16fe0b){_0x21d8b8=_0x16fe0b[0x0];var _0x5b35cb=[];var _0xc44513=[];_0x8f4941['forEach'](function(_0x534aef){if(_0x534aef[_0x9253('0xa4')]){var _0x153f91=_0x534aef[_0x9253('0xa4')][_0x9253('0x41')](_0x534aef[_0x9253('0xa4')]['lastIndexOf']('.')+0x1);if(_0x153f91==='StringAttributeMetadata'||_0x153f91===_0x9253('0xab')||_0x153f91===_0x9253('0xac')||_0x153f91===_0x9253('0xad')||_0x153f91===_0x9253('0xae')||_0x153f91===_0x9253('0xaf')||_0x153f91===_0x9253('0xb0')||_0x153f91==='EntityNameAttributeMetadata'||_0x153f91===_0x9253('0xb1')||_0x153f91===_0x9253('0xb2')){_0x5b35cb[_0x9253('0xa7')](getInputList(_0x2ff84c,_0x45fa89,_0x153f91,_0xc44513,_0x4282b3[_0x9253('0x9c')],_0x534aef['MetadataId'],_0x56c7da));}}});return Promise[_0x9253('0xa8')](_0x5b35cb);})[_0x9253('0xd')](function(_0x428fee){_0x507fb6=_0x428fee[0x0];var _0x3bb3b7=_0x2fd8e8['concat'](_0x21d8b8)['concat'](_0x507fb6);var _0x32f1e9={'count':_0x3bb3b7[_0x9253('0x20')],'rows':_0x3bb3b7};return _0x32f1e9;})[_0x9253('0xd')](respondWithResult(_0x1ad676,null))[_0x9253('0x2e')](function(_0x3d5b59){var _0x47e20a=_0x4fda28[_0x9253('0x1a')]['test']?0x1f4:_0x3d5b59[_0x9253('0xb3')]||0x1f4;logger[_0x9253('0xb4')](_0x3d5b59[_0x9253('0x11')]);delete _0x3d5b59[_0x9253('0x12')];if(_0x47e20a===0x191){_0x47e20a=0x190;}_0x1ad676[_0x9253('0x7')](_0x47e20a)['send'](_0x4fda28[_0x9253('0x1a')][_0x9253('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x3d5b59[_0x9253('0xb3')]}:_0x3d5b59);});};function getSelectList(_0x273036,_0x48a298,_0x13fdeb,_0x4ee741,_0x2acf32,_0x3803ad){var _0x255286={'method':'GET','uri':_0x273036+_0x9253('0x9d')+_0x4ee741+_0x9253('0xb6')+_0x2acf32+_0x9253('0xb7')+_0x9253('0xb8'),'headers':{'Authorization':_0x9253('0xb9')+_0x3803ad,'If-None-Match':null,'OData-Version':_0x9253('0x9a')},'json':!![]};return rp(_0x255286)[_0x9253('0xd')](function(_0x1373c1){var _0xcc4549=[];var _0x72300e=_0x1373c1[_0x9253('0xba')][_0x9253('0xbb')];_0x72300e['forEach'](function(_0x55dbca){_0xcc4549[_0x9253('0xa7')]({'name':_0x55dbca['Label'][_0x9253('0xbc')][_0x9253('0xbd')],'value':String(_0x55dbca[_0x9253('0xbe')])});});var _0x10008b={'id':_0x48a298+'_'+_0x1373c1[_0x9253('0xa2')],'name':_0x1373c1[_0x9253('0xbf')][_0x9253('0xbc')][_0x9253('0xbd')],'custom':![],'options':_0xcc4549};_0x13fdeb[_0x9253('0xa7')](_0x10008b);return _0x13fdeb;});}function getBooleanList(_0x48f33e,_0x2f9b41,_0x28430a,_0x59df6f,_0x4d01e2,_0xbcb371){var _0x23b149={'method':_0x9253('0x98'),'uri':_0x48f33e+'EntityDefinitions('+_0x59df6f+_0x9253('0xb6')+_0x4d01e2+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x9253('0xb9')+_0xbcb371,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23b149)[_0x9253('0xd')](function(_0x12ec2f){var _0x3d49e4=[];_0x3d49e4[_0x9253('0xa7')]({'name':_0x12ec2f[_0x9253('0xba')][_0x9253('0xc0')][_0x9253('0xbd')][_0x9253('0xbc')][_0x9253('0xbd')],'value':_0x9253('0xc1')},{'name':_0x12ec2f[_0x9253('0xba')]['FalseOption'][_0x9253('0xbd')][_0x9253('0xbc')][_0x9253('0xbd')],'value':_0x9253('0xc2')});var _0x5e3b77={'id':_0x2f9b41+'_'+_0x12ec2f[_0x9253('0xa2')],'name':_0x12ec2f[_0x9253('0xbf')][_0x9253('0xbc')]['Label'],'custom':![],'options':_0x3d49e4};_0x28430a[_0x9253('0xa7')](_0x5e3b77);return _0x28430a;});}function getInputList(_0x48a0e4,_0x85ed70,_0x45c9aa,_0x2b87b2,_0x349f0a,_0x3fc627,_0x6b2652){var _0x2d5ba7={'method':'GET','uri':_0x48a0e4+_0x9253('0x9d')+_0x349f0a+_0x9253('0xb6')+_0x3fc627+')/Microsoft.Dynamics.CRM.'+_0x45c9aa+_0x9253('0xc3'),'headers':{'Authorization':_0x9253('0xb9')+_0x6b2652,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d5ba7)[_0x9253('0xd')](function(_0x9d31b7){var _0x59e629={'id':_0x85ed70+'_'+_0x9d31b7[_0x9253('0xa2')],'name':_0x9d31b7[_0x9253('0xbf')][_0x9253('0xbc')]?_0x9d31b7[_0x9253('0xbf')]['UserLocalizedLabel'][_0x9253('0xbd')]:_0x9d31b7[_0x9253('0xa2')],'custom':![],'options':[]};_0x2b87b2[_0x9253('0xa7')](_0x59e629);return _0x2b87b2;});} \ No newline at end of file +var _0x4134=['followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','/oauth2/token','clientId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','util','../../config/logger','api','../../components/integrations/configuration','json','undefined','limit','count','offset','status','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','length','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname'];(function(_0x4a21d5,_0x3fb9fd){var _0x178480=function(_0x2ef053){while(--_0x2ef053){_0x4a21d5['push'](_0x4a21d5['shift']());}};_0x178480(++_0x3fb9fd);}(_0x4134,0x1c6));var _0x4413=function(_0x11bc4e,_0x2d67ab){_0x11bc4e=_0x11bc4e-0x0;var _0x4cbbe7=_0x4134[_0x11bc4e];return _0x4cbbe7;};'use strict';var rp=require('request-promise');var util=require(_0x4413('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x4413('0x1'))(_0x4413('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4413('0x3'));function respondWithResult(_0x28fd1c,_0x494668){_0x494668=_0x494668||0xc8;return function(_0x542fde){if(_0x542fde){return _0x28fd1c['status'](_0x494668)[_0x4413('0x4')](_0x542fde);}};}function respondWithFilteredResult(_0x5e240d,_0x104165){return function(_0x11cbec){if(_0x11cbec){var _0x5653fc=typeof _0x104165['offset']===_0x4413('0x5')&&typeof _0x104165[_0x4413('0x6')]===_0x4413('0x5');var _0x487741=_0x11cbec[_0x4413('0x7')];var _0x2e5bc2=_0x5653fc?0x0:_0x104165[_0x4413('0x8')];var _0x2512a4=_0x5653fc?_0x11cbec[_0x4413('0x7')]:_0x104165['offset']+_0x104165['limit'];var _0x1ad946;if(_0x2512a4>=_0x487741){_0x2512a4=_0x487741;_0x1ad946=0xc8;}else{_0x1ad946=0xce;}_0x5e240d[_0x4413('0x9')](_0x1ad946);return _0x5e240d[_0x4413('0xa')](_0x4413('0xb'),_0x2e5bc2+'-'+_0x2512a4+'/'+_0x487741)[_0x4413('0x4')](_0x11cbec);}return null;};}function saveUpdates(_0x3d24a5){return function(_0x4294ba){if(_0x4294ba){return _0x4294ba[_0x4413('0xc')](_0x3d24a5)[_0x4413('0xd')](function(_0x158922){return _0x158922;});}return null;};}function removeEntity(_0x16d819){return function(_0x3fc8fa){if(_0x3fc8fa){return _0x3fc8fa['destroy']()['then'](function(){_0x16d819[_0x4413('0x9')](0xcc)[_0x4413('0xe')]();});}};}function handleEntityNotFound(_0x2d71fd){return function(_0x5ea64c){if(!_0x5ea64c){_0x2d71fd[_0x4413('0xf')](0x194);}return _0x5ea64c;};}function handleError(_0x3d5676,_0x42aa36){_0x42aa36=_0x42aa36||0x1f4;return function(_0x92eec1){logger[_0x4413('0x10')](_0x92eec1[_0x4413('0x11')]);if(_0x92eec1[_0x4413('0x12')]){delete _0x92eec1[_0x4413('0x12')];}_0x3d5676[_0x4413('0x9')](_0x42aa36)[_0x4413('0x13')](_0x92eec1);};}exports[_0x4413('0x14')]=function(_0x39fcdb,_0x55dc83){var _0x3de4a2={},_0xfd4167={},_0x197b65={'count':0x0,'rows':[]};var _0x43a9cd=_[_0x4413('0x15')](db['Dynamics365Account'][_0x4413('0x16')],function(_0x167ae9){return{'name':_0x167ae9[_0x4413('0x17')],'type':_0x167ae9[_0x4413('0x18')][_0x4413('0x19')]};});_0xfd4167[_0x4413('0x1a')]=_['map'](_0x43a9cd,_0x4413('0x12'));_0xfd4167[_0x4413('0x1b')]=_[_0x4413('0x1c')](_0x39fcdb['query']);_0xfd4167['filters']=_['intersection'](_0xfd4167[_0x4413('0x1a')],_0xfd4167[_0x4413('0x1b')]);_0x3de4a2['attributes']=_[_0x4413('0x1d')](_0xfd4167[_0x4413('0x1a')],qs[_0x4413('0x1e')](_0x39fcdb['query'][_0x4413('0x1e')]));_0x3de4a2[_0x4413('0x1f')]=_0x3de4a2[_0x4413('0x1f')]['length']?_0x3de4a2[_0x4413('0x1f')]:_0xfd4167[_0x4413('0x1a')];if(!_0x39fcdb[_0x4413('0x1b')][_0x4413('0x20')](_0x4413('0x21'))){_0x3de4a2['limit']=qs[_0x4413('0x6')](_0x39fcdb[_0x4413('0x1b')][_0x4413('0x6')]);_0x3de4a2[_0x4413('0x8')]=qs[_0x4413('0x8')](_0x39fcdb[_0x4413('0x1b')]['offset']);}_0x3de4a2[_0x4413('0x22')]=qs[_0x4413('0x23')](_0x39fcdb[_0x4413('0x1b')][_0x4413('0x23')]);_0x3de4a2[_0x4413('0x24')]=qs[_0x4413('0x25')](_[_0x4413('0x26')](_0x39fcdb[_0x4413('0x1b')],_0xfd4167['filters']),_0x43a9cd);if(_0x39fcdb[_0x4413('0x1b')][_0x4413('0x27')]){_0x3de4a2[_0x4413('0x24')]=_[_0x4413('0x28')](_0x3de4a2['where'],{'$or':_['map'](_0x43a9cd,function(_0x22a10d){if(_0x22a10d[_0x4413('0x18')]!==_0x4413('0x29')){var _0x17b1f6={};_0x17b1f6[_0x22a10d[_0x4413('0x12')]]={'$like':'%'+_0x39fcdb[_0x4413('0x1b')][_0x4413('0x27')]+'%'};return _0x17b1f6;}})});}_0x3de4a2=_[_0x4413('0x28')]({},_0x3de4a2,_0x39fcdb['options']);var _0x2e40ff={'where':_0x3de4a2[_0x4413('0x24')]};return db[_0x4413('0x2a')]['count'](_0x2e40ff)[_0x4413('0xd')](function(_0x346c3a){_0x197b65[_0x4413('0x7')]=_0x346c3a;if(_0x39fcdb[_0x4413('0x1b')][_0x4413('0x2b')]){_0x3de4a2[_0x4413('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x4413('0x2d')](_0x3de4a2);})[_0x4413('0xd')](function(_0x140004){_0x197b65[_0x4413('0x2e')]=_0x140004;return _0x197b65;})[_0x4413('0xd')](respondWithFilteredResult(_0x55dc83,_0x3de4a2))['catch'](handleError(_0x55dc83,null));};exports['show']=function(_0x31ffba,_0x43caf9){var _0x10c01b={'raw':![],'where':{'id':_0x31ffba[_0x4413('0x2f')]['id']}},_0x3d72c1={};_0x3d72c1[_0x4413('0x1a')]=_['keys'](db[_0x4413('0x2a')][_0x4413('0x16')]);_0x3d72c1[_0x4413('0x1b')]=_[_0x4413('0x1c')](_0x31ffba[_0x4413('0x1b')]);_0x3d72c1[_0x4413('0x25')]=_['intersection'](_0x3d72c1[_0x4413('0x1a')],_0x3d72c1[_0x4413('0x1b')]);_0x10c01b[_0x4413('0x1f')]=_['intersection'](_0x3d72c1[_0x4413('0x1a')],qs['fields'](_0x31ffba['query'][_0x4413('0x1e')]));_0x10c01b[_0x4413('0x1f')]=_0x10c01b[_0x4413('0x1f')]['length']?_0x10c01b[_0x4413('0x1f')]:_0x3d72c1[_0x4413('0x1a')];if(_0x31ffba[_0x4413('0x1b')][_0x4413('0x2b')]){_0x10c01b[_0x4413('0x2c')]=[{'all':!![]}];}_0x10c01b=_[_0x4413('0x28')]({},_0x10c01b,_0x31ffba['options']);return db[_0x4413('0x2a')][_0x4413('0x30')](_0x10c01b)['then'](handleEntityNotFound(_0x43caf9,null))[_0x4413('0xd')](respondWithResult(_0x43caf9,null))[_0x4413('0x31')](handleError(_0x43caf9,null));};exports[_0x4413('0x32')]=function(_0x52daf9,_0x13c373){return db[_0x4413('0x2a')]['create'](_0x52daf9[_0x4413('0x33')],{})[_0x4413('0xd')](respondWithResult(_0x13c373,0xc9))[_0x4413('0x31')](handleError(_0x13c373,null));};exports['update']=function(_0x37715,_0x29580e){if(_0x37715[_0x4413('0x33')]['id']){delete _0x37715[_0x4413('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x37715[_0x4413('0x2f')]['id']}})['then'](handleEntityNotFound(_0x29580e,null))[_0x4413('0xd')](saveUpdates(_0x37715[_0x4413('0x33')],null))[_0x4413('0xd')](respondWithResult(_0x29580e,null))[_0x4413('0x31')](handleError(_0x29580e,null));};exports['destroy']=function(_0x16a54a,_0x213eb1){return db[_0x4413('0x2a')][_0x4413('0x30')]({'where':{'id':_0x16a54a[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0x213eb1,null))[_0x4413('0xd')](removeEntity(_0x213eb1,null))[_0x4413('0x31')](handleError(_0x213eb1,null));};exports[_0x4413('0x34')]=function(_0x1d8ad3,_0x2ef44d){var _0x33beeb={};var _0x24cb6c={};var _0x120fc1;var _0x194bcd;return db[_0x4413('0x2a')][_0x4413('0x35')]({'where':{'id':_0x1d8ad3[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0x2ef44d,null))[_0x4413('0xd')](function(_0x2e8d6b){if(_0x2e8d6b){_0x120fc1=_0x2e8d6b;_0x24cb6c['model']=_[_0x4413('0x1c')](db[_0x4413('0x36')][_0x4413('0x16')]);_0x24cb6c[_0x4413('0x1b')]=_['keys'](_0x1d8ad3[_0x4413('0x1b')]);_0x24cb6c[_0x4413('0x25')]=_[_0x4413('0x1d')](_0x24cb6c[_0x4413('0x1a')],_0x24cb6c[_0x4413('0x1b')]);_0x33beeb[_0x4413('0x1f')]=_['intersection'](_0x24cb6c[_0x4413('0x1a')],qs[_0x4413('0x1e')](_0x1d8ad3['query'][_0x4413('0x1e')]));_0x33beeb['attributes']=_0x33beeb['attributes']['length']?_0x33beeb[_0x4413('0x1f')]:_0x24cb6c[_0x4413('0x1a')];_0x33beeb[_0x4413('0x22')]=qs[_0x4413('0x23')](_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x23')]);_0x33beeb[_0x4413('0x24')]=qs[_0x4413('0x25')](_[_0x4413('0x26')](_0x1d8ad3[_0x4413('0x1b')],_0x24cb6c['filters']));if(_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x27')]){_0x33beeb[_0x4413('0x24')]=_['merge'](_0x33beeb['where'],{'$or':_[_0x4413('0x15')](_0x33beeb['attributes'],function(_0xed39fd){var _0x206b4b={};_0x206b4b[_0xed39fd]={'$like':'%'+_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x27')]+'%'};return _0x206b4b;})});}_0x33beeb=_[_0x4413('0x28')]({},_0x33beeb,_0x1d8ad3['options']);return _0x120fc1[_0x4413('0x34')](_0x33beeb);}})[_0x4413('0xd')](function(_0x3f1318){if(_0x3f1318){_0x194bcd=_0x3f1318[_0x4413('0x37')];if(!_0x1d8ad3['query']['hasOwnProperty'](_0x4413('0x21'))){_0x33beeb['limit']=qs['limit'](_0x1d8ad3[_0x4413('0x1b')]['limit']);_0x33beeb[_0x4413('0x8')]=qs[_0x4413('0x8')](_0x1d8ad3[_0x4413('0x1b')][_0x4413('0x8')]);}return _0x120fc1['getConfigurations'](_0x33beeb);}})[_0x4413('0xd')](function(_0x3964f1){if(_0x3964f1){return _0x3964f1?{'count':_0x194bcd,'rows':_0x3964f1}:null;}})[_0x4413('0xd')](respondWithResult(_0x2ef44d,null))[_0x4413('0x31')](handleError(_0x2ef44d,null));};exports['addConfiguration']=function(_0x3f8510,_0xb48e04){if(_0x3f8510['body']['id']){delete _0x3f8510[_0x4413('0x33')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x3f8510[_0x4413('0x2f')]['id']}})[_0x4413('0xd')](handleEntityNotFound(_0xb48e04,null))[_0x4413('0xd')](function(_0x1c92b5){if(_0x1c92b5){_0x3f8510[_0x4413('0x33')]['AccountId']=_0x1c92b5['id'];_0x3f8510[_0x4413('0x33')][_0x4413('0x38')]=integrations['getSubjects'](_0x3f8510[_0x4413('0x33')][_0x4413('0x39')],_0x3f8510[_0x4413('0x33')][_0x4413('0x18')]);_0x3f8510['body'][_0x4413('0x3a')]=integrations[_0x4413('0x3b')](_0x3f8510['body'][_0x4413('0x39')],_0x3f8510['body'][_0x4413('0x18')]);return db['Dynamics365Configuration']['create'](_0x3f8510['body'],{'include':[{'model':db[_0x4413('0x3c')],'as':'Subjects'},{'model':db[_0x4413('0x3c')],'as':'Descriptions'}]});}return null;})[_0x4413('0xd')](respondWithResult(_0xb48e04,null))['catch'](handleError(_0xb48e04,null));};function sanitizeRemoteUri(_0x1b2e29){var _0x272f2d=_0x1b2e29['slice'](-0x1);if(_0x272f2d==='/')return _0x1b2e29[_0x4413('0x3d')](0x0,_0x1b2e29[_0x4413('0x3e')](_0x272f2d));return _0x1b2e29;}function getWebApiUrl(_0xafd236){return util[_0x4413('0x3f')]('%s/api/data/v9.0/',_0xafd236);}exports[_0x4413('0x40')]=function(_0x23c099,_0x44a8c1){var _0x5e6742=_0x23c099[_0x4413('0x1b')][_0x4413('0x41')];var _0x85fbcb=_0x5e6742===_0x4413('0x42')?_0x4413('0x43'):_0x4413('0x44');var _0x50c8b9='';var _0xa25aa='';var _0x4e0fda='';var _0x25e2e8='';var _0x1ad634='';var _0x4d8d71='';var _0x3683f1='';var _0x5d9533='';var _0x14541f=[_0x4413('0x45'),'description','customerid',_0x4413('0x46'),_0x4413('0x47'),_0x4413('0x48'),_0x4413('0x49'),_0x4413('0x4a'),_0x4413('0x4b'),_0x4413('0x4c')];var _0x1abff1=[_0x4413('0x4d'),_0x4413('0x4e'),_0x4413('0x4f'),'billedserviceunits',_0x4413('0x50'),_0x4413('0x51'),_0x4413('0x52'),'contractidname',_0x4413('0x53'),_0x4413('0x54'),'createdbyname',_0x4413('0x55'),_0x4413('0x56'),_0x4413('0x57'),_0x4413('0x58'),'customeridname',_0x4413('0x59'),_0x4413('0x5a'),_0x4413('0x5b'),_0x4413('0x5c'),_0x4413('0x5d'),_0x4413('0x5e'),_0x4413('0x5f'),_0x4413('0x60'),_0x4413('0x61'),_0x4413('0x62'),'importsequencenumber',_0x4413('0x63'),_0x4413('0x64'),'lastonholdtime',_0x4413('0x65'),'modifiedbyexternalpartyname',_0x4413('0x66'),_0x4413('0x67'),_0x4413('0x68'),_0x4413('0x69'),_0x4413('0x6a'),_0x4413('0x6b'),_0x4413('0x6c'),_0x4413('0x6d'),_0x4413('0x6e'),'onholdtime',_0x4413('0x6f'),_0x4413('0x70'),_0x4413('0x71'),'owneridyominame','parentcaseidname',_0x4413('0x72'),_0x4413('0x73'),_0x4413('0x74'),_0x4413('0x75'),_0x4413('0x76'),_0x4413('0x77'),'resolvebykpiidname','responseby','responsiblecontactidname',_0x4413('0x78'),'sentimentvalue',_0x4413('0x79'),_0x4413('0x7a'),_0x4413('0x7b'),_0x4413('0x7c'),_0x4413('0x7d'),_0x4413('0x7e'),'ticketnumber',_0x4413('0x7f'),_0x4413('0x80'),_0x4413('0x81'),'utcconversiontimezonecode',_0x4413('0x82')];var _0x504067=_0x14541f[_0x4413('0x83')](_0x1abff1);return db[_0x4413('0x2a')][_0x4413('0x35')]({'where':{'id':_0x23c099[_0x4413('0x2f')]['id']},'attributes':['id',_0x4413('0x84'),'password',_0x4413('0x85'),_0x4413('0x86'),'clientId',_0x4413('0x87'),_0x4413('0x88')],'include':[{'model':db[_0x4413('0x89')],'as':_0x4413('0x89'),'attributes':['id','data5',_0x4413('0x8a')]}]})['then'](handleEntityNotFound(_0x44a8c1,null))['then'](function(_0x31e0d3){if(_0x31e0d3){if(_0x31e0d3[_0x4413('0x88')]){_0x31e0d3[_0x4413('0x8b')]=_0x31e0d3[_0x4413('0x89')]['data5'];_0x5d9533=sanitizeRemoteUri(_0x31e0d3[_0x4413('0x89')][_0x4413('0x8a')]);_0x3683f1=getWebApiUrl(_0x5d9533);return _0x31e0d3;}_0x5d9533=sanitizeRemoteUri(_0x31e0d3['remoteUri']);_0x3683f1=getWebApiUrl(_0x5d9533);var _0x3b81aa={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x31e0d3[_0x4413('0x86')]+_0x4413('0x8c'),'form':{'client_id':_0x31e0d3[_0x4413('0x8d')],'resource':_0x5d9533,'username':_0x31e0d3[_0x4413('0x84')],'password':_0x31e0d3['password'],'grant_type':_0x4413('0x8e'),'client_secret':_0x31e0d3['clientSecret']},'json':!![]};return rp(_0x3b81aa);}})[_0x4413('0xd')](function(_0x2a2ce6){_0x4d8d71=_0x2a2ce6[_0x4413('0x8b')];var _0x1b9e29={'method':_0x4413('0x8f'),'uri':encodeURI(_0x3683f1+_0x4413('0x90')+_0x85fbcb+'\x27'),'headers':{'Authorization':_0x4413('0x91')+_0x4d8d71,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x1b9e29);})[_0x4413('0xd')](function(_0x1fe3ce){var _0xf8dfc=_0x1fe3ce[_0x4413('0x93')][0x0];var _0x7ecedb=_0xf8dfc[_0x4413('0x94')];var _0x486304={'method':_0x4413('0x8f'),'uri':_0x3683f1+_0x4413('0x95')+_0x7ecedb+_0x4413('0x96'),'headers':{'Authorization':_0x4413('0x91')+_0x4d8d71,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x486304);})[_0x4413('0xd')](function(_0xcdba08){_0x50c8b9=_0xcdba08;_0xa25aa=_0x50c8b9[_0x4413('0x97')];_0xa25aa=_[_0x4413('0x98')](_0xa25aa,function(_0x21e02f){return!_0x504067[_0x4413('0x99')](_0x21e02f['LogicalName']);});var _0x1a52ac=[];var _0x1782b2=[];_0xa25aa[_0x4413('0x9a')](function(_0xc30535){if(_0xc30535['@odata.type']){var _0x4347bc=_0xc30535[_0x4413('0x9b')][_0x4413('0x3d')](_0xc30535[_0x4413('0x9b')][_0x4413('0x3e')]('.')+0x1);if(_0x4347bc===_0x4413('0x9c')){_0x1a52ac['push'](getSelectList(_0x3683f1,_0x5e6742,_0x1782b2,_0x50c8b9['MetadataId'],_0xc30535[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x1a52ac);})[_0x4413('0xd')](function(_0x43aa85){_0x4e0fda=_0x43aa85[0x0];var _0x2ab0e2=[];var _0x82fa79=[];_0xa25aa['forEach'](function(_0x409dec){if(!_['isNil'](_0x409dec[_0x4413('0x9b')])){var _0x4f364e=_0x409dec[_0x4413('0x9b')]['substring'](_0x409dec[_0x4413('0x9b')]['lastIndexOf']('.')+0x1);if(_0x4f364e===_0x4413('0x9e')){_0x2ab0e2[_0x4413('0x9f')](getBooleanList(_0x3683f1,_0x5e6742,_0x82fa79,_0x50c8b9[_0x4413('0x94')],_0x409dec[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x2ab0e2);})[_0x4413('0xd')](function(_0xed5298){_0x25e2e8=_0xed5298[0x0];var _0x257f37=[];var _0x1153b5=[];_0xa25aa[_0x4413('0x9a')](function(_0x40b524){if(_0x40b524[_0x4413('0x9b')]){var _0x4d3ed4=_0x40b524['@odata.type']['substring'](_0x40b524[_0x4413('0x9b')][_0x4413('0x3e')]('.')+0x1);if(_0x4d3ed4==='StringAttributeMetadata'||_0x4d3ed4==='DoubleAttributeMetadata'||_0x4d3ed4===_0x4413('0xa0')||_0x4d3ed4===_0x4413('0xa1')||_0x4d3ed4===_0x4413('0xa2')||_0x4d3ed4===_0x4413('0xa3')||_0x4d3ed4===_0x4413('0xa4')||_0x4d3ed4===_0x4413('0xa5')||_0x4d3ed4===_0x4413('0xa6')||_0x4d3ed4==='DecimalAttributeMetadata'){_0x257f37['push'](getInputList(_0x3683f1,_0x5e6742,_0x4d3ed4,_0x1153b5,_0x50c8b9[_0x4413('0x94')],_0x40b524[_0x4413('0x94')],_0x4d8d71));}}});return Promise[_0x4413('0x9d')](_0x257f37);})[_0x4413('0xd')](function(_0x1a0258){_0x1ad634=_0x1a0258[0x0];var _0x4f6be3=_0x4e0fda['concat'](_0x25e2e8)[_0x4413('0x83')](_0x1ad634);var _0xc296a4={'count':_0x4f6be3[_0x4413('0x37')],'rows':_0x4f6be3};return _0xc296a4;})[_0x4413('0xd')](respondWithResult(_0x44a8c1,null))['catch'](function(_0x27d6d1){var _0xf82cfa=_0x23c099[_0x4413('0x1b')][_0x4413('0xa7')]?0x1f4:_0x27d6d1[_0x4413('0xa8')]||0x1f4;logger[_0x4413('0x10')](_0x27d6d1[_0x4413('0x11')]);delete _0x27d6d1[_0x4413('0x12')];if(_0xf82cfa===0x191){_0xf82cfa=0x190;}_0x44a8c1[_0x4413('0x9')](_0xf82cfa)['send'](_0x23c099['query']['test']?{'message':_0x4413('0xa9'),'statusCode':_0x27d6d1[_0x4413('0xa8')]}:_0x27d6d1);});};function getSelectList(_0x2fa415,_0x4c5ea0,_0x79b9b3,_0x47a07b,_0x44b7d5,_0x57872d){var _0x369f10={'method':'GET','uri':_0x2fa415+_0x4413('0x95')+_0x47a07b+')/Attributes('+_0x44b7d5+_0x4413('0xaa')+_0x4413('0xab'),'headers':{'Authorization':_0x4413('0x91')+_0x57872d,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x369f10)[_0x4413('0xd')](function(_0x33425a){var _0x29c489=[];var _0x2163bb=_0x33425a[_0x4413('0xac')][_0x4413('0xad')];_0x2163bb[_0x4413('0x9a')](function(_0x22222a){_0x29c489['push']({'name':_0x22222a['Label'][_0x4413('0xae')][_0x4413('0xaf')],'value':String(_0x22222a[_0x4413('0xb0')])});});var _0x5952bc={'id':_0x4c5ea0+'_'+_0x33425a[_0x4413('0xb1')],'name':_0x33425a['DisplayName']['UserLocalizedLabel'][_0x4413('0xaf')],'custom':![],'options':_0x29c489};_0x79b9b3['push'](_0x5952bc);return _0x79b9b3;});}function getBooleanList(_0x3065e4,_0x2d527a,_0x31368e,_0x231faa,_0x5d171d,_0x15547a){var _0x380ca5={'method':'GET','uri':_0x3065e4+_0x4413('0x95')+_0x231faa+')/Attributes('+_0x5d171d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4413('0x91')+_0x15547a,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0x380ca5)['then'](function(_0x253e8d){var _0x46c0a2=[];_0x46c0a2['push']({'name':_0x253e8d[_0x4413('0xac')][_0x4413('0xb2')][_0x4413('0xaf')][_0x4413('0xae')][_0x4413('0xaf')],'value':_0x4413('0xb3')},{'name':_0x253e8d[_0x4413('0xac')][_0x4413('0xb4')][_0x4413('0xaf')][_0x4413('0xae')][_0x4413('0xaf')],'value':_0x4413('0xb5')});var _0x46ac74={'id':_0x2d527a+'_'+_0x253e8d[_0x4413('0xb1')],'name':_0x253e8d[_0x4413('0xb6')][_0x4413('0xae')][_0x4413('0xaf')],'custom':![],'options':_0x46c0a2};_0x31368e[_0x4413('0x9f')](_0x46ac74);return _0x31368e;});}function getInputList(_0x490c01,_0x57a5b7,_0x1c5029,_0x4a3c01,_0x3d36e0,_0x4987c3,_0x384fdb){var _0xc054ac={'method':'GET','uri':_0x490c01+_0x4413('0x95')+_0x3d36e0+')/Attributes('+_0x4987c3+_0x4413('0xb7')+_0x1c5029+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x384fdb,'If-None-Match':null,'OData-Version':_0x4413('0x92')},'json':!![]};return rp(_0xc054ac)[_0x4413('0xd')](function(_0xb233eb){var _0x5dd18f={'id':_0x57a5b7+'_'+_0xb233eb[_0x4413('0xb1')],'name':_0xb233eb[_0x4413('0xb6')][_0x4413('0xae')]?_0xb233eb[_0x4413('0xb6')][_0x4413('0xae')][_0x4413('0xaf')]:_0xb233eb['LogicalName'],'custom':![],'options':[]};_0x4a3c01['push'](_0x5dd18f);return _0x4a3c01;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3252c33..5325faa 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2e370f,_0x2862ed){var _0x7b3eee=function(_0x5ec90c){while(--_0x5ec90c){_0x2e370f['push'](_0x2e370f['shift']());}};_0x7b3eee(++_0x2862ed);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d741a84..b1e6800 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 _0xb072=['limit','include','map','model','attributes','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xb072,0x139));var _0x2b07=function(_0x56fca5,_0x397370){_0x56fca5=_0x56fca5-0x0;var _0x284bd8=_0xb072[_0x56fca5];return _0x284bd8;};'use strict';var _=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var moment=require('moment');var BPromise=require(_0x2b07('0x2'));var rs=require(_0x2b07('0x3'));var fs=require('fs');var Redis=require(_0x2b07('0x4'));var db=require(_0x2b07('0x5'))['db'];var utils=require(_0x2b07('0x6'));var logger=require(_0x2b07('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b07('0x8')][_0x2b07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cbc6b,_0x2e9626,_0x4e801f){return new BPromise(function(_0x8e938c,_0x532497){return client[_0x2b07('0xa')](_0x4cbc6b,_0x4e801f)[_0x2b07('0xb')](function(_0x6becc6){logger[_0x2b07('0xc')](_0x2b07('0xd'),_0x2e9626,'request\x20sent');logger[_0x2b07('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2e9626,_0x2b07('0xf'),JSON[_0x2b07('0x10')](_0x6becc6));if(_0x6becc6['error']){if(_0x6becc6[_0x2b07('0x11')][_0x2b07('0x12')]===0x1f4){logger[_0x2b07('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x2e9626,_0x6becc6['error'][_0x2b07('0x13')]);return _0x532497(_0x6becc6[_0x2b07('0x11')]['message']);}logger[_0x2b07('0x11')](_0x2b07('0xd'),_0x2e9626,_0x6becc6[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x8e938c(_0x6becc6[_0x2b07('0x11')]['message']);}else{logger[_0x2b07('0xc')](_0x2b07('0xd'),_0x2e9626,'request\x20sent');_0x8e938c(_0x6becc6['result'][_0x2b07('0x13')]);}})[_0x2b07('0x14')](function(_0x340982){logger[_0x2b07('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x2e9626,_0x340982);_0x532497(_0x340982);});});}exports[_0x2b07('0x15')]=function(_0xb9a8ff){var _0x118677=this;return new Promise(function(_0x5783ac,_0x5de169){return db[_0x2b07('0x16')][_0x2b07('0x17')]({'raw':_0xb9a8ff['options']?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')]['attributes']||null:null,'limit':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1b')]||null:null,'include':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff['options'][_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1c')],function(_0x311735){return{'model':db[_0x311735[_0x2b07('0x1e')]],'as':_0x311735['as'],'attributes':_0x311735['attributes'],'include':_0x311735[_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x311735['include'],function(_0x89ae70){return{'model':db[_0x89ae70[_0x2b07('0x1e')]],'as':_0x89ae70['as'],'attributes':_0x89ae70[_0x2b07('0x1f')],'include':_0x89ae70['include']?_[_0x2b07('0x1d')](_0x89ae70[_0x2b07('0x1c')],function(_0x100f0b){return{'model':db[_0x100f0b[_0x2b07('0x1e')]],'as':_0x100f0b['as'],'attributes':_0x100f0b[_0x2b07('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xb')](function(_0x3231f5){logger['info'](_0x2b07('0x15'),_0xb9a8ff);logger['debug'](_0x2b07('0x15'),_0xb9a8ff,JSON[_0x2b07('0x10')](_0x3231f5));_0x5783ac(_0x3231f5);})[_0x2b07('0x14')](function(_0x2ad420){logger[_0x2b07('0x11')](_0x2b07('0x15'),_0x2ad420['message'],_0xb9a8ff);_0x5de169(_0x118677['error'](0x1f4,_0x2ad420[_0x2b07('0x13')]));});});};exports[_0x2b07('0x20')]=function(_0x38b76c){var _0x9a6a9e=this;return new Promise(function(_0xdea355,_0x4d6fbd){return db['Dynamics365Account'][_0x2b07('0x21')]({'raw':_0x38b76c[_0x2b07('0x18')]?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x38b76c['options']?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x38b76c['options']?_0x38b76c[_0x2b07('0x18')]['attributes']||null:null,'include':_0x38b76c[_0x2b07('0x18')]?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1c')],function(_0x2f848c){return{'model':db[_0x2f848c[_0x2b07('0x1e')]],'as':_0x2f848c['as'],'attributes':_0x2f848c[_0x2b07('0x1f')],'include':_0x2f848c[_0x2b07('0x1c')]?_['map'](_0x2f848c[_0x2b07('0x1c')],function(_0x4d3cda){return{'model':db[_0x4d3cda['model']],'as':_0x4d3cda['as'],'attributes':_0x4d3cda[_0x2b07('0x1f')],'include':_0x4d3cda[_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x4d3cda[_0x2b07('0x1c')],function(_0x1a1a30){return{'model':db[_0x1a1a30[_0x2b07('0x1e')]],'as':_0x1a1a30['as'],'attributes':_0x1a1a30[_0x2b07('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x244610){logger[_0x2b07('0xc')]('ShowDynamics365Account',_0x38b76c);logger[_0x2b07('0xe')](_0x2b07('0x20'),_0x38b76c,JSON[_0x2b07('0x10')](_0x244610));_0xdea355(_0x244610);})[_0x2b07('0x14')](function(_0x471622){logger[_0x2b07('0x11')](_0x2b07('0x20'),_0x471622[_0x2b07('0x13')],_0x38b76c);_0x4d6fbd(_0x9a6a9e[_0x2b07('0x11')](0x1f4,_0x471622[_0x2b07('0x13')]));});});}; \ No newline at end of file +var _0x6844=['Dynamics365Account','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','raw','options','where','attributes','include','map','model','stringify','ShowDynamics365Account'];(function(_0x483567,_0x5f049c){var _0x493b04=function(_0x30f0b8){while(--_0x30f0b8){_0x483567['push'](_0x483567['shift']());}};_0x493b04(++_0x5f049c);}(_0x6844,0x1d0));var _0x4684=function(_0x560620,_0x308b4d){_0x560620=_0x560620-0x0;var _0x4bc7c0=_0x6844[_0x560620];return _0x4bc7c0;};'use strict';var _=require(_0x4684('0x0'));var util=require('util');var moment=require(_0x4684('0x1'));var BPromise=require(_0x4684('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4684('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4684('0x4'));var logger=require(_0x4684('0x5'))(_0x4684('0x6'));var config=require('../../config/environment');var jayson=require(_0x4684('0x7'));var client=jayson[_0x4684('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289a97,_0x119f89,_0x1fc0ea){return new BPromise(function(_0x2cfe40,_0x443359){return client[_0x4684('0x9')](_0x289a97,_0x1fc0ea)[_0x4684('0xa')](function(_0x69ab2e){logger[_0x4684('0xb')](_0x4684('0xc'),_0x119f89,_0x4684('0xd'));logger[_0x4684('0xe')](_0x4684('0xf'),_0x119f89,'request\x20sent',JSON['stringify'](_0x69ab2e));if(_0x69ab2e[_0x4684('0x10')]){if(_0x69ab2e[_0x4684('0x10')][_0x4684('0x11')]===0x1f4){logger[_0x4684('0x10')](_0x4684('0xc'),_0x119f89,_0x69ab2e['error'][_0x4684('0x12')]);return _0x443359(_0x69ab2e['error']['message']);}logger[_0x4684('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x119f89,_0x69ab2e[_0x4684('0x10')][_0x4684('0x12')]);return _0x2cfe40(_0x69ab2e[_0x4684('0x10')]['message']);}else{logger['info'](_0x4684('0xc'),_0x119f89,_0x4684('0xd'));_0x2cfe40(_0x69ab2e[_0x4684('0x13')][_0x4684('0x12')]);}})[_0x4684('0x14')](function(_0x4e0a46){logger[_0x4684('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x119f89,_0x4e0a46);_0x443359(_0x4e0a46);});});}exports[_0x4684('0x15')]=function(_0x26e587){var _0x512c6a=this;return new Promise(function(_0x20a47f,_0x308a84){return db['Dynamics365Account']['findAll']({'raw':_0x26e587['options']?_0x26e587['options'][_0x4684('0x16')]===undefined?!![]:![]:!![],'where':_0x26e587[_0x4684('0x17')]?_0x26e587['options'][_0x4684('0x18')]||null:null,'attributes':_0x26e587[_0x4684('0x17')]?_0x26e587['options'][_0x4684('0x19')]||null:null,'limit':_0x26e587[_0x4684('0x17')]?_0x26e587[_0x4684('0x17')]['limit']||null:null,'include':_0x26e587[_0x4684('0x17')]?_0x26e587[_0x4684('0x17')][_0x4684('0x1a')]?_['map'](_0x26e587[_0x4684('0x17')][_0x4684('0x1a')],function(_0x42f300){return{'model':db[_0x42f300['model']],'as':_0x42f300['as'],'attributes':_0x42f300[_0x4684('0x19')],'include':_0x42f300[_0x4684('0x1a')]?_[_0x4684('0x1b')](_0x42f300[_0x4684('0x1a')],function(_0x7d9131){return{'model':db[_0x7d9131[_0x4684('0x1c')]],'as':_0x7d9131['as'],'attributes':_0x7d9131['attributes'],'include':_0x7d9131['include']?_[_0x4684('0x1b')](_0x7d9131['include'],function(_0x3002dd){return{'model':db[_0x3002dd[_0x4684('0x1c')]],'as':_0x3002dd['as'],'attributes':_0x3002dd[_0x4684('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4684('0xa')](function(_0x3cf73f){logger[_0x4684('0xb')]('GetDynamics365Account',_0x26e587);logger[_0x4684('0xe')](_0x4684('0x15'),_0x26e587,JSON[_0x4684('0x1d')](_0x3cf73f));_0x20a47f(_0x3cf73f);})[_0x4684('0x14')](function(_0x4d5021){logger[_0x4684('0x10')](_0x4684('0x15'),_0x4d5021[_0x4684('0x12')],_0x26e587);_0x308a84(_0x512c6a[_0x4684('0x10')](0x1f4,_0x4d5021[_0x4684('0x12')]));});});};exports[_0x4684('0x1e')]=function(_0x24f880){var _0x3bd721=this;return new Promise(function(_0x1b57ab,_0x5cd3ae){return db[_0x4684('0x1f')][_0x4684('0x20')]({'raw':_0x24f880['options']?_0x24f880['options']['raw']===undefined?!![]:![]:!![],'where':_0x24f880[_0x4684('0x17')]?_0x24f880['options'][_0x4684('0x18')]||null:null,'attributes':_0x24f880[_0x4684('0x17')]?_0x24f880[_0x4684('0x17')][_0x4684('0x19')]||null:null,'include':_0x24f880[_0x4684('0x17')]?_0x24f880['options']['include']?_[_0x4684('0x1b')](_0x24f880[_0x4684('0x17')]['include'],function(_0x36ced1){return{'model':db[_0x36ced1[_0x4684('0x1c')]],'as':_0x36ced1['as'],'attributes':_0x36ced1[_0x4684('0x19')],'include':_0x36ced1[_0x4684('0x1a')]?_[_0x4684('0x1b')](_0x36ced1[_0x4684('0x1a')],function(_0x330dd7){return{'model':db[_0x330dd7[_0x4684('0x1c')]],'as':_0x330dd7['as'],'attributes':_0x330dd7[_0x4684('0x19')],'include':_0x330dd7['include']?_[_0x4684('0x1b')](_0x330dd7[_0x4684('0x1a')],function(_0xab0eaf){return{'model':db[_0xab0eaf['model']],'as':_0xab0eaf['as'],'attributes':_0xab0eaf[_0x4684('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4684('0xa')](function(_0x5138cc){logger[_0x4684('0xb')](_0x4684('0x1e'),_0x24f880);logger[_0x4684('0xe')]('ShowDynamics365Account',_0x24f880,JSON[_0x4684('0x1d')](_0x5138cc));_0x1b57ab(_0x5138cc);})[_0x4684('0x14')](function(_0x2de25f){logger[_0x4684('0x10')]('ShowDynamics365Account',_0x2de25f[_0x4684('0x12')],_0x24f880);_0x5cd3ae(_0x3bd721[_0x4684('0x10')](0x1f4,_0x2de25f[_0x4684('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 151700f..09b6720 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 _0x46a7=['destroy','exports','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','show','getFields','/:id/subjects','getDescriptions','post','put','/:id'];(function(_0x29827f,_0x452928){var _0x5237d8=function(_0x1d62ac){while(--_0x1d62ac){_0x29827f['push'](_0x29827f['shift']());}};_0x5237d8(++_0x452928);}(_0x46a7,0x92));var _0x746a=function(_0x43f980,_0x585e64){_0x43f980=_0x43f980-0x0;var _0xcf2a52=_0x46a7[_0x43f980];return _0xcf2a52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x746a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x746a('0x1')]();var fs_extra=require(_0x746a('0x2'));var auth=require(_0x746a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x746a('0x4'));var controller=require(_0x746a('0x5'));router['get']('/',auth[_0x746a('0x6')](),controller[_0x746a('0x7')]);router[_0x746a('0x8')]('/:id',auth[_0x746a('0x6')](),controller[_0x746a('0x9')]);router[_0x746a('0x8')]('/:id/fields',auth[_0x746a('0x6')](),controller[_0x746a('0xa')]);router[_0x746a('0x8')](_0x746a('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x746a('0x6')](),controller[_0x746a('0xc')]);router[_0x746a('0xd')]('/',auth[_0x746a('0x6')](),controller['create']);router[_0x746a('0xe')](_0x746a('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x746a('0xf'),auth[_0x746a('0x6')](),controller[_0x746a('0x10')]);module[_0x746a('0x11')]=router; \ No newline at end of file +var _0x7833=['/:id/fields','getFields','/:id/subjects','getSubjects','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x555569,_0x15669b){var _0x2541ff=function(_0x5aef2b){while(--_0x5aef2b){_0x555569['push'](_0x555569['shift']());}};_0x2541ff(++_0x15669b);}(_0x7833,0x1d6));var _0x3783=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x7833[_0x5eaa0b];return _0x28b295;};'use strict';var multer=require(_0x3783('0x0'));var util=require(_0x3783('0x1'));var path=require('path');var timeout=require(_0x3783('0x2'));var express=require('express');var router=express[_0x3783('0x3')]();var fs_extra=require(_0x3783('0x4'));var auth=require(_0x3783('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3783('0x6'));var controller=require(_0x3783('0x7'));router[_0x3783('0x8')]('/',auth[_0x3783('0x9')](),controller[_0x3783('0xa')]);router[_0x3783('0x8')](_0x3783('0xb'),auth[_0x3783('0x9')](),controller[_0x3783('0xc')]);router[_0x3783('0x8')](_0x3783('0xd'),auth[_0x3783('0x9')](),controller[_0x3783('0xe')]);router[_0x3783('0x8')](_0x3783('0xf'),auth[_0x3783('0x9')](),controller[_0x3783('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3783('0x11')]('/',auth['isAuthenticated'](),controller[_0x3783('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3783('0x13')]);router[_0x3783('0x14')](_0x3783('0xb'),auth['isAuthenticated'](),controller[_0x3783('0x15')]);module[_0x3783('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 0f4595b..cf8ceec 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 _0x0186=['phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0186,0x185));var _0x6018=function(_0x1ab04a,_0x26eb6a){_0x1ab04a=_0x1ab04a-0x0;var _0x22a4e3=_0x0186[_0x1ab04a];return _0x22a4e3;};'use strict';var Sequelize=require(_0x6018('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6018('0x1')]},'ticketType':{'type':Sequelize[_0x6018('0x2')]('incident',_0x6018('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x6018('0x2')](_0x6018('0x4'),_0x6018('0x5')),'defaultValue':_0x6018('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x6018('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6018('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb6c4=['exports','STRING','incident','ENUM','contact','BOOLEAN','sequelize'];(function(_0x5151b1,_0x2fb2af){var _0x3805e5=function(_0x556fde){while(--_0x556fde){_0x5151b1['push'](_0x5151b1['shift']());}};_0x3805e5(++_0x2fb2af);}(_0xb6c4,0xed));var _0x4b6c=function(_0x2459e8,_0x4924e7){_0x2459e8=_0x2459e8-0x0;var _0x2888d9=_0xb6c4[_0x2459e8];return _0x2888d9;};'use strict';var Sequelize=require(_0x4b6c('0x0'));module[_0x4b6c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b6c('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':_0x4b6c('0x3')},'moduleCreate':{'type':Sequelize[_0x4b6c('0x4')]('contact','nothing'),'defaultValue':_0x4b6c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x4b6c('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4b6c('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d5e4b63..f89291b 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 _0x47ab=['hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','include','rows','show','params','length','find','catch','create','body','update','getFields','Dynamics365Field','order','pick','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47ab,0xb2));var _0xb47a=function(_0x38d97d,_0x168431){_0x38d97d=_0x38d97d-0x0;var _0x115cee=_0x47ab[_0x38d97d];return _0x115cee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb47a('0x0'));var jsonpatch=require(_0xb47a('0x1'));var rp=require(_0xb47a('0x2'));var moment=require('moment');var BPromise=require(_0xb47a('0x3'));var Mustache=require(_0xb47a('0x4'));var util=require(_0xb47a('0x5'));var path=require(_0xb47a('0x6'));var sox=require(_0xb47a('0x7'));var csv=require(_0xb47a('0x8'));var ejs=require(_0xb47a('0x9'));var fs=require('fs');var fs_extra=require(_0xb47a('0xa'));var _=require('lodash');var squel=require(_0xb47a('0xb'));var crypto=require('crypto');var jsforce=require(_0xb47a('0xc'));var deskjs=require(_0xb47a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb47a('0xe'));var Papa=require('papaparse');var Redis=require(_0xb47a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb47a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb47a('0x11'))('api');var utils=require(_0xb47a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb47a('0x13'));var db=require(_0xb47a('0x14'))['db'];function respondWithStatusCode(_0x146e01,_0x64aff8){_0x64aff8=_0x64aff8||0xcc;return function(_0x55c34f){if(_0x55c34f){return _0x146e01['sendStatus'](_0x64aff8);}return _0x146e01[_0xb47a('0x15')](_0x64aff8)[_0xb47a('0x16')]();};}function respondWithResult(_0x12e9eb,_0x4a09f5){_0x4a09f5=_0x4a09f5||0xc8;return function(_0xc23826){if(_0xc23826){return _0x12e9eb[_0xb47a('0x15')](_0x4a09f5)[_0xb47a('0x17')](_0xc23826);}};}function respondWithFilteredResult(_0xf1b91d,_0x56b99b){return function(_0x1af57d){if(_0x1af57d){var _0x2bd3d2=typeof _0x56b99b[_0xb47a('0x18')]==='undefined'&&typeof _0x56b99b[_0xb47a('0x19')]===_0xb47a('0x1a');var _0x53f1a8=_0x1af57d['count'];var _0x112615=_0x2bd3d2?0x0:_0x56b99b[_0xb47a('0x18')];var _0x11104e=_0x2bd3d2?_0x1af57d['count']:_0x56b99b[_0xb47a('0x18')]+_0x56b99b[_0xb47a('0x19')];var _0x2dfd18;if(_0x11104e>=_0x53f1a8){_0x11104e=_0x53f1a8;_0x2dfd18=0xc8;}else{_0x2dfd18=0xce;}_0xf1b91d['status'](_0x2dfd18);return _0xf1b91d['set'](_0xb47a('0x1b'),_0x112615+'-'+_0x11104e+'/'+_0x53f1a8)['json'](_0x1af57d);}return null;};}function patchUpdates(_0x4376d9){return function(_0x173c7b){try{jsonpatch[_0xb47a('0x1c')](_0x173c7b,_0x4376d9,!![]);}catch(_0x585274){return BPromise[_0xb47a('0x1d')](_0x585274);}return _0x173c7b[_0xb47a('0x1e')]();};}function saveUpdates(_0x59c4f1,_0x481582){return function(_0x432929){if(_0x432929){return _0x432929['update'](_0x59c4f1)[_0xb47a('0x1f')](function(_0xdcca2){return _0xdcca2;});}return null;};}function removeEntity(_0x49aa05,_0x75c59c){return function(_0x55aeb1){if(_0x55aeb1){return _0x55aeb1[_0xb47a('0x20')]()[_0xb47a('0x1f')](function(){_0x49aa05['status'](0xcc)[_0xb47a('0x16')]();});}};}function handleEntityNotFound(_0x1ccb23,_0x2736ec){return function(_0x4d74e8){if(!_0x4d74e8){_0x1ccb23[_0xb47a('0x21')](0x194);}return _0x4d74e8;};}function handleError(_0x220cfc,_0x740b98){_0x740b98=_0x740b98||0x1f4;return function(_0x65d246){logger['error'](_0x65d246[_0xb47a('0x22')]);if(_0x65d246[_0xb47a('0x23')]){delete _0x65d246[_0xb47a('0x23')];}_0x220cfc[_0xb47a('0x15')](_0x740b98)[_0xb47a('0x24')](_0x65d246);};}exports[_0xb47a('0x25')]=function(_0x1a2b22,_0x150deb){var _0x1e2b10={},_0x4cf966={},_0x587700={'count':0x0,'rows':[]};var _0x3dd09f=_[_0xb47a('0x26')](db[_0xb47a('0x27')][_0xb47a('0x28')],function(_0x5701bf){return{'name':_0x5701bf['fieldName'],'type':_0x5701bf[_0xb47a('0x29')][_0xb47a('0x2a')]};});_0x4cf966[_0xb47a('0x2b')]=_[_0xb47a('0x26')](_0x3dd09f,_0xb47a('0x23'));_0x4cf966[_0xb47a('0x2c')]=_[_0xb47a('0x2d')](_0x1a2b22[_0xb47a('0x2c')]);_0x4cf966[_0xb47a('0x2e')]=_[_0xb47a('0x2f')](_0x4cf966[_0xb47a('0x2b')],_0x4cf966[_0xb47a('0x2c')]);_0x1e2b10[_0xb47a('0x30')]=_['intersection'](_0x4cf966['model'],qs[_0xb47a('0x31')](_0x1a2b22[_0xb47a('0x2c')][_0xb47a('0x31')]));_0x1e2b10[_0xb47a('0x30')]=_0x1e2b10[_0xb47a('0x30')]['length']?_0x1e2b10['attributes']:_0x4cf966[_0xb47a('0x2b')];if(!_0x1a2b22[_0xb47a('0x2c')][_0xb47a('0x32')](_0xb47a('0x33'))){_0x1e2b10[_0xb47a('0x19')]=qs['limit'](_0x1a2b22[_0xb47a('0x2c')]['limit']);_0x1e2b10['offset']=qs[_0xb47a('0x18')](_0x1a2b22[_0xb47a('0x2c')][_0xb47a('0x18')]);}_0x1e2b10['order']=qs[_0xb47a('0x34')](_0x1a2b22[_0xb47a('0x2c')]['sort']);_0x1e2b10[_0xb47a('0x35')]=qs[_0xb47a('0x2e')](_['pick'](_0x1a2b22['query'],_0x4cf966[_0xb47a('0x2e')]),_0x3dd09f);if(_0x1a2b22[_0xb47a('0x2c')][_0xb47a('0x36')]){_0x1e2b10[_0xb47a('0x35')]=_['merge'](_0x1e2b10[_0xb47a('0x35')],{'$or':_[_0xb47a('0x26')](_0x3dd09f,function(_0x52a1ff){if(_0x52a1ff[_0xb47a('0x29')]!==_0xb47a('0x37')){var _0x451b76={};_0x451b76[_0x52a1ff[_0xb47a('0x23')]]={'$like':'%'+_0x1a2b22[_0xb47a('0x2c')][_0xb47a('0x36')]+'%'};return _0x451b76;}})});}_0x1e2b10=_[_0xb47a('0x38')]({},_0x1e2b10,_0x1a2b22[_0xb47a('0x39')]);var _0x2fc8df={'where':_0x1e2b10[_0xb47a('0x35')]};return db[_0xb47a('0x27')]['count'](_0x2fc8df)[_0xb47a('0x1f')](function(_0x532f11){_0x587700[_0xb47a('0x3a')]=_0x532f11;if(_0x1a2b22['query']['includeAll']){_0x1e2b10[_0xb47a('0x3b')]=[{'all':!![]}];}return db[_0xb47a('0x27')]['findAll'](_0x1e2b10);})[_0xb47a('0x1f')](function(_0x5cc097){_0x587700[_0xb47a('0x3c')]=_0x5cc097;return _0x587700;})['then'](respondWithFilteredResult(_0x150deb,_0x1e2b10))['catch'](handleError(_0x150deb,null));};exports[_0xb47a('0x3d')]=function(_0x31206a,_0x535558){var _0x4bb82c={'raw':![],'where':{'id':_0x31206a[_0xb47a('0x3e')]['id']}},_0x1fd084={};_0x1fd084[_0xb47a('0x2b')]=_[_0xb47a('0x2d')](db[_0xb47a('0x27')][_0xb47a('0x28')]);_0x1fd084[_0xb47a('0x2c')]=_['keys'](_0x31206a[_0xb47a('0x2c')]);_0x1fd084[_0xb47a('0x2e')]=_[_0xb47a('0x2f')](_0x1fd084[_0xb47a('0x2b')],_0x1fd084[_0xb47a('0x2c')]);_0x4bb82c[_0xb47a('0x30')]=_['intersection'](_0x1fd084[_0xb47a('0x2b')],qs['fields'](_0x31206a['query'][_0xb47a('0x31')]));_0x4bb82c[_0xb47a('0x30')]=_0x4bb82c['attributes'][_0xb47a('0x3f')]?_0x4bb82c[_0xb47a('0x30')]:_0x1fd084[_0xb47a('0x2b')];if(_0x31206a['query']['includeAll']){_0x4bb82c['include']=[{'all':!![]}];}_0x4bb82c=_[_0xb47a('0x38')]({},_0x4bb82c,_0x31206a[_0xb47a('0x39')]);return db[_0xb47a('0x27')][_0xb47a('0x40')](_0x4bb82c)[_0xb47a('0x1f')](handleEntityNotFound(_0x535558,null))['then'](respondWithResult(_0x535558,null))[_0xb47a('0x41')](handleError(_0x535558,null));};exports[_0xb47a('0x42')]=function(_0x1ee2d6,_0x30db44){return db[_0xb47a('0x27')][_0xb47a('0x42')](_0x1ee2d6[_0xb47a('0x43')],{})[_0xb47a('0x1f')](respondWithResult(_0x30db44,0xc9))[_0xb47a('0x41')](handleError(_0x30db44,null));};exports[_0xb47a('0x44')]=function(_0x4ea3f5,_0x55f7b4){if(_0x4ea3f5[_0xb47a('0x43')]['id']){delete _0x4ea3f5[_0xb47a('0x43')]['id'];}return db['Dynamics365Configuration'][_0xb47a('0x40')]({'where':{'id':_0x4ea3f5[_0xb47a('0x3e')]['id']}})[_0xb47a('0x1f')](handleEntityNotFound(_0x55f7b4,null))['then'](saveUpdates(_0x4ea3f5[_0xb47a('0x43')],null))[_0xb47a('0x1f')](respondWithResult(_0x55f7b4,null))[_0xb47a('0x41')](handleError(_0x55f7b4,null));};exports[_0xb47a('0x20')]=function(_0x488109,_0x18d387){return db[_0xb47a('0x27')][_0xb47a('0x40')]({'where':{'id':_0x488109[_0xb47a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x18d387,null))[_0xb47a('0x1f')](removeEntity(_0x18d387,null))['catch'](handleError(_0x18d387,null));};exports[_0xb47a('0x45')]=function(_0x2afd76,_0x5bcdb4,_0x344db5){var _0x2c7f9b={};var _0x54db7f={};var _0x3df59d;var _0x4a114f;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2afd76[_0xb47a('0x3e')]['id']}})[_0xb47a('0x1f')](handleEntityNotFound(_0x5bcdb4,null))[_0xb47a('0x1f')](function(_0x658d9a){if(_0x658d9a){_0x3df59d=_0x658d9a;_0x54db7f[_0xb47a('0x2b')]=_[_0xb47a('0x2d')](db[_0xb47a('0x46')][_0xb47a('0x28')]);_0x54db7f['query']=_[_0xb47a('0x2d')](_0x2afd76[_0xb47a('0x2c')]);_0x54db7f[_0xb47a('0x2e')]=_['intersection'](_0x54db7f[_0xb47a('0x2b')],_0x54db7f[_0xb47a('0x2c')]);_0x2c7f9b[_0xb47a('0x30')]=_['intersection'](_0x54db7f[_0xb47a('0x2b')],qs[_0xb47a('0x31')](_0x2afd76[_0xb47a('0x2c')][_0xb47a('0x31')]));_0x2c7f9b['attributes']=_0x2c7f9b[_0xb47a('0x30')][_0xb47a('0x3f')]?_0x2c7f9b[_0xb47a('0x30')]:_0x54db7f[_0xb47a('0x2b')];_0x2c7f9b[_0xb47a('0x47')]=qs[_0xb47a('0x34')](_0x2afd76[_0xb47a('0x2c')][_0xb47a('0x34')]);_0x2c7f9b['where']=qs[_0xb47a('0x2e')](_[_0xb47a('0x48')](_0x2afd76[_0xb47a('0x2c')],_0x54db7f['filters']));if(_0x2afd76[_0xb47a('0x2c')][_0xb47a('0x36')]){_0x2c7f9b['where']=_['merge'](_0x2c7f9b[_0xb47a('0x35')],{'$or':_[_0xb47a('0x26')](_0x2c7f9b[_0xb47a('0x30')],function(_0x35de32){var _0x4e44ac={};_0x4e44ac[_0x35de32]={'$like':'%'+_0x2afd76[_0xb47a('0x2c')][_0xb47a('0x36')]+'%'};return _0x4e44ac;})});}_0x2c7f9b=_[_0xb47a('0x38')]({},_0x2c7f9b,_0x2afd76[_0xb47a('0x39')]);return _0x3df59d[_0xb47a('0x45')](_0x2c7f9b);}})[_0xb47a('0x1f')](function(_0x3fcaf1){if(_0x3fcaf1){_0x4a114f=_0x3fcaf1[_0xb47a('0x3f')];if(!_0x2afd76['query']['hasOwnProperty'](_0xb47a('0x33'))){_0x2c7f9b['limit']=qs[_0xb47a('0x19')](_0x2afd76[_0xb47a('0x2c')][_0xb47a('0x19')]);_0x2c7f9b[_0xb47a('0x18')]=qs['offset'](_0x2afd76['query'][_0xb47a('0x18')]);}return _0x3df59d['getFields'](_0x2c7f9b);}})['then'](function(_0x19f5f8){if(_0x19f5f8){return _0x19f5f8?{'count':_0x4a114f,'rows':_0x19f5f8}:null;}})[_0xb47a('0x1f')](respondWithResult(_0x5bcdb4,null))[_0xb47a('0x41')](handleError(_0x5bcdb4,null));};exports[_0xb47a('0x49')]=function(_0x214af1,_0x5ac640,_0x19632f){var _0x2a5eea={};var _0xabf77d={};var _0x548393;var _0x139196;return db[_0xb47a('0x27')][_0xb47a('0x4a')]({'where':{'id':_0x214af1[_0xb47a('0x3e')]['id']}})[_0xb47a('0x1f')](handleEntityNotFound(_0x5ac640,null))[_0xb47a('0x1f')](function(_0x22a00d){if(_0x22a00d){_0x548393=_0x22a00d;_0xabf77d[_0xb47a('0x2b')]=_['keys'](db[_0xb47a('0x46')][_0xb47a('0x28')]);_0xabf77d[_0xb47a('0x2c')]=_[_0xb47a('0x2d')](_0x214af1['query']);_0xabf77d[_0xb47a('0x2e')]=_[_0xb47a('0x2f')](_0xabf77d[_0xb47a('0x2b')],_0xabf77d['query']);_0x2a5eea[_0xb47a('0x30')]=_[_0xb47a('0x2f')](_0xabf77d[_0xb47a('0x2b')],qs[_0xb47a('0x31')](_0x214af1[_0xb47a('0x2c')][_0xb47a('0x31')]));_0x2a5eea[_0xb47a('0x30')]=_0x2a5eea['attributes'][_0xb47a('0x3f')]?_0x2a5eea['attributes']:_0xabf77d['model'];_0x2a5eea[_0xb47a('0x47')]=qs[_0xb47a('0x34')](_0x214af1[_0xb47a('0x2c')][_0xb47a('0x34')]);_0x2a5eea[_0xb47a('0x35')]=qs[_0xb47a('0x2e')](_[_0xb47a('0x48')](_0x214af1[_0xb47a('0x2c')],_0xabf77d[_0xb47a('0x2e')]));if(_0x214af1[_0xb47a('0x2c')][_0xb47a('0x36')]){_0x2a5eea['where']=_[_0xb47a('0x38')](_0x2a5eea[_0xb47a('0x35')],{'$or':_['map'](_0x2a5eea[_0xb47a('0x30')],function(_0x20c361){var _0x38ba3e={};_0x38ba3e[_0x20c361]={'$like':'%'+_0x214af1[_0xb47a('0x2c')]['filter']+'%'};return _0x38ba3e;})});}_0x2a5eea=_[_0xb47a('0x38')]({},_0x2a5eea,_0x214af1['options']);return _0x548393[_0xb47a('0x49')](_0x2a5eea);}})[_0xb47a('0x1f')](function(_0x27845d){if(_0x27845d){_0x139196=_0x27845d[_0xb47a('0x3f')];if(!_0x214af1['query'][_0xb47a('0x32')](_0xb47a('0x33'))){_0x2a5eea[_0xb47a('0x19')]=qs[_0xb47a('0x19')](_0x214af1[_0xb47a('0x2c')][_0xb47a('0x19')]);_0x2a5eea[_0xb47a('0x18')]=qs[_0xb47a('0x18')](_0x214af1['query']['offset']);}return _0x548393[_0xb47a('0x49')](_0x2a5eea);}})[_0xb47a('0x1f')](function(_0x4b88f6){if(_0x4b88f6){return _0x4b88f6?{'count':_0x139196,'rows':_0x4b88f6}:null;}})[_0xb47a('0x1f')](respondWithResult(_0x5ac640,null))[_0xb47a('0x41')](handleError(_0x5ac640,null));};exports['getDescriptions']=function(_0x2bd743,_0x4983,_0x4fe697){var _0x3fab34={};var _0x7e6b9f={};var _0x1881dd;var _0x207153;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2bd743['params']['id']}})['then'](handleEntityNotFound(_0x4983,null))[_0xb47a('0x1f')](function(_0x43d784){if(_0x43d784){_0x1881dd=_0x43d784;_0x7e6b9f['model']=_['keys'](db[_0xb47a('0x46')][_0xb47a('0x28')]);_0x7e6b9f['query']=_['keys'](_0x2bd743['query']);_0x7e6b9f[_0xb47a('0x2e')]=_['intersection'](_0x7e6b9f[_0xb47a('0x2b')],_0x7e6b9f['query']);_0x3fab34[_0xb47a('0x30')]=_[_0xb47a('0x2f')](_0x7e6b9f[_0xb47a('0x2b')],qs[_0xb47a('0x31')](_0x2bd743[_0xb47a('0x2c')][_0xb47a('0x31')]));_0x3fab34[_0xb47a('0x30')]=_0x3fab34[_0xb47a('0x30')][_0xb47a('0x3f')]?_0x3fab34[_0xb47a('0x30')]:_0x7e6b9f[_0xb47a('0x2b')];_0x3fab34[_0xb47a('0x47')]=qs[_0xb47a('0x34')](_0x2bd743[_0xb47a('0x2c')][_0xb47a('0x34')]);_0x3fab34['where']=qs[_0xb47a('0x2e')](_[_0xb47a('0x48')](_0x2bd743['query'],_0x7e6b9f[_0xb47a('0x2e')]));if(_0x2bd743['query'][_0xb47a('0x36')]){_0x3fab34[_0xb47a('0x35')]=_[_0xb47a('0x38')](_0x3fab34[_0xb47a('0x35')],{'$or':_['map'](_0x3fab34[_0xb47a('0x30')],function(_0x238ce2){var _0x2badd4={};_0x2badd4[_0x238ce2]={'$like':'%'+_0x2bd743[_0xb47a('0x2c')][_0xb47a('0x36')]+'%'};return _0x2badd4;})});}_0x3fab34=_[_0xb47a('0x38')]({},_0x3fab34,_0x2bd743[_0xb47a('0x39')]);return _0x1881dd['getDescriptions'](_0x3fab34);}})['then'](function(_0xe55756){if(_0xe55756){_0x207153=_0xe55756[_0xb47a('0x3f')];if(!_0x2bd743[_0xb47a('0x2c')][_0xb47a('0x32')](_0xb47a('0x33'))){_0x3fab34[_0xb47a('0x19')]=qs[_0xb47a('0x19')](_0x2bd743[_0xb47a('0x2c')][_0xb47a('0x19')]);_0x3fab34[_0xb47a('0x18')]=qs['offset'](_0x2bd743['query'][_0xb47a('0x18')]);}return _0x1881dd[_0xb47a('0x4b')](_0x3fab34);}})[_0xb47a('0x1f')](function(_0x89addd){if(_0x89addd){return _0x89addd?{'count':_0x207153,'rows':_0x89addd}:null;}})[_0xb47a('0x1f')](respondWithResult(_0x4983,null))[_0xb47a('0x41')](handleError(_0x4983,null));}; \ No newline at end of file +var _0x1c25=['count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','Dynamics365Configuration','findAll','rows','rawAttributes','length','includeAll','find','create','catch','body','params','findOne','Dynamics365Field','nolimit','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c25,0xcd));var _0x51c2=function(_0x856ada,_0x1864e4){_0x856ada=_0x856ada-0x0;var _0x228cc2=_0x1c25[_0x856ada];return _0x228cc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51c2('0x0'));var zipdir=require(_0x51c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51c2('0x2'));var moment=require('moment');var BPromise=require(_0x51c2('0x3'));var Mustache=require(_0x51c2('0x4'));var util=require(_0x51c2('0x5'));var path=require(_0x51c2('0x6'));var sox=require(_0x51c2('0x7'));var csv=require(_0x51c2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51c2('0x9'));var _=require(_0x51c2('0xa'));var squel=require(_0x51c2('0xb'));var crypto=require(_0x51c2('0xc'));var jsforce=require(_0x51c2('0xd'));var deskjs=require(_0x51c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x51c2('0xf'));var Papa=require('papaparse');var Redis=require(_0x51c2('0x10'));var authService=require(_0x51c2('0x11'));var qs=require(_0x51c2('0x12'));var as=require(_0x51c2('0x13'));var hardwareService=require(_0x51c2('0x14'));var logger=require('../../config/logger')(_0x51c2('0x15'));var utils=require(_0x51c2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4745,_0x234d41){_0x234d41=_0x234d41||0xcc;return function(_0x42d04a){if(_0x42d04a){return _0x3b4745[_0x51c2('0x17')](_0x234d41);}return _0x3b4745['status'](_0x234d41)['end']();};}function respondWithResult(_0x62c34c,_0x1c7dc3){_0x1c7dc3=_0x1c7dc3||0xc8;return function(_0x23499c){if(_0x23499c){return _0x62c34c[_0x51c2('0x18')](_0x1c7dc3)[_0x51c2('0x19')](_0x23499c);}};}function respondWithFilteredResult(_0x442884,_0x587b40){return function(_0x46c6f4){if(_0x46c6f4){var _0x58ac57=typeof _0x587b40[_0x51c2('0x1a')]==='undefined'&&typeof _0x587b40[_0x51c2('0x1b')]===_0x51c2('0x1c');var _0x45125c=_0x46c6f4[_0x51c2('0x1d')];var _0x10e996=_0x58ac57?0x0:_0x587b40['offset'];var _0x486e0d=_0x58ac57?_0x46c6f4[_0x51c2('0x1d')]:_0x587b40[_0x51c2('0x1a')]+_0x587b40['limit'];var _0x892009;if(_0x486e0d>=_0x45125c){_0x486e0d=_0x45125c;_0x892009=0xc8;}else{_0x892009=0xce;}_0x442884[_0x51c2('0x18')](_0x892009);return _0x442884[_0x51c2('0x1e')](_0x51c2('0x1f'),_0x10e996+'-'+_0x486e0d+'/'+_0x45125c)[_0x51c2('0x19')](_0x46c6f4);}return null;};}function patchUpdates(_0x1386b2){return function(_0x2b2383){try{jsonpatch[_0x51c2('0x20')](_0x2b2383,_0x1386b2,!![]);}catch(_0x3644cb){return BPromise[_0x51c2('0x21')](_0x3644cb);}return _0x2b2383[_0x51c2('0x22')]();};}function saveUpdates(_0x1e7026,_0x1ae272){return function(_0x3ce085){if(_0x3ce085){return _0x3ce085[_0x51c2('0x23')](_0x1e7026)[_0x51c2('0x24')](function(_0x5eeb49){return _0x5eeb49;});}return null;};}function removeEntity(_0x366be3,_0x34c721){return function(_0x6573f8){if(_0x6573f8){return _0x6573f8[_0x51c2('0x25')]()[_0x51c2('0x24')](function(){_0x366be3[_0x51c2('0x18')](0xcc)[_0x51c2('0x26')]();});}};}function handleEntityNotFound(_0x430194,_0x57dd3d){return function(_0x1dbd35){if(!_0x1dbd35){_0x430194[_0x51c2('0x17')](0x194);}return _0x1dbd35;};}function handleError(_0x4c8389,_0x12c9f6){_0x12c9f6=_0x12c9f6||0x1f4;return function(_0x2be973){logger[_0x51c2('0x27')](_0x2be973[_0x51c2('0x28')]);if(_0x2be973['name']){delete _0x2be973[_0x51c2('0x29')];}_0x4c8389[_0x51c2('0x18')](_0x12c9f6)['send'](_0x2be973);};}exports[_0x51c2('0x2a')]=function(_0x3e1907,_0x100b79){var _0x338666={},_0x3f6e11={},_0x5b9ccd={'count':0x0,'rows':[]};var _0x36b804=_[_0x51c2('0x2b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x4c1550){return{'name':_0x4c1550[_0x51c2('0x2c')],'type':_0x4c1550[_0x51c2('0x2d')]['key']};});_0x3f6e11['model']=_[_0x51c2('0x2b')](_0x36b804,_0x51c2('0x29'));_0x3f6e11[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x3e1907[_0x51c2('0x2e')]);_0x3f6e11[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x3f6e11[_0x51c2('0x32')],_0x3f6e11[_0x51c2('0x2e')]);_0x338666['attributes']=_[_0x51c2('0x31')](_0x3f6e11[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x3e1907['query'][_0x51c2('0x33')]));_0x338666['attributes']=_0x338666[_0x51c2('0x34')]['length']?_0x338666['attributes']:_0x3f6e11[_0x51c2('0x32')];if(!_0x3e1907['query'][_0x51c2('0x35')]('nolimit')){_0x338666[_0x51c2('0x1b')]=qs['limit'](_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x338666['offset']=qs[_0x51c2('0x1a')](_0x3e1907[_0x51c2('0x2e')]['offset']);}_0x338666[_0x51c2('0x36')]=qs['sort'](_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x338666[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x3e1907[_0x51c2('0x2e')],_0x3f6e11[_0x51c2('0x30')]),_0x36b804);if(_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x3a')]){_0x338666[_0x51c2('0x38')]=_[_0x51c2('0x3b')](_0x338666[_0x51c2('0x38')],{'$or':_['map'](_0x36b804,function(_0x3f25e4){if(_0x3f25e4[_0x51c2('0x2d')]!=='VIRTUAL'){var _0x3c1338={};_0x3c1338[_0x3f25e4[_0x51c2('0x29')]]={'$like':'%'+_0x3e1907[_0x51c2('0x2e')][_0x51c2('0x3a')]+'%'};return _0x3c1338;}})});}_0x338666=_[_0x51c2('0x3b')]({},_0x338666,_0x3e1907[_0x51c2('0x3c')]);var _0x1305c5={'where':_0x338666['where']};return db[_0x51c2('0x3d')][_0x51c2('0x1d')](_0x1305c5)[_0x51c2('0x24')](function(_0xd06596){_0x5b9ccd['count']=_0xd06596;if(_0x3e1907['query']['includeAll']){_0x338666['include']=[{'all':!![]}];}return db[_0x51c2('0x3d')][_0x51c2('0x3e')](_0x338666);})[_0x51c2('0x24')](function(_0x3be559){_0x5b9ccd[_0x51c2('0x3f')]=_0x3be559;return _0x5b9ccd;})[_0x51c2('0x24')](respondWithFilteredResult(_0x100b79,_0x338666))['catch'](handleError(_0x100b79,null));};exports['show']=function(_0x3943d7,_0x55e489){var _0x320c11={'raw':![],'where':{'id':_0x3943d7['params']['id']}},_0x1c7cc1={};_0x1c7cc1['model']=_['keys'](db[_0x51c2('0x3d')][_0x51c2('0x40')]);_0x1c7cc1[_0x51c2('0x2e')]=_['keys'](_0x3943d7[_0x51c2('0x2e')]);_0x1c7cc1[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x1c7cc1['model'],_0x1c7cc1[_0x51c2('0x2e')]);_0x320c11[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x1c7cc1[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x3943d7[_0x51c2('0x2e')][_0x51c2('0x33')]));_0x320c11[_0x51c2('0x34')]=_0x320c11[_0x51c2('0x34')][_0x51c2('0x41')]?_0x320c11[_0x51c2('0x34')]:_0x1c7cc1[_0x51c2('0x32')];if(_0x3943d7['query'][_0x51c2('0x42')]){_0x320c11['include']=[{'all':!![]}];}_0x320c11=_[_0x51c2('0x3b')]({},_0x320c11,_0x3943d7[_0x51c2('0x3c')]);return db[_0x51c2('0x3d')][_0x51c2('0x43')](_0x320c11)['then'](handleEntityNotFound(_0x55e489,null))[_0x51c2('0x24')](respondWithResult(_0x55e489,null))['catch'](handleError(_0x55e489,null));};exports[_0x51c2('0x44')]=function(_0x52fb05,_0x3a4c4a){return db['Dynamics365Configuration'][_0x51c2('0x44')](_0x52fb05['body'],{})[_0x51c2('0x24')](respondWithResult(_0x3a4c4a,0xc9))[_0x51c2('0x45')](handleError(_0x3a4c4a,null));};exports['update']=function(_0x396612,_0x21d6b2){if(_0x396612['body']['id']){delete _0x396612[_0x51c2('0x46')]['id'];}return db[_0x51c2('0x3d')][_0x51c2('0x43')]({'where':{'id':_0x396612[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x21d6b2,null))[_0x51c2('0x24')](saveUpdates(_0x396612[_0x51c2('0x46')],null))[_0x51c2('0x24')](respondWithResult(_0x21d6b2,null))['catch'](handleError(_0x21d6b2,null));};exports[_0x51c2('0x25')]=function(_0xc705db,_0x1a2b0b){return db[_0x51c2('0x3d')][_0x51c2('0x43')]({'where':{'id':_0xc705db[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x1a2b0b,null))[_0x51c2('0x24')](removeEntity(_0x1a2b0b,null))['catch'](handleError(_0x1a2b0b,null));};exports['getFields']=function(_0x252c44,_0x47e914,_0x217625){var _0x300ea9={};var _0x252f88={};var _0x8efc1d;var _0x2ad2f1;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x252c44[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x47e914,null))[_0x51c2('0x24')](function(_0x22aebe){if(_0x22aebe){_0x8efc1d=_0x22aebe;_0x252f88[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db[_0x51c2('0x49')]['rawAttributes']);_0x252f88[_0x51c2('0x2e')]=_['keys'](_0x252c44['query']);_0x252f88[_0x51c2('0x30')]=_[_0x51c2('0x31')](_0x252f88[_0x51c2('0x32')],_0x252f88[_0x51c2('0x2e')]);_0x300ea9[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x252f88[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x252c44['query']['fields']));_0x300ea9[_0x51c2('0x34')]=_0x300ea9[_0x51c2('0x34')]['length']?_0x300ea9[_0x51c2('0x34')]:_0x252f88[_0x51c2('0x32')];_0x300ea9[_0x51c2('0x36')]=qs[_0x51c2('0x37')](_0x252c44['query']['sort']);_0x300ea9[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x252c44[_0x51c2('0x2e')],_0x252f88['filters']));if(_0x252c44[_0x51c2('0x2e')][_0x51c2('0x3a')]){_0x300ea9[_0x51c2('0x38')]=_[_0x51c2('0x3b')](_0x300ea9[_0x51c2('0x38')],{'$or':_[_0x51c2('0x2b')](_0x300ea9['attributes'],function(_0x47b4af){var _0x22d146={};_0x22d146[_0x47b4af]={'$like':'%'+_0x252c44[_0x51c2('0x2e')]['filter']+'%'};return _0x22d146;})});}_0x300ea9=_[_0x51c2('0x3b')]({},_0x300ea9,_0x252c44['options']);return _0x8efc1d['getFields'](_0x300ea9);}})[_0x51c2('0x24')](function(_0x3ba5b6){if(_0x3ba5b6){_0x2ad2f1=_0x3ba5b6[_0x51c2('0x41')];if(!_0x252c44['query'][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x300ea9[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x252c44['query']['limit']);_0x300ea9[_0x51c2('0x1a')]=qs[_0x51c2('0x1a')](_0x252c44[_0x51c2('0x2e')][_0x51c2('0x1a')]);}return _0x8efc1d[_0x51c2('0x4b')](_0x300ea9);}})[_0x51c2('0x24')](function(_0x8e18c2){if(_0x8e18c2){return _0x8e18c2?{'count':_0x2ad2f1,'rows':_0x8e18c2}:null;}})[_0x51c2('0x24')](respondWithResult(_0x47e914,null))['catch'](handleError(_0x47e914,null));};exports[_0x51c2('0x4c')]=function(_0x2841e9,_0x270acd,_0x1e0ef4){var _0x226641={};var _0x30433b={};var _0x106918;var _0xc2c106;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x2841e9[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x270acd,null))[_0x51c2('0x24')](function(_0x56066a){if(_0x56066a){_0x106918=_0x56066a;_0x30433b[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x30433b[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x2841e9[_0x51c2('0x2e')]);_0x30433b['filters']=_[_0x51c2('0x31')](_0x30433b['model'],_0x30433b[_0x51c2('0x2e')]);_0x226641[_0x51c2('0x34')]=_[_0x51c2('0x31')](_0x30433b['model'],qs[_0x51c2('0x33')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x33')]));_0x226641['attributes']=_0x226641[_0x51c2('0x34')][_0x51c2('0x41')]?_0x226641[_0x51c2('0x34')]:_0x30433b[_0x51c2('0x32')];_0x226641[_0x51c2('0x36')]=qs[_0x51c2('0x37')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x226641[_0x51c2('0x38')]=qs['filters'](_[_0x51c2('0x39')](_0x2841e9['query'],_0x30433b['filters']));if(_0x2841e9[_0x51c2('0x2e')]['filter']){_0x226641[_0x51c2('0x38')]=_['merge'](_0x226641[_0x51c2('0x38')],{'$or':_[_0x51c2('0x2b')](_0x226641[_0x51c2('0x34')],function(_0x5b990){var _0x44d200={};_0x44d200[_0x5b990]={'$like':'%'+_0x2841e9['query'][_0x51c2('0x3a')]+'%'};return _0x44d200;})});}_0x226641=_[_0x51c2('0x3b')]({},_0x226641,_0x2841e9[_0x51c2('0x3c')]);return _0x106918[_0x51c2('0x4c')](_0x226641);}})[_0x51c2('0x24')](function(_0x1a1a11){if(_0x1a1a11){_0xc2c106=_0x1a1a11[_0x51c2('0x41')];if(!_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x226641[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x2841e9[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x226641['offset']=qs[_0x51c2('0x1a')](_0x2841e9[_0x51c2('0x2e')]['offset']);}return _0x106918[_0x51c2('0x4c')](_0x226641);}})[_0x51c2('0x24')](function(_0x184caa){if(_0x184caa){return _0x184caa?{'count':_0xc2c106,'rows':_0x184caa}:null;}})[_0x51c2('0x24')](respondWithResult(_0x270acd,null))[_0x51c2('0x45')](handleError(_0x270acd,null));};exports[_0x51c2('0x4d')]=function(_0x243bef,_0x43db23,_0x5e7de4){var _0x5c28dc={};var _0x55f6cb={};var _0x5a65ac;var _0x2c74e1;return db[_0x51c2('0x3d')][_0x51c2('0x48')]({'where':{'id':_0x243bef[_0x51c2('0x47')]['id']}})[_0x51c2('0x24')](handleEntityNotFound(_0x43db23,null))[_0x51c2('0x24')](function(_0x404cce){if(_0x404cce){_0x5a65ac=_0x404cce;_0x55f6cb[_0x51c2('0x32')]=_[_0x51c2('0x2f')](db[_0x51c2('0x49')][_0x51c2('0x40')]);_0x55f6cb[_0x51c2('0x2e')]=_[_0x51c2('0x2f')](_0x243bef[_0x51c2('0x2e')]);_0x55f6cb[_0x51c2('0x30')]=_['intersection'](_0x55f6cb[_0x51c2('0x32')],_0x55f6cb[_0x51c2('0x2e')]);_0x5c28dc[_0x51c2('0x34')]=_['intersection'](_0x55f6cb[_0x51c2('0x32')],qs[_0x51c2('0x33')](_0x243bef['query'][_0x51c2('0x33')]));_0x5c28dc[_0x51c2('0x34')]=_0x5c28dc[_0x51c2('0x34')][_0x51c2('0x41')]?_0x5c28dc[_0x51c2('0x34')]:_0x55f6cb['model'];_0x5c28dc[_0x51c2('0x36')]=qs['sort'](_0x243bef[_0x51c2('0x2e')][_0x51c2('0x37')]);_0x5c28dc[_0x51c2('0x38')]=qs[_0x51c2('0x30')](_['pick'](_0x243bef[_0x51c2('0x2e')],_0x55f6cb[_0x51c2('0x30')]));if(_0x243bef['query']['filter']){_0x5c28dc['where']=_[_0x51c2('0x3b')](_0x5c28dc['where'],{'$or':_[_0x51c2('0x2b')](_0x5c28dc['attributes'],function(_0x317775){var _0x568731={};_0x568731[_0x317775]={'$like':'%'+_0x243bef[_0x51c2('0x2e')][_0x51c2('0x3a')]+'%'};return _0x568731;})});}_0x5c28dc=_['merge']({},_0x5c28dc,_0x243bef[_0x51c2('0x3c')]);return _0x5a65ac[_0x51c2('0x4d')](_0x5c28dc);}})['then'](function(_0x239da6){if(_0x239da6){_0x2c74e1=_0x239da6['length'];if(!_0x243bef['query'][_0x51c2('0x35')](_0x51c2('0x4a'))){_0x5c28dc[_0x51c2('0x1b')]=qs[_0x51c2('0x1b')](_0x243bef[_0x51c2('0x2e')][_0x51c2('0x1b')]);_0x5c28dc[_0x51c2('0x1a')]=qs[_0x51c2('0x1a')](_0x243bef['query'][_0x51c2('0x1a')]);}return _0x5a65ac['getDescriptions'](_0x5c28dc);}})[_0x51c2('0x24')](function(_0x10725b){if(_0x10725b){return _0x10725b?{'count':_0x2c74e1,'rows':_0x10725b}:null;}})[_0x51c2('0x24')](respondWithResult(_0x43db23,null))[_0x51c2('0x45')](handleError(_0x43db23,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5642747..a7910c1 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x57f073,_0x321c88){var _0x22fe4b=function(_0xa7645a){while(--_0xa7645a){_0x57f073['push'](_0x57f073['shift']());}};_0x22fe4b(++_0x321c88);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x524357,_0x5e279b){var _0x6cbdd7=function(_0x232947){while(--_0x232947){_0x524357['push'](_0x524357['shift']());}};_0x6cbdd7(++_0x5e279b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xb4e6[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f19c0ca..6fd4f9c 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 _0xda09=['request','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xda09,0x1ae));var _0x9da0=function(_0x559c88,_0x20f0e7){_0x559c88=_0x559c88-0x0;var _0x9d0e45=_0xda09[_0x559c88];return _0x9d0e45;};'use strict';var _=require(_0x9da0('0x0'));var util=require('util');var moment=require(_0x9da0('0x1'));var BPromise=require(_0x9da0('0x2'));var rs=require(_0x9da0('0x3'));var fs=require('fs');var Redis=require(_0x9da0('0x4'));var db=require(_0x9da0('0x5'))['db'];var utils=require(_0x9da0('0x6'));var logger=require(_0x9da0('0x7'))('rpc');var config=require(_0x9da0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9da0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536b08,_0x2c819d,_0x2dffaa){return new BPromise(function(_0x3dbb01,_0x38ee47){return client[_0x9da0('0xa')](_0x536b08,_0x2dffaa)[_0x9da0('0xb')](function(_0x1db923){logger['info'](_0x9da0('0xc'),_0x2c819d,'request\x20sent');logger['debug'](_0x9da0('0xd'),_0x2c819d,_0x9da0('0xe'),JSON['stringify'](_0x1db923));if(_0x1db923['error']){if(_0x1db923[_0x9da0('0xf')][_0x9da0('0x10')]===0x1f4){logger['error'](_0x9da0('0xc'),_0x2c819d,_0x1db923['error'][_0x9da0('0x11')]);return _0x38ee47(_0x1db923['error']['message']);}logger['error'](_0x9da0('0xc'),_0x2c819d,_0x1db923[_0x9da0('0xf')][_0x9da0('0x11')]);return _0x3dbb01(_0x1db923['error'][_0x9da0('0x11')]);}else{logger[_0x9da0('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2c819d,_0x9da0('0xe'));_0x3dbb01(_0x1db923[_0x9da0('0x13')]['message']);}})['catch'](function(_0x2945f9){logger['error'](_0x9da0('0xc'),_0x2c819d,_0x2945f9);_0x38ee47(_0x2945f9);});});} \ No newline at end of file +var _0x03d3=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x5f3f60,_0x5623b3){var _0x3f0e96=function(_0x2cd826){while(--_0x2cd826){_0x5f3f60['push'](_0x5f3f60['shift']());}};_0x3f0e96(++_0x5623b3);}(_0x03d3,0x75));var _0x303d=function(_0x5a0677,_0x387ee5){_0x5a0677=_0x5a0677-0x0;var _0x2dad4d=_0x03d3[_0x5a0677];return _0x2dad4d;};'use strict';var _=require(_0x303d('0x0'));var util=require(_0x303d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x303d('0x2'));var fs=require('fs');var Redis=require(_0x303d('0x3'));var db=require(_0x303d('0x4'))['db'];var utils=require(_0x303d('0x5'));var logger=require(_0x303d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x303d('0x7'));var client=jayson[_0x303d('0x8')][_0x303d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43cf37,_0x230785,_0x3c2f91){return new BPromise(function(_0x174858,_0x5312ce){return client[_0x303d('0xa')](_0x43cf37,_0x3c2f91)[_0x303d('0xb')](function(_0x51efb7){logger[_0x303d('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x303d('0xd'));logger[_0x303d('0xe')](_0x303d('0xf'),_0x230785,_0x303d('0xd'),JSON[_0x303d('0x10')](_0x51efb7));if(_0x51efb7[_0x303d('0x11')]){if(_0x51efb7[_0x303d('0x11')]['code']===0x1f4){logger[_0x303d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x51efb7[_0x303d('0x11')][_0x303d('0x12')]);return _0x5312ce(_0x51efb7['error'][_0x303d('0x12')]);}logger[_0x303d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x230785,_0x51efb7['error'][_0x303d('0x12')]);return _0x174858(_0x51efb7[_0x303d('0x11')][_0x303d('0x12')]);}else{logger[_0x303d('0xc')](_0x303d('0x13'),_0x230785,_0x303d('0xd'));_0x174858(_0x51efb7[_0x303d('0x14')][_0x303d('0x12')]);}})[_0x303d('0x15')](function(_0x432c5a){logger[_0x303d('0x11')](_0x303d('0x13'),_0x230785,_0x432c5a);_0x5312ce(_0x432c5a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b635048..dbe471a 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 _0xcbc6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy'];(function(_0x4eb4f3,_0x50a5d4){var _0x5ef9db=function(_0x12ee6f){while(--_0x12ee6f){_0x4eb4f3['push'](_0x4eb4f3['shift']());}};_0x5ef9db(++_0x50a5d4);}(_0xcbc6,0xfd));var _0x6cbc=function(_0x3edad9,_0x3f80f6){_0x3edad9=_0x3edad9-0x0;var _0x4d6271=_0xcbc6[_0x3edad9];return _0x4d6271;};'use strict';var multer=require(_0x6cbc('0x0'));var util=require(_0x6cbc('0x1'));var path=require(_0x6cbc('0x2'));var timeout=require(_0x6cbc('0x3'));var express=require(_0x6cbc('0x4'));var router=express[_0x6cbc('0x5')]();var fs_extra=require(_0x6cbc('0x6'));var auth=require(_0x6cbc('0x7'));var interaction=require(_0x6cbc('0x8'));var config=require(_0x6cbc('0x9'));var controller=require(_0x6cbc('0xa'));router[_0x6cbc('0xb')]('/',auth[_0x6cbc('0xc')](),controller[_0x6cbc('0xd')]);router[_0x6cbc('0xb')]('/:id',auth[_0x6cbc('0xc')](),controller[_0x6cbc('0xe')]);router[_0x6cbc('0xf')]('/',auth[_0x6cbc('0xc')](),controller['create']);router[_0x6cbc('0x10')](_0x6cbc('0x11'),auth[_0x6cbc('0xc')](),controller['update']);router[_0x6cbc('0x12')](_0x6cbc('0x11'),auth['isAuthenticated'](),controller[_0x6cbc('0x13')]);module[_0x6cbc('0x14')]=router; \ No newline at end of file +var _0x092f=['express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x092f,0x131));var _0xf092=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x092f[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var path=require(_0xf092('0x2'));var timeout=require('connect-timeout');var express=require(_0xf092('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf092('0x4'));var interaction=require(_0xf092('0x5'));var config=require('../../config/environment');var controller=require(_0xf092('0x6'));router[_0xf092('0x7')]('/',auth[_0xf092('0x8')](),controller[_0xf092('0x9')]);router[_0xf092('0x7')](_0xf092('0xa'),auth[_0xf092('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf092('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf092('0xc')](_0xf092('0xa'),auth[_0xf092('0x8')](),controller[_0xf092('0xd')]);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 6d45926..83e8b0c 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 _0x0ac8=['sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x0ac8,0x102));var _0x80ac=function(_0x2287df,_0x5a4a24){_0x2287df=_0x2287df-0x0;var _0x2afbc1=_0x0ac8[_0x2287df];return _0x2afbc1;};'use strict';var Sequelize=require(_0x80ac('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x80ac('0x1'),_0x80ac('0x2'),_0x80ac('0x3'),_0x80ac('0x4'),'picklist'),'defaultValue':_0x80ac('0x1')},'content':{'type':Sequelize[_0x80ac('0x5')]},'key':{'type':Sequelize[_0x80ac('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x80ac('0x2'),_0x80ac('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x80ac('0x5')]},'nameField':{'type':Sequelize[_0x80ac('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x80ac('0x5')]}}; \ No newline at end of file +var _0x792a=['variable','customVariable','keyValue','STRING','BOOLEAN','ENUM','string'];(function(_0x54eec5,_0x436b7c){var _0x28f2b7=function(_0x2f2790){while(--_0x2f2790){_0x54eec5['push'](_0x54eec5['shift']());}};_0x28f2b7(++_0x436b7c);}(_0x792a,0xd0));var _0xa792=function(_0x3afa45,_0x35499b){_0x3afa45=_0x3afa45-0x0;var _0x236db5=_0x792a[_0x3afa45];return _0x236db5;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa792('0x0')](_0xa792('0x1'),_0xa792('0x2'),_0xa792('0x3'),_0xa792('0x4'),'picklist'),'defaultValue':_0xa792('0x1')},'content':{'type':Sequelize[_0xa792('0x5')]},'key':{'type':Sequelize[_0xa792('0x5')]},'keyType':{'type':Sequelize[_0xa792('0x0')](_0xa792('0x1'),_0xa792('0x2'),_0xa792('0x3'))},'keyContent':{'type':Sequelize[_0xa792('0x5')]},'idField':{'type':Sequelize[_0xa792('0x5')]},'nameField':{'type':Sequelize[_0xa792('0x5')]},'customField':{'type':Sequelize[_0xa792('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa792('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b231c58..274974c 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 _0x494f=['params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','Dynamics365Field','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','map','VIRTUAL','options','include','catch'];(function(_0x27f88b,_0x526bad){var _0x2114f4=function(_0x341508){while(--_0x341508){_0x27f88b['push'](_0x27f88b['shift']());}};_0x2114f4(++_0x526bad);}(_0x494f,0x1e9));var _0xf494=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x494f[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0xf494('0x0'));var rimraf=require(_0xf494('0x1'));var zipdir=require(_0xf494('0x2'));var jsonpatch=require(_0xf494('0x3'));var rp=require('request-promise');var moment=require(_0xf494('0x4'));var BPromise=require(_0xf494('0x5'));var Mustache=require('mustache');var util=require(_0xf494('0x6'));var path=require(_0xf494('0x7'));var sox=require('sox');var csv=require(_0xf494('0x8'));var ejs=require(_0xf494('0x9'));var fs=require('fs');var fs_extra=require(_0xf494('0xa'));var _=require(_0xf494('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf494('0xc'));var toCsv=require(_0xf494('0x8'));var querystring=require(_0xf494('0xd'));var Papa=require(_0xf494('0xe'));var Redis=require(_0xf494('0xf'));var authService=require(_0xf494('0x10'));var qs=require(_0xf494('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf494('0x12'));var logger=require(_0xf494('0x13'))(_0xf494('0x14'));var utils=require(_0xf494('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf494('0x16'));var db=require(_0xf494('0x17'))['db'];function respondWithStatusCode(_0x56b29a,_0x4b18bf){_0x4b18bf=_0x4b18bf||0xcc;return function(_0x36e4e6){if(_0x36e4e6){return _0x56b29a['sendStatus'](_0x4b18bf);}return _0x56b29a['status'](_0x4b18bf)[_0xf494('0x18')]();};}function respondWithResult(_0xbca0af,_0x83fbd4){_0x83fbd4=_0x83fbd4||0xc8;return function(_0x2e33cf){if(_0x2e33cf){return _0xbca0af[_0xf494('0x19')](_0x83fbd4)[_0xf494('0x1a')](_0x2e33cf);}};}function respondWithFilteredResult(_0x54edb4,_0x7e477a){return function(_0x16b271){if(_0x16b271){var _0x45af81=typeof _0x7e477a[_0xf494('0x1b')]==='undefined'&&typeof _0x7e477a['limit']===_0xf494('0x1c');var _0x47c068=_0x16b271[_0xf494('0x1d')];var _0x34ae03=_0x45af81?0x0:_0x7e477a[_0xf494('0x1b')];var _0x166c8b=_0x45af81?_0x16b271[_0xf494('0x1d')]:_0x7e477a['offset']+_0x7e477a[_0xf494('0x1e')];var _0x484724;if(_0x166c8b>=_0x47c068){_0x166c8b=_0x47c068;_0x484724=0xc8;}else{_0x484724=0xce;}_0x54edb4['status'](_0x484724);return _0x54edb4[_0xf494('0x1f')](_0xf494('0x20'),_0x34ae03+'-'+_0x166c8b+'/'+_0x47c068)[_0xf494('0x1a')](_0x16b271);}return null;};}function patchUpdates(_0x1afccf){return function(_0x21ec27){try{jsonpatch[_0xf494('0x21')](_0x21ec27,_0x1afccf,!![]);}catch(_0x3d5e9b){return BPromise[_0xf494('0x22')](_0x3d5e9b);}return _0x21ec27[_0xf494('0x23')]();};}function saveUpdates(_0x2d5160,_0x5edd6a){return function(_0x484ded){if(_0x484ded){return _0x484ded[_0xf494('0x24')](_0x2d5160)['then'](function(_0x4e67a0){return _0x4e67a0;});}return null;};}function removeEntity(_0x3e268d,_0x30c16b){return function(_0x2884d0){if(_0x2884d0){return _0x2884d0[_0xf494('0x25')]()[_0xf494('0x26')](function(){_0x3e268d[_0xf494('0x19')](0xcc)[_0xf494('0x18')]();});}};}function handleEntityNotFound(_0x2eec00,_0x279cc7){return function(_0x5b92d6){if(!_0x5b92d6){_0x2eec00[_0xf494('0x27')](0x194);}return _0x5b92d6;};}function handleError(_0x1e590f,_0xae06f2){_0xae06f2=_0xae06f2||0x1f4;return function(_0x4c5659){logger['error'](_0x4c5659['stack']);if(_0x4c5659[_0xf494('0x28')]){delete _0x4c5659['name'];}_0x1e590f['status'](_0xae06f2)[_0xf494('0x29')](_0x4c5659);};}exports['index']=function(_0x2d39e6,_0x5039fe){var _0x26ba8c={},_0x58d326={},_0x40840b={'count':0x0,'rows':[]};var _0x5a802b=_['map'](db[_0xf494('0x2a')][_0xf494('0x2b')],function(_0x943d05){return{'name':_0x943d05[_0xf494('0x2c')],'type':_0x943d05[_0xf494('0x2d')]['key']};});_0x58d326[_0xf494('0x2e')]=_['map'](_0x5a802b,'name');_0x58d326[_0xf494('0x2f')]=_['keys'](_0x2d39e6[_0xf494('0x2f')]);_0x58d326[_0xf494('0x30')]=_[_0xf494('0x31')](_0x58d326[_0xf494('0x2e')],_0x58d326[_0xf494('0x2f')]);_0x26ba8c[_0xf494('0x32')]=_['intersection'](_0x58d326[_0xf494('0x2e')],qs['fields'](_0x2d39e6[_0xf494('0x2f')][_0xf494('0x33')]));_0x26ba8c[_0xf494('0x32')]=_0x26ba8c[_0xf494('0x32')][_0xf494('0x34')]?_0x26ba8c[_0xf494('0x32')]:_0x58d326[_0xf494('0x2e')];if(!_0x2d39e6[_0xf494('0x2f')]['hasOwnProperty']('nolimit')){_0x26ba8c[_0xf494('0x1e')]=qs[_0xf494('0x1e')](_0x2d39e6[_0xf494('0x2f')][_0xf494('0x1e')]);_0x26ba8c[_0xf494('0x1b')]=qs['offset'](_0x2d39e6['query'][_0xf494('0x1b')]);}_0x26ba8c[_0xf494('0x35')]=qs[_0xf494('0x36')](_0x2d39e6['query']['sort']);_0x26ba8c[_0xf494('0x37')]=qs[_0xf494('0x30')](_['pick'](_0x2d39e6[_0xf494('0x2f')],_0x58d326[_0xf494('0x30')]),_0x5a802b);if(_0x2d39e6[_0xf494('0x2f')][_0xf494('0x38')]){_0x26ba8c[_0xf494('0x37')]=_[_0xf494('0x39')](_0x26ba8c['where'],{'$or':_[_0xf494('0x3a')](_0x5a802b,function(_0x4b0a04){if(_0x4b0a04[_0xf494('0x2d')]!==_0xf494('0x3b')){var _0x5df828={};_0x5df828[_0x4b0a04[_0xf494('0x28')]]={'$like':'%'+_0x2d39e6[_0xf494('0x2f')][_0xf494('0x38')]+'%'};return _0x5df828;}})});}_0x26ba8c=_[_0xf494('0x39')]({},_0x26ba8c,_0x2d39e6[_0xf494('0x3c')]);var _0x42871c={'where':_0x26ba8c[_0xf494('0x37')]};return db[_0xf494('0x2a')]['count'](_0x42871c)['then'](function(_0x78e385){_0x40840b[_0xf494('0x1d')]=_0x78e385;if(_0x2d39e6[_0xf494('0x2f')]['includeAll']){_0x26ba8c[_0xf494('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x26ba8c);})[_0xf494('0x26')](function(_0x4ac0eb){_0x40840b['rows']=_0x4ac0eb;return _0x40840b;})['then'](respondWithFilteredResult(_0x5039fe,_0x26ba8c))[_0xf494('0x3e')](handleError(_0x5039fe,null));};exports['show']=function(_0x5755c5,_0x146c4c){var _0x162831={'raw':!![],'where':{'id':_0x5755c5[_0xf494('0x3f')]['id']}},_0x21c9b7={};_0x21c9b7['model']=_['keys'](db[_0xf494('0x2a')][_0xf494('0x2b')]);_0x21c9b7['query']=_[_0xf494('0x40')](_0x5755c5['query']);_0x21c9b7[_0xf494('0x30')]=_[_0xf494('0x31')](_0x21c9b7[_0xf494('0x2e')],_0x21c9b7[_0xf494('0x2f')]);_0x162831[_0xf494('0x32')]=_[_0xf494('0x31')](_0x21c9b7[_0xf494('0x2e')],qs['fields'](_0x5755c5[_0xf494('0x2f')][_0xf494('0x33')]));_0x162831[_0xf494('0x32')]=_0x162831[_0xf494('0x32')]['length']?_0x162831['attributes']:_0x21c9b7[_0xf494('0x2e')];if(_0x5755c5[_0xf494('0x2f')][_0xf494('0x41')]){_0x162831[_0xf494('0x3d')]=[{'all':!![]}];}_0x162831=_['merge']({},_0x162831,_0x5755c5[_0xf494('0x3c')]);return db['Dynamics365Field'][_0xf494('0x42')](_0x162831)['then'](handleEntityNotFound(_0x146c4c,null))['then'](respondWithResult(_0x146c4c,null))['catch'](handleError(_0x146c4c,null));};exports[_0xf494('0x43')]=function(_0x4bdbc0,_0x3a0887){return db[_0xf494('0x2a')][_0xf494('0x43')](_0x4bdbc0[_0xf494('0x44')],{})[_0xf494('0x26')](respondWithResult(_0x3a0887,0xc9))[_0xf494('0x3e')](handleError(_0x3a0887,null));};exports[_0xf494('0x24')]=function(_0x1774b4,_0x319a2c){if(_0x1774b4[_0xf494('0x44')]['id']){delete _0x1774b4[_0xf494('0x44')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x1774b4[_0xf494('0x3f')]['id']}})[_0xf494('0x26')](handleEntityNotFound(_0x319a2c,null))[_0xf494('0x26')](saveUpdates(_0x1774b4[_0xf494('0x44')],null))['then'](respondWithResult(_0x319a2c,null))[_0xf494('0x3e')](handleError(_0x319a2c,null));};exports['destroy']=function(_0x486167,_0x5379ed){return db[_0xf494('0x2a')][_0xf494('0x42')]({'where':{'id':_0x486167[_0xf494('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5379ed,null))[_0xf494('0x26')](removeEntity(_0x5379ed,null))[_0xf494('0x3e')](handleError(_0x5379ed,null));}; \ No newline at end of file +var _0x76bb=['set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x133a58,_0x2881b5){var _0x3af81b=function(_0x551ccc){while(--_0x551ccc){_0x133a58['push'](_0x133a58['shift']());}};_0x3af81b(++_0x2881b5);}(_0x76bb,0x1d9));var _0xb76b=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x76bb[_0x580b15];return _0x1adb1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb76b('0x0'));var zipdir=require(_0xb76b('0x1'));var jsonpatch=require(_0xb76b('0x2'));var rp=require(_0xb76b('0x3'));var moment=require('moment');var BPromise=require(_0xb76b('0x4'));var Mustache=require('mustache');var util=require(_0xb76b('0x5'));var path=require(_0xb76b('0x6'));var sox=require('sox');var csv=require(_0xb76b('0x7'));var ejs=require(_0xb76b('0x8'));var fs=require('fs');var fs_extra=require(_0xb76b('0x9'));var _=require(_0xb76b('0xa'));var squel=require(_0xb76b('0xb'));var crypto=require(_0xb76b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb76b('0xd'));var Papa=require(_0xb76b('0xe'));var Redis=require(_0xb76b('0xf'));var authService=require(_0xb76b('0x10'));var qs=require(_0xb76b('0x11'));var as=require(_0xb76b('0x12'));var hardwareService=require(_0xb76b('0x13'));var logger=require(_0xb76b('0x14'))('api');var utils=require(_0xb76b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb76b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de7de,_0x2a84c3){_0x2a84c3=_0x2a84c3||0xcc;return function(_0x5b577f){if(_0x5b577f){return _0x4de7de[_0xb76b('0x17')](_0x2a84c3);}return _0x4de7de[_0xb76b('0x18')](_0x2a84c3)[_0xb76b('0x19')]();};}function respondWithResult(_0x351b17,_0xa12561){_0xa12561=_0xa12561||0xc8;return function(_0x5dcf68){if(_0x5dcf68){return _0x351b17[_0xb76b('0x18')](_0xa12561)[_0xb76b('0x1a')](_0x5dcf68);}};}function respondWithFilteredResult(_0x4a91e8,_0x58406e){return function(_0x2a660e){if(_0x2a660e){var _0x347d50=typeof _0x58406e[_0xb76b('0x1b')]===_0xb76b('0x1c')&&typeof _0x58406e[_0xb76b('0x1d')]==='undefined';var _0x255b71=_0x2a660e[_0xb76b('0x1e')];var _0x4f6e05=_0x347d50?0x0:_0x58406e[_0xb76b('0x1b')];var _0x35380d=_0x347d50?_0x2a660e[_0xb76b('0x1e')]:_0x58406e['offset']+_0x58406e['limit'];var _0x1f95d4;if(_0x35380d>=_0x255b71){_0x35380d=_0x255b71;_0x1f95d4=0xc8;}else{_0x1f95d4=0xce;}_0x4a91e8[_0xb76b('0x18')](_0x1f95d4);return _0x4a91e8[_0xb76b('0x1f')](_0xb76b('0x20'),_0x4f6e05+'-'+_0x35380d+'/'+_0x255b71)[_0xb76b('0x1a')](_0x2a660e);}return null;};}function patchUpdates(_0x3349f8){return function(_0x4def43){try{jsonpatch[_0xb76b('0x21')](_0x4def43,_0x3349f8,!![]);}catch(_0x3bb259){return BPromise[_0xb76b('0x22')](_0x3bb259);}return _0x4def43['save']();};}function saveUpdates(_0x3c9ec1,_0x5d7795){return function(_0x284492){if(_0x284492){return _0x284492[_0xb76b('0x23')](_0x3c9ec1)['then'](function(_0x1f7e57){return _0x1f7e57;});}return null;};}function removeEntity(_0x346056,_0x3ae9e9){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b['destroy']()[_0xb76b('0x24')](function(){_0x346056[_0xb76b('0x18')](0xcc)[_0xb76b('0x19')]();});}};}function handleEntityNotFound(_0x4afd66,_0x11bcaf){return function(_0x20840f){if(!_0x20840f){_0x4afd66[_0xb76b('0x17')](0x194);}return _0x20840f;};}function handleError(_0x234c02,_0x40f2a1){_0x40f2a1=_0x40f2a1||0x1f4;return function(_0x2620e4){logger[_0xb76b('0x25')](_0x2620e4[_0xb76b('0x26')]);if(_0x2620e4[_0xb76b('0x27')]){delete _0x2620e4[_0xb76b('0x27')];}_0x234c02[_0xb76b('0x18')](_0x40f2a1)[_0xb76b('0x28')](_0x2620e4);};}exports[_0xb76b('0x29')]=function(_0x5cd37a,_0x5c233d){var _0xca5e0={},_0x3019fc={},_0xde625={'count':0x0,'rows':[]};var _0x4f9e05=_[_0xb76b('0x2a')](db[_0xb76b('0x2b')][_0xb76b('0x2c')],function(_0x5dc77c){return{'name':_0x5dc77c['fieldName'],'type':_0x5dc77c[_0xb76b('0x2d')][_0xb76b('0x2e')]};});_0x3019fc[_0xb76b('0x2f')]=_[_0xb76b('0x2a')](_0x4f9e05,_0xb76b('0x27'));_0x3019fc[_0xb76b('0x30')]=_[_0xb76b('0x31')](_0x5cd37a[_0xb76b('0x30')]);_0x3019fc[_0xb76b('0x32')]=_[_0xb76b('0x33')](_0x3019fc[_0xb76b('0x2f')],_0x3019fc[_0xb76b('0x30')]);_0xca5e0[_0xb76b('0x34')]=_[_0xb76b('0x33')](_0x3019fc[_0xb76b('0x2f')],qs[_0xb76b('0x35')](_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x35')]));_0xca5e0[_0xb76b('0x34')]=_0xca5e0[_0xb76b('0x34')][_0xb76b('0x36')]?_0xca5e0['attributes']:_0x3019fc[_0xb76b('0x2f')];if(!_0x5cd37a[_0xb76b('0x30')]['hasOwnProperty'](_0xb76b('0x37'))){_0xca5e0[_0xb76b('0x1d')]=qs[_0xb76b('0x1d')](_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x1d')]);_0xca5e0['offset']=qs['offset'](_0x5cd37a['query'][_0xb76b('0x1b')]);}_0xca5e0[_0xb76b('0x38')]=qs[_0xb76b('0x39')](_0x5cd37a['query'][_0xb76b('0x39')]);_0xca5e0['where']=qs[_0xb76b('0x32')](_['pick'](_0x5cd37a[_0xb76b('0x30')],_0x3019fc['filters']),_0x4f9e05);if(_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x3a')]){_0xca5e0[_0xb76b('0x3b')]=_['merge'](_0xca5e0[_0xb76b('0x3b')],{'$or':_['map'](_0x4f9e05,function(_0x53ebaa){if(_0x53ebaa[_0xb76b('0x2d')]!==_0xb76b('0x3c')){var _0x2c59f3={};_0x2c59f3[_0x53ebaa[_0xb76b('0x27')]]={'$like':'%'+_0x5cd37a[_0xb76b('0x30')][_0xb76b('0x3a')]+'%'};return _0x2c59f3;}})});}_0xca5e0=_[_0xb76b('0x3d')]({},_0xca5e0,_0x5cd37a[_0xb76b('0x3e')]);var _0x149f0b={'where':_0xca5e0[_0xb76b('0x3b')]};return db[_0xb76b('0x2b')][_0xb76b('0x1e')](_0x149f0b)[_0xb76b('0x24')](function(_0x3aa834){_0xde625[_0xb76b('0x1e')]=_0x3aa834;if(_0x5cd37a['query'][_0xb76b('0x3f')]){_0xca5e0['include']=[{'all':!![]}];}return db[_0xb76b('0x2b')][_0xb76b('0x40')](_0xca5e0);})[_0xb76b('0x24')](function(_0x59a31d){_0xde625[_0xb76b('0x41')]=_0x59a31d;return _0xde625;})[_0xb76b('0x24')](respondWithFilteredResult(_0x5c233d,_0xca5e0))[_0xb76b('0x42')](handleError(_0x5c233d,null));};exports[_0xb76b('0x43')]=function(_0x30b532,_0x2b9758){var _0x43f5d1={'raw':!![],'where':{'id':_0x30b532[_0xb76b('0x44')]['id']}},_0x13065d={};_0x13065d[_0xb76b('0x2f')]=_[_0xb76b('0x31')](db['Dynamics365Field'][_0xb76b('0x2c')]);_0x13065d[_0xb76b('0x30')]=_[_0xb76b('0x31')](_0x30b532[_0xb76b('0x30')]);_0x13065d['filters']=_[_0xb76b('0x33')](_0x13065d[_0xb76b('0x2f')],_0x13065d[_0xb76b('0x30')]);_0x43f5d1[_0xb76b('0x34')]=_['intersection'](_0x13065d[_0xb76b('0x2f')],qs[_0xb76b('0x35')](_0x30b532[_0xb76b('0x30')][_0xb76b('0x35')]));_0x43f5d1[_0xb76b('0x34')]=_0x43f5d1[_0xb76b('0x34')][_0xb76b('0x36')]?_0x43f5d1['attributes']:_0x13065d[_0xb76b('0x2f')];if(_0x30b532[_0xb76b('0x30')][_0xb76b('0x3f')]){_0x43f5d1['include']=[{'all':!![]}];}_0x43f5d1=_['merge']({},_0x43f5d1,_0x30b532['options']);return db[_0xb76b('0x2b')][_0xb76b('0x45')](_0x43f5d1)[_0xb76b('0x24')](handleEntityNotFound(_0x2b9758,null))[_0xb76b('0x24')](respondWithResult(_0x2b9758,null))[_0xb76b('0x42')](handleError(_0x2b9758,null));};exports['create']=function(_0x355e14,_0x5091ad){return db[_0xb76b('0x2b')][_0xb76b('0x46')](_0x355e14[_0xb76b('0x47')],{})[_0xb76b('0x24')](respondWithResult(_0x5091ad,0xc9))[_0xb76b('0x42')](handleError(_0x5091ad,null));};exports['update']=function(_0x383b82,_0xc95c9){if(_0x383b82['body']['id']){delete _0x383b82[_0xb76b('0x47')]['id'];}return db[_0xb76b('0x2b')][_0xb76b('0x45')]({'where':{'id':_0x383b82[_0xb76b('0x44')]['id']}})[_0xb76b('0x24')](handleEntityNotFound(_0xc95c9,null))[_0xb76b('0x24')](saveUpdates(_0x383b82[_0xb76b('0x47')],null))[_0xb76b('0x24')](respondWithResult(_0xc95c9,null))[_0xb76b('0x42')](handleError(_0xc95c9,null));};exports['destroy']=function(_0x222d0c,_0x4a00fd){return db['Dynamics365Field'][_0xb76b('0x45')]({'where':{'id':_0x222d0c[_0xb76b('0x44')]['id']}})[_0xb76b('0x24')](handleEntityNotFound(_0x4a00fd,null))[_0xb76b('0x24')](removeEntity(_0x4a00fd,null))[_0xb76b('0x42')](handleError(_0x4a00fd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index cd5fc89..dcddde0 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 _0x9d87=['../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xe7da7,_0x59b192){var _0x59fd82=function(_0xefee09){while(--_0xefee09){_0xe7da7['push'](_0xe7da7['shift']());}};_0x59fd82(++_0x59b192);}(_0x9d87,0xe4));var _0x79d8=function(_0x50fd86,_0x9a41fc){_0x50fd86=_0x50fd86-0x0;var _0x1ba79b=_0x9d87[_0x50fd86];return _0x1ba79b;};'use strict';var _=require(_0x79d8('0x0'));var util=require(_0x79d8('0x1'));var logger=require(_0x79d8('0x2'))(_0x79d8('0x3'));var moment=require('moment');var BPromise=require(_0x79d8('0x4'));var rp=require(_0x79d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x79d8('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x79d8('0x7')]=function(_0x10175d,_0x971559){return _0x10175d[_0x79d8('0x8')]('Dynamics365Field',attributes,{'tableName':_0x79d8('0x9'),'paranoid':![],'indexes':[{'name':_0x79d8('0xa'),'fields':[_0x79d8('0xb'),_0x79d8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x810b=['moment','bluebird','request-promise','path','rimraf','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4ac036,_0x10b4d5){var _0x271653=function(_0x573a06){while(--_0x573a06){_0x4ac036['push'](_0x4ac036['shift']());}};_0x271653(++_0x10b4d5);}(_0x810b,0x128));var _0xb810=function(_0xaa16c4,_0x1e6242){_0xaa16c4=_0xaa16c4-0x0;var _0x552433=_0x810b[_0xaa16c4];return _0x552433;};'use strict';var _=require(_0xb810('0x0'));var util=require(_0xb810('0x1'));var logger=require(_0xb810('0x2'))(_0xb810('0x3'));var moment=require(_0xb810('0x4'));var BPromise=require(_0xb810('0x5'));var rp=require(_0xb810('0x6'));var fs=require('fs');var path=require(_0xb810('0x7'));var rimraf=require(_0xb810('0x8'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xb810('0x9')]=function(_0x495c92,_0x28c830){return _0x495c92[_0xb810('0xa')](_0xb810('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb810('0xc'),'fields':[_0xb810('0xd'),_0xb810('0xe')],'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 52a8a7c..5ae9788 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 _0xfbfe=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x4cdac9,_0x24159d){var _0x27db33=function(_0xccc98){while(--_0xccc98){_0x4cdac9['push'](_0x4cdac9['shift']());}};_0x27db33(++_0x24159d);}(_0xfbfe,0x101));var _0xefbf=function(_0x1e4eab,_0x44bc95){_0x1e4eab=_0x1e4eab-0x0;var _0x3c5015=_0xfbfe[_0x1e4eab];return _0x3c5015;};'use strict';var _=require(_0xefbf('0x0'));var util=require(_0xefbf('0x1'));var moment=require('moment');var BPromise=require(_0xefbf('0x2'));var rs=require(_0xefbf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefbf('0x4'))['db'];var utils=require(_0xefbf('0x5'));var logger=require(_0xefbf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xefbf('0x7'));var client=jayson['client'][_0xefbf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac434,_0x3719ef,_0x22eada){return new BPromise(function(_0x165565,_0xc6ccb1){return client[_0xefbf('0x9')](_0x2ac434,_0x22eada)['then'](function(_0x4464a1){logger[_0xefbf('0xa')](_0xefbf('0xb'),_0x3719ef,_0xefbf('0xc'));logger[_0xefbf('0xd')](_0xefbf('0xe'),_0x3719ef,_0xefbf('0xc'),JSON['stringify'](_0x4464a1));if(_0x4464a1[_0xefbf('0xf')]){if(_0x4464a1[_0xefbf('0xf')][_0xefbf('0x10')]===0x1f4){logger[_0xefbf('0xf')](_0xefbf('0xb'),_0x3719ef,_0x4464a1['error'][_0xefbf('0x11')]);return _0xc6ccb1(_0x4464a1[_0xefbf('0xf')][_0xefbf('0x11')]);}logger[_0xefbf('0xf')](_0xefbf('0xb'),_0x3719ef,_0x4464a1[_0xefbf('0xf')][_0xefbf('0x11')]);return _0x165565(_0x4464a1[_0xefbf('0xf')][_0xefbf('0x11')]);}else{logger[_0xefbf('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x3719ef,_0xefbf('0xc'));_0x165565(_0x4464a1[_0xefbf('0x12')][_0xefbf('0x11')]);}})[_0xefbf('0x13')](function(_0x3b4e71){logger[_0xefbf('0xf')](_0xefbf('0xb'),_0x3719ef,_0x3b4e71);_0xc6ccb1(_0x3b4e71);});});} \ No newline at end of file +var _0xb08e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xb08e,0x107));var _0xeb08=function(_0x439e69,_0x15658e){_0x439e69=_0x439e69-0x0;var _0x5e2da4=_0xb08e[_0x439e69];return _0x5e2da4;};'use strict';var _=require(_0xeb08('0x0'));var util=require(_0xeb08('0x1'));var moment=require(_0xeb08('0x2'));var BPromise=require(_0xeb08('0x3'));var rs=require(_0xeb08('0x4'));var fs=require('fs');var Redis=require(_0xeb08('0x5'));var db=require(_0xeb08('0x6'))['db'];var utils=require(_0xeb08('0x7'));var logger=require('../../config/logger')(_0xeb08('0x8'));var config=require(_0xeb08('0x9'));var jayson=require(_0xeb08('0xa'));var client=jayson[_0xeb08('0xb')][_0xeb08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4836bf,_0x1f95e7,_0x45479d){return new BPromise(function(_0x365a0a,_0x2f1372){return client['request'](_0x4836bf,_0x45479d)[_0xeb08('0xd')](function(_0x30483a){logger[_0xeb08('0xe')](_0xeb08('0xf'),_0x1f95e7,_0xeb08('0x10'));logger[_0xeb08('0x11')](_0xeb08('0x12'),_0x1f95e7,_0xeb08('0x10'),JSON[_0xeb08('0x13')](_0x30483a));if(_0x30483a[_0xeb08('0x14')]){if(_0x30483a[_0xeb08('0x14')][_0xeb08('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1f95e7,_0x30483a[_0xeb08('0x14')][_0xeb08('0x16')]);return _0x2f1372(_0x30483a[_0xeb08('0x14')][_0xeb08('0x16')]);}logger[_0xeb08('0x14')](_0xeb08('0xf'),_0x1f95e7,_0x30483a['error'][_0xeb08('0x16')]);return _0x365a0a(_0x30483a['error']['message']);}else{logger[_0xeb08('0xe')](_0xeb08('0xf'),_0x1f95e7,_0xeb08('0x10'));_0x365a0a(_0x30483a['result'][_0xeb08('0x16')]);}})[_0xeb08('0x17')](function(_0x5892c0){logger[_0xeb08('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1f95e7,_0x5892c0);_0x2f1372(_0x5892c0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 717c938..0bdf7b7 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 _0xf94a=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x1a0bd8,_0xf4ac4f){var _0x283944=function(_0x5d7429){while(--_0x5d7429){_0x1a0bd8['push'](_0x1a0bd8['shift']());}};_0x283944(++_0xf4ac4f);}(_0xf94a,0xdd));var _0xaf94=function(_0x2783fc,_0x554387){_0x2783fc=_0x2783fc-0x0;var _0x27bb57=_0xf94a[_0x2783fc];return _0x27bb57;};'use strict';var multer=require(_0xaf94('0x0'));var util=require('util');var path=require(_0xaf94('0x1'));var timeout=require(_0xaf94('0x2'));var express=require(_0xaf94('0x3'));var router=express[_0xaf94('0x4')]();var fs_extra=require(_0xaf94('0x5'));var auth=require(_0xaf94('0x6'));var interaction=require(_0xaf94('0x7'));var config=require(_0xaf94('0x8'));var controller=require(_0xaf94('0x9'));router[_0xaf94('0xa')]('/',auth[_0xaf94('0xb')](),controller[_0xaf94('0xc')]);router[_0xaf94('0xa')]('/:id',auth[_0xaf94('0xb')](),controller[_0xaf94('0xd')]);router[_0xaf94('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xaf94('0xb')](),controller[_0xaf94('0xe')]);router[_0xaf94('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf94('0xf')](_0xaf94('0x10'),auth[_0xaf94('0xb')](),controller[_0xaf94('0x11')]);router[_0xaf94('0x12')](_0xaf94('0x13'),auth[_0xaf94('0xb')](),controller[_0xaf94('0x14')]);router[_0xaf94('0x15')]('/:id',auth[_0xaf94('0xb')](),controller[_0xaf94('0x16')]);module[_0xaf94('0x17')]=router; \ No newline at end of file +var _0xcf55=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x147116,_0x6abac9){var _0x246711=function(_0x578e81){while(--_0x578e81){_0x147116['push'](_0x147116['shift']());}};_0x246711(++_0x6abac9);}(_0xcf55,0xfa));var _0x5cf5=function(_0x2b5584,_0x2c1bab){_0x2b5584=_0x2b5584-0x0;var _0x3f8885=_0xcf55[_0x2b5584];return _0x3f8885;};'use strict';var multer=require(_0x5cf5('0x0'));var util=require(_0x5cf5('0x1'));var path=require(_0x5cf5('0x2'));var timeout=require(_0x5cf5('0x3'));var express=require('express');var router=express[_0x5cf5('0x4')]();var fs_extra=require(_0x5cf5('0x5'));var auth=require(_0x5cf5('0x6'));var interaction=require(_0x5cf5('0x7'));var config=require(_0x5cf5('0x8'));var controller=require(_0x5cf5('0x9'));router[_0x5cf5('0xa')]('/',auth[_0x5cf5('0xb')](),controller[_0x5cf5('0xc')]);router['get'](_0x5cf5('0xd'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0xe')]);router[_0x5cf5('0xa')](_0x5cf5('0xf'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x10')]);router['get'](_0x5cf5('0x11'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x12')]);router['post']('/',auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x13')]);router[_0x5cf5('0x14')](_0x5cf5('0xf'),auth[_0x5cf5('0xb')](),controller['addConfiguration']);router[_0x5cf5('0x15')](_0x5cf5('0xd'),auth[_0x5cf5('0xb')](),controller[_0x5cf5('0x16')]);router[_0x5cf5('0x17')](_0x5cf5('0xd'),auth['isAuthenticated'](),controller[_0x5cf5('0x18')]);module[_0x5cf5('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 59d1c1d..a1d876b 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0x543e10,_0x1662ea){var _0x387204=function(_0x36e759){while(--_0x36e759){_0x543e10['push'](_0x543e10['shift']());}};_0x387204(++_0x1662ea);}(_0xa456,0x142));var _0x6a45=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa456[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xef0f=['sequelize','STRING','remoteUri'];(function(_0xefdff1,_0x42aa31){var _0x1cc0fb=function(_0x1831b6){while(--_0x1831b6){_0xefdff1['push'](_0xefdff1['shift']());}};_0x1cc0fb(++_0x42aa31);}(_0xef0f,0x168));var _0xfef0=function(_0x306cce,_0x18afa5){_0x306cce=_0x306cce-0x0;var _0x49881a=_0xef0f[_0x306cce];return _0x49881a;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'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 147cf9f..bec5e40 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 _0x61a5=['index','map','FreshdeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','pick','addConfiguration','AccountId','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','remoteUri','apiKey','substring','GET','format','%s/%s','Basic\x20%s','%s:X','base64','subject','description','priority','group','source','ticket_type','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send'];(function(_0x2e50f1,_0x4b3469){var _0x42ac15=function(_0x32c440){while(--_0x32c440){_0x2e50f1['push'](_0x2e50f1['shift']());}};_0x42ac15(++_0x4b3469);}(_0x61a5,0x19e));var _0x561a=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x61a5[_0x1fa759];return _0x2da9f4;};'use strict';var emlformat=require(_0x561a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x561a('0x1'));var jsonpatch=require(_0x561a('0x2'));var rp=require('request-promise');var moment=require(_0x561a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x561a('0x4'));var util=require(_0x561a('0x5'));var path=require(_0x561a('0x6'));var sox=require(_0x561a('0x7'));var csv=require(_0x561a('0x8'));var ejs=require(_0x561a('0x9'));var fs=require('fs');var fs_extra=require(_0x561a('0xa'));var _=require(_0x561a('0xb'));var squel=require('squel');var crypto=require(_0x561a('0xc'));var jsforce=require(_0x561a('0xd'));var deskjs=require(_0x561a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x561a('0xf'));var Papa=require(_0x561a('0x10'));var Redis=require('ioredis');var authService=require(_0x561a('0x11'));var qs=require(_0x561a('0x12'));var as=require(_0x561a('0x13'));var hardwareService=require(_0x561a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x561a('0x15'));var config=require(_0x561a('0x16'));var licenseUtil=require(_0x561a('0x17'));var db=require(_0x561a('0x18'))['db'];var integrations=require(_0x561a('0x19'));function respondWithStatusCode(_0x256635,_0x6ab4df){_0x6ab4df=_0x6ab4df||0xcc;return function(_0x1dacd2){if(_0x1dacd2){return _0x256635['sendStatus'](_0x6ab4df);}return _0x256635[_0x561a('0x1a')](_0x6ab4df)[_0x561a('0x1b')]();};}function respondWithResult(_0x3ac3a4,_0x352b6f){_0x352b6f=_0x352b6f||0xc8;return function(_0x5a66c7){if(_0x5a66c7){return _0x3ac3a4[_0x561a('0x1a')](_0x352b6f)['json'](_0x5a66c7);}};}function respondWithFilteredResult(_0x4427c8,_0x3a06d3){return function(_0x85faed){if(_0x85faed){var _0x4172f8=typeof _0x3a06d3[_0x561a('0x1c')]===_0x561a('0x1d')&&typeof _0x3a06d3['limit']==='undefined';var _0x47a413=_0x85faed['count'];var _0xfff95c=_0x4172f8?0x0:_0x3a06d3[_0x561a('0x1c')];var _0x1f920e=_0x4172f8?_0x85faed['count']:_0x3a06d3['offset']+_0x3a06d3['limit'];var _0x4552c0;if(_0x1f920e>=_0x47a413){_0x1f920e=_0x47a413;_0x4552c0=0xc8;}else{_0x4552c0=0xce;}_0x4427c8[_0x561a('0x1a')](_0x4552c0);return _0x4427c8[_0x561a('0x1e')](_0x561a('0x1f'),_0xfff95c+'-'+_0x1f920e+'/'+_0x47a413)[_0x561a('0x20')](_0x85faed);}return null;};}function patchUpdates(_0x5529d9){return function(_0x1d8784){try{jsonpatch[_0x561a('0x21')](_0x1d8784,_0x5529d9,!![]);}catch(_0x5e45cd){return BPromise[_0x561a('0x22')](_0x5e45cd);}return _0x1d8784[_0x561a('0x23')]();};}function saveUpdates(_0x4a038b,_0x49c937){return function(_0xb88610){if(_0xb88610){return _0xb88610['update'](_0x4a038b)['then'](function(_0x562329){return _0x562329;});}return null;};}function removeEntity(_0x48c6e1,_0x22dfb4){return function(_0x5f28a6){if(_0x5f28a6){return _0x5f28a6['destroy']()[_0x561a('0x24')](function(){_0x48c6e1[_0x561a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2e07,_0x4bcf09){return function(_0x30657a){if(!_0x30657a){_0x5f2e07[_0x561a('0x25')](0x194);}return _0x30657a;};}function handleError(_0x4f25fb,_0x35a1f4){_0x35a1f4=_0x35a1f4||0x1f4;return function(_0x4de8ef){logger[_0x561a('0x26')](_0x4de8ef[_0x561a('0x27')]);if(_0x4de8ef[_0x561a('0x28')]){delete _0x4de8ef[_0x561a('0x28')];}_0x4f25fb[_0x561a('0x1a')](_0x35a1f4)[_0x561a('0x29')](_0x4de8ef);};}exports[_0x561a('0x2a')]=function(_0x310d40,_0x44fd4d){var _0x2293bf={},_0x1e9c37={},_0x1d8948={'count':0x0,'rows':[]};var _0x4d3b16=_[_0x561a('0x2b')](db[_0x561a('0x2c')][_0x561a('0x2d')],function(_0x39a7f6){return{'name':_0x39a7f6['fieldName'],'type':_0x39a7f6[_0x561a('0x2e')][_0x561a('0x2f')]};});_0x1e9c37[_0x561a('0x30')]=_[_0x561a('0x2b')](_0x4d3b16,_0x561a('0x28'));_0x1e9c37[_0x561a('0x31')]=_['keys'](_0x310d40[_0x561a('0x31')]);_0x1e9c37[_0x561a('0x32')]=_[_0x561a('0x33')](_0x1e9c37[_0x561a('0x30')],_0x1e9c37[_0x561a('0x31')]);_0x2293bf[_0x561a('0x34')]=_[_0x561a('0x33')](_0x1e9c37[_0x561a('0x30')],qs['fields'](_0x310d40[_0x561a('0x31')][_0x561a('0x35')]));_0x2293bf[_0x561a('0x34')]=_0x2293bf[_0x561a('0x34')]['length']?_0x2293bf['attributes']:_0x1e9c37[_0x561a('0x30')];if(!_0x310d40[_0x561a('0x31')]['hasOwnProperty'](_0x561a('0x36'))){_0x2293bf[_0x561a('0x37')]=qs[_0x561a('0x37')](_0x310d40[_0x561a('0x31')][_0x561a('0x37')]);_0x2293bf[_0x561a('0x1c')]=qs[_0x561a('0x1c')](_0x310d40[_0x561a('0x31')][_0x561a('0x1c')]);}_0x2293bf['order']=qs['sort'](_0x310d40['query'][_0x561a('0x38')]);_0x2293bf[_0x561a('0x39')]=qs[_0x561a('0x32')](_['pick'](_0x310d40[_0x561a('0x31')],_0x1e9c37[_0x561a('0x32')]),_0x4d3b16);if(_0x310d40[_0x561a('0x31')][_0x561a('0x3a')]){_0x2293bf[_0x561a('0x39')]=_[_0x561a('0x3b')](_0x2293bf['where'],{'$or':_[_0x561a('0x2b')](_0x4d3b16,function(_0x86be49){if(_0x86be49[_0x561a('0x2e')]!==_0x561a('0x3c')){var _0x40b916={};_0x40b916[_0x86be49[_0x561a('0x28')]]={'$like':'%'+_0x310d40[_0x561a('0x31')][_0x561a('0x3a')]+'%'};return _0x40b916;}})});}_0x2293bf=_['merge']({},_0x2293bf,_0x310d40[_0x561a('0x3d')]);var _0x4a54ad={'where':_0x2293bf[_0x561a('0x39')]};return db[_0x561a('0x2c')][_0x561a('0x3e')](_0x4a54ad)[_0x561a('0x24')](function(_0x3f28fb){_0x1d8948['count']=_0x3f28fb;if(_0x310d40[_0x561a('0x31')][_0x561a('0x3f')]){_0x2293bf['include']=[{'all':!![]}];}return db[_0x561a('0x2c')]['findAll'](_0x2293bf);})[_0x561a('0x24')](function(_0x3ebb45){_0x1d8948[_0x561a('0x40')]=_0x3ebb45;return _0x1d8948;})[_0x561a('0x24')](respondWithFilteredResult(_0x44fd4d,_0x2293bf))[_0x561a('0x41')](handleError(_0x44fd4d,null));};exports[_0x561a('0x42')]=function(_0x2d3743,_0x215f22){var _0x566cda={'raw':![],'where':{'id':_0x2d3743[_0x561a('0x43')]['id']}},_0x1ec09c={};_0x1ec09c[_0x561a('0x30')]=_[_0x561a('0x44')](db['FreshdeskAccount'][_0x561a('0x2d')]);_0x1ec09c[_0x561a('0x31')]=_[_0x561a('0x44')](_0x2d3743[_0x561a('0x31')]);_0x1ec09c['filters']=_[_0x561a('0x33')](_0x1ec09c['model'],_0x1ec09c[_0x561a('0x31')]);_0x566cda['attributes']=_[_0x561a('0x33')](_0x1ec09c[_0x561a('0x30')],qs[_0x561a('0x35')](_0x2d3743['query']['fields']));_0x566cda[_0x561a('0x34')]=_0x566cda[_0x561a('0x34')][_0x561a('0x45')]?_0x566cda[_0x561a('0x34')]:_0x1ec09c[_0x561a('0x30')];if(_0x2d3743[_0x561a('0x31')]['includeAll']){_0x566cda[_0x561a('0x46')]=[{'all':!![]}];}_0x566cda=_['merge']({},_0x566cda,_0x2d3743[_0x561a('0x3d')]);return db[_0x561a('0x2c')][_0x561a('0x47')](_0x566cda)[_0x561a('0x24')](handleEntityNotFound(_0x215f22,null))[_0x561a('0x24')](respondWithResult(_0x215f22,null))['catch'](handleError(_0x215f22,null));};exports[_0x561a('0x48')]=function(_0x464cce,_0x2b69bc){return db[_0x561a('0x2c')][_0x561a('0x48')](_0x464cce['body'],{})[_0x561a('0x24')](respondWithResult(_0x2b69bc,0xc9))[_0x561a('0x41')](handleError(_0x2b69bc,null));};exports['update']=function(_0x180b6b,_0x1b96dd){if(_0x180b6b['body']['id']){delete _0x180b6b[_0x561a('0x49')]['id'];}return db['FreshdeskAccount'][_0x561a('0x47')]({'where':{'id':_0x180b6b[_0x561a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b96dd,null))[_0x561a('0x24')](saveUpdates(_0x180b6b[_0x561a('0x49')],null))[_0x561a('0x24')](respondWithResult(_0x1b96dd,null))['catch'](handleError(_0x1b96dd,null));};exports[_0x561a('0x4a')]=function(_0x5f55ba,_0xaf4fbd){return db[_0x561a('0x2c')][_0x561a('0x47')]({'where':{'id':_0x5f55ba['params']['id']}})[_0x561a('0x24')](handleEntityNotFound(_0xaf4fbd,null))[_0x561a('0x24')](removeEntity(_0xaf4fbd,null))[_0x561a('0x41')](handleError(_0xaf4fbd,null));};exports[_0x561a('0x4b')]=function(_0x1f9ccb,_0x2a08fc,_0x39f0ce){var _0x1a266e={};var _0x497b59={};var _0x27d737;var _0x157ff8;return db['FreshdeskAccount'][_0x561a('0x4c')]({'where':{'id':_0x1f9ccb[_0x561a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a08fc,null))[_0x561a('0x24')](function(_0x23c8f2){if(_0x23c8f2){_0x27d737=_0x23c8f2;_0x497b59[_0x561a('0x30')]=_[_0x561a('0x44')](db[_0x561a('0x4d')][_0x561a('0x2d')]);_0x497b59['query']=_[_0x561a('0x44')](_0x1f9ccb[_0x561a('0x31')]);_0x497b59[_0x561a('0x32')]=_[_0x561a('0x33')](_0x497b59['model'],_0x497b59[_0x561a('0x31')]);_0x1a266e[_0x561a('0x34')]=_[_0x561a('0x33')](_0x497b59[_0x561a('0x30')],qs[_0x561a('0x35')](_0x1f9ccb['query'][_0x561a('0x35')]));_0x1a266e[_0x561a('0x34')]=_0x1a266e['attributes'][_0x561a('0x45')]?_0x1a266e[_0x561a('0x34')]:_0x497b59[_0x561a('0x30')];_0x1a266e[_0x561a('0x4e')]=qs[_0x561a('0x38')](_0x1f9ccb[_0x561a('0x31')][_0x561a('0x38')]);_0x1a266e[_0x561a('0x39')]=qs[_0x561a('0x32')](_[_0x561a('0x4f')](_0x1f9ccb[_0x561a('0x31')],_0x497b59[_0x561a('0x32')]));if(_0x1f9ccb[_0x561a('0x31')]['filter']){_0x1a266e[_0x561a('0x39')]=_[_0x561a('0x3b')](_0x1a266e[_0x561a('0x39')],{'$or':_[_0x561a('0x2b')](_0x1a266e[_0x561a('0x34')],function(_0x35e11f){var _0x5f1992={};_0x5f1992[_0x35e11f]={'$like':'%'+_0x1f9ccb[_0x561a('0x31')][_0x561a('0x3a')]+'%'};return _0x5f1992;})});}_0x1a266e=_[_0x561a('0x3b')]({},_0x1a266e,_0x1f9ccb[_0x561a('0x3d')]);return _0x27d737[_0x561a('0x4b')](_0x1a266e);}})[_0x561a('0x24')](function(_0x278a47){if(_0x278a47){_0x157ff8=_0x278a47[_0x561a('0x45')];if(!_0x1f9ccb['query']['hasOwnProperty'](_0x561a('0x36'))){_0x1a266e[_0x561a('0x37')]=qs[_0x561a('0x37')](_0x1f9ccb[_0x561a('0x31')][_0x561a('0x37')]);_0x1a266e[_0x561a('0x1c')]=qs[_0x561a('0x1c')](_0x1f9ccb[_0x561a('0x31')]['offset']);}return _0x27d737['getConfigurations'](_0x1a266e);}})[_0x561a('0x24')](function(_0x30a1d9){if(_0x30a1d9){return _0x30a1d9?{'count':_0x157ff8,'rows':_0x30a1d9}:null;}})['then'](respondWithResult(_0x2a08fc,null))[_0x561a('0x41')](handleError(_0x2a08fc,null));};exports[_0x561a('0x50')]=function(_0x5842fd,_0x4c2753,_0xe8d377){if(_0x5842fd[_0x561a('0x49')]['id']){delete _0x5842fd['body']['id'];}return db[_0x561a('0x2c')][_0x561a('0x4c')]({'where':{'id':_0x5842fd['params']['id']}})['then'](handleEntityNotFound(_0x4c2753,null))[_0x561a('0x24')](function(_0x1c692c){if(_0x1c692c){_0x5842fd['body'][_0x561a('0x51')]=_0x1c692c['id'];_0x5842fd[_0x561a('0x49')][_0x561a('0x52')]=integrations['getSubjects'](_0x5842fd[_0x561a('0x49')]['channel'],_0x5842fd['body'][_0x561a('0x2e')]);_0x5842fd['body']['Descriptions']=integrations[_0x561a('0x53')](_0x5842fd[_0x561a('0x49')][_0x561a('0x54')],_0x5842fd[_0x561a('0x49')][_0x561a('0x2e')]);return db['FreshdeskConfiguration'][_0x561a('0x48')](_0x5842fd['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x561a('0x52')},{'model':db[_0x561a('0x55')],'as':_0x561a('0x56')}]});}return null;})['then'](respondWithResult(_0x4c2753,null))[_0x561a('0x41')](handleError(_0x4c2753,null));};exports['getFields']=function(_0x3e4f69,_0x24c819,_0x5bf6ee){var _0x1e029a='';return db[_0x561a('0x2c')][_0x561a('0x4c')]({'where':{'id':_0x3e4f69[_0x561a('0x43')]['id']},'attributes':['id',_0x561a('0x57'),_0x561a('0x58')]})[_0x561a('0x24')](handleEntityNotFound(_0x24c819,null))[_0x561a('0x24')](function(_0x28f36b){if(_0x28f36b){_0x1e029a=_0x28f36b[_0x561a('0x57')];var _0xc72933=_0x1e029a['slice'](-0x1);if(_0xc72933==='/'){_0x1e029a=_0x1e029a[_0x561a('0x59')](0x0,_0x1e029a['lastIndexOf'](_0xc72933));}return rp({'method':_0x561a('0x5a'),'uri':util[_0x561a('0x5b')](_0x561a('0x5c'),_0x1e029a,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x561a('0x5b')](_0x561a('0x5d'),new Buffer(util[_0x561a('0x5b')](_0x561a('0x5e'),_0x28f36b[_0x561a('0x58')]))['toString'](_0x561a('0x5f')))},'json':!![]});}})['then'](function(_0x19fdb5){if(_0x19fdb5){var _0x38856d=['requester',_0x561a('0x60'),'agent',_0x561a('0x61'),_0x561a('0x1a'),_0x561a('0x62'),_0x561a('0x63'),_0x561a('0x64'),_0x561a('0x65'),'group','company'];_[_0x561a('0x66')](_0x19fdb5,function(_0xe3a568){return _0x38856d['includes'](_0xe3a568[_0x561a('0x28')])||!_0xe3a568[_0x561a('0x67')]&&_0xe3a568[_0x561a('0x2e')]!==_0x561a('0x68')&&_0xe3a568['type']!==_0x561a('0x69');});return{'count':_0x19fdb5[_0x561a('0x45')],'rows':_[_0x561a('0x2b')](_0x19fdb5,function(_0x7a40c9){return{'id':_0x7a40c9[_0x561a('0x28')],'name':_0x7a40c9[_0x561a('0x6a')],'custom':!_0x7a40c9[_0x561a('0x67')],'options':_0x7a40c9[_0x561a('0x6b')]?_[_0x561a('0x2b')](_0x7a40c9[_0x561a('0x6b')],function(_0x55051c){return{'name':_[_0x561a('0x6c')](_0x55051c),'value':_0x55051c};}):[]};})};}})[_0x561a('0x24')](respondWithResult(_0x24c819,null))[_0x561a('0x41')](function(_0x28a280){var _0x4b31a0=_0x3e4f69[_0x561a('0x31')][_0x561a('0x6d')]?0x1f4:_0x28a280[_0x561a('0x6e')]||0x1f4;logger[_0x561a('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x561a('0x6f'),_0x4b31a0,JSON[_0x561a('0x70')](_0x28a280));delete _0x28a280[_0x561a('0x28')];if(_0x4b31a0===0x191){_0x4b31a0=0x190;}_0x24c819[_0x561a('0x1a')](_0x4b31a0)[_0x561a('0x29')](_0x3e4f69[_0x561a('0x31')][_0x561a('0x6d')]?{'message':_0x561a('0x71'),'statusCode':_0x28a280['statusCode']}:_0x28a280);});}; \ No newline at end of file +var _0x69e6=['custom_text','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','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','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','FreshdeskAccount','rows','catch','keys','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','subject','agent','priority','group','source','ticket_type','remove','includes','default'];(function(_0xdfd978,_0x457bba){var _0x108b04=function(_0x421c98){while(--_0x421c98){_0xdfd978['push'](_0xdfd978['shift']());}};_0x108b04(++_0x457bba);}(_0x69e6,0x1e0));var _0x669e=function(_0x2b8a7a,_0x3c76f1){_0x2b8a7a=_0x2b8a7a-0x0;var _0x141456=_0x69e6[_0x2b8a7a];return _0x141456;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x669e('0x0'));var zipdir=require(_0x669e('0x1'));var jsonpatch=require(_0x669e('0x2'));var rp=require(_0x669e('0x3'));var moment=require(_0x669e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x669e('0x5'));var util=require(_0x669e('0x6'));var path=require(_0x669e('0x7'));var sox=require(_0x669e('0x8'));var csv=require(_0x669e('0x9'));var ejs=require(_0x669e('0xa'));var fs=require('fs');var fs_extra=require(_0x669e('0xb'));var _=require(_0x669e('0xc'));var squel=require(_0x669e('0xd'));var crypto=require(_0x669e('0xe'));var jsforce=require(_0x669e('0xf'));var deskjs=require(_0x669e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x669e('0x11'));var Papa=require(_0x669e('0x12'));var Redis=require(_0x669e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x669e('0x14'));var logger=require(_0x669e('0x15'))(_0x669e('0x16'));var utils=require(_0x669e('0x17'));var config=require(_0x669e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x669e('0x19'));function respondWithStatusCode(_0x1a7ea7,_0x344b70){_0x344b70=_0x344b70||0xcc;return function(_0x12e4aa){if(_0x12e4aa){return _0x1a7ea7['sendStatus'](_0x344b70);}return _0x1a7ea7['status'](_0x344b70)[_0x669e('0x1a')]();};}function respondWithResult(_0x557e55,_0x2e53db){_0x2e53db=_0x2e53db||0xc8;return function(_0x409754){if(_0x409754){return _0x557e55[_0x669e('0x1b')](_0x2e53db)['json'](_0x409754);}};}function respondWithFilteredResult(_0x648035,_0x255d4e){return function(_0x150993){if(_0x150993){var _0x151f76=typeof _0x255d4e['offset']===_0x669e('0x1c')&&typeof _0x255d4e['limit']===_0x669e('0x1c');var _0x370a82=_0x150993[_0x669e('0x1d')];var _0x81cb19=_0x151f76?0x0:_0x255d4e[_0x669e('0x1e')];var _0x47b558=_0x151f76?_0x150993['count']:_0x255d4e[_0x669e('0x1e')]+_0x255d4e[_0x669e('0x1f')];var _0x498f9d;if(_0x47b558>=_0x370a82){_0x47b558=_0x370a82;_0x498f9d=0xc8;}else{_0x498f9d=0xce;}_0x648035[_0x669e('0x1b')](_0x498f9d);return _0x648035[_0x669e('0x20')](_0x669e('0x21'),_0x81cb19+'-'+_0x47b558+'/'+_0x370a82)[_0x669e('0x22')](_0x150993);}return null;};}function patchUpdates(_0x52d60e){return function(_0x30f7b5){try{jsonpatch[_0x669e('0x23')](_0x30f7b5,_0x52d60e,!![]);}catch(_0x5ca591){return BPromise[_0x669e('0x24')](_0x5ca591);}return _0x30f7b5[_0x669e('0x25')]();};}function saveUpdates(_0x40a590,_0x58c08f){return function(_0x145f8d){if(_0x145f8d){return _0x145f8d[_0x669e('0x26')](_0x40a590)[_0x669e('0x27')](function(_0xbe2acd){return _0xbe2acd;});}return null;};}function removeEntity(_0x2eab78,_0x2f8d20){return function(_0x1cd3f4){if(_0x1cd3f4){return _0x1cd3f4[_0x669e('0x28')]()['then'](function(){_0x2eab78['status'](0xcc)[_0x669e('0x1a')]();});}};}function handleEntityNotFound(_0x4e4500,_0x343c0a){return function(_0x5dad02){if(!_0x5dad02){_0x4e4500[_0x669e('0x29')](0x194);}return _0x5dad02;};}function handleError(_0x372ea3,_0x27fa45){_0x27fa45=_0x27fa45||0x1f4;return function(_0x3b25a5){logger[_0x669e('0x2a')](_0x3b25a5[_0x669e('0x2b')]);if(_0x3b25a5['name']){delete _0x3b25a5[_0x669e('0x2c')];}_0x372ea3[_0x669e('0x1b')](_0x27fa45)[_0x669e('0x2d')](_0x3b25a5);};}exports[_0x669e('0x2e')]=function(_0x5bf9b2,_0xe3281e){var _0x283651={},_0x20142d={},_0x295859={'count':0x0,'rows':[]};var _0x5e1980=_[_0x669e('0x2f')](db['FreshdeskAccount'][_0x669e('0x30')],function(_0x400d8f){return{'name':_0x400d8f[_0x669e('0x31')],'type':_0x400d8f[_0x669e('0x32')][_0x669e('0x33')]};});_0x20142d['model']=_[_0x669e('0x2f')](_0x5e1980,_0x669e('0x2c'));_0x20142d[_0x669e('0x34')]=_['keys'](_0x5bf9b2[_0x669e('0x34')]);_0x20142d[_0x669e('0x35')]=_[_0x669e('0x36')](_0x20142d[_0x669e('0x37')],_0x20142d['query']);_0x283651[_0x669e('0x38')]=_['intersection'](_0x20142d['model'],qs[_0x669e('0x39')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x39')]));_0x283651[_0x669e('0x38')]=_0x283651[_0x669e('0x38')][_0x669e('0x3a')]?_0x283651[_0x669e('0x38')]:_0x20142d[_0x669e('0x37')];if(!_0x5bf9b2['query']['hasOwnProperty']('nolimit')){_0x283651['limit']=qs[_0x669e('0x1f')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x1f')]);_0x283651[_0x669e('0x1e')]=qs[_0x669e('0x1e')](_0x5bf9b2[_0x669e('0x34')][_0x669e('0x1e')]);}_0x283651[_0x669e('0x3b')]=qs[_0x669e('0x3c')](_0x5bf9b2['query']['sort']);_0x283651['where']=qs[_0x669e('0x35')](_[_0x669e('0x3d')](_0x5bf9b2[_0x669e('0x34')],_0x20142d['filters']),_0x5e1980);if(_0x5bf9b2[_0x669e('0x34')][_0x669e('0x3e')]){_0x283651[_0x669e('0x3f')]=_['merge'](_0x283651['where'],{'$or':_['map'](_0x5e1980,function(_0x4a7549){if(_0x4a7549[_0x669e('0x32')]!==_0x669e('0x40')){var _0x4a349c={};_0x4a349c[_0x4a7549[_0x669e('0x2c')]]={'$like':'%'+_0x5bf9b2[_0x669e('0x34')]['filter']+'%'};return _0x4a349c;}})});}_0x283651=_[_0x669e('0x41')]({},_0x283651,_0x5bf9b2[_0x669e('0x42')]);var _0x102da5={'where':_0x283651[_0x669e('0x3f')]};return db['FreshdeskAccount'][_0x669e('0x1d')](_0x102da5)['then'](function(_0x112acf){_0x295859[_0x669e('0x1d')]=_0x112acf;if(_0x5bf9b2[_0x669e('0x34')][_0x669e('0x43')]){_0x283651[_0x669e('0x44')]=[{'all':!![]}];}return db[_0x669e('0x45')]['findAll'](_0x283651);})[_0x669e('0x27')](function(_0x2711bc){_0x295859[_0x669e('0x46')]=_0x2711bc;return _0x295859;})[_0x669e('0x27')](respondWithFilteredResult(_0xe3281e,_0x283651))[_0x669e('0x47')](handleError(_0xe3281e,null));};exports['show']=function(_0x46783f,_0x4eb087){var _0x54e2a9={'raw':![],'where':{'id':_0x46783f['params']['id']}},_0x4d4a42={};_0x4d4a42[_0x669e('0x37')]=_['keys'](db[_0x669e('0x45')][_0x669e('0x30')]);_0x4d4a42['query']=_[_0x669e('0x48')](_0x46783f['query']);_0x4d4a42[_0x669e('0x35')]=_[_0x669e('0x36')](_0x4d4a42['model'],_0x4d4a42['query']);_0x54e2a9[_0x669e('0x38')]=_[_0x669e('0x36')](_0x4d4a42[_0x669e('0x37')],qs[_0x669e('0x39')](_0x46783f['query'][_0x669e('0x39')]));_0x54e2a9[_0x669e('0x38')]=_0x54e2a9[_0x669e('0x38')][_0x669e('0x3a')]?_0x54e2a9[_0x669e('0x38')]:_0x4d4a42[_0x669e('0x37')];if(_0x46783f['query']['includeAll']){_0x54e2a9['include']=[{'all':!![]}];}_0x54e2a9=_['merge']({},_0x54e2a9,_0x46783f[_0x669e('0x42')]);return db[_0x669e('0x45')][_0x669e('0x49')](_0x54e2a9)['then'](handleEntityNotFound(_0x4eb087,null))['then'](respondWithResult(_0x4eb087,null))[_0x669e('0x47')](handleError(_0x4eb087,null));};exports[_0x669e('0x4a')]=function(_0xe23432,_0x28507e){return db[_0x669e('0x45')][_0x669e('0x4a')](_0xe23432['body'],{})[_0x669e('0x27')](respondWithResult(_0x28507e,0xc9))[_0x669e('0x47')](handleError(_0x28507e,null));};exports['update']=function(_0x11d2c8,_0x1eaf9f){if(_0x11d2c8[_0x669e('0x4b')]['id']){delete _0x11d2c8['body']['id'];}return db[_0x669e('0x45')][_0x669e('0x49')]({'where':{'id':_0x11d2c8[_0x669e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1eaf9f,null))[_0x669e('0x27')](saveUpdates(_0x11d2c8[_0x669e('0x4b')],null))[_0x669e('0x27')](respondWithResult(_0x1eaf9f,null))[_0x669e('0x47')](handleError(_0x1eaf9f,null));};exports['destroy']=function(_0x4e79c0,_0x1ec48d){return db['FreshdeskAccount']['find']({'where':{'id':_0x4e79c0[_0x669e('0x4c')]['id']}})[_0x669e('0x27')](handleEntityNotFound(_0x1ec48d,null))[_0x669e('0x27')](removeEntity(_0x1ec48d,null))[_0x669e('0x47')](handleError(_0x1ec48d,null));};exports[_0x669e('0x4d')]=function(_0x43921f,_0xdd2acf,_0x2c86d4){var _0x4225d6={};var _0xa71174={};var _0x5b9c4d;var _0x3169e7;return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x43921f[_0x669e('0x4c')]['id']}})[_0x669e('0x27')](handleEntityNotFound(_0xdd2acf,null))[_0x669e('0x27')](function(_0x29f05a){if(_0x29f05a){_0x5b9c4d=_0x29f05a;_0xa71174[_0x669e('0x37')]=_[_0x669e('0x48')](db[_0x669e('0x4f')][_0x669e('0x30')]);_0xa71174[_0x669e('0x34')]=_[_0x669e('0x48')](_0x43921f['query']);_0xa71174[_0x669e('0x35')]=_['intersection'](_0xa71174['model'],_0xa71174[_0x669e('0x34')]);_0x4225d6[_0x669e('0x38')]=_[_0x669e('0x36')](_0xa71174[_0x669e('0x37')],qs['fields'](_0x43921f[_0x669e('0x34')][_0x669e('0x39')]));_0x4225d6['attributes']=_0x4225d6[_0x669e('0x38')][_0x669e('0x3a')]?_0x4225d6[_0x669e('0x38')]:_0xa71174[_0x669e('0x37')];_0x4225d6[_0x669e('0x3b')]=qs['sort'](_0x43921f[_0x669e('0x34')][_0x669e('0x3c')]);_0x4225d6[_0x669e('0x3f')]=qs['filters'](_[_0x669e('0x3d')](_0x43921f[_0x669e('0x34')],_0xa71174[_0x669e('0x35')]));if(_0x43921f[_0x669e('0x34')][_0x669e('0x3e')]){_0x4225d6[_0x669e('0x3f')]=_[_0x669e('0x41')](_0x4225d6['where'],{'$or':_[_0x669e('0x2f')](_0x4225d6[_0x669e('0x38')],function(_0x4e9128){var _0x4f3306={};_0x4f3306[_0x4e9128]={'$like':'%'+_0x43921f[_0x669e('0x34')][_0x669e('0x3e')]+'%'};return _0x4f3306;})});}_0x4225d6=_[_0x669e('0x41')]({},_0x4225d6,_0x43921f[_0x669e('0x42')]);return _0x5b9c4d[_0x669e('0x4d')](_0x4225d6);}})[_0x669e('0x27')](function(_0x2162ba){if(_0x2162ba){_0x3169e7=_0x2162ba[_0x669e('0x3a')];if(!_0x43921f['query'][_0x669e('0x50')](_0x669e('0x51'))){_0x4225d6[_0x669e('0x1f')]=qs[_0x669e('0x1f')](_0x43921f[_0x669e('0x34')][_0x669e('0x1f')]);_0x4225d6[_0x669e('0x1e')]=qs['offset'](_0x43921f[_0x669e('0x34')][_0x669e('0x1e')]);}return _0x5b9c4d[_0x669e('0x4d')](_0x4225d6);}})[_0x669e('0x27')](function(_0x220e0d){if(_0x220e0d){return _0x220e0d?{'count':_0x3169e7,'rows':_0x220e0d}:null;}})['then'](respondWithResult(_0xdd2acf,null))['catch'](handleError(_0xdd2acf,null));};exports[_0x669e('0x52')]=function(_0x304332,_0x233942,_0x526212){if(_0x304332[_0x669e('0x4b')]['id']){delete _0x304332[_0x669e('0x4b')]['id'];}return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x304332['params']['id']}})[_0x669e('0x27')](handleEntityNotFound(_0x233942,null))['then'](function(_0x31b146){if(_0x31b146){_0x304332[_0x669e('0x4b')][_0x669e('0x53')]=_0x31b146['id'];_0x304332[_0x669e('0x4b')][_0x669e('0x54')]=integrations[_0x669e('0x55')](_0x304332['body'][_0x669e('0x56')],_0x304332['body'][_0x669e('0x32')]);_0x304332[_0x669e('0x4b')]['Descriptions']=integrations[_0x669e('0x57')](_0x304332[_0x669e('0x4b')][_0x669e('0x56')],_0x304332['body']['type']);return db[_0x669e('0x4f')][_0x669e('0x4a')](_0x304332[_0x669e('0x4b')],{'include':[{'model':db[_0x669e('0x58')],'as':_0x669e('0x54')},{'model':db['FreshdeskField'],'as':_0x669e('0x59')}]});}return null;})[_0x669e('0x27')](respondWithResult(_0x233942,null))[_0x669e('0x47')](handleError(_0x233942,null));};exports[_0x669e('0x5a')]=function(_0x417cdf,_0x26fb61,_0x228241){var _0x5b6336='';return db[_0x669e('0x45')][_0x669e('0x4e')]({'where':{'id':_0x417cdf[_0x669e('0x4c')]['id']},'attributes':['id',_0x669e('0x5b'),_0x669e('0x5c')]})[_0x669e('0x27')](handleEntityNotFound(_0x26fb61,null))[_0x669e('0x27')](function(_0x541148){if(_0x541148){_0x5b6336=_0x541148[_0x669e('0x5b')];var _0x482e2f=_0x5b6336[_0x669e('0x5d')](-0x1);if(_0x482e2f==='/'){_0x5b6336=_0x5b6336[_0x669e('0x5e')](0x0,_0x5b6336[_0x669e('0x5f')](_0x482e2f));}return rp({'method':_0x669e('0x60'),'uri':util['format'](_0x669e('0x61'),_0x5b6336,_0x669e('0x62')),'headers':{'Authorization':util[_0x669e('0x63')](_0x669e('0x64'),new Buffer(util[_0x669e('0x63')]('%s:X',_0x541148[_0x669e('0x5c')]))['toString']('base64'))},'json':!![]});}})[_0x669e('0x27')](function(_0x3f89ab){if(_0x3f89ab){var _0x2b2df9=['requester',_0x669e('0x65'),_0x669e('0x66'),'description',_0x669e('0x1b'),_0x669e('0x67'),_0x669e('0x68'),_0x669e('0x69'),_0x669e('0x6a'),_0x669e('0x68'),'company'];_[_0x669e('0x6b')](_0x3f89ab,function(_0x2dffdf){return _0x2b2df9[_0x669e('0x6c')](_0x2dffdf[_0x669e('0x2c')])||!_0x2dffdf[_0x669e('0x6d')]&&_0x2dffdf[_0x669e('0x32')]!==_0x669e('0x6e')&&_0x2dffdf[_0x669e('0x32')]!=='custom_dropdown';});return{'count':_0x3f89ab[_0x669e('0x3a')],'rows':_[_0x669e('0x2f')](_0x3f89ab,function(_0x4dadce){return{'id':_0x4dadce['name'],'name':_0x4dadce['label'],'custom':!_0x4dadce[_0x669e('0x6d')],'options':_0x4dadce[_0x669e('0x6f')]?_['map'](_0x4dadce[_0x669e('0x6f')],function(_0x55a4d9){return{'name':_[_0x669e('0x70')](_0x55a4d9),'value':_0x55a4d9};}):[]};})};}})[_0x669e('0x27')](respondWithResult(_0x26fb61,null))[_0x669e('0x47')](function(_0x3318b9){var _0x3442cc=_0x417cdf[_0x669e('0x34')]['test']?0x1f4:_0x3318b9[_0x669e('0x71')]||0x1f4;logger[_0x669e('0x2a')](_0x669e('0x72'),_0x669e('0x5a'),_0x3442cc,JSON[_0x669e('0x73')](_0x3318b9));delete _0x3318b9[_0x669e('0x2c')];if(_0x3442cc===0x191){_0x3442cc=0x190;}_0x26fb61[_0x669e('0x1b')](_0x3442cc)[_0x669e('0x2d')](_0x417cdf['query'][_0x669e('0x74')]?{'message':_0x669e('0x75'),'statusCode':_0x3318b9[_0x669e('0x71')]}:_0x3318b9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 0f40b0d..ef57928 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 _0x8742=['api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x2662ad,_0x116983){var _0x1451c7=function(_0x49916c){while(--_0x49916c){_0x2662ad['push'](_0x2662ad['shift']());}};_0x1451c7(++_0x116983);}(_0x8742,0x14f));var _0x2874=function(_0x1e168d,_0x4e6403){_0x1e168d=_0x1e168d-0x0;var _0x4bc4d4=_0x8742[_0x1e168d];return _0x4bc4d4;};'use strict';var _=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var logger=require(_0x2874('0x2'))(_0x2874('0x3'));var moment=require(_0x2874('0x4'));var BPromise=require(_0x2874('0x5'));var rp=require(_0x2874('0x6'));var fs=require('fs');var path=require(_0x2874('0x7'));var rimraf=require(_0x2874('0x8'));var config=require('../../config/environment');var attributes=require(_0x2874('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x2874('0xa')]=function(_0x106163,_0x51bb51){return _0x106163['define'](_0x2874('0xb'),attributes,{'tableName':_0x2874('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63de=['int_freshdesk_accounts','lodash','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x63de,0x1e1));var _0xe63d=function(_0x5d1bb0,_0x1791c8){_0x5d1bb0=_0x5d1bb0-0x0;var _0x49163b=_0x63de[_0x5d1bb0];return _0x49163b;};'use strict';var _=require(_0xe63d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe63d('0x1'));var BPromise=require(_0xe63d('0x2'));var rp=require(_0xe63d('0x3'));var fs=require('fs');var path=require(_0xe63d('0x4'));var rimraf=require(_0xe63d('0x5'));var config=require('../../config/environment');var attributes=require(_0xe63d('0x6'));var integrations=require(_0xe63d('0x7'));module[_0xe63d('0x8')]=function(_0x2e3762,_0x23df4b){return _0x2e3762[_0xe63d('0x9')](_0xe63d('0xa'),attributes,{'tableName':_0xe63d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e5d018d..b645e97 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 _0x1b69=['client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','map','model','include','ShowFreshdeskAccount','find','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x228aae,_0x36f2a4){var _0x4c9447=function(_0x2b3e60){while(--_0x2b3e60){_0x228aae['push'](_0x228aae['shift']());}};_0x4c9447(++_0x36f2a4);}(_0x1b69,0x190));var _0x91b6=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1b69[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x91b6('0x0'));var rs=require(_0x91b6('0x1'));var fs=require('fs');var Redis=require(_0x91b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91b6('0x3'));var logger=require(_0x91b6('0x4'))(_0x91b6('0x5'));var config=require(_0x91b6('0x6'));var jayson=require(_0x91b6('0x7'));var client=jayson[_0x91b6('0x8')][_0x91b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x407d3e,_0x169a4a,_0x455203){return new BPromise(function(_0xabc083,_0x1ef7ff){return client[_0x91b6('0xa')](_0x407d3e,_0x455203)[_0x91b6('0xb')](function(_0x564e34){logger['info'](_0x91b6('0xc'),_0x169a4a,_0x91b6('0xd'));logger[_0x91b6('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x169a4a,_0x91b6('0xd'),JSON[_0x91b6('0xf')](_0x564e34));if(_0x564e34[_0x91b6('0x10')]){if(_0x564e34[_0x91b6('0x10')][_0x91b6('0x11')]===0x1f4){logger[_0x91b6('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x169a4a,_0x564e34[_0x91b6('0x10')]['message']);return _0x1ef7ff(_0x564e34[_0x91b6('0x10')][_0x91b6('0x12')]);}logger[_0x91b6('0x10')](_0x91b6('0xc'),_0x169a4a,_0x564e34['error'][_0x91b6('0x12')]);return _0xabc083(_0x564e34[_0x91b6('0x10')][_0x91b6('0x12')]);}else{logger[_0x91b6('0x13')](_0x91b6('0xc'),_0x169a4a,'request\x20sent');_0xabc083(_0x564e34[_0x91b6('0x14')][_0x91b6('0x12')]);}})[_0x91b6('0x15')](function(_0x15791c){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x169a4a,_0x15791c);_0x1ef7ff(_0x15791c);});});}exports[_0x91b6('0x16')]=function(_0xf29bcf){var _0x191b17=this;return new Promise(function(_0x1693e5,_0xcb408d){return db[_0x91b6('0x17')]['findAll']({'raw':_0xf29bcf[_0x91b6('0x18')]?_0xf29bcf['options'][_0x91b6('0x19')]===undefined?!![]:![]:!![],'where':_0xf29bcf[_0x91b6('0x18')]?_0xf29bcf[_0x91b6('0x18')][_0x91b6('0x1a')]||null:null,'attributes':_0xf29bcf[_0x91b6('0x18')]?_0xf29bcf[_0x91b6('0x18')][_0x91b6('0x1b')]||null:null,'limit':_0xf29bcf[_0x91b6('0x18')]?_0xf29bcf['options'][_0x91b6('0x1c')]||null:null,'include':_0xf29bcf[_0x91b6('0x18')]?_0xf29bcf[_0x91b6('0x18')]['include']?_[_0x91b6('0x1d')](_0xf29bcf[_0x91b6('0x18')]['include'],function(_0x53675b){return{'model':db[_0x53675b[_0x91b6('0x1e')]],'as':_0x53675b['as'],'attributes':_0x53675b[_0x91b6('0x1b')],'include':_0x53675b[_0x91b6('0x1f')]?_[_0x91b6('0x1d')](_0x53675b[_0x91b6('0x1f')],function(_0x582775){return{'model':db[_0x582775[_0x91b6('0x1e')]],'as':_0x582775['as'],'attributes':_0x582775[_0x91b6('0x1b')],'include':_0x582775['include']?_[_0x91b6('0x1d')](_0x582775[_0x91b6('0x1f')],function(_0x27a485){return{'model':db[_0x27a485[_0x91b6('0x1e')]],'as':_0x27a485['as'],'attributes':_0x27a485[_0x91b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91b6('0xb')](function(_0x3fada5){logger[_0x91b6('0x13')](_0x91b6('0x16'),_0xf29bcf);logger[_0x91b6('0xe')]('GetFreshdeskAccount',_0xf29bcf,JSON[_0x91b6('0xf')](_0x3fada5));_0x1693e5(_0x3fada5);})[_0x91b6('0x15')](function(_0x2993ba){logger[_0x91b6('0x10')](_0x91b6('0x16'),_0x2993ba[_0x91b6('0x12')],_0xf29bcf);_0xcb408d(_0x191b17[_0x91b6('0x10')](0x1f4,_0x2993ba[_0x91b6('0x12')]));});});};exports[_0x91b6('0x20')]=function(_0x2c5804){var _0x2b9cb2=this;return new Promise(function(_0x3fa8e5,_0x3c76e3){return db[_0x91b6('0x17')][_0x91b6('0x21')]({'raw':_0x2c5804[_0x91b6('0x18')]?_0x2c5804[_0x91b6('0x18')][_0x91b6('0x19')]===undefined?!![]:![]:!![],'where':_0x2c5804[_0x91b6('0x18')]?_0x2c5804[_0x91b6('0x18')][_0x91b6('0x1a')]||null:null,'attributes':_0x2c5804[_0x91b6('0x18')]?_0x2c5804['options'][_0x91b6('0x1b')]||null:null,'include':_0x2c5804[_0x91b6('0x18')]?_0x2c5804[_0x91b6('0x18')][_0x91b6('0x1f')]?_['map'](_0x2c5804['options'][_0x91b6('0x1f')],function(_0x549c5e){return{'model':db[_0x549c5e[_0x91b6('0x1e')]],'as':_0x549c5e['as'],'attributes':_0x549c5e[_0x91b6('0x1b')],'include':_0x549c5e['include']?_['map'](_0x549c5e[_0x91b6('0x1f')],function(_0x2223b5){return{'model':db[_0x2223b5['model']],'as':_0x2223b5['as'],'attributes':_0x2223b5[_0x91b6('0x1b')],'include':_0x2223b5[_0x91b6('0x1f')]?_[_0x91b6('0x1d')](_0x2223b5['include'],function(_0x407a60){return{'model':db[_0x407a60[_0x91b6('0x1e')]],'as':_0x407a60['as'],'attributes':_0x407a60[_0x91b6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b655){logger[_0x91b6('0x13')](_0x91b6('0x20'),_0x2c5804);logger[_0x91b6('0xe')](_0x91b6('0x20'),_0x2c5804,JSON[_0x91b6('0xf')](_0x17b655));_0x3fa8e5(_0x17b655);})[_0x91b6('0x15')](function(_0x315da7){logger[_0x91b6('0x10')](_0x91b6('0x20'),_0x315da7[_0x91b6('0x12')],_0x2c5804);_0x3c76e3(_0x2b9cb2[_0x91b6('0x10')](0x1f4,_0x315da7[_0x91b6('0x12')]));});});}; \ No newline at end of file +var _0xcf8e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf8e,0x160));var _0xecf8=function(_0x4f9094,_0x7fde8a){_0x4f9094=_0x4f9094-0x0;var _0x5b9cae=_0xcf8e[_0x4f9094];return _0x5b9cae;};'use strict';var _=require(_0xecf8('0x0'));var util=require(_0xecf8('0x1'));var moment=require(_0xecf8('0x2'));var BPromise=require(_0xecf8('0x3'));var rs=require(_0xecf8('0x4'));var fs=require('fs');var Redis=require(_0xecf8('0x5'));var db=require(_0xecf8('0x6'))['db'];var utils=require(_0xecf8('0x7'));var logger=require(_0xecf8('0x8'))(_0xecf8('0x9'));var config=require(_0xecf8('0xa'));var jayson=require(_0xecf8('0xb'));var client=jayson[_0xecf8('0xc')][_0xecf8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4628f7,_0xcfa053,_0x60d3ed){return new BPromise(function(_0x459a07,_0x43eb1f){return client[_0xecf8('0xe')](_0x4628f7,_0x60d3ed)[_0xecf8('0xf')](function(_0x47400c){logger[_0xecf8('0x10')](_0xecf8('0x11'),_0xcfa053,_0xecf8('0x12'));logger[_0xecf8('0x13')](_0xecf8('0x14'),_0xcfa053,_0xecf8('0x12'),JSON[_0xecf8('0x15')](_0x47400c));if(_0x47400c[_0xecf8('0x16')]){if(_0x47400c[_0xecf8('0x16')][_0xecf8('0x17')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xcfa053,_0x47400c[_0xecf8('0x16')][_0xecf8('0x18')]);return _0x43eb1f(_0x47400c[_0xecf8('0x16')][_0xecf8('0x18')]);}logger[_0xecf8('0x16')](_0xecf8('0x11'),_0xcfa053,_0x47400c['error']['message']);return _0x459a07(_0x47400c['error']['message']);}else{logger[_0xecf8('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xcfa053,_0xecf8('0x12'));_0x459a07(_0x47400c[_0xecf8('0x19')][_0xecf8('0x18')]);}})['catch'](function(_0x1a00e4){logger[_0xecf8('0x16')](_0xecf8('0x11'),_0xcfa053,_0x1a00e4);_0x43eb1f(_0x1a00e4);});});}exports[_0xecf8('0x1a')]=function(_0x1e3c9e){var _0x4a1d03=this;return new Promise(function(_0x381a09,_0x934291){return db[_0xecf8('0x1b')][_0xecf8('0x1c')]({'raw':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')]['where']||null:null,'attributes':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e['options'][_0xecf8('0x1e')]||null:null,'limit':_0x1e3c9e['options']?_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x1f')]||null:null,'include':_0x1e3c9e[_0xecf8('0x1d')]?_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x1e3c9e[_0xecf8('0x1d')][_0xecf8('0x20')],function(_0x1d140c){return{'model':db[_0x1d140c[_0xecf8('0x22')]],'as':_0x1d140c['as'],'attributes':_0x1d140c[_0xecf8('0x1e')],'include':_0x1d140c[_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x1d140c['include'],function(_0x57b5ab){return{'model':db[_0x57b5ab[_0xecf8('0x22')]],'as':_0x57b5ab['as'],'attributes':_0x57b5ab[_0xecf8('0x1e')],'include':_0x57b5ab['include']?_[_0xecf8('0x21')](_0x57b5ab[_0xecf8('0x20')],function(_0x325a40){return{'model':db[_0x325a40[_0xecf8('0x22')]],'as':_0x325a40['as'],'attributes':_0x325a40[_0xecf8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13f4b1){logger[_0xecf8('0x10')](_0xecf8('0x1a'),_0x1e3c9e);logger['debug'](_0xecf8('0x1a'),_0x1e3c9e,JSON['stringify'](_0x13f4b1));_0x381a09(_0x13f4b1);})['catch'](function(_0x4731b6){logger[_0xecf8('0x16')](_0xecf8('0x1a'),_0x4731b6['message'],_0x1e3c9e);_0x934291(_0x4a1d03[_0xecf8('0x16')](0x1f4,_0x4731b6[_0xecf8('0x18')]));});});};exports[_0xecf8('0x23')]=function(_0x7d60f){var _0x5662b1=this;return new Promise(function(_0x1ed780,_0x204a6c){return db['FreshdeskAccount'][_0xecf8('0x24')]({'raw':_0x7d60f['options']?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x25')]===undefined?!![]:![]:!![],'where':_0x7d60f[_0xecf8('0x1d')]?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x26')]||null:null,'attributes':_0x7d60f['options']?_0x7d60f[_0xecf8('0x1d')]['attributes']||null:null,'include':_0x7d60f[_0xecf8('0x1d')]?_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x20')]?_['map'](_0x7d60f[_0xecf8('0x1d')][_0xecf8('0x20')],function(_0x4bab6e){return{'model':db[_0x4bab6e[_0xecf8('0x22')]],'as':_0x4bab6e['as'],'attributes':_0x4bab6e[_0xecf8('0x1e')],'include':_0x4bab6e[_0xecf8('0x20')]?_[_0xecf8('0x21')](_0x4bab6e[_0xecf8('0x20')],function(_0x46938e){return{'model':db[_0x46938e[_0xecf8('0x22')]],'as':_0x46938e['as'],'attributes':_0x46938e[_0xecf8('0x1e')],'include':_0x46938e[_0xecf8('0x20')]?_['map'](_0x46938e[_0xecf8('0x20')],function(_0x320fab){return{'model':db[_0x320fab[_0xecf8('0x22')]],'as':_0x320fab['as'],'attributes':_0x320fab[_0xecf8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecf8('0xf')](function(_0x1faa15){logger[_0xecf8('0x10')](_0xecf8('0x23'),_0x7d60f);logger[_0xecf8('0x13')](_0xecf8('0x23'),_0x7d60f,JSON['stringify'](_0x1faa15));_0x1ed780(_0x1faa15);})[_0xecf8('0x27')](function(_0x5b6c8a){logger[_0xecf8('0x16')](_0xecf8('0x23'),_0x5b6c8a[_0xecf8('0x18')],_0x7d60f);_0x204a6c(_0x5662b1[_0xecf8('0x16')](0x1f4,_0x5b6c8a[_0xecf8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ced7a8d..76450d5 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 _0x6f22=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','setTags','/:id','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x388b47,_0x5cefc6){var _0x2996b9=function(_0x42e6c8){while(--_0x42e6c8){_0x388b47['push'](_0x388b47['shift']());}};_0x2996b9(++_0x5cefc6);}(_0x6f22,0x171));var _0x26f2=function(_0x188199,_0x5c95c3){_0x188199=_0x188199-0x0;var _0x35c809=_0x6f22[_0x188199];return _0x35c809;};'use strict';var multer=require(_0x26f2('0x0'));var util=require(_0x26f2('0x1'));var path=require(_0x26f2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x26f2('0x3'));var auth=require(_0x26f2('0x4'));var interaction=require(_0x26f2('0x5'));var config=require(_0x26f2('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x26f2('0x7')](),controller['index']);router[_0x26f2('0x8')]('/:id',auth[_0x26f2('0x7')](),controller['show']);router[_0x26f2('0x8')](_0x26f2('0x9'),auth['isAuthenticated'](),controller['getFields']);router[_0x26f2('0x8')](_0x26f2('0xa'),auth[_0x26f2('0x7')](),controller[_0x26f2('0xb')]);router[_0x26f2('0x8')]('/:id/descriptions',auth[_0x26f2('0x7')](),controller[_0x26f2('0xc')]);router[_0x26f2('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x26f2('0xd')]('/',auth[_0x26f2('0x7')](),controller[_0x26f2('0xe')]);router[_0x26f2('0xd')]('/:id/tags',auth[_0x26f2('0x7')](),controller[_0x26f2('0xf')]);router['put'](_0x26f2('0x10'),auth[_0x26f2('0x7')](),controller['update']);router['delete'](_0x26f2('0x10'),auth[_0x26f2('0x7')](),controller['destroy']);module[_0x26f2('0x11')]=router; \ No newline at end of file +var _0xd01c=['../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x53d99f,_0x4caba7){var _0x1ee367=function(_0x30d961){while(--_0x30d961){_0x53d99f['push'](_0x53d99f['shift']());}};_0x1ee367(++_0x4caba7);}(_0xd01c,0xf3));var _0xcd01=function(_0x21e714,_0x1e9068){_0x21e714=_0x21e714-0x0;var _0x784844=_0xd01c[_0x21e714];return _0x784844;};'use strict';var multer=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var path=require(_0xcd01('0x2'));var timeout=require(_0xcd01('0x3'));var express=require(_0xcd01('0x4'));var router=express[_0xcd01('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd01('0x6'));var interaction=require(_0xcd01('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xcd01('0x8')]('/',auth[_0xcd01('0x9')](),controller[_0xcd01('0xa')]);router['get'](_0xcd01('0xb'),auth[_0xcd01('0x9')](),controller['show']);router[_0xcd01('0x8')](_0xcd01('0xc'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xd')]);router[_0xcd01('0x8')](_0xcd01('0xe'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xf')]);router['get']('/:id/descriptions',auth[_0xcd01('0x9')](),controller[_0xcd01('0x10')]);router[_0xcd01('0x8')](_0xcd01('0x11'),auth['isAuthenticated'](),controller[_0xcd01('0x12')]);router[_0xcd01('0x13')]('/',auth[_0xcd01('0x9')](),controller[_0xcd01('0x14')]);router[_0xcd01('0x13')](_0xcd01('0x11'),auth[_0xcd01('0x9')](),controller[_0xcd01('0x15')]);router[_0xcd01('0x16')](_0xcd01('0xb'),auth['isAuthenticated'](),controller[_0xcd01('0x17')]);router['delete'](_0xcd01('0xb'),auth[_0xcd01('0x9')](),controller['destroy']);module[_0xcd01('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 1c3e358..76f23d7 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 _0x1ebc=['STRING','sequelize','exports'];(function(_0x546967,_0x29ff0a){var _0x3fa6c6=function(_0xe05b36){while(--_0xe05b36){_0x546967['push'](_0x546967['shift']());}};_0x3fa6c6(++_0x29ff0a);}(_0x1ebc,0x8e));var _0xc1eb=function(_0x5eced7,_0x220098){_0x5eced7=_0x5eced7-0x0;var _0xdcfb51=_0x1ebc[_0x5eced7];return _0xdcfb51;};'use strict';var Sequelize=require(_0xc1eb('0x0'));module[_0xc1eb('0x1')]={'name':{'type':Sequelize[_0xc1eb('0x2')]},'description':{'type':Sequelize[_0xc1eb('0x2')]}}; \ No newline at end of file +var _0x9fc5=['sequelize','exports','STRING'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0x9fc5,0x129));var _0x59fc=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x9fc5[_0x5400a1];return _0x4006c7;};'use strict';var Sequelize=require(_0x59fc('0x0'));module[_0x59fc('0x1')]={'name':{'type':Sequelize[_0x59fc('0x2')]},'description':{'type':Sequelize[_0x59fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7088c09..0d8b7b4 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 _0xbcce=['include','findAll','then','rows','params','options','find','create','catch','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xbcce,0x15e));var _0xebcc=function(_0x5f014a,_0x217aa7){_0x5f014a=_0x5f014a-0x0;var _0x42f9c9=_0xbcce[_0x5f014a];return _0x42f9c9;};'use strict';var emlformat=require(_0xebcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebcc('0x1'));var jsonpatch=require(_0xebcc('0x2'));var rp=require(_0xebcc('0x3'));var moment=require(_0xebcc('0x4'));var BPromise=require(_0xebcc('0x5'));var Mustache=require(_0xebcc('0x6'));var util=require(_0xebcc('0x7'));var path=require(_0xebcc('0x8'));var sox=require(_0xebcc('0x9'));var csv=require(_0xebcc('0xa'));var ejs=require(_0xebcc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xebcc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xebcc('0xd'));var Redis=require(_0xebcc('0xe'));var authService=require(_0xebcc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebcc('0x10'))(_0xebcc('0x11'));var utils=require(_0xebcc('0x12'));var config=require(_0xebcc('0x13'));var licenseUtil=require(_0xebcc('0x14'));var db=require(_0xebcc('0x15'))['db'];function respondWithStatusCode(_0x297f8f,_0x385091){_0x385091=_0x385091||0xcc;return function(_0x459021){if(_0x459021){return _0x297f8f[_0xebcc('0x16')](_0x385091);}return _0x297f8f[_0xebcc('0x17')](_0x385091)[_0xebcc('0x18')]();};}function respondWithResult(_0x52c563,_0x4b2196){_0x4b2196=_0x4b2196||0xc8;return function(_0x31ff1b){if(_0x31ff1b){return _0x52c563[_0xebcc('0x17')](_0x4b2196)['json'](_0x31ff1b);}};}function respondWithFilteredResult(_0x56452b,_0x20bcc2){return function(_0x2857ac){if(_0x2857ac){var _0x43604d=typeof _0x20bcc2['offset']==='undefined'&&typeof _0x20bcc2[_0xebcc('0x19')]===_0xebcc('0x1a');var _0x4f2b47=_0x2857ac[_0xebcc('0x1b')];var _0x1f692e=_0x43604d?0x0:_0x20bcc2[_0xebcc('0x1c')];var _0x2a0af5=_0x43604d?_0x2857ac[_0xebcc('0x1b')]:_0x20bcc2[_0xebcc('0x1c')]+_0x20bcc2[_0xebcc('0x19')];var _0x4240b3;if(_0x2a0af5>=_0x4f2b47){_0x2a0af5=_0x4f2b47;_0x4240b3=0xc8;}else{_0x4240b3=0xce;}_0x56452b[_0xebcc('0x17')](_0x4240b3);return _0x56452b[_0xebcc('0x1d')](_0xebcc('0x1e'),_0x1f692e+'-'+_0x2a0af5+'/'+_0x4f2b47)[_0xebcc('0x1f')](_0x2857ac);}return null;};}function patchUpdates(_0x5796da){return function(_0xa47712){try{jsonpatch[_0xebcc('0x20')](_0xa47712,_0x5796da,!![]);}catch(_0x32783f){return BPromise[_0xebcc('0x21')](_0x32783f);}return _0xa47712[_0xebcc('0x22')]();};}function saveUpdates(_0x86e27f,_0xd747a4){return function(_0x101dc5){if(_0x101dc5){return _0x101dc5[_0xebcc('0x23')](_0x86e27f)['then'](function(_0x5eb5f4){return _0x5eb5f4;});}return null;};}function removeEntity(_0x56aed3,_0x419da8){return function(_0x4af5c7){if(_0x4af5c7){return _0x4af5c7[_0xebcc('0x24')]()['then'](function(){_0x56aed3[_0xebcc('0x17')](0xcc)[_0xebcc('0x18')]();});}};}function handleEntityNotFound(_0x1da7ea,_0x4f51a4){return function(_0x5da553){if(!_0x5da553){_0x1da7ea[_0xebcc('0x16')](0x194);}return _0x5da553;};}function handleError(_0xd8c471,_0xbbaa94){_0xbbaa94=_0xbbaa94||0x1f4;return function(_0x492e05){logger[_0xebcc('0x25')](_0x492e05['stack']);if(_0x492e05['name']){delete _0x492e05['name'];}_0xd8c471[_0xebcc('0x17')](_0xbbaa94)[_0xebcc('0x26')](_0x492e05);};}exports[_0xebcc('0x27')]=function(_0x319840,_0x180d8c){var _0x8f66fa={},_0x458546={},_0x4a8a55={'count':0x0,'rows':[]};var _0x5a4966=_[_0xebcc('0x28')](db[_0xebcc('0x29')][_0xebcc('0x2a')],function(_0x378997){return{'name':_0x378997[_0xebcc('0x2b')],'type':_0x378997[_0xebcc('0x2c')][_0xebcc('0x2d')]};});_0x458546[_0xebcc('0x2e')]=_['map'](_0x5a4966,_0xebcc('0x2f'));_0x458546[_0xebcc('0x30')]=_[_0xebcc('0x31')](_0x319840['query']);_0x458546[_0xebcc('0x32')]=_[_0xebcc('0x33')](_0x458546[_0xebcc('0x2e')],_0x458546[_0xebcc('0x30')]);_0x8f66fa[_0xebcc('0x34')]=_[_0xebcc('0x33')](_0x458546['model'],qs[_0xebcc('0x35')](_0x319840[_0xebcc('0x30')][_0xebcc('0x35')]));_0x8f66fa[_0xebcc('0x34')]=_0x8f66fa[_0xebcc('0x34')][_0xebcc('0x36')]?_0x8f66fa[_0xebcc('0x34')]:_0x458546[_0xebcc('0x2e')];if(!_0x319840[_0xebcc('0x30')][_0xebcc('0x37')](_0xebcc('0x38'))){_0x8f66fa[_0xebcc('0x19')]=qs[_0xebcc('0x19')](_0x319840['query']['limit']);_0x8f66fa[_0xebcc('0x1c')]=qs[_0xebcc('0x1c')](_0x319840[_0xebcc('0x30')]['offset']);}_0x8f66fa[_0xebcc('0x39')]=qs['sort'](_0x319840['query'][_0xebcc('0x3a')]);_0x8f66fa['where']=qs[_0xebcc('0x32')](_[_0xebcc('0x3b')](_0x319840[_0xebcc('0x30')],_0x458546['filters']),_0x5a4966);if(_0x319840['query'][_0xebcc('0x3c')]){_0x8f66fa['where']=_[_0xebcc('0x3d')](_0x8f66fa[_0xebcc('0x3e')],{'$or':_[_0xebcc('0x28')](_0x5a4966,function(_0x316506){if(_0x316506[_0xebcc('0x2c')]!==_0xebcc('0x3f')){var _0x37eb43={};_0x37eb43[_0x316506['name']]={'$like':'%'+_0x319840[_0xebcc('0x30')][_0xebcc('0x3c')]+'%'};return _0x37eb43;}})});}_0x8f66fa=_[_0xebcc('0x3d')]({},_0x8f66fa,_0x319840['options']);var _0x1edac3={'where':_0x8f66fa['where']};return db[_0xebcc('0x29')]['count'](_0x1edac3)['then'](function(_0x9b5d91){_0x4a8a55[_0xebcc('0x1b')]=_0x9b5d91;if(_0x319840[_0xebcc('0x30')][_0xebcc('0x40')]){_0x8f66fa[_0xebcc('0x41')]=[{'all':!![]}];}return db[_0xebcc('0x29')][_0xebcc('0x42')](_0x8f66fa);})[_0xebcc('0x43')](function(_0x3cc5c6){_0x4a8a55[_0xebcc('0x44')]=_0x3cc5c6;return _0x4a8a55;})['then'](respondWithFilteredResult(_0x180d8c,_0x8f66fa))['catch'](handleError(_0x180d8c,null));};exports['show']=function(_0x36efcf,_0x8ceb58){var _0x4df59b={'raw':![],'where':{'id':_0x36efcf[_0xebcc('0x45')]['id']}},_0x52e8c7={};_0x52e8c7[_0xebcc('0x2e')]=_[_0xebcc('0x31')](db['FreshdeskConfiguration'][_0xebcc('0x2a')]);_0x52e8c7['query']=_[_0xebcc('0x31')](_0x36efcf[_0xebcc('0x30')]);_0x52e8c7[_0xebcc('0x32')]=_[_0xebcc('0x33')](_0x52e8c7[_0xebcc('0x2e')],_0x52e8c7[_0xebcc('0x30')]);_0x4df59b['attributes']=_['intersection'](_0x52e8c7[_0xebcc('0x2e')],qs[_0xebcc('0x35')](_0x36efcf[_0xebcc('0x30')][_0xebcc('0x35')]));_0x4df59b[_0xebcc('0x34')]=_0x4df59b['attributes'][_0xebcc('0x36')]?_0x4df59b[_0xebcc('0x34')]:_0x52e8c7['model'];if(_0x36efcf[_0xebcc('0x30')][_0xebcc('0x40')]){_0x4df59b['include']=[{'all':!![]}];}_0x4df59b=_[_0xebcc('0x3d')]({},_0x4df59b,_0x36efcf[_0xebcc('0x46')]);return db[_0xebcc('0x29')][_0xebcc('0x47')](_0x4df59b)[_0xebcc('0x43')](handleEntityNotFound(_0x8ceb58,null))[_0xebcc('0x43')](respondWithResult(_0x8ceb58,null))['catch'](handleError(_0x8ceb58,null));};exports[_0xebcc('0x48')]=function(_0x2dcd7a,_0x1f4c31){return db[_0xebcc('0x29')]['create'](_0x2dcd7a['body'],{})[_0xebcc('0x43')](respondWithResult(_0x1f4c31,0xc9))[_0xebcc('0x49')](handleError(_0x1f4c31,null));};exports['update']=function(_0x1a4694,_0x28977f){if(_0x1a4694[_0xebcc('0x4a')]['id']){delete _0x1a4694[_0xebcc('0x4a')]['id'];}return db[_0xebcc('0x29')]['find']({'where':{'id':_0x1a4694[_0xebcc('0x45')]['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x28977f,null))[_0xebcc('0x43')](saveUpdates(_0x1a4694[_0xebcc('0x4a')],null))[_0xebcc('0x43')](respondWithResult(_0x28977f,null))[_0xebcc('0x49')](handleError(_0x28977f,null));};exports['destroy']=function(_0x30a902,_0x348b5d){return db[_0xebcc('0x29')]['find']({'where':{'id':_0x30a902['params']['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x348b5d,null))[_0xebcc('0x43')](removeEntity(_0x348b5d,null))['catch'](handleError(_0x348b5d,null));};exports[_0xebcc('0x4b')]=function(_0xf960bd,_0x170fc9,_0x5ed9ff){var _0x592aad={};var _0x589a95={};var _0x4665c9;var _0x3b17b2;return db[_0xebcc('0x29')][_0xebcc('0x4c')]({'where':{'id':_0xf960bd['params']['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x170fc9,null))['then'](function(_0x4bffab){if(_0x4bffab){_0x4665c9=_0x4bffab;_0x589a95['model']=_[_0xebcc('0x31')](db[_0xebcc('0x4d')]['rawAttributes']);_0x589a95[_0xebcc('0x30')]=_[_0xebcc('0x31')](_0xf960bd[_0xebcc('0x30')]);_0x589a95[_0xebcc('0x32')]=_['intersection'](_0x589a95[_0xebcc('0x2e')],_0x589a95[_0xebcc('0x30')]);_0x592aad[_0xebcc('0x34')]=_['intersection'](_0x589a95['model'],qs[_0xebcc('0x35')](_0xf960bd[_0xebcc('0x30')][_0xebcc('0x35')]));_0x592aad[_0xebcc('0x34')]=_0x592aad[_0xebcc('0x34')][_0xebcc('0x36')]?_0x592aad[_0xebcc('0x34')]:_0x589a95['model'];_0x592aad[_0xebcc('0x39')]=qs[_0xebcc('0x3a')](_0xf960bd[_0xebcc('0x30')][_0xebcc('0x3a')]);_0x592aad[_0xebcc('0x3e')]=qs[_0xebcc('0x32')](_[_0xebcc('0x3b')](_0xf960bd[_0xebcc('0x30')],_0x589a95[_0xebcc('0x32')]));if(_0xf960bd[_0xebcc('0x30')]['filter']){_0x592aad[_0xebcc('0x3e')]=_[_0xebcc('0x3d')](_0x592aad['where'],{'$or':_[_0xebcc('0x28')](_0x592aad['attributes'],function(_0x3c6f8a){var _0x5e81e9={};_0x5e81e9[_0x3c6f8a]={'$like':'%'+_0xf960bd[_0xebcc('0x30')][_0xebcc('0x3c')]+'%'};return _0x5e81e9;})});}_0x592aad=_[_0xebcc('0x3d')]({},_0x592aad,_0xf960bd['options']);return _0x4665c9['getFields'](_0x592aad);}})[_0xebcc('0x43')](function(_0x3dcfe6){if(_0x3dcfe6){_0x3b17b2=_0x3dcfe6['length'];if(!_0xf960bd[_0xebcc('0x30')]['hasOwnProperty'](_0xebcc('0x38'))){_0x592aad['limit']=qs[_0xebcc('0x19')](_0xf960bd['query'][_0xebcc('0x19')]);_0x592aad[_0xebcc('0x1c')]=qs[_0xebcc('0x1c')](_0xf960bd['query']['offset']);}return _0x4665c9[_0xebcc('0x4b')](_0x592aad);}})[_0xebcc('0x43')](function(_0x490044){if(_0x490044){return _0x490044?{'count':_0x3b17b2,'rows':_0x490044}:null;}})[_0xebcc('0x43')](respondWithResult(_0x170fc9,null))[_0xebcc('0x49')](handleError(_0x170fc9,null));};exports[_0xebcc('0x4e')]=function(_0x3605cc,_0x5621de,_0x439dc4){var _0x308576={};var _0x555684={};var _0x4239da;var _0x2f5cf3;return db[_0xebcc('0x29')][_0xebcc('0x4c')]({'where':{'id':_0x3605cc['params']['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x5621de,null))[_0xebcc('0x43')](function(_0x15cac3){if(_0x15cac3){_0x4239da=_0x15cac3;_0x555684[_0xebcc('0x2e')]=_[_0xebcc('0x31')](db[_0xebcc('0x4d')][_0xebcc('0x2a')]);_0x555684[_0xebcc('0x30')]=_[_0xebcc('0x31')](_0x3605cc[_0xebcc('0x30')]);_0x555684[_0xebcc('0x32')]=_['intersection'](_0x555684[_0xebcc('0x2e')],_0x555684['query']);_0x308576[_0xebcc('0x34')]=_[_0xebcc('0x33')](_0x555684[_0xebcc('0x2e')],qs[_0xebcc('0x35')](_0x3605cc['query'][_0xebcc('0x35')]));_0x308576[_0xebcc('0x34')]=_0x308576[_0xebcc('0x34')][_0xebcc('0x36')]?_0x308576[_0xebcc('0x34')]:_0x555684[_0xebcc('0x2e')];_0x308576['order']=qs[_0xebcc('0x3a')](_0x3605cc[_0xebcc('0x30')][_0xebcc('0x3a')]);_0x308576[_0xebcc('0x3e')]=qs[_0xebcc('0x32')](_['pick'](_0x3605cc[_0xebcc('0x30')],_0x555684[_0xebcc('0x32')]));if(_0x3605cc[_0xebcc('0x30')]['filter']){_0x308576[_0xebcc('0x3e')]=_[_0xebcc('0x3d')](_0x308576[_0xebcc('0x3e')],{'$or':_[_0xebcc('0x28')](_0x308576[_0xebcc('0x34')],function(_0x2f21b7){var _0x3d97d5={};_0x3d97d5[_0x2f21b7]={'$like':'%'+_0x3605cc[_0xebcc('0x30')][_0xebcc('0x3c')]+'%'};return _0x3d97d5;})});}_0x308576=_[_0xebcc('0x3d')]({},_0x308576,_0x3605cc[_0xebcc('0x46')]);return _0x4239da['getSubjects'](_0x308576);}})['then'](function(_0x48fc38){if(_0x48fc38){_0x2f5cf3=_0x48fc38['length'];if(!_0x3605cc[_0xebcc('0x30')][_0xebcc('0x37')](_0xebcc('0x38'))){_0x308576['limit']=qs[_0xebcc('0x19')](_0x3605cc['query'][_0xebcc('0x19')]);_0x308576[_0xebcc('0x1c')]=qs['offset'](_0x3605cc[_0xebcc('0x30')][_0xebcc('0x1c')]);}return _0x4239da[_0xebcc('0x4e')](_0x308576);}})[_0xebcc('0x43')](function(_0x24d604){if(_0x24d604){return _0x24d604?{'count':_0x2f5cf3,'rows':_0x24d604}:null;}})[_0xebcc('0x43')](respondWithResult(_0x5621de,null))[_0xebcc('0x49')](handleError(_0x5621de,null));};exports[_0xebcc('0x4f')]=function(_0x3a461e,_0x354eef,_0x1c08f0){var _0x46297b={};var _0x2a7389={};var _0x3e8e98;var _0x269165;return db[_0xebcc('0x29')][_0xebcc('0x4c')]({'where':{'id':_0x3a461e['params']['id']}})['then'](handleEntityNotFound(_0x354eef,null))[_0xebcc('0x43')](function(_0x44fe47){if(_0x44fe47){_0x3e8e98=_0x44fe47;_0x2a7389[_0xebcc('0x2e')]=_[_0xebcc('0x31')](db[_0xebcc('0x4d')][_0xebcc('0x2a')]);_0x2a7389['query']=_[_0xebcc('0x31')](_0x3a461e['query']);_0x2a7389[_0xebcc('0x32')]=_[_0xebcc('0x33')](_0x2a7389[_0xebcc('0x2e')],_0x2a7389[_0xebcc('0x30')]);_0x46297b[_0xebcc('0x34')]=_[_0xebcc('0x33')](_0x2a7389[_0xebcc('0x2e')],qs[_0xebcc('0x35')](_0x3a461e[_0xebcc('0x30')][_0xebcc('0x35')]));_0x46297b[_0xebcc('0x34')]=_0x46297b['attributes'][_0xebcc('0x36')]?_0x46297b[_0xebcc('0x34')]:_0x2a7389[_0xebcc('0x2e')];_0x46297b[_0xebcc('0x39')]=qs[_0xebcc('0x3a')](_0x3a461e[_0xebcc('0x30')][_0xebcc('0x3a')]);_0x46297b[_0xebcc('0x3e')]=qs[_0xebcc('0x32')](_['pick'](_0x3a461e[_0xebcc('0x30')],_0x2a7389[_0xebcc('0x32')]));if(_0x3a461e[_0xebcc('0x30')][_0xebcc('0x3c')]){_0x46297b[_0xebcc('0x3e')]=_[_0xebcc('0x3d')](_0x46297b['where'],{'$or':_[_0xebcc('0x28')](_0x46297b[_0xebcc('0x34')],function(_0x3f4a33){var _0x2a7987={};_0x2a7987[_0x3f4a33]={'$like':'%'+_0x3a461e['query'][_0xebcc('0x3c')]+'%'};return _0x2a7987;})});}_0x46297b=_[_0xebcc('0x3d')]({},_0x46297b,_0x3a461e[_0xebcc('0x46')]);return _0x3e8e98[_0xebcc('0x4f')](_0x46297b);}})['then'](function(_0x2239fa){if(_0x2239fa){_0x269165=_0x2239fa[_0xebcc('0x36')];if(!_0x3a461e[_0xebcc('0x30')][_0xebcc('0x37')]('nolimit')){_0x46297b['limit']=qs['limit'](_0x3a461e['query'][_0xebcc('0x19')]);_0x46297b[_0xebcc('0x1c')]=qs[_0xebcc('0x1c')](_0x3a461e['query'][_0xebcc('0x1c')]);}return _0x3e8e98[_0xebcc('0x4f')](_0x46297b);}})[_0xebcc('0x43')](function(_0x417b6c){if(_0x417b6c){return _0x417b6c?{'count':_0x269165,'rows':_0x417b6c}:null;}})[_0xebcc('0x43')](respondWithResult(_0x354eef,null))['catch'](handleError(_0x354eef,null));};exports['getTags']=function(_0x72ea16,_0x5edd72,_0x540f3d){var _0x5ab2a5={};var _0x1fac77={};var _0x21a82b;var _0x3e1881;return db['FreshdeskConfiguration'][_0xebcc('0x4c')]({'where':{'id':_0x72ea16['params']['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x5edd72,null))[_0xebcc('0x43')](function(_0x4975ac){if(_0x4975ac){_0x21a82b=_0x4975ac;_0x1fac77[_0xebcc('0x2e')]=_[_0xebcc('0x31')](db['Tag'][_0xebcc('0x2a')]);_0x1fac77[_0xebcc('0x30')]=_[_0xebcc('0x31')](_0x72ea16[_0xebcc('0x30')]);_0x1fac77[_0xebcc('0x32')]=_[_0xebcc('0x33')](_0x1fac77[_0xebcc('0x2e')],_0x1fac77[_0xebcc('0x30')]);_0x5ab2a5[_0xebcc('0x34')]=_[_0xebcc('0x33')](_0x1fac77[_0xebcc('0x2e')],qs[_0xebcc('0x35')](_0x72ea16[_0xebcc('0x30')][_0xebcc('0x35')]));_0x5ab2a5[_0xebcc('0x34')]=_0x5ab2a5[_0xebcc('0x34')][_0xebcc('0x36')]?_0x5ab2a5[_0xebcc('0x34')]:_0x1fac77['model'];_0x5ab2a5[_0xebcc('0x39')]=qs[_0xebcc('0x3a')](_0x72ea16[_0xebcc('0x30')][_0xebcc('0x3a')]);_0x5ab2a5[_0xebcc('0x3e')]=qs[_0xebcc('0x32')](_[_0xebcc('0x3b')](_0x72ea16[_0xebcc('0x30')],_0x1fac77[_0xebcc('0x32')]));if(_0x72ea16[_0xebcc('0x30')][_0xebcc('0x3c')]){_0x5ab2a5[_0xebcc('0x3e')]=_['merge'](_0x5ab2a5[_0xebcc('0x3e')],{'$or':_['map'](_0x5ab2a5[_0xebcc('0x34')],function(_0x5a6383){var _0x565460={};_0x565460[_0x5a6383]={'$like':'%'+_0x72ea16[_0xebcc('0x30')]['filter']+'%'};return _0x565460;})});}_0x5ab2a5=_['merge']({},_0x5ab2a5,_0x72ea16['options']);return _0x21a82b['getTags'](_0x5ab2a5);}})['then'](function(_0x351ef1){if(_0x351ef1){_0x3e1881=_0x351ef1['length'];if(!_0x72ea16['query'][_0xebcc('0x37')](_0xebcc('0x38'))){_0x5ab2a5[_0xebcc('0x19')]=qs[_0xebcc('0x19')](_0x72ea16['query']['limit']);_0x5ab2a5['offset']=qs[_0xebcc('0x1c')](_0x72ea16[_0xebcc('0x30')][_0xebcc('0x1c')]);}return _0x21a82b[_0xebcc('0x50')](_0x5ab2a5);}})['then'](function(_0x3c759a){if(_0x3c759a){return _0x3c759a?{'count':_0x3e1881,'rows':_0x3c759a}:null;}})[_0xebcc('0x43')](respondWithResult(_0x5edd72,null))[_0xebcc('0x49')](handleError(_0x5edd72,null));};exports[_0xebcc('0x51')]=function(_0x187990,_0x3bc53b,_0x4b195f){if(_0x187990[_0xebcc('0x4a')]['id']){delete _0x187990['body']['id'];}return db['FreshdeskConfiguration'][_0xebcc('0x4c')]({'where':{'id':_0x187990['params']['id']}})[_0xebcc('0x43')](handleEntityNotFound(_0x3bc53b,null))[_0xebcc('0x43')](function(_0x40b9d3){if(_0x40b9d3){return _0x40b9d3[_0xebcc('0x51')](_0x187990[_0xebcc('0x4a')][_0xebcc('0x52')]||[]);}return null;})[_0xebcc('0x43')](respondWithResult(_0x3bc53b,null))[_0xebcc('0x49')](handleError(_0x3bc53b,null));}; \ No newline at end of file +var _0x6521=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','type','merge','options','FreshdeskConfiguration','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','FreshdeskField','length','getSubjects','order','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x401a6a,_0xc31476){var _0x4176a8=function(_0x370f90){while(--_0x370f90){_0x401a6a['push'](_0x401a6a['shift']());}};_0x4176a8(++_0xc31476);}(_0x6521,0x1ba));var _0x1652=function(_0x2e0720,_0x2c3ea2){_0x2e0720=_0x2e0720-0x0;var _0xf36159=_0x6521[_0x2e0720];return _0xf36159;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1652('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1652('0x1'));var rp=require(_0x1652('0x2'));var moment=require(_0x1652('0x3'));var BPromise=require(_0x1652('0x4'));var Mustache=require(_0x1652('0x5'));var util=require(_0x1652('0x6'));var path=require(_0x1652('0x7'));var sox=require(_0x1652('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1652('0x9'));var _=require(_0x1652('0xa'));var squel=require(_0x1652('0xb'));var crypto=require(_0x1652('0xc'));var jsforce=require(_0x1652('0xd'));var deskjs=require(_0x1652('0xe'));var toCsv=require(_0x1652('0xf'));var querystring=require(_0x1652('0x10'));var Papa=require('papaparse');var Redis=require(_0x1652('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1652('0x12'));var as=require(_0x1652('0x13'));var hardwareService=require(_0x1652('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1652('0x15'));var db=require(_0x1652('0x16'))['db'];function respondWithStatusCode(_0x1d40db,_0x46da5d){_0x46da5d=_0x46da5d||0xcc;return function(_0x48bf42){if(_0x48bf42){return _0x1d40db[_0x1652('0x17')](_0x46da5d);}return _0x1d40db[_0x1652('0x18')](_0x46da5d)['end']();};}function respondWithResult(_0x2f700f,_0xa965d9){_0xa965d9=_0xa965d9||0xc8;return function(_0x3363a4){if(_0x3363a4){return _0x2f700f[_0x1652('0x18')](_0xa965d9)[_0x1652('0x19')](_0x3363a4);}};}function respondWithFilteredResult(_0x1c9bd7,_0x19bf6b){return function(_0x289771){if(_0x289771){var _0xb2be3c=typeof _0x19bf6b[_0x1652('0x1a')]===_0x1652('0x1b')&&typeof _0x19bf6b[_0x1652('0x1c')]==='undefined';var _0x28df1f=_0x289771['count'];var _0x51876c=_0xb2be3c?0x0:_0x19bf6b[_0x1652('0x1a')];var _0x1e7614=_0xb2be3c?_0x289771['count']:_0x19bf6b['offset']+_0x19bf6b[_0x1652('0x1c')];var _0x48cec1;if(_0x1e7614>=_0x28df1f){_0x1e7614=_0x28df1f;_0x48cec1=0xc8;}else{_0x48cec1=0xce;}_0x1c9bd7[_0x1652('0x18')](_0x48cec1);return _0x1c9bd7[_0x1652('0x1d')]('Content-Range',_0x51876c+'-'+_0x1e7614+'/'+_0x28df1f)[_0x1652('0x19')](_0x289771);}return null;};}function patchUpdates(_0x58ea9b){return function(_0x159a03){try{jsonpatch['apply'](_0x159a03,_0x58ea9b,!![]);}catch(_0x462cfe){return BPromise[_0x1652('0x1e')](_0x462cfe);}return _0x159a03[_0x1652('0x1f')]();};}function saveUpdates(_0x510fdb,_0x325cdd){return function(_0x384476){if(_0x384476){return _0x384476[_0x1652('0x20')](_0x510fdb)[_0x1652('0x21')](function(_0x1d9ca0){return _0x1d9ca0;});}return null;};}function removeEntity(_0x29adf2,_0x3af64b){return function(_0x532350){if(_0x532350){return _0x532350[_0x1652('0x22')]()[_0x1652('0x21')](function(){_0x29adf2['status'](0xcc)[_0x1652('0x23')]();});}};}function handleEntityNotFound(_0x1c048e,_0x56cdbf){return function(_0x363605){if(!_0x363605){_0x1c048e[_0x1652('0x17')](0x194);}return _0x363605;};}function handleError(_0x420a8d,_0x476716){_0x476716=_0x476716||0x1f4;return function(_0x4a3325){logger['error'](_0x4a3325[_0x1652('0x24')]);if(_0x4a3325[_0x1652('0x25')]){delete _0x4a3325[_0x1652('0x25')];}_0x420a8d[_0x1652('0x18')](_0x476716)[_0x1652('0x26')](_0x4a3325);};}exports[_0x1652('0x27')]=function(_0x371993,_0x4dc067){var _0x587327={},_0x58331b={},_0x31a0e9={'count':0x0,'rows':[]};var _0x36e764=_[_0x1652('0x28')](db['FreshdeskConfiguration'][_0x1652('0x29')],function(_0x2e1a7b){return{'name':_0x2e1a7b[_0x1652('0x2a')],'type':_0x2e1a7b['type'][_0x1652('0x2b')]};});_0x58331b[_0x1652('0x2c')]=_[_0x1652('0x28')](_0x36e764,_0x1652('0x25'));_0x58331b[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x371993[_0x1652('0x2d')]);_0x58331b['filters']=_[_0x1652('0x2f')](_0x58331b['model'],_0x58331b[_0x1652('0x2d')]);_0x587327['attributes']=_['intersection'](_0x58331b[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x371993[_0x1652('0x2d')][_0x1652('0x30')]));_0x587327['attributes']=_0x587327[_0x1652('0x31')]['length']?_0x587327[_0x1652('0x31')]:_0x58331b['model'];if(!_0x371993[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x587327[_0x1652('0x1c')]=qs['limit'](_0x371993[_0x1652('0x2d')]['limit']);_0x587327[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x371993[_0x1652('0x2d')][_0x1652('0x1a')]);}_0x587327['order']=qs[_0x1652('0x34')](_0x371993['query'][_0x1652('0x34')]);_0x587327[_0x1652('0x35')]=qs['filters'](_['pick'](_0x371993[_0x1652('0x2d')],_0x58331b[_0x1652('0x36')]),_0x36e764);if(_0x371993[_0x1652('0x2d')][_0x1652('0x37')]){_0x587327['where']=_['merge'](_0x587327[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x36e764,function(_0x12cb32){if(_0x12cb32[_0x1652('0x38')]!=='VIRTUAL'){var _0x50bba2={};_0x50bba2[_0x12cb32[_0x1652('0x25')]]={'$like':'%'+_0x371993[_0x1652('0x2d')]['filter']+'%'};return _0x50bba2;}})});}_0x587327=_[_0x1652('0x39')]({},_0x587327,_0x371993[_0x1652('0x3a')]);var _0x273766={'where':_0x587327[_0x1652('0x35')]};return db[_0x1652('0x3b')][_0x1652('0x3c')](_0x273766)[_0x1652('0x21')](function(_0x265956){_0x31a0e9['count']=_0x265956;if(_0x371993['query'][_0x1652('0x3d')]){_0x587327[_0x1652('0x3e')]=[{'all':!![]}];}return db[_0x1652('0x3b')][_0x1652('0x3f')](_0x587327);})[_0x1652('0x21')](function(_0x3649e9){_0x31a0e9[_0x1652('0x40')]=_0x3649e9;return _0x31a0e9;})[_0x1652('0x21')](respondWithFilteredResult(_0x4dc067,_0x587327))[_0x1652('0x41')](handleError(_0x4dc067,null));};exports[_0x1652('0x42')]=function(_0x5072b5,_0x284b7b){var _0x50dafc={'raw':![],'where':{'id':_0x5072b5[_0x1652('0x43')]['id']}},_0x57192f={};_0x57192f[_0x1652('0x2c')]=_[_0x1652('0x2e')](db[_0x1652('0x3b')][_0x1652('0x29')]);_0x57192f[_0x1652('0x2d')]=_['keys'](_0x5072b5[_0x1652('0x2d')]);_0x57192f[_0x1652('0x36')]=_['intersection'](_0x57192f['model'],_0x57192f['query']);_0x50dafc[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x57192f[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x5072b5[_0x1652('0x2d')]['fields']));_0x50dafc[_0x1652('0x31')]=_0x50dafc[_0x1652('0x31')]['length']?_0x50dafc['attributes']:_0x57192f['model'];if(_0x5072b5['query'][_0x1652('0x3d')]){_0x50dafc['include']=[{'all':!![]}];}_0x50dafc=_['merge']({},_0x50dafc,_0x5072b5['options']);return db[_0x1652('0x3b')][_0x1652('0x44')](_0x50dafc)[_0x1652('0x21')](handleEntityNotFound(_0x284b7b,null))[_0x1652('0x21')](respondWithResult(_0x284b7b,null))[_0x1652('0x41')](handleError(_0x284b7b,null));};exports[_0x1652('0x45')]=function(_0x3e26d6,_0xdd6cd5){return db[_0x1652('0x3b')][_0x1652('0x45')](_0x3e26d6[_0x1652('0x46')],{})[_0x1652('0x21')](respondWithResult(_0xdd6cd5,0xc9))[_0x1652('0x41')](handleError(_0xdd6cd5,null));};exports['update']=function(_0x3e8cb7,_0x126e6b){if(_0x3e8cb7['body']['id']){delete _0x3e8cb7['body']['id'];}return db[_0x1652('0x3b')]['find']({'where':{'id':_0x3e8cb7['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x126e6b,null))['then'](saveUpdates(_0x3e8cb7['body'],null))[_0x1652('0x21')](respondWithResult(_0x126e6b,null))['catch'](handleError(_0x126e6b,null));};exports[_0x1652('0x22')]=function(_0x1cdcfb,_0x5710fa){return db['FreshdeskConfiguration'][_0x1652('0x44')]({'where':{'id':_0x1cdcfb[_0x1652('0x43')]['id']}})['then'](handleEntityNotFound(_0x5710fa,null))[_0x1652('0x21')](removeEntity(_0x5710fa,null))[_0x1652('0x41')](handleError(_0x5710fa,null));};exports[_0x1652('0x47')]=function(_0x5c6937,_0x48e70b,_0x2e7faa){var _0x36d4b3={};var _0x3e84b9={};var _0x5ac3a4;var _0x204882;return db[_0x1652('0x3b')][_0x1652('0x48')]({'where':{'id':_0x5c6937['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x48e70b,null))[_0x1652('0x21')](function(_0x4af405){if(_0x4af405){_0x5ac3a4=_0x4af405;_0x3e84b9['model']=_[_0x1652('0x2e')](db[_0x1652('0x49')][_0x1652('0x29')]);_0x3e84b9['query']=_[_0x1652('0x2e')](_0x5c6937[_0x1652('0x2d')]);_0x3e84b9['filters']=_[_0x1652('0x2f')](_0x3e84b9[_0x1652('0x2c')],_0x3e84b9['query']);_0x36d4b3['attributes']=_[_0x1652('0x2f')](_0x3e84b9[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x5c6937[_0x1652('0x2d')]['fields']));_0x36d4b3[_0x1652('0x31')]=_0x36d4b3[_0x1652('0x31')][_0x1652('0x4a')]?_0x36d4b3[_0x1652('0x31')]:_0x3e84b9[_0x1652('0x2c')];_0x36d4b3['order']=qs['sort'](_0x5c6937[_0x1652('0x2d')][_0x1652('0x34')]);_0x36d4b3[_0x1652('0x35')]=qs[_0x1652('0x36')](_['pick'](_0x5c6937['query'],_0x3e84b9[_0x1652('0x36')]));if(_0x5c6937[_0x1652('0x2d')]['filter']){_0x36d4b3['where']=_['merge'](_0x36d4b3[_0x1652('0x35')],{'$or':_['map'](_0x36d4b3['attributes'],function(_0x32ef6f){var _0x135969={};_0x135969[_0x32ef6f]={'$like':'%'+_0x5c6937[_0x1652('0x2d')][_0x1652('0x37')]+'%'};return _0x135969;})});}_0x36d4b3=_[_0x1652('0x39')]({},_0x36d4b3,_0x5c6937['options']);return _0x5ac3a4[_0x1652('0x47')](_0x36d4b3);}})['then'](function(_0x3f9854){if(_0x3f9854){_0x204882=_0x3f9854[_0x1652('0x4a')];if(!_0x5c6937[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x36d4b3['limit']=qs[_0x1652('0x1c')](_0x5c6937[_0x1652('0x2d')]['limit']);_0x36d4b3[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x5c6937[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0x5ac3a4['getFields'](_0x36d4b3);}})[_0x1652('0x21')](function(_0x4f93a5){if(_0x4f93a5){return _0x4f93a5?{'count':_0x204882,'rows':_0x4f93a5}:null;}})[_0x1652('0x21')](respondWithResult(_0x48e70b,null))[_0x1652('0x41')](handleError(_0x48e70b,null));};exports[_0x1652('0x4b')]=function(_0x4159f9,_0x330599,_0x50c1c1){var _0x101c17={};var _0x3a350e={};var _0xc7e182;var _0x3411f0;return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x4159f9[_0x1652('0x43')]['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x330599,null))[_0x1652('0x21')](function(_0x4d91ab){if(_0x4d91ab){_0xc7e182=_0x4d91ab;_0x3a350e[_0x1652('0x2c')]=_[_0x1652('0x2e')](db[_0x1652('0x49')]['rawAttributes']);_0x3a350e[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x4159f9[_0x1652('0x2d')]);_0x3a350e[_0x1652('0x36')]=_[_0x1652('0x2f')](_0x3a350e['model'],_0x3a350e['query']);_0x101c17[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x3a350e[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x4159f9['query'][_0x1652('0x30')]));_0x101c17[_0x1652('0x31')]=_0x101c17[_0x1652('0x31')][_0x1652('0x4a')]?_0x101c17[_0x1652('0x31')]:_0x3a350e[_0x1652('0x2c')];_0x101c17[_0x1652('0x4c')]=qs['sort'](_0x4159f9[_0x1652('0x2d')][_0x1652('0x34')]);_0x101c17[_0x1652('0x35')]=qs[_0x1652('0x36')](_['pick'](_0x4159f9[_0x1652('0x2d')],_0x3a350e['filters']));if(_0x4159f9[_0x1652('0x2d')]['filter']){_0x101c17[_0x1652('0x35')]=_[_0x1652('0x39')](_0x101c17[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x101c17[_0x1652('0x31')],function(_0x7263f8){var _0x3bbbe9={};_0x3bbbe9[_0x7263f8]={'$like':'%'+_0x4159f9[_0x1652('0x2d')]['filter']+'%'};return _0x3bbbe9;})});}_0x101c17=_[_0x1652('0x39')]({},_0x101c17,_0x4159f9['options']);return _0xc7e182[_0x1652('0x4b')](_0x101c17);}})['then'](function(_0x155246){if(_0x155246){_0x3411f0=_0x155246['length'];if(!_0x4159f9['query']['hasOwnProperty'](_0x1652('0x33'))){_0x101c17['limit']=qs[_0x1652('0x1c')](_0x4159f9[_0x1652('0x2d')][_0x1652('0x1c')]);_0x101c17[_0x1652('0x1a')]=qs[_0x1652('0x1a')](_0x4159f9[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0xc7e182[_0x1652('0x4b')](_0x101c17);}})[_0x1652('0x21')](function(_0x201cd7){if(_0x201cd7){return _0x201cd7?{'count':_0x3411f0,'rows':_0x201cd7}:null;}})['then'](respondWithResult(_0x330599,null))['catch'](handleError(_0x330599,null));};exports[_0x1652('0x4d')]=function(_0x199159,_0x4cb8f0,_0x845ae){var _0x2a160a={};var _0x35b310={};var _0x16d356;var _0x4bd39f;return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x199159['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x4cb8f0,null))[_0x1652('0x21')](function(_0x2c413e){if(_0x2c413e){_0x16d356=_0x2c413e;_0x35b310[_0x1652('0x2c')]=_[_0x1652('0x2e')](db['FreshdeskField']['rawAttributes']);_0x35b310[_0x1652('0x2d')]=_[_0x1652('0x2e')](_0x199159[_0x1652('0x2d')]);_0x35b310[_0x1652('0x36')]=_[_0x1652('0x2f')](_0x35b310[_0x1652('0x2c')],_0x35b310[_0x1652('0x2d')]);_0x2a160a[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x35b310[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x199159['query'][_0x1652('0x30')]));_0x2a160a[_0x1652('0x31')]=_0x2a160a['attributes'][_0x1652('0x4a')]?_0x2a160a[_0x1652('0x31')]:_0x35b310[_0x1652('0x2c')];_0x2a160a[_0x1652('0x4c')]=qs['sort'](_0x199159[_0x1652('0x2d')][_0x1652('0x34')]);_0x2a160a['where']=qs[_0x1652('0x36')](_['pick'](_0x199159[_0x1652('0x2d')],_0x35b310['filters']));if(_0x199159['query']['filter']){_0x2a160a[_0x1652('0x35')]=_['merge'](_0x2a160a[_0x1652('0x35')],{'$or':_['map'](_0x2a160a[_0x1652('0x31')],function(_0x17137b){var _0x764a82={};_0x764a82[_0x17137b]={'$like':'%'+_0x199159[_0x1652('0x2d')][_0x1652('0x37')]+'%'};return _0x764a82;})});}_0x2a160a=_['merge']({},_0x2a160a,_0x199159[_0x1652('0x3a')]);return _0x16d356[_0x1652('0x4d')](_0x2a160a);}})[_0x1652('0x21')](function(_0x5dcf1d){if(_0x5dcf1d){_0x4bd39f=_0x5dcf1d['length'];if(!_0x199159[_0x1652('0x2d')][_0x1652('0x32')](_0x1652('0x33'))){_0x2a160a[_0x1652('0x1c')]=qs[_0x1652('0x1c')](_0x199159[_0x1652('0x2d')]['limit']);_0x2a160a[_0x1652('0x1a')]=qs['offset'](_0x199159[_0x1652('0x2d')]['offset']);}return _0x16d356[_0x1652('0x4d')](_0x2a160a);}})[_0x1652('0x21')](function(_0xfda438){if(_0xfda438){return _0xfda438?{'count':_0x4bd39f,'rows':_0xfda438}:null;}})[_0x1652('0x21')](respondWithResult(_0x4cb8f0,null))[_0x1652('0x41')](handleError(_0x4cb8f0,null));};exports[_0x1652('0x4e')]=function(_0x254b6c,_0x2cb185,_0x2c8bea){var _0x4af9e9={};var _0x42a637={};var _0x52fc66;var _0x3d2389;return db[_0x1652('0x3b')][_0x1652('0x48')]({'where':{'id':_0x254b6c['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x2cb185,null))[_0x1652('0x21')](function(_0x932e35){if(_0x932e35){_0x52fc66=_0x932e35;_0x42a637['model']=_['keys'](db['Tag'][_0x1652('0x29')]);_0x42a637['query']=_['keys'](_0x254b6c[_0x1652('0x2d')]);_0x42a637['filters']=_['intersection'](_0x42a637[_0x1652('0x2c')],_0x42a637[_0x1652('0x2d')]);_0x4af9e9[_0x1652('0x31')]=_[_0x1652('0x2f')](_0x42a637[_0x1652('0x2c')],qs[_0x1652('0x30')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x30')]));_0x4af9e9['attributes']=_0x4af9e9[_0x1652('0x31')][_0x1652('0x4a')]?_0x4af9e9[_0x1652('0x31')]:_0x42a637['model'];_0x4af9e9['order']=qs[_0x1652('0x34')](_0x254b6c['query'][_0x1652('0x34')]);_0x4af9e9[_0x1652('0x35')]=qs['filters'](_['pick'](_0x254b6c[_0x1652('0x2d')],_0x42a637[_0x1652('0x36')]));if(_0x254b6c[_0x1652('0x2d')][_0x1652('0x37')]){_0x4af9e9[_0x1652('0x35')]=_[_0x1652('0x39')](_0x4af9e9[_0x1652('0x35')],{'$or':_[_0x1652('0x28')](_0x4af9e9['attributes'],function(_0x3389ef){var _0x2e0be9={};_0x2e0be9[_0x3389ef]={'$like':'%'+_0x254b6c['query'][_0x1652('0x37')]+'%'};return _0x2e0be9;})});}_0x4af9e9=_[_0x1652('0x39')]({},_0x4af9e9,_0x254b6c['options']);return _0x52fc66[_0x1652('0x4e')](_0x4af9e9);}})[_0x1652('0x21')](function(_0x5a196a){if(_0x5a196a){_0x3d2389=_0x5a196a['length'];if(!_0x254b6c[_0x1652('0x2d')][_0x1652('0x32')]('nolimit')){_0x4af9e9[_0x1652('0x1c')]=qs[_0x1652('0x1c')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x1c')]);_0x4af9e9['offset']=qs[_0x1652('0x1a')](_0x254b6c[_0x1652('0x2d')][_0x1652('0x1a')]);}return _0x52fc66[_0x1652('0x4e')](_0x4af9e9);}})[_0x1652('0x21')](function(_0x1337e6){if(_0x1337e6){return _0x1337e6?{'count':_0x3d2389,'rows':_0x1337e6}:null;}})[_0x1652('0x21')](respondWithResult(_0x2cb185,null))[_0x1652('0x41')](handleError(_0x2cb185,null));};exports[_0x1652('0x4f')]=function(_0x431979,_0x3c236d,_0x2769be){if(_0x431979[_0x1652('0x46')]['id']){delete _0x431979[_0x1652('0x46')]['id'];}return db[_0x1652('0x3b')]['findOne']({'where':{'id':_0x431979['params']['id']}})[_0x1652('0x21')](handleEntityNotFound(_0x3c236d,null))[_0x1652('0x21')](function(_0x19508c){if(_0x19508c){return _0x19508c[_0x1652('0x4f')](_0x431979[_0x1652('0x46')][_0x1652('0x50')]||[]);}return null;})['then'](respondWithResult(_0x3c236d,null))['catch'](handleError(_0x3c236d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 118b821..e2a57e7 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 _0x46fc=['lodash','util','../../config/logger','moment','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x55a967,_0x1fe67f){var _0x1bc374=function(_0x232340){while(--_0x232340){_0x55a967['push'](_0x55a967['shift']());}};_0x1bc374(++_0x1fe67f);}(_0x46fc,0x17c));var _0xc46f=function(_0x4e87d1,_0x418979){_0x4e87d1=_0x4e87d1-0x0;var _0x532e82=_0x46fc[_0x4e87d1];return _0x532e82;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var logger=require(_0xc46f('0x2'))('api');var moment=require(_0xc46f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc46f('0x4'));var rimraf=require(_0xc46f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc46f('0x6'));module['exports']=function(_0x2bbff2,_0x229bd6){return _0x2bbff2[_0xc46f('0x7')](_0xc46f('0x8'),attributes,{'tableName':_0xc46f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6a6=['../../config/logger','api','moment','request-promise','path','rimraf','exports','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd6a6,0x121));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6d6a('0x0'));var logger=require(_0x6d6a('0x1'))(_0x6d6a('0x2'));var moment=require(_0x6d6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d6a('0x4'));var fs=require('fs');var path=require(_0x6d6a('0x5'));var rimraf=require(_0x6d6a('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x6d6a('0x7')]=function(_0x24385d,_0x52852a){return _0x24385d['define'](_0x6d6a('0x8'),attributes,{'tableName':_0x6d6a('0x9'),'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 d51759e..606aaf0 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 _0xdf34=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then'];(function(_0x1c815f,_0x50970a){var _0x14a3cf=function(_0x190c8c){while(--_0x190c8c){_0x1c815f['push'](_0x1c815f['shift']());}};_0x14a3cf(++_0x50970a);}(_0xdf34,0x1d2));var _0x4df3=function(_0x528871,_0x151e77){_0x528871=_0x528871-0x0;var _0x40e5cc=_0xdf34[_0x528871];return _0x40e5cc;};'use strict';var _=require(_0x4df3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4df3('0x1'));var rs=require(_0x4df3('0x2'));var fs=require('fs');var Redis=require(_0x4df3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4df3('0x4'));var client=jayson[_0x4df3('0x5')][_0x4df3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3952b1,_0x2ee333,_0x49f428){return new BPromise(function(_0x4c4f4a,_0x421aed){return client[_0x4df3('0x7')](_0x3952b1,_0x49f428)[_0x4df3('0x8')](function(_0x52e789){logger[_0x4df3('0x9')](_0x4df3('0xa'),_0x2ee333,'request\x20sent');logger[_0x4df3('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2ee333,_0x4df3('0xc'),JSON[_0x4df3('0xd')](_0x52e789));if(_0x52e789[_0x4df3('0xe')]){if(_0x52e789[_0x4df3('0xe')][_0x4df3('0xf')]===0x1f4){logger[_0x4df3('0xe')](_0x4df3('0xa'),_0x2ee333,_0x52e789[_0x4df3('0xe')][_0x4df3('0x10')]);return _0x421aed(_0x52e789[_0x4df3('0xe')][_0x4df3('0x10')]);}logger[_0x4df3('0xe')](_0x4df3('0xa'),_0x2ee333,_0x52e789[_0x4df3('0xe')][_0x4df3('0x10')]);return _0x4c4f4a(_0x52e789[_0x4df3('0xe')][_0x4df3('0x10')]);}else{logger[_0x4df3('0x9')](_0x4df3('0xa'),_0x2ee333,'request\x20sent');_0x4c4f4a(_0x52e789[_0x4df3('0x11')][_0x4df3('0x10')]);}})[_0x4df3('0x12')](function(_0x4c3bb9){logger[_0x4df3('0xe')](_0x4df3('0xa'),_0x2ee333,_0x4c3bb9);_0x421aed(_0x4c3bb9);});});} \ No newline at end of file +var _0x1ea1=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d6696,_0x2cc5f0){var _0x4a3342=function(_0x56a53c){while(--_0x56a53c){_0x1d6696['push'](_0x1d6696['shift']());}};_0x4a3342(++_0x2cc5f0);}(_0x1ea1,0x19c));var _0x11ea=function(_0x2161a6,_0x481f8a){_0x2161a6=_0x2161a6-0x0;var _0x4c1ed6=_0x1ea1[_0x2161a6];return _0x4c1ed6;};'use strict';var _=require(_0x11ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11ea('0x1'));var rs=require(_0x11ea('0x2'));var fs=require('fs');var Redis=require(_0x11ea('0x3'));var db=require(_0x11ea('0x4'))['db'];var utils=require(_0x11ea('0x5'));var logger=require(_0x11ea('0x6'))('rpc');var config=require(_0x11ea('0x7'));var jayson=require(_0x11ea('0x8'));var client=jayson[_0x11ea('0x9')][_0x11ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35ba07,_0x3fb4c8,_0x46df86){return new BPromise(function(_0x46428a,_0x59d5c6){return client[_0x11ea('0xb')](_0x35ba07,_0x46df86)[_0x11ea('0xc')](function(_0x2fb2eb){logger[_0x11ea('0xd')](_0x11ea('0xe'),_0x3fb4c8,'request\x20sent');logger[_0x11ea('0xf')](_0x11ea('0x10'),_0x3fb4c8,_0x11ea('0x11'),JSON['stringify'](_0x2fb2eb));if(_0x2fb2eb[_0x11ea('0x12')]){if(_0x2fb2eb[_0x11ea('0x12')][_0x11ea('0x13')]===0x1f4){logger[_0x11ea('0x12')](_0x11ea('0xe'),_0x3fb4c8,_0x2fb2eb['error'][_0x11ea('0x14')]);return _0x59d5c6(_0x2fb2eb[_0x11ea('0x12')][_0x11ea('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3fb4c8,_0x2fb2eb[_0x11ea('0x12')]['message']);return _0x46428a(_0x2fb2eb[_0x11ea('0x12')]['message']);}else{logger[_0x11ea('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3fb4c8,_0x11ea('0x11'));_0x46428a(_0x2fb2eb[_0x11ea('0x15')][_0x11ea('0x14')]);}})['catch'](function(_0x4cecbd){logger[_0x11ea('0x12')](_0x11ea('0xe'),_0x3fb4c8,_0x4cecbd);_0x59d5c6(_0x4cecbd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 48b31b5..87df22f 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 _0x7db1=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated'];(function(_0x43d4e0,_0x38ad4d){var _0x3218b5=function(_0x1a89d5){while(--_0x1a89d5){_0x43d4e0['push'](_0x43d4e0['shift']());}};_0x3218b5(++_0x38ad4d);}(_0x7db1,0x195));var _0x17db=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x7db1[_0x22377a];return _0x36f105;};'use strict';var multer=require(_0x17db('0x0'));var util=require('util');var path=require(_0x17db('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x17db('0x2')]();var fs_extra=require(_0x17db('0x3'));var auth=require(_0x17db('0x4'));var interaction=require(_0x17db('0x5'));var config=require(_0x17db('0x6'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x17db('0x7')]);router[_0x17db('0x8')](_0x17db('0x9'),auth['isAuthenticated'](),controller[_0x17db('0xa')]);router[_0x17db('0xb')]('/',auth[_0x17db('0xc')](),controller[_0x17db('0xd')]);router[_0x17db('0xe')](_0x17db('0x9'),auth[_0x17db('0xc')](),controller[_0x17db('0xf')]);router[_0x17db('0x10')]('/:id',auth[_0x17db('0xc')](),controller[_0x17db('0x11')]);module[_0x17db('0x12')]=router; \ No newline at end of file +var _0x271d=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x271d,0x84));var _0xd271=function(_0x277203,_0x29280b){_0x277203=_0x277203-0x0;var _0x1b3ed7=_0x271d[_0x277203];return _0x1b3ed7;};'use strict';var multer=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var path=require(_0xd271('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd271('0x3')]();var fs_extra=require(_0xd271('0x4'));var auth=require(_0xd271('0x5'));var interaction=require(_0xd271('0x6'));var config=require('../../config/environment');var controller=require(_0xd271('0x7'));router['get']('/',auth[_0xd271('0x8')](),controller[_0xd271('0x9')]);router[_0xd271('0xa')](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0xc')]);router[_0xd271('0xd')]('/',auth[_0xd271('0x8')](),controller[_0xd271('0xe')]);router[_0xd271('0xf')](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0x10')]);router['delete'](_0xd271('0xb'),auth[_0xd271('0x8')](),controller[_0xd271('0x11')]);module[_0xd271('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 10099ec..ddbe3f7 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 _0xeb58=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xd61f50,_0x4a5aae){var _0x12fe9e=function(_0x51e1d9){while(--_0x51e1d9){_0xd61f50['push'](_0xd61f50['shift']());}};_0x12fe9e(++_0x4a5aae);}(_0xeb58,0x1c0));var _0x8eb5=function(_0x1e1308,_0x472dba){_0x1e1308=_0x1e1308-0x0;var _0x4397f7=_0xeb58[_0x1e1308];return _0x4397f7;};'use strict';var Sequelize=require(_0x8eb5('0x0'));module['exports']={'type':{'type':Sequelize[_0x8eb5('0x1')](_0x8eb5('0x2'),'variable',_0x8eb5('0x3'),_0x8eb5('0x4'),_0x8eb5('0x5')),'defaultValue':_0x8eb5('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8eb5('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8eb5('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8eb5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8eb5('0x6')]},'customField':{'type':Sequelize[_0x8eb5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8eb5('0x6')]}}; \ No newline at end of file +var _0xb005=['keyValue','picklist','ENUM','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb005,0x1e1));var _0x5b00=function(_0x378898,_0x29791c){_0x378898=_0x378898-0x0;var _0x32e1a6=_0xb005[_0x378898];return _0x32e1a6;};'use strict';var Sequelize=require(_0x5b00('0x0'));module[_0x5b00('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5b00('0x2'),_0x5b00('0x3'),_0x5b00('0x4'),_0x5b00('0x5'),_0x5b00('0x6')),'defaultValue':_0x5b00('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5b00('0x7')](_0x5b00('0x2'),_0x5b00('0x3'),_0x5b00('0x4'))},'keyContent':{'type':Sequelize[_0x5b00('0x8')]},'idField':{'type':Sequelize[_0x5b00('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 21e51fa..f104e91 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 _0x222f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x478829,_0x4ef2bb){var _0x59a14a=function(_0x11e88c){while(--_0x11e88c){_0x478829['push'](_0x478829['shift']());}};_0x59a14a(++_0x4ef2bb);}(_0x222f,0x1a4));var _0xf222=function(_0x578c66,_0x3e090f){_0x578c66=_0x578c66-0x0;var _0x586aa2=_0x222f[_0x578c66];return _0x586aa2;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x1883c1,_0x3fce26){return function(_0x4305e0){if(!_0x4305e0){_0x1883c1[_0xf222('0x18')](0x194);}return _0x4305e0;};}function handleError(_0x42616e,_0x263dc2){_0x263dc2=_0x263dc2||0x1f4;return function(_0x15bf4e){logger[_0xf222('0x27')](_0x15bf4e[_0xf222('0x28')]);if(_0x15bf4e['name']){delete _0x15bf4e[_0xf222('0x29')];}_0x42616e[_0xf222('0x19')](_0x263dc2)[_0xf222('0x2a')](_0x15bf4e);};}exports[_0xf222('0x2b')]=function(_0xe41039,_0x40a715){var _0x3789e0={},_0x1b928b={},_0x1e87ec={'count':0x0,'rows':[]};var _0x59721a=_[_0xf222('0x2c')](db[_0xf222('0x2d')][_0xf222('0x2e')],function(_0x53a382){return{'name':_0x53a382[_0xf222('0x2f')],'type':_0x53a382['type'][_0xf222('0x30')]};});_0x1b928b[_0xf222('0x31')]=_[_0xf222('0x2c')](_0x59721a,_0xf222('0x29'));_0x1b928b[_0xf222('0x32')]=_[_0xf222('0x33')](_0xe41039[_0xf222('0x32')]);_0x1b928b['filters']=_['intersection'](_0x1b928b[_0xf222('0x31')],_0x1b928b[_0xf222('0x32')]);_0x3789e0[_0xf222('0x34')]=_[_0xf222('0x35')](_0x1b928b[_0xf222('0x31')],qs[_0xf222('0x36')](_0xe41039['query'][_0xf222('0x36')]));_0x3789e0[_0xf222('0x34')]=_0x3789e0[_0xf222('0x34')]['length']?_0x3789e0[_0xf222('0x34')]:_0x1b928b[_0xf222('0x31')];if(!_0xe41039[_0xf222('0x32')]['hasOwnProperty'](_0xf222('0x37'))){_0x3789e0[_0xf222('0x1d')]=qs[_0xf222('0x1d')](_0xe41039['query'][_0xf222('0x1d')]);_0x3789e0[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0xe41039[_0xf222('0x32')][_0xf222('0x1b')]);}_0x3789e0['order']=qs[_0xf222('0x38')](_0xe41039['query'][_0xf222('0x38')]);_0x3789e0[_0xf222('0x39')]=qs[_0xf222('0x3a')](_['pick'](_0xe41039[_0xf222('0x32')],_0x1b928b[_0xf222('0x3a')]),_0x59721a);if(_0xe41039['query'][_0xf222('0x3b')]){_0x3789e0['where']=_[_0xf222('0x3c')](_0x3789e0[_0xf222('0x39')],{'$or':_[_0xf222('0x2c')](_0x59721a,function(_0x5c8b04){if(_0x5c8b04[_0xf222('0x3d')]!==_0xf222('0x3e')){var _0x2c1e49={};_0x2c1e49[_0x5c8b04[_0xf222('0x29')]]={'$like':'%'+_0xe41039[_0xf222('0x32')][_0xf222('0x3b')]+'%'};return _0x2c1e49;}})});}_0x3789e0=_['merge']({},_0x3789e0,_0xe41039[_0xf222('0x3f')]);var _0x24e8a5={'where':_0x3789e0['where']};return db['FreshdeskField'][_0xf222('0x1e')](_0x24e8a5)['then'](function(_0x2b20d3){_0x1e87ec[_0xf222('0x1e')]=_0x2b20d3;if(_0xe41039[_0xf222('0x32')][_0xf222('0x40')]){_0x3789e0['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xf222('0x41')](_0x3789e0);})['then'](function(_0x522a9e){_0x1e87ec[_0xf222('0x42')]=_0x522a9e;return _0x1e87ec;})[_0xf222('0x25')](respondWithFilteredResult(_0x40a715,_0x3789e0))[_0xf222('0x43')](handleError(_0x40a715,null));};exports[_0xf222('0x44')]=function(_0x10f065,_0x2af478){var _0x5c60e6={'raw':!![],'where':{'id':_0x10f065[_0xf222('0x45')]['id']}},_0xf829ae={};_0xf829ae['model']=_[_0xf222('0x33')](db[_0xf222('0x2d')]['rawAttributes']);_0xf829ae[_0xf222('0x32')]=_['keys'](_0x10f065[_0xf222('0x32')]);_0xf829ae[_0xf222('0x3a')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],_0xf829ae[_0xf222('0x32')]);_0x5c60e6[_0xf222('0x34')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],qs[_0xf222('0x36')](_0x10f065[_0xf222('0x32')][_0xf222('0x36')]));_0x5c60e6['attributes']=_0x5c60e6['attributes']['length']?_0x5c60e6[_0xf222('0x34')]:_0xf829ae[_0xf222('0x31')];if(_0x10f065[_0xf222('0x32')][_0xf222('0x40')]){_0x5c60e6['include']=[{'all':!![]}];}_0x5c60e6=_[_0xf222('0x3c')]({},_0x5c60e6,_0x10f065[_0xf222('0x3f')]);return db[_0xf222('0x2d')][_0xf222('0x46')](_0x5c60e6)['then'](handleEntityNotFound(_0x2af478,null))[_0xf222('0x25')](respondWithResult(_0x2af478,null))[_0xf222('0x43')](handleError(_0x2af478,null));};exports[_0xf222('0x47')]=function(_0x37b393,_0x1d60e5){return db[_0xf222('0x2d')][_0xf222('0x47')](_0x37b393[_0xf222('0x48')],{})[_0xf222('0x25')](respondWithResult(_0x1d60e5,0xc9))[_0xf222('0x43')](handleError(_0x1d60e5,null));};exports['update']=function(_0x5d0d70,_0x193762){if(_0x5d0d70['body']['id']){delete _0x5d0d70[_0xf222('0x48')]['id'];}return db['FreshdeskField'][_0xf222('0x46')]({'where':{'id':_0x5d0d70['params']['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x193762,null))[_0xf222('0x25')](saveUpdates(_0x5d0d70[_0xf222('0x48')],null))[_0xf222('0x25')](respondWithResult(_0x193762,null))['catch'](handleError(_0x193762,null));};exports[_0xf222('0x26')]=function(_0x34fd50,_0x380642){return db[_0xf222('0x2d')][_0xf222('0x46')]({'where':{'id':_0x34fd50[_0xf222('0x45')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x380642,null))[_0xf222('0x25')](removeEntity(_0x380642,null))[_0xf222('0x43')](handleError(_0x380642,null));}; \ No newline at end of file +var _0x2f3a=['status','end','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','name','index','FreshdeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x3f0b9c,_0x39f258){_0x3f0b9c=_0x3f0b9c-0x0;var _0x48a63f=_0x2f3a[_0x3f0b9c];return _0x48a63f;};'use strict';var emlformat=require(_0xa2f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2f3('0x1'));var rp=require(_0xa2f3('0x2'));var moment=require(_0xa2f3('0x3'));var BPromise=require(_0xa2f3('0x4'));var Mustache=require(_0xa2f3('0x5'));var util=require(_0xa2f3('0x6'));var path=require('path');var sox=require(_0xa2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xa2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xa2f3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0xd'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xe'));var Redis=require(_0xa2f3('0xf'));var authService=require(_0xa2f3('0x10'));var qs=require(_0xa2f3('0x11'));var as=require(_0xa2f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x13'))(_0xa2f3('0x14'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x15'));var licenseUtil=require(_0xa2f3('0x16'));var db=require(_0xa2f3('0x17'))['db'];function respondWithStatusCode(_0x58f6df,_0x6aa8f2){_0x6aa8f2=_0x6aa8f2||0xcc;return function(_0x194281){if(_0x194281){return _0x58f6df[_0xa2f3('0x18')](_0x6aa8f2);}return _0x58f6df[_0xa2f3('0x19')](_0x6aa8f2)[_0xa2f3('0x1a')]();};}function respondWithResult(_0xd4f9db,_0x3907fe){_0x3907fe=_0x3907fe||0xc8;return function(_0x4544d4){if(_0x4544d4){return _0xd4f9db[_0xa2f3('0x19')](_0x3907fe)['json'](_0x4544d4);}};}function respondWithFilteredResult(_0xdc3967,_0x33bf10){return function(_0x74fb58){if(_0x74fb58){var _0x51d297=typeof _0x33bf10[_0xa2f3('0x1b')]===_0xa2f3('0x1c')&&typeof _0x33bf10['limit']==='undefined';var _0xb1fe06=_0x74fb58[_0xa2f3('0x1d')];var _0x2db0d2=_0x51d297?0x0:_0x33bf10[_0xa2f3('0x1b')];var _0x205578=_0x51d297?_0x74fb58[_0xa2f3('0x1d')]:_0x33bf10[_0xa2f3('0x1b')]+_0x33bf10[_0xa2f3('0x1e')];var _0x550d68;if(_0x205578>=_0xb1fe06){_0x205578=_0xb1fe06;_0x550d68=0xc8;}else{_0x550d68=0xce;}_0xdc3967[_0xa2f3('0x19')](_0x550d68);return _0xdc3967[_0xa2f3('0x1f')]('Content-Range',_0x2db0d2+'-'+_0x205578+'/'+_0xb1fe06)['json'](_0x74fb58);}return null;};}function patchUpdates(_0x2f74a0){return function(_0x53af81){try{jsonpatch[_0xa2f3('0x20')](_0x53af81,_0x2f74a0,!![]);}catch(_0x147fb7){return BPromise['reject'](_0x147fb7);}return _0x53af81[_0xa2f3('0x21')]();};}function saveUpdates(_0x3e055d,_0x14d989){return function(_0x2685bb){if(_0x2685bb){return _0x2685bb[_0xa2f3('0x22')](_0x3e055d)[_0xa2f3('0x23')](function(_0x37f8c2){return _0x37f8c2;});}return null;};}function removeEntity(_0xa02908,_0x49a589){return function(_0x81af9b){if(_0x81af9b){return _0x81af9b[_0xa2f3('0x24')]()[_0xa2f3('0x23')](function(){_0xa02908[_0xa2f3('0x19')](0xcc)[_0xa2f3('0x1a')]();});}};}function handleEntityNotFound(_0x2e6332,_0x1be0c1){return function(_0x5347de){if(!_0x5347de){_0x2e6332['sendStatus'](0x194);}return _0x5347de;};}function handleError(_0x2f4248,_0x4319f3){_0x4319f3=_0x4319f3||0x1f4;return function(_0x1dd4ec){logger[_0xa2f3('0x25')](_0x1dd4ec['stack']);if(_0x1dd4ec[_0xa2f3('0x26')]){delete _0x1dd4ec[_0xa2f3('0x26')];}_0x2f4248[_0xa2f3('0x19')](_0x4319f3)['send'](_0x1dd4ec);};}exports[_0xa2f3('0x27')]=function(_0x4ec4ab,_0x1ceea4){var _0x5b868c={},_0x452142={},_0x52f211={'count':0x0,'rows':[]};var _0x46f5c4=_['map'](db[_0xa2f3('0x28')][_0xa2f3('0x29')],function(_0x2e8291){return{'name':_0x2e8291[_0xa2f3('0x2a')],'type':_0x2e8291[_0xa2f3('0x2b')]['key']};});_0x452142[_0xa2f3('0x2c')]=_[_0xa2f3('0x2d')](_0x46f5c4,_0xa2f3('0x26'));_0x452142[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x4ec4ab[_0xa2f3('0x2e')]);_0x452142[_0xa2f3('0x30')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],_0x452142['query']);_0x5b868c[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],qs[_0xa2f3('0x33')](_0x4ec4ab[_0xa2f3('0x2e')]['fields']));_0x5b868c[_0xa2f3('0x32')]=_0x5b868c['attributes']['length']?_0x5b868c[_0xa2f3('0x32')]:_0x452142[_0xa2f3('0x2c')];if(!_0x4ec4ab['query'][_0xa2f3('0x34')](_0xa2f3('0x35'))){_0x5b868c['limit']=qs[_0xa2f3('0x1e')](_0x4ec4ab[_0xa2f3('0x2e')]['limit']);_0x5b868c['offset']=qs[_0xa2f3('0x1b')](_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x1b')]);}_0x5b868c[_0xa2f3('0x36')]=qs['sort'](_0x4ec4ab[_0xa2f3('0x2e')]['sort']);_0x5b868c[_0xa2f3('0x37')]=qs['filters'](_['pick'](_0x4ec4ab[_0xa2f3('0x2e')],_0x452142[_0xa2f3('0x30')]),_0x46f5c4);if(_0x4ec4ab['query'][_0xa2f3('0x38')]){_0x5b868c['where']=_[_0xa2f3('0x39')](_0x5b868c[_0xa2f3('0x37')],{'$or':_[_0xa2f3('0x2d')](_0x46f5c4,function(_0x11dade){if(_0x11dade[_0xa2f3('0x2b')]!==_0xa2f3('0x3a')){var _0x55d45f={};_0x55d45f[_0x11dade[_0xa2f3('0x26')]]={'$like':'%'+_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x38')]+'%'};return _0x55d45f;}})});}_0x5b868c=_[_0xa2f3('0x39')]({},_0x5b868c,_0x4ec4ab[_0xa2f3('0x3b')]);var _0x3a7010={'where':_0x5b868c[_0xa2f3('0x37')]};return db[_0xa2f3('0x28')]['count'](_0x3a7010)[_0xa2f3('0x23')](function(_0x1ce533){_0x52f211[_0xa2f3('0x1d')]=_0x1ce533;if(_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x5b868c['include']=[{'all':!![]}];}return db[_0xa2f3('0x28')][_0xa2f3('0x3d')](_0x5b868c);})['then'](function(_0x3c5b86){_0x52f211[_0xa2f3('0x3e')]=_0x3c5b86;return _0x52f211;})[_0xa2f3('0x23')](respondWithFilteredResult(_0x1ceea4,_0x5b868c))[_0xa2f3('0x3f')](handleError(_0x1ceea4,null));};exports['show']=function(_0x3d3458,_0x266a68){var _0x10e6e0={'raw':!![],'where':{'id':_0x3d3458[_0xa2f3('0x40')]['id']}},_0x2edc0b={};_0x2edc0b[_0xa2f3('0x2c')]=_[_0xa2f3('0x2f')](db[_0xa2f3('0x28')][_0xa2f3('0x29')]);_0x2edc0b[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x3d3458[_0xa2f3('0x2e')]);_0x2edc0b['filters']=_[_0xa2f3('0x31')](_0x2edc0b['model'],_0x2edc0b[_0xa2f3('0x2e')]);_0x10e6e0[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x2edc0b[_0xa2f3('0x2c')],qs['fields'](_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x33')]));_0x10e6e0['attributes']=_0x10e6e0['attributes'][_0xa2f3('0x41')]?_0x10e6e0[_0xa2f3('0x32')]:_0x2edc0b[_0xa2f3('0x2c')];if(_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x10e6e0['include']=[{'all':!![]}];}_0x10e6e0=_['merge']({},_0x10e6e0,_0x3d3458['options']);return db[_0xa2f3('0x28')][_0xa2f3('0x42')](_0x10e6e0)[_0xa2f3('0x23')](handleEntityNotFound(_0x266a68,null))[_0xa2f3('0x23')](respondWithResult(_0x266a68,null))['catch'](handleError(_0x266a68,null));};exports[_0xa2f3('0x43')]=function(_0x4d5ed0,_0x2c275a){return db[_0xa2f3('0x28')]['create'](_0x4d5ed0['body'],{})[_0xa2f3('0x23')](respondWithResult(_0x2c275a,0xc9))[_0xa2f3('0x3f')](handleError(_0x2c275a,null));};exports[_0xa2f3('0x22')]=function(_0x5b8403,_0xe2ad3){if(_0x5b8403['body']['id']){delete _0x5b8403[_0xa2f3('0x44')]['id'];}return db['FreshdeskField'][_0xa2f3('0x42')]({'where':{'id':_0x5b8403[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0xe2ad3,null))[_0xa2f3('0x23')](saveUpdates(_0x5b8403[_0xa2f3('0x44')],null))[_0xa2f3('0x23')](respondWithResult(_0xe2ad3,null))[_0xa2f3('0x3f')](handleError(_0xe2ad3,null));};exports['destroy']=function(_0x5c634c,_0x11b2e4){return db[_0xa2f3('0x28')][_0xa2f3('0x42')]({'where':{'id':_0x5c634c[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0x11b2e4,null))[_0xa2f3('0x23')](removeEntity(_0x11b2e4,null))['catch'](handleError(_0x11b2e4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5b7f48f..d4a3a62 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 _0x8e4c=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x8e4c,0x69));var _0xc8e4=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8e4c[_0x26462c];return _0x509a42;};'use strict';var _=require('lodash');var util=require(_0xc8e4('0x0'));var logger=require(_0xc8e4('0x1'))(_0xc8e4('0x2'));var moment=require(_0xc8e4('0x3'));var BPromise=require(_0xc8e4('0x4'));var rp=require(_0xc8e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e4('0x6'));var config=require(_0xc8e4('0x7'));var attributes=require(_0xc8e4('0x8'));module['exports']=function(_0x2f9c85,_0x528f20){return _0x2f9c85[_0xc8e4('0x9')](_0xc8e4('0xa'),attributes,{'tableName':_0xc8e4('0xb'),'paranoid':![],'indexes':[{'name':_0xc8e4('0xc'),'fields':[_0xc8e4('0xd'),_0xc8e4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f42=['FieldId','lodash','util','../../config/logger','moment','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x2f42,0x90));var _0x22f4=function(_0x1b387d,_0x161939){_0x1b387d=_0x1b387d-0x0;var _0x1e5a06=_0x2f42[_0x1b387d];return _0x1e5a06;};'use strict';var _=require(_0x22f4('0x0'));var util=require(_0x22f4('0x1'));var logger=require(_0x22f4('0x2'))('api');var moment=require(_0x22f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22f4('0x4'));var rimraf=require('rimraf');var config=require(_0x22f4('0x5'));var attributes=require(_0x22f4('0x6'));module[_0x22f4('0x7')]=function(_0x386042,_0x1a9596){return _0x386042[_0x22f4('0x8')](_0x22f4('0x9'),attributes,{'tableName':_0x22f4('0xa'),'paranoid':![],'indexes':[{'name':_0x22f4('0xb'),'fields':['idField',_0x22f4('0xc')],'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 c4bb42e..53b19cc 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 _0x349d=['debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x1f0084,_0x169444){var _0x5e80ac=function(_0x15cd3d){while(--_0x15cd3d){_0x1f0084['push'](_0x1f0084['shift']());}};_0x5e80ac(++_0x169444);}(_0x349d,0x195));var _0xd349=function(_0x5c54e0,_0x3d8d7a){_0x5c54e0=_0x5c54e0-0x0;var _0xd6345d=_0x349d[_0x5c54e0];return _0xd6345d;};'use strict';var _=require(_0xd349('0x0'));var util=require(_0xd349('0x1'));var moment=require(_0xd349('0x2'));var BPromise=require(_0xd349('0x3'));var rs=require(_0xd349('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd349('0x5'))['db'];var utils=require(_0xd349('0x6'));var logger=require('../../config/logger')(_0xd349('0x7'));var config=require(_0xd349('0x8'));var jayson=require(_0xd349('0x9'));var client=jayson[_0xd349('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49e988,_0x57c543,_0x505b35){return new BPromise(function(_0x570e6d,_0x2c6109){return client[_0xd349('0xb')](_0x49e988,_0x505b35)['then'](function(_0x57a42f){logger[_0xd349('0xc')](_0xd349('0xd'),_0x57c543,_0xd349('0xe'));logger[_0xd349('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x57c543,'request\x20sent',JSON['stringify'](_0x57a42f));if(_0x57a42f[_0xd349('0x10')]){if(_0x57a42f[_0xd349('0x10')]['code']===0x1f4){logger[_0xd349('0x10')](_0xd349('0xd'),_0x57c543,_0x57a42f[_0xd349('0x10')][_0xd349('0x11')]);return _0x2c6109(_0x57a42f[_0xd349('0x10')][_0xd349('0x11')]);}logger['error'](_0xd349('0xd'),_0x57c543,_0x57a42f[_0xd349('0x10')][_0xd349('0x11')]);return _0x570e6d(_0x57a42f['error'][_0xd349('0x11')]);}else{logger[_0xd349('0xc')](_0xd349('0xd'),_0x57c543,_0xd349('0xe'));_0x570e6d(_0x57a42f[_0xd349('0x12')][_0xd349('0x11')]);}})[_0xd349('0x13')](function(_0x14fa89){logger['error'](_0xd349('0xd'),_0x57c543,_0x14fa89);_0x2c6109(_0x14fa89);});});} \ No newline at end of file +var _0xc075=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xc075,0x199));var _0x5c07=function(_0x578c23,_0x1ce327){_0x578c23=_0x578c23-0x0;var _0x83b5c6=_0xc075[_0x578c23];return _0x83b5c6;};'use strict';var _=require('lodash');var util=require(_0x5c07('0x0'));var moment=require(_0x5c07('0x1'));var BPromise=require(_0x5c07('0x2'));var rs=require(_0x5c07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c07('0x4'));var logger=require(_0x5c07('0x5'))(_0x5c07('0x6'));var config=require(_0x5c07('0x7'));var jayson=require(_0x5c07('0x8'));var client=jayson[_0x5c07('0x9')][_0x5c07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x228d3d,_0x5dd68f,_0x3457a2){return new BPromise(function(_0xf838f9,_0x25b241){return client[_0x5c07('0xb')](_0x228d3d,_0x3457a2)[_0x5c07('0xc')](function(_0x16f312){logger['info'](_0x5c07('0xd'),_0x5dd68f,_0x5c07('0xe'));logger['debug'](_0x5c07('0xf'),_0x5dd68f,_0x5c07('0xe'),JSON[_0x5c07('0x10')](_0x16f312));if(_0x16f312['error']){if(_0x16f312[_0x5c07('0x11')][_0x5c07('0x12')]===0x1f4){logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);return _0x25b241(_0x16f312['error']['message']);}logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);return _0xf838f9(_0x16f312[_0x5c07('0x11')][_0x5c07('0x13')]);}else{logger[_0x5c07('0x14')](_0x5c07('0xd'),_0x5dd68f,_0x5c07('0xe'));_0xf838f9(_0x16f312[_0x5c07('0x15')]['message']);}})[_0x5c07('0x16')](function(_0x212d82){logger[_0x5c07('0x11')](_0x5c07('0xd'),_0x5dd68f,_0x212d82);_0x25b241(_0x212d82);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 35672a5..fec87ce 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 _0x97c1=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getFields']);router[_0x197c('0xf')]('/',auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0xf')](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0x11')]);router[_0x197c('0x12')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x14')]);module[_0x197c('0x15')]=router; \ No newline at end of file +var _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x53a1b1,_0x4e384e){var _0x20e349=function(_0x304721){while(--_0x304721){_0x53a1b1['push'](_0x53a1b1['shift']());}};_0x20e349(++_0x4e384e);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index cc1ee99..86c008f 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 _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x2b4d83,_0x4dfca3){var _0x59d0f4=function(_0x57a90a){while(--_0x57a90a){_0x2b4d83['push'](_0x2b4d83['shift']());}};_0x59d0f4(++_0x4dfca3);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x4f746c,_0x2046c3){_0x4f746c=_0x4f746c-0x0;var _0x223d37=_0xcf2f[_0x4f746c];return _0x223d37;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5b12,0xa3));var _0x25b1=function(_0x3d887d,_0x2f4f61){_0x3d887d=_0x3d887d-0x0;var _0x323a73=_0x5b12[_0x3d887d];return _0x323a73;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('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 3b4883a..b7b82e4 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 _0x7511=['Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','type','VIRTUAL','options','where','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','findOne','FreshsalesConfiguration','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','Token\x20token='];(function(_0x41b970,_0x2731c9){var _0x1b3599=function(_0x25bf40){while(--_0x25bf40){_0x41b970['push'](_0x41b970['shift']());}};_0x1b3599(++_0x2731c9);}(_0x7511,0x138));var _0x1751=function(_0x10cbda,_0x331fd9){_0x10cbda=_0x10cbda-0x0;var _0x10e5d8=_0x7511[_0x10cbda];return _0x10e5d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1751('0x0'));var zipdir=require(_0x1751('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1751('0x2'));var moment=require(_0x1751('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1751('0x4'));var util=require(_0x1751('0x5'));var path=require(_0x1751('0x6'));var sox=require(_0x1751('0x7'));var csv=require(_0x1751('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1751('0x9'));var crypto=require(_0x1751('0xa'));var jsforce=require(_0x1751('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1751('0xc'));var Papa=require(_0x1751('0xd'));var Redis=require(_0x1751('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1751('0xf'));var as=require(_0x1751('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1751('0x11'))(_0x1751('0x12'));var utils=require(_0x1751('0x13'));var config=require(_0x1751('0x14'));var licenseUtil=require(_0x1751('0x15'));var db=require(_0x1751('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536c0c,_0x56da3a){_0x56da3a=_0x56da3a||0xcc;return function(_0x3026fc){if(_0x3026fc){return _0x536c0c[_0x1751('0x17')](_0x56da3a);}return _0x536c0c[_0x1751('0x18')](_0x56da3a)[_0x1751('0x19')]();};}function respondWithResult(_0x281ff0,_0x10e6ca){_0x10e6ca=_0x10e6ca||0xc8;return function(_0x3e1757){if(_0x3e1757){return _0x281ff0[_0x1751('0x18')](_0x10e6ca)[_0x1751('0x1a')](_0x3e1757);}};}function respondWithFilteredResult(_0x16aa58,_0x54f2a7){return function(_0x4fad96){if(_0x4fad96){var _0x259fdd=typeof _0x54f2a7[_0x1751('0x1b')]==='undefined'&&typeof _0x54f2a7['limit']==='undefined';var _0x28064d=_0x4fad96[_0x1751('0x1c')];var _0x4573cf=_0x259fdd?0x0:_0x54f2a7[_0x1751('0x1b')];var _0x5c2da9=_0x259fdd?_0x4fad96[_0x1751('0x1c')]:_0x54f2a7[_0x1751('0x1b')]+_0x54f2a7['limit'];var _0x21eea;if(_0x5c2da9>=_0x28064d){_0x5c2da9=_0x28064d;_0x21eea=0xc8;}else{_0x21eea=0xce;}_0x16aa58['status'](_0x21eea);return _0x16aa58[_0x1751('0x1d')](_0x1751('0x1e'),_0x4573cf+'-'+_0x5c2da9+'/'+_0x28064d)[_0x1751('0x1a')](_0x4fad96);}return null;};}function patchUpdates(_0x4a05c4){return function(_0x4b657c){try{jsonpatch[_0x1751('0x1f')](_0x4b657c,_0x4a05c4,!![]);}catch(_0x1bc83e){return BPromise[_0x1751('0x20')](_0x1bc83e);}return _0x4b657c[_0x1751('0x21')]();};}function saveUpdates(_0xe1108f,_0x3643e4){return function(_0x29ae63){if(_0x29ae63){return _0x29ae63[_0x1751('0x22')](_0xe1108f)[_0x1751('0x23')](function(_0x332f62){return _0x332f62;});}return null;};}function removeEntity(_0x4e3d8b,_0x3b5b0d){return function(_0x1eefe1){if(_0x1eefe1){return _0x1eefe1[_0x1751('0x24')]()[_0x1751('0x23')](function(){_0x4e3d8b[_0x1751('0x18')](0xcc)[_0x1751('0x19')]();});}};}function handleEntityNotFound(_0x32e50a,_0x3a1944){return function(_0x16bb81){if(!_0x16bb81){_0x32e50a[_0x1751('0x17')](0x194);}return _0x16bb81;};}function handleError(_0x18dfc0,_0x110e5b){_0x110e5b=_0x110e5b||0x1f4;return function(_0x210870){logger[_0x1751('0x25')](_0x210870['stack']);if(_0x210870['name']){delete _0x210870['name'];}_0x18dfc0[_0x1751('0x18')](_0x110e5b)[_0x1751('0x26')](_0x210870);};}exports[_0x1751('0x27')]=function(_0x189939,_0x253bd3){var _0x1a198a={},_0x39a0fe={},_0x1d43e1={'count':0x0,'rows':[]};var _0x1e7780=_[_0x1751('0x28')](db['FreshsalesAccount'][_0x1751('0x29')],function(_0xf7d192){return{'name':_0xf7d192[_0x1751('0x2a')],'type':_0xf7d192['type'][_0x1751('0x2b')]};});_0x39a0fe[_0x1751('0x2c')]=_[_0x1751('0x28')](_0x1e7780,_0x1751('0x2d'));_0x39a0fe[_0x1751('0x2e')]=_[_0x1751('0x2f')](_0x189939[_0x1751('0x2e')]);_0x39a0fe[_0x1751('0x30')]=_[_0x1751('0x31')](_0x39a0fe[_0x1751('0x2c')],_0x39a0fe['query']);_0x1a198a['attributes']=_['intersection'](_0x39a0fe['model'],qs[_0x1751('0x32')](_0x189939[_0x1751('0x2e')][_0x1751('0x32')]));_0x1a198a[_0x1751('0x33')]=_0x1a198a[_0x1751('0x33')]['length']?_0x1a198a['attributes']:_0x39a0fe[_0x1751('0x2c')];if(!_0x189939[_0x1751('0x2e')][_0x1751('0x34')](_0x1751('0x35'))){_0x1a198a['limit']=qs['limit'](_0x189939[_0x1751('0x2e')][_0x1751('0x36')]);_0x1a198a[_0x1751('0x1b')]=qs[_0x1751('0x1b')](_0x189939[_0x1751('0x2e')][_0x1751('0x1b')]);}_0x1a198a[_0x1751('0x37')]=qs[_0x1751('0x38')](_0x189939['query'][_0x1751('0x38')]);_0x1a198a['where']=qs[_0x1751('0x30')](_['pick'](_0x189939[_0x1751('0x2e')],_0x39a0fe['filters']),_0x1e7780);if(_0x189939[_0x1751('0x2e')][_0x1751('0x39')]){_0x1a198a['where']=_['merge'](_0x1a198a['where'],{'$or':_[_0x1751('0x28')](_0x1e7780,function(_0x56f385){if(_0x56f385[_0x1751('0x3a')]!==_0x1751('0x3b')){var _0x13bed6={};_0x13bed6[_0x56f385['name']]={'$like':'%'+_0x189939[_0x1751('0x2e')][_0x1751('0x39')]+'%'};return _0x13bed6;}})});}_0x1a198a=_['merge']({},_0x1a198a,_0x189939[_0x1751('0x3c')]);var _0x5038f5={'where':_0x1a198a[_0x1751('0x3d')]};return db[_0x1751('0x3e')][_0x1751('0x1c')](_0x5038f5)[_0x1751('0x23')](function(_0x514190){_0x1d43e1[_0x1751('0x1c')]=_0x514190;if(_0x189939[_0x1751('0x2e')][_0x1751('0x3f')]){_0x1a198a[_0x1751('0x40')]=[{'all':!![]}];}return db[_0x1751('0x3e')][_0x1751('0x41')](_0x1a198a);})[_0x1751('0x23')](function(_0x247c55){_0x1d43e1[_0x1751('0x42')]=_0x247c55;return _0x1d43e1;})['then'](respondWithFilteredResult(_0x253bd3,_0x1a198a))[_0x1751('0x43')](handleError(_0x253bd3,null));};exports[_0x1751('0x44')]=function(_0x567bee,_0x6c0c4f){var _0x4cc817={'raw':![],'where':{'id':_0x567bee['params']['id']}},_0x5f137b={};_0x5f137b[_0x1751('0x2c')]=_[_0x1751('0x2f')](db[_0x1751('0x3e')]['rawAttributes']);_0x5f137b[_0x1751('0x2e')]=_['keys'](_0x567bee[_0x1751('0x2e')]);_0x5f137b[_0x1751('0x30')]=_[_0x1751('0x31')](_0x5f137b[_0x1751('0x2c')],_0x5f137b[_0x1751('0x2e')]);_0x4cc817[_0x1751('0x33')]=_[_0x1751('0x31')](_0x5f137b['model'],qs['fields'](_0x567bee['query']['fields']));_0x4cc817['attributes']=_0x4cc817[_0x1751('0x33')][_0x1751('0x45')]?_0x4cc817[_0x1751('0x33')]:_0x5f137b[_0x1751('0x2c')];if(_0x567bee['query']['includeAll']){_0x4cc817[_0x1751('0x40')]=[{'all':!![]}];}_0x4cc817=_['merge']({},_0x4cc817,_0x567bee[_0x1751('0x3c')]);return db[_0x1751('0x3e')][_0x1751('0x46')](_0x4cc817)['then'](handleEntityNotFound(_0x6c0c4f,null))[_0x1751('0x23')](respondWithResult(_0x6c0c4f,null))[_0x1751('0x43')](handleError(_0x6c0c4f,null));};exports['create']=function(_0x34948a,_0xd6741){return db[_0x1751('0x3e')][_0x1751('0x47')](_0x34948a[_0x1751('0x48')],{})['then'](respondWithResult(_0xd6741,0xc9))[_0x1751('0x43')](handleError(_0xd6741,null));};exports['update']=function(_0x2c2dae,_0x4cf9d0){if(_0x2c2dae[_0x1751('0x48')]['id']){delete _0x2c2dae['body']['id'];}return db[_0x1751('0x3e')][_0x1751('0x46')]({'where':{'id':_0x2c2dae[_0x1751('0x49')]['id']}})[_0x1751('0x23')](handleEntityNotFound(_0x4cf9d0,null))['then'](saveUpdates(_0x2c2dae[_0x1751('0x48')],null))[_0x1751('0x23')](respondWithResult(_0x4cf9d0,null))[_0x1751('0x43')](handleError(_0x4cf9d0,null));};exports[_0x1751('0x24')]=function(_0x4c3211,_0x35ba60){return db[_0x1751('0x3e')][_0x1751('0x46')]({'where':{'id':_0x4c3211[_0x1751('0x49')]['id']}})[_0x1751('0x23')](handleEntityNotFound(_0x35ba60,null))[_0x1751('0x23')](removeEntity(_0x35ba60,null))[_0x1751('0x43')](handleError(_0x35ba60,null));};exports['getConfigurations']=function(_0x46f652,_0x2635c9,_0x35e378){var _0x5c8a1d={};var _0x5d7586={};var _0x24f86d;var _0x4cc4fa;return db[_0x1751('0x3e')][_0x1751('0x4a')]({'where':{'id':_0x46f652[_0x1751('0x49')]['id']}})[_0x1751('0x23')](handleEntityNotFound(_0x2635c9,null))[_0x1751('0x23')](function(_0x4e01c6){if(_0x4e01c6){_0x24f86d=_0x4e01c6;_0x5d7586[_0x1751('0x2c')]=_[_0x1751('0x2f')](db[_0x1751('0x4b')][_0x1751('0x29')]);_0x5d7586[_0x1751('0x2e')]=_['keys'](_0x46f652[_0x1751('0x2e')]);_0x5d7586[_0x1751('0x30')]=_[_0x1751('0x31')](_0x5d7586[_0x1751('0x2c')],_0x5d7586[_0x1751('0x2e')]);_0x5c8a1d[_0x1751('0x33')]=_[_0x1751('0x31')](_0x5d7586['model'],qs[_0x1751('0x32')](_0x46f652['query'][_0x1751('0x32')]));_0x5c8a1d[_0x1751('0x33')]=_0x5c8a1d['attributes'][_0x1751('0x45')]?_0x5c8a1d[_0x1751('0x33')]:_0x5d7586[_0x1751('0x2c')];_0x5c8a1d[_0x1751('0x37')]=qs[_0x1751('0x38')](_0x46f652[_0x1751('0x2e')][_0x1751('0x38')]);_0x5c8a1d[_0x1751('0x3d')]=qs['filters'](_['pick'](_0x46f652[_0x1751('0x2e')],_0x5d7586['filters']));if(_0x46f652['query'][_0x1751('0x39')]){_0x5c8a1d[_0x1751('0x3d')]=_[_0x1751('0x4c')](_0x5c8a1d['where'],{'$or':_['map'](_0x5c8a1d['attributes'],function(_0x52030c){var _0x571ef1={};_0x571ef1[_0x52030c]={'$like':'%'+_0x46f652[_0x1751('0x2e')]['filter']+'%'};return _0x571ef1;})});}_0x5c8a1d=_[_0x1751('0x4c')]({},_0x5c8a1d,_0x46f652[_0x1751('0x3c')]);return _0x24f86d[_0x1751('0x4d')](_0x5c8a1d);}})[_0x1751('0x23')](function(_0x240168){if(_0x240168){_0x4cc4fa=_0x240168[_0x1751('0x45')];if(!_0x46f652[_0x1751('0x2e')][_0x1751('0x34')](_0x1751('0x35'))){_0x5c8a1d[_0x1751('0x36')]=qs[_0x1751('0x36')](_0x46f652[_0x1751('0x2e')][_0x1751('0x36')]);_0x5c8a1d['offset']=qs[_0x1751('0x1b')](_0x46f652[_0x1751('0x2e')][_0x1751('0x1b')]);}return _0x24f86d[_0x1751('0x4d')](_0x5c8a1d);}})[_0x1751('0x23')](function(_0x8413a4){if(_0x8413a4){return _0x8413a4?{'count':_0x4cc4fa,'rows':_0x8413a4}:null;}})['then'](respondWithResult(_0x2635c9,null))[_0x1751('0x43')](handleError(_0x2635c9,null));};exports[_0x1751('0x4e')]=function(_0xafcc2b,_0x460016,_0x231473){if(_0xafcc2b[_0x1751('0x48')]['id']){delete _0xafcc2b[_0x1751('0x48')]['id'];}return db[_0x1751('0x3e')]['findOne']({'where':{'id':_0xafcc2b[_0x1751('0x49')]['id']}})[_0x1751('0x23')](handleEntityNotFound(_0x460016,null))['then'](function(_0x35af40){if(_0x35af40){_0xafcc2b[_0x1751('0x48')][_0x1751('0x4f')]=_0x35af40['id'];_0xafcc2b[_0x1751('0x48')][_0x1751('0x50')]=integrations[_0x1751('0x51')](_0xafcc2b[_0x1751('0x48')][_0x1751('0x52')],_0xafcc2b[_0x1751('0x48')]['type']);_0xafcc2b[_0x1751('0x48')][_0x1751('0x53')]=integrations[_0x1751('0x54')](_0xafcc2b['body']['channel'],_0xafcc2b[_0x1751('0x48')]['type']);return db[_0x1751('0x4b')][_0x1751('0x47')](_0xafcc2b['body'],{'include':[{'model':db[_0x1751('0x55')],'as':_0x1751('0x50')},{'model':db[_0x1751('0x55')],'as':_0x1751('0x53')}]});}return null;})[_0x1751('0x23')](respondWithResult(_0x460016,null))[_0x1751('0x43')](handleError(_0x460016,null));};exports[_0x1751('0x56')]=function(_0x3f7442,_0x1e1fa2,_0x39f221){var _0x1eeb9e='';var _0x158dab='';return db[_0x1751('0x3e')][_0x1751('0x4a')]({'where':{'id':_0x3f7442[_0x1751('0x49')]['id']},'attributes':['id',_0x1751('0x57'),_0x1751('0x58'),_0x1751('0x59')]})[_0x1751('0x23')](handleEntityNotFound(_0x1e1fa2,null))['then'](function(_0xbb20fd){if(_0xbb20fd){_0x158dab=_0xbb20fd[_0x1751('0x57')];_0x1eeb9e=_0xbb20fd[_0x1751('0x58')];var _0x4d99ae=_0xbb20fd[_0x1751('0x58')][_0x1751('0x5a')](-0x1);if(_0x4d99ae==='/'){_0x1eeb9e=_0x1eeb9e['substring'](0x0,_0x1eeb9e[_0x1751('0x5b')](_0x4d99ae));}return rp({'method':_0x1751('0x5c'),'uri':util[_0x1751('0x5d')](_0x1751('0x5e'),_0x1eeb9e,'/api/selector/owners'),'headers':{'Authorization':_0x1751('0x5f')+_0xbb20fd[_0x1751('0x59')]},'json':!![]});}})[_0x1751('0x23')](function(_0x4dedc8){if(_0x4dedc8){var _0x2068b2=_0x4dedc8['users'];var _0x573157=![];var _0xf40136=null;for(_0xf40136=0x0;_0xf40136<_0x2068b2[_0x1751('0x45')];_0xf40136++){if(_0x2068b2[_0xf40136]['email']===_0x158dab){_0x573157=!![];}}if(_0x573157){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1751('0x60')});}}})[_0x1751('0x23')](respondWithResult(_0x1e1fa2,null))[_0x1751('0x43')](function(_0x1962ae){var _0x159eb0=_0x3f7442['query'][_0x1751('0x61')]?0x1f4:_0x1962ae['statusCode']||0x1f4;logger[_0x1751('0x25')](_0x1751('0x62'),'getFields',_0x159eb0,JSON[_0x1751('0x63')](_0x1962ae));delete _0x1962ae[_0x1751('0x2d')];if(_0x159eb0===0x191){_0x159eb0=0x190;}_0x1e1fa2[_0x1751('0x18')](_0x159eb0)[_0x1751('0x26')](_0x3f7442[_0x1751('0x2e')]['test']?{'message':_0x1751('0x64'),'statusCode':_0x1962ae[_0x1751('0x65')]}:_0x1962ae);});}; \ No newline at end of file +var _0x9591=['where','filters','pick','filter','merge','type','VIRTUAL','options','FreshsalesAccount','rows','catch','show','params','keys','includeAll','include','body','update','find','FreshsalesConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','create','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x40d24a,_0x2e7761){var _0x272a3e=function(_0x34678d){while(--_0x34678d){_0x40d24a['push'](_0x40d24a['shift']());}};_0x272a3e(++_0x2e7761);}(_0x9591,0x162));var _0x1959=function(_0x56c809,_0x28dd9a){_0x56c809=_0x56c809-0x0;var _0x14b0a7=_0x9591[_0x56c809];return _0x14b0a7;};'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(_0x1959('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1959('0x1'));var util=require(_0x1959('0x2'));var path=require(_0x1959('0x3'));var sox=require('sox');var csv=require(_0x1959('0x4'));var ejs=require(_0x1959('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1959('0x6'));var squel=require(_0x1959('0x7'));var crypto=require('crypto');var jsforce=require(_0x1959('0x8'));var deskjs=require(_0x1959('0x9'));var toCsv=require(_0x1959('0x4'));var querystring=require(_0x1959('0xa'));var Papa=require(_0x1959('0xb'));var Redis=require(_0x1959('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1959('0xd'));var as=require(_0x1959('0xe'));var hardwareService=require(_0x1959('0xf'));var logger=require(_0x1959('0x10'))(_0x1959('0x11'));var utils=require(_0x1959('0x12'));var config=require(_0x1959('0x13'));var licenseUtil=require(_0x1959('0x14'));var db=require(_0x1959('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2f2bf1,_0x57895a){_0x57895a=_0x57895a||0xcc;return function(_0x39b7bf){if(_0x39b7bf){return _0x2f2bf1[_0x1959('0x16')](_0x57895a);}return _0x2f2bf1[_0x1959('0x17')](_0x57895a)[_0x1959('0x18')]();};}function respondWithResult(_0xa9c1ed,_0xf6f766){_0xf6f766=_0xf6f766||0xc8;return function(_0x54c794){if(_0x54c794){return _0xa9c1ed[_0x1959('0x17')](_0xf6f766)[_0x1959('0x19')](_0x54c794);}};}function respondWithFilteredResult(_0x536b69,_0x24035d){return function(_0x116b34){if(_0x116b34){var _0x926540=typeof _0x24035d[_0x1959('0x1a')]===_0x1959('0x1b')&&typeof _0x24035d[_0x1959('0x1c')]===_0x1959('0x1b');var _0x399b36=_0x116b34[_0x1959('0x1d')];var _0x44440b=_0x926540?0x0:_0x24035d[_0x1959('0x1a')];var _0x2c114d=_0x926540?_0x116b34[_0x1959('0x1d')]:_0x24035d['offset']+_0x24035d[_0x1959('0x1c')];var _0xd37fa3;if(_0x2c114d>=_0x399b36){_0x2c114d=_0x399b36;_0xd37fa3=0xc8;}else{_0xd37fa3=0xce;}_0x536b69['status'](_0xd37fa3);return _0x536b69[_0x1959('0x1e')](_0x1959('0x1f'),_0x44440b+'-'+_0x2c114d+'/'+_0x399b36)['json'](_0x116b34);}return null;};}function patchUpdates(_0xb53301){return function(_0x392c92){try{jsonpatch[_0x1959('0x20')](_0x392c92,_0xb53301,!![]);}catch(_0x34e15e){return BPromise[_0x1959('0x21')](_0x34e15e);}return _0x392c92['save']();};}function saveUpdates(_0x951cbb,_0xb28478){return function(_0x47f75b){if(_0x47f75b){return _0x47f75b['update'](_0x951cbb)['then'](function(_0x1746b3){return _0x1746b3;});}return null;};}function removeEntity(_0x424c8f,_0x5524d4){return function(_0x2f2604){if(_0x2f2604){return _0x2f2604['destroy']()[_0x1959('0x22')](function(){_0x424c8f[_0x1959('0x17')](0xcc)[_0x1959('0x18')]();});}};}function handleEntityNotFound(_0x28517f,_0xe6f9ae){return function(_0x10fa09){if(!_0x10fa09){_0x28517f[_0x1959('0x16')](0x194);}return _0x10fa09;};}function handleError(_0x362914,_0x3def2d){_0x3def2d=_0x3def2d||0x1f4;return function(_0x5048bf){logger[_0x1959('0x23')](_0x5048bf[_0x1959('0x24')]);if(_0x5048bf[_0x1959('0x25')]){delete _0x5048bf[_0x1959('0x25')];}_0x362914[_0x1959('0x17')](_0x3def2d)[_0x1959('0x26')](_0x5048bf);};}exports[_0x1959('0x27')]=function(_0x20ef02,_0x4cf893){var _0x10f8a4={},_0x5cb9f0={},_0x47bbeb={'count':0x0,'rows':[]};var _0x1cee00=_[_0x1959('0x28')](db['FreshsalesAccount'][_0x1959('0x29')],function(_0xb16bed){return{'name':_0xb16bed[_0x1959('0x2a')],'type':_0xb16bed['type'][_0x1959('0x2b')]};});_0x5cb9f0[_0x1959('0x2c')]=_['map'](_0x1cee00,_0x1959('0x25'));_0x5cb9f0['query']=_['keys'](_0x20ef02[_0x1959('0x2d')]);_0x5cb9f0['filters']=_['intersection'](_0x5cb9f0['model'],_0x5cb9f0[_0x1959('0x2d')]);_0x10f8a4['attributes']=_[_0x1959('0x2e')](_0x5cb9f0[_0x1959('0x2c')],qs[_0x1959('0x2f')](_0x20ef02[_0x1959('0x2d')]['fields']));_0x10f8a4[_0x1959('0x30')]=_0x10f8a4[_0x1959('0x30')][_0x1959('0x31')]?_0x10f8a4[_0x1959('0x30')]:_0x5cb9f0[_0x1959('0x2c')];if(!_0x20ef02[_0x1959('0x2d')][_0x1959('0x32')](_0x1959('0x33'))){_0x10f8a4[_0x1959('0x1c')]=qs['limit'](_0x20ef02[_0x1959('0x2d')]['limit']);_0x10f8a4[_0x1959('0x1a')]=qs[_0x1959('0x1a')](_0x20ef02[_0x1959('0x2d')]['offset']);}_0x10f8a4[_0x1959('0x34')]=qs['sort'](_0x20ef02['query'][_0x1959('0x35')]);_0x10f8a4[_0x1959('0x36')]=qs[_0x1959('0x37')](_[_0x1959('0x38')](_0x20ef02[_0x1959('0x2d')],_0x5cb9f0[_0x1959('0x37')]),_0x1cee00);if(_0x20ef02[_0x1959('0x2d')][_0x1959('0x39')]){_0x10f8a4[_0x1959('0x36')]=_[_0x1959('0x3a')](_0x10f8a4['where'],{'$or':_[_0x1959('0x28')](_0x1cee00,function(_0x29ad99){if(_0x29ad99[_0x1959('0x3b')]!==_0x1959('0x3c')){var _0x3de979={};_0x3de979[_0x29ad99[_0x1959('0x25')]]={'$like':'%'+_0x20ef02[_0x1959('0x2d')][_0x1959('0x39')]+'%'};return _0x3de979;}})});}_0x10f8a4=_[_0x1959('0x3a')]({},_0x10f8a4,_0x20ef02[_0x1959('0x3d')]);var _0x48b342={'where':_0x10f8a4[_0x1959('0x36')]};return db[_0x1959('0x3e')][_0x1959('0x1d')](_0x48b342)[_0x1959('0x22')](function(_0x51e1cf){_0x47bbeb[_0x1959('0x1d')]=_0x51e1cf;if(_0x20ef02['query']['includeAll']){_0x10f8a4['include']=[{'all':!![]}];}return db[_0x1959('0x3e')]['findAll'](_0x10f8a4);})[_0x1959('0x22')](function(_0x574dd0){_0x47bbeb[_0x1959('0x3f')]=_0x574dd0;return _0x47bbeb;})[_0x1959('0x22')](respondWithFilteredResult(_0x4cf893,_0x10f8a4))[_0x1959('0x40')](handleError(_0x4cf893,null));};exports[_0x1959('0x41')]=function(_0x235bc8,_0x32f4f5){var _0x50124e={'raw':![],'where':{'id':_0x235bc8[_0x1959('0x42')]['id']}},_0x3c606e={};_0x3c606e[_0x1959('0x2c')]=_[_0x1959('0x43')](db[_0x1959('0x3e')][_0x1959('0x29')]);_0x3c606e[_0x1959('0x2d')]=_[_0x1959('0x43')](_0x235bc8[_0x1959('0x2d')]);_0x3c606e[_0x1959('0x37')]=_[_0x1959('0x2e')](_0x3c606e[_0x1959('0x2c')],_0x3c606e[_0x1959('0x2d')]);_0x50124e[_0x1959('0x30')]=_[_0x1959('0x2e')](_0x3c606e['model'],qs['fields'](_0x235bc8[_0x1959('0x2d')]['fields']));_0x50124e[_0x1959('0x30')]=_0x50124e[_0x1959('0x30')][_0x1959('0x31')]?_0x50124e[_0x1959('0x30')]:_0x3c606e[_0x1959('0x2c')];if(_0x235bc8[_0x1959('0x2d')][_0x1959('0x44')]){_0x50124e[_0x1959('0x45')]=[{'all':!![]}];}_0x50124e=_[_0x1959('0x3a')]({},_0x50124e,_0x235bc8[_0x1959('0x3d')]);return db[_0x1959('0x3e')]['find'](_0x50124e)['then'](handleEntityNotFound(_0x32f4f5,null))['then'](respondWithResult(_0x32f4f5,null))[_0x1959('0x40')](handleError(_0x32f4f5,null));};exports['create']=function(_0x21bc85,_0x4688f8){return db[_0x1959('0x3e')]['create'](_0x21bc85[_0x1959('0x46')],{})[_0x1959('0x22')](respondWithResult(_0x4688f8,0xc9))[_0x1959('0x40')](handleError(_0x4688f8,null));};exports[_0x1959('0x47')]=function(_0x2e3d7f,_0x494755){if(_0x2e3d7f[_0x1959('0x46')]['id']){delete _0x2e3d7f[_0x1959('0x46')]['id'];}return db[_0x1959('0x3e')][_0x1959('0x48')]({'where':{'id':_0x2e3d7f['params']['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x494755,null))[_0x1959('0x22')](saveUpdates(_0x2e3d7f[_0x1959('0x46')],null))[_0x1959('0x22')](respondWithResult(_0x494755,null))[_0x1959('0x40')](handleError(_0x494755,null));};exports['destroy']=function(_0x5ea361,_0x308ed4){return db[_0x1959('0x3e')][_0x1959('0x48')]({'where':{'id':_0x5ea361[_0x1959('0x42')]['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x308ed4,null))[_0x1959('0x22')](removeEntity(_0x308ed4,null))[_0x1959('0x40')](handleError(_0x308ed4,null));};exports['getConfigurations']=function(_0x172355,_0x54a56f,_0x33df2b){var _0x37177f={};var _0x36d311={};var _0x2b5980;var _0x928b07;return db[_0x1959('0x3e')]['findOne']({'where':{'id':_0x172355[_0x1959('0x42')]['id']}})['then'](handleEntityNotFound(_0x54a56f,null))[_0x1959('0x22')](function(_0x584fa9){if(_0x584fa9){_0x2b5980=_0x584fa9;_0x36d311[_0x1959('0x2c')]=_[_0x1959('0x43')](db[_0x1959('0x49')]['rawAttributes']);_0x36d311['query']=_['keys'](_0x172355['query']);_0x36d311[_0x1959('0x37')]=_['intersection'](_0x36d311['model'],_0x36d311[_0x1959('0x2d')]);_0x37177f[_0x1959('0x30')]=_['intersection'](_0x36d311['model'],qs[_0x1959('0x2f')](_0x172355[_0x1959('0x2d')]['fields']));_0x37177f[_0x1959('0x30')]=_0x37177f[_0x1959('0x30')][_0x1959('0x31')]?_0x37177f[_0x1959('0x30')]:_0x36d311[_0x1959('0x2c')];_0x37177f[_0x1959('0x34')]=qs[_0x1959('0x35')](_0x172355[_0x1959('0x2d')][_0x1959('0x35')]);_0x37177f[_0x1959('0x36')]=qs[_0x1959('0x37')](_[_0x1959('0x38')](_0x172355[_0x1959('0x2d')],_0x36d311[_0x1959('0x37')]));if(_0x172355[_0x1959('0x2d')][_0x1959('0x39')]){_0x37177f[_0x1959('0x36')]=_['merge'](_0x37177f[_0x1959('0x36')],{'$or':_[_0x1959('0x28')](_0x37177f[_0x1959('0x30')],function(_0xd0dcc3){var _0x56db18={};_0x56db18[_0xd0dcc3]={'$like':'%'+_0x172355[_0x1959('0x2d')][_0x1959('0x39')]+'%'};return _0x56db18;})});}_0x37177f=_[_0x1959('0x3a')]({},_0x37177f,_0x172355[_0x1959('0x3d')]);return _0x2b5980[_0x1959('0x4a')](_0x37177f);}})['then'](function(_0x5a5351){if(_0x5a5351){_0x928b07=_0x5a5351[_0x1959('0x31')];if(!_0x172355['query'][_0x1959('0x32')](_0x1959('0x33'))){_0x37177f['limit']=qs[_0x1959('0x1c')](_0x172355[_0x1959('0x2d')][_0x1959('0x1c')]);_0x37177f[_0x1959('0x1a')]=qs[_0x1959('0x1a')](_0x172355[_0x1959('0x2d')]['offset']);}return _0x2b5980['getConfigurations'](_0x37177f);}})[_0x1959('0x22')](function(_0x5e52f1){if(_0x5e52f1){return _0x5e52f1?{'count':_0x928b07,'rows':_0x5e52f1}:null;}})[_0x1959('0x22')](respondWithResult(_0x54a56f,null))[_0x1959('0x40')](handleError(_0x54a56f,null));};exports['addConfiguration']=function(_0x58e127,_0x335995,_0x1f4c6f){if(_0x58e127['body']['id']){delete _0x58e127[_0x1959('0x46')]['id'];}return db[_0x1959('0x3e')][_0x1959('0x4b')]({'where':{'id':_0x58e127[_0x1959('0x42')]['id']}})[_0x1959('0x22')](handleEntityNotFound(_0x335995,null))[_0x1959('0x22')](function(_0x18bd73){if(_0x18bd73){_0x58e127[_0x1959('0x46')][_0x1959('0x4c')]=_0x18bd73['id'];_0x58e127[_0x1959('0x46')][_0x1959('0x4d')]=integrations[_0x1959('0x4e')](_0x58e127['body'][_0x1959('0x4f')],_0x58e127[_0x1959('0x46')][_0x1959('0x3b')]);_0x58e127[_0x1959('0x46')]['Descriptions']=integrations[_0x1959('0x50')](_0x58e127[_0x1959('0x46')]['channel'],_0x58e127[_0x1959('0x46')][_0x1959('0x3b')]);return db[_0x1959('0x49')][_0x1959('0x51')](_0x58e127['body'],{'include':[{'model':db[_0x1959('0x52')],'as':_0x1959('0x4d')},{'model':db[_0x1959('0x52')],'as':_0x1959('0x53')}]});}return null;})['then'](respondWithResult(_0x335995,null))[_0x1959('0x40')](handleError(_0x335995,null));};exports[_0x1959('0x54')]=function(_0x3748ed,_0x554ab5,_0x164475){var _0xa088aa='';var _0x409420='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3748ed[_0x1959('0x42')]['id']},'attributes':['id','username',_0x1959('0x55'),_0x1959('0x56')]})['then'](handleEntityNotFound(_0x554ab5,null))[_0x1959('0x22')](function(_0x5bf4b5){if(_0x5bf4b5){_0x409420=_0x5bf4b5[_0x1959('0x57')];_0xa088aa=_0x5bf4b5['remoteUri'];var _0x164492=_0x5bf4b5[_0x1959('0x55')][_0x1959('0x58')](-0x1);if(_0x164492==='/'){_0xa088aa=_0xa088aa['substring'](0x0,_0xa088aa[_0x1959('0x59')](_0x164492));}return rp({'method':_0x1959('0x5a'),'uri':util[_0x1959('0x5b')](_0x1959('0x5c'),_0xa088aa,_0x1959('0x5d')),'headers':{'Authorization':_0x1959('0x5e')+_0x5bf4b5[_0x1959('0x56')]},'json':!![]});}})['then'](function(_0x17faea){if(_0x17faea){var _0x1586f1=_0x17faea[_0x1959('0x5f')];var _0x332106=![];var _0x334a76=null;for(_0x334a76=0x0;_0x334a76<_0x1586f1['length'];_0x334a76++){if(_0x1586f1[_0x334a76]['email']===_0x409420){_0x332106=!![];}}if(_0x332106){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1959('0x60')});}}})[_0x1959('0x22')](respondWithResult(_0x554ab5,null))['catch'](function(_0x125dd1){var _0x23a8f9=_0x3748ed[_0x1959('0x2d')][_0x1959('0x61')]?0x1f4:_0x125dd1[_0x1959('0x62')]||0x1f4;logger[_0x1959('0x23')](_0x1959('0x63'),_0x1959('0x54'),_0x23a8f9,JSON[_0x1959('0x64')](_0x125dd1));delete _0x125dd1[_0x1959('0x25')];if(_0x23a8f9===0x191){_0x23a8f9=0x190;}_0x554ab5[_0x1959('0x17')](_0x23a8f9)[_0x1959('0x26')](_0x3748ed[_0x1959('0x2d')]['test']?{'message':_0x1959('0x65'),'statusCode':_0x125dd1[_0x1959('0x62')]}:_0x125dd1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b95a05e..b913cdb 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5fab,0x177));var _0xb5fa=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5fab[_0x467488];return _0x56107f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x1967,0x173));var _0x7196=function(_0x4d125a,_0x47b8a9){_0x4d125a=_0x4d125a-0x0;var _0x61ca0d=_0x1967[_0x4d125a];return _0x61ca0d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7196('0xa')]=function(_0x186175,_0x194746){return _0x186175[_0x7196('0xb')](_0x7196('0xc'),attributes,{'tableName':_0x7196('0xd'),'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 28b992f..e681599 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 _0x627e=['request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','raw','options','where','map','model','attributes','include','then','debug','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x3a07d4,_0xa80b88){var _0x2c352=function(_0x27926b){while(--_0x27926b){_0x3a07d4['push'](_0x3a07d4['shift']());}};_0x2c352(++_0xa80b88);}(_0x627e,0x14a));var _0xe627=function(_0x3eef10,_0xf14513){_0x3eef10=_0x3eef10-0x0;var _0x378bd7=_0x627e[_0x3eef10];return _0x378bd7;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['FreshsalesAccount'][_0xe627('0x15')]({'raw':_0x56559b['options']?_0x56559b['options'][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x56559b['options']?_0x56559b[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x56559b['options']?_0x56559b['options']['attributes']||null:null,'limit':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['limit']||null:null,'include':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['include']?_[_0xe627('0x19')](_0x56559b[_0xe627('0x17')]['include'],function(_0x42f3d1){return{'model':db[_0x42f3d1[_0xe627('0x1a')]],'as':_0x42f3d1['as'],'attributes':_0x42f3d1[_0xe627('0x1b')],'include':_0x42f3d1['include']?_[_0xe627('0x19')](_0x42f3d1[_0xe627('0x1c')],function(_0x1a5081){return{'model':db[_0x1a5081[_0xe627('0x1a')]],'as':_0x1a5081['as'],'attributes':_0x1a5081['attributes'],'include':_0x1a5081[_0xe627('0x1c')]?_[_0xe627('0x19')](_0x1a5081[_0xe627('0x1c')],function(_0x29eb8e){return{'model':db[_0x29eb8e[_0xe627('0x1a')]],'as':_0x29eb8e['as'],'attributes':_0x29eb8e[_0xe627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x44c9f7){logger[_0xe627('0xb')]('GetFreshsalesAccount',_0x56559b);logger[_0xe627('0x1e')]('GetFreshsalesAccount',_0x56559b,JSON['stringify'](_0x44c9f7));_0x538b22(_0x44c9f7);})[_0xe627('0x13')](function(_0xdf63c8){logger['error'](_0xe627('0x14'),_0xdf63c8['message'],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0xdf63c8['message']));});});};exports[_0xe627('0x1f')]=function(_0x26833a){var _0x5d8992=this;return new Promise(function(_0x33e9dd,_0x4f92c9){return db[_0xe627('0x20')][_0xe627('0x21')]({'raw':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x1b')]||null:null,'include':_0x26833a['options']?_0x26833a['options'][_0xe627('0x1c')]?_['map'](_0x26833a[_0xe627('0x17')]['include'],function(_0x56d1d7){return{'model':db[_0x56d1d7[_0xe627('0x1a')]],'as':_0x56d1d7['as'],'attributes':_0x56d1d7['attributes'],'include':_0x56d1d7['include']?_[_0xe627('0x19')](_0x56d1d7[_0xe627('0x1c')],function(_0x55f001){return{'model':db[_0x55f001['model']],'as':_0x55f001['as'],'attributes':_0x55f001['attributes'],'include':_0x55f001['include']?_[_0xe627('0x19')](_0x55f001['include'],function(_0x39338c){return{'model':db[_0x39338c[_0xe627('0x1a')]],'as':_0x39338c['as'],'attributes':_0x39338c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x35a303){logger['info'](_0xe627('0x1f'),_0x26833a);logger[_0xe627('0x1e')](_0xe627('0x1f'),_0x26833a,JSON[_0xe627('0xf')](_0x35a303));_0x33e9dd(_0x35a303);})[_0xe627('0x13')](function(_0x28fd59){logger['error'](_0xe627('0x1f'),_0x28fd59['message'],_0x26833a);_0x4f92c9(_0x5d8992[_0xe627('0x10')](0x1f4,_0x28fd59['message']));});});}; \ No newline at end of file +var _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x54e0cc,_0x559c79){var _0xfd954c=function(_0xa2f897){while(--_0xa2f897){_0x54e0cc['push'](_0x54e0cc['shift']());}};_0xfd954c(++_0x559c79);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4dcd47f..28096fa 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 _0x8bc0=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x402c43,_0x51fbd2){var _0x575fe2=function(_0x2b1658){while(--_0x2b1658){_0x402c43['push'](_0x402c43['shift']());}};_0x575fe2(++_0x51fbd2);}(_0x8bc0,0xbc));var _0x08bc=function(_0x17f87d,_0x184ea7){_0x17f87d=_0x17f87d-0x0;var _0x558ee9=_0x8bc0[_0x17f87d];return _0x558ee9;};'use strict';var multer=require(_0x08bc('0x0'));var util=require(_0x08bc('0x1'));var path=require(_0x08bc('0x2'));var timeout=require(_0x08bc('0x3'));var express=require(_0x08bc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x08bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x08bc('0x6'));var controller=require(_0x08bc('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x08bc('0x8')]('/:id',auth[_0x08bc('0x9')](),controller[_0x08bc('0xa')]);router[_0x08bc('0x8')](_0x08bc('0xb'),auth['isAuthenticated'](),controller[_0x08bc('0xc')]);router[_0x08bc('0x8')]('/:id/descriptions',auth[_0x08bc('0x9')](),controller[_0x08bc('0xd')]);router[_0x08bc('0x8')](_0x08bc('0xe'),auth[_0x08bc('0x9')](),controller[_0x08bc('0xf')]);router[_0x08bc('0x10')]('/',auth[_0x08bc('0x9')](),controller[_0x08bc('0x11')]);router[_0x08bc('0x12')](_0x08bc('0x13'),auth[_0x08bc('0x9')](),controller['update']);router[_0x08bc('0x14')]('/:id',auth[_0x08bc('0x9')](),controller[_0x08bc('0x15')]);module[_0x08bc('0x16')]=router; \ No newline at end of file +var _0x7dcf=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x158057,_0x242072){var _0x237a4a=function(_0x58edce){while(--_0x58edce){_0x158057['push'](_0x158057['shift']());}};_0x237a4a(++_0x242072);}(_0x7dcf,0xb2));var _0xf7dc=function(_0x44a9c8,_0x19facb){_0x44a9c8=_0x44a9c8-0x0;var _0x3a3d70=_0x7dcf[_0x44a9c8];return _0x3a3d70;};'use strict';var multer=require(_0xf7dc('0x0'));var util=require(_0xf7dc('0x1'));var path=require(_0xf7dc('0x2'));var timeout=require(_0xf7dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7dc('0x4'));var auth=require(_0xf7dc('0x5'));var interaction=require(_0xf7dc('0x6'));var config=require(_0xf7dc('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xf7dc('0x8')](),controller['index']);router[_0xf7dc('0x9')](_0xf7dc('0xa'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0xb')]);router[_0xf7dc('0x9')](_0xf7dc('0xc'),auth[_0xf7dc('0x8')](),controller['getSubjects']);router['get'](_0xf7dc('0xd'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0xe')]);router['get'](_0xf7dc('0xf'),auth[_0xf7dc('0x8')](),controller[_0xf7dc('0x10')]);router[_0xf7dc('0x11')]('/',auth[_0xf7dc('0x8')](),controller[_0xf7dc('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf7dc('0x13')](_0xf7dc('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf7dc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5cca45a..664129b 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 _0xf68d=['exports','STRING','sequelize'];(function(_0x3577ad,_0x11e389){var _0x56c663=function(_0xf6273d){while(--_0xf6273d){_0x3577ad['push'](_0x3577ad['shift']());}};_0x56c663(++_0x11e389);}(_0xf68d,0x1ca));var _0xdf68=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xf68d[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0xdf68('0x0'));module[_0xdf68('0x1')]={'name':{'type':Sequelize[_0xdf68('0x2')]},'description':{'type':Sequelize[_0xdf68('0x2')]}}; \ No newline at end of file +var _0x264b=['sequelize','exports','STRING'];(function(_0x4ac7b4,_0xdbd931){var _0x478310=function(_0x5b70fa){while(--_0x5b70fa){_0x4ac7b4['push'](_0x4ac7b4['shift']());}};_0x478310(++_0xdbd931);}(_0x264b,0x183));var _0xb264=function(_0x250d57,_0x3e911b){_0x250d57=_0x250d57-0x0;var _0x17384e=_0x264b[_0x250d57];return _0x17384e;};'use strict';var Sequelize=require(_0xb264('0x0'));module[_0xb264('0x1')]={'name':{'type':Sequelize[_0xb264('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 2350b98..4facbc0 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 _0xa9d2=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','catch','params','intersection','create','body','find','getSubjects','findOne','FreshsalesField','length','pick','hasOwnProperty','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x24606a,_0x4f999){var _0x2168ce=function(_0x310646){while(--_0x310646){_0x24606a['push'](_0x24606a['shift']());}};_0x2168ce(++_0x4f999);}(_0xa9d2,0x17e));var _0x2a9d=function(_0x1fbc6c,_0xaab0ce){_0x1fbc6c=_0x1fbc6c-0x0;var _0x406cf4=_0xa9d2[_0x1fbc6c];return _0x406cf4;};'use strict';var emlformat=require(_0x2a9d('0x0'));var rimraf=require(_0x2a9d('0x1'));var zipdir=require(_0x2a9d('0x2'));var jsonpatch=require(_0x2a9d('0x3'));var rp=require(_0x2a9d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a9d('0x5'));var util=require(_0x2a9d('0x6'));var path=require(_0x2a9d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a9d('0x8'));var _=require(_0x2a9d('0x9'));var squel=require(_0x2a9d('0xa'));var crypto=require('crypto');var jsforce=require(_0x2a9d('0xb'));var deskjs=require(_0x2a9d('0xc'));var toCsv=require(_0x2a9d('0xd'));var querystring=require(_0x2a9d('0xe'));var Papa=require(_0x2a9d('0xf'));var Redis=require(_0x2a9d('0x10'));var authService=require(_0x2a9d('0x11'));var qs=require(_0x2a9d('0x12'));var as=require(_0x2a9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a9d('0x14'));var utils=require(_0x2a9d('0x15'));var config=require(_0x2a9d('0x16'));var licenseUtil=require(_0x2a9d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2468a7,_0x4ecd85){_0x4ecd85=_0x4ecd85||0xcc;return function(_0x29b342){if(_0x29b342){return _0x2468a7['sendStatus'](_0x4ecd85);}return _0x2468a7[_0x2a9d('0x18')](_0x4ecd85)[_0x2a9d('0x19')]();};}function respondWithResult(_0x726660,_0x378362){_0x378362=_0x378362||0xc8;return function(_0x123594){if(_0x123594){return _0x726660[_0x2a9d('0x18')](_0x378362)[_0x2a9d('0x1a')](_0x123594);}};}function respondWithFilteredResult(_0x189cdc,_0x273534){return function(_0x4b37cc){if(_0x4b37cc){var _0x52ee66=typeof _0x273534[_0x2a9d('0x1b')]===_0x2a9d('0x1c')&&typeof _0x273534['limit']===_0x2a9d('0x1c');var _0x5536b9=_0x4b37cc[_0x2a9d('0x1d')];var _0x4aa8ff=_0x52ee66?0x0:_0x273534[_0x2a9d('0x1b')];var _0x3c20a1=_0x52ee66?_0x4b37cc[_0x2a9d('0x1d')]:_0x273534[_0x2a9d('0x1b')]+_0x273534[_0x2a9d('0x1e')];var _0x285a79;if(_0x3c20a1>=_0x5536b9){_0x3c20a1=_0x5536b9;_0x285a79=0xc8;}else{_0x285a79=0xce;}_0x189cdc['status'](_0x285a79);return _0x189cdc[_0x2a9d('0x1f')](_0x2a9d('0x20'),_0x4aa8ff+'-'+_0x3c20a1+'/'+_0x5536b9)['json'](_0x4b37cc);}return null;};}function patchUpdates(_0x485ec8){return function(_0x6cc363){try{jsonpatch[_0x2a9d('0x21')](_0x6cc363,_0x485ec8,!![]);}catch(_0x4f6c37){return BPromise[_0x2a9d('0x22')](_0x4f6c37);}return _0x6cc363[_0x2a9d('0x23')]();};}function saveUpdates(_0x4e90f3,_0x15bdb4){return function(_0x1a1070){if(_0x1a1070){return _0x1a1070[_0x2a9d('0x24')](_0x4e90f3)[_0x2a9d('0x25')](function(_0x5d2b4d){return _0x5d2b4d;});}return null;};}function removeEntity(_0x83a096,_0x50282b){return function(_0x18f919){if(_0x18f919){return _0x18f919[_0x2a9d('0x26')]()['then'](function(){_0x83a096[_0x2a9d('0x18')](0xcc)[_0x2a9d('0x19')]();});}};}function handleEntityNotFound(_0x125e0c,_0x58ed6a){return function(_0x588ed6){if(!_0x588ed6){_0x125e0c[_0x2a9d('0x27')](0x194);}return _0x588ed6;};}function handleError(_0x16f86c,_0x9ba895){_0x9ba895=_0x9ba895||0x1f4;return function(_0x908816){logger['error'](_0x908816[_0x2a9d('0x28')]);if(_0x908816['name']){delete _0x908816[_0x2a9d('0x29')];}_0x16f86c[_0x2a9d('0x18')](_0x9ba895)['send'](_0x908816);};}exports['index']=function(_0x2109a4,_0x587aef){var _0x23a3f4={},_0x5afe2d={},_0x2e874a={'count':0x0,'rows':[]};var _0x55dced=_['map'](db['FreshsalesConfiguration'][_0x2a9d('0x2a')],function(_0x574c28){return{'name':_0x574c28[_0x2a9d('0x2b')],'type':_0x574c28[_0x2a9d('0x2c')][_0x2a9d('0x2d')]};});_0x5afe2d[_0x2a9d('0x2e')]=_[_0x2a9d('0x2f')](_0x55dced,_0x2a9d('0x29'));_0x5afe2d[_0x2a9d('0x30')]=_[_0x2a9d('0x31')](_0x2109a4[_0x2a9d('0x30')]);_0x5afe2d['filters']=_['intersection'](_0x5afe2d[_0x2a9d('0x2e')],_0x5afe2d['query']);_0x23a3f4[_0x2a9d('0x32')]=_['intersection'](_0x5afe2d[_0x2a9d('0x2e')],qs[_0x2a9d('0x33')](_0x2109a4[_0x2a9d('0x30')]['fields']));_0x23a3f4[_0x2a9d('0x32')]=_0x23a3f4['attributes']['length']?_0x23a3f4[_0x2a9d('0x32')]:_0x5afe2d[_0x2a9d('0x2e')];if(!_0x2109a4['query']['hasOwnProperty'](_0x2a9d('0x34'))){_0x23a3f4[_0x2a9d('0x1e')]=qs[_0x2a9d('0x1e')](_0x2109a4[_0x2a9d('0x30')]['limit']);_0x23a3f4[_0x2a9d('0x1b')]=qs['offset'](_0x2109a4[_0x2a9d('0x30')][_0x2a9d('0x1b')]);}_0x23a3f4[_0x2a9d('0x35')]=qs[_0x2a9d('0x36')](_0x2109a4['query']['sort']);_0x23a3f4[_0x2a9d('0x37')]=qs['filters'](_['pick'](_0x2109a4[_0x2a9d('0x30')],_0x5afe2d[_0x2a9d('0x38')]),_0x55dced);if(_0x2109a4[_0x2a9d('0x30')][_0x2a9d('0x39')]){_0x23a3f4['where']=_[_0x2a9d('0x3a')](_0x23a3f4['where'],{'$or':_[_0x2a9d('0x2f')](_0x55dced,function(_0x2b85f0){if(_0x2b85f0[_0x2a9d('0x2c')]!==_0x2a9d('0x3b')){var _0x1aa9d0={};_0x1aa9d0[_0x2b85f0[_0x2a9d('0x29')]]={'$like':'%'+_0x2109a4[_0x2a9d('0x30')][_0x2a9d('0x39')]+'%'};return _0x1aa9d0;}})});}_0x23a3f4=_[_0x2a9d('0x3a')]({},_0x23a3f4,_0x2109a4[_0x2a9d('0x3c')]);var _0x584825={'where':_0x23a3f4[_0x2a9d('0x37')]};return db[_0x2a9d('0x3d')][_0x2a9d('0x1d')](_0x584825)[_0x2a9d('0x25')](function(_0x31d24d){_0x2e874a[_0x2a9d('0x1d')]=_0x31d24d;if(_0x2109a4[_0x2a9d('0x30')][_0x2a9d('0x3e')]){_0x23a3f4[_0x2a9d('0x3f')]=[{'all':!![]}];}return db[_0x2a9d('0x3d')][_0x2a9d('0x40')](_0x23a3f4);})[_0x2a9d('0x25')](function(_0x3ef5d0){_0x2e874a['rows']=_0x3ef5d0;return _0x2e874a;})[_0x2a9d('0x25')](respondWithFilteredResult(_0x587aef,_0x23a3f4))[_0x2a9d('0x41')](handleError(_0x587aef,null));};exports['show']=function(_0x2a778c,_0x1d6749){var _0x4a9322={'raw':![],'where':{'id':_0x2a778c[_0x2a9d('0x42')]['id']}},_0xfc6fdf={};_0xfc6fdf['model']=_[_0x2a9d('0x31')](db[_0x2a9d('0x3d')][_0x2a9d('0x2a')]);_0xfc6fdf['query']=_['keys'](_0x2a778c[_0x2a9d('0x30')]);_0xfc6fdf[_0x2a9d('0x38')]=_['intersection'](_0xfc6fdf[_0x2a9d('0x2e')],_0xfc6fdf[_0x2a9d('0x30')]);_0x4a9322['attributes']=_[_0x2a9d('0x43')](_0xfc6fdf[_0x2a9d('0x2e')],qs[_0x2a9d('0x33')](_0x2a778c[_0x2a9d('0x30')]['fields']));_0x4a9322[_0x2a9d('0x32')]=_0x4a9322['attributes']['length']?_0x4a9322[_0x2a9d('0x32')]:_0xfc6fdf[_0x2a9d('0x2e')];if(_0x2a778c[_0x2a9d('0x30')][_0x2a9d('0x3e')]){_0x4a9322['include']=[{'all':!![]}];}_0x4a9322=_[_0x2a9d('0x3a')]({},_0x4a9322,_0x2a778c[_0x2a9d('0x3c')]);return db['FreshsalesConfiguration']['find'](_0x4a9322)[_0x2a9d('0x25')](handleEntityNotFound(_0x1d6749,null))[_0x2a9d('0x25')](respondWithResult(_0x1d6749,null))['catch'](handleError(_0x1d6749,null));};exports[_0x2a9d('0x44')]=function(_0x21a704,_0x1d4231){return db[_0x2a9d('0x3d')]['create'](_0x21a704['body'],{})['then'](respondWithResult(_0x1d4231,0xc9))[_0x2a9d('0x41')](handleError(_0x1d4231,null));};exports[_0x2a9d('0x24')]=function(_0x106ba9,_0x2d02c7){if(_0x106ba9[_0x2a9d('0x45')]['id']){delete _0x106ba9[_0x2a9d('0x45')]['id'];}return db[_0x2a9d('0x3d')][_0x2a9d('0x46')]({'where':{'id':_0x106ba9[_0x2a9d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d02c7,null))[_0x2a9d('0x25')](saveUpdates(_0x106ba9[_0x2a9d('0x45')],null))[_0x2a9d('0x25')](respondWithResult(_0x2d02c7,null))[_0x2a9d('0x41')](handleError(_0x2d02c7,null));};exports[_0x2a9d('0x26')]=function(_0x5f2400,_0x54cee0){return db[_0x2a9d('0x3d')][_0x2a9d('0x46')]({'where':{'id':_0x5f2400[_0x2a9d('0x42')]['id']}})[_0x2a9d('0x25')](handleEntityNotFound(_0x54cee0,null))[_0x2a9d('0x25')](removeEntity(_0x54cee0,null))[_0x2a9d('0x41')](handleError(_0x54cee0,null));};exports[_0x2a9d('0x47')]=function(_0x25ab0b,_0x26c7e5,_0x250891){var _0x2290e1={};var _0x13f945={};var _0x21a91c;var _0x43505e;return db[_0x2a9d('0x3d')][_0x2a9d('0x48')]({'where':{'id':_0x25ab0b[_0x2a9d('0x42')]['id']}})[_0x2a9d('0x25')](handleEntityNotFound(_0x26c7e5,null))[_0x2a9d('0x25')](function(_0xdce60b){if(_0xdce60b){_0x21a91c=_0xdce60b;_0x13f945[_0x2a9d('0x2e')]=_[_0x2a9d('0x31')](db[_0x2a9d('0x49')][_0x2a9d('0x2a')]);_0x13f945[_0x2a9d('0x30')]=_['keys'](_0x25ab0b[_0x2a9d('0x30')]);_0x13f945[_0x2a9d('0x38')]=_[_0x2a9d('0x43')](_0x13f945[_0x2a9d('0x2e')],_0x13f945['query']);_0x2290e1[_0x2a9d('0x32')]=_[_0x2a9d('0x43')](_0x13f945[_0x2a9d('0x2e')],qs[_0x2a9d('0x33')](_0x25ab0b['query'][_0x2a9d('0x33')]));_0x2290e1[_0x2a9d('0x32')]=_0x2290e1['attributes'][_0x2a9d('0x4a')]?_0x2290e1[_0x2a9d('0x32')]:_0x13f945[_0x2a9d('0x2e')];_0x2290e1['order']=qs[_0x2a9d('0x36')](_0x25ab0b[_0x2a9d('0x30')][_0x2a9d('0x36')]);_0x2290e1['where']=qs['filters'](_[_0x2a9d('0x4b')](_0x25ab0b[_0x2a9d('0x30')],_0x13f945[_0x2a9d('0x38')]));if(_0x25ab0b[_0x2a9d('0x30')]['filter']){_0x2290e1[_0x2a9d('0x37')]=_[_0x2a9d('0x3a')](_0x2290e1['where'],{'$or':_[_0x2a9d('0x2f')](_0x2290e1[_0x2a9d('0x32')],function(_0x5c1818){var _0x5133c1={};_0x5133c1[_0x5c1818]={'$like':'%'+_0x25ab0b[_0x2a9d('0x30')]['filter']+'%'};return _0x5133c1;})});}_0x2290e1=_['merge']({},_0x2290e1,_0x25ab0b[_0x2a9d('0x3c')]);return _0x21a91c['getSubjects'](_0x2290e1);}})[_0x2a9d('0x25')](function(_0x266117){if(_0x266117){_0x43505e=_0x266117[_0x2a9d('0x4a')];if(!_0x25ab0b['query'][_0x2a9d('0x4c')](_0x2a9d('0x34'))){_0x2290e1[_0x2a9d('0x1e')]=qs[_0x2a9d('0x1e')](_0x25ab0b['query'][_0x2a9d('0x1e')]);_0x2290e1[_0x2a9d('0x1b')]=qs[_0x2a9d('0x1b')](_0x25ab0b[_0x2a9d('0x30')][_0x2a9d('0x1b')]);}return _0x21a91c['getSubjects'](_0x2290e1);}})['then'](function(_0xa0806c){if(_0xa0806c){return _0xa0806c?{'count':_0x43505e,'rows':_0xa0806c}:null;}})['then'](respondWithResult(_0x26c7e5,null))[_0x2a9d('0x41')](handleError(_0x26c7e5,null));};exports['getDescriptions']=function(_0x5c9a64,_0x48b22f,_0x206e05){var _0x5c3e53={};var _0x9788ab={};var _0x4e96e1;var _0x150196;return db[_0x2a9d('0x3d')][_0x2a9d('0x48')]({'where':{'id':_0x5c9a64[_0x2a9d('0x42')]['id']}})[_0x2a9d('0x25')](handleEntityNotFound(_0x48b22f,null))['then'](function(_0x394ffe){if(_0x394ffe){_0x4e96e1=_0x394ffe;_0x9788ab[_0x2a9d('0x2e')]=_[_0x2a9d('0x31')](db[_0x2a9d('0x49')][_0x2a9d('0x2a')]);_0x9788ab[_0x2a9d('0x30')]=_['keys'](_0x5c9a64[_0x2a9d('0x30')]);_0x9788ab[_0x2a9d('0x38')]=_[_0x2a9d('0x43')](_0x9788ab['model'],_0x9788ab['query']);_0x5c3e53[_0x2a9d('0x32')]=_[_0x2a9d('0x43')](_0x9788ab['model'],qs[_0x2a9d('0x33')](_0x5c9a64[_0x2a9d('0x30')][_0x2a9d('0x33')]));_0x5c3e53[_0x2a9d('0x32')]=_0x5c3e53[_0x2a9d('0x32')]['length']?_0x5c3e53[_0x2a9d('0x32')]:_0x9788ab['model'];_0x5c3e53[_0x2a9d('0x35')]=qs['sort'](_0x5c9a64['query'][_0x2a9d('0x36')]);_0x5c3e53['where']=qs[_0x2a9d('0x38')](_[_0x2a9d('0x4b')](_0x5c9a64['query'],_0x9788ab[_0x2a9d('0x38')]));if(_0x5c9a64[_0x2a9d('0x30')][_0x2a9d('0x39')]){_0x5c3e53['where']=_[_0x2a9d('0x3a')](_0x5c3e53['where'],{'$or':_[_0x2a9d('0x2f')](_0x5c3e53[_0x2a9d('0x32')],function(_0x24119){var _0x16fdb2={};_0x16fdb2[_0x24119]={'$like':'%'+_0x5c9a64[_0x2a9d('0x30')][_0x2a9d('0x39')]+'%'};return _0x16fdb2;})});}_0x5c3e53=_[_0x2a9d('0x3a')]({},_0x5c3e53,_0x5c9a64[_0x2a9d('0x3c')]);return _0x4e96e1['getDescriptions'](_0x5c3e53);}})['then'](function(_0x848abe){if(_0x848abe){_0x150196=_0x848abe['length'];if(!_0x5c9a64[_0x2a9d('0x30')][_0x2a9d('0x4c')](_0x2a9d('0x34'))){_0x5c3e53['limit']=qs[_0x2a9d('0x1e')](_0x5c9a64['query'][_0x2a9d('0x1e')]);_0x5c3e53['offset']=qs[_0x2a9d('0x1b')](_0x5c9a64[_0x2a9d('0x30')][_0x2a9d('0x1b')]);}return _0x4e96e1['getDescriptions'](_0x5c3e53);}})[_0x2a9d('0x25')](function(_0x119077){if(_0x119077){return _0x119077?{'count':_0x150196,'rows':_0x119077}:null;}})[_0x2a9d('0x25')](respondWithResult(_0x48b22f,null))[_0x2a9d('0x41')](handleError(_0x48b22f,null));};exports['getFields']=function(_0x47df58,_0x58d85d,_0x46b630){var _0x446e78={};var _0x5a47e4={};var _0x27ea03;var _0x571528;return db[_0x2a9d('0x3d')][_0x2a9d('0x48')]({'where':{'id':_0x47df58[_0x2a9d('0x42')]['id']}})[_0x2a9d('0x25')](handleEntityNotFound(_0x58d85d,null))[_0x2a9d('0x25')](function(_0x58f381){if(_0x58f381){_0x27ea03=_0x58f381;_0x5a47e4[_0x2a9d('0x2e')]=_[_0x2a9d('0x31')](db['FreshsalesField'][_0x2a9d('0x2a')]);_0x5a47e4[_0x2a9d('0x30')]=_['keys'](_0x47df58[_0x2a9d('0x30')]);_0x5a47e4[_0x2a9d('0x38')]=_[_0x2a9d('0x43')](_0x5a47e4[_0x2a9d('0x2e')],_0x5a47e4[_0x2a9d('0x30')]);_0x446e78[_0x2a9d('0x32')]=_['intersection'](_0x5a47e4[_0x2a9d('0x2e')],qs[_0x2a9d('0x33')](_0x47df58[_0x2a9d('0x30')][_0x2a9d('0x33')]));_0x446e78['attributes']=_0x446e78['attributes'][_0x2a9d('0x4a')]?_0x446e78['attributes']:_0x5a47e4['model'];_0x446e78[_0x2a9d('0x35')]=qs['sort'](_0x47df58[_0x2a9d('0x30')]['sort']);_0x446e78[_0x2a9d('0x37')]=qs[_0x2a9d('0x38')](_['pick'](_0x47df58[_0x2a9d('0x30')],_0x5a47e4[_0x2a9d('0x38')]));if(_0x47df58['query'][_0x2a9d('0x39')]){_0x446e78['where']=_[_0x2a9d('0x3a')](_0x446e78[_0x2a9d('0x37')],{'$or':_[_0x2a9d('0x2f')](_0x446e78['attributes'],function(_0x3dca8a){var _0x223a70={};_0x223a70[_0x3dca8a]={'$like':'%'+_0x47df58[_0x2a9d('0x30')][_0x2a9d('0x39')]+'%'};return _0x223a70;})});}_0x446e78=_['merge']({},_0x446e78,_0x47df58[_0x2a9d('0x3c')]);return _0x27ea03['getFields'](_0x446e78);}})['then'](function(_0x23f892){if(_0x23f892){_0x571528=_0x23f892[_0x2a9d('0x4a')];if(!_0x47df58[_0x2a9d('0x30')]['hasOwnProperty'](_0x2a9d('0x34'))){_0x446e78['limit']=qs[_0x2a9d('0x1e')](_0x47df58['query'][_0x2a9d('0x1e')]);_0x446e78[_0x2a9d('0x1b')]=qs[_0x2a9d('0x1b')](_0x47df58[_0x2a9d('0x30')][_0x2a9d('0x1b')]);}return _0x27ea03[_0x2a9d('0x4d')](_0x446e78);}})[_0x2a9d('0x25')](function(_0x36acdc){if(_0x36acdc){return _0x36acdc?{'count':_0x571528,'rows':_0x36acdc}:null;}})[_0x2a9d('0x25')](respondWithResult(_0x58d85d,null))['catch'](handleError(_0x58d85d,null));}; \ No newline at end of file +var _0xb83c=['../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getSubjects','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xaea441,_0x3de85b){var _0x4332c1=function(_0xa76ba8){while(--_0xa76ba8){_0xaea441['push'](_0xaea441['shift']());}};_0x4332c1(++_0x3de85b);}(_0xb83c,0x12f));var _0xcb83=function(_0x59868e,_0x3072ac){_0x59868e=_0x59868e-0x0;var _0x2098d5=_0xb83c[_0x59868e];return _0x2098d5;};'use strict';var emlformat=require(_0xcb83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb83('0x1'));var jsonpatch=require(_0xcb83('0x2'));var rp=require(_0xcb83('0x3'));var moment=require(_0xcb83('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb83('0x5'));var util=require('util');var path=require(_0xcb83('0x6'));var sox=require(_0xcb83('0x7'));var csv=require(_0xcb83('0x8'));var ejs=require(_0xcb83('0x9'));var fs=require('fs');var fs_extra=require(_0xcb83('0xa'));var _=require('lodash');var squel=require(_0xcb83('0xb'));var crypto=require(_0xcb83('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb83('0xd'));var toCsv=require(_0xcb83('0x8'));var querystring=require(_0xcb83('0xe'));var Papa=require(_0xcb83('0xf'));var Redis=require(_0xcb83('0x10'));var authService=require(_0xcb83('0x11'));var qs=require(_0xcb83('0x12'));var as=require(_0xcb83('0x13'));var hardwareService=require(_0xcb83('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb83('0x15'));var licenseUtil=require(_0xcb83('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169021,_0x3ddf69){_0x3ddf69=_0x3ddf69||0xcc;return function(_0x5ae190){if(_0x5ae190){return _0x169021['sendStatus'](_0x3ddf69);}return _0x169021['status'](_0x3ddf69)[_0xcb83('0x17')]();};}function respondWithResult(_0x9c1561,_0x55809b){_0x55809b=_0x55809b||0xc8;return function(_0x667ae5){if(_0x667ae5){return _0x9c1561[_0xcb83('0x18')](_0x55809b)['json'](_0x667ae5);}};}function respondWithFilteredResult(_0x2c543c,_0x1501ea){return function(_0x15f505){if(_0x15f505){var _0x2c34a4=typeof _0x1501ea[_0xcb83('0x19')]===_0xcb83('0x1a')&&typeof _0x1501ea[_0xcb83('0x1b')]==='undefined';var _0x3453cb=_0x15f505[_0xcb83('0x1c')];var _0x125543=_0x2c34a4?0x0:_0x1501ea[_0xcb83('0x19')];var _0x90107b=_0x2c34a4?_0x15f505[_0xcb83('0x1c')]:_0x1501ea['offset']+_0x1501ea[_0xcb83('0x1b')];var _0x541012;if(_0x90107b>=_0x3453cb){_0x90107b=_0x3453cb;_0x541012=0xc8;}else{_0x541012=0xce;}_0x2c543c[_0xcb83('0x18')](_0x541012);return _0x2c543c[_0xcb83('0x1d')]('Content-Range',_0x125543+'-'+_0x90107b+'/'+_0x3453cb)[_0xcb83('0x1e')](_0x15f505);}return null;};}function patchUpdates(_0x2ba1dc){return function(_0x2c0c4f){try{jsonpatch[_0xcb83('0x1f')](_0x2c0c4f,_0x2ba1dc,!![]);}catch(_0x447645){return BPromise[_0xcb83('0x20')](_0x447645);}return _0x2c0c4f[_0xcb83('0x21')]();};}function saveUpdates(_0x46e146,_0xcd5ea){return function(_0x34afc6){if(_0x34afc6){return _0x34afc6[_0xcb83('0x22')](_0x46e146)[_0xcb83('0x23')](function(_0x4cab2f){return _0x4cab2f;});}return null;};}function removeEntity(_0x518e7e,_0xb02e77){return function(_0x215f48){if(_0x215f48){return _0x215f48[_0xcb83('0x24')]()[_0xcb83('0x23')](function(){_0x518e7e[_0xcb83('0x18')](0xcc)[_0xcb83('0x17')]();});}};}function handleEntityNotFound(_0x465eb7,_0x3ffb08){return function(_0x1a449b){if(!_0x1a449b){_0x465eb7[_0xcb83('0x25')](0x194);}return _0x1a449b;};}function handleError(_0x34143c,_0x3df9b0){_0x3df9b0=_0x3df9b0||0x1f4;return function(_0x1bede1){logger[_0xcb83('0x26')](_0x1bede1[_0xcb83('0x27')]);if(_0x1bede1[_0xcb83('0x28')]){delete _0x1bede1[_0xcb83('0x28')];}_0x34143c['status'](_0x3df9b0)[_0xcb83('0x29')](_0x1bede1);};}exports[_0xcb83('0x2a')]=function(_0xfcdff5,_0x3f1540){var _0x3ac4fe={},_0x50c06c={},_0x21e82b={'count':0x0,'rows':[]};var _0x53db8f=_['map'](db[_0xcb83('0x2b')][_0xcb83('0x2c')],function(_0x1e9c8){return{'name':_0x1e9c8[_0xcb83('0x2d')],'type':_0x1e9c8[_0xcb83('0x2e')]['key']};});_0x50c06c[_0xcb83('0x2f')]=_[_0xcb83('0x30')](_0x53db8f,_0xcb83('0x28'));_0x50c06c[_0xcb83('0x31')]=_[_0xcb83('0x32')](_0xfcdff5['query']);_0x50c06c[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x50c06c['model'],_0x50c06c[_0xcb83('0x31')]);_0x3ac4fe[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x50c06c[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0xfcdff5[_0xcb83('0x31')]['fields']));_0x3ac4fe[_0xcb83('0x35')]=_0x3ac4fe['attributes'][_0xcb83('0x37')]?_0x3ac4fe[_0xcb83('0x35')]:_0x50c06c[_0xcb83('0x2f')];if(!_0xfcdff5['query'][_0xcb83('0x38')](_0xcb83('0x39'))){_0x3ac4fe['limit']=qs[_0xcb83('0x1b')](_0xfcdff5[_0xcb83('0x31')][_0xcb83('0x1b')]);_0x3ac4fe['offset']=qs[_0xcb83('0x19')](_0xfcdff5['query']['offset']);}_0x3ac4fe[_0xcb83('0x3a')]=qs['sort'](_0xfcdff5['query'][_0xcb83('0x3b')]);_0x3ac4fe[_0xcb83('0x3c')]=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0xfcdff5[_0xcb83('0x31')],_0x50c06c[_0xcb83('0x33')]),_0x53db8f);if(_0xfcdff5[_0xcb83('0x31')]['filter']){_0x3ac4fe[_0xcb83('0x3c')]=_['merge'](_0x3ac4fe['where'],{'$or':_[_0xcb83('0x30')](_0x53db8f,function(_0x5a381a){if(_0x5a381a[_0xcb83('0x2e')]!==_0xcb83('0x3e')){var _0xa7e795={};_0xa7e795[_0x5a381a[_0xcb83('0x28')]]={'$like':'%'+_0xfcdff5['query'][_0xcb83('0x3f')]+'%'};return _0xa7e795;}})});}_0x3ac4fe=_[_0xcb83('0x40')]({},_0x3ac4fe,_0xfcdff5[_0xcb83('0x41')]);var _0x56379b={'where':_0x3ac4fe[_0xcb83('0x3c')]};return db[_0xcb83('0x2b')][_0xcb83('0x1c')](_0x56379b)[_0xcb83('0x23')](function(_0x4b6e0a){_0x21e82b['count']=_0x4b6e0a;if(_0xfcdff5[_0xcb83('0x31')][_0xcb83('0x42')]){_0x3ac4fe[_0xcb83('0x43')]=[{'all':!![]}];}return db[_0xcb83('0x2b')][_0xcb83('0x44')](_0x3ac4fe);})[_0xcb83('0x23')](function(_0x575727){_0x21e82b[_0xcb83('0x45')]=_0x575727;return _0x21e82b;})['then'](respondWithFilteredResult(_0x3f1540,_0x3ac4fe))[_0xcb83('0x46')](handleError(_0x3f1540,null));};exports[_0xcb83('0x47')]=function(_0x510ab3,_0x29c96a){var _0xb279c2={'raw':![],'where':{'id':_0x510ab3[_0xcb83('0x48')]['id']}},_0x2bd08f={};_0x2bd08f[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db[_0xcb83('0x2b')][_0xcb83('0x2c')]);_0x2bd08f[_0xcb83('0x31')]=_[_0xcb83('0x32')](_0x510ab3[_0xcb83('0x31')]);_0x2bd08f[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x2bd08f['model'],_0x2bd08f['query']);_0xb279c2[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x2bd08f[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x510ab3[_0xcb83('0x31')][_0xcb83('0x36')]));_0xb279c2[_0xcb83('0x35')]=_0xb279c2[_0xcb83('0x35')]['length']?_0xb279c2[_0xcb83('0x35')]:_0x2bd08f[_0xcb83('0x2f')];if(_0x510ab3['query']['includeAll']){_0xb279c2[_0xcb83('0x43')]=[{'all':!![]}];}_0xb279c2=_[_0xcb83('0x40')]({},_0xb279c2,_0x510ab3[_0xcb83('0x41')]);return db[_0xcb83('0x2b')][_0xcb83('0x49')](_0xb279c2)[_0xcb83('0x23')](handleEntityNotFound(_0x29c96a,null))[_0xcb83('0x23')](respondWithResult(_0x29c96a,null))[_0xcb83('0x46')](handleError(_0x29c96a,null));};exports[_0xcb83('0x4a')]=function(_0x225f2d,_0xecd54a){return db[_0xcb83('0x2b')][_0xcb83('0x4a')](_0x225f2d[_0xcb83('0x4b')],{})[_0xcb83('0x23')](respondWithResult(_0xecd54a,0xc9))[_0xcb83('0x46')](handleError(_0xecd54a,null));};exports[_0xcb83('0x22')]=function(_0x3c7c7d,_0x1bfe3d){if(_0x3c7c7d['body']['id']){delete _0x3c7c7d[_0xcb83('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xcb83('0x49')]({'where':{'id':_0x3c7c7d[_0xcb83('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bfe3d,null))[_0xcb83('0x23')](saveUpdates(_0x3c7c7d[_0xcb83('0x4b')],null))['then'](respondWithResult(_0x1bfe3d,null))[_0xcb83('0x46')](handleError(_0x1bfe3d,null));};exports[_0xcb83('0x24')]=function(_0x59cc2e,_0x3f2740){return db[_0xcb83('0x2b')]['find']({'where':{'id':_0x59cc2e[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x3f2740,null))[_0xcb83('0x23')](removeEntity(_0x3f2740,null))['catch'](handleError(_0x3f2740,null));};exports['getSubjects']=function(_0x1a6700,_0x37e1da,_0x104063){var _0x18c91e={};var _0x4c155e={};var _0x5ebc94;var _0x35ae89;return db['FreshsalesConfiguration'][_0xcb83('0x4c')]({'where':{'id':_0x1a6700[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x37e1da,null))[_0xcb83('0x23')](function(_0x4ca3e7){if(_0x4ca3e7){_0x5ebc94=_0x4ca3e7;_0x4c155e[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db['FreshsalesField'][_0xcb83('0x2c')]);_0x4c155e['query']=_[_0xcb83('0x32')](_0x1a6700[_0xcb83('0x31')]);_0x4c155e[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x4c155e['model'],_0x4c155e[_0xcb83('0x31')]);_0x18c91e['attributes']=_[_0xcb83('0x34')](_0x4c155e[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x36')]));_0x18c91e[_0xcb83('0x35')]=_0x18c91e[_0xcb83('0x35')]['length']?_0x18c91e[_0xcb83('0x35')]:_0x4c155e[_0xcb83('0x2f')];_0x18c91e[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x3b')]);_0x18c91e['where']=qs[_0xcb83('0x33')](_['pick'](_0x1a6700[_0xcb83('0x31')],_0x4c155e[_0xcb83('0x33')]));if(_0x1a6700['query'][_0xcb83('0x3f')]){_0x18c91e[_0xcb83('0x3c')]=_[_0xcb83('0x40')](_0x18c91e[_0xcb83('0x3c')],{'$or':_[_0xcb83('0x30')](_0x18c91e['attributes'],function(_0xdb109b){var _0x16d674={};_0x16d674[_0xdb109b]={'$like':'%'+_0x1a6700[_0xcb83('0x31')][_0xcb83('0x3f')]+'%'};return _0x16d674;})});}_0x18c91e=_[_0xcb83('0x40')]({},_0x18c91e,_0x1a6700['options']);return _0x5ebc94[_0xcb83('0x4d')](_0x18c91e);}})[_0xcb83('0x23')](function(_0x2915e9){if(_0x2915e9){_0x35ae89=_0x2915e9[_0xcb83('0x37')];if(!_0x1a6700[_0xcb83('0x31')][_0xcb83('0x38')]('nolimit')){_0x18c91e[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x1a6700[_0xcb83('0x31')]['limit']);_0x18c91e[_0xcb83('0x19')]=qs['offset'](_0x1a6700[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x5ebc94[_0xcb83('0x4d')](_0x18c91e);}})['then'](function(_0x1037f2){if(_0x1037f2){return _0x1037f2?{'count':_0x35ae89,'rows':_0x1037f2}:null;}})[_0xcb83('0x23')](respondWithResult(_0x37e1da,null))['catch'](handleError(_0x37e1da,null));};exports[_0xcb83('0x4e')]=function(_0x27dedb,_0x484100,_0x1dfbbe){var _0x4a675f={};var _0x527c2b={};var _0x549f90;var _0x3eebe4;return db[_0xcb83('0x2b')][_0xcb83('0x4c')]({'where':{'id':_0x27dedb[_0xcb83('0x48')]['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x484100,null))['then'](function(_0x2f410e){if(_0x2f410e){_0x549f90=_0x2f410e;_0x527c2b[_0xcb83('0x2f')]=_[_0xcb83('0x32')](db[_0xcb83('0x4f')][_0xcb83('0x2c')]);_0x527c2b[_0xcb83('0x31')]=_['keys'](_0x27dedb[_0xcb83('0x31')]);_0x527c2b[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x527c2b[_0xcb83('0x2f')],_0x527c2b[_0xcb83('0x31')]);_0x4a675f[_0xcb83('0x35')]=_[_0xcb83('0x34')](_0x527c2b[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x27dedb[_0xcb83('0x31')][_0xcb83('0x36')]));_0x4a675f[_0xcb83('0x35')]=_0x4a675f[_0xcb83('0x35')][_0xcb83('0x37')]?_0x4a675f[_0xcb83('0x35')]:_0x527c2b[_0xcb83('0x2f')];_0x4a675f[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x27dedb['query'][_0xcb83('0x3b')]);_0x4a675f[_0xcb83('0x3c')]=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0x27dedb['query'],_0x527c2b[_0xcb83('0x33')]));if(_0x27dedb[_0xcb83('0x31')][_0xcb83('0x3f')]){_0x4a675f[_0xcb83('0x3c')]=_['merge'](_0x4a675f[_0xcb83('0x3c')],{'$or':_[_0xcb83('0x30')](_0x4a675f[_0xcb83('0x35')],function(_0xd49ffc){var _0x13c642={};_0x13c642[_0xd49ffc]={'$like':'%'+_0x27dedb['query'][_0xcb83('0x3f')]+'%'};return _0x13c642;})});}_0x4a675f=_[_0xcb83('0x40')]({},_0x4a675f,_0x27dedb[_0xcb83('0x41')]);return _0x549f90[_0xcb83('0x4e')](_0x4a675f);}})[_0xcb83('0x23')](function(_0x14764c){if(_0x14764c){_0x3eebe4=_0x14764c['length'];if(!_0x27dedb[_0xcb83('0x31')]['hasOwnProperty'](_0xcb83('0x39'))){_0x4a675f[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x27dedb['query'][_0xcb83('0x1b')]);_0x4a675f[_0xcb83('0x19')]=qs[_0xcb83('0x19')](_0x27dedb[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x549f90[_0xcb83('0x4e')](_0x4a675f);}})['then'](function(_0x37e2e9){if(_0x37e2e9){return _0x37e2e9?{'count':_0x3eebe4,'rows':_0x37e2e9}:null;}})['then'](respondWithResult(_0x484100,null))[_0xcb83('0x46')](handleError(_0x484100,null));};exports[_0xcb83('0x50')]=function(_0x32c35b,_0x28e276,_0x1cf080){var _0x439217={};var _0x4e43e1={};var _0x1a5fc2;var _0x2547dc;return db[_0xcb83('0x2b')][_0xcb83('0x4c')]({'where':{'id':_0x32c35b['params']['id']}})[_0xcb83('0x23')](handleEntityNotFound(_0x28e276,null))[_0xcb83('0x23')](function(_0x5afbe2){if(_0x5afbe2){_0x1a5fc2=_0x5afbe2;_0x4e43e1['model']=_[_0xcb83('0x32')](db['FreshsalesField']['rawAttributes']);_0x4e43e1['query']=_[_0xcb83('0x32')](_0x32c35b['query']);_0x4e43e1[_0xcb83('0x33')]=_[_0xcb83('0x34')](_0x4e43e1[_0xcb83('0x2f')],_0x4e43e1[_0xcb83('0x31')]);_0x439217['attributes']=_[_0xcb83('0x34')](_0x4e43e1[_0xcb83('0x2f')],qs[_0xcb83('0x36')](_0x32c35b[_0xcb83('0x31')]['fields']));_0x439217[_0xcb83('0x35')]=_0x439217[_0xcb83('0x35')][_0xcb83('0x37')]?_0x439217[_0xcb83('0x35')]:_0x4e43e1['model'];_0x439217[_0xcb83('0x3a')]=qs[_0xcb83('0x3b')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x3b')]);_0x439217['where']=qs[_0xcb83('0x33')](_[_0xcb83('0x3d')](_0x32c35b['query'],_0x4e43e1[_0xcb83('0x33')]));if(_0x32c35b['query'][_0xcb83('0x3f')]){_0x439217[_0xcb83('0x3c')]=_[_0xcb83('0x40')](_0x439217[_0xcb83('0x3c')],{'$or':_['map'](_0x439217[_0xcb83('0x35')],function(_0x3cc4a3){var _0x23c5c4={};_0x23c5c4[_0x3cc4a3]={'$like':'%'+_0x32c35b['query'][_0xcb83('0x3f')]+'%'};return _0x23c5c4;})});}_0x439217=_['merge']({},_0x439217,_0x32c35b[_0xcb83('0x41')]);return _0x1a5fc2[_0xcb83('0x50')](_0x439217);}})[_0xcb83('0x23')](function(_0x15b1c9){if(_0x15b1c9){_0x2547dc=_0x15b1c9['length'];if(!_0x32c35b[_0xcb83('0x31')][_0xcb83('0x38')](_0xcb83('0x39'))){_0x439217[_0xcb83('0x1b')]=qs[_0xcb83('0x1b')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x1b')]);_0x439217['offset']=qs[_0xcb83('0x19')](_0x32c35b[_0xcb83('0x31')][_0xcb83('0x19')]);}return _0x1a5fc2[_0xcb83('0x50')](_0x439217);}})[_0xcb83('0x23')](function(_0x5b7502){if(_0x5b7502){return _0x5b7502?{'count':_0x2547dc,'rows':_0x5b7502}:null;}})['then'](respondWithResult(_0x28e276,null))['catch'](handleError(_0x28e276,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f5ff0ba..9d6257a 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 _0x1b59=['../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d5f56,_0x195f77){var _0x1fe112=function(_0x19fefe){while(--_0x19fefe){_0x4d5f56['push'](_0x4d5f56['shift']());}};_0x1fe112(++_0x195f77);}(_0x1b59,0x1b1));var _0x91b5=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0x1b59[_0x3dc089];return _0x34d9d3;};'use strict';var _=require(_0x91b5('0x0'));var util=require(_0x91b5('0x1'));var logger=require(_0x91b5('0x2'))(_0x91b5('0x3'));var moment=require(_0x91b5('0x4'));var BPromise=require(_0x91b5('0x5'));var rp=require(_0x91b5('0x6'));var fs=require('fs');var path=require(_0x91b5('0x7'));var rimraf=require(_0x91b5('0x8'));var config=require(_0x91b5('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x91b5('0xa')]=function(_0x1028a7,_0x4b8447){return _0x1028a7['define'](_0x91b5('0xb'),attributes,{'tableName':_0x91b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bc4=['request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bc4,0x150));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x47bc('0x0'));var util=require(_0x47bc('0x1'));var logger=require(_0x47bc('0x2'))(_0x47bc('0x3'));var moment=require('moment');var BPromise=require(_0x47bc('0x4'));var rp=require(_0x47bc('0x5'));var fs=require('fs');var path=require(_0x47bc('0x6'));var rimraf=require(_0x47bc('0x7'));var config=require(_0x47bc('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3d1e45,_0x2cc3f0){return _0x3d1e45[_0x47bc('0x9')](_0x47bc('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index da91926..ac61faf 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 _0xc3a5=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x57e029,_0x1e550c){var _0x1b1466=function(_0x40d1bf){while(--_0x40d1bf){_0x57e029['push'](_0x57e029['shift']());}};_0x1b1466(++_0x1e550c);}(_0xc3a5,0x1eb));var _0x5c3a=function(_0x4fabc8,_0x36ef52){_0x4fabc8=_0x4fabc8-0x0;var _0x425ab1=_0xc3a5[_0x4fabc8];return _0x425ab1;};'use strict';var _=require(_0x5c3a('0x0'));var util=require(_0x5c3a('0x1'));var moment=require('moment');var BPromise=require(_0x5c3a('0x2'));var rs=require(_0x5c3a('0x3'));var fs=require('fs');var Redis=require(_0x5c3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c3a('0x5'));var logger=require('../../config/logger')(_0x5c3a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c3a('0x7')][_0x5c3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ecbd6,_0xe0926d,_0x5acf7d){return new BPromise(function(_0x5d5f79,_0x5eff7b){return client[_0x5c3a('0x9')](_0x4ecbd6,_0x5acf7d)[_0x5c3a('0xa')](function(_0x52c165){logger[_0x5c3a('0xb')](_0x5c3a('0xc'),_0xe0926d,_0x5c3a('0xd'));logger[_0x5c3a('0xe')](_0x5c3a('0xf'),_0xe0926d,'request\x20sent',JSON[_0x5c3a('0x10')](_0x52c165));if(_0x52c165[_0x5c3a('0x11')]){if(_0x52c165['error']['code']===0x1f4){logger[_0x5c3a('0x11')](_0x5c3a('0xc'),_0xe0926d,_0x52c165['error'][_0x5c3a('0x12')]);return _0x5eff7b(_0x52c165['error'][_0x5c3a('0x12')]);}logger[_0x5c3a('0x11')](_0x5c3a('0xc'),_0xe0926d,_0x52c165[_0x5c3a('0x11')][_0x5c3a('0x12')]);return _0x5d5f79(_0x52c165[_0x5c3a('0x11')]['message']);}else{logger[_0x5c3a('0xb')](_0x5c3a('0xc'),_0xe0926d,_0x5c3a('0xd'));_0x5d5f79(_0x52c165[_0x5c3a('0x13')][_0x5c3a('0x12')]);}})[_0x5c3a('0x14')](function(_0x596354){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0xe0926d,_0x596354);_0x5eff7b(_0x596354);});});} \ No newline at end of file +var _0x384d=['stringify','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5944af,_0x47a19b){var _0x1d01b0=function(_0x2c5c7e){while(--_0x2c5c7e){_0x5944af['push'](_0x5944af['shift']());}};_0x1d01b0(++_0x47a19b);}(_0x384d,0x98));var _0xd384=function(_0x1c8297,_0x4a93a1){_0x1c8297=_0x1c8297-0x0;var _0x450a26=_0x384d[_0x1c8297];return _0x450a26;};'use strict';var _=require('lodash');var util=require(_0xd384('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd384('0x1'));var db=require(_0xd384('0x2'))['db'];var utils=require(_0xd384('0x3'));var logger=require('../../config/logger')(_0xd384('0x4'));var config=require(_0xd384('0x5'));var jayson=require(_0xd384('0x6'));var client=jayson[_0xd384('0x7')][_0xd384('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e05d,_0x2e1799,_0x41f9a7){return new BPromise(function(_0x29e045,_0x44b5eb){return client[_0xd384('0x9')](_0x41e05d,_0x41f9a7)[_0xd384('0xa')](function(_0x4399e5){logger[_0xd384('0xb')](_0xd384('0xc'),_0x2e1799,_0xd384('0xd'));logger[_0xd384('0xe')](_0xd384('0xf'),_0x2e1799,_0xd384('0xd'),JSON[_0xd384('0x10')](_0x4399e5));if(_0x4399e5['error']){if(_0x4399e5[_0xd384('0x11')][_0xd384('0x12')]===0x1f4){logger[_0xd384('0x11')](_0xd384('0xc'),_0x2e1799,_0x4399e5['error']['message']);return _0x44b5eb(_0x4399e5['error'][_0xd384('0x13')]);}logger[_0xd384('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e1799,_0x4399e5['error'][_0xd384('0x13')]);return _0x29e045(_0x4399e5['error']['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e1799,_0xd384('0xd'));_0x29e045(_0x4399e5[_0xd384('0x14')][_0xd384('0x13')]);}})['catch'](function(_0x37afd6){logger[_0xd384('0x11')](_0xd384('0xc'),_0x2e1799,_0x37afd6);_0x44b5eb(_0x37afd6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 19a3951..3484c4c 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 _0x68fc=['delete','destroy','exports','multer','util','path','Router','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x68fc,0xa5));var _0xc68f=function(_0x14d29f,_0x323b22){_0x14d29f=_0x14d29f-0x0;var _0x7a8212=_0x68fc[_0x14d29f];return _0x7a8212;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/:id',auth[_0xc68f('0x7')](),controller[_0xc68f('0x9')]);router[_0xc68f('0xa')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0xc')](_0xc68f('0xd'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xe')]);router[_0xc68f('0xf')]('/:id',auth[_0xc68f('0x7')](),controller[_0xc68f('0x10')]);module[_0xc68f('0x11')]=router; \ No newline at end of file +var _0xdb76=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x313213,_0x4467df){var _0x244466=function(_0x25118b){while(--_0x25118b){_0x313213['push'](_0x313213['shift']());}};_0x244466(++_0x4467df);}(_0xdb76,0x1be));var _0x6db7=function(_0x13b028,_0x54dc4b){_0x13b028=_0x13b028-0x0;var _0x7ead62=_0xdb76[_0x13b028];return _0x7ead62;};'use strict';var multer=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var path=require(_0x6db7('0x2'));var timeout=require(_0x6db7('0x3'));var express=require(_0x6db7('0x4'));var router=express['Router']();var fs_extra=require(_0x6db7('0x5'));var auth=require(_0x6db7('0x6'));var interaction=require(_0x6db7('0x7'));var config=require(_0x6db7('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x6db7('0x9')]('/',auth[_0x6db7('0xa')](),controller[_0x6db7('0xb')]);router[_0x6db7('0x9')](_0x6db7('0xc'),auth['isAuthenticated'](),controller[_0x6db7('0xd')]);router[_0x6db7('0xe')]('/',auth['isAuthenticated'](),controller[_0x6db7('0xf')]);router[_0x6db7('0x10')](_0x6db7('0xc'),auth[_0x6db7('0xa')](),controller[_0x6db7('0x11')]);router[_0x6db7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6db7('0x13')]);module[_0x6db7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6669e73..0d56bce 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 _0x7565=['picklist','STRING','ENUM','variable','BOOLEAN','exports','string','customVariable','keyValue'];(function(_0x2de380,_0x41b27e){var _0x77211=function(_0x172ee3){while(--_0x172ee3){_0x2de380['push'](_0x2de380['shift']());}};_0x77211(++_0x41b27e);}(_0x7565,0x164));var _0x5756=function(_0x2c960b,_0x17264f){_0x2c960b=_0x2c960b-0x0;var _0x7efe3f=_0x7565[_0x2c960b];return _0x7efe3f;};'use strict';var Sequelize=require('sequelize');module[_0x5756('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5756('0x1'),'variable',_0x5756('0x2'),_0x5756('0x3'),_0x5756('0x4')),'defaultValue':_0x5756('0x1')},'content':{'type':Sequelize[_0x5756('0x5')]},'key':{'type':Sequelize[_0x5756('0x5')]},'keyType':{'type':Sequelize[_0x5756('0x6')](_0x5756('0x1'),_0x5756('0x7'),_0x5756('0x2'))},'keyContent':{'type':Sequelize[_0x5756('0x5')]},'idField':{'type':Sequelize[_0x5756('0x5')]},'nameField':{'type':Sequelize[_0x5756('0x5')]},'customField':{'type':Sequelize[_0x5756('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5756('0x5')]}}; \ No newline at end of file +var _0x2a47=['picklist','variable','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x1ebe53,_0x35cc29){var _0x56cb47=function(_0x1fc9fc){while(--_0x1fc9fc){_0x1ebe53['push'](_0x1ebe53['shift']());}};_0x56cb47(++_0x35cc29);}(_0x2a47,0xf4));var _0x72a4=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x2a47[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x72a4('0x0'));module[_0x72a4('0x1')]={'type':{'type':Sequelize[_0x72a4('0x2')](_0x72a4('0x3'),'variable',_0x72a4('0x4'),_0x72a4('0x5'),_0x72a4('0x6')),'defaultValue':_0x72a4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x72a4('0x2')]('string',_0x72a4('0x7'),_0x72a4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x72a4('0x8')]},'nameField':{'type':Sequelize[_0x72a4('0x8')]},'customField':{'type':Sequelize[_0x72a4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72a4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 69d2636..dc477d2 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 _0xdb97=['offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','FreshsalesField','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xdb97,0x1a6));var _0x7db9=function(_0x558e07,_0x33d407){_0x558e07=_0x558e07-0x0;var _0x2edbb9=_0xdb97[_0x558e07];return _0x2edbb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7db9('0x0'));var jsonpatch=require(_0x7db9('0x1'));var rp=require('request-promise');var moment=require(_0x7db9('0x2'));var BPromise=require(_0x7db9('0x3'));var Mustache=require('mustache');var util=require(_0x7db9('0x4'));var path=require(_0x7db9('0x5'));var sox=require(_0x7db9('0x6'));var csv=require(_0x7db9('0x7'));var ejs=require(_0x7db9('0x8'));var fs=require('fs');var fs_extra=require(_0x7db9('0x9'));var _=require(_0x7db9('0xa'));var squel=require('squel');var crypto=require(_0x7db9('0xb'));var jsforce=require(_0x7db9('0xc'));var deskjs=require(_0x7db9('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7db9('0xe'));var Redis=require(_0x7db9('0xf'));var authService=require(_0x7db9('0x10'));var qs=require(_0x7db9('0x11'));var as=require(_0x7db9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7db9('0x13'));var utils=require(_0x7db9('0x14'));var config=require(_0x7db9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7db9('0x16'))['db'];function respondWithStatusCode(_0x251792,_0x4f5111){_0x4f5111=_0x4f5111||0xcc;return function(_0x9cb937){if(_0x9cb937){return _0x251792[_0x7db9('0x17')](_0x4f5111);}return _0x251792['status'](_0x4f5111)['end']();};}function respondWithResult(_0x364f94,_0x57f2db){_0x57f2db=_0x57f2db||0xc8;return function(_0x2b3fa0){if(_0x2b3fa0){return _0x364f94[_0x7db9('0x18')](_0x57f2db)[_0x7db9('0x19')](_0x2b3fa0);}};}function respondWithFilteredResult(_0xea26e,_0x3ab5e5){return function(_0x5b4c20){if(_0x5b4c20){var _0x4655e5=typeof _0x3ab5e5['offset']===_0x7db9('0x1a')&&typeof _0x3ab5e5[_0x7db9('0x1b')]===_0x7db9('0x1a');var _0x445f1a=_0x5b4c20['count'];var _0x4d205d=_0x4655e5?0x0:_0x3ab5e5[_0x7db9('0x1c')];var _0x5ae9e1=_0x4655e5?_0x5b4c20['count']:_0x3ab5e5[_0x7db9('0x1c')]+_0x3ab5e5[_0x7db9('0x1b')];var _0x278d00;if(_0x5ae9e1>=_0x445f1a){_0x5ae9e1=_0x445f1a;_0x278d00=0xc8;}else{_0x278d00=0xce;}_0xea26e[_0x7db9('0x18')](_0x278d00);return _0xea26e[_0x7db9('0x1d')](_0x7db9('0x1e'),_0x4d205d+'-'+_0x5ae9e1+'/'+_0x445f1a)[_0x7db9('0x19')](_0x5b4c20);}return null;};}function patchUpdates(_0x1cc63b){return function(_0x8f1d8e){try{jsonpatch[_0x7db9('0x1f')](_0x8f1d8e,_0x1cc63b,!![]);}catch(_0xf6e732){return BPromise[_0x7db9('0x20')](_0xf6e732);}return _0x8f1d8e[_0x7db9('0x21')]();};}function saveUpdates(_0x52f745,_0x1bd0c1){return function(_0x3c444b){if(_0x3c444b){return _0x3c444b[_0x7db9('0x22')](_0x52f745)[_0x7db9('0x23')](function(_0xffa90e){return _0xffa90e;});}return null;};}function removeEntity(_0x2a24a1,_0x1c25d0){return function(_0x4ee498){if(_0x4ee498){return _0x4ee498['destroy']()[_0x7db9('0x23')](function(){_0x2a24a1[_0x7db9('0x18')](0xcc)[_0x7db9('0x24')]();});}};}function handleEntityNotFound(_0x20af7c,_0x30cf23){return function(_0x5e4523){if(!_0x5e4523){_0x20af7c['sendStatus'](0x194);}return _0x5e4523;};}function handleError(_0x27e457,_0x5f03a0){_0x5f03a0=_0x5f03a0||0x1f4;return function(_0x20d8da){logger[_0x7db9('0x25')](_0x20d8da[_0x7db9('0x26')]);if(_0x20d8da['name']){delete _0x20d8da[_0x7db9('0x27')];}_0x27e457['status'](_0x5f03a0)['send'](_0x20d8da);};}exports[_0x7db9('0x28')]=function(_0x105bef,_0x8a56ca){var _0x5ab6a3={},_0x10fd01={},_0x3e6061={'count':0x0,'rows':[]};var _0x5d6a59=_['map'](db[_0x7db9('0x29')]['rawAttributes'],function(_0x432166){return{'name':_0x432166[_0x7db9('0x2a')],'type':_0x432166['type'][_0x7db9('0x2b')]};});_0x10fd01[_0x7db9('0x2c')]=_[_0x7db9('0x2d')](_0x5d6a59,_0x7db9('0x27'));_0x10fd01[_0x7db9('0x2e')]=_['keys'](_0x105bef[_0x7db9('0x2e')]);_0x10fd01[_0x7db9('0x2f')]=_[_0x7db9('0x30')](_0x10fd01[_0x7db9('0x2c')],_0x10fd01[_0x7db9('0x2e')]);_0x5ab6a3['attributes']=_[_0x7db9('0x30')](_0x10fd01[_0x7db9('0x2c')],qs[_0x7db9('0x31')](_0x105bef[_0x7db9('0x2e')][_0x7db9('0x31')]));_0x5ab6a3[_0x7db9('0x32')]=_0x5ab6a3[_0x7db9('0x32')][_0x7db9('0x33')]?_0x5ab6a3['attributes']:_0x10fd01[_0x7db9('0x2c')];if(!_0x105bef[_0x7db9('0x2e')][_0x7db9('0x34')](_0x7db9('0x35'))){_0x5ab6a3[_0x7db9('0x1b')]=qs[_0x7db9('0x1b')](_0x105bef['query'][_0x7db9('0x1b')]);_0x5ab6a3['offset']=qs['offset'](_0x105bef[_0x7db9('0x2e')]['offset']);}_0x5ab6a3[_0x7db9('0x36')]=qs[_0x7db9('0x37')](_0x105bef[_0x7db9('0x2e')][_0x7db9('0x37')]);_0x5ab6a3['where']=qs[_0x7db9('0x2f')](_[_0x7db9('0x38')](_0x105bef[_0x7db9('0x2e')],_0x10fd01[_0x7db9('0x2f')]),_0x5d6a59);if(_0x105bef[_0x7db9('0x2e')][_0x7db9('0x39')]){_0x5ab6a3[_0x7db9('0x3a')]=_['merge'](_0x5ab6a3[_0x7db9('0x3a')],{'$or':_[_0x7db9('0x2d')](_0x5d6a59,function(_0x5b77f0){if(_0x5b77f0[_0x7db9('0x3b')]!==_0x7db9('0x3c')){var _0xe87859={};_0xe87859[_0x5b77f0[_0x7db9('0x27')]]={'$like':'%'+_0x105bef['query'][_0x7db9('0x39')]+'%'};return _0xe87859;}})});}_0x5ab6a3=_[_0x7db9('0x3d')]({},_0x5ab6a3,_0x105bef['options']);var _0x4f1fb0={'where':_0x5ab6a3[_0x7db9('0x3a')]};return db['FreshsalesField'][_0x7db9('0x3e')](_0x4f1fb0)['then'](function(_0x2dccde){_0x3e6061['count']=_0x2dccde;if(_0x105bef[_0x7db9('0x2e')][_0x7db9('0x3f')]){_0x5ab6a3['include']=[{'all':!![]}];}return db[_0x7db9('0x29')][_0x7db9('0x40')](_0x5ab6a3);})[_0x7db9('0x23')](function(_0x3ba9ea){_0x3e6061[_0x7db9('0x41')]=_0x3ba9ea;return _0x3e6061;})[_0x7db9('0x23')](respondWithFilteredResult(_0x8a56ca,_0x5ab6a3))[_0x7db9('0x42')](handleError(_0x8a56ca,null));};exports[_0x7db9('0x43')]=function(_0x421c4c,_0x1b954a){var _0x174a99={'raw':!![],'where':{'id':_0x421c4c[_0x7db9('0x44')]['id']}},_0x313fe9={};_0x313fe9['model']=_['keys'](db[_0x7db9('0x29')][_0x7db9('0x45')]);_0x313fe9[_0x7db9('0x2e')]=_['keys'](_0x421c4c[_0x7db9('0x2e')]);_0x313fe9['filters']=_[_0x7db9('0x30')](_0x313fe9[_0x7db9('0x2c')],_0x313fe9[_0x7db9('0x2e')]);_0x174a99[_0x7db9('0x32')]=_[_0x7db9('0x30')](_0x313fe9[_0x7db9('0x2c')],qs['fields'](_0x421c4c[_0x7db9('0x2e')][_0x7db9('0x31')]));_0x174a99['attributes']=_0x174a99[_0x7db9('0x32')]['length']?_0x174a99['attributes']:_0x313fe9['model'];if(_0x421c4c[_0x7db9('0x2e')]['includeAll']){_0x174a99[_0x7db9('0x46')]=[{'all':!![]}];}_0x174a99=_[_0x7db9('0x3d')]({},_0x174a99,_0x421c4c[_0x7db9('0x47')]);return db['FreshsalesField'][_0x7db9('0x48')](_0x174a99)['then'](handleEntityNotFound(_0x1b954a,null))[_0x7db9('0x23')](respondWithResult(_0x1b954a,null))['catch'](handleError(_0x1b954a,null));};exports[_0x7db9('0x49')]=function(_0x4f5da9,_0x1d46e5){return db[_0x7db9('0x29')][_0x7db9('0x49')](_0x4f5da9['body'],{})[_0x7db9('0x23')](respondWithResult(_0x1d46e5,0xc9))[_0x7db9('0x42')](handleError(_0x1d46e5,null));};exports[_0x7db9('0x22')]=function(_0x471419,_0x5b08ec){if(_0x471419[_0x7db9('0x4a')]['id']){delete _0x471419[_0x7db9('0x4a')]['id'];}return db[_0x7db9('0x29')][_0x7db9('0x48')]({'where':{'id':_0x471419[_0x7db9('0x44')]['id']}})[_0x7db9('0x23')](handleEntityNotFound(_0x5b08ec,null))[_0x7db9('0x23')](saveUpdates(_0x471419[_0x7db9('0x4a')],null))[_0x7db9('0x23')](respondWithResult(_0x5b08ec,null))['catch'](handleError(_0x5b08ec,null));};exports['destroy']=function(_0x593a82,_0x358907){return db['FreshsalesField']['find']({'where':{'id':_0x593a82['params']['id']}})[_0x7db9('0x23')](handleEntityNotFound(_0x358907,null))[_0x7db9('0x23')](removeEntity(_0x358907,null))[_0x7db9('0x42')](handleError(_0x358907,null));}; \ No newline at end of file +var _0x8315=['reject','save','then','destroy','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','status','set','Content-Range'];(function(_0x50f430,_0x525873){var _0x49040e=function(_0x223c9d){while(--_0x223c9d){_0x50f430['push'](_0x50f430['shift']());}};_0x49040e(++_0x525873);}(_0x8315,0xf0));var _0x5831=function(_0x1e6cf9,_0x472dd9){_0x1e6cf9=_0x1e6cf9-0x0;var _0x32dc43=_0x8315[_0x1e6cf9];return _0x32dc43;};'use strict';var emlformat=require(_0x5831('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5831('0x1'));var jsonpatch=require(_0x5831('0x2'));var rp=require(_0x5831('0x3'));var moment=require('moment');var BPromise=require(_0x5831('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5831('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5831('0x6'));var fs=require('fs');var fs_extra=require(_0x5831('0x7'));var _=require(_0x5831('0x8'));var squel=require(_0x5831('0x9'));var crypto=require(_0x5831('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5831('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5831('0xc'));var Papa=require(_0x5831('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5831('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5831('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x5831('0x10'));var licenseUtil=require(_0x5831('0x11'));var db=require(_0x5831('0x12'))['db'];function respondWithStatusCode(_0x3a8e5f,_0x11d6cf){_0x11d6cf=_0x11d6cf||0xcc;return function(_0x144ebe){if(_0x144ebe){return _0x3a8e5f[_0x5831('0x13')](_0x11d6cf);}return _0x3a8e5f['status'](_0x11d6cf)[_0x5831('0x14')]();};}function respondWithResult(_0x20e82a,_0x5aca1c){_0x5aca1c=_0x5aca1c||0xc8;return function(_0x32c9f2){if(_0x32c9f2){return _0x20e82a['status'](_0x5aca1c)[_0x5831('0x15')](_0x32c9f2);}};}function respondWithFilteredResult(_0x4dd5e5,_0x26b2fd){return function(_0xc26b26){if(_0xc26b26){var _0x1754d3=typeof _0x26b2fd['offset']==='undefined'&&typeof _0x26b2fd[_0x5831('0x16')]==='undefined';var _0x118d05=_0xc26b26[_0x5831('0x17')];var _0x50007b=_0x1754d3?0x0:_0x26b2fd[_0x5831('0x18')];var _0x23b3e4=_0x1754d3?_0xc26b26[_0x5831('0x17')]:_0x26b2fd[_0x5831('0x18')]+_0x26b2fd[_0x5831('0x16')];var _0x46516c;if(_0x23b3e4>=_0x118d05){_0x23b3e4=_0x118d05;_0x46516c=0xc8;}else{_0x46516c=0xce;}_0x4dd5e5[_0x5831('0x19')](_0x46516c);return _0x4dd5e5[_0x5831('0x1a')](_0x5831('0x1b'),_0x50007b+'-'+_0x23b3e4+'/'+_0x118d05)[_0x5831('0x15')](_0xc26b26);}return null;};}function patchUpdates(_0x2bf1bb){return function(_0x3dbf4b){try{jsonpatch['apply'](_0x3dbf4b,_0x2bf1bb,!![]);}catch(_0x17783c){return BPromise[_0x5831('0x1c')](_0x17783c);}return _0x3dbf4b[_0x5831('0x1d')]();};}function saveUpdates(_0x53b6c5,_0x2a2950){return function(_0x1339bf){if(_0x1339bf){return _0x1339bf['update'](_0x53b6c5)[_0x5831('0x1e')](function(_0x126b27){return _0x126b27;});}return null;};}function removeEntity(_0x7e4517,_0x1b794b){return function(_0x24434a){if(_0x24434a){return _0x24434a[_0x5831('0x1f')]()[_0x5831('0x1e')](function(){_0x7e4517[_0x5831('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4386ca,_0x59e152){return function(_0x366d26){if(!_0x366d26){_0x4386ca[_0x5831('0x13')](0x194);}return _0x366d26;};}function handleError(_0x422ec9,_0x2f446f){_0x2f446f=_0x2f446f||0x1f4;return function(_0xc020b5){logger[_0x5831('0x20')](_0xc020b5[_0x5831('0x21')]);if(_0xc020b5['name']){delete _0xc020b5[_0x5831('0x22')];}_0x422ec9[_0x5831('0x19')](_0x2f446f)['send'](_0xc020b5);};}exports['index']=function(_0x2a15b6,_0x2c9f89){var _0x1e5885={},_0x463e0f={},_0x23cba6={'count':0x0,'rows':[]};var _0x24e55b=_[_0x5831('0x23')](db[_0x5831('0x24')][_0x5831('0x25')],function(_0xee56fb){return{'name':_0xee56fb[_0x5831('0x26')],'type':_0xee56fb['type'][_0x5831('0x27')]};});_0x463e0f[_0x5831('0x28')]=_[_0x5831('0x23')](_0x24e55b,_0x5831('0x22'));_0x463e0f[_0x5831('0x29')]=_[_0x5831('0x2a')](_0x2a15b6[_0x5831('0x29')]);_0x463e0f[_0x5831('0x2b')]=_[_0x5831('0x2c')](_0x463e0f[_0x5831('0x28')],_0x463e0f[_0x5831('0x29')]);_0x1e5885[_0x5831('0x2d')]=_[_0x5831('0x2c')](_0x463e0f['model'],qs['fields'](_0x2a15b6[_0x5831('0x29')]['fields']));_0x1e5885['attributes']=_0x1e5885[_0x5831('0x2d')][_0x5831('0x2e')]?_0x1e5885[_0x5831('0x2d')]:_0x463e0f['model'];if(!_0x2a15b6[_0x5831('0x29')]['hasOwnProperty'](_0x5831('0x2f'))){_0x1e5885[_0x5831('0x16')]=qs[_0x5831('0x16')](_0x2a15b6['query']['limit']);_0x1e5885['offset']=qs[_0x5831('0x18')](_0x2a15b6[_0x5831('0x29')]['offset']);}_0x1e5885[_0x5831('0x30')]=qs[_0x5831('0x31')](_0x2a15b6[_0x5831('0x29')][_0x5831('0x31')]);_0x1e5885['where']=qs['filters'](_[_0x5831('0x32')](_0x2a15b6[_0x5831('0x29')],_0x463e0f[_0x5831('0x2b')]),_0x24e55b);if(_0x2a15b6[_0x5831('0x29')][_0x5831('0x33')]){_0x1e5885['where']=_[_0x5831('0x34')](_0x1e5885['where'],{'$or':_[_0x5831('0x23')](_0x24e55b,function(_0x1b468e){if(_0x1b468e['type']!==_0x5831('0x35')){var _0x250030={};_0x250030[_0x1b468e[_0x5831('0x22')]]={'$like':'%'+_0x2a15b6[_0x5831('0x29')][_0x5831('0x33')]+'%'};return _0x250030;}})});}_0x1e5885=_['merge']({},_0x1e5885,_0x2a15b6['options']);var _0x379142={'where':_0x1e5885[_0x5831('0x36')]};return db[_0x5831('0x24')]['count'](_0x379142)[_0x5831('0x1e')](function(_0x2aac5a){_0x23cba6[_0x5831('0x17')]=_0x2aac5a;if(_0x2a15b6[_0x5831('0x29')]['includeAll']){_0x1e5885[_0x5831('0x37')]=[{'all':!![]}];}return db[_0x5831('0x24')][_0x5831('0x38')](_0x1e5885);})['then'](function(_0x2dac53){_0x23cba6[_0x5831('0x39')]=_0x2dac53;return _0x23cba6;})[_0x5831('0x1e')](respondWithFilteredResult(_0x2c9f89,_0x1e5885))[_0x5831('0x3a')](handleError(_0x2c9f89,null));};exports[_0x5831('0x3b')]=function(_0x4b40c4,_0x480e4f){var _0x1d50dd={'raw':!![],'where':{'id':_0x4b40c4[_0x5831('0x3c')]['id']}},_0xc3ccbd={};_0xc3ccbd[_0x5831('0x28')]=_[_0x5831('0x2a')](db[_0x5831('0x24')][_0x5831('0x25')]);_0xc3ccbd[_0x5831('0x29')]=_['keys'](_0x4b40c4['query']);_0xc3ccbd['filters']=_[_0x5831('0x2c')](_0xc3ccbd[_0x5831('0x28')],_0xc3ccbd['query']);_0x1d50dd[_0x5831('0x2d')]=_[_0x5831('0x2c')](_0xc3ccbd[_0x5831('0x28')],qs[_0x5831('0x3d')](_0x4b40c4['query']['fields']));_0x1d50dd['attributes']=_0x1d50dd[_0x5831('0x2d')][_0x5831('0x2e')]?_0x1d50dd[_0x5831('0x2d')]:_0xc3ccbd['model'];if(_0x4b40c4[_0x5831('0x29')][_0x5831('0x3e')]){_0x1d50dd[_0x5831('0x37')]=[{'all':!![]}];}_0x1d50dd=_[_0x5831('0x34')]({},_0x1d50dd,_0x4b40c4[_0x5831('0x3f')]);return db[_0x5831('0x24')][_0x5831('0x40')](_0x1d50dd)[_0x5831('0x1e')](handleEntityNotFound(_0x480e4f,null))['then'](respondWithResult(_0x480e4f,null))[_0x5831('0x3a')](handleError(_0x480e4f,null));};exports[_0x5831('0x41')]=function(_0x1cb3b1,_0x599410){return db[_0x5831('0x24')][_0x5831('0x41')](_0x1cb3b1['body'],{})[_0x5831('0x1e')](respondWithResult(_0x599410,0xc9))['catch'](handleError(_0x599410,null));};exports['update']=function(_0x418e64,_0x5761d3){if(_0x418e64[_0x5831('0x42')]['id']){delete _0x418e64['body']['id'];}return db['FreshsalesField'][_0x5831('0x40')]({'where':{'id':_0x418e64['params']['id']}})[_0x5831('0x1e')](handleEntityNotFound(_0x5761d3,null))[_0x5831('0x1e')](saveUpdates(_0x418e64[_0x5831('0x42')],null))[_0x5831('0x1e')](respondWithResult(_0x5761d3,null))[_0x5831('0x3a')](handleError(_0x5761d3,null));};exports[_0x5831('0x1f')]=function(_0x554d3e,_0x1cb37c){return db[_0x5831('0x24')][_0x5831('0x40')]({'where':{'id':_0x554d3e['params']['id']}})['then'](handleEntityNotFound(_0x1cb37c,null))[_0x5831('0x1e')](removeEntity(_0x1cb37c,null))[_0x5831('0x3a')](handleError(_0x1cb37c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 714efe5..c656785 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 _0x9123=['FieldId','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x69e0fb,_0x2480c7){var _0x4dd8aa=function(_0x1b557a){while(--_0x1b557a){_0x69e0fb['push'](_0x69e0fb['shift']());}};_0x4dd8aa(++_0x2480c7);}(_0x9123,0x140));var _0x3912=function(_0x54c88b,_0x154f4a){_0x54c88b=_0x54c88b-0x0;var _0x14c64a=_0x9123[_0x54c88b];return _0x14c64a;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3912('0x1'));var BPromise=require('bluebird');var rp=require(_0x3912('0x2'));var fs=require('fs');var path=require(_0x3912('0x3'));var rimraf=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x3912('0x6')]=function(_0x4709e7,_0x487e17){return _0x4709e7['define'](_0x3912('0x7'),attributes,{'tableName':_0x3912('0x8'),'paranoid':![],'indexes':[{'name':_0x3912('0x9'),'fields':['idField',_0x3912('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3445=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesField.attributes','exports','freshsales_unique_index','lodash'];(function(_0x3b6993,_0x1c4b29){var _0x3ea51a=function(_0x3100ef){while(--_0x3100ef){_0x3b6993['push'](_0x3b6993['shift']());}};_0x3ea51a(++_0x1c4b29);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require(_0x5344('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5344('0x7'));var attributes=require(_0x5344('0x8'));module[_0x5344('0x9')]=function(_0x1f654a,_0x5c1b4e){return _0x1f654a['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5344('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c4cc1a7..eb63529 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1267b0,_0x399d83){_0x1267b0=_0x1267b0-0x0;var _0x2a796e=_0x3f8a[_0x1267b0];return _0x2a796e;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x5a8390,_0x4d4f65){var _0x584a6c=function(_0x695d12){while(--_0x695d12){_0x5a8390['push'](_0x5a8390['shift']());}};_0x584a6c(++_0x4d4f65);}(_0x9536,0x179));var _0x6953=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x9536[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c52bed4..be659ff 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(_0x456717,_0x4e96eb){var _0x1bb0f4=function(_0x250ce1){while(--_0x250ce1){_0x456717['push'](_0x456717['shift']());}};_0x1bb0f4(++_0x4e96eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x494ea5,_0x234211){var _0x3e6800=function(_0x32ae92){while(--_0x32ae92){_0x494ea5['push'](_0x494ea5['shift']());}};_0x3e6800(++_0x234211);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 871c6d0..e1b91f2 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 _0x6a18=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x4e9273,_0x48cb45){var _0x3ae68b=function(_0x7ff6db){while(--_0x7ff6db){_0x4e9273['push'](_0x4e9273['shift']());}};_0x3ae68b(++_0x48cb45);}(_0x6a18,0x114));var _0x86a1=function(_0x4f2e09,_0x151e23){_0x4f2e09=_0x4f2e09-0x0;var _0x47f295=_0x6a18[_0x4f2e09];return _0x47f295;};'use strict';var Sequelize=require(_0x86a1('0x0'));module[_0x86a1('0x1')]={'name':{'type':Sequelize[_0x86a1('0x2')]},'description':{'type':Sequelize[_0x86a1('0x2')]},'username':{'type':Sequelize[_0x86a1('0x2')],'unique':_0x86a1('0x3')},'remoteUri':{'type':Sequelize[_0x86a1('0x2')]},'password':{'type':Sequelize[_0x86a1('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x86a1('0x2')]},'serverUrl':{'type':Sequelize[_0x86a1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x86a1('0x4')]('integrationTab',_0x86a1('0x5')),'defaultValue':_0x86a1('0x6')}}; \ No newline at end of file +var _0xccde=['integrationTab','sequelize','STRING','username','ENUM','newTab'];(function(_0x5e6971,_0x17ed4d){var _0x4dcb94=function(_0x3b8079){while(--_0x3b8079){_0x5e6971['push'](_0x5e6971['shift']());}};_0x4dcb94(++_0x17ed4d);}(_0xccde,0x1e1));var _0xeccd=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xccde[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeccd('0x1')],'unique':_0xeccd('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xeccd('0x1')]},'clientSecret':{'type':Sequelize[_0xeccd('0x1')]},'securityToken':{'type':Sequelize[_0xeccd('0x1')]},'serverUrl':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeccd('0x3')]('integrationTab',_0xeccd('0x4')),'defaultValue':_0xeccd('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 24a96f8..64a1783 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 _0x0da4=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','intersection','catch','create','body','find','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientSecret','username','password','slice','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','textarea','remove','includes','custom','picklistValues','label','true','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x2cd353,_0x5944f5){var _0x2a9c90=function(_0x114470){while(--_0x114470){_0x2cd353['push'](_0x2cd353['shift']());}};_0x2a9c90(++_0x5944f5);}(_0x0da4,0x13f));var _0x40da=function(_0x4fe799,_0x1f6d08){_0x4fe799=_0x4fe799-0x0;var _0x4ad0a7=_0x0da4[_0x4fe799];return _0x4ad0a7;};'use strict';var emlformat=require(_0x40da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40da('0x1'));var jsonpatch=require(_0x40da('0x2'));var rp=require(_0x40da('0x3'));var moment=require(_0x40da('0x4'));var BPromise=require(_0x40da('0x5'));var Mustache=require(_0x40da('0x6'));var util=require(_0x40da('0x7'));var path=require(_0x40da('0x8'));var sox=require('sox');var csv=require(_0x40da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40da('0xa'));var _=require(_0x40da('0xb'));var squel=require('squel');var crypto=require(_0x40da('0xc'));var jsforce=require(_0x40da('0xd'));var deskjs=require(_0x40da('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40da('0xf'));var Papa=require(_0x40da('0x10'));var Redis=require(_0x40da('0x11'));var authService=require(_0x40da('0x12'));var qs=require(_0x40da('0x13'));var as=require(_0x40da('0x14'));var hardwareService=require(_0x40da('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x40da('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x40da('0x17'))['db'];var integrations=require(_0x40da('0x18'));function respondWithStatusCode(_0x527493,_0x14d3a5){_0x14d3a5=_0x14d3a5||0xcc;return function(_0x369fbc){if(_0x369fbc){return _0x527493[_0x40da('0x19')](_0x14d3a5);}return _0x527493[_0x40da('0x1a')](_0x14d3a5)[_0x40da('0x1b')]();};}function respondWithResult(_0x28adc2,_0x3445cd){_0x3445cd=_0x3445cd||0xc8;return function(_0x505818){if(_0x505818){return _0x28adc2[_0x40da('0x1a')](_0x3445cd)[_0x40da('0x1c')](_0x505818);}};}function respondWithFilteredResult(_0xff2d61,_0x2aa9dc){return function(_0xddeede){if(_0xddeede){var _0xe4b2db=typeof _0x2aa9dc['offset']===_0x40da('0x1d')&&typeof _0x2aa9dc[_0x40da('0x1e')]===_0x40da('0x1d');var _0x459d41=_0xddeede['count'];var _0x2e05f3=_0xe4b2db?0x0:_0x2aa9dc[_0x40da('0x1f')];var _0x130e8b=_0xe4b2db?_0xddeede['count']:_0x2aa9dc[_0x40da('0x1f')]+_0x2aa9dc[_0x40da('0x1e')];var _0x281c9b;if(_0x130e8b>=_0x459d41){_0x130e8b=_0x459d41;_0x281c9b=0xc8;}else{_0x281c9b=0xce;}_0xff2d61[_0x40da('0x1a')](_0x281c9b);return _0xff2d61[_0x40da('0x20')](_0x40da('0x21'),_0x2e05f3+'-'+_0x130e8b+'/'+_0x459d41)['json'](_0xddeede);}return null;};}function patchUpdates(_0x5f41ef){return function(_0xbc71cc){try{jsonpatch[_0x40da('0x22')](_0xbc71cc,_0x5f41ef,!![]);}catch(_0x1118b9){return BPromise[_0x40da('0x23')](_0x1118b9);}return _0xbc71cc[_0x40da('0x24')]();};}function saveUpdates(_0x263415,_0x3bf972){return function(_0x3a4eab){if(_0x3a4eab){return _0x3a4eab[_0x40da('0x25')](_0x263415)['then'](function(_0x1e26fe){return _0x1e26fe;});}return null;};}function removeEntity(_0x50243c,_0x32fa3d){return function(_0x4e00a7){if(_0x4e00a7){return _0x4e00a7[_0x40da('0x26')]()[_0x40da('0x27')](function(){_0x50243c[_0x40da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd9ab1d,_0x3b7fb7){return function(_0x287230){if(!_0x287230){_0xd9ab1d['sendStatus'](0x194);}return _0x287230;};}function handleError(_0x2b44fa,_0x226804){_0x226804=_0x226804||0x1f4;return function(_0x256b89){logger['error'](_0x256b89[_0x40da('0x28')]);if(_0x256b89[_0x40da('0x29')]){delete _0x256b89['name'];}_0x2b44fa[_0x40da('0x1a')](_0x226804)[_0x40da('0x2a')](_0x256b89);};}exports['index']=function(_0x4d859f,_0x491830){var _0xe99149={},_0x335166={},_0xbf14e6={'count':0x0,'rows':[]};var _0x137b34=_[_0x40da('0x2b')](db[_0x40da('0x2c')][_0x40da('0x2d')],function(_0x69b1c7){return{'name':_0x69b1c7['fieldName'],'type':_0x69b1c7[_0x40da('0x2e')][_0x40da('0x2f')]};});_0x335166[_0x40da('0x30')]=_['map'](_0x137b34,_0x40da('0x29'));_0x335166[_0x40da('0x31')]=_[_0x40da('0x32')](_0x4d859f['query']);_0x335166[_0x40da('0x33')]=_['intersection'](_0x335166[_0x40da('0x30')],_0x335166['query']);_0xe99149[_0x40da('0x34')]=_['intersection'](_0x335166[_0x40da('0x30')],qs['fields'](_0x4d859f[_0x40da('0x31')][_0x40da('0x35')]));_0xe99149[_0x40da('0x34')]=_0xe99149[_0x40da('0x34')][_0x40da('0x36')]?_0xe99149[_0x40da('0x34')]:_0x335166[_0x40da('0x30')];if(!_0x4d859f['query'][_0x40da('0x37')](_0x40da('0x38'))){_0xe99149[_0x40da('0x1e')]=qs['limit'](_0x4d859f[_0x40da('0x31')][_0x40da('0x1e')]);_0xe99149[_0x40da('0x1f')]=qs[_0x40da('0x1f')](_0x4d859f[_0x40da('0x31')][_0x40da('0x1f')]);}_0xe99149[_0x40da('0x39')]=qs[_0x40da('0x3a')](_0x4d859f[_0x40da('0x31')]['sort']);_0xe99149['where']=qs['filters'](_[_0x40da('0x3b')](_0x4d859f['query'],_0x335166[_0x40da('0x33')]),_0x137b34);if(_0x4d859f[_0x40da('0x31')][_0x40da('0x3c')]){_0xe99149[_0x40da('0x3d')]=_['merge'](_0xe99149['where'],{'$or':_[_0x40da('0x2b')](_0x137b34,function(_0x430ecc){if(_0x430ecc['type']!==_0x40da('0x3e')){var _0x52e26a={};_0x52e26a[_0x430ecc[_0x40da('0x29')]]={'$like':'%'+_0x4d859f['query'][_0x40da('0x3c')]+'%'};return _0x52e26a;}})});}_0xe99149=_[_0x40da('0x3f')]({},_0xe99149,_0x4d859f[_0x40da('0x40')]);var _0x5215b1={'where':_0xe99149[_0x40da('0x3d')]};return db[_0x40da('0x2c')]['count'](_0x5215b1)['then'](function(_0x9a0ba0){_0xbf14e6[_0x40da('0x41')]=_0x9a0ba0;if(_0x4d859f['query'][_0x40da('0x42')]){_0xe99149[_0x40da('0x43')]=[{'all':!![]}];}return db[_0x40da('0x2c')][_0x40da('0x44')](_0xe99149);})['then'](function(_0x5e1e47){_0xbf14e6['rows']=_0x5e1e47;return _0xbf14e6;})[_0x40da('0x27')](respondWithFilteredResult(_0x491830,_0xe99149))['catch'](handleError(_0x491830,null));};exports[_0x40da('0x45')]=function(_0x5e3728,_0x53e7cb){var _0x58aaa8={'raw':![],'where':{'id':_0x5e3728[_0x40da('0x46')]['id']}},_0x3a224e={};_0x3a224e['model']=_[_0x40da('0x32')](db['SalesforceAccount'][_0x40da('0x2d')]);_0x3a224e['query']=_[_0x40da('0x32')](_0x5e3728[_0x40da('0x31')]);_0x3a224e[_0x40da('0x33')]=_[_0x40da('0x47')](_0x3a224e[_0x40da('0x30')],_0x3a224e[_0x40da('0x31')]);_0x58aaa8[_0x40da('0x34')]=_['intersection'](_0x3a224e[_0x40da('0x30')],qs[_0x40da('0x35')](_0x5e3728['query'][_0x40da('0x35')]));_0x58aaa8[_0x40da('0x34')]=_0x58aaa8[_0x40da('0x34')][_0x40da('0x36')]?_0x58aaa8['attributes']:_0x3a224e[_0x40da('0x30')];if(_0x5e3728['query'][_0x40da('0x42')]){_0x58aaa8[_0x40da('0x43')]=[{'all':!![]}];}_0x58aaa8=_[_0x40da('0x3f')]({},_0x58aaa8,_0x5e3728[_0x40da('0x40')]);return db[_0x40da('0x2c')]['find'](_0x58aaa8)[_0x40da('0x27')](handleEntityNotFound(_0x53e7cb,null))[_0x40da('0x27')](respondWithResult(_0x53e7cb,null))[_0x40da('0x48')](handleError(_0x53e7cb,null));};exports[_0x40da('0x49')]=function(_0x533a42,_0x21ee37){return db['SalesforceAccount']['create'](_0x533a42['body'],{})[_0x40da('0x27')](respondWithResult(_0x21ee37,0xc9))[_0x40da('0x48')](handleError(_0x21ee37,null));};exports[_0x40da('0x25')]=function(_0x156e71,_0x21c1a6){if(_0x156e71[_0x40da('0x4a')]['id']){delete _0x156e71[_0x40da('0x4a')]['id'];}return db[_0x40da('0x2c')][_0x40da('0x4b')]({'where':{'id':_0x156e71[_0x40da('0x46')]['id']}})[_0x40da('0x27')](handleEntityNotFound(_0x21c1a6,null))[_0x40da('0x27')](saveUpdates(_0x156e71['body'],null))[_0x40da('0x27')](respondWithResult(_0x21c1a6,null))[_0x40da('0x48')](handleError(_0x21c1a6,null));};exports[_0x40da('0x26')]=function(_0x41dd69,_0x54ea88){return db[_0x40da('0x2c')][_0x40da('0x4b')]({'where':{'id':_0x41dd69[_0x40da('0x46')]['id']}})[_0x40da('0x27')](handleEntityNotFound(_0x54ea88,null))[_0x40da('0x27')](removeEntity(_0x54ea88,null))[_0x40da('0x48')](handleError(_0x54ea88,null));};exports[_0x40da('0x4c')]=function(_0x286845,_0x39957c,_0x3f2b3b){var _0x62f02b={};var _0x8e0a2d={};var _0x240721;var _0x313c00;return db[_0x40da('0x2c')]['findOne']({'where':{'id':_0x286845[_0x40da('0x46')]['id']}})[_0x40da('0x27')](handleEntityNotFound(_0x39957c,null))[_0x40da('0x27')](function(_0x44ca84){if(_0x44ca84){_0x240721=_0x44ca84;_0x8e0a2d[_0x40da('0x30')]=_['keys'](db[_0x40da('0x4d')]['rawAttributes']);_0x8e0a2d[_0x40da('0x31')]=_[_0x40da('0x32')](_0x286845[_0x40da('0x31')]);_0x8e0a2d[_0x40da('0x33')]=_['intersection'](_0x8e0a2d['model'],_0x8e0a2d[_0x40da('0x31')]);_0x62f02b[_0x40da('0x34')]=_[_0x40da('0x47')](_0x8e0a2d[_0x40da('0x30')],qs[_0x40da('0x35')](_0x286845[_0x40da('0x31')][_0x40da('0x35')]));_0x62f02b[_0x40da('0x34')]=_0x62f02b[_0x40da('0x34')][_0x40da('0x36')]?_0x62f02b['attributes']:_0x8e0a2d[_0x40da('0x30')];_0x62f02b[_0x40da('0x39')]=qs['sort'](_0x286845['query'][_0x40da('0x3a')]);_0x62f02b[_0x40da('0x3d')]=qs[_0x40da('0x33')](_[_0x40da('0x3b')](_0x286845['query'],_0x8e0a2d[_0x40da('0x33')]));if(_0x286845[_0x40da('0x31')]['filter']){_0x62f02b[_0x40da('0x3d')]=_[_0x40da('0x3f')](_0x62f02b[_0x40da('0x3d')],{'$or':_['map'](_0x62f02b[_0x40da('0x34')],function(_0x5ddcc8){var _0x2449c4={};_0x2449c4[_0x5ddcc8]={'$like':'%'+_0x286845[_0x40da('0x31')][_0x40da('0x3c')]+'%'};return _0x2449c4;})});}_0x62f02b=_[_0x40da('0x3f')]({},_0x62f02b,_0x286845[_0x40da('0x40')]);return _0x240721[_0x40da('0x4c')](_0x62f02b);}})[_0x40da('0x27')](function(_0x2bd0c9){if(_0x2bd0c9){_0x313c00=_0x2bd0c9['length'];if(!_0x286845[_0x40da('0x31')][_0x40da('0x37')]('nolimit')){_0x62f02b[_0x40da('0x1e')]=qs[_0x40da('0x1e')](_0x286845[_0x40da('0x31')][_0x40da('0x1e')]);_0x62f02b[_0x40da('0x1f')]=qs[_0x40da('0x1f')](_0x286845[_0x40da('0x31')]['offset']);}return _0x240721['getConfigurations'](_0x62f02b);}})[_0x40da('0x27')](function(_0x184794){if(_0x184794){return _0x184794?{'count':_0x313c00,'rows':_0x184794}:null;}})[_0x40da('0x27')](respondWithResult(_0x39957c,null))[_0x40da('0x48')](handleError(_0x39957c,null));};exports[_0x40da('0x4e')]=function(_0x4cfd74,_0x2de64a,_0x5701ee){if(_0x4cfd74[_0x40da('0x4a')]['id']){delete _0x4cfd74['body']['id'];}return db['SalesforceAccount'][_0x40da('0x4f')]({'where':{'id':_0x4cfd74[_0x40da('0x46')]['id']}})['then'](handleEntityNotFound(_0x2de64a,null))[_0x40da('0x27')](function(_0x12f705){if(_0x12f705){_0x4cfd74['body'][_0x40da('0x50')]=_0x12f705['id'];_0x4cfd74[_0x40da('0x4a')][_0x40da('0x51')]=integrations[_0x40da('0x52')](_0x4cfd74['body'][_0x40da('0x53')],_0x4cfd74[_0x40da('0x4a')][_0x40da('0x2e')]);_0x4cfd74[_0x40da('0x4a')][_0x40da('0x54')]=integrations[_0x40da('0x55')](_0x4cfd74[_0x40da('0x4a')][_0x40da('0x53')],_0x4cfd74[_0x40da('0x4a')][_0x40da('0x2e')]);return db[_0x40da('0x4d')][_0x40da('0x49')](_0x4cfd74[_0x40da('0x4a')],{'include':[{'model':db[_0x40da('0x56')],'as':_0x40da('0x51')},{'model':db[_0x40da('0x56')],'as':_0x40da('0x54')}]});}return null;})['then'](respondWithResult(_0x2de64a,null))['catch'](handleError(_0x2de64a,null));};exports['getFields']=function(_0x207232,_0x62fe1a,_0x3b7be5){var _0x7a4c08;var _0x1bb2ed='';var _0x539da2=_0x40da('0x57');return db[_0x40da('0x2c')][_0x40da('0x4f')]({'where':{'id':_0x207232[_0x40da('0x46')]['id']},'attributes':['id',_0x40da('0x58'),'clientId',_0x40da('0x59'),_0x40da('0x5a'),_0x40da('0x5b'),'securityToken']})[_0x40da('0x27')](handleEntityNotFound(_0x62fe1a,null))[_0x40da('0x27')](function(_0x4d467e){if(_0x4d467e){_0x1bb2ed=_0x4d467e[_0x40da('0x58')];var _0x56dd4a=_0x1bb2ed[_0x40da('0x5c')](-0x1);if(_0x56dd4a==='/'){_0x1bb2ed=_0x1bb2ed['substring'](0x0,_0x1bb2ed[_0x40da('0x5d')](_0x56dd4a));}_0x7a4c08=new jsforce[(_0x40da('0x5e'))]({'oauth2':{'loginUrl':_0x1bb2ed,'clientId':_0x4d467e['clientId'],'clientSecret':_0x4d467e[_0x40da('0x59')]}});return _0x7a4c08[_0x40da('0x5f')](_0x4d467e['username'],_0x4d467e[_0x40da('0x5b')][_0x40da('0x60')](_0x4d467e[_0x40da('0x61')]));}})[_0x40da('0x27')](function(_0x6985ad){if(_0x6985ad){if(!_['isNil'](_0x207232[_0x40da('0x31')][_0x40da('0x62')])){_0x539da2=_0x207232[_0x40da('0x31')]['ticketType'];}return _0x7a4c08[_0x40da('0x63')](_0x539da2)[_0x40da('0x64')]();}})['then'](function(_0x86e15){var _0x1e06e=[_0x40da('0x65'),'ActivityDate',_0x40da('0x66'),_0x40da('0x67'),'Subject',_0x40da('0x68')];var _0x33211f=[_0x40da('0x69'),_0x40da('0x6a'),_0x40da('0x6b'),_0x40da('0x6c'),'email',_0x40da('0x6d'),'phone'];if(_0x86e15){_[_0x40da('0x6e')](_0x86e15[_0x40da('0x35')],function(_0x4a79a0){return _0x1e06e['includes'](_0x4a79a0['name'])||!_0x33211f[_0x40da('0x6f')](_0x4a79a0[_0x40da('0x2e')]);});return{'count':_0x86e15['fields']['length'],'rows':_[_0x40da('0x2b')](_0x86e15[_0x40da('0x35')],function(_0x2ed65f){return{'id':_0x2ed65f[_0x40da('0x29')],'name':_0x2ed65f['label'],'custom':_0x2ed65f[_0x40da('0x70')],'options':_0x2ed65f[_0x40da('0x71')][_0x40da('0x36')]>0x0?_['map'](_0x2ed65f[_0x40da('0x71')],function(_0x1a448c){return{'name':_0x1a448c[_0x40da('0x72')],'value':_0x1a448c['value']};}):_0x2ed65f['type']=='boolean'?[{'name':'True','value':_0x40da('0x73')},{'name':'False','value':_0x40da('0x74')}]:[]};})};}})['then'](respondWithResult(_0x62fe1a,null))[_0x40da('0x48')](function(_0x45ffc8){var _0x30b888=_0x207232[_0x40da('0x31')][_0x40da('0x75')]?0x1f4:_0x45ffc8[_0x40da('0x76')]||0x1f4;logger[_0x40da('0x77')](_0x40da('0x78'),_0x40da('0x79'),_0x30b888,JSON[_0x40da('0x7a')](_0x45ffc8));delete _0x45ffc8[_0x40da('0x29')];if(_0x30b888===0x191){_0x30b888=0x190;}_0x62fe1a[_0x40da('0x1a')](_0x30b888)[_0x40da('0x2a')](_0x207232[_0x40da('0x31')][_0x40da('0x75')]?{'message':_0x40da('0x7b'),'statusCode':_0x45ffc8[_0x40da('0x76')]}:_0x45ffc8);});}; \ No newline at end of file +var _0xbdfa=['concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','False','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','sendStatus','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','find','catch','create','body','getConfigurations','findOne','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','Subjects','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','substring','lastIndexOf','Connection','login','password'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xbdfa,0x95));var _0xabdf=function(_0x30dd9c,_0x320110){_0x30dd9c=_0x30dd9c-0x0;var _0x38147d=_0xbdfa[_0x30dd9c];return _0x38147d;};'use strict';var emlformat=require(_0xabdf('0x0'));var rimraf=require(_0xabdf('0x1'));var zipdir=require(_0xabdf('0x2'));var jsonpatch=require(_0xabdf('0x3'));var rp=require(_0xabdf('0x4'));var moment=require(_0xabdf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xabdf('0x6'));var util=require(_0xabdf('0x7'));var path=require(_0xabdf('0x8'));var sox=require(_0xabdf('0x9'));var csv=require(_0xabdf('0xa'));var ejs=require(_0xabdf('0xb'));var fs=require('fs');var fs_extra=require(_0xabdf('0xc'));var _=require(_0xabdf('0xd'));var squel=require('squel');var crypto=require(_0xabdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xabdf('0xf'));var toCsv=require(_0xabdf('0xa'));var querystring=require(_0xabdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xabdf('0x11'));var authService=require(_0xabdf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabdf('0x13'));var logger=require(_0xabdf('0x14'))(_0xabdf('0x15'));var utils=require('../../config/utils');var config=require(_0xabdf('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d2a77,_0x3dc6e0){_0x3dc6e0=_0x3dc6e0||0xcc;return function(_0x2b3ff7){if(_0x2b3ff7){return _0x5d2a77['sendStatus'](_0x3dc6e0);}return _0x5d2a77[_0xabdf('0x17')](_0x3dc6e0)[_0xabdf('0x18')]();};}function respondWithResult(_0x52a534,_0x108b98){_0x108b98=_0x108b98||0xc8;return function(_0x4d6924){if(_0x4d6924){return _0x52a534[_0xabdf('0x17')](_0x108b98)[_0xabdf('0x19')](_0x4d6924);}};}function respondWithFilteredResult(_0x1aa07e,_0x2b0e7a){return function(_0xf04844){if(_0xf04844){var _0x381ef5=typeof _0x2b0e7a[_0xabdf('0x1a')]==='undefined'&&typeof _0x2b0e7a[_0xabdf('0x1b')]===_0xabdf('0x1c');var _0x4e2eb7=_0xf04844[_0xabdf('0x1d')];var _0x4b81a9=_0x381ef5?0x0:_0x2b0e7a[_0xabdf('0x1a')];var _0x568175=_0x381ef5?_0xf04844[_0xabdf('0x1d')]:_0x2b0e7a[_0xabdf('0x1a')]+_0x2b0e7a[_0xabdf('0x1b')];var _0xfccdf;if(_0x568175>=_0x4e2eb7){_0x568175=_0x4e2eb7;_0xfccdf=0xc8;}else{_0xfccdf=0xce;}_0x1aa07e['status'](_0xfccdf);return _0x1aa07e['set'](_0xabdf('0x1e'),_0x4b81a9+'-'+_0x568175+'/'+_0x4e2eb7)[_0xabdf('0x19')](_0xf04844);}return null;};}function patchUpdates(_0x347949){return function(_0xbd3ab5){try{jsonpatch[_0xabdf('0x1f')](_0xbd3ab5,_0x347949,!![]);}catch(_0x19bfc3){return BPromise['reject'](_0x19bfc3);}return _0xbd3ab5['save']();};}function saveUpdates(_0x311487,_0x25ba76){return function(_0x20a4ea){if(_0x20a4ea){return _0x20a4ea[_0xabdf('0x20')](_0x311487)[_0xabdf('0x21')](function(_0xd67549){return _0xd67549;});}return null;};}function removeEntity(_0x4ed90d,_0x1a3ef6){return function(_0x5f424d){if(_0x5f424d){return _0x5f424d['destroy']()[_0xabdf('0x21')](function(){_0x4ed90d[_0xabdf('0x17')](0xcc)[_0xabdf('0x18')]();});}};}function handleEntityNotFound(_0x31ebbf,_0xed7f5f){return function(_0x4c83d1){if(!_0x4c83d1){_0x31ebbf[_0xabdf('0x22')](0x194);}return _0x4c83d1;};}function handleError(_0x23d6ad,_0x4fede7){_0x4fede7=_0x4fede7||0x1f4;return function(_0x4ca81e){logger[_0xabdf('0x23')](_0x4ca81e[_0xabdf('0x24')]);if(_0x4ca81e[_0xabdf('0x25')]){delete _0x4ca81e[_0xabdf('0x25')];}_0x23d6ad['status'](_0x4fede7)['send'](_0x4ca81e);};}exports[_0xabdf('0x26')]=function(_0x13080c,_0x4317c3){var _0x150705={},_0x1f04a8={},_0x21bc55={'count':0x0,'rows':[]};var _0x59d730=_[_0xabdf('0x27')](db[_0xabdf('0x28')][_0xabdf('0x29')],function(_0x1c47e9){return{'name':_0x1c47e9[_0xabdf('0x2a')],'type':_0x1c47e9['type']['key']};});_0x1f04a8[_0xabdf('0x2b')]=_[_0xabdf('0x27')](_0x59d730,'name');_0x1f04a8[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x13080c[_0xabdf('0x2c')]);_0x1f04a8['filters']=_[_0xabdf('0x2e')](_0x1f04a8[_0xabdf('0x2b')],_0x1f04a8['query']);_0x150705['attributes']=_[_0xabdf('0x2e')](_0x1f04a8['model'],qs[_0xabdf('0x2f')](_0x13080c[_0xabdf('0x2c')]['fields']));_0x150705[_0xabdf('0x30')]=_0x150705[_0xabdf('0x30')][_0xabdf('0x31')]?_0x150705['attributes']:_0x1f04a8[_0xabdf('0x2b')];if(!_0x13080c[_0xabdf('0x2c')][_0xabdf('0x32')]('nolimit')){_0x150705[_0xabdf('0x1b')]=qs['limit'](_0x13080c[_0xabdf('0x2c')][_0xabdf('0x1b')]);_0x150705[_0xabdf('0x1a')]=qs[_0xabdf('0x1a')](_0x13080c['query'][_0xabdf('0x1a')]);}_0x150705[_0xabdf('0x33')]=qs[_0xabdf('0x34')](_0x13080c[_0xabdf('0x2c')][_0xabdf('0x34')]);_0x150705[_0xabdf('0x35')]=qs[_0xabdf('0x36')](_[_0xabdf('0x37')](_0x13080c[_0xabdf('0x2c')],_0x1f04a8[_0xabdf('0x36')]),_0x59d730);if(_0x13080c[_0xabdf('0x2c')][_0xabdf('0x38')]){_0x150705['where']=_[_0xabdf('0x39')](_0x150705[_0xabdf('0x35')],{'$or':_[_0xabdf('0x27')](_0x59d730,function(_0x40e1cb){if(_0x40e1cb[_0xabdf('0x3a')]!==_0xabdf('0x3b')){var _0x3c383f={};_0x3c383f[_0x40e1cb[_0xabdf('0x25')]]={'$like':'%'+_0x13080c[_0xabdf('0x2c')][_0xabdf('0x38')]+'%'};return _0x3c383f;}})});}_0x150705=_[_0xabdf('0x39')]({},_0x150705,_0x13080c[_0xabdf('0x3c')]);var _0x46a87f={'where':_0x150705[_0xabdf('0x35')]};return db[_0xabdf('0x28')][_0xabdf('0x1d')](_0x46a87f)[_0xabdf('0x21')](function(_0x22dbef){_0x21bc55['count']=_0x22dbef;if(_0x13080c[_0xabdf('0x2c')][_0xabdf('0x3d')]){_0x150705[_0xabdf('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x150705);})[_0xabdf('0x21')](function(_0x1f3718){_0x21bc55['rows']=_0x1f3718;return _0x21bc55;})['then'](respondWithFilteredResult(_0x4317c3,_0x150705))['catch'](handleError(_0x4317c3,null));};exports[_0xabdf('0x3f')]=function(_0x21b3de,_0x3d7193){var _0x3a9a0f={'raw':![],'where':{'id':_0x21b3de[_0xabdf('0x40')]['id']}},_0x30e746={};_0x30e746[_0xabdf('0x2b')]=_[_0xabdf('0x2d')](db['SalesforceAccount']['rawAttributes']);_0x30e746[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x21b3de[_0xabdf('0x2c')]);_0x30e746[_0xabdf('0x36')]=_[_0xabdf('0x2e')](_0x30e746[_0xabdf('0x2b')],_0x30e746[_0xabdf('0x2c')]);_0x3a9a0f[_0xabdf('0x30')]=_[_0xabdf('0x2e')](_0x30e746[_0xabdf('0x2b')],qs[_0xabdf('0x2f')](_0x21b3de['query'][_0xabdf('0x2f')]));_0x3a9a0f[_0xabdf('0x30')]=_0x3a9a0f[_0xabdf('0x30')][_0xabdf('0x31')]?_0x3a9a0f[_0xabdf('0x30')]:_0x30e746[_0xabdf('0x2b')];if(_0x21b3de[_0xabdf('0x2c')]['includeAll']){_0x3a9a0f[_0xabdf('0x3e')]=[{'all':!![]}];}_0x3a9a0f=_[_0xabdf('0x39')]({},_0x3a9a0f,_0x21b3de[_0xabdf('0x3c')]);return db['SalesforceAccount'][_0xabdf('0x41')](_0x3a9a0f)[_0xabdf('0x21')](handleEntityNotFound(_0x3d7193,null))['then'](respondWithResult(_0x3d7193,null))[_0xabdf('0x42')](handleError(_0x3d7193,null));};exports[_0xabdf('0x43')]=function(_0x4df621,_0x151ec5){return db[_0xabdf('0x28')][_0xabdf('0x43')](_0x4df621['body'],{})[_0xabdf('0x21')](respondWithResult(_0x151ec5,0xc9))[_0xabdf('0x42')](handleError(_0x151ec5,null));};exports[_0xabdf('0x20')]=function(_0x51480a,_0x106a8a){if(_0x51480a[_0xabdf('0x44')]['id']){delete _0x51480a[_0xabdf('0x44')]['id'];}return db[_0xabdf('0x28')]['find']({'where':{'id':_0x51480a[_0xabdf('0x40')]['id']}})['then'](handleEntityNotFound(_0x106a8a,null))['then'](saveUpdates(_0x51480a['body'],null))[_0xabdf('0x21')](respondWithResult(_0x106a8a,null))[_0xabdf('0x42')](handleError(_0x106a8a,null));};exports['destroy']=function(_0x4aa367,_0x7d4d1c){return db['SalesforceAccount'][_0xabdf('0x41')]({'where':{'id':_0x4aa367[_0xabdf('0x40')]['id']}})['then'](handleEntityNotFound(_0x7d4d1c,null))['then'](removeEntity(_0x7d4d1c,null))[_0xabdf('0x42')](handleError(_0x7d4d1c,null));};exports[_0xabdf('0x45')]=function(_0x5f4b68,_0x12a408,_0x5193ff){var _0x5db05f={};var _0x44e752={};var _0x59d710;var _0x3adbc3;return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x5f4b68[_0xabdf('0x40')]['id']}})[_0xabdf('0x21')](handleEntityNotFound(_0x12a408,null))[_0xabdf('0x21')](function(_0x2d0ebd){if(_0x2d0ebd){_0x59d710=_0x2d0ebd;_0x44e752[_0xabdf('0x2b')]=_[_0xabdf('0x2d')](db['SalesforceConfiguration'][_0xabdf('0x29')]);_0x44e752[_0xabdf('0x2c')]=_[_0xabdf('0x2d')](_0x5f4b68['query']);_0x44e752[_0xabdf('0x36')]=_[_0xabdf('0x2e')](_0x44e752[_0xabdf('0x2b')],_0x44e752[_0xabdf('0x2c')]);_0x5db05f[_0xabdf('0x30')]=_['intersection'](_0x44e752[_0xabdf('0x2b')],qs[_0xabdf('0x2f')](_0x5f4b68['query'][_0xabdf('0x2f')]));_0x5db05f[_0xabdf('0x30')]=_0x5db05f[_0xabdf('0x30')]['length']?_0x5db05f[_0xabdf('0x30')]:_0x44e752['model'];_0x5db05f[_0xabdf('0x33')]=qs[_0xabdf('0x34')](_0x5f4b68['query'][_0xabdf('0x34')]);_0x5db05f[_0xabdf('0x35')]=qs[_0xabdf('0x36')](_['pick'](_0x5f4b68[_0xabdf('0x2c')],_0x44e752['filters']));if(_0x5f4b68['query'][_0xabdf('0x38')]){_0x5db05f[_0xabdf('0x35')]=_[_0xabdf('0x39')](_0x5db05f[_0xabdf('0x35')],{'$or':_[_0xabdf('0x27')](_0x5db05f[_0xabdf('0x30')],function(_0x45dd2b){var _0x19d7ae={};_0x19d7ae[_0x45dd2b]={'$like':'%'+_0x5f4b68[_0xabdf('0x2c')][_0xabdf('0x38')]+'%'};return _0x19d7ae;})});}_0x5db05f=_[_0xabdf('0x39')]({},_0x5db05f,_0x5f4b68[_0xabdf('0x3c')]);return _0x59d710['getConfigurations'](_0x5db05f);}})[_0xabdf('0x21')](function(_0x5f3c6d){if(_0x5f3c6d){_0x3adbc3=_0x5f3c6d[_0xabdf('0x31')];if(!_0x5f4b68['query']['hasOwnProperty'](_0xabdf('0x47'))){_0x5db05f[_0xabdf('0x1b')]=qs[_0xabdf('0x1b')](_0x5f4b68[_0xabdf('0x2c')]['limit']);_0x5db05f[_0xabdf('0x1a')]=qs[_0xabdf('0x1a')](_0x5f4b68['query'][_0xabdf('0x1a')]);}return _0x59d710['getConfigurations'](_0x5db05f);}})[_0xabdf('0x21')](function(_0x305a45){if(_0x305a45){return _0x305a45?{'count':_0x3adbc3,'rows':_0x305a45}:null;}})[_0xabdf('0x21')](respondWithResult(_0x12a408,null))[_0xabdf('0x42')](handleError(_0x12a408,null));};exports['addConfiguration']=function(_0x4aa6a7,_0x42c282,_0x259de3){if(_0x4aa6a7[_0xabdf('0x44')]['id']){delete _0x4aa6a7[_0xabdf('0x44')]['id'];}return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x4aa6a7['params']['id']}})[_0xabdf('0x21')](handleEntityNotFound(_0x42c282,null))['then'](function(_0x2e1239){if(_0x2e1239){_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x48')]=_0x2e1239['id'];_0x4aa6a7['body']['Subjects']=integrations[_0xabdf('0x49')](_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4a')],_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x3a')]);_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4b')]=integrations[_0xabdf('0x4c')](_0x4aa6a7[_0xabdf('0x44')][_0xabdf('0x4a')],_0x4aa6a7[_0xabdf('0x44')]['type']);return db[_0xabdf('0x4d')][_0xabdf('0x43')](_0x4aa6a7['body'],{'include':[{'model':db['SalesforceField'],'as':_0xabdf('0x4e')},{'model':db[_0xabdf('0x4f')],'as':_0xabdf('0x4b')}]});}return null;})['then'](respondWithResult(_0x42c282,null))[_0xabdf('0x42')](handleError(_0x42c282,null));};exports[_0xabdf('0x50')]=function(_0x42933b,_0xbae4f5,_0x411b8c){var _0x150bad;var _0x4503b4='';var _0x46374a='Task';return db[_0xabdf('0x28')][_0xabdf('0x46')]({'where':{'id':_0x42933b[_0xabdf('0x40')]['id']},'attributes':['id',_0xabdf('0x51'),_0xabdf('0x52'),_0xabdf('0x53'),_0xabdf('0x54'),'password',_0xabdf('0x55')]})[_0xabdf('0x21')](handleEntityNotFound(_0xbae4f5,null))[_0xabdf('0x21')](function(_0xbf6da9){if(_0xbf6da9){_0x4503b4=_0xbf6da9[_0xabdf('0x51')];var _0x2d550f=_0x4503b4['slice'](-0x1);if(_0x2d550f==='/'){_0x4503b4=_0x4503b4[_0xabdf('0x56')](0x0,_0x4503b4[_0xabdf('0x57')](_0x2d550f));}_0x150bad=new jsforce[(_0xabdf('0x58'))]({'oauth2':{'loginUrl':_0x4503b4,'clientId':_0xbf6da9['clientId'],'clientSecret':_0xbf6da9['clientSecret']}});return _0x150bad[_0xabdf('0x59')](_0xbf6da9[_0xabdf('0x54')],_0xbf6da9[_0xabdf('0x5a')][_0xabdf('0x5b')](_0xbf6da9[_0xabdf('0x55')]));}})['then'](function(_0x25477e){if(_0x25477e){if(!_[_0xabdf('0x5c')](_0x42933b['query'][_0xabdf('0x5d')])){_0x46374a=_0x42933b[_0xabdf('0x2c')][_0xabdf('0x5d')];}return _0x150bad[_0xabdf('0x5e')](_0x46374a)[_0xabdf('0x5f')]();}})[_0xabdf('0x21')](function(_0x59aab9){var _0x4af849=['OwnerId',_0xabdf('0x60'),_0xabdf('0x61'),_0xabdf('0x62'),_0xabdf('0x63'),_0xabdf('0x64')];var _0x25187e=[_0xabdf('0x65'),_0xabdf('0x66'),_0xabdf('0x67'),_0xabdf('0x68'),_0xabdf('0x69'),_0xabdf('0x6a'),_0xabdf('0x6b')];if(_0x59aab9){_[_0xabdf('0x6c')](_0x59aab9[_0xabdf('0x2f')],function(_0x15c866){return _0x4af849[_0xabdf('0x6d')](_0x15c866['name'])||!_0x25187e[_0xabdf('0x6d')](_0x15c866[_0xabdf('0x3a')]);});return{'count':_0x59aab9['fields'][_0xabdf('0x31')],'rows':_['map'](_0x59aab9[_0xabdf('0x2f')],function(_0x297370){return{'id':_0x297370[_0xabdf('0x25')],'name':_0x297370[_0xabdf('0x6e')],'custom':_0x297370[_0xabdf('0x6f')],'options':_0x297370['picklistValues'][_0xabdf('0x31')]>0x0?_[_0xabdf('0x27')](_0x297370[_0xabdf('0x70')],function(_0x3d2601){return{'name':_0x3d2601[_0xabdf('0x6e')],'value':_0x3d2601['value']};}):_0x297370[_0xabdf('0x3a')]==_0xabdf('0x68')?[{'name':_0xabdf('0x71'),'value':'true'},{'name':_0xabdf('0x72'),'value':'false'}]:[]};})};}})[_0xabdf('0x21')](respondWithResult(_0xbae4f5,null))[_0xabdf('0x42')](function(_0x65270){var _0x6da4e8=_0x42933b['query']['test']?0x1f4:_0x65270['statusCode']||0x1f4;logger[_0xabdf('0x23')](_0xabdf('0x73'),_0xabdf('0x50'),_0x6da4e8,JSON['stringify'](_0x65270));delete _0x65270[_0xabdf('0x25')];if(_0x6da4e8===0x191){_0x6da4e8=0x190;}_0xbae4f5[_0xabdf('0x17')](_0x6da4e8)[_0xabdf('0x74')](_0x42933b[_0xabdf('0x2c')][_0xabdf('0x75')]?{'message':_0xabdf('0x76'),'statusCode':_0x65270[_0xabdf('0x77')]}:_0x65270);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 38eb873..bf5b1dd 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 _0x5c2a=['exports','SalesforceAccount','lodash','util','../../config/logger','moment','rimraf','./intSalesforceAccount.attributes'];(function(_0x19824d,_0x58a11f){var _0x31e2bd=function(_0x5abfe6){while(--_0x5abfe6){_0x19824d['push'](_0x19824d['shift']());}};_0x31e2bd(++_0x58a11f);}(_0x5c2a,0x1aa));var _0xa5c2=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0x5c2a[_0xda6ad1];return _0xedc3a5;};'use strict';var _=require(_0xa5c2('0x0'));var util=require(_0xa5c2('0x1'));var logger=require(_0xa5c2('0x2'))('api');var moment=require(_0xa5c2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa5c2('0x4'));var config=require('../../config/environment');var attributes=require(_0xa5c2('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xa5c2('0x6')]=function(_0x52d42c,_0x4691d3){return _0x52d42c['define'](_0xa5c2('0x7'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8286=['util','moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts'];(function(_0x457793,_0x5d80dd){var _0x1effd6=function(_0x35e2a9){while(--_0x35e2a9){_0x457793['push'](_0x457793['shift']());}};_0x1effd6(++_0x5d80dd);}(_0x8286,0x105));var _0x6828=function(_0x39f129,_0x53372d){_0x39f129=_0x39f129-0x0;var _0x2411e3=_0x8286[_0x39f129];return _0x2411e3;};'use strict';var _=require('lodash');var util=require(_0x6828('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6828('0x1'));var BPromise=require(_0x6828('0x2'));var rp=require(_0x6828('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6828('0x4'));var integrations=require(_0x6828('0x5'));module[_0x6828('0x6')]=function(_0xce7b3,_0x20ff22){return _0xce7b3['define'](_0x6828('0x7'),attributes,{'tableName':_0x6828('0x8'),'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 e9e0be1..b49628f 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 _0x3a1a=['options','raw','where','include','map','model','attributes','then','catch','ShowSalesforceAccount','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetSalesforceAccount','SalesforceAccount'];(function(_0x192fcb,_0x2a6655){var _0x689383=function(_0xf9bed4){while(--_0xf9bed4){_0x192fcb['push'](_0x192fcb['shift']());}};_0x689383(++_0x2a6655);}(_0x3a1a,0x15f));var _0xa3a1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3a1a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xa3a1('0x0'));var moment=require(_0xa3a1('0x1'));var BPromise=require(_0xa3a1('0x2'));var rs=require(_0xa3a1('0x3'));var fs=require('fs');var Redis=require(_0xa3a1('0x4'));var db=require(_0xa3a1('0x5'))['db'];var utils=require(_0xa3a1('0x6'));var logger=require(_0xa3a1('0x7'))('rpc');var config=require(_0xa3a1('0x8'));var jayson=require(_0xa3a1('0x9'));var client=jayson[_0xa3a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9bad,_0x1c256f,_0x563b05){return new BPromise(function(_0x2cd794,_0x52fdc5){return client[_0xa3a1('0xb')](_0x2f9bad,_0x563b05)['then'](function(_0x3a390c){logger['info'](_0xa3a1('0xc'),_0x1c256f,'request\x20sent');logger[_0xa3a1('0xd')](_0xa3a1('0xe'),_0x1c256f,_0xa3a1('0xf'),JSON[_0xa3a1('0x10')](_0x3a390c));if(_0x3a390c['error']){if(_0x3a390c['error'][_0xa3a1('0x11')]===0x1f4){logger[_0xa3a1('0x12')](_0xa3a1('0xc'),_0x1c256f,_0x3a390c[_0xa3a1('0x12')][_0xa3a1('0x13')]);return _0x52fdc5(_0x3a390c[_0xa3a1('0x12')][_0xa3a1('0x13')]);}logger[_0xa3a1('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x1c256f,_0x3a390c['error']['message']);return _0x2cd794(_0x3a390c[_0xa3a1('0x12')][_0xa3a1('0x13')]);}else{logger['info'](_0xa3a1('0xc'),_0x1c256f,'request\x20sent');_0x2cd794(_0x3a390c[_0xa3a1('0x14')][_0xa3a1('0x13')]);}})['catch'](function(_0x2a7321){logger[_0xa3a1('0x12')](_0xa3a1('0xc'),_0x1c256f,_0x2a7321);_0x52fdc5(_0x2a7321);});});}exports[_0xa3a1('0x15')]=function(_0x273f33){var _0x1ce3d4=this;return new Promise(function(_0x56d084,_0x1dcd2a){return db[_0xa3a1('0x16')]['findAll']({'raw':_0x273f33[_0xa3a1('0x17')]?_0x273f33[_0xa3a1('0x17')][_0xa3a1('0x18')]===undefined?!![]:![]:!![],'where':_0x273f33['options']?_0x273f33[_0xa3a1('0x17')][_0xa3a1('0x19')]||null:null,'attributes':_0x273f33[_0xa3a1('0x17')]?_0x273f33[_0xa3a1('0x17')]['attributes']||null:null,'limit':_0x273f33[_0xa3a1('0x17')]?_0x273f33[_0xa3a1('0x17')]['limit']||null:null,'include':_0x273f33[_0xa3a1('0x17')]?_0x273f33['options'][_0xa3a1('0x1a')]?_[_0xa3a1('0x1b')](_0x273f33[_0xa3a1('0x17')]['include'],function(_0x531715){return{'model':db[_0x531715[_0xa3a1('0x1c')]],'as':_0x531715['as'],'attributes':_0x531715['attributes'],'include':_0x531715[_0xa3a1('0x1a')]?_[_0xa3a1('0x1b')](_0x531715[_0xa3a1('0x1a')],function(_0x47a16d){return{'model':db[_0x47a16d[_0xa3a1('0x1c')]],'as':_0x47a16d['as'],'attributes':_0x47a16d[_0xa3a1('0x1d')],'include':_0x47a16d[_0xa3a1('0x1a')]?_[_0xa3a1('0x1b')](_0x47a16d[_0xa3a1('0x1a')],function(_0x6b11c1){return{'model':db[_0x6b11c1['model']],'as':_0x6b11c1['as'],'attributes':_0x6b11c1[_0xa3a1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3a1('0x1e')](function(_0x23f2f2){logger['info'](_0xa3a1('0x15'),_0x273f33);logger[_0xa3a1('0xd')](_0xa3a1('0x15'),_0x273f33,JSON[_0xa3a1('0x10')](_0x23f2f2));_0x56d084(_0x23f2f2);})[_0xa3a1('0x1f')](function(_0xca75dc){logger[_0xa3a1('0x12')]('GetSalesforceAccount',_0xca75dc[_0xa3a1('0x13')],_0x273f33);_0x1dcd2a(_0x1ce3d4[_0xa3a1('0x12')](0x1f4,_0xca75dc[_0xa3a1('0x13')]));});});};exports[_0xa3a1('0x20')]=function(_0x54870e){var _0x5a06a7=this;return new Promise(function(_0x472afc,_0x340a5e){return db[_0xa3a1('0x16')]['find']({'raw':_0x54870e['options']?_0x54870e[_0xa3a1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x54870e[_0xa3a1('0x17')]?_0x54870e[_0xa3a1('0x17')][_0xa3a1('0x19')]||null:null,'attributes':_0x54870e['options']?_0x54870e[_0xa3a1('0x17')][_0xa3a1('0x1d')]||null:null,'include':_0x54870e[_0xa3a1('0x17')]?_0x54870e[_0xa3a1('0x17')]['include']?_[_0xa3a1('0x1b')](_0x54870e[_0xa3a1('0x17')][_0xa3a1('0x1a')],function(_0x207593){return{'model':db[_0x207593[_0xa3a1('0x1c')]],'as':_0x207593['as'],'attributes':_0x207593[_0xa3a1('0x1d')],'include':_0x207593[_0xa3a1('0x1a')]?_['map'](_0x207593[_0xa3a1('0x1a')],function(_0x1d164e){return{'model':db[_0x1d164e[_0xa3a1('0x1c')]],'as':_0x1d164e['as'],'attributes':_0x1d164e['attributes'],'include':_0x1d164e[_0xa3a1('0x1a')]?_[_0xa3a1('0x1b')](_0x1d164e[_0xa3a1('0x1a')],function(_0x5eefde){return{'model':db[_0x5eefde['model']],'as':_0x5eefde['as'],'attributes':_0x5eefde[_0xa3a1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3a1('0x1e')](function(_0x1d2508){logger[_0xa3a1('0x21')](_0xa3a1('0x20'),_0x54870e);logger['debug'](_0xa3a1('0x20'),_0x54870e,JSON['stringify'](_0x1d2508));_0x472afc(_0x1d2508);})[_0xa3a1('0x1f')](function(_0x27bff9){logger['error'](_0xa3a1('0x20'),_0x27bff9[_0xa3a1('0x13')],_0x54870e);_0x340a5e(_0x5a06a7[_0xa3a1('0x12')](0x1f4,_0x27bff9[_0xa3a1('0x13')]));});});}; \ No newline at end of file +var _0xe528=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','attributes','limit','map','model','include','GetSalesforceAccount','stringify','SalesforceAccount','find','where','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41f728,_0x133b16){var _0x29bf27=function(_0x3ae2aa){while(--_0x3ae2aa){_0x41f728['push'](_0x41f728['shift']());}};_0x29bf27(++_0x133b16);}(_0xe528,0x167));var _0x8e52=function(_0x5e02a7,_0x308590){_0x5e02a7=_0x5e02a7-0x0;var _0x34829f=_0xe528[_0x5e02a7];return _0x34829f;};'use strict';var _=require(_0x8e52('0x0'));var util=require(_0x8e52('0x1'));var moment=require(_0x8e52('0x2'));var BPromise=require(_0x8e52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e52('0x4'));var db=require(_0x8e52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e52('0x6'))(_0x8e52('0x7'));var config=require(_0x8e52('0x8'));var jayson=require(_0x8e52('0x9'));var client=jayson[_0x8e52('0xa')][_0x8e52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb3b2c,_0x3b3f89,_0x5af88e){return new BPromise(function(_0x5ad0b4,_0x36ae3f){return client[_0x8e52('0xc')](_0xeb3b2c,_0x5af88e)[_0x8e52('0xd')](function(_0x100ebf){logger[_0x8e52('0xe')](_0x8e52('0xf'),_0x3b3f89,_0x8e52('0x10'));logger[_0x8e52('0x11')](_0x8e52('0x12'),_0x3b3f89,_0x8e52('0x10'),JSON['stringify'](_0x100ebf));if(_0x100ebf[_0x8e52('0x13')]){if(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x14')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3b3f89,_0x100ebf[_0x8e52('0x13')]['message']);return _0x36ae3f(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x15')]);}logger[_0x8e52('0x13')](_0x8e52('0xf'),_0x3b3f89,_0x100ebf['error'][_0x8e52('0x15')]);return _0x5ad0b4(_0x100ebf[_0x8e52('0x13')][_0x8e52('0x15')]);}else{logger[_0x8e52('0xe')](_0x8e52('0xf'),_0x3b3f89,_0x8e52('0x10'));_0x5ad0b4(_0x100ebf['result'][_0x8e52('0x15')]);}})[_0x8e52('0x16')](function(_0x4a3970){logger[_0x8e52('0x13')](_0x8e52('0xf'),_0x3b3f89,_0x4a3970);_0x36ae3f(_0x4a3970);});});}exports['GetSalesforceAccount']=function(_0x1658d6){var _0x1cc984=this;return new Promise(function(_0x3358c0,_0x3f51d7){return db['SalesforceAccount'][_0x8e52('0x17')]({'raw':_0x1658d6['options']?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x19')]===undefined?!![]:![]:!![],'where':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')]['where']||null:null,'attributes':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x1a')]||null:null,'limit':_0x1658d6['options']?_0x1658d6[_0x8e52('0x18')][_0x8e52('0x1b')]||null:null,'include':_0x1658d6[_0x8e52('0x18')]?_0x1658d6[_0x8e52('0x18')]['include']?_[_0x8e52('0x1c')](_0x1658d6[_0x8e52('0x18')]['include'],function(_0xade2b2){return{'model':db[_0xade2b2[_0x8e52('0x1d')]],'as':_0xade2b2['as'],'attributes':_0xade2b2[_0x8e52('0x1a')],'include':_0xade2b2[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0xade2b2[_0x8e52('0x1e')],function(_0x2d1569){return{'model':db[_0x2d1569[_0x8e52('0x1d')]],'as':_0x2d1569['as'],'attributes':_0x2d1569['attributes'],'include':_0x2d1569[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x2d1569[_0x8e52('0x1e')],function(_0x594331){return{'model':db[_0x594331[_0x8e52('0x1d')]],'as':_0x594331['as'],'attributes':_0x594331[_0x8e52('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e52('0xd')](function(_0x29314a){logger[_0x8e52('0xe')](_0x8e52('0x1f'),_0x1658d6);logger[_0x8e52('0x11')]('GetSalesforceAccount',_0x1658d6,JSON[_0x8e52('0x20')](_0x29314a));_0x3358c0(_0x29314a);})['catch'](function(_0x27ce34){logger[_0x8e52('0x13')](_0x8e52('0x1f'),_0x27ce34[_0x8e52('0x15')],_0x1658d6);_0x3f51d7(_0x1cc984[_0x8e52('0x13')](0x1f4,_0x27ce34[_0x8e52('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x5c4b21){var _0x25d6ef=this;return new Promise(function(_0x3b8511,_0x5a8876){return db[_0x8e52('0x21')][_0x8e52('0x22')]({'raw':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x19')]===undefined?!![]:![]:!![],'where':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x23')]||null:null,'attributes':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21[_0x8e52('0x18')][_0x8e52('0x1a')]||null:null,'include':_0x5c4b21[_0x8e52('0x18')]?_0x5c4b21['options']['include']?_[_0x8e52('0x1c')](_0x5c4b21['options'][_0x8e52('0x1e')],function(_0x55b15a){return{'model':db[_0x55b15a[_0x8e52('0x1d')]],'as':_0x55b15a['as'],'attributes':_0x55b15a['attributes'],'include':_0x55b15a[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x55b15a[_0x8e52('0x1e')],function(_0x892258){return{'model':db[_0x892258['model']],'as':_0x892258['as'],'attributes':_0x892258[_0x8e52('0x1a')],'include':_0x892258[_0x8e52('0x1e')]?_[_0x8e52('0x1c')](_0x892258['include'],function(_0x252d98){return{'model':db[_0x252d98[_0x8e52('0x1d')]],'as':_0x252d98['as'],'attributes':_0x252d98[_0x8e52('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e52('0xd')](function(_0x59cc27){logger['info'](_0x8e52('0x24'),_0x5c4b21);logger[_0x8e52('0x11')]('ShowSalesforceAccount',_0x5c4b21,JSON['stringify'](_0x59cc27));_0x3b8511(_0x59cc27);})['catch'](function(_0x42888c){logger['error']('ShowSalesforceAccount',_0x42888c[_0x8e52('0x15')],_0x5c4b21);_0x5a8876(_0x25d6ef[_0x8e52('0x13')](0x1f4,_0x42888c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index bb91f8a..0b1d2cc 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d9410,_0x357cb9){var _0x2e870c=function(_0x27da0d){while(--_0x27da0d){_0x3d9410['push'](_0x3d9410['shift']());}};_0x2e870c(++_0x357cb9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5160c7,_0x130e19){_0x5160c7=_0x5160c7-0x0;var _0x5e044b=_0x5f2f[_0x5160c7];return _0x5e044b;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x31d140,_0x4062bc){var _0x5997a6=function(_0x4be034){while(--_0x4be034){_0x31d140['push'](_0x31d140['shift']());}};_0x5997a6(++_0x4062bc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5234538..166d005 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 _0xa672=['contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','STRING','Task','Case','ENUM'];(function(_0x536910,_0x596641){var _0x22d192=function(_0x1c7297){while(--_0x1c7297){_0x536910['push'](_0x536910['shift']());}};_0x22d192(++_0x596641);}(_0xa672,0x1d4));var _0x2a67=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xa672[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x2a67('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a67('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2a67('0x2'),_0x2a67('0x3')),'defaultValue':_0x2a67('0x2')},'moduleSearch':{'type':Sequelize[_0x2a67('0x4')](_0x2a67('0x5'),_0x2a67('0x6'),_0x2a67('0x7'),_0x2a67('0x8'),_0x2a67('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2a67('0x4')](_0x2a67('0xa'),_0x2a67('0x6'),_0x2a67('0x7'),_0x2a67('0x9')),'defaultValue':_0x2a67('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x2a67('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x2a67('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x2a67('0x1')]}}; \ No newline at end of file +var _0xb5fa=['STRING','ENUM','Task','contact_lead','account','nothing','lead','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb5fa,0x187));var _0xab5f=function(_0x21c139,_0x228818){_0x21c139=_0x21c139-0x0;var _0x3052d8=_0xb5fa[_0x21c139];return _0x3052d8;};'use strict';var Sequelize=require('sequelize');module[_0xab5f('0x0')]={'name':{'type':Sequelize[_0xab5f('0x1')]},'description':{'type':Sequelize[_0xab5f('0x1')]},'ticketType':{'type':Sequelize[_0xab5f('0x2')](_0xab5f('0x3'),'Case'),'defaultValue':_0xab5f('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xab5f('0x4'),'contact','lead','account_contact_lead',_0xab5f('0x5')),'defaultValue':_0xab5f('0x4')},'moduleCreate':{'type':Sequelize[_0xab5f('0x2')](_0xab5f('0x6'),'contact',_0xab5f('0x7'),_0xab5f('0x5')),'defaultValue':_0xab5f('0x7')},'leadId':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xab5f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xab5f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9aefd7f..8a55a4c 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 _0x8a86=['status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','sendStatus','error','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','update','getFields','findOne','nolimit','SalesforceField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8a86,0xd6));var _0x68a8=function(_0x3af19e,_0x25da62){_0x3af19e=_0x3af19e-0x0;var _0xf76558=_0x8a86[_0x3af19e];return _0xf76558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68a8('0x1'));var rp=require(_0x68a8('0x2'));var moment=require(_0x68a8('0x3'));var BPromise=require(_0x68a8('0x4'));var Mustache=require('mustache');var util=require(_0x68a8('0x5'));var path=require(_0x68a8('0x6'));var sox=require(_0x68a8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68a8('0x8'));var _=require(_0x68a8('0x9'));var squel=require(_0x68a8('0xa'));var crypto=require(_0x68a8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x68a8('0xc'));var toCsv=require(_0x68a8('0xd'));var querystring=require(_0x68a8('0xe'));var Papa=require(_0x68a8('0xf'));var Redis=require(_0x68a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x68a8('0x11'));var as=require(_0x68a8('0x12'));var hardwareService=require(_0x68a8('0x13'));var logger=require(_0x68a8('0x14'))(_0x68a8('0x15'));var utils=require(_0x68a8('0x16'));var config=require(_0x68a8('0x17'));var licenseUtil=require(_0x68a8('0x18'));var db=require(_0x68a8('0x19'))['db'];function respondWithStatusCode(_0xf73679,_0x33a592){_0x33a592=_0x33a592||0xcc;return function(_0x5d3532){if(_0x5d3532){return _0xf73679['sendStatus'](_0x33a592);}return _0xf73679[_0x68a8('0x1a')](_0x33a592)[_0x68a8('0x1b')]();};}function respondWithResult(_0x41d7b3,_0x4b932d){_0x4b932d=_0x4b932d||0xc8;return function(_0x171aff){if(_0x171aff){return _0x41d7b3[_0x68a8('0x1a')](_0x4b932d)[_0x68a8('0x1c')](_0x171aff);}};}function respondWithFilteredResult(_0x5a0237,_0x511550){return function(_0xba3c51){if(_0xba3c51){var _0x33253a=typeof _0x511550[_0x68a8('0x1d')]===_0x68a8('0x1e')&&typeof _0x511550['limit']===_0x68a8('0x1e');var _0x3787d3=_0xba3c51['count'];var _0x2fb52b=_0x33253a?0x0:_0x511550[_0x68a8('0x1d')];var _0x53725b=_0x33253a?_0xba3c51[_0x68a8('0x1f')]:_0x511550[_0x68a8('0x1d')]+_0x511550[_0x68a8('0x20')];var _0x5dabde;if(_0x53725b>=_0x3787d3){_0x53725b=_0x3787d3;_0x5dabde=0xc8;}else{_0x5dabde=0xce;}_0x5a0237['status'](_0x5dabde);return _0x5a0237[_0x68a8('0x21')]('Content-Range',_0x2fb52b+'-'+_0x53725b+'/'+_0x3787d3)[_0x68a8('0x1c')](_0xba3c51);}return null;};}function patchUpdates(_0x26477a){return function(_0x144cdc){try{jsonpatch[_0x68a8('0x22')](_0x144cdc,_0x26477a,!![]);}catch(_0x383fa8){return BPromise['reject'](_0x383fa8);}return _0x144cdc[_0x68a8('0x23')]();};}function saveUpdates(_0x1de7a7,_0x31400e){return function(_0x7bb8ec){if(_0x7bb8ec){return _0x7bb8ec['update'](_0x1de7a7)[_0x68a8('0x24')](function(_0x35708e){return _0x35708e;});}return null;};}function removeEntity(_0x2075ad,_0x1daf52){return function(_0x3fb156){if(_0x3fb156){return _0x3fb156[_0x68a8('0x25')]()['then'](function(){_0x2075ad[_0x68a8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5a25,_0x5db189){return function(_0x13ee27){if(!_0x13ee27){_0x2c5a25[_0x68a8('0x26')](0x194);}return _0x13ee27;};}function handleError(_0x19bef1,_0x150dc9){_0x150dc9=_0x150dc9||0x1f4;return function(_0x23ff55){logger[_0x68a8('0x27')](_0x23ff55['stack']);if(_0x23ff55[_0x68a8('0x28')]){delete _0x23ff55[_0x68a8('0x28')];}_0x19bef1[_0x68a8('0x1a')](_0x150dc9)[_0x68a8('0x29')](_0x23ff55);};}exports['index']=function(_0x1e9628,_0xb625e1){var _0x233ed5={},_0x246b0e={},_0x539160={'count':0x0,'rows':[]};var _0x5ba144=_[_0x68a8('0x2a')](db[_0x68a8('0x2b')][_0x68a8('0x2c')],function(_0x3bba92){return{'name':_0x3bba92[_0x68a8('0x2d')],'type':_0x3bba92[_0x68a8('0x2e')][_0x68a8('0x2f')]};});_0x246b0e[_0x68a8('0x30')]=_[_0x68a8('0x2a')](_0x5ba144,_0x68a8('0x28'));_0x246b0e[_0x68a8('0x31')]=_['keys'](_0x1e9628[_0x68a8('0x31')]);_0x246b0e[_0x68a8('0x32')]=_[_0x68a8('0x33')](_0x246b0e['model'],_0x246b0e[_0x68a8('0x31')]);_0x233ed5['attributes']=_['intersection'](_0x246b0e['model'],qs[_0x68a8('0x34')](_0x1e9628[_0x68a8('0x31')]['fields']));_0x233ed5['attributes']=_0x233ed5[_0x68a8('0x35')][_0x68a8('0x36')]?_0x233ed5['attributes']:_0x246b0e[_0x68a8('0x30')];if(!_0x1e9628['query'][_0x68a8('0x37')]('nolimit')){_0x233ed5[_0x68a8('0x20')]=qs['limit'](_0x1e9628[_0x68a8('0x31')][_0x68a8('0x20')]);_0x233ed5[_0x68a8('0x1d')]=qs['offset'](_0x1e9628['query'][_0x68a8('0x1d')]);}_0x233ed5[_0x68a8('0x38')]=qs[_0x68a8('0x39')](_0x1e9628[_0x68a8('0x31')][_0x68a8('0x39')]);_0x233ed5[_0x68a8('0x3a')]=qs[_0x68a8('0x32')](_[_0x68a8('0x3b')](_0x1e9628[_0x68a8('0x31')],_0x246b0e[_0x68a8('0x32')]),_0x5ba144);if(_0x1e9628[_0x68a8('0x31')][_0x68a8('0x3c')]){_0x233ed5[_0x68a8('0x3a')]=_[_0x68a8('0x3d')](_0x233ed5[_0x68a8('0x3a')],{'$or':_[_0x68a8('0x2a')](_0x5ba144,function(_0x26c571){if(_0x26c571[_0x68a8('0x2e')]!==_0x68a8('0x3e')){var _0xbc9d9b={};_0xbc9d9b[_0x26c571[_0x68a8('0x28')]]={'$like':'%'+_0x1e9628[_0x68a8('0x31')][_0x68a8('0x3c')]+'%'};return _0xbc9d9b;}})});}_0x233ed5=_[_0x68a8('0x3d')]({},_0x233ed5,_0x1e9628[_0x68a8('0x3f')]);var _0x502731={'where':_0x233ed5[_0x68a8('0x3a')]};return db['SalesforceConfiguration'][_0x68a8('0x1f')](_0x502731)[_0x68a8('0x24')](function(_0x24e279){_0x539160['count']=_0x24e279;if(_0x1e9628[_0x68a8('0x31')][_0x68a8('0x40')]){_0x233ed5[_0x68a8('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x68a8('0x42')](_0x233ed5);})['then'](function(_0x54c101){_0x539160['rows']=_0x54c101;return _0x539160;})[_0x68a8('0x24')](respondWithFilteredResult(_0xb625e1,_0x233ed5))[_0x68a8('0x43')](handleError(_0xb625e1,null));};exports['show']=function(_0x3e3ee3,_0x4cc304){var _0x17a708={'raw':![],'where':{'id':_0x3e3ee3[_0x68a8('0x44')]['id']}},_0x3d8f75={};_0x3d8f75[_0x68a8('0x30')]=_[_0x68a8('0x45')](db[_0x68a8('0x2b')][_0x68a8('0x2c')]);_0x3d8f75[_0x68a8('0x31')]=_[_0x68a8('0x45')](_0x3e3ee3['query']);_0x3d8f75[_0x68a8('0x32')]=_['intersection'](_0x3d8f75['model'],_0x3d8f75[_0x68a8('0x31')]);_0x17a708['attributes']=_['intersection'](_0x3d8f75[_0x68a8('0x30')],qs[_0x68a8('0x34')](_0x3e3ee3[_0x68a8('0x31')]['fields']));_0x17a708[_0x68a8('0x35')]=_0x17a708[_0x68a8('0x35')]['length']?_0x17a708['attributes']:_0x3d8f75[_0x68a8('0x30')];if(_0x3e3ee3[_0x68a8('0x31')][_0x68a8('0x40')]){_0x17a708[_0x68a8('0x41')]=[{'all':!![]}];}_0x17a708=_[_0x68a8('0x3d')]({},_0x17a708,_0x3e3ee3['options']);return db[_0x68a8('0x2b')][_0x68a8('0x46')](_0x17a708)[_0x68a8('0x24')](handleEntityNotFound(_0x4cc304,null))['then'](respondWithResult(_0x4cc304,null))['catch'](handleError(_0x4cc304,null));};exports[_0x68a8('0x47')]=function(_0x2cd2ff,_0x3e724e){return db[_0x68a8('0x2b')][_0x68a8('0x47')](_0x2cd2ff[_0x68a8('0x48')],{})[_0x68a8('0x24')](respondWithResult(_0x3e724e,0xc9))[_0x68a8('0x43')](handleError(_0x3e724e,null));};exports[_0x68a8('0x49')]=function(_0x5c20a2,_0x449d05){if(_0x5c20a2['body']['id']){delete _0x5c20a2['body']['id'];}return db[_0x68a8('0x2b')][_0x68a8('0x46')]({'where':{'id':_0x5c20a2[_0x68a8('0x44')]['id']}})[_0x68a8('0x24')](handleEntityNotFound(_0x449d05,null))['then'](saveUpdates(_0x5c20a2[_0x68a8('0x48')],null))[_0x68a8('0x24')](respondWithResult(_0x449d05,null))[_0x68a8('0x43')](handleError(_0x449d05,null));};exports[_0x68a8('0x25')]=function(_0x245120,_0x8aabbb){return db[_0x68a8('0x2b')][_0x68a8('0x46')]({'where':{'id':_0x245120['params']['id']}})['then'](handleEntityNotFound(_0x8aabbb,null))[_0x68a8('0x24')](removeEntity(_0x8aabbb,null))[_0x68a8('0x43')](handleError(_0x8aabbb,null));};exports[_0x68a8('0x4a')]=function(_0x2387b4,_0x1af8af,_0x3dde53){var _0xfe7a6f={};var _0x328d82={};var _0x592a5e;var _0x510969;return db[_0x68a8('0x2b')][_0x68a8('0x4b')]({'where':{'id':_0x2387b4[_0x68a8('0x44')]['id']}})[_0x68a8('0x24')](handleEntityNotFound(_0x1af8af,null))[_0x68a8('0x24')](function(_0x12561d){if(_0x12561d){_0x592a5e=_0x12561d;_0x328d82[_0x68a8('0x30')]=_[_0x68a8('0x45')](db['SalesforceField'][_0x68a8('0x2c')]);_0x328d82[_0x68a8('0x31')]=_[_0x68a8('0x45')](_0x2387b4[_0x68a8('0x31')]);_0x328d82[_0x68a8('0x32')]=_[_0x68a8('0x33')](_0x328d82[_0x68a8('0x30')],_0x328d82[_0x68a8('0x31')]);_0xfe7a6f['attributes']=_['intersection'](_0x328d82[_0x68a8('0x30')],qs['fields'](_0x2387b4[_0x68a8('0x31')]['fields']));_0xfe7a6f['attributes']=_0xfe7a6f[_0x68a8('0x35')][_0x68a8('0x36')]?_0xfe7a6f[_0x68a8('0x35')]:_0x328d82[_0x68a8('0x30')];_0xfe7a6f[_0x68a8('0x38')]=qs[_0x68a8('0x39')](_0x2387b4[_0x68a8('0x31')]['sort']);_0xfe7a6f[_0x68a8('0x3a')]=qs[_0x68a8('0x32')](_['pick'](_0x2387b4[_0x68a8('0x31')],_0x328d82['filters']));if(_0x2387b4[_0x68a8('0x31')]['filter']){_0xfe7a6f[_0x68a8('0x3a')]=_[_0x68a8('0x3d')](_0xfe7a6f['where'],{'$or':_[_0x68a8('0x2a')](_0xfe7a6f[_0x68a8('0x35')],function(_0x21f660){var _0x14f50b={};_0x14f50b[_0x21f660]={'$like':'%'+_0x2387b4['query'][_0x68a8('0x3c')]+'%'};return _0x14f50b;})});}_0xfe7a6f=_[_0x68a8('0x3d')]({},_0xfe7a6f,_0x2387b4[_0x68a8('0x3f')]);return _0x592a5e[_0x68a8('0x4a')](_0xfe7a6f);}})[_0x68a8('0x24')](function(_0x3f78bb){if(_0x3f78bb){_0x510969=_0x3f78bb[_0x68a8('0x36')];if(!_0x2387b4[_0x68a8('0x31')][_0x68a8('0x37')](_0x68a8('0x4c'))){_0xfe7a6f[_0x68a8('0x20')]=qs[_0x68a8('0x20')](_0x2387b4[_0x68a8('0x31')][_0x68a8('0x20')]);_0xfe7a6f[_0x68a8('0x1d')]=qs['offset'](_0x2387b4['query'][_0x68a8('0x1d')]);}return _0x592a5e[_0x68a8('0x4a')](_0xfe7a6f);}})[_0x68a8('0x24')](function(_0x519230){if(_0x519230){return _0x519230?{'count':_0x510969,'rows':_0x519230}:null;}})['then'](respondWithResult(_0x1af8af,null))[_0x68a8('0x43')](handleError(_0x1af8af,null));};exports['getSubjects']=function(_0x4d8e25,_0x2ecf14,_0x5c1b15){var _0x3c87ac={};var _0x221474={};var _0x57d714;var _0x8f0268;return db[_0x68a8('0x2b')][_0x68a8('0x4b')]({'where':{'id':_0x4d8e25[_0x68a8('0x44')]['id']}})[_0x68a8('0x24')](handleEntityNotFound(_0x2ecf14,null))['then'](function(_0x2ed976){if(_0x2ed976){_0x57d714=_0x2ed976;_0x221474[_0x68a8('0x30')]=_[_0x68a8('0x45')](db[_0x68a8('0x4d')][_0x68a8('0x2c')]);_0x221474[_0x68a8('0x31')]=_[_0x68a8('0x45')](_0x4d8e25[_0x68a8('0x31')]);_0x221474[_0x68a8('0x32')]=_[_0x68a8('0x33')](_0x221474[_0x68a8('0x30')],_0x221474[_0x68a8('0x31')]);_0x3c87ac['attributes']=_[_0x68a8('0x33')](_0x221474[_0x68a8('0x30')],qs[_0x68a8('0x34')](_0x4d8e25[_0x68a8('0x31')]['fields']));_0x3c87ac[_0x68a8('0x35')]=_0x3c87ac['attributes'][_0x68a8('0x36')]?_0x3c87ac['attributes']:_0x221474[_0x68a8('0x30')];_0x3c87ac[_0x68a8('0x38')]=qs[_0x68a8('0x39')](_0x4d8e25['query'][_0x68a8('0x39')]);_0x3c87ac[_0x68a8('0x3a')]=qs['filters'](_[_0x68a8('0x3b')](_0x4d8e25[_0x68a8('0x31')],_0x221474[_0x68a8('0x32')]));if(_0x4d8e25[_0x68a8('0x31')][_0x68a8('0x3c')]){_0x3c87ac[_0x68a8('0x3a')]=_[_0x68a8('0x3d')](_0x3c87ac[_0x68a8('0x3a')],{'$or':_[_0x68a8('0x2a')](_0x3c87ac['attributes'],function(_0x5d449a){var _0x22b43b={};_0x22b43b[_0x5d449a]={'$like':'%'+_0x4d8e25[_0x68a8('0x31')][_0x68a8('0x3c')]+'%'};return _0x22b43b;})});}_0x3c87ac=_[_0x68a8('0x3d')]({},_0x3c87ac,_0x4d8e25[_0x68a8('0x3f')]);return _0x57d714[_0x68a8('0x4e')](_0x3c87ac);}})['then'](function(_0x459b59){if(_0x459b59){_0x8f0268=_0x459b59[_0x68a8('0x36')];if(!_0x4d8e25[_0x68a8('0x31')][_0x68a8('0x37')](_0x68a8('0x4c'))){_0x3c87ac[_0x68a8('0x20')]=qs[_0x68a8('0x20')](_0x4d8e25['query'][_0x68a8('0x20')]);_0x3c87ac[_0x68a8('0x1d')]=qs[_0x68a8('0x1d')](_0x4d8e25[_0x68a8('0x31')][_0x68a8('0x1d')]);}return _0x57d714[_0x68a8('0x4e')](_0x3c87ac);}})['then'](function(_0x28e5a7){if(_0x28e5a7){return _0x28e5a7?{'count':_0x8f0268,'rows':_0x28e5a7}:null;}})[_0x68a8('0x24')](respondWithResult(_0x2ecf14,null))[_0x68a8('0x43')](handleError(_0x2ecf14,null));};exports[_0x68a8('0x4f')]=function(_0x1ce853,_0x4905ed,_0x212b0b){var _0x23b576={};var _0x269381={};var _0x35b0d6;var _0x67cd11;return db[_0x68a8('0x2b')][_0x68a8('0x4b')]({'where':{'id':_0x1ce853[_0x68a8('0x44')]['id']}})[_0x68a8('0x24')](handleEntityNotFound(_0x4905ed,null))['then'](function(_0x59064c){if(_0x59064c){_0x35b0d6=_0x59064c;_0x269381[_0x68a8('0x30')]=_[_0x68a8('0x45')](db[_0x68a8('0x4d')][_0x68a8('0x2c')]);_0x269381[_0x68a8('0x31')]=_[_0x68a8('0x45')](_0x1ce853[_0x68a8('0x31')]);_0x269381[_0x68a8('0x32')]=_[_0x68a8('0x33')](_0x269381[_0x68a8('0x30')],_0x269381[_0x68a8('0x31')]);_0x23b576[_0x68a8('0x35')]=_[_0x68a8('0x33')](_0x269381['model'],qs['fields'](_0x1ce853[_0x68a8('0x31')][_0x68a8('0x34')]));_0x23b576['attributes']=_0x23b576[_0x68a8('0x35')][_0x68a8('0x36')]?_0x23b576['attributes']:_0x269381[_0x68a8('0x30')];_0x23b576[_0x68a8('0x38')]=qs['sort'](_0x1ce853['query'][_0x68a8('0x39')]);_0x23b576[_0x68a8('0x3a')]=qs[_0x68a8('0x32')](_['pick'](_0x1ce853[_0x68a8('0x31')],_0x269381[_0x68a8('0x32')]));if(_0x1ce853['query']['filter']){_0x23b576['where']=_[_0x68a8('0x3d')](_0x23b576['where'],{'$or':_[_0x68a8('0x2a')](_0x23b576['attributes'],function(_0x44d082){var _0x42fb36={};_0x42fb36[_0x44d082]={'$like':'%'+_0x1ce853['query'][_0x68a8('0x3c')]+'%'};return _0x42fb36;})});}_0x23b576=_['merge']({},_0x23b576,_0x1ce853['options']);return _0x35b0d6['getDescriptions'](_0x23b576);}})[_0x68a8('0x24')](function(_0x3b2ac8){if(_0x3b2ac8){_0x67cd11=_0x3b2ac8[_0x68a8('0x36')];if(!_0x1ce853[_0x68a8('0x31')][_0x68a8('0x37')](_0x68a8('0x4c'))){_0x23b576[_0x68a8('0x20')]=qs[_0x68a8('0x20')](_0x1ce853[_0x68a8('0x31')][_0x68a8('0x20')]);_0x23b576[_0x68a8('0x1d')]=qs[_0x68a8('0x1d')](_0x1ce853['query'][_0x68a8('0x1d')]);}return _0x35b0d6[_0x68a8('0x4f')](_0x23b576);}})[_0x68a8('0x24')](function(_0x12e00f){if(_0x12e00f){return _0x12e00f?{'count':_0x67cd11,'rows':_0x12e00f}:null;}})[_0x68a8('0x24')](respondWithResult(_0x4905ed,null))['catch'](handleError(_0x4905ed,null));}; \ No newline at end of file +var _0x661c=['offset','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','catch','show','params','fields','length','include','find','create','body','getFields','findOne','order','getSubjects','SalesforceField','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','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','undefined'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0x661c,0x122));var _0xc661=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x661c[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0xc661('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc661('0x1'));var rp=require('request-promise');var moment=require(_0xc661('0x2'));var BPromise=require(_0xc661('0x3'));var Mustache=require(_0xc661('0x4'));var util=require(_0xc661('0x5'));var path=require(_0xc661('0x6'));var sox=require(_0xc661('0x7'));var csv=require(_0xc661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc661('0x9'));var squel=require('squel');var crypto=require(_0xc661('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc661('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc661('0xc'));var Papa=require(_0xc661('0xd'));var Redis=require(_0xc661('0xe'));var authService=require(_0xc661('0xf'));var qs=require(_0xc661('0x10'));var as=require(_0xc661('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc661('0x12'))('api');var utils=require(_0xc661('0x13'));var config=require(_0xc661('0x14'));var licenseUtil=require(_0xc661('0x15'));var db=require(_0xc661('0x16'))['db'];function respondWithStatusCode(_0x5be601,_0x2a8860){_0x2a8860=_0x2a8860||0xcc;return function(_0x405477){if(_0x405477){return _0x5be601[_0xc661('0x17')](_0x2a8860);}return _0x5be601[_0xc661('0x18')](_0x2a8860)['end']();};}function respondWithResult(_0x803f14,_0x365eb9){_0x365eb9=_0x365eb9||0xc8;return function(_0x52905b){if(_0x52905b){return _0x803f14[_0xc661('0x18')](_0x365eb9)['json'](_0x52905b);}};}function respondWithFilteredResult(_0x541e64,_0x2478c8){return function(_0x2223ff){if(_0x2223ff){var _0x5565f1=typeof _0x2478c8['offset']===_0xc661('0x19')&&typeof _0x2478c8['limit']==='undefined';var _0x437eae=_0x2223ff['count'];var _0x390807=_0x5565f1?0x0:_0x2478c8[_0xc661('0x1a')];var _0xab6225=_0x5565f1?_0x2223ff[_0xc661('0x1b')]:_0x2478c8[_0xc661('0x1a')]+_0x2478c8[_0xc661('0x1c')];var _0x482913;if(_0xab6225>=_0x437eae){_0xab6225=_0x437eae;_0x482913=0xc8;}else{_0x482913=0xce;}_0x541e64[_0xc661('0x18')](_0x482913);return _0x541e64['set'](_0xc661('0x1d'),_0x390807+'-'+_0xab6225+'/'+_0x437eae)[_0xc661('0x1e')](_0x2223ff);}return null;};}function patchUpdates(_0x55e7b7){return function(_0xfc05d7){try{jsonpatch[_0xc661('0x1f')](_0xfc05d7,_0x55e7b7,!![]);}catch(_0x230528){return BPromise[_0xc661('0x20')](_0x230528);}return _0xfc05d7[_0xc661('0x21')]();};}function saveUpdates(_0x1a6d38,_0x1128fe){return function(_0x34c707){if(_0x34c707){return _0x34c707[_0xc661('0x22')](_0x1a6d38)[_0xc661('0x23')](function(_0x36c643){return _0x36c643;});}return null;};}function removeEntity(_0x3e7ca0,_0x3e8339){return function(_0x4c2ecf){if(_0x4c2ecf){return _0x4c2ecf[_0xc661('0x24')]()[_0xc661('0x23')](function(){_0x3e7ca0['status'](0xcc)[_0xc661('0x25')]();});}};}function handleEntityNotFound(_0x3eb48d,_0x1b218e){return function(_0x40f4cd){if(!_0x40f4cd){_0x3eb48d[_0xc661('0x17')](0x194);}return _0x40f4cd;};}function handleError(_0x245e42,_0x564bce){_0x564bce=_0x564bce||0x1f4;return function(_0x395491){logger['error'](_0x395491[_0xc661('0x26')]);if(_0x395491[_0xc661('0x27')]){delete _0x395491['name'];}_0x245e42['status'](_0x564bce)[_0xc661('0x28')](_0x395491);};}exports[_0xc661('0x29')]=function(_0x116db6,_0x5037d6){var _0x57d4a1={},_0x2d5ab2={},_0x306093={'count':0x0,'rows':[]};var _0x2c05a9=_[_0xc661('0x2a')](db[_0xc661('0x2b')][_0xc661('0x2c')],function(_0x4e4d49){return{'name':_0x4e4d49[_0xc661('0x2d')],'type':_0x4e4d49['type'][_0xc661('0x2e')]};});_0x2d5ab2['model']=_[_0xc661('0x2a')](_0x2c05a9,_0xc661('0x27'));_0x2d5ab2[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x116db6[_0xc661('0x2f')]);_0x2d5ab2[_0xc661('0x31')]=_[_0xc661('0x32')](_0x2d5ab2[_0xc661('0x33')],_0x2d5ab2[_0xc661('0x2f')]);_0x57d4a1[_0xc661('0x34')]=_['intersection'](_0x2d5ab2[_0xc661('0x33')],qs['fields'](_0x116db6['query']['fields']));_0x57d4a1[_0xc661('0x34')]=_0x57d4a1[_0xc661('0x34')]['length']?_0x57d4a1['attributes']:_0x2d5ab2[_0xc661('0x33')];if(!_0x116db6[_0xc661('0x2f')][_0xc661('0x35')](_0xc661('0x36'))){_0x57d4a1[_0xc661('0x1c')]=qs[_0xc661('0x1c')](_0x116db6['query']['limit']);_0x57d4a1['offset']=qs[_0xc661('0x1a')](_0x116db6[_0xc661('0x2f')][_0xc661('0x1a')]);}_0x57d4a1['order']=qs[_0xc661('0x37')](_0x116db6[_0xc661('0x2f')][_0xc661('0x37')]);_0x57d4a1['where']=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x116db6['query'],_0x2d5ab2[_0xc661('0x31')]),_0x2c05a9);if(_0x116db6[_0xc661('0x2f')][_0xc661('0x39')]){_0x57d4a1[_0xc661('0x3a')]=_['merge'](_0x57d4a1[_0xc661('0x3a')],{'$or':_['map'](_0x2c05a9,function(_0x8ce015){if(_0x8ce015[_0xc661('0x3b')]!==_0xc661('0x3c')){var _0x44ed2d={};_0x44ed2d[_0x8ce015[_0xc661('0x27')]]={'$like':'%'+_0x116db6[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x44ed2d;}})});}_0x57d4a1=_[_0xc661('0x3d')]({},_0x57d4a1,_0x116db6[_0xc661('0x3e')]);var _0x2f470d={'where':_0x57d4a1[_0xc661('0x3a')]};return db['SalesforceConfiguration'][_0xc661('0x1b')](_0x2f470d)[_0xc661('0x23')](function(_0x1c0708){_0x306093[_0xc661('0x1b')]=_0x1c0708;if(_0x116db6[_0xc661('0x2f')][_0xc661('0x3f')]){_0x57d4a1['include']=[{'all':!![]}];}return db[_0xc661('0x2b')]['findAll'](_0x57d4a1);})['then'](function(_0x27eb6c){_0x306093['rows']=_0x27eb6c;return _0x306093;})[_0xc661('0x23')](respondWithFilteredResult(_0x5037d6,_0x57d4a1))[_0xc661('0x40')](handleError(_0x5037d6,null));};exports[_0xc661('0x41')]=function(_0x90c62a,_0x1e5ec1){var _0x2f442d={'raw':![],'where':{'id':_0x90c62a[_0xc661('0x42')]['id']}},_0x11b53d={};_0x11b53d[_0xc661('0x33')]=_[_0xc661('0x30')](db[_0xc661('0x2b')][_0xc661('0x2c')]);_0x11b53d[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x90c62a[_0xc661('0x2f')]);_0x11b53d[_0xc661('0x31')]=_[_0xc661('0x32')](_0x11b53d['model'],_0x11b53d['query']);_0x2f442d[_0xc661('0x34')]=_[_0xc661('0x32')](_0x11b53d['model'],qs['fields'](_0x90c62a[_0xc661('0x2f')][_0xc661('0x43')]));_0x2f442d[_0xc661('0x34')]=_0x2f442d['attributes'][_0xc661('0x44')]?_0x2f442d[_0xc661('0x34')]:_0x11b53d[_0xc661('0x33')];if(_0x90c62a[_0xc661('0x2f')]['includeAll']){_0x2f442d[_0xc661('0x45')]=[{'all':!![]}];}_0x2f442d=_[_0xc661('0x3d')]({},_0x2f442d,_0x90c62a[_0xc661('0x3e')]);return db[_0xc661('0x2b')][_0xc661('0x46')](_0x2f442d)[_0xc661('0x23')](handleEntityNotFound(_0x1e5ec1,null))[_0xc661('0x23')](respondWithResult(_0x1e5ec1,null))['catch'](handleError(_0x1e5ec1,null));};exports['create']=function(_0x1a52b9,_0x3c500d){return db[_0xc661('0x2b')][_0xc661('0x47')](_0x1a52b9['body'],{})[_0xc661('0x23')](respondWithResult(_0x3c500d,0xc9))[_0xc661('0x40')](handleError(_0x3c500d,null));};exports['update']=function(_0x9f18a9,_0x1c3758){if(_0x9f18a9['body']['id']){delete _0x9f18a9['body']['id'];}return db[_0xc661('0x2b')][_0xc661('0x46')]({'where':{'id':_0x9f18a9[_0xc661('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c3758,null))['then'](saveUpdates(_0x9f18a9[_0xc661('0x48')],null))[_0xc661('0x23')](respondWithResult(_0x1c3758,null))[_0xc661('0x40')](handleError(_0x1c3758,null));};exports['destroy']=function(_0x34fe31,_0xdfa8fb){return db[_0xc661('0x2b')][_0xc661('0x46')]({'where':{'id':_0x34fe31[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0xdfa8fb,null))['then'](removeEntity(_0xdfa8fb,null))['catch'](handleError(_0xdfa8fb,null));};exports[_0xc661('0x49')]=function(_0xb2aa6c,_0x34933c,_0x173d0e){var _0x50e848={};var _0x7dfbf5={};var _0x5a2572;var _0x4be7fd;return db[_0xc661('0x2b')][_0xc661('0x4a')]({'where':{'id':_0xb2aa6c[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0x34933c,null))['then'](function(_0x1e8d75){if(_0x1e8d75){_0x5a2572=_0x1e8d75;_0x7dfbf5[_0xc661('0x33')]=_[_0xc661('0x30')](db['SalesforceField'][_0xc661('0x2c')]);_0x7dfbf5[_0xc661('0x2f')]=_[_0xc661('0x30')](_0xb2aa6c['query']);_0x7dfbf5[_0xc661('0x31')]=_[_0xc661('0x32')](_0x7dfbf5[_0xc661('0x33')],_0x7dfbf5[_0xc661('0x2f')]);_0x50e848[_0xc661('0x34')]=_[_0xc661('0x32')](_0x7dfbf5[_0xc661('0x33')],qs[_0xc661('0x43')](_0xb2aa6c['query'][_0xc661('0x43')]));_0x50e848['attributes']=_0x50e848[_0xc661('0x34')][_0xc661('0x44')]?_0x50e848[_0xc661('0x34')]:_0x7dfbf5['model'];_0x50e848[_0xc661('0x4b')]=qs['sort'](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x37')]);_0x50e848[_0xc661('0x3a')]=qs[_0xc661('0x31')](_['pick'](_0xb2aa6c['query'],_0x7dfbf5[_0xc661('0x31')]));if(_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x39')]){_0x50e848[_0xc661('0x3a')]=_[_0xc661('0x3d')](_0x50e848[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x50e848[_0xc661('0x34')],function(_0x35a9a0){var _0x57ad49={};_0x57ad49[_0x35a9a0]={'$like':'%'+_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x57ad49;})});}_0x50e848=_[_0xc661('0x3d')]({},_0x50e848,_0xb2aa6c[_0xc661('0x3e')]);return _0x5a2572['getFields'](_0x50e848);}})['then'](function(_0x4b27eb){if(_0x4b27eb){_0x4be7fd=_0x4b27eb['length'];if(!_0xb2aa6c['query'][_0xc661('0x35')](_0xc661('0x36'))){_0x50e848[_0xc661('0x1c')]=qs[_0xc661('0x1c')](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x1c')]);_0x50e848[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0xb2aa6c[_0xc661('0x2f')][_0xc661('0x1a')]);}return _0x5a2572[_0xc661('0x49')](_0x50e848);}})[_0xc661('0x23')](function(_0x572293){if(_0x572293){return _0x572293?{'count':_0x4be7fd,'rows':_0x572293}:null;}})[_0xc661('0x23')](respondWithResult(_0x34933c,null))[_0xc661('0x40')](handleError(_0x34933c,null));};exports[_0xc661('0x4c')]=function(_0x25c97b,_0x417816,_0x3e105c){var _0x572b92={};var _0x5ca8c2={};var _0x1b2eaa;var _0x2f39ab;return db['SalesforceConfiguration'][_0xc661('0x4a')]({'where':{'id':_0x25c97b[_0xc661('0x42')]['id']}})[_0xc661('0x23')](handleEntityNotFound(_0x417816,null))['then'](function(_0x3166b1){if(_0x3166b1){_0x1b2eaa=_0x3166b1;_0x5ca8c2['model']=_['keys'](db[_0xc661('0x4d')][_0xc661('0x2c')]);_0x5ca8c2[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x25c97b[_0xc661('0x2f')]);_0x5ca8c2['filters']=_[_0xc661('0x32')](_0x5ca8c2[_0xc661('0x33')],_0x5ca8c2[_0xc661('0x2f')]);_0x572b92['attributes']=_[_0xc661('0x32')](_0x5ca8c2[_0xc661('0x33')],qs[_0xc661('0x43')](_0x25c97b[_0xc661('0x2f')][_0xc661('0x43')]));_0x572b92[_0xc661('0x34')]=_0x572b92[_0xc661('0x34')][_0xc661('0x44')]?_0x572b92[_0xc661('0x34')]:_0x5ca8c2['model'];_0x572b92[_0xc661('0x4b')]=qs[_0xc661('0x37')](_0x25c97b['query'][_0xc661('0x37')]);_0x572b92[_0xc661('0x3a')]=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x25c97b[_0xc661('0x2f')],_0x5ca8c2[_0xc661('0x31')]));if(_0x25c97b['query'][_0xc661('0x39')]){_0x572b92[_0xc661('0x3a')]=_['merge'](_0x572b92[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x572b92[_0xc661('0x34')],function(_0x5e8617){var _0x2d4a51={};_0x2d4a51[_0x5e8617]={'$like':'%'+_0x25c97b['query'][_0xc661('0x39')]+'%'};return _0x2d4a51;})});}_0x572b92=_[_0xc661('0x3d')]({},_0x572b92,_0x25c97b[_0xc661('0x3e')]);return _0x1b2eaa[_0xc661('0x4c')](_0x572b92);}})[_0xc661('0x23')](function(_0x20557b){if(_0x20557b){_0x2f39ab=_0x20557b[_0xc661('0x44')];if(!_0x25c97b[_0xc661('0x2f')][_0xc661('0x35')](_0xc661('0x36'))){_0x572b92['limit']=qs[_0xc661('0x1c')](_0x25c97b[_0xc661('0x2f')]['limit']);_0x572b92[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0x25c97b[_0xc661('0x2f')][_0xc661('0x1a')]);}return _0x1b2eaa[_0xc661('0x4c')](_0x572b92);}})[_0xc661('0x23')](function(_0xd831e9){if(_0xd831e9){return _0xd831e9?{'count':_0x2f39ab,'rows':_0xd831e9}:null;}})[_0xc661('0x23')](respondWithResult(_0x417816,null))[_0xc661('0x40')](handleError(_0x417816,null));};exports['getDescriptions']=function(_0x556a64,_0x10dd23,_0x26cbb4){var _0x518d21={};var _0x3efbdc={};var _0x3e28fc;var _0x1a1b24;return db[_0xc661('0x2b')][_0xc661('0x4a')]({'where':{'id':_0x556a64[_0xc661('0x42')]['id']}})['then'](handleEntityNotFound(_0x10dd23,null))[_0xc661('0x23')](function(_0xc4e3e9){if(_0xc4e3e9){_0x3e28fc=_0xc4e3e9;_0x3efbdc[_0xc661('0x33')]=_['keys'](db[_0xc661('0x4d')][_0xc661('0x2c')]);_0x3efbdc[_0xc661('0x2f')]=_[_0xc661('0x30')](_0x556a64['query']);_0x3efbdc[_0xc661('0x31')]=_[_0xc661('0x32')](_0x3efbdc[_0xc661('0x33')],_0x3efbdc[_0xc661('0x2f')]);_0x518d21[_0xc661('0x34')]=_['intersection'](_0x3efbdc['model'],qs['fields'](_0x556a64[_0xc661('0x2f')][_0xc661('0x43')]));_0x518d21[_0xc661('0x34')]=_0x518d21[_0xc661('0x34')][_0xc661('0x44')]?_0x518d21[_0xc661('0x34')]:_0x3efbdc[_0xc661('0x33')];_0x518d21[_0xc661('0x4b')]=qs[_0xc661('0x37')](_0x556a64['query'][_0xc661('0x37')]);_0x518d21[_0xc661('0x3a')]=qs[_0xc661('0x31')](_[_0xc661('0x38')](_0x556a64[_0xc661('0x2f')],_0x3efbdc[_0xc661('0x31')]));if(_0x556a64['query'][_0xc661('0x39')]){_0x518d21[_0xc661('0x3a')]=_[_0xc661('0x3d')](_0x518d21[_0xc661('0x3a')],{'$or':_[_0xc661('0x2a')](_0x518d21[_0xc661('0x34')],function(_0x123461){var _0x2446c0={};_0x2446c0[_0x123461]={'$like':'%'+_0x556a64[_0xc661('0x2f')][_0xc661('0x39')]+'%'};return _0x2446c0;})});}_0x518d21=_[_0xc661('0x3d')]({},_0x518d21,_0x556a64['options']);return _0x3e28fc[_0xc661('0x4e')](_0x518d21);}})[_0xc661('0x23')](function(_0x4e1bda){if(_0x4e1bda){_0x1a1b24=_0x4e1bda[_0xc661('0x44')];if(!_0x556a64[_0xc661('0x2f')]['hasOwnProperty'](_0xc661('0x36'))){_0x518d21['limit']=qs[_0xc661('0x1c')](_0x556a64[_0xc661('0x2f')]['limit']);_0x518d21[_0xc661('0x1a')]=qs[_0xc661('0x1a')](_0x556a64[_0xc661('0x2f')]['offset']);}return _0x3e28fc[_0xc661('0x4e')](_0x518d21);}})[_0xc661('0x23')](function(_0x567489){if(_0x567489){return _0x567489?{'count':_0x1a1b24,'rows':_0x567489}:null;}})[_0xc661('0x23')](respondWithResult(_0x10dd23,null))[_0xc661('0x40')](handleError(_0x10dd23,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f8526c3..01ef96a 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 _0xf54d=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x39b393,_0x41d9c2){var _0x365af5=function(_0x43599d){while(--_0x43599d){_0x39b393['push'](_0x39b393['shift']());}};_0x365af5(++_0x41d9c2);}(_0xf54d,0xa3));var _0xdf54=function(_0x5b9115,_0x24a221){_0x5b9115=_0x5b9115-0x0;var _0x141251=_0xf54d[_0x5b9115];return _0x141251;};'use strict';var _=require(_0xdf54('0x0'));var util=require(_0xdf54('0x1'));var logger=require('../../config/logger')(_0xdf54('0x2'));var moment=require(_0xdf54('0x3'));var BPromise=require(_0xdf54('0x4'));var rp=require(_0xdf54('0x5'));var fs=require('fs');var path=require(_0xdf54('0x6'));var rimraf=require(_0xdf54('0x7'));var config=require(_0xdf54('0x8'));var attributes=require(_0xdf54('0x9'));module['exports']=function(_0x144b1b,_0x381fcb){return _0x144b1b[_0xdf54('0xa')](_0xdf54('0xb'),attributes,{'tableName':_0xdf54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d26=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d26,0x90));var _0x69d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x69d2('0x0'));var logger=require(_0x69d2('0x1'))(_0x69d2('0x2'));var moment=require(_0x69d2('0x3'));var BPromise=require(_0x69d2('0x4'));var rp=require(_0x69d2('0x5'));var fs=require('fs');var path=require(_0x69d2('0x6'));var rimraf=require(_0x69d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x69d2('0x8'));module[_0x69d2('0x9')]=function(_0x2b5215,_0x527c3f){return _0x2b5215[_0x69d2('0xa')](_0x69d2('0xb'),attributes,{'tableName':'int_salesforce_configurations','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 61c6fa3..fd98eda 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 _0x78fa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0x78fa,0x152));var _0xa78f=function(_0x5d4dbc,_0x3e2b00){_0x5d4dbc=_0x5d4dbc-0x0;var _0x15dfc9=_0x78fa[_0x5d4dbc];return _0x15dfc9;};'use strict';var _=require('lodash');var util=require(_0xa78f('0x0'));var moment=require(_0xa78f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa78f('0x2'));var db=require(_0xa78f('0x3'))['db'];var utils=require(_0xa78f('0x4'));var logger=require(_0xa78f('0x5'))(_0xa78f('0x6'));var config=require(_0xa78f('0x7'));var jayson=require(_0xa78f('0x8'));var client=jayson[_0xa78f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b375,_0x3fafa1,_0x34e43b){return new BPromise(function(_0xecf471,_0x55ec28){return client[_0xa78f('0xa')](_0x18b375,_0x34e43b)['then'](function(_0x3cfd9b){logger[_0xa78f('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3fafa1,_0xa78f('0xc'));logger[_0xa78f('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3fafa1,_0xa78f('0xc'),JSON[_0xa78f('0xe')](_0x3cfd9b));if(_0x3cfd9b[_0xa78f('0xf')]){if(_0x3cfd9b[_0xa78f('0xf')]['code']===0x1f4){logger[_0xa78f('0xf')](_0xa78f('0x10'),_0x3fafa1,_0x3cfd9b[_0xa78f('0xf')]['message']);return _0x55ec28(_0x3cfd9b['error'][_0xa78f('0x11')]);}logger[_0xa78f('0xf')](_0xa78f('0x10'),_0x3fafa1,_0x3cfd9b['error']['message']);return _0xecf471(_0x3cfd9b[_0xa78f('0xf')]['message']);}else{logger[_0xa78f('0xb')](_0xa78f('0x10'),_0x3fafa1,_0xa78f('0xc'));_0xecf471(_0x3cfd9b[_0xa78f('0x12')]['message']);}})[_0xa78f('0x13')](function(_0x3090de){logger[_0xa78f('0xf')](_0xa78f('0x10'),_0x3fafa1,_0x3090de);_0x55ec28(_0x3090de);});});} \ No newline at end of file +var _0x19de=['moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x28674e,_0x9f7357){var _0x1155ef=function(_0x220a9b){while(--_0x220a9b){_0x28674e['push'](_0x28674e['shift']());}};_0x1155ef(++_0x9f7357);}(_0x19de,0x15e));var _0xe19d=function(_0x21a824,_0x52a16f){_0x21a824=_0x21a824-0x0;var _0x1b1fb6=_0x19de[_0x21a824];return _0x1b1fb6;};'use strict';var _=require(_0xe19d('0x0'));var util=require(_0xe19d('0x1'));var moment=require(_0xe19d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe19d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe19d('0x4'))['db'];var utils=require(_0xe19d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe19d('0x6'));var jayson=require(_0xe19d('0x7'));var client=jayson['client'][_0xe19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1186dc,_0x1f568c,_0x24b75c){return new BPromise(function(_0x1dd3c8,_0x3b95eb){return client[_0xe19d('0x9')](_0x1186dc,_0x24b75c)[_0xe19d('0xa')](function(_0x45ea32){logger[_0xe19d('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f568c,_0xe19d('0xc'));logger[_0xe19d('0xd')](_0xe19d('0xe'),_0x1f568c,_0xe19d('0xc'),JSON[_0xe19d('0xf')](_0x45ea32));if(_0x45ea32[_0xe19d('0x10')]){if(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x11')]===0x1f4){logger[_0xe19d('0x10')](_0xe19d('0x12'),_0x1f568c,_0x45ea32['error'][_0xe19d('0x13')]);return _0x3b95eb(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);}logger[_0xe19d('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f568c,_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);return _0x1dd3c8(_0x45ea32[_0xe19d('0x10')][_0xe19d('0x13')]);}else{logger[_0xe19d('0xb')](_0xe19d('0x12'),_0x1f568c,_0xe19d('0xc'));_0x1dd3c8(_0x45ea32[_0xe19d('0x14')]['message']);}})[_0xe19d('0x15')](function(_0x6f6183){logger['error'](_0xe19d('0x12'),_0x1f568c,_0x6f6183);_0x3b95eb(_0x6f6183);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1d43b23..4f48bd0 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 _0x57cf=['create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','post'];(function(_0x5edf7e,_0x50b407){var _0x1817f8=function(_0x3807b2){while(--_0x3807b2){_0x5edf7e['push'](_0x5edf7e['shift']());}};_0x1817f8(++_0x50b407);}(_0x57cf,0x1f3));var _0xf57c=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0x57cf[_0x132558];return _0x34f138;};'use strict';var multer=require(_0xf57c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf57c('0x1'));var express=require(_0xf57c('0x2'));var router=express[_0xf57c('0x3')]();var fs_extra=require(_0xf57c('0x4'));var auth=require(_0xf57c('0x5'));var interaction=require(_0xf57c('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0xf57c('0x7')](),controller[_0xf57c('0x8')]);router['get']('/:id',auth[_0xf57c('0x7')](),controller[_0xf57c('0x9')]);router[_0xf57c('0xa')]('/',auth[_0xf57c('0x7')](),controller[_0xf57c('0xb')]);router['put'](_0xf57c('0xc'),auth[_0xf57c('0x7')](),controller[_0xf57c('0xd')]);router[_0xf57c('0xe')](_0xf57c('0xc'),auth[_0xf57c('0x7')](),controller[_0xf57c('0xf')]);module[_0xf57c('0x10')]=router; \ No newline at end of file +var _0xf468=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0xd37c93,_0x2b8d06){var _0x1ff20e=function(_0x1a99f5){while(--_0x1a99f5){_0xd37c93['push'](_0xd37c93['shift']());}};_0x1ff20e(++_0x2b8d06);}(_0xf468,0xfe));var _0x8f46=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xf468[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x8f46('0x0'));var util=require('util');var path=require(_0x8f46('0x1'));var timeout=require(_0x8f46('0x2'));var express=require(_0x8f46('0x3'));var router=express[_0x8f46('0x4')]();var fs_extra=require(_0x8f46('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8f46('0x6'));var config=require(_0x8f46('0x7'));var controller=require(_0x8f46('0x8'));router['get']('/',auth[_0x8f46('0x9')](),controller[_0x8f46('0xa')]);router[_0x8f46('0xb')](_0x8f46('0xc'),auth[_0x8f46('0x9')](),controller[_0x8f46('0xd')]);router[_0x8f46('0xe')]('/',auth[_0x8f46('0x9')](),controller[_0x8f46('0xf')]);router[_0x8f46('0x10')](_0x8f46('0xc'),auth[_0x8f46('0x9')](),controller[_0x8f46('0x11')]);router[_0x8f46('0x12')](_0x8f46('0xc'),auth['isAuthenticated'](),controller[_0x8f46('0x13')]);module[_0x8f46('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d5d5bac..56bc15c 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 _0x6881=['exports','ENUM','string','customVariable','picklist','STRING','sequelize'];(function(_0x507a17,_0x5583e2){var _0x448368=function(_0x45262f){while(--_0x45262f){_0x507a17['push'](_0x507a17['shift']());}};_0x448368(++_0x5583e2);}(_0x6881,0x1bf));var _0x1688=function(_0xa42f11,_0x5bf1ed){_0xa42f11=_0xa42f11-0x0;var _0x15ba50=_0x6881[_0xa42f11];return _0x15ba50;};'use strict';var Sequelize=require(_0x1688('0x0'));module[_0x1688('0x1')]={'type':{'type':Sequelize[_0x1688('0x2')](_0x1688('0x3'),'variable',_0x1688('0x4'),'keyValue',_0x1688('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1688('0x6')]},'key':{'type':Sequelize[_0x1688('0x6')]},'keyType':{'type':Sequelize[_0x1688('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1688('0x6')]},'idField':{'type':Sequelize[_0x1688('0x6')]},'variableName':{'type':Sequelize[_0x1688('0x6')]}}; \ No newline at end of file +var _0x44e6=['ENUM','string','variable','STRING','customVariable','exports'];(function(_0x344bcc,_0x51152b){var _0x1b489a=function(_0x59869c){while(--_0x59869c){_0x344bcc['push'](_0x344bcc['shift']());}};_0x1b489a(++_0x51152b);}(_0x44e6,0xa7));var _0x644e=function(_0x2d5f95,_0x9c14a5){_0x2d5f95=_0x2d5f95-0x0;var _0x41b67e=_0x44e6[_0x2d5f95];return _0x41b67e;};'use strict';var Sequelize=require('sequelize');module[_0x644e('0x0')]={'type':{'type':Sequelize[_0x644e('0x1')](_0x644e('0x2'),_0x644e('0x3'),'customVariable','keyValue','picklist'),'defaultValue':_0x644e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x644e('0x4')]},'keyType':{'type':Sequelize[_0x644e('0x1')](_0x644e('0x2'),_0x644e('0x3'),_0x644e('0x5'))},'keyContent':{'type':Sequelize[_0x644e('0x4')]},'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 73f8d1e..01458d3 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 _0x7fe5=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','fields','length','find','create','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0x7fe5,0x18c));var _0x57fe=function(_0x25875c,_0xc144a9){_0x25875c=_0x25875c-0x0;var _0x48a9e6=_0x7fe5[_0x25875c];return _0x48a9e6;};'use strict';var emlformat=require(_0x57fe('0x0'));var rimraf=require(_0x57fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57fe('0x2'));var rp=require(_0x57fe('0x3'));var moment=require('moment');var BPromise=require(_0x57fe('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57fe('0x5'));var sox=require(_0x57fe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57fe('0x7'));var _=require(_0x57fe('0x8'));var squel=require(_0x57fe('0x9'));var crypto=require(_0x57fe('0xa'));var jsforce=require(_0x57fe('0xb'));var deskjs=require(_0x57fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x57fe('0xd'));var Papa=require(_0x57fe('0xe'));var Redis=require('ioredis');var authService=require(_0x57fe('0xf'));var qs=require(_0x57fe('0x10'));var as=require(_0x57fe('0x11'));var hardwareService=require(_0x57fe('0x12'));var logger=require('../../config/logger')(_0x57fe('0x13'));var utils=require(_0x57fe('0x14'));var config=require(_0x57fe('0x15'));var licenseUtil=require(_0x57fe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf6df2,_0x30ff2b){_0x30ff2b=_0x30ff2b||0xcc;return function(_0x5f203e){if(_0x5f203e){return _0xbf6df2[_0x57fe('0x17')](_0x30ff2b);}return _0xbf6df2[_0x57fe('0x18')](_0x30ff2b)[_0x57fe('0x19')]();};}function respondWithResult(_0x5680c0,_0x393937){_0x393937=_0x393937||0xc8;return function(_0x216a1b){if(_0x216a1b){return _0x5680c0[_0x57fe('0x18')](_0x393937)[_0x57fe('0x1a')](_0x216a1b);}};}function respondWithFilteredResult(_0x305ce0,_0x27c2cf){return function(_0x30224e){if(_0x30224e){var _0x531929=typeof _0x27c2cf[_0x57fe('0x1b')]==='undefined'&&typeof _0x27c2cf[_0x57fe('0x1c')]===_0x57fe('0x1d');var _0x21b9ed=_0x30224e[_0x57fe('0x1e')];var _0x5a50a4=_0x531929?0x0:_0x27c2cf['offset'];var _0x35c1a7=_0x531929?_0x30224e['count']:_0x27c2cf[_0x57fe('0x1b')]+_0x27c2cf[_0x57fe('0x1c')];var _0x6f93b1;if(_0x35c1a7>=_0x21b9ed){_0x35c1a7=_0x21b9ed;_0x6f93b1=0xc8;}else{_0x6f93b1=0xce;}_0x305ce0['status'](_0x6f93b1);return _0x305ce0[_0x57fe('0x1f')](_0x57fe('0x20'),_0x5a50a4+'-'+_0x35c1a7+'/'+_0x21b9ed)[_0x57fe('0x1a')](_0x30224e);}return null;};}function patchUpdates(_0x4971a7){return function(_0x3e49b0){try{jsonpatch[_0x57fe('0x21')](_0x3e49b0,_0x4971a7,!![]);}catch(_0x96d960){return BPromise[_0x57fe('0x22')](_0x96d960);}return _0x3e49b0[_0x57fe('0x23')]();};}function saveUpdates(_0x82cb73,_0x269e91){return function(_0x46ee8a){if(_0x46ee8a){return _0x46ee8a['update'](_0x82cb73)[_0x57fe('0x24')](function(_0x58eec6){return _0x58eec6;});}return null;};}function removeEntity(_0x384ffc,_0x55d378){return function(_0x31158a){if(_0x31158a){return _0x31158a[_0x57fe('0x25')]()[_0x57fe('0x24')](function(){_0x384ffc[_0x57fe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x675ace,_0x272944){return function(_0x12777a){if(!_0x12777a){_0x675ace[_0x57fe('0x17')](0x194);}return _0x12777a;};}function handleError(_0x168b6d,_0x3c9eb0){_0x3c9eb0=_0x3c9eb0||0x1f4;return function(_0x1c26f9){logger[_0x57fe('0x26')](_0x1c26f9[_0x57fe('0x27')]);if(_0x1c26f9[_0x57fe('0x28')]){delete _0x1c26f9[_0x57fe('0x28')];}_0x168b6d['status'](_0x3c9eb0)[_0x57fe('0x29')](_0x1c26f9);};}exports['index']=function(_0x282045,_0x3f45a4){var _0xff13a4={},_0x349b76={},_0x17a171={'count':0x0,'rows':[]};var _0x4bba99=_[_0x57fe('0x2a')](db[_0x57fe('0x2b')][_0x57fe('0x2c')],function(_0x10022b){return{'name':_0x10022b[_0x57fe('0x2d')],'type':_0x10022b[_0x57fe('0x2e')][_0x57fe('0x2f')]};});_0x349b76['model']=_[_0x57fe('0x2a')](_0x4bba99,'name');_0x349b76[_0x57fe('0x30')]=_[_0x57fe('0x31')](_0x282045[_0x57fe('0x30')]);_0x349b76['filters']=_[_0x57fe('0x32')](_0x349b76[_0x57fe('0x33')],_0x349b76[_0x57fe('0x30')]);_0xff13a4[_0x57fe('0x34')]=_[_0x57fe('0x32')](_0x349b76[_0x57fe('0x33')],qs['fields'](_0x282045['query']['fields']));_0xff13a4[_0x57fe('0x34')]=_0xff13a4[_0x57fe('0x34')]['length']?_0xff13a4[_0x57fe('0x34')]:_0x349b76['model'];if(!_0x282045[_0x57fe('0x30')][_0x57fe('0x35')](_0x57fe('0x36'))){_0xff13a4['limit']=qs[_0x57fe('0x1c')](_0x282045[_0x57fe('0x30')]['limit']);_0xff13a4[_0x57fe('0x1b')]=qs['offset'](_0x282045[_0x57fe('0x30')][_0x57fe('0x1b')]);}_0xff13a4[_0x57fe('0x37')]=qs[_0x57fe('0x38')](_0x282045[_0x57fe('0x30')][_0x57fe('0x38')]);_0xff13a4[_0x57fe('0x39')]=qs[_0x57fe('0x3a')](_[_0x57fe('0x3b')](_0x282045[_0x57fe('0x30')],_0x349b76[_0x57fe('0x3a')]),_0x4bba99);if(_0x282045['query'][_0x57fe('0x3c')]){_0xff13a4[_0x57fe('0x39')]=_[_0x57fe('0x3d')](_0xff13a4[_0x57fe('0x39')],{'$or':_[_0x57fe('0x2a')](_0x4bba99,function(_0x47248b){if(_0x47248b[_0x57fe('0x2e')]!==_0x57fe('0x3e')){var _0x154290={};_0x154290[_0x47248b['name']]={'$like':'%'+_0x282045[_0x57fe('0x30')]['filter']+'%'};return _0x154290;}})});}_0xff13a4=_[_0x57fe('0x3d')]({},_0xff13a4,_0x282045['options']);var _0x2d3e1d={'where':_0xff13a4[_0x57fe('0x39')]};return db[_0x57fe('0x2b')][_0x57fe('0x1e')](_0x2d3e1d)['then'](function(_0x2e35ab){_0x17a171[_0x57fe('0x1e')]=_0x2e35ab;if(_0x282045[_0x57fe('0x30')][_0x57fe('0x3f')]){_0xff13a4[_0x57fe('0x40')]=[{'all':!![]}];}return db[_0x57fe('0x2b')][_0x57fe('0x41')](_0xff13a4);})[_0x57fe('0x24')](function(_0x562c7c){_0x17a171[_0x57fe('0x42')]=_0x562c7c;return _0x17a171;})['then'](respondWithFilteredResult(_0x3f45a4,_0xff13a4))['catch'](handleError(_0x3f45a4,null));};exports[_0x57fe('0x43')]=function(_0x46dd1b,_0x257d82){var _0x38b281={'raw':!![],'where':{'id':_0x46dd1b[_0x57fe('0x44')]['id']}},_0x71dd65={};_0x71dd65['model']=_[_0x57fe('0x31')](db[_0x57fe('0x2b')][_0x57fe('0x2c')]);_0x71dd65[_0x57fe('0x30')]=_['keys'](_0x46dd1b[_0x57fe('0x30')]);_0x71dd65[_0x57fe('0x3a')]=_[_0x57fe('0x32')](_0x71dd65[_0x57fe('0x33')],_0x71dd65['query']);_0x38b281[_0x57fe('0x34')]=_[_0x57fe('0x32')](_0x71dd65['model'],qs['fields'](_0x46dd1b[_0x57fe('0x30')][_0x57fe('0x45')]));_0x38b281[_0x57fe('0x34')]=_0x38b281[_0x57fe('0x34')][_0x57fe('0x46')]?_0x38b281[_0x57fe('0x34')]:_0x71dd65[_0x57fe('0x33')];if(_0x46dd1b[_0x57fe('0x30')][_0x57fe('0x3f')]){_0x38b281['include']=[{'all':!![]}];}_0x38b281=_[_0x57fe('0x3d')]({},_0x38b281,_0x46dd1b['options']);return db['SalesforceField'][_0x57fe('0x47')](_0x38b281)[_0x57fe('0x24')](handleEntityNotFound(_0x257d82,null))[_0x57fe('0x24')](respondWithResult(_0x257d82,null))['catch'](handleError(_0x257d82,null));};exports[_0x57fe('0x48')]=function(_0x120aff,_0x28c35c){return db[_0x57fe('0x2b')][_0x57fe('0x48')](_0x120aff['body'],{})[_0x57fe('0x24')](respondWithResult(_0x28c35c,0xc9))[_0x57fe('0x49')](handleError(_0x28c35c,null));};exports[_0x57fe('0x4a')]=function(_0x1b82f6,_0x286b0b){if(_0x1b82f6['body']['id']){delete _0x1b82f6[_0x57fe('0x4b')]['id'];}return db[_0x57fe('0x2b')][_0x57fe('0x47')]({'where':{'id':_0x1b82f6[_0x57fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x286b0b,null))[_0x57fe('0x24')](saveUpdates(_0x1b82f6['body'],null))['then'](respondWithResult(_0x286b0b,null))[_0x57fe('0x49')](handleError(_0x286b0b,null));};exports[_0x57fe('0x25')]=function(_0x5d3e7f,_0x7c0e39){return db['SalesforceField'][_0x57fe('0x47')]({'where':{'id':_0x5d3e7f[_0x57fe('0x44')]['id']}})[_0x57fe('0x24')](handleEntityNotFound(_0x7c0e39,null))['then'](removeEntity(_0x7c0e39,null))['catch'](handleError(_0x7c0e39,null));}; \ No newline at end of file +var _0xf4b4=['mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','SalesforceField','keys','include','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5e9b8f,_0x31aa85){var _0xfbda62=function(_0xc9e587){while(--_0xc9e587){_0x5e9b8f['push'](_0x5e9b8f['shift']());}};_0xfbda62(++_0x31aa85);}(_0xf4b4,0x92));var _0x4f4b=function(_0x1777e4,_0x38b4f8){_0x1777e4=_0x1777e4-0x0;var _0x21ecac=_0xf4b4[_0x1777e4];return _0x21ecac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f4b('0x0'));var zipdir=require(_0x4f4b('0x1'));var jsonpatch=require(_0x4f4b('0x2'));var rp=require(_0x4f4b('0x3'));var moment=require(_0x4f4b('0x4'));var BPromise=require(_0x4f4b('0x5'));var Mustache=require(_0x4f4b('0x6'));var util=require('util');var path=require(_0x4f4b('0x7'));var sox=require('sox');var csv=require(_0x4f4b('0x8'));var ejs=require(_0x4f4b('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4b('0xa'));var _=require(_0x4f4b('0xb'));var squel=require(_0x4f4b('0xc'));var crypto=require(_0x4f4b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4f4b('0xe'));var toCsv=require(_0x4f4b('0x8'));var querystring=require(_0x4f4b('0xf'));var Papa=require(_0x4f4b('0x10'));var Redis=require(_0x4f4b('0x11'));var authService=require(_0x4f4b('0x12'));var qs=require(_0x4f4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f4b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4f4b('0x15'));var licenseUtil=require(_0x4f4b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47e94b,_0x2f654b){_0x2f654b=_0x2f654b||0xcc;return function(_0x5a15c8){if(_0x5a15c8){return _0x47e94b[_0x4f4b('0x17')](_0x2f654b);}return _0x47e94b['status'](_0x2f654b)[_0x4f4b('0x18')]();};}function respondWithResult(_0x2d6c25,_0x261631){_0x261631=_0x261631||0xc8;return function(_0xfcfbdb){if(_0xfcfbdb){return _0x2d6c25['status'](_0x261631)[_0x4f4b('0x19')](_0xfcfbdb);}};}function respondWithFilteredResult(_0x29a823,_0x33447a){return function(_0x35e2be){if(_0x35e2be){var _0x13e25d=typeof _0x33447a['offset']===_0x4f4b('0x1a')&&typeof _0x33447a[_0x4f4b('0x1b')]==='undefined';var _0xf8c5af=_0x35e2be[_0x4f4b('0x1c')];var _0x180876=_0x13e25d?0x0:_0x33447a['offset'];var _0x36dc8a=_0x13e25d?_0x35e2be[_0x4f4b('0x1c')]:_0x33447a[_0x4f4b('0x1d')]+_0x33447a['limit'];var _0x3bea57;if(_0x36dc8a>=_0xf8c5af){_0x36dc8a=_0xf8c5af;_0x3bea57=0xc8;}else{_0x3bea57=0xce;}_0x29a823[_0x4f4b('0x1e')](_0x3bea57);return _0x29a823[_0x4f4b('0x1f')](_0x4f4b('0x20'),_0x180876+'-'+_0x36dc8a+'/'+_0xf8c5af)[_0x4f4b('0x19')](_0x35e2be);}return null;};}function patchUpdates(_0x8293f0){return function(_0x56df63){try{jsonpatch[_0x4f4b('0x21')](_0x56df63,_0x8293f0,!![]);}catch(_0x4db0ef){return BPromise[_0x4f4b('0x22')](_0x4db0ef);}return _0x56df63[_0x4f4b('0x23')]();};}function saveUpdates(_0x8b8312,_0x534e58){return function(_0x46ba30){if(_0x46ba30){return _0x46ba30[_0x4f4b('0x24')](_0x8b8312)[_0x4f4b('0x25')](function(_0x3db957){return _0x3db957;});}return null;};}function removeEntity(_0x1aa4d8,_0x3d5537){return function(_0x4e9264){if(_0x4e9264){return _0x4e9264[_0x4f4b('0x26')]()[_0x4f4b('0x25')](function(){_0x1aa4d8[_0x4f4b('0x1e')](0xcc)[_0x4f4b('0x18')]();});}};}function handleEntityNotFound(_0x37c888,_0x2e797b){return function(_0x24609f){if(!_0x24609f){_0x37c888['sendStatus'](0x194);}return _0x24609f;};}function handleError(_0x5df64a,_0x2247a3){_0x2247a3=_0x2247a3||0x1f4;return function(_0xa9eb93){logger[_0x4f4b('0x27')](_0xa9eb93[_0x4f4b('0x28')]);if(_0xa9eb93[_0x4f4b('0x29')]){delete _0xa9eb93[_0x4f4b('0x29')];}_0x5df64a[_0x4f4b('0x1e')](_0x2247a3)[_0x4f4b('0x2a')](_0xa9eb93);};}exports['index']=function(_0x4b030a,_0x23865a){var _0xd56c77={},_0x55a8fe={},_0x79da95={'count':0x0,'rows':[]};var _0x1043fa=_[_0x4f4b('0x2b')](db['SalesforceField'][_0x4f4b('0x2c')],function(_0x371375){return{'name':_0x371375[_0x4f4b('0x2d')],'type':_0x371375['type'][_0x4f4b('0x2e')]};});_0x55a8fe[_0x4f4b('0x2f')]=_[_0x4f4b('0x2b')](_0x1043fa,_0x4f4b('0x29'));_0x55a8fe[_0x4f4b('0x30')]=_['keys'](_0x4b030a[_0x4f4b('0x30')]);_0x55a8fe['filters']=_[_0x4f4b('0x31')](_0x55a8fe['model'],_0x55a8fe[_0x4f4b('0x30')]);_0xd56c77['attributes']=_[_0x4f4b('0x31')](_0x55a8fe[_0x4f4b('0x2f')],qs[_0x4f4b('0x32')](_0x4b030a[_0x4f4b('0x30')]['fields']));_0xd56c77[_0x4f4b('0x33')]=_0xd56c77[_0x4f4b('0x33')][_0x4f4b('0x34')]?_0xd56c77['attributes']:_0x55a8fe[_0x4f4b('0x2f')];if(!_0x4b030a['query'][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0xd56c77['limit']=qs['limit'](_0x4b030a[_0x4f4b('0x30')]['limit']);_0xd56c77[_0x4f4b('0x1d')]=qs[_0x4f4b('0x1d')](_0x4b030a['query']['offset']);}_0xd56c77[_0x4f4b('0x37')]=qs[_0x4f4b('0x38')](_0x4b030a['query']['sort']);_0xd56c77[_0x4f4b('0x39')]=qs[_0x4f4b('0x3a')](_[_0x4f4b('0x3b')](_0x4b030a[_0x4f4b('0x30')],_0x55a8fe[_0x4f4b('0x3a')]),_0x1043fa);if(_0x4b030a['query'][_0x4f4b('0x3c')]){_0xd56c77[_0x4f4b('0x39')]=_[_0x4f4b('0x3d')](_0xd56c77[_0x4f4b('0x39')],{'$or':_[_0x4f4b('0x2b')](_0x1043fa,function(_0x8496c8){if(_0x8496c8[_0x4f4b('0x3e')]!==_0x4f4b('0x3f')){var _0x227490={};_0x227490[_0x8496c8[_0x4f4b('0x29')]]={'$like':'%'+_0x4b030a['query']['filter']+'%'};return _0x227490;}})});}_0xd56c77=_[_0x4f4b('0x3d')]({},_0xd56c77,_0x4b030a['options']);var _0x1a6af7={'where':_0xd56c77[_0x4f4b('0x39')]};return db['SalesforceField'][_0x4f4b('0x1c')](_0x1a6af7)[_0x4f4b('0x25')](function(_0x47a2ab){_0x79da95[_0x4f4b('0x1c')]=_0x47a2ab;if(_0x4b030a[_0x4f4b('0x30')][_0x4f4b('0x40')]){_0xd56c77['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4f4b('0x41')](_0xd56c77);})[_0x4f4b('0x25')](function(_0x29e180){_0x79da95[_0x4f4b('0x42')]=_0x29e180;return _0x79da95;})[_0x4f4b('0x25')](respondWithFilteredResult(_0x23865a,_0xd56c77))['catch'](handleError(_0x23865a,null));};exports['show']=function(_0xe0fa76,_0x294bef){var _0xf8f58a={'raw':!![],'where':{'id':_0xe0fa76[_0x4f4b('0x43')]['id']}},_0x21e8a6={};_0x21e8a6['model']=_['keys'](db[_0x4f4b('0x44')][_0x4f4b('0x2c')]);_0x21e8a6['query']=_[_0x4f4b('0x45')](_0xe0fa76[_0x4f4b('0x30')]);_0x21e8a6['filters']=_[_0x4f4b('0x31')](_0x21e8a6[_0x4f4b('0x2f')],_0x21e8a6[_0x4f4b('0x30')]);_0xf8f58a['attributes']=_[_0x4f4b('0x31')](_0x21e8a6[_0x4f4b('0x2f')],qs['fields'](_0xe0fa76['query'][_0x4f4b('0x32')]));_0xf8f58a[_0x4f4b('0x33')]=_0xf8f58a[_0x4f4b('0x33')][_0x4f4b('0x34')]?_0xf8f58a['attributes']:_0x21e8a6['model'];if(_0xe0fa76[_0x4f4b('0x30')][_0x4f4b('0x40')]){_0xf8f58a[_0x4f4b('0x46')]=[{'all':!![]}];}_0xf8f58a=_[_0x4f4b('0x3d')]({},_0xf8f58a,_0xe0fa76[_0x4f4b('0x47')]);return db[_0x4f4b('0x44')][_0x4f4b('0x48')](_0xf8f58a)[_0x4f4b('0x25')](handleEntityNotFound(_0x294bef,null))['then'](respondWithResult(_0x294bef,null))[_0x4f4b('0x49')](handleError(_0x294bef,null));};exports['create']=function(_0x164854,_0x4be367){return db['SalesforceField'][_0x4f4b('0x4a')](_0x164854[_0x4f4b('0x4b')],{})[_0x4f4b('0x25')](respondWithResult(_0x4be367,0xc9))[_0x4f4b('0x49')](handleError(_0x4be367,null));};exports['update']=function(_0x2740e3,_0x5258ed){if(_0x2740e3['body']['id']){delete _0x2740e3[_0x4f4b('0x4b')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2740e3[_0x4f4b('0x43')]['id']}})[_0x4f4b('0x25')](handleEntityNotFound(_0x5258ed,null))[_0x4f4b('0x25')](saveUpdates(_0x2740e3['body'],null))[_0x4f4b('0x25')](respondWithResult(_0x5258ed,null))['catch'](handleError(_0x5258ed,null));};exports['destroy']=function(_0x56298c,_0x2b950b){return db[_0x4f4b('0x44')]['find']({'where':{'id':_0x56298c[_0x4f4b('0x43')]['id']}})[_0x4f4b('0x25')](handleEntityNotFound(_0x2b950b,null))['then'](removeEntity(_0x2b950b,null))[_0x4f4b('0x49')](handleError(_0x2b950b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c933cac..b6f4fc0 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 _0x0bcc=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','util','api','moment','bluebird'];(function(_0x383e54,_0x35dee5){var _0xe80eea=function(_0x2e4d93){while(--_0x2e4d93){_0x383e54['push'](_0x383e54['shift']());}};_0xe80eea(++_0x35dee5);}(_0x0bcc,0x15b));var _0xc0bc=function(_0x3e3641,_0x4b7038){_0x3e3641=_0x3e3641-0x0;var _0x4691fe=_0x0bcc[_0x3e3641];return _0x4691fe;};'use strict';var _=require('lodash');var util=require(_0xc0bc('0x0'));var logger=require('../../config/logger')(_0xc0bc('0x1'));var moment=require(_0xc0bc('0x2'));var BPromise=require(_0xc0bc('0x3'));var rp=require(_0xc0bc('0x4'));var fs=require('fs');var path=require(_0xc0bc('0x5'));var rimraf=require(_0xc0bc('0x6'));var config=require(_0xc0bc('0x7'));var attributes=require(_0xc0bc('0x8'));module[_0xc0bc('0x9')]=function(_0x2763c2,_0x2757bb){return _0x2763c2['define'](_0xc0bc('0xa'),attributes,{'tableName':_0xc0bc('0xb'),'paranoid':![],'indexes':[{'name':_0xc0bc('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcce4=['../../config/logger','moment','bluebird','request-promise','path','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xcce4,0x15e));var _0x4cce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcce4[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x4cce('0x0'));var logger=require(_0x4cce('0x1'))('api');var moment=require(_0x4cce('0x2'));var BPromise=require(_0x4cce('0x3'));var rp=require(_0x4cce('0x4'));var fs=require('fs');var path=require(_0x4cce('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cce('0x6'));module[_0x4cce('0x7')]=function(_0x4e86af,_0x27527d){return _0x4e86af[_0x4cce('0x8')]('SalesforceField',attributes,{'tableName':_0x4cce('0x9'),'paranoid':![],'indexes':[{'name':_0x4cce('0xa'),'fields':[_0x4cce('0xb'),_0x4cce('0xc')],'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 399c1b9..cba4c90 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 _0xcc18=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x87f41c,_0x2cabc9){var _0x1d181e=function(_0x2ba170){while(--_0x2ba170){_0x87f41c['push'](_0x87f41c['shift']());}};_0x1d181e(++_0x2cabc9);}(_0xcc18,0x92));var _0x8cc1=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xcc18[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x8cc1('0x0'));var util=require('util');var moment=require(_0x8cc1('0x1'));var BPromise=require('bluebird');var rs=require(_0x8cc1('0x2'));var fs=require('fs');var Redis=require(_0x8cc1('0x3'));var db=require(_0x8cc1('0x4'))['db'];var utils=require(_0x8cc1('0x5'));var logger=require(_0x8cc1('0x6'))('rpc');var config=require(_0x8cc1('0x7'));var jayson=require(_0x8cc1('0x8'));var client=jayson[_0x8cc1('0x9')][_0x8cc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9df6,_0x2cbbc5,_0x2a4acd){return new BPromise(function(_0xa59cab,_0x13b28d){return client[_0x8cc1('0xb')](_0x4a9df6,_0x2a4acd)[_0x8cc1('0xc')](function(_0x18557d){logger[_0x8cc1('0xd')](_0x8cc1('0xe'),_0x2cbbc5,_0x8cc1('0xf'));logger[_0x8cc1('0x10')](_0x8cc1('0x11'),_0x2cbbc5,_0x8cc1('0xf'),JSON[_0x8cc1('0x12')](_0x18557d));if(_0x18557d[_0x8cc1('0x13')]){if(_0x18557d['error'][_0x8cc1('0x14')]===0x1f4){logger['error'](_0x8cc1('0xe'),_0x2cbbc5,_0x18557d[_0x8cc1('0x13')][_0x8cc1('0x15')]);return _0x13b28d(_0x18557d['error'][_0x8cc1('0x15')]);}logger[_0x8cc1('0x13')](_0x8cc1('0xe'),_0x2cbbc5,_0x18557d[_0x8cc1('0x13')]['message']);return _0xa59cab(_0x18557d[_0x8cc1('0x13')][_0x8cc1('0x15')]);}else{logger[_0x8cc1('0xd')](_0x8cc1('0xe'),_0x2cbbc5,_0x8cc1('0xf'));_0xa59cab(_0x18557d[_0x8cc1('0x16')][_0x8cc1('0x15')]);}})[_0x8cc1('0x17')](function(_0x46d0c8){logger[_0x8cc1('0x13')](_0x8cc1('0xe'),_0x2cbbc5,_0x46d0c8);_0x13b28d(_0x46d0c8);});});} \ No newline at end of file +var _0x9362=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c2e65,_0x20e630){var _0x445359=function(_0x2588d4){while(--_0x2588d4){_0x5c2e65['push'](_0x5c2e65['shift']());}};_0x445359(++_0x20e630);}(_0x9362,0x1b1));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2936('0x0'));var moment=require(_0x2936('0x1'));var BPromise=require(_0x2936('0x2'));var rs=require(_0x2936('0x3'));var fs=require('fs');var Redis=require(_0x2936('0x4'));var db=require(_0x2936('0x5'))['db'];var utils=require(_0x2936('0x6'));var logger=require(_0x2936('0x7'))(_0x2936('0x8'));var config=require(_0x2936('0x9'));var jayson=require(_0x2936('0xa'));var client=jayson[_0x2936('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x427b06,_0x44adf1,_0x3ec7b0){return new BPromise(function(_0x1355d4,_0x6faf4a){return client[_0x2936('0xc')](_0x427b06,_0x3ec7b0)[_0x2936('0xd')](function(_0xbf5da0){logger['info'](_0x2936('0xe'),_0x44adf1,'request\x20sent');logger[_0x2936('0xf')](_0x2936('0x10'),_0x44adf1,_0x2936('0x11'),JSON['stringify'](_0xbf5da0));if(_0xbf5da0[_0x2936('0x12')]){if(_0xbf5da0['error']['code']===0x1f4){logger[_0x2936('0x12')]('SalesforceField,\x20%s,\x20%s',_0x44adf1,_0xbf5da0[_0x2936('0x12')]['message']);return _0x6faf4a(_0xbf5da0['error'][_0x2936('0x13')]);}logger[_0x2936('0x12')]('SalesforceField,\x20%s,\x20%s',_0x44adf1,_0xbf5da0[_0x2936('0x12')]['message']);return _0x1355d4(_0xbf5da0[_0x2936('0x12')][_0x2936('0x13')]);}else{logger[_0x2936('0x14')](_0x2936('0xe'),_0x44adf1,_0x2936('0x11'));_0x1355d4(_0xbf5da0[_0x2936('0x15')][_0x2936('0x13')]);}})['catch'](function(_0x64321d){logger[_0x2936('0x12')](_0x2936('0xe'),_0x44adf1,_0x64321d);_0x6faf4a(_0x64321d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f97a63b..ae4361c 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 _0xd549=['get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x1fccd9,_0x5a7f00){var _0x493777=function(_0x5639ca){while(--_0x5639ca){_0x1fccd9['push'](_0x1fccd9['shift']());}};_0x493777(++_0x5a7f00);}(_0xd549,0xde));var _0x9d54=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd549[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x9d54('0x0'));var util=require('util');var path=require(_0x9d54('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d54('0x2')]();var fs_extra=require(_0x9d54('0x3'));var auth=require(_0x9d54('0x4'));var interaction=require(_0x9d54('0x5'));var config=require(_0x9d54('0x6'));var controller=require(_0x9d54('0x7'));router[_0x9d54('0x8')]('/',auth[_0x9d54('0x9')](),controller['index']);router[_0x9d54('0x8')](_0x9d54('0xa'),auth[_0x9d54('0x9')](),controller[_0x9d54('0xb')]);router[_0x9d54('0x8')]('/:id/configurations',auth[_0x9d54('0x9')](),controller[_0x9d54('0xc')]);router[_0x9d54('0x8')](_0x9d54('0xd'),auth[_0x9d54('0x9')](),controller[_0x9d54('0xe')]);router['post']('/',auth[_0x9d54('0x9')](),controller[_0x9d54('0xf')]);router[_0x9d54('0x10')](_0x9d54('0x11'),auth[_0x9d54('0x9')](),controller[_0x9d54('0x12')]);router[_0x9d54('0x13')](_0x9d54('0xa'),auth[_0x9d54('0x9')](),controller[_0x9d54('0x14')]);router['delete']('/:id',auth[_0x9d54('0x9')](),controller[_0x9d54('0x15')]);module[_0x9d54('0x16')]=router; \ No newline at end of file +var _0x0922=['util','path','connect-timeout','Router','fs-extra','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','update','delete','destroy','exports','multer'];(function(_0x2c1de6,_0x24d0ad){var _0xc3ba97=function(_0x47c28a){while(--_0x47c28a){_0x2c1de6['push'](_0x2c1de6['shift']());}};_0xc3ba97(++_0x24d0ad);}(_0x0922,0x77));var _0x2092=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x0922[_0x2cc594];return _0x4abff7;};'use strict';var multer=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var path=require(_0x2092('0x2'));var timeout=require(_0x2092('0x3'));var express=require('express');var router=express[_0x2092('0x4')]();var fs_extra=require(_0x2092('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2092('0x6'));router[_0x2092('0x7')]('/',auth[_0x2092('0x8')](),controller[_0x2092('0x9')]);router['get'](_0x2092('0xa'),auth['isAuthenticated'](),controller[_0x2092('0xb')]);router[_0x2092('0x7')](_0x2092('0xc'),auth['isAuthenticated'](),controller[_0x2092('0xd')]);router['get']('/:id/fields',auth[_0x2092('0x8')](),controller[_0x2092('0xe')]);router[_0x2092('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2092('0xf')](_0x2092('0xc'),auth[_0x2092('0x8')](),controller['addConfiguration']);router['put'](_0x2092('0xa'),auth[_0x2092('0x8')](),controller[_0x2092('0x10')]);router[_0x2092('0x11')]('/:id',auth[_0x2092('0x8')](),controller[_0x2092('0x12')]);module[_0x2092('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 44d7ea5..d4170bf 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 _0xc581=['STRING','username','remoteUri','exports'];(function(_0x5066af,_0x5cc97c){var _0x2df6d3=function(_0x5aef00){while(--_0x5aef00){_0x5066af['push'](_0x5066af['shift']());}};_0x2df6d3(++_0x5cc97c);}(_0xc581,0x18b));var _0x1c58=function(_0x37be00,_0x45514d){_0x37be00=_0x37be00-0x0;var _0x12b45f=_0xc581[_0x37be00];return _0x12b45f;};'use strict';var Sequelize=require('sequelize');module[_0x1c58('0x0')]={'name':{'type':Sequelize[_0x1c58('0x1')]},'description':{'type':Sequelize[_0x1c58('0x1')]},'username':{'type':Sequelize[_0x1c58('0x1')],'unique':_0x1c58('0x2')},'password':{'type':Sequelize[_0x1c58('0x1')]},'email':{'type':Sequelize[_0x1c58('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1c58('0x3')},'serverUrl':{'type':Sequelize[_0x1c58('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x58b9=['exports','STRING','remoteUri'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x58b9,0x1f2));var _0x958b=function(_0x2c9004,_0x312b13){_0x2c9004=_0x2c9004-0x0;var _0x471bb5=_0x58b9[_0x2c9004];return _0x471bb5;};'use strict';var Sequelize=require('sequelize');module[_0x958b('0x0')]={'name':{'type':Sequelize[_0x958b('0x1')]},'description':{'type':Sequelize[_0x958b('0x1')]},'username':{'type':Sequelize[_0x958b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x958b('0x1')]},'email':{'type':Sequelize[_0x958b('0x1')]},'remoteUri':{'type':Sequelize[_0x958b('0x1')],'unique':_0x958b('0x2')},'serverUrl':{'type':Sequelize[_0x958b('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 81773fd..dd9b623 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 _0x0d76=['subcategory','close_code','notify','incident_state','severity','made_sla','caused_by','sys_updated_on','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','location','username','password','email','remoteUri','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','statusCode','test','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','result','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','getConfigurations','ServicenowConfiguration','order','pick','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','knowledge'];(function(_0x57ebf5,_0x3de518){var _0x2523c6=function(_0x29a242){while(--_0x29a242){_0x57ebf5['push'](_0x57ebf5['shift']());}};_0x2523c6(++_0x3de518);}(_0x0d76,0x119));var _0x60d7=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x0d76[_0xe5b349];return _0x26b0ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60d7('0x0'));var zipdir=require(_0x60d7('0x1'));var jsonpatch=require(_0x60d7('0x2'));var rp=require(_0x60d7('0x3'));var moment=require(_0x60d7('0x4'));var BPromise=require(_0x60d7('0x5'));var Mustache=require(_0x60d7('0x6'));var util=require(_0x60d7('0x7'));var path=require(_0x60d7('0x8'));var sox=require(_0x60d7('0x9'));var csv=require(_0x60d7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60d7('0xb'));var squel=require(_0x60d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x60d7('0xd'));var deskjs=require(_0x60d7('0xe'));var toCsv=require(_0x60d7('0xa'));var querystring=require(_0x60d7('0xf'));var Papa=require(_0x60d7('0x10'));var Redis=require(_0x60d7('0x11'));var authService=require(_0x60d7('0x12'));var qs=require(_0x60d7('0x13'));var as=require(_0x60d7('0x14'));var hardwareService=require(_0x60d7('0x15'));var logger=require(_0x60d7('0x16'))('api');var utils=require(_0x60d7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x60d7('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x60d7('0x19'));function respondWithStatusCode(_0x12d5af,_0x14b67e){_0x14b67e=_0x14b67e||0xcc;return function(_0x3f0636){if(_0x3f0636){return _0x12d5af[_0x60d7('0x1a')](_0x14b67e);}return _0x12d5af[_0x60d7('0x1b')](_0x14b67e)[_0x60d7('0x1c')]();};}function respondWithResult(_0x34d694,_0x394aef){_0x394aef=_0x394aef||0xc8;return function(_0x3a1e22){if(_0x3a1e22){return _0x34d694[_0x60d7('0x1b')](_0x394aef)['json'](_0x3a1e22);}};}function respondWithFilteredResult(_0x81cd9d,_0x1d264c){return function(_0x5355cf){if(_0x5355cf){var _0x4311c8=typeof _0x1d264c[_0x60d7('0x1d')]===_0x60d7('0x1e')&&typeof _0x1d264c['limit']===_0x60d7('0x1e');var _0x4ee6cf=_0x5355cf[_0x60d7('0x1f')];var _0x212280=_0x4311c8?0x0:_0x1d264c['offset'];var _0x108dd9=_0x4311c8?_0x5355cf['count']:_0x1d264c[_0x60d7('0x1d')]+_0x1d264c[_0x60d7('0x20')];var _0x2dfabd;if(_0x108dd9>=_0x4ee6cf){_0x108dd9=_0x4ee6cf;_0x2dfabd=0xc8;}else{_0x2dfabd=0xce;}_0x81cd9d[_0x60d7('0x1b')](_0x2dfabd);return _0x81cd9d[_0x60d7('0x21')](_0x60d7('0x22'),_0x212280+'-'+_0x108dd9+'/'+_0x4ee6cf)['json'](_0x5355cf);}return null;};}function patchUpdates(_0x965ec7){return function(_0x385d30){try{jsonpatch[_0x60d7('0x23')](_0x385d30,_0x965ec7,!![]);}catch(_0x68cf0c){return BPromise[_0x60d7('0x24')](_0x68cf0c);}return _0x385d30[_0x60d7('0x25')]();};}function saveUpdates(_0x5a5434,_0x52e7ff){return function(_0x477c5a){if(_0x477c5a){return _0x477c5a[_0x60d7('0x26')](_0x5a5434)[_0x60d7('0x27')](function(_0x40f643){return _0x40f643;});}return null;};}function removeEntity(_0x14fd6a,_0x5dbba2){return function(_0x457464){if(_0x457464){return _0x457464[_0x60d7('0x28')]()[_0x60d7('0x27')](function(){_0x14fd6a[_0x60d7('0x1b')](0xcc)[_0x60d7('0x1c')]();});}};}function handleEntityNotFound(_0x523ec9,_0x1aea2d){return function(_0x4f20b1){if(!_0x4f20b1){_0x523ec9[_0x60d7('0x1a')](0x194);}return _0x4f20b1;};}function handleError(_0x6e69c6,_0x38eadf){_0x38eadf=_0x38eadf||0x1f4;return function(_0x409ed2){logger[_0x60d7('0x29')](_0x409ed2[_0x60d7('0x2a')]);if(_0x409ed2[_0x60d7('0x2b')]){delete _0x409ed2[_0x60d7('0x2b')];}_0x6e69c6[_0x60d7('0x1b')](_0x38eadf)[_0x60d7('0x2c')](_0x409ed2);};}exports[_0x60d7('0x2d')]=function(_0x169696,_0x36ae5f){var _0x20e5ca={},_0x103ea2={},_0x5d84ea={'count':0x0,'rows':[]};var _0x430865=_[_0x60d7('0x2e')](db[_0x60d7('0x2f')]['rawAttributes'],function(_0x35e407){return{'name':_0x35e407[_0x60d7('0x30')],'type':_0x35e407[_0x60d7('0x31')][_0x60d7('0x32')]};});_0x103ea2[_0x60d7('0x33')]=_[_0x60d7('0x2e')](_0x430865,'name');_0x103ea2['query']=_[_0x60d7('0x34')](_0x169696[_0x60d7('0x35')]);_0x103ea2[_0x60d7('0x36')]=_[_0x60d7('0x37')](_0x103ea2[_0x60d7('0x33')],_0x103ea2['query']);_0x20e5ca[_0x60d7('0x38')]=_[_0x60d7('0x37')](_0x103ea2[_0x60d7('0x33')],qs[_0x60d7('0x39')](_0x169696[_0x60d7('0x35')][_0x60d7('0x39')]));_0x20e5ca[_0x60d7('0x38')]=_0x20e5ca[_0x60d7('0x38')][_0x60d7('0x3a')]?_0x20e5ca['attributes']:_0x103ea2[_0x60d7('0x33')];if(!_0x169696[_0x60d7('0x35')][_0x60d7('0x3b')](_0x60d7('0x3c'))){_0x20e5ca[_0x60d7('0x20')]=qs['limit'](_0x169696[_0x60d7('0x35')][_0x60d7('0x20')]);_0x20e5ca['offset']=qs['offset'](_0x169696[_0x60d7('0x35')][_0x60d7('0x1d')]);}_0x20e5ca['order']=qs[_0x60d7('0x3d')](_0x169696[_0x60d7('0x35')][_0x60d7('0x3d')]);_0x20e5ca['where']=qs[_0x60d7('0x36')](_['pick'](_0x169696[_0x60d7('0x35')],_0x103ea2['filters']),_0x430865);if(_0x169696['query']['filter']){_0x20e5ca[_0x60d7('0x3e')]=_[_0x60d7('0x3f')](_0x20e5ca[_0x60d7('0x3e')],{'$or':_[_0x60d7('0x2e')](_0x430865,function(_0x5f4053){if(_0x5f4053['type']!==_0x60d7('0x40')){var _0x57de67={};_0x57de67[_0x5f4053['name']]={'$like':'%'+_0x169696[_0x60d7('0x35')]['filter']+'%'};return _0x57de67;}})});}_0x20e5ca=_[_0x60d7('0x3f')]({},_0x20e5ca,_0x169696['options']);var _0x28f900={'where':_0x20e5ca['where']};return db['ServicenowAccount'][_0x60d7('0x1f')](_0x28f900)[_0x60d7('0x27')](function(_0x45652b){_0x5d84ea[_0x60d7('0x1f')]=_0x45652b;if(_0x169696[_0x60d7('0x35')][_0x60d7('0x41')]){_0x20e5ca[_0x60d7('0x42')]=[{'all':!![]}];}return db[_0x60d7('0x2f')][_0x60d7('0x43')](_0x20e5ca);})[_0x60d7('0x27')](function(_0x45c348){_0x5d84ea['rows']=_0x45c348;return _0x5d84ea;})[_0x60d7('0x27')](respondWithFilteredResult(_0x36ae5f,_0x20e5ca))[_0x60d7('0x44')](handleError(_0x36ae5f,null));};exports[_0x60d7('0x45')]=function(_0x45f271,_0x5d2055){var _0x36fd00={'raw':![],'where':{'id':_0x45f271[_0x60d7('0x46')]['id']}},_0x1a41f0={};_0x1a41f0[_0x60d7('0x33')]=_[_0x60d7('0x34')](db[_0x60d7('0x2f')]['rawAttributes']);_0x1a41f0[_0x60d7('0x35')]=_[_0x60d7('0x34')](_0x45f271[_0x60d7('0x35')]);_0x1a41f0['filters']=_[_0x60d7('0x37')](_0x1a41f0[_0x60d7('0x33')],_0x1a41f0[_0x60d7('0x35')]);_0x36fd00['attributes']=_[_0x60d7('0x37')](_0x1a41f0[_0x60d7('0x33')],qs[_0x60d7('0x39')](_0x45f271[_0x60d7('0x35')][_0x60d7('0x39')]));_0x36fd00[_0x60d7('0x38')]=_0x36fd00[_0x60d7('0x38')]['length']?_0x36fd00[_0x60d7('0x38')]:_0x1a41f0[_0x60d7('0x33')];if(_0x45f271['query'][_0x60d7('0x41')]){_0x36fd00[_0x60d7('0x42')]=[{'all':!![]}];}_0x36fd00=_[_0x60d7('0x3f')]({},_0x36fd00,_0x45f271[_0x60d7('0x47')]);return db[_0x60d7('0x2f')][_0x60d7('0x48')](_0x36fd00)[_0x60d7('0x27')](handleEntityNotFound(_0x5d2055,null))[_0x60d7('0x27')](respondWithResult(_0x5d2055,null))[_0x60d7('0x44')](handleError(_0x5d2055,null));};exports[_0x60d7('0x49')]=function(_0x3ca5ba,_0xa45780){return db[_0x60d7('0x2f')][_0x60d7('0x49')](_0x3ca5ba[_0x60d7('0x4a')],{})[_0x60d7('0x27')](respondWithResult(_0xa45780,0xc9))[_0x60d7('0x44')](handleError(_0xa45780,null));};exports[_0x60d7('0x26')]=function(_0xa5307c,_0x949cde){if(_0xa5307c['body']['id']){delete _0xa5307c['body']['id'];}return db[_0x60d7('0x2f')][_0x60d7('0x48')]({'where':{'id':_0xa5307c['params']['id']}})[_0x60d7('0x27')](handleEntityNotFound(_0x949cde,null))[_0x60d7('0x27')](saveUpdates(_0xa5307c['body'],null))[_0x60d7('0x27')](respondWithResult(_0x949cde,null))[_0x60d7('0x44')](handleError(_0x949cde,null));};exports[_0x60d7('0x28')]=function(_0x54b8c9,_0x16413f){return db[_0x60d7('0x2f')][_0x60d7('0x48')]({'where':{'id':_0x54b8c9[_0x60d7('0x46')]['id']}})[_0x60d7('0x27')](handleEntityNotFound(_0x16413f,null))[_0x60d7('0x27')](removeEntity(_0x16413f,null))[_0x60d7('0x44')](handleError(_0x16413f,null));};exports[_0x60d7('0x4b')]=function(_0x22bfb3,_0x2ee481,_0x5cfc8f){var _0x28d0d6={};var _0xe66b5c={};var _0x3f287a;var _0x52c2d9;return db[_0x60d7('0x2f')]['findOne']({'where':{'id':_0x22bfb3[_0x60d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ee481,null))[_0x60d7('0x27')](function(_0x1b1764){if(_0x1b1764){_0x3f287a=_0x1b1764;_0xe66b5c[_0x60d7('0x33')]=_[_0x60d7('0x34')](db[_0x60d7('0x4c')]['rawAttributes']);_0xe66b5c['query']=_[_0x60d7('0x34')](_0x22bfb3['query']);_0xe66b5c['filters']=_[_0x60d7('0x37')](_0xe66b5c[_0x60d7('0x33')],_0xe66b5c[_0x60d7('0x35')]);_0x28d0d6[_0x60d7('0x38')]=_[_0x60d7('0x37')](_0xe66b5c[_0x60d7('0x33')],qs['fields'](_0x22bfb3['query'][_0x60d7('0x39')]));_0x28d0d6['attributes']=_0x28d0d6[_0x60d7('0x38')][_0x60d7('0x3a')]?_0x28d0d6[_0x60d7('0x38')]:_0xe66b5c[_0x60d7('0x33')];_0x28d0d6[_0x60d7('0x4d')]=qs[_0x60d7('0x3d')](_0x22bfb3[_0x60d7('0x35')][_0x60d7('0x3d')]);_0x28d0d6['where']=qs[_0x60d7('0x36')](_[_0x60d7('0x4e')](_0x22bfb3[_0x60d7('0x35')],_0xe66b5c[_0x60d7('0x36')]));if(_0x22bfb3['query'][_0x60d7('0x4f')]){_0x28d0d6[_0x60d7('0x3e')]=_[_0x60d7('0x3f')](_0x28d0d6['where'],{'$or':_[_0x60d7('0x2e')](_0x28d0d6['attributes'],function(_0xad3422){var _0xa5fb30={};_0xa5fb30[_0xad3422]={'$like':'%'+_0x22bfb3[_0x60d7('0x35')][_0x60d7('0x4f')]+'%'};return _0xa5fb30;})});}_0x28d0d6=_['merge']({},_0x28d0d6,_0x22bfb3[_0x60d7('0x47')]);return _0x3f287a[_0x60d7('0x4b')](_0x28d0d6);}})[_0x60d7('0x27')](function(_0x32ca19){if(_0x32ca19){_0x52c2d9=_0x32ca19[_0x60d7('0x3a')];if(!_0x22bfb3['query']['hasOwnProperty'](_0x60d7('0x3c'))){_0x28d0d6[_0x60d7('0x20')]=qs[_0x60d7('0x20')](_0x22bfb3[_0x60d7('0x35')][_0x60d7('0x20')]);_0x28d0d6[_0x60d7('0x1d')]=qs[_0x60d7('0x1d')](_0x22bfb3['query']['offset']);}return _0x3f287a[_0x60d7('0x4b')](_0x28d0d6);}})[_0x60d7('0x27')](function(_0x572291){if(_0x572291){return _0x572291?{'count':_0x52c2d9,'rows':_0x572291}:null;}})['then'](respondWithResult(_0x2ee481,null))[_0x60d7('0x44')](handleError(_0x2ee481,null));};exports[_0x60d7('0x50')]=function(_0x5b987e,_0x56db27,_0x381c71){if(_0x5b987e[_0x60d7('0x4a')]['id']){delete _0x5b987e['body']['id'];}return db[_0x60d7('0x2f')][_0x60d7('0x51')]({'where':{'id':_0x5b987e['params']['id']}})[_0x60d7('0x27')](handleEntityNotFound(_0x56db27,null))['then'](function(_0x34e672){if(_0x34e672){_0x5b987e[_0x60d7('0x4a')][_0x60d7('0x52')]=_0x34e672['id'];_0x5b987e[_0x60d7('0x4a')][_0x60d7('0x53')]=integrations[_0x60d7('0x54')](_0x5b987e['body'][_0x60d7('0x55')],_0x5b987e[_0x60d7('0x4a')][_0x60d7('0x31')]);_0x5b987e['body'][_0x60d7('0x56')]=integrations[_0x60d7('0x57')](_0x5b987e[_0x60d7('0x4a')][_0x60d7('0x55')],_0x5b987e['body'][_0x60d7('0x31')]);return db[_0x60d7('0x4c')][_0x60d7('0x49')](_0x5b987e[_0x60d7('0x4a')],{'include':[{'model':db[_0x60d7('0x58')],'as':'Subjects'},{'model':db[_0x60d7('0x58')],'as':'Descriptions'}]});}return null;})[_0x60d7('0x27')](respondWithResult(_0x56db27,null))[_0x60d7('0x44')](handleError(_0x56db27,null));};exports[_0x60d7('0x59')]=function(_0x2b18da,_0x15fe2b,_0x39549a){var _0x2002cf=['made_sla','hold_reason',_0x60d7('0x5a'),_0x60d7('0x5b'),_0x60d7('0x5c'),_0x60d7('0x5d'),_0x60d7('0x5e'),_0x60d7('0x5f'),'category'];var _0x5ace47=['parent',_0x60d7('0x60'),_0x60d7('0x61'),'watch_list','upon_reject',_0x60d7('0x62'),'child_incidents',_0x60d7('0x63'),_0x60d7('0x64'),'number',_0x60d7('0x65'),_0x60d7('0x66'),_0x60d7('0x67'),_0x60d7('0x68'),_0x60d7('0x69'),_0x60d7('0x6a'),'state','sys_created_by',_0x60d7('0x5a'),_0x60d7('0x4d'),_0x60d7('0x6b'),_0x60d7('0x6c'),_0x60d7('0x6d'),_0x60d7('0x6e'),'impact','active',_0x60d7('0x6f'),_0x60d7('0x70'),_0x60d7('0x71'),'sys_domain_path','rfc',_0x60d7('0x72'),_0x60d7('0x73'),_0x60d7('0x74'),_0x60d7('0x75'),_0x60d7('0x76'),_0x60d7('0x77'),'reopened_time',_0x60d7('0x78'),'caller_id',_0x60d7('0x79'),_0x60d7('0x5b'),_0x60d7('0x7a'),_0x60d7('0x7b'),'close_code',_0x60d7('0x7c'),'delivery_task',_0x60d7('0x7d'),_0x60d7('0x7e'),_0x60d7('0x7f'),_0x60d7('0x80'),_0x60d7('0x81'),_0x60d7('0x82'),_0x60d7('0x5d'),'sys_class_name',_0x60d7('0x83'),_0x60d7('0x84'),'follow_up',_0x60d7('0x85'),_0x60d7('0x86'),_0x60d7('0x87'),_0x60d7('0x88'),'incident_state',_0x60d7('0x89'),_0x60d7('0x8a'),_0x60d7('0x8b'),_0x60d7('0x8c'),_0x60d7('0x8d'),_0x60d7('0x8e'),_0x60d7('0x5f'),_0x60d7('0x8f'),_0x60d7('0x90'),_0x60d7('0x91'),_0x60d7('0x92'),_0x60d7('0x93'),_0x60d7('0x94'),_0x60d7('0x95'),'sys_tags',_0x60d7('0x96'),'upon_approval','correlation_id',_0x60d7('0x97'),'category'];var _0x174cd3='';var _0x39ce51='';var _0x9547d7=[];var _0x287390='';var _0x317c68='';var _0x160b9f=[];var _0x5685d7='';var _0x34b070='';var _0x1c04cd={};var _0x583442='';return db[_0x60d7('0x2f')][_0x60d7('0x51')]({'where':{'id':_0x2b18da['params']['id']},'attributes':['id',_0x60d7('0x98'),_0x60d7('0x99'),_0x60d7('0x9a'),_0x60d7('0x9b'),'serverUrl']})[_0x60d7('0x27')](handleEntityNotFound(_0x15fe2b,null))[_0x60d7('0x27')](function(_0xb13c1f){if(_0xb13c1f){_0x583442=_0xb13c1f[_0x60d7('0x9b')];var _0x4345b8=_0x583442['slice'](-0x1);if(_0x4345b8==='/'){_0x583442=_0x583442[_0x60d7('0x9c')](0x0,_0x583442['lastIndexOf'](_0x4345b8));}_0x34b070=util[_0x60d7('0x9d')](_0x60d7('0x9e'),_0x583442);_0x5685d7=util['format'](_0x60d7('0x9f'),_0x583442);_0x1c04cd={'user':_0xb13c1f['username'],'pass':_0xb13c1f[_0x60d7('0x99')]};var _0x39b8e6={'method':_0x60d7('0xa0'),'uri':_0x34b070+_0x60d7('0xa1'),'auth':_0x1c04cd,'json':!![]};return rp(_0x39b8e6);}})['then'](function(_0x28c0c1){if(_0x28c0c1['result'][_0x60d7('0x3a')]>0x0){_0x174cd3=_0x28c0c1['result'];}console[_0x60d7('0xa2')](_0x60d7('0xa3'),_0x174cd3);_0x160b9f=[];_0x39ce51=Object[_0x60d7('0xa4')]([],_0x174cd3);_[_0x60d7('0xa5')](_0x39ce51,function(_0x452db0){return!_0x2002cf[_0x60d7('0xa6')](_0x452db0[_0x60d7('0x2b')]);});_0x39ce51[_0x60d7('0xa7')](function(_0xe0cddb){var _0x127fc1=createFieldObject(_0x5685d7,_0x1c04cd,_0xe0cddb[_0x60d7('0xa8')],_0xe0cddb['name'],_0xe0cddb[_0x60d7('0xa9')],![]);_0x160b9f['push'](_0x127fc1);});return Promise[_0x60d7('0xaa')](_0x160b9f);})['then'](function(_0x5c8755){_0x9547d7=_0x5c8755;_0x287390=Object[_0x60d7('0xa4')]([],_0x174cd3);console[_0x60d7('0xa2')](_0x60d7('0xab'),_0x174cd3);_[_0x60d7('0xa5')](_0x287390,function(_0x431af3){return _0x5ace47[_0x60d7('0xa6')](_0x431af3['name']);});console['log'](_0x60d7('0xac'),_0x287390);_0x160b9f=[];_0x287390[_0x60d7('0xa7')](function(_0x5824b5){var _0x1fd38a=createFieldObject(_0x5685d7,_0x1c04cd,_0x5824b5[_0x60d7('0xa8')],_0x5824b5[_0x60d7('0x2b')],_0x5824b5[_0x60d7('0xa9')],!![]);_0x160b9f[_0x60d7('0xad')](_0x1fd38a);});return Promise[_0x60d7('0xaa')](_0x160b9f);})[_0x60d7('0x27')](function(_0x3245c4){_0x317c68=_0x3245c4;var _0x25fbe9=_0x9547d7[_0x60d7('0xae')](_0x317c68);return{'count':_0x25fbe9[_0x60d7('0x3a')],'rows':_0x25fbe9};})[_0x60d7('0x27')](respondWithResult(_0x15fe2b,null))[_0x60d7('0x44')](function(_0xa226a5){console[_0x60d7('0xa2')]('ServiceNow\x20error:\x20'+_0xa226a5);var _0x39c5ac=_0x2b18da[_0x60d7('0x35')]['test']?0x1f4:_0xa226a5[_0x60d7('0xaf')]||0x1f4;logger[_0x60d7('0x29')](_0xa226a5[_0x60d7('0x2a')]);delete _0xa226a5[_0x60d7('0x2b')];if(_0x39c5ac===0x191){_0x39c5ac=0x190;}_0x15fe2b[_0x60d7('0x1b')](_0x39c5ac)[_0x60d7('0x2c')](_0x2b18da[_0x60d7('0x35')][_0x60d7('0xb0')]?{'message':_0x60d7('0xb1'),'statusCode':_0xa226a5['statusCode']}:_0xa226a5);});};function createFieldObject(_0x5b49bb,_0x2667c9,_0x28d24b,_0x2b76a7,_0x263826,_0x314d79){return new Promise(function(_0x59cf6b,_0x321bcf){var _0x971465={'id':_0x2b76a7,'name':_0x263826,'custom':_0x314d79};if(_0x28d24b===_0x60d7('0xb2')){_0x971465[_0x60d7('0x47')]=[{'name':_0x60d7('0xb3'),'value':_0x60d7('0xb4')},{'name':_0x60d7('0xb5'),'value':_0x60d7('0xb6')}];_0x59cf6b(_0x971465);}else{var _0x4bf9b1={'method':'GET','uri':_0x5b49bb+_0x60d7('0xb7')+_0x2b76a7,'auth':_0x2667c9,'json':!![]};return rp(_0x4bf9b1)[_0x60d7('0x27')](function(_0x3a94d5){var _0x55d2f6=[];if(_0x3a94d5[_0x60d7('0xb8')][_0x60d7('0x3a')]>0x0){_0x3a94d5[_0x60d7('0xb8')][_0x60d7('0xa7')](function(_0x566015){if(_0x566015['inactive']===_0x60d7('0xb6')){var _0x3744cd={'name':_0x566015['label'],'value':_0x566015[_0x60d7('0xb9')]};_0x55d2f6[_0x60d7('0xad')](_0x3744cd);}});}_0x971465[_0x60d7('0x47')]=_0x55d2f6;if(_0x971465[_0x60d7('0x47')][_0x60d7('0x3a')]>0x0){_0x59cf6b(_0x971465);}else{if(_0x314d79==![]){_0x59cf6b();}else{_0x59cf6b(_0x971465);}}});}});} \ No newline at end of file +var _0xea48=['reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','GET','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','business_duration','group_list','work_end'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xea48,0xfb));var _0x8ea4=function(_0x324418,_0xeb0522){_0x324418=_0x324418-0x0;var _0x24e65b=_0xea48[_0x324418];return _0x24e65b;};'use strict';var emlformat=require(_0x8ea4('0x0'));var rimraf=require(_0x8ea4('0x1'));var zipdir=require(_0x8ea4('0x2'));var jsonpatch=require(_0x8ea4('0x3'));var rp=require(_0x8ea4('0x4'));var moment=require(_0x8ea4('0x5'));var BPromise=require(_0x8ea4('0x6'));var Mustache=require(_0x8ea4('0x7'));var util=require(_0x8ea4('0x8'));var path=require(_0x8ea4('0x9'));var sox=require('sox');var csv=require(_0x8ea4('0xa'));var ejs=require(_0x8ea4('0xb'));var fs=require('fs');var fs_extra=require(_0x8ea4('0xc'));var _=require(_0x8ea4('0xd'));var squel=require(_0x8ea4('0xe'));var crypto=require(_0x8ea4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8ea4('0x10'));var toCsv=require(_0x8ea4('0xa'));var querystring=require(_0x8ea4('0x11'));var Papa=require(_0x8ea4('0x12'));var Redis=require(_0x8ea4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8ea4('0x14'));var as=require(_0x8ea4('0x15'));var hardwareService=require(_0x8ea4('0x16'));var logger=require(_0x8ea4('0x17'))(_0x8ea4('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ea4('0x19'));var db=require(_0x8ea4('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x402909,_0x184fc8){_0x184fc8=_0x184fc8||0xcc;return function(_0x4f4e3f){if(_0x4f4e3f){return _0x402909[_0x8ea4('0x1b')](_0x184fc8);}return _0x402909[_0x8ea4('0x1c')](_0x184fc8)[_0x8ea4('0x1d')]();};}function respondWithResult(_0x45598,_0x9aa16e){_0x9aa16e=_0x9aa16e||0xc8;return function(_0x11d541){if(_0x11d541){return _0x45598[_0x8ea4('0x1c')](_0x9aa16e)[_0x8ea4('0x1e')](_0x11d541);}};}function respondWithFilteredResult(_0x1ae196,_0x55457f){return function(_0x53f0f4){if(_0x53f0f4){var _0xb43557=typeof _0x55457f[_0x8ea4('0x1f')]===_0x8ea4('0x20')&&typeof _0x55457f[_0x8ea4('0x21')]===_0x8ea4('0x20');var _0x3b59fc=_0x53f0f4[_0x8ea4('0x22')];var _0x472d66=_0xb43557?0x0:_0x55457f[_0x8ea4('0x1f')];var _0x4ef254=_0xb43557?_0x53f0f4[_0x8ea4('0x22')]:_0x55457f[_0x8ea4('0x1f')]+_0x55457f[_0x8ea4('0x21')];var _0xcbf1d4;if(_0x4ef254>=_0x3b59fc){_0x4ef254=_0x3b59fc;_0xcbf1d4=0xc8;}else{_0xcbf1d4=0xce;}_0x1ae196[_0x8ea4('0x1c')](_0xcbf1d4);return _0x1ae196[_0x8ea4('0x23')](_0x8ea4('0x24'),_0x472d66+'-'+_0x4ef254+'/'+_0x3b59fc)[_0x8ea4('0x1e')](_0x53f0f4);}return null;};}function patchUpdates(_0xae0a0c){return function(_0xd64fab){try{jsonpatch[_0x8ea4('0x25')](_0xd64fab,_0xae0a0c,!![]);}catch(_0x161c75){return BPromise['reject'](_0x161c75);}return _0xd64fab[_0x8ea4('0x26')]();};}function saveUpdates(_0x5b1447,_0x388b44){return function(_0x158571){if(_0x158571){return _0x158571[_0x8ea4('0x27')](_0x5b1447)[_0x8ea4('0x28')](function(_0xeb6be5){return _0xeb6be5;});}return null;};}function removeEntity(_0x200ba1,_0x6882e5){return function(_0x49cf39){if(_0x49cf39){return _0x49cf39[_0x8ea4('0x29')]()['then'](function(){_0x200ba1[_0x8ea4('0x1c')](0xcc)[_0x8ea4('0x1d')]();});}};}function handleEntityNotFound(_0x28b07b,_0x3eb389){return function(_0x22c4b6){if(!_0x22c4b6){_0x28b07b[_0x8ea4('0x1b')](0x194);}return _0x22c4b6;};}function handleError(_0x2102b0,_0x5050b1){_0x5050b1=_0x5050b1||0x1f4;return function(_0x57adbe){logger[_0x8ea4('0x2a')](_0x57adbe[_0x8ea4('0x2b')]);if(_0x57adbe[_0x8ea4('0x2c')]){delete _0x57adbe[_0x8ea4('0x2c')];}_0x2102b0[_0x8ea4('0x1c')](_0x5050b1)[_0x8ea4('0x2d')](_0x57adbe);};}exports[_0x8ea4('0x2e')]=function(_0x4124e1,_0x1d32a6){var _0x5731dd={},_0x111b95={},_0xf09a42={'count':0x0,'rows':[]};var _0x2afe40=_[_0x8ea4('0x2f')](db[_0x8ea4('0x30')][_0x8ea4('0x31')],function(_0x5ba19f){return{'name':_0x5ba19f[_0x8ea4('0x32')],'type':_0x5ba19f[_0x8ea4('0x33')][_0x8ea4('0x34')]};});_0x111b95[_0x8ea4('0x35')]=_[_0x8ea4('0x2f')](_0x2afe40,_0x8ea4('0x2c'));_0x111b95[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x4124e1[_0x8ea4('0x36')]);_0x111b95[_0x8ea4('0x38')]=_[_0x8ea4('0x39')](_0x111b95['model'],_0x111b95[_0x8ea4('0x36')]);_0x5731dd['attributes']=_[_0x8ea4('0x39')](_0x111b95[_0x8ea4('0x35')],qs[_0x8ea4('0x3a')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3a')]));_0x5731dd['attributes']=_0x5731dd[_0x8ea4('0x3b')]['length']?_0x5731dd[_0x8ea4('0x3b')]:_0x111b95[_0x8ea4('0x35')];if(!_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3c')](_0x8ea4('0x3d'))){_0x5731dd[_0x8ea4('0x21')]=qs[_0x8ea4('0x21')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x21')]);_0x5731dd['offset']=qs[_0x8ea4('0x1f')](_0x4124e1[_0x8ea4('0x36')]['offset']);}_0x5731dd[_0x8ea4('0x3e')]=qs[_0x8ea4('0x3f')](_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x3f')]);_0x5731dd[_0x8ea4('0x40')]=qs[_0x8ea4('0x38')](_[_0x8ea4('0x41')](_0x4124e1['query'],_0x111b95[_0x8ea4('0x38')]),_0x2afe40);if(_0x4124e1['query'][_0x8ea4('0x42')]){_0x5731dd[_0x8ea4('0x40')]=_[_0x8ea4('0x43')](_0x5731dd['where'],{'$or':_['map'](_0x2afe40,function(_0x283f25){if(_0x283f25[_0x8ea4('0x33')]!==_0x8ea4('0x44')){var _0x242860={};_0x242860[_0x283f25[_0x8ea4('0x2c')]]={'$like':'%'+_0x4124e1[_0x8ea4('0x36')]['filter']+'%'};return _0x242860;}})});}_0x5731dd=_[_0x8ea4('0x43')]({},_0x5731dd,_0x4124e1[_0x8ea4('0x45')]);var _0x10c8ba={'where':_0x5731dd['where']};return db[_0x8ea4('0x30')][_0x8ea4('0x22')](_0x10c8ba)[_0x8ea4('0x28')](function(_0x51986d){_0xf09a42[_0x8ea4('0x22')]=_0x51986d;if(_0x4124e1[_0x8ea4('0x36')][_0x8ea4('0x46')]){_0x5731dd[_0x8ea4('0x47')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x8ea4('0x48')](_0x5731dd);})[_0x8ea4('0x28')](function(_0x4c329a){_0xf09a42[_0x8ea4('0x49')]=_0x4c329a;return _0xf09a42;})[_0x8ea4('0x28')](respondWithFilteredResult(_0x1d32a6,_0x5731dd))[_0x8ea4('0x4a')](handleError(_0x1d32a6,null));};exports[_0x8ea4('0x4b')]=function(_0x3bdfad,_0x1127de){var _0x30bd93={'raw':![],'where':{'id':_0x3bdfad[_0x8ea4('0x4c')]['id']}},_0x3d6044={};_0x3d6044[_0x8ea4('0x35')]=_[_0x8ea4('0x37')](db[_0x8ea4('0x30')][_0x8ea4('0x31')]);_0x3d6044[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x3bdfad[_0x8ea4('0x36')]);_0x3d6044[_0x8ea4('0x38')]=_[_0x8ea4('0x39')](_0x3d6044['model'],_0x3d6044[_0x8ea4('0x36')]);_0x30bd93[_0x8ea4('0x3b')]=_['intersection'](_0x3d6044['model'],qs[_0x8ea4('0x3a')](_0x3bdfad[_0x8ea4('0x36')]['fields']));_0x30bd93[_0x8ea4('0x3b')]=_0x30bd93['attributes'][_0x8ea4('0x4d')]?_0x30bd93[_0x8ea4('0x3b')]:_0x3d6044[_0x8ea4('0x35')];if(_0x3bdfad[_0x8ea4('0x36')][_0x8ea4('0x46')]){_0x30bd93[_0x8ea4('0x47')]=[{'all':!![]}];}_0x30bd93=_['merge']({},_0x30bd93,_0x3bdfad[_0x8ea4('0x45')]);return db[_0x8ea4('0x30')]['find'](_0x30bd93)[_0x8ea4('0x28')](handleEntityNotFound(_0x1127de,null))[_0x8ea4('0x28')](respondWithResult(_0x1127de,null))[_0x8ea4('0x4a')](handleError(_0x1127de,null));};exports[_0x8ea4('0x4e')]=function(_0x2f8a57,_0x59ece6){return db[_0x8ea4('0x30')][_0x8ea4('0x4e')](_0x2f8a57[_0x8ea4('0x4f')],{})['then'](respondWithResult(_0x59ece6,0xc9))[_0x8ea4('0x4a')](handleError(_0x59ece6,null));};exports[_0x8ea4('0x27')]=function(_0x199b59,_0x17dc17){if(_0x199b59[_0x8ea4('0x4f')]['id']){delete _0x199b59[_0x8ea4('0x4f')]['id'];}return db[_0x8ea4('0x30')][_0x8ea4('0x50')]({'where':{'id':_0x199b59[_0x8ea4('0x4c')]['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x17dc17,null))['then'](saveUpdates(_0x199b59['body'],null))['then'](respondWithResult(_0x17dc17,null))['catch'](handleError(_0x17dc17,null));};exports[_0x8ea4('0x29')]=function(_0x1d4eb6,_0x3d86d5){return db['ServicenowAccount'][_0x8ea4('0x50')]({'where':{'id':_0x1d4eb6[_0x8ea4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d86d5,null))[_0x8ea4('0x28')](removeEntity(_0x3d86d5,null))[_0x8ea4('0x4a')](handleError(_0x3d86d5,null));};exports[_0x8ea4('0x51')]=function(_0x5143aa,_0x43578a,_0x18b547){var _0x13a0b0={};var _0x53db09={};var _0x368617;var _0x4af760;return db[_0x8ea4('0x30')][_0x8ea4('0x52')]({'where':{'id':_0x5143aa['params']['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x43578a,null))['then'](function(_0x654638){if(_0x654638){_0x368617=_0x654638;_0x53db09[_0x8ea4('0x35')]=_[_0x8ea4('0x37')](db['ServicenowConfiguration'][_0x8ea4('0x31')]);_0x53db09[_0x8ea4('0x36')]=_[_0x8ea4('0x37')](_0x5143aa['query']);_0x53db09[_0x8ea4('0x38')]=_['intersection'](_0x53db09['model'],_0x53db09[_0x8ea4('0x36')]);_0x13a0b0[_0x8ea4('0x3b')]=_['intersection'](_0x53db09[_0x8ea4('0x35')],qs[_0x8ea4('0x3a')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3a')]));_0x13a0b0[_0x8ea4('0x3b')]=_0x13a0b0[_0x8ea4('0x3b')]['length']?_0x13a0b0['attributes']:_0x53db09[_0x8ea4('0x35')];_0x13a0b0[_0x8ea4('0x3e')]=qs[_0x8ea4('0x3f')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3f')]);_0x13a0b0[_0x8ea4('0x40')]=qs['filters'](_[_0x8ea4('0x41')](_0x5143aa[_0x8ea4('0x36')],_0x53db09['filters']));if(_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x42')]){_0x13a0b0[_0x8ea4('0x40')]=_[_0x8ea4('0x43')](_0x13a0b0[_0x8ea4('0x40')],{'$or':_[_0x8ea4('0x2f')](_0x13a0b0[_0x8ea4('0x3b')],function(_0x35e4c3){var _0x3e4755={};_0x3e4755[_0x35e4c3]={'$like':'%'+_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x42')]+'%'};return _0x3e4755;})});}_0x13a0b0=_[_0x8ea4('0x43')]({},_0x13a0b0,_0x5143aa['options']);return _0x368617['getConfigurations'](_0x13a0b0);}})['then'](function(_0x337b38){if(_0x337b38){_0x4af760=_0x337b38[_0x8ea4('0x4d')];if(!_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x3c')]('nolimit')){_0x13a0b0['limit']=qs[_0x8ea4('0x21')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x21')]);_0x13a0b0[_0x8ea4('0x1f')]=qs[_0x8ea4('0x1f')](_0x5143aa[_0x8ea4('0x36')][_0x8ea4('0x1f')]);}return _0x368617['getConfigurations'](_0x13a0b0);}})[_0x8ea4('0x28')](function(_0x582995){if(_0x582995){return _0x582995?{'count':_0x4af760,'rows':_0x582995}:null;}})[_0x8ea4('0x28')](respondWithResult(_0x43578a,null))[_0x8ea4('0x4a')](handleError(_0x43578a,null));};exports['addConfiguration']=function(_0x4d2202,_0x4bdd23,_0x53f784){if(_0x4d2202[_0x8ea4('0x4f')]['id']){delete _0x4d2202[_0x8ea4('0x4f')]['id'];}return db[_0x8ea4('0x30')][_0x8ea4('0x52')]({'where':{'id':_0x4d2202[_0x8ea4('0x4c')]['id']}})[_0x8ea4('0x28')](handleEntityNotFound(_0x4bdd23,null))['then'](function(_0x51e623){if(_0x51e623){_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x53')]=_0x51e623['id'];_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x54')]=integrations['getSubjects'](_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x55')],_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x33')]);_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x56')]=integrations[_0x8ea4('0x57')](_0x4d2202['body'][_0x8ea4('0x55')],_0x4d2202[_0x8ea4('0x4f')][_0x8ea4('0x33')]);return db[_0x8ea4('0x58')][_0x8ea4('0x4e')](_0x4d2202[_0x8ea4('0x4f')],{'include':[{'model':db['ServicenowField'],'as':_0x8ea4('0x54')},{'model':db[_0x8ea4('0x59')],'as':_0x8ea4('0x56')}]});}return null;})[_0x8ea4('0x28')](respondWithResult(_0x4bdd23,null))[_0x8ea4('0x4a')](handleError(_0x4bdd23,null));};exports['getFields']=function(_0x403b5c,_0x4d0091,_0x5a1dbf){var _0x2c49df=[_0x8ea4('0x5a'),_0x8ea4('0x5b'),_0x8ea4('0x5c'),'subcategory',_0x8ea4('0x5d'),_0x8ea4('0x5e'),_0x8ea4('0x5f'),_0x8ea4('0x60'),_0x8ea4('0x61')];var _0x33b953=[_0x8ea4('0x62'),'made_sla',_0x8ea4('0x63'),_0x8ea4('0x64'),_0x8ea4('0x65'),'sys_updated_on',_0x8ea4('0x66'),_0x8ea4('0x5b'),_0x8ea4('0x67'),_0x8ea4('0x68'),_0x8ea4('0x69'),'sys_updated_by',_0x8ea4('0x6a'),'user_input',_0x8ea4('0x6b'),_0x8ea4('0x6c'),_0x8ea4('0x6d'),'sys_created_by',_0x8ea4('0x5c'),_0x8ea4('0x3e'),_0x8ea4('0x6e'),_0x8ea4('0x6f'),_0x8ea4('0x70'),'delivery_plan',_0x8ea4('0x71'),_0x8ea4('0x72'),_0x8ea4('0x73'),_0x8ea4('0x74'),_0x8ea4('0x75'),_0x8ea4('0x76'),_0x8ea4('0x77'),'time_worked','expected_start','opened_at',_0x8ea4('0x78'),_0x8ea4('0x79'),_0x8ea4('0x7a'),_0x8ea4('0x7b'),_0x8ea4('0x7c'),_0x8ea4('0x7d'),_0x8ea4('0x7e'),_0x8ea4('0x7f'),_0x8ea4('0x80'),_0x8ea4('0x81'),_0x8ea4('0x5d'),_0x8ea4('0x82'),_0x8ea4('0x83'),_0x8ea4('0x84'),_0x8ea4('0x85'),'business_stc','additional_assignee_list','description','calendar_duration',_0x8ea4('0x5e'),_0x8ea4('0x86'),_0x8ea4('0x87'),'closed_by',_0x8ea4('0x88'),'parent_incident',_0x8ea4('0x89'),_0x8ea4('0x8a'),_0x8ea4('0x8b'),_0x8ea4('0x5f'),'urgency',_0x8ea4('0x8c'),_0x8ea4('0x8d'),_0x8ea4('0x8e'),_0x8ea4('0x8f'),_0x8ea4('0x90'),'severity','comments',_0x8ea4('0x91'),_0x8ea4('0x92'),_0x8ea4('0x93'),_0x8ea4('0x94'),_0x8ea4('0x95'),_0x8ea4('0x96'),'sys_tags',_0x8ea4('0x97'),_0x8ea4('0x98'),_0x8ea4('0x99'),_0x8ea4('0x9a'),_0x8ea4('0x61')];var _0x1217fb='';var _0x3fc1b1='';var _0x395bc6=[];var _0x4c4de5='';var _0x124e9a='';var _0x2d2571=[];var _0x5366a8='';var _0x2c0066='';var _0x395c88={};var _0x4b9178='';return db['ServicenowAccount'][_0x8ea4('0x52')]({'where':{'id':_0x403b5c[_0x8ea4('0x4c')]['id']},'attributes':['id',_0x8ea4('0x9b'),_0x8ea4('0x9c'),_0x8ea4('0x9d'),_0x8ea4('0x9e'),_0x8ea4('0x9f')]})[_0x8ea4('0x28')](handleEntityNotFound(_0x4d0091,null))['then'](function(_0x2d8421){if(_0x2d8421){_0x4b9178=_0x2d8421[_0x8ea4('0x9e')];var _0x55b098=_0x4b9178[_0x8ea4('0xa0')](-0x1);if(_0x55b098==='/'){_0x4b9178=_0x4b9178['substring'](0x0,_0x4b9178['lastIndexOf'](_0x55b098));}_0x2c0066=util[_0x8ea4('0xa1')](_0x8ea4('0xa2'),_0x4b9178);_0x5366a8=util[_0x8ea4('0xa1')]('%s/api/now/table/',_0x4b9178);_0x395c88={'user':_0x2d8421[_0x8ea4('0x9b')],'pass':_0x2d8421[_0x8ea4('0x9c')]};var _0x116715={'method':_0x8ea4('0xa3'),'uri':_0x2c0066+'incident?sysparm_display_value=all','auth':_0x395c88,'json':!![]};return rp(_0x116715);}})[_0x8ea4('0x28')](function(_0x1c0b0d){if(_0x1c0b0d[_0x8ea4('0xa4')]['length']>0x0){_0x1217fb=_0x1c0b0d[_0x8ea4('0xa4')];}console['log'](_0x8ea4('0xa5'),_0x1217fb);_0x2d2571=[];_0x3fc1b1=Object[_0x8ea4('0xa6')]([],_0x1217fb);_['remove'](_0x3fc1b1,function(_0x5bb6ed){return!_0x2c49df[_0x8ea4('0xa7')](_0x5bb6ed[_0x8ea4('0x2c')]);});_0x3fc1b1[_0x8ea4('0xa8')](function(_0x467c6e){var _0x4a4090=createFieldObject(_0x5366a8,_0x395c88,_0x467c6e[_0x8ea4('0xa9')],_0x467c6e[_0x8ea4('0x2c')],_0x467c6e[_0x8ea4('0xaa')],![]);_0x2d2571[_0x8ea4('0xab')](_0x4a4090);});return Promise['all'](_0x2d2571);})[_0x8ea4('0x28')](function(_0x4c2d50){_0x395bc6=_0x4c2d50;_0x4c4de5=Object[_0x8ea4('0xa6')]([],_0x1217fb);console[_0x8ea4('0xac')](_0x8ea4('0xad'),_0x1217fb);_[_0x8ea4('0xae')](_0x4c4de5,function(_0x18c6c9){return _0x33b953[_0x8ea4('0xa7')](_0x18c6c9['name']);});console['log'](_0x8ea4('0xaf'),_0x4c4de5);_0x2d2571=[];_0x4c4de5[_0x8ea4('0xa8')](function(_0x2d0235){var _0x309f4f=createFieldObject(_0x5366a8,_0x395c88,_0x2d0235[_0x8ea4('0xa9')],_0x2d0235[_0x8ea4('0x2c')],_0x2d0235[_0x8ea4('0xaa')],!![]);_0x2d2571[_0x8ea4('0xab')](_0x309f4f);});return Promise[_0x8ea4('0xb0')](_0x2d2571);})[_0x8ea4('0x28')](function(_0x327e39){_0x124e9a=_0x327e39;var _0x378054=_0x395bc6[_0x8ea4('0xb1')](_0x124e9a);return{'count':_0x378054['length'],'rows':_0x378054};})[_0x8ea4('0x28')](respondWithResult(_0x4d0091,null))[_0x8ea4('0x4a')](function(_0x5682b8){console[_0x8ea4('0xac')](_0x8ea4('0xb2')+_0x5682b8);var _0x9f642=_0x403b5c[_0x8ea4('0x36')][_0x8ea4('0xb3')]?0x1f4:_0x5682b8['statusCode']||0x1f4;logger['error'](_0x5682b8[_0x8ea4('0x2b')]);delete _0x5682b8[_0x8ea4('0x2c')];if(_0x9f642===0x191){_0x9f642=0x190;}_0x4d0091[_0x8ea4('0x1c')](_0x9f642)[_0x8ea4('0x2d')](_0x403b5c[_0x8ea4('0x36')][_0x8ea4('0xb3')]?{'message':_0x8ea4('0xb4'),'statusCode':_0x5682b8[_0x8ea4('0xb5')]}:_0x5682b8);});};function createFieldObject(_0x2f43fe,_0x237432,_0x424718,_0x2d9cb8,_0x9954c9,_0x38f1ed){return new Promise(function(_0x26bb47,_0x46580b){var _0xd4e29a={'id':_0x2d9cb8,'name':_0x9954c9,'custom':_0x38f1ed};if(_0x424718===_0x8ea4('0xb6')){_0xd4e29a['options']=[{'name':'True','value':'true'},{'name':_0x8ea4('0xb7'),'value':_0x8ea4('0xb8')}];_0x26bb47(_0xd4e29a);}else{var _0x5d7a89={'method':_0x8ea4('0xa3'),'uri':_0x2f43fe+'sys_choice?sysparm_query=name=incident^element='+_0x2d9cb8,'auth':_0x237432,'json':!![]};return rp(_0x5d7a89)[_0x8ea4('0x28')](function(_0x52e701){var _0x1897e1=[];if(_0x52e701[_0x8ea4('0xa4')][_0x8ea4('0x4d')]>0x0){_0x52e701[_0x8ea4('0xa4')][_0x8ea4('0xa8')](function(_0x324806){if(_0x324806[_0x8ea4('0xb9')]===_0x8ea4('0xb8')){var _0xec0ca9={'name':_0x324806[_0x8ea4('0xaa')],'value':_0x324806[_0x8ea4('0xba')]};_0x1897e1['push'](_0xec0ca9);}});}_0xd4e29a['options']=_0x1897e1;if(_0xd4e29a[_0x8ea4('0x45')][_0x8ea4('0x4d')]>0x0){_0x26bb47(_0xd4e29a);}else{if(_0x38f1ed==![]){_0x26bb47();}else{_0x26bb47(_0xd4e29a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 93baf06..ed6172a 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 _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x41f0ac,_0x642ca){var _0x5aae14=function(_0x3a0d64){while(--_0x3a0d64){_0x41f0ac['push'](_0x41f0ac['shift']());}};_0x5aae14(++_0x642ca);}(_0x5d17,0x114));var _0x75d1=function(_0x290181,_0x46db3e){_0x290181=_0x290181-0x0;var _0x2dc9dc=_0x5d17[_0x290181];return _0x2dc9dc;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));var integrations=require(_0x75d1('0x8'));module['exports']=function(_0x458681,_0x116a51){return _0x458681[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5ce0e5,_0x3ed6cb){var _0x35db2d=function(_0x487572){while(--_0x487572){_0x5ce0e5['push'](_0x5ce0e5['shift']());}};_0x35db2d(++_0x3ed6cb);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'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 1cca483..f4936d5 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 _0xb1bf=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','ShowServicenowAccount','find','stringify','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xb1bf,0x1ae));var _0xfb1b=function(_0x2658c8,_0x5197a3){_0x2658c8=_0x2658c8-0x0;var _0x377f10=_0xb1bf[_0x2658c8];return _0x377f10;};'use strict';var _=require('lodash');var util=require(_0xfb1b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1b('0x1'));var db=require(_0xfb1b('0x2'))['db'];var utils=require(_0xfb1b('0x3'));var logger=require(_0xfb1b('0x4'))(_0xfb1b('0x5'));var config=require(_0xfb1b('0x6'));var jayson=require(_0xfb1b('0x7'));var client=jayson['client'][_0xfb1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2682cc,_0x41dd21,_0x5ecb4a){return new BPromise(function(_0x40b7fd,_0x1de93f){return client[_0xfb1b('0x9')](_0x2682cc,_0x5ecb4a)[_0xfb1b('0xa')](function(_0x312425){logger[_0xfb1b('0xb')](_0xfb1b('0xc'),_0x41dd21,_0xfb1b('0xd'));logger[_0xfb1b('0xe')](_0xfb1b('0xf'),_0x41dd21,_0xfb1b('0xd'),JSON['stringify'](_0x312425));if(_0x312425[_0xfb1b('0x10')]){if(_0x312425['error'][_0xfb1b('0x11')]===0x1f4){logger[_0xfb1b('0x10')](_0xfb1b('0xc'),_0x41dd21,_0x312425[_0xfb1b('0x10')][_0xfb1b('0x12')]);return _0x1de93f(_0x312425[_0xfb1b('0x10')][_0xfb1b('0x12')]);}logger[_0xfb1b('0x10')](_0xfb1b('0xc'),_0x41dd21,_0x312425[_0xfb1b('0x10')][_0xfb1b('0x12')]);return _0x40b7fd(_0x312425[_0xfb1b('0x10')][_0xfb1b('0x12')]);}else{logger['info'](_0xfb1b('0xc'),_0x41dd21,_0xfb1b('0xd'));_0x40b7fd(_0x312425[_0xfb1b('0x13')][_0xfb1b('0x12')]);}})[_0xfb1b('0x14')](function(_0x334e53){logger[_0xfb1b('0x10')](_0xfb1b('0xc'),_0x41dd21,_0x334e53);_0x1de93f(_0x334e53);});});}exports[_0xfb1b('0x15')]=function(_0xb3f565){var _0x3f1985=this;return new Promise(function(_0x5d9fd7,_0x9556dc){return db[_0xfb1b('0x16')][_0xfb1b('0x17')]({'raw':_0xb3f565[_0xfb1b('0x18')]?_0xb3f565[_0xfb1b('0x18')][_0xfb1b('0x19')]===undefined?!![]:![]:!![],'where':_0xb3f565['options']?_0xb3f565[_0xfb1b('0x18')][_0xfb1b('0x1a')]||null:null,'attributes':_0xb3f565[_0xfb1b('0x18')]?_0xb3f565[_0xfb1b('0x18')][_0xfb1b('0x1b')]||null:null,'limit':_0xb3f565['options']?_0xb3f565[_0xfb1b('0x18')]['limit']||null:null,'include':_0xb3f565[_0xfb1b('0x18')]?_0xb3f565[_0xfb1b('0x18')][_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0xb3f565[_0xfb1b('0x18')]['include'],function(_0x370bf4){return{'model':db[_0x370bf4[_0xfb1b('0x1e')]],'as':_0x370bf4['as'],'attributes':_0x370bf4[_0xfb1b('0x1b')],'include':_0x370bf4[_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0x370bf4[_0xfb1b('0x1c')],function(_0x2e8ce6){return{'model':db[_0x2e8ce6[_0xfb1b('0x1e')]],'as':_0x2e8ce6['as'],'attributes':_0x2e8ce6[_0xfb1b('0x1b')],'include':_0x2e8ce6[_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0x2e8ce6[_0xfb1b('0x1c')],function(_0x35c4e6){return{'model':db[_0x35c4e6[_0xfb1b('0x1e')]],'as':_0x35c4e6['as'],'attributes':_0x35c4e6[_0xfb1b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb1b('0xa')](function(_0x1f46ef){logger['info'](_0xfb1b('0x15'),_0xb3f565);logger[_0xfb1b('0xe')](_0xfb1b('0x15'),_0xb3f565,JSON['stringify'](_0x1f46ef));_0x5d9fd7(_0x1f46ef);})['catch'](function(_0x12c0a3){logger[_0xfb1b('0x10')](_0xfb1b('0x15'),_0x12c0a3[_0xfb1b('0x12')],_0xb3f565);_0x9556dc(_0x3f1985[_0xfb1b('0x10')](0x1f4,_0x12c0a3[_0xfb1b('0x12')]));});});};exports[_0xfb1b('0x1f')]=function(_0x50cdf8){var _0x2cb924=this;return new Promise(function(_0xa2c41a,_0x35996d){return db[_0xfb1b('0x16')][_0xfb1b('0x20')]({'raw':_0x50cdf8[_0xfb1b('0x18')]?_0x50cdf8['options']['raw']===undefined?!![]:![]:!![],'where':_0x50cdf8[_0xfb1b('0x18')]?_0x50cdf8[_0xfb1b('0x18')][_0xfb1b('0x1a')]||null:null,'attributes':_0x50cdf8['options']?_0x50cdf8['options'][_0xfb1b('0x1b')]||null:null,'include':_0x50cdf8['options']?_0x50cdf8[_0xfb1b('0x18')][_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0x50cdf8['options'][_0xfb1b('0x1c')],function(_0x333c81){return{'model':db[_0x333c81[_0xfb1b('0x1e')]],'as':_0x333c81['as'],'attributes':_0x333c81[_0xfb1b('0x1b')],'include':_0x333c81[_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0x333c81[_0xfb1b('0x1c')],function(_0x2d5a03){return{'model':db[_0x2d5a03[_0xfb1b('0x1e')]],'as':_0x2d5a03['as'],'attributes':_0x2d5a03[_0xfb1b('0x1b')],'include':_0x2d5a03[_0xfb1b('0x1c')]?_[_0xfb1b('0x1d')](_0x2d5a03['include'],function(_0x36d318){return{'model':db[_0x36d318[_0xfb1b('0x1e')]],'as':_0x36d318['as'],'attributes':_0x36d318['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb1b('0xa')](function(_0x14bc80){logger[_0xfb1b('0xb')](_0xfb1b('0x1f'),_0x50cdf8);logger[_0xfb1b('0xe')](_0xfb1b('0x1f'),_0x50cdf8,JSON[_0xfb1b('0x21')](_0x14bc80));_0xa2c41a(_0x14bc80);})['catch'](function(_0x1799bd){logger[_0xfb1b('0x10')](_0xfb1b('0x1f'),_0x1799bd[_0xfb1b('0x12')],_0x50cdf8);_0x35996d(_0x2cb924['error'](0x1f4,_0x1799bd['message']));});});}; \ No newline at end of file +var _0x3fa9=['map','ShowServicenowAccount','ServicenowAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','model'];(function(_0x3a7b0c,_0x89f976){var _0x26ef80=function(_0x349baf){while(--_0x349baf){_0x3a7b0c['push'](_0x3a7b0c['shift']());}};_0x26ef80(++_0x89f976);}(_0x3fa9,0x19c));var _0x93fa=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3fa9[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x93fa('0x0'));var util=require(_0x93fa('0x1'));var moment=require('moment');var BPromise=require(_0x93fa('0x2'));var rs=require(_0x93fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x93fa('0x5'))(_0x93fa('0x6'));var config=require(_0x93fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d345,_0x18ef9f,_0x89a3d0){return new BPromise(function(_0x9b8d3e,_0xeae901){return client[_0x93fa('0x9')](_0x35d345,_0x89a3d0)[_0x93fa('0xa')](function(_0x1c2c61){logger[_0x93fa('0xb')](_0x93fa('0xc'),_0x18ef9f,_0x93fa('0xd'));logger[_0x93fa('0xe')](_0x93fa('0xf'),_0x18ef9f,_0x93fa('0xd'),JSON[_0x93fa('0x10')](_0x1c2c61));if(_0x1c2c61['error']){if(_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x12')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x18ef9f,_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x13')]);return _0xeae901(_0x1c2c61[_0x93fa('0x11')][_0x93fa('0x13')]);}logger[_0x93fa('0x11')](_0x93fa('0xc'),_0x18ef9f,_0x1c2c61[_0x93fa('0x11')]['message']);return _0x9b8d3e(_0x1c2c61[_0x93fa('0x11')]['message']);}else{logger[_0x93fa('0xb')](_0x93fa('0xc'),_0x18ef9f,'request\x20sent');_0x9b8d3e(_0x1c2c61[_0x93fa('0x14')][_0x93fa('0x13')]);}})[_0x93fa('0x15')](function(_0x402009){logger[_0x93fa('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x18ef9f,_0x402009);_0xeae901(_0x402009);});});}exports[_0x93fa('0x16')]=function(_0x242cc0){var _0x2d563a=this;return new Promise(function(_0x54c5b0,_0x2353bc){return db['ServicenowAccount'][_0x93fa('0x17')]({'raw':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x19')]||null:null,'attributes':_0x242cc0['options']?_0x242cc0['options'][_0x93fa('0x1a')]||null:null,'limit':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x1b')]||null:null,'include':_0x242cc0[_0x93fa('0x18')]?_0x242cc0[_0x93fa('0x18')][_0x93fa('0x1c')]?_['map'](_0x242cc0[_0x93fa('0x18')]['include'],function(_0x21f43a){return{'model':db[_0x21f43a[_0x93fa('0x1d')]],'as':_0x21f43a['as'],'attributes':_0x21f43a[_0x93fa('0x1a')],'include':_0x21f43a[_0x93fa('0x1c')]?_[_0x93fa('0x1e')](_0x21f43a[_0x93fa('0x1c')],function(_0x1beedb){return{'model':db[_0x1beedb[_0x93fa('0x1d')]],'as':_0x1beedb['as'],'attributes':_0x1beedb[_0x93fa('0x1a')],'include':_0x1beedb['include']?_['map'](_0x1beedb[_0x93fa('0x1c')],function(_0x238d7d){return{'model':db[_0x238d7d[_0x93fa('0x1d')]],'as':_0x238d7d['as'],'attributes':_0x238d7d['attributes']};}):[]};}):[]};}):[]:[]})[_0x93fa('0xa')](function(_0x2ea508){logger[_0x93fa('0xb')](_0x93fa('0x16'),_0x242cc0);logger[_0x93fa('0xe')](_0x93fa('0x16'),_0x242cc0,JSON['stringify'](_0x2ea508));_0x54c5b0(_0x2ea508);})[_0x93fa('0x15')](function(_0x44533a){logger[_0x93fa('0x11')](_0x93fa('0x16'),_0x44533a[_0x93fa('0x13')],_0x242cc0);_0x2353bc(_0x2d563a['error'](0x1f4,_0x44533a[_0x93fa('0x13')]));});});};exports[_0x93fa('0x1f')]=function(_0x39ad48){var _0x40b4aa=this;return new Promise(function(_0x30d012,_0x1c0803){return db[_0x93fa('0x20')][_0x93fa('0x21')]({'raw':_0x39ad48[_0x93fa('0x18')]?_0x39ad48[_0x93fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39ad48[_0x93fa('0x18')]?_0x39ad48['options']['where']||null:null,'attributes':_0x39ad48['options']?_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1a')]||null:null,'include':_0x39ad48['options']?_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1c')]?_['map'](_0x39ad48[_0x93fa('0x18')][_0x93fa('0x1c')],function(_0x2f12f2){return{'model':db[_0x2f12f2[_0x93fa('0x1d')]],'as':_0x2f12f2['as'],'attributes':_0x2f12f2[_0x93fa('0x1a')],'include':_0x2f12f2['include']?_[_0x93fa('0x1e')](_0x2f12f2['include'],function(_0x5819e8){return{'model':db[_0x5819e8[_0x93fa('0x1d')]],'as':_0x5819e8['as'],'attributes':_0x5819e8[_0x93fa('0x1a')],'include':_0x5819e8[_0x93fa('0x1c')]?_[_0x93fa('0x1e')](_0x5819e8[_0x93fa('0x1c')],function(_0x2bdca9){return{'model':db[_0x2bdca9[_0x93fa('0x1d')]],'as':_0x2bdca9['as'],'attributes':_0x2bdca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x93fa('0xa')](function(_0x517fc3){logger['info'](_0x93fa('0x1f'),_0x39ad48);logger[_0x93fa('0xe')](_0x93fa('0x1f'),_0x39ad48,JSON[_0x93fa('0x10')](_0x517fc3));_0x30d012(_0x517fc3);})[_0x93fa('0x15')](function(_0x15837d){logger['error'](_0x93fa('0x1f'),_0x15837d[_0x93fa('0x13')],_0x39ad48);_0x1c0803(_0x40b4aa['error'](0x1f4,_0x15837d[_0x93fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 947da5a..448203f 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 _0x96cc=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x220ae4,_0x2a608c){var _0x5c8893=function(_0x4bac32){while(--_0x4bac32){_0x220ae4['push'](_0x220ae4['shift']());}};_0x5c8893(++_0x2a608c);}(_0x96cc,0x170));var _0xc96c=function(_0x625492,_0x1cd944){_0x625492=_0x625492-0x0;var _0x296b94=_0x96cc[_0x625492];return _0x296b94;};'use strict';var multer=require('multer');var util=require(_0xc96c('0x0'));var path=require(_0xc96c('0x1'));var timeout=require(_0xc96c('0x2'));var express=require(_0xc96c('0x3'));var router=express[_0xc96c('0x4')]();var fs_extra=require(_0xc96c('0x5'));var auth=require(_0xc96c('0x6'));var interaction=require(_0xc96c('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0xc96c('0x8')]('/',auth['isAuthenticated'](),controller[_0xc96c('0x9')]);router[_0xc96c('0x8')](_0xc96c('0xa'),auth[_0xc96c('0xb')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x8')](_0xc96c('0xd'),auth[_0xc96c('0xb')](),controller[_0xc96c('0xe')]);router[_0xc96c('0x8')](_0xc96c('0xf'),auth[_0xc96c('0xb')](),controller[_0xc96c('0x10')]);router[_0xc96c('0x8')](_0xc96c('0x11'),auth[_0xc96c('0xb')](),controller['getDescriptions']);router[_0xc96c('0x12')]('/',auth[_0xc96c('0xb')](),controller[_0xc96c('0x13')]);router[_0xc96c('0x14')](_0xc96c('0xa'),auth[_0xc96c('0xb')](),controller['update']);router['delete'](_0xc96c('0xa'),auth[_0xc96c('0xb')](),controller['destroy']);module[_0xc96c('0x15')]=router; \ No newline at end of file +var _0x91c1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getDescriptions','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4cc765,_0x136732){var _0x5e4a03=function(_0x4042e5){while(--_0x4042e5){_0x4cc765['push'](_0x4cc765['shift']());}};_0x5e4a03(++_0x136732);}(_0x91c1,0xcc));var _0x191c=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x91c1[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0x191c('0x0'));var util=require(_0x191c('0x1'));var path=require(_0x191c('0x2'));var timeout=require(_0x191c('0x3'));var express=require(_0x191c('0x4'));var router=express[_0x191c('0x5')]();var fs_extra=require(_0x191c('0x6'));var auth=require(_0x191c('0x7'));var interaction=require(_0x191c('0x8'));var config=require(_0x191c('0x9'));var controller=require(_0x191c('0xa'));router[_0x191c('0xb')]('/',auth[_0x191c('0xc')](),controller['index']);router[_0x191c('0xb')](_0x191c('0xd'),auth[_0x191c('0xc')](),controller[_0x191c('0xe')]);router['get']('/:id/fields',auth[_0x191c('0xc')](),controller[_0x191c('0xf')]);router[_0x191c('0xb')](_0x191c('0x10'),auth[_0x191c('0xc')](),controller['getSubjects']);router[_0x191c('0xb')]('/:id/descriptions',auth[_0x191c('0xc')](),controller[_0x191c('0x11')]);router['post']('/',auth[_0x191c('0xc')](),controller[_0x191c('0x12')]);router[_0x191c('0x13')](_0x191c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x191c('0x14')](_0x191c('0xd'),auth[_0x191c('0xc')](),controller[_0x191c('0x15')]);module[_0x191c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7d09311..838733c 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 _0x2b85=['sequelize','exports','STRING'];(function(_0x2a6472,_0x58274e){var _0x5a6f9c=function(_0x16b5ec){while(--_0x16b5ec){_0x2a6472['push'](_0x2a6472['shift']());}};_0x5a6f9c(++_0x58274e);}(_0x2b85,0x141));var _0x52b8=function(_0x2d011f,_0xc9d0d2){_0x2d011f=_0x2d011f-0x0;var _0x4938bb=_0x2b85[_0x2d011f];return _0x4938bb;};'use strict';var Sequelize=require(_0x52b8('0x0'));module[_0x52b8('0x1')]={'name':{'type':Sequelize[_0x52b8('0x2')]},'description':{'type':Sequelize[_0x52b8('0x2')]}}; \ No newline at end of file +var _0x9a0b=['exports','STRING','sequelize'];(function(_0x60277,_0x1e776a){var _0x1f48aa=function(_0x2f3972){while(--_0x2f3972){_0x60277['push'](_0x60277['shift']());}};_0x1f48aa(++_0x1e776a);}(_0x9a0b,0xc8));var _0xb9a0=function(_0xbdf0a0,_0x3d8e11){_0xbdf0a0=_0xbdf0a0-0x0;var _0x1d562a=_0x9a0b[_0xbdf0a0];return _0x1d562a;};'use strict';var Sequelize=require(_0xb9a0('0x0'));module[_0xb9a0('0x1')]={'name':{'type':Sequelize[_0xb9a0('0x2')]},'description':{'type':Sequelize[_0xb9a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 24101fa..4d3e2af 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 _0x64fb=['eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','catch','show','params','keys','length','includeAll','options','body','find','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions'];(function(_0x1a8688,_0x254bd2){var _0x304dcf=function(_0x442794){while(--_0x442794){_0x1a8688['push'](_0x1a8688['shift']());}};_0x304dcf(++_0x254bd2);}(_0x64fb,0x94));var _0xb64f=function(_0x455105,_0xf43fef){_0x455105=_0x455105-0x0;var _0x25bc3a=_0x64fb[_0x455105];return _0x25bc3a;};'use strict';var emlformat=require(_0xb64f('0x0'));var rimraf=require(_0xb64f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb64f('0x2'));var moment=require(_0xb64f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb64f('0x4'));var util=require(_0xb64f('0x5'));var path=require(_0xb64f('0x6'));var sox=require(_0xb64f('0x7'));var csv=require(_0xb64f('0x8'));var ejs=require(_0xb64f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb64f('0xa'));var squel=require('squel');var crypto=require(_0xb64f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb64f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb64f('0xd'));var Papa=require(_0xb64f('0xe'));var Redis=require(_0xb64f('0xf'));var authService=require(_0xb64f('0x10'));var qs=require(_0xb64f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb64f('0x12'));var logger=require(_0xb64f('0x13'))(_0xb64f('0x14'));var utils=require(_0xb64f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb64f('0x16'));var db=require(_0xb64f('0x17'))['db'];function respondWithStatusCode(_0x5ac5e4,_0x108eda){_0x108eda=_0x108eda||0xcc;return function(_0x3b2ca4){if(_0x3b2ca4){return _0x5ac5e4['sendStatus'](_0x108eda);}return _0x5ac5e4[_0xb64f('0x18')](_0x108eda)[_0xb64f('0x19')]();};}function respondWithResult(_0x3c9985,_0x27134e){_0x27134e=_0x27134e||0xc8;return function(_0x2a23d5){if(_0x2a23d5){return _0x3c9985[_0xb64f('0x18')](_0x27134e)['json'](_0x2a23d5);}};}function respondWithFilteredResult(_0x3e9fb3,_0x5413c2){return function(_0x289e1e){if(_0x289e1e){var _0x1171ee=typeof _0x5413c2[_0xb64f('0x1a')]===_0xb64f('0x1b')&&typeof _0x5413c2[_0xb64f('0x1c')]===_0xb64f('0x1b');var _0x1073ab=_0x289e1e['count'];var _0x4c5980=_0x1171ee?0x0:_0x5413c2[_0xb64f('0x1a')];var _0x3354c4=_0x1171ee?_0x289e1e[_0xb64f('0x1d')]:_0x5413c2['offset']+_0x5413c2[_0xb64f('0x1c')];var _0x3c8b88;if(_0x3354c4>=_0x1073ab){_0x3354c4=_0x1073ab;_0x3c8b88=0xc8;}else{_0x3c8b88=0xce;}_0x3e9fb3[_0xb64f('0x18')](_0x3c8b88);return _0x3e9fb3[_0xb64f('0x1e')]('Content-Range',_0x4c5980+'-'+_0x3354c4+'/'+_0x1073ab)['json'](_0x289e1e);}return null;};}function patchUpdates(_0x124e0b){return function(_0x1daecc){try{jsonpatch[_0xb64f('0x1f')](_0x1daecc,_0x124e0b,!![]);}catch(_0x25516d){return BPromise['reject'](_0x25516d);}return _0x1daecc[_0xb64f('0x20')]();};}function saveUpdates(_0x2dd5b5,_0x110a1f){return function(_0x57b557){if(_0x57b557){return _0x57b557[_0xb64f('0x21')](_0x2dd5b5)[_0xb64f('0x22')](function(_0x3601ab){return _0x3601ab;});}return null;};}function removeEntity(_0x49e604,_0x4bcc52){return function(_0x444e6e){if(_0x444e6e){return _0x444e6e[_0xb64f('0x23')]()['then'](function(){_0x49e604[_0xb64f('0x18')](0xcc)[_0xb64f('0x19')]();});}};}function handleEntityNotFound(_0x454bcf,_0x4375c0){return function(_0x45d988){if(!_0x45d988){_0x454bcf[_0xb64f('0x24')](0x194);}return _0x45d988;};}function handleError(_0x1c19ef,_0x19030e){_0x19030e=_0x19030e||0x1f4;return function(_0x1261e5){logger['error'](_0x1261e5[_0xb64f('0x25')]);if(_0x1261e5[_0xb64f('0x26')]){delete _0x1261e5['name'];}_0x1c19ef[_0xb64f('0x18')](_0x19030e)['send'](_0x1261e5);};}exports[_0xb64f('0x27')]=function(_0x8be151,_0x156c46){var _0x1e7bdd={},_0x42ee25={},_0x1aa676={'count':0x0,'rows':[]};var _0x11fdea=_[_0xb64f('0x28')](db[_0xb64f('0x29')][_0xb64f('0x2a')],function(_0x107618){return{'name':_0x107618[_0xb64f('0x2b')],'type':_0x107618[_0xb64f('0x2c')]['key']};});_0x42ee25[_0xb64f('0x2d')]=_[_0xb64f('0x28')](_0x11fdea,'name');_0x42ee25[_0xb64f('0x2e')]=_['keys'](_0x8be151[_0xb64f('0x2e')]);_0x42ee25[_0xb64f('0x2f')]=_[_0xb64f('0x30')](_0x42ee25[_0xb64f('0x2d')],_0x42ee25[_0xb64f('0x2e')]);_0x1e7bdd[_0xb64f('0x31')]=_[_0xb64f('0x30')](_0x42ee25[_0xb64f('0x2d')],qs[_0xb64f('0x32')](_0x8be151[_0xb64f('0x2e')]['fields']));_0x1e7bdd[_0xb64f('0x31')]=_0x1e7bdd[_0xb64f('0x31')]['length']?_0x1e7bdd[_0xb64f('0x31')]:_0x42ee25[_0xb64f('0x2d')];if(!_0x8be151[_0xb64f('0x2e')][_0xb64f('0x33')]('nolimit')){_0x1e7bdd[_0xb64f('0x1c')]=qs[_0xb64f('0x1c')](_0x8be151[_0xb64f('0x2e')]['limit']);_0x1e7bdd[_0xb64f('0x1a')]=qs[_0xb64f('0x1a')](_0x8be151[_0xb64f('0x2e')][_0xb64f('0x1a')]);}_0x1e7bdd[_0xb64f('0x34')]=qs['sort'](_0x8be151[_0xb64f('0x2e')][_0xb64f('0x35')]);_0x1e7bdd['where']=qs['filters'](_[_0xb64f('0x36')](_0x8be151[_0xb64f('0x2e')],_0x42ee25[_0xb64f('0x2f')]),_0x11fdea);if(_0x8be151[_0xb64f('0x2e')][_0xb64f('0x37')]){_0x1e7bdd[_0xb64f('0x38')]=_['merge'](_0x1e7bdd['where'],{'$or':_[_0xb64f('0x28')](_0x11fdea,function(_0x2a6e2a){if(_0x2a6e2a[_0xb64f('0x2c')]!==_0xb64f('0x39')){var _0x193109={};_0x193109[_0x2a6e2a[_0xb64f('0x26')]]={'$like':'%'+_0x8be151['query'][_0xb64f('0x37')]+'%'};return _0x193109;}})});}_0x1e7bdd=_[_0xb64f('0x3a')]({},_0x1e7bdd,_0x8be151['options']);var _0x329cb0={'where':_0x1e7bdd[_0xb64f('0x38')]};return db['ServicenowConfiguration'][_0xb64f('0x1d')](_0x329cb0)[_0xb64f('0x22')](function(_0x240489){_0x1aa676[_0xb64f('0x1d')]=_0x240489;if(_0x8be151['query']['includeAll']){_0x1e7bdd['include']=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x1e7bdd);})[_0xb64f('0x22')](function(_0x559ce2){_0x1aa676['rows']=_0x559ce2;return _0x1aa676;})[_0xb64f('0x22')](respondWithFilteredResult(_0x156c46,_0x1e7bdd))[_0xb64f('0x3b')](handleError(_0x156c46,null));};exports[_0xb64f('0x3c')]=function(_0x427ae5,_0x5ab72e){var _0x384b49={'raw':![],'where':{'id':_0x427ae5[_0xb64f('0x3d')]['id']}},_0xebfd9c={};_0xebfd9c[_0xb64f('0x2d')]=_[_0xb64f('0x3e')](db['ServicenowConfiguration'][_0xb64f('0x2a')]);_0xebfd9c[_0xb64f('0x2e')]=_['keys'](_0x427ae5[_0xb64f('0x2e')]);_0xebfd9c['filters']=_['intersection'](_0xebfd9c[_0xb64f('0x2d')],_0xebfd9c[_0xb64f('0x2e')]);_0x384b49[_0xb64f('0x31')]=_['intersection'](_0xebfd9c[_0xb64f('0x2d')],qs['fields'](_0x427ae5[_0xb64f('0x2e')][_0xb64f('0x32')]));_0x384b49[_0xb64f('0x31')]=_0x384b49[_0xb64f('0x31')][_0xb64f('0x3f')]?_0x384b49[_0xb64f('0x31')]:_0xebfd9c['model'];if(_0x427ae5[_0xb64f('0x2e')][_0xb64f('0x40')]){_0x384b49['include']=[{'all':!![]}];}_0x384b49=_[_0xb64f('0x3a')]({},_0x384b49,_0x427ae5[_0xb64f('0x41')]);return db['ServicenowConfiguration']['find'](_0x384b49)['then'](handleEntityNotFound(_0x5ab72e,null))[_0xb64f('0x22')](respondWithResult(_0x5ab72e,null))[_0xb64f('0x3b')](handleError(_0x5ab72e,null));};exports['create']=function(_0x21428c,_0x4aa49d){return db['ServicenowConfiguration']['create'](_0x21428c['body'],{})[_0xb64f('0x22')](respondWithResult(_0x4aa49d,0xc9))['catch'](handleError(_0x4aa49d,null));};exports[_0xb64f('0x21')]=function(_0x3eb8dd,_0x5d81b5){if(_0x3eb8dd[_0xb64f('0x42')]['id']){delete _0x3eb8dd[_0xb64f('0x42')]['id'];}return db[_0xb64f('0x29')]['find']({'where':{'id':_0x3eb8dd[_0xb64f('0x3d')]['id']}})[_0xb64f('0x22')](handleEntityNotFound(_0x5d81b5,null))[_0xb64f('0x22')](saveUpdates(_0x3eb8dd[_0xb64f('0x42')],null))['then'](respondWithResult(_0x5d81b5,null))[_0xb64f('0x3b')](handleError(_0x5d81b5,null));};exports['destroy']=function(_0x53cbf9,_0x371029){return db[_0xb64f('0x29')][_0xb64f('0x43')]({'where':{'id':_0x53cbf9[_0xb64f('0x3d')]['id']}})[_0xb64f('0x22')](handleEntityNotFound(_0x371029,null))[_0xb64f('0x22')](removeEntity(_0x371029,null))['catch'](handleError(_0x371029,null));};exports[_0xb64f('0x44')]=function(_0x2f2611,_0x2225e6,_0x4f63b8){var _0xe56656={};var _0x3feb1b={};var _0x13521e;var _0x2f2c06;return db['ServicenowConfiguration'][_0xb64f('0x45')]({'where':{'id':_0x2f2611[_0xb64f('0x3d')]['id']}})[_0xb64f('0x22')](handleEntityNotFound(_0x2225e6,null))[_0xb64f('0x22')](function(_0x59833a){if(_0x59833a){_0x13521e=_0x59833a;_0x3feb1b['model']=_['keys'](db['ServicenowField'][_0xb64f('0x2a')]);_0x3feb1b[_0xb64f('0x2e')]=_['keys'](_0x2f2611[_0xb64f('0x2e')]);_0x3feb1b[_0xb64f('0x2f')]=_[_0xb64f('0x30')](_0x3feb1b[_0xb64f('0x2d')],_0x3feb1b[_0xb64f('0x2e')]);_0xe56656[_0xb64f('0x31')]=_[_0xb64f('0x30')](_0x3feb1b[_0xb64f('0x2d')],qs['fields'](_0x2f2611[_0xb64f('0x2e')]['fields']));_0xe56656[_0xb64f('0x31')]=_0xe56656['attributes']['length']?_0xe56656[_0xb64f('0x31')]:_0x3feb1b['model'];_0xe56656[_0xb64f('0x34')]=qs[_0xb64f('0x35')](_0x2f2611[_0xb64f('0x2e')][_0xb64f('0x35')]);_0xe56656[_0xb64f('0x38')]=qs[_0xb64f('0x2f')](_[_0xb64f('0x36')](_0x2f2611['query'],_0x3feb1b[_0xb64f('0x2f')]));if(_0x2f2611[_0xb64f('0x2e')]['filter']){_0xe56656[_0xb64f('0x38')]=_[_0xb64f('0x3a')](_0xe56656[_0xb64f('0x38')],{'$or':_[_0xb64f('0x28')](_0xe56656[_0xb64f('0x31')],function(_0x559932){var _0x1fdf90={};_0x1fdf90[_0x559932]={'$like':'%'+_0x2f2611[_0xb64f('0x2e')][_0xb64f('0x37')]+'%'};return _0x1fdf90;})});}_0xe56656=_[_0xb64f('0x3a')]({},_0xe56656,_0x2f2611['options']);return _0x13521e[_0xb64f('0x44')](_0xe56656);}})[_0xb64f('0x22')](function(_0x3573a4){if(_0x3573a4){_0x2f2c06=_0x3573a4[_0xb64f('0x3f')];if(!_0x2f2611[_0xb64f('0x2e')][_0xb64f('0x33')](_0xb64f('0x46'))){_0xe56656['limit']=qs[_0xb64f('0x1c')](_0x2f2611[_0xb64f('0x2e')]['limit']);_0xe56656[_0xb64f('0x1a')]=qs[_0xb64f('0x1a')](_0x2f2611['query']['offset']);}return _0x13521e[_0xb64f('0x44')](_0xe56656);}})[_0xb64f('0x22')](function(_0x125009){if(_0x125009){return _0x125009?{'count':_0x2f2c06,'rows':_0x125009}:null;}})[_0xb64f('0x22')](respondWithResult(_0x2225e6,null))[_0xb64f('0x3b')](handleError(_0x2225e6,null));};exports[_0xb64f('0x47')]=function(_0xdea7b3,_0xf1fa51,_0x5008ba){var _0x493ef8={};var _0x1d73b9={};var _0x4110ac;var _0xd2ced8;return db[_0xb64f('0x29')][_0xb64f('0x45')]({'where':{'id':_0xdea7b3['params']['id']}})[_0xb64f('0x22')](handleEntityNotFound(_0xf1fa51,null))[_0xb64f('0x22')](function(_0x14555f){if(_0x14555f){_0x4110ac=_0x14555f;_0x1d73b9[_0xb64f('0x2d')]=_[_0xb64f('0x3e')](db['ServicenowField'][_0xb64f('0x2a')]);_0x1d73b9[_0xb64f('0x2e')]=_[_0xb64f('0x3e')](_0xdea7b3[_0xb64f('0x2e')]);_0x1d73b9[_0xb64f('0x2f')]=_['intersection'](_0x1d73b9[_0xb64f('0x2d')],_0x1d73b9[_0xb64f('0x2e')]);_0x493ef8[_0xb64f('0x31')]=_[_0xb64f('0x30')](_0x1d73b9['model'],qs[_0xb64f('0x32')](_0xdea7b3[_0xb64f('0x2e')]['fields']));_0x493ef8[_0xb64f('0x31')]=_0x493ef8[_0xb64f('0x31')]['length']?_0x493ef8[_0xb64f('0x31')]:_0x1d73b9[_0xb64f('0x2d')];_0x493ef8[_0xb64f('0x34')]=qs[_0xb64f('0x35')](_0xdea7b3[_0xb64f('0x2e')][_0xb64f('0x35')]);_0x493ef8['where']=qs['filters'](_['pick'](_0xdea7b3['query'],_0x1d73b9['filters']));if(_0xdea7b3[_0xb64f('0x2e')][_0xb64f('0x37')]){_0x493ef8[_0xb64f('0x38')]=_[_0xb64f('0x3a')](_0x493ef8[_0xb64f('0x38')],{'$or':_['map'](_0x493ef8[_0xb64f('0x31')],function(_0x5b0f6c){var _0x42a0c1={};_0x42a0c1[_0x5b0f6c]={'$like':'%'+_0xdea7b3[_0xb64f('0x2e')][_0xb64f('0x37')]+'%'};return _0x42a0c1;})});}_0x493ef8=_['merge']({},_0x493ef8,_0xdea7b3[_0xb64f('0x41')]);return _0x4110ac[_0xb64f('0x47')](_0x493ef8);}})[_0xb64f('0x22')](function(_0x270aa8){if(_0x270aa8){_0xd2ced8=_0x270aa8[_0xb64f('0x3f')];if(!_0xdea7b3[_0xb64f('0x2e')]['hasOwnProperty'](_0xb64f('0x46'))){_0x493ef8[_0xb64f('0x1c')]=qs[_0xb64f('0x1c')](_0xdea7b3[_0xb64f('0x2e')][_0xb64f('0x1c')]);_0x493ef8[_0xb64f('0x1a')]=qs[_0xb64f('0x1a')](_0xdea7b3[_0xb64f('0x2e')]['offset']);}return _0x4110ac[_0xb64f('0x47')](_0x493ef8);}})['then'](function(_0x58f1c7){if(_0x58f1c7){return _0x58f1c7?{'count':_0xd2ced8,'rows':_0x58f1c7}:null;}})[_0xb64f('0x22')](respondWithResult(_0xf1fa51,null))[_0xb64f('0x3b')](handleError(_0xf1fa51,null));};exports['getDescriptions']=function(_0x17356e,_0x313b9a,_0x59db08){var _0x3f1e6c={};var _0xab8eb0={};var _0x816936;var _0x4f0a79;return db[_0xb64f('0x29')]['findOne']({'where':{'id':_0x17356e[_0xb64f('0x3d')]['id']}})[_0xb64f('0x22')](handleEntityNotFound(_0x313b9a,null))['then'](function(_0x31b78b){if(_0x31b78b){_0x816936=_0x31b78b;_0xab8eb0['model']=_[_0xb64f('0x3e')](db[_0xb64f('0x48')]['rawAttributes']);_0xab8eb0[_0xb64f('0x2e')]=_[_0xb64f('0x3e')](_0x17356e['query']);_0xab8eb0[_0xb64f('0x2f')]=_[_0xb64f('0x30')](_0xab8eb0[_0xb64f('0x2d')],_0xab8eb0[_0xb64f('0x2e')]);_0x3f1e6c['attributes']=_[_0xb64f('0x30')](_0xab8eb0[_0xb64f('0x2d')],qs[_0xb64f('0x32')](_0x17356e[_0xb64f('0x2e')][_0xb64f('0x32')]));_0x3f1e6c[_0xb64f('0x31')]=_0x3f1e6c['attributes'][_0xb64f('0x3f')]?_0x3f1e6c[_0xb64f('0x31')]:_0xab8eb0[_0xb64f('0x2d')];_0x3f1e6c['order']=qs['sort'](_0x17356e[_0xb64f('0x2e')][_0xb64f('0x35')]);_0x3f1e6c[_0xb64f('0x38')]=qs[_0xb64f('0x2f')](_[_0xb64f('0x36')](_0x17356e[_0xb64f('0x2e')],_0xab8eb0[_0xb64f('0x2f')]));if(_0x17356e[_0xb64f('0x2e')][_0xb64f('0x37')]){_0x3f1e6c['where']=_['merge'](_0x3f1e6c[_0xb64f('0x38')],{'$or':_[_0xb64f('0x28')](_0x3f1e6c[_0xb64f('0x31')],function(_0x77e5c4){var _0x2eca7c={};_0x2eca7c[_0x77e5c4]={'$like':'%'+_0x17356e[_0xb64f('0x2e')]['filter']+'%'};return _0x2eca7c;})});}_0x3f1e6c=_[_0xb64f('0x3a')]({},_0x3f1e6c,_0x17356e[_0xb64f('0x41')]);return _0x816936[_0xb64f('0x49')](_0x3f1e6c);}})[_0xb64f('0x22')](function(_0x2c2938){if(_0x2c2938){_0x4f0a79=_0x2c2938[_0xb64f('0x3f')];if(!_0x17356e['query'][_0xb64f('0x33')]('nolimit')){_0x3f1e6c[_0xb64f('0x1c')]=qs[_0xb64f('0x1c')](_0x17356e[_0xb64f('0x2e')][_0xb64f('0x1c')]);_0x3f1e6c[_0xb64f('0x1a')]=qs[_0xb64f('0x1a')](_0x17356e[_0xb64f('0x2e')][_0xb64f('0x1a')]);}return _0x816936[_0xb64f('0x49')](_0x3f1e6c);}})[_0xb64f('0x22')](function(_0x352bd7){if(_0x352bd7){return _0x352bd7?{'count':_0x4f0a79,'rows':_0x352bd7}:null;}})[_0xb64f('0x22')](respondWithResult(_0x313b9a,null))['catch'](handleError(_0x313b9a,null));}; \ No newline at end of file +var _0xb66b=['save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll','find','create','body','params','getFields','findOne','ServicenowField','options','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb66b,0xd7));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbb66('0x0'));var rimraf=require(_0xbb66('0x1'));var zipdir=require(_0xbb66('0x2'));var jsonpatch=require(_0xbb66('0x3'));var rp=require(_0xbb66('0x4'));var moment=require('moment');var BPromise=require(_0xbb66('0x5'));var Mustache=require(_0xbb66('0x6'));var util=require(_0xbb66('0x7'));var path=require(_0xbb66('0x8'));var sox=require(_0xbb66('0x9'));var csv=require(_0xbb66('0xa'));var ejs=require(_0xbb66('0xb'));var fs=require('fs');var fs_extra=require(_0xbb66('0xc'));var _=require(_0xbb66('0xd'));var squel=require(_0xbb66('0xe'));var crypto=require(_0xbb66('0xf'));var jsforce=require(_0xbb66('0x10'));var deskjs=require(_0xbb66('0x11'));var toCsv=require(_0xbb66('0xa'));var querystring=require(_0xbb66('0x12'));var Papa=require(_0xbb66('0x13'));var Redis=require('ioredis');var authService=require(_0xbb66('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbb66('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb66('0x16'))(_0xbb66('0x17'));var utils=require(_0xbb66('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbb66('0x19'));var db=require(_0xbb66('0x1a'))['db'];function respondWithStatusCode(_0xe47c0b,_0x4784a5){_0x4784a5=_0x4784a5||0xcc;return function(_0x4dd906){if(_0x4dd906){return _0xe47c0b['sendStatus'](_0x4784a5);}return _0xe47c0b['status'](_0x4784a5)[_0xbb66('0x1b')]();};}function respondWithResult(_0x4cc63b,_0x10b4f1){_0x10b4f1=_0x10b4f1||0xc8;return function(_0x45a149){if(_0x45a149){return _0x4cc63b[_0xbb66('0x1c')](_0x10b4f1)[_0xbb66('0x1d')](_0x45a149);}};}function respondWithFilteredResult(_0x254901,_0x39e229){return function(_0x4d05b4){if(_0x4d05b4){var _0x2a4e49=typeof _0x39e229[_0xbb66('0x1e')]===_0xbb66('0x1f')&&typeof _0x39e229[_0xbb66('0x20')]===_0xbb66('0x1f');var _0x439ed6=_0x4d05b4['count'];var _0x102460=_0x2a4e49?0x0:_0x39e229['offset'];var _0x3d7458=_0x2a4e49?_0x4d05b4[_0xbb66('0x21')]:_0x39e229['offset']+_0x39e229['limit'];var _0x558558;if(_0x3d7458>=_0x439ed6){_0x3d7458=_0x439ed6;_0x558558=0xc8;}else{_0x558558=0xce;}_0x254901[_0xbb66('0x1c')](_0x558558);return _0x254901[_0xbb66('0x22')](_0xbb66('0x23'),_0x102460+'-'+_0x3d7458+'/'+_0x439ed6)[_0xbb66('0x1d')](_0x4d05b4);}return null;};}function patchUpdates(_0x20db32){return function(_0x2b13be){try{jsonpatch[_0xbb66('0x24')](_0x2b13be,_0x20db32,!![]);}catch(_0x1d5daa){return BPromise['reject'](_0x1d5daa);}return _0x2b13be[_0xbb66('0x25')]();};}function saveUpdates(_0x584480,_0x4b46b2){return function(_0x5aad4e){if(_0x5aad4e){return _0x5aad4e[_0xbb66('0x26')](_0x584480)[_0xbb66('0x27')](function(_0x28377d){return _0x28377d;});}return null;};}function removeEntity(_0x450a2a,_0x1e31c4){return function(_0x5dd314){if(_0x5dd314){return _0x5dd314[_0xbb66('0x28')]()[_0xbb66('0x27')](function(){_0x450a2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e625e,_0x461482){return function(_0x3ffc70){if(!_0x3ffc70){_0x3e625e[_0xbb66('0x29')](0x194);}return _0x3ffc70;};}function handleError(_0x903512,_0x125108){_0x125108=_0x125108||0x1f4;return function(_0xd7ff0d){logger[_0xbb66('0x2a')](_0xd7ff0d[_0xbb66('0x2b')]);if(_0xd7ff0d[_0xbb66('0x2c')]){delete _0xd7ff0d[_0xbb66('0x2c')];}_0x903512[_0xbb66('0x1c')](_0x125108)[_0xbb66('0x2d')](_0xd7ff0d);};}exports[_0xbb66('0x2e')]=function(_0x2260dd,_0xf8d6d0){var _0x2e539c={},_0x33f394={},_0x420d75={'count':0x0,'rows':[]};var _0x2b1a92=_[_0xbb66('0x2f')](db[_0xbb66('0x30')][_0xbb66('0x31')],function(_0xd270d7){return{'name':_0xd270d7['fieldName'],'type':_0xd270d7[_0xbb66('0x32')][_0xbb66('0x33')]};});_0x33f394[_0xbb66('0x34')]=_[_0xbb66('0x2f')](_0x2b1a92,'name');_0x33f394['query']=_[_0xbb66('0x35')](_0x2260dd[_0xbb66('0x36')]);_0x33f394[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x33f394[_0xbb66('0x34')],_0x33f394[_0xbb66('0x36')]);_0x2e539c[_0xbb66('0x39')]=_['intersection'](_0x33f394['model'],qs['fields'](_0x2260dd[_0xbb66('0x36')][_0xbb66('0x3a')]));_0x2e539c[_0xbb66('0x39')]=_0x2e539c[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x2e539c[_0xbb66('0x39')]:_0x33f394[_0xbb66('0x34')];if(!_0x2260dd[_0xbb66('0x36')]['hasOwnProperty'](_0xbb66('0x3c'))){_0x2e539c[_0xbb66('0x20')]=qs[_0xbb66('0x20')](_0x2260dd[_0xbb66('0x36')]['limit']);_0x2e539c['offset']=qs['offset'](_0x2260dd['query'][_0xbb66('0x1e')]);}_0x2e539c['order']=qs[_0xbb66('0x3d')](_0x2260dd['query'][_0xbb66('0x3d')]);_0x2e539c[_0xbb66('0x3e')]=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x2260dd[_0xbb66('0x36')],_0x33f394[_0xbb66('0x37')]),_0x2b1a92);if(_0x2260dd[_0xbb66('0x36')]['filter']){_0x2e539c[_0xbb66('0x3e')]=_[_0xbb66('0x40')](_0x2e539c[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x2b1a92,function(_0x4c8a65){if(_0x4c8a65[_0xbb66('0x32')]!==_0xbb66('0x41')){var _0x417a25={};_0x417a25[_0x4c8a65['name']]={'$like':'%'+_0x2260dd['query'][_0xbb66('0x42')]+'%'};return _0x417a25;}})});}_0x2e539c=_['merge']({},_0x2e539c,_0x2260dd['options']);var _0xb10c24={'where':_0x2e539c['where']};return db[_0xbb66('0x30')][_0xbb66('0x21')](_0xb10c24)['then'](function(_0xc6c49b){_0x420d75['count']=_0xc6c49b;if(_0x2260dd['query']['includeAll']){_0x2e539c[_0xbb66('0x43')]=[{'all':!![]}];}return db[_0xbb66('0x30')][_0xbb66('0x44')](_0x2e539c);})[_0xbb66('0x27')](function(_0xc31fb0){_0x420d75['rows']=_0xc31fb0;return _0x420d75;})['then'](respondWithFilteredResult(_0xf8d6d0,_0x2e539c))[_0xbb66('0x45')](handleError(_0xf8d6d0,null));};exports[_0xbb66('0x46')]=function(_0x3a83f8,_0x2bf437){var _0x1634da={'raw':![],'where':{'id':_0x3a83f8['params']['id']}},_0x3735dc={};_0x3735dc[_0xbb66('0x34')]=_[_0xbb66('0x35')](db['ServicenowConfiguration'][_0xbb66('0x31')]);_0x3735dc[_0xbb66('0x36')]=_[_0xbb66('0x35')](_0x3a83f8['query']);_0x3735dc['filters']=_[_0xbb66('0x38')](_0x3735dc[_0xbb66('0x34')],_0x3735dc[_0xbb66('0x36')]);_0x1634da[_0xbb66('0x39')]=_['intersection'](_0x3735dc[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x3a83f8[_0xbb66('0x36')]['fields']));_0x1634da[_0xbb66('0x39')]=_0x1634da['attributes'][_0xbb66('0x3b')]?_0x1634da[_0xbb66('0x39')]:_0x3735dc[_0xbb66('0x34')];if(_0x3a83f8[_0xbb66('0x36')][_0xbb66('0x47')]){_0x1634da['include']=[{'all':!![]}];}_0x1634da=_[_0xbb66('0x40')]({},_0x1634da,_0x3a83f8['options']);return db[_0xbb66('0x30')][_0xbb66('0x48')](_0x1634da)[_0xbb66('0x27')](handleEntityNotFound(_0x2bf437,null))[_0xbb66('0x27')](respondWithResult(_0x2bf437,null))[_0xbb66('0x45')](handleError(_0x2bf437,null));};exports[_0xbb66('0x49')]=function(_0x14f72b,_0x4c0502){return db[_0xbb66('0x30')][_0xbb66('0x49')](_0x14f72b[_0xbb66('0x4a')],{})[_0xbb66('0x27')](respondWithResult(_0x4c0502,0xc9))[_0xbb66('0x45')](handleError(_0x4c0502,null));};exports[_0xbb66('0x26')]=function(_0x33e010,_0x46d62c){if(_0x33e010['body']['id']){delete _0x33e010[_0xbb66('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xbb66('0x48')]({'where':{'id':_0x33e010[_0xbb66('0x4b')]['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x46d62c,null))[_0xbb66('0x27')](saveUpdates(_0x33e010[_0xbb66('0x4a')],null))[_0xbb66('0x27')](respondWithResult(_0x46d62c,null))[_0xbb66('0x45')](handleError(_0x46d62c,null));};exports['destroy']=function(_0x2b4287,_0x5b80f3){return db['ServicenowConfiguration'][_0xbb66('0x48')]({'where':{'id':_0x2b4287[_0xbb66('0x4b')]['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x5b80f3,null))[_0xbb66('0x27')](removeEntity(_0x5b80f3,null))[_0xbb66('0x45')](handleError(_0x5b80f3,null));};exports[_0xbb66('0x4c')]=function(_0x57b5d4,_0x3c6ffd,_0x8f355){var _0x548e2f={};var _0x1ddf91={};var _0x16b173;var _0x305459;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x57b5d4['params']['id']}})[_0xbb66('0x27')](handleEntityNotFound(_0x3c6ffd,null))[_0xbb66('0x27')](function(_0x14cad8){if(_0x14cad8){_0x16b173=_0x14cad8;_0x1ddf91['model']=_[_0xbb66('0x35')](db[_0xbb66('0x4e')]['rawAttributes']);_0x1ddf91['query']=_[_0xbb66('0x35')](_0x57b5d4['query']);_0x1ddf91[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x1ddf91[_0xbb66('0x34')],_0x1ddf91[_0xbb66('0x36')]);_0x548e2f[_0xbb66('0x39')]=_['intersection'](_0x1ddf91[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x3a')]));_0x548e2f['attributes']=_0x548e2f[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x548e2f[_0xbb66('0x39')]:_0x1ddf91[_0xbb66('0x34')];_0x548e2f['order']=qs[_0xbb66('0x3d')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x3d')]);_0x548e2f['where']=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x57b5d4['query'],_0x1ddf91['filters']));if(_0x57b5d4['query'][_0xbb66('0x42')]){_0x548e2f[_0xbb66('0x3e')]=_[_0xbb66('0x40')](_0x548e2f[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x548e2f[_0xbb66('0x39')],function(_0x958634){var _0x172b27={};_0x172b27[_0x958634]={'$like':'%'+_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x172b27;})});}_0x548e2f=_[_0xbb66('0x40')]({},_0x548e2f,_0x57b5d4[_0xbb66('0x4f')]);return _0x16b173[_0xbb66('0x4c')](_0x548e2f);}})[_0xbb66('0x27')](function(_0x3bdbdf){if(_0x3bdbdf){_0x305459=_0x3bdbdf[_0xbb66('0x3b')];if(!_0x57b5d4['query'][_0xbb66('0x50')](_0xbb66('0x3c'))){_0x548e2f[_0xbb66('0x20')]=qs[_0xbb66('0x20')](_0x57b5d4[_0xbb66('0x36')][_0xbb66('0x20')]);_0x548e2f[_0xbb66('0x1e')]=qs[_0xbb66('0x1e')](_0x57b5d4['query'][_0xbb66('0x1e')]);}return _0x16b173[_0xbb66('0x4c')](_0x548e2f);}})[_0xbb66('0x27')](function(_0x137f70){if(_0x137f70){return _0x137f70?{'count':_0x305459,'rows':_0x137f70}:null;}})[_0xbb66('0x27')](respondWithResult(_0x3c6ffd,null))['catch'](handleError(_0x3c6ffd,null));};exports[_0xbb66('0x51')]=function(_0x1916bd,_0x24d473,_0x2fd256){var _0x32c6e1={};var _0x2377eb={};var _0x1d1b53;var _0xf0ed30;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x1916bd[_0xbb66('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24d473,null))['then'](function(_0x138df9){if(_0x138df9){_0x1d1b53=_0x138df9;_0x2377eb[_0xbb66('0x34')]=_['keys'](db[_0xbb66('0x4e')][_0xbb66('0x31')]);_0x2377eb[_0xbb66('0x36')]=_[_0xbb66('0x35')](_0x1916bd[_0xbb66('0x36')]);_0x2377eb[_0xbb66('0x37')]=_['intersection'](_0x2377eb[_0xbb66('0x34')],_0x2377eb[_0xbb66('0x36')]);_0x32c6e1[_0xbb66('0x39')]=_[_0xbb66('0x38')](_0x2377eb[_0xbb66('0x34')],qs[_0xbb66('0x3a')](_0x1916bd['query'][_0xbb66('0x3a')]));_0x32c6e1[_0xbb66('0x39')]=_0x32c6e1[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x32c6e1['attributes']:_0x2377eb[_0xbb66('0x34')];_0x32c6e1[_0xbb66('0x52')]=qs[_0xbb66('0x3d')](_0x1916bd['query'][_0xbb66('0x3d')]);_0x32c6e1['where']=qs[_0xbb66('0x37')](_['pick'](_0x1916bd[_0xbb66('0x36')],_0x2377eb['filters']));if(_0x1916bd[_0xbb66('0x36')][_0xbb66('0x42')]){_0x32c6e1[_0xbb66('0x3e')]=_['merge'](_0x32c6e1[_0xbb66('0x3e')],{'$or':_['map'](_0x32c6e1['attributes'],function(_0x2d83ae){var _0x220de1={};_0x220de1[_0x2d83ae]={'$like':'%'+_0x1916bd[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x220de1;})});}_0x32c6e1=_[_0xbb66('0x40')]({},_0x32c6e1,_0x1916bd[_0xbb66('0x4f')]);return _0x1d1b53['getSubjects'](_0x32c6e1);}})[_0xbb66('0x27')](function(_0x46a64e){if(_0x46a64e){_0xf0ed30=_0x46a64e[_0xbb66('0x3b')];if(!_0x1916bd[_0xbb66('0x36')][_0xbb66('0x50')](_0xbb66('0x3c'))){_0x32c6e1['limit']=qs[_0xbb66('0x20')](_0x1916bd[_0xbb66('0x36')][_0xbb66('0x20')]);_0x32c6e1['offset']=qs[_0xbb66('0x1e')](_0x1916bd['query'][_0xbb66('0x1e')]);}return _0x1d1b53[_0xbb66('0x51')](_0x32c6e1);}})[_0xbb66('0x27')](function(_0x215cae){if(_0x215cae){return _0x215cae?{'count':_0xf0ed30,'rows':_0x215cae}:null;}})[_0xbb66('0x27')](respondWithResult(_0x24d473,null))[_0xbb66('0x45')](handleError(_0x24d473,null));};exports['getDescriptions']=function(_0x80cf4f,_0x6e0450,_0x12e29a){var _0x17a85e={};var _0x3e9613={};var _0x20dc9d;var _0x21a46c;return db[_0xbb66('0x30')][_0xbb66('0x4d')]({'where':{'id':_0x80cf4f[_0xbb66('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6e0450,null))[_0xbb66('0x27')](function(_0x2cc9eb){if(_0x2cc9eb){_0x20dc9d=_0x2cc9eb;_0x3e9613[_0xbb66('0x34')]=_[_0xbb66('0x35')](db[_0xbb66('0x4e')][_0xbb66('0x31')]);_0x3e9613[_0xbb66('0x36')]=_['keys'](_0x80cf4f[_0xbb66('0x36')]);_0x3e9613[_0xbb66('0x37')]=_[_0xbb66('0x38')](_0x3e9613[_0xbb66('0x34')],_0x3e9613[_0xbb66('0x36')]);_0x17a85e['attributes']=_[_0xbb66('0x38')](_0x3e9613[_0xbb66('0x34')],qs['fields'](_0x80cf4f['query'][_0xbb66('0x3a')]));_0x17a85e['attributes']=_0x17a85e[_0xbb66('0x39')][_0xbb66('0x3b')]?_0x17a85e[_0xbb66('0x39')]:_0x3e9613[_0xbb66('0x34')];_0x17a85e[_0xbb66('0x52')]=qs[_0xbb66('0x3d')](_0x80cf4f['query'][_0xbb66('0x3d')]);_0x17a85e[_0xbb66('0x3e')]=qs[_0xbb66('0x37')](_[_0xbb66('0x3f')](_0x80cf4f['query'],_0x3e9613[_0xbb66('0x37')]));if(_0x80cf4f[_0xbb66('0x36')]['filter']){_0x17a85e['where']=_['merge'](_0x17a85e[_0xbb66('0x3e')],{'$or':_[_0xbb66('0x2f')](_0x17a85e[_0xbb66('0x39')],function(_0xfba205){var _0x578cbd={};_0x578cbd[_0xfba205]={'$like':'%'+_0x80cf4f[_0xbb66('0x36')][_0xbb66('0x42')]+'%'};return _0x578cbd;})});}_0x17a85e=_[_0xbb66('0x40')]({},_0x17a85e,_0x80cf4f[_0xbb66('0x4f')]);return _0x20dc9d[_0xbb66('0x53')](_0x17a85e);}})[_0xbb66('0x27')](function(_0xcd7770){if(_0xcd7770){_0x21a46c=_0xcd7770[_0xbb66('0x3b')];if(!_0x80cf4f[_0xbb66('0x36')]['hasOwnProperty'](_0xbb66('0x3c'))){_0x17a85e[_0xbb66('0x20')]=qs['limit'](_0x80cf4f['query'][_0xbb66('0x20')]);_0x17a85e[_0xbb66('0x1e')]=qs[_0xbb66('0x1e')](_0x80cf4f[_0xbb66('0x36')]['offset']);}return _0x20dc9d[_0xbb66('0x53')](_0x17a85e);}})['then'](function(_0x47e777){if(_0x47e777){return _0x47e777?{'count':_0x21a46c,'rows':_0x47e777}:null;}})[_0xbb66('0x27')](respondWithResult(_0x6e0450,null))[_0xbb66('0x45')](handleError(_0x6e0450,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 53ac27d..a4bcd73 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 _0xda20=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','bluebird','path','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0xda20,0x1d9));var _0x0da2=function(_0x10fa56,_0x4f688d){_0x10fa56=_0x10fa56-0x0;var _0x3c50fa=_0xda20[_0x10fa56];return _0x3c50fa;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var logger=require(_0x0da2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0da2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0da2('0x3'));var rimraf=require(_0x0da2('0x4'));var config=require('../../config/environment');var attributes=require(_0x0da2('0x5'));module[_0x0da2('0x6')]=function(_0x5c1bcb,_0x4674a3){return _0x5c1bcb[_0x0da2('0x7')](_0x0da2('0x8'),attributes,{'tableName':_0x0da2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5b=['bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xea5b,0x152));var _0xbea5=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xea5b[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var logger=require(_0xbea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbea5('0x3'));var rp=require(_0xbea5('0x4'));var fs=require('fs');var path=require(_0xbea5('0x5'));var rimraf=require(_0xbea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbea5('0x7'));module['exports']=function(_0x2db67a,_0x3d9263){return _0x2db67a[_0xbea5('0x8')](_0xbea5('0x9'),attributes,{'tableName':_0xbea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index dcde1d1..b055b84 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 _0xea78=['rpc','../../config/environment','client','request','then','info','debug','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x173db7,_0x7c8135){var _0x31a8a1=function(_0x28c7cd){while(--_0x28c7cd){_0x173db7['push'](_0x173db7['shift']());}};_0x31a8a1(++_0x7c8135);}(_0xea78,0x162));var _0x8ea7=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xea78[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x8ea7('0x0'));var util=require(_0x8ea7('0x1'));var moment=require(_0x8ea7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ea7('0x3'));var db=require(_0x8ea7('0x4'))['db'];var utils=require(_0x8ea7('0x5'));var logger=require('../../config/logger')(_0x8ea7('0x6'));var config=require(_0x8ea7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ea7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d0b2,_0x22f7bb,_0x92270a){return new BPromise(function(_0x50cc57,_0x31f9e2){return client[_0x8ea7('0x9')](_0x19d0b2,_0x92270a)[_0x8ea7('0xa')](function(_0x238317){logger[_0x8ea7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22f7bb,'request\x20sent');logger[_0x8ea7('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x22f7bb,_0x8ea7('0xd'),JSON[_0x8ea7('0xe')](_0x238317));if(_0x238317[_0x8ea7('0xf')]){if(_0x238317['error'][_0x8ea7('0x10')]===0x1f4){logger['error'](_0x8ea7('0x11'),_0x22f7bb,_0x238317[_0x8ea7('0xf')][_0x8ea7('0x12')]);return _0x31f9e2(_0x238317['error'][_0x8ea7('0x12')]);}logger[_0x8ea7('0xf')](_0x8ea7('0x11'),_0x22f7bb,_0x238317[_0x8ea7('0xf')]['message']);return _0x50cc57(_0x238317[_0x8ea7('0xf')][_0x8ea7('0x12')]);}else{logger[_0x8ea7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22f7bb,_0x8ea7('0xd'));_0x50cc57(_0x238317[_0x8ea7('0x13')][_0x8ea7('0x12')]);}})['catch'](function(_0x529f46){logger[_0x8ea7('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22f7bb,_0x529f46);_0x31f9e2(_0x529f46);});});} \ No newline at end of file +var _0x7313=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7313,0x1f1));var _0x3731=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7313[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x3731('0x0'));var util=require(_0x3731('0x1'));var moment=require(_0x3731('0x2'));var BPromise=require(_0x3731('0x3'));var rs=require(_0x3731('0x4'));var fs=require('fs');var Redis=require(_0x3731('0x5'));var db=require(_0x3731('0x6'))['db'];var utils=require(_0x3731('0x7'));var logger=require(_0x3731('0x8'))('rpc');var config=require(_0x3731('0x9'));var jayson=require(_0x3731('0xa'));var client=jayson[_0x3731('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f34c8,_0x262372,_0x78a2c1){return new BPromise(function(_0x4e3166,_0x5a9fd5){return client['request'](_0x4f34c8,_0x78a2c1)['then'](function(_0x4f7d33){logger[_0x3731('0xc')](_0x3731('0xd'),_0x262372,_0x3731('0xe'));logger['debug'](_0x3731('0xf'),_0x262372,_0x3731('0xe'),JSON[_0x3731('0x10')](_0x4f7d33));if(_0x4f7d33[_0x3731('0x11')]){if(_0x4f7d33[_0x3731('0x11')][_0x3731('0x12')]===0x1f4){logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x4f7d33[_0x3731('0x11')]['message']);return _0x5a9fd5(_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);}logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);return _0x4e3166(_0x4f7d33[_0x3731('0x11')][_0x3731('0x13')]);}else{logger[_0x3731('0xc')](_0x3731('0xd'),_0x262372,'request\x20sent');_0x4e3166(_0x4f7d33[_0x3731('0x14')][_0x3731('0x13')]);}})['catch'](function(_0x5aa8b8){logger[_0x3731('0x11')](_0x3731('0xd'),_0x262372,_0x5aa8b8);_0x5a9fd5(_0x5aa8b8);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 376c0b8..3bb7432 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 _0xf623=['put','/:id','update','delete','destroy','multer','util','path','Router','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf623,0x9e));var _0x3f62=function(_0x1ebdd0,_0x346a06){_0x1ebdd0=_0x1ebdd0-0x0;var _0x38829e=_0xf623[_0x1ebdd0];return _0x38829e;};'use strict';var multer=require(_0x3f62('0x0'));var util=require(_0x3f62('0x1'));var path=require(_0x3f62('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f62('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f62('0x4'));var controller=require(_0x3f62('0x5'));router[_0x3f62('0x6')]('/',auth[_0x3f62('0x7')](),controller[_0x3f62('0x8')]);router[_0x3f62('0x6')]('/:id',auth[_0x3f62('0x7')](),controller[_0x3f62('0x9')]);router[_0x3f62('0xa')]('/',auth[_0x3f62('0x7')](),controller[_0x3f62('0xb')]);router[_0x3f62('0xc')](_0x3f62('0xd'),auth[_0x3f62('0x7')](),controller[_0x3f62('0xe')]);router[_0x3f62('0xf')](_0x3f62('0xd'),auth[_0x3f62('0x7')](),controller[_0x3f62('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcb0e=['post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4c8c0d,_0x4e9d39){var _0x5a7843=function(_0x4d1220){while(--_0x4d1220){_0x4c8c0d['push'](_0x4c8c0d['shift']());}};_0x5a7843(++_0x4e9d39);}(_0xcb0e,0x140));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xecb0('0x0'));var util=require(_0xecb0('0x1'));var path=require(_0xecb0('0x2'));var timeout=require(_0xecb0('0x3'));var express=require(_0xecb0('0x4'));var router=express[_0xecb0('0x5')]();var fs_extra=require(_0xecb0('0x6'));var auth=require(_0xecb0('0x7'));var interaction=require(_0xecb0('0x8'));var config=require(_0xecb0('0x9'));var controller=require(_0xecb0('0xa'));router[_0xecb0('0xb')]('/',auth['isAuthenticated'](),controller[_0xecb0('0xc')]);router[_0xecb0('0xb')](_0xecb0('0xd'),auth[_0xecb0('0xe')](),controller[_0xecb0('0xf')]);router[_0xecb0('0x10')]('/',auth[_0xecb0('0xe')](),controller[_0xecb0('0x11')]);router['put'](_0xecb0('0xd'),auth[_0xecb0('0xe')](),controller['update']);router[_0xecb0('0x12')]('/:id',auth[_0xecb0('0xe')](),controller[_0xecb0('0x13')]);module[_0xecb0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ceb0201..f23c2bd 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 _0x3a72=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a72,0x1e9));var _0x23a7=function(_0x737a04,_0x1779c1){_0x737a04=_0x737a04-0x0;var _0x160830=_0x3a72[_0x737a04];return _0x160830;};'use strict';var Sequelize=require(_0x23a7('0x0'));module[_0x23a7('0x1')]={'type':{'type':Sequelize[_0x23a7('0x2')]('string',_0x23a7('0x3'),_0x23a7('0x4'),_0x23a7('0x5'),_0x23a7('0x6')),'defaultValue':_0x23a7('0x7')},'content':{'type':Sequelize[_0x23a7('0x8')]},'key':{'type':Sequelize[_0x23a7('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x23a7('0x7'),'variable',_0x23a7('0x4'))},'keyContent':{'type':Sequelize[_0x23a7('0x8')]},'idField':{'type':Sequelize[_0x23a7('0x8')]},'nameField':{'type':Sequelize[_0x23a7('0x8')]},'customField':{'type':Sequelize[_0x23a7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7b1f=['STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x7b1f,0xd5));var _0xf7b1=function(_0x303238,_0x43cfae){_0x303238=_0x303238-0x0;var _0x86d7cc=_0x7b1f[_0x303238];return _0x86d7cc;};'use strict';var Sequelize=require(_0xf7b1('0x0'));module[_0xf7b1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf7b1('0x2'),_0xf7b1('0x3'),_0xf7b1('0x4'),_0xf7b1('0x5')),'defaultValue':_0xf7b1('0x6')},'content':{'type':Sequelize[_0xf7b1('0x7')]},'key':{'type':Sequelize[_0xf7b1('0x7')]},'keyType':{'type':Sequelize[_0xf7b1('0x8')](_0xf7b1('0x6'),_0xf7b1('0x2'),_0xf7b1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf7b1('0x7')]},'nameField':{'type':Sequelize[_0xf7b1('0x7')]},'customField':{'type':Sequelize[_0xf7b1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7b1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a1e2bc3..3b2b996 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 _0xaa9e=['to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x2680ec,_0x154ac0){var _0x5b6cf2=function(_0xaddf4f){while(--_0xaddf4f){_0x2680ec['push'](_0x2680ec['shift']());}};_0x5b6cf2(++_0x154ac0);}(_0xaa9e,0x19c));var _0xeaa9=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xaa9e[_0x4914e2];return _0x2dcd07;};'use strict';var emlformat=require(_0xeaa9('0x0'));var rimraf=require(_0xeaa9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeaa9('0x2'));var rp=require(_0xeaa9('0x3'));var moment=require('moment');var BPromise=require(_0xeaa9('0x4'));var Mustache=require(_0xeaa9('0x5'));var util=require(_0xeaa9('0x6'));var path=require(_0xeaa9('0x7'));var sox=require('sox');var csv=require(_0xeaa9('0x8'));var ejs=require(_0xeaa9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeaa9('0xa'));var squel=require('squel');var crypto=require(_0xeaa9('0xb'));var jsforce=require(_0xeaa9('0xc'));var deskjs=require(_0xeaa9('0xd'));var toCsv=require(_0xeaa9('0x8'));var querystring=require('querystring');var Papa=require(_0xeaa9('0xe'));var Redis=require(_0xeaa9('0xf'));var authService=require(_0xeaa9('0x10'));var qs=require(_0xeaa9('0x11'));var as=require(_0xeaa9('0x12'));var hardwareService=require(_0xeaa9('0x13'));var logger=require(_0xeaa9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeaa9('0x15'));var db=require(_0xeaa9('0x16'))['db'];function respondWithStatusCode(_0x32c77d,_0x35ca47){_0x35ca47=_0x35ca47||0xcc;return function(_0x22cee3){if(_0x22cee3){return _0x32c77d['sendStatus'](_0x35ca47);}return _0x32c77d['status'](_0x35ca47)['end']();};}function respondWithResult(_0x100194,_0x1c8f98){_0x1c8f98=_0x1c8f98||0xc8;return function(_0x35cef6){if(_0x35cef6){return _0x100194[_0xeaa9('0x17')](_0x1c8f98)['json'](_0x35cef6);}};}function respondWithFilteredResult(_0x5184d8,_0x2c6fdd){return function(_0x15d5b8){if(_0x15d5b8){var _0x4f9ec5=typeof _0x2c6fdd[_0xeaa9('0x18')]==='undefined'&&typeof _0x2c6fdd[_0xeaa9('0x19')]===_0xeaa9('0x1a');var _0x199e13=_0x15d5b8[_0xeaa9('0x1b')];var _0x29e8dd=_0x4f9ec5?0x0:_0x2c6fdd[_0xeaa9('0x18')];var _0xec1a01=_0x4f9ec5?_0x15d5b8[_0xeaa9('0x1b')]:_0x2c6fdd['offset']+_0x2c6fdd['limit'];var _0x48b1a1;if(_0xec1a01>=_0x199e13){_0xec1a01=_0x199e13;_0x48b1a1=0xc8;}else{_0x48b1a1=0xce;}_0x5184d8[_0xeaa9('0x17')](_0x48b1a1);return _0x5184d8[_0xeaa9('0x1c')]('Content-Range',_0x29e8dd+'-'+_0xec1a01+'/'+_0x199e13)[_0xeaa9('0x1d')](_0x15d5b8);}return null;};}function patchUpdates(_0x1003b8){return function(_0x3ad9d5){try{jsonpatch[_0xeaa9('0x1e')](_0x3ad9d5,_0x1003b8,!![]);}catch(_0x502c81){return BPromise[_0xeaa9('0x1f')](_0x502c81);}return _0x3ad9d5['save']();};}function saveUpdates(_0x2e750a,_0x3a5032){return function(_0x3dbba3){if(_0x3dbba3){return _0x3dbba3['update'](_0x2e750a)[_0xeaa9('0x20')](function(_0x4de306){return _0x4de306;});}return null;};}function removeEntity(_0x3716b2,_0x11e44b){return function(_0x1e6527){if(_0x1e6527){return _0x1e6527[_0xeaa9('0x21')]()[_0xeaa9('0x20')](function(){_0x3716b2[_0xeaa9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25f6ef,_0xf94c45){return function(_0xf57b4){if(!_0xf57b4){_0x25f6ef[_0xeaa9('0x22')](0x194);}return _0xf57b4;};}function handleError(_0x255aac,_0x4ec5d4){_0x4ec5d4=_0x4ec5d4||0x1f4;return function(_0x1b210c){logger[_0xeaa9('0x23')](_0x1b210c[_0xeaa9('0x24')]);if(_0x1b210c[_0xeaa9('0x25')]){delete _0x1b210c[_0xeaa9('0x25')];}_0x255aac[_0xeaa9('0x17')](_0x4ec5d4)[_0xeaa9('0x26')](_0x1b210c);};}exports['index']=function(_0x889c81,_0x1fe0cf){var _0x38913c={},_0x26606e={},_0x3a952c={'count':0x0,'rows':[]};var _0x275d95=_[_0xeaa9('0x27')](db[_0xeaa9('0x28')][_0xeaa9('0x29')],function(_0x20e166){return{'name':_0x20e166['fieldName'],'type':_0x20e166['type'][_0xeaa9('0x2a')]};});_0x26606e[_0xeaa9('0x2b')]=_[_0xeaa9('0x27')](_0x275d95,'name');_0x26606e['query']=_['keys'](_0x889c81[_0xeaa9('0x2c')]);_0x26606e['filters']=_[_0xeaa9('0x2d')](_0x26606e[_0xeaa9('0x2b')],_0x26606e[_0xeaa9('0x2c')]);_0x38913c[_0xeaa9('0x2e')]=_[_0xeaa9('0x2d')](_0x26606e['model'],qs['fields'](_0x889c81[_0xeaa9('0x2c')]['fields']));_0x38913c[_0xeaa9('0x2e')]=_0x38913c[_0xeaa9('0x2e')][_0xeaa9('0x2f')]?_0x38913c[_0xeaa9('0x2e')]:_0x26606e[_0xeaa9('0x2b')];if(!_0x889c81[_0xeaa9('0x2c')][_0xeaa9('0x30')](_0xeaa9('0x31'))){_0x38913c[_0xeaa9('0x19')]=qs[_0xeaa9('0x19')](_0x889c81[_0xeaa9('0x2c')][_0xeaa9('0x19')]);_0x38913c[_0xeaa9('0x18')]=qs[_0xeaa9('0x18')](_0x889c81['query'][_0xeaa9('0x18')]);}_0x38913c[_0xeaa9('0x32')]=qs[_0xeaa9('0x33')](_0x889c81[_0xeaa9('0x2c')][_0xeaa9('0x33')]);_0x38913c[_0xeaa9('0x34')]=qs[_0xeaa9('0x35')](_[_0xeaa9('0x36')](_0x889c81['query'],_0x26606e[_0xeaa9('0x35')]),_0x275d95);if(_0x889c81[_0xeaa9('0x2c')][_0xeaa9('0x37')]){_0x38913c['where']=_[_0xeaa9('0x38')](_0x38913c[_0xeaa9('0x34')],{'$or':_[_0xeaa9('0x27')](_0x275d95,function(_0x3831c9){if(_0x3831c9['type']!=='VIRTUAL'){var _0xcb08a0={};_0xcb08a0[_0x3831c9['name']]={'$like':'%'+_0x889c81['query'][_0xeaa9('0x37')]+'%'};return _0xcb08a0;}})});}_0x38913c=_['merge']({},_0x38913c,_0x889c81[_0xeaa9('0x39')]);var _0x49ce52={'where':_0x38913c[_0xeaa9('0x34')]};return db['ServicenowField']['count'](_0x49ce52)[_0xeaa9('0x20')](function(_0x441eee){_0x3a952c[_0xeaa9('0x1b')]=_0x441eee;if(_0x889c81['query'][_0xeaa9('0x3a')]){_0x38913c[_0xeaa9('0x3b')]=[{'all':!![]}];}return db[_0xeaa9('0x28')]['findAll'](_0x38913c);})['then'](function(_0x227150){_0x3a952c[_0xeaa9('0x3c')]=_0x227150;return _0x3a952c;})[_0xeaa9('0x20')](respondWithFilteredResult(_0x1fe0cf,_0x38913c))[_0xeaa9('0x3d')](handleError(_0x1fe0cf,null));};exports[_0xeaa9('0x3e')]=function(_0x7eb942,_0x1129c2){var _0x39e4f2={'raw':!![],'where':{'id':_0x7eb942[_0xeaa9('0x3f')]['id']}},_0x555eb1={};_0x555eb1[_0xeaa9('0x2b')]=_[_0xeaa9('0x40')](db[_0xeaa9('0x28')][_0xeaa9('0x29')]);_0x555eb1[_0xeaa9('0x2c')]=_[_0xeaa9('0x40')](_0x7eb942[_0xeaa9('0x2c')]);_0x555eb1[_0xeaa9('0x35')]=_[_0xeaa9('0x2d')](_0x555eb1['model'],_0x555eb1[_0xeaa9('0x2c')]);_0x39e4f2[_0xeaa9('0x2e')]=_[_0xeaa9('0x2d')](_0x555eb1[_0xeaa9('0x2b')],qs[_0xeaa9('0x41')](_0x7eb942[_0xeaa9('0x2c')]['fields']));_0x39e4f2[_0xeaa9('0x2e')]=_0x39e4f2[_0xeaa9('0x2e')][_0xeaa9('0x2f')]?_0x39e4f2[_0xeaa9('0x2e')]:_0x555eb1['model'];if(_0x7eb942[_0xeaa9('0x2c')][_0xeaa9('0x3a')]){_0x39e4f2['include']=[{'all':!![]}];}_0x39e4f2=_[_0xeaa9('0x38')]({},_0x39e4f2,_0x7eb942[_0xeaa9('0x39')]);return db[_0xeaa9('0x28')][_0xeaa9('0x42')](_0x39e4f2)['then'](handleEntityNotFound(_0x1129c2,null))[_0xeaa9('0x20')](respondWithResult(_0x1129c2,null))['catch'](handleError(_0x1129c2,null));};exports[_0xeaa9('0x43')]=function(_0x53af23,_0x372630){return db[_0xeaa9('0x28')][_0xeaa9('0x43')](_0x53af23[_0xeaa9('0x44')],{})[_0xeaa9('0x20')](respondWithResult(_0x372630,0xc9))['catch'](handleError(_0x372630,null));};exports[_0xeaa9('0x45')]=function(_0x416149,_0x5d25ea){if(_0x416149[_0xeaa9('0x44')]['id']){delete _0x416149[_0xeaa9('0x44')]['id'];}return db['ServicenowField'][_0xeaa9('0x42')]({'where':{'id':_0x416149[_0xeaa9('0x3f')]['id']}})[_0xeaa9('0x20')](handleEntityNotFound(_0x5d25ea,null))[_0xeaa9('0x20')](saveUpdates(_0x416149[_0xeaa9('0x44')],null))[_0xeaa9('0x20')](respondWithResult(_0x5d25ea,null))[_0xeaa9('0x3d')](handleError(_0x5d25ea,null));};exports[_0xeaa9('0x21')]=function(_0x11e6ab,_0x289ec8){return db[_0xeaa9('0x28')][_0xeaa9('0x42')]({'where':{'id':_0x11e6ab['params']['id']}})[_0xeaa9('0x20')](handleEntityNotFound(_0x289ec8,null))[_0xeaa9('0x20')](removeEntity(_0x289ec8,null))[_0xeaa9('0x3d')](handleError(_0x289ec8,null));}; \ No newline at end of file +var _0x3cdc=['findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','error','stack','name','send','map','ServicenowField','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include'];(function(_0x9f52ba,_0x341e38){var _0x549af4=function(_0x1adcd1){while(--_0x1adcd1){_0x9f52ba['push'](_0x9f52ba['shift']());}};_0x549af4(++_0x341e38);}(_0x3cdc,0x177));var _0xc3cd=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x3cdc[_0x3b7a0c];return _0x3bb70f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3cd('0x0'));var jsonpatch=require(_0xc3cd('0x1'));var rp=require(_0xc3cd('0x2'));var moment=require(_0xc3cd('0x3'));var BPromise=require(_0xc3cd('0x4'));var Mustache=require(_0xc3cd('0x5'));var util=require('util');var path=require(_0xc3cd('0x6'));var sox=require(_0xc3cd('0x7'));var csv=require(_0xc3cd('0x8'));var ejs=require(_0xc3cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3cd('0xa'));var squel=require(_0xc3cd('0xb'));var crypto=require(_0xc3cd('0xc'));var jsforce=require(_0xc3cd('0xd'));var deskjs=require(_0xc3cd('0xe'));var toCsv=require(_0xc3cd('0x8'));var querystring=require(_0xc3cd('0xf'));var Papa=require(_0xc3cd('0x10'));var Redis=require(_0xc3cd('0x11'));var authService=require(_0xc3cd('0x12'));var qs=require(_0xc3cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3cd('0x14'));var utils=require('../../config/utils');var config=require(_0xc3cd('0x15'));var licenseUtil=require(_0xc3cd('0x16'));var db=require(_0xc3cd('0x17'))['db'];function respondWithStatusCode(_0x33338a,_0x250724){_0x250724=_0x250724||0xcc;return function(_0x1aad81){if(_0x1aad81){return _0x33338a[_0xc3cd('0x18')](_0x250724);}return _0x33338a[_0xc3cd('0x19')](_0x250724)['end']();};}function respondWithResult(_0xefcde7,_0x1d870d){_0x1d870d=_0x1d870d||0xc8;return function(_0x1af871){if(_0x1af871){return _0xefcde7[_0xc3cd('0x19')](_0x1d870d)[_0xc3cd('0x1a')](_0x1af871);}};}function respondWithFilteredResult(_0x3e4243,_0xaad00a){return function(_0x340af9){if(_0x340af9){var _0x356592=typeof _0xaad00a[_0xc3cd('0x1b')]===_0xc3cd('0x1c')&&typeof _0xaad00a[_0xc3cd('0x1d')]==='undefined';var _0x3a0c0b=_0x340af9[_0xc3cd('0x1e')];var _0x5a1e64=_0x356592?0x0:_0xaad00a[_0xc3cd('0x1b')];var _0x539a81=_0x356592?_0x340af9[_0xc3cd('0x1e')]:_0xaad00a[_0xc3cd('0x1b')]+_0xaad00a[_0xc3cd('0x1d')];var _0x3c32c7;if(_0x539a81>=_0x3a0c0b){_0x539a81=_0x3a0c0b;_0x3c32c7=0xc8;}else{_0x3c32c7=0xce;}_0x3e4243[_0xc3cd('0x19')](_0x3c32c7);return _0x3e4243[_0xc3cd('0x1f')]('Content-Range',_0x5a1e64+'-'+_0x539a81+'/'+_0x3a0c0b)[_0xc3cd('0x1a')](_0x340af9);}return null;};}function patchUpdates(_0x4be42a){return function(_0x862813){try{jsonpatch[_0xc3cd('0x20')](_0x862813,_0x4be42a,!![]);}catch(_0x12cffc){return BPromise['reject'](_0x12cffc);}return _0x862813['save']();};}function saveUpdates(_0x58906c,_0x41dca3){return function(_0x4cb219){if(_0x4cb219){return _0x4cb219[_0xc3cd('0x21')](_0x58906c)[_0xc3cd('0x22')](function(_0x1b0220){return _0x1b0220;});}return null;};}function removeEntity(_0x47fbcb,_0x3034ee){return function(_0x516be2){if(_0x516be2){return _0x516be2[_0xc3cd('0x23')]()[_0xc3cd('0x22')](function(){_0x47fbcb[_0xc3cd('0x19')](0xcc)[_0xc3cd('0x24')]();});}};}function handleEntityNotFound(_0x3d2170,_0x2a14df){return function(_0x5bf191){if(!_0x5bf191){_0x3d2170[_0xc3cd('0x18')](0x194);}return _0x5bf191;};}function handleError(_0x5dcf02,_0x26bfc0){_0x26bfc0=_0x26bfc0||0x1f4;return function(_0x54ac48){logger[_0xc3cd('0x25')](_0x54ac48[_0xc3cd('0x26')]);if(_0x54ac48[_0xc3cd('0x27')]){delete _0x54ac48['name'];}_0x5dcf02['status'](_0x26bfc0)[_0xc3cd('0x28')](_0x54ac48);};}exports['index']=function(_0x420658,_0x10321b){var _0x2de57a={},_0x339782={},_0x5588b7={'count':0x0,'rows':[]};var _0x1b3449=_[_0xc3cd('0x29')](db[_0xc3cd('0x2a')]['rawAttributes'],function(_0x1464ef){return{'name':_0x1464ef[_0xc3cd('0x2b')],'type':_0x1464ef['type'][_0xc3cd('0x2c')]};});_0x339782[_0xc3cd('0x2d')]=_[_0xc3cd('0x29')](_0x1b3449,_0xc3cd('0x27'));_0x339782[_0xc3cd('0x2e')]=_['keys'](_0x420658[_0xc3cd('0x2e')]);_0x339782[_0xc3cd('0x2f')]=_[_0xc3cd('0x30')](_0x339782[_0xc3cd('0x2d')],_0x339782[_0xc3cd('0x2e')]);_0x2de57a[_0xc3cd('0x31')]=_[_0xc3cd('0x30')](_0x339782[_0xc3cd('0x2d')],qs[_0xc3cd('0x32')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x32')]));_0x2de57a[_0xc3cd('0x31')]=_0x2de57a['attributes'][_0xc3cd('0x33')]?_0x2de57a[_0xc3cd('0x31')]:_0x339782[_0xc3cd('0x2d')];if(!_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x34')](_0xc3cd('0x35'))){_0x2de57a[_0xc3cd('0x1d')]=qs[_0xc3cd('0x1d')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x1d')]);_0x2de57a[_0xc3cd('0x1b')]=qs[_0xc3cd('0x1b')](_0x420658['query'][_0xc3cd('0x1b')]);}_0x2de57a['order']=qs[_0xc3cd('0x36')](_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x36')]);_0x2de57a['where']=qs[_0xc3cd('0x2f')](_[_0xc3cd('0x37')](_0x420658[_0xc3cd('0x2e')],_0x339782[_0xc3cd('0x2f')]),_0x1b3449);if(_0x420658['query'][_0xc3cd('0x38')]){_0x2de57a[_0xc3cd('0x39')]=_[_0xc3cd('0x3a')](_0x2de57a['where'],{'$or':_[_0xc3cd('0x29')](_0x1b3449,function(_0x348ba8){if(_0x348ba8[_0xc3cd('0x3b')]!=='VIRTUAL'){var _0x45c877={};_0x45c877[_0x348ba8['name']]={'$like':'%'+_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x38')]+'%'};return _0x45c877;}})});}_0x2de57a=_[_0xc3cd('0x3a')]({},_0x2de57a,_0x420658[_0xc3cd('0x3c')]);var _0x2991bd={'where':_0x2de57a[_0xc3cd('0x39')]};return db['ServicenowField']['count'](_0x2991bd)['then'](function(_0x27d031){_0x5588b7[_0xc3cd('0x1e')]=_0x27d031;if(_0x420658[_0xc3cd('0x2e')][_0xc3cd('0x3d')]){_0x2de57a[_0xc3cd('0x3e')]=[{'all':!![]}];}return db[_0xc3cd('0x2a')][_0xc3cd('0x3f')](_0x2de57a);})[_0xc3cd('0x22')](function(_0x43e9d7){_0x5588b7[_0xc3cd('0x40')]=_0x43e9d7;return _0x5588b7;})[_0xc3cd('0x22')](respondWithFilteredResult(_0x10321b,_0x2de57a))['catch'](handleError(_0x10321b,null));};exports[_0xc3cd('0x41')]=function(_0x1f3507,_0x3f3c0b){var _0x570a9a={'raw':!![],'where':{'id':_0x1f3507['params']['id']}},_0x17856d={};_0x17856d[_0xc3cd('0x2d')]=_[_0xc3cd('0x42')](db[_0xc3cd('0x2a')][_0xc3cd('0x43')]);_0x17856d['query']=_['keys'](_0x1f3507[_0xc3cd('0x2e')]);_0x17856d['filters']=_[_0xc3cd('0x30')](_0x17856d[_0xc3cd('0x2d')],_0x17856d[_0xc3cd('0x2e')]);_0x570a9a[_0xc3cd('0x31')]=_[_0xc3cd('0x30')](_0x17856d['model'],qs[_0xc3cd('0x32')](_0x1f3507[_0xc3cd('0x2e')][_0xc3cd('0x32')]));_0x570a9a[_0xc3cd('0x31')]=_0x570a9a[_0xc3cd('0x31')]['length']?_0x570a9a[_0xc3cd('0x31')]:_0x17856d[_0xc3cd('0x2d')];if(_0x1f3507[_0xc3cd('0x2e')][_0xc3cd('0x3d')]){_0x570a9a[_0xc3cd('0x3e')]=[{'all':!![]}];}_0x570a9a=_[_0xc3cd('0x3a')]({},_0x570a9a,_0x1f3507[_0xc3cd('0x3c')]);return db[_0xc3cd('0x2a')][_0xc3cd('0x44')](_0x570a9a)[_0xc3cd('0x22')](handleEntityNotFound(_0x3f3c0b,null))[_0xc3cd('0x22')](respondWithResult(_0x3f3c0b,null))[_0xc3cd('0x45')](handleError(_0x3f3c0b,null));};exports['create']=function(_0x5e1e95,_0xbf3843){return db['ServicenowField'][_0xc3cd('0x46')](_0x5e1e95['body'],{})['then'](respondWithResult(_0xbf3843,0xc9))['catch'](handleError(_0xbf3843,null));};exports[_0xc3cd('0x21')]=function(_0x23957e,_0x5bbb7d){if(_0x23957e[_0xc3cd('0x47')]['id']){delete _0x23957e['body']['id'];}return db[_0xc3cd('0x2a')][_0xc3cd('0x44')]({'where':{'id':_0x23957e[_0xc3cd('0x48')]['id']}})[_0xc3cd('0x22')](handleEntityNotFound(_0x5bbb7d,null))[_0xc3cd('0x22')](saveUpdates(_0x23957e[_0xc3cd('0x47')],null))[_0xc3cd('0x22')](respondWithResult(_0x5bbb7d,null))['catch'](handleError(_0x5bbb7d,null));};exports[_0xc3cd('0x23')]=function(_0x14fd23,_0x1b388e){return db[_0xc3cd('0x2a')][_0xc3cd('0x44')]({'where':{'id':_0x14fd23[_0xc3cd('0x48')]['id']}})[_0xc3cd('0x22')](handleEntityNotFound(_0x1b388e,null))[_0xc3cd('0x22')](removeEntity(_0x1b388e,null))[_0xc3cd('0x45')](handleError(_0x1b388e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c4b7a10..677b53b 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 _0x7484=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','idField'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x7484,0x16d));var _0x4748=function(_0x7de746,_0x1ce1fc){_0x7de746=_0x7de746-0x0;var _0x538066=_0x7484[_0x7de746];return _0x538066;};'use strict';var _=require(_0x4748('0x0'));var util=require(_0x4748('0x1'));var logger=require(_0x4748('0x2'))(_0x4748('0x3'));var moment=require(_0x4748('0x4'));var BPromise=require('bluebird');var rp=require(_0x4748('0x5'));var fs=require('fs');var path=require(_0x4748('0x6'));var rimraf=require(_0x4748('0x7'));var config=require(_0x4748('0x8'));var attributes=require(_0x4748('0x9'));module['exports']=function(_0x5d8b94,_0x352cd9){return _0x5d8b94[_0x4748('0xa')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4748('0xb'),_0x4748('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1561=['define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x502b34,_0x3d5d43){var _0x333664=function(_0x331496){while(--_0x331496){_0x502b34['push'](_0x502b34['shift']());}};_0x333664(++_0x3d5d43);}(_0x1561,0x1b7));var _0x1156=function(_0xc552f5,_0x3e039b){_0xc552f5=_0xc552f5-0x0;var _0x1d5dd1=_0x1561[_0xc552f5];return _0x1d5dd1;};'use strict';var _=require(_0x1156('0x0'));var util=require(_0x1156('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1156('0x2'));var BPromise=require(_0x1156('0x3'));var rp=require(_0x1156('0x4'));var fs=require('fs');var path=require(_0x1156('0x5'));var rimraf=require(_0x1156('0x6'));var config=require(_0x1156('0x7'));var attributes=require(_0x1156('0x8'));module['exports']=function(_0x47f6e8,_0x246731){return _0x47f6e8[_0x1156('0x9')](_0x1156('0xa'),attributes,{'tableName':_0x1156('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1156('0xc'),_0x1156('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index dd86844..5f25f92 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xda3f,0xec));var _0xfda3=function(_0x458893,_0x1d0e30){_0x458893=_0x458893-0x0;var _0x235943=_0xda3f[_0x458893];return _0x235943;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 39b241e..6de3b94 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(_0x501265,_0xfd339c){var _0x4215ba=function(_0x5a5cc6){while(--_0x5a5cc6){_0x501265['push'](_0x501265['shift']());}};_0x4215ba(++_0xfd339c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x3771b4,_0x2dfde7){var _0x50c1a0=function(_0x1e49e1){while(--_0x1e49e1){_0x3771b4['push'](_0x3771b4['shift']());}};_0x50c1a0(++_0x2dfde7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b0e2ad1..6852e4e 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(_0x2ecf76,_0x4a6e4c){var _0x47e769=function(_0x313dc2){while(--_0x313dc2){_0x2ecf76['push'](_0x2ecf76['shift']());}};_0x47e769(++_0x4a6e4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x531fdb,_0x2b23ce){var _0x3f35f9=function(_0x3c6fdc){while(--_0x3c6fdc){_0x531fdb['push'](_0x531fdb['shift']());}};_0x3f35f9(++_0x2b23ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 e598a95..1fbcb15 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 _0x099f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','findOne','SugarcrmConfiguration','sort','hasOwnProperty','getConfigurations','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','stringify','Calls','values','module_fields','includes','label','endsWith','value','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e0c12,_0x148be6){var _0x5f3124=function(_0x29404a){while(--_0x29404a){_0x1e0c12['push'](_0x1e0c12['shift']());}};_0x5f3124(++_0x148be6);}(_0x099f,0x1e2));var _0xf099=function(_0x415418,_0x2fd25d){_0x415418=_0x415418-0x0;var _0x1feed9=_0x099f[_0x415418];return _0x1feed9;};'use strict';var emlformat=require(_0xf099('0x0'));var rimraf=require(_0xf099('0x1'));var zipdir=require(_0xf099('0x2'));var jsonpatch=require(_0xf099('0x3'));var rp=require(_0xf099('0x4'));var moment=require('moment');var BPromise=require(_0xf099('0x5'));var Mustache=require(_0xf099('0x6'));var util=require(_0xf099('0x7'));var path=require(_0xf099('0x8'));var sox=require(_0xf099('0x9'));var csv=require(_0xf099('0xa'));var ejs=require(_0xf099('0xb'));var fs=require('fs');var fs_extra=require(_0xf099('0xc'));var _=require(_0xf099('0xd'));var squel=require(_0xf099('0xe'));var crypto=require(_0xf099('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf099('0x10'));var toCsv=require(_0xf099('0xa'));var querystring=require(_0xf099('0x11'));var Papa=require(_0xf099('0x12'));var Redis=require('ioredis');var authService=require(_0xf099('0x13'));var qs=require(_0xf099('0x14'));var as=require(_0xf099('0x15'));var hardwareService=require(_0xf099('0x16'));var logger=require(_0xf099('0x17'))(_0xf099('0x18'));var utils=require(_0xf099('0x19'));var config=require(_0xf099('0x1a'));var licenseUtil=require(_0xf099('0x1b'));var db=require(_0xf099('0x1c'))['db'];var integrations=require(_0xf099('0x1d'));function respondWithStatusCode(_0x59eb75,_0x3a5055){_0x3a5055=_0x3a5055||0xcc;return function(_0x847e9b){if(_0x847e9b){return _0x59eb75[_0xf099('0x1e')](_0x3a5055);}return _0x59eb75[_0xf099('0x1f')](_0x3a5055)[_0xf099('0x20')]();};}function respondWithResult(_0x8c12d2,_0x3a0f19){_0x3a0f19=_0x3a0f19||0xc8;return function(_0x3815b1){if(_0x3815b1){return _0x8c12d2['status'](_0x3a0f19)[_0xf099('0x21')](_0x3815b1);}};}function respondWithFilteredResult(_0x1d1892,_0x4fef5f){return function(_0x2ca9f7){if(_0x2ca9f7){var _0x247b77=typeof _0x4fef5f[_0xf099('0x22')]===_0xf099('0x23')&&typeof _0x4fef5f[_0xf099('0x24')]===_0xf099('0x23');var _0xb19591=_0x2ca9f7[_0xf099('0x25')];var _0x318ed4=_0x247b77?0x0:_0x4fef5f[_0xf099('0x22')];var _0x3b34a9=_0x247b77?_0x2ca9f7[_0xf099('0x25')]:_0x4fef5f[_0xf099('0x22')]+_0x4fef5f[_0xf099('0x24')];var _0x5a272f;if(_0x3b34a9>=_0xb19591){_0x3b34a9=_0xb19591;_0x5a272f=0xc8;}else{_0x5a272f=0xce;}_0x1d1892['status'](_0x5a272f);return _0x1d1892[_0xf099('0x26')](_0xf099('0x27'),_0x318ed4+'-'+_0x3b34a9+'/'+_0xb19591)[_0xf099('0x21')](_0x2ca9f7);}return null;};}function patchUpdates(_0x548af1){return function(_0x98b93e){try{jsonpatch[_0xf099('0x28')](_0x98b93e,_0x548af1,!![]);}catch(_0x45342b){return BPromise[_0xf099('0x29')](_0x45342b);}return _0x98b93e[_0xf099('0x2a')]();};}function saveUpdates(_0x5903e5,_0x5ba5de){return function(_0x2ae329){if(_0x2ae329){return _0x2ae329[_0xf099('0x2b')](_0x5903e5)[_0xf099('0x2c')](function(_0x4c3f75){return _0x4c3f75;});}return null;};}function removeEntity(_0x185919,_0x4ec0cc){return function(_0x506fe9){if(_0x506fe9){return _0x506fe9[_0xf099('0x2d')]()[_0xf099('0x2c')](function(){_0x185919[_0xf099('0x1f')](0xcc)[_0xf099('0x20')]();});}};}function handleEntityNotFound(_0x9a9717,_0x5a7051){return function(_0x573165){if(!_0x573165){_0x9a9717['sendStatus'](0x194);}return _0x573165;};}function handleError(_0x2b75cc,_0x5c77bc){_0x5c77bc=_0x5c77bc||0x1f4;return function(_0x4665d9){logger['error'](_0x4665d9[_0xf099('0x2e')]);if(_0x4665d9[_0xf099('0x2f')]){delete _0x4665d9[_0xf099('0x2f')];}_0x2b75cc[_0xf099('0x1f')](_0x5c77bc)[_0xf099('0x30')](_0x4665d9);};}exports[_0xf099('0x31')]=function(_0x4ac4e4,_0xc036f0){var _0x5eae6f={},_0x19afc8={},_0xd18638={'count':0x0,'rows':[]};var _0x9a376a=_[_0xf099('0x32')](db[_0xf099('0x33')]['rawAttributes'],function(_0x1a01d5){return{'name':_0x1a01d5[_0xf099('0x34')],'type':_0x1a01d5[_0xf099('0x35')][_0xf099('0x36')]};});_0x19afc8[_0xf099('0x37')]=_[_0xf099('0x32')](_0x9a376a,_0xf099('0x2f'));_0x19afc8['query']=_[_0xf099('0x38')](_0x4ac4e4[_0xf099('0x39')]);_0x19afc8['filters']=_['intersection'](_0x19afc8[_0xf099('0x37')],_0x19afc8['query']);_0x5eae6f[_0xf099('0x3a')]=_['intersection'](_0x19afc8[_0xf099('0x37')],qs[_0xf099('0x3b')](_0x4ac4e4[_0xf099('0x39')][_0xf099('0x3b')]));_0x5eae6f[_0xf099('0x3a')]=_0x5eae6f[_0xf099('0x3a')][_0xf099('0x3c')]?_0x5eae6f[_0xf099('0x3a')]:_0x19afc8[_0xf099('0x37')];if(!_0x4ac4e4[_0xf099('0x39')]['hasOwnProperty'](_0xf099('0x3d'))){_0x5eae6f[_0xf099('0x24')]=qs[_0xf099('0x24')](_0x4ac4e4[_0xf099('0x39')]['limit']);_0x5eae6f[_0xf099('0x22')]=qs[_0xf099('0x22')](_0x4ac4e4[_0xf099('0x39')][_0xf099('0x22')]);}_0x5eae6f[_0xf099('0x3e')]=qs['sort'](_0x4ac4e4['query']['sort']);_0x5eae6f[_0xf099('0x3f')]=qs[_0xf099('0x40')](_[_0xf099('0x41')](_0x4ac4e4[_0xf099('0x39')],_0x19afc8['filters']),_0x9a376a);if(_0x4ac4e4[_0xf099('0x39')][_0xf099('0x42')]){_0x5eae6f[_0xf099('0x3f')]=_[_0xf099('0x43')](_0x5eae6f[_0xf099('0x3f')],{'$or':_[_0xf099('0x32')](_0x9a376a,function(_0x1ffded){if(_0x1ffded['type']!=='VIRTUAL'){var _0x4a6f8c={};_0x4a6f8c[_0x1ffded[_0xf099('0x2f')]]={'$like':'%'+_0x4ac4e4[_0xf099('0x39')][_0xf099('0x42')]+'%'};return _0x4a6f8c;}})});}_0x5eae6f=_[_0xf099('0x43')]({},_0x5eae6f,_0x4ac4e4[_0xf099('0x44')]);var _0x209e01={'where':_0x5eae6f[_0xf099('0x3f')]};return db[_0xf099('0x33')]['count'](_0x209e01)[_0xf099('0x2c')](function(_0x588711){_0xd18638[_0xf099('0x25')]=_0x588711;if(_0x4ac4e4[_0xf099('0x39')][_0xf099('0x45')]){_0x5eae6f[_0xf099('0x46')]=[{'all':!![]}];}return db[_0xf099('0x33')]['findAll'](_0x5eae6f);})[_0xf099('0x2c')](function(_0x41beb8){_0xd18638[_0xf099('0x47')]=_0x41beb8;return _0xd18638;})[_0xf099('0x2c')](respondWithFilteredResult(_0xc036f0,_0x5eae6f))[_0xf099('0x48')](handleError(_0xc036f0,null));};exports[_0xf099('0x49')]=function(_0x5d883e,_0x49c1b3){var _0x147c5e={'raw':![],'where':{'id':_0x5d883e[_0xf099('0x4a')]['id']}},_0x22e267={};_0x22e267[_0xf099('0x37')]=_[_0xf099('0x38')](db['SugarcrmAccount'][_0xf099('0x4b')]);_0x22e267[_0xf099('0x39')]=_[_0xf099('0x38')](_0x5d883e[_0xf099('0x39')]);_0x22e267[_0xf099('0x40')]=_[_0xf099('0x4c')](_0x22e267['model'],_0x22e267[_0xf099('0x39')]);_0x147c5e[_0xf099('0x3a')]=_[_0xf099('0x4c')](_0x22e267['model'],qs[_0xf099('0x3b')](_0x5d883e[_0xf099('0x39')][_0xf099('0x3b')]));_0x147c5e[_0xf099('0x3a')]=_0x147c5e['attributes'][_0xf099('0x3c')]?_0x147c5e[_0xf099('0x3a')]:_0x22e267[_0xf099('0x37')];if(_0x5d883e[_0xf099('0x39')][_0xf099('0x45')]){_0x147c5e[_0xf099('0x46')]=[{'all':!![]}];}_0x147c5e=_['merge']({},_0x147c5e,_0x5d883e[_0xf099('0x44')]);return db[_0xf099('0x33')][_0xf099('0x4d')](_0x147c5e)[_0xf099('0x2c')](handleEntityNotFound(_0x49c1b3,null))[_0xf099('0x2c')](respondWithResult(_0x49c1b3,null))[_0xf099('0x48')](handleError(_0x49c1b3,null));};exports[_0xf099('0x4e')]=function(_0x4f43bb,_0x46a37f){return db[_0xf099('0x33')][_0xf099('0x4e')](_0x4f43bb[_0xf099('0x4f')],{})['then'](respondWithResult(_0x46a37f,0xc9))[_0xf099('0x48')](handleError(_0x46a37f,null));};exports[_0xf099('0x2b')]=function(_0x48557a,_0x203b7c){if(_0x48557a[_0xf099('0x4f')]['id']){delete _0x48557a[_0xf099('0x4f')]['id'];}return db[_0xf099('0x33')][_0xf099('0x4d')]({'where':{'id':_0x48557a[_0xf099('0x4a')]['id']}})[_0xf099('0x2c')](handleEntityNotFound(_0x203b7c,null))[_0xf099('0x2c')](saveUpdates(_0x48557a[_0xf099('0x4f')],null))[_0xf099('0x2c')](respondWithResult(_0x203b7c,null))[_0xf099('0x48')](handleError(_0x203b7c,null));};exports[_0xf099('0x2d')]=function(_0x13c74b,_0x317ec0){return db[_0xf099('0x33')]['find']({'where':{'id':_0x13c74b[_0xf099('0x4a')]['id']}})[_0xf099('0x2c')](handleEntityNotFound(_0x317ec0,null))[_0xf099('0x2c')](removeEntity(_0x317ec0,null))[_0xf099('0x48')](handleError(_0x317ec0,null));};exports['getConfigurations']=function(_0x55d888,_0x2abc03,_0x1e07fd){var _0x17e1da={};var _0x71b4b3={};var _0x3bd27d;var _0x3d8d0b;return db['SugarcrmAccount'][_0xf099('0x50')]({'where':{'id':_0x55d888[_0xf099('0x4a')]['id']}})[_0xf099('0x2c')](handleEntityNotFound(_0x2abc03,null))[_0xf099('0x2c')](function(_0x4db464){if(_0x4db464){_0x3bd27d=_0x4db464;_0x71b4b3[_0xf099('0x37')]=_[_0xf099('0x38')](db[_0xf099('0x51')][_0xf099('0x4b')]);_0x71b4b3[_0xf099('0x39')]=_['keys'](_0x55d888[_0xf099('0x39')]);_0x71b4b3[_0xf099('0x40')]=_['intersection'](_0x71b4b3['model'],_0x71b4b3['query']);_0x17e1da[_0xf099('0x3a')]=_[_0xf099('0x4c')](_0x71b4b3[_0xf099('0x37')],qs['fields'](_0x55d888['query'][_0xf099('0x3b')]));_0x17e1da[_0xf099('0x3a')]=_0x17e1da['attributes']['length']?_0x17e1da[_0xf099('0x3a')]:_0x71b4b3['model'];_0x17e1da[_0xf099('0x3e')]=qs[_0xf099('0x52')](_0x55d888[_0xf099('0x39')]['sort']);_0x17e1da[_0xf099('0x3f')]=qs[_0xf099('0x40')](_['pick'](_0x55d888[_0xf099('0x39')],_0x71b4b3[_0xf099('0x40')]));if(_0x55d888[_0xf099('0x39')][_0xf099('0x42')]){_0x17e1da[_0xf099('0x3f')]=_[_0xf099('0x43')](_0x17e1da[_0xf099('0x3f')],{'$or':_['map'](_0x17e1da[_0xf099('0x3a')],function(_0x4fa9b2){var _0x503883={};_0x503883[_0x4fa9b2]={'$like':'%'+_0x55d888[_0xf099('0x39')][_0xf099('0x42')]+'%'};return _0x503883;})});}_0x17e1da=_['merge']({},_0x17e1da,_0x55d888[_0xf099('0x44')]);return _0x3bd27d['getConfigurations'](_0x17e1da);}})['then'](function(_0x33c4ba){if(_0x33c4ba){_0x3d8d0b=_0x33c4ba[_0xf099('0x3c')];if(!_0x55d888[_0xf099('0x39')][_0xf099('0x53')](_0xf099('0x3d'))){_0x17e1da[_0xf099('0x24')]=qs[_0xf099('0x24')](_0x55d888['query']['limit']);_0x17e1da[_0xf099('0x22')]=qs[_0xf099('0x22')](_0x55d888['query']['offset']);}return _0x3bd27d[_0xf099('0x54')](_0x17e1da);}})[_0xf099('0x2c')](function(_0x2e5ab7){if(_0x2e5ab7){return _0x2e5ab7?{'count':_0x3d8d0b,'rows':_0x2e5ab7}:null;}})['then'](respondWithResult(_0x2abc03,null))['catch'](handleError(_0x2abc03,null));};exports['addConfiguration']=function(_0x28e772,_0x2b21c6,_0x57b386){if(_0x28e772[_0xf099('0x4f')]['id']){delete _0x28e772['body']['id'];}return db['SugarcrmAccount'][_0xf099('0x50')]({'where':{'id':_0x28e772[_0xf099('0x4a')]['id']}})[_0xf099('0x2c')](handleEntityNotFound(_0x2b21c6,null))[_0xf099('0x2c')](function(_0x540831){if(_0x540831){_0x28e772[_0xf099('0x4f')]['AccountId']=_0x540831['id'];_0x28e772[_0xf099('0x4f')][_0xf099('0x55')]=integrations['getSubjects'](_0x28e772['body'][_0xf099('0x56')],_0x28e772[_0xf099('0x4f')]['type']);_0x28e772[_0xf099('0x4f')]['Descriptions']=integrations[_0xf099('0x57')](_0x28e772['body'][_0xf099('0x56')],_0x28e772[_0xf099('0x4f')]['type']);return db['SugarcrmConfiguration']['create'](_0x28e772[_0xf099('0x4f')],{'include':[{'model':db[_0xf099('0x58')],'as':'Subjects'},{'model':db[_0xf099('0x58')],'as':_0xf099('0x59')}]});}return null;})[_0xf099('0x2c')](respondWithResult(_0x2b21c6,null))[_0xf099('0x48')](handleError(_0x2b21c6,null));};exports[_0xf099('0x5a')]=function(_0x414542,_0x3bffab,_0x2981f7){var _0x5491b9='';var _0x290357=['id','name',_0xf099('0x5b'),_0xf099('0x5c'),_0xf099('0x5d'),_0xf099('0x5e'),_0xf099('0x5f'),'duration_minutes',_0xf099('0x60'),'parent_type',_0xf099('0x61'),_0xf099('0x62')];return db[_0xf099('0x33')][_0xf099('0x50')]({'where':{'id':_0x414542[_0xf099('0x4a')]['id']},'attributes':['id',_0xf099('0x63'),_0xf099('0x64'),_0xf099('0x65')]})[_0xf099('0x2c')](handleEntityNotFound(_0x3bffab,null))[_0xf099('0x2c')](function(_0x50f73e){if(_0x50f73e){_0x5491b9=_0x50f73e['remoteUri'];var _0xb265da=_0x5491b9[_0xf099('0x66')](-0x1);if(_0xb265da==='/'){_0x5491b9=_0x5491b9['substring'](0x0,_0x5491b9[_0xf099('0x67')](_0xb265da));}return rp({'method':_0xf099('0x68'),'uri':util[_0xf099('0x69')]('%s%s',_0x5491b9,_0xf099('0x6a')),'json':!![],'form':{'method':_0xf099('0x6b'),'input_type':'JSON','response_type':_0xf099('0x6c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x50f73e[_0xf099('0x63')],'password':_0x50f73e['password'],'encryption':_0xf099('0x6d')},'application':_0xf099('0x6e')})}});}})[_0xf099('0x2c')](function(_0x45b771){if(_0x45b771&&_0x45b771[_0xf099('0x2f')]!==_0xf099('0x6f')&&_0x45b771[_0xf099('0x2f')]!==_0xf099('0x70')){return rp({'method':'POST','uri':util[_0xf099('0x69')]('%s%s',_0x5491b9,_0xf099('0x6a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xf099('0x6c'),'response_type':_0xf099('0x6c'),'rest_data':JSON[_0xf099('0x71')]({'session':_0x45b771['id'],'module_name':_0xf099('0x72')})}})[_0xf099('0x2c')](function(_0x34374e){if(_0x34374e){var _0x2ba7e1=_[_0xf099('0x73')](_0x34374e[_0xf099('0x74')]);_['remove'](_0x2ba7e1,function(_0x112cdf){return _0x290357[_0xf099('0x75')](_0x112cdf[_0xf099('0x2f')]);});return{'count':_0x2ba7e1['length'],'rows':_['map'](_0x2ba7e1,function(_0x2ed182){return{'id':_0x2ed182[_0xf099('0x2f')],'name':_0x2ed182[_0xf099('0x76')],'custom':_[_0xf099('0x77')](_0x2ed182[_0xf099('0x2f')],'_c')?!![]:![],'options':_0x2ed182[_0xf099('0x44')]?_['map'](_[_0xf099('0x73')](_0x2ed182[_0xf099('0x44')]),function(_0x15bb2f){return{'name':_0x15bb2f[_0xf099('0x78')],'value':_0x15bb2f[_0xf099('0x2f')]};}):[]};})};}})[_0xf099('0x2c')](respondWithResult(_0x3bffab,null))[_0xf099('0x48')](function(_0x3b72a5){var _0x4e9d03=_0x414542[_0xf099('0x39')][_0xf099('0x79')]?0x1f4:_0x3b72a5['statusCode']||0x1f4;logger[_0xf099('0x7a')](_0xf099('0x7b'),_0xf099('0x5a'),_0x4e9d03,JSON[_0xf099('0x71')](_0x3b72a5));delete _0x3b72a5[_0xf099('0x2f')];if(_0x4e9d03===0x191){_0x4e9d03=0x190;}_0x3bffab[_0xf099('0x1f')](_0x4e9d03)['send'](_0x414542[_0xf099('0x39')]['test']?{'message':_0xf099('0x7c'),'statusCode':_0x3b72a5[_0xf099('0x7d')]}:_0x3b72a5);});}else{var _0x510ef8=0x1f4;_0x3bffab[_0xf099('0x1f')](_0x510ef8)[_0xf099('0x30')]({'message':_0xf099('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6ab0=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','catch','keys','length','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','remove','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x6ab0,0x69));var _0x06ab=function(_0x200a45,_0x585f6c){_0x200a45=_0x200a45-0x0;var _0x11f228=_0x6ab0[_0x200a45];return _0x11f228;};'use strict';var emlformat=require(_0x06ab('0x0'));var rimraf=require(_0x06ab('0x1'));var zipdir=require(_0x06ab('0x2'));var jsonpatch=require(_0x06ab('0x3'));var rp=require(_0x06ab('0x4'));var moment=require(_0x06ab('0x5'));var BPromise=require(_0x06ab('0x6'));var Mustache=require(_0x06ab('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x06ab('0x8'));var ejs=require(_0x06ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06ab('0xa'));var squel=require(_0x06ab('0xb'));var crypto=require('crypto');var jsforce=require(_0x06ab('0xc'));var deskjs=require(_0x06ab('0xd'));var toCsv=require(_0x06ab('0x8'));var querystring=require(_0x06ab('0xe'));var Papa=require(_0x06ab('0xf'));var Redis=require(_0x06ab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06ab('0x11'));var as=require(_0x06ab('0x12'));var hardwareService=require(_0x06ab('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x06ab('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x06ab('0x15'));var db=require(_0x06ab('0x16'))['db'];var integrations=require(_0x06ab('0x17'));function respondWithStatusCode(_0x361e90,_0x33c62c){_0x33c62c=_0x33c62c||0xcc;return function(_0x4b453d){if(_0x4b453d){return _0x361e90[_0x06ab('0x18')](_0x33c62c);}return _0x361e90[_0x06ab('0x19')](_0x33c62c)[_0x06ab('0x1a')]();};}function respondWithResult(_0x4ab599,_0x4bdd6e){_0x4bdd6e=_0x4bdd6e||0xc8;return function(_0x313f59){if(_0x313f59){return _0x4ab599[_0x06ab('0x19')](_0x4bdd6e)[_0x06ab('0x1b')](_0x313f59);}};}function respondWithFilteredResult(_0x3ac06e,_0x450676){return function(_0x2f2454){if(_0x2f2454){var _0x1118a6=typeof _0x450676['offset']===_0x06ab('0x1c')&&typeof _0x450676['limit']===_0x06ab('0x1c');var _0x1c9f09=_0x2f2454[_0x06ab('0x1d')];var _0xa0435b=_0x1118a6?0x0:_0x450676[_0x06ab('0x1e')];var _0x52ea97=_0x1118a6?_0x2f2454['count']:_0x450676['offset']+_0x450676['limit'];var _0x132b2c;if(_0x52ea97>=_0x1c9f09){_0x52ea97=_0x1c9f09;_0x132b2c=0xc8;}else{_0x132b2c=0xce;}_0x3ac06e[_0x06ab('0x19')](_0x132b2c);return _0x3ac06e[_0x06ab('0x1f')](_0x06ab('0x20'),_0xa0435b+'-'+_0x52ea97+'/'+_0x1c9f09)[_0x06ab('0x1b')](_0x2f2454);}return null;};}function patchUpdates(_0x57c810){return function(_0x5e507d){try{jsonpatch['apply'](_0x5e507d,_0x57c810,!![]);}catch(_0xc42830){return BPromise[_0x06ab('0x21')](_0xc42830);}return _0x5e507d[_0x06ab('0x22')]();};}function saveUpdates(_0x510192,_0xc7af28){return function(_0x36b92a){if(_0x36b92a){return _0x36b92a[_0x06ab('0x23')](_0x510192)[_0x06ab('0x24')](function(_0x2f68b7){return _0x2f68b7;});}return null;};}function removeEntity(_0x37e415,_0x23ea3b){return function(_0x2deb6f){if(_0x2deb6f){return _0x2deb6f[_0x06ab('0x25')]()['then'](function(){_0x37e415['status'](0xcc)[_0x06ab('0x1a')]();});}};}function handleEntityNotFound(_0x47a443,_0x26d444){return function(_0x2a7c6d){if(!_0x2a7c6d){_0x47a443[_0x06ab('0x18')](0x194);}return _0x2a7c6d;};}function handleError(_0x5912ae,_0x2d8ea0){_0x2d8ea0=_0x2d8ea0||0x1f4;return function(_0x2eab25){logger['error'](_0x2eab25['stack']);if(_0x2eab25[_0x06ab('0x26')]){delete _0x2eab25[_0x06ab('0x26')];}_0x5912ae[_0x06ab('0x19')](_0x2d8ea0)[_0x06ab('0x27')](_0x2eab25);};}exports[_0x06ab('0x28')]=function(_0x58febc,_0xc61bf5){var _0x37db2e={},_0x1c0914={},_0x41b179={'count':0x0,'rows':[]};var _0x3330e1=_[_0x06ab('0x29')](db['SugarcrmAccount'][_0x06ab('0x2a')],function(_0x326f93){return{'name':_0x326f93[_0x06ab('0x2b')],'type':_0x326f93['type'][_0x06ab('0x2c')]};});_0x1c0914['model']=_[_0x06ab('0x29')](_0x3330e1,_0x06ab('0x26'));_0x1c0914[_0x06ab('0x2d')]=_['keys'](_0x58febc['query']);_0x1c0914[_0x06ab('0x2e')]=_[_0x06ab('0x2f')](_0x1c0914['model'],_0x1c0914[_0x06ab('0x2d')]);_0x37db2e[_0x06ab('0x30')]=_['intersection'](_0x1c0914['model'],qs['fields'](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x37db2e[_0x06ab('0x30')]=_0x37db2e[_0x06ab('0x30')]['length']?_0x37db2e[_0x06ab('0x30')]:_0x1c0914[_0x06ab('0x32')];if(!_0x58febc[_0x06ab('0x2d')][_0x06ab('0x33')](_0x06ab('0x34'))){_0x37db2e[_0x06ab('0x35')]=qs[_0x06ab('0x35')](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x35')]);_0x37db2e['offset']=qs['offset'](_0x58febc['query']['offset']);}_0x37db2e[_0x06ab('0x36')]=qs['sort'](_0x58febc[_0x06ab('0x2d')][_0x06ab('0x37')]);_0x37db2e['where']=qs[_0x06ab('0x2e')](_[_0x06ab('0x38')](_0x58febc[_0x06ab('0x2d')],_0x1c0914[_0x06ab('0x2e')]),_0x3330e1);if(_0x58febc['query'][_0x06ab('0x39')]){_0x37db2e[_0x06ab('0x3a')]=_[_0x06ab('0x3b')](_0x37db2e[_0x06ab('0x3a')],{'$or':_[_0x06ab('0x29')](_0x3330e1,function(_0x5c1ea3){if(_0x5c1ea3['type']!==_0x06ab('0x3c')){var _0x352fe6={};_0x352fe6[_0x5c1ea3[_0x06ab('0x26')]]={'$like':'%'+_0x58febc[_0x06ab('0x2d')]['filter']+'%'};return _0x352fe6;}})});}_0x37db2e=_['merge']({},_0x37db2e,_0x58febc[_0x06ab('0x3d')]);var _0x4a583e={'where':_0x37db2e[_0x06ab('0x3a')]};return db[_0x06ab('0x3e')][_0x06ab('0x1d')](_0x4a583e)[_0x06ab('0x24')](function(_0x9e71d3){_0x41b179[_0x06ab('0x1d')]=_0x9e71d3;if(_0x58febc['query'][_0x06ab('0x3f')]){_0x37db2e[_0x06ab('0x40')]=[{'all':!![]}];}return db[_0x06ab('0x3e')][_0x06ab('0x41')](_0x37db2e);})[_0x06ab('0x24')](function(_0x589e93){_0x41b179['rows']=_0x589e93;return _0x41b179;})[_0x06ab('0x24')](respondWithFilteredResult(_0xc61bf5,_0x37db2e))[_0x06ab('0x42')](handleError(_0xc61bf5,null));};exports['show']=function(_0x3342f9,_0x32293c){var _0x6a1e83={'raw':![],'where':{'id':_0x3342f9['params']['id']}},_0x13aaeb={};_0x13aaeb[_0x06ab('0x32')]=_[_0x06ab('0x43')](db[_0x06ab('0x3e')]['rawAttributes']);_0x13aaeb['query']=_[_0x06ab('0x43')](_0x3342f9[_0x06ab('0x2d')]);_0x13aaeb[_0x06ab('0x2e')]=_[_0x06ab('0x2f')](_0x13aaeb[_0x06ab('0x32')],_0x13aaeb[_0x06ab('0x2d')]);_0x6a1e83['attributes']=_[_0x06ab('0x2f')](_0x13aaeb['model'],qs[_0x06ab('0x31')](_0x3342f9[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x6a1e83['attributes']=_0x6a1e83[_0x06ab('0x30')][_0x06ab('0x44')]?_0x6a1e83['attributes']:_0x13aaeb[_0x06ab('0x32')];if(_0x3342f9[_0x06ab('0x2d')][_0x06ab('0x3f')]){_0x6a1e83[_0x06ab('0x40')]=[{'all':!![]}];}_0x6a1e83=_[_0x06ab('0x3b')]({},_0x6a1e83,_0x3342f9[_0x06ab('0x3d')]);return db[_0x06ab('0x3e')][_0x06ab('0x45')](_0x6a1e83)[_0x06ab('0x24')](handleEntityNotFound(_0x32293c,null))[_0x06ab('0x24')](respondWithResult(_0x32293c,null))['catch'](handleError(_0x32293c,null));};exports['create']=function(_0x376a64,_0xa70745){return db[_0x06ab('0x3e')][_0x06ab('0x46')](_0x376a64[_0x06ab('0x47')],{})[_0x06ab('0x24')](respondWithResult(_0xa70745,0xc9))[_0x06ab('0x42')](handleError(_0xa70745,null));};exports['update']=function(_0x1054b1,_0x45fa9f){if(_0x1054b1[_0x06ab('0x47')]['id']){delete _0x1054b1[_0x06ab('0x47')]['id'];}return db['SugarcrmAccount'][_0x06ab('0x45')]({'where':{'id':_0x1054b1[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x45fa9f,null))[_0x06ab('0x24')](saveUpdates(_0x1054b1[_0x06ab('0x47')],null))[_0x06ab('0x24')](respondWithResult(_0x45fa9f,null))[_0x06ab('0x42')](handleError(_0x45fa9f,null));};exports[_0x06ab('0x25')]=function(_0x2980f0,_0x45a73f){return db[_0x06ab('0x3e')][_0x06ab('0x45')]({'where':{'id':_0x2980f0[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x45a73f,null))[_0x06ab('0x24')](removeEntity(_0x45a73f,null))[_0x06ab('0x42')](handleError(_0x45a73f,null));};exports[_0x06ab('0x49')]=function(_0x36e556,_0x420290,_0x1f9839){var _0x5150dc={};var _0x3e83b2={};var _0x421b2a;var _0x18a3c4;return db['SugarcrmAccount'][_0x06ab('0x4a')]({'where':{'id':_0x36e556[_0x06ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x420290,null))[_0x06ab('0x24')](function(_0x35a83a){if(_0x35a83a){_0x421b2a=_0x35a83a;_0x3e83b2[_0x06ab('0x32')]=_[_0x06ab('0x43')](db[_0x06ab('0x4b')]['rawAttributes']);_0x3e83b2['query']=_[_0x06ab('0x43')](_0x36e556[_0x06ab('0x2d')]);_0x3e83b2['filters']=_[_0x06ab('0x2f')](_0x3e83b2[_0x06ab('0x32')],_0x3e83b2['query']);_0x5150dc['attributes']=_[_0x06ab('0x2f')](_0x3e83b2['model'],qs[_0x06ab('0x31')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x31')]));_0x5150dc[_0x06ab('0x30')]=_0x5150dc[_0x06ab('0x30')][_0x06ab('0x44')]?_0x5150dc['attributes']:_0x3e83b2[_0x06ab('0x32')];_0x5150dc[_0x06ab('0x36')]=qs[_0x06ab('0x37')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x37')]);_0x5150dc[_0x06ab('0x3a')]=qs[_0x06ab('0x2e')](_[_0x06ab('0x38')](_0x36e556[_0x06ab('0x2d')],_0x3e83b2[_0x06ab('0x2e')]));if(_0x36e556[_0x06ab('0x2d')]['filter']){_0x5150dc['where']=_[_0x06ab('0x3b')](_0x5150dc[_0x06ab('0x3a')],{'$or':_['map'](_0x5150dc[_0x06ab('0x30')],function(_0x244a1c){var _0x3690d3={};_0x3690d3[_0x244a1c]={'$like':'%'+_0x36e556[_0x06ab('0x2d')]['filter']+'%'};return _0x3690d3;})});}_0x5150dc=_[_0x06ab('0x3b')]({},_0x5150dc,_0x36e556['options']);return _0x421b2a[_0x06ab('0x49')](_0x5150dc);}})[_0x06ab('0x24')](function(_0x3c17f8){if(_0x3c17f8){_0x18a3c4=_0x3c17f8[_0x06ab('0x44')];if(!_0x36e556[_0x06ab('0x2d')][_0x06ab('0x33')](_0x06ab('0x34'))){_0x5150dc[_0x06ab('0x35')]=qs[_0x06ab('0x35')](_0x36e556[_0x06ab('0x2d')][_0x06ab('0x35')]);_0x5150dc[_0x06ab('0x1e')]=qs[_0x06ab('0x1e')](_0x36e556[_0x06ab('0x2d')]['offset']);}return _0x421b2a['getConfigurations'](_0x5150dc);}})[_0x06ab('0x24')](function(_0xf678da){if(_0xf678da){return _0xf678da?{'count':_0x18a3c4,'rows':_0xf678da}:null;}})[_0x06ab('0x24')](respondWithResult(_0x420290,null))[_0x06ab('0x42')](handleError(_0x420290,null));};exports[_0x06ab('0x4c')]=function(_0x2b0e91,_0x4cce33,_0x340b5f){if(_0x2b0e91[_0x06ab('0x47')]['id']){delete _0x2b0e91['body']['id'];}return db[_0x06ab('0x3e')][_0x06ab('0x4a')]({'where':{'id':_0x2b0e91[_0x06ab('0x48')]['id']}})[_0x06ab('0x24')](handleEntityNotFound(_0x4cce33,null))[_0x06ab('0x24')](function(_0x5bbc68){if(_0x5bbc68){_0x2b0e91['body']['AccountId']=_0x5bbc68['id'];_0x2b0e91['body'][_0x06ab('0x4d')]=integrations['getSubjects'](_0x2b0e91['body'][_0x06ab('0x4e')],_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x4f')]);_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x50')]=integrations[_0x06ab('0x51')](_0x2b0e91[_0x06ab('0x47')][_0x06ab('0x4e')],_0x2b0e91['body'][_0x06ab('0x4f')]);return db[_0x06ab('0x4b')][_0x06ab('0x46')](_0x2b0e91[_0x06ab('0x47')],{'include':[{'model':db[_0x06ab('0x52')],'as':_0x06ab('0x4d')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x06ab('0x24')](respondWithResult(_0x4cce33,null))['catch'](handleError(_0x4cce33,null));};exports[_0x06ab('0x53')]=function(_0x44b7d9,_0x327473,_0xaf8bdd){var _0x32cc97='';var _0x6dd055=['id',_0x06ab('0x26'),_0x06ab('0x54'),_0x06ab('0x55'),_0x06ab('0x56'),'date_start',_0x06ab('0x57'),_0x06ab('0x58'),_0x06ab('0x59'),_0x06ab('0x5a'),_0x06ab('0x5b'),_0x06ab('0x5c')];return db['SugarcrmAccount'][_0x06ab('0x4a')]({'where':{'id':_0x44b7d9[_0x06ab('0x48')]['id']},'attributes':['id',_0x06ab('0x5d'),_0x06ab('0x5e'),'remoteUri']})[_0x06ab('0x24')](handleEntityNotFound(_0x327473,null))[_0x06ab('0x24')](function(_0x1b32b2){if(_0x1b32b2){_0x32cc97=_0x1b32b2['remoteUri'];var _0xedf2c2=_0x32cc97['slice'](-0x1);if(_0xedf2c2==='/'){_0x32cc97=_0x32cc97[_0x06ab('0x5f')](0x0,_0x32cc97[_0x06ab('0x60')](_0xedf2c2));}return rp({'method':_0x06ab('0x61'),'uri':util['format'](_0x06ab('0x62'),_0x32cc97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x06ab('0x63'),'input_type':_0x06ab('0x64'),'response_type':_0x06ab('0x64'),'rest_data':JSON[_0x06ab('0x65')]({'user_auth':{'user_name':_0x1b32b2[_0x06ab('0x5d')],'password':_0x1b32b2[_0x06ab('0x5e')],'encryption':_0x06ab('0x66')},'application':_0x06ab('0x67')})}});}})[_0x06ab('0x24')](function(_0x374eac){if(_0x374eac&&_0x374eac[_0x06ab('0x26')]!==_0x06ab('0x68')&&_0x374eac[_0x06ab('0x26')]!=='Password\x20Expired'){return rp({'method':_0x06ab('0x61'),'uri':util[_0x06ab('0x69')](_0x06ab('0x62'),_0x32cc97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x06ab('0x6a'),'input_type':_0x06ab('0x64'),'response_type':_0x06ab('0x64'),'rest_data':JSON[_0x06ab('0x65')]({'session':_0x374eac['id'],'module_name':_0x06ab('0x6b')})}})['then'](function(_0x162eb5){if(_0x162eb5){var _0x246183=_[_0x06ab('0x6c')](_0x162eb5['module_fields']);_[_0x06ab('0x6d')](_0x246183,function(_0x46e724){return _0x6dd055[_0x06ab('0x6e')](_0x46e724[_0x06ab('0x26')]);});return{'count':_0x246183[_0x06ab('0x44')],'rows':_['map'](_0x246183,function(_0x34b51a){return{'id':_0x34b51a[_0x06ab('0x26')],'name':_0x34b51a[_0x06ab('0x6f')],'custom':_[_0x06ab('0x70')](_0x34b51a[_0x06ab('0x26')],'_c')?!![]:![],'options':_0x34b51a[_0x06ab('0x3d')]?_[_0x06ab('0x29')](_[_0x06ab('0x6c')](_0x34b51a[_0x06ab('0x3d')]),function(_0x10f940){return{'name':_0x10f940[_0x06ab('0x71')],'value':_0x10f940['name']};}):[]};})};}})[_0x06ab('0x24')](respondWithResult(_0x327473,null))[_0x06ab('0x42')](function(_0x5bd597){var _0x3ab3f4=_0x44b7d9[_0x06ab('0x2d')]['test']?0x1f4:_0x5bd597[_0x06ab('0x72')]||0x1f4;logger[_0x06ab('0x73')](_0x06ab('0x74'),'getFields',_0x3ab3f4,JSON[_0x06ab('0x65')](_0x5bd597));delete _0x5bd597[_0x06ab('0x26')];if(_0x3ab3f4===0x191){_0x3ab3f4=0x190;}_0x327473[_0x06ab('0x19')](_0x3ab3f4)[_0x06ab('0x27')](_0x44b7d9[_0x06ab('0x2d')][_0x06ab('0x75')]?{'message':_0x06ab('0x76'),'statusCode':_0x5bd597[_0x06ab('0x72')]}:_0x5bd597);});}else{var _0x273867=0x1f4;_0x327473[_0x06ab('0x19')](_0x273867)[_0x06ab('0x27')]({'message':_0x06ab('0x76'),'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 5d6b82b..542f443 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 _0x1b29=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x1b29,0x7f));var _0x91b2=function(_0x1ce90b,_0x1858f0){_0x1ce90b=_0x1ce90b-0x0;var _0x409851=_0x1b29[_0x1ce90b];return _0x409851;};'use strict';var _=require(_0x91b2('0x0'));var util=require(_0x91b2('0x1'));var logger=require(_0x91b2('0x2'))(_0x91b2('0x3'));var moment=require(_0x91b2('0x4'));var BPromise=require(_0x91b2('0x5'));var rp=require(_0x91b2('0x6'));var fs=require('fs');var path=require(_0x91b2('0x7'));var rimraf=require(_0x91b2('0x8'));var config=require(_0x91b2('0x9'));var attributes=require(_0x91b2('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x91b2('0xb')]=function(_0x2d273c,_0xf9f84){return _0x2d273c[_0x91b2('0xc')](_0x91b2('0xd'),attributes,{'tableName':_0x91b2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca0d=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xca0d,0x17b));var _0xdca0=function(_0x95b83e,_0x5f3d3e){_0x95b83e=_0x95b83e-0x0;var _0x2b9529=_0xca0d[_0x95b83e];return _0x2b9529;};'use strict';var _=require(_0xdca0('0x0'));var util=require(_0xdca0('0x1'));var logger=require(_0xdca0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdca0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdca0('0x4'));var config=require(_0xdca0('0x5'));var attributes=require(_0xdca0('0x6'));var integrations=require(_0xdca0('0x7'));module[_0xdca0('0x8')]=function(_0x1897b8,_0x3c0b9b){return _0x1897b8[_0xdca0('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xdca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index a39a354..cfb4f47 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 _0x4324=['model','map','ShowSugarcrmAccount','where','debug','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','include'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x4324,0x7d));var _0x4432=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x4324[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0x4432('0x0'));var util=require('util');var moment=require(_0x4432('0x1'));var BPromise=require(_0x4432('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4432('0x3'));var db=require(_0x4432('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4432('0x5'));var config=require(_0x4432('0x6'));var jayson=require(_0x4432('0x7'));var client=jayson['client'][_0x4432('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14b9dc,_0x40b5f1,_0x31be2a){return new BPromise(function(_0x4fde27,_0x23d165){return client[_0x4432('0x9')](_0x14b9dc,_0x31be2a)[_0x4432('0xa')](function(_0x2b6388){logger[_0x4432('0xb')](_0x4432('0xc'),_0x40b5f1,_0x4432('0xd'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x40b5f1,_0x4432('0xd'),JSON[_0x4432('0xe')](_0x2b6388));if(_0x2b6388[_0x4432('0xf')]){if(_0x2b6388[_0x4432('0xf')]['code']===0x1f4){logger[_0x4432('0xf')](_0x4432('0xc'),_0x40b5f1,_0x2b6388['error'][_0x4432('0x10')]);return _0x23d165(_0x2b6388[_0x4432('0xf')]['message']);}logger[_0x4432('0xf')](_0x4432('0xc'),_0x40b5f1,_0x2b6388[_0x4432('0xf')][_0x4432('0x10')]);return _0x4fde27(_0x2b6388['error'][_0x4432('0x10')]);}else{logger[_0x4432('0xb')](_0x4432('0xc'),_0x40b5f1,_0x4432('0xd'));_0x4fde27(_0x2b6388['result']['message']);}})[_0x4432('0x11')](function(_0x581be7){logger[_0x4432('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x40b5f1,_0x581be7);_0x23d165(_0x581be7);});});}exports[_0x4432('0x12')]=function(_0x31e078){var _0x26648e=this;return new Promise(function(_0x386caf,_0x4f8ed7){return db[_0x4432('0x13')]['findAll']({'raw':_0x31e078[_0x4432('0x14')]?_0x31e078[_0x4432('0x14')][_0x4432('0x15')]===undefined?!![]:![]:!![],'where':_0x31e078['options']?_0x31e078[_0x4432('0x14')]['where']||null:null,'attributes':_0x31e078[_0x4432('0x14')]?_0x31e078['options'][_0x4432('0x16')]||null:null,'limit':_0x31e078[_0x4432('0x14')]?_0x31e078[_0x4432('0x14')][_0x4432('0x17')]||null:null,'include':_0x31e078[_0x4432('0x14')]?_0x31e078[_0x4432('0x14')][_0x4432('0x18')]?_['map'](_0x31e078[_0x4432('0x14')][_0x4432('0x18')],function(_0x4eebe9){return{'model':db[_0x4eebe9[_0x4432('0x19')]],'as':_0x4eebe9['as'],'attributes':_0x4eebe9['attributes'],'include':_0x4eebe9[_0x4432('0x18')]?_[_0x4432('0x1a')](_0x4eebe9['include'],function(_0x16c0f2){return{'model':db[_0x16c0f2[_0x4432('0x19')]],'as':_0x16c0f2['as'],'attributes':_0x16c0f2['attributes'],'include':_0x16c0f2['include']?_[_0x4432('0x1a')](_0x16c0f2[_0x4432('0x18')],function(_0x1d2653){return{'model':db[_0x1d2653[_0x4432('0x19')]],'as':_0x1d2653['as'],'attributes':_0x1d2653[_0x4432('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4432('0xa')](function(_0xa8e301){logger[_0x4432('0xb')](_0x4432('0x12'),_0x31e078);logger['debug']('GetSugarcrmAccount',_0x31e078,JSON[_0x4432('0xe')](_0xa8e301));_0x386caf(_0xa8e301);})[_0x4432('0x11')](function(_0x17362d){logger[_0x4432('0xf')]('GetSugarcrmAccount',_0x17362d[_0x4432('0x10')],_0x31e078);_0x4f8ed7(_0x26648e[_0x4432('0xf')](0x1f4,_0x17362d[_0x4432('0x10')]));});});};exports[_0x4432('0x1b')]=function(_0x4857dc){var _0x553f8c=this;return new Promise(function(_0x1ed979,_0x53a891){return db[_0x4432('0x13')]['find']({'raw':_0x4857dc[_0x4432('0x14')]?_0x4857dc[_0x4432('0x14')][_0x4432('0x15')]===undefined?!![]:![]:!![],'where':_0x4857dc[_0x4432('0x14')]?_0x4857dc[_0x4432('0x14')][_0x4432('0x1c')]||null:null,'attributes':_0x4857dc[_0x4432('0x14')]?_0x4857dc['options'][_0x4432('0x16')]||null:null,'include':_0x4857dc['options']?_0x4857dc[_0x4432('0x14')]['include']?_['map'](_0x4857dc[_0x4432('0x14')][_0x4432('0x18')],function(_0x17b18e){return{'model':db[_0x17b18e[_0x4432('0x19')]],'as':_0x17b18e['as'],'attributes':_0x17b18e[_0x4432('0x16')],'include':_0x17b18e[_0x4432('0x18')]?_[_0x4432('0x1a')](_0x17b18e[_0x4432('0x18')],function(_0x1ae5c9){return{'model':db[_0x1ae5c9['model']],'as':_0x1ae5c9['as'],'attributes':_0x1ae5c9[_0x4432('0x16')],'include':_0x1ae5c9[_0x4432('0x18')]?_[_0x4432('0x1a')](_0x1ae5c9[_0x4432('0x18')],function(_0x4392ae){return{'model':db[_0x4392ae['model']],'as':_0x4392ae['as'],'attributes':_0x4392ae[_0x4432('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4432('0xa')](function(_0x200e32){logger['info'](_0x4432('0x1b'),_0x4857dc);logger[_0x4432('0x1d')](_0x4432('0x1b'),_0x4857dc,JSON[_0x4432('0xe')](_0x200e32));_0x1ed979(_0x200e32);})[_0x4432('0x11')](function(_0x476e6b){logger['error'](_0x4432('0x1b'),_0x476e6b['message'],_0x4857dc);_0x53a891(_0x553f8c[_0x4432('0xf')](0x1f4,_0x476e6b[_0x4432('0x10')]));});});}; \ No newline at end of file +var _0x38aa=['error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2d2936,_0x158cdc){var _0x3c9860=function(_0x2dda22){while(--_0x2dda22){_0x2d2936['push'](_0x2d2936['shift']());}};_0x3c9860(++_0x158cdc);}(_0x38aa,0x134));var _0xa38a=function(_0x187338,_0x5a5ede){_0x187338=_0x187338-0x0;var _0x593434=_0x38aa[_0x187338];return _0x593434;};'use strict';var _=require(_0xa38a('0x0'));var util=require('util');var moment=require(_0xa38a('0x1'));var BPromise=require(_0xa38a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa38a('0x3'));var db=require(_0xa38a('0x4'))['db'];var utils=require(_0xa38a('0x5'));var logger=require(_0xa38a('0x6'))('rpc');var config=require(_0xa38a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa38a('0x8')][_0xa38a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fc70c,_0x5c7a0a,_0x1c6686){return new BPromise(function(_0x17e394,_0x1b6a5a){return client[_0xa38a('0xa')](_0x3fc70c,_0x1c6686)[_0xa38a('0xb')](function(_0x4fcd9d){logger[_0xa38a('0xc')](_0xa38a('0xd'),_0x5c7a0a,_0xa38a('0xe'));logger['debug'](_0xa38a('0xf'),_0x5c7a0a,_0xa38a('0xe'),JSON['stringify'](_0x4fcd9d));if(_0x4fcd9d[_0xa38a('0x10')]){if(_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x11')]===0x1f4){logger[_0xa38a('0x10')](_0xa38a('0xd'),_0x5c7a0a,_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);return _0x1b6a5a(_0x4fcd9d['error'][_0xa38a('0x12')]);}logger[_0xa38a('0x10')](_0xa38a('0xd'),_0x5c7a0a,_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);return _0x17e394(_0x4fcd9d[_0xa38a('0x10')][_0xa38a('0x12')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5c7a0a,'request\x20sent');_0x17e394(_0x4fcd9d[_0xa38a('0x13')][_0xa38a('0x12')]);}})[_0xa38a('0x14')](function(_0x24fa44){logger['error'](_0xa38a('0xd'),_0x5c7a0a,_0x24fa44);_0x1b6a5a(_0x24fa44);});});}exports[_0xa38a('0x15')]=function(_0xd1810b){var _0xa11bbc=this;return new Promise(function(_0x4d3fe3,_0x22a833){return db[_0xa38a('0x16')][_0xa38a('0x17')]({'raw':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x19')]===undefined?!![]:![]:!![],'where':_0xd1810b['options']?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1a')]||null:null,'attributes':_0xd1810b['options']?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1b')]||null:null,'limit':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1c')]||null:null,'include':_0xd1810b[_0xa38a('0x18')]?_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0xd1810b[_0xa38a('0x18')][_0xa38a('0x1d')],function(_0x45929c){return{'model':db[_0x45929c['model']],'as':_0x45929c['as'],'attributes':_0x45929c['attributes'],'include':_0x45929c[_0xa38a('0x1d')]?_['map'](_0x45929c[_0xa38a('0x1d')],function(_0x131db4){return{'model':db[_0x131db4[_0xa38a('0x1f')]],'as':_0x131db4['as'],'attributes':_0x131db4[_0xa38a('0x1b')],'include':_0x131db4[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x131db4[_0xa38a('0x1d')],function(_0x5165e1){return{'model':db[_0x5165e1['model']],'as':_0x5165e1['as'],'attributes':_0x5165e1[_0xa38a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x443827){logger['info'](_0xa38a('0x15'),_0xd1810b);logger[_0xa38a('0x20')](_0xa38a('0x15'),_0xd1810b,JSON[_0xa38a('0x21')](_0x443827));_0x4d3fe3(_0x443827);})[_0xa38a('0x14')](function(_0x5f5931){logger[_0xa38a('0x10')](_0xa38a('0x15'),_0x5f5931[_0xa38a('0x12')],_0xd1810b);_0x22a833(_0xa11bbc[_0xa38a('0x10')](0x1f4,_0x5f5931[_0xa38a('0x12')]));});});};exports[_0xa38a('0x22')]=function(_0x1ec5ea){var _0x3493d5=this;return new Promise(function(_0x221879,_0x137856){return db[_0xa38a('0x16')][_0xa38a('0x23')]({'raw':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea['options'][_0xa38a('0x19')]===undefined?!![]:![]:!![],'where':_0x1ec5ea['options']?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1a')]||null:null,'attributes':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1b')]||null:null,'include':_0x1ec5ea[_0xa38a('0x18')]?_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x1ec5ea[_0xa38a('0x18')][_0xa38a('0x1d')],function(_0x20d82f){return{'model':db[_0x20d82f['model']],'as':_0x20d82f['as'],'attributes':_0x20d82f['attributes'],'include':_0x20d82f[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x20d82f[_0xa38a('0x1d')],function(_0x471ae2){return{'model':db[_0x471ae2[_0xa38a('0x1f')]],'as':_0x471ae2['as'],'attributes':_0x471ae2[_0xa38a('0x1b')],'include':_0x471ae2[_0xa38a('0x1d')]?_[_0xa38a('0x1e')](_0x471ae2['include'],function(_0x55cf50){return{'model':db[_0x55cf50[_0xa38a('0x1f')]],'as':_0x55cf50['as'],'attributes':_0x55cf50[_0xa38a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa38a('0xb')](function(_0x53ad69){logger[_0xa38a('0xc')]('ShowSugarcrmAccount',_0x1ec5ea);logger[_0xa38a('0x20')](_0xa38a('0x22'),_0x1ec5ea,JSON['stringify'](_0x53ad69));_0x221879(_0x53ad69);})[_0xa38a('0x14')](function(_0x2e26af){logger[_0xa38a('0x10')](_0xa38a('0x22'),_0x2e26af[_0xa38a('0x12')],_0x1ec5ea);_0x137856(_0x3493d5[_0xa38a('0x10')](0x1f4,_0x2e26af[_0xa38a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 72535e2..d44dc2d 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 _0x8d6a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','post','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8d6a,0x147));var _0xa8d6=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8d6a[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xa8d6('0x0'));var util=require('util');var path=require(_0xa8d6('0x1'));var timeout=require(_0xa8d6('0x2'));var express=require(_0xa8d6('0x3'));var router=express[_0xa8d6('0x4')]();var fs_extra=require(_0xa8d6('0x5'));var auth=require(_0xa8d6('0x6'));var interaction=require(_0xa8d6('0x7'));var config=require(_0xa8d6('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xa8d6('0x9')]('/',auth[_0xa8d6('0xa')](),controller[_0xa8d6('0xb')]);router[_0xa8d6('0x9')](_0xa8d6('0xc'),auth[_0xa8d6('0xa')](),controller[_0xa8d6('0xd')]);router[_0xa8d6('0x9')](_0xa8d6('0xe'),auth[_0xa8d6('0xa')](),controller[_0xa8d6('0xf')]);router[_0xa8d6('0x9')]('/:id/subjects',auth[_0xa8d6('0xa')](),controller[_0xa8d6('0x10')]);router[_0xa8d6('0x9')]('/:id/descriptions',auth[_0xa8d6('0xa')](),controller['getDescriptions']);router[_0xa8d6('0x11')]('/',auth[_0xa8d6('0xa')](),controller[_0xa8d6('0x12')]);router[_0xa8d6('0x13')]('/:id',auth[_0xa8d6('0xa')](),controller['update']);router[_0xa8d6('0x14')](_0xa8d6('0xc'),auth[_0xa8d6('0xa')](),controller[_0xa8d6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xff19=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x137b03,_0x530eae){var _0xd30905=function(_0x2dc7de){while(--_0x2dc7de){_0x137b03['push'](_0x137b03['shift']());}};_0xd30905(++_0x530eae);}(_0xff19,0x156));var _0x9ff1=function(_0x125c5d,_0x809f6f){_0x125c5d=_0x125c5d-0x0;var _0x1cab49=_0xff19[_0x125c5d];return _0x1cab49;};'use strict';var multer=require(_0x9ff1('0x0'));var util=require(_0x9ff1('0x1'));var path=require('path');var timeout=require(_0x9ff1('0x2'));var express=require(_0x9ff1('0x3'));var router=express[_0x9ff1('0x4')]();var fs_extra=require(_0x9ff1('0x5'));var auth=require(_0x9ff1('0x6'));var interaction=require(_0x9ff1('0x7'));var config=require(_0x9ff1('0x8'));var controller=require(_0x9ff1('0x9'));router[_0x9ff1('0xa')]('/',auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xc')]);router['get']('/:id',auth[_0x9ff1('0xb')](),controller['show']);router[_0x9ff1('0xa')]('/:id/fields',auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xd')]);router[_0x9ff1('0xa')](_0x9ff1('0xe'),auth[_0x9ff1('0xb')](),controller[_0x9ff1('0xf')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9ff1('0x10')]);router[_0x9ff1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9ff1('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9ff1('0x13')](_0x9ff1('0x14'),auth[_0x9ff1('0xb')](),controller[_0x9ff1('0x15')]);module[_0x9ff1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 75a6642..aafcd83 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 _0xeecd=['sequelize','exports','STRING'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xeecd,0x150));var _0xdeec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeecd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdeec('0x0'));module[_0xdeec('0x1')]={'name':{'type':Sequelize[_0xdeec('0x2')]},'description':{'type':Sequelize[_0xdeec('0x2')]}}; \ No newline at end of file +var _0x5970=['STRING','sequelize','exports'];(function(_0x2a7049,_0x1ff477){var _0x5852d8=function(_0x303656){while(--_0x303656){_0x2a7049['push'](_0x2a7049['shift']());}};_0x5852d8(++_0x1ff477);}(_0x5970,0x151));var _0x0597=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x5970[_0x4b03c9];return _0x161ba2;};'use strict';var Sequelize=require(_0x0597('0x0'));module[_0x0597('0x1')]={'name':{'type':Sequelize[_0x0597('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 241aa75..42d5740 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 _0xa9b0=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','pick','getFields','getSubjects','SugarcrmField','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x44eac9,_0x12469c){var _0x27245f=function(_0x5dda7b){while(--_0x5dda7b){_0x44eac9['push'](_0x44eac9['shift']());}};_0x27245f(++_0x12469c);}(_0xa9b0,0xf7));var _0x0a9b=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xa9b0[_0x4d35f3];return _0x382fea;};'use strict';var emlformat=require(_0x0a9b('0x0'));var rimraf=require(_0x0a9b('0x1'));var zipdir=require(_0x0a9b('0x2'));var jsonpatch=require(_0x0a9b('0x3'));var rp=require(_0x0a9b('0x4'));var moment=require(_0x0a9b('0x5'));var BPromise=require(_0x0a9b('0x6'));var Mustache=require(_0x0a9b('0x7'));var util=require(_0x0a9b('0x8'));var path=require(_0x0a9b('0x9'));var sox=require(_0x0a9b('0xa'));var csv=require('to-csv');var ejs=require(_0x0a9b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a9b('0xc'));var squel=require(_0x0a9b('0xd'));var crypto=require(_0x0a9b('0xe'));var jsforce=require(_0x0a9b('0xf'));var deskjs=require(_0x0a9b('0x10'));var toCsv=require(_0x0a9b('0x11'));var querystring=require(_0x0a9b('0x12'));var Papa=require(_0x0a9b('0x13'));var Redis=require(_0x0a9b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0a9b('0x15'));var as=require(_0x0a9b('0x16'));var hardwareService=require(_0x0a9b('0x17'));var logger=require(_0x0a9b('0x18'))(_0x0a9b('0x19'));var utils=require(_0x0a9b('0x1a'));var config=require(_0x0a9b('0x1b'));var licenseUtil=require(_0x0a9b('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2da249,_0x18c6f8){_0x18c6f8=_0x18c6f8||0xcc;return function(_0xd09db7){if(_0xd09db7){return _0x2da249['sendStatus'](_0x18c6f8);}return _0x2da249[_0x0a9b('0x1d')](_0x18c6f8)[_0x0a9b('0x1e')]();};}function respondWithResult(_0x34e56c,_0x283433){_0x283433=_0x283433||0xc8;return function(_0x4dfbe3){if(_0x4dfbe3){return _0x34e56c['status'](_0x283433)[_0x0a9b('0x1f')](_0x4dfbe3);}};}function respondWithFilteredResult(_0x512100,_0x1a1276){return function(_0x292876){if(_0x292876){var _0x20aa86=typeof _0x1a1276[_0x0a9b('0x20')]===_0x0a9b('0x21')&&typeof _0x1a1276[_0x0a9b('0x22')]===_0x0a9b('0x21');var _0x4913b4=_0x292876[_0x0a9b('0x23')];var _0x13a852=_0x20aa86?0x0:_0x1a1276[_0x0a9b('0x20')];var _0x5e64fe=_0x20aa86?_0x292876[_0x0a9b('0x23')]:_0x1a1276[_0x0a9b('0x20')]+_0x1a1276[_0x0a9b('0x22')];var _0x323076;if(_0x5e64fe>=_0x4913b4){_0x5e64fe=_0x4913b4;_0x323076=0xc8;}else{_0x323076=0xce;}_0x512100['status'](_0x323076);return _0x512100[_0x0a9b('0x24')](_0x0a9b('0x25'),_0x13a852+'-'+_0x5e64fe+'/'+_0x4913b4)['json'](_0x292876);}return null;};}function patchUpdates(_0x52d09e){return function(_0x23270d){try{jsonpatch[_0x0a9b('0x26')](_0x23270d,_0x52d09e,!![]);}catch(_0x641aa6){return BPromise[_0x0a9b('0x27')](_0x641aa6);}return _0x23270d['save']();};}function saveUpdates(_0x1d0e30,_0x14f3bb){return function(_0x259c64){if(_0x259c64){return _0x259c64[_0x0a9b('0x28')](_0x1d0e30)['then'](function(_0x25e266){return _0x25e266;});}return null;};}function removeEntity(_0xd67fd2,_0x3da722){return function(_0x4cf3a8){if(_0x4cf3a8){return _0x4cf3a8[_0x0a9b('0x29')]()['then'](function(){_0xd67fd2[_0x0a9b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc998f7,_0x298ccd){return function(_0x912cd8){if(!_0x912cd8){_0xc998f7[_0x0a9b('0x2a')](0x194);}return _0x912cd8;};}function handleError(_0x33f89b,_0x5515a4){_0x5515a4=_0x5515a4||0x1f4;return function(_0x4a069e){logger[_0x0a9b('0x2b')](_0x4a069e[_0x0a9b('0x2c')]);if(_0x4a069e['name']){delete _0x4a069e['name'];}_0x33f89b[_0x0a9b('0x1d')](_0x5515a4)[_0x0a9b('0x2d')](_0x4a069e);};}exports['index']=function(_0x142314,_0x226e86){var _0x28bb0a={},_0xce13af={},_0x3b7a68={'count':0x0,'rows':[]};var _0x1caa87=_[_0x0a9b('0x2e')](db[_0x0a9b('0x2f')][_0x0a9b('0x30')],function(_0x49fadf){return{'name':_0x49fadf[_0x0a9b('0x31')],'type':_0x49fadf['type'][_0x0a9b('0x32')]};});_0xce13af[_0x0a9b('0x33')]=_[_0x0a9b('0x2e')](_0x1caa87,_0x0a9b('0x34'));_0xce13af['query']=_[_0x0a9b('0x35')](_0x142314[_0x0a9b('0x36')]);_0xce13af[_0x0a9b('0x37')]=_[_0x0a9b('0x38')](_0xce13af['model'],_0xce13af[_0x0a9b('0x36')]);_0x28bb0a['attributes']=_[_0x0a9b('0x38')](_0xce13af[_0x0a9b('0x33')],qs[_0x0a9b('0x39')](_0x142314[_0x0a9b('0x36')][_0x0a9b('0x39')]));_0x28bb0a[_0x0a9b('0x3a')]=_0x28bb0a['attributes'][_0x0a9b('0x3b')]?_0x28bb0a[_0x0a9b('0x3a')]:_0xce13af[_0x0a9b('0x33')];if(!_0x142314[_0x0a9b('0x36')][_0x0a9b('0x3c')](_0x0a9b('0x3d'))){_0x28bb0a[_0x0a9b('0x22')]=qs[_0x0a9b('0x22')](_0x142314[_0x0a9b('0x36')][_0x0a9b('0x22')]);_0x28bb0a[_0x0a9b('0x20')]=qs[_0x0a9b('0x20')](_0x142314[_0x0a9b('0x36')][_0x0a9b('0x20')]);}_0x28bb0a[_0x0a9b('0x3e')]=qs[_0x0a9b('0x3f')](_0x142314[_0x0a9b('0x36')][_0x0a9b('0x3f')]);_0x28bb0a['where']=qs[_0x0a9b('0x37')](_['pick'](_0x142314['query'],_0xce13af[_0x0a9b('0x37')]),_0x1caa87);if(_0x142314[_0x0a9b('0x36')][_0x0a9b('0x40')]){_0x28bb0a[_0x0a9b('0x41')]=_['merge'](_0x28bb0a[_0x0a9b('0x41')],{'$or':_[_0x0a9b('0x2e')](_0x1caa87,function(_0x421f71){if(_0x421f71[_0x0a9b('0x42')]!==_0x0a9b('0x43')){var _0x3820bc={};_0x3820bc[_0x421f71[_0x0a9b('0x34')]]={'$like':'%'+_0x142314['query'][_0x0a9b('0x40')]+'%'};return _0x3820bc;}})});}_0x28bb0a=_[_0x0a9b('0x44')]({},_0x28bb0a,_0x142314[_0x0a9b('0x45')]);var _0x44660e={'where':_0x28bb0a[_0x0a9b('0x41')]};return db[_0x0a9b('0x2f')]['count'](_0x44660e)[_0x0a9b('0x46')](function(_0x52a812){_0x3b7a68['count']=_0x52a812;if(_0x142314[_0x0a9b('0x36')][_0x0a9b('0x47')]){_0x28bb0a[_0x0a9b('0x48')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x0a9b('0x49')](_0x28bb0a);})[_0x0a9b('0x46')](function(_0x1ebf02){_0x3b7a68[_0x0a9b('0x4a')]=_0x1ebf02;return _0x3b7a68;})[_0x0a9b('0x46')](respondWithFilteredResult(_0x226e86,_0x28bb0a))[_0x0a9b('0x4b')](handleError(_0x226e86,null));};exports[_0x0a9b('0x4c')]=function(_0x572085,_0xa3ad21){var _0x2f0767={'raw':![],'where':{'id':_0x572085['params']['id']}},_0x41578a={};_0x41578a[_0x0a9b('0x33')]=_[_0x0a9b('0x35')](db[_0x0a9b('0x2f')][_0x0a9b('0x30')]);_0x41578a[_0x0a9b('0x36')]=_[_0x0a9b('0x35')](_0x572085['query']);_0x41578a[_0x0a9b('0x37')]=_['intersection'](_0x41578a[_0x0a9b('0x33')],_0x41578a[_0x0a9b('0x36')]);_0x2f0767[_0x0a9b('0x3a')]=_['intersection'](_0x41578a[_0x0a9b('0x33')],qs['fields'](_0x572085[_0x0a9b('0x36')]['fields']));_0x2f0767[_0x0a9b('0x3a')]=_0x2f0767[_0x0a9b('0x3a')]['length']?_0x2f0767[_0x0a9b('0x3a')]:_0x41578a[_0x0a9b('0x33')];if(_0x572085[_0x0a9b('0x36')][_0x0a9b('0x47')]){_0x2f0767[_0x0a9b('0x48')]=[{'all':!![]}];}_0x2f0767=_[_0x0a9b('0x44')]({},_0x2f0767,_0x572085[_0x0a9b('0x45')]);return db[_0x0a9b('0x2f')][_0x0a9b('0x4d')](_0x2f0767)[_0x0a9b('0x46')](handleEntityNotFound(_0xa3ad21,null))[_0x0a9b('0x46')](respondWithResult(_0xa3ad21,null))[_0x0a9b('0x4b')](handleError(_0xa3ad21,null));};exports[_0x0a9b('0x4e')]=function(_0x5c419f,_0x213275){return db[_0x0a9b('0x2f')]['create'](_0x5c419f[_0x0a9b('0x4f')],{})['then'](respondWithResult(_0x213275,0xc9))[_0x0a9b('0x4b')](handleError(_0x213275,null));};exports[_0x0a9b('0x28')]=function(_0x224d61,_0x2f1f54){if(_0x224d61[_0x0a9b('0x4f')]['id']){delete _0x224d61['body']['id'];}return db[_0x0a9b('0x2f')]['find']({'where':{'id':_0x224d61['params']['id']}})['then'](handleEntityNotFound(_0x2f1f54,null))[_0x0a9b('0x46')](saveUpdates(_0x224d61[_0x0a9b('0x4f')],null))[_0x0a9b('0x46')](respondWithResult(_0x2f1f54,null))['catch'](handleError(_0x2f1f54,null));};exports['destroy']=function(_0x240e0d,_0x395273){return db[_0x0a9b('0x2f')][_0x0a9b('0x4d')]({'where':{'id':_0x240e0d[_0x0a9b('0x50')]['id']}})[_0x0a9b('0x46')](handleEntityNotFound(_0x395273,null))['then'](removeEntity(_0x395273,null))[_0x0a9b('0x4b')](handleError(_0x395273,null));};exports['getFields']=function(_0x3b315b,_0x1c8e03,_0x32a4b4){var _0x1c9303={};var _0x466c68={};var _0x1e79f4;var _0x544f5a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3b315b[_0x0a9b('0x50')]['id']}})[_0x0a9b('0x46')](handleEntityNotFound(_0x1c8e03,null))[_0x0a9b('0x46')](function(_0x45f828){if(_0x45f828){_0x1e79f4=_0x45f828;_0x466c68['model']=_[_0x0a9b('0x35')](db['SugarcrmField'][_0x0a9b('0x30')]);_0x466c68['query']=_[_0x0a9b('0x35')](_0x3b315b['query']);_0x466c68[_0x0a9b('0x37')]=_['intersection'](_0x466c68[_0x0a9b('0x33')],_0x466c68[_0x0a9b('0x36')]);_0x1c9303[_0x0a9b('0x3a')]=_[_0x0a9b('0x38')](_0x466c68[_0x0a9b('0x33')],qs[_0x0a9b('0x39')](_0x3b315b[_0x0a9b('0x36')]['fields']));_0x1c9303[_0x0a9b('0x3a')]=_0x1c9303['attributes']['length']?_0x1c9303[_0x0a9b('0x3a')]:_0x466c68[_0x0a9b('0x33')];_0x1c9303[_0x0a9b('0x3e')]=qs[_0x0a9b('0x3f')](_0x3b315b['query'][_0x0a9b('0x3f')]);_0x1c9303[_0x0a9b('0x41')]=qs['filters'](_[_0x0a9b('0x51')](_0x3b315b[_0x0a9b('0x36')],_0x466c68[_0x0a9b('0x37')]));if(_0x3b315b[_0x0a9b('0x36')][_0x0a9b('0x40')]){_0x1c9303[_0x0a9b('0x41')]=_[_0x0a9b('0x44')](_0x1c9303[_0x0a9b('0x41')],{'$or':_['map'](_0x1c9303[_0x0a9b('0x3a')],function(_0x2d066e){var _0x33dc35={};_0x33dc35[_0x2d066e]={'$like':'%'+_0x3b315b[_0x0a9b('0x36')][_0x0a9b('0x40')]+'%'};return _0x33dc35;})});}_0x1c9303=_[_0x0a9b('0x44')]({},_0x1c9303,_0x3b315b['options']);return _0x1e79f4[_0x0a9b('0x52')](_0x1c9303);}})['then'](function(_0x4cf954){if(_0x4cf954){_0x544f5a=_0x4cf954[_0x0a9b('0x3b')];if(!_0x3b315b['query'][_0x0a9b('0x3c')](_0x0a9b('0x3d'))){_0x1c9303['limit']=qs[_0x0a9b('0x22')](_0x3b315b['query'][_0x0a9b('0x22')]);_0x1c9303[_0x0a9b('0x20')]=qs[_0x0a9b('0x20')](_0x3b315b[_0x0a9b('0x36')]['offset']);}return _0x1e79f4[_0x0a9b('0x52')](_0x1c9303);}})[_0x0a9b('0x46')](function(_0x2e9429){if(_0x2e9429){return _0x2e9429?{'count':_0x544f5a,'rows':_0x2e9429}:null;}})[_0x0a9b('0x46')](respondWithResult(_0x1c8e03,null))[_0x0a9b('0x4b')](handleError(_0x1c8e03,null));};exports[_0x0a9b('0x53')]=function(_0x49a64e,_0x5f58d1,_0x1ae28f){var _0x14f88c={};var _0x469547={};var _0x3c1864;var _0x2cf06b;return db[_0x0a9b('0x2f')]['findOne']({'where':{'id':_0x49a64e[_0x0a9b('0x50')]['id']}})[_0x0a9b('0x46')](handleEntityNotFound(_0x5f58d1,null))[_0x0a9b('0x46')](function(_0x5eab73){if(_0x5eab73){_0x3c1864=_0x5eab73;_0x469547[_0x0a9b('0x33')]=_[_0x0a9b('0x35')](db[_0x0a9b('0x54')]['rawAttributes']);_0x469547[_0x0a9b('0x36')]=_[_0x0a9b('0x35')](_0x49a64e[_0x0a9b('0x36')]);_0x469547[_0x0a9b('0x37')]=_[_0x0a9b('0x38')](_0x469547[_0x0a9b('0x33')],_0x469547[_0x0a9b('0x36')]);_0x14f88c[_0x0a9b('0x3a')]=_[_0x0a9b('0x38')](_0x469547[_0x0a9b('0x33')],qs[_0x0a9b('0x39')](_0x49a64e[_0x0a9b('0x36')][_0x0a9b('0x39')]));_0x14f88c[_0x0a9b('0x3a')]=_0x14f88c[_0x0a9b('0x3a')][_0x0a9b('0x3b')]?_0x14f88c['attributes']:_0x469547['model'];_0x14f88c['order']=qs[_0x0a9b('0x3f')](_0x49a64e[_0x0a9b('0x36')][_0x0a9b('0x3f')]);_0x14f88c[_0x0a9b('0x41')]=qs[_0x0a9b('0x37')](_[_0x0a9b('0x51')](_0x49a64e['query'],_0x469547[_0x0a9b('0x37')]));if(_0x49a64e[_0x0a9b('0x36')][_0x0a9b('0x40')]){_0x14f88c['where']=_[_0x0a9b('0x44')](_0x14f88c[_0x0a9b('0x41')],{'$or':_['map'](_0x14f88c[_0x0a9b('0x3a')],function(_0x3b099a){var _0x44255b={};_0x44255b[_0x3b099a]={'$like':'%'+_0x49a64e['query'][_0x0a9b('0x40')]+'%'};return _0x44255b;})});}_0x14f88c=_['merge']({},_0x14f88c,_0x49a64e['options']);return _0x3c1864[_0x0a9b('0x53')](_0x14f88c);}})[_0x0a9b('0x46')](function(_0x1a0cbe){if(_0x1a0cbe){_0x2cf06b=_0x1a0cbe[_0x0a9b('0x3b')];if(!_0x49a64e[_0x0a9b('0x36')][_0x0a9b('0x3c')](_0x0a9b('0x3d'))){_0x14f88c[_0x0a9b('0x22')]=qs[_0x0a9b('0x22')](_0x49a64e['query'][_0x0a9b('0x22')]);_0x14f88c[_0x0a9b('0x20')]=qs['offset'](_0x49a64e['query']['offset']);}return _0x3c1864[_0x0a9b('0x53')](_0x14f88c);}})['then'](function(_0x15b1be){if(_0x15b1be){return _0x15b1be?{'count':_0x2cf06b,'rows':_0x15b1be}:null;}})['then'](respondWithResult(_0x5f58d1,null))[_0x0a9b('0x4b')](handleError(_0x5f58d1,null));};exports['getDescriptions']=function(_0xef38ec,_0x27c59b,_0x5a63ca){var _0x339f03={};var _0x1a9b61={};var _0x3f184e;var _0x1c9e24;return db[_0x0a9b('0x2f')][_0x0a9b('0x55')]({'where':{'id':_0xef38ec[_0x0a9b('0x50')]['id']}})['then'](handleEntityNotFound(_0x27c59b,null))[_0x0a9b('0x46')](function(_0x1ed6ca){if(_0x1ed6ca){_0x3f184e=_0x1ed6ca;_0x1a9b61[_0x0a9b('0x33')]=_[_0x0a9b('0x35')](db[_0x0a9b('0x54')]['rawAttributes']);_0x1a9b61[_0x0a9b('0x36')]=_[_0x0a9b('0x35')](_0xef38ec['query']);_0x1a9b61[_0x0a9b('0x37')]=_[_0x0a9b('0x38')](_0x1a9b61['model'],_0x1a9b61['query']);_0x339f03[_0x0a9b('0x3a')]=_[_0x0a9b('0x38')](_0x1a9b61[_0x0a9b('0x33')],qs[_0x0a9b('0x39')](_0xef38ec[_0x0a9b('0x36')][_0x0a9b('0x39')]));_0x339f03['attributes']=_0x339f03[_0x0a9b('0x3a')][_0x0a9b('0x3b')]?_0x339f03['attributes']:_0x1a9b61[_0x0a9b('0x33')];_0x339f03[_0x0a9b('0x3e')]=qs[_0x0a9b('0x3f')](_0xef38ec[_0x0a9b('0x36')]['sort']);_0x339f03[_0x0a9b('0x41')]=qs[_0x0a9b('0x37')](_['pick'](_0xef38ec[_0x0a9b('0x36')],_0x1a9b61['filters']));if(_0xef38ec[_0x0a9b('0x36')]['filter']){_0x339f03['where']=_[_0x0a9b('0x44')](_0x339f03[_0x0a9b('0x41')],{'$or':_[_0x0a9b('0x2e')](_0x339f03[_0x0a9b('0x3a')],function(_0x4a8be9){var _0x448e24={};_0x448e24[_0x4a8be9]={'$like':'%'+_0xef38ec[_0x0a9b('0x36')]['filter']+'%'};return _0x448e24;})});}_0x339f03=_[_0x0a9b('0x44')]({},_0x339f03,_0xef38ec['options']);return _0x3f184e[_0x0a9b('0x56')](_0x339f03);}})['then'](function(_0x3daeab){if(_0x3daeab){_0x1c9e24=_0x3daeab['length'];if(!_0xef38ec[_0x0a9b('0x36')][_0x0a9b('0x3c')](_0x0a9b('0x3d'))){_0x339f03[_0x0a9b('0x22')]=qs[_0x0a9b('0x22')](_0xef38ec[_0x0a9b('0x36')][_0x0a9b('0x22')]);_0x339f03[_0x0a9b('0x20')]=qs['offset'](_0xef38ec[_0x0a9b('0x36')][_0x0a9b('0x20')]);}return _0x3f184e[_0x0a9b('0x56')](_0x339f03);}})[_0x0a9b('0x46')](function(_0x4c4ed3){if(_0x4c4ed3){return _0x4c4ed3?{'count':_0x1c9e24,'rows':_0x4c4ed3}:null;}})[_0x0a9b('0x46')](respondWithResult(_0x27c59b,null))[_0x0a9b('0x4b')](handleError(_0x27c59b,null));}; \ No newline at end of file +var _0x44ee=['body','getFields','findOne','SugarcrmField','order','pick','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create'];(function(_0x2c8fc6,_0x476ff2){var _0x2b4df1=function(_0x1f6c74){while(--_0x1f6c74){_0x2c8fc6['push'](_0x2c8fc6['shift']());}};_0x2b4df1(++_0x476ff2);}(_0x44ee,0xfc));var _0xe44e=function(_0x538f4c,_0x6ecb9a){_0x538f4c=_0x538f4c-0x0;var _0x4b017a=_0x44ee[_0x538f4c];return _0x4b017a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe44e('0x0'));var zipdir=require(_0xe44e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe44e('0x2'));var moment=require(_0xe44e('0x3'));var BPromise=require(_0xe44e('0x4'));var Mustache=require(_0xe44e('0x5'));var util=require(_0xe44e('0x6'));var path=require(_0xe44e('0x7'));var sox=require(_0xe44e('0x8'));var csv=require(_0xe44e('0x9'));var ejs=require(_0xe44e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe44e('0xb'));var squel=require(_0xe44e('0xc'));var crypto=require(_0xe44e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe44e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe44e('0xf'));var Papa=require(_0xe44e('0x10'));var Redis=require('ioredis');var authService=require(_0xe44e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe44e('0x12'));var hardwareService=require(_0xe44e('0x13'));var logger=require('../../config/logger')(_0xe44e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe44e('0x15'));var db=require(_0xe44e('0x16'))['db'];function respondWithStatusCode(_0x3d2acf,_0x3b9977){_0x3b9977=_0x3b9977||0xcc;return function(_0x1df53d){if(_0x1df53d){return _0x3d2acf[_0xe44e('0x17')](_0x3b9977);}return _0x3d2acf['status'](_0x3b9977)[_0xe44e('0x18')]();};}function respondWithResult(_0x1eca92,_0x30b3ad){_0x30b3ad=_0x30b3ad||0xc8;return function(_0x4b204c){if(_0x4b204c){return _0x1eca92[_0xe44e('0x19')](_0x30b3ad)[_0xe44e('0x1a')](_0x4b204c);}};}function respondWithFilteredResult(_0x14d2ff,_0x186f5c){return function(_0x4f1509){if(_0x4f1509){var _0x1890be=typeof _0x186f5c['offset']==='undefined'&&typeof _0x186f5c[_0xe44e('0x1b')]==='undefined';var _0x4d7d78=_0x4f1509['count'];var _0x5bc441=_0x1890be?0x0:_0x186f5c[_0xe44e('0x1c')];var _0x190b10=_0x1890be?_0x4f1509[_0xe44e('0x1d')]:_0x186f5c[_0xe44e('0x1c')]+_0x186f5c[_0xe44e('0x1b')];var _0x312eb6;if(_0x190b10>=_0x4d7d78){_0x190b10=_0x4d7d78;_0x312eb6=0xc8;}else{_0x312eb6=0xce;}_0x14d2ff[_0xe44e('0x19')](_0x312eb6);return _0x14d2ff[_0xe44e('0x1e')](_0xe44e('0x1f'),_0x5bc441+'-'+_0x190b10+'/'+_0x4d7d78)[_0xe44e('0x1a')](_0x4f1509);}return null;};}function patchUpdates(_0xbb33ba){return function(_0x57ebdb){try{jsonpatch[_0xe44e('0x20')](_0x57ebdb,_0xbb33ba,!![]);}catch(_0x2fa455){return BPromise[_0xe44e('0x21')](_0x2fa455);}return _0x57ebdb['save']();};}function saveUpdates(_0x36a118,_0x3d5899){return function(_0x4980fc){if(_0x4980fc){return _0x4980fc[_0xe44e('0x22')](_0x36a118)[_0xe44e('0x23')](function(_0x3dd250){return _0x3dd250;});}return null;};}function removeEntity(_0x2a4b17,_0x2a7845){return function(_0x571da4){if(_0x571da4){return _0x571da4[_0xe44e('0x24')]()['then'](function(){_0x2a4b17[_0xe44e('0x19')](0xcc)[_0xe44e('0x18')]();});}};}function handleEntityNotFound(_0x103492,_0x123d24){return function(_0x4ce840){if(!_0x4ce840){_0x103492[_0xe44e('0x17')](0x194);}return _0x4ce840;};}function handleError(_0x822eed,_0x52d5e3){_0x52d5e3=_0x52d5e3||0x1f4;return function(_0x43c327){logger[_0xe44e('0x25')](_0x43c327[_0xe44e('0x26')]);if(_0x43c327['name']){delete _0x43c327[_0xe44e('0x27')];}_0x822eed[_0xe44e('0x19')](_0x52d5e3)[_0xe44e('0x28')](_0x43c327);};}exports[_0xe44e('0x29')]=function(_0x5bdb31,_0x45ca0d){var _0x3800a3={},_0x40d1b2={},_0xd98ce9={'count':0x0,'rows':[]};var _0x1011de=_[_0xe44e('0x2a')](db[_0xe44e('0x2b')][_0xe44e('0x2c')],function(_0x530b76){return{'name':_0x530b76[_0xe44e('0x2d')],'type':_0x530b76[_0xe44e('0x2e')][_0xe44e('0x2f')]};});_0x40d1b2['model']=_[_0xe44e('0x2a')](_0x1011de,_0xe44e('0x27'));_0x40d1b2[_0xe44e('0x30')]=_['keys'](_0x5bdb31['query']);_0x40d1b2['filters']=_['intersection'](_0x40d1b2[_0xe44e('0x31')],_0x40d1b2[_0xe44e('0x30')]);_0x3800a3['attributes']=_[_0xe44e('0x32')](_0x40d1b2[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x5bdb31[_0xe44e('0x30')]['fields']));_0x3800a3[_0xe44e('0x34')]=_0x3800a3[_0xe44e('0x34')][_0xe44e('0x35')]?_0x3800a3[_0xe44e('0x34')]:_0x40d1b2[_0xe44e('0x31')];if(!_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x36')]('nolimit')){_0x3800a3[_0xe44e('0x1b')]=qs['limit'](_0x5bdb31[_0xe44e('0x30')]['limit']);_0x3800a3[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x5bdb31['query']['offset']);}_0x3800a3['order']=qs[_0xe44e('0x37')](_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x37')]);_0x3800a3[_0xe44e('0x38')]=qs[_0xe44e('0x39')](_['pick'](_0x5bdb31[_0xe44e('0x30')],_0x40d1b2[_0xe44e('0x39')]),_0x1011de);if(_0x5bdb31['query'][_0xe44e('0x3a')]){_0x3800a3[_0xe44e('0x38')]=_['merge'](_0x3800a3['where'],{'$or':_[_0xe44e('0x2a')](_0x1011de,function(_0x35bd5c){if(_0x35bd5c[_0xe44e('0x2e')]!==_0xe44e('0x3b')){var _0x40e5e3={};_0x40e5e3[_0x35bd5c[_0xe44e('0x27')]]={'$like':'%'+_0x5bdb31[_0xe44e('0x30')]['filter']+'%'};return _0x40e5e3;}})});}_0x3800a3=_['merge']({},_0x3800a3,_0x5bdb31[_0xe44e('0x3c')]);var _0x580d10={'where':_0x3800a3[_0xe44e('0x38')]};return db[_0xe44e('0x2b')][_0xe44e('0x1d')](_0x580d10)[_0xe44e('0x23')](function(_0x47ae93){_0xd98ce9[_0xe44e('0x1d')]=_0x47ae93;if(_0x5bdb31[_0xe44e('0x30')][_0xe44e('0x3d')]){_0x3800a3[_0xe44e('0x3e')]=[{'all':!![]}];}return db[_0xe44e('0x2b')][_0xe44e('0x3f')](_0x3800a3);})[_0xe44e('0x23')](function(_0x406318){_0xd98ce9[_0xe44e('0x40')]=_0x406318;return _0xd98ce9;})[_0xe44e('0x23')](respondWithFilteredResult(_0x45ca0d,_0x3800a3))[_0xe44e('0x41')](handleError(_0x45ca0d,null));};exports[_0xe44e('0x42')]=function(_0x3b05a6,_0x4e1a18){var _0x16f720={'raw':![],'where':{'id':_0x3b05a6[_0xe44e('0x43')]['id']}},_0x2d12e8={};_0x2d12e8[_0xe44e('0x31')]=_['keys'](db[_0xe44e('0x2b')][_0xe44e('0x2c')]);_0x2d12e8[_0xe44e('0x30')]=_[_0xe44e('0x44')](_0x3b05a6[_0xe44e('0x30')]);_0x2d12e8[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x2d12e8[_0xe44e('0x31')],_0x2d12e8[_0xe44e('0x30')]);_0x16f720[_0xe44e('0x34')]=_['intersection'](_0x2d12e8[_0xe44e('0x31')],qs['fields'](_0x3b05a6[_0xe44e('0x30')][_0xe44e('0x33')]));_0x16f720[_0xe44e('0x34')]=_0x16f720['attributes']['length']?_0x16f720['attributes']:_0x2d12e8[_0xe44e('0x31')];if(_0x3b05a6['query'][_0xe44e('0x3d')]){_0x16f720['include']=[{'all':!![]}];}_0x16f720=_[_0xe44e('0x45')]({},_0x16f720,_0x3b05a6[_0xe44e('0x3c')]);return db[_0xe44e('0x2b')][_0xe44e('0x46')](_0x16f720)[_0xe44e('0x23')](handleEntityNotFound(_0x4e1a18,null))[_0xe44e('0x23')](respondWithResult(_0x4e1a18,null))[_0xe44e('0x41')](handleError(_0x4e1a18,null));};exports[_0xe44e('0x47')]=function(_0x211a5b,_0x5a59cd){return db[_0xe44e('0x2b')]['create'](_0x211a5b[_0xe44e('0x48')],{})[_0xe44e('0x23')](respondWithResult(_0x5a59cd,0xc9))['catch'](handleError(_0x5a59cd,null));};exports[_0xe44e('0x22')]=function(_0x3dd26b,_0x4b5b88){if(_0x3dd26b['body']['id']){delete _0x3dd26b[_0xe44e('0x48')]['id'];}return db['SugarcrmConfiguration'][_0xe44e('0x46')]({'where':{'id':_0x3dd26b['params']['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x4b5b88,null))[_0xe44e('0x23')](saveUpdates(_0x3dd26b[_0xe44e('0x48')],null))[_0xe44e('0x23')](respondWithResult(_0x4b5b88,null))['catch'](handleError(_0x4b5b88,null));};exports['destroy']=function(_0xf68e07,_0x47bf82){return db[_0xe44e('0x2b')][_0xe44e('0x46')]({'where':{'id':_0xf68e07[_0xe44e('0x43')]['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x47bf82,null))[_0xe44e('0x23')](removeEntity(_0x47bf82,null))['catch'](handleError(_0x47bf82,null));};exports[_0xe44e('0x49')]=function(_0x5e82e1,_0x2f54fb,_0x3557aa){var _0x50ed16={};var _0x1794cc={};var _0x30e1fc;var _0x2ac19b;return db[_0xe44e('0x2b')][_0xe44e('0x4a')]({'where':{'id':_0x5e82e1[_0xe44e('0x43')]['id']}})[_0xe44e('0x23')](handleEntityNotFound(_0x2f54fb,null))[_0xe44e('0x23')](function(_0x3aaece){if(_0x3aaece){_0x30e1fc=_0x3aaece;_0x1794cc['model']=_[_0xe44e('0x44')](db[_0xe44e('0x4b')][_0xe44e('0x2c')]);_0x1794cc['query']=_[_0xe44e('0x44')](_0x5e82e1[_0xe44e('0x30')]);_0x1794cc[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x1794cc[_0xe44e('0x31')],_0x1794cc['query']);_0x50ed16[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x1794cc[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x33')]));_0x50ed16['attributes']=_0x50ed16[_0xe44e('0x34')][_0xe44e('0x35')]?_0x50ed16[_0xe44e('0x34')]:_0x1794cc['model'];_0x50ed16[_0xe44e('0x4c')]=qs[_0xe44e('0x37')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x37')]);_0x50ed16['where']=qs[_0xe44e('0x39')](_[_0xe44e('0x4d')](_0x5e82e1['query'],_0x1794cc[_0xe44e('0x39')]));if(_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x3a')]){_0x50ed16['where']=_[_0xe44e('0x45')](_0x50ed16[_0xe44e('0x38')],{'$or':_[_0xe44e('0x2a')](_0x50ed16[_0xe44e('0x34')],function(_0xf9fa3b){var _0x4eab27={};_0x4eab27[_0xf9fa3b]={'$like':'%'+_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x3a')]+'%'};return _0x4eab27;})});}_0x50ed16=_['merge']({},_0x50ed16,_0x5e82e1[_0xe44e('0x3c')]);return _0x30e1fc['getFields'](_0x50ed16);}})[_0xe44e('0x23')](function(_0x194ded){if(_0x194ded){_0x2ac19b=_0x194ded['length'];if(!_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x36')](_0xe44e('0x4e'))){_0x50ed16[_0xe44e('0x1b')]=qs['limit'](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x1b')]);_0x50ed16[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x5e82e1[_0xe44e('0x30')][_0xe44e('0x1c')]);}return _0x30e1fc[_0xe44e('0x49')](_0x50ed16);}})[_0xe44e('0x23')](function(_0x536943){if(_0x536943){return _0x536943?{'count':_0x2ac19b,'rows':_0x536943}:null;}})['then'](respondWithResult(_0x2f54fb,null))['catch'](handleError(_0x2f54fb,null));};exports['getSubjects']=function(_0x16898b,_0x852546,_0x13e353){var _0x267ab9={};var _0x312ade={};var _0x57a88a;var _0x1db9e8;return db[_0xe44e('0x2b')]['findOne']({'where':{'id':_0x16898b['params']['id']}})['then'](handleEntityNotFound(_0x852546,null))[_0xe44e('0x23')](function(_0x2d70fa){if(_0x2d70fa){_0x57a88a=_0x2d70fa;_0x312ade[_0xe44e('0x31')]=_['keys'](db[_0xe44e('0x4b')][_0xe44e('0x2c')]);_0x312ade['query']=_[_0xe44e('0x44')](_0x16898b[_0xe44e('0x30')]);_0x312ade[_0xe44e('0x39')]=_['intersection'](_0x312ade[_0xe44e('0x31')],_0x312ade[_0xe44e('0x30')]);_0x267ab9[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x312ade[_0xe44e('0x31')],qs['fields'](_0x16898b[_0xe44e('0x30')][_0xe44e('0x33')]));_0x267ab9[_0xe44e('0x34')]=_0x267ab9[_0xe44e('0x34')][_0xe44e('0x35')]?_0x267ab9[_0xe44e('0x34')]:_0x312ade[_0xe44e('0x31')];_0x267ab9['order']=qs['sort'](_0x16898b[_0xe44e('0x30')][_0xe44e('0x37')]);_0x267ab9['where']=qs[_0xe44e('0x39')](_[_0xe44e('0x4d')](_0x16898b[_0xe44e('0x30')],_0x312ade[_0xe44e('0x39')]));if(_0x16898b['query'][_0xe44e('0x3a')]){_0x267ab9['where']=_[_0xe44e('0x45')](_0x267ab9['where'],{'$or':_['map'](_0x267ab9[_0xe44e('0x34')],function(_0x148a8a){var _0x137afb={};_0x137afb[_0x148a8a]={'$like':'%'+_0x16898b['query']['filter']+'%'};return _0x137afb;})});}_0x267ab9=_[_0xe44e('0x45')]({},_0x267ab9,_0x16898b[_0xe44e('0x3c')]);return _0x57a88a[_0xe44e('0x4f')](_0x267ab9);}})[_0xe44e('0x23')](function(_0x141d63){if(_0x141d63){_0x1db9e8=_0x141d63['length'];if(!_0x16898b['query'][_0xe44e('0x36')](_0xe44e('0x4e'))){_0x267ab9['limit']=qs[_0xe44e('0x1b')](_0x16898b[_0xe44e('0x30')][_0xe44e('0x1b')]);_0x267ab9[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x16898b[_0xe44e('0x30')][_0xe44e('0x1c')]);}return _0x57a88a[_0xe44e('0x4f')](_0x267ab9);}})['then'](function(_0x4dc82b){if(_0x4dc82b){return _0x4dc82b?{'count':_0x1db9e8,'rows':_0x4dc82b}:null;}})['then'](respondWithResult(_0x852546,null))['catch'](handleError(_0x852546,null));};exports[_0xe44e('0x50')]=function(_0x3ec4c4,_0x35f065,_0x22933c){var _0x352b6e={};var _0x4a35e6={};var _0x2556f8;var _0x1fc596;return db['SugarcrmConfiguration'][_0xe44e('0x4a')]({'where':{'id':_0x3ec4c4['params']['id']}})['then'](handleEntityNotFound(_0x35f065,null))[_0xe44e('0x23')](function(_0x468a0f){if(_0x468a0f){_0x2556f8=_0x468a0f;_0x4a35e6[_0xe44e('0x31')]=_[_0xe44e('0x44')](db['SugarcrmField']['rawAttributes']);_0x4a35e6['query']=_[_0xe44e('0x44')](_0x3ec4c4[_0xe44e('0x30')]);_0x4a35e6[_0xe44e('0x39')]=_[_0xe44e('0x32')](_0x4a35e6['model'],_0x4a35e6[_0xe44e('0x30')]);_0x352b6e[_0xe44e('0x34')]=_[_0xe44e('0x32')](_0x4a35e6[_0xe44e('0x31')],qs[_0xe44e('0x33')](_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x33')]));_0x352b6e[_0xe44e('0x34')]=_0x352b6e['attributes']['length']?_0x352b6e['attributes']:_0x4a35e6[_0xe44e('0x31')];_0x352b6e[_0xe44e('0x4c')]=qs[_0xe44e('0x37')](_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x37')]);_0x352b6e['where']=qs['filters'](_['pick'](_0x3ec4c4[_0xe44e('0x30')],_0x4a35e6['filters']));if(_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x3a')]){_0x352b6e['where']=_[_0xe44e('0x45')](_0x352b6e[_0xe44e('0x38')],{'$or':_[_0xe44e('0x2a')](_0x352b6e[_0xe44e('0x34')],function(_0x2613fa){var _0xc1d82f={};_0xc1d82f[_0x2613fa]={'$like':'%'+_0x3ec4c4[_0xe44e('0x30')][_0xe44e('0x3a')]+'%'};return _0xc1d82f;})});}_0x352b6e=_[_0xe44e('0x45')]({},_0x352b6e,_0x3ec4c4[_0xe44e('0x3c')]);return _0x2556f8['getDescriptions'](_0x352b6e);}})[_0xe44e('0x23')](function(_0x261164){if(_0x261164){_0x1fc596=_0x261164[_0xe44e('0x35')];if(!_0x3ec4c4[_0xe44e('0x30')]['hasOwnProperty']('nolimit')){_0x352b6e[_0xe44e('0x1b')]=qs[_0xe44e('0x1b')](_0x3ec4c4[_0xe44e('0x30')]['limit']);_0x352b6e[_0xe44e('0x1c')]=qs[_0xe44e('0x1c')](_0x3ec4c4[_0xe44e('0x30')]['offset']);}return _0x2556f8[_0xe44e('0x50')](_0x352b6e);}})[_0xe44e('0x23')](function(_0x25d7ef){if(_0x25d7ef){return _0x25d7ef?{'count':_0x1fc596,'rows':_0x25d7ef}:null;}})['then'](respondWithResult(_0x35f065,null))[_0xe44e('0x41')](handleError(_0x35f065,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7db82da..fdeb81e 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 _0x6996=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0xd1d2ae,_0xadf779){var _0x36dbdd=function(_0x44ddf6){while(--_0x44ddf6){_0xd1d2ae['push'](_0xd1d2ae['shift']());}};_0x36dbdd(++_0xadf779);}(_0x6996,0x9f));var _0x6699=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x6996[_0x82140];return _0x2b15a6;};'use strict';var _=require(_0x6699('0x0'));var util=require(_0x6699('0x1'));var logger=require('../../config/logger')(_0x6699('0x2'));var moment=require(_0x6699('0x3'));var BPromise=require(_0x6699('0x4'));var rp=require(_0x6699('0x5'));var fs=require('fs');var path=require(_0x6699('0x6'));var rimraf=require(_0x6699('0x7'));var config=require('../../config/environment');var attributes=require(_0x6699('0x8'));module[_0x6699('0x9')]=function(_0x133ed4,_0x2bd7d1){return _0x133ed4[_0x6699('0xa')](_0x6699('0xb'),attributes,{'tableName':_0x6699('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d5=['moment','request-promise','path','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x15433b,_0x629b9d){var _0x3ce496=function(_0xe54809){while(--_0xe54809){_0x15433b['push'](_0x15433b['shift']());}};_0x3ce496(++_0x629b9d);}(_0xa2d5,0x177));var _0x5a2d=function(_0x2cb58d,_0xb242df){_0x2cb58d=_0x2cb58d-0x0;var _0x2f9c1e=_0xa2d5[_0x2cb58d];return _0x2f9c1e;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var logger=require(_0x5a2d('0x2'))('api');var moment=require(_0x5a2d('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a2d('0x4'));var fs=require('fs');var path=require(_0x5a2d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5a2d('0x6'));module['exports']=function(_0x2f93ce,_0x3ae996){return _0x2f93ce[_0x5a2d('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x5a2d('0x8'),'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 53a6dea..8acda2f 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 _0xff38=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ef1d3,_0x1feca1){var _0x3c990e=function(_0x589ba6){while(--_0x589ba6){_0x5ef1d3['push'](_0x5ef1d3['shift']());}};_0x3c990e(++_0x1feca1);}(_0xff38,0x122));var _0x8ff3=function(_0x76b168,_0x1219ba){_0x76b168=_0x76b168-0x0;var _0x2410a1=_0xff38[_0x76b168];return _0x2410a1;};'use strict';var _=require(_0x8ff3('0x0'));var util=require(_0x8ff3('0x1'));var moment=require(_0x8ff3('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ff3('0x3'));var fs=require('fs');var Redis=require(_0x8ff3('0x4'));var db=require(_0x8ff3('0x5'))['db'];var utils=require(_0x8ff3('0x6'));var logger=require(_0x8ff3('0x7'))(_0x8ff3('0x8'));var config=require('../../config/environment');var jayson=require(_0x8ff3('0x9'));var client=jayson['client'][_0x8ff3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e39c,_0x2ed4a7,_0x142a85){return new BPromise(function(_0x164c8b,_0x21d173){return client['request'](_0x52e39c,_0x142a85)[_0x8ff3('0xb')](function(_0x29fb0a){logger[_0x8ff3('0xc')](_0x8ff3('0xd'),_0x2ed4a7,_0x8ff3('0xe'));logger[_0x8ff3('0xf')](_0x8ff3('0x10'),_0x2ed4a7,'request\x20sent',JSON['stringify'](_0x29fb0a));if(_0x29fb0a['error']){if(_0x29fb0a[_0x8ff3('0x11')][_0x8ff3('0x12')]===0x1f4){logger['error'](_0x8ff3('0xd'),_0x2ed4a7,_0x29fb0a[_0x8ff3('0x11')]['message']);return _0x21d173(_0x29fb0a[_0x8ff3('0x11')][_0x8ff3('0x13')]);}logger['error'](_0x8ff3('0xd'),_0x2ed4a7,_0x29fb0a[_0x8ff3('0x11')][_0x8ff3('0x13')]);return _0x164c8b(_0x29fb0a[_0x8ff3('0x11')]['message']);}else{logger[_0x8ff3('0xc')](_0x8ff3('0xd'),_0x2ed4a7,_0x8ff3('0xe'));_0x164c8b(_0x29fb0a[_0x8ff3('0x14')][_0x8ff3('0x13')]);}})[_0x8ff3('0x15')](function(_0x30902f){logger[_0x8ff3('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ed4a7,_0x30902f);_0x21d173(_0x30902f);});});} \ No newline at end of file +var _0x5fb1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x41a352,_0x1feafa){var _0x101096=function(_0x2c065a){while(--_0x2c065a){_0x41a352['push'](_0x41a352['shift']());}};_0x101096(++_0x1feafa);}(_0x5fb1,0x146));var _0x15fb=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x5fb1[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x15fb('0x0'));var util=require('util');var moment=require(_0x15fb('0x1'));var BPromise=require(_0x15fb('0x2'));var rs=require(_0x15fb('0x3'));var fs=require('fs');var Redis=require(_0x15fb('0x4'));var db=require(_0x15fb('0x5'))['db'];var utils=require(_0x15fb('0x6'));var logger=require(_0x15fb('0x7'))(_0x15fb('0x8'));var config=require(_0x15fb('0x9'));var jayson=require(_0x15fb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1282e8,_0x5c2da8,_0x50aac8){return new BPromise(function(_0x389872,_0x205367){return client['request'](_0x1282e8,_0x50aac8)[_0x15fb('0xb')](function(_0x331320){logger[_0x15fb('0xc')](_0x15fb('0xd'),_0x5c2da8,_0x15fb('0xe'));logger[_0x15fb('0xf')](_0x15fb('0x10'),_0x5c2da8,_0x15fb('0xe'),JSON[_0x15fb('0x11')](_0x331320));if(_0x331320['error']){if(_0x331320[_0x15fb('0x12')][_0x15fb('0x13')]===0x1f4){logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x331320['error']['message']);return _0x205367(_0x331320[_0x15fb('0x12')][_0x15fb('0x14')]);}logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x331320[_0x15fb('0x12')]['message']);return _0x389872(_0x331320[_0x15fb('0x12')]['message']);}else{logger[_0x15fb('0xc')](_0x15fb('0xd'),_0x5c2da8,_0x15fb('0xe'));_0x389872(_0x331320[_0x15fb('0x15')][_0x15fb('0x14')]);}})['catch'](function(_0x4d98aa){logger[_0x15fb('0x12')](_0x15fb('0xd'),_0x5c2da8,_0x4d98aa);_0x205367(_0x4d98aa);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 57c83a3..d9959a6 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 _0xe0ad=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x455722,_0x40a41e){var _0xff6246=function(_0x2c519b){while(--_0x2c519b){_0x455722['push'](_0x455722['shift']());}};_0xff6246(++_0x40a41e);}(_0xe0ad,0xe7));var _0xde0a=function(_0x2c314d,_0x456374){_0x2c314d=_0x2c314d-0x0;var _0x38af7d=_0xe0ad[_0x2c314d];return _0x38af7d;};'use strict';var multer=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var path=require(_0xde0a('0x2'));var timeout=require(_0xde0a('0x3'));var express=require(_0xde0a('0x4'));var router=express[_0xde0a('0x5')]();var fs_extra=require(_0xde0a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xde0a('0x7'));var config=require('../../config/environment');var controller=require(_0xde0a('0x8'));router[_0xde0a('0x9')]('/',auth[_0xde0a('0xa')](),controller[_0xde0a('0xb')]);router[_0xde0a('0x9')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xde0a('0xd')]);router[_0xde0a('0xe')]('/:id',auth[_0xde0a('0xa')](),controller[_0xde0a('0xf')]);router[_0xde0a('0x10')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller[_0xde0a('0x11')]);module[_0xde0a('0x12')]=router; \ No newline at end of file +var _0x797e=['show','post','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated'];(function(_0x47fb54,_0x28698c){var _0x1139a7=function(_0x17c781){while(--_0x17c781){_0x47fb54['push'](_0x47fb54['shift']());}};_0x1139a7(++_0x28698c);}(_0x797e,0x71));var _0xe797=function(_0x3f264c,_0x30c0c6){_0x3f264c=_0x3f264c-0x0;var _0x133f67=_0x797e[_0x3f264c];return _0x133f67;};'use strict';var multer=require(_0xe797('0x0'));var util=require(_0xe797('0x1'));var path=require('path');var timeout=require(_0xe797('0x2'));var express=require(_0xe797('0x3'));var router=express[_0xe797('0x4')]();var fs_extra=require(_0xe797('0x5'));var auth=require(_0xe797('0x6'));var interaction=require(_0xe797('0x7'));var config=require(_0xe797('0x8'));var controller=require(_0xe797('0x9'));router[_0xe797('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe797('0xb'),auth[_0xe797('0xc')](),controller[_0xe797('0xd')]);router[_0xe797('0xe')]('/',auth[_0xe797('0xc')](),controller['create']);router[_0xe797('0xf')](_0xe797('0xb'),auth[_0xe797('0xc')](),controller['update']);router[_0xe797('0x10')](_0xe797('0xb'),auth[_0xe797('0xc')](),controller[_0xe797('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c42d908..d45e67f 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 _0xdf0b=['sequelize','ENUM','string','keyValue','picklist','customVariable','STRING','BOOLEAN'];(function(_0x5e660c,_0x516e7c){var _0x2380b1=function(_0x45c297){while(--_0x45c297){_0x5e660c['push'](_0x5e660c['shift']());}};_0x2380b1(++_0x516e7c);}(_0xdf0b,0xc8));var _0xbdf0=function(_0x3b9140,_0x5b33e2){_0x3b9140=_0x3b9140-0x0;var _0x1d559b=_0xdf0b[_0x3b9140];return _0x1d559b;};'use strict';var Sequelize=require(_0xbdf0('0x0'));module['exports']={'type':{'type':Sequelize[_0xbdf0('0x1')](_0xbdf0('0x2'),'variable','customVariable',_0xbdf0('0x3'),_0xbdf0('0x4')),'defaultValue':_0xbdf0('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbdf0('0x1')](_0xbdf0('0x2'),'variable',_0xbdf0('0x5'))},'keyContent':{'type':Sequelize[_0xbdf0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbdf0('0x6')]},'customField':{'type':Sequelize[_0xbdf0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbdf0('0x6')]}}; \ No newline at end of file +var _0xa9b9=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x5f47a7,_0xb765cf){var _0x1a167c=function(_0x2b3029){while(--_0x2b3029){_0x5f47a7['push'](_0x5f47a7['shift']());}};_0x1a167c(++_0xb765cf);}(_0xa9b9,0x75));var _0x9a9b=function(_0x22de84,_0x56142b){_0x22de84=_0x22de84-0x0;var _0x54fc49=_0xa9b9[_0x22de84];return _0x54fc49;};'use strict';var Sequelize=require(_0x9a9b('0x0'));module['exports']={'type':{'type':Sequelize[_0x9a9b('0x1')]('string',_0x9a9b('0x2'),_0x9a9b('0x3'),_0x9a9b('0x4'),'picklist'),'defaultValue':_0x9a9b('0x5')},'content':{'type':Sequelize[_0x9a9b('0x6')]},'key':{'type':Sequelize[_0x9a9b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9a9b('0x2'),_0x9a9b('0x3'))},'keyContent':{'type':Sequelize[_0x9a9b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9a9b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a9b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 82286f1..a586e56 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 _0x235c=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api'];(function(_0x2f76b0,_0x3336a1){var _0x1be0b8=function(_0x4e61db){while(--_0x4e61db){_0x2f76b0['push'](_0x2f76b0['shift']());}};_0x1be0b8(++_0x3336a1);}(_0x235c,0x15e));var _0xc235=function(_0x21dd92,_0x1b1bdc){_0x21dd92=_0x21dd92-0x0;var _0x1aec86=_0x235c[_0x21dd92];return _0x1aec86;};'use strict';var emlformat=require(_0xc235('0x0'));var rimraf=require(_0xc235('0x1'));var zipdir=require(_0xc235('0x2'));var jsonpatch=require(_0xc235('0x3'));var rp=require(_0xc235('0x4'));var moment=require(_0xc235('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc235('0x6'));var util=require(_0xc235('0x7'));var path=require(_0xc235('0x8'));var sox=require(_0xc235('0x9'));var csv=require('to-csv');var ejs=require(_0xc235('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc235('0xb'));var squel=require('squel');var crypto=require(_0xc235('0xc'));var jsforce=require(_0xc235('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc235('0xe'));var querystring=require(_0xc235('0xf'));var Papa=require(_0xc235('0x10'));var Redis=require('ioredis');var authService=require(_0xc235('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc235('0x12'));var logger=require('../../config/logger')(_0xc235('0x13'));var utils=require(_0xc235('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc235('0x15'));var db=require(_0xc235('0x16'))['db'];function respondWithStatusCode(_0x2c716c,_0xc313e9){_0xc313e9=_0xc313e9||0xcc;return function(_0x4a2976){if(_0x4a2976){return _0x2c716c[_0xc235('0x17')](_0xc313e9);}return _0x2c716c[_0xc235('0x18')](_0xc313e9)[_0xc235('0x19')]();};}function respondWithResult(_0x18c499,_0x185e84){_0x185e84=_0x185e84||0xc8;return function(_0x2c59b2){if(_0x2c59b2){return _0x18c499[_0xc235('0x18')](_0x185e84)[_0xc235('0x1a')](_0x2c59b2);}};}function respondWithFilteredResult(_0x1e9d53,_0x3ec1c4){return function(_0x356bda){if(_0x356bda){var _0x2a1c7c=typeof _0x3ec1c4['offset']===_0xc235('0x1b')&&typeof _0x3ec1c4[_0xc235('0x1c')]===_0xc235('0x1b');var _0xa80a7f=_0x356bda[_0xc235('0x1d')];var _0x244431=_0x2a1c7c?0x0:_0x3ec1c4[_0xc235('0x1e')];var _0x23ee41=_0x2a1c7c?_0x356bda['count']:_0x3ec1c4[_0xc235('0x1e')]+_0x3ec1c4[_0xc235('0x1c')];var _0xec3b36;if(_0x23ee41>=_0xa80a7f){_0x23ee41=_0xa80a7f;_0xec3b36=0xc8;}else{_0xec3b36=0xce;}_0x1e9d53['status'](_0xec3b36);return _0x1e9d53[_0xc235('0x1f')](_0xc235('0x20'),_0x244431+'-'+_0x23ee41+'/'+_0xa80a7f)[_0xc235('0x1a')](_0x356bda);}return null;};}function patchUpdates(_0x3a030e){return function(_0x1ef795){try{jsonpatch['apply'](_0x1ef795,_0x3a030e,!![]);}catch(_0x52035c){return BPromise[_0xc235('0x21')](_0x52035c);}return _0x1ef795[_0xc235('0x22')]();};}function saveUpdates(_0x30fe43,_0x59da7b){return function(_0x264ec9){if(_0x264ec9){return _0x264ec9[_0xc235('0x23')](_0x30fe43)['then'](function(_0x378427){return _0x378427;});}return null;};}function removeEntity(_0x122e57,_0x58f16f){return function(_0x151d94){if(_0x151d94){return _0x151d94['destroy']()[_0xc235('0x24')](function(){_0x122e57[_0xc235('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5202b9,_0x2ce7d5){return function(_0x14ad78){if(!_0x14ad78){_0x5202b9['sendStatus'](0x194);}return _0x14ad78;};}function handleError(_0x2ad271,_0x1e54df){_0x1e54df=_0x1e54df||0x1f4;return function(_0x2f4ad1){logger[_0xc235('0x25')](_0x2f4ad1[_0xc235('0x26')]);if(_0x2f4ad1[_0xc235('0x27')]){delete _0x2f4ad1[_0xc235('0x27')];}_0x2ad271[_0xc235('0x18')](_0x1e54df)[_0xc235('0x28')](_0x2f4ad1);};}exports['index']=function(_0x3192b5,_0x58a5c9){var _0x51b25e={},_0x383921={},_0x4dc7c8={'count':0x0,'rows':[]};var _0x261826=_[_0xc235('0x29')](db[_0xc235('0x2a')][_0xc235('0x2b')],function(_0x59e6a0){return{'name':_0x59e6a0[_0xc235('0x2c')],'type':_0x59e6a0[_0xc235('0x2d')][_0xc235('0x2e')]};});_0x383921[_0xc235('0x2f')]=_[_0xc235('0x29')](_0x261826,_0xc235('0x27'));_0x383921[_0xc235('0x30')]=_['keys'](_0x3192b5[_0xc235('0x30')]);_0x383921[_0xc235('0x31')]=_[_0xc235('0x32')](_0x383921[_0xc235('0x2f')],_0x383921[_0xc235('0x30')]);_0x51b25e['attributes']=_[_0xc235('0x32')](_0x383921[_0xc235('0x2f')],qs['fields'](_0x3192b5[_0xc235('0x30')][_0xc235('0x33')]));_0x51b25e[_0xc235('0x34')]=_0x51b25e['attributes']['length']?_0x51b25e[_0xc235('0x34')]:_0x383921[_0xc235('0x2f')];if(!_0x3192b5['query'][_0xc235('0x35')](_0xc235('0x36'))){_0x51b25e[_0xc235('0x1c')]=qs[_0xc235('0x1c')](_0x3192b5[_0xc235('0x30')][_0xc235('0x1c')]);_0x51b25e[_0xc235('0x1e')]=qs[_0xc235('0x1e')](_0x3192b5[_0xc235('0x30')][_0xc235('0x1e')]);}_0x51b25e[_0xc235('0x37')]=qs[_0xc235('0x38')](_0x3192b5[_0xc235('0x30')][_0xc235('0x38')]);_0x51b25e[_0xc235('0x39')]=qs[_0xc235('0x31')](_[_0xc235('0x3a')](_0x3192b5['query'],_0x383921[_0xc235('0x31')]),_0x261826);if(_0x3192b5[_0xc235('0x30')]['filter']){_0x51b25e[_0xc235('0x39')]=_[_0xc235('0x3b')](_0x51b25e['where'],{'$or':_['map'](_0x261826,function(_0xd49c59){if(_0xd49c59['type']!==_0xc235('0x3c')){var _0x1b430d={};_0x1b430d[_0xd49c59['name']]={'$like':'%'+_0x3192b5[_0xc235('0x30')][_0xc235('0x3d')]+'%'};return _0x1b430d;}})});}_0x51b25e=_[_0xc235('0x3b')]({},_0x51b25e,_0x3192b5[_0xc235('0x3e')]);var _0x47df68={'where':_0x51b25e[_0xc235('0x39')]};return db[_0xc235('0x2a')]['count'](_0x47df68)['then'](function(_0x304ddd){_0x4dc7c8[_0xc235('0x1d')]=_0x304ddd;if(_0x3192b5[_0xc235('0x30')][_0xc235('0x3f')]){_0x51b25e['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xc235('0x40')](_0x51b25e);})[_0xc235('0x24')](function(_0xebda98){_0x4dc7c8['rows']=_0xebda98;return _0x4dc7c8;})[_0xc235('0x24')](respondWithFilteredResult(_0x58a5c9,_0x51b25e))[_0xc235('0x41')](handleError(_0x58a5c9,null));};exports[_0xc235('0x42')]=function(_0x8f883d,_0x8dc2b){var _0x587bcb={'raw':!![],'where':{'id':_0x8f883d[_0xc235('0x43')]['id']}},_0x275c63={};_0x275c63[_0xc235('0x2f')]=_[_0xc235('0x44')](db['SugarcrmField'][_0xc235('0x2b')]);_0x275c63[_0xc235('0x30')]=_['keys'](_0x8f883d[_0xc235('0x30')]);_0x275c63[_0xc235('0x31')]=_['intersection'](_0x275c63['model'],_0x275c63[_0xc235('0x30')]);_0x587bcb['attributes']=_[_0xc235('0x32')](_0x275c63[_0xc235('0x2f')],qs[_0xc235('0x33')](_0x8f883d[_0xc235('0x30')]['fields']));_0x587bcb['attributes']=_0x587bcb['attributes']['length']?_0x587bcb[_0xc235('0x34')]:_0x275c63[_0xc235('0x2f')];if(_0x8f883d[_0xc235('0x30')][_0xc235('0x3f')]){_0x587bcb[_0xc235('0x45')]=[{'all':!![]}];}_0x587bcb=_[_0xc235('0x3b')]({},_0x587bcb,_0x8f883d[_0xc235('0x3e')]);return db[_0xc235('0x2a')][_0xc235('0x46')](_0x587bcb)[_0xc235('0x24')](handleEntityNotFound(_0x8dc2b,null))['then'](respondWithResult(_0x8dc2b,null))[_0xc235('0x41')](handleError(_0x8dc2b,null));};exports[_0xc235('0x47')]=function(_0x267228,_0x16fb5a){return db[_0xc235('0x2a')][_0xc235('0x47')](_0x267228[_0xc235('0x48')],{})[_0xc235('0x24')](respondWithResult(_0x16fb5a,0xc9))['catch'](handleError(_0x16fb5a,null));};exports['update']=function(_0x390c58,_0x24ab89){if(_0x390c58[_0xc235('0x48')]['id']){delete _0x390c58[_0xc235('0x48')]['id'];}return db[_0xc235('0x2a')][_0xc235('0x46')]({'where':{'id':_0x390c58[_0xc235('0x43')]['id']}})[_0xc235('0x24')](handleEntityNotFound(_0x24ab89,null))['then'](saveUpdates(_0x390c58[_0xc235('0x48')],null))[_0xc235('0x24')](respondWithResult(_0x24ab89,null))['catch'](handleError(_0x24ab89,null));};exports[_0xc235('0x49')]=function(_0x193de0,_0x46d0ae){return db[_0xc235('0x2a')][_0xc235('0x46')]({'where':{'id':_0x193de0[_0xc235('0x43')]['id']}})[_0xc235('0x24')](handleEntityNotFound(_0x46d0ae,null))[_0xc235('0x24')](removeEntity(_0x46d0ae,null))['catch'](handleError(_0x46d0ae,null));}; \ No newline at end of file +var _0xac3b=['SugarcrmField','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0xac3b,0xe9));var _0xbac3=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xac3b[_0x466247];return _0x4b352e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbac3('0x0'));var zipdir=require(_0xbac3('0x1'));var jsonpatch=require(_0xbac3('0x2'));var rp=require(_0xbac3('0x3'));var moment=require(_0xbac3('0x4'));var BPromise=require(_0xbac3('0x5'));var Mustache=require(_0xbac3('0x6'));var util=require(_0xbac3('0x7'));var path=require(_0xbac3('0x8'));var sox=require('sox');var csv=require(_0xbac3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbac3('0xa'));var _=require('lodash');var squel=require(_0xbac3('0xb'));var crypto=require(_0xbac3('0xc'));var jsforce=require(_0xbac3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbac3('0x9'));var querystring=require(_0xbac3('0xe'));var Papa=require(_0xbac3('0xf'));var Redis=require(_0xbac3('0x10'));var authService=require(_0xbac3('0x11'));var qs=require(_0xbac3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbac3('0x13'));var logger=require('../../config/logger')(_0xbac3('0x14'));var utils=require(_0xbac3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbac3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22782d,_0x4b838a){_0x4b838a=_0x4b838a||0xcc;return function(_0x48491c){if(_0x48491c){return _0x22782d[_0xbac3('0x17')](_0x4b838a);}return _0x22782d[_0xbac3('0x18')](_0x4b838a)[_0xbac3('0x19')]();};}function respondWithResult(_0xd9996e,_0x3e8a52){_0x3e8a52=_0x3e8a52||0xc8;return function(_0x56231b){if(_0x56231b){return _0xd9996e[_0xbac3('0x18')](_0x3e8a52)[_0xbac3('0x1a')](_0x56231b);}};}function respondWithFilteredResult(_0x1136f1,_0x28ad44){return function(_0x4a7903){if(_0x4a7903){var _0x3ccf74=typeof _0x28ad44[_0xbac3('0x1b')]==='undefined'&&typeof _0x28ad44[_0xbac3('0x1c')]===_0xbac3('0x1d');var _0x572551=_0x4a7903[_0xbac3('0x1e')];var _0x1680d1=_0x3ccf74?0x0:_0x28ad44[_0xbac3('0x1b')];var _0x5dd215=_0x3ccf74?_0x4a7903[_0xbac3('0x1e')]:_0x28ad44['offset']+_0x28ad44[_0xbac3('0x1c')];var _0x14342c;if(_0x5dd215>=_0x572551){_0x5dd215=_0x572551;_0x14342c=0xc8;}else{_0x14342c=0xce;}_0x1136f1[_0xbac3('0x18')](_0x14342c);return _0x1136f1[_0xbac3('0x1f')](_0xbac3('0x20'),_0x1680d1+'-'+_0x5dd215+'/'+_0x572551)[_0xbac3('0x1a')](_0x4a7903);}return null;};}function patchUpdates(_0x46d5a4){return function(_0x585314){try{jsonpatch[_0xbac3('0x21')](_0x585314,_0x46d5a4,!![]);}catch(_0x53a1dd){return BPromise[_0xbac3('0x22')](_0x53a1dd);}return _0x585314[_0xbac3('0x23')]();};}function saveUpdates(_0x1d6893,_0x564eef){return function(_0x50ae90){if(_0x50ae90){return _0x50ae90['update'](_0x1d6893)[_0xbac3('0x24')](function(_0x1e233b){return _0x1e233b;});}return null;};}function removeEntity(_0xbd482c,_0x31ee34){return function(_0x48e52b){if(_0x48e52b){return _0x48e52b[_0xbac3('0x25')]()[_0xbac3('0x24')](function(){_0xbd482c['status'](0xcc)[_0xbac3('0x19')]();});}};}function handleEntityNotFound(_0x1b80f8,_0x152651){return function(_0x3d2ecf){if(!_0x3d2ecf){_0x1b80f8['sendStatus'](0x194);}return _0x3d2ecf;};}function handleError(_0x223853,_0x12ef7e){_0x12ef7e=_0x12ef7e||0x1f4;return function(_0x50e61b){logger[_0xbac3('0x26')](_0x50e61b['stack']);if(_0x50e61b['name']){delete _0x50e61b[_0xbac3('0x27')];}_0x223853['status'](_0x12ef7e)[_0xbac3('0x28')](_0x50e61b);};}exports[_0xbac3('0x29')]=function(_0x1c336b,_0x3e9d4e){var _0x460c91={},_0x136f04={},_0x391234={'count':0x0,'rows':[]};var _0x3ffcc7=_[_0xbac3('0x2a')](db['SugarcrmField'][_0xbac3('0x2b')],function(_0x427021){return{'name':_0x427021[_0xbac3('0x2c')],'type':_0x427021[_0xbac3('0x2d')][_0xbac3('0x2e')]};});_0x136f04['model']=_[_0xbac3('0x2a')](_0x3ffcc7,_0xbac3('0x27'));_0x136f04[_0xbac3('0x2f')]=_['keys'](_0x1c336b[_0xbac3('0x2f')]);_0x136f04[_0xbac3('0x30')]=_[_0xbac3('0x31')](_0x136f04[_0xbac3('0x32')],_0x136f04['query']);_0x460c91['attributes']=_['intersection'](_0x136f04[_0xbac3('0x32')],qs[_0xbac3('0x33')](_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x33')]));_0x460c91['attributes']=_0x460c91[_0xbac3('0x34')][_0xbac3('0x35')]?_0x460c91[_0xbac3('0x34')]:_0x136f04[_0xbac3('0x32')];if(!_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x36')]('nolimit')){_0x460c91[_0xbac3('0x1c')]=qs[_0xbac3('0x1c')](_0x1c336b['query']['limit']);_0x460c91[_0xbac3('0x1b')]=qs[_0xbac3('0x1b')](_0x1c336b['query'][_0xbac3('0x1b')]);}_0x460c91[_0xbac3('0x37')]=qs[_0xbac3('0x38')](_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x38')]);_0x460c91['where']=qs[_0xbac3('0x30')](_[_0xbac3('0x39')](_0x1c336b[_0xbac3('0x2f')],_0x136f04['filters']),_0x3ffcc7);if(_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x3a')]){_0x460c91[_0xbac3('0x3b')]=_[_0xbac3('0x3c')](_0x460c91[_0xbac3('0x3b')],{'$or':_['map'](_0x3ffcc7,function(_0xb6cf21){if(_0xb6cf21[_0xbac3('0x2d')]!==_0xbac3('0x3d')){var _0x4edd8e={};_0x4edd8e[_0xb6cf21['name']]={'$like':'%'+_0x1c336b[_0xbac3('0x2f')][_0xbac3('0x3a')]+'%'};return _0x4edd8e;}})});}_0x460c91=_[_0xbac3('0x3c')]({},_0x460c91,_0x1c336b[_0xbac3('0x3e')]);var _0x432648={'where':_0x460c91[_0xbac3('0x3b')]};return db[_0xbac3('0x3f')][_0xbac3('0x1e')](_0x432648)[_0xbac3('0x24')](function(_0x3881d7){_0x391234[_0xbac3('0x1e')]=_0x3881d7;if(_0x1c336b['query'][_0xbac3('0x40')]){_0x460c91[_0xbac3('0x41')]=[{'all':!![]}];}return db[_0xbac3('0x3f')][_0xbac3('0x42')](_0x460c91);})['then'](function(_0x30551a){_0x391234[_0xbac3('0x43')]=_0x30551a;return _0x391234;})['then'](respondWithFilteredResult(_0x3e9d4e,_0x460c91))[_0xbac3('0x44')](handleError(_0x3e9d4e,null));};exports['show']=function(_0x26f69f,_0x4d82ba){var _0x2a591d={'raw':!![],'where':{'id':_0x26f69f[_0xbac3('0x45')]['id']}},_0x26c0e9={};_0x26c0e9[_0xbac3('0x32')]=_[_0xbac3('0x46')](db[_0xbac3('0x3f')]['rawAttributes']);_0x26c0e9[_0xbac3('0x2f')]=_['keys'](_0x26f69f[_0xbac3('0x2f')]);_0x26c0e9['filters']=_['intersection'](_0x26c0e9['model'],_0x26c0e9[_0xbac3('0x2f')]);_0x2a591d[_0xbac3('0x34')]=_[_0xbac3('0x31')](_0x26c0e9['model'],qs[_0xbac3('0x33')](_0x26f69f['query']['fields']));_0x2a591d[_0xbac3('0x34')]=_0x2a591d[_0xbac3('0x34')]['length']?_0x2a591d[_0xbac3('0x34')]:_0x26c0e9[_0xbac3('0x32')];if(_0x26f69f['query'][_0xbac3('0x40')]){_0x2a591d[_0xbac3('0x41')]=[{'all':!![]}];}_0x2a591d=_[_0xbac3('0x3c')]({},_0x2a591d,_0x26f69f[_0xbac3('0x3e')]);return db[_0xbac3('0x3f')][_0xbac3('0x47')](_0x2a591d)[_0xbac3('0x24')](handleEntityNotFound(_0x4d82ba,null))[_0xbac3('0x24')](respondWithResult(_0x4d82ba,null))['catch'](handleError(_0x4d82ba,null));};exports[_0xbac3('0x48')]=function(_0x2257bf,_0x5c1ac9){return db['SugarcrmField'][_0xbac3('0x48')](_0x2257bf[_0xbac3('0x49')],{})['then'](respondWithResult(_0x5c1ac9,0xc9))[_0xbac3('0x44')](handleError(_0x5c1ac9,null));};exports['update']=function(_0x39473b,_0x3cd926){if(_0x39473b['body']['id']){delete _0x39473b['body']['id'];}return db[_0xbac3('0x3f')]['find']({'where':{'id':_0x39473b['params']['id']}})[_0xbac3('0x24')](handleEntityNotFound(_0x3cd926,null))[_0xbac3('0x24')](saveUpdates(_0x39473b[_0xbac3('0x49')],null))[_0xbac3('0x24')](respondWithResult(_0x3cd926,null))[_0xbac3('0x44')](handleError(_0x3cd926,null));};exports[_0xbac3('0x25')]=function(_0x32b9d4,_0x6e0274){return db['SugarcrmField'][_0xbac3('0x47')]({'where':{'id':_0x32b9d4[_0xbac3('0x45')]['id']}})[_0xbac3('0x24')](handleEntityNotFound(_0x6e0274,null))[_0xbac3('0x24')](removeEntity(_0x6e0274,null))['catch'](handleError(_0x6e0274,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9120fc7..e56473a 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 _0xf23b=['api','moment','bluebird','path','rimraf','../../config/environment','define','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x5a5596,_0x4b262d){var _0x317d9d=function(_0x2fdc6f){while(--_0x2fdc6f){_0x5a5596['push'](_0x5a5596['shift']());}};_0x317d9d(++_0x4b262d);}(_0xf23b,0x9a));var _0xbf23=function(_0x33118f,_0x23bac7){_0x33118f=_0x33118f-0x0;var _0x19b474=_0xf23b[_0x33118f];return _0x19b474;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require('../../config/logger')(_0xbf23('0x2'));var moment=require(_0xbf23('0x3'));var BPromise=require(_0xbf23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf23('0x5'));var rimraf=require(_0xbf23('0x6'));var config=require(_0xbf23('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x6664b4,_0x39ae96){return _0x6664b4[_0xbf23('0x8')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xbf23('0x9'),'fields':[_0xbf23('0xa'),_0xbf23('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x396b=['../../config/logger','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x2be018,_0x4c6f4c){var _0x6e130b=function(_0x298894){while(--_0x298894){_0x2be018['push'](_0x2be018['shift']());}};_0x6e130b(++_0x4c6f4c);}(_0x396b,0x16a));var _0xb396=function(_0x5f1dd7,_0x5e29d0){_0x5f1dd7=_0x5f1dd7-0x0;var _0x2a4dda=_0x396b[_0x5f1dd7];return _0x2a4dda;};'use strict';var _=require(_0xb396('0x0'));var util=require(_0xb396('0x1'));var logger=require(_0xb396('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb396('0x3'));var fs=require('fs');var path=require(_0xb396('0x4'));var rimraf=require(_0xb396('0x5'));var config=require(_0xb396('0x6'));var attributes=require(_0xb396('0x7'));module['exports']=function(_0x566c6b,_0x47a1c2){return _0x566c6b[_0xb396('0x8')](_0xb396('0x9'),attributes,{'tableName':_0xb396('0xa'),'paranoid':![],'indexes':[{'name':_0xb396('0xb'),'fields':[_0xb396('0xc'),'FieldId'],'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 76cccb5..50aeaa6 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 _0xb553=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xb553,0x1e3));var _0x3b55=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb553[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3b55('0x0'));var util=require(_0x3b55('0x1'));var moment=require(_0x3b55('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b55('0x3'));var fs=require('fs');var Redis=require(_0x3b55('0x4'));var db=require(_0x3b55('0x5'))['db'];var utils=require(_0x3b55('0x6'));var logger=require(_0x3b55('0x7'))(_0x3b55('0x8'));var config=require(_0x3b55('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3b55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9188,_0x124195,_0x1eacde){return new BPromise(function(_0x50adb6,_0x1477c1){return client[_0x3b55('0xb')](_0x1b9188,_0x1eacde)[_0x3b55('0xc')](function(_0x108a64){logger[_0x3b55('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x124195,_0x3b55('0xe'));logger[_0x3b55('0xf')](_0x3b55('0x10'),_0x124195,_0x3b55('0xe'),JSON[_0x3b55('0x11')](_0x108a64));if(_0x108a64[_0x3b55('0x12')]){if(_0x108a64[_0x3b55('0x12')][_0x3b55('0x13')]===0x1f4){logger['error'](_0x3b55('0x14'),_0x124195,_0x108a64[_0x3b55('0x12')]['message']);return _0x1477c1(_0x108a64['error'][_0x3b55('0x15')]);}logger['error'](_0x3b55('0x14'),_0x124195,_0x108a64[_0x3b55('0x12')][_0x3b55('0x15')]);return _0x50adb6(_0x108a64[_0x3b55('0x12')][_0x3b55('0x15')]);}else{logger[_0x3b55('0xd')](_0x3b55('0x14'),_0x124195,_0x3b55('0xe'));_0x50adb6(_0x108a64[_0x3b55('0x16')][_0x3b55('0x15')]);}})['catch'](function(_0x41b951){logger[_0x3b55('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x124195,_0x41b951);_0x1477c1(_0x41b951);});});} \ No newline at end of file +var _0x2944=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x4e11a2,_0x1c9cf5){var _0x1eb57f=function(_0x2e96e4){while(--_0x2e96e4){_0x4e11a2['push'](_0x4e11a2['shift']());}};_0x1eb57f(++_0x1c9cf5);}(_0x2944,0x8a));var _0x4294=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x2944[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x4294('0x0'));var util=require('util');var moment=require(_0x4294('0x1'));var BPromise=require(_0x4294('0x2'));var rs=require(_0x4294('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4294('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4294('0x5'))(_0x4294('0x6'));var config=require('../../config/environment');var jayson=require(_0x4294('0x7'));var client=jayson[_0x4294('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17857b,_0x513515,_0x216953){return new BPromise(function(_0x10f164,_0x34a6f5){return client[_0x4294('0x9')](_0x17857b,_0x216953)[_0x4294('0xa')](function(_0xacecf7){logger[_0x4294('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x513515,'request\x20sent');logger['debug'](_0x4294('0xc'),_0x513515,_0x4294('0xd'),JSON['stringify'](_0xacecf7));if(_0xacecf7[_0x4294('0xe')]){if(_0xacecf7[_0x4294('0xe')][_0x4294('0xf')]===0x1f4){logger[_0x4294('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x513515,_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);return _0x34a6f5(_0xacecf7[_0x4294('0xe')]['message']);}logger[_0x4294('0xe')](_0x4294('0x11'),_0x513515,_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);return _0x10f164(_0xacecf7[_0x4294('0xe')][_0x4294('0x10')]);}else{logger[_0x4294('0xb')](_0x4294('0x11'),_0x513515,'request\x20sent');_0x10f164(_0xacecf7[_0x4294('0x12')][_0x4294('0x10')]);}})[_0x4294('0x13')](function(_0xc72f92){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x513515,_0xc72f92);_0x34a6f5(_0xc72f92);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index edbb91f..499d4af 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 _0x68fc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x4e158e,_0x106b54){var _0x49ca98=function(_0x3d0a2c){while(--_0x3d0a2c){_0x4e158e['push'](_0x4e158e['shift']());}};_0x49ca98(++_0x106b54);}(_0x68fc,0x9d));var _0xc68f=function(_0xe3e587,_0x2a5d93){_0xe3e587=_0xe3e587-0x0;var _0x1ac0c9=_0x68fc[_0xe3e587];return _0x1ac0c9;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require('path');var timeout=require(_0xc68f('0x2'));var express=require(_0xc68f('0x3'));var router=express[_0xc68f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x5'));var interaction=require(_0xc68f('0x6'));var config=require(_0xc68f('0x7'));var controller=require(_0xc68f('0x8'));router[_0xc68f('0x9')]('/',auth[_0xc68f('0xa')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x9')](_0xc68f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc68f('0x9')](_0xc68f('0xd'),auth[_0xc68f('0xa')](),controller[_0xc68f('0xe')]);router['get']('/:id/fields',auth[_0xc68f('0xa')](),controller[_0xc68f('0xf')]);router[_0xc68f('0x10')]('/',auth[_0xc68f('0xa')](),controller[_0xc68f('0x11')]);router[_0xc68f('0x10')](_0xc68f('0xd'),auth[_0xc68f('0xa')](),controller[_0xc68f('0x12')]);router['put']('/:id',auth[_0xc68f('0xa')](),controller[_0xc68f('0x13')]);router[_0xc68f('0x14')](_0xc68f('0xc'),auth[_0xc68f('0xa')](),controller[_0xc68f('0x15')]);module[_0xc68f('0x16')]=router; \ No newline at end of file +var _0x5af0=['show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x18331f,_0x4c2da6){var _0x1c7882=function(_0x71822b){while(--_0x71822b){_0x18331f['push'](_0x18331f['shift']());}};_0x1c7882(++_0x4c2da6);}(_0x5af0,0x1eb));var _0x05af=function(_0x23dd67,_0x3ce921){_0x23dd67=_0x23dd67-0x0;var _0x694f09=_0x5af0[_0x23dd67];return _0x694f09;};'use strict';var multer=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var path=require(_0x05af('0x2'));var timeout=require(_0x05af('0x3'));var express=require(_0x05af('0x4'));var router=express[_0x05af('0x5')]();var fs_extra=require(_0x05af('0x6'));var auth=require(_0x05af('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x05af('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x05af('0x9')]('/',auth[_0x05af('0xa')](),controller[_0x05af('0xb')]);router['get'](_0x05af('0xc'),auth['isAuthenticated'](),controller[_0x05af('0xd')]);router[_0x05af('0x9')](_0x05af('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x05af('0xa')](),controller[_0x05af('0xf')]);router[_0x05af('0x10')]('/',auth['isAuthenticated'](),controller[_0x05af('0x11')]);router['post']('/:id/configurations',auth[_0x05af('0xa')](),controller[_0x05af('0x12')]);router[_0x05af('0x13')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x14')]);router[_0x05af('0x15')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x16')]);module[_0x05af('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7194a9f..307b939 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 _0xa288=['HelpDesk','STRING'];(function(_0x23000d,_0x4037aa){var _0xfef2b3=function(_0xd3c44b){while(--_0xd3c44b){_0x23000d['push'](_0x23000d['shift']());}};_0xfef2b3(++_0x4037aa);}(_0xa288,0xb7));var _0x8a28=function(_0x367ae9,_0x535d05){_0x367ae9=_0x367ae9-0x0;var _0x2a3e41=_0xa288[_0x367ae9];return _0x2a3e41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![],'defaultValue':_0x8a28('0x1')},'remoteUri':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8a28('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x5317=['sequelize','exports','STRING'];(function(_0x19c700,_0x1662ee){var _0x213fe9=function(_0x1fd039){while(--_0x1fd039){_0x19c700['push'](_0x19c700['shift']());}};_0x213fe9(++_0x1662ee);}(_0x5317,0x81));var _0x7531=function(_0x2803a9,_0xa09521){_0x2803a9=_0x2803a9-0x0;var _0x305012=_0x5317[_0x2803a9];return _0x305012;};'use strict';var Sequelize=require(_0x7531('0x0'));module[_0x7531('0x1')]={'name':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7531('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7531('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7531('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 7ff5208..61883c7 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 _0x0275=['value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','success','POST','login','describe','result','sessionName','autogenerated','reference','remove','includes','editable','false','label','cf_','picklist','picklistValues'];(function(_0x4bac2f,_0x25b4b2){var _0x9638eb=function(_0x50465b){while(--_0x50465b){_0x4bac2f['push'](_0x4bac2f['shift']());}};_0x9638eb(++_0x25b4b2);}(_0x0275,0x167));var _0x5027=function(_0x3d12ba,_0x4fe7e9){_0x3d12ba=_0x3d12ba-0x0;var _0x40d64a=_0x0275[_0x3d12ba];return _0x40d64a;};'use strict';var emlformat=require(_0x5027('0x0'));var rimraf=require(_0x5027('0x1'));var zipdir=require(_0x5027('0x2'));var jsonpatch=require(_0x5027('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5027('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5027('0x5'));var csv=require(_0x5027('0x6'));var ejs=require(_0x5027('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5027('0x8'));var crypto=require(_0x5027('0x9'));var jsforce=require(_0x5027('0xa'));var deskjs=require(_0x5027('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5027('0xc'));var Papa=require(_0x5027('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5027('0xe'));var hardwareService=require(_0x5027('0xf'));var logger=require(_0x5027('0x10'))('api');var utils=require(_0x5027('0x11'));var config=require(_0x5027('0x12'));var licenseUtil=require(_0x5027('0x13'));var db=require(_0x5027('0x14'))['db'];var integrations=require(_0x5027('0x15'));function respondWithStatusCode(_0x62349b,_0x4eb2fb){_0x4eb2fb=_0x4eb2fb||0xcc;return function(_0x1c97e3){if(_0x1c97e3){return _0x62349b[_0x5027('0x16')](_0x4eb2fb);}return _0x62349b[_0x5027('0x17')](_0x4eb2fb)[_0x5027('0x18')]();};}function respondWithResult(_0x17c5a9,_0x41c2c0){_0x41c2c0=_0x41c2c0||0xc8;return function(_0x41ff1a){if(_0x41ff1a){return _0x17c5a9['status'](_0x41c2c0)['json'](_0x41ff1a);}};}function respondWithFilteredResult(_0xc54eb9,_0x3fa82a){return function(_0xbee305){if(_0xbee305){var _0x2cb50a=typeof _0x3fa82a['offset']===_0x5027('0x19')&&typeof _0x3fa82a[_0x5027('0x1a')]===_0x5027('0x19');var _0x3b742d=_0xbee305['count'];var _0x4c138e=_0x2cb50a?0x0:_0x3fa82a[_0x5027('0x1b')];var _0x1b0fdd=_0x2cb50a?_0xbee305[_0x5027('0x1c')]:_0x3fa82a[_0x5027('0x1b')]+_0x3fa82a[_0x5027('0x1a')];var _0x10166a;if(_0x1b0fdd>=_0x3b742d){_0x1b0fdd=_0x3b742d;_0x10166a=0xc8;}else{_0x10166a=0xce;}_0xc54eb9[_0x5027('0x17')](_0x10166a);return _0xc54eb9['set'](_0x5027('0x1d'),_0x4c138e+'-'+_0x1b0fdd+'/'+_0x3b742d)['json'](_0xbee305);}return null;};}function patchUpdates(_0x4aef45){return function(_0x215457){try{jsonpatch[_0x5027('0x1e')](_0x215457,_0x4aef45,!![]);}catch(_0x774f55){return BPromise[_0x5027('0x1f')](_0x774f55);}return _0x215457[_0x5027('0x20')]();};}function saveUpdates(_0x24a5b4,_0x2b414c){return function(_0x528aff){if(_0x528aff){return _0x528aff[_0x5027('0x21')](_0x24a5b4)[_0x5027('0x22')](function(_0x4c94b7){return _0x4c94b7;});}return null;};}function removeEntity(_0x1d8655,_0x40cbe3){return function(_0x3c83d1){if(_0x3c83d1){return _0x3c83d1[_0x5027('0x23')]()[_0x5027('0x22')](function(){_0x1d8655[_0x5027('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3082,_0x4560a4){return function(_0x2d34ce){if(!_0x2d34ce){_0x1e3082[_0x5027('0x16')](0x194);}return _0x2d34ce;};}function handleError(_0x5864d4,_0x25e6d7){_0x25e6d7=_0x25e6d7||0x1f4;return function(_0x276332){logger['error'](_0x276332[_0x5027('0x24')]);if(_0x276332[_0x5027('0x25')]){delete _0x276332[_0x5027('0x25')];}_0x5864d4[_0x5027('0x17')](_0x25e6d7)[_0x5027('0x26')](_0x276332);};}exports['index']=function(_0x5ab6fc,_0x599914){var _0x21e523={},_0x7228e7={},_0x469c3a={'count':0x0,'rows':[]};var _0x4e051e=_[_0x5027('0x27')](db[_0x5027('0x28')]['rawAttributes'],function(_0x4a7a01){return{'name':_0x4a7a01['fieldName'],'type':_0x4a7a01[_0x5027('0x29')][_0x5027('0x2a')]};});_0x7228e7[_0x5027('0x2b')]=_[_0x5027('0x27')](_0x4e051e,_0x5027('0x25'));_0x7228e7[_0x5027('0x2c')]=_[_0x5027('0x2d')](_0x5ab6fc[_0x5027('0x2c')]);_0x7228e7[_0x5027('0x2e')]=_[_0x5027('0x2f')](_0x7228e7[_0x5027('0x2b')],_0x7228e7[_0x5027('0x2c')]);_0x21e523[_0x5027('0x30')]=_[_0x5027('0x2f')](_0x7228e7[_0x5027('0x2b')],qs[_0x5027('0x31')](_0x5ab6fc[_0x5027('0x2c')][_0x5027('0x31')]));_0x21e523[_0x5027('0x30')]=_0x21e523[_0x5027('0x30')][_0x5027('0x32')]?_0x21e523[_0x5027('0x30')]:_0x7228e7[_0x5027('0x2b')];if(!_0x5ab6fc[_0x5027('0x2c')][_0x5027('0x33')](_0x5027('0x34'))){_0x21e523[_0x5027('0x1a')]=qs['limit'](_0x5ab6fc[_0x5027('0x2c')]['limit']);_0x21e523['offset']=qs[_0x5027('0x1b')](_0x5ab6fc[_0x5027('0x2c')]['offset']);}_0x21e523[_0x5027('0x35')]=qs['sort'](_0x5ab6fc[_0x5027('0x2c')][_0x5027('0x36')]);_0x21e523[_0x5027('0x37')]=qs[_0x5027('0x2e')](_[_0x5027('0x38')](_0x5ab6fc['query'],_0x7228e7['filters']),_0x4e051e);if(_0x5ab6fc['query'][_0x5027('0x39')]){_0x21e523[_0x5027('0x37')]=_[_0x5027('0x3a')](_0x21e523['where'],{'$or':_[_0x5027('0x27')](_0x4e051e,function(_0x3cd8d3){if(_0x3cd8d3[_0x5027('0x29')]!==_0x5027('0x3b')){var _0x23b8e2={};_0x23b8e2[_0x3cd8d3['name']]={'$like':'%'+_0x5ab6fc['query']['filter']+'%'};return _0x23b8e2;}})});}_0x21e523=_['merge']({},_0x21e523,_0x5ab6fc[_0x5027('0x3c')]);var _0xc8fe46={'where':_0x21e523[_0x5027('0x37')]};return db[_0x5027('0x28')][_0x5027('0x1c')](_0xc8fe46)[_0x5027('0x22')](function(_0x2eb897){_0x469c3a[_0x5027('0x1c')]=_0x2eb897;if(_0x5ab6fc[_0x5027('0x2c')]['includeAll']){_0x21e523[_0x5027('0x3d')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x21e523);})['then'](function(_0x17a295){_0x469c3a[_0x5027('0x3e')]=_0x17a295;return _0x469c3a;})[_0x5027('0x22')](respondWithFilteredResult(_0x599914,_0x21e523))[_0x5027('0x3f')](handleError(_0x599914,null));};exports[_0x5027('0x40')]=function(_0x231a09,_0x4e5d4b){var _0x32772e={'raw':![],'where':{'id':_0x231a09[_0x5027('0x41')]['id']}},_0x3fbc23={};_0x3fbc23[_0x5027('0x2b')]=_['keys'](db[_0x5027('0x28')][_0x5027('0x42')]);_0x3fbc23[_0x5027('0x2c')]=_[_0x5027('0x2d')](_0x231a09[_0x5027('0x2c')]);_0x3fbc23[_0x5027('0x2e')]=_[_0x5027('0x2f')](_0x3fbc23['model'],_0x3fbc23[_0x5027('0x2c')]);_0x32772e[_0x5027('0x30')]=_[_0x5027('0x2f')](_0x3fbc23['model'],qs[_0x5027('0x31')](_0x231a09[_0x5027('0x2c')][_0x5027('0x31')]));_0x32772e['attributes']=_0x32772e['attributes'][_0x5027('0x32')]?_0x32772e[_0x5027('0x30')]:_0x3fbc23['model'];if(_0x231a09[_0x5027('0x2c')][_0x5027('0x43')]){_0x32772e[_0x5027('0x3d')]=[{'all':!![]}];}_0x32772e=_['merge']({},_0x32772e,_0x231a09['options']);return db[_0x5027('0x28')][_0x5027('0x44')](_0x32772e)['then'](handleEntityNotFound(_0x4e5d4b,null))[_0x5027('0x22')](respondWithResult(_0x4e5d4b,null))[_0x5027('0x3f')](handleError(_0x4e5d4b,null));};exports[_0x5027('0x45')]=function(_0x1c5ef6,_0x1bcb85){return db['VtigerAccount'][_0x5027('0x45')](_0x1c5ef6[_0x5027('0x46')],{})['then'](respondWithResult(_0x1bcb85,0xc9))[_0x5027('0x3f')](handleError(_0x1bcb85,null));};exports[_0x5027('0x21')]=function(_0x187bbf,_0x22bd83){if(_0x187bbf[_0x5027('0x46')]['id']){delete _0x187bbf['body']['id'];}return db[_0x5027('0x28')][_0x5027('0x44')]({'where':{'id':_0x187bbf['params']['id']}})['then'](handleEntityNotFound(_0x22bd83,null))[_0x5027('0x22')](saveUpdates(_0x187bbf[_0x5027('0x46')],null))['then'](respondWithResult(_0x22bd83,null))[_0x5027('0x3f')](handleError(_0x22bd83,null));};exports[_0x5027('0x23')]=function(_0x43490c,_0x375345){return db[_0x5027('0x28')][_0x5027('0x44')]({'where':{'id':_0x43490c['params']['id']}})[_0x5027('0x22')](handleEntityNotFound(_0x375345,null))[_0x5027('0x22')](removeEntity(_0x375345,null))[_0x5027('0x3f')](handleError(_0x375345,null));};exports[_0x5027('0x47')]=function(_0x10b5be,_0x45098d,_0x6b0c09){var _0x3efa86={};var _0x1bbb19={};var _0x458949;var _0x394745;return db['VtigerAccount']['findOne']({'where':{'id':_0x10b5be['params']['id']}})['then'](handleEntityNotFound(_0x45098d,null))[_0x5027('0x22')](function(_0x2c4834){if(_0x2c4834){_0x458949=_0x2c4834;_0x1bbb19[_0x5027('0x2b')]=_['keys'](db[_0x5027('0x48')][_0x5027('0x42')]);_0x1bbb19[_0x5027('0x2c')]=_[_0x5027('0x2d')](_0x10b5be[_0x5027('0x2c')]);_0x1bbb19[_0x5027('0x2e')]=_['intersection'](_0x1bbb19[_0x5027('0x2b')],_0x1bbb19[_0x5027('0x2c')]);_0x3efa86['attributes']=_[_0x5027('0x2f')](_0x1bbb19[_0x5027('0x2b')],qs[_0x5027('0x31')](_0x10b5be['query'][_0x5027('0x31')]));_0x3efa86['attributes']=_0x3efa86[_0x5027('0x30')][_0x5027('0x32')]?_0x3efa86[_0x5027('0x30')]:_0x1bbb19[_0x5027('0x2b')];_0x3efa86['order']=qs['sort'](_0x10b5be[_0x5027('0x2c')][_0x5027('0x36')]);_0x3efa86['where']=qs[_0x5027('0x2e')](_[_0x5027('0x38')](_0x10b5be[_0x5027('0x2c')],_0x1bbb19['filters']));if(_0x10b5be['query'][_0x5027('0x39')]){_0x3efa86[_0x5027('0x37')]=_[_0x5027('0x3a')](_0x3efa86['where'],{'$or':_[_0x5027('0x27')](_0x3efa86['attributes'],function(_0x232fcc){var _0x28ac95={};_0x28ac95[_0x232fcc]={'$like':'%'+_0x10b5be[_0x5027('0x2c')][_0x5027('0x39')]+'%'};return _0x28ac95;})});}_0x3efa86=_['merge']({},_0x3efa86,_0x10b5be[_0x5027('0x3c')]);return _0x458949['getConfigurations'](_0x3efa86);}})[_0x5027('0x22')](function(_0x404c0e){if(_0x404c0e){_0x394745=_0x404c0e[_0x5027('0x32')];if(!_0x10b5be[_0x5027('0x2c')][_0x5027('0x33')]('nolimit')){_0x3efa86[_0x5027('0x1a')]=qs[_0x5027('0x1a')](_0x10b5be[_0x5027('0x2c')][_0x5027('0x1a')]);_0x3efa86['offset']=qs[_0x5027('0x1b')](_0x10b5be[_0x5027('0x2c')]['offset']);}return _0x458949[_0x5027('0x47')](_0x3efa86);}})['then'](function(_0x21d227){if(_0x21d227){return _0x21d227?{'count':_0x394745,'rows':_0x21d227}:null;}})[_0x5027('0x22')](respondWithResult(_0x45098d,null))['catch'](handleError(_0x45098d,null));};exports[_0x5027('0x49')]=function(_0x4f9565,_0x59dc81,_0x3954a3){if(_0x4f9565[_0x5027('0x46')]['id']){delete _0x4f9565['body']['id'];}return db[_0x5027('0x28')][_0x5027('0x4a')]({'where':{'id':_0x4f9565[_0x5027('0x41')]['id']}})[_0x5027('0x22')](handleEntityNotFound(_0x59dc81,null))[_0x5027('0x22')](function(_0x14f454){if(_0x14f454){_0x4f9565[_0x5027('0x46')]['AccountId']=_0x14f454['id'];_0x4f9565[_0x5027('0x46')][_0x5027('0x4b')]=integrations[_0x5027('0x4c')](_0x4f9565[_0x5027('0x46')]['channel'],_0x4f9565[_0x5027('0x46')][_0x5027('0x29')]);_0x4f9565[_0x5027('0x46')][_0x5027('0x4d')]=integrations[_0x5027('0x4e')](_0x4f9565['body'][_0x5027('0x4f')],_0x4f9565[_0x5027('0x46')][_0x5027('0x29')]);return db[_0x5027('0x48')]['create'](_0x4f9565[_0x5027('0x46')],{'include':[{'model':db[_0x5027('0x50')],'as':'Subjects'},{'model':db[_0x5027('0x50')],'as':_0x5027('0x4d')}]});}return null;})[_0x5027('0x22')](respondWithResult(_0x59dc81,null))[_0x5027('0x3f')](handleError(_0x59dc81,null));};var md5=require(_0x5027('0x51'));exports[_0x5027('0x52')]=function(_0x23ebfe,_0x2d12e2,_0x13c1a0){var _0x37efb4=null;var _0x2de093=null;var _0x54c6c3=null;var _0x63c441=null;var _0x5ec84e='';return db[_0x5027('0x28')]['findOne']({'where':{'id':_0x23ebfe['params']['id']},'attributes':['id',_0x5027('0x25'),_0x5027('0x53'),_0x5027('0x54'),'moduleName',_0x5027('0x55'),_0x5027('0x56'),'accessKey']})[_0x5027('0x22')](handleEntityNotFound(_0x2d12e2,null))['then'](function(_0x3af0e1){if(_0x3af0e1){_0x37efb4=_0x3af0e1[_0x5027('0x53')];_0x2de093=_0x3af0e1[_0x5027('0x57')];_0x54c6c3=_0x3af0e1['moduleName'];_0x5ec84e=_0x3af0e1[_0x5027('0x55')];var _0x1ace97=_0x5ec84e[_0x5027('0x58')](-0x1);if(_0x1ace97==='/'){_0x5ec84e=_0x5ec84e[_0x5027('0x59')](0x0,_0x5ec84e['lastIndexOf'](_0x1ace97));}_0x63c441=util[_0x5027('0x5a')](_0x5027('0x5b'),_0x5ec84e);var _0x1eca46={'method':_0x5027('0x5c'),'uri':_0x63c441,'qs':{'operation':'getchallenge','username':_0x3af0e1[_0x5027('0x53')]},'json':!![]};return rp(_0x1eca46);}})[_0x5027('0x22')](function(_0x102e55){if(_0x102e55[_0x5027('0x5d')]){var _0x284382={'method':_0x5027('0x5e'),'uri':_0x63c441,'form':{'operation':_0x5027('0x5f'),'username':_0x37efb4,'accessKey':md5(_0x102e55['result']['token']+_0x2de093)},'json':!![]};return rp(_0x284382);}})[_0x5027('0x22')](function(_0x33924d){if(_0x33924d[_0x5027('0x5d')]){var _0x1d30bd={'method':'GET','uri':_0x63c441,'qs':{'operation':_0x5027('0x60'),'username':_0x37efb4,'sessionName':_0x33924d[_0x5027('0x61')][_0x5027('0x62')],'elementType':_0x54c6c3},'json':!![]};return rp(_0x1d30bd);}})[_0x5027('0x22')](function(_0x3efcda){if(_0x3efcda['success']){var _0x416b9e=[_0x5027('0x63'),_0x5027('0x64'),'owner'];_[_0x5027('0x65')](_0x3efcda[_0x5027('0x61')][_0x5027('0x31')],function(_0x440a98){return _0x416b9e[_0x5027('0x66')](_0x440a98[_0x5027('0x29')][_0x5027('0x25')]);});_[_0x5027('0x65')](_0x3efcda[_0x5027('0x61')][_0x5027('0x31')],function(_0x4f3f61){return _0x4f3f61[_0x5027('0x67')]===_0x5027('0x68');});return{'count':_0x3efcda[_0x5027('0x61')]['fields'][_0x5027('0x32')],'rows':_[_0x5027('0x27')](_0x3efcda['result'][_0x5027('0x31')],function(_0x4cb98c){return{'id':_0x4cb98c[_0x5027('0x25')],'name':_0x4cb98c[_0x5027('0x69')],'custom':_['startsWith'](_0x4cb98c[_0x5027('0x25')],_0x5027('0x6a'))?!![]:![],'options':_0x4cb98c[_0x5027('0x29')][_0x5027('0x25')]===_0x5027('0x6b')&&_0x4cb98c['type'][_0x5027('0x6c')][_0x5027('0x32')]>0x0?_['map'](_0x4cb98c[_0x5027('0x29')][_0x5027('0x6c')],function(_0x3a6b3b){return{'name':_0x3a6b3b[_0x5027('0x69')],'value':_0x3a6b3b[_0x5027('0x6d')]};}):[]};})};}})[_0x5027('0x22')](respondWithResult(_0x2d12e2,null))[_0x5027('0x3f')](function(_0x4e026d){console[_0x5027('0x6e')](_0x5027('0x6f')+_0x4e026d);var _0x155aea=_0x23ebfe[_0x5027('0x2c')][_0x5027('0x70')]?0x1f4:_0x4e026d[_0x5027('0x71')]||0x1f4;logger[_0x5027('0x72')](_0x5027('0x73'),_0x5027('0x52'),_0x155aea,JSON[_0x5027('0x74')](_0x4e026d));delete _0x4e026d[_0x5027('0x25')];if(_0x155aea===0x191){_0x155aea=0x190;}_0x2d12e2[_0x5027('0x17')](_0x155aea)[_0x5027('0x26')](_0x23ebfe['query'][_0x5027('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x4e026d[_0x5027('0x71')]}:_0x4e026d);});}; \ No newline at end of file +var _0x13a7=['sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VtigerAccount','includeAll','include','catch','show','length','find','create','body','update','getConfigurations','findOne','params','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','reference','owner','includes','remove','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x285f91,_0x600aee){var _0x23b3b4=function(_0x193a48){while(--_0x193a48){_0x285f91['push'](_0x285f91['shift']());}};_0x23b3b4(++_0x600aee);}(_0x13a7,0x1eb));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x713a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x713a('0x1'));var jsonpatch=require(_0x713a('0x2'));var rp=require(_0x713a('0x3'));var moment=require(_0x713a('0x4'));var BPromise=require(_0x713a('0x5'));var Mustache=require(_0x713a('0x6'));var util=require(_0x713a('0x7'));var path=require(_0x713a('0x8'));var sox=require(_0x713a('0x9'));var csv=require(_0x713a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x713a('0xb'));var _=require('lodash');var squel=require(_0x713a('0xc'));var crypto=require(_0x713a('0xd'));var jsforce=require(_0x713a('0xe'));var deskjs=require(_0x713a('0xf'));var toCsv=require(_0x713a('0xa'));var querystring=require(_0x713a('0x10'));var Papa=require(_0x713a('0x11'));var Redis=require(_0x713a('0x12'));var authService=require(_0x713a('0x13'));var qs=require(_0x713a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x713a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x713a('0x16'));var licenseUtil=require(_0x713a('0x17'));var db=require(_0x713a('0x18'))['db'];var integrations=require(_0x713a('0x19'));function respondWithStatusCode(_0x1a3e00,_0x2586f2){_0x2586f2=_0x2586f2||0xcc;return function(_0x26120d){if(_0x26120d){return _0x1a3e00['sendStatus'](_0x2586f2);}return _0x1a3e00[_0x713a('0x1a')](_0x2586f2)[_0x713a('0x1b')]();};}function respondWithResult(_0xf579ba,_0x30a897){_0x30a897=_0x30a897||0xc8;return function(_0x2f18a1){if(_0x2f18a1){return _0xf579ba[_0x713a('0x1a')](_0x30a897)[_0x713a('0x1c')](_0x2f18a1);}};}function respondWithFilteredResult(_0x421b88,_0x511f4e){return function(_0xedd33d){if(_0xedd33d){var _0x50cbc1=typeof _0x511f4e[_0x713a('0x1d')]==='undefined'&&typeof _0x511f4e[_0x713a('0x1e')]===_0x713a('0x1f');var _0xf50b98=_0xedd33d[_0x713a('0x20')];var _0x450413=_0x50cbc1?0x0:_0x511f4e[_0x713a('0x1d')];var _0x3e20e8=_0x50cbc1?_0xedd33d[_0x713a('0x20')]:_0x511f4e[_0x713a('0x1d')]+_0x511f4e['limit'];var _0x65c26e;if(_0x3e20e8>=_0xf50b98){_0x3e20e8=_0xf50b98;_0x65c26e=0xc8;}else{_0x65c26e=0xce;}_0x421b88[_0x713a('0x1a')](_0x65c26e);return _0x421b88[_0x713a('0x21')](_0x713a('0x22'),_0x450413+'-'+_0x3e20e8+'/'+_0xf50b98)['json'](_0xedd33d);}return null;};}function patchUpdates(_0x49f26b){return function(_0x1be2b1){try{jsonpatch[_0x713a('0x23')](_0x1be2b1,_0x49f26b,!![]);}catch(_0x210ede){return BPromise[_0x713a('0x24')](_0x210ede);}return _0x1be2b1[_0x713a('0x25')]();};}function saveUpdates(_0x26823b,_0x2a976f){return function(_0x9186b5){if(_0x9186b5){return _0x9186b5['update'](_0x26823b)['then'](function(_0x57e2ca){return _0x57e2ca;});}return null;};}function removeEntity(_0x4c462b,_0x1cc504){return function(_0x5e1095){if(_0x5e1095){return _0x5e1095[_0x713a('0x26')]()[_0x713a('0x27')](function(){_0x4c462b[_0x713a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50eeea,_0x44833e){return function(_0x315299){if(!_0x315299){_0x50eeea[_0x713a('0x28')](0x194);}return _0x315299;};}function handleError(_0x441e9a,_0x508976){_0x508976=_0x508976||0x1f4;return function(_0x38a67d){logger[_0x713a('0x29')](_0x38a67d[_0x713a('0x2a')]);if(_0x38a67d[_0x713a('0x2b')]){delete _0x38a67d['name'];}_0x441e9a[_0x713a('0x1a')](_0x508976)[_0x713a('0x2c')](_0x38a67d);};}exports['index']=function(_0x11657e,_0x4de133){var _0x42a27c={},_0x47bf34={},_0x3fd20d={'count':0x0,'rows':[]};var _0x97fb23=_['map'](db['VtigerAccount'][_0x713a('0x2d')],function(_0x3b4070){return{'name':_0x3b4070[_0x713a('0x2e')],'type':_0x3b4070[_0x713a('0x2f')][_0x713a('0x30')]};});_0x47bf34[_0x713a('0x31')]=_[_0x713a('0x32')](_0x97fb23,_0x713a('0x2b'));_0x47bf34[_0x713a('0x33')]=_[_0x713a('0x34')](_0x11657e['query']);_0x47bf34[_0x713a('0x35')]=_[_0x713a('0x36')](_0x47bf34[_0x713a('0x31')],_0x47bf34[_0x713a('0x33')]);_0x42a27c[_0x713a('0x37')]=_[_0x713a('0x36')](_0x47bf34[_0x713a('0x31')],qs[_0x713a('0x38')](_0x11657e['query']['fields']));_0x42a27c[_0x713a('0x37')]=_0x42a27c[_0x713a('0x37')]['length']?_0x42a27c[_0x713a('0x37')]:_0x47bf34['model'];if(!_0x11657e[_0x713a('0x33')][_0x713a('0x39')](_0x713a('0x3a'))){_0x42a27c[_0x713a('0x1e')]=qs[_0x713a('0x1e')](_0x11657e[_0x713a('0x33')][_0x713a('0x1e')]);_0x42a27c[_0x713a('0x1d')]=qs[_0x713a('0x1d')](_0x11657e[_0x713a('0x33')]['offset']);}_0x42a27c[_0x713a('0x3b')]=qs[_0x713a('0x3c')](_0x11657e[_0x713a('0x33')][_0x713a('0x3c')]);_0x42a27c[_0x713a('0x3d')]=qs[_0x713a('0x35')](_[_0x713a('0x3e')](_0x11657e[_0x713a('0x33')],_0x47bf34['filters']),_0x97fb23);if(_0x11657e[_0x713a('0x33')][_0x713a('0x3f')]){_0x42a27c[_0x713a('0x3d')]=_[_0x713a('0x40')](_0x42a27c[_0x713a('0x3d')],{'$or':_[_0x713a('0x32')](_0x97fb23,function(_0x573931){if(_0x573931['type']!=='VIRTUAL'){var _0x317b80={};_0x317b80[_0x573931[_0x713a('0x2b')]]={'$like':'%'+_0x11657e['query'][_0x713a('0x3f')]+'%'};return _0x317b80;}})});}_0x42a27c=_[_0x713a('0x40')]({},_0x42a27c,_0x11657e[_0x713a('0x41')]);var _0x543add={'where':_0x42a27c[_0x713a('0x3d')]};return db[_0x713a('0x42')][_0x713a('0x20')](_0x543add)[_0x713a('0x27')](function(_0x538789){_0x3fd20d[_0x713a('0x20')]=_0x538789;if(_0x11657e[_0x713a('0x33')][_0x713a('0x43')]){_0x42a27c[_0x713a('0x44')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x42a27c);})[_0x713a('0x27')](function(_0x360b3f){_0x3fd20d['rows']=_0x360b3f;return _0x3fd20d;})[_0x713a('0x27')](respondWithFilteredResult(_0x4de133,_0x42a27c))[_0x713a('0x45')](handleError(_0x4de133,null));};exports[_0x713a('0x46')]=function(_0x4b8283,_0x250278){var _0x5f1c27={'raw':![],'where':{'id':_0x4b8283['params']['id']}},_0x28587b={};_0x28587b[_0x713a('0x31')]=_[_0x713a('0x34')](db[_0x713a('0x42')][_0x713a('0x2d')]);_0x28587b[_0x713a('0x33')]=_['keys'](_0x4b8283['query']);_0x28587b[_0x713a('0x35')]=_[_0x713a('0x36')](_0x28587b[_0x713a('0x31')],_0x28587b['query']);_0x5f1c27[_0x713a('0x37')]=_[_0x713a('0x36')](_0x28587b[_0x713a('0x31')],qs[_0x713a('0x38')](_0x4b8283[_0x713a('0x33')][_0x713a('0x38')]));_0x5f1c27[_0x713a('0x37')]=_0x5f1c27[_0x713a('0x37')][_0x713a('0x47')]?_0x5f1c27['attributes']:_0x28587b[_0x713a('0x31')];if(_0x4b8283[_0x713a('0x33')][_0x713a('0x43')]){_0x5f1c27[_0x713a('0x44')]=[{'all':!![]}];}_0x5f1c27=_[_0x713a('0x40')]({},_0x5f1c27,_0x4b8283['options']);return db[_0x713a('0x42')][_0x713a('0x48')](_0x5f1c27)[_0x713a('0x27')](handleEntityNotFound(_0x250278,null))[_0x713a('0x27')](respondWithResult(_0x250278,null))[_0x713a('0x45')](handleError(_0x250278,null));};exports['create']=function(_0x5aaeb8,_0x4b33a4){return db[_0x713a('0x42')][_0x713a('0x49')](_0x5aaeb8[_0x713a('0x4a')],{})['then'](respondWithResult(_0x4b33a4,0xc9))[_0x713a('0x45')](handleError(_0x4b33a4,null));};exports[_0x713a('0x4b')]=function(_0x6e5c80,_0x74471d){if(_0x6e5c80[_0x713a('0x4a')]['id']){delete _0x6e5c80[_0x713a('0x4a')]['id'];}return db['VtigerAccount'][_0x713a('0x48')]({'where':{'id':_0x6e5c80['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x74471d,null))['then'](saveUpdates(_0x6e5c80[_0x713a('0x4a')],null))[_0x713a('0x27')](respondWithResult(_0x74471d,null))[_0x713a('0x45')](handleError(_0x74471d,null));};exports['destroy']=function(_0x443533,_0x2ff580){return db[_0x713a('0x42')][_0x713a('0x48')]({'where':{'id':_0x443533['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x2ff580,null))['then'](removeEntity(_0x2ff580,null))[_0x713a('0x45')](handleError(_0x2ff580,null));};exports[_0x713a('0x4c')]=function(_0x32953a,_0x3d91c1,_0x42390c){var _0x525f72={};var _0x393b20={};var _0x243528;var _0x2897c2;return db[_0x713a('0x42')][_0x713a('0x4d')]({'where':{'id':_0x32953a[_0x713a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d91c1,null))[_0x713a('0x27')](function(_0x18567c){if(_0x18567c){_0x243528=_0x18567c;_0x393b20[_0x713a('0x31')]=_['keys'](db[_0x713a('0x4f')][_0x713a('0x2d')]);_0x393b20[_0x713a('0x33')]=_[_0x713a('0x34')](_0x32953a['query']);_0x393b20[_0x713a('0x35')]=_[_0x713a('0x36')](_0x393b20[_0x713a('0x31')],_0x393b20[_0x713a('0x33')]);_0x525f72[_0x713a('0x37')]=_['intersection'](_0x393b20[_0x713a('0x31')],qs[_0x713a('0x38')](_0x32953a[_0x713a('0x33')][_0x713a('0x38')]));_0x525f72['attributes']=_0x525f72[_0x713a('0x37')]['length']?_0x525f72[_0x713a('0x37')]:_0x393b20[_0x713a('0x31')];_0x525f72['order']=qs[_0x713a('0x3c')](_0x32953a[_0x713a('0x33')]['sort']);_0x525f72[_0x713a('0x3d')]=qs[_0x713a('0x35')](_['pick'](_0x32953a[_0x713a('0x33')],_0x393b20['filters']));if(_0x32953a['query'][_0x713a('0x3f')]){_0x525f72[_0x713a('0x3d')]=_['merge'](_0x525f72['where'],{'$or':_[_0x713a('0x32')](_0x525f72['attributes'],function(_0x361dda){var _0x293784={};_0x293784[_0x361dda]={'$like':'%'+_0x32953a[_0x713a('0x33')][_0x713a('0x3f')]+'%'};return _0x293784;})});}_0x525f72=_[_0x713a('0x40')]({},_0x525f72,_0x32953a['options']);return _0x243528[_0x713a('0x4c')](_0x525f72);}})[_0x713a('0x27')](function(_0x9d8de2){if(_0x9d8de2){_0x2897c2=_0x9d8de2['length'];if(!_0x32953a[_0x713a('0x33')][_0x713a('0x39')](_0x713a('0x3a'))){_0x525f72[_0x713a('0x1e')]=qs[_0x713a('0x1e')](_0x32953a[_0x713a('0x33')][_0x713a('0x1e')]);_0x525f72[_0x713a('0x1d')]=qs['offset'](_0x32953a[_0x713a('0x33')]['offset']);}return _0x243528[_0x713a('0x4c')](_0x525f72);}})['then'](function(_0xe35841){if(_0xe35841){return _0xe35841?{'count':_0x2897c2,'rows':_0xe35841}:null;}})[_0x713a('0x27')](respondWithResult(_0x3d91c1,null))['catch'](handleError(_0x3d91c1,null));};exports[_0x713a('0x50')]=function(_0x28e463,_0x220b13,_0x2f408a){if(_0x28e463[_0x713a('0x4a')]['id']){delete _0x28e463['body']['id'];}return db['VtigerAccount'][_0x713a('0x4d')]({'where':{'id':_0x28e463['params']['id']}})[_0x713a('0x27')](handleEntityNotFound(_0x220b13,null))['then'](function(_0x15354b){if(_0x15354b){_0x28e463[_0x713a('0x4a')][_0x713a('0x51')]=_0x15354b['id'];_0x28e463[_0x713a('0x4a')][_0x713a('0x52')]=integrations['getSubjects'](_0x28e463[_0x713a('0x4a')][_0x713a('0x53')],_0x28e463[_0x713a('0x4a')][_0x713a('0x2f')]);_0x28e463[_0x713a('0x4a')][_0x713a('0x54')]=integrations[_0x713a('0x55')](_0x28e463[_0x713a('0x4a')][_0x713a('0x53')],_0x28e463[_0x713a('0x4a')][_0x713a('0x2f')]);return db[_0x713a('0x4f')][_0x713a('0x49')](_0x28e463[_0x713a('0x4a')],{'include':[{'model':db[_0x713a('0x56')],'as':_0x713a('0x52')},{'model':db[_0x713a('0x56')],'as':_0x713a('0x54')}]});}return null;})[_0x713a('0x27')](respondWithResult(_0x220b13,null))['catch'](handleError(_0x220b13,null));};var md5=require(_0x713a('0x57'));exports[_0x713a('0x58')]=function(_0x31256f,_0x449ace,_0x466a3f){var _0x4c9556=null;var _0x5d050c=null;var _0x49047b=null;var _0x563f2b=null;var _0x329424='';return db['VtigerAccount']['findOne']({'where':{'id':_0x31256f['params']['id']},'attributes':['id',_0x713a('0x2b'),_0x713a('0x59'),_0x713a('0x5a'),_0x713a('0x5b'),_0x713a('0x5c'),_0x713a('0x5d'),_0x713a('0x5e')]})[_0x713a('0x27')](handleEntityNotFound(_0x449ace,null))['then'](function(_0xeb0e8e){if(_0xeb0e8e){_0x4c9556=_0xeb0e8e[_0x713a('0x59')];_0x5d050c=_0xeb0e8e[_0x713a('0x5e')];_0x49047b=_0xeb0e8e['moduleName'];_0x329424=_0xeb0e8e[_0x713a('0x5c')];var _0x9b17f6=_0x329424['slice'](-0x1);if(_0x9b17f6==='/'){_0x329424=_0x329424[_0x713a('0x5f')](0x0,_0x329424[_0x713a('0x60')](_0x9b17f6));}_0x563f2b=util[_0x713a('0x61')](_0x713a('0x62'),_0x329424);var _0x37548e={'method':_0x713a('0x63'),'uri':_0x563f2b,'qs':{'operation':_0x713a('0x64'),'username':_0xeb0e8e['username']},'json':!![]};return rp(_0x37548e);}})[_0x713a('0x27')](function(_0x5042b2){if(_0x5042b2[_0x713a('0x65')]){var _0x44b17b={'method':_0x713a('0x66'),'uri':_0x563f2b,'form':{'operation':_0x713a('0x67'),'username':_0x4c9556,'accessKey':md5(_0x5042b2[_0x713a('0x68')][_0x713a('0x69')]+_0x5d050c)},'json':!![]};return rp(_0x44b17b);}})['then'](function(_0x34f8a6){if(_0x34f8a6[_0x713a('0x65')]){var _0x1d2200={'method':_0x713a('0x63'),'uri':_0x563f2b,'qs':{'operation':'describe','username':_0x4c9556,'sessionName':_0x34f8a6[_0x713a('0x68')][_0x713a('0x6a')],'elementType':_0x49047b},'json':!![]};return rp(_0x1d2200);}})[_0x713a('0x27')](function(_0x3204ff){if(_0x3204ff[_0x713a('0x65')]){var _0xd87fbc=[_0x713a('0x6b'),_0x713a('0x6c'),_0x713a('0x6d')];_['remove'](_0x3204ff['result'][_0x713a('0x38')],function(_0x5b4c4e){return _0xd87fbc[_0x713a('0x6e')](_0x5b4c4e[_0x713a('0x2f')]['name']);});_[_0x713a('0x6f')](_0x3204ff['result'][_0x713a('0x38')],function(_0x187485){return _0x187485['editable']==='false';});return{'count':_0x3204ff[_0x713a('0x68')][_0x713a('0x38')]['length'],'rows':_[_0x713a('0x32')](_0x3204ff[_0x713a('0x68')][_0x713a('0x38')],function(_0x5554b1){return{'id':_0x5554b1['name'],'name':_0x5554b1[_0x713a('0x70')],'custom':_[_0x713a('0x71')](_0x5554b1['name'],_0x713a('0x72'))?!![]:![],'options':_0x5554b1[_0x713a('0x2f')][_0x713a('0x2b')]===_0x713a('0x73')&&_0x5554b1['type']['picklistValues'][_0x713a('0x47')]>0x0?_[_0x713a('0x32')](_0x5554b1['type'][_0x713a('0x74')],function(_0x95cfc6){return{'name':_0x95cfc6[_0x713a('0x70')],'value':_0x95cfc6[_0x713a('0x75')]};}):[]};})};}})[_0x713a('0x27')](respondWithResult(_0x449ace,null))['catch'](function(_0x5023b0){console[_0x713a('0x76')](_0x713a('0x77')+_0x5023b0);var _0x1428cb=_0x31256f[_0x713a('0x33')][_0x713a('0x78')]?0x1f4:_0x5023b0[_0x713a('0x79')]||0x1f4;logger[_0x713a('0x29')](_0x713a('0x7a'),_0x713a('0x58'),_0x1428cb,JSON[_0x713a('0x7b')](_0x5023b0));delete _0x5023b0[_0x713a('0x2b')];if(_0x1428cb===0x191){_0x1428cb=0x190;}_0x449ace['status'](_0x1428cb)[_0x713a('0x2c')](_0x31256f[_0x713a('0x33')][_0x713a('0x78')]?{'message':_0x713a('0x7c'),'statusCode':_0x5023b0[_0x713a('0x79')]}:_0x5023b0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5cfc269..b4a4e80 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 _0x769e=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x769e,0x131));var _0xe769=function(_0x39b754,_0x5c073e){_0x39b754=_0x39b754-0x0;var _0x4fbfd9=_0x769e[_0x39b754];return _0x4fbfd9;};'use strict';var _=require(_0xe769('0x0'));var util=require(_0xe769('0x1'));var logger=require('../../config/logger')(_0xe769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe769('0x3'));var fs=require('fs');var path=require(_0xe769('0x4'));var rimraf=require(_0xe769('0x5'));var config=require(_0xe769('0x6'));var attributes=require(_0xe769('0x7'));var integrations=require(_0xe769('0x8'));module[_0xe769('0x9')]=function(_0x3dccce,_0x562b42){return _0x3dccce['define'](_0xe769('0xa'),attributes,{'tableName':_0xe769('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed6=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x24c3ae,_0x3bf1d1){var _0xb02bd8=function(_0x49f94e){while(--_0x49f94e){_0x24c3ae['push'](_0x24c3ae['shift']());}};_0xb02bd8(++_0x3bf1d1);}(_0x3ed6,0x91));var _0x63ed=function(_0x32d25a,_0x2ea6f7){_0x32d25a=_0x32d25a-0x0;var _0x2a23ce=_0x3ed6[_0x32d25a];return _0x2a23ce;};'use strict';var _=require(_0x63ed('0x0'));var util=require(_0x63ed('0x1'));var logger=require(_0x63ed('0x2'))(_0x63ed('0x3'));var moment=require(_0x63ed('0x4'));var BPromise=require(_0x63ed('0x5'));var rp=require(_0x63ed('0x6'));var fs=require('fs');var path=require(_0x63ed('0x7'));var rimraf=require(_0x63ed('0x8'));var config=require('../../config/environment');var attributes=require(_0x63ed('0x9'));var integrations=require(_0x63ed('0xa'));module[_0x63ed('0xb')]=function(_0x2348fd,_0x5970f6){return _0x2348fd['define'](_0x63ed('0xc'),attributes,{'tableName':_0x63ed('0xd'),'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 8fae993..dc77243 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetVtigerAccount','catch','ShowVtigerAccount'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x087b,0x11a));var _0xb087=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x087b[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetVtigerAccount']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['VtigerAccount'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['VtigerAccount'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowVtigerAccount',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xe205,0xa7));var _0x5e20=function(_0x58f232,_0x4cfb74){_0x58f232=_0x58f232-0x0;var _0x5a041e=_0xe205[_0x58f232];return _0x5a041e;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index fec5672..41de4b4 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 _0x8f1d=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intVtigerConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8f1d,0xe5));var _0xd8f1=function(_0x54f322,_0x24a660){_0x54f322=_0x54f322-0x0;var _0xb0a1d5=_0x8f1d[_0x54f322];return _0xb0a1d5;};'use strict';var multer=require(_0xd8f1('0x0'));var util=require(_0xd8f1('0x1'));var path=require(_0xd8f1('0x2'));var timeout=require(_0xd8f1('0x3'));var express=require(_0xd8f1('0x4'));var router=express[_0xd8f1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8f1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8f1('0x7'));router[_0xd8f1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd8f1('0x9'),auth[_0xd8f1('0xa')](),controller[_0xd8f1('0xb')]);router['get'](_0xd8f1('0xc'),auth[_0xd8f1('0xa')](),controller[_0xd8f1('0xd')]);router['get'](_0xd8f1('0xe'),auth[_0xd8f1('0xa')](),controller[_0xd8f1('0xf')]);router[_0xd8f1('0x8')]('/:id/descriptions',auth[_0xd8f1('0xa')](),controller[_0xd8f1('0x10')]);router[_0xd8f1('0x11')]('/',auth[_0xd8f1('0xa')](),controller[_0xd8f1('0x12')]);router[_0xd8f1('0x13')]('/:id',auth[_0xd8f1('0xa')](),controller[_0xd8f1('0x14')]);router[_0xd8f1('0x15')](_0xd8f1('0x9'),auth[_0xd8f1('0xa')](),controller[_0xd8f1('0x16')]);module[_0xd8f1('0x17')]=router; \ No newline at end of file +var _0x6d1c=['get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40c3ed,_0x2b2053){var _0x182dd7=function(_0x38732b){while(--_0x38732b){_0x40c3ed['push'](_0x40c3ed['shift']());}};_0x182dd7(++_0x2b2053);}(_0x6d1c,0xa7));var _0xc6d1=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x6d1c[_0x1fd675];return _0x16b554;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require('path');var timeout=require(_0xc6d1('0x2'));var express=require('express');var router=express[_0xc6d1('0x3')]();var fs_extra=require(_0xc6d1('0x4'));var auth=require(_0xc6d1('0x5'));var interaction=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xc6d1('0x8')]('/',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xa')]);router[_0xc6d1('0x8')]('/:id',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xb')]);router[_0xc6d1('0x8')](_0xc6d1('0xc'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xc6d1('0xe')]);router[_0xc6d1('0x8')](_0xc6d1('0xf'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x10')]);router[_0xc6d1('0x11')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0x12')]);router[_0xc6d1('0x13')]('/:id',auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x14')]);router[_0xc6d1('0x15')](_0xc6d1('0x16'),auth[_0xc6d1('0x9')](),controller[_0xc6d1('0x17')]);module[_0xc6d1('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b62c558..17a997a 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 _0x90d0=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90d0,0x90));var _0x090d=function(_0x6e5bf7,_0x2c5d6c){_0x6e5bf7=_0x6e5bf7-0x0;var _0x145f89=_0x90d0[_0x6e5bf7];return _0x145f89;};'use strict';var Sequelize=require('sequelize');module[_0x090d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x090d('0x1')]}}; \ No newline at end of file +var _0x60a9=['STRING'];(function(_0x928f34,_0x5bcf73){var _0x498c58=function(_0x49fdb9){while(--_0x49fdb9){_0x928f34['push'](_0x928f34['shift']());}};_0x498c58(++_0x5bcf73);}(_0x60a9,0x1a0));var _0x960a=function(_0x32f339,_0x5091db){_0x32f339=_0x32f339-0x0;var _0x35c310=_0x60a9[_0x32f339];return _0x35c310;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x960a('0x0')]},'description':{'type':Sequelize[_0x960a('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4cd4f89..110dca2 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 _0x5c9b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','create','body','catch','getFields','pick','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x452153,_0x16a193){var _0x5b7e2e=function(_0xbbf2f8){while(--_0xbbf2f8){_0x452153['push'](_0x452153['shift']());}};_0x5b7e2e(++_0x16a193);}(_0x5c9b,0x13b));var _0xb5c9=function(_0x1176b6,_0x3837af){_0x1176b6=_0x1176b6-0x0;var _0x565fb4=_0x5c9b[_0x1176b6];return _0x565fb4;};'use strict';var emlformat=require(_0xb5c9('0x0'));var rimraf=require(_0xb5c9('0x1'));var zipdir=require(_0xb5c9('0x2'));var jsonpatch=require(_0xb5c9('0x3'));var rp=require(_0xb5c9('0x4'));var moment=require(_0xb5c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5c9('0x6'));var util=require(_0xb5c9('0x7'));var path=require('path');var sox=require(_0xb5c9('0x8'));var csv=require(_0xb5c9('0x9'));var ejs=require(_0xb5c9('0xa'));var fs=require('fs');var fs_extra=require(_0xb5c9('0xb'));var _=require(_0xb5c9('0xc'));var squel=require(_0xb5c9('0xd'));var crypto=require('crypto');var jsforce=require(_0xb5c9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb5c9('0xf'));var Redis=require(_0xb5c9('0x10'));var authService=require(_0xb5c9('0x11'));var qs=require(_0xb5c9('0x12'));var as=require(_0xb5c9('0x13'));var hardwareService=require(_0xb5c9('0x14'));var logger=require(_0xb5c9('0x15'))(_0xb5c9('0x16'));var utils=require(_0xb5c9('0x17'));var config=require(_0xb5c9('0x18'));var licenseUtil=require(_0xb5c9('0x19'));var db=require(_0xb5c9('0x1a'))['db'];function respondWithStatusCode(_0x180234,_0x35ff66){_0x35ff66=_0x35ff66||0xcc;return function(_0x4a0abf){if(_0x4a0abf){return _0x180234['sendStatus'](_0x35ff66);}return _0x180234['status'](_0x35ff66)[_0xb5c9('0x1b')]();};}function respondWithResult(_0x19b581,_0x9356a4){_0x9356a4=_0x9356a4||0xc8;return function(_0x18f378){if(_0x18f378){return _0x19b581[_0xb5c9('0x1c')](_0x9356a4)[_0xb5c9('0x1d')](_0x18f378);}};}function respondWithFilteredResult(_0x1cb1e5,_0x3e67fd){return function(_0x3d403e){if(_0x3d403e){var _0x2be517=typeof _0x3e67fd[_0xb5c9('0x1e')]==='undefined'&&typeof _0x3e67fd[_0xb5c9('0x1f')]===_0xb5c9('0x20');var _0x4df8e7=_0x3d403e[_0xb5c9('0x21')];var _0x12eb18=_0x2be517?0x0:_0x3e67fd[_0xb5c9('0x1e')];var _0x516810=_0x2be517?_0x3d403e[_0xb5c9('0x21')]:_0x3e67fd['offset']+_0x3e67fd[_0xb5c9('0x1f')];var _0x296f97;if(_0x516810>=_0x4df8e7){_0x516810=_0x4df8e7;_0x296f97=0xc8;}else{_0x296f97=0xce;}_0x1cb1e5[_0xb5c9('0x1c')](_0x296f97);return _0x1cb1e5[_0xb5c9('0x22')](_0xb5c9('0x23'),_0x12eb18+'-'+_0x516810+'/'+_0x4df8e7)['json'](_0x3d403e);}return null;};}function patchUpdates(_0x222f6c){return function(_0x39b003){try{jsonpatch[_0xb5c9('0x24')](_0x39b003,_0x222f6c,!![]);}catch(_0x1de3ac){return BPromise[_0xb5c9('0x25')](_0x1de3ac);}return _0x39b003['save']();};}function saveUpdates(_0x347178,_0x56ce14){return function(_0x316736){if(_0x316736){return _0x316736[_0xb5c9('0x26')](_0x347178)[_0xb5c9('0x27')](function(_0x528e9c){return _0x528e9c;});}return null;};}function removeEntity(_0x406665,_0x24f3b7){return function(_0x3d59d7){if(_0x3d59d7){return _0x3d59d7[_0xb5c9('0x28')]()[_0xb5c9('0x27')](function(){_0x406665[_0xb5c9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7dce1a,_0x1b9f8b){return function(_0x2281af){if(!_0x2281af){_0x7dce1a[_0xb5c9('0x29')](0x194);}return _0x2281af;};}function handleError(_0x4416fd,_0x5a6cad){_0x5a6cad=_0x5a6cad||0x1f4;return function(_0x387ff3){logger[_0xb5c9('0x2a')](_0x387ff3[_0xb5c9('0x2b')]);if(_0x387ff3[_0xb5c9('0x2c')]){delete _0x387ff3[_0xb5c9('0x2c')];}_0x4416fd[_0xb5c9('0x1c')](_0x5a6cad)['send'](_0x387ff3);};}exports[_0xb5c9('0x2d')]=function(_0xca267f,_0x57335d){var _0x19846f={},_0x56537d={},_0x1bf54a={'count':0x0,'rows':[]};var _0x345547=_[_0xb5c9('0x2e')](db[_0xb5c9('0x2f')][_0xb5c9('0x30')],function(_0x56186a){return{'name':_0x56186a[_0xb5c9('0x31')],'type':_0x56186a[_0xb5c9('0x32')][_0xb5c9('0x33')]};});_0x56537d[_0xb5c9('0x34')]=_[_0xb5c9('0x2e')](_0x345547,_0xb5c9('0x2c'));_0x56537d['query']=_[_0xb5c9('0x35')](_0xca267f['query']);_0x56537d[_0xb5c9('0x36')]=_[_0xb5c9('0x37')](_0x56537d[_0xb5c9('0x34')],_0x56537d[_0xb5c9('0x38')]);_0x19846f[_0xb5c9('0x39')]=_[_0xb5c9('0x37')](_0x56537d[_0xb5c9('0x34')],qs[_0xb5c9('0x3a')](_0xca267f[_0xb5c9('0x38')][_0xb5c9('0x3a')]));_0x19846f[_0xb5c9('0x39')]=_0x19846f[_0xb5c9('0x39')]['length']?_0x19846f['attributes']:_0x56537d['model'];if(!_0xca267f[_0xb5c9('0x38')][_0xb5c9('0x3b')](_0xb5c9('0x3c'))){_0x19846f[_0xb5c9('0x1f')]=qs[_0xb5c9('0x1f')](_0xca267f['query']['limit']);_0x19846f[_0xb5c9('0x1e')]=qs['offset'](_0xca267f[_0xb5c9('0x38')][_0xb5c9('0x1e')]);}_0x19846f[_0xb5c9('0x3d')]=qs[_0xb5c9('0x3e')](_0xca267f[_0xb5c9('0x38')]['sort']);_0x19846f[_0xb5c9('0x3f')]=qs['filters'](_['pick'](_0xca267f[_0xb5c9('0x38')],_0x56537d['filters']),_0x345547);if(_0xca267f[_0xb5c9('0x38')]['filter']){_0x19846f[_0xb5c9('0x3f')]=_[_0xb5c9('0x40')](_0x19846f[_0xb5c9('0x3f')],{'$or':_['map'](_0x345547,function(_0xecec1e){if(_0xecec1e[_0xb5c9('0x32')]!==_0xb5c9('0x41')){var _0x2aa18e={};_0x2aa18e[_0xecec1e['name']]={'$like':'%'+_0xca267f[_0xb5c9('0x38')][_0xb5c9('0x42')]+'%'};return _0x2aa18e;}})});}_0x19846f=_[_0xb5c9('0x40')]({},_0x19846f,_0xca267f[_0xb5c9('0x43')]);var _0x94d351={'where':_0x19846f[_0xb5c9('0x3f')]};return db[_0xb5c9('0x2f')][_0xb5c9('0x21')](_0x94d351)['then'](function(_0x1586ae){_0x1bf54a[_0xb5c9('0x21')]=_0x1586ae;if(_0xca267f[_0xb5c9('0x38')][_0xb5c9('0x44')]){_0x19846f[_0xb5c9('0x45')]=[{'all':!![]}];}return db[_0xb5c9('0x2f')][_0xb5c9('0x46')](_0x19846f);})[_0xb5c9('0x27')](function(_0x50f94c){_0x1bf54a['rows']=_0x50f94c;return _0x1bf54a;})['then'](respondWithFilteredResult(_0x57335d,_0x19846f))['catch'](handleError(_0x57335d,null));};exports[_0xb5c9('0x47')]=function(_0x37b544,_0x42ae01){var _0x31a1ff={'raw':![],'where':{'id':_0x37b544[_0xb5c9('0x48')]['id']}},_0x330bee={};_0x330bee[_0xb5c9('0x34')]=_[_0xb5c9('0x35')](db[_0xb5c9('0x2f')][_0xb5c9('0x30')]);_0x330bee[_0xb5c9('0x38')]=_['keys'](_0x37b544[_0xb5c9('0x38')]);_0x330bee[_0xb5c9('0x36')]=_[_0xb5c9('0x37')](_0x330bee[_0xb5c9('0x34')],_0x330bee[_0xb5c9('0x38')]);_0x31a1ff[_0xb5c9('0x39')]=_[_0xb5c9('0x37')](_0x330bee[_0xb5c9('0x34')],qs[_0xb5c9('0x3a')](_0x37b544[_0xb5c9('0x38')]['fields']));_0x31a1ff['attributes']=_0x31a1ff[_0xb5c9('0x39')][_0xb5c9('0x49')]?_0x31a1ff[_0xb5c9('0x39')]:_0x330bee[_0xb5c9('0x34')];if(_0x37b544['query']['includeAll']){_0x31a1ff[_0xb5c9('0x45')]=[{'all':!![]}];}_0x31a1ff=_['merge']({},_0x31a1ff,_0x37b544[_0xb5c9('0x43')]);return db[_0xb5c9('0x2f')]['find'](_0x31a1ff)[_0xb5c9('0x27')](handleEntityNotFound(_0x42ae01,null))[_0xb5c9('0x27')](respondWithResult(_0x42ae01,null))['catch'](handleError(_0x42ae01,null));};exports[_0xb5c9('0x4a')]=function(_0x2b1988,_0x4acb6f){return db[_0xb5c9('0x2f')]['create'](_0x2b1988[_0xb5c9('0x4b')],{})[_0xb5c9('0x27')](respondWithResult(_0x4acb6f,0xc9))['catch'](handleError(_0x4acb6f,null));};exports[_0xb5c9('0x26')]=function(_0x41ccad,_0x13f7de){if(_0x41ccad[_0xb5c9('0x4b')]['id']){delete _0x41ccad[_0xb5c9('0x4b')]['id'];}return db[_0xb5c9('0x2f')]['find']({'where':{'id':_0x41ccad[_0xb5c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x13f7de,null))[_0xb5c9('0x27')](saveUpdates(_0x41ccad[_0xb5c9('0x4b')],null))[_0xb5c9('0x27')](respondWithResult(_0x13f7de,null))[_0xb5c9('0x4c')](handleError(_0x13f7de,null));};exports[_0xb5c9('0x28')]=function(_0x43afc8,_0x52e96a){return db[_0xb5c9('0x2f')]['find']({'where':{'id':_0x43afc8[_0xb5c9('0x48')]['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x52e96a,null))[_0xb5c9('0x27')](removeEntity(_0x52e96a,null))[_0xb5c9('0x4c')](handleError(_0x52e96a,null));};exports[_0xb5c9('0x4d')]=function(_0x2ef856,_0x14b5f5,_0xef1ed2){var _0x1b6022={};var _0xbe2be4={};var _0x24b995;var _0x54af4d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x2ef856[_0xb5c9('0x48')]['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x14b5f5,null))[_0xb5c9('0x27')](function(_0x27cdbc){if(_0x27cdbc){_0x24b995=_0x27cdbc;_0xbe2be4['model']=_[_0xb5c9('0x35')](db['VtigerField'][_0xb5c9('0x30')]);_0xbe2be4[_0xb5c9('0x38')]=_[_0xb5c9('0x35')](_0x2ef856[_0xb5c9('0x38')]);_0xbe2be4[_0xb5c9('0x36')]=_['intersection'](_0xbe2be4[_0xb5c9('0x34')],_0xbe2be4[_0xb5c9('0x38')]);_0x1b6022[_0xb5c9('0x39')]=_[_0xb5c9('0x37')](_0xbe2be4[_0xb5c9('0x34')],qs[_0xb5c9('0x3a')](_0x2ef856['query']['fields']));_0x1b6022[_0xb5c9('0x39')]=_0x1b6022['attributes'][_0xb5c9('0x49')]?_0x1b6022[_0xb5c9('0x39')]:_0xbe2be4[_0xb5c9('0x34')];_0x1b6022['order']=qs[_0xb5c9('0x3e')](_0x2ef856[_0xb5c9('0x38')][_0xb5c9('0x3e')]);_0x1b6022['where']=qs['filters'](_[_0xb5c9('0x4e')](_0x2ef856[_0xb5c9('0x38')],_0xbe2be4[_0xb5c9('0x36')]));if(_0x2ef856[_0xb5c9('0x38')][_0xb5c9('0x42')]){_0x1b6022['where']=_[_0xb5c9('0x40')](_0x1b6022[_0xb5c9('0x3f')],{'$or':_['map'](_0x1b6022[_0xb5c9('0x39')],function(_0x57e1b0){var _0x683a88={};_0x683a88[_0x57e1b0]={'$like':'%'+_0x2ef856[_0xb5c9('0x38')][_0xb5c9('0x42')]+'%'};return _0x683a88;})});}_0x1b6022=_[_0xb5c9('0x40')]({},_0x1b6022,_0x2ef856['options']);return _0x24b995[_0xb5c9('0x4d')](_0x1b6022);}})[_0xb5c9('0x27')](function(_0x5280da){if(_0x5280da){_0x54af4d=_0x5280da['length'];if(!_0x2ef856[_0xb5c9('0x38')][_0xb5c9('0x3b')](_0xb5c9('0x3c'))){_0x1b6022[_0xb5c9('0x1f')]=qs[_0xb5c9('0x1f')](_0x2ef856[_0xb5c9('0x38')][_0xb5c9('0x1f')]);_0x1b6022[_0xb5c9('0x1e')]=qs[_0xb5c9('0x1e')](_0x2ef856['query']['offset']);}return _0x24b995[_0xb5c9('0x4d')](_0x1b6022);}})[_0xb5c9('0x27')](function(_0x4dcbed){if(_0x4dcbed){return _0x4dcbed?{'count':_0x54af4d,'rows':_0x4dcbed}:null;}})['then'](respondWithResult(_0x14b5f5,null))[_0xb5c9('0x4c')](handleError(_0x14b5f5,null));};exports['getSubjects']=function(_0x21392b,_0x5e09a3,_0x507a5e){var _0x4187dc={};var _0x38e0c0={};var _0x1511fe;var _0xbd3e66;return db[_0xb5c9('0x2f')][_0xb5c9('0x4f')]({'where':{'id':_0x21392b['params']['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x5e09a3,null))[_0xb5c9('0x27')](function(_0x39e71c){if(_0x39e71c){_0x1511fe=_0x39e71c;_0x38e0c0[_0xb5c9('0x34')]=_[_0xb5c9('0x35')](db[_0xb5c9('0x50')]['rawAttributes']);_0x38e0c0[_0xb5c9('0x38')]=_[_0xb5c9('0x35')](_0x21392b[_0xb5c9('0x38')]);_0x38e0c0[_0xb5c9('0x36')]=_[_0xb5c9('0x37')](_0x38e0c0[_0xb5c9('0x34')],_0x38e0c0[_0xb5c9('0x38')]);_0x4187dc[_0xb5c9('0x39')]=_['intersection'](_0x38e0c0['model'],qs[_0xb5c9('0x3a')](_0x21392b[_0xb5c9('0x38')][_0xb5c9('0x3a')]));_0x4187dc['attributes']=_0x4187dc[_0xb5c9('0x39')]['length']?_0x4187dc[_0xb5c9('0x39')]:_0x38e0c0[_0xb5c9('0x34')];_0x4187dc[_0xb5c9('0x3d')]=qs[_0xb5c9('0x3e')](_0x21392b[_0xb5c9('0x38')][_0xb5c9('0x3e')]);_0x4187dc[_0xb5c9('0x3f')]=qs[_0xb5c9('0x36')](_[_0xb5c9('0x4e')](_0x21392b[_0xb5c9('0x38')],_0x38e0c0[_0xb5c9('0x36')]));if(_0x21392b[_0xb5c9('0x38')][_0xb5c9('0x42')]){_0x4187dc['where']=_[_0xb5c9('0x40')](_0x4187dc[_0xb5c9('0x3f')],{'$or':_[_0xb5c9('0x2e')](_0x4187dc[_0xb5c9('0x39')],function(_0x3f1787){var _0x1f88ce={};_0x1f88ce[_0x3f1787]={'$like':'%'+_0x21392b[_0xb5c9('0x38')]['filter']+'%'};return _0x1f88ce;})});}_0x4187dc=_[_0xb5c9('0x40')]({},_0x4187dc,_0x21392b['options']);return _0x1511fe[_0xb5c9('0x51')](_0x4187dc);}})[_0xb5c9('0x27')](function(_0x2c21bb){if(_0x2c21bb){_0xbd3e66=_0x2c21bb['length'];if(!_0x21392b['query'][_0xb5c9('0x3b')]('nolimit')){_0x4187dc['limit']=qs[_0xb5c9('0x1f')](_0x21392b[_0xb5c9('0x38')][_0xb5c9('0x1f')]);_0x4187dc['offset']=qs[_0xb5c9('0x1e')](_0x21392b[_0xb5c9('0x38')]['offset']);}return _0x1511fe[_0xb5c9('0x51')](_0x4187dc);}})['then'](function(_0x1dd01f){if(_0x1dd01f){return _0x1dd01f?{'count':_0xbd3e66,'rows':_0x1dd01f}:null;}})[_0xb5c9('0x27')](respondWithResult(_0x5e09a3,null))['catch'](handleError(_0x5e09a3,null));};exports[_0xb5c9('0x52')]=function(_0x2b33f0,_0x3f1ad2,_0x5c55e8){var _0x10ceb2={};var _0x5ae4f4={};var _0xd0c25d;var _0x3f918e;return db[_0xb5c9('0x2f')][_0xb5c9('0x4f')]({'where':{'id':_0x2b33f0[_0xb5c9('0x48')]['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x3f1ad2,null))['then'](function(_0x4a3faf){if(_0x4a3faf){_0xd0c25d=_0x4a3faf;_0x5ae4f4[_0xb5c9('0x34')]=_[_0xb5c9('0x35')](db['VtigerField']['rawAttributes']);_0x5ae4f4['query']=_[_0xb5c9('0x35')](_0x2b33f0['query']);_0x5ae4f4['filters']=_['intersection'](_0x5ae4f4[_0xb5c9('0x34')],_0x5ae4f4[_0xb5c9('0x38')]);_0x10ceb2[_0xb5c9('0x39')]=_[_0xb5c9('0x37')](_0x5ae4f4['model'],qs[_0xb5c9('0x3a')](_0x2b33f0[_0xb5c9('0x38')]['fields']));_0x10ceb2[_0xb5c9('0x39')]=_0x10ceb2[_0xb5c9('0x39')][_0xb5c9('0x49')]?_0x10ceb2['attributes']:_0x5ae4f4[_0xb5c9('0x34')];_0x10ceb2[_0xb5c9('0x3d')]=qs[_0xb5c9('0x3e')](_0x2b33f0[_0xb5c9('0x38')][_0xb5c9('0x3e')]);_0x10ceb2['where']=qs[_0xb5c9('0x36')](_[_0xb5c9('0x4e')](_0x2b33f0['query'],_0x5ae4f4[_0xb5c9('0x36')]));if(_0x2b33f0['query'][_0xb5c9('0x42')]){_0x10ceb2['where']=_[_0xb5c9('0x40')](_0x10ceb2[_0xb5c9('0x3f')],{'$or':_[_0xb5c9('0x2e')](_0x10ceb2[_0xb5c9('0x39')],function(_0x570f03){var _0x2f5998={};_0x2f5998[_0x570f03]={'$like':'%'+_0x2b33f0['query'][_0xb5c9('0x42')]+'%'};return _0x2f5998;})});}_0x10ceb2=_[_0xb5c9('0x40')]({},_0x10ceb2,_0x2b33f0[_0xb5c9('0x43')]);return _0xd0c25d[_0xb5c9('0x52')](_0x10ceb2);}})[_0xb5c9('0x27')](function(_0x38f00b){if(_0x38f00b){_0x3f918e=_0x38f00b[_0xb5c9('0x49')];if(!_0x2b33f0[_0xb5c9('0x38')]['hasOwnProperty'](_0xb5c9('0x3c'))){_0x10ceb2[_0xb5c9('0x1f')]=qs[_0xb5c9('0x1f')](_0x2b33f0[_0xb5c9('0x38')][_0xb5c9('0x1f')]);_0x10ceb2[_0xb5c9('0x1e')]=qs[_0xb5c9('0x1e')](_0x2b33f0[_0xb5c9('0x38')][_0xb5c9('0x1e')]);}return _0xd0c25d[_0xb5c9('0x52')](_0x10ceb2);}})[_0xb5c9('0x27')](function(_0x8e658d){if(_0x8e658d){return _0x8e658d?{'count':_0x3f918e,'rows':_0x8e658d}:null;}})[_0xb5c9('0x27')](respondWithResult(_0x3f1ad2,null))[_0xb5c9('0x4c')](handleError(_0x3f1ad2,null));}; \ No newline at end of file +var _0xf591=['../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0xf591,0x128));var _0x1f59=function(_0x3717fc,_0x1c5cb0){_0x3717fc=_0x3717fc-0x0;var _0x3de354=_0xf591[_0x3717fc];return _0x3de354;};'use strict';var emlformat=require(_0x1f59('0x0'));var rimraf=require(_0x1f59('0x1'));var zipdir=require(_0x1f59('0x2'));var jsonpatch=require(_0x1f59('0x3'));var rp=require('request-promise');var moment=require(_0x1f59('0x4'));var BPromise=require(_0x1f59('0x5'));var Mustache=require(_0x1f59('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1f59('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f59('0x8'));var squel=require(_0x1f59('0x9'));var crypto=require(_0x1f59('0xa'));var jsforce=require(_0x1f59('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f59('0xc'));var Redis=require(_0x1f59('0xd'));var authService=require(_0x1f59('0xe'));var qs=require(_0x1f59('0xf'));var as=require(_0x1f59('0x10'));var hardwareService=require(_0x1f59('0x11'));var logger=require('../../config/logger')(_0x1f59('0x12'));var utils=require(_0x1f59('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1f59('0x14'));var db=require(_0x1f59('0x15'))['db'];function respondWithStatusCode(_0x4589d3,_0x7e0f18){_0x7e0f18=_0x7e0f18||0xcc;return function(_0x344c3a){if(_0x344c3a){return _0x4589d3[_0x1f59('0x16')](_0x7e0f18);}return _0x4589d3['status'](_0x7e0f18)['end']();};}function respondWithResult(_0x1c4a63,_0x2cb7bd){_0x2cb7bd=_0x2cb7bd||0xc8;return function(_0x20451d){if(_0x20451d){return _0x1c4a63[_0x1f59('0x17')](_0x2cb7bd)[_0x1f59('0x18')](_0x20451d);}};}function respondWithFilteredResult(_0x46f016,_0x3afe4b){return function(_0x267c4c){if(_0x267c4c){var _0x6ff8e=typeof _0x3afe4b['offset']==='undefined'&&typeof _0x3afe4b[_0x1f59('0x19')]==='undefined';var _0x1360b8=_0x267c4c[_0x1f59('0x1a')];var _0x1ced8c=_0x6ff8e?0x0:_0x3afe4b[_0x1f59('0x1b')];var _0x2bfcf0=_0x6ff8e?_0x267c4c['count']:_0x3afe4b[_0x1f59('0x1b')]+_0x3afe4b[_0x1f59('0x19')];var _0x265093;if(_0x2bfcf0>=_0x1360b8){_0x2bfcf0=_0x1360b8;_0x265093=0xc8;}else{_0x265093=0xce;}_0x46f016[_0x1f59('0x17')](_0x265093);return _0x46f016[_0x1f59('0x1c')](_0x1f59('0x1d'),_0x1ced8c+'-'+_0x2bfcf0+'/'+_0x1360b8)[_0x1f59('0x18')](_0x267c4c);}return null;};}function patchUpdates(_0x3e821e){return function(_0x5ae10d){try{jsonpatch[_0x1f59('0x1e')](_0x5ae10d,_0x3e821e,!![]);}catch(_0x1e0495){return BPromise[_0x1f59('0x1f')](_0x1e0495);}return _0x5ae10d[_0x1f59('0x20')]();};}function saveUpdates(_0x3005a8,_0xbf0fd0){return function(_0x535bcc){if(_0x535bcc){return _0x535bcc['update'](_0x3005a8)[_0x1f59('0x21')](function(_0x3ec938){return _0x3ec938;});}return null;};}function removeEntity(_0x485b9d,_0x1b8c3f){return function(_0x4d4bdc){if(_0x4d4bdc){return _0x4d4bdc[_0x1f59('0x22')]()['then'](function(){_0x485b9d[_0x1f59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19337d,_0x949f4f){return function(_0x181e80){if(!_0x181e80){_0x19337d[_0x1f59('0x16')](0x194);}return _0x181e80;};}function handleError(_0x460019,_0x15a65d){_0x15a65d=_0x15a65d||0x1f4;return function(_0x5256b8){logger[_0x1f59('0x23')](_0x5256b8[_0x1f59('0x24')]);if(_0x5256b8['name']){delete _0x5256b8[_0x1f59('0x25')];}_0x460019[_0x1f59('0x17')](_0x15a65d)[_0x1f59('0x26')](_0x5256b8);};}exports[_0x1f59('0x27')]=function(_0x56f778,_0x296642){var _0x4cdc23={},_0x1604dc={},_0x433a81={'count':0x0,'rows':[]};var _0x36fd78=_['map'](db[_0x1f59('0x28')][_0x1f59('0x29')],function(_0x1edc07){return{'name':_0x1edc07[_0x1f59('0x2a')],'type':_0x1edc07[_0x1f59('0x2b')][_0x1f59('0x2c')]};});_0x1604dc[_0x1f59('0x2d')]=_[_0x1f59('0x2e')](_0x36fd78,_0x1f59('0x25'));_0x1604dc['query']=_[_0x1f59('0x2f')](_0x56f778['query']);_0x1604dc[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x1604dc[_0x1f59('0x2d')],_0x1604dc[_0x1f59('0x32')]);_0x4cdc23[_0x1f59('0x33')]=_['intersection'](_0x1604dc[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x34')]));_0x4cdc23[_0x1f59('0x33')]=_0x4cdc23[_0x1f59('0x33')][_0x1f59('0x35')]?_0x4cdc23[_0x1f59('0x33')]:_0x1604dc[_0x1f59('0x2d')];if(!_0x56f778[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x4cdc23[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x19')]);_0x4cdc23[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x56f778['query'][_0x1f59('0x1b')]);}_0x4cdc23[_0x1f59('0x38')]=qs[_0x1f59('0x39')](_0x56f778[_0x1f59('0x32')][_0x1f59('0x39')]);_0x4cdc23[_0x1f59('0x3a')]=qs[_0x1f59('0x30')](_['pick'](_0x56f778[_0x1f59('0x32')],_0x1604dc[_0x1f59('0x30')]),_0x36fd78);if(_0x56f778[_0x1f59('0x32')]['filter']){_0x4cdc23[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x4cdc23[_0x1f59('0x3a')],{'$or':_['map'](_0x36fd78,function(_0x356cd4){if(_0x356cd4[_0x1f59('0x2b')]!==_0x1f59('0x3c')){var _0x28df18={};_0x28df18[_0x356cd4['name']]={'$like':'%'+_0x56f778['query'][_0x1f59('0x3d')]+'%'};return _0x28df18;}})});}_0x4cdc23=_[_0x1f59('0x3b')]({},_0x4cdc23,_0x56f778[_0x1f59('0x3e')]);var _0x9cc3f1={'where':_0x4cdc23[_0x1f59('0x3a')]};return db[_0x1f59('0x28')][_0x1f59('0x1a')](_0x9cc3f1)[_0x1f59('0x21')](function(_0xe9cf98){_0x433a81['count']=_0xe9cf98;if(_0x56f778[_0x1f59('0x32')]['includeAll']){_0x4cdc23['include']=[{'all':!![]}];}return db[_0x1f59('0x28')][_0x1f59('0x3f')](_0x4cdc23);})['then'](function(_0x5839c1){_0x433a81[_0x1f59('0x40')]=_0x5839c1;return _0x433a81;})['then'](respondWithFilteredResult(_0x296642,_0x4cdc23))[_0x1f59('0x41')](handleError(_0x296642,null));};exports[_0x1f59('0x42')]=function(_0x10913f,_0x52a004){var _0x3db0cd={'raw':![],'where':{'id':_0x10913f[_0x1f59('0x43')]['id']}},_0x2b538e={};_0x2b538e[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db['VtigerConfiguration'][_0x1f59('0x29')]);_0x2b538e[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x10913f['query']);_0x2b538e[_0x1f59('0x30')]=_[_0x1f59('0x31')](_0x2b538e[_0x1f59('0x2d')],_0x2b538e[_0x1f59('0x32')]);_0x3db0cd['attributes']=_[_0x1f59('0x31')](_0x2b538e['model'],qs[_0x1f59('0x34')](_0x10913f[_0x1f59('0x32')]['fields']));_0x3db0cd[_0x1f59('0x33')]=_0x3db0cd[_0x1f59('0x33')][_0x1f59('0x35')]?_0x3db0cd[_0x1f59('0x33')]:_0x2b538e[_0x1f59('0x2d')];if(_0x10913f[_0x1f59('0x32')][_0x1f59('0x44')]){_0x3db0cd[_0x1f59('0x45')]=[{'all':!![]}];}_0x3db0cd=_['merge']({},_0x3db0cd,_0x10913f[_0x1f59('0x3e')]);return db[_0x1f59('0x28')][_0x1f59('0x46')](_0x3db0cd)[_0x1f59('0x21')](handleEntityNotFound(_0x52a004,null))[_0x1f59('0x21')](respondWithResult(_0x52a004,null))[_0x1f59('0x41')](handleError(_0x52a004,null));};exports[_0x1f59('0x47')]=function(_0x1f3e5e,_0x5074cf){return db[_0x1f59('0x28')][_0x1f59('0x47')](_0x1f3e5e[_0x1f59('0x48')],{})['then'](respondWithResult(_0x5074cf,0xc9))[_0x1f59('0x41')](handleError(_0x5074cf,null));};exports['update']=function(_0x1bbae3,_0x55eb38){if(_0x1bbae3[_0x1f59('0x48')]['id']){delete _0x1bbae3['body']['id'];}return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x1bbae3[_0x1f59('0x43')]['id']}})['then'](handleEntityNotFound(_0x55eb38,null))[_0x1f59('0x21')](saveUpdates(_0x1bbae3['body'],null))[_0x1f59('0x21')](respondWithResult(_0x55eb38,null))[_0x1f59('0x41')](handleError(_0x55eb38,null));};exports[_0x1f59('0x22')]=function(_0x39bb95,_0x3f3d9d){return db['VtigerConfiguration'][_0x1f59('0x46')]({'where':{'id':_0x39bb95['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x3f3d9d,null))[_0x1f59('0x21')](removeEntity(_0x3f3d9d,null))[_0x1f59('0x41')](handleError(_0x3f3d9d,null));};exports[_0x1f59('0x49')]=function(_0x2d0b21,_0xa50352,_0x5f36d0){var _0x459a5f={};var _0x3c3068={};var _0x51147f;var _0x5b757a;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0x2d0b21['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0xa50352,null))[_0x1f59('0x21')](function(_0x2430eb){if(_0x2430eb){_0x51147f=_0x2430eb;_0x3c3068[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x3c3068[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x2d0b21[_0x1f59('0x32')]);_0x3c3068['filters']=_[_0x1f59('0x31')](_0x3c3068[_0x1f59('0x2d')],_0x3c3068['query']);_0x459a5f[_0x1f59('0x33')]=_[_0x1f59('0x31')](_0x3c3068['model'],qs['fields'](_0x2d0b21['query']['fields']));_0x459a5f[_0x1f59('0x33')]=_0x459a5f[_0x1f59('0x33')][_0x1f59('0x35')]?_0x459a5f['attributes']:_0x3c3068[_0x1f59('0x2d')];_0x459a5f['order']=qs[_0x1f59('0x39')](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x39')]);_0x459a5f['where']=qs['filters'](_[_0x1f59('0x4c')](_0x2d0b21[_0x1f59('0x32')],_0x3c3068[_0x1f59('0x30')]));if(_0x2d0b21['query'][_0x1f59('0x3d')]){_0x459a5f[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x459a5f[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x459a5f[_0x1f59('0x33')],function(_0x218a36){var _0x3fd418={};_0x3fd418[_0x218a36]={'$like':'%'+_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x3fd418;})});}_0x459a5f=_[_0x1f59('0x3b')]({},_0x459a5f,_0x2d0b21[_0x1f59('0x3e')]);return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})['then'](function(_0x3fc86f){if(_0x3fc86f){_0x5b757a=_0x3fc86f[_0x1f59('0x35')];if(!_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x459a5f[_0x1f59('0x19')]=qs['limit'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x19')]);_0x459a5f[_0x1f59('0x1b')]=qs['offset'](_0x2d0b21[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x51147f[_0x1f59('0x49')](_0x459a5f);}})[_0x1f59('0x21')](function(_0x4b7844){if(_0x4b7844){return _0x4b7844?{'count':_0x5b757a,'rows':_0x4b7844}:null;}})[_0x1f59('0x21')](respondWithResult(_0xa50352,null))[_0x1f59('0x41')](handleError(_0xa50352,null));};exports[_0x1f59('0x4d')]=function(_0xc483ec,_0x51389e,_0x127c3d){var _0x3a2b0a={};var _0x2d6636={};var _0xaeae17;var _0x107a82;return db[_0x1f59('0x28')][_0x1f59('0x4a')]({'where':{'id':_0xc483ec[_0x1f59('0x43')]['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x51389e,null))['then'](function(_0x5aea4d){if(_0x5aea4d){_0xaeae17=_0x5aea4d;_0x2d6636['model']=_[_0x1f59('0x2f')](db['VtigerField']['rawAttributes']);_0x2d6636[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0xc483ec[_0x1f59('0x32')]);_0x2d6636['filters']=_['intersection'](_0x2d6636[_0x1f59('0x2d')],_0x2d6636[_0x1f59('0x32')]);_0x3a2b0a['attributes']=_[_0x1f59('0x31')](_0x2d6636[_0x1f59('0x2d')],qs[_0x1f59('0x34')](_0xc483ec[_0x1f59('0x32')]['fields']));_0x3a2b0a[_0x1f59('0x33')]=_0x3a2b0a['attributes'][_0x1f59('0x35')]?_0x3a2b0a['attributes']:_0x2d6636[_0x1f59('0x2d')];_0x3a2b0a[_0x1f59('0x38')]=qs['sort'](_0xc483ec[_0x1f59('0x32')][_0x1f59('0x39')]);_0x3a2b0a[_0x1f59('0x3a')]=qs['filters'](_[_0x1f59('0x4c')](_0xc483ec['query'],_0x2d6636[_0x1f59('0x30')]));if(_0xc483ec['query']['filter']){_0x3a2b0a[_0x1f59('0x3a')]=_[_0x1f59('0x3b')](_0x3a2b0a[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x3a2b0a[_0x1f59('0x33')],function(_0x181689){var _0x266c2d={};_0x266c2d[_0x181689]={'$like':'%'+_0xc483ec[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x266c2d;})});}_0x3a2b0a=_['merge']({},_0x3a2b0a,_0xc483ec[_0x1f59('0x3e')]);return _0xaeae17[_0x1f59('0x4d')](_0x3a2b0a);}})['then'](function(_0x3f69e4){if(_0x3f69e4){_0x107a82=_0x3f69e4[_0x1f59('0x35')];if(!_0xc483ec['query']['hasOwnProperty']('nolimit')){_0x3a2b0a[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0xc483ec[_0x1f59('0x32')]['limit']);_0x3a2b0a['offset']=qs['offset'](_0xc483ec[_0x1f59('0x32')]['offset']);}return _0xaeae17['getSubjects'](_0x3a2b0a);}})[_0x1f59('0x21')](function(_0x43d788){if(_0x43d788){return _0x43d788?{'count':_0x107a82,'rows':_0x43d788}:null;}})[_0x1f59('0x21')](respondWithResult(_0x51389e,null))[_0x1f59('0x41')](handleError(_0x51389e,null));};exports['getDescriptions']=function(_0x4c32e8,_0x19c7c6,_0x53f9b6){var _0x35d58e={};var _0x1858a3={};var _0x576e34;var _0x2cf653;return db[_0x1f59('0x28')]['findOne']({'where':{'id':_0x4c32e8['params']['id']}})[_0x1f59('0x21')](handleEntityNotFound(_0x19c7c6,null))['then'](function(_0x1bfff0){if(_0x1bfff0){_0x576e34=_0x1bfff0;_0x1858a3[_0x1f59('0x2d')]=_[_0x1f59('0x2f')](db[_0x1f59('0x4b')][_0x1f59('0x29')]);_0x1858a3[_0x1f59('0x32')]=_[_0x1f59('0x2f')](_0x4c32e8[_0x1f59('0x32')]);_0x1858a3['filters']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],_0x1858a3[_0x1f59('0x32')]);_0x35d58e['attributes']=_[_0x1f59('0x31')](_0x1858a3[_0x1f59('0x2d')],qs['fields'](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x34')]));_0x35d58e[_0x1f59('0x33')]=_0x35d58e[_0x1f59('0x33')]['length']?_0x35d58e[_0x1f59('0x33')]:_0x1858a3[_0x1f59('0x2d')];_0x35d58e['order']=qs[_0x1f59('0x39')](_0x4c32e8['query'][_0x1f59('0x39')]);_0x35d58e['where']=qs[_0x1f59('0x30')](_[_0x1f59('0x4c')](_0x4c32e8['query'],_0x1858a3[_0x1f59('0x30')]));if(_0x4c32e8['query']['filter']){_0x35d58e['where']=_['merge'](_0x35d58e[_0x1f59('0x3a')],{'$or':_[_0x1f59('0x2e')](_0x35d58e[_0x1f59('0x33')],function(_0x1c1f09){var _0x4f6858={};_0x4f6858[_0x1c1f09]={'$like':'%'+_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x3d')]+'%'};return _0x4f6858;})});}_0x35d58e=_[_0x1f59('0x3b')]({},_0x35d58e,_0x4c32e8[_0x1f59('0x3e')]);return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x4c1684){if(_0x4c1684){_0x2cf653=_0x4c1684['length'];if(!_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x36')](_0x1f59('0x37'))){_0x35d58e[_0x1f59('0x19')]=qs[_0x1f59('0x19')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x19')]);_0x35d58e[_0x1f59('0x1b')]=qs[_0x1f59('0x1b')](_0x4c32e8[_0x1f59('0x32')][_0x1f59('0x1b')]);}return _0x576e34[_0x1f59('0x4e')](_0x35d58e);}})[_0x1f59('0x21')](function(_0x494792){if(_0x494792){return _0x494792?{'count':_0x2cf653,'rows':_0x494792}:null;}})[_0x1f59('0x21')](respondWithResult(_0x19c7c6,null))[_0x1f59('0x41')](handleError(_0x19c7c6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 403cb49..fc0c8ce 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 _0xa0f5=['./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x12b830,_0xd66540){var _0x261dc4=function(_0x57037a){while(--_0x57037a){_0x12b830['push'](_0x12b830['shift']());}};_0x261dc4(++_0xd66540);}(_0xa0f5,0x71));var _0x5a0f=function(_0x41ca7f,_0x29968a){_0x41ca7f=_0x41ca7f-0x0;var _0x4bfd63=_0xa0f5[_0x41ca7f];return _0x4bfd63;};'use strict';var _=require(_0x5a0f('0x0'));var util=require(_0x5a0f('0x1'));var logger=require(_0x5a0f('0x2'))(_0x5a0f('0x3'));var moment=require('moment');var BPromise=require(_0x5a0f('0x4'));var rp=require(_0x5a0f('0x5'));var fs=require('fs');var path=require(_0x5a0f('0x6'));var rimraf=require('rimraf');var config=require(_0x5a0f('0x7'));var attributes=require(_0x5a0f('0x8'));module['exports']=function(_0x312e09,_0x65f41d){return _0x312e09['define'](_0x5a0f('0x9'),attributes,{'tableName':_0x5a0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4df2=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x4df2,0x16d));var _0x24df=function(_0x1e392d,_0x507e78){_0x1e392d=_0x1e392d-0x0;var _0x59c9fc=_0x4df2[_0x1e392d];return _0x59c9fc;};'use strict';var _=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var logger=require(_0x24df('0x2'))(_0x24df('0x3'));var moment=require(_0x24df('0x4'));var BPromise=require(_0x24df('0x5'));var rp=require(_0x24df('0x6'));var fs=require('fs');var path=require(_0x24df('0x7'));var rimraf=require('rimraf');var config=require(_0x24df('0x8'));var attributes=require(_0x24df('0x9'));module['exports']=function(_0x3b25f6,_0x536bca){return _0x3b25f6[_0x24df('0xa')](_0x24df('0xb'),attributes,{'tableName':_0x24df('0xc'),'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 2c4bb9d..f3077dc 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 _0x553f=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x354618,_0x1308f9){var _0x4f6396=function(_0x5efbe4){while(--_0x5efbe4){_0x354618['push'](_0x354618['shift']());}};_0x4f6396(++_0x1308f9);}(_0x553f,0xf3));var _0xf553=function(_0x38f6dc,_0x39226e){_0x38f6dc=_0x38f6dc-0x0;var _0x226717=_0x553f[_0x38f6dc];return _0x226717;};'use strict';var _=require(_0xf553('0x0'));var util=require('util');var moment=require(_0xf553('0x1'));var BPromise=require('bluebird');var rs=require(_0xf553('0x2'));var fs=require('fs');var Redis=require(_0xf553('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf553('0x4'));var logger=require(_0xf553('0x5'))(_0xf553('0x6'));var config=require(_0xf553('0x7'));var jayson=require(_0xf553('0x8'));var client=jayson[_0xf553('0x9')][_0xf553('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf5a05f,_0x1f6d08,_0x40daa4){return new BPromise(function(_0x21caae,_0x562d38){return client[_0xf553('0xb')](_0xf5a05f,_0x40daa4)[_0xf553('0xc')](function(_0x3fcf7e){logger[_0xf553('0xd')](_0xf553('0xe'),_0x1f6d08,_0xf553('0xf'));logger[_0xf553('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1f6d08,_0xf553('0xf'),JSON[_0xf553('0x11')](_0x3fcf7e));if(_0x3fcf7e[_0xf553('0x12')]){if(_0x3fcf7e[_0xf553('0x12')][_0xf553('0x13')]===0x1f4){logger[_0xf553('0x12')](_0xf553('0xe'),_0x1f6d08,_0x3fcf7e[_0xf553('0x12')][_0xf553('0x14')]);return _0x562d38(_0x3fcf7e['error'][_0xf553('0x14')]);}logger[_0xf553('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f6d08,_0x3fcf7e[_0xf553('0x12')][_0xf553('0x14')]);return _0x21caae(_0x3fcf7e[_0xf553('0x12')][_0xf553('0x14')]);}else{logger[_0xf553('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f6d08,_0xf553('0xf'));_0x21caae(_0x3fcf7e[_0xf553('0x15')][_0xf553('0x14')]);}})[_0xf553('0x16')](function(_0x3269d6){logger['error'](_0xf553('0xe'),_0x1f6d08,_0x3269d6);_0x562d38(_0x3269d6);});});} \ No newline at end of file +var _0x7a1c=['../../config/environment','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0x7a1c,0x1f2));var _0xc7a1=function(_0xcccf9c,_0x24bb08){_0xcccf9c=_0xcccf9c-0x0;var _0x205b75=_0x7a1c[_0xcccf9c];return _0x205b75;};'use strict';var _=require(_0xc7a1('0x0'));var util=require(_0xc7a1('0x1'));var moment=require('moment');var BPromise=require(_0xc7a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7a1('0x3'));var db=require(_0xc7a1('0x4'))['db'];var utils=require(_0xc7a1('0x5'));var logger=require(_0xc7a1('0x6'))(_0xc7a1('0x7'));var config=require(_0xc7a1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7a1('0x9')][_0xc7a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c926b,_0x351849,_0x76b3f1){return new BPromise(function(_0x44245c,_0x171d2b){return client[_0xc7a1('0xb')](_0x1c926b,_0x76b3f1)['then'](function(_0xfa43fa){logger[_0xc7a1('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x351849,_0xc7a1('0xd'));logger[_0xc7a1('0xe')](_0xc7a1('0xf'),_0x351849,_0xc7a1('0xd'),JSON[_0xc7a1('0x10')](_0xfa43fa));if(_0xfa43fa[_0xc7a1('0x11')]){if(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x12')]===0x1f4){logger[_0xc7a1('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x351849,_0xfa43fa['error']['message']);return _0x171d2b(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);}logger[_0xc7a1('0x11')](_0xc7a1('0x14'),_0x351849,_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);return _0x44245c(_0xfa43fa[_0xc7a1('0x11')][_0xc7a1('0x13')]);}else{logger[_0xc7a1('0xc')](_0xc7a1('0x14'),_0x351849,_0xc7a1('0xd'));_0x44245c(_0xfa43fa[_0xc7a1('0x15')][_0xc7a1('0x13')]);}})[_0xc7a1('0x16')](function(_0x4db244){logger[_0xc7a1('0x11')](_0xc7a1('0x14'),_0x351849,_0x4db244);_0x171d2b(_0x4db244);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fcd1509..18686a0 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 _0x2e83=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e83,0x172));var _0x32e8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2e83[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x32e8('0x0'));var util=require(_0x32e8('0x1'));var path=require(_0x32e8('0x2'));var timeout=require(_0x32e8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x32e8('0x4'));var auth=require(_0x32e8('0x5'));var interaction=require(_0x32e8('0x6'));var config=require(_0x32e8('0x7'));var controller=require(_0x32e8('0x8'));router[_0x32e8('0x9')]('/',auth[_0x32e8('0xa')](),controller[_0x32e8('0xb')]);router['get'](_0x32e8('0xc'),auth['isAuthenticated'](),controller[_0x32e8('0xd')]);router['post']('/',auth[_0x32e8('0xa')](),controller[_0x32e8('0xe')]);router[_0x32e8('0xf')](_0x32e8('0xc'),auth['isAuthenticated'](),controller[_0x32e8('0x10')]);router[_0x32e8('0x11')](_0x32e8('0xc'),auth[_0x32e8('0xa')](),controller['destroy']);module[_0x32e8('0x12')]=router; \ No newline at end of file +var _0x87a7=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x47761d,_0x3f8494){var _0x3d1c05=function(_0x3571da){while(--_0x3571da){_0x47761d['push'](_0x47761d['shift']());}};_0x3d1c05(++_0x3f8494);}(_0x87a7,0x1b5));var _0x787a=function(_0x3b3931,_0x2aa0c1){_0x3b3931=_0x3b3931-0x0;var _0x9747e0=_0x87a7[_0x3b3931];return _0x9747e0;};'use strict';var multer=require(_0x787a('0x0'));var util=require('util');var path=require(_0x787a('0x1'));var timeout=require('connect-timeout');var express=require(_0x787a('0x2'));var router=express['Router']();var fs_extra=require(_0x787a('0x3'));var auth=require(_0x787a('0x4'));var interaction=require(_0x787a('0x5'));var config=require(_0x787a('0x6'));var controller=require(_0x787a('0x7'));router[_0x787a('0x8')]('/',auth[_0x787a('0x9')](),controller[_0x787a('0xa')]);router[_0x787a('0x8')](_0x787a('0xb'),auth[_0x787a('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x787a('0xc')]);router[_0x787a('0xd')]('/:id',auth[_0x787a('0x9')](),controller[_0x787a('0xe')]);router[_0x787a('0xf')](_0x787a('0xb'),auth[_0x787a('0x9')](),controller['destroy']);module[_0x787a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d72c5cd..4f4a45e 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 _0x403d=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x5c9a0e,_0x47c8fe){var _0x56a399=function(_0x316c7a){while(--_0x316c7a){_0x5c9a0e['push'](_0x5c9a0e['shift']());}};_0x56a399(++_0x47c8fe);}(_0x403d,0x83));var _0xd403=function(_0x2a600b,_0x26ce40){_0x2a600b=_0x2a600b-0x0;var _0x5ac763=_0x403d[_0x2a600b];return _0x5ac763;};'use strict';var Sequelize=require(_0xd403('0x0'));module['exports']={'type':{'type':Sequelize[_0xd403('0x1')]('string',_0xd403('0x2'),_0xd403('0x3'),_0xd403('0x4'),_0xd403('0x5')),'defaultValue':_0xd403('0x6')},'content':{'type':Sequelize[_0xd403('0x7')]},'key':{'type':Sequelize[_0xd403('0x7')]},'keyType':{'type':Sequelize[_0xd403('0x1')](_0xd403('0x6'),_0xd403('0x2'),_0xd403('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd403('0x7')]},'customField':{'type':Sequelize[_0xd403('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb1bb=['sequelize','exports','customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x500dc0,_0x58b0d6){var _0x5ec0aa=function(_0x17ecfc){while(--_0x17ecfc){_0x500dc0['push'](_0x500dc0['shift']());}};_0x5ec0aa(++_0x58b0d6);}(_0xb1bb,0xe8));var _0xbb1b=function(_0x3fa29a,_0x218173){_0x3fa29a=_0x3fa29a-0x0;var _0x4486d8=_0xb1bb[_0x3fa29a];return _0x4486d8;};'use strict';var Sequelize=require(_0xbb1b('0x0'));module[_0xbb1b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xbb1b('0x2'),_0xbb1b('0x3'),'picklist'),'defaultValue':_0xbb1b('0x4')},'content':{'type':Sequelize[_0xbb1b('0x5')]},'key':{'type':Sequelize[_0xbb1b('0x5')]},'keyType':{'type':Sequelize[_0xbb1b('0x6')](_0xbb1b('0x4'),'variable',_0xbb1b('0x2'))},'keyContent':{'type':Sequelize[_0xbb1b('0x5')]},'idField':{'type':Sequelize[_0xbb1b('0x5')]},'nameField':{'type':Sequelize[_0xbb1b('0x5')]},'customField':{'type':Sequelize[_0xbb1b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb1b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6f4d16c..0654dbb 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 _0x7430=['count','set','Content-Range','apply','save','update','then','destroy','error','name','index','VtigerField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','catch','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0xc0c331,_0x28405d){var _0x473b8f=function(_0x123682){while(--_0x123682){_0xc0c331['push'](_0xc0c331['shift']());}};_0x473b8f(++_0x28405d);}(_0x7430,0xfb));var _0x0743=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7430[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x0743('0x0'));var rimraf=require(_0x0743('0x1'));var zipdir=require(_0x0743('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0743('0x3'));var moment=require('moment');var BPromise=require(_0x0743('0x4'));var Mustache=require(_0x0743('0x5'));var util=require('util');var path=require(_0x0743('0x6'));var sox=require(_0x0743('0x7'));var csv=require(_0x0743('0x8'));var ejs=require(_0x0743('0x9'));var fs=require('fs');var fs_extra=require(_0x0743('0xa'));var _=require('lodash');var squel=require(_0x0743('0xb'));var crypto=require(_0x0743('0xc'));var jsforce=require(_0x0743('0xd'));var deskjs=require(_0x0743('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0743('0xf'));var Redis=require('ioredis');var authService=require(_0x0743('0x10'));var qs=require(_0x0743('0x11'));var as=require(_0x0743('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0743('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0743('0x14'));var licenseUtil=require(_0x0743('0x15'));var db=require(_0x0743('0x16'))['db'];function respondWithStatusCode(_0x4688eb,_0x4d4fcc){_0x4d4fcc=_0x4d4fcc||0xcc;return function(_0x458f47){if(_0x458f47){return _0x4688eb[_0x0743('0x17')](_0x4d4fcc);}return _0x4688eb['status'](_0x4d4fcc)['end']();};}function respondWithResult(_0x2e39cd,_0x1d0158){_0x1d0158=_0x1d0158||0xc8;return function(_0x36a1c5){if(_0x36a1c5){return _0x2e39cd[_0x0743('0x18')](_0x1d0158)[_0x0743('0x19')](_0x36a1c5);}};}function respondWithFilteredResult(_0x5911d4,_0x4427b1){return function(_0xdadccb){if(_0xdadccb){var _0x17850c=typeof _0x4427b1[_0x0743('0x1a')]===_0x0743('0x1b')&&typeof _0x4427b1[_0x0743('0x1c')]===_0x0743('0x1b');var _0x2e87bc=_0xdadccb[_0x0743('0x1d')];var _0x22c4f5=_0x17850c?0x0:_0x4427b1[_0x0743('0x1a')];var _0x581241=_0x17850c?_0xdadccb[_0x0743('0x1d')]:_0x4427b1[_0x0743('0x1a')]+_0x4427b1['limit'];var _0xf91a2c;if(_0x581241>=_0x2e87bc){_0x581241=_0x2e87bc;_0xf91a2c=0xc8;}else{_0xf91a2c=0xce;}_0x5911d4[_0x0743('0x18')](_0xf91a2c);return _0x5911d4[_0x0743('0x1e')](_0x0743('0x1f'),_0x22c4f5+'-'+_0x581241+'/'+_0x2e87bc)['json'](_0xdadccb);}return null;};}function patchUpdates(_0x3fc22a){return function(_0x5ed9d6){try{jsonpatch[_0x0743('0x20')](_0x5ed9d6,_0x3fc22a,!![]);}catch(_0x21b6b3){return BPromise['reject'](_0x21b6b3);}return _0x5ed9d6[_0x0743('0x21')]();};}function saveUpdates(_0x508b39,_0x38f332){return function(_0x144d7c){if(_0x144d7c){return _0x144d7c[_0x0743('0x22')](_0x508b39)[_0x0743('0x23')](function(_0x35a390){return _0x35a390;});}return null;};}function removeEntity(_0x7afaee,_0x4fcbcc){return function(_0x3b9257){if(_0x3b9257){return _0x3b9257[_0x0743('0x24')]()[_0x0743('0x23')](function(){_0x7afaee[_0x0743('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x400300,_0x531b1a){return function(_0x105a3b){if(!_0x105a3b){_0x400300[_0x0743('0x17')](0x194);}return _0x105a3b;};}function handleError(_0xc2971a,_0x5e92de){_0x5e92de=_0x5e92de||0x1f4;return function(_0x321209){logger[_0x0743('0x25')](_0x321209['stack']);if(_0x321209[_0x0743('0x26')]){delete _0x321209[_0x0743('0x26')];}_0xc2971a[_0x0743('0x18')](_0x5e92de)['send'](_0x321209);};}exports[_0x0743('0x27')]=function(_0x2c39d6,_0x494b85){var _0x2d58b1={},_0x248347={},_0x3bdc94={'count':0x0,'rows':[]};var _0x1012a3=_['map'](db[_0x0743('0x28')][_0x0743('0x29')],function(_0x22adb0){return{'name':_0x22adb0['fieldName'],'type':_0x22adb0[_0x0743('0x2a')][_0x0743('0x2b')]};});_0x248347[_0x0743('0x2c')]=_[_0x0743('0x2d')](_0x1012a3,_0x0743('0x26'));_0x248347[_0x0743('0x2e')]=_[_0x0743('0x2f')](_0x2c39d6[_0x0743('0x2e')]);_0x248347[_0x0743('0x30')]=_[_0x0743('0x31')](_0x248347['model'],_0x248347['query']);_0x2d58b1[_0x0743('0x32')]=_[_0x0743('0x31')](_0x248347['model'],qs[_0x0743('0x33')](_0x2c39d6['query']['fields']));_0x2d58b1['attributes']=_0x2d58b1[_0x0743('0x32')]['length']?_0x2d58b1[_0x0743('0x32')]:_0x248347[_0x0743('0x2c')];if(!_0x2c39d6[_0x0743('0x2e')][_0x0743('0x34')](_0x0743('0x35'))){_0x2d58b1[_0x0743('0x1c')]=qs['limit'](_0x2c39d6[_0x0743('0x2e')][_0x0743('0x1c')]);_0x2d58b1[_0x0743('0x1a')]=qs[_0x0743('0x1a')](_0x2c39d6[_0x0743('0x2e')][_0x0743('0x1a')]);}_0x2d58b1[_0x0743('0x36')]=qs['sort'](_0x2c39d6['query'][_0x0743('0x37')]);_0x2d58b1[_0x0743('0x38')]=qs[_0x0743('0x30')](_[_0x0743('0x39')](_0x2c39d6[_0x0743('0x2e')],_0x248347[_0x0743('0x30')]),_0x1012a3);if(_0x2c39d6['query'][_0x0743('0x3a')]){_0x2d58b1['where']=_[_0x0743('0x3b')](_0x2d58b1[_0x0743('0x38')],{'$or':_[_0x0743('0x2d')](_0x1012a3,function(_0x4590f6){if(_0x4590f6['type']!=='VIRTUAL'){var _0x1288fb={};_0x1288fb[_0x4590f6[_0x0743('0x26')]]={'$like':'%'+_0x2c39d6['query'][_0x0743('0x3a')]+'%'};return _0x1288fb;}})});}_0x2d58b1=_[_0x0743('0x3b')]({},_0x2d58b1,_0x2c39d6['options']);var _0x297398={'where':_0x2d58b1['where']};return db[_0x0743('0x28')][_0x0743('0x1d')](_0x297398)[_0x0743('0x23')](function(_0x26fc4f){_0x3bdc94[_0x0743('0x1d')]=_0x26fc4f;if(_0x2c39d6[_0x0743('0x2e')]['includeAll']){_0x2d58b1['include']=[{'all':!![]}];}return db[_0x0743('0x28')][_0x0743('0x3c')](_0x2d58b1);})[_0x0743('0x23')](function(_0x12b31d){_0x3bdc94[_0x0743('0x3d')]=_0x12b31d;return _0x3bdc94;})[_0x0743('0x23')](respondWithFilteredResult(_0x494b85,_0x2d58b1))[_0x0743('0x3e')](handleError(_0x494b85,null));};exports['show']=function(_0x52e4a8,_0x567dbf){var _0x3f3ae3={'raw':!![],'where':{'id':_0x52e4a8[_0x0743('0x3f')]['id']}},_0x5602f8={};_0x5602f8[_0x0743('0x2c')]=_[_0x0743('0x2f')](db[_0x0743('0x28')]['rawAttributes']);_0x5602f8['query']=_[_0x0743('0x2f')](_0x52e4a8['query']);_0x5602f8[_0x0743('0x30')]=_[_0x0743('0x31')](_0x5602f8['model'],_0x5602f8['query']);_0x3f3ae3[_0x0743('0x32')]=_[_0x0743('0x31')](_0x5602f8[_0x0743('0x2c')],qs['fields'](_0x52e4a8['query']['fields']));_0x3f3ae3[_0x0743('0x32')]=_0x3f3ae3[_0x0743('0x32')]['length']?_0x3f3ae3[_0x0743('0x32')]:_0x5602f8['model'];if(_0x52e4a8[_0x0743('0x2e')][_0x0743('0x40')]){_0x3f3ae3[_0x0743('0x41')]=[{'all':!![]}];}_0x3f3ae3=_[_0x0743('0x3b')]({},_0x3f3ae3,_0x52e4a8[_0x0743('0x42')]);return db['VtigerField'][_0x0743('0x43')](_0x3f3ae3)[_0x0743('0x23')](handleEntityNotFound(_0x567dbf,null))[_0x0743('0x23')](respondWithResult(_0x567dbf,null))[_0x0743('0x3e')](handleError(_0x567dbf,null));};exports[_0x0743('0x44')]=function(_0x14d31a,_0x41ca6b){return db[_0x0743('0x28')][_0x0743('0x44')](_0x14d31a[_0x0743('0x45')],{})[_0x0743('0x23')](respondWithResult(_0x41ca6b,0xc9))[_0x0743('0x3e')](handleError(_0x41ca6b,null));};exports[_0x0743('0x22')]=function(_0xbb2ee0,_0x15ac98){if(_0xbb2ee0[_0x0743('0x45')]['id']){delete _0xbb2ee0[_0x0743('0x45')]['id'];}return db[_0x0743('0x28')][_0x0743('0x43')]({'where':{'id':_0xbb2ee0[_0x0743('0x3f')]['id']}})[_0x0743('0x23')](handleEntityNotFound(_0x15ac98,null))['then'](saveUpdates(_0xbb2ee0['body'],null))['then'](respondWithResult(_0x15ac98,null))['catch'](handleError(_0x15ac98,null));};exports['destroy']=function(_0xf41b9,_0x37ca58){return db[_0x0743('0x28')]['find']({'where':{'id':_0xf41b9['params']['id']}})['then'](handleEntityNotFound(_0x37ca58,null))[_0x0743('0x23')](removeEntity(_0x37ca58,null))[_0x0743('0x3e')](handleError(_0x37ca58,null));}; \ No newline at end of file +var _0xf379=['lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','index','VtigerField','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','catch','create','update','body','find','destroy','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs'];(function(_0x1b6cf9,_0x4147a8){var _0x15d75b=function(_0x1f8fe8){while(--_0x1f8fe8){_0x1b6cf9['push'](_0x1b6cf9['shift']());}};_0x15d75b(++_0x4147a8);}(_0xf379,0x15f));var _0x9f37=function(_0x59c360,_0x59ee43){_0x59c360=_0x59c360-0x0;var _0x32cf82=_0xf379[_0x59c360];return _0x32cf82;};'use strict';var emlformat=require(_0x9f37('0x0'));var rimraf=require(_0x9f37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f37('0x2'));var moment=require('moment');var BPromise=require(_0x9f37('0x3'));var Mustache=require('mustache');var util=require(_0x9f37('0x4'));var path=require(_0x9f37('0x5'));var sox=require(_0x9f37('0x6'));var csv=require(_0x9f37('0x7'));var ejs=require(_0x9f37('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f37('0x9'));var squel=require('squel');var crypto=require(_0x9f37('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f37('0x7'));var querystring=require(_0x9f37('0xb'));var Papa=require(_0x9f37('0xc'));var Redis=require(_0x9f37('0xd'));var authService=require(_0x9f37('0xe'));var qs=require(_0x9f37('0xf'));var as=require(_0x9f37('0x10'));var hardwareService=require(_0x9f37('0x11'));var logger=require(_0x9f37('0x12'))(_0x9f37('0x13'));var utils=require(_0x9f37('0x14'));var config=require(_0x9f37('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f37('0x16'))['db'];function respondWithStatusCode(_0x4d7cb3,_0x23ad43){_0x23ad43=_0x23ad43||0xcc;return function(_0x5acd4c){if(_0x5acd4c){return _0x4d7cb3['sendStatus'](_0x23ad43);}return _0x4d7cb3[_0x9f37('0x17')](_0x23ad43)[_0x9f37('0x18')]();};}function respondWithResult(_0x32cc3c,_0x248f00){_0x248f00=_0x248f00||0xc8;return function(_0x5b1ed6){if(_0x5b1ed6){return _0x32cc3c[_0x9f37('0x17')](_0x248f00)['json'](_0x5b1ed6);}};}function respondWithFilteredResult(_0xbe038e,_0x33dfda){return function(_0x2fe3c0){if(_0x2fe3c0){var _0x1049d8=typeof _0x33dfda[_0x9f37('0x19')]===_0x9f37('0x1a')&&typeof _0x33dfda[_0x9f37('0x1b')]===_0x9f37('0x1a');var _0x2748e0=_0x2fe3c0[_0x9f37('0x1c')];var _0x3a095a=_0x1049d8?0x0:_0x33dfda[_0x9f37('0x19')];var _0x193532=_0x1049d8?_0x2fe3c0[_0x9f37('0x1c')]:_0x33dfda[_0x9f37('0x19')]+_0x33dfda[_0x9f37('0x1b')];var _0x59f9d6;if(_0x193532>=_0x2748e0){_0x193532=_0x2748e0;_0x59f9d6=0xc8;}else{_0x59f9d6=0xce;}_0xbe038e['status'](_0x59f9d6);return _0xbe038e[_0x9f37('0x1d')](_0x9f37('0x1e'),_0x3a095a+'-'+_0x193532+'/'+_0x2748e0)[_0x9f37('0x1f')](_0x2fe3c0);}return null;};}function patchUpdates(_0x5035cd){return function(_0x2f641a){try{jsonpatch[_0x9f37('0x20')](_0x2f641a,_0x5035cd,!![]);}catch(_0x45cc47){return BPromise['reject'](_0x45cc47);}return _0x2f641a[_0x9f37('0x21')]();};}function saveUpdates(_0x8d1018,_0xdeee78){return function(_0x3a3c34){if(_0x3a3c34){return _0x3a3c34['update'](_0x8d1018)[_0x9f37('0x22')](function(_0x25bb1e){return _0x25bb1e;});}return null;};}function removeEntity(_0x48d5b9,_0x2da328){return function(_0x160383){if(_0x160383){return _0x160383['destroy']()['then'](function(){_0x48d5b9[_0x9f37('0x17')](0xcc)[_0x9f37('0x18')]();});}};}function handleEntityNotFound(_0x25478c,_0x216873){return function(_0x5115c8){if(!_0x5115c8){_0x25478c[_0x9f37('0x23')](0x194);}return _0x5115c8;};}function handleError(_0xeb2de6,_0x2ac20e){_0x2ac20e=_0x2ac20e||0x1f4;return function(_0x5c5ff5){logger[_0x9f37('0x24')](_0x5c5ff5[_0x9f37('0x25')]);if(_0x5c5ff5['name']){delete _0x5c5ff5[_0x9f37('0x26')];}_0xeb2de6['status'](_0x2ac20e)[_0x9f37('0x27')](_0x5c5ff5);};}exports[_0x9f37('0x28')]=function(_0x4768dd,_0x1e09fc){var _0x560c4b={},_0x12b9e8={},_0x2f3d46={'count':0x0,'rows':[]};var _0xc8e55f=_['map'](db[_0x9f37('0x29')]['rawAttributes'],function(_0xa96806){return{'name':_0xa96806['fieldName'],'type':_0xa96806['type'][_0x9f37('0x2a')]};});_0x12b9e8[_0x9f37('0x2b')]=_[_0x9f37('0x2c')](_0xc8e55f,_0x9f37('0x26'));_0x12b9e8[_0x9f37('0x2d')]=_['keys'](_0x4768dd[_0x9f37('0x2d')]);_0x12b9e8[_0x9f37('0x2e')]=_['intersection'](_0x12b9e8[_0x9f37('0x2b')],_0x12b9e8[_0x9f37('0x2d')]);_0x560c4b[_0x9f37('0x2f')]=_[_0x9f37('0x30')](_0x12b9e8[_0x9f37('0x2b')],qs[_0x9f37('0x31')](_0x4768dd[_0x9f37('0x2d')]['fields']));_0x560c4b['attributes']=_0x560c4b[_0x9f37('0x2f')][_0x9f37('0x32')]?_0x560c4b[_0x9f37('0x2f')]:_0x12b9e8[_0x9f37('0x2b')];if(!_0x4768dd[_0x9f37('0x2d')][_0x9f37('0x33')]('nolimit')){_0x560c4b[_0x9f37('0x1b')]=qs[_0x9f37('0x1b')](_0x4768dd[_0x9f37('0x2d')]['limit']);_0x560c4b[_0x9f37('0x19')]=qs[_0x9f37('0x19')](_0x4768dd[_0x9f37('0x2d')][_0x9f37('0x19')]);}_0x560c4b['order']=qs[_0x9f37('0x34')](_0x4768dd['query'][_0x9f37('0x34')]);_0x560c4b[_0x9f37('0x35')]=qs[_0x9f37('0x2e')](_[_0x9f37('0x36')](_0x4768dd['query'],_0x12b9e8[_0x9f37('0x2e')]),_0xc8e55f);if(_0x4768dd[_0x9f37('0x2d')]['filter']){_0x560c4b[_0x9f37('0x35')]=_[_0x9f37('0x37')](_0x560c4b[_0x9f37('0x35')],{'$or':_[_0x9f37('0x2c')](_0xc8e55f,function(_0x542bc6){if(_0x542bc6['type']!==_0x9f37('0x38')){var _0x3c5450={};_0x3c5450[_0x542bc6['name']]={'$like':'%'+_0x4768dd['query'][_0x9f37('0x39')]+'%'};return _0x3c5450;}})});}_0x560c4b=_[_0x9f37('0x37')]({},_0x560c4b,_0x4768dd[_0x9f37('0x3a')]);var _0x2e19f6={'where':_0x560c4b[_0x9f37('0x35')]};return db[_0x9f37('0x29')][_0x9f37('0x1c')](_0x2e19f6)['then'](function(_0x4e16d4){_0x2f3d46[_0x9f37('0x1c')]=_0x4e16d4;if(_0x4768dd['query'][_0x9f37('0x3b')]){_0x560c4b['include']=[{'all':!![]}];}return db[_0x9f37('0x29')][_0x9f37('0x3c')](_0x560c4b);})[_0x9f37('0x22')](function(_0x1d1c8c){_0x2f3d46[_0x9f37('0x3d')]=_0x1d1c8c;return _0x2f3d46;})[_0x9f37('0x22')](respondWithFilteredResult(_0x1e09fc,_0x560c4b))['catch'](handleError(_0x1e09fc,null));};exports[_0x9f37('0x3e')]=function(_0x37def9,_0xd4f82a){var _0x2f769a={'raw':!![],'where':{'id':_0x37def9[_0x9f37('0x3f')]['id']}},_0x249d5b={};_0x249d5b['model']=_[_0x9f37('0x40')](db[_0x9f37('0x29')]['rawAttributes']);_0x249d5b['query']=_[_0x9f37('0x40')](_0x37def9[_0x9f37('0x2d')]);_0x249d5b[_0x9f37('0x2e')]=_['intersection'](_0x249d5b[_0x9f37('0x2b')],_0x249d5b[_0x9f37('0x2d')]);_0x2f769a['attributes']=_[_0x9f37('0x30')](_0x249d5b[_0x9f37('0x2b')],qs[_0x9f37('0x31')](_0x37def9[_0x9f37('0x2d')]['fields']));_0x2f769a[_0x9f37('0x2f')]=_0x2f769a['attributes'][_0x9f37('0x32')]?_0x2f769a['attributes']:_0x249d5b[_0x9f37('0x2b')];if(_0x37def9[_0x9f37('0x2d')][_0x9f37('0x3b')]){_0x2f769a[_0x9f37('0x41')]=[{'all':!![]}];}_0x2f769a=_['merge']({},_0x2f769a,_0x37def9[_0x9f37('0x3a')]);return db[_0x9f37('0x29')]['find'](_0x2f769a)[_0x9f37('0x22')](handleEntityNotFound(_0xd4f82a,null))[_0x9f37('0x22')](respondWithResult(_0xd4f82a,null))[_0x9f37('0x42')](handleError(_0xd4f82a,null));};exports[_0x9f37('0x43')]=function(_0x101908,_0x3034b8){return db[_0x9f37('0x29')][_0x9f37('0x43')](_0x101908['body'],{})[_0x9f37('0x22')](respondWithResult(_0x3034b8,0xc9))[_0x9f37('0x42')](handleError(_0x3034b8,null));};exports[_0x9f37('0x44')]=function(_0x9cb4b4,_0x43e0ac){if(_0x9cb4b4[_0x9f37('0x45')]['id']){delete _0x9cb4b4[_0x9f37('0x45')]['id'];}return db[_0x9f37('0x29')][_0x9f37('0x46')]({'where':{'id':_0x9cb4b4[_0x9f37('0x3f')]['id']}})[_0x9f37('0x22')](handleEntityNotFound(_0x43e0ac,null))[_0x9f37('0x22')](saveUpdates(_0x9cb4b4[_0x9f37('0x45')],null))[_0x9f37('0x22')](respondWithResult(_0x43e0ac,null))[_0x9f37('0x42')](handleError(_0x43e0ac,null));};exports[_0x9f37('0x47')]=function(_0xad536e,_0x2eaa6f){return db[_0x9f37('0x29')][_0x9f37('0x46')]({'where':{'id':_0xad536e['params']['id']}})[_0x9f37('0x22')](handleEntityNotFound(_0x2eaa6f,null))['then'](removeEntity(_0x2eaa6f,null))[_0x9f37('0x42')](handleError(_0x2eaa6f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3fb3932..e5c1bf1 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 _0x69c6=['api','moment','bluebird','path','rimraf','../../config/environment','define','VtigerField','idField','FieldId','lodash'];(function(_0x5e03fc,_0x1b5ed7){var _0x116ada=function(_0x1bb90e){while(--_0x1bb90e){_0x5e03fc['push'](_0x5e03fc['shift']());}};_0x116ada(++_0x1b5ed7);}(_0x69c6,0x1b7));var _0x669c=function(_0x8288e1,_0x47a093){_0x8288e1=_0x8288e1-0x0;var _0x4d2341=_0x69c6[_0x8288e1];return _0x4d2341;};'use strict';var _=require(_0x669c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x669c('0x1'));var moment=require(_0x669c('0x2'));var BPromise=require(_0x669c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x669c('0x4'));var rimraf=require(_0x669c('0x5'));var config=require(_0x669c('0x6'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x187b2f,_0x5da9ae){return _0x187b2f[_0x669c('0x7')](_0x669c('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x669c('0x9'),_0x669c('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x325a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x325a,0xff));var _0xa325=function(_0x3cc1bf,_0xed7947){_0x3cc1bf=_0x3cc1bf-0x0;var _0x2f4b69=_0x325a[_0x3cc1bf];return _0x2f4b69;};'use strict';var _=require('lodash');var util=require(_0xa325('0x0'));var logger=require(_0xa325('0x1'))(_0xa325('0x2'));var moment=require('moment');var BPromise=require(_0xa325('0x3'));var rp=require(_0xa325('0x4'));var fs=require('fs');var path=require(_0xa325('0x5'));var rimraf=require(_0xa325('0x6'));var config=require(_0xa325('0x7'));var attributes=require(_0xa325('0x8'));module[_0xa325('0x9')]=function(_0x1a51ac,_0x273699){return _0x1a51ac[_0xa325('0xa')](_0xa325('0xb'),attributes,{'tableName':_0xa325('0xc'),'paranoid':![],'indexes':[{'name':_0xa325('0xd'),'fields':[_0xa325('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 323454e..bfc6389 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 _0xc8ed=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b9ee5,_0x4fdaf8){var _0x5f4eb5=function(_0x55d418){while(--_0x55d418){_0x4b9ee5['push'](_0x4b9ee5['shift']());}};_0x5f4eb5(++_0x4fdaf8);}(_0xc8ed,0x1ee));var _0xdc8e=function(_0x4bb20d,_0x5e975f){_0x4bb20d=_0x4bb20d-0x0;var _0x1b1798=_0xc8ed[_0x4bb20d];return _0x1b1798;};'use strict';var _=require(_0xdc8e('0x0'));var util=require(_0xdc8e('0x1'));var moment=require(_0xdc8e('0x2'));var BPromise=require(_0xdc8e('0x3'));var rs=require(_0xdc8e('0x4'));var fs=require('fs');var Redis=require(_0xdc8e('0x5'));var db=require(_0xdc8e('0x6'))['db'];var utils=require(_0xdc8e('0x7'));var logger=require(_0xdc8e('0x8'))(_0xdc8e('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc8e('0xa'));var client=jayson[_0xdc8e('0xb')][_0xdc8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x383adc,_0x4aa401,_0x490dbf){return new BPromise(function(_0x4348dc,_0x10e116){return client[_0xdc8e('0xd')](_0x383adc,_0x490dbf)[_0xdc8e('0xe')](function(_0x27ade9){logger[_0xdc8e('0xf')]('VtigerField,\x20%s,\x20%s',_0x4aa401,_0xdc8e('0x10'));logger[_0xdc8e('0x11')](_0xdc8e('0x12'),_0x4aa401,'request\x20sent',JSON[_0xdc8e('0x13')](_0x27ade9));if(_0x27ade9[_0xdc8e('0x14')]){if(_0x27ade9[_0xdc8e('0x14')]['code']===0x1f4){logger['error'](_0xdc8e('0x15'),_0x4aa401,_0x27ade9[_0xdc8e('0x14')][_0xdc8e('0x16')]);return _0x10e116(_0x27ade9[_0xdc8e('0x14')][_0xdc8e('0x16')]);}logger[_0xdc8e('0x14')](_0xdc8e('0x15'),_0x4aa401,_0x27ade9[_0xdc8e('0x14')][_0xdc8e('0x16')]);return _0x4348dc(_0x27ade9[_0xdc8e('0x14')]['message']);}else{logger[_0xdc8e('0xf')](_0xdc8e('0x15'),_0x4aa401,_0xdc8e('0x10'));_0x4348dc(_0x27ade9[_0xdc8e('0x17')]['message']);}})[_0xdc8e('0x18')](function(_0x45fe44){logger[_0xdc8e('0x14')](_0xdc8e('0x15'),_0x4aa401,_0x45fe44);_0x10e116(_0x45fe44);});});} \ No newline at end of file +var _0x28c8=['rpc','jayson/promise','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x83487c,_0x1104d8){var _0x25ce18=function(_0x5814dd){while(--_0x5814dd){_0x83487c['push'](_0x83487c['shift']());}};_0x25ce18(++_0x1104d8);}(_0x28c8,0x176));var _0x828c=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x28c8[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x828c('0x0'));var util=require(_0x828c('0x1'));var moment=require(_0x828c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x828c('0x3'));var db=require(_0x828c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x828c('0x5'))(_0x828c('0x6'));var config=require('../../config/environment');var jayson=require(_0x828c('0x7'));var client=jayson['client'][_0x828c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190d39,_0x371d22,_0x3f78f6){return new BPromise(function(_0x1ee799,_0x300b71){return client[_0x828c('0x9')](_0x190d39,_0x3f78f6)['then'](function(_0x4230ae){logger['info'](_0x828c('0xa'),_0x371d22,_0x828c('0xb'));logger[_0x828c('0xc')](_0x828c('0xd'),_0x371d22,_0x828c('0xb'),JSON[_0x828c('0xe')](_0x4230ae));if(_0x4230ae[_0x828c('0xf')]){if(_0x4230ae['error']['code']===0x1f4){logger[_0x828c('0xf')]('VtigerField,\x20%s,\x20%s',_0x371d22,_0x4230ae[_0x828c('0xf')][_0x828c('0x10')]);return _0x300b71(_0x4230ae['error'][_0x828c('0x10')]);}logger['error'](_0x828c('0xa'),_0x371d22,_0x4230ae['error']['message']);return _0x1ee799(_0x4230ae[_0x828c('0xf')][_0x828c('0x10')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x371d22,_0x828c('0xb'));_0x1ee799(_0x4230ae[_0x828c('0x11')][_0x828c('0x10')]);}})[_0x828c('0x12')](function(_0x5bf891){logger[_0x828c('0xf')](_0x828c('0xa'),_0x371d22,_0x5bf891);_0x300b71(_0x5bf891);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5dc1806..3b0d0ab 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 _0x1342=['getFields','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields'];(function(_0x3c8a4e,_0x3a9a03){var _0xada375=function(_0x1194ca){while(--_0x1194ca){_0x3c8a4e['push'](_0x3c8a4e['shift']());}};_0xada375(++_0x3a9a03);}(_0x1342,0xdf));var _0x2134=function(_0x4a0d06,_0x22d096){_0x4a0d06=_0x4a0d06-0x0;var _0x123baf=_0x1342[_0x4a0d06];return _0x123baf;};'use strict';var multer=require('multer');var util=require(_0x2134('0x0'));var path=require(_0x2134('0x1'));var timeout=require(_0x2134('0x2'));var express=require(_0x2134('0x3'));var router=express[_0x2134('0x4')]();var fs_extra=require(_0x2134('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2134('0x6'));var config=require(_0x2134('0x7'));var controller=require(_0x2134('0x8'));router[_0x2134('0x9')]('/',auth['isAuthenticated'](),controller[_0x2134('0xa')]);router['get'](_0x2134('0xb'),auth['isAuthenticated'](),controller[_0x2134('0xc')]);router[_0x2134('0x9')](_0x2134('0xd'),auth[_0x2134('0xe')](),controller[_0x2134('0xf')]);router[_0x2134('0x9')](_0x2134('0x10'),auth['isAuthenticated'](),controller[_0x2134('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2134('0x12')]);router['post'](_0x2134('0xd'),auth['isAuthenticated'](),controller[_0x2134('0x13')]);router[_0x2134('0x14')]('/:id',auth[_0x2134('0xe')](),controller[_0x2134('0x15')]);router[_0x2134('0x16')](_0x2134('0xb'),auth[_0x2134('0xe')](),controller[_0x2134('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3aab=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x2c658a,_0x18d39e){var _0x26806e=function(_0x1943f7){while(--_0x1943f7){_0x2c658a['push'](_0x2c658a['shift']());}};_0x26806e(++_0x18d39e);}(_0x3aab,0x64));var _0xb3aa=function(_0x34a7d4,_0x351e9d){_0x34a7d4=_0x34a7d4-0x0;var _0x24395c=_0x3aab[_0x34a7d4];return _0x24395c;};'use strict';var multer=require(_0xb3aa('0x0'));var util=require(_0xb3aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb3aa('0x2'));var router=express['Router']();var fs_extra=require(_0xb3aa('0x3'));var auth=require(_0xb3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3aa('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xb3aa('0x6')]('/',auth['isAuthenticated'](),controller[_0xb3aa('0x7')]);router[_0xb3aa('0x6')](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xa')]);router[_0xb3aa('0x6')](_0xb3aa('0xb'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xc')]);router['get'](_0xb3aa('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb3aa('0xe')]('/',auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xf')]);router[_0xb3aa('0xe')]('/:id/configurations',auth[_0xb3aa('0x9')](),controller['addConfiguration']);router['put'](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller[_0xb3aa('0x10')]);router[_0xb3aa('0x11')](_0xb3aa('0x8'),auth[_0xb3aa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ff25945..a2065a3 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 _0x794b=['ENUM','integrationTab','sequelize','exports','STRING','password','token'];(function(_0x3a836b,_0x24a145){var _0x54a2fc=function(_0x4218a9){while(--_0x4218a9){_0x3a836b['push'](_0x3a836b['shift']());}};_0x54a2fc(++_0x24a145);}(_0x794b,0x1c2));var _0xb794=function(_0x3efcd5,_0x4a8d63){_0x3efcd5=_0x3efcd5-0x0;var _0x1b3333=_0x794b[_0x3efcd5];return _0x1b3333;};'use strict';var Sequelize=require(_0xb794('0x0'));module[_0xb794('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb794('0x2')]},'username':{'type':Sequelize[_0xb794('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb794('0x2')]},'remoteUri':{'type':Sequelize[_0xb794('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xb794('0x3'),_0xb794('0x4')),'defaultValue':_0xb794('0x3')},'serverUrl':{'type':Sequelize[_0xb794('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb794('0x5')](_0xb794('0x6'),'newTab'),'defaultValue':_0xb794('0x6')}}; \ No newline at end of file +var _0xab00=['sequelize','exports','STRING','username','ENUM','password','token','newTab','integrationTab'];(function(_0x577248,_0x21014a){var _0x598ab3=function(_0x48b6c3){while(--_0x48b6c3){_0x577248['push'](_0x577248['shift']());}};_0x598ab3(++_0x21014a);}(_0xab00,0x1b9));var _0x0ab0=function(_0x456168,_0x462769){_0x456168=_0x456168-0x0;var _0x5802e0=_0xab00[_0x456168];return _0x5802e0;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'name':{'type':Sequelize[_0x0ab0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ab0('0x2')],'unique':_0x0ab0('0x3')},'password':{'type':Sequelize[_0x0ab0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0ab0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0ab0('0x4')](_0x0ab0('0x5'),_0x0ab0('0x6')),'defaultValue':_0x0ab0('0x5')},'serverUrl':{'type':Sequelize[_0x0ab0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ab0('0x4')]('integrationTab',_0x0ab0('0x7')),'defaultValue':_0x0ab0('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2a1dfe1..03c9113 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 _0x76dc=['base64','token','headers','Basic\x20%s','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','name','send','index','ZendeskAccount','rawAttributes','fieldName','key','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','format','ticket_fields','%s:%s','toString'];(function(_0x3eb1b5,_0x580d42){var _0x1145ac=function(_0x20a727){while(--_0x20a727){_0x3eb1b5['push'](_0x3eb1b5['shift']());}};_0x1145ac(++_0x580d42);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5567aa,_0x2e355b){_0x5567aa=_0x5567aa-0x0;var _0x322306=_0x76dc[_0x5567aa];return _0x322306;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];var integrations=require(_0xc76d('0x17'));function respondWithStatusCode(_0x1722b3,_0x311814){_0x311814=_0x311814||0xcc;return function(_0x1a7b47){if(_0x1a7b47){return _0x1722b3[_0xc76d('0x18')](_0x311814);}return _0x1722b3[_0xc76d('0x19')](_0x311814)[_0xc76d('0x1a')]();};}function respondWithResult(_0x5cda20,_0x8696db){_0x8696db=_0x8696db||0xc8;return function(_0x2e9ec7){if(_0x2e9ec7){return _0x5cda20['status'](_0x8696db)[_0xc76d('0x1b')](_0x2e9ec7);}};}function respondWithFilteredResult(_0x2d23d2,_0x47a4ee){return function(_0x6f94e){if(_0x6f94e){var _0x5c680c=typeof _0x47a4ee[_0xc76d('0x1c')]==='undefined'&&typeof _0x47a4ee['limit']===_0xc76d('0x1d');var _0x31b032=_0x6f94e[_0xc76d('0x1e')];var _0x23f3ca=_0x5c680c?0x0:_0x47a4ee[_0xc76d('0x1c')];var _0x4b0402=_0x5c680c?_0x6f94e[_0xc76d('0x1e')]:_0x47a4ee[_0xc76d('0x1c')]+_0x47a4ee[_0xc76d('0x1f')];var _0x1c6d5b;if(_0x4b0402>=_0x31b032){_0x4b0402=_0x31b032;_0x1c6d5b=0xc8;}else{_0x1c6d5b=0xce;}_0x2d23d2[_0xc76d('0x19')](_0x1c6d5b);return _0x2d23d2['set'](_0xc76d('0x20'),_0x23f3ca+'-'+_0x4b0402+'/'+_0x31b032)[_0xc76d('0x1b')](_0x6f94e);}return null;};}function patchUpdates(_0x5dffde){return function(_0x455371){try{jsonpatch[_0xc76d('0x21')](_0x455371,_0x5dffde,!![]);}catch(_0x191e97){return BPromise[_0xc76d('0x22')](_0x191e97);}return _0x455371[_0xc76d('0x23')]();};}function saveUpdates(_0x3d357b,_0x42b89c){return function(_0x107fad){if(_0x107fad){return _0x107fad[_0xc76d('0x24')](_0x3d357b)[_0xc76d('0x25')](function(_0x15328d){return _0x15328d;});}return null;};}function removeEntity(_0x5de11f,_0x11b42f){return function(_0x17b46f){if(_0x17b46f){return _0x17b46f['destroy']()[_0xc76d('0x25')](function(){_0x5de11f[_0xc76d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374b9e,_0x476aee){return function(_0x2cd06e){if(!_0x2cd06e){_0x374b9e[_0xc76d('0x18')](0x194);}return _0x2cd06e;};}function handleError(_0xfc4aea,_0x1949c4){_0x1949c4=_0x1949c4||0x1f4;return function(_0x89ee5){logger['error'](_0x89ee5['stack']);if(_0x89ee5[_0xc76d('0x26')]){delete _0x89ee5[_0xc76d('0x26')];}_0xfc4aea['status'](_0x1949c4)[_0xc76d('0x27')](_0x89ee5);};}exports[_0xc76d('0x28')]=function(_0x64899f,_0x49fa89){var _0x2039f4={},_0x5cf2e4={},_0x13b468={'count':0x0,'rows':[]};var _0x18a7fa=_['map'](db[_0xc76d('0x29')][_0xc76d('0x2a')],function(_0x9ab96c){return{'name':_0x9ab96c[_0xc76d('0x2b')],'type':_0x9ab96c['type'][_0xc76d('0x2c')]};});_0x5cf2e4['model']=_[_0xc76d('0x2d')](_0x18a7fa,'name');_0x5cf2e4[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x64899f['query']);_0x5cf2e4['filters']=_['intersection'](_0x5cf2e4['model'],_0x5cf2e4[_0xc76d('0x2e')]);_0x2039f4[_0xc76d('0x30')]=_[_0xc76d('0x31')](_0x5cf2e4[_0xc76d('0x32')],qs[_0xc76d('0x33')](_0x64899f['query'][_0xc76d('0x33')]));_0x2039f4['attributes']=_0x2039f4[_0xc76d('0x30')]['length']?_0x2039f4[_0xc76d('0x30')]:_0x5cf2e4[_0xc76d('0x32')];if(!_0x64899f[_0xc76d('0x2e')][_0xc76d('0x34')](_0xc76d('0x35'))){_0x2039f4['limit']=qs[_0xc76d('0x1f')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x1f')]);_0x2039f4['offset']=qs[_0xc76d('0x1c')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x2039f4['order']=qs[_0xc76d('0x36')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x36')]);_0x2039f4[_0xc76d('0x37')]=qs[_0xc76d('0x38')](_[_0xc76d('0x39')](_0x64899f['query'],_0x5cf2e4['filters']),_0x18a7fa);if(_0x64899f[_0xc76d('0x2e')]['filter']){_0x2039f4[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x2039f4[_0xc76d('0x37')],{'$or':_[_0xc76d('0x2d')](_0x18a7fa,function(_0x57b9bc){if(_0x57b9bc['type']!==_0xc76d('0x3b')){var _0x20a456={};_0x20a456[_0x57b9bc[_0xc76d('0x26')]]={'$like':'%'+_0x64899f[_0xc76d('0x2e')][_0xc76d('0x3c')]+'%'};return _0x20a456;}})});}_0x2039f4=_['merge']({},_0x2039f4,_0x64899f[_0xc76d('0x3d')]);var _0xb264b0={'where':_0x2039f4[_0xc76d('0x37')]};return db[_0xc76d('0x29')][_0xc76d('0x1e')](_0xb264b0)[_0xc76d('0x25')](function(_0x10ba23){_0x13b468[_0xc76d('0x1e')]=_0x10ba23;if(_0x64899f[_0xc76d('0x2e')][_0xc76d('0x3e')]){_0x2039f4['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xc76d('0x3f')](_0x2039f4);})[_0xc76d('0x25')](function(_0x1e5118){_0x13b468[_0xc76d('0x40')]=_0x1e5118;return _0x13b468;})['then'](respondWithFilteredResult(_0x49fa89,_0x2039f4))['catch'](handleError(_0x49fa89,null));};exports[_0xc76d('0x41')]=function(_0x13a895,_0x3e471e){var _0x15eb42={'raw':![],'where':{'id':_0x13a895[_0xc76d('0x42')]['id']}},_0x21c18f={};_0x21c18f[_0xc76d('0x32')]=_[_0xc76d('0x2f')](db['ZendeskAccount'][_0xc76d('0x2a')]);_0x21c18f[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x13a895[_0xc76d('0x2e')]);_0x21c18f['filters']=_['intersection'](_0x21c18f['model'],_0x21c18f['query']);_0x15eb42['attributes']=_['intersection'](_0x21c18f['model'],qs[_0xc76d('0x33')](_0x13a895[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x15eb42[_0xc76d('0x30')]=_0x15eb42[_0xc76d('0x30')][_0xc76d('0x43')]?_0x15eb42[_0xc76d('0x30')]:_0x21c18f[_0xc76d('0x32')];if(_0x13a895['query'][_0xc76d('0x3e')]){_0x15eb42[_0xc76d('0x44')]=[{'all':!![]}];}_0x15eb42=_[_0xc76d('0x3a')]({},_0x15eb42,_0x13a895[_0xc76d('0x3d')]);return db[_0xc76d('0x29')][_0xc76d('0x45')](_0x15eb42)[_0xc76d('0x25')](handleEntityNotFound(_0x3e471e,null))[_0xc76d('0x25')](respondWithResult(_0x3e471e,null))[_0xc76d('0x46')](handleError(_0x3e471e,null));};exports['create']=function(_0x5b41d3,_0x144d09){return db[_0xc76d('0x29')][_0xc76d('0x47')](_0x5b41d3[_0xc76d('0x48')],{})[_0xc76d('0x25')](respondWithResult(_0x144d09,0xc9))['catch'](handleError(_0x144d09,null));};exports[_0xc76d('0x24')]=function(_0x1ede13,_0x5e48fe){if(_0x1ede13['body']['id']){delete _0x1ede13[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x29')]['find']({'where':{'id':_0x1ede13[_0xc76d('0x42')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x5e48fe,null))[_0xc76d('0x25')](saveUpdates(_0x1ede13[_0xc76d('0x48')],null))[_0xc76d('0x25')](respondWithResult(_0x5e48fe,null))[_0xc76d('0x46')](handleError(_0x5e48fe,null));};exports[_0xc76d('0x49')]=function(_0x10b1b0,_0x4452a8){return db[_0xc76d('0x29')]['find']({'where':{'id':_0x10b1b0[_0xc76d('0x42')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x4452a8,null))[_0xc76d('0x25')](removeEntity(_0x4452a8,null))['catch'](handleError(_0x4452a8,null));};exports[_0xc76d('0x4a')]=function(_0x1afc6c,_0x506b03,_0x366d43){var _0x488783={};var _0xe90d83={};var _0x12c972;var _0x316978;return db[_0xc76d('0x29')][_0xc76d('0x4b')]({'where':{'id':_0x1afc6c['params']['id']}})['then'](handleEntityNotFound(_0x506b03,null))['then'](function(_0x320483){if(_0x320483){_0x12c972=_0x320483;_0xe90d83[_0xc76d('0x32')]=_[_0xc76d('0x2f')](db[_0xc76d('0x4c')][_0xc76d('0x2a')]);_0xe90d83[_0xc76d('0x2e')]=_['keys'](_0x1afc6c[_0xc76d('0x2e')]);_0xe90d83[_0xc76d('0x38')]=_[_0xc76d('0x31')](_0xe90d83[_0xc76d('0x32')],_0xe90d83[_0xc76d('0x2e')]);_0x488783['attributes']=_[_0xc76d('0x31')](_0xe90d83[_0xc76d('0x32')],qs[_0xc76d('0x33')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x488783[_0xc76d('0x30')]=_0x488783['attributes'][_0xc76d('0x43')]?_0x488783[_0xc76d('0x30')]:_0xe90d83['model'];_0x488783['order']=qs[_0xc76d('0x36')](_0x1afc6c['query'][_0xc76d('0x36')]);_0x488783[_0xc76d('0x37')]=qs[_0xc76d('0x38')](_[_0xc76d('0x39')](_0x1afc6c[_0xc76d('0x2e')],_0xe90d83[_0xc76d('0x38')]));if(_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x3c')]){_0x488783[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x488783[_0xc76d('0x37')],{'$or':_[_0xc76d('0x2d')](_0x488783[_0xc76d('0x30')],function(_0x3afeb6){var _0x4cd7bf={};_0x4cd7bf[_0x3afeb6]={'$like':'%'+_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x3c')]+'%'};return _0x4cd7bf;})});}_0x488783=_[_0xc76d('0x3a')]({},_0x488783,_0x1afc6c[_0xc76d('0x3d')]);return _0x12c972[_0xc76d('0x4a')](_0x488783);}})['then'](function(_0x40e866){if(_0x40e866){_0x316978=_0x40e866[_0xc76d('0x43')];if(!_0x1afc6c['query']['hasOwnProperty']('nolimit')){_0x488783[_0xc76d('0x1f')]=qs[_0xc76d('0x1f')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x1f')]);_0x488783[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x1c')]);}return _0x12c972['getConfigurations'](_0x488783);}})[_0xc76d('0x25')](function(_0x5e2f0d){if(_0x5e2f0d){return _0x5e2f0d?{'count':_0x316978,'rows':_0x5e2f0d}:null;}})['then'](respondWithResult(_0x506b03,null))[_0xc76d('0x46')](handleError(_0x506b03,null));};exports[_0xc76d('0x4d')]=function(_0x1a0182,_0x502bd8,_0x11b544){if(_0x1a0182['body']['id']){delete _0x1a0182['body']['id'];}return db['ZendeskAccount'][_0xc76d('0x4b')]({'where':{'id':_0x1a0182[_0xc76d('0x42')]['id']}})['then'](handleEntityNotFound(_0x502bd8,null))[_0xc76d('0x25')](function(_0x382bc1){if(_0x382bc1){_0x1a0182[_0xc76d('0x48')][_0xc76d('0x4e')]=_0x382bc1['id'];_0x1a0182[_0xc76d('0x48')][_0xc76d('0x4f')]=integrations[_0xc76d('0x50')](_0x1a0182['body']['channel'],_0x1a0182['body'][_0xc76d('0x51')]);_0x1a0182[_0xc76d('0x48')][_0xc76d('0x52')]=integrations[_0xc76d('0x53')](_0x1a0182[_0xc76d('0x48')]['channel'],_0x1a0182[_0xc76d('0x48')][_0xc76d('0x51')]);return db[_0xc76d('0x4c')][_0xc76d('0x47')](_0x1a0182[_0xc76d('0x48')],{'include':[{'model':db[_0xc76d('0x54')],'as':_0xc76d('0x4f')},{'model':db[_0xc76d('0x54')],'as':'Descriptions'}]});}return null;})[_0xc76d('0x25')](respondWithResult(_0x502bd8,null))['catch'](handleError(_0x502bd8,null));};exports[_0xc76d('0x55')]=function(_0x40afa3,_0x35c60f,_0x55dd93){var _0x58c3ce='';return db[_0xc76d('0x29')]['findOne']({'where':{'id':_0x40afa3['params']['id']},'attributes':['id',_0xc76d('0x56'),_0xc76d('0x57'),'token',_0xc76d('0x58'),_0xc76d('0x59')]})['then'](handleEntityNotFound(_0x35c60f,null))[_0xc76d('0x25')](function(_0xef0e1b){if(_0xef0e1b){_0x58c3ce=_0xef0e1b['remoteUri'];var _0x450402=_0x58c3ce['slice'](-0x1);if(_0x450402==='/'){_0x58c3ce=_0x58c3ce[_0xc76d('0x5a')](0x0,_0x58c3ce[_0xc76d('0x5b')](_0x450402));}var _0x4cbaba={'method':_0xc76d('0x5c'),'uri':util[_0xc76d('0x5d')]('%s/%s',_0x58c3ce,_0xc76d('0x5e')),'json':!![]};switch(_0xef0e1b[_0xc76d('0x58')]){case _0xc76d('0x57'):_0x4cbaba['headers']={'Authorization':util[_0xc76d('0x5d')]('Basic\x20%s',new Buffer(util['format'](_0xc76d('0x5f'),_0xef0e1b[_0xc76d('0x56')],_0xef0e1b['password']))[_0xc76d('0x60')](_0xc76d('0x61')))};break;case _0xc76d('0x62'):_0x4cbaba[_0xc76d('0x63')]={'Authorization':util[_0xc76d('0x5d')](_0xc76d('0x64'),new Buffer(util[_0xc76d('0x5d')](_0xc76d('0x65'),_0xef0e1b[_0xc76d('0x56')],_0xef0e1b[_0xc76d('0x62')]))[_0xc76d('0x60')](_0xc76d('0x61')))};break;default:throw new db[(_0xc76d('0x66'))][(_0xc76d('0x67'))](_0xc76d('0x68'));}return rp(_0x4cbaba);}})[_0xc76d('0x25')](function(_0xa6508c){if(_0xa6508c){var _0xd16232=[_0xc76d('0x69'),_0xc76d('0x6a'),'group',_0xc76d('0x6b')];_[_0xc76d('0x6c')](_0xa6508c[_0xc76d('0x5e')],function(_0x1d97c3){return _0xd16232[_0xc76d('0x6d')](_0x1d97c3[_0xc76d('0x51')]);});return{'count':_0xa6508c[_0xc76d('0x5e')][_0xc76d('0x43')],'rows':_[_0xc76d('0x2d')](_0xa6508c[_0xc76d('0x5e')],function(_0x7210ee){return{'id':_0x7210ee['id'],'name':_0x7210ee[_0xc76d('0x6e')]>0x7?_0x7210ee[_0xc76d('0x6f')]:_0x7210ee[_0xc76d('0x51')],'custom':_0x7210ee[_0xc76d('0x6e')]>0x7?!![]:![],'options':_0x7210ee[_0xc76d('0x70')]?_0x7210ee[_0xc76d('0x70')]:_0x7210ee[_0xc76d('0x71')]?_0x7210ee[_0xc76d('0x71')]:[]};})};}})[_0xc76d('0x25')](respondWithResult(_0x35c60f,null))[_0xc76d('0x46')](function(_0x260874){var _0x508348=_0x40afa3[_0xc76d('0x2e')]['test']?0x1f4:_0x260874[_0xc76d('0x72')]||0x1f4;logger[_0xc76d('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xc76d('0x55'),_0x508348,JSON[_0xc76d('0x74')](_0x260874));delete _0x260874['name'];if(_0x508348===0x191){_0x508348=0x190;}_0x35c60f[_0xc76d('0x19')](_0x508348)[_0xc76d('0x27')](_0x40afa3[_0xc76d('0x2e')][_0xc76d('0x75')]?{'message':_0xc76d('0x76'),'statusCode':_0x260874[_0xc76d('0x72')]}:_0x260874);});}; \ No newline at end of file +var _0x4fc2=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','remove','position','title','system_field_options','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','update','getConfigurations','findOne','ZendeskConfiguration'];(function(_0xbc2239,_0x4e9648){var _0x4877da=function(_0x116e11){while(--_0x116e11){_0xbc2239['push'](_0xbc2239['shift']());}};_0x4877da(++_0x4e9648);}(_0x4fc2,0x111));var _0x24fc=function(_0x4b136a,_0xa8310c){_0x4b136a=_0x4b136a-0x0;var _0x51a36b=_0x4fc2[_0x4b136a];return _0x51a36b;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x306873,_0x76cb25){_0x76cb25=_0x76cb25||0xcc;return function(_0x3f6d8b){if(_0x3f6d8b){return _0x306873[_0x24fc('0x1b')](_0x76cb25);}return _0x306873[_0x24fc('0x1c')](_0x76cb25)[_0x24fc('0x1d')]();};}function respondWithResult(_0x537b5c,_0x2a0971){_0x2a0971=_0x2a0971||0xc8;return function(_0x18c0a7){if(_0x18c0a7){return _0x537b5c[_0x24fc('0x1c')](_0x2a0971)[_0x24fc('0x1e')](_0x18c0a7);}};}function respondWithFilteredResult(_0x4acd36,_0x2ac989){return function(_0x588543){if(_0x588543){var _0x4af098=typeof _0x2ac989[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x2ac989[_0x24fc('0x21')]===_0x24fc('0x20');var _0x52a884=_0x588543[_0x24fc('0x22')];var _0x1cb3d0=_0x4af098?0x0:_0x2ac989[_0x24fc('0x1f')];var _0x8ac114=_0x4af098?_0x588543['count']:_0x2ac989[_0x24fc('0x1f')]+_0x2ac989[_0x24fc('0x21')];var _0x304881;if(_0x8ac114>=_0x52a884){_0x8ac114=_0x52a884;_0x304881=0xc8;}else{_0x304881=0xce;}_0x4acd36['status'](_0x304881);return _0x4acd36[_0x24fc('0x23')](_0x24fc('0x24'),_0x1cb3d0+'-'+_0x8ac114+'/'+_0x52a884)[_0x24fc('0x1e')](_0x588543);}return null;};}function patchUpdates(_0x2d0e3d){return function(_0x49a0ba){try{jsonpatch[_0x24fc('0x25')](_0x49a0ba,_0x2d0e3d,!![]);}catch(_0x545939){return BPromise[_0x24fc('0x26')](_0x545939);}return _0x49a0ba['save']();};}function saveUpdates(_0x3ed464,_0x44c121){return function(_0x2ffade){if(_0x2ffade){return _0x2ffade['update'](_0x3ed464)[_0x24fc('0x27')](function(_0x552035){return _0x552035;});}return null;};}function removeEntity(_0x35a9c7,_0x2bb93a){return function(_0x36a9b4){if(_0x36a9b4){return _0x36a9b4[_0x24fc('0x28')]()[_0x24fc('0x27')](function(){_0x35a9c7[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x20192b,_0x168d98){return function(_0x2a5c4b){if(!_0x2a5c4b){_0x20192b['sendStatus'](0x194);}return _0x2a5c4b;};}function handleError(_0x11c913,_0x16f27f){_0x16f27f=_0x16f27f||0x1f4;return function(_0x3ee302){logger['error'](_0x3ee302[_0x24fc('0x29')]);if(_0x3ee302[_0x24fc('0x2a')]){delete _0x3ee302[_0x24fc('0x2a')];}_0x11c913[_0x24fc('0x1c')](_0x16f27f)[_0x24fc('0x2b')](_0x3ee302);};}exports[_0x24fc('0x2c')]=function(_0x5ac1f2,_0x240ae7){var _0x29a461={},_0x3c99ed={},_0x1c5146={'count':0x0,'rows':[]};var _0x9f7bbc=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x3df6f4){return{'name':_0x3df6f4['fieldName'],'type':_0x3df6f4[_0x24fc('0x2d')][_0x24fc('0x2e')]};});_0x3c99ed[_0x24fc('0x2f')]=_[_0x24fc('0x30')](_0x9f7bbc,'name');_0x3c99ed[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5ac1f2['query']);_0x3c99ed[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x3c99ed['model'],_0x3c99ed['query']);_0x29a461[_0x24fc('0x35')]=_['intersection'](_0x3c99ed[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x5ac1f2['query'][_0x24fc('0x36')]));_0x29a461[_0x24fc('0x35')]=_0x29a461[_0x24fc('0x35')][_0x24fc('0x37')]?_0x29a461[_0x24fc('0x35')]:_0x3c99ed[_0x24fc('0x2f')];if(!_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x38')](_0x24fc('0x39'))){_0x29a461['limit']=qs[_0x24fc('0x21')](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x21')]);_0x29a461[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x5ac1f2['query']['offset']);}_0x29a461[_0x24fc('0x3a')]=qs['sort'](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x29a461[_0x24fc('0x3c')]=qs[_0x24fc('0x33')](_['pick'](_0x5ac1f2[_0x24fc('0x31')],_0x3c99ed['filters']),_0x9f7bbc);if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x29a461[_0x24fc('0x3c')]=_[_0x24fc('0x3e')](_0x29a461[_0x24fc('0x3c')],{'$or':_['map'](_0x9f7bbc,function(_0xadedb4){if(_0xadedb4[_0x24fc('0x2d')]!==_0x24fc('0x3f')){var _0x22a75c={};_0x22a75c[_0xadedb4['name']]={'$like':'%'+_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0x22a75c;}})});}_0x29a461=_['merge']({},_0x29a461,_0x5ac1f2[_0x24fc('0x40')]);var _0x52df2e={'where':_0x29a461[_0x24fc('0x3c')]};return db[_0x24fc('0x41')][_0x24fc('0x22')](_0x52df2e)[_0x24fc('0x27')](function(_0x431189){_0x1c5146[_0x24fc('0x22')]=_0x431189;if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x42')]){_0x29a461['include']=[{'all':!![]}];}return db[_0x24fc('0x41')][_0x24fc('0x43')](_0x29a461);})[_0x24fc('0x27')](function(_0x4fee9f){_0x1c5146[_0x24fc('0x44')]=_0x4fee9f;return _0x1c5146;})[_0x24fc('0x27')](respondWithFilteredResult(_0x240ae7,_0x29a461))['catch'](handleError(_0x240ae7,null));};exports[_0x24fc('0x45')]=function(_0x22f30b,_0x2c598c){var _0x5e4e9b={'raw':![],'where':{'id':_0x22f30b[_0x24fc('0x46')]['id']}},_0x31ddd0={};_0x31ddd0['model']=_[_0x24fc('0x32')](db[_0x24fc('0x41')][_0x24fc('0x47')]);_0x31ddd0[_0x24fc('0x31')]=_['keys'](_0x22f30b[_0x24fc('0x31')]);_0x31ddd0[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],_0x31ddd0[_0x24fc('0x31')]);_0x5e4e9b['attributes']=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x22f30b[_0x24fc('0x31')]['fields']));_0x5e4e9b[_0x24fc('0x35')]=_0x5e4e9b[_0x24fc('0x35')]['length']?_0x5e4e9b['attributes']:_0x31ddd0[_0x24fc('0x2f')];if(_0x22f30b['query']['includeAll']){_0x5e4e9b[_0x24fc('0x48')]=[{'all':!![]}];}_0x5e4e9b=_['merge']({},_0x5e4e9b,_0x22f30b[_0x24fc('0x40')]);return db[_0x24fc('0x41')][_0x24fc('0x49')](_0x5e4e9b)['then'](handleEntityNotFound(_0x2c598c,null))[_0x24fc('0x27')](respondWithResult(_0x2c598c,null))[_0x24fc('0x4a')](handleError(_0x2c598c,null));};exports[_0x24fc('0x4b')]=function(_0x1ad8d6,_0x39873d){return db[_0x24fc('0x41')][_0x24fc('0x4b')](_0x1ad8d6[_0x24fc('0x4c')],{})['then'](respondWithResult(_0x39873d,0xc9))['catch'](handleError(_0x39873d,null));};exports[_0x24fc('0x4d')]=function(_0x2f1a99,_0x12e9f7){if(_0x2f1a99['body']['id']){delete _0x2f1a99['body']['id'];}return db[_0x24fc('0x41')][_0x24fc('0x49')]({'where':{'id':_0x2f1a99[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x12e9f7,null))[_0x24fc('0x27')](saveUpdates(_0x2f1a99[_0x24fc('0x4c')],null))[_0x24fc('0x27')](respondWithResult(_0x12e9f7,null))[_0x24fc('0x4a')](handleError(_0x12e9f7,null));};exports[_0x24fc('0x28')]=function(_0x4574d3,_0x434700){return db[_0x24fc('0x41')]['find']({'where':{'id':_0x4574d3[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x434700,null))[_0x24fc('0x27')](removeEntity(_0x434700,null))[_0x24fc('0x4a')](handleError(_0x434700,null));};exports[_0x24fc('0x4e')]=function(_0x5bdc4d,_0x428012,_0x4bf3a8){var _0x2c8f74={};var _0x2ee445={};var _0x446c14;var _0x41ddfb;return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x5bdc4d['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x428012,null))[_0x24fc('0x27')](function(_0xc49d9f){if(_0xc49d9f){_0x446c14=_0xc49d9f;_0x2ee445[_0x24fc('0x2f')]=_[_0x24fc('0x32')](db[_0x24fc('0x50')]['rawAttributes']);_0x2ee445[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5bdc4d[_0x24fc('0x31')]);_0x2ee445[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],_0x2ee445[_0x24fc('0x31')]);_0x2c8f74['attributes']=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],qs['fields'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x36')]));_0x2c8f74[_0x24fc('0x35')]=_0x2c8f74[_0x24fc('0x35')][_0x24fc('0x37')]?_0x2c8f74[_0x24fc('0x35')]:_0x2ee445['model'];_0x2c8f74[_0x24fc('0x3a')]=qs['sort'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x2c8f74['where']=qs[_0x24fc('0x33')](_['pick'](_0x5bdc4d[_0x24fc('0x31')],_0x2ee445['filters']));if(_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x2c8f74['where']=_[_0x24fc('0x3e')](_0x2c8f74['where'],{'$or':_[_0x24fc('0x30')](_0x2c8f74[_0x24fc('0x35')],function(_0x59e46e){var _0xd1638f={};_0xd1638f[_0x59e46e]={'$like':'%'+_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0xd1638f;})});}_0x2c8f74=_[_0x24fc('0x3e')]({},_0x2c8f74,_0x5bdc4d[_0x24fc('0x40')]);return _0x446c14['getConfigurations'](_0x2c8f74);}})[_0x24fc('0x27')](function(_0x2f62b0){if(_0x2f62b0){_0x41ddfb=_0x2f62b0[_0x24fc('0x37')];if(!_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x38')]('nolimit')){_0x2c8f74['limit']=qs[_0x24fc('0x21')](_0x5bdc4d[_0x24fc('0x31')]['limit']);_0x2c8f74['offset']=qs[_0x24fc('0x1f')](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x1f')]);}return _0x446c14[_0x24fc('0x4e')](_0x2c8f74);}})['then'](function(_0x20973d){if(_0x20973d){return _0x20973d?{'count':_0x41ddfb,'rows':_0x20973d}:null;}})[_0x24fc('0x27')](respondWithResult(_0x428012,null))[_0x24fc('0x4a')](handleError(_0x428012,null));};exports[_0x24fc('0x51')]=function(_0x1df0c4,_0x3e896f,_0x26ac2e){if(_0x1df0c4[_0x24fc('0x4c')]['id']){delete _0x1df0c4[_0x24fc('0x4c')]['id'];}return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x1df0c4[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x3e896f,null))[_0x24fc('0x27')](function(_0x354fc6){if(_0x354fc6){_0x1df0c4['body'][_0x24fc('0x52')]=_0x354fc6['id'];_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x53')]=integrations[_0x24fc('0x54')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x2d')]);_0x1df0c4['body'][_0x24fc('0x56')]=integrations[_0x24fc('0x57')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4['body'][_0x24fc('0x2d')]);return db[_0x24fc('0x50')]['create'](_0x1df0c4['body'],{'include':[{'model':db['ZendeskField'],'as':_0x24fc('0x53')},{'model':db[_0x24fc('0x58')],'as':_0x24fc('0x56')}]});}return null;})[_0x24fc('0x27')](respondWithResult(_0x3e896f,null))[_0x24fc('0x4a')](handleError(_0x3e896f,null));};exports[_0x24fc('0x59')]=function(_0x52e1aa,_0x11bafd,_0x15e8a3){var _0x5a2c09='';return db['ZendeskAccount'][_0x24fc('0x4f')]({'where':{'id':_0x52e1aa[_0x24fc('0x46')]['id']},'attributes':['id',_0x24fc('0x5a'),'password',_0x24fc('0x5b'),_0x24fc('0x5c'),_0x24fc('0x5d')]})['then'](handleEntityNotFound(_0x11bafd,null))['then'](function(_0x4c286d){if(_0x4c286d){_0x5a2c09=_0x4c286d['remoteUri'];var _0x4a1b8e=_0x5a2c09[_0x24fc('0x5e')](-0x1);if(_0x4a1b8e==='/'){_0x5a2c09=_0x5a2c09[_0x24fc('0x5f')](0x0,_0x5a2c09[_0x24fc('0x60')](_0x4a1b8e));}var _0x2a1236={'method':'GET','uri':util[_0x24fc('0x61')]('%s/%s',_0x5a2c09,_0x24fc('0x62')),'json':!![]};switch(_0x4c286d['authType']){case _0x24fc('0x63'):_0x2a1236[_0x24fc('0x64')]={'Authorization':util[_0x24fc('0x61')](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')](_0x24fc('0x66'),_0x4c286d[_0x24fc('0x5a')],_0x4c286d['password']))[_0x24fc('0x67')](_0x24fc('0x68')))};break;case _0x24fc('0x5b'):_0x2a1236['headers']={'Authorization':util['format'](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')]('%s/token:%s',_0x4c286d[_0x24fc('0x5a')],_0x4c286d[_0x24fc('0x5b')]))['toString'](_0x24fc('0x68')))};break;default:throw new db[(_0x24fc('0x69'))]['ValidationError'](_0x24fc('0x6a'));}return rp(_0x2a1236);}})[_0x24fc('0x27')](function(_0x24e717){if(_0x24e717){var _0x1efe4e=[_0x24fc('0x6b'),_0x24fc('0x6c'),'group','assignee'];_[_0x24fc('0x6d')](_0x24e717['ticket_fields'],function(_0x29bd9f){return _0x1efe4e['includes'](_0x29bd9f['type']);});return{'count':_0x24e717[_0x24fc('0x62')][_0x24fc('0x37')],'rows':_[_0x24fc('0x30')](_0x24e717[_0x24fc('0x62')],function(_0x66de4f){return{'id':_0x66de4f['id'],'name':_0x66de4f[_0x24fc('0x6e')]>0x7?_0x66de4f[_0x24fc('0x6f')]:_0x66de4f[_0x24fc('0x2d')],'custom':_0x66de4f['position']>0x7?!![]:![],'options':_0x66de4f[_0x24fc('0x70')]?_0x66de4f[_0x24fc('0x70')]:_0x66de4f['custom_field_options']?_0x66de4f['custom_field_options']:[]};})};}})[_0x24fc('0x27')](respondWithResult(_0x11bafd,null))[_0x24fc('0x4a')](function(_0x938dcf){var _0x1b2a97=_0x52e1aa[_0x24fc('0x31')]['test']?0x1f4:_0x938dcf[_0x24fc('0x71')]||0x1f4;logger[_0x24fc('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x24fc('0x59'),_0x1b2a97,JSON[_0x24fc('0x73')](_0x938dcf));delete _0x938dcf[_0x24fc('0x2a')];if(_0x1b2a97===0x191){_0x1b2a97=0x190;}_0x11bafd['status'](_0x1b2a97)[_0x24fc('0x2b')](_0x52e1aa[_0x24fc('0x31')][_0x24fc('0x74')]?{'message':_0x24fc('0x75'),'statusCode':_0x938dcf[_0x24fc('0x71')]}:_0x938dcf);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c6659a2..b7766be 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 _0x14bf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x5ea732,_0x992d68){var _0x1d3498=function(_0xdaf46c){while(--_0xdaf46c){_0x5ea732['push'](_0x5ea732['shift']());}};_0x1d3498(++_0x992d68);}(_0x14bf,0x95));var _0xf14b=function(_0x4703aa,_0x1ff23e){_0x4703aa=_0x4703aa-0x0;var _0x37ca84=_0x14bf[_0x4703aa];return _0x37ca84;};'use strict';var _=require('lodash');var util=require(_0xf14b('0x0'));var logger=require(_0xf14b('0x1'))(_0xf14b('0x2'));var moment=require(_0xf14b('0x3'));var BPromise=require(_0xf14b('0x4'));var rp=require(_0xf14b('0x5'));var fs=require('fs');var path=require(_0xf14b('0x6'));var rimraf=require(_0xf14b('0x7'));var config=require(_0xf14b('0x8'));var attributes=require(_0xf14b('0x9'));var integrations=require(_0xf14b('0xa'));module[_0xf14b('0xb')]=function(_0x2a667c,_0x284ca9){return _0x2a667c[_0xf14b('0xc')](_0xf14b('0xd'),attributes,{'tableName':_0xf14b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12b4=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','moment','bluebird','request-promise'];(function(_0x4feecd,_0x54a3de){var _0x5eb20a=function(_0x144626){while(--_0x144626){_0x4feecd['push'](_0x4feecd['shift']());}};_0x5eb20a(++_0x54a3de);}(_0x12b4,0xdf));var _0x412b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x12b4[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x412b('0x0'));var util=require(_0x412b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x412b('0x2'));var BPromise=require(_0x412b('0x3'));var rp=require(_0x412b('0x4'));var fs=require('fs');var path=require(_0x412b('0x5'));var rimraf=require(_0x412b('0x6'));var config=require(_0x412b('0x7'));var attributes=require(_0x412b('0x8'));var integrations=require(_0x412b('0x9'));module[_0x412b('0xa')]=function(_0x3340d9,_0x280697){return _0x3340d9['define']('ZendeskAccount',attributes,{'tableName':_0x412b('0xb'),'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 debea4c..d8faeec 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 _0x48d1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowZendeskAccount','ZendeskAccount','find','lodash','util'];(function(_0x2ffded,_0x3c27eb){var _0x196459=function(_0x196cb0){while(--_0x196cb0){_0x2ffded['push'](_0x2ffded['shift']());}};_0x196459(++_0x3c27eb);}(_0x48d1,0x170));var _0x148d=function(_0x30650a,_0x443118){_0x30650a=_0x30650a-0x0;var _0x2fc141=_0x48d1[_0x30650a];return _0x2fc141;};'use strict';var _=require(_0x148d('0x0'));var util=require(_0x148d('0x1'));var moment=require('moment');var BPromise=require(_0x148d('0x2'));var rs=require(_0x148d('0x3'));var fs=require('fs');var Redis=require(_0x148d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x148d('0x5'));var logger=require(_0x148d('0x6'))(_0x148d('0x7'));var config=require(_0x148d('0x8'));var jayson=require(_0x148d('0x9'));var client=jayson[_0x148d('0xa')][_0x148d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14991a,_0x2eb57a,_0x686798){return new BPromise(function(_0x5bd8d6,_0x15f567){return client['request'](_0x14991a,_0x686798)[_0x148d('0xc')](function(_0xc9be11){logger[_0x148d('0xd')](_0x148d('0xe'),_0x2eb57a,_0x148d('0xf'));logger['debug'](_0x148d('0x10'),_0x2eb57a,'request\x20sent',JSON[_0x148d('0x11')](_0xc9be11));if(_0xc9be11[_0x148d('0x12')]){if(_0xc9be11['error'][_0x148d('0x13')]===0x1f4){logger[_0x148d('0x12')](_0x148d('0xe'),_0x2eb57a,_0xc9be11[_0x148d('0x12')][_0x148d('0x14')]);return _0x15f567(_0xc9be11[_0x148d('0x12')][_0x148d('0x14')]);}logger[_0x148d('0x12')](_0x148d('0xe'),_0x2eb57a,_0xc9be11['error'][_0x148d('0x14')]);return _0x5bd8d6(_0xc9be11[_0x148d('0x12')][_0x148d('0x14')]);}else{logger[_0x148d('0xd')](_0x148d('0xe'),_0x2eb57a,_0x148d('0xf'));_0x5bd8d6(_0xc9be11[_0x148d('0x15')]['message']);}})['catch'](function(_0x2f99ef){logger[_0x148d('0x12')](_0x148d('0xe'),_0x2eb57a,_0x2f99ef);_0x15f567(_0x2f99ef);});});}exports[_0x148d('0x16')]=function(_0x1710cc){var _0x31d750=this;return new Promise(function(_0x5b29e6,_0x29a9ae){return db['ZendeskAccount'][_0x148d('0x17')]({'raw':_0x1710cc[_0x148d('0x18')]?_0x1710cc[_0x148d('0x18')][_0x148d('0x19')]===undefined?!![]:![]:!![],'where':_0x1710cc[_0x148d('0x18')]?_0x1710cc['options'][_0x148d('0x1a')]||null:null,'attributes':_0x1710cc[_0x148d('0x18')]?_0x1710cc[_0x148d('0x18')][_0x148d('0x1b')]||null:null,'limit':_0x1710cc[_0x148d('0x18')]?_0x1710cc[_0x148d('0x18')][_0x148d('0x1c')]||null:null,'include':_0x1710cc[_0x148d('0x18')]?_0x1710cc[_0x148d('0x18')][_0x148d('0x1d')]?_[_0x148d('0x1e')](_0x1710cc[_0x148d('0x18')][_0x148d('0x1d')],function(_0x54ba3c){return{'model':db[_0x54ba3c['model']],'as':_0x54ba3c['as'],'attributes':_0x54ba3c[_0x148d('0x1b')],'include':_0x54ba3c['include']?_['map'](_0x54ba3c[_0x148d('0x1d')],function(_0x735e0b){return{'model':db[_0x735e0b[_0x148d('0x1f')]],'as':_0x735e0b['as'],'attributes':_0x735e0b['attributes'],'include':_0x735e0b[_0x148d('0x1d')]?_[_0x148d('0x1e')](_0x735e0b[_0x148d('0x1d')],function(_0x462671){return{'model':db[_0x462671[_0x148d('0x1f')]],'as':_0x462671['as'],'attributes':_0x462671[_0x148d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x148d('0xc')](function(_0x3c10f2){logger[_0x148d('0xd')](_0x148d('0x16'),_0x1710cc);logger[_0x148d('0x20')](_0x148d('0x16'),_0x1710cc,JSON[_0x148d('0x11')](_0x3c10f2));_0x5b29e6(_0x3c10f2);})[_0x148d('0x21')](function(_0x4ef5bf){logger[_0x148d('0x12')](_0x148d('0x16'),_0x4ef5bf[_0x148d('0x14')],_0x1710cc);_0x29a9ae(_0x31d750[_0x148d('0x12')](0x1f4,_0x4ef5bf[_0x148d('0x14')]));});});};exports[_0x148d('0x22')]=function(_0x45ea84){var _0x4fd4f2=this;return new Promise(function(_0x337bd8,_0x28a1e6){return db[_0x148d('0x23')][_0x148d('0x24')]({'raw':_0x45ea84[_0x148d('0x18')]?_0x45ea84[_0x148d('0x18')][_0x148d('0x19')]===undefined?!![]:![]:!![],'where':_0x45ea84['options']?_0x45ea84['options'][_0x148d('0x1a')]||null:null,'attributes':_0x45ea84[_0x148d('0x18')]?_0x45ea84[_0x148d('0x18')][_0x148d('0x1b')]||null:null,'include':_0x45ea84['options']?_0x45ea84[_0x148d('0x18')][_0x148d('0x1d')]?_[_0x148d('0x1e')](_0x45ea84[_0x148d('0x18')]['include'],function(_0x3697ab){return{'model':db[_0x3697ab[_0x148d('0x1f')]],'as':_0x3697ab['as'],'attributes':_0x3697ab[_0x148d('0x1b')],'include':_0x3697ab[_0x148d('0x1d')]?_['map'](_0x3697ab[_0x148d('0x1d')],function(_0x4515b8){return{'model':db[_0x4515b8[_0x148d('0x1f')]],'as':_0x4515b8['as'],'attributes':_0x4515b8[_0x148d('0x1b')],'include':_0x4515b8[_0x148d('0x1d')]?_['map'](_0x4515b8[_0x148d('0x1d')],function(_0x411d79){return{'model':db[_0x411d79[_0x148d('0x1f')]],'as':_0x411d79['as'],'attributes':_0x411d79[_0x148d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x148d('0xc')](function(_0x3c1b3d){logger[_0x148d('0xd')](_0x148d('0x22'),_0x45ea84);logger[_0x148d('0x20')]('ShowZendeskAccount',_0x45ea84,JSON['stringify'](_0x3c1b3d));_0x337bd8(_0x3c1b3d);})[_0x148d('0x21')](function(_0x5991ae){logger['error']('ShowZendeskAccount',_0x5991ae['message'],_0x45ea84);_0x28a1e6(_0x4fd4f2[_0x148d('0x12')](0x1f4,_0x5991ae['message']));});});}; \ No newline at end of file +var _0x6a10=['then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetZendeskAccount','findAll','options','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x3da938,_0x25797d){var _0x2b2768=function(_0x58d079){while(--_0x58d079){_0x3da938['push'](_0x3da938['shift']());}};_0x2b2768(++_0x25797d);}(_0x6a10,0xe3));var _0x06a1=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x6a10[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x06a1('0x0'));var BPromise=require(_0x06a1('0x1'));var rs=require(_0x06a1('0x2'));var fs=require('fs');var Redis=require(_0x06a1('0x3'));var db=require(_0x06a1('0x4'))['db'];var utils=require(_0x06a1('0x5'));var logger=require(_0x06a1('0x6'))(_0x06a1('0x7'));var config=require(_0x06a1('0x8'));var jayson=require(_0x06a1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5259a9,_0x2d3577,_0x3451cb){return new BPromise(function(_0x3fdf82,_0x1cbc29){return client[_0x06a1('0xa')](_0x5259a9,_0x3451cb)[_0x06a1('0xb')](function(_0x186c96){logger[_0x06a1('0xc')](_0x06a1('0xd'),_0x2d3577,'request\x20sent');logger[_0x06a1('0xe')](_0x06a1('0xf'),_0x2d3577,'request\x20sent',JSON[_0x06a1('0x10')](_0x186c96));if(_0x186c96['error']){if(_0x186c96[_0x06a1('0x11')]['code']===0x1f4){logger[_0x06a1('0x11')](_0x06a1('0xd'),_0x2d3577,_0x186c96['error']['message']);return _0x1cbc29(_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);}logger[_0x06a1('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2d3577,_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);return _0x3fdf82(_0x186c96[_0x06a1('0x11')][_0x06a1('0x12')]);}else{logger[_0x06a1('0xc')](_0x06a1('0xd'),_0x2d3577,_0x06a1('0x13'));_0x3fdf82(_0x186c96[_0x06a1('0x14')][_0x06a1('0x12')]);}})[_0x06a1('0x15')](function(_0x519b47){logger[_0x06a1('0x11')](_0x06a1('0xd'),_0x2d3577,_0x519b47);_0x1cbc29(_0x519b47);});});}exports[_0x06a1('0x16')]=function(_0x274814){var _0x10f1bd=this;return new Promise(function(_0x3c5e71,_0x54cc57){return db['ZendeskAccount'][_0x06a1('0x17')]({'raw':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')]['where']||null:null,'attributes':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')][_0x06a1('0x19')]||null:null,'limit':_0x274814[_0x06a1('0x18')]?_0x274814[_0x06a1('0x18')][_0x06a1('0x1a')]||null:null,'include':_0x274814['options']?_0x274814[_0x06a1('0x18')][_0x06a1('0x1b')]?_[_0x06a1('0x1c')](_0x274814['options'][_0x06a1('0x1b')],function(_0x1a2462){return{'model':db[_0x1a2462['model']],'as':_0x1a2462['as'],'attributes':_0x1a2462[_0x06a1('0x19')],'include':_0x1a2462[_0x06a1('0x1b')]?_['map'](_0x1a2462['include'],function(_0x344bff){return{'model':db[_0x344bff[_0x06a1('0x1d')]],'as':_0x344bff['as'],'attributes':_0x344bff['attributes'],'include':_0x344bff[_0x06a1('0x1b')]?_['map'](_0x344bff[_0x06a1('0x1b')],function(_0x350894){return{'model':db[_0x350894[_0x06a1('0x1d')]],'as':_0x350894['as'],'attributes':_0x350894[_0x06a1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x06a1('0xb')](function(_0x4e583f){logger[_0x06a1('0xc')](_0x06a1('0x16'),_0x274814);logger[_0x06a1('0xe')]('GetZendeskAccount',_0x274814,JSON[_0x06a1('0x10')](_0x4e583f));_0x3c5e71(_0x4e583f);})[_0x06a1('0x15')](function(_0x22819e){logger[_0x06a1('0x11')](_0x06a1('0x16'),_0x22819e[_0x06a1('0x12')],_0x274814);_0x54cc57(_0x10f1bd[_0x06a1('0x11')](0x1f4,_0x22819e['message']));});});};exports[_0x06a1('0x1e')]=function(_0x2732fd){var _0x58bcc6=this;return new Promise(function(_0x23ade6,_0x45adb4){return db[_0x06a1('0x1f')][_0x06a1('0x20')]({'raw':_0x2732fd['options']?_0x2732fd[_0x06a1('0x18')][_0x06a1('0x21')]===undefined?!![]:![]:!![],'where':_0x2732fd[_0x06a1('0x18')]?_0x2732fd[_0x06a1('0x18')]['where']||null:null,'attributes':_0x2732fd[_0x06a1('0x18')]?_0x2732fd[_0x06a1('0x18')][_0x06a1('0x19')]||null:null,'include':_0x2732fd['options']?_0x2732fd['options'][_0x06a1('0x1b')]?_[_0x06a1('0x1c')](_0x2732fd[_0x06a1('0x18')][_0x06a1('0x1b')],function(_0x117ac7){return{'model':db[_0x117ac7['model']],'as':_0x117ac7['as'],'attributes':_0x117ac7[_0x06a1('0x19')],'include':_0x117ac7['include']?_[_0x06a1('0x1c')](_0x117ac7[_0x06a1('0x1b')],function(_0x46343d){return{'model':db[_0x46343d[_0x06a1('0x1d')]],'as':_0x46343d['as'],'attributes':_0x46343d[_0x06a1('0x19')],'include':_0x46343d['include']?_[_0x06a1('0x1c')](_0x46343d[_0x06a1('0x1b')],function(_0x51fc13){return{'model':db[_0x51fc13[_0x06a1('0x1d')]],'as':_0x51fc13['as'],'attributes':_0x51fc13[_0x06a1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1639c4){logger[_0x06a1('0xc')]('ShowZendeskAccount',_0x2732fd);logger[_0x06a1('0xe')](_0x06a1('0x1e'),_0x2732fd,JSON[_0x06a1('0x10')](_0x1639c4));_0x23ade6(_0x1639c4);})[_0x06a1('0x15')](function(_0x12462d){logger[_0x06a1('0x11')](_0x06a1('0x1e'),_0x12462d[_0x06a1('0x12')],_0x2732fd);_0x45adb4(_0x58bcc6[_0x06a1('0x11')](0x1f4,_0x12462d[_0x06a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8469929..d6332b7 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(_0x55976e,_0x27e156){var _0x169ee6=function(_0x34b8c3){while(--_0x34b8c3){_0x55976e['push'](_0x55976e['shift']());}};_0x169ee6(++_0x27e156);}(_0xac4a,0x13f));var _0xaac4=function(_0x1b4c34,_0x32ae6a){_0x1b4c34=_0x1b4c34-0x0;var _0x19acff=_0xac4a[_0x1b4c34];return _0x19acff;};'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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x368542,_0x15a971){var _0x56cf8f=function(_0x2141dd){while(--_0x2141dd){_0x368542['push'](_0x368542['shift']());}};_0x56cf8f(++_0x15a971);}(_0x087b,0x11a));var _0xb087=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x087b[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2c9ca46..4c31a8f 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 _0x11f6=['exports','STRING'];(function(_0x3e9ee2,_0x2d2ffb){var _0x342d8b=function(_0x3da46e){while(--_0x3da46e){_0x3e9ee2['push'](_0x3e9ee2['shift']());}};_0x342d8b(++_0x2d2ffb);}(_0x11f6,0x1d2));var _0x611f=function(_0x5c05cb,_0x517ace){_0x5c05cb=_0x5c05cb-0x0;var _0x15b796=_0x11f6[_0x5c05cb];return _0x15b796;};'use strict';var Sequelize=require('sequelize');module[_0x611f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x611f('0x1')]}}; \ No newline at end of file +var _0x504a=['exports','STRING'];(function(_0x2dd2ca,_0x3f4560){var _0x3bd7aa=function(_0x10e8f5){while(--_0x10e8f5){_0x2dd2ca['push'](_0x2dd2ca['shift']());}};_0x3bd7aa(++_0x3f4560);}(_0x504a,0x1ba));var _0xa504=function(_0x5b17fb,_0x62f3cf){_0x5b17fb=_0x5b17fb-0x0;var _0x5cf80b=_0x504a[_0x5b17fb];return _0x5cf80b;};'use strict';var Sequelize=require('sequelize');module[_0xa504('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa504('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0131dbb..8c1d704 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 _0x2926=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','keys','find','create','body','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2926,0x95));var _0x6292=function(_0x1249f4,_0x27226c){_0x1249f4=_0x1249f4-0x0;var _0x47c8a9=_0x2926[_0x1249f4];return _0x47c8a9;};'use strict';var emlformat=require(_0x6292('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6292('0x1'));var rp=require(_0x6292('0x2'));var moment=require(_0x6292('0x3'));var BPromise=require(_0x6292('0x4'));var Mustache=require('mustache');var util=require(_0x6292('0x5'));var path=require(_0x6292('0x6'));var sox=require(_0x6292('0x7'));var csv=require(_0x6292('0x8'));var ejs=require(_0x6292('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6292('0xa'));var squel=require(_0x6292('0xb'));var crypto=require(_0x6292('0xc'));var jsforce=require(_0x6292('0xd'));var deskjs=require(_0x6292('0xe'));var toCsv=require(_0x6292('0x8'));var querystring=require(_0x6292('0xf'));var Papa=require('papaparse');var Redis=require(_0x6292('0x10'));var authService=require(_0x6292('0x11'));var qs=require(_0x6292('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6292('0x13'))(_0x6292('0x14'));var utils=require(_0x6292('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6292('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2474,_0x52d95c){_0x52d95c=_0x52d95c||0xcc;return function(_0x7cb321){if(_0x7cb321){return _0x4f2474[_0x6292('0x17')](_0x52d95c);}return _0x4f2474['status'](_0x52d95c)[_0x6292('0x18')]();};}function respondWithResult(_0x46dd56,_0x1a7fa2){_0x1a7fa2=_0x1a7fa2||0xc8;return function(_0x523e38){if(_0x523e38){return _0x46dd56[_0x6292('0x19')](_0x1a7fa2)[_0x6292('0x1a')](_0x523e38);}};}function respondWithFilteredResult(_0x5a1abb,_0x1b0af4){return function(_0x530edb){if(_0x530edb){var _0x4e2058=typeof _0x1b0af4[_0x6292('0x1b')]==='undefined'&&typeof _0x1b0af4[_0x6292('0x1c')]===_0x6292('0x1d');var _0x1e9c61=_0x530edb[_0x6292('0x1e')];var _0x54d7da=_0x4e2058?0x0:_0x1b0af4['offset'];var _0x3dcc05=_0x4e2058?_0x530edb[_0x6292('0x1e')]:_0x1b0af4['offset']+_0x1b0af4[_0x6292('0x1c')];var _0x596c25;if(_0x3dcc05>=_0x1e9c61){_0x3dcc05=_0x1e9c61;_0x596c25=0xc8;}else{_0x596c25=0xce;}_0x5a1abb[_0x6292('0x19')](_0x596c25);return _0x5a1abb[_0x6292('0x1f')](_0x6292('0x20'),_0x54d7da+'-'+_0x3dcc05+'/'+_0x1e9c61)['json'](_0x530edb);}return null;};}function patchUpdates(_0x1adb95){return function(_0x511582){try{jsonpatch[_0x6292('0x21')](_0x511582,_0x1adb95,!![]);}catch(_0x32c6cd){return BPromise[_0x6292('0x22')](_0x32c6cd);}return _0x511582['save']();};}function saveUpdates(_0x5044f0,_0x55b2d4){return function(_0x527c63){if(_0x527c63){return _0x527c63[_0x6292('0x23')](_0x5044f0)[_0x6292('0x24')](function(_0x2b2946){return _0x2b2946;});}return null;};}function removeEntity(_0x3fcf38,_0x3fa83c){return function(_0x1d8c99){if(_0x1d8c99){return _0x1d8c99[_0x6292('0x25')]()[_0x6292('0x24')](function(){_0x3fcf38[_0x6292('0x19')](0xcc)[_0x6292('0x18')]();});}};}function handleEntityNotFound(_0xe0b1b9,_0x72dadc){return function(_0x4d70db){if(!_0x4d70db){_0xe0b1b9['sendStatus'](0x194);}return _0x4d70db;};}function handleError(_0x58f6a5,_0x15ee8c){_0x15ee8c=_0x15ee8c||0x1f4;return function(_0x289f08){logger[_0x6292('0x26')](_0x289f08[_0x6292('0x27')]);if(_0x289f08['name']){delete _0x289f08[_0x6292('0x28')];}_0x58f6a5[_0x6292('0x19')](_0x15ee8c)['send'](_0x289f08);};}exports[_0x6292('0x29')]=function(_0x20bca9,_0x521f53){var _0xa4b67b={},_0x4c331a={},_0x2c1bdc={'count':0x0,'rows':[]};var _0x2ba3e9=_[_0x6292('0x2a')](db[_0x6292('0x2b')][_0x6292('0x2c')],function(_0x10f65d){return{'name':_0x10f65d['fieldName'],'type':_0x10f65d[_0x6292('0x2d')][_0x6292('0x2e')]};});_0x4c331a[_0x6292('0x2f')]=_['map'](_0x2ba3e9,_0x6292('0x28'));_0x4c331a[_0x6292('0x30')]=_['keys'](_0x20bca9['query']);_0x4c331a['filters']=_['intersection'](_0x4c331a[_0x6292('0x2f')],_0x4c331a['query']);_0xa4b67b[_0x6292('0x31')]=_[_0x6292('0x32')](_0x4c331a[_0x6292('0x2f')],qs['fields'](_0x20bca9[_0x6292('0x30')][_0x6292('0x33')]));_0xa4b67b[_0x6292('0x31')]=_0xa4b67b[_0x6292('0x31')][_0x6292('0x34')]?_0xa4b67b['attributes']:_0x4c331a[_0x6292('0x2f')];if(!_0x20bca9[_0x6292('0x30')][_0x6292('0x35')](_0x6292('0x36'))){_0xa4b67b['limit']=qs[_0x6292('0x1c')](_0x20bca9['query'][_0x6292('0x1c')]);_0xa4b67b[_0x6292('0x1b')]=qs[_0x6292('0x1b')](_0x20bca9['query'][_0x6292('0x1b')]);}_0xa4b67b[_0x6292('0x37')]=qs[_0x6292('0x38')](_0x20bca9[_0x6292('0x30')][_0x6292('0x38')]);_0xa4b67b[_0x6292('0x39')]=qs[_0x6292('0x3a')](_[_0x6292('0x3b')](_0x20bca9[_0x6292('0x30')],_0x4c331a[_0x6292('0x3a')]),_0x2ba3e9);if(_0x20bca9[_0x6292('0x30')]['filter']){_0xa4b67b[_0x6292('0x39')]=_[_0x6292('0x3c')](_0xa4b67b[_0x6292('0x39')],{'$or':_[_0x6292('0x2a')](_0x2ba3e9,function(_0x435eec){if(_0x435eec['type']!=='VIRTUAL'){var _0x502fa3={};_0x502fa3[_0x435eec[_0x6292('0x28')]]={'$like':'%'+_0x20bca9['query'][_0x6292('0x3d')]+'%'};return _0x502fa3;}})});}_0xa4b67b=_[_0x6292('0x3c')]({},_0xa4b67b,_0x20bca9[_0x6292('0x3e')]);var _0x413c82={'where':_0xa4b67b[_0x6292('0x39')]};return db[_0x6292('0x2b')][_0x6292('0x1e')](_0x413c82)[_0x6292('0x24')](function(_0xceae35){_0x2c1bdc[_0x6292('0x1e')]=_0xceae35;if(_0x20bca9[_0x6292('0x30')][_0x6292('0x3f')]){_0xa4b67b[_0x6292('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x6292('0x41')](_0xa4b67b);})['then'](function(_0x4a6518){_0x2c1bdc['rows']=_0x4a6518;return _0x2c1bdc;})[_0x6292('0x24')](respondWithFilteredResult(_0x521f53,_0xa4b67b))[_0x6292('0x42')](handleError(_0x521f53,null));};exports['show']=function(_0x2ea15d,_0x2b910e){var _0x3f95cf={'raw':![],'where':{'id':_0x2ea15d['params']['id']}},_0x5841f5={};_0x5841f5[_0x6292('0x2f')]=_[_0x6292('0x43')](db[_0x6292('0x2b')][_0x6292('0x2c')]);_0x5841f5[_0x6292('0x30')]=_[_0x6292('0x43')](_0x2ea15d[_0x6292('0x30')]);_0x5841f5[_0x6292('0x3a')]=_[_0x6292('0x32')](_0x5841f5[_0x6292('0x2f')],_0x5841f5['query']);_0x3f95cf[_0x6292('0x31')]=_['intersection'](_0x5841f5[_0x6292('0x2f')],qs['fields'](_0x2ea15d['query'][_0x6292('0x33')]));_0x3f95cf[_0x6292('0x31')]=_0x3f95cf['attributes'][_0x6292('0x34')]?_0x3f95cf[_0x6292('0x31')]:_0x5841f5[_0x6292('0x2f')];if(_0x2ea15d[_0x6292('0x30')]['includeAll']){_0x3f95cf['include']=[{'all':!![]}];}_0x3f95cf=_[_0x6292('0x3c')]({},_0x3f95cf,_0x2ea15d[_0x6292('0x3e')]);return db['ZendeskConfiguration'][_0x6292('0x44')](_0x3f95cf)[_0x6292('0x24')](handleEntityNotFound(_0x2b910e,null))[_0x6292('0x24')](respondWithResult(_0x2b910e,null))[_0x6292('0x42')](handleError(_0x2b910e,null));};exports[_0x6292('0x45')]=function(_0x456deb,_0xe0a95f){return db[_0x6292('0x2b')][_0x6292('0x45')](_0x456deb[_0x6292('0x46')],{})[_0x6292('0x24')](respondWithResult(_0xe0a95f,0xc9))[_0x6292('0x42')](handleError(_0xe0a95f,null));};exports['update']=function(_0x47fdf9,_0x49bea3){if(_0x47fdf9[_0x6292('0x46')]['id']){delete _0x47fdf9['body']['id'];}return db[_0x6292('0x2b')][_0x6292('0x44')]({'where':{'id':_0x47fdf9[_0x6292('0x47')]['id']}})[_0x6292('0x24')](handleEntityNotFound(_0x49bea3,null))[_0x6292('0x24')](saveUpdates(_0x47fdf9[_0x6292('0x46')],null))[_0x6292('0x24')](respondWithResult(_0x49bea3,null))[_0x6292('0x42')](handleError(_0x49bea3,null));};exports['destroy']=function(_0x1c57e7,_0x10ab39){return db['ZendeskConfiguration']['find']({'where':{'id':_0x1c57e7[_0x6292('0x47')]['id']}})['then'](handleEntityNotFound(_0x10ab39,null))[_0x6292('0x24')](removeEntity(_0x10ab39,null))[_0x6292('0x42')](handleError(_0x10ab39,null));};exports[_0x6292('0x48')]=function(_0x46857b,_0x812394,_0x3503dd){var _0x4ebd63={};var _0x3261a5={};var _0x29a098;var _0x33ae4d;return db[_0x6292('0x2b')][_0x6292('0x49')]({'where':{'id':_0x46857b['params']['id']}})[_0x6292('0x24')](handleEntityNotFound(_0x812394,null))[_0x6292('0x24')](function(_0x192000){if(_0x192000){_0x29a098=_0x192000;_0x3261a5[_0x6292('0x2f')]=_[_0x6292('0x43')](db[_0x6292('0x4a')][_0x6292('0x2c')]);_0x3261a5['query']=_[_0x6292('0x43')](_0x46857b[_0x6292('0x30')]);_0x3261a5[_0x6292('0x3a')]=_[_0x6292('0x32')](_0x3261a5[_0x6292('0x2f')],_0x3261a5[_0x6292('0x30')]);_0x4ebd63[_0x6292('0x31')]=_['intersection'](_0x3261a5[_0x6292('0x2f')],qs[_0x6292('0x33')](_0x46857b['query'][_0x6292('0x33')]));_0x4ebd63[_0x6292('0x31')]=_0x4ebd63['attributes']['length']?_0x4ebd63[_0x6292('0x31')]:_0x3261a5['model'];_0x4ebd63[_0x6292('0x37')]=qs[_0x6292('0x38')](_0x46857b[_0x6292('0x30')]['sort']);_0x4ebd63[_0x6292('0x39')]=qs['filters'](_['pick'](_0x46857b[_0x6292('0x30')],_0x3261a5[_0x6292('0x3a')]));if(_0x46857b[_0x6292('0x30')][_0x6292('0x3d')]){_0x4ebd63['where']=_[_0x6292('0x3c')](_0x4ebd63[_0x6292('0x39')],{'$or':_[_0x6292('0x2a')](_0x4ebd63[_0x6292('0x31')],function(_0x2b5600){var _0xd08aa8={};_0xd08aa8[_0x2b5600]={'$like':'%'+_0x46857b['query'][_0x6292('0x3d')]+'%'};return _0xd08aa8;})});}_0x4ebd63=_[_0x6292('0x3c')]({},_0x4ebd63,_0x46857b[_0x6292('0x3e')]);return _0x29a098[_0x6292('0x48')](_0x4ebd63);}})['then'](function(_0x1faf1c){if(_0x1faf1c){_0x33ae4d=_0x1faf1c[_0x6292('0x34')];if(!_0x46857b[_0x6292('0x30')]['hasOwnProperty']('nolimit')){_0x4ebd63[_0x6292('0x1c')]=qs['limit'](_0x46857b[_0x6292('0x30')][_0x6292('0x1c')]);_0x4ebd63[_0x6292('0x1b')]=qs['offset'](_0x46857b[_0x6292('0x30')][_0x6292('0x1b')]);}return _0x29a098[_0x6292('0x48')](_0x4ebd63);}})[_0x6292('0x24')](function(_0x967aa3){if(_0x967aa3){return _0x967aa3?{'count':_0x33ae4d,'rows':_0x967aa3}:null;}})[_0x6292('0x24')](respondWithResult(_0x812394,null))[_0x6292('0x42')](handleError(_0x812394,null));};exports['getSubjects']=function(_0x6ec871,_0x6079d2,_0x3faf64){var _0x1a7871={};var _0x879ae9={};var _0x409bb1;var _0x12c646;return db[_0x6292('0x2b')][_0x6292('0x49')]({'where':{'id':_0x6ec871[_0x6292('0x47')]['id']}})[_0x6292('0x24')](handleEntityNotFound(_0x6079d2,null))[_0x6292('0x24')](function(_0x49f00f){if(_0x49f00f){_0x409bb1=_0x49f00f;_0x879ae9[_0x6292('0x2f')]=_[_0x6292('0x43')](db[_0x6292('0x4a')]['rawAttributes']);_0x879ae9[_0x6292('0x30')]=_[_0x6292('0x43')](_0x6ec871[_0x6292('0x30')]);_0x879ae9[_0x6292('0x3a')]=_[_0x6292('0x32')](_0x879ae9[_0x6292('0x2f')],_0x879ae9[_0x6292('0x30')]);_0x1a7871['attributes']=_[_0x6292('0x32')](_0x879ae9[_0x6292('0x2f')],qs[_0x6292('0x33')](_0x6ec871['query'][_0x6292('0x33')]));_0x1a7871[_0x6292('0x31')]=_0x1a7871[_0x6292('0x31')]['length']?_0x1a7871[_0x6292('0x31')]:_0x879ae9['model'];_0x1a7871[_0x6292('0x37')]=qs[_0x6292('0x38')](_0x6ec871[_0x6292('0x30')]['sort']);_0x1a7871[_0x6292('0x39')]=qs[_0x6292('0x3a')](_[_0x6292('0x3b')](_0x6ec871[_0x6292('0x30')],_0x879ae9['filters']));if(_0x6ec871[_0x6292('0x30')][_0x6292('0x3d')]){_0x1a7871[_0x6292('0x39')]=_[_0x6292('0x3c')](_0x1a7871['where'],{'$or':_[_0x6292('0x2a')](_0x1a7871[_0x6292('0x31')],function(_0x4046b6){var _0x56a953={};_0x56a953[_0x4046b6]={'$like':'%'+_0x6ec871[_0x6292('0x30')][_0x6292('0x3d')]+'%'};return _0x56a953;})});}_0x1a7871=_[_0x6292('0x3c')]({},_0x1a7871,_0x6ec871[_0x6292('0x3e')]);return _0x409bb1[_0x6292('0x4b')](_0x1a7871);}})['then'](function(_0x1bb33f){if(_0x1bb33f){_0x12c646=_0x1bb33f[_0x6292('0x34')];if(!_0x6ec871[_0x6292('0x30')][_0x6292('0x35')](_0x6292('0x36'))){_0x1a7871[_0x6292('0x1c')]=qs['limit'](_0x6ec871[_0x6292('0x30')][_0x6292('0x1c')]);_0x1a7871['offset']=qs[_0x6292('0x1b')](_0x6ec871[_0x6292('0x30')]['offset']);}return _0x409bb1[_0x6292('0x4b')](_0x1a7871);}})[_0x6292('0x24')](function(_0x2b5940){if(_0x2b5940){return _0x2b5940?{'count':_0x12c646,'rows':_0x2b5940}:null;}})['then'](respondWithResult(_0x6079d2,null))['catch'](handleError(_0x6079d2,null));};exports[_0x6292('0x4c')]=function(_0x348c7b,_0x43dc29,_0x3c93f2){var _0x11242e={};var _0x59c461={};var _0xc6bbf9;var _0xdb0cba;return db[_0x6292('0x2b')][_0x6292('0x49')]({'where':{'id':_0x348c7b[_0x6292('0x47')]['id']}})[_0x6292('0x24')](handleEntityNotFound(_0x43dc29,null))[_0x6292('0x24')](function(_0x89d7ef){if(_0x89d7ef){_0xc6bbf9=_0x89d7ef;_0x59c461['model']=_[_0x6292('0x43')](db['ZendeskField'][_0x6292('0x2c')]);_0x59c461[_0x6292('0x30')]=_['keys'](_0x348c7b[_0x6292('0x30')]);_0x59c461[_0x6292('0x3a')]=_[_0x6292('0x32')](_0x59c461[_0x6292('0x2f')],_0x59c461[_0x6292('0x30')]);_0x11242e[_0x6292('0x31')]=_['intersection'](_0x59c461[_0x6292('0x2f')],qs['fields'](_0x348c7b['query'][_0x6292('0x33')]));_0x11242e[_0x6292('0x31')]=_0x11242e[_0x6292('0x31')][_0x6292('0x34')]?_0x11242e['attributes']:_0x59c461[_0x6292('0x2f')];_0x11242e['order']=qs[_0x6292('0x38')](_0x348c7b['query'][_0x6292('0x38')]);_0x11242e[_0x6292('0x39')]=qs[_0x6292('0x3a')](_[_0x6292('0x3b')](_0x348c7b[_0x6292('0x30')],_0x59c461[_0x6292('0x3a')]));if(_0x348c7b[_0x6292('0x30')][_0x6292('0x3d')]){_0x11242e['where']=_[_0x6292('0x3c')](_0x11242e[_0x6292('0x39')],{'$or':_[_0x6292('0x2a')](_0x11242e[_0x6292('0x31')],function(_0x2e5a75){var _0xfbfc99={};_0xfbfc99[_0x2e5a75]={'$like':'%'+_0x348c7b[_0x6292('0x30')][_0x6292('0x3d')]+'%'};return _0xfbfc99;})});}_0x11242e=_[_0x6292('0x3c')]({},_0x11242e,_0x348c7b['options']);return _0xc6bbf9['getDescriptions'](_0x11242e);}})[_0x6292('0x24')](function(_0xe7cec4){if(_0xe7cec4){_0xdb0cba=_0xe7cec4[_0x6292('0x34')];if(!_0x348c7b['query'][_0x6292('0x35')](_0x6292('0x36'))){_0x11242e[_0x6292('0x1c')]=qs[_0x6292('0x1c')](_0x348c7b['query'][_0x6292('0x1c')]);_0x11242e[_0x6292('0x1b')]=qs[_0x6292('0x1b')](_0x348c7b[_0x6292('0x30')][_0x6292('0x1b')]);}return _0xc6bbf9['getDescriptions'](_0x11242e);}})['then'](function(_0x64af92){if(_0x64af92){return _0x64af92?{'count':_0xdb0cba,'rows':_0x64af92}:null;}})[_0x6292('0x24')](respondWithResult(_0x43dc29,null))[_0x6292('0x42')](handleError(_0x43dc29,null));};exports['getTags']=function(_0x20fa85,_0x4b376e,_0x1ad107){var _0x2d5a84={};var _0x377bf3={};var _0x16f2f6;var _0x221270;return db[_0x6292('0x2b')][_0x6292('0x49')]({'where':{'id':_0x20fa85[_0x6292('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b376e,null))[_0x6292('0x24')](function(_0x137dc6){if(_0x137dc6){_0x16f2f6=_0x137dc6;_0x377bf3['model']=_[_0x6292('0x43')](db[_0x6292('0x4d')][_0x6292('0x2c')]);_0x377bf3['query']=_[_0x6292('0x43')](_0x20fa85[_0x6292('0x30')]);_0x377bf3['filters']=_['intersection'](_0x377bf3['model'],_0x377bf3[_0x6292('0x30')]);_0x2d5a84[_0x6292('0x31')]=_['intersection'](_0x377bf3['model'],qs[_0x6292('0x33')](_0x20fa85['query'][_0x6292('0x33')]));_0x2d5a84[_0x6292('0x31')]=_0x2d5a84['attributes'][_0x6292('0x34')]?_0x2d5a84[_0x6292('0x31')]:_0x377bf3['model'];_0x2d5a84[_0x6292('0x37')]=qs[_0x6292('0x38')](_0x20fa85['query'][_0x6292('0x38')]);_0x2d5a84[_0x6292('0x39')]=qs[_0x6292('0x3a')](_[_0x6292('0x3b')](_0x20fa85[_0x6292('0x30')],_0x377bf3[_0x6292('0x3a')]));if(_0x20fa85[_0x6292('0x30')][_0x6292('0x3d')]){_0x2d5a84[_0x6292('0x39')]=_['merge'](_0x2d5a84[_0x6292('0x39')],{'$or':_[_0x6292('0x2a')](_0x2d5a84['attributes'],function(_0x24d7e9){var _0x38de79={};_0x38de79[_0x24d7e9]={'$like':'%'+_0x20fa85['query'][_0x6292('0x3d')]+'%'};return _0x38de79;})});}_0x2d5a84=_[_0x6292('0x3c')]({},_0x2d5a84,_0x20fa85[_0x6292('0x3e')]);return _0x16f2f6[_0x6292('0x4e')](_0x2d5a84);}})[_0x6292('0x24')](function(_0x44f151){if(_0x44f151){_0x221270=_0x44f151[_0x6292('0x34')];if(!_0x20fa85[_0x6292('0x30')][_0x6292('0x35')](_0x6292('0x36'))){_0x2d5a84['limit']=qs[_0x6292('0x1c')](_0x20fa85[_0x6292('0x30')]['limit']);_0x2d5a84['offset']=qs[_0x6292('0x1b')](_0x20fa85[_0x6292('0x30')][_0x6292('0x1b')]);}return _0x16f2f6['getTags'](_0x2d5a84);}})[_0x6292('0x24')](function(_0x461a22){if(_0x461a22){return _0x461a22?{'count':_0x221270,'rows':_0x461a22}:null;}})[_0x6292('0x24')](respondWithResult(_0x4b376e,null))[_0x6292('0x42')](handleError(_0x4b376e,null));};exports['setTags']=function(_0x270820,_0x17673e,_0x3b398f){if(_0x270820[_0x6292('0x46')]['id']){delete _0x270820['body']['id'];}return db['ZendeskConfiguration'][_0x6292('0x49')]({'where':{'id':_0x270820[_0x6292('0x47')]['id']}})[_0x6292('0x24')](handleEntityNotFound(_0x17673e,null))[_0x6292('0x24')](function(_0x60e032){if(_0x60e032){return _0x60e032[_0x6292('0x4f')](_0x270820['body'][_0x6292('0x50')]||[]);}return null;})[_0x6292('0x24')](respondWithResult(_0x17673e,null))[_0x6292('0x42')](handleError(_0x17673e,null));}; \ No newline at end of file +var _0xbdfc=['error','stack','name','send','map','ZendeskConfiguration','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','body','params','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x457d01,_0x35a354){var _0x107051=function(_0x199699){while(--_0x199699){_0x457d01['push'](_0x457d01['shift']());}};_0x107051(++_0x35a354);}(_0xbdfc,0x1d6));var _0xcbdf=function(_0x3e95e0,_0x814112){_0x3e95e0=_0x3e95e0-0x0;var _0x2761fb=_0xbdfc[_0x3e95e0];return _0x2761fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbdf('0x0'));var jsonpatch=require(_0xcbdf('0x1'));var rp=require(_0xcbdf('0x2'));var moment=require('moment');var BPromise=require(_0xcbdf('0x3'));var Mustache=require(_0xcbdf('0x4'));var util=require(_0xcbdf('0x5'));var path=require(_0xcbdf('0x6'));var sox=require(_0xcbdf('0x7'));var csv=require('to-csv');var ejs=require(_0xcbdf('0x8'));var fs=require('fs');var fs_extra=require(_0xcbdf('0x9'));var _=require(_0xcbdf('0xa'));var squel=require(_0xcbdf('0xb'));var crypto=require(_0xcbdf('0xc'));var jsforce=require(_0xcbdf('0xd'));var deskjs=require(_0xcbdf('0xe'));var toCsv=require(_0xcbdf('0xf'));var querystring=require(_0xcbdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xcbdf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcbdf('0x12'));var as=require(_0xcbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbdf('0x14'))(_0xcbdf('0x15'));var utils=require(_0xcbdf('0x16'));var config=require(_0xcbdf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbdf('0x18'))['db'];function respondWithStatusCode(_0x407858,_0xa5c5ba){_0xa5c5ba=_0xa5c5ba||0xcc;return function(_0x876c2d){if(_0x876c2d){return _0x407858[_0xcbdf('0x19')](_0xa5c5ba);}return _0x407858[_0xcbdf('0x1a')](_0xa5c5ba)[_0xcbdf('0x1b')]();};}function respondWithResult(_0x422b81,_0x24b363){_0x24b363=_0x24b363||0xc8;return function(_0x52b922){if(_0x52b922){return _0x422b81['status'](_0x24b363)['json'](_0x52b922);}};}function respondWithFilteredResult(_0x37d3b0,_0x385712){return function(_0x4589a1){if(_0x4589a1){var _0x4852b7=typeof _0x385712[_0xcbdf('0x1c')]===_0xcbdf('0x1d')&&typeof _0x385712[_0xcbdf('0x1e')]==='undefined';var _0x3bf937=_0x4589a1[_0xcbdf('0x1f')];var _0x48b5fc=_0x4852b7?0x0:_0x385712['offset'];var _0x3f6b1d=_0x4852b7?_0x4589a1[_0xcbdf('0x1f')]:_0x385712['offset']+_0x385712[_0xcbdf('0x1e')];var _0x5e8eab;if(_0x3f6b1d>=_0x3bf937){_0x3f6b1d=_0x3bf937;_0x5e8eab=0xc8;}else{_0x5e8eab=0xce;}_0x37d3b0[_0xcbdf('0x1a')](_0x5e8eab);return _0x37d3b0['set'](_0xcbdf('0x20'),_0x48b5fc+'-'+_0x3f6b1d+'/'+_0x3bf937)[_0xcbdf('0x21')](_0x4589a1);}return null;};}function patchUpdates(_0xaf6925){return function(_0x25e545){try{jsonpatch[_0xcbdf('0x22')](_0x25e545,_0xaf6925,!![]);}catch(_0x465a5b){return BPromise[_0xcbdf('0x23')](_0x465a5b);}return _0x25e545[_0xcbdf('0x24')]();};}function saveUpdates(_0x39a1cb,_0x2e63ae){return function(_0x5892b5){if(_0x5892b5){return _0x5892b5[_0xcbdf('0x25')](_0x39a1cb)[_0xcbdf('0x26')](function(_0x211929){return _0x211929;});}return null;};}function removeEntity(_0x15d58a,_0x20971a){return function(_0xb74b01){if(_0xb74b01){return _0xb74b01[_0xcbdf('0x27')]()[_0xcbdf('0x26')](function(){_0x15d58a[_0xcbdf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca94,_0x28a8b6){return function(_0x34dad0){if(!_0x34dad0){_0x41ca94[_0xcbdf('0x19')](0x194);}return _0x34dad0;};}function handleError(_0x25452b,_0x1ae32d){_0x1ae32d=_0x1ae32d||0x1f4;return function(_0x31b6bf){logger[_0xcbdf('0x28')](_0x31b6bf[_0xcbdf('0x29')]);if(_0x31b6bf[_0xcbdf('0x2a')]){delete _0x31b6bf[_0xcbdf('0x2a')];}_0x25452b[_0xcbdf('0x1a')](_0x1ae32d)[_0xcbdf('0x2b')](_0x31b6bf);};}exports['index']=function(_0x51c1de,_0x144e30){var _0x28f5b0={},_0x386825={},_0x5562fe={'count':0x0,'rows':[]};var _0x146ddd=_[_0xcbdf('0x2c')](db[_0xcbdf('0x2d')]['rawAttributes'],function(_0x58ef96){return{'name':_0x58ef96['fieldName'],'type':_0x58ef96[_0xcbdf('0x2e')][_0xcbdf('0x2f')]};});_0x386825[_0xcbdf('0x30')]=_['map'](_0x146ddd,_0xcbdf('0x2a'));_0x386825['query']=_[_0xcbdf('0x31')](_0x51c1de[_0xcbdf('0x32')]);_0x386825['filters']=_[_0xcbdf('0x33')](_0x386825[_0xcbdf('0x30')],_0x386825[_0xcbdf('0x32')]);_0x28f5b0[_0xcbdf('0x34')]=_['intersection'](_0x386825[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x28f5b0[_0xcbdf('0x34')]=_0x28f5b0[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x28f5b0[_0xcbdf('0x34')]:_0x386825[_0xcbdf('0x30')];if(!_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x28f5b0[_0xcbdf('0x1e')]=qs['limit'](_0x51c1de['query'][_0xcbdf('0x1e')]);_0x28f5b0[_0xcbdf('0x1c')]=qs[_0xcbdf('0x1c')](_0x51c1de[_0xcbdf('0x32')]['offset']);}_0x28f5b0[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x28f5b0[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x51c1de['query'],_0x386825[_0xcbdf('0x3c')]),_0x146ddd);if(_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3e')]){_0x28f5b0['where']=_[_0xcbdf('0x3f')](_0x28f5b0[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x146ddd,function(_0x578d5e){if(_0x578d5e[_0xcbdf('0x2e')]!==_0xcbdf('0x40')){var _0x67e75f={};_0x67e75f[_0x578d5e[_0xcbdf('0x2a')]]={'$like':'%'+_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x67e75f;}})});}_0x28f5b0=_['merge']({},_0x28f5b0,_0x51c1de[_0xcbdf('0x41')]);var _0x443d86={'where':_0x28f5b0[_0xcbdf('0x3b')]};return db['ZendeskConfiguration'][_0xcbdf('0x1f')](_0x443d86)['then'](function(_0x2b3476){_0x5562fe[_0xcbdf('0x1f')]=_0x2b3476;if(_0x51c1de[_0xcbdf('0x32')][_0xcbdf('0x42')]){_0x28f5b0[_0xcbdf('0x43')]=[{'all':!![]}];}return db[_0xcbdf('0x2d')][_0xcbdf('0x44')](_0x28f5b0);})[_0xcbdf('0x26')](function(_0x489b7d){_0x5562fe[_0xcbdf('0x45')]=_0x489b7d;return _0x5562fe;})[_0xcbdf('0x26')](respondWithFilteredResult(_0x144e30,_0x28f5b0))['catch'](handleError(_0x144e30,null));};exports[_0xcbdf('0x46')]=function(_0x39baa4,_0x21cb99){var _0x162c8b={'raw':![],'where':{'id':_0x39baa4['params']['id']}},_0x18db2d={};_0x18db2d[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db[_0xcbdf('0x2d')][_0xcbdf('0x47')]);_0x18db2d[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x39baa4['query']);_0x18db2d[_0xcbdf('0x3c')]=_['intersection'](_0x18db2d[_0xcbdf('0x30')],_0x18db2d[_0xcbdf('0x32')]);_0x162c8b[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x18db2d[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x39baa4['query'][_0xcbdf('0x35')]));_0x162c8b[_0xcbdf('0x34')]=_0x162c8b[_0xcbdf('0x34')]['length']?_0x162c8b[_0xcbdf('0x34')]:_0x18db2d[_0xcbdf('0x30')];if(_0x39baa4[_0xcbdf('0x32')][_0xcbdf('0x42')]){_0x162c8b[_0xcbdf('0x43')]=[{'all':!![]}];}_0x162c8b=_[_0xcbdf('0x3f')]({},_0x162c8b,_0x39baa4[_0xcbdf('0x41')]);return db[_0xcbdf('0x2d')][_0xcbdf('0x48')](_0x162c8b)['then'](handleEntityNotFound(_0x21cb99,null))[_0xcbdf('0x26')](respondWithResult(_0x21cb99,null))[_0xcbdf('0x49')](handleError(_0x21cb99,null));};exports['create']=function(_0x4b6d7b,_0x1e755c){return db[_0xcbdf('0x2d')]['create'](_0x4b6d7b[_0xcbdf('0x4a')],{})[_0xcbdf('0x26')](respondWithResult(_0x1e755c,0xc9))['catch'](handleError(_0x1e755c,null));};exports[_0xcbdf('0x25')]=function(_0x2b2418,_0x2211ea){if(_0x2b2418[_0xcbdf('0x4a')]['id']){delete _0x2b2418[_0xcbdf('0x4a')]['id'];}return db[_0xcbdf('0x2d')][_0xcbdf('0x48')]({'where':{'id':_0x2b2418['params']['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x2211ea,null))[_0xcbdf('0x26')](saveUpdates(_0x2b2418[_0xcbdf('0x4a')],null))[_0xcbdf('0x26')](respondWithResult(_0x2211ea,null))[_0xcbdf('0x49')](handleError(_0x2211ea,null));};exports[_0xcbdf('0x27')]=function(_0x2fd414,_0x2e6551){return db[_0xcbdf('0x2d')][_0xcbdf('0x48')]({'where':{'id':_0x2fd414[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x2e6551,null))['then'](removeEntity(_0x2e6551,null))[_0xcbdf('0x49')](handleError(_0x2e6551,null));};exports[_0xcbdf('0x4c')]=function(_0x2117c4,_0xd58707,_0x2e2ffa){var _0x22e16f={};var _0x4b7840={};var _0x132f3c;var _0x3c051a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2117c4[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0xd58707,null))[_0xcbdf('0x26')](function(_0x58b530){if(_0x58b530){_0x132f3c=_0x58b530;_0x4b7840['model']=_[_0xcbdf('0x31')](db[_0xcbdf('0x4d')]['rawAttributes']);_0x4b7840['query']=_[_0xcbdf('0x31')](_0x2117c4[_0xcbdf('0x32')]);_0x4b7840[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x4b7840[_0xcbdf('0x30')],_0x4b7840[_0xcbdf('0x32')]);_0x22e16f[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x4b7840[_0xcbdf('0x30')],qs['fields'](_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x22e16f[_0xcbdf('0x34')]=_0x22e16f[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x22e16f['attributes']:_0x4b7840['model'];_0x22e16f[_0xcbdf('0x39')]=qs['sort'](_0x2117c4['query'][_0xcbdf('0x3a')]);_0x22e16f[_0xcbdf('0x3b')]=qs['filters'](_[_0xcbdf('0x3d')](_0x2117c4[_0xcbdf('0x32')],_0x4b7840[_0xcbdf('0x3c')]));if(_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x3e')]){_0x22e16f[_0xcbdf('0x3b')]=_['merge'](_0x22e16f['where'],{'$or':_[_0xcbdf('0x2c')](_0x22e16f['attributes'],function(_0x1f56ac){var _0x3b027a={};_0x3b027a[_0x1f56ac]={'$like':'%'+_0x2117c4[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x3b027a;})});}_0x22e16f=_[_0xcbdf('0x3f')]({},_0x22e16f,_0x2117c4[_0xcbdf('0x41')]);return _0x132f3c[_0xcbdf('0x4c')](_0x22e16f);}})['then'](function(_0x5bb74d){if(_0x5bb74d){_0x3c051a=_0x5bb74d[_0xcbdf('0x36')];if(!_0x2117c4[_0xcbdf('0x32')]['hasOwnProperty']('nolimit')){_0x22e16f['limit']=qs[_0xcbdf('0x1e')](_0x2117c4[_0xcbdf('0x32')]['limit']);_0x22e16f[_0xcbdf('0x1c')]=qs['offset'](_0x2117c4['query'][_0xcbdf('0x1c')]);}return _0x132f3c['getFields'](_0x22e16f);}})['then'](function(_0x36038a){if(_0x36038a){return _0x36038a?{'count':_0x3c051a,'rows':_0x36038a}:null;}})[_0xcbdf('0x26')](respondWithResult(_0xd58707,null))[_0xcbdf('0x49')](handleError(_0xd58707,null));};exports['getSubjects']=function(_0x3eb99c,_0x235814,_0x52a898){var _0x2c13c6={};var _0x364221={};var _0x482b08;var _0x3cd8a1;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x3eb99c[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x235814,null))[_0xcbdf('0x26')](function(_0xaa6b50){if(_0xaa6b50){_0x482b08=_0xaa6b50;_0x364221['model']=_[_0xcbdf('0x31')](db[_0xcbdf('0x4d')]['rawAttributes']);_0x364221[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x3eb99c[_0xcbdf('0x32')]);_0x364221[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x364221[_0xcbdf('0x30')],_0x364221['query']);_0x2c13c6[_0xcbdf('0x34')]=_[_0xcbdf('0x33')](_0x364221['model'],qs[_0xcbdf('0x35')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x2c13c6['attributes']=_0x2c13c6[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x2c13c6['attributes']:_0x364221[_0xcbdf('0x30')];_0x2c13c6[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x2c13c6[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x3eb99c[_0xcbdf('0x32')],_0x364221[_0xcbdf('0x3c')]));if(_0x3eb99c['query'][_0xcbdf('0x3e')]){_0x2c13c6[_0xcbdf('0x3b')]=_[_0xcbdf('0x3f')](_0x2c13c6[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x2c13c6['attributes'],function(_0xadf6a9){var _0x22178b={};_0x22178b[_0xadf6a9]={'$like':'%'+_0x3eb99c[_0xcbdf('0x32')]['filter']+'%'};return _0x22178b;})});}_0x2c13c6=_[_0xcbdf('0x3f')]({},_0x2c13c6,_0x3eb99c[_0xcbdf('0x41')]);return _0x482b08[_0xcbdf('0x4f')](_0x2c13c6);}})[_0xcbdf('0x26')](function(_0x4be739){if(_0x4be739){_0x3cd8a1=_0x4be739[_0xcbdf('0x36')];if(!_0x3eb99c['query'][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x2c13c6['limit']=qs[_0xcbdf('0x1e')](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x1e')]);_0x2c13c6[_0xcbdf('0x1c')]=qs['offset'](_0x3eb99c[_0xcbdf('0x32')][_0xcbdf('0x1c')]);}return _0x482b08[_0xcbdf('0x4f')](_0x2c13c6);}})[_0xcbdf('0x26')](function(_0xb7607c){if(_0xb7607c){return _0xb7607c?{'count':_0x3cd8a1,'rows':_0xb7607c}:null;}})['then'](respondWithResult(_0x235814,null))[_0xcbdf('0x49')](handleError(_0x235814,null));};exports[_0xcbdf('0x50')]=function(_0x527839,_0x1930bd,_0x46c81f){var _0x140737={};var _0xbae3b1={};var _0x131d9f;var _0x27d03a;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x527839['params']['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x1930bd,null))['then'](function(_0x3bc87c){if(_0x3bc87c){_0x131d9f=_0x3bc87c;_0xbae3b1[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db['ZendeskField'][_0xcbdf('0x47')]);_0xbae3b1['query']=_[_0xcbdf('0x31')](_0x527839[_0xcbdf('0x32')]);_0xbae3b1['filters']=_[_0xcbdf('0x33')](_0xbae3b1[_0xcbdf('0x30')],_0xbae3b1['query']);_0x140737['attributes']=_[_0xcbdf('0x33')](_0xbae3b1['model'],qs[_0xcbdf('0x35')](_0x527839[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x140737[_0xcbdf('0x34')]=_0x140737['attributes'][_0xcbdf('0x36')]?_0x140737[_0xcbdf('0x34')]:_0xbae3b1[_0xcbdf('0x30')];_0x140737['order']=qs[_0xcbdf('0x3a')](_0x527839[_0xcbdf('0x32')][_0xcbdf('0x3a')]);_0x140737[_0xcbdf('0x3b')]=qs['filters'](_[_0xcbdf('0x3d')](_0x527839[_0xcbdf('0x32')],_0xbae3b1[_0xcbdf('0x3c')]));if(_0x527839['query'][_0xcbdf('0x3e')]){_0x140737[_0xcbdf('0x3b')]=_['merge'](_0x140737[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x140737[_0xcbdf('0x34')],function(_0x548a1f){var _0x885456={};_0x885456[_0x548a1f]={'$like':'%'+_0x527839[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x885456;})});}_0x140737=_[_0xcbdf('0x3f')]({},_0x140737,_0x527839['options']);return _0x131d9f[_0xcbdf('0x50')](_0x140737);}})['then'](function(_0x3a5ec6){if(_0x3a5ec6){_0x27d03a=_0x3a5ec6[_0xcbdf('0x36')];if(!_0x527839[_0xcbdf('0x32')]['hasOwnProperty'](_0xcbdf('0x38'))){_0x140737[_0xcbdf('0x1e')]=qs[_0xcbdf('0x1e')](_0x527839[_0xcbdf('0x32')]['limit']);_0x140737[_0xcbdf('0x1c')]=qs['offset'](_0x527839['query'][_0xcbdf('0x1c')]);}return _0x131d9f['getDescriptions'](_0x140737);}})[_0xcbdf('0x26')](function(_0x1a295e){if(_0x1a295e){return _0x1a295e?{'count':_0x27d03a,'rows':_0x1a295e}:null;}})[_0xcbdf('0x26')](respondWithResult(_0x1930bd,null))[_0xcbdf('0x49')](handleError(_0x1930bd,null));};exports[_0xcbdf('0x51')]=function(_0x26f0ce,_0x21bc37,_0x27523c){var _0x4ea5af={};var _0x2a84c6={};var _0x3e20b3;var _0x2e462f;return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x26f0ce[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x21bc37,null))[_0xcbdf('0x26')](function(_0x1c2161){if(_0x1c2161){_0x3e20b3=_0x1c2161;_0x2a84c6[_0xcbdf('0x30')]=_[_0xcbdf('0x31')](db[_0xcbdf('0x52')][_0xcbdf('0x47')]);_0x2a84c6[_0xcbdf('0x32')]=_[_0xcbdf('0x31')](_0x26f0ce['query']);_0x2a84c6[_0xcbdf('0x3c')]=_[_0xcbdf('0x33')](_0x2a84c6[_0xcbdf('0x30')],_0x2a84c6['query']);_0x4ea5af['attributes']=_[_0xcbdf('0x33')](_0x2a84c6[_0xcbdf('0x30')],qs[_0xcbdf('0x35')](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x35')]));_0x4ea5af['attributes']=_0x4ea5af[_0xcbdf('0x34')][_0xcbdf('0x36')]?_0x4ea5af[_0xcbdf('0x34')]:_0x2a84c6[_0xcbdf('0x30')];_0x4ea5af[_0xcbdf('0x39')]=qs[_0xcbdf('0x3a')](_0x26f0ce[_0xcbdf('0x32')]['sort']);_0x4ea5af[_0xcbdf('0x3b')]=qs[_0xcbdf('0x3c')](_[_0xcbdf('0x3d')](_0x26f0ce['query'],_0x2a84c6['filters']));if(_0x26f0ce[_0xcbdf('0x32')]['filter']){_0x4ea5af[_0xcbdf('0x3b')]=_['merge'](_0x4ea5af[_0xcbdf('0x3b')],{'$or':_[_0xcbdf('0x2c')](_0x4ea5af['attributes'],function(_0x92b15c){var _0x2ef7f8={};_0x2ef7f8[_0x92b15c]={'$like':'%'+_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x3e')]+'%'};return _0x2ef7f8;})});}_0x4ea5af=_[_0xcbdf('0x3f')]({},_0x4ea5af,_0x26f0ce[_0xcbdf('0x41')]);return _0x3e20b3[_0xcbdf('0x51')](_0x4ea5af);}})['then'](function(_0x2d9882){if(_0x2d9882){_0x2e462f=_0x2d9882[_0xcbdf('0x36')];if(!_0x26f0ce['query'][_0xcbdf('0x37')](_0xcbdf('0x38'))){_0x4ea5af[_0xcbdf('0x1e')]=qs[_0xcbdf('0x1e')](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x1e')]);_0x4ea5af[_0xcbdf('0x1c')]=qs['offset'](_0x26f0ce[_0xcbdf('0x32')][_0xcbdf('0x1c')]);}return _0x3e20b3['getTags'](_0x4ea5af);}})[_0xcbdf('0x26')](function(_0x5499b3){if(_0x5499b3){return _0x5499b3?{'count':_0x2e462f,'rows':_0x5499b3}:null;}})[_0xcbdf('0x26')](respondWithResult(_0x21bc37,null))[_0xcbdf('0x49')](handleError(_0x21bc37,null));};exports[_0xcbdf('0x53')]=function(_0x3948bf,_0x3c063e,_0x56c826){if(_0x3948bf[_0xcbdf('0x4a')]['id']){delete _0x3948bf['body']['id'];}return db[_0xcbdf('0x2d')][_0xcbdf('0x4e')]({'where':{'id':_0x3948bf[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x26')](handleEntityNotFound(_0x3c063e,null))[_0xcbdf('0x26')](function(_0x3a0aae){if(_0x3a0aae){return _0x3a0aae['setTags'](_0x3948bf['body'][_0xcbdf('0x54')]||[]);}return null;})[_0xcbdf('0x26')](respondWithResult(_0x3c063e,null))[_0xcbdf('0x49')](handleError(_0x3c063e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 948e22f..59b4a94 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 _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x272415,_0x2482e2){var _0x1ff486=function(_0x279f97){while(--_0x279f97){_0x272415['push'](_0x272415['shift']());}};_0x1ff486(++_0x2482e2);}(_0x58a4,0xbf));var _0x458a=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x58a4[_0x3fd275];return _0xe4f14f;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x23a020,_0x30f071){var _0x309c7e=function(_0x6bb2fc){while(--_0x6bb2fc){_0x23a020['push'](_0x23a020['shift']());}};_0x309c7e(++_0x30f071);}(_0xd914,0x17f));var _0x4d91=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0xd914[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('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 c88a580..d7cc38c 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 _0xd16c=['code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0xd16c,0x17f));var _0xcd16=function(_0x395959,_0x4774af){_0x395959=_0x395959-0x0;var _0x286476=_0xd16c[_0x395959];return _0x286476;};'use strict';var _=require(_0xcd16('0x0'));var util=require(_0xcd16('0x1'));var moment=require(_0xcd16('0x2'));var BPromise=require(_0xcd16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd16('0x4'));var db=require(_0xcd16('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd16('0x6'))(_0xcd16('0x7'));var config=require(_0xcd16('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcd16('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a42a2,_0x1eae1d,_0x436709){return new BPromise(function(_0x2b1cf3,_0x2acdd2){return client['request'](_0x1a42a2,_0x436709)['then'](function(_0xdddc00){logger['info'](_0xcd16('0xa'),_0x1eae1d,_0xcd16('0xb'));logger[_0xcd16('0xc')](_0xcd16('0xd'),_0x1eae1d,_0xcd16('0xb'),JSON[_0xcd16('0xe')](_0xdddc00));if(_0xdddc00[_0xcd16('0xf')]){if(_0xdddc00[_0xcd16('0xf')][_0xcd16('0x10')]===0x1f4){logger[_0xcd16('0xf')](_0xcd16('0xa'),_0x1eae1d,_0xdddc00[_0xcd16('0xf')]['message']);return _0x2acdd2(_0xdddc00[_0xcd16('0xf')][_0xcd16('0x11')]);}logger[_0xcd16('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1eae1d,_0xdddc00['error'][_0xcd16('0x11')]);return _0x2b1cf3(_0xdddc00['error']['message']);}else{logger['info'](_0xcd16('0xa'),_0x1eae1d,_0xcd16('0xb'));_0x2b1cf3(_0xdddc00[_0xcd16('0x12')]['message']);}})['catch'](function(_0x43f4d4){logger[_0xcd16('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1eae1d,_0x43f4d4);_0x2acdd2(_0x43f4d4);});});} \ No newline at end of file +var _0x254d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x200c1e,_0x2c6397){var _0x4604d4=function(_0x4bdcbf){while(--_0x4bdcbf){_0x200c1e['push'](_0x200c1e['shift']());}};_0x4604d4(++_0x2c6397);}(_0x254d,0x73));var _0xd254=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x254d[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xd254('0x0'));var util=require(_0xd254('0x1'));var moment=require(_0xd254('0x2'));var BPromise=require('bluebird');var rs=require(_0xd254('0x3'));var fs=require('fs');var Redis=require(_0xd254('0x4'));var db=require(_0xd254('0x5'))['db'];var utils=require(_0xd254('0x6'));var logger=require(_0xd254('0x7'))('rpc');var config=require(_0xd254('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd254('0x9')][_0xd254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e259a,_0x5ddb65,_0x2cc996){return new BPromise(function(_0x393a92,_0x31d448){return client[_0xd254('0xb')](_0x2e259a,_0x2cc996)[_0xd254('0xc')](function(_0x568416){logger[_0xd254('0xd')](_0xd254('0xe'),_0x5ddb65,_0xd254('0xf'));logger[_0xd254('0x10')](_0xd254('0x11'),_0x5ddb65,_0xd254('0xf'),JSON[_0xd254('0x12')](_0x568416));if(_0x568416['error']){if(_0x568416['error'][_0xd254('0x13')]===0x1f4){logger[_0xd254('0x14')](_0xd254('0xe'),_0x5ddb65,_0x568416[_0xd254('0x14')][_0xd254('0x15')]);return _0x31d448(_0x568416[_0xd254('0x14')][_0xd254('0x15')]);}logger[_0xd254('0x14')](_0xd254('0xe'),_0x5ddb65,_0x568416['error']['message']);return _0x393a92(_0x568416[_0xd254('0x14')][_0xd254('0x15')]);}else{logger['info'](_0xd254('0xe'),_0x5ddb65,_0xd254('0xf'));_0x393a92(_0x568416[_0xd254('0x16')][_0xd254('0x15')]);}})[_0xd254('0x17')](function(_0x414511){logger[_0xd254('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ddb65,_0x414511);_0x31d448(_0x414511);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ed2e090..3d974a3 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 _0x837f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','post','isAuthenticated','/:id'];(function(_0x4d2ed7,_0x168bd2){var _0x238203=function(_0x4d0765){while(--_0x4d0765){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x238203(++_0x168bd2);}(_0x837f,0x1f1));var _0xf837=function(_0x45a723,_0x177b85){_0x45a723=_0x45a723-0x0;var _0x18011f=_0x837f[_0x45a723];return _0x18011f;};'use strict';var multer=require(_0xf837('0x0'));var util=require(_0xf837('0x1'));var path=require(_0xf837('0x2'));var timeout=require(_0xf837('0x3'));var express=require(_0xf837('0x4'));var router=express[_0xf837('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf837('0x6'));var config=require(_0xf837('0x7'));var controller=require(_0xf837('0x8'));router[_0xf837('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf837('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf837('0xa')]('/',auth[_0xf837('0xb')](),controller['create']);router['put'](_0xf837('0xc'),auth[_0xf837('0xb')](),controller['update']);router['delete'](_0xf837('0xc'),auth[_0xf837('0xb')](),controller[_0xf837('0xd')]);module[_0xf837('0xe')]=router; \ No newline at end of file +var _0x03e5=['update','delete','destroy','exports','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','/:id','show','put'];(function(_0x5276c8,_0x3c2cc8){var _0x574e31=function(_0x260cfc){while(--_0x260cfc){_0x5276c8['push'](_0x5276c8['shift']());}};_0x574e31(++_0x3c2cc8);}(_0x03e5,0xba));var _0x503e=function(_0x3180b9,_0x41e58e){_0x3180b9=_0x3180b9-0x0;var _0x5942c3=_0x03e5[_0x3180b9];return _0x5942c3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x503e('0x0'));var router=express['Router']();var fs_extra=require(_0x503e('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x503e('0x2'));var config=require(_0x503e('0x3'));var controller=require(_0x503e('0x4'));router['get']('/',auth[_0x503e('0x5')](),controller[_0x503e('0x6')]);router['get'](_0x503e('0x7'),auth['isAuthenticated'](),controller[_0x503e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x503e('0x9')]('/:id',auth[_0x503e('0x5')](),controller[_0x503e('0xa')]);router[_0x503e('0xb')](_0x503e('0x7'),auth[_0x503e('0x5')](),controller[_0x503e('0xc')]);module[_0x503e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index cf48fa3..9f84942 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 _0x5f2e=['keyValue','string','STRING','ENUM','variable','customVariable'];(function(_0x25bae3,_0x41b199){var _0x18fcf6=function(_0x323061){while(--_0x323061){_0x25bae3['push'](_0x25bae3['shift']());}};_0x18fcf6(++_0x41b199);}(_0x5f2e,0x70));var _0xe5f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f2e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xe5f2('0x0'),_0xe5f2('0x1'),_0xe5f2('0x2'),'picklist'),'defaultValue':_0xe5f2('0x3')},'content':{'type':Sequelize[_0xe5f2('0x4')]},'key':{'type':Sequelize[_0xe5f2('0x4')]},'keyType':{'type':Sequelize[_0xe5f2('0x5')](_0xe5f2('0x3'),_0xe5f2('0x0'),_0xe5f2('0x1'))},'keyContent':{'type':Sequelize[_0xe5f2('0x4')]},'idField':{'type':Sequelize[_0xe5f2('0x4')]},'nameField':{'type':Sequelize[_0xe5f2('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5f2('0x4')]}}; \ No newline at end of file +var _0x531e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x531e,0x1d2));var _0xe531=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x531e[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0xe531('0x0'));module[_0xe531('0x1')]={'type':{'type':Sequelize[_0xe531('0x2')](_0xe531('0x3'),_0xe531('0x4'),_0xe531('0x5'),_0xe531('0x6'),_0xe531('0x7')),'defaultValue':_0xe531('0x3')},'content':{'type':Sequelize[_0xe531('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe531('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe531('0x8')]},'nameField':{'type':Sequelize[_0xe531('0x8')]},'customField':{'type':Sequelize[_0xe531('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a4519e3..a956d7a 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 _0x7130=['map','ZendeskField','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7130,0x14e));var _0x0713=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7130[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0x0713('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0713('0x1'));var jsonpatch=require(_0x0713('0x2'));var rp=require('request-promise');var moment=require(_0x0713('0x3'));var BPromise=require(_0x0713('0x4'));var Mustache=require(_0x0713('0x5'));var util=require(_0x0713('0x6'));var path=require(_0x0713('0x7'));var sox=require(_0x0713('0x8'));var csv=require(_0x0713('0x9'));var ejs=require(_0x0713('0xa'));var fs=require('fs');var fs_extra=require(_0x0713('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0713('0xc'));var jsforce=require(_0x0713('0xd'));var deskjs=require(_0x0713('0xe'));var toCsv=require(_0x0713('0x9'));var querystring=require(_0x0713('0xf'));var Papa=require(_0x0713('0x10'));var Redis=require(_0x0713('0x11'));var authService=require(_0x0713('0x12'));var qs=require(_0x0713('0x13'));var as=require(_0x0713('0x14'));var hardwareService=require(_0x0713('0x15'));var logger=require(_0x0713('0x16'))('api');var utils=require(_0x0713('0x17'));var config=require(_0x0713('0x18'));var licenseUtil=require(_0x0713('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26a907,_0x545bca){_0x545bca=_0x545bca||0xcc;return function(_0x418039){if(_0x418039){return _0x26a907[_0x0713('0x1a')](_0x545bca);}return _0x26a907[_0x0713('0x1b')](_0x545bca)[_0x0713('0x1c')]();};}function respondWithResult(_0x1184a5,_0x402c9c){_0x402c9c=_0x402c9c||0xc8;return function(_0x243539){if(_0x243539){return _0x1184a5[_0x0713('0x1b')](_0x402c9c)[_0x0713('0x1d')](_0x243539);}};}function respondWithFilteredResult(_0x499e29,_0x46c492){return function(_0x13c27a){if(_0x13c27a){var _0x293e66=typeof _0x46c492[_0x0713('0x1e')]===_0x0713('0x1f')&&typeof _0x46c492[_0x0713('0x20')]==='undefined';var _0x22e794=_0x13c27a[_0x0713('0x21')];var _0x2be994=_0x293e66?0x0:_0x46c492[_0x0713('0x1e')];var _0x33dcff=_0x293e66?_0x13c27a['count']:_0x46c492['offset']+_0x46c492['limit'];var _0x122459;if(_0x33dcff>=_0x22e794){_0x33dcff=_0x22e794;_0x122459=0xc8;}else{_0x122459=0xce;}_0x499e29[_0x0713('0x1b')](_0x122459);return _0x499e29['set']('Content-Range',_0x2be994+'-'+_0x33dcff+'/'+_0x22e794)[_0x0713('0x1d')](_0x13c27a);}return null;};}function patchUpdates(_0x597e29){return function(_0x62283f){try{jsonpatch[_0x0713('0x22')](_0x62283f,_0x597e29,!![]);}catch(_0x1795d6){return BPromise[_0x0713('0x23')](_0x1795d6);}return _0x62283f[_0x0713('0x24')]();};}function saveUpdates(_0x2ba5ad,_0x167693){return function(_0x3ec8da){if(_0x3ec8da){return _0x3ec8da[_0x0713('0x25')](_0x2ba5ad)[_0x0713('0x26')](function(_0x4a964d){return _0x4a964d;});}return null;};}function removeEntity(_0x3d2113,_0x1a4ca3){return function(_0x5f2df1){if(_0x5f2df1){return _0x5f2df1[_0x0713('0x27')]()[_0x0713('0x26')](function(){_0x3d2113[_0x0713('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x700649,_0x5668b8){return function(_0x4236b1){if(!_0x4236b1){_0x700649[_0x0713('0x1a')](0x194);}return _0x4236b1;};}function handleError(_0x286edb,_0x8fcce0){_0x8fcce0=_0x8fcce0||0x1f4;return function(_0x479d70){logger[_0x0713('0x28')](_0x479d70['stack']);if(_0x479d70['name']){delete _0x479d70['name'];}_0x286edb[_0x0713('0x1b')](_0x8fcce0)['send'](_0x479d70);};}exports['index']=function(_0x5cd549,_0x135d70){var _0x40e51b={},_0x1a6d1b={},_0x1f20c0={'count':0x0,'rows':[]};var _0x295d7c=_[_0x0713('0x29')](db[_0x0713('0x2a')][_0x0713('0x2b')],function(_0xd8a292){return{'name':_0xd8a292['fieldName'],'type':_0xd8a292[_0x0713('0x2c')][_0x0713('0x2d')]};});_0x1a6d1b[_0x0713('0x2e')]=_[_0x0713('0x29')](_0x295d7c,_0x0713('0x2f'));_0x1a6d1b[_0x0713('0x30')]=_['keys'](_0x5cd549[_0x0713('0x30')]);_0x1a6d1b[_0x0713('0x31')]=_[_0x0713('0x32')](_0x1a6d1b[_0x0713('0x2e')],_0x1a6d1b['query']);_0x40e51b[_0x0713('0x33')]=_[_0x0713('0x32')](_0x1a6d1b[_0x0713('0x2e')],qs[_0x0713('0x34')](_0x5cd549[_0x0713('0x30')][_0x0713('0x34')]));_0x40e51b[_0x0713('0x33')]=_0x40e51b[_0x0713('0x33')][_0x0713('0x35')]?_0x40e51b[_0x0713('0x33')]:_0x1a6d1b['model'];if(!_0x5cd549['query'][_0x0713('0x36')](_0x0713('0x37'))){_0x40e51b['limit']=qs[_0x0713('0x20')](_0x5cd549['query'][_0x0713('0x20')]);_0x40e51b[_0x0713('0x1e')]=qs[_0x0713('0x1e')](_0x5cd549[_0x0713('0x30')][_0x0713('0x1e')]);}_0x40e51b[_0x0713('0x38')]=qs[_0x0713('0x39')](_0x5cd549[_0x0713('0x30')]['sort']);_0x40e51b[_0x0713('0x3a')]=qs[_0x0713('0x31')](_[_0x0713('0x3b')](_0x5cd549[_0x0713('0x30')],_0x1a6d1b[_0x0713('0x31')]),_0x295d7c);if(_0x5cd549['query'][_0x0713('0x3c')]){_0x40e51b[_0x0713('0x3a')]=_[_0x0713('0x3d')](_0x40e51b[_0x0713('0x3a')],{'$or':_[_0x0713('0x29')](_0x295d7c,function(_0x431f29){if(_0x431f29[_0x0713('0x2c')]!==_0x0713('0x3e')){var _0x4a1f03={};_0x4a1f03[_0x431f29[_0x0713('0x2f')]]={'$like':'%'+_0x5cd549['query']['filter']+'%'};return _0x4a1f03;}})});}_0x40e51b=_[_0x0713('0x3d')]({},_0x40e51b,_0x5cd549[_0x0713('0x3f')]);var _0x411418={'where':_0x40e51b['where']};return db['ZendeskField']['count'](_0x411418)[_0x0713('0x26')](function(_0x4a7950){_0x1f20c0[_0x0713('0x21')]=_0x4a7950;if(_0x5cd549[_0x0713('0x30')][_0x0713('0x40')]){_0x40e51b['include']=[{'all':!![]}];}return db['ZendeskField'][_0x0713('0x41')](_0x40e51b);})[_0x0713('0x26')](function(_0xb085c5){_0x1f20c0[_0x0713('0x42')]=_0xb085c5;return _0x1f20c0;})[_0x0713('0x26')](respondWithFilteredResult(_0x135d70,_0x40e51b))['catch'](handleError(_0x135d70,null));};exports[_0x0713('0x43')]=function(_0x8f203f,_0x20094f){var _0x124a97={'raw':!![],'where':{'id':_0x8f203f[_0x0713('0x44')]['id']}},_0x3b29c1={};_0x3b29c1[_0x0713('0x2e')]=_['keys'](db[_0x0713('0x2a')]['rawAttributes']);_0x3b29c1[_0x0713('0x30')]=_[_0x0713('0x45')](_0x8f203f[_0x0713('0x30')]);_0x3b29c1['filters']=_[_0x0713('0x32')](_0x3b29c1[_0x0713('0x2e')],_0x3b29c1['query']);_0x124a97[_0x0713('0x33')]=_[_0x0713('0x32')](_0x3b29c1[_0x0713('0x2e')],qs[_0x0713('0x34')](_0x8f203f['query'][_0x0713('0x34')]));_0x124a97[_0x0713('0x33')]=_0x124a97[_0x0713('0x33')][_0x0713('0x35')]?_0x124a97[_0x0713('0x33')]:_0x3b29c1[_0x0713('0x2e')];if(_0x8f203f[_0x0713('0x30')][_0x0713('0x40')]){_0x124a97[_0x0713('0x46')]=[{'all':!![]}];}_0x124a97=_['merge']({},_0x124a97,_0x8f203f[_0x0713('0x3f')]);return db['ZendeskField'][_0x0713('0x47')](_0x124a97)[_0x0713('0x26')](handleEntityNotFound(_0x20094f,null))['then'](respondWithResult(_0x20094f,null))[_0x0713('0x48')](handleError(_0x20094f,null));};exports[_0x0713('0x49')]=function(_0x133262,_0x323fdf){return db['ZendeskField'][_0x0713('0x49')](_0x133262[_0x0713('0x4a')],{})[_0x0713('0x26')](respondWithResult(_0x323fdf,0xc9))[_0x0713('0x48')](handleError(_0x323fdf,null));};exports[_0x0713('0x25')]=function(_0x2e42ad,_0x365a56){if(_0x2e42ad[_0x0713('0x4a')]['id']){delete _0x2e42ad[_0x0713('0x4a')]['id'];}return db[_0x0713('0x2a')]['find']({'where':{'id':_0x2e42ad[_0x0713('0x44')]['id']}})[_0x0713('0x26')](handleEntityNotFound(_0x365a56,null))[_0x0713('0x26')](saveUpdates(_0x2e42ad[_0x0713('0x4a')],null))[_0x0713('0x26')](respondWithResult(_0x365a56,null))[_0x0713('0x48')](handleError(_0x365a56,null));};exports['destroy']=function(_0x3db94b,_0x3fdd89){return db[_0x0713('0x2a')][_0x0713('0x47')]({'where':{'id':_0x3db94b['params']['id']}})[_0x0713('0x26')](handleEntityNotFound(_0x3fdd89,null))['then'](removeEntity(_0x3fdd89,null))['catch'](handleError(_0x3fdd89,null));}; \ No newline at end of file +var _0x9a7a=['Content-Range','apply','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9a7a,0x78));var _0xa9a7=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x9a7a[_0xd58823];return _0x249c0a;};'use strict';var emlformat=require(_0xa9a7('0x0'));var rimraf=require(_0xa9a7('0x1'));var zipdir=require(_0xa9a7('0x2'));var jsonpatch=require(_0xa9a7('0x3'));var rp=require(_0xa9a7('0x4'));var moment=require(_0xa9a7('0x5'));var BPromise=require(_0xa9a7('0x6'));var Mustache=require(_0xa9a7('0x7'));var util=require(_0xa9a7('0x8'));var path=require(_0xa9a7('0x9'));var sox=require(_0xa9a7('0xa'));var csv=require(_0xa9a7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9a7('0xc'));var _=require(_0xa9a7('0xd'));var squel=require(_0xa9a7('0xe'));var crypto=require(_0xa9a7('0xf'));var jsforce=require(_0xa9a7('0x10'));var deskjs=require(_0xa9a7('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa9a7('0x12'));var Papa=require(_0xa9a7('0x13'));var Redis=require('ioredis');var authService=require(_0xa9a7('0x14'));var qs=require(_0xa9a7('0x15'));var as=require(_0xa9a7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9a7('0x17'));var utils=require('../../config/utils');var config=require(_0xa9a7('0x18'));var licenseUtil=require(_0xa9a7('0x19'));var db=require(_0xa9a7('0x1a'))['db'];function respondWithStatusCode(_0x3e14a8,_0x395623){_0x395623=_0x395623||0xcc;return function(_0x5d91ee){if(_0x5d91ee){return _0x3e14a8['sendStatus'](_0x395623);}return _0x3e14a8[_0xa9a7('0x1b')](_0x395623)[_0xa9a7('0x1c')]();};}function respondWithResult(_0x13b92f,_0x3c0e8e){_0x3c0e8e=_0x3c0e8e||0xc8;return function(_0x329218){if(_0x329218){return _0x13b92f[_0xa9a7('0x1b')](_0x3c0e8e)[_0xa9a7('0x1d')](_0x329218);}};}function respondWithFilteredResult(_0x4e5d55,_0x439132){return function(_0x80b88a){if(_0x80b88a){var _0x4cfa62=typeof _0x439132[_0xa9a7('0x1e')]===_0xa9a7('0x1f')&&typeof _0x439132['limit']===_0xa9a7('0x1f');var _0x493d1d=_0x80b88a[_0xa9a7('0x20')];var _0xa662f2=_0x4cfa62?0x0:_0x439132['offset'];var _0x4f1433=_0x4cfa62?_0x80b88a[_0xa9a7('0x20')]:_0x439132['offset']+_0x439132[_0xa9a7('0x21')];var _0x9392b6;if(_0x4f1433>=_0x493d1d){_0x4f1433=_0x493d1d;_0x9392b6=0xc8;}else{_0x9392b6=0xce;}_0x4e5d55[_0xa9a7('0x1b')](_0x9392b6);return _0x4e5d55['set'](_0xa9a7('0x22'),_0xa662f2+'-'+_0x4f1433+'/'+_0x493d1d)[_0xa9a7('0x1d')](_0x80b88a);}return null;};}function patchUpdates(_0x519933){return function(_0x12885c){try{jsonpatch[_0xa9a7('0x23')](_0x12885c,_0x519933,!![]);}catch(_0x1cd775){return BPromise[_0xa9a7('0x24')](_0x1cd775);}return _0x12885c[_0xa9a7('0x25')]();};}function saveUpdates(_0x28ee6b,_0xfd9d21){return function(_0x16cf32){if(_0x16cf32){return _0x16cf32['update'](_0x28ee6b)[_0xa9a7('0x26')](function(_0xdbe9c9){return _0xdbe9c9;});}return null;};}function removeEntity(_0x1fa448,_0x30cc2f){return function(_0x5a4eb4){if(_0x5a4eb4){return _0x5a4eb4['destroy']()['then'](function(){_0x1fa448['status'](0xcc)[_0xa9a7('0x1c')]();});}};}function handleEntityNotFound(_0xcca552,_0x35097f){return function(_0x32a2e2){if(!_0x32a2e2){_0xcca552['sendStatus'](0x194);}return _0x32a2e2;};}function handleError(_0x575120,_0x2e2bf5){_0x2e2bf5=_0x2e2bf5||0x1f4;return function(_0x501237){logger[_0xa9a7('0x27')](_0x501237[_0xa9a7('0x28')]);if(_0x501237[_0xa9a7('0x29')]){delete _0x501237['name'];}_0x575120['status'](_0x2e2bf5)[_0xa9a7('0x2a')](_0x501237);};}exports[_0xa9a7('0x2b')]=function(_0x73adff,_0x2ca7e9){var _0x239fb9={},_0x24bb12={},_0x5e0f17={'count':0x0,'rows':[]};var _0x325449=_[_0xa9a7('0x2c')](db['ZendeskField']['rawAttributes'],function(_0x5147d1){return{'name':_0x5147d1[_0xa9a7('0x2d')],'type':_0x5147d1[_0xa9a7('0x2e')][_0xa9a7('0x2f')]};});_0x24bb12[_0xa9a7('0x30')]=_[_0xa9a7('0x2c')](_0x325449,_0xa9a7('0x29'));_0x24bb12[_0xa9a7('0x31')]=_['keys'](_0x73adff[_0xa9a7('0x31')]);_0x24bb12[_0xa9a7('0x32')]=_[_0xa9a7('0x33')](_0x24bb12[_0xa9a7('0x30')],_0x24bb12[_0xa9a7('0x31')]);_0x239fb9[_0xa9a7('0x34')]=_[_0xa9a7('0x33')](_0x24bb12[_0xa9a7('0x30')],qs['fields'](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x35')]));_0x239fb9['attributes']=_0x239fb9['attributes'][_0xa9a7('0x36')]?_0x239fb9[_0xa9a7('0x34')]:_0x24bb12['model'];if(!_0x73adff['query']['hasOwnProperty'](_0xa9a7('0x37'))){_0x239fb9['limit']=qs[_0xa9a7('0x21')](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x21')]);_0x239fb9[_0xa9a7('0x1e')]=qs[_0xa9a7('0x1e')](_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x1e')]);}_0x239fb9['order']=qs[_0xa9a7('0x38')](_0x73adff['query'][_0xa9a7('0x38')]);_0x239fb9[_0xa9a7('0x39')]=qs[_0xa9a7('0x32')](_[_0xa9a7('0x3a')](_0x73adff[_0xa9a7('0x31')],_0x24bb12[_0xa9a7('0x32')]),_0x325449);if(_0x73adff['query'][_0xa9a7('0x3b')]){_0x239fb9['where']=_['merge'](_0x239fb9[_0xa9a7('0x39')],{'$or':_[_0xa9a7('0x2c')](_0x325449,function(_0x5d27cb){if(_0x5d27cb[_0xa9a7('0x2e')]!==_0xa9a7('0x3c')){var _0xe1bbf8={};_0xe1bbf8[_0x5d27cb[_0xa9a7('0x29')]]={'$like':'%'+_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x3b')]+'%'};return _0xe1bbf8;}})});}_0x239fb9=_[_0xa9a7('0x3d')]({},_0x239fb9,_0x73adff[_0xa9a7('0x3e')]);var _0x47abe3={'where':_0x239fb9['where']};return db[_0xa9a7('0x3f')][_0xa9a7('0x20')](_0x47abe3)[_0xa9a7('0x26')](function(_0x4e80d2){_0x5e0f17[_0xa9a7('0x20')]=_0x4e80d2;if(_0x73adff[_0xa9a7('0x31')][_0xa9a7('0x40')]){_0x239fb9['include']=[{'all':!![]}];}return db[_0xa9a7('0x3f')][_0xa9a7('0x41')](_0x239fb9);})['then'](function(_0x4c8807){_0x5e0f17[_0xa9a7('0x42')]=_0x4c8807;return _0x5e0f17;})[_0xa9a7('0x26')](respondWithFilteredResult(_0x2ca7e9,_0x239fb9))[_0xa9a7('0x43')](handleError(_0x2ca7e9,null));};exports['show']=function(_0x9fadc3,_0x2b618a){var _0x5f02fd={'raw':!![],'where':{'id':_0x9fadc3[_0xa9a7('0x44')]['id']}},_0x314a8b={};_0x314a8b[_0xa9a7('0x30')]=_[_0xa9a7('0x45')](db['ZendeskField'][_0xa9a7('0x46')]);_0x314a8b['query']=_[_0xa9a7('0x45')](_0x9fadc3[_0xa9a7('0x31')]);_0x314a8b[_0xa9a7('0x32')]=_[_0xa9a7('0x33')](_0x314a8b[_0xa9a7('0x30')],_0x314a8b[_0xa9a7('0x31')]);_0x5f02fd[_0xa9a7('0x34')]=_['intersection'](_0x314a8b[_0xa9a7('0x30')],qs[_0xa9a7('0x35')](_0x9fadc3[_0xa9a7('0x31')][_0xa9a7('0x35')]));_0x5f02fd['attributes']=_0x5f02fd[_0xa9a7('0x34')][_0xa9a7('0x36')]?_0x5f02fd[_0xa9a7('0x34')]:_0x314a8b[_0xa9a7('0x30')];if(_0x9fadc3[_0xa9a7('0x31')][_0xa9a7('0x40')]){_0x5f02fd[_0xa9a7('0x47')]=[{'all':!![]}];}_0x5f02fd=_[_0xa9a7('0x3d')]({},_0x5f02fd,_0x9fadc3['options']);return db[_0xa9a7('0x3f')][_0xa9a7('0x48')](_0x5f02fd)[_0xa9a7('0x26')](handleEntityNotFound(_0x2b618a,null))[_0xa9a7('0x26')](respondWithResult(_0x2b618a,null))[_0xa9a7('0x43')](handleError(_0x2b618a,null));};exports['create']=function(_0x1f733c,_0x3a6ba6){return db['ZendeskField'][_0xa9a7('0x49')](_0x1f733c[_0xa9a7('0x4a')],{})['then'](respondWithResult(_0x3a6ba6,0xc9))[_0xa9a7('0x43')](handleError(_0x3a6ba6,null));};exports[_0xa9a7('0x4b')]=function(_0x3c71d4,_0x7cb45){if(_0x3c71d4[_0xa9a7('0x4a')]['id']){delete _0x3c71d4[_0xa9a7('0x4a')]['id'];}return db[_0xa9a7('0x3f')][_0xa9a7('0x48')]({'where':{'id':_0x3c71d4[_0xa9a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x7cb45,null))[_0xa9a7('0x26')](saveUpdates(_0x3c71d4[_0xa9a7('0x4a')],null))[_0xa9a7('0x26')](respondWithResult(_0x7cb45,null))['catch'](handleError(_0x7cb45,null));};exports[_0xa9a7('0x4c')]=function(_0x54d1af,_0x2aaa3c){return db[_0xa9a7('0x3f')]['find']({'where':{'id':_0x54d1af[_0xa9a7('0x44')]['id']}})[_0xa9a7('0x26')](handleEntityNotFound(_0x2aaa3c,null))[_0xa9a7('0x26')](removeEntity(_0x2aaa3c,null))[_0xa9a7('0x43')](handleError(_0x2aaa3c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f3ddc49..af9bc7c 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 _0x9cd6=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x9cd6,0x154));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x69cd('0x0'));var util=require(_0x69cd('0x1'));var logger=require(_0x69cd('0x2'))(_0x69cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69cd('0x4'));var rimraf=require(_0x69cd('0x5'));var config=require('../../config/environment');var attributes=require(_0x69cd('0x6'));module[_0x69cd('0x7')]=function(_0x1360b8,_0x3640c9){return _0x1360b8[_0x69cd('0x8')](_0x69cd('0x9'),attributes,{'tableName':_0x69cd('0xa'),'paranoid':![],'indexes':[{'name':_0x69cd('0xb'),'fields':[_0x69cd('0xc'),_0x69cd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50a1=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3e30e9,_0x4e605e){var _0x5633d5=function(_0x3f93a9){while(--_0x3f93a9){_0x3e30e9['push'](_0x3e30e9['shift']());}};_0x5633d5(++_0x4e605e);}(_0x50a1,0xa9));var _0x150a=function(_0x212dbb,_0x4114bb){_0x212dbb=_0x212dbb-0x0;var _0x4c5cd4=_0x50a1[_0x212dbb];return _0x4c5cd4;};'use strict';var _=require(_0x150a('0x0'));var util=require(_0x150a('0x1'));var logger=require(_0x150a('0x2'))(_0x150a('0x3'));var moment=require(_0x150a('0x4'));var BPromise=require(_0x150a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x150a('0x6'));var rimraf=require('rimraf');var config=require(_0x150a('0x7'));var attributes=require(_0x150a('0x8'));module[_0x150a('0x9')]=function(_0xcd34d5,_0x1d1e2c){return _0xcd34d5[_0x150a('0xa')](_0x150a('0xb'),attributes,{'tableName':_0x150a('0xc'),'paranoid':![],'indexes':[{'name':_0x150a('0xd'),'fields':[_0x150a('0xe'),_0x150a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index c7ee1f1..0a2439f 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 _0x1f0b=['moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x192667,_0x4242c1){var _0x3dbc2b=function(_0x45100c){while(--_0x45100c){_0x192667['push'](_0x192667['shift']());}};_0x3dbc2b(++_0x4242c1);}(_0x1f0b,0xb3));var _0xb1f0=function(_0x21afed,_0x1a82c0){_0x21afed=_0x21afed-0x0;var _0x2704fe=_0x1f0b[_0x21afed];return _0x2704fe;};'use strict';var _=require(_0xb1f0('0x0'));var util=require('util');var moment=require(_0xb1f0('0x1'));var BPromise=require(_0xb1f0('0x2'));var rs=require(_0xb1f0('0x3'));var fs=require('fs');var Redis=require(_0xb1f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb1f0('0x5'))('rpc');var config=require(_0xb1f0('0x6'));var jayson=require(_0xb1f0('0x7'));var client=jayson['client'][_0xb1f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fbba5,_0x154f28,_0x403cea){return new BPromise(function(_0x7208cd,_0x466fa6){return client['request'](_0x3fbba5,_0x403cea)[_0xb1f0('0x9')](function(_0x510ebb){logger[_0xb1f0('0xa')](_0xb1f0('0xb'),_0x154f28,'request\x20sent');logger[_0xb1f0('0xc')](_0xb1f0('0xd'),_0x154f28,_0xb1f0('0xe'),JSON[_0xb1f0('0xf')](_0x510ebb));if(_0x510ebb[_0xb1f0('0x10')]){if(_0x510ebb[_0xb1f0('0x10')]['code']===0x1f4){logger[_0xb1f0('0x10')](_0xb1f0('0xb'),_0x154f28,_0x510ebb[_0xb1f0('0x10')][_0xb1f0('0x11')]);return _0x466fa6(_0x510ebb[_0xb1f0('0x10')][_0xb1f0('0x11')]);}logger[_0xb1f0('0x10')]('ZendeskField,\x20%s,\x20%s',_0x154f28,_0x510ebb['error'][_0xb1f0('0x11')]);return _0x7208cd(_0x510ebb[_0xb1f0('0x10')]['message']);}else{logger[_0xb1f0('0xa')]('ZendeskField,\x20%s,\x20%s',_0x154f28,'request\x20sent');_0x7208cd(_0x510ebb[_0xb1f0('0x12')][_0xb1f0('0x11')]);}})[_0xb1f0('0x13')](function(_0x2ee05f){logger[_0xb1f0('0x10')](_0xb1f0('0xb'),_0x154f28,_0x2ee05f);_0x466fa6(_0x2ee05f);});});} \ No newline at end of file +var _0xd978=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x3bd1fd,_0x1472ce){var _0x28ea80=function(_0x2222fa){while(--_0x2222fa){_0x3bd1fd['push'](_0x3bd1fd['shift']());}};_0x28ea80(++_0x1472ce);}(_0xd978,0x1c1));var _0x8d97=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0xd978[_0x276221];return _0x4fa716;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d97('0x0'));var BPromise=require(_0x8d97('0x1'));var rs=require(_0x8d97('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d97('0x3'))['db'];var utils=require(_0x8d97('0x4'));var logger=require(_0x8d97('0x5'))(_0x8d97('0x6'));var config=require(_0x8d97('0x7'));var jayson=require(_0x8d97('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579cff,_0x1e2443,_0x9da957){return new BPromise(function(_0x2fdcc1,_0x19c0bf){return client[_0x8d97('0x9')](_0x579cff,_0x9da957)[_0x8d97('0xa')](function(_0x475743){logger[_0x8d97('0xb')](_0x8d97('0xc'),_0x1e2443,_0x8d97('0xd'));logger[_0x8d97('0xe')](_0x8d97('0xf'),_0x1e2443,_0x8d97('0xd'),JSON[_0x8d97('0x10')](_0x475743));if(_0x475743['error']){if(_0x475743[_0x8d97('0x11')][_0x8d97('0x12')]===0x1f4){logger[_0x8d97('0x11')](_0x8d97('0xc'),_0x1e2443,_0x475743['error'][_0x8d97('0x13')]);return _0x19c0bf(_0x475743[_0x8d97('0x11')]['message']);}logger[_0x8d97('0x11')](_0x8d97('0xc'),_0x1e2443,_0x475743['error']['message']);return _0x2fdcc1(_0x475743[_0x8d97('0x11')][_0x8d97('0x13')]);}else{logger[_0x8d97('0xb')]('ZendeskField,\x20%s,\x20%s',_0x1e2443,'request\x20sent');_0x2fdcc1(_0x475743[_0x8d97('0x14')][_0x8d97('0x13')]);}})[_0x8d97('0x15')](function(_0x5252e6){logger['error'](_0x8d97('0xc'),_0x1e2443,_0x5252e6);_0x19c0bf(_0x5252e6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9044a5e..7a6d5e7 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 _0x0ca0=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','post','create','addConfiguration'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0ca0,0x115));var _0x00ca=function(_0x14804c,_0x57d426){_0x14804c=_0x14804c-0x0;var _0x2d8daf=_0x0ca0[_0x14804c];return _0x2d8daf;};'use strict';var multer=require(_0x00ca('0x0'));var util=require(_0x00ca('0x1'));var path=require(_0x00ca('0x2'));var timeout=require(_0x00ca('0x3'));var express=require('express');var router=express[_0x00ca('0x4')]();var fs_extra=require(_0x00ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x00ca('0x6'));var config=require(_0x00ca('0x7'));var controller=require(_0x00ca('0x8'));router[_0x00ca('0x9')]('/',auth[_0x00ca('0xa')](),controller['index']);router['get'](_0x00ca('0xb'),auth[_0x00ca('0xa')](),controller[_0x00ca('0xc')]);router[_0x00ca('0x9')]('/:id/configurations',auth[_0x00ca('0xa')](),controller[_0x00ca('0xd')]);router[_0x00ca('0x9')]('/:id/fields',auth[_0x00ca('0xa')](),controller['getFields']);router[_0x00ca('0xe')]('/',auth[_0x00ca('0xa')](),controller[_0x00ca('0xf')]);router[_0x00ca('0xe')]('/:id/configurations',auth[_0x00ca('0xa')](),controller[_0x00ca('0x10')]);router[_0x00ca('0x11')](_0x00ca('0xb'),auth[_0x00ca('0xa')](),controller[_0x00ca('0x12')]);router[_0x00ca('0x13')](_0x00ca('0xb'),auth[_0x00ca('0xa')](),controller[_0x00ca('0x14')]);module['exports']=router; \ No newline at end of file +var _0xee7c=['index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee7c,0x14e));var _0xcee7=function(_0x211026,_0x56ac5b){_0x211026=_0x211026-0x0;var _0x58eca8=_0xee7c[_0x211026];return _0x58eca8;};'use strict';var multer=require('multer');var util=require(_0xcee7('0x0'));var path=require(_0xcee7('0x1'));var timeout=require(_0xcee7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcee7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcee7('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xcee7('0x5')](),controller[_0xcee7('0x6')]);router['get'](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x8')]);router[_0xcee7('0x9')](_0xcee7('0xa'),auth['isAuthenticated'](),controller[_0xcee7('0xb')]);router['get'](_0xcee7('0xc'),auth[_0xcee7('0x5')](),controller[_0xcee7('0xd')]);router[_0xcee7('0xe')]('/',auth['isAuthenticated'](),controller[_0xcee7('0xf')]);router['post']('/:id/configurations',auth[_0xcee7('0x5')](),controller[_0xcee7('0x10')]);router['put'](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x11')]);router[_0xcee7('0x12')](_0xcee7('0x7'),auth[_0xcee7('0x5')](),controller[_0xcee7('0x13')]);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 b9ab5d7..75d4b7c 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 _0x22fb=['STRING'];(function(_0x343c70,_0x1681c6){var _0x1468c7=function(_0x3f40c1){while(--_0x3f40c1){_0x343c70['push'](_0x343c70['shift']());}};_0x1468c7(++_0x1681c6);}(_0x22fb,0x192));var _0xb22f=function(_0x34af31,_0x580527){_0x34af31=_0x34af31-0x0;var _0xb388b3=_0x22fb[_0x34af31];return _0xb388b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0xee5b=['sequelize','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x28eecc,_0x456d20){_0x28eecc=_0x28eecc-0x0;var _0x28b963=_0xee5b[_0x28eecc];return _0x28b963;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 839f4e2..8b859e9 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 _0x6a5a=['stack','name','index','map','ZohoAccount','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZohoConfiguration','order','getConfigurations','addConfiguration','Subjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error'];(function(_0x44d44a,_0x56d17c){var _0x826754=function(_0x1bf3d5){while(--_0x1bf3d5){_0x44d44a['push'](_0x44d44a['shift']());}};_0x826754(++_0x56d17c);}(_0x6a5a,0xe6));var _0xa6a5=function(_0x4dc12b,_0x201618){_0x4dc12b=_0x4dc12b-0x0;var _0x377804=_0x6a5a[_0x4dc12b];return _0x377804;};'use strict';var emlformat=require(_0xa6a5('0x0'));var rimraf=require(_0xa6a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6a5('0x2'));var rp=require(_0xa6a5('0x3'));var moment=require(_0xa6a5('0x4'));var BPromise=require(_0xa6a5('0x5'));var Mustache=require(_0xa6a5('0x6'));var util=require(_0xa6a5('0x7'));var path=require('path');var sox=require(_0xa6a5('0x8'));var csv=require('to-csv');var ejs=require(_0xa6a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6a5('0xa'));var squel=require(_0xa6a5('0xb'));var crypto=require(_0xa6a5('0xc'));var jsforce=require(_0xa6a5('0xd'));var deskjs=require(_0xa6a5('0xe'));var toCsv=require(_0xa6a5('0xf'));var querystring=require('querystring');var Papa=require(_0xa6a5('0x10'));var Redis=require(_0xa6a5('0x11'));var authService=require(_0xa6a5('0x12'));var qs=require(_0xa6a5('0x13'));var as=require(_0xa6a5('0x14'));var hardwareService=require(_0xa6a5('0x15'));var logger=require(_0xa6a5('0x16'))(_0xa6a5('0x17'));var utils=require(_0xa6a5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa6a5('0x19'));var db=require(_0xa6a5('0x1a'))['db'];var integrations=require(_0xa6a5('0x1b'));function respondWithStatusCode(_0x104100,_0x23047a){_0x23047a=_0x23047a||0xcc;return function(_0x2cf569){if(_0x2cf569){return _0x104100[_0xa6a5('0x1c')](_0x23047a);}return _0x104100[_0xa6a5('0x1d')](_0x23047a)['end']();};}function respondWithResult(_0x4528d7,_0x5558d2){_0x5558d2=_0x5558d2||0xc8;return function(_0xfbd6b8){if(_0xfbd6b8){return _0x4528d7[_0xa6a5('0x1d')](_0x5558d2)[_0xa6a5('0x1e')](_0xfbd6b8);}};}function respondWithFilteredResult(_0x99f1b8,_0x2dd292){return function(_0x56f529){if(_0x56f529){var _0x5aa038=typeof _0x2dd292[_0xa6a5('0x1f')]===_0xa6a5('0x20')&&typeof _0x2dd292[_0xa6a5('0x21')]===_0xa6a5('0x20');var _0x2e964f=_0x56f529[_0xa6a5('0x22')];var _0x45f38d=_0x5aa038?0x0:_0x2dd292[_0xa6a5('0x1f')];var _0x3b15eb=_0x5aa038?_0x56f529[_0xa6a5('0x22')]:_0x2dd292[_0xa6a5('0x1f')]+_0x2dd292[_0xa6a5('0x21')];var _0x59c9ba;if(_0x3b15eb>=_0x2e964f){_0x3b15eb=_0x2e964f;_0x59c9ba=0xc8;}else{_0x59c9ba=0xce;}_0x99f1b8[_0xa6a5('0x1d')](_0x59c9ba);return _0x99f1b8[_0xa6a5('0x23')](_0xa6a5('0x24'),_0x45f38d+'-'+_0x3b15eb+'/'+_0x2e964f)[_0xa6a5('0x1e')](_0x56f529);}return null;};}function patchUpdates(_0x5a1072){return function(_0x22f866){try{jsonpatch[_0xa6a5('0x25')](_0x22f866,_0x5a1072,!![]);}catch(_0x8c0cd){return BPromise['reject'](_0x8c0cd);}return _0x22f866[_0xa6a5('0x26')]();};}function saveUpdates(_0x3d9c99,_0x11e24e){return function(_0x5c86f4){if(_0x5c86f4){return _0x5c86f4[_0xa6a5('0x27')](_0x3d9c99)['then'](function(_0x1a17c7){return _0x1a17c7;});}return null;};}function removeEntity(_0x4808f1,_0xc0ecf7){return function(_0x304f70){if(_0x304f70){return _0x304f70[_0xa6a5('0x28')]()[_0xa6a5('0x29')](function(){_0x4808f1[_0xa6a5('0x1d')](0xcc)[_0xa6a5('0x2a')]();});}};}function handleEntityNotFound(_0x48d044,_0x123b9b){return function(_0x1c569e){if(!_0x1c569e){_0x48d044[_0xa6a5('0x1c')](0x194);}return _0x1c569e;};}function handleError(_0x432f69,_0x402220){_0x402220=_0x402220||0x1f4;return function(_0xd111e2){logger[_0xa6a5('0x2b')](_0xd111e2[_0xa6a5('0x2c')]);if(_0xd111e2[_0xa6a5('0x2d')]){delete _0xd111e2[_0xa6a5('0x2d')];}_0x432f69[_0xa6a5('0x1d')](_0x402220)['send'](_0xd111e2);};}exports[_0xa6a5('0x2e')]=function(_0x384f2f,_0xfe58c3){var _0xf331f6={},_0x9624a={},_0xee6a0={'count':0x0,'rows':[]};var _0x5c38f3=_[_0xa6a5('0x2f')](db[_0xa6a5('0x30')][_0xa6a5('0x31')],function(_0x3ebcd0){return{'name':_0x3ebcd0['fieldName'],'type':_0x3ebcd0[_0xa6a5('0x32')]['key']};});_0x9624a[_0xa6a5('0x33')]=_[_0xa6a5('0x2f')](_0x5c38f3,_0xa6a5('0x2d'));_0x9624a['query']=_[_0xa6a5('0x34')](_0x384f2f[_0xa6a5('0x35')]);_0x9624a['filters']=_[_0xa6a5('0x36')](_0x9624a['model'],_0x9624a[_0xa6a5('0x35')]);_0xf331f6[_0xa6a5('0x37')]=_[_0xa6a5('0x36')](_0x9624a[_0xa6a5('0x33')],qs[_0xa6a5('0x38')](_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x38')]));_0xf331f6[_0xa6a5('0x37')]=_0xf331f6[_0xa6a5('0x37')][_0xa6a5('0x39')]?_0xf331f6[_0xa6a5('0x37')]:_0x9624a[_0xa6a5('0x33')];if(!_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x3a')](_0xa6a5('0x3b'))){_0xf331f6[_0xa6a5('0x21')]=qs[_0xa6a5('0x21')](_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x21')]);_0xf331f6[_0xa6a5('0x1f')]=qs[_0xa6a5('0x1f')](_0x384f2f[_0xa6a5('0x35')]['offset']);}_0xf331f6['order']=qs['sort'](_0x384f2f['query'][_0xa6a5('0x3c')]);_0xf331f6[_0xa6a5('0x3d')]=qs[_0xa6a5('0x3e')](_[_0xa6a5('0x3f')](_0x384f2f['query'],_0x9624a['filters']),_0x5c38f3);if(_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x40')]){_0xf331f6[_0xa6a5('0x3d')]=_['merge'](_0xf331f6['where'],{'$or':_['map'](_0x5c38f3,function(_0x1bbbf9){if(_0x1bbbf9['type']!==_0xa6a5('0x41')){var _0x30354c={};_0x30354c[_0x1bbbf9['name']]={'$like':'%'+_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x40')]+'%'};return _0x30354c;}})});}_0xf331f6=_[_0xa6a5('0x42')]({},_0xf331f6,_0x384f2f[_0xa6a5('0x43')]);var _0x802376={'where':_0xf331f6[_0xa6a5('0x3d')]};return db[_0xa6a5('0x30')][_0xa6a5('0x22')](_0x802376)[_0xa6a5('0x29')](function(_0xcb537d){_0xee6a0[_0xa6a5('0x22')]=_0xcb537d;if(_0x384f2f[_0xa6a5('0x35')][_0xa6a5('0x44')]){_0xf331f6[_0xa6a5('0x45')]=[{'all':!![]}];}return db[_0xa6a5('0x30')][_0xa6a5('0x46')](_0xf331f6);})[_0xa6a5('0x29')](function(_0x2c3898){_0xee6a0[_0xa6a5('0x47')]=_0x2c3898;return _0xee6a0;})[_0xa6a5('0x29')](respondWithFilteredResult(_0xfe58c3,_0xf331f6))[_0xa6a5('0x48')](handleError(_0xfe58c3,null));};exports[_0xa6a5('0x49')]=function(_0x3bdb98,_0x2a2a00){var _0x18f481={'raw':![],'where':{'id':_0x3bdb98[_0xa6a5('0x4a')]['id']}},_0x2126bf={};_0x2126bf['model']=_['keys'](db[_0xa6a5('0x30')]['rawAttributes']);_0x2126bf[_0xa6a5('0x35')]=_['keys'](_0x3bdb98[_0xa6a5('0x35')]);_0x2126bf[_0xa6a5('0x3e')]=_[_0xa6a5('0x36')](_0x2126bf[_0xa6a5('0x33')],_0x2126bf[_0xa6a5('0x35')]);_0x18f481[_0xa6a5('0x37')]=_[_0xa6a5('0x36')](_0x2126bf[_0xa6a5('0x33')],qs[_0xa6a5('0x38')](_0x3bdb98[_0xa6a5('0x35')][_0xa6a5('0x38')]));_0x18f481[_0xa6a5('0x37')]=_0x18f481[_0xa6a5('0x37')][_0xa6a5('0x39')]?_0x18f481[_0xa6a5('0x37')]:_0x2126bf[_0xa6a5('0x33')];if(_0x3bdb98[_0xa6a5('0x35')]['includeAll']){_0x18f481[_0xa6a5('0x45')]=[{'all':!![]}];}_0x18f481=_[_0xa6a5('0x42')]({},_0x18f481,_0x3bdb98[_0xa6a5('0x43')]);return db[_0xa6a5('0x30')][_0xa6a5('0x4b')](_0x18f481)[_0xa6a5('0x29')](handleEntityNotFound(_0x2a2a00,null))['then'](respondWithResult(_0x2a2a00,null))[_0xa6a5('0x48')](handleError(_0x2a2a00,null));};exports[_0xa6a5('0x4c')]=function(_0x53ee44,_0x446d2e){return db['ZohoAccount'][_0xa6a5('0x4c')](_0x53ee44[_0xa6a5('0x4d')],{})['then'](respondWithResult(_0x446d2e,0xc9))[_0xa6a5('0x48')](handleError(_0x446d2e,null));};exports['update']=function(_0x4227c2,_0x4eaa78){if(_0x4227c2['body']['id']){delete _0x4227c2[_0xa6a5('0x4d')]['id'];}return db[_0xa6a5('0x30')][_0xa6a5('0x4b')]({'where':{'id':_0x4227c2[_0xa6a5('0x4a')]['id']}})[_0xa6a5('0x29')](handleEntityNotFound(_0x4eaa78,null))[_0xa6a5('0x29')](saveUpdates(_0x4227c2[_0xa6a5('0x4d')],null))['then'](respondWithResult(_0x4eaa78,null))[_0xa6a5('0x48')](handleError(_0x4eaa78,null));};exports[_0xa6a5('0x28')]=function(_0x5db006,_0x12f4f2){return db[_0xa6a5('0x30')][_0xa6a5('0x4b')]({'where':{'id':_0x5db006[_0xa6a5('0x4a')]['id']}})[_0xa6a5('0x29')](handleEntityNotFound(_0x12f4f2,null))['then'](removeEntity(_0x12f4f2,null))[_0xa6a5('0x48')](handleError(_0x12f4f2,null));};exports['getConfigurations']=function(_0x22349d,_0x3a4036,_0x550e05){var _0x4a806a={};var _0x5222e6={};var _0x3b7320;var _0x318b39;return db[_0xa6a5('0x30')][_0xa6a5('0x4e')]({'where':{'id':_0x22349d['params']['id']}})[_0xa6a5('0x29')](handleEntityNotFound(_0x3a4036,null))[_0xa6a5('0x29')](function(_0x1ff4f3){if(_0x1ff4f3){_0x3b7320=_0x1ff4f3;_0x5222e6['model']=_[_0xa6a5('0x34')](db[_0xa6a5('0x4f')]['rawAttributes']);_0x5222e6[_0xa6a5('0x35')]=_['keys'](_0x22349d[_0xa6a5('0x35')]);_0x5222e6[_0xa6a5('0x3e')]=_[_0xa6a5('0x36')](_0x5222e6['model'],_0x5222e6['query']);_0x4a806a[_0xa6a5('0x37')]=_[_0xa6a5('0x36')](_0x5222e6[_0xa6a5('0x33')],qs[_0xa6a5('0x38')](_0x22349d[_0xa6a5('0x35')][_0xa6a5('0x38')]));_0x4a806a[_0xa6a5('0x37')]=_0x4a806a[_0xa6a5('0x37')][_0xa6a5('0x39')]?_0x4a806a['attributes']:_0x5222e6['model'];_0x4a806a[_0xa6a5('0x50')]=qs[_0xa6a5('0x3c')](_0x22349d['query']['sort']);_0x4a806a[_0xa6a5('0x3d')]=qs[_0xa6a5('0x3e')](_[_0xa6a5('0x3f')](_0x22349d['query'],_0x5222e6[_0xa6a5('0x3e')]));if(_0x22349d['query'][_0xa6a5('0x40')]){_0x4a806a[_0xa6a5('0x3d')]=_[_0xa6a5('0x42')](_0x4a806a['where'],{'$or':_['map'](_0x4a806a['attributes'],function(_0x40142a){var _0x75ca49={};_0x75ca49[_0x40142a]={'$like':'%'+_0x22349d[_0xa6a5('0x35')][_0xa6a5('0x40')]+'%'};return _0x75ca49;})});}_0x4a806a=_[_0xa6a5('0x42')]({},_0x4a806a,_0x22349d[_0xa6a5('0x43')]);return _0x3b7320[_0xa6a5('0x51')](_0x4a806a);}})['then'](function(_0x48fddf){if(_0x48fddf){_0x318b39=_0x48fddf[_0xa6a5('0x39')];if(!_0x22349d[_0xa6a5('0x35')]['hasOwnProperty'](_0xa6a5('0x3b'))){_0x4a806a[_0xa6a5('0x21')]=qs[_0xa6a5('0x21')](_0x22349d[_0xa6a5('0x35')]['limit']);_0x4a806a[_0xa6a5('0x1f')]=qs[_0xa6a5('0x1f')](_0x22349d[_0xa6a5('0x35')][_0xa6a5('0x1f')]);}return _0x3b7320['getConfigurations'](_0x4a806a);}})[_0xa6a5('0x29')](function(_0x567c9b){if(_0x567c9b){return _0x567c9b?{'count':_0x318b39,'rows':_0x567c9b}:null;}})[_0xa6a5('0x29')](respondWithResult(_0x3a4036,null))[_0xa6a5('0x48')](handleError(_0x3a4036,null));};exports[_0xa6a5('0x52')]=function(_0x827db2,_0x435db9,_0x6814ec){if(_0x827db2[_0xa6a5('0x4d')]['id']){delete _0x827db2[_0xa6a5('0x4d')]['id'];}return db[_0xa6a5('0x30')][_0xa6a5('0x4e')]({'where':{'id':_0x827db2[_0xa6a5('0x4a')]['id']}})[_0xa6a5('0x29')](handleEntityNotFound(_0x435db9,null))[_0xa6a5('0x29')](function(_0x2e3138){if(_0x2e3138){_0x827db2[_0xa6a5('0x4d')]['AccountId']=_0x2e3138['id'];_0x827db2[_0xa6a5('0x4d')][_0xa6a5('0x53')]=integrations['getSubjects'](_0x827db2[_0xa6a5('0x4d')][_0xa6a5('0x54')],_0x827db2[_0xa6a5('0x4d')][_0xa6a5('0x32')]);_0x827db2[_0xa6a5('0x4d')]['Descriptions']=integrations[_0xa6a5('0x55')](_0x827db2[_0xa6a5('0x4d')][_0xa6a5('0x54')],_0x827db2[_0xa6a5('0x4d')][_0xa6a5('0x32')]);return db[_0xa6a5('0x4f')][_0xa6a5('0x4c')](_0x827db2[_0xa6a5('0x4d')],{'include':[{'model':db['ZohoField'],'as':_0xa6a5('0x53')},{'model':db[_0xa6a5('0x56')],'as':_0xa6a5('0x57')}]});}return null;})[_0xa6a5('0x29')](respondWithResult(_0x435db9,null))[_0xa6a5('0x48')](handleError(_0x435db9,null));};function getAccessToken(_0x189e81){return new Promise(function(_0x180de1,_0x1be813){var _0x2a8d3f;switch(_0x189e81[_0xa6a5('0x58')]){case'US':_0x2a8d3f=_0xa6a5('0x59');break;case'AU':_0x2a8d3f=_0xa6a5('0x5a');break;case'EU':_0x2a8d3f=_0xa6a5('0x5b');break;case'IN':_0x2a8d3f='https://accounts.zoho.in';break;case'CN':_0x2a8d3f=_0xa6a5('0x5c');break;default:_0x2a8d3f=_0xa6a5('0x5b');break;}var _0x186339={'method':_0xa6a5('0x5d'),'uri':_0x2a8d3f+_0xa6a5('0x5e'),'qs':{'refresh_token':_0x189e81[_0xa6a5('0x5f')],'client_id':_0x189e81[_0xa6a5('0x60')],'client_secret':_0x189e81[_0xa6a5('0x61')],'grant_type':_0xa6a5('0x62')},'json':!![]};return rp(_0x186339)[_0xa6a5('0x29')](function(_0x1817d6){if(_0x1817d6[_0xa6a5('0x63')]){_0x180de1(_0x1817d6['access_token']);}else{_0x1be813(_0xa6a5('0x64'));}})['catch'](function(_0x4cde35){_0x1be813(_0x4cde35);});});}exports[_0xa6a5('0x65')]=function(_0x1731b9,_0x583734,_0x24a772){var _0x4ce41d,_0x3546c4,_0x28228e,_0x4269d7,_0x57d012;return db[_0xa6a5('0x30')][_0xa6a5('0x4e')]({'where':{'id':_0x1731b9[_0xa6a5('0x4a')]['id']},'attributes':['id',_0xa6a5('0x66'),_0xa6a5('0x58'),_0xa6a5('0x60'),_0xa6a5('0x61'),'serverUrl',_0xa6a5('0x67'),_0xa6a5('0x5f')]})['then'](handleEntityNotFound(_0x583734,null))[_0xa6a5('0x29')](function(_0x6fcbac){_0x57d012=_0x6fcbac;_0x4ce41d=_0x57d012[_0xa6a5('0x66')];_0x3546c4=_0x4ce41d===_0xa6a5('0x68')?'eu':_0xa6a5('0x69');_0x28228e=_0x57d012['serverUrl'];var _0x137825=_0x28228e[_0xa6a5('0x6a')](-0x1);if(_0x137825==='/'||_0x137825==='\x5c'||_0x137825===':'){_0x28228e=_0x28228e[_0xa6a5('0x6b')](0x0,_0x28228e[_0xa6a5('0x6c')](_0x137825));}if(!_0x57d012['refreshToken']){throw new Error(_0xa6a5('0x6d'));}return getAccessToken(_0x57d012);})['then'](function(_0x1387a2){if(_0x1387a2){return rp({'method':_0xa6a5('0x6e'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3546c4),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa6a5('0x6f')+_0x1387a2},'json':!![]});}})['then'](function(_0x1dd9c3){if(_0x1dd9c3){if(_0x1dd9c3[_0xa6a5('0x70')]&&_0x1dd9c3[_0xa6a5('0x70')][_0xa6a5('0x2b')]){throw new Error(_0x1dd9c3['response'][_0xa6a5('0x2b')][_0xa6a5('0x71')]);}var _0x2689ec=[];var _0x347d79=[];var _0x5fa07a=[_0xa6a5('0x72'),_0xa6a5('0x73'),_0xa6a5('0x74'),_0xa6a5('0x75'),_0xa6a5('0x76'),_0xa6a5('0x77'),_0xa6a5('0x78'),_0xa6a5('0x79')];_0x347d79=_[_0xa6a5('0x7a')](_0x1dd9c3[_0xa6a5('0x38')],function(_0x14e1d4){return _0x5fa07a[_0xa6a5('0x7b')](_0x14e1d4[_0xa6a5('0x7c')]);});for(var _0x14afab=0x0;_0x14afab<_0x347d79[_0xa6a5('0x39')];_0x14afab++){if(_0x347d79[_0x14afab][_0xa6a5('0x7d')]===![]){_0x2689ec[_0xa6a5('0x7e')]({'id':_0x347d79[_0x14afab]['id'],'name':_0x347d79[_0x14afab]['display_label'],'custom':_0x347d79[_0x14afab][_0xa6a5('0x7f')],'options':_0x347d79[_0x14afab][_0xa6a5('0x80')]===_0xa6a5('0x81')&&_0x347d79[_0x14afab]['pick_list_values'][_0xa6a5('0x39')]>-0x1?_[_0xa6a5('0x2f')](_0x347d79[_0x14afab][_0xa6a5('0x82')],function(_0xbb53b0){return{'name':_0xbb53b0,'value':_0xbb53b0};}):[]});}}return{'count':_0x2689ec[_0xa6a5('0x39')],'rows':_0x2689ec};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x583734,null))[_0xa6a5('0x48')](function(_0x3d9d09){var _0x369f6f=_0x1731b9[_0xa6a5('0x35')][_0xa6a5('0x83')]?0x1f4:_0x3d9d09[_0xa6a5('0x84')]||0x1f4;logger[_0xa6a5('0x2b')](_0xa6a5('0x85'),_0xa6a5('0x65'),_0x369f6f,JSON[_0xa6a5('0x86')](_0x3d9d09));delete _0x3d9d09['name'];if(_0x369f6f===0x191){_0x369f6f=0x190;}_0x583734[_0xa6a5('0x1d')](_0x369f6f)[_0xa6a5('0x87')](_0x1731b9['query'][_0xa6a5('0x83')]?{'message':_0xa6a5('0x88'),'statusCode':_0x3d9d09[_0xa6a5('0x84')]}:_0x3d9d09);});}; \ No newline at end of file +var _0xee24=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','Subjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0xaeca13,_0x51587a){var _0x2a9c6a=function(_0x39b7c4){while(--_0x39b7c4){_0xaeca13['push'](_0xaeca13['shift']());}};_0x2a9c6a(++_0x51587a);}(_0xee24,0x172));var _0x4ee2=function(_0x1255ae,_0x538fc2){_0x1255ae=_0x1255ae-0x0;var _0x5aee74=_0xee24[_0x1255ae];return _0x5aee74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require(_0x4ee2('0x2'));var rp=require(_0x4ee2('0x3'));var moment=require(_0x4ee2('0x4'));var BPromise=require(_0x4ee2('0x5'));var Mustache=require(_0x4ee2('0x6'));var util=require('util');var path=require(_0x4ee2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ee2('0x8'));var fs=require('fs');var fs_extra=require(_0x4ee2('0x9'));var _=require(_0x4ee2('0xa'));var squel=require('squel');var crypto=require(_0x4ee2('0xb'));var jsforce=require(_0x4ee2('0xc'));var deskjs=require(_0x4ee2('0xd'));var toCsv=require(_0x4ee2('0xe'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require(_0x4ee2('0x11'));var authService=require(_0x4ee2('0x12'));var qs=require(_0x4ee2('0x13'));var as=require(_0x4ee2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ee2('0x16'))['db'];var integrations=require(_0x4ee2('0x17'));function respondWithStatusCode(_0x359cd8,_0x114a08){_0x114a08=_0x114a08||0xcc;return function(_0x43f55f){if(_0x43f55f){return _0x359cd8[_0x4ee2('0x18')](_0x114a08);}return _0x359cd8[_0x4ee2('0x19')](_0x114a08)['end']();};}function respondWithResult(_0x47cfe6,_0x3c4934){_0x3c4934=_0x3c4934||0xc8;return function(_0x3bc468){if(_0x3bc468){return _0x47cfe6[_0x4ee2('0x19')](_0x3c4934)[_0x4ee2('0x1a')](_0x3bc468);}};}function respondWithFilteredResult(_0x48a048,_0x4aef7b){return function(_0x2cfaa2){if(_0x2cfaa2){var _0x1b14ba=typeof _0x4aef7b['offset']===_0x4ee2('0x1b')&&typeof _0x4aef7b[_0x4ee2('0x1c')]===_0x4ee2('0x1b');var _0x16e8d6=_0x2cfaa2[_0x4ee2('0x1d')];var _0xaef88f=_0x1b14ba?0x0:_0x4aef7b[_0x4ee2('0x1e')];var _0x421665=_0x1b14ba?_0x2cfaa2[_0x4ee2('0x1d')]:_0x4aef7b[_0x4ee2('0x1e')]+_0x4aef7b['limit'];var _0x52c9d7;if(_0x421665>=_0x16e8d6){_0x421665=_0x16e8d6;_0x52c9d7=0xc8;}else{_0x52c9d7=0xce;}_0x48a048['status'](_0x52c9d7);return _0x48a048[_0x4ee2('0x1f')](_0x4ee2('0x20'),_0xaef88f+'-'+_0x421665+'/'+_0x16e8d6)[_0x4ee2('0x1a')](_0x2cfaa2);}return null;};}function patchUpdates(_0x3651c6){return function(_0x50453c){try{jsonpatch[_0x4ee2('0x21')](_0x50453c,_0x3651c6,!![]);}catch(_0x16dde4){return BPromise['reject'](_0x16dde4);}return _0x50453c[_0x4ee2('0x22')]();};}function saveUpdates(_0x43f520,_0x234dbf){return function(_0x386f4e){if(_0x386f4e){return _0x386f4e[_0x4ee2('0x23')](_0x43f520)[_0x4ee2('0x24')](function(_0x1e5a44){return _0x1e5a44;});}return null;};}function removeEntity(_0x4a764c,_0x41fbb7){return function(_0x315735){if(_0x315735){return _0x315735[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){_0x4a764c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a7a3,_0x36a66){return function(_0xe04041){if(!_0xe04041){_0x40a7a3[_0x4ee2('0x18')](0x194);}return _0xe04041;};}function handleError(_0x4310a8,_0x18e0d6){_0x18e0d6=_0x18e0d6||0x1f4;return function(_0x3cd3f1){logger[_0x4ee2('0x26')](_0x3cd3f1[_0x4ee2('0x27')]);if(_0x3cd3f1['name']){delete _0x3cd3f1[_0x4ee2('0x28')];}_0x4310a8[_0x4ee2('0x19')](_0x18e0d6)[_0x4ee2('0x29')](_0x3cd3f1);};}exports[_0x4ee2('0x2a')]=function(_0x701789,_0x4006b7){var _0x239e83={},_0x338032={},_0x86d1b4={'count':0x0,'rows':[]};var _0x336265=_[_0x4ee2('0x2b')](db[_0x4ee2('0x2c')][_0x4ee2('0x2d')],function(_0x21d868){return{'name':_0x21d868[_0x4ee2('0x2e')],'type':_0x21d868['type'][_0x4ee2('0x2f')]};});_0x338032[_0x4ee2('0x30')]=_[_0x4ee2('0x2b')](_0x336265,_0x4ee2('0x28'));_0x338032[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x701789[_0x4ee2('0x31')]);_0x338032['filters']=_['intersection'](_0x338032[_0x4ee2('0x30')],_0x338032[_0x4ee2('0x31')]);_0x239e83['attributes']=_[_0x4ee2('0x33')](_0x338032[_0x4ee2('0x30')],qs[_0x4ee2('0x34')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x34')]));_0x239e83[_0x4ee2('0x35')]=_0x239e83['attributes'][_0x4ee2('0x36')]?_0x239e83[_0x4ee2('0x35')]:_0x338032[_0x4ee2('0x30')];if(!_0x701789[_0x4ee2('0x31')][_0x4ee2('0x37')](_0x4ee2('0x38'))){_0x239e83[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x1c')]);_0x239e83[_0x4ee2('0x1e')]=qs[_0x4ee2('0x1e')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x1e')]);}_0x239e83['order']=qs[_0x4ee2('0x39')](_0x701789[_0x4ee2('0x31')][_0x4ee2('0x39')]);_0x239e83['where']=qs[_0x4ee2('0x3a')](_[_0x4ee2('0x3b')](_0x701789[_0x4ee2('0x31')],_0x338032[_0x4ee2('0x3a')]),_0x336265);if(_0x701789[_0x4ee2('0x31')][_0x4ee2('0x3c')]){_0x239e83[_0x4ee2('0x3d')]=_[_0x4ee2('0x3e')](_0x239e83[_0x4ee2('0x3d')],{'$or':_[_0x4ee2('0x2b')](_0x336265,function(_0x4cbd62){if(_0x4cbd62[_0x4ee2('0x3f')]!=='VIRTUAL'){var _0x129ef2={};_0x129ef2[_0x4cbd62[_0x4ee2('0x28')]]={'$like':'%'+_0x701789['query']['filter']+'%'};return _0x129ef2;}})});}_0x239e83=_[_0x4ee2('0x3e')]({},_0x239e83,_0x701789[_0x4ee2('0x40')]);var _0x5639dc={'where':_0x239e83['where']};return db[_0x4ee2('0x2c')][_0x4ee2('0x1d')](_0x5639dc)[_0x4ee2('0x24')](function(_0x192163){_0x86d1b4[_0x4ee2('0x1d')]=_0x192163;if(_0x701789[_0x4ee2('0x31')][_0x4ee2('0x41')]){_0x239e83[_0x4ee2('0x42')]=[{'all':!![]}];}return db['ZohoAccount'][_0x4ee2('0x43')](_0x239e83);})[_0x4ee2('0x24')](function(_0x5f28e2){_0x86d1b4['rows']=_0x5f28e2;return _0x86d1b4;})[_0x4ee2('0x24')](respondWithFilteredResult(_0x4006b7,_0x239e83))[_0x4ee2('0x44')](handleError(_0x4006b7,null));};exports[_0x4ee2('0x45')]=function(_0x41bad6,_0x159b99){var _0x4f6cd1={'raw':![],'where':{'id':_0x41bad6['params']['id']}},_0x57d970={};_0x57d970[_0x4ee2('0x30')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2c')][_0x4ee2('0x2d')]);_0x57d970[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41bad6[_0x4ee2('0x31')]);_0x57d970[_0x4ee2('0x3a')]=_[_0x4ee2('0x33')](_0x57d970[_0x4ee2('0x30')],_0x57d970[_0x4ee2('0x31')]);_0x4f6cd1[_0x4ee2('0x35')]=_['intersection'](_0x57d970[_0x4ee2('0x30')],qs[_0x4ee2('0x34')](_0x41bad6[_0x4ee2('0x31')][_0x4ee2('0x34')]));_0x4f6cd1[_0x4ee2('0x35')]=_0x4f6cd1[_0x4ee2('0x35')][_0x4ee2('0x36')]?_0x4f6cd1[_0x4ee2('0x35')]:_0x57d970['model'];if(_0x41bad6[_0x4ee2('0x31')]['includeAll']){_0x4f6cd1['include']=[{'all':!![]}];}_0x4f6cd1=_[_0x4ee2('0x3e')]({},_0x4f6cd1,_0x41bad6[_0x4ee2('0x40')]);return db['ZohoAccount'][_0x4ee2('0x46')](_0x4f6cd1)[_0x4ee2('0x24')](handleEntityNotFound(_0x159b99,null))[_0x4ee2('0x24')](respondWithResult(_0x159b99,null))[_0x4ee2('0x44')](handleError(_0x159b99,null));};exports[_0x4ee2('0x47')]=function(_0xe338f5,_0x4e555c){return db[_0x4ee2('0x2c')][_0x4ee2('0x47')](_0xe338f5[_0x4ee2('0x48')],{})[_0x4ee2('0x24')](respondWithResult(_0x4e555c,0xc9))[_0x4ee2('0x44')](handleError(_0x4e555c,null));};exports['update']=function(_0x264526,_0x2b6f45){if(_0x264526[_0x4ee2('0x48')]['id']){delete _0x264526[_0x4ee2('0x48')]['id'];}return db[_0x4ee2('0x2c')]['find']({'where':{'id':_0x264526[_0x4ee2('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b6f45,null))[_0x4ee2('0x24')](saveUpdates(_0x264526['body'],null))[_0x4ee2('0x24')](respondWithResult(_0x2b6f45,null))[_0x4ee2('0x44')](handleError(_0x2b6f45,null));};exports[_0x4ee2('0x25')]=function(_0x4e28cb,_0x5d47a6){return db[_0x4ee2('0x2c')]['find']({'where':{'id':_0x4e28cb['params']['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5d47a6,null))['then'](removeEntity(_0x5d47a6,null))[_0x4ee2('0x44')](handleError(_0x5d47a6,null));};exports[_0x4ee2('0x4a')]=function(_0x368abf,_0x45a48e,_0x26d584){var _0x494a95={};var _0x1c4252={};var _0x22172f;var _0x5f42fe;return db[_0x4ee2('0x2c')][_0x4ee2('0x4b')]({'where':{'id':_0x368abf['params']['id']}})['then'](handleEntityNotFound(_0x45a48e,null))[_0x4ee2('0x24')](function(_0x5d21a3){if(_0x5d21a3){_0x22172f=_0x5d21a3;_0x1c4252[_0x4ee2('0x30')]=_['keys'](db[_0x4ee2('0x4c')][_0x4ee2('0x2d')]);_0x1c4252[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x368abf[_0x4ee2('0x31')]);_0x1c4252[_0x4ee2('0x3a')]=_['intersection'](_0x1c4252[_0x4ee2('0x30')],_0x1c4252[_0x4ee2('0x31')]);_0x494a95[_0x4ee2('0x35')]=_[_0x4ee2('0x33')](_0x1c4252['model'],qs[_0x4ee2('0x34')](_0x368abf[_0x4ee2('0x31')]['fields']));_0x494a95[_0x4ee2('0x35')]=_0x494a95[_0x4ee2('0x35')]['length']?_0x494a95[_0x4ee2('0x35')]:_0x1c4252[_0x4ee2('0x30')];_0x494a95[_0x4ee2('0x4d')]=qs[_0x4ee2('0x39')](_0x368abf['query'][_0x4ee2('0x39')]);_0x494a95[_0x4ee2('0x3d')]=qs[_0x4ee2('0x3a')](_['pick'](_0x368abf['query'],_0x1c4252[_0x4ee2('0x3a')]));if(_0x368abf['query']['filter']){_0x494a95['where']=_[_0x4ee2('0x3e')](_0x494a95[_0x4ee2('0x3d')],{'$or':_['map'](_0x494a95[_0x4ee2('0x35')],function(_0x17c21b){var _0x4c3b0e={};_0x4c3b0e[_0x17c21b]={'$like':'%'+_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x3c')]+'%'};return _0x4c3b0e;})});}_0x494a95=_[_0x4ee2('0x3e')]({},_0x494a95,_0x368abf[_0x4ee2('0x40')]);return _0x22172f[_0x4ee2('0x4a')](_0x494a95);}})[_0x4ee2('0x24')](function(_0x360cc7){if(_0x360cc7){_0x5f42fe=_0x360cc7[_0x4ee2('0x36')];if(!_0x368abf[_0x4ee2('0x31')]['hasOwnProperty']('nolimit')){_0x494a95[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x1c')]);_0x494a95[_0x4ee2('0x1e')]=qs['offset'](_0x368abf[_0x4ee2('0x31')][_0x4ee2('0x1e')]);}return _0x22172f[_0x4ee2('0x4a')](_0x494a95);}})[_0x4ee2('0x24')](function(_0x1d484a){if(_0x1d484a){return _0x1d484a?{'count':_0x5f42fe,'rows':_0x1d484a}:null;}})[_0x4ee2('0x24')](respondWithResult(_0x45a48e,null))[_0x4ee2('0x44')](handleError(_0x45a48e,null));};exports[_0x4ee2('0x4e')]=function(_0xa8df15,_0x42c49f,_0x48a74c){if(_0xa8df15[_0x4ee2('0x48')]['id']){delete _0xa8df15[_0x4ee2('0x48')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0xa8df15[_0x4ee2('0x49')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x42c49f,null))[_0x4ee2('0x24')](function(_0x127c46){if(_0x127c46){_0xa8df15[_0x4ee2('0x48')]['AccountId']=_0x127c46['id'];_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x4f')]=integrations['getSubjects'](_0xa8df15[_0x4ee2('0x48')]['channel'],_0xa8df15[_0x4ee2('0x48')]['type']);_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x50')]=integrations[_0x4ee2('0x51')](_0xa8df15[_0x4ee2('0x48')]['channel'],_0xa8df15[_0x4ee2('0x48')][_0x4ee2('0x3f')]);return db[_0x4ee2('0x4c')][_0x4ee2('0x47')](_0xa8df15[_0x4ee2('0x48')],{'include':[{'model':db[_0x4ee2('0x52')],'as':_0x4ee2('0x4f')},{'model':db[_0x4ee2('0x52')],'as':_0x4ee2('0x50')}]});}return null;})[_0x4ee2('0x24')](respondWithResult(_0x42c49f,null))[_0x4ee2('0x44')](handleError(_0x42c49f,null));};function getAccessToken(_0x30c1cc){return new Promise(function(_0x2e5573,_0x36ad91){var _0x41bfa9;switch(_0x30c1cc[_0x4ee2('0x53')]){case'US':_0x41bfa9=_0x4ee2('0x54');break;case'AU':_0x41bfa9=_0x4ee2('0x55');break;case'EU':_0x41bfa9='https://accounts.zoho.eu';break;case'IN':_0x41bfa9=_0x4ee2('0x56');break;case'CN':_0x41bfa9=_0x4ee2('0x57');break;default:_0x41bfa9='https://accounts.zoho.eu';break;}var _0x5cbba1={'method':'POST','uri':_0x41bfa9+'/oauth/v2/token','qs':{'refresh_token':_0x30c1cc['refreshToken'],'client_id':_0x30c1cc[_0x4ee2('0x58')],'client_secret':_0x30c1cc[_0x4ee2('0x59')],'grant_type':_0x4ee2('0x5a')},'json':!![]};return rp(_0x5cbba1)[_0x4ee2('0x24')](function(_0x4b82bd){if(_0x4b82bd['access_token']){_0x2e5573(_0x4b82bd[_0x4ee2('0x5b')]);}else{_0x36ad91(_0x4ee2('0x5c'));}})[_0x4ee2('0x44')](function(_0x1e7d99){_0x36ad91(_0x1e7d99);});});}exports['getFields']=function(_0x299c5d,_0x364741,_0x259830){var _0x797415,_0x444e50,_0x4a7329,_0x29a92d,_0xa6e045;return db[_0x4ee2('0x2c')][_0x4ee2('0x4b')]({'where':{'id':_0x299c5d[_0x4ee2('0x49')]['id']},'attributes':['id',_0x4ee2('0x5d'),_0x4ee2('0x53'),_0x4ee2('0x58'),_0x4ee2('0x59'),_0x4ee2('0x5e'),_0x4ee2('0x5f'),_0x4ee2('0x60')]})[_0x4ee2('0x24')](handleEntityNotFound(_0x364741,null))['then'](function(_0x2a2a9f){_0xa6e045=_0x2a2a9f;_0x797415=_0xa6e045[_0x4ee2('0x5d')];_0x444e50=_0x797415===_0x4ee2('0x61')?'eu':_0x4ee2('0x62');_0x4a7329=_0xa6e045[_0x4ee2('0x5e')];var _0x2da223=_0x4a7329[_0x4ee2('0x63')](-0x1);if(_0x2da223==='/'||_0x2da223==='\x5c'||_0x2da223===':'){_0x4a7329=_0x4a7329['substring'](0x0,_0x4a7329[_0x4ee2('0x64')](_0x2da223));}if(!_0xa6e045['refreshToken']){throw new Error(_0x4ee2('0x65'));}return getAccessToken(_0xa6e045);})[_0x4ee2('0x24')](function(_0x77a3ae){if(_0x77a3ae){return rp({'method':'GET','uri':util[_0x4ee2('0x66')](_0x4ee2('0x67'),_0x444e50),'qs':{'module':_0x4ee2('0x68')},'headers':{'Authorization':_0x4ee2('0x69')+_0x77a3ae},'json':!![]});}})['then'](function(_0x46bb4b){if(_0x46bb4b){if(_0x46bb4b[_0x4ee2('0x6a')]&&_0x46bb4b[_0x4ee2('0x6a')][_0x4ee2('0x26')]){throw new Error(_0x46bb4b['response'][_0x4ee2('0x26')][_0x4ee2('0x6b')]);}var _0x9f54c0=[];var _0x515a3a=[];var _0x3521b2=[_0x4ee2('0x6c'),'Subject',_0x4ee2('0x6d'),_0x4ee2('0x6e'),_0x4ee2('0x6f'),_0x4ee2('0x70'),'Call_Start_Time',_0x4ee2('0x71')];_0x515a3a=_['remove'](_0x46bb4b[_0x4ee2('0x34')],function(_0x36e54d){return _0x3521b2[_0x4ee2('0x72')](_0x36e54d[_0x4ee2('0x73')]);});for(var _0x30802c=0x0;_0x30802c<_0x515a3a[_0x4ee2('0x36')];_0x30802c++){if(_0x515a3a[_0x30802c][_0x4ee2('0x74')]===![]){_0x9f54c0[_0x4ee2('0x75')]({'id':_0x515a3a[_0x30802c]['id'],'name':_0x515a3a[_0x30802c][_0x4ee2('0x76')],'custom':_0x515a3a[_0x30802c]['custom_field'],'options':_0x515a3a[_0x30802c]['data_type']===_0x4ee2('0x77')&&_0x515a3a[_0x30802c]['pick_list_values'][_0x4ee2('0x36')]>-0x1?_[_0x4ee2('0x2b')](_0x515a3a[_0x30802c][_0x4ee2('0x78')],function(_0x469058){return{'name':_0x469058,'value':_0x469058};}):[]});}}return{'count':_0x9f54c0[_0x4ee2('0x36')],'rows':_0x9f54c0};}else{return{'count':0x0,'rows':[]};}})[_0x4ee2('0x24')](respondWithResult(_0x364741,null))['catch'](function(_0x3c3eae){var _0x64228a=_0x299c5d[_0x4ee2('0x31')]['test']?0x1f4:_0x3c3eae[_0x4ee2('0x79')]||0x1f4;logger[_0x4ee2('0x26')](_0x4ee2('0x7a'),_0x4ee2('0x7b'),_0x64228a,JSON[_0x4ee2('0x7c')](_0x3c3eae));delete _0x3c3eae[_0x4ee2('0x28')];if(_0x64228a===0x191){_0x64228a=0x190;}_0x364741[_0x4ee2('0x19')](_0x64228a)['send'](_0x299c5d['query'][_0x4ee2('0x7d')]?{'message':_0x4ee2('0x7e'),'statusCode':_0x3c3eae[_0x4ee2('0x79')]}:_0x3c3eae);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c4de43a..a0daa03 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 _0x63e5=['clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','https://accounts.zoho.com','application/x-www-form-urlencoded','refreshToken','catch','../../config/logger','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl'];(function(_0x46f5ca,_0x3eb787){var _0x3b7738=function(_0x25f469){while(--_0x25f469){_0x46f5ca['push'](_0x46f5ca['shift']());}};_0x3b7738(++_0x3eb787);}(_0x63e5,0x18d));var _0x563e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x63e5[_0x342700];return _0x53406f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x563e('0x0'))('api');var moment=require(_0x563e('0x1'));var BPromise=require('bluebird');var rp=require(_0x563e('0x2'));var fs=require('fs');var path=require(_0x563e('0x3'));var rimraf=require('rimraf');var config=require(_0x563e('0x4'));var attributes=require(_0x563e('0x5'));var integrations=require(_0x563e('0x6'));module['exports']=function(_0x5d0367,_0x5c2448){return _0x5d0367[_0x563e('0x7')](_0x563e('0x8'),attributes,{'tableName':_0x563e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5468bf,_0x5b0463,_0xb1b597){if(_0x5468bf['changed'](_0x563e('0xa'))||_0x5468bf[_0x563e('0xb')](_0x563e('0xc'))||_0x5468bf[_0x563e('0xb')](_0x563e('0xd'))||_0x5468bf[_0x563e('0xb')](_0x563e('0xe'))||_0x5468bf[_0x563e('0xb')](_0x563e('0xf'))||_0x5468bf[_0x563e('0xb')](_0x563e('0x10'))){var _0x4c1939,_0x26fadc;_0x4c1939=_0x5468bf[_0x563e('0xc')];var _0x30f495=_0x4c1939['slice'](-0x1);if(_0x30f495==='/'||_0x30f495==='\x5c'||_0x30f495===':'){_0x4c1939=_0x4c1939[_0x563e('0x11')](0x0,_0x4c1939[_0x563e('0x12')](_0x30f495));}switch(_0x5468bf[_0x563e('0xa')]){case'US':_0x26fadc='https://accounts.zoho.com';break;case'AU':_0x26fadc=_0x563e('0x13');break;case'IN':_0x26fadc=_0x563e('0x14');break;case'CN':_0x26fadc=_0x563e('0x15');break;default:_0x26fadc=_0x563e('0x16');break;}var _0x4fd8c3={'method':_0x563e('0x17'),'uri':_0x26fadc+_0x563e('0x18'),'form':{'grant_type':_0x563e('0x19'),'client_id':_0x5468bf[_0x563e('0xd')],'client_secret':_0x5468bf[_0x563e('0xe')],'redirect_uri':_0x5468bf[_0x563e('0xc')],'code':_0x5468bf[_0x563e('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4fd8c3)[_0x563e('0x1a')](function(_0x3bbc94){var _0x167bb7=JSON[_0x563e('0x1b')](_0x3bbc94);if(_0x167bb7[_0x563e('0x1c')]){_0x5468bf['refreshToken']=_0x167bb7[_0x563e('0x1c')];logger[_0x563e('0x1d')](util['format'](_0x563e('0x1e'),_0x5468bf[_0x563e('0x1f')],_0x5468bf['id']));}else{logger[_0x563e('0x20')](util[_0x563e('0x21')](_0x563e('0x22'),_0x5468bf[_0x563e('0x1f')],_0x5468bf['id']),util[_0x563e('0x23')](_0x167bb7,{'showHidden':![],'depth':null}));}return _0xb1b597(null,_0x5b0463);})['catch'](function(_0x12c99e){logger[_0x563e('0x20')](util[_0x563e('0x21')](_0x563e('0x22'),_0x5468bf[_0x563e('0x1f')],_0x5468bf['id']),util[_0x563e('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xb1b597(_0x12c99e);});}else{return _0xb1b597(null,_0x5b0463);}},'beforeUpdate':function(_0x16381e,_0x473c7e,_0x5c3bfe){if(_0x16381e['changed']('zone')||_0x16381e['changed'](_0x563e('0xc'))||_0x16381e[_0x563e('0xb')](_0x563e('0xd'))||_0x16381e[_0x563e('0xb')]('clientSecret')||_0x16381e['changed'](_0x563e('0xf'))||_0x16381e[_0x563e('0xb')](_0x563e('0x10'))){var _0x2c6b21,_0x3c4c07;_0x2c6b21=_0x16381e['serverUrl'];var _0x52d167=_0x2c6b21[_0x563e('0x24')](-0x1);if(_0x52d167==='/'||_0x52d167==='\x5c'||_0x52d167===':'){_0x2c6b21=_0x2c6b21['substring'](0x0,_0x2c6b21[_0x563e('0x12')](_0x52d167));}switch(_0x16381e[_0x563e('0xa')]){case'US':_0x3c4c07=_0x563e('0x25');break;case'AU':_0x3c4c07=_0x563e('0x13');break;case'IN':_0x3c4c07='https://accounts.zoho.in';break;case'CN':_0x3c4c07=_0x563e('0x15');break;default:_0x3c4c07=_0x563e('0x16');break;}var _0x10a85d={'method':'POST','uri':_0x3c4c07+_0x563e('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x16381e[_0x563e('0xd')],'client_secret':_0x16381e[_0x563e('0xe')],'redirect_uri':_0x16381e[_0x563e('0xc')],'code':_0x16381e[_0x563e('0xf')]},'headers':{'Content-Type':_0x563e('0x26')}};return rp(_0x10a85d)[_0x563e('0x1a')](function(_0x3d85f5){var _0x3dfc8e=JSON[_0x563e('0x1b')](_0x3d85f5);if(_0x3dfc8e[_0x563e('0x1c')]){_0x16381e[_0x563e('0x27')]=_0x3dfc8e[_0x563e('0x1c')];logger[_0x563e('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16381e['name'],_0x16381e['id']));}else{logger[_0x563e('0x20')](util[_0x563e('0x21')](_0x563e('0x22'),_0x16381e['name'],_0x16381e['id']),util[_0x563e('0x23')](_0x3dfc8e,{'showHidden':![],'depth':null}));}return _0x5c3bfe(null,_0x473c7e);})[_0x563e('0x28')](function(_0x1431fe){logger[_0x563e('0x20')](util[_0x563e('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16381e['name'],_0x16381e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5c3bfe(_0x1431fe);});}else{return _0x5c3bfe(null,_0x473c7e);}}}});}; \ No newline at end of file +var _0x4362=['POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','code','lastIndexOf','https://accounts.zoho.com','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','changed','serverUrl','clientSecret','host','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x3e1bad,_0x3b2b10){var _0x3ae54a=function(_0x2be55e){while(--_0x2be55e){_0x3e1bad['push'](_0x3e1bad['shift']());}};_0x3ae54a(++_0x3b2b10);}(_0x4362,0xdd));var _0x2436=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x4362[_0x5e9876];return _0x576c48;};'use strict';var _=require(_0x2436('0x0'));var util=require(_0x2436('0x1'));var logger=require(_0x2436('0x2'))(_0x2436('0x3'));var moment=require(_0x2436('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2436('0x5'));var rimraf=require(_0x2436('0x6'));var config=require(_0x2436('0x7'));var attributes=require(_0x2436('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2fbb2f,_0x1355de){return _0x2fbb2f[_0x2436('0x9')](_0x2436('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3018bf,_0x40c0fb,_0x50ee51){if(_0x3018bf[_0x2436('0xb')]('zone')||_0x3018bf[_0x2436('0xb')](_0x2436('0xc'))||_0x3018bf['changed']('clientId')||_0x3018bf[_0x2436('0xb')](_0x2436('0xd'))||_0x3018bf[_0x2436('0xb')]('code')||_0x3018bf['changed'](_0x2436('0xe'))){var _0xc10f28,_0x440ed7;_0xc10f28=_0x3018bf[_0x2436('0xc')];var _0x71cada=_0xc10f28['slice'](-0x1);if(_0x71cada==='/'||_0x71cada==='\x5c'||_0x71cada===':'){_0xc10f28=_0xc10f28[_0x2436('0xf')](0x0,_0xc10f28['lastIndexOf'](_0x71cada));}switch(_0x3018bf['zone']){case'US':_0x440ed7='https://accounts.zoho.com';break;case'AU':_0x440ed7=_0x2436('0x10');break;case'IN':_0x440ed7=_0x2436('0x11');break;case'CN':_0x440ed7=_0x2436('0x12');break;default:_0x440ed7='https://accounts.zoho.eu';break;}var _0x25a5d3={'method':_0x2436('0x13'),'uri':_0x440ed7+_0x2436('0x14'),'form':{'grant_type':_0x2436('0x15'),'client_id':_0x3018bf[_0x2436('0x16')],'client_secret':_0x3018bf['clientSecret'],'redirect_uri':_0x3018bf[_0x2436('0xc')],'code':_0x3018bf['code']},'headers':{'Content-Type':_0x2436('0x17')}};return rp(_0x25a5d3)[_0x2436('0x18')](function(_0x4dd9eb){var _0x1241cd=JSON[_0x2436('0x19')](_0x4dd9eb);if(_0x1241cd['refresh_token']){_0x3018bf[_0x2436('0x1a')]=_0x1241cd[_0x2436('0x1b')];logger[_0x2436('0x1c')](util[_0x2436('0x1d')](_0x2436('0x1e'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']));}else{logger[_0x2436('0x20')](util[_0x2436('0x1d')](_0x2436('0x21'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']),util[_0x2436('0x22')](_0x1241cd,{'showHidden':![],'depth':null}));}return _0x50ee51(null,_0x40c0fb);})[_0x2436('0x23')](function(_0x2c5825){logger[_0x2436('0x20')](util['format'](_0x2436('0x21'),_0x3018bf[_0x2436('0x1f')],_0x3018bf['id']),util[_0x2436('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x50ee51(_0x2c5825);});}else{return _0x50ee51(null,_0x40c0fb);}},'beforeUpdate':function(_0x15569b,_0x2c87e8,_0x7cdc98){if(_0x15569b[_0x2436('0xb')](_0x2436('0x24'))||_0x15569b['changed'](_0x2436('0xc'))||_0x15569b[_0x2436('0xb')]('clientId')||_0x15569b['changed'](_0x2436('0xd'))||_0x15569b['changed'](_0x2436('0x25'))||_0x15569b['changed']('host')){var _0x2f01fa,_0xc68d45;_0x2f01fa=_0x15569b[_0x2436('0xc')];var _0x39427b=_0x2f01fa['slice'](-0x1);if(_0x39427b==='/'||_0x39427b==='\x5c'||_0x39427b===':'){_0x2f01fa=_0x2f01fa[_0x2436('0xf')](0x0,_0x2f01fa[_0x2436('0x26')](_0x39427b));}switch(_0x15569b[_0x2436('0x24')]){case'US':_0xc68d45=_0x2436('0x27');break;case'AU':_0xc68d45='https://accounts.zoho.com.au';break;case'IN':_0xc68d45=_0x2436('0x11');break;case'CN':_0xc68d45=_0x2436('0x12');break;default:_0xc68d45='https://accounts.zoho.eu';break;}var _0x1efa7f={'method':_0x2436('0x13'),'uri':_0xc68d45+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x15569b[_0x2436('0x16')],'client_secret':_0x15569b[_0x2436('0xd')],'redirect_uri':_0x15569b[_0x2436('0xc')],'code':_0x15569b['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1efa7f)[_0x2436('0x18')](function(_0x230063){var _0x420546=JSON[_0x2436('0x19')](_0x230063);if(_0x420546[_0x2436('0x1b')]){_0x15569b['refreshToken']=_0x420546[_0x2436('0x1b')];logger[_0x2436('0x1c')](util[_0x2436('0x1d')](_0x2436('0x1e'),_0x15569b[_0x2436('0x1f')],_0x15569b['id']));}else{logger['error'](util[_0x2436('0x1d')](_0x2436('0x21'),_0x15569b['name'],_0x15569b['id']),util[_0x2436('0x22')](_0x420546,{'showHidden':![],'depth':null}));}return _0x7cdc98(null,_0x2c87e8);})['catch'](function(_0x2216db){logger['error'](util[_0x2436('0x1d')](_0x2436('0x21'),_0x15569b[_0x2436('0x1f')],_0x15569b['id']),util[_0x2436('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x7cdc98(_0x2216db);});}else{return _0x7cdc98(null,_0x2c87e8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cb86311..5eb1b30 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 _0x48ac=['../../config/environment','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_0x48ac,0xe0));var _0xc48a=function(_0x51aa20,_0x59faff){_0x51aa20=_0x51aa20-0x0;var _0x4f75c2=_0x48ac[_0x51aa20];return _0x4f75c2;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df462,_0x5cffd4,_0x1e1e1a){return new BPromise(function(_0xf0c31b,_0x2c3285){return client['request'](_0x5df462,_0x1e1e1a)[_0xc48a('0x9')](function(_0x43461a){logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,_0xc48a('0xc'));logger[_0xc48a('0xd')](_0xc48a('0xe'),_0x5cffd4,_0xc48a('0xc'),JSON[_0xc48a('0xf')](_0x43461a));if(_0x43461a[_0xc48a('0x10')]){if(_0x43461a[_0xc48a('0x10')]['code']===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')]['message']);return _0x2c3285(_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);}logger['error'](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);return _0xf0c31b(_0x43461a['error'][_0xc48a('0x11')]);}else{logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,'request\x20sent');_0xf0c31b(_0x43461a[_0xc48a('0x12')][_0xc48a('0x11')]);}})['catch'](function(_0x5c319b){logger[_0xc48a('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x5cffd4,_0x5c319b);_0x2c3285(_0x5c319b);});});}exports[_0xc48a('0x13')]=function(_0x29a1ad){var _0x188549=this;return new Promise(function(_0x462102,_0x25e389){return db[_0xc48a('0x14')][_0xc48a('0x15')]({'raw':_0x29a1ad['options']?_0x29a1ad[_0xc48a('0x16')][_0xc48a('0x17')]===undefined?!![]:![]:!![],'where':_0x29a1ad['options']?_0x29a1ad[_0xc48a('0x16')]['where']||null:null,'attributes':_0x29a1ad[_0xc48a('0x16')]?_0x29a1ad['options'][_0xc48a('0x18')]||null:null,'limit':_0x29a1ad[_0xc48a('0x16')]?_0x29a1ad[_0xc48a('0x16')][_0xc48a('0x19')]||null:null,'include':_0x29a1ad[_0xc48a('0x16')]?_0x29a1ad[_0xc48a('0x16')][_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x29a1ad[_0xc48a('0x16')][_0xc48a('0x1a')],function(_0x112874){return{'model':db[_0x112874['model']],'as':_0x112874['as'],'attributes':_0x112874['attributes'],'include':_0x112874[_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x112874[_0xc48a('0x1a')],function(_0x1e3618){return{'model':db[_0x1e3618['model']],'as':_0x1e3618['as'],'attributes':_0x1e3618['attributes'],'include':_0x1e3618[_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x1e3618[_0xc48a('0x1a')],function(_0x4ecdaf){return{'model':db[_0x4ecdaf[_0xc48a('0x1c')]],'as':_0x4ecdaf['as'],'attributes':_0x4ecdaf[_0xc48a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc48a('0x9')](function(_0x281100){logger[_0xc48a('0xa')](_0xc48a('0x13'),_0x29a1ad);logger[_0xc48a('0xd')](_0xc48a('0x13'),_0x29a1ad,JSON[_0xc48a('0xf')](_0x281100));_0x462102(_0x281100);})[_0xc48a('0x1d')](function(_0x5da24d){logger['error'](_0xc48a('0x13'),_0x5da24d['message'],_0x29a1ad);_0x25e389(_0x188549[_0xc48a('0x10')](0x1f4,_0x5da24d[_0xc48a('0x11')]));});});};exports['ShowZohoAccount']=function(_0x2f69c7){var _0x2ab3e1=this;return new Promise(function(_0x22e62a,_0x5c6d41){return db[_0xc48a('0x14')][_0xc48a('0x1e')]({'raw':_0x2f69c7['options']?_0x2f69c7[_0xc48a('0x16')][_0xc48a('0x17')]===undefined?!![]:![]:!![],'where':_0x2f69c7[_0xc48a('0x16')]?_0x2f69c7[_0xc48a('0x16')][_0xc48a('0x1f')]||null:null,'attributes':_0x2f69c7['options']?_0x2f69c7[_0xc48a('0x16')][_0xc48a('0x18')]||null:null,'include':_0x2f69c7[_0xc48a('0x16')]?_0x2f69c7[_0xc48a('0x16')][_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x2f69c7[_0xc48a('0x16')][_0xc48a('0x1a')],function(_0x57d803){return{'model':db[_0x57d803[_0xc48a('0x1c')]],'as':_0x57d803['as'],'attributes':_0x57d803[_0xc48a('0x18')],'include':_0x57d803[_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x57d803[_0xc48a('0x1a')],function(_0x35c259){return{'model':db[_0x35c259[_0xc48a('0x1c')]],'as':_0x35c259['as'],'attributes':_0x35c259['attributes'],'include':_0x35c259[_0xc48a('0x1a')]?_[_0xc48a('0x1b')](_0x35c259[_0xc48a('0x1a')],function(_0x2288ce){return{'model':db[_0x2288ce['model']],'as':_0x2288ce['as'],'attributes':_0x2288ce[_0xc48a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc48a('0x9')](function(_0x4b355c){logger[_0xc48a('0xa')]('ShowZohoAccount',_0x2f69c7);logger[_0xc48a('0xd')]('ShowZohoAccount',_0x2f69c7,JSON['stringify'](_0x4b355c));_0x22e62a(_0x4b355c);})[_0xc48a('0x1d')](function(_0x1e9248){logger['error'](_0xc48a('0x20'),_0x1e9248[_0xc48a('0x11')],_0x2f69c7);_0x5c6d41(_0x2ab3e1[_0xc48a('0x10')](0x1f4,_0x1e9248[_0xc48a('0x11')]));});});}; \ No newline at end of file +var _0x72fa=['options','raw','where','attributes','limit','include','map','model','info','debug','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x3bf80d,_0xa866f0){var _0xf47f58=function(_0xbd4c6c){while(--_0xbd4c6c){_0x3bf80d['push'](_0x3bf80d['shift']());}};_0xf47f58(++_0xa866f0);}(_0x72fa,0x78));var _0xa72f=function(_0x134467,_0x40bd2a){_0x134467=_0x134467-0x0;var _0x2ab317=_0x72fa[_0x134467];return _0x2ab317;};'use strict';var _=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var moment=require('moment');var BPromise=require(_0xa72f('0x2'));var rs=require(_0xa72f('0x3'));var fs=require('fs');var Redis=require(_0xa72f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa72f('0x5'))(_0xa72f('0x6'));var config=require(_0xa72f('0x7'));var jayson=require(_0xa72f('0x8'));var client=jayson[_0xa72f('0x9')][_0xa72f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd1a3,_0xe8aa31,_0x1e1b85){return new BPromise(function(_0x33eae5,_0x57d4fa){return client[_0xa72f('0xb')](_0x2cd1a3,_0x1e1b85)[_0xa72f('0xc')](function(_0x423bc7){logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));logger['debug'](_0xa72f('0xf'),_0xe8aa31,_0xa72f('0xe'),JSON[_0xa72f('0x10')](_0x423bc7));if(_0x423bc7[_0xa72f('0x11')]){if(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x12')]===0x1f4){logger[_0xa72f('0x11')](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x57d4fa(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);}logger['error'](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x33eae5(_0x423bc7['error'][_0xa72f('0x13')]);}else{logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));_0x33eae5(_0x423bc7['result'][_0xa72f('0x13')]);}})[_0xa72f('0x14')](function(_0x461119){logger[_0xa72f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xe8aa31,_0x461119);_0x57d4fa(_0x461119);});});}exports[_0xa72f('0x15')]=function(_0x79d7a){var _0x425e89=this;return new Promise(function(_0x303faa,_0x59b62a){return db[_0xa72f('0x16')][_0xa72f('0x17')]({'raw':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x19')]===undefined?!![]:![]:!![],'where':_0x79d7a[_0xa72f('0x18')]?_0x79d7a['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'limit':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1c')]||null:null,'include':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x1e3af9){return{'model':db[_0x1e3af9[_0xa72f('0x1f')]],'as':_0x1e3af9['as'],'attributes':_0x1e3af9['attributes'],'include':_0x1e3af9[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x1e3af9[_0xa72f('0x1d')],function(_0x40cc13){return{'model':db[_0x40cc13[_0xa72f('0x1f')]],'as':_0x40cc13['as'],'attributes':_0x40cc13['attributes'],'include':_0x40cc13[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x40cc13[_0xa72f('0x1d')],function(_0x25bf66){return{'model':db[_0x25bf66['model']],'as':_0x25bf66['as'],'attributes':_0x25bf66['attributes']};}):[]};}):[]};}):[]:[]})[_0xa72f('0xc')](function(_0x51e4e4){logger[_0xa72f('0x20')](_0xa72f('0x15'),_0x79d7a);logger[_0xa72f('0x21')](_0xa72f('0x15'),_0x79d7a,JSON[_0xa72f('0x10')](_0x51e4e4));_0x303faa(_0x51e4e4);})['catch'](function(_0x259a9a){logger[_0xa72f('0x11')](_0xa72f('0x15'),_0x259a9a[_0xa72f('0x13')],_0x79d7a);_0x59b62a(_0x425e89['error'](0x1f4,_0x259a9a[_0xa72f('0x13')]));});});};exports[_0xa72f('0x22')]=function(_0x4c1eff){var _0x2cd213=this;return new Promise(function(_0x2216ce,_0x3206ab){return db['ZohoAccount'][_0xa72f('0x23')]({'raw':_0x4c1eff['options']?_0x4c1eff[_0xa72f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'include':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x216c49){return{'model':db[_0x216c49[_0xa72f('0x1f')]],'as':_0x216c49['as'],'attributes':_0x216c49[_0xa72f('0x1b')],'include':_0x216c49[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x216c49[_0xa72f('0x1d')],function(_0x316b10){return{'model':db[_0x316b10['model']],'as':_0x316b10['as'],'attributes':_0x316b10['attributes'],'include':_0x316b10[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x316b10[_0xa72f('0x1d')],function(_0x6fb77e){return{'model':db[_0x6fb77e[_0xa72f('0x1f')]],'as':_0x6fb77e['as'],'attributes':_0x6fb77e[_0xa72f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35eae4){logger[_0xa72f('0x20')]('ShowZohoAccount',_0x4c1eff);logger[_0xa72f('0x21')]('ShowZohoAccount',_0x4c1eff,JSON[_0xa72f('0x10')](_0x35eae4));_0x2216ce(_0x35eae4);})[_0xa72f('0x14')](function(_0x43a56f){logger[_0xa72f('0x11')](_0xa72f('0x22'),_0x43a56f[_0xa72f('0x13')],_0x4c1eff);_0x3206ab(_0x2cd213['error'](0x1f4,_0x43a56f[_0xa72f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 833786c..e9a281b 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 _0x4f87=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer'];(function(_0x4a5359,_0x5d72e8){var _0x3ddbd3=function(_0x2945b0){while(--_0x2945b0){_0x4a5359['push'](_0x4a5359['shift']());}};_0x3ddbd3(++_0x5d72e8);}(_0x4f87,0x18f));var _0x74f8=function(_0x46815f,_0x314756){_0x46815f=_0x46815f-0x0;var _0x147b07=_0x4f87[_0x46815f];return _0x147b07;};'use strict';var multer=require(_0x74f8('0x0'));var util=require(_0x74f8('0x1'));var path=require(_0x74f8('0x2'));var timeout=require(_0x74f8('0x3'));var express=require(_0x74f8('0x4'));var router=express['Router']();var fs_extra=require(_0x74f8('0x5'));var auth=require(_0x74f8('0x6'));var interaction=require(_0x74f8('0x7'));var config=require(_0x74f8('0x8'));var controller=require(_0x74f8('0x9'));router[_0x74f8('0xa')]('/',auth[_0x74f8('0xb')](),controller[_0x74f8('0xc')]);router[_0x74f8('0xa')](_0x74f8('0xd'),auth[_0x74f8('0xb')](),controller['show']);router[_0x74f8('0xa')](_0x74f8('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x74f8('0xa')](_0x74f8('0xf'),auth['isAuthenticated'](),controller[_0x74f8('0x10')]);router[_0x74f8('0xa')](_0x74f8('0x11'),auth[_0x74f8('0xb')](),controller[_0x74f8('0x12')]);router[_0x74f8('0x13')]('/',auth[_0x74f8('0xb')](),controller[_0x74f8('0x14')]);router[_0x74f8('0x15')](_0x74f8('0xd'),auth[_0x74f8('0xb')](),controller[_0x74f8('0x16')]);router[_0x74f8('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x74f8('0x18')]=router; \ No newline at end of file +var _0xa652=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','post','create','put','/:id','update','delete','exports','util'];(function(_0x8f19b9,_0xbf083f){var _0x1d8aab=function(_0x49b7c5){while(--_0x49b7c5){_0x8f19b9['push'](_0x8f19b9['shift']());}};_0x1d8aab(++_0xbf083f);}(_0xa652,0x99));var _0x2a65=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa652[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x2a65('0x0'));var path=require(_0x2a65('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a65('0x2'));var router=express[_0x2a65('0x3')]();var fs_extra=require(_0x2a65('0x4'));var auth=require(_0x2a65('0x5'));var interaction=require(_0x2a65('0x6'));var config=require(_0x2a65('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x2a65('0x8')](),controller[_0x2a65('0x9')]);router[_0x2a65('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2a65('0xb')]);router['get'](_0x2a65('0xc'),auth[_0x2a65('0x8')](),controller[_0x2a65('0xd')]);router[_0x2a65('0xa')]('/:id/subjects',auth[_0x2a65('0x8')](),controller[_0x2a65('0xe')]);router[_0x2a65('0xa')]('/:id/descriptions',auth[_0x2a65('0x8')](),controller['getDescriptions']);router[_0x2a65('0xf')]('/',auth[_0x2a65('0x8')](),controller[_0x2a65('0x10')]);router[_0x2a65('0x11')](_0x2a65('0x12'),auth[_0x2a65('0x8')](),controller[_0x2a65('0x13')]);router[_0x2a65('0x14')](_0x2a65('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a65('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 68827f1..a2010c3 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 _0x0162=['contact','nothing','lead','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x0162,0x184));var _0x2016=function(_0x32c9c6,_0x31b89b){_0x32c9c6=_0x32c9c6-0x0;var _0x374a0d=_0x0162[_0x32c9c6];return _0x374a0d;};'use strict';var Sequelize=require(_0x2016('0x0'));module[_0x2016('0x1')]={'name':{'type':Sequelize[_0x2016('0x2')]},'moduleCreate':{'type':Sequelize[_0x2016('0x3')]('lead',_0x2016('0x4'),_0x2016('0x5')),'defaultValue':_0x2016('0x6')},'moduleSearch':{'type':Sequelize[_0x2016('0x3')](_0x2016('0x7'),'contact',_0x2016('0x6')),'defaultValue':_0x2016('0x7')},'description':{'type':Sequelize[_0x2016('0x2')]}}; \ No newline at end of file +var _0x7266=['lead','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x3336c1,_0x2275be){var _0x352f07=function(_0x15cd06){while(--_0x15cd06){_0x3336c1['push'](_0x3336c1['shift']());}};_0x352f07(++_0x2275be);}(_0x7266,0xec));var _0x6726=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7266[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x6726('0x0'));module[_0x6726('0x1')]={'name':{'type':Sequelize[_0x6726('0x2')]},'moduleCreate':{'type':Sequelize[_0x6726('0x3')](_0x6726('0x4'),'contact','nothing'),'defaultValue':_0x6726('0x4')},'moduleSearch':{'type':Sequelize[_0x6726('0x3')]('contact_lead','contact',_0x6726('0x4')),'defaultValue':_0x6726('0x5')},'description':{'type':Sequelize[_0x6726('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b2d49c3..35aca86 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 _0xc749=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','end','error','stack','name','send','index','ZohoConfiguration','rawAttributes','model','map','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','include','create','body','find','params','findOne','length','getFields','hasOwnProperty','ZohoField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils'];(function(_0x7d15e0,_0x428f0b){var _0x302805=function(_0x591c48){while(--_0x591c48){_0x7d15e0['push'](_0x7d15e0['shift']());}};_0x302805(++_0x428f0b);}(_0xc749,0x116));var _0x9c74=function(_0x2b53e0,_0x1ea899){_0x2b53e0=_0x2b53e0-0x0;var _0x116e2f=_0xc749[_0x2b53e0];return _0x116e2f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c74('0x0'));var jsonpatch=require(_0x9c74('0x1'));var rp=require(_0x9c74('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c74('0x3'));var path=require(_0x9c74('0x4'));var sox=require('sox');var csv=require(_0x9c74('0x5'));var ejs=require(_0x9c74('0x6'));var fs=require('fs');var fs_extra=require(_0x9c74('0x7'));var _=require(_0x9c74('0x8'));var squel=require(_0x9c74('0x9'));var crypto=require(_0x9c74('0xa'));var jsforce=require(_0x9c74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9c74('0x5'));var querystring=require('querystring');var Papa=require(_0x9c74('0xc'));var Redis=require(_0x9c74('0xd'));var authService=require(_0x9c74('0xe'));var qs=require(_0x9c74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c74('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x9c74('0x11'));var config=require(_0x9c74('0x12'));var licenseUtil=require(_0x9c74('0x13'));var db=require(_0x9c74('0x14'))['db'];function respondWithStatusCode(_0x26311e,_0x15f73b){_0x15f73b=_0x15f73b||0xcc;return function(_0x5384f7){if(_0x5384f7){return _0x26311e[_0x9c74('0x15')](_0x15f73b);}return _0x26311e[_0x9c74('0x16')](_0x15f73b)['end']();};}function respondWithResult(_0xf87710,_0x549637){_0x549637=_0x549637||0xc8;return function(_0x212920){if(_0x212920){return _0xf87710['status'](_0x549637)[_0x9c74('0x17')](_0x212920);}};}function respondWithFilteredResult(_0xeef096,_0x1bbba6){return function(_0x5e62b1){if(_0x5e62b1){var _0x6f396f=typeof _0x1bbba6[_0x9c74('0x18')]===_0x9c74('0x19')&&typeof _0x1bbba6[_0x9c74('0x1a')]==='undefined';var _0x32436a=_0x5e62b1[_0x9c74('0x1b')];var _0x41e196=_0x6f396f?0x0:_0x1bbba6[_0x9c74('0x18')];var _0x4f64a8=_0x6f396f?_0x5e62b1[_0x9c74('0x1b')]:_0x1bbba6['offset']+_0x1bbba6[_0x9c74('0x1a')];var _0x2d3b2d;if(_0x4f64a8>=_0x32436a){_0x4f64a8=_0x32436a;_0x2d3b2d=0xc8;}else{_0x2d3b2d=0xce;}_0xeef096[_0x9c74('0x16')](_0x2d3b2d);return _0xeef096[_0x9c74('0x1c')]('Content-Range',_0x41e196+'-'+_0x4f64a8+'/'+_0x32436a)[_0x9c74('0x17')](_0x5e62b1);}return null;};}function patchUpdates(_0x2fd6d0){return function(_0x45a075){try{jsonpatch['apply'](_0x45a075,_0x2fd6d0,!![]);}catch(_0x49db7f){return BPromise[_0x9c74('0x1d')](_0x49db7f);}return _0x45a075[_0x9c74('0x1e')]();};}function saveUpdates(_0xedca36,_0x48b28d){return function(_0x3536dc){if(_0x3536dc){return _0x3536dc[_0x9c74('0x1f')](_0xedca36)['then'](function(_0x108a86){return _0x108a86;});}return null;};}function removeEntity(_0x1aca11,_0x220aae){return function(_0x1e6117){if(_0x1e6117){return _0x1e6117[_0x9c74('0x20')]()[_0x9c74('0x21')](function(){_0x1aca11['status'](0xcc)[_0x9c74('0x22')]();});}};}function handleEntityNotFound(_0x17e38e,_0x392431){return function(_0xaef590){if(!_0xaef590){_0x17e38e[_0x9c74('0x15')](0x194);}return _0xaef590;};}function handleError(_0x542785,_0x3a5589){_0x3a5589=_0x3a5589||0x1f4;return function(_0x210365){logger[_0x9c74('0x23')](_0x210365[_0x9c74('0x24')]);if(_0x210365[_0x9c74('0x25')]){delete _0x210365['name'];}_0x542785[_0x9c74('0x16')](_0x3a5589)[_0x9c74('0x26')](_0x210365);};}exports[_0x9c74('0x27')]=function(_0x304738,_0xfbcf1f){var _0x5ef10b={},_0x8f470={},_0x455817={'count':0x0,'rows':[]};var _0x2cd897=_['map'](db[_0x9c74('0x28')][_0x9c74('0x29')],function(_0xe618e){return{'name':_0xe618e['fieldName'],'type':_0xe618e['type']['key']};});_0x8f470[_0x9c74('0x2a')]=_[_0x9c74('0x2b')](_0x2cd897,_0x9c74('0x25'));_0x8f470['query']=_[_0x9c74('0x2c')](_0x304738['query']);_0x8f470[_0x9c74('0x2d')]=_[_0x9c74('0x2e')](_0x8f470[_0x9c74('0x2a')],_0x8f470[_0x9c74('0x2f')]);_0x5ef10b[_0x9c74('0x30')]=_[_0x9c74('0x2e')](_0x8f470[_0x9c74('0x2a')],qs[_0x9c74('0x31')](_0x304738[_0x9c74('0x2f')]['fields']));_0x5ef10b[_0x9c74('0x30')]=_0x5ef10b[_0x9c74('0x30')]['length']?_0x5ef10b[_0x9c74('0x30')]:_0x8f470[_0x9c74('0x2a')];if(!_0x304738[_0x9c74('0x2f')]['hasOwnProperty'](_0x9c74('0x32'))){_0x5ef10b[_0x9c74('0x1a')]=qs[_0x9c74('0x1a')](_0x304738['query'][_0x9c74('0x1a')]);_0x5ef10b[_0x9c74('0x18')]=qs[_0x9c74('0x18')](_0x304738[_0x9c74('0x2f')][_0x9c74('0x18')]);}_0x5ef10b[_0x9c74('0x33')]=qs[_0x9c74('0x34')](_0x304738['query']['sort']);_0x5ef10b[_0x9c74('0x35')]=qs['filters'](_[_0x9c74('0x36')](_0x304738[_0x9c74('0x2f')],_0x8f470[_0x9c74('0x2d')]),_0x2cd897);if(_0x304738[_0x9c74('0x2f')][_0x9c74('0x37')]){_0x5ef10b[_0x9c74('0x35')]=_[_0x9c74('0x38')](_0x5ef10b[_0x9c74('0x35')],{'$or':_['map'](_0x2cd897,function(_0x2a0711){if(_0x2a0711['type']!==_0x9c74('0x39')){var _0x63453c={};_0x63453c[_0x2a0711[_0x9c74('0x25')]]={'$like':'%'+_0x304738['query']['filter']+'%'};return _0x63453c;}})});}_0x5ef10b=_[_0x9c74('0x38')]({},_0x5ef10b,_0x304738[_0x9c74('0x3a')]);var _0x132a8e={'where':_0x5ef10b[_0x9c74('0x35')]};return db[_0x9c74('0x28')][_0x9c74('0x1b')](_0x132a8e)['then'](function(_0x1ad13f){_0x455817[_0x9c74('0x1b')]=_0x1ad13f;if(_0x304738[_0x9c74('0x2f')][_0x9c74('0x3b')]){_0x5ef10b['include']=[{'all':!![]}];}return db[_0x9c74('0x28')]['findAll'](_0x5ef10b);})['then'](function(_0x3c5aaa){_0x455817['rows']=_0x3c5aaa;return _0x455817;})[_0x9c74('0x21')](respondWithFilteredResult(_0xfbcf1f,_0x5ef10b))[_0x9c74('0x3c')](handleError(_0xfbcf1f,null));};exports[_0x9c74('0x3d')]=function(_0x32af41,_0x56297a){var _0x42a402={'raw':![],'where':{'id':_0x32af41['params']['id']}},_0x15bc81={};_0x15bc81['model']=_[_0x9c74('0x2c')](db[_0x9c74('0x28')][_0x9c74('0x29')]);_0x15bc81['query']=_[_0x9c74('0x2c')](_0x32af41[_0x9c74('0x2f')]);_0x15bc81[_0x9c74('0x2d')]=_[_0x9c74('0x2e')](_0x15bc81[_0x9c74('0x2a')],_0x15bc81[_0x9c74('0x2f')]);_0x42a402['attributes']=_['intersection'](_0x15bc81[_0x9c74('0x2a')],qs['fields'](_0x32af41[_0x9c74('0x2f')][_0x9c74('0x31')]));_0x42a402['attributes']=_0x42a402[_0x9c74('0x30')]['length']?_0x42a402[_0x9c74('0x30')]:_0x15bc81[_0x9c74('0x2a')];if(_0x32af41[_0x9c74('0x2f')][_0x9c74('0x3b')]){_0x42a402[_0x9c74('0x3e')]=[{'all':!![]}];}_0x42a402=_[_0x9c74('0x38')]({},_0x42a402,_0x32af41[_0x9c74('0x3a')]);return db[_0x9c74('0x28')]['find'](_0x42a402)[_0x9c74('0x21')](handleEntityNotFound(_0x56297a,null))[_0x9c74('0x21')](respondWithResult(_0x56297a,null))[_0x9c74('0x3c')](handleError(_0x56297a,null));};exports[_0x9c74('0x3f')]=function(_0x600e0e,_0x87d511){return db['ZohoConfiguration'][_0x9c74('0x3f')](_0x600e0e[_0x9c74('0x40')],{})[_0x9c74('0x21')](respondWithResult(_0x87d511,0xc9))[_0x9c74('0x3c')](handleError(_0x87d511,null));};exports['update']=function(_0x1d0428,_0x9e35d7){if(_0x1d0428[_0x9c74('0x40')]['id']){delete _0x1d0428[_0x9c74('0x40')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x1d0428['params']['id']}})['then'](handleEntityNotFound(_0x9e35d7,null))['then'](saveUpdates(_0x1d0428[_0x9c74('0x40')],null))[_0x9c74('0x21')](respondWithResult(_0x9e35d7,null))['catch'](handleError(_0x9e35d7,null));};exports[_0x9c74('0x20')]=function(_0x3eae33,_0x16cfac){return db[_0x9c74('0x28')][_0x9c74('0x41')]({'where':{'id':_0x3eae33[_0x9c74('0x42')]['id']}})[_0x9c74('0x21')](handleEntityNotFound(_0x16cfac,null))[_0x9c74('0x21')](removeEntity(_0x16cfac,null))[_0x9c74('0x3c')](handleError(_0x16cfac,null));};exports['getFields']=function(_0x2025e5,_0x5b501c,_0x83947c){var _0x29ca9c={};var _0x275300={};var _0x563c58;var _0x5fdf35;return db[_0x9c74('0x28')][_0x9c74('0x43')]({'where':{'id':_0x2025e5[_0x9c74('0x42')]['id']}})[_0x9c74('0x21')](handleEntityNotFound(_0x5b501c,null))[_0x9c74('0x21')](function(_0x2851a3){if(_0x2851a3){_0x563c58=_0x2851a3;_0x275300[_0x9c74('0x2a')]=_[_0x9c74('0x2c')](db['ZohoField'][_0x9c74('0x29')]);_0x275300[_0x9c74('0x2f')]=_['keys'](_0x2025e5[_0x9c74('0x2f')]);_0x275300[_0x9c74('0x2d')]=_[_0x9c74('0x2e')](_0x275300['model'],_0x275300[_0x9c74('0x2f')]);_0x29ca9c[_0x9c74('0x30')]=_[_0x9c74('0x2e')](_0x275300[_0x9c74('0x2a')],qs[_0x9c74('0x31')](_0x2025e5[_0x9c74('0x2f')][_0x9c74('0x31')]));_0x29ca9c[_0x9c74('0x30')]=_0x29ca9c[_0x9c74('0x30')][_0x9c74('0x44')]?_0x29ca9c[_0x9c74('0x30')]:_0x275300['model'];_0x29ca9c[_0x9c74('0x33')]=qs[_0x9c74('0x34')](_0x2025e5[_0x9c74('0x2f')]['sort']);_0x29ca9c[_0x9c74('0x35')]=qs['filters'](_[_0x9c74('0x36')](_0x2025e5['query'],_0x275300['filters']));if(_0x2025e5[_0x9c74('0x2f')][_0x9c74('0x37')]){_0x29ca9c[_0x9c74('0x35')]=_['merge'](_0x29ca9c[_0x9c74('0x35')],{'$or':_[_0x9c74('0x2b')](_0x29ca9c[_0x9c74('0x30')],function(_0xff5f3e){var _0x154bdd={};_0x154bdd[_0xff5f3e]={'$like':'%'+_0x2025e5[_0x9c74('0x2f')][_0x9c74('0x37')]+'%'};return _0x154bdd;})});}_0x29ca9c=_[_0x9c74('0x38')]({},_0x29ca9c,_0x2025e5['options']);return _0x563c58[_0x9c74('0x45')](_0x29ca9c);}})['then'](function(_0x376537){if(_0x376537){_0x5fdf35=_0x376537['length'];if(!_0x2025e5[_0x9c74('0x2f')][_0x9c74('0x46')](_0x9c74('0x32'))){_0x29ca9c[_0x9c74('0x1a')]=qs[_0x9c74('0x1a')](_0x2025e5[_0x9c74('0x2f')][_0x9c74('0x1a')]);_0x29ca9c[_0x9c74('0x18')]=qs[_0x9c74('0x18')](_0x2025e5['query'][_0x9c74('0x18')]);}return _0x563c58[_0x9c74('0x45')](_0x29ca9c);}})[_0x9c74('0x21')](function(_0x5bab28){if(_0x5bab28){return _0x5bab28?{'count':_0x5fdf35,'rows':_0x5bab28}:null;}})[_0x9c74('0x21')](respondWithResult(_0x5b501c,null))[_0x9c74('0x3c')](handleError(_0x5b501c,null));};exports['getSubjects']=function(_0x53bf46,_0x3f9be2,_0xef927f){var _0x43d560={};var _0x1639a3={};var _0x33bc27;var _0x5da70b;return db[_0x9c74('0x28')][_0x9c74('0x43')]({'where':{'id':_0x53bf46[_0x9c74('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f9be2,null))[_0x9c74('0x21')](function(_0x19d9a2){if(_0x19d9a2){_0x33bc27=_0x19d9a2;_0x1639a3[_0x9c74('0x2a')]=_[_0x9c74('0x2c')](db[_0x9c74('0x47')][_0x9c74('0x29')]);_0x1639a3[_0x9c74('0x2f')]=_[_0x9c74('0x2c')](_0x53bf46['query']);_0x1639a3[_0x9c74('0x2d')]=_[_0x9c74('0x2e')](_0x1639a3[_0x9c74('0x2a')],_0x1639a3[_0x9c74('0x2f')]);_0x43d560[_0x9c74('0x30')]=_[_0x9c74('0x2e')](_0x1639a3[_0x9c74('0x2a')],qs['fields'](_0x53bf46[_0x9c74('0x2f')]['fields']));_0x43d560[_0x9c74('0x30')]=_0x43d560['attributes']['length']?_0x43d560[_0x9c74('0x30')]:_0x1639a3[_0x9c74('0x2a')];_0x43d560[_0x9c74('0x33')]=qs[_0x9c74('0x34')](_0x53bf46['query']['sort']);_0x43d560[_0x9c74('0x35')]=qs[_0x9c74('0x2d')](_[_0x9c74('0x36')](_0x53bf46['query'],_0x1639a3[_0x9c74('0x2d')]));if(_0x53bf46[_0x9c74('0x2f')][_0x9c74('0x37')]){_0x43d560[_0x9c74('0x35')]=_[_0x9c74('0x38')](_0x43d560[_0x9c74('0x35')],{'$or':_[_0x9c74('0x2b')](_0x43d560[_0x9c74('0x30')],function(_0x4cd2e1){var _0x1409ce={};_0x1409ce[_0x4cd2e1]={'$like':'%'+_0x53bf46['query']['filter']+'%'};return _0x1409ce;})});}_0x43d560=_[_0x9c74('0x38')]({},_0x43d560,_0x53bf46['options']);return _0x33bc27[_0x9c74('0x48')](_0x43d560);}})[_0x9c74('0x21')](function(_0x59ef2d){if(_0x59ef2d){_0x5da70b=_0x59ef2d[_0x9c74('0x44')];if(!_0x53bf46[_0x9c74('0x2f')][_0x9c74('0x46')](_0x9c74('0x32'))){_0x43d560[_0x9c74('0x1a')]=qs[_0x9c74('0x1a')](_0x53bf46[_0x9c74('0x2f')][_0x9c74('0x1a')]);_0x43d560[_0x9c74('0x18')]=qs[_0x9c74('0x18')](_0x53bf46[_0x9c74('0x2f')][_0x9c74('0x18')]);}return _0x33bc27['getSubjects'](_0x43d560);}})[_0x9c74('0x21')](function(_0x1bd6b5){if(_0x1bd6b5){return _0x1bd6b5?{'count':_0x5da70b,'rows':_0x1bd6b5}:null;}})[_0x9c74('0x21')](respondWithResult(_0x3f9be2,null))[_0x9c74('0x3c')](handleError(_0x3f9be2,null));};exports[_0x9c74('0x49')]=function(_0x1da7a9,_0x4a2c94,_0x1471ad){var _0x12b954={};var _0x79202d={};var _0x4178ec;var _0x42ff7c;return db['ZohoConfiguration'][_0x9c74('0x43')]({'where':{'id':_0x1da7a9[_0x9c74('0x42')]['id']}})[_0x9c74('0x21')](handleEntityNotFound(_0x4a2c94,null))['then'](function(_0x299528){if(_0x299528){_0x4178ec=_0x299528;_0x79202d[_0x9c74('0x2a')]=_['keys'](db[_0x9c74('0x47')][_0x9c74('0x29')]);_0x79202d[_0x9c74('0x2f')]=_[_0x9c74('0x2c')](_0x1da7a9[_0x9c74('0x2f')]);_0x79202d['filters']=_[_0x9c74('0x2e')](_0x79202d[_0x9c74('0x2a')],_0x79202d[_0x9c74('0x2f')]);_0x12b954[_0x9c74('0x30')]=_[_0x9c74('0x2e')](_0x79202d[_0x9c74('0x2a')],qs['fields'](_0x1da7a9[_0x9c74('0x2f')]['fields']));_0x12b954[_0x9c74('0x30')]=_0x12b954[_0x9c74('0x30')]['length']?_0x12b954[_0x9c74('0x30')]:_0x79202d[_0x9c74('0x2a')];_0x12b954['order']=qs[_0x9c74('0x34')](_0x1da7a9[_0x9c74('0x2f')][_0x9c74('0x34')]);_0x12b954[_0x9c74('0x35')]=qs['filters'](_[_0x9c74('0x36')](_0x1da7a9[_0x9c74('0x2f')],_0x79202d['filters']));if(_0x1da7a9[_0x9c74('0x2f')][_0x9c74('0x37')]){_0x12b954[_0x9c74('0x35')]=_['merge'](_0x12b954[_0x9c74('0x35')],{'$or':_['map'](_0x12b954[_0x9c74('0x30')],function(_0x5dbecc){var _0x3f6dfd={};_0x3f6dfd[_0x5dbecc]={'$like':'%'+_0x1da7a9[_0x9c74('0x2f')][_0x9c74('0x37')]+'%'};return _0x3f6dfd;})});}_0x12b954=_[_0x9c74('0x38')]({},_0x12b954,_0x1da7a9[_0x9c74('0x3a')]);return _0x4178ec[_0x9c74('0x49')](_0x12b954);}})['then'](function(_0x3e4eb5){if(_0x3e4eb5){_0x42ff7c=_0x3e4eb5[_0x9c74('0x44')];if(!_0x1da7a9['query']['hasOwnProperty'](_0x9c74('0x32'))){_0x12b954['limit']=qs[_0x9c74('0x1a')](_0x1da7a9[_0x9c74('0x2f')][_0x9c74('0x1a')]);_0x12b954[_0x9c74('0x18')]=qs[_0x9c74('0x18')](_0x1da7a9[_0x9c74('0x2f')][_0x9c74('0x18')]);}return _0x4178ec[_0x9c74('0x49')](_0x12b954);}})[_0x9c74('0x21')](function(_0x45554c){if(_0x45554c){return _0x45554c?{'count':_0x42ff7c,'rows':_0x45554c}:null;}})[_0x9c74('0x21')](respondWithResult(_0x4a2c94,null))[_0x9c74('0x3c')](handleError(_0x4a2c94,null));}; \ No newline at end of file +var _0x51f9=['keys','include','merge','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params'];(function(_0x1db91e,_0x236392){var _0x39bbbc=function(_0x1f0253){while(--_0x1f0253){_0x1db91e['push'](_0x1db91e['shift']());}};_0x39bbbc(++_0x236392);}(_0x51f9,0x13f));var _0x951f=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x51f9[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x951f('0x0'));var zipdir=require(_0x951f('0x1'));var jsonpatch=require(_0x951f('0x2'));var rp=require('request-promise');var moment=require(_0x951f('0x3'));var BPromise=require(_0x951f('0x4'));var Mustache=require(_0x951f('0x5'));var util=require(_0x951f('0x6'));var path=require(_0x951f('0x7'));var sox=require(_0x951f('0x8'));var csv=require('to-csv');var ejs=require(_0x951f('0x9'));var fs=require('fs');var fs_extra=require(_0x951f('0xa'));var _=require('lodash');var squel=require(_0x951f('0xb'));var crypto=require('crypto');var jsforce=require(_0x951f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x951f('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x951f('0xe'));var qs=require(_0x951f('0xf'));var as=require(_0x951f('0x10'));var hardwareService=require(_0x951f('0x11'));var logger=require(_0x951f('0x12'))(_0x951f('0x13'));var utils=require('../../config/utils');var config=require(_0x951f('0x14'));var licenseUtil=require(_0x951f('0x15'));var db=require(_0x951f('0x16'))['db'];function respondWithStatusCode(_0x1b5a3b,_0x5c38f8){_0x5c38f8=_0x5c38f8||0xcc;return function(_0x30b3e7){if(_0x30b3e7){return _0x1b5a3b[_0x951f('0x17')](_0x5c38f8);}return _0x1b5a3b[_0x951f('0x18')](_0x5c38f8)[_0x951f('0x19')]();};}function respondWithResult(_0x5b6787,_0x513e08){_0x513e08=_0x513e08||0xc8;return function(_0x4872df){if(_0x4872df){return _0x5b6787['status'](_0x513e08)['json'](_0x4872df);}};}function respondWithFilteredResult(_0x3a5b91,_0x61b3d4){return function(_0xb9ee45){if(_0xb9ee45){var _0x5425ec=typeof _0x61b3d4[_0x951f('0x1a')]===_0x951f('0x1b')&&typeof _0x61b3d4[_0x951f('0x1c')]===_0x951f('0x1b');var _0x2a919b=_0xb9ee45['count'];var _0x308be6=_0x5425ec?0x0:_0x61b3d4[_0x951f('0x1a')];var _0x501203=_0x5425ec?_0xb9ee45[_0x951f('0x1d')]:_0x61b3d4['offset']+_0x61b3d4[_0x951f('0x1c')];var _0x1bdff8;if(_0x501203>=_0x2a919b){_0x501203=_0x2a919b;_0x1bdff8=0xc8;}else{_0x1bdff8=0xce;}_0x3a5b91['status'](_0x1bdff8);return _0x3a5b91['set'](_0x951f('0x1e'),_0x308be6+'-'+_0x501203+'/'+_0x2a919b)[_0x951f('0x1f')](_0xb9ee45);}return null;};}function patchUpdates(_0x44a6e6){return function(_0x5024c5){try{jsonpatch[_0x951f('0x20')](_0x5024c5,_0x44a6e6,!![]);}catch(_0x17f6b2){return BPromise[_0x951f('0x21')](_0x17f6b2);}return _0x5024c5['save']();};}function saveUpdates(_0x384ffd,_0x3577f1){return function(_0x1775d9){if(_0x1775d9){return _0x1775d9['update'](_0x384ffd)[_0x951f('0x22')](function(_0x3b9066){return _0x3b9066;});}return null;};}function removeEntity(_0x3b5154,_0x4e9430){return function(_0x370281){if(_0x370281){return _0x370281[_0x951f('0x23')]()[_0x951f('0x22')](function(){_0x3b5154[_0x951f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1927bf,_0x2219ec){return function(_0x2a6535){if(!_0x2a6535){_0x1927bf[_0x951f('0x17')](0x194);}return _0x2a6535;};}function handleError(_0x52ccac,_0x3f90d0){_0x3f90d0=_0x3f90d0||0x1f4;return function(_0x4f5ad2){logger['error'](_0x4f5ad2[_0x951f('0x24')]);if(_0x4f5ad2[_0x951f('0x25')]){delete _0x4f5ad2[_0x951f('0x25')];}_0x52ccac[_0x951f('0x18')](_0x3f90d0)[_0x951f('0x26')](_0x4f5ad2);};}exports[_0x951f('0x27')]=function(_0x563b51,_0x5eaa5f){var _0x54736c={},_0x3b858a={},_0x17c3e8={'count':0x0,'rows':[]};var _0x1bae9d=_[_0x951f('0x28')](db[_0x951f('0x29')][_0x951f('0x2a')],function(_0x34983b){return{'name':_0x34983b[_0x951f('0x2b')],'type':_0x34983b[_0x951f('0x2c')]['key']};});_0x3b858a[_0x951f('0x2d')]=_['map'](_0x1bae9d,_0x951f('0x25'));_0x3b858a[_0x951f('0x2e')]=_['keys'](_0x563b51['query']);_0x3b858a[_0x951f('0x2f')]=_[_0x951f('0x30')](_0x3b858a['model'],_0x3b858a['query']);_0x54736c['attributes']=_[_0x951f('0x30')](_0x3b858a[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x563b51['query'][_0x951f('0x31')]));_0x54736c[_0x951f('0x32')]=_0x54736c[_0x951f('0x32')][_0x951f('0x33')]?_0x54736c[_0x951f('0x32')]:_0x3b858a[_0x951f('0x2d')];if(!_0x563b51[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0x54736c[_0x951f('0x1c')]=qs['limit'](_0x563b51[_0x951f('0x2e')][_0x951f('0x1c')]);_0x54736c[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x563b51[_0x951f('0x2e')][_0x951f('0x1a')]);}_0x54736c[_0x951f('0x36')]=qs[_0x951f('0x37')](_0x563b51[_0x951f('0x2e')][_0x951f('0x37')]);_0x54736c['where']=qs[_0x951f('0x2f')](_[_0x951f('0x38')](_0x563b51['query'],_0x3b858a['filters']),_0x1bae9d);if(_0x563b51[_0x951f('0x2e')]['filter']){_0x54736c[_0x951f('0x39')]=_['merge'](_0x54736c[_0x951f('0x39')],{'$or':_['map'](_0x1bae9d,function(_0x53671b){if(_0x53671b[_0x951f('0x2c')]!==_0x951f('0x3a')){var _0x10ae78={};_0x10ae78[_0x53671b['name']]={'$like':'%'+_0x563b51[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x10ae78;}})});}_0x54736c=_['merge']({},_0x54736c,_0x563b51[_0x951f('0x3c')]);var _0x10d695={'where':_0x54736c[_0x951f('0x39')]};return db['ZohoConfiguration']['count'](_0x10d695)[_0x951f('0x22')](function(_0x585811){_0x17c3e8[_0x951f('0x1d')]=_0x585811;if(_0x563b51[_0x951f('0x2e')][_0x951f('0x3d')]){_0x54736c['include']=[{'all':!![]}];}return db[_0x951f('0x29')][_0x951f('0x3e')](_0x54736c);})[_0x951f('0x22')](function(_0x4ae82f){_0x17c3e8[_0x951f('0x3f')]=_0x4ae82f;return _0x17c3e8;})[_0x951f('0x22')](respondWithFilteredResult(_0x5eaa5f,_0x54736c))[_0x951f('0x40')](handleError(_0x5eaa5f,null));};exports['show']=function(_0x433706,_0x2cad15){var _0x30a2da={'raw':![],'where':{'id':_0x433706[_0x951f('0x41')]['id']}},_0x40f6e5={};_0x40f6e5['model']=_[_0x951f('0x42')](db[_0x951f('0x29')][_0x951f('0x2a')]);_0x40f6e5[_0x951f('0x2e')]=_[_0x951f('0x42')](_0x433706[_0x951f('0x2e')]);_0x40f6e5[_0x951f('0x2f')]=_['intersection'](_0x40f6e5[_0x951f('0x2d')],_0x40f6e5[_0x951f('0x2e')]);_0x30a2da['attributes']=_[_0x951f('0x30')](_0x40f6e5[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x433706['query'][_0x951f('0x31')]));_0x30a2da[_0x951f('0x32')]=_0x30a2da['attributes'][_0x951f('0x33')]?_0x30a2da[_0x951f('0x32')]:_0x40f6e5[_0x951f('0x2d')];if(_0x433706[_0x951f('0x2e')][_0x951f('0x3d')]){_0x30a2da[_0x951f('0x43')]=[{'all':!![]}];}_0x30a2da=_[_0x951f('0x44')]({},_0x30a2da,_0x433706[_0x951f('0x3c')]);return db[_0x951f('0x29')][_0x951f('0x45')](_0x30a2da)[_0x951f('0x22')](handleEntityNotFound(_0x2cad15,null))['then'](respondWithResult(_0x2cad15,null))[_0x951f('0x40')](handleError(_0x2cad15,null));};exports[_0x951f('0x46')]=function(_0x22aa1c,_0x20e4bf){return db['ZohoConfiguration'][_0x951f('0x46')](_0x22aa1c[_0x951f('0x47')],{})[_0x951f('0x22')](respondWithResult(_0x20e4bf,0xc9))['catch'](handleError(_0x20e4bf,null));};exports['update']=function(_0x44f60b,_0x2713c2){if(_0x44f60b[_0x951f('0x47')]['id']){delete _0x44f60b['body']['id'];}return db[_0x951f('0x29')][_0x951f('0x45')]({'where':{'id':_0x44f60b[_0x951f('0x41')]['id']}})['then'](handleEntityNotFound(_0x2713c2,null))[_0x951f('0x22')](saveUpdates(_0x44f60b['body'],null))[_0x951f('0x22')](respondWithResult(_0x2713c2,null))['catch'](handleError(_0x2713c2,null));};exports['destroy']=function(_0x1c585c,_0x58a7d7){return db[_0x951f('0x29')][_0x951f('0x45')]({'where':{'id':_0x1c585c['params']['id']}})[_0x951f('0x22')](handleEntityNotFound(_0x58a7d7,null))[_0x951f('0x22')](removeEntity(_0x58a7d7,null))[_0x951f('0x40')](handleError(_0x58a7d7,null));};exports[_0x951f('0x48')]=function(_0x5f0409,_0x49526e,_0x29aed2){var _0x40e526={};var _0x30f100={};var _0x12fab6;var _0x5be4aa;return db[_0x951f('0x29')][_0x951f('0x49')]({'where':{'id':_0x5f0409[_0x951f('0x41')]['id']}})['then'](handleEntityNotFound(_0x49526e,null))[_0x951f('0x22')](function(_0x1c65fc){if(_0x1c65fc){_0x12fab6=_0x1c65fc;_0x30f100['model']=_['keys'](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x30f100['query']=_['keys'](_0x5f0409[_0x951f('0x2e')]);_0x30f100['filters']=_[_0x951f('0x30')](_0x30f100[_0x951f('0x2d')],_0x30f100[_0x951f('0x2e')]);_0x40e526[_0x951f('0x32')]=_[_0x951f('0x30')](_0x30f100[_0x951f('0x2d')],qs[_0x951f('0x31')](_0x5f0409['query'][_0x951f('0x31')]));_0x40e526[_0x951f('0x32')]=_0x40e526[_0x951f('0x32')]['length']?_0x40e526[_0x951f('0x32')]:_0x30f100[_0x951f('0x2d')];_0x40e526['order']=qs[_0x951f('0x37')](_0x5f0409[_0x951f('0x2e')]['sort']);_0x40e526['where']=qs[_0x951f('0x2f')](_[_0x951f('0x38')](_0x5f0409['query'],_0x30f100[_0x951f('0x2f')]));if(_0x5f0409[_0x951f('0x2e')][_0x951f('0x3b')]){_0x40e526[_0x951f('0x39')]=_['merge'](_0x40e526['where'],{'$or':_[_0x951f('0x28')](_0x40e526['attributes'],function(_0x9d6e47){var _0x29fef8={};_0x29fef8[_0x9d6e47]={'$like':'%'+_0x5f0409[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x29fef8;})});}_0x40e526=_[_0x951f('0x44')]({},_0x40e526,_0x5f0409['options']);return _0x12fab6[_0x951f('0x48')](_0x40e526);}})['then'](function(_0x430cc9){if(_0x430cc9){_0x5be4aa=_0x430cc9[_0x951f('0x33')];if(!_0x5f0409[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0x40e526[_0x951f('0x1c')]=qs[_0x951f('0x1c')](_0x5f0409[_0x951f('0x2e')][_0x951f('0x1c')]);_0x40e526[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x5f0409['query']['offset']);}return _0x12fab6[_0x951f('0x48')](_0x40e526);}})[_0x951f('0x22')](function(_0x496931){if(_0x496931){return _0x496931?{'count':_0x5be4aa,'rows':_0x496931}:null;}})[_0x951f('0x22')](respondWithResult(_0x49526e,null))[_0x951f('0x40')](handleError(_0x49526e,null));};exports[_0x951f('0x4b')]=function(_0x498cff,_0xe11c76,_0x40e648){var _0xafe1be={};var _0x3ab880={};var _0x190020;var _0x3a5391;return db['ZohoConfiguration'][_0x951f('0x49')]({'where':{'id':_0x498cff[_0x951f('0x41')]['id']}})[_0x951f('0x22')](handleEntityNotFound(_0xe11c76,null))[_0x951f('0x22')](function(_0x4d2de8){if(_0x4d2de8){_0x190020=_0x4d2de8;_0x3ab880[_0x951f('0x2d')]=_[_0x951f('0x42')](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x3ab880['query']=_['keys'](_0x498cff[_0x951f('0x2e')]);_0x3ab880[_0x951f('0x2f')]=_['intersection'](_0x3ab880[_0x951f('0x2d')],_0x3ab880['query']);_0xafe1be[_0x951f('0x32')]=_[_0x951f('0x30')](_0x3ab880['model'],qs['fields'](_0x498cff[_0x951f('0x2e')][_0x951f('0x31')]));_0xafe1be[_0x951f('0x32')]=_0xafe1be[_0x951f('0x32')][_0x951f('0x33')]?_0xafe1be[_0x951f('0x32')]:_0x3ab880[_0x951f('0x2d')];_0xafe1be[_0x951f('0x36')]=qs['sort'](_0x498cff[_0x951f('0x2e')][_0x951f('0x37')]);_0xafe1be[_0x951f('0x39')]=qs['filters'](_[_0x951f('0x38')](_0x498cff[_0x951f('0x2e')],_0x3ab880[_0x951f('0x2f')]));if(_0x498cff[_0x951f('0x2e')]['filter']){_0xafe1be['where']=_[_0x951f('0x44')](_0xafe1be[_0x951f('0x39')],{'$or':_['map'](_0xafe1be['attributes'],function(_0x3accdf){var _0x179681={};_0x179681[_0x3accdf]={'$like':'%'+_0x498cff['query'][_0x951f('0x3b')]+'%'};return _0x179681;})});}_0xafe1be=_[_0x951f('0x44')]({},_0xafe1be,_0x498cff[_0x951f('0x3c')]);return _0x190020[_0x951f('0x4b')](_0xafe1be);}})['then'](function(_0x7a48c7){if(_0x7a48c7){_0x3a5391=_0x7a48c7['length'];if(!_0x498cff[_0x951f('0x2e')][_0x951f('0x34')](_0x951f('0x35'))){_0xafe1be['limit']=qs['limit'](_0x498cff['query'][_0x951f('0x1c')]);_0xafe1be[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x498cff[_0x951f('0x2e')]['offset']);}return _0x190020['getSubjects'](_0xafe1be);}})['then'](function(_0x43e129){if(_0x43e129){return _0x43e129?{'count':_0x3a5391,'rows':_0x43e129}:null;}})[_0x951f('0x22')](respondWithResult(_0xe11c76,null))[_0x951f('0x40')](handleError(_0xe11c76,null));};exports['getDescriptions']=function(_0x7bd79c,_0x48e485,_0xaa0f51){var _0x4d20aa={};var _0x19376a={};var _0x725acc;var _0x4567b1;return db[_0x951f('0x29')][_0x951f('0x49')]({'where':{'id':_0x7bd79c[_0x951f('0x41')]['id']}})[_0x951f('0x22')](handleEntityNotFound(_0x48e485,null))[_0x951f('0x22')](function(_0x502fb3){if(_0x502fb3){_0x725acc=_0x502fb3;_0x19376a['model']=_[_0x951f('0x42')](db[_0x951f('0x4a')][_0x951f('0x2a')]);_0x19376a[_0x951f('0x2e')]=_[_0x951f('0x42')](_0x7bd79c['query']);_0x19376a[_0x951f('0x2f')]=_[_0x951f('0x30')](_0x19376a['model'],_0x19376a[_0x951f('0x2e')]);_0x4d20aa[_0x951f('0x32')]=_[_0x951f('0x30')](_0x19376a['model'],qs[_0x951f('0x31')](_0x7bd79c['query']['fields']));_0x4d20aa[_0x951f('0x32')]=_0x4d20aa['attributes'][_0x951f('0x33')]?_0x4d20aa[_0x951f('0x32')]:_0x19376a[_0x951f('0x2d')];_0x4d20aa[_0x951f('0x36')]=qs[_0x951f('0x37')](_0x7bd79c[_0x951f('0x2e')][_0x951f('0x37')]);_0x4d20aa[_0x951f('0x39')]=qs[_0x951f('0x2f')](_['pick'](_0x7bd79c['query'],_0x19376a[_0x951f('0x2f')]));if(_0x7bd79c[_0x951f('0x2e')]['filter']){_0x4d20aa[_0x951f('0x39')]=_[_0x951f('0x44')](_0x4d20aa[_0x951f('0x39')],{'$or':_[_0x951f('0x28')](_0x4d20aa[_0x951f('0x32')],function(_0x14e666){var _0x26d3af={};_0x26d3af[_0x14e666]={'$like':'%'+_0x7bd79c[_0x951f('0x2e')][_0x951f('0x3b')]+'%'};return _0x26d3af;})});}_0x4d20aa=_[_0x951f('0x44')]({},_0x4d20aa,_0x7bd79c[_0x951f('0x3c')]);return _0x725acc['getDescriptions'](_0x4d20aa);}})['then'](function(_0x35ecdc){if(_0x35ecdc){_0x4567b1=_0x35ecdc['length'];if(!_0x7bd79c[_0x951f('0x2e')]['hasOwnProperty']('nolimit')){_0x4d20aa[_0x951f('0x1c')]=qs[_0x951f('0x1c')](_0x7bd79c[_0x951f('0x2e')][_0x951f('0x1c')]);_0x4d20aa[_0x951f('0x1a')]=qs[_0x951f('0x1a')](_0x7bd79c[_0x951f('0x2e')]['offset']);}return _0x725acc[_0x951f('0x4c')](_0x4d20aa);}})[_0x951f('0x22')](function(_0x2968f8){if(_0x2968f8){return _0x2968f8?{'count':_0x4567b1,'rows':_0x2968f8}:null;}})[_0x951f('0x22')](respondWithResult(_0x48e485,null))['catch'](handleError(_0x48e485,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3d9a183..76130af 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 _0x5958=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1bf113,_0x28ca42){var _0x532d55=function(_0x3276e1){while(--_0x3276e1){_0x1bf113['push'](_0x1bf113['shift']());}};_0x532d55(++_0x28ca42);}(_0x5958,0xe3));var _0x8595=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x5958[_0x3afe18];return _0x19ed1f;};'use strict';var _=require(_0x8595('0x0'));var util=require(_0x8595('0x1'));var logger=require(_0x8595('0x2'))('api');var moment=require(_0x8595('0x3'));var BPromise=require(_0x8595('0x4'));var rp=require(_0x8595('0x5'));var fs=require('fs');var path=require(_0x8595('0x6'));var rimraf=require(_0x8595('0x7'));var config=require(_0x8595('0x8'));var attributes=require(_0x8595('0x9'));module[_0x8595('0xa')]=function(_0x58b098,_0x3066c8){return _0x58b098[_0x8595('0xb')](_0x8595('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb125=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x443f47,_0xc4f09f){var _0x1c3d82=function(_0x16892a){while(--_0x16892a){_0x443f47['push'](_0x443f47['shift']());}};_0x1c3d82(++_0xc4f09f);}(_0xb125,0x14c));var _0x5b12=function(_0x411ce8,_0x55c0ef){_0x411ce8=_0x411ce8-0x0;var _0x294267=_0xb125[_0x411ce8];return _0x294267;};'use strict';var _=require(_0x5b12('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b12('0x1'));var moment=require(_0x5b12('0x2'));var BPromise=require(_0x5b12('0x3'));var rp=require(_0x5b12('0x4'));var fs=require('fs');var path=require(_0x5b12('0x5'));var rimraf=require(_0x5b12('0x6'));var config=require(_0x5b12('0x7'));var attributes=require(_0x5b12('0x8'));module[_0x5b12('0x9')]=function(_0x26733f,_0x543636){return _0x26733f[_0x5b12('0xa')](_0x5b12('0xb'),attributes,{'tableName':_0x5b12('0xc'),'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 189e5b5..ae4757b 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 _0xca7c=['then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x59e5fe,_0x3233af){var _0x2d99d4=function(_0x1683a2){while(--_0x1683a2){_0x59e5fe['push'](_0x59e5fe['shift']());}};_0x2d99d4(++_0x3233af);}(_0xca7c,0xbe));var _0xcca7=function(_0x51349e,_0x4b0ec3){_0x51349e=_0x51349e-0x0;var _0x28af2b=_0xca7c[_0x51349e];return _0x28af2b;};'use strict';var _=require(_0xcca7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcca7('0x1'));var fs=require('fs');var Redis=require(_0xcca7('0x2'));var db=require(_0xcca7('0x3'))['db'];var utils=require(_0xcca7('0x4'));var logger=require(_0xcca7('0x5'))('rpc');var config=require(_0xcca7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcca7('0x7')][_0xcca7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40906f,_0x5c4fbd,_0x332c6d){return new BPromise(function(_0x1c2671,_0x5c5475){return client[_0xcca7('0x9')](_0x40906f,_0x332c6d)[_0xcca7('0xa')](function(_0x1b5082){logger[_0xcca7('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c4fbd,_0xcca7('0xc'));logger[_0xcca7('0xd')](_0xcca7('0xe'),_0x5c4fbd,_0xcca7('0xc'),JSON['stringify'](_0x1b5082));if(_0x1b5082['error']){if(_0x1b5082[_0xcca7('0xf')][_0xcca7('0x10')]===0x1f4){logger[_0xcca7('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c4fbd,_0x1b5082[_0xcca7('0xf')][_0xcca7('0x11')]);return _0x5c5475(_0x1b5082['error'][_0xcca7('0x11')]);}logger[_0xcca7('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c4fbd,_0x1b5082[_0xcca7('0xf')]['message']);return _0x1c2671(_0x1b5082[_0xcca7('0xf')]['message']);}else{logger[_0xcca7('0xb')](_0xcca7('0x12'),_0x5c4fbd,_0xcca7('0xc'));_0x1c2671(_0x1b5082[_0xcca7('0x13')][_0xcca7('0x11')]);}})['catch'](function(_0x16d5f4){logger[_0xcca7('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c4fbd,_0x16d5f4);_0x5c5475(_0x16d5f4);});});} \ No newline at end of file +var _0x1f6e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x1f6e,0xa9));var _0xe1f6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1f6e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe1f6('0x0'));var util=require('util');var moment=require(_0xe1f6('0x1'));var BPromise=require(_0xe1f6('0x2'));var rs=require(_0xe1f6('0x3'));var fs=require('fs');var Redis=require(_0xe1f6('0x4'));var db=require(_0xe1f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1f6('0x6'))(_0xe1f6('0x7'));var config=require(_0xe1f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1f6('0x9')][_0xe1f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54043a,_0x38a2b1,_0x33f3a6){return new BPromise(function(_0x4e788f,_0x44e181){return client['request'](_0x54043a,_0x33f3a6)[_0xe1f6('0xb')](function(_0x29747b){logger['info'](_0xe1f6('0xc'),_0x38a2b1,_0xe1f6('0xd'));logger['debug'](_0xe1f6('0xe'),_0x38a2b1,_0xe1f6('0xd'),JSON[_0xe1f6('0xf')](_0x29747b));if(_0x29747b[_0xe1f6('0x10')]){if(_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x11')]===0x1f4){logger[_0xe1f6('0x10')](_0xe1f6('0xc'),_0x38a2b1,_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x12')]);return _0x44e181(_0x29747b[_0xe1f6('0x10')]['message']);}logger[_0xe1f6('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x38a2b1,_0x29747b[_0xe1f6('0x10')][_0xe1f6('0x12')]);return _0x4e788f(_0x29747b['error'][_0xe1f6('0x12')]);}else{logger['info'](_0xe1f6('0xc'),_0x38a2b1,_0xe1f6('0xd'));_0x4e788f(_0x29747b[_0xe1f6('0x13')][_0xe1f6('0x12')]);}})[_0xe1f6('0x14')](function(_0x3ff70c){logger[_0xe1f6('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x38a2b1,_0x3ff70c);_0x44e181(_0x3ff70c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1670819..0bbf423 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 _0xf819=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get'];(function(_0x36135b,_0x199b8b){var _0x12522e=function(_0x36ab86){while(--_0x36ab86){_0x36135b['push'](_0x36135b['shift']());}};_0x12522e(++_0x199b8b);}(_0xf819,0xad));var _0x9f81=function(_0x1f244d,_0x19e830){_0x1f244d=_0x1f244d-0x0;var _0x16003a=_0xf819[_0x1f244d];return _0x16003a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f81('0x0'));var timeout=require(_0x9f81('0x1'));var express=require('express');var router=express[_0x9f81('0x2')]();var fs_extra=require(_0x9f81('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9f81('0x4'));var config=require('../../config/environment');var controller=require(_0x9f81('0x5'));router[_0x9f81('0x6')]('/',auth[_0x9f81('0x7')](),controller[_0x9f81('0x8')]);router[_0x9f81('0x6')](_0x9f81('0x9'),auth[_0x9f81('0x7')](),controller[_0x9f81('0xa')]);router[_0x9f81('0xb')]('/',auth[_0x9f81('0x7')](),controller[_0x9f81('0xc')]);router[_0x9f81('0xd')](_0x9f81('0x9'),auth[_0x9f81('0x7')](),controller[_0x9f81('0xe')]);router[_0x9f81('0xf')]('/:id',auth[_0x9f81('0x7')](),controller[_0x9f81('0x10')]);module[_0x9f81('0x11')]=router; \ No newline at end of file +var _0x6a3a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6a3a,0x18f));var _0xa6a3=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x6a3a[_0x4ed520];return _0x4415a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6a3('0x0'));var timeout=require(_0xa6a3('0x1'));var express=require(_0xa6a3('0x2'));var router=express[_0xa6a3('0x3')]();var fs_extra=require(_0xa6a3('0x4'));var auth=require(_0xa6a3('0x5'));var interaction=require(_0xa6a3('0x6'));var config=require(_0xa6a3('0x7'));var controller=require(_0xa6a3('0x8'));router[_0xa6a3('0x9')]('/',auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xb')]);router[_0xa6a3('0x9')](_0xa6a3('0xc'),auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xd')]);router['post']('/',auth[_0xa6a3('0xa')](),controller[_0xa6a3('0xe')]);router[_0xa6a3('0xf')](_0xa6a3('0xc'),auth['isAuthenticated'](),controller[_0xa6a3('0x10')]);router[_0xa6a3('0x11')](_0xa6a3('0xc'),auth['isAuthenticated'](),controller[_0xa6a3('0x12')]);module[_0xa6a3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2bfdc1c..e1cc1ee 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 _0x65d3=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x2f4249,_0x554f30){var _0x353811=function(_0x15f7ba){while(--_0x15f7ba){_0x2f4249['push'](_0x2f4249['shift']());}};_0x353811(++_0x554f30);}(_0x65d3,0x117));var _0x365d=function(_0x2b0315,_0x2d2f66){_0x2b0315=_0x2b0315-0x0;var _0x2c0e56=_0x65d3[_0x2b0315];return _0x2c0e56;};'use strict';var Sequelize=require(_0x365d('0x0'));module[_0x365d('0x1')]={'type':{'type':Sequelize[_0x365d('0x2')](_0x365d('0x3'),_0x365d('0x4'),_0x365d('0x5'),'keyValue',_0x365d('0x6')),'defaultValue':_0x365d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x365d('0x2')](_0x365d('0x3'),_0x365d('0x4'),_0x365d('0x5'))},'keyContent':{'type':Sequelize[_0x365d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x365d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x365d('0x7')]}}; \ No newline at end of file +var _0xc0d9=['ENUM','string','keyValue','picklist','STRING','variable','customVariable','sequelize'];(function(_0x1d175d,_0x10fd73){var _0x2adbd7=function(_0x5a75ae){while(--_0x5a75ae){_0x1d175d['push'](_0x1d175d['shift']());}};_0x2adbd7(++_0x10fd73);}(_0xc0d9,0x12f));var _0x9c0d=function(_0x2318d5,_0x531822){_0x2318d5=_0x2318d5-0x0;var _0xa77057=_0xc0d9[_0x2318d5];return _0xa77057;};'use strict';var Sequelize=require(_0x9c0d('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c0d('0x1')](_0x9c0d('0x2'),'variable','customVariable',_0x9c0d('0x3'),_0x9c0d('0x4')),'defaultValue':_0x9c0d('0x2')},'content':{'type':Sequelize[_0x9c0d('0x5')]},'key':{'type':Sequelize[_0x9c0d('0x5')]},'keyType':{'type':Sequelize[_0x9c0d('0x1')](_0x9c0d('0x2'),_0x9c0d('0x6'),_0x9c0d('0x7'))},'keyContent':{'type':Sequelize[_0x9c0d('0x5')]},'idField':{'type':Sequelize[_0x9c0d('0x5')]},'nameField':{'type':Sequelize[_0x9c0d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7c81dc5..ac27ceb 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 _0x83d9=['map','ZohoField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','name','send'];(function(_0x40f018,_0x17157e){var _0x1f2ae1=function(_0x18c6f7){while(--_0x18c6f7){_0x40f018['push'](_0x40f018['shift']());}};_0x1f2ae1(++_0x17157e);}(_0x83d9,0x134));var _0x983d=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x83d9[_0x2f3848];return _0x102668;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x983d('0x0'));var zipdir=require(_0x983d('0x1'));var jsonpatch=require(_0x983d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x983d('0x3'));var util=require(_0x983d('0x4'));var path=require(_0x983d('0x5'));var sox=require(_0x983d('0x6'));var csv=require(_0x983d('0x7'));var ejs=require(_0x983d('0x8'));var fs=require('fs');var fs_extra=require(_0x983d('0x9'));var _=require(_0x983d('0xa'));var squel=require(_0x983d('0xb'));var crypto=require(_0x983d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x983d('0x7'));var querystring=require(_0x983d('0xd'));var Papa=require('papaparse');var Redis=require(_0x983d('0xe'));var authService=require(_0x983d('0xf'));var qs=require(_0x983d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x983d('0x11'));var logger=require(_0x983d('0x12'))(_0x983d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x983d('0x14'))['db'];function respondWithStatusCode(_0x47c3f7,_0x53575a){_0x53575a=_0x53575a||0xcc;return function(_0x57114e){if(_0x57114e){return _0x47c3f7[_0x983d('0x15')](_0x53575a);}return _0x47c3f7[_0x983d('0x16')](_0x53575a)[_0x983d('0x17')]();};}function respondWithResult(_0x9f87ff,_0x127f12){_0x127f12=_0x127f12||0xc8;return function(_0x1c6de1){if(_0x1c6de1){return _0x9f87ff[_0x983d('0x16')](_0x127f12)['json'](_0x1c6de1);}};}function respondWithFilteredResult(_0x39c63f,_0x5847ee){return function(_0x2cf3a5){if(_0x2cf3a5){var _0x39abb6=typeof _0x5847ee[_0x983d('0x18')]==='undefined'&&typeof _0x5847ee[_0x983d('0x19')]===_0x983d('0x1a');var _0x1dbe66=_0x2cf3a5[_0x983d('0x1b')];var _0x59e060=_0x39abb6?0x0:_0x5847ee['offset'];var _0x20885f=_0x39abb6?_0x2cf3a5[_0x983d('0x1b')]:_0x5847ee['offset']+_0x5847ee[_0x983d('0x19')];var _0xb84d59;if(_0x20885f>=_0x1dbe66){_0x20885f=_0x1dbe66;_0xb84d59=0xc8;}else{_0xb84d59=0xce;}_0x39c63f[_0x983d('0x16')](_0xb84d59);return _0x39c63f[_0x983d('0x1c')](_0x983d('0x1d'),_0x59e060+'-'+_0x20885f+'/'+_0x1dbe66)[_0x983d('0x1e')](_0x2cf3a5);}return null;};}function patchUpdates(_0x4c19a0){return function(_0x101077){try{jsonpatch[_0x983d('0x1f')](_0x101077,_0x4c19a0,!![]);}catch(_0x28a54b){return BPromise[_0x983d('0x20')](_0x28a54b);}return _0x101077[_0x983d('0x21')]();};}function saveUpdates(_0x43916f,_0x18b2c6){return function(_0x2fddca){if(_0x2fddca){return _0x2fddca['update'](_0x43916f)[_0x983d('0x22')](function(_0xa8d5ab){return _0xa8d5ab;});}return null;};}function removeEntity(_0x1ac4ec,_0x4a2653){return function(_0x184722){if(_0x184722){return _0x184722['destroy']()[_0x983d('0x22')](function(){_0x1ac4ec[_0x983d('0x16')](0xcc)[_0x983d('0x17')]();});}};}function handleEntityNotFound(_0x2bb9be,_0x1ab414){return function(_0x45ce11){if(!_0x45ce11){_0x2bb9be[_0x983d('0x15')](0x194);}return _0x45ce11;};}function handleError(_0x201e31,_0x52a78b){_0x52a78b=_0x52a78b||0x1f4;return function(_0x4ca386){logger['error'](_0x4ca386['stack']);if(_0x4ca386[_0x983d('0x23')]){delete _0x4ca386['name'];}_0x201e31[_0x983d('0x16')](_0x52a78b)[_0x983d('0x24')](_0x4ca386);};}exports['index']=function(_0x26e987,_0x1578d8){var _0x32202f={},_0x3878dd={},_0x2b70f8={'count':0x0,'rows':[]};var _0x192272=_[_0x983d('0x25')](db[_0x983d('0x26')][_0x983d('0x27')],function(_0x1622ba){return{'name':_0x1622ba[_0x983d('0x28')],'type':_0x1622ba[_0x983d('0x29')]['key']};});_0x3878dd[_0x983d('0x2a')]=_[_0x983d('0x25')](_0x192272,_0x983d('0x23'));_0x3878dd[_0x983d('0x2b')]=_['keys'](_0x26e987[_0x983d('0x2b')]);_0x3878dd['filters']=_[_0x983d('0x2c')](_0x3878dd[_0x983d('0x2a')],_0x3878dd['query']);_0x32202f[_0x983d('0x2d')]=_[_0x983d('0x2c')](_0x3878dd[_0x983d('0x2a')],qs['fields'](_0x26e987['query'][_0x983d('0x2e')]));_0x32202f[_0x983d('0x2d')]=_0x32202f[_0x983d('0x2d')][_0x983d('0x2f')]?_0x32202f['attributes']:_0x3878dd[_0x983d('0x2a')];if(!_0x26e987[_0x983d('0x2b')][_0x983d('0x30')](_0x983d('0x31'))){_0x32202f[_0x983d('0x19')]=qs[_0x983d('0x19')](_0x26e987['query'][_0x983d('0x19')]);_0x32202f[_0x983d('0x18')]=qs[_0x983d('0x18')](_0x26e987[_0x983d('0x2b')][_0x983d('0x18')]);}_0x32202f[_0x983d('0x32')]=qs[_0x983d('0x33')](_0x26e987[_0x983d('0x2b')]['sort']);_0x32202f['where']=qs[_0x983d('0x34')](_['pick'](_0x26e987[_0x983d('0x2b')],_0x3878dd['filters']),_0x192272);if(_0x26e987[_0x983d('0x2b')]['filter']){_0x32202f['where']=_[_0x983d('0x35')](_0x32202f[_0x983d('0x36')],{'$or':_[_0x983d('0x25')](_0x192272,function(_0x2919d7){if(_0x2919d7[_0x983d('0x29')]!=='VIRTUAL'){var _0x213140={};_0x213140[_0x2919d7['name']]={'$like':'%'+_0x26e987[_0x983d('0x2b')][_0x983d('0x37')]+'%'};return _0x213140;}})});}_0x32202f=_['merge']({},_0x32202f,_0x26e987[_0x983d('0x38')]);var _0x224f17={'where':_0x32202f[_0x983d('0x36')]};return db[_0x983d('0x26')][_0x983d('0x1b')](_0x224f17)[_0x983d('0x22')](function(_0x1e18cf){_0x2b70f8['count']=_0x1e18cf;if(_0x26e987['query'][_0x983d('0x39')]){_0x32202f[_0x983d('0x3a')]=[{'all':!![]}];}return db[_0x983d('0x26')]['findAll'](_0x32202f);})['then'](function(_0x2935a9){_0x2b70f8[_0x983d('0x3b')]=_0x2935a9;return _0x2b70f8;})[_0x983d('0x22')](respondWithFilteredResult(_0x1578d8,_0x32202f))[_0x983d('0x3c')](handleError(_0x1578d8,null));};exports[_0x983d('0x3d')]=function(_0x92ba82,_0x15ac5c){var _0x1d934c={'raw':!![],'where':{'id':_0x92ba82[_0x983d('0x3e')]['id']}},_0x52499c={};_0x52499c[_0x983d('0x2a')]=_[_0x983d('0x3f')](db[_0x983d('0x26')][_0x983d('0x27')]);_0x52499c[_0x983d('0x2b')]=_['keys'](_0x92ba82[_0x983d('0x2b')]);_0x52499c[_0x983d('0x34')]=_[_0x983d('0x2c')](_0x52499c[_0x983d('0x2a')],_0x52499c['query']);_0x1d934c[_0x983d('0x2d')]=_[_0x983d('0x2c')](_0x52499c[_0x983d('0x2a')],qs['fields'](_0x92ba82[_0x983d('0x2b')][_0x983d('0x2e')]));_0x1d934c[_0x983d('0x2d')]=_0x1d934c['attributes'][_0x983d('0x2f')]?_0x1d934c[_0x983d('0x2d')]:_0x52499c[_0x983d('0x2a')];if(_0x92ba82['query']['includeAll']){_0x1d934c[_0x983d('0x3a')]=[{'all':!![]}];}_0x1d934c=_[_0x983d('0x35')]({},_0x1d934c,_0x92ba82['options']);return db[_0x983d('0x26')][_0x983d('0x40')](_0x1d934c)[_0x983d('0x22')](handleEntityNotFound(_0x15ac5c,null))[_0x983d('0x22')](respondWithResult(_0x15ac5c,null))[_0x983d('0x3c')](handleError(_0x15ac5c,null));};exports[_0x983d('0x41')]=function(_0x2c2c2b,_0x24ef47){return db[_0x983d('0x26')][_0x983d('0x41')](_0x2c2c2b[_0x983d('0x42')],{})[_0x983d('0x22')](respondWithResult(_0x24ef47,0xc9))['catch'](handleError(_0x24ef47,null));};exports[_0x983d('0x43')]=function(_0x4e2557,_0x17b5b9){if(_0x4e2557[_0x983d('0x42')]['id']){delete _0x4e2557[_0x983d('0x42')]['id'];}return db[_0x983d('0x26')]['find']({'where':{'id':_0x4e2557[_0x983d('0x3e')]['id']}})[_0x983d('0x22')](handleEntityNotFound(_0x17b5b9,null))[_0x983d('0x22')](saveUpdates(_0x4e2557[_0x983d('0x42')],null))[_0x983d('0x22')](respondWithResult(_0x17b5b9,null))['catch'](handleError(_0x17b5b9,null));};exports[_0x983d('0x44')]=function(_0x34ad99,_0x2fc5f1){return db[_0x983d('0x26')][_0x983d('0x40')]({'where':{'id':_0x34ad99[_0x983d('0x3e')]['id']}})[_0x983d('0x22')](handleEntityNotFound(_0x2fc5f1,null))[_0x983d('0x22')](removeEntity(_0x2fc5f1,null))[_0x983d('0x3c')](handleError(_0x2fc5f1,null));}; \ No newline at end of file +var _0x4cd3=['update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','bluebird','mustache','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save'];(function(_0x15a31b,_0x4d09d0){var _0x52f1c7=function(_0x1421b6){while(--_0x1421b6){_0x15a31b['push'](_0x15a31b['shift']());}};_0x52f1c7(++_0x4d09d0);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x4cd3[_0x4cd846];return _0x2f2a7d;};'use strict';var emlformat=require(_0x34cd('0x0'));var rimraf=require(_0x34cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34cd('0x2'));var Mustache=require(_0x34cd('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34cd('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x34cd('0x5'));var crypto=require('crypto');var jsforce=require(_0x34cd('0x6'));var deskjs=require(_0x34cd('0x7'));var toCsv=require(_0x34cd('0x4'));var querystring=require('querystring');var Papa=require(_0x34cd('0x8'));var Redis=require(_0x34cd('0x9'));var authService=require(_0x34cd('0xa'));var qs=require(_0x34cd('0xb'));var as=require(_0x34cd('0xc'));var hardwareService=require(_0x34cd('0xd'));var logger=require(_0x34cd('0xe'))(_0x34cd('0xf'));var utils=require(_0x34cd('0x10'));var config=require(_0x34cd('0x11'));var licenseUtil=require(_0x34cd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36da2e,_0x3b31d7){_0x3b31d7=_0x3b31d7||0xcc;return function(_0x1de276){if(_0x1de276){return _0x36da2e[_0x34cd('0x13')](_0x3b31d7);}return _0x36da2e[_0x34cd('0x14')](_0x3b31d7)[_0x34cd('0x15')]();};}function respondWithResult(_0x1e65d5,_0x59a551){_0x59a551=_0x59a551||0xc8;return function(_0x2881ba){if(_0x2881ba){return _0x1e65d5[_0x34cd('0x14')](_0x59a551)['json'](_0x2881ba);}};}function respondWithFilteredResult(_0x5a1959,_0x44e5ff){return function(_0x1d5464){if(_0x1d5464){var _0x471982=typeof _0x44e5ff[_0x34cd('0x16')]==='undefined'&&typeof _0x44e5ff[_0x34cd('0x17')]===_0x34cd('0x18');var _0x203740=_0x1d5464['count'];var _0x4b20b2=_0x471982?0x0:_0x44e5ff[_0x34cd('0x16')];var _0x22351c=_0x471982?_0x1d5464[_0x34cd('0x19')]:_0x44e5ff[_0x34cd('0x16')]+_0x44e5ff['limit'];var _0xa9c5bd;if(_0x22351c>=_0x203740){_0x22351c=_0x203740;_0xa9c5bd=0xc8;}else{_0xa9c5bd=0xce;}_0x5a1959[_0x34cd('0x14')](_0xa9c5bd);return _0x5a1959[_0x34cd('0x1a')](_0x34cd('0x1b'),_0x4b20b2+'-'+_0x22351c+'/'+_0x203740)[_0x34cd('0x1c')](_0x1d5464);}return null;};}function patchUpdates(_0x2ada47){return function(_0x435a24){try{jsonpatch[_0x34cd('0x1d')](_0x435a24,_0x2ada47,!![]);}catch(_0x34cb87){return BPromise[_0x34cd('0x1e')](_0x34cb87);}return _0x435a24[_0x34cd('0x1f')]();};}function saveUpdates(_0x454e32,_0x1276aa){return function(_0x127169){if(_0x127169){return _0x127169[_0x34cd('0x20')](_0x454e32)[_0x34cd('0x21')](function(_0x4adca3){return _0x4adca3;});}return null;};}function removeEntity(_0x3821dd,_0x1dd88b){return function(_0x4cbf48){if(_0x4cbf48){return _0x4cbf48['destroy']()[_0x34cd('0x21')](function(){_0x3821dd[_0x34cd('0x14')](0xcc)[_0x34cd('0x15')]();});}};}function handleEntityNotFound(_0x396d71,_0x45f63f){return function(_0x43eb88){if(!_0x43eb88){_0x396d71[_0x34cd('0x13')](0x194);}return _0x43eb88;};}function handleError(_0x55f3d4,_0x3a37ed){_0x3a37ed=_0x3a37ed||0x1f4;return function(_0x1a580d){logger[_0x34cd('0x22')](_0x1a580d[_0x34cd('0x23')]);if(_0x1a580d[_0x34cd('0x24')]){delete _0x1a580d[_0x34cd('0x24')];}_0x55f3d4['status'](_0x3a37ed)[_0x34cd('0x25')](_0x1a580d);};}exports[_0x34cd('0x26')]=function(_0x1904b6,_0x2f5b26){var _0x15a8e7={},_0x2bca91={},_0xfd718c={'count':0x0,'rows':[]};var _0x307632=_[_0x34cd('0x27')](db[_0x34cd('0x28')][_0x34cd('0x29')],function(_0x34cb1f){return{'name':_0x34cb1f[_0x34cd('0x2a')],'type':_0x34cb1f['type'][_0x34cd('0x2b')]};});_0x2bca91[_0x34cd('0x2c')]=_[_0x34cd('0x27')](_0x307632,_0x34cd('0x24'));_0x2bca91[_0x34cd('0x2d')]=_['keys'](_0x1904b6[_0x34cd('0x2d')]);_0x2bca91[_0x34cd('0x2e')]=_[_0x34cd('0x2f')](_0x2bca91[_0x34cd('0x2c')],_0x2bca91[_0x34cd('0x2d')]);_0x15a8e7[_0x34cd('0x30')]=_[_0x34cd('0x2f')](_0x2bca91[_0x34cd('0x2c')],qs[_0x34cd('0x31')](_0x1904b6['query']['fields']));_0x15a8e7[_0x34cd('0x30')]=_0x15a8e7[_0x34cd('0x30')][_0x34cd('0x32')]?_0x15a8e7[_0x34cd('0x30')]:_0x2bca91[_0x34cd('0x2c')];if(!_0x1904b6['query']['hasOwnProperty'](_0x34cd('0x33'))){_0x15a8e7[_0x34cd('0x17')]=qs[_0x34cd('0x17')](_0x1904b6['query'][_0x34cd('0x17')]);_0x15a8e7[_0x34cd('0x16')]=qs[_0x34cd('0x16')](_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x16')]);}_0x15a8e7[_0x34cd('0x34')]=qs[_0x34cd('0x35')](_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x35')]);_0x15a8e7['where']=qs[_0x34cd('0x2e')](_['pick'](_0x1904b6[_0x34cd('0x2d')],_0x2bca91[_0x34cd('0x2e')]),_0x307632);if(_0x1904b6['query'][_0x34cd('0x36')]){_0x15a8e7[_0x34cd('0x37')]=_['merge'](_0x15a8e7[_0x34cd('0x37')],{'$or':_['map'](_0x307632,function(_0x1dc060){if(_0x1dc060[_0x34cd('0x38')]!==_0x34cd('0x39')){var _0x4f353b={};_0x4f353b[_0x1dc060['name']]={'$like':'%'+_0x1904b6['query'][_0x34cd('0x36')]+'%'};return _0x4f353b;}})});}_0x15a8e7=_[_0x34cd('0x3a')]({},_0x15a8e7,_0x1904b6[_0x34cd('0x3b')]);var _0x3f8766={'where':_0x15a8e7['where']};return db[_0x34cd('0x28')][_0x34cd('0x19')](_0x3f8766)[_0x34cd('0x21')](function(_0xa478f2){_0xfd718c['count']=_0xa478f2;if(_0x1904b6[_0x34cd('0x2d')][_0x34cd('0x3c')]){_0x15a8e7[_0x34cd('0x3d')]=[{'all':!![]}];}return db[_0x34cd('0x28')][_0x34cd('0x3e')](_0x15a8e7);})[_0x34cd('0x21')](function(_0x40f8d3){_0xfd718c[_0x34cd('0x3f')]=_0x40f8d3;return _0xfd718c;})[_0x34cd('0x21')](respondWithFilteredResult(_0x2f5b26,_0x15a8e7))[_0x34cd('0x40')](handleError(_0x2f5b26,null));};exports['show']=function(_0x3f852b,_0x9629e4){var _0x31f8c5={'raw':!![],'where':{'id':_0x3f852b[_0x34cd('0x41')]['id']}},_0x5d387b={};_0x5d387b[_0x34cd('0x2c')]=_[_0x34cd('0x42')](db['ZohoField'][_0x34cd('0x29')]);_0x5d387b[_0x34cd('0x2d')]=_[_0x34cd('0x42')](_0x3f852b[_0x34cd('0x2d')]);_0x5d387b[_0x34cd('0x2e')]=_[_0x34cd('0x2f')](_0x5d387b[_0x34cd('0x2c')],_0x5d387b['query']);_0x31f8c5[_0x34cd('0x30')]=_['intersection'](_0x5d387b[_0x34cd('0x2c')],qs[_0x34cd('0x31')](_0x3f852b[_0x34cd('0x2d')][_0x34cd('0x31')]));_0x31f8c5[_0x34cd('0x30')]=_0x31f8c5['attributes'][_0x34cd('0x32')]?_0x31f8c5[_0x34cd('0x30')]:_0x5d387b[_0x34cd('0x2c')];if(_0x3f852b[_0x34cd('0x2d')][_0x34cd('0x3c')]){_0x31f8c5[_0x34cd('0x3d')]=[{'all':!![]}];}_0x31f8c5=_[_0x34cd('0x3a')]({},_0x31f8c5,_0x3f852b[_0x34cd('0x3b')]);return db[_0x34cd('0x28')][_0x34cd('0x43')](_0x31f8c5)[_0x34cd('0x21')](handleEntityNotFound(_0x9629e4,null))[_0x34cd('0x21')](respondWithResult(_0x9629e4,null))[_0x34cd('0x40')](handleError(_0x9629e4,null));};exports[_0x34cd('0x44')]=function(_0xa541d1,_0x5823cf){return db[_0x34cd('0x28')][_0x34cd('0x44')](_0xa541d1[_0x34cd('0x45')],{})['then'](respondWithResult(_0x5823cf,0xc9))['catch'](handleError(_0x5823cf,null));};exports[_0x34cd('0x20')]=function(_0x1d24ac,_0x57370a){if(_0x1d24ac[_0x34cd('0x45')]['id']){delete _0x1d24ac[_0x34cd('0x45')]['id'];}return db[_0x34cd('0x28')]['find']({'where':{'id':_0x1d24ac[_0x34cd('0x41')]['id']}})[_0x34cd('0x21')](handleEntityNotFound(_0x57370a,null))[_0x34cd('0x21')](saveUpdates(_0x1d24ac[_0x34cd('0x45')],null))[_0x34cd('0x21')](respondWithResult(_0x57370a,null))['catch'](handleError(_0x57370a,null));};exports['destroy']=function(_0x23437a,_0x32d01e){return db[_0x34cd('0x28')]['find']({'where':{'id':_0x23437a[_0x34cd('0x41')]['id']}})[_0x34cd('0x21')](handleEntityNotFound(_0x32d01e,null))[_0x34cd('0x21')](removeEntity(_0x32d01e,null))[_0x34cd('0x40')](handleError(_0x32d01e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c2f30e1..ee73c6e 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 _0x9a5a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x9a5a,0x194));var _0xa9a5=function(_0x18fb9e,_0x35a202){_0x18fb9e=_0x18fb9e-0x0;var _0x175531=_0x9a5a[_0x18fb9e];return _0x175531;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[{'name':_0xa9a5('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x4cd581,_0x49eb2b){var _0x1ac616=function(_0x1459b3){while(--_0x1459b3){_0x4cd581['push'](_0x4cd581['shift']());}};_0x1ac616(++_0x49eb2b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 2671709..dec88ce 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 _0x9532=['request\x20sent','debug','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ZohoField,\x20%s,\x20%s'];(function(_0x39c701,_0x36a82a){var _0x1242e3=function(_0xfa524e){while(--_0xfa524e){_0x39c701['push'](_0x39c701['shift']());}};_0x1242e3(++_0x36a82a);}(_0x9532,0x70));var _0x2953=function(_0x24d3f9,_0x421034){_0x24d3f9=_0x24d3f9-0x0;var _0x3716c2=_0x9532[_0x24d3f9];return _0x3716c2;};'use strict';var _=require(_0x2953('0x0'));var util=require(_0x2953('0x1'));var moment=require(_0x2953('0x2'));var BPromise=require(_0x2953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2953('0x4'));var db=require(_0x2953('0x5'))['db'];var utils=require(_0x2953('0x6'));var logger=require(_0x2953('0x7'))(_0x2953('0x8'));var config=require(_0x2953('0x9'));var jayson=require(_0x2953('0xa'));var client=jayson['client'][_0x2953('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b80f,_0x3e18c0,_0x37cc92){return new BPromise(function(_0x596097,_0x2d0e3f){return client['request'](_0x52b80f,_0x37cc92)[_0x2953('0xc')](function(_0x491d13){logger['info'](_0x2953('0xd'),_0x3e18c0,_0x2953('0xe'));logger[_0x2953('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3e18c0,'request\x20sent',JSON['stringify'](_0x491d13));if(_0x491d13['error']){if(_0x491d13[_0x2953('0x10')][_0x2953('0x11')]===0x1f4){logger[_0x2953('0x10')](_0x2953('0xd'),_0x3e18c0,_0x491d13[_0x2953('0x10')][_0x2953('0x12')]);return _0x2d0e3f(_0x491d13[_0x2953('0x10')][_0x2953('0x12')]);}logger[_0x2953('0x10')](_0x2953('0xd'),_0x3e18c0,_0x491d13['error'][_0x2953('0x12')]);return _0x596097(_0x491d13[_0x2953('0x10')][_0x2953('0x12')]);}else{logger[_0x2953('0x13')](_0x2953('0xd'),_0x3e18c0,_0x2953('0xe'));_0x596097(_0x491d13[_0x2953('0x14')][_0x2953('0x12')]);}})['catch'](function(_0x512c1d){logger[_0x2953('0x10')]('ZohoField,\x20%s,\x20%s',_0x3e18c0,_0x512c1d);_0x2d0e3f(_0x512c1d);});});} \ No newline at end of file +var _0x5724=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5724,0x1bc));var _0x4572=function(_0x389608,_0x4923a6){_0x389608=_0x389608-0x0;var _0x5af592=_0x5724[_0x389608];return _0x5af592;};'use strict';var _=require(_0x4572('0x0'));var util=require(_0x4572('0x1'));var moment=require(_0x4572('0x2'));var BPromise=require('bluebird');var rs=require(_0x4572('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4572('0x4'))['db'];var utils=require(_0x4572('0x5'));var logger=require(_0x4572('0x6'))(_0x4572('0x7'));var config=require(_0x4572('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4572('0x9')][_0x4572('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x147582,_0x598710,_0x30386f){return new BPromise(function(_0x2bb95c,_0x17633c){return client[_0x4572('0xb')](_0x147582,_0x30386f)[_0x4572('0xc')](function(_0x3cb744){logger['info'](_0x4572('0xd'),_0x598710,_0x4572('0xe'));logger['debug'](_0x4572('0xf'),_0x598710,'request\x20sent',JSON[_0x4572('0x10')](_0x3cb744));if(_0x3cb744[_0x4572('0x11')]){if(_0x3cb744[_0x4572('0x11')][_0x4572('0x12')]===0x1f4){logger[_0x4572('0x11')]('ZohoField,\x20%s,\x20%s',_0x598710,_0x3cb744['error'][_0x4572('0x13')]);return _0x17633c(_0x3cb744['error']['message']);}logger['error'](_0x4572('0xd'),_0x598710,_0x3cb744[_0x4572('0x11')][_0x4572('0x13')]);return _0x2bb95c(_0x3cb744[_0x4572('0x11')][_0x4572('0x13')]);}else{logger[_0x4572('0x14')](_0x4572('0xd'),_0x598710,_0x4572('0xe'));_0x2bb95c(_0x3cb744[_0x4572('0x15')]['message']);}})[_0x4572('0x16')](function(_0x4aa9ad){logger[_0x4572('0x11')](_0x4572('0xd'),_0x598710,_0x4aa9ad);_0x17633c(_0x4aa9ad);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 237d54e..6e38211 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ee7344a..8fae2d5 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 _0x1157=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1157,0x1a8));var _0x7115=function(_0x51895c,_0x32663e){_0x51895c=_0x51895c-0x0;var _0x118f19=_0x1157[_0x51895c];return _0x118f19;};'use strict';var Sequelize=require(_0x7115('0x0'));module['exports']={'name':{'type':Sequelize[_0x7115('0x1')],'allowNull':![],'unique':_0x7115('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7115('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7115('0x1')]},'size':{'type':Sequelize[_0x7115('0x3')]},'active':{'type':Sequelize[_0x7115('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x7115('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x7115('0x1')]},'remoteUri':{'type':Sequelize[_0x7115('0x1')]},'link':{'type':Sequelize[_0x7115('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x5f59=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x236153,_0x2242d4){var _0x3ead90=function(_0x2f0cd9){while(--_0x2f0cd9){_0x236153['push'](_0x236153['shift']());}};_0x3ead90(++_0x2242d4);}(_0x5f59,0x1ae));var _0x95f5=function(_0x4af263,_0x5e44d6){_0x4af263=_0x4af263-0x0;var _0x29015e=_0x5f59[_0x4af263];return _0x29015e;};'use strict';var Sequelize=require(_0x95f5('0x0'));module['exports']={'name':{'type':Sequelize[_0x95f5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x95f5('0x1')],'allowNull':![],'unique':_0x95f5('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x95f5('0x1')]},'path':{'type':Sequelize[_0x95f5('0x1')]},'type':{'type':Sequelize[_0x95f5('0x1')]},'size':{'type':Sequelize[_0x95f5('0x3')]},'active':{'type':Sequelize[_0x95f5('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x95f5('0x1')]},'state':{'type':Sequelize[_0x95f5('0x1')],'unique':_0x95f5('0x5')},'description':{'type':Sequelize[_0x95f5('0x1')]},'title':{'type':Sequelize[_0x95f5('0x1')]},'remoteUri':{'type':Sequelize[_0x95f5('0x1')]},'link':{'type':Sequelize[_0x95f5('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 01d9183..0c3db0b 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 _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file +var _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2e3bd2,_0xff9cdf){var _0xa9321d=function(_0x381e63){while(--_0x381e63){_0x2e3bd2['push'](_0x2e3bd2['shift']());}};_0xa9321d(++_0xff9cdf);}(_0xafc4,0x69));var _0x4afc=function(_0x2972cb,_0x5369f1){_0x2972cb=_0x2972cb-0x0;var _0x1c0902=_0xafc4[_0x2972cb];return _0x1c0902;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f999205..80d2e71 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 _0x89b4=['exports','define','Integration','integrations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89b4,0xac));var _0x489b=function(_0x153616,_0x2899b0){_0x153616=_0x153616-0x0;var _0x3adee8=_0x89b4[_0x153616];return _0x3adee8;};'use strict';var _=require('lodash');var util=require(_0x489b('0x0'));var logger=require(_0x489b('0x1'))(_0x489b('0x2'));var moment=require('moment');var BPromise=require(_0x489b('0x3'));var rp=require(_0x489b('0x4'));var fs=require('fs');var path=require(_0x489b('0x5'));var rimraf=require('rimraf');var config=require(_0x489b('0x6'));var attributes=require(_0x489b('0x7'));module[_0x489b('0x8')]=function(_0x13e4b4,_0x28d94c){return _0x13e4b4[_0x489b('0x9')](_0x489b('0xa'),attributes,{'tableName':_0x489b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc8a=['api','moment','path','rimraf','./integration.attributes','Integration','integrations','lodash','../../config/logger'];(function(_0xc6574b,_0x4bf578){var _0x3f49a4=function(_0x3a1a0d){while(--_0x3a1a0d){_0xc6574b['push'](_0xc6574b['shift']());}};_0x3f49a4(++_0x4bf578);}(_0xfc8a,0x85));var _0xafc8=function(_0x192a0c,_0x299c0f){_0x192a0c=_0x192a0c-0x0;var _0x42ac96=_0xfc8a[_0x192a0c];return _0x42ac96;};'use strict';var _=require(_0xafc8('0x0'));var util=require('util');var logger=require(_0xafc8('0x1'))(_0xafc8('0x2'));var moment=require(_0xafc8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafc8('0x4'));var rimraf=require(_0xafc8('0x5'));var config=require('../../config/environment');var attributes=require(_0xafc8('0x6'));module['exports']=function(_0xb9005b,_0x1c77fa){return _0xb9005b['define'](_0xafc8('0x7'),attributes,{'tableName':_0xafc8('0x8'),'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 1703c3f..ba006bf 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x529c58,_0x5040d0){var _0x5ad8d8=function(_0x571785){while(--_0x571785){_0x529c58['push'](_0x529c58['shift']());}};_0x5ad8d8(++_0x5040d0);}(_0x896e,0x1e9));var _0xe896=function(_0x85adc2,_0x1ef11a){_0x85adc2=_0x85adc2-0x0;var _0x2cfd69=_0x896e[_0x85adc2];return _0x2cfd69;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x58389d,_0x3137df){var _0x2be20a=function(_0x2b6f46){while(--_0x2b6f46){_0x58389d['push'](_0x58389d['shift']());}};_0x2be20a(++_0x3137df);}(_0x14a0,0x8e));var _0x014a=function(_0x3e4e90,_0x4c0a1e){_0x3e4e90=_0x3e4e90-0x0;var _0x38effb=_0x14a0[_0x3e4e90];return _0x38effb;};'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});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 90cff62..61bafbb 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 _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0xd943,0x15d));var _0x3d94=function(_0x15fc67,_0x3c8651){_0x15fc67=_0x15fc67-0x0;var _0xafe930=_0xd943[_0x15fc67];return _0xafe930;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file +var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x28f673,_0xd2e05e){var _0x1d82b6=function(_0x43268a){while(--_0x43268a){_0x28f673['push'](_0x28f673['shift']());}};_0x1d82b6(++_0xd2e05e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4640e0,_0x10ef3c){_0x4640e0=_0x4640e0-0x0;var _0x3d87ea=_0xc2c7[_0x4640e0];return _0x3d87ea;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9a48085..7564a64 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 _0x5b5f=['FAILED','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5b5f,0xd9));var _0xf5b5=function(_0x2b390d,_0x29450c){_0x2b390d=_0x2b390d-0x0;var _0x35ae52=_0x5b5f[_0x2b390d];return _0x35ae52;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xf5b5('0x0')]},'eventChannel':{'type':Sequelize[_0xf5b5('0x0')]},'exitStatus':{'type':Sequelize[_0xf5b5('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xf5b5('0x1')]},'contacts':{'type':Sequelize[_0xf5b5('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf5b5('0x0')]},'calleridname':{'type':Sequelize[_0xf5b5('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf5b5('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf5b5('0x2')]},'holdtime':{'type':Sequelize[_0xf5b5('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf5b5('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf5b5('0x1')]},'reason':{'type':Sequelize[_0xf5b5('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xf5b5('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf5b5('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xf5b5('0x0')]},'channel':{'type':Sequelize[_0xf5b5('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf5b5('0x0')]},'connectedlinenum':{'type':Sequelize[_0xf5b5('0x0')]},'connectedlinename':{'type':Sequelize[_0xf5b5('0x0')]},'language':{'type':Sequelize[_0xf5b5('0x0')]},'accountcode':{'type':Sequelize[_0xf5b5('0x0')]},'context':{'type':Sequelize[_0xf5b5('0x0')]},'exten':{'type':Sequelize[_0xf5b5('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf5b5('0x0')]},'destchannelstate':{'type':Sequelize[_0xf5b5('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xf5b5('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf5b5('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xf5b5('0x0')]},'destlanguage':{'type':Sequelize[_0xf5b5('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf5b5('0x0')]},'destexten':{'type':Sequelize[_0xf5b5('0x0')]},'destpriority':{'type':Sequelize[_0xf5b5('0x0')]},'destuniqueid':{'type':Sequelize[_0xf5b5('0x0')]},'messageId':{'type':Sequelize[_0xf5b5('0x0')]},'inReplyTo':{'type':Sequelize[_0xf5b5('0x0')]},'subject':{'type':Sequelize[_0xf5b5('0x0')]},'from':{'type':Sequelize[_0xf5b5('0x0')]},'to':{'type':Sequelize[_0xf5b5('0x0')]},'cc':{'type':Sequelize[_0xf5b5('0x0')]},'attachment':{'type':Sequelize[_0xf5b5('0x4')]},'html':{'type':Sequelize[_0xf5b5('0x4')]},'text':{'type':Sequelize[_0xf5b5('0x4')]},'status':{'type':Sequelize['ENUM']('SENT',_0xf5b5('0x5'),_0xf5b5('0x6'),_0xf5b5('0x7'))},'url':{'type':Sequelize[_0xf5b5('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf5b5('0x0')]},'projectId':{'type':Sequelize[_0xf5b5('0x1')]}}; \ No newline at end of file +var _0xb3ab=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','sequelize'];(function(_0x1d311b,_0x31ed4f){var _0x1b28ca=function(_0x18d9ca){while(--_0x18d9ca){_0x1d311b['push'](_0x1d311b['shift']());}};_0x1b28ca(++_0x31ed4f);}(_0xb3ab,0x6b));var _0xbb3a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xb3ab[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0xbb3a('0x0'));module[_0xbb3a('0x1')]={'integration':{'type':Sequelize[_0xbb3a('0x2')]},'eventChannel':{'type':Sequelize[_0xbb3a('0x2')]},'exitStatus':{'type':Sequelize[_0xbb3a('0x2')]},'ticketId':{'type':Sequelize[_0xbb3a('0x2')]},'integrationId':{'type':Sequelize[_0xbb3a('0x3')]},'contacts':{'type':Sequelize[_0xbb3a('0x2')]},'uniqueid':{'type':Sequelize[_0xbb3a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb3a('0x2')]},'queue':{'type':Sequelize[_0xbb3a('0x2')]},'interface':{'type':Sequelize[_0xbb3a('0x2')]},'membername':{'type':Sequelize[_0xbb3a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbb3a('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xbb3a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbb3a('0x4')]},'talktime':{'type':Sequelize[_0xbb3a('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbb3a('0x3')]},'reason':{'type':Sequelize[_0xbb3a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xbb3a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbb3a('0x4')]},'agentdump':{'type':Sequelize[_0xbb3a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbb3a('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbb3a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbb3a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbb3a('0x2')]},'accountcode':{'type':Sequelize[_0xbb3a('0x2')]},'context':{'type':Sequelize[_0xbb3a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbb3a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xbb3a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbb3a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbb3a('0x2')]},'destcalleridname':{'type':Sequelize[_0xbb3a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbb3a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xbb3a('0x2')]},'destaccountcode':{'type':Sequelize[_0xbb3a('0x2')]},'destcontext':{'type':Sequelize[_0xbb3a('0x2')]},'destexten':{'type':Sequelize[_0xbb3a('0x2')]},'destpriority':{'type':Sequelize[_0xbb3a('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xbb3a('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xbb3a('0x2')]},'from':{'type':Sequelize[_0xbb3a('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbb3a('0x2')]},'attachment':{'type':Sequelize[_0xbb3a('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xbb3a('0x7'),'SENDING',_0xbb3a('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xbb3a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0b4fd81..22866df 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 _0x6822=['zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','save','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','IntegrationReport','includeAll','include','findAll','show','params','keys','rawAttributes','intersection','length','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x465709,_0x14be9e){var _0x33662e=function(_0x51354b){while(--_0x51354b){_0x465709['push'](_0x465709['shift']());}};_0x33662e(++_0x14be9e);}(_0x6822,0xd3));var _0x2682=function(_0x56d482,_0x380609){_0x56d482=_0x56d482-0x0;var _0x47a253=_0x6822[_0x56d482];return _0x47a253;};'use strict';var emlformat=require(_0x2682('0x0'));var rimraf=require(_0x2682('0x1'));var zipdir=require(_0x2682('0x2'));var jsonpatch=require(_0x2682('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2682('0x4'));var util=require(_0x2682('0x5'));var path=require(_0x2682('0x6'));var sox=require(_0x2682('0x7'));var csv=require(_0x2682('0x8'));var ejs=require(_0x2682('0x9'));var fs=require('fs');var fs_extra=require(_0x2682('0xa'));var _=require(_0x2682('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2682('0xc'));var deskjs=require(_0x2682('0xd'));var toCsv=require(_0x2682('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2682('0xe'));var authService=require(_0x2682('0xf'));var qs=require(_0x2682('0x10'));var as=require(_0x2682('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2682('0x12'))(_0x2682('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2682('0x14'));var db=require(_0x2682('0x15'))['db'];function respondWithStatusCode(_0x527bad,_0x50f51e){_0x50f51e=_0x50f51e||0xcc;return function(_0x34bdee){if(_0x34bdee){return _0x527bad[_0x2682('0x16')](_0x50f51e);}return _0x527bad['status'](_0x50f51e)[_0x2682('0x17')]();};}function respondWithResult(_0x289328,_0x251141){_0x251141=_0x251141||0xc8;return function(_0xe6ef07){if(_0xe6ef07){return _0x289328[_0x2682('0x18')](_0x251141)['json'](_0xe6ef07);}};}function respondWithFilteredResult(_0x2bf1de,_0x54bbf6){return function(_0x11182a){if(_0x11182a){var _0x4f2168=typeof _0x54bbf6['offset']===_0x2682('0x19')&&typeof _0x54bbf6[_0x2682('0x1a')]===_0x2682('0x19');var _0x590295=_0x11182a['count'];var _0x5ed576=_0x4f2168?0x0:_0x54bbf6['offset'];var _0x2c384d=_0x4f2168?_0x11182a[_0x2682('0x1b')]:_0x54bbf6[_0x2682('0x1c')]+_0x54bbf6[_0x2682('0x1a')];var _0x2e504b;if(_0x2c384d>=_0x590295){_0x2c384d=_0x590295;_0x2e504b=0xc8;}else{_0x2e504b=0xce;}_0x2bf1de['status'](_0x2e504b);return _0x2bf1de[_0x2682('0x1d')]('Content-Range',_0x5ed576+'-'+_0x2c384d+'/'+_0x590295)[_0x2682('0x1e')](_0x11182a);}return null;};}function patchUpdates(_0x21d82b){return function(_0x4a161d){try{jsonpatch[_0x2682('0x1f')](_0x4a161d,_0x21d82b,!![]);}catch(_0x57e390){return BPromise['reject'](_0x57e390);}return _0x4a161d[_0x2682('0x20')]();};}function saveUpdates(_0x37564d,_0x313431){return function(_0x114b01){if(_0x114b01){return _0x114b01['update'](_0x37564d)[_0x2682('0x21')](function(_0x46cc6e){return _0x46cc6e;});}return null;};}function removeEntity(_0x40b15a,_0x4f1fd1){return function(_0x19d63a){if(_0x19d63a){return _0x19d63a[_0x2682('0x22')]()['then'](function(){_0x40b15a[_0x2682('0x18')](0xcc)[_0x2682('0x17')]();});}};}function handleEntityNotFound(_0x585f30,_0x13c7a4){return function(_0x4300bb){if(!_0x4300bb){_0x585f30[_0x2682('0x16')](0x194);}return _0x4300bb;};}function handleError(_0xd5533c,_0x5dd2f3){_0x5dd2f3=_0x5dd2f3||0x1f4;return function(_0x5abe87){logger[_0x2682('0x23')](_0x5abe87[_0x2682('0x24')]);if(_0x5abe87[_0x2682('0x25')]){delete _0x5abe87[_0x2682('0x25')];}_0xd5533c[_0x2682('0x18')](_0x5dd2f3)['send'](_0x5abe87);};}exports[_0x2682('0x26')]=function(_0x4be3d4,_0x2d0ab4){var _0x2cd621={},_0x5777b4={},_0x1595e8={'count':0x0,'rows':[]};var _0x33d3fe=_[_0x2682('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x53a522){return{'name':_0x53a522[_0x2682('0x28')],'type':_0x53a522[_0x2682('0x29')][_0x2682('0x2a')]};});_0x5777b4[_0x2682('0x2b')]=_[_0x2682('0x27')](_0x33d3fe,'name');_0x5777b4[_0x2682('0x2c')]=_['keys'](_0x4be3d4[_0x2682('0x2c')]);_0x5777b4[_0x2682('0x2d')]=_['intersection'](_0x5777b4['model'],_0x5777b4[_0x2682('0x2c')]);_0x2cd621[_0x2682('0x2e')]=_['intersection'](_0x5777b4[_0x2682('0x2b')],qs[_0x2682('0x2f')](_0x4be3d4[_0x2682('0x2c')][_0x2682('0x2f')]));_0x2cd621[_0x2682('0x2e')]=_0x2cd621[_0x2682('0x2e')]['length']?_0x2cd621[_0x2682('0x2e')]:_0x5777b4[_0x2682('0x2b')];if(!_0x4be3d4[_0x2682('0x2c')][_0x2682('0x30')]('nolimit')){_0x2cd621['limit']=qs[_0x2682('0x1a')](_0x4be3d4[_0x2682('0x2c')][_0x2682('0x1a')]);_0x2cd621[_0x2682('0x1c')]=qs['offset'](_0x4be3d4[_0x2682('0x2c')][_0x2682('0x1c')]);}_0x2cd621['order']=qs[_0x2682('0x31')](_0x4be3d4[_0x2682('0x2c')]['sort']);_0x2cd621[_0x2682('0x32')]=qs['filters'](_[_0x2682('0x33')](_0x4be3d4[_0x2682('0x2c')],_0x5777b4['filters']),_0x33d3fe);if(_0x4be3d4[_0x2682('0x2c')]['filter']){_0x2cd621[_0x2682('0x32')]=_['merge'](_0x2cd621[_0x2682('0x32')],{'$or':_[_0x2682('0x27')](_0x33d3fe,function(_0x305cb7){if(_0x305cb7[_0x2682('0x29')]!==_0x2682('0x34')){var _0x5846ac={};_0x5846ac[_0x305cb7[_0x2682('0x25')]]={'$like':'%'+_0x4be3d4[_0x2682('0x2c')][_0x2682('0x35')]+'%'};return _0x5846ac;}})});}_0x2cd621=_[_0x2682('0x36')]({},_0x2cd621,_0x4be3d4[_0x2682('0x37')]);var _0x49cd6b={'where':_0x2cd621['where']};return db[_0x2682('0x38')][_0x2682('0x1b')](_0x49cd6b)['then'](function(_0x3f5b5e){_0x1595e8[_0x2682('0x1b')]=_0x3f5b5e;if(_0x4be3d4[_0x2682('0x2c')][_0x2682('0x39')]){_0x2cd621[_0x2682('0x3a')]=[{'all':!![]}];}return db['IntegrationReport'][_0x2682('0x3b')](_0x2cd621);})['then'](function(_0x239095){_0x1595e8['rows']=_0x239095;return _0x1595e8;})[_0x2682('0x21')](respondWithFilteredResult(_0x2d0ab4,_0x2cd621))['catch'](handleError(_0x2d0ab4,null));};exports[_0x2682('0x3c')]=function(_0x5de298,_0x2c5747){var _0x15209f={'raw':![],'where':{'id':_0x5de298[_0x2682('0x3d')]['id']}},_0x2cdd0c={};_0x2cdd0c[_0x2682('0x2b')]=_[_0x2682('0x3e')](db['IntegrationReport'][_0x2682('0x3f')]);_0x2cdd0c[_0x2682('0x2c')]=_[_0x2682('0x3e')](_0x5de298['query']);_0x2cdd0c[_0x2682('0x2d')]=_[_0x2682('0x40')](_0x2cdd0c['model'],_0x2cdd0c[_0x2682('0x2c')]);_0x15209f[_0x2682('0x2e')]=_[_0x2682('0x40')](_0x2cdd0c['model'],qs[_0x2682('0x2f')](_0x5de298[_0x2682('0x2c')][_0x2682('0x2f')]));_0x15209f[_0x2682('0x2e')]=_0x15209f[_0x2682('0x2e')][_0x2682('0x41')]?_0x15209f[_0x2682('0x2e')]:_0x2cdd0c[_0x2682('0x2b')];if(_0x5de298[_0x2682('0x2c')][_0x2682('0x39')]){_0x15209f['include']=[{'all':!![]}];}_0x15209f=_[_0x2682('0x36')]({},_0x15209f,_0x5de298['options']);return db[_0x2682('0x38')][_0x2682('0x42')](_0x15209f)['then'](handleEntityNotFound(_0x2c5747,null))[_0x2682('0x21')](respondWithResult(_0x2c5747,null))[_0x2682('0x43')](handleError(_0x2c5747,null));};exports['create']=function(_0x143c0e,_0x3703f6){return db[_0x2682('0x38')][_0x2682('0x44')](_0x143c0e['body'],{})[_0x2682('0x21')](respondWithResult(_0x3703f6,0xc9))['catch'](handleError(_0x3703f6,null));};exports['update']=function(_0x26f3dd,_0x5b9fec){if(_0x26f3dd[_0x2682('0x45')]['id']){delete _0x26f3dd[_0x2682('0x45')]['id'];}return db[_0x2682('0x38')]['find']({'where':{'id':_0x26f3dd[_0x2682('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b9fec,null))[_0x2682('0x21')](saveUpdates(_0x26f3dd[_0x2682('0x45')],null))[_0x2682('0x21')](respondWithResult(_0x5b9fec,null))[_0x2682('0x43')](handleError(_0x5b9fec,null));};exports['destroy']=function(_0x37ee8c,_0x4a35c2){return db[_0x2682('0x38')][_0x2682('0x42')]({'where':{'id':_0x37ee8c[_0x2682('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4a35c2,null))[_0x2682('0x21')](removeEntity(_0x4a35c2,null))[_0x2682('0x43')](handleError(_0x4a35c2,null));};exports[_0x2682('0x46')]=function(_0x2f3f9a,_0x55b5c2){return db[_0x2682('0x38')]['describe']()[_0x2682('0x21')](respondWithResult(_0x55b5c2,null))[_0x2682('0x43')](handleError(_0x55b5c2,null));}; \ No newline at end of file +var _0x9ddd=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','catch','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x19a02d,_0x508a15){var _0x2eff26=function(_0x4caab2){while(--_0x4caab2){_0x19a02d['push'](_0x19a02d['shift']());}};_0x2eff26(++_0x508a15);}(_0x9ddd,0x112));var _0xd9dd=function(_0x28d12b,_0x1a1f6f){_0x28d12b=_0x28d12b-0x0;var _0x1d58f0=_0x9ddd[_0x28d12b];return _0x1d58f0;};'use strict';var emlformat=require(_0xd9dd('0x0'));var rimraf=require(_0xd9dd('0x1'));var zipdir=require(_0xd9dd('0x2'));var jsonpatch=require(_0xd9dd('0x3'));var rp=require(_0xd9dd('0x4'));var moment=require(_0xd9dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9dd('0x6'));var util=require(_0xd9dd('0x7'));var path=require(_0xd9dd('0x8'));var sox=require(_0xd9dd('0x9'));var csv=require(_0xd9dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9dd('0xb'));var squel=require(_0xd9dd('0xc'));var crypto=require(_0xd9dd('0xd'));var jsforce=require(_0xd9dd('0xe'));var deskjs=require(_0xd9dd('0xf'));var toCsv=require(_0xd9dd('0xa'));var querystring=require(_0xd9dd('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9dd('0x11'));var authService=require(_0xd9dd('0x12'));var qs=require(_0xd9dd('0x13'));var as=require(_0xd9dd('0x14'));var hardwareService=require(_0xd9dd('0x15'));var logger=require(_0xd9dd('0x16'))(_0xd9dd('0x17'));var utils=require(_0xd9dd('0x18'));var config=require(_0xd9dd('0x19'));var licenseUtil=require(_0xd9dd('0x1a'));var db=require(_0xd9dd('0x1b'))['db'];function respondWithStatusCode(_0x5c4e53,_0x1929a4){_0x1929a4=_0x1929a4||0xcc;return function(_0x387ee1){if(_0x387ee1){return _0x5c4e53[_0xd9dd('0x1c')](_0x1929a4);}return _0x5c4e53[_0xd9dd('0x1d')](_0x1929a4)[_0xd9dd('0x1e')]();};}function respondWithResult(_0x3b159e,_0x185783){_0x185783=_0x185783||0xc8;return function(_0xc9c686){if(_0xc9c686){return _0x3b159e['status'](_0x185783)[_0xd9dd('0x1f')](_0xc9c686);}};}function respondWithFilteredResult(_0x4c1bfa,_0x596973){return function(_0xbedf08){if(_0xbedf08){var _0x1c6150=typeof _0x596973[_0xd9dd('0x20')]===_0xd9dd('0x21')&&typeof _0x596973[_0xd9dd('0x22')]===_0xd9dd('0x21');var _0x393aba=_0xbedf08[_0xd9dd('0x23')];var _0x25d2c7=_0x1c6150?0x0:_0x596973['offset'];var _0xd206fd=_0x1c6150?_0xbedf08[_0xd9dd('0x23')]:_0x596973[_0xd9dd('0x20')]+_0x596973[_0xd9dd('0x22')];var _0x54fb06;if(_0xd206fd>=_0x393aba){_0xd206fd=_0x393aba;_0x54fb06=0xc8;}else{_0x54fb06=0xce;}_0x4c1bfa[_0xd9dd('0x1d')](_0x54fb06);return _0x4c1bfa['set']('Content-Range',_0x25d2c7+'-'+_0xd206fd+'/'+_0x393aba)[_0xd9dd('0x1f')](_0xbedf08);}return null;};}function patchUpdates(_0x304f2b){return function(_0x2f1cc5){try{jsonpatch[_0xd9dd('0x24')](_0x2f1cc5,_0x304f2b,!![]);}catch(_0x5b3fe9){return BPromise[_0xd9dd('0x25')](_0x5b3fe9);}return _0x2f1cc5['save']();};}function saveUpdates(_0x1557cb,_0x548020){return function(_0x51f683){if(_0x51f683){return _0x51f683[_0xd9dd('0x26')](_0x1557cb)['then'](function(_0x1ee8be){return _0x1ee8be;});}return null;};}function removeEntity(_0x4aef55,_0x376d31){return function(_0x43fb2d){if(_0x43fb2d){return _0x43fb2d[_0xd9dd('0x27')]()[_0xd9dd('0x28')](function(){_0x4aef55[_0xd9dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe6de,_0x44a104){return function(_0x2987d3){if(!_0x2987d3){_0x3fe6de['sendStatus'](0x194);}return _0x2987d3;};}function handleError(_0x4e0b9a,_0xb4a027){_0xb4a027=_0xb4a027||0x1f4;return function(_0x39db8c){logger[_0xd9dd('0x29')](_0x39db8c[_0xd9dd('0x2a')]);if(_0x39db8c[_0xd9dd('0x2b')]){delete _0x39db8c[_0xd9dd('0x2b')];}_0x4e0b9a[_0xd9dd('0x1d')](_0xb4a027)[_0xd9dd('0x2c')](_0x39db8c);};}exports['index']=function(_0x436f0a,_0x32de9c){var _0x356c43={},_0x721c18={},_0x5e3ec0={'count':0x0,'rows':[]};var _0x2fc2a5=_[_0xd9dd('0x2d')](db[_0xd9dd('0x2e')][_0xd9dd('0x2f')],function(_0x409050){return{'name':_0x409050[_0xd9dd('0x30')],'type':_0x409050[_0xd9dd('0x31')][_0xd9dd('0x32')]};});_0x721c18[_0xd9dd('0x33')]=_[_0xd9dd('0x2d')](_0x2fc2a5,_0xd9dd('0x2b'));_0x721c18[_0xd9dd('0x34')]=_[_0xd9dd('0x35')](_0x436f0a['query']);_0x721c18['filters']=_[_0xd9dd('0x36')](_0x721c18[_0xd9dd('0x33')],_0x721c18[_0xd9dd('0x34')]);_0x356c43[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x721c18['model'],qs['fields'](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x38')]));_0x356c43[_0xd9dd('0x37')]=_0x356c43[_0xd9dd('0x37')]['length']?_0x356c43[_0xd9dd('0x37')]:_0x721c18[_0xd9dd('0x33')];if(!_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x39')](_0xd9dd('0x3a'))){_0x356c43['limit']=qs[_0xd9dd('0x22')](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x22')]);_0x356c43[_0xd9dd('0x20')]=qs['offset'](_0x436f0a['query'][_0xd9dd('0x20')]);}_0x356c43[_0xd9dd('0x3b')]=qs[_0xd9dd('0x3c')](_0x436f0a[_0xd9dd('0x34')][_0xd9dd('0x3c')]);_0x356c43[_0xd9dd('0x3d')]=qs[_0xd9dd('0x3e')](_['pick'](_0x436f0a[_0xd9dd('0x34')],_0x721c18[_0xd9dd('0x3e')]),_0x2fc2a5);if(_0x436f0a['query']['filter']){_0x356c43[_0xd9dd('0x3d')]=_['merge'](_0x356c43[_0xd9dd('0x3d')],{'$or':_[_0xd9dd('0x2d')](_0x2fc2a5,function(_0xa91a7d){if(_0xa91a7d[_0xd9dd('0x31')]!==_0xd9dd('0x3f')){var _0x3f3776={};_0x3f3776[_0xa91a7d[_0xd9dd('0x2b')]]={'$like':'%'+_0x436f0a[_0xd9dd('0x34')]['filter']+'%'};return _0x3f3776;}})});}_0x356c43=_[_0xd9dd('0x40')]({},_0x356c43,_0x436f0a[_0xd9dd('0x41')]);var _0xace3b9={'where':_0x356c43[_0xd9dd('0x3d')]};return db[_0xd9dd('0x2e')][_0xd9dd('0x23')](_0xace3b9)[_0xd9dd('0x28')](function(_0x5954e0){_0x5e3ec0[_0xd9dd('0x23')]=_0x5954e0;if(_0x436f0a[_0xd9dd('0x34')]['includeAll']){_0x356c43['include']=[{'all':!![]}];}return db[_0xd9dd('0x2e')]['findAll'](_0x356c43);})[_0xd9dd('0x28')](function(_0x3626b9){_0x5e3ec0['rows']=_0x3626b9;return _0x5e3ec0;})[_0xd9dd('0x28')](respondWithFilteredResult(_0x32de9c,_0x356c43))[_0xd9dd('0x42')](handleError(_0x32de9c,null));};exports['show']=function(_0x42b0e8,_0x401739){var _0x4835ea={'raw':![],'where':{'id':_0x42b0e8[_0xd9dd('0x43')]['id']}},_0x17f27b={};_0x17f27b[_0xd9dd('0x33')]=_['keys'](db[_0xd9dd('0x2e')][_0xd9dd('0x2f')]);_0x17f27b['query']=_['keys'](_0x42b0e8['query']);_0x17f27b['filters']=_[_0xd9dd('0x36')](_0x17f27b[_0xd9dd('0x33')],_0x17f27b['query']);_0x4835ea[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x17f27b[_0xd9dd('0x33')],qs[_0xd9dd('0x38')](_0x42b0e8[_0xd9dd('0x34')]['fields']));_0x4835ea['attributes']=_0x4835ea['attributes']['length']?_0x4835ea['attributes']:_0x17f27b[_0xd9dd('0x33')];if(_0x42b0e8[_0xd9dd('0x34')][_0xd9dd('0x44')]){_0x4835ea[_0xd9dd('0x45')]=[{'all':!![]}];}_0x4835ea=_['merge']({},_0x4835ea,_0x42b0e8[_0xd9dd('0x41')]);return db[_0xd9dd('0x2e')][_0xd9dd('0x46')](_0x4835ea)[_0xd9dd('0x28')](handleEntityNotFound(_0x401739,null))['then'](respondWithResult(_0x401739,null))[_0xd9dd('0x42')](handleError(_0x401739,null));};exports[_0xd9dd('0x47')]=function(_0x1e3713,_0x5520a3){return db[_0xd9dd('0x2e')][_0xd9dd('0x47')](_0x1e3713['body'],{})[_0xd9dd('0x28')](respondWithResult(_0x5520a3,0xc9))[_0xd9dd('0x42')](handleError(_0x5520a3,null));};exports[_0xd9dd('0x26')]=function(_0x4a17a7,_0x1e9709){if(_0x4a17a7[_0xd9dd('0x48')]['id']){delete _0x4a17a7[_0xd9dd('0x48')]['id'];}return db['IntegrationReport'][_0xd9dd('0x46')]({'where':{'id':_0x4a17a7[_0xd9dd('0x43')]['id']}})[_0xd9dd('0x28')](handleEntityNotFound(_0x1e9709,null))[_0xd9dd('0x28')](saveUpdates(_0x4a17a7['body'],null))[_0xd9dd('0x28')](respondWithResult(_0x1e9709,null))[_0xd9dd('0x42')](handleError(_0x1e9709,null));};exports[_0xd9dd('0x27')]=function(_0x577fd3,_0x3506a2){return db['IntegrationReport'][_0xd9dd('0x46')]({'where':{'id':_0x577fd3['params']['id']}})['then'](handleEntityNotFound(_0x3506a2,null))[_0xd9dd('0x28')](removeEntity(_0x3506a2,null))[_0xd9dd('0x42')](handleError(_0x3506a2,null));};exports[_0xd9dd('0x49')]=function(_0x2e29c3,_0x5ebf07){return db[_0xd9dd('0x2e')][_0xd9dd('0x49')]()[_0xd9dd('0x28')](respondWithResult(_0x5ebf07,null))[_0xd9dd('0x42')](handleError(_0x5ebf07,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1290f61..69325eb 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 _0xc0dd=['./integrationReport.attributes','define','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a58db,_0x2d7f41){var _0x42dd9a=function(_0x52d814){while(--_0x52d814){_0x5a58db['push'](_0x5a58db['shift']());}};_0x42dd9a(++_0x2d7f41);}(_0xc0dd,0x13b));var _0xdc0d=function(_0x312d70,_0x11418f){_0x312d70=_0x312d70-0x0;var _0x3a39a4=_0xc0dd[_0x312d70];return _0x3a39a4;};'use strict';var _=require(_0xdc0d('0x0'));var util=require(_0xdc0d('0x1'));var logger=require(_0xdc0d('0x2'))(_0xdc0d('0x3'));var moment=require(_0xdc0d('0x4'));var BPromise=require(_0xdc0d('0x5'));var rp=require(_0xdc0d('0x6'));var fs=require('fs');var path=require(_0xdc0d('0x7'));var rimraf=require(_0xdc0d('0x8'));var config=require('../../config/environment');var attributes=require(_0xdc0d('0x9'));module['exports']=function(_0x6eeaf0,_0x25ec50){return _0x6eeaf0[_0xdc0d('0xa')]('IntegrationReport',attributes,{'tableName':_0xdc0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12cc=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x4a2217,_0x9c653a){var _0x24cb1c=function(_0x35155e){while(--_0x35155e){_0x4a2217['push'](_0x4a2217['shift']());}};_0x24cb1c(++_0x9c653a);}(_0x12cc,0x185));var _0xc12c=function(_0x3e6006,_0x58c01c){_0x3e6006=_0x3e6006-0x0;var _0x357adc=_0x12cc[_0x3e6006];return _0x357adc;};'use strict';var _=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var logger=require(_0xc12c('0x2'))('api');var moment=require(_0xc12c('0x3'));var BPromise=require(_0xc12c('0x4'));var rp=require(_0xc12c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc12c('0x6'));var config=require(_0xc12c('0x7'));var attributes=require(_0xc12c('0x8'));module[_0xc12c('0x9')]=function(_0x77e24f,_0x3c2fc9){return _0x77e24f[_0xc12c('0xa')](_0xc12c('0xb'),attributes,{'tableName':_0xc12c('0xc'),'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 2976679..157792d 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\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(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x1967,0x173));var _0x7196=function(_0x4e0b4c,_0x4c3021){_0x4e0b4c=_0x4e0b4c-0x0;var _0x1e75cd=_0x1967[_0x4e0b4c];return _0x1e75cd;};'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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4975,0x86));var _0x5497=function(_0x27513e,_0x4b06fa){_0x27513e=_0x27513e-0x0;var _0x3885eb=_0x4975[_0x27513e];return _0x3885eb;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 0b5e838..af647a0 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 _0xb3f9=['show','getIntervals','isAuthenticated','create','post','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id'];(function(_0x647948,_0x84d06c){var _0x457d30=function(_0x29b574){while(--_0x29b574){_0x647948['push'](_0x647948['shift']());}};_0x457d30(++_0x84d06c);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x3e92a3,_0x17e10c){_0x3e92a3=_0x3e92a3-0x0;var _0x1d1a6d=_0xb3f9[_0x3e92a3];return _0x1d1a6d;};'use strict';var multer=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b3f('0x2'));var router=express['Router']();var fs_extra=require(_0x9b3f('0x3'));var auth=require(_0x9b3f('0x4'));var interaction=require(_0x9b3f('0x5'));var config=require(_0x9b3f('0x6'));var controller=require(_0x9b3f('0x7'));router[_0x9b3f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9b3f('0x8')](_0x9b3f('0x9'),auth['isAuthenticated'](),controller[_0x9b3f('0xa')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x9b3f('0xb')]);router['post']('/',auth[_0x9b3f('0xc')](),controller[_0x9b3f('0xd')]);router[_0x9b3f('0xe')](_0x9b3f('0xf'),auth[_0x9b3f('0xc')](),controller['addInterval']);router[_0x9b3f('0xe')](_0x9b3f('0x10'),auth[_0x9b3f('0xc')](),controller[_0x9b3f('0x11')]);router[_0x9b3f('0x12')](_0x9b3f('0x9'),auth[_0x9b3f('0xc')](),controller[_0x9b3f('0x13')]);router['delete']('/:id',auth[_0x9b3f('0xc')](),controller[_0x9b3f('0x14')]);module[_0x9b3f('0x15')]=router; \ No newline at end of file +var _0x081c=['post','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','exports','multer','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create'];(function(_0x30fe45,_0x3e20c8){var _0x1f7420=function(_0x406220){while(--_0x406220){_0x30fe45['push'](_0x30fe45['shift']());}};_0x1f7420(++_0x3e20c8);}(_0x081c,0xeb));var _0xc081=function(_0x35a329,_0x488fee){_0x35a329=_0x35a329-0x0;var _0x4cbdb1=_0x081c[_0x35a329];return _0x4cbdb1;};'use strict';var multer=require(_0xc081('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc081('0x1')]();var fs_extra=require(_0xc081('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc081('0x3'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0xc081('0x4')]('/',auth[_0xc081('0x5')](),controller[_0xc081('0x6')]);router['get'](_0xc081('0x7'),auth['isAuthenticated'](),controller[_0xc081('0x8')]);router['get'](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xa')]);router['post']('/',auth[_0xc081('0x5')](),controller[_0xc081('0xb')]);router[_0xc081('0xc')](_0xc081('0x9'),auth['isAuthenticated'](),controller[_0xc081('0xd')]);router[_0xc081('0xc')](_0xc081('0xe'),auth[_0xc081('0x5')](),controller[_0xc081('0xf')]);router['put'](_0xc081('0x7'),auth[_0xc081('0x5')](),controller[_0xc081('0x10')]);router[_0xc081('0x11')](_0xc081('0x7'),auth[_0xc081('0x5')](),controller['destroy']);module[_0xc081('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 61b35ee..4f105bb 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 _0x59d9=['sequelize','exports','STRING'];(function(_0x27e845,_0x9bf2f4){var _0x1026e8=function(_0x3f17b8){while(--_0x3f17b8){_0x27e845['push'](_0x27e845['shift']());}};_0x1026e8(++_0x9bf2f4);}(_0x59d9,0xe4));var _0x959d=function(_0x2c3677,_0x4cbca1){_0x2c3677=_0x2c3677-0x0;var _0x21740d=_0x59d9[_0x2c3677];return _0x21740d;};'use strict';var Sequelize=require(_0x959d('0x0'));module[_0x959d('0x1')]={'name':{'type':Sequelize[_0x959d('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x959d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4b08=['STRING','sequelize'];(function(_0x4aa2c9,_0x3c74e5){var _0x212e33=function(_0x20f06a){while(--_0x20f06a){_0x4aa2c9['push'](_0x4aa2c9['shift']());}};_0x212e33(++_0x3c74e5);}(_0x4b08,0xdf));var _0x84b0=function(_0x4ae731,_0xf75b7f){_0x4ae731=_0x4ae731-0x0;var _0x587df0=_0x4b08[_0x4ae731];return _0x587df0;};'use strict';var Sequelize=require(_0x84b0('0x0'));module['exports']={'name':{'type':Sequelize[_0x84b0('0x1')]},'description':{'type':Sequelize[_0x84b0('0x1')]},'interval':{'type':Sequelize[_0x84b0('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0393610..c3c8376 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 _0x1a6c=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','Intervals','destroy','stack','name','index','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3494ee,_0x7b1b9a){var _0x12b115=function(_0x25e4c6){while(--_0x25e4c6){_0x3494ee['push'](_0x3494ee['shift']());}};_0x12b115(++_0x7b1b9a);}(_0x1a6c,0x19e));var _0xc1a6=function(_0x4a7ccf,_0x388516){_0x4a7ccf=_0x4a7ccf-0x0;var _0x4afc60=_0x1a6c[_0x4a7ccf];return _0x4afc60;};'use strict';var emlformat=require(_0xc1a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1a6('0x1'));var jsonpatch=require(_0xc1a6('0x2'));var rp=require(_0xc1a6('0x3'));var moment=require(_0xc1a6('0x4'));var BPromise=require(_0xc1a6('0x5'));var Mustache=require(_0xc1a6('0x6'));var util=require(_0xc1a6('0x7'));var path=require(_0xc1a6('0x8'));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(_0xc1a6('0x9'));var squel=require(_0xc1a6('0xa'));var crypto=require(_0xc1a6('0xb'));var jsforce=require(_0xc1a6('0xc'));var deskjs=require(_0xc1a6('0xd'));var toCsv=require(_0xc1a6('0xe'));var querystring=require(_0xc1a6('0xf'));var Papa=require(_0xc1a6('0x10'));var Redis=require(_0xc1a6('0x11'));var authService=require(_0xc1a6('0x12'));var qs=require(_0xc1a6('0x13'));var as=require(_0xc1a6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1a6('0x15'))(_0xc1a6('0x16'));var utils=require(_0xc1a6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1a6('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2ae7d3,_0x1cd704){_0x1cd704=_0x1cd704||0xcc;return function(_0x5003a0){if(_0x5003a0){return _0x2ae7d3[_0xc1a6('0x19')](_0x1cd704);}return _0x2ae7d3['status'](_0x1cd704)[_0xc1a6('0x1a')]();};}function respondWithResult(_0x1b6397,_0x2b5b39){_0x2b5b39=_0x2b5b39||0xc8;return function(_0x2566c4){if(_0x2566c4){return _0x1b6397[_0xc1a6('0x1b')](_0x2b5b39)[_0xc1a6('0x1c')](_0x2566c4);}};}function respondWithFilteredResult(_0x515746,_0x2c2618){return function(_0x4b83b8){if(_0x4b83b8){var _0x19674b=typeof _0x2c2618[_0xc1a6('0x1d')]===_0xc1a6('0x1e')&&typeof _0x2c2618[_0xc1a6('0x1f')]===_0xc1a6('0x1e');var _0x2c21e4=_0x4b83b8[_0xc1a6('0x20')];var _0x38b3e0=_0x19674b?0x0:_0x2c2618[_0xc1a6('0x1d')];var _0x3b0466=_0x19674b?_0x4b83b8[_0xc1a6('0x20')]:_0x2c2618[_0xc1a6('0x1d')]+_0x2c2618[_0xc1a6('0x1f')];var _0x484dcb;if(_0x3b0466>=_0x2c21e4){_0x3b0466=_0x2c21e4;_0x484dcb=0xc8;}else{_0x484dcb=0xce;}_0x515746[_0xc1a6('0x1b')](_0x484dcb);return _0x515746[_0xc1a6('0x21')](_0xc1a6('0x22'),_0x38b3e0+'-'+_0x3b0466+'/'+_0x2c21e4)['json'](_0x4b83b8);}return null;};}function patchUpdates(_0x84bb46){return function(_0x2104ab){try{jsonpatch['apply'](_0x2104ab,_0x84bb46,!![]);}catch(_0x4ac16f){return BPromise['reject'](_0x4ac16f);}return _0x2104ab[_0xc1a6('0x23')]();};}function saveUpdates(_0x2109ce,_0x51c36d){return function(_0x205db4){if(_0x205db4){return _0x205db4[_0xc1a6('0x24')](_0x2109ce)[_0xc1a6('0x25')](function(_0x1a67fb){return _0x1a67fb;});}return null;};}function removeEntity(_0x35ccd5,_0x338806){return function(_0x232562){if(_0x232562){return _0x232562['destroy']()['then'](function(){var _0x43834c=_0x232562[_0xc1a6('0x26')]({'plain':!![]});var _0x269888=_0xc1a6('0x27');return db['UserProfileResource'][_0xc1a6('0x28')]({'where':{'type':_0x269888,'resourceId':_0x43834c['id']}})['then'](function(){return _0x232562;});})[_0xc1a6('0x25')](function(){_0x35ccd5[_0xc1a6('0x1b')](0xcc)[_0xc1a6('0x1a')]();});}};}function handleEntityNotFound(_0xd515b,_0x1762a3){return function(_0x2219cb){if(!_0x2219cb){_0xd515b[_0xc1a6('0x19')](0x194);}return _0x2219cb;};}function handleError(_0x394479,_0x34256f){_0x34256f=_0x34256f||0x1f4;return function(_0x3b37bd){logger['error'](_0x3b37bd[_0xc1a6('0x29')]);if(_0x3b37bd[_0xc1a6('0x2a')]){delete _0x3b37bd['name'];}_0x394479['status'](_0x34256f)['send'](_0x3b37bd);};}exports[_0xc1a6('0x2b')]=function(_0x12e438,_0x9a154b){var _0x53debe={},_0x22d075={},_0x14c8b7={'count':0x0,'rows':[]};var _0x5e035e=_['map'](db[_0xc1a6('0x2c')][_0xc1a6('0x2d')],function(_0x1665af){return{'name':_0x1665af[_0xc1a6('0x2e')],'type':_0x1665af[_0xc1a6('0x2f')]['key']};});_0x22d075[_0xc1a6('0x30')]=_['map'](_0x5e035e,_0xc1a6('0x2a'));_0x22d075[_0xc1a6('0x31')]=_[_0xc1a6('0x32')](_0x12e438[_0xc1a6('0x31')]);_0x22d075[_0xc1a6('0x33')]=_[_0xc1a6('0x34')](_0x22d075[_0xc1a6('0x30')],_0x22d075[_0xc1a6('0x31')]);_0x53debe[_0xc1a6('0x35')]=_[_0xc1a6('0x34')](_0x22d075[_0xc1a6('0x30')],qs['fields'](_0x12e438[_0xc1a6('0x31')][_0xc1a6('0x36')]));_0x53debe[_0xc1a6('0x35')]=_0x53debe[_0xc1a6('0x35')][_0xc1a6('0x37')]?_0x53debe[_0xc1a6('0x35')]:_0x22d075[_0xc1a6('0x30')];if(!_0x12e438['query'][_0xc1a6('0x38')](_0xc1a6('0x39'))){_0x53debe[_0xc1a6('0x1f')]=qs[_0xc1a6('0x1f')](_0x12e438[_0xc1a6('0x31')][_0xc1a6('0x1f')]);_0x53debe[_0xc1a6('0x1d')]=qs[_0xc1a6('0x1d')](_0x12e438[_0xc1a6('0x31')][_0xc1a6('0x1d')]);}_0x53debe[_0xc1a6('0x3a')]=qs[_0xc1a6('0x3b')](_0x12e438['query'][_0xc1a6('0x3b')]);_0x53debe[_0xc1a6('0x3c')]=qs['filters'](_[_0xc1a6('0x3d')](_0x12e438[_0xc1a6('0x31')],_0x22d075['filters']),_0x5e035e);if(_0x12e438['query'][_0xc1a6('0x3e')]){_0x53debe[_0xc1a6('0x3c')]=_[_0xc1a6('0x3f')](_0x53debe['where'],{'$or':_[_0xc1a6('0x40')](_0x5e035e,function(_0x54b58a){if(_0x54b58a[_0xc1a6('0x2f')]!=='VIRTUAL'){var _0x2009db={};_0x2009db[_0x54b58a[_0xc1a6('0x2a')]]={'$like':'%'+_0x12e438['query'][_0xc1a6('0x3e')]+'%'};return _0x2009db;}})});}_0x53debe=_[_0xc1a6('0x3f')]({},_0x53debe,_0x12e438['options']);var _0xb53079={'where':_0x53debe[_0xc1a6('0x3c')]};return db['Interval'][_0xc1a6('0x20')](_0xb53079)[_0xc1a6('0x25')](function(_0x226465){_0x14c8b7[_0xc1a6('0x20')]=_0x226465;if(_0x12e438[_0xc1a6('0x31')][_0xc1a6('0x41')]){_0x53debe[_0xc1a6('0x42')]=[{'all':!![]}];}return db[_0xc1a6('0x2c')]['findAll'](_0x53debe);})[_0xc1a6('0x25')](function(_0xce5ee2){_0x14c8b7[_0xc1a6('0x43')]=_0xce5ee2;return _0x14c8b7;})[_0xc1a6('0x25')](respondWithFilteredResult(_0x9a154b,_0x53debe))[_0xc1a6('0x44')](handleError(_0x9a154b,null));};exports['show']=function(_0x5df748,_0x1da96d){var _0x384ca={'raw':!![],'where':{'id':_0x5df748[_0xc1a6('0x45')]['id']}},_0x23e8e9={};_0x23e8e9['model']=_[_0xc1a6('0x32')](db[_0xc1a6('0x2c')][_0xc1a6('0x2d')]);_0x23e8e9[_0xc1a6('0x31')]=_[_0xc1a6('0x32')](_0x5df748['query']);_0x23e8e9[_0xc1a6('0x33')]=_['intersection'](_0x23e8e9[_0xc1a6('0x30')],_0x23e8e9[_0xc1a6('0x31')]);_0x384ca[_0xc1a6('0x35')]=_[_0xc1a6('0x34')](_0x23e8e9[_0xc1a6('0x30')],qs[_0xc1a6('0x36')](_0x5df748[_0xc1a6('0x31')][_0xc1a6('0x36')]));_0x384ca[_0xc1a6('0x35')]=_0x384ca['attributes'][_0xc1a6('0x37')]?_0x384ca[_0xc1a6('0x35')]:_0x23e8e9[_0xc1a6('0x30')];if(_0x5df748[_0xc1a6('0x31')][_0xc1a6('0x41')]){_0x384ca['include']=[{'all':!![]}];}_0x384ca=_['merge']({},_0x384ca,_0x5df748[_0xc1a6('0x46')]);return db[_0xc1a6('0x2c')][_0xc1a6('0x47')](_0x384ca)[_0xc1a6('0x25')](handleEntityNotFound(_0x1da96d,null))['then'](respondWithResult(_0x1da96d,null))[_0xc1a6('0x44')](handleError(_0x1da96d,null));};exports['create']=function(_0x186fc4,_0xbbb673){return db[_0xc1a6('0x2c')][_0xc1a6('0x48')](_0x186fc4['body'],{})[_0xc1a6('0x25')](function(_0x2cb0bf){var _0x109089=_0x186fc4[_0xc1a6('0x49')][_0xc1a6('0x26')]({'plain':!![]});if(!_0x109089)throw new Error(_0xc1a6('0x4a'));if(_0x109089[_0xc1a6('0x4b')]===_0xc1a6('0x49')){var _0xb5be9=_0x2cb0bf[_0xc1a6('0x26')]({'plain':!![]});var _0x5c4fca=_0xc1a6('0x27');return db[_0xc1a6('0x4c')][_0xc1a6('0x47')]({'where':{'name':_0x5c4fca,'userProfileId':_0x109089['userProfileId']},'raw':!![]})[_0xc1a6('0x25')](function(_0x583cf9){if(_0x583cf9&&_0x583cf9['autoAssociation']===0x0){return db[_0xc1a6('0x4d')][_0xc1a6('0x48')]({'name':_0xb5be9['name'],'resourceId':_0xb5be9['id'],'type':_0x583cf9[_0xc1a6('0x2a')],'sectionId':_0x583cf9['id']},{})[_0xc1a6('0x25')](function(){return _0x2cb0bf;});}else{return _0x2cb0bf;}})[_0xc1a6('0x44')](function(_0xd16b75){logger['error'](_0xc1a6('0x4e'),_0xd16b75);throw _0xd16b75;});}return _0x2cb0bf;})[_0xc1a6('0x25')](respondWithResult(_0xbbb673,0xc9))[_0xc1a6('0x44')](handleError(_0xbbb673,null));};exports[_0xc1a6('0x24')]=function(_0x593c4a,_0x21e33c){if(_0x593c4a[_0xc1a6('0x4f')]['id']){delete _0x593c4a['body']['id'];}return db[_0xc1a6('0x2c')][_0xc1a6('0x47')]({'where':{'id':_0x593c4a[_0xc1a6('0x45')]['id']}})[_0xc1a6('0x25')](handleEntityNotFound(_0x21e33c,null))[_0xc1a6('0x25')](saveUpdates(_0x593c4a['body'],null))[_0xc1a6('0x25')](respondWithResult(_0x21e33c,null))[_0xc1a6('0x44')](handleError(_0x21e33c,null));};exports['destroy']=function(_0x3da2db,_0x3a560b){return db['Interval']['find']({'where':{'id':_0x3da2db[_0xc1a6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a560b,null))['then'](removeEntity(_0x3a560b,null))['catch'](handleError(_0x3a560b,null));};exports['addInterval']=function(_0x1e6df4,_0x3203e2,_0x5b91e8){if(_0x1e6df4[_0xc1a6('0x4f')]['id']){delete _0x1e6df4[_0xc1a6('0x4f')]['id'];}return db[_0xc1a6('0x2c')]['find']({'where':{'id':_0x1e6df4[_0xc1a6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3203e2,null))[_0xc1a6('0x25')](function(_0x34daee){if(_0x34daee){_0x1e6df4[_0xc1a6('0x4f')][_0xc1a6('0x50')]=_0x34daee['id'];return db[_0xc1a6('0x2c')]['create'](_0x1e6df4['body']);}})['then'](respondWithResult(_0x3203e2,null))[_0xc1a6('0x44')](handleError(_0x3203e2,null));};exports[_0xc1a6('0x51')]=function(_0x34fb75,_0x35687b,_0x8d21f2){var _0x524c46={};var _0xf29265={};var _0x4f2fee;var _0x232150;return db[_0xc1a6('0x2c')][_0xc1a6('0x52')]({'where':{'id':_0x34fb75[_0xc1a6('0x45')]['id']}})[_0xc1a6('0x25')](handleEntityNotFound(_0x35687b,null))['then'](function(_0x2aad13){if(_0x2aad13){_0x4f2fee=_0x2aad13;_0xf29265['model']=_[_0xc1a6('0x32')](db[_0xc1a6('0x2c')][_0xc1a6('0x2d')]);_0xf29265[_0xc1a6('0x31')]=_[_0xc1a6('0x32')](_0x34fb75['query']);_0xf29265[_0xc1a6('0x33')]=_[_0xc1a6('0x34')](_0xf29265[_0xc1a6('0x30')],_0xf29265[_0xc1a6('0x31')]);_0x524c46[_0xc1a6('0x35')]=_[_0xc1a6('0x34')](_0xf29265[_0xc1a6('0x30')],qs['fields'](_0x34fb75['query']['fields']));_0x524c46[_0xc1a6('0x35')]=_0x524c46['attributes'][_0xc1a6('0x37')]?_0x524c46['attributes']:_0xf29265[_0xc1a6('0x30')];_0x524c46['order']=qs[_0xc1a6('0x3b')](_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x3b')]);_0x524c46[_0xc1a6('0x3c')]=qs[_0xc1a6('0x33')](_[_0xc1a6('0x3d')](_0x34fb75['query'],_0xf29265[_0xc1a6('0x33')]));if(_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x3e')]){_0x524c46['where']=_['merge'](_0x524c46[_0xc1a6('0x3c')],{'$or':_[_0xc1a6('0x40')](_0x524c46[_0xc1a6('0x35')],function(_0x32f437){var _0x4fa2dd={};_0x4fa2dd[_0x32f437]={'$like':'%'+_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x3e')]+'%'};return _0x4fa2dd;})});}_0x524c46=_['merge']({},_0x524c46,_0x34fb75['options']);return _0x4f2fee[_0xc1a6('0x51')](_0x524c46);}})[_0xc1a6('0x25')](function(_0x6db94a){if(_0x6db94a){_0x232150=_0x6db94a['length'];if(!_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x38')](_0xc1a6('0x39'))){_0x524c46[_0xc1a6('0x1f')]=qs[_0xc1a6('0x1f')](_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x1f')]);_0x524c46[_0xc1a6('0x1d')]=qs['offset'](_0x34fb75[_0xc1a6('0x31')][_0xc1a6('0x1d')]);}return _0x4f2fee[_0xc1a6('0x51')](_0x524c46);}})[_0xc1a6('0x25')](function(_0x5497c5){if(_0x5497c5){return _0x5497c5?{'count':_0x232150,'rows':_0x5497c5}:null;}})[_0xc1a6('0x25')](respondWithResult(_0x35687b,null))['catch'](handleError(_0x35687b,null));};exports['addIntervals']=function(_0x1aab2f,_0x4192ee,_0x5adf49){return db['Interval'][_0xc1a6('0x52')]({'where':{'id':_0x1aab2f[_0xc1a6('0x45')]['id']}})[_0xc1a6('0x25')](handleEntityNotFound(_0x4192ee,null))['then'](function(_0x1c848c){if(_0x1c848c){return db[_0xc1a6('0x53')][_0xc1a6('0x54')](function(_0x33afca){return db[_0xc1a6('0x2c')][_0xc1a6('0x28')]({'where':{'IntervalId':_0x1aab2f[_0xc1a6('0x45')]['id']},'transaction':_0x33afca})[_0xc1a6('0x25')](function(_0x210bac){var _0x5d6f2f=_[_0xc1a6('0x40')](_0x1aab2f[_0xc1a6('0x4f')],function(_0xf9dfea){delete _0xf9dfea['id'];_0xf9dfea[_0xc1a6('0x50')]=_0x1aab2f['params']['id'];return _0xf9dfea;});return db[_0xc1a6('0x2c')][_0xc1a6('0x55')](_0x5d6f2f,{'transaction':_0x33afca});});})[_0xc1a6('0x25')](function(){return db[_0xc1a6('0x2c')][_0xc1a6('0x56')]({'where':{'IntervalId':_0x1aab2f[_0xc1a6('0x45')]['id']}});});}})[_0xc1a6('0x25')](respondWithResult(_0x4192ee,null))[_0xc1a6('0x44')](handleError(_0x4192ee,null));}; \ No newline at end of file +var _0x41b4=['Content-Range','json','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','stack','name','send','index','map','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','options','Interval','include','findAll','catch','show','params','rawAttributes','keys','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x41b4,0x1d7));var _0x441b=function(_0x3c2d87,_0x623ad){_0x3c2d87=_0x3c2d87-0x0;var _0x142d3c=_0x41b4[_0x3c2d87];return _0x142d3c;};'use strict';var emlformat=require(_0x441b('0x0'));var rimraf=require(_0x441b('0x1'));var zipdir=require(_0x441b('0x2'));var jsonpatch=require(_0x441b('0x3'));var rp=require(_0x441b('0x4'));var moment=require('moment');var BPromise=require(_0x441b('0x5'));var Mustache=require(_0x441b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x441b('0x7'));var csv=require(_0x441b('0x8'));var ejs=require(_0x441b('0x9'));var fs=require('fs');var fs_extra=require(_0x441b('0xa'));var _=require('lodash');var squel=require(_0x441b('0xb'));var crypto=require(_0x441b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x441b('0xd'));var toCsv=require(_0x441b('0x8'));var querystring=require('querystring');var Papa=require(_0x441b('0xe'));var Redis=require(_0x441b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x441b('0x10'));var as=require(_0x441b('0x11'));var hardwareService=require(_0x441b('0x12'));var logger=require(_0x441b('0x13'))('api');var utils=require(_0x441b('0x14'));var config=require(_0x441b('0x15'));var licenseUtil=require(_0x441b('0x16'));var db=require(_0x441b('0x17'))['db'];var extensions=require(_0x441b('0x18'));function respondWithStatusCode(_0x414755,_0x510b4a){_0x510b4a=_0x510b4a||0xcc;return function(_0x582b94){if(_0x582b94){return _0x414755[_0x441b('0x19')](_0x510b4a);}return _0x414755[_0x441b('0x1a')](_0x510b4a)[_0x441b('0x1b')]();};}function respondWithResult(_0x4f548a,_0x564215){_0x564215=_0x564215||0xc8;return function(_0x3e2e0b){if(_0x3e2e0b){return _0x4f548a[_0x441b('0x1a')](_0x564215)['json'](_0x3e2e0b);}};}function respondWithFilteredResult(_0x3d1fd5,_0x405f47){return function(_0x42a7b3){if(_0x42a7b3){var _0x1586b6=typeof _0x405f47['offset']===_0x441b('0x1c')&&typeof _0x405f47[_0x441b('0x1d')]===_0x441b('0x1c');var _0xb31e8=_0x42a7b3['count'];var _0x219b4d=_0x1586b6?0x0:_0x405f47['offset'];var _0x4f7232=_0x1586b6?_0x42a7b3[_0x441b('0x1e')]:_0x405f47[_0x441b('0x1f')]+_0x405f47[_0x441b('0x1d')];var _0x5c2d8d;if(_0x4f7232>=_0xb31e8){_0x4f7232=_0xb31e8;_0x5c2d8d=0xc8;}else{_0x5c2d8d=0xce;}_0x3d1fd5[_0x441b('0x1a')](_0x5c2d8d);return _0x3d1fd5[_0x441b('0x20')](_0x441b('0x21'),_0x219b4d+'-'+_0x4f7232+'/'+_0xb31e8)[_0x441b('0x22')](_0x42a7b3);}return null;};}function patchUpdates(_0xe5e04c){return function(_0x5114bf){try{jsonpatch[_0x441b('0x23')](_0x5114bf,_0xe5e04c,!![]);}catch(_0x1797ef){return BPromise[_0x441b('0x24')](_0x1797ef);}return _0x5114bf[_0x441b('0x25')]();};}function saveUpdates(_0x3fb93b,_0x24e02e){return function(_0x2946fe){if(_0x2946fe){return _0x2946fe['update'](_0x3fb93b)[_0x441b('0x26')](function(_0x469ed9){return _0x469ed9;});}return null;};}function removeEntity(_0x3fd255,_0x317eaf){return function(_0x26c0c7){if(_0x26c0c7){return _0x26c0c7['destroy']()[_0x441b('0x26')](function(){var _0x2faa15=_0x26c0c7[_0x441b('0x27')]({'plain':!![]});var _0x35fdda=_0x441b('0x28');return db[_0x441b('0x29')][_0x441b('0x2a')]({'where':{'type':_0x35fdda,'resourceId':_0x2faa15['id']}})['then'](function(){return _0x26c0c7;});})[_0x441b('0x26')](function(){_0x3fd255['status'](0xcc)[_0x441b('0x1b')]();});}};}function handleEntityNotFound(_0x29b727,_0x5ac01f){return function(_0x14de54){if(!_0x14de54){_0x29b727['sendStatus'](0x194);}return _0x14de54;};}function handleError(_0x276e10,_0x5433cb){_0x5433cb=_0x5433cb||0x1f4;return function(_0x31849e){logger['error'](_0x31849e[_0x441b('0x2b')]);if(_0x31849e[_0x441b('0x2c')]){delete _0x31849e[_0x441b('0x2c')];}_0x276e10[_0x441b('0x1a')](_0x5433cb)[_0x441b('0x2d')](_0x31849e);};}exports[_0x441b('0x2e')]=function(_0x513ba6,_0x40eb5f){var _0x2519d1={},_0x4f576e={},_0x4750cd={'count':0x0,'rows':[]};var _0x2da1d3=_[_0x441b('0x2f')](db['Interval']['rawAttributes'],function(_0x194239){return{'name':_0x194239['fieldName'],'type':_0x194239[_0x441b('0x30')]['key']};});_0x4f576e[_0x441b('0x31')]=_[_0x441b('0x2f')](_0x2da1d3,'name');_0x4f576e[_0x441b('0x32')]=_['keys'](_0x513ba6[_0x441b('0x32')]);_0x4f576e[_0x441b('0x33')]=_[_0x441b('0x34')](_0x4f576e['model'],_0x4f576e['query']);_0x2519d1[_0x441b('0x35')]=_[_0x441b('0x34')](_0x4f576e[_0x441b('0x31')],qs[_0x441b('0x36')](_0x513ba6[_0x441b('0x32')][_0x441b('0x36')]));_0x2519d1['attributes']=_0x2519d1[_0x441b('0x35')][_0x441b('0x37')]?_0x2519d1[_0x441b('0x35')]:_0x4f576e[_0x441b('0x31')];if(!_0x513ba6[_0x441b('0x32')]['hasOwnProperty'](_0x441b('0x38'))){_0x2519d1[_0x441b('0x1d')]=qs['limit'](_0x513ba6['query'][_0x441b('0x1d')]);_0x2519d1[_0x441b('0x1f')]=qs[_0x441b('0x1f')](_0x513ba6[_0x441b('0x32')][_0x441b('0x1f')]);}_0x2519d1[_0x441b('0x39')]=qs[_0x441b('0x3a')](_0x513ba6[_0x441b('0x32')][_0x441b('0x3a')]);_0x2519d1[_0x441b('0x3b')]=qs['filters'](_['pick'](_0x513ba6['query'],_0x4f576e[_0x441b('0x33')]),_0x2da1d3);if(_0x513ba6['query']['filter']){_0x2519d1['where']=_['merge'](_0x2519d1['where'],{'$or':_[_0x441b('0x2f')](_0x2da1d3,function(_0x2d3639){if(_0x2d3639['type']!==_0x441b('0x3c')){var _0x322221={};_0x322221[_0x2d3639[_0x441b('0x2c')]]={'$like':'%'+_0x513ba6[_0x441b('0x32')][_0x441b('0x3d')]+'%'};return _0x322221;}})});}_0x2519d1=_['merge']({},_0x2519d1,_0x513ba6[_0x441b('0x3e')]);var _0x52d54b={'where':_0x2519d1['where']};return db[_0x441b('0x3f')]['count'](_0x52d54b)[_0x441b('0x26')](function(_0x1f08be){_0x4750cd[_0x441b('0x1e')]=_0x1f08be;if(_0x513ba6[_0x441b('0x32')]['includeAll']){_0x2519d1[_0x441b('0x40')]=[{'all':!![]}];}return db['Interval'][_0x441b('0x41')](_0x2519d1);})[_0x441b('0x26')](function(_0x11272c){_0x4750cd['rows']=_0x11272c;return _0x4750cd;})[_0x441b('0x26')](respondWithFilteredResult(_0x40eb5f,_0x2519d1))[_0x441b('0x42')](handleError(_0x40eb5f,null));};exports[_0x441b('0x43')]=function(_0x498553,_0x49624d){var _0x316303={'raw':!![],'where':{'id':_0x498553[_0x441b('0x44')]['id']}},_0x3a57c0={};_0x3a57c0[_0x441b('0x31')]=_['keys'](db[_0x441b('0x3f')][_0x441b('0x45')]);_0x3a57c0[_0x441b('0x32')]=_[_0x441b('0x46')](_0x498553[_0x441b('0x32')]);_0x3a57c0[_0x441b('0x33')]=_[_0x441b('0x34')](_0x3a57c0[_0x441b('0x31')],_0x3a57c0[_0x441b('0x32')]);_0x316303[_0x441b('0x35')]=_[_0x441b('0x34')](_0x3a57c0[_0x441b('0x31')],qs[_0x441b('0x36')](_0x498553[_0x441b('0x32')][_0x441b('0x36')]));_0x316303[_0x441b('0x35')]=_0x316303['attributes'][_0x441b('0x37')]?_0x316303[_0x441b('0x35')]:_0x3a57c0[_0x441b('0x31')];if(_0x498553[_0x441b('0x32')][_0x441b('0x47')]){_0x316303['include']=[{'all':!![]}];}_0x316303=_[_0x441b('0x48')]({},_0x316303,_0x498553['options']);return db['Interval'][_0x441b('0x49')](_0x316303)[_0x441b('0x26')](handleEntityNotFound(_0x49624d,null))[_0x441b('0x26')](respondWithResult(_0x49624d,null))[_0x441b('0x42')](handleError(_0x49624d,null));};exports[_0x441b('0x4a')]=function(_0x369dc0,_0x13068a){return db[_0x441b('0x3f')]['create'](_0x369dc0[_0x441b('0x4b')],{})[_0x441b('0x26')](function(_0x556e18){var _0x453be3=_0x369dc0['user'][_0x441b('0x27')]({'plain':!![]});if(!_0x453be3)throw new Error(_0x441b('0x4c'));if(_0x453be3['role']==='user'){var _0x3e6234=_0x556e18[_0x441b('0x27')]({'plain':!![]});var _0x1f0479='Intervals';return db['UserProfileSection'][_0x441b('0x49')]({'where':{'name':_0x1f0479,'userProfileId':_0x453be3['userProfileId']},'raw':!![]})['then'](function(_0x561cd4){if(_0x561cd4&&_0x561cd4['autoAssociation']===0x0){return db[_0x441b('0x29')]['create']({'name':_0x3e6234[_0x441b('0x2c')],'resourceId':_0x3e6234['id'],'type':_0x561cd4[_0x441b('0x2c')],'sectionId':_0x561cd4['id']},{})[_0x441b('0x26')](function(){return _0x556e18;});}else{return _0x556e18;}})['catch'](function(_0x81b59b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81b59b);throw _0x81b59b;});}return _0x556e18;})['then'](respondWithResult(_0x13068a,0xc9))[_0x441b('0x42')](handleError(_0x13068a,null));};exports['update']=function(_0x34fb30,_0x4111b7){if(_0x34fb30['body']['id']){delete _0x34fb30[_0x441b('0x4b')]['id'];}return db[_0x441b('0x3f')]['find']({'where':{'id':_0x34fb30[_0x441b('0x44')]['id']}})['then'](handleEntityNotFound(_0x4111b7,null))[_0x441b('0x26')](saveUpdates(_0x34fb30[_0x441b('0x4b')],null))[_0x441b('0x26')](respondWithResult(_0x4111b7,null))[_0x441b('0x42')](handleError(_0x4111b7,null));};exports[_0x441b('0x2a')]=function(_0x545d8d,_0x17aa44){return db['Interval'][_0x441b('0x49')]({'where':{'id':_0x545d8d[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0x17aa44,null))[_0x441b('0x26')](removeEntity(_0x17aa44,null))[_0x441b('0x42')](handleError(_0x17aa44,null));};exports[_0x441b('0x4d')]=function(_0x17cd39,_0x271b89,_0x3d4d97){if(_0x17cd39[_0x441b('0x4b')]['id']){delete _0x17cd39[_0x441b('0x4b')]['id'];}return db['Interval'][_0x441b('0x49')]({'where':{'id':_0x17cd39[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0x271b89,null))[_0x441b('0x26')](function(_0x3fa9d7){if(_0x3fa9d7){_0x17cd39[_0x441b('0x4b')][_0x441b('0x4e')]=_0x3fa9d7['id'];return db[_0x441b('0x3f')][_0x441b('0x4a')](_0x17cd39[_0x441b('0x4b')]);}})[_0x441b('0x26')](respondWithResult(_0x271b89,null))[_0x441b('0x42')](handleError(_0x271b89,null));};exports[_0x441b('0x4f')]=function(_0x29f15b,_0x3341f5,_0x485ffa){var _0x4091a3={};var _0x139e9d={};var _0x398137;var _0x985203;return db[_0x441b('0x3f')]['findOne']({'where':{'id':_0x29f15b[_0x441b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3341f5,null))['then'](function(_0x276d02){if(_0x276d02){_0x398137=_0x276d02;_0x139e9d['model']=_[_0x441b('0x46')](db['Interval'][_0x441b('0x45')]);_0x139e9d[_0x441b('0x32')]=_[_0x441b('0x46')](_0x29f15b[_0x441b('0x32')]);_0x139e9d[_0x441b('0x33')]=_[_0x441b('0x34')](_0x139e9d[_0x441b('0x31')],_0x139e9d['query']);_0x4091a3[_0x441b('0x35')]=_[_0x441b('0x34')](_0x139e9d['model'],qs[_0x441b('0x36')](_0x29f15b['query'][_0x441b('0x36')]));_0x4091a3[_0x441b('0x35')]=_0x4091a3[_0x441b('0x35')][_0x441b('0x37')]?_0x4091a3[_0x441b('0x35')]:_0x139e9d[_0x441b('0x31')];_0x4091a3[_0x441b('0x39')]=qs[_0x441b('0x3a')](_0x29f15b['query'][_0x441b('0x3a')]);_0x4091a3['where']=qs[_0x441b('0x33')](_['pick'](_0x29f15b[_0x441b('0x32')],_0x139e9d['filters']));if(_0x29f15b[_0x441b('0x32')]['filter']){_0x4091a3[_0x441b('0x3b')]=_[_0x441b('0x48')](_0x4091a3[_0x441b('0x3b')],{'$or':_[_0x441b('0x2f')](_0x4091a3[_0x441b('0x35')],function(_0x2be2c2){var _0x409b5d={};_0x409b5d[_0x2be2c2]={'$like':'%'+_0x29f15b['query'][_0x441b('0x3d')]+'%'};return _0x409b5d;})});}_0x4091a3=_[_0x441b('0x48')]({},_0x4091a3,_0x29f15b[_0x441b('0x3e')]);return _0x398137[_0x441b('0x4f')](_0x4091a3);}})['then'](function(_0x29f177){if(_0x29f177){_0x985203=_0x29f177[_0x441b('0x37')];if(!_0x29f15b[_0x441b('0x32')][_0x441b('0x50')](_0x441b('0x38'))){_0x4091a3[_0x441b('0x1d')]=qs[_0x441b('0x1d')](_0x29f15b[_0x441b('0x32')][_0x441b('0x1d')]);_0x4091a3[_0x441b('0x1f')]=qs['offset'](_0x29f15b[_0x441b('0x32')][_0x441b('0x1f')]);}return _0x398137[_0x441b('0x4f')](_0x4091a3);}})[_0x441b('0x26')](function(_0x5def84){if(_0x5def84){return _0x5def84?{'count':_0x985203,'rows':_0x5def84}:null;}})[_0x441b('0x26')](respondWithResult(_0x3341f5,null))['catch'](handleError(_0x3341f5,null));};exports[_0x441b('0x51')]=function(_0x3d291d,_0xa0c05a,_0x5af54b){return db['Interval']['findOne']({'where':{'id':_0x3d291d[_0x441b('0x44')]['id']}})[_0x441b('0x26')](handleEntityNotFound(_0xa0c05a,null))[_0x441b('0x26')](function(_0xc6ac96){if(_0xc6ac96){return db[_0x441b('0x52')][_0x441b('0x53')](function(_0x16a118){return db[_0x441b('0x3f')][_0x441b('0x2a')]({'where':{'IntervalId':_0x3d291d[_0x441b('0x44')]['id']},'transaction':_0x16a118})[_0x441b('0x26')](function(_0xc2d080){var _0x2b55db=_['map'](_0x3d291d[_0x441b('0x4b')],function(_0x52b8c0){delete _0x52b8c0['id'];_0x52b8c0[_0x441b('0x4e')]=_0x3d291d[_0x441b('0x44')]['id'];return _0x52b8c0;});return db[_0x441b('0x3f')]['bulkCreate'](_0x2b55db,{'transaction':_0x16a118});});})[_0x441b('0x26')](function(){return db['Interval'][_0x441b('0x41')]({'where':{'IntervalId':_0x3d291d[_0x441b('0x44')]['id']}});});}})[_0x441b('0x26')](respondWithResult(_0xa0c05a,null))[_0x441b('0x42')](handleError(_0xa0c05a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3314e61..a724a5c 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 _0x17bb=['rewrite','interval','string','then','all','map','ifTime','./interval.attributes','../../utils/iftime','iftime','exports','define'];(function(_0x251292,_0x27f40e){var _0x7feca0=function(_0x146efb){while(--_0x146efb){_0x251292['push'](_0x251292['shift']());}};_0x7feca0(++_0x27f40e);}(_0x17bb,0x17b));var _0xb17b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x17bb[_0x42cae2];return _0x5f256f;};'use strict';var attributes=require(_0xb17b('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xb17b('0x1'))[_0xb17b('0x2')];module[_0xb17b('0x3')]=function(_0x3d75ce){return _0x3d75ce[_0xb17b('0x4')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9d16c4){extensions[_0xb17b('0x5')](_0x3d75ce,_0x9d16c4);},'afterBulkCreate':function(_0x3ebc8b,_0x10407d,_0x618f5e){_0x618f5e();extensions[_0xb17b('0x5')](_0x3d75ce,_0x3ebc8b[0x0]);},'afterUpdate':function(_0x322e3b){extensions[_0xb17b('0x5')](_0x3d75ce,_0x322e3b);},'afterDestroy':function(_0x891826){extensions[_0xb17b('0x5')](_0x3d75ce,_0x891826);}},'instanceMethods':{'ifTime':function(_0x694f6b=undefined,_0x24a3d1=new Date()){if(typeof this[_0xb17b('0x6')]===_0xb17b('0x7')){return iftime(this[_0xb17b('0x6')],_0x694f6b,_0x24a3d1);}else{return this['getIntervals']()[_0xb17b('0x8')](function(_0x47845c){return Promise[_0xb17b('0x9')](_0x47845c[_0xb17b('0xa')](function(_0x184344){return _0x184344[_0xb17b('0xb')](_0x694f6b,_0x24a3d1);}));})[_0xb17b('0x8')](function(_0x2b0833){return _0x2b0833['reduce'](function(_0x3c0d8f,_0x25db15){return _0x3c0d8f||_0x25db15;},![]);});}}}});}; \ No newline at end of file +var _0x1400=['exports','define','tools_intervals','rewrite','string','interval','getIntervals','then','all','map','reduce','../../utils/iftime','iftime'];(function(_0x3e16fa,_0x43bc73){var _0x4b043b=function(_0xab73f6){while(--_0xab73f6){_0x3e16fa['push'](_0x3e16fa['shift']());}};_0x4b043b(++_0x43bc73);}(_0x1400,0x16a));var _0x0140=function(_0x2fb4fb,_0x13abdf){_0x2fb4fb=_0x2fb4fb-0x0;var _0x36e7d6=_0x1400[_0x2fb4fb];return _0x36e7d6;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x0140('0x0'))[_0x0140('0x1')];module[_0x0140('0x2')]=function(_0x13ca20){return _0x13ca20[_0x0140('0x3')]('Interval',attributes,{'tableName':_0x0140('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43077b){extensions[_0x0140('0x5')](_0x13ca20,_0x43077b);},'afterBulkCreate':function(_0xa3314b,_0x1dbe4e,_0x8f5038){_0x8f5038();extensions[_0x0140('0x5')](_0x13ca20,_0xa3314b[0x0]);},'afterUpdate':function(_0x4777ba){extensions['rewrite'](_0x13ca20,_0x4777ba);},'afterDestroy':function(_0x30184a){extensions[_0x0140('0x5')](_0x13ca20,_0x30184a);}},'instanceMethods':{'ifTime':function(_0x3ed47=undefined,_0x3d82c9=new Date()){if(typeof this['interval']===_0x0140('0x6')){return iftime(this[_0x0140('0x7')],_0x3ed47,_0x3d82c9);}else{return this[_0x0140('0x8')]()[_0x0140('0x9')](function(_0x2e6f48){return Promise[_0x0140('0xa')](_0x2e6f48[_0x0140('0xb')](function(_0x54e481){return _0x54e481['ifTime'](_0x3ed47,_0x3d82c9);}));})['then'](function(_0x40394e){return _0x40394e[_0x0140('0xc')](function(_0x2c666d,_0x4efe56){return _0x2c666d||_0x4efe56;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9da9261..30463a4 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 _0xfe49=['attributes','limit','map','model','include','then','info','debug','stringify','catch','error','message','ShowInterval','find','reduce','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','lodash','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where'];(function(_0x1202b9,_0x36166c){var _0x71e883=function(_0x235d29){while(--_0x235d29){_0x1202b9['push'](_0x1202b9['shift']());}};_0x71e883(++_0x36166c);}(_0xfe49,0x1ec));var _0x9fe4=function(_0x161c72,_0x3ad69d){_0x161c72=_0x161c72-0x0;var _0x2b3b5d=_0xfe49[_0x161c72];return _0x2b3b5d;};'use strict';var _=require(_0x9fe4('0x0'));var util=require(_0x9fe4('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x9fe4('0x2'))[_0x9fe4('0x3')];var logger=require(_0x9fe4('0x4'))(_0x9fe4('0x5'));exports[_0x9fe4('0x6')]=function(_0x270d7c){var _0x2a1738=this;return new Promise(function(_0x446b29,_0x6a6547){return db[_0x9fe4('0x7')][_0x9fe4('0x8')]({'raw':_0x270d7c[_0x9fe4('0x9')]?_0x270d7c[_0x9fe4('0x9')][_0x9fe4('0xa')]===undefined?!![]:![]:!![],'where':_0x270d7c[_0x9fe4('0x9')]?_0x270d7c[_0x9fe4('0x9')][_0x9fe4('0xb')]||null:null,'attributes':_0x270d7c[_0x9fe4('0x9')]?_0x270d7c[_0x9fe4('0x9')][_0x9fe4('0xc')]||null:null,'limit':_0x270d7c[_0x9fe4('0x9')]?_0x270d7c[_0x9fe4('0x9')][_0x9fe4('0xd')]||null:null,'include':_0x270d7c[_0x9fe4('0x9')]?_0x270d7c[_0x9fe4('0x9')]['include']?_[_0x9fe4('0xe')](_0x270d7c['options']['include'],function(_0x4ed7a5){return{'model':db[_0x4ed7a5[_0x9fe4('0xf')]],'as':_0x4ed7a5['as'],'attributes':_0x4ed7a5[_0x9fe4('0xc')],'include':_0x4ed7a5[_0x9fe4('0x10')]?_[_0x9fe4('0xe')](_0x4ed7a5[_0x9fe4('0x10')],function(_0xb5c2fa){return{'model':db[_0xb5c2fa['model']],'as':_0xb5c2fa['as'],'attributes':_0xb5c2fa[_0x9fe4('0xc')],'include':_0xb5c2fa[_0x9fe4('0x10')]?_['map'](_0xb5c2fa['include'],function(_0x679e91){return{'model':db[_0x679e91[_0x9fe4('0xf')]],'as':_0x679e91['as'],'attributes':_0x679e91[_0x9fe4('0xc')]};}):[]};}):[]};}):[]:[]})[_0x9fe4('0x11')](function(_0x2c25ac){logger[_0x9fe4('0x12')](_0x9fe4('0x6'),_0x270d7c);logger[_0x9fe4('0x13')](_0x9fe4('0x6'),_0x270d7c,JSON[_0x9fe4('0x14')](_0x2c25ac));_0x446b29(_0x2c25ac);})[_0x9fe4('0x15')](function(_0x4fa8d8){logger[_0x9fe4('0x16')](_0x9fe4('0x6'),_0x4fa8d8[_0x9fe4('0x17')],_0x270d7c);_0x6a6547(_0x2a1738['error'](0x1f4,_0x4fa8d8[_0x9fe4('0x17')]));});});};exports[_0x9fe4('0x18')]=function(_0x3c9200){var _0x3000aa=this;return new Promise(function(_0x53fe94,_0x2a23ef){return db[_0x9fe4('0x7')][_0x9fe4('0x19')]({'raw':_0x3c9200['options']?_0x3c9200[_0x9fe4('0x9')][_0x9fe4('0xa')]===undefined?!![]:![]:!![],'where':_0x3c9200['options']?_0x3c9200[_0x9fe4('0x9')][_0x9fe4('0xb')]||null:null,'attributes':_0x3c9200[_0x9fe4('0x9')]?_0x3c9200['options'][_0x9fe4('0xc')]||null:null,'include':_0x3c9200['options']?_0x3c9200[_0x9fe4('0x9')][_0x9fe4('0x10')]?_[_0x9fe4('0xe')](_0x3c9200[_0x9fe4('0x9')][_0x9fe4('0x10')],function(_0x3967fe){return{'model':db[_0x3967fe[_0x9fe4('0xf')]],'as':_0x3967fe['as'],'attributes':_0x3967fe[_0x9fe4('0xc')],'include':_0x3967fe[_0x9fe4('0x10')]?_['map'](_0x3967fe['include'],function(_0x4ec8b6){return{'model':db[_0x4ec8b6['model']],'as':_0x4ec8b6['as'],'attributes':_0x4ec8b6[_0x9fe4('0xc')],'include':_0x4ec8b6[_0x9fe4('0x10')]?_[_0x9fe4('0xe')](_0x4ec8b6[_0x9fe4('0x10')],function(_0xea4a5){return{'model':db[_0xea4a5[_0x9fe4('0xf')]],'as':_0xea4a5['as'],'attributes':_0xea4a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fe4('0x11')](function(_0x362237){logger[_0x9fe4('0x12')](_0x9fe4('0x18'),_0x3c9200);logger[_0x9fe4('0x13')](_0x9fe4('0x18'),_0x3c9200,JSON[_0x9fe4('0x14')](_0x362237));_0x53fe94(_0x362237);})[_0x9fe4('0x15')](function(_0x419710){logger['error']('ShowInterval',_0x419710[_0x9fe4('0x17')],_0x3c9200);_0x2a23ef(_0x3000aa['error'](0x1f4,_0x419710['message']));});});};function checkArrayOfIntervals(_0x37acf0,_0x280686){var _0x19fefb=[];return db[_0x9fe4('0x7')][_0x9fe4('0x8')]({'where':{'id':_0x37acf0}})[_0x9fe4('0x11')](function(_0x387349){_0x19fefb=_0x387349;return Promise['all'](_0x19fefb[_0x9fe4('0xe')](function(_0x45ff83){return _0x45ff83['ifTime'](_0x280686);}));})[_0x9fe4('0x11')](function(_0x294aa8){var _0x4d7bba=_0x294aa8[_0x9fe4('0x1a')](function(_0x5a930e,_0x17e17a){return _0x5a930e||_0x17e17a;},![]);logger[_0x9fe4('0x12')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x19fefb[_0x9fe4('0xe')](function(_0x51b52d){return _0x51b52d['name'];})[_0x9fe4('0x1b')](',\x20'),_0x19fefb[_0x9fe4('0xe')](function(_0x5a35de){return _0x5a35de['id'];})[_0x9fe4('0x1b')](',\x20')));return _0x4d7bba;});}function checkSingleInterval(_0x83b76b,_0x58cf2b){return db[_0x9fe4('0x7')][_0x9fe4('0x1c')](_0x83b76b)['then'](function(_0x195f91){if(_0x195f91){logger['info'](util[_0x9fe4('0x1d')](_0x9fe4('0x1e'),_0x195f91['name'],_0x195f91['id']));return _0x195f91[_0x9fe4('0x1f')](_0x58cf2b);}});}exports[_0x9fe4('0x20')]=function(_0xdc5e2){var _0xf70753=_0xdc5e2[_0x9fe4('0x21')];var _0x4b0a77=Array[_0x9fe4('0x22')](_0xdc5e2['intervals'])?_0xdc5e2[_0x9fe4('0x23')]:typeof _0xdc5e2[_0x9fe4('0x23')]==='string'?[_0xdc5e2[_0x9fe4('0x23')]]:[];var _0x5f4de0=_0xdc5e2[_0x9fe4('0x24')]||undefined;var _0x453ecc=![];if(_0x4b0a77[_0x9fe4('0x25')]){logger[_0x9fe4('0x12')](util[_0x9fe4('0x1d')](_0x9fe4('0x26'),_0x4b0a77[_0x9fe4('0x1b')](';\x20')));}if(_0x5f4de0){logger[_0x9fe4('0x12')](util[_0x9fe4('0x1d')](_0x9fe4('0x27'),_0x5f4de0));}logger[_0x9fe4('0x13')](_0x9fe4('0x28'),_0x453ecc);logger[_0x9fe4('0x29')](_0x9fe4('0x20'),_0xdc5e2);return Promise['resolve']()[_0x9fe4('0x11')](function(){if(Array[_0x9fe4('0x22')](_0xf70753)){return checkArrayOfIntervals(_0xf70753,_0x5f4de0);}else if(_0xf70753){return checkSingleInterval(_0xf70753,_0x5f4de0);}})[_0x9fe4('0x11')](function(_0xc7a63d){var _0x24ca19=_0x4b0a77[_0x9fe4('0x1a')](function(_0x2b2f95,_0x5ad06f){return _0x2b2f95||iftime(_0x5ad06f,_0x5f4de0);},![]);_0x453ecc=_0xc7a63d||_0x24ca19;return _0x453ecc;})[_0x9fe4('0x15')](function(_0x3376bd){logger['error'](_0x9fe4('0x20'),_0xdc5e2,_0x3376bd);throw this['error'](0x1f4,_0x3376bd[_0x9fe4('0x17')]);});}; \ No newline at end of file +var _0x58f1=['ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','isArray','reduce','lodash','util','../../mysqldb','iftime','rpc','GetInterval','Interval','options','where','attributes','limit','map','include','model','info','debug','catch','error','message','ShowInterval','find','raw','then','stringify','findAll','all'];(function(_0xc1f5e2,_0x7c879e){var _0xbec549=function(_0x3cf1ed){while(--_0x3cf1ed){_0xc1f5e2['push'](_0xc1f5e2['shift']());}};_0xbec549(++_0x7c879e);}(_0x58f1,0x1ca));var _0x158f=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x58f1[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x158f('0x0'));var util=require(_0x158f('0x1'));var db=require(_0x158f('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x158f('0x3')];var logger=require('../../config/logger')(_0x158f('0x4'));exports[_0x158f('0x5')]=function(_0xf24184){var _0x52b597=this;return new Promise(function(_0xe5ab79,_0x247f8b){return db[_0x158f('0x6')]['findAll']({'raw':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')][_0x158f('0x8')]||null:null,'attributes':_0xf24184['options']?_0xf24184[_0x158f('0x7')][_0x158f('0x9')]||null:null,'limit':_0xf24184['options']?_0xf24184[_0x158f('0x7')][_0x158f('0xa')]||null:null,'include':_0xf24184[_0x158f('0x7')]?_0xf24184[_0x158f('0x7')]['include']?_[_0x158f('0xb')](_0xf24184[_0x158f('0x7')][_0x158f('0xc')],function(_0x52de83){return{'model':db[_0x52de83[_0x158f('0xd')]],'as':_0x52de83['as'],'attributes':_0x52de83[_0x158f('0x9')],'include':_0x52de83[_0x158f('0xc')]?_['map'](_0x52de83[_0x158f('0xc')],function(_0x5f2c67){return{'model':db[_0x5f2c67[_0x158f('0xd')]],'as':_0x5f2c67['as'],'attributes':_0x5f2c67[_0x158f('0x9')],'include':_0x5f2c67['include']?_[_0x158f('0xb')](_0x5f2c67[_0x158f('0xc')],function(_0x51d175){return{'model':db[_0x51d175[_0x158f('0xd')]],'as':_0x51d175['as'],'attributes':_0x51d175[_0x158f('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x199e75){logger[_0x158f('0xe')](_0x158f('0x5'),_0xf24184);logger[_0x158f('0xf')](_0x158f('0x5'),_0xf24184,JSON['stringify'](_0x199e75));_0xe5ab79(_0x199e75);})[_0x158f('0x10')](function(_0x57bd57){logger[_0x158f('0x11')](_0x158f('0x5'),_0x57bd57[_0x158f('0x12')],_0xf24184);_0x247f8b(_0x52b597[_0x158f('0x11')](0x1f4,_0x57bd57[_0x158f('0x12')]));});});};exports[_0x158f('0x13')]=function(_0x3b2d26){var _0x1d78d7=this;return new Promise(function(_0x5ca96a,_0x3c7fc0){return db['Interval'][_0x158f('0x14')]({'raw':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x15')]===undefined?!![]:![]:!![],'where':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x8')]||null:null,'attributes':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0x9')]||null:null,'include':_0x3b2d26[_0x158f('0x7')]?_0x3b2d26[_0x158f('0x7')][_0x158f('0xc')]?_[_0x158f('0xb')](_0x3b2d26[_0x158f('0x7')][_0x158f('0xc')],function(_0x52a4dc){return{'model':db[_0x52a4dc[_0x158f('0xd')]],'as':_0x52a4dc['as'],'attributes':_0x52a4dc[_0x158f('0x9')],'include':_0x52a4dc[_0x158f('0xc')]?_['map'](_0x52a4dc[_0x158f('0xc')],function(_0x4862c8){return{'model':db[_0x4862c8[_0x158f('0xd')]],'as':_0x4862c8['as'],'attributes':_0x4862c8[_0x158f('0x9')],'include':_0x4862c8[_0x158f('0xc')]?_[_0x158f('0xb')](_0x4862c8[_0x158f('0xc')],function(_0x5a7297){return{'model':db[_0x5a7297[_0x158f('0xd')]],'as':_0x5a7297['as'],'attributes':_0x5a7297[_0x158f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x158f('0x16')](function(_0x5b3fc5){logger['info'](_0x158f('0x13'),_0x3b2d26);logger[_0x158f('0xf')](_0x158f('0x13'),_0x3b2d26,JSON[_0x158f('0x17')](_0x5b3fc5));_0x5ca96a(_0x5b3fc5);})[_0x158f('0x10')](function(_0x2f7abb){logger[_0x158f('0x11')]('ShowInterval',_0x2f7abb[_0x158f('0x12')],_0x3b2d26);_0x3c7fc0(_0x1d78d7[_0x158f('0x11')](0x1f4,_0x2f7abb[_0x158f('0x12')]));});});};function checkArrayOfIntervals(_0x1cfc33,_0x2d6553){var _0x5b89e6=[];return db[_0x158f('0x6')][_0x158f('0x18')]({'where':{'id':_0x1cfc33}})[_0x158f('0x16')](function(_0x5af328){_0x5b89e6=_0x5af328;return Promise[_0x158f('0x19')](_0x5b89e6[_0x158f('0xb')](function(_0x5c39fb){return _0x5c39fb[_0x158f('0x1a')](_0x2d6553);}));})[_0x158f('0x16')](function(_0x4e6d0f){var _0x4e5520=_0x4e6d0f['reduce'](function(_0x371894,_0x5114b7){return _0x371894||_0x5114b7;},![]);logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x1c'),_0x5b89e6[_0x158f('0xb')](function(_0x325ad9){return _0x325ad9['name'];})['join'](',\x20'),_0x5b89e6['map'](function(_0x55e388){return _0x55e388['id'];})[_0x158f('0x1d')](',\x20')));return _0x4e5520;});}function checkSingleInterval(_0x22593d,_0x1b99e1){return db[_0x158f('0x6')][_0x158f('0x1e')](_0x22593d)['then'](function(_0x26e8bb){if(_0x26e8bb){logger[_0x158f('0xe')](util['format'](_0x158f('0x1f'),_0x26e8bb[_0x158f('0x20')],_0x26e8bb['id']));return _0x26e8bb[_0x158f('0x1a')](_0x1b99e1);}});}exports['IntervalIftime']=function(_0x574aa7){var _0x584501=_0x574aa7[_0x158f('0x21')];var _0xdc22e0=Array['isArray'](_0x574aa7[_0x158f('0x22')])?_0x574aa7[_0x158f('0x22')]:typeof _0x574aa7['intervals']==='string'?[_0x574aa7[_0x158f('0x22')]]:[];var _0x55a8dc=_0x574aa7[_0x158f('0x23')]||undefined;var _0x299adb=![];if(_0xdc22e0['length']){logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x24'),_0xdc22e0[_0x158f('0x1d')](';\x20')));}if(_0x55a8dc){logger[_0x158f('0xe')](util[_0x158f('0x1b')](_0x158f('0x25'),_0x55a8dc));}logger['debug'](_0x158f('0x26'),_0x299adb);logger[_0x158f('0x27')](_0x158f('0x28'),_0x574aa7);return Promise[_0x158f('0x29')]()[_0x158f('0x16')](function(){if(Array[_0x158f('0x2a')](_0x584501)){return checkArrayOfIntervals(_0x584501,_0x55a8dc);}else if(_0x584501){return checkSingleInterval(_0x584501,_0x55a8dc);}})[_0x158f('0x16')](function(_0x52cb92){var _0x16844d=_0xdc22e0[_0x158f('0x2b')](function(_0x1388fb,_0x116eea){return _0x1388fb||iftime(_0x116eea,_0x55a8dc);},![]);_0x299adb=_0x52cb92||_0x16844d;return _0x299adb;})[_0x158f('0x10')](function(_0xc6573){logger[_0x158f('0x11')](_0x158f('0x28'),_0x574aa7,_0xc6573);throw this[_0x158f('0x11')](0x1f4,_0xc6573['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b6020bd..fbeb78b 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1c8097,_0x5d4305){var _0x53bbad=function(_0x328d0f){while(--_0x328d0f){_0x1c8097['push'](_0x1c8097['shift']());}};_0x53bbad(++_0x5d4305);}(_0x2ef3,0xba));var _0x32ef=function(_0x2648de,_0x360ee5){_0x2648de=_0x2648de-0x0;var _0x4386d8=_0x2ef3[_0x2648de];return _0x4386d8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56aa90,_0x3e3ce5){var _0x224dae=function(_0x455ab3){while(--_0x455ab3){_0x56aa90['push'](_0x56aa90['shift']());}};_0x224dae(++_0x3e3ce5);}(_0x2ef3,0xba));var _0x32ef=function(_0x50d683,_0xaea8ad){_0x50d683=_0x50d683-0x0;var _0x2fb58f=_0x2ef3[_0x50d683];return _0x2fb58f;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8a59413..e014faa 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 _0x2cb3=['email','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','base64','utf8','data','end','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','connection','socket','remoteAddress','https','../../config/logger','api','support','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500'];(function(_0x557d6a,_0x24267a){var _0x2f8318=function(_0x26df1a){while(--_0x26df1a){_0x557d6a['push'](_0x557d6a['shift']());}};_0x2f8318(++_0x24267a);}(_0x2cb3,0x93));var _0x32cb=function(_0x52fa3a,_0x5bb431){_0x52fa3a=_0x52fa3a-0x0;var _0x2403a6=_0x2cb3[_0x52fa3a];return _0x2403a6;};'use strict';var BPromise=require('bluebird');var https=require(_0x32cb('0x0'));var logger=require(_0x32cb('0x1'))(_0x32cb('0x2'));var USERNAME=_0x32cb('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x355c39,_0x577082){var _0x4a4346={'fields':{'project':{'key':_0x355c39['key']||'MOTGUI'},'summary':(_0x355c39[_0x32cb('0x4')]||_0x32cb('0x5'))+_0x32cb('0x6')+_0x355c39['ip'],'description':_0x355c39[_0x32cb('0x7')]||JSON[_0x32cb('0x8')](_0x355c39),'issuetype':{'name':_0x355c39[_0x32cb('0x9')]||_0x32cb('0xa')}}};_0x4a4346[_0x32cb('0xb')][_0x32cb('0xc')]=_0x355c39[_0x32cb('0xd')];_0x4a4346[_0x32cb('0xb')]['customfield_11501']=_0x355c39['oldToken'];_0x4a4346[_0x32cb('0xb')][_0x32cb('0xe')]=_0x355c39[_0x32cb('0xf')];_0x4a4346[_0x32cb('0xb')][_0x32cb('0x10')]=_0x355c39['name'];_0x4a4346[_0x32cb('0xb')][_0x32cb('0x11')]=_0x355c39[_0x32cb('0x12')];_0x4a4346[_0x32cb('0xb')][_0x32cb('0x13')]=_0x355c39['ip'];var _0x46ff6a={'host':_0x32cb('0x14'),'port':0x1bb,'path':_0x32cb('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x32cb('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x32cb('0x17')](_0x32cb('0x18'))}};var _0x245f9d=JSON[_0x32cb('0x8')](_0x4a4346);var _0x1108d3=https['request'](_0x46ff6a,function(_0x566214){_0x566214['setEncoding'](_0x32cb('0x19'));var _0xad00d5='';_0x566214['on'](_0x32cb('0x1a'),function(_0x367de6){_0xad00d5+=_0x367de6;});_0x566214['on'](_0x32cb('0x1b'),function(){if(_0x577082){return _0x577082['status'](_0x566214['statusCode'])[_0x32cb('0x1c')](JSON['parse'](_0xad00d5));}});});_0x1108d3['on'](_0x32cb('0x1d'),function(_0x21ec01){if(_0x577082){return _0x577082[_0x32cb('0x1e')](0x1f4)[_0x32cb('0x1c')]({'errors':[{'message':_0x32cb('0x1f'),'type':_0x32cb('0x20')}]});}});_0x1108d3[_0x32cb('0x21')](_0x245f9d);_0x1108d3[_0x32cb('0x1b')]();}exports[_0x32cb('0x22')]=openIssue;exports['send']=function(_0x1d752c,_0x43f281){_0x1d752c[_0x32cb('0x23')]['ip']=_0x1d752c[_0x32cb('0x24')]['x-forwarded-for']||_0x1d752c[_0x32cb('0x25')]['remoteAddress']||_0x1d752c[_0x32cb('0x26')][_0x32cb('0x27')]||_0x1d752c[_0x32cb('0x25')][_0x32cb('0x26')][_0x32cb('0x27')];return openIssue(_0x1d752c['body'],_0x43f281);}; \ No newline at end of file +var _0x8a3a=['remoteAddress','socket','connection','bluebird','https','../../config/logger','api','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers'];(function(_0x34ef54,_0x39404f){var _0x53823a=function(_0x405c40){while(--_0x405c40){_0x34ef54['push'](_0x34ef54['shift']());}};_0x53823a(++_0x39404f);}(_0x8a3a,0xbb));var _0xa8a3=function(_0x158074,_0x2224cb){_0x158074=_0x158074-0x0;var _0x73f669=_0x8a3a[_0x158074];return _0x73f669;};'use strict';var BPromise=require(_0xa8a3('0x0'));var https=require(_0xa8a3('0x1'));var logger=require(_0xa8a3('0x2'))(_0xa8a3('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5d8e23,_0x1ec0c2){var _0xf0451e={'fields':{'project':{'key':_0x5d8e23[_0xa8a3('0x4')]||'MOTGUI'},'summary':(_0x5d8e23[_0xa8a3('0x5')]||_0xa8a3('0x6'))+_0xa8a3('0x7')+_0x5d8e23['ip'],'description':_0x5d8e23[_0xa8a3('0x8')]||JSON[_0xa8a3('0x9')](_0x5d8e23),'issuetype':{'name':_0x5d8e23[_0xa8a3('0xa')]||_0xa8a3('0xb')}}};_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0xd')]=_0x5d8e23['email'];_0xf0451e[_0xa8a3('0xc')]['customfield_11501']=_0x5d8e23[_0xa8a3('0xe')];_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0xf')]=_0x5d8e23[_0xa8a3('0x10')];_0xf0451e['fields'][_0xa8a3('0x11')]=_0x5d8e23[_0xa8a3('0x12')];_0xf0451e[_0xa8a3('0xc')][_0xa8a3('0x13')]=_0x5d8e23[_0xa8a3('0x14')];_0xf0451e['fields'][_0xa8a3('0x15')]=_0x5d8e23['ip'];var _0x254440={'host':_0xa8a3('0x16'),'port':0x1bb,'path':_0xa8a3('0x17'),'method':_0xa8a3('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xa8a3('0x19'),'Authorization':_0xa8a3('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xa8a3('0x1b')](_0xa8a3('0x1c'))}};var _0x78fb3f=JSON[_0xa8a3('0x9')](_0xf0451e);var _0x35f028=https[_0xa8a3('0x1d')](_0x254440,function(_0x3c6f51){_0x3c6f51[_0xa8a3('0x1e')](_0xa8a3('0x1f'));var _0x5d3904='';_0x3c6f51['on'](_0xa8a3('0x20'),function(_0x171361){_0x5d3904+=_0x171361;});_0x3c6f51['on']('end',function(){if(_0x1ec0c2){return _0x1ec0c2[_0xa8a3('0x21')](_0x3c6f51[_0xa8a3('0x22')])['json'](JSON[_0xa8a3('0x23')](_0x5d3904));}});});_0x35f028['on']('error',function(_0x46474b){if(_0x1ec0c2){return _0x1ec0c2[_0xa8a3('0x21')](0x1f4)[_0xa8a3('0x24')]({'errors':[{'message':_0xa8a3('0x25'),'type':_0xa8a3('0x26')}]});}});_0x35f028['write'](_0x78fb3f);_0x35f028['end']();}exports[_0xa8a3('0x27')]=openIssue;exports[_0xa8a3('0x28')]=function(_0x30b7bc,_0x1ee517){_0x30b7bc[_0xa8a3('0x29')]['ip']=_0x30b7bc[_0xa8a3('0x2a')]['x-forwarded-for']||_0x30b7bc['connection'][_0xa8a3('0x2b')]||_0x30b7bc[_0xa8a3('0x2c')]['remoteAddress']||_0x30b7bc[_0xa8a3('0x2d')][_0xa8a3('0x2c')]['remoteAddress'];return openIssue(_0x30b7bc['body'],_0x1ee517);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3ceb20d..7afbaa1 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 _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x702d,0x147));var _0xd702=function(_0x686a1a,_0x58f980){_0x686a1a=_0x686a1a-0x0;var _0x5a2214=_0x702d[_0x686a1a];return _0x5a2214;};'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('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0xd55486,_0x5469ed){var _0x2a2e58=function(_0x4c9f33){while(--_0x4c9f33){_0xd55486['push'](_0xd55486['shift']());}};_0x2a2e58(++_0x5469ed);}(_0x6324,0x142));var _0x4632=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0x6324[_0xa6df52];return _0x5edd57;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 04c136c..83cb610 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x3d8837,_0x521435){_0x3d8837=_0x3d8837-0x0;var _0x36d389=_0x7a54[_0x3d8837];return _0x36d389;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x333174,_0x20893e){_0x333174=_0x333174-0x0;var _0x16470e=_0x7a54[_0x333174];return _0x16470e;};'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 df82b27..1e6aa0f 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 _0x3f1c=['params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x1219f8,_0xfbb4cb){var _0x583df9=function(_0x35766f){while(--_0x35766f){_0x1219f8['push'](_0x1219f8['shift']());}};_0x583df9(++_0xfbb4cb);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x521706,_0x102885){_0x521706=_0x521706-0x0;var _0x1402c8=_0x3f1c[_0x521706];return _0x1402c8;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23bb14,_0x103df5){_0x103df5=_0x103df5||0xcc;return function(_0x25cb9e){if(_0x25cb9e){return _0x23bb14[_0xc3f1('0x13')](_0x103df5);}return _0x23bb14[_0xc3f1('0x14')](_0x103df5)[_0xc3f1('0x15')]();};}function respondWithResult(_0x5bbfb3,_0x5dbe5c){_0x5dbe5c=_0x5dbe5c||0xc8;return function(_0x1d9ea7){if(_0x1d9ea7){return _0x5bbfb3[_0xc3f1('0x14')](_0x5dbe5c)[_0xc3f1('0x16')](_0x1d9ea7);}};}function respondWithFilteredResult(_0x23eb8c,_0x4e8f05){return function(_0x4667af){if(_0x4667af){var _0xee643=typeof _0x4e8f05[_0xc3f1('0x17')]===_0xc3f1('0x18')&&typeof _0x4e8f05['limit']===_0xc3f1('0x18');var _0x59e1e3=_0x4667af[_0xc3f1('0x19')];var _0x420d75=_0xee643?0x0:_0x4e8f05[_0xc3f1('0x17')];var _0x3dc419=_0xee643?_0x4667af['count']:_0x4e8f05[_0xc3f1('0x17')]+_0x4e8f05[_0xc3f1('0x1a')];var _0x3f97b2;if(_0x3dc419>=_0x59e1e3){_0x3dc419=_0x59e1e3;_0x3f97b2=0xc8;}else{_0x3f97b2=0xce;}_0x23eb8c[_0xc3f1('0x14')](_0x3f97b2);return _0x23eb8c[_0xc3f1('0x1b')]('Content-Range',_0x420d75+'-'+_0x3dc419+'/'+_0x59e1e3)[_0xc3f1('0x16')](_0x4667af);}return null;};}function patchUpdates(_0x4f53c1){return function(_0x546627){try{jsonpatch[_0xc3f1('0x1c')](_0x546627,_0x4f53c1,!![]);}catch(_0x1d3ebb){return BPromise[_0xc3f1('0x1d')](_0x1d3ebb);}return _0x546627[_0xc3f1('0x1e')]();};}function saveUpdates(_0x53d054,_0x44d774){return function(_0x2df1a4){if(_0x2df1a4){return _0x2df1a4[_0xc3f1('0x1f')](_0x53d054)[_0xc3f1('0x20')](function(_0x151c8a){return _0x151c8a;});}return null;};}function removeEntity(_0x31a03c,_0x2f4d81){return function(_0x294f50){if(_0x294f50){return _0x294f50['destroy']()['then'](function(){_0x31a03c[_0xc3f1('0x14')](0xcc)[_0xc3f1('0x15')]();});}};}function handleEntityNotFound(_0x3b1eb9,_0x49d98d){return function(_0x5e1b6a){if(!_0x5e1b6a){_0x3b1eb9[_0xc3f1('0x13')](0x194);}return _0x5e1b6a;};}function handleError(_0x41b473,_0x1cf63f){_0x1cf63f=_0x1cf63f||0x1f4;return function(_0x4dd154){logger['error'](_0x4dd154[_0xc3f1('0x21')]);if(_0x4dd154[_0xc3f1('0x22')]){delete _0x4dd154['name'];}_0x41b473['status'](_0x1cf63f)[_0xc3f1('0x23')](_0x4dd154);};}exports[_0xc3f1('0x24')]=function(_0x5cb85d,_0x2d6cc4){var _0x22dac7={},_0x2f925e={},_0x3454a3={'count':0x0,'rows':[]};var _0x4103ef=_[_0xc3f1('0x25')](db[_0xc3f1('0x26')]['rawAttributes'],function(_0x22957c){return{'name':_0x22957c[_0xc3f1('0x27')],'type':_0x22957c[_0xc3f1('0x28')][_0xc3f1('0x29')]};});_0x2f925e[_0xc3f1('0x2a')]=_['map'](_0x4103ef,_0xc3f1('0x22'));_0x2f925e['query']=_[_0xc3f1('0x2b')](_0x5cb85d['query']);_0x2f925e['filters']=_[_0xc3f1('0x2c')](_0x2f925e[_0xc3f1('0x2a')],_0x2f925e['query']);_0x22dac7[_0xc3f1('0x2d')]=_[_0xc3f1('0x2c')](_0x2f925e['model'],qs[_0xc3f1('0x2e')](_0x5cb85d['query'][_0xc3f1('0x2e')]));_0x22dac7[_0xc3f1('0x2d')]=_0x22dac7[_0xc3f1('0x2d')][_0xc3f1('0x2f')]?_0x22dac7[_0xc3f1('0x2d')]:_0x2f925e['model'];if(!_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x31')]('nolimit')){_0x22dac7[_0xc3f1('0x1a')]=qs[_0xc3f1('0x1a')](_0x5cb85d[_0xc3f1('0x30')]['limit']);_0x22dac7[_0xc3f1('0x17')]=qs[_0xc3f1('0x17')](_0x5cb85d['query'][_0xc3f1('0x17')]);}_0x22dac7[_0xc3f1('0x32')]=qs['sort'](_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x33')]);_0x22dac7[_0xc3f1('0x34')]=qs[_0xc3f1('0x35')](_[_0xc3f1('0x36')](_0x5cb85d[_0xc3f1('0x30')],_0x2f925e[_0xc3f1('0x35')]),_0x4103ef);if(_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x37')]){_0x22dac7[_0xc3f1('0x34')]=_[_0xc3f1('0x38')](_0x22dac7['where'],{'$or':_[_0xc3f1('0x25')](_0x4103ef,function(_0x5db660){if(_0x5db660['type']!==_0xc3f1('0x39')){var _0x4420ce={};_0x4420ce[_0x5db660[_0xc3f1('0x22')]]={'$like':'%'+_0x5cb85d['query'][_0xc3f1('0x37')]+'%'};return _0x4420ce;}})});}_0x22dac7=_[_0xc3f1('0x38')]({},_0x22dac7,_0x5cb85d[_0xc3f1('0x3a')]);var _0x29eefa={'where':_0x22dac7[_0xc3f1('0x34')]};return db[_0xc3f1('0x26')]['count'](_0x29eefa)[_0xc3f1('0x20')](function(_0x3afde8){_0x3454a3[_0xc3f1('0x19')]=_0x3afde8;if(_0x5cb85d['query']['includeAll']){_0x22dac7[_0xc3f1('0x3b')]=[{'all':!![]}];}return db[_0xc3f1('0x26')]['findAll'](_0x22dac7);})[_0xc3f1('0x20')](function(_0x30e012){_0x3454a3['rows']=_0x30e012;return _0x3454a3;})['then'](respondWithFilteredResult(_0x2d6cc4,_0x22dac7))['catch'](handleError(_0x2d6cc4,null));};exports['show']=function(_0x4a829c,_0x1904c0){var _0x1e8e55={'raw':!![],'where':{'id':_0x4a829c[_0xc3f1('0x3c')]['id']}},_0xfcf4a6={};_0xfcf4a6['model']=_['keys'](db[_0xc3f1('0x26')][_0xc3f1('0x3d')]);_0xfcf4a6[_0xc3f1('0x30')]=_[_0xc3f1('0x2b')](_0x4a829c[_0xc3f1('0x30')]);_0xfcf4a6[_0xc3f1('0x35')]=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],_0xfcf4a6[_0xc3f1('0x30')]);_0x1e8e55['attributes']=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],qs['fields'](_0x4a829c[_0xc3f1('0x30')][_0xc3f1('0x2e')]));_0x1e8e55[_0xc3f1('0x2d')]=_0x1e8e55[_0xc3f1('0x2d')]['length']?_0x1e8e55['attributes']:_0xfcf4a6['model'];if(_0x4a829c['query'][_0xc3f1('0x3e')]){_0x1e8e55[_0xc3f1('0x3b')]=[{'all':!![]}];}_0x1e8e55=_['merge']({},_0x1e8e55,_0x4a829c[_0xc3f1('0x3a')]);return db[_0xc3f1('0x26')][_0xc3f1('0x3f')](_0x1e8e55)[_0xc3f1('0x20')](handleEntityNotFound(_0x1904c0,null))[_0xc3f1('0x20')](respondWithResult(_0x1904c0,null))[_0xc3f1('0x40')](handleError(_0x1904c0,null));};exports[_0xc3f1('0x41')]=function(_0x581eca,_0x3fdb5c){return db[_0xc3f1('0x26')]['create'](_0x581eca[_0xc3f1('0x42')],{})[_0xc3f1('0x20')](respondWithResult(_0x3fdb5c,0xc9))[_0xc3f1('0x40')](handleError(_0x3fdb5c,null));};exports['update']=function(_0x1a7d8c,_0x2f370b){if(_0x1a7d8c['body']['id']){delete _0x1a7d8c[_0xc3f1('0x42')]['id'];}return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x1a7d8c[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x2f370b,null))[_0xc3f1('0x20')](saveUpdates(_0x1a7d8c[_0xc3f1('0x42')],null))[_0xc3f1('0x20')](respondWithResult(_0x2f370b,null))[_0xc3f1('0x40')](handleError(_0x2f370b,null));};exports['destroy']=function(_0x2966f2,_0x59245c){return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x2966f2[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x59245c,null))[_0xc3f1('0x20')](removeEntity(_0x59245c,null))[_0xc3f1('0x40')](handleError(_0x59245c,null));};exports[_0xc3f1('0x43')]=function(_0x58803a,_0x32aae1){return db[_0xc3f1('0x26')]['describe']()[_0xc3f1('0x20')](respondWithResult(_0x32aae1,null))[_0xc3f1('0x40')](handleError(_0x32aae1,null));}; \ No newline at end of file +var _0x6eed=['stack','name','index','map','JscriptyAnswerReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0x568e41,_0x5da0f8){var _0x2dbfde=function(_0x1be9aa){while(--_0x1be9aa){_0x568e41['push'](_0x568e41['shift']());}};_0x2dbfde(++_0x5da0f8);}(_0x6eed,0xff));var _0xd6ee=function(_0x4073c8,_0x119fb4){_0x4073c8=_0x4073c8-0x0;var _0x21ef99=_0x6eed[_0x4073c8];return _0x21ef99;};'use strict';var emlformat=require(_0xd6ee('0x0'));var rimraf=require(_0xd6ee('0x1'));var zipdir=require(_0xd6ee('0x2'));var jsonpatch=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var moment=require('moment');var BPromise=require(_0xd6ee('0x5'));var Mustache=require(_0xd6ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6ee('0x7'));var csv=require(_0xd6ee('0x8'));var ejs=require(_0xd6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ee('0xa'));var _=require(_0xd6ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ee('0xd'));var Redis=require(_0xd6ee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6ee('0xf'));var as=require(_0xd6ee('0x10'));var hardwareService=require(_0xd6ee('0x11'));var logger=require(_0xd6ee('0x12'))('api');var utils=require(_0xd6ee('0x13'));var config=require(_0xd6ee('0x14'));var licenseUtil=require(_0xd6ee('0x15'));var db=require(_0xd6ee('0x16'))['db'];function respondWithStatusCode(_0x268dd1,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xcc;return function(_0x48be63){if(_0x48be63){return _0x268dd1[_0xd6ee('0x17')](_0x3fd1df);}return _0x268dd1[_0xd6ee('0x18')](_0x3fd1df)['end']();};}function respondWithResult(_0x369b4a,_0x15918d){_0x15918d=_0x15918d||0xc8;return function(_0x2bf3b2){if(_0x2bf3b2){return _0x369b4a[_0xd6ee('0x18')](_0x15918d)[_0xd6ee('0x19')](_0x2bf3b2);}};}function respondWithFilteredResult(_0xe66d0d,_0x49bafc){return function(_0x1c2e51){if(_0x1c2e51){var _0xb99b70=typeof _0x49bafc[_0xd6ee('0x1a')]==='undefined'&&typeof _0x49bafc[_0xd6ee('0x1b')]==='undefined';var _0x3a82bf=_0x1c2e51[_0xd6ee('0x1c')];var _0x81d533=_0xb99b70?0x0:_0x49bafc['offset'];var _0x8a2718=_0xb99b70?_0x1c2e51['count']:_0x49bafc[_0xd6ee('0x1a')]+_0x49bafc['limit'];var _0x31ae0f;if(_0x8a2718>=_0x3a82bf){_0x8a2718=_0x3a82bf;_0x31ae0f=0xc8;}else{_0x31ae0f=0xce;}_0xe66d0d[_0xd6ee('0x18')](_0x31ae0f);return _0xe66d0d[_0xd6ee('0x1d')](_0xd6ee('0x1e'),_0x81d533+'-'+_0x8a2718+'/'+_0x3a82bf)[_0xd6ee('0x19')](_0x1c2e51);}return null;};}function patchUpdates(_0x4b33f1){return function(_0xe2f8c4){try{jsonpatch['apply'](_0xe2f8c4,_0x4b33f1,!![]);}catch(_0x17e011){return BPromise[_0xd6ee('0x1f')](_0x17e011);}return _0xe2f8c4[_0xd6ee('0x20')]();};}function saveUpdates(_0x1abedc,_0xec9287){return function(_0x48e6ad){if(_0x48e6ad){return _0x48e6ad['update'](_0x1abedc)[_0xd6ee('0x21')](function(_0x511c18){return _0x511c18;});}return null;};}function removeEntity(_0x2bae66,_0x519373){return function(_0x391844){if(_0x391844){return _0x391844[_0xd6ee('0x22')]()[_0xd6ee('0x21')](function(){_0x2bae66[_0xd6ee('0x18')](0xcc)[_0xd6ee('0x23')]();});}};}function handleEntityNotFound(_0x5476f2,_0x4b1926){return function(_0x2f438c){if(!_0x2f438c){_0x5476f2[_0xd6ee('0x17')](0x194);}return _0x2f438c;};}function handleError(_0x4edb7d,_0x2c9b30){_0x2c9b30=_0x2c9b30||0x1f4;return function(_0xa1e700){logger[_0xd6ee('0x24')](_0xa1e700[_0xd6ee('0x25')]);if(_0xa1e700[_0xd6ee('0x26')]){delete _0xa1e700[_0xd6ee('0x26')];}_0x4edb7d[_0xd6ee('0x18')](_0x2c9b30)['send'](_0xa1e700);};}exports[_0xd6ee('0x27')]=function(_0x124ab7,_0x50b786){var _0x5bcdd6={},_0x1578b3={},_0x4580a7={'count':0x0,'rows':[]};var _0xddca=_[_0xd6ee('0x28')](db[_0xd6ee('0x29')]['rawAttributes'],function(_0x414015){return{'name':_0x414015[_0xd6ee('0x2a')],'type':_0x414015[_0xd6ee('0x2b')]['key']};});_0x1578b3[_0xd6ee('0x2c')]=_[_0xd6ee('0x28')](_0xddca,_0xd6ee('0x26'));_0x1578b3['query']=_[_0xd6ee('0x2d')](_0x124ab7[_0xd6ee('0x2e')]);_0x1578b3[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],_0x1578b3[_0xd6ee('0x2e')]);_0x5bcdd6['attributes']=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x124ab7[_0xd6ee('0x2e')]['fields']));_0x5bcdd6[_0xd6ee('0x32')]=_0x5bcdd6[_0xd6ee('0x32')][_0xd6ee('0x33')]?_0x5bcdd6['attributes']:_0x1578b3['model'];if(!_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x34')](_0xd6ee('0x35'))){_0x5bcdd6[_0xd6ee('0x1b')]=qs[_0xd6ee('0x1b')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1b')]);_0x5bcdd6[_0xd6ee('0x1a')]=qs[_0xd6ee('0x1a')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1a')]);}_0x5bcdd6[_0xd6ee('0x36')]=qs[_0xd6ee('0x37')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x37')]);_0x5bcdd6['where']=qs[_0xd6ee('0x2f')](_[_0xd6ee('0x38')](_0x124ab7[_0xd6ee('0x2e')],_0x1578b3['filters']),_0xddca);if(_0x124ab7['query']['filter']){_0x5bcdd6['where']=_[_0xd6ee('0x39')](_0x5bcdd6[_0xd6ee('0x3a')],{'$or':_[_0xd6ee('0x28')](_0xddca,function(_0x2a6d2f){if(_0x2a6d2f[_0xd6ee('0x2b')]!==_0xd6ee('0x3b')){var _0x2c975a={};_0x2c975a[_0x2a6d2f['name']]={'$like':'%'+_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x3c')]+'%'};return _0x2c975a;}})});}_0x5bcdd6=_[_0xd6ee('0x39')]({},_0x5bcdd6,_0x124ab7[_0xd6ee('0x3d')]);var _0x407748={'where':_0x5bcdd6[_0xd6ee('0x3a')]};return db[_0xd6ee('0x29')][_0xd6ee('0x1c')](_0x407748)[_0xd6ee('0x21')](function(_0x24a7cb){_0x4580a7['count']=_0x24a7cb;if(_0x124ab7['query']['includeAll']){_0x5bcdd6[_0xd6ee('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd6ee('0x3f')](_0x5bcdd6);})[_0xd6ee('0x21')](function(_0x96aa7f){_0x4580a7[_0xd6ee('0x40')]=_0x96aa7f;return _0x4580a7;})[_0xd6ee('0x21')](respondWithFilteredResult(_0x50b786,_0x5bcdd6))['catch'](handleError(_0x50b786,null));};exports['show']=function(_0x4db1e9,_0x557936){var _0x3337a1={'raw':!![],'where':{'id':_0x4db1e9[_0xd6ee('0x41')]['id']}},_0xf38fc4={};_0xf38fc4[_0xd6ee('0x2c')]=_[_0xd6ee('0x2d')](db[_0xd6ee('0x29')][_0xd6ee('0x42')]);_0xf38fc4[_0xd6ee('0x2e')]=_[_0xd6ee('0x2d')](_0x4db1e9['query']);_0xf38fc4[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0xf38fc4['model'],_0xf38fc4[_0xd6ee('0x2e')]);_0x3337a1['attributes']=_['intersection'](_0xf38fc4[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x4db1e9[_0xd6ee('0x2e')][_0xd6ee('0x31')]));_0x3337a1[_0xd6ee('0x32')]=_0x3337a1[_0xd6ee('0x32')]['length']?_0x3337a1['attributes']:_0xf38fc4[_0xd6ee('0x2c')];if(_0x4db1e9[_0xd6ee('0x2e')]['includeAll']){_0x3337a1[_0xd6ee('0x3e')]=[{'all':!![]}];}_0x3337a1=_['merge']({},_0x3337a1,_0x4db1e9[_0xd6ee('0x3d')]);return db[_0xd6ee('0x29')][_0xd6ee('0x43')](_0x3337a1)[_0xd6ee('0x21')](handleEntityNotFound(_0x557936,null))[_0xd6ee('0x21')](respondWithResult(_0x557936,null))[_0xd6ee('0x44')](handleError(_0x557936,null));};exports[_0xd6ee('0x45')]=function(_0x1b02c4,_0x37c3ba){return db[_0xd6ee('0x29')][_0xd6ee('0x45')](_0x1b02c4['body'],{})[_0xd6ee('0x21')](respondWithResult(_0x37c3ba,0xc9))[_0xd6ee('0x44')](handleError(_0x37c3ba,null));};exports[_0xd6ee('0x46')]=function(_0x360e34,_0x418680){if(_0x360e34[_0xd6ee('0x47')]['id']){delete _0x360e34[_0xd6ee('0x47')]['id'];}return db[_0xd6ee('0x29')][_0xd6ee('0x43')]({'where':{'id':_0x360e34[_0xd6ee('0x41')]['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x418680,null))[_0xd6ee('0x21')](saveUpdates(_0x360e34['body'],null))[_0xd6ee('0x21')](respondWithResult(_0x418680,null))[_0xd6ee('0x44')](handleError(_0x418680,null));};exports[_0xd6ee('0x22')]=function(_0x52dfd3,_0x2f1bef){return db['JscriptyAnswerReport'][_0xd6ee('0x43')]({'where':{'id':_0x52dfd3['params']['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x2f1bef,null))[_0xd6ee('0x21')](removeEntity(_0x2f1bef,null))['catch'](handleError(_0x2f1bef,null));};exports[_0xd6ee('0x48')]=function(_0x164df4,_0xaef499){return db['JscriptyAnswerReport'][_0xd6ee('0x48')]()[_0xd6ee('0x21')](respondWithResult(_0xaef499,null))['catch'](handleError(_0xaef499,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7692a4c..861f3aa 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 _0xd7de=['define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x52c17c,_0x2ed55f){var _0x2c1d83=function(_0x3d0166){while(--_0x3d0166){_0x52c17c['push'](_0x52c17c['shift']());}};_0x2c1d83(++_0x2ed55f);}(_0xd7de,0x153));var _0xed7d=function(_0x27083b,_0x2bc0de){_0x27083b=_0x27083b-0x0;var _0x17d042=_0xd7de[_0x27083b];return _0x17d042;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed7d('0x0'))(_0xed7d('0x1'));var moment=require(_0xed7d('0x2'));var BPromise=require(_0xed7d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed7d('0x4'));var rimraf=require(_0xed7d('0x5'));var config=require(_0xed7d('0x6'));var attributes=require(_0xed7d('0x7'));module[_0xed7d('0x8')]=function(_0x10f921,_0x24a3d8){return _0x10f921[_0xed7d('0x9')](_0xed7d('0xa'),attributes,{'tableName':_0xed7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a5=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x2cddcb,_0x471e76){var _0x2d7c92=function(_0x3d8c02){while(--_0x3d8c02){_0x2cddcb['push'](_0x2cddcb['shift']());}};_0x2d7c92(++_0x471e76);}(_0xf2a5,0x8f));var _0x5f2a=function(_0x1aee43,_0x4215f9){_0x1aee43=_0x1aee43-0x0;var _0x2278ed=_0xf2a5[_0x1aee43];return _0x2278ed;};'use strict';var _=require(_0x5f2a('0x0'));var util=require('util');var logger=require(_0x5f2a('0x1'))(_0x5f2a('0x2'));var moment=require(_0x5f2a('0x3'));var BPromise=require(_0x5f2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f2a('0x5'));var rimraf=require(_0x5f2a('0x6'));var config=require(_0x5f2a('0x7'));var attributes=require(_0x5f2a('0x8'));module[_0x5f2a('0x9')]=function(_0x317961,_0x553b3c){return _0x317961[_0x5f2a('0xa')](_0x5f2a('0xb'),attributes,{'tableName':_0x5f2a('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 39a51ed..d58ccc4 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 _0x7142=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x52aa45,_0xacca31){var _0x270519=function(_0x44bb71){while(--_0x44bb71){_0x52aa45['push'](_0x52aa45['shift']());}};_0x270519(++_0xacca31);}(_0x7142,0x1b5));var _0x2714=function(_0x504fd4,_0x28f234){_0x504fd4=_0x504fd4-0x0;var _0x4d0c23=_0x7142[_0x504fd4];return _0x4d0c23;};'use strict';var _=require(_0x2714('0x0'));var util=require(_0x2714('0x1'));var moment=require(_0x2714('0x2'));var BPromise=require(_0x2714('0x3'));var rs=require(_0x2714('0x4'));var fs=require('fs');var Redis=require(_0x2714('0x5'));var db=require(_0x2714('0x6'))['db'];var utils=require(_0x2714('0x7'));var logger=require(_0x2714('0x8'))('rpc');var config=require(_0x2714('0x9'));var jayson=require(_0x2714('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1645df,_0x2e4489,_0x9ddb00){return new BPromise(function(_0x1276e8,_0x560625){return client[_0x2714('0xb')](_0x1645df,_0x9ddb00)[_0x2714('0xc')](function(_0x961fba){logger['info'](_0x2714('0xd'),_0x2e4489,_0x2714('0xe'));logger['debug'](_0x2714('0xf'),_0x2e4489,_0x2714('0xe'),JSON[_0x2714('0x10')](_0x961fba));if(_0x961fba[_0x2714('0x11')]){if(_0x961fba['error'][_0x2714('0x12')]===0x1f4){logger[_0x2714('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e4489,_0x961fba[_0x2714('0x11')]['message']);return _0x560625(_0x961fba[_0x2714('0x11')][_0x2714('0x13')]);}logger[_0x2714('0x11')](_0x2714('0xd'),_0x2e4489,_0x961fba['error'][_0x2714('0x13')]);return _0x1276e8(_0x961fba[_0x2714('0x11')][_0x2714('0x13')]);}else{logger[_0x2714('0x14')](_0x2714('0xd'),_0x2e4489,'request\x20sent');_0x1276e8(_0x961fba[_0x2714('0x15')][_0x2714('0x13')]);}})[_0x2714('0x16')](function(_0x3c80af){logger[_0x2714('0x11')](_0x2714('0xd'),_0x2e4489,_0x3c80af);_0x560625(_0x3c80af);});});} \ No newline at end of file +var _0x837f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x401b64,_0x5cae66){var _0x139aa0=function(_0x4bef1d){while(--_0x4bef1d){_0x401b64['push'](_0x401b64['shift']());}};_0x139aa0(++_0x5cae66);}(_0x837f,0x1e0));var _0xf837=function(_0x5cd4b9,_0x12e429){_0x5cd4b9=_0x5cd4b9-0x0;var _0x351931=_0x837f[_0x5cd4b9];return _0x351931;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf837('0x0'));var BPromise=require(_0xf837('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf837('0x2'));var db=require(_0xf837('0x3'))['db'];var utils=require(_0xf837('0x4'));var logger=require('../../config/logger')(_0xf837('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf837('0x6')][_0xf837('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb11df5,_0x2b0156,_0x296967){return new BPromise(function(_0x1374a8,_0x4fce13){return client[_0xf837('0x8')](_0xb11df5,_0x296967)[_0xf837('0x9')](function(_0x33fe68){logger[_0xf837('0xa')](_0xf837('0xb'),_0x2b0156,'request\x20sent');logger[_0xf837('0xc')](_0xf837('0xd'),_0x2b0156,'request\x20sent',JSON[_0xf837('0xe')](_0x33fe68));if(_0x33fe68[_0xf837('0xf')]){if(_0x33fe68['error'][_0xf837('0x10')]===0x1f4){logger[_0xf837('0xf')](_0xf837('0xb'),_0x2b0156,_0x33fe68['error'][_0xf837('0x11')]);return _0x4fce13(_0x33fe68[_0xf837('0xf')][_0xf837('0x11')]);}logger[_0xf837('0xf')](_0xf837('0xb'),_0x2b0156,_0x33fe68[_0xf837('0xf')][_0xf837('0x11')]);return _0x1374a8(_0x33fe68['error'][_0xf837('0x11')]);}else{logger[_0xf837('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b0156,_0xf837('0x12'));_0x1374a8(_0x33fe68[_0xf837('0x13')][_0xf837('0x11')]);}})['catch'](function(_0x292657){logger[_0xf837('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b0156,_0x292657);_0x4fce13(_0x292657);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index eee8468..5f9d66f 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 _0xfb2b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','/:id/sessions','isAuthenticated','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0x4e50e8,_0x596819){var _0x1136df=function(_0x444f10){while(--_0x444f10){_0x4e50e8['push'](_0x4e50e8['shift']());}};_0x1136df(++_0x596819);}(_0xfb2b,0x7f));var _0xbfb2=function(_0x4e78d2,_0x67fd13){_0x4e78d2=_0x4e78d2-0x0;var _0x3df981=_0xfb2b[_0x4e78d2];return _0x3df981;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbfb2('0x0'));var timeout=require(_0xbfb2('0x1'));var express=require('express');var router=express[_0xbfb2('0x2')]();var fs_extra=require(_0xbfb2('0x3'));var auth=require(_0xbfb2('0x4'));var interaction=require(_0xbfb2('0x5'));var config=require(_0xbfb2('0x6'));var controller=require(_0xbfb2('0x7'));router[_0xbfb2('0x8')]('/',auth['isAuthenticated'](),controller[_0xbfb2('0x9')]);router[_0xbfb2('0x8')](_0xbfb2('0xa'),auth['isAuthenticated'](),controller[_0xbfb2('0xb')]);router[_0xbfb2('0x8')](_0xbfb2('0xc'),auth[_0xbfb2('0xd')](),controller[_0xbfb2('0xe')]);router['get']('/:id/answers',auth[_0xbfb2('0xd')](),controller[_0xbfb2('0xf')]);router[_0xbfb2('0x8')](_0xbfb2('0x10'),auth['isAuthenticated'](),timeout(_0xbfb2('0x11')),controller['getSummary']);router[_0xbfb2('0x12')]('/',auth[_0xbfb2('0xd')](),controller[_0xbfb2('0x13')]);router[_0xbfb2('0x12')](_0xbfb2('0x14'),auth[_0xbfb2('0xd')](),controller[_0xbfb2('0x15')]);router['put'](_0xbfb2('0xa'),auth[_0xbfb2('0xd')](),controller[_0xbfb2('0x16')]);router[_0xbfb2('0x17')](_0xbfb2('0xa'),auth[_0xbfb2('0xd')](),controller[_0xbfb2('0x18')]);module[_0xbfb2('0x19')]=router; \ No newline at end of file +var _0x540a=['path','express','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getSummary','post','create','clone','delete','destroy','exports','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x540a,0xa7));var _0xa540=function(_0x47705d,_0x426790){_0x47705d=_0x47705d-0x0;var _0x58006b=_0x540a[_0x47705d];return _0x58006b;};'use strict';var multer=require('multer');var util=require(_0xa540('0x0'));var path=require(_0xa540('0x1'));var timeout=require('connect-timeout');var express=require(_0xa540('0x2'));var router=express[_0xa540('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa540('0x4'));var config=require('../../config/environment');var controller=require(_0xa540('0x5'));router[_0xa540('0x6')]('/',auth[_0xa540('0x7')](),controller[_0xa540('0x8')]);router[_0xa540('0x6')](_0xa540('0x9'),auth[_0xa540('0x7')](),controller[_0xa540('0xa')]);router[_0xa540('0x6')](_0xa540('0xb'),auth['isAuthenticated'](),controller[_0xa540('0xc')]);router[_0xa540('0x6')](_0xa540('0xd'),auth[_0xa540('0x7')](),controller['getAnswers']);router[_0xa540('0x6')]('/:id/summary',auth[_0xa540('0x7')](),timeout('30s'),controller[_0xa540('0xe')]);router[_0xa540('0xf')]('/',auth[_0xa540('0x7')](),controller[_0xa540('0x10')]);router[_0xa540('0xf')]('/:id/clone',auth[_0xa540('0x7')](),controller[_0xa540('0x11')]);router['put']('/:id',auth[_0xa540('0x7')](),controller['update']);router[_0xa540('0x12')](_0xa540('0x9'),auth[_0xa540('0x7')](),controller[_0xa540('0x13')]);module[_0xa540('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6ab474f..5b0e641 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 _0x6bcb=['sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','getDataValue','description','BOOLEAN'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x6bcb,0x1d1));var _0xb6bc=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x6bcb[_0x367336];return _0x3423a7;};'use strict';var Sequelize=require(_0xb6bc('0x0'));var _=require(_0xb6bc('0x1'));var util=require(_0xb6bc('0x2'));module['exports']={'name':{'type':Sequelize[_0xb6bc('0x3')],'unique':_0xb6bc('0x4')},'description':{'type':Sequelize[_0xb6bc('0x3')]},'formData':{'type':Sequelize[_0xb6bc('0x5')](_0xb6bc('0x6')),'set':function(_0x4d499e){if(_[_0xb6bc('0x7')](_0x4d499e)){this[_0xb6bc('0x8')](_0xb6bc('0x9'),JSON[_0xb6bc('0xa')](_0x4d499e));}else if(_['isString'](_0x4d499e)){this[_0xb6bc('0x8')](_0xb6bc('0x9'),_0x4d499e);}else{this[_0xb6bc('0x8')](_0xb6bc('0x9'),util[_0xb6bc('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb6bc('0xc')](_0xb6bc('0x4'))||'',this['getDataValue'](_0xb6bc('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb6bc('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7421=['long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','util','exports','STRING','TEXT'];(function(_0x223ace,_0x28a4f1){var _0x599ef9=function(_0x58e15f){while(--_0x58e15f){_0x223ace['push'](_0x223ace['shift']());}};_0x599ef9(++_0x28a4f1);}(_0x7421,0x1db));var _0x1742=function(_0x32596c,_0x331cb4){_0x32596c=_0x32596c-0x0;var _0xba728a=_0x7421[_0x32596c];return _0xba728a;};'use strict';var Sequelize=require(_0x1742('0x0'));var _=require('lodash');var util=require(_0x1742('0x1'));module[_0x1742('0x2')]={'name':{'type':Sequelize[_0x1742('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x1742('0x3')]},'formData':{'type':Sequelize[_0x1742('0x4')](_0x1742('0x5')),'set':function(_0x516944){if(_[_0x1742('0x6')](_0x516944)){this[_0x1742('0x7')](_0x1742('0x8'),JSON['stringify'](_0x516944));}else if(_[_0x1742('0x9')](_0x516944)){this[_0x1742('0x7')](_0x1742('0x8'),_0x516944);}else{this['setDataValue']('formData',util[_0x1742('0xa')](_0x1742('0xb'),this[_0x1742('0xc')](_0x1742('0xd'))||'',this[_0x1742('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1742('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 509216c..0729495 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 _0x041d=['order','pick','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','JscriptyProject','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','body','user','role','Projects','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport'];(function(_0x81f232,_0x50c869){var _0x3478ff=function(_0x3cd164){while(--_0x3cd164){_0x81f232['push'](_0x81f232['shift']());}};_0x3478ff(++_0x50c869);}(_0x041d,0x185));var _0xd041=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x041d[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0xd041('0x0'));var rimraf=require(_0xd041('0x1'));var zipdir=require(_0xd041('0x2'));var jsonpatch=require(_0xd041('0x3'));var rp=require(_0xd041('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd041('0x5'));var util=require('util');var path=require(_0xd041('0x6'));var sox=require(_0xd041('0x7'));var csv=require('to-csv');var ejs=require(_0xd041('0x8'));var fs=require('fs');var fs_extra=require(_0xd041('0x9'));var _=require(_0xd041('0xa'));var squel=require(_0xd041('0xb'));var crypto=require(_0xd041('0xc'));var jsforce=require(_0xd041('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd041('0xe'));var querystring=require(_0xd041('0xf'));var Papa=require(_0xd041('0x10'));var Redis=require(_0xd041('0x11'));var authService=require(_0xd041('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd041('0x13'));var hardwareService=require(_0xd041('0x14'));var logger=require(_0xd041('0x15'))('api');var utils=require(_0xd041('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd041('0x17'));var db=require(_0xd041('0x18'))['db'];function respondWithStatusCode(_0x3f3f9f,_0x4ae7dd){_0x4ae7dd=_0x4ae7dd||0xcc;return function(_0x5012c9){if(_0x5012c9){return _0x3f3f9f[_0xd041('0x19')](_0x4ae7dd);}return _0x3f3f9f['status'](_0x4ae7dd)[_0xd041('0x1a')]();};}function respondWithResult(_0x122db6,_0x31ff35){_0x31ff35=_0x31ff35||0xc8;return function(_0x381339){if(_0x381339){return _0x122db6[_0xd041('0x1b')](_0x31ff35)[_0xd041('0x1c')](_0x381339);}};}function respondWithFilteredResult(_0x56f542,_0xc16412){return function(_0xb2acba){if(_0xb2acba){var _0x3b8c40=typeof _0xc16412[_0xd041('0x1d')]===_0xd041('0x1e')&&typeof _0xc16412[_0xd041('0x1f')]===_0xd041('0x1e');var _0xfaf902=_0xb2acba[_0xd041('0x20')];var _0x3e167f=_0x3b8c40?0x0:_0xc16412[_0xd041('0x1d')];var _0x170229=_0x3b8c40?_0xb2acba[_0xd041('0x20')]:_0xc16412[_0xd041('0x1d')]+_0xc16412[_0xd041('0x1f')];var _0x439273;if(_0x170229>=_0xfaf902){_0x170229=_0xfaf902;_0x439273=0xc8;}else{_0x439273=0xce;}_0x56f542[_0xd041('0x1b')](_0x439273);return _0x56f542[_0xd041('0x21')](_0xd041('0x22'),_0x3e167f+'-'+_0x170229+'/'+_0xfaf902)[_0xd041('0x1c')](_0xb2acba);}return null;};}function patchUpdates(_0x89bf3a){return function(_0x4fc057){try{jsonpatch[_0xd041('0x23')](_0x4fc057,_0x89bf3a,!![]);}catch(_0x287aec){return BPromise[_0xd041('0x24')](_0x287aec);}return _0x4fc057[_0xd041('0x25')]();};}function saveUpdates(_0x4d289d,_0x5e7b4d){return function(_0x9c7556){if(_0x9c7556){return _0x9c7556[_0xd041('0x26')](_0x4d289d)[_0xd041('0x27')](function(_0x3b6689){return _0x3b6689;});}return null;};}function removeEntity(_0x5f1f52,_0x316008){return function(_0x255337){if(_0x255337){return _0x255337[_0xd041('0x28')]()[_0xd041('0x27')](function(){var _0x1629a0=_0x255337[_0xd041('0x29')]({'plain':!![]});var _0xacdaed='Projects';return db[_0xd041('0x2a')]['destroy']({'where':{'type':_0xacdaed,'resourceId':_0x1629a0['id']}})[_0xd041('0x27')](function(){return _0x255337;});})[_0xd041('0x27')](function(){_0x5f1f52[_0xd041('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d114e,_0x4b55fb){return function(_0x584584){if(!_0x584584){_0x5d114e[_0xd041('0x19')](0x194);}return _0x584584;};}function handleError(_0x746ee7,_0x106e96){_0x106e96=_0x106e96||0x1f4;return function(_0x49172a){logger[_0xd041('0x2b')](_0x49172a[_0xd041('0x2c')]);if(_0x49172a[_0xd041('0x2d')]){delete _0x49172a[_0xd041('0x2d')];}_0x746ee7[_0xd041('0x1b')](_0x106e96)[_0xd041('0x2e')](_0x49172a);};}exports['index']=function(_0x4d7c3f,_0x2e2dc7){var _0x13a08e={},_0x1639b9={},_0xe1790c={'count':0x0,'rows':[]};var _0x587a4e=_['map'](db[_0xd041('0x2f')][_0xd041('0x30')],function(_0x158f4b){return{'name':_0x158f4b[_0xd041('0x31')],'type':_0x158f4b['type']['key']};});_0x1639b9[_0xd041('0x32')]=_['map'](_0x587a4e,_0xd041('0x2d'));_0x1639b9['query']=_[_0xd041('0x33')](_0x4d7c3f[_0xd041('0x34')]);_0x1639b9[_0xd041('0x35')]=_[_0xd041('0x36')](_0x1639b9[_0xd041('0x32')],_0x1639b9[_0xd041('0x34')]);_0x13a08e[_0xd041('0x37')]=_[_0xd041('0x36')](_0x1639b9[_0xd041('0x32')],qs[_0xd041('0x38')](_0x4d7c3f['query'][_0xd041('0x38')]));_0x13a08e['attributes']=_0x13a08e[_0xd041('0x37')][_0xd041('0x39')]?_0x13a08e[_0xd041('0x37')]:_0x1639b9[_0xd041('0x32')];if(!_0x4d7c3f[_0xd041('0x34')][_0xd041('0x3a')](_0xd041('0x3b'))){_0x13a08e[_0xd041('0x1f')]=qs['limit'](_0x4d7c3f[_0xd041('0x34')][_0xd041('0x1f')]);_0x13a08e[_0xd041('0x1d')]=qs['offset'](_0x4d7c3f[_0xd041('0x34')][_0xd041('0x1d')]);}_0x13a08e['order']=qs[_0xd041('0x3c')](_0x4d7c3f['query']['sort']);_0x13a08e['where']=qs['filters'](_['pick'](_0x4d7c3f[_0xd041('0x34')],_0x1639b9[_0xd041('0x35')]),_0x587a4e);if(_0x4d7c3f[_0xd041('0x34')][_0xd041('0x3d')]){_0x13a08e[_0xd041('0x3e')]=_['merge'](_0x13a08e[_0xd041('0x3e')],{'$or':_[_0xd041('0x3f')](_0x587a4e,function(_0x4eb26d){if(_0x4eb26d['type']!==_0xd041('0x40')){var _0x1e7b64={};_0x1e7b64[_0x4eb26d[_0xd041('0x2d')]]={'$like':'%'+_0x4d7c3f[_0xd041('0x34')][_0xd041('0x3d')]+'%'};return _0x1e7b64;}})});}_0x13a08e=_[_0xd041('0x41')]({},_0x13a08e,_0x4d7c3f[_0xd041('0x42')]);var _0x51e101={'where':_0x13a08e['where']};return db[_0xd041('0x2f')][_0xd041('0x20')](_0x51e101)[_0xd041('0x27')](function(_0x27a33f){_0xe1790c[_0xd041('0x20')]=_0x27a33f;if(_0x4d7c3f['query'][_0xd041('0x43')]){_0x13a08e[_0xd041('0x44')]=[{'all':!![]}];}return db[_0xd041('0x2f')][_0xd041('0x45')](_0x13a08e);})[_0xd041('0x27')](function(_0x2bebb5){_0xe1790c[_0xd041('0x46')]=_0x2bebb5;return _0xe1790c;})[_0xd041('0x27')](respondWithFilteredResult(_0x2e2dc7,_0x13a08e))['catch'](handleError(_0x2e2dc7,null));};exports[_0xd041('0x47')]=function(_0x3d8604,_0x527f71){var _0x1022f3={'raw':![],'where':{'id':_0x3d8604[_0xd041('0x48')]['id']}},_0x3f84b7={};_0x3f84b7[_0xd041('0x32')]=_[_0xd041('0x33')](db[_0xd041('0x2f')][_0xd041('0x30')]);_0x3f84b7['query']=_[_0xd041('0x33')](_0x3d8604[_0xd041('0x34')]);_0x3f84b7['filters']=_[_0xd041('0x36')](_0x3f84b7[_0xd041('0x32')],_0x3f84b7[_0xd041('0x34')]);_0x1022f3['attributes']=_[_0xd041('0x36')](_0x3f84b7[_0xd041('0x32')],qs[_0xd041('0x38')](_0x3d8604[_0xd041('0x34')][_0xd041('0x38')]));_0x1022f3['attributes']=_0x1022f3[_0xd041('0x37')]['length']?_0x1022f3[_0xd041('0x37')]:_0x3f84b7['model'];if(_0x3d8604[_0xd041('0x34')]['includeAll']){_0x1022f3[_0xd041('0x44')]=[{'all':!![]}];}_0x1022f3=_[_0xd041('0x41')]({},_0x1022f3,_0x3d8604['options']);return db[_0xd041('0x2f')]['find'](_0x1022f3)[_0xd041('0x27')](handleEntityNotFound(_0x527f71,null))['then'](respondWithResult(_0x527f71,null))[_0xd041('0x49')](handleError(_0x527f71,null));};exports['create']=function(_0x17a692,_0x518b71){return db[_0xd041('0x2f')]['create'](_0x17a692[_0xd041('0x4a')],{})[_0xd041('0x27')](function(_0x3874a5){var _0x3c1c44=_0x17a692[_0xd041('0x4b')][_0xd041('0x29')]({'plain':!![]});if(!_0x3c1c44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c1c44[_0xd041('0x4c')]===_0xd041('0x4b')){var _0xed8ed2=_0x3874a5[_0xd041('0x29')]({'plain':!![]});var _0x160736=_0xd041('0x4d');return db[_0xd041('0x4e')]['find']({'where':{'name':_0x160736,'userProfileId':_0x3c1c44[_0xd041('0x4f')]},'raw':!![]})[_0xd041('0x27')](function(_0x3dfb30){if(_0x3dfb30&&_0x3dfb30[_0xd041('0x50')]===0x0){return db[_0xd041('0x2a')][_0xd041('0x51')]({'name':_0xed8ed2[_0xd041('0x2d')],'resourceId':_0xed8ed2['id'],'type':_0x3dfb30[_0xd041('0x2d')],'sectionId':_0x3dfb30['id']},{})['then'](function(){return _0x3874a5;});}else{return _0x3874a5;}})[_0xd041('0x49')](function(_0x4a77c0){logger[_0xd041('0x2b')](_0xd041('0x52'),_0x4a77c0);throw _0x4a77c0;});}return _0x3874a5;})[_0xd041('0x27')](respondWithResult(_0x518b71,0xc9))[_0xd041('0x49')](handleError(_0x518b71,null));};exports['clone']=function(_0x508b73,_0x5a651f){var _0x16d24a={'where':{'id':_0x508b73[_0xd041('0x48')]['id']}},_0x252194={};_0x252194[_0xd041('0x32')]=_[_0xd041('0x33')](db[_0xd041('0x2f')][_0xd041('0x30')]);_0x16d24a[_0xd041('0x37')]=_[_0xd041('0x36')](_0x252194[_0xd041('0x32')],qs[_0xd041('0x38')](_0x508b73[_0xd041('0x34')]['fields']));_0x16d24a['attributes']=_0x16d24a[_0xd041('0x37')][_0xd041('0x39')]?_0x16d24a[_0xd041('0x37')]:_0x252194['model'];if(_0x508b73[_0xd041('0x34')][_0xd041('0x43')]){_0x16d24a[_0xd041('0x44')]=[{'all':!![]}];}_0x16d24a=_['merge']({},_0x16d24a,_0x508b73['options']);return db[_0xd041('0x2f')][_0xd041('0x53')](_0x16d24a)[_0xd041('0x27')](handleEntityNotFound(_0x5a651f,null))[_0xd041('0x27')](function(_0x3e7419){if(_0x3e7419){var _0x313ade=_0x3e7419[_0xd041('0x29')]({'plain':!![]});_0x313ade=qs['omit'](_0x313ade,['id','createdAt',_0xd041('0x54')]);_0x508b73[_0xd041('0x4a')]=_[_0xd041('0x55')](_0x508b73[_0xd041('0x4a')],['id',_0xd041('0x56'),_0xd041('0x54')]);return db[_0xd041('0x2f')][_0xd041('0x51')](_[_0xd041('0x41')](_0x313ade,_0x508b73[_0xd041('0x4a')]),{'include':_0x508b73[_0xd041('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3f813b){var _0xbc9f81=_0x508b73['user'][_0xd041('0x29')]({'plain':!![]});if(!_0xbc9f81)throw new Error(_0xd041('0x57'));if(_0xbc9f81[_0xd041('0x4c')]===_0xd041('0x4b')){var _0x4bfbeb=_0x3f813b[_0xd041('0x29')]({'plain':!![]});var _0x4a030b=_0xd041('0x4d');return db[_0xd041('0x4e')]['find']({'where':{'name':_0x4a030b,'userProfileId':_0xbc9f81[_0xd041('0x4f')]},'raw':!![]})[_0xd041('0x27')](function(_0x5abf93){if(_0x5abf93&&_0x5abf93[_0xd041('0x50')]===0x0){return db[_0xd041('0x2a')][_0xd041('0x51')]({'name':_0x4bfbeb[_0xd041('0x2d')],'resourceId':_0x4bfbeb['id'],'type':_0x5abf93[_0xd041('0x2d')],'sectionId':_0x5abf93['id']},{})['then'](function(){return _0x3f813b;});}else{return _0x3f813b;}})[_0xd041('0x49')](function(_0x1b9c4d){logger['error'](_0xd041('0x52'),_0x1b9c4d);throw _0x1b9c4d;});}return _0x3f813b;});}})['then'](respondWithResult(_0x5a651f,0xc9))[_0xd041('0x49')](handleError(_0x5a651f,null));};exports[_0xd041('0x26')]=function(_0x435458,_0x249b51){if(_0x435458[_0xd041('0x4a')]['id']){delete _0x435458['body']['id'];}return db[_0xd041('0x2f')]['find']({'where':{'id':_0x435458[_0xd041('0x48')]['id']}})[_0xd041('0x27')](handleEntityNotFound(_0x249b51,null))[_0xd041('0x27')](saveUpdates(_0x435458[_0xd041('0x4a')],null))[_0xd041('0x27')](respondWithResult(_0x249b51,null))[_0xd041('0x49')](handleError(_0x249b51,null));};exports['destroy']=function(_0x18bf13,_0x4c0476){return db['JscriptyProject'][_0xd041('0x53')]({'where':{'id':_0x18bf13[_0xd041('0x48')]['id']}})[_0xd041('0x27')](handleEntityNotFound(_0x4c0476,null))['then'](removeEntity(_0x4c0476,null))[_0xd041('0x49')](handleError(_0x4c0476,null));};exports[_0xd041('0x58')]=function(_0x5afadb,_0x39b720,_0x48b540){var _0x297849={'raw':!![],'where':{}};var _0x59da62={};var _0xfc07a1={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd041('0x59')]({'where':{'id':_0x5afadb[_0xd041('0x48')]['id']}})[_0xd041('0x27')](handleEntityNotFound(_0x39b720,null))[_0xd041('0x27')](function(_0x57417f){if(_0x57417f){_0x59da62[_0xd041('0x32')]=_[_0xd041('0x33')](db[_0xd041('0x5a')]['rawAttributes']);_0x59da62[_0xd041('0x34')]=_[_0xd041('0x33')](_0x5afadb[_0xd041('0x34')]);_0x59da62[_0xd041('0x35')]=_['intersection'](_0x59da62['model'],_0x59da62['query']);_0x297849[_0xd041('0x37')]=_[_0xd041('0x36')](_0x59da62['model'],qs[_0xd041('0x38')](_0x5afadb[_0xd041('0x34')][_0xd041('0x38')]));_0x297849[_0xd041('0x37')]=_0x297849['attributes'][_0xd041('0x39')]?_0x297849[_0xd041('0x37')]:_0x59da62['model'];if(!_0x5afadb[_0xd041('0x34')]['hasOwnProperty'](_0xd041('0x3b'))){_0x297849[_0xd041('0x1f')]=qs[_0xd041('0x1f')](_0x5afadb[_0xd041('0x34')][_0xd041('0x1f')]);_0x297849[_0xd041('0x1d')]=qs[_0xd041('0x1d')](_0x5afadb[_0xd041('0x34')]['offset']);}_0x297849[_0xd041('0x5b')]=qs[_0xd041('0x3c')](_0x5afadb['query']['sort']);_0x297849[_0xd041('0x3e')]=qs[_0xd041('0x35')](_[_0xd041('0x5c')](_0x5afadb['query'],_0x59da62[_0xd041('0x35')]));_0x297849[_0xd041('0x3e')][_0xd041('0x5d')]=_0x57417f['id'];if(_0x5afadb[_0xd041('0x34')][_0xd041('0x3d')]){_0x297849['where']=_[_0xd041('0x41')](_0x297849[_0xd041('0x3e')],{'$or':_['map'](_0x297849[_0xd041('0x37')],function(_0x311eb){var _0x376bca={};_0x376bca[_0x311eb]={'$like':'%'+_0x5afadb[_0xd041('0x34')][_0xd041('0x3d')]+'%'};return _0x376bca;})});}_0x297849=_[_0xd041('0x41')]({},_0x297849,_0x5afadb[_0xd041('0x42')]);return db[_0xd041('0x5a')][_0xd041('0x20')]({'where':_0x297849[_0xd041('0x3e')]})['then'](function(_0x2fb078){_0xfc07a1[_0xd041('0x20')]=_0x2fb078;if(_0x5afadb[_0xd041('0x34')][_0xd041('0x43')]){_0x297849['include']=[{'all':!![]}];}return db[_0xd041('0x5a')]['findAll'](_0x297849);})[_0xd041('0x27')](function(_0x575d8d){_0xfc07a1['rows']=_0x575d8d;return _0xfc07a1;});}})['then'](respondWithFilteredResult(_0x39b720,_0x297849))[_0xd041('0x49')](handleError(_0x39b720,null));};exports['getAnswers']=function(_0x2b8e9a,_0x1e40f1,_0x378fad){var _0xc8672a={'raw':!![],'where':{}};var _0x43b233={};var _0x54b7ef={'count':0x0,'rows':[]};return db[_0xd041('0x2f')][_0xd041('0x59')]({'where':{'id':_0x2b8e9a['params']['id']}})[_0xd041('0x27')](handleEntityNotFound(_0x1e40f1,null))[_0xd041('0x27')](function(_0x1668ad){if(_0x1668ad){_0x43b233[_0xd041('0x32')]=_[_0xd041('0x33')](db[_0xd041('0x5e')]['rawAttributes']);_0x43b233[_0xd041('0x34')]=_[_0xd041('0x33')](_0x2b8e9a[_0xd041('0x34')]);_0x43b233[_0xd041('0x35')]=_[_0xd041('0x36')](_0x43b233['model'],_0x43b233[_0xd041('0x34')]);_0xc8672a[_0xd041('0x37')]=_[_0xd041('0x36')](_0x43b233[_0xd041('0x32')],qs[_0xd041('0x38')](_0x2b8e9a[_0xd041('0x34')]['fields']));_0xc8672a['attributes']=_0xc8672a[_0xd041('0x37')][_0xd041('0x39')]?_0xc8672a[_0xd041('0x37')]:_0x43b233[_0xd041('0x32')];if(!_0x2b8e9a[_0xd041('0x34')][_0xd041('0x3a')](_0xd041('0x3b'))){_0xc8672a[_0xd041('0x1f')]=qs['limit'](_0x2b8e9a['query'][_0xd041('0x1f')]);_0xc8672a[_0xd041('0x1d')]=qs[_0xd041('0x1d')](_0x2b8e9a['query']['offset']);}_0xc8672a[_0xd041('0x5b')]=qs[_0xd041('0x3c')](_0x2b8e9a[_0xd041('0x34')][_0xd041('0x3c')]);_0xc8672a[_0xd041('0x3e')]=qs['filters'](_[_0xd041('0x5c')](_0x2b8e9a[_0xd041('0x34')],_0x43b233[_0xd041('0x35')]));_0xc8672a['where'][_0xd041('0x5d')]=_0x1668ad['id'];if(_0x2b8e9a[_0xd041('0x34')][_0xd041('0x3d')]){_0xc8672a[_0xd041('0x3e')]=_[_0xd041('0x41')](_0xc8672a[_0xd041('0x3e')],{'$or':_[_0xd041('0x3f')](_0xc8672a[_0xd041('0x37')],function(_0x50ad65){var _0x130ece={};_0x130ece[_0x50ad65]={'$like':'%'+_0x2b8e9a[_0xd041('0x34')][_0xd041('0x3d')]+'%'};return _0x130ece;})});}_0xc8672a=_[_0xd041('0x41')]({},_0xc8672a,_0x2b8e9a['options']);return db[_0xd041('0x5e')]['count']({'where':_0xc8672a['where']})[_0xd041('0x27')](function(_0x220cbc){_0x54b7ef['count']=_0x220cbc;if(_0x2b8e9a[_0xd041('0x34')][_0xd041('0x43')]){_0xc8672a[_0xd041('0x44')]=[{'all':!![]}];}return db[_0xd041('0x5e')][_0xd041('0x45')](_0xc8672a);})[_0xd041('0x27')](function(_0x2383b6){_0x54b7ef['rows']=_0x2383b6;return _0x54b7ef;});}})['then'](respondWithFilteredResult(_0x1e40f1,_0xc8672a))[_0xd041('0x49')](handleError(_0x1e40f1,null));};function char(_0x1aebd9){return _0xd041('0x5f')===typeof _0x1aebd9?String[_0xd041('0x60')][_0xd041('0x23')](null,arguments):_0x1aebd9;}function needsEncapsulation(_0x222393){return!!_0x222393&&(_0x222393[_0xd041('0x61')]()[_0xd041('0x62')](char(0xd))>=0x0||_0x222393[_0xd041('0x61')]()[_0xd041('0x62')](char(0xa))>=0x0||_0x222393[_0xd041('0x61')]()[_0xd041('0x62')](char(0x2c))>=0x0||_0x222393[_0xd041('0x61')]()[_0xd041('0x62')](char(0x22))>=0x0);}function encapsulate(_0x1f8c3d){var _0x29ce29=char(0x22),_0x84ce49='\x5c'+char(0x22),_0x47ae97=_0x1f8c3d[_0xd041('0x61')]()[_0xd041('0x63')](new RegExp(_0x29ce29,'g'),_0x84ce49);return _0x29ce29+_0x47ae97+_0x29ce29;}exports[_0xd041('0x64')]=function(_0x4fefac,_0x24f3aa,_0x52df61){var _0x227303,_0x5919d1;var _0x54ce18={'where':{'ProjectId':_0x4fefac[_0xd041('0x48')]['id']}};if(_0x4fefac[_0xd041('0x34')][_0xd041('0x65')]){_0x54ce18[_0xd041('0x3e')][_0xd041('0x66')]=JSON[_0xd041('0x67')](_0x4fefac[_0xd041('0x34')][_0xd041('0x65')]);}return db['JscriptySessionReport'][_0xd041('0x45')](_0x54ce18)['then'](handleEntityNotFound(_0x24f3aa,null))['then'](function(_0x353870){if(_0x353870){_0x227303=_0x353870;return db[_0xd041('0x68')][_0xd041('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x227303,'id')},'ProjectId':_0x4fefac['params']['id']},'order':_0xd041('0x69')});}})[_0xd041('0x27')](handleEntityNotFound(_0x24f3aa,null))[_0xd041('0x27')](function(_0x65aa34){if(_0x65aa34){_0x5919d1=_0x65aa34;var _0x36429c={};for(var _0x450aa7=0x0,_0x9b09f0=_0x5919d1[_0xd041('0x39')];_0x450aa7<_0x9b09f0;_0x450aa7++){if(!_0x36429c[_0xd041('0x3a')](_0x5919d1[_0x450aa7]['questionId'])){_0x36429c[_0x5919d1[_0x450aa7][_0xd041('0x6a')]]=needsEncapsulation(_0x5919d1[_0x450aa7][_0xd041('0x6b')])?encapsulate(_0x5919d1[_0x450aa7][_0xd041('0x6b')]):_0x5919d1[_0x450aa7][_0xd041('0x6b')];}}var _0x3dc796=[],_0x106e86={};for(var _0x17d138=0x0,_0x9e79b1=_0x227303['length'];_0x17d138<_0x9e79b1;_0x17d138++){_0x106e86={'ProjectId':_0x4fefac['params']['id'],'SessionId':_0x227303[_0x17d138]['id'],'StartTime':moment(_0x227303[_0x17d138]['starttime'])[_0xd041('0x6c')](_0xd041('0x6d'))};for(var _0x2c4306=0x0,_0x26bdd1=_0x5919d1[_0xd041('0x39')];_0x2c4306<_0x26bdd1;_0x2c4306++){if(_0x5919d1[_0x2c4306][_0xd041('0x6e')]==_0x227303[_0x17d138]['id']&&_0x36429c[_0xd041('0x3a')](_0x5919d1[_0x2c4306][_0xd041('0x6a')])){_0x106e86[_0x36429c[_0x5919d1[_0x2c4306][_0xd041('0x6a')]]]=_0x5919d1[_0x2c4306][_0xd041('0x6f')];}}for(var _0xbfb44d in _0x36429c){if(!_0x106e86['hasOwnProperty'](_0x36429c[_0xbfb44d])){_0x106e86[_0x36429c[_0xbfb44d]]=null;}}_0x3dc796[_0xd041('0x70')](_0x106e86);}return _0x3dc796;}})[_0xd041('0x27')](function(_0x34f43e){if(!_[_0xd041('0x71')](_0x34f43e)){var _0x4a7dbd=toCsv(_0x34f43e);var _0x3f091a=Date['now']();fs[_0xd041('0x72')](util[_0xd041('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4fefac[_0xd041('0x48')]['id'],_0x3f091a),_0x4a7dbd);_0x24f3aa[_0xd041('0x73')](_0xd041('0x74'),_0xd041('0x75')+util[_0xd041('0x6c')](_0xd041('0x76'),_0x4fefac[_0xd041('0x48')]['id'],_0x3f091a));_0x24f3aa['setHeader'](_0xd041('0x77'),'text/csv');return _0x24f3aa['download'](util[_0xd041('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4fefac[_0xd041('0x48')]['id'],_0x3f091a));}else{return _0x24f3aa[_0xd041('0x19')](0xcc);}})[_0xd041('0x49')](handleError(_0x24f3aa,null));}; \ No newline at end of file +var _0x95aa=['fromCharCode','toString','indexOf','replace','startTime','parse','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','user','UserProfileSection','getSessions','JscriptySessionReport','order','where','ProjectId','getAnswers','findOne','nolimit','JscriptyAnswerReport','number'];(function(_0x3d3e6a,_0x3ac662){var _0x389380=function(_0x2d7a18){while(--_0x2d7a18){_0x3d3e6a['push'](_0x3d3e6a['shift']());}};_0x389380(++_0x3ac662);}(_0x95aa,0x91));var _0xa95a=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x95aa[_0x5a1cc9];return _0x471761;};'use strict';var emlformat=require(_0xa95a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa95a('0x1'));var jsonpatch=require(_0xa95a('0x2'));var rp=require('request-promise');var moment=require(_0xa95a('0x3'));var BPromise=require(_0xa95a('0x4'));var Mustache=require(_0xa95a('0x5'));var util=require(_0xa95a('0x6'));var path=require(_0xa95a('0x7'));var sox=require(_0xa95a('0x8'));var csv=require(_0xa95a('0x9'));var ejs=require(_0xa95a('0xa'));var fs=require('fs');var fs_extra=require(_0xa95a('0xb'));var _=require('lodash');var squel=require(_0xa95a('0xc'));var crypto=require('crypto');var jsforce=require(_0xa95a('0xd'));var deskjs=require(_0xa95a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa95a('0xf'));var Redis=require(_0xa95a('0x10'));var authService=require(_0xa95a('0x11'));var qs=require(_0xa95a('0x12'));var as=require(_0xa95a('0x13'));var hardwareService=require(_0xa95a('0x14'));var logger=require(_0xa95a('0x15'))(_0xa95a('0x16'));var utils=require(_0xa95a('0x17'));var config=require(_0xa95a('0x18'));var licenseUtil=require(_0xa95a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd0db,_0x25ee8a){_0x25ee8a=_0x25ee8a||0xcc;return function(_0x4fbfc4){if(_0x4fbfc4){return _0x4dd0db[_0xa95a('0x1a')](_0x25ee8a);}return _0x4dd0db[_0xa95a('0x1b')](_0x25ee8a)[_0xa95a('0x1c')]();};}function respondWithResult(_0x23b41c,_0xa26339){_0xa26339=_0xa26339||0xc8;return function(_0x32dd48){if(_0x32dd48){return _0x23b41c[_0xa95a('0x1b')](_0xa26339)[_0xa95a('0x1d')](_0x32dd48);}};}function respondWithFilteredResult(_0x3265c5,_0x235e81){return function(_0x4c94a1){if(_0x4c94a1){var _0x1d60f7=typeof _0x235e81[_0xa95a('0x1e')]==='undefined'&&typeof _0x235e81[_0xa95a('0x1f')]===_0xa95a('0x20');var _0x44942d=_0x4c94a1[_0xa95a('0x21')];var _0x59aca9=_0x1d60f7?0x0:_0x235e81[_0xa95a('0x1e')];var _0x52be20=_0x1d60f7?_0x4c94a1[_0xa95a('0x21')]:_0x235e81[_0xa95a('0x1e')]+_0x235e81[_0xa95a('0x1f')];var _0x2e31a8;if(_0x52be20>=_0x44942d){_0x52be20=_0x44942d;_0x2e31a8=0xc8;}else{_0x2e31a8=0xce;}_0x3265c5[_0xa95a('0x1b')](_0x2e31a8);return _0x3265c5[_0xa95a('0x22')](_0xa95a('0x23'),_0x59aca9+'-'+_0x52be20+'/'+_0x44942d)[_0xa95a('0x1d')](_0x4c94a1);}return null;};}function patchUpdates(_0x26a3be){return function(_0x4004ef){try{jsonpatch[_0xa95a('0x24')](_0x4004ef,_0x26a3be,!![]);}catch(_0x4cd002){return BPromise[_0xa95a('0x25')](_0x4cd002);}return _0x4004ef[_0xa95a('0x26')]();};}function saveUpdates(_0x24b05c,_0x25355c){return function(_0x64522e){if(_0x64522e){return _0x64522e['update'](_0x24b05c)['then'](function(_0x3fdfef){return _0x3fdfef;});}return null;};}function removeEntity(_0xd27cab,_0xe930d2){return function(_0x24b33b){if(_0x24b33b){return _0x24b33b[_0xa95a('0x27')]()[_0xa95a('0x28')](function(){var _0x332aca=_0x24b33b[_0xa95a('0x29')]({'plain':!![]});var _0x3d27fc=_0xa95a('0x2a');return db[_0xa95a('0x2b')][_0xa95a('0x27')]({'where':{'type':_0x3d27fc,'resourceId':_0x332aca['id']}})[_0xa95a('0x28')](function(){return _0x24b33b;});})[_0xa95a('0x28')](function(){_0xd27cab['status'](0xcc)[_0xa95a('0x1c')]();});}};}function handleEntityNotFound(_0xa541a,_0x913f65){return function(_0x912d98){if(!_0x912d98){_0xa541a[_0xa95a('0x1a')](0x194);}return _0x912d98;};}function handleError(_0xdf3cce,_0x127fbd){_0x127fbd=_0x127fbd||0x1f4;return function(_0x161c25){logger[_0xa95a('0x2c')](_0x161c25[_0xa95a('0x2d')]);if(_0x161c25['name']){delete _0x161c25[_0xa95a('0x2e')];}_0xdf3cce['status'](_0x127fbd)['send'](_0x161c25);};}exports[_0xa95a('0x2f')]=function(_0x11f114,_0x558ab4){var _0x552afd={},_0x154688={},_0x199464={'count':0x0,'rows':[]};var _0x2258be=_[_0xa95a('0x30')](db[_0xa95a('0x31')][_0xa95a('0x32')],function(_0x18ae1a){return{'name':_0x18ae1a[_0xa95a('0x33')],'type':_0x18ae1a['type'][_0xa95a('0x34')]};});_0x154688[_0xa95a('0x35')]=_[_0xa95a('0x30')](_0x2258be,_0xa95a('0x2e'));_0x154688[_0xa95a('0x36')]=_[_0xa95a('0x37')](_0x11f114[_0xa95a('0x36')]);_0x154688[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x154688['model'],_0x154688[_0xa95a('0x36')]);_0x552afd['attributes']=_[_0xa95a('0x39')](_0x154688[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x11f114['query'][_0xa95a('0x3a')]));_0x552afd[_0xa95a('0x3b')]=_0x552afd[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x552afd[_0xa95a('0x3b')]:_0x154688[_0xa95a('0x35')];if(!_0x11f114[_0xa95a('0x36')][_0xa95a('0x3d')]('nolimit')){_0x552afd['limit']=qs[_0xa95a('0x1f')](_0x11f114[_0xa95a('0x36')][_0xa95a('0x1f')]);_0x552afd['offset']=qs[_0xa95a('0x1e')](_0x11f114['query'][_0xa95a('0x1e')]);}_0x552afd['order']=qs[_0xa95a('0x3e')](_0x11f114[_0xa95a('0x36')]['sort']);_0x552afd['where']=qs[_0xa95a('0x38')](_[_0xa95a('0x3f')](_0x11f114['query'],_0x154688['filters']),_0x2258be);if(_0x11f114[_0xa95a('0x36')]['filter']){_0x552afd['where']=_['merge'](_0x552afd['where'],{'$or':_[_0xa95a('0x30')](_0x2258be,function(_0x32ee4b){if(_0x32ee4b[_0xa95a('0x40')]!==_0xa95a('0x41')){var _0x14a88f={};_0x14a88f[_0x32ee4b['name']]={'$like':'%'+_0x11f114[_0xa95a('0x36')][_0xa95a('0x42')]+'%'};return _0x14a88f;}})});}_0x552afd=_[_0xa95a('0x43')]({},_0x552afd,_0x11f114[_0xa95a('0x44')]);var _0x14bf44={'where':_0x552afd['where']};return db['JscriptyProject'][_0xa95a('0x21')](_0x14bf44)[_0xa95a('0x28')](function(_0x5b86fc){_0x199464[_0xa95a('0x21')]=_0x5b86fc;if(_0x11f114[_0xa95a('0x36')][_0xa95a('0x45')]){_0x552afd[_0xa95a('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa95a('0x47')](_0x552afd);})[_0xa95a('0x28')](function(_0x418198){_0x199464[_0xa95a('0x48')]=_0x418198;return _0x199464;})['then'](respondWithFilteredResult(_0x558ab4,_0x552afd))[_0xa95a('0x49')](handleError(_0x558ab4,null));};exports[_0xa95a('0x4a')]=function(_0x343471,_0x451e86){var _0x3f7cd9={'raw':![],'where':{'id':_0x343471[_0xa95a('0x4b')]['id']}},_0x40cdba={};_0x40cdba[_0xa95a('0x35')]=_[_0xa95a('0x37')](db[_0xa95a('0x31')][_0xa95a('0x32')]);_0x40cdba['query']=_[_0xa95a('0x37')](_0x343471['query']);_0x40cdba[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x40cdba[_0xa95a('0x35')],_0x40cdba[_0xa95a('0x36')]);_0x3f7cd9[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x40cdba[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x343471[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x3f7cd9[_0xa95a('0x3b')]=_0x3f7cd9[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x3f7cd9['attributes']:_0x40cdba[_0xa95a('0x35')];if(_0x343471[_0xa95a('0x36')]['includeAll']){_0x3f7cd9[_0xa95a('0x46')]=[{'all':!![]}];}_0x3f7cd9=_[_0xa95a('0x43')]({},_0x3f7cd9,_0x343471[_0xa95a('0x44')]);return db[_0xa95a('0x31')][_0xa95a('0x4c')](_0x3f7cd9)[_0xa95a('0x28')](handleEntityNotFound(_0x451e86,null))[_0xa95a('0x28')](respondWithResult(_0x451e86,null))[_0xa95a('0x49')](handleError(_0x451e86,null));};exports[_0xa95a('0x4d')]=function(_0x19c6e1,_0x2494c5){return db['JscriptyProject']['create'](_0x19c6e1[_0xa95a('0x4e')],{})[_0xa95a('0x28')](function(_0x1b8304){var _0x189d9f=_0x19c6e1['user'][_0xa95a('0x29')]({'plain':!![]});if(!_0x189d9f)throw new Error(_0xa95a('0x4f'));if(_0x189d9f[_0xa95a('0x50')]==='user'){var _0x1321cc=_0x1b8304[_0xa95a('0x29')]({'plain':!![]});var _0x23b322=_0xa95a('0x2a');return db['UserProfileSection'][_0xa95a('0x4c')]({'where':{'name':_0x23b322,'userProfileId':_0x189d9f[_0xa95a('0x51')]},'raw':!![]})[_0xa95a('0x28')](function(_0x3c1785){if(_0x3c1785&&_0x3c1785['autoAssociation']===0x0){return db[_0xa95a('0x2b')]['create']({'name':_0x1321cc[_0xa95a('0x2e')],'resourceId':_0x1321cc['id'],'type':_0x3c1785['name'],'sectionId':_0x3c1785['id']},{})['then'](function(){return _0x1b8304;});}else{return _0x1b8304;}})[_0xa95a('0x49')](function(_0x3a95d4){logger[_0xa95a('0x2c')](_0xa95a('0x52'),_0x3a95d4);throw _0x3a95d4;});}return _0x1b8304;})['then'](respondWithResult(_0x2494c5,0xc9))['catch'](handleError(_0x2494c5,null));};exports[_0xa95a('0x53')]=function(_0x597ae1,_0x38c97e){var _0x56df2e={'where':{'id':_0x597ae1[_0xa95a('0x4b')]['id']}},_0x3c6627={};_0x3c6627[_0xa95a('0x35')]=_[_0xa95a('0x37')](db[_0xa95a('0x31')]['rawAttributes']);_0x56df2e[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x3c6627['model'],qs['fields'](_0x597ae1[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x56df2e[_0xa95a('0x3b')]=_0x56df2e[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x56df2e['attributes']:_0x3c6627[_0xa95a('0x35')];if(_0x597ae1[_0xa95a('0x36')][_0xa95a('0x45')]){_0x56df2e['include']=[{'all':!![]}];}_0x56df2e=_['merge']({},_0x56df2e,_0x597ae1[_0xa95a('0x44')]);return db['JscriptyProject']['find'](_0x56df2e)[_0xa95a('0x28')](handleEntityNotFound(_0x38c97e,null))['then'](function(_0x2076e5){if(_0x2076e5){var _0x448145=_0x2076e5['get']({'plain':!![]});_0x448145=qs['omit'](_0x448145,['id',_0xa95a('0x54'),_0xa95a('0x55')]);_0x597ae1[_0xa95a('0x4e')]=_[_0xa95a('0x56')](_0x597ae1[_0xa95a('0x4e')],['id',_0xa95a('0x54'),_0xa95a('0x55')]);return db[_0xa95a('0x31')][_0xa95a('0x4d')](_[_0xa95a('0x43')](_0x448145,_0x597ae1['body']),{'include':_0x597ae1['query'][_0xa95a('0x45')]?[{'all':!![]}]:undefined})[_0xa95a('0x28')](function(_0x4b5913){var _0x17bd25=_0x597ae1[_0xa95a('0x57')][_0xa95a('0x29')]({'plain':!![]});if(!_0x17bd25)throw new Error(_0xa95a('0x4f'));if(_0x17bd25[_0xa95a('0x50')]===_0xa95a('0x57')){var _0x4045f8=_0x4b5913['get']({'plain':!![]});var _0x3b909d=_0xa95a('0x2a');return db[_0xa95a('0x58')][_0xa95a('0x4c')]({'where':{'name':_0x3b909d,'userProfileId':_0x17bd25[_0xa95a('0x51')]},'raw':!![]})[_0xa95a('0x28')](function(_0x318b12){if(_0x318b12&&_0x318b12['autoAssociation']===0x0){return db[_0xa95a('0x2b')][_0xa95a('0x4d')]({'name':_0x4045f8['name'],'resourceId':_0x4045f8['id'],'type':_0x318b12[_0xa95a('0x2e')],'sectionId':_0x318b12['id']},{})[_0xa95a('0x28')](function(){return _0x4b5913;});}else{return _0x4b5913;}})[_0xa95a('0x49')](function(_0x2a2fc5){logger[_0xa95a('0x2c')](_0xa95a('0x52'),_0x2a2fc5);throw _0x2a2fc5;});}return _0x4b5913;});}})[_0xa95a('0x28')](respondWithResult(_0x38c97e,0xc9))['catch'](handleError(_0x38c97e,null));};exports['update']=function(_0x33869e,_0x12897f){if(_0x33869e[_0xa95a('0x4e')]['id']){delete _0x33869e['body']['id'];}return db[_0xa95a('0x31')][_0xa95a('0x4c')]({'where':{'id':_0x33869e['params']['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0x12897f,null))[_0xa95a('0x28')](saveUpdates(_0x33869e[_0xa95a('0x4e')],null))[_0xa95a('0x28')](respondWithResult(_0x12897f,null))['catch'](handleError(_0x12897f,null));};exports[_0xa95a('0x27')]=function(_0x3dda70,_0x394038){return db[_0xa95a('0x31')][_0xa95a('0x4c')]({'where':{'id':_0x3dda70[_0xa95a('0x4b')]['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0x394038,null))[_0xa95a('0x28')](removeEntity(_0x394038,null))[_0xa95a('0x49')](handleError(_0x394038,null));};exports[_0xa95a('0x59')]=function(_0x572cb5,_0xfc400a,_0x3d4d81){var _0x3c8c75={'raw':!![],'where':{}};var _0x4ea5aa={};var _0x5170f9={'count':0x0,'rows':[]};return db[_0xa95a('0x31')]['findOne']({'where':{'id':_0x572cb5[_0xa95a('0x4b')]['id']}})[_0xa95a('0x28')](handleEntityNotFound(_0xfc400a,null))[_0xa95a('0x28')](function(_0x3aeea0){if(_0x3aeea0){_0x4ea5aa['model']=_[_0xa95a('0x37')](db[_0xa95a('0x5a')][_0xa95a('0x32')]);_0x4ea5aa[_0xa95a('0x36')]=_[_0xa95a('0x37')](_0x572cb5[_0xa95a('0x36')]);_0x4ea5aa[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x4ea5aa[_0xa95a('0x35')],_0x4ea5aa[_0xa95a('0x36')]);_0x3c8c75['attributes']=_[_0xa95a('0x39')](_0x4ea5aa[_0xa95a('0x35')],qs[_0xa95a('0x3a')](_0x572cb5[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x3c8c75['attributes']=_0x3c8c75[_0xa95a('0x3b')][_0xa95a('0x3c')]?_0x3c8c75[_0xa95a('0x3b')]:_0x4ea5aa['model'];if(!_0x572cb5['query']['hasOwnProperty']('nolimit')){_0x3c8c75[_0xa95a('0x1f')]=qs[_0xa95a('0x1f')](_0x572cb5[_0xa95a('0x36')]['limit']);_0x3c8c75[_0xa95a('0x1e')]=qs[_0xa95a('0x1e')](_0x572cb5[_0xa95a('0x36')][_0xa95a('0x1e')]);}_0x3c8c75[_0xa95a('0x5b')]=qs[_0xa95a('0x3e')](_0x572cb5['query'][_0xa95a('0x3e')]);_0x3c8c75[_0xa95a('0x5c')]=qs[_0xa95a('0x38')](_['pick'](_0x572cb5[_0xa95a('0x36')],_0x4ea5aa['filters']));_0x3c8c75[_0xa95a('0x5c')][_0xa95a('0x5d')]=_0x3aeea0['id'];if(_0x572cb5[_0xa95a('0x36')]['filter']){_0x3c8c75['where']=_[_0xa95a('0x43')](_0x3c8c75['where'],{'$or':_[_0xa95a('0x30')](_0x3c8c75[_0xa95a('0x3b')],function(_0x56f52b){var _0x3528af={};_0x3528af[_0x56f52b]={'$like':'%'+_0x572cb5[_0xa95a('0x36')][_0xa95a('0x42')]+'%'};return _0x3528af;})});}_0x3c8c75=_[_0xa95a('0x43')]({},_0x3c8c75,_0x572cb5[_0xa95a('0x44')]);return db['JscriptySessionReport'][_0xa95a('0x21')]({'where':_0x3c8c75['where']})[_0xa95a('0x28')](function(_0x4f7936){_0x5170f9[_0xa95a('0x21')]=_0x4f7936;if(_0x572cb5[_0xa95a('0x36')]['includeAll']){_0x3c8c75[_0xa95a('0x46')]=[{'all':!![]}];}return db[_0xa95a('0x5a')][_0xa95a('0x47')](_0x3c8c75);})['then'](function(_0x3096c1){_0x5170f9[_0xa95a('0x48')]=_0x3096c1;return _0x5170f9;});}})['then'](respondWithFilteredResult(_0xfc400a,_0x3c8c75))[_0xa95a('0x49')](handleError(_0xfc400a,null));};exports[_0xa95a('0x5e')]=function(_0xb46903,_0x27ceeb,_0x110d4a){var _0x111519={'raw':!![],'where':{}};var _0x4d89de={};var _0x1984f4={'count':0x0,'rows':[]};return db[_0xa95a('0x31')][_0xa95a('0x5f')]({'where':{'id':_0xb46903['params']['id']}})['then'](handleEntityNotFound(_0x27ceeb,null))['then'](function(_0x160cb7){if(_0x160cb7){_0x4d89de[_0xa95a('0x35')]=_[_0xa95a('0x37')](db['JscriptyAnswerReport'][_0xa95a('0x32')]);_0x4d89de[_0xa95a('0x36')]=_['keys'](_0xb46903['query']);_0x4d89de[_0xa95a('0x38')]=_[_0xa95a('0x39')](_0x4d89de[_0xa95a('0x35')],_0x4d89de[_0xa95a('0x36')]);_0x111519[_0xa95a('0x3b')]=_[_0xa95a('0x39')](_0x4d89de[_0xa95a('0x35')],qs['fields'](_0xb46903[_0xa95a('0x36')][_0xa95a('0x3a')]));_0x111519[_0xa95a('0x3b')]=_0x111519[_0xa95a('0x3b')]['length']?_0x111519['attributes']:_0x4d89de[_0xa95a('0x35')];if(!_0xb46903[_0xa95a('0x36')][_0xa95a('0x3d')](_0xa95a('0x60'))){_0x111519[_0xa95a('0x1f')]=qs[_0xa95a('0x1f')](_0xb46903['query'][_0xa95a('0x1f')]);_0x111519[_0xa95a('0x1e')]=qs[_0xa95a('0x1e')](_0xb46903[_0xa95a('0x36')][_0xa95a('0x1e')]);}_0x111519['order']=qs[_0xa95a('0x3e')](_0xb46903['query'][_0xa95a('0x3e')]);_0x111519[_0xa95a('0x5c')]=qs[_0xa95a('0x38')](_[_0xa95a('0x3f')](_0xb46903[_0xa95a('0x36')],_0x4d89de[_0xa95a('0x38')]));_0x111519[_0xa95a('0x5c')][_0xa95a('0x5d')]=_0x160cb7['id'];if(_0xb46903['query'][_0xa95a('0x42')]){_0x111519[_0xa95a('0x5c')]=_[_0xa95a('0x43')](_0x111519[_0xa95a('0x5c')],{'$or':_[_0xa95a('0x30')](_0x111519[_0xa95a('0x3b')],function(_0x4a1a30){var _0x4a3c7b={};_0x4a3c7b[_0x4a1a30]={'$like':'%'+_0xb46903['query'][_0xa95a('0x42')]+'%'};return _0x4a3c7b;})});}_0x111519=_['merge']({},_0x111519,_0xb46903[_0xa95a('0x44')]);return db[_0xa95a('0x61')][_0xa95a('0x21')]({'where':_0x111519[_0xa95a('0x5c')]})[_0xa95a('0x28')](function(_0x5205e6){_0x1984f4[_0xa95a('0x21')]=_0x5205e6;if(_0xb46903[_0xa95a('0x36')][_0xa95a('0x45')]){_0x111519[_0xa95a('0x46')]=[{'all':!![]}];}return db[_0xa95a('0x61')][_0xa95a('0x47')](_0x111519);})['then'](function(_0x1c6731){_0x1984f4[_0xa95a('0x48')]=_0x1c6731;return _0x1984f4;});}})[_0xa95a('0x28')](respondWithFilteredResult(_0x27ceeb,_0x111519))[_0xa95a('0x49')](handleError(_0x27ceeb,null));};function char(_0x1aac1f){return _0xa95a('0x62')===typeof _0x1aac1f?String[_0xa95a('0x63')]['apply'](null,arguments):_0x1aac1f;}function needsEncapsulation(_0x2317d6){return!!_0x2317d6&&(_0x2317d6[_0xa95a('0x64')]()[_0xa95a('0x65')](char(0xd))>=0x0||_0x2317d6[_0xa95a('0x64')]()['indexOf'](char(0xa))>=0x0||_0x2317d6['toString']()['indexOf'](char(0x2c))>=0x0||_0x2317d6[_0xa95a('0x64')]()[_0xa95a('0x65')](char(0x22))>=0x0);}function encapsulate(_0x5ce647){var _0x13516e=char(0x22),_0x5e6841='\x5c'+char(0x22),_0x12bc64=_0x5ce647[_0xa95a('0x64')]()[_0xa95a('0x66')](new RegExp(_0x13516e,'g'),_0x5e6841);return _0x13516e+_0x12bc64+_0x13516e;}exports['getSummary']=function(_0x1f97dd,_0x33dbdb,_0x4010e5){var _0x14ca65,_0x495257;var _0x56f5a2={'where':{'ProjectId':_0x1f97dd[_0xa95a('0x4b')]['id']}};if(_0x1f97dd['query'][_0xa95a('0x67')]){_0x56f5a2[_0xa95a('0x5c')]['starttime']=JSON[_0xa95a('0x68')](_0x1f97dd[_0xa95a('0x36')][_0xa95a('0x67')]);}return db[_0xa95a('0x5a')][_0xa95a('0x47')](_0x56f5a2)[_0xa95a('0x28')](handleEntityNotFound(_0x33dbdb,null))[_0xa95a('0x28')](function(_0x4f7eb4){if(_0x4f7eb4){_0x14ca65=_0x4f7eb4;return db['JscriptyQuestionReport'][_0xa95a('0x47')]({'where':{'SessionId':{'$in':_[_0xa95a('0x30')](_0x14ca65,'id')},'ProjectId':_0x1f97dd['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x33dbdb,null))[_0xa95a('0x28')](function(_0x475913){if(_0x475913){_0x495257=_0x475913;var _0x14a8d7={};for(var _0x70499f=0x0,_0x1282bb=_0x495257[_0xa95a('0x3c')];_0x70499f<_0x1282bb;_0x70499f++){if(!_0x14a8d7['hasOwnProperty'](_0x495257[_0x70499f][_0xa95a('0x69')])){_0x14a8d7[_0x495257[_0x70499f][_0xa95a('0x69')]]=needsEncapsulation(_0x495257[_0x70499f][_0xa95a('0x6a')])?encapsulate(_0x495257[_0x70499f]['question']):_0x495257[_0x70499f][_0xa95a('0x6a')];}}var _0x5379d9=[],_0x340255={};for(var _0x4c9632=0x0,_0xb6e6b6=_0x14ca65[_0xa95a('0x3c')];_0x4c9632<_0xb6e6b6;_0x4c9632++){_0x340255={'ProjectId':_0x1f97dd[_0xa95a('0x4b')]['id'],'SessionId':_0x14ca65[_0x4c9632]['id'],'StartTime':moment(_0x14ca65[_0x4c9632][_0xa95a('0x6b')])[_0xa95a('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1d0648=0x0,_0x50bb13=_0x495257[_0xa95a('0x3c')];_0x1d0648<_0x50bb13;_0x1d0648++){if(_0x495257[_0x1d0648][_0xa95a('0x6d')]==_0x14ca65[_0x4c9632]['id']&&_0x14a8d7[_0xa95a('0x3d')](_0x495257[_0x1d0648]['questionId'])){_0x340255[_0x14a8d7[_0x495257[_0x1d0648][_0xa95a('0x69')]]]=_0x495257[_0x1d0648][_0xa95a('0x6e')];}}for(var _0x38b71a in _0x14a8d7){if(!_0x340255[_0xa95a('0x3d')](_0x14a8d7[_0x38b71a])){_0x340255[_0x14a8d7[_0x38b71a]]=null;}}_0x5379d9[_0xa95a('0x6f')](_0x340255);}return _0x5379d9;}})[_0xa95a('0x28')](function(_0x28b90e){if(!_[_0xa95a('0x70')](_0x28b90e)){var _0x59e3a8=toCsv(_0x28b90e);var _0x26f48e=Date['now']();fs[_0xa95a('0x71')](util[_0xa95a('0x6c')](_0xa95a('0x72'),_0x1f97dd[_0xa95a('0x4b')]['id'],_0x26f48e),_0x59e3a8);_0x33dbdb[_0xa95a('0x73')](_0xa95a('0x74'),_0xa95a('0x75')+util[_0xa95a('0x6c')](_0xa95a('0x76'),_0x1f97dd['params']['id'],_0x26f48e));_0x33dbdb[_0xa95a('0x73')](_0xa95a('0x77'),_0xa95a('0x78'));return _0x33dbdb[_0xa95a('0x79')](util[_0xa95a('0x6c')](_0xa95a('0x72'),_0x1f97dd[_0xa95a('0x4b')]['id'],_0x26f48e));}else{return _0x33dbdb['sendStatus'](0xcc);}})[_0xa95a('0x49')](handleError(_0x33dbdb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 42ec220..4ba2378 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 _0x9d92=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','api','moment','request-promise','path'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x9d92,0xdf));var _0x29d9=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x9d92[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x29d9('0x1'));var moment=require(_0x29d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d9('0x3'));var fs=require('fs');var path=require(_0x29d9('0x4'));var rimraf=require(_0x29d9('0x5'));var config=require(_0x29d9('0x6'));var attributes=require(_0x29d9('0x7'));module[_0x29d9('0x8')]=function(_0x27d032,_0x52932b){return _0x27d032[_0x29d9('0x9')](_0x29d9('0xa'),attributes,{'tableName':_0x29d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8098=['define','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x8098,0x1ba));var _0x8809=function(_0x2414a4,_0x40295){_0x2414a4=_0x2414a4-0x0;var _0x2520fb=_0x8098[_0x2414a4];return _0x2520fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8809('0x0'))(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rp=require(_0x8809('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var attributes=require(_0x8809('0x7'));module[_0x8809('0x8')]=function(_0x5804f0,_0xeb811){return _0x5804f0[_0x8809('0x9')]('JscriptyProject',attributes,{'tableName':_0x8809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9ca9778..b38a2da 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(_0x58acb6,_0x161add){var _0x4aaf04=function(_0x1d3363){while(--_0x1d3363){_0x58acb6['push'](_0x58acb6['shift']());}};_0x4aaf04(++_0x161add);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xcb91[_0x3dea7d];return _0x53919a;};'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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x16fd24,_0x55dd7f){_0x16fd24=_0x16fd24-0x0;var _0x5a2b0d=_0xac4a[_0x16fd24];return _0x5a2b0d;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d860e88..ad5fb1f 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 _0x30b8=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d49c6,_0x14bea9){var _0x49fea7=function(_0x33f0f6){while(--_0x33f0f6){_0x1d49c6['push'](_0x1d49c6['shift']());}};_0x49fea7(++_0x14bea9);}(_0x30b8,0xc0));var _0x830b=function(_0x3e90a7,_0x44f422){_0x3e90a7=_0x3e90a7-0x0;var _0x375f1c=_0x30b8[_0x3e90a7];return _0x375f1c;};'use strict';var multer=require('multer');var util=require(_0x830b('0x0'));var path=require('path');var timeout=require(_0x830b('0x1'));var express=require(_0x830b('0x2'));var router=express[_0x830b('0x3')]();var fs_extra=require(_0x830b('0x4'));var auth=require(_0x830b('0x5'));var interaction=require(_0x830b('0x6'));var config=require(_0x830b('0x7'));var controller=require(_0x830b('0x8'));router[_0x830b('0x9')]('/',auth[_0x830b('0xa')](),controller[_0x830b('0xb')]);router[_0x830b('0x9')](_0x830b('0xc'),auth[_0x830b('0xa')](),controller[_0x830b('0xd')]);router[_0x830b('0x9')](_0x830b('0xe'),auth[_0x830b('0xa')](),controller[_0x830b('0xf')]);router[_0x830b('0x10')]('/',auth[_0x830b('0xa')](),controller[_0x830b('0x11')]);router[_0x830b('0x12')](_0x830b('0xe'),auth[_0x830b('0xa')](),controller['update']);router[_0x830b('0x13')]('/:id',auth[_0x830b('0xa')](),controller[_0x830b('0x14')]);module[_0x830b('0x15')]=router; \ No newline at end of file +var _0x1278=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x44f227,_0x82a21d){var _0x5b3928=function(_0x280ade){while(--_0x280ade){_0x44f227['push'](_0x44f227['shift']());}};_0x5b3928(++_0x82a21d);}(_0x1278,0x7e));var _0x8127=function(_0x390c42,_0x10e1ae){_0x390c42=_0x390c42-0x0;var _0x43894c=_0x1278[_0x390c42];return _0x43894c;};'use strict';var multer=require(_0x8127('0x0'));var util=require(_0x8127('0x1'));var path=require(_0x8127('0x2'));var timeout=require(_0x8127('0x3'));var express=require(_0x8127('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8127('0x5'));var interaction=require(_0x8127('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x8127('0x7')](),controller[_0x8127('0x8')]);router[_0x8127('0x9')](_0x8127('0xa'),auth[_0x8127('0x7')](),controller[_0x8127('0xb')]);router[_0x8127('0x9')](_0x8127('0xc'),auth['isAuthenticated'](),controller[_0x8127('0xd')]);router['post']('/',auth[_0x8127('0x7')](),controller[_0x8127('0xe')]);router[_0x8127('0xf')](_0x8127('0xc'),auth[_0x8127('0x7')](),controller[_0x8127('0x10')]);router[_0x8127('0x11')](_0x8127('0xc'),auth[_0x8127('0x7')](),controller[_0x8127('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e8cac63..4a655c3 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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x378440,_0x81fe4b){_0x378440=_0x378440-0x0;var _0x12761f=_0x7a54[_0x378440];return _0x12761f;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x3385af,_0x528180){_0x3385af=_0x3385af-0x0;var _0x38b010=_0x7a54[_0x3385af];return _0x38b010;};'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 d9a87f7..c4e2fb1 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 _0xa86e=['find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show'];(function(_0x53e4b5,_0x25c646){var _0xe40d4=function(_0x3ce854){while(--_0x3ce854){_0x53e4b5['push'](_0x53e4b5['shift']());}};_0xe40d4(++_0x25c646);}(_0xa86e,0x1c7));var _0xea86=function(_0x18700f,_0x2e2c4b){_0x18700f=_0x18700f-0x0;var _0x45302d=_0xa86e[_0x18700f];return _0x45302d;};'use strict';var emlformat=require(_0xea86('0x0'));var rimraf=require(_0xea86('0x1'));var zipdir=require(_0xea86('0x2'));var jsonpatch=require(_0xea86('0x3'));var rp=require(_0xea86('0x4'));var moment=require('moment');var BPromise=require(_0xea86('0x5'));var Mustache=require(_0xea86('0x6'));var util=require('util');var path=require(_0xea86('0x7'));var sox=require(_0xea86('0x8'));var csv=require(_0xea86('0x9'));var ejs=require(_0xea86('0xa'));var fs=require('fs');var fs_extra=require(_0xea86('0xb'));var _=require(_0xea86('0xc'));var squel=require(_0xea86('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea86('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea86('0xf'));var Papa=require(_0xea86('0x10'));var Redis=require('ioredis');var authService=require(_0xea86('0x11'));var qs=require(_0xea86('0x12'));var as=require(_0xea86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea86('0x14'));var utils=require(_0xea86('0x15'));var config=require(_0xea86('0x16'));var licenseUtil=require(_0xea86('0x17'));var db=require(_0xea86('0x18'))['db'];function respondWithStatusCode(_0x433a32,_0xc68d40){_0xc68d40=_0xc68d40||0xcc;return function(_0x4a1b0c){if(_0x4a1b0c){return _0x433a32['sendStatus'](_0xc68d40);}return _0x433a32[_0xea86('0x19')](_0xc68d40)['end']();};}function respondWithResult(_0x5c7d8f,_0x26345d){_0x26345d=_0x26345d||0xc8;return function(_0x4ccaf0){if(_0x4ccaf0){return _0x5c7d8f[_0xea86('0x19')](_0x26345d)['json'](_0x4ccaf0);}};}function respondWithFilteredResult(_0x189fea,_0x2a48c0){return function(_0xaa4458){if(_0xaa4458){var _0x14f3d0=typeof _0x2a48c0[_0xea86('0x1a')]===_0xea86('0x1b')&&typeof _0x2a48c0[_0xea86('0x1c')]===_0xea86('0x1b');var _0x4e3fe3=_0xaa4458[_0xea86('0x1d')];var _0x2c6aa0=_0x14f3d0?0x0:_0x2a48c0[_0xea86('0x1a')];var _0x418150=_0x14f3d0?_0xaa4458[_0xea86('0x1d')]:_0x2a48c0[_0xea86('0x1a')]+_0x2a48c0['limit'];var _0x21bf9e;if(_0x418150>=_0x4e3fe3){_0x418150=_0x4e3fe3;_0x21bf9e=0xc8;}else{_0x21bf9e=0xce;}_0x189fea['status'](_0x21bf9e);return _0x189fea[_0xea86('0x1e')](_0xea86('0x1f'),_0x2c6aa0+'-'+_0x418150+'/'+_0x4e3fe3)['json'](_0xaa4458);}return null;};}function patchUpdates(_0x55d54b){return function(_0x55ae60){try{jsonpatch[_0xea86('0x20')](_0x55ae60,_0x55d54b,!![]);}catch(_0x1bdf1b){return BPromise[_0xea86('0x21')](_0x1bdf1b);}return _0x55ae60[_0xea86('0x22')]();};}function saveUpdates(_0x20724a,_0x4336e1){return function(_0x4b50e4){if(_0x4b50e4){return _0x4b50e4[_0xea86('0x23')](_0x20724a)['then'](function(_0x42b2ad){return _0x42b2ad;});}return null;};}function removeEntity(_0x56490a,_0x5ea8a9){return function(_0x1bc115){if(_0x1bc115){return _0x1bc115[_0xea86('0x24')]()[_0xea86('0x25')](function(){_0x56490a['status'](0xcc)[_0xea86('0x26')]();});}};}function handleEntityNotFound(_0x142e0b,_0x4e98c5){return function(_0x57412e){if(!_0x57412e){_0x142e0b[_0xea86('0x27')](0x194);}return _0x57412e;};}function handleError(_0x1c3c71,_0x3b6c23){_0x3b6c23=_0x3b6c23||0x1f4;return function(_0x4c8a23){logger['error'](_0x4c8a23[_0xea86('0x28')]);if(_0x4c8a23[_0xea86('0x29')]){delete _0x4c8a23[_0xea86('0x29')];}_0x1c3c71[_0xea86('0x19')](_0x3b6c23)['send'](_0x4c8a23);};}exports[_0xea86('0x2a')]=function(_0x94d7d1,_0x3145c3){var _0x4d3851={},_0xd11b9={},_0x270ff1={'count':0x0,'rows':[]};var _0x5d0ab5=_[_0xea86('0x2b')](db[_0xea86('0x2c')][_0xea86('0x2d')],function(_0x5ed09b){return{'name':_0x5ed09b[_0xea86('0x2e')],'type':_0x5ed09b[_0xea86('0x2f')]['key']};});_0xd11b9['model']=_['map'](_0x5d0ab5,_0xea86('0x29'));_0xd11b9[_0xea86('0x30')]=_[_0xea86('0x31')](_0x94d7d1['query']);_0xd11b9[_0xea86('0x32')]=_[_0xea86('0x33')](_0xd11b9[_0xea86('0x34')],_0xd11b9['query']);_0x4d3851[_0xea86('0x35')]=_[_0xea86('0x33')](_0xd11b9[_0xea86('0x34')],qs[_0xea86('0x36')](_0x94d7d1[_0xea86('0x30')][_0xea86('0x36')]));_0x4d3851['attributes']=_0x4d3851[_0xea86('0x35')][_0xea86('0x37')]?_0x4d3851[_0xea86('0x35')]:_0xd11b9['model'];if(!_0x94d7d1[_0xea86('0x30')][_0xea86('0x38')](_0xea86('0x39'))){_0x4d3851[_0xea86('0x1c')]=qs[_0xea86('0x1c')](_0x94d7d1[_0xea86('0x30')]['limit']);_0x4d3851[_0xea86('0x1a')]=qs[_0xea86('0x1a')](_0x94d7d1['query'][_0xea86('0x1a')]);}_0x4d3851[_0xea86('0x3a')]=qs['sort'](_0x94d7d1[_0xea86('0x30')][_0xea86('0x3b')]);_0x4d3851[_0xea86('0x3c')]=qs[_0xea86('0x32')](_[_0xea86('0x3d')](_0x94d7d1['query'],_0xd11b9[_0xea86('0x32')]),_0x5d0ab5);if(_0x94d7d1[_0xea86('0x30')][_0xea86('0x3e')]){_0x4d3851[_0xea86('0x3c')]=_[_0xea86('0x3f')](_0x4d3851[_0xea86('0x3c')],{'$or':_[_0xea86('0x2b')](_0x5d0ab5,function(_0x171069){if(_0x171069[_0xea86('0x2f')]!==_0xea86('0x40')){var _0x54075a={};_0x54075a[_0x171069[_0xea86('0x29')]]={'$like':'%'+_0x94d7d1[_0xea86('0x30')][_0xea86('0x3e')]+'%'};return _0x54075a;}})});}_0x4d3851=_['merge']({},_0x4d3851,_0x94d7d1[_0xea86('0x41')]);var _0x20a9a4={'where':_0x4d3851['where']};return db[_0xea86('0x2c')][_0xea86('0x1d')](_0x20a9a4)[_0xea86('0x25')](function(_0x35f702){_0x270ff1[_0xea86('0x1d')]=_0x35f702;if(_0x94d7d1[_0xea86('0x30')][_0xea86('0x42')]){_0x4d3851[_0xea86('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xea86('0x44')](_0x4d3851);})[_0xea86('0x25')](function(_0x1e02bf){_0x270ff1['rows']=_0x1e02bf;return _0x270ff1;})[_0xea86('0x25')](respondWithFilteredResult(_0x3145c3,_0x4d3851))['catch'](handleError(_0x3145c3,null));};exports[_0xea86('0x45')]=function(_0x587f9c,_0x9ed255){var _0xc79708={'raw':!![],'where':{'id':_0x587f9c['params']['id']}},_0x3f196d={};_0x3f196d[_0xea86('0x34')]=_[_0xea86('0x31')](db[_0xea86('0x2c')][_0xea86('0x2d')]);_0x3f196d[_0xea86('0x30')]=_[_0xea86('0x31')](_0x587f9c['query']);_0x3f196d[_0xea86('0x32')]=_[_0xea86('0x33')](_0x3f196d[_0xea86('0x34')],_0x3f196d[_0xea86('0x30')]);_0xc79708['attributes']=_[_0xea86('0x33')](_0x3f196d[_0xea86('0x34')],qs[_0xea86('0x36')](_0x587f9c['query'][_0xea86('0x36')]));_0xc79708[_0xea86('0x35')]=_0xc79708['attributes'][_0xea86('0x37')]?_0xc79708[_0xea86('0x35')]:_0x3f196d[_0xea86('0x34')];if(_0x587f9c[_0xea86('0x30')][_0xea86('0x42')]){_0xc79708[_0xea86('0x43')]=[{'all':!![]}];}_0xc79708=_[_0xea86('0x3f')]({},_0xc79708,_0x587f9c[_0xea86('0x41')]);return db[_0xea86('0x2c')][_0xea86('0x46')](_0xc79708)[_0xea86('0x25')](handleEntityNotFound(_0x9ed255,null))[_0xea86('0x25')](respondWithResult(_0x9ed255,null))[_0xea86('0x47')](handleError(_0x9ed255,null));};exports[_0xea86('0x48')]=function(_0x30589d,_0x2eccb4){return db['JscriptyQuestionReport'][_0xea86('0x48')](_0x30589d[_0xea86('0x49')],{})[_0xea86('0x25')](respondWithResult(_0x2eccb4,0xc9))['catch'](handleError(_0x2eccb4,null));};exports[_0xea86('0x23')]=function(_0xa3c10a,_0x2c7083){if(_0xa3c10a[_0xea86('0x49')]['id']){delete _0xa3c10a['body']['id'];}return db['JscriptyQuestionReport'][_0xea86('0x46')]({'where':{'id':_0xa3c10a['params']['id']}})[_0xea86('0x25')](handleEntityNotFound(_0x2c7083,null))['then'](saveUpdates(_0xa3c10a[_0xea86('0x49')],null))[_0xea86('0x25')](respondWithResult(_0x2c7083,null))[_0xea86('0x47')](handleError(_0x2c7083,null));};exports[_0xea86('0x24')]=function(_0x26a806,_0x4733aa){return db[_0xea86('0x2c')][_0xea86('0x46')]({'where':{'id':_0x26a806['params']['id']}})[_0xea86('0x25')](handleEntityNotFound(_0x4733aa,null))[_0xea86('0x25')](removeEntity(_0x4733aa,null))[_0xea86('0x47')](handleError(_0x4733aa,null));};exports[_0xea86('0x4a')]=function(_0x149cb4,_0x2e6cb0){return db[_0xea86('0x2c')][_0xea86('0x4a')]()['then'](respondWithResult(_0x2e6cb0,null))[_0xea86('0x47')](handleError(_0x2e6cb0,null));}; \ No newline at end of file +var _0xfeea=['VIRTUAL','merge','options','JscriptyQuestionReport','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xfeea,0xf7));var _0xafee=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0xfeea[_0x395667];return _0x5cdb8f;};'use strict';var emlformat=require(_0xafee('0x0'));var rimraf=require(_0xafee('0x1'));var zipdir=require(_0xafee('0x2'));var jsonpatch=require(_0xafee('0x3'));var rp=require('request-promise');var moment=require(_0xafee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafee('0x5'));var util=require(_0xafee('0x6'));var path=require(_0xafee('0x7'));var sox=require('sox');var csv=require(_0xafee('0x8'));var ejs=require(_0xafee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafee('0xa'));var squel=require(_0xafee('0xb'));var crypto=require(_0xafee('0xc'));var jsforce=require(_0xafee('0xd'));var deskjs=require(_0xafee('0xe'));var toCsv=require(_0xafee('0x8'));var querystring=require(_0xafee('0xf'));var Papa=require('papaparse');var Redis=require(_0xafee('0x10'));var authService=require(_0xafee('0x11'));var qs=require(_0xafee('0x12'));var as=require(_0xafee('0x13'));var hardwareService=require(_0xafee('0x14'));var logger=require(_0xafee('0x15'))(_0xafee('0x16'));var utils=require('../../config/utils');var config=require(_0xafee('0x17'));var licenseUtil=require(_0xafee('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45858a,_0x1a9004){_0x1a9004=_0x1a9004||0xcc;return function(_0x4c1461){if(_0x4c1461){return _0x45858a[_0xafee('0x19')](_0x1a9004);}return _0x45858a[_0xafee('0x1a')](_0x1a9004)['end']();};}function respondWithResult(_0x6a3f57,_0x5c68a8){_0x5c68a8=_0x5c68a8||0xc8;return function(_0x977798){if(_0x977798){return _0x6a3f57[_0xafee('0x1a')](_0x5c68a8)['json'](_0x977798);}};}function respondWithFilteredResult(_0x256fc5,_0x235b93){return function(_0x6ccfae){if(_0x6ccfae){var _0x2a0825=typeof _0x235b93[_0xafee('0x1b')]===_0xafee('0x1c')&&typeof _0x235b93['limit']==='undefined';var _0xf676c5=_0x6ccfae[_0xafee('0x1d')];var _0x3de24a=_0x2a0825?0x0:_0x235b93['offset'];var _0x4a77f9=_0x2a0825?_0x6ccfae['count']:_0x235b93['offset']+_0x235b93[_0xafee('0x1e')];var _0x152b6f;if(_0x4a77f9>=_0xf676c5){_0x4a77f9=_0xf676c5;_0x152b6f=0xc8;}else{_0x152b6f=0xce;}_0x256fc5[_0xafee('0x1a')](_0x152b6f);return _0x256fc5[_0xafee('0x1f')](_0xafee('0x20'),_0x3de24a+'-'+_0x4a77f9+'/'+_0xf676c5)[_0xafee('0x21')](_0x6ccfae);}return null;};}function patchUpdates(_0x18e62b){return function(_0x15b12e){try{jsonpatch[_0xafee('0x22')](_0x15b12e,_0x18e62b,!![]);}catch(_0x250224){return BPromise[_0xafee('0x23')](_0x250224);}return _0x15b12e['save']();};}function saveUpdates(_0x3b8ddf,_0x514f01){return function(_0xc7c699){if(_0xc7c699){return _0xc7c699[_0xafee('0x24')](_0x3b8ddf)[_0xafee('0x25')](function(_0x13493c){return _0x13493c;});}return null;};}function removeEntity(_0x50602e,_0x127281){return function(_0x48ca11){if(_0x48ca11){return _0x48ca11['destroy']()[_0xafee('0x25')](function(){_0x50602e[_0xafee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ded05,_0x391d1f){return function(_0x15d545){if(!_0x15d545){_0x3ded05['sendStatus'](0x194);}return _0x15d545;};}function handleError(_0x3308fa,_0x40849f){_0x40849f=_0x40849f||0x1f4;return function(_0x3993f6){logger[_0xafee('0x26')](_0x3993f6[_0xafee('0x27')]);if(_0x3993f6[_0xafee('0x28')]){delete _0x3993f6[_0xafee('0x28')];}_0x3308fa[_0xafee('0x1a')](_0x40849f)['send'](_0x3993f6);};}exports[_0xafee('0x29')]=function(_0x36c699,_0x473b12){var _0x54a395={},_0x24f999={},_0x522d6a={'count':0x0,'rows':[]};var _0x46c125=_[_0xafee('0x2a')](db['JscriptyQuestionReport'][_0xafee('0x2b')],function(_0x1f41ce){return{'name':_0x1f41ce[_0xafee('0x2c')],'type':_0x1f41ce[_0xafee('0x2d')][_0xafee('0x2e')]};});_0x24f999[_0xafee('0x2f')]=_[_0xafee('0x2a')](_0x46c125,_0xafee('0x28'));_0x24f999[_0xafee('0x30')]=_[_0xafee('0x31')](_0x36c699[_0xafee('0x30')]);_0x24f999[_0xafee('0x32')]=_[_0xafee('0x33')](_0x24f999[_0xafee('0x2f')],_0x24f999['query']);_0x54a395[_0xafee('0x34')]=_['intersection'](_0x24f999[_0xafee('0x2f')],qs[_0xafee('0x35')](_0x36c699[_0xafee('0x30')][_0xafee('0x35')]));_0x54a395[_0xafee('0x34')]=_0x54a395['attributes']['length']?_0x54a395[_0xafee('0x34')]:_0x24f999[_0xafee('0x2f')];if(!_0x36c699[_0xafee('0x30')][_0xafee('0x36')](_0xafee('0x37'))){_0x54a395[_0xafee('0x1e')]=qs['limit'](_0x36c699[_0xafee('0x30')][_0xafee('0x1e')]);_0x54a395[_0xafee('0x1b')]=qs[_0xafee('0x1b')](_0x36c699[_0xafee('0x30')][_0xafee('0x1b')]);}_0x54a395[_0xafee('0x38')]=qs['sort'](_0x36c699['query'][_0xafee('0x39')]);_0x54a395[_0xafee('0x3a')]=qs[_0xafee('0x32')](_[_0xafee('0x3b')](_0x36c699[_0xafee('0x30')],_0x24f999['filters']),_0x46c125);if(_0x36c699['query'][_0xafee('0x3c')]){_0x54a395[_0xafee('0x3a')]=_['merge'](_0x54a395['where'],{'$or':_[_0xafee('0x2a')](_0x46c125,function(_0x12781f){if(_0x12781f[_0xafee('0x2d')]!==_0xafee('0x3d')){var _0x2013e0={};_0x2013e0[_0x12781f[_0xafee('0x28')]]={'$like':'%'+_0x36c699[_0xafee('0x30')]['filter']+'%'};return _0x2013e0;}})});}_0x54a395=_[_0xafee('0x3e')]({},_0x54a395,_0x36c699[_0xafee('0x3f')]);var _0x65ff1b={'where':_0x54a395['where']};return db[_0xafee('0x40')][_0xafee('0x1d')](_0x65ff1b)[_0xafee('0x25')](function(_0x2d36d4){_0x522d6a[_0xafee('0x1d')]=_0x2d36d4;if(_0x36c699[_0xafee('0x30')]['includeAll']){_0x54a395[_0xafee('0x41')]=[{'all':!![]}];}return db[_0xafee('0x40')][_0xafee('0x42')](_0x54a395);})['then'](function(_0x620784){_0x522d6a[_0xafee('0x43')]=_0x620784;return _0x522d6a;})[_0xafee('0x25')](respondWithFilteredResult(_0x473b12,_0x54a395))[_0xafee('0x44')](handleError(_0x473b12,null));};exports[_0xafee('0x45')]=function(_0x117109,_0x4e154f){var _0x28dc6f={'raw':!![],'where':{'id':_0x117109[_0xafee('0x46')]['id']}},_0x95b0d0={};_0x95b0d0['model']=_[_0xafee('0x31')](db[_0xafee('0x40')][_0xafee('0x2b')]);_0x95b0d0['query']=_[_0xafee('0x31')](_0x117109[_0xafee('0x30')]);_0x95b0d0[_0xafee('0x32')]=_[_0xafee('0x33')](_0x95b0d0['model'],_0x95b0d0[_0xafee('0x30')]);_0x28dc6f[_0xafee('0x34')]=_[_0xafee('0x33')](_0x95b0d0['model'],qs[_0xafee('0x35')](_0x117109[_0xafee('0x30')][_0xafee('0x35')]));_0x28dc6f['attributes']=_0x28dc6f[_0xafee('0x34')][_0xafee('0x47')]?_0x28dc6f['attributes']:_0x95b0d0[_0xafee('0x2f')];if(_0x117109[_0xafee('0x30')]['includeAll']){_0x28dc6f[_0xafee('0x41')]=[{'all':!![]}];}_0x28dc6f=_[_0xafee('0x3e')]({},_0x28dc6f,_0x117109[_0xafee('0x3f')]);return db[_0xafee('0x40')][_0xafee('0x48')](_0x28dc6f)['then'](handleEntityNotFound(_0x4e154f,null))[_0xafee('0x25')](respondWithResult(_0x4e154f,null))[_0xafee('0x44')](handleError(_0x4e154f,null));};exports[_0xafee('0x49')]=function(_0x22b6fc,_0x355ec7){return db[_0xafee('0x40')][_0xafee('0x49')](_0x22b6fc[_0xafee('0x4a')],{})[_0xafee('0x25')](respondWithResult(_0x355ec7,0xc9))[_0xafee('0x44')](handleError(_0x355ec7,null));};exports['update']=function(_0x36731d,_0x1710c2){if(_0x36731d[_0xafee('0x4a')]['id']){delete _0x36731d[_0xafee('0x4a')]['id'];}return db['JscriptyQuestionReport'][_0xafee('0x48')]({'where':{'id':_0x36731d[_0xafee('0x46')]['id']}})[_0xafee('0x25')](handleEntityNotFound(_0x1710c2,null))[_0xafee('0x25')](saveUpdates(_0x36731d[_0xafee('0x4a')],null))[_0xafee('0x25')](respondWithResult(_0x1710c2,null))['catch'](handleError(_0x1710c2,null));};exports[_0xafee('0x4b')]=function(_0x1389f7,_0x5c905c){return db[_0xafee('0x40')][_0xafee('0x48')]({'where':{'id':_0x1389f7[_0xafee('0x46')]['id']}})[_0xafee('0x25')](handleEntityNotFound(_0x5c905c,null))[_0xafee('0x25')](removeEntity(_0x5c905c,null))[_0xafee('0x44')](handleError(_0x5c905c,null));};exports['describe']=function(_0x3e2b72,_0x44846d){return db[_0xafee('0x40')][_0xafee('0x4c')]()[_0xafee('0x25')](respondWithResult(_0x44846d,null))[_0xafee('0x44')](handleError(_0x44846d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ca19d4e..50f676f 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 _0x5425=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_jscripty_questions','lodash'];(function(_0x5670d0,_0x1a08e4){var _0x264917=function(_0x412bdb){while(--_0x412bdb){_0x5670d0['push'](_0x5670d0['shift']());}};_0x264917(++_0x1a08e4);}(_0x5425,0x78));var _0x5542=function(_0x59a344,_0x3196b2){_0x59a344=_0x59a344-0x0;var _0x3f1a30=_0x5425[_0x59a344];return _0x3f1a30;};'use strict';var _=require(_0x5542('0x0'));var util=require(_0x5542('0x1'));var logger=require('../../config/logger')(_0x5542('0x2'));var moment=require(_0x5542('0x3'));var BPromise=require(_0x5542('0x4'));var rp=require(_0x5542('0x5'));var fs=require('fs');var path=require(_0x5542('0x6'));var rimraf=require('rimraf');var config=require(_0x5542('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x5542('0x8')]=function(_0x455ad6,_0x4810e8){return _0x455ad6[_0x5542('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x5542('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cf9=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x0cf9,0x161));var _0x90cf=function(_0x458dd7,_0xe5602b){_0x458dd7=_0x458dd7-0x0;var _0x2a12f3=_0x0cf9[_0x458dd7];return _0x2a12f3;};'use strict';var _=require(_0x90cf('0x0'));var util=require(_0x90cf('0x1'));var logger=require(_0x90cf('0x2'))(_0x90cf('0x3'));var moment=require(_0x90cf('0x4'));var BPromise=require(_0x90cf('0x5'));var rp=require(_0x90cf('0x6'));var fs=require('fs');var path=require(_0x90cf('0x7'));var rimraf=require(_0x90cf('0x8'));var config=require(_0x90cf('0x9'));var attributes=require(_0x90cf('0xa'));module[_0x90cf('0xb')]=function(_0x592332,_0x2b16ba){return _0x592332[_0x90cf('0xc')](_0x90cf('0xd'),attributes,{'tableName':_0x90cf('0xe'),'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 485270b..10020d4 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 _0xe5df=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','moment','ioredis','../../mysqldb'];(function(_0x10df18,_0x54942d){var _0x3ada17=function(_0x5bd87d){while(--_0x5bd87d){_0x10df18['push'](_0x10df18['shift']());}};_0x3ada17(++_0x54942d);}(_0xe5df,0x8d));var _0xfe5d=function(_0x400fd1,_0x5358b7){_0x400fd1=_0x400fd1-0x0;var _0x3aa667=_0xe5df[_0x400fd1];return _0x3aa667;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe5d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe5d('0x1'));var db=require(_0xfe5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5d('0x3'))('rpc');var config=require(_0xfe5d('0x4'));var jayson=require(_0xfe5d('0x5'));var client=jayson[_0xfe5d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53468b,_0x481e52,_0x5420e8){return new BPromise(function(_0x5e370d,_0x442308){return client[_0xfe5d('0x7')](_0x53468b,_0x5420e8)[_0xfe5d('0x8')](function(_0x2f3700){logger[_0xfe5d('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x481e52,'request\x20sent');logger[_0xfe5d('0xa')](_0xfe5d('0xb'),_0x481e52,_0xfe5d('0xc'),JSON['stringify'](_0x2f3700));if(_0x2f3700[_0xfe5d('0xd')]){if(_0x2f3700[_0xfe5d('0xd')][_0xfe5d('0xe')]===0x1f4){logger[_0xfe5d('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x481e52,_0x2f3700[_0xfe5d('0xd')]['message']);return _0x442308(_0x2f3700[_0xfe5d('0xd')]['message']);}logger[_0xfe5d('0xd')](_0xfe5d('0xf'),_0x481e52,_0x2f3700[_0xfe5d('0xd')][_0xfe5d('0x10')]);return _0x5e370d(_0x2f3700[_0xfe5d('0xd')][_0xfe5d('0x10')]);}else{logger[_0xfe5d('0x9')](_0xfe5d('0xf'),_0x481e52,_0xfe5d('0xc'));_0x5e370d(_0x2f3700[_0xfe5d('0x11')][_0xfe5d('0x10')]);}})['catch'](function(_0x5e2446){logger[_0xfe5d('0xd')](_0xfe5d('0xf'),_0x481e52,_0x5e2446);_0x442308(_0x5e2446);});});} \ No newline at end of file +var _0x2077=['../../config/logger','../../config/environment','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x5bec9a,_0x1a9a0b){var _0x2bc769=function(_0x1fc1cc){while(--_0x1fc1cc){_0x5bec9a['push'](_0x5bec9a['shift']());}};_0x2bc769(++_0x1a9a0b);}(_0x2077,0x9a));var _0x7207=function(_0x216a0b,_0x3c1fc4){_0x216a0b=_0x216a0b-0x0;var _0x361a85=_0x2077[_0x216a0b];return _0x361a85;};'use strict';var _=require(_0x7207('0x0'));var util=require(_0x7207('0x1'));var moment=require(_0x7207('0x2'));var BPromise=require('bluebird');var rs=require(_0x7207('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7207('0x4'))['db'];var utils=require(_0x7207('0x5'));var logger=require(_0x7207('0x6'))('rpc');var config=require(_0x7207('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x249833,_0x5abe96,_0x4d36ec){return new BPromise(function(_0x25ca93,_0x3c6a6c){return client[_0x7207('0x9')](_0x249833,_0x4d36ec)[_0x7207('0xa')](function(_0x193974){logger['info'](_0x7207('0xb'),_0x5abe96,_0x7207('0xc'));logger[_0x7207('0xd')](_0x7207('0xe'),_0x5abe96,_0x7207('0xc'),JSON[_0x7207('0xf')](_0x193974));if(_0x193974[_0x7207('0x10')]){if(_0x193974[_0x7207('0x10')]['code']===0x1f4){logger[_0x7207('0x10')](_0x7207('0xb'),_0x5abe96,_0x193974['error']['message']);return _0x3c6a6c(_0x193974['error'][_0x7207('0x11')]);}logger[_0x7207('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5abe96,_0x193974[_0x7207('0x10')][_0x7207('0x11')]);return _0x25ca93(_0x193974[_0x7207('0x10')]['message']);}else{logger[_0x7207('0x12')](_0x7207('0xb'),_0x5abe96,_0x7207('0xc'));_0x25ca93(_0x193974['result']['message']);}})[_0x7207('0x13')](function(_0x549e91){logger[_0x7207('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5abe96,_0x549e91);_0x3c6a6c(_0x549e91);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 923132a..0aa70fa 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 _0x177f=['isAuthenticated','index','get','/describe','describe','/:id/questions','getQuestions','create','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f81f6,_0x4d8c60){var _0x283e8e=function(_0x3b2889){while(--_0x3b2889){_0x4f81f6['push'](_0x4f81f6['shift']());}};_0x283e8e(++_0x4d8c60);}(_0x177f,0x1ec));var _0xf177=function(_0x19a3c1,_0xbe36b2){_0x19a3c1=_0x19a3c1-0x0;var _0x31e234=_0x177f[_0x19a3c1];return _0x31e234;};'use strict';var multer=require(_0xf177('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf177('0x1'));var express=require(_0xf177('0x2'));var router=express[_0xf177('0x3')]();var fs_extra=require(_0xf177('0x4'));var auth=require(_0xf177('0x5'));var interaction=require(_0xf177('0x6'));var config=require(_0xf177('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xf177('0x8')](),controller[_0xf177('0x9')]);router[_0xf177('0xa')](_0xf177('0xb'),auth[_0xf177('0x8')](),controller[_0xf177('0xc')]);router[_0xf177('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xf177('0xd'),auth[_0xf177('0x8')](),controller[_0xf177('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf177('0xf')]);router['put'](_0xf177('0x10'),auth[_0xf177('0x8')](),controller[_0xf177('0x11')]);router[_0xf177('0x12')](_0xf177('0x10'),auth[_0xf177('0x8')](),controller[_0xf177('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe90a=['./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1a2453,_0x5efe31){var _0x4d7d87=function(_0x4a5b6c){while(--_0x4a5b6c){_0x1a2453['push'](_0x1a2453['shift']());}};_0x4d7d87(++_0x5efe31);}(_0xe90a,0x151));var _0xae90=function(_0x2e6a69,_0x1ba014){_0x2e6a69=_0x2e6a69-0x0;var _0x583b2a=_0xe90a[_0x2e6a69];return _0x583b2a;};'use strict';var multer=require('multer');var util=require(_0xae90('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae90('0x1'));var router=express[_0xae90('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae90('0x3'));var config=require(_0xae90('0x4'));var controller=require(_0xae90('0x5'));router[_0xae90('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae90('0x6')](_0xae90('0x7'),auth[_0xae90('0x8')](),controller['describe']);router[_0xae90('0x6')](_0xae90('0x9'),auth['isAuthenticated'](),controller[_0xae90('0xa')]);router[_0xae90('0x6')](_0xae90('0xb'),auth[_0xae90('0x8')](),controller[_0xae90('0xc')]);router['post']('/',auth[_0xae90('0x8')](),controller[_0xae90('0xd')]);router[_0xae90('0xe')](_0xae90('0x9'),auth[_0xae90('0x8')](),controller[_0xae90('0xf')]);router[_0xae90('0x10')](_0xae90('0x9'),auth[_0xae90('0x8')](),controller[_0xae90('0x11')]);module[_0xae90('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b07efa2..3ef8f5b 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 _0x4864=['format','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime'];(function(_0x56d108,_0x106a5f){var _0x1eeb24=function(_0x1a2a0d){while(--_0x1a2a0d){_0x56d108['push'](_0x56d108['shift']());}};_0x1eeb24(++_0x106a5f);}(_0x4864,0x16b));var _0x4486=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x4864[_0x211fef];return _0x5447bf;};'use strict';var moment=require(_0x4486('0x0'));var Sequelize=require(_0x4486('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x4486('0x2')],'set':function(_0x27e622){this[_0x4486('0x3')](_0x4486('0x4'),_0x27e622);this[_0x4486('0x3')](_0x4486('0x5'),moment()[_0x4486('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x4486('0x7')]},'projectname':{'type':Sequelize[_0x4486('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4486('0x7')]},'calleridname':{'type':Sequelize[_0x4486('0x7')]},'calleridnum':{'type':Sequelize[_0x4486('0x7')]},'completed':{'type':Sequelize[_0x4486('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xbe60=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime'];(function(_0x18c648,_0x367e58){var _0x59bad1=function(_0x174d6b){while(--_0x174d6b){_0x18c648['push'](_0x18c648['shift']());}};_0x59bad1(++_0x367e58);}(_0xbe60,0x1d4));var _0x0be6=function(_0x447db4,_0x550a89){_0x447db4=_0x447db4-0x0;var _0x17a797=_0xbe60[_0x447db4];return _0x17a797;};'use strict';var moment=require(_0x0be6('0x0'));var Sequelize=require(_0x0be6('0x1'));module[_0x0be6('0x2')]={'starttime':{'type':Sequelize[_0x0be6('0x3')],'set':function(_0x4385e9){this['setDataValue'](_0x0be6('0x4'),_0x4385e9);this[_0x0be6('0x5')](_0x0be6('0x6'),moment()[_0x0be6('0x7')](_0x0be6('0x8')));}},'endtime':{'type':Sequelize[_0x0be6('0x3')]},'membername':{'type':Sequelize[_0x0be6('0x9')]},'projectname':{'type':Sequelize[_0x0be6('0x9')]},'queue':{'type':Sequelize[_0x0be6('0x9')]},'uniqueid':{'type':Sequelize[_0x0be6('0x9')]},'calleridname':{'type':Sequelize[_0x0be6('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0be6('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 30a7582..eae2258 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 _0x75c9=['describe','getQuestions','findOne','sort','filter','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','JscriptySessionReport','fieldName','type','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','destroy'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x75c9,0x14a));var _0x975c=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x75c9[_0x513047];return _0x15b779;};'use strict';var emlformat=require(_0x975c('0x0'));var rimraf=require(_0x975c('0x1'));var zipdir=require(_0x975c('0x2'));var jsonpatch=require(_0x975c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x975c('0x4'));var Mustache=require(_0x975c('0x5'));var util=require('util');var path=require(_0x975c('0x6'));var sox=require('sox');var csv=require(_0x975c('0x7'));var ejs=require(_0x975c('0x8'));var fs=require('fs');var fs_extra=require(_0x975c('0x9'));var _=require(_0x975c('0xa'));var squel=require(_0x975c('0xb'));var crypto=require(_0x975c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x975c('0xd'));var toCsv=require(_0x975c('0x7'));var querystring=require(_0x975c('0xe'));var Papa=require('papaparse');var Redis=require(_0x975c('0xf'));var authService=require(_0x975c('0x10'));var qs=require(_0x975c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x975c('0x12'));var logger=require(_0x975c('0x13'))(_0x975c('0x14'));var utils=require(_0x975c('0x15'));var config=require(_0x975c('0x16'));var licenseUtil=require(_0x975c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30dfd1,_0x3dbb06){_0x3dbb06=_0x3dbb06||0xcc;return function(_0x5890f2){if(_0x5890f2){return _0x30dfd1[_0x975c('0x18')](_0x3dbb06);}return _0x30dfd1[_0x975c('0x19')](_0x3dbb06)[_0x975c('0x1a')]();};}function respondWithResult(_0x3874c7,_0x1bb698){_0x1bb698=_0x1bb698||0xc8;return function(_0x2a9a59){if(_0x2a9a59){return _0x3874c7[_0x975c('0x19')](_0x1bb698)[_0x975c('0x1b')](_0x2a9a59);}};}function respondWithFilteredResult(_0x41018f,_0x1cbc2b){return function(_0x1232c7){if(_0x1232c7){var _0x1f3dba=typeof _0x1cbc2b['offset']===_0x975c('0x1c')&&typeof _0x1cbc2b[_0x975c('0x1d')]===_0x975c('0x1c');var _0x10c164=_0x1232c7[_0x975c('0x1e')];var _0x113888=_0x1f3dba?0x0:_0x1cbc2b['offset'];var _0x1aab75=_0x1f3dba?_0x1232c7[_0x975c('0x1e')]:_0x1cbc2b[_0x975c('0x1f')]+_0x1cbc2b['limit'];var _0x5d67bc;if(_0x1aab75>=_0x10c164){_0x1aab75=_0x10c164;_0x5d67bc=0xc8;}else{_0x5d67bc=0xce;}_0x41018f[_0x975c('0x19')](_0x5d67bc);return _0x41018f[_0x975c('0x20')](_0x975c('0x21'),_0x113888+'-'+_0x1aab75+'/'+_0x10c164)[_0x975c('0x1b')](_0x1232c7);}return null;};}function patchUpdates(_0x16426f){return function(_0x182df5){try{jsonpatch[_0x975c('0x22')](_0x182df5,_0x16426f,!![]);}catch(_0x481e17){return BPromise[_0x975c('0x23')](_0x481e17);}return _0x182df5[_0x975c('0x24')]();};}function saveUpdates(_0x1c3511,_0x56a978){return function(_0x4ea5c0){if(_0x4ea5c0){return _0x4ea5c0[_0x975c('0x25')](_0x1c3511)['then'](function(_0x3d89d6){return _0x3d89d6;});}return null;};}function removeEntity(_0xe95126,_0x18c2fc){return function(_0x161e19){if(_0x161e19){return _0x161e19['destroy']()[_0x975c('0x26')](function(){_0xe95126[_0x975c('0x19')](0xcc)[_0x975c('0x1a')]();});}};}function handleEntityNotFound(_0x29cb50,_0x22c256){return function(_0x52c75d){if(!_0x52c75d){_0x29cb50[_0x975c('0x18')](0x194);}return _0x52c75d;};}function handleError(_0x432b84,_0x13ca5e){_0x13ca5e=_0x13ca5e||0x1f4;return function(_0x4c9850){logger[_0x975c('0x27')](_0x4c9850['stack']);if(_0x4c9850[_0x975c('0x28')]){delete _0x4c9850[_0x975c('0x28')];}_0x432b84[_0x975c('0x19')](_0x13ca5e)[_0x975c('0x29')](_0x4c9850);};}exports[_0x975c('0x2a')]=function(_0x5b0a2c,_0xbbc4fd){var _0x5e09a5={},_0x466054={},_0x4dd71d={'count':0x0,'rows':[]};var _0x273333=_[_0x975c('0x2b')](db[_0x975c('0x2c')]['rawAttributes'],function(_0x418583){return{'name':_0x418583[_0x975c('0x2d')],'type':_0x418583[_0x975c('0x2e')][_0x975c('0x2f')]};});_0x466054['model']=_['map'](_0x273333,'name');_0x466054['query']=_[_0x975c('0x30')](_0x5b0a2c[_0x975c('0x31')]);_0x466054[_0x975c('0x32')]=_['intersection'](_0x466054[_0x975c('0x33')],_0x466054[_0x975c('0x31')]);_0x5e09a5['attributes']=_['intersection'](_0x466054[_0x975c('0x33')],qs['fields'](_0x5b0a2c[_0x975c('0x31')][_0x975c('0x34')]));_0x5e09a5['attributes']=_0x5e09a5[_0x975c('0x35')][_0x975c('0x36')]?_0x5e09a5[_0x975c('0x35')]:_0x466054['model'];if(!_0x5b0a2c[_0x975c('0x31')][_0x975c('0x37')](_0x975c('0x38'))){_0x5e09a5[_0x975c('0x1d')]=qs[_0x975c('0x1d')](_0x5b0a2c[_0x975c('0x31')][_0x975c('0x1d')]);_0x5e09a5['offset']=qs['offset'](_0x5b0a2c[_0x975c('0x31')][_0x975c('0x1f')]);}_0x5e09a5[_0x975c('0x39')]=qs['sort'](_0x5b0a2c[_0x975c('0x31')]['sort']);_0x5e09a5['where']=qs['filters'](_[_0x975c('0x3a')](_0x5b0a2c[_0x975c('0x31')],_0x466054[_0x975c('0x32')]),_0x273333);if(_0x5b0a2c[_0x975c('0x31')]['filter']){_0x5e09a5[_0x975c('0x3b')]=_[_0x975c('0x3c')](_0x5e09a5[_0x975c('0x3b')],{'$or':_[_0x975c('0x2b')](_0x273333,function(_0x4eed7b){if(_0x4eed7b['type']!=='VIRTUAL'){var _0x1585f0={};_0x1585f0[_0x4eed7b[_0x975c('0x28')]]={'$like':'%'+_0x5b0a2c['query']['filter']+'%'};return _0x1585f0;}})});}_0x5e09a5=_[_0x975c('0x3c')]({},_0x5e09a5,_0x5b0a2c[_0x975c('0x3d')]);var _0x535ed0={'where':_0x5e09a5[_0x975c('0x3b')]};return db[_0x975c('0x2c')][_0x975c('0x1e')](_0x535ed0)[_0x975c('0x26')](function(_0xbca90b){_0x4dd71d[_0x975c('0x1e')]=_0xbca90b;if(_0x5b0a2c[_0x975c('0x31')][_0x975c('0x3e')]){_0x5e09a5[_0x975c('0x3f')]=[{'all':!![]}];}return db[_0x975c('0x2c')][_0x975c('0x40')](_0x5e09a5);})['then'](function(_0x18102f){_0x4dd71d[_0x975c('0x41')]=_0x18102f;return _0x4dd71d;})[_0x975c('0x26')](respondWithFilteredResult(_0xbbc4fd,_0x5e09a5))[_0x975c('0x42')](handleError(_0xbbc4fd,null));};exports[_0x975c('0x43')]=function(_0x2fe5ed,_0x28e9fb){var _0x3774d8={'raw':!![],'where':{'id':_0x2fe5ed[_0x975c('0x44')]['id']}},_0x3ccd37={};_0x3ccd37['model']=_[_0x975c('0x30')](db[_0x975c('0x2c')][_0x975c('0x45')]);_0x3ccd37[_0x975c('0x31')]=_[_0x975c('0x30')](_0x2fe5ed[_0x975c('0x31')]);_0x3ccd37[_0x975c('0x32')]=_[_0x975c('0x46')](_0x3ccd37['model'],_0x3ccd37[_0x975c('0x31')]);_0x3774d8[_0x975c('0x35')]=_['intersection'](_0x3ccd37['model'],qs[_0x975c('0x34')](_0x2fe5ed[_0x975c('0x31')]['fields']));_0x3774d8[_0x975c('0x35')]=_0x3774d8['attributes'][_0x975c('0x36')]?_0x3774d8['attributes']:_0x3ccd37[_0x975c('0x33')];if(_0x2fe5ed[_0x975c('0x31')][_0x975c('0x3e')]){_0x3774d8[_0x975c('0x3f')]=[{'all':!![]}];}_0x3774d8=_[_0x975c('0x3c')]({},_0x3774d8,_0x2fe5ed[_0x975c('0x3d')]);return db[_0x975c('0x2c')][_0x975c('0x47')](_0x3774d8)['then'](handleEntityNotFound(_0x28e9fb,null))[_0x975c('0x26')](respondWithResult(_0x28e9fb,null))['catch'](handleError(_0x28e9fb,null));};exports[_0x975c('0x48')]=function(_0x2f1785,_0x29a0e5){return db[_0x975c('0x2c')][_0x975c('0x48')](_0x2f1785[_0x975c('0x49')],{})[_0x975c('0x26')](respondWithResult(_0x29a0e5,0xc9))['catch'](handleError(_0x29a0e5,null));};exports[_0x975c('0x25')]=function(_0x3a9f40,_0x5bff3d){if(_0x3a9f40[_0x975c('0x49')]['id']){delete _0x3a9f40[_0x975c('0x49')]['id'];}return db[_0x975c('0x2c')][_0x975c('0x47')]({'where':{'id':_0x3a9f40[_0x975c('0x44')]['id']}})[_0x975c('0x26')](handleEntityNotFound(_0x5bff3d,null))[_0x975c('0x26')](saveUpdates(_0x3a9f40['body'],null))[_0x975c('0x26')](respondWithResult(_0x5bff3d,null))[_0x975c('0x42')](handleError(_0x5bff3d,null));};exports[_0x975c('0x4a')]=function(_0x178115,_0x2124e4){return db[_0x975c('0x2c')][_0x975c('0x47')]({'where':{'id':_0x178115['params']['id']}})[_0x975c('0x26')](handleEntityNotFound(_0x2124e4,null))[_0x975c('0x26')](removeEntity(_0x2124e4,null))[_0x975c('0x42')](handleError(_0x2124e4,null));};exports['describe']=function(_0x396a33,_0x4a8670){return db[_0x975c('0x2c')][_0x975c('0x4b')]()[_0x975c('0x26')](respondWithResult(_0x4a8670,null))[_0x975c('0x42')](handleError(_0x4a8670,null));};exports[_0x975c('0x4c')]=function(_0x359ef2,_0x1fd61d,_0x5c23ee){var _0x26dfdf={'raw':!![],'where':{}};var _0x15dfdd={};var _0x2b975e={'count':0x0,'rows':[]};return db[_0x975c('0x2c')][_0x975c('0x4d')]({'where':{'id':_0x359ef2[_0x975c('0x44')]['id']}})[_0x975c('0x26')](handleEntityNotFound(_0x1fd61d,null))['then'](function(_0x3ac4ad){if(_0x3ac4ad){_0x15dfdd[_0x975c('0x33')]=_['keys'](db['JscriptyQuestionReport'][_0x975c('0x45')]);_0x15dfdd[_0x975c('0x31')]=_[_0x975c('0x30')](_0x359ef2[_0x975c('0x31')]);_0x15dfdd['filters']=_[_0x975c('0x46')](_0x15dfdd[_0x975c('0x33')],_0x15dfdd[_0x975c('0x31')]);_0x26dfdf[_0x975c('0x35')]=_[_0x975c('0x46')](_0x15dfdd[_0x975c('0x33')],qs['fields'](_0x359ef2[_0x975c('0x31')][_0x975c('0x34')]));_0x26dfdf[_0x975c('0x35')]=_0x26dfdf[_0x975c('0x35')][_0x975c('0x36')]?_0x26dfdf['attributes']:_0x15dfdd[_0x975c('0x33')];if(!_0x359ef2['query']['hasOwnProperty'](_0x975c('0x38'))){_0x26dfdf['limit']=qs[_0x975c('0x1d')](_0x359ef2[_0x975c('0x31')][_0x975c('0x1d')]);_0x26dfdf[_0x975c('0x1f')]=qs['offset'](_0x359ef2['query'][_0x975c('0x1f')]);}_0x26dfdf[_0x975c('0x39')]=qs[_0x975c('0x4e')](_0x359ef2[_0x975c('0x31')][_0x975c('0x4e')]);_0x26dfdf[_0x975c('0x3b')]=qs['filters'](_[_0x975c('0x3a')](_0x359ef2['query'],_0x15dfdd[_0x975c('0x32')]));_0x26dfdf[_0x975c('0x3b')]['SessionId']=_0x3ac4ad['id'];if(_0x359ef2[_0x975c('0x31')]['filter']){_0x26dfdf[_0x975c('0x3b')]=_[_0x975c('0x3c')](_0x26dfdf[_0x975c('0x3b')],{'$or':_[_0x975c('0x2b')](_0x26dfdf[_0x975c('0x35')],function(_0x3b86c4){var _0x2616d1={};_0x2616d1[_0x3b86c4]={'$like':'%'+_0x359ef2[_0x975c('0x31')][_0x975c('0x4f')]+'%'};return _0x2616d1;})});}_0x26dfdf=_['merge']({},_0x26dfdf,_0x359ef2[_0x975c('0x3d')]);return db['JscriptyQuestionReport'][_0x975c('0x1e')]({'where':_0x26dfdf[_0x975c('0x3b')]})[_0x975c('0x26')](function(_0xa2752){_0x2b975e[_0x975c('0x1e')]=_0xa2752;if(_0x359ef2[_0x975c('0x31')][_0x975c('0x3e')]){_0x26dfdf['include']=[{'all':!![]}];}return db[_0x975c('0x50')][_0x975c('0x40')](_0x26dfdf);})['then'](function(_0x109d55){_0x2b975e['rows']=_0x109d55;return _0x2b975e;});}})[_0x975c('0x26')](respondWithFilteredResult(_0x1fd61d,_0x26dfdf))['catch'](handleError(_0x1fd61d,null));}; \ No newline at end of file +var _0x4048=['crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','JscriptySessionReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','getQuestions','findOne','nolimit','pick','SessionId','options','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1d0e07,_0x2037e9){var _0x8912e0=function(_0x3b1c66){while(--_0x3b1c66){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x8912e0(++_0x2037e9);}(_0x4048,0x1e5));var _0x8404=function(_0x9e85af,_0x47be59){_0x9e85af=_0x9e85af-0x0;var _0x48a61f=_0x4048[_0x9e85af];return _0x48a61f;};'use strict';var emlformat=require(_0x8404('0x0'));var rimraf=require(_0x8404('0x1'));var zipdir=require(_0x8404('0x2'));var jsonpatch=require(_0x8404('0x3'));var rp=require('request-promise');var moment=require(_0x8404('0x4'));var BPromise=require(_0x8404('0x5'));var Mustache=require('mustache');var util=require(_0x8404('0x6'));var path=require(_0x8404('0x7'));var sox=require(_0x8404('0x8'));var csv=require(_0x8404('0x9'));var ejs=require(_0x8404('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8404('0xb'));var squel=require(_0x8404('0xc'));var crypto=require(_0x8404('0xd'));var jsforce=require(_0x8404('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8404('0x9'));var querystring=require('querystring');var Papa=require(_0x8404('0xf'));var Redis=require(_0x8404('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8404('0x11'));var as=require(_0x8404('0x12'));var hardwareService=require(_0x8404('0x13'));var logger=require(_0x8404('0x14'))(_0x8404('0x15'));var utils=require(_0x8404('0x16'));var config=require(_0x8404('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8404('0x18'))['db'];function respondWithStatusCode(_0x27ab99,_0x1cbbd7){_0x1cbbd7=_0x1cbbd7||0xcc;return function(_0x3c9fa3){if(_0x3c9fa3){return _0x27ab99[_0x8404('0x19')](_0x1cbbd7);}return _0x27ab99[_0x8404('0x1a')](_0x1cbbd7)[_0x8404('0x1b')]();};}function respondWithResult(_0x49d0b6,_0x56821b){_0x56821b=_0x56821b||0xc8;return function(_0x26e45d){if(_0x26e45d){return _0x49d0b6[_0x8404('0x1a')](_0x56821b)[_0x8404('0x1c')](_0x26e45d);}};}function respondWithFilteredResult(_0x4826f4,_0x6d53b2){return function(_0x31ccc2){if(_0x31ccc2){var _0x120e25=typeof _0x6d53b2[_0x8404('0x1d')]===_0x8404('0x1e')&&typeof _0x6d53b2[_0x8404('0x1f')]===_0x8404('0x1e');var _0x1951f1=_0x31ccc2[_0x8404('0x20')];var _0x383b39=_0x120e25?0x0:_0x6d53b2['offset'];var _0xf673ab=_0x120e25?_0x31ccc2[_0x8404('0x20')]:_0x6d53b2[_0x8404('0x1d')]+_0x6d53b2[_0x8404('0x1f')];var _0x2d1976;if(_0xf673ab>=_0x1951f1){_0xf673ab=_0x1951f1;_0x2d1976=0xc8;}else{_0x2d1976=0xce;}_0x4826f4['status'](_0x2d1976);return _0x4826f4[_0x8404('0x21')](_0x8404('0x22'),_0x383b39+'-'+_0xf673ab+'/'+_0x1951f1)[_0x8404('0x1c')](_0x31ccc2);}return null;};}function patchUpdates(_0x418280){return function(_0x165368){try{jsonpatch[_0x8404('0x23')](_0x165368,_0x418280,!![]);}catch(_0x20b156){return BPromise[_0x8404('0x24')](_0x20b156);}return _0x165368[_0x8404('0x25')]();};}function saveUpdates(_0x24e38f,_0x4b4b86){return function(_0x13dde1){if(_0x13dde1){return _0x13dde1[_0x8404('0x26')](_0x24e38f)['then'](function(_0x140c1d){return _0x140c1d;});}return null;};}function removeEntity(_0x4a4132,_0x4fe3c8){return function(_0x45b4ca){if(_0x45b4ca){return _0x45b4ca[_0x8404('0x27')]()[_0x8404('0x28')](function(){_0x4a4132['status'](0xcc)[_0x8404('0x1b')]();});}};}function handleEntityNotFound(_0x2cb1d0,_0x543e82){return function(_0x114e41){if(!_0x114e41){_0x2cb1d0[_0x8404('0x19')](0x194);}return _0x114e41;};}function handleError(_0x1a9d87,_0x131cf6){_0x131cf6=_0x131cf6||0x1f4;return function(_0x55b2fa){logger['error'](_0x55b2fa['stack']);if(_0x55b2fa[_0x8404('0x29')]){delete _0x55b2fa['name'];}_0x1a9d87[_0x8404('0x1a')](_0x131cf6)[_0x8404('0x2a')](_0x55b2fa);};}exports[_0x8404('0x2b')]=function(_0x332e80,_0x1e3763){var _0x2befbd={},_0x58c1cc={},_0x2b8ec3={'count':0x0,'rows':[]};var _0x31e0ae=_['map'](db[_0x8404('0x2c')]['rawAttributes'],function(_0x168c2b){return{'name':_0x168c2b[_0x8404('0x2d')],'type':_0x168c2b[_0x8404('0x2e')][_0x8404('0x2f')]};});_0x58c1cc[_0x8404('0x30')]=_[_0x8404('0x31')](_0x31e0ae,_0x8404('0x29'));_0x58c1cc['query']=_[_0x8404('0x32')](_0x332e80[_0x8404('0x33')]);_0x58c1cc[_0x8404('0x34')]=_[_0x8404('0x35')](_0x58c1cc[_0x8404('0x30')],_0x58c1cc['query']);_0x2befbd[_0x8404('0x36')]=_['intersection'](_0x58c1cc['model'],qs[_0x8404('0x37')](_0x332e80[_0x8404('0x33')][_0x8404('0x37')]));_0x2befbd[_0x8404('0x36')]=_0x2befbd[_0x8404('0x36')]['length']?_0x2befbd[_0x8404('0x36')]:_0x58c1cc[_0x8404('0x30')];if(!_0x332e80['query'][_0x8404('0x38')]('nolimit')){_0x2befbd[_0x8404('0x1f')]=qs['limit'](_0x332e80['query'][_0x8404('0x1f')]);_0x2befbd[_0x8404('0x1d')]=qs[_0x8404('0x1d')](_0x332e80[_0x8404('0x33')][_0x8404('0x1d')]);}_0x2befbd[_0x8404('0x39')]=qs[_0x8404('0x3a')](_0x332e80[_0x8404('0x33')]['sort']);_0x2befbd['where']=qs[_0x8404('0x34')](_['pick'](_0x332e80[_0x8404('0x33')],_0x58c1cc[_0x8404('0x34')]),_0x31e0ae);if(_0x332e80['query'][_0x8404('0x3b')]){_0x2befbd[_0x8404('0x3c')]=_[_0x8404('0x3d')](_0x2befbd[_0x8404('0x3c')],{'$or':_[_0x8404('0x31')](_0x31e0ae,function(_0x12ef10){if(_0x12ef10[_0x8404('0x2e')]!==_0x8404('0x3e')){var _0x2eaa10={};_0x2eaa10[_0x12ef10[_0x8404('0x29')]]={'$like':'%'+_0x332e80['query']['filter']+'%'};return _0x2eaa10;}})});}_0x2befbd=_[_0x8404('0x3d')]({},_0x2befbd,_0x332e80['options']);var _0xebe66e={'where':_0x2befbd['where']};return db['JscriptySessionReport']['count'](_0xebe66e)[_0x8404('0x28')](function(_0x1de5d4){_0x2b8ec3['count']=_0x1de5d4;if(_0x332e80[_0x8404('0x33')][_0x8404('0x3f')]){_0x2befbd[_0x8404('0x40')]=[{'all':!![]}];}return db[_0x8404('0x2c')][_0x8404('0x41')](_0x2befbd);})[_0x8404('0x28')](function(_0x4b35ae){_0x2b8ec3[_0x8404('0x42')]=_0x4b35ae;return _0x2b8ec3;})[_0x8404('0x28')](respondWithFilteredResult(_0x1e3763,_0x2befbd))[_0x8404('0x43')](handleError(_0x1e3763,null));};exports[_0x8404('0x44')]=function(_0x765c96,_0x5c6091){var _0x1f2689={'raw':!![],'where':{'id':_0x765c96[_0x8404('0x45')]['id']}},_0x84b6de={};_0x84b6de[_0x8404('0x30')]=_[_0x8404('0x32')](db[_0x8404('0x2c')][_0x8404('0x46')]);_0x84b6de[_0x8404('0x33')]=_[_0x8404('0x32')](_0x765c96[_0x8404('0x33')]);_0x84b6de['filters']=_[_0x8404('0x35')](_0x84b6de['model'],_0x84b6de[_0x8404('0x33')]);_0x1f2689[_0x8404('0x36')]=_[_0x8404('0x35')](_0x84b6de['model'],qs[_0x8404('0x37')](_0x765c96[_0x8404('0x33')][_0x8404('0x37')]));_0x1f2689[_0x8404('0x36')]=_0x1f2689['attributes'][_0x8404('0x47')]?_0x1f2689[_0x8404('0x36')]:_0x84b6de['model'];if(_0x765c96['query']['includeAll']){_0x1f2689[_0x8404('0x40')]=[{'all':!![]}];}_0x1f2689=_['merge']({},_0x1f2689,_0x765c96['options']);return db['JscriptySessionReport'][_0x8404('0x48')](_0x1f2689)[_0x8404('0x28')](handleEntityNotFound(_0x5c6091,null))[_0x8404('0x28')](respondWithResult(_0x5c6091,null))[_0x8404('0x43')](handleError(_0x5c6091,null));};exports[_0x8404('0x49')]=function(_0x58bb71,_0x23a4d4){return db[_0x8404('0x2c')][_0x8404('0x49')](_0x58bb71['body'],{})[_0x8404('0x28')](respondWithResult(_0x23a4d4,0xc9))[_0x8404('0x43')](handleError(_0x23a4d4,null));};exports[_0x8404('0x26')]=function(_0x2f2a68,_0x2f3721){if(_0x2f2a68['body']['id']){delete _0x2f2a68[_0x8404('0x4a')]['id'];}return db[_0x8404('0x2c')][_0x8404('0x48')]({'where':{'id':_0x2f2a68['params']['id']}})['then'](handleEntityNotFound(_0x2f3721,null))[_0x8404('0x28')](saveUpdates(_0x2f2a68[_0x8404('0x4a')],null))['then'](respondWithResult(_0x2f3721,null))['catch'](handleError(_0x2f3721,null));};exports['destroy']=function(_0x46602e,_0x1ba0c7){return db[_0x8404('0x2c')]['find']({'where':{'id':_0x46602e[_0x8404('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ba0c7,null))['then'](removeEntity(_0x1ba0c7,null))[_0x8404('0x43')](handleError(_0x1ba0c7,null));};exports[_0x8404('0x4b')]=function(_0x4eb3c2,_0x4aefb1){return db[_0x8404('0x2c')]['describe']()[_0x8404('0x28')](respondWithResult(_0x4aefb1,null))[_0x8404('0x43')](handleError(_0x4aefb1,null));};exports[_0x8404('0x4c')]=function(_0x142aa1,_0x5eb7a4,_0x246a0c){var _0x4ef876={'raw':!![],'where':{}};var _0x1f0c76={};var _0xf605e2={'count':0x0,'rows':[]};return db[_0x8404('0x2c')][_0x8404('0x4d')]({'where':{'id':_0x142aa1[_0x8404('0x45')]['id']}})[_0x8404('0x28')](handleEntityNotFound(_0x5eb7a4,null))[_0x8404('0x28')](function(_0x15dd25){if(_0x15dd25){_0x1f0c76[_0x8404('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0x8404('0x46')]);_0x1f0c76[_0x8404('0x33')]=_[_0x8404('0x32')](_0x142aa1[_0x8404('0x33')]);_0x1f0c76[_0x8404('0x34')]=_[_0x8404('0x35')](_0x1f0c76['model'],_0x1f0c76['query']);_0x4ef876['attributes']=_['intersection'](_0x1f0c76[_0x8404('0x30')],qs[_0x8404('0x37')](_0x142aa1[_0x8404('0x33')][_0x8404('0x37')]));_0x4ef876[_0x8404('0x36')]=_0x4ef876['attributes'][_0x8404('0x47')]?_0x4ef876[_0x8404('0x36')]:_0x1f0c76[_0x8404('0x30')];if(!_0x142aa1['query'][_0x8404('0x38')](_0x8404('0x4e'))){_0x4ef876[_0x8404('0x1f')]=qs['limit'](_0x142aa1[_0x8404('0x33')]['limit']);_0x4ef876[_0x8404('0x1d')]=qs[_0x8404('0x1d')](_0x142aa1[_0x8404('0x33')][_0x8404('0x1d')]);}_0x4ef876['order']=qs[_0x8404('0x3a')](_0x142aa1['query'][_0x8404('0x3a')]);_0x4ef876['where']=qs['filters'](_[_0x8404('0x4f')](_0x142aa1[_0x8404('0x33')],_0x1f0c76[_0x8404('0x34')]));_0x4ef876['where'][_0x8404('0x50')]=_0x15dd25['id'];if(_0x142aa1[_0x8404('0x33')][_0x8404('0x3b')]){_0x4ef876[_0x8404('0x3c')]=_[_0x8404('0x3d')](_0x4ef876[_0x8404('0x3c')],{'$or':_[_0x8404('0x31')](_0x4ef876[_0x8404('0x36')],function(_0x3797c0){var _0x3651da={};_0x3651da[_0x3797c0]={'$like':'%'+_0x142aa1['query'][_0x8404('0x3b')]+'%'};return _0x3651da;})});}_0x4ef876=_[_0x8404('0x3d')]({},_0x4ef876,_0x142aa1[_0x8404('0x51')]);return db[_0x8404('0x52')][_0x8404('0x20')]({'where':_0x4ef876[_0x8404('0x3c')]})[_0x8404('0x28')](function(_0xa2bb96){_0xf605e2[_0x8404('0x20')]=_0xa2bb96;if(_0x142aa1[_0x8404('0x33')][_0x8404('0x3f')]){_0x4ef876[_0x8404('0x40')]=[{'all':!![]}];}return db[_0x8404('0x52')][_0x8404('0x41')](_0x4ef876);})[_0x8404('0x28')](function(_0x431054){_0xf605e2[_0x8404('0x42')]=_0x431054;return _0xf605e2;});}})[_0x8404('0x28')](respondWithFilteredResult(_0x5eb7a4,_0x4ef876))[_0x8404('0x43')](handleError(_0x5eb7a4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e6adc1b..b9c3e2b 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 _0x56a4=['./jscriptySessionReport.attributes','exports','report_jscripty_sessions','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x391e71,_0x44bffa){var _0x5019b3=function(_0x4d4173){while(--_0x4d4173){_0x391e71['push'](_0x391e71['shift']());}};_0x5019b3(++_0x44bffa);}(_0x56a4,0x11b));var _0x456a=function(_0x44e167,_0x377fc6){_0x44e167=_0x44e167-0x0;var _0x32abc6=_0x56a4[_0x44e167];return _0x32abc6;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('JscriptySessionReport',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x1db9,0x176));var _0x91db=function(_0x2b53f7,_0x3a9259){_0x2b53f7=_0x2b53f7-0x0;var _0x26cee4=_0x1db9[_0x2b53f7];return _0x26cee4;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('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 0123922..25bf7d0 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 _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x188905,_0x398fac){var _0x2bf735=function(_0x228cf6){while(--_0x228cf6){_0x188905['push'](_0x188905['shift']());}};_0x2bf735(++_0x398fac);}(_0x32f4,0x154));var _0x432f=function(_0x47ee6e,_0x5c002a){_0x47ee6e=_0x47ee6e-0x0;var _0x4ae263=_0x32f4[_0x47ee6e];return _0x4ae263;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x201191,_0x177e61){var _0x5655ec=function(_0x570b54){while(--_0x570b54){_0x201191['push'](_0x201191['shift']());}};_0x5655ec(++_0x177e61);}(_0x32b6,0x1d1));var _0x632b=function(_0xe0902,_0x1e2978){_0xe0902=_0xe0902-0x0;var _0x26240c=_0x32b6[_0xe0902];return _0x26240c;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8ec76ca..aba13aa 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 _0xe523=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','exports','multer','util'];(function(_0x2b84e8,_0x4bb1a9){var _0x3f60be=function(_0x2df79c){while(--_0x2df79c){_0x2b84e8['push'](_0x2b84e8['shift']());}};_0x3f60be(++_0x4bb1a9);}(_0xe523,0x130));var _0x3e52=function(_0x3e3178,_0x38e2cf){_0x3e3178=_0x3e3178-0x0;var _0x2cae09=_0xe523[_0x3e3178];return _0x2cae09;};'use strict';var multer=require(_0x3e52('0x0'));var util=require(_0x3e52('0x1'));var path=require(_0x3e52('0x2'));var timeout=require(_0x3e52('0x3'));var express=require(_0x3e52('0x4'));var router=express[_0x3e52('0x5')]();var fs_extra=require(_0x3e52('0x6'));var auth=require(_0x3e52('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3e52('0x8'));var controller=require(_0x3e52('0x9'));router[_0x3e52('0xa')]('/',controller[_0x3e52('0xb')]);router[_0x3e52('0xc')](_0x3e52('0xd'),auth[_0x3e52('0xe')](),controller['update']);router['get'](_0x3e52('0xf'),auth[_0x3e52('0xe')](),controller['downloadLogFile']);module[_0x3e52('0x10')]=router; \ No newline at end of file +var _0xa5f6=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','update','get','/download_log_file'];(function(_0x298955,_0x4783bb){var _0xa6774e=function(_0x3edf28){while(--_0x3edf28){_0x298955['push'](_0x298955['shift']());}};_0xa6774e(++_0x4783bb);}(_0xa5f6,0x12d));var _0x6a5f=function(_0x4a96e2,_0x42719c){_0x4a96e2=_0x4a96e2-0x0;var _0x8c640b=_0xa5f6[_0x4a96e2];return _0x8c640b;};'use strict';var multer=require(_0x6a5f('0x0'));var util=require(_0x6a5f('0x1'));var path=require(_0x6a5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a5f('0x3'));var router=express['Router']();var fs_extra=require(_0x6a5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a5f('0x5'));var config=require(_0x6a5f('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x6a5f('0x7')]);router[_0x6a5f('0x8')](_0x6a5f('0x9'),auth[_0x6a5f('0xa')](),controller[_0x6a5f('0xb')]);router[_0x6a5f('0xc')](_0x6a5f('0xd'),auth[_0x6a5f('0xa')](),controller['downloadLogFile']);module[_0x6a5f('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 598a5c9..c14a714 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 _0x80f8=['STRING','sequelize','exports'];(function(_0x402ebf,_0x2eed28){var _0x6edb7d=function(_0x20a2e4){while(--_0x20a2e4){_0x402ebf['push'](_0x402ebf['shift']());}};_0x6edb7d(++_0x2eed28);}(_0x80f8,0xfa));var _0x880f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x80f8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x880f('0x0'));module[_0x880f('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x880f('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbfe8=['STRING','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfe8,0x12d));var _0x8bfe=function(_0x14a457,_0xdf1da3){_0x14a457=_0x14a457-0x0;var _0x70f824=_0xbfe8[_0x14a457];return _0x70f824;};'use strict';var Sequelize=require(_0x8bfe('0x0'));module[_0x8bfe('0x1')]={'license':{'type':Sequelize[_0x8bfe('0x2')]},'data1':{'type':Sequelize[_0x8bfe('0x3')]},'data2':{'type':Sequelize[_0x8bfe('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 60d8b22..429f343 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 _0xd47e=['keys','query','filters','intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','checkLicense','license-info.log','/var','xcally','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','License','rawAttributes'];(function(_0x4dbe86,_0x31d230){var _0x516377=function(_0x17d839){while(--_0x17d839){_0x4dbe86['push'](_0x4dbe86['shift']());}};_0x516377(++_0x31d230);}(_0xd47e,0x16f));var _0xed47=function(_0x5ee2fa,_0x1220dc){_0x5ee2fa=_0x5ee2fa-0x0;var _0x451c1c=_0xd47e[_0x5ee2fa];return _0x451c1c;};'use strict';var emlformat=require(_0xed47('0x0'));var rimraf=require(_0xed47('0x1'));var zipdir=require(_0xed47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed47('0x3'));var moment=require(_0xed47('0x4'));var BPromise=require(_0xed47('0x5'));var Mustache=require(_0xed47('0x6'));var util=require(_0xed47('0x7'));var path=require(_0xed47('0x8'));var sox=require(_0xed47('0x9'));var csv=require(_0xed47('0xa'));var ejs=require(_0xed47('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed47('0xc'));var squel=require('squel');var crypto=require(_0xed47('0xd'));var jsforce=require(_0xed47('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed47('0xa'));var querystring=require(_0xed47('0xf'));var Papa=require(_0xed47('0x10'));var Redis=require(_0xed47('0x11'));var authService=require(_0xed47('0x12'));var qs=require(_0xed47('0x13'));var as=require(_0xed47('0x14'));var hardwareService=require(_0xed47('0x15'));var logger=require(_0xed47('0x16'))('api');var utils=require(_0xed47('0x17'));var config=require(_0xed47('0x18'));var licenseUtil=require(_0xed47('0x19'));var db=require(_0xed47('0x1a'))['db'];function respondWithStatusCode(_0x4b082a,_0xa21fee){_0xa21fee=_0xa21fee||0xcc;return function(_0x494de8){if(_0x494de8){return _0x4b082a[_0xed47('0x1b')](_0xa21fee);}return _0x4b082a[_0xed47('0x1c')](_0xa21fee)[_0xed47('0x1d')]();};}function respondWithResult(_0x533e8b,_0x51bccd){_0x51bccd=_0x51bccd||0xc8;return function(_0x46026e){if(_0x46026e){return _0x533e8b[_0xed47('0x1c')](_0x51bccd)[_0xed47('0x1e')](_0x46026e);}};}function respondWithFilteredResult(_0x47432b,_0x1ae480){return function(_0x46f7cb){if(_0x46f7cb){var _0x32c437=typeof _0x1ae480[_0xed47('0x1f')]===_0xed47('0x20')&&typeof _0x1ae480['limit']===_0xed47('0x20');var _0x27acd8=_0x46f7cb[_0xed47('0x21')];var _0x22043d=_0x32c437?0x0:_0x1ae480[_0xed47('0x1f')];var _0x17ab32=_0x32c437?_0x46f7cb[_0xed47('0x21')]:_0x1ae480[_0xed47('0x1f')]+_0x1ae480[_0xed47('0x22')];var _0x2e8c7f;if(_0x17ab32>=_0x27acd8){_0x17ab32=_0x27acd8;_0x2e8c7f=0xc8;}else{_0x2e8c7f=0xce;}_0x47432b[_0xed47('0x1c')](_0x2e8c7f);return _0x47432b['set']('Content-Range',_0x22043d+'-'+_0x17ab32+'/'+_0x27acd8)[_0xed47('0x1e')](_0x46f7cb);}return null;};}function patchUpdates(_0x2c3f9c){return function(_0x6eec60){try{jsonpatch['apply'](_0x6eec60,_0x2c3f9c,!![]);}catch(_0x2ef60f){return BPromise[_0xed47('0x23')](_0x2ef60f);}return _0x6eec60[_0xed47('0x24')]();};}function saveUpdates(_0x316a2,_0x9b3e71){return function(_0x1c54a7){if(_0x1c54a7){return _0x1c54a7[_0xed47('0x25')](_0x316a2)[_0xed47('0x26')](function(_0x137220){return _0x137220;});}return null;};}function removeEntity(_0x4d2798,_0x5e8c62){return function(_0x380d7e){if(_0x380d7e){return _0x380d7e[_0xed47('0x27')]()['then'](function(){_0x4d2798[_0xed47('0x1c')](0xcc)[_0xed47('0x1d')]();});}};}function handleEntityNotFound(_0x14ff0d,_0xc2ed82){return function(_0x5995d2){if(!_0x5995d2){_0x14ff0d[_0xed47('0x1b')](0x194);}return _0x5995d2;};}function handleError(_0x74bd30,_0x37c4f0){_0x37c4f0=_0x37c4f0||0x1f4;return function(_0x39b0af){logger[_0xed47('0x28')](_0x39b0af[_0xed47('0x29')]);if(_0x39b0af[_0xed47('0x2a')]){delete _0x39b0af[_0xed47('0x2a')];}_0x74bd30[_0xed47('0x1c')](_0x37c4f0)[_0xed47('0x2b')](_0x39b0af);};}var utilLicense=require(_0xed47('0x19'));exports[_0xed47('0x2c')]=function(_0x1809ec,_0x35e040){var _0x2188f1={'raw':!![],'where':{'id':0x1}},_0x265097={};_0x265097['model']=_['keys'](db[_0xed47('0x2d')][_0xed47('0x2e')]);_0x265097['query']=_[_0xed47('0x2f')](_0x1809ec[_0xed47('0x30')]);_0x265097[_0xed47('0x31')]=_[_0xed47('0x32')](_0x265097[_0xed47('0x33')],_0x265097['query']);_0x2188f1[_0xed47('0x34')]=_[_0xed47('0x32')](_0x265097[_0xed47('0x33')],qs['fields'](_0x1809ec[_0xed47('0x30')][_0xed47('0x35')]));_0x2188f1[_0xed47('0x34')]=_0x2188f1[_0xed47('0x34')][_0xed47('0x36')]?_0x2188f1[_0xed47('0x34')]:_0x265097[_0xed47('0x33')];_0x2188f1=_[_0xed47('0x37')]({},_0x2188f1,_0x1809ec['options']);return utilLicense[_0xed47('0x38')](_0x2188f1)[_0xed47('0x26')](respondWithResult(_0x35e040,null))[_0xed47('0x39')](handleError(_0x35e040,null));};exports['update']=function(_0x3c153b,_0x5aa4b4){if(_0x3c153b[_0xed47('0x3a')]['id']){delete _0x3c153b[_0xed47('0x3a')]['id'];}return db['License'][_0xed47('0x3b')]({'where':{'id':_0x3c153b[_0xed47('0x3c')]['id']}})[_0xed47('0x26')](handleEntityNotFound(_0x5aa4b4,null))[_0xed47('0x26')](function(_0x185a4f){var _0x42bc07=_0x185a4f[_0xed47('0x3d')]({'plain':!![]});return utilLicense[_0xed47('0x3e')](_0x42bc07,_0x3c153b[_0xed47('0x3a')]['key']);})[_0xed47('0x26')](function(_0x7fac41){if(!_0x7fac41['demo']){return saveUpdates(_0x3c153b[_0xed47('0x3a')],null);}return _0x7fac41;})[_0xed47('0x26')](respondWithResult(_0x5aa4b4,null))[_0xed47('0x39')](handleError(_0x5aa4b4,null));};exports['downloadLogFile']=function(_0x233974,_0x517208){var _0x3f8534=_0xed47('0x3f');var _0x1c4c1f=path['join'](_0xed47('0x40'),'log',_0xed47('0x41'),_0x3f8534);_0x517208['setHeader']('Content-disposition','attachment;\x20filename='+_0x3f8534);_0x517208['set'](_0xed47('0x42'),_0xed47('0x43'));_0x517208[_0xed47('0x44')](_0x1c4c1f);}; \ No newline at end of file +var _0x7847=['filters','intersection','model','fields','attributes','length','options','getLicense','body','params','get','checkLicense','key','demo','catch','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','path','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','reject','save','update','then','error','name','send','index','keys','License','rawAttributes','query'];(function(_0x5c3404,_0x5e4ad0){var _0x24cdde=function(_0x286000){while(--_0x286000){_0x5c3404['push'](_0x5c3404['shift']());}};_0x24cdde(++_0x5e4ad0);}(_0x7847,0x1a3));var _0x7784=function(_0x5135f1,_0xf4d1b){_0x5135f1=_0x5135f1-0x0;var _0x1ad043=_0x7847[_0x5135f1];return _0x1ad043;};'use strict';var emlformat=require(_0x7784('0x0'));var rimraf=require(_0x7784('0x1'));var zipdir=require(_0x7784('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7784('0x3'));var moment=require('moment');var BPromise=require(_0x7784('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7784('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7784('0x6'));var _=require(_0x7784('0x7'));var squel=require(_0x7784('0x8'));var crypto=require(_0x7784('0x9'));var jsforce=require(_0x7784('0xa'));var deskjs=require(_0x7784('0xb'));var toCsv=require(_0x7784('0xc'));var querystring=require(_0x7784('0xd'));var Papa=require(_0x7784('0xe'));var Redis=require(_0x7784('0xf'));var authService=require(_0x7784('0x10'));var qs=require(_0x7784('0x11'));var as=require(_0x7784('0x12'));var hardwareService=require(_0x7784('0x13'));var logger=require('../../config/logger')(_0x7784('0x14'));var utils=require(_0x7784('0x15'));var config=require(_0x7784('0x16'));var licenseUtil=require(_0x7784('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38873d,_0x237b4b){_0x237b4b=_0x237b4b||0xcc;return function(_0x5d26a9){if(_0x5d26a9){return _0x38873d[_0x7784('0x18')](_0x237b4b);}return _0x38873d['status'](_0x237b4b)[_0x7784('0x19')]();};}function respondWithResult(_0x199a9a,_0x5e93c4){_0x5e93c4=_0x5e93c4||0xc8;return function(_0x4ec443){if(_0x4ec443){return _0x199a9a[_0x7784('0x1a')](_0x5e93c4)['json'](_0x4ec443);}};}function respondWithFilteredResult(_0x333836,_0x29b359){return function(_0x1793f7){if(_0x1793f7){var _0x1ee436=typeof _0x29b359[_0x7784('0x1b')]==='undefined'&&typeof _0x29b359[_0x7784('0x1c')]==='undefined';var _0x1539a3=_0x1793f7[_0x7784('0x1d')];var _0x2fe320=_0x1ee436?0x0:_0x29b359['offset'];var _0x52e59c=_0x1ee436?_0x1793f7[_0x7784('0x1d')]:_0x29b359[_0x7784('0x1b')]+_0x29b359[_0x7784('0x1c')];var _0x34998b;if(_0x52e59c>=_0x1539a3){_0x52e59c=_0x1539a3;_0x34998b=0xc8;}else{_0x34998b=0xce;}_0x333836[_0x7784('0x1a')](_0x34998b);return _0x333836['set'](_0x7784('0x1e'),_0x2fe320+'-'+_0x52e59c+'/'+_0x1539a3)['json'](_0x1793f7);}return null;};}function patchUpdates(_0x497442){return function(_0x1669ff){try{jsonpatch['apply'](_0x1669ff,_0x497442,!![]);}catch(_0x35ad97){return BPromise[_0x7784('0x1f')](_0x35ad97);}return _0x1669ff[_0x7784('0x20')]();};}function saveUpdates(_0x42af07,_0x3ecabf){return function(_0x43a5ab){if(_0x43a5ab){return _0x43a5ab[_0x7784('0x21')](_0x42af07)[_0x7784('0x22')](function(_0x5aed48){return _0x5aed48;});}return null;};}function removeEntity(_0x228b8c,_0x1c1ba5){return function(_0x1cc479){if(_0x1cc479){return _0x1cc479['destroy']()[_0x7784('0x22')](function(){_0x228b8c[_0x7784('0x1a')](0xcc)[_0x7784('0x19')]();});}};}function handleEntityNotFound(_0xe44166,_0x1f0abc){return function(_0x12ff51){if(!_0x12ff51){_0xe44166[_0x7784('0x18')](0x194);}return _0x12ff51;};}function handleError(_0x597db9,_0x221425){_0x221425=_0x221425||0x1f4;return function(_0x5dbdca){logger[_0x7784('0x23')](_0x5dbdca['stack']);if(_0x5dbdca[_0x7784('0x24')]){delete _0x5dbdca[_0x7784('0x24')];}_0x597db9['status'](_0x221425)[_0x7784('0x25')](_0x5dbdca);};}var utilLicense=require('../../config/license/util');exports[_0x7784('0x26')]=function(_0x438fb4,_0x4c2d28){var _0x2217b1={'raw':!![],'where':{'id':0x1}},_0x57982a={};_0x57982a['model']=_[_0x7784('0x27')](db[_0x7784('0x28')][_0x7784('0x29')]);_0x57982a[_0x7784('0x2a')]=_[_0x7784('0x27')](_0x438fb4['query']);_0x57982a[_0x7784('0x2b')]=_[_0x7784('0x2c')](_0x57982a[_0x7784('0x2d')],_0x57982a[_0x7784('0x2a')]);_0x2217b1['attributes']=_[_0x7784('0x2c')](_0x57982a[_0x7784('0x2d')],qs['fields'](_0x438fb4[_0x7784('0x2a')][_0x7784('0x2e')]));_0x2217b1[_0x7784('0x2f')]=_0x2217b1[_0x7784('0x2f')][_0x7784('0x30')]?_0x2217b1['attributes']:_0x57982a[_0x7784('0x2d')];_0x2217b1=_['merge']({},_0x2217b1,_0x438fb4[_0x7784('0x31')]);return utilLicense[_0x7784('0x32')](_0x2217b1)[_0x7784('0x22')](respondWithResult(_0x4c2d28,null))['catch'](handleError(_0x4c2d28,null));};exports[_0x7784('0x21')]=function(_0x2cf26d,_0x44ac9f){if(_0x2cf26d[_0x7784('0x33')]['id']){delete _0x2cf26d['body']['id'];}return db[_0x7784('0x28')]['find']({'where':{'id':_0x2cf26d[_0x7784('0x34')]['id']}})['then'](handleEntityNotFound(_0x44ac9f,null))[_0x7784('0x22')](function(_0x3db76d){var _0x18e67f=_0x3db76d[_0x7784('0x35')]({'plain':!![]});return utilLicense[_0x7784('0x36')](_0x18e67f,_0x2cf26d[_0x7784('0x33')][_0x7784('0x37')]);})['then'](function(_0xd14b17){if(!_0xd14b17[_0x7784('0x38')]){return saveUpdates(_0x2cf26d[_0x7784('0x33')],null);}return _0xd14b17;})[_0x7784('0x22')](respondWithResult(_0x44ac9f,null))[_0x7784('0x39')](handleError(_0x44ac9f,null));};exports['downloadLogFile']=function(_0x18c9f2,_0x1b38ae){var _0x5898f7='license-info.log';var _0x41f6f2=path[_0x7784('0x3a')]('/var',_0x7784('0x3b'),_0x7784('0x3c'),_0x5898f7);_0x1b38ae[_0x7784('0x3d')](_0x7784('0x3e'),_0x7784('0x3f')+_0x5898f7);_0x1b38ae['set']('Content-Type',_0x7784('0x40'));_0x1b38ae[_0x7784('0x41')](_0x41f6f2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7c9cc1c..4ab1910 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 _0xe44a=['exports','License','license','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./license.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe44a,0x18f));var _0xae44=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe44a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xae44('0x0'));var util=require('util');var logger=require(_0xae44('0x1'))(_0xae44('0x2'));var moment=require(_0xae44('0x3'));var BPromise=require(_0xae44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae44('0x5'));var rimraf=require(_0xae44('0x6'));var config=require('../../config/environment');var attributes=require(_0xae44('0x7'));module[_0xae44('0x8')]=function(_0x1e1e65,_0x3760da){return _0x1e1e65['define'](_0xae44('0x9'),attributes,{'tableName':_0xae44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1826=['rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4cfc35,_0xb52690){var _0x43a384=function(_0x3d896f){while(--_0x3d896f){_0x4cfc35['push'](_0x4cfc35['shift']());}};_0x43a384(++_0xb52690);}(_0x1826,0x192));var _0x6182=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x1826[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x6182('0x0'));var util=require(_0x6182('0x1'));var logger=require(_0x6182('0x2'))(_0x6182('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6182('0x4'));var fs=require('fs');var path=require(_0x6182('0x5'));var rimraf=require(_0x6182('0x6'));var config=require(_0x6182('0x7'));var attributes=require(_0x6182('0x8'));module[_0x6182('0x9')]=function(_0x20c798,_0x53810e){return _0x20c798[_0x6182('0xa')]('License',attributes,{'tableName':_0x6182('0xb'),'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 88633f6..34f1268 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 _0x1b06=['http','then','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x1b06,0x1af));var _0x61b0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1b06[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x61b0('0x0'));var util=require('util');var moment=require(_0x61b0('0x1'));var BPromise=require(_0x61b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61b0('0x3'));var db=require(_0x61b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61b0('0x5'))('rpc');var config=require(_0x61b0('0x6'));var jayson=require(_0x61b0('0x7'));var client=jayson[_0x61b0('0x8')][_0x61b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33a7d6,_0x4f2290,_0x1655ec){return new BPromise(function(_0x34021d,_0x1679b0){return client['request'](_0x33a7d6,_0x1655ec)[_0x61b0('0xa')](function(_0x24e0e1){logger['info']('License,\x20%s,\x20%s',_0x4f2290,'request\x20sent');logger[_0x61b0('0xb')](_0x61b0('0xc'),_0x4f2290,_0x61b0('0xd'),JSON[_0x61b0('0xe')](_0x24e0e1));if(_0x24e0e1['error']){if(_0x24e0e1[_0x61b0('0xf')]['code']===0x1f4){logger[_0x61b0('0xf')](_0x61b0('0x10'),_0x4f2290,_0x24e0e1['error'][_0x61b0('0x11')]);return _0x1679b0(_0x24e0e1['error']['message']);}logger[_0x61b0('0xf')](_0x61b0('0x10'),_0x4f2290,_0x24e0e1[_0x61b0('0xf')][_0x61b0('0x11')]);return _0x34021d(_0x24e0e1[_0x61b0('0xf')][_0x61b0('0x11')]);}else{logger[_0x61b0('0x12')]('License,\x20%s,\x20%s',_0x4f2290,_0x61b0('0xd'));_0x34021d(_0x24e0e1[_0x61b0('0x13')][_0x61b0('0x11')]);}})['catch'](function(_0x4b12c2){logger[_0x61b0('0xf')](_0x61b0('0x10'),_0x4f2290,_0x4b12c2);_0x1679b0(_0x4b12c2);});});} \ No newline at end of file +var _0x0ed1=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x44699a,_0x577c57){var _0x5213cb=function(_0x463c7b){while(--_0x463c7b){_0x44699a['push'](_0x44699a['shift']());}};_0x5213cb(++_0x577c57);}(_0x0ed1,0xcf));var _0x10ed=function(_0x4d3bbe,_0x12e972){_0x4d3bbe=_0x4d3bbe-0x0;var _0x5c7af0=_0x0ed1[_0x4d3bbe];return _0x5c7af0;};'use strict';var _=require(_0x10ed('0x0'));var util=require(_0x10ed('0x1'));var moment=require(_0x10ed('0x2'));var BPromise=require(_0x10ed('0x3'));var rs=require(_0x10ed('0x4'));var fs=require('fs');var Redis=require(_0x10ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10ed('0x6'));var logger=require(_0x10ed('0x7'))(_0x10ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x10ed('0x9'));var client=jayson['client'][_0x10ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a677d,_0x450c77,_0x1ba5d5){return new BPromise(function(_0x1521cd,_0x3d8ab5){return client['request'](_0x3a677d,_0x1ba5d5)[_0x10ed('0xb')](function(_0x325f1e){logger[_0x10ed('0xc')](_0x10ed('0xd'),_0x450c77,_0x10ed('0xe'));logger[_0x10ed('0xf')](_0x10ed('0x10'),_0x450c77,_0x10ed('0xe'),JSON[_0x10ed('0x11')](_0x325f1e));if(_0x325f1e['error']){if(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x13')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x450c77,_0x325f1e['error']['message']);return _0x3d8ab5(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);}logger[_0x10ed('0x12')]('License,\x20%s,\x20%s',_0x450c77,_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);return _0x1521cd(_0x325f1e[_0x10ed('0x12')][_0x10ed('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x450c77,_0x10ed('0xe'));_0x1521cd(_0x325f1e[_0x10ed('0x15')][_0x10ed('0x14')]);}})[_0x10ed('0x16')](function(_0x5cd5bb){logger['error'](_0x10ed('0xd'),_0x450c77,_0x5cd5bb);_0x3d8ab5(_0x5cd5bb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5659145..09703d4 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 _0x6684=['verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','/:id/applications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeSmtp','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify'];(function(_0x210149,_0x234507){var _0x55d7de=function(_0x5c9f87){while(--_0x5c9f87){_0x210149['push'](_0x210149['shift']());}};_0x55d7de(++_0x234507);}(_0x6684,0x73));var _0x4668=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x6684[_0xda464c];return _0x19e222;};'use strict';var multer=require('multer');var util=require(_0x4668('0x0'));var path=require(_0x4668('0x1'));var timeout=require(_0x4668('0x2'));var express=require(_0x4668('0x3'));var router=express[_0x4668('0x4')]();var fs_extra=require(_0x4668('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4668('0x6'));var config=require(_0x4668('0x7'));var controller=require('./mailAccount.controller');router[_0x4668('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4668('0x8')](_0x4668('0x9'),auth[_0x4668('0xa')](),controller[_0x4668('0xb')]);router[_0x4668('0x8')]('/:id',auth[_0x4668('0xa')](),controller[_0x4668('0xc')]);router['get'](_0x4668('0xd'),auth[_0x4668('0xa')](),controller[_0x4668('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4668('0xf')]);router['get'](_0x4668('0x10'),auth[_0x4668('0xa')](),controller[_0x4668('0x11')]);router[_0x4668('0x8')](_0x4668('0x12'),auth[_0x4668('0xa')](),controller[_0x4668('0x13')]);router[_0x4668('0x8')](_0x4668('0x14'),auth['isAuthenticated'](),controller[_0x4668('0x15')]);router[_0x4668('0x8')]('/:id/applications',auth[_0x4668('0xa')](),controller[_0x4668('0x16')]);router[_0x4668('0x8')](_0x4668('0x17'),auth[_0x4668('0xa')](),controller[_0x4668('0x18')]);router['get'](_0x4668('0x19'),auth[_0x4668('0xa')](),controller[_0x4668('0x1a')]);router[_0x4668('0x8')](_0x4668('0x1b'),auth[_0x4668('0xa')](),controller[_0x4668('0x1c')]);router[_0x4668('0x1d')](_0x4668('0xd'),auth[_0x4668('0xa')](),controller[_0x4668('0x1e')]);router[_0x4668('0x1d')](_0x4668('0x1f'),auth[_0x4668('0xa')](),controller[_0x4668('0x20')]);router[_0x4668('0x1d')]('/',auth[_0x4668('0xa')](),controller[_0x4668('0x21')]);router[_0x4668('0x1d')](_0x4668('0x10'),auth['isAuthenticated'](),controller['addImap']);router[_0x4668('0x1d')](_0x4668('0x12'),auth[_0x4668('0xa')](),controller[_0x4668('0x22')]);router[_0x4668('0x1d')](_0x4668('0x14'),auth[_0x4668('0xa')](),controller['addInteraction']);router[_0x4668('0x1d')](_0x4668('0x23'),auth[_0x4668('0xa')](),controller['addApplications']);router[_0x4668('0x1d')](_0x4668('0x24'),auth[_0x4668('0xa')](),controller[_0x4668('0x25')]);router[_0x4668('0x1d')](_0x4668('0x1b'),auth['isAuthenticated'](),controller[_0x4668('0x26')]);router[_0x4668('0x27')](_0x4668('0x28'),auth[_0x4668('0xa')](),controller[_0x4668('0x29')]);router[_0x4668('0x2a')](_0x4668('0xd'),auth[_0x4668('0xa')](),controller[_0x4668('0x2b')]);router['delete'](_0x4668('0x1f'),auth[_0x4668('0xa')](),controller['removeAnswers']);router[_0x4668('0x2a')](_0x4668('0x10'),auth['isAuthenticated'](),controller['removeImap']);router[_0x4668('0x2a')]('/:id/out_servers',auth[_0x4668('0xa')](),controller[_0x4668('0x2c')]);router['delete'](_0x4668('0x28'),auth[_0x4668('0xa')](),controller[_0x4668('0x2d')]);router[_0x4668('0x2a')](_0x4668('0x1b'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x4668('0x2e')]=router; \ No newline at end of file +var _0xb923=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','create','post','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x48478b,_0x1f15c3){var _0x48b4be=function(_0x3a795d){while(--_0x3a795d){_0x48478b['push'](_0x48478b['shift']());}};_0x48b4be(++_0x1f15c3);}(_0xb923,0x1cf));var _0x3b92=function(_0x5226b2,_0x3b3e61){_0x5226b2=_0x5226b2-0x0;var _0x325357=_0xb923[_0x5226b2];return _0x325357;};'use strict';var multer=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var path=require(_0x3b92('0x2'));var timeout=require(_0x3b92('0x3'));var express=require(_0x3b92('0x4'));var router=express[_0x3b92('0x5')]();var fs_extra=require(_0x3b92('0x6'));var auth=require(_0x3b92('0x7'));var interaction=require(_0x3b92('0x8'));var config=require(_0x3b92('0x9'));var controller=require(_0x3b92('0xa'));router[_0x3b92('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b92('0xc')]);router[_0x3b92('0xb')]('/describe',auth[_0x3b92('0xd')](),controller[_0x3b92('0xe')]);router[_0x3b92('0xb')](_0x3b92('0xf'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x10')]);router[_0x3b92('0xb')](_0x3b92('0x11'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x12')]);router[_0x3b92('0xb')](_0x3b92('0x13'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x3b92('0xb')]('/:id/in_servers',auth[_0x3b92('0xd')](),controller[_0x3b92('0x14')]);router[_0x3b92('0xb')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x16')]);router['get'](_0x3b92('0x17'),auth[_0x3b92('0xd')](),controller['getInteractions']);router[_0x3b92('0xb')](_0x3b92('0x18'),auth[_0x3b92('0xd')](),controller['getApplications']);router[_0x3b92('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3b92('0x19')]);router[_0x3b92('0xb')](_0x3b92('0x1a'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1b')]);router[_0x3b92('0xb')](_0x3b92('0x1c'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1d')]);router['post'](_0x3b92('0x11'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1e')]);router['post'](_0x3b92('0x13'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x1f')]);router['post']('/',auth[_0x3b92('0xd')](),controller[_0x3b92('0x20')]);router[_0x3b92('0x21')](_0x3b92('0x22'),auth['isAuthenticated'](),controller['addImap']);router[_0x3b92('0x21')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x23')]);router['post']('/:id/interactions',auth[_0x3b92('0xd')](),controller[_0x3b92('0x24')]);router[_0x3b92('0x21')](_0x3b92('0x18'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x25')]);router['post'](_0x3b92('0x26'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x27')]);router[_0x3b92('0x21')](_0x3b92('0x1c'),auth[_0x3b92('0xd')](),controller['addAgents']);router['put'](_0x3b92('0xf'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x28')]);router[_0x3b92('0x29')](_0x3b92('0x11'),auth['isAuthenticated'](),controller[_0x3b92('0x2a')]);router[_0x3b92('0x29')](_0x3b92('0x13'),auth['isAuthenticated'](),controller[_0x3b92('0x2b')]);router[_0x3b92('0x29')](_0x3b92('0x22'),auth['isAuthenticated'](),controller[_0x3b92('0x2c')]);router[_0x3b92('0x29')](_0x3b92('0x15'),auth[_0x3b92('0xd')](),controller[_0x3b92('0x2d')]);router[_0x3b92('0x29')](_0x3b92('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0x3b92('0x29')](_0x3b92('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3b92('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3fc836d..f909e27 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 _0x16a5=['INTEGER','UNSIGNED','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x484fc9,_0x4598aa){var _0x89aa01=function(_0x5256e1){while(--_0x5256e1){_0x484fc9['push'](_0x484fc9['shift']());}};_0x89aa01(++_0x4598aa);}(_0x16a5,0xdc));var _0x516a=function(_0x34ecbf,_0x210898){_0x34ecbf=_0x34ecbf-0x0;var _0x115f8a=_0x16a5[_0x34ecbf];return _0x115f8a;};'use strict';var Sequelize=require('sequelize');module[_0x516a('0x0')]={'description':{'type':Sequelize[_0x516a('0x1')]},'name':{'type':Sequelize[_0x516a('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x516a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x516a('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x516a('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x516a('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x516a('0x3')]},'markAsUnread':{'type':Sequelize[_0x516a('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x516a('0x1')],'allowNull':![],'defaultValue':_0x516a('0x4')},'fontSize':{'type':Sequelize[_0x516a('0x5')](0x2)[_0x516a('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x516a('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x516a('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x516a('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x516a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x516a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x516a('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x516a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x516a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0x516a('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x232305){if(!_0x232305)this[_0x516a('0x7')](_0x516a('0x8'),null);this['setDataValue'](_0x516a('0x9'),_0x232305);}},'provider':{'type':Sequelize[_0x516a('0xa')]('gmail',_0x516a('0xb'),'yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x18c2df=this[_0x516a('0xc')](_0x516a('0xd'));return _0x18c2df||'custom';},'set':function(_0x152be7){if(_0x152be7===_0x516a('0xe')){_0x152be7=null;}return this[_0x516a('0x7')]('provider',_0x152be7);}}}; \ No newline at end of file +var _0x1c39=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0x1c39,0xc7));var _0x91c3=function(_0x1c5feb,_0x3d9b3b){_0x1c5feb=_0x1c5feb-0x0;var _0x534222=_0x1c39[_0x1c5feb];return _0x534222;};'use strict';var Sequelize=require(_0x91c3('0x0'));module[_0x91c3('0x1')]={'description':{'type':Sequelize[_0x91c3('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x91c3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x91c3('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x91c3('0x4')]},'markAsUnread':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x91c3('0x2')],'allowNull':![],'defaultValue':_0x91c3('0x5')},'fontSize':{'type':Sequelize[_0x91c3('0x6')](0x2)[_0x91c3('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x91c3('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x91c3('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x91c3('0x3')],'defaultValue':![],'comment':_0x91c3('0xa'),'set':function(_0xa49a44){if(!_0xa49a44)this[_0x91c3('0xb')]('mandatoryDispositionPauseId',null);this[_0x91c3('0xb')](_0x91c3('0xc'),_0xa49a44);}},'provider':{'type':Sequelize['ENUM'](_0x91c3('0xd'),_0x91c3('0xe'),_0x91c3('0xf'),_0x91c3('0x10')),'defaultValue':null,'get':function(){var _0x4f93b9=this[_0x91c3('0x11')](_0x91c3('0x12'));return _0x4f93b9||_0x91c3('0x13');},'set':function(_0x1610fc){if(_0x1610fc==='custom'){_0x1610fc=null;}return this[_0x91c3('0xb')](_0x91c3('0x12'),_0x1610fc);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8a48cc2..fcdfef3 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 _0x973b=['filter','options','MailAccount','includeAll','include','findAll','catch','params','fields','body','provider','secure','find','update','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rawAttributes','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','removeAnswers','key','custom','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','messageId','Messages','verifySmtp','Sequelize','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','then','destroy','MailAccounts','UserProfileResource','end','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x296336,_0x445462){var _0x4a27b6=function(_0x2d46f7){while(--_0x2d46f7){_0x296336['push'](_0x296336['shift']());}};_0x4a27b6(++_0x445462);}(_0x973b,0x6e));var _0xb973=function(_0x12f9ed,_0x2c1b06){_0x12f9ed=_0x12f9ed-0x0;var _0x36837c=_0x973b[_0x12f9ed];return _0x36837c;};'use strict';var moment=require(_0xb973('0x0'));var BPromise=require(_0xb973('0x1'));var util=require(_0xb973('0x2'));var path=require(_0xb973('0x3'));var _=require(_0xb973('0x4'));var juice=require(_0xb973('0x5'));var Redis=require(_0xb973('0x6'));var qs=require(_0xb973('0x7'));var logger=require(_0xb973('0x8'))(_0xb973('0x9'));var config=require(_0xb973('0xa'));var db=require('../../mysqldb')['db'];config[_0xb973('0xb')]=_[_0xb973('0xc')](config['redis'],{'host':_0xb973('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb973('0xe'))[_0xb973('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb973('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x4dfb85,_0x21a475,_0x75e049,_0x4d2ca9){return new BPromise(function(_0x576a60,_0x3e5298){var _0xfd98af=_0x4d2ca9||client;return _0xfd98af['request'](_0x4dfb85,_0x75e049)['then'](function(_0x20193e){logger[_0xb973('0x11')](_0xb973('0x12'),_0x21a475,_0xb973('0x13'));logger[_0xb973('0x14')](_0xb973('0x15'),_0x21a475,_0xb973('0x13'),JSON[_0xb973('0x16')](_0x20193e));if(_0x20193e['error']){if(_0x20193e[_0xb973('0x17')]['code']===0x1f4){logger[_0xb973('0x17')](_0xb973('0x12'),_0x21a475,_0x20193e[_0xb973('0x17')][_0xb973('0x18')]);return _0x3e5298(_0x20193e[_0xb973('0x17')][_0xb973('0x18')]);}logger[_0xb973('0x17')](_0xb973('0x12'),_0x21a475,_0x20193e[_0xb973('0x17')][_0xb973('0x18')]);return _0x576a60(_0x20193e[_0xb973('0x17')][_0xb973('0x18')]);}else{logger[_0xb973('0x11')](_0xb973('0x12'),_0x21a475,_0xb973('0x13'));_0x576a60(_0x20193e['result'][_0xb973('0x18')]);}})['catch'](function(_0x182f7c){logger[_0xb973('0x17')]('MailAccount,\x20%s,\x20%s',_0x21a475,_0x182f7c);_0x3e5298(_0x182f7c);});});}function respondWithStatusCode(_0x38e101,_0x44437f){_0x44437f=_0x44437f||0xcc;return function(_0x42546a){if(_0x42546a){return _0x38e101[_0xb973('0x19')](_0x44437f);}return _0x38e101[_0xb973('0x1a')](_0x44437f)['end']();};}function respondWithResult(_0x2f76b6,_0x2af6d9){_0x2af6d9=_0x2af6d9||0xc8;return function(_0x1eebd2){if(_0x1eebd2){return _0x2f76b6['status'](_0x2af6d9)['json'](_0x1eebd2);}};}function respondWithFilteredResult(_0x154950,_0x531876){return function(_0xa6229a){if(_0xa6229a){var _0x562126=typeof _0x531876[_0xb973('0x1b')]==='undefined'&&typeof _0x531876[_0xb973('0x1c')]===_0xb973('0x1d');var _0x2cbeae=_0xa6229a[_0xb973('0x1e')];var _0x5c419b=_0x562126?0x0:_0x531876[_0xb973('0x1b')];var _0x3e273b=_0x562126?_0xa6229a['count']:_0x531876[_0xb973('0x1b')]+_0x531876[_0xb973('0x1c')];var _0x4c9d65;if(_0x3e273b>=_0x2cbeae){_0x3e273b=_0x2cbeae;_0x4c9d65=0xc8;}else{_0x4c9d65=0xce;}_0x154950['status'](_0x4c9d65);return _0x154950[_0xb973('0x1f')](_0xb973('0x20'),_0x5c419b+'-'+_0x3e273b+'/'+_0x2cbeae)[_0xb973('0x21')](_0xa6229a);}return null;};}function saveUpdates(_0x4a5641){return function(_0x13a9d5){if(_0x13a9d5){return _0x13a9d5['update'](_0x4a5641)[_0xb973('0x22')](function(_0x2561f4){return _0x2561f4;});}return null;};}function removeEntity(_0x5a7164){return function(_0x34adf6){if(_0x34adf6){return _0x34adf6[_0xb973('0x23')]()['then'](function(){var _0x6b040b=_0x34adf6['get']({'plain':!![]});var _0x40e1bc=_0xb973('0x24');return db[_0xb973('0x25')][_0xb973('0x23')]({'where':{'type':_0x40e1bc,'resourceId':_0x6b040b['id']}})[_0xb973('0x22')](function(){return _0x34adf6;});})[_0xb973('0x22')](function(){_0x5a7164[_0xb973('0x1a')](0xcc)[_0xb973('0x26')]();});}};}function handleEntityNotFound(_0x55ea92){return function(_0x421b0d){if(!_0x421b0d){_0x55ea92[_0xb973('0x19')](0x194);}return _0x421b0d;};}function handleError(_0x134a4f,_0x3b59f6){_0x3b59f6=_0x3b59f6||0x1f4;return function(_0x3d012f){logger[_0xb973('0x17')](_0x3d012f[_0xb973('0x27')]);if(_0x3d012f[_0xb973('0x28')]){delete _0x3d012f[_0xb973('0x28')];}_0x134a4f[_0xb973('0x1a')](_0x3b59f6)['send'](_0x3d012f);};}function getImapHost(_0x22de07){switch(_0x22de07){case _0xb973('0x29'):return _0xb973('0x2a');case _0xb973('0x2b'):return _0xb973('0x2c');case _0xb973('0x2d'):return'imap-mail.outlook.com';case _0xb973('0x2e'):return _0xb973('0x2f');}throw new Error(_0xb973('0x30'),_0x22de07);}function getSmtpHost(_0xab2584){switch(_0xab2584){case _0xb973('0x29'):return'smtp.gmail.com';case _0xb973('0x2b'):return _0xb973('0x31');case _0xb973('0x2d'):return'smtp-mail.outlook.com';case _0xb973('0x2e'):return'smtp.office365.com';}throw new Error(_0xb973('0x30'),_0xab2584);}function getAuthenticationOptions(_0x5479ba,_0x97771e){var _0x3ffa15={};var _0xb3d8a0={};if(_0x5479ba){_0x3ffa15[_0xb973('0x32')]=_0xb3d8a0['user']=_0x97771e[_0xb973('0x33')];_0x3ffa15[_0xb973('0x34')]=_0xb3d8a0[_0xb973('0x35')]=_0x97771e[_0xb973('0x34')];if(_0x97771e[_0xb973('0x36')]){_0x3ffa15[_0xb973('0x36')]=_0xb3d8a0[_0xb973('0x36')]=!![];_0x3ffa15['CloudProviderId']=_0xb3d8a0[_0xb973('0x37')]=_0x97771e[_0xb973('0x37')];_0x3ffa15[_0xb973('0x34')]=_0xb3d8a0[_0xb973('0x35')]=null;}else{_0x3ffa15['CloudProviderId']=_0xb3d8a0['CloudProviderId']=null;}_0x3ffa15[_0xb973('0x38')]=getImapHost(_0x5479ba);_0x3ffa15[_0xb973('0x39')]=0x3e1;_0xb3d8a0[_0xb973('0x38')]=getSmtpHost(_0x5479ba);_0xb3d8a0[_0xb973('0x39')]=0x24b;_0xb3d8a0['secure']=![];_0x3ffa15[_0xb973('0x3a')]=_0xb3d8a0[_0xb973('0x3a')]=null;}else{if(_0x97771e[_0xb973('0x3b')]){_0x3ffa15[_0xb973('0x32')]=_0xb3d8a0[_0xb973('0x32')]=_0x97771e[_0xb973('0x33')];_0x3ffa15[_0xb973('0x34')]=_0xb3d8a0[_0xb973('0x35')]=_0x97771e[_0xb973('0x34')];}else{_0x3ffa15[_0xb973('0x3b')]=_0xb3d8a0[_0xb973('0x3b')]=![];_0x3ffa15[_0xb973('0x32')]=_0xb3d8a0[_0xb973('0x32')]=null;_0x3ffa15[_0xb973('0x34')]=_0xb3d8a0[_0xb973('0x35')]=null;}_0x3ffa15['host']=_0x97771e[_0xb973('0x3c')]['host'];_0x3ffa15[_0xb973('0x39')]=_0x97771e[_0xb973('0x3c')][_0xb973('0x39')];_0xb3d8a0[_0xb973('0x38')]=_0x97771e[_0xb973('0x3d')][_0xb973('0x38')];_0xb3d8a0[_0xb973('0x39')]=_0x97771e['Smtp']['port'];}return{'Imap':_0x3ffa15,'Smtp':_0xb3d8a0};}exports[_0xb973('0x3e')]=function(_0x15f8b3,_0x247f12){var _0x576d64={'include':[{'model':db[_0xb973('0x3f')],'as':_0xb973('0x3c')},{'model':db[_0xb973('0x40')],'as':_0xb973('0x3d')},{'model':db[_0xb973('0x41')],'as':_0xb973('0x42')}]},_0x313257={},_0x4889c4={'count':0x0,'rows':[]};var _0x5461dc=_[_0xb973('0x43')](db['MailAccount']['rawAttributes'],function(_0x1e07bd){return{'name':_0x1e07bd[_0xb973('0x44')],'type':_0x1e07bd[_0xb973('0x45')]['key']};});_0x313257[_0xb973('0x46')]=_['map'](_0x5461dc,_0xb973('0x28'));_0x313257[_0xb973('0x47')]=_[_0xb973('0x48')](_0x15f8b3[_0xb973('0x47')]);_0x313257[_0xb973('0x49')]=_[_0xb973('0x4a')](_0x313257[_0xb973('0x46')],_0x313257['query']);_0x576d64[_0xb973('0x4b')]=_[_0xb973('0x4a')](_0x313257[_0xb973('0x46')],qs['fields'](_0x15f8b3['query']['fields']));_0x576d64[_0xb973('0x4b')]=_0x576d64[_0xb973('0x4b')][_0xb973('0x4c')]?_0x576d64[_0xb973('0x4b')]:_0x313257[_0xb973('0x46')];if(!_0x15f8b3[_0xb973('0x47')][_0xb973('0x4d')](_0xb973('0x4e'))){_0x576d64[_0xb973('0x1c')]=qs[_0xb973('0x1c')](_0x15f8b3['query'][_0xb973('0x1c')]);_0x576d64[_0xb973('0x1b')]=qs['offset'](_0x15f8b3['query'][_0xb973('0x1b')]);}_0x576d64[_0xb973('0x4f')]=qs[_0xb973('0x50')](_0x15f8b3[_0xb973('0x47')][_0xb973('0x50')]);_0x576d64[_0xb973('0x51')]=qs[_0xb973('0x49')](_[_0xb973('0x52')](_0x15f8b3[_0xb973('0x47')],_0x313257[_0xb973('0x49')]),_0x5461dc);if(_0x15f8b3[_0xb973('0x47')]['filter']){_0x576d64[_0xb973('0x51')]=_[_0xb973('0x53')](_0x576d64[_0xb973('0x51')],{'$or':_[_0xb973('0x43')](_0x5461dc,function(_0x4f6c82){if(_0x4f6c82['type']!==_0xb973('0x54')){var _0xa67c57={};_0xa67c57[_0x4f6c82[_0xb973('0x28')]]={'$like':'%'+_0x15f8b3['query'][_0xb973('0x55')]+'%'};return _0xa67c57;}})});}_0x576d64=_[_0xb973('0x53')]({},_0x576d64,_0x15f8b3[_0xb973('0x56')]);var _0x2b6104={'where':_0x576d64['where']};return db[_0xb973('0x57')][_0xb973('0x1e')](_0x2b6104)[_0xb973('0x22')](function(_0xb8f5a9){_0x4889c4[_0xb973('0x1e')]=_0xb8f5a9;if(_0x15f8b3['query'][_0xb973('0x58')]){_0x576d64[_0xb973('0x59')]=[{'all':!![]}];}return db[_0xb973('0x57')][_0xb973('0x5a')](_0x576d64);})[_0xb973('0x22')](function(_0x5214d0){_0x4889c4['rows']=_0x5214d0;return _0x4889c4;})[_0xb973('0x22')](respondWithFilteredResult(_0x247f12,_0x576d64))[_0xb973('0x5b')](handleError(_0x247f12,null));};exports['show']=function(_0x447025,_0x1d987b){var _0x214902={'raw':![],'where':{'id':_0x447025[_0xb973('0x5c')]['id']},'include':[{'model':db[_0xb973('0x3f')],'as':_0xb973('0x3c')},{'model':db[_0xb973('0x40')],'as':'Smtp'},{'model':db[_0xb973('0x41')],'as':'mandatoryDispositionPause'}]},_0x3366c1={};_0x3366c1[_0xb973('0x46')]=_[_0xb973('0x48')](db[_0xb973('0x57')]['rawAttributes']);_0x3366c1['query']=_[_0xb973('0x48')](_0x447025[_0xb973('0x47')]);_0x3366c1['filters']=_[_0xb973('0x4a')](_0x3366c1['model'],_0x3366c1[_0xb973('0x47')]);_0x214902[_0xb973('0x4b')]=_['intersection'](_0x3366c1[_0xb973('0x46')],qs[_0xb973('0x5d')](_0x447025[_0xb973('0x47')][_0xb973('0x5d')]));_0x214902[_0xb973('0x4b')]=_0x214902[_0xb973('0x4b')][_0xb973('0x4c')]?_0x214902['attributes']:_0x3366c1[_0xb973('0x46')];if(_0x447025['query'][_0xb973('0x58')]){_0x214902[_0xb973('0x59')]=[{'all':!![]}];}_0x214902=_[_0xb973('0x53')]({},_0x214902,_0x447025['options']);return db['MailAccount']['find'](_0x214902)[_0xb973('0x22')](handleEntityNotFound(_0x1d987b,null))[_0xb973('0x22')](respondWithResult(_0x1d987b,null))[_0xb973('0x5b')](handleError(_0x1d987b,null));};exports['update']=function(_0x39cb2d,_0x185e93){if(_0x39cb2d['body']['id']){delete _0x39cb2d[_0xb973('0x5e')]['id'];}var _0x51a069=_0x39cb2d[_0xb973('0x5e')][_0xb973('0x5f')]==='custom'?null:_0x39cb2d[_0xb973('0x5e')]['provider'];var _0x3153e7=_0x39cb2d[_0xb973('0x5e')][_0xb973('0x3c')]||{};var _0x39dba9=_0x39cb2d[_0xb973('0x5e')][_0xb973('0x3d')]||{};if(_0x51a069){_0x3153e7['host']=getImapHost(_0x51a069);_0x3153e7['port']=0x3e1;_0x39dba9['host']=getSmtpHost(_0x51a069);_0x39dba9[_0xb973('0x39')]=0x24b;_0x39dba9[_0xb973('0x60')]=![];}if(_0x39dba9['modernAuthentication']){_0x39dba9[_0xb973('0x60')]=![];}else{_0x39dba9[_0xb973('0x37')]=null;}if(!_0x3153e7[_0xb973('0x36')])_0x3153e7['CloudProviderId']=null;_0x39cb2d['body'][_0xb973('0x3c')]=_0x3153e7;_0x39cb2d[_0xb973('0x5e')][_0xb973('0x3d')]=_0x39dba9;return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x39cb2d[_0xb973('0x5c')]['id']},'include':[{'model':db[_0xb973('0x3f')],'as':_0xb973('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb973('0x22')](handleEntityNotFound(_0x185e93,null))['then'](function(_0x460f1d){if(!_0x460f1d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x460f1d[_0xb973('0x3a')])delete _0x39cb2d[_0xb973('0x5e')]['Imap'];return _0x460f1d;})[_0xb973('0x22')](saveUpdates(_0x39cb2d[_0xb973('0x5e')],null))[_0xb973('0x22')](function(_0x56c5a7){if(!_0x39cb2d[_0xb973('0x5e')][_0xb973('0x3c')])return _0x56c5a7;return db[_0xb973('0x3f')]['update'](_0x39cb2d['body'][_0xb973('0x3c')],{'where':{'MailAccountId':_0x56c5a7['id']}})[_0xb973('0x22')](function(){return _0x56c5a7;});})[_0xb973('0x22')](function(_0x3d2581){if(!_0x39cb2d['body'][_0xb973('0x3d')])return _0x3d2581;return db['MailServerOut'][_0xb973('0x62')](_0x39cb2d[_0xb973('0x5e')][_0xb973('0x3d')],{'where':{'MailAccountId':_0x3d2581['id']}})['then'](function(){return _0x3d2581;});})['then'](respondWithResult(_0x185e93,null))[_0xb973('0x5b')](handleError(_0x185e93,null));};exports['describe']=function(_0x39b35e,_0xca6491){return db[_0xb973('0x57')][_0xb973('0x63')]()['then'](respondWithResult(_0xca6491,null))[_0xb973('0x5b')](handleError(_0xca6491,null));};exports[_0xb973('0x64')]=function(_0x4dafe6,_0x516237){if(_0x4dafe6[_0xb973('0x5e')]['id']){delete _0x4dafe6[_0xb973('0x5e')]['id'];}return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x4dafe6[_0xb973('0x5c')]['id']}})['then'](handleEntityNotFound(_0x516237,null))[_0xb973('0x22')](function(_0x2c41ca){if(_0x2c41ca){_0x4dafe6[_0xb973('0x5e')][_0xb973('0x65')]=_0x2c41ca['id'];return db[_0xb973('0x66')]['create'](_0x4dafe6[_0xb973('0x5e')]);}})['then'](respondWithResult(_0x516237,null))['catch'](handleError(_0x516237,null));};exports[_0xb973('0x67')]=function(_0x2e60c5,_0x5830dc){var _0x3293cc={'raw':![],'where':{}};var _0x330b62={};var _0x51a58e={'count':0x0,'rows':[]};return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x2e60c5['params']['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x5830dc,null))['then'](function(_0x50b132){if(_0x50b132){_0x330b62[_0xb973('0x46')]=_[_0xb973('0x48')](db['Disposition'][_0xb973('0x69')]);_0x330b62[_0xb973('0x47')]=_['keys'](_0x2e60c5[_0xb973('0x47')]);_0x330b62[_0xb973('0x49')]=_[_0xb973('0x4a')](_0x330b62[_0xb973('0x46')],_0x330b62[_0xb973('0x47')]);_0x3293cc[_0xb973('0x4b')]=_[_0xb973('0x4a')](_0x330b62['model'],qs[_0xb973('0x5d')](_0x2e60c5['query'][_0xb973('0x5d')]));_0x3293cc[_0xb973('0x4b')]=_0x3293cc[_0xb973('0x4b')][_0xb973('0x4c')]?_0x3293cc[_0xb973('0x4b')]:_0x330b62[_0xb973('0x46')];if(!_0x2e60c5['query'][_0xb973('0x4d')](_0xb973('0x4e'))){_0x3293cc['limit']=qs['limit'](_0x2e60c5[_0xb973('0x47')]['limit']);_0x3293cc[_0xb973('0x1b')]=qs[_0xb973('0x1b')](_0x2e60c5['query'][_0xb973('0x1b')]);}_0x3293cc[_0xb973('0x4f')]=qs[_0xb973('0x50')](_0x2e60c5[_0xb973('0x47')][_0xb973('0x50')]);_0x3293cc[_0xb973('0x51')]=qs[_0xb973('0x49')](_[_0xb973('0x52')](_0x2e60c5[_0xb973('0x47')],_0x330b62[_0xb973('0x49')]));_0x3293cc[_0xb973('0x51')][_0xb973('0x65')]=_0x50b132['id'];if(_0x2e60c5[_0xb973('0x47')][_0xb973('0x55')]){_0x3293cc['where']=_[_0xb973('0x53')](_0x3293cc[_0xb973('0x51')],{'$or':_['map'](_0x3293cc[_0xb973('0x4b')],function(_0x3ab2e5){var _0x3efa4c={};_0x3efa4c[_0x3ab2e5]={'$like':'%'+_0x2e60c5['query'][_0xb973('0x55')]+'%'};return _0x3efa4c;})});}_0x3293cc=_[_0xb973('0x53')]({},_0x3293cc,_0x2e60c5[_0xb973('0x56')]);return db['Disposition'][_0xb973('0x1e')]({'where':_0x3293cc[_0xb973('0x51')]})[_0xb973('0x22')](function(_0x312040){_0x51a58e[_0xb973('0x1e')]=_0x312040;if(_0x2e60c5[_0xb973('0x47')][_0xb973('0x58')]){_0x3293cc[_0xb973('0x59')]=[{'all':!![]}];}return db[_0xb973('0x66')][_0xb973('0x5a')](_0x3293cc);})[_0xb973('0x22')](function(_0x3b3e33){_0x51a58e[_0xb973('0x6a')]=_0x3b3e33;return _0x51a58e;});}})[_0xb973('0x22')](respondWithFilteredResult(_0x5830dc,_0x3293cc))[_0xb973('0x5b')](handleError(_0x5830dc,null));};exports[_0xb973('0x6b')]=function(_0x1df8d3,_0x1e7663){return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x1df8d3[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x1e7663,null))[_0xb973('0x22')](function(_0x276cf1){if(_0x276cf1){return _0x276cf1['removeDispositions'](_0x1df8d3[_0xb973('0x47')][_0xb973('0x6c')]);}})[_0xb973('0x22')](respondWithStatusCode(_0x1e7663,null))['catch'](handleError(_0x1e7663,null));};exports[_0xb973('0x6d')]=function(_0x182565,_0x4f56b7){if(_0x182565[_0xb973('0x5e')]['id']){delete _0x182565[_0xb973('0x5e')]['id'];}return db['MailAccount'][_0xb973('0x61')]({'where':{'id':_0x182565[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x4f56b7,null))['then'](function(_0x31a876){if(_0x31a876){_0x182565['body'][_0xb973('0x65')]=_0x31a876['id'];return db[_0xb973('0x6e')][_0xb973('0x6f')](_0x182565[_0xb973('0x5e')]);}})[_0xb973('0x22')](respondWithResult(_0x4f56b7,null))[_0xb973('0x5b')](handleError(_0x4f56b7,null));};exports['getAnswers']=function(_0x33e29d,_0x20b437){var _0x149066={'raw':![],'where':{}};var _0x2aff0f={};var _0x16dec5={'count':0x0,'rows':[]};return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x33e29d['params']['id']}})['then'](handleEntityNotFound(_0x20b437,null))[_0xb973('0x22')](function(_0x55e3a7){if(_0x55e3a7){_0x2aff0f['model']=_['keys'](db[_0xb973('0x6e')][_0xb973('0x69')]);_0x2aff0f[_0xb973('0x47')]=_['keys'](_0x33e29d[_0xb973('0x47')]);_0x2aff0f[_0xb973('0x49')]=_['intersection'](_0x2aff0f['model'],_0x2aff0f[_0xb973('0x47')]);_0x149066[_0xb973('0x4b')]=_[_0xb973('0x4a')](_0x2aff0f[_0xb973('0x46')],qs[_0xb973('0x5d')](_0x33e29d[_0xb973('0x47')][_0xb973('0x5d')]));_0x149066[_0xb973('0x4b')]=_0x149066[_0xb973('0x4b')][_0xb973('0x4c')]?_0x149066[_0xb973('0x4b')]:_0x2aff0f[_0xb973('0x46')];if(!_0x33e29d['query'][_0xb973('0x4d')](_0xb973('0x4e'))){_0x149066[_0xb973('0x1c')]=qs[_0xb973('0x1c')](_0x33e29d[_0xb973('0x47')][_0xb973('0x1c')]);_0x149066[_0xb973('0x1b')]=qs[_0xb973('0x1b')](_0x33e29d['query'][_0xb973('0x1b')]);}_0x149066['order']=qs[_0xb973('0x50')](_0x33e29d[_0xb973('0x47')][_0xb973('0x50')]);_0x149066[_0xb973('0x51')]=qs['filters'](_[_0xb973('0x52')](_0x33e29d['query'],_0x2aff0f[_0xb973('0x49')]));_0x149066['where']['MailAccountId']=_0x55e3a7['id'];if(_0x33e29d[_0xb973('0x47')][_0xb973('0x55')]){_0x149066['where']=_[_0xb973('0x53')](_0x149066[_0xb973('0x51')],{'$or':_[_0xb973('0x43')](_0x149066[_0xb973('0x4b')],function(_0x15e169){var _0x1c01d5={};_0x1c01d5[_0x15e169]={'$like':'%'+_0x33e29d['query'][_0xb973('0x55')]+'%'};return _0x1c01d5;})});}_0x149066=_[_0xb973('0x53')]({},_0x149066,_0x33e29d[_0xb973('0x56')]);return db['CannedAnswer'][_0xb973('0x1e')]({'where':_0x149066[_0xb973('0x51')]})[_0xb973('0x22')](function(_0x569036){_0x16dec5[_0xb973('0x1e')]=_0x569036;if(_0x33e29d[_0xb973('0x47')][_0xb973('0x58')]){_0x149066['include']=[{'all':!![]}];}return db[_0xb973('0x6e')][_0xb973('0x5a')](_0x149066);})[_0xb973('0x22')](function(_0x4c5f68){_0x16dec5[_0xb973('0x6a')]=_0x4c5f68;return _0x16dec5;});}})[_0xb973('0x22')](respondWithFilteredResult(_0x20b437,_0x149066))[_0xb973('0x5b')](handleError(_0x20b437,null));};exports[_0xb973('0x70')]=function(_0x1b955a,_0x5a3902){return db['MailAccount'][_0xb973('0x61')]({'where':{'id':_0x1b955a[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x5a3902,null))['then'](function(_0x408b52){if(_0x408b52){return _0x408b52[_0xb973('0x70')](_0x1b955a['query'][_0xb973('0x6c')]);}})[_0xb973('0x22')](respondWithStatusCode(_0x5a3902,null))['catch'](handleError(_0x5a3902,null));};exports[_0xb973('0x6f')]=function(_0xc6f5e6,_0x5028fa){var _0x127c63={'name':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x28')],'key':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x71')],'provider':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x5f')]===_0xb973('0x72')?null:_0xc6f5e6[_0xb973('0x5e')]['provider'],'email':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x73')],'ListId':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x74')],'active':!_[_0xb973('0x75')](_0xc6f5e6['body'][_0xb973('0x76')])?_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x76')]:!![],'description':_0xc6f5e6[_0xb973('0x5e')][_0xb973('0x77')]||null};var _0x5dc227=getAuthenticationOptions(_0x127c63[_0xb973('0x5f')],_0xc6f5e6[_0xb973('0x5e')]);_0x127c63[_0xb973('0x3c')]=_0x5dc227[_0xb973('0x3c')];_0x127c63['Smtp']=_0x5dc227[_0xb973('0x3d')];return db[_0xb973('0x57')][_0xb973('0x6f')](_0x127c63,{'include':[{'model':db[_0xb973('0x40')],'as':_0xb973('0x3d')},{'model':db[_0xb973('0x3f')],'as':'Imap'}]})[_0xb973('0x22')](function(_0x376ae3){var _0x51aa42=_0xc6f5e6['user'][_0xb973('0x78')]({'plain':!![]});if(!_0x51aa42)throw new Error(_0xb973('0x79'));if(_0x51aa42[_0xb973('0x7a')]==='user'){var _0x543b79=_0x376ae3[_0xb973('0x78')]({'plain':!![]});return db[_0xb973('0x7b')][_0xb973('0x61')]({'where':{'name':_0xb973('0x24'),'userProfileId':_0x51aa42[_0xb973('0x7c')]},'raw':!![]})['then'](function(_0xc83591){if(_0xc83591&&_0xc83591['autoAssociation']===0x0){return db['UserProfileResource'][_0xb973('0x6f')]({'name':_0x543b79[_0xb973('0x28')],'resourceId':_0x543b79['id'],'type':_0xc83591['name'],'sectionId':_0xc83591['id']},{})[_0xb973('0x22')](function(){return _0x376ae3;});}else{return _0x376ae3;}})[_0xb973('0x5b')](function(_0x5a7885){logger['error'](_0xb973('0x7d'),_0x5a7885);throw _0x5a7885;});}return _0x376ae3;})[_0xb973('0x22')](respondWithResult(_0x5028fa,0xc9))['catch'](handleError(_0x5028fa,null));};exports['getImap']=function(_0x41af35,_0x595110){return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x41af35['params']['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x595110,null))[_0xb973('0x22')](function(_0x570353){if(_0x570353){return _0x570353['getImap']();}return null;})['then'](respondWithResult(_0x595110,null))[_0xb973('0x5b')](handleError(_0x595110,null));};exports[_0xb973('0x7e')]=function(_0x333ea8,_0x2dc84e){if(_0x333ea8[_0xb973('0x5e')]['id']){delete _0x333ea8[_0xb973('0x5e')]['id'];}return db[_0xb973('0x57')]['find']({'where':{'id':_0x333ea8[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x2dc84e,null))['then'](function(_0x29ac8e){if(_0x29ac8e){_0x333ea8['body'][_0xb973('0x65')]=_0x29ac8e['id'];return db[_0xb973('0x3f')][_0xb973('0x6f')](_0x333ea8[_0xb973('0x5e')]);}})['then'](respondWithResult(_0x2dc84e,null))[_0xb973('0x5b')](handleError(_0x2dc84e,null));};exports[_0xb973('0x7f')]=function(_0x22418c,_0x41e2b3){return db[_0xb973('0x57')]['findOne']({'where':{'id':_0x22418c[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x41e2b3,null))['then'](function(_0x1f427e){if(_0x1f427e){return _0x1f427e[_0xb973('0x80')](null);}return null;})[_0xb973('0x22')](respondWithStatusCode(_0x41e2b3,null))[_0xb973('0x5b')](handleError(_0x41e2b3,null));};exports[_0xb973('0x81')]=function(_0x8fb18a,_0x8a860b){return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x8fb18a[_0xb973('0x5c')]['id']}})['then'](handleEntityNotFound(_0x8a860b,null))[_0xb973('0x22')](function(_0x21ef06){if(_0x21ef06){return _0x21ef06[_0xb973('0x81')]();}return null;})[_0xb973('0x22')](respondWithResult(_0x8a860b,null))[_0xb973('0x5b')](handleError(_0x8a860b,null));};exports[_0xb973('0x82')]=function(_0x3eae04,_0x47788d){if(_0x3eae04[_0xb973('0x5e')]['id']){delete _0x3eae04[_0xb973('0x5e')]['id'];}return db[_0xb973('0x57')]['find']({'where':{'id':_0x3eae04[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x47788d,null))['then'](function(_0x162dec){if(_0x162dec){_0x3eae04[_0xb973('0x5e')][_0xb973('0x65')]=_0x162dec['id'];return db[_0xb973('0x40')]['create'](_0x3eae04[_0xb973('0x5e')]);}})[_0xb973('0x22')](respondWithResult(_0x47788d,null))[_0xb973('0x5b')](handleError(_0x47788d,null));};exports[_0xb973('0x83')]=function(_0xebee6e,_0x294c4f){return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0xebee6e[_0xb973('0x5c')]['id']}})['then'](handleEntityNotFound(_0x294c4f,null))[_0xb973('0x22')](function(_0x32c0ac){if(_0x32c0ac){return _0x32c0ac[_0xb973('0x84')](null);}return null;})[_0xb973('0x22')](respondWithStatusCode(_0x294c4f,null))[_0xb973('0x5b')](handleError(_0x294c4f,null));};exports[_0xb973('0x85')]=function(_0x4f1a91,_0x3d7c8a){return db[_0xb973('0x86')]['find']({'where':{'id':_0x4f1a91[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x3d7c8a,null))[_0xb973('0x22')](function(_0x22705a){if(_0x22705a){return _0x22705a[_0xb973('0x85')](_0x4f1a91[_0xb973('0x5e')]['ids'],_[_0xb973('0x87')](_0x4f1a91[_0xb973('0x5e')],[_0xb973('0x6c'),'id'])||{});}})[_0xb973('0x22')](respondWithResult(_0x3d7c8a,null))[_0xb973('0x5b')](handleError(_0x3d7c8a,null));};exports[_0xb973('0x88')]=function(_0x5738b3,_0x1c6546){var _0x54aa97={'raw':![],'where':{}};var _0x46c939={};var _0x336978={'count':0x0,'rows':[]};return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x5738b3[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x1c6546,null))[_0xb973('0x22')](function(_0x8d0cdc){if(_0x8d0cdc){_0x46c939[_0xb973('0x46')]=_['keys'](db[_0xb973('0x86')][_0xb973('0x69')]);_0x46c939[_0xb973('0x47')]=_[_0xb973('0x48')](_0x5738b3[_0xb973('0x47')]);_0x46c939['filters']=_[_0xb973('0x4a')](_0x46c939[_0xb973('0x46')],_0x46c939[_0xb973('0x47')]);_0x54aa97[_0xb973('0x4b')]=_['intersection'](_0x46c939['model'],qs[_0xb973('0x5d')](_0x5738b3['query'][_0xb973('0x5d')]));_0x54aa97[_0xb973('0x4b')]=_0x54aa97[_0xb973('0x4b')][_0xb973('0x4c')]?_0x54aa97[_0xb973('0x4b')]:_0x46c939[_0xb973('0x46')];if(!_0x5738b3[_0xb973('0x47')]['hasOwnProperty']('nolimit')){_0x54aa97[_0xb973('0x1c')]=qs['limit'](_0x5738b3['query'][_0xb973('0x1c')]);_0x54aa97['offset']=qs[_0xb973('0x1b')](_0x5738b3[_0xb973('0x47')][_0xb973('0x1b')]);}_0x54aa97['order']=qs['sort'](_0x5738b3[_0xb973('0x47')]['sort']);_0x54aa97[_0xb973('0x51')]=qs[_0xb973('0x49')](_[_0xb973('0x52')](_0x5738b3['query'],_0x46c939[_0xb973('0x49')]));_0x54aa97['where'][_0xb973('0x65')]=_0x8d0cdc['id'];if(_0x5738b3['query'][_0xb973('0x55')]){_0x54aa97[_0xb973('0x51')]=_['merge'](_0x54aa97[_0xb973('0x51')],{'$or':_[_0xb973('0x43')](_0x54aa97[_0xb973('0x4b')],function(_0x4b5a5f){var _0x46574d={};_0x46574d[_0x4b5a5f]={'$like':'%'+_0x5738b3['query'][_0xb973('0x55')]+'%'};return _0x46574d;})});}_0x54aa97=_[_0xb973('0x53')]({},_0x54aa97,_0x5738b3[_0xb973('0x56')]);return db[_0xb973('0x86')][_0xb973('0x1e')]({'where':_0x54aa97['where']})[_0xb973('0x22')](function(_0xff5694){_0x336978['count']=_0xff5694;if(_0x5738b3[_0xb973('0x47')][_0xb973('0x58')]){_0x54aa97[_0xb973('0x59')]=[{'model':db['CmContact'],'as':_0xb973('0x89'),'required':![]},{'model':db[_0xb973('0x8a')],'as':_0xb973('0x8b'),'attributes':[_0xb973('0x28'),_0xb973('0x8c'),_0xb973('0x8d')],'required':![]},{'model':db['Tag'],'as':_0xb973('0x8e'),'attributes':['id',_0xb973('0x28'),_0xb973('0x8f')],'where':_0x5738b3['query'][_0xb973('0x90')]?{'id':_0x5738b3[_0xb973('0x47')][_0xb973('0x90')]}:undefined,'required':_0x5738b3[_0xb973('0x47')][_0xb973('0x90')]?!![]:![]}];}return db[_0xb973('0x86')][_0xb973('0x5a')](_0x54aa97);})['then'](function(_0x37ea87){_0x336978['rows']=_0x37ea87;return _0x336978;});}})[_0xb973('0x22')](respondWithFilteredResult(_0x1c6546,_0x54aa97))[_0xb973('0x5b')](handleError(_0x1c6546,null));};exports['addApplications']=function addApplications(_0x1929dd,_0x4806fd){var _0x287b1f=_0x1929dd[_0xb973('0x5c')]['id'];var _0x3ef185=_0x1929dd[_0xb973('0x5e')];var _0x422139=0xc8;var _0x24ecc7=null;return db[_0xb973('0x91')][_0xb973('0x92')]({'isolationLevel':db[_0xb973('0x91')]['Transaction'][_0xb973('0x93')]['READ_COMMITTED']},function(_0x501a4b){return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x287b1f},'transaction':_0x501a4b})['then'](function(_0x223458){if(_0x223458){return db[_0xb973('0x94')][_0xb973('0x23')]({'where':{'MailAccountId':_0x287b1f},'transaction':_0x501a4b})[_0xb973('0x22')](function(){var _0x136d34=_['map'](_0x3ef185,function(_0x44135d){_0x44135d[_0xb973('0x65')]=_0x287b1f;return _0x44135d;});return db[_0xb973('0x94')][_0xb973('0x95')](_0x136d34,{'transaction':_0x501a4b});});}else{_0x422139=0x194;_0x24ecc7=[];}});})[_0xb973('0x22')](function(){if(_0x422139!==0x194){return db['MailApplication'][_0xb973('0x96')]({'where':{'MailAccountId':_0x287b1f},'order':_0xb973('0x97')})[_0xb973('0x22')](function(_0x50a507){_0x24ecc7=_0x50a507;});}})[_0xb973('0x5b')](function(_0xebdba9){_0x422139=0x1f4;logger[_0xb973('0x17')](_0xebdba9['stack']);if(_0xebdba9[_0xb973('0x28')]){delete _0xebdba9[_0xb973('0x28')];}_0x24ecc7=_0xebdba9;})[_0xb973('0x98')](function(){if(_0x24ecc7===null){_0x4806fd[_0xb973('0x19')](_0x422139);}else{if(_0x422139===0x1f4){_0x4806fd[_0xb973('0x1a')](_0x422139)[_0xb973('0x99')](_0x24ecc7);}else{_0x4806fd[_0xb973('0x1a')](_0x422139)['json'](_0x24ecc7);}}});};exports['getApplications']=function(_0x5f45e3,_0x256a49){var _0xf35c7f={};var _0x4c45fa={};var _0x46f447;var _0x4dda8e;return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x5f45e3[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x256a49,null))['then'](function(_0x38f2a0){if(_0x38f2a0){_0x46f447=_0x38f2a0;_0x4c45fa[_0xb973('0x46')]=_[_0xb973('0x48')](db[_0xb973('0x94')][_0xb973('0x69')]);_0x4c45fa['query']=_[_0xb973('0x48')](_0x5f45e3['query']);_0x4c45fa[_0xb973('0x49')]=_[_0xb973('0x4a')](_0x4c45fa[_0xb973('0x46')],_0x4c45fa[_0xb973('0x47')]);_0xf35c7f['attributes']=_[_0xb973('0x4a')](_0x4c45fa[_0xb973('0x46')],qs[_0xb973('0x5d')](_0x5f45e3['query'][_0xb973('0x5d')]));_0xf35c7f[_0xb973('0x4b')]=_0xf35c7f[_0xb973('0x4b')][_0xb973('0x4c')]?_0xf35c7f[_0xb973('0x4b')]:_0x4c45fa[_0xb973('0x46')];_0xf35c7f[_0xb973('0x4f')]=qs[_0xb973('0x50')](_0x5f45e3[_0xb973('0x47')]['sort']);_0xf35c7f[_0xb973('0x51')]=qs['filters'](_[_0xb973('0x52')](_0x5f45e3[_0xb973('0x47')],_0x4c45fa[_0xb973('0x49')]));if(_0x5f45e3[_0xb973('0x47')][_0xb973('0x55')]){_0xf35c7f[_0xb973('0x51')]=_[_0xb973('0x53')](_0xf35c7f[_0xb973('0x51')],{'$or':_[_0xb973('0x43')](_0xf35c7f[_0xb973('0x4b')],function(_0x30afaf){var _0x1278d8={};_0x1278d8[_0x30afaf]={'$like':'%'+_0x5f45e3[_0xb973('0x47')][_0xb973('0x55')]+'%'};return _0x1278d8;})});}_0xf35c7f=_['merge']({},_0xf35c7f,_0x5f45e3['options']);return _0x46f447[_0xb973('0x9a')](_0xf35c7f);}})['then'](function(_0x40c55d){if(_0x40c55d){_0x4dda8e=_0x40c55d[_0xb973('0x4c')];if(!_0x5f45e3[_0xb973('0x47')][_0xb973('0x4d')](_0xb973('0x4e'))){_0xf35c7f['limit']=qs['limit'](_0x5f45e3[_0xb973('0x47')]['limit']);_0xf35c7f[_0xb973('0x1b')]=qs[_0xb973('0x1b')](_0x5f45e3['query'][_0xb973('0x1b')]);}return _0x46f447[_0xb973('0x9a')](_0xf35c7f);}})[_0xb973('0x22')](function(_0x392007){if(_0x392007){return _0x392007?{'count':_0x4dda8e,'rows':_0x392007}:null;}})[_0xb973('0x22')](respondWithResult(_0x256a49,null))[_0xb973('0x5b')](handleError(_0x256a49,null));};exports[_0xb973('0x9b')]=function(_0x522077,_0x363a7f){var _0x1b2f4f={'raw':!![],'where':{}};var _0x5268cc={};var _0x3c0615={'count':0x0,'rows':[]};return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x522077[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x363a7f,null))['then'](function(_0x42a8ee){if(_0x42a8ee){_0x5268cc[_0xb973('0x46')]=_[_0xb973('0x48')](db[_0xb973('0x9c')]['rawAttributes']);_0x5268cc['query']=_[_0xb973('0x48')](_0x522077['query']);_0x5268cc[_0xb973('0x49')]=_[_0xb973('0x4a')](_0x5268cc[_0xb973('0x46')],_0x5268cc[_0xb973('0x47')]);_0x1b2f4f[_0xb973('0x4b')]=_['intersection'](_0x5268cc[_0xb973('0x46')],qs[_0xb973('0x5d')](_0x522077[_0xb973('0x47')][_0xb973('0x5d')]));_0x1b2f4f['attributes']=_0x1b2f4f[_0xb973('0x4b')][_0xb973('0x4c')]?_0x1b2f4f[_0xb973('0x4b')]:_0x5268cc[_0xb973('0x46')];if(!_0x522077['query']['hasOwnProperty'](_0xb973('0x4e'))){_0x1b2f4f[_0xb973('0x1c')]=qs['limit'](_0x522077[_0xb973('0x47')][_0xb973('0x1c')]);_0x1b2f4f['offset']=qs[_0xb973('0x1b')](_0x522077[_0xb973('0x47')]['offset']);}_0x1b2f4f[_0xb973('0x4f')]=qs[_0xb973('0x50')](_0x522077[_0xb973('0x47')][_0xb973('0x50')]);_0x1b2f4f[_0xb973('0x51')]=qs[_0xb973('0x49')](_['pick'](_0x522077[_0xb973('0x47')],_0x5268cc[_0xb973('0x49')]));_0x1b2f4f[_0xb973('0x51')][_0xb973('0x65')]=_0x42a8ee['id'];if(_0x522077[_0xb973('0x47')][_0xb973('0x55')]){_0x1b2f4f[_0xb973('0x51')]=_['merge'](_0x1b2f4f[_0xb973('0x51')],{'$or':_[_0xb973('0x43')](_0x1b2f4f['attributes'],function(_0x53c3e8){var _0x212ee8={};_0x212ee8[_0x53c3e8]={'$like':'%'+_0x522077['query'][_0xb973('0x55')]+'%'};return _0x212ee8;})});}if(_0x522077['query']['$gte']){var _0x1a15ab=_0x522077[_0xb973('0x47')][_0xb973('0x9d')][_0xb973('0x9e')](',');var _0x1a90ca={};_0x1a90ca[_0x1a15ab[0x0]]={'$gte':moment(_0x1a15ab[0x1])[_0xb973('0x9f')](_0xb973('0xa0'))};_0x1b2f4f[_0xb973('0x51')]=_['merge'](_0x1b2f4f[_0xb973('0x51')],_0x1a90ca);}_0x1b2f4f=_[_0xb973('0x53')]({},_0x1b2f4f,_0x522077['options']);return db[_0xb973('0x9c')][_0xb973('0x1e')]({'where':_0x1b2f4f[_0xb973('0x51')]})['then'](function(_0xcc4de){_0x3c0615['count']=_0xcc4de;if(_0x522077[_0xb973('0x47')][_0xb973('0x58')]){_0x1b2f4f['include']=[{'all':!![]}];}return db[_0xb973('0x9c')][_0xb973('0x5a')](_0x1b2f4f);})[_0xb973('0x22')](function(_0x43972d){if(_0x522077['query'][_0xb973('0xa1')]===_0xb973('0xa2')){for(var _0x4fba90=0x0;_0x4fba90<_0x43972d[_0xb973('0x4c')];_0x4fba90++){_0x43972d[_0x4fba90]['body']=juice(_0x43972d[_0x4fba90]['body']);}}_0x3c0615[_0xb973('0x6a')]=_0x43972d;return _0x3c0615;});}})['then'](respondWithFilteredResult(_0x363a7f,_0x1b2f4f))[_0xb973('0x5b')](handleError(_0x363a7f,null));};exports['send']=function(_0x317efe,_0x36c2a5){var _0x491ebd,_0x60b638={},_0x142f94;if(_0x317efe[_0xb973('0x5e')]['to']){_0x142f94=_0x317efe[_0xb973('0x5e')]['to'][_0xb973('0x9e')](',')[0x0];}return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x317efe['params']['id']},'include':[{'model':db[_0xb973('0xa3')],'as':_0xb973('0xa4'),'include':[{'model':db[_0xb973('0xa5')],'as':_0xb973('0xa6'),'where':{'email':_0x142f94},'limit':0x1,'order':[[_0xb973('0xa7'),_0xb973('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0xb973('0x3d'),'raw':!![],'include':[{'model':db[_0xb973('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0xb973('0x22')](handleEntityNotFound(_0x36c2a5,null))['then'](function(_0x39c057){if(!_0x39c057)return;_0x491ebd=_0x39c057;if(!_0x39c057['Smtp'])throw new Error(_0xb973('0xaa'));if(_[_0xb973('0x75')](_0x317efe[_0xb973('0x5e')][_0xb973('0xab')])){_0x317efe[_0xb973('0x5e')][_0xb973('0xab')]=util[_0xb973('0x9f')](_0xb973('0xac'),_0x39c057[_0xb973('0x28')],_0x39c057['email']||_0x39c057['Smtp'][_0xb973('0x32')]);}if(_0x317efe[_0xb973('0x5e')][_0xb973('0xad')]&&_0x317efe[_0xb973('0x5e')][_0xb973('0xad')][_0xb973('0x4c')]){for(var _0x357e7e=0x0;_0x357e7e<_0x317efe[_0xb973('0x5e')]['attachments']['length'];_0x357e7e+=0x1){_0x317efe['body']['attachments'][_0x357e7e]={'filename':_0x317efe[_0xb973('0x5e')][_0xb973('0xad')][_0x357e7e][_0xb973('0x28')],'path':path[_0xb973('0xae')](config[_0xb973('0xaf')],_0xb973('0xb0'),_0x317efe[_0xb973('0x5e')][_0xb973('0xad')][_0x357e7e][_0xb973('0xb1')])};}}var _0x47ea5f=_0x39c057[_0xb973('0xb2')]();return respondWithRpcPromise(_0xb973('0xb3'),_0xb973('0xb4'),{'account':_0x47ea5f,'message':_0x317efe['body']});})[_0xb973('0x22')](function(_0x5a0882){if(!_0x5a0882)return;_0x60b638=_0x5a0882;if(!_0x491ebd['List'])throw new Error('List\x20not\x20found');if(_0x491ebd[_0xb973('0xa4')][_0xb973('0xa6')][_0xb973('0x4c')])return _0x491ebd[_0xb973('0xa4')][_0xb973('0xa6')][0x0];return db[_0xb973('0xa5')]['create'](_['defaults'](_0x317efe[_0xb973('0x5e')],{'firstName':_0x317efe[_0xb973('0x5e')]['to'],'email':_0x317efe['body']['to'],'phone':_0x317efe[_0xb973('0x5e')]['to'],'ListId':_0x491ebd[_0xb973('0x74')]}));})['then'](function(_0x4d1d53){if(!_0x4d1d53)return;var _0xdca8ef={'UserId':_0x317efe['user']['id'],'ContactId':_0x4d1d53['id'],'MailAccountId':_0x491ebd['id'],'inReplyTo':_0x60b638['messageId'],'to':_0x317efe[_0xb973('0x5e')][_0xb973('0xab')],'cc':_0x317efe[_0xb973('0x5e')]['cc'],'subject':_0x317efe[_0xb973('0x5e')][_0xb973('0xb5')],'attach':_0x317efe[_0xb973('0x5e')][_0xb973('0xb6')],'firstMsgDirection':_0xb973('0xb7'),'lastMsgAt':moment()[_0xb973('0x9f')](_0xb973('0xa0')),'lastMsgDirection':'out','Messages':[_[_0xb973('0x53')](_0x317efe[_0xb973('0x5e')],{'messageId':_0x60b638[_0xb973('0xb8')],'sentAt':moment()[_0xb973('0x9f')](_0xb973('0xa0')),'read':!![],'MailAccountId':_0x491ebd['id'],'UserId':_0x317efe[_0xb973('0x32')]['id'],'ContactId':_0x4d1d53['id']})]};if(_0x317efe[_0xb973('0x5e')]['Interaction']){_0xdca8ef=_[_0xb973('0x53')](_0xdca8ef,_0x317efe[_0xb973('0x5e')]['Interaction']);}return db[_0xb973('0x86')][_0xb973('0x6f')](_0xdca8ef,{'include':[{'model':db[_0xb973('0x9c')],'as':_0xb973('0xb9')}]});})[_0xb973('0x22')](respondWithResult(_0x36c2a5,null))['catch'](handleError(_0x36c2a5,null));};exports[_0xb973('0xba')]=function(_0x567c1a,_0x4a411e){return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x567c1a[_0xb973('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xb973('0x3d'),'raw':!![],'include':[{'model':db[_0xb973('0xa9')],'as':_0xb973('0xa9'),'raw':!![]}]}]})[_0xb973('0x22')](handleEntityNotFound(_0x4a411e,null))[_0xb973('0x22')](function(_0x403781){if(!_0x403781['Smtp'])return;var _0xb09723=_0x403781[_0xb973('0xb2')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0xb09723});})['then'](respondWithResult(_0x4a411e,null))['catch'](handleError(_0x4a411e,null));};exports[_0xb973('0x23')]=function(_0x4760c3,_0x902e19){return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0x4760c3[_0xb973('0x5c')]['id']}})['then'](handleEntityNotFound(_0x902e19,null))['then'](function(_0x4555b6){if(_0x4555b6&&_0x4555b6['service']){throw new db[(_0xb973('0xbb'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4555b6;})[_0xb973('0x22')](removeEntity(_0x902e19,null))['catch'](handleError(_0x902e19,null));};exports[_0xb973('0xbc')]=function(_0xece791,_0x15a161){return db[_0xb973('0x57')][_0xb973('0x61')]({'where':{'id':_0xece791['params']['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x15a161,null))[_0xb973('0x22')](function(_0x555d50){if(_0x555d50){return _0x555d50[_0xb973('0xbc')](_0xece791[_0xb973('0x5e')][_0xb973('0x6c')],_[_0xb973('0x87')](_0xece791['body'],[_0xb973('0x6c'),'id'])||{})['spread'](function(_0x13690e){for(var _0x47347a=0x0;_0x47347a<_0xece791['body']['ids'][_0xb973('0x4c')];_0x47347a+=0x1){socket[_0xb973('0xbd')](_0xb973('0xbe'),{'UserId':Number(_0xece791['body'][_0xb973('0x6c')][_0x47347a]),'MailAccountId':Number(_0xece791[_0xb973('0x5c')]['id'])});}return _0x13690e;});}})[_0xb973('0x22')](respondWithResult(_0x15a161,null))[_0xb973('0x5b')](handleError(_0x15a161,null));};exports[_0xb973('0xbf')]=function(_0x4b635f,_0xd6ade8){return db['MailAccount'][_0xb973('0x61')]({'where':{'id':_0x4b635f['params']['id']}})[_0xb973('0x22')](handleEntityNotFound(_0xd6ade8,null))[_0xb973('0x22')](function(_0x1a5823){if(_0x1a5823){return _0x1a5823[_0xb973('0xbf')](_0x4b635f[_0xb973('0x47')][_0xb973('0x6c')])[_0xb973('0x22')](function(){if(_[_0xb973('0xc0')](_0x4b635f[_0xb973('0x47')][_0xb973('0x6c')])){for(var _0x2e430c=0x0;_0x2e430c<_0x4b635f['query']['ids'][_0xb973('0x4c')];_0x2e430c+=0x1){socket[_0xb973('0xbd')](_0xb973('0xc1'),{'UserId':Number(_0x4b635f[_0xb973('0x47')][_0xb973('0x6c')][_0x2e430c]),'MailAccountId':Number(_0x4b635f[_0xb973('0x5c')]['id'])});}}else{socket[_0xb973('0xbd')](_0xb973('0xc1'),{'UserId':Number(_0x4b635f['query'][_0xb973('0x6c')]),'MailAccountId':Number(_0x4b635f[_0xb973('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0xd6ade8,null))[_0xb973('0x5b')](handleError(_0xd6ade8,null));};exports[_0xb973('0xc2')]=function(_0x59140d,_0x1d20c0){var _0x988366={};var _0x597566={};var _0xaada28;var _0xd985f8;return db[_0xb973('0x57')][_0xb973('0x68')]({'where':{'id':_0x59140d[_0xb973('0x5c')]['id']}})[_0xb973('0x22')](handleEntityNotFound(_0x1d20c0,null))['then'](function(_0x1136a7){if(_0x1136a7){_0xaada28=_0x1136a7;_0x597566[_0xb973('0x46')]=_[_0xb973('0x48')](db[_0xb973('0x8a')][_0xb973('0x69')]);_0x597566[_0xb973('0x47')]=_[_0xb973('0x48')](_0x59140d[_0xb973('0x47')]);_0x597566[_0xb973('0x49')]=_[_0xb973('0x4a')](_0x597566[_0xb973('0x46')],_0x597566[_0xb973('0x47')]);_0x988366[_0xb973('0x4b')]=_[_0xb973('0x4a')](_0x597566[_0xb973('0x46')],qs['fields'](_0x59140d['query'][_0xb973('0x5d')]));_0x988366[_0xb973('0x4b')]=_0x988366['attributes'][_0xb973('0x4c')]?_0x988366[_0xb973('0x4b')]:_0x597566[_0xb973('0x46')];_0x988366['order']=qs[_0xb973('0x50')](_0x59140d[_0xb973('0x47')][_0xb973('0x50')]);_0x988366[_0xb973('0x51')]=qs[_0xb973('0x49')](_[_0xb973('0x52')](_0x59140d['query'],_0x597566[_0xb973('0x49')]));if(_0x59140d[_0xb973('0x47')][_0xb973('0x55')]){_0x988366[_0xb973('0x51')]=_['merge'](_0x988366['where'],{'$or':_[_0xb973('0x43')](_0x988366['attributes'],function(_0x326d24){var _0x43d6cc={};_0x43d6cc[_0x326d24]={'$like':'%'+_0x59140d[_0xb973('0x47')][_0xb973('0x55')]+'%'};return _0x43d6cc;})});}_0x988366=_[_0xb973('0x53')]({},_0x988366,_0x59140d[_0xb973('0x56')]);return _0xaada28[_0xb973('0xc2')](_0x988366);}})[_0xb973('0x22')](function(_0x1b0344){if(_0x1b0344){_0xd985f8=_0x1b0344[_0xb973('0x4c')];if(!_0x59140d[_0xb973('0x47')][_0xb973('0x4d')](_0xb973('0x4e'))){_0x988366[_0xb973('0x1c')]=qs[_0xb973('0x1c')](_0x59140d[_0xb973('0x47')][_0xb973('0x1c')]);_0x988366[_0xb973('0x1b')]=qs[_0xb973('0x1b')](_0x59140d['query'][_0xb973('0x1b')]);}return _0xaada28[_0xb973('0xc2')](_0x988366);}})[_0xb973('0x22')](function(_0x3979e8){if(_0x3979e8){return _0x3979e8?{'count':_0xd985f8,'rows':_0x3979e8}:null;}})[_0xb973('0x22')](respondWithResult(_0x1d20c0,null))[_0xb973('0x5b')](handleError(_0x1d20c0,null));}; \ No newline at end of file +var _0xb3a1=['error','code','message','info','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.mail.yahoo.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','port','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','body','custom','provider','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','sort','removeDispositions','addAnswer','CannedAnswer','getAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','ids','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','List','messageId','attach','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x51ea1b,_0x1c5a3b){var _0x56d914=function(_0x34623a){while(--_0x34623a){_0x51ea1b['push'](_0x51ea1b['shift']());}};_0x56d914(++_0x1c5a3b);}(_0xb3a1,0xa9));var _0x1b3a=function(_0x4bf3a7,_0x5d756b){_0x4bf3a7=_0x4bf3a7-0x0;var _0x58c9cc=_0xb3a1[_0x4bf3a7];return _0x58c9cc;};'use strict';var moment=require(_0x1b3a('0x0'));var BPromise=require(_0x1b3a('0x1'));var util=require(_0x1b3a('0x2'));var path=require('path');var _=require(_0x1b3a('0x3'));var juice=require('juice');var Redis=require(_0x1b3a('0x4'));var qs=require(_0x1b3a('0x5'));var logger=require(_0x1b3a('0x6'))(_0x1b3a('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1b3a('0x8')]=_[_0x1b3a('0x9')](config[_0x1b3a('0x8')],{'host':_0x1b3a('0xa'),'port':0x18eb});var socket=require(_0x1b3a('0xb'))(new Redis(config[_0x1b3a('0x8')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x1b3a('0xc'));var client=jayson[_0x1b3a('0xd')][_0x1b3a('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x55b0b3,_0x1b8310,_0x3c38fd,_0x3add3c){return new BPromise(function(_0x11acce,_0x47ff4b){var _0x128c34=_0x3add3c||client;return _0x128c34[_0x1b3a('0xf')](_0x55b0b3,_0x3c38fd)['then'](function(_0x25e903){logger['info'](_0x1b3a('0x10'),_0x1b8310,_0x1b3a('0x11'));logger[_0x1b3a('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1b8310,_0x1b3a('0x11'),JSON[_0x1b3a('0x13')](_0x25e903));if(_0x25e903[_0x1b3a('0x14')]){if(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x15')]===0x1f4){logger[_0x1b3a('0x14')](_0x1b3a('0x10'),_0x1b8310,_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);return _0x47ff4b(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);}logger[_0x1b3a('0x14')]('MailAccount,\x20%s,\x20%s',_0x1b8310,_0x25e903['error'][_0x1b3a('0x16')]);return _0x11acce(_0x25e903[_0x1b3a('0x14')][_0x1b3a('0x16')]);}else{logger[_0x1b3a('0x17')]('MailAccount,\x20%s,\x20%s',_0x1b8310,'request\x20sent');_0x11acce(_0x25e903[_0x1b3a('0x18')][_0x1b3a('0x16')]);}})['catch'](function(_0x2b1c94){logger[_0x1b3a('0x14')](_0x1b3a('0x10'),_0x1b8310,_0x2b1c94);_0x47ff4b(_0x2b1c94);});});}function respondWithStatusCode(_0x2c780d,_0x4f7e61){_0x4f7e61=_0x4f7e61||0xcc;return function(_0x6d3d71){if(_0x6d3d71){return _0x2c780d['sendStatus'](_0x4f7e61);}return _0x2c780d[_0x1b3a('0x19')](_0x4f7e61)['end']();};}function respondWithResult(_0x130c9c,_0x4b68b2){_0x4b68b2=_0x4b68b2||0xc8;return function(_0x4a8a43){if(_0x4a8a43){return _0x130c9c['status'](_0x4b68b2)[_0x1b3a('0x1a')](_0x4a8a43);}};}function respondWithFilteredResult(_0x5a56e6,_0x4a546b){return function(_0x4d9bd9){if(_0x4d9bd9){var _0x949de=typeof _0x4a546b[_0x1b3a('0x1b')]==='undefined'&&typeof _0x4a546b['limit']===_0x1b3a('0x1c');var _0x1bf632=_0x4d9bd9[_0x1b3a('0x1d')];var _0x591769=_0x949de?0x0:_0x4a546b[_0x1b3a('0x1b')];var _0xda6f26=_0x949de?_0x4d9bd9[_0x1b3a('0x1d')]:_0x4a546b[_0x1b3a('0x1b')]+_0x4a546b[_0x1b3a('0x1e')];var _0x371b49;if(_0xda6f26>=_0x1bf632){_0xda6f26=_0x1bf632;_0x371b49=0xc8;}else{_0x371b49=0xce;}_0x5a56e6[_0x1b3a('0x19')](_0x371b49);return _0x5a56e6[_0x1b3a('0x1f')](_0x1b3a('0x20'),_0x591769+'-'+_0xda6f26+'/'+_0x1bf632)[_0x1b3a('0x1a')](_0x4d9bd9);}return null;};}function saveUpdates(_0x146d64){return function(_0x38c6ef){if(_0x38c6ef){return _0x38c6ef[_0x1b3a('0x21')](_0x146d64)[_0x1b3a('0x22')](function(_0x52551b){return _0x52551b;});}return null;};}function removeEntity(_0x4509bd){return function(_0x245f63){if(_0x245f63){return _0x245f63['destroy']()[_0x1b3a('0x22')](function(){var _0x484398=_0x245f63[_0x1b3a('0x23')]({'plain':!![]});var _0x2e9d1f=_0x1b3a('0x24');return db[_0x1b3a('0x25')][_0x1b3a('0x26')]({'where':{'type':_0x2e9d1f,'resourceId':_0x484398['id']}})[_0x1b3a('0x22')](function(){return _0x245f63;});})[_0x1b3a('0x22')](function(){_0x4509bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aff53){return function(_0x5504d9){if(!_0x5504d9){_0x4aff53['sendStatus'](0x194);}return _0x5504d9;};}function handleError(_0x54c3b3,_0x586d85){_0x586d85=_0x586d85||0x1f4;return function(_0xc7013a){logger[_0x1b3a('0x14')](_0xc7013a[_0x1b3a('0x27')]);if(_0xc7013a[_0x1b3a('0x28')]){delete _0xc7013a[_0x1b3a('0x28')];}_0x54c3b3[_0x1b3a('0x19')](_0x586d85)[_0x1b3a('0x29')](_0xc7013a);};}function getImapHost(_0x26253f){switch(_0x26253f){case _0x1b3a('0x2a'):return'imap.gmail.com';case'yahoo':return _0x1b3a('0x2b');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0x1b3a('0x2c');}throw new Error(_0x1b3a('0x2d'),_0x26253f);}function getSmtpHost(_0x45b707){switch(_0x45b707){case _0x1b3a('0x2a'):return'smtp.gmail.com';case'yahoo':return _0x1b3a('0x2e');case'hotmail':return _0x1b3a('0x2f');case _0x1b3a('0x30'):return _0x1b3a('0x31');}throw new Error(_0x1b3a('0x2d'),_0x45b707);}function getAuthenticationOptions(_0x49eb67,_0x54bc04){var _0xb03ddb={};var _0x2e372d={};if(_0x49eb67){_0xb03ddb[_0x1b3a('0x32')]=_0x2e372d[_0x1b3a('0x32')]=_0x54bc04[_0x1b3a('0x33')];_0xb03ddb[_0x1b3a('0x34')]=_0x2e372d[_0x1b3a('0x35')]=_0x54bc04[_0x1b3a('0x34')];if(_0x54bc04['modernAuthentication']){_0xb03ddb['modernAuthentication']=_0x2e372d[_0x1b3a('0x36')]=!![];_0xb03ddb['CloudProviderId']=_0x2e372d[_0x1b3a('0x37')]=_0x54bc04[_0x1b3a('0x37')];_0xb03ddb[_0x1b3a('0x34')]=_0x2e372d[_0x1b3a('0x35')]=null;}else{_0xb03ddb[_0x1b3a('0x37')]=_0x2e372d[_0x1b3a('0x37')]=null;}_0xb03ddb[_0x1b3a('0x38')]=getImapHost(_0x49eb67);_0xb03ddb['port']=0x3e1;_0x2e372d[_0x1b3a('0x38')]=getSmtpHost(_0x49eb67);_0x2e372d['port']=0x24b;_0x2e372d[_0x1b3a('0x39')]=![];_0xb03ddb['service']=_0x2e372d[_0x1b3a('0x3a')]=null;}else{if(_0x54bc04[_0x1b3a('0x3b')]){_0xb03ddb['user']=_0x2e372d[_0x1b3a('0x32')]=_0x54bc04['username'];_0xb03ddb['password']=_0x2e372d[_0x1b3a('0x35')]=_0x54bc04[_0x1b3a('0x34')];}else{_0xb03ddb[_0x1b3a('0x3b')]=_0x2e372d[_0x1b3a('0x3b')]=![];_0xb03ddb[_0x1b3a('0x32')]=_0x2e372d['user']=null;_0xb03ddb['password']=_0x2e372d[_0x1b3a('0x35')]=null;}_0xb03ddb[_0x1b3a('0x38')]=_0x54bc04['Imap'][_0x1b3a('0x38')];_0xb03ddb[_0x1b3a('0x3c')]=_0x54bc04[_0x1b3a('0x3d')][_0x1b3a('0x3c')];_0x2e372d[_0x1b3a('0x38')]=_0x54bc04[_0x1b3a('0x3e')][_0x1b3a('0x38')];_0x2e372d['port']=_0x54bc04['Smtp'][_0x1b3a('0x3c')];}return{'Imap':_0xb03ddb,'Smtp':_0x2e372d};}exports[_0x1b3a('0x3f')]=function(_0x580a46,_0x73efb8){var _0x1e1d36={'include':[{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x42')],'as':_0x1b3a('0x43')}]},_0x31b344={},_0x5cb120={'count':0x0,'rows':[]};var _0x43c1bb=_[_0x1b3a('0x44')](db[_0x1b3a('0x45')]['rawAttributes'],function(_0x566e8c){return{'name':_0x566e8c[_0x1b3a('0x46')],'type':_0x566e8c['type'][_0x1b3a('0x47')]};});_0x31b344[_0x1b3a('0x48')]=_[_0x1b3a('0x44')](_0x43c1bb,_0x1b3a('0x28'));_0x31b344['query']=_[_0x1b3a('0x49')](_0x580a46[_0x1b3a('0x4a')]);_0x31b344[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x31b344['model'],_0x31b344[_0x1b3a('0x4a')]);_0x1e1d36[_0x1b3a('0x4d')]=_['intersection'](_0x31b344['model'],qs[_0x1b3a('0x4e')](_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x1e1d36[_0x1b3a('0x4d')]=_0x1e1d36['attributes'][_0x1b3a('0x4f')]?_0x1e1d36[_0x1b3a('0x4d')]:_0x31b344[_0x1b3a('0x48')];if(!_0x580a46[_0x1b3a('0x4a')]['hasOwnProperty'](_0x1b3a('0x50'))){_0x1e1d36['limit']=qs[_0x1b3a('0x1e')](_0x580a46['query'][_0x1b3a('0x1e')]);_0x1e1d36['offset']=qs[_0x1b3a('0x1b')](_0x580a46[_0x1b3a('0x4a')]['offset']);}_0x1e1d36[_0x1b3a('0x51')]=qs['sort'](_0x580a46[_0x1b3a('0x4a')]['sort']);_0x1e1d36[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x580a46[_0x1b3a('0x4a')],_0x31b344[_0x1b3a('0x4b')]),_0x43c1bb);if(_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x1e1d36[_0x1b3a('0x52')]=_[_0x1b3a('0x55')](_0x1e1d36[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x43c1bb,function(_0x400c6b){if(_0x400c6b[_0x1b3a('0x56')]!=='VIRTUAL'){var _0x2a262e={};_0x2a262e[_0x400c6b[_0x1b3a('0x28')]]={'$like':'%'+_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2a262e;}})});}_0x1e1d36=_[_0x1b3a('0x55')]({},_0x1e1d36,_0x580a46[_0x1b3a('0x57')]);var _0x1df22f={'where':_0x1e1d36[_0x1b3a('0x52')]};return db[_0x1b3a('0x45')]['count'](_0x1df22f)[_0x1b3a('0x22')](function(_0x50e3de){_0x5cb120['count']=_0x50e3de;if(_0x580a46[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x1e1d36[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x45')][_0x1b3a('0x5a')](_0x1e1d36);})['then'](function(_0x22ccb8){_0x5cb120[_0x1b3a('0x5b')]=_0x22ccb8;return _0x5cb120;})[_0x1b3a('0x22')](respondWithFilteredResult(_0x73efb8,_0x1e1d36))['catch'](handleError(_0x73efb8,null));};exports['show']=function(_0x5b24ca,_0x485fb9){var _0x5c74fe={'raw':![],'where':{'id':_0x5b24ca[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x40')],'as':'Imap'},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db['Pause'],'as':_0x1b3a('0x43')}]},_0x1a1959={};_0x1a1959[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x45')][_0x1b3a('0x5d')]);_0x1a1959[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5b24ca['query']);_0x1a1959['filters']=_['intersection'](_0x1a1959['model'],_0x1a1959[_0x1b3a('0x4a')]);_0x5c74fe[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x1a1959[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5b24ca[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x5c74fe[_0x1b3a('0x4d')]=_0x5c74fe[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x5c74fe['attributes']:_0x1a1959[_0x1b3a('0x48')];if(_0x5b24ca[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x5c74fe['include']=[{'all':!![]}];}_0x5c74fe=_[_0x1b3a('0x55')]({},_0x5c74fe,_0x5b24ca[_0x1b3a('0x57')]);return db[_0x1b3a('0x45')][_0x1b3a('0x5e')](_0x5c74fe)[_0x1b3a('0x22')](handleEntityNotFound(_0x485fb9,null))[_0x1b3a('0x22')](respondWithResult(_0x485fb9,null))[_0x1b3a('0x5f')](handleError(_0x485fb9,null));};exports[_0x1b3a('0x21')]=function(_0x47a348,_0x598f2b){if(_0x47a348[_0x1b3a('0x60')]['id']){delete _0x47a348['body']['id'];}var _0x384a80=_0x47a348[_0x1b3a('0x60')]['provider']===_0x1b3a('0x61')?null:_0x47a348['body'][_0x1b3a('0x62')];var _0x3f02d3=_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')]||{};var _0x23a114=_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')]||{};if(_0x384a80){_0x3f02d3[_0x1b3a('0x38')]=getImapHost(_0x384a80);_0x3f02d3[_0x1b3a('0x3c')]=0x3e1;_0x23a114[_0x1b3a('0x38')]=getSmtpHost(_0x384a80);_0x23a114['port']=0x24b;_0x23a114[_0x1b3a('0x39')]=![];}if(_0x23a114[_0x1b3a('0x36')]){_0x23a114[_0x1b3a('0x39')]=![];}else{_0x23a114['CloudProviderId']=null;}if(!_0x3f02d3[_0x1b3a('0x36')])_0x3f02d3[_0x1b3a('0x37')]=null;_0x47a348[_0x1b3a('0x60')]['Imap']=_0x3f02d3;_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')]=_0x23a114;return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x47a348['params']['id']},'include':[{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x42')],'as':_0x1b3a('0x43')}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x598f2b,null))['then'](function(_0x3e9368){if(!_0x3e9368)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3e9368['service'])delete _0x47a348['body']['Imap'];return _0x3e9368;})[_0x1b3a('0x22')](saveUpdates(_0x47a348[_0x1b3a('0x60')],null))['then'](function(_0x4d71cf){if(!_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')])return _0x4d71cf;return db[_0x1b3a('0x40')][_0x1b3a('0x21')](_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3d')],{'where':{'MailAccountId':_0x4d71cf['id']}})[_0x1b3a('0x22')](function(){return _0x4d71cf;});})[_0x1b3a('0x22')](function(_0x402bcc){if(!_0x47a348[_0x1b3a('0x60')]['Smtp'])return _0x402bcc;return db[_0x1b3a('0x41')]['update'](_0x47a348[_0x1b3a('0x60')][_0x1b3a('0x3e')],{'where':{'MailAccountId':_0x402bcc['id']}})[_0x1b3a('0x22')](function(){return _0x402bcc;});})['then'](respondWithResult(_0x598f2b,null))[_0x1b3a('0x5f')](handleError(_0x598f2b,null));};exports['describe']=function(_0x4edadf,_0x167f16){return db[_0x1b3a('0x45')][_0x1b3a('0x63')]()['then'](respondWithResult(_0x167f16,null))['catch'](handleError(_0x167f16,null));};exports[_0x1b3a('0x64')]=function(_0x21533f,_0x440196){if(_0x21533f['body']['id']){delete _0x21533f[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x21533f[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x440196,null))['then'](function(_0x4c32d7){if(_0x4c32d7){_0x21533f[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0x4c32d7['id'];return db[_0x1b3a('0x66')][_0x1b3a('0x67')](_0x21533f['body']);}})[_0x1b3a('0x22')](respondWithResult(_0x440196,null))[_0x1b3a('0x5f')](handleError(_0x440196,null));};exports['getDispositions']=function(_0x5a49d7,_0x453ba6){var _0x2cb948={'raw':![],'where':{}};var _0x2942f7={};var _0x13e5c6={'count':0x0,'rows':[]};return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x5a49d7[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x453ba6,null))[_0x1b3a('0x22')](function(_0x5819ac){if(_0x5819ac){_0x2942f7['model']=_['keys'](db[_0x1b3a('0x66')][_0x1b3a('0x5d')]);_0x2942f7[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5a49d7[_0x1b3a('0x4a')]);_0x2942f7['filters']=_[_0x1b3a('0x4c')](_0x2942f7[_0x1b3a('0x48')],_0x2942f7[_0x1b3a('0x4a')]);_0x2cb948['attributes']=_[_0x1b3a('0x4c')](_0x2942f7[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x2cb948['attributes']=_0x2cb948[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x2cb948[_0x1b3a('0x4d')]:_0x2942f7[_0x1b3a('0x48')];if(!_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x2cb948[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x5a49d7['query'][_0x1b3a('0x1e')]);_0x2cb948[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x2cb948[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x2cb948[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5a49d7[_0x1b3a('0x4a')],_0x2942f7['filters']));_0x2cb948[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x5819ac['id'];if(_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x2cb948['where']=_[_0x1b3a('0x55')](_0x2cb948[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x2cb948[_0x1b3a('0x4d')],function(_0x5a1929){var _0x4567dd={};_0x4567dd[_0x5a1929]={'$like':'%'+_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x4567dd;})});}_0x2cb948=_[_0x1b3a('0x55')]({},_0x2cb948,_0x5a49d7['options']);return db[_0x1b3a('0x66')][_0x1b3a('0x1d')]({'where':_0x2cb948[_0x1b3a('0x52')]})['then'](function(_0x528b56){_0x13e5c6[_0x1b3a('0x1d')]=_0x528b56;if(_0x5a49d7[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x2cb948['include']=[{'all':!![]}];}return db[_0x1b3a('0x66')][_0x1b3a('0x5a')](_0x2cb948);})[_0x1b3a('0x22')](function(_0x2ebed2){_0x13e5c6[_0x1b3a('0x5b')]=_0x2ebed2;return _0x13e5c6;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x453ba6,_0x2cb948))[_0x1b3a('0x5f')](handleError(_0x453ba6,null));};exports[_0x1b3a('0x6b')]=function(_0x4d4791,_0x568b52){return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0x4d4791[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x568b52,null))[_0x1b3a('0x22')](function(_0x2cf5f1){if(_0x2cf5f1){return _0x2cf5f1[_0x1b3a('0x6b')](_0x4d4791[_0x1b3a('0x4a')]['ids']);}})[_0x1b3a('0x22')](respondWithStatusCode(_0x568b52,null))[_0x1b3a('0x5f')](handleError(_0x568b52,null));};exports[_0x1b3a('0x6c')]=function(_0x4a33de,_0x10eb97){if(_0x4a33de[_0x1b3a('0x60')]['id']){delete _0x4a33de[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')]['find']({'where':{'id':_0x4a33de[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x10eb97,null))['then'](function(_0xce60af){if(_0xce60af){_0x4a33de[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0xce60af['id'];return db[_0x1b3a('0x6d')][_0x1b3a('0x67')](_0x4a33de[_0x1b3a('0x60')]);}})[_0x1b3a('0x22')](respondWithResult(_0x10eb97,null))['catch'](handleError(_0x10eb97,null));};exports[_0x1b3a('0x6e')]=function(_0x359926,_0x503147){var _0x4c7c10={'raw':![],'where':{}};var _0x442e6a={};var _0x5837b8={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x359926[_0x1b3a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x503147,null))[_0x1b3a('0x22')](function(_0x1d5c4c){if(_0x1d5c4c){_0x442e6a[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x6d')][_0x1b3a('0x5d')]);_0x442e6a[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x359926[_0x1b3a('0x4a')]);_0x442e6a[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x442e6a['model'],_0x442e6a[_0x1b3a('0x4a')]);_0x4c7c10[_0x1b3a('0x4d')]=_['intersection'](_0x442e6a[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x4c7c10['attributes']=_0x4c7c10[_0x1b3a('0x4d')]['length']?_0x4c7c10[_0x1b3a('0x4d')]:_0x442e6a[_0x1b3a('0x48')];if(!_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x4c7c10[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x4c7c10[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x4c7c10[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x4c7c10['where']=qs['filters'](_[_0x1b3a('0x53')](_0x359926['query'],_0x442e6a[_0x1b3a('0x4b')]));_0x4c7c10[_0x1b3a('0x52')]['MailAccountId']=_0x1d5c4c['id'];if(_0x359926['query']['filter']){_0x4c7c10[_0x1b3a('0x52')]=_['merge'](_0x4c7c10[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x4c7c10[_0x1b3a('0x4d')],function(_0x475e03){var _0x972af6={};_0x972af6[_0x475e03]={'$like':'%'+_0x359926[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x972af6;})});}_0x4c7c10=_[_0x1b3a('0x55')]({},_0x4c7c10,_0x359926[_0x1b3a('0x57')]);return db[_0x1b3a('0x6d')][_0x1b3a('0x1d')]({'where':_0x4c7c10[_0x1b3a('0x52')]})[_0x1b3a('0x22')](function(_0x239beb){_0x5837b8[_0x1b3a('0x1d')]=_0x239beb;if(_0x359926['query']['includeAll']){_0x4c7c10[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x6d')][_0x1b3a('0x5a')](_0x4c7c10);})['then'](function(_0x4d174a){_0x5837b8[_0x1b3a('0x5b')]=_0x4d174a;return _0x5837b8;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x503147,_0x4c7c10))['catch'](handleError(_0x503147,null));};exports['removeAnswers']=function(_0x1317be,_0x390389){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x1317be[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x390389,null))[_0x1b3a('0x22')](function(_0x45042c){if(_0x45042c){return _0x45042c['removeAnswers'](_0x1317be['query']['ids']);}})[_0x1b3a('0x22')](respondWithStatusCode(_0x390389,null))[_0x1b3a('0x5f')](handleError(_0x390389,null));};exports[_0x1b3a('0x67')]=function(_0x390f18,_0x4796d7){var _0x2d4010={'name':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x28')],'key':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x47')],'provider':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x62')]===_0x1b3a('0x61')?null:_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x62')],'email':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x6f')],'ListId':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x70')],'active':!_[_0x1b3a('0x71')](_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x72')])?_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x72')]:!![],'description':_0x390f18[_0x1b3a('0x60')][_0x1b3a('0x73')]||null};var _0x29a0e9=getAuthenticationOptions(_0x2d4010[_0x1b3a('0x62')],_0x390f18[_0x1b3a('0x60')]);_0x2d4010[_0x1b3a('0x3d')]=_0x29a0e9[_0x1b3a('0x3d')];_0x2d4010[_0x1b3a('0x3e')]=_0x29a0e9[_0x1b3a('0x3e')];return db['MailAccount'][_0x1b3a('0x67')](_0x2d4010,{'include':[{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e')},{'model':db[_0x1b3a('0x40')],'as':_0x1b3a('0x3d')}]})[_0x1b3a('0x22')](function(_0x10535a){var _0x48a066=_0x390f18[_0x1b3a('0x32')]['get']({'plain':!![]});if(!_0x48a066)throw new Error(_0x1b3a('0x74'));if(_0x48a066[_0x1b3a('0x75')]==='user'){var _0x9c5dad=_0x10535a[_0x1b3a('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x1b3a('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x48a066[_0x1b3a('0x76')]},'raw':!![]})[_0x1b3a('0x22')](function(_0xdf423a){if(_0xdf423a&&_0xdf423a[_0x1b3a('0x77')]===0x0){return db['UserProfileResource'][_0x1b3a('0x67')]({'name':_0x9c5dad[_0x1b3a('0x28')],'resourceId':_0x9c5dad['id'],'type':_0xdf423a['name'],'sectionId':_0xdf423a['id']},{})[_0x1b3a('0x22')](function(){return _0x10535a;});}else{return _0x10535a;}})[_0x1b3a('0x5f')](function(_0x5370bf){logger['error'](_0x1b3a('0x78'),_0x5370bf);throw _0x5370bf;});}return _0x10535a;})[_0x1b3a('0x22')](respondWithResult(_0x4796d7,0xc9))[_0x1b3a('0x5f')](handleError(_0x4796d7,null));};exports[_0x1b3a('0x79')]=function(_0x23fa8a,_0x5d577f){return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x23fa8a['params']['id']}})['then'](handleEntityNotFound(_0x5d577f,null))['then'](function(_0x2bf717){if(_0x2bf717){return _0x2bf717[_0x1b3a('0x79')]();}return null;})['then'](respondWithResult(_0x5d577f,null))[_0x1b3a('0x5f')](handleError(_0x5d577f,null));};exports[_0x1b3a('0x7a')]=function(_0x3f29d7,_0x56a6d5){if(_0x3f29d7[_0x1b3a('0x60')]['id']){delete _0x3f29d7[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x3f29d7['params']['id']}})['then'](handleEntityNotFound(_0x56a6d5,null))[_0x1b3a('0x22')](function(_0x448e70){if(_0x448e70){_0x3f29d7[_0x1b3a('0x60')][_0x1b3a('0x65')]=_0x448e70['id'];return db[_0x1b3a('0x40')][_0x1b3a('0x67')](_0x3f29d7['body']);}})[_0x1b3a('0x22')](respondWithResult(_0x56a6d5,null))[_0x1b3a('0x5f')](handleError(_0x56a6d5,null));};exports[_0x1b3a('0x7b')]=function(_0x4f4df0,_0x22bbe5){return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x4f4df0[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x22bbe5,null))['then'](function(_0xbc7309){if(_0xbc7309){return _0xbc7309[_0x1b3a('0x7c')](null);}return null;})[_0x1b3a('0x22')](respondWithStatusCode(_0x22bbe5,null))['catch'](handleError(_0x22bbe5,null));};exports[_0x1b3a('0x7d')]=function(_0x2c32af,_0x2515b5){return db[_0x1b3a('0x45')]['findOne']({'where':{'id':_0x2c32af[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x2515b5,null))[_0x1b3a('0x22')](function(_0x21bc6c){if(_0x21bc6c){return _0x21bc6c['getSmtp']();}return null;})[_0x1b3a('0x22')](respondWithResult(_0x2515b5,null))[_0x1b3a('0x5f')](handleError(_0x2515b5,null));};exports[_0x1b3a('0x7e')]=function(_0x3647b4,_0x3032f9){if(_0x3647b4['body']['id']){delete _0x3647b4[_0x1b3a('0x60')]['id'];}return db[_0x1b3a('0x45')]['find']({'where':{'id':_0x3647b4[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x3032f9,null))[_0x1b3a('0x22')](function(_0x48b0e1){if(_0x48b0e1){_0x3647b4[_0x1b3a('0x60')]['MailAccountId']=_0x48b0e1['id'];return db['MailServerOut'][_0x1b3a('0x67')](_0x3647b4[_0x1b3a('0x60')]);}})[_0x1b3a('0x22')](respondWithResult(_0x3032f9,null))[_0x1b3a('0x5f')](handleError(_0x3032f9,null));};exports[_0x1b3a('0x7f')]=function(_0x4d8e80,_0x51260c){return db['MailAccount'][_0x1b3a('0x68')]({'where':{'id':_0x4d8e80[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x51260c,null))['then'](function(_0x3f5539){if(_0x3f5539){return _0x3f5539[_0x1b3a('0x80')](null);}return null;})[_0x1b3a('0x22')](respondWithStatusCode(_0x51260c,null))[_0x1b3a('0x5f')](handleError(_0x51260c,null));};exports[_0x1b3a('0x81')]=function(_0x20d234,_0x32bc21){return db['MailInteraction']['find']({'where':{'id':_0x20d234['params']['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x32bc21,null))[_0x1b3a('0x22')](function(_0x18b7c6){if(_0x18b7c6){return _0x18b7c6['addInteraction'](_0x20d234[_0x1b3a('0x60')]['ids'],_[_0x1b3a('0x82')](_0x20d234[_0x1b3a('0x60')],[_0x1b3a('0x83'),'id'])||{});}})[_0x1b3a('0x22')](respondWithResult(_0x32bc21,null))[_0x1b3a('0x5f')](handleError(_0x32bc21,null));};exports[_0x1b3a('0x84')]=function(_0x746be0,_0x5b5a00){var _0x5423b2={'raw':![],'where':{}};var _0x544325={};var _0x2c9fc3={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x746be0[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x5b5a00,null))[_0x1b3a('0x22')](function(_0x1672fd){if(_0x1672fd){_0x544325[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db['MailInteraction'][_0x1b3a('0x5d')]);_0x544325[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x746be0[_0x1b3a('0x4a')]);_0x544325[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x544325[_0x1b3a('0x48')],_0x544325[_0x1b3a('0x4a')]);_0x5423b2[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x544325[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x5423b2[_0x1b3a('0x4d')]=_0x5423b2[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x5423b2[_0x1b3a('0x4d')]:_0x544325[_0x1b3a('0x48')];if(!_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x5423b2[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x5423b2[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x5423b2[_0x1b3a('0x51')]=qs['sort'](_0x746be0[_0x1b3a('0x4a')]['sort']);_0x5423b2['where']=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x746be0[_0x1b3a('0x4a')],_0x544325[_0x1b3a('0x4b')]));_0x5423b2[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x1672fd['id'];if(_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x5423b2['where']=_['merge'](_0x5423b2[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x5423b2[_0x1b3a('0x4d')],function(_0xe83b31){var _0x30f460={};_0x30f460[_0xe83b31]={'$like':'%'+_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x30f460;})});}_0x5423b2=_[_0x1b3a('0x55')]({},_0x5423b2,_0x746be0[_0x1b3a('0x57')]);return db[_0x1b3a('0x85')][_0x1b3a('0x1d')]({'where':_0x5423b2[_0x1b3a('0x52')]})[_0x1b3a('0x22')](function(_0x4c78e7){_0x2c9fc3[_0x1b3a('0x1d')]=_0x4c78e7;if(_0x746be0[_0x1b3a('0x4a')]['includeAll']){_0x5423b2[_0x1b3a('0x59')]=[{'model':db[_0x1b3a('0x86')],'as':_0x1b3a('0x87'),'required':![]},{'model':db['User'],'as':_0x1b3a('0x88'),'attributes':[_0x1b3a('0x28'),_0x1b3a('0x89'),_0x1b3a('0x8a')],'required':![]},{'model':db['Tag'],'as':_0x1b3a('0x8b'),'attributes':['id','name','color'],'where':_0x746be0[_0x1b3a('0x4a')]['tag']?{'id':_0x746be0[_0x1b3a('0x4a')][_0x1b3a('0x8c')]}:undefined,'required':_0x746be0['query'][_0x1b3a('0x8c')]?!![]:![]}];}return db['MailInteraction'][_0x1b3a('0x5a')](_0x5423b2);})[_0x1b3a('0x22')](function(_0x42da77){_0x2c9fc3[_0x1b3a('0x5b')]=_0x42da77;return _0x2c9fc3;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x5b5a00,_0x5423b2))['catch'](handleError(_0x5b5a00,null));};exports[_0x1b3a('0x8d')]=function addApplications(_0x24b842,_0x3da849){var _0x355713=_0x24b842['params']['id'];var _0x112e2f=_0x24b842['body'];var _0x3bc83a=0xc8;var _0x492e62=null;return db[_0x1b3a('0x8e')][_0x1b3a('0x8f')]({'isolationLevel':db[_0x1b3a('0x8e')][_0x1b3a('0x90')][_0x1b3a('0x91')][_0x1b3a('0x92')]},function(_0x26a4a4){return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x355713},'transaction':_0x26a4a4})[_0x1b3a('0x22')](function(_0x597e17){if(_0x597e17){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x355713},'transaction':_0x26a4a4})['then'](function(){var _0x213a81=_[_0x1b3a('0x44')](_0x112e2f,function(_0x195f09){_0x195f09['MailAccountId']=_0x355713;return _0x195f09;});return db['MailApplication'][_0x1b3a('0x93')](_0x213a81,{'transaction':_0x26a4a4});});}else{_0x3bc83a=0x194;_0x492e62=[];}});})[_0x1b3a('0x22')](function(){if(_0x3bc83a!==0x194){return db[_0x1b3a('0x94')][_0x1b3a('0x95')]({'where':{'MailAccountId':_0x355713},'order':'priority'})[_0x1b3a('0x22')](function(_0x36f8e7){_0x492e62=_0x36f8e7;});}})[_0x1b3a('0x5f')](function(_0x2602e3){_0x3bc83a=0x1f4;logger[_0x1b3a('0x14')](_0x2602e3[_0x1b3a('0x27')]);if(_0x2602e3[_0x1b3a('0x28')]){delete _0x2602e3[_0x1b3a('0x28')];}_0x492e62=_0x2602e3;})[_0x1b3a('0x96')](function(){if(_0x492e62===null){_0x3da849['sendStatus'](_0x3bc83a);}else{if(_0x3bc83a===0x1f4){_0x3da849[_0x1b3a('0x19')](_0x3bc83a)[_0x1b3a('0x29')](_0x492e62);}else{_0x3da849['status'](_0x3bc83a)['json'](_0x492e62);}}});};exports['getApplications']=function(_0x5ed9cf,_0x317af0){var _0x8c82b0={};var _0xe1fe5c={};var _0x2ae329;var _0x3a171f;return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x5ed9cf[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x317af0,null))['then'](function(_0x7de7d7){if(_0x7de7d7){_0x2ae329=_0x7de7d7;_0xe1fe5c[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db[_0x1b3a('0x94')][_0x1b3a('0x5d')]);_0xe1fe5c[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x5ed9cf[_0x1b3a('0x4a')]);_0xe1fe5c[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0xe1fe5c[_0x1b3a('0x48')],_0xe1fe5c[_0x1b3a('0x4a')]);_0x8c82b0[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0xe1fe5c[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x8c82b0[_0x1b3a('0x4d')]=_0x8c82b0[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x8c82b0[_0x1b3a('0x4d')]:_0xe1fe5c['model'];_0x8c82b0[_0x1b3a('0x51')]=qs['sort'](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x6a')]);_0x8c82b0[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5ed9cf[_0x1b3a('0x4a')],_0xe1fe5c[_0x1b3a('0x4b')]));if(_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x8c82b0[_0x1b3a('0x52')]=_[_0x1b3a('0x55')](_0x8c82b0[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x8c82b0['attributes'],function(_0x4f5c67){var _0x2ea1f3={};_0x2ea1f3[_0x4f5c67]={'$like':'%'+_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2ea1f3;})});}_0x8c82b0=_['merge']({},_0x8c82b0,_0x5ed9cf['options']);return _0x2ae329[_0x1b3a('0x97')](_0x8c82b0);}})[_0x1b3a('0x22')](function(_0x192a4c){if(_0x192a4c){_0x3a171f=_0x192a4c['length'];if(!_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x69')]('nolimit')){_0x8c82b0['limit']=qs[_0x1b3a('0x1e')](_0x5ed9cf[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x8c82b0[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5ed9cf['query'][_0x1b3a('0x1b')]);}return _0x2ae329[_0x1b3a('0x97')](_0x8c82b0);}})[_0x1b3a('0x22')](function(_0x5a8bee){if(_0x5a8bee){return _0x5a8bee?{'count':_0x3a171f,'rows':_0x5a8bee}:null;}})[_0x1b3a('0x22')](respondWithResult(_0x317af0,null))[_0x1b3a('0x5f')](handleError(_0x317af0,null));};exports[_0x1b3a('0x98')]=function(_0x5369de,_0x326e9b){var _0x52d63a={'raw':!![],'where':{}};var _0x1ce399={};var _0x149c1b={'count':0x0,'rows':[]};return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x5369de[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x326e9b,null))[_0x1b3a('0x22')](function(_0x244c81){if(_0x244c81){_0x1ce399[_0x1b3a('0x48')]=_[_0x1b3a('0x49')](db['MailMessage'][_0x1b3a('0x5d')]);_0x1ce399['query']=_[_0x1b3a('0x49')](_0x5369de[_0x1b3a('0x4a')]);_0x1ce399[_0x1b3a('0x4b')]=_[_0x1b3a('0x4c')](_0x1ce399[_0x1b3a('0x48')],_0x1ce399['query']);_0x52d63a[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0x1ce399[_0x1b3a('0x48')],qs[_0x1b3a('0x4e')](_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x52d63a[_0x1b3a('0x4d')]=_0x52d63a[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x52d63a['attributes']:_0x1ce399[_0x1b3a('0x48')];if(!_0x5369de['query'][_0x1b3a('0x69')]('nolimit')){_0x52d63a[_0x1b3a('0x1e')]=qs[_0x1b3a('0x1e')](_0x5369de[_0x1b3a('0x4a')]['limit']);_0x52d63a[_0x1b3a('0x1b')]=qs[_0x1b3a('0x1b')](_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x1b')]);}_0x52d63a['order']=qs[_0x1b3a('0x6a')](_0x5369de['query'][_0x1b3a('0x6a')]);_0x52d63a['where']=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x5369de[_0x1b3a('0x4a')],_0x1ce399['filters']));_0x52d63a[_0x1b3a('0x52')][_0x1b3a('0x65')]=_0x244c81['id'];if(_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x52d63a['where']=_[_0x1b3a('0x55')](_0x52d63a[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x52d63a['attributes'],function(_0x276ef6){var _0x2db23f={};_0x2db23f[_0x276ef6]={'$like':'%'+_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x54')]+'%'};return _0x2db23f;})});}if(_0x5369de[_0x1b3a('0x4a')]['$gte']){var _0x4f2f12=_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x99')][_0x1b3a('0x9a')](',');var _0xb60e6e={};_0xb60e6e[_0x4f2f12[0x0]]={'$gte':moment(_0x4f2f12[0x1])[_0x1b3a('0x9b')](_0x1b3a('0x9c'))};_0x52d63a['where']=_[_0x1b3a('0x55')](_0x52d63a['where'],_0xb60e6e);}_0x52d63a=_[_0x1b3a('0x55')]({},_0x52d63a,_0x5369de[_0x1b3a('0x57')]);return db['MailMessage'][_0x1b3a('0x1d')]({'where':_0x52d63a['where']})[_0x1b3a('0x22')](function(_0x4d290d){_0x149c1b['count']=_0x4d290d;if(_0x5369de[_0x1b3a('0x4a')][_0x1b3a('0x58')]){_0x52d63a[_0x1b3a('0x59')]=[{'all':!![]}];}return db[_0x1b3a('0x9d')]['findAll'](_0x52d63a);})[_0x1b3a('0x22')](function(_0x439cf4){if(_0x5369de[_0x1b3a('0x4a')]['inlineCss']===_0x1b3a('0x9e')){for(var _0x3d1c2e=0x0;_0x3d1c2e<_0x439cf4['length'];_0x3d1c2e++){_0x439cf4[_0x3d1c2e]['body']=juice(_0x439cf4[_0x3d1c2e][_0x1b3a('0x60')]);}}_0x149c1b[_0x1b3a('0x5b')]=_0x439cf4;return _0x149c1b;});}})[_0x1b3a('0x22')](respondWithFilteredResult(_0x326e9b,_0x52d63a))[_0x1b3a('0x5f')](handleError(_0x326e9b,null));};exports[_0x1b3a('0x29')]=function(_0x816fd7,_0x422d9a){var _0x3b66d0,_0x1cb7d1={},_0x48fc12;if(_0x816fd7[_0x1b3a('0x60')]['to']){_0x48fc12=_0x816fd7[_0x1b3a('0x60')]['to'][_0x1b3a('0x9a')](',')[0x0];}return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0x816fd7[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x9f')],'as':'List','include':[{'model':db[_0x1b3a('0x86')],'as':'Contacts','where':{'email':_0x48fc12},'limit':0x1,'order':[[_0x1b3a('0xa0'),_0x1b3a('0xa1')]]}]},{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1b3a('0xa2'),'raw':!![]}]}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x422d9a,null))[_0x1b3a('0x22')](function(_0x366e1e){if(!_0x366e1e)return;_0x3b66d0=_0x366e1e;if(!_0x366e1e[_0x1b3a('0x3e')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')])){_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')]=util[_0x1b3a('0x9b')](_0x1b3a('0xa4'),_0x366e1e[_0x1b3a('0x28')],_0x366e1e[_0x1b3a('0x6f')]||_0x366e1e[_0x1b3a('0x3e')][_0x1b3a('0x32')]);}if(_0x816fd7[_0x1b3a('0x60')]['attachments']&&_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x1b3a('0x4f')]){for(var _0x3c536f=0x0;_0x3c536f<_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')]['length'];_0x3c536f+=0x1){_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x3c536f]={'filename':_0x816fd7[_0x1b3a('0x60')]['attachments'][_0x3c536f][_0x1b3a('0x28')],'path':path[_0x1b3a('0xa6')](config[_0x1b3a('0xa7')],_0x1b3a('0xa8'),_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa5')][_0x3c536f][_0x1b3a('0xa9')])};}}var _0x24109c=_0x366e1e[_0x1b3a('0xaa')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x24109c,'message':_0x816fd7['body']});})['then'](function(_0x33755a){if(!_0x33755a)return;_0x1cb7d1=_0x33755a;if(!_0x3b66d0['List'])throw new Error(_0x1b3a('0xab'));if(_0x3b66d0['List']['Contacts']['length'])return _0x3b66d0[_0x1b3a('0xac')]['Contacts'][0x0];return db[_0x1b3a('0x86')]['create'](_[_0x1b3a('0x9')](_0x816fd7[_0x1b3a('0x60')],{'firstName':_0x816fd7[_0x1b3a('0x60')]['to'],'email':_0x816fd7['body']['to'],'phone':_0x816fd7[_0x1b3a('0x60')]['to'],'ListId':_0x3b66d0['ListId']}));})[_0x1b3a('0x22')](function(_0x42f670){if(!_0x42f670)return;var _0x38c944={'UserId':_0x816fd7['user']['id'],'ContactId':_0x42f670['id'],'MailAccountId':_0x3b66d0['id'],'inReplyTo':_0x1cb7d1[_0x1b3a('0xad')],'to':_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xa3')],'cc':_0x816fd7[_0x1b3a('0x60')]['cc'],'subject':_0x816fd7['body']['subject'],'attach':_0x816fd7['body'][_0x1b3a('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1b3a('0x9b')](_0x1b3a('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x1b3a('0x55')](_0x816fd7['body'],{'messageId':_0x1cb7d1[_0x1b3a('0xad')],'sentAt':moment()['format'](_0x1b3a('0x9c')),'read':!![],'MailAccountId':_0x3b66d0['id'],'UserId':_0x816fd7[_0x1b3a('0x32')]['id'],'ContactId':_0x42f670['id']})]};if(_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xaf')]){_0x38c944=_[_0x1b3a('0x55')](_0x38c944,_0x816fd7[_0x1b3a('0x60')][_0x1b3a('0xaf')]);}return db[_0x1b3a('0x85')][_0x1b3a('0x67')](_0x38c944,{'include':[{'model':db['MailMessage'],'as':_0x1b3a('0xb0')}]});})[_0x1b3a('0x22')](respondWithResult(_0x422d9a,null))[_0x1b3a('0x5f')](handleError(_0x422d9a,null));};exports[_0x1b3a('0xb1')]=function(_0x12dcee,_0x19aa90){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x12dcee[_0x1b3a('0x5c')]['id']},'include':[{'model':db[_0x1b3a('0x41')],'as':_0x1b3a('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1b3a('0xa2'),'raw':!![]}]}]})[_0x1b3a('0x22')](handleEntityNotFound(_0x19aa90,null))[_0x1b3a('0x22')](function(_0x4fbb7b){if(!_0x4fbb7b[_0x1b3a('0x3e')])return;var _0x3b09f4=_0x4fbb7b[_0x1b3a('0xaa')]();return respondWithRpcPromise(_0x1b3a('0xb2'),_0x1b3a('0xb1'),{'account':_0x3b09f4});})[_0x1b3a('0x22')](respondWithResult(_0x19aa90,null))[_0x1b3a('0x5f')](handleError(_0x19aa90,null));};exports[_0x1b3a('0x26')]=function(_0x307162,_0x42a9f8){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x307162[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x42a9f8,null))[_0x1b3a('0x22')](function(_0x32f364){if(_0x32f364&&_0x32f364['service']){throw new db[(_0x1b3a('0xb3'))]['ValidationError'](_0x1b3a('0xb4'));}return _0x32f364;})[_0x1b3a('0x22')](removeEntity(_0x42a9f8,null))[_0x1b3a('0x5f')](handleError(_0x42a9f8,null));};exports[_0x1b3a('0xb5')]=function(_0xfe1470,_0x1a77a4){return db['MailAccount'][_0x1b3a('0x5e')]({'where':{'id':_0xfe1470[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x1a77a4,null))[_0x1b3a('0x22')](function(_0x1e38bd){if(_0x1e38bd){return _0x1e38bd['addAgents'](_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')],_[_0x1b3a('0x82')](_0xfe1470[_0x1b3a('0x60')],[_0x1b3a('0x83'),'id'])||{})[_0x1b3a('0xb6')](function(_0xa5de5b){for(var _0x2797ca=0x0;_0x2797ca<_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')][_0x1b3a('0x4f')];_0x2797ca+=0x1){socket[_0x1b3a('0xb7')](_0x1b3a('0xb8'),{'UserId':Number(_0xfe1470[_0x1b3a('0x60')][_0x1b3a('0x83')][_0x2797ca]),'MailAccountId':Number(_0xfe1470[_0x1b3a('0x5c')]['id'])});}return _0xa5de5b;});}})[_0x1b3a('0x22')](respondWithResult(_0x1a77a4,null))[_0x1b3a('0x5f')](handleError(_0x1a77a4,null));};exports['removeAgents']=function(_0x343df1,_0x7be054){return db[_0x1b3a('0x45')][_0x1b3a('0x5e')]({'where':{'id':_0x343df1[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x7be054,null))[_0x1b3a('0x22')](function(_0x20e7df){if(_0x20e7df){return _0x20e7df['removeAgents'](_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')])[_0x1b3a('0x22')](function(){if(_[_0x1b3a('0xb9')](_0x343df1['query'][_0x1b3a('0x83')])){for(var _0x54db32=0x0;_0x54db32<_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')][_0x1b3a('0x4f')];_0x54db32+=0x1){socket['emit'](_0x1b3a('0xba'),{'UserId':Number(_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')][_0x54db32]),'MailAccountId':Number(_0x343df1['params']['id'])});}}else{socket['emit'](_0x1b3a('0xba'),{'UserId':Number(_0x343df1[_0x1b3a('0x4a')][_0x1b3a('0x83')]),'MailAccountId':Number(_0x343df1[_0x1b3a('0x5c')]['id'])});}});}})[_0x1b3a('0x22')](respondWithStatusCode(_0x7be054,null))['catch'](handleError(_0x7be054,null));};exports[_0x1b3a('0xbb')]=function(_0x51452e,_0x4212fa){var _0x4de335={};var _0xad8378={};var _0x3c7c6d;var _0x1efd66;return db[_0x1b3a('0x45')][_0x1b3a('0x68')]({'where':{'id':_0x51452e[_0x1b3a('0x5c')]['id']}})[_0x1b3a('0x22')](handleEntityNotFound(_0x4212fa,null))[_0x1b3a('0x22')](function(_0x160de6){if(_0x160de6){_0x3c7c6d=_0x160de6;_0xad8378['model']=_[_0x1b3a('0x49')](db[_0x1b3a('0xbc')][_0x1b3a('0x5d')]);_0xad8378[_0x1b3a('0x4a')]=_[_0x1b3a('0x49')](_0x51452e['query']);_0xad8378['filters']=_[_0x1b3a('0x4c')](_0xad8378[_0x1b3a('0x48')],_0xad8378[_0x1b3a('0x4a')]);_0x4de335[_0x1b3a('0x4d')]=_[_0x1b3a('0x4c')](_0xad8378['model'],qs[_0x1b3a('0x4e')](_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x4e')]));_0x4de335['attributes']=_0x4de335[_0x1b3a('0x4d')][_0x1b3a('0x4f')]?_0x4de335[_0x1b3a('0x4d')]:_0xad8378[_0x1b3a('0x48')];_0x4de335[_0x1b3a('0x51')]=qs[_0x1b3a('0x6a')](_0x51452e[_0x1b3a('0x4a')]['sort']);_0x4de335[_0x1b3a('0x52')]=qs[_0x1b3a('0x4b')](_[_0x1b3a('0x53')](_0x51452e[_0x1b3a('0x4a')],_0xad8378[_0x1b3a('0x4b')]));if(_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x54')]){_0x4de335['where']=_[_0x1b3a('0x55')](_0x4de335[_0x1b3a('0x52')],{'$or':_[_0x1b3a('0x44')](_0x4de335['attributes'],function(_0x5e915d){var _0xcb462e={};_0xcb462e[_0x5e915d]={'$like':'%'+_0x51452e[_0x1b3a('0x4a')]['filter']+'%'};return _0xcb462e;})});}_0x4de335=_[_0x1b3a('0x55')]({},_0x4de335,_0x51452e[_0x1b3a('0x57')]);return _0x3c7c6d[_0x1b3a('0xbb')](_0x4de335);}})['then'](function(_0x44f652){if(_0x44f652){_0x1efd66=_0x44f652[_0x1b3a('0x4f')];if(!_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x69')](_0x1b3a('0x50'))){_0x4de335[_0x1b3a('0x1e')]=qs['limit'](_0x51452e[_0x1b3a('0x4a')][_0x1b3a('0x1e')]);_0x4de335['offset']=qs[_0x1b3a('0x1b')](_0x51452e[_0x1b3a('0x4a')]['offset']);}return _0x3c7c6d[_0x1b3a('0xbb')](_0x4de335);}})['then'](function(_0x4b47bb){if(_0x4b47bb){return _0x4b47bb?{'count':_0x1efd66,'rows':_0x4b47bb}:null;}})[_0x1b3a('0x22')](respondWithResult(_0x4212fa,null))[_0x1b3a('0x5f')](handleError(_0x4212fa,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8e9e518..9eed92c 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 _0xe58e=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x46baa3,_0x286bc8){var _0x44731a=function(_0x480ec8){while(--_0x480ec8){_0x46baa3['push'](_0x46baa3['shift']());}};_0x44731a(++_0x286bc8);}(_0xe58e,0x10e));var _0xee58=function(_0xa31d0a,_0x37cae0){_0xa31d0a=_0xa31d0a-0x0;var _0x5d03e6=_0xe58e[_0xa31d0a];return _0x5d03e6;};'use strict';var EventEmitter=require(_0xee58('0x0'));var MailAccount=require(_0xee58('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee58('0x2'),'afterUpdate':_0xee58('0x3'),'afterDestroy':_0xee58('0x4')};function emitEvent(_0x21b90b){return function(_0x2520ed,_0x267e52,_0x5b1052){MailAccountEvents['emit'](_0x21b90b+':'+_0x2520ed['id'],_0x2520ed);MailAccountEvents[_0xee58('0x5')](_0x21b90b,_0x2520ed);_0x5b1052(null);};}for(var e in events){if(events[_0xee58('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xee58('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xf426=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xf426,0x168));var _0x6f42=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xf426[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0x6f42('0x0'));var MailAccount=require(_0x6f42('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f42('0x2')](0x0);var events={'afterCreate':_0x6f42('0x3'),'afterUpdate':'update','afterDestroy':_0x6f42('0x4')};function emitEvent(_0x2d8784){return function(_0x2e83d8,_0x2d9121,_0x32bd6c){MailAccountEvents[_0x6f42('0x5')](_0x2d8784+':'+_0x2e83d8['id'],_0x2e83d8);MailAccountEvents[_0x6f42('0x5')](_0x2d8784,_0x2e83d8);_0x32bd6c(null);};}for(var e in events){if(events[_0x6f42('0x6')](e)){var event=events[e];MailAccount[_0x6f42('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f219d4b..3e8bcb9 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 _0x5802=['OAuth2','user','data5','./mailAccount.attributes','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x36057b,_0x3b82f1){var _0x5c7291=function(_0x3c5785){while(--_0x3c5785){_0x36057b['push'](_0x36057b['shift']());}};_0x5c7291(++_0x3b82f1);}(_0x5802,0xc9));var _0x2580=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0x5802[_0x10e653];return _0x328dfd;};'use strict';var attributes=require(_0x2580('0x0'));module['exports']=function(_0x45349c){return _0x45349c[_0x2580('0x1')]('MailAccount',attributes,{'tableName':_0x2580('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x24868e=this;var _0x2c73a6={'id':_0x24868e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x24868e[_0x2580('0x3')]!==_0x2580('0x4')){_0x2c73a6[_0x2580('0x5')]=_0x24868e[_0x2580('0x3')];}else{_0x2c73a6[_0x2580('0x6')]=_0x24868e[_0x2580('0x7')][_0x2580('0x6')];_0x2c73a6[_0x2580('0x8')]=_0x24868e[_0x2580('0x7')][_0x2580('0x8')];_0x2c73a6[_0x2580('0x9')]=_0x24868e[_0x2580('0x7')][_0x2580('0x9')];}if(_0x24868e[_0x2580('0x7')][_0x2580('0xa')]){if(_0x24868e['Smtp'][_0x2580('0xb')]){if(!_0x24868e['Smtp'][_0x2580('0xc')])throw new Error(_0x2580('0xd'));_0x2c73a6[_0x2580('0xe')]={'type':_0x2580('0xf'),'user':_0x24868e[_0x2580('0x7')][_0x2580('0x10')],'accessToken':_0x24868e[_0x2580('0x7')][_0x2580('0xc')][_0x2580('0x11')]};}else{_0x2c73a6[_0x2580('0xe')]={'user':_0x24868e[_0x2580('0x7')][_0x2580('0x10')],'pass':_0x24868e[_0x2580('0x7')]['pass']};}}return _0x2c73a6;}}});}; \ No newline at end of file +var _0x2814=['OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','port','secure','Smtp','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x2814,0x169));var _0x4281=function(_0x9b497,_0x419469){_0x9b497=_0x9b497-0x0;var _0x18f86f=_0x2814[_0x9b497];return _0x18f86f;};'use strict';var attributes=require(_0x4281('0x0'));module[_0x4281('0x1')]=function(_0x489db0){return _0x489db0[_0x4281('0x2')](_0x4281('0x3'),attributes,{'tableName':_0x4281('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xd2ac2e=this;var _0x234608={'id':_0xd2ac2e['id'],'tls':{'rejectUnauthorized':![]}};if(_0xd2ac2e['provider']!==_0x4281('0x5')){_0x234608['service']=_0xd2ac2e['provider'];}else{_0x234608['host']=_0xd2ac2e['Smtp']['host'];_0x234608[_0x4281('0x6')]=_0xd2ac2e['Smtp'][_0x4281('0x6')];_0x234608[_0x4281('0x7')]=_0xd2ac2e[_0x4281('0x8')]['secure'];}if(_0xd2ac2e[_0x4281('0x8')][_0x4281('0x9')]){if(_0xd2ac2e[_0x4281('0x8')]['modernAuthentication']){if(!_0xd2ac2e[_0x4281('0x8')][_0x4281('0xa')])throw new Error(_0x4281('0xb'));_0x234608[_0x4281('0xc')]={'type':_0x4281('0xd'),'user':_0xd2ac2e['Smtp'][_0x4281('0xe')],'accessToken':_0xd2ac2e[_0x4281('0x8')][_0x4281('0xa')][_0x4281('0xf')]};}else{_0x234608[_0x4281('0xc')]={'user':_0xd2ac2e[_0x4281('0x8')]['user'],'pass':_0xd2ac2e['Smtp'][_0x4281('0x10')]};}}return _0x234608;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 10673d0..6acf61e 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 _0x4317=['name','agent','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','smtp','setDataValue','ShowMailAccount','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','updatedAt','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','generate','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User'];(function(_0x2a19c1,_0x1a7182){var _0x1e15bf=function(_0x302dbb){while(--_0x302dbb){_0x2a19c1['push'](_0x2a19c1['shift']());}};_0x1e15bf(++_0x1a7182);}(_0x4317,0x7c));var _0x7431=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4317[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var moment=require(_0x7431('0x0'));var BPromise=require(_0x7431('0x1'));var rs=require(_0x7431('0x2'));var Redis=require('ioredis');var db=require(_0x7431('0x3'))['db'];var logger=require(_0x7431('0x4'))(_0x7431('0x5'));var config=require(_0x7431('0x6'));var jayson=require(_0x7431('0x7'));var client=jayson[_0x7431('0x8')]['http']({'port':0x232c});config['redis']=_[_0x7431('0x9')](config[_0x7431('0xa')],{'host':_0x7431('0xb'),'port':0x18eb});var socket=require(_0x7431('0xc'))(new Redis(config[_0x7431('0xa')]));require(_0x7431('0xd'))[_0x7431('0xe')](socket);function respondWithRpcPromise(_0x2294b8,_0xccbaee,_0xcf3ea4){return new BPromise(function(_0x9a8b79,_0x13bf7b){return client[_0x7431('0xf')](_0x2294b8,_0xcf3ea4)[_0x7431('0x10')](function(_0x216897){logger[_0x7431('0x11')](_0x7431('0x12'),_0xccbaee,_0x7431('0x13'));logger[_0x7431('0x14')](_0x7431('0x15'),_0xccbaee,_0x7431('0x13'),JSON[_0x7431('0x16')](_0x216897));if(_0x216897[_0x7431('0x17')]){if(_0x216897[_0x7431('0x17')]['code']===0x1f4){logger[_0x7431('0x17')](_0x7431('0x12'),_0xccbaee,_0x216897[_0x7431('0x17')]['message']);return _0x13bf7b(_0x216897[_0x7431('0x17')][_0x7431('0x18')]);}logger[_0x7431('0x17')]('MailAccount,\x20%s,\x20%s',_0xccbaee,_0x216897[_0x7431('0x17')]['message']);return _0x9a8b79(_0x216897['error']['message']);}else{logger[_0x7431('0x11')](_0x7431('0x12'),_0xccbaee,_0x7431('0x13'));_0x9a8b79(_0x216897[_0x7431('0x19')]['message']);}})['catch'](function(_0x167238){logger[_0x7431('0x17')](_0x7431('0x12'),_0xccbaee,_0x167238);_0x13bf7b(_0x167238);});});}exports[_0x7431('0x1a')]=function(_0x1e7fdf){var _0x409c6c=this;return new Promise(function(_0x488e1a,_0x563c0a){return db['MailAccount'][_0x7431('0x1b')]({'raw':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf['options'][_0x7431('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')]['where']||null:null,'attributes':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x1e')]||null:null,'limit':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf['options'][_0x7431('0x1f')]||null:null,'include':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x20')]?_[_0x7431('0x21')](_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x20')],function(_0x183e53){return{'model':db[_0x183e53[_0x7431('0x22')]],'as':_0x183e53['as'],'attributes':_0x183e53[_0x7431('0x1e')],'include':_0x183e53[_0x7431('0x20')]?_[_0x7431('0x21')](_0x183e53['include'],function(_0x43116e){return{'model':db[_0x43116e['model']],'as':_0x43116e['as'],'attributes':_0x43116e['attributes'],'include':_0x43116e[_0x7431('0x20')]?_[_0x7431('0x21')](_0x43116e['include'],function(_0x3052fc){return{'model':db[_0x3052fc[_0x7431('0x22')]],'as':_0x3052fc['as'],'attributes':_0x3052fc[_0x7431('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7431('0x10')](function(_0x30e63f){logger[_0x7431('0x11')](_0x7431('0x1a'),_0x1e7fdf);logger[_0x7431('0x14')](_0x7431('0x1a'),_0x1e7fdf,JSON[_0x7431('0x16')](_0x30e63f));_0x488e1a(_0x30e63f);})[_0x7431('0x23')](function(_0xa63228){logger['error'](_0x7431('0x1a'),_0xa63228[_0x7431('0x18')],_0x1e7fdf);_0x563c0a(_0x409c6c[_0x7431('0x17')](0x1f4,_0xa63228[_0x7431('0x18')]));});});};exports['ShowMailAccount']=function(_0x2e3d64){var _0x27d324=this;return new Promise(function(_0x3e3fe6,_0x516dc1){return db['MailAccount'][_0x7431('0x24')]({'raw':_0x2e3d64['options']?_0x2e3d64['options'][_0x7431('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x25')]||null:null,'attributes':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x1e')]||null:null,'include':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x20')]?_[_0x7431('0x21')](_0x2e3d64[_0x7431('0x1c')][_0x7431('0x20')],function(_0x4d2be3){return{'model':db[_0x4d2be3[_0x7431('0x22')]],'as':_0x4d2be3['as'],'attributes':_0x4d2be3['attributes'],'include':_0x4d2be3[_0x7431('0x20')]?_[_0x7431('0x21')](_0x4d2be3[_0x7431('0x20')],function(_0x524de5){return{'model':db[_0x524de5[_0x7431('0x22')]],'as':_0x524de5['as'],'attributes':_0x524de5[_0x7431('0x1e')],'include':_0x524de5[_0x7431('0x20')]?_[_0x7431('0x21')](_0x524de5[_0x7431('0x20')],function(_0x316e0c){return{'model':db[_0x316e0c[_0x7431('0x22')]],'as':_0x316e0c['as'],'attributes':_0x316e0c[_0x7431('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7431('0x10')](function(_0xfde13f){if(_0x2e3d64[_0x7431('0x1c')][_0x7431('0x26')]===!![])_0xfde13f[_0x7431('0x27')]('smtpOptions',_0xfde13f['getSmtpOptions']());logger[_0x7431('0x11')](_0x7431('0x28'),_0x2e3d64);logger['debug']('ShowMailAccount',_0x2e3d64,JSON[_0x7431('0x16')](_0xfde13f));_0x3e3fe6(_0xfde13f);})[_0x7431('0x23')](function(_0x273bb8){logger[_0x7431('0x17')](_0x7431('0x28'),_0x273bb8[_0x7431('0x18')],_0x2e3d64);_0x516dc1(_0x27d324['error'](0x1f4,_0x273bb8['message']));});});};exports[_0x7431('0x29')]=function(_0x4330e5){var _0x13d903=this;return new Promise(function(_0x53dba5,_0x4fe1d7){var _0x178fc6={'body':_0x4330e5[_0x7431('0x2a')],'channel':_0x7431('0x2b')};var _0x12feb1=_['difference'](_[_0x7431('0x2c')](db['CmContact'][_0x7431('0x2d')]),[_0x7431('0x2e'),'updatedAt',_0x7431('0x2f'),_0x7431('0x30')]);var _0x32589c=![];if(_0x4330e5['body']['id']){delete _0x4330e5[_0x7431('0x2a')]['id'];}if(_[_0x7431('0x31')](_0x4330e5['body'][_0x7431('0x32')])){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x33')));}if(_[_0x7431('0x31')](_0x4330e5['body'][_0x7431('0x2a')])||_0x4330e5['body']['body']===''){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x34')));}if(_[_0x7431('0x31')](_0x4330e5['body']['mapKey'])){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x35')+_0x12feb1));}if(!_['includes'](_0x12feb1,_0x4330e5[_0x7431('0x2a')][_0x7431('0x36')])){return _0x4fe1d7(_0x13d903['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12feb1));}var _0x119608={};_0x119608[_0x4330e5['body'][_0x7431('0x36')]]=_0x4330e5[_0x7431('0x2a')][_0x7431('0x32')];return db['MailAccount'][_0x7431('0x24')]({'where':{'id':_0x4330e5['account']['id']},'include':[{'model':db[_0x7431('0x37')],'as':_0x7431('0x38'),'include':[{'model':db[_0x7431('0x39')],'as':_0x7431('0x3a'),'where':_0x119608,'limit':0x1,'order':[[_0x7431('0x3b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7431('0x3c')},{'model':db[_0x7431('0x3d')],'as':_0x7431('0x3e'),'include':[{'model':db[_0x7431('0x3f')],'as':_0x7431('0x3f')}]}]})[_0x7431('0x10')](function(_0x6f7b4){if(_0x6f7b4&&_0x6f7b4['List']){var _0x43ebe4=_0x6f7b4[_0x7431('0x40')]({'plain':!![]});_0x178fc6[_0x7431('0x41')]=_[_0x7431('0x42')](_0x43ebe4,[_0x7431('0x3c'),'List']);_0x178fc6[_0x7431('0x41')]['smtpOptions']=_0x6f7b4['getSmtpOptions']();_0x178fc6[_0x7431('0x43')]=_0x43ebe4[_0x7431('0x3c')];_0x178fc6[_0x7431('0x44')]=_0x43ebe4[_0x7431('0x38')];_0x178fc6[_0x7431('0x43')]=_[_0x7431('0x45')](_0x178fc6['applications'],[_0x7431('0x46')],[_0x7431('0x47')]);if(_0x178fc6['account']&&_0x178fc6[_0x7431('0x41')][_0x7431('0x48')]){_0x178fc6[_0x7431('0x43')][_0x7431('0x49')]({'id':0x0,'priority':_0x178fc6['applications'][_0x7431('0x4a')]+0x1,'app':'close','appdata':'autoclose','interval':_0x7431('0x4b')});}if(_0x178fc6[_0x7431('0x41')][_0x7431('0x3c')]){delete _0x178fc6[_0x7431('0x41')][_0x7431('0x3c')];}if(_0x178fc6[_0x7431('0x41')][_0x7431('0x38')]){delete _0x178fc6['account'][_0x7431('0x38')];}if(_0x43ebe4[_0x7431('0x38')]['Contacts'][_0x7431('0x4a')]){return _0x43ebe4[_0x7431('0x38')]['Contacts'][0x0];}var _0x840001=_[_0x7431('0x9')](_0x4330e5[_0x7431('0x2a')],{'firstName':_0x4330e5['body']['from'],'ListId':_0x43ebe4[_0x7431('0x30')]});_0x840001[_0x4330e5[_0x7431('0x2a')][_0x7431('0x36')]]=_0x4330e5['body'][_0x7431('0x32')];return db[_0x7431('0x39')][_0x7431('0x4c')](_0x840001);}else{throw new Error(_0x7431('0x4d'));}})[_0x7431('0x10')](function(_0x39e2aa){_0x178fc6['contact']=_0x39e2aa;if(_0x39e2aa){if(!_0x4330e5['body'][_0x7431('0x18')]['messageId']){_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['messageId']=rs[_0x7431('0x4e')]()+'\x20'+_0x4330e5[_0x7431('0x2a')]['message']['from'];}var _0x12cb28={'ContactId':_0x39e2aa['id'],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id'],'inReplyTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'to':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x32')],'cc':_0x4330e5['body']['message']['cc'],'subject':_0x4330e5['body']['message'][_0x7431('0x50')],'attach':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['attach'],'lastMsgAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgDirection':'in'};return db[_0x7431('0x53')][_0x7431('0x24')]({'where':{'closed':![],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id']},'include':[{'model':db[_0x7431('0x54')],'as':_0x7431('0x55'),'attributes':[_0x7431('0x4f')],'where':{'messageId':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x56')]}}]})['then'](function(_0x5db955){if(_0x5db955){return[_0x5db955,![]];}return db['MailInteraction'][_0x7431('0x4c')](_0x12cb28)[_0x7431('0x10')](function(_0x52b2e8){return[_0x52b2e8,!![]];});});}else{throw new Error(_0x7431('0x57'));}})[_0x7431('0x58')](function(_0x3d26be,_0x5109ee){if(_0x3d26be){_0x32589c=_0x5109ee;if(!_0x5109ee){return _0x3d26be[_0x7431('0x59')]({'inReplyTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'to':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['from'],'cc':_0x4330e5[_0x7431('0x2a')]['message']['cc'],'subject':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x50')],'attach':_0x3d26be[_0x7431('0x5a')]?_0x3d26be['attach']:_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5a')],'substatus':null,'substatusAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgDirection':'in'});}else{return _0x3d26be;}}})[_0x7431('0x10')](function(_0x2f24f1){_0x178fc6[_0x7431('0x5b')]=_0x2f24f1[_0x7431('0x40')]({'plain':!![]});_0x178fc6[_0x7431('0x5b')][_0x7431('0x5c')]=_0x32589c;return db[_0x7431('0x54')][_0x7431('0x4c')]({'body':_0x4330e5[_0x7431('0x2a')][_0x7431('0x2a')],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id'],'MailInteractionId':_0x2f24f1['id'],'direction':'in','ContactId':_0x178fc6[_0x7431('0x5d')]['id'],'messageId':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'from':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x32')],'to':_0x4330e5['body'][_0x7431('0x18')]['to'],'cc':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['cc'],'subject':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x50')],'attach':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5a')],'Attachments':_0x4330e5[_0x7431('0x2a')]['message'][_0x7431('0x5e')],'originTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5f')],'originCc':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x60')],'bcc':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x61')],'ChatWebsiteId':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x62')]||null,'originChannel':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x63')]||_0x7431('0x64'),'ChatOfflineMessageId':_0x4330e5[_0x7431('0x2a')]['message'][_0x7431('0x65')]||null},{'include':[{'model':db[_0x7431('0x66')],'as':_0x7431('0x67')}]});})['then'](function(_0x25695b){_0x178fc6[_0x7431('0x18')]=_0x25695b;if(!_0x178fc6[_0x7431('0x5b')][_0x7431('0x68')]){return;}return db[_0x7431('0x69')][_0x7431('0x24')]({'attributes':['id',_0x7431('0x6a')],'where':{'id':_0x178fc6['interaction'][_0x7431('0x68')]}});})[_0x7431('0x10')](function(_0x3071bb){if(_0x3071bb){_0x178fc6[_0x7431('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7431('0x6b'),'appdata':_0x3071bb[_0x7431('0x6a')]+','+(_0x178fc6['account'][_0x7431('0x6c')]||0xa),'interval':_0x7431('0x4b')});}if(!_0x178fc6[_0x7431('0x5b')][_0x7431('0x6d')]){return;}return db[_0x7431('0x6e')][_0x7431('0x24')]({'attributes':['id',_0x7431('0x6a')],'where':{'id':_0x178fc6[_0x7431('0x5b')][_0x7431('0x6d')]}});})[_0x7431('0x10')](function(_0x4f9001){if(_0x4f9001){_0x178fc6[_0x7431('0x43')][_0x7431('0x6f')]({'id':0x0,'priority':0x1,'app':_0x7431('0x70'),'appdata':_0x4f9001['name']+','+(_0x178fc6[_0x7431('0x41')][_0x7431('0x71')]||0x12c),'interval':_0x7431('0x4b')});}return respondWithRpcPromise('Start',_0x7431('0x72'),_0x178fc6);})[_0x7431('0x10')](function(_0x39ce1b){_0x53dba5(_0x39ce1b);})[_0x7431('0x23')](function(_0x10d474){_0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x10d474[_0x7431('0x18')]));});});}; \ No newline at end of file +var _0xce50=['subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','applications','list','priority','asc','account','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate'];(function(_0x3b363c,_0x3aef2d){var _0x20095a=function(_0x59b6a5){while(--_0x59b6a5){_0x3b363c['push'](_0x3b363c['shift']());}};_0x20095a(++_0x3aef2d);}(_0xce50,0x1d8));var _0x0ce5=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xce50[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var moment=require(_0x0ce5('0x0'));var BPromise=require(_0x0ce5('0x1'));var rs=require(_0x0ce5('0x2'));var Redis=require(_0x0ce5('0x3'));var db=require(_0x0ce5('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x0ce5('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ce5('0x6')]({'port':0x232c});config[_0x0ce5('0x7')]=_[_0x0ce5('0x8')](config[_0x0ce5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ce5('0x9'))(new Redis(config[_0x0ce5('0x7')]));require('./mailAccount.socket')[_0x0ce5('0xa')](socket);function respondWithRpcPromise(_0x55639f,_0x4475c9,_0x4ecdce){return new BPromise(function(_0x3ed31c,_0x28ff19){return client['request'](_0x55639f,_0x4ecdce)[_0x0ce5('0xb')](function(_0x2b5559){logger[_0x0ce5('0xc')](_0x0ce5('0xd'),_0x4475c9,_0x0ce5('0xe'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4475c9,'request\x20sent',JSON[_0x0ce5('0xf')](_0x2b5559));if(_0x2b5559[_0x0ce5('0x10')]){if(_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x11')]===0x1f4){logger['error'](_0x0ce5('0xd'),_0x4475c9,_0x2b5559[_0x0ce5('0x10')]['message']);return _0x28ff19(_0x2b5559[_0x0ce5('0x10')]['message']);}logger[_0x0ce5('0x10')](_0x0ce5('0xd'),_0x4475c9,_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x12')]);return _0x3ed31c(_0x2b5559[_0x0ce5('0x10')][_0x0ce5('0x12')]);}else{logger[_0x0ce5('0xc')](_0x0ce5('0xd'),_0x4475c9,'request\x20sent');_0x3ed31c(_0x2b5559[_0x0ce5('0x13')][_0x0ce5('0x12')]);}})['catch'](function(_0x4f5e0b){logger[_0x0ce5('0x10')]('MailAccount,\x20%s,\x20%s',_0x4475c9,_0x4f5e0b);_0x28ff19(_0x4f5e0b);});});}exports[_0x0ce5('0x14')]=function(_0x477451){var _0x451b39=this;return new Promise(function(_0x4485e1,_0x41ef17){return db[_0x0ce5('0x15')]['findAll']({'raw':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x477451[_0x0ce5('0x16')]?_0x477451['options'][_0x0ce5('0x18')]||null:null,'attributes':_0x477451['options']?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x19')]||null:null,'limit':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x1a')]||null:null,'include':_0x477451[_0x0ce5('0x16')]?_0x477451[_0x0ce5('0x16')][_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x477451[_0x0ce5('0x16')]['include'],function(_0x5392a4){return{'model':db[_0x5392a4[_0x0ce5('0x1d')]],'as':_0x5392a4['as'],'attributes':_0x5392a4['attributes'],'include':_0x5392a4['include']?_[_0x0ce5('0x1c')](_0x5392a4['include'],function(_0x2c7414){return{'model':db[_0x2c7414[_0x0ce5('0x1d')]],'as':_0x2c7414['as'],'attributes':_0x2c7414['attributes'],'include':_0x2c7414['include']?_[_0x0ce5('0x1c')](_0x2c7414[_0x0ce5('0x1b')],function(_0x565295){return{'model':db[_0x565295[_0x0ce5('0x1d')]],'as':_0x565295['as'],'attributes':_0x565295[_0x0ce5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0ce5('0xb')](function(_0x54a385){logger['info'](_0x0ce5('0x14'),_0x477451);logger[_0x0ce5('0x1e')](_0x0ce5('0x14'),_0x477451,JSON[_0x0ce5('0xf')](_0x54a385));_0x4485e1(_0x54a385);})[_0x0ce5('0x1f')](function(_0x44dabc){logger[_0x0ce5('0x10')](_0x0ce5('0x14'),_0x44dabc[_0x0ce5('0x12')],_0x477451);_0x41ef17(_0x451b39[_0x0ce5('0x10')](0x1f4,_0x44dabc[_0x0ce5('0x12')]));});});};exports[_0x0ce5('0x20')]=function(_0x3c7d4d){var _0xfef4a3=this;return new Promise(function(_0x733d8a,_0x143960){return db[_0x0ce5('0x15')][_0x0ce5('0x21')]({'raw':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d['options'][_0x0ce5('0x18')]||null:null,'attributes':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')]['attributes']||null:null,'include':_0x3c7d4d[_0x0ce5('0x16')]?_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x3c7d4d['options'][_0x0ce5('0x1b')],function(_0x298f92){return{'model':db[_0x298f92[_0x0ce5('0x1d')]],'as':_0x298f92['as'],'attributes':_0x298f92[_0x0ce5('0x19')],'include':_0x298f92[_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x298f92[_0x0ce5('0x1b')],function(_0x22bc73){return{'model':db[_0x22bc73[_0x0ce5('0x1d')]],'as':_0x22bc73['as'],'attributes':_0x22bc73[_0x0ce5('0x19')],'include':_0x22bc73[_0x0ce5('0x1b')]?_[_0x0ce5('0x1c')](_0x22bc73['include'],function(_0x13d73e){return{'model':db[_0x13d73e[_0x0ce5('0x1d')]],'as':_0x13d73e['as'],'attributes':_0x13d73e[_0x0ce5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15cbde){if(_0x3c7d4d[_0x0ce5('0x16')][_0x0ce5('0x22')]===!![])_0x15cbde[_0x0ce5('0x23')]('smtpOptions',_0x15cbde[_0x0ce5('0x24')]());logger['info'](_0x0ce5('0x20'),_0x3c7d4d);logger['debug']('ShowMailAccount',_0x3c7d4d,JSON[_0x0ce5('0xf')](_0x15cbde));_0x733d8a(_0x15cbde);})[_0x0ce5('0x1f')](function(_0x6e5145){logger['error'](_0x0ce5('0x20'),_0x6e5145[_0x0ce5('0x12')],_0x3c7d4d);_0x143960(_0xfef4a3[_0x0ce5('0x10')](0x1f4,_0x6e5145[_0x0ce5('0x12')]));});});};exports['NotifyMailAccount']=function(_0x140bbe){var _0x245414=this;return new Promise(function(_0x238f52,_0xb520a7){var _0x3952c6={'body':_0x140bbe[_0x0ce5('0x25')],'channel':'mail'};var _0x29f290=_[_0x0ce5('0x26')](_[_0x0ce5('0x27')](db[_0x0ce5('0x28')][_0x0ce5('0x29')]),[_0x0ce5('0x2a'),_0x0ce5('0x2b'),_0x0ce5('0x2c'),_0x0ce5('0x2d')]);var _0x48ebfc=![];if(_0x140bbe['body']['id']){delete _0x140bbe[_0x0ce5('0x25')]['id'];}if(_[_0x0ce5('0x2e')](_0x140bbe['body']['from'])){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x2f')));}if(_[_0x0ce5('0x2e')](_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x25')])||_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x25')]===''){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x30')));}if(_[_0x0ce5('0x2e')](_0x140bbe['body']['mapKey'])){return _0xb520a7(_0x245414['error'](0x1f4,_0x0ce5('0x31')+_0x29f290));}if(!_[_0x0ce5('0x32')](_0x29f290,_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')])){return _0xb520a7(_0x245414[_0x0ce5('0x10')](0x1f4,_0x0ce5('0x34')+_0x29f290));}var _0x525c20={};_0x525c20[_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')]]=_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')];return db['MailAccount'][_0x0ce5('0x21')]({'where':{'id':_0x140bbe['account']['id']},'include':[{'model':db['CmList'],'as':_0x0ce5('0x36'),'include':[{'model':db[_0x0ce5('0x28')],'as':_0x0ce5('0x37'),'where':_0x525c20,'limit':0x1,'order':[[_0x0ce5('0x2b'),_0x0ce5('0x38')]]}]},{'model':db[_0x0ce5('0x39')],'as':_0x0ce5('0x3a')},{'model':db[_0x0ce5('0x3b')],'as':_0x0ce5('0x3c'),'include':[{'model':db[_0x0ce5('0x3d')],'as':_0x0ce5('0x3d')}]}]})[_0x0ce5('0xb')](function(_0x5629f4){if(_0x5629f4&&_0x5629f4[_0x0ce5('0x36')]){var _0x57a64a=_0x5629f4[_0x0ce5('0x3e')]({'plain':!![]});_0x3952c6['account']=_['omit'](_0x57a64a,['Applications',_0x0ce5('0x36')]);_0x3952c6['account']['smtpOptions']=_0x5629f4['getSmtpOptions']();_0x3952c6[_0x0ce5('0x3f')]=_0x57a64a[_0x0ce5('0x3a')];_0x3952c6[_0x0ce5('0x40')]=_0x57a64a[_0x0ce5('0x36')];_0x3952c6['applications']=_['orderBy'](_0x3952c6[_0x0ce5('0x3f')],[_0x0ce5('0x41')],[_0x0ce5('0x42')]);if(_0x3952c6[_0x0ce5('0x43')]&&_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x44')]){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x45')]({'id':0x0,'priority':_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x46')]+0x1,'app':_0x0ce5('0x47'),'appdata':_0x0ce5('0x44'),'interval':_0x0ce5('0x48')});}if(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x3a')]){delete _0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x3a')];}if(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x36')]){delete _0x3952c6['account'][_0x0ce5('0x36')];}if(_0x57a64a['List'][_0x0ce5('0x37')][_0x0ce5('0x46')]){return _0x57a64a[_0x0ce5('0x36')][_0x0ce5('0x37')][0x0];}var _0x3010ea=_[_0x0ce5('0x8')](_0x140bbe[_0x0ce5('0x25')],{'firstName':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')],'ListId':_0x57a64a[_0x0ce5('0x2d')]});_0x3010ea[_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x33')]]=_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x35')];return db[_0x0ce5('0x28')][_0x0ce5('0x49')](_0x3010ea);}else{throw new Error(_0x0ce5('0x4a'));}})[_0x0ce5('0xb')](function(_0x1f0a7f){_0x3952c6[_0x0ce5('0x4b')]=_0x1f0a7f;if(_0x1f0a7f){if(!_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')]){_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')]=rs[_0x0ce5('0x4d')]()+'\x20'+_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x35')];}var _0x579300={'ContactId':_0x1f0a7f['id'],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id'],'inReplyTo':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4c')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['from'],'cc':_0x140bbe['body']['message']['cc'],'subject':_0x140bbe['body']['message'][_0x0ce5('0x4e')],'attach':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4f')],'lastMsgAt':moment()[_0x0ce5('0x50')](_0x0ce5('0x51')),'lastMsgDirection':'in'};return db[_0x0ce5('0x52')][_0x0ce5('0x21')]({'where':{'closed':![],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id']},'include':[{'model':db[_0x0ce5('0x53')],'as':_0x0ce5('0x54'),'attributes':[_0x0ce5('0x4c')],'where':{'messageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x55')]}}]})['then'](function(_0x270d22){if(_0x270d22){return[_0x270d22,![]];}return db[_0x0ce5('0x52')][_0x0ce5('0x49')](_0x579300)[_0x0ce5('0xb')](function(_0x2b3349){return[_0x2b3349,!![]];});});}else{throw new Error(_0x0ce5('0x56'));}})[_0x0ce5('0x57')](function(_0x1122ea,_0x199e57){if(_0x1122ea){_0x48ebfc=_0x199e57;if(!_0x199e57){return _0x1122ea[_0x0ce5('0x58')]({'inReplyTo':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x4c')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x35')],'cc':_0x140bbe[_0x0ce5('0x25')]['message']['cc'],'subject':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x4e')],'attach':_0x1122ea[_0x0ce5('0x4f')]?_0x1122ea[_0x0ce5('0x4f')]:_0x140bbe[_0x0ce5('0x25')]['message'][_0x0ce5('0x4f')],'substatus':null,'substatusAt':moment()[_0x0ce5('0x50')](_0x0ce5('0x51')),'lastMsgAt':moment()['format'](_0x0ce5('0x51')),'lastMsgDirection':'in'});}else{return _0x1122ea;}}})[_0x0ce5('0xb')](function(_0x4f9e6c){_0x3952c6[_0x0ce5('0x59')]=_0x4f9e6c[_0x0ce5('0x3e')]({'plain':!![]});_0x3952c6['interaction'][_0x0ce5('0x5a')]=_0x48ebfc;return db[_0x0ce5('0x53')][_0x0ce5('0x49')]({'body':_0x140bbe[_0x0ce5('0x25')]['body'],'MailAccountId':_0x140bbe[_0x0ce5('0x43')]['id'],'MailInteractionId':_0x4f9e6c['id'],'direction':'in','ContactId':_0x3952c6[_0x0ce5('0x4b')]['id'],'messageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x4c')],'from':_0x140bbe['body']['message'][_0x0ce5('0x35')],'to':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['to'],'cc':_0x140bbe['body'][_0x0ce5('0x12')]['cc'],'subject':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['subject'],'attach':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['attach'],'Attachments':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')]['attachments'],'originTo':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5b')],'originCc':_0x140bbe[_0x0ce5('0x25')]['message'][_0x0ce5('0x5c')],'bcc':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5d')],'ChatWebsiteId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x5e')]||null,'originChannel':_0x140bbe[_0x0ce5('0x25')][_0x0ce5('0x12')][_0x0ce5('0x5f')]||'Email','ChatOfflineMessageId':_0x140bbe['body'][_0x0ce5('0x12')][_0x0ce5('0x60')]||null},{'include':[{'model':db[_0x0ce5('0x61')],'as':'Attachments'}]});})[_0x0ce5('0xb')](function(_0x424884){_0x3952c6[_0x0ce5('0x12')]=_0x424884;if(!_0x3952c6[_0x0ce5('0x59')][_0x0ce5('0x62')]){return;}return db[_0x0ce5('0x63')][_0x0ce5('0x21')]({'attributes':['id',_0x0ce5('0x64')],'where':{'id':_0x3952c6['interaction'][_0x0ce5('0x62')]}});})[_0x0ce5('0xb')](function(_0x37a2ae){if(_0x37a2ae){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x65')]({'id':0x0,'priority':0x0,'app':_0x0ce5('0x66'),'appdata':_0x37a2ae[_0x0ce5('0x64')]+','+(_0x3952c6['account'][_0x0ce5('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x3952c6['interaction'][_0x0ce5('0x68')]){return;}return db[_0x0ce5('0x69')][_0x0ce5('0x21')]({'attributes':['id','name'],'where':{'id':_0x3952c6[_0x0ce5('0x59')][_0x0ce5('0x68')]}});})[_0x0ce5('0xb')](function(_0xe8a509){if(_0xe8a509){_0x3952c6[_0x0ce5('0x3f')][_0x0ce5('0x65')]({'id':0x0,'priority':0x1,'app':_0x0ce5('0x6a'),'appdata':_0xe8a509[_0x0ce5('0x64')]+','+(_0x3952c6[_0x0ce5('0x43')][_0x0ce5('0x6b')]||0x12c),'interval':_0x0ce5('0x48')});}return respondWithRpcPromise(_0x0ce5('0x6c'),_0x0ce5('0x6d'),_0x3952c6);})[_0x0ce5('0xb')](function(_0x262151){_0x238f52(_0x262151);})['catch'](function(_0x2ac36a){_0xb520a7(_0x245414['error'](0x1f4,_0x2ac36a[_0x0ce5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 15327fb..fef0e8c 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 _0x7497=['./mailAccount.events','save','remove','emit','removeListener','register','length','mailAccount:'];(function(_0x4f93fd,_0x354b8b){var _0x4f0e04=function(_0x47fce8){while(--_0x47fce8){_0x4f93fd['push'](_0x4f93fd['shift']());}};_0x4f0e04(++_0x354b8b);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x7749('0x0'));var events=[_0x7749('0x1'),_0x7749('0x2'),'update'];function createListener(_0x4c75af,_0x5e36cc){return function(_0x4000cf){_0x5e36cc[_0x7749('0x3')](_0x4c75af,_0x4000cf);};}function removeListener(_0x5d360f,_0x1f0553){return function(){MailAccountEvents[_0x7749('0x4')](_0x5d360f,_0x1f0553);};}exports[_0x7749('0x5')]=function(_0x455d05){for(var _0x289268=0x0,_0x29f84f=events[_0x7749('0x6')];_0x289268<_0x29f84f;_0x289268++){var _0x344fa8=events[_0x289268];var _0x38dd37=createListener(_0x7749('0x7')+_0x344fa8,_0x455d05);MailAccountEvents['on'](_0x344fa8,_0x38dd37);}}; \ No newline at end of file +var _0x9977=['register','mailAccount:','save','remove','update','removeListener'];(function(_0x5aff33,_0x397804){var _0x49bd0b=function(_0x35bd24){while(--_0x35bd24){_0x5aff33['push'](_0x5aff33['shift']());}};_0x49bd0b(++_0x397804);}(_0x9977,0x9e));var _0x7997=function(_0x11dde4,_0x1d4852){_0x11dde4=_0x11dde4-0x0;var _0x6eea94=_0x9977[_0x11dde4];return _0x6eea94;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7997('0x0'),_0x7997('0x1'),_0x7997('0x2')];function createListener(_0x545e56,_0x106129){return function(_0x4b74d6){_0x106129['emit'](_0x545e56,_0x4b74d6);};}function removeListener(_0x4a580d,_0x47ead9){return function(){MailAccountEvents[_0x7997('0x3')](_0x4a580d,_0x47ead9);};}exports[_0x7997('0x4')]=function(_0x3665ed){for(var _0x545f89=0x0,_0x8ecc17=events['length'];_0x545f89<_0x8ecc17;_0x545f89++){var _0x32f1b6=events[_0x545f89];var _0x582764=createListener(_0x7997('0x5')+_0x32f1b6,_0x3665ed);MailAccountEvents['on'](_0x32f1b6,_0x582764);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1fed054..26780a7 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 _0x4ccb=['delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ccb,0x1af));var _0xb4cc=function(_0x3c2f23,_0x55cfe1){_0x3c2f23=_0x3c2f23-0x0;var _0xd5082d=_0x4ccb[_0x3c2f23];return _0xd5082d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4cc('0x0'));var timeout=require(_0xb4cc('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb4cc('0x2'));var auth=require(_0xb4cc('0x3'));var interaction=require(_0xb4cc('0x4'));var config=require('../../config/environment');var controller=require(_0xb4cc('0x5'));router['get'](_0xb4cc('0x6'),auth[_0xb4cc('0x7')](),controller['show']);router[_0xb4cc('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb4cc('0x9')]('/:id',auth[_0xb4cc('0x7')](),controller[_0xb4cc('0xa')]);module['exports']=router; \ No newline at end of file +var _0x39f1=['express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x10cc81,_0x172700){var _0x3bbe1e=function(_0x319ed2){while(--_0x319ed2){_0x10cc81['push'](_0x10cc81['shift']());}};_0x3bbe1e(++_0x172700);}(_0x39f1,0x193));var _0x139f=function(_0x2c22b5,_0x4e38a2){_0x2c22b5=_0x2c22b5-0x0;var _0x1728eb=_0x39f1[_0x2c22b5];return _0x1728eb;};'use strict';var multer=require(_0x139f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x139f('0x1'));var express=require(_0x139f('0x2'));var router=express[_0x139f('0x3')]();var fs_extra=require(_0x139f('0x4'));var auth=require(_0x139f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x139f('0x6'));router[_0x139f('0x7')]('/:id',auth[_0x139f('0x8')](),controller['show']);router[_0x139f('0x9')](_0x139f('0xa'),auth['isAuthenticated'](),controller[_0x139f('0xb')]);router[_0x139f('0xc')](_0x139f('0xa'),auth[_0x139f('0x8')](),controller[_0x139f('0xd')]);module[_0x139f('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6a39dde..57038a1 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 _0x36c2=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x20ba6f,_0x1543b6){var _0x460576=function(_0x6e03d8){while(--_0x6e03d8){_0x20ba6f['push'](_0x20ba6f['shift']());}};_0x460576(++_0x1543b6);}(_0x36c2,0xab));var _0x236c=function(_0x23a3b9,_0x324589){_0x23a3b9=_0x23a3b9-0x0;var _0x55696c=_0x36c2[_0x23a3b9];return _0x55696c;};'use strict';var Sequelize=require(_0x236c('0x0'));module[_0x236c('0x1')]={'priority':{'type':Sequelize[_0x236c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x236c('0x3')],'allowNull':![],'defaultValue':_0x236c('0x4')},'appdata':{'type':Sequelize[_0x236c('0x5')]()},'description':{'type':Sequelize[_0x236c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x236c('0x6')}}; \ No newline at end of file +var _0x48af=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x23d8cb,_0xb28842){var _0x489878=function(_0x3900ed){while(--_0x3900ed){_0x23d8cb['push'](_0x23d8cb['shift']());}};_0x489878(++_0xb28842);}(_0x48af,0x95));var _0xf48a=function(_0x501932,_0x432837){_0x501932=_0x501932-0x0;var _0x1fe5eb=_0x48af[_0x501932];return _0x1fe5eb;};'use strict';var Sequelize=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'priority':{'type':Sequelize[_0xf48a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf48a('0x3')],'allowNull':![],'defaultValue':_0xf48a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf48a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf48a('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b24a626..15a7ab1 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x2a4b08,_0xd1d8c){var _0x131536=function(_0x57fb95){while(--_0x57fb95){_0x2a4b08['push'](_0x2a4b08['shift']());}};_0x131536(++_0xd1d8c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3cf7da,_0x40ce97){_0x3cf7da=_0x3cf7da-0x0;var _0x1981cf=_0x9bde[_0x3cf7da];return _0x1981cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x1683bb,_0x1526d3){var _0x423bfc=function(_0x148720){while(--_0x148720){_0x1683bb['push'](_0x1683bb['shift']());}};_0x423bfc(++_0x1526d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c9ca791..091e4a0 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 _0xb6a8=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes'];(function(_0x252428,_0x3c50e1){var _0x2d1992=function(_0x4bbeb9){while(--_0x4bbeb9){_0x252428['push'](_0x252428['shift']());}};_0x2d1992(++_0x3c50e1);}(_0xb6a8,0x1d9));var _0x8b6a=function(_0x37c096,_0x206499){_0x37c096=_0x37c096-0x0;var _0x1cdc80=_0xb6a8[_0x37c096];return _0x1cdc80;};'use strict';var _=require(_0x8b6a('0x0'));var util=require('util');var logger=require(_0x8b6a('0x1'))('api');var moment=require(_0x8b6a('0x2'));var BPromise=require(_0x8b6a('0x3'));var rp=require(_0x8b6a('0x4'));var fs=require('fs');var path=require(_0x8b6a('0x5'));var rimraf=require(_0x8b6a('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b6a('0x7'));module['exports']=function(_0x24cae3,_0x1e3fc4){return _0x24cae3[_0x8b6a('0x8')](_0x8b6a('0x9'),attributes,{'tableName':_0x8b6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b6a('0xb'),'collate':_0x8b6a('0xc')});}; \ No newline at end of file +var _0x49fd=['api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','util','../../config/logger'];(function(_0x389e4a,_0x1c1845){var _0x10f663=function(_0x5b89fc){while(--_0x5b89fc){_0x389e4a['push'](_0x389e4a['shift']());}};_0x10f663(++_0x1c1845);}(_0x49fd,0x1e2));var _0xd49f=function(_0x4e77d5,_0x29af90){_0x4e77d5=_0x4e77d5-0x0;var _0x5b711e=_0x49fd[_0x4e77d5];return _0x5b711e;};'use strict';var _=require('lodash');var util=require(_0xd49f('0x0'));var logger=require(_0xd49f('0x1'))(_0xd49f('0x2'));var moment=require(_0xd49f('0x3'));var BPromise=require('bluebird');var rp=require(_0xd49f('0x4'));var fs=require('fs');var path=require(_0xd49f('0x5'));var rimraf=require(_0xd49f('0x6'));var config=require(_0xd49f('0x7'));var attributes=require(_0xd49f('0x8'));module['exports']=function(_0x51a0c6,_0x533f37){return _0x51a0c6['define'](_0xd49f('0x9'),attributes,{'tableName':_0xd49f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 00d55ea..d106fca 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 _0x8c28=['body','options','raw','attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateMailApplication','MailApplication'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0x8c28,0x1c8));var _0x88c2=function(_0x5e2443,_0x18acad){_0x5e2443=_0x5e2443-0x0;var _0x4ccc3d=_0x8c28[_0x5e2443];return _0x4ccc3d;};'use strict';var _=require(_0x88c2('0x0'));var util=require(_0x88c2('0x1'));var moment=require(_0x88c2('0x2'));var BPromise=require(_0x88c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88c2('0x4'));var db=require(_0x88c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c2('0x6'))(_0x88c2('0x7'));var config=require(_0x88c2('0x8'));var jayson=require(_0x88c2('0x9'));var client=jayson[_0x88c2('0xa')][_0x88c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5601f6,_0x66fb6b,_0x1664b5){return new BPromise(function(_0x29b108,_0x31c46f){return client[_0x88c2('0xc')](_0x5601f6,_0x1664b5)[_0x88c2('0xd')](function(_0x350ba6){logger[_0x88c2('0xe')](_0x88c2('0xf'),_0x66fb6b,_0x88c2('0x10'));logger[_0x88c2('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x66fb6b,_0x88c2('0x10'),JSON['stringify'](_0x350ba6));if(_0x350ba6[_0x88c2('0x12')]){if(_0x350ba6[_0x88c2('0x12')][_0x88c2('0x13')]===0x1f4){logger[_0x88c2('0x12')](_0x88c2('0xf'),_0x66fb6b,_0x350ba6['error'][_0x88c2('0x14')]);return _0x31c46f(_0x350ba6[_0x88c2('0x12')]['message']);}logger[_0x88c2('0x12')](_0x88c2('0xf'),_0x66fb6b,_0x350ba6[_0x88c2('0x12')][_0x88c2('0x14')]);return _0x29b108(_0x350ba6[_0x88c2('0x12')][_0x88c2('0x14')]);}else{logger['info'](_0x88c2('0xf'),_0x66fb6b,_0x88c2('0x10'));_0x29b108(_0x350ba6['result'][_0x88c2('0x14')]);}})[_0x88c2('0x15')](function(_0x46f0f4){logger[_0x88c2('0x12')]('MailApplication,\x20%s,\x20%s',_0x66fb6b,_0x46f0f4);_0x31c46f(_0x46f0f4);});});}exports[_0x88c2('0x16')]=function(_0x43943e){var _0x315859=this;return new Promise(function(_0x1f1c39,_0xc1a91a){return db[_0x88c2('0x17')]['update'](_0x43943e[_0x88c2('0x18')],{'raw':_0x43943e[_0x88c2('0x19')]?_0x43943e[_0x88c2('0x19')][_0x88c2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43943e[_0x88c2('0x19')]?_0x43943e[_0x88c2('0x19')]['where']||null:null,'attributes':_0x43943e[_0x88c2('0x19')]?_0x43943e[_0x88c2('0x19')][_0x88c2('0x1b')]||null:null,'limit':_0x43943e[_0x88c2('0x19')]?_0x43943e['options'][_0x88c2('0x1c')]||null:null})[_0x88c2('0xd')](function(_0x203447){logger[_0x88c2('0xe')]('UpdateMailApplication',_0x43943e);logger[_0x88c2('0x11')](_0x88c2('0x16'),_0x43943e,JSON[_0x88c2('0x1d')](_0x203447));_0x1f1c39(_0x203447);})[_0x88c2('0x15')](function(_0x4c8c97){logger[_0x88c2('0x12')]('UpdateMailApplication',_0x4c8c97[_0x88c2('0x14')],_0x43943e);_0xc1a91a(_0x315859[_0x88c2('0x12')](0x1f4,_0x4c8c97[_0x88c2('0x14')]));});});}; \ No newline at end of file +var _0x0132=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','MailApplication','update','body','options','raw','limit','then','UpdateMailApplication','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0132,0xfc));var _0x2013=function(_0x27627f,_0x5ce92f){_0x27627f=_0x27627f-0x0;var _0x3778bb=_0x0132[_0x27627f];return _0x3778bb;};'use strict';var _=require('lodash');var util=require(_0x2013('0x0'));var moment=require(_0x2013('0x1'));var BPromise=require('bluebird');var rs=require(_0x2013('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2013('0x3'))['db'];var utils=require(_0x2013('0x4'));var logger=require(_0x2013('0x5'))('rpc');var config=require(_0x2013('0x6'));var jayson=require(_0x2013('0x7'));var client=jayson['client'][_0x2013('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25c40d,_0x58d147,_0x59a245){return new BPromise(function(_0xc08138,_0x49103b){return client[_0x2013('0x9')](_0x25c40d,_0x59a245)['then'](function(_0x5a1e35){logger[_0x2013('0xa')](_0x2013('0xb'),_0x58d147,'request\x20sent');logger['debug'](_0x2013('0xc'),_0x58d147,'request\x20sent',JSON[_0x2013('0xd')](_0x5a1e35));if(_0x5a1e35[_0x2013('0xe')]){if(_0x5a1e35[_0x2013('0xe')][_0x2013('0xf')]===0x1f4){logger[_0x2013('0xe')](_0x2013('0xb'),_0x58d147,_0x5a1e35['error']['message']);return _0x49103b(_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);}logger[_0x2013('0xe')](_0x2013('0xb'),_0x58d147,_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);return _0xc08138(_0x5a1e35[_0x2013('0xe')][_0x2013('0x10')]);}else{logger[_0x2013('0xa')](_0x2013('0xb'),_0x58d147,_0x2013('0x11'));_0xc08138(_0x5a1e35[_0x2013('0x12')][_0x2013('0x10')]);}})['catch'](function(_0x2efff6){logger[_0x2013('0xe')]('MailApplication,\x20%s,\x20%s',_0x58d147,_0x2efff6);_0x49103b(_0x2efff6);});});}exports['UpdateMailApplication']=function(_0x49a36b){var _0x3f25b0=this;return new Promise(function(_0x2c3e4e,_0x8a9de0){return db[_0x2013('0x13')][_0x2013('0x14')](_0x49a36b[_0x2013('0x15')],{'raw':_0x49a36b['options']?_0x49a36b[_0x2013('0x16')][_0x2013('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49a36b[_0x2013('0x16')]?_0x49a36b['options']['where']||null:null,'attributes':_0x49a36b[_0x2013('0x16')]?_0x49a36b[_0x2013('0x16')]['attributes']||null:null,'limit':_0x49a36b[_0x2013('0x16')]?_0x49a36b[_0x2013('0x16')][_0x2013('0x18')]||null:null})[_0x2013('0x19')](function(_0x360255){logger[_0x2013('0xa')]('UpdateMailApplication',_0x49a36b);logger['debug'](_0x2013('0x1a'),_0x49a36b,JSON['stringify'](_0x360255));_0x2c3e4e(_0x360255);})[_0x2013('0x1b')](function(_0x29ba11){logger['error'](_0x2013('0x1a'),_0x29ba11['message'],_0x49a36b);_0x8a9de0(_0x3f25b0['error'](0x1f4,_0x29ba11[_0x2013('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 560a21c..2d2731e 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 _0x09a3=['addMessage','/:id/tags','mailinteraction:addtags','tracked','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','exports','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x09a3,0x1e5));var _0x309a=function(_0x34a9bb,_0x48f74c){_0x34a9bb=_0x34a9bb-0x0;var _0x33943f=_0x09a3[_0x34a9bb];return _0x33943f;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x309a('0x0'));var controller=require(_0x309a('0x1'));router['get']('/',auth[_0x309a('0x2')](),controller[_0x309a('0x3')]);router[_0x309a('0x4')](_0x309a('0x5'),auth[_0x309a('0x2')](),controller[_0x309a('0x6')]);router[_0x309a('0x4')](_0x309a('0x7'),auth['isAuthenticated'](),controller[_0x309a('0x8')]);router[_0x309a('0x4')](_0x309a('0x9'),auth[_0x309a('0x2')](),controller[_0x309a('0xa')]);router['get'](_0x309a('0xb'),auth['isAuthenticated'](),controller[_0x309a('0xc')]);router[_0x309a('0xd')]('/',auth[_0x309a('0x2')](),controller[_0x309a('0xe')]);router[_0x309a('0xd')](_0x309a('0x9'),auth[_0x309a('0x2')](),controller[_0x309a('0xf')]);router[_0x309a('0xd')](_0x309a('0x10'),auth[_0x309a('0x2')](),interaction['tracked']('mail',_0x309a('0x11')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x309a('0x12')](_0x309a('0x13'),_0x309a('0x14')),controller[_0x309a('0x15')]);router['delete']('/:id',auth[_0x309a('0x2')](),interaction['tracked']('mail',_0x309a('0x16')),controller[_0x309a('0x17')]);router['delete']('/:id/tags',auth[_0x309a('0x2')](),controller['removeTags']);module[_0x309a('0x18')]=router; \ No newline at end of file +var _0x951d=['./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x951d,0xf0));var _0xd951=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0x951d[_0x15ee41];return _0x2b2846;};'use strict';var express=require(_0xd951('0x0'));var router=express[_0xd951('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xd951('0x2'));var controller=require(_0xd951('0x3'));router[_0xd951('0x4')]('/',auth[_0xd951('0x5')](),controller[_0xd951('0x6')]);router[_0xd951('0x4')](_0xd951('0x7'),auth[_0xd951('0x5')](),controller['describe']);router[_0xd951('0x4')](_0xd951('0x8'),auth[_0xd951('0x5')](),controller['show']);router[_0xd951('0x4')](_0xd951('0x9'),auth[_0xd951('0x5')](),controller[_0xd951('0xa')]);router['get'](_0xd951('0xb'),auth['isAuthenticated'](),controller[_0xd951('0xc')]);router[_0xd951('0xd')]('/',auth[_0xd951('0x5')](),controller['create']);router['post'](_0xd951('0x9'),auth[_0xd951('0x5')](),controller[_0xd951('0xe')]);router['post'](_0xd951('0xf'),auth[_0xd951('0x5')](),interaction['tracked'](_0xd951('0x10'),_0xd951('0x11')),controller[_0xd951('0x12')]);router[_0xd951('0x13')](_0xd951('0x8'),auth[_0xd951('0x5')](),interaction[_0xd951('0x14')](_0xd951('0x10'),_0xd951('0x15')),controller[_0xd951('0x16')]);router[_0xd951('0x17')]('/:id',auth[_0xd951('0x5')](),interaction[_0xd951('0x14')]('mail','mailinteraction:destroy'),controller[_0xd951('0x18')]);router[_0xd951('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd951('0x19')]);module[_0xd951('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index cf41d44..bcb902b 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 _0x8c8e=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER','sequelize','iconv','exports'];(function(_0x59525c,_0x49d291){var _0x321f6b=function(_0x2228aa){while(--_0x2228aa){_0x59525c['push'](_0x59525c['shift']());}};_0x321f6b(++_0x49d291);}(_0x8c8e,0xcf));var _0xe8c8=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x8c8e[_0x151334];return _0x3d03da;};'use strict';var Sequelize=require(_0xe8c8('0x0'));var iconv=require(_0xe8c8('0x1'));module[_0xe8c8('0x2')]={'closed':{'type':Sequelize[_0xe8c8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe8c8('0x4')]},'disposition':{'type':Sequelize[_0xe8c8('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe8c8('0x5')]},'note':{'type':Sequelize[_0xe8c8('0x5')]},'inReplyTo':{'type':Sequelize[_0xe8c8('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe8c8('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xe8c8('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe8c8('0x4')]},'substatus':{'type':Sequelize[_0xe8c8('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe8c8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe8c8('0x7')]('in',_0xe8c8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe8c8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe8c8('0x7')]('in',_0xe8c8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe8c8('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe8c8('0x9')]}}; \ No newline at end of file +var _0x68f7=['out','sequelize','iconv','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x68f7,0x69));var _0x768f=function(_0x159735,_0x55e04a){_0x159735=_0x159735-0x0;var _0x51f921=_0x68f7[_0x159735];return _0x51f921;};'use strict';var Sequelize=require(_0x768f('0x0'));var iconv=require(_0x768f('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x768f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x768f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x768f('0x3')]},'note':{'type':Sequelize[_0x768f('0x3')]},'inReplyTo':{'type':Sequelize[_0x768f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x768f('0x3')]},'cc':{'type':Sequelize[_0x768f('0x4')](_0x768f('0x5'))},'subject':{'type':Sequelize[_0x768f('0x4')]()},'attach':{'type':Sequelize[_0x768f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x768f('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x768f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x768f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x768f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x768f('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3a54de3..203a053 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 _0x1b33=['where','pick','MailInteractionId','split','format','YYYY-MM-DD\x20HH:mm:ss','true','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','bcc','subject','createdAt','get','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','length','basename','existsSync','build','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','mail','query','user','catch','show','params','model','MailInteraction','keys','intersection','fields','attributes','includeAll','include','merge','options','find','create','update','body','describe','addMessage','MailMessage','ids','filters','nolimit','order','sort'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x1b33,0x9b));var _0x31b3=function(_0x83bf,_0x4b3273){_0x83bf=_0x83bf-0x0;var _0x14a6d3=_0x1b33[_0x83bf];return _0x14a6d3;};'use strict';var emlformat=require(_0x31b3('0x0'));var rimraf=require(_0x31b3('0x1'));var zipdir=require(_0x31b3('0x2'));var moment=require(_0x31b3('0x3'));var BPromise=require(_0x31b3('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x31b3('0x5'));var juice=require('juice');var Redis=require(_0x31b3('0x6'));var interaction=require(_0x31b3('0x7'));var qs=require(_0x31b3('0x8'));var logger=require(_0x31b3('0x9'))(_0x31b3('0xa'));var config=require(_0x31b3('0xb'));var db=require(_0x31b3('0xc'))['db'];var htmlEntities=require(_0x31b3('0xd'));config[_0x31b3('0xe')]=_['defaults'](config[_0x31b3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x31b3('0xf'))(new Redis(config[_0x31b3('0xe')]));require(_0x31b3('0x10'))[_0x31b3('0x11')](socket);function respondWithStatusCode(_0x217149,_0x5b8f1e){_0x5b8f1e=_0x5b8f1e||0xcc;return function(_0x268de8){if(_0x268de8){return _0x217149[_0x31b3('0x12')](_0x5b8f1e);}return _0x217149['status'](_0x5b8f1e)[_0x31b3('0x13')]();};}function respondWithResult(_0x377de7,_0x5918b1){_0x5918b1=_0x5918b1||0xc8;return function(_0xd8b0b3){if(_0xd8b0b3){return _0x377de7[_0x31b3('0x14')](_0x5918b1)[_0x31b3('0x15')](_0xd8b0b3);}};}function respondWithFilteredResult(_0x120563,_0x80ed33){return function(_0x50a7b8){if(_0x50a7b8){var _0xb363d2=typeof _0x80ed33['offset']===_0x31b3('0x16')&&typeof _0x80ed33[_0x31b3('0x17')]===_0x31b3('0x16');var _0x3b8fef=_0x50a7b8['count'];var _0x4d1ee9=_0xb363d2?0x0:_0x80ed33['offset'];var _0x91a281=_0xb363d2?_0x50a7b8[_0x31b3('0x18')]:_0x80ed33[_0x31b3('0x19')]+_0x80ed33[_0x31b3('0x17')];var _0x45bb6a;if(_0x91a281>=_0x3b8fef){_0x91a281=_0x3b8fef;_0x45bb6a=0xc8;}else{_0x45bb6a=0xce;}_0x120563['status'](_0x45bb6a);return _0x120563[_0x31b3('0x1a')](_0x31b3('0x1b'),_0x4d1ee9+'-'+_0x91a281+'/'+_0x3b8fef)[_0x31b3('0x15')](_0x50a7b8);}return null;};}function saveUpdates(_0xf7fba9){return function(_0x2bdecb){if(_0x2bdecb){return _0x2bdecb['update'](_0xf7fba9)['then'](function(_0x430f4e){return _0x430f4e;});}return null;};}function removeEntity(_0x2c7448){return function(_0x5b5b3e){if(_0x5b5b3e){return _0x5b5b3e[_0x31b3('0x1c')]()[_0x31b3('0x1d')](function(){_0x2c7448['status'](0xcc)[_0x31b3('0x13')]();});}};}function handleEntityNotFound(_0x45e0e){return function(_0x365eeb){if(!_0x365eeb){_0x45e0e[_0x31b3('0x12')](0x194);}return _0x365eeb;};}function handleError(_0x29ac0e,_0x1ce4a2){_0x1ce4a2=_0x1ce4a2||0x1f4;return function(_0x5b440d){logger[_0x31b3('0x1e')](_0x5b440d[_0x31b3('0x1f')]);if(_0x5b440d[_0x31b3('0x20')]){delete _0x5b440d[_0x31b3('0x20')];}_0x29ac0e[_0x31b3('0x14')](_0x1ce4a2)[_0x31b3('0x21')](_0x5b440d);};}exports[_0x31b3('0x22')]=function(_0x4c3590,_0x34e11b){var _0x13cbdd={};var _0x18e5a1=_[_0x31b3('0x23')](db['MailInteraction'][_0x31b3('0x24')],function(_0x19d485){return{'name':_0x19d485[_0x31b3('0x25')],'type':_0x19d485['type'][_0x31b3('0x26')]};});_0x13cbdd=qs[_0x31b3('0x27')](_0x18e5a1,_0x4c3590);return interaction[_0x31b3('0x28')](_0x31b3('0x29'),_0x4c3590[_0x31b3('0x2a')],_0x4c3590[_0x31b3('0x2b')],_0x13cbdd,_0x18e5a1)[_0x31b3('0x1d')](respondWithFilteredResult(_0x34e11b,_0x13cbdd))[_0x31b3('0x2c')](handleError(_0x34e11b,null));};exports[_0x31b3('0x2d')]=function(_0x593b50,_0x53cb40){var _0x56ba7f={'raw':![],'where':{'id':_0x593b50[_0x31b3('0x2e')]['id']}},_0x4d36bf={};_0x4d36bf[_0x31b3('0x2f')]=_['keys'](db[_0x31b3('0x30')][_0x31b3('0x24')]);_0x4d36bf[_0x31b3('0x2a')]=_[_0x31b3('0x31')](_0x593b50[_0x31b3('0x2a')]);_0x4d36bf['filters']=_[_0x31b3('0x32')](_0x4d36bf['model'],_0x4d36bf[_0x31b3('0x2a')]);_0x56ba7f['attributes']=_[_0x31b3('0x32')](_0x4d36bf['model'],qs[_0x31b3('0x33')](_0x593b50[_0x31b3('0x2a')]['fields']));_0x56ba7f['attributes']=_0x56ba7f['attributes']['length']?_0x56ba7f[_0x31b3('0x34')]:_0x4d36bf['model'];if(_0x593b50[_0x31b3('0x2a')][_0x31b3('0x35')]){_0x56ba7f[_0x31b3('0x36')]=[{'all':!![]}];}_0x56ba7f=_[_0x31b3('0x37')]({},_0x56ba7f,_0x593b50[_0x31b3('0x38')]);return db['MailInteraction'][_0x31b3('0x39')](_0x56ba7f)[_0x31b3('0x1d')](handleEntityNotFound(_0x53cb40,null))[_0x31b3('0x1d')](respondWithResult(_0x53cb40,null))['catch'](handleError(_0x53cb40,null));};exports[_0x31b3('0x3a')]=function(_0x8fe74c,_0x2a67e5){return db[_0x31b3('0x30')][_0x31b3('0x3a')](_0x8fe74c['body'],{})['then'](respondWithResult(_0x2a67e5,0xc9))[_0x31b3('0x2c')](handleError(_0x2a67e5,null));};exports[_0x31b3('0x3b')]=function(_0xb7a5c5,_0x4e48ad){if(_0xb7a5c5[_0x31b3('0x3c')]['id']){delete _0xb7a5c5[_0x31b3('0x3c')]['id'];}return db['MailInteraction'][_0x31b3('0x39')]({'where':{'id':_0xb7a5c5[_0x31b3('0x2e')]['id']}})[_0x31b3('0x1d')](handleEntityNotFound(_0x4e48ad,null))[_0x31b3('0x1d')](saveUpdates(_0xb7a5c5[_0x31b3('0x3c')],null))[_0x31b3('0x1d')](respondWithResult(_0x4e48ad,null))[_0x31b3('0x2c')](handleError(_0x4e48ad,null));};exports[_0x31b3('0x1c')]=function(_0x99b212,_0x1bb599){return db['MailInteraction']['find']({'where':{'id':_0x99b212[_0x31b3('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1bb599,null))[_0x31b3('0x1d')](removeEntity(_0x1bb599,null))[_0x31b3('0x2c')](handleError(_0x1bb599,null));};exports['describe']=function(_0x248a7a,_0x29d7c4){return db['MailInteraction'][_0x31b3('0x3d')]()[_0x31b3('0x1d')](respondWithResult(_0x29d7c4,null))[_0x31b3('0x2c')](handleError(_0x29d7c4,null));};exports[_0x31b3('0x3e')]=function(_0x29967b,_0x2b6375){return db[_0x31b3('0x3f')][_0x31b3('0x39')]({'where':{'id':_0x29967b['params']['id']}})[_0x31b3('0x1d')](handleEntityNotFound(_0x2b6375,null))[_0x31b3('0x1d')](function(_0xc6cc63){if(_0xc6cc63){return _0xc6cc63[_0x31b3('0x3e')](_0x29967b[_0x31b3('0x3c')][_0x31b3('0x40')],_['omit'](_0x29967b[_0x31b3('0x3c')],[_0x31b3('0x40'),'id'])||{});}})[_0x31b3('0x1d')](respondWithResult(_0x2b6375,null))[_0x31b3('0x2c')](handleError(_0x2b6375,null));};exports['getMessages']=function(_0x7d3b91,_0x3439ee){var _0x2d9610={'raw':![],'where':{}};var _0x1cf6fa={};var _0x212aed={'count':0x0,'rows':[]};return db[_0x31b3('0x30')]['findOne']({'where':{'id':_0x7d3b91[_0x31b3('0x2e')]['id']}})[_0x31b3('0x1d')](handleEntityNotFound(_0x3439ee,null))['then'](function(_0x45f32b){if(_0x45f32b){_0x1cf6fa[_0x31b3('0x2f')]=_['keys'](db['MailMessage'][_0x31b3('0x24')]);_0x1cf6fa[_0x31b3('0x2a')]=_[_0x31b3('0x31')](_0x7d3b91[_0x31b3('0x2a')]);_0x1cf6fa[_0x31b3('0x41')]=_[_0x31b3('0x32')](_0x1cf6fa[_0x31b3('0x2f')],_0x1cf6fa[_0x31b3('0x2a')]);_0x2d9610['attributes']=_[_0x31b3('0x32')](_0x1cf6fa['model'],qs[_0x31b3('0x33')](_0x7d3b91[_0x31b3('0x2a')][_0x31b3('0x33')]));_0x2d9610[_0x31b3('0x34')]=_0x2d9610[_0x31b3('0x34')]['length']?_0x2d9610[_0x31b3('0x34')]:_0x1cf6fa[_0x31b3('0x2f')];if(!_0x7d3b91[_0x31b3('0x2a')]['hasOwnProperty'](_0x31b3('0x42'))){_0x2d9610['limit']=qs[_0x31b3('0x17')](_0x7d3b91[_0x31b3('0x2a')]['limit']);_0x2d9610[_0x31b3('0x19')]=qs['offset'](_0x7d3b91[_0x31b3('0x2a')][_0x31b3('0x19')]);}_0x2d9610[_0x31b3('0x43')]=qs[_0x31b3('0x44')](_0x7d3b91[_0x31b3('0x2a')]['sort']);_0x2d9610[_0x31b3('0x45')]=qs[_0x31b3('0x41')](_[_0x31b3('0x46')](_0x7d3b91[_0x31b3('0x2a')],_0x1cf6fa[_0x31b3('0x41')]));_0x2d9610[_0x31b3('0x45')][_0x31b3('0x47')]=_0x45f32b['id'];if(_0x7d3b91[_0x31b3('0x2a')]['filter']){_0x2d9610[_0x31b3('0x45')]=_[_0x31b3('0x37')](_0x2d9610[_0x31b3('0x45')],{'$or':_[_0x31b3('0x23')](_0x2d9610[_0x31b3('0x34')],function(_0x5d549c){var _0x38a283={};_0x38a283[_0x5d549c]={'$like':'%'+_0x7d3b91[_0x31b3('0x2a')]['filter']+'%'};return _0x38a283;})});}if(_0x7d3b91[_0x31b3('0x2a')]['$gte']){var _0x153f7f=_0x7d3b91[_0x31b3('0x2a')]['$gte'][_0x31b3('0x48')](',');var _0x12460d={};_0x12460d[_0x153f7f[0x0]]={'$gte':moment(_0x153f7f[0x1])[_0x31b3('0x49')](_0x31b3('0x4a'))};_0x2d9610[_0x31b3('0x45')]=_[_0x31b3('0x37')](_0x2d9610['where'],_0x12460d);}_0x2d9610=_['merge']({},_0x2d9610,_0x7d3b91[_0x31b3('0x38')]);return db[_0x31b3('0x3f')]['count']({'where':_0x2d9610['where']})[_0x31b3('0x1d')](function(_0x8e3789){_0x212aed[_0x31b3('0x18')]=_0x8e3789;if(_0x7d3b91[_0x31b3('0x2a')][_0x31b3('0x35')]){_0x2d9610['include']=[{'all':!![]}];}return db[_0x31b3('0x3f')][_0x31b3('0x28')](_0x2d9610);})[_0x31b3('0x1d')](function(_0x15c5a0){if(_0x7d3b91[_0x31b3('0x2a')]['inlineCss']===_0x31b3('0x4b')){for(var _0x48e864=0x0;_0x48e864<_0x15c5a0['length'];_0x48e864++){_0x15c5a0[_0x48e864][_0x31b3('0x3c')]=juice(_0x15c5a0[_0x48e864][_0x31b3('0x3c')]);}}_0x212aed['rows']=_0x15c5a0;return _0x212aed;});}})['then'](respondWithFilteredResult(_0x3439ee,_0x2d9610))['catch'](handleError(_0x3439ee,null));};exports[_0x31b3('0x4c')]=function(_0x5cd5e2,_0x57e800){return db[_0x31b3('0x30')][_0x31b3('0x39')]({'where':{'id':_0x5cd5e2[_0x31b3('0x2e')]['id']}})['then'](handleEntityNotFound(_0x57e800,null))['then'](function(_0x573786){if(_0x573786){return _0x573786[_0x31b3('0x4d')](_0x5cd5e2[_0x31b3('0x3c')][_0x31b3('0x40')],_[_0x31b3('0x4e')](_0x5cd5e2['body'],[_0x31b3('0x40'),'id'])||{})[_0x31b3('0x4f')](function(){return db[_0x31b3('0x50')][_0x31b3('0x28')]({'attributes':['id',_0x31b3('0x20'),_0x31b3('0x51')],'where':{'id':_0x5cd5e2['body'][_0x31b3('0x40')]}});})['then'](function(_0x417a0b){socket[_0x31b3('0x52')]('mailInteractionTags:save',{'id':Number(_0x5cd5e2[_0x31b3('0x2e')]['id']),'tags':_0x417a0b||[]});return{'id':Number(_0x5cd5e2[_0x31b3('0x2e')]['id']),'tags':_0x417a0b||[]};});}})[_0x31b3('0x1d')](respondWithResult(_0x57e800,null))['catch'](handleError(_0x57e800,null));};exports[_0x31b3('0x53')]=function(_0x3feecb,_0x5e0adf){return db[_0x31b3('0x30')][_0x31b3('0x39')]({'where':{'id':_0x3feecb[_0x31b3('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5e0adf,null))[_0x31b3('0x1d')](function(_0x1dd700){if(_0x1dd700){return _0x1dd700['removeTags'](_0x3feecb['query'][_0x31b3('0x40')]);}})[_0x31b3('0x1d')](respondWithStatusCode(_0x5e0adf,null))[_0x31b3('0x2c')](handleError(_0x5e0adf,null));};exports[_0x31b3('0x54')]=function(_0x5b1106,_0x288d98){var _0x248864=moment()[_0x31b3('0x55')]()[_0x31b3('0x56')]();var _0x581b9c=path[_0x31b3('0x57')](config[_0x31b3('0x58')],_0x31b3('0x59'),_0x31b3('0x5a'),_0x31b3('0x5b'));var _0x4d5ce3=path[_0x31b3('0x57')](config[_0x31b3('0x58')],_0x31b3('0x59'),'files',_0x31b3('0x5c'));var _0x5db9ac=path['join'](_0x581b9c,_0x248864);var _0x2eb6c8=util[_0x31b3('0x49')](_0x31b3('0x5d'),_0x5b1106[_0x31b3('0x2e')]['id'],_0x248864);var _0x2c0ce3=path[_0x31b3('0x57')](_0x581b9c,_0x2eb6c8);var _0xbc7124=[];if(_0x5b1106[_0x31b3('0x2a')]['attachments']){_0xbc7124[_0x31b3('0x5e')]({'model':db[_0x31b3('0x5f')],'as':'Attachments','raw':!![]});}var _0x342d3f=[{'model':db[_0x31b3('0x3f')],'as':_0x31b3('0x60'),'attributes':['id','body',_0x31b3('0x61'),'to','cc',_0x31b3('0x62'),_0x31b3('0x63'),_0x31b3('0x64')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xbc7124}];return db[_0x31b3('0x30')][_0x31b3('0x39')]({'where':{'id':_0x5b1106[_0x31b3('0x2e')]['id']},'include':_0x342d3f})['then'](handleEntityNotFound(_0x288d98,null))[_0x31b3('0x1d')](function(_0x2ad2c9){if(_0x2ad2c9&&_0x2ad2c9[_0x31b3('0x60')]){var _0x1b205b=_0x2ad2c9[_0x31b3('0x65')]({'plain':!![]});fs['mkdirSync'](_0x5db9ac);return BPromise[_0x31b3('0x66')](_0x1b205b[_0x31b3('0x60')],function(_0x210221,_0x37a9d5){var _0x5b2e9a={'from':_0x210221[_0x31b3('0x61')],'to':_0x210221['to']||_0x31b3('0x67'),'subject':_0x210221[_0x31b3('0x63')],'html':htmlEntities['decode'](_0x210221[_0x31b3('0x3c')]),'headers':{'Date':moment(_0x210221[_0x31b3('0x64')])[_0x31b3('0x49')](_0x31b3('0x68'))},'attachments':[]};if(_0x210221['cc']){_0x5b2e9a[_0x31b3('0x69')]['Cc']=_0x210221['cc'];}if(_0x210221[_0x31b3('0x62')]){_0x5b2e9a[_0x31b3('0x69')]['Bcc']=_0x210221[_0x31b3('0x62')];}return new BPromise(function(_0x59c537,_0x11e7e1){if(_0x210221[_0x31b3('0x6a')]){for(var _0x1ce9a1=0x0;_0x1ce9a1<_0x210221[_0x31b3('0x6a')][_0x31b3('0x6b')];_0x1ce9a1++){var _0x3351cb=_0x210221[_0x31b3('0x6a')][_0x1ce9a1];var _0x3fe30f=path[_0x31b3('0x57')](_0x4d5ce3,_0x3351cb[_0x31b3('0x6c')]);if(fs[_0x31b3('0x6d')](_0x3fe30f)){_0x5b2e9a[_0x31b3('0x5c')][_0x31b3('0x5e')]({'name':_0x3351cb[_0x31b3('0x20')],'contentType':_0x3351cb['type'],'data':fs['readFileSync'](_0x3fe30f)});}}}emlformat[_0x31b3('0x6e')](_0x5b2e9a,function(_0x405042,_0x286efa){if(_0x405042)return _0x11e7e1(_0x405042);fs['writeFileSync'](path[_0x31b3('0x57')](_0x5db9ac,util[_0x31b3('0x49')](_0x31b3('0x6f'),_0x37a9d5)),_0x286efa);return _0x59c537(_0x286efa);});});})[_0x31b3('0x1d')](function(){return new BPromise(function(_0x39c271,_0x3de384){zipdir(_0x5db9ac,{'saveTo':_0x2c0ce3},function(_0x1b9e79,_0x4637c6){if(_0x1b9e79)return _0x3de384(_0x1b9e79);return _0x39c271(_0x4637c6);});})[_0x31b3('0x1d')](function(){return new BPromise(function(_0x42a5fe,_0xbe7223){rimraf(_0x5db9ac,function(_0x49c93f){if(_0x49c93f)_0xbe7223(_0x49c93f);return _0x42a5fe();});});})[_0x31b3('0x1d')](function(){return _0x288d98[_0x31b3('0x54')](_0x2c0ce3,_0x2eb6c8,function(_0x53b13a){if(!_0x53b13a)fs['unlinkSync'](_0x2c0ce3);});});});}else{return _0x288d98['sendStatus'](0xc8);}})[_0x31b3('0x2c')](handleError(_0x288d98,null));}; \ No newline at end of file +var _0x65f5=['existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update','then','end','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','show','model','query','keys','filters','intersection','attributes','length','includeAll','merge','options','create','body','find','params','destroy','describe','addMessage','MailMessage','ids','getMessages','findOne','fields','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','setTags','spread','Tag','mailInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','server','files','attachments','push','from','bcc','Messages','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename'];(function(_0x70bed4,_0x3b40e2){var _0x3e358d=function(_0x2dd3e9){while(--_0x2dd3e9){_0x70bed4['push'](_0x70bed4['shift']());}};_0x3e358d(++_0x3b40e2);}(_0x65f5,0xef));var _0x565f=function(_0x3564e5,_0x252379){_0x3564e5=_0x3564e5-0x0;var _0x1df5ad=_0x65f5[_0x3564e5];return _0x1df5ad;};'use strict';var emlformat=require(_0x565f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x565f('0x1'));var moment=require(_0x565f('0x2'));var BPromise=require(_0x565f('0x3'));var util=require('util');var path=require(_0x565f('0x4'));var fs=require('fs');var _=require(_0x565f('0x5'));var juice=require(_0x565f('0x6'));var Redis=require(_0x565f('0x7'));var interaction=require(_0x565f('0x8'));var qs=require(_0x565f('0x9'));var logger=require(_0x565f('0xa'))(_0x565f('0xb'));var config=require(_0x565f('0xc'));var db=require(_0x565f('0xd'))['db'];var htmlEntities=require(_0x565f('0xe'));config['redis']=_[_0x565f('0xf')](config[_0x565f('0x10')],{'host':_0x565f('0x11'),'port':0x18eb});var socket=require(_0x565f('0x12'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2aa21d,_0x49517b){_0x49517b=_0x49517b||0xcc;return function(_0x42cf90){if(_0x42cf90){return _0x2aa21d[_0x565f('0x13')](_0x49517b);}return _0x2aa21d['status'](_0x49517b)['end']();};}function respondWithResult(_0x15eb9c,_0x58c450){_0x58c450=_0x58c450||0xc8;return function(_0x5a0760){if(_0x5a0760){return _0x15eb9c[_0x565f('0x14')](_0x58c450)['json'](_0x5a0760);}};}function respondWithFilteredResult(_0x398cec,_0x3f0ca0){return function(_0x457367){if(_0x457367){var _0x51e272=typeof _0x3f0ca0['offset']===_0x565f('0x15')&&typeof _0x3f0ca0[_0x565f('0x16')]===_0x565f('0x15');var _0x399cef=_0x457367[_0x565f('0x17')];var _0x1fddb0=_0x51e272?0x0:_0x3f0ca0[_0x565f('0x18')];var _0x438430=_0x51e272?_0x457367['count']:_0x3f0ca0['offset']+_0x3f0ca0[_0x565f('0x16')];var _0x104fb1;if(_0x438430>=_0x399cef){_0x438430=_0x399cef;_0x104fb1=0xc8;}else{_0x104fb1=0xce;}_0x398cec[_0x565f('0x14')](_0x104fb1);return _0x398cec[_0x565f('0x19')](_0x565f('0x1a'),_0x1fddb0+'-'+_0x438430+'/'+_0x399cef)[_0x565f('0x1b')](_0x457367);}return null;};}function saveUpdates(_0x3c1998){return function(_0x3919b2){if(_0x3919b2){return _0x3919b2[_0x565f('0x1c')](_0x3c1998)[_0x565f('0x1d')](function(_0xede5ba){return _0xede5ba;});}return null;};}function removeEntity(_0x253325){return function(_0x3d5d5b){if(_0x3d5d5b){return _0x3d5d5b['destroy']()[_0x565f('0x1d')](function(){_0x253325[_0x565f('0x14')](0xcc)[_0x565f('0x1e')]();});}};}function handleEntityNotFound(_0xcd747a){return function(_0x1f1b22){if(!_0x1f1b22){_0xcd747a[_0x565f('0x13')](0x194);}return _0x1f1b22;};}function handleError(_0x19b266,_0x2ba684){_0x2ba684=_0x2ba684||0x1f4;return function(_0x18272d){logger[_0x565f('0x1f')](_0x18272d[_0x565f('0x20')]);if(_0x18272d[_0x565f('0x21')]){delete _0x18272d[_0x565f('0x21')];}_0x19b266['status'](_0x2ba684)['send'](_0x18272d);};}exports[_0x565f('0x22')]=function(_0x404ba1,_0x460dc4){var _0x4fd1cb={};var _0x5878ac=_[_0x565f('0x23')](db[_0x565f('0x24')][_0x565f('0x25')],function(_0x26bb56){return{'name':_0x26bb56[_0x565f('0x26')],'type':_0x26bb56[_0x565f('0x27')][_0x565f('0x28')]};});_0x4fd1cb=qs[_0x565f('0x29')](_0x5878ac,_0x404ba1);return interaction[_0x565f('0x2a')](_0x565f('0x2b'),_0x404ba1['query'],_0x404ba1[_0x565f('0x2c')],_0x4fd1cb,_0x5878ac)[_0x565f('0x1d')](respondWithFilteredResult(_0x460dc4,_0x4fd1cb))[_0x565f('0x2d')](handleError(_0x460dc4,null));};exports[_0x565f('0x2e')]=function(_0x1067f8,_0x3fe8f2){var _0x3aebef={'raw':![],'where':{'id':_0x1067f8['params']['id']}},_0xdb5207={};_0xdb5207[_0x565f('0x2f')]=_['keys'](db['MailInteraction'][_0x565f('0x25')]);_0xdb5207[_0x565f('0x30')]=_[_0x565f('0x31')](_0x1067f8[_0x565f('0x30')]);_0xdb5207[_0x565f('0x32')]=_[_0x565f('0x33')](_0xdb5207['model'],_0xdb5207[_0x565f('0x30')]);_0x3aebef[_0x565f('0x34')]=_[_0x565f('0x33')](_0xdb5207[_0x565f('0x2f')],qs['fields'](_0x1067f8['query']['fields']));_0x3aebef[_0x565f('0x34')]=_0x3aebef[_0x565f('0x34')][_0x565f('0x35')]?_0x3aebef['attributes']:_0xdb5207['model'];if(_0x1067f8[_0x565f('0x30')][_0x565f('0x36')]){_0x3aebef['include']=[{'all':!![]}];}_0x3aebef=_[_0x565f('0x37')]({},_0x3aebef,_0x1067f8[_0x565f('0x38')]);return db[_0x565f('0x24')]['find'](_0x3aebef)[_0x565f('0x1d')](handleEntityNotFound(_0x3fe8f2,null))[_0x565f('0x1d')](respondWithResult(_0x3fe8f2,null))[_0x565f('0x2d')](handleError(_0x3fe8f2,null));};exports['create']=function(_0x21853f,_0x169844){return db[_0x565f('0x24')][_0x565f('0x39')](_0x21853f[_0x565f('0x3a')],{})[_0x565f('0x1d')](respondWithResult(_0x169844,0xc9))['catch'](handleError(_0x169844,null));};exports[_0x565f('0x1c')]=function(_0x298bdc,_0x8582b9){if(_0x298bdc[_0x565f('0x3a')]['id']){delete _0x298bdc[_0x565f('0x3a')]['id'];}return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x298bdc[_0x565f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x8582b9,null))[_0x565f('0x1d')](saveUpdates(_0x298bdc[_0x565f('0x3a')],null))[_0x565f('0x1d')](respondWithResult(_0x8582b9,null))[_0x565f('0x2d')](handleError(_0x8582b9,null));};exports[_0x565f('0x3d')]=function(_0x42a6c7,_0x35b875){return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x42a6c7['params']['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x35b875,null))[_0x565f('0x1d')](removeEntity(_0x35b875,null))['catch'](handleError(_0x35b875,null));};exports['describe']=function(_0x3b3bc3,_0x573edc){return db['MailInteraction'][_0x565f('0x3e')]()[_0x565f('0x1d')](respondWithResult(_0x573edc,null))[_0x565f('0x2d')](handleError(_0x573edc,null));};exports[_0x565f('0x3f')]=function(_0x3c6168,_0x131002){return db[_0x565f('0x40')][_0x565f('0x3b')]({'where':{'id':_0x3c6168[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x131002,null))[_0x565f('0x1d')](function(_0x5ce8df){if(_0x5ce8df){return _0x5ce8df[_0x565f('0x3f')](_0x3c6168[_0x565f('0x3a')]['ids'],_['omit'](_0x3c6168[_0x565f('0x3a')],[_0x565f('0x41'),'id'])||{});}})[_0x565f('0x1d')](respondWithResult(_0x131002,null))['catch'](handleError(_0x131002,null));};exports[_0x565f('0x42')]=function(_0x2d23bb,_0x4eb8d9){var _0x525d19={'raw':![],'where':{}};var _0x315d72={};var _0x5c697e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x565f('0x43')]({'where':{'id':_0x2d23bb['params']['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x4eb8d9,null))[_0x565f('0x1d')](function(_0xcef2fd){if(_0xcef2fd){_0x315d72['model']=_[_0x565f('0x31')](db[_0x565f('0x40')][_0x565f('0x25')]);_0x315d72[_0x565f('0x30')]=_[_0x565f('0x31')](_0x2d23bb[_0x565f('0x30')]);_0x315d72[_0x565f('0x32')]=_[_0x565f('0x33')](_0x315d72['model'],_0x315d72[_0x565f('0x30')]);_0x525d19['attributes']=_[_0x565f('0x33')](_0x315d72['model'],qs[_0x565f('0x44')](_0x2d23bb[_0x565f('0x30')][_0x565f('0x44')]));_0x525d19[_0x565f('0x34')]=_0x525d19[_0x565f('0x34')][_0x565f('0x35')]?_0x525d19[_0x565f('0x34')]:_0x315d72['model'];if(!_0x2d23bb[_0x565f('0x30')]['hasOwnProperty'](_0x565f('0x45'))){_0x525d19['limit']=qs[_0x565f('0x16')](_0x2d23bb[_0x565f('0x30')]['limit']);_0x525d19['offset']=qs[_0x565f('0x18')](_0x2d23bb[_0x565f('0x30')]['offset']);}_0x525d19[_0x565f('0x46')]=qs[_0x565f('0x47')](_0x2d23bb[_0x565f('0x30')][_0x565f('0x47')]);_0x525d19['where']=qs[_0x565f('0x32')](_[_0x565f('0x48')](_0x2d23bb['query'],_0x315d72['filters']));_0x525d19[_0x565f('0x49')][_0x565f('0x4a')]=_0xcef2fd['id'];if(_0x2d23bb['query'][_0x565f('0x4b')]){_0x525d19['where']=_[_0x565f('0x37')](_0x525d19[_0x565f('0x49')],{'$or':_[_0x565f('0x23')](_0x525d19[_0x565f('0x34')],function(_0x158cc9){var _0x2de39a={};_0x2de39a[_0x158cc9]={'$like':'%'+_0x2d23bb[_0x565f('0x30')][_0x565f('0x4b')]+'%'};return _0x2de39a;})});}if(_0x2d23bb['query']['$gte']){var _0x37f9e8=_0x2d23bb[_0x565f('0x30')][_0x565f('0x4c')][_0x565f('0x4d')](',');var _0x527558={};_0x527558[_0x37f9e8[0x0]]={'$gte':moment(_0x37f9e8[0x1])[_0x565f('0x4e')](_0x565f('0x4f'))};_0x525d19[_0x565f('0x49')]=_[_0x565f('0x37')](_0x525d19[_0x565f('0x49')],_0x527558);}_0x525d19=_[_0x565f('0x37')]({},_0x525d19,_0x2d23bb[_0x565f('0x38')]);return db['MailMessage']['count']({'where':_0x525d19[_0x565f('0x49')]})[_0x565f('0x1d')](function(_0x251bea){_0x5c697e[_0x565f('0x17')]=_0x251bea;if(_0x2d23bb[_0x565f('0x30')][_0x565f('0x36')]){_0x525d19['include']=[{'all':!![]}];}return db['MailMessage'][_0x565f('0x2a')](_0x525d19);})[_0x565f('0x1d')](function(_0x5416d3){if(_0x2d23bb[_0x565f('0x30')][_0x565f('0x50')]==='true'){for(var _0x405c79=0x0;_0x405c79<_0x5416d3[_0x565f('0x35')];_0x405c79++){_0x5416d3[_0x405c79][_0x565f('0x3a')]=juice(_0x5416d3[_0x405c79][_0x565f('0x3a')]);}}_0x5c697e[_0x565f('0x51')]=_0x5416d3;return _0x5c697e;});}})['then'](respondWithFilteredResult(_0x4eb8d9,_0x525d19))[_0x565f('0x2d')](handleError(_0x4eb8d9,null));};exports[_0x565f('0x52')]=function(_0x172ecc,_0x28414f){return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x172ecc[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x28414f,null))[_0x565f('0x1d')](function(_0xe5d039){if(_0xe5d039){return _0xe5d039[_0x565f('0x53')](_0x172ecc[_0x565f('0x3a')][_0x565f('0x41')],_['omit'](_0x172ecc[_0x565f('0x3a')],[_0x565f('0x41'),'id'])||{})[_0x565f('0x54')](function(){return db[_0x565f('0x55')]['findAll']({'attributes':['id',_0x565f('0x21'),'color'],'where':{'id':_0x172ecc['body'][_0x565f('0x41')]}});})[_0x565f('0x1d')](function(_0x2de554){socket['emit'](_0x565f('0x56'),{'id':Number(_0x172ecc[_0x565f('0x3c')]['id']),'tags':_0x2de554||[]});return{'id':Number(_0x172ecc[_0x565f('0x3c')]['id']),'tags':_0x2de554||[]};});}})[_0x565f('0x1d')](respondWithResult(_0x28414f,null))[_0x565f('0x2d')](handleError(_0x28414f,null));};exports[_0x565f('0x57')]=function(_0x1c5b42,_0x2276d5){return db[_0x565f('0x24')]['find']({'where':{'id':_0x1c5b42[_0x565f('0x3c')]['id']}})[_0x565f('0x1d')](handleEntityNotFound(_0x2276d5,null))[_0x565f('0x1d')](function(_0x2bd143){if(_0x2bd143){return _0x2bd143[_0x565f('0x57')](_0x1c5b42['query']['ids']);}})[_0x565f('0x1d')](respondWithStatusCode(_0x2276d5,null))[_0x565f('0x2d')](handleError(_0x2276d5,null));};exports[_0x565f('0x58')]=function(_0x56f7bc,_0x24d8e6){var _0x44df6a=moment()[_0x565f('0x59')]()[_0x565f('0x5a')]();var _0x595e2e=path[_0x565f('0x5b')](config[_0x565f('0x5c')],'server','files',_0x565f('0x5d'));var _0x2a4b9b=path[_0x565f('0x5b')](config[_0x565f('0x5c')],_0x565f('0x5e'),_0x565f('0x5f'),_0x565f('0x60'));var _0x308246=path['join'](_0x595e2e,_0x44df6a);var _0x51d943=util['format']('transcript-%d-%s.zip',_0x56f7bc[_0x565f('0x3c')]['id'],_0x44df6a);var _0x119e06=path[_0x565f('0x5b')](_0x595e2e,_0x51d943);var _0x30e222=[];if(_0x56f7bc[_0x565f('0x30')][_0x565f('0x60')]){_0x30e222[_0x565f('0x61')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x2a0434=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x565f('0x3a'),_0x565f('0x62'),'to','cc',_0x565f('0x63'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x565f('0x47')]('id'),'include':_0x30e222}];return db[_0x565f('0x24')][_0x565f('0x3b')]({'where':{'id':_0x56f7bc[_0x565f('0x3c')]['id']},'include':_0x2a0434})[_0x565f('0x1d')](handleEntityNotFound(_0x24d8e6,null))[_0x565f('0x1d')](function(_0x1d8047){if(_0x1d8047&&_0x1d8047[_0x565f('0x64')]){var _0x928c8e=_0x1d8047[_0x565f('0x65')]({'plain':!![]});fs[_0x565f('0x66')](_0x308246);return BPromise[_0x565f('0x67')](_0x928c8e['Messages'],function(_0x2ad5ce,_0x252e05){var _0x4676e8={'from':_0x2ad5ce[_0x565f('0x62')],'to':_0x2ad5ce['to']||_0x565f('0x68'),'subject':_0x2ad5ce[_0x565f('0x69')],'html':htmlEntities[_0x565f('0x6a')](_0x2ad5ce[_0x565f('0x3a')]),'headers':{'Date':moment(_0x2ad5ce[_0x565f('0x6b')])['format'](_0x565f('0x6c'))},'attachments':[]};if(_0x2ad5ce['cc']){_0x4676e8[_0x565f('0x6d')]['Cc']=_0x2ad5ce['cc'];}if(_0x2ad5ce[_0x565f('0x63')]){_0x4676e8[_0x565f('0x6d')]['Bcc']=_0x2ad5ce[_0x565f('0x63')];}return new BPromise(function(_0xf0b835,_0x333599){if(_0x2ad5ce[_0x565f('0x6e')]){for(var _0xf254bd=0x0;_0xf254bd<_0x2ad5ce[_0x565f('0x6e')][_0x565f('0x35')];_0xf254bd++){var _0x25ad4f=_0x2ad5ce[_0x565f('0x6e')][_0xf254bd];var _0x515dfd=path[_0x565f('0x5b')](_0x2a4b9b,_0x25ad4f[_0x565f('0x6f')]);if(fs[_0x565f('0x70')](_0x515dfd)){_0x4676e8[_0x565f('0x60')]['push']({'name':_0x25ad4f[_0x565f('0x21')],'contentType':_0x25ad4f[_0x565f('0x27')],'data':fs[_0x565f('0x71')](_0x515dfd)});}}}emlformat['build'](_0x4676e8,function(_0x2c71ca,_0x559db1){if(_0x2c71ca)return _0x333599(_0x2c71ca);fs[_0x565f('0x72')](path['join'](_0x308246,util[_0x565f('0x4e')](_0x565f('0x73'),_0x252e05)),_0x559db1);return _0xf0b835(_0x559db1);});});})[_0x565f('0x1d')](function(){return new BPromise(function(_0x1eae40,_0x3c4e40){zipdir(_0x308246,{'saveTo':_0x119e06},function(_0x2c906e,_0x5b51ff){if(_0x2c906e)return _0x3c4e40(_0x2c906e);return _0x1eae40(_0x5b51ff);});})[_0x565f('0x1d')](function(){return new BPromise(function(_0x5dffa2,_0x4738fe){rimraf(_0x308246,function(_0x1e60f2){if(_0x1e60f2)_0x4738fe(_0x1e60f2);return _0x5dffa2();});});})['then'](function(){return _0x24d8e6[_0x565f('0x58')](_0x119e06,_0x51d943,function(_0x28e23e){if(!_0x28e23e)fs[_0x565f('0x74')](_0x119e06);});});});}else{return _0x24d8e6['sendStatus'](0xc8);}})[_0x565f('0x2d')](handleError(_0x24d8e6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d0887ca..4255583 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 _0x0884=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x0884,0x1cf));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x4088('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x4088('0x0'))['db'][_0x4088('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4088('0x2'),'afterUpdate':_0x4088('0x3'),'afterDestroy':_0x4088('0x4')};function emitEvent(_0x4c91db){return function(_0x567db0,_0x200ba7,_0xda2385){_0x567db0[_0x4088('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x261996){_0x567db0[_0x4088('0x6')](_0x4088('0x7'),_0x261996[_0x4088('0x8')](function(_0x525e12){return{'id':_0x525e12['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x567db0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4088('0x9')](function(_0x491dfa){_0x567db0['setDataValue'](_0x4088('0xa'),_0x491dfa[_0x4088('0xb')]);MailInteractionEvents['emit'](_0x4c91db+':'+_0x567db0['id'],_0x567db0);MailInteractionEvents[_0x4088('0xc')](_0x4c91db,_0x567db0);_0xda2385(null);})[_0x4088('0xd')](_0xda2385(null));};}for(var e in events){if(events[_0x4088('0xe')](e)){var event=events[e];MailInteraction[_0x4088('0xf')](e,emitEvent(event));}}module[_0x4088('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xf3a6=['map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf3a6,0x15e));var _0x6f3a=function(_0x28e502,_0x3e36c5){_0x28e502=_0x28e502-0x0;var _0x2fd662=_0xf3a6[_0x28e502];return _0x2fd662;};'use strict';var EventEmitter=require(_0x6f3a('0x0'));var MailInteraction=require(_0x6f3a('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x6f3a('0x1'))['db'][_0x6f3a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6f3a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f3a('0x4'),'afterDestroy':_0x6f3a('0x5')};function emitEvent(_0x4a41bb){return function(_0x1fe60c,_0x40f84c,_0x185e9f){_0x1fe60c[_0x6f3a('0x6')]({'attributes':['id'],'raw':!![]})[_0x6f3a('0x7')](function(_0x21e65d){_0x1fe60c[_0x6f3a('0x8')](_0x6f3a('0x9'),_0x21e65d[_0x6f3a('0xa')](function(_0x648262){return{'id':_0x648262['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1fe60c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6f3a('0x7')](function(_0x5c5932){_0x1fe60c[_0x6f3a('0x8')]('unreadMessages',_0x5c5932['length']);MailInteractionEvents['emit'](_0x4a41bb+':'+_0x1fe60c['id'],_0x1fe60c);MailInteractionEvents[_0x6f3a('0xb')](_0x4a41bb,_0x1fe60c);_0x185e9f(null);})['catch'](_0x185e9f(null));};}for(var e in events){if(events[_0x6f3a('0xc')](e)){var event=events[e];MailInteraction[_0x6f3a('0xd')](e,emitEvent(event));}}module[_0x6f3a('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1ec6b34..8c1e772 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 _0xc043=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get'];(function(_0x3a218d,_0x340ffa){var _0x23580d=function(_0x2c4dbb){while(--_0x2c4dbb){_0x3a218d['push'](_0x3a218d['shift']());}};_0x23580d(++_0x340ffa);}(_0xc043,0xc9));var _0x3c04=function(_0x528acc,_0x1d77b6){_0x528acc=_0x528acc-0x0;var _0x4dca60=_0xc043[_0x528acc];return _0x4dca60;};'use strict';var _=require(_0x3c04('0x0'));var util=require(_0x3c04('0x1'));var logger=require(_0x3c04('0x2'))('api');var moment=require(_0x3c04('0x3'));var BPromise=require(_0x3c04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c04('0x5'));var config=require(_0x3c04('0x6'));var attributes=require(_0x3c04('0x7'));module[_0x3c04('0x8')]=function(_0x306b33,_0x22e613){return _0x306b33[_0x3c04('0x9')](_0x3c04('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3c04('0xb'),'fields':[_0x3c04('0xc'),'to'],'type':_0x3c04('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e05e5,_0x3c4489,_0x593468){if(_0x4e05e5['substatus']){_0x4e05e5[_0x3c04('0xe')]=moment()[_0x3c04('0xf')](_0x3c04('0x10'));}if(_0x4e05e5[_0x3c04('0x11')]){_0x4e05e5[_0x3c04('0x12')]=moment()[_0x3c04('0xf')](_0x3c04('0x10'));}_0x593468(null,_0x3c4489);},'beforeUpdate':function(_0x49b4d8,_0x32d37f,_0x5a653e){if(_0x49b4d8[_0x3c04('0x13')](_0x3c04('0x14'))){_0x49b4d8[_0x3c04('0xe')]=_0x49b4d8[_0x3c04('0x14')]?moment()[_0x3c04('0xf')](_0x3c04('0x10')):null;}if(_0x49b4d8['changed']('closed')){_0x49b4d8[_0x3c04('0x12')]=moment()[_0x3c04('0xf')](_0x3c04('0x10'));_0x49b4d8[_0x3c04('0x14')]=null;_0x49b4d8[_0x3c04('0xe')]=null;}_0x5a653e(null,_0x49b4d8);},'afterUpdate':function(_0x4e649d,_0xb9c80e,_0x1744f2){var _0x5484da=_0x306b33[_0x3c04('0x15')];var _0x35cf3e=_0x4e649d[_0x3c04('0x16')]({'plain':!![]});if(_0x35cf3e[_0x3c04('0x11')]){return _0x5484da['MailMessage'][_0x3c04('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x35cf3e['id']}})[_0x3c04('0x18')](function(){_0x1744f2();})[_0x3c04('0x19')](function(_0xfd5e1e){_0x1744f2(_0xfd5e1e);});}else{_0x1744f2();}}},'charset':_0x3c04('0x1a'),'collate':_0x3c04('0x1b')});}; \ No newline at end of file +var _0x08e1=['substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','update','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','define','mail_interactions','substatus'];(function(_0x40c219,_0x514937){var _0x3e9cd5=function(_0x5892c2){while(--_0x5892c2){_0x40c219['push'](_0x40c219['shift']());}};_0x3e9cd5(++_0x514937);}(_0x08e1,0xc2));var _0x108e=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x08e1[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0x108e('0x0'));var util=require(_0x108e('0x1'));var logger=require(_0x108e('0x2'))(_0x108e('0x3'));var moment=require(_0x108e('0x4'));var BPromise=require(_0x108e('0x5'));var rp=require(_0x108e('0x6'));var fs=require('fs');var path=require(_0x108e('0x7'));var rimraf=require('rimraf');var config=require(_0x108e('0x8'));var attributes=require(_0x108e('0x9'));module['exports']=function(_0x5f1ade,_0x4e9573){return _0x5f1ade[_0x108e('0xa')]('MailInteraction',attributes,{'tableName':_0x108e('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d00a3,_0x14d131,_0x42cabb){if(_0x4d00a3[_0x108e('0xc')]){_0x4d00a3[_0x108e('0xd')]=moment()[_0x108e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4d00a3['closed']){_0x4d00a3[_0x108e('0xf')]=moment()[_0x108e('0xe')](_0x108e('0x10'));}_0x42cabb(null,_0x14d131);},'beforeUpdate':function(_0x41a62a,_0x56d217,_0x2c7270){if(_0x41a62a[_0x108e('0x11')](_0x108e('0xc'))){_0x41a62a['substatusAt']=_0x41a62a[_0x108e('0xc')]?moment()[_0x108e('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x41a62a['changed'](_0x108e('0x12'))){_0x41a62a[_0x108e('0xf')]=moment()[_0x108e('0xe')](_0x108e('0x10'));_0x41a62a[_0x108e('0xc')]=null;_0x41a62a['substatusAt']=null;}_0x2c7270(null,_0x41a62a);},'afterUpdate':function(_0x5d9aed,_0x154cd7,_0x39e507){var _0x54c8f9=_0x5f1ade[_0x108e('0x13')];var _0x5be4d5=_0x5d9aed[_0x108e('0x14')]({'plain':!![]});if(_0x5be4d5[_0x108e('0x12')]){return _0x54c8f9['MailMessage'][_0x108e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5be4d5['id']}})['then'](function(){_0x39e507();})['catch'](function(_0x30f118){_0x39e507(_0x30f118);});}else{_0x39e507();}}},'charset':_0x108e('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 87b5619..d929410 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 _0xd3e3=['limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','MailInteraction','options','raw','where'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x55ec31,_0x3f1d64){_0x55ec31=_0x55ec31-0x0;var _0x47a20e=_0xd3e3[_0x55ec31];return _0x47a20e;};'use strict';var _=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var moment=require(_0x3d3e('0x2'));var BPromise=require(_0x3d3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d3e('0x4'));var db=require(_0x3d3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d3e('0x6'))(_0x3d3e('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d3e('0x8'));var client=jayson[_0x3d3e('0x9')][_0x3d3e('0xa')]({'port':0x232a});config[_0x3d3e('0xb')]=_[_0x3d3e('0xc')](config['redis'],{'host':_0x3d3e('0xd'),'port':0x18eb});var socket=require(_0x3d3e('0xe'))(new Redis(config[_0x3d3e('0xb')]));require('./mailInteraction.socket')[_0x3d3e('0xf')](socket);function respondWithRpcPromise(_0x17b2c5,_0x25c4a1,_0x45cb37){return new BPromise(function(_0x5cb1be,_0x53b776){return client['request'](_0x17b2c5,_0x45cb37)[_0x3d3e('0x10')](function(_0x144237){logger[_0x3d3e('0x11')](_0x3d3e('0x12'),_0x25c4a1,'request\x20sent');logger[_0x3d3e('0x13')](_0x3d3e('0x14'),_0x25c4a1,'request\x20sent',JSON[_0x3d3e('0x15')](_0x144237));if(_0x144237[_0x3d3e('0x16')]){if(_0x144237[_0x3d3e('0x16')][_0x3d3e('0x17')]===0x1f4){logger[_0x3d3e('0x16')](_0x3d3e('0x12'),_0x25c4a1,_0x144237[_0x3d3e('0x16')][_0x3d3e('0x18')]);return _0x53b776(_0x144237[_0x3d3e('0x16')]['message']);}logger[_0x3d3e('0x16')](_0x3d3e('0x12'),_0x25c4a1,_0x144237[_0x3d3e('0x16')]['message']);return _0x5cb1be(_0x144237['error'][_0x3d3e('0x18')]);}else{logger['info'](_0x3d3e('0x12'),_0x25c4a1,_0x3d3e('0x19'));_0x5cb1be(_0x144237[_0x3d3e('0x1a')][_0x3d3e('0x18')]);}})['catch'](function(_0x4a9adb){logger[_0x3d3e('0x16')](_0x3d3e('0x12'),_0x25c4a1,_0x4a9adb);_0x53b776(_0x4a9adb);});});}exports['UpdateMailInteraction']=function(_0x456e18){var _0x2d4455=this;return new Promise(function(_0x1f90ec,_0x22083a){return db[_0x3d3e('0x1b')]['update'](_0x456e18['body'],{'raw':_0x456e18[_0x3d3e('0x1c')]?_0x456e18[_0x3d3e('0x1c')][_0x3d3e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456e18[_0x3d3e('0x1c')]?_0x456e18[_0x3d3e('0x1c')][_0x3d3e('0x1e')]||null:null,'attributes':_0x456e18[_0x3d3e('0x1c')]?_0x456e18[_0x3d3e('0x1c')]['attributes']||null:null,'limit':_0x456e18['options']?_0x456e18['options'][_0x3d3e('0x1f')]||null:null})[_0x3d3e('0x10')](function(_0xe80bce){logger[_0x3d3e('0x11')](_0x3d3e('0x20'),_0x456e18);logger[_0x3d3e('0x13')](_0x3d3e('0x20'),_0x456e18,JSON[_0x3d3e('0x15')](_0xe80bce));_0x1f90ec(_0xe80bce);})['catch'](function(_0x353b74){logger[_0x3d3e('0x16')](_0x3d3e('0x20'),_0x353b74[_0x3d3e('0x18')],_0x456e18);_0x22083a(_0x2d4455[_0x3d3e('0x16')](0x1f4,_0x353b74[_0x3d3e('0x18')]));});});};exports[_0x3d3e('0x21')]=function(_0x58b5f2){return new Promise(function(_0x3bcbf3,_0x470030){return db[_0x3d3e('0x1b')][_0x3d3e('0x22')]({'where':_0x58b5f2[_0x3d3e('0x1c')]?_0x58b5f2['options'][_0x3d3e('0x1e')]||null:null})[_0x3d3e('0x10')](function(_0x5d67bd){if(_0x5d67bd){return _0x5d67bd[_0x3d3e('0x23')](_0x58b5f2[_0x3d3e('0x24')][_0x3d3e('0x25')],_[_0x3d3e('0x26')](_0x58b5f2[_0x3d3e('0x24')],['ids','id'])||{});}})[_0x3d3e('0x27')](function(_0x4f2dba){logger['info'](_0x3d3e('0x28'),_0x58b5f2);logger[_0x3d3e('0x13')](_0x3d3e('0x28'),_0x58b5f2,JSON[_0x3d3e('0x15')](_0x4f2dba));_0x3bcbf3(_0x4f2dba);})[_0x3d3e('0x29')](function(_0x242f96){logger['error'](_0x3d3e('0x28'),_0x242f96[_0x3d3e('0x18')],_0x58b5f2);_0x470030(_this[_0x3d3e('0x16')](0x1f4,_0x242f96['message']));});});}; \ No newline at end of file +var _0x69a4=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailInteraction','update','options','raw','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','body','ids','omit','AddTags','util','moment'];(function(_0x31b500,_0x196ddb){var _0x208f59=function(_0xe594d0){while(--_0xe594d0){_0x31b500['push'](_0x31b500['shift']());}};_0x208f59(++_0x196ddb);}(_0x69a4,0x76));var _0x469a=function(_0x272de4,_0x1326a9){_0x272de4=_0x272de4-0x0;var _0x510a15=_0x69a4[_0x272de4];return _0x510a15;};'use strict';var _=require('lodash');var util=require(_0x469a('0x0'));var moment=require(_0x469a('0x1'));var BPromise=require('bluebird');var rs=require(_0x469a('0x2'));var fs=require('fs');var Redis=require(_0x469a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x469a('0x4'))(_0x469a('0x5'));var config=require('../../config/environment');var jayson=require(_0x469a('0x6'));var client=jayson[_0x469a('0x7')][_0x469a('0x8')]({'port':0x232a});config[_0x469a('0x9')]=_[_0x469a('0xa')](config[_0x469a('0x9')],{'host':_0x469a('0xb'),'port':0x18eb});var socket=require(_0x469a('0xc'))(new Redis(config[_0x469a('0x9')]));require('./mailInteraction.socket')[_0x469a('0xd')](socket);function respondWithRpcPromise(_0x1a26a3,_0x4de19f,_0x49d74a){return new BPromise(function(_0xd3fcce,_0x8aa78){return client[_0x469a('0xe')](_0x1a26a3,_0x49d74a)[_0x469a('0xf')](function(_0xc3dc5e){logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));logger[_0x469a('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4de19f,'request\x20sent',JSON[_0x469a('0x14')](_0xc3dc5e));if(_0xc3dc5e[_0x469a('0x15')]){if(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x16')]===0x1f4){logger[_0x469a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0x8aa78(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x17')]);}logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0xd3fcce(_0xc3dc5e['error'][_0x469a('0x17')]);}else{logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));_0xd3fcce(_0xc3dc5e[_0x469a('0x18')]['message']);}})[_0x469a('0x19')](function(_0x440040){logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0x440040);_0x8aa78(_0x440040);});});}exports['UpdateMailInteraction']=function(_0x524a77){var _0x126c5=this;return new Promise(function(_0x4ab05a,_0x5f122a){return db[_0x469a('0x1a')][_0x469a('0x1b')](_0x524a77['body'],{'raw':_0x524a77['options']?_0x524a77[_0x469a('0x1c')][_0x469a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524a77[_0x469a('0x1c')]?_0x524a77[_0x469a('0x1c')]['where']||null:null,'attributes':_0x524a77[_0x469a('0x1c')]?_0x524a77['options']['attributes']||null:null,'limit':_0x524a77[_0x469a('0x1c')]?_0x524a77[_0x469a('0x1c')][_0x469a('0x1e')]||null:null})[_0x469a('0xf')](function(_0x5b85c8){logger[_0x469a('0x10')](_0x469a('0x1f'),_0x524a77);logger[_0x469a('0x13')](_0x469a('0x1f'),_0x524a77,JSON[_0x469a('0x14')](_0x5b85c8));_0x4ab05a(_0x5b85c8);})[_0x469a('0x19')](function(_0x55af24){logger[_0x469a('0x15')]('UpdateMailInteraction',_0x55af24[_0x469a('0x17')],_0x524a77);_0x5f122a(_0x126c5[_0x469a('0x15')](0x1f4,_0x55af24[_0x469a('0x17')]));});});};exports[_0x469a('0x20')]=function(_0x1bbc39){return new Promise(function(_0x1e6396,_0x4de8b0){return db[_0x469a('0x1a')][_0x469a('0x21')]({'where':_0x1bbc39[_0x469a('0x1c')]?_0x1bbc39[_0x469a('0x1c')][_0x469a('0x22')]||null:null})['then'](function(_0x2ba796){if(_0x2ba796){return _0x2ba796[_0x469a('0x23')](_0x1bbc39[_0x469a('0x24')][_0x469a('0x25')],_[_0x469a('0x26')](_0x1bbc39['body'],[_0x469a('0x25'),'id'])||{});}})['spread'](function(_0xa1b73){logger[_0x469a('0x10')](_0x469a('0x27'),_0x1bbc39);logger['debug']('AddTags',_0x1bbc39,JSON[_0x469a('0x14')](_0xa1b73));_0x1e6396(_0xa1b73);})[_0x469a('0x19')](function(_0x38eecb){logger[_0x469a('0x15')](_0x469a('0x27'),_0x38eecb[_0x469a('0x17')],_0x1bbc39);_0x4de8b0(_this[_0x469a('0x15')](0x1f4,_0x38eecb[_0x469a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6efb7e2..ce5d738 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 _0x1f0d=['update','emit','removeListener','register','mailInteraction:','./mailInteraction.events','save'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1f0d,0xd7));var _0xd1f0=function(_0x313920,_0x54b317){_0x313920=_0x313920-0x0;var _0x4b2bbf=_0x1f0d[_0x313920];return _0x4b2bbf;};'use strict';var MailInteractionEvents=require(_0xd1f0('0x0'));var events=[_0xd1f0('0x1'),'remove',_0xd1f0('0x2')];function createListener(_0xbdfddf,_0x1f10d2){return function(_0x558a2a){_0x1f10d2[_0xd1f0('0x3')](_0xbdfddf,_0x558a2a);};}function removeListener(_0x150bc5,_0x6d5917){return function(){MailInteractionEvents[_0xd1f0('0x4')](_0x150bc5,_0x6d5917);};}exports[_0xd1f0('0x5')]=function(_0x13c951){for(var _0x5e2a8f=0x0,_0x7c7619=events['length'];_0x5e2a8f<_0x7c7619;_0x5e2a8f++){var _0xbb4278=events[_0x5e2a8f];var _0x3a5eb5=createListener(_0xd1f0('0x6')+_0xbb4278,_0x13c951);MailInteractionEvents['on'](_0xbb4278,_0x3a5eb5);}}; \ No newline at end of file +var _0x6111=['mailInteraction:','./mailInteraction.events','save','remove','update','register'];(function(_0x195d2f,_0x58dbe8){var _0x239dee=function(_0x24404a){while(--_0x24404a){_0x195d2f['push'](_0x195d2f['shift']());}};_0x239dee(++_0x58dbe8);}(_0x6111,0xdf));var _0x1611=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6111[_0x14add3];return _0x4a174f;};'use strict';var MailInteractionEvents=require(_0x1611('0x0'));var events=[_0x1611('0x1'),_0x1611('0x2'),_0x1611('0x3')];function createListener(_0x505bc1,_0x1efa14){return function(_0x3852df){_0x1efa14['emit'](_0x505bc1,_0x3852df);};}function removeListener(_0x5d190e,_0x61e414){return function(){MailInteractionEvents['removeListener'](_0x5d190e,_0x61e414);};}exports[_0x1611('0x4')]=function(_0x422a1e){for(var _0x335a40=0x0,_0x3b28ed=events['length'];_0x335a40<_0x3b28ed;_0x335a40++){var _0xc826d9=events[_0x335a40];var _0xf9bb0d=createListener(_0x1611('0x5')+_0xc826d9,_0x422a1e);MailInteractionEvents['on'](_0xc826d9,_0xf9bb0d);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index d4e8551..e76ee9c 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 _0xc83b=['/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xc83b,0xa4));var _0xbc83=function(_0x5665be,_0x46b479){_0x5665be=_0x5665be-0x0;var _0x5e7b08=_0xc83b[_0x5665be];return _0x5e7b08;};'use strict';var express=require(_0xbc83('0x0'));var router=express[_0xbc83('0x1')]();var auth=require(_0xbc83('0x2'));var controller=require(_0xbc83('0x3'));router['get'](_0xbc83('0x4'),auth[_0xbc83('0x5')](),controller[_0xbc83('0x6')]);module[_0xbc83('0x7')]=router; \ No newline at end of file +var _0x1db9=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','describe','exports','express','Router'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x1db9,0x176));var _0x91db=function(_0x54a7f8,_0x48e29b){_0x54a7f8=_0x54a7f8-0x0;var _0x18833e=_0x1db9[_0x54a7f8];return _0x18833e;};'use strict';var express=require(_0x91db('0x0'));var router=express[_0x91db('0x1')]();var auth=require(_0x91db('0x2'));var controller=require(_0x91db('0x3'));router[_0x91db('0x4')](_0x91db('0x5'),auth['isAuthenticated'](),controller[_0x91db('0x6')]);module[_0x91db('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 d8ec163..2f86011 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(_0x11ae36,_0x26b53c){var _0x5dbb07=function(_0x207016){while(--_0x207016){_0x11ae36['push'](_0x11ae36['shift']());}};_0x5dbb07(++_0x26b53c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x560753,_0xa71e2d){var _0x4a0a86=function(_0xbe9842){while(--_0xbe9842){_0x560753['push'](_0x560753['shift']());}};_0x4a0a86(++_0xa71e2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 8359c93..1dae3f8 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 _0xc569=['exports','INTEGER','sequelize'];(function(_0x1d61db,_0x2c0731){var _0x2dbc1b=function(_0x30e3e3){while(--_0x30e3e3){_0x1d61db['push'](_0x1d61db['shift']());}};_0x2dbc1b(++_0x2c0731);}(_0xc569,0x167));var _0x9c56=function(_0x5a1cb6,_0x532bd9){_0x5a1cb6=_0x5a1cb6-0x0;var _0x355305=_0xc569[_0x5a1cb6];return _0x355305;};'use strict';var Sequelize=require(_0x9c56('0x0'));module[_0x9c56('0x1')]={'MailInteractionId':{'type':Sequelize[_0x9c56('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x5cb9=['sequelize','exports','INTEGER'];(function(_0x965b89,_0x2e394b){var _0x211af2=function(_0x5a2cdd){while(--_0x5a2cdd){_0x965b89['push'](_0x965b89['shift']());}};_0x211af2(++_0x2e394b);}(_0x5cb9,0xb4));var _0x95cb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5cb9[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x95cb('0x0'));module[_0x95cb('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x95cb('0x2')],'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 87c9fb2..0ea31ce 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 _0x0347=['./mailInteractionHasTag','exports','define','mail_interaction_has_tags'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x0347,0xa0));var _0x7034=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0347[_0x138adb];return _0x1b27f2;};'use strict';var attributes=require(_0x7034('0x0'));module[_0x7034('0x1')]=function(_0x4c5e83){return _0x4c5e83[_0x7034('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x7034('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bc8=['define','MailInteractionHasTag','./mailInteractionHasTag'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bc8,0xd4));var _0x86bc=function(_0x11d156,_0x5e45c5){_0x11d156=_0x11d156-0x0;var _0x10d46a=_0x6bc8[_0x11d156];return _0x10d46a;};'use strict';var attributes=require(_0x86bc('0x0'));module['exports']=function(_0x153b77){return _0x153b77[_0x86bc('0x1')](_0x86bc('0x2'),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 3933ade..5a1dcb0 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 _0x2ec8=['Router','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','describe','show','/:id/download','download','post','mail','mailmessage:create','create','/:id','put','accept','delete','exports','multer','util','path','connect-timeout'];(function(_0x17119d,_0x32db88){var _0x2ac447=function(_0x2237a7){while(--_0x2237a7){_0x17119d['push'](_0x17119d['shift']());}};_0x2ac447(++_0x32db88);}(_0x2ec8,0x188));var _0x82ec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ec8[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x82ec('0x0'));var util=require(_0x82ec('0x1'));var path=require(_0x82ec('0x2'));var timeout=require(_0x82ec('0x3'));var express=require('express');var router=express[_0x82ec('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x82ec('0x5'));var config=require('../../config/environment');var controller=require(_0x82ec('0x6'));router[_0x82ec('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x82ec('0x8')](),controller[_0x82ec('0x9')]);router['get']('/:id',auth[_0x82ec('0x8')](),controller[_0x82ec('0xa')]);router['get'](_0x82ec('0xb'),auth[_0x82ec('0x8')](),controller[_0x82ec('0xc')]);router[_0x82ec('0xd')]('/',auth[_0x82ec('0x8')](),interaction['tracked'](_0x82ec('0xe'),_0x82ec('0xf')),controller[_0x82ec('0x10')]);router['put'](_0x82ec('0x11'),auth[_0x82ec('0x8')](),controller['update']);router[_0x82ec('0x12')]('/:id/accept',auth[_0x82ec('0x8')](),controller[_0x82ec('0x13')]);router[_0x82ec('0x12')]('/:id/reject',auth[_0x82ec('0x8')](),controller['reject']);router[_0x82ec('0x14')](_0x82ec('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x82ec('0x15')]=router; \ No newline at end of file +var _0x3238=['describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x4b682a,_0x351971){var _0x508b4f=function(_0x4428c6){while(--_0x4428c6){_0x4b682a['push'](_0x4b682a['shift']());}};_0x508b4f(++_0x351971);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8323('0x0'));var util=require('util');var path=require(_0x8323('0x1'));var timeout=require(_0x8323('0x2'));var express=require(_0x8323('0x3'));var router=express['Router']();var fs_extra=require(_0x8323('0x4'));var auth=require(_0x8323('0x5'));var interaction=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x8323('0x8')](),controller[_0x8323('0x9')]);router[_0x8323('0xa')](_0x8323('0xb'),auth['isAuthenticated'](),controller[_0x8323('0xc')]);router['get'](_0x8323('0xd'),auth[_0x8323('0x8')](),controller[_0x8323('0xe')]);router[_0x8323('0xa')](_0x8323('0xf'),auth[_0x8323('0x8')](),controller[_0x8323('0x10')]);router[_0x8323('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8323('0x12')](_0x8323('0x13'),_0x8323('0x14')),controller['create']);router[_0x8323('0x15')](_0x8323('0xd'),auth[_0x8323('0x8')](),controller[_0x8323('0x16')]);router[_0x8323('0x15')](_0x8323('0x17'),auth[_0x8323('0x8')](),controller[_0x8323('0x18')]);router[_0x8323('0x15')](_0x8323('0x19'),auth[_0x8323('0x8')](),controller[_0x8323('0x1a')]);router[_0x8323('0x1b')](_0x8323('0xd'),auth['isAuthenticated'](),controller[_0x8323('0x1c')]);module[_0x8323('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3db53df..1220b55 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 _0x2214=['lodash','TEXT','long','medium','BOOLEAN','out','STRING','INTEGER','DATE','ENUM','Email','Chat'];(function(_0x2fe996,_0x338996){var _0xf62a41=function(_0x2df902){while(--_0x2df902){_0x2fe996['push'](_0x2fe996['shift']());}};_0xf62a41(++_0x338996);}(_0x2214,0x138));var _0x4221=function(_0x1a67e7,_0xe5b9f){_0x1a67e7=_0x1a67e7-0x0;var _0x184175=_0x2214[_0x1a67e7];return _0x184175;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4221('0x0'));module['exports']={'body':{'type':Sequelize[_0x4221('0x1')](_0x4221('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4221('0x1')](_0x4221('0x3'))},'read':{'type':Sequelize[_0x4221('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x4221('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4221('0x6')](0x1fe)},'from':{'type':Sequelize[_0x4221('0x6')]},'to':{'type':Sequelize[_0x4221('0x1')](_0x4221('0x2'))},'cc':{'type':Sequelize[_0x4221('0x1')]('long')},'bcc':{'type':Sequelize[_0x4221('0x1')](_0x4221('0x2'))},'subject':{'type':Sequelize[_0x4221('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x4221('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4221('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4221('0x8')]},'originTo':{'type':Sequelize[_0x4221('0x1')]('long')},'originCc':{'type':Sequelize[_0x4221('0x1')](_0x4221('0x2'))},'originChannel':{'type':Sequelize[_0x4221('0x9')](_0x4221('0xa'),_0x4221('0xb')),'defaultValue':_0x4221('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x7a18=['lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat'];(function(_0x44957f,_0x2e8abc){var _0x555a2b=function(_0x4ea9b8){while(--_0x4ea9b8){_0x44957f['push'](_0x44957f['shift']());}};_0x555a2b(++_0x2e8abc);}(_0x7a18,0x15c));var _0x87a1=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x7a18[_0x10f68e];return _0x4c8372;};'use strict';var Sequelize=require('sequelize');var _=require(_0x87a1('0x0'));module[_0x87a1('0x1')]={'body':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x87a1('0x2')]('medium')},'read':{'type':Sequelize[_0x87a1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x87a1('0x5')]('in','out'),'defaultValue':_0x87a1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x87a1('0x7')](0x1fe)},'from':{'type':Sequelize[_0x87a1('0x7')]},'to':{'type':Sequelize['TEXT'](_0x87a1('0x3'))},'cc':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x87a1('0x8')]},'attach':{'type':Sequelize[_0x87a1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x87a1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x87a1('0x8')]},'originTo':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'originCc':{'type':Sequelize[_0x87a1('0x2')](_0x87a1('0x3'))},'originChannel':{'type':Sequelize[_0x87a1('0x5')](_0x87a1('0xa'),_0x87a1('0xb')),'defaultValue':_0x87a1('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 68f3fba..3952b13 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 _0x3c81=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','include','findAll','rows','params','rawAttributes','options','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','acceptMessage','reject','mail','UserId','user','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','Sequelize','QueryTypes','contact','User','agent','fullname','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','unlinkSync','eml-format','moment','util','path','lodash','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','stack','name','send','map','MailMessage','type','key','model','keys','query','filters'];(function(_0x113f73,_0xeb08fa){var _0x2fd726=function(_0x15a663){while(--_0x15a663){_0x113f73['push'](_0x113f73['shift']());}};_0x2fd726(++_0xeb08fa);}(_0x3c81,0xec));var _0x13c8=function(_0x18e5fb,_0x23c7a3){_0x18e5fb=_0x18e5fb-0x0;var _0x4e7301=_0x3c81[_0x18e5fb];return _0x4e7301;};'use strict';var emlformat=require(_0x13c8('0x0'));var moment=require(_0x13c8('0x1'));var util=require(_0x13c8('0x2'));var path=require(_0x13c8('0x3'));var fs=require('fs');var _=require(_0x13c8('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x13c8('0x5'));var interactionService=require(_0x13c8('0x6'));var qs=require(_0x13c8('0x7'));var logger=require(_0x13c8('0x8'))(_0x13c8('0x9'));var interaction_log=require('../../config/logger')(_0x13c8('0xa'));var config=require(_0x13c8('0xb'));var db=require(_0x13c8('0xc'))['db'];config[_0x13c8('0xd')]=_[_0x13c8('0xe')](config[_0x13c8('0xd')],{'host':_0x13c8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13c8('0xd')]));var htmlEntities=require(_0x13c8('0x10'));require(_0x13c8('0x11'))[_0x13c8('0x12')](socket);var jayson=require(_0x13c8('0x13'));var client=jayson[_0x13c8('0x14')][_0x13c8('0x15')]({'port':0x232c});var client9003=jayson[_0x13c8('0x14')]['http']({'port':0x232b});var client9002=jayson[_0x13c8('0x14')][_0x13c8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4fcd4b,_0x4b905e,_0x2db611,_0x4b9b5f){return new Promise(function(_0x26c362,_0x9e1567){var _0x2df086=_0x4b9b5f||client;return _0x2df086['request'](_0x4fcd4b,_0x2db611)[_0x13c8('0x16')](function(_0x45b5c9){logger[_0x13c8('0x17')](_0x13c8('0x18'),_0x4b905e,_0x13c8('0x19'));logger[_0x13c8('0x1a')](_0x13c8('0x1b'),_0x4b905e,_0x13c8('0x19'),JSON[_0x13c8('0x1c')](_0x45b5c9));if(_0x45b5c9[_0x13c8('0x1d')]){if(_0x45b5c9[_0x13c8('0x1d')]['code']===0x1f4){logger[_0x13c8('0x1d')](_0x13c8('0x18'),_0x4b905e,_0x45b5c9[_0x13c8('0x1d')][_0x13c8('0x1e')]);return _0x9e1567(_0x45b5c9[_0x13c8('0x1d')][_0x13c8('0x1e')]);}logger[_0x13c8('0x1d')]('MailMessage,\x20%s,\x20%s',_0x4b905e,_0x45b5c9[_0x13c8('0x1d')][_0x13c8('0x1e')]);return _0x26c362(_0x45b5c9['error'][_0x13c8('0x1e')]);}else{logger['info'](_0x13c8('0x18'),_0x4b905e,_0x13c8('0x19'));_0x26c362(_0x45b5c9['result'][_0x13c8('0x1e')]);}})[_0x13c8('0x1f')](function(_0x200f4f){logger['error'](_0x13c8('0x18'),_0x4b905e,_0x200f4f);_0x9e1567(_0x200f4f);});});}function respondWithResult(_0x474c48,_0x5d6bdd){_0x5d6bdd=_0x5d6bdd||0xc8;return function(_0x3e7d07){if(_0x3e7d07){return _0x474c48[_0x13c8('0x20')](_0x5d6bdd)[_0x13c8('0x21')](_0x3e7d07);}};}function respondWithFilteredResult(_0x4d626b,_0xc21606){return function(_0x4eb667){if(_0x4eb667){var _0x21f3a7=typeof _0xc21606[_0x13c8('0x22')]==='undefined'&&typeof _0xc21606[_0x13c8('0x23')]===_0x13c8('0x24');var _0x864225=_0x4eb667[_0x13c8('0x25')];var _0x3edf23=_0x21f3a7?0x0:_0xc21606[_0x13c8('0x22')];var _0x26dfea=_0x21f3a7?_0x4eb667[_0x13c8('0x25')]:_0xc21606[_0x13c8('0x22')]+_0xc21606[_0x13c8('0x23')];var _0x62a81e;if(_0x26dfea>=_0x864225){_0x26dfea=_0x864225;_0x62a81e=0xc8;}else{_0x62a81e=0xce;}_0x4d626b[_0x13c8('0x20')](_0x62a81e);return _0x4d626b[_0x13c8('0x26')](_0x13c8('0x27'),_0x3edf23+'-'+_0x26dfea+'/'+_0x864225)[_0x13c8('0x21')](_0x4eb667);}return null;};}function saveUpdates(_0x444923){return function(_0x3c5dfc){if(_0x3c5dfc){return _0x3c5dfc[_0x13c8('0x28')](_0x444923)[_0x13c8('0x16')](function(_0x4a5f82){return _0x4a5f82;});}return null;};}function removeEntity(_0x53209d){return function(_0x512f6f){if(_0x512f6f){return _0x512f6f['destroy']()[_0x13c8('0x16')](function(){_0x53209d[_0x13c8('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28af36){return function(_0x33c27f){if(!_0x33c27f){_0x28af36['sendStatus'](0x194);}return _0x33c27f;};}function handleError(_0x4b65ed,_0x317979){_0x317979=_0x317979||0x1f4;return function(_0x15a355){logger[_0x13c8('0x1d')](_0x15a355[_0x13c8('0x29')]);if(_0x15a355[_0x13c8('0x2a')]){delete _0x15a355[_0x13c8('0x2a')];}_0x4b65ed['status'](_0x317979)[_0x13c8('0x2b')](_0x15a355);};}exports['index']=function(_0x3fdca3,_0x180559){var _0x45e433={},_0x497368={},_0x55f211={'count':0x0,'rows':[]};var _0x447446=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x4932d2){return{'name':_0x4932d2['fieldName'],'type':_0x4932d2[_0x13c8('0x2e')][_0x13c8('0x2f')]};});_0x497368[_0x13c8('0x30')]=_['map'](_0x447446,_0x13c8('0x2a'));_0x497368['query']=_[_0x13c8('0x31')](_0x3fdca3[_0x13c8('0x32')]);_0x497368[_0x13c8('0x33')]=_[_0x13c8('0x34')](_0x497368[_0x13c8('0x30')],_0x497368[_0x13c8('0x32')]);_0x45e433[_0x13c8('0x35')]=_[_0x13c8('0x34')](_0x497368[_0x13c8('0x30')],qs[_0x13c8('0x36')](_0x3fdca3[_0x13c8('0x32')][_0x13c8('0x36')]));_0x45e433['attributes']=_0x45e433[_0x13c8('0x35')][_0x13c8('0x37')]?_0x45e433[_0x13c8('0x35')]:_0x497368['model'];if(!_0x3fdca3[_0x13c8('0x32')][_0x13c8('0x38')](_0x13c8('0x39'))){_0x45e433['limit']=qs[_0x13c8('0x23')](_0x3fdca3['query']['limit']);_0x45e433[_0x13c8('0x22')]=qs[_0x13c8('0x22')](_0x3fdca3[_0x13c8('0x32')][_0x13c8('0x22')]);}_0x45e433['order']=qs[_0x13c8('0x3a')](_0x3fdca3['query'][_0x13c8('0x3a')]);_0x45e433[_0x13c8('0x3b')]=qs[_0x13c8('0x33')](_['pick'](_0x3fdca3[_0x13c8('0x32')],_0x497368[_0x13c8('0x33')]),_0x447446);if(_0x3fdca3[_0x13c8('0x32')]['filter']){_0x45e433[_0x13c8('0x3b')]=_[_0x13c8('0x3c')](_0x45e433[_0x13c8('0x3b')],{'$or':_[_0x13c8('0x2c')](_0x447446,function(_0x5758ec){if(_0x5758ec[_0x13c8('0x2e')]!==_0x13c8('0x3d')){var _0x3ca02e={};_0x3ca02e[_0x5758ec[_0x13c8('0x2a')]]={'$like':'%'+_0x3fdca3[_0x13c8('0x32')]['filter']+'%'};return _0x3ca02e;}})});}_0x45e433=_[_0x13c8('0x3c')]({},_0x45e433,_0x3fdca3['options']);var _0x33aa92={'where':_0x45e433[_0x13c8('0x3b')]};return db[_0x13c8('0x2d')]['count'](_0x33aa92)[_0x13c8('0x16')](function(_0x1b52e5){_0x55f211[_0x13c8('0x25')]=_0x1b52e5;if(_0x3fdca3[_0x13c8('0x32')]['includeAll']){_0x45e433[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x45e433);})[_0x13c8('0x16')](function(_0xa32684){_0x55f211[_0x13c8('0x40')]=_0xa32684;return _0x55f211;})[_0x13c8('0x16')](respondWithFilteredResult(_0x180559,_0x45e433))['catch'](handleError(_0x180559,null));};exports['show']=function(_0x152484,_0x24c989){var _0x28f371={'raw':!![],'where':{'id':_0x152484[_0x13c8('0x41')]['id']}},_0x5934f5={};_0x5934f5[_0x13c8('0x30')]=_[_0x13c8('0x31')](db['MailMessage'][_0x13c8('0x42')]);_0x5934f5[_0x13c8('0x32')]=_[_0x13c8('0x31')](_0x152484['query']);_0x5934f5[_0x13c8('0x33')]=_[_0x13c8('0x34')](_0x5934f5[_0x13c8('0x30')],_0x5934f5[_0x13c8('0x32')]);_0x28f371['attributes']=_[_0x13c8('0x34')](_0x5934f5[_0x13c8('0x30')],qs['fields'](_0x152484['query'][_0x13c8('0x36')]));_0x28f371[_0x13c8('0x35')]=_0x28f371['attributes'][_0x13c8('0x37')]?_0x28f371[_0x13c8('0x35')]:_0x5934f5[_0x13c8('0x30')];if(_0x152484[_0x13c8('0x32')]['includeAll']){_0x28f371[_0x13c8('0x3e')]=[{'all':!![]}];}_0x28f371=_[_0x13c8('0x3c')]({},_0x28f371,_0x152484[_0x13c8('0x43')]);return db[_0x13c8('0x2d')][_0x13c8('0x44')](_0x28f371)[_0x13c8('0x16')](handleEntityNotFound(_0x24c989,null))['then'](respondWithResult(_0x24c989,null))[_0x13c8('0x1f')](handleError(_0x24c989,null));};exports[_0x13c8('0x28')]=function(_0x4b4918,_0x25fc8b){if(_0x4b4918['body']['id']){delete _0x4b4918[_0x13c8('0x45')]['id'];}return db[_0x13c8('0x2d')]['find']({'where':{'id':_0x4b4918[_0x13c8('0x41')]['id']}})[_0x13c8('0x16')](handleEntityNotFound(_0x25fc8b,null))['then'](saveUpdates(_0x4b4918[_0x13c8('0x45')],null))['then'](respondWithResult(_0x25fc8b,null))[_0x13c8('0x1f')](handleError(_0x25fc8b,null));};exports['destroy']=function(_0x353c5a,_0x326d34){return db[_0x13c8('0x2d')][_0x13c8('0x44')]({'where':{'id':_0x353c5a['params']['id']}})[_0x13c8('0x16')](handleEntityNotFound(_0x326d34,null))[_0x13c8('0x16')](removeEntity(_0x326d34,null))['catch'](handleError(_0x326d34,null));};exports['describe']=function(_0x3417d9,_0x2fa154){return db[_0x13c8('0x2d')][_0x13c8('0x46')]()[_0x13c8('0x16')](respondWithResult(_0x2fa154,null))[_0x13c8('0x1f')](handleError(_0x2fa154,null));};exports[_0x13c8('0x47')]=function(_0x2ccd89,_0x5e076c){return db['MailMessage'][_0x13c8('0x47')](_0x2ccd89['body'])[_0x13c8('0x16')](function(_0x42b380){if(_0x42b380){if(_0x42b380[_0x13c8('0x48')]===_0x13c8('0x49')&&!_0x42b380[_0x13c8('0x4a')]){var _0x6e6ce7,_0x41efb8,_0x40b60e;if(_0x2ccd89[_0x13c8('0x45')]['to']){_0x41efb8=_0x2ccd89['body']['to'][_0x13c8('0x4b')](',')[0x0];}return db[_0x13c8('0x4c')][_0x13c8('0x4d')]({'where':{'id':_0x42b380[_0x13c8('0x4e')]},'include':[{'model':db[_0x13c8('0x4f')],'as':_0x13c8('0x50'),'include':[{'model':db[_0x13c8('0x51')],'as':_0x13c8('0x52'),'where':{'email':_0x41efb8},'limit':0x1,'order':[[_0x13c8('0x53'),_0x13c8('0x54')]]}]},{'model':db[_0x13c8('0x55')],'as':_0x13c8('0x56'),'raw':!![],'include':[{'model':db[_0x13c8('0x57')],'as':_0x13c8('0x57'),'raw':!![]}]}]})[_0x13c8('0x16')](function(_0x22b34f){_0x6e6ce7=_0x22b34f;if(!_0x6e6ce7||!_0x6e6ce7[_0x13c8('0x56')])return;var _0x2d8d17=_0x6e6ce7[_0x13c8('0x58')]();if(_0x2ccd89[_0x13c8('0x45')][_0x13c8('0x59')]&&_0x2ccd89[_0x13c8('0x45')]['attachments']['length']){for(var _0x10b0b1=0x0;_0x10b0b1<_0x2ccd89['body'][_0x13c8('0x59')][_0x13c8('0x37')];_0x10b0b1+=0x1){_0x2ccd89[_0x13c8('0x45')][_0x13c8('0x59')][_0x10b0b1]={'filename':_0x2ccd89[_0x13c8('0x45')][_0x13c8('0x59')][_0x10b0b1][_0x13c8('0x2a')],'path':path[_0x13c8('0x5a')](config[_0x13c8('0x5b')],'server/files/attachments',_0x2ccd89['body'][_0x13c8('0x59')][_0x10b0b1][_0x13c8('0x5c')])};}}_0x40b60e={'account':_0x2d8d17,'message':_0x2ccd89[_0x13c8('0x45')]};return;})[_0x13c8('0x16')](function(){if(_0x6e6ce7[_0x13c8('0x50')]){if(_0x6e6ce7[_0x13c8('0x50')][_0x13c8('0x52')]['length']){return _0x6e6ce7['List'][_0x13c8('0x52')][0x0];}else{return db[_0x13c8('0x51')][_0x13c8('0x47')](_[_0x13c8('0xe')](_0x2ccd89[_0x13c8('0x45')],{'firstName':_0x2ccd89[_0x13c8('0x45')]['to'],'email':_0x2ccd89[_0x13c8('0x45')]['to'],'phone':_0x2ccd89['body']['to'],'ListId':_0x6e6ce7['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x40b60e){return respondWithRpcPromise(_0x13c8('0x5d'),_0x13c8('0x5e'),_0x40b60e,client9003)[_0x13c8('0x16')](function(_0x4a3da2){return _0x42b380[_0x13c8('0x28')]({'read':!![],'messageId':_0x4a3da2['messageId'],'sentAt':moment()[_0x13c8('0x5f')](_0x13c8('0x60'))});})[_0x13c8('0x1f')](function(_0x40dde0){logger[_0x13c8('0x1d')]('%s',JSON[_0x13c8('0x1c')](_0x40dde0));return _0x42b380;});}return _0x42b380;});}return _0x42b380;}})[_0x13c8('0x16')](respondWithResult(_0x5e076c,0xc9))[_0x13c8('0x1f')](handleError(_0x5e076c,null));};exports['accept']=function(_0x3de788,_0x24f0a2){var _0x4232ae='mail';return interactionService[_0x13c8('0x61')](_0x3de788,_0x4232ae)[_0x13c8('0x16')](respondWithResult(_0x24f0a2,null))[_0x13c8('0x1f')](handleError(_0x24f0a2,null));};exports[_0x13c8('0x62')]=function(_0x1feda9,_0x36351f){var _0xda3a31={'agent':{},'channel':_0x13c8('0x63')};if(_0x1feda9['body']['id']){delete _0x1feda9[_0x13c8('0x45')]['id'];}_0x1feda9[_0x13c8('0x45')][_0x13c8('0x64')]=_0x1feda9[_0x13c8('0x45')][_0x13c8('0x64')]||_0x1feda9[_0x13c8('0x65')]['id'];_0xda3a31['agent']['id']=_0x1feda9[_0x13c8('0x45')]['UserId'];return db['MailMessage'][_0x13c8('0x44')]({'where':{'id':_0x1feda9[_0x13c8('0x41')]['id'],'UserId':null}})[_0x13c8('0x16')](handleEntityNotFound(_0x36351f,null))[_0x13c8('0x16')](function(_0x10dc7b){if(_0x10dc7b){_0xda3a31[_0x13c8('0x1e')]=_0x10dc7b['get']({'plain':!![]});return db[_0x13c8('0x66')][_0x13c8('0x44')]({'where':{'id':_0x10dc7b[_0x13c8('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x36351f,null))[_0x13c8('0x16')](function(_0x2b2f49){if(_0x2b2f49){_0xda3a31[_0x13c8('0x68')]=_0x2b2f49[_0x13c8('0x69')]({'plain':!![]});interaction_log[_0x13c8('0x17')](_0x13c8('0x6a'),_0x1feda9[_0x13c8('0x65')]['id'],_0x1feda9['user'][_0x13c8('0x2a')],_0x1feda9['user'][_0x13c8('0x6b')],_0xda3a31[_0x13c8('0x68')]['id'],_0x1feda9[_0x13c8('0x45')]?JSON[_0x13c8('0x1c')](_0x1feda9['body']):'null');return respondWithRpcPromise(_0x13c8('0x6c'),_0x13c8('0x6d'),_0xda3a31);}return null;})[_0x13c8('0x16')](function(_0x311b92){var _0x4e71ec='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x311b92[_0x13c8('0x1e')][_0x13c8('0x6e')];return db['sequelize'][_0x13c8('0x32')](_0x4e71ec,{'type':db[_0x13c8('0x6f')][_0x13c8('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x31a565){return _0x31a565;});})['then'](function(_0x25b11e){if(_0x25b11e){_0xda3a31[_0x13c8('0x1e')][_0x13c8('0x71')]=_0x25b11e[0x0];if(!_0x1feda9[_0x13c8('0x45')][_0x13c8('0x64')])return;return db[_0x13c8('0x72')][_0x13c8('0x44')]({'where':{'id':_0x1feda9['body']['UserId'],'role':_0x13c8('0x73')},'attributes':['id',_0x13c8('0x2a'),_0x13c8('0x74'),'email',_0x13c8('0x75')],'raw':!![]});}return null;})[_0x13c8('0x16')](function(_0x326ee5){if(!_0x326ee5)return null;_0xda3a31[_0x13c8('0x1e')][_0x13c8('0x73')]=_0x326ee5;return _0xda3a31;})[_0x13c8('0x16')](function(_0x329e3a){if(_0x329e3a){_0x329e3a['message'][_0x13c8('0x76')]=util[_0x13c8('0x5f')](_0x13c8('0x77'),_0x1feda9[_0x13c8('0x65')][_0x13c8('0x2a')]);_0x329e3a[_0x13c8('0x1e')][_0x13c8('0x78')]=_0xda3a31[_0x13c8('0x78')];_0x329e3a['message'][_0x13c8('0x79')]=_0xda3a31[_0x13c8('0x78')];_0x329e3a[_0x13c8('0x1e')][_0x13c8('0x7a')]=_0x13c8('0x62');_0x329e3a['message']['body']=htmlToText[_0x13c8('0x7b')](_0xda3a31[_0x13c8('0x1e')][_0x13c8('0x45')]);respondWithRpcPromise(_0x13c8('0x7c'),_0x13c8('0x7c'),{'event':_0x13c8('0x7d'),'message':_0x329e3a[_0x13c8('0x1e')]},client9002);return _0xda3a31;}return null;})[_0x13c8('0x16')](respondWithResult(_0x36351f,null))[_0x13c8('0x1f')](handleError(_0x36351f,null));};exports[_0x13c8('0x7e')]=function(_0x23276f,_0x7acd52){var _0x1102de=moment()[_0x13c8('0x7f')]()[_0x13c8('0x80')]();var _0x4a8cb3=path[_0x13c8('0x5a')](config[_0x13c8('0x5b')],_0x13c8('0x81'),_0x13c8('0x82'),'tmp');var _0x59a820=path[_0x13c8('0x5a')](config['root'],'server',_0x13c8('0x82'),_0x13c8('0x59'));var _0x3257de=util['format'](_0x13c8('0x83'),_0x1102de);return db[_0x13c8('0x2d')][_0x13c8('0x44')]({'where':{'id':_0x23276f[_0x13c8('0x41')]['id']},'attributes':['id','body',_0x13c8('0x84'),'to','cc',_0x13c8('0x85'),_0x13c8('0x86'),'createdAt'],'include':_0x23276f[_0x13c8('0x32')][_0x13c8('0x59')]?[{'model':db['Attachment'],'as':_0x13c8('0x87')}]:undefined})[_0x13c8('0x16')](handleEntityNotFound(_0x7acd52,null))['then'](function(_0x52fd24){if(_0x52fd24){var _0x175b21=_0x52fd24;var _0x36de6e={'from':_0x175b21[_0x13c8('0x84')],'to':_0x175b21['to'],'subject':_0x175b21[_0x13c8('0x86')],'html':htmlEntities[_0x13c8('0x88')](_0x175b21[_0x13c8('0x45')]),'headers':{'Date':moment(_0x175b21[_0x13c8('0x89')])[_0x13c8('0x5f')](_0x13c8('0x8a'))},'attachments':[]};if(_0x52fd24['cc']){_0x36de6e[_0x13c8('0x8b')]['Cc']=_0x52fd24['cc'];}if(_0x52fd24['bcc']){_0x36de6e[_0x13c8('0x8b')]['Bcc']=_0x52fd24[_0x13c8('0x85')];}return new Promise(function(_0x907329,_0x11031f){if(_0x52fd24[_0x13c8('0x87')]){for(var _0x509bee=0x0;_0x509bee<_0x52fd24['Attachments'][_0x13c8('0x37')];_0x509bee++){var _0x12d5e0=_0x52fd24['Attachments'][_0x509bee];var _0x51319b=path[_0x13c8('0x5a')](_0x59a820,_0x12d5e0[_0x13c8('0x5c')]);if(fs[_0x13c8('0x8c')](_0x51319b)){_0x36de6e[_0x13c8('0x59')][_0x13c8('0x8d')]({'name':_0x12d5e0[_0x13c8('0x2a')],'contentType':_0x12d5e0[_0x13c8('0x2e')],'data':fs['readFileSync'](_0x51319b)});}}}emlformat[_0x13c8('0x8e')](_0x36de6e,function(_0x314ff6,_0x1fe156){if(_0x314ff6)return _0x11031f(_0x314ff6);fs['writeFileSync'](path[_0x13c8('0x5a')](_0x4a8cb3,_0x3257de),_0x1fe156);return _0x907329(_0x1fe156);});});}})[_0x13c8('0x16')](function(_0x2c3a3a){if(_0x2c3a3a){return _0x7acd52[_0x13c8('0x7e')](path[_0x13c8('0x5a')](_0x4a8cb3,_0x3257de),_0x3257de,function(_0x235dbd){if(!_0x235dbd)fs[_0x13c8('0x8f')](path[_0x13c8('0x5a')](_0x4a8cb3,_0x3257de));});}})[_0x13c8('0x1f')](handleError(_0x7acd52,null));}; \ No newline at end of file +var _0x47c9=['decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','push','readFileSync','build','eml-format','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','set','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','update','body','describe','create','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','download','toString','join','files','tmp','server','message-%s.eml','from','subject','Attachment','Attachments'];(function(_0x2996d9,_0x761881){var _0xecf6ff=function(_0x432c7d){while(--_0x432c7d){_0x2996d9['push'](_0x2996d9['shift']());}};_0xecf6ff(++_0x761881);}(_0x47c9,0x13a));var _0x947c=function(_0x4c150a,_0x1e6c73){_0x4c150a=_0x4c150a-0x0;var _0x5f52e6=_0x47c9[_0x4c150a];return _0x5f52e6;};'use strict';var emlformat=require(_0x947c('0x0'));var moment=require(_0x947c('0x1'));var util=require(_0x947c('0x2'));var path=require(_0x947c('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x947c('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0x947c('0x5'));var qs=require(_0x947c('0x6'));var logger=require(_0x947c('0x7'))('api');var interaction_log=require(_0x947c('0x7'))(_0x947c('0x8'));var config=require(_0x947c('0x9'));var db=require(_0x947c('0xa'))['db'];config[_0x947c('0xb')]=_[_0x947c('0xc')](config[_0x947c('0xb')],{'host':_0x947c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x947c('0xb')]));var htmlEntities=require(_0x947c('0xe'));require(_0x947c('0xf'))[_0x947c('0x10')](socket);var jayson=require(_0x947c('0x11'));var client=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232c});var client9003=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232b});var client9002=jayson[_0x947c('0x12')][_0x947c('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6b6,_0x5a7942,_0x39ca66,_0x8b52f9){return new Promise(function(_0x3bfc9f,_0x41a389){var _0x204922=_0x8b52f9||client;return _0x204922[_0x947c('0x14')](_0x1eb6b6,_0x39ca66)[_0x947c('0x15')](function(_0x53df4c){logger[_0x947c('0x16')](_0x947c('0x17'),_0x5a7942,_0x947c('0x18'));logger['debug'](_0x947c('0x19'),_0x5a7942,_0x947c('0x18'),JSON[_0x947c('0x1a')](_0x53df4c));if(_0x53df4c['error']){if(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1c')]===0x1f4){logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);return _0x41a389(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);}logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x53df4c['error'][_0x947c('0x1d')]);return _0x3bfc9f(_0x53df4c[_0x947c('0x1b')][_0x947c('0x1d')]);}else{logger[_0x947c('0x16')](_0x947c('0x17'),_0x5a7942,_0x947c('0x18'));_0x3bfc9f(_0x53df4c[_0x947c('0x1e')][_0x947c('0x1d')]);}})[_0x947c('0x1f')](function(_0x3b7b73){logger[_0x947c('0x1b')](_0x947c('0x17'),_0x5a7942,_0x3b7b73);_0x41a389(_0x3b7b73);});});}function respondWithResult(_0x4908b9,_0x1695d3){_0x1695d3=_0x1695d3||0xc8;return function(_0x1e2fd2){if(_0x1e2fd2){return _0x4908b9[_0x947c('0x20')](_0x1695d3)[_0x947c('0x21')](_0x1e2fd2);}};}function respondWithFilteredResult(_0x14dc26,_0x45d54a){return function(_0x5426c5){if(_0x5426c5){var _0x2444a4=typeof _0x45d54a[_0x947c('0x22')]===_0x947c('0x23')&&typeof _0x45d54a['limit']==='undefined';var _0x380180=_0x5426c5[_0x947c('0x24')];var _0x156c7d=_0x2444a4?0x0:_0x45d54a['offset'];var _0x341c67=_0x2444a4?_0x5426c5['count']:_0x45d54a[_0x947c('0x22')]+_0x45d54a['limit'];var _0x492c67;if(_0x341c67>=_0x380180){_0x341c67=_0x380180;_0x492c67=0xc8;}else{_0x492c67=0xce;}_0x14dc26[_0x947c('0x20')](_0x492c67);return _0x14dc26[_0x947c('0x25')]('Content-Range',_0x156c7d+'-'+_0x341c67+'/'+_0x380180)[_0x947c('0x21')](_0x5426c5);}return null;};}function saveUpdates(_0x412efb){return function(_0x3f19e6){if(_0x3f19e6){return _0x3f19e6['update'](_0x412efb)[_0x947c('0x15')](function(_0x510b55){return _0x510b55;});}return null;};}function removeEntity(_0x588f17){return function(_0x246c2a){if(_0x246c2a){return _0x246c2a[_0x947c('0x26')]()[_0x947c('0x15')](function(){_0x588f17[_0x947c('0x20')](0xcc)[_0x947c('0x27')]();});}};}function handleEntityNotFound(_0x2cebd9){return function(_0x1c58c0){if(!_0x1c58c0){_0x2cebd9[_0x947c('0x28')](0x194);}return _0x1c58c0;};}function handleError(_0x203b96,_0x1c206f){_0x1c206f=_0x1c206f||0x1f4;return function(_0x465b95){logger[_0x947c('0x1b')](_0x465b95['stack']);if(_0x465b95[_0x947c('0x29')]){delete _0x465b95['name'];}_0x203b96[_0x947c('0x20')](_0x1c206f)[_0x947c('0x2a')](_0x465b95);};}exports[_0x947c('0x2b')]=function(_0x53af96,_0x22aa25){var _0x39b4d5={},_0x45e324={},_0x57903b={'count':0x0,'rows':[]};var _0x153e97=_[_0x947c('0x2c')](db[_0x947c('0x2d')][_0x947c('0x2e')],function(_0x21912b){return{'name':_0x21912b[_0x947c('0x2f')],'type':_0x21912b[_0x947c('0x30')][_0x947c('0x31')]};});_0x45e324['model']=_[_0x947c('0x2c')](_0x153e97,_0x947c('0x29'));_0x45e324['query']=_[_0x947c('0x32')](_0x53af96['query']);_0x45e324[_0x947c('0x33')]=_[_0x947c('0x34')](_0x45e324[_0x947c('0x35')],_0x45e324[_0x947c('0x36')]);_0x39b4d5['attributes']=_[_0x947c('0x34')](_0x45e324[_0x947c('0x35')],qs['fields'](_0x53af96[_0x947c('0x36')][_0x947c('0x37')]));_0x39b4d5[_0x947c('0x38')]=_0x39b4d5[_0x947c('0x38')]['length']?_0x39b4d5[_0x947c('0x38')]:_0x45e324[_0x947c('0x35')];if(!_0x53af96[_0x947c('0x36')][_0x947c('0x39')](_0x947c('0x3a'))){_0x39b4d5['limit']=qs[_0x947c('0x3b')](_0x53af96[_0x947c('0x36')]['limit']);_0x39b4d5[_0x947c('0x22')]=qs[_0x947c('0x22')](_0x53af96[_0x947c('0x36')][_0x947c('0x22')]);}_0x39b4d5[_0x947c('0x3c')]=qs['sort'](_0x53af96['query'][_0x947c('0x3d')]);_0x39b4d5[_0x947c('0x3e')]=qs['filters'](_['pick'](_0x53af96[_0x947c('0x36')],_0x45e324['filters']),_0x153e97);if(_0x53af96['query'][_0x947c('0x3f')]){_0x39b4d5[_0x947c('0x3e')]=_[_0x947c('0x40')](_0x39b4d5['where'],{'$or':_[_0x947c('0x2c')](_0x153e97,function(_0xa04ec5){if(_0xa04ec5[_0x947c('0x30')]!==_0x947c('0x41')){var _0x1b4c54={};_0x1b4c54[_0xa04ec5[_0x947c('0x29')]]={'$like':'%'+_0x53af96[_0x947c('0x36')][_0x947c('0x3f')]+'%'};return _0x1b4c54;}})});}_0x39b4d5=_[_0x947c('0x40')]({},_0x39b4d5,_0x53af96[_0x947c('0x42')]);var _0x410c8a={'where':_0x39b4d5['where']};return db['MailMessage'][_0x947c('0x24')](_0x410c8a)['then'](function(_0x21232c){_0x57903b['count']=_0x21232c;if(_0x53af96['query'][_0x947c('0x43')]){_0x39b4d5[_0x947c('0x44')]=[{'all':!![]}];}return db[_0x947c('0x2d')][_0x947c('0x45')](_0x39b4d5);})[_0x947c('0x15')](function(_0x542e20){_0x57903b[_0x947c('0x46')]=_0x542e20;return _0x57903b;})[_0x947c('0x15')](respondWithFilteredResult(_0x22aa25,_0x39b4d5))[_0x947c('0x1f')](handleError(_0x22aa25,null));};exports['show']=function(_0x1c8e7a,_0x2fdfa9){var _0x4bfb94={'raw':!![],'where':{'id':_0x1c8e7a[_0x947c('0x47')]['id']}},_0x108712={};_0x108712[_0x947c('0x35')]=_['keys'](db[_0x947c('0x2d')][_0x947c('0x2e')]);_0x108712[_0x947c('0x36')]=_[_0x947c('0x32')](_0x1c8e7a['query']);_0x108712[_0x947c('0x33')]=_[_0x947c('0x34')](_0x108712['model'],_0x108712[_0x947c('0x36')]);_0x4bfb94[_0x947c('0x38')]=_[_0x947c('0x34')](_0x108712[_0x947c('0x35')],qs[_0x947c('0x37')](_0x1c8e7a[_0x947c('0x36')][_0x947c('0x37')]));_0x4bfb94['attributes']=_0x4bfb94[_0x947c('0x38')][_0x947c('0x48')]?_0x4bfb94[_0x947c('0x38')]:_0x108712['model'];if(_0x1c8e7a[_0x947c('0x36')][_0x947c('0x43')]){_0x4bfb94[_0x947c('0x44')]=[{'all':!![]}];}_0x4bfb94=_[_0x947c('0x40')]({},_0x4bfb94,_0x1c8e7a[_0x947c('0x42')]);return db['MailMessage'][_0x947c('0x49')](_0x4bfb94)[_0x947c('0x15')](handleEntityNotFound(_0x2fdfa9,null))[_0x947c('0x15')](respondWithResult(_0x2fdfa9,null))[_0x947c('0x1f')](handleError(_0x2fdfa9,null));};exports[_0x947c('0x4a')]=function(_0xed9912,_0x332278){if(_0xed9912[_0x947c('0x4b')]['id']){delete _0xed9912[_0x947c('0x4b')]['id'];}return db[_0x947c('0x2d')]['find']({'where':{'id':_0xed9912[_0x947c('0x47')]['id']}})[_0x947c('0x15')](handleEntityNotFound(_0x332278,null))[_0x947c('0x15')](saveUpdates(_0xed9912[_0x947c('0x4b')],null))['then'](respondWithResult(_0x332278,null))[_0x947c('0x1f')](handleError(_0x332278,null));};exports[_0x947c('0x26')]=function(_0x45dae1,_0xd5c937){return db[_0x947c('0x2d')][_0x947c('0x49')]({'where':{'id':_0x45dae1['params']['id']}})[_0x947c('0x15')](handleEntityNotFound(_0xd5c937,null))[_0x947c('0x15')](removeEntity(_0xd5c937,null))[_0x947c('0x1f')](handleError(_0xd5c937,null));};exports[_0x947c('0x4c')]=function(_0x4bcaaa,_0x518b5c){return db[_0x947c('0x2d')][_0x947c('0x4c')]()[_0x947c('0x15')](respondWithResult(_0x518b5c,null))['catch'](handleError(_0x518b5c,null));};exports[_0x947c('0x4d')]=function(_0x1ba7d7,_0x44b11d){return db[_0x947c('0x2d')][_0x947c('0x4d')](_0x1ba7d7[_0x947c('0x4b')])['then'](function(_0x35713b){if(_0x35713b){if(_0x35713b['direction']===_0x947c('0x4e')&&!_0x35713b[_0x947c('0x4f')]){var _0x705e12,_0x2e1bc2,_0x38bf72;if(_0x1ba7d7[_0x947c('0x4b')]['to']){_0x2e1bc2=_0x1ba7d7[_0x947c('0x4b')]['to'][_0x947c('0x50')](',')[0x0];}return db[_0x947c('0x51')][_0x947c('0x52')]({'where':{'id':_0x35713b['MailAccountId']},'include':[{'model':db[_0x947c('0x53')],'as':_0x947c('0x54'),'include':[{'model':db[_0x947c('0x55')],'as':_0x947c('0x56'),'where':{'email':_0x2e1bc2},'limit':0x1,'order':[[_0x947c('0x57'),'DESC']]}]},{'model':db[_0x947c('0x58')],'as':_0x947c('0x59'),'raw':!![],'include':[{'model':db[_0x947c('0x5a')],'as':_0x947c('0x5a'),'raw':!![]}]}]})[_0x947c('0x15')](function(_0x60e83f){_0x705e12=_0x60e83f;if(!_0x705e12||!_0x705e12[_0x947c('0x59')])return;var _0x1d4041=_0x705e12[_0x947c('0x5b')]();if(_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')]&&_0x1ba7d7[_0x947c('0x4b')]['attachments']['length']){for(var _0x75ec55=0x0;_0x75ec55<_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')][_0x947c('0x48')];_0x75ec55+=0x1){_0x1ba7d7[_0x947c('0x4b')][_0x947c('0x5c')][_0x75ec55]={'filename':_0x1ba7d7[_0x947c('0x4b')]['attachments'][_0x75ec55][_0x947c('0x29')],'path':path['join'](config[_0x947c('0x5d')],'server/files/attachments',_0x1ba7d7[_0x947c('0x4b')]['attachments'][_0x75ec55]['basename'])};}}_0x38bf72={'account':_0x1d4041,'message':_0x1ba7d7[_0x947c('0x4b')]};return;})[_0x947c('0x15')](function(){if(_0x705e12[_0x947c('0x54')]){if(_0x705e12[_0x947c('0x54')][_0x947c('0x56')]['length']){return _0x705e12[_0x947c('0x54')][_0x947c('0x56')][0x0];}else{return db[_0x947c('0x55')][_0x947c('0x4d')](_['defaults'](_0x1ba7d7[_0x947c('0x4b')],{'firstName':_0x1ba7d7[_0x947c('0x4b')]['to'],'email':_0x1ba7d7[_0x947c('0x4b')]['to'],'phone':_0x1ba7d7['body']['to'],'ListId':_0x705e12[_0x947c('0x5e')]}));}}else{throw new Error(_0x947c('0x5f'));}})[_0x947c('0x15')](function(){if(_0x38bf72){return respondWithRpcPromise(_0x947c('0x60'),_0x947c('0x61'),_0x38bf72,client9003)[_0x947c('0x15')](function(_0x306020){return _0x35713b['update']({'read':!![],'messageId':_0x306020[_0x947c('0x62')],'sentAt':moment()['format'](_0x947c('0x63'))});})[_0x947c('0x1f')](function(_0x18d78e){logger[_0x947c('0x1b')]('%s',JSON['stringify'](_0x18d78e));return _0x35713b;});}return _0x35713b;});}return _0x35713b;}})[_0x947c('0x15')](respondWithResult(_0x44b11d,0xc9))['catch'](handleError(_0x44b11d,null));};exports[_0x947c('0x64')]=function(_0x29a56a,_0xe0a6ed){var _0x9ae1c5=_0x947c('0x65');return interactionService[_0x947c('0x66')](_0x29a56a,_0x9ae1c5)[_0x947c('0x15')](respondWithResult(_0xe0a6ed,null))['catch'](handleError(_0xe0a6ed,null));};exports[_0x947c('0x67')]=function(_0x4f5d36,_0x4fc0b1){var _0x4221ed={'agent':{},'channel':_0x947c('0x65')};if(_0x4f5d36[_0x947c('0x4b')]['id']){delete _0x4f5d36['body']['id'];}_0x4f5d36[_0x947c('0x4b')][_0x947c('0x68')]=_0x4f5d36['body']['UserId']||_0x4f5d36[_0x947c('0x69')]['id'];_0x4221ed[_0x947c('0x6a')]['id']=_0x4f5d36['body'][_0x947c('0x68')];return db[_0x947c('0x2d')]['find']({'where':{'id':_0x4f5d36['params']['id'],'UserId':null}})[_0x947c('0x15')](handleEntityNotFound(_0x4fc0b1,null))[_0x947c('0x15')](function(_0x590103){if(_0x590103){_0x4221ed['message']=_0x590103[_0x947c('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x590103[_0x947c('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x4fc0b1,null))[_0x947c('0x15')](function(_0x4be54a){if(_0x4be54a){_0x4221ed[_0x947c('0x6d')]=_0x4be54a[_0x947c('0x6b')]({'plain':!![]});interaction_log[_0x947c('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4f5d36[_0x947c('0x69')]['id'],_0x4f5d36[_0x947c('0x69')][_0x947c('0x29')],_0x4f5d36[_0x947c('0x69')][_0x947c('0x6e')],_0x4221ed['interaction']['id'],_0x4f5d36['body']?JSON['stringify'](_0x4f5d36['body']):_0x947c('0x6f'));return respondWithRpcPromise(_0x947c('0x70'),_0x947c('0x71'),_0x4221ed);}return null;})['then'](function(_0x2a8b27){var _0x3ccac5=_0x947c('0x72')+_0x2a8b27[_0x947c('0x1d')][_0x947c('0x73')];return db['sequelize'][_0x947c('0x36')](_0x3ccac5,{'type':db[_0x947c('0x74')][_0x947c('0x75')][_0x947c('0x76')],'raw':!![]})[_0x947c('0x15')](function(_0x27f498){return _0x27f498;});})[_0x947c('0x15')](function(_0x35bb42){if(_0x35bb42){_0x4221ed[_0x947c('0x1d')][_0x947c('0x77')]=_0x35bb42[0x0];if(!_0x4f5d36['body'][_0x947c('0x68')])return;return db[_0x947c('0x78')][_0x947c('0x49')]({'where':{'id':_0x4f5d36[_0x947c('0x4b')][_0x947c('0x68')],'role':_0x947c('0x6a')},'attributes':['id',_0x947c('0x29'),_0x947c('0x79'),'email',_0x947c('0x7a')],'raw':!![]});}return null;})[_0x947c('0x15')](function(_0x388926){if(!_0x388926)return null;_0x4221ed[_0x947c('0x1d')][_0x947c('0x6a')]=_0x388926;return _0x4221ed;})[_0x947c('0x15')](function(_0x67244f){if(_0x67244f){_0x67244f['message'][_0x947c('0x7b')]=util[_0x947c('0x7c')](_0x947c('0x7d'),_0x4f5d36[_0x947c('0x69')]['name']);_0x67244f['message'][_0x947c('0x7e')]=_0x4221ed[_0x947c('0x7e')];_0x67244f[_0x947c('0x1d')][_0x947c('0x7f')]=_0x4221ed[_0x947c('0x7e')];_0x67244f[_0x947c('0x1d')][_0x947c('0x80')]=_0x947c('0x67');_0x67244f[_0x947c('0x1d')]['body']=htmlToText['fromString'](_0x4221ed[_0x947c('0x1d')][_0x947c('0x4b')]);respondWithRpcPromise(_0x947c('0x81'),_0x947c('0x81'),{'event':_0x947c('0x82'),'message':_0x67244f['message']},client9002);return _0x4221ed;}return null;})[_0x947c('0x15')](respondWithResult(_0x4fc0b1,null))[_0x947c('0x1f')](handleError(_0x4fc0b1,null));};exports[_0x947c('0x83')]=function(_0x10a3e4,_0x28e007){var _0x3f614f=moment()['unix']()[_0x947c('0x84')]();var _0x110be5=path[_0x947c('0x85')](config[_0x947c('0x5d')],'server',_0x947c('0x86'),_0x947c('0x87'));var _0x27732a=path['join'](config[_0x947c('0x5d')],_0x947c('0x88'),_0x947c('0x86'),'attachments');var _0x19d61d=util[_0x947c('0x7c')](_0x947c('0x89'),_0x3f614f);return db[_0x947c('0x2d')][_0x947c('0x49')]({'where':{'id':_0x10a3e4[_0x947c('0x47')]['id']},'attributes':['id',_0x947c('0x4b'),_0x947c('0x8a'),'to','cc','bcc',_0x947c('0x8b'),'createdAt'],'include':_0x10a3e4[_0x947c('0x36')][_0x947c('0x5c')]?[{'model':db[_0x947c('0x8c')],'as':_0x947c('0x8d')}]:undefined})['then'](handleEntityNotFound(_0x28e007,null))[_0x947c('0x15')](function(_0x55e283){if(_0x55e283){var _0x28636a=_0x55e283;var _0x21bf05={'from':_0x28636a[_0x947c('0x8a')],'to':_0x28636a['to'],'subject':_0x28636a[_0x947c('0x8b')],'html':htmlEntities[_0x947c('0x8e')](_0x28636a[_0x947c('0x4b')]),'headers':{'Date':moment(_0x28636a[_0x947c('0x8f')])[_0x947c('0x7c')](_0x947c('0x90'))},'attachments':[]};if(_0x55e283['cc']){_0x21bf05[_0x947c('0x91')]['Cc']=_0x55e283['cc'];}if(_0x55e283[_0x947c('0x92')]){_0x21bf05[_0x947c('0x91')][_0x947c('0x93')]=_0x55e283['bcc'];}return new Promise(function(_0x10233d,_0x477346){if(_0x55e283[_0x947c('0x8d')]){for(var _0x956faa=0x0;_0x956faa<_0x55e283['Attachments']['length'];_0x956faa++){var _0x5ae352=_0x55e283[_0x947c('0x8d')][_0x956faa];var _0x1698e8=path[_0x947c('0x85')](_0x27732a,_0x5ae352[_0x947c('0x94')]);if(fs['existsSync'](_0x1698e8)){_0x21bf05[_0x947c('0x5c')][_0x947c('0x95')]({'name':_0x5ae352[_0x947c('0x29')],'contentType':_0x5ae352[_0x947c('0x30')],'data':fs[_0x947c('0x96')](_0x1698e8)});}}}emlformat[_0x947c('0x97')](_0x21bf05,function(_0x39788c,_0x1d2b45){if(_0x39788c)return _0x477346(_0x39788c);fs['writeFileSync'](path[_0x947c('0x85')](_0x110be5,_0x19d61d),_0x1d2b45);return _0x10233d(_0x1d2b45);});});}})['then'](function(_0x5b64b5){if(_0x5b64b5){return _0x28e007[_0x947c('0x83')](path[_0x947c('0x85')](_0x110be5,_0x19d61d),_0x19d61d,function(_0xd13269){if(!_0xd13269)fs['unlinkSync'](path[_0x947c('0x85')](_0x110be5,_0x19d61d));});}})['catch'](handleError(_0x28e007,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 791f2cc..f685479 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 _0x4431=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0xd846c7,_0x3969eb){var _0x34a122=function(_0x79b51c){while(--_0x79b51c){_0xd846c7['push'](_0xd846c7['shift']());}};_0x34a122(++_0x3969eb);}(_0x4431,0x14d));var _0x1443=function(_0x2b8ba0,_0x34a738){_0x2b8ba0=_0x2b8ba0-0x0;var _0x1c832d=_0x4431[_0x2b8ba0];return _0x1c832d;};'use strict';var EventEmitter=require(_0x1443('0x0'));var MailMessage=require(_0x1443('0x1'))['db'][_0x1443('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1443('0x3')](0x0);var events={'afterCreate':_0x1443('0x4'),'afterUpdate':_0x1443('0x5'),'afterDestroy':_0x1443('0x6')};function emitEvent(_0x4942f2){return function(_0x2c7178,_0x5ad403,_0x382f82){MailMessageEvents[_0x1443('0x7')](_0x4942f2+':'+_0x2c7178['id'],_0x2c7178);MailMessageEvents[_0x1443('0x7')](_0x4942f2,_0x2c7178);_0x382f82(null);};}for(var e in events){if(events[_0x1443('0x8')](e)){var event=events[e];MailMessage[_0x1443('0x9')](e,emitEvent(event));}}module[_0x1443('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x7e3a=['hasOwnProperty','hook','events','../../mysqldb','MailMessage','emit'];(function(_0x54b3dc,_0x1ed446){var _0x5f98eb=function(_0x11edf4){while(--_0x11edf4){_0x54b3dc['push'](_0x54b3dc['shift']());}};_0x5f98eb(++_0x1ed446);}(_0x7e3a,0x1e2));var _0xa7e3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e3a[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xa7e3('0x0'));var MailMessage=require(_0xa7e3('0x1'))['db'][_0xa7e3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9b9323){return function(_0x93d632,_0x51513f,_0x4800a4){MailMessageEvents[_0xa7e3('0x3')](_0x9b9323+':'+_0x93d632['id'],_0x93d632);MailMessageEvents[_0xa7e3('0x3')](_0x9b9323,_0x93d632);_0x4800a4(null);};}for(var e in events){if(events[_0xa7e3('0x4')](e)){var event=events[e];MailMessage[_0xa7e3('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 73c51ca..403cd09 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 _0xc009=['get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models'];(function(_0x4d7241,_0x32aa1f){var _0x59d9e2=function(_0x30e273){while(--_0x30e273){_0x4d7241['push'](_0x4d7241['shift']());}};_0x59d9e2(++_0x32aa1f);}(_0xc009,0x104));var _0x9c00=function(_0x1a165f,_0xaf7889){_0x1a165f=_0x1a165f-0x0;var _0x17d3ae=_0xc009[_0x1a165f];return _0x17d3ae;};'use strict';var _=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9c00('0x2'));var BPromise=require(_0x9c00('0x3'));var rp=require(_0x9c00('0x4'));var htmlToText=require(_0x9c00('0x5'));var fs=require('fs');var path=require(_0x9c00('0x6'));var rimraf=require('rimraf');var config=require(_0x9c00('0x7'));var attributes=require(_0x9c00('0x8'));module[_0x9c00('0x9')]=function(_0x2be6b9,_0x94c84e){return _0x2be6b9[_0x9c00('0xa')](_0x9c00('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x9c00('0xc'),'fields':[_0x9c00('0xc')]},{'name':_0x9c00('0xd'),'fields':[_0x9c00('0xe'),_0x9c00('0xf')],'type':_0x9c00('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20936d,_0x25be63,_0x56ef2b){if(_0x20936d['body']){_0x20936d[_0x9c00('0xe')]=htmlToText['fromString'](_0x20936d[_0x9c00('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x56ef2b(null,_0x25be63);},'afterCreate':function(_0x38a0e2,_0x33a1aa,_0x34e7de){var _0x46337f=_0x2be6b9[_0x9c00('0x12')];var _0x2beaf0=_0x38a0e2[_0x9c00('0x13')]({'plain':!![]});if(_0x2beaf0[_0x9c00('0x14')][_0x9c00('0x15')]()==='in'||_0x2beaf0[_0x9c00('0x14')][_0x9c00('0x15')]()===_0x9c00('0x16')&&!_0x2beaf0[_0x9c00('0x17')]&&!_['isNil'](_0x2beaf0[_0x9c00('0x18')])){_0x46337f[_0x9c00('0x19')][_0x9c00('0x1a')]({'where':{'id':_0x2beaf0['MailInteractionId']}})[_0x9c00('0x1b')](function(_0xf65bf5){if(_0xf65bf5){_0xf65bf5['update']({'lastMsgAt':_0x2beaf0[_0x9c00('0x1c')],'lastMsgDirection':_0x2beaf0[_0x9c00('0x14')][_0x9c00('0x15')]()});}})['catch'](function(_0x1df978){console[_0x9c00('0x1d')](_0x1df978);});}_0x34e7de();}},'charset':'utf8mb4','collate':_0x9c00('0x1e')});}; \ No newline at end of file +var _0x9048=['plainBody','subject','FULLTEXT','fromString','body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages'];(function(_0xc4750f,_0x17af16){var _0x16d2a4=function(_0x2db608){while(--_0x2db608){_0xc4750f['push'](_0xc4750f['shift']());}};_0x16d2a4(++_0x17af16);}(_0x9048,0x15d));var _0x8904=function(_0x5a881b,_0x1a843b){_0x5a881b=_0x5a881b-0x0;var _0x5c648b=_0x9048[_0x5a881b];return _0x5c648b;};'use strict';var _=require(_0x8904('0x0'));var util=require('util');var logger=require(_0x8904('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8904('0x2'));var htmlToText=require(_0x8904('0x3'));var fs=require('fs');var path=require(_0x8904('0x4'));var rimraf=require(_0x8904('0x5'));var config=require(_0x8904('0x6'));var attributes=require(_0x8904('0x7'));module[_0x8904('0x8')]=function(_0x43bf3f,_0x3abfa5){return _0x43bf3f[_0x8904('0x9')](_0x8904('0xa'),attributes,{'tableName':_0x8904('0xb'),'paranoid':![],'indexes':[{'name':_0x8904('0xc'),'fields':[_0x8904('0xc')]},{'name':_0x8904('0xd'),'fields':[_0x8904('0xe'),_0x8904('0xf')],'type':_0x8904('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49475d,_0x291c06,_0x3d7611){if(_0x49475d['body']){_0x49475d[_0x8904('0xe')]=htmlToText[_0x8904('0x11')](_0x49475d[_0x8904('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3d7611(null,_0x291c06);},'afterCreate':function(_0x451ee0,_0x15be30,_0x256acd){var _0x17f5b1=_0x43bf3f[_0x8904('0x13')];var _0x21a92b=_0x451ee0['get']({'plain':!![]});if(_0x21a92b['direction']['toLowerCase']()==='in'||_0x21a92b[_0x8904('0x14')][_0x8904('0x15')]()==='out'&&!_0x21a92b[_0x8904('0x16')]&&!_[_0x8904('0x17')](_0x21a92b[_0x8904('0x18')])){_0x17f5b1[_0x8904('0x19')][_0x8904('0x1a')]({'where':{'id':_0x21a92b[_0x8904('0x1b')]}})['then'](function(_0x5b0e08){if(_0x5b0e08){_0x5b0e08[_0x8904('0x1c')]({'lastMsgAt':_0x21a92b[_0x8904('0x1d')],'lastMsgDirection':_0x21a92b['direction']['toLowerCase']()});}})[_0x8904('0x1e')](function(_0x4b1611){console['error'](_0x4b1611);});}_0x256acd();}},'charset':_0x8904('0x1f'),'collate':_0x8904('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 324de56..f622aac 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 _0x4cf8=['./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost'];(function(_0x3f12a3,_0x4d545e){var _0x4833e1=function(_0x2c5310){while(--_0x2c5310){_0x3f12a3['push'](_0x3f12a3['shift']());}};_0x4833e1(++_0x4d545e);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x4cf8[_0x571d85];return _0x3c2e07;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x84cf('0xc')]=_['defaults'](config[_0x84cf('0xc')],{'host':_0x84cf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84cf('0xc')]));require(_0x84cf('0xe'))['register'](socket);function respondWithRpcPromise(_0xfb5398,_0x1b223d,_0x390ce9){return new BPromise(function(_0x369ce6,_0x50d667){return client[_0x84cf('0xf')](_0xfb5398,_0x390ce9)[_0x84cf('0x10')](function(_0x4db0a7){logger['info'](_0x84cf('0x11'),_0x1b223d,_0x84cf('0x12'));logger[_0x84cf('0x13')](_0x84cf('0x14'),_0x1b223d,_0x84cf('0x12'),JSON[_0x84cf('0x15')](_0x4db0a7));if(_0x4db0a7[_0x84cf('0x16')]){if(_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x17')]===0x1f4){logger[_0x84cf('0x16')](_0x84cf('0x11'),_0x1b223d,_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);return _0x50d667(_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);}logger[_0x84cf('0x16')](_0x84cf('0x11'),_0x1b223d,_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);return _0x369ce6(_0x4db0a7['error'][_0x84cf('0x18')]);}else{logger[_0x84cf('0x19')](_0x84cf('0x11'),_0x1b223d,_0x84cf('0x12'));_0x369ce6(_0x4db0a7[_0x84cf('0x1a')][_0x84cf('0x18')]);}})[_0x84cf('0x1b')](function(_0x5d5650){logger['error'](_0x84cf('0x11'),_0x1b223d,_0x5d5650);_0x50d667(_0x5d5650);});});}exports[_0x84cf('0x1c')]=function(_0x346b43){var _0x3e65e3=this;return new Promise(function(_0x219afa,_0x5dda3f){return db[_0x84cf('0x1d')][_0x84cf('0x1e')](_0x346b43[_0x84cf('0x1f')],{'raw':_0x346b43[_0x84cf('0x20')]?_0x346b43[_0x84cf('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x84cf('0x10')](function(_0x160f86){logger[_0x84cf('0x19')](_0x84cf('0x1c'),_0x346b43);logger[_0x84cf('0x13')](_0x84cf('0x1c'),_0x346b43,JSON[_0x84cf('0x15')](_0x160f86));_0x219afa(_0x160f86);})['catch'](function(_0x2b2c90){logger[_0x84cf('0x16')](_0x84cf('0x1c'),_0x2b2c90[_0x84cf('0x18')],_0x346b43);_0x5dda3f(_0x3e65e3[_0x84cf('0x16')](0x1f4,_0x2b2c90[_0x84cf('0x18')]));});});}; \ No newline at end of file +var _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x43a656,_0x8c7b6e){var _0x17d36d=function(_0xa659d){while(--_0xa659d){_0x43a656['push'](_0x43a656['shift']());}};_0x17d36d(++_0x8c7b6e);}(_0x6a95,0x1db));var _0x56a9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6a95[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7b39c4e..3493fa6 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 _0x165f=['removeListener','length','./mailMessage.events','remove','emit'];(function(_0x2d9db6,_0x5c7a22){var _0xd2acca=function(_0x40176b){while(--_0x40176b){_0x2d9db6['push'](_0x2d9db6['shift']());}};_0xd2acca(++_0x5c7a22);}(_0x165f,0x6b));var _0xf165=function(_0x3510f1,_0x592b24){_0x3510f1=_0x3510f1-0x0;var _0x2aa4f1=_0x165f[_0x3510f1];return _0x2aa4f1;};'use strict';var MailMessageEvents=require(_0xf165('0x0'));var events=['save',_0xf165('0x1'),'update'];function createListener(_0x1230ca,_0x388d90){return function(_0x50933c){_0x388d90[_0xf165('0x2')](_0x1230ca,_0x50933c);};}function removeListener(_0x32d1f7,_0x110d3e){return function(){MailMessageEvents[_0xf165('0x3')](_0x32d1f7,_0x110d3e);};}exports['register']=function(_0x413e24){for(var _0x1764ae=0x0,_0x24f1a1=events[_0xf165('0x4')];_0x1764ae<_0x24f1a1;_0x1764ae++){var _0x31e1e6=events[_0x1764ae];var _0x5415d1=createListener('mailMessage:'+_0x31e1e6,_0x413e24);MailMessageEvents['on'](_0x31e1e6,_0x5415d1);}}; \ No newline at end of file +var _0x4832=['emit','mailMessage:','./mailMessage.events','remove','update'];(function(_0x100d9d,_0x34ca06){var _0x290423=function(_0x258834){while(--_0x258834){_0x100d9d['push'](_0x100d9d['shift']());}};_0x290423(++_0x34ca06);}(_0x4832,0x183));var _0x2483=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x4832[_0x1488cd];return _0x63fa13;};'use strict';var MailMessageEvents=require(_0x2483('0x0'));var events=['save',_0x2483('0x1'),_0x2483('0x2')];function createListener(_0x50c1f0,_0x4a903f){return function(_0x33ad50){_0x4a903f[_0x2483('0x3')](_0x50c1f0,_0x33ad50);};}function removeListener(_0x31c83d,_0x27035f){return function(){MailMessageEvents['removeListener'](_0x31c83d,_0x27035f);};}exports['register']=function(_0x178e0a){for(var _0x3685e0=0x0,_0x1fdffb=events['length'];_0x3685e0<_0x1fdffb;_0x3685e0++){var _0x569731=events[_0x3685e0];var _0x4670b5=createListener(_0x2483('0x4')+_0x569731,_0x178e0a);MailMessageEvents['on'](_0x569731,_0x4670b5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0126bdb..d1b1fd5 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 _0x358a=['../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','delete','destroy','removeTeams','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x225e62,_0x58cc0d){var _0x48ec99=function(_0xd7dffb){while(--_0xd7dffb){_0x225e62['push'](_0x225e62['shift']());}};_0x48ec99(++_0x58cc0d);}(_0x358a,0x9d));var _0xa358=function(_0x488865,_0x1aaace){_0x488865=_0x488865-0x0;var _0x248307=_0x358a[_0x488865];return _0x248307;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa358('0x0'));var timeout=require(_0xa358('0x1'));var express=require(_0xa358('0x2'));var router=express[_0xa358('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa358('0x4'));var interaction=require(_0xa358('0x5'));var config=require(_0xa358('0x6'));var controller=require(_0xa358('0x7'));router['get']('/',auth[_0xa358('0x8')](),controller['index']);router[_0xa358('0x9')](_0xa358('0xa'),auth[_0xa358('0x8')](),controller[_0xa358('0xb')]);router[_0xa358('0x9')](_0xa358('0xc'),auth[_0xa358('0x8')](),controller[_0xa358('0xd')]);router[_0xa358('0x9')](_0xa358('0xe'),auth[_0xa358('0x8')](),controller[_0xa358('0xf')]);router[_0xa358('0x9')](_0xa358('0x10'),auth['isAuthenticated'](),controller[_0xa358('0x11')]);router['get'](_0xa358('0x12'),auth[_0xa358('0x8')](),controller['getAgents']);router[_0xa358('0x13')]('/',auth[_0xa358('0x8')](),controller['create']);router[_0xa358('0x13')]('/:id/teams',auth[_0xa358('0x8')](),controller[_0xa358('0x14')]);router[_0xa358('0x13')](_0xa358('0x12'),auth[_0xa358('0x8')](),controller[_0xa358('0x15')]);router[_0xa358('0x16')](_0xa358('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa358('0x17')](_0xa358('0xc'),auth[_0xa358('0x8')](),controller[_0xa358('0x18')]);router[_0xa358('0x17')](_0xa358('0x10'),auth[_0xa358('0x8')](),controller[_0xa358('0x19')]);router[_0xa358('0x17')](_0xa358('0x12'),auth[_0xa358('0x8')](),controller['removeAgents']);module[_0xa358('0x1a')]=router; \ No newline at end of file +var _0xdd1a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path'];(function(_0x48c85d,_0x5c90b2){var _0x194214=function(_0x308964){while(--_0x308964){_0x48c85d['push'](_0x48c85d['shift']());}};_0x194214(++_0x5c90b2);}(_0xdd1a,0x185));var _0xadd1=function(_0x5b32b1,_0x32bff5){_0x5b32b1=_0x5b32b1-0x0;var _0x38e26f=_0xdd1a[_0x5b32b1];return _0x38e26f;};'use strict';var multer=require(_0xadd1('0x0'));var util=require(_0xadd1('0x1'));var path=require(_0xadd1('0x2'));var timeout=require(_0xadd1('0x3'));var express=require(_0xadd1('0x4'));var router=express['Router']();var fs_extra=require(_0xadd1('0x5'));var auth=require(_0xadd1('0x6'));var interaction=require(_0xadd1('0x7'));var config=require('../../config/environment');var controller=require(_0xadd1('0x8'));router[_0xadd1('0x9')]('/',auth[_0xadd1('0xa')](),controller['index']);router[_0xadd1('0x9')]('/describe',auth[_0xadd1('0xa')](),controller[_0xadd1('0xb')]);router[_0xadd1('0x9')](_0xadd1('0xc'),auth['isAuthenticated'](),controller[_0xadd1('0xd')]);router[_0xadd1('0x9')](_0xadd1('0xe'),auth[_0xadd1('0xa')](),controller['getMembers']);router[_0xadd1('0x9')](_0xadd1('0xf'),auth['isAuthenticated'](),controller[_0xadd1('0x10')]);router['get']('/:id/users',auth[_0xadd1('0xa')](),controller[_0xadd1('0x11')]);router['post']('/',auth[_0xadd1('0xa')](),controller[_0xadd1('0x12')]);router[_0xadd1('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xadd1('0xa')](),controller[_0xadd1('0x14')]);router['put'](_0xadd1('0xc'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x15')]);router[_0xadd1('0x16')](_0xadd1('0xc'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x17')]);router['delete'](_0xadd1('0xf'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x18')]);router[_0xadd1('0x16')](_0xadd1('0x19'),auth[_0xadd1('0xa')](),controller[_0xadd1('0x1a')]);module[_0xadd1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5429c95..27ef7aa 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 _0xc8a7=['INTEGER','beepall','roundrobin','exports','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc8a7,0x11d));var _0x7c8a=function(_0x190bca,_0x3652d7){_0x190bca=_0x190bca-0x0;var _0x5aa731=_0xc8a7[_0x190bca];return _0x5aa731;};'use strict';var Sequelize=require('sequelize');module[_0x7c8a('0x0')]={'name':{'type':Sequelize[_0x7c8a('0x1')],'unique':_0x7c8a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7c8a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7c8a('0x4'),_0x7c8a('0x5'))}}; \ No newline at end of file +var _0xd3d3=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0xba7490,_0x3d65aa){var _0x5ad46a=function(_0x3b2ea4){while(--_0x3b2ea4){_0xba7490['push'](_0xba7490['shift']());}};_0x5ad46a(++_0x3d65aa);}(_0xd3d3,0x130));var _0x3d3d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd3d3[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x3d3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d3d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d3d('0x1')]},'timeout':{'type':Sequelize[_0x3d3d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3d3d('0x3'),_0x3d3d('0x4'),_0x3d3d('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ab9d761..f711274 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 _0x3281=['all','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','ioredis','../../config/logger','api','../../mysqldb','redis','./mailQueue.socket','register','json','undefined','count','offset','status','set','Content-Range','then','MailQueues','UserProfileResource','end','sendStatus','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','body','destroy','describe','getMembers','findOne','filters','nolimit','limit','order','sort','pick','filter','map','UserMailQueue','findAndCountAll','agent','updatedAt','rows','format','createdAt','getTeams','Team','options','hasOwnProperty','ids','Agents','voicePause','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','User','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every'];(function(_0x4147e6,_0xf9b240){var _0x28e2d0=function(_0x2698f2){while(--_0x2698f2){_0x4147e6['push'](_0x4147e6['shift']());}};_0x28e2d0(++_0xf9b240);}(_0x3281,0x79));var _0x1328=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3281[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x1328('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x1328('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1328('0x2'))(_0x1328('0x3'));var config=require('../../config/environment');var db=require(_0x1328('0x4'))['db'];config[_0x1328('0x5')]=_['defaults'](config[_0x1328('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1328('0x5')]));require(_0x1328('0x6'))[_0x1328('0x7')](socket);function respondWithStatusCode(_0x2f67b3,_0x17e3b3){_0x17e3b3=_0x17e3b3||0xcc;return function(_0x22fa79){if(_0x22fa79){return _0x2f67b3['sendStatus'](_0x17e3b3);}return _0x2f67b3['status'](_0x17e3b3)['end']();};}function respondWithResult(_0x965ac3,_0x171a71){_0x171a71=_0x171a71||0xc8;return function(_0x3d6b55){if(_0x3d6b55){return _0x965ac3['status'](_0x171a71)[_0x1328('0x8')](_0x3d6b55);}};}function respondWithFilteredResult(_0x53c12b,_0x317a7c){return function(_0x3ab499){if(_0x3ab499){var _0x1df135=typeof _0x317a7c['offset']==='undefined'&&typeof _0x317a7c['limit']===_0x1328('0x9');var _0x137d18=_0x3ab499[_0x1328('0xa')];var _0x34def4=_0x1df135?0x0:_0x317a7c[_0x1328('0xb')];var _0x1b5b18=_0x1df135?_0x3ab499[_0x1328('0xa')]:_0x317a7c[_0x1328('0xb')]+_0x317a7c['limit'];var _0x5d53be;if(_0x1b5b18>=_0x137d18){_0x1b5b18=_0x137d18;_0x5d53be=0xc8;}else{_0x5d53be=0xce;}_0x53c12b[_0x1328('0xc')](_0x5d53be);return _0x53c12b[_0x1328('0xd')](_0x1328('0xe'),_0x34def4+'-'+_0x1b5b18+'/'+_0x137d18)['json'](_0x3ab499);}return null;};}function saveUpdates(_0x26908f){return function(_0xfa58ea){if(_0xfa58ea){return _0xfa58ea['update'](_0x26908f)[_0x1328('0xf')](function(_0x212810){return _0x212810;});}return null;};}function removeEntity(_0x4f79e3){return function(_0x1ba6ff){if(_0x1ba6ff){return _0x1ba6ff['destroy']()[_0x1328('0xf')](function(){var _0x5c067f=_0x1ba6ff['get']({'plain':!![]});var _0xd769ab=_0x1328('0x10');return db[_0x1328('0x11')]['destroy']({'where':{'type':_0xd769ab,'resourceId':_0x5c067f['id']}})[_0x1328('0xf')](function(){return _0x1ba6ff;});})[_0x1328('0xf')](function(){_0x4f79e3[_0x1328('0xc')](0xcc)[_0x1328('0x12')]();});}};}function handleEntityNotFound(_0x1c3f99){return function(_0x1751a5){if(!_0x1751a5){_0x1c3f99[_0x1328('0x13')](0x194);}return _0x1751a5;};}function handleError(_0x2b0227,_0x4298ce){_0x4298ce=_0x4298ce||0x1f4;return function(_0x1ae897){logger[_0x1328('0x14')](_0x1ae897['stack']);if(_0x1ae897['name']){delete _0x1ae897[_0x1328('0x15')];}_0x2b0227[_0x1328('0xc')](_0x4298ce)[_0x1328('0x16')](_0x1ae897);};}exports[_0x1328('0x17')]=function(_0x4b3bca,_0x5de3dc){var _0x140f8e={};var _0x5c1029={'count':0x0,'rows':[]};var _0x51041e=_['map'](db[_0x1328('0x18')][_0x1328('0x19')],function(_0x17a99a){return{'name':_0x17a99a[_0x1328('0x1a')],'type':_0x17a99a[_0x1328('0x1b')][_0x1328('0x1c')]};});_0x140f8e=qs[_0x1328('0x1d')](_0x51041e,_0x4b3bca);var _0xbb128b={'where':_0x140f8e[_0x1328('0x1e')]};return db['MailQueue'][_0x1328('0xa')](_0xbb128b)[_0x1328('0xf')](function(_0x37e9ba){_0x5c1029[_0x1328('0xa')]=_0x37e9ba;_0x140f8e[_0x1328('0x1f')]=qs[_0x1328('0x1f')](_0x4b3bca[_0x1328('0x20')]);return db[_0x1328('0x18')][_0x1328('0x21')](_0x140f8e);})[_0x1328('0xf')](function(_0x19e44e){_0x5c1029['rows']=_0x19e44e;return _0x5c1029;})['then'](respondWithFilteredResult(_0x5de3dc,_0x140f8e))[_0x1328('0x22')](handleError(_0x5de3dc,null));};exports[_0x1328('0x23')]=function(_0x229d4a,_0x5c475a){var _0x30fda2={'raw':!![],'where':{'id':_0x229d4a[_0x1328('0x24')]['id']}},_0x20576e={};_0x20576e[_0x1328('0x25')]=_[_0x1328('0x26')](db[_0x1328('0x18')][_0x1328('0x19')]);_0x20576e[_0x1328('0x20')]=_[_0x1328('0x26')](_0x229d4a[_0x1328('0x20')]);_0x20576e['filters']=_[_0x1328('0x27')](_0x20576e[_0x1328('0x25')],_0x20576e[_0x1328('0x20')]);_0x30fda2[_0x1328('0x28')]=_[_0x1328('0x27')](_0x20576e[_0x1328('0x25')],qs[_0x1328('0x29')](_0x229d4a[_0x1328('0x20')][_0x1328('0x29')]));_0x30fda2[_0x1328('0x28')]=_0x30fda2[_0x1328('0x28')][_0x1328('0x2a')]?_0x30fda2['attributes']:_0x20576e[_0x1328('0x25')];if(_0x229d4a[_0x1328('0x20')][_0x1328('0x2b')]){_0x30fda2['include']=[{'all':!![]}];}_0x30fda2=_[_0x1328('0x2c')]({},_0x30fda2,_0x229d4a['options']);return db[_0x1328('0x18')][_0x1328('0x2d')](_0x30fda2)[_0x1328('0xf')](handleEntityNotFound(_0x5c475a,null))[_0x1328('0xf')](respondWithResult(_0x5c475a,null))[_0x1328('0x22')](handleError(_0x5c475a,null));};exports[_0x1328('0x2e')]=function(_0x59ac8c,_0x2e2236){return db['MailQueue'][_0x1328('0x2e')](_0x59ac8c['body'],{})['then'](function(_0x4e87c5){var _0x6c67d=_0x59ac8c['user'][_0x1328('0x2f')]({'plain':!![]});if(!_0x6c67d)throw new Error(_0x1328('0x30'));if(_0x6c67d[_0x1328('0x31')]===_0x1328('0x32')){var _0x1dd64f=_0x4e87c5['get']({'plain':!![]});var _0x283f5d=_0x1328('0x10');return db[_0x1328('0x33')][_0x1328('0x2d')]({'where':{'name':_0x283f5d,'userProfileId':_0x6c67d[_0x1328('0x34')]},'raw':!![]})[_0x1328('0xf')](function(_0xd5c067){if(_0xd5c067&&_0xd5c067['autoAssociation']===0x0){return db[_0x1328('0x11')]['create']({'name':_0x1dd64f[_0x1328('0x15')],'resourceId':_0x1dd64f['id'],'type':_0xd5c067[_0x1328('0x15')],'sectionId':_0xd5c067['id']},{})[_0x1328('0xf')](function(){return _0x4e87c5;});}else{return _0x4e87c5;}})[_0x1328('0x22')](function(_0x1e4360){logger[_0x1328('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e4360);throw _0x1e4360;});}return _0x4e87c5;})['then'](respondWithResult(_0x2e2236,0xc9))[_0x1328('0x22')](handleError(_0x2e2236,null));};exports[_0x1328('0x35')]=function(_0x4176e3,_0x20a23b){if(_0x4176e3[_0x1328('0x36')]['id']){delete _0x4176e3[_0x1328('0x36')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x4176e3[_0x1328('0x24')]['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x20a23b,null))['then'](saveUpdates(_0x4176e3[_0x1328('0x36')],null))['then'](respondWithResult(_0x20a23b,null))[_0x1328('0x22')](handleError(_0x20a23b,null));};exports[_0x1328('0x37')]=function(_0x8a0890,_0x18630b){return db[_0x1328('0x18')][_0x1328('0x2d')]({'where':{'id':_0x8a0890[_0x1328('0x24')]['id']}})['then'](handleEntityNotFound(_0x18630b,null))[_0x1328('0xf')](removeEntity(_0x18630b,null))['catch'](handleError(_0x18630b,null));};exports[_0x1328('0x38')]=function(_0x1fb49c,_0x4eb37f){return db['MailQueue'][_0x1328('0x38')]()['then'](respondWithResult(_0x4eb37f,null))[_0x1328('0x22')](handleError(_0x4eb37f,null));};exports[_0x1328('0x39')]=function(_0xd17f7e,_0x4a3108){var _0x4cabfc={'raw':!![],'where':{}},_0x3a6def={},_0x27e0fb;return db[_0x1328('0x18')][_0x1328('0x3a')]({'where':{'id':_0xd17f7e[_0x1328('0x24')]['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x4a3108,null))[_0x1328('0xf')](function(_0x20c248){if(_0x20c248){_0x27e0fb=_0x20c248[_0x1328('0x2f')]({'plain':!![]});_0x3a6def['model']=_['keys'](db['UserMailQueue'][_0x1328('0x19')]);_0x3a6def['query']=_[_0x1328('0x26')](_0xd17f7e[_0x1328('0x20')]);_0x3a6def[_0x1328('0x3b')]=_[_0x1328('0x27')](_0x3a6def[_0x1328('0x25')],_0x3a6def[_0x1328('0x20')]);_0x4cabfc['attributes']=_['intersection'](_0x3a6def[_0x1328('0x25')],qs[_0x1328('0x29')](_0xd17f7e[_0x1328('0x20')]['fields']));_0x4cabfc[_0x1328('0x28')]=_0x4cabfc[_0x1328('0x28')][_0x1328('0x2a')]?_0x4cabfc[_0x1328('0x28')]:_0x3a6def['model'];if(!_0xd17f7e[_0x1328('0x20')]['hasOwnProperty'](_0x1328('0x3c'))){_0x4cabfc[_0x1328('0x3d')]=qs[_0x1328('0x3d')](_0xd17f7e[_0x1328('0x20')][_0x1328('0x3d')]);_0x4cabfc[_0x1328('0xb')]=qs[_0x1328('0xb')](_0xd17f7e[_0x1328('0x20')][_0x1328('0xb')]);}_0x4cabfc[_0x1328('0x3e')]=qs[_0x1328('0x3f')](_0xd17f7e[_0x1328('0x20')][_0x1328('0x3f')]);_0x4cabfc[_0x1328('0x1e')]=qs['filters'](_[_0x1328('0x40')](_0xd17f7e[_0x1328('0x20')],_0x3a6def[_0x1328('0x3b')]));_0x4cabfc[_0x1328('0x1e')]['MailQueueId']=_0x20c248['id'];if(_0xd17f7e[_0x1328('0x20')][_0x1328('0x41')]){_0x4cabfc['where']=_[_0x1328('0x2c')](_0x4cabfc['where'],{'$or':_[_0x1328('0x42')](_0x4cabfc[_0x1328('0x28')],function(_0x5c07d6){var _0x1170eb={};_0x1170eb[_0x5c07d6]={'$like':'%'+_0xd17f7e[_0x1328('0x20')][_0x1328('0x41')]+'%'};return _0x1170eb;})});}_0x4cabfc=_['merge']({},_0x4cabfc,_0xd17f7e['options']);return db[_0x1328('0x43')][_0x1328('0x21')](_0x4cabfc);}})[_0x1328('0xf')](function(_0x2bf2ee){if(_0x2bf2ee){return db['User'][_0x1328('0x44')]({'where':{'id':_['map'](_0x2bf2ee,'UserId'),'role':_0x1328('0x45')},'attributes':['id',_0x1328('0x15'),'mailPause',_0x1328('0x46'),'createdAt']});}})[_0x1328('0xf')](function(_0x1013cf){if(_0x1013cf){return{'count':_0x1013cf[_0x1328('0xa')],'rows':_['map'](_0x1013cf[_0x1328('0x47')],function(_0x24e03d){return{'membername':_0x24e03d[_0x1328('0x15')],'UserId':_0x24e03d['id'],'queue_name':_0x27e0fb[_0x1328('0x15')],'MailQueueId':_0x27e0fb['id'],'interface':util[_0x1328('0x48')]('%s/%s','SIP',_0x24e03d[_0x1328('0x15')]),'penalty':0x0,'paused':_0x24e03d['mailPause'],'createdAt':_0x24e03d[_0x1328('0x49')],'updatedAt':_0x24e03d[_0x1328('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1328('0xf')](respondWithFilteredResult(_0x4a3108,_0x4cabfc))[_0x1328('0x22')](handleError(_0x4a3108,null));};exports[_0x1328('0x4a')]=function(_0x3a2a33,_0x240062){var _0xc8679d={};var _0x494348={};var _0x1ab843;var _0x2cb244;return db[_0x1328('0x18')][_0x1328('0x3a')]({'where':{'id':_0x3a2a33[_0x1328('0x24')]['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x240062,null))[_0x1328('0xf')](function(_0x44bbc2){if(_0x44bbc2){_0x1ab843=_0x44bbc2;_0x494348['model']=_[_0x1328('0x26')](db[_0x1328('0x4b')][_0x1328('0x19')]);_0x494348[_0x1328('0x20')]=_[_0x1328('0x26')](_0x3a2a33[_0x1328('0x20')]);_0x494348[_0x1328('0x3b')]=_[_0x1328('0x27')](_0x494348['model'],_0x494348[_0x1328('0x20')]);_0xc8679d['attributes']=_['intersection'](_0x494348['model'],qs[_0x1328('0x29')](_0x3a2a33[_0x1328('0x20')][_0x1328('0x29')]));_0xc8679d[_0x1328('0x28')]=_0xc8679d[_0x1328('0x28')][_0x1328('0x2a')]?_0xc8679d[_0x1328('0x28')]:_0x494348[_0x1328('0x25')];_0xc8679d[_0x1328('0x3e')]=qs[_0x1328('0x3f')](_0x3a2a33['query'][_0x1328('0x3f')]);_0xc8679d[_0x1328('0x1e')]=qs[_0x1328('0x3b')](_[_0x1328('0x40')](_0x3a2a33['query'],_0x494348[_0x1328('0x3b')]));if(_0x3a2a33[_0x1328('0x20')][_0x1328('0x41')]){_0xc8679d[_0x1328('0x1e')]=_[_0x1328('0x2c')](_0xc8679d['where'],{'$or':_[_0x1328('0x42')](_0xc8679d['attributes'],function(_0x59dc22){var _0x5567e0={};_0x5567e0[_0x59dc22]={'$like':'%'+_0x3a2a33[_0x1328('0x20')][_0x1328('0x41')]+'%'};return _0x5567e0;})});}_0xc8679d=_[_0x1328('0x2c')]({},_0xc8679d,_0x3a2a33[_0x1328('0x4c')]);return _0x1ab843['getTeams'](_0xc8679d);}})[_0x1328('0xf')](function(_0x522f37){if(_0x522f37){_0x2cb244=_0x522f37[_0x1328('0x2a')];if(!_0x3a2a33[_0x1328('0x20')][_0x1328('0x4d')](_0x1328('0x3c'))){_0xc8679d['limit']=qs[_0x1328('0x3d')](_0x3a2a33[_0x1328('0x20')][_0x1328('0x3d')]);_0xc8679d[_0x1328('0xb')]=qs['offset'](_0x3a2a33[_0x1328('0x20')][_0x1328('0xb')]);}return _0x1ab843[_0x1328('0x4a')](_0xc8679d);}})['then'](function(_0x34fcda){if(_0x34fcda){return _0x34fcda?{'count':_0x2cb244,'rows':_0x34fcda}:null;}})['then'](respondWithResult(_0x240062,null))[_0x1328('0x22')](handleError(_0x240062,null));};exports['addTeams']=function(_0x2332f9,_0x1b2e13){var _0x355144=_0x2332f9['body'][_0x1328('0x4e')];return db[_0x1328('0x4b')][_0x1328('0x21')]({'where':{'id':_0x355144},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1328('0x4f'),'attributes':['id','name','online',_0x1328('0x50'),'interface'],'raw':!![]}]})[_0x1328('0xf')](function(_0x27067d){if(_0x27067d){var _0x474be3=_['flatMap'](_0x27067d,function(_0x346956){var _0x4f8b58=_0x346956[_0x1328('0x2f')]({'plain':!![]});return _0x4f8b58[_0x1328('0x4f')];});return db[_0x1328('0x18')][_0x1328('0x2d')]({'where':{'id':_0x2332f9[_0x1328('0x24')]['id']}})[_0x1328('0xf')](function(_0x299b62){return db[_0x1328('0x51')][_0x1328('0x52')](function(_0x46a39b){return _0x299b62[_0x1328('0x53')](_0x355144,{'transaction':_0x46a39b})[_0x1328('0xf')](function(){return BPromise[_0x1328('0x54')](_0x474be3,function(_0x3cedca){return db[_0x1328('0x43')][_0x1328('0x55')]({'where':{'UserId':_0x3cedca['id'],'MailQueueId':_0x2332f9[_0x1328('0x24')]['id']},'transaction':_0x46a39b});});})[_0x1328('0xf')](function(){_0x474be3['forEach'](function(_0x10a0bd){socket[_0x1328('0x56')]('userMailQueue:save',{'UserId':_0x10a0bd['id'],'MailQueueId':_0x299b62['id']});});});});});}})['then'](respondWithStatusCode(_0x1b2e13,null))[_0x1328('0x22')](handleError(_0x1b2e13,null));};exports[_0x1328('0x57')]=function(_0x5d5c71,_0x23e6fc){return db[_0x1328('0x4b')][_0x1328('0x21')]({'where':{'id':_0x5d5c71[_0x1328('0x20')][_0x1328('0x4e')]},'attributes':['id'],'include':[{'model':db[_0x1328('0x58')],'as':_0x1328('0x4f'),'attributes':['id'],'raw':!![]}]})[_0x1328('0xf')](handleEntityNotFound(_0x23e6fc,null))[_0x1328('0xf')](function(_0x3ca3ae){var _0x1ddfee=_[_0x1328('0x42')](_0x3ca3ae,'id');var _0x300aaa=[];var _0x1add2c=[];var _0x2467c7=squel[_0x1328('0x59')]();_0x2467c7[_0x1328('0x5a')]('tq.TeamId')[_0x1328('0x5b')](_0x1328('0x5c'),'tq')[_0x1328('0x5d')]('user_has_teams','ut',_0x1328('0x5e'))[_0x1328('0x1e')]('MailQueueId\x20=\x20?',_0x5d5c71[_0x1328('0x24')]['id']);for(var _0x446160=0x0;_0x446160<_0x3ca3ae['length'];_0x446160+=0x1){let _0x912354=_0x3ca3ae[_0x446160];for(var _0x5a068a=0x0;_0x5a068a<_0x912354[_0x1328('0x4f')][_0x1328('0x2a')];_0x5a068a+=0x1){let _0x581b02=_0x912354[_0x1328('0x4f')][_0x5a068a];var _0x219dc2=_0x2467c7[_0x1328('0x5f')]();_0x219dc2['where'](_0x1328('0x60'),_0x581b02['id']);_0x1add2c[_0x1328('0x61')](db[_0x1328('0x51')]['query'](_0x219dc2[_0x1328('0x62')](),{'type':db[_0x1328('0x51')]['QueryTypes'][_0x1328('0x63')]})['then'](function(_0x51f8a6){if(_0x51f8a6[_0x1328('0x2a')]===0x1){return _0x581b02['id'];}else{var _0x1c38c9=_[_0x1328('0x64')](_[_0x1328('0x42')](_0x51f8a6,'TeamId'),function(_0x19e75c){return _['includes'](_0x1ddfee,_0x19e75c);});if(_0x1c38c9){return _0x581b02['id'];}}}));}}return BPromise[_0x1328('0x65')](_0x1add2c)[_0x1328('0xf')](function(_0x48dea9){_0x300aaa=_(_0x300aaa)['union'](_0x48dea9)[_0x1328('0x66')]()['value']();return db[_0x1328('0x18')][_0x1328('0x2d')]({'where':{'id':_0x5d5c71['params']['id']}})['then'](function(_0x1a9543){return db[_0x1328('0x51')][_0x1328('0x52')](function(_0x273646){return _0x1a9543[_0x1328('0x57')](_0x5d5c71[_0x1328('0x20')]['ids'],{'transaction':_0x273646})['then'](function(){if(!_[_0x1328('0x67')](_0x300aaa)){return _0x1a9543[_0x1328('0x68')](_0x300aaa,{'transaction':_0x273646});}})['then'](function(){_0x300aaa['forEach'](function(_0x5dcebb){socket[_0x1328('0x56')](_0x1328('0x69'),{'UserId':_0x5dcebb,'MailQueueId':_0x1a9543['id']});});});});});});})[_0x1328('0xf')](respondWithStatusCode(_0x23e6fc,null))[_0x1328('0x22')](handleError(_0x23e6fc,null));};exports[_0x1328('0x6a')]=function(_0x14bc19,_0x3d034c){return db[_0x1328('0x18')]['find']({'where':{'id':_0x14bc19['params']['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x3d034c,null))[_0x1328('0xf')](function(_0x562f80){if(_0x562f80){return _0x562f80['addAgents'](_0x14bc19[_0x1328('0x36')][_0x1328('0x4e')],_[_0x1328('0x6b')](_0x14bc19[_0x1328('0x36')],['ids','id'])||{})[_0x1328('0x6c')](function(_0x425024){for(var _0xdfd785=0x0;_0xdfd785<_0x14bc19[_0x1328('0x36')]['ids'][_0x1328('0x2a')];_0xdfd785+=0x1){socket[_0x1328('0x56')]('userMailQueue:save',{'UserId':Number(_0x14bc19['body'][_0x1328('0x4e')][_0xdfd785]),'MailQueueId':Number(_0x14bc19[_0x1328('0x24')]['id'])});}return _0x425024;});}})[_0x1328('0xf')](respondWithResult(_0x3d034c,null))[_0x1328('0x22')](handleError(_0x3d034c,null));};exports[_0x1328('0x68')]=function(_0x5370c1,_0x497d14){return db[_0x1328('0x18')][_0x1328('0x2d')]({'where':{'id':_0x5370c1['params']['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x497d14,null))[_0x1328('0xf')](function(_0x4a8de7){if(_0x4a8de7){return _0x4a8de7['removeAgents'](_0x5370c1[_0x1328('0x20')]['ids'])[_0x1328('0xf')](function(){if(_[_0x1328('0x6d')](_0x5370c1['query'][_0x1328('0x4e')])){for(var _0x183750=0x0;_0x183750<_0x5370c1[_0x1328('0x20')][_0x1328('0x4e')][_0x1328('0x2a')];_0x183750+=0x1){socket[_0x1328('0x56')](_0x1328('0x69'),{'UserId':Number(_0x5370c1['query']['ids'][_0x183750]),'MailQueueId':Number(_0x5370c1[_0x1328('0x24')]['id'])});}}else{socket['emit'](_0x1328('0x69'),{'UserId':Number(_0x5370c1['query'][_0x1328('0x4e')]),'MailQueueId':Number(_0x5370c1['params']['id'])});}});}})[_0x1328('0xf')](respondWithStatusCode(_0x497d14,null))[_0x1328('0x22')](handleError(_0x497d14,null));};exports[_0x1328('0x6e')]=function(_0x34ad91,_0x5641d0){var _0x4cc23d={};var _0x225b00={};var _0x2f6dbc;var _0x6c21ea;return db['MailQueue'][_0x1328('0x3a')]({'where':{'id':_0x34ad91[_0x1328('0x24')]['id']}})[_0x1328('0xf')](handleEntityNotFound(_0x5641d0,null))[_0x1328('0xf')](function(_0xc1f27f){if(_0xc1f27f){_0x2f6dbc=_0xc1f27f;_0x225b00[_0x1328('0x25')]=_[_0x1328('0x26')](db['User']['rawAttributes']);_0x225b00[_0x1328('0x20')]=_[_0x1328('0x26')](_0x34ad91[_0x1328('0x20')]);_0x225b00[_0x1328('0x3b')]=_['intersection'](_0x225b00['model'],_0x225b00['query']);_0x4cc23d[_0x1328('0x28')]=_[_0x1328('0x27')](_0x225b00[_0x1328('0x25')],qs[_0x1328('0x29')](_0x34ad91[_0x1328('0x20')]['fields']));_0x4cc23d[_0x1328('0x28')]=_0x4cc23d[_0x1328('0x28')][_0x1328('0x2a')]?_0x4cc23d[_0x1328('0x28')]:_0x225b00[_0x1328('0x25')];_0x4cc23d['order']=qs[_0x1328('0x3f')](_0x34ad91[_0x1328('0x20')][_0x1328('0x3f')]);_0x4cc23d[_0x1328('0x1e')]=qs[_0x1328('0x3b')](_[_0x1328('0x40')](_0x34ad91[_0x1328('0x20')],_0x225b00[_0x1328('0x3b')]));if(_0x34ad91[_0x1328('0x20')][_0x1328('0x41')]){_0x4cc23d[_0x1328('0x1e')]=_['merge'](_0x4cc23d['where'],{'$or':_[_0x1328('0x42')](_0x4cc23d['attributes'],function(_0x1b9780){var _0x88533a={};_0x88533a[_0x1b9780]={'$like':'%'+_0x34ad91['query']['filter']+'%'};return _0x88533a;})});}_0x4cc23d=_[_0x1328('0x2c')]({},_0x4cc23d,_0x34ad91[_0x1328('0x4c')]);return _0x2f6dbc[_0x1328('0x6e')](_0x4cc23d);}})[_0x1328('0xf')](function(_0x5abea8){if(_0x5abea8){_0x6c21ea=_0x5abea8['length'];if(!_0x34ad91[_0x1328('0x20')][_0x1328('0x4d')]('nolimit')){_0x4cc23d[_0x1328('0x3d')]=qs[_0x1328('0x3d')](_0x34ad91['query']['limit']);_0x4cc23d[_0x1328('0xb')]=qs[_0x1328('0xb')](_0x34ad91['query'][_0x1328('0xb')]);}return _0x2f6dbc[_0x1328('0x6e')](_0x4cc23d);}})[_0x1328('0xf')](function(_0x452d61){if(_0x452d61){return _0x452d61?{'count':_0x6c21ea,'rows':_0x452d61}:null;}})[_0x1328('0xf')](respondWithResult(_0x5641d0,null))[_0x1328('0x22')](handleError(_0x5641d0,null));}; \ No newline at end of file +var _0xf43d=['User','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','userMailQueue:remove','addAgents','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','destroy','then','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','fieldName','key','getOptions','where','include','query','rows','catch','rawAttributes','keys','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','UserMailQueue','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team'];(function(_0x7a9856,_0x316d9b){var _0x76fc4a=function(_0x3d9c3e){while(--_0x3d9c3e){_0x7a9856['push'](_0x7a9856['shift']());}};_0x76fc4a(++_0x316d9b);}(_0xf43d,0x11a));var _0xdf43=function(_0x4ad891,_0x5c7557){_0x4ad891=_0x4ad891-0x0;var _0x42e3eb=_0xf43d[_0x4ad891];return _0x42e3eb;};'use strict';var BPromise=require(_0xdf43('0x0'));var util=require(_0xdf43('0x1'));var _=require(_0xdf43('0x2'));var squel=require(_0xdf43('0x3'));var Redis=require(_0xdf43('0x4'));var qs=require(_0xdf43('0x5'));var logger=require(_0xdf43('0x6'))(_0xdf43('0x7'));var config=require(_0xdf43('0x8'));var db=require(_0xdf43('0x9'))['db'];config[_0xdf43('0xa')]=_[_0xdf43('0xb')](config[_0xdf43('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf43('0xc'))(new Redis(config['redis']));require(_0xdf43('0xd'))[_0xdf43('0xe')](socket);function respondWithStatusCode(_0x3236d0,_0xefe495){_0xefe495=_0xefe495||0xcc;return function(_0xa76f89){if(_0xa76f89){return _0x3236d0[_0xdf43('0xf')](_0xefe495);}return _0x3236d0['status'](_0xefe495)[_0xdf43('0x10')]();};}function respondWithResult(_0x14fa86,_0x1fef64){_0x1fef64=_0x1fef64||0xc8;return function(_0x1c9bed){if(_0x1c9bed){return _0x14fa86[_0xdf43('0x11')](_0x1fef64)[_0xdf43('0x12')](_0x1c9bed);}};}function respondWithFilteredResult(_0x1be9e9,_0x260481){return function(_0x1810ae){if(_0x1810ae){var _0x2b0730=typeof _0x260481[_0xdf43('0x13')]==='undefined'&&typeof _0x260481['limit']===_0xdf43('0x14');var _0x522fc5=_0x1810ae[_0xdf43('0x15')];var _0x5bb9d6=_0x2b0730?0x0:_0x260481['offset'];var _0x47597f=_0x2b0730?_0x1810ae[_0xdf43('0x15')]:_0x260481[_0xdf43('0x13')]+_0x260481[_0xdf43('0x16')];var _0x4ec7df;if(_0x47597f>=_0x522fc5){_0x47597f=_0x522fc5;_0x4ec7df=0xc8;}else{_0x4ec7df=0xce;}_0x1be9e9[_0xdf43('0x11')](_0x4ec7df);return _0x1be9e9[_0xdf43('0x17')]('Content-Range',_0x5bb9d6+'-'+_0x47597f+'/'+_0x522fc5)['json'](_0x1810ae);}return null;};}function saveUpdates(_0x309685){return function(_0x4458a4){if(_0x4458a4){return _0x4458a4['update'](_0x309685)['then'](function(_0xff5287){return _0xff5287;});}return null;};}function removeEntity(_0x144d7b){return function(_0x544380){if(_0x544380){return _0x544380[_0xdf43('0x18')]()[_0xdf43('0x19')](function(){var _0x4e0723=_0x544380['get']({'plain':!![]});var _0x23166c=_0xdf43('0x1a');return db[_0xdf43('0x1b')][_0xdf43('0x18')]({'where':{'type':_0x23166c,'resourceId':_0x4e0723['id']}})[_0xdf43('0x19')](function(){return _0x544380;});})['then'](function(){_0x144d7b[_0xdf43('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259581){return function(_0x466ec5){if(!_0x466ec5){_0x259581[_0xdf43('0xf')](0x194);}return _0x466ec5;};}function handleError(_0x58708a,_0x3a3091){_0x3a3091=_0x3a3091||0x1f4;return function(_0x5c606c){logger[_0xdf43('0x1c')](_0x5c606c['stack']);if(_0x5c606c[_0xdf43('0x1d')]){delete _0x5c606c[_0xdf43('0x1d')];}_0x58708a['status'](_0x3a3091)[_0xdf43('0x1e')](_0x5c606c);};}exports[_0xdf43('0x1f')]=function(_0x5ed23b,_0x4e99f2){var _0x1235a6={};var _0x1e7636={'count':0x0,'rows':[]};var _0x48224e=_[_0xdf43('0x20')](db[_0xdf43('0x21')]['rawAttributes'],function(_0x4c0077){return{'name':_0x4c0077[_0xdf43('0x22')],'type':_0x4c0077['type'][_0xdf43('0x23')]};});_0x1235a6=qs[_0xdf43('0x24')](_0x48224e,_0x5ed23b);var _0x1c687c={'where':_0x1235a6[_0xdf43('0x25')]};return db[_0xdf43('0x21')][_0xdf43('0x15')](_0x1c687c)[_0xdf43('0x19')](function(_0x1ad94c){_0x1e7636['count']=_0x1ad94c;_0x1235a6[_0xdf43('0x26')]=qs[_0xdf43('0x26')](_0x5ed23b[_0xdf43('0x27')]);return db[_0xdf43('0x21')]['findAll'](_0x1235a6);})['then'](function(_0x224388){_0x1e7636[_0xdf43('0x28')]=_0x224388;return _0x1e7636;})[_0xdf43('0x19')](respondWithFilteredResult(_0x4e99f2,_0x1235a6))[_0xdf43('0x29')](handleError(_0x4e99f2,null));};exports['show']=function(_0x41ac44,_0x39fc8b){var _0x51efc2={'raw':!![],'where':{'id':_0x41ac44['params']['id']}},_0x24b221={};_0x24b221['model']=_['keys'](db[_0xdf43('0x21')][_0xdf43('0x2a')]);_0x24b221['query']=_[_0xdf43('0x2b')](_0x41ac44[_0xdf43('0x27')]);_0x24b221[_0xdf43('0x2c')]=_['intersection'](_0x24b221[_0xdf43('0x2d')],_0x24b221['query']);_0x51efc2[_0xdf43('0x2e')]=_[_0xdf43('0x2f')](_0x24b221[_0xdf43('0x2d')],qs[_0xdf43('0x30')](_0x41ac44[_0xdf43('0x27')]['fields']));_0x51efc2[_0xdf43('0x2e')]=_0x51efc2['attributes']['length']?_0x51efc2[_0xdf43('0x2e')]:_0x24b221[_0xdf43('0x2d')];if(_0x41ac44[_0xdf43('0x27')][_0xdf43('0x31')]){_0x51efc2['include']=[{'all':!![]}];}_0x51efc2=_[_0xdf43('0x32')]({},_0x51efc2,_0x41ac44[_0xdf43('0x33')]);return db[_0xdf43('0x21')][_0xdf43('0x34')](_0x51efc2)[_0xdf43('0x19')](handleEntityNotFound(_0x39fc8b,null))[_0xdf43('0x19')](respondWithResult(_0x39fc8b,null))[_0xdf43('0x29')](handleError(_0x39fc8b,null));};exports[_0xdf43('0x35')]=function(_0xf3b847,_0x481ef0){return db['MailQueue'][_0xdf43('0x35')](_0xf3b847['body'],{})[_0xdf43('0x19')](function(_0x188858){var _0x2db52b=_0xf3b847['user'][_0xdf43('0x36')]({'plain':!![]});if(!_0x2db52b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2db52b[_0xdf43('0x37')]===_0xdf43('0x38')){var _0x2b6493=_0x188858[_0xdf43('0x36')]({'plain':!![]});var _0x1969a7=_0xdf43('0x1a');return db[_0xdf43('0x39')][_0xdf43('0x34')]({'where':{'name':_0x1969a7,'userProfileId':_0x2db52b[_0xdf43('0x3a')]},'raw':!![]})[_0xdf43('0x19')](function(_0x336ed2){if(_0x336ed2&&_0x336ed2[_0xdf43('0x3b')]===0x0){return db[_0xdf43('0x1b')]['create']({'name':_0x2b6493[_0xdf43('0x1d')],'resourceId':_0x2b6493['id'],'type':_0x336ed2[_0xdf43('0x1d')],'sectionId':_0x336ed2['id']},{})[_0xdf43('0x19')](function(){return _0x188858;});}else{return _0x188858;}})[_0xdf43('0x29')](function(_0x57e384){logger['error'](_0xdf43('0x3c'),_0x57e384);throw _0x57e384;});}return _0x188858;})['then'](respondWithResult(_0x481ef0,0xc9))['catch'](handleError(_0x481ef0,null));};exports[_0xdf43('0x3d')]=function(_0x15e9f4,_0x3b5c7a){if(_0x15e9f4[_0xdf43('0x3e')]['id']){delete _0x15e9f4[_0xdf43('0x3e')]['id'];}return db['MailQueue'][_0xdf43('0x34')]({'where':{'id':_0x15e9f4[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b5c7a,null))[_0xdf43('0x19')](saveUpdates(_0x15e9f4[_0xdf43('0x3e')],null))['then'](respondWithResult(_0x3b5c7a,null))[_0xdf43('0x29')](handleError(_0x3b5c7a,null));};exports[_0xdf43('0x18')]=function(_0x343455,_0x16e221){return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x343455[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x16e221,null))['then'](removeEntity(_0x16e221,null))['catch'](handleError(_0x16e221,null));};exports['describe']=function(_0x3911d2,_0x1f18e2){return db['MailQueue'][_0xdf43('0x40')]()[_0xdf43('0x19')](respondWithResult(_0x1f18e2,null))[_0xdf43('0x29')](handleError(_0x1f18e2,null));};exports[_0xdf43('0x41')]=function(_0x47fc7f,_0x3a9119){var _0x8a100d={'raw':!![],'where':{}},_0x3888ab={},_0x3c417d;return db[_0xdf43('0x21')][_0xdf43('0x42')]({'where':{'id':_0x47fc7f['params']['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x3a9119,null))['then'](function(_0xab7ee8){if(_0xab7ee8){_0x3c417d=_0xab7ee8['get']({'plain':!![]});_0x3888ab[_0xdf43('0x2d')]=_[_0xdf43('0x2b')](db['UserMailQueue']['rawAttributes']);_0x3888ab['query']=_[_0xdf43('0x2b')](_0x47fc7f['query']);_0x3888ab['filters']=_[_0xdf43('0x2f')](_0x3888ab[_0xdf43('0x2d')],_0x3888ab[_0xdf43('0x27')]);_0x8a100d['attributes']=_[_0xdf43('0x2f')](_0x3888ab['model'],qs[_0xdf43('0x30')](_0x47fc7f['query'][_0xdf43('0x30')]));_0x8a100d[_0xdf43('0x2e')]=_0x8a100d[_0xdf43('0x2e')][_0xdf43('0x43')]?_0x8a100d[_0xdf43('0x2e')]:_0x3888ab[_0xdf43('0x2d')];if(!_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x44')](_0xdf43('0x45'))){_0x8a100d[_0xdf43('0x16')]=qs[_0xdf43('0x16')](_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x16')]);_0x8a100d[_0xdf43('0x13')]=qs[_0xdf43('0x13')](_0x47fc7f[_0xdf43('0x27')]['offset']);}_0x8a100d[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x47')]);_0x8a100d['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0x47fc7f['query'],_0x3888ab['filters']));_0x8a100d['where'][_0xdf43('0x49')]=_0xab7ee8['id'];if(_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x4a')]){_0x8a100d[_0xdf43('0x25')]=_[_0xdf43('0x32')](_0x8a100d[_0xdf43('0x25')],{'$or':_['map'](_0x8a100d[_0xdf43('0x2e')],function(_0x4d0840){var _0x4c1568={};_0x4c1568[_0x4d0840]={'$like':'%'+_0x47fc7f[_0xdf43('0x27')][_0xdf43('0x4a')]+'%'};return _0x4c1568;})});}_0x8a100d=_['merge']({},_0x8a100d,_0x47fc7f[_0xdf43('0x33')]);return db[_0xdf43('0x4b')][_0xdf43('0x4c')](_0x8a100d);}})[_0xdf43('0x19')](function(_0x38feac){if(_0x38feac){return db['User'][_0xdf43('0x4d')]({'where':{'id':_[_0xdf43('0x20')](_0x38feac,_0xdf43('0x4e')),'role':_0xdf43('0x4f')},'attributes':['id',_0xdf43('0x1d'),_0xdf43('0x50'),_0xdf43('0x51'),_0xdf43('0x52')]});}})[_0xdf43('0x19')](function(_0x57cefa){if(_0x57cefa){return{'count':_0x57cefa[_0xdf43('0x15')],'rows':_[_0xdf43('0x20')](_0x57cefa['rows'],function(_0x4c86d8){return{'membername':_0x4c86d8[_0xdf43('0x1d')],'UserId':_0x4c86d8['id'],'queue_name':_0x3c417d[_0xdf43('0x1d')],'MailQueueId':_0x3c417d['id'],'interface':util[_0xdf43('0x53')](_0xdf43('0x54'),_0xdf43('0x55'),_0x4c86d8['name']),'penalty':0x0,'paused':_0x4c86d8[_0xdf43('0x50')],'createdAt':_0x4c86d8[_0xdf43('0x52')],'updatedAt':_0x4c86d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf43('0x19')](respondWithFilteredResult(_0x3a9119,_0x8a100d))['catch'](handleError(_0x3a9119,null));};exports[_0xdf43('0x56')]=function(_0x4c5e16,_0x2c7c61){var _0x13dbaa={};var _0x3e9529={};var _0x48b4f4;var _0x311426;return db['MailQueue'][_0xdf43('0x42')]({'where':{'id':_0x4c5e16[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c7c61,null))[_0xdf43('0x19')](function(_0x137810){if(_0x137810){_0x48b4f4=_0x137810;_0x3e9529[_0xdf43('0x2d')]=_[_0xdf43('0x2b')](db['Team'][_0xdf43('0x2a')]);_0x3e9529[_0xdf43('0x27')]=_['keys'](_0x4c5e16[_0xdf43('0x27')]);_0x3e9529[_0xdf43('0x2c')]=_['intersection'](_0x3e9529[_0xdf43('0x2d')],_0x3e9529[_0xdf43('0x27')]);_0x13dbaa['attributes']=_[_0xdf43('0x2f')](_0x3e9529[_0xdf43('0x2d')],qs['fields'](_0x4c5e16[_0xdf43('0x27')]['fields']));_0x13dbaa['attributes']=_0x13dbaa['attributes']['length']?_0x13dbaa[_0xdf43('0x2e')]:_0x3e9529['model'];_0x13dbaa[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0x4c5e16['query'][_0xdf43('0x47')]);_0x13dbaa['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0x4c5e16[_0xdf43('0x27')],_0x3e9529[_0xdf43('0x2c')]));if(_0x4c5e16[_0xdf43('0x27')]['filter']){_0x13dbaa['where']=_[_0xdf43('0x32')](_0x13dbaa[_0xdf43('0x25')],{'$or':_['map'](_0x13dbaa[_0xdf43('0x2e')],function(_0x426642){var _0x49820f={};_0x49820f[_0x426642]={'$like':'%'+_0x4c5e16['query']['filter']+'%'};return _0x49820f;})});}_0x13dbaa=_[_0xdf43('0x32')]({},_0x13dbaa,_0x4c5e16[_0xdf43('0x33')]);return _0x48b4f4['getTeams'](_0x13dbaa);}})[_0xdf43('0x19')](function(_0x5600b9){if(_0x5600b9){_0x311426=_0x5600b9['length'];if(!_0x4c5e16['query'][_0xdf43('0x44')](_0xdf43('0x45'))){_0x13dbaa[_0xdf43('0x16')]=qs['limit'](_0x4c5e16[_0xdf43('0x27')][_0xdf43('0x16')]);_0x13dbaa['offset']=qs[_0xdf43('0x13')](_0x4c5e16[_0xdf43('0x27')][_0xdf43('0x13')]);}return _0x48b4f4[_0xdf43('0x56')](_0x13dbaa);}})[_0xdf43('0x19')](function(_0x368602){if(_0x368602){return _0x368602?{'count':_0x311426,'rows':_0x368602}:null;}})[_0xdf43('0x19')](respondWithResult(_0x2c7c61,null))[_0xdf43('0x29')](handleError(_0x2c7c61,null));};exports[_0xdf43('0x57')]=function(_0x303261,_0x1b1507){var _0x3563b8=_0x303261[_0xdf43('0x3e')][_0xdf43('0x58')];return db[_0xdf43('0x59')][_0xdf43('0x4c')]({'where':{'id':_0x3563b8},'attributes':['id'],'include':[{'model':db[_0xdf43('0x5a')],'as':'Agents','attributes':['id','name','online',_0xdf43('0x5b'),_0xdf43('0x5c')],'raw':!![]}]})['then'](function(_0x4f347f){if(_0x4f347f){var _0x291dc4=_[_0xdf43('0x5d')](_0x4f347f,function(_0x3bf9b2){var _0x533428=_0x3bf9b2[_0xdf43('0x36')]({'plain':!![]});return _0x533428[_0xdf43('0x5e')];});return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x303261['params']['id']}})[_0xdf43('0x19')](function(_0x306e02){return db[_0xdf43('0x5f')][_0xdf43('0x60')](function(_0x443af8){return _0x306e02[_0xdf43('0x57')](_0x3563b8,{'transaction':_0x443af8})['then'](function(){return BPromise[_0xdf43('0x61')](_0x291dc4,function(_0x683f3){return db[_0xdf43('0x4b')][_0xdf43('0x62')]({'where':{'UserId':_0x683f3['id'],'MailQueueId':_0x303261[_0xdf43('0x3f')]['id']},'transaction':_0x443af8});});})[_0xdf43('0x19')](function(){_0x291dc4['forEach'](function(_0x16eb25){socket[_0xdf43('0x63')](_0xdf43('0x64'),{'UserId':_0x16eb25['id'],'MailQueueId':_0x306e02['id']});});});});});}})[_0xdf43('0x19')](respondWithStatusCode(_0x1b1507,null))['catch'](handleError(_0x1b1507,null));};exports[_0xdf43('0x65')]=function(_0x582c5a,_0x5cd0a8){return db[_0xdf43('0x59')][_0xdf43('0x4c')]({'where':{'id':_0x582c5a['query'][_0xdf43('0x58')]},'attributes':['id'],'include':[{'model':db[_0xdf43('0x5a')],'as':_0xdf43('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cd0a8,null))[_0xdf43('0x19')](function(_0x1827ac){var _0x11350b=_[_0xdf43('0x20')](_0x1827ac,'id');var _0x44992c=[];var _0x583509=[];var _0x2fa37f=squel[_0xdf43('0x66')]();_0x2fa37f[_0xdf43('0x67')](_0xdf43('0x68'))['from'](_0xdf43('0x69'),'tq')[_0xdf43('0x6a')](_0xdf43('0x6b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x582c5a[_0xdf43('0x3f')]['id']);for(var _0x872db8=0x0;_0x872db8<_0x1827ac[_0xdf43('0x43')];_0x872db8+=0x1){let _0x48bf9e=_0x1827ac[_0x872db8];for(var _0x44b842=0x0;_0x44b842<_0x48bf9e[_0xdf43('0x5e')][_0xdf43('0x43')];_0x44b842+=0x1){let _0x18cd51=_0x48bf9e['Agents'][_0x44b842];var _0x2aa57c=_0x2fa37f['clone']();_0x2aa57c['where'](_0xdf43('0x6c'),_0x18cd51['id']);_0x583509[_0xdf43('0x6d')](db['sequelize'][_0xdf43('0x27')](_0x2aa57c['toString'](),{'type':db['sequelize'][_0xdf43('0x6e')][_0xdf43('0x6f')]})[_0xdf43('0x19')](function(_0x13544c){if(_0x13544c[_0xdf43('0x43')]===0x1){return _0x18cd51['id'];}else{var _0x13daaa=_[_0xdf43('0x70')](_['map'](_0x13544c,'TeamId'),function(_0x25737d){return _[_0xdf43('0x71')](_0x11350b,_0x25737d);});if(_0x13daaa){return _0x18cd51['id'];}}}));}}return BPromise[_0xdf43('0x72')](_0x583509)[_0xdf43('0x19')](function(_0x220200){_0x44992c=_(_0x44992c)[_0xdf43('0x73')](_0x220200)[_0xdf43('0x74')]()[_0xdf43('0x75')]();return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x582c5a[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](function(_0x43b0df){return db['sequelize']['transaction'](function(_0x1ccd03){return _0x43b0df['removeTeams'](_0x582c5a[_0xdf43('0x27')][_0xdf43('0x58')],{'transaction':_0x1ccd03})[_0xdf43('0x19')](function(){if(!_[_0xdf43('0x76')](_0x44992c)){return _0x43b0df['removeAgents'](_0x44992c,{'transaction':_0x1ccd03});}})[_0xdf43('0x19')](function(){_0x44992c[_0xdf43('0x77')](function(_0x2a7c85){socket[_0xdf43('0x63')](_0xdf43('0x78'),{'UserId':_0x2a7c85,'MailQueueId':_0x43b0df['id']});});});});});});})[_0xdf43('0x19')](respondWithStatusCode(_0x5cd0a8,null))[_0xdf43('0x29')](handleError(_0x5cd0a8,null));};exports[_0xdf43('0x79')]=function(_0x39ad56,_0x4671be){return db['MailQueue'][_0xdf43('0x34')]({'where':{'id':_0x39ad56[_0xdf43('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4671be,null))['then'](function(_0x14a213){if(_0x14a213){return _0x14a213[_0xdf43('0x79')](_0x39ad56['body'][_0xdf43('0x58')],_['omit'](_0x39ad56[_0xdf43('0x3e')],[_0xdf43('0x58'),'id'])||{})[_0xdf43('0x7a')](function(_0x536a64){for(var _0x633cd=0x0;_0x633cd<_0x39ad56['body'][_0xdf43('0x58')][_0xdf43('0x43')];_0x633cd+=0x1){socket['emit'](_0xdf43('0x64'),{'UserId':Number(_0x39ad56[_0xdf43('0x3e')]['ids'][_0x633cd]),'MailQueueId':Number(_0x39ad56[_0xdf43('0x3f')]['id'])});}return _0x536a64;});}})['then'](respondWithResult(_0x4671be,null))[_0xdf43('0x29')](handleError(_0x4671be,null));};exports['removeAgents']=function(_0x4dc535,_0x3bfeff){return db[_0xdf43('0x21')][_0xdf43('0x34')]({'where':{'id':_0x4dc535[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x3bfeff,null))['then'](function(_0x9b175b){if(_0x9b175b){return _0x9b175b['removeAgents'](_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')])[_0xdf43('0x19')](function(){if(_['isArray'](_0x4dc535[_0xdf43('0x27')]['ids'])){for(var _0x1f5ad0=0x0;_0x1f5ad0<_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')][_0xdf43('0x43')];_0x1f5ad0+=0x1){socket['emit'](_0xdf43('0x78'),{'UserId':Number(_0x4dc535['query']['ids'][_0x1f5ad0]),'MailQueueId':Number(_0x4dc535['params']['id'])});}}else{socket[_0xdf43('0x63')](_0xdf43('0x78'),{'UserId':Number(_0x4dc535[_0xdf43('0x27')][_0xdf43('0x58')]),'MailQueueId':Number(_0x4dc535[_0xdf43('0x3f')]['id'])});}});}})[_0xdf43('0x19')](respondWithStatusCode(_0x3bfeff,null))[_0xdf43('0x29')](handleError(_0x3bfeff,null));};exports[_0xdf43('0x7b')]=function(_0xdeaa7c,_0x18e4b0){var _0x43e1c2={};var _0x18ea8d={};var _0x4f9036;var _0x23ca26;return db[_0xdf43('0x21')][_0xdf43('0x42')]({'where':{'id':_0xdeaa7c[_0xdf43('0x3f')]['id']}})[_0xdf43('0x19')](handleEntityNotFound(_0x18e4b0,null))[_0xdf43('0x19')](function(_0x556567){if(_0x556567){_0x4f9036=_0x556567;_0x18ea8d[_0xdf43('0x2d')]=_['keys'](db[_0xdf43('0x5a')]['rawAttributes']);_0x18ea8d['query']=_[_0xdf43('0x2b')](_0xdeaa7c['query']);_0x18ea8d[_0xdf43('0x2c')]=_[_0xdf43('0x2f')](_0x18ea8d[_0xdf43('0x2d')],_0x18ea8d[_0xdf43('0x27')]);_0x43e1c2[_0xdf43('0x2e')]=_[_0xdf43('0x2f')](_0x18ea8d['model'],qs[_0xdf43('0x30')](_0xdeaa7c['query'][_0xdf43('0x30')]));_0x43e1c2[_0xdf43('0x2e')]=_0x43e1c2[_0xdf43('0x2e')][_0xdf43('0x43')]?_0x43e1c2[_0xdf43('0x2e')]:_0x18ea8d[_0xdf43('0x2d')];_0x43e1c2[_0xdf43('0x46')]=qs[_0xdf43('0x47')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x47')]);_0x43e1c2['where']=qs[_0xdf43('0x2c')](_[_0xdf43('0x48')](_0xdeaa7c['query'],_0x18ea8d[_0xdf43('0x2c')]));if(_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x4a')]){_0x43e1c2['where']=_[_0xdf43('0x32')](_0x43e1c2[_0xdf43('0x25')],{'$or':_[_0xdf43('0x20')](_0x43e1c2[_0xdf43('0x2e')],function(_0x4325ce){var _0x1c440e={};_0x1c440e[_0x4325ce]={'$like':'%'+_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x4a')]+'%'};return _0x1c440e;})});}_0x43e1c2=_['merge']({},_0x43e1c2,_0xdeaa7c[_0xdf43('0x33')]);return _0x4f9036[_0xdf43('0x7b')](_0x43e1c2);}})[_0xdf43('0x19')](function(_0x10993c){if(_0x10993c){_0x23ca26=_0x10993c[_0xdf43('0x43')];if(!_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x44')](_0xdf43('0x45'))){_0x43e1c2[_0xdf43('0x16')]=qs[_0xdf43('0x16')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x16')]);_0x43e1c2['offset']=qs[_0xdf43('0x13')](_0xdeaa7c[_0xdf43('0x27')][_0xdf43('0x13')]);}return _0x4f9036[_0xdf43('0x7b')](_0x43e1c2);}})['then'](function(_0x453c9b){if(_0x453c9b){return _0x453c9b?{'count':_0x23ca26,'rows':_0x453c9b}:null;}})[_0xdf43('0x19')](respondWithResult(_0x18e4b0,null))[_0xdf43('0x29')](handleError(_0x18e4b0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f469ed6..c4b7410 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 _0xaed3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x572734,_0x62341c){var _0x51be8a=function(_0x552498){while(--_0x552498){_0x572734['push'](_0x572734['shift']());}};_0x51be8a(++_0x62341c);}(_0xaed3,0x124));var _0x3aed=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xaed3[_0x221ba2];return _0x47d08e;};'use strict';var EventEmitter=require(_0x3aed('0x0'));var MailQueue=require(_0x3aed('0x1'))['db'][_0x3aed('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3aed('0x3')](0x0);var events={'afterCreate':_0x3aed('0x4'),'afterUpdate':_0x3aed('0x5'),'afterDestroy':_0x3aed('0x6')};function emitEvent(_0x31ab15){return function(_0x1176a3,_0x182158,_0xcd0c3f){MailQueueEvents[_0x3aed('0x7')](_0x31ab15+':'+_0x1176a3['id'],_0x1176a3);MailQueueEvents['emit'](_0x31ab15,_0x1176a3);_0xcd0c3f(null);};}for(var e in events){if(events[_0x3aed('0x8')](e)){var event=events[e];MailQueue[_0x3aed('0x9')](e,emitEvent(event));}}module[_0x3aed('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xce83=['exports','events','setMaxListeners','save','remove','emit','hook'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xce83,0x78));var _0x3ce8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xce83[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0x3ce8('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3ce8('0x1')](0x0);var events={'afterCreate':_0x3ce8('0x2'),'afterUpdate':'update','afterDestroy':_0x3ce8('0x3')};function emitEvent(_0x1990bf){return function(_0x23dea0,_0x53bb5b,_0x2161f1){MailQueueEvents[_0x3ce8('0x4')](_0x1990bf+':'+_0x23dea0['id'],_0x23dea0);MailQueueEvents['emit'](_0x1990bf,_0x23dea0);_0x2161f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3ce8('0x5')](e,emitEvent(event));}}module[_0x3ce8('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7c3ae4d..26760dc 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 _0xd997=['request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x51d3cf,_0x434aca){var _0x3fec48=function(_0x9e3bfc){while(--_0x9e3bfc){_0x51d3cf['push'](_0x51d3cf['shift']());}};_0x3fec48(++_0x434aca);}(_0xd997,0x133));var _0x7d99=function(_0x588e18,_0x15df15){_0x588e18=_0x588e18-0x0;var _0x1d32e0=_0xd997[_0x588e18];return _0x1d32e0;};'use strict';var _=require(_0x7d99('0x0'));var util=require(_0x7d99('0x1'));var logger=require(_0x7d99('0x2'))('api');var moment=require(_0x7d99('0x3'));var BPromise=require(_0x7d99('0x4'));var rp=require(_0x7d99('0x5'));var fs=require('fs');var path=require(_0x7d99('0x6'));var rimraf=require(_0x7d99('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d99('0x8'));module[_0x7d99('0x9')]=function(_0x4a0d32,_0x551ba6){return _0x4a0d32[_0x7d99('0xa')](_0x7d99('0xb'),attributes,{'tableName':_0x7d99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65eb=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x5713d5,_0x4bd736){var _0x52e536=function(_0x25fdda){while(--_0x25fdda){_0x5713d5['push'](_0x5713d5['shift']());}};_0x52e536(++_0x4bd736);}(_0x65eb,0x9f));var _0xb65e=function(_0x53e8c9,_0x2ab57d){_0x53e8c9=_0x53e8c9-0x0;var _0x5e0aa9=_0x65eb[_0x53e8c9];return _0x5e0aa9;};'use strict';var _=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var logger=require(_0xb65e('0x2'))('api');var moment=require(_0xb65e('0x3'));var BPromise=require(_0xb65e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb65e('0x5'));var rimraf=require('rimraf');var config=require(_0xb65e('0x6'));var attributes=require(_0xb65e('0x7'));module[_0xb65e('0x8')]=function(_0x2ff7ea,_0x49f1a3){return _0x2ff7ea[_0xb65e('0x9')](_0xb65e('0xa'),attributes,{'tableName':_0xb65e('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 9cd0495..c7e2923 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 _0xa7cf=['limit','map','model','include','debug','catch','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailQueue','MailQueue','options','where','attributes'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xa7cf,0xf9));var _0xfa7c=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xa7cf[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0xfa7c('0x0'));var util=require(_0xfa7c('0x1'));var moment=require(_0xfa7c('0x2'));var BPromise=require(_0xfa7c('0x3'));var rs=require(_0xfa7c('0x4'));var fs=require('fs');var Redis=require(_0xfa7c('0x5'));var db=require(_0xfa7c('0x6'))['db'];var utils=require(_0xfa7c('0x7'));var logger=require(_0xfa7c('0x8'))('rpc');var config=require(_0xfa7c('0x9'));var jayson=require(_0xfa7c('0xa'));var client=jayson[_0xfa7c('0xb')][_0xfa7c('0xc')]({'port':0x232a});config[_0xfa7c('0xd')]=_['defaults'](config[_0xfa7c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa7c('0xe'))(new Redis(config[_0xfa7c('0xd')]));require('./mailQueue.socket')[_0xfa7c('0xf')](socket);function respondWithRpcPromise(_0x3ff6ed,_0x533ef4,_0x522a1e){return new BPromise(function(_0x3fbeab,_0x802e94){return client[_0xfa7c('0x10')](_0x3ff6ed,_0x522a1e)[_0xfa7c('0x11')](function(_0x2646b3){logger[_0xfa7c('0x12')](_0xfa7c('0x13'),_0x533ef4,_0xfa7c('0x14'));logger['debug'](_0xfa7c('0x15'),_0x533ef4,_0xfa7c('0x14'),JSON[_0xfa7c('0x16')](_0x2646b3));if(_0x2646b3[_0xfa7c('0x17')]){if(_0x2646b3['error'][_0xfa7c('0x18')]===0x1f4){logger[_0xfa7c('0x17')](_0xfa7c('0x13'),_0x533ef4,_0x2646b3[_0xfa7c('0x17')][_0xfa7c('0x19')]);return _0x802e94(_0x2646b3[_0xfa7c('0x17')][_0xfa7c('0x19')]);}logger[_0xfa7c('0x17')](_0xfa7c('0x13'),_0x533ef4,_0x2646b3['error']['message']);return _0x3fbeab(_0x2646b3['error'][_0xfa7c('0x19')]);}else{logger[_0xfa7c('0x12')](_0xfa7c('0x13'),_0x533ef4,_0xfa7c('0x14'));_0x3fbeab(_0x2646b3['result'][_0xfa7c('0x19')]);}})['catch'](function(_0x304a40){logger[_0xfa7c('0x17')](_0xfa7c('0x13'),_0x533ef4,_0x304a40);_0x802e94(_0x304a40);});});}exports[_0xfa7c('0x1a')]=function(_0x1acba8){var _0x5a7330=this;return new Promise(function(_0x524ba9,_0x56e2f2){return db[_0xfa7c('0x1b')]['findAll']({'raw':_0x1acba8['options']?_0x1acba8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1acba8['options']?_0x1acba8[_0xfa7c('0x1c')][_0xfa7c('0x1d')]||null:null,'attributes':_0x1acba8['options']?_0x1acba8[_0xfa7c('0x1c')][_0xfa7c('0x1e')]||null:null,'limit':_0x1acba8[_0xfa7c('0x1c')]?_0x1acba8['options'][_0xfa7c('0x1f')]||null:null,'include':_0x1acba8['options']?_0x1acba8['options']['include']?_[_0xfa7c('0x20')](_0x1acba8[_0xfa7c('0x1c')]['include'],function(_0x4c7a3d){return{'model':db[_0x4c7a3d[_0xfa7c('0x21')]],'as':_0x4c7a3d['as'],'attributes':_0x4c7a3d[_0xfa7c('0x1e')],'include':_0x4c7a3d[_0xfa7c('0x22')]?_[_0xfa7c('0x20')](_0x4c7a3d[_0xfa7c('0x22')],function(_0x50a75a){return{'model':db[_0x50a75a['model']],'as':_0x50a75a['as'],'attributes':_0x50a75a[_0xfa7c('0x1e')],'include':_0x50a75a[_0xfa7c('0x22')]?_[_0xfa7c('0x20')](_0x50a75a[_0xfa7c('0x22')],function(_0x24f912){return{'model':db[_0x24f912[_0xfa7c('0x21')]],'as':_0x24f912['as'],'attributes':_0x24f912[_0xfa7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfa7c('0x11')](function(_0xe5f5a9){logger['info'](_0xfa7c('0x1a'),_0x1acba8);logger[_0xfa7c('0x23')](_0xfa7c('0x1a'),_0x1acba8,JSON[_0xfa7c('0x16')](_0xe5f5a9));_0x524ba9(_0xe5f5a9);})[_0xfa7c('0x24')](function(_0x6e459e){logger[_0xfa7c('0x17')](_0xfa7c('0x1a'),_0x6e459e[_0xfa7c('0x19')],_0x1acba8);_0x56e2f2(_0x5a7330[_0xfa7c('0x17')](0x1f4,_0x6e459e[_0xfa7c('0x19')]));});});};exports[_0xfa7c('0x25')]=function(_0x259001){var _0x1b899d=this;return new Promise(function(_0x4c2ff2,_0x3bf197){return db[_0xfa7c('0x1b')][_0xfa7c('0x26')]({'raw':_0x259001[_0xfa7c('0x1c')]?_0x259001[_0xfa7c('0x1c')][_0xfa7c('0x27')]===undefined?!![]:![]:!![],'where':_0x259001['options']?_0x259001['options'][_0xfa7c('0x1d')]||null:null,'attributes':_0x259001['options']?_0x259001[_0xfa7c('0x1c')][_0xfa7c('0x1e')]||null:null,'include':_0x259001[_0xfa7c('0x1c')]?_0x259001[_0xfa7c('0x1c')][_0xfa7c('0x22')]?_[_0xfa7c('0x20')](_0x259001[_0xfa7c('0x1c')][_0xfa7c('0x22')],function(_0x546dd2){return{'model':db[_0x546dd2[_0xfa7c('0x21')]],'as':_0x546dd2['as'],'attributes':_0x546dd2['attributes'],'include':_0x546dd2[_0xfa7c('0x22')]?_[_0xfa7c('0x20')](_0x546dd2[_0xfa7c('0x22')],function(_0x34c6b6){return{'model':db[_0x34c6b6['model']],'as':_0x34c6b6['as'],'attributes':_0x34c6b6[_0xfa7c('0x1e')],'include':_0x34c6b6[_0xfa7c('0x22')]?_[_0xfa7c('0x20')](_0x34c6b6['include'],function(_0x146946){return{'model':db[_0x146946[_0xfa7c('0x21')]],'as':_0x146946['as'],'attributes':_0x146946[_0xfa7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfa7c('0x11')](function(_0x46fcf9){logger[_0xfa7c('0x12')]('ShowMailQueue',_0x259001);logger['debug'](_0xfa7c('0x25'),_0x259001,JSON[_0xfa7c('0x16')](_0x46fcf9));_0x4c2ff2(_0x46fcf9);})[_0xfa7c('0x24')](function(_0x3c431b){logger[_0xfa7c('0x17')](_0xfa7c('0x25'),_0x3c431b[_0xfa7c('0x19')],_0x259001);_0x3bf197(_0x1b899d[_0xfa7c('0x17')](0x1f4,_0x3c431b['message']));});});}; \ No newline at end of file +var _0x009f=['catch','ShowMailQueue','find','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','request\x20sent','error','code','message','MailQueue,\x20%s,\x20%s','result','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue'];(function(_0x20bb6a,_0x30050f){var _0x3ecd27=function(_0xd5594c){while(--_0xd5594c){_0x20bb6a['push'](_0x20bb6a['shift']());}};_0x3ecd27(++_0x30050f);}(_0x009f,0x194));var _0xf009=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x009f[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require(_0xf009('0x0'));var util=require(_0xf009('0x1'));var moment=require(_0xf009('0x2'));var BPromise=require('bluebird');var rs=require(_0xf009('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf009('0x4'))['db'];var utils=require(_0xf009('0x5'));var logger=require(_0xf009('0x6'))(_0xf009('0x7'));var config=require('../../config/environment');var jayson=require(_0xf009('0x8'));var client=jayson[_0xf009('0x9')][_0xf009('0xa')]({'port':0x232a});config[_0xf009('0xb')]=_[_0xf009('0xc')](config[_0xf009('0xb')],{'host':_0xf009('0xd'),'port':0x18eb});var socket=require(_0xf009('0xe'))(new Redis(config[_0xf009('0xb')]));require('./mailQueue.socket')[_0xf009('0xf')](socket);function respondWithRpcPromise(_0x48a457,_0x39427c,_0x175804){return new BPromise(function(_0x1798cf,_0x163f6f){return client['request'](_0x48a457,_0x175804)[_0xf009('0x10')](function(_0x2b8892){logger[_0xf009('0x11')]('MailQueue,\x20%s,\x20%s',_0x39427c,'request\x20sent');logger[_0xf009('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x39427c,_0xf009('0x13'),JSON['stringify'](_0x2b8892));if(_0x2b8892[_0xf009('0x14')]){if(_0x2b8892[_0xf009('0x14')][_0xf009('0x15')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x39427c,_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);return _0x163f6f(_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);}logger[_0xf009('0x14')](_0xf009('0x17'),_0x39427c,_0x2b8892[_0xf009('0x14')][_0xf009('0x16')]);return _0x1798cf(_0x2b8892['error'][_0xf009('0x16')]);}else{logger[_0xf009('0x11')](_0xf009('0x17'),_0x39427c,_0xf009('0x13'));_0x1798cf(_0x2b8892[_0xf009('0x18')][_0xf009('0x16')]);}})['catch'](function(_0x4efc36){logger[_0xf009('0x14')](_0xf009('0x17'),_0x39427c,_0x4efc36);_0x163f6f(_0x4efc36);});});}exports['GetMailQueue']=function(_0x33617b){var _0x3d4d80=this;return new Promise(function(_0x427386,_0x2829b2){return db[_0xf009('0x19')][_0xf009('0x1a')]({'raw':_0x33617b['options']?_0x33617b[_0xf009('0x1b')][_0xf009('0x1c')]===undefined?!![]:![]:!![],'where':_0x33617b[_0xf009('0x1b')]?_0x33617b['options'][_0xf009('0x1d')]||null:null,'attributes':_0x33617b[_0xf009('0x1b')]?_0x33617b[_0xf009('0x1b')][_0xf009('0x1e')]||null:null,'limit':_0x33617b[_0xf009('0x1b')]?_0x33617b[_0xf009('0x1b')][_0xf009('0x1f')]||null:null,'include':_0x33617b['options']?_0x33617b['options']['include']?_[_0xf009('0x20')](_0x33617b[_0xf009('0x1b')][_0xf009('0x21')],function(_0x33cce9){return{'model':db[_0x33cce9[_0xf009('0x22')]],'as':_0x33cce9['as'],'attributes':_0x33cce9['attributes'],'include':_0x33cce9['include']?_[_0xf009('0x20')](_0x33cce9[_0xf009('0x21')],function(_0x2e0d2c){return{'model':db[_0x2e0d2c[_0xf009('0x22')]],'as':_0x2e0d2c['as'],'attributes':_0x2e0d2c[_0xf009('0x1e')],'include':_0x2e0d2c[_0xf009('0x21')]?_['map'](_0x2e0d2c[_0xf009('0x21')],function(_0x4045e5){return{'model':db[_0x4045e5[_0xf009('0x22')]],'as':_0x4045e5['as'],'attributes':_0x4045e5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x285c93){logger[_0xf009('0x11')](_0xf009('0x23'),_0x33617b);logger[_0xf009('0x12')](_0xf009('0x23'),_0x33617b,JSON['stringify'](_0x285c93));_0x427386(_0x285c93);})[_0xf009('0x24')](function(_0x382925){logger[_0xf009('0x14')](_0xf009('0x23'),_0x382925[_0xf009('0x16')],_0x33617b);_0x2829b2(_0x3d4d80[_0xf009('0x14')](0x1f4,_0x382925[_0xf009('0x16')]));});});};exports[_0xf009('0x25')]=function(_0x29cdd3){var _0x1aff17=this;return new Promise(function(_0x24ecd1,_0x29e433){return db['MailQueue'][_0xf009('0x26')]({'raw':_0x29cdd3[_0xf009('0x1b')]?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x1c')]===undefined?!![]:![]:!![],'where':_0x29cdd3[_0xf009('0x1b')]?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x1d')]||null:null,'attributes':_0x29cdd3['options']?_0x29cdd3[_0xf009('0x1b')]['attributes']||null:null,'include':_0x29cdd3['options']?_0x29cdd3[_0xf009('0x1b')][_0xf009('0x21')]?_[_0xf009('0x20')](_0x29cdd3[_0xf009('0x1b')]['include'],function(_0x266088){return{'model':db[_0x266088[_0xf009('0x22')]],'as':_0x266088['as'],'attributes':_0x266088[_0xf009('0x1e')],'include':_0x266088['include']?_[_0xf009('0x20')](_0x266088['include'],function(_0x599409){return{'model':db[_0x599409[_0xf009('0x22')]],'as':_0x599409['as'],'attributes':_0x599409['attributes'],'include':_0x599409['include']?_['map'](_0x599409['include'],function(_0x2c42fc){return{'model':db[_0x2c42fc[_0xf009('0x22')]],'as':_0x2c42fc['as'],'attributes':_0x2c42fc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df1ac){logger[_0xf009('0x11')](_0xf009('0x25'),_0x29cdd3);logger[_0xf009('0x12')](_0xf009('0x25'),_0x29cdd3,JSON[_0xf009('0x27')](_0x5df1ac));_0x24ecd1(_0x5df1ac);})[_0xf009('0x24')](function(_0xf9f2e6){logger[_0xf009('0x14')](_0xf009('0x25'),_0xf9f2e6['message'],_0x29cdd3);_0x29e433(_0x1aff17['error'](0x1f4,_0xf9f2e6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1f90898..e909df4 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 _0x5f9f=['./mailQueue.events','update','length'];(function(_0x579f3f,_0x24511c){var _0x5053d5=function(_0x4853){while(--_0x4853){_0x579f3f['push'](_0x579f3f['shift']());}};_0x5053d5(++_0x24511c);}(_0x5f9f,0xa5));var _0xf5f9=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x5f9f[_0x31cb5f];return _0x586042;};'use strict';var MailQueueEvents=require(_0xf5f9('0x0'));var events=['save','remove',_0xf5f9('0x1')];function createListener(_0x4240e4,_0x515d36){return function(_0x43e489){_0x515d36['emit'](_0x4240e4,_0x43e489);};}function removeListener(_0x1bb1e1,_0x7bd4cf){return function(){MailQueueEvents['removeListener'](_0x1bb1e1,_0x7bd4cf);};}exports['register']=function(_0x4969aa){for(var _0x2e2b8c=0x0,_0x3ee92f=events[_0xf5f9('0x2')];_0x2e2b8c<_0x3ee92f;_0x2e2b8c++){var _0x1989e3=events[_0x2e2b8c];var _0x31dbe5=createListener('mailQueue:'+_0x1989e3,_0x4969aa);MailQueueEvents['on'](_0x1989e3,_0x31dbe5);}}; \ No newline at end of file +var _0x92a3=['remove','update','emit','removeListener','register','./mailQueue.events','save'];(function(_0x4e76cb,_0x2fbc24){var _0x458e7d=function(_0x26670e){while(--_0x26670e){_0x4e76cb['push'](_0x4e76cb['shift']());}};_0x458e7d(++_0x2fbc24);}(_0x92a3,0x140));var _0x392a=function(_0x1d344b,_0x3a2a0a){_0x1d344b=_0x1d344b-0x0;var _0x4f3b20=_0x92a3[_0x1d344b];return _0x4f3b20;};'use strict';var MailQueueEvents=require(_0x392a('0x0'));var events=[_0x392a('0x1'),_0x392a('0x2'),_0x392a('0x3')];function createListener(_0x4df5d3,_0x20f259){return function(_0x41fc48){_0x20f259[_0x392a('0x4')](_0x4df5d3,_0x41fc48);};}function removeListener(_0x27d515,_0x1007b6){return function(){MailQueueEvents[_0x392a('0x5')](_0x27d515,_0x1007b6);};}exports[_0x392a('0x6')]=function(_0x5988cc){for(var _0x1af800=0x0,_0x38cbde=events['length'];_0x1af800<_0x38cbde;_0x1af800++){var _0x41f599=events[_0x1af800];var _0xe4c3b=createListener('mailQueue:'+_0x41f599,_0x5988cc);MailQueueEvents['on'](_0x41f599,_0xe4c3b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8d461f1..99eb97d 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 _0x853a=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d7f04,_0x50e80c){var _0x36d3e8=function(_0x2998a1){while(--_0x2998a1){_0x2d7f04['push'](_0x2d7f04['shift']());}};_0x36d3e8(++_0x50e80c);}(_0x853a,0x74));var _0xa853=function(_0x2328a7,_0x3c1e62){_0x2328a7=_0x2328a7-0x0;var _0x17ef7a=_0x853a[_0x2328a7];return _0x17ef7a;};'use strict';var multer=require(_0xa853('0x0'));var util=require(_0xa853('0x1'));var path=require(_0xa853('0x2'));var timeout=require(_0xa853('0x3'));var express=require(_0xa853('0x4'));var router=express[_0xa853('0x5')]();var fs_extra=require(_0xa853('0x6'));var auth=require(_0xa853('0x7'));var interaction=require(_0xa853('0x8'));var config=require(_0xa853('0x9'));var controller=require(_0xa853('0xa'));router[_0xa853('0xb')]('/',auth[_0xa853('0xc')](),controller[_0xa853('0xd')]);router['get'](_0xa853('0xe'),auth[_0xa853('0xc')](),controller[_0xa853('0xf')]);router[_0xa853('0xb')](_0xa853('0x10'),auth[_0xa853('0xc')](),controller[_0xa853('0x11')]);router[_0xa853('0x12')]('/',auth[_0xa853('0xc')](),controller[_0xa853('0x13')]);router[_0xa853('0x14')](_0xa853('0x10'),auth[_0xa853('0xc')](),controller[_0xa853('0x15')]);router[_0xa853('0x16')](_0xa853('0x10'),auth[_0xa853('0xc')](),controller[_0xa853('0x17')]);module[_0xa853('0x18')]=router; \ No newline at end of file +var _0x78ed=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1081a3,_0x2ac784){var _0x5696a2=function(_0x23d2f6){while(--_0x23d2f6){_0x1081a3['push'](_0x1081a3['shift']());}};_0x5696a2(++_0x2ac784);}(_0x78ed,0x191));var _0xd78e=function(_0x5af3dc,_0x10a54c){_0x5af3dc=_0x5af3dc-0x0;var _0x1ea202=_0x78ed[_0x5af3dc];return _0x1ea202;};'use strict';var multer=require(_0xd78e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd78e('0x1'));var express=require(_0xd78e('0x2'));var router=express[_0xd78e('0x3')]();var fs_extra=require(_0xd78e('0x4'));var auth=require(_0xd78e('0x5'));var interaction=require(_0xd78e('0x6'));var config=require(_0xd78e('0x7'));var controller=require('./mailQueueReport.controller');router[_0xd78e('0x8')]('/',auth[_0xd78e('0x9')](),controller['index']);router['get'](_0xd78e('0xa'),auth[_0xd78e('0x9')](),controller[_0xd78e('0xb')]);router['get'](_0xd78e('0xc'),auth[_0xd78e('0x9')](),controller[_0xd78e('0xd')]);router[_0xd78e('0xe')]('/',auth[_0xd78e('0x9')](),controller[_0xd78e('0xf')]);router[_0xd78e('0x10')]('/:id',auth[_0xd78e('0x9')](),controller[_0xd78e('0x11')]);router[_0xd78e('0x12')](_0xd78e('0xc'),auth[_0xd78e('0x9')](),controller['destroy']);module[_0xd78e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 743a11c..37b598f 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 _0x3590=['sequelize','exports','STRING','DATE','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3590,0x130));var _0x0359=function(_0x1396c6,_0x1b4ad0){_0x1396c6=_0x1396c6-0x0;var _0x2342a9=_0x3590[_0x1396c6];return _0x2342a9;};'use strict';var moment=require(_0x0359('0x0'));var Sequelize=require(_0x0359('0x1'));module[_0x0359('0x2')]={'uniqueid':{'type':Sequelize[_0x0359('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0359('0x3')]},'joinAt':{'type':Sequelize[_0x0359('0x4')]},'leaveAt':{'type':Sequelize[_0x0359('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0359('0x4')]},'reason':{'type':Sequelize[_0x0359('0x3')]}}; \ No newline at end of file +var _0xfb65=['STRING','DATE','sequelize','exports'];(function(_0x12ece8,_0x2508d7){var _0x236bce=function(_0x41d0f6){while(--_0x41d0f6){_0x12ece8['push'](_0x12ece8['shift']());}};_0x236bce(++_0x2508d7);}(_0xfb65,0x82));var _0x5fb6=function(_0x38b87e,_0x2aa16e){_0x38b87e=_0x38b87e-0x0;var _0x4209d9=_0xfb65[_0x38b87e];return _0x4209d9;};'use strict';var moment=require('moment');var Sequelize=require(_0x5fb6('0x0'));module[_0x5fb6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5fb6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5fb6('0x3')]},'acceptAt':{'type':Sequelize[_0x5fb6('0x3')]},'exitAt':{'type':Sequelize[_0x5fb6('0x3')]},'reason':{'type':Sequelize[_0x5fb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b839e9c..f15a780 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 _0xa30a=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','includeAll','find','body'];(function(_0x59ae5a,_0x56a805){var _0x2cfb9b=function(_0x511e79){while(--_0x511e79){_0x59ae5a['push'](_0x59ae5a['shift']());}};_0x2cfb9b(++_0x56a805);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['MailQueueReport'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));};exports[_0xaa30('0x46')]=function(_0x1ba164,_0xdc32bc){return db[_0xaa30('0x29')][_0xaa30('0x46')]()[_0xaa30('0x23')](respondWithResult(_0xdc32bc,null))['catch'](handleError(_0xdc32bc,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x4090e2,_0x3c77ee){var _0x44b887=function(_0x5eded2){while(--_0x5eded2){_0x4090e2['push'](_0x4090e2['shift']());}};_0x44b887(++_0x3c77ee);}(_0x47c5,0x165));var _0x547c=function(_0x12130b,_0x1e5d98){_0x12130b=_0x12130b-0x0;var _0x398370=_0x47c5[_0x12130b];return _0x398370;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 711c889..39036a6 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 _0x0ecf=['../../config/logger','api','path','exports','MailQueueReport','report_mail_queue','uniqueid','util'];(function(_0x1a647a,_0x3c940c){var _0x205d87=function(_0x4e9218){while(--_0x4e9218){_0x1a647a['push'](_0x1a647a['shift']());}};_0x205d87(++_0x3c940c);}(_0x0ecf,0xbf));var _0xf0ec=function(_0x512f51,_0x3ce44e){_0x512f51=_0x512f51-0x0;var _0xbc3bb4=_0x0ecf[_0x512f51];return _0xbc3bb4;};'use strict';var _=require('lodash');var util=require(_0xf0ec('0x0'));var logger=require(_0xf0ec('0x1'))(_0xf0ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0ec('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xf0ec('0x4')]=function(_0x505222,_0x4a8998){return _0x505222['define'](_0xf0ec('0x5'),attributes,{'tableName':_0xf0ec('0x6'),'paranoid':![],'indexes':[{'name':_0xf0ec('0x7'),'fields':[_0xf0ec('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5699=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0x5699,0x148));var _0x9569=function(_0x571a9d,_0x55f1a4){_0x571a9d=_0x571a9d-0x0;var _0x592105=_0x5699[_0x571a9d];return _0x592105;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var logger=require(_0x9569('0x2'))('api');var moment=require(_0x9569('0x3'));var BPromise=require(_0x9569('0x4'));var rp=require(_0x9569('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9569('0x6'));var attributes=require(_0x9569('0x7'));module['exports']=function(_0x24a67d,_0x47397a){return _0x24a67d[_0x9569('0x8')](_0x9569('0x9'),attributes,{'tableName':_0x9569('0xa'),'paranoid':![],'indexes':[{'name':_0x9569('0xb'),'fields':[_0x9569('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index fff6aad..5d47d51 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x520db8,_0x4606b5){var _0x4e658b=function(_0x7453d0){while(--_0x7453d0){_0x520db8['push'](_0x520db8['shift']());}};_0x4e658b(++_0x4606b5);}(_0xdb28,0x106));var _0x8db2=function(_0x528d77,_0x23e40e){_0x528d77=_0x528d77-0x0;var _0x3cd55d=_0xdb28[_0x528d77];return _0x3cd55d;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3948ec,_0x3dfb10){var _0x2ad8f4=function(_0x4282fb){while(--_0x4282fb){_0x3948ec['push'](_0x3948ec['shift']());}};_0x2ad8f4(++_0x3dfb10);}(_0x2ef3,0xba));var _0x32ef=function(_0x11e942,_0x29dbe8){_0x11e942=_0x11e942-0x0;var _0x456e68=_0x2ef3[_0x11e942];return _0x456e68;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e7d0de0..8677fc3 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x449746,_0x16fda7){var _0x5be1de=function(_0x49d01b){while(--_0x49d01b){_0x449746['push'](_0x449746['shift']());}};_0x5be1de(++_0x16fda7);}(_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');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd40663,_0x2821ee){var _0x5b0a74=function(_0x779c5c){while(--_0x779c5c){_0xd40663['push'](_0xd40663['shift']());}};_0x5b0a74(++_0x2821ee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 22f6ee8..58af48f 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 _0x80f1=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x4ef781,_0x472a5d){var _0x32bce9=function(_0xa1950d){while(--_0xa1950d){_0x4ef781['push'](_0x4ef781['shift']());}};_0x32bce9(++_0x472a5d);}(_0x80f1,0x71));var _0x180f=function(_0x1575d7,_0x14675a){_0x1575d7=_0x1575d7-0x0;var _0x3406a8=_0x80f1[_0x1575d7];return _0x3406a8;};'use strict';var Sequelize=require(_0x180f('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x180f('0x1')]},'authentication':{'type':Sequelize[_0x180f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x180f('0x1')]},'password':{'type':Sequelize[_0x180f('0x1')]},'port':{'type':Sequelize[_0x180f('0x3')]},'tls':{'type':Sequelize[_0x180f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x180f('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x180f('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x180f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x180f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4421=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0xf5b6e,_0x46a714){var _0x2d0afb=function(_0x2a6296){while(--_0x2a6296){_0xf5b6e['push'](_0xf5b6e['shift']());}};_0x2d0afb(++_0x46a714);}(_0x4421,0xbb));var _0x1442=function(_0x2fae20,_0x41cf52){_0x2fae20=_0x2fae20-0x0;var _0x48de81=_0x4421[_0x2fae20];return _0x48de81;};'use strict';var Sequelize=require('sequelize');module[_0x1442('0x0')]={'description':{'type':Sequelize[_0x1442('0x1')]},'host':{'type':Sequelize[_0x1442('0x1')]},'authentication':{'type':Sequelize[_0x1442('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1442('0x1')]},'password':{'type':Sequelize[_0x1442('0x1')]},'port':{'type':Sequelize[_0x1442('0x3')]},'tls':{'type':Sequelize[_0x1442('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1442('0x1')],'defaultValue':_0x1442('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1442('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1442('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1442('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 118e336..25abf29 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 _0xd51d=['../../config/environment','exports','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0xd51d,0x121));var _0xdd51=function(_0x462ca8,_0x47ff96){_0x462ca8=_0x462ca8-0x0;var _0x11896e=_0xd51d[_0x462ca8];return _0x11896e;};'use strict';var _=require(_0xdd51('0x0'));var util=require(_0xdd51('0x1'));var logger=require('../../config/logger')(_0xdd51('0x2'));var moment=require(_0xdd51('0x3'));var BPromise=require(_0xdd51('0x4'));var rp=require(_0xdd51('0x5'));var fs=require('fs');var path=require(_0xdd51('0x6'));var rimraf=require(_0xdd51('0x7'));var config=require(_0xdd51('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xdd51('0x9')]=function(_0x433ccf,_0x2d8cb6){return _0x433ccf['define']('MailServerIn',attributes,{'tableName':_0xdd51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x369e=['bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','lodash','util','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x369e,0xf9));var _0xe369=function(_0x451913,_0x29e24a){_0x451913=_0x451913-0x0;var _0x45f885=_0x369e[_0x451913];return _0x45f885;};'use strict';var _=require(_0xe369('0x0'));var util=require(_0xe369('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe369('0x2'));var BPromise=require(_0xe369('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe369('0x4'));var config=require(_0xe369('0x5'));var attributes=require(_0xe369('0x6'));module[_0xe369('0x7')]=function(_0x49d6f2,_0x9fb4eb){return _0x49d6f2[_0xe369('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 1cca7f8..a293cf1 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 _0x47c0=['code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x27c650,_0x4b69ca){var _0x48875f=function(_0x21ed8a){while(--_0x21ed8a){_0x27c650['push'](_0x27c650['shift']());}};_0x48875f(++_0x4b69ca);}(_0x47c0,0x1dc));var _0x047c=function(_0x111902,_0x531308){_0x111902=_0x111902-0x0;var _0x24929a=_0x47c0[_0x111902];return _0x24929a;};'use strict';var _=require(_0x047c('0x0'));var util=require(_0x047c('0x1'));var moment=require(_0x047c('0x2'));var BPromise=require('bluebird');var rs=require(_0x047c('0x3'));var fs=require('fs');var Redis=require(_0x047c('0x4'));var db=require(_0x047c('0x5'))['db'];var utils=require(_0x047c('0x6'));var logger=require(_0x047c('0x7'))(_0x047c('0x8'));var config=require('../../config/environment');var jayson=require(_0x047c('0x9'));var client=jayson['client'][_0x047c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x168117,_0x4d8363,_0x2d9a91){return new BPromise(function(_0x2161bd,_0x4541b2){return client[_0x047c('0xb')](_0x168117,_0x2d9a91)[_0x047c('0xc')](function(_0x586e8d){logger[_0x047c('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4d8363,_0x047c('0xe'));logger[_0x047c('0xf')](_0x047c('0x10'),_0x4d8363,'request\x20sent',JSON[_0x047c('0x11')](_0x586e8d));if(_0x586e8d[_0x047c('0x12')]){if(_0x586e8d[_0x047c('0x12')][_0x047c('0x13')]===0x1f4){logger[_0x047c('0x12')](_0x047c('0x14'),_0x4d8363,_0x586e8d[_0x047c('0x12')][_0x047c('0x15')]);return _0x4541b2(_0x586e8d[_0x047c('0x12')][_0x047c('0x15')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4d8363,_0x586e8d['error'][_0x047c('0x15')]);return _0x2161bd(_0x586e8d[_0x047c('0x12')][_0x047c('0x15')]);}else{logger[_0x047c('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4d8363,'request\x20sent');_0x2161bd(_0x586e8d['result']['message']);}})[_0x047c('0x16')](function(_0x420796){logger[_0x047c('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4d8363,_0x420796);_0x4541b2(_0x420796);});});}exports[_0x047c('0x17')]=function(_0x3b129a){var _0x14eb6d=this;return new Promise(function(_0x4330b8,_0x46573b){return db[_0x047c('0x18')]['findAll']({'raw':_0x3b129a[_0x047c('0x19')]?_0x3b129a[_0x047c('0x19')][_0x047c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b129a[_0x047c('0x19')]?_0x3b129a[_0x047c('0x19')][_0x047c('0x1b')]||null:null,'attributes':_0x3b129a[_0x047c('0x19')]?_0x3b129a[_0x047c('0x19')][_0x047c('0x1c')]||null:null,'limit':_0x3b129a[_0x047c('0x19')]?_0x3b129a[_0x047c('0x19')][_0x047c('0x1d')]||null:null,'include':_0x3b129a['options']?_0x3b129a[_0x047c('0x19')][_0x047c('0x1e')]?_[_0x047c('0x1f')](_0x3b129a[_0x047c('0x19')][_0x047c('0x1e')],function(_0x4b94b3){return{'model':db[_0x4b94b3['model']],'as':_0x4b94b3['as'],'attributes':_0x4b94b3['attributes'],'include':_0x4b94b3[_0x047c('0x1e')]?_[_0x047c('0x1f')](_0x4b94b3[_0x047c('0x1e')],function(_0x36903f){return{'model':db[_0x36903f[_0x047c('0x20')]],'as':_0x36903f['as'],'attributes':_0x36903f[_0x047c('0x1c')],'include':_0x36903f[_0x047c('0x1e')]?_[_0x047c('0x1f')](_0x36903f[_0x047c('0x1e')],function(_0x1627cc){return{'model':db[_0x1627cc[_0x047c('0x20')]],'as':_0x1627cc['as'],'attributes':_0x1627cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x047c('0xc')](function(_0x11a0ea){logger[_0x047c('0xd')](_0x047c('0x17'),_0x3b129a);logger['debug'](_0x047c('0x17'),_0x3b129a,JSON[_0x047c('0x11')](_0x11a0ea));_0x4330b8(_0x11a0ea);})[_0x047c('0x16')](function(_0x127e8e){logger[_0x047c('0x12')](_0x047c('0x17'),_0x127e8e[_0x047c('0x15')],_0x3b129a);_0x46573b(_0x14eb6d[_0x047c('0x12')](0x1f4,_0x127e8e['message']));});});}; \ No newline at end of file +var _0x495c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x12b21,_0xf056b0){var _0x140f6a=function(_0x199065){while(--_0x199065){_0x12b21['push'](_0x12b21['shift']());}};_0x140f6a(++_0xf056b0);}(_0x495c,0xdb));var _0xc495=function(_0x133858,_0x24ea1b){_0x133858=_0x133858-0x0;var _0x447323=_0x495c[_0x133858];return _0x447323;};'use strict';var _=require('lodash');var util=require(_0xc495('0x0'));var moment=require(_0xc495('0x1'));var BPromise=require(_0xc495('0x2'));var rs=require(_0xc495('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc495('0x4'))['db'];var utils=require(_0xc495('0x5'));var logger=require(_0xc495('0x6'))(_0xc495('0x7'));var config=require('../../config/environment');var jayson=require(_0xc495('0x8'));var client=jayson[_0xc495('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77d109,_0x460f1a,_0x548bce){return new BPromise(function(_0x4e4f24,_0xb70ffa){return client['request'](_0x77d109,_0x548bce)[_0xc495('0xa')](function(_0x369b65){logger[_0xc495('0xb')](_0xc495('0xc'),_0x460f1a,'request\x20sent');logger[_0xc495('0xd')](_0xc495('0xe'),_0x460f1a,_0xc495('0xf'),JSON['stringify'](_0x369b65));if(_0x369b65['error']){if(_0x369b65['error']['code']===0x1f4){logger[_0xc495('0x10')]('MailServerIn,\x20%s,\x20%s',_0x460f1a,_0x369b65['error'][_0xc495('0x11')]);return _0xb70ffa(_0x369b65['error']['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x460f1a,_0x369b65[_0xc495('0x10')][_0xc495('0x11')]);return _0x4e4f24(_0x369b65['error'][_0xc495('0x11')]);}else{logger['info'](_0xc495('0xc'),_0x460f1a,_0xc495('0xf'));_0x4e4f24(_0x369b65[_0xc495('0x12')][_0xc495('0x11')]);}})[_0xc495('0x13')](function(_0x2fc927){logger[_0xc495('0x10')](_0xc495('0xc'),_0x460f1a,_0x2fc927);_0xb70ffa(_0x2fc927);});});}exports[_0xc495('0x14')]=function(_0x2a67ad){var _0x4b0fff=this;return new Promise(function(_0x4adb5d,_0x5a3675){return db[_0xc495('0x15')][_0xc495('0x16')]({'raw':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad[_0xc495('0x17')][_0xc495('0x18')]===undefined?!![]:![]:!![],'where':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad['options'][_0xc495('0x19')]||null:null,'attributes':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad['options'][_0xc495('0x1a')]||null:null,'limit':_0x2a67ad[_0xc495('0x17')]?_0x2a67ad[_0xc495('0x17')][_0xc495('0x1b')]||null:null,'include':_0x2a67ad['options']?_0x2a67ad[_0xc495('0x17')][_0xc495('0x1c')]?_[_0xc495('0x1d')](_0x2a67ad[_0xc495('0x17')][_0xc495('0x1c')],function(_0x3c287d){return{'model':db[_0x3c287d['model']],'as':_0x3c287d['as'],'attributes':_0x3c287d[_0xc495('0x1a')],'include':_0x3c287d['include']?_[_0xc495('0x1d')](_0x3c287d[_0xc495('0x1c')],function(_0x3da963){return{'model':db[_0x3da963[_0xc495('0x1e')]],'as':_0x3da963['as'],'attributes':_0x3da963[_0xc495('0x1a')],'include':_0x3da963['include']?_['map'](_0x3da963[_0xc495('0x1c')],function(_0x5782c4){return{'model':db[_0x5782c4['model']],'as':_0x5782c4['as'],'attributes':_0x5782c4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc495('0xa')](function(_0x2168c5){logger[_0xc495('0xb')]('GetMailServerIn',_0x2a67ad);logger[_0xc495('0xd')](_0xc495('0x14'),_0x2a67ad,JSON[_0xc495('0x1f')](_0x2168c5));_0x4adb5d(_0x2168c5);})[_0xc495('0x13')](function(_0x4da9c2){logger['error']('GetMailServerIn',_0x4da9c2['message'],_0x2a67ad);_0x5a3675(_0x4b0fff[_0xc495('0x10')](0x1f4,_0x4da9c2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0b15598..ce28d77 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(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _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(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 79f583d..953f973 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 _0xb9be=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x458edd,_0x926c10){var _0x4acd75=function(_0x36abc6){while(--_0x36abc6){_0x458edd['push'](_0x458edd['shift']());}};_0x4acd75(++_0x926c10);}(_0xb9be,0xc5));var _0xeb9b=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xb9be[_0x5cb97e];return _0x1714b4;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'description':{'type':Sequelize[_0xeb9b('0x2')]},'host':{'type':Sequelize[_0xeb9b('0x2')]},'user':{'type':Sequelize[_0xeb9b('0x2')]},'pass':{'type':Sequelize[_0xeb9b('0x2')]},'port':{'type':Sequelize[_0xeb9b('0x3')]},'secure':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb9b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4e81=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5a0e32,_0x347ae2){var _0xea8f24=function(_0x47f773){while(--_0x47f773){_0x5a0e32['push'](_0x5a0e32['shift']());}};_0xea8f24(++_0x347ae2);}(_0x4e81,0x1bc));var _0x14e8=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x4e81[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'description':{'type':Sequelize[_0x14e8('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14e8('0x3')]},'secure':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x14e8('0x2')]},'authentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x14e8('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 8c24ff7..8696e26 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 _0xaa39=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','destroy','then','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','length','include','options','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x135f3d,_0xf40bd9){var _0x1e190c=function(_0x4fbe0d){while(--_0x4fbe0d){_0x135f3d['push'](_0x135f3d['shift']());}};_0x1e190c(++_0xf40bd9);}(_0xaa39,0x7c));var _0x9aa3=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xaa39[_0x314a8c];return _0x1d4607;};'use strict';var emlformat=require(_0x9aa3('0x0'));var rimraf=require(_0x9aa3('0x1'));var zipdir=require(_0x9aa3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9aa3('0x3'));var BPromise=require(_0x9aa3('0x4'));var Mustache=require(_0x9aa3('0x5'));var util=require(_0x9aa3('0x6'));var path=require(_0x9aa3('0x7'));var sox=require(_0x9aa3('0x8'));var csv=require(_0x9aa3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9aa3('0xa'));var _=require('lodash');var squel=require(_0x9aa3('0xb'));var crypto=require(_0x9aa3('0xc'));var jsforce=require(_0x9aa3('0xd'));var deskjs=require(_0x9aa3('0xe'));var toCsv=require(_0x9aa3('0x9'));var querystring=require(_0x9aa3('0xf'));var Papa=require(_0x9aa3('0x10'));var Redis=require('ioredis');var authService=require(_0x9aa3('0x11'));var qs=require(_0x9aa3('0x12'));var as=require(_0x9aa3('0x13'));var hardwareService=require(_0x9aa3('0x14'));var logger=require(_0x9aa3('0x15'))(_0x9aa3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9aa3('0x17'));var db=require(_0x9aa3('0x18'))['db'];function respondWithStatusCode(_0xe377b7,_0x5af662){_0x5af662=_0x5af662||0xcc;return function(_0x345b25){if(_0x345b25){return _0xe377b7[_0x9aa3('0x19')](_0x5af662);}return _0xe377b7[_0x9aa3('0x1a')](_0x5af662)[_0x9aa3('0x1b')]();};}function respondWithResult(_0x363c18,_0x4497b5){_0x4497b5=_0x4497b5||0xc8;return function(_0x430d01){if(_0x430d01){return _0x363c18[_0x9aa3('0x1a')](_0x4497b5)[_0x9aa3('0x1c')](_0x430d01);}};}function respondWithFilteredResult(_0x13be42,_0x480b4a){return function(_0xc65aae){if(_0xc65aae){var _0x2adab3=typeof _0x480b4a['offset']===_0x9aa3('0x1d')&&typeof _0x480b4a[_0x9aa3('0x1e')]===_0x9aa3('0x1d');var _0x3b2444=_0xc65aae[_0x9aa3('0x1f')];var _0x3011b0=_0x2adab3?0x0:_0x480b4a[_0x9aa3('0x20')];var _0x3b3bb6=_0x2adab3?_0xc65aae[_0x9aa3('0x1f')]:_0x480b4a[_0x9aa3('0x20')]+_0x480b4a[_0x9aa3('0x1e')];var _0x307c2b;if(_0x3b3bb6>=_0x3b2444){_0x3b3bb6=_0x3b2444;_0x307c2b=0xc8;}else{_0x307c2b=0xce;}_0x13be42[_0x9aa3('0x1a')](_0x307c2b);return _0x13be42['set'](_0x9aa3('0x21'),_0x3011b0+'-'+_0x3b3bb6+'/'+_0x3b2444)[_0x9aa3('0x1c')](_0xc65aae);}return null;};}function patchUpdates(_0x474484){return function(_0x32247d){try{jsonpatch[_0x9aa3('0x22')](_0x32247d,_0x474484,!![]);}catch(_0x4254c7){return BPromise[_0x9aa3('0x23')](_0x4254c7);}return _0x32247d['save']();};}function saveUpdates(_0x3310bf,_0x1f515f){return function(_0x8976ae){if(_0x8976ae){return _0x8976ae['update'](_0x3310bf)['then'](function(_0x299f51){return _0x299f51;});}return null;};}function removeEntity(_0x45e9be,_0x49017c){return function(_0x3e3890){if(_0x3e3890){return _0x3e3890[_0x9aa3('0x24')]()[_0x9aa3('0x25')](function(){_0x45e9be[_0x9aa3('0x1a')](0xcc)[_0x9aa3('0x1b')]();});}};}function handleEntityNotFound(_0x1a5a77,_0x279628){return function(_0x2e67b5){if(!_0x2e67b5){_0x1a5a77['sendStatus'](0x194);}return _0x2e67b5;};}function handleError(_0xe47812,_0xbb61e6){_0xbb61e6=_0xbb61e6||0x1f4;return function(_0x3d9dc0){logger['error'](_0x3d9dc0[_0x9aa3('0x26')]);if(_0x3d9dc0[_0x9aa3('0x27')]){delete _0x3d9dc0[_0x9aa3('0x27')];}_0xe47812[_0x9aa3('0x1a')](_0xbb61e6)[_0x9aa3('0x28')](_0x3d9dc0);};}exports[_0x9aa3('0x29')]=function(_0x452c5f,_0x4db1a8){var _0x9a6528={},_0x1ec755={},_0x3d097d={'count':0x0,'rows':[]};var _0x1d6481=_['map'](db[_0x9aa3('0x2a')][_0x9aa3('0x2b')],function(_0x5bebd2){return{'name':_0x5bebd2[_0x9aa3('0x2c')],'type':_0x5bebd2[_0x9aa3('0x2d')][_0x9aa3('0x2e')]};});_0x1ec755[_0x9aa3('0x2f')]=_[_0x9aa3('0x30')](_0x1d6481,'name');_0x1ec755['query']=_[_0x9aa3('0x31')](_0x452c5f[_0x9aa3('0x32')]);_0x1ec755['filters']=_[_0x9aa3('0x33')](_0x1ec755['model'],_0x1ec755[_0x9aa3('0x32')]);_0x9a6528['attributes']=_['intersection'](_0x1ec755[_0x9aa3('0x2f')],qs[_0x9aa3('0x34')](_0x452c5f[_0x9aa3('0x32')][_0x9aa3('0x34')]));_0x9a6528[_0x9aa3('0x35')]=_0x9a6528[_0x9aa3('0x35')]['length']?_0x9a6528['attributes']:_0x1ec755[_0x9aa3('0x2f')];if(!_0x452c5f[_0x9aa3('0x32')]['hasOwnProperty'](_0x9aa3('0x36'))){_0x9a6528[_0x9aa3('0x1e')]=qs[_0x9aa3('0x1e')](_0x452c5f[_0x9aa3('0x32')][_0x9aa3('0x1e')]);_0x9a6528[_0x9aa3('0x20')]=qs[_0x9aa3('0x20')](_0x452c5f[_0x9aa3('0x32')][_0x9aa3('0x20')]);}_0x9a6528['order']=qs[_0x9aa3('0x37')](_0x452c5f[_0x9aa3('0x32')][_0x9aa3('0x37')]);_0x9a6528[_0x9aa3('0x38')]=qs['filters'](_[_0x9aa3('0x39')](_0x452c5f[_0x9aa3('0x32')],_0x1ec755[_0x9aa3('0x3a')]),_0x1d6481);if(_0x452c5f[_0x9aa3('0x32')]['filter']){_0x9a6528[_0x9aa3('0x38')]=_[_0x9aa3('0x3b')](_0x9a6528[_0x9aa3('0x38')],{'$or':_['map'](_0x1d6481,function(_0x57fc4a){if(_0x57fc4a[_0x9aa3('0x2d')]!==_0x9aa3('0x3c')){var _0x12ceec={};_0x12ceec[_0x57fc4a['name']]={'$like':'%'+_0x452c5f['query'][_0x9aa3('0x3d')]+'%'};return _0x12ceec;}})});}_0x9a6528=_['merge']({},_0x9a6528,_0x452c5f['options']);var _0x1e4f49={'where':_0x9a6528['where']};return db[_0x9aa3('0x2a')][_0x9aa3('0x1f')](_0x1e4f49)[_0x9aa3('0x25')](function(_0x5026c1){_0x3d097d[_0x9aa3('0x1f')]=_0x5026c1;if(_0x452c5f[_0x9aa3('0x32')][_0x9aa3('0x3e')]){_0x9a6528['include']=[{'all':!![]}];}return db[_0x9aa3('0x2a')][_0x9aa3('0x3f')](_0x9a6528);})[_0x9aa3('0x25')](function(_0x5b8880){_0x3d097d['rows']=_0x5b8880;return _0x3d097d;})[_0x9aa3('0x25')](respondWithFilteredResult(_0x4db1a8,_0x9a6528))[_0x9aa3('0x40')](handleError(_0x4db1a8,null));};exports[_0x9aa3('0x41')]=function(_0x132347,_0x56c628){var _0x3ea379={'raw':!![],'where':{'id':_0x132347[_0x9aa3('0x42')]['id']}},_0xab9edf={};_0xab9edf['model']=_['keys'](db[_0x9aa3('0x2a')][_0x9aa3('0x2b')]);_0xab9edf['query']=_[_0x9aa3('0x31')](_0x132347[_0x9aa3('0x32')]);_0xab9edf['filters']=_['intersection'](_0xab9edf[_0x9aa3('0x2f')],_0xab9edf['query']);_0x3ea379[_0x9aa3('0x35')]=_['intersection'](_0xab9edf[_0x9aa3('0x2f')],qs[_0x9aa3('0x34')](_0x132347[_0x9aa3('0x32')][_0x9aa3('0x34')]));_0x3ea379[_0x9aa3('0x35')]=_0x3ea379[_0x9aa3('0x35')][_0x9aa3('0x43')]?_0x3ea379[_0x9aa3('0x35')]:_0xab9edf['model'];if(_0x132347[_0x9aa3('0x32')][_0x9aa3('0x3e')]){_0x3ea379[_0x9aa3('0x44')]=[{'all':!![]}];}_0x3ea379=_['merge']({},_0x3ea379,_0x132347[_0x9aa3('0x45')]);return db['MailServerOut'][_0x9aa3('0x46')](_0x3ea379)['then'](handleEntityNotFound(_0x56c628,null))['then'](respondWithResult(_0x56c628,null))[_0x9aa3('0x40')](handleError(_0x56c628,null));};exports[_0x9aa3('0x47')]=function(_0x14d42e,_0x369a2f){return db[_0x9aa3('0x2a')][_0x9aa3('0x47')](_0x14d42e[_0x9aa3('0x48')],{})[_0x9aa3('0x25')](respondWithResult(_0x369a2f,0xc9))[_0x9aa3('0x40')](handleError(_0x369a2f,null));};exports[_0x9aa3('0x49')]=function(_0x25ce8f,_0xaa8de5){if(_0x25ce8f[_0x9aa3('0x48')]['id']){delete _0x25ce8f[_0x9aa3('0x48')]['id'];}return db[_0x9aa3('0x2a')]['find']({'where':{'id':_0x25ce8f[_0x9aa3('0x42')]['id']}})['then'](handleEntityNotFound(_0xaa8de5,null))['then'](saveUpdates(_0x25ce8f[_0x9aa3('0x48')],null))[_0x9aa3('0x25')](respondWithResult(_0xaa8de5,null))['catch'](handleError(_0xaa8de5,null));};exports[_0x9aa3('0x24')]=function(_0x1afa72,_0x26c12e){return db[_0x9aa3('0x2a')]['find']({'where':{'id':_0x1afa72[_0x9aa3('0x42')]['id']}})['then'](handleEntityNotFound(_0x26c12e,null))['then'](removeEntity(_0x26c12e,null))[_0x9aa3('0x40')](handleError(_0x26c12e,null));}; \ No newline at end of file +var _0x0c2c=['bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','undefined','limit','count','status','json','apply','reject','save','then','destroy','end','error','name','send','index','map','MailServerOut','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','create','body','update','find','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x0c2c,0x120));var _0xc0c2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0c2c[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0c2('0x0'));var jsonpatch=require(_0xc0c2('0x1'));var rp=require(_0xc0c2('0x2'));var moment=require(_0xc0c2('0x3'));var BPromise=require(_0xc0c2('0x4'));var Mustache=require(_0xc0c2('0x5'));var util=require('util');var path=require(_0xc0c2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0c2('0x7'));var fs=require('fs');var fs_extra=require(_0xc0c2('0x8'));var _=require('lodash');var squel=require(_0xc0c2('0x9'));var crypto=require(_0xc0c2('0xa'));var jsforce=require(_0xc0c2('0xb'));var deskjs=require(_0xc0c2('0xc'));var toCsv=require(_0xc0c2('0xd'));var querystring=require(_0xc0c2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0c2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc0c2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c2('0x11'))(_0xc0c2('0x12'));var utils=require(_0xc0c2('0x13'));var config=require(_0xc0c2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0c2('0x15'))['db'];function respondWithStatusCode(_0x54463e,_0x5277d8){_0x5277d8=_0x5277d8||0xcc;return function(_0x52e0f2){if(_0x52e0f2){return _0x54463e[_0xc0c2('0x16')](_0x5277d8);}return _0x54463e['status'](_0x5277d8)['end']();};}function respondWithResult(_0x4df33f,_0x58e8af){_0x58e8af=_0x58e8af||0xc8;return function(_0x734b58){if(_0x734b58){return _0x4df33f['status'](_0x58e8af)['json'](_0x734b58);}};}function respondWithFilteredResult(_0x557a1d,_0x5785e5){return function(_0x331578){if(_0x331578){var _0x1b9ea1=typeof _0x5785e5[_0xc0c2('0x17')]===_0xc0c2('0x18')&&typeof _0x5785e5[_0xc0c2('0x19')]===_0xc0c2('0x18');var _0x22dcae=_0x331578['count'];var _0x9fda6e=_0x1b9ea1?0x0:_0x5785e5['offset'];var _0x448088=_0x1b9ea1?_0x331578[_0xc0c2('0x1a')]:_0x5785e5[_0xc0c2('0x17')]+_0x5785e5[_0xc0c2('0x19')];var _0x4c75c2;if(_0x448088>=_0x22dcae){_0x448088=_0x22dcae;_0x4c75c2=0xc8;}else{_0x4c75c2=0xce;}_0x557a1d[_0xc0c2('0x1b')](_0x4c75c2);return _0x557a1d['set']('Content-Range',_0x9fda6e+'-'+_0x448088+'/'+_0x22dcae)[_0xc0c2('0x1c')](_0x331578);}return null;};}function patchUpdates(_0x371b8d){return function(_0xd6390){try{jsonpatch[_0xc0c2('0x1d')](_0xd6390,_0x371b8d,!![]);}catch(_0x12ed79){return BPromise[_0xc0c2('0x1e')](_0x12ed79);}return _0xd6390[_0xc0c2('0x1f')]();};}function saveUpdates(_0x2699a9,_0x55118d){return function(_0x19f27f){if(_0x19f27f){return _0x19f27f['update'](_0x2699a9)[_0xc0c2('0x20')](function(_0x532e49){return _0x532e49;});}return null;};}function removeEntity(_0x370f28,_0x43a3c8){return function(_0x2b4cf7){if(_0x2b4cf7){return _0x2b4cf7[_0xc0c2('0x21')]()[_0xc0c2('0x20')](function(){_0x370f28[_0xc0c2('0x1b')](0xcc)[_0xc0c2('0x22')]();});}};}function handleEntityNotFound(_0x145e13,_0x4a860b){return function(_0x59e2c9){if(!_0x59e2c9){_0x145e13['sendStatus'](0x194);}return _0x59e2c9;};}function handleError(_0x106342,_0x5132e1){_0x5132e1=_0x5132e1||0x1f4;return function(_0xf0a8bf){logger[_0xc0c2('0x23')](_0xf0a8bf['stack']);if(_0xf0a8bf['name']){delete _0xf0a8bf[_0xc0c2('0x24')];}_0x106342['status'](_0x5132e1)[_0xc0c2('0x25')](_0xf0a8bf);};}exports[_0xc0c2('0x26')]=function(_0x5a334e,_0x52185a){var _0x4b4cfd={},_0x247ae9={},_0x3c4769={'count':0x0,'rows':[]};var _0x1d0807=_[_0xc0c2('0x27')](db[_0xc0c2('0x28')]['rawAttributes'],function(_0x2040e5){return{'name':_0x2040e5[_0xc0c2('0x29')],'type':_0x2040e5['type'][_0xc0c2('0x2a')]};});_0x247ae9['model']=_['map'](_0x1d0807,'name');_0x247ae9[_0xc0c2('0x2b')]=_['keys'](_0x5a334e[_0xc0c2('0x2b')]);_0x247ae9['filters']=_['intersection'](_0x247ae9[_0xc0c2('0x2c')],_0x247ae9[_0xc0c2('0x2b')]);_0x4b4cfd[_0xc0c2('0x2d')]=_[_0xc0c2('0x2e')](_0x247ae9['model'],qs['fields'](_0x5a334e['query'][_0xc0c2('0x2f')]));_0x4b4cfd['attributes']=_0x4b4cfd[_0xc0c2('0x2d')][_0xc0c2('0x30')]?_0x4b4cfd[_0xc0c2('0x2d')]:_0x247ae9[_0xc0c2('0x2c')];if(!_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x31')](_0xc0c2('0x32'))){_0x4b4cfd['limit']=qs[_0xc0c2('0x19')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x19')]);_0x4b4cfd[_0xc0c2('0x17')]=qs[_0xc0c2('0x17')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x17')]);}_0x4b4cfd[_0xc0c2('0x33')]=qs[_0xc0c2('0x34')](_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x34')]);_0x4b4cfd[_0xc0c2('0x35')]=qs[_0xc0c2('0x36')](_['pick'](_0x5a334e[_0xc0c2('0x2b')],_0x247ae9[_0xc0c2('0x36')]),_0x1d0807);if(_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x37')]){_0x4b4cfd[_0xc0c2('0x35')]=_[_0xc0c2('0x38')](_0x4b4cfd[_0xc0c2('0x35')],{'$or':_[_0xc0c2('0x27')](_0x1d0807,function(_0x308860){if(_0x308860[_0xc0c2('0x39')]!==_0xc0c2('0x3a')){var _0x43e07a={};_0x43e07a[_0x308860[_0xc0c2('0x24')]]={'$like':'%'+_0x5a334e['query'][_0xc0c2('0x37')]+'%'};return _0x43e07a;}})});}_0x4b4cfd=_['merge']({},_0x4b4cfd,_0x5a334e['options']);var _0x31a2db={'where':_0x4b4cfd['where']};return db['MailServerOut'][_0xc0c2('0x1a')](_0x31a2db)['then'](function(_0x5a43cc){_0x3c4769[_0xc0c2('0x1a')]=_0x5a43cc;if(_0x5a334e[_0xc0c2('0x2b')][_0xc0c2('0x3b')]){_0x4b4cfd[_0xc0c2('0x3c')]=[{'all':!![]}];}return db[_0xc0c2('0x28')][_0xc0c2('0x3d')](_0x4b4cfd);})[_0xc0c2('0x20')](function(_0x2d0ac4){_0x3c4769[_0xc0c2('0x3e')]=_0x2d0ac4;return _0x3c4769;})[_0xc0c2('0x20')](respondWithFilteredResult(_0x52185a,_0x4b4cfd))[_0xc0c2('0x3f')](handleError(_0x52185a,null));};exports[_0xc0c2('0x40')]=function(_0x4dbdd7,_0x49ede4){var _0x535525={'raw':!![],'where':{'id':_0x4dbdd7[_0xc0c2('0x41')]['id']}},_0x263e4d={};_0x263e4d[_0xc0c2('0x2c')]=_['keys'](db['MailServerOut'][_0xc0c2('0x42')]);_0x263e4d[_0xc0c2('0x2b')]=_[_0xc0c2('0x43')](_0x4dbdd7[_0xc0c2('0x2b')]);_0x263e4d[_0xc0c2('0x36')]=_['intersection'](_0x263e4d[_0xc0c2('0x2c')],_0x263e4d[_0xc0c2('0x2b')]);_0x535525[_0xc0c2('0x2d')]=_[_0xc0c2('0x2e')](_0x263e4d[_0xc0c2('0x2c')],qs['fields'](_0x4dbdd7[_0xc0c2('0x2b')][_0xc0c2('0x2f')]));_0x535525[_0xc0c2('0x2d')]=_0x535525['attributes'][_0xc0c2('0x30')]?_0x535525[_0xc0c2('0x2d')]:_0x263e4d['model'];if(_0x4dbdd7[_0xc0c2('0x2b')][_0xc0c2('0x3b')]){_0x535525['include']=[{'all':!![]}];}_0x535525=_[_0xc0c2('0x38')]({},_0x535525,_0x4dbdd7[_0xc0c2('0x44')]);return db[_0xc0c2('0x28')]['find'](_0x535525)[_0xc0c2('0x20')](handleEntityNotFound(_0x49ede4,null))[_0xc0c2('0x20')](respondWithResult(_0x49ede4,null))[_0xc0c2('0x3f')](handleError(_0x49ede4,null));};exports[_0xc0c2('0x45')]=function(_0x221ab2,_0x9d4e15){return db['MailServerOut'][_0xc0c2('0x45')](_0x221ab2[_0xc0c2('0x46')],{})[_0xc0c2('0x20')](respondWithResult(_0x9d4e15,0xc9))[_0xc0c2('0x3f')](handleError(_0x9d4e15,null));};exports[_0xc0c2('0x47')]=function(_0x4f76c0,_0x157502){if(_0x4f76c0[_0xc0c2('0x46')]['id']){delete _0x4f76c0[_0xc0c2('0x46')]['id'];}return db[_0xc0c2('0x28')][_0xc0c2('0x48')]({'where':{'id':_0x4f76c0[_0xc0c2('0x41')]['id']}})[_0xc0c2('0x20')](handleEntityNotFound(_0x157502,null))[_0xc0c2('0x20')](saveUpdates(_0x4f76c0[_0xc0c2('0x46')],null))[_0xc0c2('0x20')](respondWithResult(_0x157502,null))[_0xc0c2('0x3f')](handleError(_0x157502,null));};exports[_0xc0c2('0x21')]=function(_0x20d242,_0x32337a){return db[_0xc0c2('0x28')][_0xc0c2('0x48')]({'where':{'id':_0x20d242[_0xc0c2('0x41')]['id']}})[_0xc0c2('0x20')](handleEntityNotFound(_0x32337a,null))[_0xc0c2('0x20')](removeEntity(_0x32337a,null))['catch'](handleError(_0x32337a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f44d628..fd8f245 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 _0x3f97=['./mailServerOut.attributes','exports','define','mail_servers_out','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3f97,0x1b1));var _0x73f9=function(_0x1c4b22,_0x3da6e4){_0x1c4b22=_0x1c4b22-0x0;var _0x4345d6=_0x3f97[_0x1c4b22];return _0x4345d6;};'use strict';var _=require('lodash');var util=require(_0x73f9('0x0'));var logger=require(_0x73f9('0x1'))(_0x73f9('0x2'));var moment=require(_0x73f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x73f9('0x4'));var fs=require('fs');var path=require(_0x73f9('0x5'));var rimraf=require('rimraf');var config=require(_0x73f9('0x6'));var attributes=require(_0x73f9('0x7'));module[_0x73f9('0x8')]=function(_0x536f58,_0x5c148b){return _0x536f58[_0x73f9('0x9')]('MailServerOut',attributes,{'tableName':_0x73f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9df9=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9df9,0x126));var _0x99df=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9df9[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require(_0x99df('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x99df('0x1'));var BPromise=require(_0x99df('0x2'));var rp=require(_0x99df('0x3'));var fs=require('fs');var path=require(_0x99df('0x4'));var rimraf=require(_0x99df('0x5'));var config=require(_0x99df('0x6'));var attributes=require(_0x99df('0x7'));module[_0x99df('0x8')]=function(_0x58497f,_0x4b5b25){return _0x58497f[_0x99df('0x9')](_0x99df('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index b018b24..815f4e7 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(_0x55b1f2,_0x2d2a5f){var _0x4d945b=function(_0x2f5097){while(--_0x2f5097){_0x55b1f2['push'](_0x55b1f2['shift']());}};_0x4d945b(++_0x2d2a5f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3dfb61,_0xe69372){var _0x4df0c1=function(_0xc8cafa){while(--_0xc8cafa){_0x3dfb61['push'](_0x3dfb61['shift']());}};_0x4df0c1(++_0xe69372);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dd4a085..b54ecca 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 _0x73ad=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x548bbb,_0x1fcc35){var _0x25bb26=function(_0xa730de){while(--_0xa730de){_0x548bbb['push'](_0x548bbb['shift']());}};_0x25bb26(++_0x1fcc35);}(_0x73ad,0x75));var _0xd73a=function(_0x1b6e23,_0x3b3563){_0x1b6e23=_0x1b6e23-0x0;var _0x36205b=_0x73ad[_0x1b6e23];return _0x36205b;};'use strict';var multer=require(_0xd73a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd73a('0x1'));var express=require(_0xd73a('0x2'));var router=express[_0xd73a('0x3')]();var fs_extra=require(_0xd73a('0x4'));var auth=require(_0xd73a('0x5'));var interaction=require(_0xd73a('0x6'));var config=require(_0xd73a('0x7'));var controller=require(_0xd73a('0x8'));router[_0xd73a('0x9')]('/',auth[_0xd73a('0xa')](),controller[_0xd73a('0xb')]);router[_0xd73a('0x9')](_0xd73a('0xc'),auth[_0xd73a('0xa')](),controller[_0xd73a('0xd')]);router[_0xd73a('0x9')]('/:id',auth[_0xd73a('0xa')](),controller[_0xd73a('0xe')]);router[_0xd73a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd73a('0x10')]);router[_0xd73a('0x11')](_0xd73a('0x12'),auth[_0xd73a('0xa')](),controller['update']);router['delete'](_0xd73a('0x12'),auth['isAuthenticated'](),controller[_0xd73a('0x13')]);module[_0xd73a('0x14')]=router; \ No newline at end of file +var _0x2c85=['index','/describe','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','./mailSubstatus.controller','get'];(function(_0x41becf,_0x4cf7bb){var _0x2d8930=function(_0x55bbb7){while(--_0x55bbb7){_0x41becf['push'](_0x41becf['shift']());}};_0x2d8930(++_0x4cf7bb);}(_0x2c85,0x9a));var _0x52c8=function(_0x1e9227,_0x5bccbc){_0x1e9227=_0x1e9227-0x0;var _0x2e8134=_0x2c85[_0x1e9227];return _0x2e8134;};'use strict';var multer=require(_0x52c8('0x0'));var util=require(_0x52c8('0x1'));var path=require(_0x52c8('0x2'));var timeout=require('connect-timeout');var express=require(_0x52c8('0x3'));var router=express[_0x52c8('0x4')]();var fs_extra=require(_0x52c8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x52c8('0x6'));router[_0x52c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x52c8('0x8')]);router['get'](_0x52c8('0x9'),auth[_0x52c8('0xa')](),controller['describe']);router[_0x52c8('0x7')](_0x52c8('0xb'),auth['isAuthenticated'](),controller[_0x52c8('0xc')]);router[_0x52c8('0xd')]('/',auth['isAuthenticated'](),controller[_0x52c8('0xe')]);router[_0x52c8('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x52c8('0x10')]);module[_0x52c8('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f0176ea..5cda946 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 _0x84e7=['exports','STRING'];(function(_0xa909a,_0x21ec96){var _0x23024a=function(_0x216212){while(--_0x216212){_0xa909a['push'](_0xa909a['shift']());}};_0x23024a(++_0x21ec96);}(_0x84e7,0x122));var _0x784e=function(_0x26f980,_0x2a0498){_0x26f980=_0x26f980-0x0;var _0x27f3b1=_0x84e7[_0x26f980];return _0x27f3b1;};'use strict';var Sequelize=require('sequelize');module[_0x784e('0x0')]={'name':{'type':Sequelize[_0x784e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x784e('0x1')]}}; \ No newline at end of file +var _0x6c7b=['STRING','sequelize'];(function(_0x2b309a,_0x534b86){var _0x37b40d=function(_0xf2ffc3){while(--_0xf2ffc3){_0x2b309a['push'](_0x2b309a['shift']());}};_0x37b40d(++_0x534b86);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x53c82a,_0x31afdc){_0x53c82a=_0x53c82a-0x0;var _0x3b6e85=_0x6c7b[_0x53c82a];return _0x3b6e85;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d14e06b..d2062a9 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 _0xd0fa=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','catch','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','MailSubstatus','rawAttributes','type','key','model','map','name','query'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd0fa,0x13f));var _0xad0f=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xd0fa[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require(_0xad0f('0x0'));var rimraf=require(_0xad0f('0x1'));var zipdir=require(_0xad0f('0x2'));var jsonpatch=require(_0xad0f('0x3'));var rp=require(_0xad0f('0x4'));var moment=require(_0xad0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad0f('0x6'));var util=require(_0xad0f('0x7'));var path=require(_0xad0f('0x8'));var sox=require(_0xad0f('0x9'));var csv=require(_0xad0f('0xa'));var ejs=require(_0xad0f('0xb'));var fs=require('fs');var fs_extra=require(_0xad0f('0xc'));var _=require(_0xad0f('0xd'));var squel=require(_0xad0f('0xe'));var crypto=require(_0xad0f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xad0f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xad0f('0x11'));var Papa=require(_0xad0f('0x12'));var Redis=require(_0xad0f('0x13'));var authService=require(_0xad0f('0x14'));var qs=require(_0xad0f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad0f('0x16'));var logger=require('../../config/logger')(_0xad0f('0x17'));var utils=require(_0xad0f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad0f('0x19'))['db'];function respondWithStatusCode(_0x30073f,_0x45822b){_0x45822b=_0x45822b||0xcc;return function(_0x528d06){if(_0x528d06){return _0x30073f['sendStatus'](_0x45822b);}return _0x30073f[_0xad0f('0x1a')](_0x45822b)['end']();};}function respondWithResult(_0x11757f,_0x319b34){_0x319b34=_0x319b34||0xc8;return function(_0x5eea7f){if(_0x5eea7f){return _0x11757f[_0xad0f('0x1a')](_0x319b34)[_0xad0f('0x1b')](_0x5eea7f);}};}function respondWithFilteredResult(_0x28634f,_0x55c520){return function(_0xadabb2){if(_0xadabb2){var _0x254dcb=typeof _0x55c520[_0xad0f('0x1c')]===_0xad0f('0x1d')&&typeof _0x55c520[_0xad0f('0x1e')]===_0xad0f('0x1d');var _0xb2a850=_0xadabb2[_0xad0f('0x1f')];var _0x3377a=_0x254dcb?0x0:_0x55c520[_0xad0f('0x1c')];var _0x3dd16a=_0x254dcb?_0xadabb2[_0xad0f('0x1f')]:_0x55c520[_0xad0f('0x1c')]+_0x55c520[_0xad0f('0x1e')];var _0x18f505;if(_0x3dd16a>=_0xb2a850){_0x3dd16a=_0xb2a850;_0x18f505=0xc8;}else{_0x18f505=0xce;}_0x28634f['status'](_0x18f505);return _0x28634f[_0xad0f('0x20')](_0xad0f('0x21'),_0x3377a+'-'+_0x3dd16a+'/'+_0xb2a850)['json'](_0xadabb2);}return null;};}function patchUpdates(_0xed1cd4){return function(_0x219ca4){try{jsonpatch['apply'](_0x219ca4,_0xed1cd4,!![]);}catch(_0x27e5bb){return BPromise[_0xad0f('0x22')](_0x27e5bb);}return _0x219ca4[_0xad0f('0x23')]();};}function saveUpdates(_0x3a261f,_0x1c6c61){return function(_0x1218d5){if(_0x1218d5){return _0x1218d5[_0xad0f('0x24')](_0x3a261f)[_0xad0f('0x25')](function(_0x467cb8){return _0x467cb8;});}return null;};}function removeEntity(_0x4afcec,_0xd3ab93){return function(_0x8746f6){if(_0x8746f6){return _0x8746f6[_0xad0f('0x26')]()['then'](function(){_0x4afcec[_0xad0f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x490713,_0x288670){return function(_0x437df9){if(!_0x437df9){_0x490713[_0xad0f('0x27')](0x194);}return _0x437df9;};}function handleError(_0x5318ea,_0x48ca38){_0x48ca38=_0x48ca38||0x1f4;return function(_0x386a78){logger[_0xad0f('0x28')](_0x386a78[_0xad0f('0x29')]);if(_0x386a78['name']){delete _0x386a78['name'];}_0x5318ea[_0xad0f('0x1a')](_0x48ca38)[_0xad0f('0x2a')](_0x386a78);};}exports['index']=function(_0x28bee5,_0x321e8a){var _0x47ebde={},_0x2af163={},_0x5205ec={'count':0x0,'rows':[]};var _0x8ae35=_['map'](db[_0xad0f('0x2b')][_0xad0f('0x2c')],function(_0x3f9bfb){return{'name':_0x3f9bfb['fieldName'],'type':_0x3f9bfb[_0xad0f('0x2d')][_0xad0f('0x2e')]};});_0x2af163[_0xad0f('0x2f')]=_[_0xad0f('0x30')](_0x8ae35,_0xad0f('0x31'));_0x2af163[_0xad0f('0x32')]=_[_0xad0f('0x33')](_0x28bee5['query']);_0x2af163[_0xad0f('0x34')]=_[_0xad0f('0x35')](_0x2af163[_0xad0f('0x2f')],_0x2af163['query']);_0x47ebde['attributes']=_['intersection'](_0x2af163[_0xad0f('0x2f')],qs[_0xad0f('0x36')](_0x28bee5['query'][_0xad0f('0x36')]));_0x47ebde[_0xad0f('0x37')]=_0x47ebde[_0xad0f('0x37')][_0xad0f('0x38')]?_0x47ebde['attributes']:_0x2af163[_0xad0f('0x2f')];if(!_0x28bee5[_0xad0f('0x32')][_0xad0f('0x39')](_0xad0f('0x3a'))){_0x47ebde[_0xad0f('0x1e')]=qs['limit'](_0x28bee5[_0xad0f('0x32')][_0xad0f('0x1e')]);_0x47ebde[_0xad0f('0x1c')]=qs[_0xad0f('0x1c')](_0x28bee5[_0xad0f('0x32')][_0xad0f('0x1c')]);}_0x47ebde['order']=qs[_0xad0f('0x3b')](_0x28bee5[_0xad0f('0x32')]['sort']);_0x47ebde[_0xad0f('0x3c')]=qs[_0xad0f('0x34')](_[_0xad0f('0x3d')](_0x28bee5['query'],_0x2af163[_0xad0f('0x34')]),_0x8ae35);if(_0x28bee5[_0xad0f('0x32')][_0xad0f('0x3e')]){_0x47ebde[_0xad0f('0x3c')]=_[_0xad0f('0x3f')](_0x47ebde[_0xad0f('0x3c')],{'$or':_[_0xad0f('0x30')](_0x8ae35,function(_0x350fc9){if(_0x350fc9['type']!=='VIRTUAL'){var _0x2b0628={};_0x2b0628[_0x350fc9[_0xad0f('0x31')]]={'$like':'%'+_0x28bee5[_0xad0f('0x32')][_0xad0f('0x3e')]+'%'};return _0x2b0628;}})});}_0x47ebde=_[_0xad0f('0x3f')]({},_0x47ebde,_0x28bee5['options']);var _0x30ba9b={'where':_0x47ebde['where']};return db[_0xad0f('0x2b')][_0xad0f('0x1f')](_0x30ba9b)[_0xad0f('0x25')](function(_0x54179f){_0x5205ec[_0xad0f('0x1f')]=_0x54179f;if(_0x28bee5[_0xad0f('0x32')][_0xad0f('0x40')]){_0x47ebde['include']=[{'all':!![]}];}return db[_0xad0f('0x2b')][_0xad0f('0x41')](_0x47ebde);})[_0xad0f('0x25')](function(_0x31f184){_0x5205ec['rows']=_0x31f184;return _0x5205ec;})['then'](respondWithFilteredResult(_0x321e8a,_0x47ebde))[_0xad0f('0x42')](handleError(_0x321e8a,null));};exports['show']=function(_0x2484dd,_0x47b7e5){var _0x459dd4={'raw':!![],'where':{'id':_0x2484dd['params']['id']}},_0x454b11={};_0x454b11['model']=_['keys'](db[_0xad0f('0x2b')][_0xad0f('0x2c')]);_0x454b11[_0xad0f('0x32')]=_[_0xad0f('0x33')](_0x2484dd[_0xad0f('0x32')]);_0x454b11['filters']=_[_0xad0f('0x35')](_0x454b11[_0xad0f('0x2f')],_0x454b11['query']);_0x459dd4[_0xad0f('0x37')]=_[_0xad0f('0x35')](_0x454b11[_0xad0f('0x2f')],qs[_0xad0f('0x36')](_0x2484dd[_0xad0f('0x32')]['fields']));_0x459dd4[_0xad0f('0x37')]=_0x459dd4[_0xad0f('0x37')]['length']?_0x459dd4['attributes']:_0x454b11['model'];if(_0x2484dd['query'][_0xad0f('0x40')]){_0x459dd4[_0xad0f('0x43')]=[{'all':!![]}];}_0x459dd4=_[_0xad0f('0x3f')]({},_0x459dd4,_0x2484dd[_0xad0f('0x44')]);return db[_0xad0f('0x2b')]['find'](_0x459dd4)[_0xad0f('0x25')](handleEntityNotFound(_0x47b7e5,null))[_0xad0f('0x25')](respondWithResult(_0x47b7e5,null))[_0xad0f('0x42')](handleError(_0x47b7e5,null));};exports['create']=function(_0x351425,_0x542094){return db[_0xad0f('0x2b')][_0xad0f('0x45')](_0x351425[_0xad0f('0x46')],{})[_0xad0f('0x25')](respondWithResult(_0x542094,0xc9))[_0xad0f('0x42')](handleError(_0x542094,null));};exports[_0xad0f('0x24')]=function(_0x2995f5,_0x9ca48b){if(_0x2995f5[_0xad0f('0x46')]['id']){delete _0x2995f5[_0xad0f('0x46')]['id'];}return db['MailSubstatus'][_0xad0f('0x47')]({'where':{'id':_0x2995f5[_0xad0f('0x48')]['id']}})[_0xad0f('0x25')](handleEntityNotFound(_0x9ca48b,null))[_0xad0f('0x25')](saveUpdates(_0x2995f5['body'],null))[_0xad0f('0x25')](respondWithResult(_0x9ca48b,null))['catch'](handleError(_0x9ca48b,null));};exports[_0xad0f('0x26')]=function(_0x29d6e1,_0x5d4c45){return db[_0xad0f('0x2b')][_0xad0f('0x47')]({'where':{'id':_0x29d6e1[_0xad0f('0x48')]['id']}})[_0xad0f('0x25')](handleEntityNotFound(_0x5d4c45,null))[_0xad0f('0x25')](removeEntity(_0x5d4c45,null))['catch'](handleError(_0x5d4c45,null));};exports[_0xad0f('0x49')]=function(_0x2eb3a1,_0x40af54){return db['MailSubstatus'][_0xad0f('0x49')]()[_0xad0f('0x25')](respondWithResult(_0x40af54,null))['catch'](handleError(_0x40af54,null));}; \ No newline at end of file +var _0x3a6d=['offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','create','body','catch','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','count'];(function(_0x335c01,_0x487dbd){var _0x4df624=function(_0x5b7092){while(--_0x5b7092){_0x335c01['push'](_0x335c01['shift']());}};_0x4df624(++_0x487dbd);}(_0x3a6d,0x1ea));var _0xd3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3a6('0x0'));var jsonpatch=require(_0xd3a6('0x1'));var rp=require(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var Mustache=require(_0xd3a6('0x5'));var util=require(_0xd3a6('0x6'));var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require('to-csv');var ejs=require(_0xd3a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd3a6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd3a6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3a6('0xc'));var Papa=require(_0xd3a6('0xd'));var Redis=require(_0xd3a6('0xe'));var authService=require(_0xd3a6('0xf'));var qs=require(_0xd3a6('0x10'));var as=require(_0xd3a6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3a6('0x12'))(_0xd3a6('0x13'));var utils=require(_0xd3a6('0x14'));var config=require(_0xd3a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccfd1,_0x372438){_0x372438=_0x372438||0xcc;return function(_0x2b7d0a){if(_0x2b7d0a){return _0x2ccfd1['sendStatus'](_0x372438);}return _0x2ccfd1[_0xd3a6('0x16')](_0x372438)[_0xd3a6('0x17')]();};}function respondWithResult(_0x5081c6,_0x17c534){_0x17c534=_0x17c534||0xc8;return function(_0x5c86d3){if(_0x5c86d3){return _0x5081c6['status'](_0x17c534)[_0xd3a6('0x18')](_0x5c86d3);}};}function respondWithFilteredResult(_0x386ad7,_0x7a51f){return function(_0x5c2410){if(_0x5c2410){var _0x44468b=typeof _0x7a51f['offset']===_0xd3a6('0x19')&&typeof _0x7a51f[_0xd3a6('0x1a')]===_0xd3a6('0x19');var _0x516fbd=_0x5c2410[_0xd3a6('0x1b')];var _0x149f96=_0x44468b?0x0:_0x7a51f[_0xd3a6('0x1c')];var _0x4fb5d5=_0x44468b?_0x5c2410['count']:_0x7a51f[_0xd3a6('0x1c')]+_0x7a51f[_0xd3a6('0x1a')];var _0x27e453;if(_0x4fb5d5>=_0x516fbd){_0x4fb5d5=_0x516fbd;_0x27e453=0xc8;}else{_0x27e453=0xce;}_0x386ad7[_0xd3a6('0x16')](_0x27e453);return _0x386ad7[_0xd3a6('0x1d')](_0xd3a6('0x1e'),_0x149f96+'-'+_0x4fb5d5+'/'+_0x516fbd)[_0xd3a6('0x18')](_0x5c2410);}return null;};}function patchUpdates(_0x38beed){return function(_0x17a8a2){try{jsonpatch[_0xd3a6('0x1f')](_0x17a8a2,_0x38beed,!![]);}catch(_0x248096){return BPromise[_0xd3a6('0x20')](_0x248096);}return _0x17a8a2['save']();};}function saveUpdates(_0x5799ff,_0x2839ca){return function(_0x8ddea6){if(_0x8ddea6){return _0x8ddea6[_0xd3a6('0x21')](_0x5799ff)[_0xd3a6('0x22')](function(_0x5383a2){return _0x5383a2;});}return null;};}function removeEntity(_0x2b3cd8,_0x1d538f){return function(_0x5c7fe2){if(_0x5c7fe2){return _0x5c7fe2['destroy']()[_0xd3a6('0x22')](function(){_0x2b3cd8[_0xd3a6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9db3,_0xd64c06){return function(_0x25847a){if(!_0x25847a){_0x1d9db3[_0xd3a6('0x23')](0x194);}return _0x25847a;};}function handleError(_0x56e01d,_0x1c5d41){_0x1c5d41=_0x1c5d41||0x1f4;return function(_0x3be3e6){logger[_0xd3a6('0x24')](_0x3be3e6[_0xd3a6('0x25')]);if(_0x3be3e6[_0xd3a6('0x26')]){delete _0x3be3e6[_0xd3a6('0x26')];}_0x56e01d['status'](_0x1c5d41)[_0xd3a6('0x27')](_0x3be3e6);};}exports[_0xd3a6('0x28')]=function(_0x53bebc,_0x5f0216){var _0x85fb6d={},_0x3cf11b={},_0x2a69c1={'count':0x0,'rows':[]};var _0x280d8e=_['map'](db[_0xd3a6('0x29')][_0xd3a6('0x2a')],function(_0x147c15){return{'name':_0x147c15[_0xd3a6('0x2b')],'type':_0x147c15['type'][_0xd3a6('0x2c')]};});_0x3cf11b['model']=_[_0xd3a6('0x2d')](_0x280d8e,_0xd3a6('0x26'));_0x3cf11b[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x53bebc[_0xd3a6('0x2e')]);_0x3cf11b['filters']=_['intersection'](_0x3cf11b[_0xd3a6('0x30')],_0x3cf11b[_0xd3a6('0x2e')]);_0x85fb6d[_0xd3a6('0x31')]=_[_0xd3a6('0x32')](_0x3cf11b[_0xd3a6('0x30')],qs[_0xd3a6('0x33')](_0x53bebc['query']['fields']));_0x85fb6d[_0xd3a6('0x31')]=_0x85fb6d[_0xd3a6('0x31')][_0xd3a6('0x34')]?_0x85fb6d[_0xd3a6('0x31')]:_0x3cf11b[_0xd3a6('0x30')];if(!_0x53bebc['query']['hasOwnProperty'](_0xd3a6('0x35'))){_0x85fb6d[_0xd3a6('0x1a')]=qs['limit'](_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x1a')]);_0x85fb6d[_0xd3a6('0x1c')]=qs['offset'](_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x1c')]);}_0x85fb6d[_0xd3a6('0x36')]=qs[_0xd3a6('0x37')](_0x53bebc[_0xd3a6('0x2e')]['sort']);_0x85fb6d[_0xd3a6('0x38')]=qs['filters'](_[_0xd3a6('0x39')](_0x53bebc['query'],_0x3cf11b[_0xd3a6('0x3a')]),_0x280d8e);if(_0x53bebc['query'][_0xd3a6('0x3b')]){_0x85fb6d['where']=_[_0xd3a6('0x3c')](_0x85fb6d[_0xd3a6('0x38')],{'$or':_[_0xd3a6('0x2d')](_0x280d8e,function(_0x1981ba){if(_0x1981ba[_0xd3a6('0x3d')]!==_0xd3a6('0x3e')){var _0x231831={};_0x231831[_0x1981ba[_0xd3a6('0x26')]]={'$like':'%'+_0x53bebc[_0xd3a6('0x2e')]['filter']+'%'};return _0x231831;}})});}_0x85fb6d=_[_0xd3a6('0x3c')]({},_0x85fb6d,_0x53bebc[_0xd3a6('0x3f')]);var _0x571a5a={'where':_0x85fb6d['where']};return db['MailSubstatus'][_0xd3a6('0x1b')](_0x571a5a)[_0xd3a6('0x22')](function(_0x290507){_0x2a69c1['count']=_0x290507;if(_0x53bebc[_0xd3a6('0x2e')][_0xd3a6('0x40')]){_0x85fb6d[_0xd3a6('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xd3a6('0x42')](_0x85fb6d);})[_0xd3a6('0x22')](function(_0x40de42){_0x2a69c1[_0xd3a6('0x43')]=_0x40de42;return _0x2a69c1;})[_0xd3a6('0x22')](respondWithFilteredResult(_0x5f0216,_0x85fb6d))['catch'](handleError(_0x5f0216,null));};exports['show']=function(_0x2bdb17,_0xf69d2c){var _0x5ee625={'raw':!![],'where':{'id':_0x2bdb17['params']['id']}},_0x5cf517={};_0x5cf517[_0xd3a6('0x30')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x29')][_0xd3a6('0x2a')]);_0x5cf517[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x2bdb17[_0xd3a6('0x2e')]);_0x5cf517[_0xd3a6('0x3a')]=_[_0xd3a6('0x32')](_0x5cf517[_0xd3a6('0x30')],_0x5cf517[_0xd3a6('0x2e')]);_0x5ee625[_0xd3a6('0x31')]=_['intersection'](_0x5cf517[_0xd3a6('0x30')],qs[_0xd3a6('0x33')](_0x2bdb17[_0xd3a6('0x2e')][_0xd3a6('0x33')]));_0x5ee625[_0xd3a6('0x31')]=_0x5ee625[_0xd3a6('0x31')][_0xd3a6('0x34')]?_0x5ee625[_0xd3a6('0x31')]:_0x5cf517[_0xd3a6('0x30')];if(_0x2bdb17[_0xd3a6('0x2e')]['includeAll']){_0x5ee625[_0xd3a6('0x41')]=[{'all':!![]}];}_0x5ee625=_[_0xd3a6('0x3c')]({},_0x5ee625,_0x2bdb17['options']);return db[_0xd3a6('0x29')]['find'](_0x5ee625)[_0xd3a6('0x22')](handleEntityNotFound(_0xf69d2c,null))['then'](respondWithResult(_0xf69d2c,null))['catch'](handleError(_0xf69d2c,null));};exports[_0xd3a6('0x44')]=function(_0x29d1a3,_0x5df08a){return db[_0xd3a6('0x29')][_0xd3a6('0x44')](_0x29d1a3[_0xd3a6('0x45')],{})[_0xd3a6('0x22')](respondWithResult(_0x5df08a,0xc9))[_0xd3a6('0x46')](handleError(_0x5df08a,null));};exports['update']=function(_0x564406,_0x20502b){if(_0x564406['body']['id']){delete _0x564406[_0xd3a6('0x45')]['id'];}return db[_0xd3a6('0x29')][_0xd3a6('0x47')]({'where':{'id':_0x564406['params']['id']}})[_0xd3a6('0x22')](handleEntityNotFound(_0x20502b,null))[_0xd3a6('0x22')](saveUpdates(_0x564406[_0xd3a6('0x45')],null))[_0xd3a6('0x22')](respondWithResult(_0x20502b,null))[_0xd3a6('0x46')](handleError(_0x20502b,null));};exports[_0xd3a6('0x48')]=function(_0x37d7a6,_0xa6fcfb){return db[_0xd3a6('0x29')][_0xd3a6('0x47')]({'where':{'id':_0x37d7a6['params']['id']}})[_0xd3a6('0x22')](handleEntityNotFound(_0xa6fcfb,null))[_0xd3a6('0x22')](removeEntity(_0xa6fcfb,null))[_0xd3a6('0x46')](handleError(_0xa6fcfb,null));};exports[_0xd3a6('0x49')]=function(_0x1b71f0,_0x11aa45){return db[_0xd3a6('0x29')]['describe']()[_0xd3a6('0x22')](respondWithResult(_0x11aa45,null))[_0xd3a6('0x46')](handleError(_0x11aa45,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 723196e..f1ad36f 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 _0x74f9=['setMaxListeners','update','emit','exports'];(function(_0x1d0cd5,_0x306c6c){var _0x20b8c3=function(_0x148039){while(--_0x148039){_0x1d0cd5['push'](_0x1d0cd5['shift']());}};_0x20b8c3(++_0x306c6c);}(_0x74f9,0x168));var _0x974f=function(_0x8a4a1e,_0x357e88){_0x8a4a1e=_0x8a4a1e-0x0;var _0x4a9174=_0x74f9[_0x8a4a1e];return _0x4a9174;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x974f('0x0')](0x0);var events={'afterUpdate':_0x974f('0x1')};function emitEvent(_0x591b54){return function(_0x599a91,_0x22d1e8,_0x1e402c){MailSubstatusEvents['emit'](_0x591b54+':'+_0x599a91['id'],_0x599a91);MailSubstatusEvents[_0x974f('0x2')](_0x591b54,_0x599a91);_0x1e402c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x974f('0x3')]=MailSubstatusEvents; \ No newline at end of file +var _0xcf14=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xcf14,0x196));var _0x4cf1=function(_0x465224,_0x2d8827){_0x465224=_0x465224-0x0;var _0x55a402=_0xcf14[_0x465224];return _0x55a402;};'use strict';var EventEmitter=require(_0x4cf1('0x0'));var MailSubstatus=require(_0x4cf1('0x1'))['db'][_0x4cf1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4cf1('0x3')](0x0);var events={'afterUpdate':_0x4cf1('0x4')};function emitEvent(_0x2514c9){return function(_0x4c96c7,_0x11a347,_0x3f80ba){MailSubstatusEvents[_0x4cf1('0x5')](_0x2514c9+':'+_0x4c96c7['id'],_0x4c96c7);MailSubstatusEvents['emit'](_0x2514c9,_0x4c96c7);_0x3f80ba(null);};}for(var e in events){if(events[_0x4cf1('0x6')](e)){var event=events[e];MailSubstatus[_0x4cf1('0x7')](e,emitEvent(event));}}module[_0x4cf1('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2b1819d..867e6a0 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 _0x3b82=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x10f5ea,_0x316c21){var _0x2c6c15=function(_0x521678){while(--_0x521678){_0x10f5ea['push'](_0x10f5ea['shift']());}};_0x2c6c15(++_0x316c21);}(_0x3b82,0x115));var _0x23b8=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3b82[_0xda464c];return _0x19e222;};'use strict';var attributes=require(_0x23b8('0x0'));module[_0x23b8('0x1')]=function(_0x231318){var _0xc97b85=_0x231318[_0x23b8('0x2')];return _0x231318[_0x23b8('0x3')](_0x23b8('0x4'),attributes,{'tableName':_0x23b8('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x31b3ae,_0x5c57cd,_0x1208c0){return _0xc97b85[_0x23b8('0x6')][_0x23b8('0x7')]({'value':_0x31b3ae[_0x23b8('0x8')]},{'where':{'field':'mailSubstatus','value':_0x31b3ae['_previousDataValues'][_0x23b8('0x8')]}})[_0x23b8('0x9')](function(){_0x1208c0();})[_0x23b8('0xa')](function(_0x4e234f){_0x1208c0(_0x4e234f);});}}});}; \ No newline at end of file +var _0xd5a2=['then','exports','models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0x5e3d2c,_0x21cfc0){var _0x313722=function(_0x2d4594){while(--_0x2d4594){_0x5e3d2c['push'](_0x5e3d2c['shift']());}};_0x313722(++_0x21cfc0);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x258589,_0xf6a3cb){_0x258589=_0x258589-0x0;var _0x3e05c3=_0xd5a2[_0x258589];return _0x3e05c3;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2d5a('0x0')]=function(_0x217b8c){var _0x75b00=_0x217b8c[_0x2d5a('0x1')];return _0x217b8c[_0x2d5a('0x2')]('MailSubstatus',attributes,{'tableName':_0x2d5a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xaeebb3,_0x18590d,_0x42947b){return _0x75b00[_0x2d5a('0x4')][_0x2d5a('0x5')]({'value':_0xaeebb3[_0x2d5a('0x6')]},{'where':{'field':_0x2d5a('0x7'),'value':_0xaeebb3[_0x2d5a('0x8')][_0x2d5a('0x6')]}})[_0x2d5a('0x9')](function(){_0x42947b();})['catch'](function(_0x5054c8){_0x42947b(_0x5054c8);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7ebe6e2..e2037fd 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 _0xd21f=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','MailSubstatus,\x20%s,\x20%s','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x49d67a,_0x55d1f6){var _0xbbb8cb=function(_0xf62fb3){while(--_0xf62fb3){_0x49d67a['push'](_0x49d67a['shift']());}};_0xbbb8cb(++_0x55d1f6);}(_0xd21f,0x1d5));var _0xfd21=function(_0x31f7c5,_0x3bf428){_0x31f7c5=_0x31f7c5-0x0;var _0x19fabc=_0xd21f[_0x31f7c5];return _0x19fabc;};'use strict';var _=require(_0xfd21('0x0'));var util=require(_0xfd21('0x1'));var moment=require(_0xfd21('0x2'));var BPromise=require(_0xfd21('0x3'));var rs=require(_0xfd21('0x4'));var fs=require('fs');var Redis=require(_0xfd21('0x5'));var db=require(_0xfd21('0x6'))['db'];var utils=require(_0xfd21('0x7'));var logger=require(_0xfd21('0x8'))(_0xfd21('0x9'));var config=require('../../config/environment');var jayson=require(_0xfd21('0xa'));var client=jayson[_0xfd21('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17ca12,_0x588246,_0x4ecc72){return new BPromise(function(_0x366e04,_0x166652){return client['request'](_0x17ca12,_0x4ecc72)[_0xfd21('0xc')](function(_0xb51770){logger[_0xfd21('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x588246,'request\x20sent');logger[_0xfd21('0xe')](_0xfd21('0xf'),_0x588246,_0xfd21('0x10'),JSON[_0xfd21('0x11')](_0xb51770));if(_0xb51770['error']){if(_0xb51770['error']['code']===0x1f4){logger['error'](_0xfd21('0x12'),_0x588246,_0xb51770['error']['message']);return _0x166652(_0xb51770['error'][_0xfd21('0x13')]);}logger[_0xfd21('0x14')](_0xfd21('0x12'),_0x588246,_0xb51770[_0xfd21('0x14')][_0xfd21('0x13')]);return _0x366e04(_0xb51770['error'][_0xfd21('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x588246,'request\x20sent');_0x366e04(_0xb51770[_0xfd21('0x15')][_0xfd21('0x13')]);}})[_0xfd21('0x16')](function(_0xdd327d){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x588246,_0xdd327d);_0x166652(_0xdd327d);});});} \ No newline at end of file +var _0xb8bc=['error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2349cd,_0x536281){var _0x22bd6f=function(_0x29b17a){while(--_0x29b17a){_0x2349cd['push'](_0x2349cd['shift']());}};_0x22bd6f(++_0x536281);}(_0xb8bc,0x1d8));var _0xcb8b=function(_0x1f408c,_0x13ef54){_0x1f408c=_0x1f408c-0x0;var _0x35ef03=_0xb8bc[_0x1f408c];return _0x35ef03;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb8b('0x0'));var fs=require('fs');var Redis=require(_0xcb8b('0x1'));var db=require(_0xcb8b('0x2'))['db'];var utils=require(_0xcb8b('0x3'));var logger=require(_0xcb8b('0x4'))(_0xcb8b('0x5'));var config=require(_0xcb8b('0x6'));var jayson=require(_0xcb8b('0x7'));var client=jayson[_0xcb8b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36dd60,_0x114c9c,_0x5820fd){return new BPromise(function(_0x2e72b9,_0x4d2db7){return client[_0xcb8b('0x9')](_0x36dd60,_0x5820fd)['then'](function(_0x1eb35e){logger[_0xcb8b('0xa')](_0xcb8b('0xb'),_0x114c9c,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x114c9c,_0xcb8b('0xc'),JSON[_0xcb8b('0xd')](_0x1eb35e));if(_0x1eb35e[_0xcb8b('0xe')]){if(_0x1eb35e[_0xcb8b('0xe')]['code']===0x1f4){logger[_0xcb8b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0x1eb35e[_0xcb8b('0xe')]['message']);return _0x4d2db7(_0x1eb35e[_0xcb8b('0xe')]['message']);}logger[_0xcb8b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0x1eb35e[_0xcb8b('0xe')]['message']);return _0x2e72b9(_0x1eb35e['error'][_0xcb8b('0xf')]);}else{logger[_0xcb8b('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x114c9c,_0xcb8b('0xc'));_0x2e72b9(_0x1eb35e[_0xcb8b('0x10')][_0xcb8b('0xf')]);}})[_0xcb8b('0x11')](function(_0xbef607){logger['error'](_0xcb8b('0xb'),_0x114c9c,_0xbef607);_0x4d2db7(_0xbef607);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5c6d1cf..f06e90d 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 _0x5731=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x5731,0x18d));var _0x1573=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5731[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x1573('0x0'));var util=require(_0x1573('0x1'));var path=require('path');var timeout=require(_0x1573('0x2'));var express=require(_0x1573('0x3'));var router=express['Router']();var fs_extra=require(_0x1573('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1573('0x5'));var config=require(_0x1573('0x6'));var controller=require(_0x1573('0x7'));router[_0x1573('0x8')]('/',auth[_0x1573('0x9')](),controller[_0x1573('0xa')]);router[_0x1573('0x8')](_0x1573('0xb'),auth[_0x1573('0x9')](),controller[_0x1573('0xc')]);router[_0x1573('0x8')](_0x1573('0xd'),auth[_0x1573('0x9')](),controller['show']);router[_0x1573('0xe')]('/',auth['isAuthenticated'](),controller[_0x1573('0xf')]);router[_0x1573('0x10')](_0x1573('0xd'),auth[_0x1573('0x9')](),controller[_0x1573('0x11')]);router[_0x1573('0x12')](_0x1573('0xd'),auth['isAuthenticated'](),controller[_0x1573('0x13')]);module[_0x1573('0x14')]=router; \ No newline at end of file +var _0x3688=['show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x44bc23,_0x52370e){var _0x21b16f=function(_0x20ca2a){while(--_0x20ca2a){_0x44bc23['push'](_0x44bc23['shift']());}};_0x21b16f(++_0x52370e);}(_0x3688,0xea));var _0x8368=function(_0x2281a0,_0x4e7028){_0x2281a0=_0x2281a0-0x0;var _0xc326c3=_0x3688[_0x2281a0];return _0xc326c3;};'use strict';var multer=require(_0x8368('0x0'));var util=require(_0x8368('0x1'));var path=require(_0x8368('0x2'));var timeout=require(_0x8368('0x3'));var express=require(_0x8368('0x4'));var router=express['Router']();var fs_extra=require(_0x8368('0x5'));var auth=require(_0x8368('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8368('0x7'));var controller=require(_0x8368('0x8'));router[_0x8368('0x9')]('/',auth[_0x8368('0xa')](),controller['index']);router['get']('/describe',auth[_0x8368('0xa')](),controller[_0x8368('0xb')]);router['get'](_0x8368('0xc'),auth[_0x8368('0xa')](),controller[_0x8368('0xd')]);router[_0x8368('0xe')]('/',auth[_0x8368('0xa')](),controller[_0x8368('0xf')]);router[_0x8368('0x10')](_0x8368('0xc'),auth[_0x8368('0xa')](),controller[_0x8368('0x11')]);router[_0x8368('0x12')]('/:id',auth[_0x8368('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fd133e7..86543ab 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1e62b8,_0x5eed4c){var _0x2ab271=function(_0x20f14e){while(--_0x20f14e){_0x1e62b8['push'](_0x1e62b8['shift']());}};_0x2ab271(++_0x5eed4c);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x557e5a,_0x561fed){var _0x3a118e=function(_0x15793d){while(--_0x15793d){_0x557e5a['push'](_0x557e5a['shift']());}};_0x3a118e(++_0x561fed);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 574162d..0cfa8f1 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 _0xd3e4=['length','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','map','MailTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','keys'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0xd3e4,0x1be));var _0x4d3e=function(_0x497672,_0x12ffe6){_0x497672=_0x497672-0x0;var _0x392c0b=_0xd3e4[_0x497672];return _0x392c0b;};'use strict';var emlformat=require(_0x4d3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d3e('0x1'));var jsonpatch=require(_0x4d3e('0x2'));var rp=require('request-promise');var moment=require(_0x4d3e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4d3e('0x4'));var util=require(_0x4d3e('0x5'));var path=require(_0x4d3e('0x6'));var sox=require(_0x4d3e('0x7'));var csv=require(_0x4d3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d3e('0x9'));var _=require('lodash');var squel=require(_0x4d3e('0xa'));var crypto=require(_0x4d3e('0xb'));var jsforce=require(_0x4d3e('0xc'));var deskjs=require(_0x4d3e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d3e('0xe'));var Redis=require(_0x4d3e('0xf'));var authService=require(_0x4d3e('0x10'));var qs=require(_0x4d3e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d3e('0x12'))(_0x4d3e('0x13'));var utils=require(_0x4d3e('0x14'));var config=require(_0x4d3e('0x15'));var licenseUtil=require(_0x4d3e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5736e4,_0x35dee2){_0x35dee2=_0x35dee2||0xcc;return function(_0x1029d1){if(_0x1029d1){return _0x5736e4['sendStatus'](_0x35dee2);}return _0x5736e4[_0x4d3e('0x17')](_0x35dee2)['end']();};}function respondWithResult(_0xd38b7a,_0x4264af){_0x4264af=_0x4264af||0xc8;return function(_0x44a299){if(_0x44a299){return _0xd38b7a[_0x4d3e('0x17')](_0x4264af)[_0x4d3e('0x18')](_0x44a299);}};}function respondWithFilteredResult(_0x1df845,_0x4d3309){return function(_0x35f1be){if(_0x35f1be){var _0x37530e=typeof _0x4d3309[_0x4d3e('0x19')]===_0x4d3e('0x1a')&&typeof _0x4d3309[_0x4d3e('0x1b')]===_0x4d3e('0x1a');var _0x2abec8=_0x35f1be[_0x4d3e('0x1c')];var _0x1c62a9=_0x37530e?0x0:_0x4d3309[_0x4d3e('0x19')];var _0x3b1d55=_0x37530e?_0x35f1be[_0x4d3e('0x1c')]:_0x4d3309[_0x4d3e('0x19')]+_0x4d3309[_0x4d3e('0x1b')];var _0x565e76;if(_0x3b1d55>=_0x2abec8){_0x3b1d55=_0x2abec8;_0x565e76=0xc8;}else{_0x565e76=0xce;}_0x1df845['status'](_0x565e76);return _0x1df845[_0x4d3e('0x1d')](_0x4d3e('0x1e'),_0x1c62a9+'-'+_0x3b1d55+'/'+_0x2abec8)[_0x4d3e('0x18')](_0x35f1be);}return null;};}function patchUpdates(_0x65563a){return function(_0xba601e){try{jsonpatch['apply'](_0xba601e,_0x65563a,!![]);}catch(_0x40ec9b){return BPromise[_0x4d3e('0x1f')](_0x40ec9b);}return _0xba601e[_0x4d3e('0x20')]();};}function saveUpdates(_0x357aa5,_0x17dac0){return function(_0x3898f8){if(_0x3898f8){return _0x3898f8[_0x4d3e('0x21')](_0x357aa5)[_0x4d3e('0x22')](function(_0xddd67a){return _0xddd67a;});}return null;};}function removeEntity(_0x25921d,_0x8d3c51){return function(_0x3716b8){if(_0x3716b8){return _0x3716b8['destroy']()[_0x4d3e('0x22')](function(){_0x25921d[_0x4d3e('0x17')](0xcc)[_0x4d3e('0x23')]();});}};}function handleEntityNotFound(_0x530601,_0x4cc08b){return function(_0x23dc5e){if(!_0x23dc5e){_0x530601[_0x4d3e('0x24')](0x194);}return _0x23dc5e;};}function handleError(_0x24074f,_0xc91b2f){_0xc91b2f=_0xc91b2f||0x1f4;return function(_0x12d72f){logger[_0x4d3e('0x25')](_0x12d72f[_0x4d3e('0x26')]);if(_0x12d72f[_0x4d3e('0x27')]){delete _0x12d72f['name'];}_0x24074f['status'](_0xc91b2f)['send'](_0x12d72f);};}exports['index']=function(_0x200eab,_0x542b74){var _0x1d1993={},_0x313ad7={},_0x1febd6={'count':0x0,'rows':[]};var _0x39203b=_[_0x4d3e('0x28')](db[_0x4d3e('0x29')][_0x4d3e('0x2a')],function(_0x24b171){return{'name':_0x24b171[_0x4d3e('0x2b')],'type':_0x24b171['type'][_0x4d3e('0x2c')]};});_0x313ad7['model']=_[_0x4d3e('0x28')](_0x39203b,'name');_0x313ad7[_0x4d3e('0x2d')]=_['keys'](_0x200eab['query']);_0x313ad7[_0x4d3e('0x2e')]=_[_0x4d3e('0x2f')](_0x313ad7[_0x4d3e('0x30')],_0x313ad7['query']);_0x1d1993[_0x4d3e('0x31')]=_[_0x4d3e('0x2f')](_0x313ad7[_0x4d3e('0x30')],qs[_0x4d3e('0x32')](_0x200eab[_0x4d3e('0x2d')][_0x4d3e('0x32')]));_0x1d1993[_0x4d3e('0x31')]=_0x1d1993[_0x4d3e('0x31')]['length']?_0x1d1993[_0x4d3e('0x31')]:_0x313ad7[_0x4d3e('0x30')];if(!_0x200eab[_0x4d3e('0x2d')]['hasOwnProperty'](_0x4d3e('0x33'))){_0x1d1993[_0x4d3e('0x1b')]=qs[_0x4d3e('0x1b')](_0x200eab[_0x4d3e('0x2d')][_0x4d3e('0x1b')]);_0x1d1993[_0x4d3e('0x19')]=qs[_0x4d3e('0x19')](_0x200eab[_0x4d3e('0x2d')][_0x4d3e('0x19')]);}_0x1d1993['order']=qs[_0x4d3e('0x34')](_0x200eab['query'][_0x4d3e('0x34')]);_0x1d1993[_0x4d3e('0x35')]=qs['filters'](_[_0x4d3e('0x36')](_0x200eab['query'],_0x313ad7['filters']),_0x39203b);if(_0x200eab['query'][_0x4d3e('0x37')]){_0x1d1993[_0x4d3e('0x35')]=_['merge'](_0x1d1993[_0x4d3e('0x35')],{'$or':_[_0x4d3e('0x28')](_0x39203b,function(_0x1af38f){if(_0x1af38f[_0x4d3e('0x38')]!==_0x4d3e('0x39')){var _0x7e0996={};_0x7e0996[_0x1af38f[_0x4d3e('0x27')]]={'$like':'%'+_0x200eab[_0x4d3e('0x2d')][_0x4d3e('0x37')]+'%'};return _0x7e0996;}})});}_0x1d1993=_[_0x4d3e('0x3a')]({},_0x1d1993,_0x200eab[_0x4d3e('0x3b')]);var _0xba2a44={'where':_0x1d1993[_0x4d3e('0x35')]};return db[_0x4d3e('0x29')][_0x4d3e('0x1c')](_0xba2a44)[_0x4d3e('0x22')](function(_0x2b8426){_0x1febd6[_0x4d3e('0x1c')]=_0x2b8426;if(_0x200eab[_0x4d3e('0x2d')][_0x4d3e('0x3c')]){_0x1d1993[_0x4d3e('0x3d')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x1d1993);})['then'](function(_0x32e589){_0x1febd6[_0x4d3e('0x3e')]=_0x32e589;return _0x1febd6;})[_0x4d3e('0x22')](respondWithFilteredResult(_0x542b74,_0x1d1993))['catch'](handleError(_0x542b74,null));};exports[_0x4d3e('0x3f')]=function(_0x6bc66a,_0x50278e){var _0x1b08b6={'raw':!![],'where':{'id':_0x6bc66a['params']['id']}},_0x2ec067={};_0x2ec067[_0x4d3e('0x30')]=_[_0x4d3e('0x40')](db['MailTransferReport'][_0x4d3e('0x2a')]);_0x2ec067['query']=_['keys'](_0x6bc66a[_0x4d3e('0x2d')]);_0x2ec067[_0x4d3e('0x2e')]=_[_0x4d3e('0x2f')](_0x2ec067[_0x4d3e('0x30')],_0x2ec067[_0x4d3e('0x2d')]);_0x1b08b6['attributes']=_[_0x4d3e('0x2f')](_0x2ec067[_0x4d3e('0x30')],qs[_0x4d3e('0x32')](_0x6bc66a[_0x4d3e('0x2d')]['fields']));_0x1b08b6[_0x4d3e('0x31')]=_0x1b08b6[_0x4d3e('0x31')][_0x4d3e('0x41')]?_0x1b08b6['attributes']:_0x2ec067['model'];if(_0x6bc66a[_0x4d3e('0x2d')][_0x4d3e('0x3c')]){_0x1b08b6['include']=[{'all':!![]}];}_0x1b08b6=_[_0x4d3e('0x3a')]({},_0x1b08b6,_0x6bc66a['options']);return db[_0x4d3e('0x29')][_0x4d3e('0x42')](_0x1b08b6)[_0x4d3e('0x22')](handleEntityNotFound(_0x50278e,null))[_0x4d3e('0x22')](respondWithResult(_0x50278e,null))[_0x4d3e('0x43')](handleError(_0x50278e,null));};exports[_0x4d3e('0x44')]=function(_0x1a91c3,_0x15899a){return db[_0x4d3e('0x29')]['create'](_0x1a91c3['body'],{})[_0x4d3e('0x22')](respondWithResult(_0x15899a,0xc9))[_0x4d3e('0x43')](handleError(_0x15899a,null));};exports[_0x4d3e('0x21')]=function(_0x22a78a,_0xdc5ba8){if(_0x22a78a['body']['id']){delete _0x22a78a[_0x4d3e('0x45')]['id'];}return db[_0x4d3e('0x29')][_0x4d3e('0x42')]({'where':{'id':_0x22a78a[_0x4d3e('0x46')]['id']}})['then'](handleEntityNotFound(_0xdc5ba8,null))[_0x4d3e('0x22')](saveUpdates(_0x22a78a[_0x4d3e('0x45')],null))[_0x4d3e('0x22')](respondWithResult(_0xdc5ba8,null))[_0x4d3e('0x43')](handleError(_0xdc5ba8,null));};exports[_0x4d3e('0x47')]=function(_0x552fe9,_0x270a92){return db[_0x4d3e('0x29')][_0x4d3e('0x42')]({'where':{'id':_0x552fe9[_0x4d3e('0x46')]['id']}})[_0x4d3e('0x22')](handleEntityNotFound(_0x270a92,null))[_0x4d3e('0x22')](removeEntity(_0x270a92,null))[_0x4d3e('0x43')](handleError(_0x270a92,null));};exports[_0x4d3e('0x48')]=function(_0x371360,_0x18f66c){return db[_0x4d3e('0x29')][_0x4d3e('0x48')]()[_0x4d3e('0x22')](respondWithResult(_0x18f66c,null))['catch'](handleError(_0x18f66c,null));}; \ No newline at end of file +var _0xb8ec=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x365056,_0x5afa4f){var _0x412743=function(_0x224968){while(--_0x224968){_0x365056['push'](_0x365056['shift']());}};_0x412743(++_0x5afa4f);}(_0xb8ec,0x11f));var _0xcb8e=function(_0x123990,_0x1025b4){_0x123990=_0x123990-0x0;var _0x3fb195=_0xb8ec[_0x123990];return _0x3fb195;};'use strict';var emlformat=require(_0xcb8e('0x0'));var rimraf=require(_0xcb8e('0x1'));var zipdir=require(_0xcb8e('0x2'));var jsonpatch=require(_0xcb8e('0x3'));var rp=require('request-promise');var moment=require(_0xcb8e('0x4'));var BPromise=require(_0xcb8e('0x5'));var Mustache=require(_0xcb8e('0x6'));var util=require(_0xcb8e('0x7'));var path=require('path');var sox=require(_0xcb8e('0x8'));var csv=require(_0xcb8e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb8e('0xa'));var _=require(_0xcb8e('0xb'));var squel=require(_0xcb8e('0xc'));var crypto=require(_0xcb8e('0xd'));var jsforce=require(_0xcb8e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcb8e('0x9'));var querystring=require(_0xcb8e('0xf'));var Papa=require(_0xcb8e('0x10'));var Redis=require(_0xcb8e('0x11'));var authService=require(_0xcb8e('0x12'));var qs=require(_0xcb8e('0x13'));var as=require(_0xcb8e('0x14'));var hardwareService=require(_0xcb8e('0x15'));var logger=require(_0xcb8e('0x16'))(_0xcb8e('0x17'));var utils=require(_0xcb8e('0x18'));var config=require(_0xcb8e('0x19'));var licenseUtil=require(_0xcb8e('0x1a'));var db=require(_0xcb8e('0x1b'))['db'];function respondWithStatusCode(_0x133c0f,_0x4c6909){_0x4c6909=_0x4c6909||0xcc;return function(_0x443a05){if(_0x443a05){return _0x133c0f[_0xcb8e('0x1c')](_0x4c6909);}return _0x133c0f[_0xcb8e('0x1d')](_0x4c6909)[_0xcb8e('0x1e')]();};}function respondWithResult(_0x675d63,_0x316782){_0x316782=_0x316782||0xc8;return function(_0x5705d2){if(_0x5705d2){return _0x675d63[_0xcb8e('0x1d')](_0x316782)[_0xcb8e('0x1f')](_0x5705d2);}};}function respondWithFilteredResult(_0x251923,_0x1c52d7){return function(_0x5bc7aa){if(_0x5bc7aa){var _0x1bad88=typeof _0x1c52d7[_0xcb8e('0x20')]===_0xcb8e('0x21')&&typeof _0x1c52d7[_0xcb8e('0x22')]===_0xcb8e('0x21');var _0x1eb421=_0x5bc7aa[_0xcb8e('0x23')];var _0x1cc8e8=_0x1bad88?0x0:_0x1c52d7[_0xcb8e('0x20')];var _0x23c934=_0x1bad88?_0x5bc7aa[_0xcb8e('0x23')]:_0x1c52d7[_0xcb8e('0x20')]+_0x1c52d7[_0xcb8e('0x22')];var _0x40c2e1;if(_0x23c934>=_0x1eb421){_0x23c934=_0x1eb421;_0x40c2e1=0xc8;}else{_0x40c2e1=0xce;}_0x251923['status'](_0x40c2e1);return _0x251923[_0xcb8e('0x24')]('Content-Range',_0x1cc8e8+'-'+_0x23c934+'/'+_0x1eb421)[_0xcb8e('0x1f')](_0x5bc7aa);}return null;};}function patchUpdates(_0x471108){return function(_0x2eac76){try{jsonpatch[_0xcb8e('0x25')](_0x2eac76,_0x471108,!![]);}catch(_0x491775){return BPromise[_0xcb8e('0x26')](_0x491775);}return _0x2eac76['save']();};}function saveUpdates(_0x5aa8e0,_0xf103b9){return function(_0x117e1b){if(_0x117e1b){return _0x117e1b[_0xcb8e('0x27')](_0x5aa8e0)[_0xcb8e('0x28')](function(_0x310084){return _0x310084;});}return null;};}function removeEntity(_0x5dbe6f,_0x3716c6){return function(_0x24c97f){if(_0x24c97f){return _0x24c97f['destroy']()[_0xcb8e('0x28')](function(){_0x5dbe6f[_0xcb8e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a627,_0x44a14c){return function(_0x2200a7){if(!_0x2200a7){_0x14a627[_0xcb8e('0x1c')](0x194);}return _0x2200a7;};}function handleError(_0x4ee515,_0x266335){_0x266335=_0x266335||0x1f4;return function(_0x1c57a2){logger[_0xcb8e('0x29')](_0x1c57a2['stack']);if(_0x1c57a2[_0xcb8e('0x2a')]){delete _0x1c57a2[_0xcb8e('0x2a')];}_0x4ee515[_0xcb8e('0x1d')](_0x266335)['send'](_0x1c57a2);};}exports['index']=function(_0x62079e,_0x230007){var _0x333130={},_0x4803ab={},_0xca4c8b={'count':0x0,'rows':[]};var _0x1860c8=_[_0xcb8e('0x2b')](db['MailTransferReport'][_0xcb8e('0x2c')],function(_0x56802c){return{'name':_0x56802c[_0xcb8e('0x2d')],'type':_0x56802c[_0xcb8e('0x2e')][_0xcb8e('0x2f')]};});_0x4803ab[_0xcb8e('0x30')]=_[_0xcb8e('0x2b')](_0x1860c8,_0xcb8e('0x2a'));_0x4803ab[_0xcb8e('0x31')]=_[_0xcb8e('0x32')](_0x62079e[_0xcb8e('0x31')]);_0x4803ab[_0xcb8e('0x33')]=_['intersection'](_0x4803ab[_0xcb8e('0x30')],_0x4803ab[_0xcb8e('0x31')]);_0x333130[_0xcb8e('0x34')]=_[_0xcb8e('0x35')](_0x4803ab[_0xcb8e('0x30')],qs[_0xcb8e('0x36')](_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x36')]));_0x333130['attributes']=_0x333130[_0xcb8e('0x34')][_0xcb8e('0x37')]?_0x333130['attributes']:_0x4803ab[_0xcb8e('0x30')];if(!_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x38')](_0xcb8e('0x39'))){_0x333130[_0xcb8e('0x22')]=qs['limit'](_0x62079e[_0xcb8e('0x31')]['limit']);_0x333130[_0xcb8e('0x20')]=qs[_0xcb8e('0x20')](_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x20')]);}_0x333130[_0xcb8e('0x3a')]=qs[_0xcb8e('0x3b')](_0x62079e['query'][_0xcb8e('0x3b')]);_0x333130[_0xcb8e('0x3c')]=qs[_0xcb8e('0x33')](_['pick'](_0x62079e['query'],_0x4803ab[_0xcb8e('0x33')]),_0x1860c8);if(_0x62079e['query'][_0xcb8e('0x3d')]){_0x333130['where']=_[_0xcb8e('0x3e')](_0x333130['where'],{'$or':_['map'](_0x1860c8,function(_0x2998ed){if(_0x2998ed[_0xcb8e('0x2e')]!==_0xcb8e('0x3f')){var _0x2c8548={};_0x2c8548[_0x2998ed[_0xcb8e('0x2a')]]={'$like':'%'+_0x62079e['query'][_0xcb8e('0x3d')]+'%'};return _0x2c8548;}})});}_0x333130=_[_0xcb8e('0x3e')]({},_0x333130,_0x62079e[_0xcb8e('0x40')]);var _0x58b235={'where':_0x333130[_0xcb8e('0x3c')]};return db[_0xcb8e('0x41')][_0xcb8e('0x23')](_0x58b235)[_0xcb8e('0x28')](function(_0x2c908e){_0xca4c8b['count']=_0x2c908e;if(_0x62079e[_0xcb8e('0x31')][_0xcb8e('0x42')]){_0x333130['include']=[{'all':!![]}];}return db[_0xcb8e('0x41')][_0xcb8e('0x43')](_0x333130);})[_0xcb8e('0x28')](function(_0x3c6e3d){_0xca4c8b[_0xcb8e('0x44')]=_0x3c6e3d;return _0xca4c8b;})[_0xcb8e('0x28')](respondWithFilteredResult(_0x230007,_0x333130))[_0xcb8e('0x45')](handleError(_0x230007,null));};exports[_0xcb8e('0x46')]=function(_0x356fde,_0x5e7b1f){var _0x10b8bf={'raw':!![],'where':{'id':_0x356fde['params']['id']}},_0x2a01ec={};_0x2a01ec[_0xcb8e('0x30')]=_[_0xcb8e('0x32')](db['MailTransferReport']['rawAttributes']);_0x2a01ec['query']=_['keys'](_0x356fde[_0xcb8e('0x31')]);_0x2a01ec[_0xcb8e('0x33')]=_['intersection'](_0x2a01ec['model'],_0x2a01ec['query']);_0x10b8bf['attributes']=_[_0xcb8e('0x35')](_0x2a01ec['model'],qs[_0xcb8e('0x36')](_0x356fde[_0xcb8e('0x31')][_0xcb8e('0x36')]));_0x10b8bf[_0xcb8e('0x34')]=_0x10b8bf['attributes'][_0xcb8e('0x37')]?_0x10b8bf[_0xcb8e('0x34')]:_0x2a01ec['model'];if(_0x356fde[_0xcb8e('0x31')][_0xcb8e('0x42')]){_0x10b8bf[_0xcb8e('0x47')]=[{'all':!![]}];}_0x10b8bf=_[_0xcb8e('0x3e')]({},_0x10b8bf,_0x356fde[_0xcb8e('0x40')]);return db[_0xcb8e('0x41')][_0xcb8e('0x48')](_0x10b8bf)[_0xcb8e('0x28')](handleEntityNotFound(_0x5e7b1f,null))[_0xcb8e('0x28')](respondWithResult(_0x5e7b1f,null))[_0xcb8e('0x45')](handleError(_0x5e7b1f,null));};exports[_0xcb8e('0x49')]=function(_0x5d380d,_0x28b555){return db[_0xcb8e('0x41')][_0xcb8e('0x49')](_0x5d380d[_0xcb8e('0x4a')],{})['then'](respondWithResult(_0x28b555,0xc9))[_0xcb8e('0x45')](handleError(_0x28b555,null));};exports[_0xcb8e('0x27')]=function(_0x1a43f2,_0x1c8b0c){if(_0x1a43f2[_0xcb8e('0x4a')]['id']){delete _0x1a43f2[_0xcb8e('0x4a')]['id'];}return db[_0xcb8e('0x41')][_0xcb8e('0x48')]({'where':{'id':_0x1a43f2[_0xcb8e('0x4b')]['id']}})[_0xcb8e('0x28')](handleEntityNotFound(_0x1c8b0c,null))['then'](saveUpdates(_0x1a43f2[_0xcb8e('0x4a')],null))['then'](respondWithResult(_0x1c8b0c,null))[_0xcb8e('0x45')](handleError(_0x1c8b0c,null));};exports[_0xcb8e('0x4c')]=function(_0xc29b15,_0x47f6f0){return db[_0xcb8e('0x41')][_0xcb8e('0x48')]({'where':{'id':_0xc29b15[_0xcb8e('0x4b')]['id']}})[_0xcb8e('0x28')](handleEntityNotFound(_0x47f6f0,null))[_0xcb8e('0x28')](removeEntity(_0x47f6f0,null))[_0xcb8e('0x45')](handleError(_0x47f6f0,null));};exports['describe']=function(_0x21502c,_0x2198bf){return db[_0xcb8e('0x41')]['describe']()[_0xcb8e('0x28')](respondWithResult(_0x2198bf,null))[_0xcb8e('0x45')](handleError(_0x2198bf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8619488..60bd039 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 _0x550b=['../../config/logger','api','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util'];(function(_0x5a974c,_0x3a785b){var _0x3fb832=function(_0x1a18e8){while(--_0x1a18e8){_0x5a974c['push'](_0x5a974c['shift']());}};_0x3fb832(++_0x3a785b);}(_0x550b,0x17e));var _0xb550=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x550b[_0x946518];return _0x909b69;};'use strict';var _=require(_0xb550('0x0'));var util=require(_0xb550('0x1'));var logger=require(_0xb550('0x2'))(_0xb550('0x3'));var moment=require('moment');var BPromise=require(_0xb550('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb550('0x5'));var rimraf=require(_0xb550('0x6'));var config=require('../../config/environment');var attributes=require(_0xb550('0x7'));module[_0xb550('0x8')]=function(_0x4dd1b4,_0x517fe4){return _0x4dd1b4[_0xb550('0x9')](_0xb550('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xb550('0xb'),'fields':[_0xb550('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a25=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x5eaca5,_0x5effb5){var _0x15baf6=function(_0x1239b3){while(--_0x1239b3){_0x5eaca5['push'](_0x5eaca5['shift']());}};_0x15baf6(++_0x5effb5);}(_0x4a25,0x1d4));var _0x54a2=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x4a25[_0x2ab365];return _0x49fef3;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[{'name':_0x54a2('0xb'),'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 f31c297..2f500cf 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 _0x0b1a=['MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x344208,_0x5c7574){var _0x2adf6a=function(_0x220cae){while(--_0x220cae){_0x344208['push'](_0x344208['shift']());}};_0x2adf6a(++_0x5c7574);}(_0x0b1a,0xad));var _0xa0b1=function(_0x2b5d92,_0x57f217){_0x2b5d92=_0x2b5d92-0x0;var _0x353bc6=_0x0b1a[_0x2b5d92];return _0x353bc6;};'use strict';var _=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var moment=require(_0xa0b1('0x2'));var BPromise=require(_0xa0b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0b1('0x4'))['db'];var utils=require(_0xa0b1('0x5'));var logger=require(_0xa0b1('0x6'))(_0xa0b1('0x7'));var config=require(_0xa0b1('0x8'));var jayson=require(_0xa0b1('0x9'));var client=jayson['client'][_0xa0b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eaf74,_0x8a48af,_0x3029e7){return new BPromise(function(_0x210130,_0x1a8ace){return client[_0xa0b1('0xb')](_0x2eaf74,_0x3029e7)[_0xa0b1('0xc')](function(_0x18eaa8){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x8a48af,_0xa0b1('0xd'));logger[_0xa0b1('0xe')](_0xa0b1('0xf'),_0x8a48af,_0xa0b1('0xd'),JSON[_0xa0b1('0x10')](_0x18eaa8));if(_0x18eaa8[_0xa0b1('0x11')]){if(_0x18eaa8[_0xa0b1('0x11')][_0xa0b1('0x12')]===0x1f4){logger['error'](_0xa0b1('0x13'),_0x8a48af,_0x18eaa8['error'][_0xa0b1('0x14')]);return _0x1a8ace(_0x18eaa8[_0xa0b1('0x11')][_0xa0b1('0x14')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x8a48af,_0x18eaa8[_0xa0b1('0x11')][_0xa0b1('0x14')]);return _0x210130(_0x18eaa8['error'][_0xa0b1('0x14')]);}else{logger[_0xa0b1('0x15')]('MailTransferReport,\x20%s,\x20%s',_0x8a48af,_0xa0b1('0xd'));_0x210130(_0x18eaa8[_0xa0b1('0x16')][_0xa0b1('0x14')]);}})[_0xa0b1('0x17')](function(_0x1c29c8){logger[_0xa0b1('0x11')](_0xa0b1('0x13'),_0x8a48af,_0x1c29c8);_0x1a8ace(_0x1c29c8);});});} \ No newline at end of file +var _0xfabe=['rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xfabe,0x12c));var _0xefab=function(_0x463912,_0x1b44df){_0x463912=_0x463912-0x0;var _0x5de804=_0xfabe[_0x463912];return _0x5de804;};'use strict';var _=require(_0xefab('0x0'));var util=require(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rs=require(_0xefab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefab('0x5'))['db'];var utils=require(_0xefab('0x6'));var logger=require(_0xefab('0x7'))(_0xefab('0x8'));var config=require(_0xefab('0x9'));var jayson=require(_0xefab('0xa'));var client=jayson[_0xefab('0xb')][_0xefab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x388f02,_0x55acc0,_0x27de60){return new BPromise(function(_0x16c001,_0x46a248){return client['request'](_0x388f02,_0x27de60)['then'](function(_0x1a2f0a){logger[_0xefab('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x55acc0,_0xefab('0xe'));logger[_0xefab('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x55acc0,'request\x20sent',JSON[_0xefab('0x10')](_0x1a2f0a));if(_0x1a2f0a[_0xefab('0x11')]){if(_0x1a2f0a[_0xefab('0x11')]['code']===0x1f4){logger[_0xefab('0x11')](_0xefab('0x12'),_0x55acc0,_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);return _0x46a248(_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);}logger['error'](_0xefab('0x12'),_0x55acc0,_0x1a2f0a[_0xefab('0x11')][_0xefab('0x13')]);return _0x16c001(_0x1a2f0a[_0xefab('0x11')]['message']);}else{logger['info'](_0xefab('0x12'),_0x55acc0,_0xefab('0xe'));_0x16c001(_0x1a2f0a[_0xefab('0x14')][_0xefab('0x13')]);}})[_0xefab('0x15')](function(_0x51b503){logger['error'](_0xefab('0x12'),_0x55acc0,_0x51b503);_0x46a248(_0x51b503);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5dc6314..f68c90d 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 _0x8f5e=['./memberReport.controller','get','index','/describe','/:id','isAuthenticated','show','post','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc7ab5,_0x1ec853){var _0x4c4b11=function(_0x3af5ab){while(--_0x3af5ab){_0xc7ab5['push'](_0xc7ab5['shift']());}};_0x4c4b11(++_0x1ec853);}(_0x8f5e,0x105));var _0xe8f5=function(_0x193c72,_0x1c2031){_0x193c72=_0x193c72-0x0;var _0x849501=_0x8f5e[_0x193c72];return _0x849501;};'use strict';var multer=require(_0xe8f5('0x0'));var util=require('util');var path=require(_0xe8f5('0x1'));var timeout=require(_0xe8f5('0x2'));var express=require(_0xe8f5('0x3'));var router=express[_0xe8f5('0x4')]();var fs_extra=require(_0xe8f5('0x5'));var auth=require(_0xe8f5('0x6'));var interaction=require(_0xe8f5('0x7'));var config=require(_0xe8f5('0x8'));var controller=require(_0xe8f5('0x9'));router[_0xe8f5('0xa')]('/',auth['isAuthenticated'](),controller[_0xe8f5('0xb')]);router['get'](_0xe8f5('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe8f5('0xd'),auth[_0xe8f5('0xe')](),controller[_0xe8f5('0xf')]);router[_0xe8f5('0x10')]('/',auth[_0xe8f5('0xe')](),controller['create']);router['put']('/:id',auth[_0xe8f5('0xe')](),controller[_0xe8f5('0x11')]);router['delete'](_0xe8f5('0xd'),auth[_0xe8f5('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1391=['/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0x1391,0x1ad));var _0x1139=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1391[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x1139('0x0'));var util=require(_0x1139('0x1'));var path=require(_0x1139('0x2'));var timeout=require(_0x1139('0x3'));var express=require(_0x1139('0x4'));var router=express['Router']();var fs_extra=require(_0x1139('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1139('0x6'));var config=require(_0x1139('0x7'));var controller=require(_0x1139('0x8'));router['get']('/',auth[_0x1139('0x9')](),controller[_0x1139('0xa')]);router['get'](_0x1139('0xb'),auth['isAuthenticated'](),controller[_0x1139('0xc')]);router[_0x1139('0xd')](_0x1139('0xe'),auth[_0x1139('0x9')](),controller[_0x1139('0xf')]);router[_0x1139('0x10')]('/',auth[_0x1139('0x9')](),controller[_0x1139('0x11')]);router[_0x1139('0x12')](_0x1139('0xe'),auth['isAuthenticated'](),controller[_0x1139('0x13')]);router['delete'](_0x1139('0xe'),auth['isAuthenticated'](),controller[_0x1139('0x14')]);module[_0x1139('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9091d3f..ea03a6d 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 _0xaa4e=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x1e6d93,_0x122802){var _0x4f12cf=function(_0x3c2622){while(--_0x3c2622){_0x1e6d93['push'](_0x1e6d93['shift']());}};_0x4f12cf(++_0x122802);}(_0xaa4e,0x14e));var _0xeaa4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa4e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xeaa4('0x0'));var moment=require(_0xeaa4('0x1'));module[_0xeaa4('0x2')]={'channel':{'type':Sequelize[_0xeaa4('0x3')]},'membername':{'type':Sequelize[_0xeaa4('0x3')]},'interface':{'type':Sequelize[_0xeaa4('0x3')]},'type':{'type':Sequelize[_0xeaa4('0x3')],'defaultValue':_0xeaa4('0x4'),'comment':_0xeaa4('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xeaa4('0x6')]},'exitAt':{'type':Sequelize[_0xeaa4('0x6')],'set':function(_0xabd6b7){var _0x3ff043=moment(_0xabd6b7);var _0xbc9a34=moment(this[_0xeaa4('0x7')](_0xeaa4('0x8')));var _0x243541=_0x3ff043[_0xeaa4('0x9')](_0xbc9a34,_0xeaa4('0xa'));this[_0xeaa4('0xb')](_0xeaa4('0xc'),_0xabd6b7);this[_0xeaa4('0xb')](_0xeaa4('0xd'),_0x243541>=0x0?_0x243541:null);}},'data1':{'type':Sequelize[_0xeaa4('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xeaa4('0x3')],'comment':_0xeaa4('0xe')},'data3':{'type':Sequelize[_0xeaa4('0x3')],'comment':_0xeaa4('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xeaa4('0x10')},'data5':{'type':Sequelize[_0xeaa4('0x3')],'comment':_0xeaa4('0x11')},'role':{'type':Sequelize[_0xeaa4('0x3')]},'internal':{'type':Sequelize[_0xeaa4('0x12')]},'uniqueid':{'type':Sequelize[_0xeaa4('0x3')]}}; \ No newline at end of file +var _0x7c20=['sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','INTEGER'];(function(_0x4f4679,_0x713087){var _0x2f7cd0=function(_0x8eaf53){while(--_0x8eaf53){_0x4f4679['push'](_0x4f4679['shift']());}};_0x2f7cd0(++_0x713087);}(_0x7c20,0x90));var _0x07c2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7c20[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x07c2('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x07c2('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x07c2('0x1')]},'type':{'type':Sequelize[_0x07c2('0x1')],'defaultValue':_0x07c2('0x2'),'comment':_0x07c2('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x07c2('0x4')],'set':function(_0x2b671e){var _0x3d52f4=moment(_0x2b671e);var _0x249968=moment(this[_0x07c2('0x5')](_0x07c2('0x6')));var _0x561e88=_0x3d52f4[_0x07c2('0x7')](_0x249968,_0x07c2('0x8'));this[_0x07c2('0x9')](_0x07c2('0xa'),_0x2b671e);this[_0x07c2('0x9')](_0x07c2('0xb'),_0x561e88>=0x0?_0x561e88:null);}},'data1':{'type':Sequelize[_0x07c2('0x1')],'comment':_0x07c2('0xc')},'data2':{'type':Sequelize[_0x07c2('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x07c2('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x07c2('0xd')},'data5':{'type':Sequelize[_0x07c2('0x1')],'comment':_0x07c2('0xe')},'role':{'type':Sequelize[_0x07c2('0x1')]},'internal':{'type':Sequelize[_0x07c2('0xf')]},'uniqueid':{'type':Sequelize[_0x07c2('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e7d9b9e..36b5785 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55ca,0x126));var _0xa55c=function(_0x131fe7,_0x21fcdb){_0x131fe7=_0x131fe7-0x0;var _0x2eddf3=_0x55ca[_0x131fe7];return _0x2eddf3;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +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(_0x1d6fff,_0x324f13){var _0xf0eaed=function(_0x58e63){while(--_0x58e63){_0x1d6fff['push'](_0x1d6fff['shift']());}};_0xf0eaed(++_0x324f13);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1a02e39..00584c8 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 _0x48e0=['membername_interface','membername','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x2f4eca,_0x2d0562){var _0x5c2a41=function(_0x54c7bc){while(--_0x54c7bc){_0x2f4eca['push'](_0x2f4eca['shift']());}};_0x5c2a41(++_0x2d0562);}(_0x48e0,0xb8));var _0x048e=function(_0x296e71,_0x500b29){_0x296e71=_0x296e71-0x0;var _0x15ccc0=_0x48e0[_0x296e71];return _0x15ccc0;};'use strict';var _=require(_0x048e('0x0'));var util=require('util');var logger=require(_0x048e('0x1'))(_0x048e('0x2'));var moment=require('moment');var BPromise=require(_0x048e('0x3'));var rp=require(_0x048e('0x4'));var fs=require('fs');var path=require(_0x048e('0x5'));var rimraf=require(_0x048e('0x6'));var config=require(_0x048e('0x7'));var attributes=require(_0x048e('0x8'));module['exports']=function(_0x3ff4db,_0x324426){return _0x3ff4db[_0x048e('0x9')](_0x048e('0xa'),attributes,{'tableName':_0x048e('0xb'),'paranoid':![],'indexes':[{'name':_0x048e('0xc'),'fields':[_0x048e('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd022=['../../config/logger','api','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','interface','lodash','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd022,0xa6));var _0x2d02=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd022[_0x279d37];return _0x530173;};'use strict';var _=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var logger=require(_0x2d02('0x2'))(_0x2d02('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d02('0x4'));var fs=require('fs');var path=require(_0x2d02('0x5'));var rimraf=require('rimraf');var config=require(_0x2d02('0x6'));var attributes=require(_0x2d02('0x7'));module[_0x2d02('0x8')]=function(_0x39c5e0,_0x511346){return _0x39c5e0[_0x2d02('0x9')]('MemberReport',attributes,{'tableName':_0x2d02('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x2d02('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 c60a889..8f35402 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 _0x2070=['attributes','limit','include','map','model','then','CreateMemberReport','create','body','update','UpdateMemberReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where'];(function(_0x4a912a,_0x282a7b){var _0x37536e=function(_0x5b1759){while(--_0x5b1759){_0x4a912a['push'](_0x4a912a['shift']());}};_0x37536e(++_0x282a7b);}(_0x2070,0x1a2));var _0x0207=function(_0x39e152,_0x32aa75){_0x39e152=_0x39e152-0x0;var _0x764289=_0x2070[_0x39e152];return _0x764289;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0207('0x0'));var BPromise=require(_0x0207('0x1'));var rs=require(_0x0207('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0207('0x3'))['db'];var utils=require(_0x0207('0x4'));var logger=require('../../config/logger')(_0x0207('0x5'));var config=require(_0x0207('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0207('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7607,_0x412b15,_0x198c8e){return new BPromise(function(_0x4b88d0,_0x471bd7){return client[_0x0207('0x8')](_0x5e7607,_0x198c8e)['then'](function(_0x29fd26){logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,_0x0207('0xb'));logger[_0x0207('0xc')](_0x0207('0xd'),_0x412b15,_0x0207('0xb'),JSON[_0x0207('0xe')](_0x29fd26));if(_0x29fd26[_0x0207('0xf')]){if(_0x29fd26[_0x0207('0xf')][_0x0207('0x10')]===0x1f4){logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')]['message']);return _0x471bd7(_0x29fd26[_0x0207('0xf')]['message']);}logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')][_0x0207('0x11')]);return _0x4b88d0(_0x29fd26[_0x0207('0xf')]['message']);}else{logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,'request\x20sent');_0x4b88d0(_0x29fd26[_0x0207('0x12')][_0x0207('0x11')]);}})[_0x0207('0x13')](function(_0x325eb1){logger['error'](_0x0207('0xa'),_0x412b15,_0x325eb1);_0x471bd7(_0x325eb1);});});}exports[_0x0207('0x14')]=function(_0x171122){var _0x91a3c2=this;return new Promise(function(_0x45bb5d,_0x179b79){return db[_0x0207('0x15')][_0x0207('0x16')]({'raw':_0x171122[_0x0207('0x17')]?_0x171122[_0x0207('0x17')][_0x0207('0x18')]===undefined?!![]:![]:!![],'where':_0x171122[_0x0207('0x17')]?_0x171122[_0x0207('0x17')][_0x0207('0x19')]||null:null,'attributes':_0x171122[_0x0207('0x17')]?_0x171122['options'][_0x0207('0x1a')]||null:null,'limit':_0x171122['options']?_0x171122[_0x0207('0x17')][_0x0207('0x1b')]||null:null,'include':_0x171122[_0x0207('0x17')]?_0x171122['options'][_0x0207('0x1c')]?_[_0x0207('0x1d')](_0x171122['options'][_0x0207('0x1c')],function(_0x11bb0f){return{'model':db[_0x11bb0f[_0x0207('0x1e')]],'as':_0x11bb0f['as'],'attributes':_0x11bb0f[_0x0207('0x1a')],'include':_0x11bb0f[_0x0207('0x1c')]?_['map'](_0x11bb0f[_0x0207('0x1c')],function(_0x4089f1){return{'model':db[_0x4089f1['model']],'as':_0x4089f1['as'],'attributes':_0x4089f1[_0x0207('0x1a')],'include':_0x4089f1['include']?_[_0x0207('0x1d')](_0x4089f1[_0x0207('0x1c')],function(_0x2e496f){return{'model':db[_0x2e496f['model']],'as':_0x2e496f['as'],'attributes':_0x2e496f[_0x0207('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0207('0x1f')](function(_0x1f6286){logger[_0x0207('0x9')](_0x0207('0x14'),_0x171122);logger['debug'](_0x0207('0x14'),_0x171122,JSON['stringify'](_0x1f6286));_0x45bb5d(_0x1f6286);})[_0x0207('0x13')](function(_0x873259){logger[_0x0207('0xf')]('GetMemberReport',_0x873259[_0x0207('0x11')],_0x171122);_0x179b79(_0x91a3c2['error'](0x1f4,_0x873259['message']));});});};exports[_0x0207('0x20')]=function(_0x43f2e6){var _0x3d0074=this;return new Promise(function(_0x3194ff,_0x445dce){return db['MemberReport'][_0x0207('0x21')](_0x43f2e6[_0x0207('0x22')],{'raw':_0x43f2e6[_0x0207('0x17')]?_0x43f2e6[_0x0207('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0207('0x1f')](function(_0x1ce120){logger[_0x0207('0x9')](_0x0207('0x20'),_0x43f2e6);logger[_0x0207('0xc')](_0x0207('0x20'),_0x43f2e6,JSON['stringify'](_0x1ce120));_0x3194ff(_0x1ce120);})['catch'](function(_0x55576d){logger['error'](_0x0207('0x20'),_0x55576d[_0x0207('0x11')],_0x43f2e6);_0x445dce(_0x3d0074[_0x0207('0xf')](0x1f4,_0x55576d[_0x0207('0x11')]));});});};exports['UpdateMemberReport']=function(_0x1ec05e){var _0x4f1e91=this;return new Promise(function(_0x558885,_0x226fc2){return db[_0x0207('0x15')][_0x0207('0x23')](_0x1ec05e[_0x0207('0x22')],{'raw':_0x1ec05e[_0x0207('0x17')]?_0x1ec05e[_0x0207('0x17')][_0x0207('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec05e['options']?_0x1ec05e[_0x0207('0x17')][_0x0207('0x19')]||null:null,'attributes':_0x1ec05e[_0x0207('0x17')]?_0x1ec05e[_0x0207('0x17')]['attributes']||null:null,'limit':_0x1ec05e['options']?_0x1ec05e['options'][_0x0207('0x1b')]||null:null})[_0x0207('0x1f')](function(_0x1f78fd){logger[_0x0207('0x9')]('UpdateMemberReport',_0x1ec05e);logger[_0x0207('0xc')](_0x0207('0x24'),_0x1ec05e,JSON[_0x0207('0xe')](_0x1f78fd));_0x558885(_0x1f78fd);})[_0x0207('0x13')](function(_0x49f8e6){logger['error'](_0x0207('0x24'),_0x49f8e6['message'],_0x1ec05e);_0x226fc2(_0x4f1e91['error'](0x1f4,_0x49f8e6[_0x0207('0x11')]));});});}; \ No newline at end of file +var _0x980e=['options','raw','where','attributes','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x13e048,_0x110a78){var _0x20affa=function(_0x13c748){while(--_0x13c748){_0x13e048['push'](_0x13e048['shift']());}};_0x20affa(++_0x110a78);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5825c1,_0xc47bdf,_0x27cc8c){return new BPromise(function(_0x3683df,_0x2d76d0){return client[_0xe980('0x6')](_0x5825c1,_0x27cc8c)['then'](function(_0xf9f019){logger[_0xe980('0x7')](_0xe980('0x8'),_0xc47bdf,'request\x20sent');logger[_0xe980('0x9')](_0xe980('0xa'),_0xc47bdf,_0xe980('0xb'),JSON[_0xe980('0xc')](_0xf9f019));if(_0xf9f019[_0xe980('0xd')]){if(_0xf9f019['error']['code']===0x1f4){logger['error'](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')]['message']);return _0x2d76d0(_0xf9f019['error'][_0xe980('0xe')]);}logger[_0xe980('0xd')](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);return _0x3683df(_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xc47bdf,'request\x20sent');_0x3683df(_0xf9f019[_0xe980('0xf')][_0xe980('0xe')]);}})[_0xe980('0x10')](function(_0x406418){logger[_0xe980('0xd')]('MemberReport,\x20%s,\x20%s',_0xc47bdf,_0x406418);_0x2d76d0(_0x406418);});});}exports[_0xe980('0x11')]=function(_0x1c6354){var _0x1ddb12=this;return new Promise(function(_0x538d32,_0x5aa2c1){return db[_0xe980('0x12')][_0xe980('0x13')]({'raw':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'where':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x16')]||null:null,'attributes':_0x1c6354['options']?_0x1c6354['options'][_0xe980('0x17')]||null:null,'limit':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['limit']||null:null,'include':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['include']?_[_0xe980('0x18')](_0x1c6354[_0xe980('0x14')][_0xe980('0x19')],function(_0x4b7888){return{'model':db[_0x4b7888[_0xe980('0x1a')]],'as':_0x4b7888['as'],'attributes':_0x4b7888['attributes'],'include':_0x4b7888[_0xe980('0x19')]?_[_0xe980('0x18')](_0x4b7888[_0xe980('0x19')],function(_0x40a34e){return{'model':db[_0x40a34e['model']],'as':_0x40a34e['as'],'attributes':_0x40a34e[_0xe980('0x17')],'include':_0x40a34e[_0xe980('0x19')]?_[_0xe980('0x18')](_0x40a34e['include'],function(_0x54e755){return{'model':db[_0x54e755[_0xe980('0x1a')]],'as':_0x54e755['as'],'attributes':_0x54e755[_0xe980('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f2fe){logger['info'](_0xe980('0x11'),_0x1c6354);logger[_0xe980('0x9')](_0xe980('0x11'),_0x1c6354,JSON[_0xe980('0xc')](_0x16f2fe));_0x538d32(_0x16f2fe);})[_0xe980('0x10')](function(_0x43a7c2){logger['error'](_0xe980('0x11'),_0x43a7c2['message'],_0x1c6354);_0x5aa2c1(_0x1ddb12[_0xe980('0xd')](0x1f4,_0x43a7c2[_0xe980('0xe')]));});});};exports[_0xe980('0x1b')]=function(_0x38ab6d){var _0x2a9ea2=this;return new Promise(function(_0x56fbf7,_0x4bf013){return db[_0xe980('0x12')][_0xe980('0x1c')](_0x38ab6d[_0xe980('0x1d')],{'raw':_0x38ab6d[_0xe980('0x14')]?_0x38ab6d[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![]})[_0xe980('0x1e')](function(_0x369c3a){logger[_0xe980('0x7')](_0xe980('0x1b'),_0x38ab6d);logger[_0xe980('0x9')]('CreateMemberReport',_0x38ab6d,JSON['stringify'](_0x369c3a));_0x56fbf7(_0x369c3a);})[_0xe980('0x10')](function(_0x4702e0){logger[_0xe980('0xd')]('CreateMemberReport',_0x4702e0[_0xe980('0xe')],_0x38ab6d);_0x4bf013(_0x2a9ea2[_0xe980('0xd')](0x1f4,_0x4702e0[_0xe980('0xe')]));});});};exports[_0xe980('0x1f')]=function(_0x163db9){var _0x44686a=this;return new Promise(function(_0x1811b3,_0x36ab72){return db[_0xe980('0x12')][_0xe980('0x20')](_0x163db9['body'],{'raw':_0x163db9['options']?_0x163db9[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163db9['options']?_0x163db9[_0xe980('0x14')]['where']||null:null,'attributes':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x17')]||null:null,'limit':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x21')]||null:null})['then'](function(_0x11fb5b){logger[_0xe980('0x7')](_0xe980('0x1f'),_0x163db9);logger[_0xe980('0x9')](_0xe980('0x1f'),_0x163db9,JSON['stringify'](_0x11fb5b));_0x1811b3(_0x11fb5b);})[_0xe980('0x10')](function(_0x1f35ed){logger[_0xe980('0xd')]('UpdateMemberReport',_0x1f35ed[_0xe980('0xe')],_0x163db9);_0x36ab72(_0x44686a['error'](0x1f4,_0x1f35ed[_0xe980('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 842160a..25c5bef 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 _0xde74=['fs-extra','../../components/auth/service','../../config/environment','get','index','exports','multer','util','path','Router'];(function(_0x37a699,_0x39528c){var _0x40ebae=function(_0x4090e6){while(--_0x4090e6){_0x37a699['push'](_0x37a699['shift']());}};_0x40ebae(++_0x39528c);}(_0xde74,0x1c8));var _0x4de7=function(_0x1db7a2,_0x37fc85){_0x1db7a2=_0x1db7a2-0x0;var _0x1d88a8=_0xde74[_0x1db7a2];return _0x1d88a8;};'use strict';var multer=require(_0x4de7('0x0'));var util=require(_0x4de7('0x1'));var path=require(_0x4de7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4de7('0x3')]();var fs_extra=require(_0x4de7('0x4'));var auth=require(_0x4de7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4de7('0x6'));var controller=require('./migration.controller');router[_0x4de7('0x7')]('/',controller[_0x4de7('0x8')]);module[_0x4de7('0x9')]=router; \ No newline at end of file +var _0x869c=['./migration.controller','get','index','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x39ae1e,_0x38d749){var _0x298d1f=function(_0x1d6aad){while(--_0x1d6aad){_0x39ae1e['push'](_0x39ae1e['shift']());}};_0x298d1f(++_0x38d749);}(_0x869c,0x1bb));var _0xc869=function(_0x184d86,_0x180b98){_0x184d86=_0x184d86-0x0;var _0x4f3c4e=_0x869c[_0x184d86];return _0x4f3c4e;};'use strict';var multer=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var path=require('path');var timeout=require(_0xc869('0x2'));var express=require(_0xc869('0x3'));var router=express[_0xc869('0x4')]();var fs_extra=require(_0xc869('0x5'));var auth=require(_0xc869('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc869('0x7'));var controller=require(_0xc869('0x8'));router[_0xc869('0x9')]('/',controller[_0xc869('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 1a2a6e1..66e7372 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78e0=['exports','STRING','version','sequelize'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x78e0,0x10b));var _0x078e=function(_0x5cfdd8,_0x27555c){_0x5cfdd8=_0x5cfdd8-0x0;var _0x4fd729=_0x78e0[_0x5cfdd8];return _0x4fd729;};'use strict';var Sequelize=require(_0x078e('0x0'));module[_0x078e('0x1')]={'version':{'type':Sequelize[_0x078e('0x2')],'unique':_0x078e('0x3')}}; \ No newline at end of file +var _0xf63f=['exports','version','sequelize'];(function(_0x7d2272,_0x41f365){var _0x5bc56e=function(_0x3974af){while(--_0x3974af){_0x7d2272['push'](_0x7d2272['shift']());}};_0x5bc56e(++_0x41f365);}(_0xf63f,0xfe));var _0xff63=function(_0x5d70d5,_0x1eab50){_0x5d70d5=_0x5d70d5-0x0;var _0x29828c=_0xf63f[_0x5d70d5];return _0x29828c;};'use strict';var Sequelize=require(_0xff63('0x0'));module[_0xff63('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xff63('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7153de5..8621f86 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 _0x6c82=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','stack','send','index','map','Migration','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x405e2d,_0x536e23){var _0x11bedd=function(_0x19be30){while(--_0x19be30){_0x405e2d['push'](_0x405e2d['shift']());}};_0x11bedd(++_0x536e23);}(_0x6c82,0x8b));var _0x26c8=function(_0x66be85,_0x3bae6d){_0x66be85=_0x66be85-0x0;var _0x3640e4=_0x6c82[_0x66be85];return _0x3640e4;};'use strict';var emlformat=require(_0x26c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26c8('0x1'));var jsonpatch=require(_0x26c8('0x2'));var rp=require(_0x26c8('0x3'));var moment=require('moment');var BPromise=require(_0x26c8('0x4'));var Mustache=require(_0x26c8('0x5'));var util=require('util');var path=require(_0x26c8('0x6'));var sox=require(_0x26c8('0x7'));var csv=require(_0x26c8('0x8'));var ejs=require(_0x26c8('0x9'));var fs=require('fs');var fs_extra=require(_0x26c8('0xa'));var _=require(_0x26c8('0xb'));var squel=require(_0x26c8('0xc'));var crypto=require('crypto');var jsforce=require(_0x26c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x26c8('0x8'));var querystring=require(_0x26c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x26c8('0xf'));var authService=require(_0x26c8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x26c8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26c8('0x12'));var utils=require(_0x26c8('0x13'));var config=require(_0x26c8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4670aa,_0x4c9a84){_0x4c9a84=_0x4c9a84||0xcc;return function(_0x247a04){if(_0x247a04){return _0x4670aa[_0x26c8('0x15')](_0x4c9a84);}return _0x4670aa[_0x26c8('0x16')](_0x4c9a84)[_0x26c8('0x17')]();};}function respondWithResult(_0x364e30,_0x420637){_0x420637=_0x420637||0xc8;return function(_0x4d8af1){if(_0x4d8af1){return _0x364e30['status'](_0x420637)['json'](_0x4d8af1);}};}function respondWithFilteredResult(_0x1e10da,_0xa2fc82){return function(_0x2e8674){if(_0x2e8674){var _0x13ea95=typeof _0xa2fc82[_0x26c8('0x18')]===_0x26c8('0x19')&&typeof _0xa2fc82[_0x26c8('0x1a')]===_0x26c8('0x19');var _0x176692=_0x2e8674['count'];var _0x486701=_0x13ea95?0x0:_0xa2fc82[_0x26c8('0x18')];var _0x51b974=_0x13ea95?_0x2e8674[_0x26c8('0x1b')]:_0xa2fc82['offset']+_0xa2fc82[_0x26c8('0x1a')];var _0x4c532a;if(_0x51b974>=_0x176692){_0x51b974=_0x176692;_0x4c532a=0xc8;}else{_0x4c532a=0xce;}_0x1e10da[_0x26c8('0x16')](_0x4c532a);return _0x1e10da[_0x26c8('0x1c')]('Content-Range',_0x486701+'-'+_0x51b974+'/'+_0x176692)[_0x26c8('0x1d')](_0x2e8674);}return null;};}function patchUpdates(_0x46f62d){return function(_0x571580){try{jsonpatch[_0x26c8('0x1e')](_0x571580,_0x46f62d,!![]);}catch(_0x349ba6){return BPromise['reject'](_0x349ba6);}return _0x571580['save']();};}function saveUpdates(_0x4f77c1,_0x2e36a4){return function(_0x56bb8d){if(_0x56bb8d){return _0x56bb8d[_0x26c8('0x1f')](_0x4f77c1)[_0x26c8('0x20')](function(_0x152319){return _0x152319;});}return null;};}function removeEntity(_0x3255d8,_0x35e770){return function(_0x43527d){if(_0x43527d){return _0x43527d[_0x26c8('0x21')]()[_0x26c8('0x20')](function(){_0x3255d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x173267,_0x2078b0){return function(_0x30e99a){if(!_0x30e99a){_0x173267['sendStatus'](0x194);}return _0x30e99a;};}function handleError(_0x44b848,_0x5f2056){_0x5f2056=_0x5f2056||0x1f4;return function(_0x2dc14b){logger[_0x26c8('0x22')](_0x2dc14b[_0x26c8('0x23')]);if(_0x2dc14b['name']){delete _0x2dc14b['name'];}_0x44b848[_0x26c8('0x16')](_0x5f2056)[_0x26c8('0x24')](_0x2dc14b);};}exports[_0x26c8('0x25')]=function(_0x177062,_0x1afa5){var _0x230f5f={},_0x49ea19={},_0x55276d={'count':0x0,'rows':[]};var _0x4c05a9=_[_0x26c8('0x26')](db[_0x26c8('0x27')][_0x26c8('0x28')],function(_0x6c7b1f){return{'name':_0x6c7b1f[_0x26c8('0x29')],'type':_0x6c7b1f[_0x26c8('0x2a')]['key']};});_0x49ea19['model']=_[_0x26c8('0x26')](_0x4c05a9,_0x26c8('0x2b'));_0x49ea19['query']=_['keys'](_0x177062[_0x26c8('0x2c')]);_0x49ea19[_0x26c8('0x2d')]=_[_0x26c8('0x2e')](_0x49ea19[_0x26c8('0x2f')],_0x49ea19[_0x26c8('0x2c')]);_0x230f5f[_0x26c8('0x30')]=_[_0x26c8('0x2e')](_0x49ea19[_0x26c8('0x2f')],qs[_0x26c8('0x31')](_0x177062[_0x26c8('0x2c')][_0x26c8('0x31')]));_0x230f5f[_0x26c8('0x30')]=_0x230f5f[_0x26c8('0x30')]['length']?_0x230f5f[_0x26c8('0x30')]:_0x49ea19[_0x26c8('0x2f')];if(!_0x177062[_0x26c8('0x2c')][_0x26c8('0x32')](_0x26c8('0x33'))){_0x230f5f[_0x26c8('0x1a')]=qs[_0x26c8('0x1a')](_0x177062[_0x26c8('0x2c')][_0x26c8('0x1a')]);_0x230f5f[_0x26c8('0x18')]=qs[_0x26c8('0x18')](_0x177062[_0x26c8('0x2c')][_0x26c8('0x18')]);}_0x230f5f[_0x26c8('0x34')]=qs['sort'](_0x177062[_0x26c8('0x2c')][_0x26c8('0x35')]);_0x230f5f[_0x26c8('0x36')]=qs[_0x26c8('0x2d')](_[_0x26c8('0x37')](_0x177062[_0x26c8('0x2c')],_0x49ea19[_0x26c8('0x2d')]),_0x4c05a9);if(_0x177062[_0x26c8('0x2c')][_0x26c8('0x38')]){_0x230f5f[_0x26c8('0x36')]=_[_0x26c8('0x39')](_0x230f5f[_0x26c8('0x36')],{'$or':_[_0x26c8('0x26')](_0x4c05a9,function(_0x5aa6a8){if(_0x5aa6a8[_0x26c8('0x2a')]!=='VIRTUAL'){var _0x4fde31={};_0x4fde31[_0x5aa6a8[_0x26c8('0x2b')]]={'$like':'%'+_0x177062['query'][_0x26c8('0x38')]+'%'};return _0x4fde31;}})});}_0x230f5f=_[_0x26c8('0x39')]({},_0x230f5f,_0x177062[_0x26c8('0x3a')]);var _0x13c168={'where':_0x230f5f['where']};return db[_0x26c8('0x27')][_0x26c8('0x1b')](_0x13c168)[_0x26c8('0x20')](function(_0x2dc474){_0x55276d['count']=_0x2dc474;if(_0x177062[_0x26c8('0x2c')][_0x26c8('0x3b')]){_0x230f5f[_0x26c8('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x26c8('0x3d')](_0x230f5f);})[_0x26c8('0x20')](function(_0x470945){_0x55276d[_0x26c8('0x3e')]=_0x470945;return _0x55276d;})[_0x26c8('0x20')](respondWithFilteredResult(_0x1afa5,_0x230f5f))[_0x26c8('0x3f')](handleError(_0x1afa5,null));}; \ No newline at end of file +var _0xe351=['name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','pick','VIRTUAL','filter','includeAll','include','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','status','json','offset','limit','count','reject','save','then','end','stack'];(function(_0x1100e4,_0x3edf36){var _0x14024c=function(_0x11f629){while(--_0x11f629){_0x1100e4['push'](_0x1100e4['shift']());}};_0x14024c(++_0x3edf36);}(_0xe351,0x92));var _0x1e35=function(_0x30c76f,_0x172ce0){_0x30c76f=_0x30c76f-0x0;var _0x13d693=_0xe351[_0x30c76f];return _0x13d693;};'use strict';var emlformat=require(_0x1e35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e35('0x2'));var moment=require(_0x1e35('0x3'));var BPromise=require(_0x1e35('0x4'));var Mustache=require(_0x1e35('0x5'));var util=require(_0x1e35('0x6'));var path=require(_0x1e35('0x7'));var sox=require(_0x1e35('0x8'));var csv=require(_0x1e35('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e35('0xa'));var _=require(_0x1e35('0xb'));var squel=require(_0x1e35('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e35('0xd'));var deskjs=require(_0x1e35('0xe'));var toCsv=require(_0x1e35('0x9'));var querystring=require('querystring');var Papa=require(_0x1e35('0xf'));var Redis=require(_0x1e35('0x10'));var authService=require(_0x1e35('0x11'));var qs=require(_0x1e35('0x12'));var as=require(_0x1e35('0x13'));var hardwareService=require(_0x1e35('0x14'));var logger=require(_0x1e35('0x15'))('api');var utils=require(_0x1e35('0x16'));var config=require(_0x1e35('0x17'));var licenseUtil=require(_0x1e35('0x18'));var db=require(_0x1e35('0x19'))['db'];function respondWithStatusCode(_0x531cb0,_0x57b735){_0x57b735=_0x57b735||0xcc;return function(_0x41f7fc){if(_0x41f7fc){return _0x531cb0[_0x1e35('0x1a')](_0x57b735);}return _0x531cb0[_0x1e35('0x1b')](_0x57b735)['end']();};}function respondWithResult(_0x4034fd,_0x418113){_0x418113=_0x418113||0xc8;return function(_0x171dae){if(_0x171dae){return _0x4034fd[_0x1e35('0x1b')](_0x418113)[_0x1e35('0x1c')](_0x171dae);}};}function respondWithFilteredResult(_0x45d0df,_0x403662){return function(_0x47d1ac){if(_0x47d1ac){var _0x2229bb=typeof _0x403662[_0x1e35('0x1d')]==='undefined'&&typeof _0x403662[_0x1e35('0x1e')]==='undefined';var _0x477082=_0x47d1ac[_0x1e35('0x1f')];var _0x403686=_0x2229bb?0x0:_0x403662[_0x1e35('0x1d')];var _0x5190eb=_0x2229bb?_0x47d1ac[_0x1e35('0x1f')]:_0x403662[_0x1e35('0x1d')]+_0x403662[_0x1e35('0x1e')];var _0x309e9c;if(_0x5190eb>=_0x477082){_0x5190eb=_0x477082;_0x309e9c=0xc8;}else{_0x309e9c=0xce;}_0x45d0df[_0x1e35('0x1b')](_0x309e9c);return _0x45d0df['set']('Content-Range',_0x403686+'-'+_0x5190eb+'/'+_0x477082)[_0x1e35('0x1c')](_0x47d1ac);}return null;};}function patchUpdates(_0x6be620){return function(_0x684217){try{jsonpatch['apply'](_0x684217,_0x6be620,!![]);}catch(_0x46aad4){return BPromise[_0x1e35('0x20')](_0x46aad4);}return _0x684217[_0x1e35('0x21')]();};}function saveUpdates(_0x5e5ce6,_0x213963){return function(_0x15de3e){if(_0x15de3e){return _0x15de3e['update'](_0x5e5ce6)['then'](function(_0x172365){return _0x172365;});}return null;};}function removeEntity(_0x30e36f,_0x18a20e){return function(_0x151265){if(_0x151265){return _0x151265['destroy']()[_0x1e35('0x22')](function(){_0x30e36f[_0x1e35('0x1b')](0xcc)[_0x1e35('0x23')]();});}};}function handleEntityNotFound(_0x5ce896,_0x41a1fb){return function(_0x2d7974){if(!_0x2d7974){_0x5ce896['sendStatus'](0x194);}return _0x2d7974;};}function handleError(_0x22e1ca,_0x54f974){_0x54f974=_0x54f974||0x1f4;return function(_0x2a5ba8){logger['error'](_0x2a5ba8[_0x1e35('0x24')]);if(_0x2a5ba8[_0x1e35('0x25')]){delete _0x2a5ba8[_0x1e35('0x25')];}_0x22e1ca[_0x1e35('0x1b')](_0x54f974)[_0x1e35('0x26')](_0x2a5ba8);};}exports[_0x1e35('0x27')]=function(_0x528caf,_0x4da2b7){var _0xaf4c88={},_0x30b785={},_0x352967={'count':0x0,'rows':[]};var _0xafb578=_[_0x1e35('0x28')](db[_0x1e35('0x29')][_0x1e35('0x2a')],function(_0x1bfffe){return{'name':_0x1bfffe[_0x1e35('0x2b')],'type':_0x1bfffe[_0x1e35('0x2c')][_0x1e35('0x2d')]};});_0x30b785[_0x1e35('0x2e')]=_[_0x1e35('0x28')](_0xafb578,_0x1e35('0x25'));_0x30b785[_0x1e35('0x2f')]=_['keys'](_0x528caf[_0x1e35('0x2f')]);_0x30b785[_0x1e35('0x30')]=_['intersection'](_0x30b785['model'],_0x30b785[_0x1e35('0x2f')]);_0xaf4c88['attributes']=_[_0x1e35('0x31')](_0x30b785['model'],qs[_0x1e35('0x32')](_0x528caf['query'][_0x1e35('0x32')]));_0xaf4c88[_0x1e35('0x33')]=_0xaf4c88['attributes'][_0x1e35('0x34')]?_0xaf4c88['attributes']:_0x30b785[_0x1e35('0x2e')];if(!_0x528caf[_0x1e35('0x2f')]['hasOwnProperty']('nolimit')){_0xaf4c88[_0x1e35('0x1e')]=qs[_0x1e35('0x1e')](_0x528caf[_0x1e35('0x2f')]['limit']);_0xaf4c88[_0x1e35('0x1d')]=qs[_0x1e35('0x1d')](_0x528caf[_0x1e35('0x2f')][_0x1e35('0x1d')]);}_0xaf4c88['order']=qs['sort'](_0x528caf['query'][_0x1e35('0x35')]);_0xaf4c88[_0x1e35('0x36')]=qs['filters'](_[_0x1e35('0x37')](_0x528caf[_0x1e35('0x2f')],_0x30b785[_0x1e35('0x30')]),_0xafb578);if(_0x528caf[_0x1e35('0x2f')]['filter']){_0xaf4c88[_0x1e35('0x36')]=_['merge'](_0xaf4c88[_0x1e35('0x36')],{'$or':_['map'](_0xafb578,function(_0x1da7bd){if(_0x1da7bd['type']!==_0x1e35('0x38')){var _0x5772f6={};_0x5772f6[_0x1da7bd['name']]={'$like':'%'+_0x528caf['query'][_0x1e35('0x39')]+'%'};return _0x5772f6;}})});}_0xaf4c88=_['merge']({},_0xaf4c88,_0x528caf['options']);var _0x222cd1={'where':_0xaf4c88['where']};return db[_0x1e35('0x29')]['count'](_0x222cd1)['then'](function(_0x2b8aed){_0x352967[_0x1e35('0x1f')]=_0x2b8aed;if(_0x528caf[_0x1e35('0x2f')][_0x1e35('0x3a')]){_0xaf4c88[_0x1e35('0x3b')]=[{'all':!![]}];}return db[_0x1e35('0x29')]['findAll'](_0xaf4c88);})[_0x1e35('0x22')](function(_0x39ba8d){_0x352967['rows']=_0x39ba8d;return _0x352967;})[_0x1e35('0x22')](respondWithFilteredResult(_0x4da2b7,_0xaf4c88))[_0x1e35('0x3c')](handleError(_0x4da2b7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8b0ecf0..b537c73 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 _0xda13=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Migration'];(function(_0x14e52d,_0x425db8){var _0x590ddb=function(_0x537760){while(--_0x537760){_0x14e52d['push'](_0x14e52d['shift']());}};_0x590ddb(++_0x425db8);}(_0xda13,0xfa));var _0x3da1=function(_0x449b54,_0x3776f3){_0x449b54=_0x449b54-0x0;var _0x32d6b9=_0xda13[_0x449b54];return _0x32d6b9;};'use strict';var _=require('lodash');var util=require(_0x3da1('0x0'));var logger=require('../../config/logger')(_0x3da1('0x1'));var moment=require(_0x3da1('0x2'));var BPromise=require(_0x3da1('0x3'));var rp=require(_0x3da1('0x4'));var fs=require('fs');var path=require(_0x3da1('0x5'));var rimraf=require(_0x3da1('0x6'));var config=require(_0x3da1('0x7'));var attributes=require('./migration.attributes');module[_0x3da1('0x8')]=function(_0x4a9f2f,_0x3940d1){return _0x4a9f2f['define'](_0x3da1('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f3=['api','bluebird','request-promise','rimraf','./migration.attributes','Migration','util','../../config/logger'];(function(_0x19e5b1,_0x45c7d5){var _0x3597dc=function(_0x4e9add){while(--_0x4e9add){_0x19e5b1['push'](_0x19e5b1['shift']());}};_0x3597dc(++_0x45c7d5);}(_0xd1f3,0x156));var _0x3d1f=function(_0x2f603c,_0x2564c4){_0x2f603c=_0x2f603c-0x0;var _0x2da2ed=_0xd1f3[_0x2f603c];return _0x2da2ed;};'use strict';var _=require('lodash');var util=require(_0x3d1f('0x0'));var logger=require(_0x3d1f('0x1'))(_0x3d1f('0x2'));var moment=require('moment');var BPromise=require(_0x3d1f('0x3'));var rp=require(_0x3d1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d1f('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d1f('0x6'));module['exports']=function(_0xfa7bf9,_0x2c1b73){return _0xfa7bf9['define'](_0x3d1f('0x7'),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 f62baf7..b3db7d2 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 _0x0834=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x0834,0x18e));var _0x4083=function(_0x2e7b27,_0x522864){_0x2e7b27=_0x2e7b27-0x0;var _0x41039c=_0x0834[_0x2e7b27];return _0x41039c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('Migration,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});} \ No newline at end of file +var _0xbf5c=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s'];(function(_0x172ba9,_0x2b4278){var _0x510713=function(_0x7c0a4b){while(--_0x7c0a4b){_0x172ba9['push'](_0x172ba9['shift']());}};_0x510713(++_0x2b4278);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x5c7975,_0xa80f8f){_0x5c7975=_0x5c7975-0x0;var _0x5c1b26=_0xbf5c[_0x5c7975];return _0x5c1b26;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522014,_0x4504dd,_0x31b6d1){return new BPromise(function(_0x54d2d4,_0x52f784){return client[_0xcbf5('0xb')](_0x522014,_0x31b6d1)[_0xcbf5('0xc')](function(_0x230a6c){logger['info'](_0xcbf5('0xd'),_0x4504dd,_0xcbf5('0xe'));logger[_0xcbf5('0xf')](_0xcbf5('0x10'),_0x4504dd,_0xcbf5('0xe'),JSON[_0xcbf5('0x11')](_0x230a6c));if(_0x230a6c['error']){if(_0x230a6c[_0xcbf5('0x12')][_0xcbf5('0x13')]===0x1f4){logger[_0xcbf5('0x12')]('Migration,\x20%s,\x20%s',_0x4504dd,_0x230a6c['error'][_0xcbf5('0x14')]);return _0x52f784(_0x230a6c['error'][_0xcbf5('0x14')]);}logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x230a6c[_0xcbf5('0x12')]['message']);return _0x54d2d4(_0x230a6c['error'][_0xcbf5('0x14')]);}else{logger['info'](_0xcbf5('0xd'),_0x4504dd,'request\x20sent');_0x54d2d4(_0x230a6c['result'][_0xcbf5('0x14')]);}})[_0xcbf5('0x15')](function(_0x18753e){logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x18753e);_0x52f784(_0x18753e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 781f523..1e92b2e 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 _0x7b77=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x52661f,_0x534196){var _0x3d4127=function(_0x26f436){while(--_0x26f436){_0x52661f['push'](_0x52661f['shift']());}};_0x3d4127(++_0x534196);}(_0x7b77,0x179));var _0x77b7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7b77[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var path=require(_0x77b7('0x2'));var timeout=require(_0x77b7('0x3'));var express=require('express');var router=express[_0x77b7('0x4')]();var fs_extra=require(_0x77b7('0x5'));var auth=require(_0x77b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77b7('0x7'));var controller=require(_0x77b7('0x8'));router[_0x77b7('0x9')]('/',auth[_0x77b7('0xa')](),controller[_0x77b7('0xb')]);router[_0x77b7('0x9')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0xc')]);router[_0x77b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x77b7('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x77b7('0xf')]);router[_0x77b7('0x10')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0x11')]);module[_0x77b7('0x12')]=router; \ No newline at end of file +var _0x87b4=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x87b4,0xaa));var _0x487b=function(_0x2063e6,_0x28df57){_0x2063e6=_0x2063e6-0x0;var _0x63f89d=_0x87b4[_0x2063e6];return _0x63f89d;};'use strict';var multer=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var path=require(_0x487b('0x2'));var timeout=require('connect-timeout');var express=require(_0x487b('0x3'));var router=express['Router']();var fs_extra=require(_0x487b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x487b('0x5'));var config=require('../../config/environment');var controller=require(_0x487b('0x6'));router[_0x487b('0x7')]('/',auth[_0x487b('0x8')](),controller[_0x487b('0x9')]);router[_0x487b('0x7')](_0x487b('0xa'),auth[_0x487b('0x8')](),controller[_0x487b('0xb')]);router[_0x487b('0xc')]('/',auth[_0x487b('0x8')](),controller[_0x487b('0xd')]);router[_0x487b('0xe')]('/:id',auth[_0x487b('0x8')](),controller[_0x487b('0xf')]);router[_0x487b('0x10')](_0x487b('0xa'),auth[_0x487b('0x8')](),controller[_0x487b('0x11')]);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 e3a960f..ae798e2 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 _0x7915=['exports','ENUM','localnet','externip','stun','STRING'];(function(_0x3095ef,_0x11a3cb){var _0x3f36a1=function(_0x1c20f9){while(--_0x1c20f9){_0x3095ef['push'](_0x3095ef['shift']());}};_0x3f36a1(++_0x11a3cb);}(_0x7915,0x198));var _0x5791=function(_0x4cf88d,_0x5de590){_0x4cf88d=_0x4cf88d-0x0;var _0x1f49c0=_0x7915[_0x4cf88d];return _0x1f49c0;};'use strict';var Sequelize=require('sequelize');module[_0x5791('0x0')]={'type':{'type':Sequelize[_0x5791('0x1')](_0x5791('0x2'),_0x5791('0x3'),_0x5791('0x4'),'turn')},'value':{'type':Sequelize[_0x5791('0x5')]},'username':{'type':Sequelize[_0x5791('0x5')]},'password':{'type':Sequelize[_0x5791('0x5')]}}; \ No newline at end of file +var _0xd75a=['exports','ENUM','localnet','stun','turn','STRING'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xd75a,0x162));var _0xad75=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd75a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xad75('0x0')]={'type':{'type':Sequelize[_0xad75('0x1')](_0xad75('0x2'),'externip',_0xad75('0x3'),_0xad75('0x4'))},'value':{'type':Sequelize[_0xad75('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xad75('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 443efd0..f5df5dd 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 _0xe563=['Reload','res_stun_monitor.so','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','params','server/files/templates/turn_multiple.ejs','TURN','toLowerCase','util','path','ejs','lodash','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Network,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','Network','rows','show','include','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0x3bc9b9,_0x2d22a4){var _0x17d53e=function(_0x76fa4d){while(--_0x76fa4d){_0x3bc9b9['push'](_0x3bc9b9['shift']());}};_0x17d53e(++_0x2d22a4);}(_0xe563,0x1bb));var _0x3e56=function(_0x328159,_0x41aba4){_0x328159=_0x328159-0x0;var _0x251e77=_0xe563[_0x328159];return _0x251e77;};'use strict';var util=require(_0x3e56('0x0'));var path=require(_0x3e56('0x1'));var ejs=require(_0x3e56('0x2'));var fs=require('fs');var _=require(_0x3e56('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x3e56('0x4'));var db=require(_0x3e56('0x5'))['db'];var jayson=require(_0x3e56('0x6'));var client=jayson[_0x3e56('0x7')][_0x3e56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc04704,_0xe6a7fe,_0x29dedf,_0x3d40b2){return new Promise(function(_0xea318b,_0x21b7cf){var _0x40d575=_0x3d40b2||client;return _0x40d575[_0x3e56('0x9')](_0xc04704,_0x29dedf)[_0x3e56('0xa')](function(_0x1b7124){logger[_0x3e56('0xb')]('Network,\x20%s,\x20%s',_0xe6a7fe,'request\x20sent');logger[_0x3e56('0xc')](_0x3e56('0xd'),_0xe6a7fe,_0x3e56('0xe'),JSON['stringify'](_0x1b7124));if(_0x1b7124[_0x3e56('0xf')]){if(_0x1b7124[_0x3e56('0xf')][_0x3e56('0x10')]===0x1f4){logger[_0x3e56('0xf')](_0x3e56('0x11'),_0xe6a7fe,_0x1b7124[_0x3e56('0xf')][_0x3e56('0x12')]);return _0x21b7cf(_0x1b7124[_0x3e56('0xf')][_0x3e56('0x12')]);}logger[_0x3e56('0xf')](_0x3e56('0x11'),_0xe6a7fe,_0x1b7124[_0x3e56('0xf')]['message']);return _0xea318b(_0x1b7124[_0x3e56('0xf')]['message']);}else{logger[_0x3e56('0xb')]('Network,\x20%s,\x20%s',_0xe6a7fe,'request\x20sent');_0xea318b(_0x1b7124[_0x3e56('0x13')][_0x3e56('0x12')]);}})[_0x3e56('0x14')](function(_0x1eda76){logger[_0x3e56('0xf')](_0x3e56('0x11'),_0xe6a7fe,_0x1eda76);_0x21b7cf(_0x1eda76);});});}function respondWithResult(_0x5afa8c,_0x1fd09f){_0x1fd09f=_0x1fd09f||0xc8;return function(_0x14ac78){if(_0x14ac78){return _0x5afa8c[_0x3e56('0x15')](_0x1fd09f)['json'](_0x14ac78);}};}function respondWithFilteredResult(_0x114473,_0x869674){return function(_0x442353){if(_0x442353){var _0x546776=typeof _0x869674['offset']===_0x3e56('0x16')&&typeof _0x869674[_0x3e56('0x17')]===_0x3e56('0x16');var _0x325922=_0x442353[_0x3e56('0x18')];var _0x50f0c8=_0x546776?0x0:_0x869674['offset'];var _0x43fee9=_0x546776?_0x442353[_0x3e56('0x18')]:_0x869674[_0x3e56('0x19')]+_0x869674['limit'];var _0x42a2e0;if(_0x43fee9>=_0x325922){_0x43fee9=_0x325922;_0x42a2e0=0xc8;}else{_0x42a2e0=0xce;}_0x114473[_0x3e56('0x15')](_0x42a2e0);return _0x114473['set'](_0x3e56('0x1a'),_0x50f0c8+'-'+_0x43fee9+'/'+_0x325922)['json'](_0x442353);}return null;};}function saveUpdates(_0x4f90b9){return function(_0x173fa8){if(_0x173fa8){return _0x173fa8[_0x3e56('0x1b')](_0x4f90b9)[_0x3e56('0xa')](function(_0x3662cf){return _0x3662cf;});}return null;};}function removeEntity(_0xe8ddf7){return function(_0x223844){if(_0x223844){return _0x223844[_0x3e56('0x1c')]()['then'](function(){_0xe8ddf7[_0x3e56('0x15')](0xcc)[_0x3e56('0x1d')]();});}};}function handleEntityNotFound(_0x15d056){return function(_0x5c1f9c){if(!_0x5c1f9c){_0x15d056[_0x3e56('0x1e')](0x194);}return _0x5c1f9c;};}function handleError(_0x2f03c5,_0x2bfa0c){_0x2bfa0c=_0x2bfa0c||0x1f4;return function(_0x3b45e7){logger[_0x3e56('0xf')](_0x3b45e7[_0x3e56('0x1f')]);if(_0x3b45e7[_0x3e56('0x20')]){delete _0x3b45e7['name'];}_0x2f03c5[_0x3e56('0x15')](_0x2bfa0c)[_0x3e56('0x21')](_0x3b45e7);};}exports[_0x3e56('0x22')]=function(_0x306e71,_0x5f4975){var _0x22a978={},_0x3227fb={},_0x105a71={'count':0x0,'rows':[]};var _0x114d6a=_[_0x3e56('0x23')](db['Network'][_0x3e56('0x24')],function(_0x50d23f){return{'name':_0x50d23f[_0x3e56('0x25')],'type':_0x50d23f[_0x3e56('0x26')][_0x3e56('0x27')]};});_0x3227fb['model']=_[_0x3e56('0x23')](_0x114d6a,_0x3e56('0x20'));_0x3227fb[_0x3e56('0x28')]=_[_0x3e56('0x29')](_0x306e71[_0x3e56('0x28')]);_0x3227fb[_0x3e56('0x2a')]=_[_0x3e56('0x2b')](_0x3227fb[_0x3e56('0x2c')],_0x3227fb[_0x3e56('0x28')]);_0x22a978['attributes']=_[_0x3e56('0x2b')](_0x3227fb[_0x3e56('0x2c')],qs[_0x3e56('0x2d')](_0x306e71['query']['fields']));_0x22a978[_0x3e56('0x2e')]=_0x22a978[_0x3e56('0x2e')][_0x3e56('0x2f')]?_0x22a978[_0x3e56('0x2e')]:_0x3227fb['model'];if(!_0x306e71['query'][_0x3e56('0x30')](_0x3e56('0x31'))){_0x22a978[_0x3e56('0x17')]=qs[_0x3e56('0x17')](_0x306e71[_0x3e56('0x28')][_0x3e56('0x17')]);_0x22a978[_0x3e56('0x19')]=qs[_0x3e56('0x19')](_0x306e71[_0x3e56('0x28')]['offset']);}_0x22a978['order']=qs[_0x3e56('0x32')](_0x306e71[_0x3e56('0x28')][_0x3e56('0x32')]);_0x22a978[_0x3e56('0x33')]=qs[_0x3e56('0x2a')](_['pick'](_0x306e71[_0x3e56('0x28')],_0x3227fb[_0x3e56('0x2a')]),_0x114d6a);if(_0x306e71[_0x3e56('0x28')][_0x3e56('0x34')]){_0x22a978[_0x3e56('0x33')]=_[_0x3e56('0x35')](_0x22a978[_0x3e56('0x33')],{'$or':_[_0x3e56('0x23')](_0x114d6a,function(_0x598bda){if(_0x598bda['type']!==_0x3e56('0x36')){var _0x5b61d1={};_0x5b61d1[_0x598bda[_0x3e56('0x20')]]={'$like':'%'+_0x306e71[_0x3e56('0x28')][_0x3e56('0x34')]+'%'};return _0x5b61d1;}})});}_0x22a978=_['merge']({},_0x22a978,_0x306e71[_0x3e56('0x37')]);var _0x58bf8f={'where':_0x22a978[_0x3e56('0x33')]};return db['Network'][_0x3e56('0x18')](_0x58bf8f)[_0x3e56('0xa')](function(_0x3ac65c){_0x105a71[_0x3e56('0x18')]=_0x3ac65c;if(_0x306e71[_0x3e56('0x28')][_0x3e56('0x38')]){_0x22a978['include']=[{'all':!![]}];}return db[_0x3e56('0x39')]['findAll'](_0x22a978);})[_0x3e56('0xa')](function(_0x2e0c06){_0x105a71[_0x3e56('0x3a')]=_0x2e0c06;return _0x105a71;})[_0x3e56('0xa')](respondWithFilteredResult(_0x5f4975,_0x22a978))[_0x3e56('0x14')](handleError(_0x5f4975,null));};exports[_0x3e56('0x3b')]=function(_0x36f5fd,_0x593044){var _0x5aca24={'raw':!![],'where':{'id':_0x36f5fd['params']['id']}},_0x5c3486={};_0x5c3486['model']=_[_0x3e56('0x29')](db[_0x3e56('0x39')][_0x3e56('0x24')]);_0x5c3486[_0x3e56('0x28')]=_[_0x3e56('0x29')](_0x36f5fd[_0x3e56('0x28')]);_0x5c3486['filters']=_[_0x3e56('0x2b')](_0x5c3486[_0x3e56('0x2c')],_0x5c3486['query']);_0x5aca24[_0x3e56('0x2e')]=_[_0x3e56('0x2b')](_0x5c3486[_0x3e56('0x2c')],qs[_0x3e56('0x2d')](_0x36f5fd[_0x3e56('0x28')][_0x3e56('0x2d')]));_0x5aca24[_0x3e56('0x2e')]=_0x5aca24[_0x3e56('0x2e')][_0x3e56('0x2f')]?_0x5aca24[_0x3e56('0x2e')]:_0x5c3486[_0x3e56('0x2c')];if(_0x36f5fd[_0x3e56('0x28')]['includeAll']){_0x5aca24[_0x3e56('0x3c')]=[{'all':!![]}];}_0x5aca24=_[_0x3e56('0x35')]({},_0x5aca24,_0x36f5fd[_0x3e56('0x37')]);return db[_0x3e56('0x39')]['find'](_0x5aca24)[_0x3e56('0xa')](handleEntityNotFound(_0x593044,null))[_0x3e56('0xa')](respondWithResult(_0x593044,null))[_0x3e56('0x14')](handleError(_0x593044,null));};exports[_0x3e56('0x3d')]=function(_0x30c8e3,_0x1c878e){var _0x27df54;return db[_0x3e56('0x39')][_0x3e56('0x3d')](_0x30c8e3[_0x3e56('0x3e')],{'raw':!![]})[_0x3e56('0xa')](function(_0x7e231){_0x27df54=_0x7e231;return db[_0x3e56('0x39')][_0x3e56('0x3f')]({'where':{'type':_0x30c8e3[_0x3e56('0x3e')]['type']},'raw':!![]});})[_0x3e56('0xa')](function(_0x227212){if(_0x27df54[_0x3e56('0x26')][_0x3e56('0x40')]()==_0x3e56('0x41')){var _0x55e48a=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config[_0x3e56('0x44')],_0x3e56('0x45')),'utf8');var _0xdef418=ejs[_0x3e56('0x46')](_0x55e48a,{'networks':_0x227212||[]});fs[_0x3e56('0x47')](_0x3e56('0x48'),_0xdef418);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x3d'),{'module':_0x3e56('0x4a')});}else if(_0x27df54[_0x3e56('0x26')]['toUpperCase']()=='TURN'){var _0x3ff999=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config[_0x3e56('0x44')],'server/files/templates/turn_multiple.ejs'),_0x3e56('0x4b'));var _0x25a429=ejs[_0x3e56('0x46')](_0x3ff999,{'networks':_0x227212||[]});fs[_0x3e56('0x47')](_0x3e56('0x4c'),_0x25a429);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x3d'),{'module':_0x3e56('0x4a')});}else{var _0x3dcd43=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config[_0x3e56('0x44')],_0x3e56('0x4d')),'utf8');var _0xb71e30=ejs[_0x3e56('0x46')](_0x3dcd43,{'networks':_0x227212||[]});fs[_0x3e56('0x47')](util[_0x3e56('0x4e')](_0x3e56('0x4f'),_0x30c8e3[_0x3e56('0x3e')][_0x3e56('0x26')]['toLowerCase']()),_0xb71e30);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x3d'),{'module':_0x3e56('0x50')});}})[_0x3e56('0xa')](function(){return _0x27df54;})['then'](respondWithResult(_0x1c878e,0xc9))[_0x3e56('0x14')](handleError(_0x1c878e,null));};exports[_0x3e56('0x1b')]=function(_0x564897,_0x4d79a0){var _0x48cc17;return db[_0x3e56('0x39')][_0x3e56('0x51')]({'where':{'id':_0x564897[_0x3e56('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d79a0,null))[_0x3e56('0xa')](saveUpdates(_0x564897[_0x3e56('0x3e')],null))['then'](function(_0x59ccd1){if(_0x59ccd1){_0x48cc17=_0x59ccd1;return db[_0x3e56('0x39')]['findAll']({'where':{'type':_0x48cc17['type']},'raw':!![]});}return null;})[_0x3e56('0xa')](function(_0x6ac4ea){if(_0x48cc17[_0x3e56('0x26')][_0x3e56('0x40')]()==_0x3e56('0x41')){var _0x21077f=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config[_0x3e56('0x44')],_0x3e56('0x45')),'utf8');var _0x41fd03=ejs[_0x3e56('0x46')](_0x21077f,{'networks':_0x6ac4ea||[]});fs['writeFileSync'](_0x3e56('0x48'),_0x41fd03);return respondWithRpcPromise('Reload',_0x3e56('0x1b'),{'module':_0x3e56('0x4a')});}else if(_0x48cc17['type'][_0x3e56('0x40')]()=='TURN'){var _0x25b4a2=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config['root'],_0x3e56('0x53')),_0x3e56('0x4b'));var _0xed6699=ejs[_0x3e56('0x46')](_0x25b4a2,{'networks':_0x6ac4ea||[]});fs[_0x3e56('0x47')](_0x3e56('0x4c'),_0xed6699);return respondWithRpcPromise('Reload',_0x3e56('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x571445=fs['readFileSync'](path['join'](config[_0x3e56('0x44')],'server/files/templates/network.ejs'),_0x3e56('0x4b'));var _0x154c6e=ejs['render'](_0x571445,{'networks':_0x6ac4ea||[]});fs[_0x3e56('0x47')](util[_0x3e56('0x4e')](_0x3e56('0x4f'),_0x564897[_0x3e56('0x3e')]['type']['toLowerCase']()),_0x154c6e);return respondWithRpcPromise('Reload',_0x3e56('0x1b'),{'module':_0x3e56('0x50')});}})['then'](function(_0xd0f801){if(_0xd0f801){return _0x48cc17;}return null;})[_0x3e56('0xa')](respondWithResult(_0x4d79a0,null))[_0x3e56('0x14')](handleError(_0x4d79a0,null));};exports[_0x3e56('0x1c')]=function(_0x1fca98,_0x23f2b7){var _0x4f9643;return db[_0x3e56('0x39')][_0x3e56('0x51')]({'where':{'id':_0x1fca98[_0x3e56('0x52')]['id']}})[_0x3e56('0xa')](function(_0x38e41f){_0x4f9643=_0x38e41f;return _0x38e41f;})['then'](handleEntityNotFound(_0x23f2b7,null))[_0x3e56('0xa')](removeEntity(_0x23f2b7,null))[_0x3e56('0xa')](function(){if(_0x4f9643){return db[_0x3e56('0x39')][_0x3e56('0x3f')]({'where':{'type':_0x4f9643[_0x3e56('0x26')]},'raw':!![]});}})[_0x3e56('0xa')](function(_0x2d9427){if(_0x4f9643[_0x3e56('0x26')]['toUpperCase']()==_0x3e56('0x41')){var _0x1e09e9=fs['readFileSync'](path[_0x3e56('0x43')](config[_0x3e56('0x44')],_0x3e56('0x45')),_0x3e56('0x4b'));var _0x12f91d=ejs[_0x3e56('0x46')](_0x1e09e9,{'networks':_0x2d9427||[]});fs[_0x3e56('0x47')]('/etc/asterisk/stun_xcally.conf',_0x12f91d);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x1c'),{'module':_0x3e56('0x4a')});}else if(_0x4f9643[_0x3e56('0x26')][_0x3e56('0x40')]()==_0x3e56('0x54')){var _0x17f8f5=fs[_0x3e56('0x42')](path['join'](config[_0x3e56('0x44')],'server/files/templates/turn_multiple.ejs'),_0x3e56('0x4b'));var _0x31641e=ejs[_0x3e56('0x46')](_0x17f8f5,{'networks':_0x2d9427||[]});fs[_0x3e56('0x47')](_0x3e56('0x4c'),_0x31641e);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x1c'),{'module':_0x3e56('0x4a')});}else{var _0x2cb9f8=fs[_0x3e56('0x42')](path[_0x3e56('0x43')](config[_0x3e56('0x44')],_0x3e56('0x4d')),_0x3e56('0x4b'));var _0xb2c8e3=ejs[_0x3e56('0x46')](_0x2cb9f8,{'networks':_0x2d9427||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4f9643[_0x3e56('0x26')][_0x3e56('0x55')]()),_0xb2c8e3);return respondWithRpcPromise(_0x3e56('0x49'),_0x3e56('0x1c'),{'module':_0x3e56('0x50')});}})[_0x3e56('0x14')](handleError(_0x23f2b7,null));}; \ No newline at end of file +var _0x469a=['limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','length','find','create','body','STUN','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined'];(function(_0x497d7c,_0x376f95){var _0x9a970e=function(_0x386d64){while(--_0x386d64){_0x497d7c['push'](_0x497d7c['shift']());}};_0x9a970e(++_0x376f95);}(_0x469a,0xed));var _0xa469=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x469a[_0x602ca8];return _0x26e8ab;};'use strict';var util=require(_0xa469('0x0'));var path=require('path');var ejs=require(_0xa469('0x1'));var fs=require('fs');var _=require(_0xa469('0x2'));var qs=require(_0xa469('0x3'));var logger=require(_0xa469('0x4'))(_0xa469('0x5'));var config=require(_0xa469('0x6'));var db=require(_0xa469('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa469('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5857d4,_0x349048,_0x2e668f,_0xb6abf9){return new Promise(function(_0x383b63,_0x43b72a){var _0x454698=_0xb6abf9||client;return _0x454698[_0xa469('0x9')](_0x5857d4,_0x2e668f)[_0xa469('0xa')](function(_0x1f7463){logger['info']('Network,\x20%s,\x20%s',_0x349048,_0xa469('0xb'));logger[_0xa469('0xc')](_0xa469('0xd'),_0x349048,'request\x20sent',JSON['stringify'](_0x1f7463));if(_0x1f7463[_0xa469('0xe')]){if(_0x1f7463[_0xa469('0xe')][_0xa469('0xf')]===0x1f4){logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);return _0x43b72a(_0x1f7463['error'][_0xa469('0x10')]);}logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);return _0x383b63(_0x1f7463[_0xa469('0xe')][_0xa469('0x10')]);}else{logger[_0xa469('0x11')]('Network,\x20%s,\x20%s',_0x349048,_0xa469('0xb'));_0x383b63(_0x1f7463[_0xa469('0x12')][_0xa469('0x10')]);}})[_0xa469('0x13')](function(_0x1b3d7d){logger[_0xa469('0xe')]('Network,\x20%s,\x20%s',_0x349048,_0x1b3d7d);_0x43b72a(_0x1b3d7d);});});}function respondWithResult(_0x610f61,_0x2ab927){_0x2ab927=_0x2ab927||0xc8;return function(_0x58cac5){if(_0x58cac5){return _0x610f61[_0xa469('0x14')](_0x2ab927)[_0xa469('0x15')](_0x58cac5);}};}function respondWithFilteredResult(_0x57fc7f,_0x5c5fe9){return function(_0x269802){if(_0x269802){var _0x4899cb=typeof _0x5c5fe9[_0xa469('0x16')]===_0xa469('0x17')&&typeof _0x5c5fe9[_0xa469('0x18')]==='undefined';var _0x348a44=_0x269802[_0xa469('0x19')];var _0x1c390e=_0x4899cb?0x0:_0x5c5fe9[_0xa469('0x16')];var _0x4b01d4=_0x4899cb?_0x269802[_0xa469('0x19')]:_0x5c5fe9['offset']+_0x5c5fe9[_0xa469('0x18')];var _0xe2b810;if(_0x4b01d4>=_0x348a44){_0x4b01d4=_0x348a44;_0xe2b810=0xc8;}else{_0xe2b810=0xce;}_0x57fc7f['status'](_0xe2b810);return _0x57fc7f[_0xa469('0x1a')](_0xa469('0x1b'),_0x1c390e+'-'+_0x4b01d4+'/'+_0x348a44)[_0xa469('0x15')](_0x269802);}return null;};}function saveUpdates(_0xed4ae6){return function(_0x37864f){if(_0x37864f){return _0x37864f[_0xa469('0x1c')](_0xed4ae6)[_0xa469('0xa')](function(_0x31e68c){return _0x31e68c;});}return null;};}function removeEntity(_0x583899){return function(_0x33cf2b){if(_0x33cf2b){return _0x33cf2b[_0xa469('0x1d')]()[_0xa469('0xa')](function(){_0x583899[_0xa469('0x14')](0xcc)[_0xa469('0x1e')]();});}};}function handleEntityNotFound(_0x107362){return function(_0x316ce0){if(!_0x316ce0){_0x107362[_0xa469('0x1f')](0x194);}return _0x316ce0;};}function handleError(_0x23c597,_0x5ad4ff){_0x5ad4ff=_0x5ad4ff||0x1f4;return function(_0x1bbfa1){logger['error'](_0x1bbfa1[_0xa469('0x20')]);if(_0x1bbfa1[_0xa469('0x21')]){delete _0x1bbfa1[_0xa469('0x21')];}_0x23c597[_0xa469('0x14')](_0x5ad4ff)[_0xa469('0x22')](_0x1bbfa1);};}exports['index']=function(_0x207f63,_0x2447de){var _0x1cb419={},_0xa65b05={},_0x2631be={'count':0x0,'rows':[]};var _0x1702b3=_[_0xa469('0x23')](db['Network'][_0xa469('0x24')],function(_0x2d289d){return{'name':_0x2d289d[_0xa469('0x25')],'type':_0x2d289d[_0xa469('0x26')][_0xa469('0x27')]};});_0xa65b05[_0xa469('0x28')]=_[_0xa469('0x23')](_0x1702b3,_0xa469('0x21'));_0xa65b05[_0xa469('0x29')]=_[_0xa469('0x2a')](_0x207f63['query']);_0xa65b05[_0xa469('0x2b')]=_[_0xa469('0x2c')](_0xa65b05[_0xa469('0x28')],_0xa65b05[_0xa469('0x29')]);_0x1cb419[_0xa469('0x2d')]=_[_0xa469('0x2c')](_0xa65b05[_0xa469('0x28')],qs[_0xa469('0x2e')](_0x207f63[_0xa469('0x29')][_0xa469('0x2e')]));_0x1cb419['attributes']=_0x1cb419[_0xa469('0x2d')]['length']?_0x1cb419[_0xa469('0x2d')]:_0xa65b05[_0xa469('0x28')];if(!_0x207f63['query'][_0xa469('0x2f')](_0xa469('0x30'))){_0x1cb419['limit']=qs['limit'](_0x207f63[_0xa469('0x29')]['limit']);_0x1cb419[_0xa469('0x16')]=qs[_0xa469('0x16')](_0x207f63[_0xa469('0x29')]['offset']);}_0x1cb419[_0xa469('0x31')]=qs['sort'](_0x207f63[_0xa469('0x29')]['sort']);_0x1cb419[_0xa469('0x32')]=qs['filters'](_[_0xa469('0x33')](_0x207f63[_0xa469('0x29')],_0xa65b05[_0xa469('0x2b')]),_0x1702b3);if(_0x207f63[_0xa469('0x29')][_0xa469('0x34')]){_0x1cb419[_0xa469('0x32')]=_[_0xa469('0x35')](_0x1cb419[_0xa469('0x32')],{'$or':_[_0xa469('0x23')](_0x1702b3,function(_0xa05fdc){if(_0xa05fdc[_0xa469('0x26')]!==_0xa469('0x36')){var _0x42a0d4={};_0x42a0d4[_0xa05fdc[_0xa469('0x21')]]={'$like':'%'+_0x207f63['query']['filter']+'%'};return _0x42a0d4;}})});}_0x1cb419=_[_0xa469('0x35')]({},_0x1cb419,_0x207f63[_0xa469('0x37')]);var _0x247276={'where':_0x1cb419[_0xa469('0x32')]};return db[_0xa469('0x38')][_0xa469('0x19')](_0x247276)[_0xa469('0xa')](function(_0x508caa){_0x2631be[_0xa469('0x19')]=_0x508caa;if(_0x207f63['query'][_0xa469('0x39')]){_0x1cb419[_0xa469('0x3a')]=[{'all':!![]}];}return db['Network'][_0xa469('0x3b')](_0x1cb419);})[_0xa469('0xa')](function(_0x33ba47){_0x2631be[_0xa469('0x3c')]=_0x33ba47;return _0x2631be;})[_0xa469('0xa')](respondWithFilteredResult(_0x2447de,_0x1cb419))[_0xa469('0x13')](handleError(_0x2447de,null));};exports[_0xa469('0x3d')]=function(_0x10ba65,_0x11b164){var _0x444009={'raw':!![],'where':{'id':_0x10ba65[_0xa469('0x3e')]['id']}},_0xc91d0a={};_0xc91d0a['model']=_[_0xa469('0x2a')](db[_0xa469('0x38')][_0xa469('0x24')]);_0xc91d0a['query']=_[_0xa469('0x2a')](_0x10ba65[_0xa469('0x29')]);_0xc91d0a[_0xa469('0x2b')]=_[_0xa469('0x2c')](_0xc91d0a['model'],_0xc91d0a[_0xa469('0x29')]);_0x444009[_0xa469('0x2d')]=_['intersection'](_0xc91d0a[_0xa469('0x28')],qs[_0xa469('0x2e')](_0x10ba65[_0xa469('0x29')][_0xa469('0x2e')]));_0x444009[_0xa469('0x2d')]=_0x444009['attributes'][_0xa469('0x3f')]?_0x444009[_0xa469('0x2d')]:_0xc91d0a[_0xa469('0x28')];if(_0x10ba65[_0xa469('0x29')][_0xa469('0x39')]){_0x444009[_0xa469('0x3a')]=[{'all':!![]}];}_0x444009=_['merge']({},_0x444009,_0x10ba65['options']);return db['Network'][_0xa469('0x40')](_0x444009)[_0xa469('0xa')](handleEntityNotFound(_0x11b164,null))['then'](respondWithResult(_0x11b164,null))[_0xa469('0x13')](handleError(_0x11b164,null));};exports[_0xa469('0x41')]=function(_0x30b54e,_0x4847ec){var _0x116d8d;return db[_0xa469('0x38')][_0xa469('0x41')](_0x30b54e[_0xa469('0x42')],{'raw':!![]})[_0xa469('0xa')](function(_0x3103cb){_0x116d8d=_0x3103cb;return db['Network'][_0xa469('0x3b')]({'where':{'type':_0x30b54e[_0xa469('0x42')][_0xa469('0x26')]},'raw':!![]});})['then'](function(_0x1d4df5){if(_0x116d8d[_0xa469('0x26')]['toUpperCase']()==_0xa469('0x43')){var _0x32993f=fs['readFileSync'](path[_0xa469('0x44')](config['root'],_0xa469('0x45')),_0xa469('0x46'));var _0x3aae7d=ejs['render'](_0x32993f,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](_0xa469('0x48'),_0x3aae7d);return respondWithRpcPromise('Reload','create',{'module':_0xa469('0x49')});}else if(_0x116d8d[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x4b')){var _0x17a300=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x4e')),_0xa469('0x46'));var _0x249364=ejs['render'](_0x17a300,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](_0xa469('0x4f'),_0x249364);return respondWithRpcPromise(_0xa469('0x50'),'create',{'module':_0xa469('0x49')});}else{var _0x5cf020=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],_0xa469('0x51')),_0xa469('0x46'));var _0x3405de=ejs[_0xa469('0x52')](_0x5cf020,{'networks':_0x1d4df5||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')](_0xa469('0x54'),_0x30b54e['body']['type'][_0xa469('0x55')]()),_0x3405de);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x41'),{'module':_0xa469('0x56')});}})[_0xa469('0xa')](function(){return _0x116d8d;})[_0xa469('0xa')](respondWithResult(_0x4847ec,0xc9))[_0xa469('0x13')](handleError(_0x4847ec,null));};exports[_0xa469('0x1c')]=function(_0x4818fa,_0x2d562d){var _0xcb39e3;return db[_0xa469('0x38')]['find']({'where':{'id':_0x4818fa['params']['id']}})[_0xa469('0xa')](handleEntityNotFound(_0x2d562d,null))[_0xa469('0xa')](saveUpdates(_0x4818fa[_0xa469('0x42')],null))['then'](function(_0x5e9872){if(_0x5e9872){_0xcb39e3=_0x5e9872;return db['Network'][_0xa469('0x3b')]({'where':{'type':_0xcb39e3[_0xa469('0x26')]},'raw':!![]});}return null;})[_0xa469('0xa')](function(_0xde4f0c){if(_0xcb39e3[_0xa469('0x26')]['toUpperCase']()=='STUN'){var _0x512112=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x45')),_0xa469('0x46'));var _0xa90c85=ejs[_0xa469('0x52')](_0x512112,{'networks':_0xde4f0c||[]});fs[_0xa469('0x47')](_0xa469('0x48'),_0xa90c85);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x49')});}else if(_0xcb39e3[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x4b')){var _0x55184d=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x4e')),_0xa469('0x46'));var _0x3bb5a6=ejs[_0xa469('0x52')](_0x55184d,{'networks':_0xde4f0c||[]});fs['writeFileSync'](_0xa469('0x4f'),_0x3bb5a6);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x49')});}else{var _0x1fbbac=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],_0xa469('0x51')),'utf8');var _0x141eec=ejs[_0xa469('0x52')](_0x1fbbac,{'networks':_0xde4f0c||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')](_0xa469('0x54'),_0x4818fa[_0xa469('0x42')][_0xa469('0x26')][_0xa469('0x55')]()),_0x141eec);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1c'),{'module':_0xa469('0x56')});}})[_0xa469('0xa')](function(_0x540743){if(_0x540743){return _0xcb39e3;}return null;})[_0xa469('0xa')](respondWithResult(_0x2d562d,null))[_0xa469('0x13')](handleError(_0x2d562d,null));};exports[_0xa469('0x1d')]=function(_0x4c0496,_0x286698){var _0x4db4b9;return db['Network']['find']({'where':{'id':_0x4c0496[_0xa469('0x3e')]['id']}})[_0xa469('0xa')](function(_0x57085e){_0x4db4b9=_0x57085e;return _0x57085e;})[_0xa469('0xa')](handleEntityNotFound(_0x286698,null))['then'](removeEntity(_0x286698,null))[_0xa469('0xa')](function(){if(_0x4db4b9){return db['Network'][_0xa469('0x3b')]({'where':{'type':_0x4db4b9['type']},'raw':!![]});}})[_0xa469('0xa')](function(_0x31582f){if(_0x4db4b9[_0xa469('0x26')][_0xa469('0x4a')]()==_0xa469('0x43')){var _0x4c718a=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config[_0xa469('0x4d')],'server/files/templates/stun_multiple.ejs'),_0xa469('0x46'));var _0x51aab7=ejs[_0xa469('0x52')](_0x4c718a,{'networks':_0x31582f||[]});fs['writeFileSync'](_0xa469('0x48'),_0x51aab7);return respondWithRpcPromise(_0xa469('0x50'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x4db4b9['type'][_0xa469('0x4a')]()=='TURN'){var _0x5d0863=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],_0xa469('0x4e')),'utf8');var _0x50aed9=ejs[_0xa469('0x52')](_0x5d0863,{'networks':_0x31582f||[]});fs[_0xa469('0x47')]('/etc/asterisk/turn_xcally.conf',_0x50aed9);return respondWithRpcPromise(_0xa469('0x50'),'destroy',{'module':_0xa469('0x49')});}else{var _0xf436a5=fs[_0xa469('0x4c')](path[_0xa469('0x44')](config['root'],'server/files/templates/network.ejs'),_0xa469('0x46'));var _0xd0ac84=ejs[_0xa469('0x52')](_0xf436a5,{'networks':_0x31582f||[]});fs[_0xa469('0x47')](util[_0xa469('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x4db4b9[_0xa469('0x26')]['toLowerCase']()),_0xd0ac84);return respondWithRpcPromise(_0xa469('0x50'),_0xa469('0x1d'),{'module':_0xa469('0x56')});}})[_0xa469('0x13')](handleError(_0x286698,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 28ce0e2..beb5553 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 _0x6953=['../../config/environment','exports','define','Network','network','lodash','util','bluebird','path','rimraf'];(function(_0xab0370,_0x3f2866){var _0x5dd2bf=function(_0x3ade09){while(--_0x3ade09){_0xab0370['push'](_0xab0370['shift']());}};_0x5dd2bf(++_0x3f2866);}(_0x6953,0x91));var _0x3695=function(_0x3f69e3,_0x191d58){_0x3f69e3=_0x3f69e3-0x0;var _0x1388f0=_0x6953[_0x3f69e3];return _0x1388f0;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./network.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04b8=['../../config/environment','./network.attributes','exports','define','Network','util','api','moment','request-promise','path'];(function(_0x9cbad4,_0x1c2062){var _0x48931d=function(_0x34e1d7){while(--_0x34e1d7){_0x9cbad4['push'](_0x9cbad4['shift']());}};_0x48931d(++_0x1c2062);}(_0x04b8,0x159));var _0x804b=function(_0x17a11f,_0x40bf5b){_0x17a11f=_0x17a11f-0x0;var _0xe29634=_0x04b8[_0x17a11f];return _0xe29634;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var moment=require(_0x804b('0x2'));var BPromise=require('bluebird');var rp=require(_0x804b('0x3'));var fs=require('fs');var path=require(_0x804b('0x4'));var rimraf=require('rimraf');var config=require(_0x804b('0x5'));var attributes=require(_0x804b('0x6'));module[_0x804b('0x7')]=function(_0x5a8a5b,_0x2c22e3){return _0x5a8a5b[_0x804b('0x8')](_0x804b('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 4e8be29..a1b7ef2 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2efc0a,_0x3374b6){var _0x353ea3=function(_0x3613b1){while(--_0x3613b1){_0x2efc0a['push'](_0x2efc0a['shift']());}};_0x353ea3(++_0x3374b6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x315319,_0x28bbb4){_0x315319=_0x315319-0x0;var _0x3a4acd=_0x7a54[_0x315319];return _0x3a4acd;};'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 5c30195..d3ed8a9 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getAgents','post','create','addDisposition','addAnswer','notify','/:id/users','addAgents','/:id/send','send','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x2c92d6,_0x2edde2){var _0x21b134=function(_0x27e91a){while(--_0x27e91a){_0x2c92d6['push'](_0x2c92d6['shift']());}};_0x21b134(++_0x2edde2);}(_0x2032,0xd9));var _0x2203=function(_0x1c956e,_0x1c05a5){_0x1c956e=_0x1c956e-0x0;var _0x19ab8a=_0x2032[_0x1c956e];return _0x19ab8a;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['get'](_0x2203('0x12'),auth[_0x2203('0x9')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x2203('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x2203('0x13')]);router[_0x2203('0x14')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0x15')]);router[_0x2203('0x14')](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0x16')]);router[_0x2203('0x14')](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x17')]);router[_0x2203('0x14')]('/:id/notify',controller[_0x2203('0x18')]);router[_0x2203('0x14')]('/:id/applications',auth[_0x2203('0x9')](),controller['addApplications']);router[_0x2203('0x14')](_0x2203('0x19'),auth[_0x2203('0x9')](),controller[_0x2203('0x1a')]);router[_0x2203('0x14')](_0x2203('0x1b'),auth['isAuthenticated'](),controller[_0x2203('0x1c')]);router['put']('/:id',auth[_0x2203('0x9')](),controller['update']);router[_0x2203('0x1d')](_0x2203('0x1e'),auth['isAuthenticated'](),controller[_0x2203('0x1f')]);router['delete']('/:id/dispositions',auth[_0x2203('0x9')](),controller[_0x2203('0x20')]);router[_0x2203('0x1d')](_0x2203('0x10'),auth[_0x2203('0x9')](),controller[_0x2203('0x21')]);router[_0x2203('0x1d')](_0x2203('0x19'),auth['isAuthenticated'](),controller[_0x2203('0x22')]);module[_0x2203('0x23')]=router; \ No newline at end of file +var _0x1a37=['/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show'];(function(_0x3fa42c,_0x286d07){var _0xc9dac3=function(_0x63fff9){while(--_0x63fff9){_0x3fa42c['push'](_0x3fa42c['shift']());}};_0xc9dac3(++_0x286d07);}(_0x1a37,0xb4));var _0x71a3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x1a37[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./openchannelAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0xa')](_0x71a3('0x15'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x17')]('/',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x71a3('0x19')]);router[_0x71a3('0x17')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x17')]('/:id/notify',controller[_0x71a3('0x1b')]);router[_0x71a3('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x71a3('0x1c')]);router[_0x71a3('0x17')](_0x71a3('0x15'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1d')]);router['post'](_0x71a3('0x1e'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1f')]);router[_0x71a3('0x20')](_0x71a3('0x21'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0x21'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x24')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller['removeDispositions']);router[_0x71a3('0x24')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x25')]);router[_0x71a3('0x24')]('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d6d9f32..1a723ab 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 _0xb527=['mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x56e19b,_0x53f5c5){var _0x4d47c8=function(_0x551df6){while(--_0x551df6){_0x56e19b['push'](_0x56e19b['shift']());}};_0x4d47c8(++_0x53f5c5);}(_0xb527,0xab));var _0x7b52=function(_0x2f20e1,_0x22f948){_0x2f20e1=_0x2f20e1-0x0;var _0x1990ab=_0xb527[_0x2f20e1];return _0x1990ab;};'use strict';var Sequelize=require(_0x7b52('0x0'));var rs=require(_0x7b52('0x1'));module[_0x7b52('0x2')]={'name':{'type':Sequelize[_0x7b52('0x3')],'unique':_0x7b52('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x7b52('0x3')]},'token':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':function(){return rs[_0x7b52('0x5')]();}},'replyUri':{'type':Sequelize[_0x7b52('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7b52('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7b52('0x6');}},'notificationSound':{'type':Sequelize[_0x7b52('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b52('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7b52('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7b52('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b52('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b52('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b52('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b52('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x7b52('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7b52('0x7')],'defaultValue':![],'comment':_0x7b52('0xa'),'set':function(_0x1fcaf0){if(!_0x1fcaf0)this['setDataValue'](_0x7b52('0xb'),null);this[_0x7b52('0xc')]('mandatoryDisposition',_0x1fcaf0);}}}; \ No newline at end of file +var _0xb9ed=['setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x4b5df0,_0x51759e){var _0x2e6b2b=function(_0x3df779){while(--_0x3df779){_0x4b5df0['push'](_0x4b5df0['shift']());}};_0x2e6b2b(++_0x51759e);}(_0xb9ed,0x86));var _0xdb9e=function(_0x4127f0,_0x2c7d32){_0x4127f0=_0x4127f0-0x0;var _0x13ac52=_0xb9ed[_0x4127f0];return _0x13ac52;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdb9e('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb9e('0x1')],'unique':_0xdb9e('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdb9e('0x3')]();}},'replyUri':{'type':Sequelize[_0xdb9e('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdb9e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdb9e('0x4');}},'notificationSound':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdb9e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb9e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xdb9e('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xdb9e('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e7b6c){if(!_0x3e7b6c)this['setDataValue'](_0xdb9e('0x8'),null);this[_0xdb9e('0x9')](_0xdb9e('0xa'),_0x3e7b6c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f712502..f389769 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 _0x814b=['Transaction','READ_COMMITTED','bulkCreate','priority','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','then','get','OpenchannelAccounts','destroy','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','offset','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','nolimit','order','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','update','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction'];(function(_0x97f3aa,_0x498c81){var _0xbc7e0e=function(_0xf9376f){while(--_0xf9376f){_0x97f3aa['push'](_0x97f3aa['shift']());}};_0xbc7e0e(++_0x498c81);}(_0x814b,0x1a2));var _0xb814=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x814b[_0x1f909a];return _0x543f16;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);var jayson=require(_0xb814('0x21'));var client=jayson[_0xb814('0x22')][_0xb814('0x23')]({'port':0x232c});var client9002=jayson[_0xb814('0x22')][_0xb814('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3a71d6,_0x45e0d0,_0x265a83,_0x125ce2){return new BPromise(function(_0x21b73f,_0x7a21ef){var _0x48c9df=_0x125ce2||client;return _0x48c9df[_0xb814('0x24')](_0x3a71d6,_0x265a83)['then'](function(_0x270598){logger[_0xb814('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x45e0d0,'request\x20sent');logger['debug'](_0xb814('0x26'),_0x45e0d0,'request\x20sent',JSON['stringify'](_0x270598));if(_0x270598[_0xb814('0x27')]){if(_0x270598[_0xb814('0x27')][_0xb814('0x28')]===0x1f4){logger['error'](_0xb814('0x29'),_0x45e0d0,_0x270598['error'][_0xb814('0x2a')]);return _0x7a21ef(_0x270598[_0xb814('0x27')][_0xb814('0x2a')]);}logger[_0xb814('0x27')](_0xb814('0x29'),_0x45e0d0,_0x270598[_0xb814('0x27')][_0xb814('0x2a')]);return _0x21b73f(_0x270598['error'][_0xb814('0x2a')]);}else{logger['info'](_0xb814('0x29'),_0x45e0d0,_0xb814('0x2b'));_0x21b73f(_0x270598[_0xb814('0x2c')][_0xb814('0x2a')]);}})[_0xb814('0x2d')](function(_0xb9e57d){logger[_0xb814('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x45e0d0,_0xb9e57d);_0x7a21ef(_0xb9e57d);});});}function respondWithStatusCode(_0x392222,_0xc0ef66){_0xc0ef66=_0xc0ef66||0xcc;return function(_0x1c2625){if(_0x1c2625){return _0x392222[_0xb814('0x2e')](_0xc0ef66);}return _0x392222[_0xb814('0x2f')](_0xc0ef66)[_0xb814('0x30')]();};}function respondWithResult(_0x3f0150,_0x1e4e89){_0x1e4e89=_0x1e4e89||0xc8;return function(_0x5a6291){if(_0x5a6291){return _0x3f0150[_0xb814('0x2f')](_0x1e4e89)[_0xb814('0x31')](_0x5a6291);}};}function respondWithFilteredResult(_0x52ed64,_0x9008b2){return function(_0x37d24d){if(_0x37d24d){var _0x530744=typeof _0x9008b2['offset']===_0xb814('0x32')&&typeof _0x9008b2[_0xb814('0x33')]==='undefined';var _0x338a28=_0x37d24d['count'];var _0x6efe9a=_0x530744?0x0:_0x9008b2['offset'];var _0x4cfc58=_0x530744?_0x37d24d[_0xb814('0x34')]:_0x9008b2['offset']+_0x9008b2[_0xb814('0x33')];var _0x19469b;if(_0x4cfc58>=_0x338a28){_0x4cfc58=_0x338a28;_0x19469b=0xc8;}else{_0x19469b=0xce;}_0x52ed64[_0xb814('0x2f')](_0x19469b);return _0x52ed64['set']('Content-Range',_0x6efe9a+'-'+_0x4cfc58+'/'+_0x338a28)[_0xb814('0x31')](_0x37d24d);}return null;};}function patchUpdates(_0x336e2b){return function(_0x523566){try{jsonpatch[_0xb814('0x35')](_0x523566,_0x336e2b,!![]);}catch(_0xe558d5){return BPromise[_0xb814('0x36')](_0xe558d5);}return _0x523566[_0xb814('0x37')]();};}function saveUpdates(_0x1b78de,_0x60024d){return function(_0x3672f3){if(_0x3672f3){return _0x3672f3['update'](_0x1b78de)[_0xb814('0x38')](function(_0x2263f6){return _0x2263f6;});}return null;};}function removeEntity(_0x30de5a,_0x424e2b){return function(_0x14100d){if(_0x14100d){return _0x14100d['destroy']()[_0xb814('0x38')](function(){var _0x57e6e6=_0x14100d[_0xb814('0x39')]({'plain':!![]});var _0x16e21c=_0xb814('0x3a');return db['UserProfileResource'][_0xb814('0x3b')]({'where':{'type':_0x16e21c,'resourceId':_0x57e6e6['id']}})[_0xb814('0x38')](function(){return _0x14100d;});})['then'](function(){_0x30de5a[_0xb814('0x2f')](0xcc)[_0xb814('0x30')]();});}};}function handleEntityNotFound(_0x1a8bd0,_0x1f7cd8){return function(_0xd77d96){if(!_0xd77d96){_0x1a8bd0[_0xb814('0x2e')](0x194);}return _0xd77d96;};}function handleError(_0x4d81eb,_0xa6ce87){_0xa6ce87=_0xa6ce87||0x1f4;return function(_0x4e4684){logger[_0xb814('0x27')](_0x4e4684['stack']);if(_0x4e4684[_0xb814('0x3c')]){delete _0x4e4684['name'];}_0x4d81eb[_0xb814('0x2f')](_0xa6ce87)[_0xb814('0x3d')](_0x4e4684);};}exports['index']=function(_0x4d308a,_0x5dd6bc){var _0x57b379={'include':[{'model':db[_0xb814('0x3e')],'as':_0xb814('0x3f')}]},_0x17549e={},_0x262a0b={'count':0x0,'rows':[]};var _0x51cdba=_['map'](db[_0xb814('0x40')]['rawAttributes'],function(_0x2a93da){return{'name':_0x2a93da[_0xb814('0x41')],'type':_0x2a93da[_0xb814('0x42')][_0xb814('0x43')]};});_0x17549e[_0xb814('0x44')]=_[_0xb814('0x45')](_0x51cdba,_0xb814('0x3c'));_0x17549e[_0xb814('0x46')]=_[_0xb814('0x47')](_0x4d308a['query']);_0x17549e['filters']=_['intersection'](_0x17549e[_0xb814('0x44')],_0x17549e['query']);_0x57b379[_0xb814('0x48')]=_['intersection'](_0x17549e[_0xb814('0x44')],qs[_0xb814('0x49')](_0x4d308a[_0xb814('0x46')][_0xb814('0x49')]));_0x57b379['attributes']=_0x57b379[_0xb814('0x48')][_0xb814('0x4a')]?_0x57b379[_0xb814('0x48')]:_0x17549e[_0xb814('0x44')];if(!_0x4d308a[_0xb814('0x46')][_0xb814('0x4b')]('nolimit')){_0x57b379[_0xb814('0x33')]=qs[_0xb814('0x33')](_0x4d308a[_0xb814('0x46')][_0xb814('0x33')]);_0x57b379[_0xb814('0x4c')]=qs[_0xb814('0x4c')](_0x4d308a[_0xb814('0x46')]['offset']);}_0x57b379['order']=qs[_0xb814('0x4d')](_0x4d308a[_0xb814('0x46')][_0xb814('0x4d')]);_0x57b379[_0xb814('0x4e')]=qs[_0xb814('0x4f')](_[_0xb814('0x50')](_0x4d308a[_0xb814('0x46')],_0x17549e[_0xb814('0x4f')]),_0x51cdba);if(_0x4d308a[_0xb814('0x46')][_0xb814('0x51')]){_0x57b379[_0xb814('0x4e')]=_['merge'](_0x57b379[_0xb814('0x4e')],{'$or':_[_0xb814('0x45')](_0x51cdba,function(_0x4a76bb){if(_0x4a76bb[_0xb814('0x42')]!=='VIRTUAL'){var _0x2fb0f7={};_0x2fb0f7[_0x4a76bb[_0xb814('0x3c')]]={'$like':'%'+_0x4d308a[_0xb814('0x46')][_0xb814('0x51')]+'%'};return _0x2fb0f7;}})});}_0x57b379=_[_0xb814('0x52')]({},_0x57b379,_0x4d308a[_0xb814('0x53')]);var _0x2cc806={'where':_0x57b379[_0xb814('0x4e')]};return db[_0xb814('0x40')][_0xb814('0x34')](_0x2cc806)['then'](function(_0x4d4a7e){_0x262a0b[_0xb814('0x34')]=_0x4d4a7e;if(_0x4d308a[_0xb814('0x46')][_0xb814('0x54')]){_0x57b379[_0xb814('0x55')]=[{'all':!![]}];}return db[_0xb814('0x40')][_0xb814('0x56')](_0x57b379);})[_0xb814('0x38')](function(_0x4a4f9a){_0x262a0b[_0xb814('0x57')]=_0x4a4f9a;return _0x262a0b;})[_0xb814('0x38')](respondWithFilteredResult(_0x5dd6bc,_0x57b379))[_0xb814('0x2d')](handleError(_0x5dd6bc,null));};exports['show']=function(_0x3a5556,_0x4e6f3c){var _0x252293={'raw':![],'where':{'id':_0x3a5556[_0xb814('0x58')]['id']},'include':[{'model':db[_0xb814('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5dc28e={};_0x5dc28e[_0xb814('0x44')]=_[_0xb814('0x47')](db[_0xb814('0x40')]['rawAttributes']);_0x5dc28e[_0xb814('0x46')]=_['keys'](_0x3a5556[_0xb814('0x46')]);_0x5dc28e[_0xb814('0x4f')]=_['intersection'](_0x5dc28e[_0xb814('0x44')],_0x5dc28e['query']);_0x252293['attributes']=_[_0xb814('0x59')](_0x5dc28e[_0xb814('0x44')],qs[_0xb814('0x49')](_0x3a5556['query'][_0xb814('0x49')]));_0x252293['attributes']=_0x252293[_0xb814('0x48')][_0xb814('0x4a')]?_0x252293['attributes']:_0x5dc28e[_0xb814('0x44')];if(_0x3a5556['query'][_0xb814('0x54')]){_0x252293[_0xb814('0x55')]=[{'all':!![]}];}_0x252293=_[_0xb814('0x52')]({},_0x252293,_0x3a5556[_0xb814('0x53')]);return db[_0xb814('0x40')][_0xb814('0x5a')](_0x252293)[_0xb814('0x38')](handleEntityNotFound(_0x4e6f3c,null))[_0xb814('0x38')](respondWithResult(_0x4e6f3c,null))['catch'](handleError(_0x4e6f3c,null));};exports[_0xb814('0x5b')]=function(_0x5441c5,_0x5d71d5){return db[_0xb814('0x40')][_0xb814('0x5b')](_0x5441c5['body'],{})[_0xb814('0x38')](function(_0x58b9a6){var _0x48362c=_0x5441c5[_0xb814('0x5c')]['get']({'plain':!![]});if(!_0x48362c)throw new Error(_0xb814('0x5d'));if(_0x48362c[_0xb814('0x5e')]===_0xb814('0x5c')){var _0x586957=_0x58b9a6[_0xb814('0x39')]({'plain':!![]});var _0x4df65c=_0xb814('0x3a');return db[_0xb814('0x5f')][_0xb814('0x5a')]({'where':{'name':_0x4df65c,'userProfileId':_0x48362c[_0xb814('0x60')]},'raw':!![]})[_0xb814('0x38')](function(_0x3b374b){if(_0x3b374b&&_0x3b374b[_0xb814('0x61')]===0x0){return db[_0xb814('0x62')][_0xb814('0x5b')]({'name':_0x586957['name'],'resourceId':_0x586957['id'],'type':_0x3b374b[_0xb814('0x3c')],'sectionId':_0x3b374b['id']},{})[_0xb814('0x38')](function(){return _0x58b9a6;});}else{return _0x58b9a6;}})[_0xb814('0x2d')](function(_0x1ac6d0){logger[_0xb814('0x27')](_0xb814('0x63'),_0x1ac6d0);throw _0x1ac6d0;});}return _0x58b9a6;})['then'](respondWithResult(_0x5d71d5,0xc9))[_0xb814('0x2d')](handleError(_0x5d71d5,null));};exports['update']=function(_0x3cd4f7,_0x39b754){if(_0x3cd4f7[_0xb814('0x64')]['id']){delete _0x3cd4f7['body']['id'];}return db[_0xb814('0x40')]['find']({'where':{'id':_0x3cd4f7[_0xb814('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb814('0x3f')}]})[_0xb814('0x38')](handleEntityNotFound(_0x39b754,null))[_0xb814('0x38')](saveUpdates(_0x3cd4f7[_0xb814('0x64')],null))[_0xb814('0x38')](respondWithResult(_0x39b754,null))[_0xb814('0x2d')](handleError(_0x39b754,null));};exports[_0xb814('0x3b')]=function(_0x4d44e3,_0x44088d){return db['OpenchannelAccount'][_0xb814('0x5a')]({'where':{'id':_0x4d44e3[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x44088d,null))[_0xb814('0x38')](removeEntity(_0x44088d,null))[_0xb814('0x2d')](handleError(_0x44088d,null));};exports[_0xb814('0x65')]=function(_0x514dab,_0x12882a){return db[_0xb814('0x40')]['describe']()[_0xb814('0x38')](respondWithResult(_0x12882a,null))[_0xb814('0x2d')](handleError(_0x12882a,null));};exports[_0xb814('0x66')]=function(_0x130033,_0x2161eb,_0x51d834){if(_0x130033[_0xb814('0x64')]['id']){delete _0x130033['body']['id'];}return db[_0xb814('0x40')][_0xb814('0x5a')]({'where':{'id':_0x130033[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x2161eb,null))[_0xb814('0x38')](function(_0x41bcaf){if(_0x41bcaf){_0x130033['body']['OpenchannelAccountId']=_0x41bcaf['id'];return db['Disposition'][_0xb814('0x5b')](_0x130033['body']);}})[_0xb814('0x38')](respondWithResult(_0x2161eb,null))[_0xb814('0x2d')](handleError(_0x2161eb,null));};exports[_0xb814('0x67')]=function(_0x5e966c,_0x1b76fa,_0x3e5ce8){var _0xee204={'raw':![],'where':{}};var _0x5aabbe={};var _0x30f717={'count':0x0,'rows':[]};return db[_0xb814('0x40')][_0xb814('0x68')]({'where':{'id':_0x5e966c[_0xb814('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b76fa,null))['then'](function(_0x28eaf8){if(_0x28eaf8){_0x5aabbe[_0xb814('0x44')]=_[_0xb814('0x47')](db[_0xb814('0x69')][_0xb814('0x6a')]);_0x5aabbe[_0xb814('0x46')]=_[_0xb814('0x47')](_0x5e966c[_0xb814('0x46')]);_0x5aabbe[_0xb814('0x4f')]=_[_0xb814('0x59')](_0x5aabbe[_0xb814('0x44')],_0x5aabbe[_0xb814('0x46')]);_0xee204[_0xb814('0x48')]=_[_0xb814('0x59')](_0x5aabbe[_0xb814('0x44')],qs['fields'](_0x5e966c[_0xb814('0x46')][_0xb814('0x49')]));_0xee204[_0xb814('0x48')]=_0xee204[_0xb814('0x48')][_0xb814('0x4a')]?_0xee204[_0xb814('0x48')]:_0x5aabbe['model'];if(!_0x5e966c[_0xb814('0x46')]['hasOwnProperty'](_0xb814('0x6b'))){_0xee204[_0xb814('0x33')]=qs[_0xb814('0x33')](_0x5e966c[_0xb814('0x46')][_0xb814('0x33')]);_0xee204['offset']=qs['offset'](_0x5e966c[_0xb814('0x46')][_0xb814('0x4c')]);}_0xee204[_0xb814('0x6c')]=qs[_0xb814('0x4d')](_0x5e966c['query'][_0xb814('0x4d')]);_0xee204['where']=qs[_0xb814('0x4f')](_[_0xb814('0x50')](_0x5e966c['query'],_0x5aabbe['filters']));_0xee204[_0xb814('0x4e')]['OpenchannelAccountId']=_0x28eaf8['id'];if(_0x5e966c[_0xb814('0x46')][_0xb814('0x51')]){_0xee204[_0xb814('0x4e')]=_[_0xb814('0x52')](_0xee204[_0xb814('0x4e')],{'$or':_[_0xb814('0x45')](_0xee204[_0xb814('0x48')],function(_0x4bd56c){var _0x1d37ea={};_0x1d37ea[_0x4bd56c]={'$like':'%'+_0x5e966c['query'][_0xb814('0x51')]+'%'};return _0x1d37ea;})});}_0xee204=_['merge']({},_0xee204,_0x5e966c[_0xb814('0x53')]);return db[_0xb814('0x69')]['count']({'where':_0xee204[_0xb814('0x4e')]})['then'](function(_0x37adec){_0x30f717[_0xb814('0x34')]=_0x37adec;if(_0x5e966c['query']['includeAll']){_0xee204[_0xb814('0x55')]=[{'all':!![]}];}return db[_0xb814('0x69')][_0xb814('0x56')](_0xee204);})[_0xb814('0x38')](function(_0x220f8b){_0x30f717[_0xb814('0x57')]=_0x220f8b;return _0x30f717;});}})[_0xb814('0x38')](respondWithFilteredResult(_0x1b76fa,_0xee204))[_0xb814('0x2d')](handleError(_0x1b76fa,null));};exports[_0xb814('0x6d')]=function(_0x34f49c,_0x53e705,_0x5b0fcd){return db['OpenchannelAccount']['find']({'where':{'id':_0x34f49c['params']['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x53e705,null))[_0xb814('0x38')](function(_0x3d87d2){if(_0x3d87d2){return _0x3d87d2['removeDispositions'](_0x34f49c[_0xb814('0x46')][_0xb814('0x6e')]);}})[_0xb814('0x38')](respondWithStatusCode(_0x53e705,null))[_0xb814('0x2d')](handleError(_0x53e705,null));};exports[_0xb814('0x6f')]=function(_0x35c18e,_0x3367b8,_0x1d9f13){if(_0x35c18e['body']['id']){delete _0x35c18e[_0xb814('0x64')]['id'];}return db[_0xb814('0x40')][_0xb814('0x5a')]({'where':{'id':_0x35c18e[_0xb814('0x58')]['id']}})['then'](handleEntityNotFound(_0x3367b8,null))[_0xb814('0x38')](function(_0x280af5){if(_0x280af5){_0x35c18e[_0xb814('0x64')][_0xb814('0x70')]=_0x280af5['id'];return db[_0xb814('0x71')]['create'](_0x35c18e['body']);}})[_0xb814('0x38')](respondWithResult(_0x3367b8,null))['catch'](handleError(_0x3367b8,null));};exports[_0xb814('0x72')]=function(_0x3882f8,_0x592aae,_0xc8f730){var _0x486495={'raw':![],'where':{}};var _0xe17e86={};var _0x520d0f={'count':0x0,'rows':[]};return db[_0xb814('0x40')][_0xb814('0x68')]({'where':{'id':_0x3882f8[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x592aae,null))[_0xb814('0x38')](function(_0x1ae812){if(_0x1ae812){_0xe17e86[_0xb814('0x44')]=_['keys'](db['CannedAnswer'][_0xb814('0x6a')]);_0xe17e86['query']=_['keys'](_0x3882f8[_0xb814('0x46')]);_0xe17e86[_0xb814('0x4f')]=_[_0xb814('0x59')](_0xe17e86['model'],_0xe17e86[_0xb814('0x46')]);_0x486495['attributes']=_[_0xb814('0x59')](_0xe17e86[_0xb814('0x44')],qs[_0xb814('0x49')](_0x3882f8[_0xb814('0x46')]['fields']));_0x486495[_0xb814('0x48')]=_0x486495[_0xb814('0x48')][_0xb814('0x4a')]?_0x486495['attributes']:_0xe17e86[_0xb814('0x44')];if(!_0x3882f8[_0xb814('0x46')][_0xb814('0x4b')]('nolimit')){_0x486495[_0xb814('0x33')]=qs[_0xb814('0x33')](_0x3882f8[_0xb814('0x46')][_0xb814('0x33')]);_0x486495[_0xb814('0x4c')]=qs[_0xb814('0x4c')](_0x3882f8[_0xb814('0x46')][_0xb814('0x4c')]);}_0x486495[_0xb814('0x6c')]=qs[_0xb814('0x4d')](_0x3882f8[_0xb814('0x46')][_0xb814('0x4d')]);_0x486495[_0xb814('0x4e')]=qs['filters'](_['pick'](_0x3882f8[_0xb814('0x46')],_0xe17e86['filters']));_0x486495[_0xb814('0x4e')][_0xb814('0x70')]=_0x1ae812['id'];if(_0x3882f8[_0xb814('0x46')][_0xb814('0x51')]){_0x486495[_0xb814('0x4e')]=_[_0xb814('0x52')](_0x486495[_0xb814('0x4e')],{'$or':_['map'](_0x486495['attributes'],function(_0x3f6df9){var _0x4f3125={};_0x4f3125[_0x3f6df9]={'$like':'%'+_0x3882f8[_0xb814('0x46')][_0xb814('0x51')]+'%'};return _0x4f3125;})});}_0x486495=_[_0xb814('0x52')]({},_0x486495,_0x3882f8['options']);return db[_0xb814('0x71')][_0xb814('0x34')]({'where':_0x486495[_0xb814('0x4e')]})[_0xb814('0x38')](function(_0x3860b8){_0x520d0f['count']=_0x3860b8;if(_0x3882f8[_0xb814('0x46')][_0xb814('0x54')]){_0x486495['include']=[{'all':!![]}];}return db[_0xb814('0x71')][_0xb814('0x56')](_0x486495);})[_0xb814('0x38')](function(_0x4b96a6){_0x520d0f[_0xb814('0x57')]=_0x4b96a6;return _0x520d0f;});}})[_0xb814('0x38')](respondWithFilteredResult(_0x592aae,_0x486495))['catch'](handleError(_0x592aae,null));};exports[_0xb814('0x73')]=function(_0x171f83,_0x5b5634,_0x6abce4){return db[_0xb814('0x40')][_0xb814('0x5a')]({'where':{'id':_0x171f83[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x5b5634,null))[_0xb814('0x38')](function(_0x40ae0b){if(_0x40ae0b){return _0x40ae0b[_0xb814('0x73')](_0x171f83[_0xb814('0x46')][_0xb814('0x6e')]);}})[_0xb814('0x38')](respondWithStatusCode(_0x5b5634,null))[_0xb814('0x2d')](handleError(_0x5b5634,null));};exports['notify']=function(_0x579deb,_0x1838b3,_0x5b13c8){var _0x5bda03={'body':_0x579deb[_0xb814('0x64')],'channel':'openchannel'};var _0x4f0427=[];var _0x50cb34=[];var _0x1044fa={};var _0x2ce4de=![];return db[_0xb814('0x74')]['describe']()[_0xb814('0x38')](function(_0x4dbe89){if(!_0x4dbe89){throw new db[(_0xb814('0x75'))][(_0xb814('0x76'))]('no\x20available\x20attributes');}_0x4f0427=_[_0xb814('0x77')](_['keys'](_0x4dbe89),[_0xb814('0x78'),_0xb814('0x79')]);_0x50cb34=_[_0xb814('0x77')](_[_0xb814('0x47')](_0x4dbe89),[_0xb814('0x78'),_0xb814('0x79'),_0xb814('0x7a'),_0xb814('0x7b')]);if(_0x579deb[_0xb814('0x64')]['id']){delete _0x579deb[_0xb814('0x64')]['id'];}if(_[_0xb814('0x7c')](_0x579deb[_0xb814('0x64')][_0xb814('0x7d')])){throw new db[(_0xb814('0x75'))][(_0xb814('0x76'))]('from\x20is\x20mandatory');}if(_[_0xb814('0x7c')](_0x579deb[_0xb814('0x64')]['body'])||_0x579deb[_0xb814('0x64')][_0xb814('0x64')]===''){throw new db[(_0xb814('0x75'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb814('0x7c')](_0x579deb['body'][_0xb814('0x7e')])){throw new db['Sequelize'][(_0xb814('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50cb34);}if(!_['includes'](_0x50cb34,_0x579deb[_0xb814('0x64')][_0xb814('0x7e')])){throw new db[(_0xb814('0x75'))][(_0xb814('0x76'))](_0xb814('0x7f')+_0x50cb34);}_0x1044fa[_0x579deb[_0xb814('0x64')][_0xb814('0x7e')]]=_0x579deb[_0xb814('0x64')][_0xb814('0x7d')];})[_0xb814('0x38')](function(){return db[_0xb814('0x40')]['find']({'where':{'id':_0x579deb[_0xb814('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xb814('0x80'),'include':[{'model':db[_0xb814('0x74')],'as':_0xb814('0x81'),'where':_0x1044fa,'limit':0x1,'order':[['updatedAt',_0xb814('0x82')]]}]},{'model':db[_0xb814('0x83')],'as':_0xb814('0x84')}]});})[_0xb814('0x38')](handleEntityNotFound(_0x1838b3,null))[_0xb814('0x38')](function(_0x2972b9){if(_0x2972b9&&_0x2972b9[_0xb814('0x80')]){_0x5bda03[_0xb814('0x85')]=_0x2972b9;_0x5bda03[_0xb814('0x86')]=_0x2972b9[_0xb814('0x84')];_0x5bda03[_0xb814('0x87')]=_0x2972b9[_0xb814('0x80')];_0x5bda03[_0xb814('0x86')]=_[_0xb814('0x88')](_0x5bda03[_0xb814('0x86')],['priority'],[_0xb814('0x89')]);if(_0x5bda03[_0xb814('0x85')][_0xb814('0x84')]){delete _0x5bda03['account']['Applications'];}if(_0x5bda03[_0xb814('0x85')]['List']&&_0x5bda03['account']['List']['Contacts'][_0xb814('0x4a')]){return _0x5bda03[_0xb814('0x85')]['List'][_0xb814('0x81')][0x0];}var _0x3ba2a0=_[_0xb814('0x1c')](_0x579deb[_0xb814('0x64')],{'firstName':_0x579deb[_0xb814('0x64')][_0xb814('0x7d')],'ListId':_0x2972b9[_0xb814('0x7b')]});_0x3ba2a0[_0x579deb[_0xb814('0x64')][_0xb814('0x7e')]]=_0x579deb[_0xb814('0x64')][_0xb814('0x7d')];return db['CmContact'][_0xb814('0x5b')](_0x3ba2a0,{'fields':_0x4f0427,'raw':!![]});}})['then'](handleEntityNotFound(_0x1838b3,null))[_0xb814('0x38')](function(_0x8c4544){_0x5bda03[_0xb814('0x8a')]=_0x8c4544;if(_0x8c4544){var _0xa7ff62={'ContactId':_0x8c4544['id'],'OpenchannelAccountId':_0x579deb[_0xb814('0x58')]['id'],'from':(_0x8c4544[_0xb814('0x8b')]||'')+'\x20'+(_0x8c4544[_0xb814('0x8c')]||'')};var _0x4125ed={'OpenchannelAccountId':_0x579deb['params']['id'],'closed':![]};if(_0x579deb['body']['threadId']){_0x4125ed[_0xb814('0x8d')]=_0x579deb[_0xb814('0x64')][_0xb814('0x8d')];return db[_0xb814('0x8e')][_0xb814('0x5a')]({'where':_0x4125ed})[_0xb814('0x38')](function(_0x42c0cd){if(_0x42c0cd){return[_0x42c0cd,![]];}_0xa7ff62[_0xb814('0x8d')]=_0x579deb[_0xb814('0x64')][_0xb814('0x8d')];_0xa7ff62['externalUrl']=_0x579deb['body'][_0xb814('0x8f')];return db[_0xb814('0x8e')][_0xb814('0x5b')](_0xa7ff62)[_0xb814('0x38')](function(_0x3f0c9c){return[_0x3f0c9c,!![]];});});}else{_0x4125ed[_0xb814('0x8d')]=null;}_0x4125ed['ContactId']=_0x8c4544['id'];return db[_0xb814('0x8e')]['find']({'where':_0x4125ed})[_0xb814('0x38')](function(_0x27b898){if(_0x27b898){return[_0x27b898,![]];}return db[_0xb814('0x8e')][_0xb814('0x5b')](_0xa7ff62)[_0xb814('0x38')](function(_0x2c2238){return[_0x2c2238,!![]];});});}})[_0xb814('0x90')](function(_0x4deb51,_0x2f6633){if(_0x4deb51){_0x2ce4de=_0x2f6633;if(!_0x2f6633){var _0x217fbd={'from':(_0x5bda03[_0xb814('0x8a')][_0xb814('0x8b')]||'')+'\x20'+(_0x5bda03['contact'][_0xb814('0x8c')]||'')};if(_0x579deb[_0xb814('0x64')][_0xb814('0x8d')]&&_0x579deb[_0xb814('0x64')][_0xb814('0x91')]&&_0x579deb['body'][_0xb814('0x8d')]!=_0x579deb[_0xb814('0x64')][_0xb814('0x91')]){_0x217fbd['threadId']=_0x579deb[_0xb814('0x64')]['messageId'];}return _0x4deb51[_0xb814('0x92')](_0x217fbd);}else{return _0x4deb51;}}})['then'](function(_0x22f6f1){_0x5bda03[_0xb814('0x93')]=_0x22f6f1[_0xb814('0x39')]({'plain':!![]});_0x5bda03[_0xb814('0x93')]['created']=_0x2ce4de;if(_0x5bda03[_0xb814('0x93')][_0xb814('0x94')]){if(_0x5bda03[_0xb814('0x85')][_0xb814('0x95')]){_0x5bda03[_0xb814('0x86')][_0xb814('0x96')]({'id':0x0,'priority':_0x5bda03[_0xb814('0x86')][_0xb814('0x4a')]+0x1,'app':_0xb814('0x97'),'appdata':_0xb814('0x98'),'interval':_0xb814('0x99')});}}return db[_0xb814('0x9a')][_0xb814('0x5b')]({'body':_0x579deb[_0xb814('0x64')][_0xb814('0x64')],'OpenchannelAccountId':_0x579deb['params']['id'],'OpenchannelInteractionId':_0x22f6f1['id'],'direction':'in','ContactId':_0x5bda03[_0xb814('0x8a')]['id'],'AttachmentId':_0x579deb[_0xb814('0x64')][_0xb814('0x9b')]});})[_0xb814('0x38')](function(_0x4017b6){_0x5bda03[_0xb814('0x2a')]=_0x4017b6;if(!_0x5bda03['interaction'][_0xb814('0x9c')])return;return db[_0xb814('0x9d')][_0xb814('0x5a')]({'attributes':['id',_0xb814('0x3c')],'where':{'id':_0x5bda03['interaction']['UserId']}});})[_0xb814('0x38')](function(_0x1f05c9){if(_0x1f05c9){_0x5bda03[_0xb814('0x86')][_0xb814('0x9e')]({'id':0x0,'priority':0x0,'app':_0xb814('0x9f'),'appdata':_0x1f05c9[_0xb814('0x3c')]+','+(_0x5bda03['account'][_0xb814('0xa0')]||0xa),'interval':_0xb814('0x99')});}if(!_0x5bda03[_0xb814('0x93')][_0xb814('0xa1')])return;return db['OpenchannelQueue'][_0xb814('0x5a')]({'attributes':['id',_0xb814('0x3c')],'where':{'id':_0x5bda03[_0xb814('0x93')][_0xb814('0xa1')]}});})[_0xb814('0x38')](function(_0x57b503){if(_0x57b503){_0x5bda03[_0xb814('0x86')][_0xb814('0x9e')]({'id':0x0,'priority':0x1,'app':_0xb814('0xa2'),'appdata':_0x57b503[_0xb814('0x3c')]+','+(_0x5bda03[_0xb814('0x85')][_0xb814('0xa3')]||0x12c),'interval':_0xb814('0x99')});}return respondWithRpcPromise(_0xb814('0xa4'),_0xb814('0xa5'),_0x5bda03);})[_0xb814('0x38')](function(_0x46599e){respondWithRpcPromise(_0xb814('0xa6'),_0xb814('0xa6'),{'event':'notify','message':_0x46599e},client9002);return _0x46599e;})['then'](respondWithResult(_0x1838b3,null))[_0xb814('0x2d')](handleError(_0x1838b3,null));};exports[_0xb814('0xa7')]=function(_0x1a32c7,_0x5aaa73){var _0x8517f1=_0x1a32c7[_0xb814('0x58')]['id'];var _0x3fe3d2=_0x1a32c7['body'];var _0x10537d=0xc8;var _0xa651a=null;return db[_0xb814('0xa8')][_0xb814('0xa9')]({'isolationLevel':db[_0xb814('0xa8')][_0xb814('0xaa')]['ISOLATION_LEVELS'][_0xb814('0xab')]},function(_0x4f7baa){return db[_0xb814('0x40')]['findOne']({'where':{'id':_0x8517f1},'transaction':_0x4f7baa})[_0xb814('0x38')](function(_0xc59d5a){if(_0xc59d5a){return db[_0xb814('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x8517f1},'transaction':_0x4f7baa})[_0xb814('0x38')](function(){var _0x2114c2=_[_0xb814('0x45')](_0x3fe3d2,function(_0x5787de){_0x5787de[_0xb814('0x70')]=_0x8517f1;return _0x5787de;});return db['OpenchannelApplication'][_0xb814('0xac')](_0x2114c2,{'transaction':_0x4f7baa});});}else{_0x10537d=0x194;_0xa651a=[];}});})[_0xb814('0x38')](function(){if(_0x10537d!==0x194){return db[_0xb814('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x8517f1},'order':_0xb814('0xad')})[_0xb814('0x38')](function(_0xc0eb21){_0xa651a=_0xc0eb21;});}})[_0xb814('0x2d')](function(_0x5edbe5){_0x10537d=0x1f4;logger[_0xb814('0x27')](_0x5edbe5[_0xb814('0xae')]);if(_0x5edbe5[_0xb814('0x3c')]){delete _0x5edbe5[_0xb814('0x3c')];}_0xa651a=_0x5edbe5;})[_0xb814('0xaf')](function(){if(_0xa651a===null){_0x5aaa73[_0xb814('0x2e')](_0x10537d);}else{if(_0x10537d===0x1f4){_0x5aaa73[_0xb814('0x2f')](_0x10537d)[_0xb814('0x3d')](_0xa651a);}else{_0x5aaa73[_0xb814('0x2f')](_0x10537d)['json'](_0xa651a);}}});};exports[_0xb814('0xb0')]=function(_0x40ad9a,_0x899965,_0x4bd78e){var _0xecdaf4={};var _0x54f6c1={};var _0x4bc492;var _0x4addae;return db[_0xb814('0x40')]['findOne']({'where':{'id':_0x40ad9a[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x899965,null))['then'](function(_0x5b6325){if(_0x5b6325){_0x4bc492=_0x5b6325;_0x54f6c1[_0xb814('0x44')]=_['keys'](db[_0xb814('0x83')]['rawAttributes']);_0x54f6c1[_0xb814('0x46')]=_[_0xb814('0x47')](_0x40ad9a[_0xb814('0x46')]);_0x54f6c1['filters']=_['intersection'](_0x54f6c1['model'],_0x54f6c1[_0xb814('0x46')]);_0xecdaf4['attributes']=_['intersection'](_0x54f6c1[_0xb814('0x44')],qs['fields'](_0x40ad9a['query']['fields']));_0xecdaf4[_0xb814('0x48')]=_0xecdaf4[_0xb814('0x48')][_0xb814('0x4a')]?_0xecdaf4['attributes']:_0x54f6c1[_0xb814('0x44')];_0xecdaf4[_0xb814('0x6c')]=qs[_0xb814('0x4d')](_0x40ad9a[_0xb814('0x46')][_0xb814('0x4d')]);_0xecdaf4[_0xb814('0x4e')]=qs['filters'](_[_0xb814('0x50')](_0x40ad9a[_0xb814('0x46')],_0x54f6c1[_0xb814('0x4f')]));if(_0x40ad9a[_0xb814('0x46')]['filter']){_0xecdaf4[_0xb814('0x4e')]=_[_0xb814('0x52')](_0xecdaf4[_0xb814('0x4e')],{'$or':_[_0xb814('0x45')](_0xecdaf4[_0xb814('0x48')],function(_0x2cb01d){var _0x1f4540={};_0x1f4540[_0x2cb01d]={'$like':'%'+_0x40ad9a[_0xb814('0x46')][_0xb814('0x51')]+'%'};return _0x1f4540;})});}_0xecdaf4=_[_0xb814('0x52')]({},_0xecdaf4,_0x40ad9a['options']);return _0x4bc492[_0xb814('0xb0')](_0xecdaf4);}})[_0xb814('0x38')](function(_0x5706ad){if(_0x5706ad){_0x4addae=_0x5706ad[_0xb814('0x4a')];if(!_0x40ad9a['query'][_0xb814('0x4b')](_0xb814('0x6b'))){_0xecdaf4['limit']=qs[_0xb814('0x33')](_0x40ad9a['query'][_0xb814('0x33')]);_0xecdaf4[_0xb814('0x4c')]=qs[_0xb814('0x4c')](_0x40ad9a[_0xb814('0x46')][_0xb814('0x4c')]);}return _0x4bc492['getApplications'](_0xecdaf4);}})[_0xb814('0x38')](function(_0x5cfdec){if(_0x5cfdec){return _0x5cfdec?{'count':_0x4addae,'rows':_0x5cfdec}:null;}})[_0xb814('0x38')](respondWithResult(_0x899965,null))[_0xb814('0x2d')](handleError(_0x899965,null));};exports[_0xb814('0xb1')]=function(_0x7e9160,_0x15f2db,_0x1fd156){var _0x19c4db={'raw':![],'where':{}};var _0xca1f74={};var _0x18d39c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb814('0x68')]({'where':{'id':_0x7e9160[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x15f2db,null))[_0xb814('0x38')](function(_0x4ef481){if(_0x4ef481){_0xca1f74[_0xb814('0x44')]=_[_0xb814('0x47')](db['OpenchannelInteraction'][_0xb814('0x6a')]);_0xca1f74['query']=_['keys'](_0x7e9160['query']);_0xca1f74[_0xb814('0x4f')]=_[_0xb814('0x59')](_0xca1f74[_0xb814('0x44')],_0xca1f74[_0xb814('0x46')]);_0x19c4db[_0xb814('0x48')]=_['intersection'](_0xca1f74[_0xb814('0x44')],qs[_0xb814('0x49')](_0x7e9160['query'][_0xb814('0x49')]));_0x19c4db['attributes']=_0x19c4db[_0xb814('0x48')][_0xb814('0x4a')]?_0x19c4db[_0xb814('0x48')]:_0xca1f74[_0xb814('0x44')];if(!_0x7e9160[_0xb814('0x46')][_0xb814('0x4b')]('nolimit')){_0x19c4db['limit']=qs[_0xb814('0x33')](_0x7e9160['query'][_0xb814('0x33')]);_0x19c4db['offset']=qs[_0xb814('0x4c')](_0x7e9160[_0xb814('0x46')][_0xb814('0x4c')]);}_0x19c4db[_0xb814('0x6c')]=qs['sort'](_0x7e9160[_0xb814('0x46')]['sort']);_0x19c4db['where']=qs[_0xb814('0x4f')](_[_0xb814('0x50')](_0x7e9160['query'],_0xca1f74[_0xb814('0x4f')]));_0x19c4db[_0xb814('0x4e')][_0xb814('0x70')]=_0x4ef481['id'];if(_0x7e9160[_0xb814('0x46')]['filter']){_0x19c4db[_0xb814('0x4e')]=_[_0xb814('0x52')](_0x19c4db[_0xb814('0x4e')],{'$or':_[_0xb814('0x45')](_0x19c4db[_0xb814('0x48')],function(_0x1fd331){var _0x324b75={};_0x324b75[_0x1fd331]={'$like':'%'+_0x7e9160[_0xb814('0x46')][_0xb814('0x51')]+'%'};return _0x324b75;})});}_0x19c4db=_[_0xb814('0x52')]({},_0x19c4db,_0x7e9160[_0xb814('0x53')]);return db[_0xb814('0x8e')][_0xb814('0x34')]({'where':_0x19c4db['where']})[_0xb814('0x38')](function(_0x12d923){_0x18d39c[_0xb814('0x34')]=_0x12d923;if(_0x7e9160[_0xb814('0x46')][_0xb814('0x54')]){_0x19c4db[_0xb814('0x55')]=[{'model':db[_0xb814('0x74')],'as':_0xb814('0xb2'),'required':![]},{'model':db['User'],'as':_0xb814('0xb3'),'attributes':[_0xb814('0x3c'),_0xb814('0xb4'),_0xb814('0xb5')],'required':![]},{'model':db[_0xb814('0xb6')],'as':_0xb814('0xb7'),'attributes':['id',_0xb814('0x3c'),_0xb814('0xb8')],'where':_0x7e9160['query'][_0xb814('0xb9')]?{'id':_0x7e9160['query']['tag']}:undefined,'required':_0x7e9160[_0xb814('0x46')]['tag']?!![]:![]}];}return db[_0xb814('0x8e')][_0xb814('0x56')](_0x19c4db);})[_0xb814('0x38')](function(_0x49a4b9){_0x18d39c[_0xb814('0x57')]=_0x49a4b9;return _0x18d39c;});}})[_0xb814('0x38')](respondWithFilteredResult(_0x15f2db,_0x19c4db))[_0xb814('0x2d')](handleError(_0x15f2db,null));};exports[_0xb814('0xba')]=function(_0x21e6c7,_0x53bc63,_0x1dafa9){return db[_0xb814('0x40')][_0xb814('0x5a')]({'where':{'id':_0x21e6c7['params']['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x53bc63,null))[_0xb814('0x38')](function(_0x3fc239){if(_0x3fc239){return _0x3fc239[_0xb814('0xba')](_0x21e6c7[_0xb814('0x64')][_0xb814('0x6e')],_['omit'](_0x21e6c7[_0xb814('0x64')],[_0xb814('0x6e'),'id'])||{})[_0xb814('0x90')](function(_0x4dd486){for(var _0x4b0adb=0x0;_0x4b0adb<_0x21e6c7[_0xb814('0x64')][_0xb814('0x6e')][_0xb814('0x4a')];_0x4b0adb+=0x1){socket[_0xb814('0xbb')]('userOpenchannelAccount:save',{'UserId':Number(_0x21e6c7[_0xb814('0x64')]['ids'][_0x4b0adb]),'OpenchannelAccountId':Number(_0x21e6c7['params']['id'])});}return _0x4dd486;});}})['then'](respondWithResult(_0x53bc63,null))[_0xb814('0x2d')](handleError(_0x53bc63,null));};exports[_0xb814('0xbc')]=function(_0xdcb11d,_0x46ab58,_0x3d5ca4){return db['OpenchannelAccount'][_0xb814('0x5a')]({'where':{'id':_0xdcb11d[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x46ab58,null))[_0xb814('0x38')](function(_0x25fc23){if(_0x25fc23){return _0x25fc23[_0xb814('0xbc')](_0xdcb11d[_0xb814('0x46')]['ids'])['then'](function(){if(_['isArray'](_0xdcb11d[_0xb814('0x46')]['ids'])){for(var _0x1da04c=0x0;_0x1da04c<_0xdcb11d[_0xb814('0x46')][_0xb814('0x6e')]['length'];_0x1da04c+=0x1){socket[_0xb814('0xbb')](_0xb814('0xbd'),{'UserId':Number(_0xdcb11d['query'][_0xb814('0x6e')][_0x1da04c]),'OpenchannelAccountId':Number(_0xdcb11d[_0xb814('0x58')]['id'])});}}else{socket[_0xb814('0xbb')](_0xb814('0xbd'),{'UserId':Number(_0xdcb11d[_0xb814('0x46')][_0xb814('0x6e')]),'OpenchannelAccountId':Number(_0xdcb11d[_0xb814('0x58')]['id'])});}});}})[_0xb814('0x38')](respondWithStatusCode(_0x46ab58,null))[_0xb814('0x2d')](handleError(_0x46ab58,null));};exports[_0xb814('0xbe')]=function(_0x5ba901,_0x35eaa8,_0x59df7a){var _0x11c5b1={};var _0x1e292f={};var _0x335417;var _0x1c5a3b;return db[_0xb814('0x40')]['findOne']({'where':{'id':_0x5ba901[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x35eaa8,null))[_0xb814('0x38')](function(_0x4827f4){if(_0x4827f4){_0x335417=_0x4827f4;_0x1e292f[_0xb814('0x44')]=_[_0xb814('0x47')](db[_0xb814('0x9d')][_0xb814('0x6a')]);_0x1e292f[_0xb814('0x46')]=_[_0xb814('0x47')](_0x5ba901[_0xb814('0x46')]);_0x1e292f[_0xb814('0x4f')]=_[_0xb814('0x59')](_0x1e292f[_0xb814('0x44')],_0x1e292f[_0xb814('0x46')]);_0x11c5b1[_0xb814('0x48')]=_[_0xb814('0x59')](_0x1e292f[_0xb814('0x44')],qs[_0xb814('0x49')](_0x5ba901[_0xb814('0x46')]['fields']));_0x11c5b1[_0xb814('0x48')]=_0x11c5b1[_0xb814('0x48')][_0xb814('0x4a')]?_0x11c5b1[_0xb814('0x48')]:_0x1e292f[_0xb814('0x44')];_0x11c5b1[_0xb814('0x6c')]=qs['sort'](_0x5ba901[_0xb814('0x46')][_0xb814('0x4d')]);_0x11c5b1[_0xb814('0x4e')]=qs[_0xb814('0x4f')](_[_0xb814('0x50')](_0x5ba901[_0xb814('0x46')],_0x1e292f[_0xb814('0x4f')]));if(_0x5ba901[_0xb814('0x46')][_0xb814('0x51')]){_0x11c5b1[_0xb814('0x4e')]=_[_0xb814('0x52')](_0x11c5b1[_0xb814('0x4e')],{'$or':_[_0xb814('0x45')](_0x11c5b1[_0xb814('0x48')],function(_0x5b59cb){var _0x1e3080={};_0x1e3080[_0x5b59cb]={'$like':'%'+_0x5ba901[_0xb814('0x46')][_0xb814('0x51')]+'%'};return _0x1e3080;})});}_0x11c5b1=_[_0xb814('0x52')]({},_0x11c5b1,_0x5ba901[_0xb814('0x53')]);return _0x335417[_0xb814('0xbe')](_0x11c5b1);}})[_0xb814('0x38')](function(_0x271495){if(_0x271495){_0x1c5a3b=_0x271495['length'];if(!_0x5ba901['query'][_0xb814('0x4b')](_0xb814('0x6b'))){_0x11c5b1[_0xb814('0x33')]=qs[_0xb814('0x33')](_0x5ba901[_0xb814('0x46')]['limit']);_0x11c5b1[_0xb814('0x4c')]=qs[_0xb814('0x4c')](_0x5ba901[_0xb814('0x46')][_0xb814('0x4c')]);}return _0x335417['getAgents'](_0x11c5b1);}})['then'](function(_0x62b454){if(_0x62b454){return _0x62b454?{'count':_0x1c5a3b,'rows':_0x62b454}:null;}})[_0xb814('0x38')](respondWithResult(_0x35eaa8,null))[_0xb814('0x2d')](handleError(_0x35eaa8,null));};exports['send']=function(_0x22f33c,_0x3f5d37,_0x8d09e8){var _0x1224bd,_0x58eb6d,_0x5665b7;if(_[_0xb814('0x7c')](_0x22f33c[_0xb814('0x64')][_0xb814('0x64')])||_0x22f33c['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0xb814('0xbf'));}if(_[_0xb814('0x7c')](_0x22f33c['body']['to'])){}_0x1224bd=_0x22f33c[_0xb814('0x64')]['to'];return db[_0xb814('0x40')][_0xb814('0x68')]({'where':{'id':_0x22f33c[_0xb814('0x58')]['id']}})[_0xb814('0x38')](handleEntityNotFound(_0x3f5d37,null))[_0xb814('0x38')](function(_0xfce403){if(_0xfce403){return db['OpenchannelAccount'][_0xb814('0x5a')]({'where':{'id':_0xfce403['id']},'include':[{'model':db[_0xb814('0xc0')],'as':_0xb814('0x80'),'include':[{'model':db[_0xb814('0x74')],'as':_0xb814('0x81'),'where':{[_0xfce403[_0xb814('0x7e')]]:_0x1224bd},'limit':0x1,'order':[[_0xb814('0x79'),_0xb814('0x82')]]}]}]})[_0xb814('0x38')](handleEntityNotFound(_0x3f5d37,null))[_0xb814('0x38')](function(_0x4980b0){if(_0x4980b0&&_0x4980b0[_0xb814('0x80')]){_0x58eb6d=_0x4980b0['get']({'plain':!![]});if(_0x58eb6d[_0xb814('0x80')]&&_0x58eb6d['List']['Contacts'][_0xb814('0x4a')]){return _0x58eb6d['List']['Contacts'][0x0];}return db[_0xb814('0x74')][_0xb814('0x5b')](_[_0xb814('0x1c')](_0x22f33c['body'],{'firstName':_0x1224bd,[_0x4980b0['mapKey']]:_0x1224bd,'phone':_0x1224bd,'ListId':_0x58eb6d[_0xb814('0x7b')]}));}})[_0xb814('0x38')](handleEntityNotFound(_0x3f5d37,null))['then'](function(_0x15495c){if(_0x15495c){_0x5665b7=_0x15495c;return db[_0xb814('0x8e')][_0xb814('0x5a')]({'where':{'ContactId':_0x5665b7['id'],'closed':![],'OpenchannelAccountId':_0x58eb6d['id']}})[_0xb814('0x38')](function(_0x37b356){if(_0x37b356){return[_0x37b356,![]];}return db['OpenchannelInteraction'][_0xb814('0x5b')]({'UserId':_0x22f33c['user']['id'],'ContactId':_0x5665b7['id'],'OpenchannelAccountId':_0x58eb6d['id'],'lastMsgDirection':_0xb814('0xc1'),'firstMsgDirection':_0xb814('0xc1'),'Messages':[_[_0xb814('0x52')](_0x22f33c[_0xb814('0x64')],{'read':![],'body':_0x22f33c[_0xb814('0x64')][_0xb814('0x64')],'OpenchannelAccountId':_0x58eb6d['id'],'UserId':_0x22f33c[_0xb814('0x5c')]['id'],'ContactId':_0x5665b7['id']})]},{'include':[{'model':db[_0xb814('0x9a')],'as':_0xb814('0xc2')}]})[_0xb814('0x38')](function(_0x433cb0){return[_0x433cb0,!![]];});});}})['spread'](function(_0x2fef1b,_0xd8cbd5){if(_0xd8cbd5){return _0x2fef1b;}return db[_0xb814('0x9a')][_0xb814('0x5b')](_[_0xb814('0x52')](_0x22f33c[_0xb814('0x64')],{'read':![],'body':_0x22f33c['body'][_0xb814('0x64')],'OpenchannelAccountId':_0x58eb6d['id'],'OpenchannelInteractionId':_0x2fef1b['id'],'UserId':_0x22f33c['user']['id'],'ContactId':_0x5665b7['id']}))[_0xb814('0x38')](function(_0x20d49b){_0x2fef1b[_0xb814('0xc3')][_0xb814('0xc2')]=[];_0x2fef1b[_0xb814('0xc3')][_0xb814('0xc2')]['push'](_0x20d49b['dataValues']);return _0x2fef1b;});});}})[_0xb814('0x38')](respondWithResult(_0x3f5d37,null))[_0xb814('0x2d')](handleError(_0x3f5d37,null));}; \ No newline at end of file +var _0x6c45=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','end','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','map','query','keys','model','attributes','fields','length','order','sort','filters','filter','merge','options','count','includeAll','include','findAll','rows','show','Pause','intersection','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','params','describe','OpenchannelAccountId','Disposition','getDispositions','where','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','nolimit','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','sendStatus','json','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','omit','emit','userOpenchannelAccount:save','removeAgents','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xc8514f,_0x28fc5f){var _0x365c4c=function(_0x1df022){while(--_0x1df022){_0xc8514f['push'](_0xc8514f['shift']());}};_0x365c4c(++_0x28fc5f);}(_0x6c45,0xb1));var _0x56c4=function(_0x149002,_0x15e57b){_0x149002=_0x149002-0x0;var _0xfc81a9=_0x6c45[_0x149002];return _0xfc81a9;};'use strict';var emlformat=require(_0x56c4('0x0'));var rimraf=require(_0x56c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56c4('0x2'));var rp=require(_0x56c4('0x3'));var moment=require(_0x56c4('0x4'));var BPromise=require(_0x56c4('0x5'));var Mustache=require(_0x56c4('0x6'));var util=require(_0x56c4('0x7'));var path=require(_0x56c4('0x8'));var sox=require(_0x56c4('0x9'));var csv=require(_0x56c4('0xa'));var ejs=require(_0x56c4('0xb'));var fs=require('fs');var fs_extra=require(_0x56c4('0xc'));var _=require(_0x56c4('0xd'));var squel=require(_0x56c4('0xe'));var crypto=require(_0x56c4('0xf'));var jsforce=require(_0x56c4('0x10'));var deskjs=require(_0x56c4('0x11'));var toCsv=require(_0x56c4('0xa'));var querystring=require(_0x56c4('0x12'));var Papa=require(_0x56c4('0x13'));var Redis=require(_0x56c4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x56c4('0x15'));var as=require(_0x56c4('0x16'));var hardwareService=require(_0x56c4('0x17'));var logger=require(_0x56c4('0x18'))('api');var utils=require(_0x56c4('0x19'));var config=require(_0x56c4('0x1a'));var licenseUtil=require(_0x56c4('0x1b'));var db=require(_0x56c4('0x1c'))['db'];config['redis']=_[_0x56c4('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56c4('0x1e'))(new Redis(config[_0x56c4('0x1f')]));require(_0x56c4('0x20'))[_0x56c4('0x21')](socket);var jayson=require(_0x56c4('0x22'));var client=jayson['client'][_0x56c4('0x23')]({'port':0x232c});var client9002=jayson[_0x56c4('0x24')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b7664,_0xd0dd01,_0x2bd3c3,_0x2f0bb2){return new BPromise(function(_0x5c54bd,_0xaa6cfa){var _0x2b2e69=_0x2f0bb2||client;return _0x2b2e69['request'](_0x9b7664,_0x2bd3c3)[_0x56c4('0x25')](function(_0x73ebc7){logger[_0x56c4('0x26')](_0x56c4('0x27'),_0xd0dd01,'request\x20sent');logger[_0x56c4('0x28')](_0x56c4('0x29'),_0xd0dd01,_0x56c4('0x2a'),JSON[_0x56c4('0x2b')](_0x73ebc7));if(_0x73ebc7[_0x56c4('0x2c')]){if(_0x73ebc7[_0x56c4('0x2c')]['code']===0x1f4){logger['error'](_0x56c4('0x27'),_0xd0dd01,_0x73ebc7[_0x56c4('0x2c')]['message']);return _0xaa6cfa(_0x73ebc7[_0x56c4('0x2c')][_0x56c4('0x2d')]);}logger[_0x56c4('0x2c')](_0x56c4('0x27'),_0xd0dd01,_0x73ebc7[_0x56c4('0x2c')][_0x56c4('0x2d')]);return _0x5c54bd(_0x73ebc7[_0x56c4('0x2c')]['message']);}else{logger[_0x56c4('0x26')](_0x56c4('0x27'),_0xd0dd01,_0x56c4('0x2a'));_0x5c54bd(_0x73ebc7['result'][_0x56c4('0x2d')]);}})['catch'](function(_0x213cc6){logger[_0x56c4('0x2c')]('OpenchannelAccount,\x20%s,\x20%s',_0xd0dd01,_0x213cc6);_0xaa6cfa(_0x213cc6);});});}function respondWithStatusCode(_0x148268,_0x292b66){_0x292b66=_0x292b66||0xcc;return function(_0x51dcf8){if(_0x51dcf8){return _0x148268['sendStatus'](_0x292b66);}return _0x148268['status'](_0x292b66)[_0x56c4('0x2e')]();};}function respondWithResult(_0x2ac814,_0x3fe97d){_0x3fe97d=_0x3fe97d||0xc8;return function(_0x514d96){if(_0x514d96){return _0x2ac814[_0x56c4('0x2f')](_0x3fe97d)['json'](_0x514d96);}};}function respondWithFilteredResult(_0x4ce20d,_0x5f9cc){return function(_0x461b3a){if(_0x461b3a){var _0x45f4ee=typeof _0x5f9cc[_0x56c4('0x30')]===_0x56c4('0x31')&&typeof _0x5f9cc[_0x56c4('0x32')]===_0x56c4('0x31');var _0x3c8db4=_0x461b3a['count'];var _0x36f430=_0x45f4ee?0x0:_0x5f9cc[_0x56c4('0x30')];var _0x3af58b=_0x45f4ee?_0x461b3a['count']:_0x5f9cc[_0x56c4('0x30')]+_0x5f9cc[_0x56c4('0x32')];var _0x3894ba;if(_0x3af58b>=_0x3c8db4){_0x3af58b=_0x3c8db4;_0x3894ba=0xc8;}else{_0x3894ba=0xce;}_0x4ce20d['status'](_0x3894ba);return _0x4ce20d[_0x56c4('0x33')](_0x56c4('0x34'),_0x36f430+'-'+_0x3af58b+'/'+_0x3c8db4)['json'](_0x461b3a);}return null;};}function patchUpdates(_0x3de2e7){return function(_0x5f1e92){try{jsonpatch[_0x56c4('0x35')](_0x5f1e92,_0x3de2e7,!![]);}catch(_0x4157cd){return BPromise[_0x56c4('0x36')](_0x4157cd);}return _0x5f1e92[_0x56c4('0x37')]();};}function saveUpdates(_0x2dfa7b,_0x4985f2){return function(_0x5533cc){if(_0x5533cc){return _0x5533cc[_0x56c4('0x38')](_0x2dfa7b)[_0x56c4('0x25')](function(_0x420bb0){return _0x420bb0;});}return null;};}function removeEntity(_0x33a9e7,_0x35460d){return function(_0x4abe0f){if(_0x4abe0f){return _0x4abe0f[_0x56c4('0x39')]()[_0x56c4('0x25')](function(){var _0x373129=_0x4abe0f[_0x56c4('0x3a')]({'plain':!![]});var _0x2cb8a5=_0x56c4('0x3b');return db[_0x56c4('0x3c')]['destroy']({'where':{'type':_0x2cb8a5,'resourceId':_0x373129['id']}})['then'](function(){return _0x4abe0f;});})[_0x56c4('0x25')](function(){_0x33a9e7[_0x56c4('0x2f')](0xcc)[_0x56c4('0x2e')]();});}};}function handleEntityNotFound(_0x35e481,_0xca8997){return function(_0x5b7c01){if(!_0x5b7c01){_0x35e481['sendStatus'](0x194);}return _0x5b7c01;};}function handleError(_0x382f79,_0x547a86){_0x547a86=_0x547a86||0x1f4;return function(_0x18be52){logger[_0x56c4('0x2c')](_0x18be52[_0x56c4('0x3d')]);if(_0x18be52[_0x56c4('0x3e')]){delete _0x18be52['name'];}_0x382f79[_0x56c4('0x2f')](_0x547a86)[_0x56c4('0x3f')](_0x18be52);};}exports[_0x56c4('0x40')]=function(_0x14cc7a,_0x4ec104){var _0xf2bdac={'include':[{'model':db['Pause'],'as':_0x56c4('0x41')}]},_0x120713={},_0x5bdf0a={'count':0x0,'rows':[]};var _0x2479a1=_['map'](db[_0x56c4('0x42')][_0x56c4('0x43')],function(_0x546ec9){return{'name':_0x546ec9[_0x56c4('0x44')],'type':_0x546ec9[_0x56c4('0x45')]['key']};});_0x120713['model']=_[_0x56c4('0x46')](_0x2479a1,_0x56c4('0x3e'));_0x120713[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x14cc7a['query']);_0x120713['filters']=_['intersection'](_0x120713[_0x56c4('0x49')],_0x120713[_0x56c4('0x47')]);_0xf2bdac[_0x56c4('0x4a')]=_['intersection'](_0x120713[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x14cc7a['query'][_0x56c4('0x4b')]));_0xf2bdac[_0x56c4('0x4a')]=_0xf2bdac[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0xf2bdac[_0x56c4('0x4a')]:_0x120713[_0x56c4('0x49')];if(!_0x14cc7a[_0x56c4('0x47')]['hasOwnProperty']('nolimit')){_0xf2bdac[_0x56c4('0x32')]=qs['limit'](_0x14cc7a['query'][_0x56c4('0x32')]);_0xf2bdac['offset']=qs[_0x56c4('0x30')](_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x30')]);}_0xf2bdac[_0x56c4('0x4d')]=qs['sort'](_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x4e')]);_0xf2bdac['where']=qs['filters'](_['pick'](_0x14cc7a['query'],_0x120713[_0x56c4('0x4f')]),_0x2479a1);if(_0x14cc7a['query'][_0x56c4('0x50')]){_0xf2bdac['where']=_[_0x56c4('0x51')](_0xf2bdac['where'],{'$or':_[_0x56c4('0x46')](_0x2479a1,function(_0x593a2d){if(_0x593a2d[_0x56c4('0x45')]!=='VIRTUAL'){var _0x5950e5={};_0x5950e5[_0x593a2d[_0x56c4('0x3e')]]={'$like':'%'+_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x5950e5;}})});}_0xf2bdac=_[_0x56c4('0x51')]({},_0xf2bdac,_0x14cc7a[_0x56c4('0x52')]);var _0x177a39={'where':_0xf2bdac['where']};return db[_0x56c4('0x42')][_0x56c4('0x53')](_0x177a39)[_0x56c4('0x25')](function(_0x3219d3){_0x5bdf0a[_0x56c4('0x53')]=_0x3219d3;if(_0x14cc7a[_0x56c4('0x47')][_0x56c4('0x54')]){_0xf2bdac[_0x56c4('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x56c4('0x56')](_0xf2bdac);})[_0x56c4('0x25')](function(_0x5f44d2){_0x5bdf0a[_0x56c4('0x57')]=_0x5f44d2;return _0x5bdf0a;})[_0x56c4('0x25')](respondWithFilteredResult(_0x4ec104,_0xf2bdac))['catch'](handleError(_0x4ec104,null));};exports[_0x56c4('0x58')]=function(_0x3b0618,_0xad66b8){var _0x227001={'raw':![],'where':{'id':_0x3b0618['params']['id']},'include':[{'model':db[_0x56c4('0x59')],'as':'mandatoryDispositionPause'}]},_0x68dbe={};_0x68dbe[_0x56c4('0x49')]=_[_0x56c4('0x48')](db['OpenchannelAccount'][_0x56c4('0x43')]);_0x68dbe[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x3b0618['query']);_0x68dbe[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x68dbe[_0x56c4('0x49')],_0x68dbe['query']);_0x227001['attributes']=_[_0x56c4('0x5a')](_0x68dbe[_0x56c4('0x49')],qs['fields'](_0x3b0618[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x227001[_0x56c4('0x4a')]=_0x227001[_0x56c4('0x4a')]['length']?_0x227001[_0x56c4('0x4a')]:_0x68dbe[_0x56c4('0x49')];if(_0x3b0618[_0x56c4('0x47')][_0x56c4('0x54')]){_0x227001['include']=[{'all':!![]}];}_0x227001=_[_0x56c4('0x51')]({},_0x227001,_0x3b0618['options']);return db[_0x56c4('0x42')][_0x56c4('0x5b')](_0x227001)['then'](handleEntityNotFound(_0xad66b8,null))[_0x56c4('0x25')](respondWithResult(_0xad66b8,null))[_0x56c4('0x5c')](handleError(_0xad66b8,null));};exports['create']=function(_0x5825e8,_0x16fc48){return db[_0x56c4('0x42')]['create'](_0x5825e8[_0x56c4('0x5d')],{})[_0x56c4('0x25')](function(_0x2fc3dd){var _0x31bcb3=_0x5825e8[_0x56c4('0x5e')][_0x56c4('0x3a')]({'plain':!![]});if(!_0x31bcb3)throw new Error(_0x56c4('0x5f'));if(_0x31bcb3[_0x56c4('0x60')]===_0x56c4('0x5e')){var _0x1487ac=_0x2fc3dd['get']({'plain':!![]});var _0x2a1e20=_0x56c4('0x3b');return db[_0x56c4('0x61')][_0x56c4('0x5b')]({'where':{'name':_0x2a1e20,'userProfileId':_0x31bcb3[_0x56c4('0x62')]},'raw':!![]})[_0x56c4('0x25')](function(_0x4241c3){if(_0x4241c3&&_0x4241c3[_0x56c4('0x63')]===0x0){return db[_0x56c4('0x3c')][_0x56c4('0x64')]({'name':_0x1487ac['name'],'resourceId':_0x1487ac['id'],'type':_0x4241c3[_0x56c4('0x3e')],'sectionId':_0x4241c3['id']},{})[_0x56c4('0x25')](function(){return _0x2fc3dd;});}else{return _0x2fc3dd;}})[_0x56c4('0x5c')](function(_0x4d2e6c){logger[_0x56c4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d2e6c);throw _0x4d2e6c;});}return _0x2fc3dd;})[_0x56c4('0x25')](respondWithResult(_0x16fc48,0xc9))[_0x56c4('0x5c')](handleError(_0x16fc48,null));};exports[_0x56c4('0x38')]=function(_0x18b5ee,_0x1d3760){if(_0x18b5ee[_0x56c4('0x5d')]['id']){delete _0x18b5ee[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x18b5ee['params']['id']},'include':[{'model':db[_0x56c4('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1d3760,null))[_0x56c4('0x25')](saveUpdates(_0x18b5ee[_0x56c4('0x5d')],null))['then'](respondWithResult(_0x1d3760,null))[_0x56c4('0x5c')](handleError(_0x1d3760,null));};exports['destroy']=function(_0x5731e9,_0x4feb13){return db[_0x56c4('0x42')]['find']({'where':{'id':_0x5731e9[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x4feb13,null))[_0x56c4('0x25')](removeEntity(_0x4feb13,null))[_0x56c4('0x5c')](handleError(_0x4feb13,null));};exports[_0x56c4('0x66')]=function(_0x1beabf,_0x196904){return db[_0x56c4('0x42')]['describe']()[_0x56c4('0x25')](respondWithResult(_0x196904,null))[_0x56c4('0x5c')](handleError(_0x196904,null));};exports['addDisposition']=function(_0x239203,_0x5c22fb,_0x493c3c){if(_0x239203[_0x56c4('0x5d')]['id']){delete _0x239203[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x239203['params']['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x5c22fb,null))[_0x56c4('0x25')](function(_0x45f27f){if(_0x45f27f){_0x239203[_0x56c4('0x5d')][_0x56c4('0x67')]=_0x45f27f['id'];return db[_0x56c4('0x68')][_0x56c4('0x64')](_0x239203[_0x56c4('0x5d')]);}})['then'](respondWithResult(_0x5c22fb,null))[_0x56c4('0x5c')](handleError(_0x5c22fb,null));};exports[_0x56c4('0x69')]=function(_0x40301c,_0x6e2c28,_0x4db4ce){var _0x19cdab={'raw':![],'where':{}};var _0x5c4161={};var _0xb59d24={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40301c[_0x56c4('0x65')]['id']}})['then'](handleEntityNotFound(_0x6e2c28,null))['then'](function(_0x5608e7){if(_0x5608e7){_0x5c4161['model']=_[_0x56c4('0x48')](db[_0x56c4('0x68')][_0x56c4('0x43')]);_0x5c4161['query']=_[_0x56c4('0x48')](_0x40301c['query']);_0x5c4161[_0x56c4('0x4f')]=_['intersection'](_0x5c4161[_0x56c4('0x49')],_0x5c4161[_0x56c4('0x47')]);_0x19cdab[_0x56c4('0x4a')]=_['intersection'](_0x5c4161[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x40301c['query']['fields']));_0x19cdab[_0x56c4('0x4a')]=_0x19cdab[_0x56c4('0x4a')]['length']?_0x19cdab[_0x56c4('0x4a')]:_0x5c4161[_0x56c4('0x49')];if(!_0x40301c['query']['hasOwnProperty']('nolimit')){_0x19cdab[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x40301c[_0x56c4('0x47')]['limit']);_0x19cdab[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x40301c[_0x56c4('0x47')]['offset']);}_0x19cdab['order']=qs[_0x56c4('0x4e')](_0x40301c[_0x56c4('0x47')]['sort']);_0x19cdab[_0x56c4('0x6a')]=qs['filters'](_['pick'](_0x40301c['query'],_0x5c4161[_0x56c4('0x4f')]));_0x19cdab[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x5608e7['id'];if(_0x40301c[_0x56c4('0x47')][_0x56c4('0x50')]){_0x19cdab[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x19cdab[_0x56c4('0x6a')],{'$or':_['map'](_0x19cdab[_0x56c4('0x4a')],function(_0x1aa5e8){var _0x4eb801={};_0x4eb801[_0x1aa5e8]={'$like':'%'+_0x40301c[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x4eb801;})});}_0x19cdab=_[_0x56c4('0x51')]({},_0x19cdab,_0x40301c[_0x56c4('0x52')]);return db['Disposition'][_0x56c4('0x53')]({'where':_0x19cdab[_0x56c4('0x6a')]})['then'](function(_0x4eddc5){_0xb59d24[_0x56c4('0x53')]=_0x4eddc5;if(_0x40301c[_0x56c4('0x47')][_0x56c4('0x54')]){_0x19cdab['include']=[{'all':!![]}];}return db[_0x56c4('0x68')]['findAll'](_0x19cdab);})['then'](function(_0x5a054e){_0xb59d24[_0x56c4('0x57')]=_0x5a054e;return _0xb59d24;});}})['then'](respondWithFilteredResult(_0x6e2c28,_0x19cdab))[_0x56c4('0x5c')](handleError(_0x6e2c28,null));};exports[_0x56c4('0x6b')]=function(_0x400fa0,_0x46d6e9,_0x5cd682){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x400fa0['params']['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x46d6e9,null))[_0x56c4('0x25')](function(_0x253e95){if(_0x253e95){return _0x253e95['removeDispositions'](_0x400fa0[_0x56c4('0x47')][_0x56c4('0x6c')]);}})[_0x56c4('0x25')](respondWithStatusCode(_0x46d6e9,null))[_0x56c4('0x5c')](handleError(_0x46d6e9,null));};exports[_0x56c4('0x6d')]=function(_0xb04ecf,_0x537f7e,_0x598dd4){if(_0xb04ecf[_0x56c4('0x5d')]['id']){delete _0xb04ecf[_0x56c4('0x5d')]['id'];}return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0xb04ecf[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x537f7e,null))[_0x56c4('0x25')](function(_0x2f5b76){if(_0x2f5b76){_0xb04ecf['body']['OpenchannelAccountId']=_0x2f5b76['id'];return db[_0x56c4('0x6e')]['create'](_0xb04ecf[_0x56c4('0x5d')]);}})[_0x56c4('0x25')](respondWithResult(_0x537f7e,null))[_0x56c4('0x5c')](handleError(_0x537f7e,null));};exports[_0x56c4('0x6f')]=function(_0x463ecd,_0x5a6b39,_0x23f2f1){var _0x3cbb4f={'raw':![],'where':{}};var _0x3a40f2={};var _0x4df8ac={'count':0x0,'rows':[]};return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x463ecd[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x5a6b39,null))[_0x56c4('0x25')](function(_0x3293b3){if(_0x3293b3){_0x3a40f2[_0x56c4('0x49')]=_[_0x56c4('0x48')](db['CannedAnswer']['rawAttributes']);_0x3a40f2['query']=_['keys'](_0x463ecd[_0x56c4('0x47')]);_0x3a40f2[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x3a40f2[_0x56c4('0x49')],_0x3a40f2[_0x56c4('0x47')]);_0x3cbb4f[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x3a40f2[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x3cbb4f[_0x56c4('0x4a')]=_0x3cbb4f[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0x3cbb4f['attributes']:_0x3a40f2[_0x56c4('0x49')];if(!_0x463ecd['query'][_0x56c4('0x71')](_0x56c4('0x72'))){_0x3cbb4f[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x463ecd[_0x56c4('0x47')]['limit']);_0x3cbb4f[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x30')]);}_0x3cbb4f[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x463ecd[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x3cbb4f[_0x56c4('0x6a')]=qs['filters'](_[_0x56c4('0x73')](_0x463ecd[_0x56c4('0x47')],_0x3a40f2[_0x56c4('0x4f')]));_0x3cbb4f[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x3293b3['id'];if(_0x463ecd['query'][_0x56c4('0x50')]){_0x3cbb4f[_0x56c4('0x6a')]=_['merge'](_0x3cbb4f[_0x56c4('0x6a')],{'$or':_['map'](_0x3cbb4f['attributes'],function(_0x4796bf){var _0x5dbb11={};_0x5dbb11[_0x4796bf]={'$like':'%'+_0x463ecd[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x5dbb11;})});}_0x3cbb4f=_['merge']({},_0x3cbb4f,_0x463ecd[_0x56c4('0x52')]);return db[_0x56c4('0x6e')][_0x56c4('0x53')]({'where':_0x3cbb4f['where']})[_0x56c4('0x25')](function(_0x116be3){_0x4df8ac[_0x56c4('0x53')]=_0x116be3;if(_0x463ecd['query'][_0x56c4('0x54')]){_0x3cbb4f[_0x56c4('0x55')]=[{'all':!![]}];}return db[_0x56c4('0x6e')]['findAll'](_0x3cbb4f);})['then'](function(_0x4f814f){_0x4df8ac[_0x56c4('0x57')]=_0x4f814f;return _0x4df8ac;});}})[_0x56c4('0x25')](respondWithFilteredResult(_0x5a6b39,_0x3cbb4f))[_0x56c4('0x5c')](handleError(_0x5a6b39,null));};exports[_0x56c4('0x74')]=function(_0x4509a3,_0xebea9,_0x30fb45){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4509a3['params']['id']}})['then'](handleEntityNotFound(_0xebea9,null))['then'](function(_0x5e9279){if(_0x5e9279){return _0x5e9279[_0x56c4('0x74')](_0x4509a3[_0x56c4('0x47')][_0x56c4('0x6c')]);}})['then'](respondWithStatusCode(_0xebea9,null))[_0x56c4('0x5c')](handleError(_0xebea9,null));};exports[_0x56c4('0x75')]=function(_0x4ab930,_0x4883cd,_0x46c4f6){var _0x5b96e6={'body':_0x4ab930[_0x56c4('0x5d')],'channel':_0x56c4('0x76')};var _0x3d310b=[];var _0x2078eb=[];var _0x3818a3={};var _0x3f9a5a=![];return db[_0x56c4('0x77')][_0x56c4('0x66')]()[_0x56c4('0x25')](function(_0x4563dd){if(!_0x4563dd){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x7a'));}_0x3d310b=_['difference'](_[_0x56c4('0x48')](_0x4563dd),[_0x56c4('0x7b'),_0x56c4('0x7c')]);_0x2078eb=_[_0x56c4('0x7d')](_['keys'](_0x4563dd),[_0x56c4('0x7b'),_0x56c4('0x7c'),_0x56c4('0x7e'),_0x56c4('0x7f')]);if(_0x4ab930['body']['id']){delete _0x4ab930[_0x56c4('0x5d')]['id'];}if(_[_0x56c4('0x80')](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')])){throw new db['Sequelize'][(_0x56c4('0x79'))](_0x56c4('0x82'));}if(_['isNil'](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x5d')])||_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x5d')]===''){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x83'));}if(_[_0x56c4('0x80')](_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')])){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x85')+_0x2078eb);}if(!_[_0x56c4('0x86')](_0x2078eb,_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')])){throw new db[(_0x56c4('0x78'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2078eb);}_0x3818a3[_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')]]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')];})[_0x56c4('0x25')](function(){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4ab930[_0x56c4('0x65')]['id']},'include':[{'model':db[_0x56c4('0x87')],'as':_0x56c4('0x88'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3818a3,'limit':0x1,'order':[['updatedAt',_0x56c4('0x89')]]}]},{'model':db[_0x56c4('0x8a')],'as':_0x56c4('0x8b')}]});})['then'](handleEntityNotFound(_0x4883cd,null))[_0x56c4('0x25')](function(_0x36b208){if(_0x36b208&&_0x36b208['List']){_0x5b96e6[_0x56c4('0x8c')]=_0x36b208;_0x5b96e6[_0x56c4('0x8d')]=_0x36b208[_0x56c4('0x8b')];_0x5b96e6[_0x56c4('0x8e')]=_0x36b208[_0x56c4('0x88')];_0x5b96e6[_0x56c4('0x8d')]=_[_0x56c4('0x8f')](_0x5b96e6['applications'],[_0x56c4('0x90')],[_0x56c4('0x91')]);if(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x8b')]){delete _0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x8b')];}if(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')]&&_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')]['Contacts'][_0x56c4('0x4c')]){return _0x5b96e6[_0x56c4('0x8c')][_0x56c4('0x88')][_0x56c4('0x92')][0x0];}var _0x295b20=_[_0x56c4('0x1d')](_0x4ab930['body'],{'firstName':_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')],'ListId':_0x36b208[_0x56c4('0x7f')]});_0x295b20[_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x84')]]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x81')];return db[_0x56c4('0x77')]['create'](_0x295b20,{'fields':_0x3d310b,'raw':!![]});}})['then'](handleEntityNotFound(_0x4883cd,null))[_0x56c4('0x25')](function(_0x11b4ac){_0x5b96e6[_0x56c4('0x93')]=_0x11b4ac;if(_0x11b4ac){var _0x2080fe={'ContactId':_0x11b4ac['id'],'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'from':(_0x11b4ac[_0x56c4('0x94')]||'')+'\x20'+(_0x11b4ac[_0x56c4('0x95')]||'')};var _0x359080={'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'closed':![]};if(_0x4ab930[_0x56c4('0x5d')]['threadId']){_0x359080['threadId']=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')];return db[_0x56c4('0x97')][_0x56c4('0x5b')]({'where':_0x359080})[_0x56c4('0x25')](function(_0x589977){if(_0x589977){return[_0x589977,![]];}_0x2080fe[_0x56c4('0x96')]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')];_0x2080fe[_0x56c4('0x98')]=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x98')];return db[_0x56c4('0x97')][_0x56c4('0x64')](_0x2080fe)['then'](function(_0x10341f){return[_0x10341f,!![]];});});}else{_0x359080[_0x56c4('0x96')]=null;}_0x359080['ContactId']=_0x11b4ac['id'];return db[_0x56c4('0x97')][_0x56c4('0x5b')]({'where':_0x359080})[_0x56c4('0x25')](function(_0x1445ef){if(_0x1445ef){return[_0x1445ef,![]];}return db[_0x56c4('0x97')][_0x56c4('0x64')](_0x2080fe)[_0x56c4('0x25')](function(_0x136e1d){return[_0x136e1d,!![]];});});}})[_0x56c4('0x99')](function(_0x553d65,_0x1d6e5a){if(_0x553d65){_0x3f9a5a=_0x1d6e5a;if(!_0x1d6e5a){var _0x30bd2={'from':(_0x5b96e6[_0x56c4('0x93')][_0x56c4('0x94')]||'')+'\x20'+(_0x5b96e6[_0x56c4('0x93')][_0x56c4('0x95')]||'')};if(_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')]&&_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x9a')]&&_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x96')]!=_0x4ab930[_0x56c4('0x5d')][_0x56c4('0x9a')]){_0x30bd2[_0x56c4('0x96')]=_0x4ab930['body'][_0x56c4('0x9a')];}return _0x553d65[_0x56c4('0x38')](_0x30bd2);}else{return _0x553d65;}}})[_0x56c4('0x25')](function(_0x30cfc9){_0x5b96e6[_0x56c4('0x9b')]=_0x30cfc9['get']({'plain':!![]});_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0x9c')]=_0x3f9a5a;if(_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0x9c')]){if(_0x5b96e6['account'][_0x56c4('0x9d')]){_0x5b96e6['applications'][_0x56c4('0x9e')]({'id':0x0,'priority':_0x5b96e6[_0x56c4('0x8d')]['length']+0x1,'app':_0x56c4('0x9f'),'appdata':_0x56c4('0xa0'),'interval':_0x56c4('0xa1')});}}return db[_0x56c4('0xa2')][_0x56c4('0x64')]({'body':_0x4ab930['body'][_0x56c4('0x5d')],'OpenchannelAccountId':_0x4ab930[_0x56c4('0x65')]['id'],'OpenchannelInteractionId':_0x30cfc9['id'],'direction':'in','ContactId':_0x5b96e6[_0x56c4('0x93')]['id'],'AttachmentId':_0x4ab930[_0x56c4('0x5d')][_0x56c4('0xa3')]});})[_0x56c4('0x25')](function(_0x30a5aa){_0x5b96e6[_0x56c4('0x2d')]=_0x30a5aa;if(!_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa4')])return;return db[_0x56c4('0xa5')][_0x56c4('0x5b')]({'attributes':['id',_0x56c4('0x3e')],'where':{'id':_0x5b96e6['interaction'][_0x56c4('0xa4')]}});})[_0x56c4('0x25')](function(_0x1a0e0c){if(_0x1a0e0c){_0x5b96e6['applications'][_0x56c4('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a0e0c['name']+','+(_0x5b96e6[_0x56c4('0x8c')][_0x56c4('0xa7')]||0xa),'interval':_0x56c4('0xa1')});}if(!_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa8')])return;return db[_0x56c4('0xa9')]['find']({'attributes':['id',_0x56c4('0x3e')],'where':{'id':_0x5b96e6[_0x56c4('0x9b')][_0x56c4('0xa8')]}});})[_0x56c4('0x25')](function(_0x55c122){if(_0x55c122){_0x5b96e6[_0x56c4('0x8d')][_0x56c4('0xa6')]({'id':0x0,'priority':0x1,'app':_0x56c4('0xaa'),'appdata':_0x55c122['name']+','+(_0x5b96e6['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x56c4('0xa1')});}return respondWithRpcPromise(_0x56c4('0xab'),_0x56c4('0xac'),_0x5b96e6);})[_0x56c4('0x25')](function(_0x3bdbf5){respondWithRpcPromise(_0x56c4('0xad'),_0x56c4('0xad'),{'event':'notify','message':_0x3bdbf5},client9002);return _0x3bdbf5;})[_0x56c4('0x25')](respondWithResult(_0x4883cd,null))[_0x56c4('0x5c')](handleError(_0x4883cd,null));};exports[_0x56c4('0xae')]=function(_0x4ff4f6,_0x603897){var _0x1ddc3e=_0x4ff4f6['params']['id'];var _0x4086ba=_0x4ff4f6[_0x56c4('0x5d')];var _0x204386=0xc8;var _0x3b5a30=null;return db[_0x56c4('0xaf')][_0x56c4('0xb0')]({'isolationLevel':db[_0x56c4('0xaf')]['Transaction'][_0x56c4('0xb1')][_0x56c4('0xb2')]},function(_0x5209c9){return db['OpenchannelAccount'][_0x56c4('0x70')]({'where':{'id':_0x1ddc3e},'transaction':_0x5209c9})[_0x56c4('0x25')](function(_0x5aa1c8){if(_0x5aa1c8){return db[_0x56c4('0x8a')][_0x56c4('0x39')]({'where':{'OpenchannelAccountId':_0x1ddc3e},'transaction':_0x5209c9})[_0x56c4('0x25')](function(){var _0xfb6978=_['map'](_0x4086ba,function(_0x1c76c5){_0x1c76c5['OpenchannelAccountId']=_0x1ddc3e;return _0x1c76c5;});return db['OpenchannelApplication'][_0x56c4('0xb3')](_0xfb6978,{'transaction':_0x5209c9});});}else{_0x204386=0x194;_0x3b5a30=[];}});})[_0x56c4('0x25')](function(){if(_0x204386!==0x194){return db[_0x56c4('0x8a')][_0x56c4('0xb4')]({'where':{'OpenchannelAccountId':_0x1ddc3e},'order':_0x56c4('0x90')})['then'](function(_0x525a0f){_0x3b5a30=_0x525a0f;});}})[_0x56c4('0x5c')](function(_0x4b92fd){_0x204386=0x1f4;logger[_0x56c4('0x2c')](_0x4b92fd[_0x56c4('0x3d')]);if(_0x4b92fd[_0x56c4('0x3e')]){delete _0x4b92fd[_0x56c4('0x3e')];}_0x3b5a30=_0x4b92fd;})['finally'](function(){if(_0x3b5a30===null){_0x603897[_0x56c4('0xb5')](_0x204386);}else{if(_0x204386===0x1f4){_0x603897['status'](_0x204386)[_0x56c4('0x3f')](_0x3b5a30);}else{_0x603897[_0x56c4('0x2f')](_0x204386)[_0x56c4('0xb6')](_0x3b5a30);}}});};exports[_0x56c4('0xb7')]=function(_0x5c627b,_0x111161,_0x4bfdb0){var _0x696605={};var _0x30cd5c={};var _0x4a9d0b;var _0x74b2a6;return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x5c627b[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x111161,null))[_0x56c4('0x25')](function(_0x38f0af){if(_0x38f0af){_0x4a9d0b=_0x38f0af;_0x30cd5c[_0x56c4('0x49')]=_[_0x56c4('0x48')](db[_0x56c4('0x8a')]['rawAttributes']);_0x30cd5c[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x5c627b[_0x56c4('0x47')]);_0x30cd5c['filters']=_[_0x56c4('0x5a')](_0x30cd5c[_0x56c4('0x49')],_0x30cd5c[_0x56c4('0x47')]);_0x696605['attributes']=_['intersection'](_0x30cd5c[_0x56c4('0x49')],qs['fields'](_0x5c627b['query'][_0x56c4('0x4b')]));_0x696605[_0x56c4('0x4a')]=_0x696605[_0x56c4('0x4a')][_0x56c4('0x4c')]?_0x696605['attributes']:_0x30cd5c[_0x56c4('0x49')];_0x696605[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x5c627b[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x696605[_0x56c4('0x6a')]=qs[_0x56c4('0x4f')](_['pick'](_0x5c627b[_0x56c4('0x47')],_0x30cd5c['filters']));if(_0x5c627b[_0x56c4('0x47')][_0x56c4('0x50')]){_0x696605['where']=_[_0x56c4('0x51')](_0x696605['where'],{'$or':_[_0x56c4('0x46')](_0x696605['attributes'],function(_0x366689){var _0x1ef8e0={};_0x1ef8e0[_0x366689]={'$like':'%'+_0x5c627b['query']['filter']+'%'};return _0x1ef8e0;})});}_0x696605=_['merge']({},_0x696605,_0x5c627b['options']);return _0x4a9d0b[_0x56c4('0xb7')](_0x696605);}})['then'](function(_0x3a00b3){if(_0x3a00b3){_0x74b2a6=_0x3a00b3[_0x56c4('0x4c')];if(!_0x5c627b[_0x56c4('0x47')][_0x56c4('0x71')](_0x56c4('0x72'))){_0x696605[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x5c627b[_0x56c4('0x47')]['limit']);_0x696605[_0x56c4('0x30')]=qs[_0x56c4('0x30')](_0x5c627b[_0x56c4('0x47')][_0x56c4('0x30')]);}return _0x4a9d0b[_0x56c4('0xb7')](_0x696605);}})[_0x56c4('0x25')](function(_0xe10a55){if(_0xe10a55){return _0xe10a55?{'count':_0x74b2a6,'rows':_0xe10a55}:null;}})[_0x56c4('0x25')](respondWithResult(_0x111161,null))[_0x56c4('0x5c')](handleError(_0x111161,null));};exports[_0x56c4('0xb8')]=function(_0x3980e0,_0x1199ff,_0x4c23e3){var _0x5bd16a={'raw':![],'where':{}};var _0x1b7c0={};var _0x357917={'count':0x0,'rows':[]};return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x3980e0[_0x56c4('0x65')]['id']}})['then'](handleEntityNotFound(_0x1199ff,null))['then'](function(_0x218330){if(_0x218330){_0x1b7c0[_0x56c4('0x49')]=_[_0x56c4('0x48')](db[_0x56c4('0x97')][_0x56c4('0x43')]);_0x1b7c0[_0x56c4('0x47')]=_[_0x56c4('0x48')](_0x3980e0[_0x56c4('0x47')]);_0x1b7c0[_0x56c4('0x4f')]=_[_0x56c4('0x5a')](_0x1b7c0['model'],_0x1b7c0['query']);_0x5bd16a[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x1b7c0[_0x56c4('0x49')],qs[_0x56c4('0x4b')](_0x3980e0['query'][_0x56c4('0x4b')]));_0x5bd16a['attributes']=_0x5bd16a['attributes']['length']?_0x5bd16a['attributes']:_0x1b7c0[_0x56c4('0x49')];if(!_0x3980e0[_0x56c4('0x47')][_0x56c4('0x71')]('nolimit')){_0x5bd16a[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x3980e0[_0x56c4('0x47')][_0x56c4('0x32')]);_0x5bd16a['offset']=qs[_0x56c4('0x30')](_0x3980e0['query'][_0x56c4('0x30')]);}_0x5bd16a[_0x56c4('0x4d')]=qs[_0x56c4('0x4e')](_0x3980e0[_0x56c4('0x47')][_0x56c4('0x4e')]);_0x5bd16a['where']=qs[_0x56c4('0x4f')](_['pick'](_0x3980e0[_0x56c4('0x47')],_0x1b7c0[_0x56c4('0x4f')]));_0x5bd16a[_0x56c4('0x6a')][_0x56c4('0x67')]=_0x218330['id'];if(_0x3980e0[_0x56c4('0x47')][_0x56c4('0x50')]){_0x5bd16a[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x5bd16a[_0x56c4('0x6a')],{'$or':_[_0x56c4('0x46')](_0x5bd16a[_0x56c4('0x4a')],function(_0x229296){var _0x284227={};_0x284227[_0x229296]={'$like':'%'+_0x3980e0[_0x56c4('0x47')][_0x56c4('0x50')]+'%'};return _0x284227;})});}_0x5bd16a=_[_0x56c4('0x51')]({},_0x5bd16a,_0x3980e0[_0x56c4('0x52')]);return db[_0x56c4('0x97')]['count']({'where':_0x5bd16a[_0x56c4('0x6a')]})[_0x56c4('0x25')](function(_0x54a813){_0x357917['count']=_0x54a813;if(_0x3980e0[_0x56c4('0x47')][_0x56c4('0x54')]){_0x5bd16a[_0x56c4('0x55')]=[{'model':db[_0x56c4('0x77')],'as':'Contact','required':![]},{'model':db[_0x56c4('0xa5')],'as':_0x56c4('0xb9'),'attributes':[_0x56c4('0x3e'),_0x56c4('0xba'),'internal'],'required':![]},{'model':db[_0x56c4('0xbb')],'as':_0x56c4('0xbc'),'attributes':['id',_0x56c4('0x3e'),_0x56c4('0xbd')],'where':_0x3980e0[_0x56c4('0x47')][_0x56c4('0xbe')]?{'id':_0x3980e0[_0x56c4('0x47')]['tag']}:undefined,'required':_0x3980e0[_0x56c4('0x47')][_0x56c4('0xbe')]?!![]:![]}];}return db[_0x56c4('0x97')]['findAll'](_0x5bd16a);})[_0x56c4('0x25')](function(_0x535bf5){_0x357917[_0x56c4('0x57')]=_0x535bf5;return _0x357917;});}})['then'](respondWithFilteredResult(_0x1199ff,_0x5bd16a))[_0x56c4('0x5c')](handleError(_0x1199ff,null));};exports['addAgents']=function(_0x3325e9,_0x4e593b,_0x5d1a44){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x3325e9[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x4e593b,null))[_0x56c4('0x25')](function(_0xb003f4){if(_0xb003f4){return _0xb003f4['addAgents'](_0x3325e9[_0x56c4('0x5d')][_0x56c4('0x6c')],_[_0x56c4('0xbf')](_0x3325e9[_0x56c4('0x5d')],[_0x56c4('0x6c'),'id'])||{})[_0x56c4('0x99')](function(_0x3ea47c){for(var _0x2522bb=0x0;_0x2522bb<_0x3325e9['body'][_0x56c4('0x6c')][_0x56c4('0x4c')];_0x2522bb+=0x1){socket[_0x56c4('0xc0')](_0x56c4('0xc1'),{'UserId':Number(_0x3325e9['body'][_0x56c4('0x6c')][_0x2522bb]),'OpenchannelAccountId':Number(_0x3325e9[_0x56c4('0x65')]['id'])});}return _0x3ea47c;});}})['then'](respondWithResult(_0x4e593b,null))[_0x56c4('0x5c')](handleError(_0x4e593b,null));};exports[_0x56c4('0xc2')]=function(_0x4a7903,_0x26d566,_0x42adf7){return db[_0x56c4('0x42')][_0x56c4('0x5b')]({'where':{'id':_0x4a7903['params']['id']}})['then'](handleEntityNotFound(_0x26d566,null))[_0x56c4('0x25')](function(_0x50e7c3){if(_0x50e7c3){return _0x50e7c3[_0x56c4('0xc2')](_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')])[_0x56c4('0x25')](function(){if(_['isArray'](_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')])){for(var _0x346d3c=0x0;_0x346d3c<_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')]['length'];_0x346d3c+=0x1){socket[_0x56c4('0xc0')](_0x56c4('0xc3'),{'UserId':Number(_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')][_0x346d3c]),'OpenchannelAccountId':Number(_0x4a7903[_0x56c4('0x65')]['id'])});}}else{socket[_0x56c4('0xc0')](_0x56c4('0xc3'),{'UserId':Number(_0x4a7903[_0x56c4('0x47')][_0x56c4('0x6c')]),'OpenchannelAccountId':Number(_0x4a7903[_0x56c4('0x65')]['id'])});}});}})[_0x56c4('0x25')](respondWithStatusCode(_0x26d566,null))[_0x56c4('0x5c')](handleError(_0x26d566,null));};exports[_0x56c4('0xc4')]=function(_0x3100a0,_0x33ea7a,_0x864216){var _0x8642c0={};var _0x5beaf6={};var _0x5f2ee8;var _0x2beb23;return db[_0x56c4('0x42')]['findOne']({'where':{'id':_0x3100a0[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0x33ea7a,null))[_0x56c4('0x25')](function(_0x107b30){if(_0x107b30){_0x5f2ee8=_0x107b30;_0x5beaf6[_0x56c4('0x49')]=_['keys'](db['User'][_0x56c4('0x43')]);_0x5beaf6['query']=_[_0x56c4('0x48')](_0x3100a0[_0x56c4('0x47')]);_0x5beaf6[_0x56c4('0x4f')]=_['intersection'](_0x5beaf6['model'],_0x5beaf6[_0x56c4('0x47')]);_0x8642c0[_0x56c4('0x4a')]=_[_0x56c4('0x5a')](_0x5beaf6[_0x56c4('0x49')],qs['fields'](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x4b')]));_0x8642c0['attributes']=_0x8642c0[_0x56c4('0x4a')]['length']?_0x8642c0[_0x56c4('0x4a')]:_0x5beaf6[_0x56c4('0x49')];_0x8642c0[_0x56c4('0x4d')]=qs['sort'](_0x3100a0['query'][_0x56c4('0x4e')]);_0x8642c0[_0x56c4('0x6a')]=qs[_0x56c4('0x4f')](_[_0x56c4('0x73')](_0x3100a0[_0x56c4('0x47')],_0x5beaf6[_0x56c4('0x4f')]));if(_0x3100a0['query']['filter']){_0x8642c0[_0x56c4('0x6a')]=_[_0x56c4('0x51')](_0x8642c0['where'],{'$or':_[_0x56c4('0x46')](_0x8642c0[_0x56c4('0x4a')],function(_0x19824a){var _0x25425a={};_0x25425a[_0x19824a]={'$like':'%'+_0x3100a0[_0x56c4('0x47')]['filter']+'%'};return _0x25425a;})});}_0x8642c0=_[_0x56c4('0x51')]({},_0x8642c0,_0x3100a0[_0x56c4('0x52')]);return _0x5f2ee8['getAgents'](_0x8642c0);}})[_0x56c4('0x25')](function(_0x486350){if(_0x486350){_0x2beb23=_0x486350['length'];if(!_0x3100a0[_0x56c4('0x47')][_0x56c4('0x71')](_0x56c4('0x72'))){_0x8642c0[_0x56c4('0x32')]=qs[_0x56c4('0x32')](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x32')]);_0x8642c0['offset']=qs[_0x56c4('0x30')](_0x3100a0[_0x56c4('0x47')][_0x56c4('0x30')]);}return _0x5f2ee8[_0x56c4('0xc4')](_0x8642c0);}})[_0x56c4('0x25')](function(_0x1268fc){if(_0x1268fc){return _0x1268fc?{'count':_0x2beb23,'rows':_0x1268fc}:null;}})['then'](respondWithResult(_0x33ea7a,null))['catch'](handleError(_0x33ea7a,null));};exports['send']=function(_0x5958f0,_0xfc59db,_0x3cd135){var _0x25552b,_0x2efbe5,_0x545461;if(_[_0x56c4('0x80')](_0x5958f0[_0x56c4('0x5d')]['body'])||_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')]===''){throw new db[(_0x56c4('0x78'))][(_0x56c4('0x79'))](_0x56c4('0x83'));}if(_[_0x56c4('0x80')](_0x5958f0[_0x56c4('0x5d')]['to'])){}_0x25552b=_0x5958f0[_0x56c4('0x5d')]['to'];return db[_0x56c4('0x42')][_0x56c4('0x70')]({'where':{'id':_0x5958f0[_0x56c4('0x65')]['id']}})[_0x56c4('0x25')](handleEntityNotFound(_0xfc59db,null))[_0x56c4('0x25')](function(_0x58519f){if(_0x58519f){return db['OpenchannelAccount'][_0x56c4('0x5b')]({'where':{'id':_0x58519f['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x56c4('0x92'),'where':{[_0x58519f[_0x56c4('0x84')]]:_0x25552b},'limit':0x1,'order':[[_0x56c4('0x7c'),_0x56c4('0x89')]]}]}]})['then'](handleEntityNotFound(_0xfc59db,null))[_0x56c4('0x25')](function(_0x3fa34a){if(_0x3fa34a&&_0x3fa34a[_0x56c4('0x88')]){_0x2efbe5=_0x3fa34a['get']({'plain':!![]});if(_0x2efbe5['List']&&_0x2efbe5[_0x56c4('0x88')][_0x56c4('0x92')][_0x56c4('0x4c')]){return _0x2efbe5['List']['Contacts'][0x0];}return db[_0x56c4('0x77')][_0x56c4('0x64')](_[_0x56c4('0x1d')](_0x5958f0[_0x56c4('0x5d')],{'firstName':_0x25552b,[_0x3fa34a['mapKey']]:_0x25552b,'phone':_0x25552b,'ListId':_0x2efbe5[_0x56c4('0x7f')]}));}})['then'](handleEntityNotFound(_0xfc59db,null))['then'](function(_0x1a0a83){if(_0x1a0a83){_0x545461=_0x1a0a83;return db['OpenchannelInteraction'][_0x56c4('0x5b')]({'where':{'ContactId':_0x545461['id'],'closed':![],'OpenchannelAccountId':_0x2efbe5['id']}})[_0x56c4('0x25')](function(_0xa55237){if(_0xa55237){return[_0xa55237,![]];}return db[_0x56c4('0x97')][_0x56c4('0x64')]({'UserId':_0x5958f0[_0x56c4('0x5e')]['id'],'ContactId':_0x545461['id'],'OpenchannelAccountId':_0x2efbe5['id'],'lastMsgDirection':_0x56c4('0xc5'),'firstMsgDirection':'out','Messages':[_['merge'](_0x5958f0[_0x56c4('0x5d')],{'read':![],'body':_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')],'OpenchannelAccountId':_0x2efbe5['id'],'UserId':_0x5958f0['user']['id'],'ContactId':_0x545461['id']})]},{'include':[{'model':db[_0x56c4('0xa2')],'as':_0x56c4('0xc6')}]})[_0x56c4('0x25')](function(_0x54f0e7){return[_0x54f0e7,!![]];});});}})[_0x56c4('0x99')](function(_0x10bd0c,_0x1d8598){if(_0x1d8598){return _0x10bd0c;}return db[_0x56c4('0xa2')][_0x56c4('0x64')](_[_0x56c4('0x51')](_0x5958f0['body'],{'read':![],'body':_0x5958f0[_0x56c4('0x5d')][_0x56c4('0x5d')],'OpenchannelAccountId':_0x2efbe5['id'],'OpenchannelInteractionId':_0x10bd0c['id'],'UserId':_0x5958f0[_0x56c4('0x5e')]['id'],'ContactId':_0x545461['id']}))[_0x56c4('0x25')](function(_0x23c204){_0x10bd0c[_0x56c4('0xc7')][_0x56c4('0xc6')]=[];_0x10bd0c[_0x56c4('0xc7')][_0x56c4('0xc6')][_0x56c4('0x9e')](_0x23c204['dataValues']);return _0x10bd0c;});});}})[_0x56c4('0x25')](respondWithResult(_0xfc59db,null))[_0x56c4('0x5c')](handleError(_0xfc59db,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b733ee5..8701d81 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x41a902,_0xeb5f37){var _0x5929a7=function(_0x1b31fb){while(--_0x1b31fb){_0x41a902['push'](_0x41a902['shift']());}};_0x5929a7(++_0xeb5f37);}(_0x878f,0x173));var _0xf878=function(_0x15ce13,_0x1dbef8){_0x15ce13=_0x15ce13-0x0;var _0x72b4ba=_0x878f[_0x15ce13];return _0x72b4ba;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x495123,_0x2bf158){var _0x39e1ee=function(_0x226778){while(--_0x226778){_0x495123['push'](_0x495123['shift']());}};_0x39e1ee(++_0x2bf158);}(_0x750a,0x140));var _0xa750=function(_0x1727b5,_0x2bbbfc){_0x1727b5=_0x1727b5-0x0;var _0x38ce81=_0x750a[_0x1727b5];return _0x38ce81;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index dbae74d..8f57015 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(_0x13526b,_0x3fb764){var _0x4725aa=function(_0x5e8c2e){while(--_0x5e8c2e){_0x13526b['push'](_0x13526b['shift']());}};_0x4725aa(++_0x3fb764);}(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4bc5ef,_0x5a1276){var _0xc6b005=function(_0x1a6d83){while(--_0x1a6d83){_0x4bc5ef['push'](_0x4bc5ef['shift']());}};_0xc6b005(++_0x5a1276);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 6537d84..b6f17a6 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 _0xed3c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x4b3cb7,_0x3e2890){var _0x49a8a4=function(_0x39298d){while(--_0x39298d){_0x4b3cb7['push'](_0x4b3cb7['shift']());}};_0x49a8a4(++_0x3e2890);}(_0xed3c,0x1a6));var _0xced3=function(_0x45321d,_0x58eb4f){_0x45321d=_0x45321d-0x0;var _0x1a999a=_0xed3c[_0x45321d];return _0x1a999a;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});} \ No newline at end of file +var _0xe493=['client','http','redis','defaults','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x13854c,_0x2ed273){var _0x4d9c2e=function(_0x2680d9){while(--_0x2680d9){_0x13854c['push'](_0x13854c['shift']());}};_0x4d9c2e(++_0x2ed273);}(_0xe493,0x7e));var _0x3e49=function(_0x43b1d5,_0x2c7fa1){_0x43b1d5=_0x43b1d5-0x0;var _0x1737c6=_0xe493[_0x43b1d5];return _0x1737c6;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});config[_0x3e49('0xb')]=_[_0x3e49('0xc')](config[_0x3e49('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e49('0xd'))[_0x3e49('0xe')](socket);function respondWithRpcPromise(_0x155727,_0x723d28,_0xb3f9f0){return new BPromise(function(_0x293965,_0xef8167){return client[_0x3e49('0xf')](_0x155727,_0xb3f9f0)[_0x3e49('0x10')](function(_0xf5e45f){logger[_0x3e49('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'));logger[_0x3e49('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'),JSON[_0x3e49('0x14')](_0xf5e45f));if(_0xf5e45f['error']){if(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x16')]===0x1f4){logger['error'](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0xef8167(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}logger[_0x3e49('0x15')](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0x293965(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}else{logger[_0x3e49('0x11')](_0x3e49('0x17'),_0x723d28,_0x3e49('0x12'));_0x293965(_0xf5e45f[_0x3e49('0x19')]['message']);}})[_0x3e49('0x1a')](function(_0x59bde3){logger[_0x3e49('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x59bde3);_0xef8167(_0x59bde3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 004570e..004de5f 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 _0xde9d=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x46aad3,_0x5c363f){var _0x20e425=function(_0x3980d2){while(--_0x3980d2){_0x46aad3['push'](_0x46aad3['shift']());}};_0x20e425(++_0x5c363f);}(_0xde9d,0x156));var _0xdde9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde9d[_0x19e35c];return _0x3e1fe8;};'use strict';var OpenchannelAccountEvents=require(_0xdde9('0x0'));var events=[_0xdde9('0x1'),_0xdde9('0x2'),_0xdde9('0x3')];function createListener(_0x20ab4a,_0x49fbbe){return function(_0x2a7fa7){_0x49fbbe[_0xdde9('0x4')](_0x20ab4a,_0x2a7fa7);};}function removeListener(_0x1aebe6,_0x4a5ea5){return function(){OpenchannelAccountEvents[_0xdde9('0x5')](_0x1aebe6,_0x4a5ea5);};}exports[_0xdde9('0x6')]=function(_0x1ea43e){for(var _0x4c10e9=0x0,_0x289ccb=events[_0xdde9('0x7')];_0x4c10e9<_0x289ccb;_0x4c10e9++){var _0x229168=events[_0x4c10e9];var _0x3be8c1=createListener(_0xdde9('0x8')+_0x229168,_0x1ea43e);OpenchannelAccountEvents['on'](_0x229168,_0x3be8c1);}}; \ No newline at end of file +var _0x4198=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x258317,_0x86bcc6){var _0x8e8765=function(_0x47967b){while(--_0x47967b){_0x258317['push'](_0x258317['shift']());}};_0x8e8765(++_0x86bcc6);}(_0x4198,0x69));var _0x8419=function(_0x276ea0,_0x5e9611){_0x276ea0=_0x276ea0-0x0;var _0x34d0c2=_0x4198[_0x276ea0];return _0x34d0c2;};'use strict';var OpenchannelAccountEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){OpenchannelAccountEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);OpenchannelAccountEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1cd05fc..1a32e46 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 _0xa899=['put','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x11c611,_0x3836cc){var _0x136636=function(_0x5d365c){while(--_0x5d365c){_0x11c611['push'](_0x11c611['shift']());}};_0x136636(++_0x3836cc);}(_0xa899,0x1b3));var _0x9a89=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xa899[_0x41382c];return _0x4da35b;};'use strict';var multer=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var path=require('path');var timeout=require(_0x9a89('0x2'));var express=require('express');var router=express[_0x9a89('0x3')]();var fs_extra=require(_0x9a89('0x4'));var auth=require(_0x9a89('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9a89('0x6'));var controller=require('./openchannelApplication.controller');router[_0x9a89('0x7')]('/',auth[_0x9a89('0x8')](),controller['index']);router[_0x9a89('0x7')](_0x9a89('0x9'),auth['isAuthenticated'](),controller[_0x9a89('0xa')]);router[_0x9a89('0xb')]('/',auth[_0x9a89('0x8')](),controller[_0x9a89('0xc')]);router[_0x9a89('0xd')](_0x9a89('0x9'),auth[_0x9a89('0x8')](),controller['update']);router[_0x9a89('0xe')](_0x9a89('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a89('0xf')]=router; \ No newline at end of file +var _0xc2ea=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x2bf01c,_0x5f492e){var _0x13655f=function(_0x5782f8){while(--_0x5782f8){_0x2bf01c['push'](_0x2bf01c['shift']());}};_0x13655f(++_0x5f492e);}(_0xc2ea,0x67));var _0xac2e=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0xc2ea[_0x5bff0];return _0x3ead2e;};'use strict';var multer=require(_0xac2e('0x0'));var util=require(_0xac2e('0x1'));var path=require(_0xac2e('0x2'));var timeout=require('connect-timeout');var express=require(_0xac2e('0x3'));var router=express[_0xac2e('0x4')]();var fs_extra=require(_0xac2e('0x5'));var auth=require(_0xac2e('0x6'));var interaction=require(_0xac2e('0x7'));var config=require(_0xac2e('0x8'));var controller=require(_0xac2e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xac2e('0xa')]);router[_0xac2e('0xb')](_0xac2e('0xc'),auth[_0xac2e('0xd')](),controller[_0xac2e('0xe')]);router[_0xac2e('0xf')]('/',auth[_0xac2e('0xd')](),controller[_0xac2e('0x10')]);router[_0xac2e('0x11')](_0xac2e('0xc'),auth[_0xac2e('0xd')](),controller[_0xac2e('0x12')]);router[_0xac2e('0x13')]('/:id',auth[_0xac2e('0xd')](),controller['destroy']);module[_0xac2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 456cbdd..7eea83c 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 _0x9a85=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x2e185c,_0x1c8b13){var _0x3cf428=function(_0x2a20a0){while(--_0x2a20a0){_0x2e185c['push'](_0x2e185c['shift']());}};_0x3cf428(++_0x1c8b13);}(_0x9a85,0x1bb));var _0x59a8=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x9a85[_0x4d1ee9];return _0x9a5456;};'use strict';var Sequelize=require(_0x59a8('0x0'));module[_0x59a8('0x1')]={'priority':{'type':Sequelize[_0x59a8('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x59a8('0x3')},'appdata':{'type':Sequelize[_0x59a8('0x4')]()},'description':{'type':Sequelize[_0x59a8('0x5')]},'interval':{'type':Sequelize[_0x59a8('0x5')],'defaultValue':_0x59a8('0x6')}}; \ No newline at end of file +var _0xecdf=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x1ae93b,_0x562c7c){var _0x41802f=function(_0x56da68){while(--_0x56da68){_0x1ae93b['push'](_0x1ae93b['shift']());}};_0x41802f(++_0x562c7c);}(_0xecdf,0x195));var _0xfecd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xecdf[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xfecd('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xfecd('0x1')],'allowNull':![],'defaultValue':_0xfecd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfecd('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfecd('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index deb3aad..e073ede 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 _0xe072=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe072,0x16e));var _0x2e07=function(_0x53b64c,_0x5f5895){_0x53b64c=_0x53b64c-0x0;var _0x3da206=_0xe072[_0x53b64c];return _0x3da206;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e07('0x0'));var zipdir=require(_0x2e07('0x1'));var jsonpatch=require(_0x2e07('0x2'));var rp=require(_0x2e07('0x3'));var moment=require(_0x2e07('0x4'));var BPromise=require(_0x2e07('0x5'));var Mustache=require(_0x2e07('0x6'));var util=require(_0x2e07('0x7'));var path=require(_0x2e07('0x8'));var sox=require('sox');var csv=require(_0x2e07('0x9'));var ejs=require(_0x2e07('0xa'));var fs=require('fs');var fs_extra=require(_0x2e07('0xb'));var _=require(_0x2e07('0xc'));var squel=require('squel');var crypto=require(_0x2e07('0xd'));var jsforce=require(_0x2e07('0xe'));var deskjs=require(_0x2e07('0xf'));var toCsv=require(_0x2e07('0x9'));var querystring=require(_0x2e07('0x10'));var Papa=require('papaparse');var Redis=require(_0x2e07('0x11'));var authService=require(_0x2e07('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e07('0x13'));var logger=require('../../config/logger')(_0x2e07('0x14'));var utils=require(_0x2e07('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2e07('0x16'));var db=require(_0x2e07('0x17'))['db'];function respondWithStatusCode(_0x41f3a0,_0x298093){_0x298093=_0x298093||0xcc;return function(_0x2ff8da){if(_0x2ff8da){return _0x41f3a0[_0x2e07('0x18')](_0x298093);}return _0x41f3a0[_0x2e07('0x19')](_0x298093)[_0x2e07('0x1a')]();};}function respondWithResult(_0x4e763f,_0x5b08f9){_0x5b08f9=_0x5b08f9||0xc8;return function(_0x21a146){if(_0x21a146){return _0x4e763f[_0x2e07('0x19')](_0x5b08f9)[_0x2e07('0x1b')](_0x21a146);}};}function respondWithFilteredResult(_0x25dca4,_0x16bfe0){return function(_0x23b803){if(_0x23b803){var _0xdb1a0=typeof _0x16bfe0[_0x2e07('0x1c')]===_0x2e07('0x1d')&&typeof _0x16bfe0[_0x2e07('0x1e')]==='undefined';var _0x4cbac6=_0x23b803[_0x2e07('0x1f')];var _0x370f8f=_0xdb1a0?0x0:_0x16bfe0[_0x2e07('0x1c')];var _0x281e55=_0xdb1a0?_0x23b803[_0x2e07('0x1f')]:_0x16bfe0[_0x2e07('0x1c')]+_0x16bfe0['limit'];var _0x553417;if(_0x281e55>=_0x4cbac6){_0x281e55=_0x4cbac6;_0x553417=0xc8;}else{_0x553417=0xce;}_0x25dca4[_0x2e07('0x19')](_0x553417);return _0x25dca4[_0x2e07('0x20')](_0x2e07('0x21'),_0x370f8f+'-'+_0x281e55+'/'+_0x4cbac6)['json'](_0x23b803);}return null;};}function patchUpdates(_0x2b52c1){return function(_0x41e739){try{jsonpatch[_0x2e07('0x22')](_0x41e739,_0x2b52c1,!![]);}catch(_0x2c928e){return BPromise['reject'](_0x2c928e);}return _0x41e739[_0x2e07('0x23')]();};}function saveUpdates(_0x43d310,_0x480a27){return function(_0x4f9236){if(_0x4f9236){return _0x4f9236[_0x2e07('0x24')](_0x43d310)['then'](function(_0x4dd465){return _0x4dd465;});}return null;};}function removeEntity(_0x5f528b,_0x42e4ca){return function(_0x207211){if(_0x207211){return _0x207211[_0x2e07('0x25')]()[_0x2e07('0x26')](function(){_0x5f528b[_0x2e07('0x19')](0xcc)[_0x2e07('0x1a')]();});}};}function handleEntityNotFound(_0x41ebc6,_0x25dd18){return function(_0x21ee8f){if(!_0x21ee8f){_0x41ebc6[_0x2e07('0x18')](0x194);}return _0x21ee8f;};}function handleError(_0x21f3a5,_0x37be5d){_0x37be5d=_0x37be5d||0x1f4;return function(_0x53dc10){logger[_0x2e07('0x27')](_0x53dc10['stack']);if(_0x53dc10[_0x2e07('0x28')]){delete _0x53dc10[_0x2e07('0x28')];}_0x21f3a5[_0x2e07('0x19')](_0x37be5d)[_0x2e07('0x29')](_0x53dc10);};}exports[_0x2e07('0x2a')]=function(_0x5c5c7b,_0x2cdd68){var _0x2bcc84={},_0x717aff={},_0x1712a1={'count':0x0,'rows':[]};var _0x36c5a9=_[_0x2e07('0x2b')](db[_0x2e07('0x2c')][_0x2e07('0x2d')],function(_0x52d51f){return{'name':_0x52d51f[_0x2e07('0x2e')],'type':_0x52d51f[_0x2e07('0x2f')]['key']};});_0x717aff[_0x2e07('0x30')]=_[_0x2e07('0x2b')](_0x36c5a9,_0x2e07('0x28'));_0x717aff['query']=_[_0x2e07('0x31')](_0x5c5c7b['query']);_0x717aff[_0x2e07('0x32')]=_[_0x2e07('0x33')](_0x717aff[_0x2e07('0x30')],_0x717aff[_0x2e07('0x34')]);_0x2bcc84[_0x2e07('0x35')]=_['intersection'](_0x717aff[_0x2e07('0x30')],qs[_0x2e07('0x36')](_0x5c5c7b[_0x2e07('0x34')][_0x2e07('0x36')]));_0x2bcc84[_0x2e07('0x35')]=_0x2bcc84['attributes'][_0x2e07('0x37')]?_0x2bcc84[_0x2e07('0x35')]:_0x717aff['model'];if(!_0x5c5c7b[_0x2e07('0x34')][_0x2e07('0x38')]('nolimit')){_0x2bcc84['limit']=qs[_0x2e07('0x1e')](_0x5c5c7b['query'][_0x2e07('0x1e')]);_0x2bcc84[_0x2e07('0x1c')]=qs[_0x2e07('0x1c')](_0x5c5c7b[_0x2e07('0x34')]['offset']);}_0x2bcc84[_0x2e07('0x39')]=qs[_0x2e07('0x3a')](_0x5c5c7b[_0x2e07('0x34')][_0x2e07('0x3a')]);_0x2bcc84['where']=qs[_0x2e07('0x32')](_[_0x2e07('0x3b')](_0x5c5c7b['query'],_0x717aff[_0x2e07('0x32')]),_0x36c5a9);if(_0x5c5c7b[_0x2e07('0x34')][_0x2e07('0x3c')]){_0x2bcc84[_0x2e07('0x3d')]=_[_0x2e07('0x3e')](_0x2bcc84[_0x2e07('0x3d')],{'$or':_[_0x2e07('0x2b')](_0x36c5a9,function(_0x4d6319){if(_0x4d6319[_0x2e07('0x2f')]!==_0x2e07('0x3f')){var _0x53170f={};_0x53170f[_0x4d6319[_0x2e07('0x28')]]={'$like':'%'+_0x5c5c7b['query']['filter']+'%'};return _0x53170f;}})});}_0x2bcc84=_['merge']({},_0x2bcc84,_0x5c5c7b[_0x2e07('0x40')]);var _0x310c15={'where':_0x2bcc84[_0x2e07('0x3d')]};return db['OpenchannelApplication'][_0x2e07('0x1f')](_0x310c15)['then'](function(_0x19c81f){_0x1712a1[_0x2e07('0x1f')]=_0x19c81f;if(_0x5c5c7b[_0x2e07('0x34')][_0x2e07('0x41')]){_0x2bcc84[_0x2e07('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x2e07('0x43')](_0x2bcc84);})[_0x2e07('0x26')](function(_0x4884f5){_0x1712a1[_0x2e07('0x44')]=_0x4884f5;return _0x1712a1;})[_0x2e07('0x26')](respondWithFilteredResult(_0x2cdd68,_0x2bcc84))[_0x2e07('0x45')](handleError(_0x2cdd68,null));};exports[_0x2e07('0x46')]=function(_0x227890,_0x493690){var _0x3a6e70={'raw':!![],'where':{'id':_0x227890['params']['id']}},_0x3d07bd={};_0x3d07bd[_0x2e07('0x30')]=_['keys'](db['OpenchannelApplication'][_0x2e07('0x2d')]);_0x3d07bd['query']=_[_0x2e07('0x31')](_0x227890[_0x2e07('0x34')]);_0x3d07bd['filters']=_[_0x2e07('0x33')](_0x3d07bd[_0x2e07('0x30')],_0x3d07bd[_0x2e07('0x34')]);_0x3a6e70[_0x2e07('0x35')]=_['intersection'](_0x3d07bd[_0x2e07('0x30')],qs[_0x2e07('0x36')](_0x227890[_0x2e07('0x34')]['fields']));_0x3a6e70[_0x2e07('0x35')]=_0x3a6e70['attributes']['length']?_0x3a6e70[_0x2e07('0x35')]:_0x3d07bd[_0x2e07('0x30')];if(_0x227890[_0x2e07('0x34')][_0x2e07('0x41')]){_0x3a6e70[_0x2e07('0x42')]=[{'all':!![]}];}_0x3a6e70=_['merge']({},_0x3a6e70,_0x227890[_0x2e07('0x40')]);return db[_0x2e07('0x2c')]['find'](_0x3a6e70)[_0x2e07('0x26')](handleEntityNotFound(_0x493690,null))[_0x2e07('0x26')](respondWithResult(_0x493690,null))['catch'](handleError(_0x493690,null));};exports[_0x2e07('0x47')]=function(_0x45cfd4,_0x2a8e6f){return db[_0x2e07('0x2c')][_0x2e07('0x47')](_0x45cfd4['body'],{})[_0x2e07('0x26')](respondWithResult(_0x2a8e6f,0xc9))[_0x2e07('0x45')](handleError(_0x2a8e6f,null));};exports[_0x2e07('0x24')]=function(_0x53e0cd,_0x3a9f83){if(_0x53e0cd[_0x2e07('0x48')]['id']){delete _0x53e0cd[_0x2e07('0x48')]['id'];}return db['OpenchannelApplication'][_0x2e07('0x49')]({'where':{'id':_0x53e0cd[_0x2e07('0x4a')]['id']}})[_0x2e07('0x26')](handleEntityNotFound(_0x3a9f83,null))[_0x2e07('0x26')](saveUpdates(_0x53e0cd[_0x2e07('0x48')],null))[_0x2e07('0x26')](respondWithResult(_0x3a9f83,null))[_0x2e07('0x45')](handleError(_0x3a9f83,null));};exports[_0x2e07('0x25')]=function(_0x96ce77,_0x3c3fbe){return db[_0x2e07('0x2c')]['find']({'where':{'id':_0x96ce77['params']['id']}})[_0x2e07('0x26')](handleEntityNotFound(_0x3c3fbe,null))[_0x2e07('0x26')](removeEntity(_0x3c3fbe,null))[_0x2e07('0x45')](handleError(_0x3c3fbe,null));}; \ No newline at end of file +var _0xb120=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','error','stack','index','map','OpenchannelApplication','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4420e4,_0x68974c){var _0x15b7b7=function(_0xd1397){while(--_0xd1397){_0x4420e4['push'](_0x4420e4['shift']());}};_0x15b7b7(++_0x68974c);}(_0xb120,0x16a));var _0x0b12=function(_0x21434b,_0x5612a1){_0x21434b=_0x21434b-0x0;var _0x3c255e=_0xb120[_0x21434b];return _0x3c255e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b12('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b12('0x1'));var rp=require(_0x0b12('0x2'));var moment=require(_0x0b12('0x3'));var BPromise=require(_0x0b12('0x4'));var Mustache=require(_0x0b12('0x5'));var util=require(_0x0b12('0x6'));var path=require(_0x0b12('0x7'));var sox=require('sox');var csv=require(_0x0b12('0x8'));var ejs=require(_0x0b12('0x9'));var fs=require('fs');var fs_extra=require(_0x0b12('0xa'));var _=require(_0x0b12('0xb'));var squel=require(_0x0b12('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b12('0xd'));var toCsv=require(_0x0b12('0x8'));var querystring=require('querystring');var Papa=require(_0x0b12('0xe'));var Redis=require(_0x0b12('0xf'));var authService=require(_0x0b12('0x10'));var qs=require(_0x0b12('0x11'));var as=require(_0x0b12('0x12'));var hardwareService=require(_0x0b12('0x13'));var logger=require(_0x0b12('0x14'))(_0x0b12('0x15'));var utils=require(_0x0b12('0x16'));var config=require(_0x0b12('0x17'));var licenseUtil=require(_0x0b12('0x18'));var db=require(_0x0b12('0x19'))['db'];function respondWithStatusCode(_0x2363d5,_0x1b1c5a){_0x1b1c5a=_0x1b1c5a||0xcc;return function(_0x5e918c){if(_0x5e918c){return _0x2363d5[_0x0b12('0x1a')](_0x1b1c5a);}return _0x2363d5[_0x0b12('0x1b')](_0x1b1c5a)[_0x0b12('0x1c')]();};}function respondWithResult(_0x4c8836,_0xd2424d){_0xd2424d=_0xd2424d||0xc8;return function(_0x403965){if(_0x403965){return _0x4c8836[_0x0b12('0x1b')](_0xd2424d)['json'](_0x403965);}};}function respondWithFilteredResult(_0x293880,_0x3e9d1c){return function(_0x596b9a){if(_0x596b9a){var _0x1088e6=typeof _0x3e9d1c['offset']==='undefined'&&typeof _0x3e9d1c[_0x0b12('0x1d')]===_0x0b12('0x1e');var _0x164355=_0x596b9a[_0x0b12('0x1f')];var _0x3735e6=_0x1088e6?0x0:_0x3e9d1c[_0x0b12('0x20')];var _0x22a14b=_0x1088e6?_0x596b9a[_0x0b12('0x1f')]:_0x3e9d1c['offset']+_0x3e9d1c[_0x0b12('0x1d')];var _0x33438e;if(_0x22a14b>=_0x164355){_0x22a14b=_0x164355;_0x33438e=0xc8;}else{_0x33438e=0xce;}_0x293880[_0x0b12('0x1b')](_0x33438e);return _0x293880[_0x0b12('0x21')](_0x0b12('0x22'),_0x3735e6+'-'+_0x22a14b+'/'+_0x164355)[_0x0b12('0x23')](_0x596b9a);}return null;};}function patchUpdates(_0x2a8f7a){return function(_0x1cf32a){try{jsonpatch[_0x0b12('0x24')](_0x1cf32a,_0x2a8f7a,!![]);}catch(_0x25ff0c){return BPromise['reject'](_0x25ff0c);}return _0x1cf32a[_0x0b12('0x25')]();};}function saveUpdates(_0x4b1471,_0x585a39){return function(_0x2e7146){if(_0x2e7146){return _0x2e7146[_0x0b12('0x26')](_0x4b1471)[_0x0b12('0x27')](function(_0x436018){return _0x436018;});}return null;};}function removeEntity(_0x14b1ab,_0x49a29c){return function(_0x1f3a1d){if(_0x1f3a1d){return _0x1f3a1d['destroy']()[_0x0b12('0x27')](function(){_0x14b1ab[_0x0b12('0x1b')](0xcc)[_0x0b12('0x1c')]();});}};}function handleEntityNotFound(_0x105301,_0x19e6cb){return function(_0xe80cfe){if(!_0xe80cfe){_0x105301['sendStatus'](0x194);}return _0xe80cfe;};}function handleError(_0x5220b8,_0x71f993){_0x71f993=_0x71f993||0x1f4;return function(_0xf66a42){logger[_0x0b12('0x28')](_0xf66a42[_0x0b12('0x29')]);if(_0xf66a42['name']){delete _0xf66a42['name'];}_0x5220b8['status'](_0x71f993)['send'](_0xf66a42);};}exports[_0x0b12('0x2a')]=function(_0x7f64d9,_0x2ae08d){var _0x2d5635={},_0x1fefcf={},_0x1b2db0={'count':0x0,'rows':[]};var _0x15adce=_[_0x0b12('0x2b')](db[_0x0b12('0x2c')]['rawAttributes'],function(_0x35b963){return{'name':_0x35b963[_0x0b12('0x2d')],'type':_0x35b963[_0x0b12('0x2e')][_0x0b12('0x2f')]};});_0x1fefcf[_0x0b12('0x30')]=_['map'](_0x15adce,_0x0b12('0x31'));_0x1fefcf[_0x0b12('0x32')]=_['keys'](_0x7f64d9[_0x0b12('0x32')]);_0x1fefcf[_0x0b12('0x33')]=_[_0x0b12('0x34')](_0x1fefcf[_0x0b12('0x30')],_0x1fefcf[_0x0b12('0x32')]);_0x2d5635[_0x0b12('0x35')]=_['intersection'](_0x1fefcf['model'],qs[_0x0b12('0x36')](_0x7f64d9['query'][_0x0b12('0x36')]));_0x2d5635[_0x0b12('0x35')]=_0x2d5635['attributes']['length']?_0x2d5635['attributes']:_0x1fefcf[_0x0b12('0x30')];if(!_0x7f64d9['query'][_0x0b12('0x37')](_0x0b12('0x38'))){_0x2d5635['limit']=qs['limit'](_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x1d')]);_0x2d5635['offset']=qs['offset'](_0x7f64d9['query'][_0x0b12('0x20')]);}_0x2d5635[_0x0b12('0x39')]=qs['sort'](_0x7f64d9['query'][_0x0b12('0x3a')]);_0x2d5635[_0x0b12('0x3b')]=qs[_0x0b12('0x33')](_[_0x0b12('0x3c')](_0x7f64d9[_0x0b12('0x32')],_0x1fefcf[_0x0b12('0x33')]),_0x15adce);if(_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x3d')]){_0x2d5635[_0x0b12('0x3b')]=_[_0x0b12('0x3e')](_0x2d5635[_0x0b12('0x3b')],{'$or':_['map'](_0x15adce,function(_0x4bbf4d){if(_0x4bbf4d['type']!=='VIRTUAL'){var _0xbcaa55={};_0xbcaa55[_0x4bbf4d[_0x0b12('0x31')]]={'$like':'%'+_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x3d')]+'%'};return _0xbcaa55;}})});}_0x2d5635=_[_0x0b12('0x3e')]({},_0x2d5635,_0x7f64d9[_0x0b12('0x3f')]);var _0xda3fbe={'where':_0x2d5635[_0x0b12('0x3b')]};return db['OpenchannelApplication'][_0x0b12('0x1f')](_0xda3fbe)[_0x0b12('0x27')](function(_0x31977a){_0x1b2db0[_0x0b12('0x1f')]=_0x31977a;if(_0x7f64d9[_0x0b12('0x32')][_0x0b12('0x40')]){_0x2d5635['include']=[{'all':!![]}];}return db[_0x0b12('0x2c')][_0x0b12('0x41')](_0x2d5635);})[_0x0b12('0x27')](function(_0x44d246){_0x1b2db0[_0x0b12('0x42')]=_0x44d246;return _0x1b2db0;})[_0x0b12('0x27')](respondWithFilteredResult(_0x2ae08d,_0x2d5635))[_0x0b12('0x43')](handleError(_0x2ae08d,null));};exports[_0x0b12('0x44')]=function(_0x20372d,_0x46f8e2){var _0x3ef550={'raw':!![],'where':{'id':_0x20372d[_0x0b12('0x45')]['id']}},_0x140ec1={};_0x140ec1[_0x0b12('0x30')]=_[_0x0b12('0x46')](db[_0x0b12('0x2c')]['rawAttributes']);_0x140ec1['query']=_[_0x0b12('0x46')](_0x20372d['query']);_0x140ec1[_0x0b12('0x33')]=_['intersection'](_0x140ec1[_0x0b12('0x30')],_0x140ec1[_0x0b12('0x32')]);_0x3ef550['attributes']=_[_0x0b12('0x34')](_0x140ec1[_0x0b12('0x30')],qs[_0x0b12('0x36')](_0x20372d[_0x0b12('0x32')][_0x0b12('0x36')]));_0x3ef550[_0x0b12('0x35')]=_0x3ef550['attributes'][_0x0b12('0x47')]?_0x3ef550[_0x0b12('0x35')]:_0x140ec1[_0x0b12('0x30')];if(_0x20372d[_0x0b12('0x32')][_0x0b12('0x40')]){_0x3ef550[_0x0b12('0x48')]=[{'all':!![]}];}_0x3ef550=_[_0x0b12('0x3e')]({},_0x3ef550,_0x20372d['options']);return db['OpenchannelApplication'][_0x0b12('0x49')](_0x3ef550)[_0x0b12('0x27')](handleEntityNotFound(_0x46f8e2,null))[_0x0b12('0x27')](respondWithResult(_0x46f8e2,null))['catch'](handleError(_0x46f8e2,null));};exports[_0x0b12('0x4a')]=function(_0x4a8039,_0x1824ff){return db[_0x0b12('0x2c')][_0x0b12('0x4a')](_0x4a8039['body'],{})['then'](respondWithResult(_0x1824ff,0xc9))[_0x0b12('0x43')](handleError(_0x1824ff,null));};exports[_0x0b12('0x26')]=function(_0x5c0d20,_0x42c074){if(_0x5c0d20['body']['id']){delete _0x5c0d20[_0x0b12('0x4b')]['id'];}return db[_0x0b12('0x2c')][_0x0b12('0x49')]({'where':{'id':_0x5c0d20[_0x0b12('0x45')]['id']}})[_0x0b12('0x27')](handleEntityNotFound(_0x42c074,null))[_0x0b12('0x27')](saveUpdates(_0x5c0d20[_0x0b12('0x4b')],null))[_0x0b12('0x27')](respondWithResult(_0x42c074,null))[_0x0b12('0x43')](handleError(_0x42c074,null));};exports['destroy']=function(_0x5865a6,_0x56a5b3){return db[_0x0b12('0x2c')][_0x0b12('0x49')]({'where':{'id':_0x5865a6[_0x0b12('0x45')]['id']}})[_0x0b12('0x27')](handleEntityNotFound(_0x56a5b3,null))[_0x0b12('0x27')](removeEntity(_0x56a5b3,null))[_0x0b12('0x43')](handleError(_0x56a5b3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 19bfb6c..6a612a8 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 _0x920a=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x203fed,_0x26bd9b){var _0x1f6d65=function(_0x1fabda){while(--_0x1fabda){_0x203fed['push'](_0x203fed['shift']());}};_0x1f6d65(++_0x26bd9b);}(_0x920a,0x134));var _0xa920=function(_0x1e4d89,_0x1def03){_0x1e4d89=_0x1e4d89-0x0;var _0x2bc0d5=_0x920a[_0x1e4d89];return _0x2bc0d5;};'use strict';var _=require(_0xa920('0x0'));var util=require(_0xa920('0x1'));var logger=require(_0xa920('0x2'))(_0xa920('0x3'));var moment=require(_0xa920('0x4'));var BPromise=require(_0xa920('0x5'));var rp=require(_0xa920('0x6'));var fs=require('fs');var path=require(_0xa920('0x7'));var rimraf=require(_0xa920('0x8'));var config=require(_0xa920('0x9'));var attributes=require(_0xa920('0xa'));module[_0xa920('0xb')]=function(_0x23e79d,_0x317e93){return _0x23e79d['define'](_0xa920('0xc'),attributes,{'tableName':_0xa920('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa920('0xe'),'collate':_0xa920('0xf')});}; \ No newline at end of file +var _0x4867=['api','moment','request-promise','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','../../config/logger'];(function(_0x3ba69c,_0x3e370c){var _0x1c722b=function(_0x1ba57a){while(--_0x1ba57a){_0x3ba69c['push'](_0x3ba69c['shift']());}};_0x1c722b(++_0x3e370c);}(_0x4867,0x1c1));var _0x7486=function(_0x2ea4f0,_0x420118){_0x2ea4f0=_0x2ea4f0-0x0;var _0x5c5877=_0x4867[_0x2ea4f0];return _0x5c5877;};'use strict';var _=require(_0x7486('0x0'));var util=require('util');var logger=require(_0x7486('0x1'))(_0x7486('0x2'));var moment=require(_0x7486('0x3'));var BPromise=require('bluebird');var rp=require(_0x7486('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7486('0x5'));var config=require('../../config/environment');var attributes=require(_0x7486('0x6'));module[_0x7486('0x7')]=function(_0x337247,_0x13fc6e){return _0x337247[_0x7486('0x8')](_0x7486('0x9'),attributes,{'tableName':_0x7486('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d474045..1a91d3b 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 _0x9333=['where','limit','then','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','update','body','options'];(function(_0x818b0f,_0xaf6fa5){var _0x4220a9=function(_0x3252a8){while(--_0x3252a8){_0x818b0f['push'](_0x818b0f['shift']());}};_0x4220a9(++_0xaf6fa5);}(_0x9333,0x12f));var _0x3933=function(_0x397b4c,_0x180df5){_0x397b4c=_0x397b4c-0x0;var _0x2c599f=_0x9333[_0x397b4c];return _0x2c599f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3933('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3933('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x3933('0x2'));var logger=require(_0x3933('0x3'))(_0x3933('0x4'));var config=require(_0x3933('0x5'));var jayson=require(_0x3933('0x6'));var client=jayson[_0x3933('0x7')][_0x3933('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d17a5,_0x16fbdb,_0x2be718){return new BPromise(function(_0x452a24,_0x70cc66){return client['request'](_0x1d17a5,_0x2be718)['then'](function(_0x66ef0f){logger[_0x3933('0x9')](_0x3933('0xa'),_0x16fbdb,_0x3933('0xb'));logger[_0x3933('0xc')](_0x3933('0xd'),_0x16fbdb,_0x3933('0xb'),JSON['stringify'](_0x66ef0f));if(_0x66ef0f['error']){if(_0x66ef0f[_0x3933('0xe')]['code']===0x1f4){logger[_0x3933('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x16fbdb,_0x66ef0f[_0x3933('0xe')][_0x3933('0xf')]);return _0x70cc66(_0x66ef0f[_0x3933('0xe')][_0x3933('0xf')]);}logger['error'](_0x3933('0xa'),_0x16fbdb,_0x66ef0f[_0x3933('0xe')][_0x3933('0xf')]);return _0x452a24(_0x66ef0f['error'][_0x3933('0xf')]);}else{logger[_0x3933('0x9')](_0x3933('0xa'),_0x16fbdb,_0x3933('0xb'));_0x452a24(_0x66ef0f[_0x3933('0x10')][_0x3933('0xf')]);}})[_0x3933('0x11')](function(_0x36a2a0){logger[_0x3933('0xe')](_0x3933('0xa'),_0x16fbdb,_0x36a2a0);_0x70cc66(_0x36a2a0);});});}exports[_0x3933('0x12')]=function(_0x45e98b){var _0x5d4247=this;return new Promise(function(_0x3f0ea8,_0x5db129){return db['OpenchannelApplication'][_0x3933('0x13')](_0x45e98b[_0x3933('0x14')],{'raw':_0x45e98b[_0x3933('0x15')]?_0x45e98b[_0x3933('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e98b[_0x3933('0x15')]?_0x45e98b[_0x3933('0x15')][_0x3933('0x16')]||null:null,'attributes':_0x45e98b['options']?_0x45e98b[_0x3933('0x15')]['attributes']||null:null,'limit':_0x45e98b['options']?_0x45e98b[_0x3933('0x15')][_0x3933('0x17')]||null:null})[_0x3933('0x18')](function(_0x3d7209){logger['info'](_0x3933('0x12'),_0x45e98b);logger['debug']('UpdateOpenchannelApplication',_0x45e98b,JSON['stringify'](_0x3d7209));_0x3f0ea8(_0x3d7209);})[_0x3933('0x11')](function(_0x453fbb){logger[_0x3933('0xe')](_0x3933('0x12'),_0x453fbb[_0x3933('0xf')],_0x45e98b);_0x5db129(_0x5d4247[_0x3933('0xe')](0x1f4,_0x453fbb[_0x3933('0xf')]));});});}; \ No newline at end of file +var _0xd0e5=['error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f4863,_0x54bc8d){var _0x30c440=function(_0x57f30e){while(--_0x57f30e){_0x3f4863['push'](_0x3f4863['shift']());}};_0x30c440(++_0x54bc8d);}(_0xd0e5,0xd2));var _0x5d0e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xd0e5[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x5d0e('0x0'));var util=require(_0x5d0e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d0e('0x2'));var fs=require('fs');var Redis=require(_0x5d0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d0e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0e('0x5'));var jayson=require(_0x5d0e('0x6'));var client=jayson[_0x5d0e('0x7')][_0x5d0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d54b0,_0x1e0b63,_0x2efba3){return new BPromise(function(_0x11997d,_0x22e656){return client['request'](_0x2d54b0,_0x2efba3)['then'](function(_0x49007b){logger[_0x5d0e('0x9')](_0x5d0e('0xa'),_0x1e0b63,_0x5d0e('0xb'));logger['debug'](_0x5d0e('0xc'),_0x1e0b63,_0x5d0e('0xb'),JSON[_0x5d0e('0xd')](_0x49007b));if(_0x49007b[_0x5d0e('0xe')]){if(_0x49007b[_0x5d0e('0xe')]['code']===0x1f4){logger[_0x5d0e('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e0b63,_0x49007b[_0x5d0e('0xe')][_0x5d0e('0xf')]);return _0x22e656(_0x49007b[_0x5d0e('0xe')][_0x5d0e('0xf')]);}logger[_0x5d0e('0xe')](_0x5d0e('0xa'),_0x1e0b63,_0x49007b[_0x5d0e('0xe')]['message']);return _0x11997d(_0x49007b['error']['message']);}else{logger[_0x5d0e('0x9')](_0x5d0e('0xa'),_0x1e0b63,_0x5d0e('0xb'));_0x11997d(_0x49007b[_0x5d0e('0x10')][_0x5d0e('0xf')]);}})[_0x5d0e('0x11')](function(_0x2b45e8){logger[_0x5d0e('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e0b63,_0x2b45e8);_0x22e656(_0x2b45e8);});});}exports[_0x5d0e('0x12')]=function(_0x4b3abb){var _0x4a5042=this;return new Promise(function(_0x273c0a,_0x14232b){return db[_0x5d0e('0x13')][_0x5d0e('0x14')](_0x4b3abb[_0x5d0e('0x15')],{'raw':_0x4b3abb['options']?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3abb[_0x5d0e('0x16')]?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x18')]||null:null,'attributes':_0x4b3abb['options']?_0x4b3abb[_0x5d0e('0x16')][_0x5d0e('0x19')]||null:null,'limit':_0x4b3abb[_0x5d0e('0x16')]?_0x4b3abb[_0x5d0e('0x16')]['limit']||null:null})[_0x5d0e('0x1a')](function(_0x43ee34){logger['info']('UpdateOpenchannelApplication',_0x4b3abb);logger[_0x5d0e('0x1b')](_0x5d0e('0x12'),_0x4b3abb,JSON[_0x5d0e('0xd')](_0x43ee34));_0x273c0a(_0x43ee34);})['catch'](function(_0x1c16e3){logger[_0x5d0e('0xe')](_0x5d0e('0x12'),_0x1c16e3[_0x5d0e('0xf')],_0x4b3abb);_0x14232b(_0x4a5042[_0x5d0e('0xe')](0x1f4,_0x1c16e3[_0x5d0e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e2017e4..23f1aff 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 _0x650f=['openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked'];(function(_0x3d135b,_0x65e919){var _0x3da5c6=function(_0x4d6021){while(--_0x4d6021){_0x3d135b['push'](_0x3d135b['shift']());}};_0x3da5c6(++_0x65e919);}(_0x650f,0x133));var _0xf650=function(_0x1687b4,_0x2661ab){_0x1687b4=_0x1687b4-0x0;var _0x45d6b0=_0x650f[_0x1687b4];return _0x45d6b0;};'use strict';var multer=require('multer');var util=require(_0xf650('0x0'));var path=require(_0xf650('0x1'));var timeout=require(_0xf650('0x2'));var express=require(_0xf650('0x3'));var router=express[_0xf650('0x4')]();var fs_extra=require(_0xf650('0x5'));var auth=require(_0xf650('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf650('0x7'));var controller=require(_0xf650('0x8'));router[_0xf650('0x9')]('/',auth['isAuthenticated'](),controller[_0xf650('0xa')]);router['get'](_0xf650('0xb'),auth[_0xf650('0xc')](),controller[_0xf650('0xd')]);router['get'](_0xf650('0xe'),auth['isAuthenticated'](),controller[_0xf650('0xf')]);router[_0xf650('0x9')](_0xf650('0x10'),auth[_0xf650('0xc')](),controller[_0xf650('0x11')]);router[_0xf650('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xf650('0x12')]);router[_0xf650('0x13')]('/',auth['isAuthenticated'](),controller[_0xf650('0x14')]);router[_0xf650('0x13')]('/:id/messages',auth[_0xf650('0xc')](),controller['addMessage']);router[_0xf650('0x13')](_0xf650('0x15'),auth[_0xf650('0xc')](),interaction[_0xf650('0x16')](_0xf650('0x17'),_0xf650('0x18')),controller[_0xf650('0x19')]);router[_0xf650('0x1a')](_0xf650('0xe'),auth['isAuthenticated'](),interaction[_0xf650('0x16')]('openchannel',_0xf650('0x1b')),controller[_0xf650('0x1c')]);router[_0xf650('0x1d')](_0xf650('0xe'),auth[_0xf650('0xc')](),interaction[_0xf650('0x16')]('openchannel',_0xf650('0x1e')),controller[_0xf650('0x1f')]);router[_0xf650('0x1d')](_0xf650('0x15'),auth[_0xf650('0xc')](),controller['removeTags']);module[_0xf650('0x20')]=router; \ No newline at end of file +var _0x363b=['/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe'];(function(_0x23c2ec,_0x2a8ff9){var _0x23e5d4=function(_0x425d25){while(--_0x425d25){_0x23c2ec['push'](_0x23c2ec['shift']());}};_0x23e5d4(++_0x2a8ff9);}(_0x363b,0x18a));var _0xb363=function(_0x36628b,_0x9e370a){_0x36628b=_0x36628b-0x0;var _0x5680fe=_0x363b[_0x36628b];return _0x5680fe;};'use strict';var multer=require(_0xb363('0x0'));var util=require(_0xb363('0x1'));var path=require(_0xb363('0x2'));var timeout=require(_0xb363('0x3'));var express=require(_0xb363('0x4'));var router=express['Router']();var fs_extra=require(_0xb363('0x5'));var auth=require(_0xb363('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb363('0x7'));router[_0xb363('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb363('0x8')](_0xb363('0x9'),auth[_0xb363('0xa')](),controller[_0xb363('0xb')]);router[_0xb363('0x8')](_0xb363('0xc'),auth[_0xb363('0xa')](),controller[_0xb363('0xd')]);router[_0xb363('0x8')]('/:id/messages',auth[_0xb363('0xa')](),controller[_0xb363('0xe')]);router[_0xb363('0x8')](_0xb363('0xf'),auth[_0xb363('0xa')](),controller[_0xb363('0x10')]);router[_0xb363('0x11')]('/',auth[_0xb363('0xa')](),controller[_0xb363('0x12')]);router[_0xb363('0x11')](_0xb363('0x13'),auth[_0xb363('0xa')](),controller['addMessage']);router[_0xb363('0x11')](_0xb363('0x14'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),_0xb363('0x17')),controller[_0xb363('0x18')]);router['put'](_0xb363('0xc'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),_0xb363('0x19')),controller['update']);router[_0xb363('0x1a')](_0xb363('0xc'),auth[_0xb363('0xa')](),interaction[_0xb363('0x15')](_0xb363('0x16'),'openchannelinteraction:destroy'),controller[_0xb363('0x1b')]);router[_0xb363('0x1a')](_0xb363('0x14'),auth[_0xb363('0xa')](),controller[_0xb363('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 bdc1a07..165d93e 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 _0x2765=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x1f7c39,_0x4340a7){var _0x1f58ba=function(_0x9ab1a1){while(--_0x9ab1a1){_0x1f7c39['push'](_0x1f7c39['shift']());}};_0x1f58ba(++_0x4340a7);}(_0x2765,0x156));var _0x5276=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2765[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5276('0x0'));module[_0x5276('0x1')]={'closed':{'type':Sequelize[_0x5276('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5276('0x3')]},'disposition':{'type':Sequelize[_0x5276('0x4')]},'secondDisposition':{'type':Sequelize[_0x5276('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5276('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x5276('0x4')]},'externalUrl':{'type':Sequelize[_0x5276('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5276('0x5')]('in',_0x5276('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5276('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5276('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5276('0x7')]}}; \ No newline at end of file +var _0xacc5=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacc5,0x104));var _0x5acc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacc5[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x5acc('0x0'));module[_0x5acc('0x1')]={'closed':{'type':Sequelize[_0x5acc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5acc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5acc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5acc('0x4')]},'note':{'type':Sequelize[_0x5acc('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5acc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5acc('0x5')]('in',_0x5acc('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5acc('0x2')],'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 42b64bb..6d9d5ac 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 _0x9ec2=['out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','undefined','offset','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','fields','length','attributes','includeAll','include','merge','options','create','body','find','describe','OpenchannelMessage','addMessage','ids','omit','findOne','hasOwnProperty','limit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','System','Contact','lastName'];(function(_0xa27dfb,_0x538f6b){var _0x547303=function(_0x5b071c){while(--_0x5b071c){_0xa27dfb['push'](_0xa27dfb['shift']());}};_0x547303(++_0x538f6b);}(_0x9ec2,0x8e));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x29ec('0x0'));var zipdir=require(_0x29ec('0x1'));var moment=require(_0x29ec('0x2'));var util=require(_0x29ec('0x3'));var path=require(_0x29ec('0x4'));var ejs=require(_0x29ec('0x5'));var fs=require('fs');var _=require(_0x29ec('0x6'));var Redis=require(_0x29ec('0x7'));var interaction=require(_0x29ec('0x8'));var qs=require(_0x29ec('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x29ec('0xa'))(_0x29ec('0xb'));var config=require(_0x29ec('0xc'));var db=require(_0x29ec('0xd'))['db'];config['redis']=_['defaults'](config[_0x29ec('0xe')],{'host':_0x29ec('0xf'),'port':0x18eb});var socket=require(_0x29ec('0x10'))(new Redis(config[_0x29ec('0xe')]));require(_0x29ec('0x11'))[_0x29ec('0x12')](socket);function respondWithStatusCode(_0x2aa4c0,_0x36508e){_0x36508e=_0x36508e||0xcc;return function(_0xa5440a){if(_0xa5440a){return _0x2aa4c0['sendStatus'](_0x36508e);}return _0x2aa4c0[_0x29ec('0x13')](_0x36508e)[_0x29ec('0x14')]();};}function respondWithResult(_0x3afff0,_0xcfeea9){_0xcfeea9=_0xcfeea9||0xc8;return function(_0x5b9bd5){if(_0x5b9bd5){return _0x3afff0[_0x29ec('0x13')](_0xcfeea9)[_0x29ec('0x15')](_0x5b9bd5);}};}function respondWithFilteredResult(_0x5b3f40,_0x2eadd4){return function(_0x342f3d){if(_0x342f3d){var _0x4f9a87=typeof _0x2eadd4['offset']===_0x29ec('0x16')&&typeof _0x2eadd4['limit']==='undefined';var _0x2cb4ff=_0x342f3d['count'];var _0x11b859=_0x4f9a87?0x0:_0x2eadd4[_0x29ec('0x17')];var _0x5de4c2=_0x4f9a87?_0x342f3d['count']:_0x2eadd4[_0x29ec('0x17')]+_0x2eadd4['limit'];var _0x292960;if(_0x5de4c2>=_0x2cb4ff){_0x5de4c2=_0x2cb4ff;_0x292960=0xc8;}else{_0x292960=0xce;}_0x5b3f40['status'](_0x292960);return _0x5b3f40['set'](_0x29ec('0x18'),_0x11b859+'-'+_0x5de4c2+'/'+_0x2cb4ff)[_0x29ec('0x15')](_0x342f3d);}return null;};}function saveUpdates(_0x582812){return function(_0x512583){if(_0x512583){return _0x512583[_0x29ec('0x19')](_0x582812)[_0x29ec('0x1a')](function(_0x2f11f8){return _0x2f11f8;});}return null;};}function removeEntity(_0x4150a7){return function(_0x214ebd){if(_0x214ebd){return _0x214ebd[_0x29ec('0x1b')]()[_0x29ec('0x1a')](function(){_0x4150a7[_0x29ec('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3342f2){return function(_0xd0b664){if(!_0xd0b664){_0x3342f2[_0x29ec('0x1c')](0x194);}return _0xd0b664;};}function handleError(_0x2f378c,_0x4e67d3){_0x4e67d3=_0x4e67d3||0x1f4;return function(_0x29d125){logger[_0x29ec('0x1d')](_0x29d125[_0x29ec('0x1e')]);if(_0x29d125[_0x29ec('0x1f')]){delete _0x29d125[_0x29ec('0x1f')];}_0x2f378c[_0x29ec('0x13')](_0x4e67d3)[_0x29ec('0x20')](_0x29d125);};}exports['index']=function(_0x95a474,_0xe60cb8){var _0x3fe1cc={};var _0x1c3085=_[_0x29ec('0x21')](db[_0x29ec('0x22')][_0x29ec('0x23')],function(_0x33a402){return{'name':_0x33a402[_0x29ec('0x24')],'type':_0x33a402[_0x29ec('0x25')][_0x29ec('0x26')]};});_0x3fe1cc=qs['getOptions'](_0x1c3085,_0x95a474);return interaction[_0x29ec('0x27')](_0x29ec('0x28'),_0x95a474[_0x29ec('0x29')],_0x95a474[_0x29ec('0x2a')],_0x3fe1cc,_0x1c3085)[_0x29ec('0x1a')](respondWithFilteredResult(_0xe60cb8,_0x3fe1cc))[_0x29ec('0x2b')](handleError(_0xe60cb8,null));};exports[_0x29ec('0x2c')]=function(_0x74c340,_0x2c3d31){var _0x1d7280={};if(_0x74c340['query'][_0x29ec('0x25')]&&_0x74c340[_0x29ec('0x29')][_0x29ec('0x25')]==='from'){_0x1d7280[_0x29ec('0x2d')]=_0x74c340[_0x29ec('0x2e')]['id'];}else{_0x1d7280['id']=_0x74c340[_0x29ec('0x2e')]['id'];}var _0x18d299={'raw':![],'where':_0x1d7280},_0x3324e1={};_0x3324e1[_0x29ec('0x2f')]=_[_0x29ec('0x30')](db[_0x29ec('0x22')][_0x29ec('0x23')]);_0x3324e1[_0x29ec('0x29')]=_['keys'](_0x74c340[_0x29ec('0x29')]);_0x3324e1[_0x29ec('0x31')]=_[_0x29ec('0x32')](_0x3324e1['model'],_0x3324e1[_0x29ec('0x29')]);_0x18d299['attributes']=_['intersection'](_0x3324e1[_0x29ec('0x2f')],qs[_0x29ec('0x33')](_0x74c340[_0x29ec('0x29')][_0x29ec('0x33')]));_0x18d299['attributes']=_0x18d299['attributes'][_0x29ec('0x34')]?_0x18d299[_0x29ec('0x35')]:_0x3324e1[_0x29ec('0x2f')];if(_0x74c340[_0x29ec('0x29')][_0x29ec('0x36')]){_0x18d299[_0x29ec('0x37')]=[{'all':!![]}];}_0x18d299=_[_0x29ec('0x38')]({},_0x18d299,_0x74c340[_0x29ec('0x39')]);return db[_0x29ec('0x22')]['find'](_0x18d299)[_0x29ec('0x1a')](handleEntityNotFound(_0x2c3d31,null))['then'](respondWithResult(_0x2c3d31,null))[_0x29ec('0x2b')](handleError(_0x2c3d31,null));};exports[_0x29ec('0x3a')]=function(_0x4bc5fa,_0x22f302){return db[_0x29ec('0x22')][_0x29ec('0x3a')](_0x4bc5fa[_0x29ec('0x3b')],{})[_0x29ec('0x1a')](respondWithResult(_0x22f302,0xc9))[_0x29ec('0x2b')](handleError(_0x22f302,null));};exports[_0x29ec('0x19')]=function(_0x5350f6,_0x5dac0e){if(_0x5350f6[_0x29ec('0x3b')]['id']){delete _0x5350f6[_0x29ec('0x3b')]['id'];}return db[_0x29ec('0x22')]['find']({'where':{'id':_0x5350f6['params']['id']}})[_0x29ec('0x1a')](handleEntityNotFound(_0x5dac0e,null))[_0x29ec('0x1a')](saveUpdates(_0x5350f6[_0x29ec('0x3b')],null))['then'](respondWithResult(_0x5dac0e,null))[_0x29ec('0x2b')](handleError(_0x5dac0e,null));};exports[_0x29ec('0x1b')]=function(_0x4bb341,_0x58c5f2){return db['OpenchannelInteraction'][_0x29ec('0x3c')]({'where':{'id':_0x4bb341[_0x29ec('0x2e')]['id']}})['then'](handleEntityNotFound(_0x58c5f2,null))[_0x29ec('0x1a')](removeEntity(_0x58c5f2,null))[_0x29ec('0x2b')](handleError(_0x58c5f2,null));};exports[_0x29ec('0x3d')]=function(_0x31a799,_0x317c0b){return db[_0x29ec('0x22')][_0x29ec('0x3d')]()[_0x29ec('0x1a')](respondWithResult(_0x317c0b,null))['catch'](handleError(_0x317c0b,null));};exports['addMessage']=function(_0x4ff16c,_0x439e45){return db[_0x29ec('0x3e')][_0x29ec('0x3c')]({'where':{'id':_0x4ff16c[_0x29ec('0x2e')]['id']}})[_0x29ec('0x1a')](handleEntityNotFound(_0x439e45,null))[_0x29ec('0x1a')](function(_0x201869){if(_0x201869){return _0x201869[_0x29ec('0x3f')](_0x4ff16c['body'][_0x29ec('0x40')],_[_0x29ec('0x41')](_0x4ff16c[_0x29ec('0x3b')],['ids','id'])||{});}})['then'](respondWithResult(_0x439e45,null))[_0x29ec('0x2b')](handleError(_0x439e45,null));};exports['getMessages']=function(_0x5cd4a1,_0x466d5e){var _0xd58c90={'raw':![],'where':{}};var _0x66ed22={};var _0x1360a1={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x29ec('0x42')]({'where':{'id':_0x5cd4a1[_0x29ec('0x2e')]['id']}})[_0x29ec('0x1a')](handleEntityNotFound(_0x466d5e,null))[_0x29ec('0x1a')](function(_0x280f2f){if(_0x280f2f){_0x66ed22[_0x29ec('0x2f')]=_['keys'](db[_0x29ec('0x3e')][_0x29ec('0x23')]);_0x66ed22[_0x29ec('0x29')]=_[_0x29ec('0x30')](_0x5cd4a1[_0x29ec('0x29')]);_0x66ed22[_0x29ec('0x31')]=_[_0x29ec('0x32')](_0x66ed22[_0x29ec('0x2f')],_0x66ed22[_0x29ec('0x29')]);_0xd58c90['attributes']=_['intersection'](_0x66ed22[_0x29ec('0x2f')],qs[_0x29ec('0x33')](_0x5cd4a1[_0x29ec('0x29')]['fields']));_0xd58c90[_0x29ec('0x35')]=_0xd58c90[_0x29ec('0x35')][_0x29ec('0x34')]?_0xd58c90['attributes']:_0x66ed22[_0x29ec('0x2f')];if(!_0x5cd4a1[_0x29ec('0x29')][_0x29ec('0x43')]('nolimit')){_0xd58c90['limit']=qs[_0x29ec('0x44')](_0x5cd4a1[_0x29ec('0x29')][_0x29ec('0x44')]);_0xd58c90[_0x29ec('0x17')]=qs[_0x29ec('0x17')](_0x5cd4a1['query'][_0x29ec('0x17')]);}_0xd58c90[_0x29ec('0x45')]=qs['sort'](_0x5cd4a1[_0x29ec('0x29')][_0x29ec('0x46')]);_0xd58c90[_0x29ec('0x47')]=qs[_0x29ec('0x31')](_[_0x29ec('0x48')](_0x5cd4a1['query'],_0x66ed22[_0x29ec('0x31')]));_0xd58c90['where'][_0x29ec('0x49')]=_0x280f2f['id'];if(_0x5cd4a1[_0x29ec('0x29')][_0x29ec('0x4a')]){_0xd58c90[_0x29ec('0x47')]=_[_0x29ec('0x38')](_0xd58c90[_0x29ec('0x47')],{'$or':_[_0x29ec('0x21')](_0xd58c90[_0x29ec('0x35')],function(_0x596e0c){var _0x561a6e={};_0x561a6e[_0x596e0c]={'$like':'%'+_0x5cd4a1[_0x29ec('0x29')]['filter']+'%'};return _0x561a6e;})});}if(_0x5cd4a1['query'][_0x29ec('0x4b')]){var _0x13c7c5=_0x5cd4a1[_0x29ec('0x29')]['$gte'][_0x29ec('0x4c')](',');var _0x88e658={};_0x88e658[_0x13c7c5[0x0]]={'$gte':moment(_0x13c7c5[0x1])[_0x29ec('0x4d')](_0x29ec('0x4e'))};_0xd58c90[_0x29ec('0x47')]=_['merge'](_0xd58c90[_0x29ec('0x47')],_0x88e658);}_0xd58c90=_[_0x29ec('0x38')]({},_0xd58c90,_0x5cd4a1[_0x29ec('0x39')]);return db[_0x29ec('0x3e')][_0x29ec('0x4f')]({'where':_0xd58c90[_0x29ec('0x47')]})[_0x29ec('0x1a')](function(_0x164094){_0x1360a1[_0x29ec('0x4f')]=_0x164094;if(_0x5cd4a1[_0x29ec('0x29')][_0x29ec('0x36')]){_0xd58c90[_0x29ec('0x37')]=[{'all':!![]}];}return db[_0x29ec('0x3e')][_0x29ec('0x27')](_0xd58c90);})[_0x29ec('0x1a')](function(_0x337ca8){_0x1360a1[_0x29ec('0x50')]=_0x337ca8;return _0x1360a1;});}})['then'](respondWithFilteredResult(_0x466d5e,_0xd58c90))['catch'](handleError(_0x466d5e,null));};exports[_0x29ec('0x51')]=function(_0x1e32b0,_0x3f599d){return db[_0x29ec('0x22')][_0x29ec('0x3c')]({'where':{'id':_0x1e32b0[_0x29ec('0x2e')]['id']}})[_0x29ec('0x1a')](handleEntityNotFound(_0x3f599d,null))['then'](function(_0x348077){if(_0x348077){return _0x348077[_0x29ec('0x52')](_0x1e32b0[_0x29ec('0x3b')][_0x29ec('0x40')],_[_0x29ec('0x41')](_0x1e32b0['body'],['ids','id'])||{})[_0x29ec('0x53')](function(){return db['Tag'][_0x29ec('0x27')]({'attributes':['id',_0x29ec('0x1f'),_0x29ec('0x54')],'where':{'id':_0x1e32b0[_0x29ec('0x3b')][_0x29ec('0x40')]}});})[_0x29ec('0x1a')](function(_0x2f711c){socket[_0x29ec('0x55')](_0x29ec('0x56'),{'id':Number(_0x1e32b0[_0x29ec('0x2e')]['id']),'tags':_0x2f711c||[]});return{'id':Number(_0x1e32b0[_0x29ec('0x2e')]['id']),'tags':_0x2f711c||[]};});}})[_0x29ec('0x1a')](respondWithResult(_0x3f599d,null))[_0x29ec('0x2b')](handleError(_0x3f599d,null));};exports[_0x29ec('0x57')]=function(_0x29ea47,_0x404b71){return db[_0x29ec('0x22')]['find']({'where':{'id':_0x29ea47[_0x29ec('0x2e')]['id']}})['then'](handleEntityNotFound(_0x404b71,null))[_0x29ec('0x1a')](function(_0x2e08e8){if(_0x2e08e8){return _0x2e08e8[_0x29ec('0x57')](_0x29ea47[_0x29ec('0x29')]['ids']);}})[_0x29ec('0x1a')](respondWithStatusCode(_0x404b71,null))[_0x29ec('0x2b')](handleError(_0x404b71,null));};exports[_0x29ec('0x58')]=function(_0x393dae,_0x57d99a){var _0x5e7d9e=moment()[_0x29ec('0x59')]()[_0x29ec('0x5a')]();var _0x5f28b4=path[_0x29ec('0x5b')](config[_0x29ec('0x5c')],'server',_0x29ec('0x5d'),_0x29ec('0x5e'));var _0x354b0c=path['join'](config[_0x29ec('0x5c')],_0x29ec('0x5f'),_0x29ec('0x5d'),_0x29ec('0x60'));var _0x447388=path[_0x29ec('0x5b')](_0x5f28b4,_0x5e7d9e);var _0x46b41d=util['format'](_0x29ec('0x61'),_0x393dae[_0x29ec('0x2e')]['id'],_0x5e7d9e);var _0x51c94a=path['join'](_0x5f28b4,_0x46b41d);var _0x5e66ab=[];_0x5e66ab[_0x29ec('0x62')]({'model':db[_0x29ec('0x63')],'as':_0x29ec('0x63'),'attributes':['id',_0x29ec('0x64')],'raw':!![]});_0x5e66ab[_0x29ec('0x62')]({'model':db[_0x29ec('0x65')],'as':'Contact','attributes':['id',_0x29ec('0x66'),'lastName'],'raw':!![]});if(_0x393dae[_0x29ec('0x29')]['attachments']){_0x5e66ab[_0x29ec('0x62')]({'model':db['Attachment'],'as':_0x29ec('0x67'),'raw':!![]});}var _0x236cf1=[{'model':db[_0x29ec('0x3e')],'as':'Messages','attributes':['id',_0x29ec('0x3b'),_0x29ec('0x68'),_0x29ec('0x69'),_0x29ec('0x6a'),_0x29ec('0x6b')],'include':_0x5e66ab}];_0x236cf1[_0x29ec('0x62')]({'model':db[_0x29ec('0x6c')],'as':_0x29ec('0x6d'),'attributes':['id',_0x29ec('0x1f')]});_0x236cf1[_0x29ec('0x62')]({'model':db[_0x29ec('0x63')],'as':_0x29ec('0x6e'),'attributes':['id',_0x29ec('0x64')]});return db[_0x29ec('0x22')]['find']({'where':{'id':_0x393dae[_0x29ec('0x2e')]['id']},'include':_0x236cf1})[_0x29ec('0x1a')](handleEntityNotFound(_0x57d99a,null))[_0x29ec('0x1a')](function(_0x38a75a){if(_0x38a75a){var _0x5d7b2c=_0x38a75a[_0x29ec('0x6f')]({'plain':!![]});fs[_0x29ec('0x70')](_0x447388);var _0x2d5936={'channel':_0x29ec('0x71'),'account':_0x5d7b2c[_0x29ec('0x6d')][_0x29ec('0x1f')],'agent':_0x5d7b2c[_0x29ec('0x6e')]?_0x5d7b2c[_0x29ec('0x6e')][_0x29ec('0x64')]:_0x29ec('0x72'),'createdAt':moment(_0x5d7b2c[_0x29ec('0x68')])[_0x29ec('0x4d')](_0x29ec('0x4e'))[_0x29ec('0x5a')](),'closedAt':_0x5d7b2c['closed']?moment(_0x5d7b2c[_0x29ec('0x73')])[_0x29ec('0x4d')](_0x29ec('0x4e'))['toString']():'','disposition':_0x5d7b2c['disposition'],'visibility':_0x5d7b2c['threadId']?_0x29ec('0x74'):_0x29ec('0x75'),'messages':_(_0x5d7b2c['Messages'])[_0x29ec('0x4a')]({'secret':![]})['map'](function(_0x4e67ef){if(_0x4e67ef[_0x29ec('0x67')]){var _0xe855ed=path[_0x29ec('0x5b')](_0x354b0c,_0x4e67ef[_0x29ec('0x67')]['basename']);if(fs[_0x29ec('0x76')](_0xe855ed)){fs[_0x29ec('0x77')](_0xe855ed)[_0x29ec('0x78')](fs[_0x29ec('0x79')](path['join'](_0x447388,_0x4e67ef[_0x29ec('0x67')][_0x29ec('0x7a')])));}}return{'date':moment(_0x4e67ef['createdAt'])['format'](_0x29ec('0x4e'))[_0x29ec('0x5a')](),'sender':_0x4e67ef[_0x29ec('0x69')]==='out'?_0x4e67ef[_0x29ec('0x63')]?_0x4e67ef[_0x29ec('0x63')]['fullname']:_0x29ec('0x7b'):_0x4e67ef['Contact'][_0x29ec('0x66')]+(_0x4e67ef[_0x29ec('0x7c')][_0x29ec('0x7d')]?'\x20'+_0x4e67ef[_0x29ec('0x7c')]['lastName']:''),'body':_0x4e67ef[_0x29ec('0x67')]?_0x4e67ef[_0x29ec('0x67')]['basename']:_0x4e67ef[_0x29ec('0x3b')],'direction':_0x4e67ef[_0x29ec('0x69')]===_0x29ec('0x7e')?'A':'C','secret':_0x4e67ef['secret'],'read':_0x4e67ef[_0x29ec('0x6b')],'attachment':_0x4e67ef[_0x29ec('0x67')]};})[_0x29ec('0x7f')]()};return ejs[_0x29ec('0x80')](path['join'](config[_0x29ec('0x5c')],'server',_0x29ec('0x81'),_0x29ec('0x82')),{'interaction':_0x2d5936})[_0x29ec('0x1a')](function(_0x331e49){var _0x3b41ca=path[_0x29ec('0x5b')](_0x447388,_0x29ec('0x83')+_0x5d7b2c['id']+'-'+_0x5e7d9e+_0x29ec('0x84'));var _0x54f789={'path':_0x3b41ca,'channel':'Openchannel','interactionId':_0x5d7b2c['id']};return pdf[_0x29ec('0x85')](_0x331e49,_0x54f789);})[_0x29ec('0x1a')](function(){return new Promise(function(_0x5d038f,_0xef2091){zipdir(_0x447388,{'saveTo':_0x51c94a},function(_0x3c9608,_0xe34976){if(_0x3c9608)return _0xef2091(_0x3c9608);return _0x5d038f(_0xe34976);});})[_0x29ec('0x1a')](function(){return new Promise(function(_0x1c65b3,_0x41756c){rimraf(_0x447388,function(_0x25d67c){if(_0x25d67c)_0x41756c(_0x25d67c);return _0x1c65b3();});});})[_0x29ec('0x1a')](function(){return _0x57d99a[_0x29ec('0x58')](_0x51c94a,_0x46b41d,function(_0x7aac89){if(_0x7aac89){logger[_0x29ec('0x1d')]('Unable\x20to\x20delete\x20zip\x20file',_0x7aac89);}else{fs['unlinkSync'](_0x51c94a);}});});});}else{return _0x57d99a[_0x29ec('0x1c')](0xc8);}})[_0x29ec('0x2b')](handleError(_0x57d99a,null));}; \ No newline at end of file +var _0x9727=['fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','disposition','Private','map','basename','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','moment','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','then','error','stack','send','getOptions','findAll','query','user','catch','show','type','params','model','keys','OpenchannelInteraction','rawAttributes','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','order','sort','where','filters','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','name','emit','removeTags','unix','toString','server','files','tmp','join','root','attachments','push','User'];(function(_0x2a04df,_0x48f2de){var _0x1369a2=function(_0x11724e){while(--_0x11724e){_0x2a04df['push'](_0x2a04df['shift']());}};_0x1369a2(++_0x48f2de);}(_0x9727,0x18a));var _0x7972=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x9727[_0x644560];return _0x41b76b;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x7972('0x0'));var util=require(_0x7972('0x1'));var path=require('path');var ejs=require(_0x7972('0x2'));var fs=require('fs');var _=require(_0x7972('0x3'));var Redis=require(_0x7972('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x7972('0x5'));var pdf=require(_0x7972('0x6'));var logger=require(_0x7972('0x7'))(_0x7972('0x8'));var config=require(_0x7972('0x9'));var db=require('../../mysqldb')['db'];config[_0x7972('0xa')]=_[_0x7972('0xb')](config[_0x7972('0xa')],{'host':_0x7972('0xc'),'port':0x18eb});var socket=require(_0x7972('0xd'))(new Redis(config[_0x7972('0xa')]));require('./openchannelInteraction.socket')[_0x7972('0xe')](socket);function respondWithStatusCode(_0x21435f,_0x552c24){_0x552c24=_0x552c24||0xcc;return function(_0x43b1c7){if(_0x43b1c7){return _0x21435f[_0x7972('0xf')](_0x552c24);}return _0x21435f['status'](_0x552c24)[_0x7972('0x10')]();};}function respondWithResult(_0x5500c7,_0x563312){_0x563312=_0x563312||0xc8;return function(_0x4291e1){if(_0x4291e1){return _0x5500c7[_0x7972('0x11')](_0x563312)[_0x7972('0x12')](_0x4291e1);}};}function respondWithFilteredResult(_0x2da42f,_0x10cd0){return function(_0x4de6dc){if(_0x4de6dc){var _0x2eacd8=typeof _0x10cd0[_0x7972('0x13')]===_0x7972('0x14')&&typeof _0x10cd0[_0x7972('0x15')]==='undefined';var _0x535a11=_0x4de6dc[_0x7972('0x16')];var _0x32056c=_0x2eacd8?0x0:_0x10cd0[_0x7972('0x13')];var _0x4a7151=_0x2eacd8?_0x4de6dc[_0x7972('0x16')]:_0x10cd0[_0x7972('0x13')]+_0x10cd0['limit'];var _0x106949;if(_0x4a7151>=_0x535a11){_0x4a7151=_0x535a11;_0x106949=0xc8;}else{_0x106949=0xce;}_0x2da42f[_0x7972('0x11')](_0x106949);return _0x2da42f['set'](_0x7972('0x17'),_0x32056c+'-'+_0x4a7151+'/'+_0x535a11)[_0x7972('0x12')](_0x4de6dc);}return null;};}function saveUpdates(_0x53b392){return function(_0x1dbea3){if(_0x1dbea3){return _0x1dbea3['update'](_0x53b392)[_0x7972('0x18')](function(_0x1eb0da){return _0x1eb0da;});}return null;};}function removeEntity(_0x30bae4){return function(_0xe401f4){if(_0xe401f4){return _0xe401f4['destroy']()[_0x7972('0x18')](function(){_0x30bae4[_0x7972('0x11')](0xcc)[_0x7972('0x10')]();});}};}function handleEntityNotFound(_0x26690a){return function(_0x3d6150){if(!_0x3d6150){_0x26690a[_0x7972('0xf')](0x194);}return _0x3d6150;};}function handleError(_0x200447,_0x502b61){_0x502b61=_0x502b61||0x1f4;return function(_0x543c7d){logger[_0x7972('0x19')](_0x543c7d[_0x7972('0x1a')]);if(_0x543c7d['name']){delete _0x543c7d['name'];}_0x200447[_0x7972('0x11')](_0x502b61)[_0x7972('0x1b')](_0x543c7d);};}exports['index']=function(_0x172565,_0x297b65){var _0x36be9f={};var _0x477747=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x30a94e){return{'name':_0x30a94e['fieldName'],'type':_0x30a94e['type']['key']};});_0x36be9f=qs[_0x7972('0x1c')](_0x477747,_0x172565);return interaction[_0x7972('0x1d')]('openchannel',_0x172565[_0x7972('0x1e')],_0x172565[_0x7972('0x1f')],_0x36be9f,_0x477747)[_0x7972('0x18')](respondWithFilteredResult(_0x297b65,_0x36be9f))[_0x7972('0x20')](handleError(_0x297b65,null));};exports[_0x7972('0x21')]=function(_0x281318,_0x1a5534){var _0x2299b8={};if(_0x281318[_0x7972('0x1e')][_0x7972('0x22')]&&_0x281318[_0x7972('0x1e')]['type']==='from'){_0x2299b8['from']=_0x281318[_0x7972('0x23')]['id'];}else{_0x2299b8['id']=_0x281318[_0x7972('0x23')]['id'];}var _0x25697c={'raw':![],'where':_0x2299b8},_0x21a2a1={};_0x21a2a1[_0x7972('0x24')]=_[_0x7972('0x25')](db[_0x7972('0x26')][_0x7972('0x27')]);_0x21a2a1[_0x7972('0x1e')]=_[_0x7972('0x25')](_0x281318['query']);_0x21a2a1['filters']=_[_0x7972('0x28')](_0x21a2a1[_0x7972('0x24')],_0x21a2a1[_0x7972('0x1e')]);_0x25697c[_0x7972('0x29')]=_['intersection'](_0x21a2a1[_0x7972('0x24')],qs[_0x7972('0x2a')](_0x281318[_0x7972('0x1e')][_0x7972('0x2a')]));_0x25697c[_0x7972('0x29')]=_0x25697c[_0x7972('0x29')]['length']?_0x25697c[_0x7972('0x29')]:_0x21a2a1[_0x7972('0x24')];if(_0x281318[_0x7972('0x1e')][_0x7972('0x2b')]){_0x25697c[_0x7972('0x2c')]=[{'all':!![]}];}_0x25697c=_[_0x7972('0x2d')]({},_0x25697c,_0x281318[_0x7972('0x2e')]);return db['OpenchannelInteraction'][_0x7972('0x2f')](_0x25697c)[_0x7972('0x18')](handleEntityNotFound(_0x1a5534,null))[_0x7972('0x18')](respondWithResult(_0x1a5534,null))[_0x7972('0x20')](handleError(_0x1a5534,null));};exports[_0x7972('0x30')]=function(_0x4e4339,_0xb1816){return db['OpenchannelInteraction'][_0x7972('0x30')](_0x4e4339[_0x7972('0x31')],{})[_0x7972('0x18')](respondWithResult(_0xb1816,0xc9))[_0x7972('0x20')](handleError(_0xb1816,null));};exports['update']=function(_0x1c52d5,_0x51ad05){if(_0x1c52d5[_0x7972('0x31')]['id']){delete _0x1c52d5[_0x7972('0x31')]['id'];}return db['OpenchannelInteraction'][_0x7972('0x2f')]({'where':{'id':_0x1c52d5['params']['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x51ad05,null))['then'](saveUpdates(_0x1c52d5[_0x7972('0x31')],null))['then'](respondWithResult(_0x51ad05,null))[_0x7972('0x20')](handleError(_0x51ad05,null));};exports[_0x7972('0x32')]=function(_0x552d65,_0x3d39a9){return db[_0x7972('0x26')][_0x7972('0x2f')]({'where':{'id':_0x552d65[_0x7972('0x23')]['id']}})['then'](handleEntityNotFound(_0x3d39a9,null))[_0x7972('0x18')](removeEntity(_0x3d39a9,null))[_0x7972('0x20')](handleError(_0x3d39a9,null));};exports['describe']=function(_0x159a83,_0x1f5e38){return db[_0x7972('0x26')][_0x7972('0x33')]()['then'](respondWithResult(_0x1f5e38,null))[_0x7972('0x20')](handleError(_0x1f5e38,null));};exports[_0x7972('0x34')]=function(_0x21d049,_0xefe6a){return db['OpenchannelMessage'][_0x7972('0x2f')]({'where':{'id':_0x21d049[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0xefe6a,null))['then'](function(_0x47c0c1){if(_0x47c0c1){return _0x47c0c1[_0x7972('0x34')](_0x21d049[_0x7972('0x31')][_0x7972('0x35')],_['omit'](_0x21d049[_0x7972('0x31')],[_0x7972('0x35'),'id'])||{});}})[_0x7972('0x18')](respondWithResult(_0xefe6a,null))['catch'](handleError(_0xefe6a,null));};exports[_0x7972('0x36')]=function(_0x5c3d8b,_0xc03ff2){var _0x4d8774={'raw':![],'where':{}};var _0x5a25ae={};var _0x1ceabb={'count':0x0,'rows':[]};return db[_0x7972('0x26')][_0x7972('0x37')]({'where':{'id':_0x5c3d8b[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0xc03ff2,null))[_0x7972('0x18')](function(_0x28c6d2){if(_0x28c6d2){_0x5a25ae[_0x7972('0x24')]=_[_0x7972('0x25')](db[_0x7972('0x38')][_0x7972('0x27')]);_0x5a25ae[_0x7972('0x1e')]=_['keys'](_0x5c3d8b[_0x7972('0x1e')]);_0x5a25ae['filters']=_['intersection'](_0x5a25ae['model'],_0x5a25ae[_0x7972('0x1e')]);_0x4d8774[_0x7972('0x29')]=_['intersection'](_0x5a25ae[_0x7972('0x24')],qs[_0x7972('0x2a')](_0x5c3d8b[_0x7972('0x1e')]['fields']));_0x4d8774[_0x7972('0x29')]=_0x4d8774[_0x7972('0x29')][_0x7972('0x39')]?_0x4d8774[_0x7972('0x29')]:_0x5a25ae[_0x7972('0x24')];if(!_0x5c3d8b['query']['hasOwnProperty']('nolimit')){_0x4d8774['limit']=qs[_0x7972('0x15')](_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x15')]);_0x4d8774['offset']=qs['offset'](_0x5c3d8b[_0x7972('0x1e')]['offset']);}_0x4d8774[_0x7972('0x3a')]=qs[_0x7972('0x3b')](_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x3b')]);_0x4d8774[_0x7972('0x3c')]=qs[_0x7972('0x3d')](_['pick'](_0x5c3d8b[_0x7972('0x1e')],_0x5a25ae[_0x7972('0x3d')]));_0x4d8774[_0x7972('0x3c')][_0x7972('0x3e')]=_0x28c6d2['id'];if(_0x5c3d8b['query'][_0x7972('0x3f')]){_0x4d8774[_0x7972('0x3c')]=_[_0x7972('0x2d')](_0x4d8774['where'],{'$or':_['map'](_0x4d8774[_0x7972('0x29')],function(_0x49aa8e){var _0x5bd20b={};_0x5bd20b[_0x49aa8e]={'$like':'%'+_0x5c3d8b['query'][_0x7972('0x3f')]+'%'};return _0x5bd20b;})});}if(_0x5c3d8b[_0x7972('0x1e')][_0x7972('0x40')]){var _0x2319d2=_0x5c3d8b['query']['$gte'][_0x7972('0x41')](',');var _0x2fa17e={};_0x2fa17e[_0x2319d2[0x0]]={'$gte':moment(_0x2319d2[0x1])[_0x7972('0x42')](_0x7972('0x43'))};_0x4d8774[_0x7972('0x3c')]=_[_0x7972('0x2d')](_0x4d8774[_0x7972('0x3c')],_0x2fa17e);}_0x4d8774=_[_0x7972('0x2d')]({},_0x4d8774,_0x5c3d8b['options']);return db['OpenchannelMessage'][_0x7972('0x16')]({'where':_0x4d8774['where']})[_0x7972('0x18')](function(_0x340ad9){_0x1ceabb[_0x7972('0x16')]=_0x340ad9;if(_0x5c3d8b[_0x7972('0x1e')]['includeAll']){_0x4d8774[_0x7972('0x2c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7972('0x1d')](_0x4d8774);})['then'](function(_0x1c81f2){_0x1ceabb[_0x7972('0x44')]=_0x1c81f2;return _0x1ceabb;});}})[_0x7972('0x18')](respondWithFilteredResult(_0xc03ff2,_0x4d8774))[_0x7972('0x20')](handleError(_0xc03ff2,null));};exports[_0x7972('0x45')]=function(_0x58d87d,_0x22067a){return db[_0x7972('0x26')]['find']({'where':{'id':_0x58d87d['params']['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x22067a,null))[_0x7972('0x18')](function(_0xee08c3){if(_0xee08c3){return _0xee08c3['setTags'](_0x58d87d[_0x7972('0x31')][_0x7972('0x35')],_[_0x7972('0x46')](_0x58d87d[_0x7972('0x31')],['ids','id'])||{})[_0x7972('0x47')](function(){return db[_0x7972('0x48')][_0x7972('0x1d')]({'attributes':['id',_0x7972('0x49'),'color'],'where':{'id':_0x58d87d['body'][_0x7972('0x35')]}});})[_0x7972('0x18')](function(_0x69fcdc){socket[_0x7972('0x4a')]('openchannelInteractionTags:save',{'id':Number(_0x58d87d['params']['id']),'tags':_0x69fcdc||[]});return{'id':Number(_0x58d87d[_0x7972('0x23')]['id']),'tags':_0x69fcdc||[]};});}})[_0x7972('0x18')](respondWithResult(_0x22067a,null))[_0x7972('0x20')](handleError(_0x22067a,null));};exports[_0x7972('0x4b')]=function(_0x4af89d,_0x276714){return db['OpenchannelInteraction'][_0x7972('0x2f')]({'where':{'id':_0x4af89d[_0x7972('0x23')]['id']}})[_0x7972('0x18')](handleEntityNotFound(_0x276714,null))[_0x7972('0x18')](function(_0x14b1d4){if(_0x14b1d4){return _0x14b1d4['removeTags'](_0x4af89d[_0x7972('0x1e')]['ids']);}})['then'](respondWithStatusCode(_0x276714,null))[_0x7972('0x20')](handleError(_0x276714,null));};exports['download']=function(_0x4a9f66,_0x7aab4d){var _0x3c71d4=moment()[_0x7972('0x4c')]()[_0x7972('0x4d')]();var _0x2d9063=path['join'](config['root'],_0x7972('0x4e'),_0x7972('0x4f'),_0x7972('0x50'));var _0x5e824c=path[_0x7972('0x51')](config[_0x7972('0x52')],_0x7972('0x4e'),'files',_0x7972('0x53'));var _0x5e1ac7=path[_0x7972('0x51')](_0x2d9063,_0x3c71d4);var _0x1e63a3=util[_0x7972('0x42')]('transcript-%d-%s.zip',_0x4a9f66['params']['id'],_0x3c71d4);var _0xa27e94=path[_0x7972('0x51')](_0x2d9063,_0x1e63a3);var _0x3a2407=[];_0x3a2407[_0x7972('0x54')]({'model':db[_0x7972('0x55')],'as':_0x7972('0x55'),'attributes':['id',_0x7972('0x56')],'raw':!![]});_0x3a2407[_0x7972('0x54')]({'model':db[_0x7972('0x57')],'as':_0x7972('0x58'),'attributes':['id',_0x7972('0x59'),_0x7972('0x5a')],'raw':!![]});if(_0x4a9f66[_0x7972('0x1e')]['attachments']){_0x3a2407['push']({'model':db['Attachment'],'as':_0x7972('0x5b'),'raw':!![]});}var _0x48879d=[{'model':db[_0x7972('0x38')],'as':_0x7972('0x5c'),'attributes':['id','body',_0x7972('0x5d'),_0x7972('0x5e'),_0x7972('0x5f'),_0x7972('0x60')],'include':_0x3a2407}];_0x48879d[_0x7972('0x54')]({'model':db[_0x7972('0x61')],'as':_0x7972('0x62'),'attributes':['id',_0x7972('0x49')]});_0x48879d[_0x7972('0x54')]({'model':db[_0x7972('0x55')],'as':'Owner','attributes':['id','fullname']});return db[_0x7972('0x26')]['find']({'where':{'id':_0x4a9f66[_0x7972('0x23')]['id']},'include':_0x48879d})['then'](handleEntityNotFound(_0x7aab4d,null))[_0x7972('0x18')](function(_0x580443){if(_0x580443){var _0x2be0f4=_0x580443[_0x7972('0x63')]({'plain':!![]});fs[_0x7972('0x64')](_0x5e1ac7);var _0x5155c1={'channel':_0x7972('0x65'),'account':_0x2be0f4['Account']['name'],'agent':_0x2be0f4[_0x7972('0x66')]?_0x2be0f4[_0x7972('0x66')]['fullname']:_0x7972('0x67'),'createdAt':moment(_0x2be0f4[_0x7972('0x5d')])['format'](_0x7972('0x43'))[_0x7972('0x4d')](),'closedAt':_0x2be0f4[_0x7972('0x68')]?moment(_0x2be0f4['closedAt'])[_0x7972('0x42')](_0x7972('0x43'))[_0x7972('0x4d')]():'','disposition':_0x2be0f4[_0x7972('0x69')],'visibility':_0x2be0f4['threadId']?'Public':_0x7972('0x6a'),'messages':_(_0x2be0f4[_0x7972('0x5c')])[_0x7972('0x3f')]({'secret':![]})[_0x7972('0x6b')](function(_0x30dc98){if(_0x30dc98[_0x7972('0x5b')]){var _0x9664f3=path[_0x7972('0x51')](_0x5e824c,_0x30dc98[_0x7972('0x5b')][_0x7972('0x6c')]);if(fs['existsSync'](_0x9664f3)){fs['createReadStream'](_0x9664f3)['pipe'](fs[_0x7972('0x6d')](path[_0x7972('0x51')](_0x5e1ac7,_0x30dc98[_0x7972('0x5b')][_0x7972('0x6c')])));}}return{'date':moment(_0x30dc98[_0x7972('0x5d')])['format'](_0x7972('0x43'))['toString'](),'sender':_0x30dc98[_0x7972('0x5e')]===_0x7972('0x6e')?_0x30dc98['User']?_0x30dc98['User'][_0x7972('0x56')]:_0x7972('0x6f'):_0x30dc98[_0x7972('0x58')][_0x7972('0x59')]+(_0x30dc98['Contact'][_0x7972('0x5a')]?'\x20'+_0x30dc98[_0x7972('0x58')][_0x7972('0x5a')]:''),'body':_0x30dc98[_0x7972('0x5b')]?_0x30dc98['Attachment']['basename']:_0x30dc98[_0x7972('0x31')],'direction':_0x30dc98['direction']===_0x7972('0x6e')?'A':'C','secret':_0x30dc98[_0x7972('0x5f')],'read':_0x30dc98[_0x7972('0x60')],'attachment':_0x30dc98['Attachment']};})[_0x7972('0x70')]()};return ejs[_0x7972('0x71')](path[_0x7972('0x51')](config['root'],_0x7972('0x4e'),_0x7972('0x72'),_0x7972('0x73')),{'interaction':_0x5155c1})[_0x7972('0x18')](function(_0x25a299){var _0x2d30a6=path['join'](_0x5e1ac7,_0x7972('0x74')+_0x2be0f4['id']+'-'+_0x3c71d4+_0x7972('0x75'));var _0x39a8e5={'path':_0x2d30a6,'channel':_0x7972('0x65'),'interactionId':_0x2be0f4['id']};return pdf[_0x7972('0x76')](_0x25a299,_0x39a8e5);})[_0x7972('0x18')](function(){return new Promise(function(_0x354470,_0x14bc06){zipdir(_0x5e1ac7,{'saveTo':_0xa27e94},function(_0x13ae1c,_0x165073){if(_0x13ae1c)return _0x14bc06(_0x13ae1c);return _0x354470(_0x165073);});})[_0x7972('0x18')](function(){return new Promise(function(_0x120aa7,_0x4f15ac){rimraf(_0x5e1ac7,function(_0x69e094){if(_0x69e094)_0x4f15ac(_0x69e094);return _0x120aa7();});});})[_0x7972('0x18')](function(){return _0x7aab4d['download'](_0xa27e94,_0x1e63a3,function(_0x566dda){if(_0x566dda){logger[_0x7972('0x19')](_0x7972('0x77'),_0x566dda);}else{fs['unlinkSync'](_0xa27e94);}});});});}else{return _0x7aab4d[_0x7972('0xf')](0xc8);}})['catch'](handleError(_0x7aab4d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b772014..df7f7c1 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 _0x6494=['catch','hasOwnProperty','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','then','findAll','length','emit'];(function(_0x49eff3,_0x1ece29){var _0x12dc77=function(_0x3b5dfa){while(--_0x3b5dfa){_0x49eff3['push'](_0x49eff3['shift']());}};_0x12dc77(++_0x1ece29);}(_0x6494,0xc3));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4649('0x0')];var OpenchannelMessage=require(_0x4649('0x1'))['db'][_0x4649('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4649('0x3')](0x0);var events={'afterCreate':_0x4649('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xa8a458){return function(_0x177a2d,_0xa36905,_0x4d19c6){_0x177a2d['getUsers']({'attributes':['id'],'raw':!![]})[_0x4649('0x5')](function(_0x218232){_0x177a2d['setDataValue']('Users',_0x218232['map'](function(_0x37de47){return{'id':_0x37de47['id']};}));return OpenchannelMessage[_0x4649('0x6')]({'where':{'OpenchannelInteractionId':_0x177a2d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4649('0x5')](function(_0x186eb5){_0x177a2d['setDataValue']('unreadMessages',_0x186eb5[_0x4649('0x7')]);OpenchannelInteractionEvents[_0x4649('0x8')](_0xa8a458+':'+_0x177a2d['id'],_0x177a2d);OpenchannelInteractionEvents['emit'](_0xa8a458,_0x177a2d);_0x4d19c6(null);})[_0x4649('0x9')](_0x4d19c6(null));};}for(var e in events){if(events[_0x4649('0xa')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4649('0xb')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0193=['Users','map','findAll','unreadMessages','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x10355a,_0x5ab3b9){var _0x3481ba=function(_0x271719){while(--_0x271719){_0x10355a['push'](_0x10355a['shift']());}};_0x3481ba(++_0x5ab3b9);}(_0x0193,0xd9));var _0x3019=function(_0x59c95f,_0xe7dbe7){_0x59c95f=_0x59c95f-0x0;var _0x42b4d5=_0x0193[_0x59c95f];return _0x42b4d5;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3019('0x0'))['db'][_0x3019('0x1')];var OpenchannelMessage=require(_0x3019('0x0'))['db'][_0x3019('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3019('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3019('0x4'),'afterDestroy':_0x3019('0x5')};function emitEvent(_0x5d7feb){return function(_0x267ada,_0x285a54,_0x200c5f){_0x267ada[_0x3019('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d7a70){_0x267ada[_0x3019('0x7')](_0x3019('0x8'),_0x1d7a70[_0x3019('0x9')](function(_0x12c3ad){return{'id':_0x12c3ad['id']};}));return OpenchannelMessage[_0x3019('0xa')]({'where':{'OpenchannelInteractionId':_0x267ada['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x345ace){_0x267ada[_0x3019('0x7')](_0x3019('0xb'),_0x345ace['length']);OpenchannelInteractionEvents['emit'](_0x5d7feb+':'+_0x267ada['id'],_0x267ada);OpenchannelInteractionEvents[_0x3019('0xc')](_0x5d7feb,_0x267ada);_0x200c5f(null);})['catch'](_0x200c5f(null));};}for(var e in events){if(events[_0x3019('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x3019('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index de43e3b..c983d8f 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 _0x99b3=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed'];(function(_0x367016,_0x14a108){var _0x2fbf40=function(_0x2daa3b){while(--_0x2daa3b){_0x367016['push'](_0x367016['shift']());}};_0x2fbf40(++_0x14a108);}(_0x99b3,0xe6));var _0x399b=function(_0x4c1474,_0x278040){_0x4c1474=_0x4c1474-0x0;var _0x3d892e=_0x99b3[_0x4c1474];return _0x3d892e;};'use strict';var _=require(_0x399b('0x0'));var util=require(_0x399b('0x1'));var logger=require(_0x399b('0x2'))(_0x399b('0x3'));var moment=require(_0x399b('0x4'));var BPromise=require(_0x399b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x399b('0x6'));var rimraf=require(_0x399b('0x7'));var config=require(_0x399b('0x8'));var attributes=require(_0x399b('0x9'));module[_0x399b('0xa')]=function(_0x578383,_0xa143c5){return _0x578383[_0x399b('0xb')](_0x399b('0xc'),attributes,{'tableName':_0x399b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x399b('0xe'),'hooks':{'beforeUpdate':function(_0x4b513e,_0x2bf09e,_0x42fa8e){if(_0x4b513e[_0x399b('0xf')](_0x399b('0x10'))){_0x4b513e[_0x399b('0x11')]=moment()['format'](_0x399b('0x12'));}_0x42fa8e(null,_0x4b513e);}}});}; \ No newline at end of file +var _0x0a14=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3bb7d1,_0x5913e9){var _0x15a5be=function(_0x9d2542){while(--_0x9d2542){_0x3bb7d1['push'](_0x3bb7d1['shift']());}};_0x15a5be(++_0x5913e9);}(_0x0a14,0x120));var _0x40a1=function(_0x30afa8,_0x4f089d){_0x30afa8=_0x30afa8-0x0;var _0x4286b7=_0x0a14[_0x30afa8];return _0x4286b7;};'use strict';var _=require(_0x40a1('0x0'));var util=require(_0x40a1('0x1'));var logger=require(_0x40a1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x40a1('0x3'));var rp=require(_0x40a1('0x4'));var fs=require('fs');var path=require(_0x40a1('0x5'));var rimraf=require(_0x40a1('0x6'));var config=require(_0x40a1('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x40a1('0x8')]=function(_0x28da3d,_0x52bc3c){return _0x28da3d[_0x40a1('0x9')](_0x40a1('0xa'),attributes,{'tableName':_0x40a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x40a1('0xc'),'hooks':{'beforeUpdate':function(_0x1734aa,_0x46bf4b,_0x145f43){if(_0x1734aa[_0x40a1('0xd')](_0x40a1('0xe'))){_0x1734aa[_0x40a1('0xf')]=moment()[_0x40a1('0x10')](_0x40a1('0x11'));}_0x145f43(null,_0x1734aa);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ad32a2a..5c4ca1c 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 _0xfe90=['redis','defaults','localhost','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','stringify','AddTagsToOpenchannelInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe90,0x13c));var _0x0fe9=function(_0x418eea,_0x5b1a8d){_0x418eea=_0x418eea-0x0;var _0x20690e=_0xfe90[_0x418eea];return _0x20690e;};'use strict';var _=require(_0x0fe9('0x0'));var util=require(_0x0fe9('0x1'));var moment=require(_0x0fe9('0x2'));var BPromise=require(_0x0fe9('0x3'));var rs=require(_0x0fe9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fe9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fe9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fe9('0x7')]['http']({'port':0x232a});config[_0x0fe9('0x8')]=_[_0x0fe9('0x9')](config[_0x0fe9('0x8')],{'host':_0x0fe9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fe9('0x8')]));require(_0x0fe9('0xb'))['register'](socket);function respondWithRpcPromise(_0xe9d39b,_0x6d5e0,_0x329ba4){return new BPromise(function(_0x57e900,_0x1706d2){return client[_0x0fe9('0xc')](_0xe9d39b,_0x329ba4)[_0x0fe9('0xd')](function(_0x195bb3){logger['info'](_0x0fe9('0xe'),_0x6d5e0,_0x0fe9('0xf'));logger[_0x0fe9('0x10')](_0x0fe9('0x11'),_0x6d5e0,'request\x20sent',JSON['stringify'](_0x195bb3));if(_0x195bb3[_0x0fe9('0x12')]){if(_0x195bb3[_0x0fe9('0x12')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x6d5e0,_0x195bb3[_0x0fe9('0x12')]['message']);return _0x1706d2(_0x195bb3[_0x0fe9('0x12')][_0x0fe9('0x13')]);}logger[_0x0fe9('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x6d5e0,_0x195bb3[_0x0fe9('0x12')][_0x0fe9('0x13')]);return _0x57e900(_0x195bb3['error']['message']);}else{logger[_0x0fe9('0x14')](_0x0fe9('0xe'),_0x6d5e0,_0x0fe9('0xf'));_0x57e900(_0x195bb3['result'][_0x0fe9('0x13')]);}})[_0x0fe9('0x15')](function(_0x15c80d){logger['error'](_0x0fe9('0xe'),_0x6d5e0,_0x15c80d);_0x1706d2(_0x15c80d);});});}exports[_0x0fe9('0x16')]=function(_0x1a3a24){var _0x596b18=this;return new Promise(function(_0x3877d,_0x11d9c3){return db[_0x0fe9('0x17')]['update'](_0x1a3a24['body'],{'raw':_0x1a3a24['options']?_0x1a3a24[_0x0fe9('0x18')][_0x0fe9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a3a24['options']?_0x1a3a24[_0x0fe9('0x18')][_0x0fe9('0x1a')]||null:null,'attributes':_0x1a3a24[_0x0fe9('0x18')]?_0x1a3a24[_0x0fe9('0x18')][_0x0fe9('0x1b')]||null:null,'limit':_0x1a3a24[_0x0fe9('0x18')]?_0x1a3a24[_0x0fe9('0x18')]['limit']||null:null})[_0x0fe9('0xd')](function(_0x1b329d){logger[_0x0fe9('0x14')](_0x0fe9('0x16'),_0x1a3a24);logger[_0x0fe9('0x10')](_0x0fe9('0x16'),_0x1a3a24,JSON[_0x0fe9('0x1c')](_0x1b329d));_0x3877d(_0x1b329d);})[_0x0fe9('0x15')](function(_0x21f333){logger[_0x0fe9('0x12')](_0x0fe9('0x16'),_0x21f333['message'],_0x1a3a24);_0x11d9c3(_0x596b18['error'](0x1f4,_0x21f333['message']));});});};exports[_0x0fe9('0x1d')]=function(_0xbb86dc){return new Promise(function(_0x355e4d,_0x1438a2){return db['OpenchannelInteraction'][_0x0fe9('0x1e')]({'where':_0xbb86dc['options']?_0xbb86dc['options'][_0x0fe9('0x1a')]||null:null})['then'](function(_0x378867){if(_0x378867){return _0x378867['addTags'](_0xbb86dc[_0x0fe9('0x1f')][_0x0fe9('0x20')],_[_0x0fe9('0x21')](_0xbb86dc[_0x0fe9('0x1f')],[_0x0fe9('0x20'),'id'])||{});}})[_0x0fe9('0x22')](function(_0x105c25){logger[_0x0fe9('0x14')]('AddTags',_0xbb86dc);logger[_0x0fe9('0x10')]('AddTags',_0xbb86dc,JSON['stringify'](_0x105c25));_0x355e4d(_0x105c25);})[_0x0fe9('0x15')](function(_0x4c0433){logger[_0x0fe9('0x12')](_0x0fe9('0x23'),_0x4c0433[_0x0fe9('0x13')],_0xbb86dc);_0x1438a2(_this['error'](0x1f4,_0x4c0433[_0x0fe9('0x13')]));});});}; \ No newline at end of file +var _0x5bcf=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','catch','find','addTags','omit','AddTags','stringify','lodash','util','moment','randomstring'];(function(_0x22579d,_0x55e681){var _0x211f24=function(_0x23aea1){while(--_0x23aea1){_0x22579d['push'](_0x22579d['shift']());}};_0x211f24(++_0x55e681);}(_0x5bcf,0xf2));var _0xf5bc=function(_0xa452c4,_0x1ee154){_0xa452c4=_0xa452c4-0x0;var _0x5b9bbc=_0x5bcf[_0xa452c4];return _0x5b9bbc;};'use strict';var _=require(_0xf5bc('0x0'));var util=require(_0xf5bc('0x1'));var moment=require(_0xf5bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5bc('0x3'));var fs=require('fs');var Redis=require(_0xf5bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5bc('0x5'));var logger=require(_0xf5bc('0x6'))(_0xf5bc('0x7'));var config=require(_0xf5bc('0x8'));var jayson=require(_0xf5bc('0x9'));var client=jayson['client'][_0xf5bc('0xa')]({'port':0x232a});config[_0xf5bc('0xb')]=_['defaults'](config[_0xf5bc('0xb')],{'host':_0xf5bc('0xc'),'port':0x18eb});var socket=require(_0xf5bc('0xd'))(new Redis(config[_0xf5bc('0xb')]));require(_0xf5bc('0xe'))[_0xf5bc('0xf')](socket);function respondWithRpcPromise(_0x1c23f8,_0x508aba,_0x2e7adf){return new BPromise(function(_0x4df53a,_0x62730){return client[_0xf5bc('0x10')](_0x1c23f8,_0x2e7adf)[_0xf5bc('0x11')](function(_0x27c2be){logger[_0xf5bc('0x12')](_0xf5bc('0x13'),_0x508aba,_0xf5bc('0x14'));logger[_0xf5bc('0x15')](_0xf5bc('0x16'),_0x508aba,_0xf5bc('0x14'),JSON['stringify'](_0x27c2be));if(_0x27c2be[_0xf5bc('0x17')]){if(_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x18')]===0x1f4){logger[_0xf5bc('0x17')](_0xf5bc('0x13'),_0x508aba,_0x27c2be[_0xf5bc('0x17')]['message']);return _0x62730(_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x19')]);}logger[_0xf5bc('0x17')](_0xf5bc('0x13'),_0x508aba,_0x27c2be[_0xf5bc('0x17')][_0xf5bc('0x19')]);return _0x4df53a(_0x27c2be[_0xf5bc('0x17')]['message']);}else{logger['info'](_0xf5bc('0x13'),_0x508aba,_0xf5bc('0x14'));_0x4df53a(_0x27c2be[_0xf5bc('0x1a')]['message']);}})['catch'](function(_0x4f6457){logger[_0xf5bc('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x508aba,_0x4f6457);_0x62730(_0x4f6457);});});}exports[_0xf5bc('0x1b')]=function(_0x408b90){var _0x748eca=this;return new Promise(function(_0x10a8df,_0x5ca2d9){return db[_0xf5bc('0x1c')][_0xf5bc('0x1d')](_0x408b90[_0xf5bc('0x1e')],{'raw':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x20')]||null:null,'attributes':_0x408b90[_0xf5bc('0x1f')]?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x21')]||null:null,'limit':_0x408b90['options']?_0x408b90[_0xf5bc('0x1f')][_0xf5bc('0x22')]||null:null})[_0xf5bc('0x11')](function(_0x8e301d){logger[_0xf5bc('0x12')](_0xf5bc('0x1b'),_0x408b90);logger[_0xf5bc('0x15')](_0xf5bc('0x1b'),_0x408b90,JSON['stringify'](_0x8e301d));_0x10a8df(_0x8e301d);})[_0xf5bc('0x23')](function(_0x200e97){logger[_0xf5bc('0x17')](_0xf5bc('0x1b'),_0x200e97[_0xf5bc('0x19')],_0x408b90);_0x5ca2d9(_0x748eca[_0xf5bc('0x17')](0x1f4,_0x200e97[_0xf5bc('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5b09a1){return new Promise(function(_0x6992be,_0x7f8424){return db[_0xf5bc('0x1c')][_0xf5bc('0x24')]({'where':_0x5b09a1[_0xf5bc('0x1f')]?_0x5b09a1[_0xf5bc('0x1f')][_0xf5bc('0x20')]||null:null})[_0xf5bc('0x11')](function(_0x9c3e7c){if(_0x9c3e7c){return _0x9c3e7c[_0xf5bc('0x25')](_0x5b09a1[_0xf5bc('0x1e')]['ids'],_[_0xf5bc('0x26')](_0x5b09a1[_0xf5bc('0x1e')],['ids','id'])||{});}})['spread'](function(_0x5634dc){logger[_0xf5bc('0x12')](_0xf5bc('0x27'),_0x5b09a1);logger[_0xf5bc('0x15')](_0xf5bc('0x27'),_0x5b09a1,JSON[_0xf5bc('0x28')](_0x5634dc));_0x6992be(_0x5634dc);})[_0xf5bc('0x23')](function(_0x18ce4b){logger[_0xf5bc('0x17')](_0xf5bc('0x27'),_0x18ce4b[_0xf5bc('0x19')],_0x5b09a1);_0x7f8424(_this['error'](0x1f4,_0x18ce4b[_0xf5bc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 957fc97..0ae7ac7 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 _0xa694=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa694,0x18f));var _0x4a69=function(_0x2a1e4c,_0x29905d){_0x2a1e4c=_0x2a1e4c-0x0;var _0x13ee25=_0xa694[_0x2a1e4c];return _0x13ee25;};'use strict';var OpenchannelInteractionEvents=require(_0x4a69('0x0'));var events=[_0x4a69('0x1'),_0x4a69('0x2'),_0x4a69('0x3')];function createListener(_0x46634f,_0x1f7f83){return function(_0x179bca){_0x1f7f83[_0x4a69('0x4')](_0x46634f,_0x179bca);};}function removeListener(_0x24a92e,_0x5b8285){return function(){OpenchannelInteractionEvents[_0x4a69('0x5')](_0x24a92e,_0x5b8285);};}exports[_0x4a69('0x6')]=function(_0x125fc3){for(var _0x50e8bb=0x0,_0x48b32e=events[_0x4a69('0x7')];_0x50e8bb<_0x48b32e;_0x50e8bb++){var _0x5d8936=events[_0x50e8bb];var _0x37f321=createListener(_0x4a69('0x8')+_0x5d8936,_0x125fc3);OpenchannelInteractionEvents['on'](_0x5d8936,_0x37f321);}}; \ No newline at end of file +var _0xfedb=['remove','removeListener','length','openchannelInteraction:','save'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfedb,0xdb));var _0xbfed=function(_0xfb75c4,_0x49906a){_0xfb75c4=_0xfb75c4-0x0;var _0x10d2fc=_0xfedb[_0xfb75c4];return _0x10d2fc;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xbfed('0x0'),_0xbfed('0x1'),'update'];function createListener(_0x11c5bd,_0x34147e){return function(_0xa8e275){_0x34147e['emit'](_0x11c5bd,_0xa8e275);};}function removeListener(_0x173f72,_0x5adcb0){return function(){OpenchannelInteractionEvents[_0xbfed('0x2')](_0x173f72,_0x5adcb0);};}exports['register']=function(_0x4a3b44){for(var _0x3e7b0f=0x0,_0x1e08d0=events[_0xbfed('0x3')];_0x3e7b0f<_0x1e08d0;_0x3e7b0f++){var _0x4445bf=events[_0x3e7b0f];var _0x48bc96=createListener(_0xbfed('0x4')+_0x4445bf,_0x4a3b44);OpenchannelInteractionEvents['on'](_0x4445bf,_0x48bc96);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 48a6d21..b2cd6df 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xcb91[_0x251e8c];return _0x1e0c1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xa0518c,_0x3cd20e){var _0x9c384d=function(_0x3602c7){while(--_0x3602c7){_0xa0518c['push'](_0xa0518c['shift']());}};_0x9c384d(++_0x3cd20e);}(_0xedd9,0xfc));var _0x9edd=function(_0x55a313,_0x447e14){_0x55a313=_0x55a313-0x0;var _0x170ff0=_0xedd9[_0x55a313];return _0x170ff0;};'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'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 18a61de..a0b4d7d 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 _0xfe9d=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x14bf8b,_0x186798){var _0x571eee=function(_0xf53e1f){while(--_0xf53e1f){_0x14bf8b['push'](_0x14bf8b['shift']());}};_0x571eee(++_0x186798);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x2a3402,_0x260c17){_0x2a3402=_0x2a3402-0x0;var _0x56549c=_0xfe9d[_0x2a3402];return _0x56549c;};'use strict';var Sequelize=require(_0xdfe9('0x0'));module[_0xdfe9('0x1')]={'body':{'type':Sequelize[_0xdfe9('0x2')](_0xdfe9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdfe9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdfe9('0x5')]('in','out'),'defaultValue':_0xdfe9('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdfe9('0x7')]},'providerName':{'type':Sequelize[_0xdfe9('0x8')]},'providerResponse':{'type':Sequelize[_0xdfe9('0x2')]}}; \ No newline at end of file +var _0x58a4=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x20c3ef,_0x37ce65){var _0x564eb8=function(_0x48d49c){while(--_0x48d49c){_0x20c3ef['push'](_0x20c3ef['shift']());}};_0x564eb8(++_0x37ce65);}(_0x58a4,0xbf));var _0x458a=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x58a4[_0x49677a];return _0x115408;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'body':{'type':Sequelize[_0x458a('0x2')](_0x458a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x458a('0x5')]('in',_0x458a('0x6')),'defaultValue':_0x458a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x458a('0x7')]},'providerName':{'type':Sequelize[_0x458a('0x8')]},'providerResponse':{'type':Sequelize[_0x458a('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0a8623e..47caf07 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 _0xbd37=['motionChannel','event','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','../../config/logger','openchannel-interactions','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','offset','undefined','count','limit','status','set','Content-Range','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','body','update','find','params','describe','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','format','SIP/%s','channel'];(function(_0x395249,_0x4153bb){var _0x4c50df=function(_0x47404d){while(--_0x47404d){_0x395249['push'](_0x395249['shift']());}};_0x4c50df(++_0x4153bb);}(_0xbd37,0x6c));var _0x7bd3=function(_0x3194b6,_0x4d04af){_0x3194b6=_0x3194b6-0x0;var _0x7534f6=_0xbd37[_0x3194b6];return _0x7534f6;};'use strict';var util=require(_0x7bd3('0x0'));var _=require(_0x7bd3('0x1'));var Redis=require(_0x7bd3('0x2'));var interactionService=require(_0x7bd3('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7bd3('0x4'));var config=require(_0x7bd3('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7bd3('0x6')](config[_0x7bd3('0x7')],{'host':_0x7bd3('0x8'),'port':0x18eb});var socket=require(_0x7bd3('0x9'))(new Redis(config[_0x7bd3('0x7')]));require(_0x7bd3('0xa'))[_0x7bd3('0xb')](socket);var jayson=require(_0x7bd3('0xc'));var client=jayson[_0x7bd3('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x7bd3('0xd')][_0x7bd3('0xe')]({'port':0x232a});var interaction_log=require(_0x7bd3('0xf'))(_0x7bd3('0x10'));function respondWithRpcPromise(_0xdded0e,_0x471118,_0x4b7d5a,_0x83603e){return new Promise(function(_0x20b3df,_0x3362d7){var _0x5df444=_0x83603e||client;return _0x5df444['request'](_0xdded0e,_0x4b7d5a)[_0x7bd3('0x11')](function(_0x36921e){logger[_0x7bd3('0x12')](_0x7bd3('0x13'),_0x471118,_0x7bd3('0x14'));logger[_0x7bd3('0x15')](_0x7bd3('0x16'),_0x471118,_0x7bd3('0x14'),JSON[_0x7bd3('0x17')](_0x36921e));if(_0x36921e['error']){if(_0x36921e[_0x7bd3('0x18')][_0x7bd3('0x19')]===0x1f4){logger['error'](_0x7bd3('0x13'),_0x471118,_0x36921e[_0x7bd3('0x18')][_0x7bd3('0x1a')]);return _0x3362d7(_0x36921e['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x471118,_0x36921e[_0x7bd3('0x18')]['message']);return _0x20b3df(_0x36921e[_0x7bd3('0x18')][_0x7bd3('0x1a')]);}else{logger[_0x7bd3('0x12')](_0x7bd3('0x13'),_0x471118,'request\x20sent');_0x20b3df(_0x36921e[_0x7bd3('0x1b')][_0x7bd3('0x1a')]);}})[_0x7bd3('0x1c')](function(_0x153817){logger['error'](_0x7bd3('0x13'),_0x471118,_0x153817);_0x3362d7(_0x153817);});});}function respondWithResult(_0x2a7756,_0x22fab1){_0x22fab1=_0x22fab1||0xc8;return function(_0x4c171c){if(_0x4c171c){return _0x2a7756['status'](_0x22fab1)['json'](_0x4c171c);}};}function respondWithFilteredResult(_0x3cfa19,_0x232371){return function(_0x3e2102){if(_0x3e2102){var _0x43c105=typeof _0x232371[_0x7bd3('0x1d')]===_0x7bd3('0x1e')&&typeof _0x232371['limit']==='undefined';var _0x10361b=_0x3e2102[_0x7bd3('0x1f')];var _0x325495=_0x43c105?0x0:_0x232371[_0x7bd3('0x1d')];var _0x1686a8=_0x43c105?_0x3e2102[_0x7bd3('0x1f')]:_0x232371[_0x7bd3('0x1d')]+_0x232371[_0x7bd3('0x20')];var _0x4da26a;if(_0x1686a8>=_0x10361b){_0x1686a8=_0x10361b;_0x4da26a=0xc8;}else{_0x4da26a=0xce;}_0x3cfa19[_0x7bd3('0x21')](_0x4da26a);return _0x3cfa19[_0x7bd3('0x22')](_0x7bd3('0x23'),_0x325495+'-'+_0x1686a8+'/'+_0x10361b)['json'](_0x3e2102);}return null;};}function saveUpdates(_0x5d05b3){return function(_0x4853ba){if(_0x4853ba){return _0x4853ba['update'](_0x5d05b3)['then'](function(_0x4a78fb){return _0x4a78fb;});}return null;};}function removeEntity(_0x171ef7){return function(_0x46f367){if(_0x46f367){return _0x46f367['destroy']()[_0x7bd3('0x11')](function(){_0x171ef7[_0x7bd3('0x21')](0xcc)[_0x7bd3('0x24')]();});}};}function handleEntityNotFound(_0x501523){return function(_0x433ad9){if(!_0x433ad9){_0x501523[_0x7bd3('0x25')](0x194);}return _0x433ad9;};}function handleError(_0x34e0b5,_0x4dd4b2){_0x4dd4b2=_0x4dd4b2||0x1f4;return function(_0x123ce6){logger['error'](_0x123ce6[_0x7bd3('0x26')]);if(_0x123ce6[_0x7bd3('0x27')]){delete _0x123ce6[_0x7bd3('0x27')];}_0x34e0b5[_0x7bd3('0x21')](_0x4dd4b2)[_0x7bd3('0x28')](_0x123ce6);};}exports[_0x7bd3('0x29')]=function(_0x3cf4e4,_0x162026){var _0x12cdeb={},_0x1e403b={},_0x4d51b2={'count':0x0,'rows':[]};var _0x4ddf7e=_[_0x7bd3('0x2a')](db[_0x7bd3('0x2b')][_0x7bd3('0x2c')],function(_0x4b7e7f){return{'name':_0x4b7e7f[_0x7bd3('0x2d')],'type':_0x4b7e7f[_0x7bd3('0x2e')][_0x7bd3('0x2f')]};});_0x1e403b[_0x7bd3('0x30')]=_[_0x7bd3('0x2a')](_0x4ddf7e,_0x7bd3('0x27'));_0x1e403b[_0x7bd3('0x31')]=_[_0x7bd3('0x32')](_0x3cf4e4['query']);_0x1e403b[_0x7bd3('0x33')]=_[_0x7bd3('0x34')](_0x1e403b[_0x7bd3('0x30')],_0x1e403b[_0x7bd3('0x31')]);_0x12cdeb[_0x7bd3('0x35')]=_['intersection'](_0x1e403b[_0x7bd3('0x30')],qs[_0x7bd3('0x36')](_0x3cf4e4['query'][_0x7bd3('0x36')]));_0x12cdeb[_0x7bd3('0x35')]=_0x12cdeb['attributes'][_0x7bd3('0x37')]?_0x12cdeb[_0x7bd3('0x35')]:_0x1e403b[_0x7bd3('0x30')];if(!_0x3cf4e4[_0x7bd3('0x31')][_0x7bd3('0x38')]('nolimit')){_0x12cdeb['limit']=qs['limit'](_0x3cf4e4[_0x7bd3('0x31')][_0x7bd3('0x20')]);_0x12cdeb[_0x7bd3('0x1d')]=qs['offset'](_0x3cf4e4[_0x7bd3('0x31')]['offset']);}_0x12cdeb[_0x7bd3('0x39')]=qs[_0x7bd3('0x3a')](_0x3cf4e4[_0x7bd3('0x31')][_0x7bd3('0x3a')]);_0x12cdeb[_0x7bd3('0x3b')]=qs[_0x7bd3('0x33')](_['pick'](_0x3cf4e4[_0x7bd3('0x31')],_0x1e403b[_0x7bd3('0x33')]),_0x4ddf7e);if(_0x3cf4e4['query'][_0x7bd3('0x3c')]){_0x12cdeb['where']=_[_0x7bd3('0x3d')](_0x12cdeb[_0x7bd3('0x3b')],{'$or':_[_0x7bd3('0x2a')](_0x4ddf7e,function(_0x3d3312){if(_0x3d3312[_0x7bd3('0x2e')]!==_0x7bd3('0x3e')){var _0x39d33c={};_0x39d33c[_0x3d3312[_0x7bd3('0x27')]]={'$like':'%'+_0x3cf4e4[_0x7bd3('0x31')][_0x7bd3('0x3c')]+'%'};return _0x39d33c;}})});}_0x12cdeb=_[_0x7bd3('0x3d')]({},_0x12cdeb,_0x3cf4e4[_0x7bd3('0x3f')]);var _0x523b66={'where':_0x12cdeb[_0x7bd3('0x3b')]};return db[_0x7bd3('0x2b')][_0x7bd3('0x1f')](_0x523b66)[_0x7bd3('0x11')](function(_0x404f8c){_0x4d51b2[_0x7bd3('0x1f')]=_0x404f8c;if(_0x3cf4e4[_0x7bd3('0x31')][_0x7bd3('0x40')]){_0x12cdeb[_0x7bd3('0x41')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7bd3('0x42')](_0x12cdeb);})[_0x7bd3('0x11')](function(_0x3d35f5){_0x4d51b2[_0x7bd3('0x43')]=_0x3d35f5;return _0x4d51b2;})[_0x7bd3('0x11')](respondWithFilteredResult(_0x162026,_0x12cdeb))[_0x7bd3('0x1c')](handleError(_0x162026,null));};exports[_0x7bd3('0x44')]=function(_0x262cfa,_0x191d16){var _0x1e902a={'raw':!![],'where':{'id':_0x262cfa['params']['id']}},_0x2ff0a5={};_0x2ff0a5[_0x7bd3('0x30')]=_['keys'](db[_0x7bd3('0x2b')][_0x7bd3('0x2c')]);_0x2ff0a5[_0x7bd3('0x31')]=_[_0x7bd3('0x32')](_0x262cfa[_0x7bd3('0x31')]);_0x2ff0a5[_0x7bd3('0x33')]=_[_0x7bd3('0x34')](_0x2ff0a5['model'],_0x2ff0a5['query']);_0x1e902a[_0x7bd3('0x35')]=_[_0x7bd3('0x34')](_0x2ff0a5['model'],qs[_0x7bd3('0x36')](_0x262cfa['query'][_0x7bd3('0x36')]));_0x1e902a[_0x7bd3('0x35')]=_0x1e902a['attributes'][_0x7bd3('0x37')]?_0x1e902a[_0x7bd3('0x35')]:_0x2ff0a5[_0x7bd3('0x30')];if(_0x262cfa['query'][_0x7bd3('0x40')]){_0x1e902a[_0x7bd3('0x41')]=[{'all':!![]}];}_0x1e902a=_[_0x7bd3('0x3d')]({},_0x1e902a,_0x262cfa[_0x7bd3('0x3f')]);return db['OpenchannelMessage']['find'](_0x1e902a)['then'](handleEntityNotFound(_0x191d16,null))['then'](respondWithResult(_0x191d16,null))[_0x7bd3('0x1c')](handleError(_0x191d16,null));};exports['create']=function(_0xb37686,_0xf97ee3){return db[_0x7bd3('0x2b')]['create'](_0xb37686[_0x7bd3('0x45')],{})[_0x7bd3('0x11')](respondWithResult(_0xf97ee3,0xc9))[_0x7bd3('0x1c')](handleError(_0xf97ee3,null));};exports[_0x7bd3('0x46')]=function(_0x52abce,_0x50d2b1){if(_0x52abce[_0x7bd3('0x45')]['id']){delete _0x52abce[_0x7bd3('0x45')]['id'];}return db[_0x7bd3('0x2b')][_0x7bd3('0x47')]({'where':{'id':_0x52abce[_0x7bd3('0x48')]['id']}})[_0x7bd3('0x11')](handleEntityNotFound(_0x50d2b1,null))['then'](saveUpdates(_0x52abce[_0x7bd3('0x45')],null))[_0x7bd3('0x11')](respondWithResult(_0x50d2b1,null))[_0x7bd3('0x1c')](handleError(_0x50d2b1,null));};exports['destroy']=function(_0x54049d,_0x18b68c){return db[_0x7bd3('0x2b')][_0x7bd3('0x47')]({'where':{'id':_0x54049d[_0x7bd3('0x48')]['id']}})['then'](handleEntityNotFound(_0x18b68c,null))['then'](removeEntity(_0x18b68c,null))[_0x7bd3('0x1c')](handleError(_0x18b68c,null));};exports[_0x7bd3('0x49')]=function(_0x5049f5,_0x3b4930){return db[_0x7bd3('0x2b')][_0x7bd3('0x49')]()['then'](respondWithResult(_0x3b4930,null))[_0x7bd3('0x1c')](handleError(_0x3b4930,null));};exports['accept']=function(_0x33045e,_0x81ff72){var _0x712548='openchannel';return interactionService['acceptMessage'](_0x33045e,_0x712548)[_0x7bd3('0x11')](respondWithResult(_0x81ff72,null))[_0x7bd3('0x1c')](handleError(_0x81ff72,null));};exports['reject']=function(_0x8e6ee3,_0x1e0942){var _0x43c05b={'agent':{},'channel':'openchannel'};if(_0x8e6ee3[_0x7bd3('0x45')]['id']){delete _0x8e6ee3[_0x7bd3('0x45')]['id'];}_0x8e6ee3[_0x7bd3('0x45')][_0x7bd3('0x4a')]=_0x8e6ee3[_0x7bd3('0x45')]['UserId']||_0x8e6ee3[_0x7bd3('0x4b')]['id'];_0x43c05b['agent']['id']=_0x8e6ee3[_0x7bd3('0x45')]['UserId'];return db[_0x7bd3('0x2b')][_0x7bd3('0x47')]({'where':{'id':_0x8e6ee3[_0x7bd3('0x48')]['id'],'UserId':null}})[_0x7bd3('0x11')](handleEntityNotFound(_0x1e0942,null))[_0x7bd3('0x11')](function(_0x1738e0){if(_0x1738e0){_0x43c05b['message']=_0x1738e0[_0x7bd3('0x4c')]({'plain':!![]});return db[_0x7bd3('0x4d')][_0x7bd3('0x47')]({'where':{'id':_0x1738e0[_0x7bd3('0x4e')]}});}return null;})[_0x7bd3('0x11')](handleEntityNotFound(_0x1e0942,null))[_0x7bd3('0x11')](function(_0x12be71){if(_0x12be71){_0x43c05b[_0x7bd3('0x4f')]=_0x12be71[_0x7bd3('0x4c')]({'plain':!![]});interaction_log[_0x7bd3('0x12')](_0x7bd3('0x50'),_0x8e6ee3[_0x7bd3('0x4b')]['id'],_0x8e6ee3[_0x7bd3('0x4b')][_0x7bd3('0x27')],_0x8e6ee3[_0x7bd3('0x4b')][_0x7bd3('0x51')],_0x43c05b[_0x7bd3('0x4f')]['id'],_0x8e6ee3['body']?JSON[_0x7bd3('0x17')](_0x8e6ee3[_0x7bd3('0x45')]):'null');return respondWithRpcPromise(_0x7bd3('0x52'),_0x7bd3('0x53'),_0x43c05b);}return null;})['then'](function(_0x5c9c50){var _0x3562b5=_0x7bd3('0x54')+_0x5c9c50[_0x7bd3('0x1a')][_0x7bd3('0x55')];return db[_0x7bd3('0x56')][_0x7bd3('0x31')](_0x3562b5,{'type':db['Sequelize'][_0x7bd3('0x57')][_0x7bd3('0x58')],'raw':!![]})['then'](function(_0x44dc5e){return _0x44dc5e;});})[_0x7bd3('0x11')](function(_0x525617){if(_0x525617){_0x43c05b[_0x7bd3('0x1a')][_0x7bd3('0x59')]=_0x525617[0x0];if(!_0x8e6ee3['body'][_0x7bd3('0x4a')])return;return db[_0x7bd3('0x5a')][_0x7bd3('0x47')]({'where':{'id':_0x8e6ee3[_0x7bd3('0x45')]['UserId'],'role':_0x7bd3('0x5b')},'attributes':['id',_0x7bd3('0x27'),_0x7bd3('0x5c'),_0x7bd3('0x5d'),_0x7bd3('0x5e')],'raw':!![]});}return null;})[_0x7bd3('0x11')](function(_0x1de39b){if(!_0x1de39b)return null;_0x43c05b[_0x7bd3('0x1a')][_0x7bd3('0x5b')]=_0x1de39b;return _0x43c05b;})[_0x7bd3('0x11')](function(_0x4537cc){if(_0x4537cc){_0x4537cc[_0x7bd3('0x1a')]['interface']=util[_0x7bd3('0x5f')](_0x7bd3('0x60'),_0x8e6ee3[_0x7bd3('0x4b')]['name']);_0x4537cc[_0x7bd3('0x1a')][_0x7bd3('0x61')]=_0x43c05b[_0x7bd3('0x61')];_0x4537cc['message'][_0x7bd3('0x62')]=_0x43c05b['channel'];_0x4537cc['message'][_0x7bd3('0x63')]=_0x7bd3('0x64');respondWithRpcPromise(_0x7bd3('0x65'),'EventManager',{'event':_0x7bd3('0x66'),'message':_0x4537cc[_0x7bd3('0x1a')]},client9002);return _0x43c05b;}return null;})[_0x7bd3('0x11')](respondWithResult(_0x1e0942,null))[_0x7bd3('0x1c')](handleError(_0x1e0942,null));}; \ No newline at end of file +var _0x0d6a=['fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','filter','options','includeAll','include','rows','show','params','model','keys','find','create','body','describe','accept','acceptMessage','reject','openchannel','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','openchannel-interactions','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','end','sendStatus','name','send','OpenchannelMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0d6a,0x97));var _0xa0d6=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x0d6a[_0x1d24eb];return _0x1dc576;};'use strict';var util=require(_0xa0d6('0x0'));var _=require(_0xa0d6('0x1'));var Redis=require(_0xa0d6('0x2'));var interactionService=require(_0xa0d6('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xa0d6('0x4'))(_0xa0d6('0x5'));var config=require(_0xa0d6('0x6'));var db=require(_0xa0d6('0x7'))['db'];config[_0xa0d6('0x8')]=_[_0xa0d6('0x9')](config[_0xa0d6('0x8')],{'host':_0xa0d6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0d6('0x8')]));require(_0xa0d6('0xb'))[_0xa0d6('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa0d6('0xd')][_0xa0d6('0xe')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0xa0d6('0x4'))(_0xa0d6('0xf'));function respondWithRpcPromise(_0x4385b6,_0x2630c1,_0x3667cb,_0x3f77ba){return new Promise(function(_0x265a68,_0xe7453c){var _0x2e02fb=_0x3f77ba||client;return _0x2e02fb[_0xa0d6('0x10')](_0x4385b6,_0x3667cb)['then'](function(_0x323b5a){logger[_0xa0d6('0x11')](_0xa0d6('0x12'),_0x2630c1,_0xa0d6('0x13'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2630c1,'request\x20sent',JSON['stringify'](_0x323b5a));if(_0x323b5a['error']){if(_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x15')]===0x1f4){logger[_0xa0d6('0x14')](_0xa0d6('0x12'),_0x2630c1,_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);return _0xe7453c(_0x323b5a[_0xa0d6('0x14')]['message']);}logger[_0xa0d6('0x14')](_0xa0d6('0x12'),_0x2630c1,_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);return _0x265a68(_0x323b5a[_0xa0d6('0x14')][_0xa0d6('0x16')]);}else{logger[_0xa0d6('0x11')](_0xa0d6('0x12'),_0x2630c1,_0xa0d6('0x13'));_0x265a68(_0x323b5a[_0xa0d6('0x17')][_0xa0d6('0x16')]);}})[_0xa0d6('0x18')](function(_0x4571c9){logger[_0xa0d6('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x2630c1,_0x4571c9);_0xe7453c(_0x4571c9);});});}function respondWithResult(_0x1ba8be,_0xf94749){_0xf94749=_0xf94749||0xc8;return function(_0x5629f0){if(_0x5629f0){return _0x1ba8be[_0xa0d6('0x19')](_0xf94749)[_0xa0d6('0x1a')](_0x5629f0);}};}function respondWithFilteredResult(_0x49c6b9,_0x137dc3){return function(_0x1e3c56){if(_0x1e3c56){var _0x4d4391=typeof _0x137dc3[_0xa0d6('0x1b')]==='undefined'&&typeof _0x137dc3[_0xa0d6('0x1c')]===_0xa0d6('0x1d');var _0x2c8ee9=_0x1e3c56[_0xa0d6('0x1e')];var _0x4a2153=_0x4d4391?0x0:_0x137dc3[_0xa0d6('0x1b')];var _0x4a3706=_0x4d4391?_0x1e3c56[_0xa0d6('0x1e')]:_0x137dc3[_0xa0d6('0x1b')]+_0x137dc3[_0xa0d6('0x1c')];var _0x424061;if(_0x4a3706>=_0x2c8ee9){_0x4a3706=_0x2c8ee9;_0x424061=0xc8;}else{_0x424061=0xce;}_0x49c6b9[_0xa0d6('0x19')](_0x424061);return _0x49c6b9[_0xa0d6('0x1f')](_0xa0d6('0x20'),_0x4a2153+'-'+_0x4a3706+'/'+_0x2c8ee9)[_0xa0d6('0x1a')](_0x1e3c56);}return null;};}function saveUpdates(_0x14b4bc){return function(_0xbd0e00){if(_0xbd0e00){return _0xbd0e00[_0xa0d6('0x21')](_0x14b4bc)['then'](function(_0x23be44){return _0x23be44;});}return null;};}function removeEntity(_0x3dc9df){return function(_0x301862){if(_0x301862){return _0x301862[_0xa0d6('0x22')]()[_0xa0d6('0x23')](function(){_0x3dc9df[_0xa0d6('0x19')](0xcc)[_0xa0d6('0x24')]();});}};}function handleEntityNotFound(_0x10150c){return function(_0x19b97b){if(!_0x19b97b){_0x10150c[_0xa0d6('0x25')](0x194);}return _0x19b97b;};}function handleError(_0x2a7e72,_0x406255){_0x406255=_0x406255||0x1f4;return function(_0x116e09){logger[_0xa0d6('0x14')](_0x116e09['stack']);if(_0x116e09[_0xa0d6('0x26')]){delete _0x116e09[_0xa0d6('0x26')];}_0x2a7e72[_0xa0d6('0x19')](_0x406255)[_0xa0d6('0x27')](_0x116e09);};}exports['index']=function(_0x105e3d,_0x46fec1){var _0x4a9855={},_0x352b51={},_0x472305={'count':0x0,'rows':[]};var _0x1d73af=_['map'](db[_0xa0d6('0x28')][_0xa0d6('0x29')],function(_0x229343){return{'name':_0x229343[_0xa0d6('0x2a')],'type':_0x229343[_0xa0d6('0x2b')][_0xa0d6('0x2c')]};});_0x352b51['model']=_[_0xa0d6('0x2d')](_0x1d73af,_0xa0d6('0x26'));_0x352b51[_0xa0d6('0x2e')]=_['keys'](_0x105e3d[_0xa0d6('0x2e')]);_0x352b51[_0xa0d6('0x2f')]=_[_0xa0d6('0x30')](_0x352b51['model'],_0x352b51[_0xa0d6('0x2e')]);_0x4a9855['attributes']=_[_0xa0d6('0x30')](_0x352b51['model'],qs['fields'](_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x31')]));_0x4a9855['attributes']=_0x4a9855[_0xa0d6('0x32')][_0xa0d6('0x33')]?_0x4a9855[_0xa0d6('0x32')]:_0x352b51['model'];if(!_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x34')](_0xa0d6('0x35'))){_0x4a9855[_0xa0d6('0x1c')]=qs['limit'](_0x105e3d[_0xa0d6('0x2e')]['limit']);_0x4a9855[_0xa0d6('0x1b')]=qs[_0xa0d6('0x1b')](_0x105e3d[_0xa0d6('0x2e')]['offset']);}_0x4a9855[_0xa0d6('0x36')]=qs['sort'](_0x105e3d[_0xa0d6('0x2e')]['sort']);_0x4a9855[_0xa0d6('0x37')]=qs[_0xa0d6('0x2f')](_['pick'](_0x105e3d['query'],_0x352b51[_0xa0d6('0x2f')]),_0x1d73af);if(_0x105e3d[_0xa0d6('0x2e')]['filter']){_0x4a9855[_0xa0d6('0x37')]=_[_0xa0d6('0x38')](_0x4a9855[_0xa0d6('0x37')],{'$or':_[_0xa0d6('0x2d')](_0x1d73af,function(_0x3dbc32){if(_0x3dbc32[_0xa0d6('0x2b')]!=='VIRTUAL'){var _0x418e31={};_0x418e31[_0x3dbc32[_0xa0d6('0x26')]]={'$like':'%'+_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x39')]+'%'};return _0x418e31;}})});}_0x4a9855=_['merge']({},_0x4a9855,_0x105e3d[_0xa0d6('0x3a')]);var _0x170cdd={'where':_0x4a9855[_0xa0d6('0x37')]};return db[_0xa0d6('0x28')][_0xa0d6('0x1e')](_0x170cdd)[_0xa0d6('0x23')](function(_0x183d83){_0x472305[_0xa0d6('0x1e')]=_0x183d83;if(_0x105e3d[_0xa0d6('0x2e')][_0xa0d6('0x3b')]){_0x4a9855[_0xa0d6('0x3c')]=[{'all':!![]}];}return db[_0xa0d6('0x28')]['findAll'](_0x4a9855);})[_0xa0d6('0x23')](function(_0x353f56){_0x472305[_0xa0d6('0x3d')]=_0x353f56;return _0x472305;})[_0xa0d6('0x23')](respondWithFilteredResult(_0x46fec1,_0x4a9855))['catch'](handleError(_0x46fec1,null));};exports[_0xa0d6('0x3e')]=function(_0x291cd0,_0x4fc144){var _0x56d09e={'raw':!![],'where':{'id':_0x291cd0[_0xa0d6('0x3f')]['id']}},_0x19e0e9={};_0x19e0e9[_0xa0d6('0x40')]=_[_0xa0d6('0x41')](db['OpenchannelMessage'][_0xa0d6('0x29')]);_0x19e0e9[_0xa0d6('0x2e')]=_['keys'](_0x291cd0[_0xa0d6('0x2e')]);_0x19e0e9[_0xa0d6('0x2f')]=_[_0xa0d6('0x30')](_0x19e0e9[_0xa0d6('0x40')],_0x19e0e9[_0xa0d6('0x2e')]);_0x56d09e[_0xa0d6('0x32')]=_[_0xa0d6('0x30')](_0x19e0e9[_0xa0d6('0x40')],qs[_0xa0d6('0x31')](_0x291cd0[_0xa0d6('0x2e')]['fields']));_0x56d09e[_0xa0d6('0x32')]=_0x56d09e[_0xa0d6('0x32')]['length']?_0x56d09e[_0xa0d6('0x32')]:_0x19e0e9['model'];if(_0x291cd0[_0xa0d6('0x2e')]['includeAll']){_0x56d09e[_0xa0d6('0x3c')]=[{'all':!![]}];}_0x56d09e=_[_0xa0d6('0x38')]({},_0x56d09e,_0x291cd0[_0xa0d6('0x3a')]);return db[_0xa0d6('0x28')][_0xa0d6('0x42')](_0x56d09e)[_0xa0d6('0x23')](handleEntityNotFound(_0x4fc144,null))[_0xa0d6('0x23')](respondWithResult(_0x4fc144,null))[_0xa0d6('0x18')](handleError(_0x4fc144,null));};exports[_0xa0d6('0x43')]=function(_0x672fb3,_0x50431d){return db[_0xa0d6('0x28')]['create'](_0x672fb3['body'],{})[_0xa0d6('0x23')](respondWithResult(_0x50431d,0xc9))['catch'](handleError(_0x50431d,null));};exports[_0xa0d6('0x21')]=function(_0x4bf3ec,_0x532ff7){if(_0x4bf3ec[_0xa0d6('0x44')]['id']){delete _0x4bf3ec[_0xa0d6('0x44')]['id'];}return db[_0xa0d6('0x28')][_0xa0d6('0x42')]({'where':{'id':_0x4bf3ec[_0xa0d6('0x3f')]['id']}})[_0xa0d6('0x23')](handleEntityNotFound(_0x532ff7,null))[_0xa0d6('0x23')](saveUpdates(_0x4bf3ec[_0xa0d6('0x44')],null))[_0xa0d6('0x23')](respondWithResult(_0x532ff7,null))[_0xa0d6('0x18')](handleError(_0x532ff7,null));};exports[_0xa0d6('0x22')]=function(_0x429fac,_0x374b83){return db['OpenchannelMessage']['find']({'where':{'id':_0x429fac[_0xa0d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x374b83,null))['then'](removeEntity(_0x374b83,null))[_0xa0d6('0x18')](handleError(_0x374b83,null));};exports['describe']=function(_0x479390,_0x38fe54){return db[_0xa0d6('0x28')][_0xa0d6('0x45')]()['then'](respondWithResult(_0x38fe54,null))['catch'](handleError(_0x38fe54,null));};exports[_0xa0d6('0x46')]=function(_0x5ed5b6,_0x34f144){var _0x5f206e='openchannel';return interactionService[_0xa0d6('0x47')](_0x5ed5b6,_0x5f206e)['then'](respondWithResult(_0x34f144,null))[_0xa0d6('0x18')](handleError(_0x34f144,null));};exports[_0xa0d6('0x48')]=function(_0xf0e5fb,_0x177175){var _0x2f4a0b={'agent':{},'channel':_0xa0d6('0x49')};if(_0xf0e5fb['body']['id']){delete _0xf0e5fb[_0xa0d6('0x44')]['id'];}_0xf0e5fb[_0xa0d6('0x44')]['UserId']=_0xf0e5fb[_0xa0d6('0x44')][_0xa0d6('0x4a')]||_0xf0e5fb[_0xa0d6('0x4b')]['id'];_0x2f4a0b[_0xa0d6('0x4c')]['id']=_0xf0e5fb[_0xa0d6('0x44')]['UserId'];return db[_0xa0d6('0x28')][_0xa0d6('0x42')]({'where':{'id':_0xf0e5fb[_0xa0d6('0x3f')]['id'],'UserId':null}})[_0xa0d6('0x23')](handleEntityNotFound(_0x177175,null))[_0xa0d6('0x23')](function(_0x578c33){if(_0x578c33){_0x2f4a0b[_0xa0d6('0x16')]=_0x578c33[_0xa0d6('0x4d')]({'plain':!![]});return db[_0xa0d6('0x4e')][_0xa0d6('0x42')]({'where':{'id':_0x578c33[_0xa0d6('0x4f')]}});}return null;})[_0xa0d6('0x23')](handleEntityNotFound(_0x177175,null))[_0xa0d6('0x23')](function(_0xe9dfdd){if(_0xe9dfdd){_0x2f4a0b[_0xa0d6('0x50')]=_0xe9dfdd['get']({'plain':!![]});interaction_log[_0xa0d6('0x11')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf0e5fb[_0xa0d6('0x4b')]['id'],_0xf0e5fb[_0xa0d6('0x4b')][_0xa0d6('0x26')],_0xf0e5fb['user'][_0xa0d6('0x51')],_0x2f4a0b[_0xa0d6('0x50')]['id'],_0xf0e5fb[_0xa0d6('0x44')]?JSON['stringify'](_0xf0e5fb[_0xa0d6('0x44')]):_0xa0d6('0x52'));return respondWithRpcPromise(_0xa0d6('0x53'),_0xa0d6('0x54'),_0x2f4a0b);}return null;})[_0xa0d6('0x23')](function(_0x49716d){var _0x207c92=_0xa0d6('0x55')+_0x49716d[_0xa0d6('0x16')][_0xa0d6('0x56')];return db[_0xa0d6('0x57')][_0xa0d6('0x2e')](_0x207c92,{'type':db[_0xa0d6('0x58')]['QueryTypes'][_0xa0d6('0x59')],'raw':!![]})[_0xa0d6('0x23')](function(_0x1010c3){return _0x1010c3;});})[_0xa0d6('0x23')](function(_0x4ca86e){if(_0x4ca86e){_0x2f4a0b['message'][_0xa0d6('0x5a')]=_0x4ca86e[0x0];if(!_0xf0e5fb[_0xa0d6('0x44')]['UserId'])return;return db['User'][_0xa0d6('0x42')]({'where':{'id':_0xf0e5fb['body'][_0xa0d6('0x4a')],'role':_0xa0d6('0x4c')},'attributes':['id',_0xa0d6('0x26'),_0xa0d6('0x5b'),_0xa0d6('0x5c'),'internal'],'raw':!![]});}return null;})[_0xa0d6('0x23')](function(_0x50c88a){if(!_0x50c88a)return null;_0x2f4a0b[_0xa0d6('0x16')][_0xa0d6('0x4c')]=_0x50c88a;return _0x2f4a0b;})[_0xa0d6('0x23')](function(_0x563bb3){if(_0x563bb3){_0x563bb3[_0xa0d6('0x16')]['interface']=util[_0xa0d6('0x5d')](_0xa0d6('0x5e'),_0xf0e5fb[_0xa0d6('0x4b')][_0xa0d6('0x26')]);_0x563bb3[_0xa0d6('0x16')]['channel']=_0x2f4a0b[_0xa0d6('0x5f')];_0x563bb3[_0xa0d6('0x16')][_0xa0d6('0x60')]=_0x2f4a0b[_0xa0d6('0x5f')];_0x563bb3[_0xa0d6('0x16')][_0xa0d6('0x61')]=_0xa0d6('0x48');respondWithRpcPromise('EventManager',_0xa0d6('0x62'),{'event':_0xa0d6('0x63'),'message':_0x563bb3[_0xa0d6('0x16')]},client9002);return _0x2f4a0b;}return null;})[_0xa0d6('0x23')](respondWithResult(_0x177175,null))[_0xa0d6('0x18')](handleError(_0x177175,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ceaa933..e0a1542 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 _0xb3bf=['save','update','remove','emit','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x41dddc,_0x181cc4){var _0x415f2c=function(_0x18162e){while(--_0x18162e){_0x41dddc['push'](_0x41dddc['shift']());}};_0x415f2c(++_0x181cc4);}(_0xb3bf,0x95));var _0xfb3b=function(_0x1121fc,_0x3ad11a){_0x1121fc=_0x1121fc-0x0;var _0x7963c3=_0xb3bf[_0x1121fc];return _0x7963c3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfb3b('0x0'))['db'][_0xfb3b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfb3b('0x2')](0x0);var events={'afterCreate':_0xfb3b('0x3'),'afterUpdate':_0xfb3b('0x4'),'afterDestroy':_0xfb3b('0x5')};function emitEvent(_0xab0643){return function(_0x32f1b0,_0x1cdb5e,_0x4a2810){OpenchannelMessageEvents[_0xfb3b('0x6')](_0xab0643+':'+_0x32f1b0['id'],_0x32f1b0);OpenchannelMessageEvents[_0xfb3b('0x6')](_0xab0643,_0x32f1b0);_0x4a2810(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xfb3b('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8754=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2043b5,_0x4139a8){var _0x20efac=function(_0x366087){while(--_0x366087){_0x2043b5['push'](_0x2043b5['shift']());}};_0x20efac(++_0x4139a8);}(_0x8754,0xb7));var _0x4875=function(_0x2a4b13,_0x4b941b){_0x2a4b13=_0x2a4b13-0x0;var _0x3413d6=_0x8754[_0x2a4b13];return _0x3413d6;};'use strict';var EventEmitter=require(_0x4875('0x0'));var OpenchannelMessage=require(_0x4875('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4875('0x2'),'afterUpdate':'update','afterDestroy':_0x4875('0x3')};function emitEvent(_0x2dc5e3){return function(_0x110069,_0xbf4313,_0x2c3fdf){OpenchannelMessageEvents[_0x4875('0x4')](_0x2dc5e3+':'+_0x110069['id'],_0x110069);OpenchannelMessageEvents['emit'](_0x2dc5e3,_0x110069);_0x2c3fdf(null);};}for(var e in events){if(events[_0x4875('0x5')](e)){var event=events[e];OpenchannelMessage[_0x4875('0x6')](e,emitEvent(event));}}module[_0x4875('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 381df88..a4bfcff 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 _0x21f7=['catch','error','secret','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','info','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt'];(function(_0x39377b,_0x48bfa7){var _0x475278=function(_0x1b90ec){while(--_0x1b90ec){_0x39377b['push'](_0x39377b['shift']());}};_0x475278(++_0x48bfa7);}(_0x21f7,0xf3));var _0x721f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x21f7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x721f('0x0'));var util=require(_0x721f('0x1'));var logger=require('../../config/logger')(_0x721f('0x2'));var moment=require('moment');var BPromise=require(_0x721f('0x3'));var rp=require(_0x721f('0x4'));var fs=require('fs');var path=require(_0x721f('0x5'));var rimraf=require(_0x721f('0x6'));var config=require(_0x721f('0x7'));var attributes=require(_0x721f('0x8'));module[_0x721f('0x9')]=function(_0x124dbc,_0x4c63a9){return _0x124dbc[_0x721f('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x721f('0xb'),'paranoid':![],'indexes':[{'name':_0x721f('0xc'),'fields':[_0x721f('0xd')],'type':_0x721f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x485d74,_0x1d77b1,_0x409dcf){var _0x6b0bc6=_0x124dbc[_0x721f('0xf')];var _0x4deda0=_0x485d74[_0x721f('0x10')]({'plain':!![]});if(_0x4deda0[_0x721f('0x11')][_0x721f('0x12')]()==='in'||_0x4deda0[_0x721f('0x11')][_0x721f('0x12')]()===_0x721f('0x13')&&!_0x4deda0['secret']&&!_[_0x721f('0x14')](_0x4deda0[_0x721f('0x15')])){_0x6b0bc6[_0x721f('0x16')][_0x721f('0x17')]({'where':{'id':_0x4deda0[_0x721f('0x18')]}})['then'](function(_0x5691f2){if(_0x5691f2){_0x5691f2[_0x721f('0x19')]({'lastMsgAt':_0x4deda0[_0x721f('0x1a')],'lastMsgDirection':_0x4deda0['direction'][_0x721f('0x12')]()});}})[_0x721f('0x1b')](function(_0x1c66c9){console[_0x721f('0x1c')](_0x1c66c9);});}if(_0x4deda0[_0x721f('0x11')]===_0x721f('0x13')&&!_0x4deda0[_0x721f('0x1d')]){var _0x3ac7ea;_0x6b0bc6['CmContact']['describe']()[_0x721f('0x1e')](function(_0x322a62){return _0x6b0bc6[_0x721f('0x1f')][_0x721f('0x20')]({'where':{'id':_0x4deda0[_0x721f('0x21')]},'include':[{'model':_0x6b0bc6['OpenchannelInteraction'],'as':_0x721f('0x22'),'where':{'id':_0x4deda0[_0x721f('0x18')]},'limit':0x1,'include':[{'model':_0x6b0bc6[_0x721f('0x23')],'as':_0x721f('0x24'),'attributes':_[_0x721f('0x25')](_0x322a62)}]}]});})[_0x721f('0x1e')](function(_0x4933a3){_0x3ac7ea=_0x4933a3[_0x721f('0x10')]({'plain':!![]});if(_0x3ac7ea&&_0x3ac7ea['replyUri']){logger[_0x721f('0x26')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x721f('0x27')](_0x721f('0x28'),_0x4deda0['id'],_0x3ac7ea[_0x721f('0x29')]));if(_0x3ac7ea[_0x721f('0x22')]&&_0x3ac7ea[_0x721f('0x22')][_0x721f('0x2a')]){_0x4deda0[_0x721f('0x2b')]=_['omit'](_0x3ac7ea[_0x721f('0x22')][0x0],'Contact');_0x4deda0[_0x721f('0x24')]=_0x3ac7ea[_0x721f('0x22')][0x0][_0x721f('0x24')];}var _0x1d77b1={'method':'POST','uri':encodeURI(_0x3ac7ea['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1d77b1['method']){case _0x721f('0x2c'):_0x1d77b1['qs']=_0x4deda0;break;case _0x721f('0x2d'):_0x1d77b1[_0x721f('0xd')]=_0x4deda0;break;}return rp(_0x1d77b1)[_0x721f('0x1e')](function(_0x4847f2){logger[_0x721f('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x721f('0x2e'),util[_0x721f('0x27')](_0x721f('0x2f'),_0x4deda0['id'],_0x3ac7ea[_0x721f('0x29')]));if(_0x4847f2[_0x721f('0xd')][_0x721f('0x30')]&&_0x4847f2[_0x721f('0xd')][_0x721f('0x30')]!=_0x4deda0['Interaction'][_0x721f('0x30')]){return _0x6b0bc6['OpenchannelInteraction'][_0x721f('0x19')]({'threadId':_0x4847f2['body'][_0x721f('0x30')]},{'where':{'id':_0x4deda0['Interaction']['id']}});}else{return;}})[_0x721f('0x1e')](function(){return _0x485d74[_0x721f('0x19')]({'read':!![]});})[_0x721f('0x1b')](function(_0x20f5c2){logger[_0x721f('0x1c')](_0x721f('0x31'),_0x721f('0x2e'),util[_0x721f('0x32')](_0x20f5c2,{'showHidden':![],'depth':null}));_0x409dcf();});}else{_0x409dcf();}})[_0x721f('0x33')](function(){_0x409dcf();});}else{_0x409dcf();}}},'charset':_0x721f('0x34'),'collate':_0x721f('0x35')});}; \ No newline at end of file +var _0x949d=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','update','createdAt','error','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','CmContact','keys','then','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Interactions','omit','Contact','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction'];(function(_0x3866a0,_0x501e9a){var _0x4de61c=function(_0x581267){while(--_0x581267){_0x3866a0['push'](_0x3866a0['shift']());}};_0x4de61c(++_0x501e9a);}(_0x949d,0x6a));var _0xd949=function(_0x50a46f,_0x188384){_0x50a46f=_0x50a46f-0x0;var _0x428db1=_0x949d[_0x50a46f];return _0x428db1;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var logger=require(_0xd949('0x2'))('api');var moment=require(_0xd949('0x3'));var BPromise=require(_0xd949('0x4'));var rp=require(_0xd949('0x5'));var fs=require('fs');var path=require(_0xd949('0x6'));var rimraf=require('rimraf');var config=require(_0xd949('0x7'));var attributes=require(_0xd949('0x8'));module[_0xd949('0x9')]=function(_0x42edf8,_0x15a864){return _0x42edf8[_0xd949('0xa')](_0xd949('0xb'),attributes,{'tableName':_0xd949('0xc'),'paranoid':![],'indexes':[{'name':_0xd949('0xd'),'fields':[_0xd949('0xe')],'type':_0xd949('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40c4b3,_0x352256,_0xc1bb03){var _0x4d9ba7=_0x42edf8[_0xd949('0x10')];var _0x1ad12e=_0x40c4b3['get']({'plain':!![]});if(_0x1ad12e[_0xd949('0x11')]['toLowerCase']()==='in'||_0x1ad12e['direction'][_0xd949('0x12')]()===_0xd949('0x13')&&!_0x1ad12e[_0xd949('0x14')]&&!_['isNil'](_0x1ad12e[_0xd949('0x15')])){_0x4d9ba7[_0xd949('0x16')][_0xd949('0x17')]({'where':{'id':_0x1ad12e['OpenchannelInteractionId']}})['then'](function(_0x1c73c9){if(_0x1c73c9){_0x1c73c9[_0xd949('0x18')]({'lastMsgAt':_0x1ad12e[_0xd949('0x19')],'lastMsgDirection':_0x1ad12e[_0xd949('0x11')][_0xd949('0x12')]()});}})['catch'](function(_0xc9788f){console[_0xd949('0x1a')](_0xc9788f);});}if(_0x1ad12e[_0xd949('0x11')]===_0xd949('0x13')&&!_0x1ad12e['secret']){var _0x20eaaf;_0x4d9ba7['CmContact'][_0xd949('0x1b')]()['then'](function(_0x29ad08){return _0x4d9ba7[_0xd949('0x1c')][_0xd949('0x1d')]({'where':{'id':_0x1ad12e[_0xd949('0x1e')]},'include':[{'model':_0x4d9ba7[_0xd949('0x16')],'as':'Interactions','where':{'id':_0x1ad12e[_0xd949('0x1f')]},'limit':0x1,'include':[{'model':_0x4d9ba7[_0xd949('0x20')],'as':'Contact','attributes':_[_0xd949('0x21')](_0x29ad08)}]}]});})[_0xd949('0x22')](function(_0x10aa6b){_0x20eaaf=_0x10aa6b['get']({'plain':!![]});if(_0x20eaaf&&_0x20eaaf[_0xd949('0x23')]){logger[_0xd949('0x24')](_0xd949('0x25'),_0xd949('0x26'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1ad12e['id'],_0x20eaaf['replyUri']));if(_0x20eaaf['Interactions']&&_0x20eaaf[_0xd949('0x27')]['length']){_0x1ad12e['Interaction']=_[_0xd949('0x28')](_0x20eaaf[_0xd949('0x27')][0x0],_0xd949('0x29'));_0x1ad12e[_0xd949('0x29')]=_0x20eaaf[_0xd949('0x27')][0x0]['Contact'];}var _0x352256={'method':'POST','uri':encodeURI(_0x20eaaf[_0xd949('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x352256[_0xd949('0x2a')]){case _0xd949('0x2b'):_0x352256['qs']=_0x1ad12e;break;case'POST':_0x352256[_0xd949('0xe')]=_0x1ad12e;break;}return rp(_0x352256)['then'](function(_0x56f617){logger[_0xd949('0x24')](_0xd949('0x25'),_0xd949('0x26'),util['format'](_0xd949('0x2c'),_0x1ad12e['id'],_0x20eaaf[_0xd949('0x23')]));if(_0x56f617[_0xd949('0xe')]['threadId']&&_0x56f617['body'][_0xd949('0x2d')]!=_0x1ad12e['Interaction']['threadId']){return _0x4d9ba7[_0xd949('0x16')]['update']({'threadId':_0x56f617[_0xd949('0xe')][_0xd949('0x2d')]},{'where':{'id':_0x1ad12e[_0xd949('0x2e')]['id']}});}else{return;}})['then'](function(){return _0x40c4b3[_0xd949('0x18')]({'read':!![]});})['catch'](function(_0x2e8973){logger['error'](_0xd949('0x25'),_0xd949('0x26'),util[_0xd949('0x2f')](_0x2e8973,{'showHidden':![],'depth':null}));_0xc1bb03();});}else{_0xc1bb03();}})[_0xd949('0x30')](function(){_0xc1bb03();});}else{_0xc1bb03();}}},'charset':_0xd949('0x31'),'collate':_0xd949('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c6090a0..6f29ac4 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4b3b70,_0x4bde10){var _0x3f9517=function(_0x4735a9){while(--_0x4735a9){_0x4b3b70['push'](_0x4b3b70['shift']());}};_0x3f9517(++_0x4bde10);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x0b0e[_0x3ce937];return _0x41d2fa;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4e65a5,_0x1e0cb9){var _0xcba877=function(_0x1e0669){while(--_0x1e0669){_0x4e65a5['push'](_0x4e65a5['shift']());}};_0xcba877(++_0x1e0cb9);}(_0xadb5,0xad));var _0x5adb=function(_0x5d77e9,_0x33d19c){_0x5d77e9=_0x5d77e9-0x0;var _0x5334cd=_0xadb5[_0x5d77e9];return _0x5334cd;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f6be4bb..4004f96 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 _0xac47=['save','remove','update','emit','removeListener','register','openchannelMessage:','./openchannelMessage.events'];(function(_0xdd14b1,_0x26d70f){var _0x485690=function(_0xdad3db){while(--_0xdad3db){_0xdd14b1['push'](_0xdd14b1['shift']());}};_0x485690(++_0x26d70f);}(_0xac47,0x1af));var _0x7ac4=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xac47[_0x5a99db];return _0x3aad62;};'use strict';var OpenchannelMessageEvents=require(_0x7ac4('0x0'));var events=[_0x7ac4('0x1'),_0x7ac4('0x2'),_0x7ac4('0x3')];function createListener(_0x28c7b1,_0x1174c4){return function(_0x525502){_0x1174c4[_0x7ac4('0x4')](_0x28c7b1,_0x525502);};}function removeListener(_0x3f250a,_0x521f00){return function(){OpenchannelMessageEvents[_0x7ac4('0x5')](_0x3f250a,_0x521f00);};}exports[_0x7ac4('0x6')]=function(_0x1c5478){for(var _0x2bacdf=0x0,_0x438c8e=events['length'];_0x2bacdf<_0x438c8e;_0x2bacdf++){var _0x18c34d=events[_0x2bacdf];var _0x435e68=createListener(_0x7ac4('0x7')+_0x18c34d,_0x1c5478);OpenchannelMessageEvents['on'](_0x18c34d,_0x435e68);}}; \ No newline at end of file +var _0x0127=['update','removeListener','register','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x5787e9,_0x5e2be6){var _0x7bb998=function(_0xb5dfe8){while(--_0xb5dfe8){_0x5787e9['push'](_0x5787e9['shift']());}};_0x7bb998(++_0x5e2be6);}(_0x0127,0xa0));var _0x7012=function(_0x31e511,_0x2dedb9){_0x31e511=_0x31e511-0x0;var _0x1cf899=_0x0127[_0x31e511];return _0x1cf899;};'use strict';var OpenchannelMessageEvents=require(_0x7012('0x0'));var events=['save',_0x7012('0x1'),_0x7012('0x2')];function createListener(_0x4a6b99,_0x467838){return function(_0x2c65bc){_0x467838['emit'](_0x4a6b99,_0x2c65bc);};}function removeListener(_0x308ba0,_0x35d7d7){return function(){OpenchannelMessageEvents[_0x7012('0x3')](_0x308ba0,_0x35d7d7);};}exports[_0x7012('0x4')]=function(_0x3cfeca){for(var _0x446df5=0x0,_0x21e6a5=events['length'];_0x446df5<_0x21e6a5;_0x446df5++){var _0xaca19a=events[_0x446df5];var _0x2d4954=createListener(_0x7012('0x5')+_0xaca19a,_0x3cfeca);OpenchannelMessageEvents['on'](_0xaca19a,_0x2d4954);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 24752a1..bee7c66 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 _0x69b1=['/:id/users','getAgents','addAgents','put','delete','destroy','removeTeams','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x2fd339,_0x37a25c){var _0x37646d=function(_0x86e686){while(--_0x86e686){_0x2fd339['push'](_0x2fd339['shift']());}};_0x37646d(++_0x37a25c);}(_0x69b1,0x18e));var _0x169b=function(_0x3481c3,_0x2ce48e){_0x3481c3=_0x3481c3-0x0;var _0x46a7a0=_0x69b1[_0x3481c3];return _0x46a7a0;};'use strict';var multer=require(_0x169b('0x0'));var util=require(_0x169b('0x1'));var path=require(_0x169b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x169b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x169b('0x4'));var config=require(_0x169b('0x5'));var controller=require(_0x169b('0x6'));router[_0x169b('0x7')]('/',auth[_0x169b('0x8')](),controller[_0x169b('0x9')]);router[_0x169b('0x7')](_0x169b('0xa'),auth['isAuthenticated'](),controller[_0x169b('0xb')]);router[_0x169b('0x7')](_0x169b('0xc'),auth[_0x169b('0x8')](),controller[_0x169b('0xd')]);router[_0x169b('0x7')](_0x169b('0xe'),auth['isAuthenticated'](),controller[_0x169b('0xf')]);router['get'](_0x169b('0x10'),auth[_0x169b('0x8')](),controller[_0x169b('0x11')]);router[_0x169b('0x7')](_0x169b('0x12'),auth[_0x169b('0x8')](),controller[_0x169b('0x13')]);router['post']('/',auth[_0x169b('0x8')](),controller['create']);router['post'](_0x169b('0x10'),auth[_0x169b('0x8')](),controller['addTeams']);router['post'](_0x169b('0x12'),auth[_0x169b('0x8')](),controller[_0x169b('0x14')]);router[_0x169b('0x15')](_0x169b('0xc'),auth[_0x169b('0x8')](),controller['update']);router[_0x169b('0x16')](_0x169b('0xc'),auth[_0x169b('0x8')](),controller[_0x169b('0x17')]);router['delete'](_0x169b('0x10'),auth['isAuthenticated'](),controller[_0x169b('0x18')]);router[_0x169b('0x16')]('/:id/users',auth[_0x169b('0x8')](),controller['removeAgents']);module[_0x169b('0x19')]=router; \ No newline at end of file +var _0x1fbc=['removeTeams','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fbc,0xe2));var _0xc1fb=function(_0x3010be,_0x1ac04c){_0x3010be=_0x3010be-0x0;var _0x17836e=_0x1fbc[_0x3010be];return _0x17836e;};'use strict';var multer=require(_0xc1fb('0x0'));var util=require(_0xc1fb('0x1'));var path=require(_0xc1fb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1fb('0x3')]();var fs_extra=require(_0xc1fb('0x4'));var auth=require(_0xc1fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1fb('0x6'));var controller=require('./openchannelQueue.controller');router[_0xc1fb('0x7')]('/',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x9')]);router[_0xc1fb('0x7')](_0xc1fb('0xa'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0xb')]);router['get'](_0xc1fb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc1fb('0x7')](_0xc1fb('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xc1fb('0xe'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0xf')]);router[_0xc1fb('0x7')](_0xc1fb('0x10'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x11')]);router[_0xc1fb('0x12')]('/',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x13')]);router[_0xc1fb('0x12')]('/:id/teams',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x14')]);router[_0xc1fb('0x12')]('/:id/users',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x15')]);router[_0xc1fb('0x16')]('/:id',auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x17')]);router[_0xc1fb('0x18')](_0xc1fb('0xc'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x19')]);router['delete'](_0xc1fb('0xe'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x1a')]);router[_0xc1fb('0x18')](_0xc1fb('0x10'),auth[_0xc1fb('0x8')](),controller[_0xc1fb('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 552afc9..985864b 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 _0x20db=['STRING','name','ENUM','beepall','exports'];(function(_0x5a9596,_0x47d934){var _0x50d76c=function(_0x4bd0b2){while(--_0x4bd0b2){_0x5a9596['push'](_0x5a9596['shift']());}};_0x50d76c(++_0x47d934);}(_0x20db,0x68));var _0xb20d=function(_0x36949f,_0xac8926){_0x36949f=_0x36949f-0x0;var _0x225ac9=_0x20db[_0x36949f];return _0x225ac9;};'use strict';var Sequelize=require('sequelize');module[_0xb20d('0x0')]={'name':{'type':Sequelize[_0xb20d('0x1')],'unique':_0xb20d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb20d('0x3')]('rrmemory',_0xb20d('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x430c=['name','ENUM','beepall','exports','STRING'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x430c,0x8a));var _0xc430=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x430c[_0x29c3b2];return _0x4b3aa7;};'use strict';var Sequelize=require('sequelize');module[_0xc430('0x0')]={'name':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc430('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc430('0x3')]('rrmemory',_0xc430('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 54fc882..b1ecb3a 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 _0xa76d=['omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','where','include','query','findAll','rows','catch','show','model','keys','OpenchannelQueue','filters','intersection','attributes','fields','includeAll','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','UserOpenchannelQueue','rawAttributes','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','length','order','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userOpenchannelQueue:save','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','includes','all','compact','value','removeTeams','removeAgents','emit','userOpenchannelQueue:remove','addAgents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa76d,0x7e));var _0xda76=function(_0x3640b2,_0x327b3b){_0x3640b2=_0x3640b2-0x0;var _0x5dc255=_0xa76d[_0x3640b2];return _0x5dc255;};'use strict';var BPromise=require(_0xda76('0x0'));var util=require('util');var _=require(_0xda76('0x1'));var squel=require(_0xda76('0x2'));var Redis=require(_0xda76('0x3'));var qs=require(_0xda76('0x4'));var logger=require(_0xda76('0x5'))(_0xda76('0x6'));var config=require(_0xda76('0x7'));var db=require(_0xda76('0x8'))['db'];config[_0xda76('0x9')]=_['defaults'](config[_0xda76('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xda76('0xa'))(new Redis(config[_0xda76('0x9')]));require(_0xda76('0xb'))['register'](socket);function respondWithStatusCode(_0x26e11e,_0x2d173e){_0x2d173e=_0x2d173e||0xcc;return function(_0x172f40){if(_0x172f40){return _0x26e11e[_0xda76('0xc')](_0x2d173e);}return _0x26e11e[_0xda76('0xd')](_0x2d173e)[_0xda76('0xe')]();};}function respondWithResult(_0x299cc5,_0x11598b){_0x11598b=_0x11598b||0xc8;return function(_0x3eb9bc){if(_0x3eb9bc){return _0x299cc5[_0xda76('0xd')](_0x11598b)[_0xda76('0xf')](_0x3eb9bc);}};}function respondWithFilteredResult(_0x371f36,_0x393079){return function(_0x4390ab){if(_0x4390ab){var _0x18d7f8=typeof _0x393079['offset']===_0xda76('0x10')&&typeof _0x393079[_0xda76('0x11')]===_0xda76('0x10');var _0x123170=_0x4390ab[_0xda76('0x12')];var _0x37784f=_0x18d7f8?0x0:_0x393079[_0xda76('0x13')];var _0x57e975=_0x18d7f8?_0x4390ab[_0xda76('0x12')]:_0x393079['offset']+_0x393079['limit'];var _0x7a95ba;if(_0x57e975>=_0x123170){_0x57e975=_0x123170;_0x7a95ba=0xc8;}else{_0x7a95ba=0xce;}_0x371f36[_0xda76('0xd')](_0x7a95ba);return _0x371f36['set'](_0xda76('0x14'),_0x37784f+'-'+_0x57e975+'/'+_0x123170)[_0xda76('0xf')](_0x4390ab);}return null;};}function saveUpdates(_0x1cb733){return function(_0x94028a){if(_0x94028a){return _0x94028a[_0xda76('0x15')](_0x1cb733)[_0xda76('0x16')](function(_0x2c22aa){return _0x2c22aa;});}return null;};}function removeEntity(_0x315265){return function(_0x10023c){if(_0x10023c){return _0x10023c[_0xda76('0x17')]()[_0xda76('0x16')](function(){var _0x1393e0=_0x10023c[_0xda76('0x18')]({'plain':!![]});var _0xd84c6e=_0xda76('0x19');return db[_0xda76('0x1a')][_0xda76('0x17')]({'where':{'type':_0xd84c6e,'resourceId':_0x1393e0['id']}})[_0xda76('0x16')](function(){return _0x10023c;});})[_0xda76('0x16')](function(){_0x315265['status'](0xcc)[_0xda76('0xe')]();});}};}function handleEntityNotFound(_0x55aeda){return function(_0x246f6c){if(!_0x246f6c){_0x55aeda['sendStatus'](0x194);}return _0x246f6c;};}function handleError(_0x4b9936,_0x1ccb44){_0x1ccb44=_0x1ccb44||0x1f4;return function(_0x52bd7d){logger[_0xda76('0x1b')](_0x52bd7d[_0xda76('0x1c')]);if(_0x52bd7d[_0xda76('0x1d')]){delete _0x52bd7d['name'];}_0x4b9936[_0xda76('0xd')](_0x1ccb44)[_0xda76('0x1e')](_0x52bd7d);};}exports[_0xda76('0x1f')]=function(_0x5d6bf7,_0x438508){var _0x50f547={};var _0x297134={'count':0x0,'rows':[]};var _0x33b087=_[_0xda76('0x20')](db['OpenchannelQueue']['rawAttributes'],function(_0x6f8942){return{'name':_0x6f8942[_0xda76('0x21')],'type':_0x6f8942[_0xda76('0x22')][_0xda76('0x23')]};});_0x50f547=qs['getOptions'](_0x33b087,_0x5d6bf7);var _0x745d56={'where':_0x50f547[_0xda76('0x24')]};return db['OpenchannelQueue'][_0xda76('0x12')](_0x745d56)[_0xda76('0x16')](function(_0xb6faa5){_0x297134[_0xda76('0x12')]=_0xb6faa5;_0x50f547['include']=qs[_0xda76('0x25')](_0x5d6bf7[_0xda76('0x26')]);return db['OpenchannelQueue'][_0xda76('0x27')](_0x50f547);})[_0xda76('0x16')](function(_0x539cb2){_0x297134[_0xda76('0x28')]=_0x539cb2;return _0x297134;})[_0xda76('0x16')](respondWithFilteredResult(_0x438508,_0x50f547))[_0xda76('0x29')](handleError(_0x438508,null));};exports[_0xda76('0x2a')]=function(_0x17b576,_0x38b4bf){var _0x122c2d={'raw':!![],'where':{'id':_0x17b576['params']['id']}},_0x4c3a5e={};_0x4c3a5e[_0xda76('0x2b')]=_[_0xda76('0x2c')](db[_0xda76('0x2d')]['rawAttributes']);_0x4c3a5e['query']=_[_0xda76('0x2c')](_0x17b576[_0xda76('0x26')]);_0x4c3a5e[_0xda76('0x2e')]=_[_0xda76('0x2f')](_0x4c3a5e[_0xda76('0x2b')],_0x4c3a5e[_0xda76('0x26')]);_0x122c2d[_0xda76('0x30')]=_['intersection'](_0x4c3a5e[_0xda76('0x2b')],qs[_0xda76('0x31')](_0x17b576[_0xda76('0x26')]['fields']));_0x122c2d[_0xda76('0x30')]=_0x122c2d[_0xda76('0x30')]['length']?_0x122c2d[_0xda76('0x30')]:_0x4c3a5e[_0xda76('0x2b')];if(_0x17b576[_0xda76('0x26')][_0xda76('0x32')]){_0x122c2d[_0xda76('0x25')]=[{'all':!![]}];}_0x122c2d=_['merge']({},_0x122c2d,_0x17b576[_0xda76('0x33')]);return db[_0xda76('0x2d')]['find'](_0x122c2d)[_0xda76('0x16')](handleEntityNotFound(_0x38b4bf,null))[_0xda76('0x16')](respondWithResult(_0x38b4bf,null))[_0xda76('0x29')](handleError(_0x38b4bf,null));};exports[_0xda76('0x34')]=function(_0x384c55,_0x2d8d9c){return db['OpenchannelQueue'][_0xda76('0x34')](_0x384c55['body'],{})[_0xda76('0x16')](function(_0xf50049){var _0x1635ec=_0x384c55[_0xda76('0x35')][_0xda76('0x18')]({'plain':!![]});if(!_0x1635ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1635ec[_0xda76('0x36')]==='user'){var _0x5bf113=_0xf50049[_0xda76('0x18')]({'plain':!![]});var _0x7d5a00=_0xda76('0x19');return db[_0xda76('0x37')][_0xda76('0x38')]({'where':{'name':_0x7d5a00,'userProfileId':_0x1635ec[_0xda76('0x39')]},'raw':!![]})['then'](function(_0x31a928){if(_0x31a928&&_0x31a928[_0xda76('0x3a')]===0x0){return db[_0xda76('0x1a')][_0xda76('0x34')]({'name':_0x5bf113[_0xda76('0x1d')],'resourceId':_0x5bf113['id'],'type':_0x31a928[_0xda76('0x1d')],'sectionId':_0x31a928['id']},{})[_0xda76('0x16')](function(){return _0xf50049;});}else{return _0xf50049;}})[_0xda76('0x29')](function(_0x878f0b){logger['error'](_0xda76('0x3b'),_0x878f0b);throw _0x878f0b;});}return _0xf50049;})[_0xda76('0x16')](respondWithResult(_0x2d8d9c,0xc9))[_0xda76('0x29')](handleError(_0x2d8d9c,null));};exports['update']=function(_0x564284,_0x4a741f){if(_0x564284[_0xda76('0x3c')]['id']){delete _0x564284['body']['id'];}return db[_0xda76('0x2d')][_0xda76('0x38')]({'where':{'id':_0x564284['params']['id']}})[_0xda76('0x16')](handleEntityNotFound(_0x4a741f,null))[_0xda76('0x16')](saveUpdates(_0x564284[_0xda76('0x3c')],null))['then'](respondWithResult(_0x4a741f,null))['catch'](handleError(_0x4a741f,null));};exports[_0xda76('0x17')]=function(_0x2c445e,_0x1f2e92){return db[_0xda76('0x2d')]['find']({'where':{'id':_0x2c445e[_0xda76('0x3d')]['id']}})[_0xda76('0x16')](handleEntityNotFound(_0x1f2e92,null))[_0xda76('0x16')](removeEntity(_0x1f2e92,null))[_0xda76('0x29')](handleError(_0x1f2e92,null));};exports[_0xda76('0x3e')]=function(_0x18cce6,_0x36219c){return db[_0xda76('0x2d')]['describe']()[_0xda76('0x16')](respondWithResult(_0x36219c,null))['catch'](handleError(_0x36219c,null));};exports['getMembers']=function(_0x9658fb,_0x37d46f){var _0x13d34e={'raw':!![],'where':{}},_0x4dcdba={},_0x210376;return db[_0xda76('0x2d')]['findOne']({'where':{'id':_0x9658fb[_0xda76('0x3d')]['id']}})[_0xda76('0x16')](handleEntityNotFound(_0x37d46f,null))['then'](function(_0x149608){if(_0x149608){_0x210376=_0x149608[_0xda76('0x18')]({'plain':!![]});_0x4dcdba['model']=_[_0xda76('0x2c')](db[_0xda76('0x3f')][_0xda76('0x40')]);_0x4dcdba[_0xda76('0x26')]=_[_0xda76('0x2c')](_0x9658fb[_0xda76('0x26')]);_0x4dcdba[_0xda76('0x2e')]=_[_0xda76('0x2f')](_0x4dcdba['model'],_0x4dcdba['query']);_0x13d34e[_0xda76('0x30')]=_[_0xda76('0x2f')](_0x4dcdba[_0xda76('0x2b')],qs[_0xda76('0x31')](_0x9658fb[_0xda76('0x26')][_0xda76('0x31')]));_0x13d34e[_0xda76('0x30')]=_0x13d34e[_0xda76('0x30')]['length']?_0x13d34e[_0xda76('0x30')]:_0x4dcdba['model'];if(!_0x9658fb[_0xda76('0x26')][_0xda76('0x41')](_0xda76('0x42'))){_0x13d34e['limit']=qs['limit'](_0x9658fb[_0xda76('0x26')][_0xda76('0x11')]);_0x13d34e['offset']=qs['offset'](_0x9658fb[_0xda76('0x26')]['offset']);}_0x13d34e['order']=qs[_0xda76('0x43')](_0x9658fb[_0xda76('0x26')][_0xda76('0x43')]);_0x13d34e[_0xda76('0x24')]=qs['filters'](_[_0xda76('0x44')](_0x9658fb[_0xda76('0x26')],_0x4dcdba[_0xda76('0x2e')]));_0x13d34e[_0xda76('0x24')][_0xda76('0x45')]=_0x149608['id'];if(_0x9658fb['query']['filter']){_0x13d34e['where']=_['merge'](_0x13d34e[_0xda76('0x24')],{'$or':_[_0xda76('0x20')](_0x13d34e[_0xda76('0x30')],function(_0x238c4b){var _0x30ffa9={};_0x30ffa9[_0x238c4b]={'$like':'%'+_0x9658fb[_0xda76('0x26')][_0xda76('0x46')]+'%'};return _0x30ffa9;})});}_0x13d34e=_[_0xda76('0x47')]({},_0x13d34e,_0x9658fb[_0xda76('0x33')]);return db[_0xda76('0x3f')][_0xda76('0x27')](_0x13d34e);}})[_0xda76('0x16')](function(_0x4cb046){if(_0x4cb046){return db[_0xda76('0x48')][_0xda76('0x49')]({'where':{'id':_[_0xda76('0x20')](_0x4cb046,_0xda76('0x4a')),'role':_0xda76('0x4b')},'attributes':['id',_0xda76('0x1d'),_0xda76('0x4c'),'updatedAt',_0xda76('0x4d')]});}})[_0xda76('0x16')](function(_0x442c4d){if(_0x442c4d){return{'count':_0x442c4d['count'],'rows':_[_0xda76('0x20')](_0x442c4d[_0xda76('0x28')],function(_0x47d826){return{'membername':_0x47d826[_0xda76('0x1d')],'UserId':_0x47d826['id'],'queue_name':_0x210376[_0xda76('0x1d')],'OpenchannelQueueId':_0x210376['id'],'interface':util[_0xda76('0x4e')](_0xda76('0x4f'),'SIP',_0x47d826['name']),'penalty':0x0,'paused':_0x47d826[_0xda76('0x4c')],'createdAt':_0x47d826[_0xda76('0x4d')],'updatedAt':_0x47d826[_0xda76('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda76('0x16')](respondWithFilteredResult(_0x37d46f,_0x13d34e))[_0xda76('0x29')](handleError(_0x37d46f,null));};exports[_0xda76('0x51')]=function(_0x117d8b,_0x2e6d63){var _0x44d661={};var _0x28ad6b={};var _0x3fcf97;var _0x4540aa;return db[_0xda76('0x2d')][_0xda76('0x52')]({'where':{'id':_0x117d8b[_0xda76('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2e6d63,null))['then'](function(_0x58438d){if(_0x58438d){_0x3fcf97=_0x58438d;_0x28ad6b[_0xda76('0x2b')]=_[_0xda76('0x2c')](db['Team'][_0xda76('0x40')]);_0x28ad6b[_0xda76('0x26')]=_[_0xda76('0x2c')](_0x117d8b[_0xda76('0x26')]);_0x28ad6b[_0xda76('0x2e')]=_['intersection'](_0x28ad6b['model'],_0x28ad6b[_0xda76('0x26')]);_0x44d661[_0xda76('0x30')]=_['intersection'](_0x28ad6b[_0xda76('0x2b')],qs['fields'](_0x117d8b['query'][_0xda76('0x31')]));_0x44d661['attributes']=_0x44d661[_0xda76('0x30')][_0xda76('0x53')]?_0x44d661[_0xda76('0x30')]:_0x28ad6b[_0xda76('0x2b')];_0x44d661[_0xda76('0x54')]=qs[_0xda76('0x43')](_0x117d8b[_0xda76('0x26')]['sort']);_0x44d661[_0xda76('0x24')]=qs[_0xda76('0x2e')](_[_0xda76('0x44')](_0x117d8b[_0xda76('0x26')],_0x28ad6b[_0xda76('0x2e')]));if(_0x117d8b[_0xda76('0x26')][_0xda76('0x46')]){_0x44d661['where']=_['merge'](_0x44d661['where'],{'$or':_['map'](_0x44d661['attributes'],function(_0x44d0b9){var _0x3c80b1={};_0x3c80b1[_0x44d0b9]={'$like':'%'+_0x117d8b[_0xda76('0x26')]['filter']+'%'};return _0x3c80b1;})});}_0x44d661=_[_0xda76('0x47')]({},_0x44d661,_0x117d8b[_0xda76('0x33')]);return _0x3fcf97[_0xda76('0x51')](_0x44d661);}})[_0xda76('0x16')](function(_0x51f720){if(_0x51f720){_0x4540aa=_0x51f720[_0xda76('0x53')];if(!_0x117d8b[_0xda76('0x26')][_0xda76('0x41')](_0xda76('0x42'))){_0x44d661[_0xda76('0x11')]=qs[_0xda76('0x11')](_0x117d8b[_0xda76('0x26')][_0xda76('0x11')]);_0x44d661[_0xda76('0x13')]=qs[_0xda76('0x13')](_0x117d8b['query'][_0xda76('0x13')]);}return _0x3fcf97[_0xda76('0x51')](_0x44d661);}})[_0xda76('0x16')](function(_0xfaf7df){if(_0xfaf7df){return _0xfaf7df?{'count':_0x4540aa,'rows':_0xfaf7df}:null;}})[_0xda76('0x16')](respondWithResult(_0x2e6d63,null))[_0xda76('0x29')](handleError(_0x2e6d63,null));};exports[_0xda76('0x55')]=function(_0xb9a0a3,_0x3452c4){var _0x4d53c4=_0xb9a0a3[_0xda76('0x3c')]['ids'];return db[_0xda76('0x56')][_0xda76('0x27')]({'where':{'id':_0x4d53c4},'attributes':['id'],'include':[{'model':db[_0xda76('0x48')],'as':_0xda76('0x57'),'attributes':['id',_0xda76('0x1d'),_0xda76('0x58'),_0xda76('0x59'),_0xda76('0x5a')],'raw':!![]}]})[_0xda76('0x16')](function(_0x205f41){if(_0x205f41){var _0x2dcfc2=_[_0xda76('0x5b')](_0x205f41,function(_0x14fbe5){var _0x2c0517=_0x14fbe5['get']({'plain':!![]});return _0x2c0517[_0xda76('0x57')];});return db[_0xda76('0x2d')][_0xda76('0x38')]({'where':{'id':_0xb9a0a3['params']['id']}})[_0xda76('0x16')](function(_0x460693){return db['sequelize']['transaction'](function(_0x46d48e){return _0x460693[_0xda76('0x55')](_0x4d53c4,{'transaction':_0x46d48e})['then'](function(){return BPromise[_0xda76('0x5c')](_0x2dcfc2,function(_0x51ceb3){return db[_0xda76('0x3f')][_0xda76('0x5d')]({'where':{'UserId':_0x51ceb3['id'],'OpenchannelQueueId':_0xb9a0a3['params']['id']},'transaction':_0x46d48e});});})[_0xda76('0x16')](function(){_0x2dcfc2[_0xda76('0x5e')](function(_0x5f337f){socket['emit'](_0xda76('0x5f'),{'UserId':_0x5f337f['id'],'OpenchannelQueueId':_0x460693['id']});});});});});}})[_0xda76('0x16')](respondWithStatusCode(_0x3452c4,null))[_0xda76('0x29')](handleError(_0x3452c4,null));};exports['removeTeams']=function(_0x5416c3,_0x1ac624){return db[_0xda76('0x56')][_0xda76('0x27')]({'where':{'id':_0x5416c3[_0xda76('0x26')][_0xda76('0x60')]},'attributes':['id'],'include':[{'model':db[_0xda76('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xda76('0x16')](handleEntityNotFound(_0x1ac624,null))[_0xda76('0x16')](function(_0xc2c3bb){var _0x362e8a=_[_0xda76('0x20')](_0xc2c3bb,'id');var _0x1a82b6=[];var _0x323683=[];var _0x59ada5=squel[_0xda76('0x61')]();_0x59ada5['field'](_0xda76('0x62'))[_0xda76('0x63')]('team_has_openchannel_queues','tq')[_0xda76('0x64')]('user_has_teams','ut',_0xda76('0x65'))['where'](_0xda76('0x66'),_0x5416c3[_0xda76('0x3d')]['id']);for(var _0x2925e2=0x0;_0x2925e2<_0xc2c3bb[_0xda76('0x53')];_0x2925e2+=0x1){let _0x2f5838=_0xc2c3bb[_0x2925e2];for(var _0x11f918=0x0;_0x11f918<_0x2f5838['Agents'][_0xda76('0x53')];_0x11f918+=0x1){let _0x4b04ae=_0x2f5838[_0xda76('0x57')][_0x11f918];var _0x5d23ae=_0x59ada5[_0xda76('0x67')]();_0x5d23ae[_0xda76('0x24')]('ut.UserId\x20=\x20?',_0x4b04ae['id']);_0x323683[_0xda76('0x68')](db[_0xda76('0x69')][_0xda76('0x26')](_0x5d23ae['toString'](),{'type':db[_0xda76('0x69')][_0xda76('0x6a')][_0xda76('0x6b')]})[_0xda76('0x16')](function(_0x2dd734){if(_0x2dd734[_0xda76('0x53')]===0x1){return _0x4b04ae['id'];}else{var _0x226e4a=_[_0xda76('0x6c')](_['map'](_0x2dd734,'TeamId'),function(_0x5e55e1){return _[_0xda76('0x6d')](_0x362e8a,_0x5e55e1);});if(_0x226e4a){return _0x4b04ae['id'];}}}));}}return BPromise[_0xda76('0x6e')](_0x323683)[_0xda76('0x16')](function(_0x3ff17c){_0x1a82b6=_(_0x1a82b6)['union'](_0x3ff17c)[_0xda76('0x6f')]()[_0xda76('0x70')]();return db['OpenchannelQueue'][_0xda76('0x38')]({'where':{'id':_0x5416c3[_0xda76('0x3d')]['id']}})[_0xda76('0x16')](function(_0x1b2756){return db[_0xda76('0x69')]['transaction'](function(_0x8bd930){return _0x1b2756[_0xda76('0x71')](_0x5416c3[_0xda76('0x26')]['ids'],{'transaction':_0x8bd930})[_0xda76('0x16')](function(){if(!_['isEmpty'](_0x1a82b6)){return _0x1b2756[_0xda76('0x72')](_0x1a82b6,{'transaction':_0x8bd930});}})['then'](function(){_0x1a82b6[_0xda76('0x5e')](function(_0x33c7d3){socket[_0xda76('0x73')](_0xda76('0x74'),{'UserId':_0x33c7d3,'OpenchannelQueueId':_0x1b2756['id']});});});});});});})[_0xda76('0x16')](respondWithStatusCode(_0x1ac624,null))[_0xda76('0x29')](handleError(_0x1ac624,null));};exports['addAgents']=function(_0x2edf9e,_0x5aefd2){return db[_0xda76('0x2d')][_0xda76('0x38')]({'where':{'id':_0x2edf9e[_0xda76('0x3d')]['id']}})[_0xda76('0x16')](handleEntityNotFound(_0x5aefd2,null))[_0xda76('0x16')](function(_0x36b09d){if(_0x36b09d){return _0x36b09d[_0xda76('0x75')](_0x2edf9e[_0xda76('0x3c')][_0xda76('0x60')],_[_0xda76('0x76')](_0x2edf9e['body'],[_0xda76('0x60'),'id'])||{})[_0xda76('0x77')](function(_0x45769e){for(var _0x554efe=0x0;_0x554efe<_0x2edf9e[_0xda76('0x3c')][_0xda76('0x60')][_0xda76('0x53')];_0x554efe+=0x1){socket['emit'](_0xda76('0x5f'),{'UserId':Number(_0x2edf9e[_0xda76('0x3c')][_0xda76('0x60')][_0x554efe]),'OpenchannelQueueId':Number(_0x2edf9e[_0xda76('0x3d')]['id'])});}return _0x45769e;});}})[_0xda76('0x16')](respondWithResult(_0x5aefd2,null))[_0xda76('0x29')](handleError(_0x5aefd2,null));};exports[_0xda76('0x72')]=function(_0x24d042,_0x48ddb8){return db['OpenchannelQueue'][_0xda76('0x38')]({'where':{'id':_0x24d042[_0xda76('0x3d')]['id']}})[_0xda76('0x16')](handleEntityNotFound(_0x48ddb8,null))[_0xda76('0x16')](function(_0x120b80){if(_0x120b80){return _0x120b80[_0xda76('0x72')](_0x24d042[_0xda76('0x26')][_0xda76('0x60')])[_0xda76('0x16')](function(){if(_[_0xda76('0x78')](_0x24d042['query'][_0xda76('0x60')])){for(var _0x3a1b98=0x0;_0x3a1b98<_0x24d042[_0xda76('0x26')][_0xda76('0x60')][_0xda76('0x53')];_0x3a1b98+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x24d042[_0xda76('0x26')]['ids'][_0x3a1b98]),'OpenchannelQueueId':Number(_0x24d042[_0xda76('0x3d')]['id'])});}}else{socket[_0xda76('0x73')](_0xda76('0x74'),{'UserId':Number(_0x24d042[_0xda76('0x26')][_0xda76('0x60')]),'OpenchannelQueueId':Number(_0x24d042[_0xda76('0x3d')]['id'])});}});}})[_0xda76('0x16')](respondWithStatusCode(_0x48ddb8,null))[_0xda76('0x29')](handleError(_0x48ddb8,null));};exports[_0xda76('0x79')]=function(_0x62aa72,_0x543bea){var _0x59f2ca={};var _0x31ccd6={};var _0xb7a6d4;var _0x3a3954;return db['OpenchannelQueue'][_0xda76('0x52')]({'where':{'id':_0x62aa72['params']['id']}})['then'](handleEntityNotFound(_0x543bea,null))[_0xda76('0x16')](function(_0x45c26f){if(_0x45c26f){_0xb7a6d4=_0x45c26f;_0x31ccd6[_0xda76('0x2b')]=_[_0xda76('0x2c')](db[_0xda76('0x48')][_0xda76('0x40')]);_0x31ccd6[_0xda76('0x26')]=_['keys'](_0x62aa72[_0xda76('0x26')]);_0x31ccd6['filters']=_['intersection'](_0x31ccd6[_0xda76('0x2b')],_0x31ccd6[_0xda76('0x26')]);_0x59f2ca[_0xda76('0x30')]=_[_0xda76('0x2f')](_0x31ccd6[_0xda76('0x2b')],qs[_0xda76('0x31')](_0x62aa72[_0xda76('0x26')][_0xda76('0x31')]));_0x59f2ca[_0xda76('0x30')]=_0x59f2ca[_0xda76('0x30')][_0xda76('0x53')]?_0x59f2ca[_0xda76('0x30')]:_0x31ccd6[_0xda76('0x2b')];_0x59f2ca['order']=qs[_0xda76('0x43')](_0x62aa72[_0xda76('0x26')]['sort']);_0x59f2ca[_0xda76('0x24')]=qs[_0xda76('0x2e')](_['pick'](_0x62aa72['query'],_0x31ccd6[_0xda76('0x2e')]));if(_0x62aa72[_0xda76('0x26')][_0xda76('0x46')]){_0x59f2ca[_0xda76('0x24')]=_[_0xda76('0x47')](_0x59f2ca[_0xda76('0x24')],{'$or':_[_0xda76('0x20')](_0x59f2ca[_0xda76('0x30')],function(_0xa6131c){var _0x4eb28e={};_0x4eb28e[_0xa6131c]={'$like':'%'+_0x62aa72[_0xda76('0x26')][_0xda76('0x46')]+'%'};return _0x4eb28e;})});}_0x59f2ca=_[_0xda76('0x47')]({},_0x59f2ca,_0x62aa72['options']);return _0xb7a6d4[_0xda76('0x79')](_0x59f2ca);}})['then'](function(_0x19c269){if(_0x19c269){_0x3a3954=_0x19c269[_0xda76('0x53')];if(!_0x62aa72[_0xda76('0x26')][_0xda76('0x41')]('nolimit')){_0x59f2ca[_0xda76('0x11')]=qs[_0xda76('0x11')](_0x62aa72[_0xda76('0x26')][_0xda76('0x11')]);_0x59f2ca[_0xda76('0x13')]=qs[_0xda76('0x13')](_0x62aa72[_0xda76('0x26')][_0xda76('0x13')]);}return _0xb7a6d4[_0xda76('0x79')](_0x59f2ca);}})[_0xda76('0x16')](function(_0x478c6d){if(_0x478c6d){return _0x478c6d?{'count':_0x3a3954,'rows':_0x478c6d}:null;}})[_0xda76('0x16')](respondWithResult(_0x543bea,null))[_0xda76('0x29')](handleError(_0x543bea,null));}; \ No newline at end of file +var _0x80bf=['redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','OpenchannelQueues','error','name','send','OpenchannelQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','model','keys','rawAttributes','attributes','intersection','fields','length','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','filters','OpenchannelQueueId','filter','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','SIP','getTeams','Team','addTeams','Agents','online','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults'];(function(_0xbc9ae6,_0x3b7c66){var _0x33446e=function(_0x2222c1){while(--_0x2222c1){_0xbc9ae6['push'](_0xbc9ae6['shift']());}};_0x33446e(++_0x3b7c66);}(_0x80bf,0x163));var _0xf80b=function(_0x4d6451,_0x214b3e){_0x4d6451=_0x4d6451-0x0;var _0x599768=_0x80bf[_0x4d6451];return _0x599768;};'use strict';var BPromise=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var _=require(_0xf80b('0x2'));var squel=require(_0xf80b('0x3'));var Redis=require(_0xf80b('0x4'));var qs=require(_0xf80b('0x5'));var logger=require(_0xf80b('0x6'))(_0xf80b('0x7'));var config=require(_0xf80b('0x8'));var db=require(_0xf80b('0x9'))['db'];config['redis']=_[_0xf80b('0xa')](config[_0xf80b('0xb')],{'host':_0xf80b('0xc'),'port':0x18eb});var socket=require(_0xf80b('0xd'))(new Redis(config[_0xf80b('0xb')]));require('./openchannelQueue.socket')[_0xf80b('0xe')](socket);function respondWithStatusCode(_0x4d2c1d,_0x27c7c4){_0x27c7c4=_0x27c7c4||0xcc;return function(_0xf54599){if(_0xf54599){return _0x4d2c1d[_0xf80b('0xf')](_0x27c7c4);}return _0x4d2c1d[_0xf80b('0x10')](_0x27c7c4)[_0xf80b('0x11')]();};}function respondWithResult(_0x3c0144,_0x5b07cc){_0x5b07cc=_0x5b07cc||0xc8;return function(_0xc01cfd){if(_0xc01cfd){return _0x3c0144[_0xf80b('0x10')](_0x5b07cc)[_0xf80b('0x12')](_0xc01cfd);}};}function respondWithFilteredResult(_0x1f50cb,_0x124b40){return function(_0x515c51){if(_0x515c51){var _0x798117=typeof _0x124b40[_0xf80b('0x13')]===_0xf80b('0x14')&&typeof _0x124b40[_0xf80b('0x15')]===_0xf80b('0x14');var _0x348293=_0x515c51[_0xf80b('0x16')];var _0x563815=_0x798117?0x0:_0x124b40['offset'];var _0x9a87f6=_0x798117?_0x515c51['count']:_0x124b40['offset']+_0x124b40[_0xf80b('0x15')];var _0x17c8cd;if(_0x9a87f6>=_0x348293){_0x9a87f6=_0x348293;_0x17c8cd=0xc8;}else{_0x17c8cd=0xce;}_0x1f50cb[_0xf80b('0x10')](_0x17c8cd);return _0x1f50cb[_0xf80b('0x17')](_0xf80b('0x18'),_0x563815+'-'+_0x9a87f6+'/'+_0x348293)[_0xf80b('0x12')](_0x515c51);}return null;};}function saveUpdates(_0x192c48){return function(_0xfb5bee){if(_0xfb5bee){return _0xfb5bee[_0xf80b('0x19')](_0x192c48)[_0xf80b('0x1a')](function(_0x2eb103){return _0x2eb103;});}return null;};}function removeEntity(_0x562043){return function(_0x59da79){if(_0x59da79){return _0x59da79[_0xf80b('0x1b')]()['then'](function(){var _0x12d75a=_0x59da79[_0xf80b('0x1c')]({'plain':!![]});var _0x1e3d7e=_0xf80b('0x1d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e3d7e,'resourceId':_0x12d75a['id']}})[_0xf80b('0x1a')](function(){return _0x59da79;});})[_0xf80b('0x1a')](function(){_0x562043[_0xf80b('0x10')](0xcc)[_0xf80b('0x11')]();});}};}function handleEntityNotFound(_0x216815){return function(_0xb536cd){if(!_0xb536cd){_0x216815[_0xf80b('0xf')](0x194);}return _0xb536cd;};}function handleError(_0x18de2e,_0x619640){_0x619640=_0x619640||0x1f4;return function(_0x1167e4){logger[_0xf80b('0x1e')](_0x1167e4['stack']);if(_0x1167e4[_0xf80b('0x1f')]){delete _0x1167e4[_0xf80b('0x1f')];}_0x18de2e[_0xf80b('0x10')](_0x619640)[_0xf80b('0x20')](_0x1167e4);};}exports['index']=function(_0x39caab,_0x5e14ff){var _0x3dc894={};var _0x490c30={'count':0x0,'rows':[]};var _0x1ab366=_['map'](db[_0xf80b('0x21')]['rawAttributes'],function(_0x5498d2){return{'name':_0x5498d2[_0xf80b('0x22')],'type':_0x5498d2[_0xf80b('0x23')][_0xf80b('0x24')]};});_0x3dc894=qs[_0xf80b('0x25')](_0x1ab366,_0x39caab);var _0x1d4e75={'where':_0x3dc894[_0xf80b('0x26')]};return db[_0xf80b('0x21')]['count'](_0x1d4e75)['then'](function(_0x49f0d0){_0x490c30[_0xf80b('0x16')]=_0x49f0d0;_0x3dc894[_0xf80b('0x27')]=qs[_0xf80b('0x27')](_0x39caab[_0xf80b('0x28')]);return db[_0xf80b('0x21')][_0xf80b('0x29')](_0x3dc894);})[_0xf80b('0x1a')](function(_0x4d1d9b){_0x490c30[_0xf80b('0x2a')]=_0x4d1d9b;return _0x490c30;})['then'](respondWithFilteredResult(_0x5e14ff,_0x3dc894))[_0xf80b('0x2b')](handleError(_0x5e14ff,null));};exports['show']=function(_0x464e15,_0x581218){var _0x4db465={'raw':!![],'where':{'id':_0x464e15['params']['id']}},_0x5ce20a={};_0x5ce20a[_0xf80b('0x2c')]=_[_0xf80b('0x2d')](db[_0xf80b('0x21')][_0xf80b('0x2e')]);_0x5ce20a['query']=_[_0xf80b('0x2d')](_0x464e15[_0xf80b('0x28')]);_0x5ce20a['filters']=_['intersection'](_0x5ce20a[_0xf80b('0x2c')],_0x5ce20a['query']);_0x4db465[_0xf80b('0x2f')]=_[_0xf80b('0x30')](_0x5ce20a[_0xf80b('0x2c')],qs[_0xf80b('0x31')](_0x464e15['query'][_0xf80b('0x31')]));_0x4db465[_0xf80b('0x2f')]=_0x4db465[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x4db465[_0xf80b('0x2f')]:_0x5ce20a[_0xf80b('0x2c')];if(_0x464e15[_0xf80b('0x28')]['includeAll']){_0x4db465['include']=[{'all':!![]}];}_0x4db465=_[_0xf80b('0x33')]({},_0x4db465,_0x464e15[_0xf80b('0x34')]);return db[_0xf80b('0x21')]['find'](_0x4db465)[_0xf80b('0x1a')](handleEntityNotFound(_0x581218,null))[_0xf80b('0x1a')](respondWithResult(_0x581218,null))[_0xf80b('0x2b')](handleError(_0x581218,null));};exports[_0xf80b('0x35')]=function(_0x2a72bb,_0x2e06b8){return db[_0xf80b('0x21')]['create'](_0x2a72bb[_0xf80b('0x36')],{})[_0xf80b('0x1a')](function(_0x316001){var _0x869354=_0x2a72bb['user'][_0xf80b('0x1c')]({'plain':!![]});if(!_0x869354)throw new Error(_0xf80b('0x37'));if(_0x869354[_0xf80b('0x38')]==='user'){var _0x1650d3=_0x316001[_0xf80b('0x1c')]({'plain':!![]});var _0x31d19e='OpenchannelQueues';return db[_0xf80b('0x39')][_0xf80b('0x3a')]({'where':{'name':_0x31d19e,'userProfileId':_0x869354[_0xf80b('0x3b')]},'raw':!![]})[_0xf80b('0x1a')](function(_0x33f8c5){if(_0x33f8c5&&_0x33f8c5[_0xf80b('0x3c')]===0x0){return db[_0xf80b('0x3d')][_0xf80b('0x35')]({'name':_0x1650d3[_0xf80b('0x1f')],'resourceId':_0x1650d3['id'],'type':_0x33f8c5['name'],'sectionId':_0x33f8c5['id']},{})['then'](function(){return _0x316001;});}else{return _0x316001;}})['catch'](function(_0x56e995){logger['error'](_0xf80b('0x3e'),_0x56e995);throw _0x56e995;});}return _0x316001;})['then'](respondWithResult(_0x2e06b8,0xc9))['catch'](handleError(_0x2e06b8,null));};exports[_0xf80b('0x19')]=function(_0x2747ea,_0x1ff61e){if(_0x2747ea[_0xf80b('0x36')]['id']){delete _0x2747ea[_0xf80b('0x36')]['id'];}return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2747ea[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ff61e,null))['then'](saveUpdates(_0x2747ea[_0xf80b('0x36')],null))[_0xf80b('0x1a')](respondWithResult(_0x1ff61e,null))[_0xf80b('0x2b')](handleError(_0x1ff61e,null));};exports[_0xf80b('0x1b')]=function(_0x4fb982,_0x3af70e){return db['OpenchannelQueue']['find']({'where':{'id':_0x4fb982[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x3af70e,null))[_0xf80b('0x1a')](removeEntity(_0x3af70e,null))['catch'](handleError(_0x3af70e,null));};exports[_0xf80b('0x40')]=function(_0xecb58b,_0x1210e9){return db[_0xf80b('0x21')][_0xf80b('0x40')]()['then'](respondWithResult(_0x1210e9,null))[_0xf80b('0x2b')](handleError(_0x1210e9,null));};exports[_0xf80b('0x41')]=function(_0x4c30c7,_0x4b88b3){var _0x5046ad={'raw':!![],'where':{}},_0x21e94f={},_0x483dec;return db[_0xf80b('0x21')][_0xf80b('0x42')]({'where':{'id':_0x4c30c7['params']['id']}})['then'](handleEntityNotFound(_0x4b88b3,null))[_0xf80b('0x1a')](function(_0x336e63){if(_0x336e63){_0x483dec=_0x336e63[_0xf80b('0x1c')]({'plain':!![]});_0x21e94f[_0xf80b('0x2c')]=_['keys'](db[_0xf80b('0x43')][_0xf80b('0x2e')]);_0x21e94f[_0xf80b('0x28')]=_['keys'](_0x4c30c7[_0xf80b('0x28')]);_0x21e94f['filters']=_[_0xf80b('0x30')](_0x21e94f['model'],_0x21e94f[_0xf80b('0x28')]);_0x5046ad[_0xf80b('0x2f')]=_['intersection'](_0x21e94f[_0xf80b('0x2c')],qs['fields'](_0x4c30c7['query']['fields']));_0x5046ad[_0xf80b('0x2f')]=_0x5046ad[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x5046ad[_0xf80b('0x2f')]:_0x21e94f['model'];if(!_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x44')](_0xf80b('0x45'))){_0x5046ad[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x15')]);_0x5046ad[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x13')]);}_0x5046ad[_0xf80b('0x46')]=qs['sort'](_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x47')]);_0x5046ad['where']=qs['filters'](_[_0xf80b('0x48')](_0x4c30c7['query'],_0x21e94f[_0xf80b('0x49')]));_0x5046ad[_0xf80b('0x26')][_0xf80b('0x4a')]=_0x336e63['id'];if(_0x4c30c7['query'][_0xf80b('0x4b')]){_0x5046ad[_0xf80b('0x26')]=_['merge'](_0x5046ad[_0xf80b('0x26')],{'$or':_[_0xf80b('0x4c')](_0x5046ad[_0xf80b('0x2f')],function(_0x55dc2d){var _0x394973={};_0x394973[_0x55dc2d]={'$like':'%'+_0x4c30c7[_0xf80b('0x28')][_0xf80b('0x4b')]+'%'};return _0x394973;})});}_0x5046ad=_[_0xf80b('0x33')]({},_0x5046ad,_0x4c30c7['options']);return db[_0xf80b('0x43')]['findAll'](_0x5046ad);}})[_0xf80b('0x1a')](function(_0x5aa503){if(_0x5aa503){return db[_0xf80b('0x4d')][_0xf80b('0x4e')]({'where':{'id':_['map'](_0x5aa503,_0xf80b('0x4f')),'role':_0xf80b('0x50')},'attributes':['id',_0xf80b('0x1f'),_0xf80b('0x51'),_0xf80b('0x52'),'createdAt']});}})[_0xf80b('0x1a')](function(_0x491af1){if(_0x491af1){return{'count':_0x491af1[_0xf80b('0x16')],'rows':_['map'](_0x491af1[_0xf80b('0x2a')],function(_0x4e2c61){return{'membername':_0x4e2c61['name'],'UserId':_0x4e2c61['id'],'queue_name':_0x483dec['name'],'OpenchannelQueueId':_0x483dec['id'],'interface':util[_0xf80b('0x53')]('%s/%s',_0xf80b('0x54'),_0x4e2c61['name']),'penalty':0x0,'paused':_0x4e2c61[_0xf80b('0x51')],'createdAt':_0x4e2c61['createdAt'],'updatedAt':_0x4e2c61['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf80b('0x1a')](respondWithFilteredResult(_0x4b88b3,_0x5046ad))[_0xf80b('0x2b')](handleError(_0x4b88b3,null));};exports[_0xf80b('0x55')]=function(_0xe4dc5a,_0x67248f){var _0x3ff7b0={};var _0x4c9e82={};var _0x5312ce;var _0x49d63f;return db[_0xf80b('0x21')][_0xf80b('0x42')]({'where':{'id':_0xe4dc5a[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x67248f,null))[_0xf80b('0x1a')](function(_0x1e577f){if(_0x1e577f){_0x5312ce=_0x1e577f;_0x4c9e82[_0xf80b('0x2c')]=_[_0xf80b('0x2d')](db[_0xf80b('0x56')][_0xf80b('0x2e')]);_0x4c9e82[_0xf80b('0x28')]=_[_0xf80b('0x2d')](_0xe4dc5a[_0xf80b('0x28')]);_0x4c9e82[_0xf80b('0x49')]=_[_0xf80b('0x30')](_0x4c9e82[_0xf80b('0x2c')],_0x4c9e82[_0xf80b('0x28')]);_0x3ff7b0['attributes']=_[_0xf80b('0x30')](_0x4c9e82[_0xf80b('0x2c')],qs[_0xf80b('0x31')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x31')]));_0x3ff7b0[_0xf80b('0x2f')]=_0x3ff7b0[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x3ff7b0['attributes']:_0x4c9e82[_0xf80b('0x2c')];_0x3ff7b0[_0xf80b('0x46')]=qs[_0xf80b('0x47')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x47')]);_0x3ff7b0[_0xf80b('0x26')]=qs[_0xf80b('0x49')](_[_0xf80b('0x48')](_0xe4dc5a['query'],_0x4c9e82['filters']));if(_0xe4dc5a['query']['filter']){_0x3ff7b0[_0xf80b('0x26')]=_[_0xf80b('0x33')](_0x3ff7b0['where'],{'$or':_[_0xf80b('0x4c')](_0x3ff7b0[_0xf80b('0x2f')],function(_0x432ac9){var _0x26f1f3={};_0x26f1f3[_0x432ac9]={'$like':'%'+_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x4b')]+'%'};return _0x26f1f3;})});}_0x3ff7b0=_[_0xf80b('0x33')]({},_0x3ff7b0,_0xe4dc5a[_0xf80b('0x34')]);return _0x5312ce['getTeams'](_0x3ff7b0);}})['then'](function(_0x494ff5){if(_0x494ff5){_0x49d63f=_0x494ff5[_0xf80b('0x32')];if(!_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x44')](_0xf80b('0x45'))){_0x3ff7b0[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0xe4dc5a[_0xf80b('0x28')]['limit']);_0x3ff7b0[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0xe4dc5a[_0xf80b('0x28')][_0xf80b('0x13')]);}return _0x5312ce['getTeams'](_0x3ff7b0);}})[_0xf80b('0x1a')](function(_0x3fc818){if(_0x3fc818){return _0x3fc818?{'count':_0x49d63f,'rows':_0x3fc818}:null;}})[_0xf80b('0x1a')](respondWithResult(_0x67248f,null))[_0xf80b('0x2b')](handleError(_0x67248f,null));};exports[_0xf80b('0x57')]=function(_0x2c0f2a,_0x5b5400){var _0xb44f10=_0x2c0f2a[_0xf80b('0x36')]['ids'];return db[_0xf80b('0x56')][_0xf80b('0x29')]({'where':{'id':_0xb44f10},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf80b('0x58'),'attributes':['id',_0xf80b('0x1f'),_0xf80b('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xf80b('0x1a')](function(_0x117186){if(_0x117186){var _0x1a9af7=_['flatMap'](_0x117186,function(_0x457f04){var _0x3cc368=_0x457f04['get']({'plain':!![]});return _0x3cc368[_0xf80b('0x58')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x2c0f2a[_0xf80b('0x3f')]['id']}})[_0xf80b('0x1a')](function(_0x3587d4){return db[_0xf80b('0x5a')]['transaction'](function(_0x59f90b){return _0x3587d4['addTeams'](_0xb44f10,{'transaction':_0x59f90b})[_0xf80b('0x1a')](function(){return BPromise[_0xf80b('0x5b')](_0x1a9af7,function(_0x42bc96){return db[_0xf80b('0x43')][_0xf80b('0x5c')]({'where':{'UserId':_0x42bc96['id'],'OpenchannelQueueId':_0x2c0f2a[_0xf80b('0x3f')]['id']},'transaction':_0x59f90b});});})[_0xf80b('0x1a')](function(){_0x1a9af7[_0xf80b('0x5d')](function(_0x51a5d5){socket[_0xf80b('0x5e')](_0xf80b('0x5f'),{'UserId':_0x51a5d5['id'],'OpenchannelQueueId':_0x3587d4['id']});});});});});}})[_0xf80b('0x1a')](respondWithStatusCode(_0x5b5400,null))[_0xf80b('0x2b')](handleError(_0x5b5400,null));};exports[_0xf80b('0x60')]=function(_0x2b13dc,_0x41a03f){return db['Team'][_0xf80b('0x29')]({'where':{'id':_0x2b13dc[_0xf80b('0x28')][_0xf80b('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf80b('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf80b('0x1a')](handleEntityNotFound(_0x41a03f,null))[_0xf80b('0x1a')](function(_0x3ecdb0){var _0x55ed2f=_[_0xf80b('0x4c')](_0x3ecdb0,'id');var _0x840308=[];var _0x1e8ea2=[];var _0x25e06c=squel[_0xf80b('0x62')]();_0x25e06c[_0xf80b('0x63')]('tq.TeamId')[_0xf80b('0x64')]('team_has_openchannel_queues','tq')[_0xf80b('0x65')](_0xf80b('0x66'),'ut',_0xf80b('0x67'))[_0xf80b('0x26')]('OpenchannelQueueId\x20=\x20?',_0x2b13dc[_0xf80b('0x3f')]['id']);for(var _0x2a2a2b=0x0;_0x2a2a2b<_0x3ecdb0['length'];_0x2a2a2b+=0x1){let _0x1a1c26=_0x3ecdb0[_0x2a2a2b];for(var _0x23c095=0x0;_0x23c095<_0x1a1c26[_0xf80b('0x58')][_0xf80b('0x32')];_0x23c095+=0x1){let _0xbe24f2=_0x1a1c26[_0xf80b('0x58')][_0x23c095];var _0x4ce95f=_0x25e06c[_0xf80b('0x68')]();_0x4ce95f['where'](_0xf80b('0x69'),_0xbe24f2['id']);_0x1e8ea2[_0xf80b('0x6a')](db[_0xf80b('0x5a')]['query'](_0x4ce95f[_0xf80b('0x6b')](),{'type':db[_0xf80b('0x5a')][_0xf80b('0x6c')][_0xf80b('0x6d')]})[_0xf80b('0x1a')](function(_0x342193){if(_0x342193['length']===0x1){return _0xbe24f2['id'];}else{var _0x2bc855=_['every'](_['map'](_0x342193,'TeamId'),function(_0x851c50){return _[_0xf80b('0x6e')](_0x55ed2f,_0x851c50);});if(_0x2bc855){return _0xbe24f2['id'];}}}));}}return BPromise[_0xf80b('0x6f')](_0x1e8ea2)[_0xf80b('0x1a')](function(_0xd11d9a){_0x840308=_(_0x840308)[_0xf80b('0x70')](_0xd11d9a)[_0xf80b('0x71')]()[_0xf80b('0x72')]();return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2b13dc['params']['id']}})[_0xf80b('0x1a')](function(_0x146438){return db[_0xf80b('0x5a')]['transaction'](function(_0x53123f){return _0x146438[_0xf80b('0x60')](_0x2b13dc['query']['ids'],{'transaction':_0x53123f})[_0xf80b('0x1a')](function(){if(!_[_0xf80b('0x73')](_0x840308)){return _0x146438[_0xf80b('0x74')](_0x840308,{'transaction':_0x53123f});}})['then'](function(){_0x840308[_0xf80b('0x5d')](function(_0x36a07b){socket[_0xf80b('0x5e')](_0xf80b('0x75'),{'UserId':_0x36a07b,'OpenchannelQueueId':_0x146438['id']});});});});});});})[_0xf80b('0x1a')](respondWithStatusCode(_0x41a03f,null))[_0xf80b('0x2b')](handleError(_0x41a03f,null));};exports[_0xf80b('0x76')]=function(_0x460f1a,_0xc4ba6d){return db['OpenchannelQueue']['find']({'where':{'id':_0x460f1a[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc4ba6d,null))[_0xf80b('0x1a')](function(_0x278ff0){if(_0x278ff0){return _0x278ff0[_0xf80b('0x76')](_0x460f1a[_0xf80b('0x36')][_0xf80b('0x61')],_[_0xf80b('0x77')](_0x460f1a[_0xf80b('0x36')],[_0xf80b('0x61'),'id'])||{})[_0xf80b('0x78')](function(_0x2b5d3e){for(var _0x3b0084=0x0;_0x3b0084<_0x460f1a['body'][_0xf80b('0x61')]['length'];_0x3b0084+=0x1){socket[_0xf80b('0x5e')](_0xf80b('0x5f'),{'UserId':Number(_0x460f1a[_0xf80b('0x36')][_0xf80b('0x61')][_0x3b0084]),'OpenchannelQueueId':Number(_0x460f1a[_0xf80b('0x3f')]['id'])});}return _0x2b5d3e;});}})['then'](respondWithResult(_0xc4ba6d,null))[_0xf80b('0x2b')](handleError(_0xc4ba6d,null));};exports[_0xf80b('0x74')]=function(_0x2f900a,_0x2f9c5c){return db[_0xf80b('0x21')][_0xf80b('0x3a')]({'where':{'id':_0x2f900a[_0xf80b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f9c5c,null))[_0xf80b('0x1a')](function(_0x2bbef9){if(_0x2bbef9){return _0x2bbef9['removeAgents'](_0x2f900a[_0xf80b('0x28')][_0xf80b('0x61')])[_0xf80b('0x1a')](function(){if(_['isArray'](_0x2f900a['query'][_0xf80b('0x61')])){for(var _0x1997c0=0x0;_0x1997c0<_0x2f900a[_0xf80b('0x28')][_0xf80b('0x61')][_0xf80b('0x32')];_0x1997c0+=0x1){socket[_0xf80b('0x5e')](_0xf80b('0x75'),{'UserId':Number(_0x2f900a['query']['ids'][_0x1997c0]),'OpenchannelQueueId':Number(_0x2f900a[_0xf80b('0x3f')]['id'])});}}else{socket[_0xf80b('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2f900a['query'][_0xf80b('0x61')]),'OpenchannelQueueId':Number(_0x2f900a['params']['id'])});}});}})[_0xf80b('0x1a')](respondWithStatusCode(_0x2f9c5c,null))['catch'](handleError(_0x2f9c5c,null));};exports['getAgents']=function(_0xee3957,_0x3b98df){var _0x2f0948={};var _0x42cef6={};var _0x5361af;var _0xe4973d;return db[_0xf80b('0x21')]['findOne']({'where':{'id':_0xee3957['params']['id']}})[_0xf80b('0x1a')](handleEntityNotFound(_0x3b98df,null))[_0xf80b('0x1a')](function(_0x5f1a26){if(_0x5f1a26){_0x5361af=_0x5f1a26;_0x42cef6['model']=_[_0xf80b('0x2d')](db[_0xf80b('0x4d')][_0xf80b('0x2e')]);_0x42cef6[_0xf80b('0x28')]=_[_0xf80b('0x2d')](_0xee3957['query']);_0x42cef6[_0xf80b('0x49')]=_['intersection'](_0x42cef6[_0xf80b('0x2c')],_0x42cef6[_0xf80b('0x28')]);_0x2f0948['attributes']=_[_0xf80b('0x30')](_0x42cef6['model'],qs[_0xf80b('0x31')](_0xee3957['query']['fields']));_0x2f0948[_0xf80b('0x2f')]=_0x2f0948[_0xf80b('0x2f')][_0xf80b('0x32')]?_0x2f0948[_0xf80b('0x2f')]:_0x42cef6['model'];_0x2f0948[_0xf80b('0x46')]=qs['sort'](_0xee3957[_0xf80b('0x28')][_0xf80b('0x47')]);_0x2f0948[_0xf80b('0x26')]=qs['filters'](_[_0xf80b('0x48')](_0xee3957['query'],_0x42cef6['filters']));if(_0xee3957[_0xf80b('0x28')]['filter']){_0x2f0948[_0xf80b('0x26')]=_[_0xf80b('0x33')](_0x2f0948[_0xf80b('0x26')],{'$or':_[_0xf80b('0x4c')](_0x2f0948['attributes'],function(_0x28572d){var _0x228b76={};_0x228b76[_0x28572d]={'$like':'%'+_0xee3957[_0xf80b('0x28')]['filter']+'%'};return _0x228b76;})});}_0x2f0948=_[_0xf80b('0x33')]({},_0x2f0948,_0xee3957['options']);return _0x5361af[_0xf80b('0x79')](_0x2f0948);}})['then'](function(_0x15528b){if(_0x15528b){_0xe4973d=_0x15528b['length'];if(!_0xee3957[_0xf80b('0x28')]['hasOwnProperty'](_0xf80b('0x45'))){_0x2f0948[_0xf80b('0x15')]=qs[_0xf80b('0x15')](_0xee3957['query'][_0xf80b('0x15')]);_0x2f0948[_0xf80b('0x13')]=qs[_0xf80b('0x13')](_0xee3957[_0xf80b('0x28')]['offset']);}return _0x5361af[_0xf80b('0x79')](_0x2f0948);}})[_0xf80b('0x1a')](function(_0x4002c0){if(_0x4002c0){return _0x4002c0?{'count':_0xe4973d,'rows':_0x4002c0}:null;}})[_0xf80b('0x1a')](respondWithResult(_0x3b98df,null))['catch'](handleError(_0x3b98df,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3317fe2..1c3aebb 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 _0x364d=['hook','../../mysqldb','OpenchannelQueue','save','update','emit'];(function(_0x40e0d0,_0x41b879){var _0x47efab=function(_0xbc1a23){while(--_0xbc1a23){_0x40e0d0['push'](_0x40e0d0['shift']());}};_0x47efab(++_0x41b879);}(_0x364d,0xc7));var _0xd364=function(_0x577d1f,_0x10e850){_0x577d1f=_0x577d1f-0x0;var _0x582290=_0x364d[_0x577d1f];return _0x582290;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xd364('0x0'))['db'][_0xd364('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd364('0x2'),'afterUpdate':_0xd364('0x3'),'afterDestroy':'remove'};function emitEvent(_0x287f1f){return function(_0x1c8d98,_0x1cf412,_0x52deb6){OpenchannelQueueEvents[_0xd364('0x4')](_0x287f1f+':'+_0x1c8d98['id'],_0x1c8d98);OpenchannelQueueEvents[_0xd364('0x4')](_0x287f1f,_0x1c8d98);_0x52deb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd364('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x6785=['exports','events','../../mysqldb','OpenchannelQueue','remove','emit','hasOwnProperty'];(function(_0xcf97f3,_0x50c3e8){var _0x176ae2=function(_0x1ed524){while(--_0x1ed524){_0xcf97f3['push'](_0xcf97f3['shift']());}};_0x176ae2(++_0x50c3e8);}(_0x6785,0x1c8));var _0x5678=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6785[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0x5678('0x0'));var OpenchannelQueue=require(_0x5678('0x1'))['db'][_0x5678('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5678('0x3')};function emitEvent(_0x2e4a04){return function(_0xd61888,_0x1e220d,_0x1edba4){OpenchannelQueueEvents[_0x5678('0x4')](_0x2e4a04+':'+_0xd61888['id'],_0xd61888);OpenchannelQueueEvents[_0x5678('0x4')](_0x2e4a04,_0xd61888);_0x1edba4(null);};}for(var e in events){if(events[_0x5678('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5678('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f036945..027210e 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 _0xe092=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues'];(function(_0x3cb896,_0x208768){var _0x110050=function(_0x1526e2){while(--_0x1526e2){_0x3cb896['push'](_0x3cb896['shift']());}};_0x110050(++_0x208768);}(_0xe092,0x1a4));var _0x2e09=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xe092[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x2e09('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e09('0x1'));var moment=require(_0x2e09('0x2'));var BPromise=require(_0x2e09('0x3'));var rp=require(_0x2e09('0x4'));var fs=require('fs');var path=require(_0x2e09('0x5'));var rimraf=require(_0x2e09('0x6'));var config=require(_0x2e09('0x7'));var attributes=require(_0x2e09('0x8'));module[_0x2e09('0x9')]=function(_0x2d3afe,_0x42c09a){return _0x2d3afe[_0x2e09('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x2e09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9edc=['OpenchannelQueue','lodash','util','api','moment','bluebird','path','../../config/environment','./openchannelQueue.attributes','define'];(function(_0x1d5450,_0x57ed0b){var _0x216cc7=function(_0x5be307){while(--_0x5be307){_0x1d5450['push'](_0x1d5450['shift']());}};_0x216cc7(++_0x57ed0b);}(_0x9edc,0x79));var _0xc9ed=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x9edc[_0x2aa48b];return _0x48caf8;};'use strict';var _=require(_0xc9ed('0x0'));var util=require(_0xc9ed('0x1'));var logger=require('../../config/logger')(_0xc9ed('0x2'));var moment=require(_0xc9ed('0x3'));var BPromise=require(_0xc9ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9ed('0x5'));var rimraf=require('rimraf');var config=require(_0xc9ed('0x6'));var attributes=require(_0xc9ed('0x7'));module['exports']=function(_0x4ebf30,_0x13375b){return _0x4ebf30[_0xc9ed('0x8')](_0xc9ed('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e1bb3b1..7fffa04 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 _0x304c=['defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','OpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0xd6e0ed,_0x50bf47){var _0x5b5903=function(_0x478688){while(--_0x478688){_0xd6e0ed['push'](_0xd6e0ed['shift']());}};_0x5b5903(++_0x50bf47);}(_0x304c,0x127));var _0xc304=function(_0x45f5bb,_0x57b1dc){_0x45f5bb=_0x45f5bb-0x0;var _0x16175e=_0x304c[_0x45f5bb];return _0x16175e;};'use strict';var _=require(_0xc304('0x0'));var util=require(_0xc304('0x1'));var moment=require(_0xc304('0x2'));var BPromise=require(_0xc304('0x3'));var rs=require(_0xc304('0x4'));var fs=require('fs');var Redis=require(_0xc304('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc304('0x6'));var logger=require(_0xc304('0x7'))(_0xc304('0x8'));var config=require('../../config/environment');var jayson=require(_0xc304('0x9'));var client=jayson[_0xc304('0xa')][_0xc304('0xb')]({'port':0x232a});config[_0xc304('0xc')]=_[_0xc304('0xd')](config[_0xc304('0xc')],{'host':_0xc304('0xe'),'port':0x18eb});var socket=require(_0xc304('0xf'))(new Redis(config[_0xc304('0xc')]));require(_0xc304('0x10'))[_0xc304('0x11')](socket);function respondWithRpcPromise(_0x296e2f,_0x209a36,_0x239d19){return new BPromise(function(_0x2e1c9c,_0x5868c5){return client[_0xc304('0x12')](_0x296e2f,_0x239d19)[_0xc304('0x13')](function(_0xf38727){logger[_0xc304('0x14')](_0xc304('0x15'),_0x209a36,_0xc304('0x16'));logger[_0xc304('0x17')](_0xc304('0x18'),_0x209a36,_0xc304('0x16'),JSON['stringify'](_0xf38727));if(_0xf38727[_0xc304('0x19')]){if(_0xf38727[_0xc304('0x19')][_0xc304('0x1a')]===0x1f4){logger[_0xc304('0x19')](_0xc304('0x15'),_0x209a36,_0xf38727[_0xc304('0x19')][_0xc304('0x1b')]);return _0x5868c5(_0xf38727[_0xc304('0x19')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x209a36,_0xf38727['error'][_0xc304('0x1b')]);return _0x2e1c9c(_0xf38727['error']['message']);}else{logger[_0xc304('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x209a36,_0xc304('0x16'));_0x2e1c9c(_0xf38727[_0xc304('0x1c')][_0xc304('0x1b')]);}})[_0xc304('0x1d')](function(_0x1b679a){logger[_0xc304('0x19')](_0xc304('0x15'),_0x209a36,_0x1b679a);_0x5868c5(_0x1b679a);});});}exports[_0xc304('0x1e')]=function(_0x39c1e1){var _0xaa7411=this;return new Promise(function(_0x5cbd89,_0x3156d2){return db['OpenchannelQueue'][_0xc304('0x1f')]({'raw':_0x39c1e1['options']?_0x39c1e1[_0xc304('0x20')][_0xc304('0x21')]===undefined?!![]:![]:!![],'where':_0x39c1e1['options']?_0x39c1e1['options']['where']||null:null,'attributes':_0x39c1e1['options']?_0x39c1e1[_0xc304('0x20')][_0xc304('0x22')]||null:null,'limit':_0x39c1e1[_0xc304('0x20')]?_0x39c1e1[_0xc304('0x20')][_0xc304('0x23')]||null:null,'include':_0x39c1e1[_0xc304('0x20')]?_0x39c1e1['options'][_0xc304('0x24')]?_[_0xc304('0x25')](_0x39c1e1[_0xc304('0x20')][_0xc304('0x24')],function(_0x2887bf){return{'model':db[_0x2887bf['model']],'as':_0x2887bf['as'],'attributes':_0x2887bf[_0xc304('0x22')],'include':_0x2887bf[_0xc304('0x24')]?_['map'](_0x2887bf[_0xc304('0x24')],function(_0x2428a4){return{'model':db[_0x2428a4['model']],'as':_0x2428a4['as'],'attributes':_0x2428a4[_0xc304('0x22')],'include':_0x2428a4[_0xc304('0x24')]?_[_0xc304('0x25')](_0x2428a4['include'],function(_0x16ccf5){return{'model':db[_0x16ccf5[_0xc304('0x26')]],'as':_0x16ccf5['as'],'attributes':_0x16ccf5[_0xc304('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc304('0x13')](function(_0x564175){logger[_0xc304('0x14')](_0xc304('0x1e'),_0x39c1e1);logger['debug'](_0xc304('0x1e'),_0x39c1e1,JSON[_0xc304('0x27')](_0x564175));_0x5cbd89(_0x564175);})[_0xc304('0x1d')](function(_0x3e6156){logger[_0xc304('0x19')](_0xc304('0x1e'),_0x3e6156[_0xc304('0x1b')],_0x39c1e1);_0x3156d2(_0xaa7411[_0xc304('0x19')](0x1f4,_0x3e6156[_0xc304('0x1b')]));});});};exports[_0xc304('0x28')]=function(_0x56487a){var _0x1b7c5f=this;return new Promise(function(_0x2da8b2,_0x313293){return db[_0xc304('0x29')][_0xc304('0x2a')]({'raw':_0x56487a['options']?_0x56487a[_0xc304('0x20')][_0xc304('0x21')]===undefined?!![]:![]:!![],'where':_0x56487a['options']?_0x56487a['options'][_0xc304('0x2b')]||null:null,'attributes':_0x56487a['options']?_0x56487a[_0xc304('0x20')][_0xc304('0x22')]||null:null,'include':_0x56487a[_0xc304('0x20')]?_0x56487a['options'][_0xc304('0x24')]?_[_0xc304('0x25')](_0x56487a['options'][_0xc304('0x24')],function(_0x5cd55e){return{'model':db[_0x5cd55e[_0xc304('0x26')]],'as':_0x5cd55e['as'],'attributes':_0x5cd55e[_0xc304('0x22')],'include':_0x5cd55e[_0xc304('0x24')]?_[_0xc304('0x25')](_0x5cd55e['include'],function(_0x3760c4){return{'model':db[_0x3760c4['model']],'as':_0x3760c4['as'],'attributes':_0x3760c4[_0xc304('0x22')],'include':_0x3760c4['include']?_[_0xc304('0x25')](_0x3760c4[_0xc304('0x24')],function(_0x38f32d){return{'model':db[_0x38f32d[_0xc304('0x26')]],'as':_0x38f32d['as'],'attributes':_0x38f32d[_0xc304('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x313ef1){logger[_0xc304('0x14')]('ShowOpenchannelQueue',_0x56487a);logger[_0xc304('0x17')]('ShowOpenchannelQueue',_0x56487a,JSON[_0xc304('0x27')](_0x313ef1));_0x2da8b2(_0x313ef1);})[_0xc304('0x1d')](function(_0x281303){logger[_0xc304('0x19')](_0xc304('0x28'),_0x281303[_0xc304('0x1b')],_0x56487a);_0x313293(_0x1b7c5f['error'](0x1f4,_0x281303[_0xc304('0x1b')]));});});}; \ No newline at end of file +var _0x43e4=['client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ac722,_0x144fd5){var _0x4d7380=function(_0x5a6781){while(--_0x5a6781){_0x4ac722['push'](_0x4ac722['shift']());}};_0x4d7380(++_0x144fd5);}(_0x43e4,0xe7));var _0x443e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x43e4[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x443e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x443e('0x1'));var rs=require(_0x443e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x443e('0x3'))['db'];var utils=require(_0x443e('0x4'));var logger=require(_0x443e('0x5'))(_0x443e('0x6'));var config=require(_0x443e('0x7'));var jayson=require(_0x443e('0x8'));var client=jayson[_0x443e('0x9')][_0x443e('0xa')]({'port':0x232a});config[_0x443e('0xb')]=_['defaults'](config['redis'],{'host':_0x443e('0xc'),'port':0x18eb});var socket=require(_0x443e('0xd'))(new Redis(config['redis']));require(_0x443e('0xe'))[_0x443e('0xf')](socket);function respondWithRpcPromise(_0x590296,_0x109f9c,_0x1c8c51){return new BPromise(function(_0x230c56,_0x304e39){return client[_0x443e('0x10')](_0x590296,_0x1c8c51)[_0x443e('0x11')](function(_0x16ecf9){logger[_0x443e('0x12')](_0x443e('0x13'),_0x109f9c,_0x443e('0x14'));logger[_0x443e('0x15')](_0x443e('0x16'),_0x109f9c,_0x443e('0x14'),JSON[_0x443e('0x17')](_0x16ecf9));if(_0x16ecf9[_0x443e('0x18')]){if(_0x16ecf9['error']['code']===0x1f4){logger[_0x443e('0x18')](_0x443e('0x13'),_0x109f9c,_0x16ecf9[_0x443e('0x18')][_0x443e('0x19')]);return _0x304e39(_0x16ecf9[_0x443e('0x18')]['message']);}logger[_0x443e('0x18')](_0x443e('0x13'),_0x109f9c,_0x16ecf9['error'][_0x443e('0x19')]);return _0x230c56(_0x16ecf9[_0x443e('0x18')][_0x443e('0x19')]);}else{logger[_0x443e('0x12')](_0x443e('0x13'),_0x109f9c,_0x443e('0x14'));_0x230c56(_0x16ecf9['result']['message']);}})[_0x443e('0x1a')](function(_0x4617c5){logger[_0x443e('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x109f9c,_0x4617c5);_0x304e39(_0x4617c5);});});}exports[_0x443e('0x1b')]=function(_0x3a20db){var _0x3a8f60=this;return new Promise(function(_0x1efedf,_0x800fdf){return db['OpenchannelQueue'][_0x443e('0x1c')]({'raw':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a20db['options']?_0x3a20db[_0x443e('0x1d')][_0x443e('0x1f')]||null:null,'attributes':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x20')]||null:null,'limit':_0x3a20db['options']?_0x3a20db[_0x443e('0x1d')][_0x443e('0x21')]||null:null,'include':_0x3a20db[_0x443e('0x1d')]?_0x3a20db[_0x443e('0x1d')][_0x443e('0x22')]?_[_0x443e('0x23')](_0x3a20db[_0x443e('0x1d')][_0x443e('0x22')],function(_0x49dd53){return{'model':db[_0x49dd53[_0x443e('0x24')]],'as':_0x49dd53['as'],'attributes':_0x49dd53[_0x443e('0x20')],'include':_0x49dd53[_0x443e('0x22')]?_['map'](_0x49dd53[_0x443e('0x22')],function(_0x533363){return{'model':db[_0x533363[_0x443e('0x24')]],'as':_0x533363['as'],'attributes':_0x533363[_0x443e('0x20')],'include':_0x533363[_0x443e('0x22')]?_[_0x443e('0x23')](_0x533363['include'],function(_0xbc9dcc){return{'model':db[_0xbc9dcc[_0x443e('0x24')]],'as':_0xbc9dcc['as'],'attributes':_0xbc9dcc['attributes']};}):[]};}):[]};}):[]:[]})[_0x443e('0x11')](function(_0x465ae7){logger['info']('GetOpenchannelQueue',_0x3a20db);logger[_0x443e('0x15')](_0x443e('0x1b'),_0x3a20db,JSON[_0x443e('0x17')](_0x465ae7));_0x1efedf(_0x465ae7);})[_0x443e('0x1a')](function(_0xed347b){logger[_0x443e('0x18')](_0x443e('0x1b'),_0xed347b[_0x443e('0x19')],_0x3a20db);_0x800fdf(_0x3a8f60[_0x443e('0x18')](0x1f4,_0xed347b[_0x443e('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x14fe84){var _0x2dd167=this;return new Promise(function(_0x3ab0e5,_0x5c959d){return db[_0x443e('0x25')][_0x443e('0x26')]({'raw':_0x14fe84['options']?_0x14fe84['options'][_0x443e('0x1e')]===undefined?!![]:![]:!![],'where':_0x14fe84[_0x443e('0x1d')]?_0x14fe84[_0x443e('0x1d')][_0x443e('0x1f')]||null:null,'attributes':_0x14fe84[_0x443e('0x1d')]?_0x14fe84[_0x443e('0x1d')][_0x443e('0x20')]||null:null,'include':_0x14fe84['options']?_0x14fe84[_0x443e('0x1d')][_0x443e('0x22')]?_[_0x443e('0x23')](_0x14fe84['options'][_0x443e('0x22')],function(_0x1b38d){return{'model':db[_0x1b38d['model']],'as':_0x1b38d['as'],'attributes':_0x1b38d[_0x443e('0x20')],'include':_0x1b38d[_0x443e('0x22')]?_['map'](_0x1b38d[_0x443e('0x22')],function(_0x1fc9ed){return{'model':db[_0x1fc9ed[_0x443e('0x24')]],'as':_0x1fc9ed['as'],'attributes':_0x1fc9ed['attributes'],'include':_0x1fc9ed[_0x443e('0x22')]?_[_0x443e('0x23')](_0x1fc9ed['include'],function(_0x269854){return{'model':db[_0x269854[_0x443e('0x24')]],'as':_0x269854['as'],'attributes':_0x269854['attributes']};}):[]};}):[]};}):[]:[]})[_0x443e('0x11')](function(_0x112db5){logger['info'](_0x443e('0x27'),_0x14fe84);logger['debug']('ShowOpenchannelQueue',_0x14fe84,JSON[_0x443e('0x17')](_0x112db5));_0x3ab0e5(_0x112db5);})['catch'](function(_0x4e2746){logger[_0x443e('0x18')]('ShowOpenchannelQueue',_0x4e2746[_0x443e('0x19')],_0x14fe84);_0x5c959d(_0x2dd167['error'](0x1f4,_0x4e2746[_0x443e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f20778d..1a9d185 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 _0x1f64=['openchannelQueue:','./openchannelQueue.events','save','update','emit','register','length'];(function(_0x523cc7,_0x34b3d0){var _0x268b8b=function(_0x26d073){while(--_0x26d073){_0x523cc7['push'](_0x523cc7['shift']());}};_0x268b8b(++_0x34b3d0);}(_0x1f64,0xfd));var _0x41f6=function(_0x22d29d,_0x3cf5f6){_0x22d29d=_0x22d29d-0x0;var _0x9bb0f7=_0x1f64[_0x22d29d];return _0x9bb0f7;};'use strict';var OpenchannelQueueEvents=require(_0x41f6('0x0'));var events=[_0x41f6('0x1'),'remove',_0x41f6('0x2')];function createListener(_0x48a6b8,_0x42f65c){return function(_0x5a85ed){_0x42f65c[_0x41f6('0x3')](_0x48a6b8,_0x5a85ed);};}function removeListener(_0x4cb5ae,_0x4c83fb){return function(){OpenchannelQueueEvents['removeListener'](_0x4cb5ae,_0x4c83fb);};}exports[_0x41f6('0x4')]=function(_0x3f3576){for(var _0x155967=0x0,_0x2a5f45=events[_0x41f6('0x5')];_0x155967<_0x2a5f45;_0x155967++){var _0x4ab123=events[_0x155967];var _0xde7f0b=createListener(_0x41f6('0x6')+_0x4ab123,_0x3f3576);OpenchannelQueueEvents['on'](_0x4ab123,_0xde7f0b);}}; \ No newline at end of file +var _0x6ccf=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','emit'];(function(_0x210be7,_0x7872f6){var _0x1566ba=function(_0xca934f){while(--_0xca934f){_0x210be7['push'](_0x210be7['shift']());}};_0x1566ba(++_0x7872f6);}(_0x6ccf,0x1d8));var _0xf6cc=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x6ccf[_0x5cc8];return _0x450661;};'use strict';var OpenchannelQueueEvents=require(_0xf6cc('0x0'));var events=['save','remove','update'];function createListener(_0x11a59a,_0xe81b0d){return function(_0x463ff){_0xe81b0d[_0xf6cc('0x1')](_0x11a59a,_0x463ff);};}function removeListener(_0x27f842,_0x1f9acc){return function(){OpenchannelQueueEvents[_0xf6cc('0x2')](_0x27f842,_0x1f9acc);};}exports[_0xf6cc('0x3')]=function(_0x2f8d2c){for(var _0x315155=0x0,_0x196e52=events[_0xf6cc('0x4')];_0x315155<_0x196e52;_0x315155++){var _0x29f251=events[_0x315155];var _0x20bdd6=createListener(_0xf6cc('0x5')+_0x29f251,_0x2f8d2c);OpenchannelQueueEvents['on'](_0x29f251,_0x20bdd6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9f8b7ac..351f112 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 _0x9d68=['Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x9d68,0x140));var _0x89d6=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0x9d68[_0x19691f];return _0x5677b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x89d6('0x0'));var timeout=require(_0x89d6('0x1'));var express=require(_0x89d6('0x2'));var router=express[_0x89d6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89d6('0x4'));var interaction=require(_0x89d6('0x5'));var config=require('../../config/environment');var controller=require(_0x89d6('0x6'));router[_0x89d6('0x7')]('/',auth[_0x89d6('0x8')](),controller[_0x89d6('0x9')]);router[_0x89d6('0x7')](_0x89d6('0xa'),auth[_0x89d6('0x8')](),controller['describe']);router[_0x89d6('0x7')](_0x89d6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x89d6('0xc')]('/',auth[_0x89d6('0x8')](),controller[_0x89d6('0xd')]);router[_0x89d6('0xe')]('/:id',auth[_0x89d6('0x8')](),controller[_0x89d6('0xf')]);router[_0x89d6('0x10')](_0x89d6('0xb'),auth[_0x89d6('0x8')](),controller[_0x89d6('0x11')]);module[_0x89d6('0x12')]=router; \ No newline at end of file +var _0x8ac4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5ef1d3,_0x1feca1){var _0x3c990e=function(_0x589ba6){while(--_0x589ba6){_0x5ef1d3['push'](_0x5ef1d3['shift']());}};_0x3c990e(++_0x1feca1);}(_0x8ac4,0x19b));var _0x48ac=function(_0x26a93a,_0x56509f){_0x26a93a=_0x26a93a-0x0;var _0x38b4b3=_0x8ac4[_0x26a93a];return _0x38b4b3;};'use strict';var multer=require(_0x48ac('0x0'));var util=require(_0x48ac('0x1'));var path=require(_0x48ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x48ac('0x3'));var router=express[_0x48ac('0x4')]();var fs_extra=require(_0x48ac('0x5'));var auth=require(_0x48ac('0x6'));var interaction=require(_0x48ac('0x7'));var config=require(_0x48ac('0x8'));var controller=require(_0x48ac('0x9'));router[_0x48ac('0xa')]('/',auth[_0x48ac('0xb')](),controller[_0x48ac('0xc')]);router[_0x48ac('0xa')](_0x48ac('0xd'),auth[_0x48ac('0xb')](),controller['describe']);router[_0x48ac('0xa')](_0x48ac('0xe'),auth[_0x48ac('0xb')](),controller[_0x48ac('0xf')]);router[_0x48ac('0x10')]('/',auth[_0x48ac('0xb')](),controller[_0x48ac('0x11')]);router[_0x48ac('0x12')](_0x48ac('0xe'),auth['isAuthenticated'](),controller[_0x48ac('0x13')]);router[_0x48ac('0x14')](_0x48ac('0xe'),auth[_0x48ac('0xb')](),controller[_0x48ac('0x15')]);module[_0x48ac('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6557163..34c7752 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 _0x6636=['moment','exports','STRING','DATE'];(function(_0x276003,_0x3050c2){var _0x5b95ac=function(_0x44e6c8){while(--_0x44e6c8){_0x276003['push'](_0x276003['shift']());}};_0x5b95ac(++_0x3050c2);}(_0x6636,0x1d4));var _0x6663=function(_0x2212ba,_0x546891){_0x2212ba=_0x2212ba-0x0;var _0x29a77f=_0x6636[_0x2212ba];return _0x29a77f;};'use strict';var moment=require(_0x6663('0x0'));var Sequelize=require('sequelize');module[_0x6663('0x1')]={'uniqueid':{'type':Sequelize[_0x6663('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6663('0x2')]},'joinAt':{'type':Sequelize[_0x6663('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6663('0x3')]},'reason':{'type':Sequelize[_0x6663('0x2')]}}; \ No newline at end of file +var _0x2598=['DATE','moment','sequelize','exports','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2598,0xba));var _0x8259=function(_0x3a51f0,_0x84e1c7){_0x3a51f0=_0x3a51f0-0x0;var _0x11c7c8=_0x2598[_0x3a51f0];return _0x11c7c8;};'use strict';var moment=require(_0x8259('0x0'));var Sequelize=require(_0x8259('0x1'));module[_0x8259('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8259('0x3')]},'joinAt':{'type':Sequelize[_0x8259('0x4')]},'leaveAt':{'type':Sequelize[_0x8259('0x4')]},'acceptAt':{'type':Sequelize[_0x8259('0x4')]},'exitAt':{'type':Sequelize[_0x8259('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index eb6c8a7..42d3f3c 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 _0xa71b=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','rows','catch','show','keys','includeAll','include','create','body','find','params','describe','eml-format','request-promise','moment','mustache','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa71b,0xfa));var _0xba71=function(_0x10a0ed,_0x25c843){_0x10a0ed=_0x10a0ed-0x0;var _0x3e4283=_0xa71b[_0x10a0ed];return _0x3e4283;};'use strict';var emlformat=require(_0xba71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xba71('0x1'));var moment=require(_0xba71('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xba71('0x3'));var util=require(_0xba71('0x4'));var path=require(_0xba71('0x5'));var sox=require('sox');var csv=require(_0xba71('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba71('0x7'));var _=require(_0xba71('0x8'));var squel=require(_0xba71('0x9'));var crypto=require(_0xba71('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba71('0xb'));var toCsv=require(_0xba71('0x6'));var querystring=require('querystring');var Papa=require(_0xba71('0xc'));var Redis=require(_0xba71('0xd'));var authService=require(_0xba71('0xe'));var qs=require(_0xba71('0xf'));var as=require(_0xba71('0x10'));var hardwareService=require(_0xba71('0x11'));var logger=require(_0xba71('0x12'))(_0xba71('0x13'));var utils=require(_0xba71('0x14'));var config=require(_0xba71('0x15'));var licenseUtil=require(_0xba71('0x16'));var db=require(_0xba71('0x17'))['db'];function respondWithStatusCode(_0x1e0ee8,_0xfab521){_0xfab521=_0xfab521||0xcc;return function(_0x10e62f){if(_0x10e62f){return _0x1e0ee8[_0xba71('0x18')](_0xfab521);}return _0x1e0ee8[_0xba71('0x19')](_0xfab521)['end']();};}function respondWithResult(_0x2236d7,_0x3ea59c){_0x3ea59c=_0x3ea59c||0xc8;return function(_0x481ce6){if(_0x481ce6){return _0x2236d7[_0xba71('0x19')](_0x3ea59c)[_0xba71('0x1a')](_0x481ce6);}};}function respondWithFilteredResult(_0x31993b,_0x51d8a7){return function(_0x4aecea){if(_0x4aecea){var _0x1ab531=typeof _0x51d8a7[_0xba71('0x1b')]==='undefined'&&typeof _0x51d8a7[_0xba71('0x1c')]==='undefined';var _0x2c833c=_0x4aecea[_0xba71('0x1d')];var _0x189a6c=_0x1ab531?0x0:_0x51d8a7[_0xba71('0x1b')];var _0x3a81db=_0x1ab531?_0x4aecea[_0xba71('0x1d')]:_0x51d8a7['offset']+_0x51d8a7['limit'];var _0x43ef46;if(_0x3a81db>=_0x2c833c){_0x3a81db=_0x2c833c;_0x43ef46=0xc8;}else{_0x43ef46=0xce;}_0x31993b[_0xba71('0x19')](_0x43ef46);return _0x31993b['set'](_0xba71('0x1e'),_0x189a6c+'-'+_0x3a81db+'/'+_0x2c833c)[_0xba71('0x1a')](_0x4aecea);}return null;};}function patchUpdates(_0x3e2bb1){return function(_0x4e8ba5){try{jsonpatch[_0xba71('0x1f')](_0x4e8ba5,_0x3e2bb1,!![]);}catch(_0x56db52){return BPromise[_0xba71('0x20')](_0x56db52);}return _0x4e8ba5[_0xba71('0x21')]();};}function saveUpdates(_0x3f4ed0,_0x17bcad){return function(_0x5dd8f1){if(_0x5dd8f1){return _0x5dd8f1[_0xba71('0x22')](_0x3f4ed0)[_0xba71('0x23')](function(_0x32cbd0){return _0x32cbd0;});}return null;};}function removeEntity(_0x31a2a6,_0x509901){return function(_0x3e9bca){if(_0x3e9bca){return _0x3e9bca[_0xba71('0x24')]()[_0xba71('0x23')](function(){_0x31a2a6[_0xba71('0x19')](0xcc)[_0xba71('0x25')]();});}};}function handleEntityNotFound(_0x314dd8,_0x4778e7){return function(_0x5f4155){if(!_0x5f4155){_0x314dd8[_0xba71('0x18')](0x194);}return _0x5f4155;};}function handleError(_0x263079,_0x1569a4){_0x1569a4=_0x1569a4||0x1f4;return function(_0x42c060){logger[_0xba71('0x26')](_0x42c060[_0xba71('0x27')]);if(_0x42c060[_0xba71('0x28')]){delete _0x42c060[_0xba71('0x28')];}_0x263079[_0xba71('0x19')](_0x1569a4)[_0xba71('0x29')](_0x42c060);};}exports[_0xba71('0x2a')]=function(_0x129770,_0x35ddba){var _0x5173e7={},_0x41c324={},_0xa17006={'count':0x0,'rows':[]};var _0x674de1=_[_0xba71('0x2b')](db[_0xba71('0x2c')][_0xba71('0x2d')],function(_0x49cf07){return{'name':_0x49cf07[_0xba71('0x2e')],'type':_0x49cf07[_0xba71('0x2f')][_0xba71('0x30')]};});_0x41c324[_0xba71('0x31')]=_[_0xba71('0x2b')](_0x674de1,_0xba71('0x28'));_0x41c324[_0xba71('0x32')]=_['keys'](_0x129770[_0xba71('0x32')]);_0x41c324[_0xba71('0x33')]=_[_0xba71('0x34')](_0x41c324[_0xba71('0x31')],_0x41c324[_0xba71('0x32')]);_0x5173e7['attributes']=_[_0xba71('0x34')](_0x41c324[_0xba71('0x31')],qs[_0xba71('0x35')](_0x129770[_0xba71('0x32')][_0xba71('0x35')]));_0x5173e7['attributes']=_0x5173e7[_0xba71('0x36')][_0xba71('0x37')]?_0x5173e7[_0xba71('0x36')]:_0x41c324[_0xba71('0x31')];if(!_0x129770[_0xba71('0x32')][_0xba71('0x38')](_0xba71('0x39'))){_0x5173e7[_0xba71('0x1c')]=qs[_0xba71('0x1c')](_0x129770[_0xba71('0x32')][_0xba71('0x1c')]);_0x5173e7[_0xba71('0x1b')]=qs[_0xba71('0x1b')](_0x129770['query'][_0xba71('0x1b')]);}_0x5173e7[_0xba71('0x3a')]=qs[_0xba71('0x3b')](_0x129770[_0xba71('0x32')][_0xba71('0x3b')]);_0x5173e7[_0xba71('0x3c')]=qs[_0xba71('0x33')](_[_0xba71('0x3d')](_0x129770['query'],_0x41c324[_0xba71('0x33')]),_0x674de1);if(_0x129770[_0xba71('0x32')][_0xba71('0x3e')]){_0x5173e7['where']=_['merge'](_0x5173e7[_0xba71('0x3c')],{'$or':_[_0xba71('0x2b')](_0x674de1,function(_0x339cde){if(_0x339cde['type']!==_0xba71('0x3f')){var _0x17f507={};_0x17f507[_0x339cde[_0xba71('0x28')]]={'$like':'%'+_0x129770[_0xba71('0x32')][_0xba71('0x3e')]+'%'};return _0x17f507;}})});}_0x5173e7=_[_0xba71('0x40')]({},_0x5173e7,_0x129770['options']);var _0x173f39={'where':_0x5173e7['where']};return db['OpenchannelQueueReport']['count'](_0x173f39)[_0xba71('0x23')](function(_0x286360){_0xa17006[_0xba71('0x1d')]=_0x286360;if(_0x129770[_0xba71('0x32')]['includeAll']){_0x5173e7['include']=[{'all':!![]}];}return db[_0xba71('0x2c')]['findAll'](_0x5173e7);})[_0xba71('0x23')](function(_0x248803){_0xa17006[_0xba71('0x41')]=_0x248803;return _0xa17006;})[_0xba71('0x23')](respondWithFilteredResult(_0x35ddba,_0x5173e7))[_0xba71('0x42')](handleError(_0x35ddba,null));};exports[_0xba71('0x43')]=function(_0x4a5a90,_0x359a09){var _0x53e1ea={'raw':!![],'where':{'id':_0x4a5a90['params']['id']}},_0x550b5e={};_0x550b5e[_0xba71('0x31')]=_[_0xba71('0x44')](db['OpenchannelQueueReport'][_0xba71('0x2d')]);_0x550b5e[_0xba71('0x32')]=_[_0xba71('0x44')](_0x4a5a90[_0xba71('0x32')]);_0x550b5e['filters']=_[_0xba71('0x34')](_0x550b5e[_0xba71('0x31')],_0x550b5e[_0xba71('0x32')]);_0x53e1ea[_0xba71('0x36')]=_['intersection'](_0x550b5e[_0xba71('0x31')],qs[_0xba71('0x35')](_0x4a5a90[_0xba71('0x32')]['fields']));_0x53e1ea[_0xba71('0x36')]=_0x53e1ea['attributes'][_0xba71('0x37')]?_0x53e1ea[_0xba71('0x36')]:_0x550b5e[_0xba71('0x31')];if(_0x4a5a90['query'][_0xba71('0x45')]){_0x53e1ea[_0xba71('0x46')]=[{'all':!![]}];}_0x53e1ea=_['merge']({},_0x53e1ea,_0x4a5a90['options']);return db['OpenchannelQueueReport']['find'](_0x53e1ea)[_0xba71('0x23')](handleEntityNotFound(_0x359a09,null))['then'](respondWithResult(_0x359a09,null))[_0xba71('0x42')](handleError(_0x359a09,null));};exports[_0xba71('0x47')]=function(_0x19b6d3,_0x2f1a0c){return db[_0xba71('0x2c')]['create'](_0x19b6d3[_0xba71('0x48')],{})[_0xba71('0x23')](respondWithResult(_0x2f1a0c,0xc9))[_0xba71('0x42')](handleError(_0x2f1a0c,null));};exports[_0xba71('0x22')]=function(_0x32a674,_0x3b000c){if(_0x32a674[_0xba71('0x48')]['id']){delete _0x32a674[_0xba71('0x48')]['id'];}return db[_0xba71('0x2c')][_0xba71('0x49')]({'where':{'id':_0x32a674[_0xba71('0x4a')]['id']}})[_0xba71('0x23')](handleEntityNotFound(_0x3b000c,null))[_0xba71('0x23')](saveUpdates(_0x32a674[_0xba71('0x48')],null))[_0xba71('0x23')](respondWithResult(_0x3b000c,null))[_0xba71('0x42')](handleError(_0x3b000c,null));};exports[_0xba71('0x24')]=function(_0x3d1f3d,_0x1b178a){return db[_0xba71('0x2c')][_0xba71('0x49')]({'where':{'id':_0x3d1f3d[_0xba71('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b178a,null))[_0xba71('0x23')](removeEntity(_0x1b178a,null))['catch'](handleError(_0x1b178a,null));};exports[_0xba71('0x4b')]=function(_0x2793e6,_0x49e632){return db[_0xba71('0x2c')]['describe']()[_0xba71('0x23')](respondWithResult(_0x49e632,null))[_0xba71('0x42')](handleError(_0x49e632,null));}; \ No newline at end of file +var _0x0a87=['apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set'];(function(_0xaa9204,_0x163a47){var _0x1e39f8=function(_0x4737eb){while(--_0x4737eb){_0xaa9204['push'](_0xaa9204['shift']());}};_0x1e39f8(++_0x163a47);}(_0x0a87,0x196));var _0x70a8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a87[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x70a8('0x0'));var rimraf=require(_0x70a8('0x1'));var zipdir=require(_0x70a8('0x2'));var jsonpatch=require(_0x70a8('0x3'));var rp=require(_0x70a8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70a8('0x5'));var util=require(_0x70a8('0x6'));var path=require('path');var sox=require(_0x70a8('0x7'));var csv=require(_0x70a8('0x8'));var ejs=require(_0x70a8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70a8('0xa'));var squel=require(_0x70a8('0xb'));var crypto=require(_0x70a8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70a8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70a8('0xe'));var Papa=require(_0x70a8('0xf'));var Redis=require('ioredis');var authService=require(_0x70a8('0x10'));var qs=require(_0x70a8('0x11'));var as=require(_0x70a8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70a8('0x13'))(_0x70a8('0x14'));var utils=require(_0x70a8('0x15'));var config=require(_0x70a8('0x16'));var licenseUtil=require(_0x70a8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87f966,_0x177888){_0x177888=_0x177888||0xcc;return function(_0x2f4ec5){if(_0x2f4ec5){return _0x87f966[_0x70a8('0x18')](_0x177888);}return _0x87f966[_0x70a8('0x19')](_0x177888)[_0x70a8('0x1a')]();};}function respondWithResult(_0x49db46,_0x209603){_0x209603=_0x209603||0xc8;return function(_0x3d5db9){if(_0x3d5db9){return _0x49db46[_0x70a8('0x19')](_0x209603)[_0x70a8('0x1b')](_0x3d5db9);}};}function respondWithFilteredResult(_0xd74bfe,_0x3ff44e){return function(_0xa00aca){if(_0xa00aca){var _0x5e3579=typeof _0x3ff44e['offset']===_0x70a8('0x1c')&&typeof _0x3ff44e[_0x70a8('0x1d')]===_0x70a8('0x1c');var _0x25ad56=_0xa00aca['count'];var _0x1d7287=_0x5e3579?0x0:_0x3ff44e[_0x70a8('0x1e')];var _0x450192=_0x5e3579?_0xa00aca['count']:_0x3ff44e[_0x70a8('0x1e')]+_0x3ff44e['limit'];var _0x482660;if(_0x450192>=_0x25ad56){_0x450192=_0x25ad56;_0x482660=0xc8;}else{_0x482660=0xce;}_0xd74bfe[_0x70a8('0x19')](_0x482660);return _0xd74bfe[_0x70a8('0x1f')]('Content-Range',_0x1d7287+'-'+_0x450192+'/'+_0x25ad56)[_0x70a8('0x1b')](_0xa00aca);}return null;};}function patchUpdates(_0x3c31a4){return function(_0x396620){try{jsonpatch[_0x70a8('0x20')](_0x396620,_0x3c31a4,!![]);}catch(_0x47bcc1){return BPromise['reject'](_0x47bcc1);}return _0x396620[_0x70a8('0x21')]();};}function saveUpdates(_0x368610,_0x2bf622){return function(_0x46de2d){if(_0x46de2d){return _0x46de2d[_0x70a8('0x22')](_0x368610)[_0x70a8('0x23')](function(_0x1883f4){return _0x1883f4;});}return null;};}function removeEntity(_0x5ee6bc,_0x210e85){return function(_0x58ade3){if(_0x58ade3){return _0x58ade3[_0x70a8('0x24')]()[_0x70a8('0x23')](function(){_0x5ee6bc[_0x70a8('0x19')](0xcc)[_0x70a8('0x1a')]();});}};}function handleEntityNotFound(_0x26fe9f,_0x23455a){return function(_0x1d0af0){if(!_0x1d0af0){_0x26fe9f[_0x70a8('0x18')](0x194);}return _0x1d0af0;};}function handleError(_0x195b73,_0xed06b0){_0xed06b0=_0xed06b0||0x1f4;return function(_0x4969c8){logger[_0x70a8('0x25')](_0x4969c8[_0x70a8('0x26')]);if(_0x4969c8[_0x70a8('0x27')]){delete _0x4969c8['name'];}_0x195b73[_0x70a8('0x19')](_0xed06b0)[_0x70a8('0x28')](_0x4969c8);};}exports['index']=function(_0x2f1ca4,_0x17d320){var _0x3102c5={},_0x1e9174={},_0x2fdacf={'count':0x0,'rows':[]};var _0x541edc=_[_0x70a8('0x29')](db[_0x70a8('0x2a')][_0x70a8('0x2b')],function(_0x5a630c){return{'name':_0x5a630c[_0x70a8('0x2c')],'type':_0x5a630c[_0x70a8('0x2d')]['key']};});_0x1e9174[_0x70a8('0x2e')]=_[_0x70a8('0x29')](_0x541edc,_0x70a8('0x27'));_0x1e9174[_0x70a8('0x2f')]=_['keys'](_0x2f1ca4[_0x70a8('0x2f')]);_0x1e9174['filters']=_['intersection'](_0x1e9174['model'],_0x1e9174[_0x70a8('0x2f')]);_0x3102c5[_0x70a8('0x30')]=_[_0x70a8('0x31')](_0x1e9174[_0x70a8('0x2e')],qs[_0x70a8('0x32')](_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x32')]));_0x3102c5[_0x70a8('0x30')]=_0x3102c5[_0x70a8('0x30')][_0x70a8('0x33')]?_0x3102c5[_0x70a8('0x30')]:_0x1e9174['model'];if(!_0x2f1ca4[_0x70a8('0x2f')]['hasOwnProperty'](_0x70a8('0x34'))){_0x3102c5['limit']=qs[_0x70a8('0x1d')](_0x2f1ca4['query']['limit']);_0x3102c5[_0x70a8('0x1e')]=qs[_0x70a8('0x1e')](_0x2f1ca4['query'][_0x70a8('0x1e')]);}_0x3102c5['order']=qs[_0x70a8('0x35')](_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x35')]);_0x3102c5['where']=qs[_0x70a8('0x36')](_['pick'](_0x2f1ca4[_0x70a8('0x2f')],_0x1e9174[_0x70a8('0x36')]),_0x541edc);if(_0x2f1ca4['query'][_0x70a8('0x37')]){_0x3102c5[_0x70a8('0x38')]=_[_0x70a8('0x39')](_0x3102c5[_0x70a8('0x38')],{'$or':_[_0x70a8('0x29')](_0x541edc,function(_0x17b65c){if(_0x17b65c[_0x70a8('0x2d')]!==_0x70a8('0x3a')){var _0x5283aa={};_0x5283aa[_0x17b65c[_0x70a8('0x27')]]={'$like':'%'+_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x37')]+'%'};return _0x5283aa;}})});}_0x3102c5=_[_0x70a8('0x39')]({},_0x3102c5,_0x2f1ca4[_0x70a8('0x3b')]);var _0x280d68={'where':_0x3102c5[_0x70a8('0x38')]};return db[_0x70a8('0x2a')][_0x70a8('0x3c')](_0x280d68)[_0x70a8('0x23')](function(_0x79ca8c){_0x2fdacf['count']=_0x79ca8c;if(_0x2f1ca4[_0x70a8('0x2f')][_0x70a8('0x3d')]){_0x3102c5[_0x70a8('0x3e')]=[{'all':!![]}];}return db[_0x70a8('0x2a')][_0x70a8('0x3f')](_0x3102c5);})['then'](function(_0x20c73c){_0x2fdacf[_0x70a8('0x40')]=_0x20c73c;return _0x2fdacf;})[_0x70a8('0x23')](respondWithFilteredResult(_0x17d320,_0x3102c5))[_0x70a8('0x41')](handleError(_0x17d320,null));};exports[_0x70a8('0x42')]=function(_0x2e7d66,_0x492cde){var _0x5d1d01={'raw':!![],'where':{'id':_0x2e7d66[_0x70a8('0x43')]['id']}},_0x3151b3={};_0x3151b3['model']=_[_0x70a8('0x44')](db[_0x70a8('0x2a')]['rawAttributes']);_0x3151b3[_0x70a8('0x2f')]=_[_0x70a8('0x44')](_0x2e7d66[_0x70a8('0x2f')]);_0x3151b3[_0x70a8('0x36')]=_['intersection'](_0x3151b3[_0x70a8('0x2e')],_0x3151b3[_0x70a8('0x2f')]);_0x5d1d01['attributes']=_[_0x70a8('0x31')](_0x3151b3[_0x70a8('0x2e')],qs[_0x70a8('0x32')](_0x2e7d66[_0x70a8('0x2f')][_0x70a8('0x32')]));_0x5d1d01[_0x70a8('0x30')]=_0x5d1d01[_0x70a8('0x30')][_0x70a8('0x33')]?_0x5d1d01[_0x70a8('0x30')]:_0x3151b3[_0x70a8('0x2e')];if(_0x2e7d66['query']['includeAll']){_0x5d1d01['include']=[{'all':!![]}];}_0x5d1d01=_[_0x70a8('0x39')]({},_0x5d1d01,_0x2e7d66['options']);return db[_0x70a8('0x2a')]['find'](_0x5d1d01)[_0x70a8('0x23')](handleEntityNotFound(_0x492cde,null))['then'](respondWithResult(_0x492cde,null))[_0x70a8('0x41')](handleError(_0x492cde,null));};exports[_0x70a8('0x45')]=function(_0x3fad81,_0x282775){return db[_0x70a8('0x2a')]['create'](_0x3fad81[_0x70a8('0x46')],{})[_0x70a8('0x23')](respondWithResult(_0x282775,0xc9))[_0x70a8('0x41')](handleError(_0x282775,null));};exports[_0x70a8('0x22')]=function(_0x15a954,_0x3f1fea){if(_0x15a954[_0x70a8('0x46')]['id']){delete _0x15a954[_0x70a8('0x46')]['id'];}return db[_0x70a8('0x2a')][_0x70a8('0x47')]({'where':{'id':_0x15a954[_0x70a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f1fea,null))[_0x70a8('0x23')](saveUpdates(_0x15a954[_0x70a8('0x46')],null))[_0x70a8('0x23')](respondWithResult(_0x3f1fea,null))[_0x70a8('0x41')](handleError(_0x3f1fea,null));};exports['destroy']=function(_0x4211cf,_0x575d50){return db[_0x70a8('0x2a')][_0x70a8('0x47')]({'where':{'id':_0x4211cf[_0x70a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x575d50,null))[_0x70a8('0x23')](removeEntity(_0x575d50,null))[_0x70a8('0x41')](handleError(_0x575d50,null));};exports[_0x70a8('0x48')]=function(_0x26f322,_0x2fedc5){return db[_0x70a8('0x2a')][_0x70a8('0x48')]()['then'](respondWithResult(_0x2fedc5,null))[_0x70a8('0x41')](handleError(_0x2fedc5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 296f13b..b4cc1ff 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x814b,0x1a2));var _0xb814=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x814b[_0x9fb081];return _0x43f8b0;};'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 +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x4047c1,_0x1d41aa){var _0xb6d722=function(_0x2075ce){while(--_0x2075ce){_0x4047c1['push'](_0x4047c1['shift']());}};_0xb6d722(++_0x1d41aa);}(_0x7a54,0x106));var _0x47a5=function(_0x1bc979,_0x3cf2f4){_0x1bc979=_0x1bc979-0x0;var _0x590046=_0x7a54[_0x1bc979];return _0x590046;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index bd612f4..9e3d8c9 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 _0xa866=['catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result'];(function(_0x4c438e,_0x54d4bd){var _0x504c69=function(_0x3bebfd){while(--_0x3bebfd){_0x4c438e['push'](_0x4c438e['shift']());}};_0x504c69(++_0x54d4bd);}(_0xa866,0x6a));var _0x6a86=function(_0x598d20,_0x488480){_0x598d20=_0x598d20-0x0;var _0x7ac1da=_0xa866[_0x598d20];return _0x7ac1da;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});}exports['CreateOpenchannelQueueReport']=function(_0x50024d){var _0x11fe3b=this;return new Promise(function(_0x535fd9,_0x588a2f){return db[_0x6a86('0x17')][_0x6a86('0x18')](_0x50024d[_0x6a86('0x19')],{'raw':_0x50024d['options']?_0x50024d[_0x6a86('0x1a')][_0x6a86('0x1b')]===undefined?!![]:![]:!![]})[_0x6a86('0xc')](function(_0x262bf5){logger[_0x6a86('0xd')](_0x6a86('0x1c'),_0x50024d);logger['debug']('CreateOpenchannelQueueReport',_0x50024d,JSON['stringify'](_0x262bf5));_0x535fd9(_0x262bf5);})[_0x6a86('0x16')](function(_0x2007c7){logger[_0x6a86('0x12')](_0x6a86('0x1c'),_0x2007c7['message'],_0x50024d);_0x588a2f(_0x11fe3b[_0x6a86('0x12')](0x1f4,_0x2007c7[_0x6a86('0x14')]));});});};exports[_0x6a86('0x1d')]=function(_0x3f2b70){var _0x19382d=this;return new Promise(function(_0x1c41a7,_0x46f6c7){return db[_0x6a86('0x17')][_0x6a86('0x1e')](_0x3f2b70['body'],{'raw':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')]['where']||null:null,'attributes':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')][_0x6a86('0x1f')]||null:null,'limit':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['limit']||null:null})['then'](function(_0x4d8bf0){logger[_0x6a86('0xd')](_0x6a86('0x1d'),_0x3f2b70);logger[_0x6a86('0xf')]('UpdateOpenchannelQueueReport',_0x3f2b70,JSON[_0x6a86('0x11')](_0x4d8bf0));_0x1c41a7(_0x4d8bf0);})[_0x6a86('0x16')](function(_0x1bb745){logger[_0x6a86('0x12')]('UpdateOpenchannelQueueReport',_0x1bb745[_0x6a86('0x14')],_0x3f2b70);_0x46f6c7(_0x19382d['error'](0x1f4,_0x1bb745[_0x6a86('0x14')]));});});}; \ No newline at end of file +var _0x282b=['catch','CreateOpenchannelQueueReport','create','body','options','raw','debug','OpenchannelQueueReport','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x47e9d4,_0x3ef1f7){var _0x5aa858=function(_0x3e2874){while(--_0x3e2874){_0x47e9d4['push'](_0x47e9d4['shift']());}};_0x5aa858(++_0x3ef1f7);}(_0x282b,0xec));var _0xb282=function(_0x301b3,_0x17eb8e){_0x301b3=_0x301b3-0x0;var _0x585f4e=_0x282b[_0x301b3];return _0x585f4e;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['OpenchannelQueueReport'][_0xb282('0x16')](_0xca5f12[_0xb282('0x17')],{'raw':_0xca5f12['options']?_0xca5f12[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![]})[_0xb282('0xb')](function(_0x438dbe){logger[_0xb282('0xc')]('CreateOpenchannelQueueReport',_0xca5f12);logger[_0xb282('0x1a')](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x438dbe));_0x3f8a3f(_0x438dbe);})['catch'](function(_0x437d66){logger[_0xb282('0x11')](_0xb282('0x15'),_0x437d66[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070[_0xb282('0x11')](0x1f4,_0x437d66['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x360f15){var _0x3c7f1f=this;return new Promise(function(_0x4934f0,_0x5e828e){return db[_0xb282('0x1b')][_0xb282('0x1c')](_0x360f15[_0xb282('0x17')],{'raw':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1d')]||null:null,'attributes':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1e')]||null:null,'limit':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')]['limit']||null:null})[_0xb282('0xb')](function(_0x1fb89f){logger[_0xb282('0xc')](_0xb282('0x1f'),_0x360f15);logger[_0xb282('0x1a')](_0xb282('0x1f'),_0x360f15,JSON[_0xb282('0x10')](_0x1fb89f));_0x4934f0(_0x1fb89f);})['catch'](function(_0x1b15b5){logger[_0xb282('0x11')](_0xb282('0x1f'),_0x1b15b5[_0xb282('0x12')],_0x360f15);_0x5e828e(_0x3c7f1f[_0xb282('0x11')](0x1f4,_0x1b15b5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 912f6f6..d0e19d0 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 _0xedf2=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','/describe','isAuthenticated','get','show','post'];(function(_0x231496,_0x23ef77){var _0x5b6e36=function(_0x34f968){while(--_0x34f968){_0x231496['push'](_0x231496['shift']());}};_0x5b6e36(++_0x23ef77);}(_0xedf2,0xf8));var _0x2edf=function(_0x419e89,_0x57f7a4){_0x419e89=_0x419e89-0x0;var _0xda3210=_0xedf2[_0x419e89];return _0xda3210;};'use strict';var multer=require(_0x2edf('0x0'));var util=require(_0x2edf('0x1'));var path=require(_0x2edf('0x2'));var timeout=require(_0x2edf('0x3'));var express=require(_0x2edf('0x4'));var router=express[_0x2edf('0x5')]();var fs_extra=require(_0x2edf('0x6'));var auth=require(_0x2edf('0x7'));var interaction=require(_0x2edf('0x8'));var config=require(_0x2edf('0x9'));var controller=require(_0x2edf('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2edf('0xb'),auth[_0x2edf('0xc')](),controller['describe']);router[_0x2edf('0xd')]('/:id',auth[_0x2edf('0xc')](),controller[_0x2edf('0xe')]);router[_0x2edf('0xf')]('/',auth['isAuthenticated'](),controller[_0x2edf('0x10')]);router[_0x2edf('0x11')]('/:id',auth[_0x2edf('0xc')](),controller[_0x2edf('0x12')]);router[_0x2edf('0x13')]('/:id',auth[_0x2edf('0xc')](),controller[_0x2edf('0x14')]);module[_0x2edf('0x15')]=router; \ No newline at end of file +var _0x0b2d=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','describe','get','show','post','put','/:id','update','delete','destroy'];(function(_0x56f3a3,_0x47d801){var _0x40c0cb=function(_0x500a7a){while(--_0x500a7a){_0x56f3a3['push'](_0x56f3a3['shift']());}};_0x40c0cb(++_0x47d801);}(_0x0b2d,0xd3));var _0xd0b2=function(_0x530ce7,_0x5b4ac5){_0x530ce7=_0x530ce7-0x0;var _0x5b1233=_0x0b2d[_0x530ce7];return _0x5b1233;};'use strict';var multer=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var path=require(_0xd0b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0b2('0x3'));var router=express[_0xd0b2('0x4')]();var fs_extra=require(_0xd0b2('0x5'));var auth=require(_0xd0b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0b2('0x7'));var controller=require(_0xd0b2('0x8'));router['get']('/',auth[_0xd0b2('0x9')](),controller[_0xd0b2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd0b2('0xb')]);router[_0xd0b2('0xc')]('/:id',auth[_0xd0b2('0x9')](),controller[_0xd0b2('0xd')]);router[_0xd0b2('0xe')]('/',auth[_0xd0b2('0x9')](),controller['create']);router[_0xd0b2('0xf')](_0xd0b2('0x10'),auth[_0xd0b2('0x9')](),controller[_0xd0b2('0x11')]);router[_0xd0b2('0x12')](_0xd0b2('0x10'),auth[_0xd0b2('0x9')](),controller[_0xd0b2('0x13')]);module[_0xd0b2('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 159d7d2..03b1036 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xb43b,0x1b2));var _0xbb43=function(_0x6e12c0,_0xd5bff3){_0x6e12c0=_0x6e12c0-0x0;var _0x121b5b=_0xb43b[_0x6e12c0];return _0x121b5b;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x38838f,_0x1cd670){_0x38838f=_0x38838f-0x0;var _0x4a30d6=_0xb43b[_0x38838f];return _0x4a30d6;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 149dfca..778bf2d 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 _0x1dea=['../../config/logger','api','../../config/utils','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelTransferReport','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2717b3,_0x48cd4c){var _0x3b8e1a=function(_0x5063ac){while(--_0x5063ac){_0x2717b3['push'](_0x2717b3['shift']());}};_0x3b8e1a(++_0x48cd4c);}(_0x1dea,0x19e));var _0xa1de=function(_0x515792,_0x114206){_0x515792=_0x515792-0x0;var _0x4c1fc9=_0x1dea[_0x515792];return _0x4c1fc9;};'use strict';var emlformat=require(_0xa1de('0x0'));var rimraf=require(_0xa1de('0x1'));var zipdir=require(_0xa1de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1de('0x3'));var moment=require(_0xa1de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa1de('0x5'));var util=require('util');var path=require(_0xa1de('0x6'));var sox=require(_0xa1de('0x7'));var csv=require(_0xa1de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1de('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa1de('0xa'));var jsforce=require(_0xa1de('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa1de('0x8'));var querystring=require('querystring');var Papa=require(_0xa1de('0xc'));var Redis=require(_0xa1de('0xd'));var authService=require(_0xa1de('0xe'));var qs=require(_0xa1de('0xf'));var as=require(_0xa1de('0x10'));var hardwareService=require(_0xa1de('0x11'));var logger=require(_0xa1de('0x12'))(_0xa1de('0x13'));var utils=require(_0xa1de('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x770d47,_0x7d1274){_0x7d1274=_0x7d1274||0xcc;return function(_0x31adda){if(_0x31adda){return _0x770d47['sendStatus'](_0x7d1274);}return _0x770d47['status'](_0x7d1274)[_0xa1de('0x15')]();};}function respondWithResult(_0x21521d,_0x4a9fc5){_0x4a9fc5=_0x4a9fc5||0xc8;return function(_0x5d9645){if(_0x5d9645){return _0x21521d[_0xa1de('0x16')](_0x4a9fc5)[_0xa1de('0x17')](_0x5d9645);}};}function respondWithFilteredResult(_0x35921e,_0x337705){return function(_0x461da4){if(_0x461da4){var _0x5ac1a7=typeof _0x337705['offset']===_0xa1de('0x18')&&typeof _0x337705[_0xa1de('0x19')]===_0xa1de('0x18');var _0x2230cc=_0x461da4[_0xa1de('0x1a')];var _0xc45e2d=_0x5ac1a7?0x0:_0x337705[_0xa1de('0x1b')];var _0x1b0a25=_0x5ac1a7?_0x461da4['count']:_0x337705[_0xa1de('0x1b')]+_0x337705['limit'];var _0x520853;if(_0x1b0a25>=_0x2230cc){_0x1b0a25=_0x2230cc;_0x520853=0xc8;}else{_0x520853=0xce;}_0x35921e[_0xa1de('0x16')](_0x520853);return _0x35921e['set'](_0xa1de('0x1c'),_0xc45e2d+'-'+_0x1b0a25+'/'+_0x2230cc)['json'](_0x461da4);}return null;};}function patchUpdates(_0x4f43bd){return function(_0x2fe400){try{jsonpatch[_0xa1de('0x1d')](_0x2fe400,_0x4f43bd,!![]);}catch(_0x5acf92){return BPromise[_0xa1de('0x1e')](_0x5acf92);}return _0x2fe400[_0xa1de('0x1f')]();};}function saveUpdates(_0x11d36d,_0x394f4e){return function(_0x1f2ecb){if(_0x1f2ecb){return _0x1f2ecb[_0xa1de('0x20')](_0x11d36d)[_0xa1de('0x21')](function(_0x26b68b){return _0x26b68b;});}return null;};}function removeEntity(_0x5c30e4,_0x2d96e3){return function(_0x17ca63){if(_0x17ca63){return _0x17ca63[_0xa1de('0x22')]()[_0xa1de('0x21')](function(){_0x5c30e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc32de,_0x58ac9a){return function(_0x50f4c2){if(!_0x50f4c2){_0xcc32de[_0xa1de('0x23')](0x194);}return _0x50f4c2;};}function handleError(_0x3169f2,_0x59ea88){_0x59ea88=_0x59ea88||0x1f4;return function(_0x514892){logger[_0xa1de('0x24')](_0x514892['stack']);if(_0x514892[_0xa1de('0x25')]){delete _0x514892[_0xa1de('0x25')];}_0x3169f2[_0xa1de('0x16')](_0x59ea88)[_0xa1de('0x26')](_0x514892);};}exports[_0xa1de('0x27')]=function(_0x373e84,_0x3b0d28){var _0x237a8b={},_0x3e89aa={},_0x3781c8={'count':0x0,'rows':[]};var _0x1248fd=_['map'](db[_0xa1de('0x28')]['rawAttributes'],function(_0x2ecec4){return{'name':_0x2ecec4['fieldName'],'type':_0x2ecec4['type'][_0xa1de('0x29')]};});_0x3e89aa[_0xa1de('0x2a')]=_[_0xa1de('0x2b')](_0x1248fd,_0xa1de('0x25'));_0x3e89aa['query']=_[_0xa1de('0x2c')](_0x373e84[_0xa1de('0x2d')]);_0x3e89aa[_0xa1de('0x2e')]=_[_0xa1de('0x2f')](_0x3e89aa[_0xa1de('0x2a')],_0x3e89aa['query']);_0x237a8b['attributes']=_[_0xa1de('0x2f')](_0x3e89aa[_0xa1de('0x2a')],qs['fields'](_0x373e84[_0xa1de('0x2d')][_0xa1de('0x30')]));_0x237a8b[_0xa1de('0x31')]=_0x237a8b['attributes'][_0xa1de('0x32')]?_0x237a8b[_0xa1de('0x31')]:_0x3e89aa['model'];if(!_0x373e84[_0xa1de('0x2d')][_0xa1de('0x33')](_0xa1de('0x34'))){_0x237a8b[_0xa1de('0x19')]=qs['limit'](_0x373e84[_0xa1de('0x2d')][_0xa1de('0x19')]);_0x237a8b[_0xa1de('0x1b')]=qs[_0xa1de('0x1b')](_0x373e84[_0xa1de('0x2d')][_0xa1de('0x1b')]);}_0x237a8b['order']=qs[_0xa1de('0x35')](_0x373e84[_0xa1de('0x2d')][_0xa1de('0x35')]);_0x237a8b[_0xa1de('0x36')]=qs[_0xa1de('0x2e')](_['pick'](_0x373e84['query'],_0x3e89aa[_0xa1de('0x2e')]),_0x1248fd);if(_0x373e84[_0xa1de('0x2d')][_0xa1de('0x37')]){_0x237a8b[_0xa1de('0x36')]=_[_0xa1de('0x38')](_0x237a8b['where'],{'$or':_[_0xa1de('0x2b')](_0x1248fd,function(_0x2d1e26){if(_0x2d1e26[_0xa1de('0x39')]!==_0xa1de('0x3a')){var _0x4bc7d7={};_0x4bc7d7[_0x2d1e26['name']]={'$like':'%'+_0x373e84[_0xa1de('0x2d')]['filter']+'%'};return _0x4bc7d7;}})});}_0x237a8b=_[_0xa1de('0x38')]({},_0x237a8b,_0x373e84[_0xa1de('0x3b')]);var _0x324dbf={'where':_0x237a8b[_0xa1de('0x36')]};return db[_0xa1de('0x28')][_0xa1de('0x1a')](_0x324dbf)[_0xa1de('0x21')](function(_0x31ba38){_0x3781c8[_0xa1de('0x1a')]=_0x31ba38;if(_0x373e84[_0xa1de('0x2d')][_0xa1de('0x3c')]){_0x237a8b[_0xa1de('0x3d')]=[{'all':!![]}];}return db[_0xa1de('0x28')][_0xa1de('0x3e')](_0x237a8b);})[_0xa1de('0x21')](function(_0xd6f06a){_0x3781c8[_0xa1de('0x3f')]=_0xd6f06a;return _0x3781c8;})[_0xa1de('0x21')](respondWithFilteredResult(_0x3b0d28,_0x237a8b))[_0xa1de('0x40')](handleError(_0x3b0d28,null));};exports[_0xa1de('0x41')]=function(_0x36cd0e,_0x5da0bd){var _0x93fd8c={'raw':!![],'where':{'id':_0x36cd0e[_0xa1de('0x42')]['id']}},_0x37a117={};_0x37a117[_0xa1de('0x2a')]=_[_0xa1de('0x2c')](db['OpenchannelTransferReport'][_0xa1de('0x43')]);_0x37a117[_0xa1de('0x2d')]=_['keys'](_0x36cd0e[_0xa1de('0x2d')]);_0x37a117[_0xa1de('0x2e')]=_[_0xa1de('0x2f')](_0x37a117['model'],_0x37a117[_0xa1de('0x2d')]);_0x93fd8c['attributes']=_[_0xa1de('0x2f')](_0x37a117[_0xa1de('0x2a')],qs[_0xa1de('0x30')](_0x36cd0e[_0xa1de('0x2d')][_0xa1de('0x30')]));_0x93fd8c[_0xa1de('0x31')]=_0x93fd8c[_0xa1de('0x31')][_0xa1de('0x32')]?_0x93fd8c[_0xa1de('0x31')]:_0x37a117[_0xa1de('0x2a')];if(_0x36cd0e[_0xa1de('0x2d')][_0xa1de('0x3c')]){_0x93fd8c[_0xa1de('0x3d')]=[{'all':!![]}];}_0x93fd8c=_['merge']({},_0x93fd8c,_0x36cd0e[_0xa1de('0x3b')]);return db['OpenchannelTransferReport']['find'](_0x93fd8c)['then'](handleEntityNotFound(_0x5da0bd,null))[_0xa1de('0x21')](respondWithResult(_0x5da0bd,null))[_0xa1de('0x40')](handleError(_0x5da0bd,null));};exports[_0xa1de('0x44')]=function(_0x134f3e,_0x47ee7c){return db[_0xa1de('0x28')][_0xa1de('0x44')](_0x134f3e[_0xa1de('0x45')],{})[_0xa1de('0x21')](respondWithResult(_0x47ee7c,0xc9))[_0xa1de('0x40')](handleError(_0x47ee7c,null));};exports[_0xa1de('0x20')]=function(_0x1cf580,_0x24d02c){if(_0x1cf580['body']['id']){delete _0x1cf580[_0xa1de('0x45')]['id'];}return db[_0xa1de('0x28')]['find']({'where':{'id':_0x1cf580['params']['id']}})[_0xa1de('0x21')](handleEntityNotFound(_0x24d02c,null))[_0xa1de('0x21')](saveUpdates(_0x1cf580['body'],null))[_0xa1de('0x21')](respondWithResult(_0x24d02c,null))[_0xa1de('0x40')](handleError(_0x24d02c,null));};exports[_0xa1de('0x22')]=function(_0x10c250,_0x38ab88){return db[_0xa1de('0x28')][_0xa1de('0x46')]({'where':{'id':_0x10c250[_0xa1de('0x42')]['id']}})[_0xa1de('0x21')](handleEntityNotFound(_0x38ab88,null))[_0xa1de('0x21')](removeEntity(_0x38ab88,null))[_0xa1de('0x40')](handleError(_0x38ab88,null));};exports[_0xa1de('0x47')]=function(_0x5ebb0e,_0x345dea){return db[_0xa1de('0x28')][_0xa1de('0x47')]()[_0xa1de('0x21')](respondWithResult(_0x345dea,null))[_0xa1de('0x40')](handleError(_0x345dea,null));}; \ No newline at end of file +var _0xa5fc=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','include','findAll','catch','show','params','length','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x379ad5,_0x552893){var _0x2bcdec=function(_0x2b7568){while(--_0x2b7568){_0x379ad5['push'](_0x379ad5['shift']());}};_0x2bcdec(++_0x552893);}(_0xa5fc,0x146));var _0xca5f=function(_0x211b20,_0x306c73){_0x211b20=_0x211b20-0x0;var _0xa1eab=_0xa5fc[_0x211b20];return _0xa1eab;};'use strict';var emlformat=require(_0xca5f('0x0'));var rimraf=require(_0xca5f('0x1'));var zipdir=require(_0xca5f('0x2'));var jsonpatch=require(_0xca5f('0x3'));var rp=require(_0xca5f('0x4'));var moment=require(_0xca5f('0x5'));var BPromise=require(_0xca5f('0x6'));var Mustache=require('mustache');var util=require(_0xca5f('0x7'));var path=require(_0xca5f('0x8'));var sox=require(_0xca5f('0x9'));var csv=require(_0xca5f('0xa'));var ejs=require(_0xca5f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xca5f('0xc'));var crypto=require(_0xca5f('0xd'));var jsforce=require(_0xca5f('0xe'));var deskjs=require(_0xca5f('0xf'));var toCsv=require(_0xca5f('0xa'));var querystring=require(_0xca5f('0x10'));var Papa=require(_0xca5f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca5f('0x13'));var logger=require(_0xca5f('0x14'))(_0xca5f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca5f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5278ef,_0x5e744d){_0x5e744d=_0x5e744d||0xcc;return function(_0x3a9057){if(_0x3a9057){return _0x5278ef[_0xca5f('0x17')](_0x5e744d);}return _0x5278ef[_0xca5f('0x18')](_0x5e744d)[_0xca5f('0x19')]();};}function respondWithResult(_0x1c3f9d,_0x1246dd){_0x1246dd=_0x1246dd||0xc8;return function(_0x43758a){if(_0x43758a){return _0x1c3f9d[_0xca5f('0x18')](_0x1246dd)[_0xca5f('0x1a')](_0x43758a);}};}function respondWithFilteredResult(_0x23cab6,_0x3da903){return function(_0x28754c){if(_0x28754c){var _0x4b414b=typeof _0x3da903[_0xca5f('0x1b')]===_0xca5f('0x1c')&&typeof _0x3da903[_0xca5f('0x1d')]===_0xca5f('0x1c');var _0xe4302d=_0x28754c[_0xca5f('0x1e')];var _0x185004=_0x4b414b?0x0:_0x3da903['offset'];var _0x588bf0=_0x4b414b?_0x28754c[_0xca5f('0x1e')]:_0x3da903[_0xca5f('0x1b')]+_0x3da903[_0xca5f('0x1d')];var _0x510058;if(_0x588bf0>=_0xe4302d){_0x588bf0=_0xe4302d;_0x510058=0xc8;}else{_0x510058=0xce;}_0x23cab6[_0xca5f('0x18')](_0x510058);return _0x23cab6[_0xca5f('0x1f')](_0xca5f('0x20'),_0x185004+'-'+_0x588bf0+'/'+_0xe4302d)['json'](_0x28754c);}return null;};}function patchUpdates(_0x327039){return function(_0x710489){try{jsonpatch[_0xca5f('0x21')](_0x710489,_0x327039,!![]);}catch(_0xfb9933){return BPromise['reject'](_0xfb9933);}return _0x710489['save']();};}function saveUpdates(_0x445d1d,_0x3aebe6){return function(_0x48c239){if(_0x48c239){return _0x48c239[_0xca5f('0x22')](_0x445d1d)['then'](function(_0x469db2){return _0x469db2;});}return null;};}function removeEntity(_0x4ce755,_0xed8b41){return function(_0x2a5ba1){if(_0x2a5ba1){return _0x2a5ba1['destroy']()[_0xca5f('0x23')](function(){_0x4ce755['status'](0xcc)[_0xca5f('0x19')]();});}};}function handleEntityNotFound(_0x185044,_0xc798e5){return function(_0x1b246a){if(!_0x1b246a){_0x185044[_0xca5f('0x17')](0x194);}return _0x1b246a;};}function handleError(_0x103630,_0xf68a4f){_0xf68a4f=_0xf68a4f||0x1f4;return function(_0x2954a6){logger[_0xca5f('0x24')](_0x2954a6[_0xca5f('0x25')]);if(_0x2954a6['name']){delete _0x2954a6[_0xca5f('0x26')];}_0x103630[_0xca5f('0x18')](_0xf68a4f)[_0xca5f('0x27')](_0x2954a6);};}exports[_0xca5f('0x28')]=function(_0x3b9054,_0x268233){var _0x5c29e4={},_0x30cb5a={},_0x314d61={'count':0x0,'rows':[]};var _0x1777a5=_[_0xca5f('0x29')](db['OpenchannelTransferReport'][_0xca5f('0x2a')],function(_0x17b500){return{'name':_0x17b500[_0xca5f('0x2b')],'type':_0x17b500[_0xca5f('0x2c')]['key']};});_0x30cb5a[_0xca5f('0x2d')]=_[_0xca5f('0x29')](_0x1777a5,_0xca5f('0x26'));_0x30cb5a[_0xca5f('0x2e')]=_[_0xca5f('0x2f')](_0x3b9054['query']);_0x30cb5a[_0xca5f('0x30')]=_[_0xca5f('0x31')](_0x30cb5a[_0xca5f('0x2d')],_0x30cb5a[_0xca5f('0x2e')]);_0x5c29e4[_0xca5f('0x32')]=_['intersection'](_0x30cb5a[_0xca5f('0x2d')],qs[_0xca5f('0x33')](_0x3b9054['query'][_0xca5f('0x33')]));_0x5c29e4[_0xca5f('0x32')]=_0x5c29e4[_0xca5f('0x32')]['length']?_0x5c29e4[_0xca5f('0x32')]:_0x30cb5a[_0xca5f('0x2d')];if(!_0x3b9054['query'][_0xca5f('0x34')](_0xca5f('0x35'))){_0x5c29e4[_0xca5f('0x1d')]=qs[_0xca5f('0x1d')](_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x1d')]);_0x5c29e4[_0xca5f('0x1b')]=qs['offset'](_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x1b')]);}_0x5c29e4[_0xca5f('0x36')]=qs[_0xca5f('0x37')](_0x3b9054[_0xca5f('0x2e')]['sort']);_0x5c29e4[_0xca5f('0x38')]=qs['filters'](_[_0xca5f('0x39')](_0x3b9054['query'],_0x30cb5a['filters']),_0x1777a5);if(_0x3b9054[_0xca5f('0x2e')][_0xca5f('0x3a')]){_0x5c29e4['where']=_[_0xca5f('0x3b')](_0x5c29e4[_0xca5f('0x38')],{'$or':_[_0xca5f('0x29')](_0x1777a5,function(_0x2fb677){if(_0x2fb677[_0xca5f('0x2c')]!==_0xca5f('0x3c')){var _0x4706a7={};_0x4706a7[_0x2fb677[_0xca5f('0x26')]]={'$like':'%'+_0x3b9054[_0xca5f('0x2e')]['filter']+'%'};return _0x4706a7;}})});}_0x5c29e4=_[_0xca5f('0x3b')]({},_0x5c29e4,_0x3b9054['options']);var _0x1bed30={'where':_0x5c29e4[_0xca5f('0x38')]};return db[_0xca5f('0x3d')][_0xca5f('0x1e')](_0x1bed30)[_0xca5f('0x23')](function(_0x5cfc1d){_0x314d61['count']=_0x5cfc1d;if(_0x3b9054[_0xca5f('0x2e')]['includeAll']){_0x5c29e4[_0xca5f('0x3e')]=[{'all':!![]}];}return db[_0xca5f('0x3d')][_0xca5f('0x3f')](_0x5c29e4);})[_0xca5f('0x23')](function(_0x4e575e){_0x314d61['rows']=_0x4e575e;return _0x314d61;})[_0xca5f('0x23')](respondWithFilteredResult(_0x268233,_0x5c29e4))[_0xca5f('0x40')](handleError(_0x268233,null));};exports[_0xca5f('0x41')]=function(_0xa199ed,_0x4cf099){var _0xef1548={'raw':!![],'where':{'id':_0xa199ed[_0xca5f('0x42')]['id']}},_0x4b3a85={};_0x4b3a85[_0xca5f('0x2d')]=_[_0xca5f('0x2f')](db[_0xca5f('0x3d')]['rawAttributes']);_0x4b3a85['query']=_[_0xca5f('0x2f')](_0xa199ed[_0xca5f('0x2e')]);_0x4b3a85[_0xca5f('0x30')]=_[_0xca5f('0x31')](_0x4b3a85['model'],_0x4b3a85[_0xca5f('0x2e')]);_0xef1548[_0xca5f('0x32')]=_[_0xca5f('0x31')](_0x4b3a85['model'],qs[_0xca5f('0x33')](_0xa199ed[_0xca5f('0x2e')][_0xca5f('0x33')]));_0xef1548[_0xca5f('0x32')]=_0xef1548[_0xca5f('0x32')][_0xca5f('0x43')]?_0xef1548[_0xca5f('0x32')]:_0x4b3a85[_0xca5f('0x2d')];if(_0xa199ed[_0xca5f('0x2e')][_0xca5f('0x44')]){_0xef1548[_0xca5f('0x3e')]=[{'all':!![]}];}_0xef1548=_[_0xca5f('0x3b')]({},_0xef1548,_0xa199ed[_0xca5f('0x45')]);return db[_0xca5f('0x3d')][_0xca5f('0x46')](_0xef1548)[_0xca5f('0x23')](handleEntityNotFound(_0x4cf099,null))[_0xca5f('0x23')](respondWithResult(_0x4cf099,null))[_0xca5f('0x40')](handleError(_0x4cf099,null));};exports[_0xca5f('0x47')]=function(_0x589992,_0x320db1){return db[_0xca5f('0x3d')][_0xca5f('0x47')](_0x589992[_0xca5f('0x48')],{})['then'](respondWithResult(_0x320db1,0xc9))[_0xca5f('0x40')](handleError(_0x320db1,null));};exports[_0xca5f('0x22')]=function(_0x984d07,_0x57350a){if(_0x984d07[_0xca5f('0x48')]['id']){delete _0x984d07[_0xca5f('0x48')]['id'];}return db[_0xca5f('0x3d')]['find']({'where':{'id':_0x984d07[_0xca5f('0x42')]['id']}})['then'](handleEntityNotFound(_0x57350a,null))[_0xca5f('0x23')](saveUpdates(_0x984d07['body'],null))['then'](respondWithResult(_0x57350a,null))[_0xca5f('0x40')](handleError(_0x57350a,null));};exports[_0xca5f('0x49')]=function(_0x59906e,_0x2b7363){return db[_0xca5f('0x3d')][_0xca5f('0x46')]({'where':{'id':_0x59906e['params']['id']}})['then'](handleEntityNotFound(_0x2b7363,null))['then'](removeEntity(_0x2b7363,null))[_0xca5f('0x40')](handleError(_0x2b7363,null));};exports[_0xca5f('0x4a')]=function(_0xac30a9,_0x15a011){return db[_0xca5f('0x3d')][_0xca5f('0x4a')]()[_0xca5f('0x23')](respondWithResult(_0x15a011,null))['catch'](handleError(_0x15a011,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0bf0b04..8d1f9d9 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 _0x527f=['api','moment','bluebird','request-promise','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x527f,0x123));var _0xf527=function(_0x2e01d6,_0x21b8c4){_0x2e01d6=_0x2e01d6-0x0;var _0x554d92=_0x527f[_0x2e01d6];return _0x554d92;};'use strict';var _=require(_0xf527('0x0'));var util=require(_0xf527('0x1'));var logger=require(_0xf527('0x2'))(_0xf527('0x3'));var moment=require(_0xf527('0x4'));var BPromise=require(_0xf527('0x5'));var rp=require(_0xf527('0x6'));var fs=require('fs');var path=require(_0xf527('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf527('0x8'));module[_0xf527('0x9')]=function(_0x27fd1d,_0x2d048e){return _0x27fd1d[_0xf527('0xa')](_0xf527('0xb'),attributes,{'tableName':_0xf527('0xc'),'paranoid':![],'indexes':[{'name':_0xf527('0xd'),'fields':[_0xf527('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9676=['lodash','util','../../config/logger','api','bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9676,0x136));var _0x6967=function(_0x3e8450,_0x3d95a1){_0x3e8450=_0x3e8450-0x0;var _0x40a872=_0x9676[_0x3e8450];return _0x40a872;};'use strict';var _=require(_0x6967('0x0'));var util=require(_0x6967('0x1'));var logger=require(_0x6967('0x2'))(_0x6967('0x3'));var moment=require('moment');var BPromise=require(_0x6967('0x4'));var rp=require(_0x6967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6967('0x6'));module[_0x6967('0x7')]=function(_0x47cb93,_0x126465){return _0x47cb93[_0x6967('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x6967('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 03b8dc4..fe0b15a 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27c5=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x564b0e,_0x1db1d2){var _0x23c592=function(_0x504e63){while(--_0x504e63){_0x564b0e['push'](_0x564b0e['shift']());}};_0x23c592(++_0x1db1d2);}(_0x27c5,0x173));var _0x527c=function(_0x5016c9,_0x57cdf0){_0x5016c9=_0x5016c9-0x0;var _0x5371ee=_0x27c5[_0x5016c9];return _0x5371ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x527c('0x0'));var BPromise=require(_0x527c('0x1'));var rs=require(_0x527c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x527c('0x3'))['db'];var utils=require(_0x527c('0x4'));var logger=require(_0x527c('0x5'))(_0x527c('0x6'));var config=require(_0x527c('0x7'));var jayson=require(_0x527c('0x8'));var client=jayson[_0x527c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c413,_0x5a68e8,_0x2db820){return new BPromise(function(_0x5e07ba,_0x1071f5){return client[_0x527c('0xa')](_0x18c413,_0x2db820)[_0x527c('0xb')](function(_0x49465c){logger[_0x527c('0xc')](_0x527c('0xd'),_0x5a68e8,_0x527c('0xe'));logger[_0x527c('0xf')](_0x527c('0x10'),_0x5a68e8,_0x527c('0xe'),JSON[_0x527c('0x11')](_0x49465c));if(_0x49465c[_0x527c('0x12')]){if(_0x49465c[_0x527c('0x12')][_0x527c('0x13')]===0x1f4){logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c['error'][_0x527c('0x14')]);return _0x1071f5(_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);}logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);return _0x5e07ba(_0x49465c['error']['message']);}else{logger[_0x527c('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,'request\x20sent');_0x5e07ba(_0x49465c[_0x527c('0x15')][_0x527c('0x14')]);}})[_0x527c('0x16')](function(_0x5e987c){logger[_0x527c('0x12')](_0x527c('0xd'),_0x5a68e8,_0x5e987c);_0x1071f5(_0x5e987c);});});} \ No newline at end of file +var _0xed1f=['request','then','info','OpenchannelTransferReport,\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(_0x514ea0,_0x352eb7){var _0x57b24b=function(_0x57fe04){while(--_0x57fe04){_0x514ea0['push'](_0x514ea0['shift']());}};_0x57b24b(++_0x352eb7);}(_0xed1f,0x6a));var _0xfed1=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xed1f[_0x5f3f88];return _0xd08119;};'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')]('OpenchannelTransferReport,\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')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('OpenchannelTransferReport,\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')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a0e5e1b..bf238f7 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 _0x59a5=['create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post'];(function(_0x414901,_0x20ee6a){var _0x2cae72=function(_0x1f13bc){while(--_0x1f13bc){_0x414901['push'](_0x414901['shift']());}};_0x2cae72(++_0x20ee6a);}(_0x59a5,0x157));var _0x559a=function(_0x10e6ab,_0x446978){_0x10e6ab=_0x10e6ab-0x0;var _0x581b5b=_0x59a5[_0x10e6ab];return _0x581b5b;};'use strict';var multer=require(_0x559a('0x0'));var util=require(_0x559a('0x1'));var path=require(_0x559a('0x2'));var timeout=require(_0x559a('0x3'));var express=require(_0x559a('0x4'));var router=express[_0x559a('0x5')]();var fs_extra=require(_0x559a('0x6'));var auth=require(_0x559a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x559a('0x8'));var controller=require('./pause.controller');router['get']('/',auth[_0x559a('0x9')](),controller[_0x559a('0xa')]);router[_0x559a('0xb')](_0x559a('0xc'),auth[_0x559a('0x9')](),controller['show']);router[_0x559a('0xd')]('/',auth['isAuthenticated'](),controller[_0x559a('0xe')]);router['put'](_0x559a('0xc'),auth[_0x559a('0x9')](),controller['update']);router[_0x559a('0xf')](_0x559a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x559a('0x10')]=router; \ No newline at end of file +var _0x86d1=['post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id'];(function(_0x4f495f,_0x1844cd){var _0x5c08c9=function(_0x357e34){while(--_0x357e34){_0x4f495f['push'](_0x4f495f['shift']());}};_0x5c08c9(++_0x1844cd);}(_0x86d1,0xc5));var _0x186d=function(_0x5cb410,_0x25605f){_0x5cb410=_0x5cb410-0x0;var _0x3ac7c7=_0x86d1[_0x5cb410];return _0x3ac7c7;};'use strict';var multer=require(_0x186d('0x0'));var util=require(_0x186d('0x1'));var path=require(_0x186d('0x2'));var timeout=require(_0x186d('0x3'));var express=require('express');var router=express[_0x186d('0x4')]();var fs_extra=require(_0x186d('0x5'));var auth=require(_0x186d('0x6'));var interaction=require(_0x186d('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0x186d('0x8')](),controller['index']);router[_0x186d('0x9')](_0x186d('0xa'),auth[_0x186d('0x8')](),controller['show']);router[_0x186d('0xb')]('/',auth[_0x186d('0x8')](),controller[_0x186d('0xc')]);router['put'](_0x186d('0xa'),auth[_0x186d('0x8')](),controller[_0x186d('0xd')]);router[_0x186d('0xe')](_0x186d('0xa'),auth[_0x186d('0x8')](),controller['destroy']);module[_0x186d('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index c007284..c1a8c85 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 _0x79ac=['STRING','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x79ac,0x199));var _0xc79a=function(_0x1ea524,_0x2ae4cd){_0x1ea524=_0x1ea524-0x0;var _0x205ac6=_0x79ac[_0x1ea524];return _0x205ac6;};'use strict';var Sequelize=require(_0xc79a('0x0'));module[_0xc79a('0x1')]={'name':{'type':Sequelize[_0xc79a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e7a=['sequelize','exports','STRING','name'];(function(_0x35c978,_0x54d0c1){var _0x286dde=function(_0x399fc5){while(--_0x399fc5){_0x35c978['push'](_0x35c978['shift']());}};_0x286dde(++_0x54d0c1);}(_0x3e7a,0x1d4));var _0xa3e7=function(_0x3266ba,_0x3a3980){_0x3266ba=_0x3266ba-0x0;var _0x5a1bde=_0x3e7a[_0x3266ba];return _0x5a1bde;};'use strict';var Sequelize=require(_0xa3e7('0x0'));module[_0xa3e7('0x1')]={'name':{'type':Sequelize[_0xa3e7('0x2')],'unique':_0xa3e7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa3e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d8fe245..3969d15 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 _0x8fd5=['reject','save','update','destroy','then','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x3507bc,_0x2ee152){var _0x1462f8=function(_0x4e9bfc){while(--_0x4e9bfc){_0x3507bc['push'](_0x3507bc['shift']());}};_0x1462f8(++_0x2ee152);}(_0x8fd5,0x134));var _0x58fd=function(_0x354e96,_0x187439){_0x354e96=_0x354e96-0x0;var _0x26dad5=_0x8fd5[_0x354e96];return _0x26dad5;};'use strict';var emlformat=require(_0x58fd('0x0'));var rimraf=require(_0x58fd('0x1'));var zipdir=require(_0x58fd('0x2'));var jsonpatch=require(_0x58fd('0x3'));var rp=require(_0x58fd('0x4'));var moment=require(_0x58fd('0x5'));var BPromise=require(_0x58fd('0x6'));var Mustache=require(_0x58fd('0x7'));var util=require(_0x58fd('0x8'));var path=require('path');var sox=require(_0x58fd('0x9'));var csv=require(_0x58fd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58fd('0xb'));var _=require(_0x58fd('0xc'));var squel=require(_0x58fd('0xd'));var crypto=require('crypto');var jsforce=require(_0x58fd('0xe'));var deskjs=require(_0x58fd('0xf'));var toCsv=require(_0x58fd('0xa'));var querystring=require(_0x58fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x58fd('0x11'));var authService=require(_0x58fd('0x12'));var qs=require(_0x58fd('0x13'));var as=require(_0x58fd('0x14'));var hardwareService=require(_0x58fd('0x15'));var logger=require('../../config/logger')(_0x58fd('0x16'));var utils=require(_0x58fd('0x17'));var config=require(_0x58fd('0x18'));var licenseUtil=require(_0x58fd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d4c3d,_0x218341){_0x218341=_0x218341||0xcc;return function(_0x3943ce){if(_0x3943ce){return _0x7d4c3d[_0x58fd('0x1a')](_0x218341);}return _0x7d4c3d[_0x58fd('0x1b')](_0x218341)[_0x58fd('0x1c')]();};}function respondWithResult(_0x18429a,_0x13aec3){_0x13aec3=_0x13aec3||0xc8;return function(_0x3bc928){if(_0x3bc928){return _0x18429a[_0x58fd('0x1b')](_0x13aec3)['json'](_0x3bc928);}};}function respondWithFilteredResult(_0x264ded,_0x375d35){return function(_0x239aaf){if(_0x239aaf){var _0x132916=typeof _0x375d35['offset']===_0x58fd('0x1d')&&typeof _0x375d35[_0x58fd('0x1e')]==='undefined';var _0x18d963=_0x239aaf[_0x58fd('0x1f')];var _0x369fc9=_0x132916?0x0:_0x375d35[_0x58fd('0x20')];var _0x5b4952=_0x132916?_0x239aaf['count']:_0x375d35[_0x58fd('0x20')]+_0x375d35['limit'];var _0x424de4;if(_0x5b4952>=_0x18d963){_0x5b4952=_0x18d963;_0x424de4=0xc8;}else{_0x424de4=0xce;}_0x264ded['status'](_0x424de4);return _0x264ded[_0x58fd('0x21')](_0x58fd('0x22'),_0x369fc9+'-'+_0x5b4952+'/'+_0x18d963)['json'](_0x239aaf);}return null;};}function patchUpdates(_0x54673d){return function(_0x10833c){try{jsonpatch[_0x58fd('0x23')](_0x10833c,_0x54673d,!![]);}catch(_0x39c539){return BPromise[_0x58fd('0x24')](_0x39c539);}return _0x10833c[_0x58fd('0x25')]();};}function saveUpdates(_0x16b6c9,_0x3eb920){return function(_0x42cfbd){if(_0x42cfbd){return _0x42cfbd[_0x58fd('0x26')](_0x16b6c9)['then'](function(_0x452873){return _0x452873;});}return null;};}function removeEntity(_0x10d957,_0x122600){return function(_0x2f5358){if(_0x2f5358){return _0x2f5358[_0x58fd('0x27')]()[_0x58fd('0x28')](function(){var _0x20e7dc=_0x2f5358[_0x58fd('0x29')]({'plain':!![]});var _0x147498=_0x58fd('0x2a');return db[_0x58fd('0x2b')]['destroy']({'where':{'type':_0x147498,'resourceId':_0x20e7dc['id']}})['then'](function(){return _0x2f5358;});})['then'](function(){_0x10d957[_0x58fd('0x1b')](0xcc)[_0x58fd('0x1c')]();});}};}function handleEntityNotFound(_0x222390,_0x55acdb){return function(_0x5e53ee){if(!_0x5e53ee){_0x222390['sendStatus'](0x194);}return _0x5e53ee;};}function handleError(_0x1c3a5c,_0x5b4fb9){_0x5b4fb9=_0x5b4fb9||0x1f4;return function(_0x6484a1){logger[_0x58fd('0x2c')](_0x6484a1[_0x58fd('0x2d')]);if(_0x6484a1[_0x58fd('0x2e')]){delete _0x6484a1['name'];}_0x1c3a5c[_0x58fd('0x1b')](_0x5b4fb9)[_0x58fd('0x2f')](_0x6484a1);};}exports['index']=function(_0x28ef54,_0x67834b){var _0x4e53b1={},_0x4ff216={},_0x1dccdb={'count':0x0,'rows':[]};var _0x2bc626=_[_0x58fd('0x30')](db[_0x58fd('0x31')]['rawAttributes'],function(_0x1fc17d){return{'name':_0x1fc17d[_0x58fd('0x32')],'type':_0x1fc17d[_0x58fd('0x33')][_0x58fd('0x34')]};});_0x4ff216[_0x58fd('0x35')]=_[_0x58fd('0x30')](_0x2bc626,'name');_0x4ff216[_0x58fd('0x36')]=_[_0x58fd('0x37')](_0x28ef54[_0x58fd('0x36')]);_0x4ff216[_0x58fd('0x38')]=_['intersection'](_0x4ff216[_0x58fd('0x35')],_0x4ff216[_0x58fd('0x36')]);_0x4e53b1['attributes']=_[_0x58fd('0x39')](_0x4ff216[_0x58fd('0x35')],qs[_0x58fd('0x3a')](_0x28ef54['query'][_0x58fd('0x3a')]));_0x4e53b1[_0x58fd('0x3b')]=_0x4e53b1[_0x58fd('0x3b')][_0x58fd('0x3c')]?_0x4e53b1[_0x58fd('0x3b')]:_0x4ff216[_0x58fd('0x35')];if(!_0x28ef54[_0x58fd('0x36')][_0x58fd('0x3d')](_0x58fd('0x3e'))){_0x4e53b1[_0x58fd('0x1e')]=qs[_0x58fd('0x1e')](_0x28ef54[_0x58fd('0x36')][_0x58fd('0x1e')]);_0x4e53b1[_0x58fd('0x20')]=qs[_0x58fd('0x20')](_0x28ef54['query'][_0x58fd('0x20')]);}_0x4e53b1[_0x58fd('0x3f')]=qs[_0x58fd('0x40')](_0x28ef54[_0x58fd('0x36')][_0x58fd('0x40')]);_0x4e53b1[_0x58fd('0x41')]=qs[_0x58fd('0x38')](_[_0x58fd('0x42')](_0x28ef54[_0x58fd('0x36')],_0x4ff216[_0x58fd('0x38')]),_0x2bc626);if(_0x28ef54[_0x58fd('0x36')][_0x58fd('0x43')]){_0x4e53b1['where']=_['merge'](_0x4e53b1[_0x58fd('0x41')],{'$or':_[_0x58fd('0x30')](_0x2bc626,function(_0x34c4ee){if(_0x34c4ee[_0x58fd('0x33')]!==_0x58fd('0x44')){var _0x33e14e={};_0x33e14e[_0x34c4ee['name']]={'$like':'%'+_0x28ef54[_0x58fd('0x36')]['filter']+'%'};return _0x33e14e;}})});}_0x4e53b1=_[_0x58fd('0x45')]({},_0x4e53b1,_0x28ef54['options']);var _0x5a54b2={'where':_0x4e53b1[_0x58fd('0x41')]};return db[_0x58fd('0x31')][_0x58fd('0x1f')](_0x5a54b2)['then'](function(_0x271423){_0x1dccdb[_0x58fd('0x1f')]=_0x271423;if(_0x28ef54[_0x58fd('0x36')][_0x58fd('0x46')]){_0x4e53b1['include']=[{'all':!![]}];}return db['Pause'][_0x58fd('0x47')](_0x4e53b1);})['then'](function(_0x2516b5){_0x1dccdb[_0x58fd('0x48')]=_0x2516b5;return _0x1dccdb;})[_0x58fd('0x28')](respondWithFilteredResult(_0x67834b,_0x4e53b1))[_0x58fd('0x49')](handleError(_0x67834b,null));};exports[_0x58fd('0x4a')]=function(_0x10b137,_0x458c15){var _0x3edbe2={'raw':!![],'where':{'id':_0x10b137[_0x58fd('0x4b')]['id']}},_0x39f209={};_0x39f209[_0x58fd('0x35')]=_['keys'](db[_0x58fd('0x31')][_0x58fd('0x4c')]);_0x39f209[_0x58fd('0x36')]=_[_0x58fd('0x37')](_0x10b137['query']);_0x39f209[_0x58fd('0x38')]=_[_0x58fd('0x39')](_0x39f209['model'],_0x39f209[_0x58fd('0x36')]);_0x3edbe2[_0x58fd('0x3b')]=_[_0x58fd('0x39')](_0x39f209['model'],qs['fields'](_0x10b137['query'][_0x58fd('0x3a')]));_0x3edbe2[_0x58fd('0x3b')]=_0x3edbe2[_0x58fd('0x3b')]['length']?_0x3edbe2[_0x58fd('0x3b')]:_0x39f209[_0x58fd('0x35')];if(_0x10b137[_0x58fd('0x36')]['includeAll']){_0x3edbe2[_0x58fd('0x4d')]=[{'all':!![]}];}_0x3edbe2=_[_0x58fd('0x45')]({},_0x3edbe2,_0x10b137[_0x58fd('0x4e')]);return db[_0x58fd('0x31')][_0x58fd('0x4f')](_0x3edbe2)['then'](handleEntityNotFound(_0x458c15,null))['then'](respondWithResult(_0x458c15,null))['catch'](handleError(_0x458c15,null));};exports[_0x58fd('0x50')]=function(_0x54123f,_0x5e17d0){return db[_0x58fd('0x31')]['create'](_0x54123f[_0x58fd('0x51')],{})['then'](function(_0x4a950b){var _0x341cd3=_0x54123f[_0x58fd('0x52')][_0x58fd('0x29')]({'plain':!![]});if(!_0x341cd3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x341cd3['role']===_0x58fd('0x52')){var _0x1cabda=_0x4a950b[_0x58fd('0x29')]({'plain':!![]});var _0x58c9d0='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x58c9d0,'userProfileId':_0x341cd3[_0x58fd('0x53')]},'raw':!![]})['then'](function(_0x59affa){if(_0x59affa&&_0x59affa[_0x58fd('0x54')]===0x0){return db[_0x58fd('0x2b')][_0x58fd('0x50')]({'name':_0x1cabda[_0x58fd('0x2e')],'resourceId':_0x1cabda['id'],'type':_0x59affa[_0x58fd('0x2e')],'sectionId':_0x59affa['id']},{})[_0x58fd('0x28')](function(){return _0x4a950b;});}else{return _0x4a950b;}})[_0x58fd('0x49')](function(_0x3bf17a){logger[_0x58fd('0x2c')](_0x58fd('0x55'),_0x3bf17a);throw _0x3bf17a;});}return _0x4a950b;})['then'](respondWithResult(_0x5e17d0,0xc9))[_0x58fd('0x49')](handleError(_0x5e17d0,null));};exports[_0x58fd('0x26')]=function(_0x12c6cf,_0x3be75c){if(_0x12c6cf[_0x58fd('0x51')]['id']){delete _0x12c6cf[_0x58fd('0x51')]['id'];}return db[_0x58fd('0x31')][_0x58fd('0x4f')]({'where':{'id':_0x12c6cf[_0x58fd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3be75c,null))['then'](saveUpdates(_0x12c6cf[_0x58fd('0x51')],null))['then'](respondWithResult(_0x3be75c,null))['catch'](handleError(_0x3be75c,null));};exports[_0x58fd('0x27')]=function(_0x4891ac,_0x324cc9){return db[_0x58fd('0x31')][_0x58fd('0x4f')]({'where':{'id':_0x4891ac[_0x58fd('0x4b')]['id']}})[_0x58fd('0x28')](handleEntityNotFound(_0x324cc9,null))[_0x58fd('0x28')](removeEntity(_0x324cc9,null))[_0x58fd('0x49')](handleError(_0x324cc9,null));}; \ No newline at end of file +var _0x27cb=['rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','reject','save','update','then','destroy','get','name','send','index','Pause'];(function(_0x3f9ff7,_0x187ae0){var _0x5bf44e=function(_0x45d4cd){while(--_0x45d4cd){_0x3f9ff7['push'](_0x3f9ff7['shift']());}};_0x5bf44e(++_0x187ae0);}(_0x27cb,0x1b1));var _0xb27c=function(_0x1d0dad,_0x1e00f9){_0x1d0dad=_0x1d0dad-0x0;var _0x560ed1=_0x27cb[_0x1d0dad];return _0x560ed1;};'use strict';var emlformat=require(_0xb27c('0x0'));var rimraf=require(_0xb27c('0x1'));var zipdir=require(_0xb27c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb27c('0x3'));var moment=require(_0xb27c('0x4'));var BPromise=require(_0xb27c('0x5'));var Mustache=require(_0xb27c('0x6'));var util=require(_0xb27c('0x7'));var path=require(_0xb27c('0x8'));var sox=require(_0xb27c('0x9'));var csv=require(_0xb27c('0xa'));var ejs=require(_0xb27c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb27c('0xc'));var crypto=require('crypto');var jsforce=require(_0xb27c('0xd'));var deskjs=require(_0xb27c('0xe'));var toCsv=require(_0xb27c('0xa'));var querystring=require('querystring');var Papa=require(_0xb27c('0xf'));var Redis=require('ioredis');var authService=require(_0xb27c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb27c('0x11'));var hardwareService=require(_0xb27c('0x12'));var logger=require(_0xb27c('0x13'))(_0xb27c('0x14'));var utils=require(_0xb27c('0x15'));var config=require(_0xb27c('0x16'));var licenseUtil=require(_0xb27c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2495ab,_0x4f713d){_0x4f713d=_0x4f713d||0xcc;return function(_0x41ac4e){if(_0x41ac4e){return _0x2495ab[_0xb27c('0x18')](_0x4f713d);}return _0x2495ab[_0xb27c('0x19')](_0x4f713d)[_0xb27c('0x1a')]();};}function respondWithResult(_0x4f2394,_0x41516f){_0x41516f=_0x41516f||0xc8;return function(_0x56962b){if(_0x56962b){return _0x4f2394['status'](_0x41516f)['json'](_0x56962b);}};}function respondWithFilteredResult(_0x2e96e5,_0x283db8){return function(_0x57d0fa){if(_0x57d0fa){var _0x599860=typeof _0x283db8[_0xb27c('0x1b')]==='undefined'&&typeof _0x283db8[_0xb27c('0x1c')]==='undefined';var _0x5f3219=_0x57d0fa[_0xb27c('0x1d')];var _0x91a80a=_0x599860?0x0:_0x283db8[_0xb27c('0x1b')];var _0x2a94c9=_0x599860?_0x57d0fa[_0xb27c('0x1d')]:_0x283db8[_0xb27c('0x1b')]+_0x283db8['limit'];var _0x5dd4cb;if(_0x2a94c9>=_0x5f3219){_0x2a94c9=_0x5f3219;_0x5dd4cb=0xc8;}else{_0x5dd4cb=0xce;}_0x2e96e5[_0xb27c('0x19')](_0x5dd4cb);return _0x2e96e5['set'](_0xb27c('0x1e'),_0x91a80a+'-'+_0x2a94c9+'/'+_0x5f3219)['json'](_0x57d0fa);}return null;};}function patchUpdates(_0xe0e0ae){return function(_0xfbcbd1){try{jsonpatch['apply'](_0xfbcbd1,_0xe0e0ae,!![]);}catch(_0x54e102){return BPromise[_0xb27c('0x1f')](_0x54e102);}return _0xfbcbd1[_0xb27c('0x20')]();};}function saveUpdates(_0x399314,_0xe10d10){return function(_0x5475ca){if(_0x5475ca){return _0x5475ca[_0xb27c('0x21')](_0x399314)[_0xb27c('0x22')](function(_0x519eea){return _0x519eea;});}return null;};}function removeEntity(_0x3a7ab9,_0x2593e8){return function(_0x356694){if(_0x356694){return _0x356694[_0xb27c('0x23')]()[_0xb27c('0x22')](function(){var _0x3d55b7=_0x356694[_0xb27c('0x24')]({'plain':!![]});var _0x38130d='Pauses';return db['UserProfileResource'][_0xb27c('0x23')]({'where':{'type':_0x38130d,'resourceId':_0x3d55b7['id']}})[_0xb27c('0x22')](function(){return _0x356694;});})['then'](function(){_0x3a7ab9['status'](0xcc)[_0xb27c('0x1a')]();});}};}function handleEntityNotFound(_0x5652a0,_0x453725){return function(_0x335d04){if(!_0x335d04){_0x5652a0[_0xb27c('0x18')](0x194);}return _0x335d04;};}function handleError(_0xad63eb,_0x73eee6){_0x73eee6=_0x73eee6||0x1f4;return function(_0x59b02d){logger['error'](_0x59b02d['stack']);if(_0x59b02d[_0xb27c('0x25')]){delete _0x59b02d[_0xb27c('0x25')];}_0xad63eb[_0xb27c('0x19')](_0x73eee6)[_0xb27c('0x26')](_0x59b02d);};}exports[_0xb27c('0x27')]=function(_0x2618a2,_0x1eafba){var _0x4d9c64={},_0x22898a={},_0x16f9b2={'count':0x0,'rows':[]};var _0x1c0e77=_['map'](db[_0xb27c('0x28')][_0xb27c('0x29')],function(_0x4669af){return{'name':_0x4669af[_0xb27c('0x2a')],'type':_0x4669af['type'][_0xb27c('0x2b')]};});_0x22898a[_0xb27c('0x2c')]=_['map'](_0x1c0e77,_0xb27c('0x25'));_0x22898a['query']=_['keys'](_0x2618a2['query']);_0x22898a[_0xb27c('0x2d')]=_[_0xb27c('0x2e')](_0x22898a[_0xb27c('0x2c')],_0x22898a[_0xb27c('0x2f')]);_0x4d9c64[_0xb27c('0x30')]=_[_0xb27c('0x2e')](_0x22898a[_0xb27c('0x2c')],qs[_0xb27c('0x31')](_0x2618a2['query']['fields']));_0x4d9c64[_0xb27c('0x30')]=_0x4d9c64[_0xb27c('0x30')]['length']?_0x4d9c64['attributes']:_0x22898a[_0xb27c('0x2c')];if(!_0x2618a2['query']['hasOwnProperty']('nolimit')){_0x4d9c64[_0xb27c('0x1c')]=qs[_0xb27c('0x1c')](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x1c')]);_0x4d9c64[_0xb27c('0x1b')]=qs[_0xb27c('0x1b')](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x1b')]);}_0x4d9c64[_0xb27c('0x32')]=qs['sort'](_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x33')]);_0x4d9c64[_0xb27c('0x34')]=qs[_0xb27c('0x2d')](_[_0xb27c('0x35')](_0x2618a2[_0xb27c('0x2f')],_0x22898a['filters']),_0x1c0e77);if(_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x36')]){_0x4d9c64['where']=_[_0xb27c('0x37')](_0x4d9c64[_0xb27c('0x34')],{'$or':_['map'](_0x1c0e77,function(_0xcaaf17){if(_0xcaaf17[_0xb27c('0x38')]!=='VIRTUAL'){var _0x1e7c9f={};_0x1e7c9f[_0xcaaf17['name']]={'$like':'%'+_0x2618a2['query'][_0xb27c('0x36')]+'%'};return _0x1e7c9f;}})});}_0x4d9c64=_[_0xb27c('0x37')]({},_0x4d9c64,_0x2618a2[_0xb27c('0x39')]);var _0x51c128={'where':_0x4d9c64[_0xb27c('0x34')]};return db[_0xb27c('0x28')][_0xb27c('0x1d')](_0x51c128)[_0xb27c('0x22')](function(_0x40f740){_0x16f9b2[_0xb27c('0x1d')]=_0x40f740;if(_0x2618a2[_0xb27c('0x2f')][_0xb27c('0x3a')]){_0x4d9c64[_0xb27c('0x3b')]=[{'all':!![]}];}return db[_0xb27c('0x28')][_0xb27c('0x3c')](_0x4d9c64);})[_0xb27c('0x22')](function(_0x1fe373){_0x16f9b2[_0xb27c('0x3d')]=_0x1fe373;return _0x16f9b2;})[_0xb27c('0x22')](respondWithFilteredResult(_0x1eafba,_0x4d9c64))[_0xb27c('0x3e')](handleError(_0x1eafba,null));};exports[_0xb27c('0x3f')]=function(_0x2d4024,_0x2a77f0){var _0x2e49b1={'raw':!![],'where':{'id':_0x2d4024['params']['id']}},_0x39a27c={};_0x39a27c['model']=_[_0xb27c('0x40')](db[_0xb27c('0x28')]['rawAttributes']);_0x39a27c[_0xb27c('0x2f')]=_[_0xb27c('0x40')](_0x2d4024[_0xb27c('0x2f')]);_0x39a27c['filters']=_[_0xb27c('0x2e')](_0x39a27c[_0xb27c('0x2c')],_0x39a27c[_0xb27c('0x2f')]);_0x2e49b1[_0xb27c('0x30')]=_['intersection'](_0x39a27c[_0xb27c('0x2c')],qs[_0xb27c('0x31')](_0x2d4024[_0xb27c('0x2f')][_0xb27c('0x31')]));_0x2e49b1[_0xb27c('0x30')]=_0x2e49b1[_0xb27c('0x30')][_0xb27c('0x41')]?_0x2e49b1[_0xb27c('0x30')]:_0x39a27c[_0xb27c('0x2c')];if(_0x2d4024[_0xb27c('0x2f')]['includeAll']){_0x2e49b1[_0xb27c('0x3b')]=[{'all':!![]}];}_0x2e49b1=_[_0xb27c('0x37')]({},_0x2e49b1,_0x2d4024[_0xb27c('0x39')]);return db[_0xb27c('0x28')][_0xb27c('0x42')](_0x2e49b1)['then'](handleEntityNotFound(_0x2a77f0,null))[_0xb27c('0x22')](respondWithResult(_0x2a77f0,null))[_0xb27c('0x3e')](handleError(_0x2a77f0,null));};exports[_0xb27c('0x43')]=function(_0x131106,_0xf70894){return db[_0xb27c('0x28')][_0xb27c('0x43')](_0x131106[_0xb27c('0x44')],{})[_0xb27c('0x22')](function(_0x3480fa){var _0xaab730=_0x131106[_0xb27c('0x45')][_0xb27c('0x24')]({'plain':!![]});if(!_0xaab730)throw new Error(_0xb27c('0x46'));if(_0xaab730[_0xb27c('0x47')]==='user'){var _0x326dc6=_0x3480fa[_0xb27c('0x24')]({'plain':!![]});var _0x2e1e0d=_0xb27c('0x48');return db[_0xb27c('0x49')][_0xb27c('0x42')]({'where':{'name':_0x2e1e0d,'userProfileId':_0xaab730['userProfileId']},'raw':!![]})[_0xb27c('0x22')](function(_0x4b4cc1){if(_0x4b4cc1&&_0x4b4cc1[_0xb27c('0x4a')]===0x0){return db[_0xb27c('0x4b')]['create']({'name':_0x326dc6[_0xb27c('0x25')],'resourceId':_0x326dc6['id'],'type':_0x4b4cc1['name'],'sectionId':_0x4b4cc1['id']},{})[_0xb27c('0x22')](function(){return _0x3480fa;});}else{return _0x3480fa;}})[_0xb27c('0x3e')](function(_0x3df82b){logger[_0xb27c('0x4c')](_0xb27c('0x4d'),_0x3df82b);throw _0x3df82b;});}return _0x3480fa;})[_0xb27c('0x22')](respondWithResult(_0xf70894,0xc9))['catch'](handleError(_0xf70894,null));};exports[_0xb27c('0x21')]=function(_0x1c208e,_0x541fc1){if(_0x1c208e['body']['id']){delete _0x1c208e[_0xb27c('0x44')]['id'];}return db[_0xb27c('0x28')][_0xb27c('0x42')]({'where':{'id':_0x1c208e[_0xb27c('0x4e')]['id']}})[_0xb27c('0x22')](handleEntityNotFound(_0x541fc1,null))[_0xb27c('0x22')](saveUpdates(_0x1c208e[_0xb27c('0x44')],null))[_0xb27c('0x22')](respondWithResult(_0x541fc1,null))[_0xb27c('0x3e')](handleError(_0x541fc1,null));};exports[_0xb27c('0x23')]=function(_0x3155f9,_0x1f684d){return db[_0xb27c('0x28')]['find']({'where':{'id':_0x3155f9[_0xb27c('0x4e')]['id']}})[_0xb27c('0x22')](handleEntityNotFound(_0x1f684d,null))[_0xb27c('0x22')](removeEntity(_0x1f684d,null))[_0xb27c('0x3e')](handleError(_0x1f684d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index baa6251..7979972 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2bf1ea,_0x2171eb){_0x2bf1ea=_0x2bf1ea-0x0;var _0x43c02b=_0x8ef6[_0x2bf1ea];return _0x43c02b;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'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 4809a7a..3ff278e 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(_0x1757c9,_0x23707d){var _0x102ba9=function(_0x4c4b4b){while(--_0x4c4b4b){_0x1757c9['push'](_0x1757c9['shift']());}};_0x102ba9(++_0x23707d);}(_0x7a54,0x106));var _0x47a5=function(_0x5a89e8,_0x27a1f7){_0x5a89e8=_0x5a89e8-0x0;var _0x542b29=_0x7a54[_0x5a89e8];return _0x542b29;};'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(_0x2ec2f7,_0x399e63){var _0x5a52d5=function(_0x525dfb){while(--_0x525dfb){_0x2ec2f7['push'](_0x2ec2f7['shift']());}};_0x5a52d5(++_0x399e63);}(_0x7a54,0x106));var _0x47a5=function(_0x147e8e,_0x12b71d){_0x147e8e=_0x147e8e-0x0;var _0x52742c=_0x7a54[_0x147e8e];return _0x52742c;};'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 a7b33a7..03952df 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 _0xbec5=['get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','upload','webhookPost','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x1c7e44,_0x27bbbd){var _0xce7e9=function(_0x595233){while(--_0x595233){_0x1c7e44['push'](_0x1c7e44['shift']());}};_0xce7e9(++_0x27bbbd);}(_0xbec5,0xe5));var _0x5bec=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xbec5[_0x31a938];return _0x1bf341;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),controller[_0x5bec('0xc')]);router[_0x5bec('0x9')](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0xf')]);router['get'](_0x5bec('0x10'),auth['isAuthenticated'](),controller[_0x5bec('0x11')]);var upload=multer({'storage':multer[_0x5bec('0x12')]({'destination':function(_0x117162,_0x4a5482,_0x288d1b){_0x288d1b(null,path[_0x5bec('0x13')](config[_0x5bec('0x14')],'server/files/plugins'));},'filename':function(_0x6bee21,_0x1c888f,_0x589d14){_0x1c888f[_0x5bec('0x15')]=_0x1c888f[_0x5bec('0x15')][_0x5bec('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589d14(null,util[_0x5bec('0x17')](_0x5bec('0x18'),path[_0x5bec('0x19')](_0x1c888f[_0x5bec('0x15')],path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])),Date[_0x5bec('0x1b')](),path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])));}})});router[_0x5bec('0x1c')]('/',upload['single']('file'),controller[_0x5bec('0x1d')]);router[_0x5bec('0x1c')](_0x5bec('0xb'),controller[_0x5bec('0x1e')]);router['put']('/:id',auth[_0x5bec('0xe')](),controller[_0x5bec('0x1f')]);router['delete'](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0x20')]);module[_0x5bec('0x21')]=router; \ No newline at end of file +var _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0xb7ff96,_0x25837a){var _0x205e45=function(_0x4856d1){while(--_0x4856d1){_0xb7ff96['push'](_0xb7ff96['shift']());}};_0x205e45(++_0x25837a);}(_0xc874,0x154));var _0x4c87=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xc874[_0x1c510a];return _0x23cedd;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c76e95f..012e7ae 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 _0xdd06=['sequelize','exports','STRING','ENUM','html','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never'];(function(_0x17314d,_0x9082f8){var _0x2d6750=function(_0x4cef61){while(--_0x4cef61){_0x17314d['push'](_0x17314d['shift']());}};_0x2d6750(++_0x9082f8);}(_0xdd06,0x84));var _0x6dd0=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xdd06[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x6dd0('0x0'));module[_0x6dd0('0x1')]={'name':{'type':Sequelize[_0x6dd0('0x2')]},'type':{'type':Sequelize[_0x6dd0('0x3')](_0x6dd0('0x4'),'script')},'description':{'type':Sequelize[_0x6dd0('0x5')]},'version':{'type':Sequelize[_0x6dd0('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x6dd0('0x6')],'defaultValue':0x0,'comment':_0x6dd0('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x6dd0('0x8'),_0x6dd0('0x9'),_0x6dd0('0xa')),'defaultValue':_0x6dd0('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x6dd0('0x2')]},'adminUrl':{'type':Sequelize[_0x6dd0('0x2')]},'agentUrl':{'type':Sequelize[_0x6dd0('0x2')]},'scriptName':{'type':Sequelize[_0x6dd0('0x2')]},'scriptPath':{'type':Sequelize[_0x6dd0('0x2')]}}; \ No newline at end of file +var _0x1c9e=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x437aa2,_0x48d508){var _0x28ac4d=function(_0x4afc37){while(--_0x4afc37){_0x437aa2['push'](_0x437aa2['shift']());}};_0x28ac4d(++_0x48d508);}(_0x1c9e,0xd5));var _0xe1c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1c9('0x0')]={'name':{'type':Sequelize[_0xe1c9('0x1')]},'type':{'type':Sequelize[_0xe1c9('0x2')](_0xe1c9('0x3'),_0xe1c9('0x4'))},'description':{'type':Sequelize[_0xe1c9('0x5')]},'version':{'type':Sequelize[_0xe1c9('0x5')]},'path':{'type':Sequelize[_0xe1c9('0x1')],'comment':_0xe1c9('0x6')},'active':{'type':Sequelize[_0xe1c9('0x7')],'defaultValue':0x0,'comment':_0xe1c9('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xe1c9('0x9'),_0xe1c9('0xa'),_0xe1c9('0xb')),'defaultValue':'always','comment':_0xe1c9('0xc')},'icon':{'type':Sequelize[_0xe1c9('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe1c9('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 90e49ff..4f6097a 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 _0xf246=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','name','index','map','Plugin','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','keys','rawAttributes','include','find','download','join','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root','attachments/**/*','finalize','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver'];(function(_0x939a59,_0x174b9d){var _0x37206e=function(_0x5473d0){while(--_0x5473d0){_0x939a59['push'](_0x939a59['shift']());}};_0x37206e(++_0x174b9d);}(_0xf246,0x1d7));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6f24('0x0'));var rimraf=require(_0x6f24('0x1'));var zipdir=require(_0x6f24('0x2'));var jsonpatch=require(_0x6f24('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6f24('0x4'));var Mustache=require(_0x6f24('0x5'));var util=require('util');var path=require(_0x6f24('0x6'));var sox=require(_0x6f24('0x7'));var csv=require(_0x6f24('0x8'));var ejs=require(_0x6f24('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f24('0xa'));var squel=require(_0x6f24('0xb'));var crypto=require(_0x6f24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6f24('0xd'));var toCsv=require(_0x6f24('0x8'));var querystring=require(_0x6f24('0xe'));var Papa=require(_0x6f24('0xf'));var extract=require(_0x6f24('0x10'));var rimraf=require('rimraf');var archiver=require(_0x6f24('0x11'));var Redis=require(_0x6f24('0x12'));var authService=require(_0x6f24('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6f24('0x14'));var hardwareService=require(_0x6f24('0x15'));var logger=require('../../config/logger')(_0x6f24('0x16'));var utils=require('../../config/utils');var config=require(_0x6f24('0x17'));var licenseUtil=require(_0x6f24('0x18'));var db=require('../../mysqldb')['db'];config[_0x6f24('0x19')]=_[_0x6f24('0x1a')](config[_0x6f24('0x19')],{'host':_0x6f24('0x1b'),'port':0x18eb});var socket=require(_0x6f24('0x1c'))(new Redis(config[_0x6f24('0x19')]));require(_0x6f24('0x1d'))[_0x6f24('0x1e')](socket);function respondWithStatusCode(_0x4f3a8c,_0x48d55d){_0x48d55d=_0x48d55d||0xcc;return function(_0x193780){if(_0x193780){return _0x4f3a8c[_0x6f24('0x1f')](_0x48d55d);}return _0x4f3a8c[_0x6f24('0x20')](_0x48d55d)[_0x6f24('0x21')]();};}function respondWithResult(_0x2e85af,_0x47ba0b){_0x47ba0b=_0x47ba0b||0xc8;return function(_0x28f68a){if(_0x28f68a){return _0x2e85af[_0x6f24('0x20')](_0x47ba0b)[_0x6f24('0x22')](_0x28f68a);}};}function respondWithFilteredResult(_0x591991,_0xa7e6d0){return function(_0x1126f7){if(_0x1126f7){var _0x4ce3ca=typeof _0xa7e6d0[_0x6f24('0x23')]===_0x6f24('0x24')&&typeof _0xa7e6d0[_0x6f24('0x25')]===_0x6f24('0x24');var _0x4836e4=_0x1126f7[_0x6f24('0x26')];var _0x236354=_0x4ce3ca?0x0:_0xa7e6d0[_0x6f24('0x23')];var _0x270695=_0x4ce3ca?_0x1126f7[_0x6f24('0x26')]:_0xa7e6d0[_0x6f24('0x23')]+_0xa7e6d0['limit'];var _0x425479;if(_0x270695>=_0x4836e4){_0x270695=_0x4836e4;_0x425479=0xc8;}else{_0x425479=0xce;}_0x591991[_0x6f24('0x20')](_0x425479);return _0x591991[_0x6f24('0x27')](_0x6f24('0x28'),_0x236354+'-'+_0x270695+'/'+_0x4836e4)[_0x6f24('0x22')](_0x1126f7);}return null;};}function patchUpdates(_0x19e9ac){return function(_0x292414){try{jsonpatch[_0x6f24('0x29')](_0x292414,_0x19e9ac,!![]);}catch(_0x244767){return BPromise[_0x6f24('0x2a')](_0x244767);}return _0x292414[_0x6f24('0x2b')]();};}function saveUpdates(_0x3b62d7,_0x317c22){return function(_0x5aff4f){if(_0x5aff4f){return _0x5aff4f[_0x6f24('0x2c')](_0x3b62d7)['then'](function(_0x1e5048){return _0x1e5048;});}return null;};}function removeEntity(_0x30b08b,_0x1e495a){return function(_0x1cc6cd){if(_0x1cc6cd){return _0x1cc6cd[_0x6f24('0x2d')]()[_0x6f24('0x2e')](function(){var _0x1a6c76=_0x1cc6cd[_0x6f24('0x2f')]({'plain':!![]});var _0x674bc8=_0x6f24('0x30');return db[_0x6f24('0x31')][_0x6f24('0x2d')]({'where':{'type':_0x674bc8,'resourceId':_0x1a6c76['id']}})[_0x6f24('0x2e')](function(){return _0x1cc6cd;});})[_0x6f24('0x2e')](function(){_0x30b08b[_0x6f24('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x242d5e,_0x57496e){return function(_0x1ddc53){if(!_0x1ddc53){_0x242d5e[_0x6f24('0x1f')](0x194);}return _0x1ddc53;};}function handleError(_0x23f32e,_0x17cd65){_0x17cd65=_0x17cd65||0x1f4;return function(_0x1d6303){logger[_0x6f24('0x32')](_0x1d6303['stack']);if(_0x1d6303[_0x6f24('0x33')]){delete _0x1d6303[_0x6f24('0x33')];}_0x23f32e['status'](_0x17cd65)['send'](_0x1d6303);};}exports[_0x6f24('0x34')]=function(_0x1499ba,_0x45158b){var _0x1366f2={},_0xbec75c={},_0x5ce40e={'count':0x0,'rows':[]};var _0x18ee17=_[_0x6f24('0x35')](db[_0x6f24('0x36')]['rawAttributes'],function(_0x4bed3d){return{'name':_0x4bed3d[_0x6f24('0x37')],'type':_0x4bed3d[_0x6f24('0x38')][_0x6f24('0x39')]};});_0xbec75c[_0x6f24('0x3a')]=_[_0x6f24('0x35')](_0x18ee17,'name');_0xbec75c[_0x6f24('0x3b')]=_['keys'](_0x1499ba[_0x6f24('0x3b')]);_0xbec75c['filters']=_[_0x6f24('0x3c')](_0xbec75c[_0x6f24('0x3a')],_0xbec75c[_0x6f24('0x3b')]);_0x1366f2[_0x6f24('0x3d')]=_['intersection'](_0xbec75c[_0x6f24('0x3a')],qs[_0x6f24('0x3e')](_0x1499ba['query'][_0x6f24('0x3e')]));_0x1366f2[_0x6f24('0x3d')]=_0x1366f2[_0x6f24('0x3d')][_0x6f24('0x3f')]?_0x1366f2[_0x6f24('0x3d')]:_0xbec75c[_0x6f24('0x3a')];if(!_0x1499ba['query']['hasOwnProperty'](_0x6f24('0x40'))){_0x1366f2[_0x6f24('0x25')]=qs['limit'](_0x1499ba['query']['limit']);_0x1366f2[_0x6f24('0x23')]=qs['offset'](_0x1499ba[_0x6f24('0x3b')][_0x6f24('0x23')]);}_0x1366f2[_0x6f24('0x41')]=qs['sort'](_0x1499ba['query'][_0x6f24('0x42')]);_0x1366f2[_0x6f24('0x43')]=qs[_0x6f24('0x44')](_['pick'](_0x1499ba[_0x6f24('0x3b')],_0xbec75c[_0x6f24('0x44')]),_0x18ee17);if(_0x1499ba[_0x6f24('0x3b')]['filter']){_0x1366f2['where']=_[_0x6f24('0x45')](_0x1366f2[_0x6f24('0x43')],{'$or':_[_0x6f24('0x35')](_0x18ee17,function(_0x11a259){if(_0x11a259['type']!==_0x6f24('0x46')){var _0x74efae={};_0x74efae[_0x11a259[_0x6f24('0x33')]]={'$like':'%'+_0x1499ba[_0x6f24('0x3b')][_0x6f24('0x47')]+'%'};return _0x74efae;}})});}_0x1366f2=_['merge']({},_0x1366f2,_0x1499ba[_0x6f24('0x48')]);var _0x1e3f56={'where':_0x1366f2[_0x6f24('0x43')]};return db['Plugin']['count'](_0x1e3f56)[_0x6f24('0x2e')](function(_0x15647e){_0x5ce40e[_0x6f24('0x26')]=_0x15647e;if(_0x1499ba[_0x6f24('0x3b')][_0x6f24('0x49')]){_0x1366f2['include']=[{'all':!![]}];}return db[_0x6f24('0x36')][_0x6f24('0x4a')](_0x1366f2);})[_0x6f24('0x2e')](function(_0x1c99bd){_0x5ce40e['rows']=_0x1c99bd;return _0x5ce40e;})[_0x6f24('0x2e')](respondWithFilteredResult(_0x45158b,_0x1366f2))[_0x6f24('0x4b')](handleError(_0x45158b,null));};exports['show']=function(_0x3c51b7,_0x15aa58){var _0x10bc57={'raw':!![],'where':{'id':_0x3c51b7[_0x6f24('0x4c')]['id']}},_0x3f879e={};_0x3f879e[_0x6f24('0x3a')]=_[_0x6f24('0x4d')](db['Plugin'][_0x6f24('0x4e')]);_0x3f879e['query']=_[_0x6f24('0x4d')](_0x3c51b7['query']);_0x3f879e['filters']=_[_0x6f24('0x3c')](_0x3f879e[_0x6f24('0x3a')],_0x3f879e[_0x6f24('0x3b')]);_0x10bc57[_0x6f24('0x3d')]=_['intersection'](_0x3f879e[_0x6f24('0x3a')],qs[_0x6f24('0x3e')](_0x3c51b7[_0x6f24('0x3b')]['fields']));_0x10bc57[_0x6f24('0x3d')]=_0x10bc57[_0x6f24('0x3d')][_0x6f24('0x3f')]?_0x10bc57[_0x6f24('0x3d')]:_0x3f879e[_0x6f24('0x3a')];if(_0x3c51b7[_0x6f24('0x3b')][_0x6f24('0x49')]){_0x10bc57[_0x6f24('0x4f')]=[{'all':!![]}];}_0x10bc57=_[_0x6f24('0x45')]({},_0x10bc57,_0x3c51b7['options']);return db[_0x6f24('0x36')][_0x6f24('0x50')](_0x10bc57)[_0x6f24('0x2e')](handleEntityNotFound(_0x15aa58,null))['then'](respondWithResult(_0x15aa58,null))[_0x6f24('0x4b')](handleError(_0x15aa58,null));};exports[_0x6f24('0x51')]=function(_0x7f824d,_0x208080,_0x24d8a6){return db['Plugin'][_0x6f24('0x50')]({'where':{'id':_0x7f824d[_0x6f24('0x4c')]['id']},'attributes':[_0x6f24('0x33'),_0x6f24('0x6')],'raw':!![]})[_0x6f24('0x2e')](handleEntityNotFound(_0x208080,null))[_0x6f24('0x2e')](function(_0x40a638){if(_0x40a638){var _0xf682b0=path[_0x6f24('0x52')](config['root'],_0x6f24('0x53'),util[_0x6f24('0x54')]('%s.zip',path[_0x6f24('0x55')](_0x40a638[_0x6f24('0x6')])));var _0x4d011e=fs[_0x6f24('0x56')](_0xf682b0);var _0x25e997=archiver(_0x6f24('0x57'),{'zlib':{'level':0x9}});_0x25e997['on']('warning',function(_0x5d205c){if(_0x5d205c[_0x6f24('0x58')]===_0x6f24('0x59')){logger[_0x6f24('0x32')](_0x5d205c);}else{throw new db[(_0x6f24('0x5a'))][(_0x6f24('0x5b'))](_0x6f24('0x5c'));}});_0x25e997['on'](_0x6f24('0x32'),function(_0x5d9646){throw new db['Sequelize'][(_0x6f24('0x5b'))](_0x6f24('0x5c'));});_0x25e997[_0x6f24('0x5d')](_0x4d011e);_0x25e997[_0x6f24('0x5e')]('**/*',{'cwd':path[_0x6f24('0x52')](config[_0x6f24('0x5f')],'server/files/plugins',path['dirname'](_0x40a638[_0x6f24('0x6')])),'ignore':[path['join'](path[_0x6f24('0x55')](_0x40a638['path']),'node_modules/**/*'),path[_0x6f24('0x52')](path[_0x6f24('0x55')](_0x40a638['path']),_0x6f24('0x60'))],'nodir':!![]})[_0x6f24('0x61')]();_0x4d011e['on'](_0x6f24('0x62'),function(){if(!fs[_0x6f24('0x63')](_0xf682b0)){throw new db[(_0x6f24('0x5a'))]['Error']('Plugin\x20not\x20found');}return _0x208080[_0x6f24('0x51')](_0xf682b0,util[_0x6f24('0x54')](_0x6f24('0x64'),path['basename'](_0x40a638[_0x6f24('0x6')])),function(_0x339cf0){if(_0x339cf0){throw new db[(_0x6f24('0x5a'))][(_0x6f24('0x5b'))](_0x6f24('0x65'));}fs['unlinkSync'](_0xf682b0);logger[_0x6f24('0x66')]('Download\x20completed');logger[_0x6f24('0x66')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x208080,null));};exports[_0x6f24('0x67')]=function(_0x1a740d,_0x1c423a,_0x29f633){var _0x39c49b=path['basename'](_0x1a740d[_0x6f24('0x68')][_0x6f24('0x69')],path['extname'](_0x1a740d[_0x6f24('0x68')][_0x6f24('0x69')]));var _0x1df326=path['join'](config[_0x6f24('0x5f')],_0x6f24('0x53'),_0x1a740d[_0x6f24('0x68')]['filename']);var _0x1199b1=path[_0x6f24('0x52')](config[_0x6f24('0x5f')],'server/files/plugins',_0x39c49b);logger['info'](_0x6f24('0x6a'),_0x1df326);logger[_0x6f24('0x66')](_0x6f24('0x6b'),_0x1199b1);try{fs[_0x6f24('0x6c')](_0x1df326,parseInt(_0x6f24('0x6d'),0x8));extract(_0x1df326,{'dir':_0x1199b1},function(_0x5e1ced){if(_0x5e1ced){logger[_0x6f24('0x32')](_0x5e1ced);handleError(_0x5e1ced,!![]);};var _0x24c574=fs['readdirSync'](_0x1199b1);if(_0x24c574['length']>0x1){removeReferences(_0x1df326,_0x1199b1);logger[_0x6f24('0x32')](_0x6f24('0x6e'));return _0x29f633(new Error(_0x6f24('0x6e')));}var _0x2030f2=fs['lstatSync'](path[_0x6f24('0x52')](_0x1199b1,_0x24c574[0x0]));if(_0x2030f2[_0x6f24('0x6f')]()){removeReferences(_0x1df326,_0x1199b1);logger[_0x6f24('0x32')](_0x6f24('0x6e'));return _0x29f633(new Error(_0x6f24('0x6e')));}if(_0x2030f2['isDirectory']()){var _0x58d2bc=fs['readdirSync'](path[_0x6f24('0x52')](_0x1199b1,_0x24c574[0x0]));if(_0x58d2bc[_0x6f24('0x3f')]===0x0){removeReferences(_0x1df326,_0x1199b1);logger[_0x6f24('0x32')](_0x6f24('0x6e'));return _0x29f633(new Error(_0x6f24('0x6e')));}var _0x228000=_0x58d2bc['some'](function(_0x356ad3){return _0x356ad3==='manifest.json';});if(!_0x228000){return _0x29f633(new Error(_0x6f24('0x70')));}var _0x43be2a=fs[_0x6f24('0x71')](path[_0x6f24('0x52')](_0x1199b1,_0x24c574[0x0],_0x6f24('0x72')));var _0x2d9ea0=JSON['parse'](_0x43be2a);if(_0x6f24('0x24')==typeof _0x2d9ea0['name']){return _0x29f633(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x6f24('0x24')==typeof _0x2d9ea0[_0x6f24('0x38')]){return _0x29f633(new Error(_0x6f24('0x73')));}if(_0x6f24('0x24')==typeof _0x2d9ea0[_0x6f24('0x74')]){return _0x29f633(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x6f24('0x24')==typeof _0x2d9ea0[_0x6f24('0x75')]){return _0x29f633(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2d9ea0['type']==='html'){if(_0x6f24('0x24')==typeof _0x2d9ea0['parameters'][_0x6f24('0x76')]){return _0x29f633(new Error(_0x6f24('0x77')));}if(_0x6f24('0x24')==typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x78')]&&'undefined'==typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x79')]){return _0x29f633(new Error(_0x6f24('0x7a')));}}else if(_0x2d9ea0[_0x6f24('0x38')]===_0x6f24('0x7b')){if('undefined'==typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x7c')]){return _0x29f633(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x6f24('0x24')==typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x7d')]){return _0x29f633(new Error(_0x6f24('0x7e')));}}else{return _0x29f633(new Error(_0x6f24('0x7f')));}var _0x218b16=_0x2d9ea0[_0x6f24('0x33')];var _0x35af73=_0x2d9ea0['description'];var _0x4a7a99=_0x2d9ea0[_0x6f24('0x38')];var _0x24d98a=_0x2d9ea0[_0x6f24('0x80')]?_0x2d9ea0[_0x6f24('0x80')]:_0x6f24('0x81');var _0xce3ee8=_0x2d9ea0[_0x6f24('0x82')]?_0x2d9ea0['icon']:_0x6f24('0x83');var _0x34f0f3='';var _0x367916='';var _0x20ea53='';var _0x13b254='';var _0x23315a=_0x2d9ea0[_0x6f24('0x74')];if(_0x4a7a99===_0x6f24('0x84')){if(_0x6f24('0x24')!=typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x78')]){var _0x35cdb5=_0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x6f24('0x85')](_0x35cdb5)){_0x34f0f3=path[_0x6f24('0x52')]('plugins',_0x39c49b,_0x24c574[0x0],_0x35cdb5);}else{_0x34f0f3=_0x35cdb5;}}else{logger[_0x6f24('0x66')](_0x6f24('0x86'));}if(_0x6f24('0x24')!=typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x79')]){var _0x55be9d=_0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x6f24('0x85')](_0x55be9d)){_0x367916=path[_0x6f24('0x52')]('plugins',_0x39c49b,_0x24c574[0x0],_0x55be9d);}else{_0x367916=_0x55be9d;}}else{logger[_0x6f24('0x66')](_0x6f24('0x87'));}}else if(_0x4a7a99===_0x6f24('0x7b')){_0x20ea53=_0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x7c')];_0x13b254=_0x2d9ea0[_0x6f24('0x75')]['scriptPath'];if(_0x6f24('0x24')!=typeof _0x2d9ea0['parameters'][_0x6f24('0x76')]){if('undefined'!=typeof _0x2d9ea0[_0x6f24('0x75')]['views']['admin']){var _0x35cdb5=_0x2d9ea0[_0x6f24('0x75')]['views'][_0x6f24('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x6f24('0x85')](_0x35cdb5)){_0x34f0f3=path[_0x6f24('0x52')](_0x6f24('0x88'),_0x39c49b,_0x24c574[0x0],_0x35cdb5);}else{_0x34f0f3=_0x35cdb5;}}if('undefined'!=typeof _0x2d9ea0[_0x6f24('0x75')][_0x6f24('0x76')][_0x6f24('0x79')]){var _0x55be9d=_0x2d9ea0['parameters'][_0x6f24('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6f24('0x85')](_0x55be9d)){_0x367916=path[_0x6f24('0x52')](_0x6f24('0x88'),_0x39c49b,_0x24c574[0x0],_0x55be9d);}else{_0x367916=_0x55be9d;}}}}var _0x443154={'name':_0x218b16,'description':_0x35af73,'path':path['join'](_0x39c49b,_0x24c574[0x0]),'type':_0x4a7a99,'sidebar':_0x24d98a,'icon':_0xce3ee8,'adminUrl':_0x34f0f3,'agentUrl':_0x367916,'scriptName':_0x20ea53,'scriptPath':_0x13b254,'version':_0x23315a};removeReferences(_0x1df326,null);return db[_0x6f24('0x36')]['create'](_0x443154)[_0x6f24('0x2e')](function(_0x2e7b2e){var _0xf826c6={'role':_0x1a740d[_0x6f24('0x89')][_0x6f24('0x8a')],'userProfileId':_0x1a740d[_0x6f24('0x89')][_0x6f24('0x8b')]};if(!_0xf826c6)throw new Error(_0x6f24('0x8c'));if(_0xf826c6[_0x6f24('0x8a')]==='user'){var _0x5ee9de=_0x2e7b2e[_0x6f24('0x2f')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x6f24('0x30'),'userProfileId':_0xf826c6[_0x6f24('0x8b')]},'raw':!![]})[_0x6f24('0x2e')](function(_0x214bfb){if(_0x214bfb&&_0x214bfb['autoAssociation']===0x0){return db[_0x6f24('0x31')][_0x6f24('0x8d')]({'name':_0x5ee9de[_0x6f24('0x33')],'resourceId':_0x5ee9de['id'],'type':_0x214bfb['name'],'sectionId':_0x214bfb['id']},{})['then'](function(){return _0x2e7b2e;});}else{return _0x2e7b2e;}})[_0x6f24('0x4b')](function(_0x3324ed){logger[_0x6f24('0x32')](_0x6f24('0x8e'),_0x3324ed);throw _0x3324ed;});}return _0x2e7b2e;})[_0x6f24('0x2e')](respondWithResult(_0x1c423a,null))['catch'](handleError(_0x1c423a,null));}});}catch(_0x1fdc6f){_0x1c423a['status'](0x1f4)[_0x6f24('0x8f')](_0x1fdc6f);}};function removeReferences(_0x54477a,_0xa3e740){try{if(_0x54477a){fs['unlinkSync'](_0x54477a);logger[_0x6f24('0x66')]('Zip\x20archive\x20removed');}if(_0xa3e740){rimraf(_0xa3e740,function(){});logger[_0x6f24('0x66')](_0x6f24('0x90'));}}catch(_0x35a8a6){logger[_0x6f24('0x32')](_0x35a8a6);}}exports[_0x6f24('0x2c')]=function(_0x2ad40c,_0x1c77db,_0x366b00){return db[_0x6f24('0x36')]['find']({'where':{'id':_0x2ad40c[_0x6f24('0x4c')]['id']}})[_0x6f24('0x2e')](handleEntityNotFound(_0x1c77db,null))[_0x6f24('0x2e')](saveUpdates(_0x2ad40c['body'],null))[_0x6f24('0x2e')](respondWithResult(_0x1c77db,null))[_0x6f24('0x4b')](handleError(_0x1c77db,null));};exports[_0x6f24('0x91')]=function(_0x165311,_0x4ec0cc,_0x30cdc7){return db['Plugin']['find']({'where':{'id':_0x165311[_0x6f24('0x4c')]['id']}})[_0x6f24('0x2e')](function(_0x538861){if(_0x538861){return _0x538861[_0x6f24('0x2d')]();}})['then'](function(_0x13efe1){rimraf(path[_0x6f24('0x52')](config[_0x6f24('0x5f')],'server/files/plugins',path[_0x6f24('0x92')](_0x13efe1[_0x6f24('0x6')])),function(){});return _0x13efe1;})['then'](handleEntityNotFound(_0x4ec0cc,null))[_0x6f24('0x2e')](respondWithStatusCode(_0x4ec0cc,null))['catch'](handleError(_0x4ec0cc,null));};exports[_0x6f24('0x93')]=function(_0x5bdaba,_0x466061,_0x310445){return BPromise[_0x6f24('0x94')]()['then'](function(){if(!_0x5bdaba['query']['path']){throw new Error(_0x6f24('0x95'));}if(!_0x5bdaba[_0x6f24('0x3b')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x10ad2b=_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x96')]?_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x96')]+':'+_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x97')]:_0x6f24('0x98')+_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x97')];var _0x3eece3=_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x22')]?_0x5bdaba['query'][_0x6f24('0x22')]:!![];var _0x38da0f=_0x5bdaba[_0x6f24('0x3b')]['encoding']?_0x5bdaba[_0x6f24('0x3b')]['encoding']:null;var _0x344214={'method':_0x5bdaba['method'],'uri':util['format'](_0x6f24('0x99'),_0x10ad2b,_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x6')]),'json':_0x3eece3,'resolveWithFullResponse':!![],'encoding':_0x38da0f,'qs':_0x5bdaba[_0x6f24('0x3b')]};if(_0x5bdaba[_0x6f24('0x9a')]){_0x344214['headers']=_0x5bdaba[_0x6f24('0x9a')];if(_0x344214['headers']['content-length']){delete _0x344214[_0x6f24('0x9a')][_0x6f24('0x9b')];}}if(_0x344214[_0x6f24('0x9a')][_0x6f24('0x9c')]){delete _0x344214[_0x6f24('0x9a')][_0x6f24('0x9c')];}return rp(_0x344214);})['then'](function(_0x41546a){if(_0x41546a){_0x466061[_0x6f24('0x27')](_0x41546a[_0x6f24('0x9a')]);logger[_0x6f24('0x66')](_0x41546a[_0x6f24('0x89')]);if(_[_0x6f24('0x9d')](_0x5bdaba[_0x6f24('0x3b')][_0x6f24('0x6')],_0x6f24('0x51'))&&_0x41546a[_0x6f24('0x9e')]==0x1f4){return _0x466061[_0x6f24('0x1f')](_0x41546a['statusCode']);}else{return _0x466061[_0x6f24('0x20')](_0x41546a[_0x6f24('0x9e')])[_0x6f24('0x8f')](_0x41546a[_0x6f24('0x89')]);}}else{return _0x466061['sendStatus'](0xc8);}})[_0x6f24('0x4b')](handleError(_0x466061,null));};exports[_0x6f24('0x9f')]=function(_0x48f95a,_0x5c9e45,_0x4e3b90){return BPromise[_0x6f24('0x94')]()[_0x6f24('0x2e')](function(){if(!_0x48f95a[_0x6f24('0x3b')][_0x6f24('0x6')]){throw new Error(_0x6f24('0x95'));}if(!_0x48f95a[_0x6f24('0x3b')][_0x6f24('0x97')]){throw new Error(_0x6f24('0xa0'));}var _0x9a69a8=_0x48f95a['query'][_0x6f24('0x96')]?_0x48f95a[_0x6f24('0x3b')][_0x6f24('0x96')]+':'+_0x48f95a[_0x6f24('0x3b')]['port']:_0x6f24('0x98')+_0x48f95a[_0x6f24('0x3b')][_0x6f24('0x97')];var _0x21d04a=_0x48f95a['query'][_0x6f24('0x22')]?_0x48f95a[_0x6f24('0x3b')][_0x6f24('0x22')]:!![];var _0x3c17a0=_0x48f95a[_0x6f24('0x3b')][_0x6f24('0xa1')]?_0x48f95a['query'][_0x6f24('0xa1')]:null;var _0x3d1f36={'method':_0x48f95a[_0x6f24('0xa2')],'uri':util['format'](_0x6f24('0x99'),_0x9a69a8,_0x48f95a['query'][_0x6f24('0x6')]),'json':_0x21d04a,'resolveWithFullResponse':!![],'encoding':_0x3c17a0,'body':_0x48f95a[_0x6f24('0x89')]};if(_0x48f95a[_0x6f24('0x9a')]){_0x3d1f36['headers']=_0x48f95a[_0x6f24('0x9a')];if(_0x3d1f36[_0x6f24('0x9a')][_0x6f24('0x9b')]){delete _0x3d1f36[_0x6f24('0x9a')][_0x6f24('0x9b')];}}if(_0x3d1f36['headers'][_0x6f24('0x9c')]){delete _0x3d1f36[_0x6f24('0x9a')][_0x6f24('0x9c')];}return rp(_0x3d1f36);})[_0x6f24('0x2e')](function(_0x2e7c90){if(_0x2e7c90){_0x5c9e45['set'](_0x2e7c90['headers']);logger[_0x6f24('0x66')](_0x2e7c90[_0x6f24('0x89')]);return _0x5c9e45[_0x6f24('0x20')](_0x2e7c90[_0x6f24('0x9e')])[_0x6f24('0x8f')](_0x2e7c90[_0x6f24('0x89')]);}else{return _0x5c9e45[_0x6f24('0x1f')](0xc8);}})[_0x6f24('0x4b')](handleError(_0x5c9e45,null));}; \ No newline at end of file +var _0x815c=['stack','name','send','map','Plugin','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Plugins','UserProfileResource','then','error'];(function(_0x3f15af,_0x1b4091){var _0x47dfa8=function(_0x1a0cec){while(--_0x1a0cec){_0x3f15af['push'](_0x3f15af['shift']());}};_0x47dfa8(++_0x1b4091);}(_0x815c,0x1cb));var _0xc815=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x815c[_0x3def1b];return _0x57340e;};'use strict';var emlformat=require(_0xc815('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc815('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc815('0x2'));var moment=require(_0xc815('0x3'));var BPromise=require(_0xc815('0x4'));var Mustache=require(_0xc815('0x5'));var util=require(_0xc815('0x6'));var path=require(_0xc815('0x7'));var sox=require(_0xc815('0x8'));var csv=require(_0xc815('0x9'));var ejs=require(_0xc815('0xa'));var fs=require('fs');var fs_extra=require(_0xc815('0xb'));var _=require(_0xc815('0xc'));var squel=require(_0xc815('0xd'));var crypto=require(_0xc815('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc815('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc815('0x10'));var extract=require(_0xc815('0x11'));var rimraf=require(_0xc815('0x12'));var archiver=require(_0xc815('0x13'));var Redis=require(_0xc815('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc815('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc815('0x16'));var logger=require(_0xc815('0x17'))(_0xc815('0x18'));var utils=require(_0xc815('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc815('0x1a'));var db=require(_0xc815('0x1b'))['db'];config[_0xc815('0x1c')]=_[_0xc815('0x1d')](config[_0xc815('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc815('0x1e'))(new Redis(config[_0xc815('0x1c')]));require(_0xc815('0x1f'))['register'](socket);function respondWithStatusCode(_0x9d49,_0xa5611e){_0xa5611e=_0xa5611e||0xcc;return function(_0x369cfa){if(_0x369cfa){return _0x9d49[_0xc815('0x20')](_0xa5611e);}return _0x9d49[_0xc815('0x21')](_0xa5611e)[_0xc815('0x22')]();};}function respondWithResult(_0x48e1b0,_0x7f1e24){_0x7f1e24=_0x7f1e24||0xc8;return function(_0x5c9e8c){if(_0x5c9e8c){return _0x48e1b0['status'](_0x7f1e24)[_0xc815('0x23')](_0x5c9e8c);}};}function respondWithFilteredResult(_0x336f65,_0x2924b3){return function(_0x421c02){if(_0x421c02){var _0x36e45e=typeof _0x2924b3[_0xc815('0x24')]==='undefined'&&typeof _0x2924b3[_0xc815('0x25')]==='undefined';var _0x138263=_0x421c02[_0xc815('0x26')];var _0x16c784=_0x36e45e?0x0:_0x2924b3['offset'];var _0x115afd=_0x36e45e?_0x421c02['count']:_0x2924b3[_0xc815('0x24')]+_0x2924b3[_0xc815('0x25')];var _0x55216d;if(_0x115afd>=_0x138263){_0x115afd=_0x138263;_0x55216d=0xc8;}else{_0x55216d=0xce;}_0x336f65['status'](_0x55216d);return _0x336f65[_0xc815('0x27')](_0xc815('0x28'),_0x16c784+'-'+_0x115afd+'/'+_0x138263)[_0xc815('0x23')](_0x421c02);}return null;};}function patchUpdates(_0x2c7ef9){return function(_0x32e39a){try{jsonpatch[_0xc815('0x29')](_0x32e39a,_0x2c7ef9,!![]);}catch(_0x3373bc){return BPromise[_0xc815('0x2a')](_0x3373bc);}return _0x32e39a[_0xc815('0x2b')]();};}function saveUpdates(_0x1ef4da,_0x17e9f8){return function(_0x3ed41e){if(_0x3ed41e){return _0x3ed41e[_0xc815('0x2c')](_0x1ef4da)['then'](function(_0x4b9f70){return _0x4b9f70;});}return null;};}function removeEntity(_0x375852,_0x6dbfda){return function(_0x30e580){if(_0x30e580){return _0x30e580[_0xc815('0x2d')]()['then'](function(){var _0x285eaa=_0x30e580[_0xc815('0x2e')]({'plain':!![]});var _0x4c9e73=_0xc815('0x2f');return db[_0xc815('0x30')][_0xc815('0x2d')]({'where':{'type':_0x4c9e73,'resourceId':_0x285eaa['id']}})['then'](function(){return _0x30e580;});})[_0xc815('0x31')](function(){_0x375852[_0xc815('0x21')](0xcc)[_0xc815('0x22')]();});}};}function handleEntityNotFound(_0x5833d5,_0x5a2434){return function(_0x58f150){if(!_0x58f150){_0x5833d5[_0xc815('0x20')](0x194);}return _0x58f150;};}function handleError(_0x3b6204,_0x31d909){_0x31d909=_0x31d909||0x1f4;return function(_0x3f52af){logger[_0xc815('0x32')](_0x3f52af[_0xc815('0x33')]);if(_0x3f52af[_0xc815('0x34')]){delete _0x3f52af[_0xc815('0x34')];}_0x3b6204[_0xc815('0x21')](_0x31d909)[_0xc815('0x35')](_0x3f52af);};}exports['index']=function(_0x1896f2,_0x24d997){var _0x2533c8={},_0x3276de={},_0x5ab52d={'count':0x0,'rows':[]};var _0xfd0867=_[_0xc815('0x36')](db[_0xc815('0x37')][_0xc815('0x38')],function(_0x3455b7){return{'name':_0x3455b7[_0xc815('0x39')],'type':_0x3455b7[_0xc815('0x3a')]['key']};});_0x3276de[_0xc815('0x3b')]=_[_0xc815('0x36')](_0xfd0867,_0xc815('0x34'));_0x3276de['query']=_[_0xc815('0x3c')](_0x1896f2[_0xc815('0x3d')]);_0x3276de[_0xc815('0x3e')]=_[_0xc815('0x3f')](_0x3276de[_0xc815('0x3b')],_0x3276de[_0xc815('0x3d')]);_0x2533c8[_0xc815('0x40')]=_[_0xc815('0x3f')](_0x3276de[_0xc815('0x3b')],qs['fields'](_0x1896f2[_0xc815('0x3d')][_0xc815('0x41')]));_0x2533c8[_0xc815('0x40')]=_0x2533c8['attributes'][_0xc815('0x42')]?_0x2533c8[_0xc815('0x40')]:_0x3276de[_0xc815('0x3b')];if(!_0x1896f2[_0xc815('0x3d')][_0xc815('0x43')]('nolimit')){_0x2533c8[_0xc815('0x25')]=qs['limit'](_0x1896f2[_0xc815('0x3d')]['limit']);_0x2533c8[_0xc815('0x24')]=qs[_0xc815('0x24')](_0x1896f2['query'][_0xc815('0x24')]);}_0x2533c8['order']=qs['sort'](_0x1896f2[_0xc815('0x3d')][_0xc815('0x44')]);_0x2533c8['where']=qs['filters'](_[_0xc815('0x45')](_0x1896f2[_0xc815('0x3d')],_0x3276de[_0xc815('0x3e')]),_0xfd0867);if(_0x1896f2[_0xc815('0x3d')][_0xc815('0x46')]){_0x2533c8[_0xc815('0x47')]=_[_0xc815('0x48')](_0x2533c8['where'],{'$or':_[_0xc815('0x36')](_0xfd0867,function(_0x5bf40a){if(_0x5bf40a['type']!==_0xc815('0x49')){var _0x5cc145={};_0x5cc145[_0x5bf40a[_0xc815('0x34')]]={'$like':'%'+_0x1896f2[_0xc815('0x3d')]['filter']+'%'};return _0x5cc145;}})});}_0x2533c8=_[_0xc815('0x48')]({},_0x2533c8,_0x1896f2['options']);var _0x3f4f6a={'where':_0x2533c8['where']};return db[_0xc815('0x37')][_0xc815('0x26')](_0x3f4f6a)[_0xc815('0x31')](function(_0x482004){_0x5ab52d[_0xc815('0x26')]=_0x482004;if(_0x1896f2['query'][_0xc815('0x4a')]){_0x2533c8[_0xc815('0x4b')]=[{'all':!![]}];}return db[_0xc815('0x37')]['findAll'](_0x2533c8);})['then'](function(_0x546a3c){_0x5ab52d[_0xc815('0x4c')]=_0x546a3c;return _0x5ab52d;})[_0xc815('0x31')](respondWithFilteredResult(_0x24d997,_0x2533c8))[_0xc815('0x4d')](handleError(_0x24d997,null));};exports[_0xc815('0x4e')]=function(_0x33471d,_0x1c7837){var _0x1dc9e7={'raw':!![],'where':{'id':_0x33471d[_0xc815('0x4f')]['id']}},_0x3013da={};_0x3013da[_0xc815('0x3b')]=_[_0xc815('0x3c')](db[_0xc815('0x37')][_0xc815('0x38')]);_0x3013da[_0xc815('0x3d')]=_[_0xc815('0x3c')](_0x33471d[_0xc815('0x3d')]);_0x3013da[_0xc815('0x3e')]=_['intersection'](_0x3013da['model'],_0x3013da[_0xc815('0x3d')]);_0x1dc9e7[_0xc815('0x40')]=_['intersection'](_0x3013da[_0xc815('0x3b')],qs['fields'](_0x33471d[_0xc815('0x3d')][_0xc815('0x41')]));_0x1dc9e7[_0xc815('0x40')]=_0x1dc9e7['attributes'][_0xc815('0x42')]?_0x1dc9e7[_0xc815('0x40')]:_0x3013da[_0xc815('0x3b')];if(_0x33471d[_0xc815('0x3d')][_0xc815('0x4a')]){_0x1dc9e7[_0xc815('0x4b')]=[{'all':!![]}];}_0x1dc9e7=_[_0xc815('0x48')]({},_0x1dc9e7,_0x33471d['options']);return db['Plugin'][_0xc815('0x50')](_0x1dc9e7)[_0xc815('0x31')](handleEntityNotFound(_0x1c7837,null))['then'](respondWithResult(_0x1c7837,null))['catch'](handleError(_0x1c7837,null));};exports[_0xc815('0x51')]=function(_0x268fd8,_0x309c68,_0x3770f8){return db[_0xc815('0x37')][_0xc815('0x50')]({'where':{'id':_0x268fd8['params']['id']},'attributes':[_0xc815('0x34'),_0xc815('0x7')],'raw':!![]})[_0xc815('0x31')](handleEntityNotFound(_0x309c68,null))[_0xc815('0x31')](function(_0x51813f){if(_0x51813f){var _0x5e2d32=path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),util[_0xc815('0x55')](_0xc815('0x56'),path['basename'](_0x51813f[_0xc815('0x7')])));var _0x20865e=fs[_0xc815('0x57')](_0x5e2d32);var _0xadf931=archiver(_0xc815('0x58'),{'zlib':{'level':0x9}});_0xadf931['on'](_0xc815('0x59'),function(_0x3a9a78){if(_0x3a9a78['code']==='ENOENT'){logger['error'](_0x3a9a78);}else{throw new db[(_0xc815('0x5a'))][(_0xc815('0x5b'))](_0xc815('0x5c'));}});_0xadf931['on']('error',function(_0x410bd9){throw new db[(_0xc815('0x5a'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xadf931[_0xc815('0x5d')](_0x20865e);_0xadf931['glob']('**/*',{'cwd':path[_0xc815('0x52')](config['root'],'server/files/plugins',path[_0xc815('0x5e')](_0x51813f[_0xc815('0x7')])),'ignore':[path[_0xc815('0x52')](path[_0xc815('0x5f')](_0x51813f[_0xc815('0x7')]),_0xc815('0x60')),path[_0xc815('0x52')](path[_0xc815('0x5f')](_0x51813f[_0xc815('0x7')]),_0xc815('0x61'))],'nodir':!![]})[_0xc815('0x62')]();_0x20865e['on']('close',function(){if(!fs[_0xc815('0x63')](_0x5e2d32)){throw new db['Sequelize'][(_0xc815('0x5b'))]('Plugin\x20not\x20found');}return _0x309c68[_0xc815('0x51')](_0x5e2d32,util['format'](_0xc815('0x56'),path['basename'](_0x51813f['path'])),function(_0x29c118){if(_0x29c118){throw new db[(_0xc815('0x5a'))][(_0xc815('0x5b'))](_0xc815('0x64'));}fs[_0xc815('0x65')](_0x5e2d32);logger[_0xc815('0x66')](_0xc815('0x67'));logger['info'](_0xc815('0x68'));});});}return null;})[_0xc815('0x4d')](handleError(_0x309c68,null));};exports[_0xc815('0x69')]=function(_0x342cba,_0x24c166,_0x32c50c){var _0x1c64df=path[_0xc815('0x5f')](_0x342cba[_0xc815('0x6a')][_0xc815('0x6b')],path['extname'](_0x342cba[_0xc815('0x6a')][_0xc815('0x6b')]));var _0xaad695=path['join'](config[_0xc815('0x53')],'server/files/plugins',_0x342cba['file'][_0xc815('0x6b')]);var _0xcd922b=path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),_0x1c64df);logger['info'](_0xc815('0x6c'),_0xaad695);logger[_0xc815('0x66')]('Plugin\x20upload\x20destination:\x20%s',_0xcd922b);try{fs[_0xc815('0x6d')](_0xaad695,parseInt(_0xc815('0x6e'),0x8));extract(_0xaad695,{'dir':_0xcd922b},function(_0x459e53){if(_0x459e53){logger[_0xc815('0x32')](_0x459e53);handleError(_0x459e53,!![]);};var _0x5753f6=fs[_0xc815('0x6f')](_0xcd922b);if(_0x5753f6[_0xc815('0x42')]>0x1){removeReferences(_0xaad695,_0xcd922b);logger[_0xc815('0x32')](_0xc815('0x70'));return _0x32c50c(new Error(_0xc815('0x70')));}var _0x1ba90f=fs[_0xc815('0x71')](path[_0xc815('0x52')](_0xcd922b,_0x5753f6[0x0]));if(_0x1ba90f[_0xc815('0x72')]()){removeReferences(_0xaad695,_0xcd922b);logger[_0xc815('0x32')](_0xc815('0x70'));return _0x32c50c(new Error(_0xc815('0x70')));}if(_0x1ba90f[_0xc815('0x73')]()){var _0x3a67b0=fs[_0xc815('0x6f')](path['join'](_0xcd922b,_0x5753f6[0x0]));if(_0x3a67b0[_0xc815('0x42')]===0x0){removeReferences(_0xaad695,_0xcd922b);logger['error']('Invalid\x20plugin\x20structure');return _0x32c50c(new Error(_0xc815('0x70')));}var _0x3694d5=_0x3a67b0[_0xc815('0x74')](function(_0x167277){return _0x167277===_0xc815('0x75');});if(!_0x3694d5){return _0x32c50c(new Error('Plugin\x20manifest\x20missing'));}var _0x404843=fs['readFileSync'](path[_0xc815('0x52')](_0xcd922b,_0x5753f6[0x0],_0xc815('0x75')));var _0x51795b=JSON[_0xc815('0x76')](_0x404843);if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x34')]){return _0x32c50c(new Error(_0xc815('0x78')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x3a')]){return _0x32c50c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x79')]){return _0x32c50c(new Error(_0xc815('0x7a')));}if('undefined'==typeof _0x51795b[_0xc815('0x7b')]){return _0x32c50c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x51795b[_0xc815('0x3a')]==='html'){if(_0xc815('0x77')==typeof _0x51795b['parameters'][_0xc815('0x7c')]){return _0x32c50c(new Error(_0xc815('0x7d')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')]['views'][_0xc815('0x7e')]&&_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){return _0x32c50c(new Error(_0xc815('0x80')));}}else if(_0x51795b[_0xc815('0x3a')]===_0xc815('0x81')){if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x82')]){return _0x32c50c(new Error(_0xc815('0x83')));}if(_0xc815('0x77')==typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x84')]){return _0x32c50c(new Error(_0xc815('0x85')));}}else{return _0x32c50c(new Error(_0xc815('0x86')));}var _0x55236a=_0x51795b['name'];var _0x2c55d4=_0x51795b[_0xc815('0x87')];var _0x9c5c82=_0x51795b[_0xc815('0x3a')];var _0x2e9d0b=_0x51795b[_0xc815('0x88')]?_0x51795b[_0xc815('0x88')]:_0xc815('0x89');var _0x11d4d6=_0x51795b[_0xc815('0x8a')]?_0x51795b[_0xc815('0x8a')]:_0xc815('0x8b');var _0x16b3d4='';var _0x417a81='';var _0x3225bd='';var _0x23f028='';var _0x29b1d7=_0x51795b[_0xc815('0x79')];if(_0x9c5c82==='html'){if('undefined'!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7e')]){var _0x15e46f=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15e46f)){_0x16b3d4=path[_0xc815('0x52')]('plugins',_0x1c64df,_0x5753f6[0x0],_0x15e46f);}else{_0x16b3d4=_0x15e46f;}}else{logger[_0xc815('0x66')](_0xc815('0x8c'));}if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){var _0x469697=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc815('0x8d')](_0x469697)){_0x417a81=path[_0xc815('0x52')](_0xc815('0x8e'),_0x1c64df,_0x5753f6[0x0],_0x469697);}else{_0x417a81=_0x469697;}}else{logger[_0xc815('0x66')](_0xc815('0x8f'));}}else if(_0x9c5c82===_0xc815('0x81')){_0x3225bd=_0x51795b[_0xc815('0x7b')][_0xc815('0x82')];_0x23f028=_0x51795b['parameters']['scriptPath'];if('undefined'!=typeof _0x51795b[_0xc815('0x7b')]['views']){if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')]['views']['admin']){var _0x15e46f=_0x51795b[_0xc815('0x7b')][_0xc815('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15e46f)){_0x16b3d4=path[_0xc815('0x52')](_0xc815('0x8e'),_0x1c64df,_0x5753f6[0x0],_0x15e46f);}else{_0x16b3d4=_0x15e46f;}}if(_0xc815('0x77')!=typeof _0x51795b[_0xc815('0x7b')][_0xc815('0x7c')][_0xc815('0x7f')]){var _0x469697=_0x51795b['parameters'][_0xc815('0x7c')][_0xc815('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc815('0x8d')](_0x469697)){_0x417a81=path[_0xc815('0x52')]('plugins',_0x1c64df,_0x5753f6[0x0],_0x469697);}else{_0x417a81=_0x469697;}}}}var _0x5a5f6b={'name':_0x55236a,'description':_0x2c55d4,'path':path[_0xc815('0x52')](_0x1c64df,_0x5753f6[0x0]),'type':_0x9c5c82,'sidebar':_0x2e9d0b,'icon':_0x11d4d6,'adminUrl':_0x16b3d4,'agentUrl':_0x417a81,'scriptName':_0x3225bd,'scriptPath':_0x23f028,'version':_0x29b1d7};removeReferences(_0xaad695,null);return db['Plugin'][_0xc815('0x90')](_0x5a5f6b)[_0xc815('0x31')](function(_0x39dbca){var _0x465421={'role':_0x342cba[_0xc815('0x91')][_0xc815('0x92')],'userProfileId':_0x342cba['body']['userProfileId']};if(!_0x465421)throw new Error(_0xc815('0x93'));if(_0x465421[_0xc815('0x92')]===_0xc815('0x94')){var _0x47239a=_0x39dbca['get']({'plain':!![]});return db[_0xc815('0x95')]['find']({'where':{'name':_0xc815('0x2f'),'userProfileId':_0x465421[_0xc815('0x96')]},'raw':!![]})[_0xc815('0x31')](function(_0x30f381){if(_0x30f381&&_0x30f381[_0xc815('0x97')]===0x0){return db[_0xc815('0x30')]['create']({'name':_0x47239a[_0xc815('0x34')],'resourceId':_0x47239a['id'],'type':_0x30f381[_0xc815('0x34')],'sectionId':_0x30f381['id']},{})[_0xc815('0x31')](function(){return _0x39dbca;});}else{return _0x39dbca;}})['catch'](function(_0xdb1f98){logger[_0xc815('0x32')](_0xc815('0x98'),_0xdb1f98);throw _0xdb1f98;});}return _0x39dbca;})['then'](respondWithResult(_0x24c166,null))['catch'](handleError(_0x24c166,null));}});}catch(_0x394fca){_0x24c166['status'](0x1f4)[_0xc815('0x35')](_0x394fca);}};function removeReferences(_0x523306,_0x4753d1){try{if(_0x523306){fs[_0xc815('0x65')](_0x523306);logger['info']('Zip\x20archive\x20removed');}if(_0x4753d1){rimraf(_0x4753d1,function(){});logger[_0xc815('0x66')](_0xc815('0x99'));}}catch(_0x1c865a){logger['error'](_0x1c865a);}}exports[_0xc815('0x2c')]=function(_0x38d891,_0x15d856,_0x3279f5){return db[_0xc815('0x37')]['find']({'where':{'id':_0x38d891[_0xc815('0x4f')]['id']}})[_0xc815('0x31')](handleEntityNotFound(_0x15d856,null))['then'](saveUpdates(_0x38d891[_0xc815('0x91')],null))[_0xc815('0x31')](respondWithResult(_0x15d856,null))[_0xc815('0x4d')](handleError(_0x15d856,null));};exports[_0xc815('0x9a')]=function(_0x33a222,_0x4ccf06,_0x4151b6){return db[_0xc815('0x37')][_0xc815('0x50')]({'where':{'id':_0x33a222['params']['id']}})[_0xc815('0x31')](function(_0xbf6065){if(_0xbf6065){return _0xbf6065['destroy']();}})[_0xc815('0x31')](function(_0x54055e){rimraf(path[_0xc815('0x52')](config[_0xc815('0x53')],_0xc815('0x54'),path['dirname'](_0x54055e[_0xc815('0x7')])),function(){});return _0x54055e;})['then'](handleEntityNotFound(_0x4ccf06,null))[_0xc815('0x31')](respondWithStatusCode(_0x4ccf06,null))[_0xc815('0x4d')](handleError(_0x4ccf06,null));};exports[_0xc815('0x9b')]=function(_0x4adb02,_0x1efbee,_0x5f3655){return BPromise['resolve']()[_0xc815('0x31')](function(){if(!_0x4adb02['query'][_0xc815('0x7')]){throw new Error(_0xc815('0x9c'));}if(!_0x4adb02[_0xc815('0x3d')][_0xc815('0x9d')]){throw new Error(_0xc815('0x9e'));}var _0x9c5fda=_0x4adb02[_0xc815('0x3d')][_0xc815('0x9f')]?_0x4adb02['query']['hostname']+':'+_0x4adb02[_0xc815('0x3d')][_0xc815('0x9d')]:'http://localhost:'+_0x4adb02[_0xc815('0x3d')]['port'];var _0x3a87c0=_0x4adb02[_0xc815('0x3d')][_0xc815('0x23')]?_0x4adb02[_0xc815('0x3d')]['json']:!![];var _0x3573f9=_0x4adb02[_0xc815('0x3d')][_0xc815('0xa0')]?_0x4adb02[_0xc815('0x3d')][_0xc815('0xa0')]:null;var _0x49f5df={'method':_0x4adb02[_0xc815('0xa1')],'uri':util[_0xc815('0x55')](_0xc815('0xa2'),_0x9c5fda,_0x4adb02['query'][_0xc815('0x7')]),'json':_0x3a87c0,'resolveWithFullResponse':!![],'encoding':_0x3573f9,'qs':_0x4adb02[_0xc815('0x3d')]};if(_0x4adb02[_0xc815('0xa3')]){_0x49f5df[_0xc815('0xa3')]=_0x4adb02[_0xc815('0xa3')];if(_0x49f5df[_0xc815('0xa3')][_0xc815('0xa4')]){delete _0x49f5df[_0xc815('0xa3')]['content-length'];}}if(_0x49f5df[_0xc815('0xa3')][_0xc815('0xa5')]){delete _0x49f5df[_0xc815('0xa3')][_0xc815('0xa5')];}return rp(_0x49f5df);})[_0xc815('0x31')](function(_0x7a0ce4){if(_0x7a0ce4){_0x1efbee[_0xc815('0x27')](_0x7a0ce4['headers']);logger[_0xc815('0x66')](_0x7a0ce4['body']);if(_[_0xc815('0xa6')](_0x4adb02[_0xc815('0x3d')][_0xc815('0x7')],_0xc815('0x51'))&&_0x7a0ce4[_0xc815('0xa7')]==0x1f4){return _0x1efbee['sendStatus'](_0x7a0ce4[_0xc815('0xa7')]);}else{return _0x1efbee['status'](_0x7a0ce4[_0xc815('0xa7')])[_0xc815('0x35')](_0x7a0ce4[_0xc815('0x91')]);}}else{return _0x1efbee[_0xc815('0x20')](0xc8);}})[_0xc815('0x4d')](handleError(_0x1efbee,null));};exports[_0xc815('0xa8')]=function(_0x3881fb,_0x562add,_0x31cad8){return BPromise[_0xc815('0xa9')]()['then'](function(){if(!_0x3881fb[_0xc815('0x3d')][_0xc815('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3881fb['query'][_0xc815('0x9d')]){throw new Error(_0xc815('0x9e'));}var _0x5c9769=_0x3881fb[_0xc815('0x3d')]['hostname']?_0x3881fb[_0xc815('0x3d')][_0xc815('0x9f')]+':'+_0x3881fb['query']['port']:'http://localhost:'+_0x3881fb[_0xc815('0x3d')][_0xc815('0x9d')];var _0x2db01f=_0x3881fb[_0xc815('0x3d')][_0xc815('0x23')]?_0x3881fb['query'][_0xc815('0x23')]:!![];var _0x56267f=_0x3881fb[_0xc815('0x3d')]['encoding']?_0x3881fb[_0xc815('0x3d')][_0xc815('0xa0')]:null;var _0x251e33={'method':_0x3881fb['method'],'uri':util['format'](_0xc815('0xa2'),_0x5c9769,_0x3881fb[_0xc815('0x3d')][_0xc815('0x7')]),'json':_0x2db01f,'resolveWithFullResponse':!![],'encoding':_0x56267f,'body':_0x3881fb[_0xc815('0x91')]};if(_0x3881fb[_0xc815('0xa3')]){_0x251e33[_0xc815('0xa3')]=_0x3881fb[_0xc815('0xa3')];if(_0x251e33['headers'][_0xc815('0xa4')]){delete _0x251e33[_0xc815('0xa3')][_0xc815('0xa4')];}}if(_0x251e33[_0xc815('0xa3')][_0xc815('0xa5')]){delete _0x251e33[_0xc815('0xa3')]['content-type'];}return rp(_0x251e33);})[_0xc815('0x31')](function(_0x55936d){if(_0x55936d){_0x562add['set'](_0x55936d[_0xc815('0xa3')]);logger[_0xc815('0x66')](_0x55936d['body']);return _0x562add[_0xc815('0x21')](_0x55936d['statusCode'])[_0xc815('0x35')](_0x55936d[_0xc815('0x91')]);}else{return _0x562add[_0xc815('0x20')](0xc8);}})[_0xc815('0x4d')](handleError(_0x562add,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index efd8f00..352f151 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 _0xdf98=['remove','emit','hasOwnProperty','exports','events','Plugin','update'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xdf98,0xcf));var _0x8df9=function(_0x25e812,_0x1342a2){_0x25e812=_0x25e812-0x0;var _0x727c56=_0xdf98[_0x25e812];return _0x727c56;};'use strict';var EventEmitter=require(_0x8df9('0x0'));var Plugin=require('../../mysqldb')['db'][_0x8df9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8df9('0x2'),'afterDestroy':_0x8df9('0x3')};function emitEvent(_0x19edc7){return function(_0xeec2ab,_0x3f2ade,_0x207605){PluginEvents[_0x8df9('0x4')](_0x19edc7+':'+_0xeec2ab['id'],_0xeec2ab);PluginEvents[_0x8df9('0x4')](_0x19edc7,_0xeec2ab);_0x207605(null);};}for(var e in events){if(events[_0x8df9('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8df9('0x6')]=PluginEvents; \ No newline at end of file +var _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x4011ed,_0x3b671e){var _0x4e8143=function(_0x124fce){while(--_0x124fce){_0x4011ed['push'](_0x4011ed['shift']());}};_0x4e8143(++_0x3b671e);}(_0x0f80,0x108));var _0x00f8=function(_0x4316a5,_0x663fdb){_0x4316a5=_0x4316a5-0x0;var _0x53eee9=_0x0f80[_0x4316a5];return _0x53eee9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){PluginEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);PluginEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];Plugin[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('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 87a1a76..e9c35be 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 _0x66d2=['bluebird','path','rimraf','./plugin.attributes','define','plugins','util','../../config/logger','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x66d2,0x1da));var _0x266d=function(_0x518a9b,_0x564725){_0x518a9b=_0x518a9b-0x0;var _0x78f45d=_0x66d2[_0x518a9b];return _0x78f45d;};'use strict';var _=require('lodash');var util=require(_0x266d('0x0'));var logger=require(_0x266d('0x1'))('api');var moment=require(_0x266d('0x2'));var BPromise=require(_0x266d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x266d('0x4'));var rimraf=require(_0x266d('0x5'));var config=require('../../config/environment');var attributes=require(_0x266d('0x6'));module['exports']=function(_0x286799,_0x5c8be0){return _0x286799[_0x266d('0x7')]('Plugin',attributes,{'tableName':_0x266d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc53a=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','lodash','util'];(function(_0x5b2c68,_0x11cf2c){var _0x205310=function(_0xc13ded){while(--_0xc13ded){_0x5b2c68['push'](_0x5b2c68['shift']());}};_0x205310(++_0x11cf2c);}(_0xc53a,0xd6));var _0xac53=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc53a[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac53('0x0'));var util=require(_0xac53('0x1'));var logger=require(_0xac53('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac53('0x3'));var rp=require(_0xac53('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac53('0x5'));var config=require(_0xac53('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x4c1923,_0x29a030){return _0x4c1923[_0xac53('0x7')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 2465420..df23fca 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 _0x8e44=['debug','error','code','message','result','catch','Plugin','options','raw','then','CreatePlugin','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x3999a9,_0x5d4526){var _0xe73d52=function(_0x48e718){while(--_0x48e718){_0x3999a9['push'](_0x3999a9['shift']());}};_0xe73d52(++_0x5d4526);}(_0x8e44,0x1ac));var _0x48e4=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0x8e44[_0x81f000];return _0x337aa2;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});config['redis']=_[_0x48e4('0xa')](config[_0x48e4('0xb')],{'host':_0x48e4('0xc'),'port':0x18eb});var socket=require(_0x48e4('0xd'))(new Redis(config[_0x48e4('0xb')]));require(_0x48e4('0xe'))[_0x48e4('0xf')](socket);function respondWithRpcPromise(_0x2d5783,_0xfa7867,_0x518066){return new BPromise(function(_0x184fc7,_0x13ea42){return client[_0x48e4('0x10')](_0x2d5783,_0x518066)['then'](function(_0x4f6a9d){logger[_0x48e4('0x11')](_0x48e4('0x12'),_0xfa7867,_0x48e4('0x13'));logger[_0x48e4('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0xfa7867,_0x48e4('0x13'),JSON['stringify'](_0x4f6a9d));if(_0x4f6a9d[_0x48e4('0x15')]){if(_0x4f6a9d[_0x48e4('0x15')][_0x48e4('0x16')]===0x1f4){logger[_0x48e4('0x15')](_0x48e4('0x12'),_0xfa7867,_0x4f6a9d[_0x48e4('0x15')][_0x48e4('0x17')]);return _0x13ea42(_0x4f6a9d['error'][_0x48e4('0x17')]);}logger[_0x48e4('0x15')]('Plugin,\x20%s,\x20%s',_0xfa7867,_0x4f6a9d[_0x48e4('0x15')][_0x48e4('0x17')]);return _0x184fc7(_0x4f6a9d['error'][_0x48e4('0x17')]);}else{logger[_0x48e4('0x11')](_0x48e4('0x12'),_0xfa7867,'request\x20sent');_0x184fc7(_0x4f6a9d[_0x48e4('0x18')][_0x48e4('0x17')]);}})[_0x48e4('0x19')](function(_0x4e75f6){logger[_0x48e4('0x15')]('Plugin,\x20%s,\x20%s',_0xfa7867,_0x4e75f6);_0x13ea42(_0x4e75f6);});});}exports['CreatePlugin']=function(_0x113ff4){var _0x1c9a5a=this;return new Promise(function(_0x25ecba,_0xad2f7d){return db[_0x48e4('0x1a')]['create'](_0x113ff4['body'],{'raw':_0x113ff4[_0x48e4('0x1b')]?_0x113ff4[_0x48e4('0x1b')][_0x48e4('0x1c')]===undefined?!![]:![]:!![]})[_0x48e4('0x1d')](function(_0x846128){logger[_0x48e4('0x11')](_0x48e4('0x1e'),_0x113ff4);logger[_0x48e4('0x14')](_0x48e4('0x1e'),_0x113ff4,JSON[_0x48e4('0x1f')](_0x846128));_0x25ecba(_0x846128);})[_0x48e4('0x19')](function(_0x5cc3e6){logger[_0x48e4('0x15')](_0x48e4('0x1e'),_0x5cc3e6['message'],_0x113ff4);_0xad2f7d(_0x1c9a5a[_0x48e4('0x15')](0x1f4,_0x5cc3e6[_0x48e4('0x17')]));});});}; \ No newline at end of file +var _0x0179=['request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket'];(function(_0x4bb336,_0x81fd3c){var _0x4da388=function(_0x2e9240){while(--_0x2e9240){_0x4bb336['push'](_0x4bb336['shift']());}};_0x4da388(++_0x81fd3c);}(_0x0179,0x1f1));var _0x9017=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x0179[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x9017('0x0'));var util=require(_0x9017('0x1'));var moment=require(_0x9017('0x2'));var BPromise=require(_0x9017('0x3'));var rs=require(_0x9017('0x4'));var fs=require('fs');var Redis=require(_0x9017('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9017('0x6'));var config=require(_0x9017('0x7'));var jayson=require(_0x9017('0x8'));var client=jayson[_0x9017('0x9')][_0x9017('0xa')]({'port':0x232a});config['redis']=_[_0x9017('0xb')](config[_0x9017('0xc')],{'host':_0x9017('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9017('0xc')]));require(_0x9017('0xe'))['register'](socket);function respondWithRpcPromise(_0x5f3785,_0x5cd595,_0x59852b){return new BPromise(function(_0x39b19f,_0x286b77){return client[_0x9017('0xf')](_0x5f3785,_0x59852b)[_0x9017('0x10')](function(_0x13afa6){logger[_0x9017('0x11')]('Plugin,\x20%s,\x20%s',_0x5cd595,'request\x20sent');logger[_0x9017('0x12')](_0x9017('0x13'),_0x5cd595,'request\x20sent',JSON[_0x9017('0x14')](_0x13afa6));if(_0x13afa6[_0x9017('0x15')]){if(_0x13afa6['error'][_0x9017('0x16')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x5cd595,_0x13afa6['error'][_0x9017('0x17')]);return _0x286b77(_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);}logger['error'](_0x9017('0x18'),_0x5cd595,_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);return _0x39b19f(_0x13afa6[_0x9017('0x15')][_0x9017('0x17')]);}else{logger[_0x9017('0x11')](_0x9017('0x18'),_0x5cd595,'request\x20sent');_0x39b19f(_0x13afa6[_0x9017('0x19')]['message']);}})[_0x9017('0x1a')](function(_0x57ccfa){logger['error'](_0x9017('0x18'),_0x5cd595,_0x57ccfa);_0x286b77(_0x57ccfa);});});}exports[_0x9017('0x1b')]=function(_0x20e64f){var _0x2837c5=this;return new Promise(function(_0x2b70aa,_0x17934e){return db[_0x9017('0x1c')]['create'](_0x20e64f[_0x9017('0x1d')],{'raw':_0x20e64f['options']?_0x20e64f[_0x9017('0x1e')][_0x9017('0x1f')]===undefined?!![]:![]:!![]})[_0x9017('0x10')](function(_0x5c7ea4){logger['info'](_0x9017('0x1b'),_0x20e64f);logger[_0x9017('0x12')](_0x9017('0x1b'),_0x20e64f,JSON[_0x9017('0x14')](_0x5c7ea4));_0x2b70aa(_0x5c7ea4);})['catch'](function(_0x251f8d){logger[_0x9017('0x15')]('CreatePlugin',_0x251f8d['message'],_0x20e64f);_0x17934e(_0x2837c5[_0x9017('0x15')](0x1f4,_0x251f8d[_0x9017('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1c7a79d..6375ad8 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 _0x2bd0=['save','remove','update','emit','removeListener','length','./plugin.events'];(function(_0x47b815,_0x1b58fd){var _0x2acc27=function(_0x25524e){while(--_0x25524e){_0x47b815['push'](_0x47b815['shift']());}};_0x2acc27(++_0x1b58fd);}(_0x2bd0,0x141));var _0x02bd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2bd0[_0x6131cd];return _0x47e916;};'use strict';var PluginEvents=require(_0x02bd('0x0'));var events=[_0x02bd('0x1'),_0x02bd('0x2'),_0x02bd('0x3')];function createListener(_0x2a1ce9,_0x3557fb){return function(_0x350be3){_0x3557fb[_0x02bd('0x4')](_0x2a1ce9,_0x350be3);};}function removeListener(_0x3316d3,_0x1c2d1d){return function(){PluginEvents[_0x02bd('0x5')](_0x3316d3,_0x1c2d1d);};}exports['register']=function(_0x32796e){for(var _0x2b2123=0x0,_0x30a5f7=events[_0x02bd('0x6')];_0x2b2123<_0x30a5f7;_0x2b2123++){var _0x240353=events[_0x2b2123];var _0x1e0507=createListener('plugin:'+_0x240353,_0x32796e);PluginEvents['on'](_0x240353,_0x1e0507);}}; \ No newline at end of file +var _0x3069=['remove','removeListener','register','length','./plugin.events','save'];(function(_0x4e4da4,_0x511775){var _0x4b2cc0=function(_0x58b406){while(--_0x58b406){_0x4e4da4['push'](_0x4e4da4['shift']());}};_0x4b2cc0(++_0x511775);}(_0x3069,0x16c));var _0x9306=function(_0x1b87a6,_0x4b11a0){_0x1b87a6=_0x1b87a6-0x0;var _0x3f2b76=_0x3069[_0x1b87a6];return _0x3f2b76;};'use strict';var PluginEvents=require(_0x9306('0x0'));var events=[_0x9306('0x1'),_0x9306('0x2'),'update'];function createListener(_0x48a219,_0x9ca79d){return function(_0x10963b){_0x9ca79d['emit'](_0x48a219,_0x10963b);};}function removeListener(_0x5a11be,_0x4949f2){return function(){PluginEvents[_0x9306('0x3')](_0x5a11be,_0x4949f2);};}exports[_0x9306('0x4')]=function(_0x1e91d0){for(var _0x29e605=0x0,_0x294d37=events[_0x9306('0x5')];_0x29e605<_0x294d37;_0x29e605++){var _0x3930eb=events[_0x29e605];var _0x283058=createListener('plugin:'+_0x3930eb,_0x1e91d0);PluginEvents['on'](_0x3930eb,_0x283058);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0faa80e..3d9bac0 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(_0x20b69c,_0x47c352){var _0x1801a8=function(_0x53c838){while(--_0x53c838){_0x20b69c['push'](_0x20b69c['shift']());}};_0x1801a8(++_0x47c352);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0xa1596b,_0x923dd1){var _0x3ce2f6=function(_0x240286){while(--_0x240286){_0xa1596b['push'](_0xa1596b['shift']());}};_0x3ce2f6(++_0x923dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 1ad91b4..8ad8015 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 _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x45f24a,_0xcda029){var _0x5d3b3d=function(_0x2130dd){while(--_0x2130dd){_0x45f24a['push'](_0x45f24a['shift']());}};_0x5d3b3d(++_0xcda029);}(_0x2f68,0x9a));var _0x82f6=function(_0x55b027,_0x2664d4){_0x55b027=_0x55b027-0x0;var _0x42112f=_0x2f68[_0x55b027];return _0x42112f;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file +var _0xb821=['params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','../../config/pm2','../../config/logger','child_process','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','reject','express','length','catch','show'];(function(_0x520155,_0x5c8d3c){var _0x164f31=function(_0xeec4a9){while(--_0xeec4a9){_0x520155['push'](_0x520155['shift']());}};_0x164f31(++_0x5c8d3c);}(_0xb821,0xa7));var _0x1b82=function(_0x944be3,_0x163b09){_0x944be3=_0x944be3-0x0;var _0x38ad64=_0xb821[_0x944be3];return _0x38ad64;};'use strict';var _=require('lodash');var pm2=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var path=require('path');var exec=require(_0x1b82('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x3b1d14,_0x1403ab){return function(_0x3fadf0){if(!_0x3fadf0){_0x3b1d14[_0x1b82('0x3')](0x194);;}return _0x3fadf0;};}function respondWithResult(_0x597ca7,_0x3e27c4){_0x3e27c4=_0x3e27c4||0xc8;return function(_0x192434){if(_0x192434){return _0x597ca7[_0x1b82('0x4')](_0x3e27c4)[_0x1b82('0x5')](_0x192434);}return null;};}function handleError(_0x18f45f,_0x7b87e8){_0x7b87e8=_0x7b87e8||0x1f4;return function(_0x161155){logger[_0x1b82('0x6')](_0x161155[_0x1b82('0x7')]);if(_0x161155['name']){delete _0x161155[_0x1b82('0x8')];}_0x18f45f[_0x1b82('0x4')](_0x7b87e8)[_0x1b82('0x9')](_0x161155);};}function execChildProcess(){return new BPromise(function(_0x14c57a,_0xcffb87){exec(_0x1b82('0xa'),function(_0x739f99,_0x1ce719,_0x5f521f){logger[_0x1b82('0xb')](_0x1ce719);logger[_0x1b82('0xb')](_0x5f521f);if(_0x739f99){logger[_0x1b82('0x6')](_0x739f99);return _0xcffb87(_0x739f99);}return _0x14c57a(_0x1ce719);});});}exports[_0x1b82('0xc')]=function(_0x50aed7,_0x1a6285){return pm2['list']()['then'](function(_0x1e553a){if(_0x1e553a){var _0x4bf75b=_[_0x1b82('0xd')](_0x1e553a,function(_0xe1d608){return _0xe1d608['name']===_0x1b82('0xe')||_0xe1d608['name']==='motion2';});return{'rows':_0x4bf75b,'count':_0x4bf75b[_0x1b82('0xf')]};}return null;})['then'](respondWithResult(_0x1a6285,null))[_0x1b82('0x10')](handleError(_0x1a6285,null));};exports[_0x1b82('0x11')]=function(_0xf42818,_0x4a09a2){return pm2['describe'](_0xf42818[_0x1b82('0x12')]['id'])['then'](respondWithResult(_0x4a09a2,null))[_0x1b82('0x13')](handleEntityNotFound(_0x4a09a2,null))[_0x1b82('0x10')](handleError(_0x4a09a2,null));};exports[_0x1b82('0x14')]=function(_0x594a63,_0x352426){if(_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')]&&_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]){var _0x47e99b=path[_0x1b82('0x17')](__dirname,_0x1b82('0x18'),_0x594a63[_0x1b82('0x15')][_0x1b82('0x16')]);var _0x26e481=process[_0x1b82('0x19')]();process[_0x1b82('0x1a')](path['dirname'](_0x47e99b));return execChildProcess()[_0x1b82('0x13')](function(_0x233740){process['chdir'](_0x26e481);return pm2[_0x1b82('0x1b')]({'name':_0x594a63[_0x1b82('0x15')][_0x1b82('0x8')],'script':_0x47e99b});})['then'](function(_0x3a1226){pm2['dump']();return _0x3a1226[0x0];})['then'](respondWithResult(_0x352426,0xc9))['catch'](handleError(_0x352426,null));}else{return _0x352426[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x1c')});}};exports[_0x1b82('0x1d')]=function(_0x548a3b,_0x222483){if(_0x548a3b[_0x1b82('0x15')]['id']){delete _0x548a3b[_0x1b82('0x15')]['id'];}var _0x7455e8={'online':_0x1b82('0x1e'),'stopped':_0x1b82('0x1f')};if(_0x7455e8[_0x1b82('0x20')](_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')])){return pm2[_0x7455e8[_0x548a3b[_0x1b82('0x15')][_0x1b82('0x4')]]](_0x548a3b[_0x1b82('0x12')]['id'])[_0x1b82('0x13')](respondWithResult(_0x222483,0xc8))['catch'](handleError(_0x222483,null));}else{return _0x222483[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':_0x1b82('0x21')});}};exports[_0x1b82('0x22')]=function(_0x18e4ff,_0x115ce7){if(_0x18e4ff[_0x1b82('0x15')]['id']){delete _0x18e4ff[_0x1b82('0x15')]['id'];}if(_0x18e4ff[_0x1b82('0x12')]['id']){return pm2[_0x1b82('0x23')](_0x18e4ff['params']['id'])[_0x1b82('0x13')](function(_0x29a31e){pm2[_0x1b82('0x24')]();return _0x29a31e[0x0];})[_0x1b82('0x13')](respondWithResult(_0x115ce7,null))['catch'](handleError(_0x115ce7,null));}else{return _0x115ce7[_0x1b82('0x4')](0x1f4)[_0x1b82('0x9')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index c1cb75d..9dd6572 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 _0x3992=['exports','express','get','/agents','getAgents','/queues','getQueues'];(function(_0x70d3b5,_0x4bbd30){var _0x4f96d6=function(_0x25798d){while(--_0x25798d){_0x70d3b5['push'](_0x70d3b5['shift']());}};_0x4f96d6(++_0x4bbd30);}(_0x3992,0x1c8));var _0x2399=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3992[_0x432682];return _0x463d05;};'use strict';var express=require(_0x2399('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x2399('0x1')](_0x2399('0x2'),auth['isAuthenticated'](),controller[_0x2399('0x3')]);router[_0x2399('0x1')](_0x2399('0x4'),auth['isAuthenticated'](),controller[_0x2399('0x5')]);module[_0x2399('0x6')]=router; \ No newline at end of file +var _0x4579=['/queues','getQueues','express','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents'];(function(_0x34cea1,_0x16d860){var _0x2d796a=function(_0x11e340){while(--_0x11e340){_0x34cea1['push'](_0x34cea1['shift']());}};_0x2d796a(++_0x16d860);}(_0x4579,0x8a));var _0x9457=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4579[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x9457('0x0'));var router=express['Router']();var auth=require(_0x9457('0x1'));var controller=require(_0x9457('0x2'));router[_0x9457('0x3')]('/agents',auth[_0x9457('0x4')](),controller[_0x9457('0x5')]);router[_0x9457('0x3')](_0x9457('0x6'),auth[_0x9457('0x4')](),controller[_0x9457('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 199b81a..7a975cc 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 _0x4a98=['initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','limit','undefined','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','sort','includes','validateSortParameter','fields','order','getAgentIdsByQueues','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','getOptions','raw','push','sequelize','FIELD(id,','forEach','Pause','where','user','Agents','agent','online','extraQueryConditions','omit','findAndCountAll','count','rows','find','filterAgentAttributes','merge','globalStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Queue','name','outbound','dialActive','join','userProfileId','QueueCampaigns','startCase','Queues','filter','assign','UserProfile','getResources','getRealtimeQueues'];(function(_0x198a64,_0x161ee9){var _0x538d15=function(_0x2c5d1a){while(--_0x2c5d1a){_0x198a64['push'](_0x198a64['shift']());}};_0x538d15(++_0x161ee9);}(_0x4a98,0xaf));var _0x84a9=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0x4a98[_0x57a670];return _0x41ce21;};'use strict';var _=require(_0x84a9('0x0'));var util=require(_0x84a9('0x1'));var rta=require(_0x84a9('0x2'));var rtq=require(_0x84a9('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x84a9('0x4'));var db=require(_0x84a9('0x5'))['db'];var APIBadRequestError=require(_0x84a9('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x84a9('0x6'))[_0x84a9('0x7')];function respondWithFilteredResult(_0x55e0f1,_0x469c21){return function(_0x2b913f){if(_0x2b913f){var _0x3f0cf3=typeof _0x469c21[_0x84a9('0x8')]==='undefined'&&typeof _0x469c21[_0x84a9('0x9')]===_0x84a9('0xa');var _0x4f701b=_0x2b913f['count'];var _0x4a0d52=_0x3f0cf3?0x0:_0x469c21[_0x84a9('0x8')];var _0x50f375=_0x3f0cf3?_0x2b913f['count']:_0x469c21[_0x84a9('0x8')]+_0x469c21[_0x84a9('0x9')];var _0x4c2015;if(_0x50f375>=_0x4f701b){_0x50f375=_0x4f701b;_0x4c2015=0xc8;}else{_0x4c2015=0xce;}_0x55e0f1[_0x84a9('0xb')](_0x4c2015);return _0x55e0f1[_0x84a9('0xc')](_0x84a9('0xd'),_0x4a0d52+'-'+_0x50f375+'/'+_0x4f701b)['json'](_0x2b913f);}return null;};}exports[_0x84a9('0xe')]=function(_0xc802b2,_0xff63a7){var _0x18c530={'count':0x0,'rows':[]};var _0x25854f={};var _0x57b426;var _0x373102=utils[_0x84a9('0xf')]();var _0x395afa;var _0x3ca4f0;var _0x53c5e4=_0xc802b2[_0x84a9('0x10')][_0x84a9('0x11')];var _0x32a4e4=_0xc802b2[_0x84a9('0x10')]['globalStatusFilter'];var _0x91889=_0xc802b2[_0x84a9('0x10')][_0x84a9('0x12')];var _0x1c8de3=_0x32a4e4===_0x84a9('0x13')||_0x32a4e4===_0x84a9('0x14')?!![]:![];var _0x4aa3e4=[];var _0x3664eb;var _0x114529;Promise[_0x84a9('0x15')]()[_0x84a9('0x16')](function(){if(_0xc802b2[_0x84a9('0x10')][_0x84a9('0x17')]){if(!utils[_0x84a9('0x18')](_0xc802b2[_0x84a9('0x10')][_0x84a9('0x17')])){throw new APIBadRequestError(util[_0x84a9('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xc802b2['query']['channel']));}_0x57b426=_0xc802b2[_0x84a9('0x10')][_0x84a9('0x17')]['toLowerCase']();}if(!_0xc802b2[_0x84a9('0x10')][_0x84a9('0x1a')]||!_0xc802b2[_0x84a9('0x10')][_0x84a9('0x1a')][_0x84a9('0x1b')]('globalStatus')){_0xc802b2[_0x84a9('0x10')]['sort']=rta[_0x84a9('0x1c')](_0xc802b2[_0x84a9('0x10')]['sort']);return;}var _0x145e3f=rta['getUpdatedSortOptions'](_0xc802b2[_0x84a9('0x10')][_0x84a9('0x1a')]);_0xc802b2[_0x84a9('0x10')][_0x84a9('0x1a')]=_0x145e3f[_0x84a9('0x1d')]['join'](',');_0x3664eb=_0x145e3f[_0x84a9('0x1e')];})[_0x84a9('0x16')](function(){if(!_0x53c5e4){return[];}return rta[_0x84a9('0x1f')](_0x53c5e4,_0x57b426);})[_0x84a9('0x16')](function(_0x4ebf3a){_0x4aa3e4=_0x4ebf3a;return rta[_0x84a9('0x20')]();})[_0x84a9('0x16')](function(_0x2d40eb){_0x3ca4f0=_0x2d40eb['rows'];if((!_0x32a4e4||_0x1c8de3)&&!_0x3664eb){return _0x4aa3e4;}if(_0x3664eb&&!_0x32a4e4){return rta['getSortedAgentsIdsByStatus'](_0x3ca4f0,_0x4aa3e4,_0x3664eb);}else{return rta[_0x84a9('0x21')](_0x3ca4f0,_0x4aa3e4,_0x32a4e4);}})[_0x84a9('0x16')](function(_0x11900c){_0x4aa3e4=_0x11900c;var _0x226353=![];if(_0x4aa3e4[_0x84a9('0x22')]===0x0){if(_0x53c5e4||_0x32a4e4){_0x226353=!![];}if(_0x1c8de3){_0x226353=![];}}if(_0x226353){return _0x18c530;}var _0x12da33=_[_0x84a9('0x23')](db[_0x84a9('0x24')][_0x84a9('0x25')],function(_0x4fd6fb){return{'name':_0x4fd6fb[_0x84a9('0x26')],'type':_0x4fd6fb[_0x84a9('0x27')][_0x84a9('0x28')]};});_0xc802b2[_0x84a9('0x10')][_0x84a9('0x29')]='agent';_0x25854f=qs[_0x84a9('0x2a')](_0x12da33,_0xc802b2);_0x25854f[_0x84a9('0x2b')]=!![];var _0x3c1d45=[];if(_0x4aa3e4[_0x84a9('0x22')]>0x0){_0x3c1d45[_0x84a9('0x2c')]({'id':{'$in':_0x4aa3e4}});if(_0x3664eb&&!_0x32a4e4){_0x114529=[db[_0x84a9('0x2d')]['literal'](_0x84a9('0x2e')+_0x4aa3e4+')')];_0x25854f[_0x84a9('0x1e')]=_0x114529;}}if(_0x1c8de3){_0x373102[_0x84a9('0x2f')](function(_0xebde84){var _0x36492b=!![];if(_0x32a4e4==='*pause'&&_0x57b426!==_0xebde84){_0x36492b=![];}_0x3c1d45['push']({[_0xebde84+_0x84a9('0x30')]:_0x36492b});});if(_0x91889){_0x3c1d45['push']({'pauseType':_0x91889});}}else if(_0x32a4e4){_0x373102[_0x84a9('0x2f')](function(_0x576b47){_0x3c1d45[_0x84a9('0x2c')]({[_0x576b47+_0x84a9('0x30')]:![]});});}_0x25854f[_0x84a9('0x31')]=_['merge'](_0x25854f[_0x84a9('0x31')],{'$and':_0x3c1d45});if(_0xc802b2['user'][_0x84a9('0x29')]===_0x84a9('0x32')){var _0x27308b={'params':{'id':_0xc802b2['user']['userProfileId']},'query':{'section':_0x84a9('0x33'),'role':_0x84a9('0x34'),'raw':!![],'ids':_0x4aa3e4,'customSorting':_0x114529}};if(_0xc802b2[_0x84a9('0x10')][_0x84a9('0x35')]){_0x27308b[_0x84a9('0x10')][_0x84a9('0x35')]=!![];}if(_0x1c8de3){_0x27308b[_0x84a9('0x10')][_0x84a9('0x36')]=_0x3c1d45;}_0x27308b[_0x84a9('0x10')]=Object['assign'](_0x27308b[_0x84a9('0x10')],_[_0x84a9('0x37')](_0xc802b2[_0x84a9('0x10')],'id'));return db['UserProfile']['getResources'](_0x27308b);}return db[_0x84a9('0x24')][_0x84a9('0x38')](_0x25854f);})[_0x84a9('0x16')](function(_0x42194b){_0x18c530[_0x84a9('0x39')]=_0x42194b[_0x84a9('0x39')];_0x395afa=_0x42194b[_0x84a9('0x3a')];return _0x395afa[_0x84a9('0x23')](function(_0x4bb46b){var _0x240865=_[_0x84a9('0x3b')](_0x3ca4f0,['id',_0x4bb46b['id']]);if(_0x240865){var _0x20cddc=rta[_0x84a9('0x3c')](_0x240865);_[_0x84a9('0x3d')](_0x4bb46b,_0x20cddc);}_0x4bb46b[_0x84a9('0x3e')]=rta['getAgentStatus'](_0x4bb46b);if(_0x4bb46b[_0x84a9('0x3e')]['includes']('pause')){_0x373102[_0x84a9('0x2f')](function(_0x52a043){if(_0x4bb46b[_0x52a043+_0x84a9('0x30')]){if(_0x52a043===_0x84a9('0x3f')){if(_0x4bb46b[_0x84a9('0x40')]!==_0x84a9('0x41')){_0x4bb46b[_0x84a9('0x40')]=_0x84a9('0x13');}}else{_0x4bb46b[_0x52a043+_0x84a9('0x42')]=_0x84a9('0x13');}}});}return _0x4bb46b;});})[_0x84a9('0x16')](function(_0xd1fba1){if(!_0x3664eb||_0x114529){return _0xd1fba1;}return rta[_0x84a9('0x43')](_0xd1fba1,_0x3664eb);})[_0x84a9('0x16')](function(_0x20353c){var _0x3809bb=rta[_0x84a9('0x44')]();_0x18c530['rows']=_0x20353c[_0x84a9('0x23')](function(_0x353e86){return _[_0x84a9('0x45')](_0x353e86,_0x3809bb);});return _0x18c530;})[_0x84a9('0x16')](respondWithFilteredResult(_0xff63a7,_0x25854f))[_0x84a9('0x46')](APIHandleError(_0xff63a7));};exports[_0x84a9('0x47')]=function(_0x2ef764,_0x197168){var _0x873bd6={'count':0x0,'rows':[]};var _0xb8e3d0={};var _0x186a2d;var _0x190cde;var _0x2e7146;Promise[_0x84a9('0x15')]()[_0x84a9('0x16')](function(){if(_0x2ef764['query'][_0x84a9('0x17')]){if(!utils['isValidChannel'](_0x2ef764[_0x84a9('0x10')][_0x84a9('0x17')])){throw new APIBadRequestError(util[_0x84a9('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2ef764[_0x84a9('0x10')][_0x84a9('0x17')]));}_0x186a2d=_0x2ef764['query'][_0x84a9('0x17')]['toLowerCase']();}var _0x326f9c=_['startCase'](_0x186a2d)+_0x84a9('0x48');var _0x3f42f4=_[_0x84a9('0x23')](db[_0x326f9c][_0x84a9('0x25')],function(_0x418d66){return{'name':_0x418d66[_0x84a9('0x26')],'type':_0x418d66[_0x84a9('0x27')][_0x84a9('0x28')]};});if(!_0x2ef764[_0x84a9('0x10')][_0x84a9('0x1d')]){var _0x286955=['id',_0x84a9('0x49')];if(_0x186a2d===_0x84a9('0x3f')){_0x286955['push']('type');if(_0x2ef764[_0x84a9('0x10')][_0x84a9('0x27')]===_0x84a9('0x4a')){_0x286955['push']([_0x84a9('0x4b'),'dialMethod']);}}_0x2ef764[_0x84a9('0x10')][_0x84a9('0x1d')]=_0x286955[_0x84a9('0x4c')](',');}_0xb8e3d0=qs['getOptions'](_0x3f42f4,_0x2ef764);if(_0x2ef764[_0x84a9('0x32')]['role']==='user'){var _0x406153={'params':{'id':_0x2ef764[_0x84a9('0x32')][_0x84a9('0x4d')]},'query':{'section':_0x186a2d===_0x84a9('0x3f')&&_0x2ef764[_0x84a9('0x10')][_0x84a9('0x27')]===_0x84a9('0x4a')?_0x84a9('0x4e'):_[_0x84a9('0x4f')](_0x186a2d)+_0x84a9('0x50'),'type':_0x2ef764['query'][_0x84a9('0x27')],'nolimit':!![],'sort':_0x84a9('0x49'),'filter':_0x2ef764[_0x84a9('0x10')][_0x84a9('0x51')]}};_0x406153[_0x84a9('0x10')]=Object[_0x84a9('0x52')](_0x406153['query'],_0x2ef764['query']);delete _0x406153[_0x84a9('0x10')]['id'];return db[_0x84a9('0x53')][_0x84a9('0x54')](_0x406153);}return db[_0x326f9c][_0x84a9('0x38')](_0xb8e3d0);})[_0x84a9('0x16')](function(_0x456368){_0x873bd6[_0x84a9('0x39')]=_0x456368['count'];_0x190cde=_0x456368[_0x84a9('0x3a')];return rtq[_0x84a9('0x55')](_0x2ef764,_0x186a2d);})['then'](function(_0x257dbc){_0x2e7146=_0x257dbc[_0x84a9('0x3a')];return rtq[_0x84a9('0x56')](_0x190cde,_0x2e7146,_0x186a2d,_0x2ef764[_0x84a9('0x10')][_0x84a9('0x27')]);})[_0x84a9('0x16')](function(_0x15ad1f){_0x873bd6[_0x84a9('0x3a')]=_0x15ad1f;return _0x873bd6;})['then'](respondWithFilteredResult(_0x197168,_0xb8e3d0))['catch'](APIHandleError(_0x197168));}; \ No newline at end of file +var _0x7cce=['talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','map','pick','catch','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','Queue','key','fields','outbound','dialMethod','QueueCampaigns','Queues','name','filter','getResources','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','format','toLowerCase','sort','includes','validateSortParameter','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','role','agent','getOptions','raw','literal','FIELD(id,','forEach','Pause','push','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll','find','globalStatus','getAgentStatus','pause','voice','voiceStatus'];(function(_0x21b0ef,_0x2bec64){var _0x135500=function(_0x4d155){while(--_0x4d155){_0x21b0ef['push'](_0x21b0ef['shift']());}};_0x135500(++_0x2bec64);}(_0x7cce,0xc2));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7cc('0x0'));var util=require(_0xe7cc('0x1'));var rta=require(_0xe7cc('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0xe7cc('0x3'));var utils=require(_0xe7cc('0x4'));var db=require(_0xe7cc('0x5'))['db'];var APIBadRequestError=require(_0xe7cc('0x6'))[_0xe7cc('0x7')];var APIHandleError=require('../../errors/api')[_0xe7cc('0x8')];function respondWithFilteredResult(_0x1df0bc,_0x3207b0){return function(_0x7c6627){if(_0x7c6627){var _0x135d3a=typeof _0x3207b0[_0xe7cc('0x9')]===_0xe7cc('0xa')&&typeof _0x3207b0['limit']===_0xe7cc('0xa');var _0x23958d=_0x7c6627[_0xe7cc('0xb')];var _0xffacfa=_0x135d3a?0x0:_0x3207b0[_0xe7cc('0x9')];var _0x1718a7=_0x135d3a?_0x7c6627[_0xe7cc('0xb')]:_0x3207b0['offset']+_0x3207b0[_0xe7cc('0xc')];var _0x18747a;if(_0x1718a7>=_0x23958d){_0x1718a7=_0x23958d;_0x18747a=0xc8;}else{_0x18747a=0xce;}_0x1df0bc['status'](_0x18747a);return _0x1df0bc[_0xe7cc('0xd')](_0xe7cc('0xe'),_0xffacfa+'-'+_0x1718a7+'/'+_0x23958d)[_0xe7cc('0xf')](_0x7c6627);}return null;};}exports[_0xe7cc('0x10')]=function(_0x368b24,_0x533dfe){var _0x22c1a2={'count':0x0,'rows':[]};var _0x9276f6={};var _0x1ee1b5;var _0x140e9d=utils[_0xe7cc('0x11')]();var _0x39c900;var _0x5c4f99;var _0x26fb2e=_0x368b24[_0xe7cc('0x12')]['globalQueueFilter'];var _0x374178=_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x13')];var _0xe8746e=_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x14')];var _0x108e78=_0x374178==='pause'||_0x374178===_0xe7cc('0x15')?!![]:![];var _0x5780f6=[];var _0x3ebc6e;var _0x38ace9;Promise[_0xe7cc('0x16')]()['then'](function(){if(_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x17')]){if(!utils['isValidChannel'](_0x368b24['query'][_0xe7cc('0x17')])){throw new APIBadRequestError(util[_0xe7cc('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x368b24['query'][_0xe7cc('0x17')]));}_0x1ee1b5=_0x368b24['query']['channel'][_0xe7cc('0x19')]();}if(!_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]||!_0x368b24[_0xe7cc('0x12')]['sort'][_0xe7cc('0x1b')]('globalStatus')){_0x368b24['query'][_0xe7cc('0x1a')]=rta[_0xe7cc('0x1c')](_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]);return;}var _0x2ed518=rta['getUpdatedSortOptions'](_0x368b24[_0xe7cc('0x12')]['sort']);_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x1a')]=_0x2ed518['fields'][_0xe7cc('0x1d')](',');_0x3ebc6e=_0x2ed518[_0xe7cc('0x1e')];})[_0xe7cc('0x1f')](function(){if(!_0x26fb2e){return[];}return rta[_0xe7cc('0x20')](_0x26fb2e,_0x1ee1b5);})['then'](function(_0x3f8884){_0x5780f6=_0x3f8884;return rta[_0xe7cc('0x21')]();})['then'](function(_0x422ec6){_0x5c4f99=_0x422ec6[_0xe7cc('0x22')];if((!_0x374178||_0x108e78)&&!_0x3ebc6e){return _0x5780f6;}if(_0x3ebc6e&&!_0x374178){return rta[_0xe7cc('0x23')](_0x5c4f99,_0x5780f6,_0x3ebc6e);}else{return rta[_0xe7cc('0x24')](_0x5c4f99,_0x5780f6,_0x374178);}})[_0xe7cc('0x1f')](function(_0x3618b6){_0x5780f6=_0x3618b6;var _0x20b9d0=![];if(_0x5780f6[_0xe7cc('0x25')]===0x0){if(_0x26fb2e||_0x374178){_0x20b9d0=!![];}if(_0x108e78){_0x20b9d0=![];}}if(_0x20b9d0){return _0x22c1a2;}var _0x557cb2=_['map'](db[_0xe7cc('0x26')][_0xe7cc('0x27')],function(_0x25bca6){return{'name':_0x25bca6[_0xe7cc('0x28')],'type':_0x25bca6[_0xe7cc('0x29')]['key']};});_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x2a')]=_0xe7cc('0x2b');_0x9276f6=qs[_0xe7cc('0x2c')](_0x557cb2,_0x368b24);_0x9276f6[_0xe7cc('0x2d')]=!![];var _0x138375=[];if(_0x5780f6['length']>0x0){_0x138375['push']({'id':{'$in':_0x5780f6}});if(_0x3ebc6e&&!_0x374178){_0x38ace9=[db['sequelize'][_0xe7cc('0x2e')](_0xe7cc('0x2f')+_0x5780f6+')')];_0x9276f6[_0xe7cc('0x1e')]=_0x38ace9;}}if(_0x108e78){_0x140e9d[_0xe7cc('0x30')](function(_0x48ba96){var _0x4808a9=!![];if(_0x374178===_0xe7cc('0x15')&&_0x1ee1b5!==_0x48ba96){_0x4808a9=![];}_0x138375['push']({[_0x48ba96+_0xe7cc('0x31')]:_0x4808a9});});if(_0xe8746e){_0x138375[_0xe7cc('0x32')]({'pauseType':_0xe8746e});}}else if(_0x374178){_0x140e9d[_0xe7cc('0x30')](function(_0x3d8c0e){_0x138375[_0xe7cc('0x32')]({[_0x3d8c0e+'Pause']:![]});});}_0x9276f6[_0xe7cc('0x33')]=_[_0xe7cc('0x34')](_0x9276f6[_0xe7cc('0x33')],{'$and':_0x138375});if(_0x368b24['user'][_0xe7cc('0x2a')]===_0xe7cc('0x35')){var _0x17735d={'params':{'id':_0x368b24[_0xe7cc('0x35')][_0xe7cc('0x36')]},'query':{'section':_0xe7cc('0x37'),'role':_0xe7cc('0x2b'),'raw':!![],'ids':_0x5780f6,'customSorting':_0x38ace9}};if(_0x368b24[_0xe7cc('0x12')][_0xe7cc('0x38')]){_0x17735d[_0xe7cc('0x12')]['online']=!![];}if(_0x108e78){_0x17735d['query'][_0xe7cc('0x39')]=_0x138375;}_0x17735d['query']=Object[_0xe7cc('0x3a')](_0x17735d['query'],_['omit'](_0x368b24['query'],'id'));return db[_0xe7cc('0x3b')]['getResources'](_0x17735d);}return db[_0xe7cc('0x26')][_0xe7cc('0x3c')](_0x9276f6);})[_0xe7cc('0x1f')](function(_0x138e3a){_0x22c1a2[_0xe7cc('0xb')]=_0x138e3a[_0xe7cc('0xb')];_0x39c900=_0x138e3a['rows'];return _0x39c900['map'](function(_0x4a07ab){var _0x46620e=_[_0xe7cc('0x3d')](_0x5c4f99,['id',_0x4a07ab['id']]);if(_0x46620e){var _0x37947b=rta['filterAgentAttributes'](_0x46620e);_[_0xe7cc('0x34')](_0x4a07ab,_0x37947b);}_0x4a07ab[_0xe7cc('0x3e')]=rta[_0xe7cc('0x3f')](_0x4a07ab);if(_0x4a07ab[_0xe7cc('0x3e')][_0xe7cc('0x1b')](_0xe7cc('0x40'))){_0x140e9d[_0xe7cc('0x30')](function(_0x44c33c){if(_0x4a07ab[_0x44c33c+'Pause']){if(_0x44c33c===_0xe7cc('0x41')){if(_0x4a07ab[_0xe7cc('0x42')]!==_0xe7cc('0x43')){_0x4a07ab[_0xe7cc('0x42')]='pause';}}else{_0x4a07ab[_0x44c33c+_0xe7cc('0x44')]=_0xe7cc('0x40');}}});}return _0x4a07ab;});})['then'](function(_0xc26360){if(!_0x3ebc6e||_0x38ace9){return _0xc26360;}return rta[_0xe7cc('0x45')](_0xc26360,_0x3ebc6e);})['then'](function(_0x490da3){var _0x379e5c=rta[_0xe7cc('0x46')]();_0x22c1a2[_0xe7cc('0x22')]=_0x490da3[_0xe7cc('0x47')](function(_0x43b357){return _[_0xe7cc('0x48')](_0x43b357,_0x379e5c);});return _0x22c1a2;})[_0xe7cc('0x1f')](respondWithFilteredResult(_0x533dfe,_0x9276f6))[_0xe7cc('0x49')](APIHandleError(_0x533dfe));};exports['getQueues']=function(_0x2d9dbb,_0x402733){var _0xa546d7={'count':0x0,'rows':[]};var _0x476908={};var _0x10ce97;var _0x1ab6ca;var _0x23ebdd;Promise[_0xe7cc('0x16')]()[_0xe7cc('0x1f')](function(){if(_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')]){if(!utils[_0xe7cc('0x4a')](_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')])){throw new APIBadRequestError(util[_0xe7cc('0x18')](_0xe7cc('0x4b'),_0x2d9dbb['query'][_0xe7cc('0x17')]));}_0x10ce97=_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x17')][_0xe7cc('0x19')]();}var _0x3e9a54=_['startCase'](_0x10ce97)+_0xe7cc('0x4c');var _0x25b2d8=_[_0xe7cc('0x47')](db[_0x3e9a54]['rawAttributes'],function(_0x3d8276){return{'name':_0x3d8276[_0xe7cc('0x28')],'type':_0x3d8276['type'][_0xe7cc('0x4d')]};});if(!_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x4e')]){var _0x14ebaf=['id','name'];if(_0x10ce97===_0xe7cc('0x41')){_0x14ebaf[_0xe7cc('0x32')]('type');if(_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]===_0xe7cc('0x4f')){_0x14ebaf[_0xe7cc('0x32')](['dialActive',_0xe7cc('0x50')]);}}_0x2d9dbb[_0xe7cc('0x12')]['fields']=_0x14ebaf['join'](',');}_0x476908=qs['getOptions'](_0x25b2d8,_0x2d9dbb);if(_0x2d9dbb[_0xe7cc('0x35')]['role']===_0xe7cc('0x35')){var _0x3d7401={'params':{'id':_0x2d9dbb[_0xe7cc('0x35')][_0xe7cc('0x36')]},'query':{'section':_0x10ce97==='voice'&&_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]==='outbound'?_0xe7cc('0x51'):_['startCase'](_0x10ce97)+_0xe7cc('0x52'),'type':_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')],'nolimit':!![],'sort':_0xe7cc('0x53'),'filter':_0x2d9dbb['query'][_0xe7cc('0x54')]}};_0x3d7401[_0xe7cc('0x12')]=Object['assign'](_0x3d7401['query'],_0x2d9dbb[_0xe7cc('0x12')]);delete _0x3d7401[_0xe7cc('0x12')]['id'];return db['UserProfile'][_0xe7cc('0x55')](_0x3d7401);}return db[_0x3e9a54][_0xe7cc('0x3c')](_0x476908);})[_0xe7cc('0x1f')](function(_0x2b964c){_0xa546d7[_0xe7cc('0xb')]=_0x2b964c[_0xe7cc('0xb')];_0x1ab6ca=_0x2b964c['rows'];return rtq[_0xe7cc('0x56')](_0x2d9dbb,_0x10ce97);})[_0xe7cc('0x1f')](function(_0x3b81cf){_0x23ebdd=_0x3b81cf[_0xe7cc('0x22')];return rtq['initializeQueues'](_0x1ab6ca,_0x23ebdd,_0x10ce97,_0x2d9dbb[_0xe7cc('0x12')][_0xe7cc('0x29')]);})[_0xe7cc('0x1f')](function(_0x53481c){_0xa546d7['rows']=_0x53481c;return _0xa546d7;})['then'](respondWithFilteredResult(_0x402733,_0x476908))[_0xe7cc('0x49')](APIHandleError(_0x402733));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c43e950..9329be3 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x391d90,_0x4b8c59){var _0x45dfd4=function(_0xaf207a){while(--_0xaf207a){_0x391d90['push'](_0x391d90['shift']());}};_0x45dfd4(++_0x4b8c59);}(_0xe706,0xa3));var _0x6e70=function(_0xfa75b5,_0x5cbe19){_0xfa75b5=_0xfa75b5-0x0;var _0x1c1911=_0xe706[_0xfa75b5];return _0x1c1911;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x52dbd1,_0xe46f69){var _0x58c76a=function(_0x35bff0){while(--_0x35bff0){_0x52dbd1['push'](_0x52dbd1['shift']());}};_0x58c76a(++_0xe46f69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d0a8e19..57c6e5f 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 _0xd7ce=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xd7ce,0x16b));var _0xed7c=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xd7ce[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require(_0xed7c('0x0'));module[_0xed7c('0x1')]={'state':{'type':Sequelize[_0xed7c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xed7c('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xed7c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xed7c('0x3')]},'membername':{'type':Sequelize[_0xed7c('0x3')]}}; \ No newline at end of file +var _0x7217=['STRING','DATE','sequelize','INTEGER'];(function(_0x26abbb,_0xce92dd){var _0x4fc77f=function(_0x1d8c33){while(--_0x1d8c33){_0x26abbb['push'](_0x26abbb['shift']());}};_0x4fc77f(++_0xce92dd);}(_0x7217,0x19e));var _0x7721=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7217[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'state':{'type':Sequelize[_0x7721('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7721('0x2')]},'scheduledat':{'type':Sequelize[_0x7721('0x3')]},'uniqueid':{'type':Sequelize[_0x7721('0x2')]},'starttime':{'type':Sequelize[_0x7721('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7721('0x2')]},'campaigntype':{'type':Sequelize[_0x7721('0x2')]},'membername':{'type':Sequelize[_0x7721('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4c08d22..1ee4a5c 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 _0x1198=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x1198,0x8a));var _0x8119=function(_0x7f90e6,_0xd69393){_0x7f90e6=_0x7f90e6-0x0;var _0x3b8426=_0x1198[_0x7f90e6];return _0x3b8426;};'use strict';var _=require('lodash');var util=require(_0x8119('0x0'));var logger=require(_0x8119('0x1'))(_0x8119('0x2'));var moment=require('moment');var BPromise=require(_0x8119('0x3'));var rp=require(_0x8119('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8119('0x5'));var config=require(_0x8119('0x6'));var attributes=require(_0x8119('0x7'));module[_0x8119('0x8')]=function(_0xc118aa,_0x15a43d){return _0xc118aa[_0x8119('0x9')](_0x8119('0xa'),attributes,{'tableName':_0x8119('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ffa=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x533b90,_0x4352f3){var _0x210919=function(_0x383bb9){while(--_0x383bb9){_0x533b90['push'](_0x533b90['shift']());}};_0x210919(++_0x4352f3);}(_0x4ffa,0x1ca));var _0xa4ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ffa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4ff('0x0'))(_0xa4ff('0x1'));var moment=require(_0xa4ff('0x2'));var BPromise=require(_0xa4ff('0x3'));var rp=require(_0xa4ff('0x4'));var fs=require('fs');var path=require(_0xa4ff('0x5'));var rimraf=require(_0xa4ff('0x6'));var config=require(_0xa4ff('0x7'));var attributes=require(_0xa4ff('0x8'));module['exports']=function(_0x57124b,_0x2d4b1d){return _0x57124b[_0xa4ff('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xa4ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index f336c67..f43dd94 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 _0x50bf=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateReportAgentPreview','body','options','lodash'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x50bf,0xd7));var _0xf50b=function(_0x573241,_0x53d481){_0x573241=_0x573241-0x0;var _0x32858a=_0x50bf[_0x573241];return _0x32858a;};'use strict';var _=require(_0xf50b('0x0'));var util=require(_0xf50b('0x1'));var moment=require(_0xf50b('0x2'));var BPromise=require(_0xf50b('0x3'));var rs=require(_0xf50b('0x4'));var fs=require('fs');var Redis=require(_0xf50b('0x5'));var db=require(_0xf50b('0x6'))['db'];var utils=require(_0xf50b('0x7'));var logger=require(_0xf50b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf50b('0x9'));var client=jayson[_0xf50b('0xa')][_0xf50b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5502ef,_0x53aa63,_0x239eee){return new BPromise(function(_0x2d108c,_0x1bc2bb){return client[_0xf50b('0xc')](_0x5502ef,_0x239eee)[_0xf50b('0xd')](function(_0x5ad41e){logger[_0xf50b('0xe')](_0xf50b('0xf'),_0x53aa63,_0xf50b('0x10'));logger[_0xf50b('0x11')](_0xf50b('0x12'),_0x53aa63,'request\x20sent',JSON[_0xf50b('0x13')](_0x5ad41e));if(_0x5ad41e['error']){if(_0x5ad41e[_0xf50b('0x14')]['code']===0x1f4){logger[_0xf50b('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x53aa63,_0x5ad41e[_0xf50b('0x14')][_0xf50b('0x15')]);return _0x1bc2bb(_0x5ad41e[_0xf50b('0x14')]['message']);}logger[_0xf50b('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x53aa63,_0x5ad41e[_0xf50b('0x14')][_0xf50b('0x15')]);return _0x2d108c(_0x5ad41e[_0xf50b('0x14')][_0xf50b('0x15')]);}else{logger['info'](_0xf50b('0xf'),_0x53aa63,'request\x20sent');_0x2d108c(_0x5ad41e[_0xf50b('0x16')]['message']);}})[_0xf50b('0x17')](function(_0x2e3568){logger[_0xf50b('0x14')](_0xf50b('0xf'),_0x53aa63,_0x2e3568);_0x1bc2bb(_0x2e3568);});});}exports[_0xf50b('0x18')]=function(_0x2d3567){var _0x567704=this;return new Promise(function(_0x250810,_0x11d5de){return db['ReportAgentPreview']['create'](_0x2d3567[_0xf50b('0x19')],{'raw':_0x2d3567[_0xf50b('0x1a')]?_0x2d3567[_0xf50b('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf50b('0xd')](function(_0x16ab6f){logger[_0xf50b('0xe')](_0xf50b('0x18'),_0x2d3567);logger['debug'](_0xf50b('0x18'),_0x2d3567,JSON['stringify'](_0x16ab6f));_0x250810(_0x16ab6f);})[_0xf50b('0x17')](function(_0x202552){logger['error'](_0xf50b('0x18'),_0x202552['message'],_0x2d3567);_0x11d5de(_0x567704[_0xf50b('0x14')](0x1f4,_0x202552[_0xf50b('0x15')]));});});}; \ No newline at end of file +var _0xc20d=['../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','body','options','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc20d,0x1b3));var _0xdc20=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xc20d[_0x3f4891];return _0x54f2d8;};'use strict';var _=require('lodash');var util=require(_0xdc20('0x0'));var moment=require(_0xdc20('0x1'));var BPromise=require(_0xdc20('0x2'));var rs=require(_0xdc20('0x3'));var fs=require('fs');var Redis=require(_0xdc20('0x4'));var db=require(_0xdc20('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc20('0x6'));var config=require(_0xdc20('0x7'));var jayson=require(_0xdc20('0x8'));var client=jayson[_0xdc20('0x9')][_0xdc20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3046c9,_0x19e1c5,_0xd0a871){return new BPromise(function(_0x3600a7,_0x5f00d9){return client[_0xdc20('0xb')](_0x3046c9,_0xd0a871)[_0xdc20('0xc')](function(_0x177ae5){logger['info'](_0xdc20('0xd'),_0x19e1c5,_0xdc20('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x19e1c5,_0xdc20('0xe'),JSON[_0xdc20('0xf')](_0x177ae5));if(_0x177ae5['error']){if(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x11')]===0x1f4){logger[_0xdc20('0x10')](_0xdc20('0xd'),_0x19e1c5,_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);return _0x5f00d9(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);}logger[_0xdc20('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x19e1c5,_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);return _0x3600a7(_0x177ae5[_0xdc20('0x10')][_0xdc20('0x12')]);}else{logger[_0xdc20('0x13')](_0xdc20('0xd'),_0x19e1c5,'request\x20sent');_0x3600a7(_0x177ae5[_0xdc20('0x14')][_0xdc20('0x12')]);}})[_0xdc20('0x15')](function(_0x272420){logger[_0xdc20('0x10')](_0xdc20('0xd'),_0x19e1c5,_0x272420);_0x5f00d9(_0x272420);});});}exports[_0xdc20('0x16')]=function(_0x1bc036){var _0x1b8f0f=this;return new Promise(function(_0x1b1c07,_0x2ce286){return db['ReportAgentPreview']['create'](_0x1bc036[_0xdc20('0x17')],{'raw':_0x1bc036[_0xdc20('0x18')]?_0x1bc036[_0xdc20('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xdc20('0xc')](function(_0x4e036f){logger[_0xdc20('0x13')](_0xdc20('0x16'),_0x1bc036);logger[_0xdc20('0x19')](_0xdc20('0x16'),_0x1bc036,JSON[_0xdc20('0xf')](_0x4e036f));_0x1b1c07(_0x4e036f);})[_0xdc20('0x15')](function(_0x94d1e1){logger[_0xdc20('0x10')](_0xdc20('0x16'),_0x94d1e1[_0xdc20('0x12')],_0x1bc036);_0x2ce286(_0x1b8f0f[_0xdc20('0x10')](0x1f4,_0x94d1e1[_0xdc20('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a69513a..97cb178 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 _0x987a=['smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues'];(function(_0x277a9c,_0x3cee18){var _0x520144=function(_0x55691c){while(--_0x55691c){_0x277a9c['push'](_0x277a9c['shift']());}};_0x520144(++_0x3cee18);}(_0x987a,0x17e));var _0xa987=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x987a[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xa987('0x0'));var util=require(_0xa987('0x1'));var path=require(_0xa987('0x2'));var express=require(_0xa987('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xa987('0x4'));router['get'](_0xa987('0x5'),auth[_0xa987('0x6')](),controller[_0xa987('0x7')]);router[_0xa987('0x8')](_0xa987('0x9'),auth[_0xa987('0x6')](),controller[_0xa987('0xa')]);router[_0xa987('0x8')](_0xa987('0xb'),auth[_0xa987('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xa987('0x8')](_0xa987('0xc'),auth[_0xa987('0x6')](),controller[_0xa987('0xd')]);router['get']('/chat/queues',auth[_0xa987('0x6')](),controller[_0xa987('0xe')]);router[_0xa987('0x8')]('/mail/queues',auth[_0xa987('0x6')](),controller[_0xa987('0xf')]);router[_0xa987('0x8')](_0xa987('0x10'),auth[_0xa987('0x6')](),controller['mailAccounts']);router[_0xa987('0x8')](_0xa987('0x11'),auth['isAuthenticated'](),controller[_0xa987('0x12')]);router[_0xa987('0x8')](_0xa987('0x13'),auth[_0xa987('0x6')](),controller[_0xa987('0x14')]);router['get'](_0xa987('0x15'),auth[_0xa987('0x6')](),controller[_0xa987('0x16')]);router[_0xa987('0x8')](_0xa987('0x17'),auth['isAuthenticated'](),controller[_0xa987('0x18')]);router[_0xa987('0x8')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xa987('0x8')]('/voice/queues/channels',auth[_0xa987('0x6')](),controller['voiceQueuesChannels']);router[_0xa987('0x8')](_0xa987('0x19'),auth[_0xa987('0x6')](),controller[_0xa987('0x1a')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xa987('0x8')](_0xa987('0x1b'),auth[_0xa987('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0xa987('0x8')]('/voice/queues/:id',auth[_0xa987('0x6')](),controller[_0xa987('0x1c')]);router['put']('/voice/queues/:id',auth[_0xa987('0x6')](),controller[_0xa987('0x1d')]);router[_0xa987('0x8')](_0xa987('0x1e'),auth[_0xa987('0x6')](),controller[_0xa987('0x1f')]);router[_0xa987('0x8')](_0xa987('0x20'),auth[_0xa987('0x6')](),controller[_0xa987('0x21')]);router[_0xa987('0x8')](_0xa987('0x22'),auth[_0xa987('0x6')](),controller[_0xa987('0x23')]);router[_0xa987('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xa987('0x25')]);router[_0xa987('0x8')]('/telephones',auth[_0xa987('0x6')](),controller['telephones']);router['get'](_0xa987('0x26'),auth[_0xa987('0x6')](),controller[_0xa987('0x27')]);router[_0xa987('0x8')](_0xa987('0x28'),auth[_0xa987('0x6')](),controller[_0xa987('0x29')]);router['get']('/fax/accounts',auth[_0xa987('0x6')](),controller['faxAccounts']);router[_0xa987('0x8')](_0xa987('0x2a'),auth['isAuthenticated'](),controller[_0xa987('0x2b')]);router[_0xa987('0x8')]('/mail/queues/waitinginteractions',auth[_0xa987('0x6')](),controller[_0xa987('0x2c')]);router[_0xa987('0x8')](_0xa987('0x2d'),auth[_0xa987('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0xa987('0x8')]('/openchannel/queues/:id/waitinginteractions',auth[_0xa987('0x6')](),controller[_0xa987('0x2e')]);router['get']('/sms/queues/waitinginteractions',auth[_0xa987('0x6')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xa987('0x6')](),controller[_0xa987('0x2f')]);router[_0xa987('0x8')](_0xa987('0x30'),auth[_0xa987('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0xa987('0x31')]('/mail/queues/:id/notify',auth[_0xa987('0x6')](),controller[_0xa987('0x32')](_0xa987('0x33')));router['get'](_0xa987('0x34'),auth[_0xa987('0x6')](),controller['showMailQueues']);router['post'](_0xa987('0x35'),auth[_0xa987('0x6')](),controller['queueNotify'](_0xa987('0x36')));router[_0xa987('0x8')](_0xa987('0x37'),auth[_0xa987('0x6')](),controller[_0xa987('0x38')]);router[_0xa987('0x31')](_0xa987('0x39'),auth[_0xa987('0x6')](),controller[_0xa987('0x32')]('fax'));router[_0xa987('0x8')](_0xa987('0x3a'),auth['isAuthenticated'](),controller[_0xa987('0x3b')]);router[_0xa987('0x31')]('/openchannel/queues/:id/notify',auth[_0xa987('0x6')](),controller[_0xa987('0x32')](_0xa987('0x3c')));router[_0xa987('0x8')](_0xa987('0x3d'),auth[_0xa987('0x6')](),controller['showOpenchannelQueues']);router[_0xa987('0x31')](_0xa987('0x3e'),auth['isAuthenticated'](),controller[_0xa987('0x32')](_0xa987('0x3f')));router['post']('/whatsapp/queues/:id/notify',auth[_0xa987('0x6')](),controller[_0xa987('0x32')]('whatsapp'));router['get'](_0xa987('0x40'),auth[_0xa987('0x6')](),controller['showSmsQueues']);router[_0xa987('0x8')](_0xa987('0x41'),auth[_0xa987('0x6')](),controller['showWhatsappQueues']);router[_0xa987('0x31')](_0xa987('0x42'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xe5e6=['/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues'];(function(_0xc1ecf9,_0x52f5af){var _0x4f5829=function(_0x3c375f){while(--_0x3c375f){_0xc1ecf9['push'](_0xc1ecf9['shift']());}};_0x4f5829(++_0x52f5af);}(_0xe5e6,0x158));var _0x6e5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe5e6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6e5e('0x0'));var util=require(_0x6e5e('0x1'));var path=require(_0x6e5e('0x2'));var express=require(_0x6e5e('0x3'));var router=express[_0x6e5e('0x4')]();var auth=require(_0x6e5e('0x5'));var controller=require('./rpc.controller');router[_0x6e5e('0x6')](_0x6e5e('0x7'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x9')]);router[_0x6e5e('0x6')](_0x6e5e('0xa'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0xb')]);router[_0x6e5e('0x6')](_0x6e5e('0xc'),auth['isAuthenticated'](),controller[_0x6e5e('0xd')]);router['get'](_0x6e5e('0xe'),auth[_0x6e5e('0x8')](),controller['voiceQueues']);router[_0x6e5e('0x6')](_0x6e5e('0xf'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x10')]);router[_0x6e5e('0x6')](_0x6e5e('0x11'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x12')]);router['get'](_0x6e5e('0x13'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x14')]);router[_0x6e5e('0x6')]('/openchannel/queues',auth[_0x6e5e('0x8')](),controller['openchannelQueues']);router['get'](_0x6e5e('0x15'),auth['isAuthenticated'](),controller[_0x6e5e('0x16')]);router[_0x6e5e('0x6')](_0x6e5e('0x17'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x18')]);router[_0x6e5e('0x6')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x6e5e('0x6')](_0x6e5e('0x19'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x1a')]);router[_0x6e5e('0x6')](_0x6e5e('0x1b'),auth['isAuthenticated'](),controller[_0x6e5e('0x1c')]);router[_0x6e5e('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x6e5e('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x6e5e('0x1d'),auth['isAuthenticated'](),controller[_0x6e5e('0x1e')]);router[_0x6e5e('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x6e5e('0x1f')]);router[_0x6e5e('0x6')]('/voice/queues/:id',auth[_0x6e5e('0x8')](),controller['showVoiceQueues']);router['put'](_0x6e5e('0x20'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x6e5e('0x6')](_0x6e5e('0x21'),auth[_0x6e5e('0x8')](),controller['outbound']);router[_0x6e5e('0x6')](_0x6e5e('0x22'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x23')]);router[_0x6e5e('0x6')](_0x6e5e('0x24'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x25')]);router['put'](_0x6e5e('0x26'),auth['isAuthenticated'](),controller[_0x6e5e('0x27')]);router[_0x6e5e('0x6')](_0x6e5e('0x28'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x29')]);router[_0x6e5e('0x6')](_0x6e5e('0x2a'),auth[_0x6e5e('0x8')](),controller['trunks']);router[_0x6e5e('0x6')](_0x6e5e('0x2b'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x2c')]);router[_0x6e5e('0x6')](_0x6e5e('0x2d'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x2e')]);router[_0x6e5e('0x6')](_0x6e5e('0x2f'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x30')]);router[_0x6e5e('0x6')](_0x6e5e('0x31'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x32')]);router[_0x6e5e('0x6')](_0x6e5e('0x33'),auth['isAuthenticated'](),controller[_0x6e5e('0x34')]);router[_0x6e5e('0x6')](_0x6e5e('0x35'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x36')]);router[_0x6e5e('0x6')]('/sms/queues/waitinginteractions',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x37')]);router[_0x6e5e('0x6')](_0x6e5e('0x38'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x39')]);router[_0x6e5e('0x6')](_0x6e5e('0x3a'),auth['isAuthenticated'](),controller[_0x6e5e('0x3b')]);router[_0x6e5e('0x3c')](_0x6e5e('0x3d'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x3e')](_0x6e5e('0x3f')));router[_0x6e5e('0x6')](_0x6e5e('0x40'),auth['isAuthenticated'](),controller[_0x6e5e('0x41')]);router['post']('/chat/queues/:id/notify',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x3e')](_0x6e5e('0x42')));router[_0x6e5e('0x6')](_0x6e5e('0x43'),auth['isAuthenticated'](),controller[_0x6e5e('0x44')]);router['post'](_0x6e5e('0x45'),auth['isAuthenticated'](),controller[_0x6e5e('0x3e')]('fax'));router['get']('/fax/queues/:id',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x46')]);router['post'](_0x6e5e('0x47'),auth[_0x6e5e('0x8')](),controller['queueNotify'](_0x6e5e('0x48')));router[_0x6e5e('0x6')](_0x6e5e('0x49'),auth[_0x6e5e('0x8')](),controller['showOpenchannelQueues']);router[_0x6e5e('0x3c')](_0x6e5e('0x4a'),auth['isAuthenticated'](),controller[_0x6e5e('0x3e')](_0x6e5e('0x4b')));router[_0x6e5e('0x3c')](_0x6e5e('0x4c'),auth[_0x6e5e('0x8')](),controller['queueNotify'](_0x6e5e('0x4d')));router['get'](_0x6e5e('0x4e'),auth[_0x6e5e('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x4f')]);router[_0x6e5e('0x3c')](_0x6e5e('0x50'),auth[_0x6e5e('0x8')](),controller[_0x6e5e('0x51')]);module[_0x6e5e('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 98ef652..2dc1d4d 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(_0x1ee8cf,_0x576430){var _0x4682b5=function(_0x2e9420){while(--_0x2e9420){_0x1ee8cf['push'](_0x1ee8cf['shift']());}};_0x4682b5(++_0x576430);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2507b6,_0x2d059a){var _0x22c8a4=function(_0x3deebb){while(--_0x3deebb){_0x2507b6['push'](_0x2507b6['shift']());}};_0x22c8a4(++_0x2d059a);}(_0xb10b,0x12a));var _0xbb10=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0xb10b[_0x190681];return _0x4f2ada;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index bdb41d7..0503b2e 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 _0x641f=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x28e0c5,_0xae901c){var _0x154afc=function(_0x9a6c91){while(--_0x9a6c91){_0x28e0c5['push'](_0x28e0c5['shift']());}};_0x154afc(++_0xae901c);}(_0x641f,0x87));var _0xf641=function(_0x434380,_0x46abb2){_0x434380=_0x434380-0x0;var _0x5973a1=_0x641f[_0x434380];return _0x5973a1;};'use strict';var multer=require(_0xf641('0x0'));var util=require(_0xf641('0x1'));var path=require(_0xf641('0x2'));var timeout=require(_0xf641('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf641('0x4'));var auth=require(_0xf641('0x5'));var interaction=require(_0xf641('0x6'));var config=require(_0xf641('0x7'));var controller=require(_0xf641('0x8'));router[_0xf641('0x9')]('/',auth[_0xf641('0xa')](),controller[_0xf641('0xb')]);router[_0xf641('0x9')](_0xf641('0xc'),auth[_0xf641('0xa')](),controller[_0xf641('0xd')]);router[_0xf641('0x9')](_0xf641('0xe'),auth[_0xf641('0xa')](),controller[_0xf641('0xf')]);router[_0xf641('0x10')]('/',auth['isAuthenticated'](),controller[_0xf641('0x11')]);router[_0xf641('0x12')](_0xf641('0xc'),auth['isAuthenticated'](),controller[_0xf641('0x13')]);router[_0xf641('0x14')](_0xf641('0xc'),auth[_0xf641('0xa')](),controller[_0xf641('0x15')]);module[_0xf641('0x16')]=router; \ No newline at end of file +var _0xcf13=['update','/:id','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','post','put'];(function(_0x2bb625,_0xf8de66){var _0x14696a=function(_0x4bc92c){while(--_0x4bc92c){_0x2bb625['push'](_0x2bb625['shift']());}};_0x14696a(++_0xf8de66);}(_0xcf13,0xe0));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3cf1('0x0'));var util=require(_0x3cf1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3cf1('0x2'));var router=express[_0x3cf1('0x3')]();var fs_extra=require(_0x3cf1('0x4'));var auth=require(_0x3cf1('0x5'));var interaction=require(_0x3cf1('0x6'));var config=require('../../config/environment');var controller=require(_0x3cf1('0x7'));router[_0x3cf1('0x8')]('/',auth['isAuthenticated'](),controller[_0x3cf1('0x9')]);router['get']('/:id',auth[_0x3cf1('0xa')](),controller[_0x3cf1('0xb')]);router[_0x3cf1('0x8')](_0x3cf1('0xc'),auth['isAuthenticated'](),controller[_0x3cf1('0xd')]);router[_0x3cf1('0xe')]('/',auth[_0x3cf1('0xa')](),controller['create']);router[_0x3cf1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3cf1('0x10')]);router['delete'](_0x3cf1('0x11'),auth[_0x3cf1('0xa')](),controller[_0x3cf1('0x12')]);module[_0x3cf1('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index da9a4cc..1b8cc1a 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 _0x4f13=['custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','months','days','hours','minutes','csv','xlsx'];(function(_0x36c48e,_0x509112){var _0x431e88=function(_0x430bfa){while(--_0x430bfa){_0x36c48e['push'](_0x36c48e['shift']());}};_0x431e88(++_0x509112);}(_0x4f13,0x143));var _0x34f1=function(_0x2694f6,_0x31b042){_0x2694f6=_0x2694f6-0x0;var _0x13ab43=_0x4f13[_0x2694f6];return _0x13ab43;};'use strict';var Sequelize=require(_0x34f1('0x0'));module[_0x34f1('0x1')]={'name':{'type':Sequelize[_0x34f1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x34f1('0x2')]},'active':{'type':Sequelize[_0x34f1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x34f1('0x2')],'allowNull':![],'defaultValue':_0x34f1('0x4')},'startAt':{'type':Sequelize[_0x34f1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x34f1('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x34f1('0x6')]('years','quarters',_0x34f1('0x7'),'weeks',_0x34f1('0x8'),_0x34f1('0x9'),_0x34f1('0xa')),'allowNull':![],'defaultValue':_0x34f1('0x8')},'output':{'type':Sequelize['ENUM'](_0x34f1('0xb'),'pdf',_0x34f1('0xc')),'allowNull':![],'defaultValue':_0x34f1('0xb')},'type':{'type':Sequelize[_0x34f1('0x6')](_0x34f1('0xd'),_0x34f1('0xe')),'allowNull':![],'defaultValue':_0x34f1('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x34f1('0x2')]},'cc':{'type':Sequelize[_0x34f1('0xf')]},'bcc':{'type':Sequelize[_0x34f1('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x55a4=['days','hours','minutes','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x10699e,_0x4f8055){var _0x3181ae=function(_0x307c34){while(--_0x307c34){_0x10699e['push'](_0x10699e['shift']());}};_0x3181ae(++_0x4f8055);}(_0x55a4,0xbb));var _0x455a=function(_0x34ac3d,_0x289201){_0x34ac3d=_0x34ac3d-0x0;var _0x216857=_0x55a4[_0x34ac3d];return _0x216857;};'use strict';var Sequelize=require(_0x455a('0x0'));module[_0x455a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x455a('0x2')]},'active':{'type':Sequelize[_0x455a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x455a('0x2')],'allowNull':![],'defaultValue':_0x455a('0x4')},'startAt':{'type':Sequelize[_0x455a('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x455a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x455a('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x455a('0x7')](_0x455a('0x8'),_0x455a('0x9'),_0x455a('0xa'),'weeks',_0x455a('0xb'),_0x455a('0xc'),_0x455a('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x455a('0x7')](_0x455a('0xe'),_0x455a('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0x455a('0xe')},'type':{'type':Sequelize[_0x455a('0x7')](_0x455a('0x10'),'default'),'allowNull':![],'defaultValue':_0x455a('0x10')},'sendMail':{'type':Sequelize[_0x455a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x455a('0x2')]},'cc':{'type':Sequelize[_0x455a('0x11')]},'bcc':{'type':Sequelize[_0x455a('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x455a('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 5715567..5714859 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 _0x15e4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','role','user','userProfileId','body','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','to-csv','querystring'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x15e4,0x1cc));var _0x415e=function(_0x5e27f2,_0x434e8d){_0x5e27f2=_0x5e27f2-0x0;var _0x51f4c6=_0x15e4[_0x5e27f2];return _0x51f4c6;};'use strict';var emlformat=require(_0x415e('0x0'));var rimraf=require(_0x415e('0x1'));var zipdir=require(_0x415e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x415e('0x3'));var moment=require(_0x415e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x415e('0x5'));var util=require(_0x415e('0x6'));var path=require(_0x415e('0x7'));var sox=require(_0x415e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x415e('0x9'));var _=require(_0x415e('0xa'));var squel=require('squel');var crypto=require(_0x415e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x415e('0xc'));var querystring=require(_0x415e('0xd'));var Papa=require(_0x415e('0xe'));var Redis=require(_0x415e('0xf'));var authService=require(_0x415e('0x10'));var qs=require(_0x415e('0x11'));var as=require(_0x415e('0x12'));var hardwareService=require(_0x415e('0x13'));var logger=require(_0x415e('0x14'))(_0x415e('0x15'));var utils=require(_0x415e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x415e('0x17'));var db=require(_0x415e('0x18'))['db'];function respondWithStatusCode(_0x3fd9f4,_0xeca21f){_0xeca21f=_0xeca21f||0xcc;return function(_0x56f86b){if(_0x56f86b){return _0x3fd9f4[_0x415e('0x19')](_0xeca21f);}return _0x3fd9f4[_0x415e('0x1a')](_0xeca21f)[_0x415e('0x1b')]();};}function respondWithResult(_0x2e24bc,_0x51de93){_0x51de93=_0x51de93||0xc8;return function(_0x29d4e9){if(_0x29d4e9){return _0x2e24bc[_0x415e('0x1a')](_0x51de93)['json'](_0x29d4e9);}};}function respondWithFilteredResult(_0x1af888,_0x12dd99){return function(_0x420446){if(_0x420446){var _0x287f88=typeof _0x12dd99[_0x415e('0x1c')]===_0x415e('0x1d')&&typeof _0x12dd99[_0x415e('0x1e')]==='undefined';var _0x14e51a=_0x420446[_0x415e('0x1f')];var _0x3a233d=_0x287f88?0x0:_0x12dd99[_0x415e('0x1c')];var _0xc19a98=_0x287f88?_0x420446[_0x415e('0x1f')]:_0x12dd99['offset']+_0x12dd99['limit'];var _0xb5de3b;if(_0xc19a98>=_0x14e51a){_0xc19a98=_0x14e51a;_0xb5de3b=0xc8;}else{_0xb5de3b=0xce;}_0x1af888['status'](_0xb5de3b);return _0x1af888['set'](_0x415e('0x20'),_0x3a233d+'-'+_0xc19a98+'/'+_0x14e51a)[_0x415e('0x21')](_0x420446);}return null;};}function patchUpdates(_0xeb53d7){return function(_0x14a2e5){try{jsonpatch['apply'](_0x14a2e5,_0xeb53d7,!![]);}catch(_0x92d6c9){return BPromise[_0x415e('0x22')](_0x92d6c9);}return _0x14a2e5[_0x415e('0x23')]();};}function saveUpdates(_0xe3c558,_0x7fff30){return function(_0x3a5649){if(_0x3a5649){return _0x3a5649[_0x415e('0x24')](_0xe3c558)[_0x415e('0x25')](function(_0x3dbf12){return _0x3dbf12;});}return null;};}function removeEntity(_0x190e83,_0x55ae6e){return function(_0x29d147){if(_0x29d147){return _0x29d147['destroy']()[_0x415e('0x25')](function(){var _0x7342d1=_0x29d147[_0x415e('0x26')]({'plain':!![]});var _0x1cf9c6=_0x415e('0x27');return db[_0x415e('0x28')][_0x415e('0x29')]({'where':{'type':_0x1cf9c6,'resourceId':_0x7342d1['id']}})[_0x415e('0x25')](function(){return _0x29d147;});})[_0x415e('0x25')](function(){_0x190e83[_0x415e('0x1a')](0xcc)[_0x415e('0x1b')]();});}};}function handleEntityNotFound(_0x471abb,_0x284e94){return function(_0x428cda){if(!_0x428cda){_0x471abb[_0x415e('0x19')](0x194);}return _0x428cda;};}function handleError(_0x5cb6fd,_0x394bf1){_0x394bf1=_0x394bf1||0x1f4;return function(_0x25a318){logger[_0x415e('0x2a')](_0x25a318[_0x415e('0x2b')]);if(_0x25a318[_0x415e('0x2c')]){delete _0x25a318[_0x415e('0x2c')];}_0x5cb6fd[_0x415e('0x1a')](_0x394bf1)[_0x415e('0x2d')](_0x25a318);};}exports['index']=function(_0x5125ff,_0x7c0b2a){var _0x494703={},_0x8df96b={},_0x74b020={'count':0x0,'rows':[]};var _0x40c51e=_[_0x415e('0x2e')](db[_0x415e('0x2f')][_0x415e('0x30')],function(_0x3cd68b){return{'name':_0x3cd68b[_0x415e('0x31')],'type':_0x3cd68b[_0x415e('0x32')][_0x415e('0x33')]};});_0x8df96b[_0x415e('0x34')]=_[_0x415e('0x2e')](_0x40c51e,_0x415e('0x2c'));_0x8df96b[_0x415e('0x35')]=_[_0x415e('0x36')](_0x5125ff[_0x415e('0x35')]);_0x8df96b[_0x415e('0x37')]=_[_0x415e('0x38')](_0x8df96b[_0x415e('0x34')],_0x8df96b[_0x415e('0x35')]);_0x494703[_0x415e('0x39')]=_[_0x415e('0x38')](_0x8df96b[_0x415e('0x34')],qs[_0x415e('0x3a')](_0x5125ff[_0x415e('0x35')][_0x415e('0x3a')]));_0x494703[_0x415e('0x39')]=_0x494703[_0x415e('0x39')][_0x415e('0x3b')]?_0x494703['attributes']:_0x8df96b[_0x415e('0x34')];if(!_0x5125ff[_0x415e('0x35')]['hasOwnProperty'](_0x415e('0x3c'))){_0x494703['limit']=qs[_0x415e('0x1e')](_0x5125ff['query']['limit']);_0x494703[_0x415e('0x1c')]=qs[_0x415e('0x1c')](_0x5125ff[_0x415e('0x35')][_0x415e('0x1c')]);}_0x494703['order']=qs[_0x415e('0x3d')](_0x5125ff[_0x415e('0x35')][_0x415e('0x3d')]);_0x494703[_0x415e('0x3e')]=qs[_0x415e('0x37')](_['pick'](_0x5125ff[_0x415e('0x35')],_0x8df96b[_0x415e('0x37')]),_0x40c51e);if(_0x5125ff['query'][_0x415e('0x3f')]){_0x494703['where']=_[_0x415e('0x40')](_0x494703['where'],{'$or':_['map'](_0x40c51e,function(_0x28ea29){if(_0x28ea29[_0x415e('0x32')]!==_0x415e('0x41')){var _0x5cfc3a={};_0x5cfc3a[_0x28ea29[_0x415e('0x2c')]]={'$like':'%'+_0x5125ff[_0x415e('0x35')]['filter']+'%'};return _0x5cfc3a;}})});}_0x494703=_[_0x415e('0x40')]({},_0x494703,_0x5125ff['options']);var _0x3e60ca={'where':_0x494703[_0x415e('0x3e')]};return db[_0x415e('0x2f')]['count'](_0x3e60ca)[_0x415e('0x25')](function(_0x109446){_0x74b020[_0x415e('0x1f')]=_0x109446;if(_0x5125ff[_0x415e('0x35')][_0x415e('0x42')]){_0x494703[_0x415e('0x43')]=[{'all':!![]}];}return db[_0x415e('0x2f')]['findAll'](_0x494703);})[_0x415e('0x25')](function(_0x2e9384){_0x74b020[_0x415e('0x44')]=_0x2e9384;return _0x74b020;})[_0x415e('0x25')](respondWithFilteredResult(_0x7c0b2a,_0x494703))[_0x415e('0x45')](handleError(_0x7c0b2a,null));};exports[_0x415e('0x46')]=function(_0x55af91,_0x185e51){var _0x1b5a64={'raw':![],'where':{'id':_0x55af91[_0x415e('0x47')]['id']}},_0x23002e={};_0x23002e['model']=_['keys'](db[_0x415e('0x2f')][_0x415e('0x30')]);_0x23002e[_0x415e('0x35')]=_['keys'](_0x55af91['query']);_0x23002e[_0x415e('0x37')]=_[_0x415e('0x38')](_0x23002e[_0x415e('0x34')],_0x23002e[_0x415e('0x35')]);_0x1b5a64[_0x415e('0x39')]=_[_0x415e('0x38')](_0x23002e[_0x415e('0x34')],qs[_0x415e('0x3a')](_0x55af91[_0x415e('0x35')][_0x415e('0x3a')]));_0x1b5a64['attributes']=_0x1b5a64[_0x415e('0x39')]['length']?_0x1b5a64['attributes']:_0x23002e[_0x415e('0x34')];if(_0x55af91[_0x415e('0x35')][_0x415e('0x42')]){_0x1b5a64['include']=[{'all':!![]}];}_0x1b5a64=_[_0x415e('0x40')]({},_0x1b5a64,_0x55af91['options']);return db[_0x415e('0x2f')][_0x415e('0x48')](_0x1b5a64)[_0x415e('0x25')](handleEntityNotFound(_0x185e51,null))[_0x415e('0x25')](respondWithResult(_0x185e51,null))[_0x415e('0x45')](handleError(_0x185e51,null));};exports[_0x415e('0x49')]=function(_0x26a4c2,_0x368341){return db['Schedule']['create'](_0x26a4c2['body'],{})['then'](function(_0x3b9a66){var _0x59b549=_0x26a4c2['user'][_0x415e('0x26')]({'plain':!![]});if(!_0x59b549)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59b549[_0x415e('0x4a')]===_0x415e('0x4b')){var _0x53373f=_0x3b9a66[_0x415e('0x26')]({'plain':!![]});var _0x32258d=_0x415e('0x27');return db['UserProfileSection'][_0x415e('0x48')]({'where':{'name':_0x32258d,'userProfileId':_0x59b549[_0x415e('0x4c')]},'raw':!![]})[_0x415e('0x25')](function(_0x366811){if(_0x366811&&_0x366811['autoAssociation']===0x0){return db[_0x415e('0x28')][_0x415e('0x49')]({'name':_0x53373f[_0x415e('0x2c')],'resourceId':_0x53373f['id'],'type':_0x366811[_0x415e('0x2c')],'sectionId':_0x366811['id']},{})[_0x415e('0x25')](function(){return _0x3b9a66;});}else{return _0x3b9a66;}})[_0x415e('0x45')](function(_0x326476){logger[_0x415e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x326476);throw _0x326476;});}return _0x3b9a66;})['then'](respondWithResult(_0x368341,0xc9))['catch'](handleError(_0x368341,null));};exports['update']=function(_0x10e785,_0x5645c2){if(_0x10e785[_0x415e('0x4d')]['id']){delete _0x10e785['body']['id'];}return db['Schedule'][_0x415e('0x48')]({'where':{'id':_0x10e785[_0x415e('0x47')]['id']}})[_0x415e('0x25')](handleEntityNotFound(_0x5645c2,null))[_0x415e('0x25')](saveUpdates(_0x10e785[_0x415e('0x4d')],null))['then'](respondWithResult(_0x5645c2,null))['catch'](handleError(_0x5645c2,null));};exports[_0x415e('0x29')]=function(_0x23b96e,_0x5a1ae6){return db[_0x415e('0x2f')][_0x415e('0x48')]({'where':{'id':_0x23b96e[_0x415e('0x47')]['id']}})[_0x415e('0x25')](handleEntityNotFound(_0x5a1ae6,null))[_0x415e('0x25')](removeEntity(_0x5a1ae6,null))[_0x415e('0x45')](handleError(_0x5a1ae6,null));};exports['run']=function(_0x40acb8,_0x523f7a,_0x3b8f9b){var _0x26227a=require(_0x415e('0x4e'));return db['Schedule'][_0x415e('0x48')]({'where':{'id':_0x40acb8[_0x415e('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x523f7a,null))[_0x415e('0x25')](function(){_0x26227a['run'](_0x40acb8[_0x415e('0x47')]['id']);})[_0x415e('0x25')](respondWithStatusCode(_0x523f7a,null))[_0x415e('0x45')](handleError(_0x523f7a,null));}; \ No newline at end of file +var _0xdd9c=['status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xdd9c,0xee));var _0xcdd9=function(_0x3213c2,_0x3fb44e){_0x3213c2=_0x3213c2-0x0;var _0x381092=_0xdd9c[_0x3213c2];return _0x381092;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcdd9('0x0'));var jsonpatch=require(_0xcdd9('0x1'));var rp=require(_0xcdd9('0x2'));var moment=require(_0xcdd9('0x3'));var BPromise=require(_0xcdd9('0x4'));var Mustache=require(_0xcdd9('0x5'));var util=require(_0xcdd9('0x6'));var path=require('path');var sox=require(_0xcdd9('0x7'));var csv=require(_0xcdd9('0x8'));var ejs=require(_0xcdd9('0x9'));var fs=require('fs');var fs_extra=require(_0xcdd9('0xa'));var _=require(_0xcdd9('0xb'));var squel=require(_0xcdd9('0xc'));var crypto=require(_0xcdd9('0xd'));var jsforce=require(_0xcdd9('0xe'));var deskjs=require(_0xcdd9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcdd9('0x10'));var Papa=require(_0xcdd9('0x11'));var Redis=require(_0xcdd9('0x12'));var authService=require(_0xcdd9('0x13'));var qs=require(_0xcdd9('0x14'));var as=require(_0xcdd9('0x15'));var hardwareService=require(_0xcdd9('0x16'));var logger=require(_0xcdd9('0x17'))(_0xcdd9('0x18'));var utils=require(_0xcdd9('0x19'));var config=require(_0xcdd9('0x1a'));var licenseUtil=require(_0xcdd9('0x1b'));var db=require(_0xcdd9('0x1c'))['db'];function respondWithStatusCode(_0x11b3da,_0x3c730a){_0x3c730a=_0x3c730a||0xcc;return function(_0xaf4488){if(_0xaf4488){return _0x11b3da['sendStatus'](_0x3c730a);}return _0x11b3da[_0xcdd9('0x1d')](_0x3c730a)[_0xcdd9('0x1e')]();};}function respondWithResult(_0x4b1118,_0x365c58){_0x365c58=_0x365c58||0xc8;return function(_0x529bca){if(_0x529bca){return _0x4b1118['status'](_0x365c58)[_0xcdd9('0x1f')](_0x529bca);}};}function respondWithFilteredResult(_0x2e3d6e,_0x3a587a){return function(_0x1a569e){if(_0x1a569e){var _0x52f899=typeof _0x3a587a[_0xcdd9('0x20')]===_0xcdd9('0x21')&&typeof _0x3a587a['limit']===_0xcdd9('0x21');var _0x38f787=_0x1a569e[_0xcdd9('0x22')];var _0x418091=_0x52f899?0x0:_0x3a587a[_0xcdd9('0x20')];var _0x15f41b=_0x52f899?_0x1a569e['count']:_0x3a587a[_0xcdd9('0x20')]+_0x3a587a['limit'];var _0x2a0a49;if(_0x15f41b>=_0x38f787){_0x15f41b=_0x38f787;_0x2a0a49=0xc8;}else{_0x2a0a49=0xce;}_0x2e3d6e[_0xcdd9('0x1d')](_0x2a0a49);return _0x2e3d6e[_0xcdd9('0x23')](_0xcdd9('0x24'),_0x418091+'-'+_0x15f41b+'/'+_0x38f787)[_0xcdd9('0x1f')](_0x1a569e);}return null;};}function patchUpdates(_0x4ac143){return function(_0x426761){try{jsonpatch['apply'](_0x426761,_0x4ac143,!![]);}catch(_0x1f0a5c){return BPromise[_0xcdd9('0x25')](_0x1f0a5c);}return _0x426761[_0xcdd9('0x26')]();};}function saveUpdates(_0x4a6e47,_0x298a82){return function(_0x66b1f2){if(_0x66b1f2){return _0x66b1f2[_0xcdd9('0x27')](_0x4a6e47)[_0xcdd9('0x28')](function(_0x3a476c){return _0x3a476c;});}return null;};}function removeEntity(_0x485a64,_0x1eb7fa){return function(_0x473fe7){if(_0x473fe7){return _0x473fe7[_0xcdd9('0x29')]()['then'](function(){var _0x41fe0c=_0x473fe7['get']({'plain':!![]});var _0x3e64e8=_0xcdd9('0x2a');return db[_0xcdd9('0x2b')][_0xcdd9('0x29')]({'where':{'type':_0x3e64e8,'resourceId':_0x41fe0c['id']}})['then'](function(){return _0x473fe7;});})[_0xcdd9('0x28')](function(){_0x485a64[_0xcdd9('0x1d')](0xcc)[_0xcdd9('0x1e')]();});}};}function handleEntityNotFound(_0x279c96,_0x748cdb){return function(_0x27389d){if(!_0x27389d){_0x279c96['sendStatus'](0x194);}return _0x27389d;};}function handleError(_0x1ee9fa,_0x4c1e59){_0x4c1e59=_0x4c1e59||0x1f4;return function(_0x4a9ac5){logger[_0xcdd9('0x2c')](_0x4a9ac5['stack']);if(_0x4a9ac5[_0xcdd9('0x2d')]){delete _0x4a9ac5[_0xcdd9('0x2d')];}_0x1ee9fa[_0xcdd9('0x1d')](_0x4c1e59)['send'](_0x4a9ac5);};}exports[_0xcdd9('0x2e')]=function(_0x2fc93b,_0x3974e9){var _0x518fb9={},_0x3fa536={},_0x16862b={'count':0x0,'rows':[]};var _0x2b728a=_[_0xcdd9('0x2f')](db['Schedule'][_0xcdd9('0x30')],function(_0x422d08){return{'name':_0x422d08[_0xcdd9('0x31')],'type':_0x422d08[_0xcdd9('0x32')][_0xcdd9('0x33')]};});_0x3fa536[_0xcdd9('0x34')]=_[_0xcdd9('0x2f')](_0x2b728a,_0xcdd9('0x2d'));_0x3fa536[_0xcdd9('0x35')]=_[_0xcdd9('0x36')](_0x2fc93b[_0xcdd9('0x35')]);_0x3fa536[_0xcdd9('0x37')]=_[_0xcdd9('0x38')](_0x3fa536[_0xcdd9('0x34')],_0x3fa536['query']);_0x518fb9[_0xcdd9('0x39')]=_[_0xcdd9('0x38')](_0x3fa536[_0xcdd9('0x34')],qs[_0xcdd9('0x3a')](_0x2fc93b['query']['fields']));_0x518fb9['attributes']=_0x518fb9[_0xcdd9('0x39')]['length']?_0x518fb9[_0xcdd9('0x39')]:_0x3fa536[_0xcdd9('0x34')];if(!_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x3b')](_0xcdd9('0x3c'))){_0x518fb9[_0xcdd9('0x3d')]=qs[_0xcdd9('0x3d')](_0x2fc93b['query'][_0xcdd9('0x3d')]);_0x518fb9[_0xcdd9('0x20')]=qs[_0xcdd9('0x20')](_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x20')]);}_0x518fb9[_0xcdd9('0x3e')]=qs[_0xcdd9('0x3f')](_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x3f')]);_0x518fb9[_0xcdd9('0x40')]=qs[_0xcdd9('0x37')](_['pick'](_0x2fc93b[_0xcdd9('0x35')],_0x3fa536['filters']),_0x2b728a);if(_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x41')]){_0x518fb9[_0xcdd9('0x40')]=_['merge'](_0x518fb9[_0xcdd9('0x40')],{'$or':_[_0xcdd9('0x2f')](_0x2b728a,function(_0x3acd21){if(_0x3acd21[_0xcdd9('0x32')]!==_0xcdd9('0x42')){var _0x272b81={};_0x272b81[_0x3acd21['name']]={'$like':'%'+_0x2fc93b['query'][_0xcdd9('0x41')]+'%'};return _0x272b81;}})});}_0x518fb9=_[_0xcdd9('0x43')]({},_0x518fb9,_0x2fc93b[_0xcdd9('0x44')]);var _0x3a2471={'where':_0x518fb9[_0xcdd9('0x40')]};return db[_0xcdd9('0x45')][_0xcdd9('0x22')](_0x3a2471)[_0xcdd9('0x28')](function(_0x5ad57b){_0x16862b[_0xcdd9('0x22')]=_0x5ad57b;if(_0x2fc93b[_0xcdd9('0x35')][_0xcdd9('0x46')]){_0x518fb9[_0xcdd9('0x47')]=[{'all':!![]}];}return db['Schedule'][_0xcdd9('0x48')](_0x518fb9);})[_0xcdd9('0x28')](function(_0x49729e){_0x16862b[_0xcdd9('0x49')]=_0x49729e;return _0x16862b;})[_0xcdd9('0x28')](respondWithFilteredResult(_0x3974e9,_0x518fb9))[_0xcdd9('0x4a')](handleError(_0x3974e9,null));};exports[_0xcdd9('0x4b')]=function(_0x50a9f1,_0x230e9c){var _0x234263={'raw':![],'where':{'id':_0x50a9f1[_0xcdd9('0x4c')]['id']}},_0x4ecbd4={};_0x4ecbd4[_0xcdd9('0x34')]=_[_0xcdd9('0x36')](db[_0xcdd9('0x45')][_0xcdd9('0x30')]);_0x4ecbd4[_0xcdd9('0x35')]=_[_0xcdd9('0x36')](_0x50a9f1[_0xcdd9('0x35')]);_0x4ecbd4[_0xcdd9('0x37')]=_[_0xcdd9('0x38')](_0x4ecbd4[_0xcdd9('0x34')],_0x4ecbd4[_0xcdd9('0x35')]);_0x234263['attributes']=_[_0xcdd9('0x38')](_0x4ecbd4['model'],qs[_0xcdd9('0x3a')](_0x50a9f1['query'][_0xcdd9('0x3a')]));_0x234263[_0xcdd9('0x39')]=_0x234263['attributes'][_0xcdd9('0x4d')]?_0x234263[_0xcdd9('0x39')]:_0x4ecbd4[_0xcdd9('0x34')];if(_0x50a9f1[_0xcdd9('0x35')][_0xcdd9('0x46')]){_0x234263[_0xcdd9('0x47')]=[{'all':!![]}];}_0x234263=_[_0xcdd9('0x43')]({},_0x234263,_0x50a9f1[_0xcdd9('0x44')]);return db[_0xcdd9('0x45')][_0xcdd9('0x4e')](_0x234263)['then'](handleEntityNotFound(_0x230e9c,null))[_0xcdd9('0x28')](respondWithResult(_0x230e9c,null))['catch'](handleError(_0x230e9c,null));};exports[_0xcdd9('0x4f')]=function(_0x2467c5,_0x4f46da){return db[_0xcdd9('0x45')]['create'](_0x2467c5[_0xcdd9('0x50')],{})[_0xcdd9('0x28')](function(_0x5d84c9){var _0x39db94=_0x2467c5[_0xcdd9('0x51')][_0xcdd9('0x52')]({'plain':!![]});if(!_0x39db94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39db94[_0xcdd9('0x53')]==='user'){var _0x19df9d=_0x5d84c9[_0xcdd9('0x52')]({'plain':!![]});var _0x1acec7=_0xcdd9('0x2a');return db[_0xcdd9('0x54')]['find']({'where':{'name':_0x1acec7,'userProfileId':_0x39db94[_0xcdd9('0x55')]},'raw':!![]})['then'](function(_0x202e5c){if(_0x202e5c&&_0x202e5c['autoAssociation']===0x0){return db[_0xcdd9('0x2b')][_0xcdd9('0x4f')]({'name':_0x19df9d[_0xcdd9('0x2d')],'resourceId':_0x19df9d['id'],'type':_0x202e5c[_0xcdd9('0x2d')],'sectionId':_0x202e5c['id']},{})['then'](function(){return _0x5d84c9;});}else{return _0x5d84c9;}})[_0xcdd9('0x4a')](function(_0x2febb1){logger[_0xcdd9('0x2c')](_0xcdd9('0x56'),_0x2febb1);throw _0x2febb1;});}return _0x5d84c9;})[_0xcdd9('0x28')](respondWithResult(_0x4f46da,0xc9))[_0xcdd9('0x4a')](handleError(_0x4f46da,null));};exports[_0xcdd9('0x27')]=function(_0x548ec6,_0xb58b0e){if(_0x548ec6[_0xcdd9('0x50')]['id']){delete _0x548ec6['body']['id'];}return db[_0xcdd9('0x45')]['find']({'where':{'id':_0x548ec6[_0xcdd9('0x4c')]['id']}})[_0xcdd9('0x28')](handleEntityNotFound(_0xb58b0e,null))['then'](saveUpdates(_0x548ec6[_0xcdd9('0x50')],null))['then'](respondWithResult(_0xb58b0e,null))[_0xcdd9('0x4a')](handleError(_0xb58b0e,null));};exports[_0xcdd9('0x29')]=function(_0xf4004e,_0x62f891){return db[_0xcdd9('0x45')][_0xcdd9('0x4e')]({'where':{'id':_0xf4004e[_0xcdd9('0x4c')]['id']}})[_0xcdd9('0x28')](handleEntityNotFound(_0x62f891,null))[_0xcdd9('0x28')](removeEntity(_0x62f891,null))[_0xcdd9('0x4a')](handleError(_0x62f891,null));};exports['run']=function(_0x4ba91d,_0x4e222a,_0x47e0df){var _0x6c0a4e=require(_0xcdd9('0x57'));return db[_0xcdd9('0x45')][_0xcdd9('0x4e')]({'where':{'id':_0x4ba91d[_0xcdd9('0x4c')]['id']},'raw':!![]})[_0xcdd9('0x28')](handleEntityNotFound(_0x4e222a,null))['then'](function(){_0x6c0a4e[_0xcdd9('0x58')](_0x4ba91d[_0xcdd9('0x4c')]['id']);})[_0xcdd9('0x28')](respondWithStatusCode(_0x4e222a,null))[_0xcdd9('0x4a')](handleError(_0x4e222a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index eb0fe5f..75c1d83 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 _0xee66=['tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0xee66,0x8d));var _0x6ee6=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0xee66[_0x130209];return _0x155fb7;};'use strict';var _=require(_0x6ee6('0x0'));var util=require(_0x6ee6('0x1'));var logger=require(_0x6ee6('0x2'))(_0x6ee6('0x3'));var moment=require(_0x6ee6('0x4'));var BPromise=require(_0x6ee6('0x5'));var rp=require(_0x6ee6('0x6'));var fs=require('fs');var path=require(_0x6ee6('0x7'));var rimraf=require(_0x6ee6('0x8'));var config=require(_0x6ee6('0x9'));var attributes=require(_0x6ee6('0xa'));module[_0x6ee6('0xb')]=function(_0x7cacb8,_0xf40f72){return _0x7cacb8[_0x6ee6('0xc')]('Schedule',attributes,{'tableName':_0x6ee6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d15=['moment','bluebird','request-promise','path','exports','define','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x52319f,_0x3b2128){var _0x4530fd=function(_0x49f9ac){while(--_0x49f9ac){_0x52319f['push'](_0x52319f['shift']());}};_0x4530fd(++_0x3b2128);}(_0x5d15,0x1eb));var _0x55d1=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5d15[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x55d1('0x0'));var util=require(_0x55d1('0x1'));var logger=require(_0x55d1('0x2'))(_0x55d1('0x3'));var moment=require(_0x55d1('0x4'));var BPromise=require(_0x55d1('0x5'));var rp=require(_0x55d1('0x6'));var fs=require('fs');var path=require(_0x55d1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x55d1('0x8')]=function(_0x3ae19c,_0x34410e){return _0x3ae19c[_0x55d1('0x9')]('Schedule',attributes,{'tableName':_0x55d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 8d4cea4..4829968 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 _0x62f2=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62f2,0x109));var _0x262f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x62f2[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x262f('0x0'));var util=require(_0x262f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x262f('0x2'));var fs=require('fs');var Redis=require(_0x262f('0x3'));var db=require(_0x262f('0x4'))['db'];var utils=require(_0x262f('0x5'));var logger=require(_0x262f('0x6'))(_0x262f('0x7'));var config=require('../../config/environment');var jayson=require(_0x262f('0x8'));var client=jayson['client'][_0x262f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37a7ce,_0x13b3f0,_0xfa2932){return new BPromise(function(_0x11c8ac,_0x10bed4){return client[_0x262f('0xa')](_0x37a7ce,_0xfa2932)['then'](function(_0x1583f3){logger[_0x262f('0xb')]('Schedule,\x20%s,\x20%s',_0x13b3f0,_0x262f('0xc'));logger[_0x262f('0xd')](_0x262f('0xe'),_0x13b3f0,_0x262f('0xc'),JSON[_0x262f('0xf')](_0x1583f3));if(_0x1583f3[_0x262f('0x10')]){if(_0x1583f3[_0x262f('0x10')][_0x262f('0x11')]===0x1f4){logger[_0x262f('0x10')]('Schedule,\x20%s,\x20%s',_0x13b3f0,_0x1583f3['error']['message']);return _0x10bed4(_0x1583f3[_0x262f('0x10')][_0x262f('0x12')]);}logger[_0x262f('0x10')](_0x262f('0x13'),_0x13b3f0,_0x1583f3[_0x262f('0x10')][_0x262f('0x12')]);return _0x11c8ac(_0x1583f3[_0x262f('0x10')][_0x262f('0x12')]);}else{logger['info'](_0x262f('0x13'),_0x13b3f0,'request\x20sent');_0x11c8ac(_0x1583f3[_0x262f('0x14')][_0x262f('0x12')]);}})[_0x262f('0x15')](function(_0x917f0f){logger[_0x262f('0x10')](_0x262f('0x13'),_0x13b3f0,_0x917f0f);_0x10bed4(_0x917f0f);});});} \ No newline at end of file +var _0xe9c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x255385,_0x119512){var _0x122c23=function(_0x5a8ed7){while(--_0x5a8ed7){_0x255385['push'](_0x255385['shift']());}};_0x122c23(++_0x119512);}(_0xe9c5,0x14d));var _0x5e9c=function(_0x3d466a,_0x599d63){_0x3d466a=_0x3d466a-0x0;var _0x57ebab=_0xe9c5[_0x3d466a];return _0x57ebab;};'use strict';var _=require(_0x5e9c('0x0'));var util=require(_0x5e9c('0x1'));var moment=require(_0x5e9c('0x2'));var BPromise=require(_0x5e9c('0x3'));var rs=require(_0x5e9c('0x4'));var fs=require('fs');var Redis=require(_0x5e9c('0x5'));var db=require(_0x5e9c('0x6'))['db'];var utils=require(_0x5e9c('0x7'));var logger=require('../../config/logger')(_0x5e9c('0x8'));var config=require(_0x5e9c('0x9'));var jayson=require(_0x5e9c('0xa'));var client=jayson[_0x5e9c('0xb')][_0x5e9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe172a,_0x597b5b,_0x11f84e){return new BPromise(function(_0x4b4f20,_0x253320){return client[_0x5e9c('0xd')](_0xe172a,_0x11f84e)[_0x5e9c('0xe')](function(_0x383cf0){logger[_0x5e9c('0xf')](_0x5e9c('0x10'),_0x597b5b,_0x5e9c('0x11'));logger[_0x5e9c('0x12')](_0x5e9c('0x13'),_0x597b5b,'request\x20sent',JSON[_0x5e9c('0x14')](_0x383cf0));if(_0x383cf0[_0x5e9c('0x15')]){if(_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x16')]===0x1f4){logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);return _0x253320(_0x383cf0[_0x5e9c('0x15')]['message']);}logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);return _0x4b4f20(_0x383cf0[_0x5e9c('0x15')][_0x5e9c('0x17')]);}else{logger[_0x5e9c('0xf')](_0x5e9c('0x10'),_0x597b5b,_0x5e9c('0x11'));_0x4b4f20(_0x383cf0[_0x5e9c('0x18')][_0x5e9c('0x17')]);}})[_0x5e9c('0x19')](function(_0x19b7ab){logger[_0x5e9c('0x15')](_0x5e9c('0x10'),_0x597b5b,_0x19b7ab);_0x253320(_0x19b7ab);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 6fbdcba..ab30d53 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 _0xaca0=['isAuthenticated','index','/describe','/:id','show','/:id/download','download','create','put','delete','destroy','exports','util','path','../../components/auth/service','../../config/environment','./screenRecording.controller','get'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0xaca0,0xd2));var _0x0aca=function(_0x3054ef,_0x49b2ae){_0x3054ef=_0x3054ef-0x0;var _0x5474d2=_0xaca0[_0x3054ef];return _0x5474d2;};'use strict';var multer=require('multer');var util=require(_0x0aca('0x0'));var path=require(_0x0aca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0aca('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0aca('0x3'));var controller=require(_0x0aca('0x4'));router[_0x0aca('0x5')]('/',auth[_0x0aca('0x6')](),controller[_0x0aca('0x7')]);router['get'](_0x0aca('0x8'),auth[_0x0aca('0x6')](),controller['describe']);router[_0x0aca('0x5')](_0x0aca('0x9'),auth[_0x0aca('0x6')](),controller[_0x0aca('0xa')]);router[_0x0aca('0x5')](_0x0aca('0xb'),auth[_0x0aca('0x6')](),controller[_0x0aca('0xc')]);router['post']('/',auth[_0x0aca('0x6')](),controller[_0x0aca('0xd')]);router[_0x0aca('0xe')]('/:id',auth[_0x0aca('0x6')](),controller['update']);router[_0x0aca('0xf')](_0x0aca('0x9'),auth[_0x0aca('0x6')](),controller[_0x0aca('0x10')]);module[_0x0aca('0x11')]=router; \ No newline at end of file +var _0xf7be=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','index','get','describe','/:id','isAuthenticated','post','create','put','update','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf7be,0x104));var _0xef7b=function(_0x41d1b5,_0x262fdf){_0x41d1b5=_0x41d1b5-0x0;var _0x4f7783=_0xf7be[_0x41d1b5];return _0x4f7783;};'use strict';var multer=require(_0xef7b('0x0'));var util=require(_0xef7b('0x1'));var path=require(_0xef7b('0x2'));var timeout=require(_0xef7b('0x3'));var express=require(_0xef7b('0x4'));var router=express['Router']();var fs_extra=require(_0xef7b('0x5'));var auth=require(_0xef7b('0x6'));var interaction=require(_0xef7b('0x7'));var config=require(_0xef7b('0x8'));var controller=require(_0xef7b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xef7b('0xa')]);router[_0xef7b('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xef7b('0xc')]);router[_0xef7b('0xb')](_0xef7b('0xd'),auth[_0xef7b('0xe')](),controller['show']);router[_0xef7b('0xb')]('/:id/download',auth[_0xef7b('0xe')](),controller['download']);router[_0xef7b('0xf')]('/',auth[_0xef7b('0xe')](),controller[_0xef7b('0x10')]);router[_0xef7b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xef7b('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xef7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1398a5b..2d5559f 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 _0x87bc=['toString','updatedAt','sequelize','moment','../../config/environment','getDataValue','extname','STRING','value','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x87bc,0x189));var _0xc87b=function(_0xa869ce,_0x548c53){_0xa869ce=_0xa869ce-0x0;var _0x4d277f=_0x87bc[_0xa869ce];return _0x4d277f;};'use strict';var Sequelize=require(_0xc87b('0x0'));var moment=require(_0xc87b('0x1'));var path=require('path');var config=require(_0xc87b('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc87b('0x3')]('value')?path[_0xc87b('0x4')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc87b('0x5')]},'value':{'type':Sequelize[_0xc87b('0x5')],'set':function(_0x402aac){var _0x5d1813=_0x402aac['replace'](/\\/g,'/');this['setDataValue'](_0xc87b('0x6'),_0x5d1813);}},'rating':{'type':Sequelize[_0xc87b('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc87b('0x7')],'set':function(_0x19b571){this[_0xc87b('0x8')](_0xc87b('0x9'),moment()[_0xc87b('0xa')](_0x19b571,'ms'));this[_0xc87b('0x8')](_0xc87b('0xb'),moment());this['setDataValue']('duration',_0x19b571);}},'startedAt':{'type':Sequelize[_0xc87b('0xc')],'get':function(){return moment(this['getDataValue'](_0xc87b('0x9')))[_0xc87b('0xd')](_0xc87b('0xe'))[_0xc87b('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc87b('0x3')]('closedAt'))[_0xc87b('0xd')](_0xc87b('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xc87b('0xc')],'get':function(){return moment(this[_0xc87b('0x3')]('createdAt'))[_0xc87b('0xd')](_0xc87b('0xe'))[_0xc87b('0xf')]();}},'updatedAt':{'type':Sequelize[_0xc87b('0xc')],'get':function(){return moment(this[_0xc87b('0x3')](_0xc87b('0x10')))[_0xc87b('0xd')](_0xc87b('0xe'))['toString']();}}}; \ No newline at end of file +var _0x1a85=['extname','getDataValue','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','value'];(function(_0x235d9c,_0xf831bb){var _0x32534f=function(_0x10345b){while(--_0x10345b){_0x235d9c['push'](_0x235d9c['shift']());}};_0x32534f(++_0xf831bb);}(_0x1a85,0x178));var _0x51a8=function(_0x4e5b60,_0x58b613){_0x4e5b60=_0x4e5b60-0x0;var _0x3b53bf=_0x1a85[_0x4e5b60];return _0x3b53bf;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x51a8('0x0'));var config=require(_0x51a8('0x1'));module[_0x51a8('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x51a8('0x3'))?path[_0x51a8('0x4')](this[_0x51a8('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x51a8('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x51a8('0x6')],'set':function(_0x5cf430){var _0x331117=_0x5cf430[_0x51a8('0x7')](/\\/g,'/');this['setDataValue'](_0x51a8('0x3'),_0x331117);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x39e06a){this[_0x51a8('0x8')](_0x51a8('0x9'),moment()[_0x51a8('0xa')](_0x39e06a,'ms'));this[_0x51a8('0x8')](_0x51a8('0xb'),moment());this[_0x51a8('0x8')](_0x51a8('0xc'),_0x39e06a);}},'startedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0x9')))[_0x51a8('0xe')](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'closedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0xb')))['format'](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'createdAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this['getDataValue'](_0x51a8('0x11')))['format'](_0x51a8('0xf'))[_0x51a8('0x10')]();}},'updatedAt':{'type':Sequelize[_0x51a8('0xd')],'get':function(){return moment(this[_0x51a8('0x5')](_0x51a8('0x12')))[_0x51a8('0xe')](_0x51a8('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6bff913..20798ac 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 _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4472b7,_0x324265){_0x4472b7=_0x4472b7-0x0;var _0x414968=_0xdbf5[_0x4472b7];return _0x414968;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +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(_0x5dd35a,_0x543f8d){var _0x6a3f73=function(_0x20c369){while(--_0x20c369){_0x5dd35a['push'](_0x5dd35a['shift']());}};_0x6a3f73(++_0x543f8d);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a04c7dc..86677f0 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 _0xd7be=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd7be,0x107));var _0xed7b=function(_0x3f9a9d,_0x1820fe){_0x3f9a9d=_0x3f9a9d-0x0;var _0x530a1f=_0xd7be[_0x3f9a9d];return _0x530a1f;};'use strict';var _=require(_0xed7b('0x0'));var util=require('util');var logger=require(_0xed7b('0x1'))(_0xed7b('0x2'));var moment=require(_0xed7b('0x3'));var BPromise=require(_0xed7b('0x4'));var rp=require(_0xed7b('0x5'));var fs=require('fs');var path=require(_0xed7b('0x6'));var rimraf=require(_0xed7b('0x7'));var config=require(_0xed7b('0x8'));var attributes=require(_0xed7b('0x9'));module[_0xed7b('0xa')]=function(_0x2013a5,_0x3a5e57){return _0x2013a5[_0xed7b('0xb')](_0xed7b('0xc'),attributes,{'tableName':_0xed7b('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xed7b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2452=['../../config/environment','exports','interactionid','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0x2452,0xae));var _0x2245=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0x2452[_0x5be46a];return _0x1ce3b8;};'use strict';var _=require(_0x2245('0x0'));var util=require('util');var logger=require(_0x2245('0x1'))(_0x2245('0x2'));var moment=require('moment');var BPromise=require(_0x2245('0x3'));var rp=require(_0x2245('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2245('0x5'));var config=require(_0x2245('0x6'));var attributes=require('./screenRecording.attributes');module[_0x2245('0x7')]=function(_0x54f3bc,_0x510634){return _0x54f3bc['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2245('0x8'),'fields':[_0x2245('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9d4639a..9b05691 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 _0x4e33=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2df2f4,_0x4f9918){var _0x441729=function(_0xd9464b){while(--_0xd9464b){_0x2df2f4['push'](_0x2df2f4['shift']());}};_0x441729(++_0x4f9918);}(_0x4e33,0xcb));var _0x34e3=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0x4e33[_0x528497];return _0x392d59;};'use strict';var _=require(_0x34e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x34e3('0x1'));var rs=require(_0x34e3('0x2'));var fs=require('fs');var Redis=require(_0x34e3('0x3'));var db=require(_0x34e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34e3('0x5'))(_0x34e3('0x6'));var config=require(_0x34e3('0x7'));var jayson=require(_0x34e3('0x8'));var client=jayson[_0x34e3('0x9')][_0x34e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f12fd,_0x46f4bb,_0x3c08fd){return new BPromise(function(_0x1ee98e,_0x58a06e){return client[_0x34e3('0xb')](_0x2f12fd,_0x3c08fd)[_0x34e3('0xc')](function(_0x13b7d9){logger[_0x34e3('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x46f4bb,_0x34e3('0xe'));logger[_0x34e3('0xf')](_0x34e3('0x10'),_0x46f4bb,'request\x20sent',JSON['stringify'](_0x13b7d9));if(_0x13b7d9[_0x34e3('0x11')]){if(_0x13b7d9[_0x34e3('0x11')][_0x34e3('0x12')]===0x1f4){logger[_0x34e3('0x11')](_0x34e3('0x13'),_0x46f4bb,_0x13b7d9['error'][_0x34e3('0x14')]);return _0x58a06e(_0x13b7d9[_0x34e3('0x11')][_0x34e3('0x14')]);}logger[_0x34e3('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x46f4bb,_0x13b7d9[_0x34e3('0x11')][_0x34e3('0x14')]);return _0x1ee98e(_0x13b7d9[_0x34e3('0x11')][_0x34e3('0x14')]);}else{logger[_0x34e3('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x46f4bb,_0x34e3('0xe'));_0x1ee98e(_0x13b7d9['result'][_0x34e3('0x14')]);}})['catch'](function(_0x140e97){logger[_0x34e3('0x11')](_0x34e3('0x13'),_0x46f4bb,_0x140e97);_0x58a06e(_0x140e97);});});} \ No newline at end of file +var _0xdd6b=['ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e2c96,_0x37c518){var _0x53fcfc=function(_0xf79f9f){while(--_0xf79f9f){_0x2e2c96['push'](_0x2e2c96['shift']());}};_0x53fcfc(++_0x37c518);}(_0xdd6b,0x9f));var _0xbdd6=function(_0x5e92db,_0x2dd018){_0x5e92db=_0x5e92db-0x0;var _0x25674c=_0xdd6b[_0x5e92db];return _0x25674c;};'use strict';var _=require(_0xbdd6('0x0'));var util=require(_0xbdd6('0x1'));var moment=require(_0xbdd6('0x2'));var BPromise=require(_0xbdd6('0x3'));var rs=require(_0xbdd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdd6('0x5'))['db'];var utils=require(_0xbdd6('0x6'));var logger=require(_0xbdd6('0x7'))(_0xbdd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xbdd6('0x9'));var client=jayson['client'][_0xbdd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bceb,_0x38ae21,_0x46e8b3){return new BPromise(function(_0x4399d4,_0x4fe832){return client[_0xbdd6('0xb')](_0x31bceb,_0x46e8b3)[_0xbdd6('0xc')](function(_0x3ef8bc){logger[_0xbdd6('0xd')](_0xbdd6('0xe'),_0x38ae21,_0xbdd6('0xf'));logger[_0xbdd6('0x10')](_0xbdd6('0x11'),_0x38ae21,_0xbdd6('0xf'),JSON['stringify'](_0x3ef8bc));if(_0x3ef8bc[_0xbdd6('0x12')]){if(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x13')]===0x1f4){logger[_0xbdd6('0x12')](_0xbdd6('0xe'),_0x38ae21,_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);return _0x4fe832(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);}logger[_0xbdd6('0x12')](_0xbdd6('0xe'),_0x38ae21,_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);return _0x4399d4(_0x3ef8bc[_0xbdd6('0x12')][_0xbdd6('0x14')]);}else{logger[_0xbdd6('0xd')](_0xbdd6('0xe'),_0x38ae21,'request\x20sent');_0x4399d4(_0x3ef8bc['result'][_0xbdd6('0x14')]);}})[_0xbdd6('0x15')](function(_0x50488f){logger[_0xbdd6('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x38ae21,_0x50488f);_0x4fe832(_0x50488f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 205b74e..c86d7d4 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 _0x933d=['update','exports','util','path','Router','fs-extra','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','join','server/files/images/logos/','format','%s%s','logo','extname','post','addLogo','diskStorage','root','logologin','originalname','single','file','addLogoLogin','preferred','addPreferred','favicon','put'];(function(_0x7873eb,_0x4486a6){var _0x225452=function(_0x2c3455){while(--_0x2c3455){_0x7873eb['push'](_0x7873eb['shift']());}};_0x225452(++_0x4486a6);}(_0x933d,0x19c));var _0xd933=function(_0x1a5ec9,_0x3fd7f1){_0x1a5ec9=_0x1a5ec9-0x0;var _0x2b6154=_0x933d[_0x1a5ec9];return _0x2b6154;};'use strict';var multer=require('multer');var util=require(_0xd933('0x0'));var path=require(_0xd933('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd933('0x2')]();var fs_extra=require(_0xd933('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd933('0x4'));var config=require('../../config/environment');var controller=require(_0xd933('0x5'));router['get']('/',auth[_0xd933('0x6')](),controller[_0xd933('0x7')]);router[_0xd933('0x8')](_0xd933('0x9'),controller[_0xd933('0xa')]);router[_0xd933('0x8')](_0xd933('0xb'),controller[_0xd933('0xc')]);router[_0xd933('0x8')](_0xd933('0xd'),controller[_0xd933('0xe')]);router[_0xd933('0x8')](_0xd933('0xf'),controller['getLogoLogin']);router['get'](_0xd933('0x10'),controller['gdpr']);router['get'](_0xd933('0x11'),controller[_0xd933('0x12')]);router[_0xd933('0x8')](_0xd933('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x110dd1,_0x415571,_0x4370db){_0x4370db(null,path[_0xd933('0x14')](config['root'],_0xd933('0x15')));},'filename':function(_0x3e00dd,_0x2e7229,_0x40d9c2){_0x40d9c2(null,util[_0xd933('0x16')](_0xd933('0x17'),_0xd933('0x18'),path[_0xd933('0x19')](_0x2e7229['originalname'])));}})});router[_0xd933('0x1a')]('/:id/logo',upload['single']('file'),controller[_0xd933('0x1b')]);var upload=multer({'storage':multer[_0xd933('0x1c')]({'destination':function(_0x186b23,_0x43572b,_0x43c7fb){_0x43c7fb(null,path[_0xd933('0x14')](config[_0xd933('0x1d')],_0xd933('0x15')));},'filename':function(_0x4a6133,_0x175fa5,_0x346779){_0x346779(null,util['format']('%s%s',_0xd933('0x1e'),path[_0xd933('0x19')](_0x175fa5[_0xd933('0x1f')])));}})});router[_0xd933('0x1a')](_0xd933('0xf'),upload[_0xd933('0x20')](_0xd933('0x21')),controller[_0xd933('0x22')]);var upload=multer({'storage':multer[_0xd933('0x1c')]({'destination':function(_0x2e3158,_0x3c85e6,_0x390338){_0x390338(null,path[_0xd933('0x14')](config[_0xd933('0x1d')],_0xd933('0x15')));},'filename':function(_0x54e20f,_0x15b500,_0x54ae12){_0x54ae12(null,util['format'](_0xd933('0x17'),_0xd933('0x23'),path[_0xd933('0x19')](_0x15b500[_0xd933('0x1f')])));}})});router[_0xd933('0x1a')](_0xd933('0x11'),upload[_0xd933('0x20')](_0xd933('0x21')),controller[_0xd933('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36ebbe,_0x1e6f14,_0x597cf4){_0x597cf4(null,path[_0xd933('0x14')](config[_0xd933('0x1d')],_0xd933('0x15')));},'filename':function(_0x2e8150,_0x11bacd,_0x4b5a9f){_0x4b5a9f(null,util[_0xd933('0x16')](_0xd933('0x17'),_0xd933('0x25'),path[_0xd933('0x19')](_0x11bacd['originalname'])));}})});router[_0xd933('0x1a')](_0xd933('0x13'),upload['single']('file'),controller['addFavicon']);router[_0xd933('0x26')](_0xd933('0xb'),auth['isAuthenticated'](),controller[_0xd933('0x27')]);module[_0xd933('0x28')]=router; \ No newline at end of file +var _0x1e5d=['server/files/images/logos/','logologin','extname','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','format','%s%s','logo','originalname','post','single','file','addLogo'];(function(_0x40f99e,_0x3ac4e8){var _0x8504eb=function(_0x2199a8){while(--_0x2199a8){_0x40f99e['push'](_0x40f99e['shift']());}};_0x8504eb(++_0x3ac4e8);}(_0x1e5d,0x1ee));var _0xd1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd1e5('0x0'));var util=require(_0xd1e5('0x1'));var path=require(_0xd1e5('0x2'));var timeout=require(_0xd1e5('0x3'));var express=require(_0xd1e5('0x4'));var router=express[_0xd1e5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e5('0x7'));var controller=require(_0xd1e5('0x8'));router[_0xd1e5('0x9')]('/',auth[_0xd1e5('0xa')](),controller[_0xd1e5('0xb')]);router[_0xd1e5('0x9')](_0xd1e5('0xc'),controller[_0xd1e5('0xd')]);router['get'](_0xd1e5('0xe'),controller['show']);router[_0xd1e5('0x9')](_0xd1e5('0xf'),controller[_0xd1e5('0x10')]);router[_0xd1e5('0x9')](_0xd1e5('0x11'),controller[_0xd1e5('0x12')]);router[_0xd1e5('0x9')](_0xd1e5('0x13'),controller[_0xd1e5('0x14')]);router['get'](_0xd1e5('0x15'),controller['getPreferred']);router[_0xd1e5('0x9')](_0xd1e5('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x2195a5,_0x540586,_0x2a3684){_0x2a3684(null,path[_0xd1e5('0x18')](config[_0xd1e5('0x19')],'server/files/images/logos/'));},'filename':function(_0x38748e,_0x3bb40c,_0xe502e7){_0xe502e7(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x1c'),path['extname'](_0x3bb40c[_0xd1e5('0x1d')])));}})});router[_0xd1e5('0x1e')]('/:id/logo',upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller[_0xd1e5('0x21')]);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x22f9c1,_0x369735,_0xbc0dfb){_0xbc0dfb(null,path[_0xd1e5('0x18')](config['root'],_0xd1e5('0x22')));},'filename':function(_0x337fef,_0x27fe3b,_0x532efd){_0x532efd(null,util['format'](_0xd1e5('0x1b'),_0xd1e5('0x23'),path[_0xd1e5('0x24')](_0x27fe3b[_0xd1e5('0x1d')])));}})});router['post'](_0xd1e5('0x11'),upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller[_0xd1e5('0x25')]);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0xcfbf00,_0x152189,_0x5deaf3){_0x5deaf3(null,path[_0xd1e5('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5278f1,_0x27d5a0,_0x12724b){_0x12724b(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x26'),path[_0xd1e5('0x24')](_0x27d5a0[_0xd1e5('0x1d')])));}})});router[_0xd1e5('0x1e')](_0xd1e5('0x15'),upload[_0xd1e5('0x1f')](_0xd1e5('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0xd1e5('0x17')]({'destination':function(_0x21d94e,_0x1026e6,_0xc06885){_0xc06885(null,path[_0xd1e5('0x18')](config[_0xd1e5('0x19')],_0xd1e5('0x22')));},'filename':function(_0x12c28c,_0x57aea7,_0x3d39ec){_0x3d39ec(null,util[_0xd1e5('0x1a')](_0xd1e5('0x1b'),_0xd1e5('0x27'),path['extname'](_0x57aea7[_0xd1e5('0x1d')])));}})});router['post'](_0xd1e5('0x16'),upload[_0xd1e5('0x1f')]('file'),controller[_0xd1e5('0x28')]);router[_0xd1e5('0x29')](_0xd1e5('0xe'),auth['isAuthenticated'](),controller[_0xd1e5('0x2a')]);module[_0xd1e5('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 435aab7..b97c2f7 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 _0x2617=['min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER'];(function(_0xffbd35,_0x3414bd){var _0x47c7e3=function(_0x5031c5){while(--_0x5031c5){_0xffbd35['push'](_0xffbd35['shift']());}};_0x47c7e3(++_0x3414bd);}(_0x2617,0xc5));var _0x7261=function(_0x36807d,_0x40c05e){_0x36807d=_0x36807d-0x0;var _0x14b69a=_0x2617[_0x36807d];return _0x14b69a;};'use strict';var Sequelize=require(_0x7261('0x0'));module[_0x7261('0x1')]={'min_internal':{'type':Sequelize[_0x7261('0x2')](0xb),'unique':_0x7261('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7261('0x4')],'defaultValue':_0x7261('0x5')},'logo':{'type':Sequelize[_0x7261('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7261('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7261('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x7261('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7261('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7261('0x4')],'defaultValue':_0x7261('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7261('0x4')],'defaultValue':_0x7261('0x8')},'chatTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7261('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7261('0x2')]},'transcribeRegion':{'type':Sequelize[_0x7261('0x4')]},'sentiment':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7261('0x2')]},'sentimentRegion':{'type':Sequelize[_0x7261('0x4')]},'language':{'type':Sequelize[_0x7261('0x4')]},'bucket':{'type':Sequelize[_0x7261('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x7261('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7261('0x2')](0x2)[_0x7261('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7261('0x2')](0x2)[_0x7261('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7261('0x2')](0x2)[_0x7261('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7261('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7261('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x7261('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x1a91=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','INTEGER','min_internal'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x1a91,0xd5));var _0x11a9=function(_0x141e5f,_0x216927){_0x141e5f=_0x141e5f-0x0;var _0x5bea96=_0x1a91[_0x141e5f];return _0x5bea96;};'use strict';var Sequelize=require(_0x11a9('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x11a9('0x1')](0xb),'unique':_0x11a9('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x11a9('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':_0x11a9('0x4')},'logo':{'type':Sequelize[_0x11a9('0x3')]},'defaultLogo':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x11a9('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x11a9('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x11a9('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x11a9('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x11a9('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x11a9('0x3')],'defaultValue':_0x11a9('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x11a9('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x11a9('0x3')]},'defaultFavicon':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x11a9('0x1')]},'sentimentRegion':{'type':Sequelize[_0x11a9('0x3')]},'language':{'type':Sequelize[_0x11a9('0x3')]},'bucket':{'type':Sequelize[_0x11a9('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x11a9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x11a9('0x1')](0x2)[_0x11a9('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x11a9('0x1')](0x2)[_0x11a9('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x11a9('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x11a9('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x11a9('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x11a9('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 dadf0e2..20bd577 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 _0xf7df=['download','getLogoLogin','defaultLogo','defaultPreferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','custom','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','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','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','find','addLogo','filename','logo','file','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize','\x20not\x20found'];(function(_0x152728,_0x5bdfd4){var _0x17b484=function(_0x4e6b0d){while(--_0x4e6b0d){_0x152728['push'](_0x152728['shift']());}};_0x17b484(++_0x5bdfd4);}(_0xf7df,0x10e));var _0xff7d=function(_0x5dfd58,_0x585ca7){_0x5dfd58=_0x5dfd58-0x0;var _0x31a980=_0xf7df[_0x5dfd58];return _0x31a980;};'use strict';var emlformat=require(_0xff7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff7d('0x1'));var jsonpatch=require(_0xff7d('0x2'));var rp=require(_0xff7d('0x3'));var moment=require(_0xff7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff7d('0x5'));var util=require('util');var path=require(_0xff7d('0x6'));var sox=require(_0xff7d('0x7'));var csv=require('to-csv');var ejs=require(_0xff7d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff7d('0x9'));var crypto=require(_0xff7d('0xa'));var jsforce=require(_0xff7d('0xb'));var deskjs=require(_0xff7d('0xc'));var toCsv=require(_0xff7d('0xd'));var querystring=require(_0xff7d('0xe'));var Papa=require('papaparse');var Redis=require(_0xff7d('0xf'));var authService=require(_0xff7d('0x10'));var qs=require(_0xff7d('0x11'));var as=require(_0xff7d('0x12'));var hardwareService=require(_0xff7d('0x13'));var logger=require(_0xff7d('0x14'))(_0xff7d('0x15'));var utils=require(_0xff7d('0x16'));var config=require(_0xff7d('0x17'));var licenseUtil=require(_0xff7d('0x18'));var db=require(_0xff7d('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xff7d('0x1a')][_0xff7d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5ceb43,_0x1174c5,_0x19124c,_0x2965e2){return new BPromise(function(_0x3886f5,_0x1d6a4c){var _0x2ea760=_0x2965e2||client;return _0x2ea760['request'](_0x5ceb43,_0x19124c)[_0xff7d('0x1c')](function(_0x10e4ae){logger[_0xff7d('0x1d')](_0xff7d('0x1e'),_0x1174c5,_0xff7d('0x1f'));logger[_0xff7d('0x20')](_0xff7d('0x21'),_0x1174c5,_0xff7d('0x1f'),JSON[_0xff7d('0x22')](_0x10e4ae));if(_0x10e4ae['error']){if(_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x24')]===0x1f4){logger[_0xff7d('0x23')]('Setting,\x20%s,\x20%s',_0x1174c5,_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);return _0x1d6a4c(_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);}logger[_0xff7d('0x23')](_0xff7d('0x1e'),_0x1174c5,_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);return _0x3886f5(_0x10e4ae[_0xff7d('0x23')]['message']);}else{logger[_0xff7d('0x1d')](_0xff7d('0x1e'),_0x1174c5,_0xff7d('0x1f'));_0x3886f5(_0x10e4ae['result'][_0xff7d('0x25')]);}})[_0xff7d('0x26')](function(_0x455ac7){logger['error'](_0xff7d('0x1e'),_0x1174c5,_0x455ac7);_0x1d6a4c(_0x455ac7);});});}function respondWithStatusCode(_0x14e4b4,_0xf42f3c){_0xf42f3c=_0xf42f3c||0xcc;return function(_0x1a6506){if(_0x1a6506){return _0x14e4b4[_0xff7d('0x27')](_0xf42f3c);}return _0x14e4b4[_0xff7d('0x28')](_0xf42f3c)[_0xff7d('0x29')]();};}function respondWithResult(_0x15bbe6,_0x5ef97e){_0x5ef97e=_0x5ef97e||0xc8;return function(_0x457adf){if(_0x457adf){return _0x15bbe6[_0xff7d('0x28')](_0x5ef97e)[_0xff7d('0x2a')](_0x457adf);}};}function respondWithFilteredResult(_0x5a7997,_0x5eb41e){return function(_0x55708a){if(_0x55708a){var _0x24e962=typeof _0x5eb41e['offset']==='undefined'&&typeof _0x5eb41e['limit']===_0xff7d('0x2b');var _0x3642a9=_0x55708a[_0xff7d('0x2c')];var _0x479184=_0x24e962?0x0:_0x5eb41e['offset'];var _0x18bbaa=_0x24e962?_0x55708a[_0xff7d('0x2c')]:_0x5eb41e['offset']+_0x5eb41e['limit'];var _0x4ef328;if(_0x18bbaa>=_0x3642a9){_0x18bbaa=_0x3642a9;_0x4ef328=0xc8;}else{_0x4ef328=0xce;}_0x5a7997[_0xff7d('0x28')](_0x4ef328);return _0x5a7997[_0xff7d('0x2d')](_0xff7d('0x2e'),_0x479184+'-'+_0x18bbaa+'/'+_0x3642a9)[_0xff7d('0x2a')](_0x55708a);}return null;};}function patchUpdates(_0x39ccde){return function(_0x6127ef){try{jsonpatch[_0xff7d('0x2f')](_0x6127ef,_0x39ccde,!![]);}catch(_0xbcb02f){return BPromise['reject'](_0xbcb02f);}return _0x6127ef[_0xff7d('0x30')]();};}function saveUpdates(_0x5d532d,_0xb1dd88){return function(_0x279866){if(_0x279866){return _0x279866[_0xff7d('0x31')](_0x5d532d)['then'](function(_0x5092c4){return _0x5092c4;});}return null;};}function removeEntity(_0x2c8227,_0xccd74f){return function(_0x112dfa){if(_0x112dfa){return _0x112dfa[_0xff7d('0x32')]()[_0xff7d('0x1c')](function(){_0x2c8227[_0xff7d('0x28')](0xcc)[_0xff7d('0x29')]();});}};}function handleEntityNotFound(_0x349c8d,_0xf98cc6){return function(_0x4250eb){if(!_0x4250eb){_0x349c8d['sendStatus'](0x194);}return _0x4250eb;};}function handleError(_0x436f53,_0x38a8d){_0x38a8d=_0x38a8d||0x1f4;return function(_0x3e9f9c){logger['error'](_0x3e9f9c[_0xff7d('0x33')]);if(_0x3e9f9c[_0xff7d('0x34')]){delete _0x3e9f9c['name'];}_0x436f53[_0xff7d('0x28')](_0x38a8d)[_0xff7d('0x35')](_0x3e9f9c);};}exports['index']=function(_0x454042,_0x114508){var _0x42dfce={},_0x4debed={},_0x48f078={'count':0x0,'rows':[]};var _0x3a2a00=_[_0xff7d('0x36')](db[_0xff7d('0x37')][_0xff7d('0x38')],function(_0x3b5a85){return{'name':_0x3b5a85[_0xff7d('0x39')],'type':_0x3b5a85[_0xff7d('0x3a')][_0xff7d('0x3b')]};});_0x4debed[_0xff7d('0x3c')]=_['map'](_0x3a2a00,_0xff7d('0x34'));_0x4debed[_0xff7d('0x3d')]=_[_0xff7d('0x3e')](_0x454042[_0xff7d('0x3d')]);_0x4debed['filters']=_[_0xff7d('0x3f')](_0x4debed[_0xff7d('0x3c')],_0x4debed[_0xff7d('0x3d')]);_0x42dfce[_0xff7d('0x40')]=_['intersection'](_0x4debed[_0xff7d('0x3c')],qs[_0xff7d('0x41')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x41')]));_0x42dfce[_0xff7d('0x40')]=_0x42dfce['attributes'][_0xff7d('0x42')]?_0x42dfce[_0xff7d('0x40')]:_0x4debed[_0xff7d('0x3c')];if(!_0x454042['query'][_0xff7d('0x43')](_0xff7d('0x44'))){_0x42dfce[_0xff7d('0x45')]=qs[_0xff7d('0x45')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x45')]);_0x42dfce[_0xff7d('0x46')]=qs[_0xff7d('0x46')](_0x454042['query'][_0xff7d('0x46')]);}_0x42dfce[_0xff7d('0x47')]=qs[_0xff7d('0x48')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x48')]);_0x42dfce[_0xff7d('0x49')]=qs[_0xff7d('0x4a')](_[_0xff7d('0x4b')](_0x454042[_0xff7d('0x3d')],_0x4debed[_0xff7d('0x4a')]),_0x3a2a00);if(_0x454042['query'][_0xff7d('0x4c')]){_0x42dfce['where']=_[_0xff7d('0x4d')](_0x42dfce['where'],{'$or':_['map'](_0x3a2a00,function(_0x4fa723){if(_0x4fa723['type']!==_0xff7d('0x4e')){var _0x28e747={};_0x28e747[_0x4fa723[_0xff7d('0x34')]]={'$like':'%'+_0x454042[_0xff7d('0x3d')][_0xff7d('0x4c')]+'%'};return _0x28e747;}})});}_0x42dfce=_[_0xff7d('0x4d')]({},_0x42dfce,_0x454042[_0xff7d('0x4f')]);var _0x19620c={'where':_0x42dfce['where']};return db[_0xff7d('0x37')][_0xff7d('0x2c')](_0x19620c)['then'](function(_0xcdc2df){_0x48f078[_0xff7d('0x2c')]=_0xcdc2df;if(_0x454042['query'][_0xff7d('0x50')]){_0x42dfce[_0xff7d('0x51')]=[{'all':!![]}];}return db[_0xff7d('0x37')][_0xff7d('0x52')](_0x42dfce);})[_0xff7d('0x1c')](function(_0x373806){_0x48f078[_0xff7d('0x53')]=_0x373806;return _0x48f078;})[_0xff7d('0x1c')](respondWithFilteredResult(_0x114508,_0x42dfce))['catch'](handleError(_0x114508,null));};exports[_0xff7d('0x54')]=function(_0x313d31,_0xbba471){var _0x469a9d={'raw':![],'where':{'id':_0x313d31[_0xff7d('0x55')]['id']}},_0x107270={};_0x107270[_0xff7d('0x3c')]=_[_0xff7d('0x3e')](db['Setting'][_0xff7d('0x38')]);_0x107270[_0xff7d('0x3d')]=_[_0xff7d('0x3e')](_0x313d31[_0xff7d('0x3d')]);_0x107270[_0xff7d('0x4a')]=_[_0xff7d('0x3f')](_0x107270[_0xff7d('0x3c')],_0x107270[_0xff7d('0x3d')]);_0x469a9d[_0xff7d('0x40')]=_['intersection'](_0x107270[_0xff7d('0x3c')],qs[_0xff7d('0x41')](_0x313d31[_0xff7d('0x3d')][_0xff7d('0x41')]));_0x469a9d[_0xff7d('0x40')]=_0x469a9d[_0xff7d('0x40')][_0xff7d('0x42')]?_0x469a9d[_0xff7d('0x40')]:_0x107270[_0xff7d('0x3c')];if(_0x313d31[_0xff7d('0x3d')][_0xff7d('0x50')]){_0x469a9d[_0xff7d('0x51')]=[{'all':!![]}];}_0x469a9d=_[_0xff7d('0x4d')]({},_0x469a9d,_0x313d31['options']);return db[_0xff7d('0x37')]['find'](_0x469a9d)[_0xff7d('0x1c')](handleEntityNotFound(_0xbba471,null))[_0xff7d('0x1c')](respondWithResult(_0xbba471,null))[_0xff7d('0x26')](handleError(_0xbba471,null));};exports['update']=function(_0x5c2258,_0x43982b){if(_0x5c2258[_0xff7d('0x56')]['id']){delete _0x5c2258['body']['id'];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x5c2258[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x43982b,null))[_0xff7d('0x1c')](saveUpdates(_0x5c2258['body'],null))[_0xff7d('0x1c')](respondWithResult(_0x43982b,null))[_0xff7d('0x26')](handleError(_0x43982b,null));};exports[_0xff7d('0x58')]=function(_0x1abe91,_0x576421,_0x1beb2b){if(_0x1abe91['file']&&_0x1abe91['file'][_0xff7d('0x59')]){_0x1abe91[_0xff7d('0x56')][_0xff7d('0x5a')]=_0x1abe91[_0xff7d('0x5b')]['filename'];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x1abe91['params']['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x576421,null))[_0xff7d('0x1c')](saveUpdates(_0x1abe91[_0xff7d('0x56')],null))['then'](respondWithResult(_0x576421,null))[_0xff7d('0x26')](handleError(_0x576421,null));};exports[_0xff7d('0x5c')]=function(_0x48b4a1,_0x438d23,_0x26bc6e){if(_0x48b4a1[_0xff7d('0x5b')]&&_0x48b4a1['file'][_0xff7d('0x59')]){_0x48b4a1[_0xff7d('0x56')][_0xff7d('0x5d')]=_0x48b4a1['file'][_0xff7d('0x59')];}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x48b4a1[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x438d23,null))['then'](saveUpdates(_0x48b4a1[_0xff7d('0x56')],null))['then'](respondWithResult(_0x438d23,null))[_0xff7d('0x26')](handleError(_0x438d23,null));};var utilLicense=require(_0xff7d('0x18'));exports['getLogo']=function(_0x4bc561,_0x4c53f5,_0x351772){var _0x47fa32=_0xff7d('0x5e');var _0x551cba={'custom':![]};return utilLicense['getLicense']()[_0xff7d('0x1c')](function(_0x2fdcb5){if(_0x2fdcb5){_0x551cba=_0x2fdcb5;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x4bc561[_0xff7d('0x55')]['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),'defaultLogo',_0xff7d('0x61'),'defaultPreferred',_0xff7d('0x62')],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x4c53f5,null))['then'](function(_0x42f67a){if(_0x42f67a){var _0x2fb34c=_0x42f67a['logo']&&fs[_0xff7d('0x63')](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0x42f67a[_0xff7d('0x5a')])))?path['join'](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0x42f67a[_0xff7d('0x5a')])):path['join'](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')]('default_logo.svg'));var _0x2dcbe1=_0xff7d('0x67')+_[_0xff7d('0x68')](_0xff7d('0x5a'));if(_0x42f67a[_0x2dcbe1]||!_0x551cba['custom']){_0x2fb34c=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0xff7d('0x69')));}if(!fs['existsSync'](_0x2fb34c)){throw new db[(_0xff7d('0x6a'))]['ValidationError'](_['upperFirst']('logo')+_0xff7d('0x6b'));}return _0x4c53f5[_0xff7d('0x6c')](_0x2fb34c);}})[_0xff7d('0x26')](handleError(_0x4c53f5,null));};var utilLicense=require('../../config/license/util');exports[_0xff7d('0x6d')]=function(_0x258890,_0x130e16,_0xfb26dd){var _0x2549d3='server/files/images/logos';var _0x1ef0a2={'custom':![]};return utilLicense['getLicense']()[_0xff7d('0x1c')](function(_0x14a209){if(_0x14a209){_0x1ef0a2=_0x14a209;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x258890[_0xff7d('0x55')]['id']},'attributes':['logo',_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),_0xff7d('0x6e'),'defaultLoginLogo',_0xff7d('0x6f'),_0xff7d('0x62')],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x130e16,null))['then'](function(_0x114865){if(_0x114865){var _0x282999=_0x114865[_0xff7d('0x5d')]&&fs['existsSync'](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_['toLower'](_0x114865['loginLogo'])))?path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0x114865['loginLogo'])):path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0xff7d('0x70')));var _0x2a070f=_0xff7d('0x67')+_['upperFirst'](_0xff7d('0x5d'));if(_0x114865[_0x2a070f]||!_0x1ef0a2['custom']){_0x282999=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0xff7d('0x70')));}if(!fs[_0xff7d('0x63')](_0x282999)){throw new db[(_0xff7d('0x6a'))][(_0xff7d('0x71'))](_[_0xff7d('0x68')](_0xff7d('0x5d'))+'\x20not\x20found');}return _0x130e16[_0xff7d('0x6c')](_0x282999);}})['catch'](handleError(_0x130e16,null));};exports[_0xff7d('0x72')]=function(_0x1ba859,_0x5dba31){return db[_0xff7d('0x37')]['find']({'where':{'id':_0x1ba859['params']['id']},'attributes':[_0xff7d('0x73')]})['then'](respondWithResult(_0x5dba31,null))[_0xff7d('0x26')](handleError(_0x5dba31,null));};exports[_0xff7d('0x74')]=function(_0x3e0278,_0x322a84,_0x14c44f){if(_0x3e0278['file']&&_0x3e0278[_0xff7d('0x5b')]['filename']){_0x3e0278[_0xff7d('0x56')][_0xff7d('0x5f')]=_0x3e0278[_0xff7d('0x5b')][_0xff7d('0x59')];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x3e0278[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x322a84,null))[_0xff7d('0x1c')](saveUpdates(_0x3e0278[_0xff7d('0x56')],null))[_0xff7d('0x1c')](respondWithResult(_0x322a84,null))[_0xff7d('0x26')](handleError(_0x322a84,null));};var utilLicense=require(_0xff7d('0x18'));exports['getPreferred']=function(_0x4685c7,_0x55d40d,_0xc53f53){var _0x1d256a='server/files/images/logos';var _0x1bc030={'custom':![]};return utilLicense[_0xff7d('0x75')]()['then'](function(_0x4b6b99){if(_0x4b6b99){_0x1bc030=_0x4b6b99;}return db['Setting'][_0xff7d('0x57')]({'where':{'id':_0x4685c7['params']['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),_0xff7d('0x6e'),_0xff7d('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x55d40d,null))[_0xff7d('0x1c')](function(_0x38daf2){if(_0x38daf2){var _0x180820=_0x38daf2[_0xff7d('0x5f')]&&fs[_0xff7d('0x63')](path['join'](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0x38daf2['preferred'])))?path['join'](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0x38daf2[_0xff7d('0x5f')])):path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0xff7d('0x76')));var _0xbed75b=_0xff7d('0x67')+_['upperFirst'](_0xff7d('0x5f'));if(_0x38daf2[_0xbed75b]||!_0x1bc030[_0xff7d('0x77')]||!_0x1bc030[_0xff7d('0x5f')]){_0x180820=path['join'](config['root'],_0x1d256a,_[_0xff7d('0x66')]('default_preferred.png'));}if(!fs[_0xff7d('0x63')](_0x180820)){throw new db[(_0xff7d('0x6a'))]['ValidationError'](_[_0xff7d('0x68')](_0xff7d('0x5f'))+'\x20not\x20found');}return _0x55d40d['download'](_0x180820);}})[_0xff7d('0x26')](handleError(_0x55d40d,null));};exports['addFavicon']=function(_0x5a090a,_0x3ccc29,_0x28cb8c){if(_0x5a090a[_0xff7d('0x5b')]&&_0x5a090a[_0xff7d('0x5b')]['filename']){_0x5a090a[_0xff7d('0x56')]['favicon']=_0x5a090a[_0xff7d('0x5b')][_0xff7d('0x59')];}return db['Setting'][_0xff7d('0x57')]({'where':{'id':_0x5a090a[_0xff7d('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ccc29,null))['then'](saveUpdates(_0x5a090a['body'],null))[_0xff7d('0x1c')](respondWithResult(_0x3ccc29,null))['catch'](handleError(_0x3ccc29,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2b8739,_0x54fb1b,_0x41d1e7){var _0xd3210d='server/files/images/logos';var _0x12bd2b={'custom':![]};return utilLicense[_0xff7d('0x75')]()[_0xff7d('0x1c')](function(_0x498c60){if(_0x498c60){_0x12bd2b=_0x498c60;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x2b8739[_0xff7d('0x55')]['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),'favicon',_0xff7d('0x6e'),_0xff7d('0x61'),_0xff7d('0x6f'),_0xff7d('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x54fb1b,null))[_0xff7d('0x1c')](function(_0x574e3c){if(_0x574e3c){var _0x3fa175=_0x574e3c['favicon']&&fs['existsSync'](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0xd3210d,_[_0xff7d('0x66')](_0x574e3c[_0xff7d('0x60')])))?path[_0xff7d('0x64')](config['root'],_0xd3210d,_[_0xff7d('0x66')](_0x574e3c[_0xff7d('0x60')])):path[_0xff7d('0x64')](config['root'],_0xd3210d,_[_0xff7d('0x66')](_0xff7d('0x78')));var _0x40f74f=_0xff7d('0x67')+_[_0xff7d('0x68')](_0xff7d('0x60'));if(_0x574e3c[_0x40f74f]||!_0x12bd2b[_0xff7d('0x77')]){_0x3fa175=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0xd3210d,_[_0xff7d('0x66')](_0xff7d('0x78')));}if(!fs[_0xff7d('0x63')](_0x3fa175)){throw new db[(_0xff7d('0x6a'))][(_0xff7d('0x71'))](_[_0xff7d('0x68')](_0xff7d('0x60'))+_0xff7d('0x6b'));}return _0x54fb1b[_0xff7d('0x6c')](_0x3fa175);}})[_0xff7d('0x26')](handleError(_0x54fb1b,null));};exports[_0xff7d('0x79')]=function(_0x4fd1b2,_0x20087d){var _0x342adf={'offset':moment()[_0xff7d('0x7a')]()};_0x342adf[_0xff7d('0x7b')]=moment()[_0xff7d('0x7a')](_0x342adf[_0xff7d('0x46')])[_0xff7d('0x7c')](_0xff7d('0x7d'));return _0x20087d[_0xff7d('0x28')](0xc8)[_0xff7d('0x35')](_0x342adf);}; \ No newline at end of file +var _0x09f4=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','fields','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','favicon','defaultLoginLogo','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x26a8aa,_0xcc692a){var _0x3d35f7=function(_0x125686){while(--_0x125686){_0x26a8aa['push'](_0x26a8aa['shift']());}};_0x3d35f7(++_0xcc692a);}(_0x09f4,0xe4));var _0x409f=function(_0x361931,_0x27574e){_0x361931=_0x361931-0x0;var _0x57984b=_0x09f4[_0x361931];return _0x57984b;};'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'];var jayson=require(_0x409f('0x17'));var client=jayson[_0x409f('0x18')][_0x409f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1555c0,_0x3234c3,_0x2c4e0e,_0x565f47){return new BPromise(function(_0x1bc1bb,_0x55e557){var _0x3ec157=_0x565f47||client;return _0x3ec157[_0x409f('0x1a')](_0x1555c0,_0x2c4e0e)['then'](function(_0x34fcc9){logger[_0x409f('0x1b')](_0x409f('0x1c'),_0x3234c3,_0x409f('0x1d'));logger[_0x409f('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x3234c3,'request\x20sent',JSON['stringify'](_0x34fcc9));if(_0x34fcc9['error']){if(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x20')]===0x1f4){logger[_0x409f('0x1f')]('Setting,\x20%s,\x20%s',_0x3234c3,_0x34fcc9[_0x409f('0x1f')]['message']);return _0x55e557(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x21')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3234c3,_0x34fcc9[_0x409f('0x1f')]['message']);return _0x1bc1bb(_0x34fcc9[_0x409f('0x1f')][_0x409f('0x21')]);}else{logger[_0x409f('0x1b')]('Setting,\x20%s,\x20%s',_0x3234c3,_0x409f('0x1d'));_0x1bc1bb(_0x34fcc9[_0x409f('0x22')]['message']);}})[_0x409f('0x23')](function(_0x2f11c2){logger[_0x409f('0x1f')](_0x409f('0x1c'),_0x3234c3,_0x2f11c2);_0x55e557(_0x2f11c2);});});}function respondWithStatusCode(_0x344b3b,_0x11ca7f){_0x11ca7f=_0x11ca7f||0xcc;return function(_0xd937fe){if(_0xd937fe){return _0x344b3b[_0x409f('0x24')](_0x11ca7f);}return _0x344b3b[_0x409f('0x25')](_0x11ca7f)[_0x409f('0x26')]();};}function respondWithResult(_0x4dc190,_0x7e2bad){_0x7e2bad=_0x7e2bad||0xc8;return function(_0x1b9bce){if(_0x1b9bce){return _0x4dc190['status'](_0x7e2bad)['json'](_0x1b9bce);}};}function respondWithFilteredResult(_0x2f3051,_0x301cd4){return function(_0x521da8){if(_0x521da8){var _0x113f6b=typeof _0x301cd4[_0x409f('0x27')]===_0x409f('0x28')&&typeof _0x301cd4[_0x409f('0x29')]===_0x409f('0x28');var _0x2fca1d=_0x521da8[_0x409f('0x2a')];var _0x1aeea3=_0x113f6b?0x0:_0x301cd4['offset'];var _0x3750bb=_0x113f6b?_0x521da8[_0x409f('0x2a')]:_0x301cd4['offset']+_0x301cd4[_0x409f('0x29')];var _0xc7971e;if(_0x3750bb>=_0x2fca1d){_0x3750bb=_0x2fca1d;_0xc7971e=0xc8;}else{_0xc7971e=0xce;}_0x2f3051[_0x409f('0x25')](_0xc7971e);return _0x2f3051[_0x409f('0x2b')]('Content-Range',_0x1aeea3+'-'+_0x3750bb+'/'+_0x2fca1d)[_0x409f('0x2c')](_0x521da8);}return null;};}function patchUpdates(_0x14832d){return function(_0x6ef0ba){try{jsonpatch[_0x409f('0x2d')](_0x6ef0ba,_0x14832d,!![]);}catch(_0x1f5f39){return BPromise[_0x409f('0x2e')](_0x1f5f39);}return _0x6ef0ba[_0x409f('0x2f')]();};}function saveUpdates(_0x405bc3,_0x3fd225){return function(_0x2aaf0e){if(_0x2aaf0e){return _0x2aaf0e[_0x409f('0x30')](_0x405bc3)[_0x409f('0x31')](function(_0x4ba72d){return _0x4ba72d;});}return null;};}function removeEntity(_0x45a99f,_0x13a920){return function(_0x59df7c){if(_0x59df7c){return _0x59df7c[_0x409f('0x32')]()['then'](function(){_0x45a99f[_0x409f('0x25')](0xcc)[_0x409f('0x26')]();});}};}function handleEntityNotFound(_0x1f3e67,_0x44e1a3){return function(_0x362d85){if(!_0x362d85){_0x1f3e67[_0x409f('0x24')](0x194);}return _0x362d85;};}function handleError(_0x582b8a,_0xff40aa){_0xff40aa=_0xff40aa||0x1f4;return function(_0x2095f7){logger[_0x409f('0x1f')](_0x2095f7['stack']);if(_0x2095f7[_0x409f('0x33')]){delete _0x2095f7[_0x409f('0x33')];}_0x582b8a['status'](_0xff40aa)['send'](_0x2095f7);};}exports['index']=function(_0x28a50f,_0x12f98d){var _0x55e2bb={},_0x4eaf35={},_0x3720bb={'count':0x0,'rows':[]};var _0x4ef3d2=_[_0x409f('0x34')](db[_0x409f('0x35')][_0x409f('0x36')],function(_0x4791f5){return{'name':_0x4791f5[_0x409f('0x37')],'type':_0x4791f5[_0x409f('0x38')][_0x409f('0x39')]};});_0x4eaf35[_0x409f('0x3a')]=_[_0x409f('0x34')](_0x4ef3d2,_0x409f('0x33'));_0x4eaf35[_0x409f('0x3b')]=_['keys'](_0x28a50f[_0x409f('0x3b')]);_0x4eaf35[_0x409f('0x3c')]=_[_0x409f('0x3d')](_0x4eaf35[_0x409f('0x3a')],_0x4eaf35[_0x409f('0x3b')]);_0x55e2bb[_0x409f('0x3e')]=_[_0x409f('0x3d')](_0x4eaf35[_0x409f('0x3a')],qs['fields'](_0x28a50f[_0x409f('0x3b')]['fields']));_0x55e2bb[_0x409f('0x3e')]=_0x55e2bb['attributes'][_0x409f('0x3f')]?_0x55e2bb[_0x409f('0x3e')]:_0x4eaf35['model'];if(!_0x28a50f[_0x409f('0x3b')][_0x409f('0x40')]('nolimit')){_0x55e2bb[_0x409f('0x29')]=qs['limit'](_0x28a50f[_0x409f('0x3b')]['limit']);_0x55e2bb['offset']=qs[_0x409f('0x27')](_0x28a50f[_0x409f('0x3b')][_0x409f('0x27')]);}_0x55e2bb[_0x409f('0x41')]=qs[_0x409f('0x42')](_0x28a50f[_0x409f('0x3b')]['sort']);_0x55e2bb[_0x409f('0x43')]=qs[_0x409f('0x3c')](_[_0x409f('0x44')](_0x28a50f[_0x409f('0x3b')],_0x4eaf35[_0x409f('0x3c')]),_0x4ef3d2);if(_0x28a50f[_0x409f('0x3b')]['filter']){_0x55e2bb['where']=_[_0x409f('0x45')](_0x55e2bb[_0x409f('0x43')],{'$or':_[_0x409f('0x34')](_0x4ef3d2,function(_0x54f842){if(_0x54f842['type']!=='VIRTUAL'){var _0xf72ba5={};_0xf72ba5[_0x54f842[_0x409f('0x33')]]={'$like':'%'+_0x28a50f[_0x409f('0x3b')][_0x409f('0x46')]+'%'};return _0xf72ba5;}})});}_0x55e2bb=_[_0x409f('0x45')]({},_0x55e2bb,_0x28a50f[_0x409f('0x47')]);var _0x3bded7={'where':_0x55e2bb['where']};return db[_0x409f('0x35')][_0x409f('0x2a')](_0x3bded7)[_0x409f('0x31')](function(_0x160e45){_0x3720bb['count']=_0x160e45;if(_0x28a50f[_0x409f('0x3b')][_0x409f('0x48')]){_0x55e2bb[_0x409f('0x49')]=[{'all':!![]}];}return db[_0x409f('0x35')]['findAll'](_0x55e2bb);})[_0x409f('0x31')](function(_0x536f83){_0x3720bb[_0x409f('0x4a')]=_0x536f83;return _0x3720bb;})[_0x409f('0x31')](respondWithFilteredResult(_0x12f98d,_0x55e2bb))[_0x409f('0x23')](handleError(_0x12f98d,null));};exports[_0x409f('0x4b')]=function(_0x22ba65,_0x232373){var _0x84283f={'raw':![],'where':{'id':_0x22ba65[_0x409f('0x4c')]['id']}},_0x63a7a8={};_0x63a7a8[_0x409f('0x3a')]=_['keys'](db[_0x409f('0x35')][_0x409f('0x36')]);_0x63a7a8[_0x409f('0x3b')]=_['keys'](_0x22ba65[_0x409f('0x3b')]);_0x63a7a8[_0x409f('0x3c')]=_[_0x409f('0x3d')](_0x63a7a8['model'],_0x63a7a8[_0x409f('0x3b')]);_0x84283f[_0x409f('0x3e')]=_[_0x409f('0x3d')](_0x63a7a8[_0x409f('0x3a')],qs[_0x409f('0x4d')](_0x22ba65[_0x409f('0x3b')][_0x409f('0x4d')]));_0x84283f[_0x409f('0x3e')]=_0x84283f['attributes'][_0x409f('0x3f')]?_0x84283f[_0x409f('0x3e')]:_0x63a7a8['model'];if(_0x22ba65[_0x409f('0x3b')]['includeAll']){_0x84283f[_0x409f('0x49')]=[{'all':!![]}];}_0x84283f=_[_0x409f('0x45')]({},_0x84283f,_0x22ba65[_0x409f('0x47')]);return db[_0x409f('0x35')][_0x409f('0x4e')](_0x84283f)[_0x409f('0x31')](handleEntityNotFound(_0x232373,null))['then'](respondWithResult(_0x232373,null))['catch'](handleError(_0x232373,null));};exports[_0x409f('0x30')]=function(_0x43bbb3,_0x28e2b5){if(_0x43bbb3[_0x409f('0x4f')]['id']){delete _0x43bbb3[_0x409f('0x4f')]['id'];}return db[_0x409f('0x35')]['find']({'where':{'id':_0x43bbb3['params']['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x28e2b5,null))[_0x409f('0x31')](saveUpdates(_0x43bbb3[_0x409f('0x4f')],null))[_0x409f('0x31')](respondWithResult(_0x28e2b5,null))[_0x409f('0x23')](handleError(_0x28e2b5,null));};exports[_0x409f('0x50')]=function(_0xc17b73,_0x45791,_0x16eaf8){if(_0xc17b73[_0x409f('0x51')]&&_0xc17b73[_0x409f('0x51')]['filename']){_0xc17b73[_0x409f('0x4f')]['logo']=_0xc17b73[_0x409f('0x51')]['filename'];}return db[_0x409f('0x35')]['find']({'where':{'id':_0xc17b73[_0x409f('0x4c')]['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x45791,null))['then'](saveUpdates(_0xc17b73['body'],null))[_0x409f('0x31')](respondWithResult(_0x45791,null))[_0x409f('0x23')](handleError(_0x45791,null));};exports['addLogoLogin']=function(_0x2df918,_0xe2bab7,_0x3ce7c0){if(_0x2df918[_0x409f('0x51')]&&_0x2df918['file'][_0x409f('0x52')]){_0x2df918[_0x409f('0x4f')][_0x409f('0x53')]=_0x2df918[_0x409f('0x51')][_0x409f('0x52')];}return db[_0x409f('0x35')]['find']({'where':{'id':_0x2df918['params']['id']}})['then'](handleEntityNotFound(_0xe2bab7,null))['then'](saveUpdates(_0x2df918['body'],null))[_0x409f('0x31')](respondWithResult(_0xe2bab7,null))['catch'](handleError(_0xe2bab7,null));};var utilLicense=require(_0x409f('0x54'));exports[_0x409f('0x55')]=function(_0x2ba474,_0x2248af,_0x4c3d6b){var _0x59d163=_0x409f('0x56');var _0x5e2918={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x68eceb){if(_0x68eceb){_0x5e2918=_0x68eceb;}return db[_0x409f('0x35')]['find']({'where':{'id':_0x2ba474[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x58'),_0x409f('0x53'),_0x409f('0x59'),'favicon',_0x409f('0x5a'),'defaultLoginLogo',_0x409f('0x5b'),_0x409f('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x2248af,null))['then'](function(_0x5979a9){if(_0x5979a9){var _0x54d4b5=_0x5979a9['logo']&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_['toLower'](_0x5979a9['logo'])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x5979a9[_0x409f('0x58')])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x409f('0x61')));var _0xf44f6=_0x409f('0x62')+_[_0x409f('0x63')](_0x409f('0x58'));if(_0x5979a9[_0xf44f6]||!_0x5e2918[_0x409f('0x64')]){_0x54d4b5=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x59d163,_[_0x409f('0x60')](_0x409f('0x61')));}if(!fs[_0x409f('0x5d')](_0x54d4b5)){throw new db['Sequelize'][(_0x409f('0x65'))](_[_0x409f('0x63')](_0x409f('0x58'))+_0x409f('0x66'));}return _0x2248af['download'](_0x54d4b5);}})['catch'](handleError(_0x2248af,null));};var utilLicense=require(_0x409f('0x54'));exports['getLogoLogin']=function(_0x352ff7,_0x6a1cbb,_0x9b4838){var _0x3442f5=_0x409f('0x56');var _0x1f45f0={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x1f7fce){if(_0x1f7fce){_0x1f45f0=_0x1f7fce;}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x352ff7[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x58'),_0x409f('0x53'),_0x409f('0x59'),_0x409f('0x67'),_0x409f('0x5a'),_0x409f('0x68'),_0x409f('0x5b'),_0x409f('0x5c')],'raw':!![]});})[_0x409f('0x31')](handleEntityNotFound(_0x6a1cbb,null))[_0x409f('0x31')](function(_0xf3e408){if(_0xf3e408){var _0x32d84d=_0xf3e408['loginLogo']&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_[_0x409f('0x60')](_0xf3e408[_0x409f('0x53')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_[_0x409f('0x60')](_0xf3e408[_0x409f('0x53')])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_['toLower'](_0x409f('0x69')));var _0x36fb42=_0x409f('0x62')+_[_0x409f('0x63')]('loginLogo');if(_0xf3e408[_0x36fb42]||!_0x1f45f0[_0x409f('0x64')]){_0x32d84d=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x3442f5,_['toLower'](_0x409f('0x69')));}if(!fs['existsSync'](_0x32d84d)){throw new db[(_0x409f('0x6a'))][(_0x409f('0x65'))](_['upperFirst'](_0x409f('0x53'))+_0x409f('0x66'));}return _0x6a1cbb[_0x409f('0x6b')](_0x32d84d);}})[_0x409f('0x23')](handleError(_0x6a1cbb,null));};exports[_0x409f('0x6c')]=function(_0x322ea4,_0x52664a){return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x322ea4[_0x409f('0x4c')]['id']},'attributes':[_0x409f('0x6d')]})[_0x409f('0x31')](respondWithResult(_0x52664a,null))[_0x409f('0x23')](handleError(_0x52664a,null));};exports[_0x409f('0x6e')]=function(_0x2b946b,_0x321eeb,_0x5868b5){if(_0x2b946b['file']&&_0x2b946b[_0x409f('0x51')][_0x409f('0x52')]){_0x2b946b['body'][_0x409f('0x59')]=_0x2b946b[_0x409f('0x51')]['filename'];}return db['Setting'][_0x409f('0x4e')]({'where':{'id':_0x2b946b[_0x409f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x321eeb,null))[_0x409f('0x31')](saveUpdates(_0x2b946b[_0x409f('0x4f')],null))[_0x409f('0x31')](respondWithResult(_0x321eeb,null))[_0x409f('0x23')](handleError(_0x321eeb,null));};var utilLicense=require(_0x409f('0x54'));exports[_0x409f('0x6f')]=function(_0x1ad442,_0x5929f3,_0x3e6d37){var _0x506cd4=_0x409f('0x56');var _0x5747df={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x26d419){if(_0x26d419){_0x5747df=_0x26d419;}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x1ad442[_0x409f('0x4c')]['id']},'attributes':['logo',_0x409f('0x53'),_0x409f('0x59'),'favicon',_0x409f('0x5a'),_0x409f('0x68'),_0x409f('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x409f('0x31')](handleEntityNotFound(_0x5929f3,null))[_0x409f('0x31')](function(_0x5c2922){if(_0x5c2922){var _0x539107=_0x5c2922[_0x409f('0x59')]&&fs['existsSync'](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_['toLower'](_0x5c2922[_0x409f('0x59')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')](_0x5c2922['preferred'])):path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')](_0x409f('0x70')));var _0x55e8a9='default'+_[_0x409f('0x63')](_0x409f('0x59'));if(_0x5c2922[_0x55e8a9]||!_0x5747df['custom']||!_0x5747df['preferred']){_0x539107=path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x506cd4,_[_0x409f('0x60')]('default_preferred.png'));}if(!fs[_0x409f('0x5d')](_0x539107)){throw new db['Sequelize'][(_0x409f('0x65'))](_[_0x409f('0x63')](_0x409f('0x59'))+_0x409f('0x66'));}return _0x5929f3[_0x409f('0x6b')](_0x539107);}})[_0x409f('0x23')](handleError(_0x5929f3,null));};exports[_0x409f('0x71')]=function(_0x1a2800,_0x5e3f2a,_0x469bd9){if(_0x1a2800[_0x409f('0x51')]&&_0x1a2800[_0x409f('0x51')]['filename']){_0x1a2800[_0x409f('0x4f')][_0x409f('0x67')]=_0x1a2800[_0x409f('0x51')]['filename'];}return db[_0x409f('0x35')][_0x409f('0x4e')]({'where':{'id':_0x1a2800[_0x409f('0x4c')]['id']}})[_0x409f('0x31')](handleEntityNotFound(_0x5e3f2a,null))[_0x409f('0x31')](saveUpdates(_0x1a2800[_0x409f('0x4f')],null))['then'](respondWithResult(_0x5e3f2a,null))['catch'](handleError(_0x5e3f2a,null));};var utilLicense=require(_0x409f('0x54'));exports['getFavicon']=function(_0x58af2c,_0x48abfa,_0x2a7f90){var _0x6ab63d='server/files/images/logos';var _0x38d278={'custom':![]};return utilLicense[_0x409f('0x57')]()[_0x409f('0x31')](function(_0x3022e7){if(_0x3022e7){_0x38d278=_0x3022e7;}return db['Setting'][_0x409f('0x4e')]({'where':{'id':_0x58af2c[_0x409f('0x4c')]['id']},'attributes':['logo',_0x409f('0x53'),_0x409f('0x59'),_0x409f('0x67'),_0x409f('0x5a'),_0x409f('0x68'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x48abfa,null))[_0x409f('0x31')](function(_0x162e31){if(_0x162e31){var _0x8fde12=_0x162e31[_0x409f('0x67')]&&fs[_0x409f('0x5d')](path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x162e31[_0x409f('0x67')])))?path[_0x409f('0x5e')](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x162e31[_0x409f('0x67')])):path['join'](config[_0x409f('0x5f')],_0x6ab63d,_[_0x409f('0x60')](_0x409f('0x72')));var _0x30809b=_0x409f('0x62')+_[_0x409f('0x63')](_0x409f('0x67'));if(_0x162e31[_0x30809b]||!_0x38d278[_0x409f('0x64')]){_0x8fde12=path[_0x409f('0x5e')](config['root'],_0x6ab63d,_[_0x409f('0x60')](_0x409f('0x72')));}if(!fs[_0x409f('0x5d')](_0x8fde12)){throw new db[(_0x409f('0x6a'))]['ValidationError'](_[_0x409f('0x63')](_0x409f('0x67'))+_0x409f('0x66'));}return _0x48abfa[_0x409f('0x6b')](_0x8fde12);}})['catch'](handleError(_0x48abfa,null));};exports['getDate']=function(_0x311cf7,_0x18c5ef){var _0x2461a9={'offset':moment()[_0x409f('0x73')]()};_0x2461a9['now']=moment()[_0x409f('0x73')](_0x2461a9[_0x409f('0x27')])[_0x409f('0x74')](_0x409f('0x75'));return _0x18c5ef[_0x409f('0x25')](0xc8)['send'](_0x2461a9);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5628cec..7dcb570 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x4dfa20,_0x35afb5){var _0x146afc=function(_0x5a4344){while(--_0x5a4344){_0x4dfa20['push'](_0x4dfa20['shift']());}};_0x146afc(++_0x35afb5);}(_0x3e74,0x175));var _0x43e7=function(_0x2903e0,_0xefce2c){_0x2903e0=_0x2903e0-0x0;var _0x5744cb=_0x3e74[_0x2903e0];return _0x5744cb;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 2359a96..7c92f6c 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 _0xdc36=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','info','result','catch','options','raw','include','map','attributes','model','then','ShowSetting','lodash','util'];(function(_0x3fdfd5,_0x14031c){var _0x244725=function(_0x51e6ff){while(--_0x51e6ff){_0x3fdfd5['push'](_0x3fdfd5['shift']());}};_0x244725(++_0x14031c);}(_0xdc36,0x1ee));var _0x6dc3=function(_0x248011,_0x360f48){_0x248011=_0x248011-0x0;var _0x33eaa7=_0xdc36[_0x248011];return _0x33eaa7;};'use strict';var _=require(_0x6dc3('0x0'));var util=require(_0x6dc3('0x1'));var moment=require(_0x6dc3('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dc3('0x3'));var fs=require('fs');var Redis=require(_0x6dc3('0x4'));var db=require(_0x6dc3('0x5'))['db'];var utils=require(_0x6dc3('0x6'));var logger=require(_0x6dc3('0x7'))(_0x6dc3('0x8'));var config=require(_0x6dc3('0x9'));var jayson=require(_0x6dc3('0xa'));var client=jayson[_0x6dc3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440242,_0x4f9a43,_0xd2df85){return new BPromise(function(_0x380ce1,_0x5901bd){return client[_0x6dc3('0xc')](_0x440242,_0xd2df85)['then'](function(_0x15948f){logger['info']('Setting,\x20%s,\x20%s',_0x4f9a43,'request\x20sent');logger[_0x6dc3('0xd')](_0x6dc3('0xe'),_0x4f9a43,_0x6dc3('0xf'),JSON[_0x6dc3('0x10')](_0x15948f));if(_0x15948f[_0x6dc3('0x11')]){if(_0x15948f[_0x6dc3('0x11')]['code']===0x1f4){logger[_0x6dc3('0x11')](_0x6dc3('0x12'),_0x4f9a43,_0x15948f['error'][_0x6dc3('0x13')]);return _0x5901bd(_0x15948f[_0x6dc3('0x11')][_0x6dc3('0x13')]);}logger[_0x6dc3('0x11')](_0x6dc3('0x12'),_0x4f9a43,_0x15948f[_0x6dc3('0x11')]['message']);return _0x380ce1(_0x15948f[_0x6dc3('0x11')]['message']);}else{logger[_0x6dc3('0x14')]('Setting,\x20%s,\x20%s',_0x4f9a43,_0x6dc3('0xf'));_0x380ce1(_0x15948f[_0x6dc3('0x15')]['message']);}})[_0x6dc3('0x16')](function(_0x1ccaef){logger['error']('Setting,\x20%s,\x20%s',_0x4f9a43,_0x1ccaef);_0x5901bd(_0x1ccaef);});});}exports['ShowSetting']=function(_0x2b1158){var _0x2281bc=this;return new Promise(function(_0x1db6f8,_0x59cce2){return db['Setting']['find']({'raw':_0x2b1158[_0x6dc3('0x17')]?_0x2b1158['options'][_0x6dc3('0x18')]===undefined?!![]:![]:!![],'where':_0x2b1158[_0x6dc3('0x17')]?_0x2b1158[_0x6dc3('0x17')]['where']||null:null,'attributes':_0x2b1158[_0x6dc3('0x17')]?_0x2b1158['options']['attributes']||null:null,'include':_0x2b1158[_0x6dc3('0x17')]?_0x2b1158[_0x6dc3('0x17')][_0x6dc3('0x19')]?_[_0x6dc3('0x1a')](_0x2b1158[_0x6dc3('0x17')]['include'],function(_0x4bb34c){return{'model':db[_0x4bb34c['model']],'as':_0x4bb34c['as'],'attributes':_0x4bb34c[_0x6dc3('0x1b')],'include':_0x4bb34c[_0x6dc3('0x19')]?_['map'](_0x4bb34c['include'],function(_0x55a9b9){return{'model':db[_0x55a9b9[_0x6dc3('0x1c')]],'as':_0x55a9b9['as'],'attributes':_0x55a9b9['attributes'],'include':_0x55a9b9['include']?_[_0x6dc3('0x1a')](_0x55a9b9[_0x6dc3('0x19')],function(_0x407db1){return{'model':db[_0x407db1['model']],'as':_0x407db1['as'],'attributes':_0x407db1[_0x6dc3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6dc3('0x1d')](function(_0x15fa2c){logger[_0x6dc3('0x14')](_0x6dc3('0x1e'),_0x2b1158);logger[_0x6dc3('0xd')](_0x6dc3('0x1e'),_0x2b1158,JSON[_0x6dc3('0x10')](_0x15fa2c));_0x1db6f8(_0x15fa2c);})['catch'](function(_0x1feaa2){logger[_0x6dc3('0x11')](_0x6dc3('0x1e'),_0x1feaa2[_0x6dc3('0x13')],_0x2b1158);_0x59cce2(_0x2281bc[_0x6dc3('0x11')](0x1f4,_0x1feaa2[_0x6dc3('0x13')]));});});}; \ No newline at end of file +var _0xa5c3=['attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','include','model','map'];(function(_0x5e7c7a,_0x3439c1){var _0x106214=function(_0x4516ca){while(--_0x4516ca){_0x5e7c7a['push'](_0x5e7c7a['shift']());}};_0x106214(++_0x3439c1);}(_0xa5c3,0x1e1));var _0x3a5c=function(_0x1c5032,_0xb1820b){_0x1c5032=_0x1c5032-0x0;var _0x36acea=_0xa5c3[_0x1c5032];return _0x36acea;};'use strict';var _=require(_0x3a5c('0x0'));var util=require(_0x3a5c('0x1'));var moment=require(_0x3a5c('0x2'));var BPromise=require(_0x3a5c('0x3'));var rs=require(_0x3a5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a5c('0x5'))['db'];var utils=require(_0x3a5c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a5c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3a5c('0x8')][_0x3a5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb105a,_0x1b16aa,_0x25343e){return new BPromise(function(_0xb42579,_0x151705){return client[_0x3a5c('0xa')](_0xb105a,_0x25343e)[_0x3a5c('0xb')](function(_0x59a94f){logger['info']('Setting,\x20%s,\x20%s',_0x1b16aa,'request\x20sent');logger[_0x3a5c('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x1b16aa,_0x3a5c('0xd'),JSON[_0x3a5c('0xe')](_0x59a94f));if(_0x59a94f['error']){if(_0x59a94f[_0x3a5c('0xf')][_0x3a5c('0x10')]===0x1f4){logger['error'](_0x3a5c('0x11'),_0x1b16aa,_0x59a94f[_0x3a5c('0xf')]['message']);return _0x151705(_0x59a94f[_0x3a5c('0xf')][_0x3a5c('0x12')]);}logger[_0x3a5c('0xf')](_0x3a5c('0x11'),_0x1b16aa,_0x59a94f['error'][_0x3a5c('0x12')]);return _0xb42579(_0x59a94f[_0x3a5c('0xf')]['message']);}else{logger[_0x3a5c('0x13')](_0x3a5c('0x11'),_0x1b16aa,'request\x20sent');_0xb42579(_0x59a94f[_0x3a5c('0x14')][_0x3a5c('0x12')]);}})[_0x3a5c('0x15')](function(_0x5e4f0e){logger['error'](_0x3a5c('0x11'),_0x1b16aa,_0x5e4f0e);_0x151705(_0x5e4f0e);});});}exports[_0x3a5c('0x16')]=function(_0x24fcf4){var _0xc73235=this;return new Promise(function(_0x44c142,_0x269479){return db[_0x3a5c('0x17')][_0x3a5c('0x18')]({'raw':_0x24fcf4['options']?_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x24fcf4['options']?_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1b')]||null:null,'attributes':_0x24fcf4[_0x3a5c('0x19')]?_0x24fcf4[_0x3a5c('0x19')]['attributes']||null:null,'include':_0x24fcf4[_0x3a5c('0x19')]?_0x24fcf4['options']['include']?_['map'](_0x24fcf4[_0x3a5c('0x19')][_0x3a5c('0x1c')],function(_0x3c0566){return{'model':db[_0x3c0566[_0x3a5c('0x1d')]],'as':_0x3c0566['as'],'attributes':_0x3c0566['attributes'],'include':_0x3c0566[_0x3a5c('0x1c')]?_[_0x3a5c('0x1e')](_0x3c0566[_0x3a5c('0x1c')],function(_0xbc1306){return{'model':db[_0xbc1306[_0x3a5c('0x1d')]],'as':_0xbc1306['as'],'attributes':_0xbc1306[_0x3a5c('0x1f')],'include':_0xbc1306[_0x3a5c('0x1c')]?_[_0x3a5c('0x1e')](_0xbc1306[_0x3a5c('0x1c')],function(_0x4d4312){return{'model':db[_0x4d4312['model']],'as':_0x4d4312['as'],'attributes':_0x4d4312[_0x3a5c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3a5c('0xb')](function(_0x1a269f){logger[_0x3a5c('0x13')](_0x3a5c('0x16'),_0x24fcf4);logger[_0x3a5c('0xc')]('ShowSetting',_0x24fcf4,JSON[_0x3a5c('0xe')](_0x1a269f));_0x44c142(_0x1a269f);})[_0x3a5c('0x15')](function(_0x432d7f){logger[_0x3a5c('0xf')](_0x3a5c('0x16'),_0x432d7f[_0x3a5c('0x12')],_0x24fcf4);_0x269479(_0xc73235[_0x3a5c('0xf')](0x1f4,_0x432d7f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f4c2221..bbf02d7 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(_0x21d5f6,_0x229b9d){var _0x574030=function(_0x33b87b){while(--_0x33b87b){_0x21d5f6['push'](_0x21d5f6['shift']());}};_0x574030(++_0x229b9d);}(_0x7a54,0x106));var _0x47a5=function(_0x5b91e2,_0x14b15c){_0x5b91e2=_0x5b91e2-0x0;var _0xeaab57=_0x7a54[_0x5b91e2];return _0xeaab57;};'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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x455eda,_0x5ba3e4){var _0x30284b=function(_0x46ea92){while(--_0x46ea92){_0x455eda['push'](_0x455eda['shift']());}};_0x30284b(++_0x5ba3e4);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4082505..8ae0cdc 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 _0x68a6=['randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','csc','infobip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x2d7193,_0x10650f){var _0x5b6f9c=function(_0x6feb6b){while(--_0x6feb6b){_0x2d7193['push'](_0x2d7193['shift']());}};_0x5b6f9c(++_0x10650f);}(_0x68a6,0x19e));var _0x668a=function(_0x50405e,_0x5f19b5){_0x50405e=_0x50405e-0x0;var _0x10d0c7=_0x68a6[_0x50405e];return _0x10d0c7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x668a('0x0'));module[_0x668a('0x1')]={'name':{'type':Sequelize[_0x668a('0x2')],'unique':_0x668a('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x668a('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x668a('0x4')]();}},'phone':{'type':Sequelize[_0x668a('0x2')]},'type':{'type':Sequelize[_0x668a('0x5')](_0x668a('0x6'),'skebby',_0x668a('0x7'),_0x668a('0x8'),'plivo','clickatell','bandwidth',_0x668a('0x9'),_0x668a('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x668a('0x2')]},'authId':{'type':Sequelize[_0x668a('0x2')]},'authToken':{'type':Sequelize[_0x668a('0x2')]},'smsMethod':{'type':Sequelize[_0x668a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x668a('0x2')]},'apiKey':{'type':Sequelize[_0x668a('0x2')]},'applicationId':{'type':Sequelize[_0x668a('0x2')]},'accountId':{'type':Sequelize[_0x668a('0x2')]},'senderString':{'type':Sequelize[_0x668a('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x668a('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x668a('0xb');}},'notificationSound':{'type':Sequelize[_0x668a('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x668a('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x668a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x668a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x668a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x668a('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x668a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x668a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x668a('0xd')],'comment':_0x668a('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x668a('0xc')],'defaultValue':![],'comment':_0x668a('0xf'),'set':function(_0x29ff4b){if(!_0x29ff4b)this[_0x668a('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x668a('0x11'),_0x29ff4b);}}}; \ No newline at end of file +var _0xb11c=['connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate','ENUM','twilio','skebby'];(function(_0x317019,_0x1725f4){var _0x2840ca=function(_0x370a85){while(--_0x370a85){_0x317019['push'](_0x317019['shift']());}};_0x2840ca(++_0x1725f4);}(_0xb11c,0x12d));var _0xcb11=function(_0x35d7c2,_0x5a0252){_0x35d7c2=_0x35d7c2-0x0;var _0x3d9ace=_0xb11c[_0x35d7c2];return _0x3d9ace;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcb11('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcb11('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xcb11('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcb11('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcb11('0x2')],'defaultValue':function(){return rs[_0xcb11('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcb11('0x4')](_0xcb11('0x5'),_0xcb11('0x6'),_0xcb11('0x7'),_0xcb11('0x8'),_0xcb11('0x9'),_0xcb11('0xa'),'bandwidth',_0xcb11('0xb'),_0xcb11('0xc'),_0xcb11('0xd'))},'accountSid':{'type':Sequelize[_0xcb11('0x2')]},'authId':{'type':Sequelize[_0xcb11('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xcb11('0x2')]},'password':{'type':Sequelize[_0xcb11('0x2')]},'apiKey':{'type':Sequelize[_0xcb11('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xcb11('0x2')]},'senderString':{'type':Sequelize[_0xcb11('0x2')]},'deliveryReport':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xcb11('0x2')]},'notificationTemplate':{'type':Sequelize[_0xcb11('0xf')],'defaultValue':function(){return _0xcb11('0x10');}},'notificationSound':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb11('0xe')],'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[_0xcb11('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcb11('0xe')],'defaultValue':![],'comment':_0xcb11('0x12'),'set':function(_0x397049){if(!_0x397049)this[_0xcb11('0x13')](_0xcb11('0x14'),null);this['setDataValue'](_0xcb11('0x15'),_0x397049);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fec37df..86aa2f6 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 _0x0330=['Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','status_code','groupName','DELIVERED','redif','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','UserProfileResource','end','stack','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','params','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','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','defaults','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications'];(function(_0x244d1d,_0x4c47a2){var _0x4cd32f=function(_0x126080){while(--_0x126080){_0x244d1d['push'](_0x244d1d['shift']());}};_0x4cd32f(++_0x4c47a2);}(_0x0330,0x1f4));var _0x0033=function(_0x53af22,_0x17f9b7){_0x53af22=_0x53af22-0x0;var _0x553c9a=_0x0330[_0x53af22];return _0x553c9a;};'use strict';var emlformat=require(_0x0033('0x0'));var rimraf=require(_0x0033('0x1'));var zipdir=require(_0x0033('0x2'));var jsonpatch=require(_0x0033('0x3'));var rp=require('request-promise');var moment=require(_0x0033('0x4'));var BPromise=require(_0x0033('0x5'));var Mustache=require(_0x0033('0x6'));var util=require(_0x0033('0x7'));var path=require('path');var sox=require(_0x0033('0x8'));var csv=require('to-csv');var ejs=require(_0x0033('0x9'));var fs=require('fs');var fs_extra=require(_0x0033('0xa'));var _=require('lodash');var squel=require(_0x0033('0xb'));var crypto=require(_0x0033('0xc'));var jsforce=require(_0x0033('0xd'));var deskjs=require(_0x0033('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0033('0xf'));var Papa=require('papaparse');var Redis=require(_0x0033('0x10'));var authService=require(_0x0033('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0033('0x12'));var hardwareService=require(_0x0033('0x13'));var logger=require('../../config/logger')(_0x0033('0x14'));var utils=require(_0x0033('0x15'));var config=require(_0x0033('0x16'));var licenseUtil=require(_0x0033('0x17'));var db=require('../../mysqldb')['db'];config[_0x0033('0x18')]=_['defaults'](config[_0x0033('0x18')],{'host':_0x0033('0x19'),'port':0x18eb});var socket=require(_0x0033('0x1a'))(new Redis(config[_0x0033('0x18')]));require(_0x0033('0x1b'))['register'](socket);var jayson=require(_0x0033('0x1c'));var client=jayson['client'][_0x0033('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x58e14c,_0x236ebb,_0x3914c6,_0x198c86){return new BPromise(function(_0x2e3104,_0x24925a){var _0x59f5a2=_0x198c86||client;return _0x59f5a2[_0x0033('0x1e')](_0x58e14c,_0x3914c6)[_0x0033('0x1f')](function(_0x540599){logger[_0x0033('0x20')](_0x0033('0x21'),_0x236ebb,_0x0033('0x22'));logger[_0x0033('0x23')](_0x0033('0x24'),_0x236ebb,_0x0033('0x22'),JSON[_0x0033('0x25')](_0x540599));if(_0x540599[_0x0033('0x26')]){if(_0x540599['error'][_0x0033('0x27')]===0x1f4){logger[_0x0033('0x26')](_0x0033('0x21'),_0x236ebb,_0x540599[_0x0033('0x26')][_0x0033('0x28')]);return _0x24925a(_0x540599['error'][_0x0033('0x28')]);}logger['error'](_0x0033('0x21'),_0x236ebb,_0x540599['error'][_0x0033('0x28')]);return _0x2e3104(_0x540599[_0x0033('0x26')][_0x0033('0x28')]);}else{logger[_0x0033('0x20')](_0x0033('0x21'),_0x236ebb,'request\x20sent');_0x2e3104(_0x540599[_0x0033('0x29')][_0x0033('0x28')]);}})[_0x0033('0x2a')](function(_0x21f65a){logger[_0x0033('0x26')]('SmsAccount,\x20%s,\x20%s',_0x236ebb,_0x21f65a);_0x24925a(_0x21f65a);});});}function respondWithStatusCode(_0x331998,_0x34d7ab){_0x34d7ab=_0x34d7ab||0xcc;return function(_0x105be6){if(_0x105be6){return _0x331998[_0x0033('0x2b')](_0x34d7ab);}return _0x331998['status'](_0x34d7ab)['end']();};}function respondWithResult(_0x355726,_0x48c07f){_0x48c07f=_0x48c07f||0xc8;return function(_0x3dfbdb){if(_0x3dfbdb){return _0x355726[_0x0033('0x2c')](_0x48c07f)[_0x0033('0x2d')](_0x3dfbdb);}};}function respondWithFilteredResult(_0x2ed8f5,_0x235d6b){return function(_0x418bad){if(_0x418bad){var _0x2a8bac=typeof _0x235d6b[_0x0033('0x2e')]===_0x0033('0x2f')&&typeof _0x235d6b[_0x0033('0x30')]===_0x0033('0x2f');var _0x3949bb=_0x418bad['count'];var _0x51b7b5=_0x2a8bac?0x0:_0x235d6b[_0x0033('0x2e')];var _0x3d2eb0=_0x2a8bac?_0x418bad[_0x0033('0x31')]:_0x235d6b['offset']+_0x235d6b[_0x0033('0x30')];var _0x564168;if(_0x3d2eb0>=_0x3949bb){_0x3d2eb0=_0x3949bb;_0x564168=0xc8;}else{_0x564168=0xce;}_0x2ed8f5[_0x0033('0x2c')](_0x564168);return _0x2ed8f5[_0x0033('0x32')](_0x0033('0x33'),_0x51b7b5+'-'+_0x3d2eb0+'/'+_0x3949bb)[_0x0033('0x2d')](_0x418bad);}return null;};}function patchUpdates(_0x2e2db8){return function(_0xd64138){try{jsonpatch['apply'](_0xd64138,_0x2e2db8,!![]);}catch(_0xb92d58){return BPromise['reject'](_0xb92d58);}return _0xd64138[_0x0033('0x34')]();};}function saveUpdates(_0x376c67,_0x3662bf){return function(_0x7ceeb5){if(_0x7ceeb5){return _0x7ceeb5[_0x0033('0x35')](_0x376c67)['then'](function(_0x501193){return _0x501193;});}return null;};}function removeEntity(_0xf547c2,_0x3ce022){return function(_0x26f2d0){if(_0x26f2d0){return _0x26f2d0[_0x0033('0x36')]()[_0x0033('0x1f')](function(){var _0x455da5=_0x26f2d0[_0x0033('0x37')]({'plain':!![]});var _0x2860fe='SmsAccounts';return db[_0x0033('0x38')]['destroy']({'where':{'type':_0x2860fe,'resourceId':_0x455da5['id']}})[_0x0033('0x1f')](function(){return _0x26f2d0;});})['then'](function(){_0xf547c2[_0x0033('0x2c')](0xcc)[_0x0033('0x39')]();});}};}function handleEntityNotFound(_0xdc26b4,_0x438ac1){return function(_0x5303f9){if(!_0x5303f9){_0xdc26b4[_0x0033('0x2b')](0x194);}return _0x5303f9;};}function handleError(_0x68fa15,_0xb179e3){_0xb179e3=_0xb179e3||0x1f4;return function(_0x218c05){logger[_0x0033('0x26')](_0x218c05[_0x0033('0x3a')]);if(_0x218c05['name']){delete _0x218c05['name'];}_0x68fa15[_0x0033('0x2c')](_0xb179e3)['send'](_0x218c05);};}exports[_0x0033('0x3b')]=function(_0x2cc07c,_0x32ed77){var _0x2ade83={'include':[{'model':db[_0x0033('0x3c')],'as':_0x0033('0x3d')}]},_0x2eeabd={},_0xd7c276={'count':0x0,'rows':[]};var _0xab7bc9=_[_0x0033('0x3e')](db[_0x0033('0x3f')][_0x0033('0x40')],function(_0x24f60d){return{'name':_0x24f60d[_0x0033('0x41')],'type':_0x24f60d['type'][_0x0033('0x42')]};});_0x2eeabd['model']=_[_0x0033('0x3e')](_0xab7bc9,_0x0033('0x43'));_0x2eeabd[_0x0033('0x44')]=_[_0x0033('0x45')](_0x2cc07c[_0x0033('0x44')]);_0x2eeabd[_0x0033('0x46')]=_['intersection'](_0x2eeabd['model'],_0x2eeabd[_0x0033('0x44')]);_0x2ade83['attributes']=_[_0x0033('0x47')](_0x2eeabd[_0x0033('0x48')],qs[_0x0033('0x49')](_0x2cc07c[_0x0033('0x44')][_0x0033('0x49')]));_0x2ade83[_0x0033('0x4a')]=_0x2ade83[_0x0033('0x4a')][_0x0033('0x4b')]?_0x2ade83[_0x0033('0x4a')]:_0x2eeabd[_0x0033('0x48')];if(!_0x2cc07c[_0x0033('0x44')][_0x0033('0x4c')](_0x0033('0x4d'))){_0x2ade83[_0x0033('0x30')]=qs['limit'](_0x2cc07c[_0x0033('0x44')]['limit']);_0x2ade83[_0x0033('0x2e')]=qs['offset'](_0x2cc07c[_0x0033('0x44')]['offset']);}_0x2ade83[_0x0033('0x4e')]=qs[_0x0033('0x4f')](_0x2cc07c[_0x0033('0x44')][_0x0033('0x4f')]);_0x2ade83[_0x0033('0x50')]=qs['filters'](_[_0x0033('0x51')](_0x2cc07c[_0x0033('0x44')],_0x2eeabd[_0x0033('0x46')]),_0xab7bc9);if(_0x2cc07c[_0x0033('0x44')]['filter']){_0x2ade83[_0x0033('0x50')]=_[_0x0033('0x52')](_0x2ade83[_0x0033('0x50')],{'$or':_[_0x0033('0x3e')](_0xab7bc9,function(_0x49dff4){if(_0x49dff4[_0x0033('0x53')]!==_0x0033('0x54')){var _0x27bab2={};_0x27bab2[_0x49dff4['name']]={'$like':'%'+_0x2cc07c[_0x0033('0x44')][_0x0033('0x55')]+'%'};return _0x27bab2;}})});}_0x2ade83=_[_0x0033('0x52')]({},_0x2ade83,_0x2cc07c[_0x0033('0x56')]);var _0x24ba2c={'where':_0x2ade83[_0x0033('0x50')]};return db[_0x0033('0x3f')]['count'](_0x24ba2c)[_0x0033('0x1f')](function(_0x103d1c){_0xd7c276[_0x0033('0x31')]=_0x103d1c;if(_0x2cc07c[_0x0033('0x44')]['includeAll']){_0x2ade83[_0x0033('0x57')]=[{'all':!![]}];}return db[_0x0033('0x3f')][_0x0033('0x58')](_0x2ade83);})[_0x0033('0x1f')](function(_0x4471e6){_0xd7c276['rows']=_0x4471e6;return _0xd7c276;})[_0x0033('0x1f')](respondWithFilteredResult(_0x32ed77,_0x2ade83))[_0x0033('0x2a')](handleError(_0x32ed77,null));};exports[_0x0033('0x59')]=function(_0xf34f19,_0x41bcd7){var _0x3859b0={'raw':![],'where':{'id':_0xf34f19['params']['id']},'include':[{'model':db[_0x0033('0x3c')],'as':_0x0033('0x3d')}]},_0x36e058={};_0x36e058[_0x0033('0x48')]=_['keys'](db[_0x0033('0x3f')][_0x0033('0x40')]);_0x36e058['query']=_[_0x0033('0x45')](_0xf34f19[_0x0033('0x44')]);_0x36e058[_0x0033('0x46')]=_[_0x0033('0x47')](_0x36e058[_0x0033('0x48')],_0x36e058[_0x0033('0x44')]);_0x3859b0[_0x0033('0x4a')]=_[_0x0033('0x47')](_0x36e058[_0x0033('0x48')],qs['fields'](_0xf34f19[_0x0033('0x44')][_0x0033('0x49')]));_0x3859b0['attributes']=_0x3859b0[_0x0033('0x4a')][_0x0033('0x4b')]?_0x3859b0['attributes']:_0x36e058['model'];if(_0xf34f19[_0x0033('0x44')][_0x0033('0x5a')]){_0x3859b0[_0x0033('0x57')]=[{'all':!![]}];}_0x3859b0=_['merge']({},_0x3859b0,_0xf34f19[_0x0033('0x56')]);return db[_0x0033('0x3f')][_0x0033('0x5b')](_0x3859b0)['then'](handleEntityNotFound(_0x41bcd7,null))[_0x0033('0x1f')](respondWithResult(_0x41bcd7,null))['catch'](handleError(_0x41bcd7,null));};exports[_0x0033('0x5c')]=function(_0x54d8d3,_0x4a1e6b){return db[_0x0033('0x3f')][_0x0033('0x5c')](_0x54d8d3['body'],{})[_0x0033('0x1f')](function(_0x1d7c0e){var _0x1fa2c6=_0x54d8d3[_0x0033('0x5d')][_0x0033('0x37')]({'plain':!![]});if(!_0x1fa2c6)throw new Error(_0x0033('0x5e'));if(_0x1fa2c6['role']===_0x0033('0x5d')){var _0xdb5501=_0x1d7c0e['get']({'plain':!![]});var _0x59695c=_0x0033('0x5f');return db[_0x0033('0x60')]['find']({'where':{'name':_0x59695c,'userProfileId':_0x1fa2c6[_0x0033('0x61')]},'raw':!![]})[_0x0033('0x1f')](function(_0xb65487){if(_0xb65487&&_0xb65487['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xdb5501[_0x0033('0x43')],'resourceId':_0xdb5501['id'],'type':_0xb65487[_0x0033('0x43')],'sectionId':_0xb65487['id']},{})[_0x0033('0x1f')](function(){return _0x1d7c0e;});}else{return _0x1d7c0e;}})[_0x0033('0x2a')](function(_0xf470e9){logger[_0x0033('0x26')](_0x0033('0x62'),_0xf470e9);throw _0xf470e9;});}return _0x1d7c0e;})['then'](respondWithResult(_0x4a1e6b,0xc9))['catch'](handleError(_0x4a1e6b,null));};exports['update']=function(_0x3be162,_0x2129d7){if(_0x3be162[_0x0033('0x63')]['id']){delete _0x3be162[_0x0033('0x63')]['id'];}return db[_0x0033('0x3f')]['find']({'where':{'id':_0x3be162['params']['id']},'include':[{'model':db[_0x0033('0x3c')],'as':_0x0033('0x3d')}]})['then'](handleEntityNotFound(_0x2129d7,null))[_0x0033('0x1f')](saveUpdates(_0x3be162[_0x0033('0x63')],null))[_0x0033('0x1f')](respondWithResult(_0x2129d7,null))['catch'](handleError(_0x2129d7,null));};exports[_0x0033('0x36')]=function(_0x14c0a7,_0x2a8acf){return db['SmsAccount'][_0x0033('0x5b')]({'where':{'id':_0x14c0a7['params']['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x2a8acf,null))[_0x0033('0x1f')](removeEntity(_0x2a8acf,null))[_0x0033('0x2a')](handleError(_0x2a8acf,null));};exports[_0x0033('0x64')]=function(_0x4e90ed,_0xd1dfc6){return db[_0x0033('0x3f')][_0x0033('0x64')]()[_0x0033('0x1f')](respondWithResult(_0xd1dfc6,null))[_0x0033('0x2a')](handleError(_0xd1dfc6,null));};exports['addDisposition']=function(_0x315adc,_0x25e91d,_0x35d8ef){if(_0x315adc[_0x0033('0x63')]['id']){delete _0x315adc[_0x0033('0x63')]['id'];}return db['SmsAccount'][_0x0033('0x5b')]({'where':{'id':_0x315adc[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x25e91d,null))['then'](function(_0x4b553e){if(_0x4b553e){_0x315adc[_0x0033('0x63')][_0x0033('0x66')]=_0x4b553e['id'];return db[_0x0033('0x67')][_0x0033('0x5c')](_0x315adc[_0x0033('0x63')]);}})[_0x0033('0x1f')](respondWithResult(_0x25e91d,null))[_0x0033('0x2a')](handleError(_0x25e91d,null));};exports[_0x0033('0x68')]=function(_0x3c9ea5,_0x5a4960,_0x19f603){var _0x3e4c3d={'raw':![],'where':{}};var _0x1be89c={};var _0x3792f={'count':0x0,'rows':[]};return db[_0x0033('0x3f')][_0x0033('0x69')]({'where':{'id':_0x3c9ea5[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x5a4960,null))[_0x0033('0x1f')](function(_0x5e3975){if(_0x5e3975){_0x1be89c[_0x0033('0x48')]=_['keys'](db['Disposition'][_0x0033('0x40')]);_0x1be89c['query']=_[_0x0033('0x45')](_0x3c9ea5[_0x0033('0x44')]);_0x1be89c[_0x0033('0x46')]=_[_0x0033('0x47')](_0x1be89c[_0x0033('0x48')],_0x1be89c[_0x0033('0x44')]);_0x3e4c3d[_0x0033('0x4a')]=_[_0x0033('0x47')](_0x1be89c[_0x0033('0x48')],qs[_0x0033('0x49')](_0x3c9ea5['query'][_0x0033('0x49')]));_0x3e4c3d['attributes']=_0x3e4c3d[_0x0033('0x4a')]['length']?_0x3e4c3d[_0x0033('0x4a')]:_0x1be89c[_0x0033('0x48')];if(!_0x3c9ea5[_0x0033('0x44')]['hasOwnProperty'](_0x0033('0x4d'))){_0x3e4c3d[_0x0033('0x30')]=qs[_0x0033('0x30')](_0x3c9ea5['query'][_0x0033('0x30')]);_0x3e4c3d['offset']=qs[_0x0033('0x2e')](_0x3c9ea5[_0x0033('0x44')][_0x0033('0x2e')]);}_0x3e4c3d[_0x0033('0x4e')]=qs['sort'](_0x3c9ea5[_0x0033('0x44')][_0x0033('0x4f')]);_0x3e4c3d[_0x0033('0x50')]=qs['filters'](_[_0x0033('0x51')](_0x3c9ea5[_0x0033('0x44')],_0x1be89c['filters']));_0x3e4c3d[_0x0033('0x50')][_0x0033('0x66')]=_0x5e3975['id'];if(_0x3c9ea5[_0x0033('0x44')][_0x0033('0x55')]){_0x3e4c3d[_0x0033('0x50')]=_['merge'](_0x3e4c3d[_0x0033('0x50')],{'$or':_['map'](_0x3e4c3d[_0x0033('0x4a')],function(_0x37e496){var _0x141963={};_0x141963[_0x37e496]={'$like':'%'+_0x3c9ea5[_0x0033('0x44')][_0x0033('0x55')]+'%'};return _0x141963;})});}_0x3e4c3d=_[_0x0033('0x52')]({},_0x3e4c3d,_0x3c9ea5[_0x0033('0x56')]);return db[_0x0033('0x67')][_0x0033('0x31')]({'where':_0x3e4c3d[_0x0033('0x50')]})[_0x0033('0x1f')](function(_0x4e2730){_0x3792f[_0x0033('0x31')]=_0x4e2730;if(_0x3c9ea5[_0x0033('0x44')][_0x0033('0x5a')]){_0x3e4c3d[_0x0033('0x57')]=[{'all':!![]}];}return db[_0x0033('0x67')][_0x0033('0x58')](_0x3e4c3d);})['then'](function(_0x1fd177){_0x3792f[_0x0033('0x6a')]=_0x1fd177;return _0x3792f;});}})[_0x0033('0x1f')](respondWithFilteredResult(_0x5a4960,_0x3e4c3d))['catch'](handleError(_0x5a4960,null));};exports['removeDispositions']=function(_0x596147,_0x264d76,_0x1d31c3){return db['SmsAccount'][_0x0033('0x5b')]({'where':{'id':_0x596147[_0x0033('0x65')]['id']}})['then'](handleEntityNotFound(_0x264d76,null))[_0x0033('0x1f')](function(_0x4cbc27){if(_0x4cbc27){return _0x4cbc27[_0x0033('0x6b')](_0x596147['query'][_0x0033('0x6c')]);}})[_0x0033('0x1f')](respondWithStatusCode(_0x264d76,null))[_0x0033('0x2a')](handleError(_0x264d76,null));};exports['addAnswer']=function(_0x140886,_0x21d345,_0x20e8fe){if(_0x140886[_0x0033('0x63')]['id']){delete _0x140886[_0x0033('0x63')]['id'];}return db[_0x0033('0x3f')]['find']({'where':{'id':_0x140886[_0x0033('0x65')]['id']}})['then'](handleEntityNotFound(_0x21d345,null))[_0x0033('0x1f')](function(_0x3aa44f){if(_0x3aa44f){_0x140886[_0x0033('0x63')][_0x0033('0x66')]=_0x3aa44f['id'];return db[_0x0033('0x6d')]['create'](_0x140886['body']);}})[_0x0033('0x1f')](respondWithResult(_0x21d345,null))[_0x0033('0x2a')](handleError(_0x21d345,null));};exports[_0x0033('0x6e')]=function(_0x11e986,_0x1d03a7,_0x121a22){var _0x132b8e={'raw':![],'where':{}};var _0x552206={};var _0x82e06e={'count':0x0,'rows':[]};return db[_0x0033('0x3f')]['findOne']({'where':{'id':_0x11e986['params']['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x1d03a7,null))[_0x0033('0x1f')](function(_0x2b9eb7){if(_0x2b9eb7){_0x552206['model']=_[_0x0033('0x45')](db[_0x0033('0x6d')][_0x0033('0x40')]);_0x552206[_0x0033('0x44')]=_['keys'](_0x11e986['query']);_0x552206[_0x0033('0x46')]=_[_0x0033('0x47')](_0x552206['model'],_0x552206[_0x0033('0x44')]);_0x132b8e[_0x0033('0x4a')]=_['intersection'](_0x552206[_0x0033('0x48')],qs[_0x0033('0x49')](_0x11e986['query'][_0x0033('0x49')]));_0x132b8e[_0x0033('0x4a')]=_0x132b8e[_0x0033('0x4a')][_0x0033('0x4b')]?_0x132b8e[_0x0033('0x4a')]:_0x552206[_0x0033('0x48')];if(!_0x11e986['query'][_0x0033('0x4c')](_0x0033('0x4d'))){_0x132b8e['limit']=qs[_0x0033('0x30')](_0x11e986[_0x0033('0x44')]['limit']);_0x132b8e[_0x0033('0x2e')]=qs[_0x0033('0x2e')](_0x11e986['query'][_0x0033('0x2e')]);}_0x132b8e['order']=qs['sort'](_0x11e986[_0x0033('0x44')]['sort']);_0x132b8e['where']=qs['filters'](_[_0x0033('0x51')](_0x11e986[_0x0033('0x44')],_0x552206[_0x0033('0x46')]));_0x132b8e[_0x0033('0x50')]['SmsAccountId']=_0x2b9eb7['id'];if(_0x11e986[_0x0033('0x44')][_0x0033('0x55')]){_0x132b8e[_0x0033('0x50')]=_['merge'](_0x132b8e[_0x0033('0x50')],{'$or':_[_0x0033('0x3e')](_0x132b8e[_0x0033('0x4a')],function(_0x1c44d3){var _0x47e0d6={};_0x47e0d6[_0x1c44d3]={'$like':'%'+_0x11e986[_0x0033('0x44')][_0x0033('0x55')]+'%'};return _0x47e0d6;})});}_0x132b8e=_[_0x0033('0x52')]({},_0x132b8e,_0x11e986[_0x0033('0x56')]);return db[_0x0033('0x6d')]['count']({'where':_0x132b8e[_0x0033('0x50')]})[_0x0033('0x1f')](function(_0x355ae4){_0x82e06e[_0x0033('0x31')]=_0x355ae4;if(_0x11e986[_0x0033('0x44')]['includeAll']){_0x132b8e[_0x0033('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0033('0x58')](_0x132b8e);})[_0x0033('0x1f')](function(_0x1ff173){_0x82e06e[_0x0033('0x6a')]=_0x1ff173;return _0x82e06e;});}})['then'](respondWithFilteredResult(_0x1d03a7,_0x132b8e))[_0x0033('0x2a')](handleError(_0x1d03a7,null));};exports[_0x0033('0x6f')]=function(_0x453639,_0x406e49,_0x88aa97){return db[_0x0033('0x3f')][_0x0033('0x5b')]({'where':{'id':_0x453639[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x406e49,null))[_0x0033('0x1f')](function(_0x5c9c22){if(_0x5c9c22){return _0x5c9c22[_0x0033('0x6f')](_0x453639[_0x0033('0x44')][_0x0033('0x6c')]);}})[_0x0033('0x1f')](respondWithStatusCode(_0x406e49,null))[_0x0033('0x2a')](handleError(_0x406e49,null));};exports[_0x0033('0x70')]=function(_0x5abb0d,_0x3d0d21,_0x3da746){var _0x4b2a1b={'channel':'sms'};var _0x13f0e5=[];var _0x1bee6a=[];var _0x2ee266={};return db[_0x0033('0x3f')]['find']({'where':{'id':_0x5abb0d[_0x0033('0x65')]['id']},'include':[{'model':db[_0x0033('0x71')],'as':_0x0033('0x72')}]})[_0x0033('0x1f')](handleEntityNotFound(_0x3d0d21,null))['then'](function(_0x5d370d){_0x4b2a1b[_0x0033('0x73')]=_0x5d370d;_0x4b2a1b[_0x0033('0x74')]=_[_0x0033('0x75')](_0x5d370d['Applications'],[_0x0033('0x76')],['asc']);if(_0x4b2a1b[_0x0033('0x73')][_0x0033('0x72')]){delete _0x4b2a1b[_0x0033('0x73')][_0x0033('0x72')];}return db[_0x0033('0x77')][_0x0033('0x64')]();})[_0x0033('0x1f')](function(_0x4959f9){if(!_0x4959f9){throw new db[(_0x0033('0x78'))]['ValidationError'](_0x0033('0x79'));}_0x13f0e5=_[_0x0033('0x7a')](_[_0x0033('0x45')](_0x4959f9),[_0x0033('0x7b'),_0x0033('0x7c')]);_0x1bee6a=_[_0x0033('0x7a')](_[_0x0033('0x45')](_0x4959f9),['createdAt','updatedAt',_0x0033('0x7d'),_0x0033('0x7e')]);_0x4b2a1b[_0x0033('0x63')]={'mapKey':_0x0033('0x7f')};if(_0x4b2a1b[_0x0033('0x73')]['type']){switch(_0x4b2a1b['account'][_0x0033('0x53')]){case _0x0033('0x80'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')][_0x0033('0x82')];_0x4b2a1b['body'][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')]['Body'];_0x4b2a1b['body'][_0x0033('0x83')]=_0x5abb0d[_0x0033('0x63')][_0x0033('0x84')];break;case _0x0033('0x85'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]='+'+_0x5abb0d['body'][_0x0033('0x86')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')]['text'];break;case _0x0033('0x87'):_0x4b2a1b[_0x0033('0x63')]['from']=_0x5abb0d[_0x0033('0x63')]['from'];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d['body'][_0x0033('0x28')];break;case'clicksend':_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')]['from'];_0x4b2a1b['body'][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')]['body'];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x83')]=_0x5abb0d['body'][_0x0033('0x88')];break;case _0x0033('0x89'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')]['From'];_0x4b2a1b['body']['body']=_0x5abb0d[_0x0033('0x63')][_0x0033('0x8a')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x83')]=_0x5abb0d['body'][_0x0033('0x8b')];break;case _0x0033('0x8c'):_0x4b2a1b[_0x0033('0x63')]['from']='+'+_0x5abb0d[_0x0033('0x63')][_0x0033('0x8d')][0x0][_0x0033('0x81')];_0x4b2a1b['body']['body']=_0x5abb0d[_0x0033('0x63')][_0x0033('0x8d')][0x0][_0x0033('0x8e')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x83')]=_0x5abb0d['body'][_0x0033('0x8d')][0x0][_0x0033('0x83')];break;case _0x0033('0x8f'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')][_0x0033('0x90')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')][_0x0033('0x91')][_0x0033('0x28')];break;case _0x0033('0x92'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')][_0x0033('0x93')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')]['text'];_0x4b2a1b[_0x0033('0x63')]['messageId']=_0x5abb0d[_0x0033('0x63')][_0x0033('0x94')];break;case _0x0033('0x95'):_0x4b2a1b['body'][_0x0033('0x83')]=_0x5abb0d[_0x0033('0x63')][0x0][_0x0033('0x28')]['id'];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')][0x0][_0x0033('0x28')][_0x0033('0x81')];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')][0x0][_0x0033('0x28')]['text'];break;case _0x0033('0x96'):_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')]=_0x5abb0d[_0x0033('0x63')]['from'];_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]=_0x5abb0d[_0x0033('0x63')]['message'];_0x4b2a1b[_0x0033('0x63')]['messageId']=_0x5abb0d[_0x0033('0x63')][_0x0033('0x97')];break;}}if(_0x4b2a1b[_0x0033('0x63')]['id']){delete _0x4b2a1b[_0x0033('0x63')]['id'];}if(_['isNil'](_0x4b2a1b[_0x0033('0x63')]['from'])){throw new db['Sequelize']['ValidationError'](_0x0033('0x98'));}if(_[_0x0033('0x99')](_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')])||_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')]===''){throw new db[(_0x0033('0x78'))][(_0x0033('0x9a'))](_0x0033('0x9b'));}if(_[_0x0033('0x99')](_0x4b2a1b[_0x0033('0x63')][_0x0033('0x9c')])){throw new db['Sequelize'][(_0x0033('0x9a'))](_0x0033('0x9d')+_0x1bee6a);}if(!_[_0x0033('0x9e')](_0x1bee6a,_0x4b2a1b['body']['mapKey'])){throw new db[(_0x0033('0x78'))][(_0x0033('0x9a'))](_0x0033('0x9f')+_0x1bee6a);}_0x2ee266[_0x4b2a1b[_0x0033('0x63')][_0x0033('0x9c')]]=_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')];return db[_0x0033('0xa0')]['find']({'where':{'id':_0x4b2a1b[_0x0033('0x73')][_0x0033('0x7e')]},'include':[{'model':db['CmContact'],'as':_0x0033('0xa1'),'where':_0x2ee266,'limit':0x1,'order':[[_0x0033('0x7c'),'DESC']]}]});})[_0x0033('0x1f')](handleEntityNotFound(_0x3d0d21,null))[_0x0033('0x1f')](function(_0x568624){if(_0x568624){_0x4b2a1b[_0x0033('0xa2')]=_[_0x0033('0xa3')](_0x568624,['Contacts']);if(_0x568624[_0x0033('0xa1')][_0x0033('0x4b')]){return _0x568624[_0x0033('0xa1')][0x0];}var _0x211b51=_[_0x0033('0xa4')](_0x4b2a1b['body'],{'firstName':_0x4b2a1b['body'][_0x0033('0x81')],'ListId':_0x568624['id']});_0x211b51[_0x4b2a1b[_0x0033('0x63')]['mapKey']]=_0x4b2a1b['body'][_0x0033('0x81')];return db[_0x0033('0x77')]['create'](_0x211b51,{'fields':_0x13f0e5,'raw':!![]});}})[_0x0033('0x1f')](handleEntityNotFound(_0x3d0d21,null))[_0x0033('0x1f')](function(_0x5db745){if(_0x5db745){_0x4b2a1b['contact']=_0x5db745;var _0x52cc06={'ContactId':_0x5db745['id'],'phone':_0x4b2a1b[_0x0033('0x63')][_0x0033('0x81')],'SmsAccountId':_0x5abb0d['params']['id']};var _0x50a1e2={'ContactId':_0x5db745['id'],'SmsAccountId':_0x5abb0d['params']['id'],'closed':![]};return db[_0x0033('0xa5')][_0x0033('0x5b')]({'where':_0x50a1e2})['then'](function(_0x28c55b){if(_0x28c55b){return[_0x28c55b,![]];}return db[_0x0033('0xa5')][_0x0033('0x5c')](_0x52cc06)[_0x0033('0x1f')](function(_0x17775){return[_0x17775,!![]];});});}})[_0x0033('0xa6')](function(_0x410d5,_0x21858a){_0x4b2a1b[_0x0033('0xa7')]=_0x410d5[_0x0033('0x37')]({'plain':!![]});_0x4b2a1b[_0x0033('0xa7')][_0x0033('0xa8')]=![];if(_0x21858a){if(_0x4b2a1b[_0x0033('0x73')][_0x0033('0xa9')]){_0x4b2a1b[_0x0033('0x74')]['push']({'id':0x0,'priority':_0x4b2a1b[_0x0033('0x74')]['length']+0x1,'app':_0x0033('0xaa'),'appdata':_0x0033('0xab'),'interval':_0x0033('0xac')});}_0x4b2a1b[_0x0033('0xa7')][_0x0033('0xa8')]=!![];}return db[_0x0033('0xad')][_0x0033('0x5c')]({'phone':_0x4b2a1b['body'][_0x0033('0x81')],'messageId':_0x4b2a1b[_0x0033('0x63')][_0x0033('0x83')],'body':_0x4b2a1b[_0x0033('0x63')][_0x0033('0x63')],'SmsAccountId':_0x5abb0d['params']['id'],'SmsInteractionId':_0x410d5['id'],'direction':'in','ContactId':_0x410d5[_0x0033('0xae')],'AttachmentId':_0x4b2a1b[_0x0033('0x63')]['AttachmentId']});})[_0x0033('0x1f')](function(_0x506348){_0x4b2a1b['message']=_0x506348;if(!_0x4b2a1b['interaction'][_0x0033('0xaf')])return;return db[_0x0033('0xb0')]['find']({'attributes':['id',_0x0033('0x43')],'where':{'id':_0x4b2a1b[_0x0033('0xa7')][_0x0033('0xaf')]}});})[_0x0033('0x1f')](function(_0x429a55){if(_0x429a55){_0x4b2a1b['applications'][_0x0033('0xb1')]({'id':0x0,'priority':0x0,'app':_0x0033('0xb2'),'appdata':_0x429a55['name']+','+(_0x4b2a1b[_0x0033('0x73')][_0x0033('0xb3')]||0xa),'interval':_0x0033('0xac')});}if(!_0x4b2a1b['interaction'][_0x0033('0xb4')])return;return db[_0x0033('0xb5')][_0x0033('0x5b')]({'attributes':['id',_0x0033('0x43')],'where':{'id':_0x4b2a1b['interaction']['queueId']}});})[_0x0033('0x1f')](function(_0x5d4a95){if(_0x5d4a95){_0x4b2a1b[_0x0033('0x74')][_0x0033('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5d4a95[_0x0033('0x43')]+','+(_0x4b2a1b[_0x0033('0x73')][_0x0033('0xb6')]||0x12c),'interval':_0x0033('0xac')});}return respondWithRpcPromise(_0x0033('0xb7'),'startRouting',_0x4b2a1b);})['then'](function(_0x8619d){if(_0x8619d){var _0x4ea83c=0xc8;var _0x171851=_0x0033('0xb8');logger[_0x0033('0x20')](_0x0033('0x24'),_0x171851,_0x4ea83c,_0x0033('0xb9'));logger[_0x0033('0x23')](_0x0033('0xba'),_0x171851,_0x4ea83c,_0x0033('0xb9'),JSON[_0x0033('0x25')](_0x8619d));if(_0x4b2a1b[_0x0033('0x73')]['type']==='twilio'){return _0x3d0d21[_0x0033('0x2c')](_0x4ea83c)[_0x0033('0x32')](_0x0033('0xbb'),_0x0033('0xbc'))[_0x0033('0xbd')]('\x0a');}else{return _0x3d0d21[_0x0033('0x2c')](_0x4ea83c)[_0x0033('0x2d')](_0x8619d);}}})[_0x0033('0x2a')](handleError(_0x3d0d21,null));};exports[_0x0033('0xbe')]=function(_0x496801,_0x3c639a){var _0x3bafdf=_0x496801[_0x0033('0x65')]['id'];var _0xd8a7b1=_0x496801['body'];var _0x32ffc8=0xc8;var _0x377ee5=null;return db['sequelize'][_0x0033('0xbf')]({'isolationLevel':db[_0x0033('0xc0')][_0x0033('0xc1')][_0x0033('0xc2')][_0x0033('0xc3')]},function(_0x47b45c){return db['SmsAccount'][_0x0033('0x69')]({'where':{'id':_0x3bafdf},'transaction':_0x47b45c})[_0x0033('0x1f')](function(_0x440a76){if(_0x440a76){return db[_0x0033('0x71')][_0x0033('0x36')]({'where':{'SmsAccountId':_0x3bafdf},'transaction':_0x47b45c})[_0x0033('0x1f')](function(){var _0x4e14c4=_[_0x0033('0x3e')](_0xd8a7b1,function(_0x59f771){_0x59f771[_0x0033('0x66')]=_0x3bafdf;return _0x59f771;});return db['SmsApplication']['bulkCreate'](_0x4e14c4,{'transaction':_0x47b45c});});}else{_0x32ffc8=0x194;_0x377ee5=[];}});})[_0x0033('0x1f')](function(){if(_0x32ffc8!==0x194){return db[_0x0033('0x71')][_0x0033('0xc4')]({'where':{'SmsAccountId':_0x3bafdf},'order':_0x0033('0x76')})[_0x0033('0x1f')](function(_0x38db2c){_0x377ee5=_0x38db2c;});}})[_0x0033('0x2a')](function(_0x2caf82){_0x32ffc8=0x1f4;logger[_0x0033('0x26')](_0x2caf82[_0x0033('0x3a')]);if(_0x2caf82['name']){delete _0x2caf82[_0x0033('0x43')];}_0x377ee5=_0x2caf82;})[_0x0033('0xc5')](function(){if(_0x377ee5===null){_0x3c639a[_0x0033('0x2b')](_0x32ffc8);}else{if(_0x32ffc8===0x1f4){_0x3c639a[_0x0033('0x2c')](_0x32ffc8)['send'](_0x377ee5);}else{_0x3c639a[_0x0033('0x2c')](_0x32ffc8)[_0x0033('0x2d')](_0x377ee5);}}});};exports[_0x0033('0xc6')]=function(_0x515f17,_0x417c1d,_0x2f9326){var _0x57ee0c={};var _0x39a8f4={};var _0x647d0d;var _0x3d5aa6;return db[_0x0033('0x3f')]['findOne']({'where':{'id':_0x515f17[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x417c1d,null))['then'](function(_0x11ca64){if(_0x11ca64){_0x647d0d=_0x11ca64;_0x39a8f4[_0x0033('0x48')]=_['keys'](db[_0x0033('0x71')][_0x0033('0x40')]);_0x39a8f4['query']=_[_0x0033('0x45')](_0x515f17['query']);_0x39a8f4[_0x0033('0x46')]=_['intersection'](_0x39a8f4[_0x0033('0x48')],_0x39a8f4[_0x0033('0x44')]);_0x57ee0c[_0x0033('0x4a')]=_[_0x0033('0x47')](_0x39a8f4[_0x0033('0x48')],qs[_0x0033('0x49')](_0x515f17['query'][_0x0033('0x49')]));_0x57ee0c[_0x0033('0x4a')]=_0x57ee0c[_0x0033('0x4a')][_0x0033('0x4b')]?_0x57ee0c[_0x0033('0x4a')]:_0x39a8f4[_0x0033('0x48')];_0x57ee0c['order']=qs[_0x0033('0x4f')](_0x515f17[_0x0033('0x44')][_0x0033('0x4f')]);_0x57ee0c[_0x0033('0x50')]=qs[_0x0033('0x46')](_[_0x0033('0x51')](_0x515f17[_0x0033('0x44')],_0x39a8f4[_0x0033('0x46')]));if(_0x515f17[_0x0033('0x44')]['filter']){_0x57ee0c[_0x0033('0x50')]=_['merge'](_0x57ee0c[_0x0033('0x50')],{'$or':_[_0x0033('0x3e')](_0x57ee0c[_0x0033('0x4a')],function(_0x32fe85){var _0x36123a={};_0x36123a[_0x32fe85]={'$like':'%'+_0x515f17['query']['filter']+'%'};return _0x36123a;})});}_0x57ee0c=_[_0x0033('0x52')]({},_0x57ee0c,_0x515f17[_0x0033('0x56')]);return _0x647d0d[_0x0033('0xc6')](_0x57ee0c);}})['then'](function(_0x1dd317){if(_0x1dd317){_0x3d5aa6=_0x1dd317[_0x0033('0x4b')];if(!_0x515f17[_0x0033('0x44')][_0x0033('0x4c')](_0x0033('0x4d'))){_0x57ee0c[_0x0033('0x30')]=qs[_0x0033('0x30')](_0x515f17['query'][_0x0033('0x30')]);_0x57ee0c['offset']=qs[_0x0033('0x2e')](_0x515f17[_0x0033('0x44')][_0x0033('0x2e')]);}return _0x647d0d[_0x0033('0xc6')](_0x57ee0c);}})[_0x0033('0x1f')](function(_0x313a3e){if(_0x313a3e){return _0x313a3e?{'count':_0x3d5aa6,'rows':_0x313a3e}:null;}})[_0x0033('0x1f')](respondWithResult(_0x417c1d,null))['catch'](handleError(_0x417c1d,null));};exports['getInteractions']=function(_0x1df581,_0x290460,_0x1449f1){var _0x1370d4={'raw':![],'where':{}};var _0x257280={};var _0x4b3ef0={'count':0x0,'rows':[]};return db[_0x0033('0x3f')][_0x0033('0x69')]({'where':{'id':_0x1df581['params']['id']}})['then'](handleEntityNotFound(_0x290460,null))[_0x0033('0x1f')](function(_0x332b28){if(_0x332b28){_0x257280[_0x0033('0x48')]=_[_0x0033('0x45')](db['SmsInteraction'][_0x0033('0x40')]);_0x257280[_0x0033('0x44')]=_[_0x0033('0x45')](_0x1df581[_0x0033('0x44')]);_0x257280['filters']=_[_0x0033('0x47')](_0x257280[_0x0033('0x48')],_0x257280[_0x0033('0x44')]);_0x1370d4['attributes']=_['intersection'](_0x257280[_0x0033('0x48')],qs[_0x0033('0x49')](_0x1df581[_0x0033('0x44')][_0x0033('0x49')]));_0x1370d4[_0x0033('0x4a')]=_0x1370d4[_0x0033('0x4a')]['length']?_0x1370d4[_0x0033('0x4a')]:_0x257280['model'];if(!_0x1df581[_0x0033('0x44')]['hasOwnProperty'](_0x0033('0x4d'))){_0x1370d4['limit']=qs[_0x0033('0x30')](_0x1df581[_0x0033('0x44')][_0x0033('0x30')]);_0x1370d4[_0x0033('0x2e')]=qs[_0x0033('0x2e')](_0x1df581[_0x0033('0x44')][_0x0033('0x2e')]);}_0x1370d4[_0x0033('0x4e')]=qs[_0x0033('0x4f')](_0x1df581['query'][_0x0033('0x4f')]);_0x1370d4[_0x0033('0x50')]=qs[_0x0033('0x46')](_[_0x0033('0x51')](_0x1df581['query'],_0x257280[_0x0033('0x46')]));_0x1370d4[_0x0033('0x50')][_0x0033('0x66')]=_0x332b28['id'];if(_0x1df581[_0x0033('0x44')][_0x0033('0x55')]){_0x1370d4[_0x0033('0x50')]=_[_0x0033('0x52')](_0x1370d4['where'],{'$or':_[_0x0033('0x3e')](_0x1370d4[_0x0033('0x4a')],function(_0x2b06bb){var _0x3b025a={};_0x3b025a[_0x2b06bb]={'$like':'%'+_0x1df581[_0x0033('0x44')][_0x0033('0x55')]+'%'};return _0x3b025a;})});}_0x1370d4=_['merge']({},_0x1370d4,_0x1df581[_0x0033('0x56')]);return db[_0x0033('0xa5')][_0x0033('0x31')]({'where':_0x1370d4['where']})[_0x0033('0x1f')](function(_0x4006c7){_0x4b3ef0[_0x0033('0x31')]=_0x4006c7;if(_0x1df581['query'][_0x0033('0x5a')]){_0x1370d4[_0x0033('0x57')]=[{'model':db[_0x0033('0x77')],'as':_0x0033('0xc7'),'required':![]},{'model':db[_0x0033('0xb0')],'as':_0x0033('0xc8'),'attributes':[_0x0033('0x43'),_0x0033('0xc9'),'internal'],'required':![]},{'model':db[_0x0033('0xca')],'as':_0x0033('0xcb'),'attributes':['id',_0x0033('0x43'),_0x0033('0xcc')],'where':_0x1df581[_0x0033('0x44')][_0x0033('0xcd')]?{'id':_0x1df581[_0x0033('0x44')]['tag']}:undefined,'required':_0x1df581['query'][_0x0033('0xcd')]?!![]:![]}];}return db['SmsInteraction'][_0x0033('0x58')](_0x1370d4);})[_0x0033('0x1f')](function(_0x1eea5b){_0x4b3ef0['rows']=_0x1eea5b;return _0x4b3ef0;});}})[_0x0033('0x1f')](respondWithFilteredResult(_0x290460,_0x1370d4))[_0x0033('0x2a')](handleError(_0x290460,null));};exports[_0x0033('0xbd')]=function(_0x57bc27,_0x2eb02f,_0x366377){var _0x8109f1,_0x1f287c,_0x38816e;if(_[_0x0033('0x99')](_0x57bc27[_0x0033('0x63')]['body'])||_0x57bc27['body'][_0x0033('0x63')]===''){throw new db[(_0x0033('0x78'))][(_0x0033('0x9a'))](_0x0033('0x9b'));}if(_[_0x0033('0x99')](_0x57bc27[_0x0033('0x63')]['to'])){throw new db['Sequelize'][(_0x0033('0x9a'))](_0x0033('0xce'));}_0x8109f1=_0x57bc27[_0x0033('0x63')]['to'];return db[_0x0033('0x3f')][_0x0033('0x5b')]({'where':{'id':_0x57bc27['params']['id']},'include':[{'model':db['CmList'],'as':_0x0033('0xcf'),'include':[{'model':db[_0x0033('0x77')],'as':_0x0033('0xa1'),'where':{'mobile':_0x8109f1},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0033('0x1f')](handleEntityNotFound(_0x2eb02f,null))[_0x0033('0x1f')](function(_0x7f5e59){if(_0x7f5e59&&_0x7f5e59[_0x0033('0xcf')]){_0x1f287c=_0x7f5e59[_0x0033('0x37')]({'plain':!![]});if(_0x1f287c[_0x0033('0xcf')]&&_0x1f287c[_0x0033('0xcf')][_0x0033('0xa1')][_0x0033('0x4b')]){return _0x1f287c[_0x0033('0xcf')][_0x0033('0xa1')][0x0];}return db[_0x0033('0x77')]['create'](_['defaults'](_0x57bc27[_0x0033('0x63')],{'firstName':_0x8109f1,'mobile':_0x8109f1,'phone':_0x8109f1,'ListId':_0x1f287c[_0x0033('0x7e')]}));}})[_0x0033('0x1f')](handleEntityNotFound(_0x2eb02f,null))['then'](function(_0x33be51){if(_0x33be51){_0x38816e=_0x33be51;return db[_0x0033('0xa5')][_0x0033('0x5b')]({'where':{'ContactId':_0x38816e['id'],'closed':![],'SmsAccountId':_0x1f287c['id']}})['then'](function(_0x429ebf){if(_0x429ebf){return[_0x429ebf,![]];}return db[_0x0033('0xa5')][_0x0033('0x5c')]({'UserId':_0x57bc27[_0x0033('0x5d')]['id'],'ContactId':_0x38816e['id'],'SmsAccountId':_0x1f287c['id'],'phone':_0x8109f1,'firstMsgDirection':_0x0033('0xd0'),'Messages':[_[_0x0033('0x52')](_0x57bc27[_0x0033('0x63')],{'read':![],'body':_0x57bc27[_0x0033('0x63')][_0x0033('0x63')],'phone':_0x8109f1,'SmsAccountId':_0x1f287c['id'],'UserId':_0x57bc27[_0x0033('0x5d')]['id'],'ContactId':_0x38816e['id']})]},{'include':[{'model':db[_0x0033('0xad')],'as':_0x0033('0xd1')}]})[_0x0033('0x1f')](function(_0x224d28){return[_0x224d28,!![]];});});}})[_0x0033('0xa6')](function(_0xa633fd,_0x3568c7){if(_0x3568c7){return _0xa633fd;}return db[_0x0033('0xad')][_0x0033('0x5c')](_[_0x0033('0x52')](_0x57bc27[_0x0033('0x63')],{'read':![],'body':_0x57bc27[_0x0033('0x63')][_0x0033('0x63')],'phone':_0x8109f1,'SmsAccountId':_0x1f287c['id'],'SmsInteractionId':_0xa633fd['id'],'UserId':_0x57bc27[_0x0033('0x5d')]['id'],'ContactId':_0x38816e['id']}))[_0x0033('0x1f')](function(_0x28f679){_0xa633fd[_0x0033('0xd2')]['Messages']=[];_0xa633fd[_0x0033('0xd2')][_0x0033('0xd1')][_0x0033('0xd3')](_0x28f679['dataValues']);return _0xa633fd;});})[_0x0033('0x1f')](respondWithResult(_0x2eb02f,null))[_0x0033('0x2a')](handleError(_0x2eb02f,null));};exports['status']=function(_0x25273b,_0x5527fa,_0xdc6169){if(_0x25273b['body']['id']){delete _0x25273b[_0x0033('0x63')]['id'];}var _0x3ed5ce,_0x1ccc8d,_0x5159c3;return db[_0x0033('0x3f')][_0x0033('0x5b')]({'where':{'id':_0x25273b['params']['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x5527fa,null))['then'](function(_0x485362){if(_0x485362){_0x5159c3=_0x485362;logger['debug'](_0x0033('0x24'),_0x0033('0x2c'),_0x0033('0xd4'),_0x485362[_0x0033('0x53')],util[_0x0033('0xd5')](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));switch(_0x485362[_0x0033('0x53')]){case _0x0033('0x85'):if(_0x25273b[_0x0033('0x63')][_0x0033('0xd6')]&&_0x25273b['body'][_0x0033('0x2c')]){_0x1ccc8d=_0x25273b['body']['status'];return db[_0x0033('0xad')]['find']({'where':{'messageId':_0x25273b['body']['skebby_dispatch_id']}});}break;case _0x0033('0x87'):if(_0x25273b[_0x0033('0x63')]['requestid']&&_0x25273b[_0x0033('0x63')]['statusInt']){_0x1ccc8d=_0x25273b[_0x0033('0x63')]['statusInt'];return db[_0x0033('0xad')]['find']({'where':{'messageId':_0x25273b['body'][_0x0033('0xd7')]}});}break;case'clicksend':if(_0x25273b[_0x0033('0x63')]['message_id']&&_0x25273b['body'][_0x0033('0xd8')]){_0x1ccc8d=_0x25273b[_0x0033('0x63')][_0x0033('0xd8')];return db['SmsMessage'][_0x0033('0x5b')]({'where':{'messageId':_0x25273b[_0x0033('0x63')][_0x0033('0x88')]}});}break;case _0x0033('0x8c'):var _0x4a832e=_0x25273b[_0x0033('0x63')][_0x0033('0x8d')][0x0];if(_0x4a832e[_0x0033('0x83')]&&_0x4a832e['status'][_0x0033('0xd9')]===_0x0033('0xda')){_0x1ccc8d=_0x4a832e[_0x0033('0x2c')][_0x0033('0xd9')];return db[_0x0033('0xad')][_0x0033('0x5b')]({'where':{'messageId':_0x4a832e['messageId']}});}break;case _0x0033('0x92'):if(_0x25273b[_0x0033('0x63')][_0x0033('0x83')]&&_0x25273b['body'][_0x0033('0x2c')]){_0x1ccc8d=_0x25273b[_0x0033('0x63')][_0x0033('0x2c')];return db['SmsMessage'][_0x0033('0x5b')]({'where':{'messageId':_0x25273b[_0x0033('0x63')]['messageId']}});}break;case _0x0033('0x95'):if(_0x25273b['body'][0x0][_0x0033('0x28')]['id']){_0x1ccc8d=_0x25273b[_0x0033('0x63')][0x0]['type'];return db[_0x0033('0xad')][_0x0033('0x5b')]({'where':{'messageId':_0x25273b['body'][0x0][_0x0033('0x28')]['id']}});}break;case _0x0033('0x96'):if(_0x25273b[_0x0033('0x63')][_0x0033('0xdb')]&&_0x25273b[_0x0033('0x63')][_0x0033('0x2c')]){_0x1ccc8d=_0x25273b[_0x0033('0x63')][_0x0033('0x2c')];return db['SmsMessage'][_0x0033('0x5b')]({'where':{'messageId':_0x25273b[_0x0033('0x63')][_0x0033('0xdb')]}});}break;}}})[_0x0033('0x1f')](handleEntityNotFound(_0x5527fa,null))['then'](function(_0x19a91b){if(_0x19a91b){_0x3ed5ce=_0x19a91b;switch(_0x5159c3[_0x0033('0x53')]){case _0x0033('0x85'):if(_0x1ccc8d===_0x0033('0xda')){return _0x3ed5ce[_0x0033('0x35')]({'read':!![]});}else{logger[_0x0033('0x26')](_0x0033('0x24'),_0x0033('0x2c'),_0x0033('0x85'),util['inspect'](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0x87'):if(_0x1ccc8d==='1'){return _0x3ed5ce['update']({'read':!![]});}else{logger[_0x0033('0x26')](_0x0033('0x24'),_0x0033('0x2c'),_0x0033('0x85'),util[_0x0033('0xd5')](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0xdc'):if(!_0x25273b['body']['error_code']&&_0x1ccc8d>=0xc8&&_0x1ccc8d<=0xce){return _0x3ed5ce['update']({'read':!![]});}else{logger[_0x0033('0x26')](_0x0033('0x24'),'status',_0x0033('0xdc'),util['inspect'](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0x8c'):var _0x10620a=_0x25273b[_0x0033('0x63')][_0x0033('0x8d')][0x0];if(_0x10620a[_0x0033('0x2c')]['groupName']==='DELIVERED'){return _0x3ed5ce[_0x0033('0x35')]({'read':!![]});}else{logger[_0x0033('0x26')](_0x0033('0x24'),'status',_0x0033('0x8c'),util['inspect'](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0x92'):if(_0x1ccc8d==_0x0033('0xdd')||_0x1ccc8d==_0x0033('0xde')){return _0x3ed5ce['update']({'read':!![]});}else{logger['error'](_0x0033('0x24'),'status','clickatell',util[_0x0033('0xd5')](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0x95'):if(_0x1ccc8d==_0x0033('0xdf')){return _0x3ed5ce[_0x0033('0x35')]({'read':!![]});}else{logger[_0x0033('0x26')](_0x0033('0x24'),'status',_0x0033('0x95'),util[_0x0033('0xd5')](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0033('0x96'):if(_0x1ccc8d===_0x0033('0xe0')||_0x1ccc8d==='ACCEPTD'){return _0x3ed5ce['update']({'read':!![]});}else{logger[_0x0033('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0033('0x96'),util[_0x0033('0xd5')](_0x25273b[_0x0033('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x3ed5ce;}})[_0x0033('0x1f')](respondWithResult(_0x5527fa,null))[_0x0033('0x2a')](handleError(_0x5527fa,null));};exports['statusGet']=function(_0xe4d6b9,_0x5694ad,_0x273d0c){var _0x45ef7c,_0xec0ae8,_0x557577;return db[_0x0033('0x3f')]['find']({'where':{'id':_0xe4d6b9[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x5694ad,null))[_0x0033('0x1f')](function(_0x200a16){if(_0x200a16){_0x557577=_0x200a16;logger[_0x0033('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0033('0x2c'),_0x0033('0xd4'),_0x200a16[_0x0033('0x53')],util[_0x0033('0xd5')](_0xe4d6b9[_0x0033('0x44')],{'showHidden':![],'depth':null}));switch(_0x200a16['type']){case _0x0033('0x8f'):if(_0xe4d6b9[_0x0033('0x44')][_0x0033('0xe1')]&&_0xe4d6b9[_0x0033('0x44')][_0x0033('0xe2')]){_0xec0ae8=_0xe4d6b9[_0x0033('0x44')][_0x0033('0xe2')];return db[_0x0033('0xad')][_0x0033('0x5b')]({'where':{'messageId':_0xe4d6b9[_0x0033('0x44')][_0x0033('0xe1')]}});}break;}}})[_0x0033('0x1f')](handleEntityNotFound(_0x5694ad,null))[_0x0033('0x1f')](function(_0x10371d){if(_0x10371d){_0x45ef7c=_0x10371d;switch(_0x557577[_0x0033('0x53')]){case'csc':if(_0xec0ae8==='2'||_0xec0ae8==='6'){return _0x45ef7c[_0x0033('0x35')]({'read':!![]});}else{logger['error'](_0x0033('0x24'),_0x0033('0x2c'),_0x0033('0x8f'),util[_0x0033('0xd5')](_0xe4d6b9[_0x0033('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x45ef7c;}})[_0x0033('0x1f')](respondWithResult(_0x5694ad,null))[_0x0033('0x2a')](handleError(_0x5694ad,null));};exports['addAgents']=function(_0x3eb3d5,_0x497683,_0x54ba82){return db[_0x0033('0x3f')]['find']({'where':{'id':_0x3eb3d5[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x497683,null))['then'](function(_0x5a1527){if(_0x5a1527){return _0x5a1527[_0x0033('0xe3')](_0x3eb3d5['body'][_0x0033('0x6c')],_['omit'](_0x3eb3d5[_0x0033('0x63')],[_0x0033('0x6c'),'id'])||{})[_0x0033('0xa6')](function(_0x3d83d7){for(var _0x983283=0x0;_0x983283<_0x3eb3d5['body'][_0x0033('0x6c')]['length'];_0x983283+=0x1){socket[_0x0033('0xe4')](_0x0033('0xe5'),{'UserId':Number(_0x3eb3d5[_0x0033('0x63')]['ids'][_0x983283]),'SmsAccountId':Number(_0x3eb3d5[_0x0033('0x65')]['id'])});}return _0x3d83d7;});}})[_0x0033('0x1f')](respondWithResult(_0x497683,null))[_0x0033('0x2a')](handleError(_0x497683,null));};exports[_0x0033('0xe6')]=function(_0x49a4d6,_0x4bae0,_0x1069df){return db[_0x0033('0x3f')][_0x0033('0x5b')]({'where':{'id':_0x49a4d6['params']['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x4bae0,null))[_0x0033('0x1f')](function(_0x2942a9){if(_0x2942a9){return _0x2942a9[_0x0033('0xe6')](_0x49a4d6[_0x0033('0x44')][_0x0033('0x6c')])[_0x0033('0x1f')](function(){if(_['isArray'](_0x49a4d6[_0x0033('0x44')][_0x0033('0x6c')])){for(var _0xce23e=0x0;_0xce23e<_0x49a4d6['query'][_0x0033('0x6c')]['length'];_0xce23e+=0x1){socket[_0x0033('0xe4')](_0x0033('0xe7'),{'UserId':Number(_0x49a4d6[_0x0033('0x44')][_0x0033('0x6c')][_0xce23e]),'SmsAccountId':Number(_0x49a4d6[_0x0033('0x65')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x49a4d6['query'][_0x0033('0x6c')]),'SmsAccountId':Number(_0x49a4d6[_0x0033('0x65')]['id'])});}});}})[_0x0033('0x1f')](respondWithStatusCode(_0x4bae0,null))['catch'](handleError(_0x4bae0,null));};exports['getAgents']=function(_0x5aa1d0,_0x520464,_0x1d6255){var _0x2a306d={};var _0xc0e0e4={};var _0x47c3e5;var _0x40000c;return db[_0x0033('0x3f')][_0x0033('0x69')]({'where':{'id':_0x5aa1d0[_0x0033('0x65')]['id']}})[_0x0033('0x1f')](handleEntityNotFound(_0x520464,null))['then'](function(_0x10a139){if(_0x10a139){_0x47c3e5=_0x10a139;_0xc0e0e4[_0x0033('0x48')]=_[_0x0033('0x45')](db[_0x0033('0xb0')][_0x0033('0x40')]);_0xc0e0e4[_0x0033('0x44')]=_[_0x0033('0x45')](_0x5aa1d0[_0x0033('0x44')]);_0xc0e0e4['filters']=_['intersection'](_0xc0e0e4['model'],_0xc0e0e4[_0x0033('0x44')]);_0x2a306d[_0x0033('0x4a')]=_['intersection'](_0xc0e0e4[_0x0033('0x48')],qs[_0x0033('0x49')](_0x5aa1d0[_0x0033('0x44')][_0x0033('0x49')]));_0x2a306d['attributes']=_0x2a306d[_0x0033('0x4a')]['length']?_0x2a306d[_0x0033('0x4a')]:_0xc0e0e4['model'];_0x2a306d[_0x0033('0x4e')]=qs[_0x0033('0x4f')](_0x5aa1d0['query'][_0x0033('0x4f')]);_0x2a306d[_0x0033('0x50')]=qs['filters'](_[_0x0033('0x51')](_0x5aa1d0['query'],_0xc0e0e4[_0x0033('0x46')]));if(_0x5aa1d0[_0x0033('0x44')][_0x0033('0x55')]){_0x2a306d[_0x0033('0x50')]=_[_0x0033('0x52')](_0x2a306d[_0x0033('0x50')],{'$or':_[_0x0033('0x3e')](_0x2a306d['attributes'],function(_0x4f969a){var _0x1d252f={};_0x1d252f[_0x4f969a]={'$like':'%'+_0x5aa1d0[_0x0033('0x44')][_0x0033('0x55')]+'%'};return _0x1d252f;})});}_0x2a306d=_[_0x0033('0x52')]({},_0x2a306d,_0x5aa1d0[_0x0033('0x56')]);return _0x47c3e5[_0x0033('0xe8')](_0x2a306d);}})[_0x0033('0x1f')](function(_0x5f235f){if(_0x5f235f){_0x40000c=_0x5f235f[_0x0033('0x4b')];if(!_0x5aa1d0[_0x0033('0x44')][_0x0033('0x4c')](_0x0033('0x4d'))){_0x2a306d[_0x0033('0x30')]=qs[_0x0033('0x30')](_0x5aa1d0[_0x0033('0x44')][_0x0033('0x30')]);_0x2a306d[_0x0033('0x2e')]=qs['offset'](_0x5aa1d0[_0x0033('0x44')][_0x0033('0x2e')]);}return _0x47c3e5['getAgents'](_0x2a306d);}})[_0x0033('0x1f')](function(_0x227a4c){if(_0x227a4c){return _0x227a4c?{'count':_0x40000c,'rows':_0x227a4c}:null;}})[_0x0033('0x1f')](respondWithResult(_0x520464,null))['catch'](handleError(_0x520464,null));}; \ No newline at end of file +var _0x1d03=['removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','from','sender','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','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','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','SmsQueue','queueId','waitForTheAssignedQueue','receiveMessage','entity\x20found','send','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','push','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby','requestid','statusInt','status_code','DELIVERED','clickatell','bandwidth','redif','update','connectel','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1d03,0x166));var _0x31d0=function(_0x1b0e94,_0x522b67){_0x1b0e94=_0x1b0e94-0x0;var _0x180971=_0x1d03[_0x1b0e94];return _0x180971;};'use strict';var emlformat=require(_0x31d0('0x0'));var rimraf=require(_0x31d0('0x1'));var zipdir=require(_0x31d0('0x2'));var jsonpatch=require(_0x31d0('0x3'));var rp=require(_0x31d0('0x4'));var moment=require(_0x31d0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31d0('0x6'));var util=require(_0x31d0('0x7'));var path=require(_0x31d0('0x8'));var sox=require(_0x31d0('0x9'));var csv=require('to-csv');var ejs=require(_0x31d0('0xa'));var fs=require('fs');var fs_extra=require(_0x31d0('0xb'));var _=require(_0x31d0('0xc'));var squel=require(_0x31d0('0xd'));var crypto=require(_0x31d0('0xe'));var jsforce=require(_0x31d0('0xf'));var deskjs=require(_0x31d0('0x10'));var toCsv=require(_0x31d0('0x11'));var querystring=require('querystring');var Papa=require(_0x31d0('0x12'));var Redis=require(_0x31d0('0x13'));var authService=require(_0x31d0('0x14'));var qs=require(_0x31d0('0x15'));var as=require(_0x31d0('0x16'));var hardwareService=require(_0x31d0('0x17'));var logger=require(_0x31d0('0x18'))(_0x31d0('0x19'));var utils=require(_0x31d0('0x1a'));var config=require(_0x31d0('0x1b'));var licenseUtil=require(_0x31d0('0x1c'));var db=require('../../mysqldb')['db'];config[_0x31d0('0x1d')]=_['defaults'](config[_0x31d0('0x1d')],{'host':_0x31d0('0x1e'),'port':0x18eb});var socket=require(_0x31d0('0x1f'))(new Redis(config[_0x31d0('0x1d')]));require(_0x31d0('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x31d0('0x21')][_0x31d0('0x22')]({'port':0x232c});function respondWithRpcPromise(_0xa55c23,_0x569f31,_0x26361c,_0x3fae25){return new BPromise(function(_0x5c373c,_0x30db48){var _0x4cc938=_0x3fae25||client;return _0x4cc938[_0x31d0('0x23')](_0xa55c23,_0x26361c)[_0x31d0('0x24')](function(_0x4b2304){logger[_0x31d0('0x25')](_0x31d0('0x26'),_0x569f31,_0x31d0('0x27'));logger[_0x31d0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x569f31,_0x31d0('0x27'),JSON['stringify'](_0x4b2304));if(_0x4b2304[_0x31d0('0x29')]){if(_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2a')]===0x1f4){logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2b')]);return _0x30db48(_0x4b2304['error'][_0x31d0('0x2b')]);}logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4b2304[_0x31d0('0x29')]['message']);return _0x5c373c(_0x4b2304[_0x31d0('0x29')][_0x31d0('0x2b')]);}else{logger[_0x31d0('0x25')]('SmsAccount,\x20%s,\x20%s',_0x569f31,_0x31d0('0x27'));_0x5c373c(_0x4b2304[_0x31d0('0x2c')]['message']);}})[_0x31d0('0x2d')](function(_0x4f19bd){logger[_0x31d0('0x29')](_0x31d0('0x26'),_0x569f31,_0x4f19bd);_0x30db48(_0x4f19bd);});});}function respondWithStatusCode(_0x144e9b,_0x8c6cea){_0x8c6cea=_0x8c6cea||0xcc;return function(_0x5d0b1c){if(_0x5d0b1c){return _0x144e9b[_0x31d0('0x2e')](_0x8c6cea);}return _0x144e9b['status'](_0x8c6cea)[_0x31d0('0x2f')]();};}function respondWithResult(_0x4c08ce,_0x5c3e85){_0x5c3e85=_0x5c3e85||0xc8;return function(_0x2769e1){if(_0x2769e1){return _0x4c08ce[_0x31d0('0x30')](_0x5c3e85)[_0x31d0('0x31')](_0x2769e1);}};}function respondWithFilteredResult(_0x3c9bda,_0xcd96e6){return function(_0x589f50){if(_0x589f50){var _0x4e97e5=typeof _0xcd96e6[_0x31d0('0x32')]===_0x31d0('0x33')&&typeof _0xcd96e6[_0x31d0('0x34')]===_0x31d0('0x33');var _0x376027=_0x589f50[_0x31d0('0x35')];var _0x5bda42=_0x4e97e5?0x0:_0xcd96e6['offset'];var _0x375311=_0x4e97e5?_0x589f50[_0x31d0('0x35')]:_0xcd96e6[_0x31d0('0x32')]+_0xcd96e6[_0x31d0('0x34')];var _0x483503;if(_0x375311>=_0x376027){_0x375311=_0x376027;_0x483503=0xc8;}else{_0x483503=0xce;}_0x3c9bda[_0x31d0('0x30')](_0x483503);return _0x3c9bda[_0x31d0('0x36')](_0x31d0('0x37'),_0x5bda42+'-'+_0x375311+'/'+_0x376027)[_0x31d0('0x31')](_0x589f50);}return null;};}function patchUpdates(_0x1cf2c3){return function(_0x3ace78){try{jsonpatch['apply'](_0x3ace78,_0x1cf2c3,!![]);}catch(_0x41f331){return BPromise[_0x31d0('0x38')](_0x41f331);}return _0x3ace78[_0x31d0('0x39')]();};}function saveUpdates(_0x64194e,_0x2a2da4){return function(_0x1d25d2){if(_0x1d25d2){return _0x1d25d2['update'](_0x64194e)[_0x31d0('0x24')](function(_0x20e4a6){return _0x20e4a6;});}return null;};}function removeEntity(_0x19104a,_0x2deeed){return function(_0x18b993){if(_0x18b993){return _0x18b993[_0x31d0('0x3a')]()[_0x31d0('0x24')](function(){var _0x11921f=_0x18b993[_0x31d0('0x3b')]({'plain':!![]});var _0x2a5c4a=_0x31d0('0x3c');return db[_0x31d0('0x3d')][_0x31d0('0x3a')]({'where':{'type':_0x2a5c4a,'resourceId':_0x11921f['id']}})[_0x31d0('0x24')](function(){return _0x18b993;});})[_0x31d0('0x24')](function(){_0x19104a[_0x31d0('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bec9f,_0x51a210){return function(_0xe7498f){if(!_0xe7498f){_0x1bec9f['sendStatus'](0x194);}return _0xe7498f;};}function handleError(_0x32e95a,_0x2ed5f3){_0x2ed5f3=_0x2ed5f3||0x1f4;return function(_0x37ff0f){logger[_0x31d0('0x29')](_0x37ff0f['stack']);if(_0x37ff0f[_0x31d0('0x3e')]){delete _0x37ff0f['name'];}_0x32e95a['status'](_0x2ed5f3)['send'](_0x37ff0f);};}exports[_0x31d0('0x3f')]=function(_0x4cfd21,_0x4c845e){var _0xac608={'include':[{'model':db[_0x31d0('0x40')],'as':_0x31d0('0x41')}]},_0x172fb6={},_0x1f1c64={'count':0x0,'rows':[]};var _0x29486f=_[_0x31d0('0x42')](db[_0x31d0('0x43')][_0x31d0('0x44')],function(_0x53c40f){return{'name':_0x53c40f['fieldName'],'type':_0x53c40f['type'][_0x31d0('0x45')]};});_0x172fb6[_0x31d0('0x46')]=_[_0x31d0('0x42')](_0x29486f,_0x31d0('0x3e'));_0x172fb6[_0x31d0('0x47')]=_['keys'](_0x4cfd21[_0x31d0('0x47')]);_0x172fb6[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x172fb6['model'],_0x172fb6[_0x31d0('0x47')]);_0xac608[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x172fb6['model'],qs[_0x31d0('0x4b')](_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x4b')]));_0xac608[_0x31d0('0x4a')]=_0xac608[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0xac608[_0x31d0('0x4a')]:_0x172fb6[_0x31d0('0x46')];if(!_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0xac608[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0x4cfd21['query'][_0x31d0('0x34')]);_0xac608['offset']=qs[_0x31d0('0x32')](_0x4cfd21[_0x31d0('0x47')]['offset']);}_0xac608[_0x31d0('0x4f')]=qs['sort'](_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x50')]);_0xac608['where']=qs['filters'](_[_0x31d0('0x51')](_0x4cfd21[_0x31d0('0x47')],_0x172fb6['filters']),_0x29486f);if(_0x4cfd21['query'][_0x31d0('0x52')]){_0xac608['where']=_[_0x31d0('0x53')](_0xac608[_0x31d0('0x54')],{'$or':_['map'](_0x29486f,function(_0x2f2c96){if(_0x2f2c96[_0x31d0('0x55')]!==_0x31d0('0x56')){var _0x2f22ba={};_0x2f22ba[_0x2f2c96['name']]={'$like':'%'+_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x2f22ba;}})});}_0xac608=_[_0x31d0('0x53')]({},_0xac608,_0x4cfd21[_0x31d0('0x57')]);var _0x35cab6={'where':_0xac608[_0x31d0('0x54')]};return db['SmsAccount'][_0x31d0('0x35')](_0x35cab6)[_0x31d0('0x24')](function(_0x3970f2){_0x1f1c64[_0x31d0('0x35')]=_0x3970f2;if(_0x4cfd21[_0x31d0('0x47')][_0x31d0('0x58')]){_0xac608[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x43')]['findAll'](_0xac608);})[_0x31d0('0x24')](function(_0x12a142){_0x1f1c64[_0x31d0('0x5a')]=_0x12a142;return _0x1f1c64;})[_0x31d0('0x24')](respondWithFilteredResult(_0x4c845e,_0xac608))[_0x31d0('0x2d')](handleError(_0x4c845e,null));};exports[_0x31d0('0x5b')]=function(_0x585027,_0x18d314){var _0x5a15f8={'raw':![],'where':{'id':_0x585027[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0x40')],'as':_0x31d0('0x41')}]},_0x49e827={};_0x49e827[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x43')][_0x31d0('0x44')]);_0x49e827[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x585027[_0x31d0('0x47')]);_0x49e827[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x49e827[_0x31d0('0x46')],_0x49e827[_0x31d0('0x47')]);_0x5a15f8[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x49e827['model'],qs['fields'](_0x585027[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x5a15f8[_0x31d0('0x4a')]=_0x5a15f8[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0x5a15f8[_0x31d0('0x4a')]:_0x49e827[_0x31d0('0x46')];if(_0x585027[_0x31d0('0x47')]['includeAll']){_0x5a15f8[_0x31d0('0x59')]=[{'all':!![]}];}_0x5a15f8=_[_0x31d0('0x53')]({},_0x5a15f8,_0x585027[_0x31d0('0x57')]);return db[_0x31d0('0x43')][_0x31d0('0x5e')](_0x5a15f8)[_0x31d0('0x24')](handleEntityNotFound(_0x18d314,null))[_0x31d0('0x24')](respondWithResult(_0x18d314,null))[_0x31d0('0x2d')](handleError(_0x18d314,null));};exports[_0x31d0('0x5f')]=function(_0x344065,_0x214f39){return db[_0x31d0('0x43')]['create'](_0x344065[_0x31d0('0x60')],{})[_0x31d0('0x24')](function(_0x3f616a){var _0xcb07c6=_0x344065[_0x31d0('0x61')][_0x31d0('0x3b')]({'plain':!![]});if(!_0xcb07c6)throw new Error(_0x31d0('0x62'));if(_0xcb07c6[_0x31d0('0x63')]===_0x31d0('0x61')){var _0x51504c=_0x3f616a[_0x31d0('0x3b')]({'plain':!![]});var _0x406188='SmsAccounts';return db[_0x31d0('0x64')][_0x31d0('0x5e')]({'where':{'name':_0x406188,'userProfileId':_0xcb07c6[_0x31d0('0x65')]},'raw':!![]})[_0x31d0('0x24')](function(_0x20c971){if(_0x20c971&&_0x20c971[_0x31d0('0x66')]===0x0){return db[_0x31d0('0x3d')][_0x31d0('0x5f')]({'name':_0x51504c['name'],'resourceId':_0x51504c['id'],'type':_0x20c971['name'],'sectionId':_0x20c971['id']},{})[_0x31d0('0x24')](function(){return _0x3f616a;});}else{return _0x3f616a;}})[_0x31d0('0x2d')](function(_0x2e9029){logger[_0x31d0('0x29')](_0x31d0('0x67'),_0x2e9029);throw _0x2e9029;});}return _0x3f616a;})['then'](respondWithResult(_0x214f39,0xc9))[_0x31d0('0x2d')](handleError(_0x214f39,null));};exports['update']=function(_0x3edb93,_0x242eb7){if(_0x3edb93['body']['id']){delete _0x3edb93[_0x31d0('0x60')]['id'];}return db['SmsAccount'][_0x31d0('0x5e')]({'where':{'id':_0x3edb93['params']['id']},'include':[{'model':db[_0x31d0('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x242eb7,null))['then'](saveUpdates(_0x3edb93[_0x31d0('0x60')],null))['then'](respondWithResult(_0x242eb7,null))['catch'](handleError(_0x242eb7,null));};exports[_0x31d0('0x3a')]=function(_0x19d2e5,_0x1cff54){return db[_0x31d0('0x43')]['find']({'where':{'id':_0x19d2e5[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1cff54,null))['then'](removeEntity(_0x1cff54,null))[_0x31d0('0x2d')](handleError(_0x1cff54,null));};exports['describe']=function(_0x470910,_0x45b18f){return db[_0x31d0('0x43')][_0x31d0('0x68')]()[_0x31d0('0x24')](respondWithResult(_0x45b18f,null))[_0x31d0('0x2d')](handleError(_0x45b18f,null));};exports[_0x31d0('0x69')]=function(_0x4cad45,_0x4a9134,_0x135881){if(_0x4cad45['body']['id']){delete _0x4cad45[_0x31d0('0x60')]['id'];}return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x4cad45[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a9134,null))[_0x31d0('0x24')](function(_0x1afaaf){if(_0x1afaaf){_0x4cad45[_0x31d0('0x60')]['SmsAccountId']=_0x1afaaf['id'];return db['Disposition'][_0x31d0('0x5f')](_0x4cad45[_0x31d0('0x60')]);}})[_0x31d0('0x24')](respondWithResult(_0x4a9134,null))[_0x31d0('0x2d')](handleError(_0x4a9134,null));};exports[_0x31d0('0x6a')]=function(_0x1b6ff3,_0x26ca9c,_0x4c5c52){var _0x2b7172={'raw':![],'where':{}};var _0x63ccdd={};var _0x56f9cf={'count':0x0,'rows':[]};return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x1b6ff3[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x26ca9c,null))[_0x31d0('0x24')](function(_0x2b7a48){if(_0x2b7a48){_0x63ccdd[_0x31d0('0x46')]=_[_0x31d0('0x5d')](db[_0x31d0('0x6c')]['rawAttributes']);_0x63ccdd[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x1b6ff3[_0x31d0('0x47')]);_0x63ccdd[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x63ccdd['model'],_0x63ccdd[_0x31d0('0x47')]);_0x2b7172[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x63ccdd[_0x31d0('0x46')],qs['fields'](_0x1b6ff3[_0x31d0('0x47')]['fields']));_0x2b7172[_0x31d0('0x4a')]=_0x2b7172[_0x31d0('0x4a')]['length']?_0x2b7172[_0x31d0('0x4a')]:_0x63ccdd[_0x31d0('0x46')];if(!_0x1b6ff3[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x2b7172[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0x1b6ff3['query']['limit']);_0x2b7172['offset']=qs['offset'](_0x1b6ff3[_0x31d0('0x47')][_0x31d0('0x32')]);}_0x2b7172['order']=qs[_0x31d0('0x50')](_0x1b6ff3[_0x31d0('0x47')]['sort']);_0x2b7172[_0x31d0('0x54')]=qs['filters'](_[_0x31d0('0x51')](_0x1b6ff3[_0x31d0('0x47')],_0x63ccdd['filters']));_0x2b7172['where'][_0x31d0('0x6d')]=_0x2b7a48['id'];if(_0x1b6ff3['query'][_0x31d0('0x52')]){_0x2b7172['where']=_[_0x31d0('0x53')](_0x2b7172[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x2b7172[_0x31d0('0x4a')],function(_0x36ea06){var _0x51a495={};_0x51a495[_0x36ea06]={'$like':'%'+_0x1b6ff3['query'][_0x31d0('0x52')]+'%'};return _0x51a495;})});}_0x2b7172=_[_0x31d0('0x53')]({},_0x2b7172,_0x1b6ff3['options']);return db[_0x31d0('0x6c')][_0x31d0('0x35')]({'where':_0x2b7172[_0x31d0('0x54')]})[_0x31d0('0x24')](function(_0x11fd47){_0x56f9cf[_0x31d0('0x35')]=_0x11fd47;if(_0x1b6ff3[_0x31d0('0x47')]['includeAll']){_0x2b7172[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x6c')]['findAll'](_0x2b7172);})[_0x31d0('0x24')](function(_0x4fadd6){_0x56f9cf[_0x31d0('0x5a')]=_0x4fadd6;return _0x56f9cf;});}})[_0x31d0('0x24')](respondWithFilteredResult(_0x26ca9c,_0x2b7172))['catch'](handleError(_0x26ca9c,null));};exports['removeDispositions']=function(_0x3d8234,_0x34591f,_0x25c25c){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x3d8234[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x34591f,null))[_0x31d0('0x24')](function(_0x5e1933){if(_0x5e1933){return _0x5e1933[_0x31d0('0x6e')](_0x3d8234['query'][_0x31d0('0x6f')]);}})[_0x31d0('0x24')](respondWithStatusCode(_0x34591f,null))[_0x31d0('0x2d')](handleError(_0x34591f,null));};exports[_0x31d0('0x70')]=function(_0x59cb02,_0x463059,_0x5e1063){if(_0x59cb02['body']['id']){delete _0x59cb02[_0x31d0('0x60')]['id'];}return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x59cb02[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x463059,null))[_0x31d0('0x24')](function(_0x255ba1){if(_0x255ba1){_0x59cb02[_0x31d0('0x60')]['SmsAccountId']=_0x255ba1['id'];return db[_0x31d0('0x71')][_0x31d0('0x5f')](_0x59cb02[_0x31d0('0x60')]);}})['then'](respondWithResult(_0x463059,null))['catch'](handleError(_0x463059,null));};exports[_0x31d0('0x72')]=function(_0xa690cb,_0x4f03e4,_0x35e450){var _0x4ea13d={'raw':![],'where':{}};var _0x2f785e={};var _0x2c7fe1={'count':0x0,'rows':[]};return db[_0x31d0('0x43')]['findOne']({'where':{'id':_0xa690cb[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x4f03e4,null))[_0x31d0('0x24')](function(_0x5c1dc3){if(_0x5c1dc3){_0x2f785e[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x71')][_0x31d0('0x44')]);_0x2f785e[_0x31d0('0x47')]=_['keys'](_0xa690cb[_0x31d0('0x47')]);_0x2f785e[_0x31d0('0x48')]=_['intersection'](_0x2f785e[_0x31d0('0x46')],_0x2f785e['query']);_0x4ea13d[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x2f785e[_0x31d0('0x46')],qs[_0x31d0('0x4b')](_0xa690cb[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x4ea13d[_0x31d0('0x4a')]=_0x4ea13d[_0x31d0('0x4a')]['length']?_0x4ea13d[_0x31d0('0x4a')]:_0x2f785e['model'];if(!_0xa690cb[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x4ea13d[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0xa690cb[_0x31d0('0x47')][_0x31d0('0x34')]);_0x4ea13d[_0x31d0('0x32')]=qs['offset'](_0xa690cb['query'][_0x31d0('0x32')]);}_0x4ea13d[_0x31d0('0x4f')]=qs[_0x31d0('0x50')](_0xa690cb['query'][_0x31d0('0x50')]);_0x4ea13d[_0x31d0('0x54')]=qs['filters'](_['pick'](_0xa690cb['query'],_0x2f785e['filters']));_0x4ea13d[_0x31d0('0x54')][_0x31d0('0x6d')]=_0x5c1dc3['id'];if(_0xa690cb[_0x31d0('0x47')]['filter']){_0x4ea13d['where']=_[_0x31d0('0x53')](_0x4ea13d[_0x31d0('0x54')],{'$or':_['map'](_0x4ea13d['attributes'],function(_0x12ad50){var _0x599e45={};_0x599e45[_0x12ad50]={'$like':'%'+_0xa690cb[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x599e45;})});}_0x4ea13d=_[_0x31d0('0x53')]({},_0x4ea13d,_0xa690cb[_0x31d0('0x57')]);return db[_0x31d0('0x71')]['count']({'where':_0x4ea13d[_0x31d0('0x54')]})['then'](function(_0x10840f){_0x2c7fe1['count']=_0x10840f;if(_0xa690cb['query']['includeAll']){_0x4ea13d[_0x31d0('0x59')]=[{'all':!![]}];}return db[_0x31d0('0x71')][_0x31d0('0x73')](_0x4ea13d);})[_0x31d0('0x24')](function(_0x1abeaf){_0x2c7fe1[_0x31d0('0x5a')]=_0x1abeaf;return _0x2c7fe1;});}})['then'](respondWithFilteredResult(_0x4f03e4,_0x4ea13d))[_0x31d0('0x2d')](handleError(_0x4f03e4,null));};exports[_0x31d0('0x74')]=function(_0x383a9a,_0x25d659,_0x477a30){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x383a9a[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x25d659,null))['then'](function(_0x2a4be8){if(_0x2a4be8){return _0x2a4be8[_0x31d0('0x74')](_0x383a9a[_0x31d0('0x47')]['ids']);}})[_0x31d0('0x24')](respondWithStatusCode(_0x25d659,null))[_0x31d0('0x2d')](handleError(_0x25d659,null));};exports[_0x31d0('0x75')]=function(_0x2bbf11,_0x5e333e,_0x472471){var _0x1f91a7={'channel':_0x31d0('0x76')};var _0x1f27b4=[];var _0xbfa71c=[];var _0x425d49={};return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x2bbf11[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0x77')],'as':_0x31d0('0x78')}]})[_0x31d0('0x24')](handleEntityNotFound(_0x5e333e,null))[_0x31d0('0x24')](function(_0x21f686){_0x1f91a7[_0x31d0('0x79')]=_0x21f686;_0x1f91a7[_0x31d0('0x7a')]=_[_0x31d0('0x7b')](_0x21f686['Applications'],['priority'],[_0x31d0('0x7c')]);if(_0x1f91a7[_0x31d0('0x79')]['Applications']){delete _0x1f91a7['account'][_0x31d0('0x78')];}return db[_0x31d0('0x7d')][_0x31d0('0x68')]();})[_0x31d0('0x24')](function(_0x298a3c){if(!_0x298a3c){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))]('no\x20available\x20attributes');}_0x1f27b4=_[_0x31d0('0x80')](_[_0x31d0('0x5d')](_0x298a3c),['createdAt',_0x31d0('0x81')]);_0xbfa71c=_[_0x31d0('0x80')](_[_0x31d0('0x5d')](_0x298a3c),[_0x31d0('0x82'),_0x31d0('0x81'),_0x31d0('0x83'),_0x31d0('0x84')]);_0x1f91a7[_0x31d0('0x60')]={'mapKey':_0x31d0('0x85')};if(_0x1f91a7['account'][_0x31d0('0x55')]){switch(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0x55')]){case _0x31d0('0x86'):_0x1f91a7[_0x31d0('0x60')]['from']=_0x2bbf11[_0x31d0('0x60')]['From'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11['body'][_0x31d0('0x87')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x89')];break;case'skebby':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]='+'+_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8b')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')]['text'];break;case'connectel':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')]['from'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11['body'][_0x31d0('0x2b')];break;case _0x31d0('0x8c'):_0x1f91a7['body']['from']=_0x2bbf11['body'][_0x31d0('0x8a')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')]['body'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8d')];break;case _0x31d0('0x8e'):_0x1f91a7[_0x31d0('0x60')]['from']=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8f')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x90')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11['body'][_0x31d0('0x91')];break;case _0x31d0('0x92'):_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]='+'+_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x93')][0x0][_0x31d0('0x8a')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x93')][0x0][_0x31d0('0x94')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11['body'][_0x31d0('0x93')][0x0]['messageId'];break;case'csc':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x95')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x96')][_0x31d0('0x2b')];break;case'clickatell':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x97')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x94')];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x98')];break;case'bandwidth':_0x1f91a7[_0x31d0('0x60')]['messageId']=_0x2bbf11[_0x31d0('0x60')][0x0]['message']['id'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][0x0][_0x31d0('0x2b')][_0x31d0('0x8a')];_0x1f91a7['body'][_0x31d0('0x60')]=_0x2bbf11[_0x31d0('0x60')][0x0][_0x31d0('0x2b')][_0x31d0('0x94')];break;case _0x31d0('0x99'):_0x1f91a7['body'][_0x31d0('0x8a')]=_0x2bbf11[_0x31d0('0x60')][_0x31d0('0x8a')];_0x1f91a7[_0x31d0('0x60')]['body']=_0x2bbf11[_0x31d0('0x60')]['message'];_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')]=_0x2bbf11[_0x31d0('0x60')]['refid'];break;}}if(_0x1f91a7[_0x31d0('0x60')]['id']){delete _0x1f91a7[_0x31d0('0x60')]['id'];}if(_['isNil'](_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')])){throw new db['Sequelize'][(_0x31d0('0x7f'))](_0x31d0('0x9a'));}if(_[_0x31d0('0x9b')](_0x1f91a7[_0x31d0('0x60')]['body'])||_0x1f91a7['body'][_0x31d0('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x31d0('0x9c'));}if(_[_0x31d0('0x9b')](_0x1f91a7['body'][_0x31d0('0x9d')])){throw new db[(_0x31d0('0x7e'))]['ValidationError'](_0x31d0('0x9e')+_0xbfa71c);}if(!_['includes'](_0xbfa71c,_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x9d')])){throw new db[(_0x31d0('0x7e'))]['ValidationError'](_0x31d0('0x9f')+_0xbfa71c);}_0x425d49[_0x1f91a7['body'][_0x31d0('0x9d')]]=_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')];return db[_0x31d0('0xa0')][_0x31d0('0x5e')]({'where':{'id':_0x1f91a7[_0x31d0('0x79')][_0x31d0('0x84')]},'include':[{'model':db['CmContact'],'as':_0x31d0('0xa1'),'where':_0x425d49,'limit':0x1,'order':[[_0x31d0('0x81'),_0x31d0('0xa2')]]}]});})[_0x31d0('0x24')](handleEntityNotFound(_0x5e333e,null))['then'](function(_0x374dff){if(_0x374dff){_0x1f91a7[_0x31d0('0xa3')]=_[_0x31d0('0xa4')](_0x374dff,[_0x31d0('0xa1')]);if(_0x374dff[_0x31d0('0xa1')][_0x31d0('0x4c')]){return _0x374dff[_0x31d0('0xa1')][0x0];}var _0x4775da=_[_0x31d0('0xa5')](_0x1f91a7[_0x31d0('0x60')],{'firstName':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')],'ListId':_0x374dff['id']});_0x4775da[_0x1f91a7['body'][_0x31d0('0x9d')]]=_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')];return db['CmContact']['create'](_0x4775da,{'fields':_0x1f27b4,'raw':!![]});}})['then'](handleEntityNotFound(_0x5e333e,null))[_0x31d0('0x24')](function(_0x216ea0){if(_0x216ea0){_0x1f91a7[_0x31d0('0xa6')]=_0x216ea0;var _0x5cc2cd={'ContactId':_0x216ea0['id'],'phone':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x8a')],'SmsAccountId':_0x2bbf11[_0x31d0('0x5c')]['id']};var _0x35966d={'ContactId':_0x216ea0['id'],'SmsAccountId':_0x2bbf11['params']['id'],'closed':![]};return db[_0x31d0('0xa7')][_0x31d0('0x5e')]({'where':_0x35966d})[_0x31d0('0x24')](function(_0x3a6f57){if(_0x3a6f57){return[_0x3a6f57,![]];}return db[_0x31d0('0xa7')][_0x31d0('0x5f')](_0x5cc2cd)[_0x31d0('0x24')](function(_0x43513d){return[_0x43513d,!![]];});});}})[_0x31d0('0xa8')](function(_0x1d422b,_0x33266a){_0x1f91a7[_0x31d0('0xa9')]=_0x1d422b[_0x31d0('0x3b')]({'plain':!![]});_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xaa')]=![];if(_0x33266a){if(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0xab')]){_0x1f91a7['applications']['push']({'id':0x0,'priority':_0x1f91a7['applications']['length']+0x1,'app':'close','appdata':_0x31d0('0xac'),'interval':_0x31d0('0xad')});}_0x1f91a7['interaction'][_0x31d0('0xaa')]=!![];}return db[_0x31d0('0xae')]['create']({'phone':_0x1f91a7[_0x31d0('0x60')]['from'],'messageId':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x88')],'body':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0x60')],'SmsAccountId':_0x2bbf11[_0x31d0('0x5c')]['id'],'SmsInteractionId':_0x1d422b['id'],'direction':'in','ContactId':_0x1d422b[_0x31d0('0xaf')],'AttachmentId':_0x1f91a7[_0x31d0('0x60')][_0x31d0('0xb0')]});})[_0x31d0('0x24')](function(_0x2c2bd6){_0x1f91a7[_0x31d0('0x2b')]=_0x2c2bd6;if(!_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xb1')])return;return db['User'][_0x31d0('0x5e')]({'attributes':['id',_0x31d0('0x3e')],'where':{'id':_0x1f91a7['interaction'][_0x31d0('0xb1')]}});})[_0x31d0('0x24')](function(_0x463a4b){if(_0x463a4b){_0x1f91a7[_0x31d0('0x7a')][_0x31d0('0xb2')]({'id':0x0,'priority':0x0,'app':_0x31d0('0xb3'),'appdata':_0x463a4b[_0x31d0('0x3e')]+','+(_0x1f91a7[_0x31d0('0x79')]['waitForTheAssignedAgent']||0xa),'interval':_0x31d0('0xad')});}if(!_0x1f91a7[_0x31d0('0xa9')]['queueId'])return;return db[_0x31d0('0xb4')][_0x31d0('0x5e')]({'attributes':['id',_0x31d0('0x3e')],'where':{'id':_0x1f91a7[_0x31d0('0xa9')][_0x31d0('0xb5')]}});})['then'](function(_0x7a383b){if(_0x7a383b){_0x1f91a7[_0x31d0('0x7a')][_0x31d0('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x7a383b[_0x31d0('0x3e')]+','+(_0x1f91a7[_0x31d0('0x79')][_0x31d0('0xb6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x1f91a7);})[_0x31d0('0x24')](function(_0x382de8){if(_0x382de8){var _0x4a943c=0xc8;var _0x26324d=_0x31d0('0xb7');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x26324d,_0x4a943c,'entity\x20found');logger[_0x31d0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26324d,_0x4a943c,_0x31d0('0xb8'),JSON['stringify'](_0x382de8));if(_0x1f91a7[_0x31d0('0x79')]['type']===_0x31d0('0x86')){return _0x5e333e[_0x31d0('0x30')](_0x4a943c)[_0x31d0('0x36')]('Content-Type','text/xml')[_0x31d0('0xb9')]('\x0a');}else{return _0x5e333e[_0x31d0('0x30')](_0x4a943c)['json'](_0x382de8);}}})[_0x31d0('0x2d')](handleError(_0x5e333e,null));};exports[_0x31d0('0xba')]=function(_0x3130ca,_0x5788de){var _0x5431fc=_0x3130ca[_0x31d0('0x5c')]['id'];var _0x56046a=_0x3130ca[_0x31d0('0x60')];var _0x33231b=0xc8;var _0x390e23=null;return db['sequelize'][_0x31d0('0xbb')]({'isolationLevel':db['sequelize'][_0x31d0('0xbc')][_0x31d0('0xbd')][_0x31d0('0xbe')]},function(_0x24a62f){return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x5431fc},'transaction':_0x24a62f})[_0x31d0('0x24')](function(_0x2a8c2f){if(_0x2a8c2f){return db['SmsApplication'][_0x31d0('0x3a')]({'where':{'SmsAccountId':_0x5431fc},'transaction':_0x24a62f})['then'](function(){var _0x19794f=_[_0x31d0('0x42')](_0x56046a,function(_0x470eea){_0x470eea['SmsAccountId']=_0x5431fc;return _0x470eea;});return db[_0x31d0('0x77')][_0x31d0('0xbf')](_0x19794f,{'transaction':_0x24a62f});});}else{_0x33231b=0x194;_0x390e23=[];}});})[_0x31d0('0x24')](function(){if(_0x33231b!==0x194){return db[_0x31d0('0x77')]['findAndCountAll']({'where':{'SmsAccountId':_0x5431fc},'order':'priority'})[_0x31d0('0x24')](function(_0x10bcea){_0x390e23=_0x10bcea;});}})[_0x31d0('0x2d')](function(_0x1b725c){_0x33231b=0x1f4;logger[_0x31d0('0x29')](_0x1b725c[_0x31d0('0xc0')]);if(_0x1b725c[_0x31d0('0x3e')]){delete _0x1b725c['name'];}_0x390e23=_0x1b725c;})[_0x31d0('0xc1')](function(){if(_0x390e23===null){_0x5788de[_0x31d0('0x2e')](_0x33231b);}else{if(_0x33231b===0x1f4){_0x5788de[_0x31d0('0x30')](_0x33231b)['send'](_0x390e23);}else{_0x5788de[_0x31d0('0x30')](_0x33231b)[_0x31d0('0x31')](_0x390e23);}}});};exports[_0x31d0('0xc2')]=function(_0xab9d89,_0x141524,_0x53fd47){var _0x19bf22={};var _0x213e52={};var _0xb157f2;var _0xc79ded;return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0xab9d89[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x141524,null))[_0x31d0('0x24')](function(_0x4403b4){if(_0x4403b4){_0xb157f2=_0x4403b4;_0x213e52[_0x31d0('0x46')]=_['keys'](db[_0x31d0('0x77')][_0x31d0('0x44')]);_0x213e52[_0x31d0('0x47')]=_['keys'](_0xab9d89[_0x31d0('0x47')]);_0x213e52[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x213e52[_0x31d0('0x46')],_0x213e52[_0x31d0('0x47')]);_0x19bf22['attributes']=_[_0x31d0('0x49')](_0x213e52[_0x31d0('0x46')],qs[_0x31d0('0x4b')](_0xab9d89[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x19bf22[_0x31d0('0x4a')]=_0x19bf22[_0x31d0('0x4a')][_0x31d0('0x4c')]?_0x19bf22[_0x31d0('0x4a')]:_0x213e52[_0x31d0('0x46')];_0x19bf22[_0x31d0('0x4f')]=qs['sort'](_0xab9d89[_0x31d0('0x47')][_0x31d0('0x50')]);_0x19bf22[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_[_0x31d0('0x51')](_0xab9d89[_0x31d0('0x47')],_0x213e52['filters']));if(_0xab9d89['query'][_0x31d0('0x52')]){_0x19bf22[_0x31d0('0x54')]=_[_0x31d0('0x53')](_0x19bf22[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x19bf22[_0x31d0('0x4a')],function(_0x1bc1e9){var _0x305467={};_0x305467[_0x1bc1e9]={'$like':'%'+_0xab9d89['query']['filter']+'%'};return _0x305467;})});}_0x19bf22=_['merge']({},_0x19bf22,_0xab9d89['options']);return _0xb157f2[_0x31d0('0xc2')](_0x19bf22);}})[_0x31d0('0x24')](function(_0x48f489){if(_0x48f489){_0xc79ded=_0x48f489['length'];if(!_0xab9d89[_0x31d0('0x47')]['hasOwnProperty'](_0x31d0('0x4e'))){_0x19bf22[_0x31d0('0x34')]=qs[_0x31d0('0x34')](_0xab9d89[_0x31d0('0x47')]['limit']);_0x19bf22[_0x31d0('0x32')]=qs['offset'](_0xab9d89['query'][_0x31d0('0x32')]);}return _0xb157f2[_0x31d0('0xc2')](_0x19bf22);}})[_0x31d0('0x24')](function(_0xc6601e){if(_0xc6601e){return _0xc6601e?{'count':_0xc79ded,'rows':_0xc6601e}:null;}})[_0x31d0('0x24')](respondWithResult(_0x141524,null))[_0x31d0('0x2d')](handleError(_0x141524,null));};exports[_0x31d0('0xc3')]=function(_0x5dd66a,_0x4d9f54,_0x48e37c){var _0x1a350e={'raw':![],'where':{}};var _0x46d9a3={};var _0x14cd36={'count':0x0,'rows':[]};return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x5dd66a[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x4d9f54,null))['then'](function(_0x1ced2){if(_0x1ced2){_0x46d9a3[_0x31d0('0x46')]=_[_0x31d0('0x5d')](db[_0x31d0('0xa7')][_0x31d0('0x44')]);_0x46d9a3['query']=_[_0x31d0('0x5d')](_0x5dd66a[_0x31d0('0x47')]);_0x46d9a3[_0x31d0('0x48')]=_['intersection'](_0x46d9a3[_0x31d0('0x46')],_0x46d9a3['query']);_0x1a350e[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x46d9a3[_0x31d0('0x46')],qs['fields'](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x1a350e[_0x31d0('0x4a')]=_0x1a350e['attributes'][_0x31d0('0x4c')]?_0x1a350e[_0x31d0('0x4a')]:_0x46d9a3[_0x31d0('0x46')];if(!_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x4d')]('nolimit')){_0x1a350e['limit']=qs[_0x31d0('0x34')](_0x5dd66a['query'][_0x31d0('0x34')]);_0x1a350e[_0x31d0('0x32')]=qs[_0x31d0('0x32')](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x32')]);}_0x1a350e[_0x31d0('0x4f')]=qs['sort'](_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x50')]);_0x1a350e[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_[_0x31d0('0x51')](_0x5dd66a['query'],_0x46d9a3[_0x31d0('0x48')]));_0x1a350e[_0x31d0('0x54')]['SmsAccountId']=_0x1ced2['id'];if(_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x52')]){_0x1a350e[_0x31d0('0x54')]=_['merge'](_0x1a350e[_0x31d0('0x54')],{'$or':_['map'](_0x1a350e[_0x31d0('0x4a')],function(_0x3873a9){var _0x5b568d={};_0x5b568d[_0x3873a9]={'$like':'%'+_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x5b568d;})});}_0x1a350e=_['merge']({},_0x1a350e,_0x5dd66a['options']);return db[_0x31d0('0xa7')][_0x31d0('0x35')]({'where':_0x1a350e[_0x31d0('0x54')]})['then'](function(_0x300f5c){_0x14cd36[_0x31d0('0x35')]=_0x300f5c;if(_0x5dd66a[_0x31d0('0x47')][_0x31d0('0x58')]){_0x1a350e[_0x31d0('0x59')]=[{'model':db[_0x31d0('0x7d')],'as':_0x31d0('0xc4'),'required':![]},{'model':db['User'],'as':_0x31d0('0xc5'),'attributes':[_0x31d0('0x3e'),_0x31d0('0xc6'),_0x31d0('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x31d0('0xc8'),'attributes':['id',_0x31d0('0x3e'),_0x31d0('0xc9')],'where':_0x5dd66a[_0x31d0('0x47')]['tag']?{'id':_0x5dd66a['query'][_0x31d0('0xca')]}:undefined,'required':_0x5dd66a[_0x31d0('0x47')][_0x31d0('0xca')]?!![]:![]}];}return db[_0x31d0('0xa7')][_0x31d0('0x73')](_0x1a350e);})[_0x31d0('0x24')](function(_0x4ab0a1){_0x14cd36[_0x31d0('0x5a')]=_0x4ab0a1;return _0x14cd36;});}})[_0x31d0('0x24')](respondWithFilteredResult(_0x4d9f54,_0x1a350e))[_0x31d0('0x2d')](handleError(_0x4d9f54,null));};exports[_0x31d0('0xb9')]=function(_0x17bcdf,_0x33830a,_0x13de35){var _0x13142b,_0xd8c3b6,_0x888d81;if(_[_0x31d0('0x9b')](_0x17bcdf['body'][_0x31d0('0x60')])||_0x17bcdf[_0x31d0('0x60')]['body']===''){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))](_0x31d0('0x9c'));}if(_[_0x31d0('0x9b')](_0x17bcdf[_0x31d0('0x60')]['to'])){throw new db[(_0x31d0('0x7e'))][(_0x31d0('0x7f'))](_0x31d0('0xcb'));}_0x13142b=_0x17bcdf[_0x31d0('0x60')]['to'];return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x17bcdf[_0x31d0('0x5c')]['id']},'include':[{'model':db[_0x31d0('0xa0')],'as':'List','include':[{'model':db[_0x31d0('0x7d')],'as':_0x31d0('0xa1'),'where':{'mobile':_0x13142b},'limit':0x1,'order':[[_0x31d0('0x81'),_0x31d0('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x33830a,null))[_0x31d0('0x24')](function(_0x3c8818){if(_0x3c8818&&_0x3c8818[_0x31d0('0xcc')]){_0xd8c3b6=_0x3c8818[_0x31d0('0x3b')]({'plain':!![]});if(_0xd8c3b6[_0x31d0('0xcc')]&&_0xd8c3b6['List'][_0x31d0('0xa1')]['length']){return _0xd8c3b6[_0x31d0('0xcc')][_0x31d0('0xa1')][0x0];}return db[_0x31d0('0x7d')][_0x31d0('0x5f')](_[_0x31d0('0xa5')](_0x17bcdf['body'],{'firstName':_0x13142b,'mobile':_0x13142b,'phone':_0x13142b,'ListId':_0xd8c3b6[_0x31d0('0x84')]}));}})[_0x31d0('0x24')](handleEntityNotFound(_0x33830a,null))[_0x31d0('0x24')](function(_0x2394aa){if(_0x2394aa){_0x888d81=_0x2394aa;return db[_0x31d0('0xa7')]['find']({'where':{'ContactId':_0x888d81['id'],'closed':![],'SmsAccountId':_0xd8c3b6['id']}})['then'](function(_0x114e82){if(_0x114e82){return[_0x114e82,![]];}return db[_0x31d0('0xa7')][_0x31d0('0x5f')]({'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id'],'SmsAccountId':_0xd8c3b6['id'],'phone':_0x13142b,'firstMsgDirection':_0x31d0('0xcd'),'Messages':[_[_0x31d0('0x53')](_0x17bcdf[_0x31d0('0x60')],{'read':![],'body':_0x17bcdf['body'][_0x31d0('0x60')],'phone':_0x13142b,'SmsAccountId':_0xd8c3b6['id'],'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id']})]},{'include':[{'model':db[_0x31d0('0xae')],'as':'Messages'}]})[_0x31d0('0x24')](function(_0x76343d){return[_0x76343d,!![]];});});}})[_0x31d0('0xa8')](function(_0x2a6988,_0x53b79d){if(_0x53b79d){return _0x2a6988;}return db[_0x31d0('0xae')]['create'](_[_0x31d0('0x53')](_0x17bcdf[_0x31d0('0x60')],{'read':![],'body':_0x17bcdf['body'][_0x31d0('0x60')],'phone':_0x13142b,'SmsAccountId':_0xd8c3b6['id'],'SmsInteractionId':_0x2a6988['id'],'UserId':_0x17bcdf[_0x31d0('0x61')]['id'],'ContactId':_0x888d81['id']}))[_0x31d0('0x24')](function(_0x30c15a){_0x2a6988['dataValues']['Messages']=[];_0x2a6988[_0x31d0('0xce')][_0x31d0('0xcf')][_0x31d0('0xd0')](_0x30c15a[_0x31d0('0xce')]);return _0x2a6988;});})[_0x31d0('0x24')](respondWithResult(_0x33830a,null))[_0x31d0('0x2d')](handleError(_0x33830a,null));};exports['status']=function(_0x26b34d,_0x164b22,_0x2e3943){if(_0x26b34d[_0x31d0('0x60')]['id']){delete _0x26b34d['body']['id'];}var _0x5c62c6,_0x3ec816,_0x76b5db;return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x26b34d[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x164b22,null))[_0x31d0('0x24')](function(_0x21ef7c){if(_0x21ef7c){_0x76b5db=_0x21ef7c;logger[_0x31d0('0x28')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd2'),_0x21ef7c[_0x31d0('0x55')],util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));switch(_0x21ef7c[_0x31d0('0x55')]){case _0x31d0('0xd4'):if(_0x26b34d[_0x31d0('0x60')]['skebby_dispatch_id']&&_0x26b34d['body'][_0x31d0('0x30')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['status'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd5')]&&_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd6')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['statusInt'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')]['requestid']}});}break;case'clicksend':if(_0x26b34d['body'][_0x31d0('0x8d')]&&_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd7')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')][_0x31d0('0xd7')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0x8d')]}});}break;case _0x31d0('0x92'):var _0x47a8b3=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x93')][0x0];if(_0x47a8b3[_0x31d0('0x88')]&&_0x47a8b3[_0x31d0('0x30')]['groupName']===_0x31d0('0xd8')){_0x3ec816=_0x47a8b3[_0x31d0('0x30')]['groupName'];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x47a8b3[_0x31d0('0x88')]}});}break;case _0x31d0('0xd9'):if(_0x26b34d[_0x31d0('0x60')][_0x31d0('0x88')]&&_0x26b34d['body']['status']){_0x3ec816=_0x26b34d[_0x31d0('0x60')]['status'];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0x88')]}});}break;case _0x31d0('0xda'):if(_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x2b')]['id']){_0x3ec816=_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x55')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][0x0][_0x31d0('0x2b')]['id']}});}break;case _0x31d0('0x99'):if(_0x26b34d['body'][_0x31d0('0xdb')]&&_0x26b34d['body'][_0x31d0('0x30')]){_0x3ec816=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x30')];return db[_0x31d0('0xae')]['find']({'where':{'messageId':_0x26b34d[_0x31d0('0x60')][_0x31d0('0xdb')]}});}break;}}})[_0x31d0('0x24')](handleEntityNotFound(_0x164b22,null))['then'](function(_0x16e185){if(_0x16e185){_0x5c62c6=_0x16e185;switch(_0x76b5db[_0x31d0('0x55')]){case _0x31d0('0xd4'):if(_0x3ec816===_0x31d0('0xd8')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),'skebby',util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x31d0('0xdd'):if(_0x3ec816==='1'){return _0x5c62c6['update']({'read':!![]});}else{logger['error'](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd4'),util[_0x31d0('0xd3')](_0x26b34d['body'],{'showHidden':![],'depth':null}));}break;case _0x31d0('0x8c'):if(!_0x26b34d[_0x31d0('0x60')][_0x31d0('0xde')]&&_0x3ec816>=0xc8&&_0x3ec816<=0xce){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0x8c'),util[_0x31d0('0xd3')](_0x26b34d['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3743a3=_0x26b34d[_0x31d0('0x60')][_0x31d0('0x93')][0x0];if(_0x3743a3[_0x31d0('0x30')]['groupName']==='DELIVERED'){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger['error'](_0x31d0('0xd1'),_0x31d0('0x30'),'infobip',util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3ec816=='DELIVERED_TO_GATEWAY'||_0x3ec816==_0x31d0('0xdf')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0xd9'),util['inspect'](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3ec816==_0x31d0('0xe0')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xda'),util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;case _0x31d0('0x99'):if(_0x3ec816===_0x31d0('0xe1')||_0x3ec816===_0x31d0('0xe2')){return _0x5c62c6[_0x31d0('0xdc')]({'read':!![]});}else{logger[_0x31d0('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31d0('0x30'),_0x31d0('0x99'),util[_0x31d0('0xd3')](_0x26b34d[_0x31d0('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x5c62c6;}})['then'](respondWithResult(_0x164b22,null))['catch'](handleError(_0x164b22,null));};exports['statusGet']=function(_0x5ccef2,_0x1a940b,_0x4cbc05){var _0x25da23,_0x12853c,_0x41fa8a;return db[_0x31d0('0x43')]['find']({'where':{'id':_0x5ccef2['params']['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x1a940b,null))[_0x31d0('0x24')](function(_0x14c2db){if(_0x14c2db){_0x41fa8a=_0x14c2db;logger[_0x31d0('0x28')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xd2'),_0x14c2db['type'],util[_0x31d0('0xd3')](_0x5ccef2[_0x31d0('0x47')],{'showHidden':![],'depth':null}));switch(_0x14c2db[_0x31d0('0x55')]){case _0x31d0('0xe3'):if(_0x5ccef2[_0x31d0('0x47')][_0x31d0('0xe4')]&&_0x5ccef2['query']['state']){_0x12853c=_0x5ccef2['query'][_0x31d0('0xe5')];return db[_0x31d0('0xae')][_0x31d0('0x5e')]({'where':{'messageId':_0x5ccef2[_0x31d0('0x47')][_0x31d0('0xe4')]}});}break;}}})[_0x31d0('0x24')](handleEntityNotFound(_0x1a940b,null))[_0x31d0('0x24')](function(_0x29ac94){if(_0x29ac94){_0x25da23=_0x29ac94;switch(_0x41fa8a['type']){case _0x31d0('0xe3'):if(_0x12853c==='2'||_0x12853c==='6'){return _0x25da23['update']({'read':!![]});}else{logger[_0x31d0('0x29')](_0x31d0('0xd1'),_0x31d0('0x30'),_0x31d0('0xe3'),util[_0x31d0('0xd3')](_0x5ccef2[_0x31d0('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x25da23;}})[_0x31d0('0x24')](respondWithResult(_0x1a940b,null))[_0x31d0('0x2d')](handleError(_0x1a940b,null));};exports[_0x31d0('0xe6')]=function(_0x54c7f8,_0x669db0,_0x3064ca){return db[_0x31d0('0x43')][_0x31d0('0x5e')]({'where':{'id':_0x54c7f8[_0x31d0('0x5c')]['id']}})[_0x31d0('0x24')](handleEntityNotFound(_0x669db0,null))[_0x31d0('0x24')](function(_0x3adf70){if(_0x3adf70){return _0x3adf70[_0x31d0('0xe6')](_0x54c7f8[_0x31d0('0x60')][_0x31d0('0x6f')],_['omit'](_0x54c7f8['body'],['ids','id'])||{})['spread'](function(_0x2699ff){for(var _0x371a05=0x0;_0x371a05<_0x54c7f8[_0x31d0('0x60')]['ids'][_0x31d0('0x4c')];_0x371a05+=0x1){socket['emit'](_0x31d0('0xe7'),{'UserId':Number(_0x54c7f8[_0x31d0('0x60')][_0x31d0('0x6f')][_0x371a05]),'SmsAccountId':Number(_0x54c7f8['params']['id'])});}return _0x2699ff;});}})['then'](respondWithResult(_0x669db0,null))['catch'](handleError(_0x669db0,null));};exports[_0x31d0('0xe8')]=function(_0x4a156e,_0x568379,_0x48c6a7){return db['SmsAccount'][_0x31d0('0x5e')]({'where':{'id':_0x4a156e[_0x31d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x568379,null))[_0x31d0('0x24')](function(_0xbe3358){if(_0xbe3358){return _0xbe3358[_0x31d0('0xe8')](_0x4a156e[_0x31d0('0x47')]['ids'])['then'](function(){if(_[_0x31d0('0xe9')](_0x4a156e[_0x31d0('0x47')]['ids'])){for(var _0x1a60a3=0x0;_0x1a60a3<_0x4a156e['query'][_0x31d0('0x6f')][_0x31d0('0x4c')];_0x1a60a3+=0x1){socket[_0x31d0('0xea')](_0x31d0('0xeb'),{'UserId':Number(_0x4a156e[_0x31d0('0x47')][_0x31d0('0x6f')][_0x1a60a3]),'SmsAccountId':Number(_0x4a156e[_0x31d0('0x5c')]['id'])});}}else{socket[_0x31d0('0xea')](_0x31d0('0xeb'),{'UserId':Number(_0x4a156e['query'][_0x31d0('0x6f')]),'SmsAccountId':Number(_0x4a156e[_0x31d0('0x5c')]['id'])});}});}})[_0x31d0('0x24')](respondWithStatusCode(_0x568379,null))[_0x31d0('0x2d')](handleError(_0x568379,null));};exports[_0x31d0('0xec')]=function(_0x52374d,_0x81244d,_0x2f73cd){var _0x5ee0bf={};var _0x1c38cf={};var _0x55085a;var _0x4e9050;return db[_0x31d0('0x43')][_0x31d0('0x6b')]({'where':{'id':_0x52374d['params']['id']}})['then'](handleEntityNotFound(_0x81244d,null))['then'](function(_0x461926){if(_0x461926){_0x55085a=_0x461926;_0x1c38cf[_0x31d0('0x46')]=_['keys'](db['User'][_0x31d0('0x44')]);_0x1c38cf[_0x31d0('0x47')]=_[_0x31d0('0x5d')](_0x52374d[_0x31d0('0x47')]);_0x1c38cf[_0x31d0('0x48')]=_[_0x31d0('0x49')](_0x1c38cf[_0x31d0('0x46')],_0x1c38cf['query']);_0x5ee0bf[_0x31d0('0x4a')]=_[_0x31d0('0x49')](_0x1c38cf[_0x31d0('0x46')],qs['fields'](_0x52374d[_0x31d0('0x47')][_0x31d0('0x4b')]));_0x5ee0bf[_0x31d0('0x4a')]=_0x5ee0bf['attributes'][_0x31d0('0x4c')]?_0x5ee0bf[_0x31d0('0x4a')]:_0x1c38cf[_0x31d0('0x46')];_0x5ee0bf[_0x31d0('0x4f')]=qs[_0x31d0('0x50')](_0x52374d[_0x31d0('0x47')]['sort']);_0x5ee0bf[_0x31d0('0x54')]=qs[_0x31d0('0x48')](_['pick'](_0x52374d['query'],_0x1c38cf[_0x31d0('0x48')]));if(_0x52374d['query']['filter']){_0x5ee0bf[_0x31d0('0x54')]=_['merge'](_0x5ee0bf[_0x31d0('0x54')],{'$or':_[_0x31d0('0x42')](_0x5ee0bf['attributes'],function(_0x4c527f){var _0x1f4f77={};_0x1f4f77[_0x4c527f]={'$like':'%'+_0x52374d[_0x31d0('0x47')][_0x31d0('0x52')]+'%'};return _0x1f4f77;})});}_0x5ee0bf=_[_0x31d0('0x53')]({},_0x5ee0bf,_0x52374d[_0x31d0('0x57')]);return _0x55085a[_0x31d0('0xec')](_0x5ee0bf);}})['then'](function(_0x25bf2e){if(_0x25bf2e){_0x4e9050=_0x25bf2e['length'];if(!_0x52374d[_0x31d0('0x47')][_0x31d0('0x4d')](_0x31d0('0x4e'))){_0x5ee0bf['limit']=qs[_0x31d0('0x34')](_0x52374d['query'][_0x31d0('0x34')]);_0x5ee0bf[_0x31d0('0x32')]=qs['offset'](_0x52374d[_0x31d0('0x47')][_0x31d0('0x32')]);}return _0x55085a[_0x31d0('0xec')](_0x5ee0bf);}})[_0x31d0('0x24')](function(_0x1dcba5){if(_0x1dcba5){return _0x1dcba5?{'count':_0x4e9050,'rows':_0x1dcba5}:null;}})[_0x31d0('0x24')](respondWithResult(_0x81244d,null))[_0x31d0('0x2d')](handleError(_0x81244d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 7a7300d..2b3e461 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 _0x8055=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x31e7d1,_0x321d25){var _0x18a205=function(_0x35ed80){while(--_0x35ed80){_0x31e7d1['push'](_0x31e7d1['shift']());}};_0x18a205(++_0x321d25);}(_0x8055,0x193));var _0x5805=function(_0x5205ce,_0x378f54){_0x5205ce=_0x5205ce-0x0;var _0x54c3be=_0x8055[_0x5205ce];return _0x54c3be;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x5805('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5805('0x1')](0x0);var events={'afterCreate':_0x5805('0x2'),'afterUpdate':_0x5805('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4e0e5f){return function(_0x5d815d,_0x5c95b8,_0x56f6a7){SmsAccountEvents[_0x5805('0x4')](_0x4e0e5f+':'+_0x5d815d['id'],_0x5d815d);SmsAccountEvents[_0x5805('0x4')](_0x4e0e5f,_0x5d815d);_0x56f6a7(null);};}for(var e in events){if(events[_0x5805('0x5')](e)){var event=events[e];SmsAccount[_0x5805('0x6')](e,emitEvent(event));}}module[_0x5805('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xf847=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x50e1b8,_0x15934e){var _0x16e922=function(_0x58d5f9){while(--_0x58d5f9){_0x50e1b8['push'](_0x50e1b8['shift']());}};_0x16e922(++_0x15934e);}(_0xf847,0xdd));var _0x7f84=function(_0x5c4fea,_0x5a21fc){_0x5c4fea=_0x5c4fea-0x0;var _0x2341fb=_0xf847[_0x5c4fea];return _0x2341fb;};'use strict';var EventEmitter=require(_0x7f84('0x0'));var SmsAccount=require(_0x7f84('0x1'))['db'][_0x7f84('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7f84('0x3')](0x0);var events={'afterCreate':_0x7f84('0x4'),'afterUpdate':'update','afterDestroy':_0x7f84('0x5')};function emitEvent(_0x5cf105){return function(_0x3e835d,_0x5d8aac,_0x53e008){SmsAccountEvents[_0x7f84('0x6')](_0x5cf105+':'+_0x3e835d['id'],_0x3e835d);SmsAccountEvents[_0x7f84('0x6')](_0x5cf105,_0x3e835d);_0x53e008(null);};}for(var e in events){if(events[_0x7f84('0x7')](e)){var event=events[e];SmsAccount[_0x7f84('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2ed5ab6..4f25b41 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 _0xa519=['../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa519,0x148));var _0x9a51=function(_0x2dac29,_0x30de5b){_0x2dac29=_0x2dac29-0x0;var _0x37bd03=_0xa519[_0x2dac29];return _0x37bd03;};'use strict';var _=require(_0x9a51('0x0'));var util=require(_0x9a51('0x1'));var logger=require(_0x9a51('0x2'))(_0x9a51('0x3'));var moment=require(_0x9a51('0x4'));var BPromise=require(_0x9a51('0x5'));var rp=require(_0x9a51('0x6'));var fs=require('fs');var path=require(_0x9a51('0x7'));var rimraf=require('rimraf');var config=require(_0x9a51('0x8'));var attributes=require(_0x9a51('0x9'));module['exports']=function(_0x5d2c43,_0x1b4c83){return _0x5d2c43['define'](_0x9a51('0xa'),attributes,{'tableName':_0x9a51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2221=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4a21e4,_0x47b754){var _0x46c9a5=function(_0x5a1cea){while(--_0x5a1cea){_0x4a21e4['push'](_0x4a21e4['shift']());}};_0x46c9a5(++_0x47b754);}(_0x2221,0x96));var _0x1222=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x2221[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0x1222('0x0'));var util=require(_0x1222('0x1'));var logger=require(_0x1222('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1222('0x3'));var rp=require(_0x1222('0x4'));var fs=require('fs');var path=require(_0x1222('0x5'));var rimraf=require('rimraf');var config=require(_0x1222('0x6'));var attributes=require(_0x1222('0x7'));module[_0x1222('0x8')]=function(_0x2dbae8,_0x1393bb){return _0x2dbae8[_0x1222('0x9')](_0x1222('0xa'),attributes,{'tableName':_0x1222('0xb'),'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 a5169b7..dae0ee8 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 _0x5ba1=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsAccount','options','raw','where','include','map','model','attributes','stringify','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x262e81,_0x357386){var _0x45863e=function(_0x490d7d){while(--_0x490d7d){_0x262e81['push'](_0x262e81['shift']());}};_0x45863e(++_0x357386);}(_0x5ba1,0xfc));var _0x15ba=function(_0x467ec6,_0x3e20c5){_0x467ec6=_0x467ec6-0x0;var _0x3b4f4d=_0x5ba1[_0x467ec6];return _0x3b4f4d;};'use strict';var _=require(_0x15ba('0x0'));var util=require(_0x15ba('0x1'));var moment=require(_0x15ba('0x2'));var BPromise=require(_0x15ba('0x3'));var rs=require(_0x15ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15ba('0x5'))['db'];var utils=require(_0x15ba('0x6'));var logger=require(_0x15ba('0x7'))('rpc');var config=require(_0x15ba('0x8'));var jayson=require(_0x15ba('0x9'));var client=jayson[_0x15ba('0xa')][_0x15ba('0xb')]({'port':0x232a});config[_0x15ba('0xc')]=_[_0x15ba('0xd')](config[_0x15ba('0xc')],{'host':_0x15ba('0xe'),'port':0x18eb});var socket=require(_0x15ba('0xf'))(new Redis(config[_0x15ba('0xc')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4c36f0,_0x59a838,_0x2013b5){return new BPromise(function(_0x20c561,_0x39cc30){return client[_0x15ba('0x10')](_0x4c36f0,_0x2013b5)[_0x15ba('0x11')](function(_0x18056d){logger[_0x15ba('0x12')](_0x15ba('0x13'),_0x59a838,_0x15ba('0x14'));logger['debug'](_0x15ba('0x15'),_0x59a838,_0x15ba('0x14'),JSON['stringify'](_0x18056d));if(_0x18056d[_0x15ba('0x16')]){if(_0x18056d['error'][_0x15ba('0x17')]===0x1f4){logger[_0x15ba('0x16')]('SmsAccount,\x20%s,\x20%s',_0x59a838,_0x18056d['error']['message']);return _0x39cc30(_0x18056d[_0x15ba('0x16')][_0x15ba('0x18')]);}logger[_0x15ba('0x16')](_0x15ba('0x13'),_0x59a838,_0x18056d['error'][_0x15ba('0x18')]);return _0x20c561(_0x18056d['error'][_0x15ba('0x18')]);}else{logger[_0x15ba('0x12')](_0x15ba('0x13'),_0x59a838,_0x15ba('0x14'));_0x20c561(_0x18056d[_0x15ba('0x19')][_0x15ba('0x18')]);}})[_0x15ba('0x1a')](function(_0xad6fd7){logger[_0x15ba('0x16')](_0x15ba('0x13'),_0x59a838,_0xad6fd7);_0x39cc30(_0xad6fd7);});});}exports['ShowSmsAccount']=function(_0x14a1a6){var _0x3a9475=this;return new Promise(function(_0x423e34,_0x1ef878){return db[_0x15ba('0x1b')]['find']({'raw':_0x14a1a6[_0x15ba('0x1c')]?_0x14a1a6['options'][_0x15ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x14a1a6[_0x15ba('0x1c')]?_0x14a1a6[_0x15ba('0x1c')][_0x15ba('0x1e')]||null:null,'attributes':_0x14a1a6['options']?_0x14a1a6['options']['attributes']||null:null,'include':_0x14a1a6[_0x15ba('0x1c')]?_0x14a1a6[_0x15ba('0x1c')][_0x15ba('0x1f')]?_[_0x15ba('0x20')](_0x14a1a6[_0x15ba('0x1c')][_0x15ba('0x1f')],function(_0x8636e9){return{'model':db[_0x8636e9[_0x15ba('0x21')]],'as':_0x8636e9['as'],'attributes':_0x8636e9['attributes'],'include':_0x8636e9[_0x15ba('0x1f')]?_['map'](_0x8636e9[_0x15ba('0x1f')],function(_0x190de1){return{'model':db[_0x190de1['model']],'as':_0x190de1['as'],'attributes':_0x190de1[_0x15ba('0x22')],'include':_0x190de1[_0x15ba('0x1f')]?_[_0x15ba('0x20')](_0x190de1[_0x15ba('0x1f')],function(_0x5901e4){return{'model':db[_0x5901e4[_0x15ba('0x21')]],'as':_0x5901e4['as'],'attributes':_0x5901e4[_0x15ba('0x22')]};}):[]};}):[]};}):[]:[]})[_0x15ba('0x11')](function(_0x47c59a){logger[_0x15ba('0x12')]('ShowSmsAccount',_0x14a1a6);logger['debug']('ShowSmsAccount',_0x14a1a6,JSON[_0x15ba('0x23')](_0x47c59a));_0x423e34(_0x47c59a);})[_0x15ba('0x1a')](function(_0x4a440b){logger[_0x15ba('0x16')](_0x15ba('0x24'),_0x4a440b[_0x15ba('0x18')],_0x14a1a6);_0x1ef878(_0x3a9475['error'](0x1f4,_0x4a440b[_0x15ba('0x18')]));});});}; \ No newline at end of file +var _0xb5e1=['error','code','message','result','catch','SmsAccount','options','raw','where','attributes','map','include','model','ShowSmsAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x13a37e,_0x449327){var _0x1b5924=function(_0x27d622){while(--_0x27d622){_0x13a37e['push'](_0x13a37e['shift']());}};_0x1b5924(++_0x449327);}(_0xb5e1,0x15c));var _0x1b5e=function(_0x91c951,_0x2988ba){_0x91c951=_0x91c951-0x0;var _0xc454d1=_0xb5e1[_0x91c951];return _0xc454d1;};'use strict';var _=require(_0x1b5e('0x0'));var util=require(_0x1b5e('0x1'));var moment=require(_0x1b5e('0x2'));var BPromise=require(_0x1b5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b5e('0x4'));var db=require(_0x1b5e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b5e('0x6'))(_0x1b5e('0x7'));var config=require(_0x1b5e('0x8'));var jayson=require(_0x1b5e('0x9'));var client=jayson[_0x1b5e('0xa')]['http']({'port':0x232a});config[_0x1b5e('0xb')]=_[_0x1b5e('0xc')](config[_0x1b5e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b5e('0xd'))(new Redis(config[_0x1b5e('0xb')]));require(_0x1b5e('0xe'))[_0x1b5e('0xf')](socket);function respondWithRpcPromise(_0x4b8348,_0x767619,_0x5bdbe1){return new BPromise(function(_0x160442,_0x499734){return client[_0x1b5e('0x10')](_0x4b8348,_0x5bdbe1)[_0x1b5e('0x11')](function(_0x216cda){logger[_0x1b5e('0x12')](_0x1b5e('0x13'),_0x767619,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x767619,_0x1b5e('0x14'),JSON[_0x1b5e('0x15')](_0x216cda));if(_0x216cda[_0x1b5e('0x16')]){if(_0x216cda['error'][_0x1b5e('0x17')]===0x1f4){logger[_0x1b5e('0x16')](_0x1b5e('0x13'),_0x767619,_0x216cda['error'][_0x1b5e('0x18')]);return _0x499734(_0x216cda[_0x1b5e('0x16')][_0x1b5e('0x18')]);}logger[_0x1b5e('0x16')](_0x1b5e('0x13'),_0x767619,_0x216cda[_0x1b5e('0x16')]['message']);return _0x160442(_0x216cda[_0x1b5e('0x16')][_0x1b5e('0x18')]);}else{logger[_0x1b5e('0x12')](_0x1b5e('0x13'),_0x767619,_0x1b5e('0x14'));_0x160442(_0x216cda[_0x1b5e('0x19')][_0x1b5e('0x18')]);}})[_0x1b5e('0x1a')](function(_0x5ab832){logger['error'](_0x1b5e('0x13'),_0x767619,_0x5ab832);_0x499734(_0x5ab832);});});}exports['ShowSmsAccount']=function(_0x1b83e0){var _0xaedb3e=this;return new Promise(function(_0x2227c1,_0x4f90d1){return db[_0x1b5e('0x1b')]['find']({'raw':_0x1b83e0[_0x1b5e('0x1c')]?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b83e0['options']?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1e')]||null:null,'attributes':_0x1b83e0['options']?_0x1b83e0[_0x1b5e('0x1c')][_0x1b5e('0x1f')]||null:null,'include':_0x1b83e0[_0x1b5e('0x1c')]?_0x1b83e0['options']['include']?_[_0x1b5e('0x20')](_0x1b83e0['options'][_0x1b5e('0x21')],function(_0x1d47ec){return{'model':db[_0x1d47ec['model']],'as':_0x1d47ec['as'],'attributes':_0x1d47ec[_0x1b5e('0x1f')],'include':_0x1d47ec[_0x1b5e('0x21')]?_[_0x1b5e('0x20')](_0x1d47ec[_0x1b5e('0x21')],function(_0x3b0ad9){return{'model':db[_0x3b0ad9[_0x1b5e('0x22')]],'as':_0x3b0ad9['as'],'attributes':_0x3b0ad9[_0x1b5e('0x1f')],'include':_0x3b0ad9[_0x1b5e('0x21')]?_[_0x1b5e('0x20')](_0x3b0ad9[_0x1b5e('0x21')],function(_0x279558){return{'model':db[_0x279558[_0x1b5e('0x22')]],'as':_0x279558['as'],'attributes':_0x279558[_0x1b5e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18a0b8){logger[_0x1b5e('0x12')](_0x1b5e('0x23'),_0x1b83e0);logger[_0x1b5e('0x24')](_0x1b5e('0x23'),_0x1b83e0,JSON['stringify'](_0x18a0b8));_0x2227c1(_0x18a0b8);})[_0x1b5e('0x1a')](function(_0xf89e88){logger[_0x1b5e('0x16')](_0x1b5e('0x23'),_0xf89e88[_0x1b5e('0x18')],_0x1b83e0);_0x4f90d1(_0xaedb3e[_0x1b5e('0x16')](0x1f4,_0xf89e88[_0x1b5e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3c98150..11969f8 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 9651b9b..8cedcc6 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5eb1b3,_0x32c009){var _0x214976=function(_0x2630aa){while(--_0x2630aa){_0x5eb1b3['push'](_0x5eb1b3['shift']());}};_0x214976(++_0x32c009);}(_0x34e8,0x12c));var _0x834e=function(_0x86913f,_0x4c6227){_0x86913f=_0x86913f-0x0;var _0x284074=_0x34e8[_0x86913f];return _0x284074;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x290501,_0x1c8e10){var _0x151537=function(_0x3c28ec){while(--_0x3c28ec){_0x290501['push'](_0x290501['shift']());}};_0x151537(++_0x1c8e10);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'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')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 055eb5e..5fd37eb 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 _0x6414=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x6414,0x195));var _0x4641=function(_0x57bd5d,_0x2c0fee){_0x57bd5d=_0x57bd5d-0x0;var _0x4ddad0=_0x6414[_0x57bd5d];return _0x4ddad0;};'use strict';var Sequelize=require(_0x4641('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4641('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4641('0x2')],'allowNull':![],'defaultValue':_0x4641('0x3')},'appdata':{'type':Sequelize[_0x4641('0x4')]()},'description':{'type':Sequelize[_0x4641('0x2')]},'interval':{'type':Sequelize[_0x4641('0x2')],'defaultValue':_0x4641('0x5')}}; \ No newline at end of file +var _0x2999=['exports','noop','TEXT','STRING','sequelize'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x2999,0x1c1));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9299('0x0'));module[_0x9299('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9299('0x2')},'appdata':{'type':Sequelize[_0x9299('0x3')]()},'description':{'type':Sequelize[_0x9299('0x4')]},'interval':{'type':Sequelize[_0x9299('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 919dfa6..9c8cb42 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 _0x7367=['end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SmsApplication','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','keys','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus'];(function(_0x1c3b69,_0x2065af){var _0x2445fc=function(_0x4ff408){while(--_0x4ff408){_0x1c3b69['push'](_0x1c3b69['shift']());}};_0x2445fc(++_0x2065af);}(_0x7367,0xb9));var _0x7736=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7367[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7736('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7736('0x1'));var jsonpatch=require(_0x7736('0x2'));var rp=require('request-promise');var moment=require(_0x7736('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7736('0x4'));var util=require(_0x7736('0x5'));var path=require('path');var sox=require(_0x7736('0x6'));var csv=require(_0x7736('0x7'));var ejs=require(_0x7736('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7736('0x9'));var squel=require(_0x7736('0xa'));var crypto=require(_0x7736('0xb'));var jsforce=require(_0x7736('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7736('0x7'));var querystring=require(_0x7736('0xd'));var Papa=require(_0x7736('0xe'));var Redis=require(_0x7736('0xf'));var authService=require(_0x7736('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7736('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7736('0x12'))(_0x7736('0x13'));var utils=require(_0x7736('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52a7be,_0x2b085b){_0x2b085b=_0x2b085b||0xcc;return function(_0x2f966e){if(_0x2f966e){return _0x52a7be[_0x7736('0x15')](_0x2b085b);}return _0x52a7be['status'](_0x2b085b)[_0x7736('0x16')]();};}function respondWithResult(_0x90497e,_0x2e6071){_0x2e6071=_0x2e6071||0xc8;return function(_0x8a4dbd){if(_0x8a4dbd){return _0x90497e[_0x7736('0x17')](_0x2e6071)[_0x7736('0x18')](_0x8a4dbd);}};}function respondWithFilteredResult(_0x5951dc,_0x58f65b){return function(_0x55fe17){if(_0x55fe17){var _0x34047a=typeof _0x58f65b[_0x7736('0x19')]===_0x7736('0x1a')&&typeof _0x58f65b[_0x7736('0x1b')]===_0x7736('0x1a');var _0x2fd999=_0x55fe17['count'];var _0x305d74=_0x34047a?0x0:_0x58f65b[_0x7736('0x19')];var _0x14eba2=_0x34047a?_0x55fe17['count']:_0x58f65b['offset']+_0x58f65b[_0x7736('0x1b')];var _0x2ec12a;if(_0x14eba2>=_0x2fd999){_0x14eba2=_0x2fd999;_0x2ec12a=0xc8;}else{_0x2ec12a=0xce;}_0x5951dc['status'](_0x2ec12a);return _0x5951dc['set'](_0x7736('0x1c'),_0x305d74+'-'+_0x14eba2+'/'+_0x2fd999)[_0x7736('0x18')](_0x55fe17);}return null;};}function patchUpdates(_0x29476d){return function(_0xd5adde){try{jsonpatch[_0x7736('0x1d')](_0xd5adde,_0x29476d,!![]);}catch(_0x175b4b){return BPromise[_0x7736('0x1e')](_0x175b4b);}return _0xd5adde[_0x7736('0x1f')]();};}function saveUpdates(_0x5cb873,_0x27b871){return function(_0x15bf17){if(_0x15bf17){return _0x15bf17[_0x7736('0x20')](_0x5cb873)[_0x7736('0x21')](function(_0x575ff7){return _0x575ff7;});}return null;};}function removeEntity(_0x2678dc,_0x4feba4){return function(_0x5a9697){if(_0x5a9697){return _0x5a9697[_0x7736('0x22')]()['then'](function(){_0x2678dc[_0x7736('0x17')](0xcc)[_0x7736('0x16')]();});}};}function handleEntityNotFound(_0x3bd4a9,_0x3a2af1){return function(_0x1e28de){if(!_0x1e28de){_0x3bd4a9[_0x7736('0x15')](0x194);}return _0x1e28de;};}function handleError(_0xbe5047,_0x1cb66d){_0x1cb66d=_0x1cb66d||0x1f4;return function(_0x517ab0){logger[_0x7736('0x23')](_0x517ab0['stack']);if(_0x517ab0[_0x7736('0x24')]){delete _0x517ab0[_0x7736('0x24')];}_0xbe5047[_0x7736('0x17')](_0x1cb66d)['send'](_0x517ab0);};}exports[_0x7736('0x25')]=function(_0x5ec1fe,_0x10a0ca){var _0x312c29={},_0x41a0bd={},_0x3b7aa1={'count':0x0,'rows':[]};var _0x4dca4c=_[_0x7736('0x26')](db[_0x7736('0x27')]['rawAttributes'],function(_0x5b7473){return{'name':_0x5b7473['fieldName'],'type':_0x5b7473[_0x7736('0x28')][_0x7736('0x29')]};});_0x41a0bd[_0x7736('0x2a')]=_[_0x7736('0x26')](_0x4dca4c,'name');_0x41a0bd[_0x7736('0x2b')]=_['keys'](_0x5ec1fe[_0x7736('0x2b')]);_0x41a0bd[_0x7736('0x2c')]=_[_0x7736('0x2d')](_0x41a0bd[_0x7736('0x2a')],_0x41a0bd[_0x7736('0x2b')]);_0x312c29[_0x7736('0x2e')]=_[_0x7736('0x2d')](_0x41a0bd[_0x7736('0x2a')],qs[_0x7736('0x2f')](_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x2f')]));_0x312c29[_0x7736('0x2e')]=_0x312c29[_0x7736('0x2e')][_0x7736('0x30')]?_0x312c29[_0x7736('0x2e')]:_0x41a0bd['model'];if(!_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x31')](_0x7736('0x32'))){_0x312c29[_0x7736('0x1b')]=qs[_0x7736('0x1b')](_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x1b')]);_0x312c29[_0x7736('0x19')]=qs[_0x7736('0x19')](_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x19')]);}_0x312c29['order']=qs[_0x7736('0x33')](_0x5ec1fe[_0x7736('0x2b')]['sort']);_0x312c29['where']=qs[_0x7736('0x2c')](_[_0x7736('0x34')](_0x5ec1fe['query'],_0x41a0bd[_0x7736('0x2c')]),_0x4dca4c);if(_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x35')]){_0x312c29['where']=_[_0x7736('0x36')](_0x312c29[_0x7736('0x37')],{'$or':_[_0x7736('0x26')](_0x4dca4c,function(_0x212364){if(_0x212364[_0x7736('0x28')]!==_0x7736('0x38')){var _0x8031a0={};_0x8031a0[_0x212364[_0x7736('0x24')]]={'$like':'%'+_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x35')]+'%'};return _0x8031a0;}})});}_0x312c29=_[_0x7736('0x36')]({},_0x312c29,_0x5ec1fe[_0x7736('0x39')]);var _0x122b03={'where':_0x312c29['where']};return db['SmsApplication'][_0x7736('0x3a')](_0x122b03)['then'](function(_0x2ae3e0){_0x3b7aa1[_0x7736('0x3a')]=_0x2ae3e0;if(_0x5ec1fe[_0x7736('0x2b')][_0x7736('0x3b')]){_0x312c29['include']=[{'all':!![]}];}return db['SmsApplication'][_0x7736('0x3c')](_0x312c29);})[_0x7736('0x21')](function(_0x52315d){_0x3b7aa1[_0x7736('0x3d')]=_0x52315d;return _0x3b7aa1;})[_0x7736('0x21')](respondWithFilteredResult(_0x10a0ca,_0x312c29))[_0x7736('0x3e')](handleError(_0x10a0ca,null));};exports['show']=function(_0x37601a,_0x113bf4){var _0x385364={'raw':!![],'where':{'id':_0x37601a[_0x7736('0x3f')]['id']}},_0x517aab={};_0x517aab[_0x7736('0x2a')]=_[_0x7736('0x40')](db[_0x7736('0x27')][_0x7736('0x41')]);_0x517aab[_0x7736('0x2b')]=_[_0x7736('0x40')](_0x37601a['query']);_0x517aab[_0x7736('0x2c')]=_[_0x7736('0x2d')](_0x517aab[_0x7736('0x2a')],_0x517aab[_0x7736('0x2b')]);_0x385364['attributes']=_[_0x7736('0x2d')](_0x517aab[_0x7736('0x2a')],qs[_0x7736('0x2f')](_0x37601a['query'][_0x7736('0x2f')]));_0x385364[_0x7736('0x2e')]=_0x385364[_0x7736('0x2e')][_0x7736('0x30')]?_0x385364[_0x7736('0x2e')]:_0x517aab[_0x7736('0x2a')];if(_0x37601a['query'][_0x7736('0x3b')]){_0x385364['include']=[{'all':!![]}];}_0x385364=_[_0x7736('0x36')]({},_0x385364,_0x37601a[_0x7736('0x39')]);return db[_0x7736('0x27')][_0x7736('0x42')](_0x385364)[_0x7736('0x21')](handleEntityNotFound(_0x113bf4,null))[_0x7736('0x21')](respondWithResult(_0x113bf4,null))[_0x7736('0x3e')](handleError(_0x113bf4,null));};exports[_0x7736('0x43')]=function(_0x4a7512,_0x13b41d){return db[_0x7736('0x27')][_0x7736('0x43')](_0x4a7512[_0x7736('0x44')],{})['then'](respondWithResult(_0x13b41d,0xc9))[_0x7736('0x3e')](handleError(_0x13b41d,null));};exports[_0x7736('0x20')]=function(_0x31b88f,_0x918973){if(_0x31b88f[_0x7736('0x44')]['id']){delete _0x31b88f[_0x7736('0x44')]['id'];}return db['SmsApplication'][_0x7736('0x42')]({'where':{'id':_0x31b88f[_0x7736('0x3f')]['id']}})[_0x7736('0x21')](handleEntityNotFound(_0x918973,null))['then'](saveUpdates(_0x31b88f['body'],null))['then'](respondWithResult(_0x918973,null))[_0x7736('0x3e')](handleError(_0x918973,null));};exports[_0x7736('0x22')]=function(_0x144897,_0xfdfd22){return db[_0x7736('0x27')][_0x7736('0x42')]({'where':{'id':_0x144897[_0x7736('0x3f')]['id']}})['then'](handleEntityNotFound(_0xfdfd22,null))[_0x7736('0x21')](removeEntity(_0xfdfd22,null))[_0x7736('0x3e')](handleError(_0xfdfd22,null));}; \ No newline at end of file +var _0x86a3=['sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x500d35,_0x3f5d69){var _0x383af4=function(_0x22c7e9){while(--_0x22c7e9){_0x500d35['push'](_0x500d35['shift']());}};_0x383af4(++_0x3f5d69);}(_0x86a3,0x152));var _0x386a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x86a3[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x386a('0x0'));var zipdir=require(_0x386a('0x1'));var jsonpatch=require(_0x386a('0x2'));var rp=require('request-promise');var moment=require(_0x386a('0x3'));var BPromise=require(_0x386a('0x4'));var Mustache=require(_0x386a('0x5'));var util=require(_0x386a('0x6'));var path=require(_0x386a('0x7'));var sox=require(_0x386a('0x8'));var csv=require(_0x386a('0x9'));var ejs=require(_0x386a('0xa'));var fs=require('fs');var fs_extra=require(_0x386a('0xb'));var _=require('lodash');var squel=require(_0x386a('0xc'));var crypto=require('crypto');var jsforce=require(_0x386a('0xd'));var deskjs=require(_0x386a('0xe'));var toCsv=require(_0x386a('0x9'));var querystring=require(_0x386a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x386a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x386a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x386a('0x12'))(_0x386a('0x13'));var utils=require(_0x386a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x386a('0x15'))['db'];function respondWithStatusCode(_0x81450b,_0x15d95a){_0x15d95a=_0x15d95a||0xcc;return function(_0x326fb4){if(_0x326fb4){return _0x81450b[_0x386a('0x16')](_0x15d95a);}return _0x81450b[_0x386a('0x17')](_0x15d95a)['end']();};}function respondWithResult(_0x4de3a4,_0x28116f){_0x28116f=_0x28116f||0xc8;return function(_0x3d562a){if(_0x3d562a){return _0x4de3a4[_0x386a('0x17')](_0x28116f)['json'](_0x3d562a);}};}function respondWithFilteredResult(_0xc13ace,_0x13b2c9){return function(_0x2fe44f){if(_0x2fe44f){var _0x1d24ca=typeof _0x13b2c9[_0x386a('0x18')]===_0x386a('0x19')&&typeof _0x13b2c9[_0x386a('0x1a')]===_0x386a('0x19');var _0x68461d=_0x2fe44f['count'];var _0x4040a9=_0x1d24ca?0x0:_0x13b2c9['offset'];var _0x743840=_0x1d24ca?_0x2fe44f['count']:_0x13b2c9['offset']+_0x13b2c9[_0x386a('0x1a')];var _0x5048ed;if(_0x743840>=_0x68461d){_0x743840=_0x68461d;_0x5048ed=0xc8;}else{_0x5048ed=0xce;}_0xc13ace[_0x386a('0x17')](_0x5048ed);return _0xc13ace[_0x386a('0x1b')](_0x386a('0x1c'),_0x4040a9+'-'+_0x743840+'/'+_0x68461d)[_0x386a('0x1d')](_0x2fe44f);}return null;};}function patchUpdates(_0x165e0c){return function(_0xe0e8dd){try{jsonpatch[_0x386a('0x1e')](_0xe0e8dd,_0x165e0c,!![]);}catch(_0x570d05){return BPromise[_0x386a('0x1f')](_0x570d05);}return _0xe0e8dd[_0x386a('0x20')]();};}function saveUpdates(_0x18d2c1,_0x587dab){return function(_0x10bae3){if(_0x10bae3){return _0x10bae3['update'](_0x18d2c1)[_0x386a('0x21')](function(_0x4eda3d){return _0x4eda3d;});}return null;};}function removeEntity(_0x3380d8,_0x504ec0){return function(_0x453109){if(_0x453109){return _0x453109['destroy']()['then'](function(){_0x3380d8['status'](0xcc)[_0x386a('0x22')]();});}};}function handleEntityNotFound(_0xd7f2df,_0x2daf81){return function(_0x59e24e){if(!_0x59e24e){_0xd7f2df['sendStatus'](0x194);}return _0x59e24e;};}function handleError(_0x42312a,_0x29a95f){_0x29a95f=_0x29a95f||0x1f4;return function(_0x563cb0){logger['error'](_0x563cb0[_0x386a('0x23')]);if(_0x563cb0[_0x386a('0x24')]){delete _0x563cb0[_0x386a('0x24')];}_0x42312a[_0x386a('0x17')](_0x29a95f)[_0x386a('0x25')](_0x563cb0);};}exports['index']=function(_0x3b973f,_0x1a2d7d){var _0xb4c918={},_0x4a6c83={},_0x10a445={'count':0x0,'rows':[]};var _0x5b1acb=_[_0x386a('0x26')](db[_0x386a('0x27')][_0x386a('0x28')],function(_0x405559){return{'name':_0x405559[_0x386a('0x29')],'type':_0x405559[_0x386a('0x2a')][_0x386a('0x2b')]};});_0x4a6c83[_0x386a('0x2c')]=_[_0x386a('0x26')](_0x5b1acb,'name');_0x4a6c83[_0x386a('0x2d')]=_[_0x386a('0x2e')](_0x3b973f[_0x386a('0x2d')]);_0x4a6c83[_0x386a('0x2f')]=_['intersection'](_0x4a6c83[_0x386a('0x2c')],_0x4a6c83[_0x386a('0x2d')]);_0xb4c918[_0x386a('0x30')]=_[_0x386a('0x31')](_0x4a6c83[_0x386a('0x2c')],qs['fields'](_0x3b973f[_0x386a('0x2d')][_0x386a('0x32')]));_0xb4c918[_0x386a('0x30')]=_0xb4c918[_0x386a('0x30')][_0x386a('0x33')]?_0xb4c918['attributes']:_0x4a6c83[_0x386a('0x2c')];if(!_0x3b973f[_0x386a('0x2d')]['hasOwnProperty'](_0x386a('0x34'))){_0xb4c918[_0x386a('0x1a')]=qs[_0x386a('0x1a')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x1a')]);_0xb4c918['offset']=qs[_0x386a('0x18')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x18')]);}_0xb4c918['order']=qs[_0x386a('0x35')](_0x3b973f[_0x386a('0x2d')][_0x386a('0x35')]);_0xb4c918[_0x386a('0x36')]=qs[_0x386a('0x2f')](_[_0x386a('0x37')](_0x3b973f[_0x386a('0x2d')],_0x4a6c83['filters']),_0x5b1acb);if(_0x3b973f['query']['filter']){_0xb4c918[_0x386a('0x36')]=_['merge'](_0xb4c918[_0x386a('0x36')],{'$or':_[_0x386a('0x26')](_0x5b1acb,function(_0xab5720){if(_0xab5720[_0x386a('0x2a')]!==_0x386a('0x38')){var _0x325744={};_0x325744[_0xab5720[_0x386a('0x24')]]={'$like':'%'+_0x3b973f[_0x386a('0x2d')][_0x386a('0x39')]+'%'};return _0x325744;}})});}_0xb4c918=_[_0x386a('0x3a')]({},_0xb4c918,_0x3b973f[_0x386a('0x3b')]);var _0x30d5c8={'where':_0xb4c918['where']};return db[_0x386a('0x27')][_0x386a('0x3c')](_0x30d5c8)[_0x386a('0x21')](function(_0x572035){_0x10a445[_0x386a('0x3c')]=_0x572035;if(_0x3b973f[_0x386a('0x2d')][_0x386a('0x3d')]){_0xb4c918[_0x386a('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0x386a('0x3f')](_0xb4c918);})[_0x386a('0x21')](function(_0x9369ad){_0x10a445[_0x386a('0x40')]=_0x9369ad;return _0x10a445;})['then'](respondWithFilteredResult(_0x1a2d7d,_0xb4c918))['catch'](handleError(_0x1a2d7d,null));};exports['show']=function(_0x1fc613,_0x5dd48a){var _0x424547={'raw':!![],'where':{'id':_0x1fc613[_0x386a('0x41')]['id']}},_0x5673ff={};_0x5673ff[_0x386a('0x2c')]=_[_0x386a('0x2e')](db[_0x386a('0x27')][_0x386a('0x28')]);_0x5673ff[_0x386a('0x2d')]=_[_0x386a('0x2e')](_0x1fc613[_0x386a('0x2d')]);_0x5673ff[_0x386a('0x2f')]=_[_0x386a('0x31')](_0x5673ff[_0x386a('0x2c')],_0x5673ff[_0x386a('0x2d')]);_0x424547[_0x386a('0x30')]=_[_0x386a('0x31')](_0x5673ff['model'],qs[_0x386a('0x32')](_0x1fc613['query'][_0x386a('0x32')]));_0x424547[_0x386a('0x30')]=_0x424547['attributes'][_0x386a('0x33')]?_0x424547['attributes']:_0x5673ff[_0x386a('0x2c')];if(_0x1fc613['query'][_0x386a('0x3d')]){_0x424547[_0x386a('0x3e')]=[{'all':!![]}];}_0x424547=_['merge']({},_0x424547,_0x1fc613['options']);return db['SmsApplication'][_0x386a('0x42')](_0x424547)['then'](handleEntityNotFound(_0x5dd48a,null))[_0x386a('0x21')](respondWithResult(_0x5dd48a,null))[_0x386a('0x43')](handleError(_0x5dd48a,null));};exports[_0x386a('0x44')]=function(_0x48607f,_0x24acc9){return db[_0x386a('0x27')][_0x386a('0x44')](_0x48607f[_0x386a('0x45')],{})[_0x386a('0x21')](respondWithResult(_0x24acc9,0xc9))[_0x386a('0x43')](handleError(_0x24acc9,null));};exports[_0x386a('0x46')]=function(_0x24c18b,_0x15d5e1){if(_0x24c18b[_0x386a('0x45')]['id']){delete _0x24c18b['body']['id'];}return db[_0x386a('0x27')][_0x386a('0x42')]({'where':{'id':_0x24c18b[_0x386a('0x41')]['id']}})['then'](handleEntityNotFound(_0x15d5e1,null))[_0x386a('0x21')](saveUpdates(_0x24c18b['body'],null))[_0x386a('0x21')](respondWithResult(_0x15d5e1,null))[_0x386a('0x43')](handleError(_0x15d5e1,null));};exports[_0x386a('0x47')]=function(_0xd5ff12,_0x529949){return db['SmsApplication'][_0x386a('0x42')]({'where':{'id':_0xd5ff12[_0x386a('0x41')]['id']}})[_0x386a('0x21')](handleEntityNotFound(_0x529949,null))[_0x386a('0x21')](removeEntity(_0x529949,null))['catch'](handleError(_0x529949,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 429f1bb..8c351e5 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 _0x1666=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications'];(function(_0x2d7977,_0x231ee4){var _0x95e40=function(_0x42a5d9){while(--_0x42a5d9){_0x2d7977['push'](_0x2d7977['shift']());}};_0x95e40(++_0x231ee4);}(_0x1666,0x75));var _0x6166=function(_0x4445a5,_0xabfcca){_0x4445a5=_0x4445a5-0x0;var _0x4f2554=_0x1666[_0x4445a5];return _0x4f2554;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var logger=require('../../config/logger')(_0x6166('0x2'));var moment=require(_0x6166('0x3'));var BPromise=require(_0x6166('0x4'));var rp=require(_0x6166('0x5'));var fs=require('fs');var path=require(_0x6166('0x6'));var rimraf=require(_0x6166('0x7'));var config=require(_0x6166('0x8'));var attributes=require(_0x6166('0x9'));module['exports']=function(_0x2ee359,_0x1d4f2a){return _0x2ee359[_0x6166('0xa')](_0x6166('0xb'),attributes,{'tableName':_0x6166('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc502=['../../config/environment','./smsApplication.attributes','exports','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xc502,0x1cc));var _0x2c50=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xc502[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var logger=require(_0x2c50('0x2'))(_0x2c50('0x3'));var moment=require(_0x2c50('0x4'));var BPromise=require(_0x2c50('0x5'));var rp=require(_0x2c50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c50('0x7'));var config=require(_0x2c50('0x8'));var attributes=require(_0x2c50('0x9'));module[_0x2c50('0xa')]=function(_0x2298e6,_0x3dcd9b){return _0x2298e6['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c50('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3d54652..cc0ac0e 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 _0xf277=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf277,0x1e1));var _0x7f27=function(_0xd04a00,_0x22e403){_0xd04a00=_0xd04a00-0x0;var _0x30ff41=_0xf277[_0xd04a00];return _0x30ff41;};'use strict';var _=require(_0x7f27('0x0'));var util=require(_0x7f27('0x1'));var moment=require('moment');var BPromise=require(_0x7f27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f27('0x3'));var db=require(_0x7f27('0x4'))['db'];var utils=require(_0x7f27('0x5'));var logger=require(_0x7f27('0x6'))(_0x7f27('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f27('0x8'));var client=jayson['client'][_0x7f27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39dcee,_0x480cd6,_0x23dbcc){return new BPromise(function(_0x25c4dc,_0x5c0dbb){return client[_0x7f27('0xa')](_0x39dcee,_0x23dbcc)[_0x7f27('0xb')](function(_0x8ecc84){logger[_0x7f27('0xc')]('SmsApplication,\x20%s,\x20%s',_0x480cd6,'request\x20sent');logger[_0x7f27('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x480cd6,_0x7f27('0xe'),JSON[_0x7f27('0xf')](_0x8ecc84));if(_0x8ecc84[_0x7f27('0x10')]){if(_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x11')]===0x1f4){logger[_0x7f27('0x10')]('SmsApplication,\x20%s,\x20%s',_0x480cd6,_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);return _0x5c0dbb(_0x8ecc84['error'][_0x7f27('0x12')]);}logger[_0x7f27('0x10')](_0x7f27('0x13'),_0x480cd6,_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);return _0x25c4dc(_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);}else{logger[_0x7f27('0xc')]('SmsApplication,\x20%s,\x20%s',_0x480cd6,_0x7f27('0xe'));_0x25c4dc(_0x8ecc84[_0x7f27('0x14')]['message']);}})[_0x7f27('0x15')](function(_0x402610){logger['error'](_0x7f27('0x13'),_0x480cd6,_0x402610);_0x5c0dbb(_0x402610);});});} \ No newline at end of file +var _0x1619=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4d4d61,_0x271183){var _0x24572a=function(_0x2d6077){while(--_0x2d6077){_0x4d4d61['push'](_0x4d4d61['shift']());}};_0x24572a(++_0x271183);}(_0x1619,0x189));var _0x9161=function(_0x34e461,_0x18b647){_0x34e461=_0x34e461-0x0;var _0x1b312e=_0x1619[_0x34e461];return _0x1b312e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9161('0x0'));var BPromise=require('bluebird');var rs=require(_0x9161('0x1'));var fs=require('fs');var Redis=require(_0x9161('0x2'));var db=require(_0x9161('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9161('0x4'))('rpc');var config=require(_0x9161('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9161('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x280562,_0x4a0ec2,_0xb212e4){return new BPromise(function(_0x1f8240,_0x4f3e87){return client[_0x9161('0x7')](_0x280562,_0xb212e4)['then'](function(_0x3d6e0b){logger['info'](_0x9161('0x8'),_0x4a0ec2,_0x9161('0x9'));logger[_0x9161('0xa')](_0x9161('0xb'),_0x4a0ec2,_0x9161('0x9'),JSON[_0x9161('0xc')](_0x3d6e0b));if(_0x3d6e0b[_0x9161('0xd')]){if(_0x3d6e0b['error']['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4a0ec2,_0x3d6e0b[_0x9161('0xd')]['message']);return _0x4f3e87(_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);}logger[_0x9161('0xd')](_0x9161('0x8'),_0x4a0ec2,_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);return _0x1f8240(_0x3d6e0b[_0x9161('0xd')][_0x9161('0xe')]);}else{logger['info'](_0x9161('0x8'),_0x4a0ec2,_0x9161('0x9'));_0x1f8240(_0x3d6e0b[_0x9161('0xf')]['message']);}})[_0x9161('0x10')](function(_0x2a7261){logger[_0x9161('0xd')]('SmsApplication,\x20%s,\x20%s',_0x4a0ec2,_0x2a7261);_0x4f3e87(_0x2a7261);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 82c256d..709279a 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 _0x93e9=['update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update'];(function(_0x570f6d,_0x2029fe){var _0xe0e296=function(_0x31e477){while(--_0x31e477){_0x570f6d['push'](_0x570f6d['shift']());}};_0xe0e296(++_0x2029fe);}(_0x93e9,0xcc));var _0x993e=function(_0x1bb639,_0x3000d8){_0x1bb639=_0x1bb639-0x0;var _0x361e15=_0x93e9[_0x1bb639];return _0x361e15;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getMessages']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/messages',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0x14'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x17')),controller[_0x993e('0x18')]);router[_0x993e('0x19')](_0x993e('0xd'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1a')),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')]('/:id',auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1d')),controller[_0x993e('0x1e')]);router[_0x993e('0x1c')]('/:id/tags',auth[_0x993e('0xa')](),controller[_0x993e('0x1f')]);module[_0x993e('0x20')]=router; \ No newline at end of file +var _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x17bb47,_0x10a06c){var _0x4bc955=function(_0x1e020f){while(--_0x1e020f){_0x17bb47['push'](_0x17bb47['shift']());}};_0x4bc955(++_0x10a06c);}(_0xea28,0x13a));var _0x8ea2=function(_0x3d1174,_0x51dfc3){_0x3d1174=_0x3d1174-0x0;var _0x321c3a=_0xea28[_0x3d1174];return _0x321c3a;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index dae958d..90da262 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 _0x3fce=['out','INTEGER','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x56fa53,_0x46c7fa){var _0x2f3de5=function(_0x1ac0fe){while(--_0x1ac0fe){_0x56fa53['push'](_0x56fa53['shift']());}};_0x2f3de5(++_0x46c7fa);}(_0x3fce,0x121));var _0xe3fc=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x3fce[_0xc87d08];return _0x30a714;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe3fc('0x0'));module[_0xe3fc('0x1')]={'closed':{'type':Sequelize[_0xe3fc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3fc('0x3')]},'disposition':{'type':Sequelize[_0xe3fc('0x4')]},'secondDisposition':{'type':Sequelize[_0xe3fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe3fc('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe3fc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe3fc('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe3fc('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe3fc('0x6')]}}; \ No newline at end of file +var _0xc5c0=['sequelize','moment','exports','STRING','DATE','ENUM','out','BOOLEAN','INTEGER'];(function(_0x1bc7c4,_0x498d70){var _0x493b1e=function(_0x7f7142){while(--_0x7f7142){_0x1bc7c4['push'](_0x1bc7c4['shift']());}};_0x493b1e(++_0x498d70);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x2a255f,_0x2ed0f4){_0x2a255f=_0x2a255f-0x0;var _0x4f2a1c=_0xc5c0[_0x2a255f];return _0x4f2a1c;};'use strict';var Sequelize=require(_0x0c5c('0x0'));var moment=require(_0x0c5c('0x1'));module[_0x0c5c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c5c('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c5c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c5c('0x3')]},'phone':{'type':Sequelize[_0x0c5c('0x3')]},'read1stAt':{'type':Sequelize[_0x0c5c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in',_0x0c5c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0c5c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0c5c('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0c5c('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 029362f..1585ed1 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 _0x6286=['SmsInteraction','filters','attributes','intersection','fields','includeAll','options','find','create','body','describe','ids','SmsMessage','length','hasOwnProperty','nolimit','sort','where','pick','SmsInteractionId','filter','merge','map','$gte','split','format','rows','addTags','omit','spread','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','User','push','Contact','firstName','direction','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','Account','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','System','lastName','value','views','transcript-','.pdf','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys'];(function(_0x3ba3e7,_0x44a9ec){var _0x41e34b=function(_0x3915d4){while(--_0x3915d4){_0x3ba3e7['push'](_0x3ba3e7['shift']());}};_0x41e34b(++_0x44a9ec);}(_0x6286,0x1a5));var _0x6628=function(_0x424ebf,_0x4c64d3){_0x424ebf=_0x424ebf-0x0;var _0x4c6aef=_0x6286[_0x424ebf];return _0x4c6aef;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x6628('0x0'));var moment=require(_0x6628('0x1'));var BPromise=require(_0x6628('0x2'));var util=require(_0x6628('0x3'));var path=require(_0x6628('0x4'));var ejs=require(_0x6628('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x6628('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x6628('0x7'))(_0x6628('0x8'));var config=require(_0x6628('0x9'));var db=require(_0x6628('0xa'))['db'];config['redis']=_['defaults'](config[_0x6628('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6628('0xc'))(new Redis(config[_0x6628('0xb')]));require('./smsInteraction.socket')[_0x6628('0xd')](socket);function respondWithStatusCode(_0xad1826,_0x11681e){_0x11681e=_0x11681e||0xcc;return function(_0x36877c){if(_0x36877c){return _0xad1826[_0x6628('0xe')](_0x11681e);}return _0xad1826[_0x6628('0xf')](_0x11681e)[_0x6628('0x10')]();};}function respondWithResult(_0x128519,_0x2b97ab){_0x2b97ab=_0x2b97ab||0xc8;return function(_0xeff0ca){if(_0xeff0ca){return _0x128519[_0x6628('0xf')](_0x2b97ab)[_0x6628('0x11')](_0xeff0ca);}};}function respondWithFilteredResult(_0x46c82d,_0x463b7e){return function(_0x55de34){if(_0x55de34){var _0x28c5e8=typeof _0x463b7e[_0x6628('0x12')]===_0x6628('0x13')&&typeof _0x463b7e['limit']===_0x6628('0x13');var _0x235d87=_0x55de34[_0x6628('0x14')];var _0x5e7d24=_0x28c5e8?0x0:_0x463b7e[_0x6628('0x12')];var _0x47cd69=_0x28c5e8?_0x55de34['count']:_0x463b7e[_0x6628('0x12')]+_0x463b7e[_0x6628('0x15')];var _0x222ca2;if(_0x47cd69>=_0x235d87){_0x47cd69=_0x235d87;_0x222ca2=0xc8;}else{_0x222ca2=0xce;}_0x46c82d['status'](_0x222ca2);return _0x46c82d['set'](_0x6628('0x16'),_0x5e7d24+'-'+_0x47cd69+'/'+_0x235d87)[_0x6628('0x11')](_0x55de34);}return null;};}function saveUpdates(_0x382adc){return function(_0x1b59d1){if(_0x1b59d1){return _0x1b59d1[_0x6628('0x17')](_0x382adc)['then'](function(_0x27f68a){return _0x27f68a;});}return null;};}function removeEntity(_0x4a194d){return function(_0x2e5daf){if(_0x2e5daf){return _0x2e5daf[_0x6628('0x18')]()[_0x6628('0x19')](function(){_0x4a194d[_0x6628('0xf')](0xcc)[_0x6628('0x10')]();});}};}function handleEntityNotFound(_0x2fa678){return function(_0x237bd1){if(!_0x237bd1){_0x2fa678[_0x6628('0xe')](0x194);}return _0x237bd1;};}function handleError(_0x3ce778,_0x495abe){_0x495abe=_0x495abe||0x1f4;return function(_0x347b12){logger[_0x6628('0x1a')](_0x347b12[_0x6628('0x1b')]);if(_0x347b12[_0x6628('0x1c')]){delete _0x347b12[_0x6628('0x1c')];}_0x3ce778[_0x6628('0xf')](_0x495abe)['send'](_0x347b12);};}exports[_0x6628('0x1d')]=function(_0x4428ab,_0x434250){var _0x139728={};var _0x13a5c1=_['map'](db['SmsInteraction'][_0x6628('0x1e')],function(_0x1de195){return{'name':_0x1de195[_0x6628('0x1f')],'type':_0x1de195[_0x6628('0x20')][_0x6628('0x21')]};});_0x139728=qs[_0x6628('0x22')](_0x13a5c1,_0x4428ab);return interaction[_0x6628('0x23')](_0x6628('0x24'),_0x4428ab[_0x6628('0x25')],_0x4428ab['user'],_0x139728,_0x13a5c1)[_0x6628('0x19')](respondWithFilteredResult(_0x434250,_0x139728))[_0x6628('0x26')](handleError(_0x434250,null));};exports[_0x6628('0x27')]=function(_0x4b27ba,_0x4058ae){var _0x4f1b37={'raw':![],'where':{'id':_0x4b27ba[_0x6628('0x28')]['id']}},_0x12a1f4={};_0x12a1f4[_0x6628('0x29')]=_[_0x6628('0x2a')](db[_0x6628('0x2b')]['rawAttributes']);_0x12a1f4[_0x6628('0x25')]=_['keys'](_0x4b27ba[_0x6628('0x25')]);_0x12a1f4[_0x6628('0x2c')]=_['intersection'](_0x12a1f4[_0x6628('0x29')],_0x12a1f4[_0x6628('0x25')]);_0x4f1b37[_0x6628('0x2d')]=_[_0x6628('0x2e')](_0x12a1f4[_0x6628('0x29')],qs[_0x6628('0x2f')](_0x4b27ba[_0x6628('0x25')][_0x6628('0x2f')]));_0x4f1b37['attributes']=_0x4f1b37[_0x6628('0x2d')]['length']?_0x4f1b37[_0x6628('0x2d')]:_0x12a1f4[_0x6628('0x29')];if(_0x4b27ba[_0x6628('0x25')][_0x6628('0x30')]){_0x4f1b37['include']=[{'all':!![]}];}_0x4f1b37=_['merge']({},_0x4f1b37,_0x4b27ba[_0x6628('0x31')]);return db['SmsInteraction'][_0x6628('0x32')](_0x4f1b37)[_0x6628('0x19')](handleEntityNotFound(_0x4058ae,null))[_0x6628('0x19')](respondWithResult(_0x4058ae,null))[_0x6628('0x26')](handleError(_0x4058ae,null));};exports[_0x6628('0x33')]=function(_0x116ac5,_0x1bd445){return db[_0x6628('0x2b')][_0x6628('0x33')](_0x116ac5['body'],{})[_0x6628('0x19')](respondWithResult(_0x1bd445,0xc9))[_0x6628('0x26')](handleError(_0x1bd445,null));};exports[_0x6628('0x17')]=function(_0x1fc724,_0x183a20){if(_0x1fc724[_0x6628('0x34')]['id']){delete _0x1fc724[_0x6628('0x34')]['id'];}return db[_0x6628('0x2b')][_0x6628('0x32')]({'where':{'id':_0x1fc724[_0x6628('0x28')]['id']}})[_0x6628('0x19')](handleEntityNotFound(_0x183a20,null))[_0x6628('0x19')](saveUpdates(_0x1fc724[_0x6628('0x34')],null))['then'](respondWithResult(_0x183a20,null))['catch'](handleError(_0x183a20,null));};exports[_0x6628('0x18')]=function(_0x232933,_0x5f26c0){return db[_0x6628('0x2b')]['find']({'where':{'id':_0x232933[_0x6628('0x28')]['id']}})[_0x6628('0x19')](handleEntityNotFound(_0x5f26c0,null))[_0x6628('0x19')](removeEntity(_0x5f26c0,null))[_0x6628('0x26')](handleError(_0x5f26c0,null));};exports[_0x6628('0x35')]=function(_0x33b366,_0x38a6ee){return db[_0x6628('0x2b')][_0x6628('0x35')]()[_0x6628('0x19')](respondWithResult(_0x38a6ee,null))[_0x6628('0x26')](handleError(_0x38a6ee,null));};exports['addMessage']=function(_0x7a69a4,_0x521c88){return db['SmsMessage'][_0x6628('0x32')]({'where':{'id':_0x7a69a4[_0x6628('0x28')]['id']}})[_0x6628('0x19')](handleEntityNotFound(_0x521c88,null))[_0x6628('0x19')](function(_0x2c7748){if(_0x2c7748){return _0x2c7748['addMessage'](_0x7a69a4[_0x6628('0x34')][_0x6628('0x36')],_['omit'](_0x7a69a4[_0x6628('0x34')],[_0x6628('0x36'),'id'])||{});}})[_0x6628('0x19')](respondWithResult(_0x521c88,null))[_0x6628('0x26')](handleError(_0x521c88,null));};exports['getMessages']=function(_0x32f6d7,_0x1c44bb){var _0x26ff8b={'raw':![],'where':{}};var _0x3e6b16={};var _0x47e0a3={'count':0x0,'rows':[]};return db[_0x6628('0x2b')]['findOne']({'where':{'id':_0x32f6d7[_0x6628('0x28')]['id']}})['then'](handleEntityNotFound(_0x1c44bb,null))[_0x6628('0x19')](function(_0x41ea5f){if(_0x41ea5f){_0x3e6b16[_0x6628('0x29')]=_[_0x6628('0x2a')](db[_0x6628('0x37')][_0x6628('0x1e')]);_0x3e6b16['query']=_['keys'](_0x32f6d7['query']);_0x3e6b16[_0x6628('0x2c')]=_[_0x6628('0x2e')](_0x3e6b16[_0x6628('0x29')],_0x3e6b16['query']);_0x26ff8b[_0x6628('0x2d')]=_['intersection'](_0x3e6b16[_0x6628('0x29')],qs[_0x6628('0x2f')](_0x32f6d7[_0x6628('0x25')][_0x6628('0x2f')]));_0x26ff8b[_0x6628('0x2d')]=_0x26ff8b[_0x6628('0x2d')][_0x6628('0x38')]?_0x26ff8b[_0x6628('0x2d')]:_0x3e6b16[_0x6628('0x29')];if(!_0x32f6d7[_0x6628('0x25')][_0x6628('0x39')](_0x6628('0x3a'))){_0x26ff8b[_0x6628('0x15')]=qs[_0x6628('0x15')](_0x32f6d7[_0x6628('0x25')][_0x6628('0x15')]);_0x26ff8b[_0x6628('0x12')]=qs['offset'](_0x32f6d7['query'][_0x6628('0x12')]);}_0x26ff8b['order']=qs[_0x6628('0x3b')](_0x32f6d7[_0x6628('0x25')][_0x6628('0x3b')]);_0x26ff8b[_0x6628('0x3c')]=qs[_0x6628('0x2c')](_[_0x6628('0x3d')](_0x32f6d7[_0x6628('0x25')],_0x3e6b16[_0x6628('0x2c')]));_0x26ff8b[_0x6628('0x3c')][_0x6628('0x3e')]=_0x41ea5f['id'];if(_0x32f6d7[_0x6628('0x25')][_0x6628('0x3f')]){_0x26ff8b[_0x6628('0x3c')]=_[_0x6628('0x40')](_0x26ff8b['where'],{'$or':_[_0x6628('0x41')](_0x26ff8b[_0x6628('0x2d')],function(_0x38e22b){var _0x2e73dc={};_0x2e73dc[_0x38e22b]={'$like':'%'+_0x32f6d7[_0x6628('0x25')][_0x6628('0x3f')]+'%'};return _0x2e73dc;})});}if(_0x32f6d7[_0x6628('0x25')][_0x6628('0x42')]){var _0x179ccb=_0x32f6d7[_0x6628('0x25')][_0x6628('0x42')][_0x6628('0x43')](',');var _0x35f354={};_0x35f354[_0x179ccb[0x0]]={'$gte':moment(_0x179ccb[0x1])[_0x6628('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x26ff8b[_0x6628('0x3c')]=_['merge'](_0x26ff8b[_0x6628('0x3c')],_0x35f354);}_0x26ff8b=_[_0x6628('0x40')]({},_0x26ff8b,_0x32f6d7[_0x6628('0x31')]);return db[_0x6628('0x37')][_0x6628('0x14')]({'where':_0x26ff8b[_0x6628('0x3c')]})[_0x6628('0x19')](function(_0x5b977a){_0x47e0a3[_0x6628('0x14')]=_0x5b977a;if(_0x32f6d7[_0x6628('0x25')]['includeAll']){_0x26ff8b['include']=[{'all':!![]}];}return db[_0x6628('0x37')]['findAll'](_0x26ff8b);})[_0x6628('0x19')](function(_0x3904bb){_0x47e0a3[_0x6628('0x45')]=_0x3904bb;return _0x47e0a3;});}})['then'](respondWithFilteredResult(_0x1c44bb,_0x26ff8b))[_0x6628('0x26')](handleError(_0x1c44bb,null));};exports[_0x6628('0x46')]=function(_0x11de80,_0x44e685){return db[_0x6628('0x2b')][_0x6628('0x32')]({'where':{'id':_0x11de80[_0x6628('0x28')]['id']}})[_0x6628('0x19')](handleEntityNotFound(_0x44e685,null))['then'](function(_0x36f8d7){if(_0x36f8d7){return _0x36f8d7['setTags'](_0x11de80['body'][_0x6628('0x36')],_[_0x6628('0x47')](_0x11de80[_0x6628('0x34')],['ids','id'])||{})[_0x6628('0x48')](function(){return db[_0x6628('0x49')][_0x6628('0x23')]({'attributes':['id',_0x6628('0x1c'),_0x6628('0x4a')],'where':{'id':_0x11de80[_0x6628('0x34')]['ids']}});})[_0x6628('0x19')](function(_0x197b57){socket['emit'](_0x6628('0x4b'),{'id':Number(_0x11de80['params']['id']),'tags':_0x197b57||[]});return{'id':Number(_0x11de80[_0x6628('0x28')]['id']),'tags':_0x197b57||[]};});}})['then'](respondWithResult(_0x44e685,null))['catch'](handleError(_0x44e685,null));};exports[_0x6628('0x4c')]=function(_0x448443,_0x31f472){return db[_0x6628('0x2b')][_0x6628('0x32')]({'where':{'id':_0x448443[_0x6628('0x28')]['id']}})['then'](handleEntityNotFound(_0x31f472,null))[_0x6628('0x19')](function(_0x416367){if(_0x416367){return _0x416367[_0x6628('0x4c')](_0x448443['query'][_0x6628('0x36')]);}})[_0x6628('0x19')](respondWithStatusCode(_0x31f472,null))[_0x6628('0x26')](handleError(_0x31f472,null));};exports[_0x6628('0x4d')]=function(_0x3d61ca,_0x4489fa){var _0x735ca6=moment()[_0x6628('0x4e')]()[_0x6628('0x4f')]();var _0x4c8137=path[_0x6628('0x50')](config[_0x6628('0x51')],_0x6628('0x52'),_0x6628('0x53'),_0x6628('0x54'));var _0x4697d0=path[_0x6628('0x50')](_0x4c8137,_0x735ca6);var _0x1ba8c9=util[_0x6628('0x44')]('transcript-%d-%s.zip',_0x3d61ca[_0x6628('0x28')]['id'],_0x735ca6);var _0x216896=path[_0x6628('0x50')](_0x4c8137,_0x1ba8c9);var _0x1308e8=[];_0x1308e8['push']({'model':db['User'],'as':_0x6628('0x55'),'attributes':['id','fullname'],'raw':!![]});_0x1308e8[_0x6628('0x56')]({'model':db['CmContact'],'as':_0x6628('0x57'),'attributes':['id',_0x6628('0x58'),'lastName'],'raw':!![]});var _0x4feafe=[{'model':db[_0x6628('0x37')],'as':'Messages','attributes':['id',_0x6628('0x34'),'createdAt',_0x6628('0x59'),_0x6628('0x5a'),_0x6628('0x5b')],'include':_0x1308e8}];_0x4feafe[_0x6628('0x56')]({'model':db[_0x6628('0x5c')],'as':'Account','attributes':['id',_0x6628('0x1c')]});_0x4feafe['push']({'model':db[_0x6628('0x55')],'as':_0x6628('0x5d'),'attributes':['id',_0x6628('0x5e')]});return db[_0x6628('0x2b')][_0x6628('0x32')]({'where':{'id':_0x3d61ca[_0x6628('0x28')]['id']},'include':_0x4feafe})[_0x6628('0x19')](handleEntityNotFound(_0x4489fa,null))[_0x6628('0x19')](function(_0x1aed17){if(_0x1aed17){var _0x47a381=_0x1aed17[_0x6628('0x5f')]({'plain':!![]});fs[_0x6628('0x60')](_0x4697d0);var _0x28ed06={'channel':_0x6628('0x61'),'account':_0x47a381[_0x6628('0x62')]['name'],'agent':_0x47a381[_0x6628('0x5d')]?_0x47a381[_0x6628('0x5d')]['fullname']:_0x6628('0x63'),'createdAt':moment(_0x47a381[_0x6628('0x64')])[_0x6628('0x44')](_0x6628('0x65'))[_0x6628('0x4f')](),'closedAt':_0x47a381[_0x6628('0x66')]?moment(_0x47a381[_0x6628('0x67')])[_0x6628('0x44')](_0x6628('0x65'))[_0x6628('0x4f')]():'','disposition':_0x47a381[_0x6628('0x68')],'messages':_(_0x47a381[_0x6628('0x69')])[_0x6628('0x3f')]({'secret':![]})[_0x6628('0x41')](function(_0x16b7e2){return{'date':moment(_0x16b7e2[_0x6628('0x64')])['format'](_0x6628('0x65'))['toString'](),'sender':_0x16b7e2[_0x6628('0x59')]===_0x6628('0x6a')?_0x16b7e2['User']?_0x16b7e2[_0x6628('0x55')]['fullname']:_0x6628('0x6b'):_0x16b7e2[_0x6628('0x57')]['firstName']+(_0x16b7e2[_0x6628('0x57')][_0x6628('0x6c')]?'\x20'+_0x16b7e2['Contact'][_0x6628('0x6c')]:''),'body':_0x16b7e2[_0x6628('0x34')],'direction':_0x16b7e2['direction']===_0x6628('0x6a')?'A':'C','secret':_0x16b7e2[_0x6628('0x5a')],'read':_0x16b7e2[_0x6628('0x5b')]};})[_0x6628('0x6d')]()};return ejs['renderFile'](path[_0x6628('0x50')](config[_0x6628('0x51')],_0x6628('0x52'),_0x6628('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x28ed06})[_0x6628('0x19')](function(_0x90975c){var _0x534071=path['join'](_0x4697d0,_0x6628('0x6f')+_0x47a381['id']+'-'+_0x735ca6+_0x6628('0x70'));var _0x3af5e5={'path':_0x534071,'channel':_0x6628('0x61'),'interactionId':_0x47a381['id']};return pdf['createPdfFromHTML'](_0x90975c,_0x3af5e5);})[_0x6628('0x19')](function(){return new BPromise(function(_0x403afb,_0x4352fb){zipdir(_0x4697d0,{'saveTo':_0x216896},function(_0x211d86,_0x1d943a){if(_0x211d86)return _0x4352fb(_0x211d86);return _0x403afb(_0x1d943a);});})[_0x6628('0x19')](function(){return new BPromise(function(_0xcb5a8,_0x488a1d){rimraf(_0x4697d0,function(_0x1003d6){if(_0x1003d6)_0x488a1d(_0x1003d6);return _0xcb5a8();});});})[_0x6628('0x19')](function(){return _0x4489fa[_0x6628('0x4d')](_0x216896,_0x1ba8c9,function(_0xeefe59){if(_0xeefe59){console[_0x6628('0x71')](_0x6628('0x72'),_0xeefe59);}else{fs[_0x6628('0x73')](_0x216896);}});});});}else{return _0x4489fa[_0x6628('0xe')](0xc8);}})[_0x6628('0x26')](handleError(_0x4489fa,null));}; \ No newline at end of file +var _0xf81f=['Messages','System','firstName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','SmsInteraction','type','key','getOptions','findAll','query','user','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','length','nolimit','order','sort','where','filters','pick','SmsInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','createdAt','direction','secret','read','Account','get','mkdirSync','Owner','N.A.','disposition'];(function(_0x2a275e,_0x5aa79b){var _0x2287fe=function(_0x2f2a70){while(--_0x2f2a70){_0x2a275e['push'](_0x2a275e['shift']());}};_0x2287fe(++_0x5aa79b);}(_0xf81f,0xfc));var _0xff81=function(_0x5f07f6,_0x22b465){_0x5f07f6=_0x5f07f6-0x0;var _0x5c7947=_0xf81f[_0x5f07f6];return _0x5c7947;};'use strict';var rimraf=require(_0xff81('0x0'));var zipdir=require(_0xff81('0x1'));var moment=require(_0xff81('0x2'));var BPromise=require(_0xff81('0x3'));var util=require(_0xff81('0x4'));var path=require(_0xff81('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xff81('0x6'));var qs=require(_0xff81('0x7'));var pdf=require(_0xff81('0x8'));var logger=require(_0xff81('0x9'))('api');var config=require(_0xff81('0xa'));var db=require(_0xff81('0xb'))['db'];config[_0xff81('0xc')]=_['defaults'](config['redis'],{'host':_0xff81('0xd'),'port':0x18eb});var socket=require(_0xff81('0xe'))(new Redis(config[_0xff81('0xc')]));require(_0xff81('0xf'))[_0xff81('0x10')](socket);function respondWithStatusCode(_0x464fc8,_0x365e5f){_0x365e5f=_0x365e5f||0xcc;return function(_0x45a94c){if(_0x45a94c){return _0x464fc8[_0xff81('0x11')](_0x365e5f);}return _0x464fc8[_0xff81('0x12')](_0x365e5f)['end']();};}function respondWithResult(_0xf487e9,_0x129e2d){_0x129e2d=_0x129e2d||0xc8;return function(_0x23e2b5){if(_0x23e2b5){return _0xf487e9[_0xff81('0x12')](_0x129e2d)[_0xff81('0x13')](_0x23e2b5);}};}function respondWithFilteredResult(_0x119f14,_0xd71d4b){return function(_0x4d9a3b){if(_0x4d9a3b){var _0x4be67c=typeof _0xd71d4b[_0xff81('0x14')]===_0xff81('0x15')&&typeof _0xd71d4b[_0xff81('0x16')]===_0xff81('0x15');var _0x240636=_0x4d9a3b[_0xff81('0x17')];var _0x47c943=_0x4be67c?0x0:_0xd71d4b[_0xff81('0x14')];var _0x2c2968=_0x4be67c?_0x4d9a3b[_0xff81('0x17')]:_0xd71d4b['offset']+_0xd71d4b['limit'];var _0x580968;if(_0x2c2968>=_0x240636){_0x2c2968=_0x240636;_0x580968=0xc8;}else{_0x580968=0xce;}_0x119f14['status'](_0x580968);return _0x119f14[_0xff81('0x18')](_0xff81('0x19'),_0x47c943+'-'+_0x2c2968+'/'+_0x240636)['json'](_0x4d9a3b);}return null;};}function saveUpdates(_0x917498){return function(_0x455bf4){if(_0x455bf4){return _0x455bf4[_0xff81('0x1a')](_0x917498)[_0xff81('0x1b')](function(_0xbb170d){return _0xbb170d;});}return null;};}function removeEntity(_0x3996ec){return function(_0x5ad290){if(_0x5ad290){return _0x5ad290[_0xff81('0x1c')]()[_0xff81('0x1b')](function(){_0x3996ec[_0xff81('0x12')](0xcc)[_0xff81('0x1d')]();});}};}function handleEntityNotFound(_0x5e9b08){return function(_0x5c75de){if(!_0x5c75de){_0x5e9b08[_0xff81('0x11')](0x194);}return _0x5c75de;};}function handleError(_0x558312,_0x272cc8){_0x272cc8=_0x272cc8||0x1f4;return function(_0x1c28f5){logger[_0xff81('0x1e')](_0x1c28f5['stack']);if(_0x1c28f5[_0xff81('0x1f')]){delete _0x1c28f5[_0xff81('0x1f')];}_0x558312[_0xff81('0x12')](_0x272cc8)[_0xff81('0x20')](_0x1c28f5);};}exports[_0xff81('0x21')]=function(_0x6f881f,_0x40eff2){var _0x16179b={};var _0x2a91db=_['map'](db[_0xff81('0x22')]['rawAttributes'],function(_0x2e734d){return{'name':_0x2e734d['fieldName'],'type':_0x2e734d[_0xff81('0x23')][_0xff81('0x24')]};});_0x16179b=qs[_0xff81('0x25')](_0x2a91db,_0x6f881f);return interaction[_0xff81('0x26')]('sms',_0x6f881f[_0xff81('0x27')],_0x6f881f[_0xff81('0x28')],_0x16179b,_0x2a91db)[_0xff81('0x1b')](respondWithFilteredResult(_0x40eff2,_0x16179b))[_0xff81('0x29')](handleError(_0x40eff2,null));};exports[_0xff81('0x2a')]=function(_0x2d3afe,_0x326d3c){var _0x1f861b={'raw':![],'where':{'id':_0x2d3afe[_0xff81('0x2b')]['id']}},_0x214fb1={};_0x214fb1[_0xff81('0x2c')]=_[_0xff81('0x2d')](db[_0xff81('0x22')][_0xff81('0x2e')]);_0x214fb1[_0xff81('0x27')]=_['keys'](_0x2d3afe[_0xff81('0x27')]);_0x214fb1['filters']=_[_0xff81('0x2f')](_0x214fb1['model'],_0x214fb1['query']);_0x1f861b[_0xff81('0x30')]=_[_0xff81('0x2f')](_0x214fb1['model'],qs['fields'](_0x2d3afe[_0xff81('0x27')][_0xff81('0x31')]));_0x1f861b[_0xff81('0x30')]=_0x1f861b[_0xff81('0x30')]['length']?_0x1f861b['attributes']:_0x214fb1['model'];if(_0x2d3afe[_0xff81('0x27')][_0xff81('0x32')]){_0x1f861b[_0xff81('0x33')]=[{'all':!![]}];}_0x1f861b=_[_0xff81('0x34')]({},_0x1f861b,_0x2d3afe[_0xff81('0x35')]);return db[_0xff81('0x22')][_0xff81('0x36')](_0x1f861b)[_0xff81('0x1b')](handleEntityNotFound(_0x326d3c,null))[_0xff81('0x1b')](respondWithResult(_0x326d3c,null))['catch'](handleError(_0x326d3c,null));};exports[_0xff81('0x37')]=function(_0x2a3100,_0x59f790){return db[_0xff81('0x22')][_0xff81('0x37')](_0x2a3100[_0xff81('0x38')],{})[_0xff81('0x1b')](respondWithResult(_0x59f790,0xc9))[_0xff81('0x29')](handleError(_0x59f790,null));};exports['update']=function(_0x2f5458,_0x42c312){if(_0x2f5458['body']['id']){delete _0x2f5458[_0xff81('0x38')]['id'];}return db[_0xff81('0x22')]['find']({'where':{'id':_0x2f5458[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x42c312,null))['then'](saveUpdates(_0x2f5458['body'],null))[_0xff81('0x1b')](respondWithResult(_0x42c312,null))['catch'](handleError(_0x42c312,null));};exports[_0xff81('0x1c')]=function(_0x3dcb13,_0x215392){return db[_0xff81('0x22')][_0xff81('0x36')]({'where':{'id':_0x3dcb13[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x215392,null))['then'](removeEntity(_0x215392,null))[_0xff81('0x29')](handleError(_0x215392,null));};exports[_0xff81('0x39')]=function(_0x1c0ba9,_0x260627){return db[_0xff81('0x22')][_0xff81('0x39')]()[_0xff81('0x1b')](respondWithResult(_0x260627,null))[_0xff81('0x29')](handleError(_0x260627,null));};exports[_0xff81('0x3a')]=function(_0x2755f5,_0x5e1199){return db[_0xff81('0x3b')][_0xff81('0x36')]({'where':{'id':_0x2755f5[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x5e1199,null))[_0xff81('0x1b')](function(_0x44785e){if(_0x44785e){return _0x44785e[_0xff81('0x3a')](_0x2755f5[_0xff81('0x38')]['ids'],_['omit'](_0x2755f5[_0xff81('0x38')],[_0xff81('0x3c'),'id'])||{});}})[_0xff81('0x1b')](respondWithResult(_0x5e1199,null))[_0xff81('0x29')](handleError(_0x5e1199,null));};exports['getMessages']=function(_0xb1153b,_0x325ab0){var _0x46add9={'raw':![],'where':{}};var _0x354c43={};var _0xad4cc4={'count':0x0,'rows':[]};return db[_0xff81('0x22')]['findOne']({'where':{'id':_0xb1153b['params']['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x325ab0,null))[_0xff81('0x1b')](function(_0x2fce75){if(_0x2fce75){_0x354c43[_0xff81('0x2c')]=_['keys'](db[_0xff81('0x3b')][_0xff81('0x2e')]);_0x354c43['query']=_['keys'](_0xb1153b[_0xff81('0x27')]);_0x354c43['filters']=_[_0xff81('0x2f')](_0x354c43[_0xff81('0x2c')],_0x354c43[_0xff81('0x27')]);_0x46add9[_0xff81('0x30')]=_[_0xff81('0x2f')](_0x354c43[_0xff81('0x2c')],qs[_0xff81('0x31')](_0xb1153b[_0xff81('0x27')][_0xff81('0x31')]));_0x46add9[_0xff81('0x30')]=_0x46add9['attributes'][_0xff81('0x3d')]?_0x46add9['attributes']:_0x354c43[_0xff81('0x2c')];if(!_0xb1153b[_0xff81('0x27')]['hasOwnProperty'](_0xff81('0x3e'))){_0x46add9[_0xff81('0x16')]=qs[_0xff81('0x16')](_0xb1153b[_0xff81('0x27')]['limit']);_0x46add9[_0xff81('0x14')]=qs[_0xff81('0x14')](_0xb1153b['query'][_0xff81('0x14')]);}_0x46add9[_0xff81('0x3f')]=qs['sort'](_0xb1153b[_0xff81('0x27')][_0xff81('0x40')]);_0x46add9[_0xff81('0x41')]=qs[_0xff81('0x42')](_[_0xff81('0x43')](_0xb1153b['query'],_0x354c43['filters']));_0x46add9[_0xff81('0x41')][_0xff81('0x44')]=_0x2fce75['id'];if(_0xb1153b['query']['filter']){_0x46add9[_0xff81('0x41')]=_[_0xff81('0x34')](_0x46add9[_0xff81('0x41')],{'$or':_[_0xff81('0x45')](_0x46add9[_0xff81('0x30')],function(_0x29dbd2){var _0x393c8f={};_0x393c8f[_0x29dbd2]={'$like':'%'+_0xb1153b['query'][_0xff81('0x46')]+'%'};return _0x393c8f;})});}if(_0xb1153b[_0xff81('0x27')][_0xff81('0x47')]){var _0x31b169=_0xb1153b[_0xff81('0x27')][_0xff81('0x47')][_0xff81('0x48')](',');var _0x3a78ca={};_0x3a78ca[_0x31b169[0x0]]={'$gte':moment(_0x31b169[0x1])[_0xff81('0x49')](_0xff81('0x4a'))};_0x46add9['where']=_[_0xff81('0x34')](_0x46add9[_0xff81('0x41')],_0x3a78ca);}_0x46add9=_['merge']({},_0x46add9,_0xb1153b[_0xff81('0x35')]);return db['SmsMessage']['count']({'where':_0x46add9[_0xff81('0x41')]})[_0xff81('0x1b')](function(_0x3d19cd){_0xad4cc4[_0xff81('0x17')]=_0x3d19cd;if(_0xb1153b[_0xff81('0x27')][_0xff81('0x32')]){_0x46add9[_0xff81('0x33')]=[{'all':!![]}];}return db[_0xff81('0x3b')]['findAll'](_0x46add9);})[_0xff81('0x1b')](function(_0x2f5505){_0xad4cc4[_0xff81('0x4b')]=_0x2f5505;return _0xad4cc4;});}})[_0xff81('0x1b')](respondWithFilteredResult(_0x325ab0,_0x46add9))[_0xff81('0x29')](handleError(_0x325ab0,null));};exports['addTags']=function(_0x293012,_0x316e38){return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x293012[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x316e38,null))['then'](function(_0x1e6ebe){if(_0x1e6ebe){return _0x1e6ebe['setTags'](_0x293012['body'][_0xff81('0x3c')],_[_0xff81('0x4c')](_0x293012[_0xff81('0x38')],[_0xff81('0x3c'),'id'])||{})[_0xff81('0x4d')](function(){return db['Tag'][_0xff81('0x26')]({'attributes':['id',_0xff81('0x1f'),_0xff81('0x4e')],'where':{'id':_0x293012['body']['ids']}});})[_0xff81('0x1b')](function(_0x4512a1){socket[_0xff81('0x4f')](_0xff81('0x50'),{'id':Number(_0x293012['params']['id']),'tags':_0x4512a1||[]});return{'id':Number(_0x293012[_0xff81('0x2b')]['id']),'tags':_0x4512a1||[]};});}})[_0xff81('0x1b')](respondWithResult(_0x316e38,null))['catch'](handleError(_0x316e38,null));};exports[_0xff81('0x51')]=function(_0x34caa4,_0x487a7b){return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x34caa4[_0xff81('0x2b')]['id']}})[_0xff81('0x1b')](handleEntityNotFound(_0x487a7b,null))[_0xff81('0x1b')](function(_0x320509){if(_0x320509){return _0x320509[_0xff81('0x51')](_0x34caa4[_0xff81('0x27')]['ids']);}})[_0xff81('0x1b')](respondWithStatusCode(_0x487a7b,null))['catch'](handleError(_0x487a7b,null));};exports[_0xff81('0x52')]=function(_0x335726,_0x201be5){var _0x2aa692=moment()['unix']()[_0xff81('0x53')]();var _0x557659=path[_0xff81('0x54')](config[_0xff81('0x55')],_0xff81('0x56'),'files',_0xff81('0x57'));var _0x2a08da=path[_0xff81('0x54')](_0x557659,_0x2aa692);var _0x33235e=util[_0xff81('0x49')](_0xff81('0x58'),_0x335726[_0xff81('0x2b')]['id'],_0x2aa692);var _0x5c542c=path[_0xff81('0x54')](_0x557659,_0x33235e);var _0x130f92=[];_0x130f92[_0xff81('0x59')]({'model':db['User'],'as':_0xff81('0x5a'),'attributes':['id',_0xff81('0x5b')],'raw':!![]});_0x130f92[_0xff81('0x59')]({'model':db[_0xff81('0x5c')],'as':_0xff81('0x5d'),'attributes':['id','firstName',_0xff81('0x5e')],'raw':!![]});var _0x54f0dd=[{'model':db[_0xff81('0x3b')],'as':'Messages','attributes':['id',_0xff81('0x38'),_0xff81('0x5f'),_0xff81('0x60'),_0xff81('0x61'),_0xff81('0x62')],'include':_0x130f92}];_0x54f0dd[_0xff81('0x59')]({'model':db['SmsAccount'],'as':_0xff81('0x63'),'attributes':['id',_0xff81('0x1f')]});_0x54f0dd[_0xff81('0x59')]({'model':db[_0xff81('0x5a')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xff81('0x36')]({'where':{'id':_0x335726[_0xff81('0x2b')]['id']},'include':_0x54f0dd})[_0xff81('0x1b')](handleEntityNotFound(_0x201be5,null))['then'](function(_0x471dde){if(_0x471dde){var _0x1ab5ba=_0x471dde[_0xff81('0x64')]({'plain':!![]});fs[_0xff81('0x65')](_0x2a08da);var _0x24b797={'channel':'Sms','account':_0x1ab5ba[_0xff81('0x63')]['name'],'agent':_0x1ab5ba['Owner']?_0x1ab5ba[_0xff81('0x66')][_0xff81('0x5b')]:_0xff81('0x67'),'createdAt':moment(_0x1ab5ba[_0xff81('0x5f')])['format'](_0xff81('0x4a'))[_0xff81('0x53')](),'closedAt':_0x1ab5ba['closed']?moment(_0x1ab5ba['closedAt'])[_0xff81('0x49')](_0xff81('0x4a'))[_0xff81('0x53')]():'','disposition':_0x1ab5ba[_0xff81('0x68')],'messages':_(_0x1ab5ba[_0xff81('0x69')])[_0xff81('0x46')]({'secret':![]})[_0xff81('0x45')](function(_0x28516){return{'date':moment(_0x28516[_0xff81('0x5f')])['format'](_0xff81('0x4a'))['toString'](),'sender':_0x28516['direction']==='out'?_0x28516['User']?_0x28516[_0xff81('0x5a')][_0xff81('0x5b')]:_0xff81('0x6a'):_0x28516[_0xff81('0x5d')][_0xff81('0x6b')]+(_0x28516[_0xff81('0x5d')][_0xff81('0x5e')]?'\x20'+_0x28516[_0xff81('0x5d')][_0xff81('0x5e')]:''),'body':_0x28516[_0xff81('0x38')],'direction':_0x28516[_0xff81('0x60')]===_0xff81('0x6c')?'A':'C','secret':_0x28516['secret'],'read':_0x28516['read']};})[_0xff81('0x6d')]()};return ejs[_0xff81('0x6e')](path[_0xff81('0x54')](config[_0xff81('0x55')],'server',_0xff81('0x6f'),_0xff81('0x70')),{'interaction':_0x24b797})[_0xff81('0x1b')](function(_0x29efaf){var _0x16e886=path[_0xff81('0x54')](_0x2a08da,_0xff81('0x71')+_0x1ab5ba['id']+'-'+_0x2aa692+'.pdf');var _0x45c829={'path':_0x16e886,'channel':_0xff81('0x72'),'interactionId':_0x1ab5ba['id']};return pdf[_0xff81('0x73')](_0x29efaf,_0x45c829);})[_0xff81('0x1b')](function(){return new BPromise(function(_0x589c61,_0x55ff1c){zipdir(_0x2a08da,{'saveTo':_0x5c542c},function(_0x4677a2,_0x15f82){if(_0x4677a2)return _0x55ff1c(_0x4677a2);return _0x589c61(_0x15f82);});})[_0xff81('0x1b')](function(){return new BPromise(function(_0x46f41b,_0x7878a4){rimraf(_0x2a08da,function(_0x5b87f8){if(_0x5b87f8)_0x7878a4(_0x5b87f8);return _0x46f41b();});});})[_0xff81('0x1b')](function(){return _0x201be5[_0xff81('0x52')](_0x5c542c,_0x33235e,function(_0x4b7e7b){if(_0x4b7e7b){console[_0xff81('0x74')](_0xff81('0x75'),_0x4b7e7b);}else{fs[_0xff81('0x76')](_0x5c542c);}});});});}else{return _0x201be5[_0xff81('0x11')](0xc8);}})['catch'](handleError(_0x201be5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5209efa..a1f7de4 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x40eb9b,_0x23f5e4){var _0x272c73=function(_0x5aff2d){while(--_0x5aff2d){_0x40eb9b['push'](_0x40eb9b['shift']());}};_0x272c73(++_0x23f5e4);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x12e329,_0x2e0f60){_0x12e329=_0x12e329-0x0;var _0x467977=_0xdd4f[_0x12e329];return _0x467977;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x4d30bb,_0x429e29){var _0x252221=function(_0x49789f){while(--_0x49789f){_0x4d30bb['push'](_0x4d30bb['shift']());}};_0x252221(++_0x429e29);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5c206f,_0x2e4f65){_0x5c206f=_0x5c206f-0x0;var _0x3ef9e7=_0xdd4f[_0x5c206f];return _0x3ef9e7;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 74c8d43..0d4fd15 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 _0x551b=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0xa4d0ff,_0x4f5ee3){var _0x25afc4=function(_0x2d7fbc){while(--_0x2d7fbc){_0xa4d0ff['push'](_0xa4d0ff['shift']());}};_0x25afc4(++_0x4f5ee3);}(_0x551b,0x1ce));var _0xb551=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x551b[_0x20aadb];return _0x520018;};'use strict';var _=require(_0xb551('0x0'));var util=require(_0xb551('0x1'));var logger=require(_0xb551('0x2'))(_0xb551('0x3'));var moment=require(_0xb551('0x4'));var BPromise=require('bluebird');var rp=require(_0xb551('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb551('0x6'));var config=require(_0xb551('0x7'));var attributes=require(_0xb551('0x8'));module[_0xb551('0x9')]=function(_0x3208e9,_0x2b6dcb){return _0x3208e9[_0xb551('0xa')](_0xb551('0xb'),attributes,{'tableName':_0xb551('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f23aa,_0x15aab2,_0x16be2f){if(_0x5f23aa[_0xb551('0xd')](_0xb551('0xe'))){_0x5f23aa['closedAt']=moment()[_0xb551('0xf')](_0xb551('0x10'));}_0x16be2f(null,_0x5f23aa);}}});}; \ No newline at end of file +var _0xc113=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x47201e,_0x4d8da2){var _0x87043=function(_0x2544c0){while(--_0x2544c0){_0x47201e['push'](_0x47201e['shift']());}};_0x87043(++_0x4d8da2);}(_0xc113,0xfe));var _0x3c11=function(_0x143288,_0x238f3e){_0x143288=_0x143288-0x0;var _0x1f3742=_0xc113[_0x143288];return _0x1f3742;};'use strict';var _=require('lodash');var util=require(_0x3c11('0x0'));var logger=require(_0x3c11('0x1'))(_0x3c11('0x2'));var moment=require(_0x3c11('0x3'));var BPromise=require(_0x3c11('0x4'));var rp=require(_0x3c11('0x5'));var fs=require('fs');var path=require(_0x3c11('0x6'));var rimraf=require(_0x3c11('0x7'));var config=require(_0x3c11('0x8'));var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x49aa61,_0x8c43cc){return _0x49aa61[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16cc84,_0x5e2c76,_0x290640){if(_0x16cc84[_0x3c11('0xd')]('closed')){_0x16cc84[_0x3c11('0xe')]=moment()[_0x3c11('0xf')](_0x3c11('0x10'));}_0x290640(null,_0x16cc84);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d2258f3..f421bfa 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 _0xd45b=['UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsInteraction','body','options','raw','where','limit','debug'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0xd45b,0x198));var _0xbd45=function(_0x2e5099,_0x17c7a4){_0x2e5099=_0x2e5099-0x0;var _0x263475=_0xd45b[_0x2e5099];return _0x263475;};'use strict';var _=require(_0xbd45('0x0'));var util=require(_0xbd45('0x1'));var moment=require(_0xbd45('0x2'));var BPromise=require(_0xbd45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd45('0x4'));var db=require(_0xbd45('0x5'))['db'];var utils=require(_0xbd45('0x6'));var logger=require('../../config/logger')(_0xbd45('0x7'));var config=require(_0xbd45('0x8'));var jayson=require(_0xbd45('0x9'));var client=jayson[_0xbd45('0xa')][_0xbd45('0xb')]({'port':0x232a});config[_0xbd45('0xc')]=_['defaults'](config[_0xbd45('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd45('0xd'))(new Redis(config[_0xbd45('0xc')]));require(_0xbd45('0xe'))['register'](socket);function respondWithRpcPromise(_0x35f4e8,_0x408b28,_0x11bfb4){return new BPromise(function(_0x425876,_0x250c0d){return client['request'](_0x35f4e8,_0x11bfb4)[_0xbd45('0xf')](function(_0x161022){logger[_0xbd45('0x10')](_0xbd45('0x11'),_0x408b28,'request\x20sent');logger['debug'](_0xbd45('0x12'),_0x408b28,_0xbd45('0x13'),JSON[_0xbd45('0x14')](_0x161022));if(_0x161022[_0xbd45('0x15')]){if(_0x161022[_0xbd45('0x15')]['code']===0x1f4){logger['error'](_0xbd45('0x11'),_0x408b28,_0x161022[_0xbd45('0x15')]['message']);return _0x250c0d(_0x161022['error']['message']);}logger[_0xbd45('0x15')](_0xbd45('0x11'),_0x408b28,_0x161022[_0xbd45('0x15')]['message']);return _0x425876(_0x161022[_0xbd45('0x15')][_0xbd45('0x16')]);}else{logger[_0xbd45('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x408b28,_0xbd45('0x13'));_0x425876(_0x161022[_0xbd45('0x17')][_0xbd45('0x16')]);}})[_0xbd45('0x18')](function(_0x263dba){logger[_0xbd45('0x15')](_0xbd45('0x11'),_0x408b28,_0x263dba);_0x250c0d(_0x263dba);});});}exports['UpdateSmsInteraction']=function(_0x2c220f){var _0x4f0dd4=this;return new Promise(function(_0x42989b,_0x37b5d2){return db[_0xbd45('0x19')]['update'](_0x2c220f[_0xbd45('0x1a')],{'raw':_0x2c220f[_0xbd45('0x1b')]?_0x2c220f[_0xbd45('0x1b')][_0xbd45('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c220f['options']?_0x2c220f[_0xbd45('0x1b')][_0xbd45('0x1d')]||null:null,'attributes':_0x2c220f[_0xbd45('0x1b')]?_0x2c220f['options']['attributes']||null:null,'limit':_0x2c220f['options']?_0x2c220f['options'][_0xbd45('0x1e')]||null:null})['then'](function(_0x1cd758){logger[_0xbd45('0x10')]('UpdateSmsInteraction',_0x2c220f);logger[_0xbd45('0x1f')]('UpdateSmsInteraction',_0x2c220f,JSON['stringify'](_0x1cd758));_0x42989b(_0x1cd758);})['catch'](function(_0x3351e6){logger[_0xbd45('0x15')](_0xbd45('0x20'),_0x3351e6[_0xbd45('0x16')],_0x2c220f);_0x37b5d2(_0x4f0dd4['error'](0x1f4,_0x3351e6[_0xbd45('0x16')]));});});};exports[_0xbd45('0x21')]=function(_0x9a15a){return new Promise(function(_0x519fd8,_0x2badb6){return db[_0xbd45('0x19')][_0xbd45('0x22')]({'where':_0x9a15a[_0xbd45('0x1b')]?_0x9a15a[_0xbd45('0x1b')][_0xbd45('0x1d')]||null:null})[_0xbd45('0xf')](function(_0x104e80){if(_0x104e80){return _0x104e80[_0xbd45('0x23')](_0x9a15a[_0xbd45('0x1a')][_0xbd45('0x24')],_[_0xbd45('0x25')](_0x9a15a[_0xbd45('0x1a')],[_0xbd45('0x24'),'id'])||{});}})[_0xbd45('0x26')](function(_0x331888){logger[_0xbd45('0x10')](_0xbd45('0x27'),_0x9a15a);logger[_0xbd45('0x1f')]('AddTags',_0x9a15a,JSON[_0xbd45('0x14')](_0x331888));_0x519fd8(_0x331888);})[_0xbd45('0x18')](function(_0x36816c){logger[_0xbd45('0x15')](_0xbd45('0x27'),_0x36816c[_0xbd45('0x16')],_0x9a15a);_0x2badb6(_this[_0xbd45('0x15')](0x1f4,_0x36816c['message']));});});}; \ No newline at end of file +var _0xb6d3=['info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','then','AddTagsToSmsInteraction','find','addTags','omit','spread','stringify','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x51d651,_0x5657e3){var _0x14e40a=function(_0x30b961){while(--_0x30b961){_0x51d651['push'](_0x51d651['shift']());}};_0x14e40a(++_0x5657e3);}(_0xb6d3,0xe9));var _0x3b6d=function(_0x125e3c,_0x59cbb3){_0x125e3c=_0x125e3c-0x0;var _0x15e625=_0xb6d3[_0x125e3c];return _0x15e625;};'use strict';var _=require(_0x3b6d('0x0'));var util=require('util');var moment=require(_0x3b6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b6d('0x4'));var config=require(_0x3b6d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3b6d('0x6')][_0x3b6d('0x7')]({'port':0x232a});config['redis']=_[_0x3b6d('0x8')](config['redis'],{'host':_0x3b6d('0x9'),'port':0x18eb});var socket=require(_0x3b6d('0xa'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x3b6d('0xb')](socket);function respondWithRpcPromise(_0x16a9ab,_0x5f1169,_0x1ca188){return new BPromise(function(_0x38a9de,_0x1f4137){return client[_0x3b6d('0xc')](_0x16a9ab,_0x1ca188)['then'](function(_0x2e5039){logger['info'](_0x3b6d('0xd'),_0x5f1169,_0x3b6d('0xe'));logger[_0x3b6d('0xf')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5f1169,'request\x20sent',JSON['stringify'](_0x2e5039));if(_0x2e5039[_0x3b6d('0x10')]){if(_0x2e5039[_0x3b6d('0x10')][_0x3b6d('0x11')]===0x1f4){logger['error'](_0x3b6d('0xd'),_0x5f1169,_0x2e5039['error'][_0x3b6d('0x12')]);return _0x1f4137(_0x2e5039['error']['message']);}logger[_0x3b6d('0x10')](_0x3b6d('0xd'),_0x5f1169,_0x2e5039[_0x3b6d('0x10')]['message']);return _0x38a9de(_0x2e5039[_0x3b6d('0x10')][_0x3b6d('0x12')]);}else{logger[_0x3b6d('0x13')](_0x3b6d('0xd'),_0x5f1169,'request\x20sent');_0x38a9de(_0x2e5039[_0x3b6d('0x14')][_0x3b6d('0x12')]);}})[_0x3b6d('0x15')](function(_0x4a1b5a){logger['error'](_0x3b6d('0xd'),_0x5f1169,_0x4a1b5a);_0x1f4137(_0x4a1b5a);});});}exports[_0x3b6d('0x16')]=function(_0x2f96e0){var _0x4c4ec8=this;return new Promise(function(_0x514a2e,_0x5a2013){return db[_0x3b6d('0x17')][_0x3b6d('0x18')](_0x2f96e0[_0x3b6d('0x19')],{'raw':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0[_0x3b6d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0['options'][_0x3b6d('0x1b')]||null:null,'attributes':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0[_0x3b6d('0x1a')]['attributes']||null:null,'limit':_0x2f96e0[_0x3b6d('0x1a')]?_0x2f96e0['options'][_0x3b6d('0x1c')]||null:null})[_0x3b6d('0x1d')](function(_0x10802a){logger[_0x3b6d('0x13')](_0x3b6d('0x16'),_0x2f96e0);logger['debug'](_0x3b6d('0x16'),_0x2f96e0,JSON['stringify'](_0x10802a));_0x514a2e(_0x10802a);})[_0x3b6d('0x15')](function(_0x17be35){logger[_0x3b6d('0x10')](_0x3b6d('0x16'),_0x17be35[_0x3b6d('0x12')],_0x2f96e0);_0x5a2013(_0x4c4ec8['error'](0x1f4,_0x17be35['message']));});});};exports[_0x3b6d('0x1e')]=function(_0x4ceb7d){return new Promise(function(_0x4c2675,_0x1cd3cf){return db[_0x3b6d('0x17')][_0x3b6d('0x1f')]({'where':_0x4ceb7d[_0x3b6d('0x1a')]?_0x4ceb7d['options'][_0x3b6d('0x1b')]||null:null})[_0x3b6d('0x1d')](function(_0x30c117){if(_0x30c117){return _0x30c117[_0x3b6d('0x20')](_0x4ceb7d[_0x3b6d('0x19')]['ids'],_[_0x3b6d('0x21')](_0x4ceb7d[_0x3b6d('0x19')],['ids','id'])||{});}})[_0x3b6d('0x22')](function(_0x502845){logger[_0x3b6d('0x13')]('AddTags',_0x4ceb7d);logger[_0x3b6d('0xf')]('AddTags',_0x4ceb7d,JSON[_0x3b6d('0x23')](_0x502845));_0x4c2675(_0x502845);})['catch'](function(_0x423422){logger[_0x3b6d('0x10')]('AddTags',_0x423422[_0x3b6d('0x12')],_0x4ceb7d);_0x1cd3cf(_this['error'](0x1f4,_0x423422[_0x3b6d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 07ee717..8e4d181 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 _0xa3cb=['smsInteraction:','remove','emit','removeListener','register'];(function(_0x48b016,_0x40a81c){var _0x3a5e01=function(_0x10d2f0){while(--_0x10d2f0){_0x48b016['push'](_0x48b016['shift']());}};_0x3a5e01(++_0x40a81c);}(_0xa3cb,0x1c8));var _0xba3c=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0xa3cb[_0x5db99b];return _0x4b2d0e;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xba3c('0x0'),'update'];function createListener(_0x47e44c,_0x175b31){return function(_0x3fe462){_0x175b31[_0xba3c('0x1')](_0x47e44c,_0x3fe462);};}function removeListener(_0x22d762,_0x491676){return function(){SmsInteractionEvents[_0xba3c('0x2')](_0x22d762,_0x491676);};}exports[_0xba3c('0x3')]=function(_0x5d6355){for(var _0xbee205=0x0,_0x51b240=events['length'];_0xbee205<_0x51b240;_0xbee205++){var _0x46752f=events[_0xbee205];var _0x2120d7=createListener(_0xba3c('0x4')+_0x46752f,_0x5d6355);SmsInteractionEvents['on'](_0x46752f,_0x2120d7);}}; \ No newline at end of file +var _0x1e03=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x1ae802,_0x75149d){var _0x15404e=function(_0x3d6b8b){while(--_0x3d6b8b){_0x1ae802['push'](_0x1ae802['shift']());}};_0x15404e(++_0x75149d);}(_0x1e03,0x1bd));var _0x31e0=function(_0x26a844,_0x18c9bc){_0x26a844=_0x26a844-0x0;var _0x19b920=_0x1e03[_0x26a844];return _0x19b920;};'use strict';var SmsInteractionEvents=require(_0x31e0('0x0'));var events=['save',_0x31e0('0x1'),_0x31e0('0x2')];function createListener(_0x3d3e58,_0x1c23ad){return function(_0x2a6dc8){_0x1c23ad[_0x31e0('0x3')](_0x3d3e58,_0x2a6dc8);};}function removeListener(_0x1ed893,_0x3c23de){return function(){SmsInteractionEvents[_0x31e0('0x4')](_0x1ed893,_0x3c23de);};}exports[_0x31e0('0x5')]=function(_0x43fc2f){for(var _0x2a750a=0x0,_0x53f315=events['length'];_0x2a750a<_0x53f315;_0x2a750a++){var _0x3fa110=events[_0x2a750a];var _0x5cab3c=createListener(_0x31e0('0x6')+_0x3fa110,_0x43fc2f);SmsInteractionEvents['on'](_0x3fa110,_0x5cab3c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ca11c65..85f02cf 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 _0xfabf=['/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','/describe','describe','show','tracked','smsmessage:create','create','post','/:id/status','status','update','/:id/accept','isAuthenticated','accept','put','/:id/reject','reject','delete'];(function(_0x2453d0,_0x1b2017){var _0x521fc8=function(_0xfc824f){while(--_0xfc824f){_0x2453d0['push'](_0x2453d0['shift']());}};_0x521fc8(++_0x1b2017);}(_0xfabf,0x11a));var _0xffab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfabf[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xffab('0x0'));var util=require(_0xffab('0x1'));var path=require(_0xffab('0x2'));var timeout=require(_0xffab('0x3'));var express=require(_0xffab('0x4'));var router=express['Router']();var fs_extra=require(_0xffab('0x5'));var auth=require(_0xffab('0x6'));var interaction=require(_0xffab('0x7'));var config=require('../../config/environment');var controller=require(_0xffab('0x8'));router[_0xffab('0x9')]('/',auth['isAuthenticated'](),controller[_0xffab('0xa')]);router[_0xffab('0x9')](_0xffab('0xb'),auth['isAuthenticated'](),controller[_0xffab('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xffab('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xffab('0xe')]('sms',_0xffab('0xf')),controller[_0xffab('0x10')]);router[_0xffab('0x11')](_0xffab('0x12'),controller[_0xffab('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xffab('0x14')]);router['put'](_0xffab('0x15'),auth[_0xffab('0x16')](),controller[_0xffab('0x17')]);router[_0xffab('0x18')](_0xffab('0x19'),auth[_0xffab('0x16')](),controller[_0xffab('0x1a')]);router[_0xffab('0x1b')](_0xffab('0x1c'),auth[_0xffab('0x16')](),controller[_0xffab('0x1d')]);module[_0xffab('0x1e')]=router; \ No newline at end of file +var _0x6c1c=['/:id/reject','reject','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','/describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c1c,0x124));var _0xc6c1=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x6c1c[_0x1ac6e5];return _0x5877dc;};'use strict';var multer=require(_0xc6c1('0x0'));var util=require(_0xc6c1('0x1'));var path=require('path');var timeout=require(_0xc6c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc6c1('0x3'));var auth=require(_0xc6c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6c1('0x5'));var controller=require(_0xc6c1('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc6c1('0x7')](_0xc6c1('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc6c1('0x9'),auth[_0xc6c1('0xa')](),controller[_0xc6c1('0xb')]);router[_0xc6c1('0xc')]('/',auth['isAuthenticated'](),interaction[_0xc6c1('0xd')](_0xc6c1('0xe'),_0xc6c1('0xf')),controller['create']);router['post'](_0xc6c1('0x10'),controller[_0xc6c1('0x11')]);router[_0xc6c1('0x12')]('/:id',auth[_0xc6c1('0xa')](),controller['update']);router[_0xc6c1('0x12')](_0xc6c1('0x13'),auth[_0xc6c1('0xa')](),controller['accept']);router[_0xc6c1('0x12')](_0xc6c1('0x14'),auth[_0xc6c1('0xa')](),controller[_0xc6c1('0x15')]);router['delete']('/:id',auth[_0xc6c1('0xa')](),controller[_0xc6c1('0x16')]);module[_0xc6c1('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4c46cc0..1bba990 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 _0xd10b=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4c8fec,_0x2fbf97){var _0x32ba89=function(_0x308e0a){while(--_0x308e0a){_0x4c8fec['push'](_0x4c8fec['shift']());}};_0x32ba89(++_0x2fbf97);}(_0xd10b,0x189));var _0xbd10=function(_0x90962b,_0x37f010){_0x90962b=_0x90962b-0x0;var _0x4711af=_0xd10b[_0x90962b];return _0x4711af;};'use strict';var Sequelize=require(_0xbd10('0x0'));module[_0xbd10('0x1')]={'body':{'type':Sequelize[_0xbd10('0x2')](_0xbd10('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbd10('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd10('0x5')]('in',_0xbd10('0x6')),'defaultValue':_0xbd10('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xbd10('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbd10('0x2')]}}; \ No newline at end of file +var _0x8bc3=['ENUM','out','STRING','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8bc3,0x82));var _0x38bc=function(_0x350034,_0x341770){_0x350034=_0x350034-0x0;var _0x303eb4=_0x8bc3[_0x350034];return _0x303eb4;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'body':{'type':Sequelize[_0x38bc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x38bc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x38bc('0x3')]('in','out'),'defaultValue':_0x38bc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x38bc('0x5')](0xbe)},'phone':{'type':Sequelize[_0x38bc('0x5')]},'readAt':{'type':Sequelize[_0x38bc('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x38bc('0x5')]},'providerResponse':{'type':Sequelize[_0x38bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0b85356..e8e1e36 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 _0xc164=['redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','count','limit','destroy','end','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','find','create','body','describe','sms','acceptMessage','reject','UserId','agent','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','format','channel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','update','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc164,0x149));var _0x4c16=function(_0x2b1eb1,_0x446116){_0x2b1eb1=_0x2b1eb1-0x0;var _0x47e40b=_0xc164[_0x2b1eb1];return _0x47e40b;};'use strict';var util=require(_0x4c16('0x0'));var _=require(_0x4c16('0x1'));var Redis=require(_0x4c16('0x2'));var interactionService=require(_0x4c16('0x3'));var qs=require(_0x4c16('0x4'));var logger=require('../../config/logger')(_0x4c16('0x5'));var config=require('../../config/environment');var db=require(_0x4c16('0x6'))['db'];config[_0x4c16('0x7')]=_['defaults'](config[_0x4c16('0x7')],{'host':_0x4c16('0x8'),'port':0x18eb});var socket=require(_0x4c16('0x9'))(new Redis(config['redis']));require(_0x4c16('0xa'))[_0x4c16('0xb')](socket);var jayson=require(_0x4c16('0xc'));var client=jayson[_0x4c16('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x4c16('0xd')][_0x4c16('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x4b94ed,_0x110ba5,_0x38bf1e,_0x1eb71a){return new Promise(function(_0x28e515,_0x3d14e9){var _0x5ed7cd=_0x1eb71a||client;return _0x5ed7cd[_0x4c16('0xf')](_0x4b94ed,_0x38bf1e)[_0x4c16('0x10')](function(_0x255e87){logger[_0x4c16('0x11')](_0x4c16('0x12'),_0x110ba5,_0x4c16('0x13'));logger[_0x4c16('0x14')](_0x4c16('0x15'),_0x110ba5,_0x4c16('0x13'),JSON[_0x4c16('0x16')](_0x255e87));if(_0x255e87[_0x4c16('0x17')]){if(_0x255e87[_0x4c16('0x17')]['code']===0x1f4){logger[_0x4c16('0x17')](_0x4c16('0x12'),_0x110ba5,_0x255e87[_0x4c16('0x17')][_0x4c16('0x18')]);return _0x3d14e9(_0x255e87[_0x4c16('0x17')]['message']);}logger[_0x4c16('0x17')](_0x4c16('0x12'),_0x110ba5,_0x255e87['error'][_0x4c16('0x18')]);return _0x28e515(_0x255e87[_0x4c16('0x17')]['message']);}else{logger[_0x4c16('0x11')]('SmsMessage,\x20%s,\x20%s',_0x110ba5,_0x4c16('0x13'));_0x28e515(_0x255e87[_0x4c16('0x19')][_0x4c16('0x18')]);}})['catch'](function(_0x2166ad){logger[_0x4c16('0x17')]('SmsMessage,\x20%s,\x20%s',_0x110ba5,_0x2166ad);_0x3d14e9(_0x2166ad);});});}function respondWithResult(_0x3feb6d,_0x346bdd){_0x346bdd=_0x346bdd||0xc8;return function(_0x40484c){if(_0x40484c){return _0x3feb6d[_0x4c16('0x1a')](_0x346bdd)[_0x4c16('0x1b')](_0x40484c);}};}function respondWithFilteredResult(_0x219e20,_0x38f164){return function(_0x4b50a4){if(_0x4b50a4){var _0x2e8dde=typeof _0x38f164[_0x4c16('0x1c')]===_0x4c16('0x1d')&&typeof _0x38f164['limit']==='undefined';var _0xaeaa91=_0x4b50a4[_0x4c16('0x1e')];var _0x31c4b3=_0x2e8dde?0x0:_0x38f164[_0x4c16('0x1c')];var _0x5c4d9f=_0x2e8dde?_0x4b50a4['count']:_0x38f164[_0x4c16('0x1c')]+_0x38f164[_0x4c16('0x1f')];var _0x539302;if(_0x5c4d9f>=_0xaeaa91){_0x5c4d9f=_0xaeaa91;_0x539302=0xc8;}else{_0x539302=0xce;}_0x219e20[_0x4c16('0x1a')](_0x539302);return _0x219e20['set']('Content-Range',_0x31c4b3+'-'+_0x5c4d9f+'/'+_0xaeaa91)[_0x4c16('0x1b')](_0x4b50a4);}return null;};}function saveUpdates(_0x1754e0){return function(_0x53f14a){if(_0x53f14a){return _0x53f14a['update'](_0x1754e0)[_0x4c16('0x10')](function(_0x412323){return _0x412323;});}return null;};}function removeEntity(_0x51fbd9){return function(_0x5be5c4){if(_0x5be5c4){return _0x5be5c4[_0x4c16('0x20')]()[_0x4c16('0x10')](function(){_0x51fbd9['status'](0xcc)[_0x4c16('0x21')]();});}};}function handleEntityNotFound(_0x31c1aa){return function(_0x5ed978){if(!_0x5ed978){_0x31c1aa[_0x4c16('0x22')](0x194);}return _0x5ed978;};}function handleError(_0x19df36,_0xc2eed4){_0xc2eed4=_0xc2eed4||0x1f4;return function(_0x378bbc){logger['error'](_0x378bbc[_0x4c16('0x23')]);if(_0x378bbc[_0x4c16('0x24')]){delete _0x378bbc['name'];}_0x19df36[_0x4c16('0x1a')](_0xc2eed4)['send'](_0x378bbc);};}exports[_0x4c16('0x25')]=function(_0x59cb8e,_0x43a24e){var _0x4847fd={},_0x3a822a={},_0x33716e={'count':0x0,'rows':[]};var _0x277a78=_[_0x4c16('0x26')](db[_0x4c16('0x27')][_0x4c16('0x28')],function(_0x25081f){return{'name':_0x25081f[_0x4c16('0x29')],'type':_0x25081f[_0x4c16('0x2a')][_0x4c16('0x2b')]};});_0x3a822a['model']=_[_0x4c16('0x26')](_0x277a78,_0x4c16('0x24'));_0x3a822a[_0x4c16('0x2c')]=_[_0x4c16('0x2d')](_0x59cb8e['query']);_0x3a822a[_0x4c16('0x2e')]=_['intersection'](_0x3a822a[_0x4c16('0x2f')],_0x3a822a['query']);_0x4847fd[_0x4c16('0x30')]=_[_0x4c16('0x31')](_0x3a822a['model'],qs[_0x4c16('0x32')](_0x59cb8e[_0x4c16('0x2c')][_0x4c16('0x32')]));_0x4847fd['attributes']=_0x4847fd[_0x4c16('0x30')]['length']?_0x4847fd[_0x4c16('0x30')]:_0x3a822a[_0x4c16('0x2f')];if(!_0x59cb8e[_0x4c16('0x2c')]['hasOwnProperty'](_0x4c16('0x33'))){_0x4847fd[_0x4c16('0x1f')]=qs[_0x4c16('0x1f')](_0x59cb8e[_0x4c16('0x2c')][_0x4c16('0x1f')]);_0x4847fd[_0x4c16('0x1c')]=qs[_0x4c16('0x1c')](_0x59cb8e[_0x4c16('0x2c')][_0x4c16('0x1c')]);}_0x4847fd['order']=qs['sort'](_0x59cb8e['query']['sort']);_0x4847fd[_0x4c16('0x34')]=qs[_0x4c16('0x2e')](_['pick'](_0x59cb8e[_0x4c16('0x2c')],_0x3a822a[_0x4c16('0x2e')]),_0x277a78);if(_0x59cb8e[_0x4c16('0x2c')]['filter']){_0x4847fd[_0x4c16('0x34')]=_[_0x4c16('0x35')](_0x4847fd[_0x4c16('0x34')],{'$or':_[_0x4c16('0x26')](_0x277a78,function(_0x18989e){if(_0x18989e['type']!==_0x4c16('0x36')){var _0x24de34={};_0x24de34[_0x18989e['name']]={'$like':'%'+_0x59cb8e['query'][_0x4c16('0x37')]+'%'};return _0x24de34;}})});}_0x4847fd=_['merge']({},_0x4847fd,_0x59cb8e[_0x4c16('0x38')]);var _0x961a35={'where':_0x4847fd['where']};return db[_0x4c16('0x27')][_0x4c16('0x1e')](_0x961a35)[_0x4c16('0x10')](function(_0x17a129){_0x33716e[_0x4c16('0x1e')]=_0x17a129;if(_0x59cb8e[_0x4c16('0x2c')][_0x4c16('0x39')]){_0x4847fd['include']=[{'all':!![]}];}return db[_0x4c16('0x27')][_0x4c16('0x3a')](_0x4847fd);})[_0x4c16('0x10')](function(_0x5bca9b){_0x33716e['rows']=_0x5bca9b;return _0x33716e;})[_0x4c16('0x10')](respondWithFilteredResult(_0x43a24e,_0x4847fd))[_0x4c16('0x3b')](handleError(_0x43a24e,null));};exports[_0x4c16('0x3c')]=function(_0x68f4bb,_0x461848){var _0x3c8a6e={'raw':!![],'where':{'id':_0x68f4bb[_0x4c16('0x3d')]['id']}},_0x443d86={};_0x443d86[_0x4c16('0x2f')]=_[_0x4c16('0x2d')](db['SmsMessage']['rawAttributes']);_0x443d86[_0x4c16('0x2c')]=_['keys'](_0x68f4bb[_0x4c16('0x2c')]);_0x443d86['filters']=_[_0x4c16('0x31')](_0x443d86[_0x4c16('0x2f')],_0x443d86[_0x4c16('0x2c')]);_0x3c8a6e[_0x4c16('0x30')]=_[_0x4c16('0x31')](_0x443d86['model'],qs[_0x4c16('0x32')](_0x68f4bb[_0x4c16('0x2c')][_0x4c16('0x32')]));_0x3c8a6e[_0x4c16('0x30')]=_0x3c8a6e[_0x4c16('0x30')]['length']?_0x3c8a6e[_0x4c16('0x30')]:_0x443d86[_0x4c16('0x2f')];if(_0x68f4bb[_0x4c16('0x2c')][_0x4c16('0x39')]){_0x3c8a6e['include']=[{'all':!![]}];}_0x3c8a6e=_[_0x4c16('0x35')]({},_0x3c8a6e,_0x68f4bb[_0x4c16('0x38')]);return db[_0x4c16('0x27')][_0x4c16('0x3e')](_0x3c8a6e)[_0x4c16('0x10')](handleEntityNotFound(_0x461848,null))[_0x4c16('0x10')](respondWithResult(_0x461848,null))[_0x4c16('0x3b')](handleError(_0x461848,null));};exports[_0x4c16('0x3f')]=function(_0x14b329,_0x433014){return db[_0x4c16('0x27')][_0x4c16('0x3f')](_0x14b329[_0x4c16('0x40')],{})[_0x4c16('0x10')](respondWithResult(_0x433014,0xc9))['catch'](handleError(_0x433014,null));};exports['update']=function(_0x36ec4b,_0x383509){if(_0x36ec4b[_0x4c16('0x40')]['id']){delete _0x36ec4b[_0x4c16('0x40')]['id'];}return db[_0x4c16('0x27')][_0x4c16('0x3e')]({'where':{'id':_0x36ec4b[_0x4c16('0x3d')]['id']}})[_0x4c16('0x10')](handleEntityNotFound(_0x383509,null))[_0x4c16('0x10')](saveUpdates(_0x36ec4b[_0x4c16('0x40')],null))[_0x4c16('0x10')](respondWithResult(_0x383509,null))['catch'](handleError(_0x383509,null));};exports[_0x4c16('0x20')]=function(_0x2e5411,_0x40865a){return db[_0x4c16('0x27')][_0x4c16('0x3e')]({'where':{'id':_0x2e5411[_0x4c16('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40865a,null))[_0x4c16('0x10')](removeEntity(_0x40865a,null))[_0x4c16('0x3b')](handleError(_0x40865a,null));};exports['describe']=function(_0x2f687e,_0x16c703){return db[_0x4c16('0x27')][_0x4c16('0x41')]()[_0x4c16('0x10')](respondWithResult(_0x16c703,null))['catch'](handleError(_0x16c703,null));};exports['accept']=function(_0x42476d,_0x5b5e80){var _0x35cf2b=_0x4c16('0x42');return interactionService[_0x4c16('0x43')](_0x42476d,_0x35cf2b)[_0x4c16('0x10')](respondWithResult(_0x5b5e80,null))[_0x4c16('0x3b')](handleError(_0x5b5e80,null));};exports[_0x4c16('0x44')]=function(_0x1775d6,_0x3b7590){var _0x3ba8d4={'agent':{},'channel':_0x4c16('0x42')};if(_0x1775d6[_0x4c16('0x40')]['id']){delete _0x1775d6[_0x4c16('0x40')]['id'];}_0x1775d6[_0x4c16('0x40')][_0x4c16('0x45')]=_0x1775d6[_0x4c16('0x40')]['UserId']||_0x1775d6['user']['id'];_0x3ba8d4[_0x4c16('0x46')]['id']=_0x1775d6[_0x4c16('0x40')][_0x4c16('0x45')];return db['SmsMessage'][_0x4c16('0x3e')]({'where':{'id':_0x1775d6[_0x4c16('0x3d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b7590,null))[_0x4c16('0x10')](function(_0x236207){if(_0x236207){_0x3ba8d4['message']=_0x236207[_0x4c16('0x47')]({'plain':!![]});return db[_0x4c16('0x48')][_0x4c16('0x3e')]({'where':{'id':_0x236207[_0x4c16('0x49')]}});}return null;})[_0x4c16('0x10')](handleEntityNotFound(_0x3b7590,null))[_0x4c16('0x10')](function(_0x279f67){if(_0x279f67){_0x3ba8d4[_0x4c16('0x4a')]=_0x279f67[_0x4c16('0x47')]({'plain':!![]});interaction_log['info'](_0x4c16('0x4b'),_0x1775d6[_0x4c16('0x4c')]['id'],_0x1775d6[_0x4c16('0x4c')][_0x4c16('0x24')],_0x1775d6[_0x4c16('0x4c')]['role'],_0x3ba8d4['interaction']['id'],_0x1775d6[_0x4c16('0x40')]?JSON['stringify'](_0x1775d6[_0x4c16('0x40')]):_0x4c16('0x4d'));return respondWithRpcPromise(_0x4c16('0x4e'),'rejectMessage',_0x3ba8d4);}return null;})['then'](function(_0xf30f7a){var _0x2c2f41=_0x4c16('0x4f')+_0xf30f7a[_0x4c16('0x18')][_0x4c16('0x50')];return db[_0x4c16('0x51')]['query'](_0x2c2f41,{'type':db[_0x4c16('0x52')]['QueryTypes'][_0x4c16('0x53')],'raw':!![]})[_0x4c16('0x10')](function(_0x13a4ac){return _0x13a4ac;});})['then'](function(_0x1b8987){if(_0x1b8987){_0x3ba8d4[_0x4c16('0x18')][_0x4c16('0x54')]=_0x1b8987[0x0];if(!_0x1775d6[_0x4c16('0x40')]['UserId'])return;return db['User'][_0x4c16('0x3e')]({'where':{'id':_0x1775d6[_0x4c16('0x40')][_0x4c16('0x45')],'role':'agent'},'attributes':['id',_0x4c16('0x24'),_0x4c16('0x55'),_0x4c16('0x56'),_0x4c16('0x57')],'raw':!![]});}return null;})[_0x4c16('0x10')](function(_0x335030){if(!_0x335030)return null;_0x3ba8d4[_0x4c16('0x18')][_0x4c16('0x46')]=_0x335030;return _0x3ba8d4;})[_0x4c16('0x10')](function(_0x53e4e6){if(_0x53e4e6){_0x53e4e6[_0x4c16('0x18')]['interface']=util[_0x4c16('0x58')]('SIP/%s',_0x1775d6['user'][_0x4c16('0x24')]);_0x53e4e6[_0x4c16('0x18')][_0x4c16('0x59')]=_0x3ba8d4[_0x4c16('0x59')];_0x53e4e6[_0x4c16('0x18')]['motionChannel']=_0x3ba8d4[_0x4c16('0x59')];_0x53e4e6[_0x4c16('0x18')][_0x4c16('0x5a')]=_0x4c16('0x44');respondWithRpcPromise(_0x4c16('0x5b'),_0x4c16('0x5b'),{'event':_0x4c16('0x5c'),'message':_0x53e4e6['message']},client9002);return _0x3ba8d4;}return null;})[_0x4c16('0x10')](respondWithResult(_0x3b7590,null))[_0x4c16('0x3b')](handleError(_0x3b7590,null));};exports[_0x4c16('0x1a')]=function(_0x340379,_0x439664){if(_0x340379['body']['id']){delete _0x340379[_0x4c16('0x40')]['id'];}var _0x1ac220;return db[_0x4c16('0x27')][_0x4c16('0x3e')]({'where':{'id':_0x340379['params']['id']}})['then'](handleEntityNotFound(_0x439664,null))['then'](function(_0x2fc4af){if(_0x2fc4af){_0x1ac220=_0x2fc4af;return db[_0x4c16('0x5d')]['find']({'where':{'id':_0x2fc4af[_0x4c16('0x5e')]}});}})[_0x4c16('0x10')](handleEntityNotFound(_0x439664,null))[_0x4c16('0x10')](function(_0x48c8cd){if(_0x48c8cd){logger[_0x4c16('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4c16('0x1a'),_0x4c16('0x5f'),_0x48c8cd[_0x4c16('0x2a')],util['inspect'](_0x340379[_0x4c16('0x40')],{'showHidden':![],'depth':null}));switch(_0x48c8cd['type']){case _0x4c16('0x60'):if(_0x340379[_0x4c16('0x40')][_0x4c16('0x61')]&&_0x340379[_0x4c16('0x40')][_0x4c16('0x61')]===_0x1ac220[_0x4c16('0x62')]){return _0x1ac220[_0x4c16('0x63')]({'read':!![]});}else{logger[_0x4c16('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c16('0x1a'),_0x4c16('0x60'),util[_0x4c16('0x64')](_0x340379[_0x4c16('0x40')],{'showHidden':![],'depth':null}));}break;case _0x4c16('0x65'):if(_0x340379[_0x4c16('0x40')]['MessageUUID']&&_0x340379['body'][_0x4c16('0x66')]===_0x1ac220[_0x4c16('0x62')]&&_[_0x4c16('0x67')]([_0x4c16('0x68'),_0x4c16('0x69')],_0x340379[_0x4c16('0x40')][_0x4c16('0x6a')])>=0x0){return _0x1ac220[_0x4c16('0x63')]({'read':!![]});}else{logger[_0x4c16('0x17')](_0x4c16('0x6b'),_0x4c16('0x1a'),_0x4c16('0x6c'),util[_0x4c16('0x64')](_0x340379[_0x4c16('0x40')],{'showHidden':![],'depth':null}));}break;case _0x4c16('0x6d'):var _0x3858c5=_0x340379['body']['results'][0x0];if(_0x3858c5[_0x4c16('0x1a')][_0x4c16('0x6e')]===_0x4c16('0x6f')){return _0x1ac220[_0x4c16('0x63')]({'read':!![]});}else{logger[_0x4c16('0x17')](_0x4c16('0x6b'),'status',_0x4c16('0x6d'),util[_0x4c16('0x64')](_0x340379[_0x4c16('0x40')],{'showHidden':![],'depth':null}));}break;}return _0x1ac220;}})[_0x4c16('0x10')](respondWithResult(_0x439664,null))[_0x4c16('0x3b')](handleError(_0x439664,null));}; \ No newline at end of file +var _0xfd41=['filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','params','destroy','describe','accept','sms','acceptMessage','reject','UserId','user','agent','get','SmsInteraction','SmsInteractionId','interaction','role','null','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','../../config/logger','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x335e68,_0x271f8c){var _0x2cecbc=function(_0x21c0c4){while(--_0x21c0c4){_0x335e68['push'](_0x335e68['shift']());}};_0x2cecbc(++_0x271f8c);}(_0xfd41,0xb6));var _0x1fd4=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfd41[_0x12fc8d];return _0x3f9d04;};'use strict';var util=require(_0x1fd4('0x0'));var _=require(_0x1fd4('0x1'));var Redis=require(_0x1fd4('0x2'));var interactionService=require(_0x1fd4('0x3'));var qs=require(_0x1fd4('0x4'));var logger=require('../../config/logger')(_0x1fd4('0x5'));var config=require('../../config/environment');var db=require(_0x1fd4('0x6'))['db'];config[_0x1fd4('0x7')]=_['defaults'](config[_0x1fd4('0x7')],{'host':_0x1fd4('0x8'),'port':0x18eb});var socket=require(_0x1fd4('0x9'))(new Redis(config[_0x1fd4('0x7')]));require(_0x1fd4('0xa'))[_0x1fd4('0xb')](socket);var jayson=require(_0x1fd4('0xc'));var client=jayson[_0x1fd4('0xd')][_0x1fd4('0xe')]({'port':0x232c});var client9002=jayson[_0x1fd4('0xd')][_0x1fd4('0xe')]({'port':0x232a});var interaction_log=require(_0x1fd4('0xf'))(_0x1fd4('0x10'));function respondWithRpcPromise(_0x484f4f,_0x1860c5,_0x23b37a,_0x448435){return new Promise(function(_0x4b6f42,_0x155d3d){var _0x1adc90=_0x448435||client;return _0x1adc90[_0x1fd4('0x11')](_0x484f4f,_0x23b37a)[_0x1fd4('0x12')](function(_0x2b8bca){logger[_0x1fd4('0x13')](_0x1fd4('0x14'),_0x1860c5,'request\x20sent');logger['debug'](_0x1fd4('0x15'),_0x1860c5,_0x1fd4('0x16'),JSON[_0x1fd4('0x17')](_0x2b8bca));if(_0x2b8bca[_0x1fd4('0x18')]){if(_0x2b8bca[_0x1fd4('0x18')]['code']===0x1f4){logger[_0x1fd4('0x18')](_0x1fd4('0x14'),_0x1860c5,_0x2b8bca[_0x1fd4('0x18')][_0x1fd4('0x19')]);return _0x155d3d(_0x2b8bca['error'][_0x1fd4('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1860c5,_0x2b8bca[_0x1fd4('0x18')][_0x1fd4('0x19')]);return _0x4b6f42(_0x2b8bca[_0x1fd4('0x18')]['message']);}else{logger[_0x1fd4('0x13')]('SmsMessage,\x20%s,\x20%s',_0x1860c5,'request\x20sent');_0x4b6f42(_0x2b8bca[_0x1fd4('0x1a')]['message']);}})[_0x1fd4('0x1b')](function(_0x177d46){logger[_0x1fd4('0x18')]('SmsMessage,\x20%s,\x20%s',_0x1860c5,_0x177d46);_0x155d3d(_0x177d46);});});}function respondWithResult(_0x51a392,_0x124446){_0x124446=_0x124446||0xc8;return function(_0x5e4f1d){if(_0x5e4f1d){return _0x51a392[_0x1fd4('0x1c')](_0x124446)[_0x1fd4('0x1d')](_0x5e4f1d);}};}function respondWithFilteredResult(_0x4b5bc3,_0x423f32){return function(_0x9dbd9){if(_0x9dbd9){var _0x2dbc9e=typeof _0x423f32[_0x1fd4('0x1e')]===_0x1fd4('0x1f')&&typeof _0x423f32[_0x1fd4('0x20')]===_0x1fd4('0x1f');var _0x3f2e95=_0x9dbd9['count'];var _0xcfd965=_0x2dbc9e?0x0:_0x423f32[_0x1fd4('0x1e')];var _0x556c05=_0x2dbc9e?_0x9dbd9[_0x1fd4('0x21')]:_0x423f32[_0x1fd4('0x1e')]+_0x423f32[_0x1fd4('0x20')];var _0x49aeb5;if(_0x556c05>=_0x3f2e95){_0x556c05=_0x3f2e95;_0x49aeb5=0xc8;}else{_0x49aeb5=0xce;}_0x4b5bc3[_0x1fd4('0x1c')](_0x49aeb5);return _0x4b5bc3[_0x1fd4('0x22')]('Content-Range',_0xcfd965+'-'+_0x556c05+'/'+_0x3f2e95)[_0x1fd4('0x1d')](_0x9dbd9);}return null;};}function saveUpdates(_0x3353af){return function(_0x1d2a0c){if(_0x1d2a0c){return _0x1d2a0c[_0x1fd4('0x23')](_0x3353af)[_0x1fd4('0x12')](function(_0x45bcb4){return _0x45bcb4;});}return null;};}function removeEntity(_0x15dfb8){return function(_0x5ded6c){if(_0x5ded6c){return _0x5ded6c['destroy']()['then'](function(){_0x15dfb8[_0x1fd4('0x1c')](0xcc)[_0x1fd4('0x24')]();});}};}function handleEntityNotFound(_0x2e79ec){return function(_0x1f2b9b){if(!_0x1f2b9b){_0x2e79ec[_0x1fd4('0x25')](0x194);}return _0x1f2b9b;};}function handleError(_0x5ceba8,_0x346977){_0x346977=_0x346977||0x1f4;return function(_0x1e5bda){logger[_0x1fd4('0x18')](_0x1e5bda[_0x1fd4('0x26')]);if(_0x1e5bda[_0x1fd4('0x27')]){delete _0x1e5bda[_0x1fd4('0x27')];}_0x5ceba8[_0x1fd4('0x1c')](_0x346977)[_0x1fd4('0x28')](_0x1e5bda);};}exports[_0x1fd4('0x29')]=function(_0x29864e,_0x55aaa5){var _0x5925f3={},_0x808f48={},_0x2c007e={'count':0x0,'rows':[]};var _0x2f8fb6=_[_0x1fd4('0x2a')](db[_0x1fd4('0x2b')][_0x1fd4('0x2c')],function(_0x29e141){return{'name':_0x29e141[_0x1fd4('0x2d')],'type':_0x29e141[_0x1fd4('0x2e')][_0x1fd4('0x2f')]};});_0x808f48[_0x1fd4('0x30')]=_[_0x1fd4('0x2a')](_0x2f8fb6,'name');_0x808f48[_0x1fd4('0x31')]=_[_0x1fd4('0x32')](_0x29864e[_0x1fd4('0x31')]);_0x808f48[_0x1fd4('0x33')]=_['intersection'](_0x808f48[_0x1fd4('0x30')],_0x808f48[_0x1fd4('0x31')]);_0x5925f3[_0x1fd4('0x34')]=_[_0x1fd4('0x35')](_0x808f48[_0x1fd4('0x30')],qs[_0x1fd4('0x36')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x36')]));_0x5925f3[_0x1fd4('0x34')]=_0x5925f3[_0x1fd4('0x34')]['length']?_0x5925f3[_0x1fd4('0x34')]:_0x808f48[_0x1fd4('0x30')];if(!_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x37')]('nolimit')){_0x5925f3['limit']=qs[_0x1fd4('0x20')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x20')]);_0x5925f3[_0x1fd4('0x1e')]=qs['offset'](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x1e')]);}_0x5925f3[_0x1fd4('0x38')]=qs[_0x1fd4('0x39')](_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x39')]);_0x5925f3[_0x1fd4('0x3a')]=qs[_0x1fd4('0x33')](_[_0x1fd4('0x3b')](_0x29864e['query'],_0x808f48[_0x1fd4('0x33')]),_0x2f8fb6);if(_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x3c')]){_0x5925f3[_0x1fd4('0x3a')]=_[_0x1fd4('0x3d')](_0x5925f3[_0x1fd4('0x3a')],{'$or':_[_0x1fd4('0x2a')](_0x2f8fb6,function(_0x605cd8){if(_0x605cd8[_0x1fd4('0x2e')]!==_0x1fd4('0x3e')){var _0x3d0dff={};_0x3d0dff[_0x605cd8[_0x1fd4('0x27')]]={'$like':'%'+_0x29864e['query'][_0x1fd4('0x3c')]+'%'};return _0x3d0dff;}})});}_0x5925f3=_[_0x1fd4('0x3d')]({},_0x5925f3,_0x29864e[_0x1fd4('0x3f')]);var _0x4ad9d6={'where':_0x5925f3[_0x1fd4('0x3a')]};return db[_0x1fd4('0x2b')][_0x1fd4('0x21')](_0x4ad9d6)[_0x1fd4('0x12')](function(_0x439fc8){_0x2c007e['count']=_0x439fc8;if(_0x29864e[_0x1fd4('0x31')][_0x1fd4('0x40')]){_0x5925f3[_0x1fd4('0x41')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5925f3);})[_0x1fd4('0x12')](function(_0x1493b5){_0x2c007e[_0x1fd4('0x42')]=_0x1493b5;return _0x2c007e;})['then'](respondWithFilteredResult(_0x55aaa5,_0x5925f3))[_0x1fd4('0x1b')](handleError(_0x55aaa5,null));};exports[_0x1fd4('0x43')]=function(_0x5719bd,_0x56f843){var _0x18af7e={'raw':!![],'where':{'id':_0x5719bd['params']['id']}},_0xe54fb={};_0xe54fb['model']=_[_0x1fd4('0x32')](db[_0x1fd4('0x2b')][_0x1fd4('0x2c')]);_0xe54fb[_0x1fd4('0x31')]=_[_0x1fd4('0x32')](_0x5719bd['query']);_0xe54fb[_0x1fd4('0x33')]=_[_0x1fd4('0x35')](_0xe54fb[_0x1fd4('0x30')],_0xe54fb[_0x1fd4('0x31')]);_0x18af7e[_0x1fd4('0x34')]=_['intersection'](_0xe54fb[_0x1fd4('0x30')],qs[_0x1fd4('0x36')](_0x5719bd[_0x1fd4('0x31')][_0x1fd4('0x36')]));_0x18af7e[_0x1fd4('0x34')]=_0x18af7e[_0x1fd4('0x34')]['length']?_0x18af7e['attributes']:_0xe54fb[_0x1fd4('0x30')];if(_0x5719bd[_0x1fd4('0x31')][_0x1fd4('0x40')]){_0x18af7e[_0x1fd4('0x41')]=[{'all':!![]}];}_0x18af7e=_[_0x1fd4('0x3d')]({},_0x18af7e,_0x5719bd[_0x1fd4('0x3f')]);return db[_0x1fd4('0x2b')][_0x1fd4('0x44')](_0x18af7e)[_0x1fd4('0x12')](handleEntityNotFound(_0x56f843,null))[_0x1fd4('0x12')](respondWithResult(_0x56f843,null))[_0x1fd4('0x1b')](handleError(_0x56f843,null));};exports[_0x1fd4('0x45')]=function(_0x1cf7a2,_0x3a5799){return db[_0x1fd4('0x2b')][_0x1fd4('0x45')](_0x1cf7a2[_0x1fd4('0x46')],{})[_0x1fd4('0x12')](respondWithResult(_0x3a5799,0xc9))[_0x1fd4('0x1b')](handleError(_0x3a5799,null));};exports[_0x1fd4('0x23')]=function(_0x5258e5,_0x348fb6){if(_0x5258e5['body']['id']){delete _0x5258e5[_0x1fd4('0x46')]['id'];}return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x5258e5[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x348fb6,null))['then'](saveUpdates(_0x5258e5[_0x1fd4('0x46')],null))['then'](respondWithResult(_0x348fb6,null))[_0x1fd4('0x1b')](handleError(_0x348fb6,null));};exports[_0x1fd4('0x48')]=function(_0x4ab7cd,_0x3e3dfc){return db['SmsMessage'][_0x1fd4('0x44')]({'where':{'id':_0x4ab7cd[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x3e3dfc,null))['then'](removeEntity(_0x3e3dfc,null))[_0x1fd4('0x1b')](handleError(_0x3e3dfc,null));};exports[_0x1fd4('0x49')]=function(_0x40b244,_0x152ee9){return db[_0x1fd4('0x2b')][_0x1fd4('0x49')]()[_0x1fd4('0x12')](respondWithResult(_0x152ee9,null))[_0x1fd4('0x1b')](handleError(_0x152ee9,null));};exports[_0x1fd4('0x4a')]=function(_0x248b32,_0x401e54){var _0x1b29bd=_0x1fd4('0x4b');return interactionService[_0x1fd4('0x4c')](_0x248b32,_0x1b29bd)[_0x1fd4('0x12')](respondWithResult(_0x401e54,null))['catch'](handleError(_0x401e54,null));};exports[_0x1fd4('0x4d')]=function(_0x57783b,_0xc85bb0){var _0x346e26={'agent':{},'channel':_0x1fd4('0x4b')};if(_0x57783b[_0x1fd4('0x46')]['id']){delete _0x57783b[_0x1fd4('0x46')]['id'];}_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')]=_0x57783b['body'][_0x1fd4('0x4e')]||_0x57783b[_0x1fd4('0x4f')]['id'];_0x346e26[_0x1fd4('0x50')]['id']=_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')];return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x57783b[_0x1fd4('0x47')]['id'],'UserId':null}})[_0x1fd4('0x12')](handleEntityNotFound(_0xc85bb0,null))['then'](function(_0x36e5c2){if(_0x36e5c2){_0x346e26[_0x1fd4('0x19')]=_0x36e5c2[_0x1fd4('0x51')]({'plain':!![]});return db[_0x1fd4('0x52')][_0x1fd4('0x44')]({'where':{'id':_0x36e5c2[_0x1fd4('0x53')]}});}return null;})['then'](handleEntityNotFound(_0xc85bb0,null))['then'](function(_0x3fff61){if(_0x3fff61){_0x346e26[_0x1fd4('0x54')]=_0x3fff61[_0x1fd4('0x51')]({'plain':!![]});interaction_log[_0x1fd4('0x13')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57783b['user']['id'],_0x57783b[_0x1fd4('0x4f')][_0x1fd4('0x27')],_0x57783b[_0x1fd4('0x4f')][_0x1fd4('0x55')],_0x346e26['interaction']['id'],_0x57783b['body']?JSON['stringify'](_0x57783b[_0x1fd4('0x46')]):_0x1fd4('0x56'));return respondWithRpcPromise(_0x1fd4('0x57'),_0x1fd4('0x58'),_0x346e26);}return null;})['then'](function(_0x160f58){var _0x56ddfb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x160f58[_0x1fd4('0x19')]['ContactId'];return db['sequelize'][_0x1fd4('0x31')](_0x56ddfb,{'type':db[_0x1fd4('0x59')][_0x1fd4('0x5a')][_0x1fd4('0x5b')],'raw':!![]})[_0x1fd4('0x12')](function(_0x53e19b){return _0x53e19b;});})['then'](function(_0x35c75b){if(_0x35c75b){_0x346e26['message']['contact']=_0x35c75b[0x0];if(!_0x57783b['body'][_0x1fd4('0x4e')])return;return db[_0x1fd4('0x5c')][_0x1fd4('0x44')]({'where':{'id':_0x57783b[_0x1fd4('0x46')][_0x1fd4('0x4e')],'role':_0x1fd4('0x50')},'attributes':['id',_0x1fd4('0x27'),_0x1fd4('0x5d'),_0x1fd4('0x5e'),_0x1fd4('0x5f')],'raw':!![]});}return null;})[_0x1fd4('0x12')](function(_0x273bd5){if(!_0x273bd5)return null;_0x346e26[_0x1fd4('0x19')]['agent']=_0x273bd5;return _0x346e26;})[_0x1fd4('0x12')](function(_0x40e405){if(_0x40e405){_0x40e405[_0x1fd4('0x19')]['interface']=util['format'](_0x1fd4('0x60'),_0x57783b['user']['name']);_0x40e405[_0x1fd4('0x19')][_0x1fd4('0x61')]=_0x346e26['channel'];_0x40e405[_0x1fd4('0x19')][_0x1fd4('0x62')]=_0x346e26[_0x1fd4('0x61')];_0x40e405[_0x1fd4('0x19')]['event']=_0x1fd4('0x4d');respondWithRpcPromise(_0x1fd4('0x63'),_0x1fd4('0x63'),{'event':_0x1fd4('0x64'),'message':_0x40e405[_0x1fd4('0x19')]},client9002);return _0x346e26;}return null;})[_0x1fd4('0x12')](respondWithResult(_0xc85bb0,null))[_0x1fd4('0x1b')](handleError(_0xc85bb0,null));};exports[_0x1fd4('0x1c')]=function(_0x38fde6,_0x34679a){if(_0x38fde6[_0x1fd4('0x46')]['id']){delete _0x38fde6[_0x1fd4('0x46')]['id'];}var _0x133bed;return db[_0x1fd4('0x2b')][_0x1fd4('0x44')]({'where':{'id':_0x38fde6[_0x1fd4('0x47')]['id']}})[_0x1fd4('0x12')](handleEntityNotFound(_0x34679a,null))['then'](function(_0x232574){if(_0x232574){_0x133bed=_0x232574;return db[_0x1fd4('0x65')]['find']({'where':{'id':_0x232574[_0x1fd4('0x66')]}});}})[_0x1fd4('0x12')](handleEntityNotFound(_0x34679a,null))[_0x1fd4('0x12')](function(_0x42b85f){if(_0x42b85f){logger[_0x1fd4('0x67')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1fd4('0x1c'),_0x1fd4('0x68'),_0x42b85f[_0x1fd4('0x2e')],util['inspect'](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));switch(_0x42b85f[_0x1fd4('0x2e')]){case _0x1fd4('0x69'):if(_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6a')]&&_0x38fde6[_0x1fd4('0x46')]['MessageSid']===_0x133bed[_0x1fd4('0x6b')]){return _0x133bed['update']({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),_0x1fd4('0x1c'),'twilio',util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1fd4('0x6e'):if(_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6f')]&&_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x6f')]===_0x133bed['messageId']&&_[_0x1fd4('0x70')]([_0x1fd4('0x71'),_0x1fd4('0x72')],_0x38fde6[_0x1fd4('0x46')][_0x1fd4('0x73')])>=0x0){return _0x133bed[_0x1fd4('0x23')]({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),_0x1fd4('0x1c'),_0x1fd4('0x74'),util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe38d59=_0x38fde6['body'][_0x1fd4('0x75')][0x0];if(_0xe38d59[_0x1fd4('0x1c')][_0x1fd4('0x76')]===_0x1fd4('0x77')){return _0x133bed[_0x1fd4('0x23')]({'read':!![]});}else{logger[_0x1fd4('0x18')](_0x1fd4('0x6c'),'status',_0x1fd4('0x78'),util[_0x1fd4('0x6d')](_0x38fde6[_0x1fd4('0x46')],{'showHidden':![],'depth':null}));}break;}return _0x133bed;}})['then'](respondWithResult(_0x34679a,null))[_0x1fd4('0x1b')](handleError(_0x34679a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bb6d6d7..7912b56 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 _0xa0af=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x2e3613,_0x5f4948){var _0x2b916d=function(_0xaff5b5){while(--_0xaff5b5){_0x2e3613['push'](_0x2e3613['shift']());}};_0x2b916d(++_0x5f4948);}(_0xa0af,0x129));var _0xfa0a=function(_0x2497a7,_0x373842){_0x2497a7=_0x2497a7-0x0;var _0x339433=_0xa0af[_0x2497a7];return _0x339433;};'use strict';var EventEmitter=require(_0xfa0a('0x0'));var SmsMessage=require(_0xfa0a('0x1'))['db'][_0xfa0a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfa0a('0x3')](0x0);var events={'afterCreate':_0xfa0a('0x4'),'afterUpdate':_0xfa0a('0x5'),'afterDestroy':_0xfa0a('0x6')};function emitEvent(_0x21c8ff){return function(_0xac0a39,_0x4cead5,_0x582c6c){SmsMessageEvents[_0xfa0a('0x7')](_0x21c8ff+':'+_0xac0a39['id'],_0xac0a39);SmsMessageEvents['emit'](_0x21c8ff,_0xac0a39);_0x582c6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xfa0a('0x8')](e,emitEvent(event));}}module[_0xfa0a('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x7f4f=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x7f4f,0x89));var _0xf7f4=function(_0x54331b,_0x27138c){_0x54331b=_0x54331b-0x0;var _0x60bf0d=_0x7f4f[_0x54331b];return _0x60bf0d;};'use strict';var EventEmitter=require(_0xf7f4('0x0'));var SmsMessage=require(_0xf7f4('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7f4('0x2'),'afterUpdate':_0xf7f4('0x3'),'afterDestroy':_0xf7f4('0x4')};function emitEvent(_0xb80e52){return function(_0x184bf9,_0x58ad94,_0x3ad711){SmsMessageEvents[_0xf7f4('0x5')](_0xb80e52+':'+_0x184bf9['id'],_0x184bf9);SmsMessageEvents[_0xf7f4('0x5')](_0xb80e52,_0x184bf9);_0x3ad711(null);};}for(var e in events){if(events[_0xf7f4('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf7f4('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c93c97f..a59254a 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 _0xdb75=['POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','toString','base64','data','queued_count','message_id','clickSend','authId','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','Token\x20not\x20received','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms'];(function(_0x3b8865,_0x3f907e){var _0x248376=function(_0x4669ae){while(--_0x4669ae){_0x3b8865['push'](_0x3b8865['shift']());}};_0x248376(++_0x3f907e);}(_0xdb75,0xb3));var _0x5db7=function(_0x280f87,_0x4651ec){_0x280f87=_0x280f87-0x0;var _0x2db9d8=_0xdb75[_0x280f87];return _0x2db9d8;};'use strict';var _=require(_0x5db7('0x0'));var util=require(_0x5db7('0x1'));var logger=require(_0x5db7('0x2'))('api');var moment=require(_0x5db7('0x3'));var BPromise=require(_0x5db7('0x4'));var rp=require(_0x5db7('0x5'));var fs=require('fs');var path=require(_0x5db7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x5db7('0x7')]=function(_0x560253,_0x483c4c){return _0x560253[_0x5db7('0x8')](_0x5db7('0x9'),attributes,{'tableName':_0x5db7('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5db7('0xb')]},{'name':_0x5db7('0xc'),'fields':[_0x5db7('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d477a,_0x3b74cd,_0x2ad7f2){var _0x5651c3=_0x560253['models'];var _0x466c5f=_0x5d477a[_0x5db7('0xe')]({'plain':!![]});if(_0x466c5f[_0x5db7('0xf')][_0x5db7('0x10')]()==='in'||_0x466c5f['direction'][_0x5db7('0x10')]()===_0x5db7('0x11')&&!_0x466c5f[_0x5db7('0x12')]&&!_[_0x5db7('0x13')](_0x466c5f['UserId'])&&!_['isNil'](_0x466c5f['SmsInteractionId'])){_0x5651c3[_0x5db7('0x14')][_0x5db7('0x15')]({'where':{'id':_0x466c5f[_0x5db7('0x16')]}})[_0x5db7('0x17')](function(_0x46401b){if(_0x46401b){_0x46401b[_0x5db7('0x18')]({'lastMsgAt':_0x466c5f[_0x5db7('0x19')],'lastMsgDirection':_0x466c5f[_0x5db7('0xf')][_0x5db7('0x10')]()});}})[_0x5db7('0x1a')](function(_0x2cfefb){console[_0x5db7('0x1b')](_0x2cfefb);});}if(_0x466c5f[_0x5db7('0xf')]===_0x5db7('0x11')&&!_0x466c5f[_0x5db7('0x12')]){var _0x41d17a;_0x5651c3[_0x5db7('0x1c')][_0x5db7('0x1d')]({'where':{'id':_0x466c5f[_0x5db7('0x1e')]},'raw':!![]})[_0x5db7('0x17')](function(_0x20dd39){_0x41d17a=_0x20dd39;if(_0x41d17a&&_0x41d17a[_0x5db7('0x1f')]){switch(_0x41d17a[_0x5db7('0x1f')]){case _0x5db7('0x20'):var _0x3b0e73=require('twilio');if(_0x41d17a[_0x5db7('0x21')]&&_0x41d17a[_0x5db7('0x22')]&&_0x41d17a[_0x5db7('0x23')]){var _0x562ca7=new _0x3b0e73(_0x41d17a[_0x5db7('0x21')],_0x41d17a['authToken']);_0x562ca7[_0x5db7('0x24')][_0x5db7('0x25')]({'body':_0x466c5f[_0x5db7('0xd')],'to':_0x466c5f[_0x5db7('0x23')],'from':_0x41d17a['phone'],'statusCallback':_0x41d17a[_0x5db7('0x26')]+_0x5db7('0x27')+_0x466c5f['id']+_0x5db7('0x28')+_0x41d17a[_0x5db7('0x29')]})[_0x5db7('0x17')](function(_0x39b076){if(_0x39b076[_0x5db7('0x2a')]){return _0x5d477a[_0x5db7('0x18')]({'messageId':_0x39b076[_0x5db7('0x2a')]});}})['catch'](function(_0x28d464){logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x20'),util[_0x5db7('0x2d')](_0x28d464,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x20'),_0x5db7('0x2e'));}break;case'skebby':var _0x4e42d0=_0x5db7('0x2f');if(_0x41d17a['username']&&_0x41d17a[_0x5db7('0x30')]){var _0x1c09da={'recipient':[_0x466c5f[_0x5db7('0x23')]],'message':_0x466c5f[_0x5db7('0xd')],'message_type':_0x41d17a[_0x5db7('0x31')]};if(_0x41d17a['smsMethod']&&_0x41d17a[_0x5db7('0x31')]!=='SI'){_0x1c09da[_0x5db7('0x32')]=_0x41d17a[_0x5db7('0x23')];}var _0x37b086={'url':_0x4e42d0+_0x5db7('0x33')+_0x41d17a[_0x5db7('0x34')]+_0x5db7('0x35')+_0x41d17a[_0x5db7('0x30')],'method':_0x5db7('0x36')};rp(_0x37b086)[_0x5db7('0x17')](function(_0x2b48f2){var _0x34d036=_0x2b48f2[_0x5db7('0x37')](';');var _0x346235={'user_key':_0x34d036[0x0],'session_key':_0x34d036[0x1]};_0x37b086={'url':_0x4e42d0+_0x5db7('0x38'),'method':_0x5db7('0x39'),'headers':{'user_key':_0x346235[_0x5db7('0x3a')],'Session_key':_0x346235[_0x5db7('0x3b')]},'json':!![],'body':_0x1c09da};return rp(_0x37b086);})[_0x5db7('0x17')](function(_0x4f7cc1){if(_0x4f7cc1['total_sent']>=0x1){var _0x30e05d={'messageId':_0x4f7cc1[_0x5db7('0x3c')]};if(_0x41d17a[_0x5db7('0x31')]!=='GP'||!_0x41d17a[_0x5db7('0x3d')]){_0x30e05d[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x30e05d);}else{return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x3f'),util[_0x5db7('0x2d')](_0x4f7cc1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x353351){return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x3f'),util[_0x5db7('0x2d')](_0x353351,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5db7('0x2c'),_0x5db7('0x3f'),_0x5db7('0x40'));}break;case _0x5db7('0x41'):if(_0x41d17a[_0x5db7('0x22')]){var _0x4ead3c={'recipient':_0x466c5f['phone'],'message':_0x466c5f['body'],'sender':_0x41d17a[_0x5db7('0x42')]||_0x41d17a[_0x5db7('0x23')],'authorization':_0x41d17a[_0x5db7('0x22')]};var _0x3b74cd={'method':_0x5db7('0x39'),'uri':_0x5db7('0x43'),'body':_0x4ead3c,'json':!![]};rp(_0x3b74cd)['then'](function(_0x34f5f1){var _0x27d3cc={'messageId':_0x34f5f1[_0x5db7('0x44')]};if(!_0x41d17a['deliveryReport']){_0x27d3cc[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x27d3cc);})[_0x5db7('0x1a')](function(_0x31d8b7){logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x41'),util[_0x5db7('0x2d')](_0x31d8b7,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x41'),_0x5db7('0x45'));}break;case'clicksend':if(_0x41d17a[_0x5db7('0x34')]&&_0x41d17a[_0x5db7('0x30')]){var _0x4ead3c={'messages':[{'source':_0x5db7('0x46'),'to':_0x466c5f[_0x5db7('0x23')],'body':_0x466c5f[_0x5db7('0xd')],'from':_0x41d17a[_0x5db7('0x42')]||_0x41d17a[_0x5db7('0x23')]}]};var _0x10139c=util[_0x5db7('0x47')](_0x5db7('0x48'),_0x41d17a[_0x5db7('0x34')],_0x41d17a[_0x5db7('0x30')]);var _0x3b74cd={'method':_0x5db7('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4ead3c,'headers':{'Authorization':util[_0x5db7('0x47')]('Basic\x20%s',new Buffer(_0x10139c)[_0x5db7('0x49')](_0x5db7('0x4a')))},'json':!![]};rp(_0x3b74cd)[_0x5db7('0x17')](function(_0x269c9e){if(_0x269c9e['http_code']>=0xc8&&_0x269c9e['http_code']<=0xce){if(_0x269c9e['data']&&_0x269c9e[_0x5db7('0x4b')][_0x5db7('0x4c')]>0x0){var _0x156632=_['head'](_0x269c9e[_0x5db7('0x4b')][_0x5db7('0x24')]);var _0x10eef3={'messageId':_0x156632[_0x5db7('0x4d')]};if(!_0x41d17a[_0x5db7('0x3d')]){_0x10eef3[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x10eef3);}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x4e'),util[_0x5db7('0x2d')](_0x269c9e,{'showHidden':![],'depth':null}));}}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),'afterCreate','clickSend',util[_0x5db7('0x2d')](_0x269c9e,{'showHidden':![],'depth':null}));}})[_0x5db7('0x1a')](function(_0x53bc6d){logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x4e'),util[_0x5db7('0x2d')](_0x53bc6d,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x41d17a['authId']&&_0x41d17a['authToken']){var _0x4ead3c={'dst':_0x466c5f['phone'],'text':_0x466c5f[_0x5db7('0xd')],'src':_0x41d17a[_0x5db7('0x42')]||_0x41d17a[_0x5db7('0x23')],'url':_0x41d17a['remote']+_0x5db7('0x27')+_0x466c5f['id']+_0x5db7('0x28')+_0x41d17a[_0x5db7('0x29')]};var _0x10139c=util[_0x5db7('0x47')](_0x5db7('0x48'),_0x41d17a[_0x5db7('0x4f')],_0x41d17a[_0x5db7('0x22')]);var _0x3b74cd={'method':'POST','uri':util[_0x5db7('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x41d17a['authId']),'body':_0x4ead3c,'headers':{'Authorization':util[_0x5db7('0x47')](_0x5db7('0x50'),new Buffer(_0x10139c)[_0x5db7('0x49')]('base64'))},'json':!![]};rp(_0x3b74cd)['then'](function(_0x155b76){var _0x3bffd3={'messageId':_0x155b76[_0x5db7('0x51')][0x0]};return _0x5d477a[_0x5db7('0x18')](_0x3bffd3);})[_0x5db7('0x1a')](function(_0x2936fc){logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x52'),util['inspect'](_0x2936fc,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),'afterCreate',_0x5db7('0x52'),_0x5db7('0x53'));}break;case _0x5db7('0x54'):if(_0x41d17a[_0x5db7('0x34')]&&_0x41d17a[_0x5db7('0x30')]){if(_0x41d17a[_0x5db7('0x55')]){var _0x38d064={'method':_0x5db7('0x39'),'uri':_0x41d17a[_0x5db7('0x55')]+_0x5db7('0x56'),'body':{'username':_0x41d17a[_0x5db7('0x34')],'password':_0x41d17a[_0x5db7('0x30')]},'json':!![]};return rp(_0x38d064)[_0x5db7('0x17')](function(_0x43199d){var _0x41de73={'method':_0x5db7('0x39'),'uri':_0x41d17a['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x41d17a['phone'],'destinations':[{'to':_0x466c5f['phone']}],'text':_0x466c5f[_0x5db7('0xd')],'notifyUrl':_0x41d17a[_0x5db7('0x26')]+'/api/sms/messages/'+_0x466c5f['id']+'/status?token='+_0x41d17a[_0x5db7('0x29')],'notifyContentType':_0x5db7('0x57'),'callbackData':_0x41d17a[_0x5db7('0x23')]+';'+_0x466c5f[_0x5db7('0xd')]}]},'headers':{'Authorization':_0x5db7('0x58')+_0x43199d[_0x5db7('0x29')]},'json':!![]};return rp(_0x41de73)[_0x5db7('0x17')](function(_0x1b1dd1){if(_0x1b1dd1[_0x5db7('0x24')]){var _0x135226={'messageId':_0x1b1dd1[_0x5db7('0x24')][0x0]['messageId']};if(!_0x41d17a[_0x5db7('0x3d')]){_0x135226[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x135226);}else{return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x54'),util['inspect'](_0x1b1dd1,{'showHidden':![],'depth':null}));}});})[_0x5db7('0x1a')](function(_0x1e6e50){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5db7('0x2c'),_0x5db7('0x54'),util[_0x5db7('0x2d')](_0x1e6e50,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x54'),_0x5db7('0x59'));}}else{logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5db7('0x5a'):var _0x183da9=require(_0x5db7('0x5b'));if(_0x41d17a[_0x5db7('0x5c')]){var _0xaa133={};_0xaa133[_0x5db7('0x5d')]=_0x41d17a[_0x5db7('0x34')];_0xaa133[_0x5db7('0x23')]=_0x466c5f['phone'];_0xaa133[_0x5db7('0x32')]=_0x41d17a[_0x5db7('0x23')];_0xaa133[_0x5db7('0x5e')]=_0x466c5f['body'];_0xaa133[_0x5db7('0x5f')]=+new Date();var _0x4a0c88='';var _0x2a6101='';var _0x9931cb=Object[_0x5db7('0x60')](_0xaa133);_0x9931cb['sort']();for(var _0x45324f=0x0;_0x45324f<_0x9931cb[_0x5db7('0x61')];_0x45324f++){if(_0x4a0c88!=''){_0x4a0c88+='&';}_0x4a0c88+=_0x9931cb[_0x45324f]+'='+encodeURIComponent(_0xaa133[_0x9931cb[_0x45324f]]);_0x2a6101+=_0xaa133[_0x9931cb[_0x45324f]];}_0x2a6101+=_0x41d17a[_0x5db7('0x5c')];_0x2a6101=_0x183da9[_0x5db7('0x62')](_0x5db7('0x63'))[_0x5db7('0x18')](_0x2a6101)[_0x5db7('0x64')](_0x5db7('0x65'));if(_0x4a0c88!==''){_0x4a0c88+='&';}_0x4a0c88+='signature='+_0x2a6101;var _0x37b086={'method':'GET','uri':_0x41d17a[_0x5db7('0x55')]+_0x5db7('0x66')+_0x4a0c88,'json':!![]};return rp(_0x37b086)[_0x5db7('0x17')](function(_0x3526d2){var _0x31c5cc=Object['keys'](_0x3526d2);if(_0x3526d2[_0x31c5cc[0x0]][_0x5db7('0x1b')]&&parseInt(_0x3526d2[_0x31c5cc[0x0]][_0x5db7('0x1b')])===0x0){var _0x58d1f2={'messageId':_0x3526d2[_0x31c5cc[0x0]][_0x5db7('0x67')]};if(!_0x41d17a['deliveryReport']){_0x58d1f2[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x58d1f2);}else{return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x5a'),util[_0x5db7('0x2d')](_0x3526d2['error'],{'showHidden':![],'depth':null}));}})[_0x5db7('0x1a')](function(_0x31841f){return logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x5a'),util[_0x5db7('0x2d')](_0x31841f,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),'afterCreate',_0x5db7('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x41d17a['apiKey']){var _0x1941c4={'method':_0x5db7('0x39'),'uri':_0x5db7('0x68'),'headers':{'Authorization':_0x41d17a[_0x5db7('0x5c')]},'body':{'content':_0x466c5f['body'],'to':[_0x466c5f[_0x5db7('0x23')]],'from':_0x41d17a[_0x5db7('0x23')],'binary':![],'clientMessageId':_0x5db7('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x1941c4)[_0x5db7('0x17')](function(_0x3b709c){if(!_0x3b709c[_0x5db7('0x1b')]){var _0x5b0912={'messageId':_0x3b709c[_0x5db7('0x24')][0x0][_0x5db7('0x6a')]};if(!_0x41d17a[_0x5db7('0x3d')]){_0x5b0912[_0x5db7('0x3e')]=!![];}return _0x5d477a[_0x5db7('0x18')](_0x5b0912);}else{return logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),'clickatell',util[_0x5db7('0x2d')](_0x3b709c[_0x5db7('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x183d66){return logger[_0x5db7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5db7('0x2c'),'clickatell',util[_0x5db7('0x2d')](_0x183d66,{'showHidden':![],'depth':null}));});}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),'clickatell',_0x5db7('0x6b'));}break;case _0x5db7('0x6c'):if(_0x41d17a['username']&&_0x41d17a[_0x5db7('0x30')]){var _0x10139c=util['format'](_0x5db7('0x48'),_0x41d17a[_0x5db7('0x34')],_0x41d17a[_0x5db7('0x30')]);var _0x3b74cd={'method':_0x5db7('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x41d17a['accountId']+'/messages','body':{'to':[_0x466c5f['phone']],'text':_0x466c5f['body'],'from':_0x41d17a['phone'],'applicationId':_0x41d17a[_0x5db7('0x6d')]},'headers':{'Authorization':util[_0x5db7('0x47')](_0x5db7('0x50'),new Buffer(_0x10139c)['toString'](_0x5db7('0x4a')))},'json':!![]};rp(_0x3b74cd)[_0x5db7('0x17')](function(_0x25203f){if(_0x25203f['id']){var _0x2113d8={'messageId':_0x25203f['id']};return _0x5d477a['update'](_0x2113d8);}else{logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x6c'),util[_0x5db7('0x2d')](_0x25203f,{'showHidden':![],'depth':null}));}})[_0x5db7('0x1a')](function(_0x3b7e27){logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x6c'),util[_0x5db7('0x2d')](_0x3b7e27,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x6c'),_0x5db7('0x40'));}break;case _0x5db7('0x6e'):if(_0x41d17a[_0x5db7('0x5c')]){var _0x436d36={};var _0x37b086={'method':_0x5db7('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5db7('0x6f')+_0x41d17a[_0x5db7('0x5c')],'Content-Type':_0x5db7('0x57')},'body':{'from':_0x41d17a['phone'],'to':_0x466c5f['phone'],'text':_0x466c5f[_0x5db7('0xd')]},'json':!![]};return rp(_0x37b086)['then'](function(_0x1df412){if(_0x1df412[_0x5db7('0x70')]==0xca){_0x436d36[_0x5db7('0x71')]=_0x1df412;var _0x597107={'method':_0x5db7('0x39'),'uri':_0x5db7('0x72'),'headers':{'Authorization':_0x5db7('0x6f')+_0x41d17a[_0x5db7('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x436d36['message']['refid']},'json':!![]};return rp(_0x597107)[_0x5db7('0x17')](function(_0x51ac70){_0x436d36[_0x5db7('0x73')]=_0x51ac70;var _0x578355={'messageId':_0x436d36['message']['refid'],'read':!![]};return _0x5d477a[_0x5db7('0x18')](_0x578355);});}else{return logger[_0x5db7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5db7('0x2c'),_0x5db7('0x6e'),util['inspect'](_0x1df412,{'showHidden':![],'depth':null}));}})[_0x5db7('0x1a')](function(_0x1706d0){return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),'afterCreate','intelepeer',util['inspect'](_0x1706d0,{'showHidden':![],'depth':null}));});}else{return logger[_0x5db7('0x1b')](_0x5db7('0x2b'),_0x5db7('0x2c'),_0x5db7('0x6e'),_0x5db7('0x74'));}break;}}})['finally'](function(){_0x2ad7f2();});}else{_0x2ad7f2();}}},'charset':_0x5db7('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x90ad=['digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/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/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','sort','md5'];(function(_0x4706ca,_0x15a8d7){var _0xc3acdf=function(_0x390bc2){while(--_0x390bc2){_0x4706ca['push'](_0x4706ca['shift']());}};_0xc3acdf(++_0x15a8d7);}(_0x90ad,0x18e));var _0xd90a=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x90ad[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xd90a('0x0'));var util=require('util');var logger=require(_0xd90a('0x1'))('api');var moment=require(_0xd90a('0x2'));var BPromise=require('bluebird');var rp=require(_0xd90a('0x3'));var fs=require('fs');var path=require(_0xd90a('0x4'));var rimraf=require(_0xd90a('0x5'));var config=require('../../config/environment');var attributes=require(_0xd90a('0x6'));module[_0xd90a('0x7')]=function(_0x45e34b,_0x30a61c){return _0x45e34b[_0xd90a('0x8')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xd90a('0x9'),'fields':[_0xd90a('0x9')]},{'name':_0xd90a('0xa'),'fields':[_0xd90a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x557b5c,_0x48702b,_0x2f6bd3){var _0x130453=_0x45e34b[_0xd90a('0xc')];var _0xa74b36=_0x557b5c[_0xd90a('0xd')]({'plain':!![]});if(_0xa74b36[_0xd90a('0xe')][_0xd90a('0xf')]()==='in'||_0xa74b36[_0xd90a('0xe')]['toLowerCase']()===_0xd90a('0x10')&&!_0xa74b36[_0xd90a('0x11')]&&!_['isNil'](_0xa74b36[_0xd90a('0x12')])&&!_[_0xd90a('0x13')](_0xa74b36['SmsInteractionId'])){_0x130453['SmsInteraction'][_0xd90a('0x14')]({'where':{'id':_0xa74b36[_0xd90a('0x15')]}})[_0xd90a('0x16')](function(_0x5b1cc9){if(_0x5b1cc9){_0x5b1cc9[_0xd90a('0x17')]({'lastMsgAt':_0xa74b36[_0xd90a('0x18')],'lastMsgDirection':_0xa74b36[_0xd90a('0xe')][_0xd90a('0xf')]()});}})[_0xd90a('0x19')](function(_0x3bc1a0){console[_0xd90a('0x1a')](_0x3bc1a0);});}if(_0xa74b36[_0xd90a('0xe')]==='out'&&!_0xa74b36[_0xd90a('0x11')]){var _0xdec43f;_0x130453['SmsAccount'][_0xd90a('0x1b')]({'where':{'id':_0xa74b36[_0xd90a('0x1c')]},'raw':!![]})[_0xd90a('0x16')](function(_0x2489e9){_0xdec43f=_0x2489e9;if(_0xdec43f&&_0xdec43f['type']){switch(_0xdec43f[_0xd90a('0x1d')]){case _0xd90a('0x1e'):var _0x36d001=require(_0xd90a('0x1e'));if(_0xdec43f[_0xd90a('0x1f')]&&_0xdec43f[_0xd90a('0x20')]&&_0xdec43f['phone']){var _0x223126=new _0x36d001(_0xdec43f[_0xd90a('0x1f')],_0xdec43f[_0xd90a('0x20')]);_0x223126[_0xd90a('0x21')][_0xd90a('0x22')]({'body':_0xa74b36[_0xd90a('0xb')],'to':_0xa74b36[_0xd90a('0x23')],'from':_0xdec43f[_0xd90a('0x23')],'statusCallback':_0xdec43f[_0xd90a('0x24')]+'/api/sms/messages/'+_0xa74b36['id']+_0xd90a('0x25')+_0xdec43f[_0xd90a('0x26')]})[_0xd90a('0x16')](function(_0x410e8d){if(_0x410e8d[_0xd90a('0x27')]){return _0x557b5c[_0xd90a('0x17')]({'messageId':_0x410e8d[_0xd90a('0x27')]});}})[_0xd90a('0x19')](function(_0x7769f6){logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x1e'),util[_0xd90a('0x2a')](_0x7769f6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x1e'),_0xd90a('0x2b'));}break;case _0xd90a('0x2c'):var _0x2f274d=_0xd90a('0x2d');if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f[_0xd90a('0x2f')]){var _0x4b926a={'recipient':[_0xa74b36[_0xd90a('0x23')]],'message':_0xa74b36[_0xd90a('0xb')],'message_type':_0xdec43f[_0xd90a('0x30')]};if(_0xdec43f[_0xd90a('0x30')]&&_0xdec43f[_0xd90a('0x30')]!=='SI'){_0x4b926a[_0xd90a('0x31')]=_0xdec43f['phone'];}var _0x35adad={'url':_0x2f274d+'login?username='+_0xdec43f[_0xd90a('0x2e')]+_0xd90a('0x32')+_0xdec43f[_0xd90a('0x2f')],'method':_0xd90a('0x33')};rp(_0x35adad)['then'](function(_0x11c855){var _0x3f1f2b=_0x11c855[_0xd90a('0x34')](';');var _0x242d25={'user_key':_0x3f1f2b[0x0],'session_key':_0x3f1f2b[0x1]};_0x35adad={'url':_0x2f274d+_0xd90a('0x35'),'method':_0xd90a('0x36'),'headers':{'user_key':_0x242d25['user_key'],'Session_key':_0x242d25[_0xd90a('0x37')]},'json':!![],'body':_0x4b926a};return rp(_0x35adad);})[_0xd90a('0x16')](function(_0x44c30d){if(_0x44c30d[_0xd90a('0x38')]>=0x1){var _0x2b38a8={'messageId':_0x44c30d[_0xd90a('0x39')]};if(_0xdec43f[_0xd90a('0x30')]!=='GP'||!_0xdec43f[_0xd90a('0x3a')]){_0x2b38a8['read']=!![];}return _0x557b5c[_0xd90a('0x17')](_0x2b38a8);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x2c'),util[_0xd90a('0x2a')](_0x44c30d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x176deb){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x2c'),util[_0xd90a('0x2a')](_0x176deb,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),'skebby',_0xd90a('0x3b'));}break;case _0xd90a('0x3c'):if(_0xdec43f[_0xd90a('0x20')]){var _0x35911c={'recipient':_0xa74b36[_0xd90a('0x23')],'message':_0xa74b36[_0xd90a('0xb')],'sender':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f['phone'],'authorization':_0xdec43f[_0xd90a('0x20')]};var _0x48702b={'method':'POST','uri':_0xd90a('0x3e'),'body':_0x35911c,'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0xdce34e){var _0x3fc547={'messageId':_0xdce34e[_0xd90a('0x3f')]};if(!_0xdec43f['deliveryReport']){_0x3fc547[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x3fc547);})[_0xd90a('0x19')](function(_0x89ac26){logger['error'](_0xd90a('0x28'),'afterCreate',_0xd90a('0x3c'),util['inspect'](_0x89ac26,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xd90a('0x41'):if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f['password']){var _0x35911c={'messages':[{'source':_0xd90a('0x42'),'to':_0xa74b36[_0xd90a('0x23')],'body':_0xa74b36[_0xd90a('0xb')],'from':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f['phone']}]};var _0x45dbec=util['format'](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x2e')],_0xdec43f['password']);var _0x48702b={'method':_0xd90a('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x35911c,'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)['toString'](_0xd90a('0x46')))},'json':!![]};rp(_0x48702b)['then'](function(_0xa191e7){if(_0xa191e7[_0xd90a('0x47')]>=0xc8&&_0xa191e7['http_code']<=0xce){if(_0xa191e7[_0xd90a('0x48')]&&_0xa191e7[_0xd90a('0x48')][_0xd90a('0x49')]>0x0){var _0x2b6fd7=_[_0xd90a('0x4a')](_0xa191e7['data'][_0xd90a('0x21')]);var _0x4f58db={'messageId':_0x2b6fd7['message_id']};if(!_0xdec43f['deliveryReport']){_0x4f58db[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x4f58db);}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0xa191e7,{'showHidden':![],'depth':null}));}}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x4b'),util[_0xd90a('0x2a')](_0xa191e7,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x174462){logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x4b'),util[_0xd90a('0x2a')](_0x174462,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd90a('0x4c'):if(_0xdec43f[_0xd90a('0x4d')]&&_0xdec43f[_0xd90a('0x20')]){var _0x35911c={'dst':_0xa74b36[_0xd90a('0x23')],'text':_0xa74b36[_0xd90a('0xb')],'src':_0xdec43f[_0xd90a('0x3d')]||_0xdec43f[_0xd90a('0x23')],'url':_0xdec43f[_0xd90a('0x24')]+_0xd90a('0x4e')+_0xa74b36['id']+'/status?token='+_0xdec43f[_0xd90a('0x26')]};var _0x45dbec=util[_0xd90a('0x44')](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x4d')],_0xdec43f[_0xd90a('0x20')]);var _0x48702b={'method':'POST','uri':util[_0xd90a('0x44')](_0xd90a('0x4f'),_0xdec43f['authId']),'body':_0x35911c,'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)['toString'](_0xd90a('0x46')))},'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0x510412){var _0x46f55f={'messageId':_0x510412[_0xd90a('0x50')][0x0]};return _0x557b5c['update'](_0x46f55f);})[_0xd90a('0x19')](function(_0x507f7d){logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x4c'),util['inspect'](_0x507f7d,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd90a('0x29'),_0xd90a('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd90a('0x51'):if(_0xdec43f['username']&&_0xdec43f[_0xd90a('0x2f')]){if(_0xdec43f['baseUrl']){var _0x26a55e={'method':_0xd90a('0x36'),'uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x53'),'body':{'username':_0xdec43f[_0xd90a('0x2e')],'password':_0xdec43f[_0xd90a('0x2f')]},'json':!![]};return rp(_0x26a55e)[_0xd90a('0x16')](function(_0x288f22){var _0x4427cd={'method':'POST','uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x54'),'body':{'messages':[{'from':_0xdec43f[_0xd90a('0x23')],'destinations':[{'to':_0xa74b36[_0xd90a('0x23')]}],'text':_0xa74b36[_0xd90a('0xb')],'notifyUrl':_0xdec43f[_0xd90a('0x24')]+_0xd90a('0x4e')+_0xa74b36['id']+_0xd90a('0x25')+_0xdec43f[_0xd90a('0x26')],'notifyContentType':'application/json','callbackData':_0xdec43f['phone']+';'+_0xa74b36[_0xd90a('0xb')]}]},'headers':{'Authorization':_0xd90a('0x55')+_0x288f22[_0xd90a('0x26')]},'json':!![]};return rp(_0x4427cd)['then'](function(_0x359d7c){if(_0x359d7c['messages']){var _0x56bdba={'messageId':_0x359d7c['messages'][0x0][_0xd90a('0x9')]};if(!_0xdec43f[_0xd90a('0x3a')]){_0x56bdba[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x56bdba);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x51'),util['inspect'](_0x359d7c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x13bee4){return logger[_0xd90a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd90a('0x51'),util['inspect'](_0x13bee4,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate',_0xd90a('0x51'),_0xd90a('0x56'));}}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate',_0xd90a('0x51'),_0xd90a('0x3b'));}break;case _0xd90a('0x57'):var _0x1cf1aa=require(_0xd90a('0x58'));if(_0xdec43f[_0xd90a('0x59')]){var _0x54d7c0={};_0x54d7c0[_0xd90a('0x5a')]=_0xdec43f[_0xd90a('0x2e')];_0x54d7c0['phone']=_0xa74b36['phone'];_0x54d7c0['sender']=_0xdec43f[_0xd90a('0x23')];_0x54d7c0['text']=_0xa74b36[_0xd90a('0xb')];_0x54d7c0[_0xd90a('0x5b')]=+new Date();var _0x457c5d='';var _0x50ad2d='';var _0x439e08=Object['keys'](_0x54d7c0);_0x439e08[_0xd90a('0x5c')]();for(var _0x3e1147=0x0;_0x3e1147<_0x439e08['length'];_0x3e1147++){if(_0x457c5d!=''){_0x457c5d+='&';}_0x457c5d+=_0x439e08[_0x3e1147]+'='+encodeURIComponent(_0x54d7c0[_0x439e08[_0x3e1147]]);_0x50ad2d+=_0x54d7c0[_0x439e08[_0x3e1147]];}_0x50ad2d+=_0xdec43f[_0xd90a('0x59')];_0x50ad2d=_0x1cf1aa['createHash'](_0xd90a('0x5d'))['update'](_0x50ad2d)[_0xd90a('0x5e')](_0xd90a('0x5f'));if(_0x457c5d!==''){_0x457c5d+='&';}_0x457c5d+=_0xd90a('0x60')+_0x50ad2d;var _0x35adad={'method':_0xd90a('0x33'),'uri':_0xdec43f[_0xd90a('0x52')]+_0xd90a('0x61')+_0x457c5d,'json':!![]};return rp(_0x35adad)[_0xd90a('0x16')](function(_0x271d54){var _0x232c28=Object['keys'](_0x271d54);if(_0x271d54[_0x232c28[0x0]][_0xd90a('0x1a')]&&parseInt(_0x271d54[_0x232c28[0x0]]['error'])===0x0){var _0x565646={'messageId':_0x271d54[_0x232c28[0x0]][_0xd90a('0x62')]};if(!_0xdec43f[_0xd90a('0x3a')]){_0x565646[_0xd90a('0x40')]=!![];}return _0x557b5c[_0xd90a('0x17')](_0x565646);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x57'),util[_0xd90a('0x2a')](_0x271d54[_0xd90a('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x55611f){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','csc',util[_0xd90a('0x2a')](_0x55611f,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x57'),_0xd90a('0x63'));}break;case _0xd90a('0x64'):if(_0xdec43f['apiKey']){var _0x52d010={'method':_0xd90a('0x36'),'uri':_0xd90a('0x65'),'headers':{'Authorization':_0xdec43f['apiKey']},'body':{'content':_0xa74b36[_0xd90a('0xb')],'to':[_0xa74b36[_0xd90a('0x23')]],'from':_0xdec43f[_0xd90a('0x23')],'binary':![],'clientMessageId':_0xd90a('0x66'),'charset':_0xd90a('0x67')},'json':!![]};rp(_0x52d010)['then'](function(_0x39c8e6){if(!_0x39c8e6[_0xd90a('0x1a')]){var _0x14db8c={'messageId':_0x39c8e6[_0xd90a('0x21')][0x0]['apiMessageId']};if(!_0xdec43f[_0xd90a('0x3a')]){_0x14db8c[_0xd90a('0x40')]=!![];}return _0x557b5c['update'](_0x14db8c);}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x64'),util[_0xd90a('0x2a')](_0x39c8e6[_0xd90a('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x39d9ba){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),'afterCreate','clickatell',util[_0xd90a('0x2a')](_0x39d9ba,{'showHidden':![],'depth':null}));});}else{logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x64'),_0xd90a('0x63'));}break;case _0xd90a('0x68'):if(_0xdec43f[_0xd90a('0x2e')]&&_0xdec43f['password']){var _0x45dbec=util[_0xd90a('0x44')](_0xd90a('0x43'),_0xdec43f[_0xd90a('0x2e')],_0xdec43f[_0xd90a('0x2f')]);var _0x48702b={'method':_0xd90a('0x36'),'uri':_0xd90a('0x69')+_0xdec43f[_0xd90a('0x6a')]+_0xd90a('0x6b'),'body':{'to':[_0xa74b36['phone']],'text':_0xa74b36[_0xd90a('0xb')],'from':_0xdec43f[_0xd90a('0x23')],'applicationId':_0xdec43f[_0xd90a('0x6c')]},'headers':{'Authorization':util[_0xd90a('0x44')](_0xd90a('0x45'),new Buffer(_0x45dbec)[_0xd90a('0x6d')]('base64'))},'json':!![]};rp(_0x48702b)[_0xd90a('0x16')](function(_0xd11cf2){if(_0xd11cf2['id']){var _0x45b997={'messageId':_0xd11cf2['id']};return _0x557b5c['update'](_0x45b997);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util['inspect'](_0xd11cf2,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x9b86c6){logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x68'),util['inspect'](_0x9b86c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x68'),_0xd90a('0x3b'));}break;case _0xd90a('0x6e'):if(_0xdec43f['apiKey']){var _0x13c3b7={};var _0x35adad={'method':_0xd90a('0x36'),'uri':_0xd90a('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0xdec43f[_0xd90a('0x59')],'Content-Type':_0xd90a('0x70')},'body':{'from':_0xdec43f[_0xd90a('0x23')],'to':_0xa74b36[_0xd90a('0x23')],'text':_0xa74b36[_0xd90a('0xb')]},'json':!![]};return rp(_0x35adad)[_0xd90a('0x16')](function(_0x306d93){if(_0x306d93[_0xd90a('0x71')]==0xca){_0x13c3b7[_0xd90a('0x72')]=_0x306d93;var _0x27550d={'method':'POST','uri':_0xd90a('0x73'),'headers':{'Authorization':_0xd90a('0x74')+_0xdec43f['apiKey'],'Content-Type':_0xd90a('0x70')},'body':{'refid':_0x13c3b7[_0xd90a('0x72')][_0xd90a('0x75')]},'json':!![]};return rp(_0x27550d)[_0xd90a('0x16')](function(_0x1b586a){_0x13c3b7[_0xd90a('0x76')]=_0x1b586a;var _0x56ef84={'messageId':_0x13c3b7[_0xd90a('0x72')][_0xd90a('0x75')],'read':!![]};return _0x557b5c[_0xd90a('0x17')](_0x56ef84);});}else{return logger['error'](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),util['inspect'](_0x306d93,{'showHidden':![],'depth':null}));}})[_0xd90a('0x19')](function(_0x2b178a){return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),util['inspect'](_0x2b178a,{'showHidden':![],'depth':null}));});}else{return logger[_0xd90a('0x1a')](_0xd90a('0x28'),_0xd90a('0x29'),_0xd90a('0x6e'),_0xd90a('0x77'));}break;}}})[_0xd90a('0x78')](function(){_0x2f6bd3();});}else{_0x2f6bd3();}}},'charset':_0xd90a('0x79'),'collate':_0xd90a('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index adae523..c32d226 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 _0x57bb=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47804d,_0x269d3b){var _0x560e77=function(_0xf783cb){while(--_0xf783cb){_0x47804d['push'](_0x47804d['shift']());}};_0x560e77(++_0x269d3b);}(_0x57bb,0x7c));var _0xb57b=function(_0x2ba5cf,_0xd06565){_0x2ba5cf=_0x2ba5cf-0x0;var _0x1bc8f6=_0x57bb[_0x2ba5cf];return _0x1bc8f6;};'use strict';var _=require(_0xb57b('0x0'));var util=require(_0xb57b('0x1'));var moment=require(_0xb57b('0x2'));var BPromise=require(_0xb57b('0x3'));var rs=require(_0xb57b('0x4'));var fs=require('fs');var Redis=require(_0xb57b('0x5'));var db=require(_0xb57b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb57b('0x7'))(_0xb57b('0x8'));var config=require(_0xb57b('0x9'));var jayson=require(_0xb57b('0xa'));var client=jayson[_0xb57b('0xb')][_0xb57b('0xc')]({'port':0x232a});config[_0xb57b('0xd')]=_[_0xb57b('0xe')](config[_0xb57b('0xd')],{'host':_0xb57b('0xf'),'port':0x18eb});var socket=require(_0xb57b('0x10'))(new Redis(config[_0xb57b('0xd')]));require(_0xb57b('0x11'))[_0xb57b('0x12')](socket);function respondWithRpcPromise(_0x3bfce2,_0x28acff,_0x1ccde4){return new BPromise(function(_0x302a33,_0x5063a7){return client[_0xb57b('0x13')](_0x3bfce2,_0x1ccde4)[_0xb57b('0x14')](function(_0x1ae87d){logger['info'](_0xb57b('0x15'),_0x28acff,_0xb57b('0x16'));logger[_0xb57b('0x17')](_0xb57b('0x18'),_0x28acff,_0xb57b('0x16'),JSON[_0xb57b('0x19')](_0x1ae87d));if(_0x1ae87d[_0xb57b('0x1a')]){if(_0x1ae87d[_0xb57b('0x1a')][_0xb57b('0x1b')]===0x1f4){logger['error'](_0xb57b('0x15'),_0x28acff,_0x1ae87d[_0xb57b('0x1a')][_0xb57b('0x1c')]);return _0x5063a7(_0x1ae87d[_0xb57b('0x1a')][_0xb57b('0x1c')]);}logger[_0xb57b('0x1a')](_0xb57b('0x15'),_0x28acff,_0x1ae87d[_0xb57b('0x1a')][_0xb57b('0x1c')]);return _0x302a33(_0x1ae87d['error']['message']);}else{logger[_0xb57b('0x1d')]('SmsMessage,\x20%s,\x20%s',_0x28acff,_0xb57b('0x16'));_0x302a33(_0x1ae87d[_0xb57b('0x1e')][_0xb57b('0x1c')]);}})[_0xb57b('0x1f')](function(_0x1121bd){logger[_0xb57b('0x1a')](_0xb57b('0x15'),_0x28acff,_0x1121bd);_0x5063a7(_0x1121bd);});});}exports['CreateSmsMessage']=function(_0x506bfd){var _0x329d73=this;return new Promise(function(_0x5c2d4e,_0x3f8d6c){return db[_0xb57b('0x20')][_0xb57b('0x21')](_0x506bfd['body'],{'raw':_0x506bfd[_0xb57b('0x22')]?_0x506bfd[_0xb57b('0x22')][_0xb57b('0x23')]===undefined?!![]:![]:!![]})[_0xb57b('0x14')](function(_0x1d0341){logger['info'](_0xb57b('0x24'),_0x506bfd);logger['debug']('CreateSmsMessage',_0x506bfd,JSON[_0xb57b('0x19')](_0x1d0341));_0x5c2d4e(_0x1d0341);})[_0xb57b('0x1f')](function(_0x13a05b){logger[_0xb57b('0x1a')](_0xb57b('0x24'),_0x13a05b[_0xb57b('0x1c')],_0x506bfd);_0x3f8d6c(_0x329d73[_0xb57b('0x1a')](0x1f4,_0x13a05b[_0xb57b('0x1c')]));});});}; \ No newline at end of file +var _0x757d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util'];(function(_0x249862,_0x22ad39){var _0xcc638a=function(_0x4c0858){while(--_0x4c0858){_0x249862['push'](_0x249862['shift']());}};_0xcc638a(++_0x22ad39);}(_0x757d,0x65));var _0xd757=function(_0x20a137,_0x4d9549){_0x20a137=_0x20a137-0x0;var _0x3dc414=_0x757d[_0x20a137];return _0x3dc414;};'use strict';var _=require('lodash');var util=require(_0xd757('0x0'));var moment=require(_0xd757('0x1'));var BPromise=require(_0xd757('0x2'));var rs=require(_0xd757('0x3'));var fs=require('fs');var Redis=require(_0xd757('0x4'));var db=require(_0xd757('0x5'))['db'];var utils=require(_0xd757('0x6'));var logger=require(_0xd757('0x7'))(_0xd757('0x8'));var config=require(_0xd757('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd757('0xa')][_0xd757('0xb')]({'port':0x232a});config[_0xd757('0xc')]=_['defaults'](config[_0xd757('0xc')],{'host':_0xd757('0xd'),'port':0x18eb});var socket=require(_0xd757('0xe'))(new Redis(config['redis']));require(_0xd757('0xf'))[_0xd757('0x10')](socket);function respondWithRpcPromise(_0x107fef,_0x2725fc,_0x28eaf2){return new BPromise(function(_0x1dc3d6,_0x4da76c){return client[_0xd757('0x11')](_0x107fef,_0x28eaf2)[_0xd757('0x12')](function(_0x1d48eb){logger[_0xd757('0x13')](_0xd757('0x14'),_0x2725fc,_0xd757('0x15'));logger[_0xd757('0x16')](_0xd757('0x17'),_0x2725fc,_0xd757('0x15'),JSON[_0xd757('0x18')](_0x1d48eb));if(_0x1d48eb['error']){if(_0x1d48eb['error']['code']===0x1f4){logger[_0xd757('0x19')](_0xd757('0x14'),_0x2725fc,_0x1d48eb[_0xd757('0x19')][_0xd757('0x1a')]);return _0x4da76c(_0x1d48eb[_0xd757('0x19')]['message']);}logger[_0xd757('0x19')](_0xd757('0x14'),_0x2725fc,_0x1d48eb[_0xd757('0x19')][_0xd757('0x1a')]);return _0x1dc3d6(_0x1d48eb['error']['message']);}else{logger[_0xd757('0x13')](_0xd757('0x14'),_0x2725fc,_0xd757('0x15'));_0x1dc3d6(_0x1d48eb['result'][_0xd757('0x1a')]);}})[_0xd757('0x1b')](function(_0x57b4a1){logger['error'](_0xd757('0x14'),_0x2725fc,_0x57b4a1);_0x4da76c(_0x57b4a1);});});}exports['CreateSmsMessage']=function(_0x16ca86){var _0x192a11=this;return new Promise(function(_0x379601,_0x2b0b29){return db[_0xd757('0x1c')][_0xd757('0x1d')](_0x16ca86[_0xd757('0x1e')],{'raw':_0x16ca86[_0xd757('0x1f')]?_0x16ca86[_0xd757('0x1f')][_0xd757('0x20')]===undefined?!![]:![]:!![]})[_0xd757('0x12')](function(_0x276c2d){logger[_0xd757('0x13')](_0xd757('0x21'),_0x16ca86);logger[_0xd757('0x16')](_0xd757('0x21'),_0x16ca86,JSON[_0xd757('0x18')](_0x276c2d));_0x379601(_0x276c2d);})[_0xd757('0x1b')](function(_0x365a3a){logger['error'](_0xd757('0x21'),_0x365a3a['message'],_0x16ca86);_0x2b0b29(_0x192a11[_0xd757('0x19')](0x1f4,_0x365a3a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index dc555cd..7110c6a 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 _0x578f=['length','smsMessage:','./smsMessage.events','save','emit','removeListener','register'];(function(_0x5466e0,_0x586206){var _0xf32c89=function(_0x68e0e9){while(--_0x68e0e9){_0x5466e0['push'](_0x5466e0['shift']());}};_0xf32c89(++_0x586206);}(_0x578f,0xe2));var _0xf578=function(_0xa401d1,_0x5a71c5){_0xa401d1=_0xa401d1-0x0;var _0x14c978=_0x578f[_0xa401d1];return _0x14c978;};'use strict';var SmsMessageEvents=require(_0xf578('0x0'));var events=[_0xf578('0x1'),'remove','update'];function createListener(_0x18948f,_0x3b07e2){return function(_0x18cad6){_0x3b07e2[_0xf578('0x2')](_0x18948f,_0x18cad6);};}function removeListener(_0x6e8d7e,_0x213921){return function(){SmsMessageEvents[_0xf578('0x3')](_0x6e8d7e,_0x213921);};}exports[_0xf578('0x4')]=function(_0x1dc928){for(var _0x345845=0x0,_0x5ef0bb=events[_0xf578('0x5')];_0x345845<_0x5ef0bb;_0x345845++){var _0x4a1f5b=events[_0x345845];var _0x3bb70f=createListener(_0xf578('0x6')+_0x4a1f5b,_0x1dc928);SmsMessageEvents['on'](_0x4a1f5b,_0x3bb70f);}}; \ No newline at end of file +var _0x9807=['update','emit','removeListener','register','./smsMessage.events','save'];(function(_0x3347ed,_0x5e569b){var _0x5d4dcb=function(_0x140baa){while(--_0x140baa){_0x3347ed['push'](_0x3347ed['shift']());}};_0x5d4dcb(++_0x5e569b);}(_0x9807,0x11e));var _0x7980=function(_0x2fac53,_0x14b60a){_0x2fac53=_0x2fac53-0x0;var _0x4a17dd=_0x9807[_0x2fac53];return _0x4a17dd;};'use strict';var SmsMessageEvents=require(_0x7980('0x0'));var events=[_0x7980('0x1'),'remove',_0x7980('0x2')];function createListener(_0x3057f8,_0x4bc0b3){return function(_0x2187e5){_0x4bc0b3[_0x7980('0x3')](_0x3057f8,_0x2187e5);};}function removeListener(_0x579e49,_0x40c1df){return function(){SmsMessageEvents[_0x7980('0x4')](_0x579e49,_0x40c1df);};}exports[_0x7980('0x5')]=function(_0x53d0db){for(var _0x4a40c6=0x0,_0x41d360=events['length'];_0x4a40c6<_0x41d360;_0x4a40c6++){var _0x85cb45=events[_0x4a40c6];var _0x2c43b7=createListener('smsMessage:'+_0x85cb45,_0x53d0db);SmsMessageEvents['on'](_0x85cb45,_0x2c43b7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 081d8da..7a11fba 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 _0xcad0=['getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x3a7382,_0x417165){var _0x4ba1b2=function(_0x206bab){while(--_0x206bab){_0x3a7382['push'](_0x3a7382['shift']());}};_0x4ba1b2(++_0x417165);}(_0xcad0,0xc5));var _0x0cad=function(_0x19f432,_0x32ce04){_0x19f432=_0x19f432-0x0;var _0x1f03de=_0xcad0[_0x19f432];return _0x1f03de;};'use strict';var multer=require(_0x0cad('0x0'));var util=require(_0x0cad('0x1'));var path=require(_0x0cad('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cad('0x3'));var router=express[_0x0cad('0x4')]();var fs_extra=require(_0x0cad('0x5'));var auth=require(_0x0cad('0x6'));var interaction=require(_0x0cad('0x7'));var config=require('../../config/environment');var controller=require(_0x0cad('0x8'));router[_0x0cad('0x9')]('/',auth[_0x0cad('0xa')](),controller[_0x0cad('0xb')]);router[_0x0cad('0x9')](_0x0cad('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0cad('0x9')](_0x0cad('0xd'),auth[_0x0cad('0xa')](),controller[_0x0cad('0xe')]);router[_0x0cad('0x9')](_0x0cad('0xf'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x10')]);router['get'](_0x0cad('0x11'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x12')]);router[_0x0cad('0x9')](_0x0cad('0x13'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x14')]);router[_0x0cad('0x15')]('/',auth[_0x0cad('0xa')](),controller[_0x0cad('0x16')]);router['post']('/:id/teams',auth[_0x0cad('0xa')](),controller[_0x0cad('0x17')]);router[_0x0cad('0x15')](_0x0cad('0x13'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x18')]);router[_0x0cad('0x19')](_0x0cad('0xd'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x1a')]);router[_0x0cad('0x1b')]('/:id',auth[_0x0cad('0xa')](),controller['destroy']);router[_0x0cad('0x1b')](_0x0cad('0x11'),auth['isAuthenticated'](),controller[_0x0cad('0x1c')]);router['delete'](_0x0cad('0x13'),auth[_0x0cad('0xa')](),controller[_0x0cad('0x1d')]);module[_0x0cad('0x1e')]=router; \ No newline at end of file +var _0x1479=['delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update'];(function(_0x2c2e74,_0x5e8ebf){var _0x50db91=function(_0xfa65e3){while(--_0xfa65e3){_0x2c2e74['push'](_0x2c2e74['shift']());}};_0x50db91(++_0x5e8ebf);}(_0x1479,0x14e));var _0x9147=function(_0x4a3103,_0x3417bd){_0x4a3103=_0x4a3103-0x0;var _0x780cea=_0x1479[_0x4a3103];return _0x780cea;};'use strict';var multer=require(_0x9147('0x0'));var util=require(_0x9147('0x1'));var path=require(_0x9147('0x2'));var timeout=require(_0x9147('0x3'));var express=require(_0x9147('0x4'));var router=express[_0x9147('0x5')]();var fs_extra=require(_0x9147('0x6'));var auth=require(_0x9147('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9147('0x8'));var controller=require(_0x9147('0x9'));router[_0x9147('0xa')]('/',auth[_0x9147('0xb')](),controller[_0x9147('0xc')]);router[_0x9147('0xa')](_0x9147('0xd'),auth[_0x9147('0xb')](),controller[_0x9147('0xe')]);router[_0x9147('0xa')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller['show']);router[_0x9147('0xa')](_0x9147('0x10'),auth['isAuthenticated'](),controller[_0x9147('0x11')]);router[_0x9147('0xa')](_0x9147('0x12'),auth[_0x9147('0xb')](),controller['getTeams']);router[_0x9147('0xa')](_0x9147('0x13'),auth[_0x9147('0xb')](),controller['getAgents']);router[_0x9147('0x14')]('/',auth['isAuthenticated'](),controller[_0x9147('0x15')]);router[_0x9147('0x14')](_0x9147('0x12'),auth['isAuthenticated'](),controller[_0x9147('0x16')]);router['post'](_0x9147('0x13'),auth[_0x9147('0xb')](),controller[_0x9147('0x17')]);router[_0x9147('0x18')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller[_0x9147('0x19')]);router[_0x9147('0x1a')](_0x9147('0xf'),auth[_0x9147('0xb')](),controller['destroy']);router['delete'](_0x9147('0x12'),auth[_0x9147('0xb')](),controller[_0x9147('0x1b')]);router[_0x9147('0x1a')](_0x9147('0x13'),auth[_0x9147('0xb')](),controller[_0x9147('0x1c')]);module[_0x9147('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 20af855..c4d71ed 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 _0x8689=['beepall','roundrobin','sequelize','name','STRING','INTEGER','rrmemory'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x8689,0xcd));var _0x9868=function(_0x23584e,_0x49748e){_0x23584e=_0x23584e-0x0;var _0x3aa530=_0x8689[_0x23584e];return _0x3aa530;};'use strict';var Sequelize=require(_0x9868('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9868('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9868('0x2')]},'timeout':{'type':Sequelize[_0x9868('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9868('0x4'),_0x9868('0x5'),_0x9868('0x6'))}}; \ No newline at end of file +var _0x609c=['STRING','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x609c,0x1e4));var _0xc609=function(_0x502e47,_0x535f0d){_0x502e47=_0x502e47-0x0;var _0x11a93a=_0x609c[_0x502e47];return _0x11a93a;};'use strict';var Sequelize=require(_0xc609('0x0'));module[_0xc609('0x1')]={'name':{'type':Sequelize[_0xc609('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc609('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc609('0x3')](_0xc609('0x4'),_0xc609('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index dfb96e8..09b4856 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x4421b5,_0x13d0f6){var _0x26cca3=function(_0x295016){while(--_0x295016){_0x4421b5['push'](_0x4421b5['shift']());}};_0x26cca3(++_0x13d0f6);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,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(_0x205b6a,_0x426c63){var _0x2d8e62=function(_0x417a6b){while(--_0x417a6b){_0x205b6a['push'](_0x205b6a['shift']());}};_0x2d8e62(++_0x426c63);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e1d10,_0x986873){_0x1e1d10=_0x1e1d10-0x0;var _0x2fcb97=_0x2ef3[_0x1e1d10];return _0x2fcb97;};'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 a67a7b5..2a0cf45 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 _0x8ee3=['hook','exports','../../mysqldb','SmsQueue','save','remove','emit','hasOwnProperty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ee3,0x1da));var _0x38ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ee3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x38ee('0x0'))['db'][_0x38ee('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x38ee('0x2'),'afterUpdate':'update','afterDestroy':_0x38ee('0x3')};function emitEvent(_0x4dcaad){return function(_0x5db8e1,_0x17fdc1,_0x1ef58b){SmsQueueEvents[_0x38ee('0x4')](_0x4dcaad+':'+_0x5db8e1['id'],_0x5db8e1);SmsQueueEvents[_0x38ee('0x4')](_0x4dcaad,_0x5db8e1);_0x1ef58b(null);};}for(var e in events){if(events[_0x38ee('0x5')](e)){var event=events[e];SmsQueue[_0x38ee('0x6')](e,emitEvent(event));}}module[_0x38ee('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x3ccb=['SmsQueue','setMaxListeners','emit','hook','events'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0x3ccb,0xdb));var _0xb3cc=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x3ccb[_0x1f4fe3];return _0xe8dd52;};'use strict';var EventEmitter=require(_0xb3cc('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb3cc('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb3cc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4d4618){return function(_0x29bf24,_0x1ac04d,_0x18d24c){SmsQueueEvents[_0xb3cc('0x3')](_0x4d4618+':'+_0x29bf24['id'],_0x29bf24);SmsQueueEvents['emit'](_0x4d4618,_0x29bf24);_0x18d24c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb3cc('0x4')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index cf2dc4f..6858530 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 _0x8b7c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define','SmsQueue','sms_queues'];(function(_0x2fb39d,_0x5da15f){var _0x56a497=function(_0x3e5717){while(--_0x3e5717){_0x2fb39d['push'](_0x2fb39d['shift']());}};_0x56a497(++_0x5da15f);}(_0x8b7c,0x1a2));var _0xc8b7=function(_0x43330e,_0x3ddaae){_0x43330e=_0x43330e-0x0;var _0x9fedf4=_0x8b7c[_0x43330e];return _0x9fedf4;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require('moment');var BPromise=require(_0xc8b7('0x4'));var rp=require(_0xc8b7('0x5'));var fs=require('fs');var path=require(_0xc8b7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xc8b7('0x7')]=function(_0x11b449,_0x2040a2){return _0x11b449[_0xc8b7('0x8')](_0xc8b7('0x9'),attributes,{'tableName':_0xc8b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a3d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','../../config/logger'];(function(_0x2d35b5,_0x520c90){var _0x333e77=function(_0x260f8a){while(--_0x260f8a){_0x2d35b5['push'](_0x2d35b5['shift']());}};_0x333e77(++_0x520c90);}(_0x4a3d,0x111));var _0xd4a3=function(_0x4e4eff,_0x59e6f8){_0x4e4eff=_0x4e4eff-0x0;var _0x181d13=_0x4a3d[_0x4e4eff];return _0x181d13;};'use strict';var _=require(_0xd4a3('0x0'));var util=require('util');var logger=require(_0xd4a3('0x1'))('api');var moment=require(_0xd4a3('0x2'));var BPromise=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var fs=require('fs');var path=require(_0xd4a3('0x5'));var rimraf=require(_0xd4a3('0x6'));var config=require(_0xd4a3('0x7'));var attributes=require('./smsQueue.attributes');module[_0xd4a3('0x8')]=function(_0x6b01bb,_0x19d36c){return _0x6b01bb[_0xd4a3('0x9')](_0xd4a3('0xa'),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 5f7ffe3..1a5f1d1 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 _0x2440=['options','raw','limit','include','map','model','attributes','catch','ShowSmsQueue','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsQueue.socket','register','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x2440,0x187));var _0x0244=function(_0x529190,_0x43d004){_0x529190=_0x529190-0x0;var _0x2a9984=_0x2440[_0x529190];return _0x2a9984;};'use strict';var _=require(_0x0244('0x0'));var util=require('util');var moment=require(_0x0244('0x1'));var BPromise=require('bluebird');var rs=require(_0x0244('0x2'));var fs=require('fs');var Redis=require(_0x0244('0x3'));var db=require(_0x0244('0x4'))['db'];var utils=require(_0x0244('0x5'));var logger=require('../../config/logger')(_0x0244('0x6'));var config=require(_0x0244('0x7'));var jayson=require(_0x0244('0x8'));var client=jayson[_0x0244('0x9')]['http']({'port':0x232a});config[_0x0244('0xa')]=_[_0x0244('0xb')](config[_0x0244('0xa')],{'host':_0x0244('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0244('0xa')]));require(_0x0244('0xd'))[_0x0244('0xe')](socket);function respondWithRpcPromise(_0x24f8ee,_0x3a1580,_0x35f671){return new BPromise(function(_0x8fdfd2,_0x1b7dd0){return client['request'](_0x24f8ee,_0x35f671)[_0x0244('0xf')](function(_0x4f3314){logger[_0x0244('0x10')]('SmsQueue,\x20%s,\x20%s',_0x3a1580,'request\x20sent');logger[_0x0244('0x11')](_0x0244('0x12'),_0x3a1580,_0x0244('0x13'),JSON[_0x0244('0x14')](_0x4f3314));if(_0x4f3314[_0x0244('0x15')]){if(_0x4f3314[_0x0244('0x15')]['code']===0x1f4){logger['error'](_0x0244('0x16'),_0x3a1580,_0x4f3314['error'][_0x0244('0x17')]);return _0x1b7dd0(_0x4f3314[_0x0244('0x15')][_0x0244('0x17')]);}logger[_0x0244('0x15')](_0x0244('0x16'),_0x3a1580,_0x4f3314[_0x0244('0x15')][_0x0244('0x17')]);return _0x8fdfd2(_0x4f3314['error'][_0x0244('0x17')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x3a1580,_0x0244('0x13'));_0x8fdfd2(_0x4f3314[_0x0244('0x18')][_0x0244('0x17')]);}})['catch'](function(_0x21ffd2){logger[_0x0244('0x15')](_0x0244('0x16'),_0x3a1580,_0x21ffd2);_0x1b7dd0(_0x21ffd2);});});}exports[_0x0244('0x19')]=function(_0x4a6b78){var _0x2ca8c0=this;return new Promise(function(_0x138890,_0x77b49a){return db[_0x0244('0x1a')]['findAll']({'raw':_0x4a6b78[_0x0244('0x1b')]?_0x4a6b78[_0x0244('0x1b')][_0x0244('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a6b78[_0x0244('0x1b')]?_0x4a6b78['options']['where']||null:null,'attributes':_0x4a6b78[_0x0244('0x1b')]?_0x4a6b78[_0x0244('0x1b')]['attributes']||null:null,'limit':_0x4a6b78[_0x0244('0x1b')]?_0x4a6b78['options'][_0x0244('0x1d')]||null:null,'include':_0x4a6b78['options']?_0x4a6b78[_0x0244('0x1b')][_0x0244('0x1e')]?_[_0x0244('0x1f')](_0x4a6b78['options'][_0x0244('0x1e')],function(_0x54ca33){return{'model':db[_0x54ca33[_0x0244('0x20')]],'as':_0x54ca33['as'],'attributes':_0x54ca33[_0x0244('0x21')],'include':_0x54ca33[_0x0244('0x1e')]?_[_0x0244('0x1f')](_0x54ca33[_0x0244('0x1e')],function(_0x3f14b3){return{'model':db[_0x3f14b3['model']],'as':_0x3f14b3['as'],'attributes':_0x3f14b3['attributes'],'include':_0x3f14b3[_0x0244('0x1e')]?_[_0x0244('0x1f')](_0x3f14b3[_0x0244('0x1e')],function(_0x595424){return{'model':db[_0x595424[_0x0244('0x20')]],'as':_0x595424['as'],'attributes':_0x595424['attributes']};}):[]};}):[]};}):[]:[]})[_0x0244('0xf')](function(_0x39d9b6){logger[_0x0244('0x10')](_0x0244('0x19'),_0x4a6b78);logger[_0x0244('0x11')](_0x0244('0x19'),_0x4a6b78,JSON[_0x0244('0x14')](_0x39d9b6));_0x138890(_0x39d9b6);})[_0x0244('0x22')](function(_0x548586){logger[_0x0244('0x15')](_0x0244('0x19'),_0x548586[_0x0244('0x17')],_0x4a6b78);_0x77b49a(_0x2ca8c0['error'](0x1f4,_0x548586['message']));});});};exports[_0x0244('0x23')]=function(_0x5983f8){var _0x118e77=this;return new Promise(function(_0x4145ef,_0x256193){return db[_0x0244('0x1a')][_0x0244('0x24')]({'raw':_0x5983f8[_0x0244('0x1b')]?_0x5983f8['options']['raw']===undefined?!![]:![]:!![],'where':_0x5983f8['options']?_0x5983f8[_0x0244('0x1b')][_0x0244('0x25')]||null:null,'attributes':_0x5983f8[_0x0244('0x1b')]?_0x5983f8[_0x0244('0x1b')][_0x0244('0x21')]||null:null,'include':_0x5983f8[_0x0244('0x1b')]?_0x5983f8[_0x0244('0x1b')]['include']?_['map'](_0x5983f8['options'][_0x0244('0x1e')],function(_0x2523af){return{'model':db[_0x2523af[_0x0244('0x20')]],'as':_0x2523af['as'],'attributes':_0x2523af['attributes'],'include':_0x2523af[_0x0244('0x1e')]?_[_0x0244('0x1f')](_0x2523af['include'],function(_0x280355){return{'model':db[_0x280355['model']],'as':_0x280355['as'],'attributes':_0x280355[_0x0244('0x21')],'include':_0x280355[_0x0244('0x1e')]?_[_0x0244('0x1f')](_0x280355[_0x0244('0x1e')],function(_0x299985){return{'model':db[_0x299985['model']],'as':_0x299985['as'],'attributes':_0x299985[_0x0244('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0244('0xf')](function(_0x3d0537){logger[_0x0244('0x10')]('ShowSmsQueue',_0x5983f8);logger[_0x0244('0x11')](_0x0244('0x23'),_0x5983f8,JSON[_0x0244('0x14')](_0x3d0537));_0x4145ef(_0x3d0537);})[_0x0244('0x22')](function(_0x4ef090){logger[_0x0244('0x15')]('ShowSmsQueue',_0x4ef090[_0x0244('0x17')],_0x5983f8);_0x256193(_0x118e77[_0x0244('0x15')](0x1f4,_0x4ef090[_0x0244('0x17')]));});});}; \ No newline at end of file +var _0x79c4=['options','raw','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue'];(function(_0x493900,_0x552812){var _0x3d8452=function(_0x46d9c5){while(--_0x46d9c5){_0x493900['push'](_0x493900['shift']());}};_0x3d8452(++_0x552812);}(_0x79c4,0x1eb));var _0x479c=function(_0x392c55,_0xb615d5){_0x392c55=_0x392c55-0x0;var _0x3860de=_0x79c4[_0x392c55];return _0x3860de;};'use strict';var _=require(_0x479c('0x0'));var util=require(_0x479c('0x1'));var moment=require(_0x479c('0x2'));var BPromise=require(_0x479c('0x3'));var rs=require(_0x479c('0x4'));var fs=require('fs');var Redis=require(_0x479c('0x5'));var db=require(_0x479c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x479c('0x7'))(_0x479c('0x8'));var config=require(_0x479c('0x9'));var jayson=require(_0x479c('0xa'));var client=jayson[_0x479c('0xb')]['http']({'port':0x232a});config[_0x479c('0xc')]=_['defaults'](config[_0x479c('0xc')],{'host':_0x479c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x479c('0xc')]));require(_0x479c('0xe'))[_0x479c('0xf')](socket);function respondWithRpcPromise(_0x37ee39,_0x469730,_0x136ef6){return new BPromise(function(_0x3d9fcb,_0x45131c){return client[_0x479c('0x10')](_0x37ee39,_0x136ef6)[_0x479c('0x11')](function(_0x54ddaa){logger[_0x479c('0x12')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x479c('0x13'));logger['debug'](_0x479c('0x14'),_0x469730,_0x479c('0x13'),JSON[_0x479c('0x15')](_0x54ddaa));if(_0x54ddaa[_0x479c('0x16')]){if(_0x54ddaa[_0x479c('0x16')][_0x479c('0x17')]===0x1f4){logger[_0x479c('0x16')](_0x479c('0x18'),_0x469730,_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);return _0x45131c(_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);}logger[_0x479c('0x16')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);return _0x3d9fcb(_0x54ddaa[_0x479c('0x16')][_0x479c('0x19')]);}else{logger[_0x479c('0x12')]('SmsQueue,\x20%s,\x20%s',_0x469730,_0x479c('0x13'));_0x3d9fcb(_0x54ddaa[_0x479c('0x1a')][_0x479c('0x19')]);}})[_0x479c('0x1b')](function(_0x526191){logger[_0x479c('0x16')](_0x479c('0x18'),_0x469730,_0x526191);_0x45131c(_0x526191);});});}exports['GetSmsQueue']=function(_0x1c534e){var _0x59d350=this;return new Promise(function(_0x5e6aed,_0x2c4cd9){return db[_0x479c('0x1c')]['findAll']({'raw':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options'][_0x479c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options']['where']||null:null,'attributes':_0x1c534e['options']?_0x1c534e[_0x479c('0x1d')][_0x479c('0x1f')]||null:null,'limit':_0x1c534e[_0x479c('0x1d')]?_0x1c534e['options'][_0x479c('0x20')]||null:null,'include':_0x1c534e[_0x479c('0x1d')]?_0x1c534e[_0x479c('0x1d')][_0x479c('0x21')]?_[_0x479c('0x22')](_0x1c534e[_0x479c('0x1d')][_0x479c('0x21')],function(_0x82e19c){return{'model':db[_0x82e19c['model']],'as':_0x82e19c['as'],'attributes':_0x82e19c[_0x479c('0x1f')],'include':_0x82e19c[_0x479c('0x21')]?_[_0x479c('0x22')](_0x82e19c[_0x479c('0x21')],function(_0x479e3d){return{'model':db[_0x479e3d[_0x479c('0x23')]],'as':_0x479e3d['as'],'attributes':_0x479e3d[_0x479c('0x1f')],'include':_0x479e3d[_0x479c('0x21')]?_[_0x479c('0x22')](_0x479e3d[_0x479c('0x21')],function(_0x542105){return{'model':db[_0x542105[_0x479c('0x23')]],'as':_0x542105['as'],'attributes':_0x542105[_0x479c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x479c('0x11')](function(_0x21d287){logger[_0x479c('0x12')](_0x479c('0x24'),_0x1c534e);logger[_0x479c('0x25')]('GetSmsQueue',_0x1c534e,JSON[_0x479c('0x15')](_0x21d287));_0x5e6aed(_0x21d287);})['catch'](function(_0x3f6ec2){logger[_0x479c('0x16')](_0x479c('0x24'),_0x3f6ec2[_0x479c('0x19')],_0x1c534e);_0x2c4cd9(_0x59d350['error'](0x1f4,_0x3f6ec2['message']));});});};exports[_0x479c('0x26')]=function(_0x2bb7ff){var _0xf43590=this;return new Promise(function(_0x2b69ab,_0x214e72){return db[_0x479c('0x1c')]['find']({'raw':_0x2bb7ff[_0x479c('0x1d')]?_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bb7ff['options']?_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x27')]||null:null,'attributes':_0x2bb7ff['options']?_0x2bb7ff['options'][_0x479c('0x1f')]||null:null,'include':_0x2bb7ff[_0x479c('0x1d')]?_0x2bb7ff['options']['include']?_[_0x479c('0x22')](_0x2bb7ff[_0x479c('0x1d')][_0x479c('0x21')],function(_0x2bdc7d){return{'model':db[_0x2bdc7d[_0x479c('0x23')]],'as':_0x2bdc7d['as'],'attributes':_0x2bdc7d[_0x479c('0x1f')],'include':_0x2bdc7d[_0x479c('0x21')]?_[_0x479c('0x22')](_0x2bdc7d[_0x479c('0x21')],function(_0x2b80c6){return{'model':db[_0x2b80c6[_0x479c('0x23')]],'as':_0x2b80c6['as'],'attributes':_0x2b80c6[_0x479c('0x1f')],'include':_0x2b80c6[_0x479c('0x21')]?_[_0x479c('0x22')](_0x2b80c6[_0x479c('0x21')],function(_0x1483ca){return{'model':db[_0x1483ca[_0x479c('0x23')]],'as':_0x1483ca['as'],'attributes':_0x1483ca[_0x479c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x479c('0x11')](function(_0x1af05d){logger[_0x479c('0x12')](_0x479c('0x26'),_0x2bb7ff);logger[_0x479c('0x25')](_0x479c('0x26'),_0x2bb7ff,JSON[_0x479c('0x15')](_0x1af05d));_0x2b69ab(_0x1af05d);})['catch'](function(_0x6a70b7){logger[_0x479c('0x16')](_0x479c('0x26'),_0x6a70b7[_0x479c('0x19')],_0x2bb7ff);_0x214e72(_0xf43590['error'](0x1f4,_0x6a70b7[_0x479c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index edbf663..06b9390 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 _0x9cdb=['emit','removeListener','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x3af857,_0x24cd62){var _0x3fbc90=function(_0x4945ef){while(--_0x4945ef){_0x3af857['push'](_0x3af857['shift']());}};_0x3fbc90(++_0x24cd62);}(_0x9cdb,0x146));var _0xb9cd=function(_0x15e17c,_0x39f6c8){_0x15e17c=_0x15e17c-0x0;var _0x55d8c7=_0x9cdb[_0x15e17c];return _0x55d8c7;};'use strict';var SmsQueueEvents=require(_0xb9cd('0x0'));var events=['save',_0xb9cd('0x1'),_0xb9cd('0x2')];function createListener(_0x489ca4,_0x229ece){return function(_0xe0fba){_0x229ece[_0xb9cd('0x3')](_0x489ca4,_0xe0fba);};}function removeListener(_0x44f697,_0x19fcf1){return function(){SmsQueueEvents[_0xb9cd('0x4')](_0x44f697,_0x19fcf1);};}exports['register']=function(_0x12f6e7){for(var _0x3e5055=0x0,_0xeefb84=events[_0xb9cd('0x5')];_0x3e5055<_0xeefb84;_0x3e5055++){var _0x1ae9ce=events[_0x3e5055];var _0x2e5079=createListener(_0xb9cd('0x6')+_0x1ae9ce,_0x12f6e7);SmsQueueEvents['on'](_0x1ae9ce,_0x2e5079);}}; \ No newline at end of file +var _0xa5ee=['save','remove','emit','removeListener','register','smsQueue:','./smsQueue.events'];(function(_0x506b15,_0x4a4eb2){var _0x46175d=function(_0xb21280){while(--_0xb21280){_0x506b15['push'](_0x506b15['shift']());}};_0x46175d(++_0x4a4eb2);}(_0xa5ee,0x180));var _0xea5e=function(_0x3b6fef,_0x5ae452){_0x3b6fef=_0x3b6fef-0x0;var _0x227b3f=_0xa5ee[_0x3b6fef];return _0x227b3f;};'use strict';var SmsQueueEvents=require(_0xea5e('0x0'));var events=[_0xea5e('0x1'),_0xea5e('0x2'),'update'];function createListener(_0x35d0cd,_0x3e7f1a){return function(_0x389b55){_0x3e7f1a[_0xea5e('0x3')](_0x35d0cd,_0x389b55);};}function removeListener(_0x1e404c,_0x27c847){return function(){SmsQueueEvents[_0xea5e('0x4')](_0x1e404c,_0x27c847);};}exports[_0xea5e('0x5')]=function(_0x5e4614){for(var _0x43efae=0x0,_0x3705e4=events['length'];_0x43efae<_0x3705e4;_0x43efae++){var _0x5cec59=events[_0x43efae];var _0x4a497b=createListener(_0xea5e('0x6')+_0x5cec59,_0x5e4614);SmsQueueEvents['on'](_0x5cec59,_0x4a497b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 772ee2b..26efcd6 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 _0x64e4=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','util','path'];(function(_0x41e7c9,_0x5cd048){var _0x626084=function(_0x4fee4e){while(--_0x4fee4e){_0x41e7c9['push'](_0x41e7c9['shift']());}};_0x626084(++_0x5cd048);}(_0x64e4,0x12a));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x464e('0x0'));var path=require(_0x464e('0x1'));var timeout=require(_0x464e('0x2'));var express=require(_0x464e('0x3'));var router=express[_0x464e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x464e('0x5'));var config=require(_0x464e('0x6'));var controller=require(_0x464e('0x7'));router['get']('/',auth[_0x464e('0x8')](),controller[_0x464e('0x9')]);router[_0x464e('0xa')](_0x464e('0xb'),auth[_0x464e('0x8')](),controller[_0x464e('0xc')]);router[_0x464e('0xa')](_0x464e('0xd'),auth['isAuthenticated'](),controller[_0x464e('0xe')]);router[_0x464e('0xf')]('/',auth[_0x464e('0x8')](),controller[_0x464e('0x10')]);router[_0x464e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x464e('0x12')]);router['delete'](_0x464e('0xd'),auth[_0x464e('0x8')](),controller['destroy']);module[_0x464e('0x13')]=router; \ No newline at end of file +var _0xe920=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','put','/:id','update','destroy','multer','express','Router','fs-extra'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xe920,0x11c));var _0x0e92=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xe920[_0x419e17];return _0x1f2044;};'use strict';var multer=require(_0x0e92('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e92('0x1'));var router=express[_0x0e92('0x2')]();var fs_extra=require(_0x0e92('0x3'));var auth=require(_0x0e92('0x4'));var interaction=require(_0x0e92('0x5'));var config=require(_0x0e92('0x6'));var controller=require('./smsQueueReport.controller');router[_0x0e92('0x7')]('/',auth[_0x0e92('0x8')](),controller[_0x0e92('0x9')]);router[_0x0e92('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x0e92('0xa')]);router[_0x0e92('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e92('0xb')]('/',auth[_0x0e92('0x8')](),controller['create']);router[_0x0e92('0xc')](_0x0e92('0xd'),auth['isAuthenticated'](),controller[_0x0e92('0xe')]);router['delete'](_0x0e92('0xd'),auth[_0x0e92('0x8')](),controller[_0x0e92('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 4c8f09e..8f2d268 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 _0xa1fc=['sequelize','STRING','DATE'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa1fc,0xb1));var _0xca1f=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0xa1fc[_0x46b22a];return _0x44c2e8;};'use strict';var moment=require('moment');var Sequelize=require(_0xca1f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xca1f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xca1f('0x1')]},'joinAt':{'type':Sequelize[_0xca1f('0x2')]},'leaveAt':{'type':Sequelize[_0xca1f('0x2')]},'acceptAt':{'type':Sequelize[_0xca1f('0x2')]},'exitAt':{'type':Sequelize[_0xca1f('0x2')]},'reason':{'type':Sequelize[_0xca1f('0x1')]}}; \ No newline at end of file +var _0x3ed6=['exports','STRING','DATE','sequelize'];(function(_0x3f55bb,_0x48f83c){var _0x4af5e9=function(_0x515c34){while(--_0x515c34){_0x3f55bb['push'](_0x3f55bb['shift']());}};_0x4af5e9(++_0x48f83c);}(_0x3ed6,0x12f));var _0x63ed=function(_0x3c28a3,_0x32f5c0){_0x3c28a3=_0x3c28a3-0x0;var _0x59d25d=_0x3ed6[_0x3c28a3];return _0x59d25d;};'use strict';var moment=require('moment');var Sequelize=require(_0x63ed('0x0'));module[_0x63ed('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x63ed('0x2')]},'joinAt':{'type':Sequelize[_0x63ed('0x3')]},'leaveAt':{'type':Sequelize[_0x63ed('0x3')]},'acceptAt':{'type':Sequelize[_0x63ed('0x3')]},'exitAt':{'type':Sequelize[_0x63ed('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b7a4bff..48b9e1c 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 _0xf54e=['fields','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','name','index','map','SmsQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3b3aa1,_0x4e936a){var _0x11ed95=function(_0x374e3a){while(--_0x374e3a){_0x3b3aa1['push'](_0x3b3aa1['shift']());}};_0x11ed95(++_0x4e936a);}(_0xf54e,0xf0));var _0xef54=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0xf54e[_0x21d0c3];return _0x4df18e;};'use strict';var emlformat=require(_0xef54('0x0'));var rimraf=require(_0xef54('0x1'));var zipdir=require(_0xef54('0x2'));var jsonpatch=require(_0xef54('0x3'));var rp=require(_0xef54('0x4'));var moment=require(_0xef54('0x5'));var BPromise=require(_0xef54('0x6'));var Mustache=require(_0xef54('0x7'));var util=require('util');var path=require(_0xef54('0x8'));var sox=require(_0xef54('0x9'));var csv=require('to-csv');var ejs=require(_0xef54('0xa'));var fs=require('fs');var fs_extra=require(_0xef54('0xb'));var _=require(_0xef54('0xc'));var squel=require(_0xef54('0xd'));var crypto=require(_0xef54('0xe'));var jsforce=require(_0xef54('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xef54('0x10'));var querystring=require(_0xef54('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef54('0x12'));var qs=require(_0xef54('0x13'));var as=require(_0xef54('0x14'));var hardwareService=require(_0xef54('0x15'));var logger=require(_0xef54('0x16'))(_0xef54('0x17'));var utils=require(_0xef54('0x18'));var config=require(_0xef54('0x19'));var licenseUtil=require(_0xef54('0x1a'));var db=require(_0xef54('0x1b'))['db'];function respondWithStatusCode(_0x4b26ff,_0x5f52bd){_0x5f52bd=_0x5f52bd||0xcc;return function(_0x4f492b){if(_0x4f492b){return _0x4b26ff[_0xef54('0x1c')](_0x5f52bd);}return _0x4b26ff[_0xef54('0x1d')](_0x5f52bd)[_0xef54('0x1e')]();};}function respondWithResult(_0x128b69,_0x28c9ba){_0x28c9ba=_0x28c9ba||0xc8;return function(_0x1d94c1){if(_0x1d94c1){return _0x128b69[_0xef54('0x1d')](_0x28c9ba)[_0xef54('0x1f')](_0x1d94c1);}};}function respondWithFilteredResult(_0x28cceb,_0x3d244f){return function(_0x36de0f){if(_0x36de0f){var _0x251a20=typeof _0x3d244f[_0xef54('0x20')]===_0xef54('0x21')&&typeof _0x3d244f[_0xef54('0x22')]===_0xef54('0x21');var _0x514cc6=_0x36de0f[_0xef54('0x23')];var _0x9255a1=_0x251a20?0x0:_0x3d244f[_0xef54('0x20')];var _0x416ccd=_0x251a20?_0x36de0f[_0xef54('0x23')]:_0x3d244f['offset']+_0x3d244f[_0xef54('0x22')];var _0x14f2a6;if(_0x416ccd>=_0x514cc6){_0x416ccd=_0x514cc6;_0x14f2a6=0xc8;}else{_0x14f2a6=0xce;}_0x28cceb[_0xef54('0x1d')](_0x14f2a6);return _0x28cceb['set']('Content-Range',_0x9255a1+'-'+_0x416ccd+'/'+_0x514cc6)[_0xef54('0x1f')](_0x36de0f);}return null;};}function patchUpdates(_0x3bac41){return function(_0x1b1543){try{jsonpatch[_0xef54('0x24')](_0x1b1543,_0x3bac41,!![]);}catch(_0x7a36f7){return BPromise[_0xef54('0x25')](_0x7a36f7);}return _0x1b1543[_0xef54('0x26')]();};}function saveUpdates(_0x25fe43,_0x22ccb5){return function(_0xa85700){if(_0xa85700){return _0xa85700['update'](_0x25fe43)[_0xef54('0x27')](function(_0x1d39fd){return _0x1d39fd;});}return null;};}function removeEntity(_0x375f4f,_0x5391fc){return function(_0x5abc83){if(_0x5abc83){return _0x5abc83[_0xef54('0x28')]()[_0xef54('0x27')](function(){_0x375f4f[_0xef54('0x1d')](0xcc)[_0xef54('0x1e')]();});}};}function handleEntityNotFound(_0x37ab78,_0x171f9b){return function(_0xac9898){if(!_0xac9898){_0x37ab78[_0xef54('0x1c')](0x194);}return _0xac9898;};}function handleError(_0x5a0d8a,_0x5972de){_0x5972de=_0x5972de||0x1f4;return function(_0x1f8f53){logger[_0xef54('0x29')](_0x1f8f53['stack']);if(_0x1f8f53[_0xef54('0x2a')]){delete _0x1f8f53[_0xef54('0x2a')];}_0x5a0d8a['status'](_0x5972de)['send'](_0x1f8f53);};}exports[_0xef54('0x2b')]=function(_0x1a1f52,_0x482fe6){var _0x16d78e={},_0x4cb695={},_0x1f2c8d={'count':0x0,'rows':[]};var _0x51939e=_[_0xef54('0x2c')](db[_0xef54('0x2d')][_0xef54('0x2e')],function(_0x414cc4){return{'name':_0x414cc4['fieldName'],'type':_0x414cc4[_0xef54('0x2f')]['key']};});_0x4cb695[_0xef54('0x30')]=_['map'](_0x51939e,_0xef54('0x2a'));_0x4cb695[_0xef54('0x31')]=_[_0xef54('0x32')](_0x1a1f52[_0xef54('0x31')]);_0x4cb695['filters']=_[_0xef54('0x33')](_0x4cb695['model'],_0x4cb695[_0xef54('0x31')]);_0x16d78e[_0xef54('0x34')]=_[_0xef54('0x33')](_0x4cb695[_0xef54('0x30')],qs['fields'](_0x1a1f52[_0xef54('0x31')]['fields']));_0x16d78e[_0xef54('0x34')]=_0x16d78e[_0xef54('0x34')][_0xef54('0x35')]?_0x16d78e[_0xef54('0x34')]:_0x4cb695[_0xef54('0x30')];if(!_0x1a1f52[_0xef54('0x31')][_0xef54('0x36')](_0xef54('0x37'))){_0x16d78e[_0xef54('0x22')]=qs[_0xef54('0x22')](_0x1a1f52[_0xef54('0x31')][_0xef54('0x22')]);_0x16d78e[_0xef54('0x20')]=qs[_0xef54('0x20')](_0x1a1f52[_0xef54('0x31')]['offset']);}_0x16d78e[_0xef54('0x38')]=qs[_0xef54('0x39')](_0x1a1f52[_0xef54('0x31')][_0xef54('0x39')]);_0x16d78e[_0xef54('0x3a')]=qs[_0xef54('0x3b')](_[_0xef54('0x3c')](_0x1a1f52[_0xef54('0x31')],_0x4cb695[_0xef54('0x3b')]),_0x51939e);if(_0x1a1f52[_0xef54('0x31')][_0xef54('0x3d')]){_0x16d78e[_0xef54('0x3a')]=_[_0xef54('0x3e')](_0x16d78e[_0xef54('0x3a')],{'$or':_[_0xef54('0x2c')](_0x51939e,function(_0x1002ad){if(_0x1002ad[_0xef54('0x2f')]!==_0xef54('0x3f')){var _0x577e42={};_0x577e42[_0x1002ad['name']]={'$like':'%'+_0x1a1f52['query'][_0xef54('0x3d')]+'%'};return _0x577e42;}})});}_0x16d78e=_['merge']({},_0x16d78e,_0x1a1f52[_0xef54('0x40')]);var _0x261913={'where':_0x16d78e[_0xef54('0x3a')]};return db['SmsQueueReport'][_0xef54('0x23')](_0x261913)[_0xef54('0x27')](function(_0x58cd04){_0x1f2c8d['count']=_0x58cd04;if(_0x1a1f52[_0xef54('0x31')][_0xef54('0x41')]){_0x16d78e[_0xef54('0x42')]=[{'all':!![]}];}return db[_0xef54('0x2d')][_0xef54('0x43')](_0x16d78e);})[_0xef54('0x27')](function(_0x1a5578){_0x1f2c8d[_0xef54('0x44')]=_0x1a5578;return _0x1f2c8d;})[_0xef54('0x27')](respondWithFilteredResult(_0x482fe6,_0x16d78e))[_0xef54('0x45')](handleError(_0x482fe6,null));};exports[_0xef54('0x46')]=function(_0x19865e,_0x447942){var _0x3f441e={'raw':!![],'where':{'id':_0x19865e[_0xef54('0x47')]['id']}},_0x2bb99d={};_0x2bb99d['model']=_[_0xef54('0x32')](db[_0xef54('0x2d')][_0xef54('0x2e')]);_0x2bb99d[_0xef54('0x31')]=_[_0xef54('0x32')](_0x19865e[_0xef54('0x31')]);_0x2bb99d['filters']=_['intersection'](_0x2bb99d[_0xef54('0x30')],_0x2bb99d['query']);_0x3f441e['attributes']=_['intersection'](_0x2bb99d[_0xef54('0x30')],qs[_0xef54('0x48')](_0x19865e[_0xef54('0x31')][_0xef54('0x48')]));_0x3f441e[_0xef54('0x34')]=_0x3f441e['attributes'][_0xef54('0x35')]?_0x3f441e[_0xef54('0x34')]:_0x2bb99d[_0xef54('0x30')];if(_0x19865e[_0xef54('0x31')][_0xef54('0x41')]){_0x3f441e[_0xef54('0x42')]=[{'all':!![]}];}_0x3f441e=_['merge']({},_0x3f441e,_0x19865e[_0xef54('0x40')]);return db[_0xef54('0x2d')][_0xef54('0x49')](_0x3f441e)[_0xef54('0x27')](handleEntityNotFound(_0x447942,null))['then'](respondWithResult(_0x447942,null))[_0xef54('0x45')](handleError(_0x447942,null));};exports[_0xef54('0x4a')]=function(_0x20cfaa,_0x2abd15){return db[_0xef54('0x2d')][_0xef54('0x4a')](_0x20cfaa['body'],{})[_0xef54('0x27')](respondWithResult(_0x2abd15,0xc9))['catch'](handleError(_0x2abd15,null));};exports[_0xef54('0x4b')]=function(_0x4a43f0,_0x439695){if(_0x4a43f0[_0xef54('0x4c')]['id']){delete _0x4a43f0[_0xef54('0x4c')]['id'];}return db[_0xef54('0x2d')]['find']({'where':{'id':_0x4a43f0[_0xef54('0x47')]['id']}})[_0xef54('0x27')](handleEntityNotFound(_0x439695,null))[_0xef54('0x27')](saveUpdates(_0x4a43f0[_0xef54('0x4c')],null))[_0xef54('0x27')](respondWithResult(_0x439695,null))[_0xef54('0x45')](handleError(_0x439695,null));};exports[_0xef54('0x28')]=function(_0x3c9ff9,_0x1ecc60){return db[_0xef54('0x2d')]['find']({'where':{'id':_0x3c9ff9[_0xef54('0x47')]['id']}})[_0xef54('0x27')](handleEntityNotFound(_0x1ecc60,null))['then'](removeEntity(_0x1ecc60,null))[_0xef54('0x45')](handleError(_0x1ecc60,null));};exports[_0xef54('0x4d')]=function(_0x103def,_0x55f403){return db[_0xef54('0x2d')][_0xef54('0x4d')]()[_0xef54('0x27')](respondWithResult(_0x55f403,null))['catch'](handleError(_0x55f403,null));}; \ No newline at end of file +var _0x8337=['update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject'];(function(_0x575135,_0x2ed478){var _0x12c2e8=function(_0x323e65){while(--_0x323e65){_0x575135['push'](_0x575135['shift']());}};_0x12c2e8(++_0x2ed478);}(_0x8337,0x13e));var _0x7833=function(_0x5378c1,_0x156fe4){_0x5378c1=_0x5378c1-0x0;var _0x31e8a7=_0x8337[_0x5378c1];return _0x31e8a7;};'use strict';var emlformat=require(_0x7833('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7833('0x1'));var jsonpatch=require(_0x7833('0x2'));var rp=require(_0x7833('0x3'));var moment=require('moment');var BPromise=require(_0x7833('0x4'));var Mustache=require(_0x7833('0x5'));var util=require('util');var path=require(_0x7833('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7833('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7833('0x8'));var squel=require('squel');var crypto=require(_0x7833('0x9'));var jsforce=require(_0x7833('0xa'));var deskjs=require(_0x7833('0xb'));var toCsv=require(_0x7833('0xc'));var querystring=require(_0x7833('0xd'));var Papa=require('papaparse');var Redis=require(_0x7833('0xe'));var authService=require(_0x7833('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7833('0x10'));var hardwareService=require(_0x7833('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7833('0x12'));var config=require(_0x7833('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2197a9,_0x57378a){_0x57378a=_0x57378a||0xcc;return function(_0x5b6e41){if(_0x5b6e41){return _0x2197a9[_0x7833('0x14')](_0x57378a);}return _0x2197a9['status'](_0x57378a)[_0x7833('0x15')]();};}function respondWithResult(_0x368a3f,_0x4c3729){_0x4c3729=_0x4c3729||0xc8;return function(_0x5762c1){if(_0x5762c1){return _0x368a3f[_0x7833('0x16')](_0x4c3729)['json'](_0x5762c1);}};}function respondWithFilteredResult(_0x318cd8,_0x26e7cf){return function(_0x53b783){if(_0x53b783){var _0x3d374d=typeof _0x26e7cf[_0x7833('0x17')]==='undefined'&&typeof _0x26e7cf['limit']===_0x7833('0x18');var _0x2ce4b4=_0x53b783[_0x7833('0x19')];var _0x239cbb=_0x3d374d?0x0:_0x26e7cf[_0x7833('0x17')];var _0x477982=_0x3d374d?_0x53b783[_0x7833('0x19')]:_0x26e7cf[_0x7833('0x17')]+_0x26e7cf[_0x7833('0x1a')];var _0x5ee0e3;if(_0x477982>=_0x2ce4b4){_0x477982=_0x2ce4b4;_0x5ee0e3=0xc8;}else{_0x5ee0e3=0xce;}_0x318cd8[_0x7833('0x16')](_0x5ee0e3);return _0x318cd8[_0x7833('0x1b')](_0x7833('0x1c'),_0x239cbb+'-'+_0x477982+'/'+_0x2ce4b4)[_0x7833('0x1d')](_0x53b783);}return null;};}function patchUpdates(_0x16dedb){return function(_0x29fd7b){try{jsonpatch[_0x7833('0x1e')](_0x29fd7b,_0x16dedb,!![]);}catch(_0xe1002f){return BPromise[_0x7833('0x1f')](_0xe1002f);}return _0x29fd7b['save']();};}function saveUpdates(_0x3310bc,_0x11bfbf){return function(_0x114c49){if(_0x114c49){return _0x114c49[_0x7833('0x20')](_0x3310bc)[_0x7833('0x21')](function(_0x4aa060){return _0x4aa060;});}return null;};}function removeEntity(_0xc04c4e,_0xf5caef){return function(_0x2d4108){if(_0x2d4108){return _0x2d4108[_0x7833('0x22')]()[_0x7833('0x21')](function(){_0xc04c4e['status'](0xcc)[_0x7833('0x15')]();});}};}function handleEntityNotFound(_0x82cdd8,_0x46f4b5){return function(_0x51d02e){if(!_0x51d02e){_0x82cdd8[_0x7833('0x14')](0x194);}return _0x51d02e;};}function handleError(_0x3b16e2,_0x209b43){_0x209b43=_0x209b43||0x1f4;return function(_0x518861){logger['error'](_0x518861[_0x7833('0x23')]);if(_0x518861[_0x7833('0x24')]){delete _0x518861[_0x7833('0x24')];}_0x3b16e2[_0x7833('0x16')](_0x209b43)[_0x7833('0x25')](_0x518861);};}exports[_0x7833('0x26')]=function(_0x1e30fc,_0x5e3b9b){var _0x3a9b7c={},_0xa22801={},_0x3c81a2={'count':0x0,'rows':[]};var _0x2a4750=_[_0x7833('0x27')](db[_0x7833('0x28')][_0x7833('0x29')],function(_0x58b40b){return{'name':_0x58b40b['fieldName'],'type':_0x58b40b[_0x7833('0x2a')][_0x7833('0x2b')]};});_0xa22801[_0x7833('0x2c')]=_['map'](_0x2a4750,_0x7833('0x24'));_0xa22801[_0x7833('0x2d')]=_[_0x7833('0x2e')](_0x1e30fc[_0x7833('0x2d')]);_0xa22801[_0x7833('0x2f')]=_[_0x7833('0x30')](_0xa22801[_0x7833('0x2c')],_0xa22801[_0x7833('0x2d')]);_0x3a9b7c[_0x7833('0x31')]=_[_0x7833('0x30')](_0xa22801[_0x7833('0x2c')],qs[_0x7833('0x32')](_0x1e30fc[_0x7833('0x2d')][_0x7833('0x32')]));_0x3a9b7c[_0x7833('0x31')]=_0x3a9b7c[_0x7833('0x31')]['length']?_0x3a9b7c[_0x7833('0x31')]:_0xa22801[_0x7833('0x2c')];if(!_0x1e30fc['query'][_0x7833('0x33')]('nolimit')){_0x3a9b7c['limit']=qs[_0x7833('0x1a')](_0x1e30fc['query']['limit']);_0x3a9b7c['offset']=qs[_0x7833('0x17')](_0x1e30fc[_0x7833('0x2d')][_0x7833('0x17')]);}_0x3a9b7c[_0x7833('0x34')]=qs['sort'](_0x1e30fc['query'][_0x7833('0x35')]);_0x3a9b7c['where']=qs[_0x7833('0x2f')](_['pick'](_0x1e30fc[_0x7833('0x2d')],_0xa22801['filters']),_0x2a4750);if(_0x1e30fc[_0x7833('0x2d')][_0x7833('0x36')]){_0x3a9b7c[_0x7833('0x37')]=_[_0x7833('0x38')](_0x3a9b7c[_0x7833('0x37')],{'$or':_[_0x7833('0x27')](_0x2a4750,function(_0x4b43a4){if(_0x4b43a4['type']!==_0x7833('0x39')){var _0x1ff955={};_0x1ff955[_0x4b43a4[_0x7833('0x24')]]={'$like':'%'+_0x1e30fc[_0x7833('0x2d')][_0x7833('0x36')]+'%'};return _0x1ff955;}})});}_0x3a9b7c=_['merge']({},_0x3a9b7c,_0x1e30fc[_0x7833('0x3a')]);var _0x1d3227={'where':_0x3a9b7c['where']};return db[_0x7833('0x28')][_0x7833('0x19')](_0x1d3227)['then'](function(_0x56f223){_0x3c81a2[_0x7833('0x19')]=_0x56f223;if(_0x1e30fc[_0x7833('0x2d')]['includeAll']){_0x3a9b7c[_0x7833('0x3b')]=[{'all':!![]}];}return db[_0x7833('0x28')][_0x7833('0x3c')](_0x3a9b7c);})['then'](function(_0x261d9a){_0x3c81a2[_0x7833('0x3d')]=_0x261d9a;return _0x3c81a2;})['then'](respondWithFilteredResult(_0x5e3b9b,_0x3a9b7c))[_0x7833('0x3e')](handleError(_0x5e3b9b,null));};exports[_0x7833('0x3f')]=function(_0x5d0983,_0x3fcb3b){var _0x3f440a={'raw':!![],'where':{'id':_0x5d0983['params']['id']}},_0x5d7dbb={};_0x5d7dbb[_0x7833('0x2c')]=_[_0x7833('0x2e')](db['SmsQueueReport'][_0x7833('0x29')]);_0x5d7dbb['query']=_[_0x7833('0x2e')](_0x5d0983[_0x7833('0x2d')]);_0x5d7dbb['filters']=_[_0x7833('0x30')](_0x5d7dbb['model'],_0x5d7dbb['query']);_0x3f440a[_0x7833('0x31')]=_[_0x7833('0x30')](_0x5d7dbb['model'],qs[_0x7833('0x32')](_0x5d0983[_0x7833('0x2d')]['fields']));_0x3f440a[_0x7833('0x31')]=_0x3f440a['attributes'][_0x7833('0x40')]?_0x3f440a[_0x7833('0x31')]:_0x5d7dbb[_0x7833('0x2c')];if(_0x5d0983['query']['includeAll']){_0x3f440a['include']=[{'all':!![]}];}_0x3f440a=_[_0x7833('0x38')]({},_0x3f440a,_0x5d0983['options']);return db[_0x7833('0x28')][_0x7833('0x41')](_0x3f440a)[_0x7833('0x21')](handleEntityNotFound(_0x3fcb3b,null))[_0x7833('0x21')](respondWithResult(_0x3fcb3b,null))[_0x7833('0x3e')](handleError(_0x3fcb3b,null));};exports[_0x7833('0x42')]=function(_0x30517e,_0x2d4db2){return db[_0x7833('0x28')][_0x7833('0x42')](_0x30517e[_0x7833('0x43')],{})[_0x7833('0x21')](respondWithResult(_0x2d4db2,0xc9))[_0x7833('0x3e')](handleError(_0x2d4db2,null));};exports['update']=function(_0x249ebf,_0x292dec){if(_0x249ebf[_0x7833('0x43')]['id']){delete _0x249ebf[_0x7833('0x43')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x249ebf[_0x7833('0x44')]['id']}})[_0x7833('0x21')](handleEntityNotFound(_0x292dec,null))[_0x7833('0x21')](saveUpdates(_0x249ebf[_0x7833('0x43')],null))['then'](respondWithResult(_0x292dec,null))[_0x7833('0x3e')](handleError(_0x292dec,null));};exports[_0x7833('0x22')]=function(_0x1d383b,_0x32b17d){return db[_0x7833('0x28')][_0x7833('0x41')]({'where':{'id':_0x1d383b['params']['id']}})[_0x7833('0x21')](handleEntityNotFound(_0x32b17d,null))[_0x7833('0x21')](removeEntity(_0x32b17d,null))[_0x7833('0x3e')](handleError(_0x32b17d,null));};exports[_0x7833('0x45')]=function(_0x12eedf,_0x4a9c1a){return db[_0x7833('0x28')]['describe']()[_0x7833('0x21')](respondWithResult(_0x4a9c1a,null))[_0x7833('0x3e')](handleError(_0x4a9c1a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 321af2e..d29029d 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x387bfe,_0x23fcc2){var _0x278d5b=function(_0x5c3366){while(--_0x5c3366){_0x387bfe['push'](_0x387bfe['shift']());}};_0x278d5b(++_0x23fcc2);}(_0x70e0,0x17b));var _0x070e=function(_0x512e93,_0x85c376){_0x512e93=_0x512e93-0x0;var _0x36af9c=_0x70e0[_0x512e93];return _0x36af9c;};'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']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0xe706,0xa3));var _0x6e70=function(_0x180632,_0x3a229e){_0x180632=_0x180632-0x0;var _0x151961=_0xe706[_0x180632];return _0x151961;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 171550d..a74698d 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 _0x0259=['message','result','catch','create','body','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32d360,_0x34c1a2){var _0x381f56=function(_0x12d19e){while(--_0x12d19e){_0x32d360['push'](_0x32d360['shift']());}};_0x381f56(++_0x34c1a2);}(_0x0259,0xbf));var _0x9025=function(_0x3ba61d,_0x255b2b){_0x3ba61d=_0x3ba61d-0x0;var _0x2264c4=_0x0259[_0x3ba61d];return _0x2264c4;};'use strict';var _=require(_0x9025('0x0'));var util=require(_0x9025('0x1'));var moment=require(_0x9025('0x2'));var BPromise=require(_0x9025('0x3'));var rs=require(_0x9025('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9025('0x5'))['db'];var utils=require(_0x9025('0x6'));var logger=require(_0x9025('0x7'))(_0x9025('0x8'));var config=require('../../config/environment');var jayson=require(_0x9025('0x9'));var client=jayson['client'][_0x9025('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3849d9,_0x431d1a,_0x4a822f){return new BPromise(function(_0x5309a6,_0x5efb3d){return client[_0x9025('0xb')](_0x3849d9,_0x4a822f)['then'](function(_0x1bd044){logger[_0x9025('0xc')](_0x9025('0xd'),_0x431d1a,_0x9025('0xe'));logger[_0x9025('0xf')](_0x9025('0x10'),_0x431d1a,_0x9025('0xe'),JSON[_0x9025('0x11')](_0x1bd044));if(_0x1bd044[_0x9025('0x12')]){if(_0x1bd044['error']['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x431d1a,_0x1bd044[_0x9025('0x12')][_0x9025('0x13')]);return _0x5efb3d(_0x1bd044[_0x9025('0x12')][_0x9025('0x13')]);}logger[_0x9025('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x431d1a,_0x1bd044['error'][_0x9025('0x13')]);return _0x5309a6(_0x1bd044['error']['message']);}else{logger[_0x9025('0xc')](_0x9025('0xd'),_0x431d1a,_0x9025('0xe'));_0x5309a6(_0x1bd044[_0x9025('0x14')][_0x9025('0x13')]);}})[_0x9025('0x15')](function(_0x2d0c71){logger['error'](_0x9025('0xd'),_0x431d1a,_0x2d0c71);_0x5efb3d(_0x2d0c71);});});}exports['CreateSmsQueueReport']=function(_0x5878f1){var _0x48f282=this;return new Promise(function(_0x4b4161,_0x1a6a13){return db['SmsQueueReport'][_0x9025('0x16')](_0x5878f1[_0x9025('0x17')],{'raw':_0x5878f1['options']?_0x5878f1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3c2ef7){logger['info'](_0x9025('0x18'),_0x5878f1);logger[_0x9025('0xf')](_0x9025('0x18'),_0x5878f1,JSON['stringify'](_0x3c2ef7));_0x4b4161(_0x3c2ef7);})[_0x9025('0x15')](function(_0x5ada89){logger[_0x9025('0x12')](_0x9025('0x18'),_0x5ada89[_0x9025('0x13')],_0x5878f1);_0x1a6a13(_0x48f282[_0x9025('0x12')](0x1f4,_0x5ada89[_0x9025('0x13')]));});});};exports[_0x9025('0x19')]=function(_0x8a8963){var _0x8d3bf2=this;return new Promise(function(_0x22b82e,_0x59604a){return db[_0x9025('0x1a')]['update'](_0x8a8963[_0x9025('0x17')],{'raw':_0x8a8963[_0x9025('0x1b')]?_0x8a8963[_0x9025('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a8963[_0x9025('0x1b')]?_0x8a8963['options'][_0x9025('0x1c')]||null:null,'attributes':_0x8a8963[_0x9025('0x1b')]?_0x8a8963[_0x9025('0x1b')][_0x9025('0x1d')]||null:null,'limit':_0x8a8963[_0x9025('0x1b')]?_0x8a8963['options']['limit']||null:null})['then'](function(_0x1be533){logger['info']('UpdateSmsQueueReport',_0x8a8963);logger[_0x9025('0xf')](_0x9025('0x19'),_0x8a8963,JSON[_0x9025('0x11')](_0x1be533));_0x22b82e(_0x1be533);})[_0x9025('0x15')](function(_0x2cdba2){logger[_0x9025('0x12')](_0x9025('0x19'),_0x2cdba2['message'],_0x8a8963);_0x59604a(_0x8d3bf2[_0x9025('0x12')](0x1f4,_0x2cdba2[_0x9025('0x13')]));});});}; \ No newline at end of file +var _0x7a2d=['create','body','options','raw','debug','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x459de1,_0x187d8c){var _0x2a1006=function(_0x4931b1){while(--_0x4931b1){_0x459de1['push'](_0x459de1['shift']());}};_0x2a1006(++_0x187d8c);}(_0x7a2d,0x111));var _0xd7a2=function(_0x4cd5ba,_0x3f16b5){_0x4cd5ba=_0x4cd5ba-0x0;var _0x3e4fe5=_0x7a2d[_0x4cd5ba];return _0x3e4fe5;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var moment=require(_0xd7a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7a2('0x3'));var db=require(_0xd7a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7a2('0x5'))(_0xd7a2('0x6'));var config=require(_0xd7a2('0x7'));var jayson=require(_0xd7a2('0x8'));var client=jayson[_0xd7a2('0x9')][_0xd7a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x139185,_0x1a6b9e,_0x5775ee){return new BPromise(function(_0x3a8d76,_0x5bd25e){return client[_0xd7a2('0xb')](_0x139185,_0x5775ee)[_0xd7a2('0xc')](function(_0x3949f4){logger[_0xd7a2('0xd')](_0xd7a2('0xe'),_0x1a6b9e,_0xd7a2('0xf'));logger['debug'](_0xd7a2('0x10'),_0x1a6b9e,'request\x20sent',JSON[_0xd7a2('0x11')](_0x3949f4));if(_0x3949f4[_0xd7a2('0x12')]){if(_0x3949f4[_0xd7a2('0x12')]['code']===0x1f4){logger['error'](_0xd7a2('0xe'),_0x1a6b9e,_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);return _0x5bd25e(_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);}logger['error'](_0xd7a2('0xe'),_0x1a6b9e,_0x3949f4[_0xd7a2('0x12')][_0xd7a2('0x13')]);return _0x3a8d76(_0x3949f4['error']['message']);}else{logger[_0xd7a2('0xd')](_0xd7a2('0xe'),_0x1a6b9e,_0xd7a2('0xf'));_0x3a8d76(_0x3949f4[_0xd7a2('0x14')][_0xd7a2('0x13')]);}})[_0xd7a2('0x15')](function(_0x3a7176){logger[_0xd7a2('0x12')](_0xd7a2('0xe'),_0x1a6b9e,_0x3a7176);_0x5bd25e(_0x3a7176);});});}exports[_0xd7a2('0x16')]=function(_0x592272){var _0x274db7=this;return new Promise(function(_0x1e4673,_0x19e67d){return db[_0xd7a2('0x17')][_0xd7a2('0x18')](_0x592272[_0xd7a2('0x19')],{'raw':_0x592272[_0xd7a2('0x1a')]?_0x592272[_0xd7a2('0x1a')][_0xd7a2('0x1b')]===undefined?!![]:![]:!![]})[_0xd7a2('0xc')](function(_0x257055){logger[_0xd7a2('0xd')]('CreateSmsQueueReport',_0x592272);logger[_0xd7a2('0x1c')](_0xd7a2('0x16'),_0x592272,JSON[_0xd7a2('0x11')](_0x257055));_0x1e4673(_0x257055);})[_0xd7a2('0x15')](function(_0x28b584){logger[_0xd7a2('0x12')]('CreateSmsQueueReport',_0x28b584['message'],_0x592272);_0x19e67d(_0x274db7['error'](0x1f4,_0x28b584[_0xd7a2('0x13')]));});});};exports[_0xd7a2('0x1d')]=function(_0x458ad5){var _0x9be6a7=this;return new Promise(function(_0x4bee04,_0x3e6593){return db[_0xd7a2('0x17')][_0xd7a2('0x1e')](_0x458ad5['body'],{'raw':_0x458ad5[_0xd7a2('0x1a')]?_0x458ad5['options'][_0xd7a2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458ad5['options']?_0x458ad5[_0xd7a2('0x1a')][_0xd7a2('0x1f')]||null:null,'attributes':_0x458ad5['options']?_0x458ad5['options']['attributes']||null:null,'limit':_0x458ad5['options']?_0x458ad5[_0xd7a2('0x1a')][_0xd7a2('0x20')]||null:null})[_0xd7a2('0xc')](function(_0x403c9c){logger['info'](_0xd7a2('0x1d'),_0x458ad5);logger[_0xd7a2('0x1c')]('UpdateSmsQueueReport',_0x458ad5,JSON[_0xd7a2('0x11')](_0x403c9c));_0x4bee04(_0x403c9c);})[_0xd7a2('0x15')](function(_0x2d24a6){logger[_0xd7a2('0x12')]('UpdateSmsQueueReport',_0x2d24a6[_0xd7a2('0x13')],_0x458ad5);_0x3e6593(_0x9be6a7['error'](0x1f4,_0x2d24a6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 29ac7ba..ce333d7 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 _0x86f4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x86f4,0x18a));var _0x486f=function(_0x170d72,_0x2c8713){_0x170d72=_0x170d72-0x0;var _0x4964ce=_0x86f4[_0x170d72];return _0x4964ce;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./smsTransferReport.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0xf')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x11')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);module[_0x486f('0x15')]=router; \ No newline at end of file +var _0x0b78=['get','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','/describe','isAuthenticated','describe'];(function(_0xcaad02,_0x248307){var _0x49160c=function(_0x32e738){while(--_0x32e738){_0xcaad02['push'](_0xcaad02['shift']());}};_0x49160c(++_0x248307);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),auth[_0x80b7('0xa')](),controller[_0x80b7('0xb')]);router[_0x80b7('0xc')]('/:id',auth[_0x80b7('0xa')](),controller[_0x80b7('0xd')]);router[_0x80b7('0xe')]('/',auth['isAuthenticated'](),controller[_0x80b7('0xf')]);router['put'](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x11')]);router[_0x80b7('0x12')](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x13')]);module[_0x80b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index efb7ebc..c771df6 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x35fd3c,_0x215d64){var _0x5af6ea=function(_0xd8c59f){while(--_0xd8c59f){_0x35fd3c['push'](_0x35fd3c['shift']());}};_0x5af6ea(++_0x215d64);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00bb[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4421da,_0x41121b){var _0x4be32c=function(_0x296a07){while(--_0x296a07){_0x4421da['push'](_0x4421da['shift']());}};_0x4be32c(++_0x41121b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x33a5c6,_0x1536d5){_0x33a5c6=_0x33a5c6-0x0;var _0x206d7c=_0xf4eb[_0x33a5c6];return _0x206d7c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c17484c..88f4f3c 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 _0xa1ad=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','findAll','rows','show','params','include','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4c956c,_0x57f5fc){var _0x180108=function(_0x2558cc){while(--_0x2558cc){_0x4c956c['push'](_0x4c956c['shift']());}};_0x180108(++_0x57f5fc);}(_0xa1ad,0x180));var _0xda1a=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0xa1ad[_0x3b3a82];return _0x267063;};'use strict';var emlformat=require(_0xda1a('0x0'));var rimraf=require(_0xda1a('0x1'));var zipdir=require(_0xda1a('0x2'));var jsonpatch=require(_0xda1a('0x3'));var rp=require('request-promise');var moment=require(_0xda1a('0x4'));var BPromise=require(_0xda1a('0x5'));var Mustache=require(_0xda1a('0x6'));var util=require(_0xda1a('0x7'));var path=require(_0xda1a('0x8'));var sox=require(_0xda1a('0x9'));var csv=require(_0xda1a('0xa'));var ejs=require(_0xda1a('0xb'));var fs=require('fs');var fs_extra=require(_0xda1a('0xc'));var _=require(_0xda1a('0xd'));var squel=require(_0xda1a('0xe'));var crypto=require(_0xda1a('0xf'));var jsforce=require(_0xda1a('0x10'));var deskjs=require(_0xda1a('0x11'));var toCsv=require(_0xda1a('0xa'));var querystring=require(_0xda1a('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xda1a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xda1a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda1a('0x15'))(_0xda1a('0x16'));var utils=require(_0xda1a('0x17'));var config=require(_0xda1a('0x18'));var licenseUtil=require(_0xda1a('0x19'));var db=require(_0xda1a('0x1a'))['db'];function respondWithStatusCode(_0x656cb9,_0x48e4f1){_0x48e4f1=_0x48e4f1||0xcc;return function(_0x22cb81){if(_0x22cb81){return _0x656cb9['sendStatus'](_0x48e4f1);}return _0x656cb9[_0xda1a('0x1b')](_0x48e4f1)[_0xda1a('0x1c')]();};}function respondWithResult(_0x2fdefe,_0x34dfa8){_0x34dfa8=_0x34dfa8||0xc8;return function(_0x4356a0){if(_0x4356a0){return _0x2fdefe[_0xda1a('0x1b')](_0x34dfa8)[_0xda1a('0x1d')](_0x4356a0);}};}function respondWithFilteredResult(_0x39fe8d,_0x17c8e2){return function(_0x46ea3e){if(_0x46ea3e){var _0x4d5ed9=typeof _0x17c8e2[_0xda1a('0x1e')]==='undefined'&&typeof _0x17c8e2[_0xda1a('0x1f')]==='undefined';var _0x513f0c=_0x46ea3e[_0xda1a('0x20')];var _0x2ff123=_0x4d5ed9?0x0:_0x17c8e2[_0xda1a('0x1e')];var _0x18a93c=_0x4d5ed9?_0x46ea3e['count']:_0x17c8e2[_0xda1a('0x1e')]+_0x17c8e2[_0xda1a('0x1f')];var _0x5963a7;if(_0x18a93c>=_0x513f0c){_0x18a93c=_0x513f0c;_0x5963a7=0xc8;}else{_0x5963a7=0xce;}_0x39fe8d['status'](_0x5963a7);return _0x39fe8d['set'](_0xda1a('0x21'),_0x2ff123+'-'+_0x18a93c+'/'+_0x513f0c)['json'](_0x46ea3e);}return null;};}function patchUpdates(_0x1b053b){return function(_0x2cbfeb){try{jsonpatch[_0xda1a('0x22')](_0x2cbfeb,_0x1b053b,!![]);}catch(_0x246f98){return BPromise[_0xda1a('0x23')](_0x246f98);}return _0x2cbfeb[_0xda1a('0x24')]();};}function saveUpdates(_0x1865ad,_0x3d83e2){return function(_0x374a62){if(_0x374a62){return _0x374a62[_0xda1a('0x25')](_0x1865ad)[_0xda1a('0x26')](function(_0x5b4745){return _0x5b4745;});}return null;};}function removeEntity(_0x5bf507,_0x2da460){return function(_0x37769f){if(_0x37769f){return _0x37769f[_0xda1a('0x27')]()['then'](function(){_0x5bf507[_0xda1a('0x1b')](0xcc)[_0xda1a('0x1c')]();});}};}function handleEntityNotFound(_0x2de0d4,_0x5f3b67){return function(_0xa08990){if(!_0xa08990){_0x2de0d4[_0xda1a('0x28')](0x194);}return _0xa08990;};}function handleError(_0xaa146,_0x543062){_0x543062=_0x543062||0x1f4;return function(_0x50c9a1){logger[_0xda1a('0x29')](_0x50c9a1[_0xda1a('0x2a')]);if(_0x50c9a1['name']){delete _0x50c9a1[_0xda1a('0x2b')];}_0xaa146[_0xda1a('0x1b')](_0x543062)[_0xda1a('0x2c')](_0x50c9a1);};}exports[_0xda1a('0x2d')]=function(_0x52ccb1,_0x52c868){var _0x4a43c5={},_0x3e8b20={},_0x59f77a={'count':0x0,'rows':[]};var _0x3f99b0=_[_0xda1a('0x2e')](db[_0xda1a('0x2f')][_0xda1a('0x30')],function(_0xaa28f6){return{'name':_0xaa28f6[_0xda1a('0x31')],'type':_0xaa28f6[_0xda1a('0x32')][_0xda1a('0x33')]};});_0x3e8b20[_0xda1a('0x34')]=_['map'](_0x3f99b0,_0xda1a('0x2b'));_0x3e8b20['query']=_[_0xda1a('0x35')](_0x52ccb1[_0xda1a('0x36')]);_0x3e8b20[_0xda1a('0x37')]=_[_0xda1a('0x38')](_0x3e8b20[_0xda1a('0x34')],_0x3e8b20[_0xda1a('0x36')]);_0x4a43c5[_0xda1a('0x39')]=_[_0xda1a('0x38')](_0x3e8b20[_0xda1a('0x34')],qs['fields'](_0x52ccb1[_0xda1a('0x36')][_0xda1a('0x3a')]));_0x4a43c5[_0xda1a('0x39')]=_0x4a43c5['attributes'][_0xda1a('0x3b')]?_0x4a43c5[_0xda1a('0x39')]:_0x3e8b20[_0xda1a('0x34')];if(!_0x52ccb1['query'][_0xda1a('0x3c')](_0xda1a('0x3d'))){_0x4a43c5[_0xda1a('0x1f')]=qs['limit'](_0x52ccb1['query'][_0xda1a('0x1f')]);_0x4a43c5['offset']=qs['offset'](_0x52ccb1[_0xda1a('0x36')][_0xda1a('0x1e')]);}_0x4a43c5[_0xda1a('0x3e')]=qs[_0xda1a('0x3f')](_0x52ccb1[_0xda1a('0x36')][_0xda1a('0x3f')]);_0x4a43c5['where']=qs[_0xda1a('0x37')](_[_0xda1a('0x40')](_0x52ccb1[_0xda1a('0x36')],_0x3e8b20['filters']),_0x3f99b0);if(_0x52ccb1[_0xda1a('0x36')]['filter']){_0x4a43c5['where']=_[_0xda1a('0x41')](_0x4a43c5[_0xda1a('0x42')],{'$or':_[_0xda1a('0x2e')](_0x3f99b0,function(_0x5720d2){if(_0x5720d2['type']!==_0xda1a('0x43')){var _0x51bba8={};_0x51bba8[_0x5720d2[_0xda1a('0x2b')]]={'$like':'%'+_0x52ccb1['query']['filter']+'%'};return _0x51bba8;}})});}_0x4a43c5=_[_0xda1a('0x41')]({},_0x4a43c5,_0x52ccb1[_0xda1a('0x44')]);var _0x33571={'where':_0x4a43c5[_0xda1a('0x42')]};return db[_0xda1a('0x2f')][_0xda1a('0x20')](_0x33571)[_0xda1a('0x26')](function(_0xba1365){_0x59f77a[_0xda1a('0x20')]=_0xba1365;if(_0x52ccb1[_0xda1a('0x36')]['includeAll']){_0x4a43c5['include']=[{'all':!![]}];}return db[_0xda1a('0x2f')][_0xda1a('0x45')](_0x4a43c5);})['then'](function(_0x35788d){_0x59f77a[_0xda1a('0x46')]=_0x35788d;return _0x59f77a;})[_0xda1a('0x26')](respondWithFilteredResult(_0x52c868,_0x4a43c5))['catch'](handleError(_0x52c868,null));};exports[_0xda1a('0x47')]=function(_0x2bfa07,_0x4d083d){var _0x21907a={'raw':!![],'where':{'id':_0x2bfa07[_0xda1a('0x48')]['id']}},_0x12ae8b={};_0x12ae8b[_0xda1a('0x34')]=_[_0xda1a('0x35')](db['SmsTransferReport']['rawAttributes']);_0x12ae8b[_0xda1a('0x36')]=_[_0xda1a('0x35')](_0x2bfa07[_0xda1a('0x36')]);_0x12ae8b['filters']=_[_0xda1a('0x38')](_0x12ae8b[_0xda1a('0x34')],_0x12ae8b['query']);_0x21907a[_0xda1a('0x39')]=_[_0xda1a('0x38')](_0x12ae8b['model'],qs[_0xda1a('0x3a')](_0x2bfa07[_0xda1a('0x36')][_0xda1a('0x3a')]));_0x21907a[_0xda1a('0x39')]=_0x21907a[_0xda1a('0x39')][_0xda1a('0x3b')]?_0x21907a[_0xda1a('0x39')]:_0x12ae8b[_0xda1a('0x34')];if(_0x2bfa07[_0xda1a('0x36')]['includeAll']){_0x21907a[_0xda1a('0x49')]=[{'all':!![]}];}_0x21907a=_['merge']({},_0x21907a,_0x2bfa07['options']);return db[_0xda1a('0x2f')]['find'](_0x21907a)[_0xda1a('0x26')](handleEntityNotFound(_0x4d083d,null))[_0xda1a('0x26')](respondWithResult(_0x4d083d,null))['catch'](handleError(_0x4d083d,null));};exports[_0xda1a('0x4a')]=function(_0x482e81,_0x3b2e55){return db[_0xda1a('0x2f')]['create'](_0x482e81['body'],{})['then'](respondWithResult(_0x3b2e55,0xc9))['catch'](handleError(_0x3b2e55,null));};exports[_0xda1a('0x25')]=function(_0x12ba1b,_0x308dd4){if(_0x12ba1b[_0xda1a('0x4b')]['id']){delete _0x12ba1b[_0xda1a('0x4b')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x12ba1b['params']['id']}})[_0xda1a('0x26')](handleEntityNotFound(_0x308dd4,null))[_0xda1a('0x26')](saveUpdates(_0x12ba1b['body'],null))[_0xda1a('0x26')](respondWithResult(_0x308dd4,null))[_0xda1a('0x4c')](handleError(_0x308dd4,null));};exports[_0xda1a('0x27')]=function(_0x1ad8cd,_0x3fbd5e){return db[_0xda1a('0x2f')][_0xda1a('0x4d')]({'where':{'id':_0x1ad8cd[_0xda1a('0x48')]['id']}})[_0xda1a('0x26')](handleEntityNotFound(_0x3fbd5e,null))[_0xda1a('0x26')](removeEntity(_0x3fbd5e,null))[_0xda1a('0x4c')](handleError(_0x3fbd5e,null));};exports[_0xda1a('0x4e')]=function(_0x5c867c,_0x39a93d){return db[_0xda1a('0x2f')][_0xda1a('0x4e')]()['then'](respondWithResult(_0x39a93d,null))[_0xda1a('0x4c')](handleError(_0x39a93d,null));}; \ No newline at end of file +var _0xa7b1=['sendStatus','status','json','limit','count','offset','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','SmsTransferReport','findAll','rows','catch','show','params','keys','rawAttributes','create','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util'];(function(_0xd5f8c9,_0xdf425b){var _0x5ae8f6=function(_0xc5d316){while(--_0xc5d316){_0xd5f8c9['push'](_0xd5f8c9['shift']());}};_0x5ae8f6(++_0xdf425b);}(_0xa7b1,0x7a));var _0x1a7b=function(_0x584880,_0x5ebdfc){_0x584880=_0x584880-0x0;var _0x1342e0=_0xa7b1[_0x584880];return _0x1342e0;};'use strict';var emlformat=require(_0x1a7b('0x0'));var rimraf=require(_0x1a7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a7b('0x2'));var rp=require(_0x1a7b('0x3'));var moment=require(_0x1a7b('0x4'));var BPromise=require(_0x1a7b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a7b('0x6'));var csv=require(_0x1a7b('0x7'));var ejs=require(_0x1a7b('0x8'));var fs=require('fs');var fs_extra=require(_0x1a7b('0x9'));var _=require(_0x1a7b('0xa'));var squel=require(_0x1a7b('0xb'));var crypto=require(_0x1a7b('0xc'));var jsforce=require(_0x1a7b('0xd'));var deskjs=require(_0x1a7b('0xe'));var toCsv=require(_0x1a7b('0x7'));var querystring=require(_0x1a7b('0xf'));var Papa=require(_0x1a7b('0x10'));var Redis=require(_0x1a7b('0x11'));var authService=require(_0x1a7b('0x12'));var qs=require(_0x1a7b('0x13'));var as=require(_0x1a7b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a7b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1a7b('0x16'));var licenseUtil=require(_0x1a7b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bb380,_0x4a3bbd){_0x4a3bbd=_0x4a3bbd||0xcc;return function(_0x3513e4){if(_0x3513e4){return _0x4bb380[_0x1a7b('0x18')](_0x4a3bbd);}return _0x4bb380['status'](_0x4a3bbd)['end']();};}function respondWithResult(_0x4c233d,_0x36a61f){_0x36a61f=_0x36a61f||0xc8;return function(_0x477894){if(_0x477894){return _0x4c233d[_0x1a7b('0x19')](_0x36a61f)[_0x1a7b('0x1a')](_0x477894);}};}function respondWithFilteredResult(_0x459702,_0x29e8e2){return function(_0x22d9f3){if(_0x22d9f3){var _0x5f349f=typeof _0x29e8e2['offset']==='undefined'&&typeof _0x29e8e2[_0x1a7b('0x1b')]==='undefined';var _0x50d8db=_0x22d9f3[_0x1a7b('0x1c')];var _0x534ad2=_0x5f349f?0x0:_0x29e8e2[_0x1a7b('0x1d')];var _0x1c66dd=_0x5f349f?_0x22d9f3[_0x1a7b('0x1c')]:_0x29e8e2[_0x1a7b('0x1d')]+_0x29e8e2[_0x1a7b('0x1b')];var _0x33966c;if(_0x1c66dd>=_0x50d8db){_0x1c66dd=_0x50d8db;_0x33966c=0xc8;}else{_0x33966c=0xce;}_0x459702['status'](_0x33966c);return _0x459702['set']('Content-Range',_0x534ad2+'-'+_0x1c66dd+'/'+_0x50d8db)[_0x1a7b('0x1a')](_0x22d9f3);}return null;};}function patchUpdates(_0x2e8864){return function(_0x1282bf){try{jsonpatch[_0x1a7b('0x1e')](_0x1282bf,_0x2e8864,!![]);}catch(_0x479691){return BPromise[_0x1a7b('0x1f')](_0x479691);}return _0x1282bf['save']();};}function saveUpdates(_0x53767e,_0x43262b){return function(_0x3ede02){if(_0x3ede02){return _0x3ede02[_0x1a7b('0x20')](_0x53767e)[_0x1a7b('0x21')](function(_0x1f4d92){return _0x1f4d92;});}return null;};}function removeEntity(_0x816c41,_0x447aad){return function(_0x5f1ea1){if(_0x5f1ea1){return _0x5f1ea1[_0x1a7b('0x22')]()[_0x1a7b('0x21')](function(){_0x816c41['status'](0xcc)[_0x1a7b('0x23')]();});}};}function handleEntityNotFound(_0x56402d,_0x2e2a0b){return function(_0x4a3fcf){if(!_0x4a3fcf){_0x56402d['sendStatus'](0x194);}return _0x4a3fcf;};}function handleError(_0x8c950d,_0x2d64a9){_0x2d64a9=_0x2d64a9||0x1f4;return function(_0x41120a){logger[_0x1a7b('0x24')](_0x41120a[_0x1a7b('0x25')]);if(_0x41120a[_0x1a7b('0x26')]){delete _0x41120a[_0x1a7b('0x26')];}_0x8c950d[_0x1a7b('0x19')](_0x2d64a9)[_0x1a7b('0x27')](_0x41120a);};}exports[_0x1a7b('0x28')]=function(_0x919ec2,_0x11fe75){var _0x24f1bd={},_0x453ba4={},_0x4872cd={'count':0x0,'rows':[]};var _0x1c890a=_[_0x1a7b('0x29')](db['SmsTransferReport']['rawAttributes'],function(_0x57f2c0){return{'name':_0x57f2c0[_0x1a7b('0x2a')],'type':_0x57f2c0['type'][_0x1a7b('0x2b')]};});_0x453ba4[_0x1a7b('0x2c')]=_[_0x1a7b('0x29')](_0x1c890a,'name');_0x453ba4[_0x1a7b('0x2d')]=_['keys'](_0x919ec2[_0x1a7b('0x2d')]);_0x453ba4['filters']=_[_0x1a7b('0x2e')](_0x453ba4[_0x1a7b('0x2c')],_0x453ba4[_0x1a7b('0x2d')]);_0x24f1bd[_0x1a7b('0x2f')]=_['intersection'](_0x453ba4[_0x1a7b('0x2c')],qs[_0x1a7b('0x30')](_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x30')]));_0x24f1bd['attributes']=_0x24f1bd[_0x1a7b('0x2f')]['length']?_0x24f1bd[_0x1a7b('0x2f')]:_0x453ba4[_0x1a7b('0x2c')];if(!_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x31')]('nolimit')){_0x24f1bd[_0x1a7b('0x1b')]=qs[_0x1a7b('0x1b')](_0x919ec2[_0x1a7b('0x2d')]['limit']);_0x24f1bd[_0x1a7b('0x1d')]=qs[_0x1a7b('0x1d')](_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x1d')]);}_0x24f1bd['order']=qs[_0x1a7b('0x32')](_0x919ec2[_0x1a7b('0x2d')]['sort']);_0x24f1bd[_0x1a7b('0x33')]=qs['filters'](_[_0x1a7b('0x34')](_0x919ec2['query'],_0x453ba4[_0x1a7b('0x35')]),_0x1c890a);if(_0x919ec2[_0x1a7b('0x2d')]['filter']){_0x24f1bd[_0x1a7b('0x33')]=_[_0x1a7b('0x36')](_0x24f1bd['where'],{'$or':_[_0x1a7b('0x29')](_0x1c890a,function(_0x5011d1){if(_0x5011d1[_0x1a7b('0x37')]!==_0x1a7b('0x38')){var _0x177513={};_0x177513[_0x5011d1[_0x1a7b('0x26')]]={'$like':'%'+_0x919ec2['query'][_0x1a7b('0x39')]+'%'};return _0x177513;}})});}_0x24f1bd=_['merge']({},_0x24f1bd,_0x919ec2[_0x1a7b('0x3a')]);var _0x34b077={'where':_0x24f1bd[_0x1a7b('0x33')]};return db['SmsTransferReport'][_0x1a7b('0x1c')](_0x34b077)[_0x1a7b('0x21')](function(_0x150e94){_0x4872cd[_0x1a7b('0x1c')]=_0x150e94;if(_0x919ec2[_0x1a7b('0x2d')][_0x1a7b('0x3b')]){_0x24f1bd[_0x1a7b('0x3c')]=[{'all':!![]}];}return db[_0x1a7b('0x3d')][_0x1a7b('0x3e')](_0x24f1bd);})[_0x1a7b('0x21')](function(_0x6d2461){_0x4872cd[_0x1a7b('0x3f')]=_0x6d2461;return _0x4872cd;})['then'](respondWithFilteredResult(_0x11fe75,_0x24f1bd))[_0x1a7b('0x40')](handleError(_0x11fe75,null));};exports[_0x1a7b('0x41')]=function(_0x3010a2,_0x3d5813){var _0x40b6bf={'raw':!![],'where':{'id':_0x3010a2[_0x1a7b('0x42')]['id']}},_0x44f258={};_0x44f258[_0x1a7b('0x2c')]=_[_0x1a7b('0x43')](db['SmsTransferReport'][_0x1a7b('0x44')]);_0x44f258[_0x1a7b('0x2d')]=_[_0x1a7b('0x43')](_0x3010a2[_0x1a7b('0x2d')]);_0x44f258['filters']=_[_0x1a7b('0x2e')](_0x44f258[_0x1a7b('0x2c')],_0x44f258[_0x1a7b('0x2d')]);_0x40b6bf[_0x1a7b('0x2f')]=_[_0x1a7b('0x2e')](_0x44f258[_0x1a7b('0x2c')],qs['fields'](_0x3010a2[_0x1a7b('0x2d')]['fields']));_0x40b6bf[_0x1a7b('0x2f')]=_0x40b6bf[_0x1a7b('0x2f')]['length']?_0x40b6bf[_0x1a7b('0x2f')]:_0x44f258[_0x1a7b('0x2c')];if(_0x3010a2[_0x1a7b('0x2d')]['includeAll']){_0x40b6bf[_0x1a7b('0x3c')]=[{'all':!![]}];}_0x40b6bf=_[_0x1a7b('0x36')]({},_0x40b6bf,_0x3010a2['options']);return db[_0x1a7b('0x3d')]['find'](_0x40b6bf)[_0x1a7b('0x21')](handleEntityNotFound(_0x3d5813,null))[_0x1a7b('0x21')](respondWithResult(_0x3d5813,null))[_0x1a7b('0x40')](handleError(_0x3d5813,null));};exports[_0x1a7b('0x45')]=function(_0x20862d,_0x3b0b44){return db[_0x1a7b('0x3d')][_0x1a7b('0x45')](_0x20862d['body'],{})[_0x1a7b('0x21')](respondWithResult(_0x3b0b44,0xc9))[_0x1a7b('0x40')](handleError(_0x3b0b44,null));};exports[_0x1a7b('0x20')]=function(_0x2a89ca,_0x22bc18){if(_0x2a89ca['body']['id']){delete _0x2a89ca['body']['id'];}return db[_0x1a7b('0x3d')][_0x1a7b('0x46')]({'where':{'id':_0x2a89ca['params']['id']}})[_0x1a7b('0x21')](handleEntityNotFound(_0x22bc18,null))[_0x1a7b('0x21')](saveUpdates(_0x2a89ca[_0x1a7b('0x47')],null))[_0x1a7b('0x21')](respondWithResult(_0x22bc18,null))['catch'](handleError(_0x22bc18,null));};exports[_0x1a7b('0x22')]=function(_0x3a9153,_0x10ae0d){return db[_0x1a7b('0x3d')][_0x1a7b('0x46')]({'where':{'id':_0x3a9153[_0x1a7b('0x42')]['id']}})[_0x1a7b('0x21')](handleEntityNotFound(_0x10ae0d,null))[_0x1a7b('0x21')](removeEntity(_0x10ae0d,null))[_0x1a7b('0x40')](handleError(_0x10ae0d,null));};exports['describe']=function(_0x3ae008,_0x210093){return db[_0x1a7b('0x3d')][_0x1a7b('0x48')]()[_0x1a7b('0x21')](respondWithResult(_0x210093,null))[_0x1a7b('0x40')](handleError(_0x210093,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e49a1da..16583d4 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 _0x2c2b=['SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','request-promise','rimraf','exports','define'];(function(_0x29f77f,_0x54d73b){var _0x5ec7f1=function(_0x544b6e){while(--_0x544b6e){_0x29f77f['push'](_0x29f77f['shift']());}};_0x5ec7f1(++_0x54d73b);}(_0x2c2b,0x1b1));var _0xb2c2=function(_0x4a9148,_0x4a699e){_0x4a9148=_0x4a9148-0x0;var _0x27057a=_0x2c2b[_0x4a9148];return _0x27057a;};'use strict';var _=require('lodash');var util=require(_0xb2c2('0x0'));var logger=require(_0xb2c2('0x1'))(_0xb2c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c2('0x4'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xb2c2('0x5')]=function(_0x103254,_0x5d42f4){return _0x103254[_0xb2c2('0x6')](_0xb2c2('0x7'),attributes,{'tableName':_0xb2c2('0x8'),'paranoid':![],'indexes':[{'name':_0xb2c2('0x9'),'fields':[_0xb2c2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b2=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0xc5fcc3,_0x33883a){var _0x26f33a=function(_0xa4a50b){while(--_0xa4a50b){_0xc5fcc3['push'](_0xc5fcc3['shift']());}};_0x26f33a(++_0x33883a);}(_0xd0b2,0x96));var _0x2d0b=function(_0x271b23,_0x39789c){_0x271b23=_0x271b23-0x0;var _0x1266a3=_0xd0b2[_0x271b23];return _0x1266a3;};'use strict';var _=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var logger=require(_0x2d0b('0x2'))(_0x2d0b('0x3'));var moment=require(_0x2d0b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0b('0x5'));var rimraf=require(_0x2d0b('0x6'));var config=require(_0x2d0b('0x7'));var attributes=require(_0x2d0b('0x8'));module[_0x2d0b('0x9')]=function(_0x419d84,_0x11654a){return _0x419d84['define']('SmsTransferReport',attributes,{'tableName':_0x2d0b('0xa'),'paranoid':![],'indexes':[{'name':_0x2d0b('0xb'),'fields':[_0x2d0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index eba773d..723da7f 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 _0x15cb=['request\x20sent','stringify','error','code','message','info','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x193e41,_0x4dd14a){var _0x196000=function(_0x2f2c67){while(--_0x2f2c67){_0x193e41['push'](_0x193e41['shift']());}};_0x196000(++_0x4dd14a);}(_0x15cb,0x16f));var _0xb15c=function(_0x46e324,_0x20625f){_0x46e324=_0x46e324-0x0;var _0x6ef733=_0x15cb[_0x46e324];return _0x6ef733;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var moment=require('moment');var BPromise=require(_0xb15c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb15c('0x2'));var db=require(_0xb15c('0x3'))['db'];var utils=require(_0xb15c('0x4'));var logger=require(_0xb15c('0x5'))('rpc');var config=require(_0xb15c('0x6'));var jayson=require(_0xb15c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x161c9c,_0x2c18ad,_0x1c75a8){return new BPromise(function(_0x3ad071,_0x157a90){return client[_0xb15c('0x8')](_0x161c9c,_0x1c75a8)[_0xb15c('0x9')](function(_0x12ebcd){logger['info'](_0xb15c('0xa'),_0x2c18ad,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c18ad,_0xb15c('0xb'),JSON[_0xb15c('0xc')](_0x12ebcd));if(_0x12ebcd[_0xb15c('0xd')]){if(_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xe')]===0x1f4){logger[_0xb15c('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2c18ad,_0x12ebcd['error'][_0xb15c('0xf')]);return _0x157a90(_0x12ebcd['error'][_0xb15c('0xf')]);}logger[_0xb15c('0xd')](_0xb15c('0xa'),_0x2c18ad,_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xf')]);return _0x3ad071(_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xf')]);}else{logger[_0xb15c('0x10')](_0xb15c('0xa'),_0x2c18ad,_0xb15c('0xb'));_0x3ad071(_0x12ebcd['result'][_0xb15c('0xf')]);}})[_0xb15c('0x11')](function(_0x5d0d92){logger[_0xb15c('0xd')](_0xb15c('0xa'),_0x2c18ad,_0x5d0d92);_0x157a90(_0x5d0d92);});});} \ No newline at end of file +var _0x1793=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1793,0x1ce));var _0x3179=function(_0x3f7111,_0x3c0988){_0x3f7111=_0x3f7111-0x0;var _0x216d7d=_0x1793[_0x3f7111];return _0x216d7d;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var moment=require(_0x3179('0x2'));var BPromise=require(_0x3179('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3179('0x4'));var db=require(_0x3179('0x5'))['db'];var utils=require(_0x3179('0x6'));var logger=require(_0x3179('0x7'))(_0x3179('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3179('0x9')][_0x3179('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52ff5c,_0x4e43f3,_0x446329){return new BPromise(function(_0x160208,_0x23d2ee){return client['request'](_0x52ff5c,_0x446329)[_0x3179('0xb')](function(_0x433f39){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));logger[_0x3179('0xd')](_0x3179('0xe'),_0x4e43f3,'request\x20sent',JSON[_0x3179('0xf')](_0x433f39));if(_0x433f39[_0x3179('0x10')]){if(_0x433f39[_0x3179('0x10')][_0x3179('0x11')]===0x1f4){logger['error'](_0x3179('0x12'),_0x4e43f3,_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);return _0x23d2ee(_0x433f39['error']['message']);}logger[_0x3179('0x10')](_0x3179('0x12'),_0x4e43f3,_0x433f39['error']['message']);return _0x160208(_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);}else{logger[_0x3179('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));_0x160208(_0x433f39[_0x3179('0x15')][_0x3179('0x13')]);}})[_0x3179('0x16')](function(_0x24451a){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4e43f3,_0x24451a);_0x23d2ee(_0x24451a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3754b16..678f03d 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 _0x17b4=['../../config/environment','get','isAuthenticated','index','/:id/download','download','join','originalname','format','%s-%s%s','basename','now','extname','single','file','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x12e3b8,_0x20d61f){var _0x2a0fa5=function(_0x7f80a3){while(--_0x7f80a3){_0x12e3b8['push'](_0x12e3b8['shift']());}};_0x2a0fa5(++_0x20d61f);}(_0x17b4,0x13f));var _0x417b=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x17b4[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x417b('0x0'));var util=require('util');var path=require(_0x417b('0x1'));var timeout=require(_0x417b('0x2'));var express=require(_0x417b('0x3'));var router=express[_0x417b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x417b('0x5'));var config=require(_0x417b('0x6'));var controller=require('./sound.controller');router[_0x417b('0x7')]('/',auth[_0x417b('0x8')](),controller[_0x417b('0x9')]);router[_0x417b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x417b('0x7')](_0x417b('0xa'),auth['isAuthenticated'](),controller[_0x417b('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x444b82,_0x3ea46c,_0x2f4120){_0x2f4120(null,path[_0x417b('0xc')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x13b690,_0x48788f,_0x4d90e7){_0x48788f[_0x417b('0xd')]=_0x48788f['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d90e7(null,util[_0x417b('0xe')](_0x417b('0xf'),path[_0x417b('0x10')](_0x48788f['originalname'],path['extname'](_0x48788f[_0x417b('0xd')])),Date[_0x417b('0x11')](),path[_0x417b('0x12')](_0x48788f[_0x417b('0xd')])));}})});router['post']('/',upload[_0x417b('0x13')](_0x417b('0x14')),controller[_0x417b('0x15')]);router[_0x417b('0x16')]('/:id',auth[_0x417b('0x8')](),controller['update']);router[_0x417b('0x17')]('/:id',auth[_0x417b('0x8')](),controller['delete']);module[_0x417b('0x18')]=router; \ No newline at end of file +var _0xf133=['format','%s-%s%s','basename','now','post','file','create','put','update','delete','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','/:id','show','/:id/download','isAuthenticated','diskStorage','join','root','originalname','replace'];(function(_0x151add,_0x1b87c6){var _0x1479e7=function(_0x627399){while(--_0x627399){_0x151add['push'](_0x151add['shift']());}};_0x1479e7(++_0x1b87c6);}(_0xf133,0x176));var _0x3f13=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf133[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f13('0x0'));var timeout=require(_0x3f13('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3f13('0x2'));var auth=require(_0x3f13('0x3'));var interaction=require(_0x3f13('0x4'));var config=require('../../config/environment');var controller=require(_0x3f13('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3f13('0x6')](_0x3f13('0x7'),auth['isAuthenticated'](),controller[_0x3f13('0x8')]);router[_0x3f13('0x6')](_0x3f13('0x9'),auth[_0x3f13('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x3f13('0xb')]({'destination':function(_0x30bde9,_0x55a23c,_0x5489e9){_0x5489e9(null,path[_0x3f13('0xc')](config[_0x3f13('0xd')],'server/files/sounds/original/'));},'filename':function(_0x15be44,_0x296b18,_0x144013){_0x296b18[_0x3f13('0xe')]=_0x296b18[_0x3f13('0xe')][_0x3f13('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x144013(null,util[_0x3f13('0x10')](_0x3f13('0x11'),path[_0x3f13('0x12')](_0x296b18[_0x3f13('0xe')],path['extname'](_0x296b18['originalname'])),Date[_0x3f13('0x13')](),path['extname'](_0x296b18[_0x3f13('0xe')])));}})});router[_0x3f13('0x14')]('/',upload['single'](_0x3f13('0x15')),controller[_0x3f13('0x16')]);router[_0x3f13('0x17')](_0x3f13('0x7'),auth[_0x3f13('0xa')](),controller[_0x3f13('0x18')]);router[_0x3f13('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x3f13('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 74cd994..cf421dc 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 _0x3e25=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x3e25,0x14f));var _0x53e2=function(_0x1d1297,_0x154bc5){_0x1d1297=_0x1d1297-0x0;var _0x5ce001=_0x3e25[_0x1d1297];return _0x5ce001;};'use strict';var Sequelize=require(_0x53e2('0x0'));module[_0x53e2('0x1')]={'name':{'type':Sequelize[_0x53e2('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x53e2('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x53e2('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x53e2('0x3')]},'original_sampleCount':{'type':Sequelize[_0x53e2('0x4')]},'original_channelCount':{'type':Sequelize[_0x53e2('0x5')]},'original_bitRate':{'type':Sequelize[_0x53e2('0x4')]},'original_sampleRate':{'type':Sequelize[_0x53e2('0x5')]},'converted_format':{'type':Sequelize[_0x53e2('0x2')]},'converted_duration':{'type':Sequelize[_0x53e2('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x53e2('0x4')]},'converted_channelCount':{'type':Sequelize[_0x53e2('0x5')]},'converted_bitRate':{'type':Sequelize[_0x53e2('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x53e2('0x5')]}}; \ No newline at end of file +var _0xf698=['BIGINT','INTEGER','STRING','FLOAT'];(function(_0x1695ce,_0xfbc15){var _0x216995=function(_0x508c4f){while(--_0x508c4f){_0x1695ce['push'](_0x1695ce['shift']());}};_0x216995(++_0xfbc15);}(_0xf698,0x10e));var _0x8f69=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xf698[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8f69('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x8f69('0x0')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x8f69('0x0')]},'original_format':{'type':Sequelize[_0x8f69('0x0')]},'original_duration':{'type':Sequelize[_0x8f69('0x1')]},'original_sampleCount':{'type':Sequelize[_0x8f69('0x2')]},'original_channelCount':{'type':Sequelize[_0x8f69('0x3')]},'original_bitRate':{'type':Sequelize[_0x8f69('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x8f69('0x0')]},'converted_duration':{'type':Sequelize[_0x8f69('0x1')]},'converted_sampleCount':{'type':Sequelize[_0x8f69('0x2')]},'converted_channelCount':{'type':Sequelize[_0x8f69('0x3')]},'converted_bitRate':{'type':Sequelize[_0x8f69('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x8f69('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7576761..ee1c812 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 _0xc294=['wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','body','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','end','error','stack','name','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','download','params','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','extname','basename','filename','substring'];(function(_0x12dc45,_0x388e68){var _0x3691e4=function(_0x1393b4){while(--_0x1393b4){_0x12dc45['push'](_0x12dc45['shift']());}};_0x3691e4(++_0x388e68);}(_0xc294,0x11e));var _0x4c29=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0xc294[_0x3dd822];return _0x4f58d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c29('0x0'));var rp=require(_0x4c29('0x1'));var moment=require(_0x4c29('0x2'));var BPromise=require(_0x4c29('0x3'));var Mustache=require('mustache');var util=require(_0x4c29('0x4'));var path=require('path');var sox=require(_0x4c29('0x5'));var csv=require(_0x4c29('0x6'));var ejs=require(_0x4c29('0x7'));var fs=require('fs');var fs_extra=require(_0x4c29('0x8'));var _=require(_0x4c29('0x9'));var squel=require(_0x4c29('0xa'));var crypto=require('crypto');var jsforce=require(_0x4c29('0xb'));var deskjs=require(_0x4c29('0xc'));var toCsv=require(_0x4c29('0x6'));var querystring=require(_0x4c29('0xd'));var Papa=require('papaparse');var Redis=require(_0x4c29('0xe'));var authService=require(_0x4c29('0xf'));var qs=require(_0x4c29('0x10'));var as=require(_0x4c29('0x11'));var hardwareService=require(_0x4c29('0x12'));var logger=require(_0x4c29('0x13'))(_0x4c29('0x14'));var utils=require(_0x4c29('0x15'));var config=require(_0x4c29('0x16'));var licenseUtil=require(_0x4c29('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e56b8,_0x476cd9){_0x476cd9=_0x476cd9||0xcc;return function(_0x126e4d){if(_0x126e4d){return _0x2e56b8[_0x4c29('0x18')](_0x476cd9);}return _0x2e56b8[_0x4c29('0x19')](_0x476cd9)['end']();};}function respondWithResult(_0x351d89,_0x5472b3){_0x5472b3=_0x5472b3||0xc8;return function(_0x4c1ab1){if(_0x4c1ab1){return _0x351d89[_0x4c29('0x19')](_0x5472b3)['json'](_0x4c1ab1);}};}function respondWithFilteredResult(_0x269b3f,_0x47eeef){return function(_0x366956){if(_0x366956){var _0x25db75=typeof _0x47eeef[_0x4c29('0x1a')]===_0x4c29('0x1b')&&typeof _0x47eeef[_0x4c29('0x1c')]===_0x4c29('0x1b');var _0x2816a6=_0x366956[_0x4c29('0x1d')];var _0x31e839=_0x25db75?0x0:_0x47eeef['offset'];var _0x3acbbd=_0x25db75?_0x366956[_0x4c29('0x1d')]:_0x47eeef['offset']+_0x47eeef['limit'];var _0x4d4cf6;if(_0x3acbbd>=_0x2816a6){_0x3acbbd=_0x2816a6;_0x4d4cf6=0xc8;}else{_0x4d4cf6=0xce;}_0x269b3f[_0x4c29('0x19')](_0x4d4cf6);return _0x269b3f['set'](_0x4c29('0x1e'),_0x31e839+'-'+_0x3acbbd+'/'+_0x2816a6)['json'](_0x366956);}return null;};}function patchUpdates(_0x58104d){return function(_0x3d2b34){try{jsonpatch[_0x4c29('0x1f')](_0x3d2b34,_0x58104d,!![]);}catch(_0x39831b){return BPromise[_0x4c29('0x20')](_0x39831b);}return _0x3d2b34[_0x4c29('0x21')]();};}function saveUpdates(_0x15d633,_0xcd62a9){return function(_0x51b58a){if(_0x51b58a){return _0x51b58a[_0x4c29('0x22')](_0x15d633)['then'](function(_0x85eceb){return _0x85eceb;});}return null;};}function removeEntity(_0x523040,_0x3451ce){return function(_0xc14b0b){if(_0xc14b0b){return _0xc14b0b[_0x4c29('0x23')]()[_0x4c29('0x24')](function(){var _0x3cffa6=_0xc14b0b[_0x4c29('0x25')]({'plain':!![]});var _0x4e86d0=_0x4c29('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e86d0,'resourceId':_0x3cffa6['id']}})[_0x4c29('0x24')](function(){return _0xc14b0b;});})[_0x4c29('0x24')](function(){_0x523040[_0x4c29('0x19')](0xcc)[_0x4c29('0x27')]();});}};}function handleEntityNotFound(_0xb86ecb,_0xd7c31d){return function(_0x3c9e20){if(!_0x3c9e20){_0xb86ecb[_0x4c29('0x18')](0x194);}return _0x3c9e20;};}function handleError(_0x3ca37d,_0x9323db){_0x9323db=_0x9323db||0x1f4;return function(_0x3caffe){logger[_0x4c29('0x28')](_0x3caffe[_0x4c29('0x29')]);if(_0x3caffe[_0x4c29('0x2a')]){delete _0x3caffe[_0x4c29('0x2a')];}_0x3ca37d[_0x4c29('0x19')](_0x9323db)['send'](_0x3caffe);};}exports[_0x4c29('0x2b')]=function(_0x3aecad,_0x3c23bf){var _0x30694f={},_0xa577ac={},_0x46d1f6={'count':0x0,'rows':[]};var _0x4fece1=_['map'](db[_0x4c29('0x2c')][_0x4c29('0x2d')],function(_0x3e7162){return{'name':_0x3e7162[_0x4c29('0x2e')],'type':_0x3e7162[_0x4c29('0x2f')][_0x4c29('0x30')]};});_0xa577ac[_0x4c29('0x31')]=_[_0x4c29('0x32')](_0x4fece1,'name');_0xa577ac['query']=_[_0x4c29('0x33')](_0x3aecad[_0x4c29('0x34')]);_0xa577ac[_0x4c29('0x35')]=_[_0x4c29('0x36')](_0xa577ac[_0x4c29('0x31')],_0xa577ac['query']);_0x30694f[_0x4c29('0x37')]=_[_0x4c29('0x36')](_0xa577ac[_0x4c29('0x31')],qs[_0x4c29('0x38')](_0x3aecad[_0x4c29('0x34')][_0x4c29('0x38')]));_0x30694f[_0x4c29('0x37')]=_0x30694f[_0x4c29('0x37')][_0x4c29('0x39')]?_0x30694f[_0x4c29('0x37')]:_0xa577ac[_0x4c29('0x31')];if(!_0x3aecad['query'][_0x4c29('0x3a')](_0x4c29('0x3b'))){_0x30694f['limit']=qs['limit'](_0x3aecad[_0x4c29('0x34')][_0x4c29('0x1c')]);_0x30694f['offset']=qs[_0x4c29('0x1a')](_0x3aecad[_0x4c29('0x34')][_0x4c29('0x1a')]);}_0x30694f[_0x4c29('0x3c')]=qs[_0x4c29('0x3d')](_0x3aecad[_0x4c29('0x34')][_0x4c29('0x3d')]);_0x30694f[_0x4c29('0x3e')]=qs[_0x4c29('0x35')](_[_0x4c29('0x3f')](_0x3aecad['query'],_0xa577ac[_0x4c29('0x35')]),_0x4fece1);if(_0x3aecad['query']['filter']){_0x30694f['where']=_[_0x4c29('0x40')](_0x30694f[_0x4c29('0x3e')],{'$or':_[_0x4c29('0x32')](_0x4fece1,function(_0x2a5735){if(_0x2a5735['type']!==_0x4c29('0x41')){var _0x23ed7b={};_0x23ed7b[_0x2a5735[_0x4c29('0x2a')]]={'$like':'%'+_0x3aecad[_0x4c29('0x34')][_0x4c29('0x42')]+'%'};return _0x23ed7b;}})});}_0x30694f=_[_0x4c29('0x40')]({},_0x30694f,_0x3aecad[_0x4c29('0x43')]);var _0x164341={'where':_0x30694f[_0x4c29('0x3e')]};return db[_0x4c29('0x2c')]['count'](_0x164341)[_0x4c29('0x24')](function(_0x4ed04a){_0x46d1f6[_0x4c29('0x1d')]=_0x4ed04a;if(_0x3aecad[_0x4c29('0x34')][_0x4c29('0x44')]){_0x30694f[_0x4c29('0x45')]=[{'all':!![]}];}return db['Sound'][_0x4c29('0x46')](_0x30694f);})[_0x4c29('0x24')](function(_0x5a41a5){_0x46d1f6[_0x4c29('0x47')]=_0x5a41a5;return _0x46d1f6;})['then'](respondWithFilteredResult(_0x3c23bf,_0x30694f))[_0x4c29('0x48')](handleError(_0x3c23bf,null));};exports[_0x4c29('0x49')]=function(_0x3dd037,_0x54f0b3){var _0x290764={'raw':!![],'where':{'id':_0x3dd037['params']['id']}},_0x10b993={};_0x10b993[_0x4c29('0x31')]=_[_0x4c29('0x33')](db[_0x4c29('0x2c')][_0x4c29('0x2d')]);_0x10b993[_0x4c29('0x34')]=_[_0x4c29('0x33')](_0x3dd037[_0x4c29('0x34')]);_0x10b993[_0x4c29('0x35')]=_['intersection'](_0x10b993[_0x4c29('0x31')],_0x10b993[_0x4c29('0x34')]);_0x290764[_0x4c29('0x37')]=_[_0x4c29('0x36')](_0x10b993[_0x4c29('0x31')],qs[_0x4c29('0x38')](_0x3dd037[_0x4c29('0x34')][_0x4c29('0x38')]));_0x290764['attributes']=_0x290764[_0x4c29('0x37')][_0x4c29('0x39')]?_0x290764[_0x4c29('0x37')]:_0x10b993['model'];if(_0x3dd037[_0x4c29('0x34')][_0x4c29('0x44')]){_0x290764[_0x4c29('0x45')]=[{'all':!![]}];}_0x290764=_[_0x4c29('0x40')]({},_0x290764,_0x3dd037['options']);return db[_0x4c29('0x2c')][_0x4c29('0x4a')](_0x290764)[_0x4c29('0x24')](handleEntityNotFound(_0x54f0b3,null))['then'](respondWithResult(_0x54f0b3,null))[_0x4c29('0x48')](handleError(_0x54f0b3,null));};exports[_0x4c29('0x4b')]=function(_0x4c1239,_0x2f35e6,_0xd1b454){return db[_0x4c29('0x2c')]['find']({'where':{'id':_0x4c1239[_0x4c29('0x4c')]['id']},'attributes':[_0x4c29('0x2a'),'save_name','converted_format'],'raw':!![]})[_0x4c29('0x24')](handleEntityNotFound(_0x2f35e6,null))[_0x4c29('0x24')](function(_0x4b0158){if(_0x4b0158){if(!fs[_0x4c29('0x4d')](path[_0x4c29('0x4e')](config[_0x4c29('0x4f')],_0x4c29('0x50'),_0x4b0158[_0x4c29('0x51')]+'.'+_0x4b0158[_0x4c29('0x52')]))){throw new db[(_0x4c29('0x53'))][(_0x4c29('0x54'))](_0x4c29('0x55'));}return _0x2f35e6[_0x4c29('0x4b')](path[_0x4c29('0x4e')](config[_0x4c29('0x4f')],'server/files/sounds/converted',util[_0x4c29('0x56')](_0x4c29('0x57'),_0x4b0158[_0x4c29('0x51')],_0x4b0158[_0x4c29('0x52')])),util[_0x4c29('0x56')](_0x4c29('0x57'),_0x4b0158[_0x4c29('0x2a')],_0x4b0158[_0x4c29('0x52')]));}return null;})[_0x4c29('0x48')](handleError(_0x2f35e6,null));};exports[_0x4c29('0x58')]=function(_0x550852,_0x583034,_0x370a59){var _0xa86b49={'name':path['basename'](_0x550852[_0x4c29('0x59')][_0x4c29('0x5a')],path[_0x4c29('0x5b')](_0x550852[_0x4c29('0x59')]['originalname'])),'save_name':path[_0x4c29('0x5c')](_0x550852['file']['filename'],path[_0x4c29('0x5b')](_0x550852['file'][_0x4c29('0x5d')])),'original_format':path[_0x4c29('0x5b')](_0x550852[_0x4c29('0x59')][_0x4c29('0x5a')])[_0x4c29('0x5e')](0x1),'converted_format':_0x4c29('0x5f')};var _0x4f7334=path[_0x4c29('0x4e')](config[_0x4c29('0x4f')],_0x4c29('0x60'),_0x550852['file'][_0x4c29('0x5d')]);var _0x511877=path[_0x4c29('0x4e')](config[_0x4c29('0x4f')],_0x4c29('0x50'),util['format'](_0x4c29('0x57'),path['basename'](_0x550852['file'][_0x4c29('0x5d')],path[_0x4c29('0x5b')](_0x550852[_0x4c29('0x59')][_0x4c29('0x5d')])),_0xa86b49[_0x4c29('0x52')]));logger[_0x4c29('0x61')](_0x4c29('0x62'),_0x4f7334);logger[_0x4c29('0x61')](_0x4c29('0x63'),_0x511877);try{fs[_0x4c29('0x64')](_0x4f7334,parseInt(_0x4c29('0x65'),0x8));var _0x3e29c4=sox[_0x4c29('0x66')](_0x4f7334,_0x511877,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e29c4['on']('error',function(_0x2e2190){fs[_0x4c29('0x67')](_0x4f7334);_0x583034['status'](0x1f4)[_0x4c29('0x68')](_0x2e2190);});_0x3e29c4['on'](_0x4c29('0x69'),function(_0x9c1076){_0xa86b49[_0x4c29('0x6a')]=isNaN(_0x9c1076[_0x4c29('0x6b')])?null:_0x9c1076[_0x4c29('0x6b')]*0x3e8;_0xa86b49['original_sampleCount']=isNaN(_0x9c1076[_0x4c29('0x6c')])?null:_0x9c1076[_0x4c29('0x6c')];_0xa86b49['original_channelCount']=isNaN(_0x9c1076[_0x4c29('0x6d')])?null:_0x9c1076[_0x4c29('0x6d')];_0xa86b49[_0x4c29('0x6e')]=isNaN(_0x9c1076['bitRate'])?null:_0x9c1076[_0x4c29('0x6f')];_0xa86b49[_0x4c29('0x70')]=isNaN(_0x9c1076[_0x4c29('0x71')])?null:_0x9c1076['sampleRate'];});_0x3e29c4['on'](_0x4c29('0x72'),function(_0x46b142){_0xa86b49[_0x4c29('0x73')]=isNaN(_0x46b142[_0x4c29('0x6b')])?null:_0x46b142['duration']*0x3e8;_0xa86b49[_0x4c29('0x74')]=isNaN(_0x46b142[_0x4c29('0x6c')])?null:_0x46b142[_0x4c29('0x6c')];_0xa86b49[_0x4c29('0x75')]=isNaN(_0x46b142[_0x4c29('0x6d')])?null:_0x46b142['channelCount'];_0xa86b49['converted_bitRate']=isNaN(_0x46b142[_0x4c29('0x6f')])?null:_0x46b142['bitRate'];_0xa86b49['converted_sampleRate']=isNaN(_0x46b142[_0x4c29('0x71')])?null:_0x46b142[_0x4c29('0x71')];});_0x3e29c4['on'](_0x4c29('0x27'),function(){fs[_0x4c29('0x64')](_0x511877,parseInt('0777',0x8));return db['Sound'][_0x4c29('0x58')](_0xa86b49)[_0x4c29('0x24')](function(_0x5b1bf8){var _0x46f8ba={'role':_0x550852[_0x4c29('0x76')][_0x4c29('0x77')],'userProfileId':_0x550852['body']['userProfileId']};if(!_0x46f8ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46f8ba[_0x4c29('0x77')]==='user'){var _0x33a96e=_0x5b1bf8[_0x4c29('0x25')]({'plain':!![]});return db[_0x4c29('0x78')][_0x4c29('0x4a')]({'where':{'name':_0x4c29('0x26'),'userProfileId':_0x46f8ba[_0x4c29('0x79')]},'raw':!![]})[_0x4c29('0x24')](function(_0x3089d4){if(_0x3089d4&&_0x3089d4[_0x4c29('0x7a')]===0x0){return db[_0x4c29('0x7b')][_0x4c29('0x58')]({'name':_0x33a96e['name'],'resourceId':_0x33a96e['id'],'type':_0x3089d4['name'],'sectionId':_0x3089d4['id']},{})['then'](function(){return _0x5b1bf8;});}else{return _0x5b1bf8;}})[_0x4c29('0x48')](function(_0x4b62a6){logger[_0x4c29('0x28')](_0x4c29('0x7c'),_0x4b62a6);throw _0x4b62a6;});}return _0x5b1bf8;})[_0x4c29('0x24')](respondWithResult(_0x583034,null))[_0x4c29('0x48')](handleError(_0x583034,null));});_0x3e29c4['start']();}catch(_0xbc1000){_0x583034[_0x4c29('0x19')](0x1f4)[_0x4c29('0x68')](_0xbc1000);}};exports[_0x4c29('0x22')]=function(_0x50104f,_0x49e249,_0x1affae){return db[_0x4c29('0x2c')][_0x4c29('0x4a')]({'where':{'id':_0x50104f[_0x4c29('0x4c')]['id']}})[_0x4c29('0x24')](handleEntityNotFound(_0x49e249,null))[_0x4c29('0x24')](saveUpdates(_['pick'](_0x50104f['body'],[_0x4c29('0x2a'),'description']),null))[_0x4c29('0x24')](respondWithResult(_0x49e249,null))[_0x4c29('0x48')](handleError(_0x49e249,null));};exports[_0x4c29('0x7d')]=function(_0x43d60a,_0x41ba49,_0x3606de){return db[_0x4c29('0x2c')]['find']({'where':{'id':_0x43d60a[_0x4c29('0x4c')]['id']}})[_0x4c29('0x24')](function(_0x172df3){if(_0x172df3){return _0x172df3[_0x4c29('0x23')]();}})[_0x4c29('0x24')](function(_0x124248){var _0x3aaa75=path['join'](config['root'],_0x4c29('0x60'),util['format'](_0x4c29('0x57'),_0x124248[_0x4c29('0x51')],_0x124248[_0x4c29('0x7e')]));var _0x1f5727=path[_0x4c29('0x4e')](config[_0x4c29('0x4f')],_0x4c29('0x50'),util['format'](_0x4c29('0x57'),_0x124248[_0x4c29('0x51')],_0x124248[_0x4c29('0x52')]));fs[_0x4c29('0x67')](_0x3aaa75);fs[_0x4c29('0x67')](_0x1f5727);return _0x124248;})[_0x4c29('0x24')](function(_0x84e2c2){if(_0x84e2c2){return _0x41ba49[_0x4c29('0x19')](0xcc)[_0x4c29('0x27')]();}})[_0x4c29('0x24')](handleEntityNotFound(_0x41ba49,null))['catch'](handleError(_0x41ba49,null));}; \ No newline at end of file +var _0x4cb7=['converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','Sound','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','download','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','save_name','format','converted_format','file','originalname','extname','basename','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','send','src','duration','sampleCount','original_channelCount','channelCount'];(function(_0xdeffe6,_0x198150){var _0x5baeb=function(_0x51e1c5){while(--_0x51e1c5){_0xdeffe6['push'](_0xdeffe6['shift']());}};_0x5baeb(++_0x198150);}(_0x4cb7,0x8b));var _0x74cb=function(_0x56ebcf,_0x15423d){_0x56ebcf=_0x56ebcf-0x0;var _0x5ba88a=_0x4cb7[_0x56ebcf];return _0x5ba88a;};'use strict';var emlformat=require(_0x74cb('0x0'));var rimraf=require(_0x74cb('0x1'));var zipdir=require(_0x74cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x74cb('0x3'));var BPromise=require(_0x74cb('0x4'));var Mustache=require(_0x74cb('0x5'));var util=require(_0x74cb('0x6'));var path=require(_0x74cb('0x7'));var sox=require(_0x74cb('0x8'));var csv=require(_0x74cb('0x9'));var ejs=require(_0x74cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74cb('0xb'));var squel=require(_0x74cb('0xc'));var crypto=require(_0x74cb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74cb('0x9'));var querystring=require(_0x74cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x74cb('0xf'));var authService=require(_0x74cb('0x10'));var qs=require(_0x74cb('0x11'));var as=require(_0x74cb('0x12'));var hardwareService=require(_0x74cb('0x13'));var logger=require(_0x74cb('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x74cb('0x15'));var db=require(_0x74cb('0x16'))['db'];function respondWithStatusCode(_0x4b62ef,_0x29ad3f){_0x29ad3f=_0x29ad3f||0xcc;return function(_0x4e8e03){if(_0x4e8e03){return _0x4b62ef['sendStatus'](_0x29ad3f);}return _0x4b62ef[_0x74cb('0x17')](_0x29ad3f)[_0x74cb('0x18')]();};}function respondWithResult(_0x3e5157,_0x111a9c){_0x111a9c=_0x111a9c||0xc8;return function(_0x4f4af4){if(_0x4f4af4){return _0x3e5157['status'](_0x111a9c)['json'](_0x4f4af4);}};}function respondWithFilteredResult(_0x253e16,_0x214670){return function(_0x56228e){if(_0x56228e){var _0x3b7569=typeof _0x214670[_0x74cb('0x19')]===_0x74cb('0x1a')&&typeof _0x214670[_0x74cb('0x1b')]===_0x74cb('0x1a');var _0x274de=_0x56228e[_0x74cb('0x1c')];var _0x1ae24e=_0x3b7569?0x0:_0x214670['offset'];var _0x3cfdec=_0x3b7569?_0x56228e['count']:_0x214670['offset']+_0x214670['limit'];var _0xf2ed5a;if(_0x3cfdec>=_0x274de){_0x3cfdec=_0x274de;_0xf2ed5a=0xc8;}else{_0xf2ed5a=0xce;}_0x253e16[_0x74cb('0x17')](_0xf2ed5a);return _0x253e16[_0x74cb('0x1d')](_0x74cb('0x1e'),_0x1ae24e+'-'+_0x3cfdec+'/'+_0x274de)['json'](_0x56228e);}return null;};}function patchUpdates(_0x1f0ef2){return function(_0x390546){try{jsonpatch['apply'](_0x390546,_0x1f0ef2,!![]);}catch(_0x58c26d){return BPromise['reject'](_0x58c26d);}return _0x390546[_0x74cb('0x1f')]();};}function saveUpdates(_0x2758ae,_0x138607){return function(_0x460580){if(_0x460580){return _0x460580[_0x74cb('0x20')](_0x2758ae)[_0x74cb('0x21')](function(_0x28541d){return _0x28541d;});}return null;};}function removeEntity(_0x257782,_0xfdc262){return function(_0x57fd9f){if(_0x57fd9f){return _0x57fd9f[_0x74cb('0x22')]()[_0x74cb('0x21')](function(){var _0x1a982c=_0x57fd9f[_0x74cb('0x23')]({'plain':!![]});var _0x2ce217=_0x74cb('0x24');return db[_0x74cb('0x25')][_0x74cb('0x22')]({'where':{'type':_0x2ce217,'resourceId':_0x1a982c['id']}})[_0x74cb('0x21')](function(){return _0x57fd9f;});})[_0x74cb('0x21')](function(){_0x257782[_0x74cb('0x17')](0xcc)[_0x74cb('0x18')]();});}};}function handleEntityNotFound(_0xf57509,_0x533de2){return function(_0x10e0a1){if(!_0x10e0a1){_0xf57509[_0x74cb('0x26')](0x194);}return _0x10e0a1;};}function handleError(_0xe03e5d,_0x10724f){_0x10724f=_0x10724f||0x1f4;return function(_0xc52ec0){logger[_0x74cb('0x27')](_0xc52ec0[_0x74cb('0x28')]);if(_0xc52ec0[_0x74cb('0x29')]){delete _0xc52ec0[_0x74cb('0x29')];}_0xe03e5d['status'](_0x10724f)['send'](_0xc52ec0);};}exports['index']=function(_0x42a4e8,_0x5ae6b2){var _0x1dab99={},_0x49aaea={},_0x26c463={'count':0x0,'rows':[]};var _0x494aeb=_['map'](db[_0x74cb('0x2a')][_0x74cb('0x2b')],function(_0x127cc1){return{'name':_0x127cc1[_0x74cb('0x2c')],'type':_0x127cc1[_0x74cb('0x2d')][_0x74cb('0x2e')]};});_0x49aaea['model']=_[_0x74cb('0x2f')](_0x494aeb,_0x74cb('0x29'));_0x49aaea[_0x74cb('0x30')]=_[_0x74cb('0x31')](_0x42a4e8[_0x74cb('0x30')]);_0x49aaea[_0x74cb('0x32')]=_['intersection'](_0x49aaea[_0x74cb('0x33')],_0x49aaea[_0x74cb('0x30')]);_0x1dab99[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x49aaea[_0x74cb('0x33')],qs[_0x74cb('0x36')](_0x42a4e8['query'][_0x74cb('0x36')]));_0x1dab99[_0x74cb('0x34')]=_0x1dab99['attributes'][_0x74cb('0x37')]?_0x1dab99['attributes']:_0x49aaea[_0x74cb('0x33')];if(!_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x38')]('nolimit')){_0x1dab99[_0x74cb('0x1b')]=qs[_0x74cb('0x1b')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x1b')]);_0x1dab99[_0x74cb('0x19')]=qs[_0x74cb('0x19')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x19')]);}_0x1dab99[_0x74cb('0x39')]=qs[_0x74cb('0x3a')](_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3a')]);_0x1dab99['where']=qs[_0x74cb('0x32')](_[_0x74cb('0x3b')](_0x42a4e8[_0x74cb('0x30')],_0x49aaea['filters']),_0x494aeb);if(_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3c')]){_0x1dab99[_0x74cb('0x3d')]=_[_0x74cb('0x3e')](_0x1dab99['where'],{'$or':_[_0x74cb('0x2f')](_0x494aeb,function(_0x2c6736){if(_0x2c6736[_0x74cb('0x2d')]!==_0x74cb('0x3f')){var _0x4dbda6={};_0x4dbda6[_0x2c6736['name']]={'$like':'%'+_0x42a4e8[_0x74cb('0x30')][_0x74cb('0x3c')]+'%'};return _0x4dbda6;}})});}_0x1dab99=_[_0x74cb('0x3e')]({},_0x1dab99,_0x42a4e8[_0x74cb('0x40')]);var _0x3af50d={'where':_0x1dab99['where']};return db[_0x74cb('0x2a')][_0x74cb('0x1c')](_0x3af50d)[_0x74cb('0x21')](function(_0x83119a){_0x26c463[_0x74cb('0x1c')]=_0x83119a;if(_0x42a4e8[_0x74cb('0x30')]['includeAll']){_0x1dab99[_0x74cb('0x41')]=[{'all':!![]}];}return db[_0x74cb('0x2a')][_0x74cb('0x42')](_0x1dab99);})[_0x74cb('0x21')](function(_0x54af86){_0x26c463[_0x74cb('0x43')]=_0x54af86;return _0x26c463;})[_0x74cb('0x21')](respondWithFilteredResult(_0x5ae6b2,_0x1dab99))[_0x74cb('0x44')](handleError(_0x5ae6b2,null));};exports[_0x74cb('0x45')]=function(_0x60aae4,_0x35265b){var _0x2aa7e2={'raw':!![],'where':{'id':_0x60aae4[_0x74cb('0x46')]['id']}},_0x4cf832={};_0x4cf832[_0x74cb('0x33')]=_[_0x74cb('0x31')](db[_0x74cb('0x2a')]['rawAttributes']);_0x4cf832[_0x74cb('0x30')]=_[_0x74cb('0x31')](_0x60aae4[_0x74cb('0x30')]);_0x4cf832[_0x74cb('0x32')]=_[_0x74cb('0x35')](_0x4cf832['model'],_0x4cf832[_0x74cb('0x30')]);_0x2aa7e2[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x4cf832[_0x74cb('0x33')],qs[_0x74cb('0x36')](_0x60aae4['query'][_0x74cb('0x36')]));_0x2aa7e2[_0x74cb('0x34')]=_0x2aa7e2[_0x74cb('0x34')][_0x74cb('0x37')]?_0x2aa7e2[_0x74cb('0x34')]:_0x4cf832['model'];if(_0x60aae4['query'][_0x74cb('0x47')]){_0x2aa7e2[_0x74cb('0x41')]=[{'all':!![]}];}_0x2aa7e2=_['merge']({},_0x2aa7e2,_0x60aae4['options']);return db[_0x74cb('0x2a')][_0x74cb('0x48')](_0x2aa7e2)['then'](handleEntityNotFound(_0x35265b,null))[_0x74cb('0x21')](respondWithResult(_0x35265b,null))[_0x74cb('0x44')](handleError(_0x35265b,null));};exports[_0x74cb('0x49')]=function(_0x353b76,_0x4d297c,_0x4606a5){return db[_0x74cb('0x2a')]['find']({'where':{'id':_0x353b76[_0x74cb('0x46')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x74cb('0x21')](handleEntityNotFound(_0x4d297c,null))[_0x74cb('0x21')](function(_0x3ef3f9){if(_0x3ef3f9){if(!fs['existsSync'](path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),_0x3ef3f9['save_name']+'.'+_0x3ef3f9['converted_format']))){throw new db[(_0x74cb('0x4d'))][(_0x74cb('0x4e'))](_0x74cb('0x4f'));}return _0x4d297c[_0x74cb('0x49')](path[_0x74cb('0x4a')](config['root'],_0x74cb('0x4c'),util['format'](_0x74cb('0x50'),_0x3ef3f9[_0x74cb('0x51')],_0x3ef3f9['converted_format'])),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x3ef3f9[_0x74cb('0x29')],_0x3ef3f9[_0x74cb('0x53')]));}return null;})['catch'](handleError(_0x4d297c,null));};exports['create']=function(_0x2626d8,_0x119917,_0x4d46f4){var _0x11c87a={'name':path['basename'](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x55')],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x55')])),'save_name':path[_0x74cb('0x57')](_0x2626d8[_0x74cb('0x54')]['filename'],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')])),'original_format':path['extname'](_0x2626d8[_0x74cb('0x54')]['originalname'])[_0x74cb('0x59')](0x1),'converted_format':'wav'};var _0x4c7e16=path['join'](config[_0x74cb('0x4b')],_0x74cb('0x5a'),_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')]);var _0x903e04=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),util['format']('%s.%s',path['basename'](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')],path[_0x74cb('0x56')](_0x2626d8[_0x74cb('0x54')][_0x74cb('0x58')])),_0x11c87a[_0x74cb('0x53')]));logger[_0x74cb('0x5b')](_0x74cb('0x5c'),_0x4c7e16);logger['info'](_0x74cb('0x5d'),_0x903e04);try{fs[_0x74cb('0x5e')](_0x4c7e16,parseInt(_0x74cb('0x5f'),0x8));var _0x437b4a=sox[_0x74cb('0x60')](_0x4c7e16,_0x903e04,{'sampleRate':0x1f40,'format':_0x74cb('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x437b4a['on'](_0x74cb('0x27'),function(_0x479025){fs[_0x74cb('0x62')](_0x4c7e16);_0x119917['status'](0x1f4)[_0x74cb('0x63')](_0x479025);});_0x437b4a['on'](_0x74cb('0x64'),function(_0x47439d){_0x11c87a['original_duration']=isNaN(_0x47439d[_0x74cb('0x65')])?null:_0x47439d[_0x74cb('0x65')]*0x3e8;_0x11c87a['original_sampleCount']=isNaN(_0x47439d['sampleCount'])?null:_0x47439d[_0x74cb('0x66')];_0x11c87a[_0x74cb('0x67')]=isNaN(_0x47439d['channelCount'])?null:_0x47439d[_0x74cb('0x68')];_0x11c87a['original_bitRate']=isNaN(_0x47439d['bitRate'])?null:_0x47439d['bitRate'];_0x11c87a['original_sampleRate']=isNaN(_0x47439d['sampleRate'])?null:_0x47439d['sampleRate'];});_0x437b4a['on']('dest',function(_0x141f97){_0x11c87a[_0x74cb('0x69')]=isNaN(_0x141f97[_0x74cb('0x65')])?null:_0x141f97['duration']*0x3e8;_0x11c87a[_0x74cb('0x6a')]=isNaN(_0x141f97[_0x74cb('0x66')])?null:_0x141f97[_0x74cb('0x66')];_0x11c87a[_0x74cb('0x6b')]=isNaN(_0x141f97[_0x74cb('0x68')])?null:_0x141f97[_0x74cb('0x68')];_0x11c87a[_0x74cb('0x6c')]=isNaN(_0x141f97[_0x74cb('0x6d')])?null:_0x141f97[_0x74cb('0x6d')];_0x11c87a[_0x74cb('0x6e')]=isNaN(_0x141f97[_0x74cb('0x6f')])?null:_0x141f97['sampleRate'];});_0x437b4a['on']('end',function(){fs[_0x74cb('0x5e')](_0x903e04,parseInt('0777',0x8));return db['Sound'][_0x74cb('0x70')](_0x11c87a)['then'](function(_0x2ce030){var _0x4fab6c={'role':_0x2626d8[_0x74cb('0x71')][_0x74cb('0x72')],'userProfileId':_0x2626d8['body']['userProfileId']};if(!_0x4fab6c)throw new Error(_0x74cb('0x73'));if(_0x4fab6c[_0x74cb('0x72')]==='user'){var _0x42547b=_0x2ce030[_0x74cb('0x23')]({'plain':!![]});return db[_0x74cb('0x74')][_0x74cb('0x48')]({'where':{'name':_0x74cb('0x24'),'userProfileId':_0x4fab6c[_0x74cb('0x75')]},'raw':!![]})[_0x74cb('0x21')](function(_0x25b5cf){if(_0x25b5cf&&_0x25b5cf['autoAssociation']===0x0){return db[_0x74cb('0x25')][_0x74cb('0x70')]({'name':_0x42547b[_0x74cb('0x29')],'resourceId':_0x42547b['id'],'type':_0x25b5cf['name'],'sectionId':_0x25b5cf['id']},{})['then'](function(){return _0x2ce030;});}else{return _0x2ce030;}})[_0x74cb('0x44')](function(_0xe35646){logger['error'](_0x74cb('0x76'),_0xe35646);throw _0xe35646;});}return _0x2ce030;})[_0x74cb('0x21')](respondWithResult(_0x119917,null))['catch'](handleError(_0x119917,null));});_0x437b4a[_0x74cb('0x77')]();}catch(_0x267875){_0x119917[_0x74cb('0x17')](0x1f4)[_0x74cb('0x63')](_0x267875);}};exports[_0x74cb('0x20')]=function(_0x46f3db,_0x3cf995,_0x1e414f){return db[_0x74cb('0x2a')][_0x74cb('0x48')]({'where':{'id':_0x46f3db['params']['id']}})[_0x74cb('0x21')](handleEntityNotFound(_0x3cf995,null))['then'](saveUpdates(_[_0x74cb('0x3b')](_0x46f3db['body'],[_0x74cb('0x29'),_0x74cb('0x78')]),null))[_0x74cb('0x21')](respondWithResult(_0x3cf995,null))[_0x74cb('0x44')](handleError(_0x3cf995,null));};exports[_0x74cb('0x79')]=function(_0x4926b4,_0x1aa977,_0x26dab8){return db['Sound'][_0x74cb('0x48')]({'where':{'id':_0x4926b4[_0x74cb('0x46')]['id']}})['then'](function(_0xfbdd6b){if(_0xfbdd6b){return _0xfbdd6b['destroy']();}})[_0x74cb('0x21')](function(_0x1543e8){var _0x51acf7=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x5a'),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x1543e8[_0x74cb('0x51')],_0x1543e8['original_format']));var _0x47f826=path[_0x74cb('0x4a')](config[_0x74cb('0x4b')],_0x74cb('0x4c'),util[_0x74cb('0x52')](_0x74cb('0x50'),_0x1543e8[_0x74cb('0x51')],_0x1543e8['converted_format']));fs['unlinkSync'](_0x51acf7);fs[_0x74cb('0x62')](_0x47f826);return _0x1543e8;})[_0x74cb('0x21')](function(_0x4640b6){if(_0x4640b6){return _0x1aa977['status'](0xcc)[_0x74cb('0x18')]();}})[_0x74cb('0x21')](handleEntityNotFound(_0x1aa977,null))['catch'](handleError(_0x1aa977,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a51e654..d853d3b 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 _0x0aab=['exports','define','Sound','tools_sounds','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0x0aab,0xa0));var _0xb0aa=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x0aab[_0x41cfd4];return _0x190f48;};'use strict';var _=require(_0xb0aa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0aa('0x1'));var moment=require(_0xb0aa('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0aa('0x3'));var fs=require('fs');var path=require(_0xb0aa('0x4'));var rimraf=require(_0xb0aa('0x5'));var config=require(_0xb0aa('0x6'));var attributes=require(_0xb0aa('0x7'));module[_0xb0aa('0x8')]=function(_0x466ced,_0x11fb2d){return _0x466ced[_0xb0aa('0x9')](_0xb0aa('0xa'),attributes,{'tableName':_0xb0aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x2ac193,_0x313650){var _0x10e2dc=function(_0x4003e0){while(--_0x4003e0){_0x2ac193['push'](_0x2ac193['shift']());}};_0x10e2dc(++_0x313650);}(_0x9db5,0xf4));var _0x59db=function(_0x1131a5,_0x263b45){_0x1131a5=_0x1131a5-0x0;var _0x4af3cb=_0x9db5[_0x1131a5];return _0x4af3cb;};'use strict';var _=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var logger=require(_0x59db('0x2'))(_0x59db('0x3'));var moment=require(_0x59db('0x4'));var BPromise=require(_0x59db('0x5'));var rp=require(_0x59db('0x6'));var fs=require('fs');var path=require(_0x59db('0x7'));var rimraf=require(_0x59db('0x8'));var config=require(_0x59db('0x9'));var attributes=require('./sound.attributes');module['exports']=function(_0x1fab55,_0x18f56c){return _0x1fab55[_0x59db('0xa')](_0x59db('0xb'),attributes,{'tableName':_0x59db('0xc'),'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 f5c5c59..a828d57 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 _0xe89b=['catch','find','where','options','attributes','include','map','model','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result'];(function(_0x66f455,_0x43978d){var _0x2f4d67=function(_0x5cc247){while(--_0x5cc247){_0x66f455['push'](_0x66f455['shift']());}};_0x2f4d67(++_0x43978d);}(_0xe89b,0x120));var _0xbe89=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe89b[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xbe89('0x0'));var util=require('util');var moment=require(_0xbe89('0x1'));var BPromise=require(_0xbe89('0x2'));var rs=require(_0xbe89('0x3'));var fs=require('fs');var Redis=require(_0xbe89('0x4'));var db=require(_0xbe89('0x5'))['db'];var utils=require(_0xbe89('0x6'));var logger=require(_0xbe89('0x7'))(_0xbe89('0x8'));var config=require(_0xbe89('0x9'));var jayson=require(_0xbe89('0xa'));var client=jayson[_0xbe89('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6e992,_0x4ac744,_0x4d710e){return new BPromise(function(_0x3921fa,_0x3e3fc7){return client['request'](_0xd6e992,_0x4d710e)[_0xbe89('0xc')](function(_0x12460a){logger[_0xbe89('0xd')]('Sound,\x20%s,\x20%s',_0x4ac744,_0xbe89('0xe'));logger[_0xbe89('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x4ac744,'request\x20sent',JSON[_0xbe89('0x10')](_0x12460a));if(_0x12460a['error']){if(_0x12460a[_0xbe89('0x11')][_0xbe89('0x12')]===0x1f4){logger['error'](_0xbe89('0x13'),_0x4ac744,_0x12460a[_0xbe89('0x11')][_0xbe89('0x14')]);return _0x3e3fc7(_0x12460a[_0xbe89('0x11')]['message']);}logger['error'](_0xbe89('0x13'),_0x4ac744,_0x12460a['error'][_0xbe89('0x14')]);return _0x3921fa(_0x12460a[_0xbe89('0x11')][_0xbe89('0x14')]);}else{logger['info'](_0xbe89('0x13'),_0x4ac744,'request\x20sent');_0x3921fa(_0x12460a[_0xbe89('0x15')]['message']);}})[_0xbe89('0x16')](function(_0x38e1a0){logger[_0xbe89('0x11')]('Sound,\x20%s,\x20%s',_0x4ac744,_0x38e1a0);_0x3e3fc7(_0x38e1a0);});});}exports['ShowSound']=function(_0x2c59d4){var _0x38cc1f=this;return new Promise(function(_0x3ca4a1,_0x4cae35){return db['Sound'][_0xbe89('0x17')]({'raw':_0x2c59d4['options']?_0x2c59d4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c59d4['options']?_0x2c59d4['options'][_0xbe89('0x18')]||null:null,'attributes':_0x2c59d4[_0xbe89('0x19')]?_0x2c59d4[_0xbe89('0x19')][_0xbe89('0x1a')]||null:null,'include':_0x2c59d4[_0xbe89('0x19')]?_0x2c59d4[_0xbe89('0x19')]['include']?_['map'](_0x2c59d4[_0xbe89('0x19')][_0xbe89('0x1b')],function(_0x3e9dcf){return{'model':db[_0x3e9dcf['model']],'as':_0x3e9dcf['as'],'attributes':_0x3e9dcf['attributes'],'include':_0x3e9dcf[_0xbe89('0x1b')]?_[_0xbe89('0x1c')](_0x3e9dcf['include'],function(_0x1bd07a){return{'model':db[_0x1bd07a[_0xbe89('0x1d')]],'as':_0x1bd07a['as'],'attributes':_0x1bd07a['attributes'],'include':_0x1bd07a[_0xbe89('0x1b')]?_[_0xbe89('0x1c')](_0x1bd07a[_0xbe89('0x1b')],function(_0x215294){return{'model':db[_0x215294['model']],'as':_0x215294['as'],'attributes':_0x215294[_0xbe89('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbe89('0xc')](function(_0x511441){logger[_0xbe89('0xd')](_0xbe89('0x1e'),_0x2c59d4);logger[_0xbe89('0xf')](_0xbe89('0x1e'),_0x2c59d4,JSON[_0xbe89('0x10')](_0x511441));_0x3ca4a1(_0x511441);})[_0xbe89('0x16')](function(_0x27b94f){logger[_0xbe89('0x11')](_0xbe89('0x1e'),_0x27b94f[_0xbe89('0x14')],_0x2c59d4);_0x4cae35(_0x38cc1f['error'](0x1f4,_0x27b94f[_0xbe89('0x14')]));});});}; \ No newline at end of file +var _0x00db=['ShowSound','Sound','options','raw','where','attributes','map','model','include','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x00db,0x166));var _0xb00d=function(_0x5cdb47,_0x1e43d6){_0x5cdb47=_0x5cdb47-0x0;var _0x5c5e2b=_0x00db[_0x5cdb47];return _0x5c5e2b;};'use strict';var _=require('lodash');var util=require(_0xb00d('0x0'));var moment=require(_0xb00d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb00d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb00d('0x3'))(_0xb00d('0x4'));var config=require(_0xb00d('0x5'));var jayson=require(_0xb00d('0x6'));var client=jayson['client'][_0xb00d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x284ea7,_0x45b616,_0x3ce941){return new BPromise(function(_0x3b9f8a,_0x17c87f){return client[_0xb00d('0x8')](_0x284ea7,_0x3ce941)[_0xb00d('0x9')](function(_0x56a9cd){logger[_0xb00d('0xa')](_0xb00d('0xb'),_0x45b616,_0xb00d('0xc'));logger[_0xb00d('0xd')](_0xb00d('0xe'),_0x45b616,'request\x20sent',JSON[_0xb00d('0xf')](_0x56a9cd));if(_0x56a9cd[_0xb00d('0x10')]){if(_0x56a9cd[_0xb00d('0x10')]['code']===0x1f4){logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);return _0x17c87f(_0x56a9cd['error'][_0xb00d('0x11')]);}logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);return _0x3b9f8a(_0x56a9cd[_0xb00d('0x10')][_0xb00d('0x11')]);}else{logger[_0xb00d('0xa')](_0xb00d('0xb'),_0x45b616,_0xb00d('0xc'));_0x3b9f8a(_0x56a9cd[_0xb00d('0x12')]['message']);}})['catch'](function(_0x45f127){logger[_0xb00d('0x10')](_0xb00d('0xb'),_0x45b616,_0x45f127);_0x17c87f(_0x45f127);});});}exports[_0xb00d('0x13')]=function(_0x1fa748){var _0xd62938=this;return new Promise(function(_0x2c9a70,_0x5c16ea){return db[_0xb00d('0x14')]['find']({'raw':_0x1fa748[_0xb00d('0x15')]?_0x1fa748[_0xb00d('0x15')][_0xb00d('0x16')]===undefined?!![]:![]:!![],'where':_0x1fa748[_0xb00d('0x15')]?_0x1fa748['options'][_0xb00d('0x17')]||null:null,'attributes':_0x1fa748['options']?_0x1fa748['options'][_0xb00d('0x18')]||null:null,'include':_0x1fa748[_0xb00d('0x15')]?_0x1fa748[_0xb00d('0x15')]['include']?_[_0xb00d('0x19')](_0x1fa748[_0xb00d('0x15')]['include'],function(_0x548cb8){return{'model':db[_0x548cb8[_0xb00d('0x1a')]],'as':_0x548cb8['as'],'attributes':_0x548cb8['attributes'],'include':_0x548cb8[_0xb00d('0x1b')]?_['map'](_0x548cb8[_0xb00d('0x1b')],function(_0x22fe53){return{'model':db[_0x22fe53['model']],'as':_0x22fe53['as'],'attributes':_0x22fe53['attributes'],'include':_0x22fe53['include']?_[_0xb00d('0x19')](_0x22fe53[_0xb00d('0x1b')],function(_0x11dce4){return{'model':db[_0x11dce4[_0xb00d('0x1a')]],'as':_0x11dce4['as'],'attributes':_0x11dce4[_0xb00d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb00d('0x9')](function(_0x7b9d6f){logger[_0xb00d('0xa')]('ShowSound',_0x1fa748);logger[_0xb00d('0xd')](_0xb00d('0x13'),_0x1fa748,JSON[_0xb00d('0xf')](_0x7b9d6f));_0x2c9a70(_0x7b9d6f);})[_0xb00d('0x1c')](function(_0x58d134){logger[_0xb00d('0x10')](_0xb00d('0x13'),_0x58d134[_0xb00d('0x11')],_0x1fa748);_0x5c16ea(_0xd62938[_0xb00d('0x10')](0x1f4,_0x58d134[_0xb00d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ed06c7e..a879184 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x8603,0x190));var _0x3860=function(_0x1b6117,_0x39f1e5){_0x1b6117=_0x1b6117-0x0;var _0x8fa76c=_0x8603[_0x1b6117];return _0x8fa76c;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x35d294,_0x3a9b4){var _0xb9ae9a=function(_0x3c08ce){while(--_0x3c08ce){_0x35d294['push'](_0x35d294['shift']());}};_0xb9ae9a(++_0x3a9b4);}(_0x2032,0xd9));var _0x2203=function(_0x3c29ac,_0x278e96){_0x3c29ac=_0x3c29ac-0x0;var _0x4320d0=_0x2032[_0x3c29ac];return _0x4320d0;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('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 b1588e2..36813e7 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 _0x9bb3=['STRING','sequelize','exports','TEXT','medium','out'];(function(_0x17c0a3,_0x1fdacf){var _0x21eb98=function(_0x516dfc){while(--_0x516dfc){_0x17c0a3['push'](_0x17c0a3['shift']());}};_0x21eb98(++_0x1fdacf);}(_0x9bb3,0xdf));var _0x39bb=function(_0x262d5b,_0x1f96e6){_0x262d5b=_0x262d5b-0x0;var _0x67f684=_0x9bb3[_0x262d5b];return _0x67f684;};'use strict';var Sequelize=require(_0x39bb('0x0'));module[_0x39bb('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x39bb('0x2')](_0x39bb('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x39bb('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x39bb('0x5')]},'providerResponse':{'type':Sequelize[_0x39bb('0x2')]}}; \ No newline at end of file +var _0xde49=['TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x2a64ab,_0x3ad8bc){var _0x289b69=function(_0x3eb6b3){while(--_0x3eb6b3){_0x2a64ab['push'](_0x2a64ab['shift']());}};_0x289b69(++_0x3ad8bc);}(_0xde49,0xbe));var _0x9de4=function(_0xe25d87,_0x391229){_0xe25d87=_0xe25d87-0x0;var _0x199807=_0xde49[_0xe25d87];return _0x199807;};'use strict';var Sequelize=require(_0x9de4('0x0'));module[_0x9de4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x9de4('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x9de4('0x3')]('in',_0x9de4('0x4')),'defaultValue':_0x9de4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9de4('0x5')]},'providerResponse':{'type':Sequelize[_0x9de4('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e26ca49..b5a6bfd 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 _0xb7d6=['crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','catch','show','params','rawAttributes','includeAll','find','create','body','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x49d88d,_0x41934c){var _0x2702f5=function(_0x49375e){while(--_0x49375e){_0x49d88d['push'](_0x49d88d['shift']());}};_0x2702f5(++_0x41934c);}(_0xb7d6,0xca));var _0x6b7d=function(_0x14fedc,_0x36a213){_0x14fedc=_0x14fedc-0x0;var _0x538f1f=_0xb7d6[_0x14fedc];return _0x538f1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b7d('0x0'));var rp=require(_0x6b7d('0x1'));var moment=require(_0x6b7d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6b7d('0x3'));var util=require(_0x6b7d('0x4'));var path=require(_0x6b7d('0x5'));var sox=require(_0x6b7d('0x6'));var csv=require('to-csv');var ejs=require(_0x6b7d('0x7'));var fs=require('fs');var fs_extra=require(_0x6b7d('0x8'));var _=require(_0x6b7d('0x9'));var squel=require(_0x6b7d('0xa'));var crypto=require(_0x6b7d('0xb'));var jsforce=require(_0x6b7d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6b7d('0xd'));var querystring=require(_0x6b7d('0xe'));var Papa=require(_0x6b7d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b7d('0x10'));var hardwareService=require(_0x6b7d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6b7d('0x12'));var config=require(_0x6b7d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b7d('0x14'))['db'];function respondWithStatusCode(_0x136ea4,_0x502606){_0x502606=_0x502606||0xcc;return function(_0x54c4ca){if(_0x54c4ca){return _0x136ea4[_0x6b7d('0x15')](_0x502606);}return _0x136ea4[_0x6b7d('0x16')](_0x502606)[_0x6b7d('0x17')]();};}function respondWithResult(_0x3051ad,_0xb56366){_0xb56366=_0xb56366||0xc8;return function(_0x3d7fe5){if(_0x3d7fe5){return _0x3051ad[_0x6b7d('0x16')](_0xb56366)[_0x6b7d('0x18')](_0x3d7fe5);}};}function respondWithFilteredResult(_0xc34722,_0x524d8a){return function(_0x2e9177){if(_0x2e9177){var _0x556d15=typeof _0x524d8a[_0x6b7d('0x19')]===_0x6b7d('0x1a')&&typeof _0x524d8a[_0x6b7d('0x1b')]==='undefined';var _0x8d78b4=_0x2e9177[_0x6b7d('0x1c')];var _0xd6d3e9=_0x556d15?0x0:_0x524d8a[_0x6b7d('0x19')];var _0x3d67b6=_0x556d15?_0x2e9177[_0x6b7d('0x1c')]:_0x524d8a[_0x6b7d('0x19')]+_0x524d8a[_0x6b7d('0x1b')];var _0x30fedf;if(_0x3d67b6>=_0x8d78b4){_0x3d67b6=_0x8d78b4;_0x30fedf=0xc8;}else{_0x30fedf=0xce;}_0xc34722[_0x6b7d('0x16')](_0x30fedf);return _0xc34722[_0x6b7d('0x1d')](_0x6b7d('0x1e'),_0xd6d3e9+'-'+_0x3d67b6+'/'+_0x8d78b4)[_0x6b7d('0x18')](_0x2e9177);}return null;};}function patchUpdates(_0x3d695f){return function(_0x15c3a4){try{jsonpatch[_0x6b7d('0x1f')](_0x15c3a4,_0x3d695f,!![]);}catch(_0x5f12c5){return BPromise['reject'](_0x5f12c5);}return _0x15c3a4[_0x6b7d('0x20')]();};}function saveUpdates(_0x4f47fb,_0x257b60){return function(_0x466678){if(_0x466678){return _0x466678[_0x6b7d('0x21')](_0x4f47fb)[_0x6b7d('0x22')](function(_0x4d03ca){return _0x4d03ca;});}return null;};}function removeEntity(_0x12188b,_0x4e313a){return function(_0x260c03){if(_0x260c03){return _0x260c03[_0x6b7d('0x23')]()[_0x6b7d('0x22')](function(){_0x12188b[_0x6b7d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d92d,_0x3bae4e){return function(_0x38fec4){if(!_0x38fec4){_0x13d92d['sendStatus'](0x194);}return _0x38fec4;};}function handleError(_0x440016,_0x2701de){_0x2701de=_0x2701de||0x1f4;return function(_0xb370e7){logger[_0x6b7d('0x24')](_0xb370e7[_0x6b7d('0x25')]);if(_0xb370e7['name']){delete _0xb370e7[_0x6b7d('0x26')];}_0x440016[_0x6b7d('0x16')](_0x2701de)[_0x6b7d('0x27')](_0xb370e7);};}exports[_0x6b7d('0x28')]=function(_0xae3138,_0x2058e9){var _0x57b65b={},_0xcd58b0={},_0x137de5={'count':0x0,'rows':[]};var _0x2251ca=_[_0x6b7d('0x29')](db[_0x6b7d('0x2a')]['rawAttributes'],function(_0x26fbd2){return{'name':_0x26fbd2['fieldName'],'type':_0x26fbd2[_0x6b7d('0x2b')][_0x6b7d('0x2c')]};});_0xcd58b0['model']=_[_0x6b7d('0x29')](_0x2251ca,'name');_0xcd58b0[_0x6b7d('0x2d')]=_[_0x6b7d('0x2e')](_0xae3138[_0x6b7d('0x2d')]);_0xcd58b0[_0x6b7d('0x2f')]=_[_0x6b7d('0x30')](_0xcd58b0['model'],_0xcd58b0[_0x6b7d('0x2d')]);_0x57b65b[_0x6b7d('0x31')]=_[_0x6b7d('0x30')](_0xcd58b0[_0x6b7d('0x32')],qs['fields'](_0xae3138[_0x6b7d('0x2d')][_0x6b7d('0x33')]));_0x57b65b['attributes']=_0x57b65b[_0x6b7d('0x31')][_0x6b7d('0x34')]?_0x57b65b[_0x6b7d('0x31')]:_0xcd58b0[_0x6b7d('0x32')];if(!_0xae3138['query'][_0x6b7d('0x35')](_0x6b7d('0x36'))){_0x57b65b['limit']=qs['limit'](_0xae3138[_0x6b7d('0x2d')]['limit']);_0x57b65b[_0x6b7d('0x19')]=qs[_0x6b7d('0x19')](_0xae3138['query'][_0x6b7d('0x19')]);}_0x57b65b[_0x6b7d('0x37')]=qs[_0x6b7d('0x38')](_0xae3138[_0x6b7d('0x2d')][_0x6b7d('0x38')]);_0x57b65b['where']=qs[_0x6b7d('0x2f')](_[_0x6b7d('0x39')](_0xae3138[_0x6b7d('0x2d')],_0xcd58b0['filters']),_0x2251ca);if(_0xae3138[_0x6b7d('0x2d')][_0x6b7d('0x3a')]){_0x57b65b[_0x6b7d('0x3b')]=_['merge'](_0x57b65b[_0x6b7d('0x3b')],{'$or':_[_0x6b7d('0x29')](_0x2251ca,function(_0x170e35){if(_0x170e35[_0x6b7d('0x2b')]!=='VIRTUAL'){var _0x10a9eb={};_0x10a9eb[_0x170e35[_0x6b7d('0x26')]]={'$like':'%'+_0xae3138['query']['filter']+'%'};return _0x10a9eb;}})});}_0x57b65b=_[_0x6b7d('0x3c')]({},_0x57b65b,_0xae3138[_0x6b7d('0x3d')]);var _0x38e9e0={'where':_0x57b65b[_0x6b7d('0x3b')]};return db['SquareMessage'][_0x6b7d('0x1c')](_0x38e9e0)[_0x6b7d('0x22')](function(_0x309eff){_0x137de5[_0x6b7d('0x1c')]=_0x309eff;if(_0xae3138[_0x6b7d('0x2d')]['includeAll']){_0x57b65b[_0x6b7d('0x3e')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x57b65b);})[_0x6b7d('0x22')](function(_0x2066d1){_0x137de5['rows']=_0x2066d1;return _0x137de5;})[_0x6b7d('0x22')](respondWithFilteredResult(_0x2058e9,_0x57b65b))[_0x6b7d('0x3f')](handleError(_0x2058e9,null));};exports[_0x6b7d('0x40')]=function(_0x210c92,_0x3dca61){var _0x5b0bcc={'raw':!![],'where':{'id':_0x210c92[_0x6b7d('0x41')]['id']}},_0x5f1e86={};_0x5f1e86[_0x6b7d('0x32')]=_['keys'](db[_0x6b7d('0x2a')][_0x6b7d('0x42')]);_0x5f1e86[_0x6b7d('0x2d')]=_[_0x6b7d('0x2e')](_0x210c92['query']);_0x5f1e86[_0x6b7d('0x2f')]=_['intersection'](_0x5f1e86['model'],_0x5f1e86['query']);_0x5b0bcc[_0x6b7d('0x31')]=_[_0x6b7d('0x30')](_0x5f1e86[_0x6b7d('0x32')],qs[_0x6b7d('0x33')](_0x210c92['query'][_0x6b7d('0x33')]));_0x5b0bcc[_0x6b7d('0x31')]=_0x5b0bcc[_0x6b7d('0x31')][_0x6b7d('0x34')]?_0x5b0bcc[_0x6b7d('0x31')]:_0x5f1e86[_0x6b7d('0x32')];if(_0x210c92[_0x6b7d('0x2d')][_0x6b7d('0x43')]){_0x5b0bcc['include']=[{'all':!![]}];}_0x5b0bcc=_[_0x6b7d('0x3c')]({},_0x5b0bcc,_0x210c92[_0x6b7d('0x3d')]);return db[_0x6b7d('0x2a')][_0x6b7d('0x44')](_0x5b0bcc)[_0x6b7d('0x22')](handleEntityNotFound(_0x3dca61,null))['then'](respondWithResult(_0x3dca61,null))[_0x6b7d('0x3f')](handleError(_0x3dca61,null));};exports[_0x6b7d('0x45')]=function(_0x2a1579,_0x580375){return db[_0x6b7d('0x2a')][_0x6b7d('0x45')](_0x2a1579['body'],{})[_0x6b7d('0x22')](respondWithResult(_0x580375,0xc9))[_0x6b7d('0x3f')](handleError(_0x580375,null));};exports[_0x6b7d('0x21')]=function(_0x36bad9,_0x29a5ae){if(_0x36bad9[_0x6b7d('0x46')]['id']){delete _0x36bad9[_0x6b7d('0x46')]['id'];}return db[_0x6b7d('0x2a')][_0x6b7d('0x44')]({'where':{'id':_0x36bad9[_0x6b7d('0x41')]['id']}})[_0x6b7d('0x22')](handleEntityNotFound(_0x29a5ae,null))[_0x6b7d('0x22')](saveUpdates(_0x36bad9['body'],null))[_0x6b7d('0x22')](respondWithResult(_0x29a5ae,null))[_0x6b7d('0x3f')](handleError(_0x29a5ae,null));};exports['destroy']=function(_0x1bbdfc,_0x2c6b95){return db['SquareMessage'][_0x6b7d('0x44')]({'where':{'id':_0x1bbdfc[_0x6b7d('0x41')]['id']}})[_0x6b7d('0x22')](handleEntityNotFound(_0x2c6b95,null))[_0x6b7d('0x22')](removeEntity(_0x2c6b95,null))['catch'](handleError(_0x2c6b95,null));}; \ No newline at end of file +var _0xa0df=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','send','index','map','SquareMessage','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x42774c,_0x54b775){var _0x167bbf=function(_0x677611){while(--_0x677611){_0x42774c['push'](_0x42774c['shift']());}};_0x167bbf(++_0x54b775);}(_0xa0df,0x11d));var _0xfa0d=function(_0x564090,_0x26aa09){_0x564090=_0x564090-0x0;var _0x295eaf=_0xa0df[_0x564090];return _0x295eaf;};'use strict';var emlformat=require(_0xfa0d('0x0'));var rimraf=require(_0xfa0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa0d('0x2'));var rp=require(_0xfa0d('0x3'));var moment=require('moment');var BPromise=require(_0xfa0d('0x4'));var Mustache=require(_0xfa0d('0x5'));var util=require(_0xfa0d('0x6'));var path=require(_0xfa0d('0x7'));var sox=require(_0xfa0d('0x8'));var csv=require(_0xfa0d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa0d('0xa'));var _=require(_0xfa0d('0xb'));var squel=require('squel');var crypto=require(_0xfa0d('0xc'));var jsforce=require(_0xfa0d('0xd'));var deskjs=require(_0xfa0d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa0d('0xf'));var Papa=require(_0xfa0d('0x10'));var Redis=require('ioredis');var authService=require(_0xfa0d('0x11'));var qs=require(_0xfa0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa0d('0x13'));var logger=require(_0xfa0d('0x14'))(_0xfa0d('0x15'));var utils=require(_0xfa0d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa0d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x546d98,_0x5e5c57){_0x5e5c57=_0x5e5c57||0xcc;return function(_0x383693){if(_0x383693){return _0x546d98['sendStatus'](_0x5e5c57);}return _0x546d98['status'](_0x5e5c57)[_0xfa0d('0x18')]();};}function respondWithResult(_0x44dee5,_0x52744a){_0x52744a=_0x52744a||0xc8;return function(_0x44f341){if(_0x44f341){return _0x44dee5[_0xfa0d('0x19')](_0x52744a)[_0xfa0d('0x1a')](_0x44f341);}};}function respondWithFilteredResult(_0x6feb24,_0x42c249){return function(_0x5e9e9b){if(_0x5e9e9b){var _0x3e0859=typeof _0x42c249[_0xfa0d('0x1b')]===_0xfa0d('0x1c')&&typeof _0x42c249[_0xfa0d('0x1d')]===_0xfa0d('0x1c');var _0x11474b=_0x5e9e9b['count'];var _0x4d3191=_0x3e0859?0x0:_0x42c249['offset'];var _0x2bef43=_0x3e0859?_0x5e9e9b[_0xfa0d('0x1e')]:_0x42c249[_0xfa0d('0x1b')]+_0x42c249['limit'];var _0x5a83b5;if(_0x2bef43>=_0x11474b){_0x2bef43=_0x11474b;_0x5a83b5=0xc8;}else{_0x5a83b5=0xce;}_0x6feb24['status'](_0x5a83b5);return _0x6feb24[_0xfa0d('0x1f')](_0xfa0d('0x20'),_0x4d3191+'-'+_0x2bef43+'/'+_0x11474b)['json'](_0x5e9e9b);}return null;};}function patchUpdates(_0x1d4824){return function(_0xa450b7){try{jsonpatch[_0xfa0d('0x21')](_0xa450b7,_0x1d4824,!![]);}catch(_0x19a3b4){return BPromise[_0xfa0d('0x22')](_0x19a3b4);}return _0xa450b7[_0xfa0d('0x23')]();};}function saveUpdates(_0x49c02f,_0x447c4c){return function(_0x3af8c6){if(_0x3af8c6){return _0x3af8c6[_0xfa0d('0x24')](_0x49c02f)['then'](function(_0x2f4331){return _0x2f4331;});}return null;};}function removeEntity(_0x2dd3a3,_0x25b0ff){return function(_0x2a90e7){if(_0x2a90e7){return _0x2a90e7[_0xfa0d('0x25')]()[_0xfa0d('0x26')](function(){_0x2dd3a3[_0xfa0d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5ad83,_0x1a5028){return function(_0xb9cc55){if(!_0xb9cc55){_0xc5ad83[_0xfa0d('0x27')](0x194);}return _0xb9cc55;};}function handleError(_0x1ba354,_0x3a14fa){_0x3a14fa=_0x3a14fa||0x1f4;return function(_0x3331e8){logger['error'](_0x3331e8[_0xfa0d('0x28')]);if(_0x3331e8['name']){delete _0x3331e8['name'];}_0x1ba354['status'](_0x3a14fa)[_0xfa0d('0x29')](_0x3331e8);};}exports[_0xfa0d('0x2a')]=function(_0x454d99,_0x11e396){var _0x4c885f={},_0x3119f3={},_0x13c2ed={'count':0x0,'rows':[]};var _0x2bf1d3=_[_0xfa0d('0x2b')](db[_0xfa0d('0x2c')][_0xfa0d('0x2d')],function(_0x262f4d){return{'name':_0x262f4d[_0xfa0d('0x2e')],'type':_0x262f4d[_0xfa0d('0x2f')]['key']};});_0x3119f3['model']=_[_0xfa0d('0x2b')](_0x2bf1d3,_0xfa0d('0x30'));_0x3119f3['query']=_['keys'](_0x454d99[_0xfa0d('0x31')]);_0x3119f3[_0xfa0d('0x32')]=_[_0xfa0d('0x33')](_0x3119f3[_0xfa0d('0x34')],_0x3119f3[_0xfa0d('0x31')]);_0x4c885f[_0xfa0d('0x35')]=_[_0xfa0d('0x33')](_0x3119f3[_0xfa0d('0x34')],qs[_0xfa0d('0x36')](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x36')]));_0x4c885f[_0xfa0d('0x35')]=_0x4c885f[_0xfa0d('0x35')][_0xfa0d('0x37')]?_0x4c885f['attributes']:_0x3119f3[_0xfa0d('0x34')];if(!_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x38')](_0xfa0d('0x39'))){_0x4c885f[_0xfa0d('0x1d')]=qs['limit'](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x1d')]);_0x4c885f[_0xfa0d('0x1b')]=qs['offset'](_0x454d99[_0xfa0d('0x31')]['offset']);}_0x4c885f[_0xfa0d('0x3a')]=qs[_0xfa0d('0x3b')](_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3b')]);_0x4c885f[_0xfa0d('0x3c')]=qs[_0xfa0d('0x32')](_[_0xfa0d('0x3d')](_0x454d99[_0xfa0d('0x31')],_0x3119f3[_0xfa0d('0x32')]),_0x2bf1d3);if(_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3e')]){_0x4c885f[_0xfa0d('0x3c')]=_[_0xfa0d('0x3f')](_0x4c885f[_0xfa0d('0x3c')],{'$or':_['map'](_0x2bf1d3,function(_0x12470e){if(_0x12470e[_0xfa0d('0x2f')]!==_0xfa0d('0x40')){var _0x43cf7b={};_0x43cf7b[_0x12470e[_0xfa0d('0x30')]]={'$like':'%'+_0x454d99[_0xfa0d('0x31')][_0xfa0d('0x3e')]+'%'};return _0x43cf7b;}})});}_0x4c885f=_[_0xfa0d('0x3f')]({},_0x4c885f,_0x454d99['options']);var _0x226b42={'where':_0x4c885f[_0xfa0d('0x3c')]};return db['SquareMessage'][_0xfa0d('0x1e')](_0x226b42)[_0xfa0d('0x26')](function(_0xc6b36e){_0x13c2ed[_0xfa0d('0x1e')]=_0xc6b36e;if(_0x454d99['query'][_0xfa0d('0x41')]){_0x4c885f[_0xfa0d('0x42')]=[{'all':!![]}];}return db[_0xfa0d('0x2c')][_0xfa0d('0x43')](_0x4c885f);})[_0xfa0d('0x26')](function(_0x4c2ba2){_0x13c2ed[_0xfa0d('0x44')]=_0x4c2ba2;return _0x13c2ed;})[_0xfa0d('0x26')](respondWithFilteredResult(_0x11e396,_0x4c885f))[_0xfa0d('0x45')](handleError(_0x11e396,null));};exports[_0xfa0d('0x46')]=function(_0x49da4c,_0x48096e){var _0x5ccc1c={'raw':!![],'where':{'id':_0x49da4c[_0xfa0d('0x47')]['id']}},_0xd9cae={};_0xd9cae[_0xfa0d('0x34')]=_[_0xfa0d('0x48')](db[_0xfa0d('0x2c')][_0xfa0d('0x2d')]);_0xd9cae['query']=_[_0xfa0d('0x48')](_0x49da4c['query']);_0xd9cae[_0xfa0d('0x32')]=_[_0xfa0d('0x33')](_0xd9cae['model'],_0xd9cae[_0xfa0d('0x31')]);_0x5ccc1c[_0xfa0d('0x35')]=_['intersection'](_0xd9cae[_0xfa0d('0x34')],qs[_0xfa0d('0x36')](_0x49da4c[_0xfa0d('0x31')][_0xfa0d('0x36')]));_0x5ccc1c[_0xfa0d('0x35')]=_0x5ccc1c[_0xfa0d('0x35')][_0xfa0d('0x37')]?_0x5ccc1c['attributes']:_0xd9cae['model'];if(_0x49da4c[_0xfa0d('0x31')][_0xfa0d('0x41')]){_0x5ccc1c[_0xfa0d('0x42')]=[{'all':!![]}];}_0x5ccc1c=_[_0xfa0d('0x3f')]({},_0x5ccc1c,_0x49da4c['options']);return db[_0xfa0d('0x2c')][_0xfa0d('0x49')](_0x5ccc1c)[_0xfa0d('0x26')](handleEntityNotFound(_0x48096e,null))[_0xfa0d('0x26')](respondWithResult(_0x48096e,null))[_0xfa0d('0x45')](handleError(_0x48096e,null));};exports[_0xfa0d('0x4a')]=function(_0x35e9b9,_0xeba2c6){return db[_0xfa0d('0x2c')][_0xfa0d('0x4a')](_0x35e9b9['body'],{})[_0xfa0d('0x26')](respondWithResult(_0xeba2c6,0xc9))['catch'](handleError(_0xeba2c6,null));};exports[_0xfa0d('0x24')]=function(_0x262951,_0x5858eb){if(_0x262951[_0xfa0d('0x4b')]['id']){delete _0x262951[_0xfa0d('0x4b')]['id'];}return db[_0xfa0d('0x2c')][_0xfa0d('0x49')]({'where':{'id':_0x262951['params']['id']}})['then'](handleEntityNotFound(_0x5858eb,null))[_0xfa0d('0x26')](saveUpdates(_0x262951[_0xfa0d('0x4b')],null))['then'](respondWithResult(_0x5858eb,null))[_0xfa0d('0x45')](handleError(_0x5858eb,null));};exports['destroy']=function(_0x28f066,_0x25c574){return db[_0xfa0d('0x2c')]['find']({'where':{'id':_0x28f066['params']['id']}})[_0xfa0d('0x26')](handleEntityNotFound(_0x25c574,null))['then'](removeEntity(_0x25c574,null))['catch'](handleError(_0x25c574,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 837e0e2..bd4dc0f 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 _0x79f7=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','util'];(function(_0x1dad53,_0x807af2){var _0x4e8cc4=function(_0x5a8eb2){while(--_0x5a8eb2){_0x1dad53['push'](_0x1dad53['shift']());}};_0x4e8cc4(++_0x807af2);}(_0x79f7,0x78));var _0x779f=function(_0x2db20e,_0x16ba57){_0x2db20e=_0x2db20e-0x0;var _0x126722=_0x79f7[_0x2db20e];return _0x126722;};'use strict';var _=require('lodash');var util=require(_0x779f('0x0'));var logger=require('../../config/logger')(_0x779f('0x1'));var moment=require(_0x779f('0x2'));var BPromise=require(_0x779f('0x3'));var rp=require(_0x779f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x779f('0x5'));var config=require(_0x779f('0x6'));var attributes=require(_0x779f('0x7'));module[_0x779f('0x8')]=function(_0x6f1908,_0x4d669c){return _0x6f1908['define'](_0x779f('0x9'),attributes,{'tableName':_0x779f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3410=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x3410,0x8c));var _0x0341=function(_0x41f2e8,_0x56df53){_0x41f2e8=_0x41f2e8-0x0;var _0x21d86f=_0x3410[_0x41f2e8];return _0x21d86f;};'use strict';var _=require(_0x0341('0x0'));var util=require(_0x0341('0x1'));var logger=require('../../config/logger')(_0x0341('0x2'));var moment=require(_0x0341('0x3'));var BPromise=require('bluebird');var rp=require(_0x0341('0x4'));var fs=require('fs');var path=require(_0x0341('0x5'));var rimraf=require(_0x0341('0x6'));var config=require(_0x0341('0x7'));var attributes=require(_0x0341('0x8'));module[_0x0341('0x9')]=function(_0x5046f4,_0x1be255){return _0x5046f4[_0x0341('0xa')](_0x0341('0xb'),attributes,{'tableName':_0x0341('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f0ac65c..da030e3 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 _0x04ae=['SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','debug','error','code','message'];(function(_0x386f56,_0x5f50e1){var _0x5ba5c5=function(_0x131eed){while(--_0x131eed){_0x386f56['push'](_0x386f56['shift']());}};_0x5ba5c5(++_0x5f50e1);}(_0x04ae,0x67));var _0xe04a=function(_0x421d1f,_0x28e5ec){_0x421d1f=_0x421d1f-0x0;var _0x2ba09e=_0x04ae[_0x421d1f];return _0x2ba09e;};'use strict';var _=require(_0xe04a('0x0'));var util=require(_0xe04a('0x1'));var moment=require(_0xe04a('0x2'));var BPromise=require(_0xe04a('0x3'));var rs=require(_0xe04a('0x4'));var fs=require('fs');var Redis=require(_0xe04a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe04a('0x6'));var logger=require('../../config/logger')(_0xe04a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe04a('0x8'));var client=jayson[_0xe04a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49447b,_0x2154c7,_0x166c57){return new BPromise(function(_0x38686d,_0x5c1387){return client['request'](_0x49447b,_0x166c57)[_0xe04a('0xa')](function(_0x23a551){logger[_0xe04a('0xb')]('SquareMessage,\x20%s,\x20%s',_0x2154c7,_0xe04a('0xc'));logger[_0xe04a('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2154c7,_0xe04a('0xc'),JSON['stringify'](_0x23a551));if(_0x23a551[_0xe04a('0xe')]){if(_0x23a551[_0xe04a('0xe')][_0xe04a('0xf')]===0x1f4){logger[_0xe04a('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2154c7,_0x23a551[_0xe04a('0xe')]['message']);return _0x5c1387(_0x23a551[_0xe04a('0xe')][_0xe04a('0x10')]);}logger[_0xe04a('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2154c7,_0x23a551[_0xe04a('0xe')][_0xe04a('0x10')]);return _0x38686d(_0x23a551[_0xe04a('0xe')]['message']);}else{logger['info'](_0xe04a('0x11'),_0x2154c7,'request\x20sent');_0x38686d(_0x23a551[_0xe04a('0x12')][_0xe04a('0x10')]);}})[_0xe04a('0x13')](function(_0x1d5dbc){logger[_0xe04a('0xe')](_0xe04a('0x11'),_0x2154c7,_0x1d5dbc);_0x5c1387(_0x1d5dbc);});});}exports[_0xe04a('0x14')]=function(_0x50036b){var _0x1e57a9=this;return new Promise(function(_0x312b4f,_0x57a4f8){return db['SquareMessage']['create'](_0x50036b['body'],{'raw':_0x50036b['options']?_0x50036b[_0xe04a('0x15')][_0xe04a('0x16')]===undefined?!![]:![]:!![]})[_0xe04a('0xa')](function(_0x4fe80b){logger[_0xe04a('0xb')](_0xe04a('0x14'),_0x50036b);logger['debug'](_0xe04a('0x14'),_0x50036b,JSON[_0xe04a('0x17')](_0x4fe80b));_0x312b4f(_0x4fe80b);})[_0xe04a('0x13')](function(_0x123c31){logger['error'](_0xe04a('0x14'),_0x123c31['message'],_0x50036b);_0x57a4f8(_0x1e57a9['error'](0x1f4,_0x123c31[_0xe04a('0x10')]));});});}; \ No newline at end of file +var _0x1c47=['result','catch','CreateSquareMessage','create','body','options','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x28e4cf,_0x12dfd6){var _0x4cc2ba=function(_0x4b6c88){while(--_0x4b6c88){_0x28e4cf['push'](_0x28e4cf['shift']());}};_0x4cc2ba(++_0x12dfd6);}(_0x1c47,0x16e));var _0x71c4=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x1c47[_0x478c8a];return _0x3b6b3e;};'use strict';var _=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71c4('0x3'))['db'];var utils=require(_0x71c4('0x4'));var logger=require('../../config/logger')(_0x71c4('0x5'));var config=require(_0x71c4('0x6'));var jayson=require(_0x71c4('0x7'));var client=jayson[_0x71c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb385,_0x3d6be1,_0x5e301a){return new BPromise(function(_0x484f80,_0x7a2427){return client['request'](_0x1bb385,_0x5e301a)[_0x71c4('0x9')](function(_0x188ce3){logger[_0x71c4('0xa')](_0x71c4('0xb'),_0x3d6be1,_0x71c4('0xc'));logger[_0x71c4('0xd')](_0x71c4('0xe'),_0x3d6be1,_0x71c4('0xc'),JSON[_0x71c4('0xf')](_0x188ce3));if(_0x188ce3[_0x71c4('0x10')]){if(_0x188ce3[_0x71c4('0x10')]['code']===0x1f4){logger[_0x71c4('0x10')](_0x71c4('0xb'),_0x3d6be1,_0x188ce3[_0x71c4('0x10')]['message']);return _0x7a2427(_0x188ce3[_0x71c4('0x10')]['message']);}logger[_0x71c4('0x10')](_0x71c4('0xb'),_0x3d6be1,_0x188ce3[_0x71c4('0x10')]['message']);return _0x484f80(_0x188ce3[_0x71c4('0x10')][_0x71c4('0x11')]);}else{logger['info'](_0x71c4('0xb'),_0x3d6be1,_0x71c4('0xc'));_0x484f80(_0x188ce3[_0x71c4('0x12')]['message']);}})[_0x71c4('0x13')](function(_0x19692a){logger['error'](_0x71c4('0xb'),_0x3d6be1,_0x19692a);_0x7a2427(_0x19692a);});});}exports[_0x71c4('0x14')]=function(_0x1c8d96){var _0x3a300d=this;return new Promise(function(_0x3a5858,_0x37c8ad){return db['SquareMessage'][_0x71c4('0x15')](_0x1c8d96[_0x71c4('0x16')],{'raw':_0x1c8d96[_0x71c4('0x17')]?_0x1c8d96[_0x71c4('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f0298){logger[_0x71c4('0xa')](_0x71c4('0x14'),_0x1c8d96);logger['debug'](_0x71c4('0x14'),_0x1c8d96,JSON[_0x71c4('0xf')](_0x3f0298));_0x3a5858(_0x3f0298);})[_0x71c4('0x13')](function(_0x56e620){logger[_0x71c4('0x10')](_0x71c4('0x14'),_0x56e620['message'],_0x1c8d96);_0x37c8ad(_0x3a300d[_0x71c4('0x10')](0x1f4,_0x56e620[_0x71c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8429348..e401d05 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 _0x481e=['isAuthenticated','/:id','show','/:id/test','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x19d2a5,_0x344cc7){var _0x257a93=function(_0x37e3a2){while(--_0x37e3a2){_0x19d2a5['push'](_0x19d2a5['shift']());}};_0x257a93(++_0x344cc7);}(_0x481e,0x1ad));var _0xe481=function(_0xbaae0a,_0x4abb2a){_0xbaae0a=_0xbaae0a-0x0;var _0x399d88=_0x481e[_0xbaae0a];return _0x399d88;};'use strict';var multer=require(_0xe481('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe481('0x1'));var express=require('express');var router=express[_0xe481('0x2')]();var fs_extra=require(_0xe481('0x3'));var auth=require(_0xe481('0x4'));var interaction=require(_0xe481('0x5'));var config=require(_0xe481('0x6'));var controller=require('./squareOdbc.controller');router[_0xe481('0x7')]('/',auth[_0xe481('0x8')](),controller['index']);router[_0xe481('0x7')](_0xe481('0x9'),auth[_0xe481('0x8')](),controller[_0xe481('0xa')]);router[_0xe481('0x7')](_0xe481('0xb'),auth[_0xe481('0x8')](),timeout('15s'),controller['test']);router[_0xe481('0xc')]('/',auth['isAuthenticated'](),controller[_0xe481('0xd')]);router[_0xe481('0xe')](_0xe481('0x9'),auth[_0xe481('0x8')](),controller[_0xe481('0xf')]);router[_0xe481('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe481('0x11')]);module[_0xe481('0x12')]=router; \ No newline at end of file +var _0x52c1=['show','/:id/test','15s','test','post','exports','util','path','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0x52c1,0xd8));var _0x152c=function(_0x32af19,_0x40198d){_0x32af19=_0x32af19-0x0;var _0x45c202=_0x52c1[_0x32af19];return _0x45c202;};'use strict';var multer=require('multer');var util=require(_0x152c('0x0'));var path=require(_0x152c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x152c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x152c('0x3'));var controller=require(_0x152c('0x4'));router[_0x152c('0x5')]('/',auth[_0x152c('0x6')](),controller[_0x152c('0x7')]);router['get'](_0x152c('0x8'),auth[_0x152c('0x6')](),controller[_0x152c('0x9')]);router[_0x152c('0x5')](_0x152c('0xa'),auth[_0x152c('0x6')](),timeout(_0x152c('0xb')),controller[_0x152c('0xc')]);router[_0x152c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x152c('0x8'),auth[_0x152c('0x6')](),controller['update']);router['delete']('/:id',auth[_0x152c('0x6')](),controller['destroy']);module[_0x152c('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index c504374..8edf920 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 _0x95cf=['name','sequelize','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x95cf,0x15d));var _0xf95c=function(_0x31b421,_0x243a94){_0x31b421=_0x31b421-0x0;var _0x324f6b=_0x95cf[_0x31b421];return _0x324f6b;};'use strict';var Sequelize=require(_0xf95c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf95c('0x1')],'unique':_0xf95c('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf95c('0x1')]},'description':{'type':Sequelize[_0xf95c('0x1')]}}; \ No newline at end of file +var _0x9d50=['exports','STRING','name','sequelize'];(function(_0x53da0e,_0x2c4eb0){var _0x3a6ae7=function(_0xbcafb3){while(--_0xbcafb3){_0x53da0e['push'](_0x53da0e['shift']());}};_0x3a6ae7(++_0x2c4eb0);}(_0x9d50,0xd3));var _0x09d5=function(_0x1b1857,_0x5d90f4){_0x1b1857=_0x1b1857-0x0;var _0xcb5c13=_0x9d50[_0x1b1857];return _0xcb5c13;};'use strict';var Sequelize=require(_0x09d5('0x0'));module[_0x09d5('0x1')]={'name':{'type':Sequelize[_0x09d5('0x2')],'unique':_0x09d5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x09d5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 51097ad..6d1e658 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 _0xf062=['merge','where','VIRTUAL','options','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','end','error','stack','name','send','index','map','SquareOdbc','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter'];(function(_0x38d825,_0x357fd6){var _0xc39a03=function(_0x10e2de){while(--_0x10e2de){_0x38d825['push'](_0x38d825['shift']());}};_0xc39a03(++_0x357fd6);}(_0xf062,0x1ca));var _0x2f06=function(_0x4e35ce,_0x30ca51){_0x4e35ce=_0x4e35ce-0x0;var _0x5aa975=_0xf062[_0x4e35ce];return _0x5aa975;};'use strict';var emlformat=require(_0x2f06('0x0'));var rimraf=require(_0x2f06('0x1'));var zipdir=require(_0x2f06('0x2'));var jsonpatch=require(_0x2f06('0x3'));var rp=require(_0x2f06('0x4'));var moment=require(_0x2f06('0x5'));var BPromise=require(_0x2f06('0x6'));var Mustache=require(_0x2f06('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f06('0x8'));var csv=require(_0x2f06('0x9'));var ejs=require(_0x2f06('0xa'));var fs=require('fs');var fs_extra=require(_0x2f06('0xb'));var _=require(_0x2f06('0xc'));var squel=require(_0x2f06('0xd'));var crypto=require(_0x2f06('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f06('0x9'));var querystring=require('querystring');var Papa=require(_0x2f06('0xf'));var Redis=require(_0x2f06('0x10'));var authService=require(_0x2f06('0x11'));var qs=require(_0x2f06('0x12'));var as=require(_0x2f06('0x13'));var hardwareService=require(_0x2f06('0x14'));var logger=require('../../config/logger')(_0x2f06('0x15'));var utils=require('../../config/utils');var config=require(_0x2f06('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f06('0x17'))['db'];function respondWithStatusCode(_0x19d2d5,_0x4233a2){_0x4233a2=_0x4233a2||0xcc;return function(_0x3ea398){if(_0x3ea398){return _0x19d2d5[_0x2f06('0x18')](_0x4233a2);}return _0x19d2d5['status'](_0x4233a2)['end']();};}function respondWithResult(_0x1cf15a,_0xfbeefc){_0xfbeefc=_0xfbeefc||0xc8;return function(_0x5f32cd){if(_0x5f32cd){return _0x1cf15a[_0x2f06('0x19')](_0xfbeefc)[_0x2f06('0x1a')](_0x5f32cd);}};}function respondWithFilteredResult(_0x1d7730,_0x511cf8){return function(_0x5cf7cc){if(_0x5cf7cc){var _0x250eae=typeof _0x511cf8['offset']===_0x2f06('0x1b')&&typeof _0x511cf8[_0x2f06('0x1c')]===_0x2f06('0x1b');var _0xd0cd19=_0x5cf7cc[_0x2f06('0x1d')];var _0x30fc09=_0x250eae?0x0:_0x511cf8['offset'];var _0xf587f5=_0x250eae?_0x5cf7cc[_0x2f06('0x1d')]:_0x511cf8[_0x2f06('0x1e')]+_0x511cf8[_0x2f06('0x1c')];var _0x3e5c0c;if(_0xf587f5>=_0xd0cd19){_0xf587f5=_0xd0cd19;_0x3e5c0c=0xc8;}else{_0x3e5c0c=0xce;}_0x1d7730[_0x2f06('0x19')](_0x3e5c0c);return _0x1d7730[_0x2f06('0x1f')](_0x2f06('0x20'),_0x30fc09+'-'+_0xf587f5+'/'+_0xd0cd19)[_0x2f06('0x1a')](_0x5cf7cc);}return null;};}function patchUpdates(_0x31c536){return function(_0xb232e3){try{jsonpatch[_0x2f06('0x21')](_0xb232e3,_0x31c536,!![]);}catch(_0x9ac7f5){return BPromise[_0x2f06('0x22')](_0x9ac7f5);}return _0xb232e3[_0x2f06('0x23')]();};}function saveUpdates(_0x40e8db,_0x2dc460){return function(_0x3927e1){if(_0x3927e1){return _0x3927e1[_0x2f06('0x24')](_0x40e8db)['then'](function(_0x24ec2e){return _0x24ec2e;});}return null;};}function removeEntity(_0x23eb66,_0x10831d){return function(_0x2ef34f){if(_0x2ef34f){return _0x2ef34f[_0x2f06('0x25')]()[_0x2f06('0x26')](function(){var _0x164229=_0x2ef34f[_0x2f06('0x27')]({'plain':!![]});var _0x1cdd3f=_0x2f06('0x28');return db['UserProfileResource'][_0x2f06('0x25')]({'where':{'type':_0x1cdd3f,'resourceId':_0x164229['id']}})[_0x2f06('0x26')](function(){return _0x2ef34f;});})[_0x2f06('0x26')](function(){_0x23eb66[_0x2f06('0x19')](0xcc)[_0x2f06('0x29')]();});}};}function handleEntityNotFound(_0x463f54,_0x12fca4){return function(_0x2129ca){if(!_0x2129ca){_0x463f54['sendStatus'](0x194);}return _0x2129ca;};}function handleError(_0x2ed7a3,_0x220a4f){_0x220a4f=_0x220a4f||0x1f4;return function(_0x26ff93){logger[_0x2f06('0x2a')](_0x26ff93[_0x2f06('0x2b')]);if(_0x26ff93[_0x2f06('0x2c')]){delete _0x26ff93['name'];}_0x2ed7a3[_0x2f06('0x19')](_0x220a4f)[_0x2f06('0x2d')](_0x26ff93);};}exports[_0x2f06('0x2e')]=function(_0xb3ca2e,_0x26aa93){var _0x3f0ac1={},_0x32ad8c={},_0x37009c={'count':0x0,'rows':[]};var _0x5dbac3=_[_0x2f06('0x2f')](db[_0x2f06('0x30')]['rawAttributes'],function(_0x435f4d){return{'name':_0x435f4d['fieldName'],'type':_0x435f4d[_0x2f06('0x31')][_0x2f06('0x32')]};});_0x32ad8c['model']=_[_0x2f06('0x2f')](_0x5dbac3,_0x2f06('0x2c'));_0x32ad8c[_0x2f06('0x33')]=_['keys'](_0xb3ca2e[_0x2f06('0x33')]);_0x32ad8c['filters']=_[_0x2f06('0x34')](_0x32ad8c['model'],_0x32ad8c[_0x2f06('0x33')]);_0x3f0ac1['attributes']=_['intersection'](_0x32ad8c[_0x2f06('0x35')],qs['fields'](_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x36')]));_0x3f0ac1[_0x2f06('0x37')]=_0x3f0ac1[_0x2f06('0x37')][_0x2f06('0x38')]?_0x3f0ac1['attributes']:_0x32ad8c[_0x2f06('0x35')];if(!_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x39')](_0x2f06('0x3a'))){_0x3f0ac1[_0x2f06('0x1c')]=qs[_0x2f06('0x1c')](_0xb3ca2e[_0x2f06('0x33')]['limit']);_0x3f0ac1['offset']=qs[_0x2f06('0x1e')](_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x1e')]);}_0x3f0ac1[_0x2f06('0x3b')]=qs[_0x2f06('0x3c')](_0xb3ca2e['query'][_0x2f06('0x3c')]);_0x3f0ac1['where']=qs['filters'](_[_0x2f06('0x3d')](_0xb3ca2e[_0x2f06('0x33')],_0x32ad8c[_0x2f06('0x3e')]),_0x5dbac3);if(_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x3f')]){_0x3f0ac1['where']=_[_0x2f06('0x40')](_0x3f0ac1[_0x2f06('0x41')],{'$or':_['map'](_0x5dbac3,function(_0x272842){if(_0x272842[_0x2f06('0x31')]!==_0x2f06('0x42')){var _0x5d9a9b={};_0x5d9a9b[_0x272842['name']]={'$like':'%'+_0xb3ca2e['query'][_0x2f06('0x3f')]+'%'};return _0x5d9a9b;}})});}_0x3f0ac1=_[_0x2f06('0x40')]({},_0x3f0ac1,_0xb3ca2e[_0x2f06('0x43')]);var _0x520e76={'where':_0x3f0ac1[_0x2f06('0x41')]};return db['SquareOdbc']['count'](_0x520e76)[_0x2f06('0x26')](function(_0x2332b1){_0x37009c[_0x2f06('0x1d')]=_0x2332b1;if(_0xb3ca2e['query']['includeAll']){_0x3f0ac1['include']=[{'all':!![]}];}return db[_0x2f06('0x30')][_0x2f06('0x44')](_0x3f0ac1);})[_0x2f06('0x26')](function(_0x50f0e9){_0x37009c[_0x2f06('0x45')]=_0x50f0e9;return _0x37009c;})[_0x2f06('0x26')](respondWithFilteredResult(_0x26aa93,_0x3f0ac1))['catch'](handleError(_0x26aa93,null));};exports['show']=function(_0x31ba77,_0x496981){var _0x25a06c={'raw':!![],'where':{'id':_0x31ba77[_0x2f06('0x46')]['id']}},_0x44a809={};_0x44a809[_0x2f06('0x35')]=_[_0x2f06('0x47')](db['SquareOdbc'][_0x2f06('0x48')]);_0x44a809['query']=_[_0x2f06('0x47')](_0x31ba77[_0x2f06('0x33')]);_0x44a809[_0x2f06('0x3e')]=_[_0x2f06('0x34')](_0x44a809['model'],_0x44a809[_0x2f06('0x33')]);_0x25a06c[_0x2f06('0x37')]=_[_0x2f06('0x34')](_0x44a809['model'],qs[_0x2f06('0x36')](_0x31ba77[_0x2f06('0x33')][_0x2f06('0x36')]));_0x25a06c[_0x2f06('0x37')]=_0x25a06c[_0x2f06('0x37')][_0x2f06('0x38')]?_0x25a06c[_0x2f06('0x37')]:_0x44a809[_0x2f06('0x35')];if(_0x31ba77['query'][_0x2f06('0x49')]){_0x25a06c[_0x2f06('0x4a')]=[{'all':!![]}];}_0x25a06c=_[_0x2f06('0x40')]({},_0x25a06c,_0x31ba77['options']);return db['SquareOdbc'][_0x2f06('0x4b')](_0x25a06c)['then'](handleEntityNotFound(_0x496981,null))[_0x2f06('0x26')](respondWithResult(_0x496981,null))[_0x2f06('0x4c')](handleError(_0x496981,null));};exports[_0x2f06('0x4d')]=function(_0x73d315,_0x9806b1){return db[_0x2f06('0x30')][_0x2f06('0x4d')](_0x73d315[_0x2f06('0x4e')],{})['then'](function(_0x4b0448){var _0x2885fe=_0x73d315[_0x2f06('0x4f')][_0x2f06('0x27')]({'plain':!![]});if(!_0x2885fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2885fe[_0x2f06('0x50')]==='user'){var _0x5893ab=_0x4b0448['get']({'plain':!![]});var _0x525b36=_0x2f06('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x525b36,'userProfileId':_0x2885fe['userProfileId']},'raw':!![]})[_0x2f06('0x26')](function(_0x2dde88){if(_0x2dde88&&_0x2dde88['autoAssociation']===0x0){return db[_0x2f06('0x51')][_0x2f06('0x4d')]({'name':_0x5893ab['name'],'resourceId':_0x5893ab['id'],'type':_0x2dde88[_0x2f06('0x2c')],'sectionId':_0x2dde88['id']},{})['then'](function(){return _0x4b0448;});}else{return _0x4b0448;}})[_0x2f06('0x4c')](function(_0x1c3e74){logger[_0x2f06('0x2a')](_0x2f06('0x52'),_0x1c3e74);throw _0x1c3e74;});}return _0x4b0448;})[_0x2f06('0x26')](respondWithResult(_0x9806b1,0xc9))[_0x2f06('0x4c')](handleError(_0x9806b1,null));};exports[_0x2f06('0x24')]=function(_0x3fe8b4,_0x4dc864){if(_0x3fe8b4[_0x2f06('0x4e')]['id']){delete _0x3fe8b4[_0x2f06('0x4e')]['id'];}return db[_0x2f06('0x30')][_0x2f06('0x4b')]({'where':{'id':_0x3fe8b4[_0x2f06('0x46')]['id']}})[_0x2f06('0x26')](handleEntityNotFound(_0x4dc864,null))['then'](saveUpdates(_0x3fe8b4[_0x2f06('0x4e')],null))[_0x2f06('0x26')](respondWithResult(_0x4dc864,null))[_0x2f06('0x4c')](handleError(_0x4dc864,null));};exports[_0x2f06('0x25')]=function(_0x4fe77a,_0x11a57c){return db['SquareOdbc'][_0x2f06('0x4b')]({'where':{'id':_0x4fe77a[_0x2f06('0x46')]['id']}})[_0x2f06('0x26')](handleEntityNotFound(_0x11a57c,null))[_0x2f06('0x26')](removeEntity(_0x11a57c,null))['catch'](handleError(_0x11a57c,null));};exports['test']=function(_0x4f6ded,_0x72fe92,_0xfb8565){var _0x2b16a5;return db[_0x2f06('0x30')][_0x2f06('0x4b')]({'where':{'id':_0x4f6ded[_0x2f06('0x46')]['id']},'attributes':['id',_0x2f06('0x53')]})[_0x2f06('0x26')](handleEntityNotFound(_0x72fe92,null))[_0x2f06('0x26')](function(_0x45b17c){if(_0x45b17c){var _0x585cfb=require(_0x2f06('0x54'))();_0x585cfb[_0x2f06('0x55')](_0x45b17c['dsn']);_0x585cfb[_0x2f06('0x56')]();return _0x45b17c;}})['then'](respondWithResult(_0x72fe92,null))['catch'](handleError(_0x72fe92,null));}; \ No newline at end of file +var _0xc10c=['hasOwnProperty','nolimit','order','sort','where','filter','options','SquareOdbc','includeAll','include','rows','catch','show','length','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xc10c,0x1bb));var _0xcc10=function(_0xdd57d2,_0x437799){_0xdd57d2=_0xdd57d2-0x0;var _0x426d85=_0xc10c[_0xdd57d2];return _0x426d85;};'use strict';var emlformat=require(_0xcc10('0x0'));var rimraf=require(_0xcc10('0x1'));var zipdir=require(_0xcc10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc10('0x3'));var moment=require(_0xcc10('0x4'));var BPromise=require(_0xcc10('0x5'));var Mustache=require('mustache');var util=require(_0xcc10('0x6'));var path=require(_0xcc10('0x7'));var sox=require(_0xcc10('0x8'));var csv=require(_0xcc10('0x9'));var ejs=require(_0xcc10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc10('0xb'));var squel=require(_0xcc10('0xc'));var crypto=require(_0xcc10('0xd'));var jsforce=require(_0xcc10('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcc10('0x10'));var as=require(_0xcc10('0x11'));var hardwareService=require(_0xcc10('0x12'));var logger=require('../../config/logger')(_0xcc10('0x13'));var utils=require(_0xcc10('0x14'));var config=require(_0xcc10('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc10('0x16'))['db'];function respondWithStatusCode(_0x1fec53,_0xb471ca){_0xb471ca=_0xb471ca||0xcc;return function(_0x10dbf1){if(_0x10dbf1){return _0x1fec53[_0xcc10('0x17')](_0xb471ca);}return _0x1fec53[_0xcc10('0x18')](_0xb471ca)[_0xcc10('0x19')]();};}function respondWithResult(_0xe28a63,_0x33f1fc){_0x33f1fc=_0x33f1fc||0xc8;return function(_0x1bb69a){if(_0x1bb69a){return _0xe28a63['status'](_0x33f1fc)[_0xcc10('0x1a')](_0x1bb69a);}};}function respondWithFilteredResult(_0x221060,_0x1861ea){return function(_0x173477){if(_0x173477){var _0x3eb186=typeof _0x1861ea[_0xcc10('0x1b')]==='undefined'&&typeof _0x1861ea['limit']===_0xcc10('0x1c');var _0x24a805=_0x173477[_0xcc10('0x1d')];var _0x337a03=_0x3eb186?0x0:_0x1861ea['offset'];var _0x5ee76e=_0x3eb186?_0x173477[_0xcc10('0x1d')]:_0x1861ea[_0xcc10('0x1b')]+_0x1861ea[_0xcc10('0x1e')];var _0x3553b9;if(_0x5ee76e>=_0x24a805){_0x5ee76e=_0x24a805;_0x3553b9=0xc8;}else{_0x3553b9=0xce;}_0x221060[_0xcc10('0x18')](_0x3553b9);return _0x221060[_0xcc10('0x1f')](_0xcc10('0x20'),_0x337a03+'-'+_0x5ee76e+'/'+_0x24a805)[_0xcc10('0x1a')](_0x173477);}return null;};}function patchUpdates(_0x5cdb94){return function(_0x392ca0){try{jsonpatch[_0xcc10('0x21')](_0x392ca0,_0x5cdb94,!![]);}catch(_0x259fbe){return BPromise['reject'](_0x259fbe);}return _0x392ca0[_0xcc10('0x22')]();};}function saveUpdates(_0x963e40,_0x384e95){return function(_0x499596){if(_0x499596){return _0x499596[_0xcc10('0x23')](_0x963e40)[_0xcc10('0x24')](function(_0x4e9bf7){return _0x4e9bf7;});}return null;};}function removeEntity(_0x50edf5,_0x143a4d){return function(_0x5c979f){if(_0x5c979f){return _0x5c979f[_0xcc10('0x25')]()[_0xcc10('0x24')](function(){var _0x2c4733=_0x5c979f[_0xcc10('0x26')]({'plain':!![]});var _0x1d3d63=_0xcc10('0x27');return db[_0xcc10('0x28')]['destroy']({'where':{'type':_0x1d3d63,'resourceId':_0x2c4733['id']}})[_0xcc10('0x24')](function(){return _0x5c979f;});})[_0xcc10('0x24')](function(){_0x50edf5[_0xcc10('0x18')](0xcc)[_0xcc10('0x19')]();});}};}function handleEntityNotFound(_0x5bacb9,_0x45385a){return function(_0x4daa5){if(!_0x4daa5){_0x5bacb9['sendStatus'](0x194);}return _0x4daa5;};}function handleError(_0x26fd7c,_0x48bfb0){_0x48bfb0=_0x48bfb0||0x1f4;return function(_0x245eda){logger[_0xcc10('0x29')](_0x245eda['stack']);if(_0x245eda[_0xcc10('0x2a')]){delete _0x245eda['name'];}_0x26fd7c[_0xcc10('0x18')](_0x48bfb0)[_0xcc10('0x2b')](_0x245eda);};}exports[_0xcc10('0x2c')]=function(_0x1f48ee,_0x7abf24){var _0x212289={},_0x2cd602={},_0x13bc5b={'count':0x0,'rows':[]};var _0xb03139=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x377888){return{'name':_0x377888[_0xcc10('0x2d')],'type':_0x377888[_0xcc10('0x2e')][_0xcc10('0x2f')]};});_0x2cd602[_0xcc10('0x30')]=_['map'](_0xb03139,_0xcc10('0x2a'));_0x2cd602[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x1f48ee[_0xcc10('0x31')]);_0x2cd602[_0xcc10('0x33')]=_['intersection'](_0x2cd602[_0xcc10('0x30')],_0x2cd602[_0xcc10('0x31')]);_0x212289['attributes']=_[_0xcc10('0x34')](_0x2cd602[_0xcc10('0x30')],qs['fields'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x35')]));_0x212289['attributes']=_0x212289[_0xcc10('0x36')]['length']?_0x212289[_0xcc10('0x36')]:_0x2cd602['model'];if(!_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x37')](_0xcc10('0x38'))){_0x212289[_0xcc10('0x1e')]=qs['limit'](_0x1f48ee[_0xcc10('0x31')]['limit']);_0x212289['offset']=qs[_0xcc10('0x1b')](_0x1f48ee[_0xcc10('0x31')]['offset']);}_0x212289[_0xcc10('0x39')]=qs['sort'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3a')]);_0x212289['where']=qs['filters'](_['pick'](_0x1f48ee[_0xcc10('0x31')],_0x2cd602[_0xcc10('0x33')]),_0xb03139);if(_0x1f48ee[_0xcc10('0x31')]['filter']){_0x212289[_0xcc10('0x3b')]=_['merge'](_0x212289[_0xcc10('0x3b')],{'$or':_['map'](_0xb03139,function(_0x2ac843){if(_0x2ac843[_0xcc10('0x2e')]!=='VIRTUAL'){var _0x7fa816={};_0x7fa816[_0x2ac843['name']]={'$like':'%'+_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3c')]+'%'};return _0x7fa816;}})});}_0x212289=_['merge']({},_0x212289,_0x1f48ee[_0xcc10('0x3d')]);var _0x4b6836={'where':_0x212289[_0xcc10('0x3b')]};return db[_0xcc10('0x3e')][_0xcc10('0x1d')](_0x4b6836)['then'](function(_0x425f06){_0x13bc5b['count']=_0x425f06;if(_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x212289[_0xcc10('0x40')]=[{'all':!![]}];}return db[_0xcc10('0x3e')]['findAll'](_0x212289);})[_0xcc10('0x24')](function(_0x3bb1d3){_0x13bc5b[_0xcc10('0x41')]=_0x3bb1d3;return _0x13bc5b;})['then'](respondWithFilteredResult(_0x7abf24,_0x212289))[_0xcc10('0x42')](handleError(_0x7abf24,null));};exports[_0xcc10('0x43')]=function(_0x36c3b6,_0x5068cd){var _0x34f4f6={'raw':!![],'where':{'id':_0x36c3b6['params']['id']}},_0x1af38e={};_0x1af38e[_0xcc10('0x30')]=_[_0xcc10('0x32')](db[_0xcc10('0x3e')]['rawAttributes']);_0x1af38e[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x36c3b6[_0xcc10('0x31')]);_0x1af38e[_0xcc10('0x33')]=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],_0x1af38e['query']);_0x34f4f6['attributes']=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],qs['fields'](_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x35')]));_0x34f4f6[_0xcc10('0x36')]=_0x34f4f6[_0xcc10('0x36')][_0xcc10('0x44')]?_0x34f4f6[_0xcc10('0x36')]:_0x1af38e[_0xcc10('0x30')];if(_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x34f4f6[_0xcc10('0x40')]=[{'all':!![]}];}_0x34f4f6=_[_0xcc10('0x45')]({},_0x34f4f6,_0x36c3b6['options']);return db[_0xcc10('0x3e')][_0xcc10('0x46')](_0x34f4f6)['then'](handleEntityNotFound(_0x5068cd,null))[_0xcc10('0x24')](respondWithResult(_0x5068cd,null))[_0xcc10('0x42')](handleError(_0x5068cd,null));};exports['create']=function(_0x22e737,_0x1e3efc){return db[_0xcc10('0x3e')][_0xcc10('0x47')](_0x22e737[_0xcc10('0x48')],{})[_0xcc10('0x24')](function(_0x5b9b4d){var _0x4064ae=_0x22e737[_0xcc10('0x49')][_0xcc10('0x26')]({'plain':!![]});if(!_0x4064ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4064ae[_0xcc10('0x4a')]===_0xcc10('0x49')){var _0x11ff8a=_0x5b9b4d['get']({'plain':!![]});var _0x51e635=_0xcc10('0x27');return db[_0xcc10('0x4b')][_0xcc10('0x46')]({'where':{'name':_0x51e635,'userProfileId':_0x4064ae[_0xcc10('0x4c')]},'raw':!![]})[_0xcc10('0x24')](function(_0x27f2cf){if(_0x27f2cf&&_0x27f2cf['autoAssociation']===0x0){return db[_0xcc10('0x28')][_0xcc10('0x47')]({'name':_0x11ff8a[_0xcc10('0x2a')],'resourceId':_0x11ff8a['id'],'type':_0x27f2cf[_0xcc10('0x2a')],'sectionId':_0x27f2cf['id']},{})[_0xcc10('0x24')](function(){return _0x5b9b4d;});}else{return _0x5b9b4d;}})[_0xcc10('0x42')](function(_0x3cd560){logger[_0xcc10('0x29')](_0xcc10('0x4d'),_0x3cd560);throw _0x3cd560;});}return _0x5b9b4d;})[_0xcc10('0x24')](respondWithResult(_0x1e3efc,0xc9))[_0xcc10('0x42')](handleError(_0x1e3efc,null));};exports[_0xcc10('0x23')]=function(_0x5833a0,_0x19078f){if(_0x5833a0[_0xcc10('0x48')]['id']){delete _0x5833a0[_0xcc10('0x48')]['id'];}return db[_0xcc10('0x3e')]['find']({'where':{'id':_0x5833a0[_0xcc10('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19078f,null))[_0xcc10('0x24')](saveUpdates(_0x5833a0[_0xcc10('0x48')],null))[_0xcc10('0x24')](respondWithResult(_0x19078f,null))['catch'](handleError(_0x19078f,null));};exports[_0xcc10('0x25')]=function(_0x11d2e,_0x466c80){return db[_0xcc10('0x3e')][_0xcc10('0x46')]({'where':{'id':_0x11d2e[_0xcc10('0x4e')]['id']}})[_0xcc10('0x24')](handleEntityNotFound(_0x466c80,null))[_0xcc10('0x24')](removeEntity(_0x466c80,null))[_0xcc10('0x42')](handleError(_0x466c80,null));};exports[_0xcc10('0x4f')]=function(_0x2a6a3f,_0x2bff81,_0x716b1b){var _0x21a9ab;return db['SquareOdbc'][_0xcc10('0x46')]({'where':{'id':_0x2a6a3f[_0xcc10('0x4e')]['id']},'attributes':['id',_0xcc10('0x50')]})[_0xcc10('0x24')](handleEntityNotFound(_0x2bff81,null))[_0xcc10('0x24')](function(_0x3f72de){if(_0x3f72de){var _0x107edf=require('odbc')();_0x107edf[_0xcc10('0x51')](_0x3f72de[_0xcc10('0x50')]);_0x107edf[_0xcc10('0x52')]();return _0x3f72de;}})[_0xcc10('0x24')](respondWithResult(_0x2bff81,null))[_0xcc10('0x42')](handleError(_0x2bff81,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2a00360..c82110b 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 _0x1fbc=['SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x232e96,_0x33f06a){var _0x5acaea=function(_0x15b35a){while(--_0x15b35a){_0x232e96['push'](_0x232e96['shift']());}};_0x5acaea(++_0x33f06a);}(_0x1fbc,0x1be));var _0xc1fb=function(_0x1c0390,_0x355efc){_0x1c0390=_0x1c0390-0x0;var _0x315da7=_0x1fbc[_0x1c0390];return _0x315da7;};'use strict';var _=require(_0xc1fb('0x0'));var util=require(_0xc1fb('0x1'));var logger=require(_0xc1fb('0x2'))('api');var moment=require(_0xc1fb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1fb('0x4'));var rimraf=require(_0xc1fb('0x5'));var config=require(_0xc1fb('0x6'));var attributes=require(_0xc1fb('0x7'));module[_0xc1fb('0x8')]=function(_0x4d9c43,_0x22c4f6){return _0x4d9c43[_0xc1fb('0x9')](_0xc1fb('0xa'),attributes,{'tableName':_0xc1fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7256=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareOdbc','square_odbc','lodash'];(function(_0x105a8e,_0x12dd9a){var _0x298729=function(_0x3e9079){while(--_0x3e9079){_0x105a8e['push'](_0x105a8e['shift']());}};_0x298729(++_0x12dd9a);}(_0x7256,0x77));var _0x6725=function(_0x373119,_0x336dee){_0x373119=_0x373119-0x0;var _0x446d29=_0x7256[_0x373119];return _0x446d29;};'use strict';var _=require(_0x6725('0x0'));var util=require('util');var logger=require(_0x6725('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6725('0x2'));var rp=require(_0x6725('0x3'));var fs=require('fs');var path=require(_0x6725('0x4'));var rimraf=require(_0x6725('0x5'));var config=require(_0x6725('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x6725('0x7')]=function(_0x332b44,_0xd4a32d){return _0x332b44['define'](_0x6725('0x8'),attributes,{'tableName':_0x6725('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index cb2c4c4..c4fbf2a 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 _0xe0c0=['message','info','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','map','model','include','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s'];(function(_0x101ec3,_0x1635b6){var _0x2581af=function(_0x450515){while(--_0x450515){_0x101ec3['push'](_0x101ec3['shift']());}};_0x2581af(++_0x1635b6);}(_0xe0c0,0x1cd));var _0x0e0c=function(_0xdac3ab,_0x52c983){_0xdac3ab=_0xdac3ab-0x0;var _0x51d458=_0xe0c0[_0xdac3ab];return _0x51d458;};'use strict';var _=require(_0x0e0c('0x0'));var util=require(_0x0e0c('0x1'));var moment=require(_0x0e0c('0x2'));var BPromise=require(_0x0e0c('0x3'));var rs=require(_0x0e0c('0x4'));var fs=require('fs');var Redis=require(_0x0e0c('0x5'));var db=require(_0x0e0c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0e0c('0x7'));var jayson=require(_0x0e0c('0x8'));var client=jayson[_0x0e0c('0x9')][_0x0e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59f394,_0xe28709,_0x31431a){return new BPromise(function(_0x5badac,_0xd0cca9){return client[_0x0e0c('0xb')](_0x59f394,_0x31431a)[_0x0e0c('0xc')](function(_0x429901){logger['info']('SquareOdbc,\x20%s,\x20%s',_0xe28709,'request\x20sent');logger[_0x0e0c('0xd')](_0x0e0c('0xe'),_0xe28709,_0x0e0c('0xf'),JSON['stringify'](_0x429901));if(_0x429901[_0x0e0c('0x10')]){if(_0x429901['error'][_0x0e0c('0x11')]===0x1f4){logger[_0x0e0c('0x10')](_0x0e0c('0x12'),_0xe28709,_0x429901[_0x0e0c('0x10')]['message']);return _0xd0cca9(_0x429901[_0x0e0c('0x10')]['message']);}logger[_0x0e0c('0x10')](_0x0e0c('0x12'),_0xe28709,_0x429901[_0x0e0c('0x10')][_0x0e0c('0x13')]);return _0x5badac(_0x429901[_0x0e0c('0x10')][_0x0e0c('0x13')]);}else{logger[_0x0e0c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0xe28709,_0x0e0c('0xf'));_0x5badac(_0x429901[_0x0e0c('0x15')]['message']);}})[_0x0e0c('0x16')](function(_0x437fec){logger[_0x0e0c('0x10')](_0x0e0c('0x12'),_0xe28709,_0x437fec);_0xd0cca9(_0x437fec);});});}exports[_0x0e0c('0x17')]=function(_0xc6db7){var _0x3e2b32=this;return new Promise(function(_0x4fd5a0,_0x25d978){return db[_0x0e0c('0x18')]['find']({'raw':_0xc6db7[_0x0e0c('0x19')]?_0xc6db7['options'][_0x0e0c('0x1a')]===undefined?!![]:![]:!![],'where':_0xc6db7[_0x0e0c('0x19')]?_0xc6db7[_0x0e0c('0x19')]['where']||null:null,'attributes':_0xc6db7[_0x0e0c('0x19')]?_0xc6db7[_0x0e0c('0x19')][_0x0e0c('0x1b')]||null:null,'include':_0xc6db7['options']?_0xc6db7[_0x0e0c('0x19')]['include']?_[_0x0e0c('0x1c')](_0xc6db7['options']['include'],function(_0x5bf5ee){return{'model':db[_0x5bf5ee[_0x0e0c('0x1d')]],'as':_0x5bf5ee['as'],'attributes':_0x5bf5ee[_0x0e0c('0x1b')],'include':_0x5bf5ee[_0x0e0c('0x1e')]?_[_0x0e0c('0x1c')](_0x5bf5ee[_0x0e0c('0x1e')],function(_0x1f046f){return{'model':db[_0x1f046f['model']],'as':_0x1f046f['as'],'attributes':_0x1f046f[_0x0e0c('0x1b')],'include':_0x1f046f[_0x0e0c('0x1e')]?_[_0x0e0c('0x1c')](_0x1f046f['include'],function(_0x5c1dab){return{'model':db[_0x5c1dab['model']],'as':_0x5c1dab['as'],'attributes':_0x5c1dab[_0x0e0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0e0c('0xc')](function(_0x3b2e96){logger[_0x0e0c('0x14')]('ShowSquareOdbc',_0xc6db7);logger[_0x0e0c('0xd')](_0x0e0c('0x17'),_0xc6db7,JSON[_0x0e0c('0x1f')](_0x3b2e96));_0x4fd5a0(_0x3b2e96);})['catch'](function(_0x10ddf9){logger[_0x0e0c('0x10')](_0x0e0c('0x17'),_0x10ddf9[_0x0e0c('0x13')],_0xc6db7);_0x25d978(_0x3e2b32[_0x0e0c('0x10')](0x1f4,_0x10ddf9[_0x0e0c('0x13')]));});});}; \ No newline at end of file +var _0x5366=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','map','include','model','lodash','moment'];(function(_0x1851dc,_0x47b570){var _0x37abb4=function(_0x4a3244){while(--_0x4a3244){_0x1851dc['push'](_0x1851dc['shift']());}};_0x37abb4(++_0x47b570);}(_0x5366,0x134));var _0x6536=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5366[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x6536('0x0'));var util=require('util');var moment=require(_0x6536('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6536('0x2'));var db=require(_0x6536('0x3'))['db'];var utils=require(_0x6536('0x4'));var logger=require(_0x6536('0x5'))(_0x6536('0x6'));var config=require('../../config/environment');var jayson=require(_0x6536('0x7'));var client=jayson['client'][_0x6536('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30e09f,_0xfbf468,_0x2e2597){return new BPromise(function(_0x1a259,_0xb24339){return client[_0x6536('0x9')](_0x30e09f,_0x2e2597)[_0x6536('0xa')](function(_0x4259c7){logger[_0x6536('0xb')](_0x6536('0xc'),_0xfbf468,'request\x20sent');logger[_0x6536('0xd')](_0x6536('0xe'),_0xfbf468,_0x6536('0xf'),JSON[_0x6536('0x10')](_0x4259c7));if(_0x4259c7[_0x6536('0x11')]){if(_0x4259c7[_0x6536('0x11')][_0x6536('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x4259c7['error']['message']);return _0xb24339(_0x4259c7[_0x6536('0x11')][_0x6536('0x13')]);}logger[_0x6536('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x4259c7['error'][_0x6536('0x13')]);return _0x1a259(_0x4259c7['error'][_0x6536('0x13')]);}else{logger[_0x6536('0xb')](_0x6536('0xc'),_0xfbf468,_0x6536('0xf'));_0x1a259(_0x4259c7[_0x6536('0x14')][_0x6536('0x13')]);}})[_0x6536('0x15')](function(_0x3117b3){logger[_0x6536('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xfbf468,_0x3117b3);_0xb24339(_0x3117b3);});});}exports[_0x6536('0x16')]=function(_0x8a2859){var _0x5afe1d=this;return new Promise(function(_0x17e71e,_0x94b612){return db[_0x6536('0x17')]['find']({'raw':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x19')]===undefined?!![]:![]:!![],'where':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x1a')]||null:null,'attributes':_0x8a2859[_0x6536('0x18')]?_0x8a2859[_0x6536('0x18')][_0x6536('0x1b')]||null:null,'include':_0x8a2859[_0x6536('0x18')]?_0x8a2859['options']['include']?_[_0x6536('0x1c')](_0x8a2859[_0x6536('0x18')][_0x6536('0x1d')],function(_0x48dd93){return{'model':db[_0x48dd93[_0x6536('0x1e')]],'as':_0x48dd93['as'],'attributes':_0x48dd93[_0x6536('0x1b')],'include':_0x48dd93[_0x6536('0x1d')]?_[_0x6536('0x1c')](_0x48dd93[_0x6536('0x1d')],function(_0x395b65){return{'model':db[_0x395b65[_0x6536('0x1e')]],'as':_0x395b65['as'],'attributes':_0x395b65[_0x6536('0x1b')],'include':_0x395b65[_0x6536('0x1d')]?_['map'](_0x395b65[_0x6536('0x1d')],function(_0x3d712a){return{'model':db[_0x3d712a['model']],'as':_0x3d712a['as'],'attributes':_0x3d712a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6536('0xa')](function(_0x46530f){logger[_0x6536('0xb')](_0x6536('0x16'),_0x8a2859);logger[_0x6536('0xd')]('ShowSquareOdbc',_0x8a2859,JSON[_0x6536('0x10')](_0x46530f));_0x17e71e(_0x46530f);})['catch'](function(_0x133bf9){logger[_0x6536('0x11')](_0x6536('0x16'),_0x133bf9['message'],_0x8a2859);_0x94b612(_0x5afe1d[_0x6536('0x11')](0x1f4,_0x133bf9[_0x6536('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a59aa85..e3f8133 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 _0x8d23=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x8d23,0x166));var _0x38d2=function(_0x54e0e3,_0x305138){_0x54e0e3=_0x54e0e3-0x0;var _0x5ed78c=_0x8d23[_0x54e0e3];return _0x5ed78c;};'use strict';var multer=require(_0x38d2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x38d2('0x1'));var express=require(_0x38d2('0x2'));var router=express['Router']();var fs_extra=require(_0x38d2('0x3'));var auth=require(_0x38d2('0x4'));var interaction=require(_0x38d2('0x5'));var config=require('../../config/environment');var controller=require(_0x38d2('0x6'));router[_0x38d2('0x7')]('/',auth[_0x38d2('0x8')](),controller[_0x38d2('0x9')]);router[_0x38d2('0x7')](_0x38d2('0xa'),auth['isAuthenticated'](),controller[_0x38d2('0xb')]);router[_0x38d2('0xc')]('/',auth['isAuthenticated'](),controller[_0x38d2('0xd')]);router[_0x38d2('0xe')](_0x38d2('0xa'),auth[_0x38d2('0x8')](),controller['update']);router[_0x38d2('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x38d2('0x10')]=router; \ No newline at end of file +var _0xe837=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util'];(function(_0x245891,_0x5bedf9){var _0x59dfa8=function(_0x288c2f){while(--_0x288c2f){_0x245891['push'](_0x245891['shift']());}};_0x59dfa8(++_0x5bedf9);}(_0xe837,0xae));var _0x7e83=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xe837[_0x4bb581];return _0x316bf5;};'use strict';var multer=require(_0x7e83('0x0'));var util=require(_0x7e83('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e83('0x2'));var router=express[_0x7e83('0x3')]();var fs_extra=require(_0x7e83('0x4'));var auth=require(_0x7e83('0x5'));var interaction=require(_0x7e83('0x6'));var config=require(_0x7e83('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7e83('0x8')]);router['get'](_0x7e83('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7e83('0xa')](),controller[_0x7e83('0xb')]);router['put']('/:id',auth[_0x7e83('0xa')](),controller[_0x7e83('0xc')]);router[_0x7e83('0xd')](_0x7e83('0x9'),auth['isAuthenticated'](),controller[_0x7e83('0xe')]);module[_0x7e83('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 7785cdd..2c96586 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 _0x6f85=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue'];(function(_0x8d5de5,_0x143d83){var _0x400b7d=function(_0x2abd97){while(--_0x2abd97){_0x8d5de5['push'](_0x8d5de5['shift']());}};_0x400b7d(++_0x143d83);}(_0x6f85,0xe9));var _0x56f8=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6f85[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x56f8('0x0'));module[_0x56f8('0x1')]={'name':{'type':Sequelize[_0x56f8('0x2')],'unique':_0x56f8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x56f8('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x56f8('0x5')),'get':function(){if(this[_0x56f8('0x6')](_0x56f8('0x7'))){return this[_0x56f8('0x6')]('preproduction')[_0x56f8('0x8')](_0x56f8('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x56f8('0x5')),'get':function(){if(this[_0x56f8('0x6')](_0x56f8('0xa'))){return this[_0x56f8('0x6')](_0x56f8('0xa'))[_0x56f8('0x8')](_0x56f8('0x9'));}}},'savedAt':{'type':Sequelize[_0x56f8('0xb')]},'publishedAt':{'type':Sequelize[_0x56f8('0xb')]}}; \ No newline at end of file +var _0xe1fc=['utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','toString'];(function(_0x209ee1,_0x16c7f6){var _0x399881=function(_0xd7ea8e){while(--_0xd7ea8e){_0x209ee1['push'](_0x209ee1['shift']());}};_0x399881(++_0x16c7f6);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xe1fc[_0x2f4c1c];return _0x25e0f2;};'use strict';var Sequelize=require(_0xce1f('0x0'));module['exports']={'name':{'type':Sequelize[_0xce1f('0x1')],'unique':_0xce1f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xce1f('0x3')]},'preproduction':{'type':Sequelize[_0xce1f('0x4')](_0xce1f('0x5')),'get':function(){if(this['getDataValue'](_0xce1f('0x6'))){return this[_0xce1f('0x7')](_0xce1f('0x6'))[_0xce1f('0x8')](_0xce1f('0x9'));}}},'production':{'type':Sequelize[_0xce1f('0x4')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0xce1f('0x7')](_0xce1f('0xa'))[_0xce1f('0x8')](_0xce1f('0x9'));}}},'savedAt':{'type':Sequelize[_0xce1f('0xb')]},'publishedAt':{'type':Sequelize[_0xce1f('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index c1cfd68..94586ef 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 _0x2aeb=['UserProfileResource','publish','stringify','end','error','stack','name','send','index','rawAttributes','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','include','SquareProject','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','Content-Range','update','then','destroy','get','SquareProjects'];(function(_0x495dc2,_0x496604){var _0x49bafc=function(_0x4a9e68){while(--_0x4a9e68){_0x495dc2['push'](_0x495dc2['shift']());}};_0x49bafc(++_0x496604);}(_0x2aeb,0x18a));var _0xb2ae=function(_0x3e60ea,_0x201369){_0x3e60ea=_0x3e60ea-0x0;var _0x515872=_0x2aeb[_0x3e60ea];return _0x515872;};'use strict';var _=require(_0xb2ae('0x0'));var Redis=require(_0xb2ae('0x1'));var qs=require(_0xb2ae('0x2'));var logger=require(_0xb2ae('0x3'))('api');var config=require(_0xb2ae('0x4'));var db=require('../../mysqldb')['db'];config[_0xb2ae('0x5')]=_['defaults'](config[_0xb2ae('0x5')],{'host':_0xb2ae('0x6'),'port':0x18eb});var socket=require(_0xb2ae('0x7'))(new Redis(config[_0xb2ae('0x5')]));require('./squareProject.socket')[_0xb2ae('0x8')](socket);function respondWithResult(_0x1fd8bc,_0x142cc5){_0x142cc5=_0x142cc5||0xc8;return function(_0xdde947){if(_0xdde947){return _0x1fd8bc[_0xb2ae('0x9')](_0x142cc5)['json'](_0xdde947);}};}function respondWithFilteredResult(_0x35cea7,_0x2311e3){return function(_0xc671da){if(_0xc671da){var _0x3b2ab2=typeof _0x2311e3[_0xb2ae('0xa')]===_0xb2ae('0xb')&&typeof _0x2311e3[_0xb2ae('0xc')]===_0xb2ae('0xb');var _0x30c628=_0xc671da['count'];var _0x56d87a=_0x3b2ab2?0x0:_0x2311e3[_0xb2ae('0xa')];var _0x390a87=_0x3b2ab2?_0xc671da[_0xb2ae('0xd')]:_0x2311e3[_0xb2ae('0xa')]+_0x2311e3[_0xb2ae('0xc')];var _0x35159c;if(_0x390a87>=_0x30c628){_0x390a87=_0x30c628;_0x35159c=0xc8;}else{_0x35159c=0xce;}_0x35cea7['status'](_0x35159c);return _0x35cea7['set'](_0xb2ae('0xe'),_0x56d87a+'-'+_0x390a87+'/'+_0x30c628)['json'](_0xc671da);}return null;};}function saveUpdates(_0x5ebc04){return function(_0x2ab243){if(_0x2ab243){return _0x2ab243[_0xb2ae('0xf')](_0x5ebc04)[_0xb2ae('0x10')](function(_0x53f10e){return _0x53f10e;});}return null;};}function removeEntity(_0x36b272){return function(_0x2bcad6){if(_0x2bcad6){return _0x2bcad6[_0xb2ae('0x11')]()['then'](function(){var _0x42d9a1=_0x2bcad6[_0xb2ae('0x12')]({'plain':!![]});var _0x43f8bf=_0xb2ae('0x13');return db[_0xb2ae('0x14')][_0xb2ae('0x11')]({'where':{'type':_0x43f8bf,'resourceId':_0x42d9a1['id']}})['then'](function(){return _0x2bcad6;});})['then'](function(){var _0x1fd178=new Redis(config['redis']);_0x1fd178[_0xb2ae('0x15')]('agi',JSON[_0xb2ae('0x16')]({'id':_0x2bcad6['id'],'deleted':!![]}));})[_0xb2ae('0x10')](function(){_0x36b272['status'](0xcc)[_0xb2ae('0x17')]();});}};}function handleEntityNotFound(_0x58da08){return function(_0x3c2f44){if(!_0x3c2f44){_0x58da08['sendStatus'](0x194);}return _0x3c2f44;};}function handleError(_0x1eb558,_0x1c1dae){_0x1c1dae=_0x1c1dae||0x1f4;return function(_0x119b04){logger[_0xb2ae('0x18')](_0x119b04[_0xb2ae('0x19')]);if(_0x119b04[_0xb2ae('0x1a')]){delete _0x119b04[_0xb2ae('0x1a')];}_0x1eb558['status'](_0x1c1dae)[_0xb2ae('0x1b')](_0x119b04);};}exports[_0xb2ae('0x1c')]=function(_0x9d402f,_0x473340){var _0x13c058={},_0x5c82ed={},_0x242b98={'count':0x0,'rows':[]};var _0x2a0044=_['map'](db['SquareProject'][_0xb2ae('0x1d')],function(_0x3001e1){return{'name':_0x3001e1['fieldName'],'type':_0x3001e1['type'][_0xb2ae('0x1e')]};});_0x5c82ed[_0xb2ae('0x1f')]=_[_0xb2ae('0x20')](_0x2a0044,_0xb2ae('0x1a'));_0x5c82ed['query']=_[_0xb2ae('0x21')](_0x9d402f[_0xb2ae('0x22')]);_0x5c82ed['filters']=_[_0xb2ae('0x23')](_0x5c82ed[_0xb2ae('0x1f')],_0x5c82ed[_0xb2ae('0x22')]);_0x13c058[_0xb2ae('0x24')]=_['intersection'](_0x5c82ed[_0xb2ae('0x1f')],qs[_0xb2ae('0x25')](_0x9d402f[_0xb2ae('0x22')]['fields']));_0x13c058[_0xb2ae('0x24')]=_0x13c058[_0xb2ae('0x24')][_0xb2ae('0x26')]?_0x13c058['attributes']:_0x5c82ed['model'];if(!_0x9d402f[_0xb2ae('0x22')][_0xb2ae('0x27')](_0xb2ae('0x28'))){_0x13c058[_0xb2ae('0xc')]=qs[_0xb2ae('0xc')](_0x9d402f[_0xb2ae('0x22')]['limit']);_0x13c058['offset']=qs[_0xb2ae('0xa')](_0x9d402f['query']['offset']);}_0x13c058[_0xb2ae('0x29')]=qs[_0xb2ae('0x2a')](_0x9d402f['query'][_0xb2ae('0x2a')]);_0x13c058[_0xb2ae('0x2b')]=qs['filters'](_['pick'](_0x9d402f[_0xb2ae('0x22')],_0x5c82ed[_0xb2ae('0x2c')]),_0x2a0044);if(_0x9d402f['query']['filter']){_0x13c058['where']=_[_0xb2ae('0x2d')](_0x13c058[_0xb2ae('0x2b')],{'$or':_['map'](_0x2a0044,function(_0x2769da){if(_0x2769da[_0xb2ae('0x2e')]!==_0xb2ae('0x2f')){var _0x11ddd5={};_0x11ddd5[_0x2769da[_0xb2ae('0x1a')]]={'$like':'%'+_0x9d402f[_0xb2ae('0x22')][_0xb2ae('0x30')]+'%'};return _0x11ddd5;}})});}_0x13c058=_[_0xb2ae('0x2d')]({},_0x13c058,_0x9d402f['options']);var _0x19bbcf={'where':_0x13c058['where']};return db['SquareProject']['count'](_0x19bbcf)[_0xb2ae('0x10')](function(_0x3d88fc){_0x242b98[_0xb2ae('0xd')]=_0x3d88fc;if(_0x9d402f['query']['includeAll']){_0x13c058[_0xb2ae('0x31')]=[{'all':!![]}];}return db[_0xb2ae('0x32')][_0xb2ae('0x33')](_0x13c058);})['then'](function(_0x2cad3e){_0x242b98[_0xb2ae('0x34')]=_0x2cad3e;return _0x242b98;})[_0xb2ae('0x10')](respondWithFilteredResult(_0x473340,_0x13c058))[_0xb2ae('0x35')](handleError(_0x473340,null));};exports[_0xb2ae('0x36')]=function(_0x11bbf0,_0x2ef571){var _0x106aa1={'raw':![],'where':{'id':_0x11bbf0[_0xb2ae('0x37')]['id']}},_0x4335e5={};_0x4335e5['model']=_['keys'](db[_0xb2ae('0x32')]['rawAttributes']);_0x4335e5['query']=_['keys'](_0x11bbf0[_0xb2ae('0x22')]);_0x4335e5[_0xb2ae('0x2c')]=_[_0xb2ae('0x23')](_0x4335e5[_0xb2ae('0x1f')],_0x4335e5[_0xb2ae('0x22')]);_0x106aa1[_0xb2ae('0x24')]=_['intersection'](_0x4335e5['model'],qs[_0xb2ae('0x25')](_0x11bbf0[_0xb2ae('0x22')][_0xb2ae('0x25')]));_0x106aa1['attributes']=_0x106aa1['attributes']['length']?_0x106aa1[_0xb2ae('0x24')]:_0x4335e5['model'];if(_0x11bbf0[_0xb2ae('0x22')][_0xb2ae('0x38')]){_0x106aa1[_0xb2ae('0x31')]=[{'all':!![]}];}_0x106aa1=_[_0xb2ae('0x2d')]({},_0x106aa1,_0x11bbf0['options']);return db[_0xb2ae('0x32')][_0xb2ae('0x39')](_0x106aa1)[_0xb2ae('0x10')](handleEntityNotFound(_0x2ef571,null))[_0xb2ae('0x10')](respondWithResult(_0x2ef571,null))['catch'](handleError(_0x2ef571,null));};exports[_0xb2ae('0x3a')]=function(_0x3284d5,_0x23ca07){return db[_0xb2ae('0x32')][_0xb2ae('0x3a')](_0x3284d5[_0xb2ae('0x3b')],{})[_0xb2ae('0x10')](function(_0x5ee09a){var _0xc7467b=_0x3284d5[_0xb2ae('0x3c')]['get']({'plain':!![]});if(!_0xc7467b)throw new Error(_0xb2ae('0x3d'));if(_0xc7467b['role']===_0xb2ae('0x3c')){var _0x483e33=_0x5ee09a['get']({'plain':!![]});var _0x1b2fa7=_0xb2ae('0x13');return db[_0xb2ae('0x3e')]['find']({'where':{'name':_0x1b2fa7,'userProfileId':_0xc7467b[_0xb2ae('0x3f')]},'raw':!![]})[_0xb2ae('0x10')](function(_0x454f0a){if(_0x454f0a&&_0x454f0a[_0xb2ae('0x40')]===0x0){return db[_0xb2ae('0x14')][_0xb2ae('0x3a')]({'name':_0x483e33[_0xb2ae('0x1a')],'resourceId':_0x483e33['id'],'type':_0x454f0a[_0xb2ae('0x1a')],'sectionId':_0x454f0a['id']},{})[_0xb2ae('0x10')](function(){return _0x5ee09a;});}else{return _0x5ee09a;}})[_0xb2ae('0x35')](function(_0x1095b6){logger[_0xb2ae('0x18')](_0xb2ae('0x41'),_0x1095b6);throw _0x1095b6;});}return _0x5ee09a;})['then'](respondWithResult(_0x23ca07,0xc9))[_0xb2ae('0x35')](handleError(_0x23ca07,null));};exports['update']=function(_0x1ef866,_0x270eae){if(_0x1ef866[_0xb2ae('0x3b')]['id']){delete _0x1ef866[_0xb2ae('0x3b')]['id'];}return db[_0xb2ae('0x32')]['find']({'where':{'id':_0x1ef866[_0xb2ae('0x37')]['id']}})['then'](handleEntityNotFound(_0x270eae,null))[_0xb2ae('0x10')](saveUpdates(_0x1ef866[_0xb2ae('0x3b')],null))[_0xb2ae('0x10')](function(_0x56dc02){if(!_0x56dc02)return;var _0x2db2c7=_0x56dc02[_0xb2ae('0x12')]({'plain':!![]});return _0x2db2c7;})['then'](function(_0x2cf368){var _0x5f4b4b=new Redis(config[_0xb2ae('0x5')]);_0x5f4b4b[_0xb2ae('0x15')](_0xb2ae('0x42'),JSON[_0xb2ae('0x16')](_[_0xb2ae('0x43')](_0x2cf368,['id',_0xb2ae('0x1a'),_0xb2ae('0x44')])));return _0x2cf368;})[_0xb2ae('0x10')](respondWithResult(_0x270eae,null))[_0xb2ae('0x35')](handleError(_0x270eae,null));};exports[_0xb2ae('0x11')]=function(_0x2f2a63,_0x41f6bc){return db[_0xb2ae('0x32')]['find']({'where':{'id':_0x2f2a63[_0xb2ae('0x37')]['id']}})[_0xb2ae('0x10')](handleEntityNotFound(_0x41f6bc,null))[_0xb2ae('0x10')](removeEntity(_0x41f6bc,null))[_0xb2ae('0x35')](handleError(_0x41f6bc,null));}; \ No newline at end of file +var _0x53ba=['count','set','then','get','SquareProjects','UserProfileResource','publish','agi','end','sendStatus','stack','name','send','map','SquareProject','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit'];(function(_0x2b8d9e,_0x38f52a){var _0x380e14=function(_0xfc9680){while(--_0xfc9680){_0x2b8d9e['push'](_0x2b8d9e['shift']());}};_0x380e14(++_0x38f52a);}(_0x53ba,0x18e));var _0xa53b=function(_0x902b9c,_0x57b164){_0x902b9c=_0x902b9c-0x0;var _0x230e34=_0x53ba[_0x902b9c];return _0x230e34;};'use strict';var _=require(_0xa53b('0x0'));var Redis=require(_0xa53b('0x1'));var qs=require(_0xa53b('0x2'));var logger=require(_0xa53b('0x3'))('api');var config=require(_0xa53b('0x4'));var db=require(_0xa53b('0x5'))['db'];config[_0xa53b('0x6')]=_['defaults'](config[_0xa53b('0x6')],{'host':_0xa53b('0x7'),'port':0x18eb});var socket=require(_0xa53b('0x8'))(new Redis(config['redis']));require(_0xa53b('0x9'))[_0xa53b('0xa')](socket);function respondWithResult(_0x482a56,_0x52d9ca){_0x52d9ca=_0x52d9ca||0xc8;return function(_0x3fcdfe){if(_0x3fcdfe){return _0x482a56[_0xa53b('0xb')](_0x52d9ca)[_0xa53b('0xc')](_0x3fcdfe);}};}function respondWithFilteredResult(_0x157f11,_0x238c6b){return function(_0x4c36b1){if(_0x4c36b1){var _0x127938=typeof _0x238c6b[_0xa53b('0xd')]===_0xa53b('0xe')&&typeof _0x238c6b[_0xa53b('0xf')]===_0xa53b('0xe');var _0x41481c=_0x4c36b1[_0xa53b('0x10')];var _0x47434d=_0x127938?0x0:_0x238c6b[_0xa53b('0xd')];var _0x5df1a0=_0x127938?_0x4c36b1[_0xa53b('0x10')]:_0x238c6b[_0xa53b('0xd')]+_0x238c6b['limit'];var _0x2d2ea6;if(_0x5df1a0>=_0x41481c){_0x5df1a0=_0x41481c;_0x2d2ea6=0xc8;}else{_0x2d2ea6=0xce;}_0x157f11[_0xa53b('0xb')](_0x2d2ea6);return _0x157f11[_0xa53b('0x11')]('Content-Range',_0x47434d+'-'+_0x5df1a0+'/'+_0x41481c)[_0xa53b('0xc')](_0x4c36b1);}return null;};}function saveUpdates(_0x3cc8d1){return function(_0x3ca0f3){if(_0x3ca0f3){return _0x3ca0f3['update'](_0x3cc8d1)['then'](function(_0x10bc46){return _0x10bc46;});}return null;};}function removeEntity(_0x56a921){return function(_0x26ddff){if(_0x26ddff){return _0x26ddff['destroy']()[_0xa53b('0x12')](function(){var _0x367b1e=_0x26ddff[_0xa53b('0x13')]({'plain':!![]});var _0x52e7f7=_0xa53b('0x14');return db[_0xa53b('0x15')]['destroy']({'where':{'type':_0x52e7f7,'resourceId':_0x367b1e['id']}})[_0xa53b('0x12')](function(){return _0x26ddff;});})[_0xa53b('0x12')](function(){var _0x300a8d=new Redis(config['redis']);_0x300a8d[_0xa53b('0x16')](_0xa53b('0x17'),JSON['stringify']({'id':_0x26ddff['id'],'deleted':!![]}));})[_0xa53b('0x12')](function(){_0x56a921[_0xa53b('0xb')](0xcc)[_0xa53b('0x18')]();});}};}function handleEntityNotFound(_0x319a3d){return function(_0x483bea){if(!_0x483bea){_0x319a3d[_0xa53b('0x19')](0x194);}return _0x483bea;};}function handleError(_0x4bd53c,_0x1d09e7){_0x1d09e7=_0x1d09e7||0x1f4;return function(_0x223e7d){logger['error'](_0x223e7d[_0xa53b('0x1a')]);if(_0x223e7d['name']){delete _0x223e7d[_0xa53b('0x1b')];}_0x4bd53c[_0xa53b('0xb')](_0x1d09e7)[_0xa53b('0x1c')](_0x223e7d);};}exports['index']=function(_0x1e2eed,_0x42c0c9){var _0x2b3fd7={},_0x495683={},_0x4afea5={'count':0x0,'rows':[]};var _0x2e1848=_[_0xa53b('0x1d')](db[_0xa53b('0x1e')]['rawAttributes'],function(_0x26b7cf){return{'name':_0x26b7cf['fieldName'],'type':_0x26b7cf[_0xa53b('0x1f')][_0xa53b('0x20')]};});_0x495683['model']=_[_0xa53b('0x1d')](_0x2e1848,_0xa53b('0x1b'));_0x495683['query']=_[_0xa53b('0x21')](_0x1e2eed[_0xa53b('0x22')]);_0x495683[_0xa53b('0x23')]=_[_0xa53b('0x24')](_0x495683[_0xa53b('0x25')],_0x495683[_0xa53b('0x22')]);_0x2b3fd7[_0xa53b('0x26')]=_[_0xa53b('0x24')](_0x495683[_0xa53b('0x25')],qs[_0xa53b('0x27')](_0x1e2eed[_0xa53b('0x22')][_0xa53b('0x27')]));_0x2b3fd7['attributes']=_0x2b3fd7[_0xa53b('0x26')][_0xa53b('0x28')]?_0x2b3fd7['attributes']:_0x495683[_0xa53b('0x25')];if(!_0x1e2eed[_0xa53b('0x22')][_0xa53b('0x29')](_0xa53b('0x2a'))){_0x2b3fd7[_0xa53b('0xf')]=qs['limit'](_0x1e2eed['query'][_0xa53b('0xf')]);_0x2b3fd7[_0xa53b('0xd')]=qs['offset'](_0x1e2eed[_0xa53b('0x22')][_0xa53b('0xd')]);}_0x2b3fd7[_0xa53b('0x2b')]=qs['sort'](_0x1e2eed[_0xa53b('0x22')]['sort']);_0x2b3fd7[_0xa53b('0x2c')]=qs[_0xa53b('0x23')](_[_0xa53b('0x2d')](_0x1e2eed[_0xa53b('0x22')],_0x495683['filters']),_0x2e1848);if(_0x1e2eed[_0xa53b('0x22')]['filter']){_0x2b3fd7[_0xa53b('0x2c')]=_[_0xa53b('0x2e')](_0x2b3fd7[_0xa53b('0x2c')],{'$or':_[_0xa53b('0x1d')](_0x2e1848,function(_0x5c5d8a){if(_0x5c5d8a[_0xa53b('0x1f')]!==_0xa53b('0x2f')){var _0x14d152={};_0x14d152[_0x5c5d8a['name']]={'$like':'%'+_0x1e2eed['query'][_0xa53b('0x30')]+'%'};return _0x14d152;}})});}_0x2b3fd7=_[_0xa53b('0x2e')]({},_0x2b3fd7,_0x1e2eed[_0xa53b('0x31')]);var _0x364a18={'where':_0x2b3fd7['where']};return db[_0xa53b('0x1e')][_0xa53b('0x10')](_0x364a18)[_0xa53b('0x12')](function(_0x479ddc){_0x4afea5[_0xa53b('0x10')]=_0x479ddc;if(_0x1e2eed['query']['includeAll']){_0x2b3fd7['include']=[{'all':!![]}];}return db[_0xa53b('0x1e')][_0xa53b('0x32')](_0x2b3fd7);})[_0xa53b('0x12')](function(_0x6e38bb){_0x4afea5[_0xa53b('0x33')]=_0x6e38bb;return _0x4afea5;})['then'](respondWithFilteredResult(_0x42c0c9,_0x2b3fd7))[_0xa53b('0x34')](handleError(_0x42c0c9,null));};exports[_0xa53b('0x35')]=function(_0x30057b,_0x17a100){var _0xc61266={'raw':![],'where':{'id':_0x30057b[_0xa53b('0x36')]['id']}},_0x20021b={};_0x20021b[_0xa53b('0x25')]=_['keys'](db[_0xa53b('0x1e')][_0xa53b('0x37')]);_0x20021b['query']=_[_0xa53b('0x21')](_0x30057b['query']);_0x20021b[_0xa53b('0x23')]=_['intersection'](_0x20021b[_0xa53b('0x25')],_0x20021b[_0xa53b('0x22')]);_0xc61266[_0xa53b('0x26')]=_[_0xa53b('0x24')](_0x20021b['model'],qs[_0xa53b('0x27')](_0x30057b['query'][_0xa53b('0x27')]));_0xc61266['attributes']=_0xc61266[_0xa53b('0x26')][_0xa53b('0x28')]?_0xc61266['attributes']:_0x20021b[_0xa53b('0x25')];if(_0x30057b[_0xa53b('0x22')][_0xa53b('0x38')]){_0xc61266[_0xa53b('0x39')]=[{'all':!![]}];}_0xc61266=_[_0xa53b('0x2e')]({},_0xc61266,_0x30057b['options']);return db['SquareProject'][_0xa53b('0x3a')](_0xc61266)[_0xa53b('0x12')](handleEntityNotFound(_0x17a100,null))['then'](respondWithResult(_0x17a100,null))[_0xa53b('0x34')](handleError(_0x17a100,null));};exports[_0xa53b('0x3b')]=function(_0x13f021,_0x3eca8a){return db[_0xa53b('0x1e')][_0xa53b('0x3b')](_0x13f021[_0xa53b('0x3c')],{})['then'](function(_0x467c14){var _0x590ce9=_0x13f021[_0xa53b('0x3d')][_0xa53b('0x13')]({'plain':!![]});if(!_0x590ce9)throw new Error(_0xa53b('0x3e'));if(_0x590ce9[_0xa53b('0x3f')]==='user'){var _0x7608b4=_0x467c14['get']({'plain':!![]});var _0x3bfaac=_0xa53b('0x14');return db['UserProfileSection'][_0xa53b('0x3a')]({'where':{'name':_0x3bfaac,'userProfileId':_0x590ce9['userProfileId']},'raw':!![]})['then'](function(_0x34f56f){if(_0x34f56f&&_0x34f56f[_0xa53b('0x40')]===0x0){return db[_0xa53b('0x15')]['create']({'name':_0x7608b4[_0xa53b('0x1b')],'resourceId':_0x7608b4['id'],'type':_0x34f56f['name'],'sectionId':_0x34f56f['id']},{})[_0xa53b('0x12')](function(){return _0x467c14;});}else{return _0x467c14;}})['catch'](function(_0x159b89){logger[_0xa53b('0x41')](_0xa53b('0x42'),_0x159b89);throw _0x159b89;});}return _0x467c14;})['then'](respondWithResult(_0x3eca8a,0xc9))[_0xa53b('0x34')](handleError(_0x3eca8a,null));};exports[_0xa53b('0x43')]=function(_0x5712ec,_0x58148c){if(_0x5712ec[_0xa53b('0x3c')]['id']){delete _0x5712ec[_0xa53b('0x3c')]['id'];}return db[_0xa53b('0x1e')]['find']({'where':{'id':_0x5712ec['params']['id']}})['then'](handleEntityNotFound(_0x58148c,null))[_0xa53b('0x12')](saveUpdates(_0x5712ec['body'],null))[_0xa53b('0x12')](function(_0x1f5d0b){if(!_0x1f5d0b)return;var _0x7a332f=_0x1f5d0b[_0xa53b('0x13')]({'plain':!![]});return _0x7a332f;})['then'](function(_0x4d6baa){var _0x46fc12=new Redis(config[_0xa53b('0x6')]);_0x46fc12[_0xa53b('0x16')](_0xa53b('0x17'),JSON['stringify'](_[_0xa53b('0x2d')](_0x4d6baa,['id',_0xa53b('0x1b'),_0xa53b('0x44')])));return _0x4d6baa;})[_0xa53b('0x12')](respondWithResult(_0x58148c,null))[_0xa53b('0x34')](handleError(_0x58148c,null));};exports['destroy']=function(_0x45f12b,_0x5ad543){return db[_0xa53b('0x1e')][_0xa53b('0x3a')]({'where':{'id':_0x45f12b[_0xa53b('0x36')]['id']}})[_0xa53b('0x12')](handleEntityNotFound(_0x5ad543,null))[_0xa53b('0x12')](removeEntity(_0x5ad543,null))['catch'](handleError(_0x5ad543,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fbd0489..98d8fa1 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 _0xd2e0=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x529185,_0x5f5ef5){var _0x541314=function(_0x2c64cf){while(--_0x2c64cf){_0x529185['push'](_0x529185['shift']());}};_0x541314(++_0x5f5ef5);}(_0xd2e0,0x1d0));var _0x0d2e=function(_0x5f595c,_0x1a6851){_0x5f595c=_0x5f595c-0x0;var _0xd341e=_0xd2e0[_0x5f595c];return _0xd341e;};'use strict';var EventEmitter=require(_0x0d2e('0x0'));var SquareProject=require(_0x0d2e('0x1'))['db'][_0x0d2e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0d2e('0x3')](0x0);var events={'afterCreate':_0x0d2e('0x4'),'afterUpdate':_0x0d2e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x6550d0){return function(_0x17c22b,_0x4f8c15,_0x5ed42e){SquareProjectEvents[_0x0d2e('0x6')](_0x6550d0+':'+_0x17c22b['id'],_0x17c22b);SquareProjectEvents[_0x0d2e('0x6')](_0x6550d0,_0x17c22b);_0x5ed42e(null);};}for(var e in events){if(events[_0x0d2e('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x0d2e('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x2a22=['events','../../mysqldb','SquareProject','remove','emit','hasOwnProperty','hook','exports'];(function(_0x27d15a,_0x3e904b){var _0x4aedf1=function(_0x424141){while(--_0x424141){_0x27d15a['push'](_0x27d15a['shift']());}};_0x4aedf1(++_0x3e904b);}(_0x2a22,0x158));var _0x22a2=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2a22[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0x22a2('0x0'));var SquareProject=require(_0x22a2('0x1'))['db'][_0x22a2('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x22a2('0x3')};function emitEvent(_0x362c7c){return function(_0x5d322f,_0x324173,_0x221984){SquareProjectEvents[_0x22a2('0x4')](_0x362c7c+':'+_0x5d322f['id'],_0x5d322f);SquareProjectEvents[_0x22a2('0x4')](_0x362c7c,_0x5d322f);_0x221984(null);};}for(var e in events){if(events[_0x22a2('0x5')](e)){var event=events[e];SquareProject[_0x22a2('0x6')](e,emitEvent(event));}}module[_0x22a2('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3831494..7b13115 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 _0x654f=['moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x654f,0x1b4));var _0xf654=function(_0x41dc6e,_0xbc4620){_0x41dc6e=_0x41dc6e-0x0;var _0x32f851=_0x654f[_0x41dc6e];return _0x32f851;};'use strict';var _=require(_0xf654('0x0'));var util=require(_0xf654('0x1'));var logger=require(_0xf654('0x2'))(_0xf654('0x3'));var moment=require(_0xf654('0x4'));var BPromise=require('bluebird');var rp=require(_0xf654('0x5'));var fs=require('fs');var path=require(_0xf654('0x6'));var rimraf=require(_0xf654('0x7'));var config=require(_0xf654('0x8'));var attributes=require(_0xf654('0x9'));module[_0xf654('0xa')]=function(_0x4d35e2,_0x483c73){return _0x4d35e2[_0xf654('0xb')]('SquareProject',attributes,{'tableName':_0xf654('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d81e5,_0x44bda3,_0xbb5f1d){if(_0x5d81e5[_0xf654('0xd')](_0xf654('0xe'))){_0x5d81e5[_0xf654('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5d81e5[_0xf654('0xd')](_0xf654('0x10'))){_0x5d81e5[_0xf654('0x11')]=moment()[_0xf654('0x12')](_0xf654('0x13'));}_0xbb5f1d(null,_0x5d81e5);}}});}; \ No newline at end of file +var _0x7c03=['changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x21dca6,_0x322ca5){var _0x183068=function(_0x376af0){while(--_0x376af0){_0x21dca6['push'](_0x21dca6['shift']());}};_0x183068(++_0x322ca5);}(_0x7c03,0x1a4));var _0x37c0=function(_0x424e92,_0x48fc5c){_0x424e92=_0x424e92-0x0;var _0x316d3c=_0x7c03[_0x424e92];return _0x316d3c;};'use strict';var _=require(_0x37c0('0x0'));var util=require(_0x37c0('0x1'));var logger=require('../../config/logger')(_0x37c0('0x2'));var moment=require(_0x37c0('0x3'));var BPromise=require(_0x37c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37c0('0x5'));var rimraf=require(_0x37c0('0x6'));var config=require(_0x37c0('0x7'));var attributes=require(_0x37c0('0x8'));module[_0x37c0('0x9')]=function(_0x4f3c1c,_0x11541d){return _0x4f3c1c[_0x37c0('0xa')](_0x37c0('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2601d3,_0x1023b9,_0x501b4d){if(_0x2601d3[_0x37c0('0xc')]('preproduction')){_0x2601d3[_0x37c0('0xd')]=moment()[_0x37c0('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2601d3[_0x37c0('0xc')](_0x37c0('0xf'))){_0x2601d3[_0x37c0('0x10')]=moment()[_0x37c0('0xe')](_0x37c0('0x11'));}_0x501b4d(null,_0x2601d3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 71bb98c..84e909c 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 _0x7eb9=['limit','include','map','model','attributes','then','info','GetSquareProjects','stringify','error','message','find','ShowSquareProject','debug','catch','lodash','ioredis','../../config/logger','rpc','redis','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where'];(function(_0x13df40,_0x3140c5){var _0x44820e=function(_0x14fb6a){while(--_0x14fb6a){_0x13df40['push'](_0x13df40['shift']());}};_0x44820e(++_0x3140c5);}(_0x7eb9,0x114));var _0x97eb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7eb9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x97eb('0x0'));var Redis=require(_0x97eb('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x97eb('0x2'))(_0x97eb('0x3'));var config=require('../../config/environment');config[_0x97eb('0x4')]=_['defaults'](config[_0x97eb('0x4')],{'host':_0x97eb('0x5'),'port':0x18eb});var socket=require(_0x97eb('0x6'))(new Redis(config[_0x97eb('0x4')]));require(_0x97eb('0x7'))[_0x97eb('0x8')](socket);exports['GetSquareProjects']=function(_0x46a9b6){var _0x35d5b9=this;return new Promise(function(_0x1e83c2,_0x3f3db7){return db[_0x97eb('0x9')][_0x97eb('0xa')]({'raw':_0x46a9b6[_0x97eb('0xb')]?_0x46a9b6[_0x97eb('0xb')][_0x97eb('0xc')]===undefined?!![]:![]:!![],'where':_0x46a9b6['options']?_0x46a9b6[_0x97eb('0xb')][_0x97eb('0xd')]||null:null,'attributes':_0x46a9b6['options']?_0x46a9b6[_0x97eb('0xb')]['attributes']||null:null,'limit':_0x46a9b6[_0x97eb('0xb')]?_0x46a9b6[_0x97eb('0xb')][_0x97eb('0xe')]||null:null,'include':_0x46a9b6[_0x97eb('0xb')]?_0x46a9b6[_0x97eb('0xb')][_0x97eb('0xf')]?_[_0x97eb('0x10')](_0x46a9b6[_0x97eb('0xb')][_0x97eb('0xf')],function(_0x3501a7){return{'model':db[_0x3501a7[_0x97eb('0x11')]],'as':_0x3501a7['as'],'attributes':_0x3501a7[_0x97eb('0x12')],'include':_0x3501a7[_0x97eb('0xf')]?_[_0x97eb('0x10')](_0x3501a7['include'],function(_0x5b28c9){return{'model':db[_0x5b28c9['model']],'as':_0x5b28c9['as'],'attributes':_0x5b28c9[_0x97eb('0x12')],'include':_0x5b28c9[_0x97eb('0xf')]?_[_0x97eb('0x10')](_0x5b28c9[_0x97eb('0xf')],function(_0xf3e3d4){return{'model':db[_0xf3e3d4[_0x97eb('0x11')]],'as':_0xf3e3d4['as'],'attributes':_0xf3e3d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x97eb('0x13')](function(_0x6e603){logger[_0x97eb('0x14')](_0x97eb('0x15'),_0x46a9b6);logger['debug'](_0x97eb('0x15'),_0x46a9b6,JSON[_0x97eb('0x16')](_0x6e603));_0x1e83c2(_0x6e603);})['catch'](function(_0x6f71ed){logger[_0x97eb('0x17')](_0x97eb('0x15'),_0x6f71ed[_0x97eb('0x18')],_0x46a9b6);_0x3f3db7(_0x35d5b9['error'](0x1f4,_0x6f71ed['message']));});});};exports['ShowSquareProject']=function(_0x2b57dc){var _0x58ee53=this;return new Promise(function(_0x407cca,_0x44c551){return db[_0x97eb('0x9')][_0x97eb('0x19')]({'raw':_0x2b57dc['options']?_0x2b57dc[_0x97eb('0xb')][_0x97eb('0xc')]===undefined?!![]:![]:!![],'where':_0x2b57dc[_0x97eb('0xb')]?_0x2b57dc[_0x97eb('0xb')][_0x97eb('0xd')]||null:null,'attributes':_0x2b57dc[_0x97eb('0xb')]?_0x2b57dc['options']['attributes']||null:null,'include':_0x2b57dc[_0x97eb('0xb')]?_0x2b57dc[_0x97eb('0xb')]['include']?_[_0x97eb('0x10')](_0x2b57dc[_0x97eb('0xb')]['include'],function(_0x58a603){return{'model':db[_0x58a603[_0x97eb('0x11')]],'as':_0x58a603['as'],'attributes':_0x58a603['attributes'],'include':_0x58a603[_0x97eb('0xf')]?_[_0x97eb('0x10')](_0x58a603[_0x97eb('0xf')],function(_0x5e2b28){return{'model':db[_0x5e2b28[_0x97eb('0x11')]],'as':_0x5e2b28['as'],'attributes':_0x5e2b28[_0x97eb('0x12')],'include':_0x5e2b28[_0x97eb('0xf')]?_[_0x97eb('0x10')](_0x5e2b28[_0x97eb('0xf')],function(_0x5553ce){return{'model':db[_0x5553ce[_0x97eb('0x11')]],'as':_0x5553ce['as'],'attributes':_0x5553ce[_0x97eb('0x12')]};}):[]};}):[]};}):[]:[]})[_0x97eb('0x13')](function(_0x83d92e){logger['info'](_0x97eb('0x1a'),_0x2b57dc);logger[_0x97eb('0x1b')](_0x97eb('0x1a'),_0x2b57dc,JSON[_0x97eb('0x16')](_0x83d92e));_0x407cca(_0x83d92e);})[_0x97eb('0x1c')](function(_0x595ed3){logger['error'](_0x97eb('0x1a'),_0x595ed3['message'],_0x2b57dc);_0x44c551(_0x58ee53[_0x97eb('0x17')](0x1f4,_0x595ed3[_0x97eb('0x18')]));});});}; \ No newline at end of file +var _0x6dc5=['localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','include','map','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','where','model','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x6dc5,0x161));var _0x56dc=function(_0x530f66,_0x5c92ae){_0x530f66=_0x530f66-0x0;var _0x384937=_0x6dc5[_0x530f66];return _0x384937;};'use strict';var _=require(_0x56dc('0x0'));var Redis=require(_0x56dc('0x1'));var db=require(_0x56dc('0x2'))['db'];var logger=require(_0x56dc('0x3'))('rpc');var config=require(_0x56dc('0x4'));config[_0x56dc('0x5')]=_[_0x56dc('0x6')](config[_0x56dc('0x5')],{'host':_0x56dc('0x7'),'port':0x18eb});var socket=require(_0x56dc('0x8'))(new Redis(config[_0x56dc('0x5')]));require(_0x56dc('0x9'))[_0x56dc('0xa')](socket);exports[_0x56dc('0xb')]=function(_0x1f37a8){var _0x4a54b7=this;return new Promise(function(_0x1bdb87,_0x5c5626){return db[_0x56dc('0xc')][_0x56dc('0xd')]({'raw':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0xf')]===undefined?!![]:![]:!![],'where':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')]['where']||null:null,'attributes':_0x1f37a8['options']?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x10')]||null:null,'limit':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')]['limit']||null:null,'include':_0x1f37a8[_0x56dc('0xe')]?_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x11')]?_['map'](_0x1f37a8[_0x56dc('0xe')][_0x56dc('0x11')],function(_0x273ae1){return{'model':db[_0x273ae1['model']],'as':_0x273ae1['as'],'attributes':_0x273ae1[_0x56dc('0x10')],'include':_0x273ae1['include']?_[_0x56dc('0x12')](_0x273ae1[_0x56dc('0x11')],function(_0x4a7e90){return{'model':db[_0x4a7e90['model']],'as':_0x4a7e90['as'],'attributes':_0x4a7e90[_0x56dc('0x10')],'include':_0x4a7e90[_0x56dc('0x11')]?_[_0x56dc('0x12')](_0x4a7e90[_0x56dc('0x11')],function(_0xb20e8d){return{'model':db[_0xb20e8d['model']],'as':_0xb20e8d['as'],'attributes':_0xb20e8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x56dc('0x13')](function(_0x4bd960){logger[_0x56dc('0x14')]('GetSquareProjects',_0x1f37a8);logger[_0x56dc('0x15')](_0x56dc('0xb'),_0x1f37a8,JSON[_0x56dc('0x16')](_0x4bd960));_0x1bdb87(_0x4bd960);})[_0x56dc('0x17')](function(_0x3a5365){logger['error'](_0x56dc('0xb'),_0x3a5365[_0x56dc('0x18')],_0x1f37a8);_0x5c5626(_0x4a54b7[_0x56dc('0x19')](0x1f4,_0x3a5365[_0x56dc('0x18')]));});});};exports[_0x56dc('0x1a')]=function(_0x27c394){var _0x3e1c8a=this;return new Promise(function(_0x283d56,_0x44fea7){return db['SquareProject'][_0x56dc('0x1b')]({'raw':_0x27c394[_0x56dc('0xe')]?_0x27c394[_0x56dc('0xe')][_0x56dc('0xf')]===undefined?!![]:![]:!![],'where':_0x27c394['options']?_0x27c394['options'][_0x56dc('0x1c')]||null:null,'attributes':_0x27c394[_0x56dc('0xe')]?_0x27c394['options'][_0x56dc('0x10')]||null:null,'include':_0x27c394[_0x56dc('0xe')]?_0x27c394[_0x56dc('0xe')][_0x56dc('0x11')]?_[_0x56dc('0x12')](_0x27c394[_0x56dc('0xe')][_0x56dc('0x11')],function(_0x47c2a8){return{'model':db[_0x47c2a8[_0x56dc('0x1d')]],'as':_0x47c2a8['as'],'attributes':_0x47c2a8[_0x56dc('0x10')],'include':_0x47c2a8[_0x56dc('0x11')]?_['map'](_0x47c2a8[_0x56dc('0x11')],function(_0x31ff0b){return{'model':db[_0x31ff0b['model']],'as':_0x31ff0b['as'],'attributes':_0x31ff0b['attributes'],'include':_0x31ff0b['include']?_['map'](_0x31ff0b[_0x56dc('0x11')],function(_0x594ce2){return{'model':db[_0x594ce2[_0x56dc('0x1d')]],'as':_0x594ce2['as'],'attributes':_0x594ce2[_0x56dc('0x10')]};}):[]};}):[]};}):[]:[]})[_0x56dc('0x13')](function(_0x296385){logger[_0x56dc('0x14')](_0x56dc('0x1a'),_0x27c394);logger['debug'](_0x56dc('0x1a'),_0x27c394,JSON[_0x56dc('0x16')](_0x296385));_0x283d56(_0x296385);})[_0x56dc('0x17')](function(_0x1813ef){logger['error'](_0x56dc('0x1a'),_0x1813ef['message'],_0x27c394);_0x44fea7(_0x3e1c8a[_0x56dc('0x19')](0x1f4,_0x1813ef[_0x56dc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2aa4fd0..64f7bdd 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 _0x115b=['register','length','squareProject:','./squareProject.events','remove','emit'];(function(_0x4574d9,_0x224f1a){var _0x30cea4=function(_0x4d26a5){while(--_0x4d26a5){_0x4574d9['push'](_0x4574d9['shift']());}};_0x30cea4(++_0x224f1a);}(_0x115b,0x11d));var _0xb115=function(_0x10b3af,_0x1183e4){_0x10b3af=_0x10b3af-0x0;var _0x30a0ab=_0x115b[_0x10b3af];return _0x30a0ab;};'use strict';var SquareProjectEvents=require(_0xb115('0x0'));var events=['save',_0xb115('0x1'),'update'];function createListener(_0x13da8b,_0x536e18){return function(_0x2b9979){_0x536e18[_0xb115('0x2')](_0x13da8b,_0x2b9979);};}function removeListener(_0x585da0,_0x4cc8f7){return function(){SquareProjectEvents['removeListener'](_0x585da0,_0x4cc8f7);};}exports[_0xb115('0x3')]=function(_0x168eab){for(var _0x1f7414=0x0,_0x2b3bf1=events[_0xb115('0x4')];_0x1f7414<_0x2b3bf1;_0x1f7414++){var _0x72e06f=events[_0x1f7414];var _0x3fccad=createListener(_0xb115('0x5')+_0x72e06f,_0x168eab);SquareProjectEvents['on'](_0x72e06f,_0x3fccad);}}; \ No newline at end of file +var _0x892f=['update','removeListener','squareProject:','./squareProject.events','save','remove'];(function(_0x5694cd,_0x2fefe4){var _0x5235d6=function(_0x4cd263){while(--_0x4cd263){_0x5694cd['push'](_0x5694cd['shift']());}};_0x5235d6(++_0x2fefe4);}(_0x892f,0x123));var _0xf892=function(_0x373e3c,_0xa87c9e){_0x373e3c=_0x373e3c-0x0;var _0x17ef08=_0x892f[_0x373e3c];return _0x17ef08;};'use strict';var SquareProjectEvents=require(_0xf892('0x0'));var events=[_0xf892('0x1'),_0xf892('0x2'),_0xf892('0x3')];function createListener(_0x394984,_0x436864){return function(_0x26b26c){_0x436864['emit'](_0x394984,_0x26b26c);};}function removeListener(_0xd471d2,_0xe4487e){return function(){SquareProjectEvents[_0xf892('0x4')](_0xd471d2,_0xe4487e);};}exports['register']=function(_0x2a7d62){for(var _0x402e2e=0x0,_0x381637=events['length'];_0x402e2e<_0x381637;_0x402e2e++){var _0x3822e1=events[_0x402e2e];var _0x34f879=createListener(_0xf892('0x5')+_0x3822e1,_0x2a7d62);SquareProjectEvents['on'](_0x3822e1,_0x34f879);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 21f542b..114cbe8 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x497737,_0x358bb6){var _0x329271=function(_0x1c2ee2){while(--_0x1c2ee2){_0x497737['push'](_0x497737['shift']());}};_0x329271(++_0x358bb6);}(_0xf494,0x1c6));var _0x4f49=function(_0x46d9b5,_0x57a520){_0x46d9b5=_0x46d9b5-0x0;var _0x3ff759=_0xf494[_0x46d9b5];return _0x3ff759;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3b224c,_0x4eaedb){var _0x4b21f3=function(_0xfc0413){while(--_0xfc0413){_0x3b224c['push'](_0x3b224c['shift']());}};_0x4b21f3(++_0x4eaedb);}(_0x4975,0x86));var _0x5497=function(_0x214346,_0x32b38a){_0x214346=_0x214346-0x0;var _0x373f68=_0x4975[_0x214346];return _0x373f68;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0fab299..6982875 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 _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x13ee79,_0x21e765){var _0x233440=function(_0x534e34){while(--_0x534e34){_0x13ee79['push'](_0x13ee79['shift']());}};_0x233440(++_0x21e765);}(_0x81bd,0x7c));var _0xd81b=function(_0x30af23,_0x1b9d6a){_0x30af23=_0x30af23-0x0;var _0x5cea96=_0x81bd[_0x30af23];return _0x5cea96;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file +var _0x7bae=['savePath','substring','lastIndexOf','STRING','VIRTUAL','getDataValue'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7bae[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'callerid':{'type':Sequelize[_0xe7ba('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7ba('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ba('0x0')]},'accountcode':{'type':Sequelize[_0xe7ba('0x0')]},'dnid':{'type':Sequelize[_0xe7ba('0x0')]},'projectName':{'type':Sequelize[_0xe7ba('0x0')]},'saveName':{'type':Sequelize[_0xe7ba('0x0')]},'filename':{'type':Sequelize[_0xe7ba('0x0')]},'savePath':{'type':Sequelize[_0xe7ba('0x0')]},'format':{'type':Sequelize[_0xe7ba('0x1')],'get':function(){var _0x10b307='';var _0x34fb18=this[_0xe7ba('0x2')](_0xe7ba('0x3'));if(_0x34fb18){_0x10b307=_0x34fb18[_0xe7ba('0x4')](_0x34fb18[_0xe7ba('0x5')]('.'));}return _0x10b307;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 649d3ff..dfabc73 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 _0xfd8e=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','uniqueid','filename','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','savePath','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','moment','bluebird','mustache','util','path'];(function(_0x500aa7,_0x350ad6){var _0x5aca36=function(_0x4b63e8){while(--_0x4b63e8){_0x500aa7['push'](_0x500aa7['shift']());}};_0x5aca36(++_0x350ad6);}(_0xfd8e,0x181));var _0xefd8=function(_0x5b06c5,_0x2f3afe){_0x5b06c5=_0x5b06c5-0x0;var _0x247879=_0xfd8e[_0x5b06c5];return _0x247879;};'use strict';var emlformat=require(_0xefd8('0x0'));var rimraf=require(_0xefd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefd8('0x2'));var BPromise=require(_0xefd8('0x3'));var Mustache=require(_0xefd8('0x4'));var util=require(_0xefd8('0x5'));var path=require(_0xefd8('0x6'));var sox=require(_0xefd8('0x7'));var csv=require(_0xefd8('0x8'));var ejs=require(_0xefd8('0x9'));var fs=require('fs');var fs_extra=require(_0xefd8('0xa'));var _=require(_0xefd8('0xb'));var squel=require(_0xefd8('0xc'));var crypto=require(_0xefd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xefd8('0xe'));var toCsv=require(_0xefd8('0x8'));var querystring=require(_0xefd8('0xf'));var Papa=require(_0xefd8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefd8('0x11'));var as=require(_0xefd8('0x12'));var hardwareService=require(_0xefd8('0x13'));var logger=require(_0xefd8('0x14'))(_0xefd8('0x15'));var utils=require('../../config/utils');var config=require(_0xefd8('0x16'));var licenseUtil=require(_0xefd8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0db8,_0x1deb4d){_0x1deb4d=_0x1deb4d||0xcc;return function(_0x3b879c){if(_0x3b879c){return _0x2f0db8[_0xefd8('0x18')](_0x1deb4d);}return _0x2f0db8[_0xefd8('0x19')](_0x1deb4d)[_0xefd8('0x1a')]();};}function respondWithResult(_0x55fa8d,_0x3669f4){_0x3669f4=_0x3669f4||0xc8;return function(_0x50581c){if(_0x50581c){return _0x55fa8d['status'](_0x3669f4)[_0xefd8('0x1b')](_0x50581c);}};}function respondWithFilteredResult(_0x460ec6,_0xf7e5d){return function(_0x1789d7){if(_0x1789d7){var _0x421462=typeof _0xf7e5d['offset']===_0xefd8('0x1c')&&typeof _0xf7e5d[_0xefd8('0x1d')]===_0xefd8('0x1c');var _0x564057=_0x1789d7[_0xefd8('0x1e')];var _0x139fea=_0x421462?0x0:_0xf7e5d[_0xefd8('0x1f')];var _0x36dfaa=_0x421462?_0x1789d7[_0xefd8('0x1e')]:_0xf7e5d['offset']+_0xf7e5d[_0xefd8('0x1d')];var _0x190cf9;if(_0x36dfaa>=_0x564057){_0x36dfaa=_0x564057;_0x190cf9=0xc8;}else{_0x190cf9=0xce;}_0x460ec6[_0xefd8('0x19')](_0x190cf9);return _0x460ec6[_0xefd8('0x20')](_0xefd8('0x21'),_0x139fea+'-'+_0x36dfaa+'/'+_0x564057)[_0xefd8('0x1b')](_0x1789d7);}return null;};}function patchUpdates(_0x33fd98){return function(_0x14ee0f){try{jsonpatch['apply'](_0x14ee0f,_0x33fd98,!![]);}catch(_0x83a8b){return BPromise[_0xefd8('0x22')](_0x83a8b);}return _0x14ee0f[_0xefd8('0x23')]();};}function saveUpdates(_0x2ac3f3,_0x55fa9e){return function(_0x1c769d){if(_0x1c769d){return _0x1c769d[_0xefd8('0x24')](_0x2ac3f3)[_0xefd8('0x25')](function(_0x3d9f61){return _0x3d9f61;});}return null;};}function removeEntity(_0x6881b2,_0x5a55f9){return function(_0xfd68e8){if(_0xfd68e8){return _0xfd68e8[_0xefd8('0x26')]()[_0xefd8('0x25')](function(){_0x6881b2[_0xefd8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf9cb77,_0x2a3694){return function(_0x47fb98){if(!_0x47fb98){_0xf9cb77['sendStatus'](0x194);}return _0x47fb98;};}function handleError(_0x24bb08,_0x2e0c3e){_0x2e0c3e=_0x2e0c3e||0x1f4;return function(_0x3fcd5e){logger[_0xefd8('0x27')](_0x3fcd5e[_0xefd8('0x28')]);if(_0x3fcd5e[_0xefd8('0x29')]){delete _0x3fcd5e[_0xefd8('0x29')];}_0x24bb08[_0xefd8('0x19')](_0x2e0c3e)[_0xefd8('0x2a')](_0x3fcd5e);};}exports['index']=function(_0x4db06c,_0x240bc0){var _0x229906={},_0x110120={},_0x669788={'count':0x0,'rows':[]};var _0x1560b4=_['map'](db[_0xefd8('0x2b')][_0xefd8('0x2c')],function(_0x31ca27){return{'name':_0x31ca27[_0xefd8('0x2d')],'type':_0x31ca27[_0xefd8('0x2e')][_0xefd8('0x2f')]};});_0x110120[_0xefd8('0x30')]=_['map'](_0x1560b4,_0xefd8('0x29'));_0x110120[_0xefd8('0x31')]=_[_0xefd8('0x32')](_0x4db06c[_0xefd8('0x31')]);_0x110120['filters']=_['intersection'](_0x110120[_0xefd8('0x30')],_0x110120[_0xefd8('0x31')]);_0x229906[_0xefd8('0x33')]=_['intersection'](_0x110120['model'],qs['fields'](_0x4db06c[_0xefd8('0x31')][_0xefd8('0x34')]));_0x229906[_0xefd8('0x33')]=_0x229906['attributes'][_0xefd8('0x35')]?_0x229906[_0xefd8('0x33')]:_0x110120['model'];if(!_0x4db06c[_0xefd8('0x31')][_0xefd8('0x36')](_0xefd8('0x37'))){_0x229906[_0xefd8('0x1d')]=qs[_0xefd8('0x1d')](_0x4db06c['query']['limit']);_0x229906[_0xefd8('0x1f')]=qs['offset'](_0x4db06c['query'][_0xefd8('0x1f')]);}_0x229906[_0xefd8('0x38')]=qs[_0xefd8('0x39')](_0x4db06c[_0xefd8('0x31')][_0xefd8('0x39')]);_0x229906['where']=qs[_0xefd8('0x3a')](_[_0xefd8('0x3b')](_0x4db06c[_0xefd8('0x31')],_0x110120[_0xefd8('0x3a')]),_0x1560b4);if(_0x4db06c[_0xefd8('0x31')][_0xefd8('0x3c')]){_0x229906[_0xefd8('0x3d')]=_['merge'](_0x229906['where'],{'$or':_[_0xefd8('0x3e')](_0x1560b4,function(_0x3448da){if(_0x3448da['type']!=='VIRTUAL'){var _0x1b8e0b={};_0x1b8e0b[_0x3448da[_0xefd8('0x29')]]={'$like':'%'+_0x4db06c[_0xefd8('0x31')][_0xefd8('0x3c')]+'%'};return _0x1b8e0b;}})});}_0x229906=_[_0xefd8('0x3f')]({},_0x229906,_0x4db06c[_0xefd8('0x40')]);var _0x495c90={'where':_0x229906[_0xefd8('0x3d')]};return db['SquareRecording']['count'](_0x495c90)['then'](function(_0x319b45){_0x669788[_0xefd8('0x1e')]=_0x319b45;if(_0x4db06c[_0xefd8('0x31')][_0xefd8('0x41')]){_0x229906[_0xefd8('0x42')]=[{'all':!![]}];}return db[_0xefd8('0x2b')][_0xefd8('0x43')](_0x229906);})[_0xefd8('0x25')](function(_0x205e48){_0x669788[_0xefd8('0x44')]=_0x205e48;return _0x669788;})['then'](respondWithFilteredResult(_0x240bc0,_0x229906))[_0xefd8('0x45')](handleError(_0x240bc0,null));};exports[_0xefd8('0x46')]=function(_0x239026,_0x63e769){var _0x594e1b={'raw':!![],'where':{'id':_0x239026[_0xefd8('0x47')]['id']}},_0x236a9f={};_0x236a9f[_0xefd8('0x30')]=_[_0xefd8('0x32')](db[_0xefd8('0x2b')][_0xefd8('0x2c')]);_0x236a9f[_0xefd8('0x31')]=_['keys'](_0x239026[_0xefd8('0x31')]);_0x236a9f[_0xefd8('0x3a')]=_['intersection'](_0x236a9f[_0xefd8('0x30')],_0x236a9f[_0xefd8('0x31')]);_0x594e1b['attributes']=_[_0xefd8('0x48')](_0x236a9f[_0xefd8('0x30')],qs[_0xefd8('0x34')](_0x239026[_0xefd8('0x31')]['fields']));_0x594e1b[_0xefd8('0x33')]=_0x594e1b[_0xefd8('0x33')]['length']?_0x594e1b[_0xefd8('0x33')]:_0x236a9f['model'];if(_0x239026[_0xefd8('0x31')][_0xefd8('0x41')]){_0x594e1b[_0xefd8('0x42')]=[{'all':!![]}];}_0x594e1b=_[_0xefd8('0x3f')]({},_0x594e1b,_0x239026['options']);return db[_0xefd8('0x2b')][_0xefd8('0x49')](_0x594e1b)['then'](handleEntityNotFound(_0x63e769,null))[_0xefd8('0x25')](respondWithResult(_0x63e769,null))[_0xefd8('0x45')](handleError(_0x63e769,null));};exports[_0xefd8('0x4a')]=function(_0x330342,_0x59902a){return db[_0xefd8('0x2b')][_0xefd8('0x4a')](_0x330342[_0xefd8('0x4b')],{})['then'](respondWithResult(_0x59902a,0xc9))[_0xefd8('0x45')](handleError(_0x59902a,null));};exports[_0xefd8('0x24')]=function(_0x28c477,_0x55790e){if(_0x28c477[_0xefd8('0x4b')]['id']){delete _0x28c477[_0xefd8('0x4b')]['id'];}return db[_0xefd8('0x2b')][_0xefd8('0x49')]({'where':{'id':_0x28c477[_0xefd8('0x47')]['id']}})['then'](handleEntityNotFound(_0x55790e,null))['then'](saveUpdates(_0x28c477['body'],null))[_0xefd8('0x25')](respondWithResult(_0x55790e,null))[_0xefd8('0x45')](handleError(_0x55790e,null));};exports['download']=function(_0xc73149,_0x1e7980,_0x3c2f9b){var _0x5dd52=require('../../components/encryptor');var _0x366d03=![];var _0x97b570={};if(_0xc73149[_0xefd8('0x31')]['type']&&_0xc73149[_0xefd8('0x31')][_0xefd8('0x2e')]===_0xefd8('0x4c')){_0x97b570[_0xefd8('0x4c')]=_0xc73149[_0xefd8('0x47')]['id'];}else{_0x97b570['id']=_0xc73149[_0xefd8('0x47')]['id'];}return db[_0xefd8('0x2b')][_0xefd8('0x49')]({'where':_0x97b570,'attributes':['id','savePath',_0xefd8('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1e7980,null))[_0xefd8('0x25')](function(_0x58e804){if(_0x58e804){var _0x4a76ab=_0x58e804['savePath'];var _0x364a60=util[_0xefd8('0x4e')](_0xefd8('0x4f'),_0x4a76ab);if(fs[_0xefd8('0x50')](_0x364a60)){_0x366d03=!![];return _0x5dd52[_0xefd8('0x51')](_0x364a60,_0x4a76ab,config['secrets'][_0xefd8('0x52')])[_0xefd8('0x25')](function(){return _0x58e804;});}return _0x58e804;}})['then'](function(_0x1a6431){if(_0x1a6431){var _0x29c732=_0x1a6431['savePath'];if(!fs['existsSync'](_0x29c732)){throw new db['Sequelize'][(_0xefd8('0x53'))](_0xefd8('0x54'));}if(_0x1a6431['filename']){return _0x1e7980[_0xefd8('0x55')](_0x29c732,_0x1a6431[_0xefd8('0x4d')]+path['extname'](_0x29c732),function(){if(_0x366d03){fs['unlink'](_0x29c732);}});}else{return _0x1e7980[_0xefd8('0x55')](_0x29c732,function(_0x57eb1f){if(_0x366d03){fs[_0xefd8('0x56')](_0x29c732);}});}}})[_0xefd8('0x45')](function(_0x26ba60){if(_0x26ba60[_0xefd8('0x57')]===_0xefd8('0x54')){_0x1e7980[_0xefd8('0x19')](0x194)['send'](_0xefd8('0x58'));}else{return handleError(_0x1e7980,null);}});};exports[_0xefd8('0x26')]=function(_0x35f262,_0xcb67f2){return db[_0xefd8('0x2b')][_0xefd8('0x49')]({'where':{'id':_0x35f262['params']['id']}})[_0xefd8('0x25')](function(_0x374571){if(_[_0xefd8('0x59')](_0x374571)){throw new ReferenceError(_0xefd8('0x5a'));}return _0x374571;})[_0xefd8('0x25')](function(_0x2fbde5){var _0x59bcb5=_0x2fbde5[_0xefd8('0x5b')];logger['info'](_0xefd8('0x5c'),_0x59bcb5);if(!_['isNil'](_0x2fbde5[_0xefd8('0x5b')])&&fs[_0xefd8('0x50')](_0x59bcb5)){logger[_0xefd8('0x5d')](_0xefd8('0x5e')+_0x59bcb5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xefd8('0x5f')](_0x59bcb5);}_0x59bcb5=_0x59bcb5+_0xefd8('0x60');if(!_[_0xefd8('0x59')](_0x2fbde5[_0xefd8('0x5b')])&&fs[_0xefd8('0x50')](_0x59bcb5)){logger[_0xefd8('0x5d')](_0xefd8('0x5e')+_0x59bcb5+_0xefd8('0x61'));fs[_0xefd8('0x5f')](_0x59bcb5);}return _0x2fbde5;})['then'](function(_0xd832bf){if(!_0xd832bf)throw new InternalError();return _0xd832bf['destroy']();})[_0xefd8('0x25')](function(){_0xcb67f2[_0xefd8('0x19')](0xcc)[_0xefd8('0x1a')]();})[_0xefd8('0x45')](handleError(_0xcb67f2,null));}; \ No newline at end of file +var _0xae05=['secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','body','params','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile'];(function(_0x46d1b5,_0x167007){var _0x5002cc=function(_0x473946){while(--_0x473946){_0x46d1b5['push'](_0x46d1b5['shift']());}};_0x5002cc(++_0x167007);}(_0xae05,0x1e9));var _0x5ae0=function(_0xa4f529,_0x36add4){_0xa4f529=_0xa4f529-0x0;var _0x3ce0df=_0xae05[_0xa4f529];return _0x3ce0df;};'use strict';var emlformat=require(_0x5ae0('0x0'));var rimraf=require(_0x5ae0('0x1'));var zipdir=require(_0x5ae0('0x2'));var jsonpatch=require(_0x5ae0('0x3'));var rp=require(_0x5ae0('0x4'));var moment=require('moment');var BPromise=require(_0x5ae0('0x5'));var Mustache=require('mustache');var util=require(_0x5ae0('0x6'));var path=require(_0x5ae0('0x7'));var sox=require(_0x5ae0('0x8'));var csv=require('to-csv');var ejs=require(_0x5ae0('0x9'));var fs=require('fs');var fs_extra=require(_0x5ae0('0xa'));var _=require('lodash');var squel=require(_0x5ae0('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ae0('0xc'));var deskjs=require(_0x5ae0('0xd'));var toCsv=require(_0x5ae0('0xe'));var querystring=require(_0x5ae0('0xf'));var Papa=require(_0x5ae0('0x10'));var Redis=require(_0x5ae0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae0('0x12'));var logger=require(_0x5ae0('0x13'))('api');var utils=require(_0x5ae0('0x14'));var config=require(_0x5ae0('0x15'));var licenseUtil=require(_0x5ae0('0x16'));var db=require(_0x5ae0('0x17'))['db'];function respondWithStatusCode(_0x160e68,_0x4e07a5){_0x4e07a5=_0x4e07a5||0xcc;return function(_0x108a6a){if(_0x108a6a){return _0x160e68['sendStatus'](_0x4e07a5);}return _0x160e68[_0x5ae0('0x18')](_0x4e07a5)['end']();};}function respondWithResult(_0x3e62b9,_0x18d7a6){_0x18d7a6=_0x18d7a6||0xc8;return function(_0x57a9c0){if(_0x57a9c0){return _0x3e62b9[_0x5ae0('0x18')](_0x18d7a6)[_0x5ae0('0x19')](_0x57a9c0);}};}function respondWithFilteredResult(_0x5017d8,_0x53d238){return function(_0x6f13e3){if(_0x6f13e3){var _0x4e8585=typeof _0x53d238[_0x5ae0('0x1a')]===_0x5ae0('0x1b')&&typeof _0x53d238['limit']===_0x5ae0('0x1b');var _0x2539f8=_0x6f13e3[_0x5ae0('0x1c')];var _0x129e82=_0x4e8585?0x0:_0x53d238[_0x5ae0('0x1a')];var _0x54d477=_0x4e8585?_0x6f13e3[_0x5ae0('0x1c')]:_0x53d238[_0x5ae0('0x1a')]+_0x53d238['limit'];var _0x3fce03;if(_0x54d477>=_0x2539f8){_0x54d477=_0x2539f8;_0x3fce03=0xc8;}else{_0x3fce03=0xce;}_0x5017d8['status'](_0x3fce03);return _0x5017d8['set'](_0x5ae0('0x1d'),_0x129e82+'-'+_0x54d477+'/'+_0x2539f8)[_0x5ae0('0x19')](_0x6f13e3);}return null;};}function patchUpdates(_0x57ab38){return function(_0x3682f0){try{jsonpatch['apply'](_0x3682f0,_0x57ab38,!![]);}catch(_0xa444b0){return BPromise[_0x5ae0('0x1e')](_0xa444b0);}return _0x3682f0[_0x5ae0('0x1f')]();};}function saveUpdates(_0x20029a,_0x5369a5){return function(_0x28c2d6){if(_0x28c2d6){return _0x28c2d6[_0x5ae0('0x20')](_0x20029a)[_0x5ae0('0x21')](function(_0x18d34d){return _0x18d34d;});}return null;};}function removeEntity(_0x5ca299,_0xac89fb){return function(_0x4207f){if(_0x4207f){return _0x4207f[_0x5ae0('0x22')]()['then'](function(){_0x5ca299['status'](0xcc)[_0x5ae0('0x23')]();});}};}function handleEntityNotFound(_0x2ca02f,_0x1513ce){return function(_0x53e219){if(!_0x53e219){_0x2ca02f[_0x5ae0('0x24')](0x194);}return _0x53e219;};}function handleError(_0x56913e,_0x520644){_0x520644=_0x520644||0x1f4;return function(_0x1d3225){logger['error'](_0x1d3225['stack']);if(_0x1d3225[_0x5ae0('0x25')]){delete _0x1d3225['name'];}_0x56913e[_0x5ae0('0x18')](_0x520644)[_0x5ae0('0x26')](_0x1d3225);};}exports[_0x5ae0('0x27')]=function(_0x30076e,_0x38d7d1){var _0x351fd6={},_0x2eb3ee={},_0x4632e5={'count':0x0,'rows':[]};var _0x4070e3=_[_0x5ae0('0x28')](db[_0x5ae0('0x29')][_0x5ae0('0x2a')],function(_0x483f59){return{'name':_0x483f59[_0x5ae0('0x2b')],'type':_0x483f59[_0x5ae0('0x2c')][_0x5ae0('0x2d')]};});_0x2eb3ee[_0x5ae0('0x2e')]=_[_0x5ae0('0x28')](_0x4070e3,'name');_0x2eb3ee[_0x5ae0('0x2f')]=_[_0x5ae0('0x30')](_0x30076e['query']);_0x2eb3ee[_0x5ae0('0x31')]=_['intersection'](_0x2eb3ee[_0x5ae0('0x2e')],_0x2eb3ee[_0x5ae0('0x2f')]);_0x351fd6[_0x5ae0('0x32')]=_[_0x5ae0('0x33')](_0x2eb3ee[_0x5ae0('0x2e')],qs[_0x5ae0('0x34')](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x34')]));_0x351fd6[_0x5ae0('0x32')]=_0x351fd6[_0x5ae0('0x32')][_0x5ae0('0x35')]?_0x351fd6['attributes']:_0x2eb3ee[_0x5ae0('0x2e')];if(!_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x36')](_0x5ae0('0x37'))){_0x351fd6[_0x5ae0('0x38')]=qs[_0x5ae0('0x38')](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x38')]);_0x351fd6['offset']=qs[_0x5ae0('0x1a')](_0x30076e['query'][_0x5ae0('0x1a')]);}_0x351fd6[_0x5ae0('0x39')]=qs['sort'](_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x3a')]);_0x351fd6[_0x5ae0('0x3b')]=qs[_0x5ae0('0x31')](_['pick'](_0x30076e[_0x5ae0('0x2f')],_0x2eb3ee[_0x5ae0('0x31')]),_0x4070e3);if(_0x30076e['query'][_0x5ae0('0x3c')]){_0x351fd6[_0x5ae0('0x3b')]=_[_0x5ae0('0x3d')](_0x351fd6[_0x5ae0('0x3b')],{'$or':_[_0x5ae0('0x28')](_0x4070e3,function(_0x2b9781){if(_0x2b9781[_0x5ae0('0x2c')]!=='VIRTUAL'){var _0x56aca2={};_0x56aca2[_0x2b9781[_0x5ae0('0x25')]]={'$like':'%'+_0x30076e[_0x5ae0('0x2f')][_0x5ae0('0x3c')]+'%'};return _0x56aca2;}})});}_0x351fd6=_[_0x5ae0('0x3d')]({},_0x351fd6,_0x30076e[_0x5ae0('0x3e')]);var _0x5ab1c9={'where':_0x351fd6[_0x5ae0('0x3b')]};return db[_0x5ae0('0x29')][_0x5ae0('0x1c')](_0x5ab1c9)[_0x5ae0('0x21')](function(_0x2313cc){_0x4632e5['count']=_0x2313cc;if(_0x30076e['query'][_0x5ae0('0x3f')]){_0x351fd6[_0x5ae0('0x40')]=[{'all':!![]}];}return db[_0x5ae0('0x29')][_0x5ae0('0x41')](_0x351fd6);})[_0x5ae0('0x21')](function(_0x79c0d7){_0x4632e5[_0x5ae0('0x42')]=_0x79c0d7;return _0x4632e5;})[_0x5ae0('0x21')](respondWithFilteredResult(_0x38d7d1,_0x351fd6))[_0x5ae0('0x43')](handleError(_0x38d7d1,null));};exports[_0x5ae0('0x44')]=function(_0x543745,_0x24d877){var _0xdbc428={'raw':!![],'where':{'id':_0x543745['params']['id']}},_0x299a59={};_0x299a59['model']=_[_0x5ae0('0x30')](db[_0x5ae0('0x29')]['rawAttributes']);_0x299a59['query']=_[_0x5ae0('0x30')](_0x543745[_0x5ae0('0x2f')]);_0x299a59[_0x5ae0('0x31')]=_['intersection'](_0x299a59['model'],_0x299a59[_0x5ae0('0x2f')]);_0xdbc428[_0x5ae0('0x32')]=_[_0x5ae0('0x33')](_0x299a59['model'],qs[_0x5ae0('0x34')](_0x543745['query']['fields']));_0xdbc428[_0x5ae0('0x32')]=_0xdbc428[_0x5ae0('0x32')]['length']?_0xdbc428['attributes']:_0x299a59[_0x5ae0('0x2e')];if(_0x543745[_0x5ae0('0x2f')][_0x5ae0('0x3f')]){_0xdbc428['include']=[{'all':!![]}];}_0xdbc428=_[_0x5ae0('0x3d')]({},_0xdbc428,_0x543745[_0x5ae0('0x3e')]);return db[_0x5ae0('0x29')]['find'](_0xdbc428)['then'](handleEntityNotFound(_0x24d877,null))['then'](respondWithResult(_0x24d877,null))[_0x5ae0('0x43')](handleError(_0x24d877,null));};exports['create']=function(_0x3e9246,_0x19207d){return db[_0x5ae0('0x29')]['create'](_0x3e9246[_0x5ae0('0x45')],{})[_0x5ae0('0x21')](respondWithResult(_0x19207d,0xc9))[_0x5ae0('0x43')](handleError(_0x19207d,null));};exports['update']=function(_0x12eb9b,_0x232a0b){if(_0x12eb9b[_0x5ae0('0x45')]['id']){delete _0x12eb9b[_0x5ae0('0x45')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x12eb9b[_0x5ae0('0x46')]['id']}})[_0x5ae0('0x21')](handleEntityNotFound(_0x232a0b,null))[_0x5ae0('0x21')](saveUpdates(_0x12eb9b['body'],null))[_0x5ae0('0x21')](respondWithResult(_0x232a0b,null))[_0x5ae0('0x43')](handleError(_0x232a0b,null));};exports[_0x5ae0('0x47')]=function(_0xdfdacd,_0x402d5e,_0x409d0a){var _0x4c3ef2=require(_0x5ae0('0x48'));var _0x49a22e=![];var _0x37d71={};if(_0xdfdacd[_0x5ae0('0x2f')][_0x5ae0('0x2c')]&&_0xdfdacd['query'][_0x5ae0('0x2c')]===_0x5ae0('0x49')){_0x37d71[_0x5ae0('0x49')]=_0xdfdacd[_0x5ae0('0x46')]['id'];}else{_0x37d71['id']=_0xdfdacd[_0x5ae0('0x46')]['id'];}return db[_0x5ae0('0x29')][_0x5ae0('0x4a')]({'where':_0x37d71,'attributes':['id',_0x5ae0('0x4b'),_0x5ae0('0x4c')],'raw':!![]})[_0x5ae0('0x21')](handleEntityNotFound(_0x402d5e,null))[_0x5ae0('0x21')](function(_0x3f6129){if(_0x3f6129){var _0x164600=_0x3f6129[_0x5ae0('0x4b')];var _0x19fdde=util[_0x5ae0('0x4d')](_0x5ae0('0x4e'),_0x164600);if(fs[_0x5ae0('0x4f')](_0x19fdde)){_0x49a22e=!![];return _0x4c3ef2[_0x5ae0('0x50')](_0x19fdde,_0x164600,config[_0x5ae0('0x51')][_0x5ae0('0x52')])['then'](function(){return _0x3f6129;});}return _0x3f6129;}})[_0x5ae0('0x21')](function(_0x92e6ed){if(_0x92e6ed){var _0x113cf2=_0x92e6ed[_0x5ae0('0x4b')];if(!fs[_0x5ae0('0x4f')](_0x113cf2)){throw new db[(_0x5ae0('0x53'))]['ValidationError'](_0x5ae0('0x54'));}if(_0x92e6ed[_0x5ae0('0x4c')]){return _0x402d5e[_0x5ae0('0x47')](_0x113cf2,_0x92e6ed[_0x5ae0('0x4c')]+path['extname'](_0x113cf2),function(){if(_0x49a22e){fs[_0x5ae0('0x55')](_0x113cf2);}});}else{return _0x402d5e[_0x5ae0('0x47')](_0x113cf2,function(_0x361ac3){if(_0x49a22e){fs[_0x5ae0('0x55')](_0x113cf2);}});}}})['catch'](function(_0x588bab){if(_0x588bab[_0x5ae0('0x56')]===_0x5ae0('0x54')){_0x402d5e['status'](0x194)[_0x5ae0('0x26')](_0x5ae0('0x57'));}else{return handleError(_0x402d5e,null);}});};exports[_0x5ae0('0x22')]=function(_0x204385,_0x317414){return db['SquareRecording'][_0x5ae0('0x4a')]({'where':{'id':_0x204385[_0x5ae0('0x46')]['id']}})[_0x5ae0('0x21')](function(_0x2280d6){if(_['isNil'](_0x2280d6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2280d6;})[_0x5ae0('0x21')](function(_0x38d560){var _0x1d9773=_0x38d560[_0x5ae0('0x4b')];logger[_0x5ae0('0x58')](_0x5ae0('0x59'),_0x1d9773);if(!_['isNil'](_0x38d560[_0x5ae0('0x4b')])&&fs[_0x5ae0('0x4f')](_0x1d9773)){logger[_0x5ae0('0x58')](_0x5ae0('0x5a')+_0x1d9773+_0x5ae0('0x5b'));fs[_0x5ae0('0x5c')](_0x1d9773);}_0x1d9773=_0x1d9773+_0x5ae0('0x5d');if(!_[_0x5ae0('0x5e')](_0x38d560['savePath'])&&fs[_0x5ae0('0x4f')](_0x1d9773)){logger[_0x5ae0('0x58')](_0x5ae0('0x5a')+_0x1d9773+_0x5ae0('0x5b'));fs[_0x5ae0('0x5c')](_0x1d9773);}return _0x38d560;})[_0x5ae0('0x21')](function(_0x1a4588){if(!_0x1a4588)throw new InternalError();return _0x1a4588[_0x5ae0('0x22')]();})[_0x5ae0('0x21')](function(){_0x317414['status'](0xcc)[_0x5ae0('0x23')]();})[_0x5ae0('0x43')](handleError(_0x317414,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 76de992..db777a0 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 _0xa35e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x37794d,_0x392d50){var _0x5c5a70=function(_0x3dfb8d){while(--_0x3dfb8d){_0x37794d['push'](_0x37794d['shift']());}};_0x5c5a70(++_0x392d50);}(_0xa35e,0x111));var _0xea35=function(_0x57de65,_0x127a29){_0x57de65=_0x57de65-0x0;var _0x5a962c=_0xa35e[_0x57de65];return _0x5a962c;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var logger=require(_0xea35('0x1'))(_0xea35('0x2'));var moment=require(_0xea35('0x3'));var BPromise=require(_0xea35('0x4'));var rp=require(_0xea35('0x5'));var fs=require('fs');var path=require(_0xea35('0x6'));var rimraf=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var attributes=require(_0xea35('0x9'));module[_0xea35('0xa')]=function(_0x3d2b41,_0x3dc645){return _0x3d2b41[_0xea35('0xb')](_0xea35('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9512=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0x9512,0x75));var _0x2951=function(_0x44176c,_0x150427){_0x44176c=_0x44176c-0x0;var _0x15f4bb=_0x9512[_0x44176c];return _0x15f4bb;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var logger=require(_0x2951('0x2'))(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require(_0x2951('0x5'));var rp=require(_0x2951('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2951('0x7'));var config=require(_0x2951('0x8'));var attributes=require(_0x2951('0x9'));module[_0x2951('0xa')]=function(_0x15d4fa,_0x293a9c){return _0x15d4fa[_0x2951('0xb')]('SquareRecording',attributes,{'tableName':_0x2951('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 0ac491c..61d8ca8 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 _0xf193=['message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','moment','../../mysqldb','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b800f,_0x38c4f7){var _0x58b855=function(_0x50a03f){while(--_0x50a03f){_0x3b800f['push'](_0x3b800f['shift']());}};_0x58b855(++_0x38c4f7);}(_0xf193,0x162));var _0x3f19=function(_0x5d57ff,_0x45a569){_0x5d57ff=_0x5d57ff-0x0;var _0x3b95a0=_0xf193[_0x5d57ff];return _0x3b95a0;};'use strict';var _=require(_0x3f19('0x0'));var util=require('util');var moment=require(_0x3f19('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f19('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3f19('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3f19('0x4')][_0x3f19('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x580700,_0x21d642,_0x25311a){return new BPromise(function(_0x474714,_0x357f6a){return client[_0x3f19('0x6')](_0x580700,_0x25311a)[_0x3f19('0x7')](function(_0x53a329){logger[_0x3f19('0x8')](_0x3f19('0x9'),_0x21d642,_0x3f19('0xa'));logger['debug'](_0x3f19('0xb'),_0x21d642,_0x3f19('0xa'),JSON['stringify'](_0x53a329));if(_0x53a329[_0x3f19('0xc')]){if(_0x53a329['error'][_0x3f19('0xd')]===0x1f4){logger[_0x3f19('0xc')](_0x3f19('0x9'),_0x21d642,_0x53a329['error']['message']);return _0x357f6a(_0x53a329[_0x3f19('0xc')]['message']);}logger[_0x3f19('0xc')](_0x3f19('0x9'),_0x21d642,_0x53a329[_0x3f19('0xc')]['message']);return _0x474714(_0x53a329[_0x3f19('0xc')][_0x3f19('0xe')]);}else{logger[_0x3f19('0x8')](_0x3f19('0x9'),_0x21d642,_0x3f19('0xa'));_0x474714(_0x53a329['result'][_0x3f19('0xe')]);}})[_0x3f19('0xf')](function(_0x486fbc){logger[_0x3f19('0xc')](_0x3f19('0x9'),_0x21d642,_0x486fbc);_0x357f6a(_0x486fbc);});});}exports[_0x3f19('0x10')]=function(_0x237286){var _0x51ce9f=this;return new Promise(function(_0x469064,_0x539c5d){return db[_0x3f19('0x11')][_0x3f19('0x12')](_0x237286[_0x3f19('0x13')],{'raw':_0x237286[_0x3f19('0x14')]?_0x237286[_0x3f19('0x14')][_0x3f19('0x15')]===undefined?!![]:![]:!![]})[_0x3f19('0x7')](function(_0x157da8){logger[_0x3f19('0x8')](_0x3f19('0x10'),_0x237286);logger['debug'](_0x3f19('0x10'),_0x237286,JSON[_0x3f19('0x16')](_0x157da8));_0x469064(_0x157da8);})['catch'](function(_0x450503){logger['error']('CreateSquareRecording',_0x450503[_0x3f19('0xe')],_0x237286);_0x539c5d(_0x51ce9f[_0x3f19('0xc')](0x1f4,_0x450503[_0x3f19('0xe')]));});});}; \ No newline at end of file +var _0xa3f1=['rpc','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a0693,_0x5e80b8){var _0x5daa64=function(_0x36f24f){while(--_0x36f24f){_0x5a0693['push'](_0x5a0693['shift']());}};_0x5daa64(++_0x5e80b8);}(_0xa3f1,0x111));var _0x1a3f=function(_0x2bbfcd,_0x5c117b){_0x2bbfcd=_0x2bbfcd-0x0;var _0x5a3f66=_0xa3f1[_0x2bbfcd];return _0x5a3f66;};'use strict';var _=require(_0x1a3f('0x0'));var util=require(_0x1a3f('0x1'));var moment=require('moment');var BPromise=require(_0x1a3f('0x2'));var rs=require(_0x1a3f('0x3'));var fs=require('fs');var Redis=require(_0x1a3f('0x4'));var db=require(_0x1a3f('0x5'))['db'];var utils=require(_0x1a3f('0x6'));var logger=require('../../config/logger')(_0x1a3f('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a3f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x405293,_0x1adb72,_0x518cc7){return new BPromise(function(_0x451723,_0x295bda){return client[_0x1a3f('0x9')](_0x405293,_0x518cc7)[_0x1a3f('0xa')](function(_0x3573e9){logger[_0x1a3f('0xb')](_0x1a3f('0xc'),_0x1adb72,_0x1a3f('0xd'));logger[_0x1a3f('0xe')](_0x1a3f('0xf'),_0x1adb72,_0x1a3f('0xd'),JSON[_0x1a3f('0x10')](_0x3573e9));if(_0x3573e9['error']){if(_0x3573e9['error'][_0x1a3f('0x11')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x1adb72,_0x3573e9[_0x1a3f('0x12')][_0x1a3f('0x13')]);return _0x295bda(_0x3573e9[_0x1a3f('0x12')][_0x1a3f('0x13')]);}logger[_0x1a3f('0x12')](_0x1a3f('0xc'),_0x1adb72,_0x3573e9['error'][_0x1a3f('0x13')]);return _0x451723(_0x3573e9['error'][_0x1a3f('0x13')]);}else{logger[_0x1a3f('0xb')](_0x1a3f('0xc'),_0x1adb72,'request\x20sent');_0x451723(_0x3573e9[_0x1a3f('0x14')][_0x1a3f('0x13')]);}})[_0x1a3f('0x15')](function(_0x19f6eb){logger[_0x1a3f('0x12')](_0x1a3f('0xc'),_0x1adb72,_0x19f6eb);_0x295bda(_0x19f6eb);});});}exports['CreateSquareRecording']=function(_0xe32e39){var _0x1a4f5f=this;return new Promise(function(_0x3b5595,_0x2cfcb5){return db[_0x1a3f('0x16')][_0x1a3f('0x17')](_0xe32e39[_0x1a3f('0x18')],{'raw':_0xe32e39['options']?_0xe32e39[_0x1a3f('0x19')][_0x1a3f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x52200b){logger[_0x1a3f('0xb')](_0x1a3f('0x1b'),_0xe32e39);logger[_0x1a3f('0xe')]('CreateSquareRecording',_0xe32e39,JSON[_0x1a3f('0x10')](_0x52200b));_0x3b5595(_0x52200b);})[_0x1a3f('0x15')](function(_0x3a2ab1){logger['error']('CreateSquareRecording',_0x3a2ab1[_0x1a3f('0x13')],_0xe32e39);_0x2cfcb5(_0x1a4f5f[_0x1a3f('0x12')](0x1f4,_0x3a2ab1[_0x1a3f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 22f0bbe..9fdc6d2 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x23a894,_0x4774d9){var _0x4f286c=function(_0x1cbc2b){while(--_0x1cbc2b){_0x23a894['push'](_0x23a894['shift']());}};_0x4f286c(++_0x4774d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x4c7d93,_0x346501){var _0x5298c7=function(_0x592460){while(--_0x592460){_0x4c7d93['push'](_0x4c7d93['shift']());}};_0x5298c7(++_0x346501);}(_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('./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 737f8e6..937ae6a 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 _0x3904=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x539659,_0xb36818){var _0x317047=function(_0x3dff89){while(--_0x3dff89){_0x539659['push'](_0x539659['shift']());}};_0x317047(++_0xb36818);}(_0x3904,0x1d9));var _0x4390=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0x3904[_0x3ba537];return _0x585c1a;};'use strict';var Sequelize=require(_0x4390('0x0'));module[_0x4390('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4390('0x2')]},'channel':{'type':Sequelize[_0x4390('0x2')]},'language':{'type':Sequelize[_0x4390('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4390('0x2')]},'version':{'type':Sequelize[_0x4390('0x2')]},'callerid':{'type':Sequelize[_0x4390('0x2')]},'calleridname':{'type':Sequelize[_0x4390('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4390('0x2')]},'callington':{'type':Sequelize[_0x4390('0x2')]},'callingtns':{'type':Sequelize[_0x4390('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x4390('0x2')]},'context':{'type':Sequelize[_0x4390('0x2')]},'extension':{'type':Sequelize[_0x4390('0x2')]},'priority':{'type':Sequelize[_0x4390('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4390('0x2')]},'joinAt':{'type':Sequelize[_0x4390('0x3')]},'leaveAt':{'type':Sequelize[_0x4390('0x3')]},'bot':{'type':Sequelize[_0x4390('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x652d=['STRING','DATE','exports'];(function(_0xa52e8e,_0x1cdcdf){var _0x498424=function(_0x3a8c81){while(--_0x3a8c81){_0xa52e8e['push'](_0xa52e8e['shift']());}};_0x498424(++_0x1cdcdf);}(_0x652d,0x1a0));var _0xd652=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x652d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xd652('0x0')]={'network':{'type':Sequelize[_0xd652('0x1')]},'network_script':{'type':Sequelize[_0xd652('0x1')]},'request':{'type':Sequelize[_0xd652('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd652('0x1')]},'version':{'type':Sequelize[_0xd652('0x1')]},'callerid':{'type':Sequelize[_0xd652('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd652('0x1')]},'callingani2':{'type':Sequelize[_0xd652('0x1')]},'callington':{'type':Sequelize[_0xd652('0x1')]},'callingtns':{'type':Sequelize[_0xd652('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd652('0x1')]},'context':{'type':Sequelize[_0xd652('0x1')]},'extension':{'type':Sequelize[_0xd652('0x1')]},'priority':{'type':Sequelize[_0xd652('0x1')]},'enhanced':{'type':Sequelize[_0xd652('0x1')]},'accountcode':{'type':Sequelize[_0xd652('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd652('0x2')]},'leaveAt':{'type':Sequelize[_0xd652('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d1de856..e7b0e60 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 _0x2115=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','send','index','map','SquareReport','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x42d341,_0x263d93){var _0x1f23ce=function(_0x223271){while(--_0x223271){_0x42d341['push'](_0x42d341['shift']());}};_0x1f23ce(++_0x263d93);}(_0x2115,0x8f));var _0x5211=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x2115[_0x2ac71a];return _0x3ee904;};'use strict';var emlformat=require(_0x5211('0x0'));var rimraf=require(_0x5211('0x1'));var zipdir=require(_0x5211('0x2'));var jsonpatch=require(_0x5211('0x3'));var rp=require(_0x5211('0x4'));var moment=require(_0x5211('0x5'));var BPromise=require(_0x5211('0x6'));var Mustache=require(_0x5211('0x7'));var util=require(_0x5211('0x8'));var path=require('path');var sox=require(_0x5211('0x9'));var csv=require('to-csv');var ejs=require(_0x5211('0xa'));var fs=require('fs');var fs_extra=require(_0x5211('0xb'));var _=require(_0x5211('0xc'));var squel=require('squel');var crypto=require(_0x5211('0xd'));var jsforce=require(_0x5211('0xe'));var deskjs=require(_0x5211('0xf'));var toCsv=require(_0x5211('0x10'));var querystring=require(_0x5211('0x11'));var Papa=require(_0x5211('0x12'));var Redis=require(_0x5211('0x13'));var authService=require(_0x5211('0x14'));var qs=require(_0x5211('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5211('0x16'));var utils=require(_0x5211('0x17'));var config=require(_0x5211('0x18'));var licenseUtil=require(_0x5211('0x19'));var db=require(_0x5211('0x1a'))['db'];function respondWithStatusCode(_0x28b73a,_0x5c2799){_0x5c2799=_0x5c2799||0xcc;return function(_0x4279af){if(_0x4279af){return _0x28b73a['sendStatus'](_0x5c2799);}return _0x28b73a[_0x5211('0x1b')](_0x5c2799)[_0x5211('0x1c')]();};}function respondWithResult(_0xeb8d6e,_0x393f6d){_0x393f6d=_0x393f6d||0xc8;return function(_0x46b3fc){if(_0x46b3fc){return _0xeb8d6e[_0x5211('0x1b')](_0x393f6d)[_0x5211('0x1d')](_0x46b3fc);}};}function respondWithFilteredResult(_0x51375b,_0x12fcea){return function(_0x4aa4a7){if(_0x4aa4a7){var _0x1941b5=typeof _0x12fcea[_0x5211('0x1e')]===_0x5211('0x1f')&&typeof _0x12fcea[_0x5211('0x20')]===_0x5211('0x1f');var _0x556044=_0x4aa4a7[_0x5211('0x21')];var _0x4c7939=_0x1941b5?0x0:_0x12fcea[_0x5211('0x1e')];var _0x277076=_0x1941b5?_0x4aa4a7[_0x5211('0x21')]:_0x12fcea['offset']+_0x12fcea[_0x5211('0x20')];var _0x2b71bb;if(_0x277076>=_0x556044){_0x277076=_0x556044;_0x2b71bb=0xc8;}else{_0x2b71bb=0xce;}_0x51375b[_0x5211('0x1b')](_0x2b71bb);return _0x51375b['set'](_0x5211('0x22'),_0x4c7939+'-'+_0x277076+'/'+_0x556044)[_0x5211('0x1d')](_0x4aa4a7);}return null;};}function patchUpdates(_0x4fb53b){return function(_0x4b57df){try{jsonpatch[_0x5211('0x23')](_0x4b57df,_0x4fb53b,!![]);}catch(_0x846dcb){return BPromise[_0x5211('0x24')](_0x846dcb);}return _0x4b57df[_0x5211('0x25')]();};}function saveUpdates(_0x2894d8,_0x4832a0){return function(_0x4642f4){if(_0x4642f4){return _0x4642f4['update'](_0x2894d8)[_0x5211('0x26')](function(_0x2cf233){return _0x2cf233;});}return null;};}function removeEntity(_0x90df82,_0x22e19){return function(_0x32f2d4){if(_0x32f2d4){return _0x32f2d4['destroy']()[_0x5211('0x26')](function(){_0x90df82[_0x5211('0x1b')](0xcc)[_0x5211('0x1c')]();});}};}function handleEntityNotFound(_0x3bffcc,_0x10066f){return function(_0x3e8ef1){if(!_0x3e8ef1){_0x3bffcc['sendStatus'](0x194);}return _0x3e8ef1;};}function handleError(_0x4a096c,_0x20c091){_0x20c091=_0x20c091||0x1f4;return function(_0x4d0544){logger['error'](_0x4d0544[_0x5211('0x27')]);if(_0x4d0544[_0x5211('0x28')]){delete _0x4d0544[_0x5211('0x28')];}_0x4a096c[_0x5211('0x1b')](_0x20c091)[_0x5211('0x29')](_0x4d0544);};}exports[_0x5211('0x2a')]=function(_0x259aec,_0x49721a){var _0xddfe13={},_0x4df3ec={},_0x3d59f9={'count':0x0,'rows':[]};var _0xa9d4bb=_[_0x5211('0x2b')](db[_0x5211('0x2c')]['rawAttributes'],function(_0x3abe0a){return{'name':_0x3abe0a['fieldName'],'type':_0x3abe0a['type'][_0x5211('0x2d')]};});_0x4df3ec[_0x5211('0x2e')]=_[_0x5211('0x2b')](_0xa9d4bb,_0x5211('0x28'));_0x4df3ec[_0x5211('0x2f')]=_[_0x5211('0x30')](_0x259aec[_0x5211('0x2f')]);_0x4df3ec[_0x5211('0x31')]=_[_0x5211('0x32')](_0x4df3ec['model'],_0x4df3ec[_0x5211('0x2f')]);_0xddfe13[_0x5211('0x33')]=_['intersection'](_0x4df3ec[_0x5211('0x2e')],qs['fields'](_0x259aec[_0x5211('0x2f')][_0x5211('0x34')]));_0xddfe13[_0x5211('0x33')]=_0xddfe13[_0x5211('0x33')][_0x5211('0x35')]?_0xddfe13[_0x5211('0x33')]:_0x4df3ec[_0x5211('0x2e')];if(!_0x259aec[_0x5211('0x2f')][_0x5211('0x36')](_0x5211('0x37'))){_0xddfe13[_0x5211('0x20')]=qs[_0x5211('0x20')](_0x259aec[_0x5211('0x2f')]['limit']);_0xddfe13[_0x5211('0x1e')]=qs[_0x5211('0x1e')](_0x259aec['query'][_0x5211('0x1e')]);}_0xddfe13[_0x5211('0x38')]=qs['sort'](_0x259aec['query']['sort']);_0xddfe13[_0x5211('0x39')]=qs['filters'](_[_0x5211('0x3a')](_0x259aec['query'],_0x4df3ec[_0x5211('0x31')]),_0xa9d4bb);if(_0x259aec[_0x5211('0x2f')]['filter']){_0xddfe13[_0x5211('0x39')]=_['merge'](_0xddfe13['where'],{'$or':_['map'](_0xa9d4bb,function(_0x39ad80){if(_0x39ad80[_0x5211('0x3b')]!==_0x5211('0x3c')){var _0x3eac67={};_0x3eac67[_0x39ad80['name']]={'$like':'%'+_0x259aec[_0x5211('0x2f')][_0x5211('0x3d')]+'%'};return _0x3eac67;}})});}_0xddfe13=_[_0x5211('0x3e')]({},_0xddfe13,_0x259aec['options']);var _0x29afdc={'where':_0xddfe13[_0x5211('0x39')]};return db[_0x5211('0x2c')][_0x5211('0x21')](_0x29afdc)[_0x5211('0x26')](function(_0x3460cd){_0x3d59f9['count']=_0x3460cd;if(_0x259aec[_0x5211('0x2f')][_0x5211('0x3f')]){_0xddfe13[_0x5211('0x40')]=[{'all':!![]}];}return db[_0x5211('0x2c')][_0x5211('0x41')](_0xddfe13);})[_0x5211('0x26')](function(_0x43681d){_0x3d59f9[_0x5211('0x42')]=_0x43681d;return _0x3d59f9;})['then'](respondWithFilteredResult(_0x49721a,_0xddfe13))[_0x5211('0x43')](handleError(_0x49721a,null));};exports[_0x5211('0x44')]=function(_0x5d4393,_0xcdf351){var _0x11663c={'raw':!![],'where':{'id':_0x5d4393[_0x5211('0x45')]['id']}},_0x45d100={};_0x45d100[_0x5211('0x2e')]=_[_0x5211('0x30')](db[_0x5211('0x2c')][_0x5211('0x46')]);_0x45d100[_0x5211('0x2f')]=_['keys'](_0x5d4393[_0x5211('0x2f')]);_0x45d100['filters']=_[_0x5211('0x32')](_0x45d100[_0x5211('0x2e')],_0x45d100[_0x5211('0x2f')]);_0x11663c[_0x5211('0x33')]=_[_0x5211('0x32')](_0x45d100[_0x5211('0x2e')],qs[_0x5211('0x34')](_0x5d4393[_0x5211('0x2f')]['fields']));_0x11663c[_0x5211('0x33')]=_0x11663c[_0x5211('0x33')]['length']?_0x11663c[_0x5211('0x33')]:_0x45d100['model'];if(_0x5d4393[_0x5211('0x2f')]['includeAll']){_0x11663c['include']=[{'all':!![]}];}_0x11663c=_[_0x5211('0x3e')]({},_0x11663c,_0x5d4393[_0x5211('0x47')]);return db[_0x5211('0x2c')][_0x5211('0x48')](_0x11663c)[_0x5211('0x26')](handleEntityNotFound(_0xcdf351,null))['then'](respondWithResult(_0xcdf351,null))[_0x5211('0x43')](handleError(_0xcdf351,null));};exports[_0x5211('0x49')]=function(_0x53ba64,_0x38bb00){return db[_0x5211('0x2c')][_0x5211('0x49')](_0x53ba64[_0x5211('0x4a')],{})[_0x5211('0x26')](respondWithResult(_0x38bb00,0xc9))[_0x5211('0x43')](handleError(_0x38bb00,null));};exports[_0x5211('0x4b')]=function(_0x27959e,_0x349ad3){if(_0x27959e[_0x5211('0x4a')]['id']){delete _0x27959e['body']['id'];}return db[_0x5211('0x2c')][_0x5211('0x48')]({'where':{'id':_0x27959e[_0x5211('0x45')]['id']}})[_0x5211('0x26')](handleEntityNotFound(_0x349ad3,null))['then'](saveUpdates(_0x27959e['body'],null))[_0x5211('0x26')](respondWithResult(_0x349ad3,null))[_0x5211('0x43')](handleError(_0x349ad3,null));};exports[_0x5211('0x4c')]=function(_0x27687c,_0x4b91a1){return db['SquareReport'][_0x5211('0x48')]({'where':{'id':_0x27687c['params']['id']}})[_0x5211('0x26')](handleEntityNotFound(_0x4b91a1,null))[_0x5211('0x26')](removeEntity(_0x4b91a1,null))['catch'](handleError(_0x4b91a1,null));};exports[_0x5211('0x4d')]=function(_0x11ddc8,_0x2d45d0){return db[_0x5211('0x2c')]['describe']()['then'](respondWithResult(_0x2d45d0,null))['catch'](handleError(_0x2d45d0,null));}; \ No newline at end of file +var _0x3c4b=['where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','SquareReport','rawAttributes','type','map','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x3c4b,0xa0));var _0xb3c4=function(_0x297c6a,_0x1fca7a){_0x297c6a=_0x297c6a-0x0;var _0x4820ff=_0x3c4b[_0x297c6a];return _0x4820ff;};'use strict';var emlformat=require(_0xb3c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3c4('0x1'));var jsonpatch=require(_0xb3c4('0x2'));var rp=require(_0xb3c4('0x3'));var moment=require(_0xb3c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb3c4('0x5'));var util=require(_0xb3c4('0x6'));var path=require(_0xb3c4('0x7'));var sox=require(_0xb3c4('0x8'));var csv=require(_0xb3c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3c4('0xa'));var crypto=require(_0xb3c4('0xb'));var jsforce=require(_0xb3c4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3c4('0xd'));var Papa=require(_0xb3c4('0xe'));var Redis=require(_0xb3c4('0xf'));var authService=require(_0xb3c4('0x10'));var qs=require(_0xb3c4('0x11'));var as=require(_0xb3c4('0x12'));var hardwareService=require(_0xb3c4('0x13'));var logger=require('../../config/logger')(_0xb3c4('0x14'));var utils=require(_0xb3c4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d64ca,_0x26d381){_0x26d381=_0x26d381||0xcc;return function(_0x5e64c1){if(_0x5e64c1){return _0x3d64ca[_0xb3c4('0x16')](_0x26d381);}return _0x3d64ca[_0xb3c4('0x17')](_0x26d381)[_0xb3c4('0x18')]();};}function respondWithResult(_0x269b13,_0x25781f){_0x25781f=_0x25781f||0xc8;return function(_0x2b3e52){if(_0x2b3e52){return _0x269b13[_0xb3c4('0x17')](_0x25781f)[_0xb3c4('0x19')](_0x2b3e52);}};}function respondWithFilteredResult(_0x1c6158,_0x27b1de){return function(_0x4ebcfa){if(_0x4ebcfa){var _0x42e8fe=typeof _0x27b1de[_0xb3c4('0x1a')]==='undefined'&&typeof _0x27b1de[_0xb3c4('0x1b')]===_0xb3c4('0x1c');var _0x5aacad=_0x4ebcfa[_0xb3c4('0x1d')];var _0x596c6e=_0x42e8fe?0x0:_0x27b1de['offset'];var _0x17384c=_0x42e8fe?_0x4ebcfa[_0xb3c4('0x1d')]:_0x27b1de['offset']+_0x27b1de['limit'];var _0x171614;if(_0x17384c>=_0x5aacad){_0x17384c=_0x5aacad;_0x171614=0xc8;}else{_0x171614=0xce;}_0x1c6158[_0xb3c4('0x17')](_0x171614);return _0x1c6158[_0xb3c4('0x1e')](_0xb3c4('0x1f'),_0x596c6e+'-'+_0x17384c+'/'+_0x5aacad)['json'](_0x4ebcfa);}return null;};}function patchUpdates(_0x4f2a97){return function(_0x1cb94b){try{jsonpatch['apply'](_0x1cb94b,_0x4f2a97,!![]);}catch(_0x16dcb5){return BPromise[_0xb3c4('0x20')](_0x16dcb5);}return _0x1cb94b[_0xb3c4('0x21')]();};}function saveUpdates(_0x16d22f,_0x4151b7){return function(_0x53a5c8){if(_0x53a5c8){return _0x53a5c8[_0xb3c4('0x22')](_0x16d22f)[_0xb3c4('0x23')](function(_0x4ea8ad){return _0x4ea8ad;});}return null;};}function removeEntity(_0x519b2f,_0x44c7a3){return function(_0x2a979b){if(_0x2a979b){return _0x2a979b[_0xb3c4('0x24')]()[_0xb3c4('0x23')](function(){_0x519b2f[_0xb3c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4684c7,_0x1a23cb){return function(_0x59b972){if(!_0x59b972){_0x4684c7['sendStatus'](0x194);}return _0x59b972;};}function handleError(_0x1f15ea,_0x4bf87c){_0x4bf87c=_0x4bf87c||0x1f4;return function(_0x4bb87b){logger[_0xb3c4('0x25')](_0x4bb87b[_0xb3c4('0x26')]);if(_0x4bb87b['name']){delete _0x4bb87b['name'];}_0x1f15ea[_0xb3c4('0x17')](_0x4bf87c)[_0xb3c4('0x27')](_0x4bb87b);};}exports['index']=function(_0x418478,_0x11e724){var _0x255e66={},_0x36c446={},_0x3ee0a6={'count':0x0,'rows':[]};var _0x109435=_['map'](db[_0xb3c4('0x28')][_0xb3c4('0x29')],function(_0x107cc9){return{'name':_0x107cc9['fieldName'],'type':_0x107cc9[_0xb3c4('0x2a')]['key']};});_0x36c446['model']=_[_0xb3c4('0x2b')](_0x109435,_0xb3c4('0x2c'));_0x36c446[_0xb3c4('0x2d')]=_[_0xb3c4('0x2e')](_0x418478[_0xb3c4('0x2d')]);_0x36c446[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x36c446[_0xb3c4('0x31')],_0x36c446[_0xb3c4('0x2d')]);_0x255e66['attributes']=_['intersection'](_0x36c446[_0xb3c4('0x31')],qs['fields'](_0x418478[_0xb3c4('0x2d')]['fields']));_0x255e66[_0xb3c4('0x32')]=_0x255e66[_0xb3c4('0x32')][_0xb3c4('0x33')]?_0x255e66['attributes']:_0x36c446['model'];if(!_0x418478['query'][_0xb3c4('0x34')](_0xb3c4('0x35'))){_0x255e66[_0xb3c4('0x1b')]=qs[_0xb3c4('0x1b')](_0x418478['query'][_0xb3c4('0x1b')]);_0x255e66[_0xb3c4('0x1a')]=qs[_0xb3c4('0x1a')](_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x1a')]);}_0x255e66[_0xb3c4('0x36')]=qs[_0xb3c4('0x37')](_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x37')]);_0x255e66[_0xb3c4('0x38')]=qs[_0xb3c4('0x2f')](_['pick'](_0x418478[_0xb3c4('0x2d')],_0x36c446[_0xb3c4('0x2f')]),_0x109435);if(_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x39')]){_0x255e66[_0xb3c4('0x38')]=_[_0xb3c4('0x3a')](_0x255e66['where'],{'$or':_[_0xb3c4('0x2b')](_0x109435,function(_0x14d09f){if(_0x14d09f[_0xb3c4('0x2a')]!==_0xb3c4('0x3b')){var _0x294f23={};_0x294f23[_0x14d09f[_0xb3c4('0x2c')]]={'$like':'%'+_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x39')]+'%'};return _0x294f23;}})});}_0x255e66=_[_0xb3c4('0x3a')]({},_0x255e66,_0x418478[_0xb3c4('0x3c')]);var _0x248371={'where':_0x255e66['where']};return db[_0xb3c4('0x28')][_0xb3c4('0x1d')](_0x248371)['then'](function(_0x3786d7){_0x3ee0a6[_0xb3c4('0x1d')]=_0x3786d7;if(_0x418478[_0xb3c4('0x2d')][_0xb3c4('0x3d')]){_0x255e66[_0xb3c4('0x3e')]=[{'all':!![]}];}return db[_0xb3c4('0x28')][_0xb3c4('0x3f')](_0x255e66);})[_0xb3c4('0x23')](function(_0x50d50b){_0x3ee0a6[_0xb3c4('0x40')]=_0x50d50b;return _0x3ee0a6;})[_0xb3c4('0x23')](respondWithFilteredResult(_0x11e724,_0x255e66))[_0xb3c4('0x41')](handleError(_0x11e724,null));};exports['show']=function(_0xf0a98a,_0x121720){var _0xac5448={'raw':!![],'where':{'id':_0xf0a98a['params']['id']}},_0x1c96e3={};_0x1c96e3[_0xb3c4('0x31')]=_[_0xb3c4('0x2e')](db['SquareReport']['rawAttributes']);_0x1c96e3['query']=_[_0xb3c4('0x2e')](_0xf0a98a[_0xb3c4('0x2d')]);_0x1c96e3[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x1c96e3['model'],_0x1c96e3['query']);_0xac5448['attributes']=_[_0xb3c4('0x30')](_0x1c96e3['model'],qs[_0xb3c4('0x42')](_0xf0a98a[_0xb3c4('0x2d')][_0xb3c4('0x42')]));_0xac5448['attributes']=_0xac5448[_0xb3c4('0x32')]['length']?_0xac5448[_0xb3c4('0x32')]:_0x1c96e3[_0xb3c4('0x31')];if(_0xf0a98a[_0xb3c4('0x2d')][_0xb3c4('0x3d')]){_0xac5448['include']=[{'all':!![]}];}_0xac5448=_[_0xb3c4('0x3a')]({},_0xac5448,_0xf0a98a[_0xb3c4('0x3c')]);return db[_0xb3c4('0x28')][_0xb3c4('0x43')](_0xac5448)[_0xb3c4('0x23')](handleEntityNotFound(_0x121720,null))['then'](respondWithResult(_0x121720,null))[_0xb3c4('0x41')](handleError(_0x121720,null));};exports[_0xb3c4('0x44')]=function(_0xf4d961,_0x204a8b){return db[_0xb3c4('0x28')]['create'](_0xf4d961[_0xb3c4('0x45')],{})[_0xb3c4('0x23')](respondWithResult(_0x204a8b,0xc9))['catch'](handleError(_0x204a8b,null));};exports[_0xb3c4('0x22')]=function(_0x27f64f,_0x526def){if(_0x27f64f['body']['id']){delete _0x27f64f[_0xb3c4('0x45')]['id'];}return db[_0xb3c4('0x28')]['find']({'where':{'id':_0x27f64f[_0xb3c4('0x46')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x526def,null))['then'](saveUpdates(_0x27f64f[_0xb3c4('0x45')],null))[_0xb3c4('0x23')](respondWithResult(_0x526def,null))[_0xb3c4('0x41')](handleError(_0x526def,null));};exports['destroy']=function(_0x24411e,_0x4f818f){return db[_0xb3c4('0x28')]['find']({'where':{'id':_0x24411e[_0xb3c4('0x46')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x4f818f,null))[_0xb3c4('0x23')](removeEntity(_0x4f818f,null))[_0xb3c4('0x41')](handleError(_0x4f818f,null));};exports[_0xb3c4('0x47')]=function(_0x3a2b89,_0x4125d6){return db[_0xb3c4('0x28')]['describe']()[_0xb3c4('0x23')](respondWithResult(_0x4125d6,null))['catch'](handleError(_0x4125d6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e99d050..0d16f76 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 _0x09e2=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x662f5b,_0x1bbf91){var _0xa58422=function(_0x3f46da){while(--_0x3f46da){_0x662f5b['push'](_0x662f5b['shift']());}};_0xa58422(++_0x1bbf91);}(_0x09e2,0x1b6));var _0x209e=function(_0x32a2cf,_0x20b153){_0x32a2cf=_0x32a2cf-0x0;var _0x250e9d=_0x09e2[_0x32a2cf];return _0x250e9d;};'use strict';var _=require(_0x209e('0x0'));var util=require(_0x209e('0x1'));var logger=require(_0x209e('0x2'))(_0x209e('0x3'));var moment=require(_0x209e('0x4'));var BPromise=require(_0x209e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x209e('0x6'));var rimraf=require(_0x209e('0x7'));var config=require(_0x209e('0x8'));var attributes=require(_0x209e('0x9'));module[_0x209e('0xa')]=function(_0x193fc4,_0x574598){return _0x193fc4[_0x209e('0xb')](_0x209e('0xc'),attributes,{'tableName':_0x209e('0xd'),'paranoid':![],'indexes':[{'name':_0x209e('0xe'),'fields':[_0x209e('0xf'),_0x209e('0x10')]},{'name':_0x209e('0x11'),'fields':[_0x209e('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfd8=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareReport','report_square','uid_pname'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdfd8,0x133));var _0x8dfd=function(_0x56fa90,_0x5726e3){_0x56fa90=_0x56fa90-0x0;var _0xae05b=_0xdfd8[_0x56fa90];return _0xae05b;};'use strict';var _=require(_0x8dfd('0x0'));var util=require(_0x8dfd('0x1'));var logger=require(_0x8dfd('0x2'))('api');var moment=require(_0x8dfd('0x3'));var BPromise=require(_0x8dfd('0x4'));var rp=require(_0x8dfd('0x5'));var fs=require('fs');var path=require(_0x8dfd('0x6'));var rimraf=require('rimraf');var config=require(_0x8dfd('0x7'));var attributes=require('./squareReport.attributes');module[_0x8dfd('0x8')]=function(_0x3fc640,_0x53a9af){return _0x3fc640[_0x8dfd('0x9')](_0x8dfd('0xa'),attributes,{'tableName':_0x8dfd('0xb'),'paranoid':![],'indexes':[{'name':_0x8dfd('0xc'),'fields':[_0x8dfd('0xd'),_0x8dfd('0xe')]},{'name':_0x8dfd('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index aa48f5d..b06d926 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 _0xcad2=['result','catch','SquareReport','body','options','raw','CreateSquareReport','UpdateSquareReport','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','message','SquareReport,\x20%s,\x20%s'];(function(_0x3799a4,_0x42785e){var _0x10390e=function(_0x1e4c58){while(--_0x1e4c58){_0x3799a4['push'](_0x3799a4['shift']());}};_0x10390e(++_0x42785e);}(_0xcad2,0xfa));var _0x2cad=function(_0x4ec3d7,_0x25c57f){_0x4ec3d7=_0x4ec3d7-0x0;var _0x3b9d3c=_0xcad2[_0x4ec3d7];return _0x3b9d3c;};'use strict';var _=require(_0x2cad('0x0'));var util=require('util');var moment=require(_0x2cad('0x1'));var BPromise=require(_0x2cad('0x2'));var rs=require(_0x2cad('0x3'));var fs=require('fs');var Redis=require(_0x2cad('0x4'));var db=require(_0x2cad('0x5'))['db'];var utils=require(_0x2cad('0x6'));var logger=require('../../config/logger')(_0x2cad('0x7'));var config=require(_0x2cad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2cad('0x9')][_0x2cad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bfb66,_0x24ba64,_0x261060){return new BPromise(function(_0x1d3d78,_0xb8b01d){return client['request'](_0x3bfb66,_0x261060)[_0x2cad('0xb')](function(_0x2ee949){logger[_0x2cad('0xc')]('SquareReport,\x20%s,\x20%s',_0x24ba64,_0x2cad('0xd'));logger[_0x2cad('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x24ba64,_0x2cad('0xd'),JSON[_0x2cad('0xf')](_0x2ee949));if(_0x2ee949[_0x2cad('0x10')]){if(_0x2ee949[_0x2cad('0x10')][_0x2cad('0x11')]===0x1f4){logger[_0x2cad('0x10')]('SquareReport,\x20%s,\x20%s',_0x24ba64,_0x2ee949[_0x2cad('0x10')][_0x2cad('0x12')]);return _0xb8b01d(_0x2ee949[_0x2cad('0x10')]['message']);}logger[_0x2cad('0x10')](_0x2cad('0x13'),_0x24ba64,_0x2ee949[_0x2cad('0x10')][_0x2cad('0x12')]);return _0x1d3d78(_0x2ee949[_0x2cad('0x10')]['message']);}else{logger[_0x2cad('0xc')](_0x2cad('0x13'),_0x24ba64,_0x2cad('0xd'));_0x1d3d78(_0x2ee949[_0x2cad('0x14')][_0x2cad('0x12')]);}})[_0x2cad('0x15')](function(_0xd8bb44){logger[_0x2cad('0x10')](_0x2cad('0x13'),_0x24ba64,_0xd8bb44);_0xb8b01d(_0xd8bb44);});});}exports['CreateSquareReport']=function(_0x303f48){var _0x196905=this;return new Promise(function(_0x22d88e,_0x41624c){return db[_0x2cad('0x16')]['create'](_0x303f48[_0x2cad('0x17')],{'raw':_0x303f48[_0x2cad('0x18')]?_0x303f48[_0x2cad('0x18')][_0x2cad('0x19')]===undefined?!![]:![]:!![]})[_0x2cad('0xb')](function(_0x288526){logger['info'](_0x2cad('0x1a'),_0x303f48);logger[_0x2cad('0xe')](_0x2cad('0x1a'),_0x303f48,JSON['stringify'](_0x288526));_0x22d88e(_0x288526);})[_0x2cad('0x15')](function(_0x498f26){logger[_0x2cad('0x10')](_0x2cad('0x1a'),_0x498f26[_0x2cad('0x12')],_0x303f48);_0x41624c(_0x196905['error'](0x1f4,_0x498f26['message']));});});};exports[_0x2cad('0x1b')]=function(_0x5f5581){var _0x1ac22c=this;return new Promise(function(_0x1d54d4,_0x3cb7ca){return db[_0x2cad('0x16')]['update'](_0x5f5581[_0x2cad('0x17')],{'raw':_0x5f5581['options']?_0x5f5581[_0x2cad('0x18')][_0x2cad('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f5581[_0x2cad('0x18')]?_0x5f5581[_0x2cad('0x18')]['where']||null:null,'attributes':_0x5f5581[_0x2cad('0x18')]?_0x5f5581['options'][_0x2cad('0x1c')]||null:null,'limit':_0x5f5581[_0x2cad('0x18')]?_0x5f5581[_0x2cad('0x18')][_0x2cad('0x1d')]||null:null})[_0x2cad('0xb')](function(_0x5b233a){logger[_0x2cad('0xc')](_0x2cad('0x1b'),_0x5f5581);logger['debug'](_0x2cad('0x1b'),_0x5f5581,JSON[_0x2cad('0xf')](_0x5b233a));_0x1d54d4(_0x5b233a);})[_0x2cad('0x15')](function(_0x5103af){logger[_0x2cad('0x10')](_0x2cad('0x1b'),_0x5103af[_0x2cad('0x12')],_0x5f5581);_0x3cb7ca(_0x1ac22c['error'](0x1f4,_0x5103af[_0x2cad('0x12')]));});});}; \ No newline at end of file +var _0x48db=['stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x1a89d0,_0x433624){var _0x2fa8e8=function(_0xc4da1c){while(--_0xc4da1c){_0x1a89d0['push'](_0x1a89d0['shift']());}};_0x2fa8e8(++_0x433624);}(_0x48db,0x19b));var _0xb48d=function(_0x150ced,_0x486de0){_0x150ced=_0x150ced-0x0;var _0x538c95=_0x48db[_0x150ced];return _0x538c95;};'use strict';var _=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var moment=require(_0xb48d('0x2'));var BPromise=require(_0xb48d('0x3'));var rs=require(_0xb48d('0x4'));var fs=require('fs');var Redis=require(_0xb48d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb48d('0x6'))(_0xb48d('0x7'));var config=require(_0xb48d('0x8'));var jayson=require(_0xb48d('0x9'));var client=jayson[_0xb48d('0xa')][_0xb48d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c7133,_0x3e0bc7,_0x5d8aa5){return new BPromise(function(_0x3a24e6,_0x48dd8b){return client['request'](_0x1c7133,_0x5d8aa5)[_0xb48d('0xc')](function(_0x186b7a){logger[_0xb48d('0xd')](_0xb48d('0xe'),_0x3e0bc7,_0xb48d('0xf'));logger[_0xb48d('0x10')](_0xb48d('0x11'),_0x3e0bc7,_0xb48d('0xf'),JSON[_0xb48d('0x12')](_0x186b7a));if(_0x186b7a['error']){if(_0x186b7a[_0xb48d('0x13')][_0xb48d('0x14')]===0x1f4){logger[_0xb48d('0x13')](_0xb48d('0xe'),_0x3e0bc7,_0x186b7a[_0xb48d('0x13')][_0xb48d('0x15')]);return _0x48dd8b(_0x186b7a['error'][_0xb48d('0x15')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x3e0bc7,_0x186b7a[_0xb48d('0x13')][_0xb48d('0x15')]);return _0x3a24e6(_0x186b7a['error']['message']);}else{logger['info'](_0xb48d('0xe'),_0x3e0bc7,_0xb48d('0xf'));_0x3a24e6(_0x186b7a[_0xb48d('0x16')][_0xb48d('0x15')]);}})[_0xb48d('0x17')](function(_0x450924){logger[_0xb48d('0x13')](_0xb48d('0xe'),_0x3e0bc7,_0x450924);_0x48dd8b(_0x450924);});});}exports[_0xb48d('0x18')]=function(_0x431bd1){var _0x3b09be=this;return new Promise(function(_0x578cc9,_0x38a3c7){return db[_0xb48d('0x19')][_0xb48d('0x1a')](_0x431bd1[_0xb48d('0x1b')],{'raw':_0x431bd1['options']?_0x431bd1[_0xb48d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xb48d('0xc')](function(_0x2a569c){logger[_0xb48d('0xd')]('CreateSquareReport',_0x431bd1);logger[_0xb48d('0x10')](_0xb48d('0x18'),_0x431bd1,JSON[_0xb48d('0x12')](_0x2a569c));_0x578cc9(_0x2a569c);})[_0xb48d('0x17')](function(_0x51284a){logger['error'](_0xb48d('0x18'),_0x51284a[_0xb48d('0x15')],_0x431bd1);_0x38a3c7(_0x3b09be['error'](0x1f4,_0x51284a[_0xb48d('0x15')]));});});};exports[_0xb48d('0x1d')]=function(_0x480f58){var _0xf83f36=this;return new Promise(function(_0x102b66,_0x4654d7){return db[_0xb48d('0x19')][_0xb48d('0x1e')](_0x480f58[_0xb48d('0x1b')],{'raw':_0x480f58['options']?_0x480f58['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480f58[_0xb48d('0x1c')]?_0x480f58[_0xb48d('0x1c')]['where']||null:null,'attributes':_0x480f58[_0xb48d('0x1c')]?_0x480f58[_0xb48d('0x1c')][_0xb48d('0x1f')]||null:null,'limit':_0x480f58['options']?_0x480f58['options'][_0xb48d('0x20')]||null:null})[_0xb48d('0xc')](function(_0x54d45d){logger[_0xb48d('0xd')](_0xb48d('0x1d'),_0x480f58);logger[_0xb48d('0x10')](_0xb48d('0x1d'),_0x480f58,JSON['stringify'](_0x54d45d));_0x102b66(_0x54d45d);})['catch'](function(_0x11c629){logger[_0xb48d('0x13')](_0xb48d('0x1d'),_0x11c629[_0xb48d('0x15')],_0x480f58);_0x4654d7(_0xf83f36[_0xb48d('0x13')](0x1f4,_0x11c629[_0xb48d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0442048..07eb09c 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 _0x40f0=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x40f0,0x1a4));var _0x040f=function(_0x30affd,_0x31ef0f){_0x30affd=_0x30affd-0x0;var _0x3d2e25=_0x40f0[_0x30affd];return _0x3d2e25;};'use strict';var multer=require('multer');var util=require(_0x040f('0x0'));var path=require(_0x040f('0x1'));var timeout=require(_0x040f('0x2'));var express=require(_0x040f('0x3'));var router=express['Router']();var fs_extra=require(_0x040f('0x4'));var auth=require(_0x040f('0x5'));var interaction=require(_0x040f('0x6'));var config=require(_0x040f('0x7'));var controller=require(_0x040f('0x8'));router[_0x040f('0x9')]('/',auth[_0x040f('0xa')](),controller[_0x040f('0xb')]);router[_0x040f('0x9')]('/describe',auth[_0x040f('0xa')](),controller[_0x040f('0xc')]);router[_0x040f('0x9')](_0x040f('0xd'),auth[_0x040f('0xa')](),controller[_0x040f('0xe')]);router[_0x040f('0xf')]('/',auth['isAuthenticated'](),controller[_0x040f('0x10')]);router['put'](_0x040f('0xd'),auth[_0x040f('0xa')](),controller[_0x040f('0x11')]);router[_0x040f('0x12')](_0x040f('0xd'),auth[_0x040f('0xa')](),controller[_0x040f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5645=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x213000,_0x159d84){var _0x493fa5=function(_0x476899){while(--_0x476899){_0x213000['push'](_0x213000['shift']());}};_0x493fa5(++_0x159d84);}(_0x5645,0x8c));var _0x5564=function(_0x107719,_0x36a59f){_0x107719=_0x107719-0x0;var _0xb3e990=_0x5645[_0x107719];return _0xb3e990;};'use strict';var multer=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var path=require(_0x5564('0x2'));var timeout=require(_0x5564('0x3'));var express=require('express');var router=express[_0x5564('0x4')]();var fs_extra=require(_0x5564('0x5'));var auth=require(_0x5564('0x6'));var interaction=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var controller=require(_0x5564('0x9'));router[_0x5564('0xa')]('/',auth[_0x5564('0xb')](),controller[_0x5564('0xc')]);router[_0x5564('0xa')](_0x5564('0xd'),auth[_0x5564('0xb')](),controller['describe']);router['get'](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5564('0x10')]);router[_0x5564('0x11')](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0x12')]);router[_0x5564('0x13')](_0x5564('0xe'),auth[_0x5564('0xb')](),controller[_0x5564('0x14')]);module[_0x5564('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 374ee46..5dda067 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 _0x214e=['sequelize','STRING'];(function(_0x2d4f8f,_0x3d88f4){var _0xda2e80=function(_0x3a5aa3){while(--_0x3a5aa3){_0x2d4f8f['push'](_0x2d4f8f['shift']());}};_0xda2e80(++_0x3d88f4);}(_0x214e,0x12a));var _0xe214=function(_0x5896e2,_0x7cf6b5){_0x5896e2=_0x5896e2-0x0;var _0x5a1717=_0x214e[_0x5896e2];return _0x5a1717;};'use strict';var Sequelize=require(_0xe214('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe214('0x1')]},'node':{'type':Sequelize[_0xe214('0x1')]},'application':{'type':Sequelize[_0xe214('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xe214('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd3c=['exports','STRING','TEXT','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcd3c,0x1b7));var _0xccd3=function(_0x3dc8cd,_0x4696a3){_0x3dc8cd=_0x3dc8cd-0x0;var _0x192ac8=_0xcd3c[_0x3dc8cd];return _0x192ac8;};'use strict';var Sequelize=require(_0xccd3('0x0'));module[_0xccd3('0x1')]={'uniqueid':{'type':Sequelize[_0xccd3('0x2')]},'node':{'type':Sequelize[_0xccd3('0x2')]},'application':{'type':Sequelize[_0xccd3('0x2')]},'data':{'type':Sequelize[_0xccd3('0x3')]},'project_name':{'type':Sequelize[_0xccd3('0x2')]},'callerid':{'type':Sequelize[_0xccd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 8591a8e..c3bd76a 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 _0x4818=['apply','reject','update','then','sendStatus','error','stack','name','send','index','map','fieldName','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','SquareDetailsReport','includeAll','include','rows','catch','params','rawAttributes','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json'];(function(_0x58c61f,_0x14ad3c){var _0x3915a6=function(_0x28ea93){while(--_0x28ea93){_0x58c61f['push'](_0x58c61f['shift']());}};_0x3915a6(++_0x14ad3c);}(_0x4818,0x10e));var _0x8481=function(_0x5fa878,_0x3d7da4){_0x5fa878=_0x5fa878-0x0;var _0x1420e5=_0x4818[_0x5fa878];return _0x1420e5;};'use strict';var emlformat=require(_0x8481('0x0'));var rimraf=require(_0x8481('0x1'));var zipdir=require(_0x8481('0x2'));var jsonpatch=require(_0x8481('0x3'));var rp=require(_0x8481('0x4'));var moment=require(_0x8481('0x5'));var BPromise=require(_0x8481('0x6'));var Mustache=require(_0x8481('0x7'));var util=require('util');var path=require(_0x8481('0x8'));var sox=require(_0x8481('0x9'));var csv=require('to-csv');var ejs=require(_0x8481('0xa'));var fs=require('fs');var fs_extra=require(_0x8481('0xb'));var _=require(_0x8481('0xc'));var squel=require(_0x8481('0xd'));var crypto=require(_0x8481('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8481('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8481('0x10'));var Papa=require('papaparse');var Redis=require(_0x8481('0x11'));var authService=require(_0x8481('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8481('0x13'));var logger=require(_0x8481('0x14'))(_0x8481('0x15'));var utils=require(_0x8481('0x16'));var config=require(_0x8481('0x17'));var licenseUtil=require(_0x8481('0x18'));var db=require(_0x8481('0x19'))['db'];function respondWithStatusCode(_0x2a2975,_0x5d91ca){_0x5d91ca=_0x5d91ca||0xcc;return function(_0x27741a){if(_0x27741a){return _0x2a2975['sendStatus'](_0x5d91ca);}return _0x2a2975[_0x8481('0x1a')](_0x5d91ca)[_0x8481('0x1b')]();};}function respondWithResult(_0xf2cfc9,_0x4c0363){_0x4c0363=_0x4c0363||0xc8;return function(_0x5f41da){if(_0x5f41da){return _0xf2cfc9[_0x8481('0x1a')](_0x4c0363)['json'](_0x5f41da);}};}function respondWithFilteredResult(_0x4978a6,_0xdb91be){return function(_0x1d85c2){if(_0x1d85c2){var _0x49f7d8=typeof _0xdb91be[_0x8481('0x1c')]==='undefined'&&typeof _0xdb91be[_0x8481('0x1d')]===_0x8481('0x1e');var _0x674d7f=_0x1d85c2[_0x8481('0x1f')];var _0x3770d7=_0x49f7d8?0x0:_0xdb91be[_0x8481('0x1c')];var _0x58852c=_0x49f7d8?_0x1d85c2['count']:_0xdb91be['offset']+_0xdb91be[_0x8481('0x1d')];var _0x192ddd;if(_0x58852c>=_0x674d7f){_0x58852c=_0x674d7f;_0x192ddd=0xc8;}else{_0x192ddd=0xce;}_0x4978a6[_0x8481('0x1a')](_0x192ddd);return _0x4978a6['set'](_0x8481('0x20'),_0x3770d7+'-'+_0x58852c+'/'+_0x674d7f)[_0x8481('0x21')](_0x1d85c2);}return null;};}function patchUpdates(_0x18ee11){return function(_0x3bbe1e){try{jsonpatch[_0x8481('0x22')](_0x3bbe1e,_0x18ee11,!![]);}catch(_0x393b3b){return BPromise[_0x8481('0x23')](_0x393b3b);}return _0x3bbe1e['save']();};}function saveUpdates(_0x614ffb,_0x439fcc){return function(_0x3eb814){if(_0x3eb814){return _0x3eb814[_0x8481('0x24')](_0x614ffb)['then'](function(_0x513bd6){return _0x513bd6;});}return null;};}function removeEntity(_0x4c1551,_0x4151f0){return function(_0x1a527a){if(_0x1a527a){return _0x1a527a['destroy']()[_0x8481('0x25')](function(){_0x4c1551[_0x8481('0x1a')](0xcc)[_0x8481('0x1b')]();});}};}function handleEntityNotFound(_0x8f1f20,_0x241332){return function(_0x2d32ea){if(!_0x2d32ea){_0x8f1f20[_0x8481('0x26')](0x194);}return _0x2d32ea;};}function handleError(_0x16b065,_0x2a7d71){_0x2a7d71=_0x2a7d71||0x1f4;return function(_0x490847){logger[_0x8481('0x27')](_0x490847[_0x8481('0x28')]);if(_0x490847[_0x8481('0x29')]){delete _0x490847[_0x8481('0x29')];}_0x16b065[_0x8481('0x1a')](_0x2a7d71)[_0x8481('0x2a')](_0x490847);};}exports[_0x8481('0x2b')]=function(_0x1379e9,_0x5027ea){var _0x125e5e={},_0x4101aa={},_0x89fda6={'count':0x0,'rows':[]};var _0x54094b=_[_0x8481('0x2c')](db['SquareDetailsReport']['rawAttributes'],function(_0x51280d){return{'name':_0x51280d[_0x8481('0x2d')],'type':_0x51280d['type']['key']};});_0x4101aa[_0x8481('0x2e')]=_['map'](_0x54094b,_0x8481('0x29'));_0x4101aa['query']=_[_0x8481('0x2f')](_0x1379e9['query']);_0x4101aa['filters']=_[_0x8481('0x30')](_0x4101aa[_0x8481('0x2e')],_0x4101aa['query']);_0x125e5e[_0x8481('0x31')]=_[_0x8481('0x30')](_0x4101aa[_0x8481('0x2e')],qs[_0x8481('0x32')](_0x1379e9[_0x8481('0x33')][_0x8481('0x32')]));_0x125e5e['attributes']=_0x125e5e[_0x8481('0x31')][_0x8481('0x34')]?_0x125e5e[_0x8481('0x31')]:_0x4101aa[_0x8481('0x2e')];if(!_0x1379e9[_0x8481('0x33')][_0x8481('0x35')](_0x8481('0x36'))){_0x125e5e['limit']=qs[_0x8481('0x1d')](_0x1379e9[_0x8481('0x33')][_0x8481('0x1d')]);_0x125e5e[_0x8481('0x1c')]=qs['offset'](_0x1379e9[_0x8481('0x33')][_0x8481('0x1c')]);}_0x125e5e[_0x8481('0x37')]=qs['sort'](_0x1379e9[_0x8481('0x33')][_0x8481('0x38')]);_0x125e5e['where']=qs[_0x8481('0x39')](_[_0x8481('0x3a')](_0x1379e9['query'],_0x4101aa['filters']),_0x54094b);if(_0x1379e9['query'][_0x8481('0x3b')]){_0x125e5e[_0x8481('0x3c')]=_[_0x8481('0x3d')](_0x125e5e['where'],{'$or':_[_0x8481('0x2c')](_0x54094b,function(_0x556cf2){if(_0x556cf2[_0x8481('0x3e')]!=='VIRTUAL'){var _0x3281bd={};_0x3281bd[_0x556cf2[_0x8481('0x29')]]={'$like':'%'+_0x1379e9[_0x8481('0x33')][_0x8481('0x3b')]+'%'};return _0x3281bd;}})});}_0x125e5e=_[_0x8481('0x3d')]({},_0x125e5e,_0x1379e9[_0x8481('0x3f')]);var _0x399728={'where':_0x125e5e[_0x8481('0x3c')]};return db[_0x8481('0x40')][_0x8481('0x1f')](_0x399728)['then'](function(_0x3e3f57){_0x89fda6['count']=_0x3e3f57;if(_0x1379e9['query'][_0x8481('0x41')]){_0x125e5e[_0x8481('0x42')]=[{'all':!![]}];}return db[_0x8481('0x40')]['findAll'](_0x125e5e);})['then'](function(_0x246d70){_0x89fda6[_0x8481('0x43')]=_0x246d70;return _0x89fda6;})[_0x8481('0x25')](respondWithFilteredResult(_0x5027ea,_0x125e5e))[_0x8481('0x44')](handleError(_0x5027ea,null));};exports['show']=function(_0x538497,_0x399eb6){var _0xf6ace5={'raw':!![],'where':{'id':_0x538497[_0x8481('0x45')]['id']}},_0x162415={};_0x162415[_0x8481('0x2e')]=_[_0x8481('0x2f')](db[_0x8481('0x40')][_0x8481('0x46')]);_0x162415[_0x8481('0x33')]=_[_0x8481('0x2f')](_0x538497['query']);_0x162415[_0x8481('0x39')]=_[_0x8481('0x30')](_0x162415[_0x8481('0x2e')],_0x162415['query']);_0xf6ace5['attributes']=_['intersection'](_0x162415[_0x8481('0x2e')],qs['fields'](_0x538497['query'][_0x8481('0x32')]));_0xf6ace5[_0x8481('0x31')]=_0xf6ace5[_0x8481('0x31')]['length']?_0xf6ace5[_0x8481('0x31')]:_0x162415[_0x8481('0x2e')];if(_0x538497[_0x8481('0x33')][_0x8481('0x41')]){_0xf6ace5[_0x8481('0x42')]=[{'all':!![]}];}_0xf6ace5=_[_0x8481('0x3d')]({},_0xf6ace5,_0x538497[_0x8481('0x3f')]);return db[_0x8481('0x40')]['find'](_0xf6ace5)[_0x8481('0x25')](handleEntityNotFound(_0x399eb6,null))[_0x8481('0x25')](respondWithResult(_0x399eb6,null))[_0x8481('0x44')](handleError(_0x399eb6,null));};exports[_0x8481('0x47')]=function(_0xc03732,_0x1e9135){return db[_0x8481('0x40')]['create'](_0xc03732[_0x8481('0x48')],{})[_0x8481('0x25')](respondWithResult(_0x1e9135,0xc9))[_0x8481('0x44')](handleError(_0x1e9135,null));};exports[_0x8481('0x24')]=function(_0x4548eb,_0x9bdc67){if(_0x4548eb['body']['id']){delete _0x4548eb[_0x8481('0x48')]['id'];}return db[_0x8481('0x40')][_0x8481('0x49')]({'where':{'id':_0x4548eb[_0x8481('0x45')]['id']}})['then'](handleEntityNotFound(_0x9bdc67,null))[_0x8481('0x25')](saveUpdates(_0x4548eb[_0x8481('0x48')],null))[_0x8481('0x25')](respondWithResult(_0x9bdc67,null))['catch'](handleError(_0x9bdc67,null));};exports[_0x8481('0x4a')]=function(_0x2f6300,_0x54ae6a){return db[_0x8481('0x40')][_0x8481('0x49')]({'where':{'id':_0x2f6300[_0x8481('0x45')]['id']}})['then'](handleEntityNotFound(_0x54ae6a,null))[_0x8481('0x25')](removeEntity(_0x54ae6a,null))[_0x8481('0x44')](handleError(_0x54ae6a,null));};exports[_0x8481('0x4b')]=function(_0x385fc9,_0x14b173){return db[_0x8481('0x40')]['describe']()[_0x8481('0x25')](respondWithResult(_0x14b173,null))[_0x8481('0x44')](handleError(_0x14b173,null));}; \ No newline at end of file +var _0xd238=['bluebird','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','end','stack','name','send','index','SquareDetailsReport','rawAttributes','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','describe','rimraf','request-promise','moment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd238,0x174));var _0x8d23=function(_0x20a098,_0x14b7cb){_0x20a098=_0x20a098-0x0;var _0xc7e9c=_0xd238[_0x20a098];return _0xc7e9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d23('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d23('0x1'));var moment=require(_0x8d23('0x2'));var BPromise=require(_0x8d23('0x3'));var Mustache=require(_0x8d23('0x4'));var util=require(_0x8d23('0x5'));var path=require(_0x8d23('0x6'));var sox=require(_0x8d23('0x7'));var csv=require(_0x8d23('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d23('0x9'));var _=require('lodash');var squel=require(_0x8d23('0xa'));var crypto=require(_0x8d23('0xb'));var jsforce=require(_0x8d23('0xc'));var deskjs=require(_0x8d23('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d23('0xe'));var Papa=require(_0x8d23('0xf'));var Redis=require('ioredis');var authService=require(_0x8d23('0x10'));var qs=require(_0x8d23('0x11'));var as=require(_0x8d23('0x12'));var hardwareService=require(_0x8d23('0x13'));var logger=require('../../config/logger')(_0x8d23('0x14'));var utils=require(_0x8d23('0x15'));var config=require(_0x8d23('0x16'));var licenseUtil=require(_0x8d23('0x17'));var db=require(_0x8d23('0x18'))['db'];function respondWithStatusCode(_0x32b172,_0xdb414d){_0xdb414d=_0xdb414d||0xcc;return function(_0x4a6e92){if(_0x4a6e92){return _0x32b172[_0x8d23('0x19')](_0xdb414d);}return _0x32b172[_0x8d23('0x1a')](_0xdb414d)['end']();};}function respondWithResult(_0x16b273,_0x5aa3af){_0x5aa3af=_0x5aa3af||0xc8;return function(_0x3f8567){if(_0x3f8567){return _0x16b273[_0x8d23('0x1a')](_0x5aa3af)[_0x8d23('0x1b')](_0x3f8567);}};}function respondWithFilteredResult(_0x3e1130,_0x16dd9b){return function(_0x26804e){if(_0x26804e){var _0x173636=typeof _0x16dd9b[_0x8d23('0x1c')]==='undefined'&&typeof _0x16dd9b[_0x8d23('0x1d')]===_0x8d23('0x1e');var _0x10bfea=_0x26804e['count'];var _0x3d3480=_0x173636?0x0:_0x16dd9b[_0x8d23('0x1c')];var _0xa79697=_0x173636?_0x26804e[_0x8d23('0x1f')]:_0x16dd9b[_0x8d23('0x1c')]+_0x16dd9b['limit'];var _0x27006b;if(_0xa79697>=_0x10bfea){_0xa79697=_0x10bfea;_0x27006b=0xc8;}else{_0x27006b=0xce;}_0x3e1130[_0x8d23('0x1a')](_0x27006b);return _0x3e1130[_0x8d23('0x20')]('Content-Range',_0x3d3480+'-'+_0xa79697+'/'+_0x10bfea)[_0x8d23('0x1b')](_0x26804e);}return null;};}function patchUpdates(_0x5c72f8){return function(_0x4a0aff){try{jsonpatch['apply'](_0x4a0aff,_0x5c72f8,!![]);}catch(_0x4017b8){return BPromise[_0x8d23('0x21')](_0x4017b8);}return _0x4a0aff['save']();};}function saveUpdates(_0x50d256,_0x47e98b){return function(_0x16a217){if(_0x16a217){return _0x16a217[_0x8d23('0x22')](_0x50d256)[_0x8d23('0x23')](function(_0x4d8576){return _0x4d8576;});}return null;};}function removeEntity(_0x116d3e,_0x1fb0f7){return function(_0x3a9ded){if(_0x3a9ded){return _0x3a9ded['destroy']()[_0x8d23('0x23')](function(){_0x116d3e[_0x8d23('0x1a')](0xcc)[_0x8d23('0x24')]();});}};}function handleEntityNotFound(_0x561c11,_0x27478d){return function(_0x286411){if(!_0x286411){_0x561c11[_0x8d23('0x19')](0x194);}return _0x286411;};}function handleError(_0x52deeb,_0x224333){_0x224333=_0x224333||0x1f4;return function(_0x56b678){logger['error'](_0x56b678[_0x8d23('0x25')]);if(_0x56b678['name']){delete _0x56b678[_0x8d23('0x26')];}_0x52deeb[_0x8d23('0x1a')](_0x224333)[_0x8d23('0x27')](_0x56b678);};}exports[_0x8d23('0x28')]=function(_0x53d4cc,_0x210627){var _0x4047c0={},_0x5190d4={},_0x23a133={'count':0x0,'rows':[]};var _0x1e65a9=_['map'](db[_0x8d23('0x29')][_0x8d23('0x2a')],function(_0x587964){return{'name':_0x587964['fieldName'],'type':_0x587964['type'][_0x8d23('0x2b')]};});_0x5190d4['model']=_[_0x8d23('0x2c')](_0x1e65a9,'name');_0x5190d4[_0x8d23('0x2d')]=_[_0x8d23('0x2e')](_0x53d4cc[_0x8d23('0x2d')]);_0x5190d4[_0x8d23('0x2f')]=_[_0x8d23('0x30')](_0x5190d4[_0x8d23('0x31')],_0x5190d4['query']);_0x4047c0['attributes']=_[_0x8d23('0x30')](_0x5190d4[_0x8d23('0x31')],qs[_0x8d23('0x32')](_0x53d4cc[_0x8d23('0x2d')]['fields']));_0x4047c0[_0x8d23('0x33')]=_0x4047c0[_0x8d23('0x33')][_0x8d23('0x34')]?_0x4047c0[_0x8d23('0x33')]:_0x5190d4[_0x8d23('0x31')];if(!_0x53d4cc['query'][_0x8d23('0x35')](_0x8d23('0x36'))){_0x4047c0[_0x8d23('0x1d')]=qs['limit'](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x1d')]);_0x4047c0[_0x8d23('0x1c')]=qs[_0x8d23('0x1c')](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x1c')]);}_0x4047c0[_0x8d23('0x37')]=qs[_0x8d23('0x38')](_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x38')]);_0x4047c0['where']=qs[_0x8d23('0x2f')](_[_0x8d23('0x39')](_0x53d4cc[_0x8d23('0x2d')],_0x5190d4['filters']),_0x1e65a9);if(_0x53d4cc['query'][_0x8d23('0x3a')]){_0x4047c0['where']=_[_0x8d23('0x3b')](_0x4047c0[_0x8d23('0x3c')],{'$or':_['map'](_0x1e65a9,function(_0xbd9d49){if(_0xbd9d49[_0x8d23('0x3d')]!==_0x8d23('0x3e')){var _0x1664a7={};_0x1664a7[_0xbd9d49[_0x8d23('0x26')]]={'$like':'%'+_0x53d4cc[_0x8d23('0x2d')][_0x8d23('0x3a')]+'%'};return _0x1664a7;}})});}_0x4047c0=_[_0x8d23('0x3b')]({},_0x4047c0,_0x53d4cc[_0x8d23('0x3f')]);var _0x49ded3={'where':_0x4047c0[_0x8d23('0x3c')]};return db['SquareDetailsReport'][_0x8d23('0x1f')](_0x49ded3)['then'](function(_0x68112c){_0x23a133['count']=_0x68112c;if(_0x53d4cc['query']['includeAll']){_0x4047c0[_0x8d23('0x40')]=[{'all':!![]}];}return db[_0x8d23('0x29')][_0x8d23('0x41')](_0x4047c0);})['then'](function(_0x3739cb){_0x23a133[_0x8d23('0x42')]=_0x3739cb;return _0x23a133;})['then'](respondWithFilteredResult(_0x210627,_0x4047c0))[_0x8d23('0x43')](handleError(_0x210627,null));};exports[_0x8d23('0x44')]=function(_0x41f5cc,_0x41f50e){var _0x22dd3e={'raw':!![],'where':{'id':_0x41f5cc[_0x8d23('0x45')]['id']}},_0x120459={};_0x120459['model']=_[_0x8d23('0x2e')](db[_0x8d23('0x29')][_0x8d23('0x2a')]);_0x120459[_0x8d23('0x2d')]=_['keys'](_0x41f5cc[_0x8d23('0x2d')]);_0x120459[_0x8d23('0x2f')]=_[_0x8d23('0x30')](_0x120459[_0x8d23('0x31')],_0x120459[_0x8d23('0x2d')]);_0x22dd3e[_0x8d23('0x33')]=_[_0x8d23('0x30')](_0x120459[_0x8d23('0x31')],qs[_0x8d23('0x32')](_0x41f5cc[_0x8d23('0x2d')][_0x8d23('0x32')]));_0x22dd3e['attributes']=_0x22dd3e['attributes']['length']?_0x22dd3e['attributes']:_0x120459['model'];if(_0x41f5cc[_0x8d23('0x2d')][_0x8d23('0x46')]){_0x22dd3e[_0x8d23('0x40')]=[{'all':!![]}];}_0x22dd3e=_[_0x8d23('0x3b')]({},_0x22dd3e,_0x41f5cc[_0x8d23('0x3f')]);return db[_0x8d23('0x29')]['find'](_0x22dd3e)[_0x8d23('0x23')](handleEntityNotFound(_0x41f50e,null))[_0x8d23('0x23')](respondWithResult(_0x41f50e,null))[_0x8d23('0x43')](handleError(_0x41f50e,null));};exports[_0x8d23('0x47')]=function(_0xc23c7e,_0x545a23){return db['SquareDetailsReport'][_0x8d23('0x47')](_0xc23c7e['body'],{})[_0x8d23('0x23')](respondWithResult(_0x545a23,0xc9))[_0x8d23('0x43')](handleError(_0x545a23,null));};exports[_0x8d23('0x22')]=function(_0x34e06b,_0x3cb960){if(_0x34e06b[_0x8d23('0x48')]['id']){delete _0x34e06b['body']['id'];}return db[_0x8d23('0x29')]['find']({'where':{'id':_0x34e06b[_0x8d23('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cb960,null))[_0x8d23('0x23')](saveUpdates(_0x34e06b[_0x8d23('0x48')],null))[_0x8d23('0x23')](respondWithResult(_0x3cb960,null))['catch'](handleError(_0x3cb960,null));};exports[_0x8d23('0x49')]=function(_0x1afd63,_0x594f00){return db[_0x8d23('0x29')]['find']({'where':{'id':_0x1afd63[_0x8d23('0x45')]['id']}})[_0x8d23('0x23')](handleEntityNotFound(_0x594f00,null))[_0x8d23('0x23')](removeEntity(_0x594f00,null))[_0x8d23('0x43')](handleError(_0x594f00,null));};exports[_0x8d23('0x4a')]=function(_0xcc8f02,_0x585851){return db[_0x8d23('0x29')][_0x8d23('0x4a')]()[_0x8d23('0x23')](respondWithResult(_0x585851,null))[_0x8d23('0x43')](handleError(_0x585851,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 30d0d5a..792f02e 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 _0x3a1d=['api','moment','bluebird','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger'];(function(_0x3c6ab3,_0x433fe9){var _0x5f125d=function(_0x382a8c){while(--_0x382a8c){_0x3c6ab3['push'](_0x3c6ab3['shift']());}};_0x5f125d(++_0x433fe9);}(_0x3a1d,0xda));var _0xd3a1=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0x3a1d[_0x3b6f58];return _0x987c61;};'use strict';var _=require(_0xd3a1('0x0'));var util=require('util');var logger=require(_0xd3a1('0x1'))(_0xd3a1('0x2'));var moment=require(_0xd3a1('0x3'));var BPromise=require(_0xd3a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3a1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd3a1('0x6'));module[_0xd3a1('0x7')]=function(_0x11ae56,_0x2b1fe1){return _0x11ae56[_0xd3a1('0x8')](_0xd3a1('0x9'),attributes,{'tableName':_0xd3a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce1=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x4ce1,0xca));var _0x14ce=function(_0x1fe6e7,_0x30fdb){_0x1fe6e7=_0x1fe6e7-0x0;var _0xf87e74=_0x4ce1[_0x1fe6e7];return _0xf87e74;};'use strict';var _=require(_0x14ce('0x0'));var util=require('util');var logger=require(_0x14ce('0x1'))(_0x14ce('0x2'));var moment=require('moment');var BPromise=require(_0x14ce('0x3'));var rp=require(_0x14ce('0x4'));var fs=require('fs');var path=require(_0x14ce('0x5'));var rimraf=require('rimraf');var config=require(_0x14ce('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x11763d,_0x4c48bf){return _0x11763d[_0x14ce('0x7')](_0x14ce('0x8'),attributes,{'tableName':_0x14ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 9389cc8..76f8b8e 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 _0x7894=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3db07c,_0x22f5dd){var _0x4385ae=function(_0x2843f0){while(--_0x2843f0){_0x3db07c['push'](_0x3db07c['shift']());}};_0x4385ae(++_0x22f5dd);}(_0x7894,0x170));var _0x4789=function(_0x1326b2,_0x574ba0){_0x1326b2=_0x1326b2-0x0;var _0x17b0df=_0x7894[_0x1326b2];return _0x17b0df;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require(_0x4789('0x3'));var rs=require(_0x4789('0x4'));var fs=require('fs');var Redis=require(_0x4789('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114a90,_0x298902,_0x13b7f6){return new BPromise(function(_0x5a45ae,_0x49d256){return client[_0x4789('0xc')](_0x114a90,_0x13b7f6)['then'](function(_0x2e8038){logger[_0x4789('0xd')](_0x4789('0xe'),_0x298902,'request\x20sent');logger[_0x4789('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x298902,_0x4789('0x10'),JSON[_0x4789('0x11')](_0x2e8038));if(_0x2e8038[_0x4789('0x12')]){if(_0x2e8038['error']['code']===0x1f4){logger[_0x4789('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x298902,_0x2e8038[_0x4789('0x12')]['message']);return _0x49d256(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}logger['error'](_0x4789('0xe'),_0x298902,_0x2e8038['error'][_0x4789('0x13')]);return _0x5a45ae(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xe'),_0x298902,_0x4789('0x10'));_0x5a45ae(_0x2e8038['result'][_0x4789('0x13')]);}})['catch'](function(_0x118f97){logger[_0x4789('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x298902,_0x118f97);_0x49d256(_0x118f97);});});}exports[_0x4789('0x14')]=function(_0x5af7b3){var _0x2f1511=this;return new Promise(function(_0x56d799,_0x19dc59){return db[_0x4789('0x15')]['create'](_0x5af7b3[_0x4789('0x16')],{'raw':_0x5af7b3[_0x4789('0x17')]?_0x5af7b3[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![]})[_0x4789('0x19')](function(_0x3a707d){logger[_0x4789('0xd')](_0x4789('0x14'),_0x5af7b3);logger[_0x4789('0xf')](_0x4789('0x14'),_0x5af7b3,JSON[_0x4789('0x11')](_0x3a707d));_0x56d799(_0x3a707d);})[_0x4789('0x1a')](function(_0x4f7ceb){logger[_0x4789('0x12')](_0x4789('0x14'),_0x4f7ceb['message'],_0x5af7b3);_0x19dc59(_0x2f1511[_0x4789('0x12')](0x1f4,_0x4f7ceb[_0x4789('0x13')]));});});}; \ No newline at end of file +var _0xe1e3=['jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x48c26b,_0x8dec12){var _0x32d08b=function(_0x5b2c3b){while(--_0x5b2c3b){_0x48c26b['push'](_0x48c26b['shift']());}};_0x32d08b(++_0x8dec12);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4b4d5f,_0x4b7dab){_0x4b4d5f=_0x4b4d5f-0x0;var _0x352832=_0xe1e3[_0x4b4d5f];return _0x352832;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['SquareDetailsReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateSquareDetailsReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8742241..e32cc55 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 _0x2dae=['index','/process/:pid/kill','killProcess','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x1aa76f,_0x1337e2){var _0x956cc2=function(_0x4c6f4b){while(--_0x4c6f4b){_0x1aa76f['push'](_0x1aa76f['shift']());}};_0x956cc2(++_0x1337e2);}(_0x2dae,0x8b));var _0xe2da=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x2dae[_0x1cc961];return _0x471d86;};'use strict';var express=require(_0xe2da('0x0'));var router=express[_0xe2da('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe2da('0x2'));router[_0xe2da('0x3')]('/',auth[_0xe2da('0x4')](),controller[_0xe2da('0x5')]);router[_0xe2da('0x3')](_0xe2da('0x6'),auth[_0xe2da('0x4')](),controller[_0xe2da('0x7')]);module[_0xe2da('0x8')]=router; \ No newline at end of file +var _0x34d4=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x1478b1,_0x85d8e5){var _0x403f8d=function(_0x45d00d){while(--_0x45d00d){_0x1478b1['push'](_0x1478b1['shift']());}};_0x403f8d(++_0x85d8e5);}(_0x34d4,0xeb));var _0x434d=function(_0x4ac517,_0x481cb1){_0x4ac517=_0x4ac517-0x0;var _0x17dec8=_0x34d4[_0x4ac517];return _0x17dec8;};'use strict';var express=require(_0x434d('0x0'));var router=express[_0x434d('0x1')]();var auth=require(_0x434d('0x2'));var controller=require(_0x434d('0x3'));router[_0x434d('0x4')]('/',auth[_0x434d('0x5')](),controller[_0x434d('0x6')]);router[_0x434d('0x4')](_0x434d('0x7'),auth[_0x434d('0x5')](),controller[_0x434d('0x8')]);module[_0x434d('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0c4e743..afa613a 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 _0x9c42=['catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','pid','kill','SIGINT','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','index','then','json'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0x9c42,0x12c));var _0x29c4=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x9c42[_0x4bfe08];return _0x1f9125;};'use strict';var info=require(_0x29c4('0x0'));var exec=require(_0x29c4('0x1'))[_0x29c4('0x2')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require(_0x29c4('0x3'));var _=require(_0x29c4('0x4'));function handleError(_0x21631f,_0x36dd04,_0x122058){_0x36dd04=_0x36dd04||0x1f4;return function(_0x20c08e){logger[_0x29c4('0x5')](_0x29c4('0x6'),_0x122058,_0x36dd04,util[_0x29c4('0x7')](_0x20c08e,{'showHidden':![],'depth':null}));delete _0x20c08e['name'];_0x21631f['status'](_0x36dd04)[_0x29c4('0x8')](_0x20c08e);};}exports[_0x29c4('0x9')]=function(_0x4d4787,_0xefdb37){return info['getAllData']()[_0x29c4('0xa')](function(_0x5c97f4){return _0xefdb37['status'](0xc8)[_0x29c4('0xb')](_0x5c97f4);})[_0x29c4('0xc')](function(_0xd208c1){return _0xefdb37['status'](0x1f4)['json'](_0xd208c1);});};exports['killProcess']=function(_0x22e8e5,_0x2141e8){var _0x2d5ff4=['components/import/cm'];return new BPromise(function(_0x3e9ad6,_0x353a71){return exec(util[_0x29c4('0xd')](_0x29c4('0xe'),_0x22e8e5[_0x29c4('0xf')]['pid']),function(_0x323685,_0x1f70d5,_0x212bff){if(_0x323685){return _0x353a71(_0x323685);}return _0x3e9ad6(_0x1f70d5);});})['then'](function(_0x24cb43){var _0x48f13f=![];var _0x50831d=_0x24cb43[_0x29c4('0x10')](/\n/);for(var _0x281100=0x0,_0x1aab10=_0x2d5ff4[_0x29c4('0x11')];_0x281100<_0x1aab10,_0x48f13f===![];_0x281100+=0x1){if(_0x24cb43['indexOf'](_0x2d5ff4[_0x281100])>=0x0){_0x48f13f=!![];}}if(!_0x48f13f){throw new Error(util[_0x29c4('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x22e8e5[_0x29c4('0xf')][_0x29c4('0x12')]));}process[_0x29c4('0x13')](_0x22e8e5[_0x29c4('0xf')][_0x29c4('0x12')],_0x29c4('0x14'));return _0x2141e8[_0x29c4('0x15')](0xc8)[_0x29c4('0xb')]({'message':util[_0x29c4('0xd')](_0x29c4('0x16'),_0x22e8e5[_0x29c4('0xf')][_0x29c4('0x12')])});})['catch'](handleError(_0x2141e8,null,_0x29c4('0x17')));}; \ No newline at end of file +var _0xc406=['kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x57a7f3,_0x26889b){var _0x38d9f9=function(_0x412d55){while(--_0x412d55){_0x57a7f3['push'](_0x57a7f3['shift']());}};_0x38d9f9(++_0x26889b);}(_0xc406,0x1a9));var _0x6c40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc406[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x6c40('0x0'));var exec=require(_0x6c40('0x1'))[_0x6c40('0x2')];var logger=require(_0x6c40('0x3'))(_0x6c40('0x4'));var util=require('util');var BPromise=require(_0x6c40('0x5'));var _=require(_0x6c40('0x6'));function handleError(_0x70c2e5,_0x17aed0,_0x417200){_0x17aed0=_0x17aed0||0x1f4;return function(_0x22befc){logger[_0x6c40('0x7')](_0x6c40('0x8'),_0x417200,_0x17aed0,util[_0x6c40('0x9')](_0x22befc,{'showHidden':![],'depth':null}));delete _0x22befc['name'];_0x70c2e5[_0x6c40('0xa')](_0x17aed0)[_0x6c40('0xb')](_0x22befc);};}exports['index']=function(_0x1748c4,_0x55b1a7){return info[_0x6c40('0xc')]()[_0x6c40('0xd')](function(_0x2f7b92){return _0x55b1a7[_0x6c40('0xa')](0xc8)[_0x6c40('0xe')](_0x2f7b92);})['catch'](function(_0x46f9fb){return _0x55b1a7[_0x6c40('0xa')](0x1f4)[_0x6c40('0xe')](_0x46f9fb);});};exports[_0x6c40('0xf')]=function(_0x40e80c,_0x34212b){var _0x48c023=[_0x6c40('0x10')];return new BPromise(function(_0x5e1122,_0x579f3c){return exec(util[_0x6c40('0x11')](_0x6c40('0x12'),_0x40e80c[_0x6c40('0x13')]['pid']),function(_0x347310,_0x584338,_0x2eb4b6){if(_0x347310){return _0x579f3c(_0x347310);}return _0x5e1122(_0x584338);});})['then'](function(_0x29ca23){var _0x5c907b=![];var _0x5ba6a8=_0x29ca23[_0x6c40('0x14')](/\n/);for(var _0x449519=0x0,_0x5b2dcb=_0x48c023[_0x6c40('0x15')];_0x449519<_0x5b2dcb,_0x5c907b===![];_0x449519+=0x1){if(_0x29ca23['indexOf'](_0x48c023[_0x449519])>=0x0){_0x5c907b=!![];}}if(!_0x5c907b){throw new Error(util[_0x6c40('0x11')](_0x6c40('0x16'),_0x40e80c[_0x6c40('0x13')]['pid']));}process[_0x6c40('0x17')](_0x40e80c[_0x6c40('0x13')][_0x6c40('0x18')],_0x6c40('0x19'));return _0x34212b[_0x6c40('0xa')](0xc8)[_0x6c40('0xe')]({'message':util[_0x6c40('0x11')](_0x6c40('0x1a'),_0x40e80c[_0x6c40('0x13')][_0x6c40('0x18')])});})[_0x6c40('0x1b')](handleError(_0x34212b,null,_0x6c40('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f5cd8dd..af2c3c0 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/describe','show','post'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 _0x153f=['Router','fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3ae7ab,_0x898902){var _0x9f04f2=function(_0x2243c0){while(--_0x2243c0){_0x3ae7ab['push'](_0x3ae7ab['shift']());}};_0x9f04f2(++_0x898902);}(_0x153f,0x15b));var _0xf153=function(_0x3983a2,_0x5adabe){_0x3983a2=_0x3983a2-0x0;var _0x5d1578=_0x153f[_0x3983a2];return _0x5d1578;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index dd26bf3..d5f3ff8 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 _0x5eb8=['name','#0091EA','STRING'];(function(_0xcffb7c,_0x107710){var _0x56cdd1=function(_0x1bdc13){while(--_0x1bdc13){_0xcffb7c['push'](_0xcffb7c['shift']());}};_0x56cdd1(++_0x107710);}(_0x5eb8,0xb0));var _0x85eb=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x5eb8[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file +var _0xefe3=['STRING','#0091EA','sequelize'];(function(_0x4eebcf,_0x5a49f3){var _0x1612a5=function(_0x5d4264){while(--_0x5d4264){_0x4eebcf['push'](_0x4eebcf['shift']());}};_0x1612a5(++_0x5a49f3);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3efe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':_0x3efe('0x2')},'description':{'type':Sequelize[_0x3efe('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e22961f..9c94ddf 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 _0x80ce=['UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Tags'];(function(_0x3a7a8f,_0x248578){var _0x15cc41=function(_0x3d1a55){while(--_0x3d1a55){_0x3a7a8f['push'](_0x3a7a8f['shift']());}};_0x15cc41(++_0x248578);}(_0x80ce,0x7d));var _0xe80c=function(_0x56d026,_0x18a964){_0x56d026=_0x56d026-0x0;var _0x15f439=_0x80ce[_0x56d026];return _0x15f439;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe80c('0x0'));var rp=require(_0xe80c('0x1'));var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require(_0xe80c('0x5'));var path=require(_0xe80c('0x6'));var sox=require(_0xe80c('0x7'));var csv=require(_0xe80c('0x8'));var ejs=require(_0xe80c('0x9'));var fs=require('fs');var fs_extra=require(_0xe80c('0xa'));var _=require(_0xe80c('0xb'));var squel=require(_0xe80c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0xd'));var toCsv=require(_0xe80c('0x8'));var querystring=require('querystring');var Papa=require(_0xe80c('0xe'));var Redis=require(_0xe80c('0xf'));var authService=require(_0xe80c('0x10'));var qs=require(_0xe80c('0x11'));var as=require(_0xe80c('0x12'));var hardwareService=require(_0xe80c('0x13'));var logger=require('../../config/logger')(_0xe80c('0x14'));var utils=require(_0xe80c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3b13,_0x38cede){_0x38cede=_0x38cede||0xcc;return function(_0x1f8ea2){if(_0x1f8ea2){return _0x4d3b13[_0xe80c('0x16')](_0x38cede);}return _0x4d3b13[_0xe80c('0x17')](_0x38cede)[_0xe80c('0x18')]();};}function respondWithResult(_0x3c707e,_0x3ea41f){_0x3ea41f=_0x3ea41f||0xc8;return function(_0x3e25dd){if(_0x3e25dd){return _0x3c707e['status'](_0x3ea41f)[_0xe80c('0x19')](_0x3e25dd);}};}function respondWithFilteredResult(_0x2a2f9c,_0x4e9612){return function(_0x277f91){if(_0x277f91){var _0x53b0cb=typeof _0x4e9612[_0xe80c('0x1a')]===_0xe80c('0x1b')&&typeof _0x4e9612[_0xe80c('0x1c')]==='undefined';var _0x3e28d4=_0x277f91['count'];var _0x373d4a=_0x53b0cb?0x0:_0x4e9612['offset'];var _0x2a9bd0=_0x53b0cb?_0x277f91[_0xe80c('0x1d')]:_0x4e9612[_0xe80c('0x1a')]+_0x4e9612[_0xe80c('0x1c')];var _0x40617a;if(_0x2a9bd0>=_0x3e28d4){_0x2a9bd0=_0x3e28d4;_0x40617a=0xc8;}else{_0x40617a=0xce;}_0x2a2f9c[_0xe80c('0x17')](_0x40617a);return _0x2a2f9c[_0xe80c('0x1e')](_0xe80c('0x1f'),_0x373d4a+'-'+_0x2a9bd0+'/'+_0x3e28d4)[_0xe80c('0x19')](_0x277f91);}return null;};}function patchUpdates(_0x5903ac){return function(_0x4f5ff5){try{jsonpatch[_0xe80c('0x20')](_0x4f5ff5,_0x5903ac,!![]);}catch(_0x1aff0e){return BPromise[_0xe80c('0x21')](_0x1aff0e);}return _0x4f5ff5[_0xe80c('0x22')]();};}function saveUpdates(_0x24b63c,_0x31db11){return function(_0x97d405){if(_0x97d405){return _0x97d405['update'](_0x24b63c)[_0xe80c('0x23')](function(_0x3e8246){return _0x3e8246;});}return null;};}function removeEntity(_0x35b15d,_0x36411e){return function(_0x43e4a6){if(_0x43e4a6){return _0x43e4a6[_0xe80c('0x24')]()[_0xe80c('0x23')](function(){var _0x30d37b=_0x43e4a6[_0xe80c('0x25')]({'plain':!![]});var _0x31ac93=_0xe80c('0x26');return db[_0xe80c('0x27')][_0xe80c('0x24')]({'where':{'type':_0x31ac93,'resourceId':_0x30d37b['id']}})[_0xe80c('0x23')](function(){return _0x43e4a6;});})[_0xe80c('0x23')](function(){_0x35b15d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fae89,_0x89c20f){return function(_0x4dae4e){if(!_0x4dae4e){_0x4fae89[_0xe80c('0x16')](0x194);}return _0x4dae4e;};}function handleError(_0x90af61,_0x275633){_0x275633=_0x275633||0x1f4;return function(_0x286fc0){logger[_0xe80c('0x28')](_0x286fc0[_0xe80c('0x29')]);if(_0x286fc0['name']){delete _0x286fc0[_0xe80c('0x2a')];}_0x90af61[_0xe80c('0x17')](_0x275633)[_0xe80c('0x2b')](_0x286fc0);};}exports[_0xe80c('0x2c')]=function(_0x36806e,_0x1635ba){var _0x38e757={},_0x260bb6={},_0x1b30fa={'count':0x0,'rows':[]};var _0x4b00b2=_[_0xe80c('0x2d')](db[_0xe80c('0x2e')][_0xe80c('0x2f')],function(_0x54d6ae){return{'name':_0x54d6ae[_0xe80c('0x30')],'type':_0x54d6ae[_0xe80c('0x31')]['key']};});_0x260bb6['model']=_[_0xe80c('0x2d')](_0x4b00b2,_0xe80c('0x2a'));_0x260bb6[_0xe80c('0x32')]=_[_0xe80c('0x33')](_0x36806e['query']);_0x260bb6[_0xe80c('0x34')]=_['intersection'](_0x260bb6[_0xe80c('0x35')],_0x260bb6[_0xe80c('0x32')]);_0x38e757[_0xe80c('0x36')]=_[_0xe80c('0x37')](_0x260bb6['model'],qs[_0xe80c('0x38')](_0x36806e[_0xe80c('0x32')][_0xe80c('0x38')]));_0x38e757['attributes']=_0x38e757[_0xe80c('0x36')][_0xe80c('0x39')]?_0x38e757[_0xe80c('0x36')]:_0x260bb6[_0xe80c('0x35')];if(!_0x36806e['query'][_0xe80c('0x3a')](_0xe80c('0x3b'))){_0x38e757[_0xe80c('0x1c')]=qs[_0xe80c('0x1c')](_0x36806e[_0xe80c('0x32')]['limit']);_0x38e757['offset']=qs['offset'](_0x36806e['query'][_0xe80c('0x1a')]);}_0x38e757[_0xe80c('0x3c')]=qs[_0xe80c('0x3d')](_0x36806e['query']['sort']);_0x38e757[_0xe80c('0x3e')]=qs[_0xe80c('0x34')](_[_0xe80c('0x3f')](_0x36806e[_0xe80c('0x32')],_0x260bb6[_0xe80c('0x34')]),_0x4b00b2);if(_0x36806e[_0xe80c('0x32')]['filter']){_0x38e757[_0xe80c('0x3e')]=_[_0xe80c('0x40')](_0x38e757[_0xe80c('0x3e')],{'$or':_[_0xe80c('0x2d')](_0x4b00b2,function(_0x16abe1){if(_0x16abe1['type']!==_0xe80c('0x41')){var _0x317c72={};_0x317c72[_0x16abe1['name']]={'$like':'%'+_0x36806e[_0xe80c('0x32')][_0xe80c('0x42')]+'%'};return _0x317c72;}})});}_0x38e757=_[_0xe80c('0x40')]({},_0x38e757,_0x36806e[_0xe80c('0x43')]);var _0xe48a0b={'where':_0x38e757[_0xe80c('0x3e')]};return db[_0xe80c('0x2e')][_0xe80c('0x1d')](_0xe48a0b)[_0xe80c('0x23')](function(_0xc07e2e){_0x1b30fa[_0xe80c('0x1d')]=_0xc07e2e;if(_0x36806e[_0xe80c('0x32')][_0xe80c('0x44')]){_0x38e757['include']=[{'all':!![]}];}return db[_0xe80c('0x2e')][_0xe80c('0x45')](_0x38e757);})[_0xe80c('0x23')](function(_0x17a267){_0x1b30fa['rows']=_0x17a267;return _0x1b30fa;})[_0xe80c('0x23')](respondWithFilteredResult(_0x1635ba,_0x38e757))['catch'](handleError(_0x1635ba,null));};exports[_0xe80c('0x46')]=function(_0x57dd2d,_0x57eb04){var _0x475a5e={'raw':!![],'where':{'id':_0x57dd2d[_0xe80c('0x47')]['id']}},_0x56de3b={};_0x56de3b[_0xe80c('0x35')]=_['keys'](db[_0xe80c('0x2e')][_0xe80c('0x2f')]);_0x56de3b[_0xe80c('0x32')]=_['keys'](_0x57dd2d[_0xe80c('0x32')]);_0x56de3b['filters']=_[_0xe80c('0x37')](_0x56de3b[_0xe80c('0x35')],_0x56de3b[_0xe80c('0x32')]);_0x475a5e[_0xe80c('0x36')]=_[_0xe80c('0x37')](_0x56de3b[_0xe80c('0x35')],qs['fields'](_0x57dd2d[_0xe80c('0x32')]['fields']));_0x475a5e[_0xe80c('0x36')]=_0x475a5e['attributes'][_0xe80c('0x39')]?_0x475a5e[_0xe80c('0x36')]:_0x56de3b[_0xe80c('0x35')];if(_0x57dd2d[_0xe80c('0x32')][_0xe80c('0x44')]){_0x475a5e['include']=[{'all':!![]}];}_0x475a5e=_[_0xe80c('0x40')]({},_0x475a5e,_0x57dd2d[_0xe80c('0x43')]);return db[_0xe80c('0x2e')][_0xe80c('0x48')](_0x475a5e)[_0xe80c('0x23')](handleEntityNotFound(_0x57eb04,null))[_0xe80c('0x23')](respondWithResult(_0x57eb04,null))[_0xe80c('0x49')](handleError(_0x57eb04,null));};exports[_0xe80c('0x4a')]=function(_0x27061f,_0x2770c4){return db[_0xe80c('0x2e')]['create'](_0x27061f['body'],{})[_0xe80c('0x23')](function(_0x3f9ddb){var _0x4aba48=_0x27061f['user'][_0xe80c('0x25')]({'plain':!![]});if(!_0x4aba48)throw new Error(_0xe80c('0x4b'));if(_0x4aba48['role']===_0xe80c('0x4c')){var _0x347116=_0x3f9ddb['get']({'plain':!![]});var _0x5a93c7=_0xe80c('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x5a93c7,'userProfileId':_0x4aba48[_0xe80c('0x4d')]},'raw':!![]})[_0xe80c('0x23')](function(_0x15546f){if(_0x15546f&&_0x15546f[_0xe80c('0x4e')]===0x0){return db[_0xe80c('0x27')][_0xe80c('0x4a')]({'name':_0x347116[_0xe80c('0x2a')],'resourceId':_0x347116['id'],'type':_0x15546f[_0xe80c('0x2a')],'sectionId':_0x15546f['id']},{})['then'](function(){return _0x3f9ddb;});}else{return _0x3f9ddb;}})['catch'](function(_0x286958){logger[_0xe80c('0x28')](_0xe80c('0x4f'),_0x286958);throw _0x286958;});}return _0x3f9ddb;})[_0xe80c('0x23')](respondWithResult(_0x2770c4,0xc9))['catch'](handleError(_0x2770c4,null));};exports['update']=function(_0x5de6b4,_0x21ce67){if(_0x5de6b4[_0xe80c('0x50')]['id']){delete _0x5de6b4[_0xe80c('0x50')]['id'];}return db[_0xe80c('0x2e')][_0xe80c('0x48')]({'where':{'id':_0x5de6b4['params']['id']}})[_0xe80c('0x23')](handleEntityNotFound(_0x21ce67,null))['then'](saveUpdates(_0x5de6b4[_0xe80c('0x50')],null))[_0xe80c('0x23')](respondWithResult(_0x21ce67,null))[_0xe80c('0x49')](handleError(_0x21ce67,null));};exports['destroy']=function(_0x340206,_0x185d2d){return db[_0xe80c('0x2e')][_0xe80c('0x48')]({'where':{'id':_0x340206['params']['id']}})[_0xe80c('0x23')](handleEntityNotFound(_0x185d2d,null))[_0xe80c('0x23')](removeEntity(_0x185d2d,null))[_0xe80c('0x49')](handleError(_0x185d2d,null));};exports['describe']=function(_0x342552,_0x287cb0){return db[_0xe80c('0x2e')][_0xe80c('0x51')]()['then'](respondWithResult(_0x287cb0,null))['catch'](handleError(_0x287cb0,null));}; \ No newline at end of file +var _0x8be8=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','Tags','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x342308,_0xdb4482){var _0x295eae=function(_0x366bb9){while(--_0x366bb9){_0x342308['push'](_0x342308['shift']());}};_0x295eae(++_0xdb4482);}(_0x8be8,0xf6));var _0x88be=function(_0x21b831,_0x2de10a){_0x21b831=_0x21b831-0x0;var _0x31354f=_0x8be8[_0x21b831];return _0x31354f;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require(_0x88be('0x1'));var zipdir=require(_0x88be('0x2'));var jsonpatch=require(_0x88be('0x3'));var rp=require(_0x88be('0x4'));var moment=require(_0x88be('0x5'));var BPromise=require(_0x88be('0x6'));var Mustache=require(_0x88be('0x7'));var util=require(_0x88be('0x8'));var path=require('path');var sox=require(_0x88be('0x9'));var csv=require('to-csv');var ejs=require(_0x88be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88be('0xb'));var squel=require(_0x88be('0xc'));var crypto=require(_0x88be('0xd'));var jsforce=require(_0x88be('0xe'));var deskjs=require(_0x88be('0xf'));var toCsv=require(_0x88be('0x10'));var querystring=require('querystring');var Papa=require(_0x88be('0x11'));var Redis=require('ioredis');var authService=require(_0x88be('0x12'));var qs=require(_0x88be('0x13'));var as=require(_0x88be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88be('0x15'))(_0x88be('0x16'));var utils=require(_0x88be('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321775,_0x484d78){_0x484d78=_0x484d78||0xcc;return function(_0x51ee23){if(_0x51ee23){return _0x321775[_0x88be('0x19')](_0x484d78);}return _0x321775[_0x88be('0x1a')](_0x484d78)[_0x88be('0x1b')]();};}function respondWithResult(_0x220d9f,_0x1f6f57){_0x1f6f57=_0x1f6f57||0xc8;return function(_0x209623){if(_0x209623){return _0x220d9f[_0x88be('0x1a')](_0x1f6f57)[_0x88be('0x1c')](_0x209623);}};}function respondWithFilteredResult(_0x4ec7cc,_0xefc67){return function(_0x94737d){if(_0x94737d){var _0x44a12f=typeof _0xefc67['offset']===_0x88be('0x1d')&&typeof _0xefc67[_0x88be('0x1e')]==='undefined';var _0x3566e7=_0x94737d[_0x88be('0x1f')];var _0xf43785=_0x44a12f?0x0:_0xefc67[_0x88be('0x20')];var _0x152918=_0x44a12f?_0x94737d[_0x88be('0x1f')]:_0xefc67[_0x88be('0x20')]+_0xefc67[_0x88be('0x1e')];var _0x53fb85;if(_0x152918>=_0x3566e7){_0x152918=_0x3566e7;_0x53fb85=0xc8;}else{_0x53fb85=0xce;}_0x4ec7cc[_0x88be('0x1a')](_0x53fb85);return _0x4ec7cc['set'](_0x88be('0x21'),_0xf43785+'-'+_0x152918+'/'+_0x3566e7)['json'](_0x94737d);}return null;};}function patchUpdates(_0x51c0e4){return function(_0x2fd77d){try{jsonpatch[_0x88be('0x22')](_0x2fd77d,_0x51c0e4,!![]);}catch(_0x4079f7){return BPromise['reject'](_0x4079f7);}return _0x2fd77d[_0x88be('0x23')]();};}function saveUpdates(_0x332e50,_0x1d0414){return function(_0x213580){if(_0x213580){return _0x213580[_0x88be('0x24')](_0x332e50)[_0x88be('0x25')](function(_0x466b19){return _0x466b19;});}return null;};}function removeEntity(_0x344c20,_0xdd27c1){return function(_0x215024){if(_0x215024){return _0x215024[_0x88be('0x26')]()[_0x88be('0x25')](function(){var _0x358d2c=_0x215024[_0x88be('0x27')]({'plain':!![]});var _0x1c3e45=_0x88be('0x28');return db['UserProfileResource'][_0x88be('0x26')]({'where':{'type':_0x1c3e45,'resourceId':_0x358d2c['id']}})[_0x88be('0x25')](function(){return _0x215024;});})[_0x88be('0x25')](function(){_0x344c20['status'](0xcc)[_0x88be('0x1b')]();});}};}function handleEntityNotFound(_0x381a99,_0x1ca77c){return function(_0x44c139){if(!_0x44c139){_0x381a99[_0x88be('0x19')](0x194);}return _0x44c139;};}function handleError(_0x4f8d52,_0x1fea9d){_0x1fea9d=_0x1fea9d||0x1f4;return function(_0x48f6a0){logger[_0x88be('0x29')](_0x48f6a0['stack']);if(_0x48f6a0[_0x88be('0x2a')]){delete _0x48f6a0[_0x88be('0x2a')];}_0x4f8d52[_0x88be('0x1a')](_0x1fea9d)[_0x88be('0x2b')](_0x48f6a0);};}exports[_0x88be('0x2c')]=function(_0x134910,_0x3180a5){var _0x390cf0={},_0x1de831={},_0x59d21f={'count':0x0,'rows':[]};var _0x46ca1c=_[_0x88be('0x2d')](db[_0x88be('0x2e')][_0x88be('0x2f')],function(_0x382be6){return{'name':_0x382be6[_0x88be('0x30')],'type':_0x382be6[_0x88be('0x31')][_0x88be('0x32')]};});_0x1de831[_0x88be('0x33')]=_['map'](_0x46ca1c,'name');_0x1de831[_0x88be('0x34')]=_[_0x88be('0x35')](_0x134910[_0x88be('0x34')]);_0x1de831['filters']=_['intersection'](_0x1de831[_0x88be('0x33')],_0x1de831['query']);_0x390cf0[_0x88be('0x36')]=_['intersection'](_0x1de831[_0x88be('0x33')],qs[_0x88be('0x37')](_0x134910[_0x88be('0x34')][_0x88be('0x37')]));_0x390cf0[_0x88be('0x36')]=_0x390cf0[_0x88be('0x36')][_0x88be('0x38')]?_0x390cf0[_0x88be('0x36')]:_0x1de831[_0x88be('0x33')];if(!_0x134910[_0x88be('0x34')][_0x88be('0x39')](_0x88be('0x3a'))){_0x390cf0[_0x88be('0x1e')]=qs[_0x88be('0x1e')](_0x134910[_0x88be('0x34')][_0x88be('0x1e')]);_0x390cf0[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x134910[_0x88be('0x34')][_0x88be('0x20')]);}_0x390cf0[_0x88be('0x3b')]=qs[_0x88be('0x3c')](_0x134910[_0x88be('0x34')][_0x88be('0x3c')]);_0x390cf0['where']=qs['filters'](_['pick'](_0x134910[_0x88be('0x34')],_0x1de831['filters']),_0x46ca1c);if(_0x134910[_0x88be('0x34')][_0x88be('0x3d')]){_0x390cf0[_0x88be('0x3e')]=_[_0x88be('0x3f')](_0x390cf0[_0x88be('0x3e')],{'$or':_[_0x88be('0x2d')](_0x46ca1c,function(_0x224c91){if(_0x224c91['type']!=='VIRTUAL'){var _0x2ed10d={};_0x2ed10d[_0x224c91[_0x88be('0x2a')]]={'$like':'%'+_0x134910[_0x88be('0x34')][_0x88be('0x3d')]+'%'};return _0x2ed10d;}})});}_0x390cf0=_['merge']({},_0x390cf0,_0x134910[_0x88be('0x40')]);var _0x1f65a8={'where':_0x390cf0[_0x88be('0x3e')]};return db[_0x88be('0x2e')]['count'](_0x1f65a8)[_0x88be('0x25')](function(_0x429f7b){_0x59d21f[_0x88be('0x1f')]=_0x429f7b;if(_0x134910[_0x88be('0x34')][_0x88be('0x41')]){_0x390cf0[_0x88be('0x42')]=[{'all':!![]}];}return db[_0x88be('0x2e')][_0x88be('0x43')](_0x390cf0);})[_0x88be('0x25')](function(_0x5261d7){_0x59d21f[_0x88be('0x44')]=_0x5261d7;return _0x59d21f;})['then'](respondWithFilteredResult(_0x3180a5,_0x390cf0))['catch'](handleError(_0x3180a5,null));};exports[_0x88be('0x45')]=function(_0x101e20,_0x267cdc){var _0xae6c17={'raw':!![],'where':{'id':_0x101e20[_0x88be('0x46')]['id']}},_0x4aca27={};_0x4aca27[_0x88be('0x33')]=_[_0x88be('0x35')](db[_0x88be('0x2e')][_0x88be('0x2f')]);_0x4aca27['query']=_[_0x88be('0x35')](_0x101e20[_0x88be('0x34')]);_0x4aca27['filters']=_[_0x88be('0x47')](_0x4aca27['model'],_0x4aca27[_0x88be('0x34')]);_0xae6c17['attributes']=_[_0x88be('0x47')](_0x4aca27[_0x88be('0x33')],qs['fields'](_0x101e20[_0x88be('0x34')][_0x88be('0x37')]));_0xae6c17[_0x88be('0x36')]=_0xae6c17[_0x88be('0x36')][_0x88be('0x38')]?_0xae6c17[_0x88be('0x36')]:_0x4aca27['model'];if(_0x101e20['query'][_0x88be('0x41')]){_0xae6c17[_0x88be('0x42')]=[{'all':!![]}];}_0xae6c17=_[_0x88be('0x3f')]({},_0xae6c17,_0x101e20[_0x88be('0x40')]);return db[_0x88be('0x2e')][_0x88be('0x48')](_0xae6c17)['then'](handleEntityNotFound(_0x267cdc,null))['then'](respondWithResult(_0x267cdc,null))[_0x88be('0x49')](handleError(_0x267cdc,null));};exports[_0x88be('0x4a')]=function(_0xf60d87,_0x174488){return db['Tag']['create'](_0xf60d87[_0x88be('0x4b')],{})['then'](function(_0x3f5de3){var _0x4007cd=_0xf60d87[_0x88be('0x4c')]['get']({'plain':!![]});if(!_0x4007cd)throw new Error(_0x88be('0x4d'));if(_0x4007cd[_0x88be('0x4e')]==='user'){var _0x3dc85b=_0x3f5de3['get']({'plain':!![]});var _0x1956ae='Tags';return db[_0x88be('0x4f')][_0x88be('0x48')]({'where':{'name':_0x1956ae,'userProfileId':_0x4007cd[_0x88be('0x50')]},'raw':!![]})[_0x88be('0x25')](function(_0xffc8a9){if(_0xffc8a9&&_0xffc8a9[_0x88be('0x51')]===0x0){return db[_0x88be('0x52')][_0x88be('0x4a')]({'name':_0x3dc85b['name'],'resourceId':_0x3dc85b['id'],'type':_0xffc8a9[_0x88be('0x2a')],'sectionId':_0xffc8a9['id']},{})[_0x88be('0x25')](function(){return _0x3f5de3;});}else{return _0x3f5de3;}})['catch'](function(_0x44dd80){logger[_0x88be('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44dd80);throw _0x44dd80;});}return _0x3f5de3;})[_0x88be('0x25')](respondWithResult(_0x174488,0xc9))['catch'](handleError(_0x174488,null));};exports[_0x88be('0x24')]=function(_0x22352f,_0x288c13){if(_0x22352f[_0x88be('0x4b')]['id']){delete _0x22352f['body']['id'];}return db[_0x88be('0x2e')][_0x88be('0x48')]({'where':{'id':_0x22352f[_0x88be('0x46')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x288c13,null))['then'](saveUpdates(_0x22352f[_0x88be('0x4b')],null))['then'](respondWithResult(_0x288c13,null))['catch'](handleError(_0x288c13,null));};exports[_0x88be('0x26')]=function(_0x4849a1,_0x341349){return db[_0x88be('0x2e')][_0x88be('0x48')]({'where':{'id':_0x4849a1[_0x88be('0x46')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x341349,null))['then'](removeEntity(_0x341349,null))[_0x88be('0x49')](handleError(_0x341349,null));};exports[_0x88be('0x53')]=function(_0x29ad7e,_0x132f83){return db[_0x88be('0x2e')][_0x88be('0x53')]()[_0x88be('0x25')](respondWithResult(_0x132f83,null))['catch'](handleError(_0x132f83,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5b60c78..638a18f 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 _0xee22=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xee22,0x8a));var _0x2ee2=function(_0x53f29b,_0x22cf73){_0x53f29b=_0x53f29b-0x0;var _0x18b486=_0xee22[_0x53f29b];return _0x18b486;};'use strict';var _=require(_0x2ee2('0x0'));var util=require(_0x2ee2('0x1'));var logger=require(_0x2ee2('0x2'))(_0x2ee2('0x3'));var moment=require(_0x2ee2('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ee2('0x5'));var fs=require('fs');var path=require(_0x2ee2('0x6'));var rimraf=require(_0x2ee2('0x7'));var config=require(_0x2ee2('0x8'));var attributes=require(_0x2ee2('0x9'));module[_0x2ee2('0xa')]=function(_0x119319,_0x1e4262){return _0x119319[_0x2ee2('0xb')](_0x2ee2('0xc'),attributes,{'tableName':_0x2ee2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe25b=['bluebird','request-promise','path','rimraf','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x5a150c,_0x583b40){var _0x17d8ea=function(_0x41092b){while(--_0x41092b){_0x5a150c['push'](_0x5a150c['shift']());}};_0x17d8ea(++_0x583b40);}(_0xe25b,0xe4));var _0xbe25=function(_0x58b28b,_0x528710){_0x58b28b=_0x58b28b-0x0;var _0x22a632=_0xe25b[_0x58b28b];return _0x22a632;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var logger=require(_0xbe25('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe25('0x3'));var rp=require(_0xbe25('0x4'));var fs=require('fs');var path=require(_0xbe25('0x5'));var rimraf=require(_0xbe25('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe25('0x7'));module['exports']=function(_0xeba575,_0x3b9c86){return _0xeba575[_0xbe25('0x8')](_0xbe25('0x9'),attributes,{'tableName':_0xbe25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index e83e452..207aaed 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb647=['request','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x198b0e,_0x237a4a){var _0x5cdfb9=function(_0x54640d){while(--_0x54640d){_0x198b0e['push'](_0x198b0e['shift']());}};_0x5cdfb9(++_0x237a4a);}(_0xb647,0xdb));var _0x7b64=function(_0x5eb892,_0x30eb1a){_0x5eb892=_0x5eb892-0x0;var _0x404d29=_0xb647[_0x5eb892];return _0x404d29;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var moment=require(_0x7b64('0x2'));var BPromise=require(_0x7b64('0x3'));var rs=require(_0x7b64('0x4'));var fs=require('fs');var Redis=require(_0x7b64('0x5'));var db=require(_0x7b64('0x6'))['db'];var utils=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b64('0x9'));var client=jayson[_0x7b64('0xa')][_0x7b64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80721a,_0xcdec41,_0x22eca3){return new BPromise(function(_0x727684,_0x2ff650){return client[_0x7b64('0xc')](_0x80721a,_0x22eca3)['then'](function(_0x1b8b2a){logger['info'](_0x7b64('0xd'),_0xcdec41,'request\x20sent');logger['debug'](_0x7b64('0xe'),_0xcdec41,_0x7b64('0xf'),JSON['stringify'](_0x1b8b2a));if(_0x1b8b2a[_0x7b64('0x10')]){if(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x11')]===0x1f4){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x2ff650(_0x1b8b2a['error'][_0x7b64('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x727684(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);}else{logger[_0x7b64('0x13')](_0x7b64('0xd'),_0xcdec41,_0x7b64('0xf'));_0x727684(_0x1b8b2a['result'][_0x7b64('0x12')]);}})[_0x7b64('0x14')](function(_0x16ff72){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x16ff72);_0x2ff650(_0x16ff72);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x577a2c,_0x34f252){var _0x458b35=function(_0x2814d2){while(--_0x2814d2){_0x577a2c['push'](_0x577a2c['shift']());}};_0x458b35(++_0x34f252);}(_0x55ca,0x126));var _0xa55c=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x55ca[_0x4cee4b];return _0x4d891d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Tag,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Tag,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7a527bd..8e51bf5 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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/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 77d69a8..a79cc5e 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(_0x51c16f,_0x6e85e7){var _0x3cf14a=function(_0x2211a5){while(--_0x2211a5){_0x51c16f['push'](_0x51c16f['shift']());}};_0x3cf14a(++_0x6e85e7);}(_0x757a,0xde));var _0xa757=function(_0x37dc65,_0x8f70f6){_0x37dc65=_0x37dc65-0x0;var _0x1aeeff=_0x757a[_0x37dc65];return _0x1aeeff;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b3baf4c..9a93c56 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 _0xc5bf=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','stack','name','status','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','ValidationError','capitalize','channel','toLowerCase','pick','Queues','addQueues','add','ids','removeQueues','Unknown\x20channel','remove','addAgents','isArray','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','User','Queue','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','format','TeamVoiceQueue','all','upsert','spread','removeAgents','Chat','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel'];(function(_0x430a67,_0x4caf0c){var _0x5ed7b9=function(_0x1e14f6){while(--_0x1e14f6){_0x430a67['push'](_0x430a67['shift']());}};_0x5ed7b9(++_0x4caf0c);}(_0xc5bf,0x1ca));var _0xfc5b=function(_0x1c3c1b,_0x2807e6){_0x1c3c1b=_0x1c3c1b-0x0;var _0xe0fc2d=_0xc5bf[_0x1c3c1b];return _0xe0fc2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc5b('0x0'));var rp=require(_0xfc5b('0x1'));var moment=require(_0xfc5b('0x2'));var BPromise=require(_0xfc5b('0x3'));var Mustache=require('mustache');var util=require(_0xfc5b('0x4'));var path=require(_0xfc5b('0x5'));var sox=require('sox');var csv=require(_0xfc5b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc5b('0x7'));var _=require(_0xfc5b('0x8'));var squel=require(_0xfc5b('0x9'));var crypto=require(_0xfc5b('0xa'));var jsforce=require(_0xfc5b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc5b('0xc'));var Papa=require(_0xfc5b('0xd'));var Redis=require(_0xfc5b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfc5b('0xf'));var as=require(_0xfc5b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5b('0x11'))(_0xfc5b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc5b('0x13'));var db=require(_0xfc5b('0x14'))['db'];config[_0xfc5b('0x15')]=_[_0xfc5b('0x16')](config[_0xfc5b('0x15')],{'host':_0xfc5b('0x17'),'port':0x18eb});var socket=require(_0xfc5b('0x18'))(new Redis(config[_0xfc5b('0x15')]));require(_0xfc5b('0x19'))[_0xfc5b('0x1a')](socket);function respondWithStatusCode(_0x55765f,_0x31de75){_0x31de75=_0x31de75||0xcc;return function(_0x123ed4){if(_0x123ed4){return _0x55765f[_0xfc5b('0x1b')](_0x31de75);}return _0x55765f['status'](_0x31de75)[_0xfc5b('0x1c')]();};}function respondWithResult(_0x43a844,_0x1bf082){_0x1bf082=_0x1bf082||0xc8;return function(_0x38e426){if(_0x38e426){return _0x43a844['status'](_0x1bf082)[_0xfc5b('0x1d')](_0x38e426);}};}function respondWithFilteredResult(_0xe66627,_0x28bfeb){return function(_0x487418){if(_0x487418){var _0x3c3486=typeof _0x28bfeb[_0xfc5b('0x1e')]==='undefined'&&typeof _0x28bfeb[_0xfc5b('0x1f')]===_0xfc5b('0x20');var _0x50c800=_0x487418[_0xfc5b('0x21')];var _0x2cfb89=_0x3c3486?0x0:_0x28bfeb[_0xfc5b('0x1e')];var _0x1aa40c=_0x3c3486?_0x487418[_0xfc5b('0x21')]:_0x28bfeb[_0xfc5b('0x1e')]+_0x28bfeb[_0xfc5b('0x1f')];var _0x54bed0;if(_0x1aa40c>=_0x50c800){_0x1aa40c=_0x50c800;_0x54bed0=0xc8;}else{_0x54bed0=0xce;}_0xe66627['status'](_0x54bed0);return _0xe66627[_0xfc5b('0x22')](_0xfc5b('0x23'),_0x2cfb89+'-'+_0x1aa40c+'/'+_0x50c800)[_0xfc5b('0x1d')](_0x487418);}return null;};}function patchUpdates(_0x55ebbd){return function(_0x25c012){try{jsonpatch[_0xfc5b('0x24')](_0x25c012,_0x55ebbd,!![]);}catch(_0x462a06){return BPromise[_0xfc5b('0x25')](_0x462a06);}return _0x25c012[_0xfc5b('0x26')]();};}function saveUpdates(_0x3d4b45,_0xef5d04){return function(_0x36a2e6){if(_0x36a2e6){return _0x36a2e6[_0xfc5b('0x27')](_0x3d4b45)['then'](function(_0x44b064){return _0x44b064;});}return null;};}function handleEntityNotFound(_0x36ae94,_0x38bb9a){return function(_0x1713cf){if(!_0x1713cf){_0x36ae94['sendStatus'](0x194);}return _0x1713cf;};}function handleError(_0x3c0190,_0x3fe92c){_0x3fe92c=_0x3fe92c||0x1f4;return function(_0x16b4de){logger['error'](_0x16b4de[_0xfc5b('0x28')]);if(_0x16b4de[_0xfc5b('0x29')]){delete _0x16b4de['name'];}_0x3c0190[_0xfc5b('0x2a')](_0x3fe92c)[_0xfc5b('0x2b')](_0x16b4de);};}exports[_0xfc5b('0x2c')]=function(_0x2cfb07,_0x5755dd){var _0x281756={},_0x1940ac={},_0x2542d2={'count':0x0,'rows':[]};var _0x8f02f5=_[_0xfc5b('0x2d')](db[_0xfc5b('0x2e')][_0xfc5b('0x2f')],function(_0x13ad2a){return{'name':_0x13ad2a['fieldName'],'type':_0x13ad2a[_0xfc5b('0x30')][_0xfc5b('0x31')]};});_0x1940ac[_0xfc5b('0x32')]=_['map'](_0x8f02f5,'name');_0x1940ac[_0xfc5b('0x33')]=_[_0xfc5b('0x34')](_0x2cfb07[_0xfc5b('0x33')]);_0x1940ac[_0xfc5b('0x35')]=_[_0xfc5b('0x36')](_0x1940ac['model'],_0x1940ac[_0xfc5b('0x33')]);_0x281756[_0xfc5b('0x37')]=_[_0xfc5b('0x36')](_0x1940ac[_0xfc5b('0x32')],qs[_0xfc5b('0x38')](_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x38')]));_0x281756[_0xfc5b('0x37')]=_0x281756[_0xfc5b('0x37')][_0xfc5b('0x39')]?_0x281756['attributes']:_0x1940ac[_0xfc5b('0x32')];if(!_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x3a')](_0xfc5b('0x3b'))){_0x281756[_0xfc5b('0x1f')]=qs[_0xfc5b('0x1f')](_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x1f')]);_0x281756[_0xfc5b('0x1e')]=qs[_0xfc5b('0x1e')](_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x1e')]);}_0x281756[_0xfc5b('0x3c')]=qs[_0xfc5b('0x3d')](_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x3d')]);_0x281756[_0xfc5b('0x3e')]=qs['filters'](_['pick'](_0x2cfb07[_0xfc5b('0x33')],_0x1940ac[_0xfc5b('0x35')]),_0x8f02f5);if(_0x2cfb07[_0xfc5b('0x33')]['filter']){_0x281756['where']=_['merge'](_0x281756['where'],{'$or':_[_0xfc5b('0x2d')](_0x8f02f5,function(_0x1039df){if(_0x1039df[_0xfc5b('0x30')]!==_0xfc5b('0x3f')){var _0x3111b4={};_0x3111b4[_0x1039df[_0xfc5b('0x29')]]={'$like':'%'+_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x40')]+'%'};return _0x3111b4;}})});}_0x281756=_[_0xfc5b('0x41')]({},_0x281756,_0x2cfb07[_0xfc5b('0x42')]);var _0x35b84b={'where':_0x281756['where']};return db[_0xfc5b('0x2e')][_0xfc5b('0x21')](_0x35b84b)[_0xfc5b('0x43')](function(_0x491d86){_0x2542d2[_0xfc5b('0x21')]=_0x491d86;if(_0x2cfb07[_0xfc5b('0x33')][_0xfc5b('0x44')]){_0x281756[_0xfc5b('0x45')]=[{'all':!![]}];}return db[_0xfc5b('0x2e')][_0xfc5b('0x46')](_0x281756);})[_0xfc5b('0x43')](function(_0x1aefbd){_0x2542d2[_0xfc5b('0x47')]=_0x1aefbd;return _0x2542d2;})[_0xfc5b('0x43')](respondWithFilteredResult(_0x5755dd,_0x281756))[_0xfc5b('0x48')](handleError(_0x5755dd,null));};exports['show']=function(_0x19f9e1,_0x3c3c9d){var _0x32f574={'raw':![],'where':{'id':_0x19f9e1[_0xfc5b('0x49')]['id']}},_0xaeaa67={};_0xaeaa67['model']=_[_0xfc5b('0x34')](db['Team']['rawAttributes']);_0xaeaa67['query']=_[_0xfc5b('0x34')](_0x19f9e1[_0xfc5b('0x33')]);_0xaeaa67[_0xfc5b('0x35')]=_[_0xfc5b('0x36')](_0xaeaa67['model'],_0xaeaa67[_0xfc5b('0x33')]);_0x32f574[_0xfc5b('0x37')]=_[_0xfc5b('0x36')](_0xaeaa67['model'],qs[_0xfc5b('0x38')](_0x19f9e1[_0xfc5b('0x33')][_0xfc5b('0x38')]));_0x32f574[_0xfc5b('0x37')]=_0x32f574[_0xfc5b('0x37')][_0xfc5b('0x39')]?_0x32f574[_0xfc5b('0x37')]:_0xaeaa67[_0xfc5b('0x32')];if(_0x19f9e1['query'][_0xfc5b('0x44')]){_0x32f574[_0xfc5b('0x45')]=[{'all':!![]}];}_0x32f574=_[_0xfc5b('0x41')]({},_0x32f574,_0x19f9e1[_0xfc5b('0x42')]);return db[_0xfc5b('0x2e')][_0xfc5b('0x4a')](_0x32f574)[_0xfc5b('0x43')](handleEntityNotFound(_0x3c3c9d,null))[_0xfc5b('0x43')](respondWithResult(_0x3c3c9d,null))[_0xfc5b('0x48')](handleError(_0x3c3c9d,null));};exports[_0xfc5b('0x4b')]=function(_0x478a67,_0x5362b4){return db[_0xfc5b('0x2e')]['create'](_0x478a67['body'],{})[_0xfc5b('0x43')](function(_0x2205fd){var _0x30a1e7=_0x478a67[_0xfc5b('0x4c')][_0xfc5b('0x4d')]({'plain':!![]});if(!_0x30a1e7)throw new Error(_0xfc5b('0x4e'));if(_0x30a1e7['role']===_0xfc5b('0x4c')){var _0x518dda=_0x2205fd[_0xfc5b('0x4d')]({'plain':!![]});var _0xd83be6=_0xfc5b('0x4f');return db[_0xfc5b('0x50')][_0xfc5b('0x4a')]({'where':{'name':_0xd83be6,'userProfileId':_0x30a1e7[_0xfc5b('0x51')]},'raw':!![]})['then'](function(_0x1a8116){if(_0x1a8116&&_0x1a8116['autoAssociation']===0x0){return db['UserProfileResource'][_0xfc5b('0x4b')]({'name':_0x518dda[_0xfc5b('0x29')],'resourceId':_0x518dda['id'],'type':_0x1a8116[_0xfc5b('0x29')],'sectionId':_0x1a8116['id']},{})[_0xfc5b('0x43')](function(){return _0x2205fd;});}else{return _0x2205fd;}})[_0xfc5b('0x48')](function(_0x46713b){logger[_0xfc5b('0x52')](_0xfc5b('0x53'),_0x46713b);throw _0x46713b;});}return _0x2205fd;})[_0xfc5b('0x43')](respondWithResult(_0x5362b4,0xc9))['catch'](handleError(_0x5362b4,null));};exports[_0xfc5b('0x27')]=function(_0x1a31bd,_0x13ab31){if(_0x1a31bd[_0xfc5b('0x54')]['id']){delete _0x1a31bd['body']['id'];}return db[_0xfc5b('0x2e')][_0xfc5b('0x4a')]({'where':{'id':_0x1a31bd[_0xfc5b('0x49')]['id']}})[_0xfc5b('0x43')](handleEntityNotFound(_0x13ab31,null))[_0xfc5b('0x43')](saveUpdates(_0x1a31bd[_0xfc5b('0x54')],null))['then'](respondWithResult(_0x13ab31,null))[_0xfc5b('0x48')](handleError(_0x13ab31,null));};exports['destroy']=function(_0x5573ca,_0x7eac65){var _0x67b813=_0x5573ca[_0xfc5b('0x49')]['id'];var _0xcbe622=[];return db[_0xfc5b('0x55')][_0xfc5b('0x56')](function(_0x16a18b){var _0x446284=_0xfc5b('0x57')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x446284,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b})[_0xfc5b('0x43')](function(_0x1ae03a){_0xcbe622=_[_0xfc5b('0x2d')](_0x1ae03a,function(_0x4ac8c3){return Number(_0x4ac8c3[_0xfc5b('0x5b')]);});})[_0xfc5b('0x43')](function(){var _0x302e73='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x302e73,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0x1b85b9){var _0x4fca23=_['map'](_0x1b85b9,function(_0x1ac9ed){return Number(_0x1ac9ed['VoiceQueueId']);});return db[_0xfc5b('0x5c')][_0xfc5b('0x5d')]({'where':{'UserId':{'$in':_0xcbe622},'VoiceQueueId':{'$in':_0x4fca23}},'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(){var _0x521adc=_0xfc5b('0x5e')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x521adc,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b});})['then'](function(_0x309428){var _0x4c72a0=_[_0xfc5b('0x2d')](_0x309428,function(_0x319d24){return Number(_0x319d24[_0xfc5b('0x5f')]);});return db[_0xfc5b('0x60')][_0xfc5b('0x5d')]({'where':{'UserId':{'$in':_0xcbe622},'MailQueueId':{'$in':_0x4c72a0}},'transaction':_0x16a18b});})['then'](function(){var _0x36ccaa=_0xfc5b('0x61')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x36ccaa,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')]['SELECT'],'raw':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0x5a8746){var _0x13433c=_[_0xfc5b('0x2d')](_0x5a8746,function(_0x52d93c){return Number(_0x52d93c[_0xfc5b('0x62')]);});return db[_0xfc5b('0x63')][_0xfc5b('0x5d')]({'where':{'UserId':{'$in':_0xcbe622},'SmsQueueId':{'$in':_0x13433c}},'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(){var _0x214bba=_0xfc5b('0x64')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x214bba,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b});})['then'](function(_0x2a0cb0){var _0x4f83ff=_[_0xfc5b('0x2d')](_0x2a0cb0,function(_0x241530){return Number(_0x241530[_0xfc5b('0x65')]);});return db[_0xfc5b('0x66')]['destroy']({'where':{'UserId':{'$in':_0xcbe622},'ChatQueueId':{'$in':_0x4f83ff}},'transaction':_0x16a18b});})['then'](function(){var _0x548882='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x548882,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')]['SELECT'],'raw':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0x29dc55){var _0x510e50=_['map'](_0x29dc55,function(_0x17591a){return Number(_0x17591a['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0xcbe622},'FaxQueueId':{'$in':_0x510e50}},'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(){var _0x45bb38=_0xfc5b('0x67')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x45bb38,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0x50195e){var _0x360f79=_[_0xfc5b('0x2d')](_0x50195e,function(_0x317c36){return Number(_0x317c36[_0xfc5b('0x68')]);});return db[_0xfc5b('0x69')][_0xfc5b('0x5d')]({'where':{'UserId':{'$in':_0xcbe622},'OpenchannelQueueId':{'$in':_0x360f79}},'transaction':_0x16a18b});})['then'](function(){var _0x2af9c9=_0xfc5b('0x6a')+_0x67b813;return db[_0xfc5b('0x55')][_0xfc5b('0x33')](_0x2af9c9,{'type':db[_0xfc5b('0x58')][_0xfc5b('0x59')][_0xfc5b('0x5a')],'raw':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0xe121f0){var _0x397526=_['map'](_0xe121f0,function(_0x17eda9){return Number(_0x17eda9['WhatsappQueueId']);});return db[_0xfc5b('0x6b')]['destroy']({'where':{'UserId':{'$in':_0xcbe622},'WhatsappQueueId':{'$in':_0x397526}},'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(){return db[_0xfc5b('0x6c')][_0xfc5b('0x4a')]({'where':{'TeamId':_0x67b813}});})[_0xfc5b('0x43')](function(_0x42518c){if(_0x42518c===null){return;}return db[_0xfc5b('0x6d')][_0xfc5b('0x5d')]({'where':{'UserId':{'$in':_0xcbe622},'VoicePrefixId':_0x42518c[_0xfc5b('0x6e')]},'transaction':_0x16a18b});})['then'](function(){return db[_0xfc5b('0x2e')][_0xfc5b('0x5d')]({'where':{'id':_0x67b813},'cascade':!![],'transaction':_0x16a18b});})[_0xfc5b('0x43')](function(_0x35f85b){if(_0x35f85b===0x0){_0x7eac65[_0xfc5b('0x1b')](0x194);}else{return db[_0xfc5b('0x6f')]['destroy']({'where':{'type':'Teams','resourceId':_0x67b813},'cascade':!![],'transaction':_0x16a18b})['then'](function(){_0x7eac65['status'](0xcc)[_0xfc5b('0x1c')]();});}})['catch'](function(_0x12613f){_0x7eac65[_0xfc5b('0x2a')](0x1f4)[_0xfc5b('0x2b')](_0x12613f);});});};exports[_0xfc5b('0x70')]=function(_0x268f14,_0x1b7982,_0x154db4){return db['Team'][_0xfc5b('0x71')]({'where':{'id':_0x268f14[_0xfc5b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b7982,null))['then'](function(_0x2c8a13){if(!_0x268f14[_0xfc5b('0x33')]['channel']||!utils[_0xfc5b('0x72')](_0x268f14[_0xfc5b('0x33')]['channel'])){throw new db[(_0xfc5b('0x58'))][(_0xfc5b('0x73'))]('Unknown\x20channel');}var _0x2f956c={};var _0x572e0e={};_0x572e0e[_0xfc5b('0x32')]=_[_0xfc5b('0x34')](db[_[_0xfc5b('0x74')](_0x268f14['query'][_0xfc5b('0x75')][_0xfc5b('0x76')]())+'Queue'][_0xfc5b('0x2f')]);_0x572e0e[_0xfc5b('0x33')]=_[_0xfc5b('0x34')](_0x268f14[_0xfc5b('0x33')]);_0x572e0e[_0xfc5b('0x35')]=_[_0xfc5b('0x36')](_0x572e0e[_0xfc5b('0x32')],_0x572e0e[_0xfc5b('0x33')]);_0x2f956c[_0xfc5b('0x37')]=_[_0xfc5b('0x36')](_0x572e0e['model'],qs[_0xfc5b('0x38')](_0x268f14[_0xfc5b('0x33')][_0xfc5b('0x38')]));_0x2f956c['attributes']=_0x2f956c['attributes']['length']?_0x2f956c[_0xfc5b('0x37')]:_0x572e0e[_0xfc5b('0x32')];_0x2f956c['limit']=qs[_0xfc5b('0x1f')](_0x268f14[_0xfc5b('0x33')][_0xfc5b('0x1f')]);_0x2f956c[_0xfc5b('0x1e')]=qs['offset'](_0x268f14[_0xfc5b('0x33')][_0xfc5b('0x1e')]);_0x2f956c['order']=qs['sort'](_0x268f14[_0xfc5b('0x33')]['sort']);_0x2f956c['where']=qs['filters'](_[_0xfc5b('0x77')](_0x268f14['query'],_0x572e0e[_0xfc5b('0x35')]));_0x2f956c=_[_0xfc5b('0x41')]({},_0x2f956c,_0x268f14['options']);return _0x2c8a13[_0xfc5b('0x4d')+_['capitalize'](_0x268f14['query']['channel'][_0xfc5b('0x76')]())+_0xfc5b('0x78')](_0x2f956c);})['then'](respondWithResult(_0x1b7982,null))[_0xfc5b('0x48')](handleError(_0x1b7982,null));};exports[_0xfc5b('0x79')]=function(_0x38602b,_0x1a222a,_0x125f6e){return db['Team'][_0xfc5b('0x71')]({'where':{'id':_0x38602b['params']['id']}})['then'](function(_0x384625){if(_0x384625){if(!_0x38602b['body'][_0xfc5b('0x75')]||!utils[_0xfc5b('0x72')](_0x38602b[_0xfc5b('0x54')][_0xfc5b('0x75')])){throw new db[(_0xfc5b('0x58'))][(_0xfc5b('0x73'))]('Unknown\x20channel');}return _0x384625[_0xfc5b('0x7a')+_[_0xfc5b('0x74')](_0x38602b[_0xfc5b('0x54')][_0xfc5b('0x75')][_0xfc5b('0x76')]())+_0xfc5b('0x78')](_0x38602b[_0xfc5b('0x54')][_0xfc5b('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x1a222a,null))[_0xfc5b('0x43')](respondWithStatusCode(_0x1a222a,null))[_0xfc5b('0x48')](handleError(_0x1a222a,null));};exports[_0xfc5b('0x7c')]=function(_0x224093,_0x156c31,_0x413434){return db[_0xfc5b('0x2e')][_0xfc5b('0x71')]({'where':{'id':_0x224093[_0xfc5b('0x49')]['id']}})[_0xfc5b('0x43')](function(_0x4ea184){if(_0x4ea184){if(!_0x224093[_0xfc5b('0x33')][_0xfc5b('0x75')]||!utils['isValidChannel'](_0x224093[_0xfc5b('0x33')][_0xfc5b('0x75')])){throw new db[(_0xfc5b('0x58'))]['ValidationError'](_0xfc5b('0x7d'));}return _0x4ea184[_0xfc5b('0x7e')+_[_0xfc5b('0x74')](_0x224093[_0xfc5b('0x33')]['channel'][_0xfc5b('0x76')]())+_0xfc5b('0x78')](_0x224093['query'][_0xfc5b('0x7b')]);}return null;})[_0xfc5b('0x43')](handleEntityNotFound(_0x156c31,null))[_0xfc5b('0x43')](respondWithStatusCode(_0x156c31,null))['catch'](handleError(_0x156c31,null));};exports[_0xfc5b('0x7f')]=function(_0x24c1a8,_0x343275){var _0x1d46d1=_[_0xfc5b('0x80')](_0x24c1a8[_0xfc5b('0x54')][_0xfc5b('0x7b')])?_0x24c1a8[_0xfc5b('0x54')][_0xfc5b('0x7b')]:[_0x24c1a8[_0xfc5b('0x54')][_0xfc5b('0x7b')]];var _0x1cc8fd=_0x24c1a8[_0xfc5b('0x49')]['id'];return db[_0xfc5b('0x2e')][_0xfc5b('0x4a')]({'where':{'id':_0x1cc8fd}})['then'](handleEntityNotFound(_0x343275,null))[_0xfc5b('0x43')](function(_0x1de868){if(_0x1de868){var _0x3c0335=['Voice','Chat',_0xfc5b('0x81'),_0xfc5b('0x82'),_0xfc5b('0x83'),_0xfc5b('0x84'),_0xfc5b('0x85')];return db[_0xfc5b('0x55')][_0xfc5b('0x56')](function(_0x17ef55){var _0x47f563=_[_0xfc5b('0x2d')](_0x3c0335,function(_0x3f4373){var _0x2e9fe1={'attributes':['id','name']};if(_0x3f4373===_0xfc5b('0x86')){_0x2e9fe1[_0xfc5b('0x87')]={'attributes':[_0xfc5b('0x88')]};}return _0x1de868[_0xfc5b('0x4d')+_0x3f4373+_0xfc5b('0x78')](_0x2e9fe1)[_0xfc5b('0x43')](function(_0x1a6894){var _0x5acfd9=_[_0xfc5b('0x2d')](_0x1a6894,function(_0x20f8e5){var _0x3d801e=_['map'](_0x1d46d1,function(_0x553031){var _0x4c4c6b={'where':{'UserId':_0x553031,[_0x3f4373+'QueueId']:_0x20f8e5['id']},'transaction':_0x17ef55};if(_0x3f4373===_0xfc5b('0x86')){_0x4c4c6b[_0xfc5b('0x16')]={'penalty':_0x20f8e5['TeamVoiceQueue'][_0xfc5b('0x88')]};}return db[_0xfc5b('0x89')+_0x3f4373+_0xfc5b('0x8a')][_0xfc5b('0x8b')](_0x4c4c6b)[_0xfc5b('0x43')](function(){socket[_0xfc5b('0x8c')](_0xfc5b('0x4c')+_0x3f4373+_0xfc5b('0x8d'),{'UserId':_0x553031,[_0x3f4373+_0xfc5b('0x8e')]:_0x20f8e5['id']});if(_0x3f4373!==_0xfc5b('0x86')){return;}return db[_0xfc5b('0x89')]['findAll']({'where':{'id':_0x1d46d1,'online':0x1},'attributes':['id','name',_0xfc5b('0x8f'),_0xfc5b('0x90'),_0xfc5b('0x91')],'raw':!![]})[_0xfc5b('0x43')](function(_0x895cda){var _0x1a2f06=_[_0xfc5b('0x2d')](_0x895cda,function(_0x9c5c6b){return db[_0xfc5b('0x92')]['upsert']({'membername':_0x9c5c6b[_0xfc5b('0x29')],'UserId':_0x9c5c6b['id'],'queue_name':_0x20f8e5[_0xfc5b('0x29')],'VoiceQueueId':_0x20f8e5['id'],'interface':_[_0xfc5b('0x93')](_0x9c5c6b[_0xfc5b('0x91')])?util[_0xfc5b('0x94')]('SIP/%s',_0x9c5c6b[_0xfc5b('0x29')]):_0x9c5c6b[_0xfc5b('0x91')],'paused':_0x9c5c6b['voicePause']||![],'penalty':_0x20f8e5[_0xfc5b('0x95')][_0xfc5b('0x88')]},{'transaction':_0x17ef55});});return Promise[_0xfc5b('0x96')](_0x1a2f06);});});});return Promise[_0xfc5b('0x96')](_0x3d801e);});return Promise[_0xfc5b('0x96')](_0x5acfd9);})[_0xfc5b('0x43')](function(){return db[_0xfc5b('0x6c')][_0xfc5b('0x71')]({'where':{'teamId':_0x1cc8fd}})[_0xfc5b('0x43')](function(_0x446bee){if(_0x446bee){var _0x26f01e=_[_0xfc5b('0x2d')](_0x1d46d1,function(_0x24a494){db['UserVoicePrefix'][_0xfc5b('0x97')]({'UserId':_0x24a494,'VoicePrefixId':_0x446bee['VoicePrefixId']});});return Promise['all'](_0x26f01e);}});});});return Promise[_0xfc5b('0x96')](_0x47f563)[_0xfc5b('0x43')](function(){return _0x1de868[_0xfc5b('0x7f')](_0x1d46d1,{'transaction':_0x17ef55})[_0xfc5b('0x98')](function(_0x96bd81){return _0x96bd81;});});});}})[_0xfc5b('0x43')](respondWithResult(_0x343275,null))[_0xfc5b('0x48')](handleError(_0x343275,null));};exports[_0xfc5b('0x99')]=function(_0x31ad34,_0x5c7ab8){var _0x48ac27=_[_0xfc5b('0x80')](_0x31ad34[_0xfc5b('0x33')][_0xfc5b('0x7b')])?_0x31ad34[_0xfc5b('0x33')][_0xfc5b('0x7b')]:[_0x31ad34[_0xfc5b('0x33')][_0xfc5b('0x7b')]];var _0x547013=_0x31ad34['params']['id'];return db[_0xfc5b('0x2e')][_0xfc5b('0x4a')]({'where':{'id':_0x547013}})['then'](handleEntityNotFound(_0x5c7ab8,null))[_0xfc5b('0x43')](function(_0x178f3f){if(_0x178f3f){var _0x1ca136=[_0xfc5b('0x86'),_0xfc5b('0x9a'),'Mail',_0xfc5b('0x82'),_0xfc5b('0x83'),_0xfc5b('0x84'),_0xfc5b('0x85')];return db[_0xfc5b('0x55')][_0xfc5b('0x56')](function(_0x339536){var _0x198977=_[_0xfc5b('0x2d')](_0x1ca136,function(_0xe53595){var _0x46ebdc={'attributes':['id',_0xfc5b('0x29')]};return _0x178f3f[_0xfc5b('0x4d')+_0xe53595+_0xfc5b('0x78')](_0x46ebdc)[_0xfc5b('0x43')](function(_0x55e112){var _0x596375=_[_0xfc5b('0x2d')](_0x55e112,function(_0x175e7c){return _0x175e7c['removeAgents'](_0x48ac27,{'transaction':_0x339536})[_0xfc5b('0x43')](function(){var _0x481bf1=_[_0xfc5b('0x2d')](_0x48ac27,function(_0x4fb957){socket[_0xfc5b('0x8c')](_0xfc5b('0x4c')+_0xe53595+'Queue:remove',{'UserId':Number(_0x4fb957),[_0xe53595+_0xfc5b('0x8e')]:_0x175e7c['id']});if(_0xe53595!==_0xfc5b('0x86')){return;}return db[_0xfc5b('0x92')][_0xfc5b('0x5d')]({'where':{'VoiceQueueId':_0x175e7c['id'],'UserId':_0x4fb957},'transaction':_0x339536});});return Promise['all'](_0x481bf1);});});return Promise[_0xfc5b('0x96')](_0x596375);});});return Promise[_0xfc5b('0x96')](_0x198977)[_0xfc5b('0x43')](function(){return _0x178f3f['removeAgents'](_0x48ac27,{'transaction':_0x339536});})[_0xfc5b('0x43')](function(){return db[_0xfc5b('0x6c')]['findOne']({'where':{'teamId':_0x547013}})[_0xfc5b('0x43')](function(_0x3f6ec3){if(_0x3f6ec3){var _0xd6df69=_[_0xfc5b('0x2d')](_0x48ac27,function(_0x47837e){db[_0xfc5b('0x6d')][_0xfc5b('0x5d')]({'where':{'UserId':_0x47837e,'VoicePrefixId':_0x3f6ec3[_0xfc5b('0x6e')]}});});return Promise[_0xfc5b('0x96')](_0xd6df69);}});});});}})[_0xfc5b('0x43')](respondWithStatusCode(_0x5c7ab8,null))[_0xfc5b('0x48')](handleError(_0x5c7ab8,null));};exports[_0xfc5b('0x9b')]=function(_0x1df4c9,_0x402a15,_0x3f4d97){var _0x14230b={};var _0x18aaee={};var _0xf7fcc;var _0x272625;return db['Team'][_0xfc5b('0x71')]({'where':{'id':_0x1df4c9[_0xfc5b('0x49')]['id']}})['then'](handleEntityNotFound(_0x402a15,null))['then'](function(_0x1e1721){if(_0x1e1721){_0xf7fcc=_0x1e1721;_0x18aaee['model']=_[_0xfc5b('0x34')](db[_0xfc5b('0x89')][_0xfc5b('0x2f')]);_0x18aaee[_0xfc5b('0x33')]=_[_0xfc5b('0x34')](_0x1df4c9[_0xfc5b('0x33')]);_0x18aaee[_0xfc5b('0x35')]=_['intersection'](_0x18aaee[_0xfc5b('0x32')],_0x18aaee[_0xfc5b('0x33')]);_0x14230b[_0xfc5b('0x37')]=_[_0xfc5b('0x36')](_0x18aaee[_0xfc5b('0x32')],qs[_0xfc5b('0x38')](_0x1df4c9[_0xfc5b('0x33')]['fields']));_0x14230b[_0xfc5b('0x37')]=_0x14230b['attributes']['length']?_0x14230b[_0xfc5b('0x37')]:_0x18aaee[_0xfc5b('0x32')];_0x14230b[_0xfc5b('0x3c')]=qs[_0xfc5b('0x3d')](_0x1df4c9[_0xfc5b('0x33')]['sort']);_0x14230b[_0xfc5b('0x3e')]=qs[_0xfc5b('0x35')](_[_0xfc5b('0x77')](_0x1df4c9['query'],_0x18aaee[_0xfc5b('0x35')]));if(_0x1df4c9[_0xfc5b('0x33')][_0xfc5b('0x40')]){_0x14230b['where']=_[_0xfc5b('0x41')](_0x14230b[_0xfc5b('0x3e')],{'$or':_[_0xfc5b('0x2d')](_0x14230b[_0xfc5b('0x37')],function(_0x55b4cb){var _0x127705={};_0x127705[_0x55b4cb]={'$like':'%'+_0x1df4c9[_0xfc5b('0x33')][_0xfc5b('0x40')]+'%'};return _0x127705;})});}_0x14230b=_['merge']({},_0x14230b,_0x1df4c9['options']);return _0xf7fcc[_0xfc5b('0x9b')](_0x14230b);}})[_0xfc5b('0x43')](function(_0x2f1ad7){if(_0x2f1ad7){_0x272625=_0x2f1ad7['length'];if(!_0x1df4c9['query']['hasOwnProperty'](_0xfc5b('0x3b'))){_0x14230b[_0xfc5b('0x1f')]=qs[_0xfc5b('0x1f')](_0x1df4c9['query']['limit']);_0x14230b[_0xfc5b('0x1e')]=qs[_0xfc5b('0x1e')](_0x1df4c9[_0xfc5b('0x33')]['offset']);}return _0xf7fcc['getAgents'](_0x14230b);}})[_0xfc5b('0x43')](function(_0x209cf3){if(_0x209cf3){return _0x209cf3?{'count':_0x272625,'rows':_0x209cf3}:null;}})[_0xfc5b('0x43')](respondWithResult(_0x402a15,null))[_0xfc5b('0x48')](handleError(_0x402a15,null));}; \ No newline at end of file +var _0xc9f0=['upsert','isNil','format','interface','all','spread','removeAgents','Chat','Mail','emit','Queue:remove','VoicePrefixId','getAgents','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','json','undefined','limit','offset','Content-Range','apply','reject','save','then','error','stack','name','send','index','Team','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','find','params','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','map','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','ValidationError','keys','toLowerCase','get','capitalize','Queues','addQueues','findOne','isValidChannel','Unknown\x20channel','removeQueues','remove','ids','isArray','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','Queue:save','Voice','online','voicePause','UserVoiceQueueRt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9f0,0xa8));var _0x0c9f=function(_0x66c435,_0x1dfb48){_0x66c435=_0x66c435-0x0;var _0x3e174a=_0xc9f0[_0x66c435];return _0x3e174a;};'use strict';var emlformat=require(_0x0c9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c9f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c9f('0x2'));var moment=require(_0x0c9f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0c9f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0c9f('0x5'));var csv=require(_0x0c9f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c9f('0x7'));var _=require('lodash');var squel=require(_0x0c9f('0x8'));var crypto=require(_0x0c9f('0x9'));var jsforce=require(_0x0c9f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0c9f('0x6'));var querystring=require(_0x0c9f('0xb'));var Papa=require(_0x0c9f('0xc'));var Redis=require('ioredis');var authService=require(_0x0c9f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0c9f('0xe'));var hardwareService=require(_0x0c9f('0xf'));var logger=require(_0x0c9f('0x10'))('api');var utils=require(_0x0c9f('0x11'));var config=require(_0x0c9f('0x12'));var licenseUtil=require(_0x0c9f('0x13'));var db=require(_0x0c9f('0x14'))['db'];config[_0x0c9f('0x15')]=_['defaults'](config[_0x0c9f('0x15')],{'host':_0x0c9f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c9f('0x15')]));require(_0x0c9f('0x17'))[_0x0c9f('0x18')](socket);function respondWithStatusCode(_0x5023ce,_0x21d464){_0x21d464=_0x21d464||0xcc;return function(_0x2d6ca6){if(_0x2d6ca6){return _0x5023ce[_0x0c9f('0x19')](_0x21d464);}return _0x5023ce[_0x0c9f('0x1a')](_0x21d464)['end']();};}function respondWithResult(_0x477d32,_0x422235){_0x422235=_0x422235||0xc8;return function(_0x180cb0){if(_0x180cb0){return _0x477d32[_0x0c9f('0x1a')](_0x422235)[_0x0c9f('0x1b')](_0x180cb0);}};}function respondWithFilteredResult(_0x4a87b0,_0xe46b99){return function(_0x2ff2d1){if(_0x2ff2d1){var _0x4bdf98=typeof _0xe46b99['offset']===_0x0c9f('0x1c')&&typeof _0xe46b99[_0x0c9f('0x1d')]===_0x0c9f('0x1c');var _0x3b77c8=_0x2ff2d1['count'];var _0x34f136=_0x4bdf98?0x0:_0xe46b99['offset'];var _0x3f7ac4=_0x4bdf98?_0x2ff2d1['count']:_0xe46b99[_0x0c9f('0x1e')]+_0xe46b99['limit'];var _0x1312a8;if(_0x3f7ac4>=_0x3b77c8){_0x3f7ac4=_0x3b77c8;_0x1312a8=0xc8;}else{_0x1312a8=0xce;}_0x4a87b0[_0x0c9f('0x1a')](_0x1312a8);return _0x4a87b0['set'](_0x0c9f('0x1f'),_0x34f136+'-'+_0x3f7ac4+'/'+_0x3b77c8)[_0x0c9f('0x1b')](_0x2ff2d1);}return null;};}function patchUpdates(_0x3a609f){return function(_0x3cc36f){try{jsonpatch[_0x0c9f('0x20')](_0x3cc36f,_0x3a609f,!![]);}catch(_0x3b239c){return BPromise[_0x0c9f('0x21')](_0x3b239c);}return _0x3cc36f[_0x0c9f('0x22')]();};}function saveUpdates(_0x572a21,_0x13bf69){return function(_0x4f853c){if(_0x4f853c){return _0x4f853c['update'](_0x572a21)[_0x0c9f('0x23')](function(_0x3ddd27){return _0x3ddd27;});}return null;};}function handleEntityNotFound(_0x593e44,_0x1c729b){return function(_0x3fa62c){if(!_0x3fa62c){_0x593e44['sendStatus'](0x194);}return _0x3fa62c;};}function handleError(_0x4d8321,_0x242d52){_0x242d52=_0x242d52||0x1f4;return function(_0x248553){logger[_0x0c9f('0x24')](_0x248553[_0x0c9f('0x25')]);if(_0x248553[_0x0c9f('0x26')]){delete _0x248553[_0x0c9f('0x26')];}_0x4d8321[_0x0c9f('0x1a')](_0x242d52)[_0x0c9f('0x27')](_0x248553);};}exports[_0x0c9f('0x28')]=function(_0xfcba9a,_0x2f5f34){var _0x21f861={},_0x4e90e={},_0x4ed8ee={'count':0x0,'rows':[]};var _0x44b477=_['map'](db[_0x0c9f('0x29')][_0x0c9f('0x2a')],function(_0x2e7fce){return{'name':_0x2e7fce[_0x0c9f('0x2b')],'type':_0x2e7fce['type']['key']};});_0x4e90e[_0x0c9f('0x2c')]=_['map'](_0x44b477,_0x0c9f('0x26'));_0x4e90e[_0x0c9f('0x2d')]=_['keys'](_0xfcba9a[_0x0c9f('0x2d')]);_0x4e90e[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x4e90e[_0x0c9f('0x2c')],_0x4e90e[_0x0c9f('0x2d')]);_0x21f861[_0x0c9f('0x30')]=_['intersection'](_0x4e90e[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x21f861[_0x0c9f('0x30')]=_0x21f861[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x21f861[_0x0c9f('0x30')]:_0x4e90e['model'];if(!_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x33')](_0x0c9f('0x34'))){_0x21f861['limit']=qs[_0x0c9f('0x1d')](_0xfcba9a['query']['limit']);_0x21f861[_0x0c9f('0x1e')]=qs[_0x0c9f('0x1e')](_0xfcba9a[_0x0c9f('0x2d')]['offset']);}_0x21f861[_0x0c9f('0x35')]=qs[_0x0c9f('0x36')](_0xfcba9a[_0x0c9f('0x2d')]['sort']);_0x21f861[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_[_0x0c9f('0x38')](_0xfcba9a[_0x0c9f('0x2d')],_0x4e90e[_0x0c9f('0x2e')]),_0x44b477);if(_0xfcba9a['query']['filter']){_0x21f861[_0x0c9f('0x37')]=_[_0x0c9f('0x39')](_0x21f861[_0x0c9f('0x37')],{'$or':_['map'](_0x44b477,function(_0x51ad63){if(_0x51ad63[_0x0c9f('0x3a')]!==_0x0c9f('0x3b')){var _0x22d7bd={};_0x22d7bd[_0x51ad63[_0x0c9f('0x26')]]={'$like':'%'+_0xfcba9a[_0x0c9f('0x2d')][_0x0c9f('0x3c')]+'%'};return _0x22d7bd;}})});}_0x21f861=_[_0x0c9f('0x39')]({},_0x21f861,_0xfcba9a[_0x0c9f('0x3d')]);var _0x1c2091={'where':_0x21f861[_0x0c9f('0x37')]};return db[_0x0c9f('0x29')][_0x0c9f('0x3e')](_0x1c2091)[_0x0c9f('0x23')](function(_0x5f1769){_0x4ed8ee[_0x0c9f('0x3e')]=_0x5f1769;if(_0xfcba9a['query']['includeAll']){_0x21f861[_0x0c9f('0x3f')]=[{'all':!![]}];}return db[_0x0c9f('0x29')][_0x0c9f('0x40')](_0x21f861);})[_0x0c9f('0x23')](function(_0xc2d331){_0x4ed8ee[_0x0c9f('0x41')]=_0xc2d331;return _0x4ed8ee;})[_0x0c9f('0x23')](respondWithFilteredResult(_0x2f5f34,_0x21f861))[_0x0c9f('0x42')](handleError(_0x2f5f34,null));};exports[_0x0c9f('0x43')]=function(_0x4db6c5,_0x30f4bf){var _0x238219={'raw':![],'where':{'id':_0x4db6c5['params']['id']}},_0x42004c={};_0x42004c[_0x0c9f('0x2c')]=_['keys'](db[_0x0c9f('0x29')]['rawAttributes']);_0x42004c[_0x0c9f('0x2d')]=_['keys'](_0x4db6c5[_0x0c9f('0x2d')]);_0x42004c[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x42004c[_0x0c9f('0x2c')],_0x42004c[_0x0c9f('0x2d')]);_0x238219['attributes']=_[_0x0c9f('0x2f')](_0x42004c[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0x4db6c5[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x238219[_0x0c9f('0x30')]=_0x238219[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x238219[_0x0c9f('0x30')]:_0x42004c[_0x0c9f('0x2c')];if(_0x4db6c5[_0x0c9f('0x2d')][_0x0c9f('0x44')]){_0x238219[_0x0c9f('0x3f')]=[{'all':!![]}];}_0x238219=_[_0x0c9f('0x39')]({},_0x238219,_0x4db6c5[_0x0c9f('0x3d')]);return db[_0x0c9f('0x29')]['find'](_0x238219)[_0x0c9f('0x23')](handleEntityNotFound(_0x30f4bf,null))[_0x0c9f('0x23')](respondWithResult(_0x30f4bf,null))[_0x0c9f('0x42')](handleError(_0x30f4bf,null));};exports[_0x0c9f('0x45')]=function(_0x16056a,_0x15c9d4){return db[_0x0c9f('0x29')]['create'](_0x16056a[_0x0c9f('0x46')],{})['then'](function(_0x4b3254){var _0x1e2a6e=_0x16056a[_0x0c9f('0x47')]['get']({'plain':!![]});if(!_0x1e2a6e)throw new Error(_0x0c9f('0x48'));if(_0x1e2a6e[_0x0c9f('0x49')]==='user'){var _0x1d47b9=_0x4b3254['get']({'plain':!![]});var _0x2e281c=_0x0c9f('0x4a');return db[_0x0c9f('0x4b')]['find']({'where':{'name':_0x2e281c,'userProfileId':_0x1e2a6e[_0x0c9f('0x4c')]},'raw':!![]})[_0x0c9f('0x23')](function(_0x2e6f7d){if(_0x2e6f7d&&_0x2e6f7d[_0x0c9f('0x4d')]===0x0){return db[_0x0c9f('0x4e')][_0x0c9f('0x45')]({'name':_0x1d47b9[_0x0c9f('0x26')],'resourceId':_0x1d47b9['id'],'type':_0x2e6f7d['name'],'sectionId':_0x2e6f7d['id']},{})[_0x0c9f('0x23')](function(){return _0x4b3254;});}else{return _0x4b3254;}})[_0x0c9f('0x42')](function(_0x3e5dcd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e5dcd);throw _0x3e5dcd;});}return _0x4b3254;})['then'](respondWithResult(_0x15c9d4,0xc9))[_0x0c9f('0x42')](handleError(_0x15c9d4,null));};exports[_0x0c9f('0x4f')]=function(_0x28e647,_0x397942){if(_0x28e647['body']['id']){delete _0x28e647[_0x0c9f('0x46')]['id'];}return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x28e647[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x397942,null))[_0x0c9f('0x23')](saveUpdates(_0x28e647['body'],null))['then'](respondWithResult(_0x397942,null))[_0x0c9f('0x42')](handleError(_0x397942,null));};exports[_0x0c9f('0x52')]=function(_0x126472,_0x45ef43){var _0x5d0258=_0x126472[_0x0c9f('0x51')]['id'];var _0x2031f8=[];return db[_0x0c9f('0x53')]['transaction'](function(_0x2a2035){var _0x5e67ce=_0x0c9f('0x54')+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x5e67ce,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x2a2035})[_0x0c9f('0x23')](function(_0x38da10){_0x2031f8=_[_0x0c9f('0x57')](_0x38da10,function(_0x4616e1){return Number(_0x4616e1[_0x0c9f('0x58')]);});})[_0x0c9f('0x23')](function(){var _0x260b2e=_0x0c9f('0x59')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x260b2e,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x5d1634){var _0x52f0e3=_[_0x0c9f('0x57')](_0x5d1634,function(_0x4e94af){return Number(_0x4e94af[_0x0c9f('0x5b')]);});return db[_0x0c9f('0x5c')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'VoiceQueueId':{'$in':_0x52f0e3}},'transaction':_0x2a2035});})['then'](function(){var _0x47d431=_0x0c9f('0x5d')+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x47d431,{'type':db['Sequelize'][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x5a6d64){var _0x26dfa7=_['map'](_0x5a6d64,function(_0x564b14){return Number(_0x564b14[_0x0c9f('0x5e')]);});return db[_0x0c9f('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x2031f8},'MailQueueId':{'$in':_0x26dfa7}},'transaction':_0x2a2035});})['then'](function(){var _0x34e95f=_0x0c9f('0x60')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x34e95f,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x1d4090){var _0x369966=_[_0x0c9f('0x57')](_0x1d4090,function(_0x9454d){return Number(_0x9454d[_0x0c9f('0x61')]);});return db[_0x0c9f('0x62')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'SmsQueueId':{'$in':_0x369966}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0x1fe32e='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x1fe32e,{'type':db['Sequelize'][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x1d204a){var _0x22c22d=_[_0x0c9f('0x57')](_0x1d204a,function(_0x2f682e){return Number(_0x2f682e[_0x0c9f('0x63')]);});return db[_0x0c9f('0x64')]['destroy']({'where':{'UserId':{'$in':_0x2031f8},'ChatQueueId':{'$in':_0x22c22d}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0xb33e84=_0x0c9f('0x65')+_0x5d0258;return db[_0x0c9f('0x53')]['query'](_0xb33e84,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x31d82d){var _0x1a8c1b=_[_0x0c9f('0x57')](_0x31d82d,function(_0x2d31eb){return Number(_0x2d31eb['FaxQueueId']);});return db[_0x0c9f('0x66')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'FaxQueueId':{'$in':_0x1a8c1b}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){var _0x515d1a='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5d0258;return db[_0x0c9f('0x53')][_0x0c9f('0x2d')](_0x515d1a,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})['then'](function(_0x200d7a){var _0x8b7b=_[_0x0c9f('0x57')](_0x200d7a,function(_0x35e914){return Number(_0x35e914[_0x0c9f('0x67')]);});return db[_0x0c9f('0x68')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'OpenchannelQueueId':{'$in':_0x8b7b}},'transaction':_0x2a2035});})['then'](function(){var _0x4c7ef9=_0x0c9f('0x69')+_0x5d0258;return db['sequelize'][_0x0c9f('0x2d')](_0x4c7ef9,{'type':db[_0x0c9f('0x55')][_0x0c9f('0x56')][_0x0c9f('0x5a')],'raw':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x10298f){var _0x54843e=_[_0x0c9f('0x57')](_0x10298f,function(_0x44354f){return Number(_0x44354f['WhatsappQueueId']);});return db[_0x0c9f('0x6a')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'WhatsappQueueId':{'$in':_0x54843e}},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x6b')][_0x0c9f('0x50')]({'where':{'TeamId':_0x5d0258}});})['then'](function(_0x4ea140){if(_0x4ea140===null){return;}return db[_0x0c9f('0x6c')][_0x0c9f('0x52')]({'where':{'UserId':{'$in':_0x2031f8},'VoicePrefixId':_0x4ea140['VoicePrefixId']},'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x29')][_0x0c9f('0x52')]({'where':{'id':_0x5d0258},'cascade':!![],'transaction':_0x2a2035});})[_0x0c9f('0x23')](function(_0x179987){if(_0x179987===0x0){_0x45ef43[_0x0c9f('0x19')](0x194);}else{return db[_0x0c9f('0x4e')][_0x0c9f('0x52')]({'where':{'type':_0x0c9f('0x4a'),'resourceId':_0x5d0258},'cascade':!![],'transaction':_0x2a2035})[_0x0c9f('0x23')](function(){_0x45ef43[_0x0c9f('0x1a')](0xcc)['end']();});}})[_0x0c9f('0x42')](function(_0x529f41){_0x45ef43[_0x0c9f('0x1a')](0x1f4)[_0x0c9f('0x27')](_0x529f41);});});};exports[_0x0c9f('0x6d')]=function(_0x54dc79,_0x2e1f60,_0xa2c773){return db['Team']['findOne']({'where':{'id':_0x54dc79['params']['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x2e1f60,null))['then'](function(_0xf86fde){if(!_0x54dc79['query'][_0x0c9f('0x6e')]||!utils['isValidChannel'](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')])){throw new db[(_0x0c9f('0x55'))][(_0x0c9f('0x6f'))]('Unknown\x20channel');}var _0x399a83={};var _0x1ec6d4={};_0x1ec6d4[_0x0c9f('0x2c')]=_[_0x0c9f('0x70')](db[_['capitalize'](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+'Queue'][_0x0c9f('0x2a')]);_0x1ec6d4[_0x0c9f('0x2d')]=_['keys'](_0x54dc79['query']);_0x1ec6d4[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x1ec6d4[_0x0c9f('0x2c')],_0x1ec6d4['query']);_0x399a83['attributes']=_[_0x0c9f('0x2f')](_0x1ec6d4[_0x0c9f('0x2c')],qs[_0x0c9f('0x31')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x399a83[_0x0c9f('0x30')]=_0x399a83[_0x0c9f('0x30')][_0x0c9f('0x32')]?_0x399a83[_0x0c9f('0x30')]:_0x1ec6d4[_0x0c9f('0x2c')];_0x399a83['limit']=qs[_0x0c9f('0x1d')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x1d')]);_0x399a83['offset']=qs[_0x0c9f('0x1e')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x1e')]);_0x399a83[_0x0c9f('0x35')]=qs[_0x0c9f('0x36')](_0x54dc79[_0x0c9f('0x2d')]['sort']);_0x399a83[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_['pick'](_0x54dc79['query'],_0x1ec6d4[_0x0c9f('0x2e')]));_0x399a83=_[_0x0c9f('0x39')]({},_0x399a83,_0x54dc79[_0x0c9f('0x3d')]);return _0xf86fde[_0x0c9f('0x72')+_[_0x0c9f('0x73')](_0x54dc79[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+_0x0c9f('0x74')](_0x399a83);})['then'](respondWithResult(_0x2e1f60,null))[_0x0c9f('0x42')](handleError(_0x2e1f60,null));};exports[_0x0c9f('0x75')]=function(_0x276aad,_0x4cd77f,_0x2241a9){return db[_0x0c9f('0x29')][_0x0c9f('0x76')]({'where':{'id':_0x276aad[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](function(_0xf4e7c3){if(_0xf4e7c3){if(!_0x276aad[_0x0c9f('0x46')][_0x0c9f('0x6e')]||!utils[_0x0c9f('0x77')](_0x276aad[_0x0c9f('0x46')]['channel'])){throw new db[(_0x0c9f('0x55'))]['ValidationError'](_0x0c9f('0x78'));}return _0xf4e7c3['add'+_[_0x0c9f('0x73')](_0x276aad[_0x0c9f('0x46')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+'Queues'](_0x276aad[_0x0c9f('0x46')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4cd77f,null))['then'](respondWithStatusCode(_0x4cd77f,null))['catch'](handleError(_0x4cd77f,null));};exports[_0x0c9f('0x79')]=function(_0x4fe15c,_0x1c8303,_0x500a69){return db[_0x0c9f('0x29')][_0x0c9f('0x76')]({'where':{'id':_0x4fe15c[_0x0c9f('0x51')]['id']}})[_0x0c9f('0x23')](function(_0x490557){if(_0x490557){if(!_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')]||!utils[_0x0c9f('0x77')](_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')])){throw new db[(_0x0c9f('0x55'))][(_0x0c9f('0x6f'))](_0x0c9f('0x78'));}return _0x490557[_0x0c9f('0x7a')+_[_0x0c9f('0x73')](_0x4fe15c[_0x0c9f('0x2d')][_0x0c9f('0x6e')][_0x0c9f('0x71')]())+_0x0c9f('0x74')](_0x4fe15c['query'][_0x0c9f('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x1c8303,null))[_0x0c9f('0x23')](respondWithStatusCode(_0x1c8303,null))[_0x0c9f('0x42')](handleError(_0x1c8303,null));};exports['addAgents']=function(_0x296a8b,_0x43ccea){var _0x3afe98=_[_0x0c9f('0x7c')](_0x296a8b['body'][_0x0c9f('0x7b')])?_0x296a8b[_0x0c9f('0x46')][_0x0c9f('0x7b')]:[_0x296a8b[_0x0c9f('0x46')]['ids']];var _0x54058d=_0x296a8b[_0x0c9f('0x51')]['id'];return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x54058d}})[_0x0c9f('0x23')](handleEntityNotFound(_0x43ccea,null))[_0x0c9f('0x23')](function(_0x2cdf71){if(_0x2cdf71){var _0x586ace=['Voice','Chat','Mail',_0x0c9f('0x7d'),_0x0c9f('0x7e'),_0x0c9f('0x7f'),_0x0c9f('0x80')];return db[_0x0c9f('0x53')][_0x0c9f('0x81')](function(_0x32a962){var _0x27582b=_['map'](_0x586ace,function(_0x4edd30){var _0xe7e0f6={'attributes':['id',_0x0c9f('0x26')]};if(_0x4edd30==='Voice'){_0xe7e0f6[_0x0c9f('0x82')]={'attributes':[_0x0c9f('0x83')]};}return _0x2cdf71[_0x0c9f('0x72')+_0x4edd30+'Queues'](_0xe7e0f6)[_0x0c9f('0x23')](function(_0x2df316){var _0x5c7ecb=_[_0x0c9f('0x57')](_0x2df316,function(_0x3b87e2){var _0x31bb6d=_[_0x0c9f('0x57')](_0x3afe98,function(_0x13b019){var _0x38e915={'where':{'UserId':_0x13b019,[_0x4edd30+_0x0c9f('0x84')]:_0x3b87e2['id']},'transaction':_0x32a962};if(_0x4edd30==='Voice'){_0x38e915[_0x0c9f('0x85')]={'penalty':_0x3b87e2[_0x0c9f('0x86')][_0x0c9f('0x83')]};}return db[_0x0c9f('0x87')+_0x4edd30+_0x0c9f('0x88')]['findOrCreate'](_0x38e915)[_0x0c9f('0x23')](function(){socket['emit'](_0x0c9f('0x47')+_0x4edd30+_0x0c9f('0x89'),{'UserId':_0x13b019,[_0x4edd30+_0x0c9f('0x84')]:_0x3b87e2['id']});if(_0x4edd30!==_0x0c9f('0x8a')){return;}return db[_0x0c9f('0x87')]['findAll']({'where':{'id':_0x3afe98,'online':0x1},'attributes':['id',_0x0c9f('0x26'),_0x0c9f('0x8b'),_0x0c9f('0x8c'),'interface'],'raw':!![]})[_0x0c9f('0x23')](function(_0x35ff20){var _0x390a2a=_[_0x0c9f('0x57')](_0x35ff20,function(_0x52ac7a){return db[_0x0c9f('0x8d')][_0x0c9f('0x8e')]({'membername':_0x52ac7a[_0x0c9f('0x26')],'UserId':_0x52ac7a['id'],'queue_name':_0x3b87e2['name'],'VoiceQueueId':_0x3b87e2['id'],'interface':_[_0x0c9f('0x8f')](_0x52ac7a['interface'])?util[_0x0c9f('0x90')]('SIP/%s',_0x52ac7a[_0x0c9f('0x26')]):_0x52ac7a[_0x0c9f('0x91')],'paused':_0x52ac7a[_0x0c9f('0x8c')]||![],'penalty':_0x3b87e2[_0x0c9f('0x86')]['penalty']},{'transaction':_0x32a962});});return Promise[_0x0c9f('0x92')](_0x390a2a);});});});return Promise['all'](_0x31bb6d);});return Promise['all'](_0x5c7ecb);})[_0x0c9f('0x23')](function(){return db[_0x0c9f('0x6b')][_0x0c9f('0x76')]({'where':{'teamId':_0x54058d}})[_0x0c9f('0x23')](function(_0x23f450){if(_0x23f450){var _0x40c2c4=_[_0x0c9f('0x57')](_0x3afe98,function(_0xc5d4d4){db['UserVoicePrefix'][_0x0c9f('0x8e')]({'UserId':_0xc5d4d4,'VoicePrefixId':_0x23f450['VoicePrefixId']});});return Promise[_0x0c9f('0x92')](_0x40c2c4);}});});});return Promise[_0x0c9f('0x92')](_0x27582b)['then'](function(){return _0x2cdf71['addAgents'](_0x3afe98,{'transaction':_0x32a962})[_0x0c9f('0x93')](function(_0x27720f){return _0x27720f;});});});}})['then'](respondWithResult(_0x43ccea,null))[_0x0c9f('0x42')](handleError(_0x43ccea,null));};exports[_0x0c9f('0x94')]=function(_0x13f96c,_0xb7ea59){var _0x3ffb7a=_['isArray'](_0x13f96c[_0x0c9f('0x2d')]['ids'])?_0x13f96c['query'][_0x0c9f('0x7b')]:[_0x13f96c[_0x0c9f('0x2d')][_0x0c9f('0x7b')]];var _0x5d67d0=_0x13f96c[_0x0c9f('0x51')]['id'];return db[_0x0c9f('0x29')][_0x0c9f('0x50')]({'where':{'id':_0x5d67d0}})['then'](handleEntityNotFound(_0xb7ea59,null))[_0x0c9f('0x23')](function(_0x5f200c){if(_0x5f200c){var _0x3aa285=['Voice',_0x0c9f('0x95'),_0x0c9f('0x96'),'Sms',_0x0c9f('0x7e'),_0x0c9f('0x7f'),'Whatsapp'];return db[_0x0c9f('0x53')]['transaction'](function(_0x73fea3){var _0x3ae80f=_[_0x0c9f('0x57')](_0x3aa285,function(_0x30f244){var _0x3f8e03={'attributes':['id',_0x0c9f('0x26')]};return _0x5f200c[_0x0c9f('0x72')+_0x30f244+_0x0c9f('0x74')](_0x3f8e03)[_0x0c9f('0x23')](function(_0x57a11d){var _0x453702=_[_0x0c9f('0x57')](_0x57a11d,function(_0x3e07d9){return _0x3e07d9[_0x0c9f('0x94')](_0x3ffb7a,{'transaction':_0x73fea3})[_0x0c9f('0x23')](function(){var _0x6fa67=_[_0x0c9f('0x57')](_0x3ffb7a,function(_0x4e3c50){socket[_0x0c9f('0x97')](_0x0c9f('0x47')+_0x30f244+_0x0c9f('0x98'),{'UserId':Number(_0x4e3c50),[_0x30f244+_0x0c9f('0x84')]:_0x3e07d9['id']});if(_0x30f244!==_0x0c9f('0x8a')){return;}return db[_0x0c9f('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x3e07d9['id'],'UserId':_0x4e3c50},'transaction':_0x73fea3});});return Promise[_0x0c9f('0x92')](_0x6fa67);});});return Promise['all'](_0x453702);});});return Promise[_0x0c9f('0x92')](_0x3ae80f)[_0x0c9f('0x23')](function(){return _0x5f200c[_0x0c9f('0x94')](_0x3ffb7a,{'transaction':_0x73fea3});})[_0x0c9f('0x23')](function(){return db['TeamVoicePrefix'][_0x0c9f('0x76')]({'where':{'teamId':_0x5d67d0}})[_0x0c9f('0x23')](function(_0x58de70){if(_0x58de70){var _0x2e636c=_[_0x0c9f('0x57')](_0x3ffb7a,function(_0x3792cc){db[_0x0c9f('0x6c')][_0x0c9f('0x52')]({'where':{'UserId':_0x3792cc,'VoicePrefixId':_0x58de70[_0x0c9f('0x99')]}});});return Promise['all'](_0x2e636c);}});});});}})[_0x0c9f('0x23')](respondWithStatusCode(_0xb7ea59,null))[_0x0c9f('0x42')](handleError(_0xb7ea59,null));};exports['getAgents']=function(_0x15e5c7,_0x24a388,_0x5ba657){var _0x1eef4f={};var _0x5cf5ba={};var _0x2ffea3;var _0xd34378;return db[_0x0c9f('0x29')]['findOne']({'where':{'id':_0x15e5c7['params']['id']}})[_0x0c9f('0x23')](handleEntityNotFound(_0x24a388,null))['then'](function(_0x8ac362){if(_0x8ac362){_0x2ffea3=_0x8ac362;_0x5cf5ba[_0x0c9f('0x2c')]=_[_0x0c9f('0x70')](db['User'][_0x0c9f('0x2a')]);_0x5cf5ba[_0x0c9f('0x2d')]=_[_0x0c9f('0x70')](_0x15e5c7[_0x0c9f('0x2d')]);_0x5cf5ba[_0x0c9f('0x2e')]=_[_0x0c9f('0x2f')](_0x5cf5ba[_0x0c9f('0x2c')],_0x5cf5ba[_0x0c9f('0x2d')]);_0x1eef4f[_0x0c9f('0x30')]=_[_0x0c9f('0x2f')](_0x5cf5ba[_0x0c9f('0x2c')],qs['fields'](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x31')]));_0x1eef4f['attributes']=_0x1eef4f[_0x0c9f('0x30')]['length']?_0x1eef4f[_0x0c9f('0x30')]:_0x5cf5ba['model'];_0x1eef4f[_0x0c9f('0x35')]=qs['sort'](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x36')]);_0x1eef4f[_0x0c9f('0x37')]=qs[_0x0c9f('0x2e')](_[_0x0c9f('0x38')](_0x15e5c7[_0x0c9f('0x2d')],_0x5cf5ba[_0x0c9f('0x2e')]));if(_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x3c')]){_0x1eef4f[_0x0c9f('0x37')]=_[_0x0c9f('0x39')](_0x1eef4f[_0x0c9f('0x37')],{'$or':_[_0x0c9f('0x57')](_0x1eef4f['attributes'],function(_0x307db1){var _0x578833={};_0x578833[_0x307db1]={'$like':'%'+_0x15e5c7[_0x0c9f('0x2d')]['filter']+'%'};return _0x578833;})});}_0x1eef4f=_[_0x0c9f('0x39')]({},_0x1eef4f,_0x15e5c7[_0x0c9f('0x3d')]);return _0x2ffea3[_0x0c9f('0x9a')](_0x1eef4f);}})[_0x0c9f('0x23')](function(_0x2236d0){if(_0x2236d0){_0xd34378=_0x2236d0['length'];if(!_0x15e5c7['query']['hasOwnProperty'](_0x0c9f('0x34'))){_0x1eef4f[_0x0c9f('0x1d')]=qs[_0x0c9f('0x1d')](_0x15e5c7['query'][_0x0c9f('0x1d')]);_0x1eef4f[_0x0c9f('0x1e')]=qs[_0x0c9f('0x1e')](_0x15e5c7[_0x0c9f('0x2d')][_0x0c9f('0x1e')]);}return _0x2ffea3[_0x0c9f('0x9a')](_0x1eef4f);}})['then'](function(_0x14fe73){if(_0x14fe73){return _0x14fe73?{'count':_0xd34378,'rows':_0x14fe73}:null;}})['then'](respondWithResult(_0x24a388,null))[_0x0c9f('0x42')](handleError(_0x24a388,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ea1b56a..cbe2551 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 _0x3303=['setMaxListeners','update','emit','exports','Team'];(function(_0xd4f0c,_0x3a0bd2){var _0x51c918=function(_0x483799){while(--_0x483799){_0xd4f0c['push'](_0xd4f0c['shift']());}};_0x51c918(++_0x3a0bd2);}(_0x3303,0x103));var _0x3330=function(_0x1120d4,_0x3976f7){_0x1120d4=_0x1120d4-0x0;var _0x2bb4a7=_0x3303[_0x1120d4];return _0x2bb4a7;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x3330('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x3330('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3330('0x2'),'afterDestroy':'remove'};function emitEvent(_0xadf6bc){return function(_0x1ac5ca,_0x4774bf,_0x416207){TeamEvents[_0x3330('0x3')](_0xadf6bc+':'+_0x1ac5ca['id'],_0x1ac5ca);TeamEvents[_0x3330('0x3')](_0xadf6bc,_0x1ac5ca);_0x416207(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x3330('0x4')]=TeamEvents; \ No newline at end of file +var _0x052a=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x5a9600,_0x46da77){var _0x20b0e6=function(_0x351865){while(--_0x351865){_0x5a9600['push'](_0x5a9600['shift']());}};_0x20b0e6(++_0x46da77);}(_0x052a,0x17f));var _0xa052=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x052a[_0x1c546c];return _0x2cc384;};'use strict';var EventEmitter=require(_0xa052('0x0'));var Team=require(_0xa052('0x1'))['db'][_0xa052('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa052('0x3')](0x0);var events={'afterCreate':_0xa052('0x4'),'afterUpdate':'update','afterDestroy':_0xa052('0x5')};function emitEvent(_0x33a63d){return function(_0x275dfd,_0x2ec568,_0x187dfa){TeamEvents['emit'](_0x33a63d+':'+_0x275dfd['id'],_0x275dfd);TeamEvents['emit'](_0x33a63d,_0x275dfd);_0x187dfa(null);};}for(var e in events){if(events[_0xa052('0x6')](e)){var event=events[e];Team[_0xa052('0x7')](e,emitEvent(event));}}module[_0xa052('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 61c083a..b06ca2e 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 _0x383f=['Whatsapp','resolve','all','Queues','then','map','catch','exports','Team','teams','Chat','Fax','Mail','Openchannel','Sms'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x383f,0x15c));var _0xf383=function(_0x513847,_0x5ee9e3){_0x513847=_0x513847-0x0;var _0x3390ae=_0x383f[_0x513847];return _0x3390ae;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x258af8,_0x465b35){var _0x3370a7='get'+_0x465b35+_0xf383('0x0');return _0x258af8[_0x3370a7]()[_0xf383('0x1')](function(_0x207ae0){return _[_0xf383('0x2')](_0x207ae0,function(_0xa2eba8){_0xa2eba8['setDataValue']('channel',_0x465b35);return _0xa2eba8;});})[_0xf383('0x3')](function(_0x54de1a){throw _0x54de1a;});}module[_0xf383('0x4')]=function(_0x5dde44){return _0x5dde44['define'](_0xf383('0x5'),attributes,{'tableName':_0xf383('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5aae99=this;var _0x138038=[_0xf383('0x7'),_0xf383('0x8'),_0xf383('0x9'),_0xf383('0xa'),_0xf383('0xb'),'Voice',_0xf383('0xc')];return Promise[_0xf383('0xd')]()[_0xf383('0x1')](function(){var _0x16092a=_[_0xf383('0x2')](_0x138038,function(_0x36ac92){return getQueuesByChannel(_0x5aae99,_0x36ac92);});return Promise[_0xf383('0xe')](_0x16092a);})['catch'](function(_0x1900b9){throw _0x1900b9;});}}});}; \ No newline at end of file +var _0x06fe=['Team','Fax','Mail','Openchannel','Sms','catch','lodash','./team.attributes','Queues','then','map','exports','define'];(function(_0x384207,_0x4e2b68){var _0xbc41bc=function(_0x1ff5e9){while(--_0x1ff5e9){_0x384207['push'](_0x384207['shift']());}};_0xbc41bc(++_0x4e2b68);}(_0x06fe,0x1c0));var _0xe06f=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0x06fe[_0x33c70e];return _0x5a33e5;};'use strict';var _=require(_0xe06f('0x0'));var attributes=require(_0xe06f('0x1'));function getQueuesByChannel(_0x5bd58f,_0x3b5802){var _0x2e3143='get'+_0x3b5802+_0xe06f('0x2');return _0x5bd58f[_0x2e3143]()[_0xe06f('0x3')](function(_0x8b087d){return _[_0xe06f('0x4')](_0x8b087d,function(_0xc62649){_0xc62649['setDataValue']('channel',_0x3b5802);return _0xc62649;});})['catch'](function(_0x5e5845){throw _0x5e5845;});}module[_0xe06f('0x5')]=function(_0xf4965c){return _0xf4965c[_0xe06f('0x6')](_0xe06f('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x516c5a=this;var _0x3b6b44=['Chat',_0xe06f('0x8'),_0xe06f('0x9'),_0xe06f('0xa'),_0xe06f('0xb'),'Voice','Whatsapp'];return Promise['resolve']()[_0xe06f('0x3')](function(){var _0x1d1cac=_[_0xe06f('0x4')](_0x3b6b44,function(_0x4137ec){return getQueuesByChannel(_0x516c5a,_0x4137ec);});return Promise['all'](_0x1d1cac);})[_0xe06f('0xc')](function(_0x1938e5){throw _0x1938e5;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1523bb2..567b687 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 _0xa26d=['localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x45e3f3,_0x3a1854){var _0x4af723=function(_0x50358c){while(--_0x50358c){_0x45e3f3['push'](_0x45e3f3['shift']());}};_0x4af723(++_0x3a1854);}(_0xa26d,0x1d7));var _0xda26=function(_0x358e85,_0x26de42){_0x358e85=_0x358e85-0x0;var _0xfb089b=_0xa26d[_0x358e85];return _0xfb089b;};'use strict';var _=require(_0xda26('0x0'));var util=require('util');var moment=require(_0xda26('0x1'));var BPromise=require('bluebird');var rs=require(_0xda26('0x2'));var fs=require('fs');var Redis=require(_0xda26('0x3'));var db=require(_0xda26('0x4'))['db'];var utils=require(_0xda26('0x5'));var logger=require(_0xda26('0x6'))(_0xda26('0x7'));var config=require(_0xda26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xda26('0x9')][_0xda26('0xa')]({'port':0x232a});config[_0xda26('0xb')]=_[_0xda26('0xc')](config[_0xda26('0xb')],{'host':_0xda26('0xd'),'port':0x18eb});var socket=require(_0xda26('0xe'))(new Redis(config['redis']));require(_0xda26('0xf'))['register'](socket);function respondWithRpcPromise(_0x3230b1,_0x21db6b,_0x5c1e45){return new BPromise(function(_0x5a9131,_0x300a43){return client['request'](_0x3230b1,_0x5c1e45)['then'](function(_0x11efcc){logger[_0xda26('0x10')](_0xda26('0x11'),_0x21db6b,_0xda26('0x12'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x21db6b,_0xda26('0x12'),JSON['stringify'](_0x11efcc));if(_0x11efcc[_0xda26('0x13')]){if(_0x11efcc['error']['code']===0x1f4){logger[_0xda26('0x13')]('Team,\x20%s,\x20%s',_0x21db6b,_0x11efcc[_0xda26('0x13')][_0xda26('0x14')]);return _0x300a43(_0x11efcc[_0xda26('0x13')][_0xda26('0x14')]);}logger[_0xda26('0x13')](_0xda26('0x11'),_0x21db6b,_0x11efcc[_0xda26('0x13')][_0xda26('0x14')]);return _0x5a9131(_0x11efcc['error'][_0xda26('0x14')]);}else{logger[_0xda26('0x10')](_0xda26('0x11'),_0x21db6b,_0xda26('0x12'));_0x5a9131(_0x11efcc[_0xda26('0x15')][_0xda26('0x14')]);}})['catch'](function(_0xd67dc9){logger['error'](_0xda26('0x11'),_0x21db6b,_0xd67dc9);_0x300a43(_0xd67dc9);});});} \ No newline at end of file +var _0x6b37=['message','info','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3da227,_0x4af25b){var _0x7d0ba9=function(_0xe4c6b3){while(--_0xe4c6b3){_0x3da227['push'](_0x3da227['shift']());}};_0x7d0ba9(++_0x4af25b);}(_0x6b37,0x86));var _0x76b3=function(_0x450127,_0x2e3ade){_0x450127=_0x450127-0x0;var _0x17ea36=_0x6b37[_0x450127];return _0x17ea36;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var moment=require('moment');var BPromise=require(_0x76b3('0x2'));var rs=require(_0x76b3('0x3'));var fs=require('fs');var Redis=require(_0x76b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76b3('0x5'));var logger=require(_0x76b3('0x6'))(_0x76b3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76b3('0x8')][_0x76b3('0x9')]({'port':0x232a});config['redis']=_[_0x76b3('0xa')](config[_0x76b3('0xb')],{'host':_0x76b3('0xc'),'port':0x18eb});var socket=require(_0x76b3('0xd'))(new Redis(config[_0x76b3('0xb')]));require('./team.socket')[_0x76b3('0xe')](socket);function respondWithRpcPromise(_0x18568a,_0x3a708e,_0x30cc2e){return new BPromise(function(_0x21738c,_0x48fa20){return client[_0x76b3('0xf')](_0x18568a,_0x30cc2e)[_0x76b3('0x10')](function(_0x32802a){logger['info'](_0x76b3('0x11'),_0x3a708e,'request\x20sent');logger[_0x76b3('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x3a708e,'request\x20sent',JSON[_0x76b3('0x13')](_0x32802a));if(_0x32802a['error']){if(_0x32802a[_0x76b3('0x14')][_0x76b3('0x15')]===0x1f4){logger['error'](_0x76b3('0x11'),_0x3a708e,_0x32802a[_0x76b3('0x14')][_0x76b3('0x16')]);return _0x48fa20(_0x32802a['error'][_0x76b3('0x16')]);}logger[_0x76b3('0x14')](_0x76b3('0x11'),_0x3a708e,_0x32802a[_0x76b3('0x14')]['message']);return _0x21738c(_0x32802a[_0x76b3('0x14')][_0x76b3('0x16')]);}else{logger[_0x76b3('0x17')]('Team,\x20%s,\x20%s',_0x3a708e,_0x76b3('0x18'));_0x21738c(_0x32802a['result'][_0x76b3('0x16')]);}})[_0x76b3('0x19')](function(_0x26c8d7){logger[_0x76b3('0x14')](_0x76b3('0x11'),_0x3a708e,_0x26c8d7);_0x48fa20(_0x26c8d7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index eefff42..9cfe0a8 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 _0x4b6c=['./team.events','save','update','emit','register'];(function(_0x520b07,_0x2ef167){var _0x40fe08=function(_0x25ea18){while(--_0x25ea18){_0x520b07['push'](_0x520b07['shift']());}};_0x40fe08(++_0x2ef167);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xc4b6('0x0'));var events=[_0xc4b6('0x1'),'remove',_0xc4b6('0x2')];function createListener(_0x36f354,_0x116336){return function(_0x5aef7d){_0x116336[_0xc4b6('0x3')](_0x36f354,_0x5aef7d);};}function removeListener(_0x26d2d9,_0x3c532b){return function(){TeamEvents['removeListener'](_0x26d2d9,_0x3c532b);};}exports[_0xc4b6('0x4')]=function(_0x1d5e09){for(var _0x21f368=0x0,_0x2948c6=events['length'];_0x21f368<_0x2948c6;_0x21f368++){var _0x443998=events[_0x21f368];var _0x4b935f=createListener('team:'+_0x443998,_0x1d5e09);TeamEvents['on'](_0x443998,_0x4b935f);}}; \ No newline at end of file +var _0x585b=['team:','./team.events','save','removeListener','register'];(function(_0x3ed474,_0x31854a){var _0x303c91=function(_0x286f62){while(--_0x286f62){_0x3ed474['push'](_0x3ed474['shift']());}};_0x303c91(++_0x31854a);}(_0x585b,0x1af));var _0xb585=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x585b[_0x5d4607];return _0x5e4a86;};'use strict';var TeamEvents=require(_0xb585('0x0'));var events=[_0xb585('0x1'),'remove','update'];function createListener(_0x2da463,_0x527906){return function(_0x124908){_0x527906['emit'](_0x2da463,_0x124908);};}function removeListener(_0x4db6de,_0x5cc948){return function(){TeamEvents[_0xb585('0x2')](_0x4db6de,_0x5cc948);};}exports[_0xb585('0x3')]=function(_0x2ed1c1){for(var _0x474970=0x0,_0x378aff=events['length'];_0x474970<_0x378aff;_0x474970++){var _0x1488a5=events[_0x474970];var _0x4d8dfc=createListener(_0xb585('0x4')+_0x1488a5,_0x2ed1c1);TeamEvents['on'](_0x1488a5,_0x4d8dfc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 2709484..d8d9b1b 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 _0x477a=['sequelize','INTEGER'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa477('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xa477('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xa477('0x1')]}}; \ No newline at end of file +var _0x8cc8=['sequelize','exports','INTEGER'];(function(_0x43ada0,_0x4d4c5a){var _0x33531f=function(_0x1b5ba8){while(--_0x1b5ba8){_0x43ada0['push'](_0x43ada0['shift']());}};_0x33531f(++_0x4d4c5a);}(_0x8cc8,0x177));var _0x88cc=function(_0x283170,_0x5cc2e1){_0x283170=_0x283170-0x0;var _0x1437f9=_0x8cc8[_0x283170];return _0x1437f9;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'TeamId':{'type':Sequelize[_0x88cc('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x88cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5f9561b..cc1ed45 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 _0xdf79=['api','moment','bluebird','request-promise','exports','define','team_has_voice_prefixes','../../config/logger'];(function(_0x5d8084,_0x1947e9){var _0x4c0147=function(_0x20c7f0){while(--_0x20c7f0){_0x5d8084['push'](_0x5d8084['shift']());}};_0x4c0147(++_0x1947e9);}(_0xdf79,0xa7));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9df7('0x0'))(_0x9df7('0x1'));var moment=require(_0x9df7('0x2'));var BPromise=require(_0x9df7('0x3'));var rp=require(_0x9df7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x9df7('0x5')]=function(_0x23c80b,_0x3350cd){return _0x23c80b[_0x9df7('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0x9df7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x174b=['path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise'];(function(_0x2ae97e,_0x1071e6){var _0x205fa1=function(_0x3411ce){while(--_0x3411ce){_0x2ae97e['push'](_0x2ae97e['shift']());}};_0x205fa1(++_0x1071e6);}(_0x174b,0x19d));var _0xb174=function(_0x432b34,_0x1a86de){_0x432b34=_0x432b34-0x0;var _0x5eca50=_0x174b[_0x432b34];return _0x5eca50;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb174('0x1'));var moment=require(_0xb174('0x2'));var BPromise=require(_0xb174('0x3'));var rp=require(_0xb174('0x4'));var fs=require('fs');var path=require(_0xb174('0x5'));var rimraf=require(_0xb174('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xb174('0x7')]=function(_0x3e81c9,_0x326afc){return _0x3e81c9[_0xb174('0x8')](_0xb174('0x9'),attributes,{'tableName':_0xb174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 73cae5d..8fa1715 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x39b04e,_0x5768ae){var _0x352e20=function(_0x2abbfe){while(--_0x2abbfe){_0x39b04e['push'](_0x39b04e['shift']());}};_0x352e20(++_0x5768ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x47d91e,_0x3e5da9){_0x47d91e=_0x47d91e-0x0;var _0x1be66b=_0xedd9[_0x47d91e];return _0x1be66b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 68d32a4..441bd1a 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 _0x8767=['exports','INTEGER'];(function(_0x180e4f,_0x4e445a){var _0x85b943=function(_0x2b3ef8){while(--_0x2b3ef8){_0x180e4f['push'](_0x180e4f['shift']());}};_0x85b943(++_0x4e445a);}(_0x8767,0x134));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7876('0x0')]={'penalty':{'type':Sequelize[_0x7876('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb74=['sequelize','INTEGER'];(function(_0x20fc32,_0x2f4981){var _0x2c6e0d=function(_0x1747de){while(--_0x1747de){_0x20fc32['push'](_0x20fc32['shift']());}};_0x2c6e0d(++_0x2f4981);}(_0xbb74,0x116));var _0x4bb7=function(_0x204b81,_0x26783e){_0x204b81=_0x204b81-0x0;var _0x4833e9=_0xbb74[_0x204b81];return _0x4833e9;};'use strict';var Sequelize=require(_0x4bb7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4bb7('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 62e3d7d..c9d5961 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 _0x8bdf=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x37556e,_0x3c677a){var _0x48740a=function(_0x5bb24f){while(--_0x5bb24f){_0x37556e['push'](_0x37556e['shift']());}};_0x48740a(++_0x3c677a);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8bdf[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var logger=require(_0xf8bd('0x2'))(_0xf8bd('0x3'));var moment=require(_0xf8bd('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8bd('0x5'));var fs=require('fs');var path=require(_0xf8bd('0x6'));var rimraf=require(_0xf8bd('0x7'));var config=require(_0xf8bd('0x8'));var attributes=require(_0xf8bd('0x9'));module[_0xf8bd('0xa')]=function(_0x59eff9,_0x4ed701){return _0x59eff9['define'](_0xf8bd('0xb'),attributes,{'tableName':_0xf8bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x204be9,_0x525eaf){_0x204be9=_0x204be9-0x0;var _0x54fe9c=_0xe5b3[_0x204be9];return _0x54fe9c;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x3e5b('0xc'),'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 da941a9..fe8fd00 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 _0x876c=['then','request\x20sent','debug','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ced5b,_0x58370e){var _0x45ebc1=function(_0x495930){while(--_0x495930){_0x2ced5b['push'](_0x2ced5b['shift']());}};_0x45ebc1(++_0x58370e);}(_0x876c,0x12f));var _0xc876=function(_0x5295cf,_0x5d36ee){_0x5295cf=_0x5295cf-0x0;var _0x1aa61e=_0x876c[_0x5295cf];return _0x1aa61e;};'use strict';var _=require(_0xc876('0x0'));var util=require(_0xc876('0x1'));var moment=require(_0xc876('0x2'));var BPromise=require(_0xc876('0x3'));var rs=require(_0xc876('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc876('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc876('0x6'))(_0xc876('0x7'));var config=require(_0xc876('0x8'));var jayson=require(_0xc876('0x9'));var client=jayson[_0xc876('0xa')][_0xc876('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x195e3e,_0x3f6d9e,_0x2b3e09){return new BPromise(function(_0x5c0c6a,_0x5a823b){return client['request'](_0x195e3e,_0x2b3e09)[_0xc876('0xc')](function(_0x2a65cc){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3f6d9e,_0xc876('0xd'));logger[_0xc876('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3f6d9e,_0xc876('0xd'),JSON[_0xc876('0xf')](_0x2a65cc));if(_0x2a65cc[_0xc876('0x10')]){if(_0x2a65cc['error']['code']===0x1f4){logger[_0xc876('0x10')](_0xc876('0x11'),_0x3f6d9e,_0x2a65cc['error']['message']);return _0x5a823b(_0x2a65cc[_0xc876('0x10')][_0xc876('0x12')]);}logger['error'](_0xc876('0x11'),_0x3f6d9e,_0x2a65cc['error'][_0xc876('0x12')]);return _0x5c0c6a(_0x2a65cc[_0xc876('0x10')][_0xc876('0x12')]);}else{logger['info'](_0xc876('0x11'),_0x3f6d9e,_0xc876('0xd'));_0x5c0c6a(_0x2a65cc[_0xc876('0x13')][_0xc876('0x12')]);}})[_0xc876('0x14')](function(_0x51e40f){logger['error'](_0xc876('0x11'),_0x3f6d9e,_0x51e40f);_0x5a823b(_0x51e40f);});});} \ No newline at end of file +var _0x865c=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x865c,0x91));var _0xc865=function(_0x4ff0d8,_0x32a4af){_0x4ff0d8=_0x4ff0d8-0x0;var _0x3bfba7=_0x865c[_0x4ff0d8];return _0x3bfba7;};'use strict';var _=require(_0xc865('0x0'));var util=require(_0xc865('0x1'));var moment=require('moment');var BPromise=require(_0xc865('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc865('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc865('0x4'));var logger=require(_0xc865('0x5'))(_0xc865('0x6'));var config=require(_0xc865('0x7'));var jayson=require(_0xc865('0x8'));var client=jayson['client'][_0xc865('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36404c,_0x1897c0,_0x2290c5){return new BPromise(function(_0x31a3b9,_0x275fdc){return client[_0xc865('0xa')](_0x36404c,_0x2290c5)[_0xc865('0xb')](function(_0x374800){logger[_0xc865('0xc')](_0xc865('0xd'),_0x1897c0,_0xc865('0xe'));logger[_0xc865('0xf')](_0xc865('0x10'),_0x1897c0,'request\x20sent',JSON[_0xc865('0x11')](_0x374800));if(_0x374800['error']){if(_0x374800[_0xc865('0x12')][_0xc865('0x13')]===0x1f4){logger[_0xc865('0x12')](_0xc865('0xd'),_0x1897c0,_0x374800['error'][_0xc865('0x14')]);return _0x275fdc(_0x374800['error'][_0xc865('0x14')]);}logger['error'](_0xc865('0xd'),_0x1897c0,_0x374800[_0xc865('0x12')][_0xc865('0x14')]);return _0x31a3b9(_0x374800[_0xc865('0x12')][_0xc865('0x14')]);}else{logger[_0xc865('0xc')](_0xc865('0xd'),_0x1897c0,_0xc865('0xe'));_0x31a3b9(_0x374800[_0xc865('0x15')][_0xc865('0x14')]);}})[_0xc865('0x16')](function(_0x5c1799){logger[_0xc865('0x12')](_0xc865('0xd'),_0x1897c0,_0x5c1799);_0x275fdc(_0x5c1799);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 70ffa09..82083f1 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 _0x6372=['show','create','put','/:id','delete','isAuthenticated','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index'];(function(_0x48d133,_0xecfe43){var _0x33758=function(_0x310752){while(--_0x310752){_0x48d133['push'](_0x48d133['shift']());}};_0x33758(++_0xecfe43);}(_0x6372,0x1b8));var _0x2637=function(_0x30943b,_0x46c972){_0x30943b=_0x30943b-0x0;var _0x27ad13=_0x6372[_0x30943b];return _0x27ad13;};'use strict';var multer=require(_0x2637('0x0'));var util=require('util');var path=require(_0x2637('0x1'));var timeout=require('connect-timeout');var express=require(_0x2637('0x2'));var router=express[_0x2637('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2637('0x4'));var interaction=require(_0x2637('0x5'));var config=require(_0x2637('0x6'));var controller=require(_0x2637('0x7'));router[_0x2637('0x8')]('/',auth['isAuthenticated'](),controller[_0x2637('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2637('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2637('0xb')]);router[_0x2637('0xc')](_0x2637('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2637('0xe')](_0x2637('0xd'),auth[_0x2637('0xf')](),controller[_0x2637('0x10')]);module[_0x2637('0x11')]=router; \ No newline at end of file +var _0x96d8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x504f3b,_0x385350){var _0x31f12c=function(_0x146e0b){while(--_0x146e0b){_0x504f3b['push'](_0x504f3b['shift']());}};_0x31f12c(++_0x385350);}(_0x96d8,0x1e2));var _0x896d=function(_0x4cfff8,_0x37aa0a){_0x4cfff8=_0x4cfff8-0x0;var _0x3617d7=_0x96d8[_0x4cfff8];return _0x3617d7;};'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 diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 331ae97..a5c7eba 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 _0x9940=['TEXT','sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9940,0xad));var _0x0994=function(_0x4a66b9,_0x5cefed){_0x4a66b9=_0x4a66b9-0x0;var _0x4d1a81=_0x9940[_0x4a66b9];return _0x4d1a81;};'use strict';var Sequelize=require(_0x0994('0x0'));module[_0x0994('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0994('0x2')]},'html':{'type':Sequelize[_0x0994('0x3')]}}; \ No newline at end of file +var _0x9bc2=['TEXT','sequelize','exports','STRING'];(function(_0x3e9b46,_0xe0b9c0){var _0x2e402f=function(_0x3c2b64){while(--_0x3c2b64){_0x3e9b46['push'](_0x3e9b46['shift']());}};_0x2e402f(++_0xe0b9c0);}(_0x9bc2,0x121));var _0x29bc=function(_0x32a2e8,_0x2b28c8){_0x32a2e8=_0x32a2e8-0x0;var _0x7641ae=_0x9bc2[_0x32a2e8];return _0x7641ae;};'use strict';var Sequelize=require(_0x29bc('0x0'));module[_0x29bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29bc('0x2')]},'html':{'type':Sequelize[_0x29bc('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f5defd8..39c849a 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 _0xfac3=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Template','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','map'];(function(_0x7c0032,_0x9b832d){var _0x225fb5=function(_0xf6b8d){while(--_0xf6b8d){_0x7c0032['push'](_0x7c0032['shift']());}};_0x225fb5(++_0x9b832d);}(_0xfac3,0x171));var _0x3fac=function(_0x200e17,_0x4db7f1){_0x200e17=_0x200e17-0x0;var _0x5eddc7=_0xfac3[_0x200e17];return _0x5eddc7;};'use strict';var emlformat=require(_0x3fac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fac('0x1'));var rp=require(_0x3fac('0x2'));var moment=require(_0x3fac('0x3'));var BPromise=require(_0x3fac('0x4'));var Mustache=require('mustache');var util=require(_0x3fac('0x5'));var path=require(_0x3fac('0x6'));var sox=require(_0x3fac('0x7'));var csv=require(_0x3fac('0x8'));var ejs=require(_0x3fac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fac('0xa'));var squel=require(_0x3fac('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3fac('0xc'));var toCsv=require(_0x3fac('0x8'));var querystring=require(_0x3fac('0xd'));var Papa=require(_0x3fac('0xe'));var Redis=require(_0x3fac('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3fac('0x10'));var as=require(_0x3fac('0x11'));var hardwareService=require(_0x3fac('0x12'));var logger=require(_0x3fac('0x13'))('api');var utils=require(_0x3fac('0x14'));var config=require(_0x3fac('0x15'));var licenseUtil=require(_0x3fac('0x16'));var db=require(_0x3fac('0x17'))['db'];function respondWithStatusCode(_0x2ecd1a,_0x20671e){_0x20671e=_0x20671e||0xcc;return function(_0x13a40d){if(_0x13a40d){return _0x2ecd1a['sendStatus'](_0x20671e);}return _0x2ecd1a[_0x3fac('0x18')](_0x20671e)[_0x3fac('0x19')]();};}function respondWithResult(_0x228f52,_0x5f071a){_0x5f071a=_0x5f071a||0xc8;return function(_0x288b17){if(_0x288b17){return _0x228f52[_0x3fac('0x18')](_0x5f071a)[_0x3fac('0x1a')](_0x288b17);}};}function respondWithFilteredResult(_0xf81c9a,_0x291df4){return function(_0x75ea6c){if(_0x75ea6c){var _0xd4d47=typeof _0x291df4[_0x3fac('0x1b')]===_0x3fac('0x1c')&&typeof _0x291df4[_0x3fac('0x1d')]===_0x3fac('0x1c');var _0x565900=_0x75ea6c[_0x3fac('0x1e')];var _0x58ea91=_0xd4d47?0x0:_0x291df4['offset'];var _0x1f71a7=_0xd4d47?_0x75ea6c[_0x3fac('0x1e')]:_0x291df4[_0x3fac('0x1b')]+_0x291df4[_0x3fac('0x1d')];var _0x362512;if(_0x1f71a7>=_0x565900){_0x1f71a7=_0x565900;_0x362512=0xc8;}else{_0x362512=0xce;}_0xf81c9a[_0x3fac('0x18')](_0x362512);return _0xf81c9a[_0x3fac('0x1f')]('Content-Range',_0x58ea91+'-'+_0x1f71a7+'/'+_0x565900)[_0x3fac('0x1a')](_0x75ea6c);}return null;};}function patchUpdates(_0x3f7008){return function(_0x359afe){try{jsonpatch[_0x3fac('0x20')](_0x359afe,_0x3f7008,!![]);}catch(_0x2ae178){return BPromise[_0x3fac('0x21')](_0x2ae178);}return _0x359afe['save']();};}function saveUpdates(_0x11dbe7,_0x277325){return function(_0x1e0cfd){if(_0x1e0cfd){return _0x1e0cfd[_0x3fac('0x22')](_0x11dbe7)['then'](function(_0x28a465){return _0x28a465;});}return null;};}function removeEntity(_0x1fbe39,_0x489bd4){return function(_0x23b795){if(_0x23b795){return _0x23b795[_0x3fac('0x23')]()['then'](function(){var _0x42d474=_0x23b795[_0x3fac('0x24')]({'plain':!![]});var _0x4dec69='Templates';return db[_0x3fac('0x25')]['destroy']({'where':{'type':_0x4dec69,'resourceId':_0x42d474['id']}})[_0x3fac('0x26')](function(){return _0x23b795;});})[_0x3fac('0x26')](function(){_0x1fbe39['status'](0xcc)[_0x3fac('0x19')]();});}};}function handleEntityNotFound(_0x47ba26,_0x43308c){return function(_0x55b27a){if(!_0x55b27a){_0x47ba26[_0x3fac('0x27')](0x194);}return _0x55b27a;};}function handleError(_0x1eea41,_0x5bcc2a){_0x5bcc2a=_0x5bcc2a||0x1f4;return function(_0x4aa05e){logger[_0x3fac('0x28')](_0x4aa05e[_0x3fac('0x29')]);if(_0x4aa05e[_0x3fac('0x2a')]){delete _0x4aa05e[_0x3fac('0x2a')];}_0x1eea41[_0x3fac('0x18')](_0x5bcc2a)[_0x3fac('0x2b')](_0x4aa05e);};}exports[_0x3fac('0x2c')]=function(_0x1fa2f5,_0x502b38){var _0x5c8f37={},_0x16325a={},_0x1f95ad={'count':0x0,'rows':[]};var _0x94932b=_[_0x3fac('0x2d')](db['Template'][_0x3fac('0x2e')],function(_0x489d98){return{'name':_0x489d98[_0x3fac('0x2f')],'type':_0x489d98[_0x3fac('0x30')][_0x3fac('0x31')]};});_0x16325a[_0x3fac('0x32')]=_['map'](_0x94932b,_0x3fac('0x2a'));_0x16325a[_0x3fac('0x33')]=_[_0x3fac('0x34')](_0x1fa2f5[_0x3fac('0x33')]);_0x16325a[_0x3fac('0x35')]=_[_0x3fac('0x36')](_0x16325a['model'],_0x16325a[_0x3fac('0x33')]);_0x5c8f37['attributes']=_['intersection'](_0x16325a[_0x3fac('0x32')],qs[_0x3fac('0x37')](_0x1fa2f5['query'][_0x3fac('0x37')]));_0x5c8f37[_0x3fac('0x38')]=_0x5c8f37[_0x3fac('0x38')][_0x3fac('0x39')]?_0x5c8f37[_0x3fac('0x38')]:_0x16325a[_0x3fac('0x32')];if(!_0x1fa2f5[_0x3fac('0x33')][_0x3fac('0x3a')](_0x3fac('0x3b'))){_0x5c8f37[_0x3fac('0x1d')]=qs[_0x3fac('0x1d')](_0x1fa2f5[_0x3fac('0x33')]['limit']);_0x5c8f37[_0x3fac('0x1b')]=qs[_0x3fac('0x1b')](_0x1fa2f5[_0x3fac('0x33')][_0x3fac('0x1b')]);}_0x5c8f37[_0x3fac('0x3c')]=qs[_0x3fac('0x3d')](_0x1fa2f5[_0x3fac('0x33')][_0x3fac('0x3d')]);_0x5c8f37['where']=qs[_0x3fac('0x35')](_[_0x3fac('0x3e')](_0x1fa2f5['query'],_0x16325a[_0x3fac('0x35')]),_0x94932b);if(_0x1fa2f5['query'][_0x3fac('0x3f')]){_0x5c8f37[_0x3fac('0x40')]=_[_0x3fac('0x41')](_0x5c8f37[_0x3fac('0x40')],{'$or':_[_0x3fac('0x2d')](_0x94932b,function(_0x409c40){if(_0x409c40[_0x3fac('0x30')]!=='VIRTUAL'){var _0x2a2906={};_0x2a2906[_0x409c40[_0x3fac('0x2a')]]={'$like':'%'+_0x1fa2f5[_0x3fac('0x33')][_0x3fac('0x3f')]+'%'};return _0x2a2906;}})});}_0x5c8f37=_['merge']({},_0x5c8f37,_0x1fa2f5[_0x3fac('0x42')]);var _0x1f20e5={'where':_0x5c8f37[_0x3fac('0x40')]};return db[_0x3fac('0x43')][_0x3fac('0x1e')](_0x1f20e5)['then'](function(_0x1b10c9){_0x1f95ad[_0x3fac('0x1e')]=_0x1b10c9;if(_0x1fa2f5['query'][_0x3fac('0x44')]){_0x5c8f37[_0x3fac('0x45')]=[{'all':!![]}];}return db['Template'][_0x3fac('0x46')](_0x5c8f37);})['then'](function(_0x2b1a8f){_0x1f95ad[_0x3fac('0x47')]=_0x2b1a8f;return _0x1f95ad;})[_0x3fac('0x26')](respondWithFilteredResult(_0x502b38,_0x5c8f37))[_0x3fac('0x48')](handleError(_0x502b38,null));};exports[_0x3fac('0x49')]=function(_0x32c8e4,_0x2ed6bc){var _0x2822a4={'raw':!![],'where':{'id':_0x32c8e4['params']['id']}},_0x41b6de={};_0x41b6de[_0x3fac('0x32')]=_[_0x3fac('0x34')](db[_0x3fac('0x43')]['rawAttributes']);_0x41b6de[_0x3fac('0x33')]=_[_0x3fac('0x34')](_0x32c8e4[_0x3fac('0x33')]);_0x41b6de['filters']=_[_0x3fac('0x36')](_0x41b6de[_0x3fac('0x32')],_0x41b6de[_0x3fac('0x33')]);_0x2822a4[_0x3fac('0x38')]=_[_0x3fac('0x36')](_0x41b6de[_0x3fac('0x32')],qs['fields'](_0x32c8e4[_0x3fac('0x33')][_0x3fac('0x37')]));_0x2822a4['attributes']=_0x2822a4[_0x3fac('0x38')][_0x3fac('0x39')]?_0x2822a4[_0x3fac('0x38')]:_0x41b6de['model'];if(_0x32c8e4[_0x3fac('0x33')][_0x3fac('0x44')]){_0x2822a4['include']=[{'all':!![]}];}_0x2822a4=_[_0x3fac('0x41')]({},_0x2822a4,_0x32c8e4[_0x3fac('0x42')]);return db[_0x3fac('0x43')][_0x3fac('0x4a')](_0x2822a4)[_0x3fac('0x26')](handleEntityNotFound(_0x2ed6bc,null))['then'](respondWithResult(_0x2ed6bc,null))[_0x3fac('0x48')](handleError(_0x2ed6bc,null));};exports[_0x3fac('0x4b')]=function(_0x4fce18,_0x39e6ea){return db[_0x3fac('0x43')]['create'](_0x4fce18['body'],{})['then'](function(_0x3dd531){var _0x5b722c=_0x4fce18[_0x3fac('0x4c')][_0x3fac('0x24')]({'plain':!![]});if(!_0x5b722c)throw new Error(_0x3fac('0x4d'));if(_0x5b722c[_0x3fac('0x4e')]===_0x3fac('0x4c')){var _0x3e4fc3=_0x3dd531[_0x3fac('0x24')]({'plain':!![]});var _0x231b19='Templates';return db[_0x3fac('0x4f')][_0x3fac('0x4a')]({'where':{'name':_0x231b19,'userProfileId':_0x5b722c['userProfileId']},'raw':!![]})[_0x3fac('0x26')](function(_0x377a6d){if(_0x377a6d&&_0x377a6d['autoAssociation']===0x0){return db[_0x3fac('0x25')]['create']({'name':_0x3e4fc3[_0x3fac('0x2a')],'resourceId':_0x3e4fc3['id'],'type':_0x377a6d[_0x3fac('0x2a')],'sectionId':_0x377a6d['id']},{})['then'](function(){return _0x3dd531;});}else{return _0x3dd531;}})[_0x3fac('0x48')](function(_0x4a82cc){logger[_0x3fac('0x28')](_0x3fac('0x50'),_0x4a82cc);throw _0x4a82cc;});}return _0x3dd531;})['then'](respondWithResult(_0x39e6ea,0xc9))[_0x3fac('0x48')](handleError(_0x39e6ea,null));};exports[_0x3fac('0x22')]=function(_0x41532a,_0x3122dd){if(_0x41532a['body']['id']){delete _0x41532a[_0x3fac('0x51')]['id'];}return db[_0x3fac('0x43')][_0x3fac('0x4a')]({'where':{'id':_0x41532a[_0x3fac('0x52')]['id']}})[_0x3fac('0x26')](handleEntityNotFound(_0x3122dd,null))[_0x3fac('0x26')](saveUpdates(_0x41532a[_0x3fac('0x51')],null))[_0x3fac('0x26')](respondWithResult(_0x3122dd,null))['catch'](handleError(_0x3122dd,null));};exports[_0x3fac('0x23')]=function(_0x3a0bca,_0x5a2185){return db[_0x3fac('0x43')][_0x3fac('0x4a')]({'where':{'id':_0x3a0bca[_0x3fac('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a2185,null))[_0x3fac('0x26')](removeEntity(_0x5a2185,null))[_0x3fac('0x48')](handleError(_0x5a2185,null));}; \ No newline at end of file +var _0xb2c4=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','Template','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x5d2cf3,_0x16bfd2){var _0x45a3fc=function(_0x24e67f){while(--_0x24e67f){_0x5d2cf3['push'](_0x5d2cf3['shift']());}};_0x45a3fc(++_0x16bfd2);}(_0xb2c4,0x1eb));var _0x4b2c=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xb2c4[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x4b2c('0x0'));var rimraf=require(_0x4b2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b2c('0x2'));var rp=require('request-promise');var moment=require(_0x4b2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b2c('0x4'));var util=require(_0x4b2c('0x5'));var path=require(_0x4b2c('0x6'));var sox=require(_0x4b2c('0x7'));var csv=require('to-csv');var ejs=require(_0x4b2c('0x8'));var fs=require('fs');var fs_extra=require(_0x4b2c('0x9'));var _=require('lodash');var squel=require(_0x4b2c('0xa'));var crypto=require(_0x4b2c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b2c('0xc'));var toCsv=require(_0x4b2c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b2c('0xe'));var authService=require(_0x4b2c('0xf'));var qs=require(_0x4b2c('0x10'));var as=require(_0x4b2c('0x11'));var hardwareService=require(_0x4b2c('0x12'));var logger=require(_0x4b2c('0x13'))(_0x4b2c('0x14'));var utils=require(_0x4b2c('0x15'));var config=require(_0x4b2c('0x16'));var licenseUtil=require(_0x4b2c('0x17'));var db=require(_0x4b2c('0x18'))['db'];function respondWithStatusCode(_0x5caea0,_0x1734ed){_0x1734ed=_0x1734ed||0xcc;return function(_0x2cf5cc){if(_0x2cf5cc){return _0x5caea0[_0x4b2c('0x19')](_0x1734ed);}return _0x5caea0['status'](_0x1734ed)[_0x4b2c('0x1a')]();};}function respondWithResult(_0x13a39b,_0x12fa70){_0x12fa70=_0x12fa70||0xc8;return function(_0x400a78){if(_0x400a78){return _0x13a39b[_0x4b2c('0x1b')](_0x12fa70)['json'](_0x400a78);}};}function respondWithFilteredResult(_0x18270e,_0x5a506e){return function(_0x378e2e){if(_0x378e2e){var _0x2571e2=typeof _0x5a506e[_0x4b2c('0x1c')]===_0x4b2c('0x1d')&&typeof _0x5a506e[_0x4b2c('0x1e')]===_0x4b2c('0x1d');var _0x41d66e=_0x378e2e['count'];var _0x556ad9=_0x2571e2?0x0:_0x5a506e[_0x4b2c('0x1c')];var _0x3dd945=_0x2571e2?_0x378e2e[_0x4b2c('0x1f')]:_0x5a506e['offset']+_0x5a506e[_0x4b2c('0x1e')];var _0x3662ec;if(_0x3dd945>=_0x41d66e){_0x3dd945=_0x41d66e;_0x3662ec=0xc8;}else{_0x3662ec=0xce;}_0x18270e[_0x4b2c('0x1b')](_0x3662ec);return _0x18270e[_0x4b2c('0x20')](_0x4b2c('0x21'),_0x556ad9+'-'+_0x3dd945+'/'+_0x41d66e)[_0x4b2c('0x22')](_0x378e2e);}return null;};}function patchUpdates(_0x3011b5){return function(_0x2b36b3){try{jsonpatch[_0x4b2c('0x23')](_0x2b36b3,_0x3011b5,!![]);}catch(_0x5c47f4){return BPromise[_0x4b2c('0x24')](_0x5c47f4);}return _0x2b36b3['save']();};}function saveUpdates(_0x52155c,_0x4baa54){return function(_0x532fe6){if(_0x532fe6){return _0x532fe6[_0x4b2c('0x25')](_0x52155c)['then'](function(_0x377402){return _0x377402;});}return null;};}function removeEntity(_0x2eab60,_0x584e0e){return function(_0x5ebb9c){if(_0x5ebb9c){return _0x5ebb9c[_0x4b2c('0x26')]()[_0x4b2c('0x27')](function(){var _0x1981d4=_0x5ebb9c[_0x4b2c('0x28')]({'plain':!![]});var _0x49f630=_0x4b2c('0x29');return db[_0x4b2c('0x2a')][_0x4b2c('0x26')]({'where':{'type':_0x49f630,'resourceId':_0x1981d4['id']}})[_0x4b2c('0x27')](function(){return _0x5ebb9c;});})[_0x4b2c('0x27')](function(){_0x2eab60[_0x4b2c('0x1b')](0xcc)[_0x4b2c('0x1a')]();});}};}function handleEntityNotFound(_0x2641a5,_0xcce124){return function(_0x3f28e4){if(!_0x3f28e4){_0x2641a5[_0x4b2c('0x19')](0x194);}return _0x3f28e4;};}function handleError(_0x189678,_0x1c9dae){_0x1c9dae=_0x1c9dae||0x1f4;return function(_0x6c5713){logger[_0x4b2c('0x2b')](_0x6c5713[_0x4b2c('0x2c')]);if(_0x6c5713[_0x4b2c('0x2d')]){delete _0x6c5713[_0x4b2c('0x2d')];}_0x189678['status'](_0x1c9dae)[_0x4b2c('0x2e')](_0x6c5713);};}exports['index']=function(_0x2b5648,_0x17d3cc){var _0x55cd26={},_0x5b25bb={},_0x16e73d={'count':0x0,'rows':[]};var _0x2f4530=_['map'](db[_0x4b2c('0x2f')][_0x4b2c('0x30')],function(_0x5e0ba6){return{'name':_0x5e0ba6['fieldName'],'type':_0x5e0ba6[_0x4b2c('0x31')][_0x4b2c('0x32')]};});_0x5b25bb['model']=_[_0x4b2c('0x33')](_0x2f4530,'name');_0x5b25bb[_0x4b2c('0x34')]=_[_0x4b2c('0x35')](_0x2b5648[_0x4b2c('0x34')]);_0x5b25bb[_0x4b2c('0x36')]=_[_0x4b2c('0x37')](_0x5b25bb['model'],_0x5b25bb[_0x4b2c('0x34')]);_0x55cd26[_0x4b2c('0x38')]=_['intersection'](_0x5b25bb[_0x4b2c('0x39')],qs['fields'](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3a')]));_0x55cd26[_0x4b2c('0x38')]=_0x55cd26['attributes']['length']?_0x55cd26[_0x4b2c('0x38')]:_0x5b25bb[_0x4b2c('0x39')];if(!_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3b')](_0x4b2c('0x3c'))){_0x55cd26['limit']=qs[_0x4b2c('0x1e')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x1e')]);_0x55cd26[_0x4b2c('0x1c')]=qs[_0x4b2c('0x1c')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x1c')]);}_0x55cd26[_0x4b2c('0x3d')]=qs[_0x4b2c('0x3e')](_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x3e')]);_0x55cd26[_0x4b2c('0x3f')]=qs[_0x4b2c('0x36')](_[_0x4b2c('0x40')](_0x2b5648[_0x4b2c('0x34')],_0x5b25bb[_0x4b2c('0x36')]),_0x2f4530);if(_0x2b5648['query'][_0x4b2c('0x41')]){_0x55cd26['where']=_['merge'](_0x55cd26[_0x4b2c('0x3f')],{'$or':_[_0x4b2c('0x33')](_0x2f4530,function(_0x410169){if(_0x410169[_0x4b2c('0x31')]!==_0x4b2c('0x42')){var _0x25c135={};_0x25c135[_0x410169[_0x4b2c('0x2d')]]={'$like':'%'+_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x41')]+'%'};return _0x25c135;}})});}_0x55cd26=_[_0x4b2c('0x43')]({},_0x55cd26,_0x2b5648['options']);var _0x8e239c={'where':_0x55cd26[_0x4b2c('0x3f')]};return db[_0x4b2c('0x2f')]['count'](_0x8e239c)[_0x4b2c('0x27')](function(_0x835976){_0x16e73d[_0x4b2c('0x1f')]=_0x835976;if(_0x2b5648[_0x4b2c('0x34')][_0x4b2c('0x44')]){_0x55cd26['include']=[{'all':!![]}];}return db[_0x4b2c('0x2f')][_0x4b2c('0x45')](_0x55cd26);})[_0x4b2c('0x27')](function(_0x552581){_0x16e73d[_0x4b2c('0x46')]=_0x552581;return _0x16e73d;})[_0x4b2c('0x27')](respondWithFilteredResult(_0x17d3cc,_0x55cd26))[_0x4b2c('0x47')](handleError(_0x17d3cc,null));};exports[_0x4b2c('0x48')]=function(_0x1f71a9,_0xef53b6){var _0x2239b4={'raw':!![],'where':{'id':_0x1f71a9[_0x4b2c('0x49')]['id']}},_0x429f84={};_0x429f84['model']=_[_0x4b2c('0x35')](db[_0x4b2c('0x2f')][_0x4b2c('0x30')]);_0x429f84[_0x4b2c('0x34')]=_[_0x4b2c('0x35')](_0x1f71a9[_0x4b2c('0x34')]);_0x429f84[_0x4b2c('0x36')]=_[_0x4b2c('0x37')](_0x429f84[_0x4b2c('0x39')],_0x429f84[_0x4b2c('0x34')]);_0x2239b4[_0x4b2c('0x38')]=_['intersection'](_0x429f84[_0x4b2c('0x39')],qs[_0x4b2c('0x3a')](_0x1f71a9['query'][_0x4b2c('0x3a')]));_0x2239b4[_0x4b2c('0x38')]=_0x2239b4[_0x4b2c('0x38')][_0x4b2c('0x4a')]?_0x2239b4[_0x4b2c('0x38')]:_0x429f84[_0x4b2c('0x39')];if(_0x1f71a9['query'][_0x4b2c('0x44')]){_0x2239b4[_0x4b2c('0x4b')]=[{'all':!![]}];}_0x2239b4=_[_0x4b2c('0x43')]({},_0x2239b4,_0x1f71a9[_0x4b2c('0x4c')]);return db[_0x4b2c('0x2f')][_0x4b2c('0x4d')](_0x2239b4)[_0x4b2c('0x27')](handleEntityNotFound(_0xef53b6,null))['then'](respondWithResult(_0xef53b6,null))[_0x4b2c('0x47')](handleError(_0xef53b6,null));};exports[_0x4b2c('0x4e')]=function(_0x3ed787,_0x50d794){return db[_0x4b2c('0x2f')]['create'](_0x3ed787[_0x4b2c('0x4f')],{})['then'](function(_0x19b134){var _0x498f8e=_0x3ed787['user'][_0x4b2c('0x28')]({'plain':!![]});if(!_0x498f8e)throw new Error(_0x4b2c('0x50'));if(_0x498f8e[_0x4b2c('0x51')]===_0x4b2c('0x52')){var _0x34087d=_0x19b134['get']({'plain':!![]});var _0x10f223=_0x4b2c('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x10f223,'userProfileId':_0x498f8e['userProfileId']},'raw':!![]})[_0x4b2c('0x27')](function(_0x3f5608){if(_0x3f5608&&_0x3f5608['autoAssociation']===0x0){return db[_0x4b2c('0x2a')]['create']({'name':_0x34087d['name'],'resourceId':_0x34087d['id'],'type':_0x3f5608[_0x4b2c('0x2d')],'sectionId':_0x3f5608['id']},{})[_0x4b2c('0x27')](function(){return _0x19b134;});}else{return _0x19b134;}})['catch'](function(_0x4eb05a){logger[_0x4b2c('0x2b')](_0x4b2c('0x53'),_0x4eb05a);throw _0x4eb05a;});}return _0x19b134;})[_0x4b2c('0x27')](respondWithResult(_0x50d794,0xc9))[_0x4b2c('0x47')](handleError(_0x50d794,null));};exports[_0x4b2c('0x25')]=function(_0x1b0e06,_0x8c6590){if(_0x1b0e06[_0x4b2c('0x4f')]['id']){delete _0x1b0e06[_0x4b2c('0x4f')]['id'];}return db['Template'][_0x4b2c('0x4d')]({'where':{'id':_0x1b0e06[_0x4b2c('0x49')]['id']}})[_0x4b2c('0x27')](handleEntityNotFound(_0x8c6590,null))[_0x4b2c('0x27')](saveUpdates(_0x1b0e06[_0x4b2c('0x4f')],null))[_0x4b2c('0x27')](respondWithResult(_0x8c6590,null))['catch'](handleError(_0x8c6590,null));};exports[_0x4b2c('0x26')]=function(_0x10f533,_0x1dca09){return db[_0x4b2c('0x2f')]['find']({'where':{'id':_0x10f533[_0x4b2c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1dca09,null))[_0x4b2c('0x27')](removeEntity(_0x1dca09,null))[_0x4b2c('0x47')](handleError(_0x1dca09,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f8b413a..1ca6a3f 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 _0x700c=['./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x700c,0x161));var _0xc700=function(_0x32ad77,_0x43bbcd){_0x32ad77=_0x32ad77-0x0;var _0x4ae664=_0x700c[_0x32ad77];return _0x4ae664;};'use strict';var _=require(_0xc700('0x0'));var util=require(_0xc700('0x1'));var logger=require('../../config/logger')(_0xc700('0x2'));var moment=require(_0xc700('0x3'));var BPromise=require(_0xc700('0x4'));var rp=require(_0xc700('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc700('0x6'));var config=require('../../config/environment');var attributes=require(_0xc700('0x7'));module[_0xc700('0x8')]=function(_0x57901b,_0x10762c){return _0x57901b[_0xc700('0x9')](_0xc700('0xa'),attributes,{'tableName':_0xc700('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078c=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./template.attributes','exports','tools_templates'];(function(_0xbd8c33,_0x5d1f67){var _0x4e29ee=function(_0x4ef1e1){while(--_0x4ef1e1){_0xbd8c33['push'](_0xbd8c33['shift']());}};_0x4e29ee(++_0x5d1f67);}(_0x078c,0x18c));var _0xc078=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x078c[_0x183256];return _0x5394a2;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))('api');var moment=require(_0xc078('0x2'));var BPromise=require('bluebird');var rp=require(_0xc078('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc078('0x4'));var config=require(_0xc078('0x5'));var attributes=require(_0xc078('0x6'));module[_0xc078('0x7')]=function(_0x7c7ea8,_0x5d7ca6){return _0x7c7ea8['define']('Template',attributes,{'tableName':_0xc078('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 4560a2b..f917c98 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 _0x1a54=['where','attributes','limit','include','model','map','debug','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a54,0x1d6));var _0x41a5=function(_0x3702e7,_0x1fa64e){_0x3702e7=_0x3702e7-0x0;var _0x2bc3e8=_0x1a54[_0x3702e7];return _0x2bc3e8;};'use strict';var _=require(_0x41a5('0x0'));var util=require(_0x41a5('0x1'));var moment=require('moment');var BPromise=require(_0x41a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41a5('0x3'));var db=require(_0x41a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x41a5('0x5'))(_0x41a5('0x6'));var config=require(_0x41a5('0x7'));var jayson=require(_0x41a5('0x8'));var client=jayson['client'][_0x41a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9a5a,_0x3e8609,_0x2a3837){return new BPromise(function(_0x5dfe06,_0x9c1929){return client[_0x41a5('0xa')](_0x2b9a5a,_0x2a3837)[_0x41a5('0xb')](function(_0x19487a){logger[_0x41a5('0xc')]('Template,\x20%s,\x20%s',_0x3e8609,_0x41a5('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x3e8609,_0x41a5('0xd'),JSON[_0x41a5('0xe')](_0x19487a));if(_0x19487a[_0x41a5('0xf')]){if(_0x19487a[_0x41a5('0xf')][_0x41a5('0x10')]===0x1f4){logger[_0x41a5('0xf')](_0x41a5('0x11'),_0x3e8609,_0x19487a[_0x41a5('0xf')][_0x41a5('0x12')]);return _0x9c1929(_0x19487a[_0x41a5('0xf')][_0x41a5('0x12')]);}logger[_0x41a5('0xf')](_0x41a5('0x11'),_0x3e8609,_0x19487a[_0x41a5('0xf')][_0x41a5('0x12')]);return _0x5dfe06(_0x19487a[_0x41a5('0xf')][_0x41a5('0x12')]);}else{logger[_0x41a5('0xc')](_0x41a5('0x11'),_0x3e8609,_0x41a5('0xd'));_0x5dfe06(_0x19487a[_0x41a5('0x13')][_0x41a5('0x12')]);}})['catch'](function(_0x4bca62){logger[_0x41a5('0xf')](_0x41a5('0x11'),_0x3e8609,_0x4bca62);_0x9c1929(_0x4bca62);});});}exports[_0x41a5('0x14')]=function(_0x468139){var _0x47fcbb=this;return new Promise(function(_0x175a79,_0x4513fd){return db[_0x41a5('0x15')][_0x41a5('0x16')]({'raw':_0x468139[_0x41a5('0x17')]?_0x468139[_0x41a5('0x17')][_0x41a5('0x18')]===undefined?!![]:![]:!![],'where':_0x468139[_0x41a5('0x17')]?_0x468139[_0x41a5('0x17')][_0x41a5('0x19')]||null:null,'attributes':_0x468139['options']?_0x468139['options'][_0x41a5('0x1a')]||null:null,'limit':_0x468139[_0x41a5('0x17')]?_0x468139[_0x41a5('0x17')][_0x41a5('0x1b')]||null:null,'include':_0x468139[_0x41a5('0x17')]?_0x468139[_0x41a5('0x17')][_0x41a5('0x1c')]?_['map'](_0x468139[_0x41a5('0x17')]['include'],function(_0x57bbf5){return{'model':db[_0x57bbf5[_0x41a5('0x1d')]],'as':_0x57bbf5['as'],'attributes':_0x57bbf5['attributes'],'include':_0x57bbf5['include']?_[_0x41a5('0x1e')](_0x57bbf5[_0x41a5('0x1c')],function(_0x19ddd5){return{'model':db[_0x19ddd5[_0x41a5('0x1d')]],'as':_0x19ddd5['as'],'attributes':_0x19ddd5[_0x41a5('0x1a')],'include':_0x19ddd5[_0x41a5('0x1c')]?_[_0x41a5('0x1e')](_0x19ddd5['include'],function(_0x4852a1){return{'model':db[_0x4852a1['model']],'as':_0x4852a1['as'],'attributes':_0x4852a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x41a5('0xb')](function(_0x1e9591){logger['info']('GetTemplate',_0x468139);logger[_0x41a5('0x1f')]('GetTemplate',_0x468139,JSON[_0x41a5('0xe')](_0x1e9591));_0x175a79(_0x1e9591);})[_0x41a5('0x20')](function(_0x1c5e5e){logger[_0x41a5('0xf')](_0x41a5('0x14'),_0x1c5e5e[_0x41a5('0x12')],_0x468139);_0x4513fd(_0x47fcbb['error'](0x1f4,_0x1c5e5e[_0x41a5('0x12')]));});});}; \ No newline at end of file +var _0xb875=['catch','GetTemplate','options','raw','include','map','model','attributes','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x49e37a,_0x40beae){var _0x56f277=function(_0xa9b029){while(--_0xa9b029){_0x49e37a['push'](_0x49e37a['shift']());}};_0x56f277(++_0x40beae);}(_0xb875,0x167));var _0x5b87=function(_0x51d1ac,_0x3479a6){_0x51d1ac=_0x51d1ac-0x0;var _0x3399b6=_0xb875[_0x51d1ac];return _0x3399b6;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('Template,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});}exports[_0x5b87('0x14')]=function(_0x18cfa8){var _0x384289=this;return new Promise(function(_0x4865da,_0x4e6777){return db['Template']['findAll']({'raw':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x16')]===undefined?!![]:![]:!![],'where':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')]['where']||null:null,'attributes':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8['options']['attributes']||null:null,'limit':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')]['limit']||null:null,'include':_0x18cfa8[_0x5b87('0x15')]?_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x17')]?_[_0x5b87('0x18')](_0x18cfa8[_0x5b87('0x15')][_0x5b87('0x17')],function(_0x1afe46){return{'model':db[_0x1afe46[_0x5b87('0x19')]],'as':_0x1afe46['as'],'attributes':_0x1afe46[_0x5b87('0x1a')],'include':_0x1afe46[_0x5b87('0x17')]?_['map'](_0x1afe46[_0x5b87('0x17')],function(_0x250dec){return{'model':db[_0x250dec[_0x5b87('0x19')]],'as':_0x250dec['as'],'attributes':_0x250dec[_0x5b87('0x1a')],'include':_0x250dec[_0x5b87('0x17')]?_[_0x5b87('0x18')](_0x250dec[_0x5b87('0x17')],function(_0x27b4e1){return{'model':db[_0x27b4e1[_0x5b87('0x19')]],'as':_0x27b4e1['as'],'attributes':_0x27b4e1[_0x5b87('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b87('0x9')](function(_0x5a9f77){logger['info'](_0x5b87('0x14'),_0x18cfa8);logger['debug'](_0x5b87('0x14'),_0x18cfa8,JSON[_0x5b87('0xe')](_0x5a9f77));_0x4865da(_0x5a9f77);})['catch'](function(_0x49f639){logger[_0x5b87('0xf')](_0x5b87('0x14'),_0x49f639[_0x5b87('0x11')],_0x18cfa8);_0x4e6777(_0x384289[_0x5b87('0xf')](0x1f4,_0x49f639[_0x5b87('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index bd331ff..dc130c4 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 _0x7887=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7887,0x1b3));var _0x7788=function(_0x4fed99,_0x4a2712){_0x4fed99=_0x4fed99-0x0;var _0x5408e8=_0x7887[_0x4fed99];return _0x5408e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7788('0x0'));var timeout=require(_0x7788('0x1'));var express=require(_0x7788('0x2'));var router=express[_0x7788('0x3')]();var fs_extra=require(_0x7788('0x4'));var auth=require(_0x7788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7788('0x6'));var controller=require('./trigger.controller');router[_0x7788('0x7')]('/',auth[_0x7788('0x8')](),controller['index']);router[_0x7788('0x7')](_0x7788('0x9'),auth[_0x7788('0x8')](),controller[_0x7788('0xa')]);router[_0x7788('0x7')](_0x7788('0xb'),auth[_0x7788('0x8')](),controller[_0x7788('0xc')]);router[_0x7788('0x7')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x7788('0xd')]);router[_0x7788('0x7')](_0x7788('0xe'),auth[_0x7788('0x8')](),controller[_0x7788('0xf')]);router[_0x7788('0x10')]('/',auth['isAuthenticated'](),controller[_0x7788('0x11')]);router[_0x7788('0x10')](_0x7788('0xb'),auth[_0x7788('0x8')](),controller[_0x7788('0x12')]);router[_0x7788('0x10')](_0x7788('0x13'),auth['isAuthenticated'](),controller[_0x7788('0x14')]);router[_0x7788('0x10')](_0x7788('0xe'),auth['isAuthenticated'](),controller[_0x7788('0x15')]);router[_0x7788('0x16')](_0x7788('0x9'),auth[_0x7788('0x8')](),controller[_0x7788('0x17')]);router[_0x7788('0x18')](_0x7788('0x9'),auth[_0x7788('0x8')](),controller[_0x7788('0x19')]);module[_0x7788('0x1a')]=router; \ No newline at end of file +var _0xa44d=['update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','/:id/all_conditions','addAllCondition','/:id/actions','addAction','put','/:id'];(function(_0x5f415f,_0x15ba69){var _0x4f9ff7=function(_0xec410f){while(--_0xec410f){_0x5f415f['push'](_0x5f415f['shift']());}};_0x4f9ff7(++_0x15ba69);}(_0xa44d,0xf6));var _0xda44=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xa44d[_0x96f74c];return _0x379222;};'use strict';var multer=require('multer');var util=require(_0xda44('0x0'));var path=require('path');var timeout=require(_0xda44('0x1'));var express=require(_0xda44('0x2'));var router=express[_0xda44('0x3')]();var fs_extra=require(_0xda44('0x4'));var auth=require(_0xda44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda44('0x6'));var controller=require(_0xda44('0x7'));router[_0xda44('0x8')]('/',auth[_0xda44('0x9')](),controller[_0xda44('0xa')]);router[_0xda44('0x8')]('/:id',auth[_0xda44('0x9')](),controller[_0xda44('0xb')]);router[_0xda44('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xda44('0xc')]);router[_0xda44('0x8')](_0xda44('0xd'),auth[_0xda44('0x9')](),controller[_0xda44('0xe')]);router[_0xda44('0x8')]('/:id/actions',auth[_0xda44('0x9')](),controller[_0xda44('0xf')]);router['post']('/',auth[_0xda44('0x9')](),controller[_0xda44('0x10')]);router[_0xda44('0x11')](_0xda44('0x12'),auth['isAuthenticated'](),controller[_0xda44('0x13')]);router[_0xda44('0x11')](_0xda44('0xd'),auth[_0xda44('0x9')](),controller['addAnyCondition']);router[_0xda44('0x11')](_0xda44('0x14'),auth['isAuthenticated'](),controller[_0xda44('0x15')]);router[_0xda44('0x16')](_0xda44('0x17'),auth[_0xda44('0x9')](),controller[_0xda44('0x18')]);router['delete'](_0xda44('0x17'),auth[_0xda44('0x9')](),controller[_0xda44('0x19')]);module[_0xda44('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3fd42f2..ec4caec 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 _0x94c5=['exports','STRING','sequelize'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x94c5,0xef));var _0x594c=function(_0xf1b0a0,_0x42bd06){_0xf1b0a0=_0xf1b0a0-0x0;var _0x54675d=_0x94c5[_0xf1b0a0];return _0x54675d;};'use strict';var Sequelize=require(_0x594c('0x0'));module[_0x594c('0x1')]={'name':{'type':Sequelize[_0x594c('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2f55=['BOOLEAN','exports','STRING'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x2f55,0x112));var _0x52f5=function(_0x18051f,_0x187f33){_0x18051f=_0x18051f-0x0;var _0x372160=_0x2f55[_0x18051f];return _0x372160;};'use strict';var Sequelize=require('sequelize');module[_0x52f5('0x0')]={'name':{'type':Sequelize[_0x52f5('0x1')]},'channel':{'type':Sequelize[_0x52f5('0x1')]},'description':{'type':Sequelize[_0x52f5('0x1')]},'status':{'type':Sequelize[_0x52f5('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 2b7676a..2491e1a 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 _0x38ab=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','TriggerAllId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','getActions','nolimit','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xd2cd94,_0x3bf735){var _0x844eaa=function(_0xafb688){while(--_0xafb688){_0xd2cd94['push'](_0xd2cd94['shift']());}};_0x844eaa(++_0x3bf735);}(_0x38ab,0x9f));var _0xb38a=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x38ab[_0x5235a6];return _0x1cf37e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb38a('0x0'));var rp=require(_0xb38a('0x1'));var moment=require('moment');var BPromise=require(_0xb38a('0x2'));var Mustache=require(_0xb38a('0x3'));var util=require(_0xb38a('0x4'));var path=require(_0xb38a('0x5'));var sox=require(_0xb38a('0x6'));var csv=require(_0xb38a('0x7'));var ejs=require(_0xb38a('0x8'));var fs=require('fs');var fs_extra=require(_0xb38a('0x9'));var _=require(_0xb38a('0xa'));var squel=require(_0xb38a('0xb'));var crypto=require(_0xb38a('0xc'));var jsforce=require(_0xb38a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb38a('0xe'));var Redis=require(_0xb38a('0xf'));var authService=require(_0xb38a('0x10'));var qs=require(_0xb38a('0x11'));var as=require(_0xb38a('0x12'));var hardwareService=require(_0xb38a('0x13'));var logger=require(_0xb38a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb38a('0x15'));var licenseUtil=require(_0xb38a('0x16'));var db=require(_0xb38a('0x17'))['db'];function respondWithStatusCode(_0x4f0950,_0x5dc598){_0x5dc598=_0x5dc598||0xcc;return function(_0x5452e6){if(_0x5452e6){return _0x4f0950[_0xb38a('0x18')](_0x5dc598);}return _0x4f0950[_0xb38a('0x19')](_0x5dc598)[_0xb38a('0x1a')]();};}function respondWithResult(_0x4d2115,_0x57afa0){_0x57afa0=_0x57afa0||0xc8;return function(_0x43a881){if(_0x43a881){return _0x4d2115['status'](_0x57afa0)[_0xb38a('0x1b')](_0x43a881);}};}function respondWithFilteredResult(_0x5a4714,_0x3fcf64){return function(_0x2d33a8){if(_0x2d33a8){var _0x4904cb=typeof _0x3fcf64['offset']==='undefined'&&typeof _0x3fcf64[_0xb38a('0x1c')]===_0xb38a('0x1d');var _0xeba880=_0x2d33a8['count'];var _0x3ac3c8=_0x4904cb?0x0:_0x3fcf64[_0xb38a('0x1e')];var _0x4aadab=_0x4904cb?_0x2d33a8[_0xb38a('0x1f')]:_0x3fcf64[_0xb38a('0x1e')]+_0x3fcf64[_0xb38a('0x1c')];var _0x4266ff;if(_0x4aadab>=_0xeba880){_0x4aadab=_0xeba880;_0x4266ff=0xc8;}else{_0x4266ff=0xce;}_0x5a4714[_0xb38a('0x19')](_0x4266ff);return _0x5a4714[_0xb38a('0x20')]('Content-Range',_0x3ac3c8+'-'+_0x4aadab+'/'+_0xeba880)[_0xb38a('0x1b')](_0x2d33a8);}return null;};}function patchUpdates(_0x1ea39b){return function(_0x2bbfb4){try{jsonpatch[_0xb38a('0x21')](_0x2bbfb4,_0x1ea39b,!![]);}catch(_0x206fd6){return BPromise[_0xb38a('0x22')](_0x206fd6);}return _0x2bbfb4['save']();};}function saveUpdates(_0x755a3b,_0x760d5e){return function(_0x5a49d7){if(_0x5a49d7){return _0x5a49d7['update'](_0x755a3b)[_0xb38a('0x23')](function(_0x1b8d24){return _0x1b8d24;});}return null;};}function removeEntity(_0x5af162,_0x16f55e){return function(_0x19a34f){if(_0x19a34f){return _0x19a34f['destroy']()[_0xb38a('0x23')](function(){var _0xbf3e94=_0x19a34f[_0xb38a('0x24')]({'plain':!![]});var _0x479796='Triggers';return db[_0xb38a('0x25')][_0xb38a('0x26')]({'where':{'type':_0x479796,'resourceId':_0xbf3e94['id']}})['then'](function(){return _0x19a34f;});})[_0xb38a('0x23')](function(){_0x5af162[_0xb38a('0x19')](0xcc)[_0xb38a('0x1a')]();});}};}function handleEntityNotFound(_0x212c03,_0x3cc76a){return function(_0x4f71b7){if(!_0x4f71b7){_0x212c03[_0xb38a('0x18')](0x194);}return _0x4f71b7;};}function handleError(_0x271156,_0x554945){_0x554945=_0x554945||0x1f4;return function(_0x298bd9){logger[_0xb38a('0x27')](_0x298bd9[_0xb38a('0x28')]);if(_0x298bd9[_0xb38a('0x29')]){delete _0x298bd9[_0xb38a('0x29')];}_0x271156[_0xb38a('0x19')](_0x554945)[_0xb38a('0x2a')](_0x298bd9);};}exports[_0xb38a('0x2b')]=function(_0x1c0621,_0x45e79d){var _0x476b5c={},_0x2267b6={},_0x22777d={'count':0x0,'rows':[]};var _0x3b444c=_[_0xb38a('0x2c')](db[_0xb38a('0x2d')]['rawAttributes'],function(_0x42ee89){return{'name':_0x42ee89[_0xb38a('0x2e')],'type':_0x42ee89[_0xb38a('0x2f')][_0xb38a('0x30')]};});_0x2267b6[_0xb38a('0x31')]=_[_0xb38a('0x2c')](_0x3b444c,_0xb38a('0x29'));_0x2267b6[_0xb38a('0x32')]=_[_0xb38a('0x33')](_0x1c0621[_0xb38a('0x32')]);_0x2267b6[_0xb38a('0x34')]=_['intersection'](_0x2267b6[_0xb38a('0x31')],_0x2267b6[_0xb38a('0x32')]);_0x476b5c[_0xb38a('0x35')]=_[_0xb38a('0x36')](_0x2267b6[_0xb38a('0x31')],qs['fields'](_0x1c0621[_0xb38a('0x32')][_0xb38a('0x37')]));_0x476b5c['attributes']=_0x476b5c[_0xb38a('0x35')][_0xb38a('0x38')]?_0x476b5c[_0xb38a('0x35')]:_0x2267b6[_0xb38a('0x31')];if(!_0x1c0621[_0xb38a('0x32')][_0xb38a('0x39')]('nolimit')){_0x476b5c[_0xb38a('0x1c')]=qs[_0xb38a('0x1c')](_0x1c0621[_0xb38a('0x32')][_0xb38a('0x1c')]);_0x476b5c['offset']=qs['offset'](_0x1c0621[_0xb38a('0x32')][_0xb38a('0x1e')]);}_0x476b5c[_0xb38a('0x3a')]=qs[_0xb38a('0x3b')](_0x1c0621['query']['sort']);_0x476b5c['where']=qs[_0xb38a('0x34')](_[_0xb38a('0x3c')](_0x1c0621[_0xb38a('0x32')],_0x2267b6[_0xb38a('0x34')]),_0x3b444c);if(_0x1c0621[_0xb38a('0x32')][_0xb38a('0x3d')]){_0x476b5c[_0xb38a('0x3e')]=_['merge'](_0x476b5c[_0xb38a('0x3e')],{'$or':_[_0xb38a('0x2c')](_0x3b444c,function(_0x441989){if(_0x441989['type']!==_0xb38a('0x3f')){var _0x29a872={};_0x29a872[_0x441989['name']]={'$like':'%'+_0x1c0621[_0xb38a('0x32')][_0xb38a('0x3d')]+'%'};return _0x29a872;}})});}_0x476b5c=_['merge']({},_0x476b5c,_0x1c0621[_0xb38a('0x40')]);var _0x4d13d0={'where':_0x476b5c[_0xb38a('0x3e')]};return db[_0xb38a('0x2d')][_0xb38a('0x1f')](_0x4d13d0)[_0xb38a('0x23')](function(_0x2936e2){_0x22777d[_0xb38a('0x1f')]=_0x2936e2;if(_0x1c0621['query'][_0xb38a('0x41')]){_0x476b5c[_0xb38a('0x42')]=[{'all':!![]}];}return db[_0xb38a('0x2d')][_0xb38a('0x43')](_0x476b5c);})[_0xb38a('0x23')](function(_0x4d9392){_0x22777d['rows']=_0x4d9392;return _0x22777d;})[_0xb38a('0x23')](respondWithFilteredResult(_0x45e79d,_0x476b5c))[_0xb38a('0x44')](handleError(_0x45e79d,null));};exports[_0xb38a('0x45')]=function(_0x168888,_0x1777f9){var _0x6928bd={'raw':![],'where':{'id':_0x168888[_0xb38a('0x46')]['id']}},_0x352aa7={};_0x352aa7[_0xb38a('0x31')]=_[_0xb38a('0x33')](db[_0xb38a('0x2d')][_0xb38a('0x47')]);_0x352aa7[_0xb38a('0x32')]=_['keys'](_0x168888['query']);_0x352aa7[_0xb38a('0x34')]=_[_0xb38a('0x36')](_0x352aa7[_0xb38a('0x31')],_0x352aa7['query']);_0x6928bd[_0xb38a('0x35')]=_[_0xb38a('0x36')](_0x352aa7[_0xb38a('0x31')],qs['fields'](_0x168888[_0xb38a('0x32')][_0xb38a('0x37')]));_0x6928bd[_0xb38a('0x35')]=_0x6928bd[_0xb38a('0x35')][_0xb38a('0x38')]?_0x6928bd[_0xb38a('0x35')]:_0x352aa7[_0xb38a('0x31')];if(_0x168888[_0xb38a('0x32')][_0xb38a('0x41')]){_0x6928bd[_0xb38a('0x42')]=[{'all':!![]}];}_0x6928bd=_[_0xb38a('0x48')]({},_0x6928bd,_0x168888[_0xb38a('0x40')]);return db[_0xb38a('0x2d')][_0xb38a('0x49')](_0x6928bd)[_0xb38a('0x23')](handleEntityNotFound(_0x1777f9,null))[_0xb38a('0x23')](respondWithResult(_0x1777f9,null))[_0xb38a('0x44')](handleError(_0x1777f9,null));};exports[_0xb38a('0x4a')]=function(_0x1ca5c8,_0x1a4285){return db[_0xb38a('0x2d')][_0xb38a('0x4a')](_0x1ca5c8[_0xb38a('0x4b')],{})[_0xb38a('0x23')](function(_0x117a24){var _0x396236=_0x1ca5c8['user'][_0xb38a('0x24')]({'plain':!![]});if(!_0x396236)throw new Error(_0xb38a('0x4c'));if(_0x396236[_0xb38a('0x4d')]==='user'){var _0x1e9fe2=_0x117a24[_0xb38a('0x24')]({'plain':!![]});var _0x1a8014=_0xb38a('0x4e');return db[_0xb38a('0x4f')][_0xb38a('0x49')]({'where':{'name':_0x1a8014,'userProfileId':_0x396236[_0xb38a('0x50')]},'raw':!![]})['then'](function(_0x22200f){if(_0x22200f&&_0x22200f[_0xb38a('0x51')]===0x0){return db['UserProfileResource'][_0xb38a('0x4a')]({'name':_0x1e9fe2[_0xb38a('0x29')],'resourceId':_0x1e9fe2['id'],'type':_0x22200f['name'],'sectionId':_0x22200f['id']},{})[_0xb38a('0x23')](function(){return _0x117a24;});}else{return _0x117a24;}})[_0xb38a('0x44')](function(_0x5d4bab){logger[_0xb38a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d4bab);throw _0x5d4bab;});}return _0x117a24;})[_0xb38a('0x23')](respondWithResult(_0x1a4285,0xc9))[_0xb38a('0x44')](handleError(_0x1a4285,null));};exports['update']=function(_0x20f158,_0x1eedc7){if(_0x20f158[_0xb38a('0x4b')]['id']){delete _0x20f158[_0xb38a('0x4b')]['id'];}return db[_0xb38a('0x2d')][_0xb38a('0x49')]({'where':{'id':_0x20f158[_0xb38a('0x46')]['id']}})[_0xb38a('0x23')](handleEntityNotFound(_0x1eedc7,null))[_0xb38a('0x23')](saveUpdates(_0x20f158[_0xb38a('0x4b')],null))[_0xb38a('0x23')](respondWithResult(_0x1eedc7,null))[_0xb38a('0x44')](handleError(_0x1eedc7,null));};exports[_0xb38a('0x26')]=function(_0x1bb20a,_0x164e3b){return db[_0xb38a('0x2d')][_0xb38a('0x49')]({'where':{'id':_0x1bb20a[_0xb38a('0x46')]['id']}})['then'](handleEntityNotFound(_0x164e3b,null))['then'](removeEntity(_0x164e3b,null))['catch'](handleError(_0x164e3b,null));};exports['addAllCondition']=function(_0x162025,_0x18e263,_0x172a10){if(_0x162025[_0xb38a('0x4b')]['id']){delete _0x162025[_0xb38a('0x4b')]['id'];}return db['Trigger'][_0xb38a('0x49')]({'where':{'id':_0x162025[_0xb38a('0x46')]['id']}})[_0xb38a('0x23')](handleEntityNotFound(_0x18e263,null))[_0xb38a('0x23')](function(_0x45db48){if(_0x45db48){_0x162025[_0xb38a('0x4b')][_0xb38a('0x52')]=_0x45db48['id'];return db[_0xb38a('0x53')][_0xb38a('0x4a')](_0x162025[_0xb38a('0x4b')]);}})['then'](respondWithResult(_0x18e263,null))[_0xb38a('0x44')](handleError(_0x18e263,null));};exports['addAnyCondition']=function(_0x3078f1,_0xf211c0,_0x28c7fd){if(_0x3078f1['body']['id']){delete _0x3078f1[_0xb38a('0x4b')]['id'];}return db[_0xb38a('0x2d')][_0xb38a('0x49')]({'where':{'id':_0x3078f1[_0xb38a('0x46')]['id']}})[_0xb38a('0x23')](handleEntityNotFound(_0xf211c0,null))[_0xb38a('0x23')](function(_0x53517a){if(_0x53517a){_0x3078f1[_0xb38a('0x4b')]['TriggerAnyId']=_0x53517a['id'];return db[_0xb38a('0x53')]['create'](_0x3078f1[_0xb38a('0x4b')]);}})['then'](respondWithResult(_0xf211c0,null))[_0xb38a('0x44')](handleError(_0xf211c0,null));};exports[_0xb38a('0x54')]=function(_0x5b14eb,_0x504bf2,_0x22ad00){var _0x5bbb32={};var _0x236a62={};var _0x18271c;var _0x428631;return db[_0xb38a('0x2d')][_0xb38a('0x55')]({'where':{'id':_0x5b14eb[_0xb38a('0x46')]['id']}})['then'](handleEntityNotFound(_0x504bf2,null))[_0xb38a('0x23')](function(_0x27077a){if(_0x27077a){_0x18271c=_0x27077a;_0x236a62[_0xb38a('0x31')]=_[_0xb38a('0x33')](db['Condition'][_0xb38a('0x47')]);_0x236a62['query']=_[_0xb38a('0x33')](_0x5b14eb[_0xb38a('0x32')]);_0x236a62[_0xb38a('0x34')]=_['intersection'](_0x236a62[_0xb38a('0x31')],_0x236a62[_0xb38a('0x32')]);_0x5bbb32[_0xb38a('0x35')]=_[_0xb38a('0x36')](_0x236a62['model'],qs[_0xb38a('0x37')](_0x5b14eb[_0xb38a('0x32')]['fields']));_0x5bbb32['attributes']=_0x5bbb32['attributes']['length']?_0x5bbb32[_0xb38a('0x35')]:_0x236a62[_0xb38a('0x31')];_0x5bbb32['order']=qs[_0xb38a('0x3b')](_0x5b14eb['query'][_0xb38a('0x3b')]);_0x5bbb32['where']=qs['filters'](_['pick'](_0x5b14eb[_0xb38a('0x32')],_0x236a62['filters']));if(_0x5b14eb[_0xb38a('0x32')][_0xb38a('0x3d')]){_0x5bbb32[_0xb38a('0x3e')]=_[_0xb38a('0x48')](_0x5bbb32[_0xb38a('0x3e')],{'$or':_[_0xb38a('0x2c')](_0x5bbb32['attributes'],function(_0x25aac9){var _0x6643af={};_0x6643af[_0x25aac9]={'$like':'%'+_0x5b14eb[_0xb38a('0x32')][_0xb38a('0x3d')]+'%'};return _0x6643af;})});}_0x5bbb32=_[_0xb38a('0x48')]({},_0x5bbb32,_0x5b14eb[_0xb38a('0x40')]);return _0x18271c[_0xb38a('0x54')](_0x5bbb32);}})[_0xb38a('0x23')](function(_0x294b9e){if(_0x294b9e){_0x428631=_0x294b9e[_0xb38a('0x38')];if(!_0x5b14eb[_0xb38a('0x32')][_0xb38a('0x39')]('nolimit')){_0x5bbb32[_0xb38a('0x1c')]=qs[_0xb38a('0x1c')](_0x5b14eb['query'][_0xb38a('0x1c')]);_0x5bbb32['offset']=qs['offset'](_0x5b14eb[_0xb38a('0x32')][_0xb38a('0x1e')]);}return _0x18271c[_0xb38a('0x54')](_0x5bbb32);}})['then'](function(_0x464faf){if(_0x464faf){return _0x464faf?{'count':_0x428631,'rows':_0x464faf}:null;}})['then'](respondWithResult(_0x504bf2,null))['catch'](handleError(_0x504bf2,null));};exports[_0xb38a('0x56')]=function(_0x44b4f9,_0x3df81f,_0x48bea6){var _0x3267b5={};var _0x26439d={};var _0x2b4fef;var _0x55500d;return db[_0xb38a('0x2d')][_0xb38a('0x55')]({'where':{'id':_0x44b4f9['params']['id']}})['then'](handleEntityNotFound(_0x3df81f,null))[_0xb38a('0x23')](function(_0x373528){if(_0x373528){_0x2b4fef=_0x373528;_0x26439d[_0xb38a('0x31')]=_[_0xb38a('0x33')](db[_0xb38a('0x53')][_0xb38a('0x47')]);_0x26439d[_0xb38a('0x32')]=_[_0xb38a('0x33')](_0x44b4f9[_0xb38a('0x32')]);_0x26439d['filters']=_[_0xb38a('0x36')](_0x26439d[_0xb38a('0x31')],_0x26439d[_0xb38a('0x32')]);_0x3267b5[_0xb38a('0x35')]=_[_0xb38a('0x36')](_0x26439d[_0xb38a('0x31')],qs['fields'](_0x44b4f9[_0xb38a('0x32')][_0xb38a('0x37')]));_0x3267b5[_0xb38a('0x35')]=_0x3267b5[_0xb38a('0x35')]['length']?_0x3267b5[_0xb38a('0x35')]:_0x26439d[_0xb38a('0x31')];_0x3267b5['order']=qs['sort'](_0x44b4f9[_0xb38a('0x32')]['sort']);_0x3267b5[_0xb38a('0x3e')]=qs[_0xb38a('0x34')](_[_0xb38a('0x3c')](_0x44b4f9[_0xb38a('0x32')],_0x26439d[_0xb38a('0x34')]));if(_0x44b4f9[_0xb38a('0x32')][_0xb38a('0x3d')]){_0x3267b5[_0xb38a('0x3e')]=_['merge'](_0x3267b5[_0xb38a('0x3e')],{'$or':_[_0xb38a('0x2c')](_0x3267b5['attributes'],function(_0x415434){var _0x4c8cd8={};_0x4c8cd8[_0x415434]={'$like':'%'+_0x44b4f9[_0xb38a('0x32')][_0xb38a('0x3d')]+'%'};return _0x4c8cd8;})});}_0x3267b5=_[_0xb38a('0x48')]({},_0x3267b5,_0x44b4f9[_0xb38a('0x40')]);return _0x2b4fef[_0xb38a('0x56')](_0x3267b5);}})[_0xb38a('0x23')](function(_0x5b4476){if(_0x5b4476){_0x55500d=_0x5b4476[_0xb38a('0x38')];if(!_0x44b4f9[_0xb38a('0x32')][_0xb38a('0x39')]('nolimit')){_0x3267b5[_0xb38a('0x1c')]=qs['limit'](_0x44b4f9[_0xb38a('0x32')][_0xb38a('0x1c')]);_0x3267b5[_0xb38a('0x1e')]=qs['offset'](_0x44b4f9[_0xb38a('0x32')]['offset']);}return _0x2b4fef[_0xb38a('0x56')](_0x3267b5);}})[_0xb38a('0x23')](function(_0x2bcf1f){if(_0x2bcf1f){return _0x2bcf1f?{'count':_0x55500d,'rows':_0x2bcf1f}:null;}})[_0xb38a('0x23')](respondWithResult(_0x3df81f,null))[_0xb38a('0x44')](handleError(_0x3df81f,null));};exports['addAction']=function(_0x18f04d,_0x2216e8,_0x15484a){if(_0x18f04d['body']['id']){delete _0x18f04d[_0xb38a('0x4b')]['id'];}return db[_0xb38a('0x2d')][_0xb38a('0x49')]({'where':{'id':_0x18f04d[_0xb38a('0x46')]['id']}})[_0xb38a('0x23')](handleEntityNotFound(_0x2216e8,null))[_0xb38a('0x23')](function(_0x2e1f5b){if(_0x2e1f5b){_0x18f04d[_0xb38a('0x4b')][_0xb38a('0x57')]=_0x2e1f5b['id'];return db['Action'][_0xb38a('0x4a')](_0x18f04d['body']);}})[_0xb38a('0x23')](respondWithResult(_0x2216e8,null))[_0xb38a('0x44')](handleError(_0x2216e8,null));};exports[_0xb38a('0x58')]=function(_0x510808,_0x4c60c6,_0x103b0a){var _0x42bc74={};var _0x303570={};var _0x1864cb;var _0x5ee143;return db['Trigger'][_0xb38a('0x55')]({'where':{'id':_0x510808[_0xb38a('0x46')]['id']}})[_0xb38a('0x23')](handleEntityNotFound(_0x4c60c6,null))[_0xb38a('0x23')](function(_0x17cda0){if(_0x17cda0){_0x1864cb=_0x17cda0;_0x303570[_0xb38a('0x31')]=_[_0xb38a('0x33')](db['Action'][_0xb38a('0x47')]);_0x303570[_0xb38a('0x32')]=_[_0xb38a('0x33')](_0x510808[_0xb38a('0x32')]);_0x303570[_0xb38a('0x34')]=_[_0xb38a('0x36')](_0x303570[_0xb38a('0x31')],_0x303570[_0xb38a('0x32')]);_0x42bc74['attributes']=_['intersection'](_0x303570[_0xb38a('0x31')],qs[_0xb38a('0x37')](_0x510808[_0xb38a('0x32')][_0xb38a('0x37')]));_0x42bc74[_0xb38a('0x35')]=_0x42bc74[_0xb38a('0x35')][_0xb38a('0x38')]?_0x42bc74[_0xb38a('0x35')]:_0x303570[_0xb38a('0x31')];_0x42bc74[_0xb38a('0x3a')]=qs[_0xb38a('0x3b')](_0x510808[_0xb38a('0x32')][_0xb38a('0x3b')]);_0x42bc74[_0xb38a('0x3e')]=qs[_0xb38a('0x34')](_[_0xb38a('0x3c')](_0x510808[_0xb38a('0x32')],_0x303570['filters']));if(_0x510808[_0xb38a('0x32')][_0xb38a('0x3d')]){_0x42bc74['where']=_['merge'](_0x42bc74['where'],{'$or':_[_0xb38a('0x2c')](_0x42bc74['attributes'],function(_0x224a69){var _0x5052d2={};_0x5052d2[_0x224a69]={'$like':'%'+_0x510808['query'][_0xb38a('0x3d')]+'%'};return _0x5052d2;})});}_0x42bc74=_['merge']({},_0x42bc74,_0x510808[_0xb38a('0x40')]);return _0x1864cb[_0xb38a('0x58')](_0x42bc74);}})['then'](function(_0x2688b9){if(_0x2688b9){_0x5ee143=_0x2688b9['length'];if(!_0x510808[_0xb38a('0x32')][_0xb38a('0x39')](_0xb38a('0x59'))){_0x42bc74[_0xb38a('0x1c')]=qs[_0xb38a('0x1c')](_0x510808[_0xb38a('0x32')][_0xb38a('0x1c')]);_0x42bc74[_0xb38a('0x1e')]=qs[_0xb38a('0x1e')](_0x510808[_0xb38a('0x32')][_0xb38a('0x1e')]);}return _0x1864cb[_0xb38a('0x58')](_0x42bc74);}})['then'](function(_0x19b3fa){if(_0x19b3fa){return _0x19b3fa?{'count':_0x5ee143,'rows':_0x19b3fa}:null;}})[_0xb38a('0x23')](respondWithResult(_0x4c60c6,null))[_0xb38a('0x44')](handleError(_0x4c60c6,null));}; \ No newline at end of file +var _0x8902=['show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','getAnyConditions','addAction','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x8902,0x1de));var _0x2890=function(_0x3552a2,_0x3fe749){_0x3552a2=_0x3552a2-0x0;var _0x21ce29=_0x8902[_0x3552a2];return _0x21ce29;};'use strict';var emlformat=require(_0x2890('0x0'));var rimraf=require(_0x2890('0x1'));var zipdir=require(_0x2890('0x2'));var jsonpatch=require(_0x2890('0x3'));var rp=require(_0x2890('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2890('0x5'));var util=require(_0x2890('0x6'));var path=require('path');var sox=require(_0x2890('0x7'));var csv=require('to-csv');var ejs=require(_0x2890('0x8'));var fs=require('fs');var fs_extra=require(_0x2890('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2890('0xa'));var jsforce=require(_0x2890('0xb'));var deskjs=require(_0x2890('0xc'));var toCsv=require(_0x2890('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2890('0xe'));var authService=require(_0x2890('0xf'));var qs=require(_0x2890('0x10'));var as=require(_0x2890('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2890('0x12'))(_0x2890('0x13'));var utils=require(_0x2890('0x14'));var config=require(_0x2890('0x15'));var licenseUtil=require(_0x2890('0x16'));var db=require(_0x2890('0x17'))['db'];function respondWithStatusCode(_0x5c4467,_0x4e62ec){_0x4e62ec=_0x4e62ec||0xcc;return function(_0x56e74d){if(_0x56e74d){return _0x5c4467['sendStatus'](_0x4e62ec);}return _0x5c4467[_0x2890('0x18')](_0x4e62ec)[_0x2890('0x19')]();};}function respondWithResult(_0x469ad0,_0x39eba6){_0x39eba6=_0x39eba6||0xc8;return function(_0x5e9ca5){if(_0x5e9ca5){return _0x469ad0[_0x2890('0x18')](_0x39eba6)['json'](_0x5e9ca5);}};}function respondWithFilteredResult(_0x578d94,_0x593345){return function(_0x244062){if(_0x244062){var _0x34793e=typeof _0x593345[_0x2890('0x1a')]===_0x2890('0x1b')&&typeof _0x593345[_0x2890('0x1c')]==='undefined';var _0x1f9995=_0x244062[_0x2890('0x1d')];var _0x5e1a48=_0x34793e?0x0:_0x593345[_0x2890('0x1a')];var _0x29eb7e=_0x34793e?_0x244062[_0x2890('0x1d')]:_0x593345[_0x2890('0x1a')]+_0x593345[_0x2890('0x1c')];var _0xa66396;if(_0x29eb7e>=_0x1f9995){_0x29eb7e=_0x1f9995;_0xa66396=0xc8;}else{_0xa66396=0xce;}_0x578d94[_0x2890('0x18')](_0xa66396);return _0x578d94['set']('Content-Range',_0x5e1a48+'-'+_0x29eb7e+'/'+_0x1f9995)[_0x2890('0x1e')](_0x244062);}return null;};}function patchUpdates(_0x444add){return function(_0x1684f1){try{jsonpatch['apply'](_0x1684f1,_0x444add,!![]);}catch(_0x5f4fe2){return BPromise[_0x2890('0x1f')](_0x5f4fe2);}return _0x1684f1[_0x2890('0x20')]();};}function saveUpdates(_0x2a839e,_0x31ae19){return function(_0x5451f9){if(_0x5451f9){return _0x5451f9['update'](_0x2a839e)[_0x2890('0x21')](function(_0x2e8fdc){return _0x2e8fdc;});}return null;};}function removeEntity(_0x56c3f2,_0x3ff89e){return function(_0x1d5f08){if(_0x1d5f08){return _0x1d5f08[_0x2890('0x22')]()[_0x2890('0x21')](function(){var _0x2b6b7a=_0x1d5f08[_0x2890('0x23')]({'plain':!![]});var _0x2a5234=_0x2890('0x24');return db[_0x2890('0x25')]['destroy']({'where':{'type':_0x2a5234,'resourceId':_0x2b6b7a['id']}})['then'](function(){return _0x1d5f08;});})[_0x2890('0x21')](function(){_0x56c3f2[_0x2890('0x18')](0xcc)[_0x2890('0x19')]();});}};}function handleEntityNotFound(_0x264f5e,_0x509622){return function(_0xbebb16){if(!_0xbebb16){_0x264f5e['sendStatus'](0x194);}return _0xbebb16;};}function handleError(_0x1ca749,_0x4adc16){_0x4adc16=_0x4adc16||0x1f4;return function(_0x4a6b53){logger[_0x2890('0x26')](_0x4a6b53[_0x2890('0x27')]);if(_0x4a6b53[_0x2890('0x28')]){delete _0x4a6b53[_0x2890('0x28')];}_0x1ca749['status'](_0x4adc16)[_0x2890('0x29')](_0x4a6b53);};}exports[_0x2890('0x2a')]=function(_0x2a51b1,_0x33a35d){var _0x103a4c={},_0x5bac99={},_0x3e1455={'count':0x0,'rows':[]};var _0x37465b=_[_0x2890('0x2b')](db[_0x2890('0x2c')]['rawAttributes'],function(_0x5ccb23){return{'name':_0x5ccb23[_0x2890('0x2d')],'type':_0x5ccb23[_0x2890('0x2e')][_0x2890('0x2f')]};});_0x5bac99[_0x2890('0x30')]=_[_0x2890('0x2b')](_0x37465b,'name');_0x5bac99[_0x2890('0x31')]=_[_0x2890('0x32')](_0x2a51b1['query']);_0x5bac99[_0x2890('0x33')]=_[_0x2890('0x34')](_0x5bac99[_0x2890('0x30')],_0x5bac99[_0x2890('0x31')]);_0x103a4c[_0x2890('0x35')]=_[_0x2890('0x34')](_0x5bac99[_0x2890('0x30')],qs[_0x2890('0x36')](_0x2a51b1[_0x2890('0x31')]['fields']));_0x103a4c['attributes']=_0x103a4c[_0x2890('0x35')]['length']?_0x103a4c[_0x2890('0x35')]:_0x5bac99['model'];if(!_0x2a51b1[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x103a4c['limit']=qs[_0x2890('0x1c')](_0x2a51b1[_0x2890('0x31')][_0x2890('0x1c')]);_0x103a4c[_0x2890('0x1a')]=qs['offset'](_0x2a51b1[_0x2890('0x31')][_0x2890('0x1a')]);}_0x103a4c[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x2a51b1['query'][_0x2890('0x3a')]);_0x103a4c[_0x2890('0x3b')]=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x2a51b1[_0x2890('0x31')],_0x5bac99[_0x2890('0x33')]),_0x37465b);if(_0x2a51b1[_0x2890('0x31')]['filter']){_0x103a4c[_0x2890('0x3b')]=_['merge'](_0x103a4c[_0x2890('0x3b')],{'$or':_['map'](_0x37465b,function(_0x350c39){if(_0x350c39[_0x2890('0x2e')]!==_0x2890('0x3d')){var _0x56d016={};_0x56d016[_0x350c39[_0x2890('0x28')]]={'$like':'%'+_0x2a51b1['query']['filter']+'%'};return _0x56d016;}})});}_0x103a4c=_[_0x2890('0x3e')]({},_0x103a4c,_0x2a51b1[_0x2890('0x3f')]);var _0x43ead6={'where':_0x103a4c['where']};return db['Trigger'][_0x2890('0x1d')](_0x43ead6)[_0x2890('0x21')](function(_0x3e5433){_0x3e1455[_0x2890('0x1d')]=_0x3e5433;if(_0x2a51b1[_0x2890('0x31')][_0x2890('0x40')]){_0x103a4c[_0x2890('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x2890('0x42')](_0x103a4c);})[_0x2890('0x21')](function(_0x5af786){_0x3e1455['rows']=_0x5af786;return _0x3e1455;})[_0x2890('0x21')](respondWithFilteredResult(_0x33a35d,_0x103a4c))[_0x2890('0x43')](handleError(_0x33a35d,null));};exports[_0x2890('0x44')]=function(_0x3209d9,_0x1c4a68){var _0x565365={'raw':![],'where':{'id':_0x3209d9[_0x2890('0x45')]['id']}},_0xdb7799={};_0xdb7799['model']=_[_0x2890('0x32')](db[_0x2890('0x2c')][_0x2890('0x46')]);_0xdb7799[_0x2890('0x31')]=_['keys'](_0x3209d9[_0x2890('0x31')]);_0xdb7799[_0x2890('0x33')]=_[_0x2890('0x34')](_0xdb7799[_0x2890('0x30')],_0xdb7799[_0x2890('0x31')]);_0x565365[_0x2890('0x35')]=_[_0x2890('0x34')](_0xdb7799[_0x2890('0x30')],qs[_0x2890('0x36')](_0x3209d9[_0x2890('0x31')][_0x2890('0x36')]));_0x565365[_0x2890('0x35')]=_0x565365[_0x2890('0x35')][_0x2890('0x47')]?_0x565365[_0x2890('0x35')]:_0xdb7799[_0x2890('0x30')];if(_0x3209d9['query'][_0x2890('0x40')]){_0x565365[_0x2890('0x41')]=[{'all':!![]}];}_0x565365=_['merge']({},_0x565365,_0x3209d9[_0x2890('0x3f')]);return db[_0x2890('0x2c')][_0x2890('0x48')](_0x565365)[_0x2890('0x21')](handleEntityNotFound(_0x1c4a68,null))['then'](respondWithResult(_0x1c4a68,null))[_0x2890('0x43')](handleError(_0x1c4a68,null));};exports[_0x2890('0x49')]=function(_0x441292,_0x540f02){return db[_0x2890('0x2c')]['create'](_0x441292[_0x2890('0x4a')],{})[_0x2890('0x21')](function(_0xd0b47a){var _0x2b89c8=_0x441292[_0x2890('0x4b')][_0x2890('0x23')]({'plain':!![]});if(!_0x2b89c8)throw new Error(_0x2890('0x4c'));if(_0x2b89c8['role']===_0x2890('0x4b')){var _0x59e8f4=_0xd0b47a[_0x2890('0x23')]({'plain':!![]});var _0x499187=_0x2890('0x24');return db['UserProfileSection'][_0x2890('0x48')]({'where':{'name':_0x499187,'userProfileId':_0x2b89c8[_0x2890('0x4d')]},'raw':!![]})[_0x2890('0x21')](function(_0x5dc8d7){if(_0x5dc8d7&&_0x5dc8d7[_0x2890('0x4e')]===0x0){return db[_0x2890('0x25')][_0x2890('0x49')]({'name':_0x59e8f4[_0x2890('0x28')],'resourceId':_0x59e8f4['id'],'type':_0x5dc8d7[_0x2890('0x28')],'sectionId':_0x5dc8d7['id']},{})[_0x2890('0x21')](function(){return _0xd0b47a;});}else{return _0xd0b47a;}})[_0x2890('0x43')](function(_0x209076){logger[_0x2890('0x26')](_0x2890('0x4f'),_0x209076);throw _0x209076;});}return _0xd0b47a;})[_0x2890('0x21')](respondWithResult(_0x540f02,0xc9))[_0x2890('0x43')](handleError(_0x540f02,null));};exports[_0x2890('0x50')]=function(_0x2599ea,_0x1b2250){if(_0x2599ea['body']['id']){delete _0x2599ea[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x2599ea[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x1b2250,null))[_0x2890('0x21')](saveUpdates(_0x2599ea['body'],null))['then'](respondWithResult(_0x1b2250,null))[_0x2890('0x43')](handleError(_0x1b2250,null));};exports[_0x2890('0x22')]=function(_0x31b696,_0xd9fd43){return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x31b696[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0xd9fd43,null))[_0x2890('0x21')](removeEntity(_0xd9fd43,null))[_0x2890('0x43')](handleError(_0xd9fd43,null));};exports[_0x2890('0x51')]=function(_0x5eebd2,_0x26136f,_0x537085){if(_0x5eebd2['body']['id']){delete _0x5eebd2[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')]['find']({'where':{'id':_0x5eebd2['params']['id']}})['then'](handleEntityNotFound(_0x26136f,null))[_0x2890('0x21')](function(_0xb1a58c){if(_0xb1a58c){_0x5eebd2[_0x2890('0x4a')][_0x2890('0x52')]=_0xb1a58c['id'];return db[_0x2890('0x53')][_0x2890('0x49')](_0x5eebd2[_0x2890('0x4a')]);}})[_0x2890('0x21')](respondWithResult(_0x26136f,null))[_0x2890('0x43')](handleError(_0x26136f,null));};exports[_0x2890('0x54')]=function(_0x35f43e,_0x2540e3,_0x2dc99e){if(_0x35f43e[_0x2890('0x4a')]['id']){delete _0x35f43e['body']['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x35f43e[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x2540e3,null))[_0x2890('0x21')](function(_0x37a16a){if(_0x37a16a){_0x35f43e[_0x2890('0x4a')]['TriggerAnyId']=_0x37a16a['id'];return db['Condition']['create'](_0x35f43e[_0x2890('0x4a')]);}})['then'](respondWithResult(_0x2540e3,null))[_0x2890('0x43')](handleError(_0x2540e3,null));};exports[_0x2890('0x55')]=function(_0x50eb6d,_0x53f1c4,_0x3866c7){var _0x2feb92={};var _0x15b756={};var _0x612b49;var _0x5a544a;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x50eb6d[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x53f1c4,null))[_0x2890('0x21')](function(_0x17c8df){if(_0x17c8df){_0x612b49=_0x17c8df;_0x15b756[_0x2890('0x30')]=_[_0x2890('0x32')](db[_0x2890('0x53')][_0x2890('0x46')]);_0x15b756[_0x2890('0x31')]=_[_0x2890('0x32')](_0x50eb6d[_0x2890('0x31')]);_0x15b756['filters']=_[_0x2890('0x34')](_0x15b756[_0x2890('0x30')],_0x15b756[_0x2890('0x31')]);_0x2feb92[_0x2890('0x35')]=_['intersection'](_0x15b756[_0x2890('0x30')],qs[_0x2890('0x36')](_0x50eb6d[_0x2890('0x31')][_0x2890('0x36')]));_0x2feb92[_0x2890('0x35')]=_0x2feb92[_0x2890('0x35')]['length']?_0x2feb92[_0x2890('0x35')]:_0x15b756[_0x2890('0x30')];_0x2feb92[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x50eb6d['query'][_0x2890('0x3a')]);_0x2feb92[_0x2890('0x3b')]=qs['filters'](_['pick'](_0x50eb6d['query'],_0x15b756[_0x2890('0x33')]));if(_0x50eb6d[_0x2890('0x31')][_0x2890('0x57')]){_0x2feb92[_0x2890('0x3b')]=_['merge'](_0x2feb92[_0x2890('0x3b')],{'$or':_[_0x2890('0x2b')](_0x2feb92[_0x2890('0x35')],function(_0x413700){var _0x47673f={};_0x47673f[_0x413700]={'$like':'%'+_0x50eb6d['query'][_0x2890('0x57')]+'%'};return _0x47673f;})});}_0x2feb92=_[_0x2890('0x3e')]({},_0x2feb92,_0x50eb6d['options']);return _0x612b49[_0x2890('0x55')](_0x2feb92);}})[_0x2890('0x21')](function(_0x34853a){if(_0x34853a){_0x5a544a=_0x34853a[_0x2890('0x47')];if(!_0x50eb6d[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x2feb92[_0x2890('0x1c')]=qs[_0x2890('0x1c')](_0x50eb6d['query'][_0x2890('0x1c')]);_0x2feb92['offset']=qs[_0x2890('0x1a')](_0x50eb6d['query']['offset']);}return _0x612b49[_0x2890('0x55')](_0x2feb92);}})['then'](function(_0xd1a222){if(_0xd1a222){return _0xd1a222?{'count':_0x5a544a,'rows':_0xd1a222}:null;}})[_0x2890('0x21')](respondWithResult(_0x53f1c4,null))['catch'](handleError(_0x53f1c4,null));};exports[_0x2890('0x58')]=function(_0x43cc51,_0x3ab1c0,_0x21c6ef){var _0x5c734b={};var _0x1a856b={};var _0x501a60;var _0x7961ab;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x43cc51[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x3ab1c0,null))[_0x2890('0x21')](function(_0x5427d5){if(_0x5427d5){_0x501a60=_0x5427d5;_0x1a856b[_0x2890('0x30')]=_[_0x2890('0x32')](db[_0x2890('0x53')][_0x2890('0x46')]);_0x1a856b['query']=_[_0x2890('0x32')](_0x43cc51[_0x2890('0x31')]);_0x1a856b[_0x2890('0x33')]=_[_0x2890('0x34')](_0x1a856b[_0x2890('0x30')],_0x1a856b['query']);_0x5c734b[_0x2890('0x35')]=_['intersection'](_0x1a856b[_0x2890('0x30')],qs[_0x2890('0x36')](_0x43cc51[_0x2890('0x31')][_0x2890('0x36')]));_0x5c734b[_0x2890('0x35')]=_0x5c734b[_0x2890('0x35')][_0x2890('0x47')]?_0x5c734b[_0x2890('0x35')]:_0x1a856b[_0x2890('0x30')];_0x5c734b[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x43cc51[_0x2890('0x31')][_0x2890('0x3a')]);_0x5c734b[_0x2890('0x3b')]=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x43cc51[_0x2890('0x31')],_0x1a856b[_0x2890('0x33')]));if(_0x43cc51[_0x2890('0x31')][_0x2890('0x57')]){_0x5c734b[_0x2890('0x3b')]=_[_0x2890('0x3e')](_0x5c734b[_0x2890('0x3b')],{'$or':_['map'](_0x5c734b[_0x2890('0x35')],function(_0x5acd0b){var _0x4f644a={};_0x4f644a[_0x5acd0b]={'$like':'%'+_0x43cc51[_0x2890('0x31')][_0x2890('0x57')]+'%'};return _0x4f644a;})});}_0x5c734b=_[_0x2890('0x3e')]({},_0x5c734b,_0x43cc51[_0x2890('0x3f')]);return _0x501a60[_0x2890('0x58')](_0x5c734b);}})[_0x2890('0x21')](function(_0x1b829c){if(_0x1b829c){_0x7961ab=_0x1b829c[_0x2890('0x47')];if(!_0x43cc51[_0x2890('0x31')][_0x2890('0x37')](_0x2890('0x38'))){_0x5c734b[_0x2890('0x1c')]=qs[_0x2890('0x1c')](_0x43cc51[_0x2890('0x31')][_0x2890('0x1c')]);_0x5c734b['offset']=qs[_0x2890('0x1a')](_0x43cc51['query']['offset']);}return _0x501a60[_0x2890('0x58')](_0x5c734b);}})[_0x2890('0x21')](function(_0x30e248){if(_0x30e248){return _0x30e248?{'count':_0x7961ab,'rows':_0x30e248}:null;}})['then'](respondWithResult(_0x3ab1c0,null))[_0x2890('0x43')](handleError(_0x3ab1c0,null));};exports[_0x2890('0x59')]=function(_0x1deb3a,_0x2da514,_0x452468){if(_0x1deb3a[_0x2890('0x4a')]['id']){delete _0x1deb3a[_0x2890('0x4a')]['id'];}return db[_0x2890('0x2c')][_0x2890('0x48')]({'where':{'id':_0x1deb3a['params']['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x2da514,null))[_0x2890('0x21')](function(_0x1bba60){if(_0x1bba60){_0x1deb3a['body']['TriggerId']=_0x1bba60['id'];return db[_0x2890('0x5a')][_0x2890('0x49')](_0x1deb3a[_0x2890('0x4a')]);}})[_0x2890('0x21')](respondWithResult(_0x2da514,null))[_0x2890('0x43')](handleError(_0x2da514,null));};exports['getActions']=function(_0x2d4779,_0x16477d,_0x570aea){var _0x1c6302={};var _0x1f6398={};var _0x291608;var _0x2ea0b1;return db[_0x2890('0x2c')][_0x2890('0x56')]({'where':{'id':_0x2d4779[_0x2890('0x45')]['id']}})[_0x2890('0x21')](handleEntityNotFound(_0x16477d,null))[_0x2890('0x21')](function(_0x7ce9aa){if(_0x7ce9aa){_0x291608=_0x7ce9aa;_0x1f6398[_0x2890('0x30')]=_['keys'](db[_0x2890('0x5a')][_0x2890('0x46')]);_0x1f6398[_0x2890('0x31')]=_[_0x2890('0x32')](_0x2d4779['query']);_0x1f6398[_0x2890('0x33')]=_['intersection'](_0x1f6398['model'],_0x1f6398[_0x2890('0x31')]);_0x1c6302['attributes']=_[_0x2890('0x34')](_0x1f6398['model'],qs[_0x2890('0x36')](_0x2d4779[_0x2890('0x31')]['fields']));_0x1c6302['attributes']=_0x1c6302[_0x2890('0x35')][_0x2890('0x47')]?_0x1c6302[_0x2890('0x35')]:_0x1f6398[_0x2890('0x30')];_0x1c6302[_0x2890('0x39')]=qs[_0x2890('0x3a')](_0x2d4779['query'][_0x2890('0x3a')]);_0x1c6302['where']=qs[_0x2890('0x33')](_[_0x2890('0x3c')](_0x2d4779[_0x2890('0x31')],_0x1f6398[_0x2890('0x33')]));if(_0x2d4779[_0x2890('0x31')][_0x2890('0x57')]){_0x1c6302[_0x2890('0x3b')]=_[_0x2890('0x3e')](_0x1c6302[_0x2890('0x3b')],{'$or':_['map'](_0x1c6302[_0x2890('0x35')],function(_0x42053c){var _0x5ae172={};_0x5ae172[_0x42053c]={'$like':'%'+_0x2d4779[_0x2890('0x31')][_0x2890('0x57')]+'%'};return _0x5ae172;})});}_0x1c6302=_['merge']({},_0x1c6302,_0x2d4779[_0x2890('0x3f')]);return _0x291608['getActions'](_0x1c6302);}})['then'](function(_0x18bc35){if(_0x18bc35){_0x2ea0b1=_0x18bc35[_0x2890('0x47')];if(!_0x2d4779['query'][_0x2890('0x37')]('nolimit')){_0x1c6302[_0x2890('0x1c')]=qs['limit'](_0x2d4779[_0x2890('0x31')][_0x2890('0x1c')]);_0x1c6302['offset']=qs['offset'](_0x2d4779[_0x2890('0x31')]['offset']);}return _0x291608['getActions'](_0x1c6302);}})[_0x2890('0x21')](function(_0x59a07a){if(_0x59a07a){return _0x59a07a?{'count':_0x2ea0b1,'rows':_0x59a07a}:null;}})[_0x2890('0x21')](respondWithResult(_0x16477d,null))[_0x2890('0x43')](handleError(_0x16477d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0fa7b54..376069a 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 _0x47d6=['../../config/logger','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util'];(function(_0x114d21,_0x3520de){var _0x1be5b1=function(_0x5e142b){while(--_0x5e142b){_0x114d21['push'](_0x114d21['shift']());}};_0x1be5b1(++_0x3520de);}(_0x47d6,0x1de));var _0x647d=function(_0x21f970,_0x429ec7){_0x21f970=_0x21f970-0x0;var _0x52fb5c=_0x47d6[_0x21f970];return _0x52fb5c;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x647d('0x3'));var rp=require(_0x647d('0x4'));var fs=require('fs');var path=require(_0x647d('0x5'));var rimraf=require('rimraf');var config=require(_0x647d('0x6'));var attributes=require(_0x647d('0x7'));module[_0x647d('0x8')]=function(_0x4e18a7,_0x13797c){return _0x4e18a7[_0x647d('0x9')](_0x647d('0xa'),attributes,{'tableName':_0x647d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2c=['path','rimraf','../../config/environment','exports','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2829c0,_0x23823c){var _0x4a9ff6=function(_0x348974){while(--_0x348974){_0x2829c0['push'](_0x2829c0['shift']());}};_0x4a9ff6(++_0x23823c);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x14e119,_0x464ffc){_0x14e119=_0x14e119-0x0;var _0x2e5775=_0x7a2c[_0x14e119];return _0x2e5775;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./trigger.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Trigger',attributes,{'tableName':_0xc7a2('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 341cd4c..1921bf0 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 _0xe033=['GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x55bf87,_0x43ad5f){var _0x4aff7a=function(_0x4d5439){while(--_0x4d5439){_0x55bf87['push'](_0x55bf87['shift']());}};_0x4aff7a(++_0x43ad5f);}(_0xe033,0x161));var _0x3e03=function(_0x1b8a37,_0x103ec6){_0x1b8a37=_0x1b8a37-0x0;var _0x27afe6=_0xe033[_0x1b8a37];return _0x27afe6;};'use strict';var _=require(_0x3e03('0x0'));var util=require(_0x3e03('0x1'));var moment=require(_0x3e03('0x2'));var BPromise=require(_0x3e03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e03('0x5'));var logger=require(_0x3e03('0x6'))('rpc');var config=require(_0x3e03('0x7'));var jayson=require(_0x3e03('0x8'));var client=jayson[_0x3e03('0x9')][_0x3e03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf9e652,_0x157bb1,_0x33db85){return new BPromise(function(_0x47b502,_0x4e6d6e){return client[_0x3e03('0xb')](_0xf9e652,_0x33db85)[_0x3e03('0xc')](function(_0x17eb1a){logger[_0x3e03('0xd')](_0x3e03('0xe'),_0x157bb1,_0x3e03('0xf'));logger[_0x3e03('0x10')](_0x3e03('0x11'),_0x157bb1,_0x3e03('0xf'),JSON['stringify'](_0x17eb1a));if(_0x17eb1a[_0x3e03('0x12')]){if(_0x17eb1a[_0x3e03('0x12')]['code']===0x1f4){logger[_0x3e03('0x12')](_0x3e03('0xe'),_0x157bb1,_0x17eb1a[_0x3e03('0x12')][_0x3e03('0x13')]);return _0x4e6d6e(_0x17eb1a[_0x3e03('0x12')][_0x3e03('0x13')]);}logger[_0x3e03('0x12')](_0x3e03('0xe'),_0x157bb1,_0x17eb1a[_0x3e03('0x12')][_0x3e03('0x13')]);return _0x47b502(_0x17eb1a[_0x3e03('0x12')]['message']);}else{logger[_0x3e03('0xd')](_0x3e03('0xe'),_0x157bb1,_0x3e03('0xf'));_0x47b502(_0x17eb1a[_0x3e03('0x14')]['message']);}})['catch'](function(_0x22a22d){logger[_0x3e03('0x12')](_0x3e03('0xe'),_0x157bb1,_0x22a22d);_0x4e6d6e(_0x22a22d);});});}exports[_0x3e03('0x15')]=function(_0x34f4c5){var _0x36e9d7=this;return new Promise(function(_0x2a9b0e,_0x487dcd){return db[_0x3e03('0x16')]['findAll']({'raw':_0x34f4c5['options']?_0x34f4c5[_0x3e03('0x17')][_0x3e03('0x18')]===undefined?!![]:![]:!![],'where':_0x34f4c5[_0x3e03('0x17')]?_0x34f4c5[_0x3e03('0x17')][_0x3e03('0x19')]||null:null,'attributes':_0x34f4c5[_0x3e03('0x17')]?_0x34f4c5['options'][_0x3e03('0x1a')]||null:null,'limit':_0x34f4c5[_0x3e03('0x17')]?_0x34f4c5[_0x3e03('0x17')][_0x3e03('0x1b')]||null:null,'include':_0x34f4c5['options']?_0x34f4c5['options'][_0x3e03('0x1c')]?_[_0x3e03('0x1d')](_0x34f4c5[_0x3e03('0x17')][_0x3e03('0x1c')],function(_0x46ed59){return{'model':db[_0x46ed59[_0x3e03('0x1e')]],'as':_0x46ed59['as'],'attributes':_0x46ed59['attributes'],'include':_0x46ed59[_0x3e03('0x1c')]?_[_0x3e03('0x1d')](_0x46ed59[_0x3e03('0x1c')],function(_0x5a6902){return{'model':db[_0x5a6902[_0x3e03('0x1e')]],'as':_0x5a6902['as'],'attributes':_0x5a6902[_0x3e03('0x1a')],'include':_0x5a6902[_0x3e03('0x1c')]?_[_0x3e03('0x1d')](_0x5a6902['include'],function(_0x6af631){return{'model':db[_0x6af631['model']],'as':_0x6af631['as'],'attributes':_0x6af631[_0x3e03('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e03('0xc')](function(_0xda8cd2){logger[_0x3e03('0xd')](_0x3e03('0x15'),_0x34f4c5);logger['debug'](_0x3e03('0x15'),_0x34f4c5,JSON['stringify'](_0xda8cd2));_0x2a9b0e(_0xda8cd2);})[_0x3e03('0x1f')](function(_0x297bd4){logger['error']('GetTrigger',_0x297bd4[_0x3e03('0x13')],_0x34f4c5);_0x487dcd(_0x36e9d7[_0x3e03('0x12')](0x1f4,_0x297bd4[_0x3e03('0x13')]));});});};exports['ShowTrigger']=function(_0x4b17ae){var _0x336439=this;return new Promise(function(_0x575833,_0x466e81){return db['Trigger']['find']({'raw':_0x4b17ae[_0x3e03('0x17')]?_0x4b17ae[_0x3e03('0x17')][_0x3e03('0x18')]===undefined?!![]:![]:!![],'where':_0x4b17ae[_0x3e03('0x17')]?_0x4b17ae[_0x3e03('0x17')]['where']||null:null,'attributes':_0x4b17ae['options']?_0x4b17ae[_0x3e03('0x17')][_0x3e03('0x1a')]||null:null,'include':_0x4b17ae[_0x3e03('0x17')]?_0x4b17ae['options'][_0x3e03('0x1c')]?_[_0x3e03('0x1d')](_0x4b17ae['options'][_0x3e03('0x1c')],function(_0x4eb729){return{'model':db[_0x4eb729[_0x3e03('0x1e')]],'as':_0x4eb729['as'],'attributes':_0x4eb729[_0x3e03('0x1a')],'include':_0x4eb729[_0x3e03('0x1c')]?_[_0x3e03('0x1d')](_0x4eb729['include'],function(_0x5b784e){return{'model':db[_0x5b784e[_0x3e03('0x1e')]],'as':_0x5b784e['as'],'attributes':_0x5b784e[_0x3e03('0x1a')],'include':_0x5b784e[_0x3e03('0x1c')]?_['map'](_0x5b784e[_0x3e03('0x1c')],function(_0x4130a2){return{'model':db[_0x4130a2[_0x3e03('0x1e')]],'as':_0x4130a2['as'],'attributes':_0x4130a2[_0x3e03('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e03('0xc')](function(_0xcb16e8){logger[_0x3e03('0xd')](_0x3e03('0x20'),_0x4b17ae);logger[_0x3e03('0x10')](_0x3e03('0x20'),_0x4b17ae,JSON[_0x3e03('0x21')](_0xcb16e8));_0x575833(_0xcb16e8);})[_0x3e03('0x1f')](function(_0x5ac964){logger[_0x3e03('0x12')](_0x3e03('0x20'),_0x5ac964[_0x3e03('0x13')],_0x4b17ae);_0x466e81(_0x336439[_0x3e03('0x12')](0x1f4,_0x5ac964[_0x3e03('0x13')]));});});}; \ No newline at end of file +var _0x3926=['stringify','error','code','message','result','catch','GetTrigger','options','raw','where','attributes','include','map','model','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x3926,0xe3));var _0x6392=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x3926[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x6392('0x0'));var util=require('util');var moment=require(_0x6392('0x1'));var BPromise=require(_0x6392('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6392('0x3'));var db=require(_0x6392('0x4'))['db'];var utils=require(_0x6392('0x5'));var logger=require(_0x6392('0x6'))(_0x6392('0x7'));var config=require(_0x6392('0x8'));var jayson=require(_0x6392('0x9'));var client=jayson[_0x6392('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482397,_0x2f947a,_0x26af1d){return new BPromise(function(_0x472252,_0x471bae){return client[_0x6392('0xb')](_0x482397,_0x26af1d)[_0x6392('0xc')](function(_0x2edcef){logger[_0x6392('0xd')](_0x6392('0xe'),_0x2f947a,'request\x20sent');logger[_0x6392('0xf')](_0x6392('0x10'),_0x2f947a,_0x6392('0x11'),JSON[_0x6392('0x12')](_0x2edcef));if(_0x2edcef[_0x6392('0x13')]){if(_0x2edcef[_0x6392('0x13')][_0x6392('0x14')]===0x1f4){logger[_0x6392('0x13')](_0x6392('0xe'),_0x2f947a,_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);return _0x471bae(_0x2edcef[_0x6392('0x13')]['message']);}logger[_0x6392('0x13')](_0x6392('0xe'),_0x2f947a,_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);return _0x472252(_0x2edcef[_0x6392('0x13')][_0x6392('0x15')]);}else{logger[_0x6392('0xd')](_0x6392('0xe'),_0x2f947a,_0x6392('0x11'));_0x472252(_0x2edcef[_0x6392('0x16')][_0x6392('0x15')]);}})[_0x6392('0x17')](function(_0x5693ac){logger['error']('Trigger,\x20%s,\x20%s',_0x2f947a,_0x5693ac);_0x471bae(_0x5693ac);});});}exports[_0x6392('0x18')]=function(_0x22cfba){var _0x4b0121=this;return new Promise(function(_0xfd827a,_0x38db68){return db['Trigger']['findAll']({'raw':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1a')]===undefined?!![]:![]:!![],'where':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1b')]||null:null,'attributes':_0x22cfba['options']?_0x22cfba[_0x6392('0x19')][_0x6392('0x1c')]||null:null,'limit':_0x22cfba[_0x6392('0x19')]?_0x22cfba['options']['limit']||null:null,'include':_0x22cfba[_0x6392('0x19')]?_0x22cfba[_0x6392('0x19')][_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x22cfba[_0x6392('0x19')]['include'],function(_0xe3df92){return{'model':db[_0xe3df92[_0x6392('0x1f')]],'as':_0xe3df92['as'],'attributes':_0xe3df92[_0x6392('0x1c')],'include':_0xe3df92[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0xe3df92['include'],function(_0x58160b){return{'model':db[_0x58160b['model']],'as':_0x58160b['as'],'attributes':_0x58160b['attributes'],'include':_0x58160b[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x58160b['include'],function(_0x22c2e3){return{'model':db[_0x22c2e3[_0x6392('0x1f')]],'as':_0x22c2e3['as'],'attributes':_0x22c2e3[_0x6392('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6392('0xc')](function(_0x158db3){logger[_0x6392('0xd')]('GetTrigger',_0x22cfba);logger[_0x6392('0xf')](_0x6392('0x18'),_0x22cfba,JSON[_0x6392('0x12')](_0x158db3));_0xfd827a(_0x158db3);})[_0x6392('0x17')](function(_0x1ce6bb){logger['error'](_0x6392('0x18'),_0x1ce6bb[_0x6392('0x15')],_0x22cfba);_0x38db68(_0x4b0121[_0x6392('0x13')](0x1f4,_0x1ce6bb[_0x6392('0x15')]));});});};exports[_0x6392('0x20')]=function(_0x46fc4d){var _0xa56b3c=this;return new Promise(function(_0x5bbbdb,_0x5b1e15){return db[_0x6392('0x21')][_0x6392('0x22')]({'raw':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d[_0x6392('0x19')][_0x6392('0x1a')]===undefined?!![]:![]:!![],'where':_0x46fc4d['options']?_0x46fc4d[_0x6392('0x19')][_0x6392('0x1b')]||null:null,'attributes':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d['options'][_0x6392('0x1c')]||null:null,'include':_0x46fc4d[_0x6392('0x19')]?_0x46fc4d['options'][_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x46fc4d[_0x6392('0x19')][_0x6392('0x1d')],function(_0x3adfb3){return{'model':db[_0x3adfb3['model']],'as':_0x3adfb3['as'],'attributes':_0x3adfb3[_0x6392('0x1c')],'include':_0x3adfb3[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x3adfb3[_0x6392('0x1d')],function(_0x7a1ad5){return{'model':db[_0x7a1ad5['model']],'as':_0x7a1ad5['as'],'attributes':_0x7a1ad5['attributes'],'include':_0x7a1ad5[_0x6392('0x1d')]?_[_0x6392('0x1e')](_0x7a1ad5[_0x6392('0x1d')],function(_0x51615d){return{'model':db[_0x51615d[_0x6392('0x1f')]],'as':_0x51615d['as'],'attributes':_0x51615d[_0x6392('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6392('0xc')](function(_0x3db577){logger[_0x6392('0xd')](_0x6392('0x20'),_0x46fc4d);logger[_0x6392('0xf')]('ShowTrigger',_0x46fc4d,JSON[_0x6392('0x12')](_0x3db577));_0x5bbbdb(_0x3db577);})['catch'](function(_0x33610b){logger[_0x6392('0x13')]('ShowTrigger',_0x33610b['message'],_0x46fc4d);_0x5b1e15(_0xa56b3c[_0x6392('0x13')](0x1f4,_0x33610b[_0x6392('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4751f3e..62caf28 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 _0xa55f=['multer','util','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa55f,0xaa));var _0xfa55=function(_0x109963,_0x4acc46){_0x109963=_0x109963-0x0;var _0x1902d5=_0xa55f[_0x109963];return _0x1902d5;};'use strict';var multer=require(_0xfa55('0x0'));var util=require(_0xfa55('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa55('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfa55('0x3'));var interaction=require(_0xfa55('0x4'));var config=require('../../config/environment');var controller=require(_0xfa55('0x5'));router[_0xfa55('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa55('0x6')]('/:id',auth[_0xfa55('0x7')](),controller[_0xfa55('0x8')]);router[_0xfa55('0x9')](_0xfa55('0xa'),auth[_0xfa55('0x7')](),controller[_0xfa55('0xb')]);router[_0xfa55('0x9')]('/',auth[_0xfa55('0x7')](),controller[_0xfa55('0xc')]);router[_0xfa55('0xd')](_0xfa55('0xe'),auth['isAuthenticated'](),controller[_0xfa55('0xf')]);router[_0xfa55('0x10')](_0xfa55('0xe'),auth[_0xfa55('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ec2=['express','fs-extra','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show','post','/:id/clone','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x1bc5c5,_0xeca88c){var _0x304977=function(_0x18f09e){while(--_0x18f09e){_0x1bc5c5['push'](_0x1bc5c5['shift']());}};_0x304977(++_0xeca88c);}(_0x8ec2,0x11e));var _0x28ec=function(_0x5676df,_0x14d122){_0x5676df=_0x5676df-0x0;var _0x1fb878=_0x8ec2[_0x5676df];return _0x1fb878;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x28ec('0x0'));var timeout=require(_0x28ec('0x1'));var express=require(_0x28ec('0x2'));var router=express['Router']();var fs_extra=require(_0x28ec('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28ec('0x4'));var controller=require(_0x28ec('0x5'));router['get']('/',auth[_0x28ec('0x6')](),controller['index']);router[_0x28ec('0x7')](_0x28ec('0x8'),auth[_0x28ec('0x6')](),controller[_0x28ec('0x9')]);router[_0x28ec('0xa')](_0x28ec('0xb'),auth[_0x28ec('0x6')](),controller['clone']);router[_0x28ec('0xa')]('/',auth[_0x28ec('0x6')](),controller[_0x28ec('0xc')]);router[_0x28ec('0xd')](_0x28ec('0x8'),auth[_0x28ec('0x6')](),controller[_0x28ec('0xe')]);router[_0x28ec('0xf')]('/:id',auth[_0x28ec('0x6')](),controller[_0x28ec('0x10')]);module[_0x28ec('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2341688..6075496 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 _0xd009=['udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','nonat','update,nonat','BOOLEAN','name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB'];(function(_0x3dfa38,_0x19b150){var _0x166297=function(_0x580756){while(--_0x580756){_0x3dfa38['push'](_0x3dfa38['shift']());}};_0x166297(++_0x19b150);}(_0xd009,0x125));var _0x9d00=function(_0x5d9dbf,_0x29f995){_0x5d9dbf=_0x5d9dbf-0x0;var _0x374248=_0xd009[_0x5d9dbf];return _0x374248;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9d00('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x2'),'user',_0x9d00('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x9d00('0x4')],'allowNull':![],'defaultValue':_0x9d00('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x9d00('0x6'),_0x9d00('0x7'),_0x9d00('0x8'),_0x9d00('0x9'),_0x9d00('0xa'),_0x9d00('0xb'),'PROHIB_FAILED_SCREEN',_0x9d00('0xc'))},'deny':{'type':Sequelize[_0x9d00('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x9d00('0x4')]},'md5secret':{'type':Sequelize[_0x9d00('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x9d00('0xd'),'set':function(_0x38aa68){this[_0x9d00('0xe')](_0x9d00('0xf'),_0x38aa68?_0x38aa68[_0x9d00('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x9d00('0xf'))?this[_0x9d00('0x11')](_0x9d00('0xf'))[_0x9d00('0x12')](','):null;},'comment':_0x9d00('0x13')},'dtmfmode':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x14'),'info',_0x9d00('0x15'),'inband',_0x9d00('0x16')),'defaultValue':_0x9d00('0x14')},'directmedia':{'type':Sequelize[_0x9d00('0x1')]('yes','no','nonat',_0x9d00('0x17'),_0x9d00('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9d00('0x1')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':_0x9d00('0x19'),'set':function(_0x1cdbf9){this[_0x9d00('0xe')]('nat',_0x1cdbf9?_0x1cdbf9[_0x9d00('0x10')](','):null);},'get':function(){return this[_0x9d00('0x11')](_0x9d00('0x1a'))?this[_0x9d00('0x11')](_0x9d00('0x1a'))[_0x9d00('0x12')](','):null;},'comment':_0x9d00('0x1b')},'callgroup':{'type':Sequelize[_0x9d00('0x4')]},'namedcallgroup':{'type':Sequelize[_0x9d00('0x4')]},'pickupgroup':{'type':Sequelize[_0x9d00('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x9d00('0x4')]},'language':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9d00('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x9d00('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d00('0x1d'),'set':function(_0x4bdaaf){this['setDataValue'](_0x9d00('0x1e'),_0x4bdaaf?_0x4bdaaf[_0x9d00('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9d00('0x11')](_0x9d00('0x1e'))?this[_0x9d00('0x11')]('allow')['split'](';'):null;},'comment':_0x9d00('0x1f')},'autoframing':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'insecure':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':_0x9d00('0x21'),'set':function(_0x16c6b9){this[_0x9d00('0xe')](_0x9d00('0x22'),_0x16c6b9?_0x16c6b9[_0x9d00('0x10')](','):null);},'get':function(){return this[_0x9d00('0x11')](_0x9d00('0x22'))?this[_0x9d00('0x11')]('insecure')['split'](','):null;},'comment':_0x9d00('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x9d00('0x20'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no',_0x9d00('0x24'))},'promiscredir':{'type':Sequelize[_0x9d00('0x1')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x9d00('0x20'),'no')},'accountcode':{'type':Sequelize[_0x9d00('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9d00('0x4')]},'callcounter':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no'),'defaultValue':_0x9d00('0x20')},'busylevel':{'type':Sequelize[_0x9d00('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x9d00('0x1')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'allowtransfer':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'subscribecontext':{'type':Sequelize[_0x9d00('0x4')]},'template':{'type':Sequelize[_0x9d00('0x4')]},'videosupport':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no',_0x9d00('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9d00('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9d00('0x1')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x9d00('0x27'),_0x9d00('0x28'))},'session_expires':{'type':Sequelize[_0x9d00('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x9d00('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x29'),_0x9d00('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x9d00('0x4')]},'fromdomain':{'type':Sequelize[_0x9d00('0x4')]},'fromuser':{'type':Sequelize[_0x9d00('0x4')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x9d00('0x1')]('yes','no'),'defaultValue':_0x9d00('0x20')},'keepalive':{'type':Sequelize[_0x9d00('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x9d00('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9d00('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9d00('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x9d00('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9d00('0x4')]},'callbackextension':{'type':Sequelize[_0x9d00('0x4')]},'timert1':{'type':Sequelize[_0x9d00('0x25')](0xb)},'timerb':{'type':Sequelize[_0x9d00('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9d00('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x9d00('0x4')]},'contactdeny':{'type':Sequelize[_0x9d00('0x4')]},'contactacl':{'type':Sequelize[_0x9d00('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x9d00('0x4')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x9d00('0x25')](0xb)},'encryption':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x9d00('0x20'),'no')},'icesupport':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'dtlsenable':{'type':Sequelize[_0x9d00('0x1')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no',_0x9d00('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x9d00('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9d00('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x9d00('0x4')]},'dtlscipher':{'type':Sequelize[_0x9d00('0x4')]},'dtlscafile':{'type':Sequelize[_0x9d00('0x4')]},'dtlscapath':{'type':Sequelize[_0x9d00('0x4')]},'dtlssetup':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x2d'),_0x9d00('0x2e'),_0x9d00('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9d00('0x4')]},'usereqphone':{'type':Sequelize['ENUM'](_0x9d00('0x20'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9d00('0x4')]},'recordofffeature':{'type':Sequelize[_0x9d00('0x4')]},'call_limit':{'type':Sequelize[_0x9d00('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'subscribemwi':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no')},'vmexten':{'type':Sequelize[_0x9d00('0x4')]},'mohinterpret':{'type':Sequelize[_0x9d00('0x4')]},'mohsuggest':{'type':Sequelize[_0x9d00('0x4')]},'parkinglot':{'type':Sequelize[_0x9d00('0x4')]},'description':{'type':Sequelize[_0x9d00('0x4')]},'host':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x9d00('0x1')](_0x9d00('0x20'),'no',_0x9d00('0x30'),_0x9d00('0x17'),_0x9d00('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9d00('0x4')]},'otherFields':{'type':Sequelize[_0x9d00('0x4')]},'active':{'type':Sequelize[_0x9d00('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9d00('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9968=['ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','STRING','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','originate','uac','pai','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9968,0x8d));var _0x8996=function(_0x5292e7,_0xdb4d75){_0x5292e7=_0x5292e7-0x0;var _0x2d6b73=_0x9968[_0x5292e7];return _0x2d6b73;};'use strict';var Sequelize=require(_0x8996('0x0'));module[_0x8996('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8996('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x4'),_0x8996('0x5'),'peer'),'allowNull':![],'defaultValue':_0x8996('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8996('0x6')},'callingpres':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x7'),_0x8996('0x8'),_0x8996('0x9'),'ALLOWED',_0x8996('0xa'),_0x8996('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x8996('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8996('0xc')]},'md5secret':{'type':Sequelize[_0x8996('0xc')]},'remotesecret':{'type':Sequelize[_0x8996('0xc')]},'transport':{'type':Sequelize[_0x8996('0xc')],'defaultValue':'udp','set':function(_0x2a23d5){this['setDataValue']('transport',_0x2a23d5?_0x2a23d5[_0x8996('0xd')](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0xf'))?this[_0x8996('0xe')](_0x8996('0xf'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x11')},'dtmfmode':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x12'),_0x8996('0x13'),_0x8996('0x14'),_0x8996('0x15'),_0x8996('0x16')),'defaultValue':_0x8996('0x12')},'directmedia':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x18'),_0x8996('0x19'),_0x8996('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8996('0xc')]},'directmediadeny':{'type':Sequelize[_0x8996('0xc')]},'nat':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x1b'),'set':function(_0x35e5b3){this[_0x8996('0x1c')]('nat',_0x35e5b3?_0x35e5b3[_0x8996('0xd')](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0x1d'))?this[_0x8996('0xe')](_0x8996('0x1d'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x1e')},'callgroup':{'type':Sequelize[_0x8996('0xc')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8996('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8996('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8996('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x1f')},'allow':{'type':Sequelize[_0x8996('0xc')],'allowNull':![],'defaultValue':_0x8996('0x20'),'set':function(_0x4b5903){this[_0x8996('0x1c')](_0x8996('0x21'),_0x4b5903?_0x4b5903[_0x8996('0xd')](';'):_0x8996('0x20'));},'get':function(){return this[_0x8996('0xe')](_0x8996('0x21'))?this[_0x8996('0xe')](_0x8996('0x21'))[_0x8996('0x10')](';'):null;},'comment':_0x8996('0x22')},'autoframing':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x23'),'set':function(_0x4b08e8){this[_0x8996('0x1c')](_0x8996('0x24'),_0x4b08e8?_0x4b08e8['join'](','):null);},'get':function(){return this[_0x8996('0xe')](_0x8996('0x24'))?this[_0x8996('0xe')](_0x8996('0x24'))[_0x8996('0x10')](','):null;},'comment':_0x8996('0x25')},'trustrpid':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8996('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'accountcode':{'type':Sequelize[_0x8996('0x27')](0xb)},'setvar':{'type':Sequelize[_0x8996('0xc')]},'callerid':{'type':Sequelize[_0x8996('0xc')],'defaultValue':_0x8996('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':_0x8996('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x8996('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x8996('0xc')]},'template':{'type':Sequelize[_0x8996('0xc')]},'videosupport':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8996('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x8996('0x3')]('accept','refuse',_0x8996('0x29'))},'session_expires':{'type':Sequelize[_0x8996('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x8996('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x8996('0xc')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x8996('0xc')]},'port':{'type':Sequelize[_0x8996('0x27')](0x5)},'qualify':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no'),'defaultValue':_0x8996('0x17')},'keepalive':{'type':Sequelize[_0x8996('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8996('0xc')]},'rtptimeout':{'type':Sequelize[_0x8996('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8996('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8996('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no',_0x8996('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x8996('0xc')]},'timert1':{'type':Sequelize[_0x8996('0x27')](0xb)},'timerb':{'type':Sequelize[_0x8996('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8996('0xc')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x8996('0xc')]},'use_q850_reason':{'type':Sequelize[_0x8996('0xc')]},'maxforwards':{'type':Sequelize[_0x8996('0x27')](0xb)},'encryption':{'type':Sequelize[_0x8996('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x8996('0x3')]('yes','no','fingerprint',_0x8996('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x8996('0xc')]},'dtlsprivatekey':{'type':Sequelize[_0x8996('0xc')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8996('0xc')]},'dtlscapath':{'type':Sequelize[_0x8996('0xc')]},'dtlssetup':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x2d'),_0x8996('0x2e'),_0x8996('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8996('0xc')]},'usereqphone':{'type':Sequelize['ENUM'](_0x8996('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8996('0xc')]},'recordofffeature':{'type':Sequelize[_0x8996('0xc')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x8996('0x3')](_0x8996('0x17'),'no')},'vmexten':{'type':Sequelize[_0x8996('0xc')]},'mohinterpret':{'type':Sequelize[_0x8996('0xc')]},'mohsuggest':{'type':Sequelize[_0x8996('0xc')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8996('0xc')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x8996('0x18'),'update',_0x8996('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8996('0xc')]},'otherFields':{'type':Sequelize[_0x8996('0xc')]},'active':{'type':Sequelize[_0x8996('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8996('0xc')],'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 7c5ff4e..b3f5b70 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x2a6084,_0x400993){var _0x3b846a=function(_0x1d6800){while(--_0x1d6800){_0x2a6084['push'](_0x2a6084['shift']());}};_0x3b846a(++_0x400993);}(_0x34e8,0x12c));var _0x834e=function(_0x15a992,_0x55ff81){_0x15a992=_0x15a992-0x0;var _0x12e01e=_0x34e8[_0x15a992];return _0x12e01e;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0xcaa808,_0x5c4f17){var _0x236f7e=function(_0xf7c24f){while(--_0xf7c24f){_0xcaa808['push'](_0xcaa808['shift']());}};_0x236f7e(++_0x5c4f17);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6ae79df..ca79876 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 _0xb60b=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','Trunk','lodash'];(function(_0x585276,_0x553f5a){var _0x4a7181=function(_0x26f87d){while(--_0x26f87d){_0x585276['push'](_0x585276['shift']());}};_0x4a7181(++_0x553f5a);}(_0xb60b,0xd0));var _0xbb60=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb60b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xbb60('0x0'));var util=require(_0xbb60('0x1'));var logger=require(_0xbb60('0x2'))(_0xbb60('0x3'));var moment=require(_0xbb60('0x4'));var BPromise=require(_0xbb60('0x5'));var rp=require(_0xbb60('0x6'));var fs=require('fs');var path=require(_0xbb60('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xbb60('0x8')]=function(_0x27c15c,_0x440393){return _0x27c15c[_0xbb60('0x9')](_0xbb60('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc17e=['tools_trunks','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','Trunk'];(function(_0x31981d,_0x4ec54a){var _0xa67d83=function(_0x21fc22){while(--_0x21fc22){_0x31981d['push'](_0x31981d['shift']());}};_0xa67d83(++_0x4ec54a);}(_0xc17e,0x1da));var _0xec17=function(_0x35e683,_0x128119){_0x35e683=_0x35e683-0x0;var _0x580795=_0xc17e[_0x35e683];return _0x580795;};'use strict';var _=require(_0xec17('0x0'));var util=require(_0xec17('0x1'));var logger=require(_0xec17('0x2'))('api');var moment=require(_0xec17('0x3'));var BPromise=require('bluebird');var rp=require(_0xec17('0x4'));var fs=require('fs');var path=require(_0xec17('0x5'));var rimraf=require(_0xec17('0x6'));var config=require(_0xec17('0x7'));var attributes=require(_0xec17('0x8'));module['exports']=function(_0x292589,_0x406eba){return _0x292589['define'](_0xec17('0x9'),attributes,{'tableName':_0xec17('0xa'),'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 d7f6e3e..4dca328 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 _0xbf68=['code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error'];(function(_0x44a919,_0x3155be){var _0x2353e6=function(_0x3f6fc5){while(--_0x3f6fc5){_0x44a919['push'](_0x44a919['shift']());}};_0x2353e6(++_0x3155be);}(_0xbf68,0x17a));var _0x8bf6=function(_0x3e0b82,_0x123fd2){_0x3e0b82=_0x3e0b82-0x0;var _0xb6808=_0xbf68[_0x3e0b82];return _0xb6808;};'use strict';var _=require(_0x8bf6('0x0'));var util=require(_0x8bf6('0x1'));var moment=require(_0x8bf6('0x2'));var BPromise=require(_0x8bf6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8bf6('0x5'))(_0x8bf6('0x6'));var config=require(_0x8bf6('0x7'));var jayson=require(_0x8bf6('0x8'));var client=jayson[_0x8bf6('0x9')][_0x8bf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d1ce,_0x311912,_0x50a794){return new BPromise(function(_0x519728,_0x12e406){return client[_0x8bf6('0xb')](_0x10d1ce,_0x50a794)[_0x8bf6('0xc')](function(_0x4b1f7f){logger[_0x8bf6('0xd')]('Trunk,\x20%s,\x20%s',_0x311912,_0x8bf6('0xe'));logger[_0x8bf6('0xf')](_0x8bf6('0x10'),_0x311912,_0x8bf6('0xe'),JSON['stringify'](_0x4b1f7f));if(_0x4b1f7f[_0x8bf6('0x11')]){if(_0x4b1f7f['error'][_0x8bf6('0x12')]===0x1f4){logger[_0x8bf6('0x11')](_0x8bf6('0x13'),_0x311912,_0x4b1f7f[_0x8bf6('0x11')][_0x8bf6('0x14')]);return _0x12e406(_0x4b1f7f[_0x8bf6('0x11')]['message']);}logger[_0x8bf6('0x11')](_0x8bf6('0x13'),_0x311912,_0x4b1f7f['error'][_0x8bf6('0x14')]);return _0x519728(_0x4b1f7f['error'][_0x8bf6('0x14')]);}else{logger[_0x8bf6('0xd')](_0x8bf6('0x13'),_0x311912,_0x8bf6('0xe'));_0x519728(_0x4b1f7f[_0x8bf6('0x15')][_0x8bf6('0x14')]);}})['catch'](function(_0x17a757){logger[_0x8bf6('0x11')](_0x8bf6('0x13'),_0x311912,_0x17a757);_0x12e406(_0x17a757);});});}exports[_0x8bf6('0x16')]=function(_0x298876){var _0x4eb375=this;return new Promise(function(_0x471e11,_0x296c9c){return db[_0x8bf6('0x17')][_0x8bf6('0x18')]({'raw':_0x298876[_0x8bf6('0x19')]?_0x298876['options'][_0x8bf6('0x1a')]===undefined?!![]:![]:!![],'where':_0x298876[_0x8bf6('0x19')]?_0x298876['options'][_0x8bf6('0x1b')]||null:null,'attributes':_0x298876[_0x8bf6('0x19')]?_0x298876[_0x8bf6('0x19')][_0x8bf6('0x1c')]||null:null,'limit':_0x298876[_0x8bf6('0x19')]?_0x298876[_0x8bf6('0x19')][_0x8bf6('0x1d')]||null:null,'include':_0x298876[_0x8bf6('0x19')]?_0x298876[_0x8bf6('0x19')][_0x8bf6('0x1e')]?_[_0x8bf6('0x1f')](_0x298876[_0x8bf6('0x19')][_0x8bf6('0x1e')],function(_0x376882){return{'model':db[_0x376882['model']],'as':_0x376882['as'],'attributes':_0x376882[_0x8bf6('0x1c')],'include':_0x376882[_0x8bf6('0x1e')]?_['map'](_0x376882[_0x8bf6('0x1e')],function(_0x3dd40a){return{'model':db[_0x3dd40a[_0x8bf6('0x20')]],'as':_0x3dd40a['as'],'attributes':_0x3dd40a['attributes'],'include':_0x3dd40a[_0x8bf6('0x1e')]?_[_0x8bf6('0x1f')](_0x3dd40a[_0x8bf6('0x1e')],function(_0x581de3){return{'model':db[_0x581de3[_0x8bf6('0x20')]],'as':_0x581de3['as'],'attributes':_0x581de3[_0x8bf6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bf6('0xc')](function(_0x47f4ea){logger['info']('GetTrunk',_0x298876);logger['debug'](_0x8bf6('0x16'),_0x298876,JSON[_0x8bf6('0x21')](_0x47f4ea));_0x471e11(_0x47f4ea);})['catch'](function(_0x124eda){logger['error']('GetTrunk',_0x124eda[_0x8bf6('0x14')],_0x298876);_0x296c9c(_0x4eb375[_0x8bf6('0x11')](0x1f4,_0x124eda[_0x8bf6('0x14')]));});});};exports['ShowTrunk']=function(_0x54d113){var _0x193bd8=this;return new Promise(function(_0x2cca88,_0x5dfc0d){return db[_0x8bf6('0x17')][_0x8bf6('0x22')]({'raw':_0x54d113[_0x8bf6('0x19')]?_0x54d113[_0x8bf6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x54d113[_0x8bf6('0x19')]?_0x54d113[_0x8bf6('0x19')]['where']||null:null,'attributes':_0x54d113[_0x8bf6('0x19')]?_0x54d113[_0x8bf6('0x19')][_0x8bf6('0x1c')]||null:null,'include':_0x54d113[_0x8bf6('0x19')]?_0x54d113[_0x8bf6('0x19')]['include']?_[_0x8bf6('0x1f')](_0x54d113[_0x8bf6('0x19')][_0x8bf6('0x1e')],function(_0x13a571){return{'model':db[_0x13a571[_0x8bf6('0x20')]],'as':_0x13a571['as'],'attributes':_0x13a571[_0x8bf6('0x1c')],'include':_0x13a571[_0x8bf6('0x1e')]?_[_0x8bf6('0x1f')](_0x13a571[_0x8bf6('0x1e')],function(_0xb251b6){return{'model':db[_0xb251b6[_0x8bf6('0x20')]],'as':_0xb251b6['as'],'attributes':_0xb251b6[_0x8bf6('0x1c')],'include':_0xb251b6[_0x8bf6('0x1e')]?_[_0x8bf6('0x1f')](_0xb251b6[_0x8bf6('0x1e')],function(_0x2b2004){return{'model':db[_0x2b2004[_0x8bf6('0x20')]],'as':_0x2b2004['as'],'attributes':_0x2b2004[_0x8bf6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bf6('0xc')](function(_0x5e6b12){logger[_0x8bf6('0xd')](_0x8bf6('0x23'),_0x54d113);logger[_0x8bf6('0xf')]('ShowTrunk',_0x54d113,JSON[_0x8bf6('0x21')](_0x5e6b12));_0x2cca88(_0x5e6b12);})['catch'](function(_0x42ac2a){logger[_0x8bf6('0x11')](_0x8bf6('0x23'),_0x42ac2a[_0x8bf6('0x14')],_0x54d113);_0x5dfc0d(_0x193bd8[_0x8bf6('0x11')](0x1f4,_0x42ac2a[_0x8bf6('0x14')]));});});}; \ No newline at end of file +var _0x2906=['debug','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x384120,_0x382556){var _0x35f5a2=function(_0x2e6bcc){while(--_0x2e6bcc){_0x384120['push'](_0x384120['shift']());}};_0x35f5a2(++_0x382556);}(_0x2906,0x9f));var _0x6290=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x2906[_0x5e8c32];return _0x595f7b;};'use strict';var _=require(_0x6290('0x0'));var util=require(_0x6290('0x1'));var moment=require(_0x6290('0x2'));var BPromise=require(_0x6290('0x3'));var rs=require(_0x6290('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6290('0x5'))['db'];var utils=require(_0x6290('0x6'));var logger=require(_0x6290('0x7'))(_0x6290('0x8'));var config=require('../../config/environment');var jayson=require(_0x6290('0x9'));var client=jayson[_0x6290('0xa')][_0x6290('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54e82f,_0xec958c,_0x4215eb){return new BPromise(function(_0x3a86ab,_0x34961f){return client[_0x6290('0xc')](_0x54e82f,_0x4215eb)['then'](function(_0x1f504b){logger[_0x6290('0xd')](_0x6290('0xe'),_0xec958c,_0x6290('0xf'));logger[_0x6290('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0xec958c,_0x6290('0xf'),JSON[_0x6290('0x11')](_0x1f504b));if(_0x1f504b[_0x6290('0x12')]){if(_0x1f504b[_0x6290('0x12')][_0x6290('0x13')]===0x1f4){logger[_0x6290('0x12')](_0x6290('0xe'),_0xec958c,_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);return _0x34961f(_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);}logger['error'](_0x6290('0xe'),_0xec958c,_0x1f504b[_0x6290('0x12')]['message']);return _0x3a86ab(_0x1f504b[_0x6290('0x12')][_0x6290('0x14')]);}else{logger[_0x6290('0xd')](_0x6290('0xe'),_0xec958c,_0x6290('0xf'));_0x3a86ab(_0x1f504b['result'][_0x6290('0x14')]);}})[_0x6290('0x15')](function(_0x25126c){logger[_0x6290('0x12')]('Trunk,\x20%s,\x20%s',_0xec958c,_0x25126c);_0x34961f(_0x25126c);});});}exports[_0x6290('0x16')]=function(_0x4065de){var _0x34b8aa=this;return new Promise(function(_0x414228,_0x3b5f16){return db[_0x6290('0x17')][_0x6290('0x18')]({'raw':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1a')]===undefined?!![]:![]:!![],'where':_0x4065de[_0x6290('0x19')]?_0x4065de[_0x6290('0x19')][_0x6290('0x1b')]||null:null,'attributes':_0x4065de['options']?_0x4065de[_0x6290('0x19')][_0x6290('0x1c')]||null:null,'limit':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1d')]||null:null,'include':_0x4065de[_0x6290('0x19')]?_0x4065de['options'][_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x4065de['options'][_0x6290('0x1e')],function(_0xfe2de6){return{'model':db[_0xfe2de6[_0x6290('0x20')]],'as':_0xfe2de6['as'],'attributes':_0xfe2de6[_0x6290('0x1c')],'include':_0xfe2de6['include']?_['map'](_0xfe2de6[_0x6290('0x1e')],function(_0x426ae3){return{'model':db[_0x426ae3['model']],'as':_0x426ae3['as'],'attributes':_0x426ae3['attributes'],'include':_0x426ae3[_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x426ae3[_0x6290('0x1e')],function(_0x473226){return{'model':db[_0x473226[_0x6290('0x20')]],'as':_0x473226['as'],'attributes':_0x473226[_0x6290('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6290('0x21')](function(_0x2ad2c3){logger[_0x6290('0xd')]('GetTrunk',_0x4065de);logger[_0x6290('0x10')]('GetTrunk',_0x4065de,JSON[_0x6290('0x11')](_0x2ad2c3));_0x414228(_0x2ad2c3);})[_0x6290('0x15')](function(_0x2d0be7){logger['error']('GetTrunk',_0x2d0be7[_0x6290('0x14')],_0x4065de);_0x3b5f16(_0x34b8aa[_0x6290('0x12')](0x1f4,_0x2d0be7[_0x6290('0x14')]));});});};exports[_0x6290('0x22')]=function(_0x4b38db){var _0xa77326=this;return new Promise(function(_0x44a103,_0x4b80e0){return db[_0x6290('0x17')]['find']({'raw':_0x4b38db[_0x6290('0x19')]?_0x4b38db['options'][_0x6290('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b38db['options']?_0x4b38db['options'][_0x6290('0x1b')]||null:null,'attributes':_0x4b38db[_0x6290('0x19')]?_0x4b38db[_0x6290('0x19')][_0x6290('0x1c')]||null:null,'include':_0x4b38db[_0x6290('0x19')]?_0x4b38db[_0x6290('0x19')][_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x4b38db[_0x6290('0x19')][_0x6290('0x1e')],function(_0x77c2e8){return{'model':db[_0x77c2e8[_0x6290('0x20')]],'as':_0x77c2e8['as'],'attributes':_0x77c2e8[_0x6290('0x1c')],'include':_0x77c2e8[_0x6290('0x1e')]?_[_0x6290('0x1f')](_0x77c2e8[_0x6290('0x1e')],function(_0x1a7fd4){return{'model':db[_0x1a7fd4[_0x6290('0x20')]],'as':_0x1a7fd4['as'],'attributes':_0x1a7fd4[_0x6290('0x1c')],'include':_0x1a7fd4['include']?_[_0x6290('0x1f')](_0x1a7fd4['include'],function(_0x52a142){return{'model':db[_0x52a142[_0x6290('0x20')]],'as':_0x52a142['as'],'attributes':_0x52a142[_0x6290('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c62b){logger[_0x6290('0xd')]('ShowTrunk',_0x4b38db);logger[_0x6290('0x10')](_0x6290('0x22'),_0x4b38db,JSON[_0x6290('0x11')](_0x51c62b));_0x44a103(_0x51c62b);})[_0x6290('0x15')](function(_0x23a062){logger[_0x6290('0x12')](_0x6290('0x22'),_0x23a062[_0x6290('0x14')],_0x4b38db);_0x4b80e0(_0xa77326['error'](0x1f4,_0x23a062[_0x6290('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 093d072..12e3c60 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 _0x19ad=['./user-setting.controller','put','/:id','isAuthenticated','exports','Router','../../components/auth/service'];(function(_0xb874eb,_0x1be219){var _0x313348=function(_0x44e7be){while(--_0x44e7be){_0xb874eb['push'](_0xb874eb['shift']());}};_0x313348(++_0x1be219);}(_0x19ad,0x194));var _0xd19a=function(_0x470ada,_0x453059){_0x470ada=_0x470ada-0x0;var _0x5a71e0=_0x19ad[_0x470ada];return _0x5a71e0;};'use strict';var express=require('express');var router=express[_0xd19a('0x0')]();var auth=require(_0xd19a('0x1'));var controller=require(_0xd19a('0x2'));router[_0xd19a('0x3')](_0xd19a('0x4'),auth[_0xd19a('0x5')](),controller['update']);module[_0xd19a('0x6')]=router; \ No newline at end of file +var _0x2b29=['put','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x59beb6,_0x10d085){var _0x331d47=function(_0x367f16){while(--_0x367f16){_0x59beb6['push'](_0x59beb6['shift']());}};_0x331d47(++_0x10d085);}(_0x2b29,0x17e));var _0x92b2=function(_0x5756b7,_0x172674){_0x5756b7=_0x5756b7-0x0;var _0x11aa10=_0x2b29[_0x5756b7];return _0x11aa10;};'use strict';var express=require(_0x92b2('0x0'));var router=express['Router']();var auth=require(_0x92b2('0x1'));var controller=require(_0x92b2('0x2'));router[_0x92b2('0x3')]('/:id',auth[_0x92b2('0x4')](),controller[_0x92b2('0x5')]);module[_0x92b2('0x6')]=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 8f5f769..9a1d6aa 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 _0x4d11=['TEXT','DATE','UserId','sequelize','error','debug','exports','ENUM','BOOLEAN'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4d11,0x1c5));var _0x14d1=function(_0x3aaf33,_0x4c56fe){_0x3aaf33=_0x3aaf33-0x0;var _0x281a10=_0x4d11[_0x3aaf33];return _0x281a10;};'use strict';var Sequelize=require(_0x14d1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x14d1('0x1'),'warning','info',_0x14d1('0x2')];module[_0x14d1('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x14d1('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x14d1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x14d1('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x14d1('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x14d1('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x14d1('0x8')}}; \ No newline at end of file +var _0x32ff=['warning','info','debug','ENUM','TEXT','INTEGER','UserId','sequelize','error'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x32ff,0x16f));var _0xf32f=function(_0x2bfbc3,_0x4d7905){_0x2bfbc3=_0x2bfbc3-0x0;var _0x52293d=_0x32ff[_0x2bfbc3];return _0x52293d;};'use strict';var Sequelize=require(_0xf32f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf32f('0x1'),_0xf32f('0x2'),_0xf32f('0x3'),_0xf32f('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xf32f('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf32f('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf32f('0x7')],'unique':_0xf32f('0x8')}}; \ 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 49373b3..6c9fd9f 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 _0x9bde=['stack','name','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error'];(function(_0x7834c0,_0x1af0ca){var _0x52211d=function(_0x4bfa4f){while(--_0x4bfa4f){_0x7834c0['push'](_0x7834c0['shift']());}};_0x52211d(++_0x1af0ca);}(_0x9bde,0xe1));var _0xe9bd=function(_0x27b163,_0x3dd7d3){_0x27b163=_0x27b163-0x0;var _0x454bb5=_0x9bde[_0x27b163];return _0x454bb5;};'use strict';var _=require('lodash');var Redis=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var config=require('../../config/environment');var db=require(_0xe9bd('0x2'))['db'];var socket=require(_0xe9bd('0x3'))(new Redis(config[_0xe9bd('0x4')]));require(_0xe9bd('0x5'))[_0xe9bd('0x6')](socket);config[_0xe9bd('0x4')]=_[_0xe9bd('0x7')](config['redis'],{'host':_0xe9bd('0x8'),'port':0x18eb});function respondWithResult(_0x5f18fe,_0x22a438){_0x22a438=_0x22a438||0xc8;return function(_0xa66ae2){if(_0xa66ae2){return _0x5f18fe[_0xe9bd('0x9')](_0x22a438)[_0xe9bd('0xa')](_0xa66ae2);}};}function saveUpdates(_0x29bc2b){return function(_0xbefddb){if(_0xbefddb){return _0xbefddb[_0xe9bd('0xb')](_0x29bc2b)[_0xe9bd('0xc')](function(_0x581602){return _0x581602;});}return null;};}function handleEntityNotFound(_0x5f36c8){return function(_0x3c8e95){if(!_0x3c8e95){_0x5f36c8[_0xe9bd('0xd')](0x194);}return _0x3c8e95;};}function handleError(_0x2601ac,_0x581ab9){_0x581ab9=_0x581ab9||0x1f4;return function(_0x12c96e){logger[_0xe9bd('0xe')](_0x12c96e[_0xe9bd('0xf')]);if(_0x12c96e[_0xe9bd('0x10')]){delete _0x12c96e['name'];}_0x2601ac[_0xe9bd('0x9')](_0x581ab9)['send'](_0x12c96e);};}exports[_0xe9bd('0xb')]=function(_0x429e88,_0x3435b4){if(_0x429e88['user']['role']!==_0xe9bd('0x11'))throw new Error(_0xe9bd('0x12'));if(isNaN(Number(_0x429e88[_0xe9bd('0x13')]['id'])))throw new Error(_0xe9bd('0x14'));return db[_0xe9bd('0x15')][_0xe9bd('0x16')]({'where':{'id':_0x429e88[_0xe9bd('0x13')]['id']}})['then'](handleEntityNotFound(_0x3435b4,null))[_0xe9bd('0xc')](saveUpdates(_0x429e88[_0xe9bd('0x17')],null))[_0xe9bd('0xc')](respondWithResult(_0x3435b4,null))['catch'](handleError(_0x3435b4,null));}; \ No newline at end of file +var _0x61a5=['../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','defaults','redis','localhost','status','update','then','error','stack','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api'];(function(_0x10c467,_0x298f44){var _0x92aaa2=function(_0x233054){while(--_0x233054){_0x10c467['push'](_0x10c467['shift']());}};_0x92aaa2(++_0x298f44);}(_0x61a5,0xf0));var _0x561a=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x61a5[_0x687ddc];return _0x441991;};'use strict';var _=require(_0x561a('0x0'));var Redis=require('ioredis');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var config=require(_0x561a('0x3'));var db=require(_0x561a('0x4'))['db'];var socket=require(_0x561a('0x5'))(new Redis(config['redis']));require(_0x561a('0x6'))[_0x561a('0x7')](socket);config['redis']=_[_0x561a('0x8')](config[_0x561a('0x9')],{'host':_0x561a('0xa'),'port':0x18eb});function respondWithResult(_0x2646bd,_0x3d55f8){_0x3d55f8=_0x3d55f8||0xc8;return function(_0xfe091){if(_0xfe091){return _0x2646bd[_0x561a('0xb')](_0x3d55f8)['json'](_0xfe091);}};}function saveUpdates(_0x3db11c){return function(_0x52563e){if(_0x52563e){return _0x52563e[_0x561a('0xc')](_0x3db11c)[_0x561a('0xd')](function(_0x5b3510){return _0x5b3510;});}return null;};}function handleEntityNotFound(_0x34e464){return function(_0x4071ba){if(!_0x4071ba){_0x34e464['sendStatus'](0x194);}return _0x4071ba;};}function handleError(_0x3a1eee,_0x5cc8ed){_0x5cc8ed=_0x5cc8ed||0x1f4;return function(_0x205e99){logger[_0x561a('0xe')](_0x205e99[_0x561a('0xf')]);if(_0x205e99[_0x561a('0x10')]){delete _0x205e99[_0x561a('0x10')];}_0x3a1eee[_0x561a('0xb')](_0x5cc8ed)[_0x561a('0x11')](_0x205e99);};}exports[_0x561a('0xc')]=function(_0x8c1952,_0x4f1e33){if(_0x8c1952[_0x561a('0x12')][_0x561a('0x13')]!=='admin')throw new Error(_0x561a('0x14'));if(isNaN(Number(_0x8c1952[_0x561a('0x15')]['id'])))throw new Error(_0x561a('0x16'));return db[_0x561a('0x17')][_0x561a('0x18')]({'where':{'id':_0x8c1952[_0x561a('0x15')]['id']}})[_0x561a('0xd')](handleEntityNotFound(_0x4f1e33,null))[_0x561a('0xd')](saveUpdates(_0x8c1952[_0x561a('0x19')],null))[_0x561a('0xd')](respondWithResult(_0x4f1e33,null))[_0x561a('0x1a')](handleError(_0x4f1e33,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 41d0963..8ac1d87 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 _0x1141=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3a912c,_0x56d42b){var _0x3a2a83=function(_0x17dd44){while(--_0x17dd44){_0x3a912c['push'](_0x3a912c['shift']());}};_0x3a2a83(++_0x56d42b);}(_0x1141,0x12d));var _0x1114=function(_0x955747,_0xd1ab29){_0x955747=_0x955747-0x0;var _0x3ff6d5=_0x1141[_0x955747];return _0x3ff6d5;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x1114('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1114('0x1')](0x0);var events={'afterCreate':_0x1114('0x2'),'afterUpdate':_0x1114('0x3'),'afterDestroy':_0x1114('0x4')};function emitEvent(_0x55a3c0){return function(_0x4e6f71,_0x7374f9,_0x4505a4){UserSettingEvents[_0x1114('0x5')](_0x55a3c0+':'+_0x4e6f71['id'],_0x4e6f71);UserSettingEvents[_0x1114('0x5')](_0x55a3c0,_0x4e6f71);_0x4505a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1114('0x6')](e,emitEvent(event));}}module[_0x1114('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x30cc=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4469a8,_0x43db44){var _0x473935=function(_0x565ae8){while(--_0x565ae8){_0x4469a8['push'](_0x4469a8['shift']());}};_0x473935(++_0x43db44);}(_0x30cc,0x1aa));var _0xc30c=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x30cc[_0x1f71d8];return _0x10b045;};'use strict';var EventEmitter=require(_0xc30c('0x0'));var UserSetting=require(_0xc30c('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc30c('0x2')](0x0);var events={'afterCreate':_0xc30c('0x3'),'afterUpdate':'update','afterDestroy':_0xc30c('0x4')};function emitEvent(_0x48bd4e){return function(_0x4666dd,_0x4e0cd6,_0x4e7b54){UserSettingEvents['emit'](_0x48bd4e+':'+_0x4666dd['id'],_0x4666dd);UserSettingEvents[_0xc30c('0x5')](_0x48bd4e,_0x4666dd);_0x4e7b54(null);};}for(var e in events){if(events[_0xc30c('0x6')](e)){var event=events[e];UserSetting[_0xc30c('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 82c190c..e351b66 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 _0x69d3=['UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0xe12906,_0x2717ab){var _0x65d8cc=function(_0x36ab8c){while(--_0x36ab8c){_0xe12906['push'](_0xe12906['shift']());}};_0x65d8cc(++_0x2717ab);}(_0x69d3,0xda));var _0x369d=function(_0x1aa211,_0x5ef871){_0x1aa211=_0x1aa211-0x0;var _0x6a63c1=_0x69d3[_0x1aa211];return _0x6a63c1;};'use strict';var attributes=require(_0x369d('0x0'));module[_0x369d('0x1')]=function(_0xf1a301){return _0xf1a301['define'](_0x369d('0x2'),attributes,{'tableName':_0x369d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d777e){if(!_0x4d777e['clientSideLoggingEnabled'])_0x4d777e[_0x369d('0x4')]=null;else if(_0x4d777e['clientSideLoggingEnabledSince']===null)_0x4d777e['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x0c71=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0x2b893b,_0x1c0f36){var _0x42c815=function(_0x120674){while(--_0x120674){_0x2b893b['push'](_0x2b893b['shift']());}};_0x42c815(++_0x1c0f36);}(_0x0c71,0xfb));var _0x10c7=function(_0x1adf7b,_0x187d58){_0x1adf7b=_0x1adf7b-0x0;var _0x2973fb=_0x0c71[_0x1adf7b];return _0x2973fb;};'use strict';var attributes=require('./user-setting.attributes');module[_0x10c7('0x0')]=function(_0x4ff793){return _0x4ff793[_0x10c7('0x1')](_0x10c7('0x2'),attributes,{'tableName':_0x10c7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4858c1){if(!_0x4858c1['clientSideLoggingEnabled'])_0x4858c1[_0x10c7('0x4')]=null;else if(_0x4858c1['clientSideLoggingEnabledSince']===null)_0x4858c1[_0x10c7('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 3eebdd4..895cc36 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 _0x6ace=['./user-setting.events','remove','update','emit','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x438cf2,_0x5edfad){var _0x586869=function(_0x508352){while(--_0x508352){_0x438cf2['push'](_0x438cf2['shift']());}};_0x586869(++_0x5edfad);}(_0x6ace,0xd0));var _0xe6ac=function(_0xada87a,_0x16223c){_0xada87a=_0xada87a-0x0;var _0x7ad44c=_0x6ace[_0xada87a];return _0x7ad44c;};'use strict';var UserSettingEvents=require(_0xe6ac('0x0'));var events=['save',_0xe6ac('0x1'),_0xe6ac('0x2')];function createListener(_0xdac24f,_0x1f8af7){return function(_0x4f6f17){_0x1f8af7[_0xe6ac('0x3')](_0xdac24f,_0x4f6f17);if(_0xdac24f==='user-setting:update'){_0x1f8af7[_0xe6ac('0x3')](_0xe6ac('0x4')+_0x4f6f17[_0xe6ac('0x5')],_0x4f6f17);}};}exports[_0xe6ac('0x6')]=function(_0x26a329){for(var _0x3cfc94=0x0,_0x58b1ed=events['length'];_0x3cfc94<_0x58b1ed;_0x3cfc94++){var _0x3d51c6=events[_0x3cfc94];var _0x11eb26=createListener(_0xe6ac('0x7')+_0x3d51c6,_0x26a329);UserSettingEvents['on'](_0x3d51c6,_0x11eb26);}}; \ No newline at end of file +var _0xc174=['UserId','register','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x45806c,_0x158f22){var _0x4f8fcc=function(_0x4f20e4){while(--_0x4f20e4){_0x45806c['push'](_0x45806c['shift']());}};_0x4f8fcc(++_0x158f22);}(_0xc174,0x1c2));var _0x4c17=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc174[_0xa1e3e3];return _0xc980e9;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x4c17('0x0'),_0x4c17('0x1')];function createListener(_0x12c849,_0x2f3f9d){return function(_0x12068d){_0x2f3f9d[_0x4c17('0x2')](_0x12c849,_0x12068d);if(_0x12c849===_0x4c17('0x3')){_0x2f3f9d[_0x4c17('0x2')](_0x4c17('0x4')+_0x12068d[_0x4c17('0x5')],_0x12068d);}};}exports[_0x4c17('0x6')]=function(_0x4493e5){for(var _0x1a8114=0x0,_0x400b95=events['length'];_0x1a8114<_0x400b95;_0x1a8114++){var _0x12764d=events[_0x1a8114];var _0x59db26=createListener('user-setting:'+_0x12764d,_0x4493e5);UserSettingEvents['on'](_0x12764d,_0x59db26);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 299fb15..8a00606 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 _0x3feb=['bulkCreate','diskStorage','join','root','format','now','single','/:id/login','login','logout','/:id/unpause','unpause','addTeams','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','create','/create_many'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x3feb,0x1ce));var _0xb3fe=function(_0x3369b7,_0x13bb45){_0x3369b7=_0x3369b7-0x0;var _0x23bbfd=_0x3feb[_0x3369b7];return _0x23bbfd;};'use strict';var multer=require(_0xb3fe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb3fe('0x1'));var express=require(_0xb3fe('0x2'));var router=express[_0xb3fe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3fe('0x5'));var controller=require('./user.controller');router['get']('/',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x7')]);router[_0xb3fe('0x8')](_0xb3fe('0x9'),auth['isAuthenticated'](),controller[_0xb3fe('0xa')]);router[_0xb3fe('0x8')](_0xb3fe('0xb'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0xc')]);router[_0xb3fe('0x8')]('/presence',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0xd')]);router[_0xb3fe('0x8')](_0xb3fe('0xe'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0xf')]);router[_0xb3fe('0x8')](_0xb3fe('0x10'),controller['getAvatar']);router[_0xb3fe('0x8')]('/:id/open_tabs',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x11')]);router[_0xb3fe('0x8')](_0xb3fe('0x12'),auth['isAuthenticated'](),controller[_0xb3fe('0x13')]);router[_0xb3fe('0x8')](_0xb3fe('0x14'),auth['isAuthenticated'](),controller[_0xb3fe('0x15')]);router['get'](_0xb3fe('0x16'),auth[_0xb3fe('0x6')](),controller['getVoiceQueuesRt']);router[_0xb3fe('0x8')](_0xb3fe('0x17'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x18')]);router['get'](_0xb3fe('0x19'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x1a')]);router['get']('/:id/screen_recordings',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x1b')]);router['get'](_0xb3fe('0x1c'),auth[_0xb3fe('0x6')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth[_0xb3fe('0x6')](),controller['getOpenchannelInteractions']);router[_0xb3fe('0x8')](_0xb3fe('0x1d'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x1e')]);router[_0xb3fe('0x8')]('/:id/sms/interactions',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x1f')]);router[_0xb3fe('0x8')](_0xb3fe('0x20'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x21')]);router['get'](_0xb3fe('0x22'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x23')]);router[_0xb3fe('0x8')](_0xb3fe('0x24'),auth[_0xb3fe('0x6')](),controller['getTeams']);router[_0xb3fe('0x8')](_0xb3fe('0x25'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x26')]);router[_0xb3fe('0x8')](_0xb3fe('0x27'),auth[_0xb3fe('0x6')](),controller['getAgents']);router['get'](_0xb3fe('0x28'),auth[_0xb3fe('0x6')](),controller['getVoicePrefixes']);router[_0xb3fe('0x8')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xb3fe('0x29')]);router[_0xb3fe('0x8')]('/:id/mail_accounts',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x2a')]);router[_0xb3fe('0x8')](_0xb3fe('0x2b'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x2c')]);router[_0xb3fe('0x8')]('/:id/sms_accounts',auth[_0xb3fe('0x6')](),controller['getSmsAccounts']);router[_0xb3fe('0x8')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xb3fe('0x2d')]);router[_0xb3fe('0x8')](_0xb3fe('0x2e'),auth['isAuthenticated'](),controller[_0xb3fe('0x2f')]);router[_0xb3fe('0x8')]('/:id/scheduled_calls',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x30')]);router[_0xb3fe('0x8')](_0xb3fe('0x31'),auth[_0xb3fe('0x6')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0xb3fe('0x6')](),controller['addContacts']);router[_0xb3fe('0x32')]('/',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x33')]);router[_0xb3fe('0x32')](_0xb3fe('0x34'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x35')]);router[_0xb3fe('0x32')](_0xb3fe('0x14'),auth[_0xb3fe('0x6')](),controller['addQueues']);var upload=multer({'storage':multer[_0xb3fe('0x36')]({'destination':function(_0x1c98a8,_0x222306,_0x5d1950){_0x5d1950(null,path[_0xb3fe('0x37')](config[_0xb3fe('0x38')],'server/files/images/'));},'filename':function(_0x32f249,_0x1aca33,_0x2f98e8){_0x2f98e8(null,util[_0xb3fe('0x39')]('%s-%s',Date[_0xb3fe('0x3a')](),_0x1aca33['originalname']));}})});router[_0xb3fe('0x32')](_0xb3fe('0x10'),upload[_0xb3fe('0x3b')]('file'),controller['addAvatar']);router[_0xb3fe('0x32')](_0xb3fe('0x3c'),auth['isAuthenticated'](),controller[_0xb3fe('0x3d')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xb3fe('0x3e')]);router[_0xb3fe('0x32')]('/:id/pause',auth[_0xb3fe('0x6')](),controller['pause']);router['post'](_0xb3fe('0x3f'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x40')]);router[_0xb3fe('0x32')](_0xb3fe('0x24'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x41')]);router[_0xb3fe('0x32')]('/:id/chat_interactions',auth[_0xb3fe('0x6')](),controller['addChatInteractions']);router[_0xb3fe('0x32')]('/:id/mail_interactions',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x42')]);router[_0xb3fe('0x32')](_0xb3fe('0x43'),auth[_0xb3fe('0x6')](),controller['addFaxInteractions']);router[_0xb3fe('0x32')](_0xb3fe('0x44'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x45')]);router[_0xb3fe('0x32')](_0xb3fe('0x46'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x47')]);router[_0xb3fe('0x32')](_0xb3fe('0x48'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x49')]);router[_0xb3fe('0x32')](_0xb3fe('0x4a'),auth['isAuthenticated'](),controller[_0xb3fe('0x4b')]);router[_0xb3fe('0x32')](_0xb3fe('0x4c'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x4d')]);router[_0xb3fe('0x32')](_0xb3fe('0x2b'),auth['isAuthenticated'](),controller[_0xb3fe('0x4e')]);router[_0xb3fe('0x32')]('/:id/sms_accounts',auth[_0xb3fe('0x6')](),controller['addSmsAccounts']);router[_0xb3fe('0x32')](_0xb3fe('0x4f'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x50')]);router['post'](_0xb3fe('0x2e'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x51')]);router[_0xb3fe('0x32')](_0xb3fe('0x31'),auth[_0xb3fe('0x6')](),controller['createApiKey']);router[_0xb3fe('0x52')](_0xb3fe('0xe'),auth['isAuthenticated'](),controller[_0xb3fe('0x53')]);router['put'](_0xb3fe('0x54'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x55')]);router[_0xb3fe('0x56')](_0xb3fe('0x14'),auth[_0xb3fe('0x6')](),controller['removeQueues']);router[_0xb3fe('0x56')]('/:id/teams',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x57')]);router['delete'](_0xb3fe('0xe'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x58')]);router[_0xb3fe('0x56')](_0xb3fe('0x59'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x5a')]);router[_0xb3fe('0x56')](_0xb3fe('0x5b'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x5c')]);router['delete']('/:id/fax_interactions',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x5d')]);router[_0xb3fe('0x56')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb3fe('0x5e')]);router['delete'](_0xb3fe('0x46'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x5f')]);router[_0xb3fe('0x56')]('/:id/whatsapp_interactions',auth[_0xb3fe('0x6')](),controller['removeWhatsappInteractions']);router[_0xb3fe('0x56')](_0xb3fe('0x4a'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xb3fe('0x56')](_0xb3fe('0x4c'),auth['isAuthenticated'](),controller[_0xb3fe('0x60')]);router[_0xb3fe('0x56')]('/:id/openchannel_accounts',auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x61')]);router[_0xb3fe('0x56')](_0xb3fe('0x62'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x63')]);router[_0xb3fe('0x56')](_0xb3fe('0x4f'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x64')]);router[_0xb3fe('0x56')](_0xb3fe('0x2e'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x65')]);router[_0xb3fe('0x56')](_0xb3fe('0x31'),auth[_0xb3fe('0x6')](),controller[_0xb3fe('0x66')]);router['post']('/:id/messengerSoundNotification',auth[_0xb3fe('0x6')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0x1069=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/fax_accounts','addFaxAccounts'];(function(_0x42f78a,_0x210841){var _0x26cb8f=function(_0x5c596a){while(--_0x5c596a){_0x42f78a['push'](_0x42f78a['shift']());}};_0x26cb8f(++_0x210841);}(_0x1069,0x167));var _0x9106=function(_0xe47ef0,_0x30445d){_0xe47ef0=_0xe47ef0-0x0;var _0x45d200=_0x1069[_0xe47ef0];return _0x45d200;};'use strict';var multer=require(_0x9106('0x0'));var util=require(_0x9106('0x1'));var path=require(_0x9106('0x2'));var timeout=require(_0x9106('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9106('0x4'));var interaction=require(_0x9106('0x5'));var config=require(_0x9106('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x9106('0x7')](),controller[_0x9106('0x8')]);router[_0x9106('0x9')]('/describe',auth[_0x9106('0x7')](),controller['describe']);router[_0x9106('0x9')](_0x9106('0xa'),auth[_0x9106('0x7')](),controller[_0x9106('0xb')]);router[_0x9106('0x9')](_0x9106('0xc'),auth[_0x9106('0x7')](),controller[_0x9106('0xd')]);router[_0x9106('0x9')]('/:id',auth[_0x9106('0x7')](),controller[_0x9106('0xe')]);router[_0x9106('0x9')](_0x9106('0xf'),controller[_0x9106('0x10')]);router[_0x9106('0x9')]('/:id/open_tabs',auth[_0x9106('0x7')](),controller[_0x9106('0x11')]);router[_0x9106('0x9')](_0x9106('0x12'),auth[_0x9106('0x7')](),controller['getContacts']);router[_0x9106('0x9')](_0x9106('0x13'),auth['isAuthenticated'](),controller['getQueues']);router[_0x9106('0x9')]('/:id/queues_rt',auth[_0x9106('0x7')](),controller[_0x9106('0x14')]);router['get'](_0x9106('0x15'),auth[_0x9106('0x7')](),controller[_0x9106('0x16')]);router[_0x9106('0x9')](_0x9106('0x17'),auth['isAuthenticated'](),controller[_0x9106('0x18')]);router['get'](_0x9106('0x19'),auth[_0x9106('0x7')](),controller['getScreenRecordings']);router['get'](_0x9106('0x1a'),auth['isAuthenticated'](),controller[_0x9106('0x1b')]);router[_0x9106('0x9')](_0x9106('0x1c'),auth[_0x9106('0x7')](),controller[_0x9106('0x1d')]);router[_0x9106('0x9')](_0x9106('0x1e'),auth[_0x9106('0x7')](),controller['getMailInteractions']);router[_0x9106('0x9')](_0x9106('0x1f'),auth[_0x9106('0x7')](),controller[_0x9106('0x20')]);router[_0x9106('0x9')]('/:id/fax/interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x21')]);router[_0x9106('0x9')]('/:id/whatsapp/interactions',auth[_0x9106('0x7')](),controller['getWhatsappInteractions']);router['get'](_0x9106('0x22'),auth[_0x9106('0x7')](),controller['getTeams']);router[_0x9106('0x9')](_0x9106('0x23'),auth['isAuthenticated'](),controller[_0x9106('0x24')]);router[_0x9106('0x9')](_0x9106('0x25'),auth[_0x9106('0x7')](),controller[_0x9106('0x26')]);router['get']('/:id/prefixes',auth[_0x9106('0x7')](),controller[_0x9106('0x27')]);router[_0x9106('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9106('0x28')]);router[_0x9106('0x9')](_0x9106('0x29'),auth[_0x9106('0x7')](),controller[_0x9106('0x2a')]);router[_0x9106('0x9')]('/:id/openchannel_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x2b')]);router[_0x9106('0x9')](_0x9106('0x2c'),auth[_0x9106('0x7')](),controller['getSmsAccounts']);router[_0x9106('0x9')](_0x9106('0x2d'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x9106('0x9')](_0x9106('0x2e'),auth[_0x9106('0x7')](),controller[_0x9106('0x2f')]);router[_0x9106('0x9')](_0x9106('0x30'),auth['isAuthenticated'](),controller[_0x9106('0x31')]);router[_0x9106('0x9')](_0x9106('0x32'),auth[_0x9106('0x7')](),controller[_0x9106('0x33')]);router['post'](_0x9106('0x12'),auth['isAuthenticated'](),controller[_0x9106('0x34')]);router[_0x9106('0x35')]('/',auth[_0x9106('0x7')](),controller[_0x9106('0x36')]);router[_0x9106('0x35')](_0x9106('0x37'),auth[_0x9106('0x7')](),controller[_0x9106('0x38')]);router['post'](_0x9106('0x13'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x9106('0x39')]({'destination':function(_0xc3d35,_0x352a97,_0x2e2108){_0x2e2108(null,path[_0x9106('0x3a')](config[_0x9106('0x3b')],_0x9106('0x3c')));},'filename':function(_0xc6c990,_0x2e8738,_0x1d3252){_0x1d3252(null,util[_0x9106('0x3d')]('%s-%s',Date['now'](),_0x2e8738['originalname']));}})});router[_0x9106('0x35')](_0x9106('0xf'),upload[_0x9106('0x3e')](_0x9106('0x3f')),controller['addAvatar']);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x9106('0x40')]);router[_0x9106('0x35')](_0x9106('0x41'),auth[_0x9106('0x7')](),controller[_0x9106('0x42')]);router[_0x9106('0x35')](_0x9106('0x43'),auth[_0x9106('0x7')](),controller[_0x9106('0x44')]);router[_0x9106('0x35')](_0x9106('0x45'),auth[_0x9106('0x7')](),controller[_0x9106('0x46')]);router[_0x9106('0x35')](_0x9106('0x22'),auth[_0x9106('0x7')](),controller[_0x9106('0x47')]);router[_0x9106('0x35')](_0x9106('0x48'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x9106('0x35')](_0x9106('0x49'),auth[_0x9106('0x7')](),controller[_0x9106('0x4a')]);router[_0x9106('0x35')](_0x9106('0x4b'),auth[_0x9106('0x7')](),controller[_0x9106('0x4c')]);router[_0x9106('0x35')](_0x9106('0x4d'),auth['isAuthenticated'](),controller[_0x9106('0x4e')]);router[_0x9106('0x35')]('/:id/openchannel_interactions',auth[_0x9106('0x7')](),controller['addOpenchannelInteractions']);router[_0x9106('0x35')]('/:id/whatsapp_interactions',auth[_0x9106('0x7')](),controller['addWhatsappInteractions']);router[_0x9106('0x35')](_0x9106('0x4f'),auth[_0x9106('0x7')](),controller[_0x9106('0x50')]);router[_0x9106('0x35')](_0x9106('0x29'),auth[_0x9106('0x7')](),controller[_0x9106('0x51')]);router[_0x9106('0x35')]('/:id/openchannel_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x52')]);router[_0x9106('0x35')](_0x9106('0x2c'),auth[_0x9106('0x7')](),controller[_0x9106('0x53')]);router['post'](_0x9106('0x2d'),auth[_0x9106('0x7')](),controller[_0x9106('0x54')]);router[_0x9106('0x35')](_0x9106('0x2e'),auth['isAuthenticated'](),controller[_0x9106('0x55')]);router[_0x9106('0x35')](_0x9106('0x32'),auth[_0x9106('0x7')](),controller[_0x9106('0x56')]);router[_0x9106('0x57')]('/:id',auth['isAuthenticated'](),controller[_0x9106('0x58')]);router[_0x9106('0x57')](_0x9106('0x59'),auth[_0x9106('0x7')](),controller[_0x9106('0x5a')]);router[_0x9106('0x5b')](_0x9106('0x13'),auth['isAuthenticated'](),controller[_0x9106('0x5c')]);router[_0x9106('0x5b')]('/:id/teams',auth[_0x9106('0x7')](),controller[_0x9106('0x5d')]);router[_0x9106('0x5b')](_0x9106('0x5e'),auth[_0x9106('0x7')](),controller['destroy']);router[_0x9106('0x5b')](_0x9106('0x48'),auth[_0x9106('0x7')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x5f')]);router[_0x9106('0x5b')]('/:id/fax_interactions',auth[_0x9106('0x7')](),controller[_0x9106('0x60')]);router[_0x9106('0x5b')](_0x9106('0x4d'),auth[_0x9106('0x7')](),controller[_0x9106('0x61')]);router[_0x9106('0x5b')](_0x9106('0x62'),auth[_0x9106('0x7')](),controller[_0x9106('0x63')]);router[_0x9106('0x5b')](_0x9106('0x64'),auth[_0x9106('0x7')](),controller[_0x9106('0x65')]);router[_0x9106('0x5b')](_0x9106('0x4f'),auth[_0x9106('0x7')](),controller['removeFaxAccounts']);router[_0x9106('0x5b')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x9106('0x66'),auth['isAuthenticated'](),controller[_0x9106('0x67')]);router[_0x9106('0x5b')]('/:id/sms_accounts',auth[_0x9106('0x7')](),controller[_0x9106('0x68')]);router[_0x9106('0x5b')](_0x9106('0x2d'),auth[_0x9106('0x7')](),controller[_0x9106('0x69')]);router[_0x9106('0x5b')](_0x9106('0x2e'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x9106('0x5b')]('/:id/api_key',auth[_0x9106('0x7')](),controller[_0x9106('0x6a')]);router[_0x9106('0x35')](_0x9106('0x6b'),auth[_0x9106('0x7')](),controller[_0x9106('0x6c')]);module[_0x9106('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index db6917b..470fc53 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 _0xdea7=['isArray','wss','encryption','avpf','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','lodash','exports','name','setDataValue','defaultuser','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','user','telephone','local','accountcode','callerid','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','get'];(function(_0x8f551b,_0x2d76eb){var _0x285bfb=function(_0x4b75c6){while(--_0x4b75c6){_0x8f551b['push'](_0x8f551b['shift']());}};_0x285bfb(++_0x2d76eb);}(_0xdea7,0x1c8));var _0x7dea=function(_0x24289c,_0x388286){_0x24289c=_0x24289c-0x0;var _0x334fa5=_0xdea7[_0x24289c];return _0x334fa5;};'use strict';var Sequelize=require(_0x7dea('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x7dea('0x1'));module[_0x7dea('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x324cb0){this['setDataValue'](_0x7dea('0x3'),_0x324cb0);this[_0x7dea('0x4')](_0x7dea('0x5'),_0x324cb0);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x30f160){this[_0x7dea('0x4')](_0x7dea('0x6'),_0x30f160);this[_0x7dea('0x4')]('callerid',util['format'](_0x7dea('0x7'),_0x30f160,this[_0x7dea('0x8')](_0x7dea('0x9'))));}},'alias':{'type':Sequelize[_0x7dea('0xa')]},'email':{'type':Sequelize[_0x7dea('0xa')],'allowNull':![],'unique':_0x7dea('0xb'),'validate':{'isEmail':!![]},'set':function(_0x7f2f9f){if(_0x7f2f9f){this['setDataValue']('email',_0x7f2f9f[_0x7dea('0xc')]());}}},'role':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0xe'),_0x7dea('0xf'),'agent',_0x7dea('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x7dea('0xa')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7dea('0xa')],'defaultValue':_0x7dea('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x7dea('0x9'),'set':function(_0x4bc971){this['setDataValue'](_0x7dea('0x9'),_0x4bc971);this[_0x7dea('0x4')](_0x7dea('0x12'),_0x4bc971);this[_0x7dea('0x4')](_0x7dea('0x13'),util['format']('\x22%s\x22\x20<%s>',this[_0x7dea('0x8')](_0x7dea('0x6')),_0x4bc971));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7dea('0xa')]},'address':{'type':Sequelize[_0x7dea('0xa')]},'zipcode':{'type':Sequelize[_0x7dea('0xa')]},'userpic':{'type':Sequelize[_0x7dea('0xa')]},'city':{'type':Sequelize[_0x7dea('0xa')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7dea('0x15')]},'voicePause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x7dea('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7dea('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'host':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![],'defaultValue':_0x7dea('0x17')},'ipaddr':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'port':{'type':Sequelize[_0x7dea('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x18'),_0x7dea('0xf'),_0x7dea('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x7dea('0xd')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x7dea('0x1a'),'ALLOWED',_0x7dea('0x1b'),_0x7dea('0x1c'),_0x7dea('0x1d'),_0x7dea('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![],'defaultValue':_0x7dea('0x1f'),'set':function(_0x2f67c9){this['setDataValue']('transport',_0x2f67c9?_0x2f67c9[_0x7dea('0x20')](','):null);},'get':function(){return this[_0x7dea('0x8')]('transport')?this[_0x7dea('0x8')](_0x7dea('0x21'))[_0x7dea('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7dea('0xd')]('rfc2833','info',_0x7dea('0x23'),_0x7dea('0x24'),_0x7dea('0x25')),'allowNull':!![],'defaultValue':_0x7dea('0x26')},'directmedia':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no',_0x7dea('0x28'),_0x7dea('0x29'),_0x7dea('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![],'defaultValue':_0x7dea('0x2b'),'set':function(_0x290185){this['setDataValue']('nat',_0x290185?_0x290185['join'](','):null);},'get':function(){return this[_0x7dea('0x8')](_0x7dea('0x2c'))?this[_0x7dea('0x8')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7dea('0xa')]},'namedcallgroup':{'type':Sequelize[_0x7dea('0xa')]},'pickupgroup':{'type':Sequelize[_0x7dea('0xa')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7dea('0xa')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7dea('0xa')]},'disallow':{'type':Sequelize[_0x7dea('0xa')],'allowNull':![],'defaultValue':_0x7dea('0x2d')},'allow':{'type':Sequelize[_0x7dea('0xa')],'allowNull':![],'defaultValue':_0x7dea('0x2e'),'set':function(_0x881183){this['setDataValue']('allow',_0x881183?_0x881183[_0x7dea('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x7dea('0x2f'))?this[_0x7dea('0x8')]('allow')[_0x7dea('0x22')](';'):null;},'comment':_0x7dea('0x30')},'autoframing':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![],'set':function(_0x2eb461){this['setDataValue'](_0x7dea('0x31'),_0x2eb461?_0x2eb461[_0x7dea('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x7dea('0x31'))?this[_0x7dea('0x8')](_0x7dea('0x31'))[_0x7dea('0x22')](','):null;},'comment':_0x7dea('0x32')},'trustrpid':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no',_0x7dea('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7dea('0x34')},'amaflags':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':_0x7dea('0x27')},'busylevel':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no',_0x7dea('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x36'),_0x7dea('0x37'),_0x7dea('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x39'),_0x7dea('0x3a')),'allowNull':!![],'defaultValue':_0x7dea('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':_0x7dea('0x27')},'keepalive':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no','fingerprint',_0x7dea('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7dea('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7dea('0x3c'),_0x7dea('0x3d'),_0x7dea('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x7dea('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7dea('0xd')](_0x7dea('0x27'),'no','nonat',_0x7dea('0x29'),_0x7dea('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x7dea('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7dea('0x40')]},'showWebBar':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0,'set':function(_0x2ef7ae){this[_0x7dea('0x4')]('showWebBar',_0x2ef7ae);var _0x4217b1=this[_0x7dea('0x41')]({'plain':!![]});switch(_0x2ef7ae){case 0x0:case 0x1:var _0x4bcfd2=_0x4217b1['transport']?_[_0x7dea('0x42')](_0x4217b1[_0x7dea('0x21')])?_0x4217b1['transport'][_0x7dea('0x20')]():_0x4217b1[_0x7dea('0x21')]:_0x7dea('0x1f');if(_0x4bcfd2===_0x7dea('0x43')){_0x4bcfd2=_0x7dea('0x1f');}this[_0x7dea('0x4')](_0x7dea('0x21'),_0x4bcfd2);this['setDataValue'](_0x7dea('0x44'),'no');this[_0x7dea('0x4')](_0x7dea('0x45'),null);this[_0x7dea('0x4')]('force_avp',null);this[_0x7dea('0x4')]('icesupport',null);this[_0x7dea('0x4')]('dtlsenable',null);this['setDataValue'](_0x7dea('0x46'),null);this['setDataValue'](_0x7dea('0x47'),null);this[_0x7dea('0x4')]('dtlscertfile',null);this[_0x7dea('0x4')](_0x7dea('0x48'),null);this[_0x7dea('0x4')](_0x7dea('0x49'),'no');break;case 0x2:this['setDataValue'](_0x7dea('0x21'),'wss');this[_0x7dea('0x4')]('encryption','yes');this['setDataValue'](_0x7dea('0x45'),'yes');this[_0x7dea('0x4')]('force_avp',_0x7dea('0x27'));this[_0x7dea('0x4')]('icesupport','yes');this[_0x7dea('0x4')](_0x7dea('0x4a'),_0x7dea('0x27'));this[_0x7dea('0x4')]('dtlsverify','no');this[_0x7dea('0x4')](_0x7dea('0x47'),_0x7dea('0x3e'));this[_0x7dea('0x4')]('dtlscertfile',_0x4217b1[_0x7dea('0x4b')]||_0x7dea('0x4c'));this[_0x7dea('0x4')](_0x7dea('0x48'),_0x4217b1[_0x7dea('0x48')]||_0x7dea('0x4d'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x7dea('0x40')],'set':function(_0x2e4d06){this[_0x7dea('0x4')](_0x7dea('0x4e'),_0x2e4d06?_0x2e4d06[_0x7dea('0x20')](','):[]);},'get':function(){return this[_0x7dea('0x8')](_0x7dea('0x4e'))?_[_0x7dea('0x4f')](this[_0x7dea('0x8')](_0x7dea('0x4e'))[_0x7dea('0x22')](','),function(_0x1e5768){return parseInt(_0x1e5768,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7dea('0xa')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7dea('0xa')]},'phoneBarBusyNumber':{'type':Sequelize[_0x7dea('0xa')]},'phoneBarUnconditional':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7dea('0xa')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7dea('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7dea('0xa')]},'phoneBarEnableJaws':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7dea('0x8')](_0x7dea('0x50'))?this[_0x7dea('0x8')](_0x7dea('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x7dea('0xa')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x7dea('0xa')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![],'set':function(_0x4ea500){if(typeof _0x4ea500===_0x7dea('0x51')){var _0x228dc2=_0x4ea500==='1'?!![]:_0x4ea500==='0'?![]:_0x4ea500===_0x7dea('0x52')?!![]:_0x4ea500==='false'?![]:![];this[_0x7dea('0x4')](_0x7dea('0x53'),_0x228dc2);}else{this[_0x7dea('0x4')](_0x7dea('0x53'),_0x4ea500);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x17de6b){this[_0x7dea('0x4')](_0x7dea('0x54'),_0x17de6b);if(_0x17de6b===!![]){this[_0x7dea('0x4')](_0x7dea('0x55'),moment());this[_0x7dea('0x4')](_0x7dea('0x56'),0x0);}else{this[_0x7dea('0x4')](_0x7dea('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x7dea('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x7dea('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x7dea('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd627=['name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','STRING','email','toLowerCase','admin','agent','telephone','local','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','info','shortinfo','inband','rfc2833','yes','nonat','update','outgoing','nat','split','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','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','uac','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','exports'];(function(_0x38f9fc,_0x2ca82b){var _0x242585=function(_0x3b9371){while(--_0x3b9371){_0x38f9fc['push'](_0x38f9fc['shift']());}};_0x242585(++_0x2ca82b);}(_0xd627,0xb0));var _0x7d62=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xd627[_0x561f25];return _0x150e4c;};'use strict';var Sequelize=require(_0x7d62('0x0'));var moment=require('moment');var util=require(_0x7d62('0x1'));var _=require(_0x7d62('0x2'));module[_0x7d62('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7d62('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3bb2d6){this['setDataValue'](_0x7d62('0x4'),_0x3bb2d6);this[_0x7d62('0x5')]('defaultuser',_0x3bb2d6);},'comment':_0x7d62('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x32de9a){this['setDataValue']('fullname',_0x32de9a);this[_0x7d62('0x5')](_0x7d62('0x7'),util[_0x7d62('0x8')](_0x7d62('0x9'),_0x32de9a,this['getDataValue'](_0x7d62('0xa'))));}},'alias':{'type':Sequelize[_0x7d62('0xb')]},'email':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'unique':_0x7d62('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4f64f8){if(_0x4f64f8){this[_0x7d62('0x5')](_0x7d62('0xc'),_0x4f64f8[_0x7d62('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x7d62('0xe'),'user',_0x7d62('0xf'),_0x7d62('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':_0x7d62('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x21001e){this['setDataValue']('internal',_0x21001e);this[_0x7d62('0x5')](_0x7d62('0x12'),_0x21001e);this[_0x7d62('0x5')](_0x7d62('0x7'),util[_0x7d62('0x8')](_0x7d62('0x9'),this['getDataValue'](_0x7d62('0x13')),_0x21001e));}},'salt':{'type':Sequelize[_0x7d62('0xb')]},'phone':{'type':Sequelize[_0x7d62('0xb')]},'mobile':{'type':Sequelize[_0x7d62('0xb')]},'address':{'type':Sequelize[_0x7d62('0xb')]},'zipcode':{'type':Sequelize[_0x7d62('0xb')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7d62('0xb')]},'country':{'type':Sequelize[_0x7d62('0xb')]},'online':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7d62('0x15')]},'voicePause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':_0x7d62('0x16')},'lastPauseAt':{'type':Sequelize[_0x7d62('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7d62('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7d62('0x18')},'ipaddr':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x7d62('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x1a'),_0x7d62('0x1b'),'peer'),'allowNull':!![],'defaultValue':_0x7d62('0x1a')},'context':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':_0x7d62('0x1c')},'callingpres':{'type':Sequelize[_0x7d62('0x19')]('ALLOWED_NOT_SCREENED',_0x7d62('0x1d'),_0x7d62('0x1e'),_0x7d62('0x1f'),_0x7d62('0x20'),'PROHIB_PASSED_SCREEN',_0x7d62('0x21'),_0x7d62('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'transport':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':_0x7d62('0x23'),'set':function(_0x1e6a28){this[_0x7d62('0x5')](_0x7d62('0x24'),_0x1e6a28?_0x1e6a28['join'](','):null);},'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x24'))?this['getDataValue'](_0x7d62('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7d62('0x19')]('rfc2833',_0x7d62('0x26'),_0x7d62('0x27'),_0x7d62('0x28'),'auto'),'allowNull':!![],'defaultValue':_0x7d62('0x29')},'directmedia':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no',_0x7d62('0x2b'),_0x7d62('0x2c'),_0x7d62('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x58562f){this[_0x7d62('0x5')](_0x7d62('0x2e'),_0x58562f?_0x58562f['join'](','):null);},'get':function(){return this[_0x7d62('0x25')]('nat')?this['getDataValue']('nat')[_0x7d62('0x2f')](','):null;},'comment':_0x7d62('0x30')},'callgroup':{'type':Sequelize[_0x7d62('0xb')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7d62('0xb')]},'namedpickupgroup':{'type':Sequelize[_0x7d62('0xb')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7d62('0xb')]},'disallow':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7d62('0xb')],'allowNull':![],'defaultValue':_0x7d62('0x31'),'set':function(_0x119cf8){this[_0x7d62('0x5')]('allow',_0x119cf8?_0x119cf8['join'](';'):_0x7d62('0x31'));},'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x32'))?this[_0x7d62('0x25')](_0x7d62('0x32'))[_0x7d62('0x2f')](';'):null;},'comment':_0x7d62('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![],'set':function(_0x33945c){this[_0x7d62('0x5')](_0x7d62('0x34'),_0x33945c?_0x33945c[_0x7d62('0x35')](','):null);},'get':function(){return this[_0x7d62('0x25')]('insecure')?this[_0x7d62('0x25')](_0x7d62('0x34'))['split'](','):null;},'comment':_0x7d62('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no',_0x7d62('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7d62('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x7d62('0x2a')},'busylevel':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7d62('0x19')]('yes','no',_0x7d62('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7d62('0x19')]('accept',_0x7d62('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x7d62('0x2a')},'keepalive':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7d62('0x19')]('yes','no','fingerprint',_0x7d62('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7d62('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7d62('0x3d'),_0x7d62('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7d62('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no','nonat',_0x7d62('0x2c'),_0x7d62('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x7d62('0x15')]},'passwordResetAt':{'type':Sequelize[_0x7d62('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7d62('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5b99dc){this['setDataValue'](_0x7d62('0x41'),_0x5b99dc);var _0x37cd4a=this['get']({'plain':!![]});switch(_0x5b99dc){case 0x0:case 0x1:var _0x224735=_0x37cd4a[_0x7d62('0x24')]?_[_0x7d62('0x42')](_0x37cd4a[_0x7d62('0x24')])?_0x37cd4a[_0x7d62('0x24')][_0x7d62('0x35')]():_0x37cd4a['transport']:_0x7d62('0x23');if(_0x224735===_0x7d62('0x43')){_0x224735='udp';}this[_0x7d62('0x5')](_0x7d62('0x24'),_0x224735);this[_0x7d62('0x5')](_0x7d62('0x44'),'no');this[_0x7d62('0x5')]('avpf',null);this[_0x7d62('0x5')](_0x7d62('0x45'),null);this[_0x7d62('0x5')](_0x7d62('0x46'),null);this['setDataValue'](_0x7d62('0x47'),null);this[_0x7d62('0x5')]('dtlsverify',null);this['setDataValue'](_0x7d62('0x48'),null);this[_0x7d62('0x5')](_0x7d62('0x49'),null);this[_0x7d62('0x5')](_0x7d62('0x4a'),null);this[_0x7d62('0x5')](_0x7d62('0x4b'),'no');break;case 0x2:this[_0x7d62('0x5')](_0x7d62('0x24'),_0x7d62('0x43'));this[_0x7d62('0x5')]('encryption',_0x7d62('0x2a'));this[_0x7d62('0x5')]('avpf','yes');this[_0x7d62('0x5')](_0x7d62('0x45'),_0x7d62('0x2a'));this[_0x7d62('0x5')](_0x7d62('0x46'),_0x7d62('0x2a'));this['setDataValue'](_0x7d62('0x47'),'yes');this[_0x7d62('0x5')]('dtlsverify','no');this[_0x7d62('0x5')](_0x7d62('0x48'),_0x7d62('0x4c'));this[_0x7d62('0x5')](_0x7d62('0x49'),_0x37cd4a[_0x7d62('0x49')]||_0x7d62('0x4d'));this[_0x7d62('0x5')](_0x7d62('0x4a'),_0x37cd4a['dtlsprivatekey']||_0x7d62('0x4e'));this['setDataValue'](_0x7d62('0x4b'),_0x7d62('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x7d62('0x40')],'set':function(_0x316e0f){this[_0x7d62('0x5')](_0x7d62('0x4f'),_0x316e0f?_0x316e0f[_0x7d62('0x35')](','):[]);},'get':function(){return this[_0x7d62('0x25')]('permissions')?_[_0x7d62('0x50')](this[_0x7d62('0x25')](_0x7d62('0x4f'))[_0x7d62('0x2f')](','),function(_0x457f55){return parseInt(_0x457f55,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7d62('0x19')](_0x7d62('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7d62('0xb')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x7d62('0x51')],'get':function(){return this[_0x7d62('0x25')](_0x7d62('0x52'))?this['getDataValue'](_0x7d62('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7d62('0xb')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7d62('0xb')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![],'set':function(_0x1cc367){if(typeof _0x1cc367===_0x7d62('0x53')){var _0x775070=_0x1cc367==='1'?!![]:_0x1cc367==='0'?![]:_0x1cc367==='true'?!![]:_0x1cc367===_0x7d62('0x54')?![]:![];this[_0x7d62('0x5')](_0x7d62('0x55'),_0x775070);}else{this[_0x7d62('0x5')](_0x7d62('0x55'),_0x1cc367);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x40c918){this[_0x7d62('0x5')](_0x7d62('0x56'),_0x40c918);if(_0x40c918===!![]){this[_0x7d62('0x5')](_0x7d62('0x57'),moment());this[_0x7d62('0x5')](_0x7d62('0x58'),0x0);}else{this[_0x7d62('0x5')](_0x7d62('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x7d62('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7d62('0x17')](0x5)[_0x7d62('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x7d62('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x7d62('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c827a41..2c9bc87 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 _0x200d=['unknown','ringing','teams','flatten','toString','col','asc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','QueryTypes','select','ui.','InteractionId','field','_interactions','OpenTabs','messengerSoundNotification','enabled','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','socket.io-emitter','./user.socket','register','redis','client','http','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update','agent','destroy','role','admin','Users','Agents','ignore','map','value','includes','find','name','send','rawAttributes','fieldName','key','filter','salt','resetPasswordToken','resetPasswordExpires','index','getOptions','where','User','query','includeAll','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','openchannel','whatsapp','all','include','merge','mail','body','params','addContacts','omit','internal','Setting','findById','securePassword','validatePasswordPattern','password','max','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','SELECT','length','isNil','from','voicemail','VoiceMail','email','permissions','101','102','103','113','104','105','106','107','108','109','100','111','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','compact','Telephones','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','toLowerCase','ids','penalty','spread','capitalize','QueueId','Queue:save','voice','VoiceQueue','get','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','emit','Queue:remove','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','existsSync','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','findOne','format','User\x20with\x20id\x20%s\x20not\x20found','describe','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','options','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','commit','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','bulkCreate','LOGININPAUSE','isMiddleware','resolve','logout','online','QueuePause','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','smsPause','whatsappPause','pauseType','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','transaction','flattenDeep','removeAgent','UserVoicePrefix','getLists','CmList','getAgents','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','CmContact','dialActive','getApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle'];(function(_0x243e77,_0x2bfff6){var _0x1520da=function(_0x4131f3){while(--_0x4131f3){_0x243e77['push'](_0x243e77['shift']());}};_0x1520da(++_0x2bfff6);}(_0x200d,0x1ab));var _0xd200=function(_0x3ebbd2,_0x18293c){_0x3ebbd2=_0x3ebbd2-0x0;var _0x5cc1ba=_0x200d[_0x3ebbd2];return _0x5cc1ba;};'use strict';var moment=require(_0xd200('0x0'));var util=require(_0xd200('0x1'));var path=require(_0xd200('0x2'));var fs=require('fs');var _=require(_0xd200('0x3'));var squel=require(_0xd200('0x4'));var Redis=require(_0xd200('0x5'));var jayson=require(_0xd200('0x6'));var authService=require(_0xd200('0x7'));var contacts=require('../../components/contacts');var qs=require(_0xd200('0x8'));var rta=require(_0xd200('0x9'));var logger=require(_0xd200('0xa'))(_0xd200('0xb'));var utils=require(_0xd200('0xc'));var config=require(_0xd200('0xd'));var licenseUtil=require(_0xd200('0xe'));var APIBadRequestError=require(_0xd200('0xf'))[_0xd200('0x10')];var APINotFoundError=require(_0xd200('0xf'))[_0xd200('0x11')];var APIForbiddenError=require(_0xd200('0xf'))[_0xd200('0x12')];var APIHandleError=require(_0xd200('0xf'))[_0xd200('0x13')];var db=require('../../mysqldb')['db'];var socket=require(_0xd200('0x14'))(new Redis(config['redis']));require(_0xd200('0x15'))[_0xd200('0x16')](socket);config[_0xd200('0x17')]=_['defaults'](config[_0xd200('0x17')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xd200('0x18')][_0xd200('0x19')]({'port':0x232a});var values;function respondWithStatusCode(_0x5647e2,_0x12bcec){_0x12bcec=_0x12bcec||0xcc;return function(_0x1b9e17){if(_0x1b9e17){return _0x5647e2[_0xd200('0x1a')](_0x12bcec);}return _0x5647e2['status'](_0x12bcec)[_0xd200('0x1b')]();};}function respondWithResult(_0x849edf,_0x5bad88){_0x5bad88=_0x5bad88||0xc8;return function(_0x1739a4){if(_0x1739a4){return _0x849edf[_0xd200('0x1c')](_0x5bad88)[_0xd200('0x1d')](_0x1739a4);}};}function respondWithFilteredResult(_0x81385e,_0x37a0b0){return function(_0x3fbbe2){if(_0x3fbbe2){var _0x2d7272=typeof _0x37a0b0[_0xd200('0x1e')]==='undefined'&&typeof _0x37a0b0[_0xd200('0x1f')]===_0xd200('0x20');var _0x3d6c4e=_0x3fbbe2[_0xd200('0x21')];var _0x8bc892=_0x2d7272?0x0:_0x37a0b0[_0xd200('0x1e')];var _0x16b2db=_0x2d7272?_0x3fbbe2[_0xd200('0x21')]:_0x37a0b0[_0xd200('0x1e')]+_0x37a0b0[_0xd200('0x1f')];var _0x210e8f;if(_0x16b2db>=_0x3d6c4e){_0x16b2db=_0x3d6c4e;_0x210e8f=0xc8;}else{_0x210e8f=0xce;}_0x81385e[_0xd200('0x1c')](_0x210e8f);return _0x81385e['set'](_0xd200('0x22'),_0x8bc892+'-'+_0x16b2db+'/'+_0x3d6c4e)[_0xd200('0x1d')](_0x3fbbe2);}return null;};}function respondWithRpcPromise(_0x37e950,_0x2d9c00,_0x511186,_0x1cb4bd){return new Promise(function(_0x261d95,_0x1a015b){var _0x5e7d58=_0x1cb4bd||amiClient;return _0x5e7d58[_0xd200('0x23')](_0x37e950,_0x511186)[_0xd200('0x24')](function(_0x550c43){logger['info'](_0xd200('0x25'),_0x2d9c00,_0xd200('0x26'));logger[_0xd200('0x27')](_0xd200('0x28'),_0x2d9c00,_0xd200('0x26'),JSON[_0xd200('0x29')](_0x550c43));if(_0x550c43[_0xd200('0x2a')]){if(_0x550c43[_0xd200('0x2a')][_0xd200('0x2b')]===0x1f4){logger[_0xd200('0x2a')](_0xd200('0x25'),_0x2d9c00,_0x550c43[_0xd200('0x2a')]['message']);return _0x1a015b(_0x550c43[_0xd200('0x2a')][_0xd200('0x2c')]);}logger['error'](_0xd200('0x25'),_0x2d9c00,_0x550c43['error'][_0xd200('0x2c')]);return _0x261d95(_0x550c43[_0xd200('0x2a')]['message']);}else{logger[_0xd200('0x2d')](_0xd200('0x25'),_0x2d9c00,_0xd200('0x26'));_0x261d95(_0x550c43[_0xd200('0x2e')][_0xd200('0x2c')]);}})[_0xd200('0x2f')](function(_0x772558){logger[_0xd200('0x2a')](_0xd200('0x25'),_0x2d9c00,_0x772558);_0x1a015b(_0x772558);});});}function saveUpdates(_0x36aedb){return function(_0x5ac06f){if(_0x5ac06f){return _0x5ac06f[_0xd200('0x30')](_0x36aedb)[_0xd200('0x24')](function(_0x25ef80){if(_0x25ef80['role']===_0xd200('0x31')){socket['emit']('userNotification:recalc:'+_0x25ef80['id'],_0x25ef80);}return _0x25ef80;});}return null;};}function removeEntity(_0x553415,_0x87702e){return function(_0x3fa031){if(_0x3fa031){return _0x3fa031[_0xd200('0x32')]({'transaction':_0x87702e})[_0xd200('0x24')](function(){var _0x1c71d4=_0x3fa031['get']({'plain':!![]});if(_0x1c71d4[_0xd200('0x33')]===_0xd200('0x34'))return;var _0x1b205b=[{'name':_0xd200('0x35'),'value':'user','ignore':!![]},{'name':_0xd200('0x36'),'value':_0xd200('0x31'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x4dff88=_(_0x1b205b)['filter'](_0xd200('0x37'))[_0xd200('0x38')](_0xd200('0x39'))[_0xd200('0x39')]();if(_[_0xd200('0x3a')](_0x4dff88,_0x1c71d4[_0xd200('0x33')])){return;}var _0x262d1e=_[_0xd200('0x3b')](_0x1b205b,[_0xd200('0x39'),_0x1c71d4['role']])[_0xd200('0x3c')];return db['UserProfileResource'][_0xd200('0x32')]({'where':{'type':_0x262d1e,'resourceId':_0x1c71d4['id']},'transaction':_0x87702e})[_0xd200('0x24')](function(){return _0x3fa031;});})['then'](function(){_0x553415[_0xd200('0x1c')](0xcc)[_0xd200('0x1b')]();});}};}function handleEntityNotFound(_0x5003a4){return function(_0x4d2815){if(!_0x4d2815){_0x5003a4[_0xd200('0x1a')](0x194);}return _0x4d2815;};}function handleError(_0x397b07,_0x567a9a){_0x567a9a=_0x567a9a||0x1f4;return function(_0x10320d){logger[_0xd200('0x2a')](_0x10320d['stack']);if(_0x10320d[_0xd200('0x3c')]){delete _0x10320d[_0xd200('0x3c')];}_0x397b07[_0xd200('0x1c')](_0x567a9a)[_0xd200('0x3d')](_0x10320d);};}function getUserAttributes(){return _(db['User'][_0xd200('0x3e')])[_0xd200('0x38')](function(_0x46b4a1){return{'name':_0x46b4a1[_0xd200('0x3f')],'type':_0x46b4a1['type'][_0xd200('0x40')]};})[_0xd200('0x41')](function(_0x3d23b8){return!['password',_0xd200('0x42'),'previousPasswords',_0xd200('0x43'),_0xd200('0x44'),'md5secret'][_0xd200('0x3a')](_0x3d23b8[_0xd200('0x3c')]);})[_0xd200('0x39')]();}exports[_0xd200('0x45')]=function(_0x1b6573,_0x3f8bad){var _0x486450={},_0x1f944b={'count':0x0,'rows':[]};var _0xfbd80b=getUserAttributes();_0x486450=qs[_0xd200('0x46')](_0xfbd80b,_0x1b6573);var _0x21ff1c={'where':_0x486450[_0xd200('0x47')]};return db[_0xd200('0x48')][_0xd200('0x21')](_0x21ff1c)['then'](function(_0x5eee8f){_0x1f944b['count']=_0x5eee8f;if(_0x1b6573[_0xd200('0x49')][_0xd200('0x4a')]){_0x486450['include']=[{'all':!![]}];}if(_0x1b6573[_0xd200('0x49')][_0xd200('0x4b')]===_0xd200('0x4c')){_0x486450['include']=[{'model':db[_0xd200('0x4d')],'as':_0xd200('0x4b')}];}if(!_[_0xd200('0x3a')](_0x486450['attributes'],'id')){_0x486450[_0xd200('0x4e')][_0xd200('0x4f')]('id');}return db['User'][_0xd200('0x50')](_0x486450);})['then'](function(_0x28f23f){_0x1f944b[_0xd200('0x51')]=_0x28f23f;if(_0x1b6573[_0xd200('0x49')][_0xd200('0x52')]===_0xd200('0x4c')){var _0xd49cbc=[];for(var _0x3f8f49=0x0;_0x3f8f49<_0x1f944b['rows']['length'];_0x3f8f49++){_0xd49cbc[_0xd200('0x4f')](get_open_tabs(_0xd200('0x53'),_0x1f944b[_0xd200('0x51')][_0x3f8f49][_0xd200('0x54')]));_0xd49cbc[_0xd200('0x4f')](get_open_tabs(_0xd200('0x55'),_0x1f944b['rows'][_0x3f8f49][_0xd200('0x54')]));_0xd49cbc[_0xd200('0x4f')](get_open_tabs(_0xd200('0x56'),_0x1f944b[_0xd200('0x51')][_0x3f8f49][_0xd200('0x54')]));_0xd49cbc[_0xd200('0x4f')](get_open_tabs('mail',_0x1f944b[_0xd200('0x51')][_0x3f8f49][_0xd200('0x54')]));_0xd49cbc[_0xd200('0x4f')](get_open_tabs(_0xd200('0x57'),_0x1f944b['rows'][_0x3f8f49]['dataValues']));_0xd49cbc['push'](get_open_tabs(_0xd200('0x58'),_0x1f944b['rows'][_0x3f8f49][_0xd200('0x54')]));}return Promise[_0xd200('0x59')](_0xd49cbc)['then'](function(){return _0x1f944b;});}else{return _0x1f944b;}})[_0xd200('0x24')](respondWithFilteredResult(_0x3f8bad,_0x486450))[_0xd200('0x2f')](handleError(_0x3f8bad,null));};exports['show']=function(_0x570c49,_0x543dc5){var _0x15e92f=getUserAttributes();_0x570c49['query']['id']=_0x570c49['params']['id'];var _0xdc26e=qs[_0xd200('0x46')](_0x15e92f,_0x570c49);if(_0x570c49[_0xd200('0x49')][_0xd200('0x4a')]){_0xdc26e[_0xd200('0x5a')]=[{'all':!![]}];}if(_0x570c49[_0xd200('0x49')][_0xd200('0x4b')]===_0xd200('0x4c')){_0xdc26e[_0xd200('0x5a')]=[{'model':db[_0xd200('0x4d')],'as':_0xd200('0x4b')}];}_0xdc26e=_[_0xd200('0x5b')]({},_0xdc26e,_0x570c49['options']);if(!_[_0xd200('0x3a')](_0xdc26e['attributes'],'id')){_0xdc26e[_0xd200('0x4e')]['push']('id');}return db[_0xd200('0x48')][_0xd200('0x3b')](_0xdc26e)[_0xd200('0x24')](handleEntityNotFound(_0x543dc5,null))[_0xd200('0x24')](function(_0xe580bc){var _0x302781=[];values=_0xe580bc;if(_0x570c49[_0xd200('0x49')]['openTabs']==='true'){_0x302781[_0xd200('0x4f')](get_open_tabs('chat',_0xe580bc[_0xd200('0x54')]));_0x302781[_0xd200('0x4f')](get_open_tabs(_0xd200('0x55'),_0xe580bc['dataValues']));_0x302781[_0xd200('0x4f')](get_open_tabs(_0xd200('0x57'),_0xe580bc[_0xd200('0x54')]));_0x302781[_0xd200('0x4f')](get_open_tabs(_0xd200('0x58'),_0xe580bc[_0xd200('0x54')]));_0x302781['push'](get_open_tabs(_0xd200('0x56'),_0xe580bc['dataValues']));_0x302781[_0xd200('0x4f')](get_open_tabs(_0xd200('0x5c'),_0xe580bc['dataValues']));return Promise[_0xd200('0x59')](_0x302781);}else{return values;}})[_0xd200('0x24')](function(){return values;})[_0xd200('0x24')](respondWithResult(_0x543dc5,null))[_0xd200('0x2f')](handleError(_0x543dc5,null));};exports['update']=function(_0x446abe,_0xab2c1a){if(_0x446abe[_0xd200('0x5d')]['id']){delete _0x446abe[_0xd200('0x5d')]['id'];}delete _0x446abe[_0xd200('0x5d')][_0xd200('0x33')];return db[_0xd200('0x48')]['find']({'where':{'id':_0x446abe[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0xab2c1a,null))[_0xd200('0x24')](saveUpdates(_0x446abe['body'],null))[_0xd200('0x24')](respondWithResult(_0xab2c1a,null))['catch'](handleError(_0xab2c1a,null));};exports['describe']=function(_0x109bde,_0x3e0f8a){return db[_0xd200('0x48')]['describe']()[_0xd200('0x24')](respondWithResult(_0x3e0f8a,null))[_0xd200('0x2f')](handleError(_0x3e0f8a,null));};exports[_0xd200('0x5f')]=function(_0x2ff49d,_0x236400){return db[_0xd200('0x48')]['find']({'where':{'id':_0x2ff49d[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x236400,null))[_0xd200('0x24')](function(_0x488384){if(_0x488384){return _0x488384['addContacts'](_0x2ff49d[_0xd200('0x5d')]['ids'],_[_0xd200('0x60')](_0x2ff49d['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x236400,null))[_0xd200('0x2f')](handleError(_0x236400,null));};function validateUser(_0x3ec012){return new Promise(function(_0x29f6ee,_0xc6348a){if(_0x3ec012[_0xd200('0x61')])return _0x29f6ee(_0x3ec012);return db[_0xd200('0x62')][_0xd200('0x63')](0x1)[_0xd200('0x24')](function(_0x358545){if(_0x358545[_0xd200('0x64')])authService[_0xd200('0x65')](_0x3ec012[_0xd200('0x66')]);db[_0xd200('0x48')][_0xd200('0x67')]('internal')[_0xd200('0x24')](function(_0x5f320d){if(_['isNil'](_0x5f320d)){_0x3ec012['internal']=_0x358545[_0xd200('0x68')]||0x1;return;}if(_['isNil'](_0x358545[_0xd200('0x68')])||_0x358545[_0xd200('0x68')]===_0x5f320d){_0x3ec012[_0xd200('0x61')]=_0x5f320d+0x1;return;}if(_0x358545[_0xd200('0x68')]>_0x5f320d){_0x3ec012[_0xd200('0x61')]=_0x358545[_0xd200('0x68')];return;}return db['sequelize'][_0xd200('0x49')](_0xd200('0x69'),{'type':db[_0xd200('0x6a')]['QueryTypes'][_0xd200('0x6b')]})['then'](function(_0x30baa4){if(_0x30baa4&&_0x30baa4[_0xd200('0x6c')]){for(var _0x510c61=0x0,_0x44f36a=_0x30baa4['length'];_0x510c61<_0x44f36a&&_[_0xd200('0x6d')](_0x3ec012[_0xd200('0x61')]);_0x510c61++){if(_0x358545[_0xd200('0x68')]<=_0x30baa4[_0x510c61][_0xd200('0x6e')]){_0x3ec012[_0xd200('0x61')]=_0x30baa4[_0x510c61][_0xd200('0x6e')];}else if(_0x358545[_0xd200('0x68')]>_0x30baa4[_0x510c61][_0xd200('0x6e')]&&_0x358545[_0xd200('0x68')]<=_0x30baa4[_0x510c61]['to']){_0x3ec012['internal']=_0x358545[_0xd200('0x68')];}}}if(_[_0xd200('0x6d')](_0x3ec012['internal'])){_0x3ec012['internal']=_0x5f320d+0x1;}return _0x29f6ee(_0x3ec012);});});})[_0xd200('0x2f')](function(_0x243dcc){_0xc6348a(_0x243dcc);});});}function updateUser(_0x4d2aef){return new Promise(function(_0x447926,_0x2d7f66){try{if(_0x4d2aef[_0xd200('0x6f')]){_0x4d2aef['mailbox']=_0x4d2aef[_0xd200('0x61')];_0x4d2aef[_0xd200('0x70')]={'mailbox':_0x4d2aef[_0xd200('0x61')],'password':_0x4d2aef[_0xd200('0x66')],'fullname':_0x4d2aef['fullname'],'email':_0x4d2aef[_0xd200('0x71')]};}if(_0x4d2aef[_0xd200('0x33')]===_0xd200('0x31')){if(!_0x4d2aef[_0xd200('0x72')])_0x4d2aef[_0xd200('0x72')]=[_0xd200('0x73'),_0xd200('0x74'),_0xd200('0x75'),_0xd200('0x76'),'110',_0xd200('0x77'),_0xd200('0x78'),_0xd200('0x79'),_0xd200('0x7a'),_0xd200('0x7b'),_0xd200('0x7c'),_0xd200('0x7d'),_0xd200('0x7e'),_0xd200('0x7f'),'115'];}_0x447926(_0x4d2aef);}catch(_0x1ce871){_0x2d7f66(_0x1ce871);}});}exports['create']=function(_0x1ecc0d,_0x12fa87){if(_0x1ecc0d[_0xd200('0x80')][_0xd200('0x33')]===_0xd200('0x31'))throw new Error(_0xd200('0x81'));if(_0x1ecc0d[_0xd200('0x5d')]['role']===_0xd200('0x80')&&_0x1ecc0d[_0xd200('0x80')][_0xd200('0x33')]!=='admin'){throw new Error(_0xd200('0x82'));}if(_0x1ecc0d[_0xd200('0x5d')]['role']===_0xd200('0x34')&&_0x1ecc0d[_0xd200('0x80')][_0xd200('0x33')]!==_0xd200('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xd200('0x83')]([_0x1ecc0d['body']])[_0xd200('0x24')](function(){return validateUser(_0x1ecc0d[_0xd200('0x5d')]);})['then'](function(_0x4a0a99){return updateUser(_0x4a0a99)['then'](function(_0x39bb00){if(_0x39bb00[_0xd200('0x33')]==='admin'){_0x39bb00[_0xd200('0x84')]=_0x1ecc0d[_0xd200('0x80')]['settingsEnabled'];delete _0x39bb00[_0xd200('0x85')];}return _0x39bb00;});})[_0xd200('0x24')](function(_0x5591fe){return db['User'][_0xd200('0x86')](_0x5591fe,{'include':[{'model':db[_0xd200('0x70')],'as':_0xd200('0x70')}]});})['then'](function(_0x3670e9){if(_0x1ecc0d['body'][_0xd200('0x33')]===_0xd200('0x80'))return _0x3670e9;if(_0x1ecc0d[_0xd200('0x80')][_0xd200('0x33')]!==_0xd200('0x80'))return _0x3670e9;return db[_0xd200('0x87')][_0xd200('0x3b')]({'where':{'name':_0x3670e9['role']==='agent'?_0xd200('0x36'):'Telephones','userProfileId':_0x1ecc0d['user'][_0xd200('0x85')]},'raw':!![]})[_0xd200('0x24')](function(_0x5464e5){if(!_0x5464e5||_0x5464e5[_0xd200('0x88')]!=0x0)return _0x3670e9;return db['UserProfileResource'][_0xd200('0x86')]({'name':_0x3670e9['name'],'resourceId':_0x3670e9['id'],'type':_0x5464e5[_0xd200('0x3c')],'sectionId':_0x5464e5['id']},{})['then'](function(){return _0x3670e9;});})[_0xd200('0x2f')](function(_0x14f045){logger[_0xd200('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14f045);throw _0x14f045;});})['then'](respondWithResult(_0x12fa87,0xc9))[_0xd200('0x2f')](handleError(_0x12fa87,null));};exports['bulkCreate']=function(_0x435808,_0x371212){var _0x334678=_0x435808[_0xd200('0x5d')];var _0x272494=[];if(_0x435808['user']['role']===_0xd200('0x31'))throw new Error(_0xd200('0x81'));if(_['some'](_0x334678,[_0xd200('0x33'),_0xd200('0x80')])&&_0x435808[_0xd200('0x80')][_0xd200('0x33')]!=='admin'){throw new Error(_0xd200('0x82'));}if(_[_0xd200('0x89')](_0x334678,['role',_0xd200('0x34')])&&_0x435808[_0xd200('0x80')][_0xd200('0x33')]!==_0xd200('0x34')){throw new Error(_0xd200('0x8a'));}return licenseUtil[_0xd200('0x83')](_0x334678)[_0xd200('0x24')](function(){return validateUser(_0x334678[0x0]);})[_0xd200('0x24')](function(){for(var _0x55194e=0x1;_0x55194e<_0x334678[_0xd200('0x6c')];_0x55194e++){var _0x20856f=_0x334678[_0x55194e-0x1]['internal'];if(!_0x334678[_0x55194e][_0xd200('0x61')])_0x334678[_0x55194e][_0xd200('0x61')]=_0x20856f+0x1;_0x272494[_0xd200('0x4f')](validateUser(_0x334678[_0x55194e]));}return Promise[_0xd200('0x59')](_0x272494);})[_0xd200('0x24')](function(){_0x272494=[];for(var _0x2ff0a2=0x0;_0x2ff0a2<_0x334678['length'];_0x2ff0a2++){_0x272494[_0xd200('0x4f')](updateUser(_0x334678[_0x2ff0a2]));}return Promise[_0xd200('0x59')](_0x272494);})[_0xd200('0x24')](function(){_0x272494=_0x334678[_0xd200('0x38')](function(_0x44a2e1){return db[_0xd200('0x48')]['create'](_0x44a2e1,{'include':[{'model':db[_0xd200('0x70')],'as':_0xd200('0x70')}]})[_0xd200('0x24')](function(_0x446d3e){_0x44a2e1['id']=_0x446d3e['id'];return _0x44a2e1;});});return Promise[_0xd200('0x59')](_0x272494);})[_0xd200('0x24')](function(_0x55f590){if(_0x435808[_0xd200('0x5d')]['role']==='user')return _0x55f590;if(_0x435808[_0xd200('0x80')][_0xd200('0x33')]!=='user')return _0x55f590;var _0x3e7a39=_[_0xd200('0x89')](_0x55f590,function(_0x376bcd){return _0x376bcd['role']==='agent'||_0x376bcd['role']===_0xd200('0x8b');});if(!_0x3e7a39)return _0x55f590;return db[_0xd200('0x87')][_0xd200('0x50')]({'where':{'name':{'$or':[_0xd200('0x36'),'Telephones']},'userProfileId':_0x435808[_0xd200('0x80')]['userProfileId']},'raw':!![]})[_0xd200('0x24')](function(_0x129184){if(_['isEmpty'](_0x129184)||!_[_0xd200('0x89')](_0x129184,[_0xd200('0x88'),0x0]))return _0x55f590;_0x272494=[];var _0x278f8a=_(_0x129184)[_0xd200('0x38')](function(_0x2c9349){if(_0x2c9349[_0xd200('0x88')]===0x1)return;return _0x2c9349[_0xd200('0x3c')]===_0xd200('0x36')?_0xd200('0x31'):_0xd200('0x8b');})[_0xd200('0x8c')]()[_0xd200('0x39')]();for(var _0x3fe8b6=0x0;_0x3fe8b6<_0x55f590[_0xd200('0x6c')];_0x3fe8b6++){if(!_[_0xd200('0x3a')](_0x278f8a,_0x55f590[_0x3fe8b6][_0xd200('0x33')]))return;var _0x417449=_0x55f590[_0x3fe8b6][_0xd200('0x33')]==='agent'?_0xd200('0x36'):_0xd200('0x8d');_0x272494[_0xd200('0x4f')](db[_0xd200('0x8e')][_0xd200('0x86')]({'name':_0x55f590[_0x3fe8b6][_0xd200('0x3c')],'resourceId':_0x55f590[_0x3fe8b6]['id'],'type':_0x417449,'sectionId':_[_0xd200('0x3b')](_0x129184,[_0xd200('0x3c'),_0x417449])['id']},{}));}return Promise['all'](_0x272494);});})[_0xd200('0x24')](respondWithResult(_0x371212,0xc9))[_0xd200('0x2f')](handleError(_0x371212,null));};exports[_0xd200('0x8f')]=function(_0x4ff86b,_0x59dc79){if(_0x4ff86b[_0xd200('0x5d')]['id']){delete _0x4ff86b[_0xd200('0x5d')]['id'];}return db[_0xd200('0x48')]['find']({'where':{'id':_0x4ff86b[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](function(_0x3f1a19){if(!_0x3f1a19)return null;if(_0x3f1a19['id']===_0x4ff86b[_0xd200('0x80')]['id']){if(!_0x4ff86b['body'][_0xd200('0x90')]||!_0x4ff86b[_0xd200('0x5d')][_0xd200('0x91')]){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3f1a19[_0xd200('0x94')](_0x4ff86b[_0xd200('0x5d')][_0xd200('0x90')])){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0x95'));}if(_0x4ff86b[_0xd200('0x5d')]['oldPassword']===_0x4ff86b[_0xd200('0x5d')][_0xd200('0x91')]){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0x96'));}}else if(_0x4ff86b['user'][_0xd200('0x33')]===_0xd200('0x34')){if(!_0x4ff86b[_0xd200('0x5d')][_0xd200('0x91')]){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4ff86b[_0xd200('0x80')][_0xd200('0x33')]==='user'){if(!_0x4ff86b['body'][_0xd200('0x91')]){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0x97'));}if(_0x3f1a19[_0xd200('0x33')]!==_0xd200('0x31')){throw new db['Sequelize']['ValidationError']('Unauthorized');}}else{throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0x81'));}return _0x3f1a19;})[_0xd200('0x24')](handleEntityNotFound(_0x59dc79,null))[_0xd200('0x24')](function(_0x54fbc2){return db[_0xd200('0x62')]['findOne']({'attributes':['id',_0xd200('0x64'),_0xd200('0x98'),_0xd200('0x99')]})['then'](function(_0x513988){if(_0x513988[_0xd200('0x64')])authService[_0xd200('0x65')](_0x4ff86b[_0xd200('0x5d')][_0xd200('0x91')]);if(!_0x513988[_0xd200('0x98')]||!_0x54fbc2[_0xd200('0x9a')])return _0x54fbc2;authService[_0xd200('0x9b')](_0x4ff86b[_0xd200('0x5d')]['newPassword'],_0x54fbc2[_0xd200('0x9a')],_0x513988['passwordHistoryLimit']);return _0x54fbc2;})[_0xd200('0x24')](saveUpdates({'password':_0x4ff86b[_0xd200('0x5d')]['newPassword'],'passwordResetAt':_0x4ff86b[_0xd200('0x80')]['id']==_0x4ff86b[_0xd200('0x5e')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4ff86b[_0xd200('0x5d')][_0xd200('0x91')],_0x54fbc2['previousPasswords'])},null));})[_0xd200('0x24')](respondWithResult(_0x59dc79,null))[_0xd200('0x2f')](handleError(_0x59dc79,null));};exports[_0xd200('0x9c')]=function(_0x56b1fb,_0x1cf537){var _0x35ced3=_0x56b1fb[_0xd200('0x5d')][_0xd200('0x9d')];return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0x56b1fb['params']['id']},'attributes':['id',_0xd200('0x3c'),_0xd200('0x33'),'online',_0xd200('0x9e'),_0xd200('0x9f'),_0xd200('0xa0')]})[_0xd200('0x24')](handleEntityNotFound(_0x1cf537,null))[_0xd200('0x24')](function(_0x135f1d){if(_0x135f1d){if(!utils[_0xd200('0xa1')](_0x35ced3)){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0xa2'));}return _0x135f1d['add'+_['capitalize'](_0x35ced3[_0xd200('0xa3')]())+'Queues'](_0x56b1fb['body'][_0xd200('0xa4')],{'penalty':_0x56b1fb[_0xd200('0x5d')][_0xd200('0xa5')]||0x0})[_0xd200('0xa6')](function(_0x494acf){for(var _0x12e336=0x0;_0x12e336<_0x56b1fb[_0xd200('0x5d')]['ids'][_0xd200('0x6c')];_0x12e336+=0x1){var _0x3972ea={'UserId':Number(_0x56b1fb[_0xd200('0x5e')]['id'])};_0x3972ea[_[_0xd200('0xa7')](_0x35ced3['toLowerCase']())+_0xd200('0xa8')]=Number(_0x56b1fb[_0xd200('0x5d')][_0xd200('0xa4')][_0x12e336]);socket['emit'](_0xd200('0x80')+_[_0xd200('0xa7')](_0x35ced3['toLowerCase']())+_0xd200('0xa9'),_0x3972ea);}return _0x494acf;})[_0xd200('0x24')](function(){if(_0x35ced3===_0xd200('0xaa')){return db[_0xd200('0xab')]['findAll']({'where':{'id':_0x56b1fb[_0xd200('0x5d')][_0xd200('0xa4')]||[]},'raw':!![],'attributes':['id',_0xd200('0x3c')]});}})['then'](function(_0x1327a9){var _0x41055d=_0x135f1d[_0xd200('0xac')]({'plain':!![]});var _0x45716c=[];if(_0x35ced3==='voice'&&_0x41055d[_0xd200('0x33')]===_0xd200('0x31')&&_0x41055d['online']){for(let _0x521c5f=0x0;_0x521c5f<_0x1327a9[_0xd200('0x6c')];_0x521c5f+=0x1){_0x45716c[_0xd200('0x4f')]({'membername':_0x41055d['name'],'UserId':_0x41055d['id'],'queue_name':_0x1327a9[_0x521c5f]['name'],'VoiceQueueId':_0x1327a9[_0x521c5f]['id'],'interface':_[_0xd200('0x6d')](_0x41055d['interface'])?util['format']('SIP/%s',_0x41055d[_0xd200('0x3c')]):_0x41055d[_0xd200('0xa0')],'paused':_0x41055d[_0xd200('0x9f')]||![],'penalty':_0x56b1fb[_0xd200('0x5d')][_0xd200('0xa5')]||0x0});}return Promise['all'](_0x45716c['map'](function(_0x47443d){return db[_0xd200('0xad')][_0xd200('0xae')](_0x47443d);}));}return _0x135f1d;});}})[_0xd200('0x24')](respondWithStatusCode(_0x1cf537,null))[_0xd200('0x2f')](handleError(_0x1cf537,null));};exports[_0xd200('0xaf')]=function(_0x280a6b,_0x5a4102){var _0x361632,_0x45d105;return db[_0xd200('0x48')]['find']({'where':{'id':_0x280a6b[_0xd200('0x5e')]['id']},'attributes':['id',_0xd200('0x3c'),_0xd200('0x33')]})['then'](handleEntityNotFound(_0x5a4102,null))['then'](function(_0x258ee5){if(_0x258ee5){_0x361632=_0x258ee5;if(!_0x280a6b['query'][_0xd200('0x9d')]||!utils[_0xd200('0xa1')](_0x280a6b[_0xd200('0x49')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xd200('0xa2'));}return _0x258ee5[_0xd200('0xb0')+_[_0xd200('0xa7')](_0x280a6b[_0xd200('0x49')][_0xd200('0x9d')]['toLowerCase']())+_0xd200('0xb1')](_0x280a6b[_0xd200('0x49')][_0xd200('0xa4')]);}})['then'](function(_0x1bc3aa){if(_['isArray'](_0x280a6b[_0xd200('0x49')][_0xd200('0xa4')])){for(var _0x161b52=0x0;_0x161b52<_0x280a6b['query'][_0xd200('0xa4')][_0xd200('0x6c')];_0x161b52+=0x1){_0x45d105={'UserId':Number(_0x280a6b[_0xd200('0x5e')]['id'])};_0x45d105[_[_0xd200('0xa7')](_0x280a6b[_0xd200('0x49')]['channel'][_0xd200('0xa3')]())+_0xd200('0xa8')]=Number(_0x280a6b[_0xd200('0x49')][_0xd200('0xa4')][_0x161b52]);socket[_0xd200('0xb2')](_0xd200('0x80')+_[_0xd200('0xa7')](_0x280a6b[_0xd200('0x49')][_0xd200('0x9d')][_0xd200('0xa3')]())+_0xd200('0xb3'),_0x45d105);}}else{_0x45d105={'UserId':Number(_0x280a6b[_0xd200('0x5e')]['id'])};_0x45d105[_['capitalize'](_0x280a6b[_0xd200('0x49')]['channel'][_0xd200('0xa3')]())+'QueueId']=Number(_0x280a6b[_0xd200('0x49')][_0xd200('0xa4')]);socket[_0xd200('0xb2')](_0xd200('0x80')+_[_0xd200('0xa7')](_0x280a6b[_0xd200('0x49')]['channel'][_0xd200('0xa3')]())+_0xd200('0xb3'),_0x45d105);}return _0x1bc3aa;})[_0xd200('0x24')](function(){if(_0x280a6b[_0xd200('0x49')]['channel']==='voice'){return db[_0xd200('0xad')]['destroy']({'where':{'UserId':_0x280a6b[_0xd200('0x5e')]['id'],'VoiceQueueId':_0x280a6b[_0xd200('0x49')]['ids']},'individualHooks':!![]})[_0xd200('0x24')](function(){return _0x361632;});}return _0x361632;})['then'](respondWithStatusCode(_0x5a4102,null))[_0xd200('0x2f')](handleError(_0x5a4102,null));};exports[_0xd200('0xb4')]=function(_0xa36062,_0x419952){_0xa36062[_0xd200('0x5d')][_0xd200('0xb5')]=_0xa36062[_0xd200('0xb6')][_0xd200('0xb7')];return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0xa36062[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x419952,null))[_0xd200('0x24')](saveUpdates(_0xa36062[_0xd200('0x5d')],null))['then'](respondWithResult(_0x419952,null))['catch'](handleError(_0x419952,null));};exports['getAvatar']=function(_0x27e0e1,_0x537b03){var _0x169615=path[_0xd200('0xb8')](config[_0xd200('0xb9')],_0xd200('0xba'));return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0x27e0e1['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xd200('0x24')](handleEntityNotFound(_0x537b03,null))['then'](function(_0x5b2dcf){if(_0x5b2dcf){if(_[_0xd200('0x6d')](_0x5b2dcf['userpic'])){return _0x537b03['download'](_0x169615);}else{if(!fs[_0xd200('0xbb')](path[_0xd200('0xb8')](config[_0xd200('0xb9')],'server/files/images/',_0x5b2dcf[_0xd200('0xb5')]))){return _0x537b03['download'](_0x169615);}return _0x537b03['download'](path[_0xd200('0xb8')](config[_0xd200('0xb9')],'server/files/images/',_0x5b2dcf['userpic']));}}})[_0xd200('0x2f')](handleError(_0x537b03,null));};exports[_0xd200('0xbc')]=function(_0x235bc9,_0x479dc7){return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0x235bc9[_0xd200('0x5e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x479dc7,null))[_0xd200('0x24')](function(_0xa4c3a2){var _0x26c35f=[];values=_0xa4c3a2[_0xd200('0x54')];_0x26c35f['push'](get_open_tabs('chat',_0xa4c3a2[_0xd200('0x54')]));_0x26c35f[_0xd200('0x4f')](get_open_tabs(_0xd200('0x55'),_0xa4c3a2[_0xd200('0x54')]));_0x26c35f['push'](get_open_tabs(_0xd200('0x57'),_0xa4c3a2['dataValues']));_0x26c35f[_0xd200('0x4f')](get_open_tabs(_0xd200('0x58'),_0xa4c3a2[_0xd200('0x54')]));_0x26c35f[_0xd200('0x4f')](get_open_tabs('fax',_0xa4c3a2[_0xd200('0x54')]));_0x26c35f['push'](get_open_tabs(_0xd200('0x5c'),_0xa4c3a2[_0xd200('0x54')]));return Promise[_0xd200('0x59')](_0x26c35f);})[_0xd200('0x24')](function(_0x1b3567){if(_0x1b3567){var _0x3d4df2=_['map'](values[_0xd200('0xbd')],function(_0x5c657d){return{'channel':_0xd200('0xbe'),'id':_0x5c657d['id'],'createdAt':_0x5c657d[_0xd200('0xbf')]};});var _0x2a40b3=_['map'](values[_0xd200('0xc0')],function(_0x176258){return{'channel':_0xd200('0xc1'),'id':_0x176258['id'],'createdAt':_0x176258['createdAt']};});var _0x520181=_['map'](values[_0xd200('0xc2')],function(_0x23eeb3){return{'channel':'OPENCHANNEL','id':_0x23eeb3['id'],'createdAt':_0x23eeb3[_0xd200('0xbf')]};});var _0xaaa5a5=_[_0xd200('0x38')](values[_0xd200('0xc3')],function(_0x583542){return{'channel':_0xd200('0xc4'),'id':_0x583542['id'],'createdAt':_0x583542['createdAt']};});var _0x474617=_[_0xd200('0x38')](values[_0xd200('0xc5')],function(_0x2b1ce0){return{'channel':'SMS','id':_0x2b1ce0['id'],'createdAt':_0x2b1ce0[_0xd200('0xbf')]};});var _0x431bd7=_[_0xd200('0x38')](values[_0xd200('0xc6')],function(_0x4198da){return{'channel':_0xd200('0xc7'),'id':_0x4198da['id'],'createdAt':_0x4198da['createdAt']};});var _0x3a0dea=_[_0xd200('0xc8')](_0x3d4df2,_0x2a40b3,_0x520181,_0xaaa5a5,_0x474617,_0x431bd7);var _0x1b1dde={'count':_0x3a0dea[_0xd200('0x6c')],'rows':_0x3a0dea};return _0x1b1dde;}else return null;})[_0xd200('0x24')](respondWithResult(_0x479dc7,null))['catch'](handleError(_0x479dc7,null));};exports['getContacts']=function(_0x5dfd79,_0x5f4dd1){var _0xaf3f77={};return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x5dfd79[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](function(_0x54d767){if(!_0x54d767){throw new APINotFoundError(util[_0xd200('0xca')](_0xd200('0xcb'),_0x5dfd79[_0xd200('0x5e')]['id']));}return contacts[_0xd200('0xcc')]();})[_0xd200('0x24')](function(_0x223400){_0x5dfd79['query'][_0xd200('0x48')]=_0x5dfd79[_0xd200('0x5e')]['id'];_0xaf3f77=qs[_0xd200('0x46')](_0x223400,_0x5dfd79);if(_0x5dfd79[_0xd200('0x49')]['hasOwnProperty']('includeAll')){_0xaf3f77[_0xd200('0x5a')]=[{'model':db['CmList'],'as':_0xd200('0xcd'),'required':![]},{'model':db[_0xd200('0xce')],'as':_0xd200('0xcf'),'attributes':['id',_0xd200('0x3c'),_0xd200('0xd0')],'where':_0x5dfd79['query'][_0xd200('0xd1')]?{'id':_0x5dfd79['query'][_0xd200('0xd1')]}:undefined,'required':_0x5dfd79[_0xd200('0x49')][_0xd200('0xd1')]?!![]:![]}];}return contacts[_0xd200('0x50')](_0x5dfd79['query'],_0x5dfd79['user'],_0xaf3f77,_0x223400);})[_0xd200('0x24')](respondWithFilteredResult(_0x5f4dd1,_0xaf3f77))[_0xd200('0x2f')](APIHandleError(_0x5f4dd1));};exports[_0xd200('0xd2')]=function(_0x2ababe,_0x5139f1){var _0x2bd8ad;var _0x4e554d={};var _0x3dbb29;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x2ababe[_0xd200('0x5e')]['id']},'attributes':['id','name',_0xd200('0x33')]})[_0xd200('0x24')](handleEntityNotFound(_0x5139f1,null))[_0xd200('0x24')](function(_0x217012){if(!utils[_0xd200('0xa1')](_0x2ababe[_0xd200('0x49')][_0xd200('0x9d')])){throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))](_0xd200('0xa2'));}_0x2bd8ad=_0x217012;var _0x514eda={};_0x514eda[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_[_0xd200('0xa7')](_0x2ababe[_0xd200('0x49')][_0xd200('0x9d')])+_0xd200('0xd5')][_0xd200('0x3e')]);_0x514eda[_0xd200('0x49')]=_[_0xd200('0xd4')](_0x2ababe[_0xd200('0x49')]);_0x514eda[_0xd200('0xd6')]=_[_0xd200('0xd7')](_0x514eda['model'],_0x514eda['query']);_0x4e554d[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x514eda[_0xd200('0xd3')],qs['fields'](_0x2ababe[_0xd200('0x49')][_0xd200('0xd8')]));_0x4e554d['attributes']=_0x4e554d['attributes'][_0xd200('0x6c')]?_0x4e554d['attributes']:_0x514eda[_0xd200('0xd3')];_0x4e554d[_0xd200('0xd9')]=qs['sort'](_0x2ababe[_0xd200('0x49')][_0xd200('0xda')]);_0x4e554d['where']=qs['filters'](_[_0xd200('0xdb')](_0x2ababe[_0xd200('0x49')],_0x514eda['filters']));if(_0x2ababe[_0xd200('0x49')][_0xd200('0x41')]){_0x4e554d[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x4e554d['where'],{'$or':_[_0xd200('0x38')](_0x4e554d['attributes'],function(_0x5b42bd){var _0x318a7a={};_0x318a7a[_0x5b42bd]={'$like':'%'+_0x2ababe[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x318a7a;})});}_0x4e554d=_[_0xd200('0x5b')]({},_0x4e554d,_0x2ababe[_0xd200('0xdc')]);switch(_0x2bd8ad[_0xd200('0x33')]){case'admin':return db[_['capitalize'](_0x2ababe[_0xd200('0x49')][_0xd200('0x9d')])+_0xd200('0xd5')][_0xd200('0x50')](_0x4e554d);case'user':case'agent':return _0x2bd8ad[_0xd200('0xac')+_[_0xd200('0xa7')](_0x2ababe[_0xd200('0x49')]['channel'])+_0xd200('0xb1')](_0x4e554d);default:throw new db['Sequelize'][(_0xd200('0x93'))]('Unknown\x20role');}})[_0xd200('0x24')](function(_0x20bec4){_0x3dbb29=_0x20bec4['length'];if(!_0x2ababe[_0xd200('0x49')][_0xd200('0xdd')](_0xd200('0xde'))){_0x4e554d[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x2ababe[_0xd200('0x49')][_0xd200('0x1f')]);_0x4e554d[_0xd200('0x1e')]=qs[_0xd200('0x1e')](_0x2ababe[_0xd200('0x49')][_0xd200('0x1e')]);}switch(_0x2bd8ad[_0xd200('0x33')]){case _0xd200('0x34'):return db[_[_0xd200('0xa7')](_0x2ababe['query'][_0xd200('0x9d')])+_0xd200('0xd5')]['findAll'](_0x4e554d);case _0xd200('0x80'):case _0xd200('0x31'):return _0x2bd8ad[_0xd200('0xac')+_['capitalize'](_0x2ababe[_0xd200('0x49')]['channel'])+_0xd200('0xb1')](_0x4e554d);}})['then'](function(_0x221314){return{'count':_0x3dbb29,'rows':_0x221314};})[_0xd200('0x24')](respondWithResult(_0x5139f1,null))[_0xd200('0x2f')](handleError(_0x5139f1,null));};exports[_0xd200('0xdf')]=function(_0x30f9a7,_0x4dcdc7){var _0x154be7={};var _0x50a41e={};var _0x44f883;var _0x13d73;return db['User'][_0xd200('0xc9')]({'where':{'id':_0x30f9a7['params']['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x4dcdc7,null))[_0xd200('0x24')](function(_0x642959){if(_0x642959){_0x44f883=_0x642959;_0x50a41e[_0xd200('0xd3')]=_['keys'](db['UserVoiceQueueRt'][_0xd200('0x3e')]);_0x50a41e[_0xd200('0x49')]=_['keys'](_0x30f9a7['query']);_0x50a41e['filters']=_['intersection'](_0x50a41e['model'],_0x50a41e[_0xd200('0x49')]);_0x154be7['attributes']=_[_0xd200('0xd7')](_0x50a41e[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x30f9a7[_0xd200('0x49')][_0xd200('0xd8')]));_0x154be7[_0xd200('0x4e')]=_0x154be7[_0xd200('0x4e')]['length']?_0x154be7[_0xd200('0x4e')]:_0x50a41e[_0xd200('0xd3')];_0x154be7[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x30f9a7[_0xd200('0x49')][_0xd200('0xda')]);_0x154be7[_0xd200('0x47')]=qs['filters'](_[_0xd200('0xdb')](_0x30f9a7[_0xd200('0x49')],_0x50a41e[_0xd200('0xd6')]));if(_0x30f9a7[_0xd200('0x49')]['filter']){_0x154be7[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x154be7[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x154be7[_0xd200('0x4e')],function(_0x316346){var _0x1d5bff={};_0x1d5bff[_0x316346]={'$like':'%'+_0x30f9a7['query'][_0xd200('0x41')]+'%'};return _0x1d5bff;})});}_0x154be7=_[_0xd200('0x5b')]({},_0x154be7,_0x30f9a7[_0xd200('0xdc')]);return _0x44f883[_0xd200('0xdf')](_0x154be7);}})[_0xd200('0x24')](function(_0x1185de){if(_0x1185de){_0x13d73=_0x1185de[_0xd200('0x6c')];if(!_0x30f9a7[_0xd200('0x49')]['hasOwnProperty'](_0xd200('0xde'))){_0x154be7[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x30f9a7['query'][_0xd200('0x1f')]);_0x154be7[_0xd200('0x1e')]=qs['offset'](_0x30f9a7[_0xd200('0x49')][_0xd200('0x1e')]);}return _0x44f883['getVoiceQueuesRt'](_0x154be7);}})[_0xd200('0x24')](function(_0x102316){if(_0x102316){return _0x102316?{'count':_0x13d73,'rows':_0x102316}:null;}})[_0xd200('0x24')](respondWithResult(_0x4dcdc7,null))[_0xd200('0x2f')](handleError(_0x4dcdc7,null));};exports[_0xd200('0xe0')]=function(_0x2d2df3,_0x347a17){var _0x50f0ef={};var _0x6199c7={};var _0x4de931;var _0x52132a;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x2d2df3['params']['id']}})['then'](handleEntityNotFound(_0x347a17,null))[_0xd200('0x24')](function(_0x31b657){if(_0x31b657){_0x4de931=_0x31b657;_0x6199c7[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0xe1')][_0xd200('0x3e')]);_0x6199c7[_0xd200('0x49')]=_['keys'](_0x2d2df3['query']);_0x6199c7[_0xd200('0xd6')]=_[_0xd200('0xd7')](_0x6199c7[_0xd200('0xd3')],_0x6199c7['query']);_0x50f0ef['attributes']=_[_0xd200('0xd7')](_0x6199c7[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x2d2df3[_0xd200('0x49')][_0xd200('0xd8')]));_0x50f0ef[_0xd200('0x4e')]=_0x50f0ef[_0xd200('0x4e')][_0xd200('0x6c')]?_0x50f0ef[_0xd200('0x4e')]:_0x6199c7[_0xd200('0xd3')];_0x50f0ef[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x2d2df3[_0xd200('0x49')][_0xd200('0xda')]);_0x50f0ef[_0xd200('0x47')]=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x2d2df3[_0xd200('0x49')],_0x6199c7['filters']));if(_0x2d2df3[_0xd200('0x49')][_0xd200('0x41')]){_0x50f0ef[_0xd200('0x47')]=_['merge'](_0x50f0ef['where'],{'$or':_[_0xd200('0x38')](_0x50f0ef[_0xd200('0x4e')],function(_0x49af35){var _0x437b84={};_0x437b84[_0x49af35]={'$like':'%'+_0x2d2df3['query']['filter']+'%'};return _0x437b84;})});}_0x50f0ef=_[_0xd200('0x5b')]({},_0x50f0ef,_0x2d2df3[_0xd200('0xdc')]);return _0x4de931[_0xd200('0xe0')](_0x50f0ef);}})[_0xd200('0x24')](function(_0x199f31){if(_0x199f31){_0x52132a=_0x199f31[_0xd200('0x6c')];if(!_0x2d2df3[_0xd200('0x49')][_0xd200('0xdd')]('nolimit')){_0x50f0ef[_0xd200('0x1f')]=qs['limit'](_0x2d2df3[_0xd200('0x49')][_0xd200('0x1f')]);_0x50f0ef[_0xd200('0x1e')]=qs['offset'](_0x2d2df3[_0xd200('0x49')]['offset']);}return _0x4de931[_0xd200('0xe0')](_0x50f0ef);}})[_0xd200('0x24')](function(_0x58d99d){if(_0x58d99d){return _0x58d99d?{'count':_0x52132a,'rows':_0x58d99d}:null;}})[_0xd200('0x24')](respondWithResult(_0x347a17,null))[_0xd200('0x2f')](handleError(_0x347a17,null));};exports['getRecordings']=function(_0x27a21f,_0xdf3176){var _0x2afc8e={'raw':!![],'where':{}};var _0x2eceab={};var _0x3e6a25={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x27a21f[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0xdf3176,null))[_0xd200('0x24')](function(_0x51499e){if(_0x51499e){_0x2eceab[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0xe2')][_0xd200('0x3e')]);_0x2eceab['query']=_['keys'](_0x27a21f[_0xd200('0x49')]);_0x2eceab[_0xd200('0xd6')]=_['intersection'](_0x2eceab['model'],_0x2eceab[_0xd200('0x49')]);_0x2afc8e[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x2eceab[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x27a21f['query']['fields']));_0x2afc8e[_0xd200('0x4e')]=_0x2afc8e[_0xd200('0x4e')][_0xd200('0x6c')]?_0x2afc8e[_0xd200('0x4e')]:_0x2eceab['model'];if(!_0x27a21f[_0xd200('0x49')][_0xd200('0xdd')]('nolimit')){_0x2afc8e[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x27a21f[_0xd200('0x49')][_0xd200('0x1f')]);_0x2afc8e[_0xd200('0x1e')]=qs[_0xd200('0x1e')](_0x27a21f[_0xd200('0x49')][_0xd200('0x1e')]);}_0x2afc8e[_0xd200('0xd9')]=qs['sort'](_0x27a21f[_0xd200('0x49')][_0xd200('0xda')]);_0x2afc8e['where']=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x27a21f['query'],_0x2eceab[_0xd200('0xd6')]));_0x2afc8e[_0xd200('0x47')][_0xd200('0xe3')]=_0x51499e['id'];if(_0x27a21f[_0xd200('0x49')]['filter']){_0x2afc8e[_0xd200('0x47')]=_['merge'](_0x2afc8e[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x2afc8e[_0xd200('0x4e')],function(_0x149ce9){var _0x552de3={};_0x552de3[_0x149ce9]={'$like':'%'+_0x27a21f[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x552de3;})});}_0x2afc8e=_[_0xd200('0x5b')]({},_0x2afc8e,_0x27a21f['options']);return db[_0xd200('0xe2')]['count']({'where':_0x2afc8e[_0xd200('0x47')]})[_0xd200('0x24')](function(_0x289bc6){_0x3e6a25[_0xd200('0x21')]=_0x289bc6;if(_0x27a21f['query'][_0xd200('0x4a')]){_0x2afc8e[_0xd200('0x5a')]=[{'all':!![]}];}return db['VoiceRecording'][_0xd200('0x50')](_0x2afc8e);})[_0xd200('0x24')](function(_0x5c16a5){_0x3e6a25[_0xd200('0x51')]=_0x5c16a5;return _0x3e6a25;});}})[_0xd200('0x24')](respondWithFilteredResult(_0xdf3176,_0x2afc8e))[_0xd200('0x2f')](handleError(_0xdf3176,null));};exports[_0xd200('0xe4')]=function(_0x256e69,_0x9cb204){var _0x496f59={'raw':!![],'where':{}};var _0x42bbf0={};var _0x2b12e0={'count':0x0,'rows':[]};return db['User'][_0xd200('0xc9')]({'where':{'id':_0x256e69[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x9cb204,null))[_0xd200('0x24')](function(_0x119803){if(_0x119803){_0x42bbf0['model']=_[_0xd200('0xd4')](db['ScreenRecording']['rawAttributes']);_0x42bbf0[_0xd200('0x49')]=_['keys'](_0x256e69['query']);_0x42bbf0[_0xd200('0xd6')]=_['intersection'](_0x42bbf0[_0xd200('0xd3')],_0x42bbf0[_0xd200('0x49')]);_0x496f59[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x42bbf0[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x256e69[_0xd200('0x49')][_0xd200('0xd8')]));_0x496f59[_0xd200('0x4e')]=_0x496f59[_0xd200('0x4e')][_0xd200('0x6c')]?_0x496f59['attributes']:_0x42bbf0[_0xd200('0xd3')];if(!_0x256e69['query'][_0xd200('0xdd')](_0xd200('0xde'))){_0x496f59['limit']=qs[_0xd200('0x1f')](_0x256e69['query']['limit']);_0x496f59['offset']=qs[_0xd200('0x1e')](_0x256e69[_0xd200('0x49')]['offset']);}_0x496f59['order']=qs[_0xd200('0xda')](_0x256e69['query'][_0xd200('0xda')]);_0x496f59[_0xd200('0x47')]=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x256e69[_0xd200('0x49')],_0x42bbf0[_0xd200('0xd6')]));_0x496f59[_0xd200('0x47')]['UserId']=_0x119803['id'];if(_0x256e69[_0xd200('0x49')][_0xd200('0x41')]){_0x496f59[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x496f59[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x496f59['attributes'],function(_0x2ab907){var _0x179506={};_0x179506[_0x2ab907]={'$like':'%'+_0x256e69['query'][_0xd200('0x41')]+'%'};return _0x179506;})});}_0x496f59=_['merge']({},_0x496f59,_0x256e69['options']);return db['ScreenRecording'][_0xd200('0x21')]({'where':_0x496f59[_0xd200('0x47')]})[_0xd200('0x24')](function(_0x5e237a){_0x2b12e0[_0xd200('0x21')]=_0x5e237a;if(_0x256e69[_0xd200('0x49')][_0xd200('0x4a')]){_0x496f59[_0xd200('0x5a')]=[{'all':!![]}];}return db[_0xd200('0xe5')]['findAll'](_0x496f59);})[_0xd200('0x24')](function(_0x5c4f89){_0x2b12e0[_0xd200('0x51')]=_0x5c4f89;return _0x2b12e0;});}})[_0xd200('0x24')](respondWithFilteredResult(_0x9cb204,_0x496f59))[_0xd200('0x2f')](handleError(_0x9cb204,null));};exports[_0xd200('0xe6')]=function(_0x25103d,_0x1c50ce){var _0x50cb00={};var _0x3b4384={};var _0x380dfc;var _0x367611;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x25103d[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x1c50ce,null))['then'](function(_0x52915f){if(_0x52915f){_0x380dfc=_0x52915f;_0x3b4384[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0xe7')]['rawAttributes']);_0x3b4384[_0xd200('0x49')]=_[_0xd200('0xd4')](_0x25103d[_0xd200('0x49')]);_0x3b4384['filters']=_[_0xd200('0xd7')](_0x3b4384[_0xd200('0xd3')],_0x3b4384[_0xd200('0x49')]);_0x50cb00[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x3b4384[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x25103d[_0xd200('0x49')]['fields']));_0x50cb00['attributes']=_0x50cb00[_0xd200('0x4e')][_0xd200('0x6c')]?_0x50cb00[_0xd200('0x4e')]:_0x3b4384[_0xd200('0xd3')];_0x50cb00[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x25103d['query'][_0xd200('0xda')]);_0x50cb00[_0xd200('0x47')]=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x25103d[_0xd200('0x49')],_0x3b4384[_0xd200('0xd6')]));if(_0x25103d[_0xd200('0x49')]['filter']){_0x50cb00['where']=_[_0xd200('0x5b')](_0x50cb00[_0xd200('0x47')],{'$or':_['map'](_0x50cb00[_0xd200('0x4e')],function(_0x4effe2){var _0x36292e={};_0x36292e[_0x4effe2]={'$like':'%'+_0x25103d[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x36292e;})});}_0x50cb00=_[_0xd200('0x5b')]({},_0x50cb00,_0x25103d[_0xd200('0xdc')]);return _0x380dfc[_0xd200('0xe6')](_0x50cb00);}})['then'](function(_0x5f2b86){if(_0x5f2b86){_0x367611=_0x5f2b86['length'];if(!_0x25103d['query'][_0xd200('0xdd')]('nolimit')){_0x50cb00['limit']=qs[_0xd200('0x1f')](_0x25103d[_0xd200('0x49')]['limit']);_0x50cb00[_0xd200('0x1e')]=qs[_0xd200('0x1e')](_0x25103d['query'][_0xd200('0x1e')]);}return _0x380dfc[_0xd200('0xe6')](_0x50cb00);}})['then'](function(_0x59856b){if(_0x59856b){return _0x59856b?{'count':_0x367611,'rows':_0x59856b}:null;}})[_0xd200('0x24')](respondWithResult(_0x1c50ce,null))[_0xd200('0x2f')](handleError(_0x1c50ce,null));};exports[_0xd200('0xe8')]=function(_0x4cb893,_0x5e6c0c){var _0x205fce={};var _0x48eaab={};var _0x1583e5;var _0x1fd8a7;return db[_0xd200('0x48')]['findOne']({'where':{'id':_0x4cb893[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x5e6c0c,null))[_0xd200('0x24')](function(_0x25cf0a){if(_0x25cf0a){_0x1583e5=_0x25cf0a;_0x48eaab['model']=_['keys'](db[_0xd200('0xe9')][_0xd200('0x3e')]);_0x48eaab['query']=_[_0xd200('0xd4')](_0x4cb893[_0xd200('0x49')]);_0x48eaab['filters']=_[_0xd200('0xd7')](_0x48eaab[_0xd200('0xd3')],_0x48eaab[_0xd200('0x49')]);_0x205fce[_0xd200('0x4e')]=_['intersection'](_0x48eaab['model'],qs[_0xd200('0xd8')](_0x4cb893[_0xd200('0x49')][_0xd200('0xd8')]));_0x205fce[_0xd200('0x4e')]=_0x205fce[_0xd200('0x4e')][_0xd200('0x6c')]?_0x205fce[_0xd200('0x4e')]:_0x48eaab['model'];_0x205fce[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x4cb893[_0xd200('0x49')][_0xd200('0xda')]);_0x205fce['where']=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x4cb893[_0xd200('0x49')],_0x48eaab[_0xd200('0xd6')]));if(_0x4cb893[_0xd200('0x49')][_0xd200('0x41')]){_0x205fce[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x205fce[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x205fce[_0xd200('0x4e')],function(_0xb08dcf){var _0x518ac7={};_0x518ac7[_0xb08dcf]={'$like':'%'+_0x4cb893['query'][_0xd200('0x41')]+'%'};return _0x518ac7;})});}_0x205fce=_['merge']({},_0x205fce,_0x4cb893['options']);return _0x1583e5[_0xd200('0xe8')](_0x205fce);}})['then'](function(_0x3745c7){if(_0x3745c7){_0x1fd8a7=_0x3745c7['length'];if(!_0x4cb893[_0xd200('0x49')][_0xd200('0xdd')](_0xd200('0xde'))){_0x205fce[_0xd200('0x1f')]=qs['limit'](_0x4cb893[_0xd200('0x49')]['limit']);_0x205fce[_0xd200('0x1e')]=qs['offset'](_0x4cb893[_0xd200('0x49')][_0xd200('0x1e')]);}return _0x1583e5['getOpenchannelInteractions'](_0x205fce);}})[_0xd200('0x24')](function(_0xccc458){if(_0xccc458){return _0xccc458?{'count':_0x1fd8a7,'rows':_0xccc458}:null;}})[_0xd200('0x24')](respondWithResult(_0x5e6c0c,null))[_0xd200('0x2f')](handleError(_0x5e6c0c,null));};exports[_0xd200('0xea')]=function(_0x3b3681,_0x34db52){var _0x218d6a={'raw':!![],'where':{}};var _0x48b774={};var _0x42bbd0={'count':0x0,'rows':[]};return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x3b3681[_0xd200('0x5e')]['id']}})['then'](handleEntityNotFound(_0x34db52,null))[_0xd200('0x24')](function(_0x1057a8){if(_0x1057a8){_0x48b774['model']=_[_0xd200('0xd4')](db['MailInteraction'][_0xd200('0x3e')]);_0x48b774[_0xd200('0x49')]=_['keys'](_0x3b3681[_0xd200('0x49')]);_0x48b774[_0xd200('0xd6')]=_['intersection'](_0x48b774[_0xd200('0xd3')],_0x48b774[_0xd200('0x49')]);_0x218d6a[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x48b774['model'],qs[_0xd200('0xd8')](_0x3b3681['query']['fields']));_0x218d6a[_0xd200('0x4e')]=_0x218d6a[_0xd200('0x4e')]['length']?_0x218d6a[_0xd200('0x4e')]:_0x48b774[_0xd200('0xd3')];if(!_0x3b3681[_0xd200('0x49')]['hasOwnProperty'](_0xd200('0xde'))){_0x218d6a[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x3b3681[_0xd200('0x49')][_0xd200('0x1f')]);_0x218d6a['offset']=qs['offset'](_0x3b3681['query'][_0xd200('0x1e')]);}_0x218d6a[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x3b3681[_0xd200('0x49')]['sort']);_0x218d6a[_0xd200('0x47')]=qs[_0xd200('0xd6')](_[_0xd200('0xdb')](_0x3b3681[_0xd200('0x49')],_0x48b774['filters']));_0x218d6a['where'][_0xd200('0xe3')]=_0x1057a8['id'];if(_0x3b3681[_0xd200('0x49')][_0xd200('0x41')]){_0x218d6a['where']=_['merge'](_0x218d6a[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x218d6a[_0xd200('0x4e')],function(_0x3b4a84){var _0x189f68={};_0x189f68[_0x3b4a84]={'$like':'%'+_0x3b3681[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x189f68;})});}_0x218d6a=_['merge']({},_0x218d6a,_0x3b3681[_0xd200('0xdc')]);return db[_0xd200('0xeb')][_0xd200('0x21')]({'where':_0x218d6a[_0xd200('0x47')]})[_0xd200('0x24')](function(_0x416947){_0x42bbd0['count']=_0x416947;if(_0x3b3681[_0xd200('0x49')][_0xd200('0x4a')]){_0x218d6a[_0xd200('0x5a')]=[{'all':!![]}];}return db[_0xd200('0xeb')][_0xd200('0x50')](_0x218d6a);})[_0xd200('0x24')](function(_0x52ea32){_0x42bbd0[_0xd200('0x51')]=_0x52ea32;return _0x42bbd0;});}})[_0xd200('0x24')](respondWithFilteredResult(_0x34db52,_0x218d6a))['catch'](handleError(_0x34db52,null));};exports[_0xd200('0xec')]=function(_0x281f52,_0x22e7dc){var _0x12fce5={};var _0x1809ba={};var _0x279949;var _0x2dc9bd;return db['User'][_0xd200('0xc9')]({'where':{'id':_0x281f52[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x22e7dc,null))['then'](function(_0x58f9d1){if(_0x58f9d1){_0x279949=_0x58f9d1;_0x1809ba[_0xd200('0xd3')]=_[_0xd200('0xd4')](db['SmsInteraction'][_0xd200('0x3e')]);_0x1809ba[_0xd200('0x49')]=_[_0xd200('0xd4')](_0x281f52[_0xd200('0x49')]);_0x1809ba['filters']=_['intersection'](_0x1809ba['model'],_0x1809ba[_0xd200('0x49')]);_0x12fce5['attributes']=_[_0xd200('0xd7')](_0x1809ba[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x281f52['query'][_0xd200('0xd8')]));_0x12fce5[_0xd200('0x4e')]=_0x12fce5[_0xd200('0x4e')]['length']?_0x12fce5[_0xd200('0x4e')]:_0x1809ba[_0xd200('0xd3')];_0x12fce5['order']=qs[_0xd200('0xda')](_0x281f52[_0xd200('0x49')]['sort']);_0x12fce5['where']=qs[_0xd200('0xd6')](_['pick'](_0x281f52[_0xd200('0x49')],_0x1809ba[_0xd200('0xd6')]));if(_0x281f52[_0xd200('0x49')][_0xd200('0x41')]){_0x12fce5[_0xd200('0x47')]=_['merge'](_0x12fce5['where'],{'$or':_[_0xd200('0x38')](_0x12fce5['attributes'],function(_0x354ec2){var _0x3bb4b6={};_0x3bb4b6[_0x354ec2]={'$like':'%'+_0x281f52['query'][_0xd200('0x41')]+'%'};return _0x3bb4b6;})});}_0x12fce5=_[_0xd200('0x5b')]({},_0x12fce5,_0x281f52[_0xd200('0xdc')]);return _0x279949[_0xd200('0xec')](_0x12fce5);}})[_0xd200('0x24')](function(_0x33e931){if(_0x33e931){_0x2dc9bd=_0x33e931[_0xd200('0x6c')];if(!_0x281f52[_0xd200('0x49')][_0xd200('0xdd')](_0xd200('0xde'))){_0x12fce5[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x281f52[_0xd200('0x49')][_0xd200('0x1f')]);_0x12fce5['offset']=qs[_0xd200('0x1e')](_0x281f52['query'][_0xd200('0x1e')]);}return _0x279949[_0xd200('0xec')](_0x12fce5);}})[_0xd200('0x24')](function(_0x4065e8){if(_0x4065e8){return _0x4065e8?{'count':_0x2dc9bd,'rows':_0x4065e8}:null;}})['then'](respondWithResult(_0x22e7dc,null))[_0xd200('0x2f')](handleError(_0x22e7dc,null));};exports[_0xd200('0xed')]=function(_0x20ffee,_0x11795c){var _0x5a6240={};var _0x5a6fc9={};var _0x5e06b7;var _0x4fd47f;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x20ffee['params']['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x11795c,null))[_0xd200('0x24')](function(_0x4673b1){if(_0x4673b1){_0x5e06b7=_0x4673b1;_0x5a6fc9[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0xee')][_0xd200('0x3e')]);_0x5a6fc9[_0xd200('0x49')]=_[_0xd200('0xd4')](_0x20ffee['query']);_0x5a6fc9[_0xd200('0xd6')]=_[_0xd200('0xd7')](_0x5a6fc9['model'],_0x5a6fc9[_0xd200('0x49')]);_0x5a6240[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x5a6fc9[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x20ffee['query'][_0xd200('0xd8')]));_0x5a6240[_0xd200('0x4e')]=_0x5a6240[_0xd200('0x4e')][_0xd200('0x6c')]?_0x5a6240[_0xd200('0x4e')]:_0x5a6fc9['model'];_0x5a6240[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x20ffee[_0xd200('0x49')][_0xd200('0xda')]);_0x5a6240[_0xd200('0x47')]=qs[_0xd200('0xd6')](_['pick'](_0x20ffee['query'],_0x5a6fc9['filters']));if(_0x20ffee[_0xd200('0x49')][_0xd200('0x41')]){_0x5a6240[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x5a6240[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x5a6240[_0xd200('0x4e')],function(_0x4f78f7){var _0x5bf48f={};_0x5bf48f[_0x4f78f7]={'$like':'%'+_0x20ffee[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x5bf48f;})});}_0x5a6240=_[_0xd200('0x5b')]({},_0x5a6240,_0x20ffee[_0xd200('0xdc')]);return _0x5e06b7[_0xd200('0xed')](_0x5a6240);}})[_0xd200('0x24')](function(_0x972d34){if(_0x972d34){_0x4fd47f=_0x972d34[_0xd200('0x6c')];if(!_0x20ffee[_0xd200('0x49')][_0xd200('0xdd')]('nolimit')){_0x5a6240[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x20ffee[_0xd200('0x49')][_0xd200('0x1f')]);_0x5a6240['offset']=qs['offset'](_0x20ffee[_0xd200('0x49')]['offset']);}return _0x5e06b7[_0xd200('0xed')](_0x5a6240);}})[_0xd200('0x24')](function(_0x150755){if(_0x150755){return _0x150755?{'count':_0x4fd47f,'rows':_0x150755}:null;}})['then'](respondWithResult(_0x11795c,null))['catch'](handleError(_0x11795c,null));};exports[_0xd200('0xef')]=function(_0xe94c96,_0x47c759){var _0x5034bd={};var _0x143cdc={};var _0x570064;var _0x4634e;return db[_0xd200('0x48')]['findOne']({'where':{'id':_0xe94c96[_0xd200('0x5e')]['id']}})['then'](handleEntityNotFound(_0x47c759,null))[_0xd200('0x24')](function(_0x4d20d9){if(_0x4d20d9){_0x570064=_0x4d20d9;_0x143cdc['model']=_[_0xd200('0xd4')](db[_0xd200('0xf0')][_0xd200('0x3e')]);_0x143cdc[_0xd200('0x49')]=_[_0xd200('0xd4')](_0xe94c96[_0xd200('0x49')]);_0x143cdc[_0xd200('0xd6')]=_[_0xd200('0xd7')](_0x143cdc[_0xd200('0xd3')],_0x143cdc['query']);_0x5034bd[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x143cdc['model'],qs[_0xd200('0xd8')](_0xe94c96[_0xd200('0x49')][_0xd200('0xd8')]));_0x5034bd[_0xd200('0x4e')]=_0x5034bd[_0xd200('0x4e')][_0xd200('0x6c')]?_0x5034bd[_0xd200('0x4e')]:_0x143cdc[_0xd200('0xd3')];_0x5034bd[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0xe94c96[_0xd200('0x49')][_0xd200('0xda')]);_0x5034bd['where']=qs['filters'](_[_0xd200('0xdb')](_0xe94c96[_0xd200('0x49')],_0x143cdc[_0xd200('0xd6')]));if(_0xe94c96[_0xd200('0x49')][_0xd200('0x41')]){_0x5034bd[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x5034bd[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x5034bd[_0xd200('0x4e')],function(_0x2daf93){var _0x3fd30a={};_0x3fd30a[_0x2daf93]={'$like':'%'+_0xe94c96['query'][_0xd200('0x41')]+'%'};return _0x3fd30a;})});}_0x5034bd=_[_0xd200('0x5b')]({},_0x5034bd,_0xe94c96[_0xd200('0xdc')]);return _0x570064[_0xd200('0xef')](_0x5034bd);}})[_0xd200('0x24')](function(_0xb99a54){if(_0xb99a54){_0x4634e=_0xb99a54[_0xd200('0x6c')];if(!_0xe94c96[_0xd200('0x49')][_0xd200('0xdd')]('nolimit')){_0x5034bd[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0xe94c96['query']['limit']);_0x5034bd['offset']=qs[_0xd200('0x1e')](_0xe94c96['query']['offset']);}return _0x570064[_0xd200('0xef')](_0x5034bd);}})[_0xd200('0x24')](function(_0x1cc426){if(_0x1cc426){return _0x1cc426?{'count':_0x4634e,'rows':_0x1cc426}:null;}})['then'](respondWithResult(_0x47c759,null))[_0xd200('0x2f')](handleError(_0x47c759,null));};exports['login']=function(_0xb64f18,_0x2aa6c2,_0x16d374){var _0x3217f1;var _0x2925ec;var _0x59184d;var _0x46c900=!_[_0xd200('0x6d')](_0xb64f18[_0xd200('0x5e')]['id'])?_0xb64f18[_0xd200('0x5e')]['id']:!_['isNil'](_0xb64f18[_0xd200('0x80')]['id'])?_0xb64f18[_0xd200('0x80')]['id']:null;return db['User'][_0xd200('0x3b')]({'where':{'id':_0x46c900,'role':{'$or':[_0xd200('0x34'),_0xd200('0x80'),_0xd200('0x31')]}},'attributes':['id','name',_0xd200('0xf1'),_0xd200('0xf2'),_0xd200('0x33'),'internal',_0xd200('0x9e')]})[_0xd200('0x24')](function(_0x2a5f0c){if(_0x2a5f0c){if(_0x2a5f0c[_0xd200('0x33')]===_0xd200('0x31')){_0x3217f1=_0x2a5f0c;if(_0xb64f18[_0xd200('0x5d')][_0xd200('0xa0')]){_0x59184d=util[_0xd200('0xca')](_0xd200('0xf3'),_0x3217f1[_0xb64f18[_0xd200('0x5d')]['interface']]);}else if(_0xb64f18[_0xd200('0x5d')][_0xd200('0xf4')]){_0x59184d=util[_0xd200('0xca')](_0xd200('0xf5'),_0xb64f18[_0xd200('0x5d')][_0xd200('0xf4')]);}else{_0x59184d=util['format'](_0xd200('0xf5'),_0x3217f1[_0xd200('0x3c')]);}socket['to'](util['format']('user:%s',_0x3217f1[_0xd200('0x3c')]))[_0xd200('0xb2')](_0xd200('0xf6'),{'user':{'id':_0x3217f1['id'],'name':_0x3217f1[_0xd200('0x3c')]},'ip':_0xb64f18[_0xd200('0xf7')][_0xd200('0xf8')]||_0xb64f18[_0xd200('0xf9')][_0xd200('0xfa')]||_0xb64f18[_0xd200('0xfb')]['remoteAddress']||_0xb64f18[_0xd200('0xf9')]['socket'][_0xd200('0xfa')]});return new Promise(function(_0x237185,_0x31c9a7){db[_0xd200('0x6a')]['transaction']()[_0xd200('0x24')](_0x4cf009=>{db[_0xd200('0xad')]['destroy']({'where':{'membername':_0x3217f1[_0xd200('0x3c')]},'individualHooks':!![]},{'transaction':_0x4cf009})[_0xd200('0x24')](function(){return _0x4cf009[_0xd200('0xfc')]();})[_0xd200('0x24')](_0x237185)[_0xd200('0x2f')](_0x31c9a7);});});}}else{throw new db[(_0xd200('0x92'))][(_0xd200('0x93'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x3217f1){return _0x3217f1[_0xd200('0xfd')]({'raw':!![]});}})['then'](function(_0x2d86ce){if(_0x3217f1){if(_0x2d86ce){_0x2925ec=_0x2d86ce;if(_0x2925ec[_0xd200('0x6c')]){var _0x129d5a=_0x2925ec[_0xd200('0x38')](function(_0x556f0b){return{'membername':_0x3217f1['name'],'UserId':_0x3217f1['id'],'queue_name':_0x556f0b[_0xd200('0x3c')],'VoiceQueueId':_0x556f0b['id'],'interface':_0x59184d,'paused':_0x3217f1['loginInPause']||![],'penalty':_0x556f0b[_0xd200('0xfe')]||0x0};});return db[_0xd200('0xad')]['bulkCreate'](_0x129d5a);}}}})[_0xd200('0x24')](function(){if(_0x3217f1){return db[_0xd200('0xff')]['findAll']({'where':{'membername':_0x3217f1[_0xd200('0x3c')],'exitAt':null}});}})[_0xd200('0x24')](function(_0x287272){if(_0x3217f1){var _0x562109=[];_0x287272[_0xd200('0x100')](function(_0x542ce4){_0x562109['push'](_0x542ce4['update']({'exitAt':moment()[_0xd200('0xca')](_0xd200('0x101'))}));});return Promise[_0xd200('0x59')](_0x562109);}})['then'](function(){if(_0x3217f1){var _0x1349d9=[];var _0x4653f7=[];var _0x28f254=utils[_0xd200('0x102')]();var _0x423d5a={'membername':_0x3217f1[_0xd200('0x3c')],'interface':_0x59184d,'enterAt':moment()['format'](_0xd200('0x101')),'role':_0x3217f1[_0xd200('0x33')],'internal':_0x3217f1[_0xd200('0x61')]};_0x28f254[_0xd200('0x100')](function(_0x23d94c){_0x1349d9[_0xd200('0x4f')](_[_0xd200('0x5b')]({'channel':_0x23d94c,'type':'LOGIN','data1':_0xb64f18['body'][_0xd200('0x103')],'data2':_0x59184d},_0x423d5a));if(_0x3217f1[_0xd200('0x9e')]){_0x4653f7['push'](_[_0xd200('0x5b')]({'channel':_0x23d94c,'type':_0xd200('0x104'),'data1':'LOGININPAUSE'},_0x423d5a));}});return db[_0xd200('0xff')][_0xd200('0x105')](_0x1349d9['concat'](_0x4653f7),{'individualHooks':!![]});}})[_0xd200('0x24')](function(){if(_0x3217f1){return _0x3217f1[_0xd200('0x30')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3217f1['loginInPause']||![],'mailPause':_0x3217f1[_0xd200('0x9e')]||![],'chatPause':_0x3217f1[_0xd200('0x9e')]||![],'faxPause':_0x3217f1[_0xd200('0x9e')]||![],'smsPause':_0x3217f1[_0xd200('0x9e')]||![],'openchannelPause':_0x3217f1[_0xd200('0x9e')]||![],'whatsappPause':_0x3217f1[_0xd200('0x9e')]||![],'pauseType':_0x3217f1[_0xd200('0x9e')]?_0xd200('0x106'):null,'interface':_0x59184d,'lastPauseAt':moment()[_0xd200('0xca')](_0xd200('0x101'))});}})['then'](function(_0x241388){if(_0xb64f18[_0xd200('0x107')]){return _0x16d374();}else{return Promise[_0xd200('0x108')](_0x241388)[_0xd200('0x24')](respondWithResult(_0x2aa6c2,null));}})['catch'](handleError(_0x2aa6c2,null));};exports[_0xd200('0x109')]=function(_0x483710,_0x4a7684){var _0x365287;return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0x483710[_0xd200('0x5e')]['id'],'role':_0xd200('0x31')},'attributes':['id',_0xd200('0x3c'),_0xd200('0x33')]})[_0xd200('0x24')](handleEntityNotFound(_0x4a7684,null))[_0xd200('0x24')](function(_0x17da8e){if(_0x17da8e){_0x365287=_0x17da8e;return db[_0xd200('0xad')]['destroy']({'where':{'membername':_0x365287['name']},'individualHooks':!![]});}})[_0xd200('0x24')](function(){return db[_0xd200('0xff')][_0xd200('0x50')]({'where':{'membername':_0x365287['name'],'exitAt':null}});})[_0xd200('0x24')](function(_0x265b92){var _0x3a9750=[];_0x265b92[_0xd200('0x100')](function(_0xe7fe1c){_0x3a9750[_0xd200('0x4f')](_0xe7fe1c[_0xd200('0x30')]({'exitAt':moment()['format'](_0xd200('0x101'))}));});return Promise['all'](_0x3a9750);})[_0xd200('0x24')](function(){return _0x365287['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd200('0x24')](respondWithResult(_0x4a7684,null))[_0xd200('0x2f')](handleError(_0x4a7684,null));};exports['pause']=function(_0x8ea895,_0x4a2490){var _0xd77bf9;return db['UserVoiceQueueRt'][_0xd200('0x30')]({'paused':0x1},{'where':{'UserId':_0x8ea895[_0xd200('0x5e')]['id']},'individualHooks':!![]})[_0xd200('0x24')](function(){return db['User'][_0xd200('0x3b')]({'where':{'id':_0x8ea895[_0xd200('0x5e')]['id'],'role':'agent'},'attributes':['id',_0xd200('0x3c'),_0xd200('0x33'),_0xd200('0x61'),_0xd200('0xa0'),_0xd200('0x10a')]});})[_0xd200('0x24')](handleEntityNotFound(_0x4a2490,null))['then'](function(_0x654ed9){if(_0x654ed9){_0xd77bf9=_0x654ed9;return respondWithRpcPromise(_0xd200('0x10b'),_0xd200('0x10c'),{'id':_0xd77bf9['id'],'name':_0xd77bf9[_0xd200('0x3c')],'pause':!![]});}})[_0xd200('0x24')](function(){if(_0xd77bf9){return db['MemberReport'][_0xd200('0x50')]({'where':{'membername':_0xd77bf9['name'],'type':_0xd200('0x104'),'exitAt':null}});}})['then'](function(_0x29adef){if(_0x29adef[_0xd200('0x6c')]){var _0xfbf00e=moment()[_0xd200('0xca')](_0xd200('0x101'));for(var _0x527b3a=0x0,_0x1ee31b=_0x29adef[_0xd200('0x6c')];_0x527b3a<_0x1ee31b;_0x527b3a++){_0x29adef[_0x527b3a][_0xd200('0x10d')]({'exitAt':_0xfbf00e});}}})['then'](function(){var _0x43c4c3=[];var _0x3a2efe=utils[_0xd200('0x102')]();_0x3a2efe['forEach'](function(_0x3b8cdc){_0x43c4c3['push']({'channel':_0x3b8cdc,'membername':_0xd77bf9[_0xd200('0x3c')],'interface':_[_0xd200('0x6d')](_0xd77bf9[_0xd200('0xa0')])?util['format'](_0xd200('0xf5'),_0xd77bf9['name']):_0xd77bf9['interface'],'type':_0xd200('0x104'),'enterAt':moment()[_0xd200('0xca')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x8ea895[_0xd200('0x5d')][_0xd200('0x10e')]||_0xd200('0x10f'),'role':_0xd77bf9[_0xd200('0x33')],'internal':_0xd77bf9['internal']});});return db['MemberReport'][_0xd200('0x105')](_0x43c4c3,{'individualHooks':!![]});})[_0xd200('0x24')](function(){return _0xd77bf9[_0xd200('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8ea895[_0xd200('0x5d')][_0xd200('0x10e')]||_0xd200('0x10f'),'lastPauseAt':moment()[_0xd200('0xca')](_0xd200('0x101'))});})['then'](respondWithResult(_0x4a2490,null))[_0xd200('0x2f')](handleError(_0x4a2490,null));};exports[_0xd200('0x110')]=function(_0x129337,_0x55f02e){if(_0x129337[_0xd200('0x5d')][_0xd200('0x9d')]&&!utils[_0xd200('0xa1')](_0x129337[_0xd200('0x5d')][_0xd200('0x9d')])){throw new APIBadRequestError(util[_0xd200('0xca')](_0xd200('0x111'),_0x129337[_0xd200('0x5d')]['channel']));}return db[_0xd200('0x48')][_0xd200('0x3b')]({'where':{'id':_0x129337[_0xd200('0x5e')]['id']},'attributes':['id','name','role',_0xd200('0x61'),_0xd200('0xa0'),_0xd200('0x10a'),'voicePause',_0xd200('0x112'),_0xd200('0x113'),'faxPause','openchannelPause',_0xd200('0x114'),_0xd200('0x115'),_0xd200('0x116'),'lastPauseAt']})[_0xd200('0x24')](function(_0x2c9a6c){if(!_0x2c9a6c){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x129337[_0xd200('0x5e')]['id']));}return _0x2c9a6c[_0xd200('0x110')](_0x129337[_0xd200('0x5d')][_0xd200('0x9d')]);})[_0xd200('0x24')](respondWithResult(_0x55f02e,null))[_0xd200('0x2f')](APIHandleError(_0x55f02e));};exports['getTeams']=function(_0x5d8921,_0x363c98){var _0x51afc2={};var _0x5ad596={};var _0x35c5d0;var _0x420a2e;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x5d8921[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x363c98,null))[_0xd200('0x24')](function(_0x3fa9be){if(_0x3fa9be){_0x35c5d0=_0x3fa9be;_0x5ad596[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0x117')][_0xd200('0x3e')]);_0x5ad596[_0xd200('0x49')]=_[_0xd200('0xd4')](_0x5d8921[_0xd200('0x49')]);_0x5ad596[_0xd200('0xd6')]=_[_0xd200('0xd7')](_0x5ad596[_0xd200('0xd3')],_0x5ad596['query']);_0x51afc2['attributes']=_[_0xd200('0xd7')](_0x5ad596[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x5d8921[_0xd200('0x49')][_0xd200('0xd8')]));_0x51afc2['attributes']=_0x51afc2[_0xd200('0x4e')][_0xd200('0x6c')]?_0x51afc2[_0xd200('0x4e')]:_0x5ad596[_0xd200('0xd3')];_0x51afc2['order']=qs[_0xd200('0xda')](_0x5d8921[_0xd200('0x49')][_0xd200('0xda')]);_0x51afc2['where']=qs['filters'](_[_0xd200('0xdb')](_0x5d8921['query'],_0x5ad596[_0xd200('0xd6')]));if(_0x5d8921[_0xd200('0x49')][_0xd200('0x41')]){_0x51afc2[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x51afc2['where'],{'$or':_[_0xd200('0x38')](_0x51afc2['attributes'],function(_0x129e8d){var _0x4513ae={};_0x4513ae[_0x129e8d]={'$like':'%'+_0x5d8921[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0x4513ae;})});}_0x51afc2=_[_0xd200('0x5b')]({},_0x51afc2,_0x5d8921['options']);return _0x35c5d0[_0xd200('0x118')](_0x51afc2);}})[_0xd200('0x24')](function(_0x2ec8f3){if(_0x2ec8f3){_0x420a2e=_0x2ec8f3[_0xd200('0x6c')];if(!_0x5d8921[_0xd200('0x49')][_0xd200('0xdd')](_0xd200('0xde'))){_0x51afc2[_0xd200('0x1f')]=qs[_0xd200('0x1f')](_0x5d8921[_0xd200('0x49')][_0xd200('0x1f')]);_0x51afc2[_0xd200('0x1e')]=qs[_0xd200('0x1e')](_0x5d8921[_0xd200('0x49')][_0xd200('0x1e')]);}return _0x35c5d0[_0xd200('0x118')](_0x51afc2);}})[_0xd200('0x24')](function(_0x198746){if(_0x198746){return _0x198746?{'count':_0x420a2e,'rows':_0x198746}:null;}})[_0xd200('0x24')](respondWithResult(_0x363c98,null))[_0xd200('0x2f')](handleError(_0x363c98,null));};exports[_0xd200('0x119')]=function(_0x46c266,_0x852c2e){var _0x2c190f=_0x46c266[_0xd200('0x5e')]['id'];var _0x3fe2b8=_0x46c266[_0xd200('0x5d')]?_0x46c266[_0xd200('0x5d')]['ids']:null;var _0x4946c4=[];return Promise[_0xd200('0x108')]()['then'](function(){if(!_0x3fe2b8)throw new APIBadRequestError(_0xd200('0x11a'));})[_0xd200('0x24')](function(){return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x2c190f}});})[_0xd200('0x24')](function(_0x449fa7){if(!_0x449fa7)throw new APINotFoundError(util[_0xd200('0xca')](_0xd200('0xcb'),_0x46c266['params']['id']));return db[_0xd200('0x6a')]['transaction'](function(_0x4ac64d){return _0x449fa7[_0xd200('0x119')](_0x3fe2b8,{'transaction':_0x4ac64d})[_0xd200('0x24')](function(){return db['Team'][_0xd200('0x50')]({'where':{'id':{'$in':_0x3fe2b8}}});})['then'](function(_0xb131e1){var _0x444165=_[_0xd200('0x38')](_0xb131e1,function(_0x128839){return _0x128839['getAssociatedQueues']();});return Promise['all'](_0x444165);})[_0xd200('0x24')](function(_0x1f3236){_0x4946c4=_['flattenDeep'](_0x1f3236);var _0x1984bd=_[_0xd200('0x38')](_0x4946c4,function(_0x47f090){return _0x47f090['addAgent'](_0x449fa7['id'],{'transaction':_0x4ac64d});});return Promise[_0xd200('0x59')](_0x1984bd);})['then'](function(){if(!_0x449fa7[_0xd200('0x10a')])return;var _0x2951f9=_[_0xd200('0x41')](_0x4946c4,function(_0xda68e6){return _0xda68e6[_0xd200('0x11b')](_0xd200('0x9d'))===_0xd200('0x11c');});var _0xb3cbfc=_['map'](_0x2951f9,function(_0x496407){return db['UserVoiceQueueRt'][_0xd200('0xae')]({'membername':_0x449fa7[_0xd200('0x3c')],'UserId':_0x449fa7['id'],'queue_name':_0x496407[_0xd200('0x3c')],'VoiceQueueId':_0x496407['id'],'interface':_['isNil'](_0x449fa7[_0xd200('0xa0')])?util['format'](_0xd200('0xf5'),_0x449fa7[_0xd200('0x3c')]):_0x449fa7[_0xd200('0xa0')],'paused':_0x449fa7[_0xd200('0x9f')]||![],'penalty':_0x449fa7[_0xd200('0xa5')]},{'transaction':_0x4ac64d});});return Promise[_0xd200('0x59')](_0xb3cbfc);})[_0xd200('0x24')](function(){return db[_0xd200('0x11d')][_0xd200('0x50')]({'where':{'teamId':{'$in':_0x3fe2b8}}});})[_0xd200('0x24')](function(_0x41c466){var _0x39b323=_[_0xd200('0x38')](_0x41c466,function(_0x29ff79){return db['UserVoicePrefix'][_0xd200('0x86')]({'UserId':_0x449fa7['id'],'VoicePrefixId':_0x29ff79[_0xd200('0x11e')]},{'transaction':_0x4ac64d});});return Promise[_0xd200('0x59')](_0x39b323);});});})[_0xd200('0x24')](function(){for(var _0x8eea58=0x0;_0x8eea58<_0x4946c4[_0xd200('0x6c')];_0x8eea58++){var _0x2bd92c=_0x4946c4[_0x8eea58][_0xd200('0x11b')](_0xd200('0x9d'));var _0x228503=_0x2bd92c+_0xd200('0xa8');socket['emit'](_0xd200('0x80')+_0x2bd92c+_0xd200('0xa9'),{'UserId':_0x2c190f,['queueField']:_0x4946c4[_0x8eea58]['id']});}})[_0xd200('0x24')](respondWithStatusCode(_0x852c2e,null))[_0xd200('0x2f')](APIHandleError(_0x852c2e));};exports[_0xd200('0x11f')]=function(_0x306be6,_0x444410){var _0x272726=_0x306be6[_0xd200('0x5e')]['id'];var _0x31f9f6=null;if(_0x306be6[_0xd200('0x49')][_0xd200('0xa4')]){_0x31f9f6=_['isArray'](_0x306be6[_0xd200('0x49')][_0xd200('0xa4')])?_0x306be6[_0xd200('0x49')][_0xd200('0xa4')]:[_0x306be6['query'][_0xd200('0xa4')]];}var _0x57e377=[];return Promise[_0xd200('0x108')]()[_0xd200('0x24')](function(){if(!_0x31f9f6)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xd200('0x48')]['findOne']({'where':{'id':_0x272726}});})[_0xd200('0x24')](function(_0x1f605d){if(!_0x1f605d)throw new APINotFoundError(util[_0xd200('0xca')](_0xd200('0xcb'),_0x306be6[_0xd200('0x5e')]['id']));return db[_0xd200('0x6a')][_0xd200('0x120')](function(_0x3903b5){return _0x1f605d[_0xd200('0x11f')](_0x31f9f6,{'transaction':_0x3903b5})['then'](function(){return db[_0xd200('0x117')][_0xd200('0x50')]({'where':{'id':{'$in':_0x31f9f6}}});})[_0xd200('0x24')](function(_0x2457cf){var _0x37f386=_[_0xd200('0x38')](_0x2457cf,function(_0xa7c73){return _0xa7c73['getAssociatedQueues']();});return Promise['all'](_0x37f386);})[_0xd200('0x24')](function(_0x14ed2f){_0x57e377=_[_0xd200('0x121')](_0x14ed2f);var _0x254418=_['map'](_0x57e377,function(_0x17cbb8){return _0x17cbb8[_0xd200('0x122')](_0x1f605d['id'],{'transaction':_0x3903b5});});return Promise[_0xd200('0x59')](_0x254418);})['then'](function(){if(!_0x1f605d[_0xd200('0x10a')])return;var _0x2426d0=_['filter'](_0x57e377,function(_0x18f0c9){return _0x18f0c9['getDataValue']('channel')==='Voice';});var _0x29e85b=_[_0xd200('0x38')](_0x2426d0,function(_0x19d369){return db[_0xd200('0xad')][_0xd200('0x32')]({'where':{'VoiceQueueId':_0x19d369['id'],'UserId':_0x1f605d['id']},'transaction':_0x3903b5});});return Promise[_0xd200('0x59')](_0x29e85b);})[_0xd200('0x24')](function(){return db[_0xd200('0x11d')]['findAll']({'where':{'teamId':{'$in':_0x31f9f6}}});})[_0xd200('0x24')](function(_0x2338b8){var _0x41bfdc=_['map'](_0x2338b8,function(_0x17ae19){return db[_0xd200('0x123')][_0xd200('0x32')]({'where':{'UserId':_0x1f605d['id'],'VoicePrefixId':_0x17ae19[_0xd200('0x11e')]}},{'transaction':_0x3903b5});});return Promise['all'](_0x41bfdc);});});})[_0xd200('0x24')](function(){for(var _0xe94a26=0x0;_0xe94a26<_0x57e377[_0xd200('0x6c')];_0xe94a26++){var _0x7a0d7d=_0x57e377[_0xe94a26]['getDataValue'](_0xd200('0x9d'));var _0x290128=_0x7a0d7d+_0xd200('0xa8');socket['emit'](_0xd200('0x80')+_0x7a0d7d+'Queue:remove',{'UserId':_0x272726,['queueField']:_0x57e377[_0xe94a26]['id']});}})[_0xd200('0x24')](respondWithStatusCode(_0x444410,null))[_0xd200('0x2f')](APIHandleError(_0x444410));};exports[_0xd200('0x124')]=function(_0x3145ac,_0x24df7a){var _0x40b24e={};var _0x34d4d6={};var _0x33eb69;var _0x4e3225;return db[_0xd200('0x48')][_0xd200('0xc9')]({'where':{'id':_0x3145ac['params']['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x24df7a,null))[_0xd200('0x24')](function(_0x45b130){if(_0x45b130){_0x33eb69=_0x45b130;_0x34d4d6[_0xd200('0xd3')]=_[_0xd200('0xd4')](db[_0xd200('0x125')]['rawAttributes']);_0x34d4d6['query']=_[_0xd200('0xd4')](_0x3145ac[_0xd200('0x49')]);_0x34d4d6['filters']=_[_0xd200('0xd7')](_0x34d4d6['model'],_0x34d4d6['query']);_0x40b24e[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x34d4d6[_0xd200('0xd3')],qs[_0xd200('0xd8')](_0x3145ac['query'][_0xd200('0xd8')]));_0x40b24e[_0xd200('0x4e')]=_0x40b24e[_0xd200('0x4e')][_0xd200('0x6c')]?_0x40b24e[_0xd200('0x4e')]:_0x34d4d6[_0xd200('0xd3')];_0x40b24e[_0xd200('0xd9')]=qs[_0xd200('0xda')](_0x3145ac[_0xd200('0x49')][_0xd200('0xda')]);_0x40b24e[_0xd200('0x47')]=qs['filters'](_[_0xd200('0xdb')](_0x3145ac['query'],_0x34d4d6[_0xd200('0xd6')]));if(_0x3145ac[_0xd200('0x49')][_0xd200('0x41')]){_0x40b24e[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x40b24e[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x40b24e['attributes'],function(_0x105e81){var _0xbc46f7={};_0xbc46f7[_0x105e81]={'$like':'%'+_0x3145ac[_0xd200('0x49')][_0xd200('0x41')]+'%'};return _0xbc46f7;})});}_0x40b24e=_[_0xd200('0x5b')]({},_0x40b24e,_0x3145ac['options']);return _0x33eb69[_0xd200('0x124')](_0x40b24e);}})[_0xd200('0x24')](function(_0x1d81b1){if(_0x1d81b1){_0x4e3225=_0x1d81b1['length'];if(!_0x3145ac[_0xd200('0x49')][_0xd200('0xdd')]('nolimit')){_0x40b24e['limit']=qs['limit'](_0x3145ac[_0xd200('0x49')][_0xd200('0x1f')]);_0x40b24e[_0xd200('0x1e')]=qs[_0xd200('0x1e')](_0x3145ac[_0xd200('0x49')][_0xd200('0x1e')]);}return _0x33eb69['getLists'](_0x40b24e);}})[_0xd200('0x24')](function(_0x38f58d){if(_0x38f58d){return _0x38f58d?{'count':_0x4e3225,'rows':_0x38f58d}:null;}})['then'](respondWithResult(_0x24df7a,null))['catch'](handleError(_0x24df7a,null));};exports[_0xd200('0x126')]=function(_0xf54374,_0x16bbe4){var _0x5f1fea={};var _0x5745fd={};var _0x1b94de;return db[_0xd200('0x48')]['findOne']({'where':{'id':_0xf54374[_0xd200('0x5e')]['id']}})[_0xd200('0x24')](handleEntityNotFound(_0x16bbe4,null))[_0xd200('0x24')](function(_0x135a6e){if(_0x135a6e){_0x1b94de=_0x135a6e;_0x5745fd[_0xd200('0xd3')]=_[_0xd200('0xd4')](db['User'][_0xd200('0x3e')]);_0x5745fd[_0xd200('0x49')]=_[_0xd200('0xd4')](_0xf54374[_0xd200('0x49')]);_0x5745fd[_0xd200('0xd6')]=_['intersection'](_0x5745fd['model'],_0x5745fd[_0xd200('0x49')]);_0x5f1fea[_0xd200('0x4e')]=_[_0xd200('0xd7')](_0x5745fd[_0xd200('0xd3')],qs['fields'](_0xf54374[_0xd200('0x49')]['fields']));_0x5f1fea[_0xd200('0x4e')]=_0x5f1fea[_0xd200('0x4e')][_0xd200('0x6c')]?_0x5f1fea[_0xd200('0x4e')]:_0x5745fd[_0xd200('0xd3')];_0x5f1fea[_0xd200('0xd9')]=qs['sort'](_0xf54374[_0xd200('0x49')][_0xd200('0xda')]);_0x5f1fea[_0xd200('0x47')]=qs[_0xd200('0xd6')](_['pick'](_0xf54374['query'],_0x5745fd[_0xd200('0xd6')]));if(_0xf54374[_0xd200('0x49')][_0xd200('0x41')]){_0x5f1fea[_0xd200('0x47')]=_[_0xd200('0x5b')](_0x5f1fea[_0xd200('0x47')],{'$or':_[_0xd200('0x38')](_0x5f1fea['attributes'],function(_0x1c9d9d){var _0x3566d0={};_0x3566d0[_0x1c9d9d]={'$like':'%'+_0xf54374[_0xd200('0x49')]['filter']+'%'};return _0x3566d0;})});}_0x5f1fea[_0xd200('0xd3')]=db[_0xd200('0x48')];_0x5f1fea['as']='Agents';_0x5f1fea=_[_0xd200('0x5b')]({},_0x5f1fea,_0xf54374[_0xd200('0xdc')]);return _0x1b94de[_0xd200('0xfd')]({'include':[_0x5f1fea]});}})[_0xd200('0x24')](function(_0x176276){if(_0x176276){var _0x61d204={},_0x48114a=[];for(var _0xc8249f=0x0;_0xc8249f<_0x176276[_0xd200('0x6c')];_0xc8249f+=0x1){for(var _0x4ac7d8=0x0,_0x4c903a;_0x4ac7d8<_0x176276[_0xc8249f][_0xd200('0x36')]['length'];_0x4ac7d8+=0x1){_0x4c903a=_0x176276[_0xc8249f][_0xd200('0x36')][_0x4ac7d8][_0xd200('0xac')]({'plain':!![]});_0x61d204[_0x4c903a['id']]=_0x4c903a;}}_0x61d204=_['values'](_0x61d204);for(var _0x363e0f=qs[_0xd200('0x1e')](_0xf54374['query'][_0xd200('0x1e')]);_0x363e0f<_0x61d204[_0xd200('0x6c')]&&_0x48114a['length']=_0x127a9d){_0xf5a57e=_0x127a9d;_0x37b002=0xc8;}else{_0x37b002=0xce;}_0x2e3ae8['status'](_0x37b002);return _0x2e3ae8[_0x0240('0x21')](_0x0240('0x22'),_0x4bdd84+'-'+_0xf5a57e+'/'+_0x127a9d)[_0x0240('0x1c')](_0x2ab730);}return null;};}function respondWithRpcPromise(_0x163977,_0x494b90,_0x4c10fd,_0x47b553){return new Promise(function(_0x197131,_0x4b2114){var _0x2ded4a=_0x47b553||amiClient;return _0x2ded4a[_0x0240('0x23')](_0x163977,_0x4c10fd)[_0x0240('0x24')](function(_0x652406){logger[_0x0240('0x25')](_0x0240('0x26'),_0x494b90,_0x0240('0x27'));logger[_0x0240('0x28')](_0x0240('0x29'),_0x494b90,_0x0240('0x27'),JSON[_0x0240('0x2a')](_0x652406));if(_0x652406[_0x0240('0x2b')]){if(_0x652406[_0x0240('0x2b')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x494b90,_0x652406[_0x0240('0x2b')]['message']);return _0x4b2114(_0x652406[_0x0240('0x2b')][_0x0240('0x2c')]);}logger[_0x0240('0x2b')](_0x0240('0x26'),_0x494b90,_0x652406['error'][_0x0240('0x2c')]);return _0x197131(_0x652406[_0x0240('0x2b')][_0x0240('0x2c')]);}else{logger['info'](_0x0240('0x26'),_0x494b90,_0x0240('0x27'));_0x197131(_0x652406[_0x0240('0x2d')]['message']);}})[_0x0240('0x2e')](function(_0x121be6){logger['error']('User,\x20%s,\x20%s',_0x494b90,_0x121be6);_0x4b2114(_0x121be6);});});}function saveUpdates(_0x390e82){return function(_0x4df2cf){if(_0x4df2cf){return _0x4df2cf[_0x0240('0x2f')](_0x390e82)[_0x0240('0x24')](function(_0x2258b3){if(_0x2258b3[_0x0240('0x30')]==='agent'){socket[_0x0240('0x31')]('userNotification:recalc:'+_0x2258b3['id'],_0x2258b3);}return _0x2258b3;});}return null;};}function removeEntity(_0xf68f1f,_0x13e795){return function(_0x27420b){if(_0x27420b){return _0x27420b[_0x0240('0x32')]({'transaction':_0x13e795})[_0x0240('0x24')](function(){var _0x134220=_0x27420b['get']({'plain':!![]});if(_0x134220[_0x0240('0x30')]==='admin')return;var _0xd0ed05=[{'name':_0x0240('0x33'),'value':_0x0240('0x34'),'ignore':!![]},{'name':_0x0240('0x35'),'value':_0x0240('0x36'),'ignore':![]},{'name':_0x0240('0x37'),'value':_0x0240('0x38'),'ignore':![]}];var _0x2af602=_(_0xd0ed05)[_0x0240('0x39')](_0x0240('0x3a'))[_0x0240('0x3b')](_0x0240('0x3c'))['value']();if(_[_0x0240('0x3d')](_0x2af602,_0x134220[_0x0240('0x30')])){return;}var _0x4730d7=_[_0x0240('0x3e')](_0xd0ed05,['value',_0x134220[_0x0240('0x30')]])[_0x0240('0x3f')];return db['UserProfileResource'][_0x0240('0x32')]({'where':{'type':_0x4730d7,'resourceId':_0x134220['id']},'transaction':_0x13e795})[_0x0240('0x24')](function(){return _0x27420b;});})[_0x0240('0x24')](function(){_0xf68f1f['status'](0xcc)[_0x0240('0x1b')]();});}};}function handleEntityNotFound(_0x22831a){return function(_0x2e3bcd){if(!_0x2e3bcd){_0x22831a['sendStatus'](0x194);}return _0x2e3bcd;};}function handleError(_0xfeb578,_0x248ab6){_0x248ab6=_0x248ab6||0x1f4;return function(_0x41e858){logger[_0x0240('0x2b')](_0x41e858[_0x0240('0x40')]);if(_0x41e858['name']){delete _0x41e858[_0x0240('0x3f')];}_0xfeb578[_0x0240('0x1a')](_0x248ab6)[_0x0240('0x41')](_0x41e858);};}function getUserAttributes(){return _(db['User'][_0x0240('0x42')])['map'](function(_0x1f0066){return{'name':_0x1f0066[_0x0240('0x43')],'type':_0x1f0066[_0x0240('0x44')][_0x0240('0x45')]};})['filter'](function(_0x1fb9fc){return!['password',_0x0240('0x46'),_0x0240('0x47'),_0x0240('0x48'),_0x0240('0x49'),_0x0240('0x4a')][_0x0240('0x3d')](_0x1fb9fc[_0x0240('0x3f')]);})[_0x0240('0x3c')]();}exports[_0x0240('0x4b')]=function(_0x578680,_0x5f1664){var _0x4a4788={},_0x31f4bc={'count':0x0,'rows':[]};var _0x44a12a=getUserAttributes();_0x4a4788=qs[_0x0240('0x4c')](_0x44a12a,_0x578680);var _0x3a841c={'where':_0x4a4788['where']};return db['User']['count'](_0x3a841c)[_0x0240('0x24')](function(_0x1e20cc){_0x31f4bc[_0x0240('0x20')]=_0x1e20cc;if(_0x578680[_0x0240('0x4d')]['includeAll']){_0x4a4788[_0x0240('0x4e')]=[{'all':!![]}];}if(_0x578680[_0x0240('0x4d')][_0x0240('0x4f')]===_0x0240('0x50')){_0x4a4788[_0x0240('0x4e')]=[{'model':db[_0x0240('0x51')],'as':_0x0240('0x4f')}];}if(!_[_0x0240('0x3d')](_0x4a4788[_0x0240('0x52')],'id')){_0x4a4788[_0x0240('0x52')][_0x0240('0x53')]('id');}return db[_0x0240('0x54')][_0x0240('0x55')](_0x4a4788);})[_0x0240('0x24')](function(_0x36f3ee){_0x31f4bc['rows']=_0x36f3ee;if(_0x578680[_0x0240('0x4d')][_0x0240('0x56')]==='true'){var _0x33cf4e=[];for(var _0x1f9e35=0x0;_0x1f9e35<_0x31f4bc[_0x0240('0x57')][_0x0240('0x58')];_0x1f9e35++){_0x33cf4e['push'](get_open_tabs(_0x0240('0x59'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e['push'](get_open_tabs(_0x0240('0x5b'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e[_0x0240('0x53')](get_open_tabs('fax',_0x31f4bc[_0x0240('0x57')][_0x1f9e35]['dataValues']));_0x33cf4e[_0x0240('0x53')](get_open_tabs('mail',_0x31f4bc['rows'][_0x1f9e35][_0x0240('0x5a')]));_0x33cf4e[_0x0240('0x53')](get_open_tabs(_0x0240('0x5c'),_0x31f4bc[_0x0240('0x57')][_0x1f9e35]['dataValues']));_0x33cf4e[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x31f4bc['rows'][_0x1f9e35]['dataValues']));}return Promise[_0x0240('0x5e')](_0x33cf4e)[_0x0240('0x24')](function(){return _0x31f4bc;});}else{return _0x31f4bc;}})[_0x0240('0x24')](respondWithFilteredResult(_0x5f1664,_0x4a4788))[_0x0240('0x2e')](handleError(_0x5f1664,null));};exports[_0x0240('0x5f')]=function(_0x3f0647,_0x213bff){var _0xfbcbd1=getUserAttributes();_0x3f0647[_0x0240('0x4d')]['id']=_0x3f0647[_0x0240('0x60')]['id'];var _0x24ebe5=qs[_0x0240('0x4c')](_0xfbcbd1,_0x3f0647);if(_0x3f0647[_0x0240('0x4d')]['includeAll']){_0x24ebe5[_0x0240('0x4e')]=[{'all':!![]}];}if(_0x3f0647[_0x0240('0x4d')][_0x0240('0x4f')]==='true'){_0x24ebe5[_0x0240('0x4e')]=[{'model':db[_0x0240('0x51')],'as':_0x0240('0x4f')}];}_0x24ebe5=_[_0x0240('0x61')]({},_0x24ebe5,_0x3f0647[_0x0240('0x62')]);if(!_['includes'](_0x24ebe5[_0x0240('0x52')],'id')){_0x24ebe5[_0x0240('0x52')][_0x0240('0x53')]('id');}return db[_0x0240('0x54')][_0x0240('0x3e')](_0x24ebe5)['then'](handleEntityNotFound(_0x213bff,null))['then'](function(_0x30364b){var _0x3ed430=[];values=_0x30364b;if(_0x3f0647[_0x0240('0x4d')][_0x0240('0x56')]===_0x0240('0x50')){_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x59'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x5b'),_0x30364b['dataValues']));_0x3ed430['push'](get_open_tabs(_0x0240('0x5c'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x30364b[_0x0240('0x5a')]));_0x3ed430[_0x0240('0x53')](get_open_tabs(_0x0240('0x63'),_0x30364b['dataValues']));_0x3ed430[_0x0240('0x53')](get_open_tabs('mail',_0x30364b[_0x0240('0x5a')]));return Promise[_0x0240('0x5e')](_0x3ed430);}else{return values;}})[_0x0240('0x24')](function(){return values;})[_0x0240('0x24')](respondWithResult(_0x213bff,null))[_0x0240('0x2e')](handleError(_0x213bff,null));};exports['update']=function(_0x338af6,_0x2747d6){if(_0x338af6[_0x0240('0x64')]['id']){delete _0x338af6[_0x0240('0x64')]['id'];}delete _0x338af6['body'][_0x0240('0x30')];return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x338af6['params']['id']}})['then'](handleEntityNotFound(_0x2747d6,null))[_0x0240('0x24')](saveUpdates(_0x338af6['body'],null))[_0x0240('0x24')](respondWithResult(_0x2747d6,null))[_0x0240('0x2e')](handleError(_0x2747d6,null));};exports['describe']=function(_0x1ff3b9,_0x5cf559){return db[_0x0240('0x54')][_0x0240('0x65')]()[_0x0240('0x24')](respondWithResult(_0x5cf559,null))[_0x0240('0x2e')](handleError(_0x5cf559,null));};exports[_0x0240('0x66')]=function(_0x3fc625,_0x3d9dd0){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x3fc625[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x3d9dd0,null))[_0x0240('0x24')](function(_0x13588c){if(_0x13588c){return _0x13588c[_0x0240('0x66')](_0x3fc625[_0x0240('0x64')][_0x0240('0x67')],_[_0x0240('0x68')](_0x3fc625[_0x0240('0x64')],[_0x0240('0x67'),'id'])||{});}})[_0x0240('0x24')](respondWithResult(_0x3d9dd0,null))[_0x0240('0x2e')](handleError(_0x3d9dd0,null));};function validateUser(_0xf3a8d8){return new Promise(function(_0x5b88a6,_0x74f35d){if(_0xf3a8d8[_0x0240('0x69')])return _0x5b88a6(_0xf3a8d8);return db['Setting']['findById'](0x1)['then'](function(_0x206a20){if(_0x206a20['securePassword'])authService[_0x0240('0x6a')](_0xf3a8d8['password']);db['User'][_0x0240('0x6b')](_0x0240('0x69'))[_0x0240('0x24')](function(_0x46491f){if(_['isNil'](_0x46491f)){_0xf3a8d8['internal']=_0x206a20[_0x0240('0x6c')]||0x1;return;}if(_[_0x0240('0x6d')](_0x206a20[_0x0240('0x6c')])||_0x206a20['min_internal']===_0x46491f){_0xf3a8d8[_0x0240('0x69')]=_0x46491f+0x1;return;}if(_0x206a20[_0x0240('0x6c')]>_0x46491f){_0xf3a8d8[_0x0240('0x69')]=_0x206a20[_0x0240('0x6c')];return;}return db[_0x0240('0x6e')][_0x0240('0x4d')](_0x0240('0x6f'),{'type':db[_0x0240('0x6e')][_0x0240('0x70')][_0x0240('0x71')]})['then'](function(_0x55e0f4){if(_0x55e0f4&&_0x55e0f4[_0x0240('0x58')]){for(var _0x25e0f7=0x0,_0x532725=_0x55e0f4[_0x0240('0x58')];_0x25e0f7<_0x532725&&_[_0x0240('0x6d')](_0xf3a8d8[_0x0240('0x69')]);_0x25e0f7++){if(_0x206a20[_0x0240('0x6c')]<=_0x55e0f4[_0x25e0f7][_0x0240('0x72')]){_0xf3a8d8[_0x0240('0x69')]=_0x55e0f4[_0x25e0f7][_0x0240('0x72')];}else if(_0x206a20[_0x0240('0x6c')]>_0x55e0f4[_0x25e0f7][_0x0240('0x72')]&&_0x206a20[_0x0240('0x6c')]<=_0x55e0f4[_0x25e0f7]['to']){_0xf3a8d8[_0x0240('0x69')]=_0x206a20['min_internal'];}}}if(_[_0x0240('0x6d')](_0xf3a8d8[_0x0240('0x69')])){_0xf3a8d8[_0x0240('0x69')]=_0x46491f+0x1;}return _0x5b88a6(_0xf3a8d8);});});})[_0x0240('0x2e')](function(_0x577594){_0x74f35d(_0x577594);});});}function updateUser(_0x41a144){return new Promise(function(_0x3b8564,_0x4f4cc2){try{if(_0x41a144[_0x0240('0x73')]){_0x41a144[_0x0240('0x74')]=_0x41a144['internal'];_0x41a144[_0x0240('0x75')]={'mailbox':_0x41a144['internal'],'password':_0x41a144[_0x0240('0x76')],'fullname':_0x41a144['fullname'],'email':_0x41a144[_0x0240('0x77')]};}if(_0x41a144[_0x0240('0x30')]===_0x0240('0x36')){if(!_0x41a144[_0x0240('0x78')])_0x41a144[_0x0240('0x78')]=['101',_0x0240('0x79'),_0x0240('0x7a'),_0x0240('0x7b'),'110','104',_0x0240('0x7c'),_0x0240('0x7d'),'107',_0x0240('0x7e'),_0x0240('0x7f'),_0x0240('0x80'),_0x0240('0x81'),_0x0240('0x82'),'115'];}_0x3b8564(_0x41a144);}catch(_0x437e03){_0x4f4cc2(_0x437e03);}});}exports[_0x0240('0x83')]=function(_0x43ed4a,_0x4afdf5){if(_0x43ed4a[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x36'))throw new Error(_0x0240('0x84'));if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x34')&&_0x43ed4a[_0x0240('0x34')]['role']!==_0x0240('0x85')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x85')&&_0x43ed4a['user']['role']!=='admin'){throw new Error(_0x0240('0x86'));}return licenseUtil[_0x0240('0x87')]([_0x43ed4a[_0x0240('0x64')]])[_0x0240('0x24')](function(){return validateUser(_0x43ed4a['body']);})['then'](function(_0x97acac){return updateUser(_0x97acac)[_0x0240('0x24')](function(_0x40d744){if(_0x40d744['role']==='admin'){_0x40d744[_0x0240('0x88')]=_0x43ed4a[_0x0240('0x34')][_0x0240('0x88')];delete _0x40d744[_0x0240('0x89')];}return _0x40d744;});})[_0x0240('0x24')](function(_0x1dbdb3){return db['User'][_0x0240('0x83')](_0x1dbdb3,{'include':[{'model':db[_0x0240('0x75')],'as':_0x0240('0x75')}]});})['then'](function(_0x194e01){if(_0x43ed4a[_0x0240('0x64')]['role']===_0x0240('0x34'))return _0x194e01;if(_0x43ed4a[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x34'))return _0x194e01;return db['UserProfileSection'][_0x0240('0x3e')]({'where':{'name':_0x194e01[_0x0240('0x30')]==='agent'?_0x0240('0x35'):_0x0240('0x37'),'userProfileId':_0x43ed4a[_0x0240('0x34')][_0x0240('0x89')]},'raw':!![]})[_0x0240('0x24')](function(_0x566aaf){if(!_0x566aaf||_0x566aaf[_0x0240('0x8a')]!=0x0)return _0x194e01;return db[_0x0240('0x8b')][_0x0240('0x83')]({'name':_0x194e01[_0x0240('0x3f')],'resourceId':_0x194e01['id'],'type':_0x566aaf[_0x0240('0x3f')],'sectionId':_0x566aaf['id']},{})[_0x0240('0x24')](function(){return _0x194e01;});})[_0x0240('0x2e')](function(_0x3c1a3e){logger[_0x0240('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1a3e);throw _0x3c1a3e;});})[_0x0240('0x24')](respondWithResult(_0x4afdf5,0xc9))[_0x0240('0x2e')](handleError(_0x4afdf5,null));};exports[_0x0240('0x8c')]=function(_0x4ec522,_0x30d6be){var _0xeed3a1=_0x4ec522[_0x0240('0x64')];var _0x18889b=[];if(_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x36'))throw new Error(_0x0240('0x84'));if(_[_0x0240('0x8d')](_0xeed3a1,[_0x0240('0x30'),'user'])&&_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x85')){throw new Error(_0x0240('0x8e'));}if(_[_0x0240('0x8d')](_0xeed3a1,[_0x0240('0x30'),_0x0240('0x85')])&&_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x85')){throw new Error(_0x0240('0x8f'));}return licenseUtil['checkUserLimits'](_0xeed3a1)[_0x0240('0x24')](function(){return validateUser(_0xeed3a1[0x0]);})[_0x0240('0x24')](function(){for(var _0x389909=0x1;_0x389909<_0xeed3a1[_0x0240('0x58')];_0x389909++){var _0x43dea7=_0xeed3a1[_0x389909-0x1][_0x0240('0x69')];if(!_0xeed3a1[_0x389909][_0x0240('0x69')])_0xeed3a1[_0x389909][_0x0240('0x69')]=_0x43dea7+0x1;_0x18889b[_0x0240('0x53')](validateUser(_0xeed3a1[_0x389909]));}return Promise['all'](_0x18889b);})['then'](function(){_0x18889b=[];for(var _0x4ac990=0x0;_0x4ac990<_0xeed3a1['length'];_0x4ac990++){_0x18889b[_0x0240('0x53')](updateUser(_0xeed3a1[_0x4ac990]));}return Promise[_0x0240('0x5e')](_0x18889b);})['then'](function(){_0x18889b=_0xeed3a1[_0x0240('0x3b')](function(_0x45cb03){return db[_0x0240('0x54')]['create'](_0x45cb03,{'include':[{'model':db[_0x0240('0x75')],'as':_0x0240('0x75')}]})[_0x0240('0x24')](function(_0x2e3820){_0x45cb03['id']=_0x2e3820['id'];return _0x45cb03;});});return Promise['all'](_0x18889b);})[_0x0240('0x24')](function(_0x2fd752){if(_0x4ec522[_0x0240('0x64')][_0x0240('0x30')]==='user')return _0x2fd752;if(_0x4ec522[_0x0240('0x34')][_0x0240('0x30')]!==_0x0240('0x34'))return _0x2fd752;var _0x5d57fa=_['some'](_0x2fd752,function(_0x4ae3ec){return _0x4ae3ec[_0x0240('0x30')]===_0x0240('0x36')||_0x4ae3ec[_0x0240('0x30')]===_0x0240('0x38');});if(!_0x5d57fa)return _0x2fd752;return db[_0x0240('0x90')]['findAll']({'where':{'name':{'$or':[_0x0240('0x35'),'Telephones']},'userProfileId':_0x4ec522[_0x0240('0x34')][_0x0240('0x89')]},'raw':!![]})[_0x0240('0x24')](function(_0x3b0c48){if(_[_0x0240('0x91')](_0x3b0c48)||!_[_0x0240('0x8d')](_0x3b0c48,[_0x0240('0x8a'),0x0]))return _0x2fd752;_0x18889b=[];var _0x2c8a09=_(_0x3b0c48)['map'](function(_0x234152){if(_0x234152[_0x0240('0x8a')]===0x1)return;return _0x234152[_0x0240('0x3f')]==='Agents'?_0x0240('0x36'):_0x0240('0x38');})['compact']()[_0x0240('0x3c')]();for(var _0x4eedba=0x0;_0x4eedba<_0x2fd752['length'];_0x4eedba++){if(!_[_0x0240('0x3d')](_0x2c8a09,_0x2fd752[_0x4eedba]['role']))return;var _0x1f1234=_0x2fd752[_0x4eedba][_0x0240('0x30')]===_0x0240('0x36')?'Agents':_0x0240('0x37');_0x18889b[_0x0240('0x53')](db[_0x0240('0x8b')][_0x0240('0x83')]({'name':_0x2fd752[_0x4eedba][_0x0240('0x3f')],'resourceId':_0x2fd752[_0x4eedba]['id'],'type':_0x1f1234,'sectionId':_[_0x0240('0x3e')](_0x3b0c48,[_0x0240('0x3f'),_0x1f1234])['id']},{}));}return Promise['all'](_0x18889b);});})[_0x0240('0x24')](respondWithResult(_0x30d6be,0xc9))['catch'](handleError(_0x30d6be,null));};exports[_0x0240('0x92')]=function(_0xe30be3,_0x2a4b59){if(_0xe30be3[_0x0240('0x64')]['id']){delete _0xe30be3['body']['id'];}return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0xe30be3[_0x0240('0x60')]['id']}})[_0x0240('0x24')](function(_0x3ed96c){if(!_0x3ed96c)return null;if(_0x3ed96c['id']===_0xe30be3[_0x0240('0x34')]['id']){if(!_0xe30be3['body'][_0x0240('0x93')]||!_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3ed96c['authenticate'](_0xe30be3[_0x0240('0x64')][_0x0240('0x93')])){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x97'));}if(_0xe30be3[_0x0240('0x64')][_0x0240('0x93')]===_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x98'));}}else if(_0xe30be3[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x85')){if(!_0xe30be3['body'][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x99'));}}else if(_0xe30be3[_0x0240('0x34')][_0x0240('0x30')]===_0x0240('0x34')){if(!_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]){throw new db[(_0x0240('0x95'))]['ValidationError'](_0x0240('0x99'));}if(_0x3ed96c['role']!==_0x0240('0x36')){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))]('Unauthorized');}}else{throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0x84'));}return _0x3ed96c;})[_0x0240('0x24')](handleEntityNotFound(_0x2a4b59,null))[_0x0240('0x24')](function(_0x5d0fcb){return db['Setting']['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x0240('0x24')](function(_0x38437c){if(_0x38437c['securePassword'])authService['validatePasswordPattern'](_0xe30be3[_0x0240('0x64')][_0x0240('0x94')]);if(!_0x38437c[_0x0240('0x9a')]||!_0x5d0fcb[_0x0240('0x47')])return _0x5d0fcb;authService[_0x0240('0x9b')](_0xe30be3[_0x0240('0x64')]['newPassword'],_0x5d0fcb[_0x0240('0x47')],_0x38437c[_0x0240('0x9c')]);return _0x5d0fcb;})['then'](saveUpdates({'password':_0xe30be3[_0x0240('0x64')][_0x0240('0x94')],'passwordResetAt':_0xe30be3[_0x0240('0x34')]['id']==_0xe30be3['params']['id']?moment():null,'previousPasswords':authService[_0x0240('0x9d')](_0xe30be3[_0x0240('0x64')][_0x0240('0x94')],_0x5d0fcb[_0x0240('0x47')])},null));})['then'](respondWithResult(_0x2a4b59,null))[_0x0240('0x2e')](handleError(_0x2a4b59,null));};exports[_0x0240('0x9e')]=function(_0x4b0b25,_0xefb7e3){var _0x41aa5d=_0x4b0b25[_0x0240('0x64')]['channel'];return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x4b0b25[_0x0240('0x60')]['id']},'attributes':['id','name','role',_0x0240('0x9f'),'loginInPause',_0x0240('0xa0'),'interface']})[_0x0240('0x24')](handleEntityNotFound(_0xefb7e3,null))[_0x0240('0x24')](function(_0x4b089b){if(_0x4b089b){if(!utils[_0x0240('0xa1')](_0x41aa5d)){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xa2'));}return _0x4b089b[_0x0240('0xa3')+_[_0x0240('0xa4')](_0x41aa5d[_0x0240('0xa5')]())+'Queues'](_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')],{'penalty':_0x4b0b25[_0x0240('0x64')][_0x0240('0xa6')]||0x0})[_0x0240('0xa7')](function(_0x285a52){for(var _0x1d8fdc=0x0;_0x1d8fdc<_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')][_0x0240('0x58')];_0x1d8fdc+=0x1){var _0x2a2f72={'UserId':Number(_0x4b0b25[_0x0240('0x60')]['id'])};_0x2a2f72[_[_0x0240('0xa4')](_0x41aa5d[_0x0240('0xa5')]())+_0x0240('0xa8')]=Number(_0x4b0b25[_0x0240('0x64')][_0x0240('0x67')][_0x1d8fdc]);socket['emit'](_0x0240('0x34')+_[_0x0240('0xa4')](_0x41aa5d['toLowerCase']())+'Queue:save',_0x2a2f72);}return _0x285a52;})[_0x0240('0x24')](function(){if(_0x41aa5d==='voice'){return db[_0x0240('0xa9')][_0x0240('0x55')]({'where':{'id':_0x4b0b25[_0x0240('0x64')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x0240('0x24')](function(_0x3e22f6){var _0x2bba83=_0x4b089b[_0x0240('0xaa')]({'plain':!![]});var _0x190dd5=[];if(_0x41aa5d===_0x0240('0xab')&&_0x2bba83[_0x0240('0x30')]===_0x0240('0x36')&&_0x2bba83['online']){for(let _0x53578e=0x0;_0x53578e<_0x3e22f6['length'];_0x53578e+=0x1){_0x190dd5[_0x0240('0x53')]({'membername':_0x2bba83['name'],'UserId':_0x2bba83['id'],'queue_name':_0x3e22f6[_0x53578e][_0x0240('0x3f')],'VoiceQueueId':_0x3e22f6[_0x53578e]['id'],'interface':_['isNil'](_0x2bba83[_0x0240('0xac')])?util[_0x0240('0xad')](_0x0240('0xae'),_0x2bba83[_0x0240('0x3f')]):_0x2bba83[_0x0240('0xac')],'paused':_0x2bba83[_0x0240('0xa0')]||![],'penalty':_0x4b0b25[_0x0240('0x64')]['penalty']||0x0});}return Promise[_0x0240('0x5e')](_0x190dd5[_0x0240('0x3b')](function(_0x3b0e2b){return db[_0x0240('0xaf')]['upsert'](_0x3b0e2b);}));}return _0x4b089b;});}})['then'](respondWithStatusCode(_0xefb7e3,null))[_0x0240('0x2e')](handleError(_0xefb7e3,null));};exports[_0x0240('0xb0')]=function(_0x45cc17,_0x50ff98){var _0x56d179,_0x5431f7;return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x45cc17[_0x0240('0x60')]['id']},'attributes':['id','name','role']})[_0x0240('0x24')](handleEntityNotFound(_0x50ff98,null))['then'](function(_0xc75a13){if(_0xc75a13){_0x56d179=_0xc75a13;if(!_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]||!utils[_0x0240('0xa1')](_0x45cc17['query'][_0x0240('0xb1')])){throw new db[(_0x0240('0x95'))]['ValidationError'](_0x0240('0xa2'));}return _0xc75a13[_0x0240('0xb2')+_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')][_0x0240('0xa5')]())+'Queues'](_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')]);}})['then'](function(_0x44307a){if(_[_0x0240('0xb3')](_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')])){for(var _0x26cf75=0x0;_0x26cf75<_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')][_0x0240('0x58')];_0x26cf75+=0x1){_0x5431f7={'UserId':Number(_0x45cc17[_0x0240('0x60')]['id'])};_0x5431f7[_[_0x0240('0xa4')](_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xa8')]=Number(_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')][_0x26cf75]);socket[_0x0240('0x31')](_0x0240('0x34')+_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xb4'),_0x5431f7);}}else{_0x5431f7={'UserId':Number(_0x45cc17[_0x0240('0x60')]['id'])};_0x5431f7[_[_0x0240('0xa4')](_0x45cc17['query'][_0x0240('0xb1')][_0x0240('0xa5')]())+'QueueId']=Number(_0x45cc17[_0x0240('0x4d')][_0x0240('0x67')]);socket[_0x0240('0x31')](_0x0240('0x34')+_['capitalize'](_0x45cc17[_0x0240('0x4d')][_0x0240('0xb1')]['toLowerCase']())+_0x0240('0xb4'),_0x5431f7);}return _0x44307a;})[_0x0240('0x24')](function(){if(_0x45cc17[_0x0240('0x4d')]['channel']==='voice'){return db[_0x0240('0xaf')]['destroy']({'where':{'UserId':_0x45cc17[_0x0240('0x60')]['id'],'VoiceQueueId':_0x45cc17[_0x0240('0x4d')]['ids']},'individualHooks':!![]})['then'](function(){return _0x56d179;});}return _0x56d179;})[_0x0240('0x24')](respondWithStatusCode(_0x50ff98,null))[_0x0240('0x2e')](handleError(_0x50ff98,null));};exports[_0x0240('0xb5')]=function(_0x42b9a0,_0x4471bb){_0x42b9a0[_0x0240('0x64')][_0x0240('0xb6')]=_0x42b9a0['file'][_0x0240('0xb7')];return db['User']['find']({'where':{'id':_0x42b9a0[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4471bb,null))[_0x0240('0x24')](saveUpdates(_0x42b9a0[_0x0240('0x64')],null))[_0x0240('0x24')](respondWithResult(_0x4471bb,null))['catch'](handleError(_0x4471bb,null));};exports[_0x0240('0xb8')]=function(_0x299ed1,_0x6fb277){var _0x92c9af=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x0240('0x54')]['find']({'where':{'id':_0x299ed1[_0x0240('0x60')]['id']},'attributes':['id',_0x0240('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x6fb277,null))[_0x0240('0x24')](function(_0x4e6e86){if(_0x4e6e86){if(_[_0x0240('0x6d')](_0x4e6e86[_0x0240('0xb6')])){return _0x6fb277['download'](_0x92c9af);}else{if(!fs[_0x0240('0xb9')](path[_0x0240('0xba')](config['root'],_0x0240('0xbb'),_0x4e6e86['userpic']))){return _0x6fb277[_0x0240('0xbc')](_0x92c9af);}return _0x6fb277[_0x0240('0xbc')](path['join'](config['root'],'server/files/images/',_0x4e6e86[_0x0240('0xb6')]));}}})[_0x0240('0x2e')](handleError(_0x6fb277,null));};exports['getOpenTabs']=function(_0x25b8a0,_0x2df38b){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x25b8a0[_0x0240('0x60')]['id']},'attributes':['id']})[_0x0240('0x24')](handleEntityNotFound(_0x2df38b,null))[_0x0240('0x24')](function(_0x500260){var _0x413b94=[];values=_0x500260[_0x0240('0x5a')];_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x59'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5b'),_0x500260['dataValues']));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5c'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x5d'),_0x500260['dataValues']));_0x413b94[_0x0240('0x53')](get_open_tabs(_0x0240('0x63'),_0x500260[_0x0240('0x5a')]));_0x413b94[_0x0240('0x53')](get_open_tabs('mail',_0x500260[_0x0240('0x5a')]));return Promise[_0x0240('0x5e')](_0x413b94);})[_0x0240('0x24')](function(_0x31c3a6){if(_0x31c3a6){var _0x4eef67=_['map'](values[_0x0240('0xbd')],function(_0x162f84){return{'channel':_0x0240('0xbe'),'id':_0x162f84['id'],'createdAt':_0x162f84[_0x0240('0xbf')]};});var _0x189bf6=_[_0x0240('0x3b')](values[_0x0240('0xc0')],function(_0x2aa2a0){return{'channel':_0x0240('0xc1'),'id':_0x2aa2a0['id'],'createdAt':_0x2aa2a0['createdAt']};});var _0x46e07f=_[_0x0240('0x3b')](values[_0x0240('0xc2')],function(_0x907fa2){return{'channel':_0x0240('0xc3'),'id':_0x907fa2['id'],'createdAt':_0x907fa2['createdAt']};});var _0xac24df=_[_0x0240('0x3b')](values['MailOpenTabs'],function(_0x35b92a){return{'channel':_0x0240('0xc4'),'id':_0x35b92a['id'],'createdAt':_0x35b92a['createdAt']};});var _0x226e7e=_['map'](values[_0x0240('0xc5')],function(_0x20aa22){return{'channel':_0x0240('0xc6'),'id':_0x20aa22['id'],'createdAt':_0x20aa22[_0x0240('0xbf')]};});var _0x5427ea=_[_0x0240('0x3b')](values['WhatsappOpenTabs'],function(_0xfb7227){return{'channel':'WHATSAPP','id':_0xfb7227['id'],'createdAt':_0xfb7227[_0x0240('0xbf')]};});var _0x209835=_[_0x0240('0xc7')](_0x4eef67,_0x189bf6,_0x46e07f,_0xac24df,_0x226e7e,_0x5427ea);var _0x1f2946={'count':_0x209835[_0x0240('0x58')],'rows':_0x209835};return _0x1f2946;}else return null;})[_0x0240('0x24')](respondWithResult(_0x2df38b,null))['catch'](handleError(_0x2df38b,null));};exports[_0x0240('0xc8')]=function(_0x1ee741,_0x2a396d){var _0x5c6ff4={};return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x1ee741[_0x0240('0x60')]['id']}})[_0x0240('0x24')](function(_0x37e1ae){if(!_0x37e1ae){throw new APINotFoundError(util['format'](_0x0240('0xca'),_0x1ee741['params']['id']));}return contacts[_0x0240('0x65')]();})['then'](function(_0x20f8a8){_0x1ee741[_0x0240('0x4d')][_0x0240('0x54')]=_0x1ee741['params']['id'];_0x5c6ff4=qs['getOptions'](_0x20f8a8,_0x1ee741);if(_0x1ee741[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xcc'))){_0x5c6ff4['include']=[{'model':db['CmList'],'as':_0x0240('0xcd'),'required':![]},{'model':db[_0x0240('0xce')],'as':_0x0240('0xcf'),'attributes':['id','name',_0x0240('0xd0')],'where':_0x1ee741[_0x0240('0x4d')]['tag']?{'id':_0x1ee741[_0x0240('0x4d')][_0x0240('0xd1')]}:undefined,'required':_0x1ee741[_0x0240('0x4d')][_0x0240('0xd1')]?!![]:![]}];}return contacts['findAll'](_0x1ee741[_0x0240('0x4d')],_0x1ee741[_0x0240('0x34')],_0x5c6ff4,_0x20f8a8);})[_0x0240('0x24')](respondWithFilteredResult(_0x2a396d,_0x5c6ff4))[_0x0240('0x2e')](APIHandleError(_0x2a396d));};exports[_0x0240('0xd2')]=function(_0x1c7f07,_0x4963d3){var _0x5374f3;var _0xec5bab={};var _0x592e82;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x1c7f07['params']['id']},'attributes':['id','name',_0x0240('0x30')]})['then'](handleEntityNotFound(_0x4963d3,null))[_0x0240('0x24')](function(_0x5cef0a){if(!utils[_0x0240('0xa1')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])){throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xa2'));}_0x5374f3=_0x5cef0a;var _0x13161c={};_0x13161c['model']=_[_0x0240('0xd3')](db[_[_0x0240('0xa4')](_0x1c7f07['query'][_0x0240('0xb1')])+_0x0240('0xd4')][_0x0240('0x42')]);_0x13161c['query']=_[_0x0240('0xd3')](_0x1c7f07[_0x0240('0x4d')]);_0x13161c[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x13161c[_0x0240('0xd7')],_0x13161c[_0x0240('0x4d')]);_0xec5bab[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x13161c[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x1c7f07['query']['fields']));_0xec5bab['attributes']=_0xec5bab['attributes'][_0x0240('0x58')]?_0xec5bab[_0x0240('0x52')]:_0x13161c[_0x0240('0xd7')];_0xec5bab[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xda')]);_0xec5bab['where']=qs['filters'](_[_0x0240('0xdb')](_0x1c7f07[_0x0240('0x4d')],_0x13161c['filters']));if(_0x1c7f07[_0x0240('0x4d')][_0x0240('0x39')]){_0xec5bab['where']=_[_0x0240('0x61')](_0xec5bab['where'],{'$or':_[_0x0240('0x3b')](_0xec5bab[_0x0240('0x52')],function(_0xa5e5ef){var _0x3fafd8={};_0x3fafd8[_0xa5e5ef]={'$like':'%'+_0x1c7f07['query'][_0x0240('0x39')]+'%'};return _0x3fafd8;})});}_0xec5bab=_['merge']({},_0xec5bab,_0x1c7f07[_0x0240('0x62')]);switch(_0x5374f3[_0x0240('0x30')]){case _0x0240('0x85'):return db[_[_0x0240('0xa4')](_0x1c7f07[_0x0240('0x4d')]['channel'])+_0x0240('0xd4')][_0x0240('0x55')](_0xec5bab);case _0x0240('0x34'):case _0x0240('0x36'):return _0x5374f3['get'+_[_0x0240('0xa4')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])+_0x0240('0xdc')](_0xec5bab);default:throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xdd'));}})['then'](function(_0x2f8d11){_0x592e82=_0x2f8d11[_0x0240('0x58')];if(!_0x1c7f07['query']['hasOwnProperty'](_0x0240('0xde'))){_0xec5bab[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0x1f')]);_0xec5bab[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x1c7f07[_0x0240('0x4d')][_0x0240('0x1d')]);}switch(_0x5374f3[_0x0240('0x30')]){case _0x0240('0x85'):return db[_[_0x0240('0xa4')](_0x1c7f07['query'][_0x0240('0xb1')])+_0x0240('0xd4')][_0x0240('0x55')](_0xec5bab);case _0x0240('0x34'):case _0x0240('0x36'):return _0x5374f3[_0x0240('0xaa')+_['capitalize'](_0x1c7f07[_0x0240('0x4d')][_0x0240('0xb1')])+_0x0240('0xdc')](_0xec5bab);}})[_0x0240('0x24')](function(_0x42d8c4){return{'count':_0x592e82,'rows':_0x42d8c4};})[_0x0240('0x24')](respondWithResult(_0x4963d3,null))[_0x0240('0x2e')](handleError(_0x4963d3,null));};exports[_0x0240('0xdf')]=function(_0x102a2c,_0x313f49){var _0xe63399={};var _0x366eb7={};var _0x12f306;var _0x35924d;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x102a2c[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x313f49,null))[_0x0240('0x24')](function(_0x319b77){if(_0x319b77){_0x12f306=_0x319b77;_0x366eb7['model']=_['keys'](db[_0x0240('0xaf')][_0x0240('0x42')]);_0x366eb7[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x102a2c['query']);_0x366eb7[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x366eb7[_0x0240('0xd7')],_0x366eb7['query']);_0xe63399[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x366eb7['model'],qs[_0x0240('0xd8')](_0x102a2c[_0x0240('0x4d')][_0x0240('0xd8')]));_0xe63399['attributes']=_0xe63399[_0x0240('0x52')]['length']?_0xe63399[_0x0240('0x52')]:_0x366eb7[_0x0240('0xd7')];_0xe63399['order']=qs[_0x0240('0xda')](_0x102a2c[_0x0240('0x4d')][_0x0240('0xda')]);_0xe63399[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x102a2c[_0x0240('0x4d')],_0x366eb7[_0x0240('0xd5')]));if(_0x102a2c[_0x0240('0x4d')][_0x0240('0x39')]){_0xe63399[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xe63399['where'],{'$or':_[_0x0240('0x3b')](_0xe63399[_0x0240('0x52')],function(_0x365fd4){var _0x31959c={};_0x31959c[_0x365fd4]={'$like':'%'+_0x102a2c[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x31959c;})});}_0xe63399=_['merge']({},_0xe63399,_0x102a2c[_0x0240('0x62')]);return _0x12f306['getVoiceQueuesRt'](_0xe63399);}})[_0x0240('0x24')](function(_0x4d87ef){if(_0x4d87ef){_0x35924d=_0x4d87ef[_0x0240('0x58')];if(!_0x102a2c['query']['hasOwnProperty'](_0x0240('0xde'))){_0xe63399['limit']=qs[_0x0240('0x1f')](_0x102a2c['query'][_0x0240('0x1f')]);_0xe63399[_0x0240('0x1d')]=qs['offset'](_0x102a2c[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x12f306[_0x0240('0xdf')](_0xe63399);}})[_0x0240('0x24')](function(_0x194058){if(_0x194058){return _0x194058?{'count':_0x35924d,'rows':_0x194058}:null;}})[_0x0240('0x24')](respondWithResult(_0x313f49,null))['catch'](handleError(_0x313f49,null));};exports['getGroups']=function(_0x53f870,_0x61e002){var _0x3023b4={};var _0x35833b={};var _0x2eca4e;var _0x36d5a2;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x53f870[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x61e002,null))[_0x0240('0x24')](function(_0x924ddc){if(_0x924ddc){_0x2eca4e=_0x924ddc;_0x35833b[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe1')][_0x0240('0x42')]);_0x35833b[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x53f870[_0x0240('0x4d')]);_0x35833b[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x35833b[_0x0240('0xd7')],_0x35833b[_0x0240('0x4d')]);_0x3023b4[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x35833b[_0x0240('0xd7')],qs['fields'](_0x53f870[_0x0240('0x4d')][_0x0240('0xd8')]));_0x3023b4[_0x0240('0x52')]=_0x3023b4[_0x0240('0x52')][_0x0240('0x58')]?_0x3023b4[_0x0240('0x52')]:_0x35833b[_0x0240('0xd7')];_0x3023b4[_0x0240('0xd9')]=qs['sort'](_0x53f870[_0x0240('0x4d')][_0x0240('0xda')]);_0x3023b4[_0x0240('0xe0')]=qs['filters'](_['pick'](_0x53f870[_0x0240('0x4d')],_0x35833b[_0x0240('0xd5')]));if(_0x53f870['query'][_0x0240('0x39')]){_0x3023b4[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x3023b4[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x3023b4[_0x0240('0x52')],function(_0x4eacc5){var _0xb364a3={};_0xb364a3[_0x4eacc5]={'$like':'%'+_0x53f870[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0xb364a3;})});}_0x3023b4=_[_0x0240('0x61')]({},_0x3023b4,_0x53f870['options']);return _0x2eca4e[_0x0240('0xe2')](_0x3023b4);}})[_0x0240('0x24')](function(_0x5cff6a){if(_0x5cff6a){_0x36d5a2=_0x5cff6a['length'];if(!_0x53f870['query']['hasOwnProperty'](_0x0240('0xde'))){_0x3023b4[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x53f870[_0x0240('0x4d')][_0x0240('0x1f')]);_0x3023b4[_0x0240('0x1d')]=qs['offset'](_0x53f870[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x2eca4e[_0x0240('0xe2')](_0x3023b4);}})[_0x0240('0x24')](function(_0x5a9ec2){if(_0x5a9ec2){return _0x5a9ec2?{'count':_0x36d5a2,'rows':_0x5a9ec2}:null;}})[_0x0240('0x24')](respondWithResult(_0x61e002,null))['catch'](handleError(_0x61e002,null));};exports['getRecordings']=function(_0x464957,_0x4a5b53){var _0x551991={'raw':!![],'where':{}};var _0x25794a={};var _0x58ca12={'count':0x0,'rows':[]};return db['User'][_0x0240('0xc9')]({'where':{'id':_0x464957[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4a5b53,null))[_0x0240('0x24')](function(_0x55b154){if(_0x55b154){_0x25794a[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe3')][_0x0240('0x42')]);_0x25794a[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x464957[_0x0240('0x4d')]);_0x25794a[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x25794a[_0x0240('0xd7')],_0x25794a[_0x0240('0x4d')]);_0x551991['attributes']=_[_0x0240('0xd6')](_0x25794a['model'],qs[_0x0240('0xd8')](_0x464957['query']['fields']));_0x551991[_0x0240('0x52')]=_0x551991[_0x0240('0x52')][_0x0240('0x58')]?_0x551991[_0x0240('0x52')]:_0x25794a['model'];if(!_0x464957[_0x0240('0x4d')]['hasOwnProperty'](_0x0240('0xde'))){_0x551991[_0x0240('0x1f')]=qs['limit'](_0x464957[_0x0240('0x4d')][_0x0240('0x1f')]);_0x551991[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x464957['query']['offset']);}_0x551991[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x464957[_0x0240('0x4d')][_0x0240('0xda')]);_0x551991[_0x0240('0xe0')]=qs['filters'](_[_0x0240('0xdb')](_0x464957['query'],_0x25794a[_0x0240('0xd5')]));_0x551991['where'][_0x0240('0xe4')]=_0x55b154['id'];if(_0x464957[_0x0240('0x4d')][_0x0240('0x39')]){_0x551991['where']=_[_0x0240('0x61')](_0x551991[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x551991[_0x0240('0x52')],function(_0x584d48){var _0x2d996b={};_0x2d996b[_0x584d48]={'$like':'%'+_0x464957['query'][_0x0240('0x39')]+'%'};return _0x2d996b;})});}_0x551991=_[_0x0240('0x61')]({},_0x551991,_0x464957[_0x0240('0x62')]);return db[_0x0240('0xe3')][_0x0240('0x20')]({'where':_0x551991[_0x0240('0xe0')]})['then'](function(_0xd1f3f5){_0x58ca12['count']=_0xd1f3f5;if(_0x464957['query'][_0x0240('0xcc')]){_0x551991['include']=[{'all':!![]}];}return db[_0x0240('0xe3')][_0x0240('0x55')](_0x551991);})['then'](function(_0x2afbc5){_0x58ca12[_0x0240('0x57')]=_0x2afbc5;return _0x58ca12;});}})['then'](respondWithFilteredResult(_0x4a5b53,_0x551991))[_0x0240('0x2e')](handleError(_0x4a5b53,null));};exports[_0x0240('0xe5')]=function(_0x5b99d3,_0x147ba3){var _0xa6bb4={'raw':!![],'where':{}};var _0x11cf01={};var _0x493d9c={'count':0x0,'rows':[]};return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x5b99d3[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x147ba3,null))['then'](function(_0x4bb6c0){if(_0x4bb6c0){_0x11cf01['model']=_['keys'](db[_0x0240('0xe6')][_0x0240('0x42')]);_0x11cf01[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x5b99d3[_0x0240('0x4d')]);_0x11cf01[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x11cf01[_0x0240('0xd7')],_0x11cf01['query']);_0xa6bb4[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x11cf01['model'],qs['fields'](_0x5b99d3['query'][_0x0240('0xd8')]));_0xa6bb4[_0x0240('0x52')]=_0xa6bb4['attributes'][_0x0240('0x58')]?_0xa6bb4[_0x0240('0x52')]:_0x11cf01['model'];if(!_0x5b99d3[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0xa6bb4[_0x0240('0x1f')]=qs['limit'](_0x5b99d3[_0x0240('0x4d')][_0x0240('0x1f')]);_0xa6bb4[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x5b99d3[_0x0240('0x4d')][_0x0240('0x1d')]);}_0xa6bb4[_0x0240('0xd9')]=qs['sort'](_0x5b99d3[_0x0240('0x4d')]['sort']);_0xa6bb4['where']=qs[_0x0240('0xd5')](_['pick'](_0x5b99d3['query'],_0x11cf01[_0x0240('0xd5')]));_0xa6bb4[_0x0240('0xe0')][_0x0240('0xe4')]=_0x4bb6c0['id'];if(_0x5b99d3[_0x0240('0x4d')][_0x0240('0x39')]){_0xa6bb4[_0x0240('0xe0')]=_['merge'](_0xa6bb4['where'],{'$or':_[_0x0240('0x3b')](_0xa6bb4['attributes'],function(_0x29dd22){var _0x8cbc39={};_0x8cbc39[_0x29dd22]={'$like':'%'+_0x5b99d3[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x8cbc39;})});}_0xa6bb4=_[_0x0240('0x61')]({},_0xa6bb4,_0x5b99d3[_0x0240('0x62')]);return db['ScreenRecording'][_0x0240('0x20')]({'where':_0xa6bb4[_0x0240('0xe0')]})['then'](function(_0x4c67ad){_0x493d9c[_0x0240('0x20')]=_0x4c67ad;if(_0x5b99d3['query']['includeAll']){_0xa6bb4['include']=[{'all':!![]}];}return db[_0x0240('0xe6')]['findAll'](_0xa6bb4);})['then'](function(_0x14a823){_0x493d9c['rows']=_0x14a823;return _0x493d9c;});}})[_0x0240('0x24')](respondWithFilteredResult(_0x147ba3,_0xa6bb4))[_0x0240('0x2e')](handleError(_0x147ba3,null));};exports[_0x0240('0xe7')]=function(_0x296714,_0x45acca){var _0x1b5aa2={};var _0x3f6c7b={};var _0x1d6da1;var _0x4b43d0;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x296714[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x45acca,null))['then'](function(_0x1da172){if(_0x1da172){_0x1d6da1=_0x1da172;_0x3f6c7b[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xe8')][_0x0240('0x42')]);_0x3f6c7b[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x296714[_0x0240('0x4d')]);_0x3f6c7b[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x3f6c7b['model'],_0x3f6c7b[_0x0240('0x4d')]);_0x1b5aa2[_0x0240('0x52')]=_['intersection'](_0x3f6c7b[_0x0240('0xd7')],qs['fields'](_0x296714[_0x0240('0x4d')][_0x0240('0xd8')]));_0x1b5aa2[_0x0240('0x52')]=_0x1b5aa2[_0x0240('0x52')][_0x0240('0x58')]?_0x1b5aa2['attributes']:_0x3f6c7b[_0x0240('0xd7')];_0x1b5aa2[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x296714[_0x0240('0x4d')]['sort']);_0x1b5aa2[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x296714[_0x0240('0x4d')],_0x3f6c7b['filters']));if(_0x296714[_0x0240('0x4d')][_0x0240('0x39')]){_0x1b5aa2[_0x0240('0xe0')]=_['merge'](_0x1b5aa2[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x1b5aa2[_0x0240('0x52')],function(_0x34a86e){var _0x494c28={};_0x494c28[_0x34a86e]={'$like':'%'+_0x296714[_0x0240('0x4d')]['filter']+'%'};return _0x494c28;})});}_0x1b5aa2=_['merge']({},_0x1b5aa2,_0x296714[_0x0240('0x62')]);return _0x1d6da1[_0x0240('0xe7')](_0x1b5aa2);}})[_0x0240('0x24')](function(_0x441358){if(_0x441358){_0x4b43d0=_0x441358[_0x0240('0x58')];if(!_0x296714['query']['hasOwnProperty'](_0x0240('0xde'))){_0x1b5aa2['limit']=qs[_0x0240('0x1f')](_0x296714[_0x0240('0x4d')]['limit']);_0x1b5aa2[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x296714[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x1d6da1[_0x0240('0xe7')](_0x1b5aa2);}})[_0x0240('0x24')](function(_0x3724f0){if(_0x3724f0){return _0x3724f0?{'count':_0x4b43d0,'rows':_0x3724f0}:null;}})[_0x0240('0x24')](respondWithResult(_0x45acca,null))[_0x0240('0x2e')](handleError(_0x45acca,null));};exports[_0x0240('0xe9')]=function(_0x282a3c,_0x348165){var _0x54ad78={};var _0x4673e4={};var _0x393cc0;var _0x100f19;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x282a3c[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x348165,null))[_0x0240('0x24')](function(_0x4948e6){if(_0x4948e6){_0x393cc0=_0x4948e6;_0x4673e4['model']=_[_0x0240('0xd3')](db[_0x0240('0xea')]['rawAttributes']);_0x4673e4[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x282a3c[_0x0240('0x4d')]);_0x4673e4[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x4673e4['model'],_0x4673e4['query']);_0x54ad78['attributes']=_[_0x0240('0xd6')](_0x4673e4['model'],qs[_0x0240('0xd8')](_0x282a3c['query']['fields']));_0x54ad78[_0x0240('0x52')]=_0x54ad78['attributes'][_0x0240('0x58')]?_0x54ad78[_0x0240('0x52')]:_0x4673e4[_0x0240('0xd7')];_0x54ad78[_0x0240('0xd9')]=qs['sort'](_0x282a3c[_0x0240('0x4d')]['sort']);_0x54ad78[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x282a3c[_0x0240('0x4d')],_0x4673e4[_0x0240('0xd5')]));if(_0x282a3c[_0x0240('0x4d')][_0x0240('0x39')]){_0x54ad78[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x54ad78['where'],{'$or':_['map'](_0x54ad78[_0x0240('0x52')],function(_0x3d4f04){var _0x1ab3ca={};_0x1ab3ca[_0x3d4f04]={'$like':'%'+_0x282a3c['query']['filter']+'%'};return _0x1ab3ca;})});}_0x54ad78=_['merge']({},_0x54ad78,_0x282a3c[_0x0240('0x62')]);return _0x393cc0[_0x0240('0xe9')](_0x54ad78);}})[_0x0240('0x24')](function(_0x2b8d17){if(_0x2b8d17){_0x100f19=_0x2b8d17[_0x0240('0x58')];if(!_0x282a3c[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x54ad78['limit']=qs[_0x0240('0x1f')](_0x282a3c[_0x0240('0x4d')][_0x0240('0x1f')]);_0x54ad78['offset']=qs['offset'](_0x282a3c['query']['offset']);}return _0x393cc0['getOpenchannelInteractions'](_0x54ad78);}})['then'](function(_0x40ceb6){if(_0x40ceb6){return _0x40ceb6?{'count':_0x100f19,'rows':_0x40ceb6}:null;}})[_0x0240('0x24')](respondWithResult(_0x348165,null))[_0x0240('0x2e')](handleError(_0x348165,null));};exports['getMailInteractions']=function(_0x402b69,_0x445b2f){var _0xb6756d={'raw':!![],'where':{}};var _0x5ed859={};var _0xb92850={'count':0x0,'rows':[]};return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x402b69['params']['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x445b2f,null))[_0x0240('0x24')](function(_0x52cca6){if(_0x52cca6){_0x5ed859[_0x0240('0xd7')]=_['keys'](db[_0x0240('0xeb')][_0x0240('0x42')]);_0x5ed859[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x402b69['query']);_0x5ed859['filters']=_[_0x0240('0xd6')](_0x5ed859[_0x0240('0xd7')],_0x5ed859[_0x0240('0x4d')]);_0xb6756d[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x5ed859[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x402b69[_0x0240('0x4d')][_0x0240('0xd8')]));_0xb6756d[_0x0240('0x52')]=_0xb6756d['attributes'][_0x0240('0x58')]?_0xb6756d[_0x0240('0x52')]:_0x5ed859[_0x0240('0xd7')];if(!_0x402b69[_0x0240('0x4d')][_0x0240('0xcb')]('nolimit')){_0xb6756d[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x402b69[_0x0240('0x4d')]['limit']);_0xb6756d[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x402b69[_0x0240('0x4d')][_0x0240('0x1d')]);}_0xb6756d[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x402b69[_0x0240('0x4d')][_0x0240('0xda')]);_0xb6756d[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x402b69[_0x0240('0x4d')],_0x5ed859['filters']));_0xb6756d[_0x0240('0xe0')]['UserId']=_0x52cca6['id'];if(_0x402b69['query'][_0x0240('0x39')]){_0xb6756d[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xb6756d[_0x0240('0xe0')],{'$or':_['map'](_0xb6756d['attributes'],function(_0x342574){var _0x3f696f={};_0x3f696f[_0x342574]={'$like':'%'+_0x402b69['query'][_0x0240('0x39')]+'%'};return _0x3f696f;})});}_0xb6756d=_['merge']({},_0xb6756d,_0x402b69[_0x0240('0x62')]);return db[_0x0240('0xeb')][_0x0240('0x20')]({'where':_0xb6756d[_0x0240('0xe0')]})['then'](function(_0x4a6006){_0xb92850[_0x0240('0x20')]=_0x4a6006;if(_0x402b69[_0x0240('0x4d')][_0x0240('0xcc')]){_0xb6756d[_0x0240('0x4e')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0xb6756d);})['then'](function(_0xfd4568){_0xb92850[_0x0240('0x57')]=_0xfd4568;return _0xb92850;});}})[_0x0240('0x24')](respondWithFilteredResult(_0x445b2f,_0xb6756d))[_0x0240('0x2e')](handleError(_0x445b2f,null));};exports[_0x0240('0xec')]=function(_0x329003,_0x4b090d){var _0x19ebf2={};var _0x444f11={};var _0x28ff70;var _0xf45056;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x329003[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x4b090d,null))[_0x0240('0x24')](function(_0x1fe430){if(_0x1fe430){_0x28ff70=_0x1fe430;_0x444f11['model']=_[_0x0240('0xd3')](db[_0x0240('0xed')][_0x0240('0x42')]);_0x444f11[_0x0240('0x4d')]=_['keys'](_0x329003[_0x0240('0x4d')]);_0x444f11[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x444f11[_0x0240('0xd7')],_0x444f11[_0x0240('0x4d')]);_0x19ebf2[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x444f11[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x329003[_0x0240('0x4d')][_0x0240('0xd8')]));_0x19ebf2['attributes']=_0x19ebf2[_0x0240('0x52')][_0x0240('0x58')]?_0x19ebf2[_0x0240('0x52')]:_0x444f11[_0x0240('0xd7')];_0x19ebf2[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x329003[_0x0240('0x4d')][_0x0240('0xda')]);_0x19ebf2[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x329003['query'],_0x444f11['filters']));if(_0x329003[_0x0240('0x4d')][_0x0240('0x39')]){_0x19ebf2['where']=_[_0x0240('0x61')](_0x19ebf2[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x19ebf2['attributes'],function(_0x2c4a01){var _0x48c6fa={};_0x48c6fa[_0x2c4a01]={'$like':'%'+_0x329003[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x48c6fa;})});}_0x19ebf2=_['merge']({},_0x19ebf2,_0x329003[_0x0240('0x62')]);return _0x28ff70[_0x0240('0xec')](_0x19ebf2);}})[_0x0240('0x24')](function(_0x3a2016){if(_0x3a2016){_0xf45056=_0x3a2016[_0x0240('0x58')];if(!_0x329003[_0x0240('0x4d')]['hasOwnProperty'](_0x0240('0xde'))){_0x19ebf2['limit']=qs[_0x0240('0x1f')](_0x329003[_0x0240('0x4d')][_0x0240('0x1f')]);_0x19ebf2[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x329003[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x28ff70['getSmsInteractions'](_0x19ebf2);}})[_0x0240('0x24')](function(_0x2918e0){if(_0x2918e0){return _0x2918e0?{'count':_0xf45056,'rows':_0x2918e0}:null;}})[_0x0240('0x24')](respondWithResult(_0x4b090d,null))['catch'](handleError(_0x4b090d,null));};exports['getFaxInteractions']=function(_0x3d8ec7,_0x107c2a){var _0x230f19={};var _0x12ad08={};var _0x57ea7b;var _0x50732e;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x3d8ec7[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x107c2a,null))[_0x0240('0x24')](function(_0x5d31d9){if(_0x5d31d9){_0x57ea7b=_0x5d31d9;_0x12ad08[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0xee')][_0x0240('0x42')]);_0x12ad08[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x3d8ec7[_0x0240('0x4d')]);_0x12ad08[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x12ad08[_0x0240('0xd7')],_0x12ad08[_0x0240('0x4d')]);_0x230f19[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x12ad08['model'],qs[_0x0240('0xd8')](_0x3d8ec7['query'][_0x0240('0xd8')]));_0x230f19['attributes']=_0x230f19[_0x0240('0x52')]['length']?_0x230f19[_0x0240('0x52')]:_0x12ad08['model'];_0x230f19[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x3d8ec7['query'][_0x0240('0xda')]);_0x230f19[_0x0240('0xe0')]=qs['filters'](_[_0x0240('0xdb')](_0x3d8ec7[_0x0240('0x4d')],_0x12ad08[_0x0240('0xd5')]));if(_0x3d8ec7['query'][_0x0240('0x39')]){_0x230f19[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x230f19[_0x0240('0xe0')],{'$or':_['map'](_0x230f19['attributes'],function(_0x562fe4){var _0x23d5be={};_0x23d5be[_0x562fe4]={'$like':'%'+_0x3d8ec7[_0x0240('0x4d')]['filter']+'%'};return _0x23d5be;})});}_0x230f19=_['merge']({},_0x230f19,_0x3d8ec7['options']);return _0x57ea7b[_0x0240('0xef')](_0x230f19);}})[_0x0240('0x24')](function(_0x4f9d41){if(_0x4f9d41){_0x50732e=_0x4f9d41[_0x0240('0x58')];if(!_0x3d8ec7[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x230f19[_0x0240('0x1f')]=qs['limit'](_0x3d8ec7[_0x0240('0x4d')][_0x0240('0x1f')]);_0x230f19[_0x0240('0x1d')]=qs['offset'](_0x3d8ec7['query'][_0x0240('0x1d')]);}return _0x57ea7b['getFaxInteractions'](_0x230f19);}})[_0x0240('0x24')](function(_0x44caae){if(_0x44caae){return _0x44caae?{'count':_0x50732e,'rows':_0x44caae}:null;}})['then'](respondWithResult(_0x107c2a,null))['catch'](handleError(_0x107c2a,null));};exports[_0x0240('0xf0')]=function(_0x160e7d,_0x3cc53c){var _0x2ce749={};var _0x397257={};var _0x56bca5;var _0x4624f7;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x160e7d[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x3cc53c,null))[_0x0240('0x24')](function(_0x391c3d){if(_0x391c3d){_0x56bca5=_0x391c3d;_0x397257[_0x0240('0xd7')]=_['keys'](db[_0x0240('0xf1')]['rawAttributes']);_0x397257[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x160e7d[_0x0240('0x4d')]);_0x397257[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x397257['model'],_0x397257[_0x0240('0x4d')]);_0x2ce749[_0x0240('0x52')]=_['intersection'](_0x397257[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x160e7d[_0x0240('0x4d')]['fields']));_0x2ce749[_0x0240('0x52')]=_0x2ce749[_0x0240('0x52')][_0x0240('0x58')]?_0x2ce749[_0x0240('0x52')]:_0x397257['model'];_0x2ce749[_0x0240('0xd9')]=qs['sort'](_0x160e7d[_0x0240('0x4d')][_0x0240('0xda')]);_0x2ce749[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x160e7d[_0x0240('0x4d')],_0x397257[_0x0240('0xd5')]));if(_0x160e7d[_0x0240('0x4d')]['filter']){_0x2ce749[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x2ce749['where'],{'$or':_[_0x0240('0x3b')](_0x2ce749[_0x0240('0x52')],function(_0x5718fa){var _0x1e7869={};_0x1e7869[_0x5718fa]={'$like':'%'+_0x160e7d['query'][_0x0240('0x39')]+'%'};return _0x1e7869;})});}_0x2ce749=_[_0x0240('0x61')]({},_0x2ce749,_0x160e7d['options']);return _0x56bca5[_0x0240('0xf0')](_0x2ce749);}})[_0x0240('0x24')](function(_0x59e5e0){if(_0x59e5e0){_0x4624f7=_0x59e5e0['length'];if(!_0x160e7d[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x2ce749[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x160e7d['query'][_0x0240('0x1f')]);_0x2ce749[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0x160e7d[_0x0240('0x4d')][_0x0240('0x1d')]);}return _0x56bca5['getWhatsappInteractions'](_0x2ce749);}})[_0x0240('0x24')](function(_0x508210){if(_0x508210){return _0x508210?{'count':_0x4624f7,'rows':_0x508210}:null;}})[_0x0240('0x24')](respondWithResult(_0x3cc53c,null))[_0x0240('0x2e')](handleError(_0x3cc53c,null));};exports[_0x0240('0xf2')]=function(_0x433f1c,_0x354a38,_0x119706){var _0x46e33c;var _0xe399dd;var _0x5b518b;var _0x3ad831=!_[_0x0240('0x6d')](_0x433f1c[_0x0240('0x60')]['id'])?_0x433f1c[_0x0240('0x60')]['id']:!_[_0x0240('0x6d')](_0x433f1c['user']['id'])?_0x433f1c[_0x0240('0x34')]['id']:null;return db['User']['find']({'where':{'id':_0x3ad831,'role':{'$or':[_0x0240('0x85'),_0x0240('0x34'),_0x0240('0x36')]}},'attributes':['id','name','phone',_0x0240('0xf3'),_0x0240('0x30'),_0x0240('0x69'),_0x0240('0xf4')]})[_0x0240('0x24')](function(_0x4ce4a1){if(_0x4ce4a1){if(_0x4ce4a1[_0x0240('0x30')]===_0x0240('0x36')){_0x46e33c=_0x4ce4a1;if(_0x433f1c[_0x0240('0x64')][_0x0240('0xac')]){_0x5b518b=util[_0x0240('0xad')](_0x0240('0xf5'),_0x46e33c[_0x433f1c[_0x0240('0x64')]['interface']]);}else if(_0x433f1c[_0x0240('0x64')][_0x0240('0xf6')]){_0x5b518b=util[_0x0240('0xad')]('SIP/%s',_0x433f1c[_0x0240('0x64')][_0x0240('0xf6')]);}else{_0x5b518b=util[_0x0240('0xad')](_0x0240('0xae'),_0x46e33c[_0x0240('0x3f')]);}socket['to'](util[_0x0240('0xad')](_0x0240('0xf7'),_0x46e33c['name']))[_0x0240('0x31')]('user:forcelogout',{'user':{'id':_0x46e33c['id'],'name':_0x46e33c[_0x0240('0x3f')]},'ip':_0x433f1c[_0x0240('0xf8')]['x-forwarded-for']||_0x433f1c[_0x0240('0xf9')][_0x0240('0xfa')]||_0x433f1c['socket'][_0x0240('0xfa')]||_0x433f1c['connection'][_0x0240('0xfb')][_0x0240('0xfa')]});return new Promise(function(_0xb35698,_0x3f28f5){db[_0x0240('0x6e')][_0x0240('0xfc')]()[_0x0240('0x24')](_0x157912=>{db[_0x0240('0xaf')][_0x0240('0x32')]({'where':{'membername':_0x46e33c[_0x0240('0x3f')]},'individualHooks':!![]},{'transaction':_0x157912})[_0x0240('0x24')](function(){return _0x157912[_0x0240('0xfd')]();})['then'](_0xb35698)[_0x0240('0x2e')](_0x3f28f5);});});}}else{throw new db[(_0x0240('0x95'))][(_0x0240('0x96'))](_0x0240('0xfe'));}})[_0x0240('0x24')](function(){if(_0x46e33c){return _0x46e33c[_0x0240('0xff')]({'raw':!![]});}})[_0x0240('0x24')](function(_0x291f92){if(_0x46e33c){if(_0x291f92){_0xe399dd=_0x291f92;if(_0xe399dd['length']){var _0x48394d=_0xe399dd['map'](function(_0x2cdbd8){return{'membername':_0x46e33c[_0x0240('0x3f')],'UserId':_0x46e33c['id'],'queue_name':_0x2cdbd8['name'],'VoiceQueueId':_0x2cdbd8['id'],'interface':_0x5b518b,'paused':_0x46e33c[_0x0240('0xf4')]||![],'penalty':_0x2cdbd8['UserVoiceQueue.penalty']||0x0};});return db[_0x0240('0xaf')]['bulkCreate'](_0x48394d);}}}})['then'](function(){if(_0x46e33c){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x46e33c[_0x0240('0x3f')],'exitAt':null}});}})[_0x0240('0x24')](function(_0x1e7d5b){if(_0x46e33c){var _0x2a32b4=[];_0x1e7d5b[_0x0240('0x101')](function(_0x45816d){_0x2a32b4[_0x0240('0x53')](_0x45816d[_0x0240('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x0240('0x5e')](_0x2a32b4);}})['then'](function(){if(_0x46e33c){var _0x289cb5=[];var _0x4b7d0f=[];var _0x686c38=utils[_0x0240('0x102')]();var _0x280d44={'membername':_0x46e33c['name'],'interface':_0x5b518b,'enterAt':moment()[_0x0240('0xad')](_0x0240('0x103')),'role':_0x46e33c['role'],'internal':_0x46e33c[_0x0240('0x69')]};_0x686c38[_0x0240('0x101')](function(_0x1299d8){_0x289cb5[_0x0240('0x53')](_['merge']({'channel':_0x1299d8,'type':_0x0240('0x104'),'data1':_0x433f1c[_0x0240('0x64')]['device'],'data2':_0x5b518b},_0x280d44));if(_0x46e33c[_0x0240('0xf4')]){_0x4b7d0f[_0x0240('0x53')](_[_0x0240('0x61')]({'channel':_0x1299d8,'type':_0x0240('0x105'),'data1':_0x0240('0x106')},_0x280d44));}});return db[_0x0240('0x100')][_0x0240('0x8c')](_0x289cb5['concat'](_0x4b7d0f),{'individualHooks':!![]});}})[_0x0240('0x24')](function(){if(_0x46e33c){return _0x46e33c[_0x0240('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x46e33c[_0x0240('0xf4')]||![],'mailPause':_0x46e33c['loginInPause']||![],'chatPause':_0x46e33c[_0x0240('0xf4')]||![],'faxPause':_0x46e33c[_0x0240('0xf4')]||![],'smsPause':_0x46e33c['loginInPause']||![],'openchannelPause':_0x46e33c['loginInPause']||![],'whatsappPause':_0x46e33c['loginInPause']||![],'pauseType':_0x46e33c[_0x0240('0xf4')]?'LOGININPAUSE':null,'interface':_0x5b518b,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0240('0x24')](function(_0x14b71d){if(_0x433f1c[_0x0240('0x107')]){return _0x119706();}else{return Promise['resolve'](_0x14b71d)['then'](respondWithResult(_0x354a38,null));}})['catch'](handleError(_0x354a38,null));};exports['logout']=function(_0x591217,_0x2b3a31){var _0x52215f;return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x591217[_0x0240('0x60')]['id'],'role':'agent'},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30')]})[_0x0240('0x24')](handleEntityNotFound(_0x2b3a31,null))['then'](function(_0x551060){if(_0x551060){_0x52215f=_0x551060;return db['UserVoiceQueueRt'][_0x0240('0x32')]({'where':{'membername':_0x52215f['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x52215f[_0x0240('0x3f')],'exitAt':null}});})[_0x0240('0x24')](function(_0x5f04ab){var _0x38a873=[];_0x5f04ab[_0x0240('0x101')](function(_0x128834){_0x38a873[_0x0240('0x53')](_0x128834[_0x0240('0x2f')]({'exitAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x0240('0x5e')](_0x38a873);})[_0x0240('0x24')](function(){return _0x52215f[_0x0240('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0240('0x24')](respondWithResult(_0x2b3a31,null))[_0x0240('0x2e')](handleError(_0x2b3a31,null));};exports[_0x0240('0x108')]=function(_0x5867bc,_0x1a4038){var _0x401182;return db[_0x0240('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x5867bc[_0x0240('0x60')]['id']},'individualHooks':!![]})[_0x0240('0x24')](function(){return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x5867bc[_0x0240('0x60')]['id'],'role':'agent'},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30'),_0x0240('0x69'),_0x0240('0xac'),_0x0240('0x9f')]});})['then'](handleEntityNotFound(_0x1a4038,null))[_0x0240('0x24')](function(_0xfdb3dc){if(_0xfdb3dc){_0x401182=_0xfdb3dc;return respondWithRpcPromise('QueuePause',_0x0240('0x108'),{'id':_0x401182['id'],'name':_0x401182[_0x0240('0x3f')],'pause':!![]});}})[_0x0240('0x24')](function(){if(_0x401182){return db[_0x0240('0x100')][_0x0240('0x55')]({'where':{'membername':_0x401182[_0x0240('0x3f')],'type':_0x0240('0x105'),'exitAt':null}});}})['then'](function(_0x1733a5){if(_0x1733a5[_0x0240('0x58')]){var _0x391592=moment()[_0x0240('0xad')](_0x0240('0x103'));for(var _0xe8feed=0x0,_0x3d45a8=_0x1733a5[_0x0240('0x58')];_0xe8feed<_0x3d45a8;_0xe8feed++){_0x1733a5[_0xe8feed][_0x0240('0x109')]({'exitAt':_0x391592});}}})[_0x0240('0x24')](function(){var _0x33f227=[];var _0x406994=utils[_0x0240('0x102')]();_0x406994[_0x0240('0x101')](function(_0x3bf481){_0x33f227[_0x0240('0x53')]({'channel':_0x3bf481,'membername':_0x401182[_0x0240('0x3f')],'interface':_[_0x0240('0x6d')](_0x401182[_0x0240('0xac')])?util[_0x0240('0xad')](_0x0240('0xae'),_0x401182[_0x0240('0x3f')]):_0x401182['interface'],'type':_0x0240('0x105'),'enterAt':moment()[_0x0240('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5867bc['body'][_0x0240('0x44')]||'DEFAULT\x20PAUSE','role':_0x401182[_0x0240('0x30')],'internal':_0x401182[_0x0240('0x69')]});});return db[_0x0240('0x100')][_0x0240('0x8c')](_0x33f227,{'individualHooks':!![]});})['then'](function(){return _0x401182['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5867bc[_0x0240('0x64')][_0x0240('0x44')]||_0x0240('0x10a'),'lastPauseAt':moment()['format'](_0x0240('0x103'))});})[_0x0240('0x24')](respondWithResult(_0x1a4038,null))[_0x0240('0x2e')](handleError(_0x1a4038,null));};exports['unpause']=function(_0x217bee,_0x22e03e){if(_0x217bee['body'][_0x0240('0xb1')]&&!utils[_0x0240('0xa1')](_0x217bee[_0x0240('0x64')]['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x217bee['body'][_0x0240('0xb1')]));}return db[_0x0240('0x54')][_0x0240('0x3e')]({'where':{'id':_0x217bee[_0x0240('0x60')]['id']},'attributes':['id',_0x0240('0x3f'),_0x0240('0x30'),_0x0240('0x69'),'interface','online','voicePause','mailPause','chatPause',_0x0240('0x10b'),'openchannelPause',_0x0240('0x10c'),_0x0240('0x10d'),_0x0240('0x10e'),_0x0240('0x10f')]})[_0x0240('0x24')](function(_0x558112){if(!_0x558112){throw new APINotFoundError(util[_0x0240('0xad')](_0x0240('0xca'),_0x217bee['params']['id']));}return _0x558112[_0x0240('0x110')](_0x217bee[_0x0240('0x64')][_0x0240('0xb1')]);})['then'](respondWithResult(_0x22e03e,null))[_0x0240('0x2e')](APIHandleError(_0x22e03e));};exports[_0x0240('0x111')]=function(_0x2e3781,_0x3f03cd){var _0x5ba690={};var _0x25c700={};var _0x214761;var _0x3b0930;return db[_0x0240('0x54')]['findOne']({'where':{'id':_0x2e3781[_0x0240('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f03cd,null))[_0x0240('0x24')](function(_0xb05b9f){if(_0xb05b9f){_0x214761=_0xb05b9f;_0x25c700[_0x0240('0xd7')]=_[_0x0240('0xd3')](db['Team'][_0x0240('0x42')]);_0x25c700[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0x2e3781[_0x0240('0x4d')]);_0x25c700[_0x0240('0xd5')]=_[_0x0240('0xd6')](_0x25c700[_0x0240('0xd7')],_0x25c700[_0x0240('0x4d')]);_0x5ba690[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x25c700[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x2e3781['query'][_0x0240('0xd8')]));_0x5ba690[_0x0240('0x52')]=_0x5ba690[_0x0240('0x52')][_0x0240('0x58')]?_0x5ba690[_0x0240('0x52')]:_0x25c700[_0x0240('0xd7')];_0x5ba690[_0x0240('0xd9')]=qs['sort'](_0x2e3781['query'][_0x0240('0xda')]);_0x5ba690[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0x2e3781[_0x0240('0x4d')],_0x25c700[_0x0240('0xd5')]));if(_0x2e3781['query'][_0x0240('0x39')]){_0x5ba690[_0x0240('0xe0')]=_[_0x0240('0x61')](_0x5ba690[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x5ba690['attributes'],function(_0x3e9765){var _0x141ae4={};_0x141ae4[_0x3e9765]={'$like':'%'+_0x2e3781['query'][_0x0240('0x39')]+'%'};return _0x141ae4;})});}_0x5ba690=_[_0x0240('0x61')]({},_0x5ba690,_0x2e3781['options']);return _0x214761[_0x0240('0x111')](_0x5ba690);}})['then'](function(_0x5c14a5){if(_0x5c14a5){_0x3b0930=_0x5c14a5[_0x0240('0x58')];if(!_0x2e3781[_0x0240('0x4d')][_0x0240('0xcb')](_0x0240('0xde'))){_0x5ba690[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0x2e3781[_0x0240('0x4d')]['limit']);_0x5ba690['offset']=qs[_0x0240('0x1d')](_0x2e3781['query'][_0x0240('0x1d')]);}return _0x214761[_0x0240('0x111')](_0x5ba690);}})[_0x0240('0x24')](function(_0x5df71a){if(_0x5df71a){return _0x5df71a?{'count':_0x3b0930,'rows':_0x5df71a}:null;}})[_0x0240('0x24')](respondWithResult(_0x3f03cd,null))['catch'](handleError(_0x3f03cd,null));};exports['addTeams']=function(_0x814317,_0x27067a){var _0x43b514=_0x814317[_0x0240('0x60')]['id'];var _0x309ae3=_0x814317[_0x0240('0x64')]?_0x814317[_0x0240('0x64')][_0x0240('0x67')]:null;var _0x5bce5f=[];return Promise[_0x0240('0x112')]()[_0x0240('0x24')](function(){if(!_0x309ae3)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x0240('0x24')](function(){return db['User'][_0x0240('0xc9')]({'where':{'id':_0x43b514}});})[_0x0240('0x24')](function(_0x33159c){if(!_0x33159c)throw new APINotFoundError(util[_0x0240('0xad')]('User\x20with\x20id\x20%s\x20not\x20found',_0x814317['params']['id']));return db[_0x0240('0x6e')][_0x0240('0xfc')](function(_0x30b895){return _0x33159c['addTeams'](_0x309ae3,{'transaction':_0x30b895})[_0x0240('0x24')](function(){return db[_0x0240('0x113')][_0x0240('0x55')]({'where':{'id':{'$in':_0x309ae3}}});})[_0x0240('0x24')](function(_0x57b1ac){var _0x735c56=_[_0x0240('0x3b')](_0x57b1ac,function(_0x1ec98b){return _0x1ec98b['getAssociatedQueues']();});return Promise[_0x0240('0x5e')](_0x735c56);})[_0x0240('0x24')](function(_0x23776c){_0x5bce5f=_['flattenDeep'](_0x23776c);var _0x22393c=_['map'](_0x5bce5f,function(_0x566e5e){return _0x566e5e[_0x0240('0x114')](_0x33159c['id'],{'transaction':_0x30b895});});return Promise['all'](_0x22393c);})[_0x0240('0x24')](function(){if(!_0x33159c[_0x0240('0x9f')])return;var _0x416768=_[_0x0240('0x39')](_0x5bce5f,function(_0x2eb4fc){return _0x2eb4fc[_0x0240('0x115')](_0x0240('0xb1'))===_0x0240('0x116');});var _0x3f3d15=_[_0x0240('0x3b')](_0x416768,function(_0x58b65a){return db[_0x0240('0xaf')]['upsert']({'membername':_0x33159c[_0x0240('0x3f')],'UserId':_0x33159c['id'],'queue_name':_0x58b65a[_0x0240('0x3f')],'VoiceQueueId':_0x58b65a['id'],'interface':_[_0x0240('0x6d')](_0x33159c['interface'])?util[_0x0240('0xad')](_0x0240('0xae'),_0x33159c[_0x0240('0x3f')]):_0x33159c[_0x0240('0xac')],'paused':_0x33159c[_0x0240('0xa0')]||![],'penalty':_0x33159c[_0x0240('0xa6')]},{'transaction':_0x30b895});});return Promise[_0x0240('0x5e')](_0x3f3d15);})[_0x0240('0x24')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x309ae3}}});})['then'](function(_0x2cad50){var _0xc8cb7=_[_0x0240('0x3b')](_0x2cad50,function(_0x3620df){return db[_0x0240('0x117')][_0x0240('0x83')]({'UserId':_0x33159c['id'],'VoicePrefixId':_0x3620df[_0x0240('0x118')]},{'transaction':_0x30b895});});return Promise[_0x0240('0x5e')](_0xc8cb7);});});})[_0x0240('0x24')](function(){for(var _0x55470c=0x0;_0x55470c<_0x5bce5f[_0x0240('0x58')];_0x55470c++){var _0x3bd1f1=_0x5bce5f[_0x55470c][_0x0240('0x115')](_0x0240('0xb1'));var _0x29ddf7=_0x3bd1f1+_0x0240('0xa8');socket[_0x0240('0x31')](_0x0240('0x34')+_0x3bd1f1+_0x0240('0x119'),{'UserId':_0x43b514,['queueField']:_0x5bce5f[_0x55470c]['id']});}})[_0x0240('0x24')](respondWithStatusCode(_0x27067a,null))['catch'](APIHandleError(_0x27067a));};exports[_0x0240('0x11a')]=function(_0x405905,_0x597433){var _0x512fdf=_0x405905['params']['id'];var _0x174b35=null;if(_0x405905[_0x0240('0x4d')][_0x0240('0x67')]){_0x174b35=_[_0x0240('0xb3')](_0x405905[_0x0240('0x4d')]['ids'])?_0x405905[_0x0240('0x4d')][_0x0240('0x67')]:[_0x405905[_0x0240('0x4d')][_0x0240('0x67')]];}var _0x4626ef=[];return Promise[_0x0240('0x112')]()['then'](function(){if(!_0x174b35)throw new APIBadRequestError(_0x0240('0x11b'));})[_0x0240('0x24')](function(){return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0x512fdf}});})[_0x0240('0x24')](function(_0x1e4457){if(!_0x1e4457)throw new APINotFoundError(util[_0x0240('0xad')](_0x0240('0xca'),_0x405905['params']['id']));return db[_0x0240('0x6e')]['transaction'](function(_0x3271b2){return _0x1e4457[_0x0240('0x11a')](_0x174b35,{'transaction':_0x3271b2})['then'](function(){return db[_0x0240('0x113')][_0x0240('0x55')]({'where':{'id':{'$in':_0x174b35}}});})[_0x0240('0x24')](function(_0x24a702){var _0x4072e2=_[_0x0240('0x3b')](_0x24a702,function(_0x2ef941){return _0x2ef941['getAssociatedQueues']();});return Promise[_0x0240('0x5e')](_0x4072e2);})['then'](function(_0x5a3463){_0x4626ef=_[_0x0240('0x11c')](_0x5a3463);var _0x3f4048=_[_0x0240('0x3b')](_0x4626ef,function(_0x42c6df){return _0x42c6df['removeAgent'](_0x1e4457['id'],{'transaction':_0x3271b2});});return Promise['all'](_0x3f4048);})['then'](function(){if(!_0x1e4457[_0x0240('0x9f')])return;var _0x1f16ad=_['filter'](_0x4626ef,function(_0x27942a){return _0x27942a[_0x0240('0x115')](_0x0240('0xb1'))===_0x0240('0x116');});var _0x5bc752=_[_0x0240('0x3b')](_0x1f16ad,function(_0xd77e14){return db[_0x0240('0xaf')]['destroy']({'where':{'VoiceQueueId':_0xd77e14['id'],'UserId':_0x1e4457['id']},'transaction':_0x3271b2});});return Promise[_0x0240('0x5e')](_0x5bc752);})[_0x0240('0x24')](function(){return db['TeamVoicePrefix'][_0x0240('0x55')]({'where':{'teamId':{'$in':_0x174b35}}});})['then'](function(_0x41101d){var _0x4de11e=_[_0x0240('0x3b')](_0x41101d,function(_0x3a45ac){return db[_0x0240('0x117')]['destroy']({'where':{'UserId':_0x1e4457['id'],'VoicePrefixId':_0x3a45ac['VoicePrefixId']}},{'transaction':_0x3271b2});});return Promise['all'](_0x4de11e);});});})[_0x0240('0x24')](function(){for(var _0x28e434=0x0;_0x28e434<_0x4626ef[_0x0240('0x58')];_0x28e434++){var _0x5edb39=_0x4626ef[_0x28e434][_0x0240('0x115')]('channel');var _0x40cc85=_0x5edb39+_0x0240('0xa8');socket[_0x0240('0x31')]('user'+_0x5edb39+'Queue:remove',{'UserId':_0x512fdf,['queueField']:_0x4626ef[_0x28e434]['id']});}})[_0x0240('0x24')](respondWithStatusCode(_0x597433,null))[_0x0240('0x2e')](APIHandleError(_0x597433));};exports[_0x0240('0x11d')]=function(_0xdfe45e,_0x350b94){var _0x3eb66d={};var _0x1d314d={};var _0x1c1db6;var _0x5a99a8;return db[_0x0240('0x54')][_0x0240('0xc9')]({'where':{'id':_0xdfe45e[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x350b94,null))[_0x0240('0x24')](function(_0x17e061){if(_0x17e061){_0x1c1db6=_0x17e061;_0x1d314d[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0x11e')][_0x0240('0x42')]);_0x1d314d[_0x0240('0x4d')]=_[_0x0240('0xd3')](_0xdfe45e[_0x0240('0x4d')]);_0x1d314d['filters']=_['intersection'](_0x1d314d[_0x0240('0xd7')],_0x1d314d[_0x0240('0x4d')]);_0x3eb66d[_0x0240('0x52')]=_[_0x0240('0xd6')](_0x1d314d[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0xdfe45e[_0x0240('0x4d')]['fields']));_0x3eb66d[_0x0240('0x52')]=_0x3eb66d[_0x0240('0x52')][_0x0240('0x58')]?_0x3eb66d[_0x0240('0x52')]:_0x1d314d[_0x0240('0xd7')];_0x3eb66d['order']=qs[_0x0240('0xda')](_0xdfe45e[_0x0240('0x4d')][_0x0240('0xda')]);_0x3eb66d[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_['pick'](_0xdfe45e[_0x0240('0x4d')],_0x1d314d[_0x0240('0xd5')]));if(_0xdfe45e[_0x0240('0x4d')][_0x0240('0x39')]){_0x3eb66d[_0x0240('0xe0')]=_['merge'](_0x3eb66d[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0x3eb66d[_0x0240('0x52')],function(_0xd1df38){var _0x2ba8e0={};_0x2ba8e0[_0xd1df38]={'$like':'%'+_0xdfe45e[_0x0240('0x4d')][_0x0240('0x39')]+'%'};return _0x2ba8e0;})});}_0x3eb66d=_[_0x0240('0x61')]({},_0x3eb66d,_0xdfe45e[_0x0240('0x62')]);return _0x1c1db6[_0x0240('0x11d')](_0x3eb66d);}})[_0x0240('0x24')](function(_0x654d6d){if(_0x654d6d){_0x5a99a8=_0x654d6d['length'];if(!_0xdfe45e['query'][_0x0240('0xcb')](_0x0240('0xde'))){_0x3eb66d[_0x0240('0x1f')]=qs[_0x0240('0x1f')](_0xdfe45e['query'][_0x0240('0x1f')]);_0x3eb66d[_0x0240('0x1d')]=qs[_0x0240('0x1d')](_0xdfe45e['query'][_0x0240('0x1d')]);}return _0x1c1db6[_0x0240('0x11d')](_0x3eb66d);}})[_0x0240('0x24')](function(_0x2ebfa0){if(_0x2ebfa0){return _0x2ebfa0?{'count':_0x5a99a8,'rows':_0x2ebfa0}:null;}})[_0x0240('0x24')](respondWithResult(_0x350b94,null))[_0x0240('0x2e')](handleError(_0x350b94,null));};exports[_0x0240('0x11f')]=function(_0x1b4a49,_0x46010e){var _0xf4a68={};var _0x23e4d2={};var _0x4eba10;return db['User'][_0x0240('0xc9')]({'where':{'id':_0x1b4a49[_0x0240('0x60')]['id']}})[_0x0240('0x24')](handleEntityNotFound(_0x46010e,null))[_0x0240('0x24')](function(_0x184f1d){if(_0x184f1d){_0x4eba10=_0x184f1d;_0x23e4d2[_0x0240('0xd7')]=_[_0x0240('0xd3')](db[_0x0240('0x54')][_0x0240('0x42')]);_0x23e4d2['query']=_[_0x0240('0xd3')](_0x1b4a49[_0x0240('0x4d')]);_0x23e4d2[_0x0240('0xd5')]=_['intersection'](_0x23e4d2['model'],_0x23e4d2[_0x0240('0x4d')]);_0xf4a68['attributes']=_[_0x0240('0xd6')](_0x23e4d2[_0x0240('0xd7')],qs[_0x0240('0xd8')](_0x1b4a49['query'][_0x0240('0xd8')]));_0xf4a68[_0x0240('0x52')]=_0xf4a68[_0x0240('0x52')][_0x0240('0x58')]?_0xf4a68['attributes']:_0x23e4d2[_0x0240('0xd7')];_0xf4a68[_0x0240('0xd9')]=qs[_0x0240('0xda')](_0x1b4a49[_0x0240('0x4d')][_0x0240('0xda')]);_0xf4a68[_0x0240('0xe0')]=qs[_0x0240('0xd5')](_[_0x0240('0xdb')](_0x1b4a49[_0x0240('0x4d')],_0x23e4d2[_0x0240('0xd5')]));if(_0x1b4a49['query'][_0x0240('0x39')]){_0xf4a68[_0x0240('0xe0')]=_[_0x0240('0x61')](_0xf4a68[_0x0240('0xe0')],{'$or':_[_0x0240('0x3b')](_0xf4a68[_0x0240('0x52')],function(_0x1ef2ac){var _0x5739e6={};_0x5739e6[_0x1ef2ac]={'$like':'%'+_0x1b4a49['query'][_0x0240('0x39')]+'%'};return _0x5739e6;})});}_0xf4a68[_0x0240('0xd7')]=db['User'];_0xf4a68['as']=_0x0240('0x35');_0xf4a68=_[_0x0240('0x61')]({},_0xf4a68,_0x1b4a49[_0x0240('0x62')]);return _0x4eba10['getVoiceQueues']({'include':[_0xf4a68]});}})['then'](function(_0x144599){if(_0x144599){var _0x230212={},_0x4af789=[];for(var _0x295867=0x0;_0x295867<_0x144599[_0x0240('0x58')];_0x295867+=0x1){for(var _0x17516c=0x0,_0x1629d2;_0x17516c<_0x144599[_0x295867]['Agents'][_0x0240('0x58')];_0x17516c+=0x1){_0x1629d2=_0x144599[_0x295867][_0x0240('0x35')][_0x17516c]['get']({'plain':!![]});_0x230212[_0x1629d2['id']]=_0x1629d2;}}_0x230212=_['values'](_0x230212);for(var _0x562bf5=qs[_0x0240('0x1d')](_0x1b4a49[_0x0240('0x4d')]['offset']);_0x562bf5<_0x230212[_0x0240('0x58')]&&_0x4af789['length']=_0x2d8899[_0x38b3('0x4b')]){throw new Error(_0x38b3('0x4c'));}})[_0x38b3('0x14')](function(){if(_0x425e10){return db[_0x38b3('0x25')][_0x38b3('0x43')]({'where':{'membername':_0x425e10['name']},'individualHooks':!![]});}})[_0x38b3('0x14')](function(){if(_0x425e10){return _0x425e10[_0x38b3('0x4d')]({'raw':!![]});}})[_0x38b3('0x14')](function(_0x5ba1e2){if(_0x425e10){if(_0x5ba1e2){var _0x8916c9=[];_0x58e4cd=_0x5ba1e2;if(_0x58e4cd[_0x38b3('0x28')]){for(var _0x21af9b=0x0;_0x21af9b<_0x58e4cd[_0x38b3('0x28')];_0x21af9b++){_0x8916c9[_0x38b3('0x2d')](db[_0x38b3('0x25')]['upsert']({'membername':_0x425e10[_0x38b3('0x20')],'UserId':_0x425e10['id'],'queue_name':_0x58e4cd[_0x21af9b][_0x38b3('0x20')],'VoiceQueueId':_0x58e4cd[_0x21af9b]['id'],'interface':_0x589c27,'paused':_0x425e10[_0x38b3('0x47')]||![],'penalty':_0x58e4cd[_0x21af9b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x38b3('0x44')](_0x8916c9);}}}})[_0x38b3('0x14')](function(){if(_0x425e10){return db['MemberReport'][_0x38b3('0xc')]({'where':{'membername':_0x425e10[_0x38b3('0x20')],'exitAt':null}});}})['then'](function(_0x5a87e1){if(_0x425e10){if(_0x5a87e1&&_0x5a87e1[_0x38b3('0x28')]){var _0x3066be=[];_0x5a87e1[_0x38b3('0x2c')](function(_0x115874){_0x3066be[_0x38b3('0x2d')](_0x115874[_0x38b3('0x45')]({'exitAt':moment()[_0x38b3('0x23')](_0x38b3('0x29'))}));});return BPromise[_0x38b3('0x44')](_0x3066be);}}})[_0x38b3('0x14')](function(){if(_0x425e10){var _0xd6e450=[];var _0x1e041e=[];var _0x4b1d0a=utils[_0x38b3('0x2b')]();var _0x581111={'membername':_0x425e10[_0x38b3('0x20')],'interface':_0x589c27,'enterAt':moment()[_0x38b3('0x23')](_0x38b3('0x29')),'role':_0x425e10[_0x38b3('0x38')],'internal':_0x425e10[_0x38b3('0x21')]};_0x4b1d0a[_0x38b3('0x2c')](function(_0x37c19e){_0xd6e450[_0x38b3('0x2d')](_[_0x38b3('0x4e')]({'channel':_0x37c19e,'type':_0x38b3('0x4f'),'data1':_0x38b3('0x50'),'data2':_0x589c27},_0x581111));if(_0x425e10['loginInPause']){_0x1e041e[_0x38b3('0x2d')](_['merge']({'channel':_0x37c19e,'type':_0x38b3('0x27'),'data1':_0x38b3('0x51')},_0x581111));}});return db[_0x38b3('0x26')][_0x38b3('0x52')](_0xd6e450[_0x38b3('0x53')](_0x1e041e),{'individualHooks':!![]});}})['then'](function(){if(_0x425e10){return _0x425e10[_0x38b3('0x45')]({'online':!![],'lastLoginAt':moment()['format'](_0x38b3('0x29')),'voicePause':_0x425e10[_0x38b3('0x47')]||![],'mailPause':_0x425e10[_0x38b3('0x47')]||![],'chatPause':_0x425e10['loginInPause']||![],'faxPause':_0x425e10[_0x38b3('0x47')]||![],'smsPause':_0x425e10[_0x38b3('0x47')]||![],'openchannelPause':_0x425e10['loginInPause']||![],'pauseType':_0x425e10['loginInPause']?_0x38b3('0x51'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x589c27});}})[_0x38b3('0x14')](function(_0x3cfe56){_0x3f3120(_0x3cfe56);})['catch'](function(_0x343dff){_0x15f81d(_0x19654b[_0x38b3('0x1a')](0x1f4,_0x343dff[_0x38b3('0x1b')]));});});}; \ No newline at end of file +var _0x8425=['internal','bulkCreate','update','UnpauseUser','channel','isValidChannel','findOne','chatPause','faxPause','smsPause','whatsappPause','lastPauseAt','unpause','system','LogoutUser','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','limit','map','include','attributes','model','info','debug','catch','error','message','ShowUser','then','stringify','PauseUser','find','role','interface','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','format','SIP/%s','body','type','DEFAULT\x20PAUSE'];(function(_0x3b963d,_0x5739e0){var _0x11847a=function(_0x494e6c){while(--_0x494e6c){_0x3b963d['push'](_0x3b963d['shift']());}};_0x11847a(++_0x5739e0);}(_0x8425,0xca));var _0x5842=function(_0x47a0d3,_0x3a4828){_0x47a0d3=_0x47a0d3-0x0;var _0x32aa66=_0x8425[_0x47a0d3];return _0x32aa66;};'use strict';var _=require(_0x5842('0x0'));var util=require('util');var moment=require(_0x5842('0x1'));var BPromise=require(_0x5842('0x2'));var Redis=require(_0x5842('0x3'));var db=require(_0x5842('0x4'))['db'];var utils=require(_0x5842('0x5'));var logger=require(_0x5842('0x6'))('rpc');var config=require(_0x5842('0x7'));config['redis']=_[_0x5842('0x8')](config[_0x5842('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5842('0xa'))(new Redis(config[_0x5842('0x9')]));require(_0x5842('0xb'))[_0x5842('0xc')](socket);exports[_0x5842('0xd')]=function(_0x67190b){var _0x395700=this;return new Promise(function(_0x2bb7da,_0x2b2880){return db[_0x5842('0xe')][_0x5842('0xf')]({'raw':_0x67190b[_0x5842('0x10')]?_0x67190b[_0x5842('0x10')][_0x5842('0x11')]===undefined?!![]:![]:!![],'where':_0x67190b[_0x5842('0x10')]?_0x67190b[_0x5842('0x10')][_0x5842('0x12')]||null:null,'attributes':_0x67190b[_0x5842('0x10')]?_0x67190b[_0x5842('0x10')]['attributes']||null:null,'limit':_0x67190b[_0x5842('0x10')]?_0x67190b['options'][_0x5842('0x13')]||null:null,'include':_0x67190b['options']?_0x67190b[_0x5842('0x10')]['include']?_[_0x5842('0x14')](_0x67190b[_0x5842('0x10')][_0x5842('0x15')],function(_0x53c5ee){return{'model':db[_0x53c5ee['model']],'as':_0x53c5ee['as'],'attributes':_0x53c5ee['attributes'],'include':_0x53c5ee[_0x5842('0x15')]?_[_0x5842('0x14')](_0x53c5ee['include'],function(_0x3ee1b9){return{'model':db[_0x3ee1b9['model']],'as':_0x3ee1b9['as'],'attributes':_0x3ee1b9[_0x5842('0x16')],'include':_0x3ee1b9[_0x5842('0x15')]?_[_0x5842('0x14')](_0x3ee1b9[_0x5842('0x15')],function(_0x3a50e8){return{'model':db[_0x3a50e8[_0x5842('0x17')]],'as':_0x3a50e8['as'],'attributes':_0x3a50e8[_0x5842('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2301ce){logger[_0x5842('0x18')](_0x5842('0xd'),_0x67190b);logger[_0x5842('0x19')]('GetUser',_0x67190b,JSON['stringify'](_0x2301ce));_0x2bb7da(_0x2301ce);})[_0x5842('0x1a')](function(_0xb0410a){logger[_0x5842('0x1b')](_0x5842('0xd'),_0xb0410a[_0x5842('0x1c')],_0x67190b);_0x2b2880(_0x395700[_0x5842('0x1b')](0x1f4,_0xb0410a[_0x5842('0x1c')]));});});};exports[_0x5842('0x1d')]=function(_0x4a0c12){var _0x591210=this;return new Promise(function(_0x5d6427,_0x576435){return db[_0x5842('0xe')]['find']({'raw':_0x4a0c12['options']?_0x4a0c12[_0x5842('0x10')][_0x5842('0x11')]===undefined?!![]:![]:!![],'where':_0x4a0c12[_0x5842('0x10')]?_0x4a0c12[_0x5842('0x10')][_0x5842('0x12')]||null:null,'attributes':_0x4a0c12['options']?_0x4a0c12['options'][_0x5842('0x16')]||null:null,'include':_0x4a0c12[_0x5842('0x10')]?_0x4a0c12[_0x5842('0x10')][_0x5842('0x15')]?_['map'](_0x4a0c12['options']['include'],function(_0x3c933f){return{'model':db[_0x3c933f['model']],'as':_0x3c933f['as'],'attributes':_0x3c933f[_0x5842('0x16')],'include':_0x3c933f['include']?_[_0x5842('0x14')](_0x3c933f[_0x5842('0x15')],function(_0x2cc021){return{'model':db[_0x2cc021['model']],'as':_0x2cc021['as'],'attributes':_0x2cc021['attributes'],'include':_0x2cc021[_0x5842('0x15')]?_['map'](_0x2cc021[_0x5842('0x15')],function(_0x58895c){return{'model':db[_0x58895c['model']],'as':_0x58895c['as'],'attributes':_0x58895c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5842('0x1e')](function(_0x1442ed){logger['info'](_0x5842('0x1d'),_0x4a0c12);logger[_0x5842('0x19')]('ShowUser',_0x4a0c12,JSON[_0x5842('0x1f')](_0x1442ed));_0x5d6427(_0x1442ed);})[_0x5842('0x1a')](function(_0x20eb52){logger[_0x5842('0x1b')](_0x5842('0x1d'),_0x20eb52['message'],_0x4a0c12);_0x576435(_0x591210[_0x5842('0x1b')](0x1f4,_0x20eb52[_0x5842('0x1c')]));});});};exports[_0x5842('0x20')]=function(_0x15c826){var _0x39ac09;return db[_0x5842('0xe')][_0x5842('0x21')]({'where':_0x15c826['options']['where']||{},'attributes':['id','name',_0x5842('0x22'),'internal',_0x5842('0x23')]})[_0x5842('0x1e')](function(_0xe5d3f2){if(!_0xe5d3f2){throw new Error(util['format'](_0x5842('0x24'),_0x15c826[_0x5842('0x25')]['id']));}_0x39ac09=_0xe5d3f2;return db[_0x5842('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0x39ac09['id']},'individualHooks':!![]});})[_0x5842('0x1e')](function(){return db[_0x5842('0x27')]['findAll']({'where':{'membername':_0x39ac09[_0x5842('0x28')],'type':_0x5842('0x29'),'exitAt':null}});})[_0x5842('0x1e')](function(_0x4dfa4a){if(_0x4dfa4a&&_0x4dfa4a[_0x5842('0x2a')]){var _0x194277=moment()['format'](_0x5842('0x2b'));for(var _0x3e0ee1=0x0,_0x34502d=_0x4dfa4a[_0x5842('0x2a')];_0x3e0ee1<_0x34502d;_0x3e0ee1++){_0x4dfa4a[_0x3e0ee1][_0x5842('0x2c')]({'exitAt':_0x194277});}}})['then'](function(){var _0x297018=[];var _0x25e67f=utils[_0x5842('0x2d')]();_0x25e67f[_0x5842('0x2e')](function(_0x297cd2){_0x297018[_0x5842('0x2f')]({'channel':_0x297cd2,'membername':_0x39ac09[_0x5842('0x28')],'interface':_['isNil'](_0x39ac09['interface'])?util[_0x5842('0x30')](_0x5842('0x31'),_0x39ac09['name']):_0x39ac09[_0x5842('0x23')],'type':_0x5842('0x29'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x15c826[_0x5842('0x32')][_0x5842('0x33')]||_0x5842('0x34'),'role':_0x39ac09[_0x5842('0x22')],'internal':_0x39ac09[_0x5842('0x35')],'uniqueid':_0x15c826[_0x5842('0x32')]['uniqueid']||null});});return db['MemberReport'][_0x5842('0x36')](_0x297018,{'individualHooks':!![]});})[_0x5842('0x1e')](function(){return _0x39ac09[_0x5842('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x15c826['body']['type']||_0x5842('0x34'),'lastPauseAt':moment()[_0x5842('0x30')](_0x5842('0x2b'))});})[_0x5842('0x1a')](function(_0xa7fdff){throw _0xa7fdff;});};exports[_0x5842('0x38')]=function(_0x548e0e){return Promise['resolve']()[_0x5842('0x1e')](function(){if(_0x548e0e[_0x5842('0x32')][_0x5842('0x39')]&&!utils[_0x5842('0x3a')](_0x548e0e[_0x5842('0x32')][_0x5842('0x39')])){throw new Error(util[_0x5842('0x30')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x548e0e[_0x5842('0x32')]['channel']));}return db['User'][_0x5842('0x3b')]({'where':_0x548e0e[_0x5842('0x10')]['where']||{},'attributes':['id',_0x5842('0x28'),'role','internal',_0x5842('0x23'),'online','voicePause','mailPause',_0x5842('0x3c'),_0x5842('0x3d'),'openchannelPause',_0x5842('0x3e'),_0x5842('0x3f'),'pauseType',_0x5842('0x40')]});})['then'](function(_0x2803d1){if(!_0x2803d1){throw new Error(util[_0x5842('0x30')](_0x5842('0x24'),_0x548e0e[_0x5842('0x25')]['id']));}return _0x2803d1[_0x5842('0x41')](_0x548e0e[_0x5842('0x32')]['channel'],_0x5842('0x42'));})[_0x5842('0x1a')](function(_0x5d4ca6){throw _0x5d4ca6;});};exports[_0x5842('0x43')]=function(_0x37a1db){var _0x1f8e6f=this;return new Promise(function(_0x446e15,_0x25b707){var _0x337698;return db['User'][_0x5842('0x3b')]({'where':_0x37a1db[_0x5842('0x10')][_0x5842('0x12')]||{},'attributes':['id',_0x5842('0x28')]})[_0x5842('0x1e')](function(_0xa3bb54){if(_0xa3bb54){_0x337698=_0xa3bb54;return db[_0x5842('0x26')]['destroy']({'where':{'membername':_0x337698['name']},'individualHooks':!![]});}})['then'](function(){if(_0x337698){return db[_0x5842('0x27')]['findAll']({'where':{'membername':_0x337698['name'],'exitAt':null}});}})['then'](function(_0x39805a){if(_0x337698){if(_0x39805a&&_0x39805a[_0x5842('0x2a')]){var _0x1c6659=[];_0x39805a[_0x5842('0x2e')](function(_0x572fdc){_0x1c6659[_0x5842('0x2f')](_0x572fdc[_0x5842('0x37')]({'exitAt':moment()[_0x5842('0x30')](_0x5842('0x2b'))}));});return BPromise[_0x5842('0x44')](_0x1c6659);}}})[_0x5842('0x1e')](function(){if(_0x337698){return _0x337698['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5842('0x1e')](function(_0x53f4c4){_0x446e15(_0x53f4c4);})[_0x5842('0x1a')](function(_0x17805b){_0x25b707(_0x1f8e6f[_0x5842('0x1b')](0x1f4,_0x17805b[_0x5842('0x1c')]));});});};exports[_0x5842('0x45')]=function(_0x3b2603){var _0x5df67d=this;return new Promise(function(_0xcb14bc,_0x35167c){var _0x44dd88;var _0x1c48b4;var _0x5ca2bd;var _0x376504;return db[_0x5842('0xe')][_0x5842('0x3b')]({'where':_0x3b2603[_0x5842('0x10')]['where']||{},'attributes':['id',_0x5842('0x28'),'role',_0x5842('0x46'),_0x5842('0x47'),_0x5842('0x35'),_0x5842('0x48'),'interface']})[_0x5842('0x1e')](function(_0x584e0b){if(_0x584e0b){_0x44dd88=_0x584e0b;_0x376504=_0x3b2603['body'][_0x5842('0x23')]?_0x3b2603['body'][_0x5842('0x23')]:util[_0x5842('0x30')](_0x5842('0x31'),_0x44dd88[_0x5842('0x28')]);return db['User'][_0x5842('0x49')]({'where':{'role':_0x5842('0x4a'),'online':!![],'id':{'$ne':_0x44dd88['id']}}});}})[_0x5842('0x1e')](function(_0x5f1410){if(_0x5f1410){_0x5ca2bd=_0x5f1410;return require(_0x5842('0x4b'))[_0x5842('0x4c')]();}})[_0x5842('0x1e')](function(_0x516167){if(_0x516167&&_0x516167[_0x5842('0x4d')]&&_0x5ca2bd>=_0x516167[_0x5842('0x4d')]){throw new Error(_0x5842('0x4e'));}})['then'](function(){if(_0x44dd88){return db[_0x5842('0x26')][_0x5842('0x4f')]({'where':{'membername':_0x44dd88['name']},'individualHooks':!![]});}})[_0x5842('0x1e')](function(){if(_0x44dd88){return _0x44dd88[_0x5842('0x50')]({'raw':!![]});}})[_0x5842('0x1e')](function(_0x5f5c95){if(_0x44dd88){if(_0x5f5c95){var _0x3e87fe=[];_0x1c48b4=_0x5f5c95;if(_0x1c48b4[_0x5842('0x2a')]){for(var _0x4147af=0x0;_0x4147af<_0x1c48b4['length'];_0x4147af++){_0x3e87fe['push'](db[_0x5842('0x26')][_0x5842('0x51')]({'membername':_0x44dd88['name'],'UserId':_0x44dd88['id'],'queue_name':_0x1c48b4[_0x4147af][_0x5842('0x28')],'VoiceQueueId':_0x1c48b4[_0x4147af]['id'],'interface':_0x376504,'paused':_0x44dd88['loginInPause']||![],'penalty':_0x1c48b4[_0x4147af]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x3e87fe);}}}})[_0x5842('0x1e')](function(){if(_0x44dd88){return db['MemberReport'][_0x5842('0xf')]({'where':{'membername':_0x44dd88['name'],'exitAt':null}});}})['then'](function(_0x12239d){if(_0x44dd88){if(_0x12239d&&_0x12239d['length']){var _0x4557a1=[];_0x12239d[_0x5842('0x2e')](function(_0x184cfc){_0x4557a1[_0x5842('0x2f')](_0x184cfc['update']({'exitAt':moment()[_0x5842('0x30')](_0x5842('0x2b'))}));});return BPromise[_0x5842('0x44')](_0x4557a1);}}})[_0x5842('0x1e')](function(){if(_0x44dd88){var _0x1ea687=[];var _0x1565b2=[];var _0x5200be=utils['getChannels']();var _0x337647={'membername':_0x44dd88[_0x5842('0x28')],'interface':_0x376504,'enterAt':moment()[_0x5842('0x30')](_0x5842('0x2b')),'role':_0x44dd88[_0x5842('0x22')],'internal':_0x44dd88[_0x5842('0x35')]};_0x5200be['forEach'](function(_0x1b5008){_0x1ea687['push'](_[_0x5842('0x52')]({'channel':_0x1b5008,'type':'LOGIN','data1':_0x5842('0x53'),'data2':_0x376504},_0x337647));if(_0x44dd88[_0x5842('0x48')]){_0x1565b2[_0x5842('0x2f')](_[_0x5842('0x52')]({'channel':_0x1b5008,'type':_0x5842('0x29'),'data1':'LOGININPAUSE'},_0x337647));}});return db[_0x5842('0x27')][_0x5842('0x36')](_0x1ea687['concat'](_0x1565b2),{'individualHooks':!![]});}})['then'](function(){if(_0x44dd88){return _0x44dd88['update']({'online':!![],'lastLoginAt':moment()['format'](_0x5842('0x2b')),'voicePause':_0x44dd88[_0x5842('0x48')]||![],'mailPause':_0x44dd88['loginInPause']||![],'chatPause':_0x44dd88['loginInPause']||![],'faxPause':_0x44dd88[_0x5842('0x48')]||![],'smsPause':_0x44dd88[_0x5842('0x48')]||![],'openchannelPause':_0x44dd88['loginInPause']||![],'pauseType':_0x44dd88[_0x5842('0x48')]?_0x5842('0x54'):null,'lastPauseAt':moment()[_0x5842('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x376504});}})['then'](function(_0x3284f2){_0xcb14bc(_0x3284f2);})[_0x5842('0x1a')](function(_0xd89817){_0x35167c(_0x5df67d['error'](0x1f4,_0xd89817['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8fe9b61..60cdd62 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 _0x04a8=['emit','removeListener','register','length','./user.events','save','remove','update'];(function(_0x3ff00e,_0x4e9945){var _0x15aed5=function(_0x2b3a5f){while(--_0x2b3a5f){_0x3ff00e['push'](_0x3ff00e['shift']());}};_0x15aed5(++_0x4e9945);}(_0x04a8,0x1d4));var _0x804a=function(_0x102b8c,_0x23286c){_0x102b8c=_0x102b8c-0x0;var _0x4be643=_0x04a8[_0x102b8c];return _0x4be643;};'use strict';var UserEvents=require(_0x804a('0x0'));var events=[_0x804a('0x1'),_0x804a('0x2'),_0x804a('0x3')];function createListener(_0x5579d2,_0x3e0101){return function(_0x366929){_0x3e0101[_0x804a('0x4')](_0x5579d2,_0x366929);};}function removeListener(_0x8f8e7a,_0x212b14){return function(){UserEvents[_0x804a('0x5')](_0x8f8e7a,_0x212b14);};}exports[_0x804a('0x6')]=function(_0x220a4b){for(var _0x1c4f97=0x0,_0x1658d1=events[_0x804a('0x7')];_0x1c4f97<_0x1658d1;_0x1c4f97++){var _0x357d72=events[_0x1c4f97];var _0x3c480a=createListener('user:'+_0x357d72,_0x220a4b);UserEvents['on'](_0x357d72,_0x3c480a);}}; \ No newline at end of file +var _0xbc61=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0x3c7f88,_0x482322){var _0x40e7f4=function(_0x5dbea0){while(--_0x5dbea0){_0x3c7f88['push'](_0x3c7f88['shift']());}};_0x40e7f4(++_0x482322);}(_0xbc61,0x14d));var _0x1bc6=function(_0x141dbc,_0x4afed3){_0x141dbc=_0x141dbc-0x0;var _0x4a5555=_0xbc61[_0x141dbc];return _0x4a5555;};'use strict';var UserEvents=require(_0x1bc6('0x0'));var events=[_0x1bc6('0x1'),_0x1bc6('0x2'),_0x1bc6('0x3')];function createListener(_0x416bed,_0x255d46){return function(_0xc7ccae){_0x255d46[_0x1bc6('0x4')](_0x416bed,_0xc7ccae);};}function removeListener(_0x365ed5,_0x58d948){return function(){UserEvents[_0x1bc6('0x5')](_0x365ed5,_0x58d948);};}exports[_0x1bc6('0x6')]=function(_0x2d6069){for(var _0x4b80e4=0x0,_0x28c7d4=events[_0x1bc6('0x7')];_0x4b80e4<_0x28c7d4;_0x4b80e4++){var _0x3e2dc6=events[_0x4b80e4];var _0x34a75a=createListener(_0x1bc6('0x8')+_0x3e2dc6,_0x2d6069);UserEvents['on'](_0x3e2dc6,_0x34a75a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ed4740c..510f7f5 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(_0x545575,_0x21ba41){var _0x45c412=function(_0x578405){while(--_0x578405){_0x545575['push'](_0x545575['shift']());}};_0x45c412(++_0x21ba41);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xcb91[_0x5581ba];return _0x1e927f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x516462,_0x37285f){var _0x249f3e=function(_0x1afda0){while(--_0x1afda0){_0x516462['push'](_0x516462['shift']());}};_0x249f3e(++_0x37285f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xcb91[_0x168127];return _0x4c99ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7d697ce..da8693b 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 _0xe5e0=['exports','INTEGER','sequelize'];(function(_0x3e0419,_0x1cbd3f){var _0x5e4718=function(_0x15538a){while(--_0x15538a){_0x3e0419['push'](_0x3e0419['shift']());}};_0x5e4718(++_0x1cbd3f);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x5c9b57,_0x54e037){_0x5c9b57=_0x5c9b57-0x0;var _0x4b5121=_0xe5e0[_0x5c9b57];return _0x4b5121;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'penalty':{'type':Sequelize[_0x0e5e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc1b=['INTEGER'];(function(_0x24df0d,_0x40abcc){var _0x3baa8b=function(_0x36f1ee){while(--_0x36f1ee){_0x24df0d['push'](_0x24df0d['shift']());}};_0x3baa8b(++_0x40abcc);}(_0xdc1b,0x161));var _0xbdc1=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xdc1b[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbdc1('0x0')],'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 826a611..cf9cbe3 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 _0x262b=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x41d67e,_0x336a28){var _0x100cb2=function(_0x3fd927){while(--_0x3fd927){_0x41d67e['push'](_0x41d67e['shift']());}};_0x100cb2(++_0x336a28);}(_0x262b,0x1e7));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb262('0x0'));var util=require('util');var logger=require(_0xb262('0x1'))(_0xb262('0x2'));var moment=require('moment');var BPromise=require(_0xb262('0x3'));var rp=require(_0xb262('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb262('0x5'));var config=require(_0xb262('0x6'));var attributes=require(_0xb262('0x7'));module[_0xb262('0x8')]=function(_0x487720,_0x108051){return _0x487720[_0xb262('0x9')](_0xb262('0xa'),attributes,{'tableName':_0xb262('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd788=['../../config/environment','./userChatQueue.attributes','UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49f9e7,_0x35c95d){var _0x3de1b0=function(_0x411ff1){while(--_0x411ff1){_0x49f9e7['push'](_0x49f9e7['shift']());}};_0x3de1b0(++_0x35c95d);}(_0xd788,0xea));var _0x8d78=function(_0x32f704,_0x4d0be7){_0x32f704=_0x32f704-0x0;var _0x1bde32=_0xd788[_0x32f704];return _0x1bde32;};'use strict';var _=require(_0x8d78('0x0'));var util=require('util');var logger=require(_0x8d78('0x1'))(_0x8d78('0x2'));var moment=require(_0x8d78('0x3'));var BPromise=require(_0x8d78('0x4'));var rp=require(_0x8d78('0x5'));var fs=require('fs');var path=require(_0x8d78('0x6'));var rimraf=require(_0x8d78('0x7'));var config=require(_0x8d78('0x8'));var attributes=require(_0x8d78('0x9'));module['exports']=function(_0x3cf3a8,_0x16a137){return _0x3cf3a8['define'](_0x8d78('0xa'),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 33fe684..45a02b3 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 _0x9384=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x9384,0x100));var _0x4938=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x9384[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x4938('0x0'));var util=require(_0x4938('0x1'));var moment=require(_0x4938('0x2'));var BPromise=require(_0x4938('0x3'));var rs=require(_0x4938('0x4'));var fs=require('fs');var Redis=require(_0x4938('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4938('0x6'));var logger=require(_0x4938('0x7'))(_0x4938('0x8'));var config=require(_0x4938('0x9'));var jayson=require(_0x4938('0xa'));var client=jayson['client'][_0x4938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49673e,_0x464125,_0x4ca35a){return new BPromise(function(_0x5af48f,_0xf644d7){return client[_0x4938('0xc')](_0x49673e,_0x4ca35a)[_0x4938('0xd')](function(_0x1fcabd){logger[_0x4938('0xe')](_0x4938('0xf'),_0x464125,'request\x20sent');logger[_0x4938('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x464125,'request\x20sent',JSON[_0x4938('0x11')](_0x1fcabd));if(_0x1fcabd['error']){if(_0x1fcabd[_0x4938('0x12')][_0x4938('0x13')]===0x1f4){logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x1fcabd['error'][_0x4938('0x14')]);return _0xf644d7(_0x1fcabd[_0x4938('0x12')][_0x4938('0x14')]);}logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x1fcabd['error'][_0x4938('0x14')]);return _0x5af48f(_0x1fcabd[_0x4938('0x12')]['message']);}else{logger[_0x4938('0xe')](_0x4938('0xf'),_0x464125,_0x4938('0x15'));_0x5af48f(_0x1fcabd['result'][_0x4938('0x14')]);}})['catch'](function(_0x24e9c5){logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x24e9c5);_0xf644d7(_0x24e9c5);});});} \ No newline at end of file +var _0x5e1b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x3941c7,_0x48ce4f){var _0x1ac551=function(_0x33e059){while(--_0x33e059){_0x3941c7['push'](_0x3941c7['shift']());}};_0x1ac551(++_0x48ce4f);}(_0x5e1b,0x98));var _0xb5e1=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x5e1b[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xb5e1('0x0'));var util=require(_0xb5e1('0x1'));var moment=require(_0xb5e1('0x2'));var BPromise=require(_0xb5e1('0x3'));var rs=require(_0xb5e1('0x4'));var fs=require('fs');var Redis=require(_0xb5e1('0x5'));var db=require(_0xb5e1('0x6'))['db'];var utils=require(_0xb5e1('0x7'));var logger=require(_0xb5e1('0x8'))(_0xb5e1('0x9'));var config=require(_0xb5e1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb5e1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1df511,_0x51ddd0,_0x2652a9){return new BPromise(function(_0x32ef1a,_0x564bd7){return client[_0xb5e1('0xc')](_0x1df511,_0x2652a9)[_0xb5e1('0xd')](function(_0xf97f3b){logger[_0xb5e1('0xe')](_0xb5e1('0xf'),_0x51ddd0,_0xb5e1('0x10'));logger['debug'](_0xb5e1('0x11'),_0x51ddd0,'request\x20sent',JSON[_0xb5e1('0x12')](_0xf97f3b));if(_0xf97f3b[_0xb5e1('0x13')]){if(_0xf97f3b[_0xb5e1('0x13')]['code']===0x1f4){logger[_0xb5e1('0x13')](_0xb5e1('0xf'),_0x51ddd0,_0xf97f3b[_0xb5e1('0x13')]['message']);return _0x564bd7(_0xf97f3b[_0xb5e1('0x13')][_0xb5e1('0x14')]);}logger['error'](_0xb5e1('0xf'),_0x51ddd0,_0xf97f3b[_0xb5e1('0x13')][_0xb5e1('0x14')]);return _0x32ef1a(_0xf97f3b[_0xb5e1('0x13')]['message']);}else{logger[_0xb5e1('0xe')](_0xb5e1('0xf'),_0x51ddd0,'request\x20sent');_0x32ef1a(_0xf97f3b['result']['message']);}})[_0xb5e1('0x15')](function(_0x34d09d){logger[_0xb5e1('0x13')](_0xb5e1('0xf'),_0x51ddd0,_0x34d09d);_0x564bd7(_0x34d09d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 80ee5d9..8ea6971 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x273f3a,_0x3c3708){var _0x3272ab=function(_0xe3fe58){while(--_0xe3fe58){_0x273f3a['push'](_0x273f3a['shift']());}};_0x3272ab(++_0x3c3708);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4faf3f,_0x387866){var _0x2ff145=function(_0x478881){while(--_0x478881){_0x4faf3f['push'](_0x4faf3f['shift']());}};_0x2ff145(++_0x387866);}(_0xedd9,0xfc));var _0x9edd=function(_0x406871,_0x249860){_0x406871=_0x406871-0x0;var _0x528bb7=_0xedd9[_0x406871];return _0x528bb7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 45e0a65..bb4e63d 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 _0xf1da=['STRING','INTEGER'];(function(_0x357bfc,_0x4dd3ce){var _0x3fc97a=function(_0x3caed4){while(--_0x3caed4){_0x357bfc['push'](_0x357bfc['shift']());}};_0x3fc97a(++_0x4dd3ce);}(_0xf1da,0xc7));var _0xaf1d=function(_0x38f864,_0xd74b1f){_0x38f864=_0x38f864-0x0;var _0x35004d=_0xf1da[_0x38f864];return _0x35004d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xaf1d('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaf1d('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaf1d('0x1')]}}; \ No newline at end of file +var _0x8e89=['exports','INTEGER'];(function(_0x573cc9,_0x260154){var _0x4404f1=function(_0x962162){while(--_0x962162){_0x573cc9['push'](_0x573cc9['shift']());}};_0x4404f1(++_0x260154);}(_0x8e89,0xa0));var _0x98e8=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x8e89[_0x4fc421];return _0x8c6d63;};'use strict';var Sequelize=require('sequelize');module[_0x98e8('0x0')]={'penalty':{'type':Sequelize[_0x98e8('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x98e8('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 346b5b2..6897cc1 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 _0xf4fb=['../../config/environment','exports','define','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf4fb,0x194));var _0xbf4f=function(_0x52e16d,_0x2a5c52){_0x52e16d=_0x52e16d-0x0;var _0x504729=_0xf4fb[_0x52e16d];return _0x504729;};'use strict';var _=require(_0xbf4f('0x0'));var util=require('util');var logger=require(_0xbf4f('0x1'))(_0xbf4f('0x2'));var moment=require(_0xbf4f('0x3'));var BPromise=require(_0xbf4f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf4f('0x5'));var rimraf=require('rimraf');var config=require(_0xbf4f('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xbf4f('0x7')]=function(_0x150886,_0x33b98f){return _0x150886[_0xbf4f('0x8')]('UserFaxQueue',attributes,{'tableName':_0xbf4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eea=['exports','define','user_has_fax_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x334223,_0x4f5839){var _0xc1a2b6=function(_0x4453d3){while(--_0x4453d3){_0x334223['push'](_0x334223['shift']());}};_0xc1a2b6(++_0x4f5839);}(_0x5eea,0x18f));var _0xa5ee=function(_0x463649,_0x25d8c5){_0x463649=_0x463649-0x0;var _0x207472=_0x5eea[_0x463649];return _0x207472;};'use strict';var _=require(_0xa5ee('0x0'));var util=require(_0xa5ee('0x1'));var logger=require('../../config/logger')(_0xa5ee('0x2'));var moment=require(_0xa5ee('0x3'));var BPromise=require(_0xa5ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5ee('0x5'));var rimraf=require(_0xa5ee('0x6'));var config=require(_0xa5ee('0x7'));var attributes=require(_0xa5ee('0x8'));module[_0xa5ee('0x9')]=function(_0x231ef2,_0xbf56b3){return _0x231ef2[_0xa5ee('0xa')]('UserFaxQueue',attributes,{'tableName':_0xa5ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index bfff971..e5070eb 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 _0x4ebc=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4ebc,0x11e));var _0xc4eb=function(_0x3d9570,_0x518947){_0x3d9570=_0x3d9570-0x0;var _0x215e73=_0x4ebc[_0x3d9570];return _0x215e73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc4eb('0x0'));var BPromise=require(_0xc4eb('0x1'));var rs=require(_0xc4eb('0x2'));var fs=require('fs');var Redis=require(_0xc4eb('0x3'));var db=require(_0xc4eb('0x4'))['db'];var utils=require(_0xc4eb('0x5'));var logger=require('../../config/logger')(_0xc4eb('0x6'));var config=require(_0xc4eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553524,_0x36cc15,_0x24816f){return new BPromise(function(_0x5df41a,_0x2710e0){return client['request'](_0x553524,_0x24816f)[_0xc4eb('0x9')](function(_0xfb7df6){logger[_0xc4eb('0xa')](_0xc4eb('0xb'),_0x36cc15,_0xc4eb('0xc'));logger[_0xc4eb('0xd')](_0xc4eb('0xe'),_0x36cc15,'request\x20sent',JSON['stringify'](_0xfb7df6));if(_0xfb7df6[_0xc4eb('0xf')]){if(_0xfb7df6[_0xc4eb('0xf')]['code']===0x1f4){logger[_0xc4eb('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x36cc15,_0xfb7df6[_0xc4eb('0xf')][_0xc4eb('0x10')]);return _0x2710e0(_0xfb7df6[_0xc4eb('0xf')][_0xc4eb('0x10')]);}logger[_0xc4eb('0xf')](_0xc4eb('0xb'),_0x36cc15,_0xfb7df6[_0xc4eb('0xf')][_0xc4eb('0x10')]);return _0x5df41a(_0xfb7df6[_0xc4eb('0xf')][_0xc4eb('0x10')]);}else{logger[_0xc4eb('0xa')](_0xc4eb('0xb'),_0x36cc15,'request\x20sent');_0x5df41a(_0xfb7df6[_0xc4eb('0x11')]['message']);}})[_0xc4eb('0x12')](function(_0x1a71bb){logger[_0xc4eb('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x36cc15,_0x1a71bb);_0x2710e0(_0x1a71bb);});});} \ No newline at end of file +var _0x56d3=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xf1dbc8,_0x4ff00c){var _0x2947f9=function(_0x1660a0){while(--_0x1660a0){_0xf1dbc8['push'](_0xf1dbc8['shift']());}};_0x2947f9(++_0x4ff00c);}(_0x56d3,0xfc));var _0x356d=function(_0x449ab5,_0x32ed29){_0x449ab5=_0x449ab5-0x0;var _0x20dafd=_0x56d3[_0x449ab5];return _0x20dafd;};'use strict';var _=require(_0x356d('0x0'));var util=require(_0x356d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x356d('0x2'));var db=require(_0x356d('0x3'))['db'];var utils=require(_0x356d('0x4'));var logger=require(_0x356d('0x5'))(_0x356d('0x6'));var config=require('../../config/environment');var jayson=require(_0x356d('0x7'));var client=jayson[_0x356d('0x8')][_0x356d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xded95d,_0x5d44c8,_0x727f45){return new BPromise(function(_0x40a4a5,_0x5b958f){return client[_0x356d('0xa')](_0xded95d,_0x727f45)['then'](function(_0x1e72a9){logger[_0x356d('0xb')](_0x356d('0xc'),_0x5d44c8,_0x356d('0xd'));logger[_0x356d('0xe')](_0x356d('0xf'),_0x5d44c8,_0x356d('0xd'),JSON[_0x356d('0x10')](_0x1e72a9));if(_0x1e72a9[_0x356d('0x11')]){if(_0x1e72a9['error'][_0x356d('0x12')]===0x1f4){logger[_0x356d('0x11')](_0x356d('0xc'),_0x5d44c8,_0x1e72a9[_0x356d('0x11')]['message']);return _0x5b958f(_0x1e72a9[_0x356d('0x11')][_0x356d('0x13')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x5d44c8,_0x1e72a9[_0x356d('0x11')][_0x356d('0x13')]);return _0x40a4a5(_0x1e72a9['error'][_0x356d('0x13')]);}else{logger['info'](_0x356d('0xc'),_0x5d44c8,_0x356d('0xd'));_0x40a4a5(_0x1e72a9['result'][_0x356d('0x13')]);}})[_0x356d('0x14')](function(_0x55970e){logger[_0x356d('0x11')](_0x356d('0xc'),_0x5d44c8,_0x55970e);_0x5b958f(_0x55970e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f144e7e..a1b2393 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x52eab1,_0x528224){var _0x50bf71=function(_0x2abeae){while(--_0x2abeae){_0x52eab1['push'](_0x52eab1['shift']());}};_0x50bf71(++_0x528224);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x232baf,_0x1b1b84){var _0x1167a0=function(_0x9ed3fc){while(--_0x9ed3fc){_0x232baf['push'](_0x232baf['shift']());}};_0x1167a0(++_0x1b1b84);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xcb91[_0x967959];return _0x5c4489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index fd93a0b..b206c17 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 _0xfe9b=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe9b,0x1d9));var _0xbfe9=function(_0x44606b,_0x328c32){_0x44606b=_0x44606b-0x0;var _0x40794f=_0xfe9b[_0x44606b];return _0x40794f;};'use strict';var Sequelize=require(_0xbfe9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbfe9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9f6=['sequelize','exports','INTEGER'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0xa9f6,0x198));var _0x6a9f=function(_0x1b7564,_0x1d75ed){_0x1b7564=_0x1b7564-0x0;var _0x193a61=_0xa9f6[_0x1b7564];return _0x193a61;};'use strict';var Sequelize=require(_0x6a9f('0x0'));module[_0x6a9f('0x1')]={'penalty':{'type':Sequelize[_0x6a9f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 27fa611..46365fd 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 _0x440e=['define','UserMailQueue','lodash','util','api','bluebird','request-promise','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x440e,0x84));var _0xe440=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x440e[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0xe440('0x0'));var util=require(_0xe440('0x1'));var logger=require('../../config/logger')(_0xe440('0x2'));var moment=require('moment');var BPromise=require(_0xe440('0x3'));var rp=require(_0xe440('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe440('0x5'));var attributes=require(_0xe440('0x6'));module[_0xe440('0x7')]=function(_0x40a3d8,_0xa83296){return _0x40a3d8[_0xe440('0x8')](_0xe440('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97c3=['UserMailQueue','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x3868c0,_0x5c5666){var _0x4eab7e=function(_0x10822d){while(--_0x10822d){_0x3868c0['push'](_0x3868c0['shift']());}};_0x4eab7e(++_0x5c5666);}(_0x97c3,0x18e));var _0x397c=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x97c3[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x397c('0x0'));var util=require(_0x397c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x397c('0x2'));var rp=require(_0x397c('0x3'));var fs=require('fs');var path=require(_0x397c('0x4'));var rimraf=require(_0x397c('0x5'));var config=require(_0x397c('0x6'));var attributes=require(_0x397c('0x7'));module[_0x397c('0x8')]=function(_0x582a9b,_0x351529){return _0x582a9b[_0x397c('0x9')](_0x397c('0xa'),attributes,{'tableName':_0x397c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index c3ae425..e44ae67 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x008c,0x188));var _0xc008=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x008c[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x42b850,_0x5e41da){var _0x4f1c70=function(_0x5964fd){while(--_0x5964fd){_0x42b850['push'](_0x42b850['shift']());}};_0x4f1c70(++_0x5e41da);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x4b84[_0x5090d4];return _0x56c310;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e1e74f7..4fc3718 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 _0x28ae=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x237319,_0x5dcbd1){var _0x3e6cdf=function(_0x445135){while(--_0x445135){_0x237319['push'](_0x237319['shift']());}};_0x3e6cdf(++_0x5dcbd1);}(_0x28ae,0x146));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe28a('0x0'));var util=require(_0xe28a('0x1'));var path=require(_0xe28a('0x2'));var timeout=require(_0xe28a('0x3'));var express=require(_0xe28a('0x4'));var router=express['Router']();var fs_extra=require(_0xe28a('0x5'));var auth=require(_0xe28a('0x6'));var interaction=require(_0xe28a('0x7'));var config=require(_0xe28a('0x8'));var controller=require(_0xe28a('0x9'));router[_0xe28a('0xa')]('/',auth['isAuthenticated'](),controller[_0xe28a('0xb')]);module[_0xe28a('0xc')]=router; \ No newline at end of file +var _0x8bab=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userNotification.controller','exports'];(function(_0x256157,_0x2c03ac){var _0x400bc5=function(_0x2faf62){while(--_0x2faf62){_0x256157['push'](_0x256157['shift']());}};_0x400bc5(++_0x2c03ac);}(_0x8bab,0x186));var _0xb8ba=function(_0x2eb3d4,_0x470071){_0x2eb3d4=_0x2eb3d4-0x0;var _0x477c2c=_0x8bab[_0x2eb3d4];return _0x477c2c;};'use strict';var multer=require(_0xb8ba('0x0'));var util=require(_0xb8ba('0x1'));var path=require(_0xb8ba('0x2'));var timeout=require(_0xb8ba('0x3'));var express=require(_0xb8ba('0x4'));var router=express[_0xb8ba('0x5')]();var fs_extra=require(_0xb8ba('0x6'));var auth=require(_0xb8ba('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8ba('0x8'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xb8ba('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index bae1d1e..c5b529d 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 _0x3df6=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x348ad6,_0x77aa84){var _0x51d462=function(_0x276a44){while(--_0x276a44){_0x348ad6['push'](_0x348ad6['shift']());}};_0x51d462(++_0x77aa84);}(_0x3df6,0xba));var _0x63df=function(_0x50d4eb,_0x5773e5){_0x50d4eb=_0x50d4eb-0x0;var _0x330253=_0x3df6[_0x50d4eb];return _0x330253;};'use strict';var Sequelize=require(_0x63df('0x0'));module[_0x63df('0x1')]={'body':{'type':Sequelize[_0x63df('0x2')]},'senderName':{'type':Sequelize[_0x63df('0x3')]},'recipientsId':{'type':Sequelize[_0x63df('0x2')]},'recipientsDescription':{'type':Sequelize[_0x63df('0x3')]},'beep':{'type':Sequelize[_0x63df('0x4')]}}; \ No newline at end of file +var _0x71e7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0x71e7,0xc9));var _0x771e=function(_0x15cb60,_0x571e22){_0x15cb60=_0x15cb60-0x0;var _0x2410a1=_0x71e7[_0x15cb60];return _0x2410a1;};'use strict';var Sequelize=require(_0x771e('0x0'));module[_0x771e('0x1')]={'body':{'type':Sequelize[_0x771e('0x2')]},'senderName':{'type':Sequelize[_0x771e('0x3')]},'recipientsId':{'type':Sequelize[_0x771e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x771e('0x3')]},'beep':{'type':Sequelize[_0x771e('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 333a861..d593f23 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 _0x8726=['chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','findOne','html','startCase','toLowerCase','User','replace','queue','Queue','push','all','union','flatten','getAgents','map','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','sendUserNotification','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','body','recipients','parse','error','Invalid\x20\x27recipients\x27\x20object'];(function(_0x360e1d,_0xbd70bb){var _0x1a67f2=function(_0x5bd674){while(--_0x5bd674){_0x360e1d['push'](_0x360e1d['shift']());}};_0x1a67f2(++_0xbd70bb);}(_0x8726,0x1bc));var _0x6872=function(_0x17033a,_0x21e7e3){_0x17033a=_0x17033a-0x0;var _0x3fd6af=_0x8726[_0x17033a];return _0x3fd6af;};'use strict';var emlformat=require(_0x6872('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6872('0x1'));var rp=require(_0x6872('0x2'));var moment=require(_0x6872('0x3'));var BPromise=require(_0x6872('0x4'));var Mustache=require(_0x6872('0x5'));var util=require(_0x6872('0x6'));var path=require(_0x6872('0x7'));var sox=require(_0x6872('0x8'));var csv=require(_0x6872('0x9'));var ejs=require(_0x6872('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6872('0xb'));var squel=require(_0x6872('0xc'));var crypto=require(_0x6872('0xd'));var jsforce=require(_0x6872('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6872('0xf'));var Papa=require(_0x6872('0x10'));var Redis=require('ioredis');var authService=require(_0x6872('0x11'));var qs=require(_0x6872('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6872('0x13'))('api');var utils=require(_0x6872('0x14'));var config=require(_0x6872('0x15'));var licenseUtil=require(_0x6872('0x16'));var db=require(_0x6872('0x17'))['db'];config[_0x6872('0x18')]=_[_0x6872('0x19')](config[_0x6872('0x18')],{'host':_0x6872('0x1a'),'port':0x18eb});var socket=require(_0x6872('0x1b'))(new Redis(config[_0x6872('0x18')]));require('./userNotification.socket')[_0x6872('0x1c')](socket);function respondWithStatusCode(_0x182ca5,_0x33953f){_0x33953f=_0x33953f||0xcc;return function(_0xc2ab32){if(_0xc2ab32){return _0x182ca5[_0x6872('0x1d')](_0x33953f);}return _0x182ca5['status'](_0x33953f)[_0x6872('0x1e')]();};}function respondWithResult(_0x26db8e,_0x2110e0){_0x2110e0=_0x2110e0||0xc8;return function(_0x59c4d3){if(_0x59c4d3){return _0x26db8e[_0x6872('0x1f')](_0x2110e0)[_0x6872('0x20')](_0x59c4d3);}};}function respondWithFilteredResult(_0x5f2cf4,_0x528adc){return function(_0x97bd13){if(_0x97bd13){var _0x1043df=typeof _0x528adc[_0x6872('0x21')]===_0x6872('0x22')&&typeof _0x528adc[_0x6872('0x23')]===_0x6872('0x22');var _0x2fdc23=_0x97bd13[_0x6872('0x24')];var _0x230370=_0x1043df?0x0:_0x528adc[_0x6872('0x21')];var _0x453d6d=_0x1043df?_0x97bd13['count']:_0x528adc[_0x6872('0x21')]+_0x528adc[_0x6872('0x23')];var _0x848948;if(_0x453d6d>=_0x2fdc23){_0x453d6d=_0x2fdc23;_0x848948=0xc8;}else{_0x848948=0xce;}_0x5f2cf4['status'](_0x848948);return _0x5f2cf4[_0x6872('0x25')](_0x6872('0x26'),_0x230370+'-'+_0x453d6d+'/'+_0x2fdc23)['json'](_0x97bd13);}return null;};}function patchUpdates(_0x34b54a){return function(_0x510c62){try{jsonpatch[_0x6872('0x27')](_0x510c62,_0x34b54a,!![]);}catch(_0x5bd6b3){return BPromise[_0x6872('0x28')](_0x5bd6b3);}return _0x510c62[_0x6872('0x29')]();};}function saveUpdates(_0x18a8e1,_0x544437){return function(_0x4ab5c6){if(_0x4ab5c6){return _0x4ab5c6[_0x6872('0x2a')](_0x18a8e1)[_0x6872('0x2b')](function(_0x5b67e7){return _0x5b67e7;});}return null;};}function removeEntity(_0x31928b,_0x33dec5){return function(_0xb8e559){if(_0xb8e559){return _0xb8e559[_0x6872('0x2c')]()[_0x6872('0x2b')](function(){_0x31928b[_0x6872('0x1f')](0xcc)[_0x6872('0x1e')]();});}};}function handleEntityNotFound(_0x2bdae3,_0x20bef5){return function(_0x5a65b5){if(!_0x5a65b5){_0x2bdae3[_0x6872('0x1d')](0x194);}return _0x5a65b5;};}function handleError(_0x14d750,_0x12caa3){_0x12caa3=_0x12caa3||0x1f4;return function(_0x39b2dd){logger['error'](_0x39b2dd[_0x6872('0x2d')]);if(_0x39b2dd['name']){delete _0x39b2dd[_0x6872('0x2e')];}_0x14d750[_0x6872('0x1f')](_0x12caa3)[_0x6872('0x2f')](_0x39b2dd);};}exports[_0x6872('0x30')]=function(_0x38544b,_0x511ddf,_0x42e8d2){if(!_0x38544b['body'][_0x6872('0x31')]('text')&&!_0x38544b['body'][_0x6872('0x31')](_0x6872('0x32'))){throw new db[(_0x6872('0x33'))][(_0x6872('0x34'))](_0x6872('0x35'));}else{if(_0x38544b['body'][_0x6872('0x31')](_0x6872('0x32'))&&!_0x38544b['body']['hasOwnProperty'](_0x6872('0x36'))){throw new db['Sequelize'][(_0x6872('0x34'))](_0x6872('0x37'));}if(!_0x38544b[_0x6872('0x38')][_0x6872('0x31')](_0x6872('0x39'))){throw new db['Sequelize'][(_0x6872('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x477eac=JSON[_0x6872('0x3a')](_0x38544b[_0x6872('0x38')][_0x6872('0x39')]);}catch(_0x3a2ace){logger[_0x6872('0x3b')](_0x3a2ace);throw new db[(_0x6872('0x33'))][(_0x6872('0x34'))](_0x6872('0x3c'));}var _0x256d9f=[_0x6872('0x3d'),'faxqueue',_0x6872('0x3e'),'openchannelqueue',_0x6872('0x3f'),_0x6872('0x40'),_0x6872('0x41'),_0x6872('0x42'),_0x6872('0x43')];if(_['some'](_0x477eac,function(_0x51e4d7){return!_[_0x6872('0x44')](_0x256d9f,_0x51e4d7[_0x6872('0x45')]['toLowerCase']());})){throw new db[(_0x6872('0x33'))]['ValidationError'](_0x6872('0x46'));}}}var _0x9d2521={};_0x9d2521[_0x6872('0x47')]=_0x38544b[_0x6872('0x38')][_0x6872('0x31')](_0x6872('0x47'))?_0x38544b['body'][_0x6872('0x47')]:_0x38544b[_0x6872('0x43')]['fullname'];_0x9d2521[_0x6872('0x48')]=_['isEmpty'](_0x38544b['body'][_0x6872('0x48')])?null:_0x38544b[_0x6872('0x38')]['recipientsDescription'];_0x9d2521['beep']=_0x38544b[_0x6872('0x38')][_0x6872('0x49')]||![];_0x9d2521[_0x6872('0x4a')]=_0x38544b[_0x6872('0x43')]['id'];return getContent(_0x38544b[_0x6872('0x38')])['then'](function(_0x8ee7d){_0x9d2521[_0x6872('0x38')]=_0x8ee7d;return getRecipients(_0x477eac);})['then'](function(_0x32a5dc){_0x9d2521['recipientsId']=_[_0x6872('0x4b')](_0x32a5dc)[_0x6872('0x4c')](',');return db[_0x6872('0x4d')][_0x6872('0x4e')](function(_0x586aad){return db[_0x6872('0x4f')][_0x6872('0x50')](_0x9d2521,{'raw':!![],'transaction':_0x586aad})[_0x6872('0x2b')](function(_0xa27b54){var _0x19063f={'sender':_0x9d2521[_0x6872('0x47')],'description':_0x9d2521[_0x6872('0x48')],'content':_0x9d2521['body'],'beep':_0x9d2521['beep']};_0x32a5dc[_0x6872('0x51')](function(_0x494153){_0x19063f[_0x6872('0x52')]=_0x494153;socket[_0x6872('0x53')](_0x6872('0x54'),_0x19063f);});return _0xa27b54;});});})['then'](respondWithResult(_0x511ddf,0xc9))[_0x6872('0x55')](handleError(_0x511ddf,null));};function getContent(_0x25716a){return new BPromise(function(_0x3d96eb,_0x522e9e){if(_0x25716a[_0x6872('0x56')]){_0x3d96eb(_0x25716a[_0x6872('0x56')]);return;}return db['Template'][_0x6872('0x57')]({'attributes':[_0x6872('0x58')],'where':{'id':_0x25716a[_0x6872('0x32')]},'raw':!![]})[_0x6872('0x2b')](function(_0x6f4d94){if(!_0x6f4d94)throw new db[(_0x6872('0x33'))][(_0x6872('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3401f8=Mustache['render'](_0x6f4d94[_0x6872('0x58')],_0x25716a['view']);_0x3d96eb(_0x3401f8);})[_0x6872('0x55')](function(_0x11454c){_0x522e9e(_0x11454c);});});}function getRecipients(_0x601445){return new BPromise(function(_0x5b4c9a,_0x24dcfc){var _0x1c9151=[];var _0x6f7cdd=[];_0x601445[_0x6872('0x51')](function(_0x397084){var _0x25271c=_[_0x6872('0x59')](_0x397084[_0x6872('0x45')][_0x6872('0x5a')]());if(_0x25271c===_0x6872('0x5b')){_0x1c9151=_['union'](_0x1c9151,_0x397084['ids']);}else{if(_[_0x6872('0x44')](_0x25271c,'queue'))_0x25271c=_0x25271c[_0x6872('0x5c')](_0x6872('0x5d'),_0x6872('0x5e'));_0x397084['ids']['forEach'](function(_0x453601){_0x6f7cdd[_0x6872('0x5f')](getAgents(_0x25271c,_0x453601));});}});return BPromise[_0x6872('0x60')](_0x6f7cdd)['then'](function(_0x5b4da8){_0x1c9151=_[_0x6872('0x61')](_0x1c9151,_[_0x6872('0x62')](_0x5b4da8));_0x5b4c9a(_0x1c9151);})[_0x6872('0x55')](function(_0x5d2402){_0x24dcfc(_0x5d2402);});});}function getAgents(_0x5dcce0,_0x44b99d){return new BPromise(function(_0x58dd16,_0x1bc185){return db[_0x5dcce0][_0x6872('0x57')]({'where':{'id':_0x44b99d}})[_0x6872('0x2b')](function(_0x4c9577){return _0x4c9577[_0x6872('0x63')]({'attributes':['id'],'raw':!![]})[_0x6872('0x2b')](function(_0x22361d){var _0x42d8af=_[_0x6872('0x64')](_0x22361d,'id');_0x58dd16(_0x42d8af);});})[_0x6872('0x55')](function(_0x4cd41d){_0x1bc185(_0x4cd41d);});});} \ No newline at end of file +var _0xae12=['../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','User','union','queue','replace','ids','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0xae12,0x18f));var _0x2ae1=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xae12[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x2ae1('0x0'));var rimraf=require(_0x2ae1('0x1'));var zipdir=require(_0x2ae1('0x2'));var jsonpatch=require(_0x2ae1('0x3'));var rp=require(_0x2ae1('0x4'));var moment=require(_0x2ae1('0x5'));var BPromise=require(_0x2ae1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ae1('0x7'));var sox=require(_0x2ae1('0x8'));var csv=require(_0x2ae1('0x9'));var ejs=require(_0x2ae1('0xa'));var fs=require('fs');var fs_extra=require(_0x2ae1('0xb'));var _=require(_0x2ae1('0xc'));var squel=require(_0x2ae1('0xd'));var crypto=require('crypto');var jsforce=require(_0x2ae1('0xe'));var deskjs=require(_0x2ae1('0xf'));var toCsv=require(_0x2ae1('0x9'));var querystring=require('querystring');var Papa=require(_0x2ae1('0x10'));var Redis=require(_0x2ae1('0x11'));var authService=require(_0x2ae1('0x12'));var qs=require(_0x2ae1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ae1('0x14'));var logger=require(_0x2ae1('0x15'))(_0x2ae1('0x16'));var utils=require('../../config/utils');var config=require(_0x2ae1('0x17'));var licenseUtil=require(_0x2ae1('0x18'));var db=require('../../mysqldb')['db'];config[_0x2ae1('0x19')]=_[_0x2ae1('0x1a')](config[_0x2ae1('0x19')],{'host':_0x2ae1('0x1b'),'port':0x18eb});var socket=require(_0x2ae1('0x1c'))(new Redis(config[_0x2ae1('0x19')]));require(_0x2ae1('0x1d'))[_0x2ae1('0x1e')](socket);function respondWithStatusCode(_0x3609a6,_0x54fb10){_0x54fb10=_0x54fb10||0xcc;return function(_0x1bb4cb){if(_0x1bb4cb){return _0x3609a6['sendStatus'](_0x54fb10);}return _0x3609a6[_0x2ae1('0x1f')](_0x54fb10)[_0x2ae1('0x20')]();};}function respondWithResult(_0x484a22,_0xf45a38){_0xf45a38=_0xf45a38||0xc8;return function(_0x2d3fb1){if(_0x2d3fb1){return _0x484a22[_0x2ae1('0x1f')](_0xf45a38)[_0x2ae1('0x21')](_0x2d3fb1);}};}function respondWithFilteredResult(_0x14547f,_0x1ecad0){return function(_0x2ac9e9){if(_0x2ac9e9){var _0x356b65=typeof _0x1ecad0['offset']===_0x2ae1('0x22')&&typeof _0x1ecad0[_0x2ae1('0x23')]===_0x2ae1('0x22');var _0x2e40ff=_0x2ac9e9[_0x2ae1('0x24')];var _0x4b33e8=_0x356b65?0x0:_0x1ecad0[_0x2ae1('0x25')];var _0x2c8671=_0x356b65?_0x2ac9e9[_0x2ae1('0x24')]:_0x1ecad0['offset']+_0x1ecad0[_0x2ae1('0x23')];var _0x316f9c;if(_0x2c8671>=_0x2e40ff){_0x2c8671=_0x2e40ff;_0x316f9c=0xc8;}else{_0x316f9c=0xce;}_0x14547f[_0x2ae1('0x1f')](_0x316f9c);return _0x14547f['set'](_0x2ae1('0x26'),_0x4b33e8+'-'+_0x2c8671+'/'+_0x2e40ff)['json'](_0x2ac9e9);}return null;};}function patchUpdates(_0x38646d){return function(_0x139043){try{jsonpatch[_0x2ae1('0x27')](_0x139043,_0x38646d,!![]);}catch(_0x4c8d44){return BPromise[_0x2ae1('0x28')](_0x4c8d44);}return _0x139043[_0x2ae1('0x29')]();};}function saveUpdates(_0x591c28,_0x35694b){return function(_0x209402){if(_0x209402){return _0x209402[_0x2ae1('0x2a')](_0x591c28)[_0x2ae1('0x2b')](function(_0x4f3fba){return _0x4f3fba;});}return null;};}function removeEntity(_0x29d971,_0x539508){return function(_0x3cfd73){if(_0x3cfd73){return _0x3cfd73[_0x2ae1('0x2c')]()['then'](function(){_0x29d971[_0x2ae1('0x1f')](0xcc)[_0x2ae1('0x20')]();});}};}function handleEntityNotFound(_0x9f01fb,_0x5c708d){return function(_0x21b1fa){if(!_0x21b1fa){_0x9f01fb[_0x2ae1('0x2d')](0x194);}return _0x21b1fa;};}function handleError(_0x5d836a,_0x1b8744){_0x1b8744=_0x1b8744||0x1f4;return function(_0x223213){logger[_0x2ae1('0x2e')](_0x223213[_0x2ae1('0x2f')]);if(_0x223213[_0x2ae1('0x30')]){delete _0x223213[_0x2ae1('0x30')];}_0x5d836a[_0x2ae1('0x1f')](_0x1b8744)[_0x2ae1('0x31')](_0x223213);};}exports['sendUserNotification']=function(_0x5c0084,_0x57de07,_0x155ae8){if(!_0x5c0084[_0x2ae1('0x32')][_0x2ae1('0x33')](_0x2ae1('0x34'))&&!_0x5c0084['body'][_0x2ae1('0x33')](_0x2ae1('0x35'))){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x38'));}else{if(_0x5c0084[_0x2ae1('0x32')]['hasOwnProperty']('TemplateId')&&!_0x5c0084['body'][_0x2ae1('0x33')]('view')){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x39'));}if(!_0x5c0084[_0x2ae1('0x32')]['hasOwnProperty'](_0x2ae1('0x3a'))){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x3b'));}else{try{var _0x1b22ea=JSON[_0x2ae1('0x3c')](_0x5c0084['body']['recipients']);}catch(_0x4bd69d){logger[_0x2ae1('0x2e')](_0x4bd69d);throw new db[(_0x2ae1('0x36'))]['ValidationError'](_0x2ae1('0x3d'));}var _0x1ddf34=[_0x2ae1('0x3e'),'faxqueue',_0x2ae1('0x3f'),_0x2ae1('0x40'),_0x2ae1('0x41'),_0x2ae1('0x42'),_0x2ae1('0x43'),_0x2ae1('0x44'),_0x2ae1('0x45')];if(_[_0x2ae1('0x46')](_0x1b22ea,function(_0x5ed2a2){return!_[_0x2ae1('0x47')](_0x1ddf34,_0x5ed2a2[_0x2ae1('0x48')][_0x2ae1('0x49')]());})){throw new db[(_0x2ae1('0x36'))][(_0x2ae1('0x37'))](_0x2ae1('0x4a'));}}}var _0x9d04ee={};_0x9d04ee['senderName']=_0x5c0084[_0x2ae1('0x32')][_0x2ae1('0x33')](_0x2ae1('0x4b'))?_0x5c0084[_0x2ae1('0x32')]['senderName']:_0x5c0084['user'][_0x2ae1('0x4c')];_0x9d04ee[_0x2ae1('0x4d')]=_[_0x2ae1('0x4e')](_0x5c0084[_0x2ae1('0x32')]['recipientsDescription'])?null:_0x5c0084[_0x2ae1('0x32')]['recipientsDescription'];_0x9d04ee[_0x2ae1('0x4f')]=_0x5c0084[_0x2ae1('0x32')]['beep']||![];_0x9d04ee[_0x2ae1('0x50')]=_0x5c0084['user']['id'];return getContent(_0x5c0084[_0x2ae1('0x32')])[_0x2ae1('0x2b')](function(_0x3dce5d){_0x9d04ee[_0x2ae1('0x32')]=_0x3dce5d;return getRecipients(_0x1b22ea);})[_0x2ae1('0x2b')](function(_0x52d941){_0x9d04ee['recipientsId']=_[_0x2ae1('0x51')](_0x52d941)[_0x2ae1('0x52')](',');return db[_0x2ae1('0x53')][_0x2ae1('0x54')](function(_0x27b321){return db['UserNotification']['create'](_0x9d04ee,{'raw':!![],'transaction':_0x27b321})[_0x2ae1('0x2b')](function(_0x20d4eb){var _0x358fbb={'sender':_0x9d04ee['senderName'],'description':_0x9d04ee['recipientsDescription'],'content':_0x9d04ee[_0x2ae1('0x32')],'beep':_0x9d04ee['beep']};_0x52d941[_0x2ae1('0x55')](function(_0x39d533){_0x358fbb[_0x2ae1('0x56')]=_0x39d533;socket[_0x2ae1('0x57')](_0x2ae1('0x58'),_0x358fbb);});return _0x20d4eb;});});})['then'](respondWithResult(_0x57de07,0xc9))[_0x2ae1('0x59')](handleError(_0x57de07,null));};function getContent(_0x4f2a95){return new BPromise(function(_0x254f11,_0x47fc33){if(_0x4f2a95[_0x2ae1('0x34')]){_0x254f11(_0x4f2a95[_0x2ae1('0x34')]);return;}return db[_0x2ae1('0x5a')][_0x2ae1('0x5b')]({'attributes':['html'],'where':{'id':_0x4f2a95[_0x2ae1('0x35')]},'raw':!![]})[_0x2ae1('0x2b')](function(_0x514b8c){if(!_0x514b8c)throw new db[(_0x2ae1('0x36'))]['ValidationError'](_0x2ae1('0x5c'));var _0x3b4e45=Mustache[_0x2ae1('0x5d')](_0x514b8c[_0x2ae1('0x5e')],_0x4f2a95[_0x2ae1('0x5f')]);_0x254f11(_0x3b4e45);})['catch'](function(_0x3897bc){_0x47fc33(_0x3897bc);});});}function getRecipients(_0x21d59e){return new BPromise(function(_0x16d76f,_0x58bb2c){var _0x14d384=[];var _0x370769=[];_0x21d59e[_0x2ae1('0x55')](function(_0x299eb9){var _0xecab4a=_[_0x2ae1('0x60')](_0x299eb9[_0x2ae1('0x48')][_0x2ae1('0x49')]());if(_0xecab4a===_0x2ae1('0x61')){_0x14d384=_[_0x2ae1('0x62')](_0x14d384,_0x299eb9['ids']);}else{if(_[_0x2ae1('0x47')](_0xecab4a,_0x2ae1('0x63')))_0xecab4a=_0xecab4a[_0x2ae1('0x64')](_0x2ae1('0x63'),'Queue');_0x299eb9[_0x2ae1('0x65')][_0x2ae1('0x55')](function(_0x1bc46d){_0x370769[_0x2ae1('0x66')](getAgents(_0xecab4a,_0x1bc46d));});}});return BPromise['all'](_0x370769)[_0x2ae1('0x2b')](function(_0x3dbbde){_0x14d384=_[_0x2ae1('0x62')](_0x14d384,_[_0x2ae1('0x67')](_0x3dbbde));_0x16d76f(_0x14d384);})[_0x2ae1('0x59')](function(_0x377caa){_0x58bb2c(_0x377caa);});});}function getAgents(_0x5bf861,_0x4aa292){return new BPromise(function(_0x37b3a5,_0x41eca9){return db[_0x5bf861]['findOne']({'where':{'id':_0x4aa292}})['then'](function(_0x321600){return _0x321600[_0x2ae1('0x68')]({'attributes':['id'],'raw':!![]})['then'](function(_0x417c7a){var _0x2f2df5=_['map'](_0x417c7a,'id');_0x37b3a5(_0x2f2df5);});})[_0x2ae1('0x59')](function(_0x353cac){_0x41eca9(_0x353cac);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e53e51b..38fb561 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 _0xcf1d=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x108bee,_0x2b9cab){var _0x4cd36d=function(_0x511006){while(--_0x511006){_0x108bee['push'](_0x108bee['shift']());}};_0x4cd36d(++_0x2b9cab);}(_0xcf1d,0x141));var _0xdcf1=function(_0x4f4b2b,_0x3fadff){_0x4f4b2b=_0x4f4b2b-0x0;var _0x171a9f=_0xcf1d[_0x4f4b2b];return _0x171a9f;};'use strict';var EventEmitter=require(_0xdcf1('0x0'));var UserNotification=require(_0xdcf1('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdcf1('0x2')](0x0);var events={'afterCreate':_0xdcf1('0x3'),'afterUpdate':_0xdcf1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b267c){return function(_0x27e5ba,_0x507a7d,_0x1391b5){UserNotificationEvents[_0xdcf1('0x5')](_0x3b267c+':'+_0x27e5ba['id'],_0x27e5ba);UserNotificationEvents[_0xdcf1('0x5')](_0x3b267c,_0x27e5ba);_0x1391b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xdcf1('0x6')](e,emitEvent(event));}}module[_0xdcf1('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x6ea1=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x5ad55d,_0x5eaefe){var _0x388987=function(_0x15a06b){while(--_0x15a06b){_0x5ad55d['push'](_0x5ad55d['shift']());}};_0x388987(++_0x5eaefe);}(_0x6ea1,0xd9));var _0x16ea=function(_0x10530b,_0x305795){_0x10530b=_0x10530b-0x0;var _0x37ccf7=_0x6ea1[_0x10530b];return _0x37ccf7;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x16ea('0x0'))['db'][_0x16ea('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x16ea('0x2')](0x0);var events={'afterCreate':_0x16ea('0x3'),'afterUpdate':_0x16ea('0x4'),'afterDestroy':_0x16ea('0x5')};function emitEvent(_0x3b46b7){return function(_0x4bf1b0,_0x5f3803,_0x3245bb){UserNotificationEvents[_0x16ea('0x6')](_0x3b46b7+':'+_0x4bf1b0['id'],_0x4bf1b0);UserNotificationEvents[_0x16ea('0x6')](_0x3b46b7,_0x4bf1b0);_0x3245bb(null);};}for(var e in events){if(events[_0x16ea('0x7')](e)){var event=events[e];UserNotification[_0x16ea('0x8')](e,emitEvent(event));}}module[_0x16ea('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 6f2131e..dfb0d8e 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 _0x7ab8=['bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0x7ab8,0xdc));var _0x87ab=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7ab8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x87ab('0x0'));var util=require(_0x87ab('0x1'));var logger=require(_0x87ab('0x2'))(_0x87ab('0x3'));var moment=require('moment');var BPromise=require(_0x87ab('0x4'));var rp=require(_0x87ab('0x5'));var fs=require('fs');var path=require(_0x87ab('0x6'));var rimraf=require(_0x87ab('0x7'));var config=require('../../config/environment');var attributes=require(_0x87ab('0x8'));module[_0x87ab('0x9')]=function(_0x23c577,_0x120bf9){return _0x23c577[_0x87ab('0xa')](_0x87ab('0xb'),attributes,{'tableName':_0x87ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x87ab('0xd')});}; \ No newline at end of file +var _0x0a4b=['request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x238202,_0x10da07){var _0x217367=function(_0x34f6d0){while(--_0x34f6d0){_0x238202['push'](_0x238202['shift']());}};_0x217367(++_0x10da07);}(_0x0a4b,0x168));var _0xb0a4=function(_0x4967c2,_0x545950){_0x4967c2=_0x4967c2-0x0;var _0x11746b=_0x0a4b[_0x4967c2];return _0x11746b;};'use strict';var _=require('lodash');var util=require(_0xb0a4('0x0'));var logger=require(_0xb0a4('0x1'))(_0xb0a4('0x2'));var moment=require('moment');var BPromise=require(_0xb0a4('0x3'));var rp=require(_0xb0a4('0x4'));var fs=require('fs');var path=require(_0xb0a4('0x5'));var rimraf=require(_0xb0a4('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0a4('0x7'));module[_0xb0a4('0x8')]=function(_0x1d7282,_0x3633d5){return _0x1d7282[_0xb0a4('0x9')](_0xb0a4('0xa'),attributes,{'tableName':_0xb0a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb0a4('0xc'),'collate':_0xb0a4('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d4ec88f..182be4c 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 _0xaecd=['stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x599fdc,_0x1f1138){var _0x98ea0f=function(_0x2bfd54){while(--_0x2bfd54){_0x599fdc['push'](_0x599fdc['shift']());}};_0x98ea0f(++_0x1f1138);}(_0xaecd,0xfb));var _0xdaec=function(_0x4b02fc,_0x17a652){_0x4b02fc=_0x4b02fc-0x0;var _0x5224a2=_0xaecd[_0x4b02fc];return _0x5224a2;};'use strict';var _=require(_0xdaec('0x0'));var util=require(_0xdaec('0x1'));var moment=require(_0xdaec('0x2'));var BPromise=require(_0xdaec('0x3'));var rs=require(_0xdaec('0x4'));var fs=require('fs');var Redis=require(_0xdaec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdaec('0x6'));var logger=require(_0xdaec('0x7'))(_0xdaec('0x8'));var config=require('../../config/environment');var jayson=require(_0xdaec('0x9'));var client=jayson[_0xdaec('0xa')][_0xdaec('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdaec('0xc')],{'host':_0xdaec('0xd'),'port':0x18eb});var socket=require(_0xdaec('0xe'))(new Redis(config[_0xdaec('0xc')]));require('./userNotification.socket')[_0xdaec('0xf')](socket);function respondWithRpcPromise(_0x3e57e0,_0x3c9786,_0x36345d){return new BPromise(function(_0x3b0fec,_0x3c838d){return client['request'](_0x3e57e0,_0x36345d)[_0xdaec('0x10')](function(_0x5e6afe){logger['info']('UserNotification,\x20%s,\x20%s',_0x3c9786,'request\x20sent');logger[_0xdaec('0x11')](_0xdaec('0x12'),_0x3c9786,'request\x20sent',JSON[_0xdaec('0x13')](_0x5e6afe));if(_0x5e6afe[_0xdaec('0x14')]){if(_0x5e6afe['error'][_0xdaec('0x15')]===0x1f4){logger['error'](_0xdaec('0x16'),_0x3c9786,_0x5e6afe[_0xdaec('0x14')][_0xdaec('0x17')]);return _0x3c838d(_0x5e6afe[_0xdaec('0x14')][_0xdaec('0x17')]);}logger[_0xdaec('0x14')](_0xdaec('0x16'),_0x3c9786,_0x5e6afe[_0xdaec('0x14')][_0xdaec('0x17')]);return _0x3b0fec(_0x5e6afe[_0xdaec('0x14')][_0xdaec('0x17')]);}else{logger[_0xdaec('0x18')](_0xdaec('0x16'),_0x3c9786,_0xdaec('0x19'));_0x3b0fec(_0x5e6afe[_0xdaec('0x1a')][_0xdaec('0x17')]);}})['catch'](function(_0x4ec047){logger[_0xdaec('0x14')](_0xdaec('0x16'),_0x3c9786,_0x4ec047);_0x3c838d(_0x4ec047);});});} \ No newline at end of file +var _0xba73=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x1aaa00,_0x245138){var _0x4be822=function(_0x249c61){while(--_0x249c61){_0x1aaa00['push'](_0x1aaa00['shift']());}};_0x4be822(++_0x245138);}(_0xba73,0x1ab));var _0x3ba7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xba73[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3ba7('0x0'));var util=require(_0x3ba7('0x1'));var moment=require(_0x3ba7('0x2'));var BPromise=require(_0x3ba7('0x3'));var rs=require(_0x3ba7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ba7('0x5'))['db'];var utils=require(_0x3ba7('0x6'));var logger=require(_0x3ba7('0x7'))('rpc');var config=require(_0x3ba7('0x8'));var jayson=require(_0x3ba7('0x9'));var client=jayson[_0x3ba7('0xa')][_0x3ba7('0xb')]({'port':0x232a});config[_0x3ba7('0xc')]=_[_0x3ba7('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ba7('0xe'))(new Redis(config[_0x3ba7('0xc')]));require('./userNotification.socket')[_0x3ba7('0xf')](socket);function respondWithRpcPromise(_0x29f385,_0x4d14fa,_0xa21dfd){return new BPromise(function(_0x551569,_0x2def1a){return client[_0x3ba7('0x10')](_0x29f385,_0xa21dfd)[_0x3ba7('0x11')](function(_0x1fbb75){logger[_0x3ba7('0x12')](_0x3ba7('0x13'),_0x4d14fa,_0x3ba7('0x14'));logger['debug'](_0x3ba7('0x15'),_0x4d14fa,_0x3ba7('0x14'),JSON[_0x3ba7('0x16')](_0x1fbb75));if(_0x1fbb75['error']){if(_0x1fbb75['error'][_0x3ba7('0x17')]===0x1f4){logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x1fbb75[_0x3ba7('0x18')]['message']);return _0x2def1a(_0x1fbb75[_0x3ba7('0x18')]['message']);}logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x1fbb75[_0x3ba7('0x18')][_0x3ba7('0x19')]);return _0x551569(_0x1fbb75[_0x3ba7('0x18')][_0x3ba7('0x19')]);}else{logger[_0x3ba7('0x12')](_0x3ba7('0x13'),_0x4d14fa,_0x3ba7('0x14'));_0x551569(_0x1fbb75[_0x3ba7('0x1a')]['message']);}})[_0x3ba7('0x1b')](function(_0x343cae){logger[_0x3ba7('0x18')](_0x3ba7('0x13'),_0x4d14fa,_0x343cae);_0x2def1a(_0x343cae);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d6a715e..c450f0e 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 _0x2de7=['remove','update','register','length','userNotification:'];(function(_0x9e0772,_0x360f25){var _0x3c5980=function(_0xe9438a){while(--_0xe9438a){_0x9e0772['push'](_0x9e0772['shift']());}};_0x3c5980(++_0x360f25);}(_0x2de7,0x12c));var _0x72de=function(_0x47ce2e,_0x4c509a){_0x47ce2e=_0x47ce2e-0x0;var _0x15116a=_0x2de7[_0x47ce2e];return _0x15116a;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0x72de('0x0'),_0x72de('0x1')];function createListener(_0x352449,_0x49f7f0){return function(_0x22c2c2){_0x49f7f0['emit'](_0x352449,_0x22c2c2);};}function removeListener(_0x5e105f,_0x3bb7c2){return function(){UserNotificationEvents['removeListener'](_0x5e105f,_0x3bb7c2);};}exports[_0x72de('0x2')]=function(_0x387803){for(var _0x59b913=0x0,_0x30691c=events[_0x72de('0x3')];_0x59b913<_0x30691c;_0x59b913++){var _0x127552=events[_0x59b913];var _0x4b2fc7=createListener(_0x72de('0x4')+_0x127552,_0x387803);UserNotificationEvents['on'](_0x127552,_0x4b2fc7);}}; \ No newline at end of file +var _0xb183=['./userNotification.events','save','remove','update','emit','removeListener','register','userNotification:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb183,0x1e8));var _0x3b18=function(_0x238f63,_0x14a6b4){_0x238f63=_0x238f63-0x0;var _0x25aa75=_0xb183[_0x238f63];return _0x25aa75;};'use strict';var UserNotificationEvents=require(_0x3b18('0x0'));var events=[_0x3b18('0x1'),_0x3b18('0x2'),_0x3b18('0x3')];function createListener(_0x3f8cc5,_0x56685e){return function(_0x2f684a){_0x56685e[_0x3b18('0x4')](_0x3f8cc5,_0x2f684a);};}function removeListener(_0x90821b,_0x2a8831){return function(){UserNotificationEvents[_0x3b18('0x5')](_0x90821b,_0x2a8831);};}exports[_0x3b18('0x6')]=function(_0x521783){for(var _0x21a1f0=0x0,_0x6132ec=events['length'];_0x21a1f0<_0x6132ec;_0x21a1f0++){var _0x11914e=events[_0x21a1f0];var _0x103042=createListener(_0x3b18('0x7')+_0x11914e,_0x521783);UserNotificationEvents['on'](_0x11914e,_0x103042);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4265d88..c2640bc 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x344be0,_0x475e6d){var _0x5a5bb8=function(_0x41bc3b){while(--_0x41bc3b){_0x344be0['push'](_0x344be0['shift']());}};_0x5a5bb8(++_0x475e6d);}(_0xe706,0xa3));var _0x6e70=function(_0x475b7d,_0x3e1f95){_0x475b7d=_0x475b7d-0x0;var _0x2ad527=_0xe706[_0x475b7d];return _0x2ad527;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2068bb,_0xe39035){var _0x476332=function(_0x19dfb1){while(--_0x19dfb1){_0x2068bb['push'](_0x2068bb['shift']());}};_0x476332(++_0xe39035);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcb91[_0xa8883];return _0x479426;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 79b365f..a49a8d3 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 _0x8994=['INTEGER','sequelize','exports'];(function(_0x174216,_0x21a850){var _0x48fce0=function(_0xd6a022){while(--_0xd6a022){_0x174216['push'](_0x174216['shift']());}};_0x48fce0(++_0x21a850);}(_0x8994,0x16f));var _0x4899=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x8994[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0x4899('0x0'));module[_0x4899('0x1')]={'penalty':{'type':Sequelize[_0x4899('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20ad=['exports','INTEGER','sequelize'];(function(_0x28a4d8,_0x284459){var _0x5d53a5=function(_0x186c23){while(--_0x186c23){_0x28a4d8['push'](_0x28a4d8['shift']());}};_0x5d53a5(++_0x284459);}(_0x20ad,0x13a));var _0xd20a=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x20ad[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xd20a('0x0'));module[_0xd20a('0x1')]={'penalty':{'type':Sequelize[_0xd20a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 6747a6f..71c11de 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 _0xbd9e=['../../config/logger','path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd9e,0x15c));var _0xebd9=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xbd9e[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xebd9('0x0'));var util=require(_0xebd9('0x1'));var logger=require(_0xebd9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xebd9('0x3'));var rimraf=require(_0xebd9('0x4'));var config=require(_0xebd9('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xebd9('0x6')]=function(_0x26ce6d,_0x1c1ab3){return _0x26ce6d[_0xebd9('0x7')](_0xebd9('0x8'),attributes,{'tableName':_0xebd9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68c4=['path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c4,0x1ab));var _0x468c=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0x68c4[_0x214d54];return _0x44ca46;};'use strict';var _=require(_0x468c('0x0'));var util=require(_0x468c('0x1'));var logger=require(_0x468c('0x2'))(_0x468c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x468c('0x4'));var fs=require('fs');var path=require(_0x468c('0x5'));var rimraf=require(_0x468c('0x6'));var config=require('../../config/environment');var attributes=require(_0x468c('0x7'));module[_0x468c('0x8')]=function(_0x652dfd,_0x467542){return _0x652dfd[_0x468c('0x9')](_0x468c('0xa'),attributes,{'tableName':_0x468c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5c044ee..acbb3a1 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 _0x45f7=['http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x34d701,_0xa3bd65){var _0x1b9d6c=function(_0x586a53){while(--_0x586a53){_0x34d701['push'](_0x34d701['shift']());}};_0x1b9d6c(++_0xa3bd65);}(_0x45f7,0x1c4));var _0x745f=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x45f7[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x745f('0x0'));var util=require(_0x745f('0x1'));var moment=require(_0x745f('0x2'));var BPromise=require(_0x745f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x745f('0x4'));var db=require(_0x745f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x745f('0x6'))(_0x745f('0x7'));var config=require(_0x745f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x745f('0x9')][_0x745f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39fce6,_0x4ff3cc,_0x391978){return new BPromise(function(_0x4b356a,_0x4f08f3){return client['request'](_0x39fce6,_0x391978)[_0x745f('0xb')](function(_0x244e48){logger[_0x745f('0xc')](_0x745f('0xd'),_0x4ff3cc,_0x745f('0xe'));logger[_0x745f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ff3cc,_0x745f('0xe'),JSON[_0x745f('0x10')](_0x244e48));if(_0x244e48[_0x745f('0x11')]){if(_0x244e48[_0x745f('0x11')][_0x745f('0x12')]===0x1f4){logger['error'](_0x745f('0xd'),_0x4ff3cc,_0x244e48[_0x745f('0x11')]['message']);return _0x4f08f3(_0x244e48[_0x745f('0x11')][_0x745f('0x13')]);}logger[_0x745f('0x11')](_0x745f('0xd'),_0x4ff3cc,_0x244e48[_0x745f('0x11')][_0x745f('0x13')]);return _0x4b356a(_0x244e48[_0x745f('0x11')][_0x745f('0x13')]);}else{logger[_0x745f('0xc')](_0x745f('0xd'),_0x4ff3cc,'request\x20sent');_0x4b356a(_0x244e48['result'][_0x745f('0x13')]);}})[_0x745f('0x14')](function(_0x161566){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4ff3cc,_0x161566);_0x4f08f3(_0x161566);});});} \ No newline at end of file +var _0xd988=['result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3425d1,_0x46945d){var _0x58adee=function(_0x115ca2){while(--_0x115ca2){_0x3425d1['push'](_0x3425d1['shift']());}};_0x58adee(++_0x46945d);}(_0xd988,0x17d));var _0x8d98=function(_0x5af4d2,_0x5f372a){_0x5af4d2=_0x5af4d2-0x0;var _0x3edf6a=_0xd988[_0x5af4d2];return _0x3edf6a;};'use strict';var _=require('lodash');var util=require(_0x8d98('0x0'));var moment=require('moment');var BPromise=require(_0x8d98('0x1'));var rs=require(_0x8d98('0x2'));var fs=require('fs');var Redis=require(_0x8d98('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d98('0x4'));var logger=require(_0x8d98('0x5'))(_0x8d98('0x6'));var config=require(_0x8d98('0x7'));var jayson=require(_0x8d98('0x8'));var client=jayson['client'][_0x8d98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bd42c,_0x475c74,_0x361664){return new BPromise(function(_0x114c53,_0x1d5e61){return client[_0x8d98('0xa')](_0x1bd42c,_0x361664)[_0x8d98('0xb')](function(_0x415065){logger[_0x8d98('0xc')](_0x8d98('0xd'),_0x475c74,_0x8d98('0xe'));logger[_0x8d98('0xf')](_0x8d98('0x10'),_0x475c74,'request\x20sent',JSON['stringify'](_0x415065));if(_0x415065['error']){if(_0x415065[_0x8d98('0x11')]['code']===0x1f4){logger['error'](_0x8d98('0xd'),_0x475c74,_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);return _0x1d5e61(_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);}logger['error'](_0x8d98('0xd'),_0x475c74,_0x415065['error'][_0x8d98('0x12')]);return _0x114c53(_0x415065[_0x8d98('0x11')][_0x8d98('0x12')]);}else{logger['info'](_0x8d98('0xd'),_0x475c74,_0x8d98('0xe'));_0x114c53(_0x415065[_0x8d98('0x13')]['message']);}})['catch'](function(_0x3199b6){logger[_0x8d98('0x11')](_0x8d98('0xd'),_0x475c74,_0x3199b6);_0x1d5e61(_0x3199b6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4c0beeb..741dbaf 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 _0xbf8d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addResources','put','update','delete','removeSections','removeResources','exports','util'];(function(_0x35dc4e,_0x41bcb9){var _0x24b54d=function(_0x5af23c){while(--_0x5af23c){_0x35dc4e['push'](_0x35dc4e['shift']());}};_0x24b54d(++_0x41bcb9);}(_0xbf8d,0x117));var _0xdbf8=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0xbf8d[_0x52cbe2];return _0x277141;};'use strict';var multer=require('multer');var util=require(_0xdbf8('0x0'));var path=require(_0xdbf8('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbf8('0x2'));var router=express[_0xdbf8('0x3')]();var fs_extra=require(_0xdbf8('0x4'));var auth=require(_0xdbf8('0x5'));var interaction=require(_0xdbf8('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xdbf8('0x7')]('/',auth['isAuthenticated'](),controller[_0xdbf8('0x8')]);router[_0xdbf8('0x7')]('/describe',auth[_0xdbf8('0x9')](),controller[_0xdbf8('0xa')]);router['get'](_0xdbf8('0xb'),auth[_0xdbf8('0x9')](),controller[_0xdbf8('0xc')]);router['get']('/:id/sections',auth[_0xdbf8('0x9')](),controller[_0xdbf8('0xd')]);router[_0xdbf8('0x7')](_0xdbf8('0xe'),auth[_0xdbf8('0x9')](),controller[_0xdbf8('0xf')]);router[_0xdbf8('0x10')]('/',auth[_0xdbf8('0x9')](),controller[_0xdbf8('0x11')]);router[_0xdbf8('0x10')](_0xdbf8('0x12'),auth['isAuthenticated'](),controller[_0xdbf8('0x13')]);router[_0xdbf8('0x10')](_0xdbf8('0x14'),auth['isAuthenticated'](),controller['addSections']);router[_0xdbf8('0x10')]('/:id/resources',auth[_0xdbf8('0x9')](),controller[_0xdbf8('0x15')]);router[_0xdbf8('0x16')](_0xdbf8('0xb'),auth[_0xdbf8('0x9')](),controller[_0xdbf8('0x17')]);router[_0xdbf8('0x18')](_0xdbf8('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xdbf8('0x18')](_0xdbf8('0x14'),auth[_0xdbf8('0x9')](),controller[_0xdbf8('0x19')]);router[_0xdbf8('0x18')](_0xdbf8('0xe'),auth['isAuthenticated'](),controller[_0xdbf8('0x1a')]);module[_0xdbf8('0x1b')]=router; \ No newline at end of file +var _0x9c91=['get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','destroy','delete','/:id/sections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller'];(function(_0x129b2c,_0x2bcd57){var _0x5ac558=function(_0x531f54){while(--_0x531f54){_0x129b2c['push'](_0x129b2c['shift']());}};_0x5ac558(++_0x2bcd57);}(_0x9c91,0x153));var _0x19c9=function(_0x22dcdb,_0x46bac5){_0x22dcdb=_0x22dcdb-0x0;var _0x1c96f5=_0x9c91[_0x22dcdb];return _0x1c96f5;};'use strict';var multer=require(_0x19c9('0x0'));var util=require(_0x19c9('0x1'));var path=require(_0x19c9('0x2'));var timeout=require(_0x19c9('0x3'));var express=require(_0x19c9('0x4'));var router=express[_0x19c9('0x5')]();var fs_extra=require(_0x19c9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19c9('0x7'));var controller=require(_0x19c9('0x8'));router[_0x19c9('0x9')]('/',auth[_0x19c9('0xa')](),controller[_0x19c9('0xb')]);router[_0x19c9('0x9')](_0x19c9('0xc'),auth[_0x19c9('0xa')](),controller[_0x19c9('0xd')]);router['get'](_0x19c9('0xe'),auth['isAuthenticated'](),controller[_0x19c9('0xf')]);router[_0x19c9('0x9')]('/:id/sections',auth[_0x19c9('0xa')](),controller[_0x19c9('0x10')]);router[_0x19c9('0x9')](_0x19c9('0x11'),auth['isAuthenticated'](),controller[_0x19c9('0x12')]);router[_0x19c9('0x13')]('/',auth[_0x19c9('0xa')](),controller[_0x19c9('0x14')]);router[_0x19c9('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0x19c9('0x15')]);router[_0x19c9('0x13')]('/:id/sections',auth[_0x19c9('0xa')](),controller[_0x19c9('0x16')]);router[_0x19c9('0x13')](_0x19c9('0x11'),auth[_0x19c9('0xa')](),controller[_0x19c9('0x17')]);router['put'](_0x19c9('0xe'),auth[_0x19c9('0xa')](),controller['update']);router['delete'](_0x19c9('0xe'),auth['isAuthenticated'](),controller[_0x19c9('0x18')]);router[_0x19c9('0x19')](_0x19c9('0x1a'),auth[_0x19c9('0xa')](),controller['removeSections']);router[_0x19c9('0x19')](_0x19c9('0x11'),auth[_0x19c9('0xa')](),controller[_0x19c9('0x1b')]);module[_0x19c9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f1f17cd..e66a20f 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 _0x94fd=['STRING','name','setDataValue','crudPermissions','join','split','BOOLEAN','sequelize','exports'];(function(_0x3be308,_0x276299){var _0x441e71=function(_0x1301c3){while(--_0x1301c3){_0x3be308['push'](_0x3be308['shift']());}};_0x441e71(++_0x276299);}(_0x94fd,0x181));var _0xd94f=function(_0x221917,_0x3325ac){_0x221917=_0x221917-0x0;var _0x3d3c2f=_0x94fd[_0x221917];return _0x3d3c2f;};'use strict';var Sequelize=require(_0xd94f('0x0'));module[_0xd94f('0x1')]={'name':{'type':Sequelize[_0xd94f('0x2')],'allowNull':![],'unique':_0xd94f('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x24e500){this[_0xd94f('0x4')](_0xd94f('0x5'),_0x24e500?_0x24e500[_0xd94f('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xd94f('0x5'))?this['getDataValue'](_0xd94f('0x5'))[_0xd94f('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd94f('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd94f('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd94f('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd94f('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xccde=['STRING','name','setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xccde,0x18f));var _0xeccd=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0xccde[_0x34bc94];return _0xee41e7;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![],'unique':_0xeccd('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xecb04b){this[_0xeccd('0x3')]('crudPermissions',_0xecb04b?_0xecb04b[_0xeccd('0x4')](''):[]);},'get':function(){return this[_0xeccd('0x5')](_0xeccd('0x6'))?this[_0xeccd('0x5')](_0xeccd('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xeccd('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xeccd('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 46205b0..68dcff0 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 _0xc126=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','updatedAt','Resources','UserProfileResource','describe','destroy','sectionId','userProfileId','each','push','removeSections','ids','getSections','isEmpty','includes','subsections','concat','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key'];(function(_0x38a212,_0x2590a0){var _0x698015=function(_0xb93a18){while(--_0xb93a18){_0x38a212['push'](_0x38a212['shift']());}};_0x698015(++_0x2590a0);}(_0xc126,0x125));var _0x6c12=function(_0x3a0e4e,_0x597be9){_0x3a0e4e=_0x3a0e4e-0x0;var _0x1443dd=_0xc126[_0x3a0e4e];return _0x1443dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6c12('0x0'));var jsonpatch=require(_0x6c12('0x1'));var rp=require('request-promise');var moment=require(_0x6c12('0x2'));var BPromise=require(_0x6c12('0x3'));var Mustache=require(_0x6c12('0x4'));var util=require(_0x6c12('0x5'));var path=require(_0x6c12('0x6'));var sox=require(_0x6c12('0x7'));var csv=require(_0x6c12('0x8'));var ejs=require(_0x6c12('0x9'));var fs=require('fs');var fs_extra=require(_0x6c12('0xa'));var _=require(_0x6c12('0xb'));var squel=require('squel');var crypto=require(_0x6c12('0xc'));var jsforce=require(_0x6c12('0xd'));var deskjs=require(_0x6c12('0xe'));var toCsv=require(_0x6c12('0x8'));var querystring=require(_0x6c12('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c12('0x10'));var as=require(_0x6c12('0x11'));var hardwareService=require(_0x6c12('0x12'));var logger=require(_0x6c12('0x13'))(_0x6c12('0x14'));var utils=require('../../config/utils');var config=require(_0x6c12('0x15'));var licenseUtil=require(_0x6c12('0x16'));var db=require(_0x6c12('0x17'))['db'];config[_0x6c12('0x18')]=_[_0x6c12('0x19')](config[_0x6c12('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c12('0x1a'))(new Redis(config[_0x6c12('0x18')]));require(_0x6c12('0x1b'))[_0x6c12('0x1c')](socket);function respondWithStatusCode(_0x2a87ea,_0x3120b8){_0x3120b8=_0x3120b8||0xcc;return function(_0x43b218){if(_0x43b218){return _0x2a87ea[_0x6c12('0x1d')](_0x3120b8);}return _0x2a87ea[_0x6c12('0x1e')](_0x3120b8)[_0x6c12('0x1f')]();};}function respondWithResult(_0x4a681f,_0x32a3f5){_0x32a3f5=_0x32a3f5||0xc8;return function(_0x366b01){if(_0x366b01){return _0x4a681f['status'](_0x32a3f5)[_0x6c12('0x20')](_0x366b01);}};}function respondWithFilteredResult(_0x14dec8,_0x448bb4){return function(_0x4a8027){if(_0x4a8027){var _0x1ef87c=typeof _0x448bb4['offset']===_0x6c12('0x21')&&typeof _0x448bb4[_0x6c12('0x22')]==='undefined';var _0x3f7db3=_0x4a8027[_0x6c12('0x23')];var _0x200b20=_0x1ef87c?0x0:_0x448bb4[_0x6c12('0x24')];var _0x1b81aa=_0x1ef87c?_0x4a8027['count']:_0x448bb4[_0x6c12('0x24')]+_0x448bb4[_0x6c12('0x22')];var _0x31298c;if(_0x1b81aa>=_0x3f7db3){_0x1b81aa=_0x3f7db3;_0x31298c=0xc8;}else{_0x31298c=0xce;}_0x14dec8[_0x6c12('0x1e')](_0x31298c);return _0x14dec8[_0x6c12('0x25')](_0x6c12('0x26'),_0x200b20+'-'+_0x1b81aa+'/'+_0x3f7db3)[_0x6c12('0x20')](_0x4a8027);}return null;};}function patchUpdates(_0x2d8b16){return function(_0x4046b1){try{jsonpatch[_0x6c12('0x27')](_0x4046b1,_0x2d8b16,!![]);}catch(_0x2338a5){return BPromise['reject'](_0x2338a5);}return _0x4046b1[_0x6c12('0x28')]();};}function saveUpdates(_0x430dec,_0x594b45){return function(_0x17682c){if(_0x17682c){return _0x17682c[_0x6c12('0x29')](_0x430dec)[_0x6c12('0x2a')](function(_0x18a786){return _0x18a786;});}return null;};}function removeEntity(_0xac892d,_0x3879bf){return function(_0x56e829){if(_0x56e829){return _0x56e829['destroy']()['then'](function(){_0xac892d[_0x6c12('0x1e')](0xcc)[_0x6c12('0x1f')]();});}};}function handleEntityNotFound(_0x3a79e7,_0x2182d9){return function(_0xd117b9){if(!_0xd117b9){_0x3a79e7['sendStatus'](0x194);}return _0xd117b9;};}function handleError(_0x5cdd0e,_0x15ea6c){_0x15ea6c=_0x15ea6c||0x1f4;return function(_0x13d4c0){logger['error'](_0x13d4c0[_0x6c12('0x2b')]);if(_0x13d4c0[_0x6c12('0x2c')]){delete _0x13d4c0[_0x6c12('0x2c')];}_0x5cdd0e[_0x6c12('0x1e')](_0x15ea6c)[_0x6c12('0x2d')](_0x13d4c0);};}exports['index']=function(_0x4303b7,_0x316022){var _0x473893={},_0xb2b0e5={},_0x3ffb6f={'count':0x0,'rows':[]};var _0x58e2f2=_[_0x6c12('0x2e')](db[_0x6c12('0x2f')][_0x6c12('0x30')],function(_0x3d3c0e){return{'name':_0x3d3c0e[_0x6c12('0x31')],'type':_0x3d3c0e[_0x6c12('0x32')][_0x6c12('0x33')]};});_0xb2b0e5[_0x6c12('0x34')]=_[_0x6c12('0x2e')](_0x58e2f2,_0x6c12('0x2c'));_0xb2b0e5[_0x6c12('0x35')]=_[_0x6c12('0x36')](_0x4303b7[_0x6c12('0x35')]);_0xb2b0e5['filters']=_[_0x6c12('0x37')](_0xb2b0e5[_0x6c12('0x34')],_0xb2b0e5[_0x6c12('0x35')]);_0x473893[_0x6c12('0x38')]=_['intersection'](_0xb2b0e5[_0x6c12('0x34')],qs[_0x6c12('0x39')](_0x4303b7[_0x6c12('0x35')][_0x6c12('0x39')]));_0x473893['attributes']=_0x473893[_0x6c12('0x38')]['length']?_0x473893[_0x6c12('0x38')]:_0xb2b0e5[_0x6c12('0x34')];if(!_0x4303b7[_0x6c12('0x35')][_0x6c12('0x3a')](_0x6c12('0x3b'))){_0x473893['limit']=qs[_0x6c12('0x22')](_0x4303b7[_0x6c12('0x35')]['limit']);_0x473893[_0x6c12('0x24')]=qs[_0x6c12('0x24')](_0x4303b7[_0x6c12('0x35')][_0x6c12('0x24')]);}_0x473893[_0x6c12('0x3c')]=qs[_0x6c12('0x3d')](_0x4303b7[_0x6c12('0x35')][_0x6c12('0x3d')]);_0x473893[_0x6c12('0x3e')]=qs['filters'](_[_0x6c12('0x3f')](_0x4303b7['query'],_0xb2b0e5[_0x6c12('0x40')]),_0x58e2f2);if(_0x4303b7[_0x6c12('0x35')][_0x6c12('0x41')]){_0x473893['where']=_[_0x6c12('0x42')](_0x473893[_0x6c12('0x3e')],{'$or':_[_0x6c12('0x2e')](_0x58e2f2,function(_0x3506f5){if(_0x3506f5[_0x6c12('0x32')]!=='VIRTUAL'){var _0x1a2441={};_0x1a2441[_0x3506f5[_0x6c12('0x2c')]]={'$like':'%'+_0x4303b7[_0x6c12('0x35')][_0x6c12('0x41')]+'%'};return _0x1a2441;}})});}_0x473893=_[_0x6c12('0x42')]({},_0x473893,_0x4303b7['options']);var _0x16d326={'where':_0x473893[_0x6c12('0x3e')]};return db[_0x6c12('0x2f')]['count'](_0x16d326)['then'](function(_0x449dcb){_0x3ffb6f[_0x6c12('0x23')]=_0x449dcb;if(_0x4303b7[_0x6c12('0x35')][_0x6c12('0x43')]){_0x473893[_0x6c12('0x44')]=[{'all':!![]}];}return db[_0x6c12('0x2f')][_0x6c12('0x45')](_0x473893);})[_0x6c12('0x2a')](function(_0x418b5f){_0x3ffb6f[_0x6c12('0x46')]=_0x418b5f;return _0x3ffb6f;})[_0x6c12('0x2a')](respondWithFilteredResult(_0x316022,_0x473893))[_0x6c12('0x47')](handleError(_0x316022,null));};exports['show']=function(_0x32dd07,_0x46befc){var _0x152cf3={'raw':![],'where':{'id':_0x32dd07[_0x6c12('0x48')]['id']}},_0x3ae679={};_0x3ae679['model']=_['keys'](db[_0x6c12('0x2f')]['rawAttributes']);_0x3ae679[_0x6c12('0x35')]=_[_0x6c12('0x36')](_0x32dd07[_0x6c12('0x35')]);_0x3ae679[_0x6c12('0x40')]=_['intersection'](_0x3ae679[_0x6c12('0x34')],_0x3ae679[_0x6c12('0x35')]);_0x152cf3[_0x6c12('0x38')]=_[_0x6c12('0x37')](_0x3ae679[_0x6c12('0x34')],qs['fields'](_0x32dd07[_0x6c12('0x35')][_0x6c12('0x39')]));_0x152cf3['attributes']=_0x152cf3['attributes'][_0x6c12('0x49')]?_0x152cf3[_0x6c12('0x38')]:_0x3ae679[_0x6c12('0x34')];if(_0x32dd07[_0x6c12('0x35')][_0x6c12('0x43')]){_0x152cf3[_0x6c12('0x44')]=[{'all':!![]}];}_0x152cf3=_[_0x6c12('0x42')]({},_0x152cf3,_0x32dd07[_0x6c12('0x4a')]);return db['UserProfile'][_0x6c12('0x4b')](_0x152cf3)[_0x6c12('0x2a')](handleEntityNotFound(_0x46befc,null))[_0x6c12('0x2a')](respondWithResult(_0x46befc,null))['catch'](handleError(_0x46befc,null));};exports[_0x6c12('0x4c')]=function(_0x38b113,_0x273500){return db[_0x6c12('0x2f')][_0x6c12('0x4c')](_0x38b113[_0x6c12('0x4d')],{})['then'](respondWithResult(_0x273500,0xc9))[_0x6c12('0x47')](handleError(_0x273500,null));};exports[_0x6c12('0x4e')]=function(_0x11bcf8,_0x5de901){var _0x4a17dd={'where':{'id':_0x11bcf8[_0x6c12('0x48')]['id']}},_0x44bbba={};_0x44bbba[_0x6c12('0x34')]=_[_0x6c12('0x36')](db[_0x6c12('0x2f')]['rawAttributes']);_0x4a17dd['attributes']=_[_0x6c12('0x37')](_0x44bbba['model'],qs['fields'](_0x11bcf8[_0x6c12('0x35')][_0x6c12('0x39')]));_0x4a17dd[_0x6c12('0x38')]=_0x4a17dd[_0x6c12('0x38')][_0x6c12('0x49')]?_0x4a17dd['attributes']:_0x44bbba[_0x6c12('0x34')];if(_0x11bcf8[_0x6c12('0x35')][_0x6c12('0x43')]){_0x4a17dd[_0x6c12('0x44')]=[{'all':!![]}];}_0x4a17dd=_[_0x6c12('0x42')]({},_0x4a17dd,_0x11bcf8[_0x6c12('0x4a')]);return db[_0x6c12('0x2f')][_0x6c12('0x4b')](_0x4a17dd)[_0x6c12('0x2a')](handleEntityNotFound(_0x5de901,null))['then'](function(_0x198887){if(_0x198887){var _0xf6c4d0=_0x198887[_0x6c12('0x4f')]({'plain':!![]});_0xf6c4d0=qs[_0x6c12('0x50')](_0xf6c4d0,['id',_0x6c12('0x51'),'updatedAt',_0x6c12('0x52')]);_0x11bcf8[_0x6c12('0x4d')]=_['omit'](_0x11bcf8['body'],['id',_0x6c12('0x51'),'updatedAt']);return db[_0x6c12('0x53')][_0x6c12('0x54')](function(_0x1537f1){return db[_0x6c12('0x2f')][_0x6c12('0x4c')](_[_0x6c12('0x42')](_0xf6c4d0,_0x11bcf8[_0x6c12('0x4d')]),{'include':_0x11bcf8[_0x6c12('0x35')][_0x6c12('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x1537f1})[_0x6c12('0x2a')](function(_0x44b070){var _0xdef665=_0x44b070[_0x6c12('0x4f')]({'plain':!![]});return db[_0x6c12('0x55')]['findAll']({'where':{'userProfileId':_0x11bcf8['params']['id']},'raw':!![]})['then'](function(_0x32940e){if(_0x32940e){return BPromise['each'](_0x32940e,function(_0x5d163c){return new BPromise(function(_0x3af33b,_0x4a6df8){if(_0x5d163c[_0x6c12('0x56')]===null||_0x5d163c[_0x6c12('0x56')]===0x1)_0x3af33b(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5d163c['id']},'raw':!![]})['then'](function(_0xb5ae2f){var _0x5ab72a=_[_0x6c12('0x2e')](_0xb5ae2f,function(_0x18759f){return qs['omit'](_0x18759f,['id',_0x6c12('0x51'),_0x6c12('0x57'),'sectionId']);});_0x3af33b(_0x5ab72a);})[_0x6c12('0x47')](function(_0xdc94bb){_0x4a6df8(_0xdc94bb);});})[_0x6c12('0x2a')](function(_0x4d2c2a){var _0x307200=qs[_0x6c12('0x50')](_0x5d163c,['id',_0x6c12('0x51'),_0x6c12('0x57')]);_0x307200['userProfileId']=_0xdef665['id'];if(_0x4d2c2a)_0x307200[_0x6c12('0x58')]=_0x4d2c2a;return _0x307200;})['then'](function(_0x28be40){return db[_0x6c12('0x55')][_0x6c12('0x4c')](_0x28be40,{'include':[{'model':db[_0x6c12('0x59')],'as':_0x6c12('0x58')}],'raw':!![],'transaction':_0x1537f1});});})[_0x6c12('0x2a')](function(){return _0xdef665;});}});});});}})[_0x6c12('0x2a')](respondWithResult(_0x5de901,0xc9))[_0x6c12('0x47')](handleError(_0x5de901,null));};exports[_0x6c12('0x29')]=function(_0x4f4d2e,_0x26de02){if(_0x4f4d2e[_0x6c12('0x4d')]['id']){delete _0x4f4d2e[_0x6c12('0x4d')]['id'];}return db[_0x6c12('0x2f')]['find']({'where':{'id':_0x4f4d2e[_0x6c12('0x48')]['id']}})[_0x6c12('0x2a')](handleEntityNotFound(_0x26de02,null))[_0x6c12('0x2a')](saveUpdates(_0x4f4d2e['body'],null))['then'](respondWithResult(_0x26de02,null))[_0x6c12('0x47')](handleError(_0x26de02,null));};exports['destroy']=function(_0x31d846,_0x3d4529){return db[_0x6c12('0x2f')][_0x6c12('0x4b')]({'where':{'id':_0x31d846[_0x6c12('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d4529,null))['then'](removeEntity(_0x3d4529,null))['catch'](handleError(_0x3d4529,null));};exports[_0x6c12('0x5a')]=function(_0x55adee,_0x394e93){return db['UserProfile']['describe']()['then'](respondWithResult(_0x394e93,null))[_0x6c12('0x47')](handleError(_0x394e93,null));};exports['addSections']=function(_0x1e7b5e,_0x4c38ed){var _0x1c6584=_0x1e7b5e[_0x6c12('0x4d')];return db['UserProfile'][_0x6c12('0x4b')]({'where':{'id':_0x1e7b5e[_0x6c12('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c38ed,null))[_0x6c12('0x2a')](function(_0x54c7ef){if(_0x54c7ef){return db[_0x6c12('0x53')]['transaction'](function(_0x40176c){return db[_0x6c12('0x55')][_0x6c12('0x5b')]({'where':{'userProfileId':_0x1e7b5e['params']['id'],'sectionId':_[_0x6c12('0x2e')](_0x1c6584,function(_0x1b9903){return _0x1b9903[_0x6c12('0x5c')];})},'transaction':_0x40176c})[_0x6c12('0x2a')](function(){var _0x5b79ac=_[_0x6c12('0x2e')](_0x1c6584,function(_0x1e75d2){_0x1e75d2[_0x6c12('0x5d')]=_0x1e7b5e[_0x6c12('0x48')]['id'];return _0x1e75d2;});var _0x54e9ef=[];return BPromise[_0x6c12('0x5e')](_0x5b79ac,function(_0x2801e4){return db[_0x6c12('0x55')][_0x6c12('0x4c')](_0x2801e4,{'include':[{'model':db[_0x6c12('0x59')],'as':_0x6c12('0x58')}],'raw':!![],'transaction':_0x40176c})[_0x6c12('0x2a')](function(_0x42a565){_0x54e9ef[_0x6c12('0x5f')](_0x42a565[_0x6c12('0x4f')]({'plain':!![]}));});})[_0x6c12('0x2a')](function(){return _0x54e9ef;});});});}})[_0x6c12('0x2a')](function(_0x4cb97a){return _0x4cb97a;})[_0x6c12('0x2a')](respondWithResult(_0x4c38ed,null))[_0x6c12('0x47')](handleError(_0x4c38ed,null));};exports[_0x6c12('0x60')]=function(_0x518689,_0x50ee83){var _0x16420b;return db[_0x6c12('0x2f')][_0x6c12('0x4b')]({'where':{'id':_0x518689[_0x6c12('0x48')]['id']},'attributes':['id',_0x6c12('0x2c')]})['then'](handleEntityNotFound(_0x50ee83,null))[_0x6c12('0x2a')](function(_0x5b9f0f){if(_0x5b9f0f){_0x16420b=_0x5b9f0f;return db[_0x6c12('0x55')][_0x6c12('0x5b')]({'where':{'userProfileId':_0x518689[_0x6c12('0x48')]['id'],'sectionId':_0x518689['query'][_0x6c12('0x61')]}});}})[_0x6c12('0x2a')](function(){return _0x16420b;})[_0x6c12('0x2a')](respondWithStatusCode(_0x50ee83,null))[_0x6c12('0x47')](handleError(_0x50ee83,null));};exports[_0x6c12('0x62')]=function(_0x34686d,_0x1ac08e){var _0x39292f=[];var _0x6b3410=[];return db[_0x6c12('0x55')]['findAll']({'where':{'userProfileId':_0x34686d[_0x6c12('0x48')]['id']},'raw':!![]})[_0x6c12('0x2a')](function(_0x3752ae){_0x39292f=_['filter'](_0x3752ae,function(_0x947dd3){return _0x947dd3['enabled']===0x1||_['includes']([0x3eb,0x709],_0x947dd3['sectionId']);});if(!_[_0x6c12('0x63')](_0x39292f)){return _[_0x6c12('0x2e')](_0x39292f,function(_0x2dee4b){return _0x2dee4b[_0x6c12('0x5c')];});}else{return;}})[_0x6c12('0x2a')](function(_0x38d7b4){if(_0x38d7b4)_0x6b3410=_0x38d7b4;if(_[_0x6c12('0x64')](_0x6b3410,0x64)){var _0x57c028=_[_0x6c12('0x4b')](_0x39292f,{'sectionId':0x64});return hasDefaultDashboard(_0x57c028)[_0x6c12('0x2a')](function(_0x2a3382){return _[_0x6c12('0x2e')](_0x39292f,function(_0x581b83){if(_0x581b83[_0x6c12('0x5c')]===0x64){_0x581b83[_0x6c12('0x65')]=_0x2a3382;}return _0x581b83;});});}else{return;}})[_0x6c12('0x2a')](function(_0x2e1d4f){if(_0x2e1d4f)_0x39292f=_0x2e1d4f;if(_['includes'](_0x6b3410,0x3eb)){var _0x1552d9=_['find'](_0x39292f,{'sectionId':0x3eb});return getCustomDashboards(_0x1552d9)[_0x6c12('0x2a')](function(_0x39caeb){return _['map'](_0x39292f,function(_0x4e16d6){if(_0x1552d9['enabled']){if(_0x4e16d6[_0x6c12('0x5c')]===0x3eb){_0x4e16d6[_0x6c12('0x65')]=_0x39caeb;}}else{if(_0x4e16d6[_0x6c12('0x5c')]===0x64){if(!_0x4e16d6[_0x6c12('0x65')]){_0x4e16d6[_0x6c12('0x65')]=[];}_0x4e16d6['subsections']=_0x4e16d6['subsections'][_0x6c12('0x66')](_0x39caeb);}}return _0x4e16d6;});});}else{return;}})[_0x6c12('0x2a')](function(_0x1028fa){if(_0x1028fa)_0x39292f=_0x1028fa;if(_['includes'](_0x6b3410,0x709)){var _0xe6e54=_['find'](_0x39292f,{'sectionId':0x709});return getPlugins(_0xe6e54)['then'](function(_0x20a3e3){if(_0xe6e54[_0x6c12('0x67')]){return _[_0x6c12('0x2e')](_0x39292f,function(_0x52df9d){if(_0x52df9d[_0x6c12('0x5c')]===0x709){_0x52df9d[_0x6c12('0x65')]=_0x20a3e3;}return _0x52df9d;});}else{var _0x16c3eb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x20a3e3};var _0x4d35ba=_[_0x6c12('0x2e')](_0x39292f);_0x4d35ba[_0x6c12('0x5f')](_0x16c3eb);return _0x4d35ba;}});}else{return;}})[_0x6c12('0x2a')](function(_0x4b3b50){if(_0x4b3b50)_0x39292f=_0x4b3b50;return _[_0x6c12('0x41')](_0x39292f,[_0x6c12('0x67'),0x1]);})[_0x6c12('0x2a')](respondWithResult(_0x1ac08e,null))[_0x6c12('0x47')](handleError(_0x1ac08e,null));};function hasDefaultDashboard(_0x11f10e){var _0x3613c5=[0x65];return new BPromise(function(_0x1916d8,_0x59c63f){try{if(_0x11f10e['autoAssociation']){_0x1916d8(_0x3613c5);}else{return db['UserProfileResource'][_0x6c12('0x68')]({'where':{'sectionId':_0x11f10e['id']},'raw':!![]})[_0x6c12('0x2a')](function(_0x4fe9dd){_0x4fe9dd?_0x1916d8(_0x3613c5):_0x1916d8();});}}catch(_0x3dc59b){_0x59c63f(_0x3dc59b);}});}function getCustomDashboards(_0x9ef9c8){var _0x189f89=[];return new BPromise(function(_0x11143f,_0x358e9f){try{if(_0x9ef9c8[_0x6c12('0x56')]){return db[_0x6c12('0x69')]['findAll']({'raw':!![]})[_0x6c12('0x2a')](function(_0x3da74a){_0x3da74a['forEach'](function(_0x24475c){_0x189f89[_0x6c12('0x5f')](_0x24475c['id']+0x1869f);});_0x11143f(_0x189f89);});}else{return db[_0x6c12('0x59')][_0x6c12('0x45')]({'where':{'sectionId':_0x9ef9c8['id']},'raw':!![]})['then'](function(_0x23138f){_0x23138f[_0x6c12('0x6a')](function(_0x500cfa){_0x189f89['push'](_0x500cfa[_0x6c12('0x6b')]+0x1869f);});_0x11143f(_0x189f89);});}}catch(_0x1f3ef6){_0x358e9f(_0x1f3ef6);}});}function getPlugins(_0x2a3fab){var _0x5e63a7=[];return new BPromise(function(_0x24ade4,_0x13621e){try{if(_0x2a3fab['autoAssociation']){return db[_0x6c12('0x6c')]['findAll']({'raw':!![]})['then'](function(_0x391428){_0x391428[_0x6c12('0x6a')](function(_0x1e3f1c){_0x5e63a7[_0x6c12('0x5f')](_0x1e3f1c['id']+0x15b38);});_0x24ade4(_0x5e63a7);});}else{return db[_0x6c12('0x59')][_0x6c12('0x45')]({'where':{'sectionId':_0x2a3fab['id']},'raw':!![]})['then'](function(_0xc53b69){_0xc53b69[_0x6c12('0x6a')](function(_0x5394ca){_0x5e63a7[_0x6c12('0x5f')](_0x5394ca[_0x6c12('0x6b')]+0x15b38);});_0x24ade4(_0x5e63a7);});}}catch(_0x14395c){_0x13621e(_0x14395c);}});}exports[_0x6c12('0x6d')]=function(_0x246e8e,_0x16545e){return db[_0x6c12('0x2f')][_0x6c12('0x4b')]({'where':{'id':_0x246e8e[_0x6c12('0x48')]['id']}})[_0x6c12('0x2a')](handleEntityNotFound(_0x16545e,null))['then'](function(_0x3f1cb7){if(_0x3f1cb7){return db[_0x6c12('0x53')][_0x6c12('0x54')](function(_0x4d7258){return db[_0x6c12('0x55')][_0x6c12('0x45')]({'where':{'userProfileId':_0x246e8e[_0x6c12('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x6c12('0x2a')](function(_0x51eced){if(_0x51eced){return db[_0x6c12('0x55')][_0x6c12('0x5b')]({'where':{'userProfileId':_0x246e8e[_0x6c12('0x48')]['id'],'id':_[_0x6c12('0x2e')](_0x51eced,function(_0x409b7e){return _0x409b7e['id'];})},'transaction':_0x4d7258});}})[_0x6c12('0x2a')](function(_0x4c99d7){var _0x47c60f=_[_0x6c12('0x2e')](_0x246e8e[_0x6c12('0x4d')],function(_0x428a8b){_0x428a8b[_0x6c12('0x5d')]=_0x246e8e[_0x6c12('0x48')]['id'];return _0x428a8b;});return db[_0x6c12('0x55')][_0x6c12('0x6e')](_0x47c60f,{'raw':!![],'transaction':_0x4d7258});})[_0x6c12('0x2a')](function(_0x5b2029){var _0x22e31f=_[_0x6c12('0x41')](_[_0x6c12('0x2e')](_0x5b2029,function(_0x39f4ee){return _0x39f4ee[_0x6c12('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x22e31f){return db[_0x6c12('0x55')]['findAll']({'where':{'userProfileId':_0x246e8e[_0x6c12('0x48')]['id'],'sectionId':_['map'](_0x22e31f,function(_0x4a2688){return _0x4a2688[_0x6c12('0x5c')];})},'attributes':['id',_0x6c12('0x5c')],'raw':!![]})[_0x6c12('0x2a')](function(_0x326ae6){var _0x49448c=_[_0x6c12('0x2e')](_0x246e8e['body'],function(_0x58aa49){_0x58aa49[_0x6c12('0x5d')]=_0x246e8e[_0x6c12('0x48')]['id'];return _0x58aa49;});return db[_0x6c12('0x59')][_0x6c12('0x6e')](_0x49448c,{'raw':!![],'transaction':_0x4d7258});});}})[_0x6c12('0x47')](handleError(_0x16545e,null));});}})[_0x6c12('0x2a')](function(_0x17a77a){var _0xbd8b42=_[_0x6c12('0x2e')](_0x17a77a,function(_0x3f32bc){return _0x3f32bc['get']({'plain':!![]});});})[_0x6c12('0x2a')](respondWithResult(_0x16545e,null))[_0x6c12('0x47')](handleError(_0x16545e,null));};exports[_0x6c12('0x6f')]=function(_0x3afb45,_0x2b394f,_0x5c267a){return db['UserProfile'][_0x6c12('0x4b')]({'where':{'id':_0x3afb45[_0x6c12('0x48')]['id']}})[_0x6c12('0x2a')](handleEntityNotFound(_0x2b394f,null))[_0x6c12('0x2a')](function(_0x397e59){if(_0x397e59){return _0x397e59[_0x6c12('0x6f')](_0x3afb45[_0x6c12('0x35')][_0x6c12('0x61')]);}})[_0x6c12('0x2a')](respondWithStatusCode(_0x2b394f,null))[_0x6c12('0x47')](handleError(_0x2b394f,null));};exports['getResources']=function(_0x1032f8,_0x517cff){var _0x5b2e2e={};if(!_0x1032f8['query'][_0x6c12('0x70')])throw new Error(_0x6c12('0x71'));if(!_0x1032f8[_0x6c12('0x35')][_0x6c12('0x3a')](_0x6c12('0x3b'))){_0x5b2e2e['limit']=qs['limit'](_0x1032f8[_0x6c12('0x35')]['limit']);_0x5b2e2e[_0x6c12('0x24')]=qs[_0x6c12('0x24')](_0x1032f8[_0x6c12('0x35')][_0x6c12('0x24')]);}return db[_0x6c12('0x2f')][_0x6c12('0x4b')]({'where':{'id':_0x1032f8['params']['id']}})[_0x6c12('0x2a')](function(_0x22e1d4){if(!_0x22e1d4)throw new Error(_0x6c12('0x72')+_0x1032f8[_0x6c12('0x48')]['id']);return db['UserProfile']['getResources'](_0x1032f8);})[_0x6c12('0x2a')](respondWithFilteredResult(_0x517cff,_0x5b2e2e))[_0x6c12('0x47')](handleError(_0x517cff,null));}; \ No newline at end of file +var _0x56ca=['fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','UserProfile','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','name','includeAll','include','rows','catch','show','params','keys','options','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','sequelize','push','removeSections','getSections','findAll','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x56ca,0xde));var _0xa56c=function(_0x214cb8,_0x406018){_0x214cb8=_0x214cb8-0x0;var _0x1cebbf=_0x56ca[_0x214cb8];return _0x1cebbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa56c('0x0'));var zipdir=require(_0xa56c('0x1'));var jsonpatch=require(_0xa56c('0x2'));var rp=require(_0xa56c('0x3'));var moment=require('moment');var BPromise=require(_0xa56c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa56c('0x5'));var sox=require(_0xa56c('0x6'));var csv=require(_0xa56c('0x7'));var ejs=require(_0xa56c('0x8'));var fs=require('fs');var fs_extra=require(_0xa56c('0x9'));var _=require(_0xa56c('0xa'));var squel=require(_0xa56c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa56c('0x7'));var querystring=require('querystring');var Papa=require(_0xa56c('0xc'));var Redis=require(_0xa56c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa56c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa56c('0xf'));var logger=require(_0xa56c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa56c('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa56c('0x12')](config[_0xa56c('0x13')],{'host':_0xa56c('0x14'),'port':0x18eb});var socket=require(_0xa56c('0x15'))(new Redis(config[_0xa56c('0x13')]));require(_0xa56c('0x16'))['register'](socket);function respondWithStatusCode(_0x51771d,_0x42baff){_0x42baff=_0x42baff||0xcc;return function(_0xdbecc3){if(_0xdbecc3){return _0x51771d[_0xa56c('0x17')](_0x42baff);}return _0x51771d['status'](_0x42baff)[_0xa56c('0x18')]();};}function respondWithResult(_0x32a2ce,_0x524b7d){_0x524b7d=_0x524b7d||0xc8;return function(_0xac227a){if(_0xac227a){return _0x32a2ce['status'](_0x524b7d)[_0xa56c('0x19')](_0xac227a);}};}function respondWithFilteredResult(_0x17f943,_0x4f0273){return function(_0x141b74){if(_0x141b74){var _0x4cc297=typeof _0x4f0273[_0xa56c('0x1a')]===_0xa56c('0x1b')&&typeof _0x4f0273['limit']===_0xa56c('0x1b');var _0x591570=_0x141b74[_0xa56c('0x1c')];var _0x100c40=_0x4cc297?0x0:_0x4f0273[_0xa56c('0x1a')];var _0x4e2de3=_0x4cc297?_0x141b74[_0xa56c('0x1c')]:_0x4f0273[_0xa56c('0x1a')]+_0x4f0273[_0xa56c('0x1d')];var _0x28aeda;if(_0x4e2de3>=_0x591570){_0x4e2de3=_0x591570;_0x28aeda=0xc8;}else{_0x28aeda=0xce;}_0x17f943[_0xa56c('0x1e')](_0x28aeda);return _0x17f943[_0xa56c('0x1f')](_0xa56c('0x20'),_0x100c40+'-'+_0x4e2de3+'/'+_0x591570)['json'](_0x141b74);}return null;};}function patchUpdates(_0x58dc5d){return function(_0x44d844){try{jsonpatch[_0xa56c('0x21')](_0x44d844,_0x58dc5d,!![]);}catch(_0x2eb1d0){return BPromise[_0xa56c('0x22')](_0x2eb1d0);}return _0x44d844[_0xa56c('0x23')]();};}function saveUpdates(_0x31bc27,_0x21c4b0){return function(_0xc9518d){if(_0xc9518d){return _0xc9518d[_0xa56c('0x24')](_0x31bc27)[_0xa56c('0x25')](function(_0x20a35a){return _0x20a35a;});}return null;};}function removeEntity(_0x438436,_0x132913){return function(_0x13f708){if(_0x13f708){return _0x13f708[_0xa56c('0x26')]()[_0xa56c('0x25')](function(){_0x438436[_0xa56c('0x1e')](0xcc)[_0xa56c('0x18')]();});}};}function handleEntityNotFound(_0x2f899a,_0x2c50d0){return function(_0x313e2d){if(!_0x313e2d){_0x2f899a[_0xa56c('0x17')](0x194);}return _0x313e2d;};}function handleError(_0x1132ea,_0x1376c5){_0x1376c5=_0x1376c5||0x1f4;return function(_0x46c031){logger[_0xa56c('0x27')](_0x46c031[_0xa56c('0x28')]);if(_0x46c031['name']){delete _0x46c031['name'];}_0x1132ea[_0xa56c('0x1e')](_0x1376c5)[_0xa56c('0x29')](_0x46c031);};}exports[_0xa56c('0x2a')]=function(_0x41c612,_0x44c7f5){var _0x33f968={},_0xcb047={},_0x5e860d={'count':0x0,'rows':[]};var _0x5cf04b=_['map'](db[_0xa56c('0x2b')][_0xa56c('0x2c')],function(_0x3e88cf){return{'name':_0x3e88cf[_0xa56c('0x2d')],'type':_0x3e88cf[_0xa56c('0x2e')]['key']};});_0xcb047['model']=_['map'](_0x5cf04b,'name');_0xcb047[_0xa56c('0x2f')]=_['keys'](_0x41c612[_0xa56c('0x2f')]);_0xcb047[_0xa56c('0x30')]=_[_0xa56c('0x31')](_0xcb047[_0xa56c('0x32')],_0xcb047[_0xa56c('0x2f')]);_0x33f968[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0xcb047[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x34')]));_0x33f968[_0xa56c('0x33')]=_0x33f968[_0xa56c('0x33')][_0xa56c('0x35')]?_0x33f968[_0xa56c('0x33')]:_0xcb047[_0xa56c('0x32')];if(!_0x41c612[_0xa56c('0x2f')][_0xa56c('0x36')](_0xa56c('0x37'))){_0x33f968[_0xa56c('0x1d')]=qs[_0xa56c('0x1d')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x1d')]);_0x33f968[_0xa56c('0x1a')]=qs[_0xa56c('0x1a')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x1a')]);}_0x33f968[_0xa56c('0x38')]=qs[_0xa56c('0x39')](_0x41c612[_0xa56c('0x2f')][_0xa56c('0x39')]);_0x33f968['where']=qs['filters'](_[_0xa56c('0x3a')](_0x41c612['query'],_0xcb047[_0xa56c('0x30')]),_0x5cf04b);if(_0x41c612['query'][_0xa56c('0x3b')]){_0x33f968[_0xa56c('0x3c')]=_[_0xa56c('0x3d')](_0x33f968['where'],{'$or':_[_0xa56c('0x3e')](_0x5cf04b,function(_0x4af76a){if(_0x4af76a[_0xa56c('0x2e')]!==_0xa56c('0x3f')){var _0x38db6a={};_0x38db6a[_0x4af76a[_0xa56c('0x40')]]={'$like':'%'+_0x41c612['query'][_0xa56c('0x3b')]+'%'};return _0x38db6a;}})});}_0x33f968=_['merge']({},_0x33f968,_0x41c612['options']);var _0x4bd5f1={'where':_0x33f968[_0xa56c('0x3c')]};return db[_0xa56c('0x2b')][_0xa56c('0x1c')](_0x4bd5f1)[_0xa56c('0x25')](function(_0x1c1d13){_0x5e860d[_0xa56c('0x1c')]=_0x1c1d13;if(_0x41c612[_0xa56c('0x2f')][_0xa56c('0x41')]){_0x33f968[_0xa56c('0x42')]=[{'all':!![]}];}return db[_0xa56c('0x2b')]['findAll'](_0x33f968);})['then'](function(_0x183333){_0x5e860d[_0xa56c('0x43')]=_0x183333;return _0x5e860d;})[_0xa56c('0x25')](respondWithFilteredResult(_0x44c7f5,_0x33f968))[_0xa56c('0x44')](handleError(_0x44c7f5,null));};exports[_0xa56c('0x45')]=function(_0x3516a0,_0x573d6d){var _0x562594={'raw':![],'where':{'id':_0x3516a0[_0xa56c('0x46')]['id']}},_0x4f5cb2={};_0x4f5cb2[_0xa56c('0x32')]=_['keys'](db['UserProfile'][_0xa56c('0x2c')]);_0x4f5cb2[_0xa56c('0x2f')]=_[_0xa56c('0x47')](_0x3516a0['query']);_0x4f5cb2[_0xa56c('0x30')]=_[_0xa56c('0x31')](_0x4f5cb2[_0xa56c('0x32')],_0x4f5cb2[_0xa56c('0x2f')]);_0x562594[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0x4f5cb2[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x3516a0[_0xa56c('0x2f')][_0xa56c('0x34')]));_0x562594[_0xa56c('0x33')]=_0x562594[_0xa56c('0x33')][_0xa56c('0x35')]?_0x562594[_0xa56c('0x33')]:_0x4f5cb2[_0xa56c('0x32')];if(_0x3516a0[_0xa56c('0x2f')]['includeAll']){_0x562594['include']=[{'all':!![]}];}_0x562594=_[_0xa56c('0x3d')]({},_0x562594,_0x3516a0[_0xa56c('0x48')]);return db['UserProfile'][_0xa56c('0x49')](_0x562594)['then'](handleEntityNotFound(_0x573d6d,null))[_0xa56c('0x25')](respondWithResult(_0x573d6d,null))['catch'](handleError(_0x573d6d,null));};exports[_0xa56c('0x4a')]=function(_0x11df4a,_0x201c86){return db[_0xa56c('0x2b')]['create'](_0x11df4a[_0xa56c('0x4b')],{})['then'](respondWithResult(_0x201c86,0xc9))[_0xa56c('0x44')](handleError(_0x201c86,null));};exports[_0xa56c('0x4c')]=function(_0x1402dc,_0x2c6d2a){var _0xc14a40={'where':{'id':_0x1402dc[_0xa56c('0x46')]['id']}},_0x27b9bb={};_0x27b9bb[_0xa56c('0x32')]=_[_0xa56c('0x47')](db[_0xa56c('0x2b')][_0xa56c('0x2c')]);_0xc14a40[_0xa56c('0x33')]=_[_0xa56c('0x31')](_0x27b9bb[_0xa56c('0x32')],qs[_0xa56c('0x34')](_0x1402dc['query'][_0xa56c('0x34')]));_0xc14a40[_0xa56c('0x33')]=_0xc14a40['attributes'][_0xa56c('0x35')]?_0xc14a40['attributes']:_0x27b9bb[_0xa56c('0x32')];if(_0x1402dc[_0xa56c('0x2f')]['includeAll']){_0xc14a40[_0xa56c('0x42')]=[{'all':!![]}];}_0xc14a40=_[_0xa56c('0x3d')]({},_0xc14a40,_0x1402dc[_0xa56c('0x48')]);return db[_0xa56c('0x2b')][_0xa56c('0x49')](_0xc14a40)[_0xa56c('0x25')](handleEntityNotFound(_0x2c6d2a,null))[_0xa56c('0x25')](function(_0x1b2b08){if(_0x1b2b08){var _0x1d3ce8=_0x1b2b08[_0xa56c('0x4d')]({'plain':!![]});_0x1d3ce8=qs[_0xa56c('0x4e')](_0x1d3ce8,['id','createdAt',_0xa56c('0x4f'),_0xa56c('0x50')]);_0x1402dc[_0xa56c('0x4b')]=_[_0xa56c('0x4e')](_0x1402dc[_0xa56c('0x4b')],['id',_0xa56c('0x51'),'updatedAt']);return db['sequelize'][_0xa56c('0x52')](function(_0x21381f){return db[_0xa56c('0x2b')][_0xa56c('0x4a')](_[_0xa56c('0x3d')](_0x1d3ce8,_0x1402dc[_0xa56c('0x4b')]),{'include':_0x1402dc[_0xa56c('0x2f')][_0xa56c('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x21381f})[_0xa56c('0x25')](function(_0xaddd0d){var _0x4e5820=_0xaddd0d[_0xa56c('0x4d')]({'plain':!![]});return db[_0xa56c('0x53')]['findAll']({'where':{'userProfileId':_0x1402dc[_0xa56c('0x46')]['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x6fe8ee){if(_0x6fe8ee){return BPromise[_0xa56c('0x54')](_0x6fe8ee,function(_0x171b2a){return new BPromise(function(_0x11d6b8,_0x38f66a){if(_0x171b2a[_0xa56c('0x55')]===null||_0x171b2a['autoAssociation']===0x1)_0x11d6b8(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x171b2a['id']},'raw':!![]})['then'](function(_0x137d7f){var _0x25d85b=_[_0xa56c('0x3e')](_0x137d7f,function(_0x3fd5f4){return qs[_0xa56c('0x4e')](_0x3fd5f4,['id',_0xa56c('0x51'),'updatedAt',_0xa56c('0x56')]);});_0x11d6b8(_0x25d85b);})[_0xa56c('0x44')](function(_0x3b498a){_0x38f66a(_0x3b498a);});})['then'](function(_0x4d8a96){var _0x138e05=qs['omit'](_0x171b2a,['id','createdAt',_0xa56c('0x4f')]);_0x138e05[_0xa56c('0x57')]=_0x4e5820['id'];if(_0x4d8a96)_0x138e05[_0xa56c('0x58')]=_0x4d8a96;return _0x138e05;})[_0xa56c('0x25')](function(_0x2c6bb5){return db[_0xa56c('0x53')][_0xa56c('0x4a')](_0x2c6bb5,{'include':[{'model':db[_0xa56c('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x21381f});});})[_0xa56c('0x25')](function(){return _0x4e5820;});}});});});}})['then'](respondWithResult(_0x2c6d2a,0xc9))[_0xa56c('0x44')](handleError(_0x2c6d2a,null));};exports[_0xa56c('0x24')]=function(_0x457c75,_0x12554d){if(_0x457c75['body']['id']){delete _0x457c75['body']['id'];}return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x457c75[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x12554d,null))[_0xa56c('0x25')](saveUpdates(_0x457c75[_0xa56c('0x4b')],null))['then'](respondWithResult(_0x12554d,null))[_0xa56c('0x44')](handleError(_0x12554d,null));};exports[_0xa56c('0x26')]=function(_0x4b2b50,_0x4094f8){return db['UserProfile'][_0xa56c('0x49')]({'where':{'id':_0x4b2b50[_0xa56c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4094f8,null))[_0xa56c('0x25')](removeEntity(_0x4094f8,null))[_0xa56c('0x44')](handleError(_0x4094f8,null));};exports[_0xa56c('0x5a')]=function(_0x41d9b4,_0xee2278){return db[_0xa56c('0x2b')][_0xa56c('0x5a')]()[_0xa56c('0x25')](respondWithResult(_0xee2278,null))[_0xa56c('0x44')](handleError(_0xee2278,null));};exports['addSections']=function(_0x4dabfa,_0x57333c){var _0x5c3b32=_0x4dabfa['body'];return db['UserProfile']['find']({'where':{'id':_0x4dabfa[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x57333c,null))[_0xa56c('0x25')](function(_0x569cce){if(_0x569cce){return db[_0xa56c('0x5b')][_0xa56c('0x52')](function(_0x2daf13){return db[_0xa56c('0x53')]['destroy']({'where':{'userProfileId':_0x4dabfa[_0xa56c('0x46')]['id'],'sectionId':_['map'](_0x5c3b32,function(_0x4b9b29){return _0x4b9b29[_0xa56c('0x56')];})},'transaction':_0x2daf13})[_0xa56c('0x25')](function(){var _0x5b860c=_[_0xa56c('0x3e')](_0x5c3b32,function(_0x5f2a33){_0x5f2a33['userProfileId']=_0x4dabfa[_0xa56c('0x46')]['id'];return _0x5f2a33;});var _0x52bb0b=[];return BPromise['each'](_0x5b860c,function(_0x54b53a){return db['UserProfileSection'][_0xa56c('0x4a')](_0x54b53a,{'include':[{'model':db[_0xa56c('0x59')],'as':_0xa56c('0x58')}],'raw':!![],'transaction':_0x2daf13})[_0xa56c('0x25')](function(_0x3e8323){_0x52bb0b[_0xa56c('0x5c')](_0x3e8323[_0xa56c('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x52bb0b;});});});}})['then'](function(_0x4521b1){return _0x4521b1;})[_0xa56c('0x25')](respondWithResult(_0x57333c,null))['catch'](handleError(_0x57333c,null));};exports[_0xa56c('0x5d')]=function(_0x1e8716,_0x47090d){var _0x59b078;return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x1e8716[_0xa56c('0x46')]['id']},'attributes':['id',_0xa56c('0x40')]})[_0xa56c('0x25')](handleEntityNotFound(_0x47090d,null))[_0xa56c('0x25')](function(_0x1b5c7b){if(_0x1b5c7b){_0x59b078=_0x1b5c7b;return db['UserProfileSection'][_0xa56c('0x26')]({'where':{'userProfileId':_0x1e8716[_0xa56c('0x46')]['id'],'sectionId':_0x1e8716[_0xa56c('0x2f')]['ids']}});}})['then'](function(){return _0x59b078;})['then'](respondWithStatusCode(_0x47090d,null))[_0xa56c('0x44')](handleError(_0x47090d,null));};exports[_0xa56c('0x5e')]=function(_0x3d64ec,_0x105141){var _0x56a900=[];var _0x346148=[];return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x3d64ec[_0xa56c('0x46')]['id']},'raw':!![]})['then'](function(_0x313cea){_0x56a900=_['filter'](_0x313cea,function(_0x16ea7d){return _0x16ea7d[_0xa56c('0x60')]===0x1||_[_0xa56c('0x61')]([0x3eb,0x709],_0x16ea7d[_0xa56c('0x56')]);});if(!_[_0xa56c('0x62')](_0x56a900)){return _[_0xa56c('0x3e')](_0x56a900,function(_0x52d9ff){return _0x52d9ff['sectionId'];});}else{return;}})['then'](function(_0x571871){if(_0x571871)_0x346148=_0x571871;if(_[_0xa56c('0x61')](_0x346148,0x64)){var _0x274496=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x64});return hasDefaultDashboard(_0x274496)[_0xa56c('0x25')](function(_0x51ca47){return _['map'](_0x56a900,function(_0x2ccb1a){if(_0x2ccb1a[_0xa56c('0x56')]===0x64){_0x2ccb1a[_0xa56c('0x63')]=_0x51ca47;}return _0x2ccb1a;});});}else{return;}})[_0xa56c('0x25')](function(_0x58115f){if(_0x58115f)_0x56a900=_0x58115f;if(_[_0xa56c('0x61')](_0x346148,0x3eb)){var _0x961836=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x3eb});return getCustomDashboards(_0x961836)[_0xa56c('0x25')](function(_0x3242d3){return _[_0xa56c('0x3e')](_0x56a900,function(_0x31eed4){if(_0x961836['enabled']){if(_0x31eed4[_0xa56c('0x56')]===0x3eb){_0x31eed4['subsections']=_0x3242d3;}}else{if(_0x31eed4[_0xa56c('0x56')]===0x64){if(!_0x31eed4[_0xa56c('0x63')]){_0x31eed4[_0xa56c('0x63')]=[];}_0x31eed4[_0xa56c('0x63')]=_0x31eed4[_0xa56c('0x63')][_0xa56c('0x64')](_0x3242d3);}}return _0x31eed4;});});}else{return;}})[_0xa56c('0x25')](function(_0x2dd36a){if(_0x2dd36a)_0x56a900=_0x2dd36a;if(_[_0xa56c('0x61')](_0x346148,0x709)){var _0x445321=_[_0xa56c('0x49')](_0x56a900,{'sectionId':0x709});return getPlugins(_0x445321)['then'](function(_0x3c59cb){if(_0x445321[_0xa56c('0x60')]){return _['map'](_0x56a900,function(_0x5c3239){if(_0x5c3239[_0xa56c('0x56')]===0x709){_0x5c3239['subsections']=_0x3c59cb;}return _0x5c3239;});}else{var _0xc0d2a4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c59cb};var _0x1edfc6=_[_0xa56c('0x3e')](_0x56a900);_0x1edfc6[_0xa56c('0x5c')](_0xc0d2a4);return _0x1edfc6;}});}else{return;}})[_0xa56c('0x25')](function(_0x254e56){if(_0x254e56)_0x56a900=_0x254e56;return _[_0xa56c('0x3b')](_0x56a900,[_0xa56c('0x60'),0x1]);})[_0xa56c('0x25')](respondWithResult(_0x105141,null))[_0xa56c('0x44')](handleError(_0x105141,null));};function hasDefaultDashboard(_0xcbac0c){var _0x5bce3d=[0x65];return new BPromise(function(_0x2c853b,_0x3591fc){try{if(_0xcbac0c[_0xa56c('0x55')]){_0x2c853b(_0x5bce3d);}else{return db[_0xa56c('0x59')]['findOne']({'where':{'sectionId':_0xcbac0c['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x4df500){_0x4df500?_0x2c853b(_0x5bce3d):_0x2c853b();});}}catch(_0x299346){_0x3591fc(_0x299346);}});}function getCustomDashboards(_0x394ad3){var _0x1c9f9a=[];return new BPromise(function(_0x40d9bf,_0x3b460a){try{if(_0x394ad3[_0xa56c('0x55')]){return db[_0xa56c('0x65')][_0xa56c('0x5f')]({'raw':!![]})['then'](function(_0x1ac0d5){_0x1ac0d5['forEach'](function(_0x556548){_0x1c9f9a[_0xa56c('0x5c')](_0x556548['id']+0x1869f);});_0x40d9bf(_0x1c9f9a);});}else{return db[_0xa56c('0x59')][_0xa56c('0x5f')]({'where':{'sectionId':_0x394ad3['id']},'raw':!![]})['then'](function(_0x5422e9){_0x5422e9[_0xa56c('0x66')](function(_0x180fd4){_0x1c9f9a[_0xa56c('0x5c')](_0x180fd4['resourceId']+0x1869f);});_0x40d9bf(_0x1c9f9a);});}}catch(_0x15d7aa){_0x3b460a(_0x15d7aa);}});}function getPlugins(_0x420c01){var _0x3248ed=[];return new BPromise(function(_0x35cb06,_0x4e4e92){try{if(_0x420c01[_0xa56c('0x55')]){return db[_0xa56c('0x67')][_0xa56c('0x5f')]({'raw':!![]})[_0xa56c('0x25')](function(_0x55f114){_0x55f114[_0xa56c('0x66')](function(_0x1b3f2e){_0x3248ed[_0xa56c('0x5c')](_0x1b3f2e['id']+0x15b38);});_0x35cb06(_0x3248ed);});}else{return db[_0xa56c('0x59')][_0xa56c('0x5f')]({'where':{'sectionId':_0x420c01['id']},'raw':!![]})[_0xa56c('0x25')](function(_0x4e26ae){_0x4e26ae[_0xa56c('0x66')](function(_0x5050f7){_0x3248ed[_0xa56c('0x5c')](_0x5050f7[_0xa56c('0x68')]+0x15b38);});_0x35cb06(_0x3248ed);});}}catch(_0x55c60a){_0x4e4e92(_0x55c60a);}});}exports[_0xa56c('0x69')]=function(_0x206244,_0x3f6202){return db[_0xa56c('0x2b')]['find']({'where':{'id':_0x206244['params']['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x3f6202,null))[_0xa56c('0x25')](function(_0x2ab804){if(_0x2ab804){return db[_0xa56c('0x5b')][_0xa56c('0x52')](function(_0x330d11){return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x9d1157){if(_0x9d1157){return db[_0xa56c('0x53')][_0xa56c('0x26')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id'],'id':_['map'](_0x9d1157,function(_0x5db439){return _0x5db439['id'];})},'transaction':_0x330d11});}})[_0xa56c('0x25')](function(_0x3e4568){var _0x312b8a=_[_0xa56c('0x3e')](_0x206244[_0xa56c('0x4b')],function(_0x5c4977){_0x5c4977[_0xa56c('0x57')]=_0x206244['params']['id'];return _0x5c4977;});return db[_0xa56c('0x53')][_0xa56c('0x6a')](_0x312b8a,{'raw':!![],'transaction':_0x330d11});})['then'](function(_0x53fd48){var _0x3337ab=_[_0xa56c('0x3b')](_['map'](_0x53fd48,function(_0x4f7904){return _0x4f7904[_0xa56c('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x3337ab){return db[_0xa56c('0x53')][_0xa56c('0x5f')]({'where':{'userProfileId':_0x206244[_0xa56c('0x46')]['id'],'sectionId':_[_0xa56c('0x3e')](_0x3337ab,function(_0x351b95){return _0x351b95['sectionId'];})},'attributes':['id',_0xa56c('0x56')],'raw':!![]})[_0xa56c('0x25')](function(_0x3166c9){var _0x4d87c8=_[_0xa56c('0x3e')](_0x206244[_0xa56c('0x4b')],function(_0x2e3990){_0x2e3990[_0xa56c('0x57')]=_0x206244['params']['id'];return _0x2e3990;});return db[_0xa56c('0x59')]['bulkCreate'](_0x4d87c8,{'raw':!![],'transaction':_0x330d11});});}})['catch'](handleError(_0x3f6202,null));});}})[_0xa56c('0x25')](function(_0x2c8bf5){var _0x4797f0=_[_0xa56c('0x3e')](_0x2c8bf5,function(_0x41a80e){return _0x41a80e[_0xa56c('0x4d')]({'plain':!![]});});})['then'](respondWithResult(_0x3f6202,null))[_0xa56c('0x44')](handleError(_0x3f6202,null));};exports[_0xa56c('0x6b')]=function(_0x3a9dbd,_0x41d5e8,_0x5ca802){return db[_0xa56c('0x2b')][_0xa56c('0x49')]({'where':{'id':_0x3a9dbd[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](handleEntityNotFound(_0x41d5e8,null))[_0xa56c('0x25')](function(_0x4d6fbd){if(_0x4d6fbd){return _0x4d6fbd['removeResources'](_0x3a9dbd[_0xa56c('0x2f')]['ids']);}})[_0xa56c('0x25')](respondWithStatusCode(_0x41d5e8,null))[_0xa56c('0x44')](handleError(_0x41d5e8,null));};exports[_0xa56c('0x6c')]=function(_0x17ee20,_0x34adfb){var _0x6df1dc={};if(!_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x6d')])throw new Error(_0xa56c('0x6e'));if(!_0x17ee20['query'][_0xa56c('0x36')](_0xa56c('0x37'))){_0x6df1dc[_0xa56c('0x1d')]=qs[_0xa56c('0x1d')](_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x1d')]);_0x6df1dc[_0xa56c('0x1a')]=qs['offset'](_0x17ee20[_0xa56c('0x2f')][_0xa56c('0x1a')]);}return db['UserProfile'][_0xa56c('0x49')]({'where':{'id':_0x17ee20[_0xa56c('0x46')]['id']}})[_0xa56c('0x25')](function(_0x39a8f2){if(!_0x39a8f2)throw new Error(_0xa56c('0x6f')+_0x17ee20[_0xa56c('0x46')]['id']);return db[_0xa56c('0x2b')]['getResources'](_0x17ee20);})[_0xa56c('0x25')](respondWithFilteredResult(_0x34adfb,_0x6df1dc))[_0xa56c('0x44')](handleError(_0x34adfb,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 063739e..aa9c0b6 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 _0x38b2=['UserProfile','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x43e69a,_0x1e763e){var _0x52f5ed=function(_0x327ea5){while(--_0x327ea5){_0x43e69a['push'](_0x43e69a['shift']());}};_0x52f5ed(++_0x1e763e);}(_0x38b2,0xf6));var _0x238b=function(_0x5e136f,_0x2a4eba){_0x5e136f=_0x5e136f-0x0;var _0x5ebc55=_0x38b2[_0x5e136f];return _0x5ebc55;};'use strict';var EventEmitter=require(_0x238b('0x0'));var UserProfile=require(_0x238b('0x1'))['db'][_0x238b('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x238b('0x3'),'afterDestroy':_0x238b('0x4')};function emitEvent(_0x4df021){return function(_0x44251b,_0x4c4f0e,_0x44ddd2){UserProfileEvents[_0x238b('0x5')](_0x4df021+':'+_0x44251b['id'],_0x44251b);UserProfileEvents[_0x238b('0x5')](_0x4df021,_0x44251b);_0x44ddd2(null);};}for(var e in events){if(events[_0x238b('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x238b('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x77d4=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x1a9681,_0x341d2f){var _0x54dfda=function(_0x65f242){while(--_0x65f242){_0x1a9681['push'](_0x1a9681['shift']());}};_0x54dfda(++_0x341d2f);}(_0x77d4,0x108));var _0x477d=function(_0x55ffee,_0x1862c1){_0x55ffee=_0x55ffee-0x0;var _0x27992d=_0x77d4[_0x55ffee];return _0x27992d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x477d('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x477d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x477d('0x2'),'afterDestroy':_0x477d('0x3')};function emitEvent(_0x53637c){return function(_0x53e1b8,_0x16213f,_0xf3cde0){UserProfileEvents[_0x477d('0x4')](_0x53637c+':'+_0x53e1b8['id'],_0x53e1b8);UserProfileEvents[_0x477d('0x4')](_0x53637c,_0x53e1b8);_0xf3cde0(null);};}for(var e in events){if(events[_0x477d('0x5')](e)){var event=events[e];UserProfile[_0x477d('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3af180a..976fd3f 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 _0x8664=['name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','agents','telephones','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','Plugin','reportId','metrics','AnalyticMetric','Sequelize','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','nolimit','limit','offset','order','sort','pick','VIRTUAL','foreignKey','forEach','merge','options','includeAll','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','include','Tags','color','tag','Tag','openTabs','true','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','exports','models','filter','field','findAll','associatedResources','map','catch','value','model','then'];(function(_0x40da3d,_0x8ba0d7){var _0x4b8fc5=function(_0x182d30){while(--_0x182d30){_0x40da3d['push'](_0x40da3d['shift']());}};_0x4b8fc5(++_0x8ba0d7);}(_0x8664,0xaf));var _0x4866=function(_0x321016,_0x201eb6){_0x321016=_0x321016-0x0;var _0x221250=_0x8664[_0x321016];return _0x221250;};'use strict';var _=require('lodash');var attributes=require(_0x4866('0x0'));var squel=require('squel');module[_0x4866('0x1')]=function(_0x33c95e){var _0x3bdedc=_0x33c95e[_0x4866('0x2')];function _0x1374bf(_0x2bb153,_0x2ed214){return new Promise(function(_0x114232,_0x18e0e5){if(!_0x2ed214)return _0x114232(null);var _0x216a19=_0x2ed214[_0x4866('0x3')]?{[_0x2ed214[_0x4866('0x3')][_0x4866('0x4')]]:_0x2ed214[_0x4866('0x3')]['value']}:undefined;return _0x3bdedc[_0x2bb153][_0x4866('0x5')]({'where':_0x216a19,'raw':!![]})['then'](function(_0x5f0291){_0x2ed214[_0x4866('0x6')]=_[_0x4866('0x7')](_0x5f0291,'id');_0x114232(_0x2ed214);})[_0x4866('0x8')](function(_0x41d741){_0x18e0e5(_0x41d741);});});}function _0x5f00fb(_0x66fc73,_0x1ef58e){return new Promise(function(_0x2faae2,_0x51e309){var _0x7fe1cc=_0x66fc73[_0x4866('0x3')]?{[_0x66fc73['filter'][_0x4866('0x4')]]:_0x66fc73[_0x4866('0x3')][_0x4866('0x9')]}:undefined;return _0x3bdedc[_0x66fc73[_0x4866('0xa')]][_0x4866('0x5')]({'where':_0x7fe1cc,'raw':!![]})[_0x4866('0xb')](function(_0x302b35){_0x1ef58e[_0x4866('0x6')]=_[_0x4866('0x7')](_0x302b35,function(_0x5ac643){return _0x5ac643[_0x4866('0xc')];});_0x2faae2(_0x1ef58e);})[_0x4866('0x8')](function(_0x7897cc){_0x51e309(_0x7897cc);});});}function _0x5af9b5(_0x4e5eff,_0x437517,_0x89431b){if(!_0x437517)return Promise['resolve'](null);return new Promise(function(_0x1eef35,_0x2cc72a){return _0x3bdedc[_0x4866('0xd')]['findAll']({'where':{'sectionId':_0x437517['id']},'raw':!![]})[_0x4866('0xb')](function(_0x16328b){if(_0x4e5eff[_0x4866('0x4')]&&_0x4e5eff[_0x4866('0x4')]!=='id'){_0x437517['associatedResources']=_['map'](_0x16328b,function(_0x5ce4d1){return _0x5ce4d1[_0x4e5eff[_0x4866('0x4')]];});}else{if(_0x89431b===_0x4866('0xe')){_0x437517[_0x4866('0x6')]=_[_0x4866('0x7')](_0x16328b,function(_0x4ec256){return{'id':_0x4ec256[_0x4866('0xf')],'type':_0x4ec256[_0x4866('0x10')]};});}else{_0x437517[_0x4866('0x6')]=_[_0x4866('0x7')](_0x16328b,function(_0xb4fffb){return _0xb4fffb['resourceId'];});}}_0x1eef35(_0x437517);})['catch'](function(_0x57b321){_0x2cc72a(_0x57b321);});});}function _0x3eabad(_0xfa0a5e,_0x466c88){var _0x1f4937={'parentSections':[]};switch(_0xfa0a5e[_0x4866('0x11')]()){case _0x4866('0x12'):_0x1f4937[_0x4866('0x13')]='SquareProject';break;case'odbc':_0x1f4937[_0x4866('0x13')]=_0x4866('0x14');break;case _0x4866('0x15'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x16');_0x1f4937['parentSections']=[{'name':_0x4866('0x17'),'field':_0x4866('0xc'),'foreignKey':_0x4866('0x18')}];break;case _0x4866('0x19'):_0x1f4937['childModel']=_0x4866('0x1a');break;case _0x4866('0x1b'):_0x1f4937['childModel']=_0x4866('0x1c');_0x1f4937[_0x4866('0x1d')]=[{'name':_0x4866('0x1e'),'field':'id','foreignKey':_0x4866('0x1f')}];break;case _0x4866('0x20'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x21');break;case _0x4866('0x22'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x23');break;case _0x4866('0x24'):_0x1f4937[_0x4866('0x13')]='CmCustomField';break;case _0x4866('0x25'):_0x1f4937[_0x4866('0x13')]='ChatQueue';break;case _0x4866('0x26'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x27');break;case _0x4866('0x28'):_0x1f4937[_0x4866('0x13')]='FaxQueue';break;case _0x4866('0x29'):_0x1f4937['childModel']=_0x4866('0x2a');break;case _0x4866('0x2b'):case _0x4866('0x2c'):case _0x4866('0x2d'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x2e');break;case'contexts':_0x1f4937['childModel']=_0x4866('0x2f');break;case _0x4866('0x30'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x31');break;case _0x4866('0x32'):_0x1f4937[_0x4866('0x13')]='VoiceRecording';_0x1f4937[_0x4866('0x1d')]=[{'name':_0x4866('0x33'),'field':'name','foreignKey':_0x4866('0x34'),'model':_0x4866('0x35'),'filter':{'field':'role','value':[_0x4866('0x36')]}},{'name':_0x4866('0x37'),'field':_0x4866('0xc'),'foreignKey':_0x4866('0x34'),'model':'User','filter':{'field':_0x4866('0x38'),'value':[_0x4866('0x39')]}},{'name':_0x4866('0x3a'),'field':'name','foreignKey':_0x4866('0x3b'),'model':_0x4866('0x3c'),'filter':{'field':'type','value':[_0x4866('0x3d')]}},{'name':_0x4866('0x3e'),'field':'name','foreignKey':_0x4866('0x3b'),'model':_0x4866('0x3c'),'filter':{'field':_0x4866('0x10'),'value':['outbound']}}];break;case _0x4866('0x3f'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x40');break;case _0x4866('0x41'):_0x1f4937['childModel']=_0x4866('0x42');break;case _0x4866('0x43'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x44');break;case _0x4866('0x45'):_0x1f4937[_0x4866('0x13')]='Campaign';break;case _0x4866('0x46'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x47');break;case _0x4866('0x48'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x49');break;case _0x4866('0x4a'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x4b');break;case'openchannelqueues':_0x1f4937['childModel']='OpenchannelQueue';break;case _0x4866('0x4c'):_0x1f4937[_0x4866('0x13')]='OpenchannelAccount';break;case'smsqueues':_0x1f4937['childModel']='SmsQueue';break;case'smsaccounts':_0x1f4937['childModel']=_0x4866('0x4d');break;case _0x4866('0x4e'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x4f');break;case _0x4866('0x50'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x51');break;case _0x4866('0x52'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x53');break;case _0x4866('0x54'):case'queuecampaigns':_0x1f4937[_0x4866('0x13')]=_0x4866('0x3c');if(_0x466c88){_0x1f4937[_0x4866('0x1d')]=[{'name':_0x4866('0x3a')},{'name':_0x4866('0x3e')}];}break;case'users':case _0x4866('0x55'):case _0x4866('0x56'):_0x1f4937['childModel']=_0x4866('0x35');if(_0x466c88){_0x1f4937[_0x4866('0x1d')]=[{'name':'Users','filter':{'field':'role','value':[_0x4866('0x57'),_0x4866('0x58')]},'ignore':!![]},{'name':_0x4866('0x33')},{'name':_0x4866('0x37')}];}break;case'zendeskaccounts':_0x1f4937[_0x4866('0x13')]=_0x4866('0x59');break;case _0x4866('0x5a'):_0x1f4937[_0x4866('0x13')]='SalesforceAccount';break;case _0x4866('0x5b'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x5c');break;case _0x4866('0x5d'):_0x1f4937[_0x4866('0x13')]='SugarcrmAccount';break;case'deskaccounts':_0x1f4937[_0x4866('0x13')]=_0x4866('0x5e');break;case _0x4866('0x5f'):_0x1f4937[_0x4866('0x13')]='ZohoAccount';break;case _0x4866('0x60'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x35');break;case'cannedanswers':_0x1f4937['childModel']=_0x4866('0x61');break;case _0x4866('0x62'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x63');break;case _0x4866('0x64'):_0x1f4937[_0x4866('0x13')]='Dashboard';break;case _0x4866('0x65'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x66');break;case _0x4866('0x67'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x68');break;case _0x4866('0x69'):_0x1f4937['childModel']=_0x4866('0x6a');break;case _0x4866('0x6b'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x6c');break;case _0x4866('0x6d'):_0x1f4937[_0x4866('0x13')]='Tag';break;case _0x4866('0x6e'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x6f');break;case _0x4866('0x70'):_0x1f4937[_0x4866('0x13')]='Trigger';break;case _0x4866('0x71'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x72');break;case _0x4866('0x73'):_0x1f4937['childModel']=_0x4866('0x74');break;case'plugins':_0x1f4937['childModel']=_0x4866('0x75');break;case'extractedreports':_0x1f4937[_0x4866('0x13')]=_0x4866('0xe');_0x1f4937[_0x4866('0x1d')]=[{'name':'Reports','field':'id','foreignKey':_0x4866('0x76')}];break;case _0x4866('0x77'):_0x1f4937[_0x4866('0x13')]=_0x4866('0x78');break;}return _0x1f4937;}function _0x530b1b(_0x3308b1,_0x3f673d){var _0x201134=_0x3308b1['charAt'](0x0)['toUpperCase']()+_0x3308b1['slice'](0x1);var _0x36c76b={'type':_0x3bdedc[_0x4866('0x79')][_0x4866('0x7a')][_0x4866('0x7b')],'raw':!![]};return new Promise(function(_0x39770d,_0x277510){var _0x5d616b=squel['select']()[_0x4866('0x4')]('ui.'+_0x201134+_0x4866('0x7c'),'id')[_0x4866('0x4')](_0x4866('0x7d'))[_0x4866('0x7e')](_0x4866('0x7f')+_0x3308b1+_0x4866('0x80'),'ui')[_0x4866('0x81')](_0x4866('0x82'),_0x3f673d['id']);return _0x3bdedc['sequelize'][_0x4866('0x83')](_0x5d616b[_0x4866('0x84')](),_0x36c76b)[_0x4866('0xb')](function(_0x50afa8){_0x3f673d[_0x201134+_0x4866('0x85')]=_0x50afa8;_0x39770d(_0x50afa8);})[_0x4866('0x8')](function(_0x1b6bbb){_0x277510(_0x1b6bbb);});});}return _0x33c95e[_0x4866('0x86')]('UserProfile',attributes,{'tableName':_0x4866('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x537965){var _0x3d7b57=require(_0x4866('0x88'));var _0x38b836={'raw':_0x537965['query']['raw'],'where':{}};var _0x340736={};var _0x17b03e={'count':0x0,'rows':[]};var _0x56076a=_0x537965['query'][_0x4866('0x89')];var _0x4dcefa=_0x537965[_0x4866('0x83')][_0x4866('0x8a')]||![];var _0x14053c=_0x3eabad(_0x56076a,_0x4dcefa);if(!_0x14053c[_0x4866('0x13')])throw new Error(_0x4866('0x8b')+_0x56076a+'\x27');var _0x4b736f=[{'name':_0x56076a}];if(!_['isEmpty'](_0x14053c[_0x4866('0x1d')]))_0x4b736f=_0x14053c[_0x4866('0x1d')];var _0xec6c70=[];for(var _0xbb3adf=0x0;_0xbb3adf<_0x4b736f[_0x4866('0x8c')];_0xbb3adf++){_0xec6c70[_0x4866('0x8d')](_0x3bdedc[_0x4866('0x8e')][_0x4866('0x8f')]({'where':{'userProfileId':_0x537965[_0x4866('0x90')]['id'],'name':_0x4b736f[_0xbb3adf][_0x4866('0xc')]},'raw':!![]}));}return Promise[_0x4866('0x91')](_0xec6c70)[_0x4866('0xb')](function(_0x3b7272){var _0x699064=_[_0x4866('0x3')](_0x3b7272,function(_0x144bcc){return _0x144bcc?_0x144bcc:undefined;});var _0x456b91=_[_0x4866('0x3')](_0x4b736f,[_0x4866('0x92'),!![]]);var _0x339cde=_[_0x4866('0x93')](_0x699064)&&_[_0x4866('0x93')](_0x456b91)?null:_[_0x4866('0x94')](_0x456b91,_0x699064);if(!_0x339cde)return null;var _0x30ed38=[];for(var _0x4f4b94=0x0;_0x4f4b94<_0x339cde[_0x4866('0x8c')];_0x4f4b94++){var _0x286df2=_['find'](_0x4b736f,function(_0x5712c5){return _0x339cde[_0x4f4b94]?_0x5712c5[_0x4866('0xc')]===_0x339cde[_0x4f4b94][_0x4866('0xc')]:null;});if(_0x286df2){if(_0x339cde[_0x4f4b94]['ignore']){_0x30ed38[_0x4866('0x8d')](_0x1374bf(_0x14053c['childModel'],_0x339cde[_0x4f4b94]));}else{if(!_0x339cde[_0x4f4b94][_0x4866('0x95')]){_0x30ed38['push'](_0x5af9b5(_0x286df2,_0x339cde[_0x4f4b94],_0x14053c[_0x4866('0x13')]));}else{if(_0x286df2[_0x4866('0xa')]){_0x30ed38[_0x4866('0x8d')](_0x5f00fb(_0x286df2,_0x339cde[_0x4f4b94]));}}}}}return Promise[_0x4866('0x91')](_0x30ed38);})[_0x4866('0xb')](function(_0x50400f){var _0xcbddc3=_0x50400f;var _0x367ac4=null;if(_0xcbddc3){_0x367ac4=_0xcbddc3[_0x4866('0x8c')]===0x1?_0xcbddc3[0x0]:null;}if(!_0x367ac4&&!_0xcbddc3)return _0x17b03e;var _0x17b14e=_0x3bdedc[_0x14053c[_0x4866('0x13')]][_0x4866('0x96')];_0x340736[_0x4866('0xa')]=_['keys'](_0x17b14e);_0x340736['query']=_[_0x4866('0x97')](_0x537965[_0x4866('0x83')]);_0x340736[_0x4866('0x98')]=_[_0x4866('0x99')](_0x340736[_0x4866('0xa')],_0x340736[_0x4866('0x83')]);_0x38b836[_0x4866('0x9a')]=_[_0x4866('0x99')](_0x340736[_0x4866('0xa')],_0x3d7b57['fields'](_0x537965['query']['fields']));_0x38b836['attributes']=_0x38b836['attributes']['length']?_0x38b836['attributes']:_0x340736[_0x4866('0xa')];if(!_0x537965[_0x4866('0x83')]['hasOwnProperty'](_0x4866('0x9b'))){_0x38b836[_0x4866('0x9c')]=_0x3d7b57[_0x4866('0x9c')](_0x537965[_0x4866('0x83')]['limit']);_0x38b836[_0x4866('0x9d')]=_0x3d7b57[_0x4866('0x9d')](_0x537965[_0x4866('0x83')][_0x4866('0x9d')]);}_0x38b836[_0x4866('0x9e')]=_0x3d7b57[_0x4866('0x9f')](_0x537965[_0x4866('0x83')]['sort']);_0x38b836[_0x4866('0x81')]=_0x3d7b57[_0x4866('0x98')](_[_0x4866('0xa0')](_0x537965['query'],_0x340736[_0x4866('0x98')]));if(_0x537965[_0x4866('0x83')][_0x4866('0x3')]){_0x38b836[_0x4866('0x81')]=_['merge'](_0x38b836[_0x4866('0x81')],{'$or':_['map'](_0x17b14e,function(_0x4b1eff){if(_0x4b1eff[_0x4866('0x10')]['key']!==_0x4866('0xa1')){var _0x8e2543={};_0x8e2543[_0x4b1eff[_0x4866('0x4')]]={'$like':'%'+_0x537965[_0x4866('0x83')][_0x4866('0x3')]+'%'};return _0x8e2543;}})});}var _0x1e867a=[];var _0x31fa4f=null;var _0x439ad1={};if(_0x367ac4){_0x31fa4f=_[_0x4866('0x8f')](_0x4b736f,[_0x4866('0xc'),_0x367ac4[_0x4866('0xc')]]);if(_0x31fa4f[_0x4866('0x4')]){_0x439ad1={};if(_0x14053c[_0x4866('0x13')]===_0x4866('0xe')){_0x439ad1[_0x31fa4f[_0x4866('0xa2')]]=_[_0x4866('0x7')](_0x367ac4[_0x4866('0x6')],'id');}else{_0x439ad1[_0x31fa4f['foreignKey']]=_0x367ac4['associatedResources'];}_0x1e867a[_0x4866('0x8d')](_0x439ad1);}else{_0x38b836[_0x4866('0x81')]['id']=_0x367ac4[_0x4866('0x6')];}}else{for(var _0x38c0d6=0x0;_0x38c0d6<_0xcbddc3[_0x4866('0x8c')];_0x38c0d6++){_0x31fa4f=_[_0x4866('0x8f')](_0x4b736f,[_0x4866('0xc'),_0xcbddc3[_0x38c0d6][_0x4866('0xc')]]);if(_0x31fa4f['field']){_0x439ad1={};_0x439ad1[_0x31fa4f[_0x4866('0xa2')]]=_0xcbddc3[_0x38c0d6][_0x4866('0x6')];_0x1e867a[_0x4866('0x8d')](_0x439ad1);}else{if(!_0x38b836[_0x4866('0x81')]['id'])_0x38b836[_0x4866('0x81')]['id']=[];_0xcbddc3[_0x38c0d6]['associatedResources'][_0x4866('0xa3')](function(_0x2180bd){_0x38b836[_0x4866('0x81')]['id']['push'](_0x2180bd);});}}}if(!_[_0x4866('0x93')](_0x1e867a)){_0x38b836[_0x4866('0x81')]=_[_0x4866('0xa4')](_0x38b836[_0x4866('0x81')],{'$and':{'$or':_0x1e867a}});}_0x38b836=_[_0x4866('0xa4')]({},_0x38b836,_0x537965[_0x4866('0xa5')]);if(_0x367ac4&&!_0x367ac4['autoAssociation']&&_0x14053c['childModel']==='AnalyticExtractedReport'){if(_0x537965['query'][_0x4866('0xa6')]){_0x38b836['include']=[{'all':!![]}];}return _0x3bdedc[_0x14053c['childModel']]['findAll'](_0x38b836)[_0x4866('0xb')](function(_0x2961a3){var _0x276645=[];_0x2961a3['forEach'](function(_0x56c46d){var _0x777184;switch(_0x56c46d['reportType']){case _0x4866('0xa7'):_0x777184=_[_0x4866('0x8f')](_0x367ac4[_0x4866('0x6')],function(_0x39b787){return _0x39b787['id']===_0x56c46d[_0x4866('0x76')]&&_0x39b787['type']==='DefaultReports';});break;case _0x4866('0xa8'):_0x777184=_[_0x4866('0x8f')](_0x367ac4[_0x4866('0x6')],function(_0x5d68e0){return _0x5d68e0['id']===_0x56c46d['reportId']&&_0x5d68e0[_0x4866('0x10')]===_0x4866('0xa9');});break;}if(_0x777184)_0x276645[_0x4866('0x8d')](_0x56c46d);});_0x17b03e[_0x4866('0xaa')]=_0x276645[_0x4866('0x8c')];_0x17b03e[_0x4866('0xab')]=_0x276645;return _0x17b03e;});}else{if(!_['isEmpty'](_0x537965[_0x4866('0x83')]['ids'])){_0x38b836[_0x4866('0x81')]['id']=_0x38b836['where']['id']?_[_0x4866('0x99')](_0x38b836['where']['id'],_0x537965['query'][_0x4866('0xac')]):_0x537965[_0x4866('0x83')][_0x4866('0xac')];if(_0x537965['query'][_0x4866('0xad')]){_0x38b836[_0x4866('0x9e')]=_0x537965[_0x4866('0x83')][_0x4866('0xad')];}}if(_0x537965['query'][_0x4866('0xae')]){_0x38b836['where']=_['merge'](_0x38b836[_0x4866('0x81')],{'$and':_0x537965[_0x4866('0x83')][_0x4866('0xae')]});}return _0x3bdedc[_0x14053c[_0x4866('0x13')]][_0x4866('0xaa')]({'where':_0x38b836[_0x4866('0x81')]})[_0x4866('0xb')](function(_0x219b37){_0x17b03e[_0x4866('0xaa')]=_0x219b37;if(_0x537965['query']['includeAll']){if(_0x14053c['childModel']==='CmContact'){_0x38b836[_0x4866('0xaf')]=[{'model':_0x3bdedc['Tag'],'as':_0x4866('0xb0'),'attributes':['id',_0x4866('0xc'),_0x4866('0xb1')],'required':_0x537965['query'][_0x4866('0xb2')]?!![]:![]},{'model':_0x3bdedc[_0x4866('0xb3')],'as':'ThroughTags','attributes':['id',_0x4866('0xc'),_0x4866('0xb1')],'through':_0x537965['query']['tag']?{'attributes':[],'where':{'TagId':_0x537965[_0x4866('0x83')][_0x4866('0xb2')]||undefined}}:{},'required':_0x537965[_0x4866('0x83')][_0x4866('0xb2')]?!![]:![]}];}else{_0x38b836['include']=[{'all':!![]}];}}return _0x3bdedc[_0x14053c[_0x4866('0x13')]][_0x4866('0x5')](_0x38b836);})[_0x4866('0xb')](function(_0x26c71f){_0x17b03e[_0x4866('0xab')]=_0x26c71f;if(_0x56076a===_0x4866('0x33')&&_0x537965[_0x4866('0x83')][_0x4866('0xb4')]===_0x4866('0xb5')){var _0x241e52=[];for(var _0x4ac2a2=0x0;_0x4ac2a2<_0x17b03e[_0x4866('0xab')]['length'];_0x4ac2a2++){_0x241e52[_0x4866('0x8d')](_0x530b1b('chat',_0x17b03e[_0x4866('0xab')][_0x4ac2a2]['dataValues']));_0x241e52[_0x4866('0x8d')](_0x530b1b('sms',_0x17b03e['rows'][_0x4ac2a2][_0x4866('0xb6')]));_0x241e52['push'](_0x530b1b(_0x4866('0xb7'),_0x17b03e[_0x4866('0xab')][_0x4ac2a2]['dataValues']));_0x241e52[_0x4866('0x8d')](_0x530b1b(_0x4866('0xb8'),_0x17b03e[_0x4866('0xab')][_0x4ac2a2][_0x4866('0xb6')]));_0x241e52['push'](_0x530b1b(_0x4866('0xb9'),_0x17b03e[_0x4866('0xab')][_0x4ac2a2][_0x4866('0xb6')]));_0x241e52[_0x4866('0x8d')](_0x530b1b(_0x4866('0xba'),_0x17b03e[_0x4866('0xab')][_0x4ac2a2][_0x4866('0xb6')]));}return Promise[_0x4866('0x91')](_0x241e52)['then'](function(){return _0x17b03e;});}return _0x17b03e;});}});}}});}; \ No newline at end of file +var _0xc41d=['FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','all','ignore','union','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','find','foreignKey','forEach','options','autoAssociation','includeAll','include','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','associatedResources','catch','value','model','findAll','then','name','resolve','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','contexts','voicemails','membername','User','role','telephone','VoiceQueues','VoiceQueue','queue','outbound','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','users','Users','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0xc41d,0x6a));var _0xdc41=function(_0x24442f,_0x2fe48b){_0x24442f=_0x24442f-0x0;var _0x41c2e3=_0xc41d[_0x24442f];return _0x41c2e3;};'use strict';var _=require(_0xdc41('0x0'));var attributes=require(_0xdc41('0x1'));var squel=require(_0xdc41('0x2'));module[_0xdc41('0x3')]=function(_0x16f657){var _0x4e8770=_0x16f657[_0xdc41('0x4')];function _0x123829(_0x22991c,_0x4f671e){return new Promise(function(_0xda6eb9,_0x709b6d){if(!_0x4f671e)return _0xda6eb9(null);var _0x1b024d=_0x4f671e[_0xdc41('0x5')]?{[_0x4f671e['filter'][_0xdc41('0x6')]]:_0x4f671e['filter']['value']}:undefined;return _0x4e8770[_0x22991c]['findAll']({'where':_0x1b024d,'raw':!![]})['then'](function(_0x2acc85){_0x4f671e[_0xdc41('0x7')]=_['map'](_0x2acc85,'id');_0xda6eb9(_0x4f671e);})[_0xdc41('0x8')](function(_0x565a0f){_0x709b6d(_0x565a0f);});});}function _0x3a4da9(_0x5e80e3,_0x33dd10){return new Promise(function(_0x52732e,_0x2ba5a2){var _0x311262=_0x5e80e3['filter']?{[_0x5e80e3[_0xdc41('0x5')]['field']]:_0x5e80e3[_0xdc41('0x5')][_0xdc41('0x9')]}:undefined;return _0x4e8770[_0x5e80e3[_0xdc41('0xa')]][_0xdc41('0xb')]({'where':_0x311262,'raw':!![]})[_0xdc41('0xc')](function(_0x1a7f25){_0x33dd10[_0xdc41('0x7')]=_['map'](_0x1a7f25,function(_0x347a93){return _0x347a93[_0xdc41('0xd')];});_0x52732e(_0x33dd10);})['catch'](function(_0x27307e){_0x2ba5a2(_0x27307e);});});}function _0xc61204(_0x3cc43e,_0x3dd411,_0x434c8d){if(!_0x3dd411)return Promise[_0xdc41('0xe')](null);return new Promise(function(_0x44adf2,_0x23812a){return _0x4e8770['UserProfileResource'][_0xdc41('0xb')]({'where':{'sectionId':_0x3dd411['id']},'raw':!![]})[_0xdc41('0xc')](function(_0x1fd3d8){if(_0x3cc43e[_0xdc41('0x6')]&&_0x3cc43e[_0xdc41('0x6')]!=='id'){_0x3dd411[_0xdc41('0x7')]=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x7190a6){return _0x7190a6[_0x3cc43e[_0xdc41('0x6')]];});}else{if(_0x434c8d===_0xdc41('0x10')){_0x3dd411[_0xdc41('0x7')]=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x22aeea){return{'id':_0x22aeea[_0xdc41('0x11')],'type':_0x22aeea[_0xdc41('0x12')]};});}else{_0x3dd411['associatedResources']=_[_0xdc41('0xf')](_0x1fd3d8,function(_0x5c6912){return _0x5c6912[_0xdc41('0x11')];});}}_0x44adf2(_0x3dd411);})['catch'](function(_0x272f54){_0x23812a(_0x272f54);});});}function _0x399a71(_0x27b226,_0x5c6a8f){var _0x508c5e={'parentSections':[]};switch(_0x27b226[_0xdc41('0x13')]()){case _0xdc41('0x14'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x16');break;case _0xdc41('0x17'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x18');break;case _0xdc41('0x19'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x1a');_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x1c'),'field':'name','foreignKey':_0xdc41('0x1d')}];break;case _0xdc41('0x1e'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x1f');break;case _0xdc41('0x20'):_0x508c5e['childModel']=_0xdc41('0x21');_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x22'),'field':'id','foreignKey':'ListId'}];break;case _0xdc41('0x23'):_0x508c5e['childModel']=_0xdc41('0x24');break;case'companies':_0x508c5e[_0xdc41('0x15')]='CmCompany';break;case'globalcustomfields':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x25');break;case _0xdc41('0x26'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x27');break;case _0xdc41('0x28'):_0x508c5e['childModel']=_0xdc41('0x29');break;case _0xdc41('0x2a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x2b');break;case _0xdc41('0x2c'):_0x508c5e[_0xdc41('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0xdc41('0x2d'):_0x508c5e['childModel']=_0xdc41('0x2e');break;case _0xdc41('0x2f'):_0x508c5e[_0xdc41('0x15')]='VoiceContext';break;case _0xdc41('0x30'):_0x508c5e[_0xdc41('0x15')]='VoiceMail';break;case'voicerecordings':_0x508c5e[_0xdc41('0x15')]='VoiceRecording';_0x508c5e[_0xdc41('0x1b')]=[{'name':'Agents','field':_0xdc41('0xd'),'foreignKey':_0xdc41('0x31'),'model':_0xdc41('0x32'),'filter':{'field':_0xdc41('0x33'),'value':['agent']}},{'name':'Telephones','field':'name','foreignKey':_0xdc41('0x31'),'model':_0xdc41('0x32'),'filter':{'field':'role','value':[_0xdc41('0x34')]}},{'name':_0xdc41('0x35'),'field':_0xdc41('0xd'),'foreignKey':'queue','model':_0xdc41('0x36'),'filter':{'field':_0xdc41('0x12'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xdc41('0xd'),'foreignKey':_0xdc41('0x37'),'model':'VoiceQueue','filter':{'field':_0xdc41('0x12'),'value':[_0xdc41('0x38')]}}];break;case'musiconholds':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x39');break;case'chanspies':_0x508c5e['childModel']='VoiceChanSpy';break;case _0xdc41('0x3a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3b');break;case _0xdc41('0x3c'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3d');break;case _0xdc41('0x3e'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x3f');break;case _0xdc41('0x40'):_0x508c5e[_0xdc41('0x15')]='MailAccount';break;case'mailsubstatuses':_0x508c5e['childModel']=_0xdc41('0x41');break;case _0xdc41('0x42'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x43');break;case _0xdc41('0x44'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x45');break;case _0xdc41('0x46'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x47');break;case _0xdc41('0x48'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x49');break;case _0xdc41('0x4a'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x4b');break;case'whatsappaccounts':_0x508c5e['childModel']=_0xdc41('0x4c');break;case _0xdc41('0x4d'):_0x508c5e['childModel']=_0xdc41('0x4e');break;case _0xdc41('0x4f'):case'queuecampaigns':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x36');if(_0x5c6a8f){_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x35')},{'name':_0xdc41('0x50')}];}break;case _0xdc41('0x51'):case'agents':case'telephones':_0x508c5e[_0xdc41('0x15')]='User';if(_0x5c6a8f){_0x508c5e[_0xdc41('0x1b')]=[{'name':_0xdc41('0x52'),'filter':{'field':_0xdc41('0x33'),'value':[_0xdc41('0x53'),_0xdc41('0x54')]},'ignore':!![]},{'name':_0xdc41('0x55')},{'name':_0xdc41('0x56')}];}break;case _0xdc41('0x57'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x58');break;case _0xdc41('0x59'):_0x508c5e[_0xdc41('0x15')]='SalesforceAccount';break;case'freshdeskaccounts':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x5a');break;case _0xdc41('0x5b'):_0x508c5e['childModel']=_0xdc41('0x5c');break;case _0xdc41('0x5d'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x5e');break;case _0xdc41('0x5f'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x60');break;case _0xdc41('0x61'):_0x508c5e[_0xdc41('0x15')]='User';break;case'cannedanswers':_0x508c5e['childModel']=_0xdc41('0x62');break;case _0xdc41('0x63'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x64');break;case _0xdc41('0x65'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x66');break;case _0xdc41('0x67'):_0x508c5e['childModel']=_0xdc41('0x68');break;case _0xdc41('0x69'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x6a');break;case _0xdc41('0x6b'):_0x508c5e['childModel']=_0xdc41('0x6c');break;case _0xdc41('0x6d'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x6e');break;case _0xdc41('0x6f'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x70');break;case _0xdc41('0x71'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x72');break;case _0xdc41('0x73'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x74');break;case _0xdc41('0x75'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x76');break;case'variables':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x77');break;case _0xdc41('0x78'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x79');break;case'extractedreports':_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x10');_0x508c5e['parentSections']=[{'name':_0xdc41('0x7a'),'field':'id','foreignKey':_0xdc41('0x7b')}];break;case _0xdc41('0x7c'):_0x508c5e[_0xdc41('0x15')]=_0xdc41('0x7d');break;}return _0x508c5e;}function _0x33c570(_0x400eb8,_0x586a1f){var _0x3fcaa8=_0x400eb8[_0xdc41('0x7e')](0x0)[_0xdc41('0x7f')]()+_0x400eb8[_0xdc41('0x80')](0x1);var _0x598556={'type':_0x4e8770['Sequelize'][_0xdc41('0x81')][_0xdc41('0x82')],'raw':!![]};return new Promise(function(_0x1c56bb,_0x40864b){var _0x347f3d=squel[_0xdc41('0x83')]()[_0xdc41('0x6')](_0xdc41('0x84')+_0x3fcaa8+_0xdc41('0x85'),'id')[_0xdc41('0x6')](_0xdc41('0x86'))[_0xdc41('0x87')](_0xdc41('0x88')+_0x400eb8+'_interactions','ui')[_0xdc41('0x89')](_0xdc41('0x8a'),_0x586a1f['id']);return _0x4e8770[_0xdc41('0x8b')][_0xdc41('0x8c')](_0x347f3d[_0xdc41('0x8d')](),_0x598556)[_0xdc41('0xc')](function(_0x441d3a){_0x586a1f[_0x3fcaa8+_0xdc41('0x8e')]=_0x441d3a;_0x1c56bb(_0x441d3a);})[_0xdc41('0x8')](function(_0x460fd4){_0x40864b(_0x460fd4);});});}return _0x16f657[_0xdc41('0x8f')](_0xdc41('0x90'),attributes,{'tableName':_0xdc41('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4cc3a0){var _0x1ce0e6=require(_0xdc41('0x92'));var _0x42dd10={'raw':_0x4cc3a0[_0xdc41('0x8c')]['raw'],'where':{}};var _0xf15faa={};var _0x5c4d9b={'count':0x0,'rows':[]};var _0x31ddba=_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0x93')];var _0x5f5a05=_0x4cc3a0[_0xdc41('0x8c')]['mergeResources']||![];var _0x24d3df=_0x399a71(_0x31ddba,_0x5f5a05);if(!_0x24d3df[_0xdc41('0x15')])throw new Error(_0xdc41('0x94')+_0x31ddba+'\x27');var _0x390fc4=[{'name':_0x31ddba}];if(!_[_0xdc41('0x95')](_0x24d3df['parentSections']))_0x390fc4=_0x24d3df[_0xdc41('0x1b')];var _0xe6792b=[];for(var _0x3eccb4=0x0;_0x3eccb4<_0x390fc4[_0xdc41('0x96')];_0x3eccb4++){_0xe6792b[_0xdc41('0x97')](_0x4e8770[_0xdc41('0x98')]['find']({'where':{'userProfileId':_0x4cc3a0['params']['id'],'name':_0x390fc4[_0x3eccb4][_0xdc41('0xd')]},'raw':!![]}));}return Promise[_0xdc41('0x99')](_0xe6792b)[_0xdc41('0xc')](function(_0x361d63){var _0x2929d2=_[_0xdc41('0x5')](_0x361d63,function(_0x2121e8){return _0x2121e8?_0x2121e8:undefined;});var _0x2f8b2a=_[_0xdc41('0x5')](_0x390fc4,[_0xdc41('0x9a'),!![]]);var _0x20285c=_[_0xdc41('0x95')](_0x2929d2)&&_['isEmpty'](_0x2f8b2a)?null:_[_0xdc41('0x9b')](_0x2f8b2a,_0x2929d2);if(!_0x20285c)return null;var _0x16255f=[];for(var _0x38a350=0x0;_0x38a350<_0x20285c[_0xdc41('0x96')];_0x38a350++){var _0x5b9581=_['find'](_0x390fc4,function(_0xc7555c){return _0x20285c[_0x38a350]?_0xc7555c[_0xdc41('0xd')]===_0x20285c[_0x38a350][_0xdc41('0xd')]:null;});if(_0x5b9581){if(_0x20285c[_0x38a350][_0xdc41('0x9a')]){_0x16255f[_0xdc41('0x97')](_0x123829(_0x24d3df[_0xdc41('0x15')],_0x20285c[_0x38a350]));}else{if(!_0x20285c[_0x38a350]['autoAssociation']){_0x16255f[_0xdc41('0x97')](_0xc61204(_0x5b9581,_0x20285c[_0x38a350],_0x24d3df[_0xdc41('0x15')]));}else{if(_0x5b9581[_0xdc41('0xa')]){_0x16255f[_0xdc41('0x97')](_0x3a4da9(_0x5b9581,_0x20285c[_0x38a350]));}}}}}return Promise[_0xdc41('0x99')](_0x16255f);})[_0xdc41('0xc')](function(_0x3b0283){var _0x3bcacf=_0x3b0283;var _0x338b12=null;if(_0x3bcacf){_0x338b12=_0x3bcacf[_0xdc41('0x96')]===0x1?_0x3bcacf[0x0]:null;}if(!_0x338b12&&!_0x3bcacf)return _0x5c4d9b;var _0x1794bb=_0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0x9c')];_0xf15faa[_0xdc41('0xa')]=_[_0xdc41('0x9d')](_0x1794bb);_0xf15faa[_0xdc41('0x8c')]=_[_0xdc41('0x9d')](_0x4cc3a0['query']);_0xf15faa[_0xdc41('0x9e')]=_['intersection'](_0xf15faa['model'],_0xf15faa[_0xdc41('0x8c')]);_0x42dd10[_0xdc41('0x9f')]=_[_0xdc41('0xa0')](_0xf15faa[_0xdc41('0xa')],_0x1ce0e6[_0xdc41('0xa1')](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa1')]));_0x42dd10['attributes']=_0x42dd10[_0xdc41('0x9f')]['length']?_0x42dd10[_0xdc41('0x9f')]:_0xf15faa['model'];if(!_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa2')](_0xdc41('0xa3'))){_0x42dd10[_0xdc41('0xa4')]=_0x1ce0e6['limit'](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa4')]);_0x42dd10[_0xdc41('0xa5')]=_0x1ce0e6[_0xdc41('0xa5')](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xa5')]);}_0x42dd10[_0xdc41('0xa6')]=_0x1ce0e6[_0xdc41('0xa7')](_0x4cc3a0['query'][_0xdc41('0xa7')]);_0x42dd10['where']=_0x1ce0e6[_0xdc41('0x9e')](_[_0xdc41('0xa8')](_0x4cc3a0[_0xdc41('0x8c')],_0xf15faa[_0xdc41('0x9e')]));if(_0x4cc3a0['query']['filter']){_0x42dd10[_0xdc41('0x89')]=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$or':_['map'](_0x1794bb,function(_0x4a6d0e){if(_0x4a6d0e[_0xdc41('0x12')][_0xdc41('0xaa')]!=='VIRTUAL'){var _0x16efa7={};_0x16efa7[_0x4a6d0e['field']]={'$like':'%'+_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0x5')]+'%'};return _0x16efa7;}})});}var _0xc6a354=[];var _0x3d0d78=null;var _0x2f05a4={};if(_0x338b12){_0x3d0d78=_[_0xdc41('0xab')](_0x390fc4,['name',_0x338b12[_0xdc41('0xd')]]);if(_0x3d0d78[_0xdc41('0x6')]){_0x2f05a4={};if(_0x24d3df['childModel']===_0xdc41('0x10')){_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_[_0xdc41('0xf')](_0x338b12[_0xdc41('0x7')],'id');}else{_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_0x338b12[_0xdc41('0x7')];}_0xc6a354[_0xdc41('0x97')](_0x2f05a4);}else{_0x42dd10[_0xdc41('0x89')]['id']=_0x338b12[_0xdc41('0x7')];}}else{for(var _0x43f840=0x0;_0x43f840<_0x3bcacf[_0xdc41('0x96')];_0x43f840++){_0x3d0d78=_[_0xdc41('0xab')](_0x390fc4,['name',_0x3bcacf[_0x43f840][_0xdc41('0xd')]]);if(_0x3d0d78[_0xdc41('0x6')]){_0x2f05a4={};_0x2f05a4[_0x3d0d78[_0xdc41('0xac')]]=_0x3bcacf[_0x43f840][_0xdc41('0x7')];_0xc6a354[_0xdc41('0x97')](_0x2f05a4);}else{if(!_0x42dd10[_0xdc41('0x89')]['id'])_0x42dd10[_0xdc41('0x89')]['id']=[];_0x3bcacf[_0x43f840][_0xdc41('0x7')][_0xdc41('0xad')](function(_0x543654){_0x42dd10[_0xdc41('0x89')]['id'][_0xdc41('0x97')](_0x543654);});}}}if(!_[_0xdc41('0x95')](_0xc6a354)){_0x42dd10[_0xdc41('0x89')]=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$and':{'$or':_0xc6a354}});}_0x42dd10=_[_0xdc41('0xa9')]({},_0x42dd10,_0x4cc3a0[_0xdc41('0xae')]);if(_0x338b12&&!_0x338b12[_0xdc41('0xaf')]&&_0x24d3df[_0xdc41('0x15')]===_0xdc41('0x10')){if(_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb0')]){_0x42dd10[_0xdc41('0xb1')]=[{'all':!![]}];}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb')](_0x42dd10)['then'](function(_0x2e6535){var _0x2d5f16=[];_0x2e6535[_0xdc41('0xad')](function(_0xc9ac17){var _0x33de71;switch(_0xc9ac17['reportType']){case _0xdc41('0xb2'):_0x33de71=_[_0xdc41('0xab')](_0x338b12[_0xdc41('0x7')],function(_0x26e9c5){return _0x26e9c5['id']===_0xc9ac17['reportId']&&_0x26e9c5[_0xdc41('0x12')]===_0xdc41('0xb3');});break;case'custom':_0x33de71=_[_0xdc41('0xab')](_0x338b12['associatedResources'],function(_0x363c35){return _0x363c35['id']===_0xc9ac17[_0xdc41('0x7b')]&&_0x363c35[_0xdc41('0x12')]===_0xdc41('0xb4');});break;}if(_0x33de71)_0x2d5f16[_0xdc41('0x97')](_0xc9ac17);});_0x5c4d9b[_0xdc41('0xb5')]=_0x2d5f16[_0xdc41('0x96')];_0x5c4d9b[_0xdc41('0xb6')]=_0x2d5f16;return _0x5c4d9b;});}else{if(!_['isEmpty'](_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb7')])){_0x42dd10[_0xdc41('0x89')]['id']=_0x42dd10[_0xdc41('0x89')]['id']?_[_0xdc41('0xa0')](_0x42dd10[_0xdc41('0x89')]['id'],_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb7')]):_0x4cc3a0['query'][_0xdc41('0xb7')];if(_0x4cc3a0['query'][_0xdc41('0xb8')]){_0x42dd10[_0xdc41('0xa6')]=_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb8')];}}if(_0x4cc3a0[_0xdc41('0x8c')]['extraQueryConditions']){_0x42dd10['where']=_[_0xdc41('0xa9')](_0x42dd10[_0xdc41('0x89')],{'$and':_0x4cc3a0['query'][_0xdc41('0xb9')]});}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb5')]({'where':_0x42dd10['where']})[_0xdc41('0xc')](function(_0x5030d1){_0x5c4d9b[_0xdc41('0xb5')]=_0x5030d1;if(_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xb0')]){if(_0x24d3df[_0xdc41('0x15')]===_0xdc41('0x21')){_0x42dd10[_0xdc41('0xb1')]=[{'model':_0x4e8770[_0xdc41('0x70')],'as':_0xdc41('0xba'),'attributes':['id',_0xdc41('0xd'),_0xdc41('0xbb')],'required':_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbc')]?!![]:![]},{'model':_0x4e8770['Tag'],'as':_0xdc41('0xbd'),'attributes':['id','name',_0xdc41('0xbb')],'through':_0x4cc3a0['query']['tag']?{'attributes':[],'where':{'TagId':_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbc')]||undefined}}:{},'required':_0x4cc3a0[_0xdc41('0x8c')]['tag']?!![]:![]}];}else{_0x42dd10[_0xdc41('0xb1')]=[{'all':!![]}];}}return _0x4e8770[_0x24d3df[_0xdc41('0x15')]][_0xdc41('0xb')](_0x42dd10);})['then'](function(_0x889943){_0x5c4d9b[_0xdc41('0xb6')]=_0x889943;if(_0x31ddba===_0xdc41('0x55')&&_0x4cc3a0[_0xdc41('0x8c')][_0xdc41('0xbe')]==='true'){var _0x553a58=[];for(var _0x5cf38a=0x0;_0x5cf38a<_0x5c4d9b['rows'][_0xdc41('0x96')];_0x5cf38a++){_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xbf'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a]['dataValues']));_0x553a58['push'](_0x33c570('sms',_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));_0x553a58['push'](_0x33c570('fax',_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xc1'),_0x5c4d9b['rows'][_0x5cf38a]['dataValues']));_0x553a58['push'](_0x33c570(_0xdc41('0xc2'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a]['dataValues']));_0x553a58[_0xdc41('0x97')](_0x33c570(_0xdc41('0xc3'),_0x5c4d9b[_0xdc41('0xb6')][_0x5cf38a][_0xdc41('0xc0')]));}return Promise[_0xdc41('0x99')](_0x553a58)[_0xdc41('0xc')](function(){return _0x5c4d9b;});}return _0x5c4d9b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8e1b7ec..9f08ae6 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 _0x804d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util'];(function(_0x5b2ee7,_0x12939f){var _0x12c63e=function(_0x265738){while(--_0x265738){_0x5b2ee7['push'](_0x5b2ee7['shift']());}};_0x12c63e(++_0x12939f);}(_0x804d,0x116));var _0xd804=function(_0x424bd3,_0x8760d8){_0x424bd3=_0x424bd3-0x0;var _0x1fdade=_0x804d[_0x424bd3];return _0x1fdade;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var moment=require(_0xd804('0x2'));var BPromise=require(_0xd804('0x3'));var rs=require(_0xd804('0x4'));var fs=require('fs');var Redis=require(_0xd804('0x5'));var db=require(_0xd804('0x6'))['db'];var utils=require(_0xd804('0x7'));var logger=require('../../config/logger')(_0xd804('0x8'));var config=require(_0xd804('0x9'));var jayson=require(_0xd804('0xa'));var client=jayson[_0xd804('0xb')][_0xd804('0xc')]({'port':0x232a});config[_0xd804('0xd')]=_[_0xd804('0xe')](config[_0xd804('0xd')],{'host':_0xd804('0xf'),'port':0x18eb});var socket=require(_0xd804('0x10'))(new Redis(config[_0xd804('0xd')]));require(_0xd804('0x11'))['register'](socket);function respondWithRpcPromise(_0x321d86,_0x2d2434,_0x46730f){return new BPromise(function(_0xa48fe0,_0x52dbe7){return client['request'](_0x321d86,_0x46730f)[_0xd804('0x12')](function(_0x2ce688){logger['info'](_0xd804('0x13'),_0x2d2434,_0xd804('0x14'));logger['debug'](_0xd804('0x15'),_0x2d2434,_0xd804('0x14'),JSON[_0xd804('0x16')](_0x2ce688));if(_0x2ce688['error']){if(_0x2ce688['error'][_0xd804('0x17')]===0x1f4){logger[_0xd804('0x18')](_0xd804('0x13'),_0x2d2434,_0x2ce688[_0xd804('0x18')][_0xd804('0x19')]);return _0x52dbe7(_0x2ce688['error'][_0xd804('0x19')]);}logger[_0xd804('0x18')]('UserProfile,\x20%s,\x20%s',_0x2d2434,_0x2ce688[_0xd804('0x18')][_0xd804('0x19')]);return _0xa48fe0(_0x2ce688[_0xd804('0x18')]['message']);}else{logger[_0xd804('0x1a')]('UserProfile,\x20%s,\x20%s',_0x2d2434,_0xd804('0x14'));_0xa48fe0(_0x2ce688[_0xd804('0x1b')][_0xd804('0x19')]);}})['catch'](function(_0x33873f){logger[_0xd804('0x18')](_0xd804('0x13'),_0x2d2434,_0x33873f);_0x52dbe7(_0x33873f);});});} \ No newline at end of file +var _0x3d3d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','code','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','moment','randomstring'];(function(_0x29ecb0,_0x3c5ab2){var _0x966f2f=function(_0x35ceb4){while(--_0x35ceb4){_0x29ecb0['push'](_0x29ecb0['shift']());}};_0x966f2f(++_0x3c5ab2);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});config['redis']=_[_0xd3d3('0xc')](config[_0xd3d3('0xd')],{'host':_0xd3d3('0xe'),'port':0x18eb});var socket=require(_0xd3d3('0xf'))(new Redis(config['redis']));require(_0xd3d3('0x10'))[_0xd3d3('0x11')](socket);function respondWithRpcPromise(_0x409e2c,_0x300cba,_0x53cb12){return new BPromise(function(_0x2c523f,_0x44599e){return client[_0xd3d3('0x12')](_0x409e2c,_0x53cb12)[_0xd3d3('0x13')](function(_0x1cd30a){logger[_0xd3d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x300cba,_0xd3d3('0x15'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x300cba,'request\x20sent',JSON[_0xd3d3('0x16')](_0x1cd30a));if(_0x1cd30a['error']){if(_0x1cd30a['error'][_0xd3d3('0x17')]===0x1f4){logger[_0xd3d3('0x18')]('UserProfile,\x20%s,\x20%s',_0x300cba,_0x1cd30a[_0xd3d3('0x18')]['message']);return _0x44599e(_0x1cd30a['error'][_0xd3d3('0x19')]);}logger[_0xd3d3('0x18')](_0xd3d3('0x1a'),_0x300cba,_0x1cd30a[_0xd3d3('0x18')][_0xd3d3('0x19')]);return _0x2c523f(_0x1cd30a['error'][_0xd3d3('0x19')]);}else{logger[_0xd3d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x300cba,'request\x20sent');_0x2c523f(_0x1cd30a[_0xd3d3('0x1b')][_0xd3d3('0x19')]);}})[_0xd3d3('0x1c')](function(_0x5f4031){logger[_0xd3d3('0x18')](_0xd3d3('0x1a'),_0x300cba,_0x5f4031);_0x44599e(_0x5f4031);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4bdb865..fc7cc78 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 _0xb57f=['removeListener','register','userProfile:','./userProfile.events','save','remove'];(function(_0x3da36a,_0x179caf){var _0xca7943=function(_0x1983e3){while(--_0x1983e3){_0x3da36a['push'](_0x3da36a['shift']());}};_0xca7943(++_0x179caf);}(_0xb57f,0x129));var _0xfb57=function(_0x5bb928,_0x3db771){_0x5bb928=_0x5bb928-0x0;var _0x5a4e38=_0xb57f[_0x5bb928];return _0x5a4e38;};'use strict';var UserProfileEvents=require(_0xfb57('0x0'));var events=[_0xfb57('0x1'),_0xfb57('0x2'),'update'];function createListener(_0x3c1a99,_0x4d6552){return function(_0x5ba6e1){_0x4d6552['emit'](_0x3c1a99,_0x5ba6e1);};}function removeListener(_0x4c51e9,_0x454f72){return function(){UserProfileEvents[_0xfb57('0x3')](_0x4c51e9,_0x454f72);};}exports[_0xfb57('0x4')]=function(_0x37b9ee){for(var _0x55d16f=0x0,_0x8eeed3=events['length'];_0x55d16f<_0x8eeed3;_0x55d16f++){var _0x5028e9=events[_0x55d16f];var _0x9d7582=createListener(_0xfb57('0x5')+_0x5028e9,_0x37b9ee);UserProfileEvents['on'](_0x5028e9,_0x9d7582);}}; \ No newline at end of file +var _0xda1c=['length','userProfile:','update','removeListener'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xda1c,0xc6));var _0xcda1=function(_0x1f7971,_0xacefbf){_0x1f7971=_0x1f7971-0x0;var _0x14712f=_0xda1c[_0x1f7971];return _0x14712f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0xcda1('0x0')];function createListener(_0x36766a,_0x29e2c8){return function(_0x20f455){_0x29e2c8['emit'](_0x36766a,_0x20f455);};}function removeListener(_0x4bd019,_0x5dcf29){return function(){UserProfileEvents[_0xcda1('0x1')](_0x4bd019,_0x5dcf29);};}exports['register']=function(_0x4dacad){for(var _0x24a09b=0x0,_0x381d1c=events[_0xcda1('0x2')];_0x24a09b<_0x381d1c;_0x24a09b++){var _0x2768d9=events[_0x24a09b];var _0x793b36=createListener(_0xcda1('0x3')+_0x2768d9,_0x4dacad);UserProfileEvents['on'](_0x2768d9,_0x793b36);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3ea349b..aeeb68b 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 _0xd68a=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update'];(function(_0x1ee7cd,_0x1a314b){var _0x4e0136=function(_0x36c5e7){while(--_0x36c5e7){_0x1ee7cd['push'](_0x1ee7cd['shift']());}};_0x4e0136(++_0x1a314b);}(_0xd68a,0xc3));var _0xad68=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd68a[_0x166d93];return _0xba708;};'use strict';var multer=require(_0xad68('0x0'));var util=require(_0xad68('0x1'));var path=require(_0xad68('0x2'));var timeout=require(_0xad68('0x3'));var express=require(_0xad68('0x4'));var router=express[_0xad68('0x5')]();var fs_extra=require(_0xad68('0x6'));var auth=require(_0xad68('0x7'));var interaction=require(_0xad68('0x8'));var config=require(_0xad68('0x9'));var controller=require(_0xad68('0xa'));router['get']('/',auth[_0xad68('0xb')](),controller[_0xad68('0xc')]);router[_0xad68('0xd')](_0xad68('0xe'),auth['isAuthenticated'](),controller[_0xad68('0xf')]);router[_0xad68('0xd')]('/:id',auth[_0xad68('0xb')](),controller[_0xad68('0x10')]);router['post']('/',auth[_0xad68('0xb')](),controller[_0xad68('0x11')]);router[_0xad68('0x12')](_0xad68('0x13'),auth[_0xad68('0xb')](),controller[_0xad68('0x14')]);router[_0xad68('0x15')]('/:id',auth[_0xad68('0xb')](),controller[_0xad68('0x16')]);module[_0xad68('0x17')]=router; \ No newline at end of file +var _0x6360=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x6360,0xf9));var _0x0636=function(_0x5bcae7,_0x41e7e9){_0x5bcae7=_0x5bcae7-0x0;var _0x59dbca=_0x6360[_0x5bcae7];return _0x59dbca;};'use strict';var multer=require('multer');var util=require(_0x0636('0x0'));var path=require(_0x0636('0x1'));var timeout=require(_0x0636('0x2'));var express=require(_0x0636('0x3'));var router=express['Router']();var fs_extra=require(_0x0636('0x4'));var auth=require(_0x0636('0x5'));var interaction=require(_0x0636('0x6'));var config=require(_0x0636('0x7'));var controller=require('./userProfileResource.controller');router[_0x0636('0x8')]('/',auth['isAuthenticated'](),controller[_0x0636('0x9')]);router[_0x0636('0x8')](_0x0636('0xa'),auth[_0x0636('0xb')](),controller[_0x0636('0xc')]);router[_0x0636('0x8')](_0x0636('0xd'),auth[_0x0636('0xb')](),controller['show']);router[_0x0636('0xe')]('/',auth[_0x0636('0xb')](),controller[_0x0636('0xf')]);router[_0x0636('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0636('0x11')]);router[_0x0636('0x12')](_0x0636('0xd'),auth['isAuthenticated'](),controller[_0x0636('0x13')]);module[_0x0636('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 da81214..3dcfe63 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 _0xc414=['STRING','sequelize','exports'];(function(_0x3799a0,_0x5ee7d1){var _0x426b03=function(_0x3a1bad){while(--_0x3a1bad){_0x3799a0['push'](_0x3799a0['shift']());}};_0x426b03(++_0x5ee7d1);}(_0xc414,0x12d));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c41('0x0'));module[_0x4c41('0x1')]={'name':{'type':Sequelize[_0x4c41('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x4c41('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf42a=['sequelize','exports','STRING','INTEGER'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xf42a,0x19c));var _0xaf42=function(_0x12dc31,_0x363ec5){_0x12dc31=_0x12dc31-0x0;var _0xdce4ca=_0xf42a[_0x12dc31];return _0xdce4ca;};'use strict';var Sequelize=require(_0xaf42('0x0'));module[_0xaf42('0x1')]={'name':{'type':Sequelize[_0xaf42('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xaf42('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xaf42('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1b4d5d3..6ed7a9a 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(_0x53ddcb,_0xc1a547){var _0x48afdb=function(_0x44a795){while(--_0x44a795){_0x53ddcb['push'](_0x53ddcb['shift']());}};_0x48afdb(++_0xc1a547);}(_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 _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d73e32b..5bba8b9 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 _0xad6a=['user_profile_has_resources','resourceId','sectionId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports'];(function(_0x4c637b,_0x326ee8){var _0x5c2e10=function(_0x2674f9){while(--_0x2674f9){_0x4c637b['push'](_0x4c637b['shift']());}};_0x5c2e10(++_0x326ee8);}(_0xad6a,0x6f));var _0xaad6=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xad6a[_0x34843e];return _0x598f7f;};'use strict';var _=require('lodash');var util=require(_0xaad6('0x0'));var logger=require(_0xaad6('0x1'))(_0xaad6('0x2'));var moment=require('moment');var BPromise=require(_0xaad6('0x3'));var rp=require(_0xaad6('0x4'));var fs=require('fs');var path=require(_0xaad6('0x5'));var rimraf=require(_0xaad6('0x6'));var config=require('../../config/environment');var attributes=require(_0xaad6('0x7'));module[_0xaad6('0x8')]=function(_0x1bf3ea,_0x29d73c){return _0x1bf3ea['define']('UserProfileResource',attributes,{'tableName':_0xaad6('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xaad6('0xa'),_0xaad6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6085=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x47fd17,_0x4f7037){var _0x353a4b=function(_0x16badc){while(--_0x16badc){_0x47fd17['push'](_0x47fd17['shift']());}};_0x353a4b(++_0x4f7037);}(_0x6085,0x166));var _0x5608=function(_0x28e351,_0x3ec4d1){_0x28e351=_0x28e351-0x0;var _0x2bab4a=_0x6085[_0x28e351];return _0x2bab4a;};'use strict';var _=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5608('0x2'));var rp=require(_0x5608('0x3'));var fs=require('fs');var path=require(_0x5608('0x4'));var rimraf=require(_0x5608('0x5'));var config=require(_0x5608('0x6'));var attributes=require(_0x5608('0x7'));module[_0x5608('0x8')]=function(_0x56df35,_0x114ce3){return _0x56df35[_0x5608('0x9')](_0x5608('0xa'),attributes,{'tableName':_0x5608('0xb'),'paranoid':![],'indexes':[{'name':_0x5608('0xc'),'fields':[_0x5608('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bea24d6..74d32fd 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 _0xb11d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb11d,0x104));var _0xdb11=function(_0x3d44e9,_0x2e8d17){_0x3d44e9=_0x3d44e9-0x0;var _0x40f2cf=_0xb11d[_0x3d44e9];return _0x40f2cf;};'use strict';var _=require(_0xdb11('0x0'));var util=require(_0xdb11('0x1'));var moment=require(_0xdb11('0x2'));var BPromise=require(_0xdb11('0x3'));var rs=require(_0xdb11('0x4'));var fs=require('fs');var Redis=require(_0xdb11('0x5'));var db=require(_0xdb11('0x6'))['db'];var utils=require(_0xdb11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb11('0x8'));var jayson=require(_0xdb11('0x9'));var client=jayson[_0xdb11('0xa')][_0xdb11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaf9aa,_0xd8f0c1,_0x4ca49c){return new BPromise(function(_0x5bed06,_0x257d95){return client['request'](_0xaf9aa,_0x4ca49c)[_0xdb11('0xc')](function(_0x115e2f){logger['info'](_0xdb11('0xd'),_0xd8f0c1,_0xdb11('0xe'));logger[_0xdb11('0xf')](_0xdb11('0x10'),_0xd8f0c1,_0xdb11('0xe'),JSON[_0xdb11('0x11')](_0x115e2f));if(_0x115e2f[_0xdb11('0x12')]){if(_0x115e2f[_0xdb11('0x12')]['code']===0x1f4){logger[_0xdb11('0x12')](_0xdb11('0xd'),_0xd8f0c1,_0x115e2f[_0xdb11('0x12')][_0xdb11('0x13')]);return _0x257d95(_0x115e2f['error']['message']);}logger['error'](_0xdb11('0xd'),_0xd8f0c1,_0x115e2f[_0xdb11('0x12')][_0xdb11('0x13')]);return _0x5bed06(_0x115e2f['error'][_0xdb11('0x13')]);}else{logger[_0xdb11('0x14')](_0xdb11('0xd'),_0xd8f0c1,_0xdb11('0xe'));_0x5bed06(_0x115e2f['result']['message']);}})[_0xdb11('0x15')](function(_0x482035){logger[_0xdb11('0x12')](_0xdb11('0xd'),_0xd8f0c1,_0x482035);_0x257d95(_0x482035);});});} \ No newline at end of file +var _0x93e9=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x1a14ce,_0x12507a){var _0x172e1c=function(_0x315065){while(--_0x315065){_0x1a14ce['push'](_0x1a14ce['shift']());}};_0x172e1c(++_0x12507a);}(_0x93e9,0xcc));var _0x993e=function(_0x2af004,_0x279c55){_0x2af004=_0x2af004-0x0;var _0x5c5442=_0x93e9[_0x2af004];return _0x5c5442;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6a71cac..ef1710f 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 _0xa56c=['exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy'];(function(_0x834ab7,_0x2a0429){var _0x5eddc5=function(_0x1315df){while(--_0x1315df){_0x834ab7['push'](_0x834ab7['shift']());}};_0x5eddc5(++_0x2a0429);}(_0xa56c,0xbf));var _0xca56=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xa56c[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xca56('0x0'));var util=require(_0xca56('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca56('0x2'));var router=express['Router']();var fs_extra=require(_0xca56('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xca56('0x4'));var config=require(_0xca56('0x5'));var controller=require(_0xca56('0x6'));router[_0xca56('0x7')]('/',auth[_0xca56('0x8')](),controller[_0xca56('0x9')]);router[_0xca56('0x7')](_0xca56('0xa'),auth[_0xca56('0x8')](),controller[_0xca56('0xb')]);router[_0xca56('0x7')](_0xca56('0xc'),auth['isAuthenticated'](),controller[_0xca56('0xd')]);router[_0xca56('0xe')]('/',auth[_0xca56('0x8')](),controller['create']);router[_0xca56('0xf')](_0xca56('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xca56('0x10')](_0xca56('0xc'),auth[_0xca56('0x8')](),controller[_0xca56('0x11')]);module[_0xca56('0x12')]=router; \ No newline at end of file +var _0xf38b=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller'];(function(_0x22390f,_0x377090){var _0x29d641=function(_0x4c0eff){while(--_0x4c0eff){_0x22390f['push'](_0x22390f['shift']());}};_0x29d641(++_0x377090);}(_0xf38b,0x1db));var _0xbf38=function(_0x3d31af,_0x1b667d){_0x3d31af=_0x3d31af-0x0;var _0x29cd78=_0xf38b[_0x3d31af];return _0x29cd78;};'use strict';var multer=require(_0xbf38('0x0'));var util=require('util');var path=require(_0xbf38('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf38('0x2'));var router=express[_0xbf38('0x3')]();var fs_extra=require(_0xbf38('0x4'));var auth=require(_0xbf38('0x5'));var interaction=require(_0xbf38('0x6'));var config=require('../../config/environment');var controller=require(_0xbf38('0x7'));router[_0xbf38('0x8')]('/',auth[_0xbf38('0x9')](),controller[_0xbf38('0xa')]);router[_0xbf38('0x8')](_0xbf38('0xb'),auth['isAuthenticated'](),controller[_0xbf38('0xc')]);router[_0xbf38('0x8')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0xe')]);router[_0xbf38('0xf')]('/',auth[_0xbf38('0x9')](),controller[_0xbf38('0x10')]);router[_0xbf38('0x11')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0x12')]);router[_0xbf38('0x13')](_0xbf38('0xd'),auth[_0xbf38('0x9')](),controller[_0xbf38('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3039919..ca66560 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 _0x0fd9=['join','getDataValue','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x16fdb0,_0xdfd50e){var _0x1f0084=function(_0x24c3d3){while(--_0x24c3d3){_0x16fdb0['push'](_0x16fdb0['shift']());}};_0x1f0084(++_0xdfd50e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x0fd9[_0x228ac9];return _0x69fe02;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'name':{'type':Sequelize[_0x90fd('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x90fd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x90fd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x90fd('0x1')],'set':function(_0x2a5f76){this[_0x90fd('0x3')](_0x90fd('0x4'),_0x2a5f76?_0x2a5f76[_0x90fd('0x5')](''):[]);},'get':function(){return this[_0x90fd('0x6')]('crudPermissions')?this['getDataValue'](_0x90fd('0x4'))['split'](''):[];}}}; \ No newline at end of file +var _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x69d3,0xda));var _0x369d=function(_0x53e41d,_0x472323){_0x53e41d=_0x53e41d-0x0;var _0x472353=_0x69d3[_0x53e41d];return _0x472353;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7194442..5af3e71 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 _0xde12=['options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','merge'];(function(_0x2e0d30,_0x69dd2e){var _0x25ab1a=function(_0x3f0539){while(--_0x3f0539){_0x2e0d30['push'](_0x2e0d30['shift']());}};_0x25ab1a(++_0x69dd2e);}(_0xde12,0x126));var _0x2de1=function(_0x4b931c,_0x48b0cb){_0x4b931c=_0x4b931c-0x0;var _0x2bc6c1=_0xde12[_0x4b931c];return _0x2bc6c1;};'use strict';var emlformat=require(_0x2de1('0x0'));var rimraf=require(_0x2de1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2de1('0x2'));var rp=require(_0x2de1('0x3'));var moment=require(_0x2de1('0x4'));var BPromise=require(_0x2de1('0x5'));var Mustache=require('mustache');var util=require(_0x2de1('0x6'));var path=require(_0x2de1('0x7'));var sox=require(_0x2de1('0x8'));var csv=require(_0x2de1('0x9'));var ejs=require(_0x2de1('0xa'));var fs=require('fs');var fs_extra=require(_0x2de1('0xb'));var _=require(_0x2de1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2de1('0xd'));var deskjs=require(_0x2de1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2de1('0xf'));var Redis=require(_0x2de1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2de1('0x11'));var hardwareService=require(_0x2de1('0x12'));var logger=require(_0x2de1('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2de1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a6070,_0x310146){_0x310146=_0x310146||0xcc;return function(_0x2ab598){if(_0x2ab598){return _0x5a6070[_0x2de1('0x15')](_0x310146);}return _0x5a6070['status'](_0x310146)[_0x2de1('0x16')]();};}function respondWithResult(_0x18cb4a,_0x5d075c){_0x5d075c=_0x5d075c||0xc8;return function(_0x18eae0){if(_0x18eae0){return _0x18cb4a[_0x2de1('0x17')](_0x5d075c)[_0x2de1('0x18')](_0x18eae0);}};}function respondWithFilteredResult(_0x557ed8,_0x2ad3a7){return function(_0x244bf8){if(_0x244bf8){var _0x53da74=typeof _0x2ad3a7[_0x2de1('0x19')]===_0x2de1('0x1a')&&typeof _0x2ad3a7[_0x2de1('0x1b')]===_0x2de1('0x1a');var _0x2d81b2=_0x244bf8[_0x2de1('0x1c')];var _0x247e85=_0x53da74?0x0:_0x2ad3a7['offset'];var _0x47579e=_0x53da74?_0x244bf8[_0x2de1('0x1c')]:_0x2ad3a7['offset']+_0x2ad3a7[_0x2de1('0x1b')];var _0x1a97e0;if(_0x47579e>=_0x2d81b2){_0x47579e=_0x2d81b2;_0x1a97e0=0xc8;}else{_0x1a97e0=0xce;}_0x557ed8['status'](_0x1a97e0);return _0x557ed8[_0x2de1('0x1d')](_0x2de1('0x1e'),_0x247e85+'-'+_0x47579e+'/'+_0x2d81b2)['json'](_0x244bf8);}return null;};}function patchUpdates(_0x24e729){return function(_0x42a109){try{jsonpatch['apply'](_0x42a109,_0x24e729,!![]);}catch(_0x3f18f9){return BPromise['reject'](_0x3f18f9);}return _0x42a109[_0x2de1('0x1f')]();};}function saveUpdates(_0x4678a1,_0x170c3a){return function(_0x175713){if(_0x175713){return _0x175713[_0x2de1('0x20')](_0x4678a1)[_0x2de1('0x21')](function(_0x2d741b){return _0x2d741b;});}return null;};}function removeEntity(_0xe45fe9,_0x383648){return function(_0x49a2f7){if(_0x49a2f7){return _0x49a2f7['destroy']()[_0x2de1('0x21')](function(){_0xe45fe9['status'](0xcc)[_0x2de1('0x16')]();});}};}function handleEntityNotFound(_0x13ce56,_0xea4752){return function(_0x540702){if(!_0x540702){_0x13ce56[_0x2de1('0x15')](0x194);}return _0x540702;};}function handleError(_0x7dfc0d,_0x45a64d){_0x45a64d=_0x45a64d||0x1f4;return function(_0x2fd59e){logger[_0x2de1('0x22')](_0x2fd59e[_0x2de1('0x23')]);if(_0x2fd59e[_0x2de1('0x24')]){delete _0x2fd59e[_0x2de1('0x24')];}_0x7dfc0d[_0x2de1('0x17')](_0x45a64d)[_0x2de1('0x25')](_0x2fd59e);};}exports['index']=function(_0xd8de81,_0x2fa52f){var _0x1830c0={},_0x3b5bc9={},_0x5e3d96={'count':0x0,'rows':[]};var _0x5b0bb6=_[_0x2de1('0x26')](db[_0x2de1('0x27')][_0x2de1('0x28')],function(_0x170e34){return{'name':_0x170e34[_0x2de1('0x29')],'type':_0x170e34[_0x2de1('0x2a')][_0x2de1('0x2b')]};});_0x3b5bc9[_0x2de1('0x2c')]=_[_0x2de1('0x26')](_0x5b0bb6,_0x2de1('0x24'));_0x3b5bc9[_0x2de1('0x2d')]=_['keys'](_0xd8de81[_0x2de1('0x2d')]);_0x3b5bc9[_0x2de1('0x2e')]=_[_0x2de1('0x2f')](_0x3b5bc9['model'],_0x3b5bc9[_0x2de1('0x2d')]);_0x1830c0['attributes']=_[_0x2de1('0x2f')](_0x3b5bc9[_0x2de1('0x2c')],qs[_0x2de1('0x30')](_0xd8de81['query'][_0x2de1('0x30')]));_0x1830c0[_0x2de1('0x31')]=_0x1830c0[_0x2de1('0x31')]['length']?_0x1830c0[_0x2de1('0x31')]:_0x3b5bc9[_0x2de1('0x2c')];if(!_0xd8de81[_0x2de1('0x2d')][_0x2de1('0x32')](_0x2de1('0x33'))){_0x1830c0['limit']=qs[_0x2de1('0x1b')](_0xd8de81['query']['limit']);_0x1830c0['offset']=qs['offset'](_0xd8de81[_0x2de1('0x2d')][_0x2de1('0x19')]);}_0x1830c0[_0x2de1('0x34')]=qs[_0x2de1('0x35')](_0xd8de81[_0x2de1('0x2d')][_0x2de1('0x35')]);_0x1830c0[_0x2de1('0x36')]=qs[_0x2de1('0x2e')](_['pick'](_0xd8de81[_0x2de1('0x2d')],_0x3b5bc9['filters']),_0x5b0bb6);if(_0xd8de81[_0x2de1('0x2d')][_0x2de1('0x37')]){_0x1830c0['where']=_['merge'](_0x1830c0[_0x2de1('0x36')],{'$or':_[_0x2de1('0x26')](_0x5b0bb6,function(_0x586f02){if(_0x586f02[_0x2de1('0x2a')]!==_0x2de1('0x38')){var _0x127d1c={};_0x127d1c[_0x586f02[_0x2de1('0x24')]]={'$like':'%'+_0xd8de81[_0x2de1('0x2d')]['filter']+'%'};return _0x127d1c;}})});}_0x1830c0=_['merge']({},_0x1830c0,_0xd8de81['options']);var _0x34bb69={'where':_0x1830c0[_0x2de1('0x36')]};return db[_0x2de1('0x27')]['count'](_0x34bb69)[_0x2de1('0x21')](function(_0x1de7ff){_0x5e3d96[_0x2de1('0x1c')]=_0x1de7ff;if(_0xd8de81['query'][_0x2de1('0x39')]){_0x1830c0['include']=[{'all':!![]}];}return db[_0x2de1('0x27')][_0x2de1('0x3a')](_0x1830c0);})[_0x2de1('0x21')](function(_0xebfc0f){_0x5e3d96[_0x2de1('0x3b')]=_0xebfc0f;return _0x5e3d96;})['then'](respondWithFilteredResult(_0x2fa52f,_0x1830c0))[_0x2de1('0x3c')](handleError(_0x2fa52f,null));};exports[_0x2de1('0x3d')]=function(_0x1e4e95,_0x38ce83){var _0x506f5e={'raw':![],'where':{'id':_0x1e4e95[_0x2de1('0x3e')]['id']}},_0xd37651={};_0xd37651['model']=_[_0x2de1('0x3f')](db[_0x2de1('0x27')][_0x2de1('0x28')]);_0xd37651[_0x2de1('0x2d')]=_[_0x2de1('0x3f')](_0x1e4e95[_0x2de1('0x2d')]);_0xd37651[_0x2de1('0x2e')]=_[_0x2de1('0x2f')](_0xd37651['model'],_0xd37651[_0x2de1('0x2d')]);_0x506f5e['attributes']=_[_0x2de1('0x2f')](_0xd37651[_0x2de1('0x2c')],qs[_0x2de1('0x30')](_0x1e4e95[_0x2de1('0x2d')][_0x2de1('0x30')]));_0x506f5e[_0x2de1('0x31')]=_0x506f5e[_0x2de1('0x31')]['length']?_0x506f5e[_0x2de1('0x31')]:_0xd37651[_0x2de1('0x2c')];if(_0x1e4e95[_0x2de1('0x2d')][_0x2de1('0x39')]){_0x506f5e[_0x2de1('0x40')]=[{'all':!![]}];}_0x506f5e=_[_0x2de1('0x41')]({},_0x506f5e,_0x1e4e95[_0x2de1('0x42')]);return db[_0x2de1('0x27')][_0x2de1('0x43')](_0x506f5e)['then'](handleEntityNotFound(_0x38ce83,null))[_0x2de1('0x21')](respondWithResult(_0x38ce83,null))['catch'](handleError(_0x38ce83,null));};exports[_0x2de1('0x44')]=function(_0x58f112,_0x75434e){return db[_0x2de1('0x27')][_0x2de1('0x44')](_0x58f112[_0x2de1('0x45')],{})['then'](respondWithResult(_0x75434e,0xc9))[_0x2de1('0x3c')](handleError(_0x75434e,null));};exports['update']=function(_0xb7bce7,_0x2344f5){if(_0xb7bce7[_0x2de1('0x45')]['id']){delete _0xb7bce7[_0x2de1('0x45')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0xb7bce7[_0x2de1('0x3e')]['id']}})[_0x2de1('0x21')](handleEntityNotFound(_0x2344f5,null))['then'](saveUpdates(_0xb7bce7[_0x2de1('0x45')],null))[_0x2de1('0x21')](respondWithResult(_0x2344f5,null))[_0x2de1('0x3c')](handleError(_0x2344f5,null));};exports[_0x2de1('0x46')]=function(_0x4538b7,_0x3a7630){return db[_0x2de1('0x27')][_0x2de1('0x43')]({'where':{'id':_0x4538b7[_0x2de1('0x3e')]['id']}})[_0x2de1('0x21')](handleEntityNotFound(_0x3a7630,null))[_0x2de1('0x21')](removeEntity(_0x3a7630,null))[_0x2de1('0x3c')](handleError(_0x3a7630,null));};exports[_0x2de1('0x47')]=function(_0x3091e4,_0x5f46af){return db[_0x2de1('0x27')][_0x2de1('0x47')]()[_0x2de1('0x21')](respondWithResult(_0x5f46af,null))[_0x2de1('0x3c')](handleError(_0x5f46af,null));}; \ No newline at end of file +var _0x4cfd=['limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','UserProfileSection','includeAll','include','rows','show','catch','create','body','update','params','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','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','sendStatus','status','end','json','offset','undefined'];(function(_0x3f3125,_0x3f49d2){var _0x28bf12=function(_0xb9d9cb){while(--_0xb9d9cb){_0x3f3125['push'](_0x3f3125['shift']());}};_0x28bf12(++_0x3f49d2);}(_0x4cfd,0x1ae));var _0xd4cf=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x4cfd[_0x1e081a];return _0x428209;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require(_0xd4cf('0x2'));var jsonpatch=require(_0xd4cf('0x3'));var rp=require(_0xd4cf('0x4'));var moment=require(_0xd4cf('0x5'));var BPromise=require(_0xd4cf('0x6'));var Mustache=require('mustache');var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4cf('0x8'));var fs=require('fs');var fs_extra=require(_0xd4cf('0x9'));var _=require(_0xd4cf('0xa'));var squel=require(_0xd4cf('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xc'));var deskjs=require(_0xd4cf('0xd'));var toCsv=require(_0xd4cf('0xe'));var querystring=require(_0xd4cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xd4cf('0x10'));var authService=require(_0xd4cf('0x11'));var qs=require(_0xd4cf('0x12'));var as=require(_0xd4cf('0x13'));var hardwareService=require(_0xd4cf('0x14'));var logger=require(_0xd4cf('0x15'))(_0xd4cf('0x16'));var utils=require(_0xd4cf('0x17'));var config=require(_0xd4cf('0x18'));var licenseUtil=require(_0xd4cf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1096c4,_0x1b06d9){_0x1b06d9=_0x1b06d9||0xcc;return function(_0x2698b8){if(_0x2698b8){return _0x1096c4[_0xd4cf('0x1a')](_0x1b06d9);}return _0x1096c4[_0xd4cf('0x1b')](_0x1b06d9)[_0xd4cf('0x1c')]();};}function respondWithResult(_0x337822,_0x57eca7){_0x57eca7=_0x57eca7||0xc8;return function(_0xbd6464){if(_0xbd6464){return _0x337822[_0xd4cf('0x1b')](_0x57eca7)[_0xd4cf('0x1d')](_0xbd6464);}};}function respondWithFilteredResult(_0x4e52c2,_0x17ae6a){return function(_0x521925){if(_0x521925){var _0x540f7e=typeof _0x17ae6a[_0xd4cf('0x1e')]===_0xd4cf('0x1f')&&typeof _0x17ae6a[_0xd4cf('0x20')]==='undefined';var _0x1fdf2d=_0x521925[_0xd4cf('0x21')];var _0x2a4a44=_0x540f7e?0x0:_0x17ae6a['offset'];var _0x3f597a=_0x540f7e?_0x521925[_0xd4cf('0x21')]:_0x17ae6a[_0xd4cf('0x1e')]+_0x17ae6a[_0xd4cf('0x20')];var _0x1ce630;if(_0x3f597a>=_0x1fdf2d){_0x3f597a=_0x1fdf2d;_0x1ce630=0xc8;}else{_0x1ce630=0xce;}_0x4e52c2[_0xd4cf('0x1b')](_0x1ce630);return _0x4e52c2[_0xd4cf('0x22')]('Content-Range',_0x2a4a44+'-'+_0x3f597a+'/'+_0x1fdf2d)[_0xd4cf('0x1d')](_0x521925);}return null;};}function patchUpdates(_0x53e119){return function(_0x54d9dd){try{jsonpatch[_0xd4cf('0x23')](_0x54d9dd,_0x53e119,!![]);}catch(_0x1a8149){return BPromise[_0xd4cf('0x24')](_0x1a8149);}return _0x54d9dd[_0xd4cf('0x25')]();};}function saveUpdates(_0x341070,_0x23b2e6){return function(_0x3b3127){if(_0x3b3127){return _0x3b3127['update'](_0x341070)[_0xd4cf('0x26')](function(_0x7105fc){return _0x7105fc;});}return null;};}function removeEntity(_0x11bf9f,_0x27566a){return function(_0x407e44){if(_0x407e44){return _0x407e44['destroy']()[_0xd4cf('0x26')](function(){_0x11bf9f[_0xd4cf('0x1b')](0xcc)[_0xd4cf('0x1c')]();});}};}function handleEntityNotFound(_0x3fdd64,_0x473410){return function(_0x2a6f71){if(!_0x2a6f71){_0x3fdd64[_0xd4cf('0x1a')](0x194);}return _0x2a6f71;};}function handleError(_0x212af0,_0x5faf0){_0x5faf0=_0x5faf0||0x1f4;return function(_0x3362a8){logger[_0xd4cf('0x27')](_0x3362a8[_0xd4cf('0x28')]);if(_0x3362a8[_0xd4cf('0x29')]){delete _0x3362a8['name'];}_0x212af0[_0xd4cf('0x1b')](_0x5faf0)[_0xd4cf('0x2a')](_0x3362a8);};}exports[_0xd4cf('0x2b')]=function(_0x2b8a95,_0x581a2a){var _0x297102={},_0x33875d={},_0x14502b={'count':0x0,'rows':[]};var _0x5cb2f7=_[_0xd4cf('0x2c')](db['UserProfileSection'][_0xd4cf('0x2d')],function(_0x123a76){return{'name':_0x123a76[_0xd4cf('0x2e')],'type':_0x123a76[_0xd4cf('0x2f')]['key']};});_0x33875d[_0xd4cf('0x30')]=_['map'](_0x5cb2f7,_0xd4cf('0x29'));_0x33875d[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x2b8a95[_0xd4cf('0x31')]);_0x33875d[_0xd4cf('0x33')]=_[_0xd4cf('0x34')](_0x33875d[_0xd4cf('0x30')],_0x33875d['query']);_0x297102[_0xd4cf('0x35')]=_[_0xd4cf('0x34')](_0x33875d[_0xd4cf('0x30')],qs[_0xd4cf('0x36')](_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x36')]));_0x297102['attributes']=_0x297102['attributes'][_0xd4cf('0x37')]?_0x297102[_0xd4cf('0x35')]:_0x33875d['model'];if(!_0x2b8a95[_0xd4cf('0x31')]['hasOwnProperty'](_0xd4cf('0x38'))){_0x297102[_0xd4cf('0x20')]=qs[_0xd4cf('0x20')](_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x20')]);_0x297102[_0xd4cf('0x1e')]=qs['offset'](_0x2b8a95['query'][_0xd4cf('0x1e')]);}_0x297102[_0xd4cf('0x39')]=qs[_0xd4cf('0x3a')](_0x2b8a95['query'][_0xd4cf('0x3a')]);_0x297102[_0xd4cf('0x3b')]=qs[_0xd4cf('0x33')](_[_0xd4cf('0x3c')](_0x2b8a95['query'],_0x33875d[_0xd4cf('0x33')]),_0x5cb2f7);if(_0x2b8a95['query'][_0xd4cf('0x3d')]){_0x297102[_0xd4cf('0x3b')]=_[_0xd4cf('0x3e')](_0x297102['where'],{'$or':_[_0xd4cf('0x2c')](_0x5cb2f7,function(_0x136408){if(_0x136408[_0xd4cf('0x2f')]!=='VIRTUAL'){var _0x249802={};_0x249802[_0x136408['name']]={'$like':'%'+_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x3d')]+'%'};return _0x249802;}})});}_0x297102=_[_0xd4cf('0x3e')]({},_0x297102,_0x2b8a95[_0xd4cf('0x3f')]);var _0x2c737c={'where':_0x297102[_0xd4cf('0x3b')]};return db[_0xd4cf('0x40')][_0xd4cf('0x21')](_0x2c737c)[_0xd4cf('0x26')](function(_0x1b01e1){_0x14502b['count']=_0x1b01e1;if(_0x2b8a95[_0xd4cf('0x31')][_0xd4cf('0x41')]){_0x297102[_0xd4cf('0x42')]=[{'all':!![]}];}return db[_0xd4cf('0x40')]['findAll'](_0x297102);})[_0xd4cf('0x26')](function(_0x2fe468){_0x14502b[_0xd4cf('0x43')]=_0x2fe468;return _0x14502b;})[_0xd4cf('0x26')](respondWithFilteredResult(_0x581a2a,_0x297102))['catch'](handleError(_0x581a2a,null));};exports[_0xd4cf('0x44')]=function(_0x1b49fd,_0xdcf847){var _0x34c7ac={'raw':![],'where':{'id':_0x1b49fd['params']['id']}},_0x954289={};_0x954289['model']=_[_0xd4cf('0x32')](db[_0xd4cf('0x40')][_0xd4cf('0x2d')]);_0x954289[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x1b49fd[_0xd4cf('0x31')]);_0x954289['filters']=_[_0xd4cf('0x34')](_0x954289['model'],_0x954289[_0xd4cf('0x31')]);_0x34c7ac['attributes']=_[_0xd4cf('0x34')](_0x954289[_0xd4cf('0x30')],qs[_0xd4cf('0x36')](_0x1b49fd[_0xd4cf('0x31')][_0xd4cf('0x36')]));_0x34c7ac[_0xd4cf('0x35')]=_0x34c7ac[_0xd4cf('0x35')][_0xd4cf('0x37')]?_0x34c7ac[_0xd4cf('0x35')]:_0x954289[_0xd4cf('0x30')];if(_0x1b49fd['query']['includeAll']){_0x34c7ac['include']=[{'all':!![]}];}_0x34c7ac=_['merge']({},_0x34c7ac,_0x1b49fd['options']);return db[_0xd4cf('0x40')]['find'](_0x34c7ac)['then'](handleEntityNotFound(_0xdcf847,null))[_0xd4cf('0x26')](respondWithResult(_0xdcf847,null))[_0xd4cf('0x45')](handleError(_0xdcf847,null));};exports[_0xd4cf('0x46')]=function(_0x292707,_0x442cf2){return db[_0xd4cf('0x40')]['create'](_0x292707[_0xd4cf('0x47')],{})[_0xd4cf('0x26')](respondWithResult(_0x442cf2,0xc9))['catch'](handleError(_0x442cf2,null));};exports[_0xd4cf('0x48')]=function(_0x199c0f,_0x511f09){if(_0x199c0f[_0xd4cf('0x47')]['id']){delete _0x199c0f['body']['id'];}return db[_0xd4cf('0x40')]['find']({'where':{'id':_0x199c0f[_0xd4cf('0x49')]['id']}})[_0xd4cf('0x26')](handleEntityNotFound(_0x511f09,null))[_0xd4cf('0x26')](saveUpdates(_0x199c0f['body'],null))['then'](respondWithResult(_0x511f09,null))['catch'](handleError(_0x511f09,null));};exports[_0xd4cf('0x4a')]=function(_0x3739f7,_0x436e10){return db[_0xd4cf('0x40')][_0xd4cf('0x4b')]({'where':{'id':_0x3739f7[_0xd4cf('0x49')]['id']}})[_0xd4cf('0x26')](handleEntityNotFound(_0x436e10,null))[_0xd4cf('0x26')](removeEntity(_0x436e10,null))[_0xd4cf('0x45')](handleError(_0x436e10,null));};exports[_0xd4cf('0x4c')]=function(_0x3c577a,_0x4519fd){return db[_0xd4cf('0x40')][_0xd4cf('0x4c')]()['then'](respondWithResult(_0x4519fd,null))[_0xd4cf('0x45')](handleError(_0x4519fd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8c508df..02815a3 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 _0x8129=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','user_profile_has_sections','compositeIndex','sectionId','util'];(function(_0x4bd97e,_0x1393d4){var _0x8a831f=function(_0x3b186a){while(--_0x3b186a){_0x4bd97e['push'](_0x4bd97e['shift']());}};_0x8a831f(++_0x1393d4);}(_0x8129,0x99));var _0x9812=function(_0x16f864,_0x1b7a88){_0x16f864=_0x16f864-0x0;var _0x404e38=_0x8129[_0x16f864];return _0x404e38;};'use strict';var _=require('lodash');var util=require(_0x9812('0x0'));var logger=require(_0x9812('0x1'))(_0x9812('0x2'));var moment=require('moment');var BPromise=require(_0x9812('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9812('0x4'));var rimraf=require(_0x9812('0x5'));var config=require(_0x9812('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x9812('0x7')]=function(_0x2e1ea8,_0x173517){return _0x2e1ea8['define']('UserProfileSection',attributes,{'tableName':_0x9812('0x8'),'paranoid':![],'indexes':[{'name':_0x9812('0x9'),'fields':[_0x9812('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5792=['./userProfileSection.attributes','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x506ffc,_0x1d5505){var _0x3a3e43=function(_0x54bf3f){while(--_0x54bf3f){_0x506ffc['push'](_0x506ffc['shift']());}};_0x3a3e43(++_0x1d5505);}(_0x5792,0x156));var _0x2579=function(_0x33419b,_0x5709f8){_0x33419b=_0x33419b-0x0;var _0x11475a=_0x5792[_0x33419b];return _0x11475a;};'use strict';var _=require(_0x2579('0x0'));var util=require(_0x2579('0x1'));var logger=require(_0x2579('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2579('0x3'));var rp=require(_0x2579('0x4'));var fs=require('fs');var path=require(_0x2579('0x5'));var rimraf=require(_0x2579('0x6'));var config=require(_0x2579('0x7'));var attributes=require(_0x2579('0x8'));module['exports']=function(_0x469e99,_0x526c03){return _0x469e99['define'](_0x2579('0x9'),attributes,{'tableName':_0x2579('0xa'),'paranoid':![],'indexes':[{'name':_0x2579('0xb'),'fields':[_0x2579('0xc'),_0x2579('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b3820c6..6cc5aec 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 _0xd148=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x245539,_0x24f9da){var _0x1595f8=function(_0x1a0db2){while(--_0x1a0db2){_0x245539['push'](_0x245539['shift']());}};_0x1595f8(++_0x24f9da);}(_0xd148,0x8d));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8d14('0x0'));var moment=require(_0x8d14('0x1'));var BPromise=require(_0x8d14('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d14('0x3'));var db=require(_0x8d14('0x4'))['db'];var utils=require(_0x8d14('0x5'));var logger=require(_0x8d14('0x6'))(_0x8d14('0x7'));var config=require('../../config/environment');var jayson=require(_0x8d14('0x8'));var client=jayson[_0x8d14('0x9')][_0x8d14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242779,_0x18e619,_0x2c593a){return new BPromise(function(_0x485d47,_0x5c52a3){return client[_0x8d14('0xb')](_0x242779,_0x2c593a)[_0x8d14('0xc')](function(_0x2dd376){logger[_0x8d14('0xd')](_0x8d14('0xe'),_0x18e619,_0x8d14('0xf'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x18e619,_0x8d14('0xf'),JSON[_0x8d14('0x10')](_0x2dd376));if(_0x2dd376['error']){if(_0x2dd376[_0x8d14('0x11')][_0x8d14('0x12')]===0x1f4){logger[_0x8d14('0x11')](_0x8d14('0xe'),_0x18e619,_0x2dd376[_0x8d14('0x11')][_0x8d14('0x13')]);return _0x5c52a3(_0x2dd376[_0x8d14('0x11')]['message']);}logger[_0x8d14('0x11')](_0x8d14('0xe'),_0x18e619,_0x2dd376[_0x8d14('0x11')][_0x8d14('0x13')]);return _0x485d47(_0x2dd376[_0x8d14('0x11')][_0x8d14('0x13')]);}else{logger[_0x8d14('0xd')](_0x8d14('0xe'),_0x18e619,'request\x20sent');_0x485d47(_0x2dd376[_0x8d14('0x14')]['message']);}})[_0x8d14('0x15')](function(_0x5cb5b9){logger['error'](_0x8d14('0xe'),_0x18e619,_0x5cb5b9);_0x5c52a3(_0x5cb5b9);});});} \ No newline at end of file +var _0xd578=['catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x270b86,_0x59265d){var _0xdb09ec=function(_0x320e9a){while(--_0x320e9a){_0x270b86['push'](_0x270b86['shift']());}};_0xdb09ec(++_0x59265d);}(_0xd578,0x1dd));var _0x8d57=function(_0x491a3b,_0x4c9b90){_0x491a3b=_0x491a3b-0x0;var _0xf8fee5=_0xd578[_0x491a3b];return _0xf8fee5;};'use strict';var _=require(_0x8d57('0x0'));var util=require(_0x8d57('0x1'));var moment=require(_0x8d57('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d57('0x3'));var fs=require('fs');var Redis=require(_0x8d57('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d57('0x5'))(_0x8d57('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d57('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cb33d,_0x5e929c,_0x3ad031){return new BPromise(function(_0x2e84b7,_0x3f853f){return client['request'](_0x3cb33d,_0x3ad031)[_0x8d57('0x8')](function(_0x17737a){logger[_0x8d57('0x9')](_0x8d57('0xa'),_0x5e929c,_0x8d57('0xb'));logger[_0x8d57('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5e929c,_0x8d57('0xb'),JSON[_0x8d57('0xd')](_0x17737a));if(_0x17737a[_0x8d57('0xe')]){if(_0x17737a[_0x8d57('0xe')]['code']===0x1f4){logger[_0x8d57('0xe')](_0x8d57('0xa'),_0x5e929c,_0x17737a[_0x8d57('0xe')][_0x8d57('0xf')]);return _0x3f853f(_0x17737a[_0x8d57('0xe')][_0x8d57('0xf')]);}logger[_0x8d57('0xe')](_0x8d57('0xa'),_0x5e929c,_0x17737a[_0x8d57('0xe')]['message']);return _0x2e84b7(_0x17737a[_0x8d57('0xe')]['message']);}else{logger['info'](_0x8d57('0xa'),_0x5e929c,_0x8d57('0xb'));_0x2e84b7(_0x17737a['result'][_0x8d57('0xf')]);}})[_0x8d57('0x10')](function(_0x2e811e){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5e929c,_0x2e811e);_0x3f853f(_0x2e811e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3b8b6e6..90c8060 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31e00f,_0x1a4e77){var _0x260194=function(_0x58c57a){while(--_0x58c57a){_0x31e00f['push'](_0x31e00f['shift']());}};_0x260194(++_0x1a4e77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x335c97,_0x485355){var _0x36ac8e=function(_0x582562){while(--_0x582562){_0x335c97['push'](_0x335c97['shift']());}};_0x36ac8e(++_0x485355);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a683929..9bc050b 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 _0xee26=['exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee26,0x9c));var _0x6ee2=function(_0x7a00ab,_0x55e187){_0x7a00ab=_0x7a00ab-0x0;var _0x3324e5=_0xee26[_0x7a00ab];return _0x3324e5;};'use strict';var Sequelize=require('sequelize');module[_0x6ee2('0x0')]={'penalty':{'type':Sequelize[_0x6ee2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x98a0=['INTEGER'];(function(_0x455974,_0x490f95){var _0x4356f0=function(_0x1b8600){while(--_0x1b8600){_0x455974['push'](_0x455974['shift']());}};_0x4356f0(++_0x490f95);}(_0x98a0,0x7c));var _0x098a=function(_0x1fa2ac,_0x3157f5){_0x1fa2ac=_0x1fa2ac-0x0;var _0x5d701c=_0x98a0[_0x1fa2ac];return _0x5d701c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x098a('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 471d0d5..897e805 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 _0xef17=['./userSmsQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xef17,0x136));var _0x7ef1=function(_0x9def34,_0x256c45){_0x9def34=_0x9def34-0x0;var _0x20cc65=_0xef17[_0x9def34];return _0x20cc65;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0af5=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ede29,_0x32fd20){var _0x2f6fd9=function(_0x5a39e2){while(--_0x5a39e2){_0x3ede29['push'](_0x3ede29['shift']());}};_0x2f6fd9(++_0x32fd20);}(_0x0af5,0x158));var _0x50af=function(_0x5234ae,_0x5ea986){_0x5234ae=_0x5234ae-0x0;var _0x45ba62=_0x0af5[_0x5234ae];return _0x45ba62;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var logger=require(_0x50af('0x1'))(_0x50af('0x2'));var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var rp=require(_0x50af('0x5'));var fs=require('fs');var path=require(_0x50af('0x6'));var rimraf=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var attributes=require(_0x50af('0x9'));module[_0x50af('0xa')]=function(_0xe37b1,_0x5e94f8){return _0xe37b1['define'](_0x50af('0xb'),attributes,{'tableName':_0x50af('0xc'),'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 80f3835..0d89bf1 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 _0xd127=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x3e4788,_0x1052c2){var _0xb78fe3=function(_0x4a14d8){while(--_0x4a14d8){_0x3e4788['push'](_0x3e4788['shift']());}};_0xb78fe3(++_0x1052c2);}(_0xd127,0x1e0));var _0x7d12=function(_0x49568f,_0x40e6d7){_0x49568f=_0x49568f-0x0;var _0x59ee9b=_0xd127[_0x49568f];return _0x59ee9b;};'use strict';var _=require(_0x7d12('0x0'));var util=require(_0x7d12('0x1'));var moment=require('moment');var BPromise=require(_0x7d12('0x2'));var rs=require(_0x7d12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d12('0x5'))('rpc');var config=require(_0x7d12('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7d12('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fcc8f,_0x1a17d1,_0x5d9d1c){return new BPromise(function(_0x12bfdd,_0x2ca6da){return client[_0x7d12('0x8')](_0x4fcc8f,_0x5d9d1c)[_0x7d12('0x9')](function(_0x3a1954){logger['info'](_0x7d12('0xa'),_0x1a17d1,_0x7d12('0xb'));logger[_0x7d12('0xc')](_0x7d12('0xd'),_0x1a17d1,_0x7d12('0xb'),JSON['stringify'](_0x3a1954));if(_0x3a1954['error']){if(_0x3a1954[_0x7d12('0xe')][_0x7d12('0xf')]===0x1f4){logger[_0x7d12('0xe')](_0x7d12('0xa'),_0x1a17d1,_0x3a1954[_0x7d12('0xe')][_0x7d12('0x10')]);return _0x2ca6da(_0x3a1954[_0x7d12('0xe')]['message']);}logger[_0x7d12('0xe')](_0x7d12('0xa'),_0x1a17d1,_0x3a1954[_0x7d12('0xe')][_0x7d12('0x10')]);return _0x12bfdd(_0x3a1954[_0x7d12('0xe')][_0x7d12('0x10')]);}else{logger[_0x7d12('0x11')](_0x7d12('0xa'),_0x1a17d1,_0x7d12('0xb'));_0x12bfdd(_0x3a1954[_0x7d12('0x12')][_0x7d12('0x10')]);}})[_0x7d12('0x13')](function(_0xca77e1){logger[_0x7d12('0xe')](_0x7d12('0xa'),_0x1a17d1,_0xca77e1);_0x2ca6da(_0xca77e1);});});} \ No newline at end of file +var _0xad22=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x59b576,_0x3cda9d){var _0x2c65b2=function(_0x2ce0aa){while(--_0x2ce0aa){_0x59b576['push'](_0x59b576['shift']());}};_0x2c65b2(++_0x3cda9d);}(_0xad22,0x120));var _0x2ad2=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xad22[_0x420f2a];return _0x28f802;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ad2('0x0'));var BPromise=require(_0x2ad2('0x1'));var rs=require(_0x2ad2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ad2('0x3'))['db'];var utils=require(_0x2ad2('0x4'));var logger=require('../../config/logger')(_0x2ad2('0x5'));var config=require(_0x2ad2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2ad2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5b0f,_0x50d968,_0x9727b3){return new BPromise(function(_0x3aefe6,_0x59ac79){return client[_0x2ad2('0x8')](_0x1b5b0f,_0x9727b3)[_0x2ad2('0x9')](function(_0x4690ae){logger['info'](_0x2ad2('0xa'),_0x50d968,'request\x20sent');logger[_0x2ad2('0xb')](_0x2ad2('0xc'),_0x50d968,_0x2ad2('0xd'),JSON[_0x2ad2('0xe')](_0x4690ae));if(_0x4690ae[_0x2ad2('0xf')]){if(_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x10')]===0x1f4){logger[_0x2ad2('0xf')](_0x2ad2('0xa'),_0x50d968,_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x59ac79(_0x4690ae['error'][_0x2ad2('0x11')]);}logger['error'](_0x2ad2('0xa'),_0x50d968,_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x3aefe6(_0x4690ae[_0x2ad2('0xf')][_0x2ad2('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x50d968,_0x2ad2('0xd'));_0x3aefe6(_0x4690ae[_0x2ad2('0x12')][_0x2ad2('0x11')]);}})[_0x2ad2('0x13')](function(_0x36f01f){logger[_0x2ad2('0xf')](_0x2ad2('0xa'),_0x50d968,_0x36f01f);_0x59ac79(_0x36f01f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 64ac677..e806940 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 _0x5cee=['INTEGER','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5cee,0x163));var _0xe5ce=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x5cee[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0xe5ce('0x0'));module[_0xe5ce('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xe5ce('0x2')]}}; \ No newline at end of file +var _0x622d=['sequelize','exports','INTEGER'];(function(_0x5a51dc,_0x325229){var _0x5bf5cd=function(_0x130ca8){while(--_0x130ca8){_0x5a51dc['push'](_0x5a51dc['shift']());}};_0x5bf5cd(++_0x325229);}(_0x622d,0x189));var _0xd622=function(_0x4749cd,_0x5f4501){_0x4749cd=_0x4749cd-0x0;var _0x21dd14=_0x622d[_0x4749cd];return _0x21dd14;};'use strict';var Sequelize=require(_0xd622('0x0'));module[_0xd622('0x1')]={'UserId':{'type':Sequelize[_0xd622('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd622('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b1c65c2..37b9253 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(_0x2a446b,_0x3e1756){var _0x342be6=function(_0x566793){while(--_0x566793){_0x2a446b['push'](_0x2a446b['shift']());}};_0x342be6(++_0x3e1756);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x229ba2,_0x58b073){var _0x4dd06a=function(_0xe99dd0){while(--_0xe99dd0){_0x229ba2['push'](_0x229ba2['shift']());}};_0x4dd06a(++_0x58b073);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 ec0848d..a5d1d62 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1fcd30,_0x38b6a8){var _0x232fa3=function(_0x419a1){while(--_0x419a1){_0x1fcd30['push'](_0x1fcd30['shift']());}};_0x232fa3(++_0x38b6a8);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x26f513,_0x57c063){var _0x7ab795=function(_0x45458c){while(--_0x45458c){_0x26f513['push'](_0x26f513['shift']());}};_0x7ab795(++_0x57c063);}(_0x70e0,0x17b));var _0x070e=function(_0x5e7549,_0x65f9b8){_0x5e7549=_0x5e7549-0x0;var _0x35862a=_0x70e0[_0x5e7549];return _0x35862a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9006424..1cc66be 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8483=['INTEGER','sequelize','exports'];(function(_0x13b3ea,_0x2a54ac){var _0x49f6d3=function(_0x5ef0ab){while(--_0x5ef0ab){_0x13b3ea['push'](_0x13b3ea['shift']());}};_0x49f6d3(++_0x2a54ac);}(_0x8483,0x1c9));var _0x3848=function(_0x5c9f58,_0xd151ba){_0x5c9f58=_0x5c9f58-0x0;var _0x4cb8e2=_0x8483[_0x5c9f58];return _0x4cb8e2;};'use strict';var Sequelize=require(_0x3848('0x0'));module[_0x3848('0x1')]={'penalty':{'type':Sequelize[_0x3848('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 f66e406..3696c57 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 _0x764d=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0xe59cff,_0x1a7dbe){var _0x26e8c1=function(_0x6a95cc){while(--_0x6a95cc){_0xe59cff['push'](_0xe59cff['shift']());}};_0x26e8c1(++_0x1a7dbe);}(_0x764d,0xc1));var _0xd764=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x764d[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0xd764('0x0'));var util=require('util');var logger=require(_0xd764('0x1'))(_0xd764('0x2'));var moment=require(_0xd764('0x3'));var BPromise=require('bluebird');var rp=require(_0xd764('0x4'));var fs=require('fs');var path=require(_0xd764('0x5'));var rimraf=require(_0xd764('0x6'));var config=require(_0xd764('0x7'));var attributes=require(_0xd764('0x8'));module[_0xd764('0x9')]=function(_0x14f217,_0x849f7f){return _0x14f217['define']('UserVoiceQueue',attributes,{'tableName':_0xd764('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31b8=['exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0x31b8,0x137));var _0x831b=function(_0x4d953d,_0x4df7cc){_0x4d953d=_0x4d953d-0x0;var _0x1e30c9=_0x31b8[_0x4d953d];return _0x1e30c9;};'use strict';var _=require(_0x831b('0x0'));var util=require(_0x831b('0x1'));var logger=require(_0x831b('0x2'))(_0x831b('0x3'));var moment=require(_0x831b('0x4'));var BPromise=require(_0x831b('0x5'));var rp=require(_0x831b('0x6'));var fs=require('fs');var path=require(_0x831b('0x7'));var rimraf=require(_0x831b('0x8'));var config=require(_0x831b('0x9'));var attributes=require(_0x831b('0xa'));module[_0x831b('0xb')]=function(_0x4b3a6d,_0xf67f4a){return _0x4b3a6d['define'](_0x831b('0xc'),attributes,{'tableName':_0x831b('0xd'),'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 9630ddd..a69ad19 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 _0xfed1=['then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xfed1,0x96));var _0x1fed=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfed1[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1fed('0x0'));var util=require(_0x1fed('0x1'));var moment=require('moment');var BPromise=require(_0x1fed('0x2'));var rs=require(_0x1fed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fed('0x5'))('rpc');var config=require(_0x1fed('0x6'));var jayson=require(_0x1fed('0x7'));var client=jayson[_0x1fed('0x8')][_0x1fed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b242,_0x25e279,_0x3edb0e){return new BPromise(function(_0x484936,_0x41d166){return client['request'](_0x14b242,_0x3edb0e)[_0x1fed('0xa')](function(_0x47b42c){logger[_0x1fed('0xb')](_0x1fed('0xc'),_0x25e279,'request\x20sent');logger['debug'](_0x1fed('0xd'),_0x25e279,_0x1fed('0xe'),JSON[_0x1fed('0xf')](_0x47b42c));if(_0x47b42c[_0x1fed('0x10')]){if(_0x47b42c[_0x1fed('0x10')][_0x1fed('0x11')]===0x1f4){logger['error'](_0x1fed('0xc'),_0x25e279,_0x47b42c[_0x1fed('0x10')][_0x1fed('0x12')]);return _0x41d166(_0x47b42c[_0x1fed('0x10')][_0x1fed('0x12')]);}logger[_0x1fed('0x10')](_0x1fed('0xc'),_0x25e279,_0x47b42c[_0x1fed('0x10')][_0x1fed('0x12')]);return _0x484936(_0x47b42c['error'][_0x1fed('0x12')]);}else{logger[_0x1fed('0xb')](_0x1fed('0xc'),_0x25e279,_0x1fed('0xe'));_0x484936(_0x47b42c['result'][_0x1fed('0x12')]);}})[_0x1fed('0x13')](function(_0x4c76d4){logger[_0x1fed('0x10')](_0x1fed('0xc'),_0x25e279,_0x4c76d4);_0x41d166(_0x4c76d4);});});} \ No newline at end of file +var _0x4729=['../../config/environment','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2a53ad,_0x234135){var _0x31b3b6=function(_0x141ec6){while(--_0x141ec6){_0x2a53ad['push'](_0x2a53ad['shift']());}};_0x31b3b6(++_0x234135);}(_0x4729,0x1c7));var _0x9472=function(_0x193495,_0x454bad){_0x193495=_0x193495-0x0;var _0x4b8bf2=_0x4729[_0x193495];return _0x4b8bf2;};'use strict';var _=require(_0x9472('0x0'));var util=require(_0x9472('0x1'));var moment=require(_0x9472('0x2'));var BPromise=require(_0x9472('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9472('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9472('0x5'))(_0x9472('0x6'));var config=require(_0x9472('0x7'));var jayson=require(_0x9472('0x8'));var client=jayson[_0x9472('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8ddc,_0x9e7d93,_0x45aabe){return new BPromise(function(_0x4c945c,_0x26c0d0){return client['request'](_0x5e8ddc,_0x45aabe)[_0x9472('0xa')](function(_0xc93157){logger[_0x9472('0xb')](_0x9472('0xc'),_0x9e7d93,'request\x20sent');logger[_0x9472('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x9e7d93,_0x9472('0xe'),JSON[_0x9472('0xf')](_0xc93157));if(_0xc93157[_0x9472('0x10')]){if(_0xc93157[_0x9472('0x10')][_0x9472('0x11')]===0x1f4){logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0xc93157['error'][_0x9472('0x12')]);return _0x26c0d0(_0xc93157['error']['message']);}logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0xc93157[_0x9472('0x10')][_0x9472('0x12')]);return _0x4c945c(_0xc93157[_0x9472('0x10')][_0x9472('0x12')]);}else{logger[_0x9472('0xb')](_0x9472('0xc'),_0x9e7d93,_0x9472('0xe'));_0x4c945c(_0xc93157[_0x9472('0x13')][_0x9472('0x12')]);}})[_0x9472('0x14')](function(_0x496816){logger[_0x9472('0x10')](_0x9472('0xc'),_0x9e7d93,_0x496816);_0x26c0d0(_0x496816);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 89c05b6..2906a0a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1ebf76,_0x482439){var _0x5a2e6d=function(_0x3daaa3){while(--_0x3daaa3){_0x1ebf76['push'](_0x1ebf76['shift']());}};_0x5a2e6d(++_0x482439);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4f7588,_0x399e6b){var _0x535c70=function(_0x5c2bbb){while(--_0x5c2bbb){_0x4f7588['push'](_0x4f7588['shift']());}};_0x535c70(++_0x399e6b);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3c310f3..dbb498e 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 _0x7f5e=['queue_interface','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x2ccdec,_0x304c5f){var _0x8ac0=function(_0x1895d8){while(--_0x1895d8){_0x2ccdec['push'](_0x2ccdec['shift']());}};_0x8ac0(++_0x304c5f);}(_0x7f5e,0x18d));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xe7f5('0x0')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe7f5('0x0')],'allowNull':![],'unique':'queue_interface','comment':_0xe7f5('0x1')},'VoiceQueueId':{'type':Sequelize[_0xe7f5('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe7f5('0x3'),'comment':_0xe7f5('0x1')},'penalty':{'type':Sequelize[_0xe7f5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xe7f5('0x2')](0xb),'defaultValue':0x0,'comment':_0xe7f5('0x1')}}; \ No newline at end of file +var _0x737d=['INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x737d,0x18b));var _0xd737=function(_0x5d49e4,_0x23d8d7){_0x5d49e4=_0x5d49e4-0x0;var _0x585f8e=_0x737d[_0x5d49e4];return _0x585f8e;};'use strict';var Sequelize=require(_0xd737('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd737('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd737('0x2')},'membername':{'type':Sequelize[_0xd737('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd737('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xd737('0x2')},'penalty':{'type':Sequelize[_0xd737('0x1')](0xb),'defaultValue':0x0,'comment':_0xd737('0x2')},'paused':{'type':Sequelize[_0xd737('0x1')](0xb),'defaultValue':0x0,'comment':_0xd737('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e655fe2..464a699 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 _0xb998=['UserVoiceQueueRt','save','emit','hook'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb998,0x188));var _0x8b99=function(_0x284067,_0x3244be){_0x284067=_0x284067-0x0;var _0x439002=_0xb998[_0x284067];return _0x439002;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x8b99('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b99('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x714710){return function(_0x6c3376,_0x19b503,_0x3552ba){UserVoiceQueueRtEvents['emit'](_0x714710+':'+_0x6c3376['id'],_0x6c3376);UserVoiceQueueRtEvents[_0x8b99('0x2')](_0x714710,_0x6c3376);_0x3552ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x8b99('0x3')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xabd3=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xabd3,0xde));var _0x3abd=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xabd3[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x3abd('0x0'));var UserVoiceQueueRt=require(_0x3abd('0x1'))['db'][_0x3abd('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3abd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3abd('0x4')};function emitEvent(_0x4f1400){return function(_0xeec56c,_0x2e21f7,_0x4259c5){UserVoiceQueueRtEvents[_0x3abd('0x5')](_0x4f1400+':'+_0xeec56c['id'],_0xeec56c);UserVoiceQueueRtEvents[_0x3abd('0x5')](_0x4f1400,_0xeec56c);_0x4259c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 597f0c5..5de6a64 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 _0xa215=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x345e6f,_0x441180){var _0x478968=function(_0x4cec3e){while(--_0x4cec3e){_0x345e6f['push'](_0x345e6f['shift']());}};_0x478968(++_0x441180);}(_0xa215,0x1ed));var _0x5a21=function(_0x3aa5cf,_0x4879b3){_0x3aa5cf=_0x3aa5cf-0x0;var _0x22854a=_0xa215[_0x3aa5cf];return _0x22854a;};'use strict';var _=require(_0x5a21('0x0'));var util=require('util');var logger=require(_0x5a21('0x1'))(_0x5a21('0x2'));var moment=require(_0x5a21('0x3'));var BPromise=require(_0x5a21('0x4'));var rp=require(_0x5a21('0x5'));var fs=require('fs');var path=require(_0x5a21('0x6'));var rimraf=require(_0x5a21('0x7'));var config=require(_0x5a21('0x8'));var attributes=require(_0x5a21('0x9'));module['exports']=function(_0x27d65e,_0x194207){return _0x27d65e[_0x5a21('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x5a21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd10=['../../config/environment','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x52ea8c,_0x1750d0){var _0x108340=function(_0x48e839){while(--_0x48e839){_0x52ea8c['push'](_0x52ea8c['shift']());}};_0x108340(++_0x1750d0);}(_0xcd10,0x190));var _0x0cd1=function(_0x507702,_0x1dc552){_0x507702=_0x507702-0x0;var _0x314f81=_0xcd10[_0x507702];return _0x314f81;};'use strict';var _=require(_0x0cd1('0x0'));var util=require('util');var logger=require(_0x0cd1('0x1'))(_0x0cd1('0x2'));var moment=require(_0x0cd1('0x3'));var BPromise=require(_0x0cd1('0x4'));var rp=require(_0x0cd1('0x5'));var fs=require('fs');var path=require(_0x0cd1('0x6'));var rimraf=require(_0x0cd1('0x7'));var config=require(_0x0cd1('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x0cd1('0x9')]=function(_0x3a7c92,_0x3021b4){return _0x3a7c92[_0x0cd1('0xa')](_0x0cd1('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a6aec74..3d0164f 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 _0x1dce=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dce,0x1d1));var _0xe1dc=function(_0x3ee697,_0x24f133){_0x3ee697=_0x3ee697-0x0;var _0x3b81e2=_0x1dce[_0x3ee697];return _0x3b81e2;};'use strict';var _=require(_0xe1dc('0x0'));var util=require(_0xe1dc('0x1'));var moment=require(_0xe1dc('0x2'));var BPromise=require(_0xe1dc('0x3'));var rs=require(_0xe1dc('0x4'));var fs=require('fs');var Redis=require(_0xe1dc('0x5'));var db=require(_0xe1dc('0x6'))['db'];var utils=require(_0xe1dc('0x7'));var logger=require(_0xe1dc('0x8'))(_0xe1dc('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe1dc('0xa')]({'port':0x232a});config[_0xe1dc('0xb')]=_[_0xe1dc('0xc')](config[_0xe1dc('0xb')],{'host':_0xe1dc('0xd'),'port':0x18eb});var socket=require(_0xe1dc('0xe'))(new Redis(config[_0xe1dc('0xb')]));require(_0xe1dc('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a3c79,_0x1c468d,_0x4b1c7d){return new BPromise(function(_0x974a3f,_0x35989e){return client[_0xe1dc('0x10')](_0x2a3c79,_0x4b1c7d)[_0xe1dc('0x11')](function(_0x1232a5){logger[_0xe1dc('0x12')](_0xe1dc('0x13'),_0x1c468d,_0xe1dc('0x14'));logger[_0xe1dc('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1c468d,_0xe1dc('0x14'),JSON['stringify'](_0x1232a5));if(_0x1232a5[_0xe1dc('0x16')]){if(_0x1232a5['error'][_0xe1dc('0x17')]===0x1f4){logger[_0xe1dc('0x16')](_0xe1dc('0x13'),_0x1c468d,_0x1232a5[_0xe1dc('0x16')][_0xe1dc('0x18')]);return _0x35989e(_0x1232a5[_0xe1dc('0x16')]['message']);}logger[_0xe1dc('0x16')](_0xe1dc('0x13'),_0x1c468d,_0x1232a5[_0xe1dc('0x16')][_0xe1dc('0x18')]);return _0x974a3f(_0x1232a5[_0xe1dc('0x16')][_0xe1dc('0x18')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c468d,'request\x20sent');_0x974a3f(_0x1232a5[_0xe1dc('0x19')]['message']);}})[_0xe1dc('0x1a')](function(_0x4ab107){logger[_0xe1dc('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c468d,_0x4ab107);_0x35989e(_0x4ab107);});});}exports[_0xe1dc('0x1b')]=function(_0x33008d){var _0x1469f0=this;return new Promise(function(_0x5fd856,_0x12f172){return db[_0xe1dc('0x1c')][_0xe1dc('0x1d')]({'raw':_0x33008d['options']?_0x33008d['options']['raw']===undefined?!![]:![]:!![],'where':_0x33008d['options']?_0x33008d[_0xe1dc('0x1e')][_0xe1dc('0x1f')]||null:null,'attributes':[[db[_0xe1dc('0x20')]['fn'](_0xe1dc('0x21'),db[_0xe1dc('0x20')]['fn']('IF',db[_0xe1dc('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xe1dc('0x22')]]})['then'](function(_0x356ff6){logger[_0xe1dc('0x12')]('GetVoiceQueueRtPauses',_0x33008d);logger[_0xe1dc('0x15')](_0xe1dc('0x1b'),_0x33008d,JSON['stringify'](_0x356ff6));_0x5fd856(_0x356ff6);})[_0xe1dc('0x1a')](function(_0x3d39a2){logger[_0xe1dc('0x16')](_0xe1dc('0x1b'),_0x3d39a2[_0xe1dc('0x18')],_0x33008d);_0x12f172(_0x1469f0[_0xe1dc('0x16')](0x1f4,_0x3d39a2[_0xe1dc('0x18')]));});});}; \ No newline at end of file +var _0x4d68=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x4d68,0x1da));var _0x84d6=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x4d68[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x84d6('0x3'));var fs=require('fs');var Redis=require(_0x84d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x5'));var logger=require(_0x84d6('0x6'))(_0x84d6('0x7'));var config=require(_0x84d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});config[_0x84d6('0xb')]=_[_0x84d6('0xc')](config[_0x84d6('0xb')],{'host':_0x84d6('0xd'),'port':0x18eb});var socket=require(_0x84d6('0xe'))(new Redis(config[_0x84d6('0xb')]));require(_0x84d6('0xf'))['register'](socket);function respondWithRpcPromise(_0x1eea98,_0x398c0d,_0x36b309){return new BPromise(function(_0x430032,_0x5669d8){return client[_0x84d6('0x10')](_0x1eea98,_0x36b309)['then'](function(_0x310e32){logger[_0x84d6('0x11')](_0x84d6('0x12'),_0x398c0d,_0x84d6('0x13'));logger[_0x84d6('0x14')](_0x84d6('0x15'),_0x398c0d,_0x84d6('0x13'),JSON[_0x84d6('0x16')](_0x310e32));if(_0x310e32['error']){if(_0x310e32[_0x84d6('0x17')][_0x84d6('0x18')]===0x1f4){logger[_0x84d6('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x398c0d,_0x310e32[_0x84d6('0x17')][_0x84d6('0x19')]);return _0x5669d8(_0x310e32['error'][_0x84d6('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x398c0d,_0x310e32['error'][_0x84d6('0x19')]);return _0x430032(_0x310e32[_0x84d6('0x17')]['message']);}else{logger[_0x84d6('0x11')](_0x84d6('0x12'),_0x398c0d,_0x84d6('0x13'));_0x430032(_0x310e32[_0x84d6('0x1a')][_0x84d6('0x19')]);}})[_0x84d6('0x1b')](function(_0x2988e1){logger[_0x84d6('0x17')](_0x84d6('0x12'),_0x398c0d,_0x2988e1);_0x5669d8(_0x2988e1);});});}exports[_0x84d6('0x1c')]=function(_0x1f31bd){var _0x1ff9cb=this;return new Promise(function(_0x52f36f,_0x3203c4){return db[_0x84d6('0x1d')][_0x84d6('0x1e')]({'raw':_0x1f31bd[_0x84d6('0x1f')]?_0x1f31bd[_0x84d6('0x1f')][_0x84d6('0x20')]===undefined?!![]:![]:!![],'where':_0x1f31bd[_0x84d6('0x1f')]?_0x1f31bd[_0x84d6('0x1f')]['where']||null:null,'attributes':[[db[_0x84d6('0x21')]['fn'](_0x84d6('0x22'),db[_0x84d6('0x21')]['fn']('IF',db[_0x84d6('0x21')]['literal'](_0x84d6('0x23')))),_0x84d6('0x24')]]})[_0x84d6('0x25')](function(_0x46f213){logger[_0x84d6('0x11')]('GetVoiceQueueRtPauses',_0x1f31bd);logger[_0x84d6('0x14')]('GetVoiceQueueRtPauses',_0x1f31bd,JSON[_0x84d6('0x16')](_0x46f213));_0x52f36f(_0x46f213);})['catch'](function(_0x2ac09d){logger[_0x84d6('0x17')](_0x84d6('0x1c'),_0x2ac09d[_0x84d6('0x19')],_0x1f31bd);_0x3203c4(_0x1ff9cb[_0x84d6('0x17')](0x1f4,_0x2ac09d['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6c90e25..415864b 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 _0xd8b1=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0xd8b1,0x105));var _0x1d8b=function(_0x49b00c,_0x3e34f5){_0x49b00c=_0x49b00c-0x0;var _0x348b93=_0xd8b1[_0x49b00c];return _0x348b93;};'use strict';var UserVoiceQueueRtEvents=require(_0x1d8b('0x0'));var events=[_0x1d8b('0x1'),_0x1d8b('0x2'),_0x1d8b('0x3')];function createListener(_0x20c6dd,_0x5deaca){return function(_0x68d7af){_0x5deaca[_0x1d8b('0x4')](_0x20c6dd,_0x68d7af);};}function removeListener(_0x531170,_0xad218){return function(){UserVoiceQueueRtEvents['removeListener'](_0x531170,_0xad218);};}exports['register']=function(_0x4d5ba0){for(var _0x27534c=0x0,_0x5f5bbd=events[_0x1d8b('0x5')];_0x27534c<_0x5f5bbd;_0x27534c++){var _0xdba2e5=events[_0x27534c];var _0x2b28e2=createListener(_0x1d8b('0x6')+_0xdba2e5,_0x4d5ba0);UserVoiceQueueRtEvents['on'](_0xdba2e5,_0x2b28e2);}}; \ No newline at end of file +var _0xcedf=['update','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x29b35c,_0x2001c5){var _0x5ab131=function(_0x4afc0a){while(--_0x4afc0a){_0x29b35c['push'](_0x29b35c['shift']());}};_0x5ab131(++_0x2001c5);}(_0xcedf,0x1b6));var _0xfced=function(_0x504450,_0x3877d4){_0x504450=_0x504450-0x0;var _0x1089f5=_0xcedf[_0x504450];return _0x1089f5;};'use strict';var UserVoiceQueueRtEvents=require(_0xfced('0x0'));var events=[_0xfced('0x1'),_0xfced('0x2'),_0xfced('0x3')];function createListener(_0x59538d,_0x153f0f){return function(_0x2165b9){_0x153f0f['emit'](_0x59538d,_0x2165b9);};}function removeListener(_0x5b16af,_0x1dad76){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5b16af,_0x1dad76);};}exports[_0xfced('0x4')]=function(_0x5c2015){for(var _0x455382=0x0,_0x571725=events[_0xfced('0x5')];_0x455382<_0x571725;_0x455382++){var _0x5bd518=events[_0x455382];var _0x5c6588=createListener(_0xfced('0x6')+_0x5bd518,_0x5c2015);UserVoiceQueueRtEvents['on'](_0x5bd518,_0x5c6588);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 21e83ce..2b96350 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5f3255,_0x66d0e2){var _0x4e88d1=function(_0x2c90b4){while(--_0x2c90b4){_0x5f3255['push'](_0x5f3255['shift']());}};_0x4e88d1(++_0x66d0e2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xcb91[_0x134d5e];return _0x1e166a;};'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(_0x238533,_0x28d833){var _0x748145=function(_0x485d2e){while(--_0x485d2e){_0x238533['push'](_0x238533['shift']());}};_0x748145(++_0x28d833);}(_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'));module[_0x0a9e('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 63dfe61..ed4aaa2 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3353=['exports','sequelize'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3353,0xbf));var _0x3335=function(_0x43d1a7,_0x17b9b9){_0x43d1a7=_0x43d1a7-0x0;var _0x152f08=_0x3353[_0x43d1a7];return _0x152f08;};'use strict';var Sequelize=require(_0x3335('0x0'));module[_0x3335('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x19be=['INTEGER','sequelize','exports'];(function(_0x4201de,_0x43ac07){var _0x3fef97=function(_0x92694c){while(--_0x92694c){_0x4201de['push'](_0x4201de['shift']());}};_0x3fef97(++_0x43ac07);}(_0x19be,0x1de));var _0xe19b=function(_0x1de8da,_0x5e3998){_0x1de8da=_0x1de8da-0x0;var _0x5ec0ee=_0x19be[_0x1de8da];return _0x5ec0ee;};'use strict';var Sequelize=require(_0xe19b('0x0'));module[_0xe19b('0x1')]={'penalty':{'type':Sequelize[_0xe19b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 68de821..ed952b4 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 _0xb0c0=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x3d7d89,_0x4a42be){var _0x102504=function(_0x2ca348){while(--_0x2ca348){_0x3d7d89['push'](_0x3d7d89['shift']());}};_0x102504(++_0x4a42be);}(_0xb0c0,0xdf));var _0x0b0c=function(_0x3d8876,_0x1a23cd){_0x3d8876=_0x3d8876-0x0;var _0x1e3350=_0xb0c0[_0x3d8876];return _0x1e3350;};'use strict';var _=require(_0x0b0c('0x0'));var util=require(_0x0b0c('0x1'));var logger=require(_0x0b0c('0x2'))('api');var moment=require(_0x0b0c('0x3'));var BPromise=require(_0x0b0c('0x4'));var rp=require(_0x0b0c('0x5'));var fs=require('fs');var path=require(_0x0b0c('0x6'));var rimraf=require(_0x0b0c('0x7'));var config=require(_0x0b0c('0x8'));var attributes=require(_0x0b0c('0x9'));module[_0x0b0c('0xa')]=function(_0xb85831,_0xe312ee){return _0xb85831[_0x0b0c('0xb')](_0x0b0c('0xc'),attributes,{'tableName':_0x0b0c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ef6=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5a108a,_0x1d2d49){var _0x44cfb1=function(_0x516007){while(--_0x516007){_0x5a108a['push'](_0x5a108a['shift']());}};_0x44cfb1(++_0x1d2d49);}(_0x4ef6,0x75));var _0x64ef=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x4ef6[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0x64ef('0x0'));var util=require('util');var logger=require(_0x64ef('0x1'))(_0x64ef('0x2'));var moment=require(_0x64ef('0x3'));var BPromise=require(_0x64ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64ef('0x5'));var rimraf=require(_0x64ef('0x6'));var config=require(_0x64ef('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x64ef('0x8')]=function(_0x5646c0,_0x49b177){return _0x5646c0['define']('UserWhatsappQueue',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 06a1a4a..4cdf030 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 _0x9b6e=['request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9b6e,0x9e));var _0xe9b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9b6e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe9b6('0x0'));var util=require(_0xe9b6('0x1'));var moment=require(_0xe9b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9b6('0x4'))['db'];var utils=require(_0xe9b6('0x5'));var logger=require(_0xe9b6('0x6'))(_0xe9b6('0x7'));var config=require(_0xe9b6('0x8'));var jayson=require(_0xe9b6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa3a6fb,_0x2f6633,_0x4b9def){return new BPromise(function(_0x2a7f96,_0x5a5137){return client[_0xe9b6('0xa')](_0xa3a6fb,_0x4b9def)[_0xe9b6('0xb')](function(_0x188d12){logger[_0xe9b6('0xc')](_0xe9b6('0xd'),_0x2f6633,_0xe9b6('0xe'));logger['debug'](_0xe9b6('0xf'),_0x2f6633,'request\x20sent',JSON[_0xe9b6('0x10')](_0x188d12));if(_0x188d12[_0xe9b6('0x11')]){if(_0x188d12[_0xe9b6('0x11')][_0xe9b6('0x12')]===0x1f4){logger['error'](_0xe9b6('0xd'),_0x2f6633,_0x188d12['error'][_0xe9b6('0x13')]);return _0x5a5137(_0x188d12['error'][_0xe9b6('0x13')]);}logger[_0xe9b6('0x11')](_0xe9b6('0xd'),_0x2f6633,_0x188d12[_0xe9b6('0x11')][_0xe9b6('0x13')]);return _0x2a7f96(_0x188d12[_0xe9b6('0x11')][_0xe9b6('0x13')]);}else{logger[_0xe9b6('0xc')](_0xe9b6('0xd'),_0x2f6633,_0xe9b6('0xe'));_0x2a7f96(_0x188d12['result'][_0xe9b6('0x13')]);}})[_0xe9b6('0x14')](function(_0x28bfa4){logger[_0xe9b6('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f6633,_0x28bfa4);_0x5a5137(_0x28bfa4);});});} \ No newline at end of file +var _0xa701=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0xa701,0x188));var _0x1a70=function(_0x297c27,_0x2ca3e4){_0x297c27=_0x297c27-0x0;var _0x2a9997=_0xa701[_0x297c27];return _0x2a9997;};'use strict';var _=require(_0x1a70('0x0'));var util=require(_0x1a70('0x1'));var moment=require('moment');var BPromise=require(_0x1a70('0x2'));var rs=require(_0x1a70('0x3'));var fs=require('fs');var Redis=require(_0x1a70('0x4'));var db=require(_0x1a70('0x5'))['db'];var utils=require(_0x1a70('0x6'));var logger=require('../../config/logger')(_0x1a70('0x7'));var config=require(_0x1a70('0x8'));var jayson=require(_0x1a70('0x9'));var client=jayson['client'][_0x1a70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55c631,_0x3c844d,_0x49b3b4){return new BPromise(function(_0x3b741f,_0x4c1c9c){return client[_0x1a70('0xb')](_0x55c631,_0x49b3b4)[_0x1a70('0xc')](function(_0x40c3b4){logger[_0x1a70('0xd')](_0x1a70('0xe'),_0x3c844d,_0x1a70('0xf'));logger[_0x1a70('0x10')](_0x1a70('0x11'),_0x3c844d,_0x1a70('0xf'),JSON[_0x1a70('0x12')](_0x40c3b4));if(_0x40c3b4[_0x1a70('0x13')]){if(_0x40c3b4[_0x1a70('0x13')][_0x1a70('0x14')]===0x1f4){logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x40c3b4[_0x1a70('0x13')]['message']);return _0x4c1c9c(_0x40c3b4['error']['message']);}logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x40c3b4[_0x1a70('0x13')][_0x1a70('0x15')]);return _0x3b741f(_0x40c3b4[_0x1a70('0x13')]['message']);}else{logger['info'](_0x1a70('0xe'),_0x3c844d,_0x1a70('0xf'));_0x3b741f(_0x40c3b4[_0x1a70('0x16')][_0x1a70('0x15')]);}})[_0x1a70('0x17')](function(_0x8a970d){logger[_0x1a70('0x13')](_0x1a70('0xe'),_0x3c844d,_0x8a970d);_0x4c1c9c(_0x8a970d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 65c9825..dc898a9 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 _0xf3cc=['Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x20534c,_0xe46275){_0x20534c=_0x20534c-0x0;var _0x1925cc=_0xf3cc[_0x20534c];return _0x1925cc;};'use strict';var multer=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var path=require(_0xcf3c('0x2'));var timeout=require(_0xcf3c('0x3'));var express=require('express');var router=express[_0xcf3c('0x4')]();var fs_extra=require(_0xcf3c('0x5'));var auth=require(_0xcf3c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf3c('0x7'));var controller=require(_0xcf3c('0x8'));router['get']('/',auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xa')]);router[_0xcf3c('0xb')](_0xcf3c('0xc'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xd')]);router[_0xcf3c('0xe')]('/',auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xf')]);router[_0xcf3c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcf3c('0x11')]);router[_0xcf3c('0x12')](_0xcf3c('0xc'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0x13')]);module[_0xcf3c('0x14')]=router; \ No newline at end of file +var _0xea89=['/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index'];(function(_0xd42bb1,_0x126627){var _0x2281c6=function(_0x3aa6b2){while(--_0x3aa6b2){_0xd42bb1['push'](_0xd42bb1['shift']());}};_0x2281c6(++_0x126627);}(_0xea89,0x1e2));var _0x9ea8=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0xea89[_0xf64e53];return _0x1e185e;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ea8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ea8('0x6'));var config=require('../../config/environment');var controller=require(_0x9ea8('0x7'));router[_0x9ea8('0x8')]('/',auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xa')]);router[_0x9ea8('0x8')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['show']);router[_0x9ea8('0xc')]('/',auth[_0x9ea8('0x9')](),controller['create']);router[_0x9ea8('0xd')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['update']);router[_0x9ea8('0xe')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xf')]);module[_0x9ea8('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e883513..f4da27d 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 _0xcb36=['exports','name','sequelize'];(function(_0x6fadaf,_0x77a39c){var _0x422d9d=function(_0x4d6caf){while(--_0x4d6caf){_0x6fadaf['push'](_0x6fadaf['shift']());}};_0x422d9d(++_0x77a39c);}(_0xcb36,0xe9));var _0x6cb3=function(_0x46f65d,_0x4859ef){_0x46f65d=_0x46f65d-0x0;var _0x5be93c=_0xcb36[_0x46f65d];return _0x5be93c;};'use strict';var Sequelize=require(_0x6cb3('0x0'));module[_0x6cb3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6cb3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa5df=['sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa5df,0x190));var _0xfa5d=function(_0x45dfd3,_0x46506b){_0x45dfd3=_0x45dfd3-0x0;var _0x29d982=_0xa5df[_0x45dfd3];return _0x29d982;};'use strict';var Sequelize=require(_0xfa5d('0x0'));module[_0xfa5d('0x1')]={'name':{'type':Sequelize[_0xfa5d('0x2')],'unique':_0xfa5d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2bd8a24..c8eb218 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 _0xc839=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','end','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x3ef411,_0x24db9c){var _0xc31610=function(_0xa47591){while(--_0xa47591){_0x3ef411['push'](_0x3ef411['shift']());}};_0xc31610(++_0x24db9c);}(_0xc839,0xb8));var _0x9c83=function(_0x1c4daf,_0x201046){_0x1c4daf=_0x1c4daf-0x0;var _0x17f70d=_0xc839[_0x1c4daf];return _0x17f70d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c83('0x0'));var zipdir=require(_0x9c83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c83('0x2'));var moment=require('moment');var BPromise=require(_0x9c83('0x3'));var Mustache=require(_0x9c83('0x4'));var util=require(_0x9c83('0x5'));var path=require(_0x9c83('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c83('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c83('0x8'));var squel=require(_0x9c83('0x9'));var crypto=require('crypto');var jsforce=require(_0x9c83('0xa'));var deskjs=require(_0x9c83('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9c83('0xc'));var Papa=require('papaparse');var Redis=require(_0x9c83('0xd'));var authService=require(_0x9c83('0xe'));var qs=require(_0x9c83('0xf'));var as=require(_0x9c83('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c83('0x11'))(_0x9c83('0x12'));var utils=require('../../config/utils');var config=require(_0x9c83('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c83('0x14'))['db'];function respondWithStatusCode(_0x5f1cfc,_0x56003c){_0x56003c=_0x56003c||0xcc;return function(_0x37e3b1){if(_0x37e3b1){return _0x5f1cfc[_0x9c83('0x15')](_0x56003c);}return _0x5f1cfc[_0x9c83('0x16')](_0x56003c)['end']();};}function respondWithResult(_0x10d854,_0x435b2b){_0x435b2b=_0x435b2b||0xc8;return function(_0xc77daf){if(_0xc77daf){return _0x10d854[_0x9c83('0x16')](_0x435b2b)[_0x9c83('0x17')](_0xc77daf);}};}function respondWithFilteredResult(_0x294a99,_0x230382){return function(_0x46eae4){if(_0x46eae4){var _0x40bfe8=typeof _0x230382[_0x9c83('0x18')]===_0x9c83('0x19')&&typeof _0x230382[_0x9c83('0x1a')]===_0x9c83('0x19');var _0x1323d8=_0x46eae4[_0x9c83('0x1b')];var _0x280948=_0x40bfe8?0x0:_0x230382[_0x9c83('0x18')];var _0x49ee27=_0x40bfe8?_0x46eae4[_0x9c83('0x1b')]:_0x230382[_0x9c83('0x18')]+_0x230382[_0x9c83('0x1a')];var _0x1b0deb;if(_0x49ee27>=_0x1323d8){_0x49ee27=_0x1323d8;_0x1b0deb=0xc8;}else{_0x1b0deb=0xce;}_0x294a99[_0x9c83('0x16')](_0x1b0deb);return _0x294a99[_0x9c83('0x1c')](_0x9c83('0x1d'),_0x280948+'-'+_0x49ee27+'/'+_0x1323d8)[_0x9c83('0x17')](_0x46eae4);}return null;};}function patchUpdates(_0x3b4f49){return function(_0x3dcd24){try{jsonpatch[_0x9c83('0x1e')](_0x3dcd24,_0x3b4f49,!![]);}catch(_0x436d1a){return BPromise[_0x9c83('0x1f')](_0x436d1a);}return _0x3dcd24['save']();};}function saveUpdates(_0xa1e9c0,_0x2873fe){return function(_0x1a12c8){if(_0x1a12c8){return _0x1a12c8['update'](_0xa1e9c0)[_0x9c83('0x20')](function(_0x4bd56b){return _0x4bd56b;});}return null;};}function removeEntity(_0x502638,_0x3521a1){return function(_0xb935e4){if(_0xb935e4){return _0xb935e4[_0x9c83('0x21')]()[_0x9c83('0x20')](function(){var _0x1b813c=_0xb935e4[_0x9c83('0x22')]({'plain':!![]});var _0xba81c3='Variables';return db[_0x9c83('0x23')][_0x9c83('0x21')]({'where':{'type':_0xba81c3,'resourceId':_0x1b813c['id']}})['then'](function(){return _0xb935e4;});})[_0x9c83('0x20')](function(){_0x502638['status'](0xcc)[_0x9c83('0x24')]();});}};}function handleEntityNotFound(_0xe76892,_0x3c080c){return function(_0x212f4e){if(!_0x212f4e){_0xe76892[_0x9c83('0x15')](0x194);}return _0x212f4e;};}function handleError(_0xe999c3,_0x2ae4f5){_0x2ae4f5=_0x2ae4f5||0x1f4;return function(_0xdbd8fc){logger['error'](_0xdbd8fc[_0x9c83('0x25')]);if(_0xdbd8fc['name']){delete _0xdbd8fc[_0x9c83('0x26')];}_0xe999c3[_0x9c83('0x16')](_0x2ae4f5)[_0x9c83('0x27')](_0xdbd8fc);};}exports[_0x9c83('0x28')]=function(_0x425b00,_0x50e045){var _0x4a09e6={},_0x5d2295={},_0x112195={'count':0x0,'rows':[]};var _0x4b83ff=_['map'](db[_0x9c83('0x29')][_0x9c83('0x2a')],function(_0x2e3886){return{'name':_0x2e3886[_0x9c83('0x2b')],'type':_0x2e3886[_0x9c83('0x2c')][_0x9c83('0x2d')]};});_0x5d2295[_0x9c83('0x2e')]=_[_0x9c83('0x2f')](_0x4b83ff,'name');_0x5d2295[_0x9c83('0x30')]=_['keys'](_0x425b00[_0x9c83('0x30')]);_0x5d2295[_0x9c83('0x31')]=_[_0x9c83('0x32')](_0x5d2295[_0x9c83('0x2e')],_0x5d2295['query']);_0x4a09e6[_0x9c83('0x33')]=_[_0x9c83('0x32')](_0x5d2295['model'],qs[_0x9c83('0x34')](_0x425b00['query'][_0x9c83('0x34')]));_0x4a09e6['attributes']=_0x4a09e6['attributes'][_0x9c83('0x35')]?_0x4a09e6[_0x9c83('0x33')]:_0x5d2295[_0x9c83('0x2e')];if(!_0x425b00[_0x9c83('0x30')][_0x9c83('0x36')](_0x9c83('0x37'))){_0x4a09e6[_0x9c83('0x1a')]=qs[_0x9c83('0x1a')](_0x425b00[_0x9c83('0x30')][_0x9c83('0x1a')]);_0x4a09e6['offset']=qs[_0x9c83('0x18')](_0x425b00[_0x9c83('0x30')]['offset']);}_0x4a09e6[_0x9c83('0x38')]=qs['sort'](_0x425b00[_0x9c83('0x30')][_0x9c83('0x39')]);_0x4a09e6['where']=qs['filters'](_[_0x9c83('0x3a')](_0x425b00[_0x9c83('0x30')],_0x5d2295['filters']),_0x4b83ff);if(_0x425b00[_0x9c83('0x30')][_0x9c83('0x3b')]){_0x4a09e6['where']=_[_0x9c83('0x3c')](_0x4a09e6[_0x9c83('0x3d')],{'$or':_['map'](_0x4b83ff,function(_0x2d81f0){if(_0x2d81f0[_0x9c83('0x2c')]!==_0x9c83('0x3e')){var _0x2b4681={};_0x2b4681[_0x2d81f0[_0x9c83('0x26')]]={'$like':'%'+_0x425b00[_0x9c83('0x30')][_0x9c83('0x3b')]+'%'};return _0x2b4681;}})});}_0x4a09e6=_['merge']({},_0x4a09e6,_0x425b00[_0x9c83('0x3f')]);var _0x47b740={'where':_0x4a09e6['where']};return db[_0x9c83('0x29')][_0x9c83('0x1b')](_0x47b740)[_0x9c83('0x20')](function(_0x3f4943){_0x112195[_0x9c83('0x1b')]=_0x3f4943;if(_0x425b00[_0x9c83('0x30')][_0x9c83('0x40')]){_0x4a09e6[_0x9c83('0x41')]=[{'all':!![]}];}return db[_0x9c83('0x29')][_0x9c83('0x42')](_0x4a09e6);})[_0x9c83('0x20')](function(_0x571138){_0x112195[_0x9c83('0x43')]=_0x571138;return _0x112195;})[_0x9c83('0x20')](respondWithFilteredResult(_0x50e045,_0x4a09e6))['catch'](handleError(_0x50e045,null));};exports[_0x9c83('0x44')]=function(_0x201c62,_0x3533ac){var _0x3fa948={'raw':!![],'where':{'id':_0x201c62[_0x9c83('0x45')]['id']}},_0x224835={};_0x224835['model']=_[_0x9c83('0x46')](db['Variable'][_0x9c83('0x2a')]);_0x224835[_0x9c83('0x30')]=_[_0x9c83('0x46')](_0x201c62[_0x9c83('0x30')]);_0x224835[_0x9c83('0x31')]=_[_0x9c83('0x32')](_0x224835['model'],_0x224835[_0x9c83('0x30')]);_0x3fa948['attributes']=_[_0x9c83('0x32')](_0x224835[_0x9c83('0x2e')],qs[_0x9c83('0x34')](_0x201c62[_0x9c83('0x30')][_0x9c83('0x34')]));_0x3fa948[_0x9c83('0x33')]=_0x3fa948[_0x9c83('0x33')][_0x9c83('0x35')]?_0x3fa948[_0x9c83('0x33')]:_0x224835[_0x9c83('0x2e')];if(_0x201c62[_0x9c83('0x30')][_0x9c83('0x40')]){_0x3fa948[_0x9c83('0x41')]=[{'all':!![]}];}_0x3fa948=_[_0x9c83('0x3c')]({},_0x3fa948,_0x201c62['options']);return db[_0x9c83('0x29')][_0x9c83('0x47')](_0x3fa948)[_0x9c83('0x20')](handleEntityNotFound(_0x3533ac,null))[_0x9c83('0x20')](respondWithResult(_0x3533ac,null))['catch'](handleError(_0x3533ac,null));};exports[_0x9c83('0x48')]=function(_0x3cb48a,_0x384ee5){return db[_0x9c83('0x29')][_0x9c83('0x48')](_0x3cb48a[_0x9c83('0x49')],{})[_0x9c83('0x20')](function(_0x47ee30){var _0x5aa96c=_0x3cb48a[_0x9c83('0x4a')][_0x9c83('0x22')]({'plain':!![]});if(!_0x5aa96c)throw new Error(_0x9c83('0x4b'));if(_0x5aa96c[_0x9c83('0x4c')]==='user'){var _0x50ffad=_0x47ee30['get']({'plain':!![]});var _0x2d957e=_0x9c83('0x4d');return db[_0x9c83('0x4e')][_0x9c83('0x47')]({'where':{'name':_0x2d957e,'userProfileId':_0x5aa96c[_0x9c83('0x4f')]},'raw':!![]})['then'](function(_0x4b6d0c){if(_0x4b6d0c&&_0x4b6d0c[_0x9c83('0x50')]===0x0){return db[_0x9c83('0x23')][_0x9c83('0x48')]({'name':_0x50ffad[_0x9c83('0x26')],'resourceId':_0x50ffad['id'],'type':_0x4b6d0c[_0x9c83('0x26')],'sectionId':_0x4b6d0c['id']},{})['then'](function(){return _0x47ee30;});}else{return _0x47ee30;}})[_0x9c83('0x51')](function(_0x3f7b50){logger[_0x9c83('0x52')](_0x9c83('0x53'),_0x3f7b50);throw _0x3f7b50;});}return _0x47ee30;})[_0x9c83('0x20')](respondWithResult(_0x384ee5,0xc9))['catch'](handleError(_0x384ee5,null));};exports[_0x9c83('0x54')]=function(_0x487edf,_0x3a3fdc){if(_0x487edf[_0x9c83('0x49')]['id']){delete _0x487edf[_0x9c83('0x49')]['id'];}return db[_0x9c83('0x29')][_0x9c83('0x47')]({'where':{'id':_0x487edf['params']['id']}})[_0x9c83('0x20')](handleEntityNotFound(_0x3a3fdc,null))[_0x9c83('0x20')](saveUpdates(_0x487edf['body'],null))['then'](respondWithResult(_0x3a3fdc,null))[_0x9c83('0x51')](handleError(_0x3a3fdc,null));};exports['destroy']=function(_0x16ccea,_0x48c5bf){return db[_0x9c83('0x29')][_0x9c83('0x47')]({'where':{'id':_0x16ccea[_0x9c83('0x45')]['id']}})[_0x9c83('0x20')](handleEntityNotFound(_0x48c5bf,null))[_0x9c83('0x20')](removeEntity(_0x48c5bf,null))[_0x9c83('0x51')](handleError(_0x48c5bf,null));}; \ No newline at end of file +var _0x1fd5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','update','then','Variables','UserProfileResource','destroy','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','catch','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','error','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x26f661,_0x5ba5f3){var _0x402db7=function(_0x59f632){while(--_0x59f632){_0x26f661['push'](_0x26f661['shift']());}};_0x402db7(++_0x5ba5f3);}(_0x1fd5,0x87));var _0x51fd=function(_0x3e8285,_0x1ff5e4){_0x3e8285=_0x3e8285-0x0;var _0xe21112=_0x1fd5[_0x3e8285];return _0xe21112;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51fd('0x0'));var zipdir=require(_0x51fd('0x1'));var jsonpatch=require(_0x51fd('0x2'));var rp=require('request-promise');var moment=require(_0x51fd('0x3'));var BPromise=require(_0x51fd('0x4'));var Mustache=require(_0x51fd('0x5'));var util=require('util');var path=require(_0x51fd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51fd('0x7'));var _=require(_0x51fd('0x8'));var squel=require(_0x51fd('0x9'));var crypto=require(_0x51fd('0xa'));var jsforce=require(_0x51fd('0xb'));var deskjs=require(_0x51fd('0xc'));var toCsv=require(_0x51fd('0xd'));var querystring=require('querystring');var Papa=require(_0x51fd('0xe'));var Redis=require(_0x51fd('0xf'));var authService=require(_0x51fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51fd('0x11'));var hardwareService=require(_0x51fd('0x12'));var logger=require(_0x51fd('0x13'))(_0x51fd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51fd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f5f03,_0x593dad){_0x593dad=_0x593dad||0xcc;return function(_0x209f65){if(_0x209f65){return _0x1f5f03[_0x51fd('0x16')](_0x593dad);}return _0x1f5f03['status'](_0x593dad)[_0x51fd('0x17')]();};}function respondWithResult(_0x1581c0,_0x46b838){_0x46b838=_0x46b838||0xc8;return function(_0x2044f6){if(_0x2044f6){return _0x1581c0['status'](_0x46b838)[_0x51fd('0x18')](_0x2044f6);}};}function respondWithFilteredResult(_0x5f353a,_0x2845c6){return function(_0x2f7927){if(_0x2f7927){var _0x5ee231=typeof _0x2845c6[_0x51fd('0x19')]===_0x51fd('0x1a')&&typeof _0x2845c6['limit']===_0x51fd('0x1a');var _0xa3272e=_0x2f7927[_0x51fd('0x1b')];var _0x2bedde=_0x5ee231?0x0:_0x2845c6[_0x51fd('0x19')];var _0x11aa88=_0x5ee231?_0x2f7927[_0x51fd('0x1b')]:_0x2845c6['offset']+_0x2845c6[_0x51fd('0x1c')];var _0x295239;if(_0x11aa88>=_0xa3272e){_0x11aa88=_0xa3272e;_0x295239=0xc8;}else{_0x295239=0xce;}_0x5f353a[_0x51fd('0x1d')](_0x295239);return _0x5f353a['set'](_0x51fd('0x1e'),_0x2bedde+'-'+_0x11aa88+'/'+_0xa3272e)[_0x51fd('0x18')](_0x2f7927);}return null;};}function patchUpdates(_0x1b4059){return function(_0x282a0c){try{jsonpatch[_0x51fd('0x1f')](_0x282a0c,_0x1b4059,!![]);}catch(_0x1564e4){return BPromise['reject'](_0x1564e4);}return _0x282a0c['save']();};}function saveUpdates(_0x3f6b01,_0x199def){return function(_0x7fe8f7){if(_0x7fe8f7){return _0x7fe8f7[_0x51fd('0x20')](_0x3f6b01)[_0x51fd('0x21')](function(_0xdd79ba){return _0xdd79ba;});}return null;};}function removeEntity(_0x4e70ba,_0x430f88){return function(_0x110658){if(_0x110658){return _0x110658['destroy']()[_0x51fd('0x21')](function(){var _0x1491c8=_0x110658['get']({'plain':!![]});var _0x1f2092=_0x51fd('0x22');return db[_0x51fd('0x23')][_0x51fd('0x24')]({'where':{'type':_0x1f2092,'resourceId':_0x1491c8['id']}})['then'](function(){return _0x110658;});})[_0x51fd('0x21')](function(){_0x4e70ba['status'](0xcc)[_0x51fd('0x17')]();});}};}function handleEntityNotFound(_0x31dbd1,_0x272376){return function(_0x139abd){if(!_0x139abd){_0x31dbd1[_0x51fd('0x16')](0x194);}return _0x139abd;};}function handleError(_0x28d135,_0x2f56dd){_0x2f56dd=_0x2f56dd||0x1f4;return function(_0x5c1239){logger['error'](_0x5c1239['stack']);if(_0x5c1239[_0x51fd('0x25')]){delete _0x5c1239[_0x51fd('0x25')];}_0x28d135[_0x51fd('0x1d')](_0x2f56dd)[_0x51fd('0x26')](_0x5c1239);};}exports[_0x51fd('0x27')]=function(_0x2822d7,_0x237188){var _0x181d79={},_0x2412d4={},_0x2ccfe9={'count':0x0,'rows':[]};var _0x19720c=_[_0x51fd('0x28')](db[_0x51fd('0x29')][_0x51fd('0x2a')],function(_0x320a2f){return{'name':_0x320a2f[_0x51fd('0x2b')],'type':_0x320a2f[_0x51fd('0x2c')]['key']};});_0x2412d4[_0x51fd('0x2d')]=_[_0x51fd('0x28')](_0x19720c,_0x51fd('0x25'));_0x2412d4['query']=_['keys'](_0x2822d7[_0x51fd('0x2e')]);_0x2412d4[_0x51fd('0x2f')]=_[_0x51fd('0x30')](_0x2412d4[_0x51fd('0x2d')],_0x2412d4[_0x51fd('0x2e')]);_0x181d79[_0x51fd('0x31')]=_[_0x51fd('0x30')](_0x2412d4[_0x51fd('0x2d')],qs['fields'](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x32')]));_0x181d79['attributes']=_0x181d79[_0x51fd('0x31')][_0x51fd('0x33')]?_0x181d79[_0x51fd('0x31')]:_0x2412d4[_0x51fd('0x2d')];if(!_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x34')](_0x51fd('0x35'))){_0x181d79[_0x51fd('0x1c')]=qs[_0x51fd('0x1c')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x1c')]);_0x181d79[_0x51fd('0x19')]=qs[_0x51fd('0x19')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x19')]);}_0x181d79[_0x51fd('0x36')]=qs[_0x51fd('0x37')](_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x37')]);_0x181d79['where']=qs[_0x51fd('0x2f')](_['pick'](_0x2822d7[_0x51fd('0x2e')],_0x2412d4[_0x51fd('0x2f')]),_0x19720c);if(_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x38')]){_0x181d79['where']=_[_0x51fd('0x39')](_0x181d79[_0x51fd('0x3a')],{'$or':_['map'](_0x19720c,function(_0x1aa409){if(_0x1aa409[_0x51fd('0x2c')]!==_0x51fd('0x3b')){var _0xe36862={};_0xe36862[_0x1aa409[_0x51fd('0x25')]]={'$like':'%'+_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x38')]+'%'};return _0xe36862;}})});}_0x181d79=_['merge']({},_0x181d79,_0x2822d7['options']);var _0x452e10={'where':_0x181d79[_0x51fd('0x3a')]};return db[_0x51fd('0x29')][_0x51fd('0x1b')](_0x452e10)['then'](function(_0x37f4e7){_0x2ccfe9[_0x51fd('0x1b')]=_0x37f4e7;if(_0x2822d7[_0x51fd('0x2e')][_0x51fd('0x3c')]){_0x181d79[_0x51fd('0x3d')]=[{'all':!![]}];}return db[_0x51fd('0x29')]['findAll'](_0x181d79);})[_0x51fd('0x21')](function(_0x145cd2){_0x2ccfe9['rows']=_0x145cd2;return _0x2ccfe9;})[_0x51fd('0x21')](respondWithFilteredResult(_0x237188,_0x181d79))[_0x51fd('0x3e')](handleError(_0x237188,null));};exports[_0x51fd('0x3f')]=function(_0x1e6bf2,_0x3d68c2){var _0x9fc591={'raw':!![],'where':{'id':_0x1e6bf2[_0x51fd('0x40')]['id']}},_0x142749={};_0x142749[_0x51fd('0x2d')]=_[_0x51fd('0x41')](db[_0x51fd('0x29')][_0x51fd('0x2a')]);_0x142749[_0x51fd('0x2e')]=_[_0x51fd('0x41')](_0x1e6bf2[_0x51fd('0x2e')]);_0x142749['filters']=_[_0x51fd('0x30')](_0x142749[_0x51fd('0x2d')],_0x142749[_0x51fd('0x2e')]);_0x9fc591['attributes']=_[_0x51fd('0x30')](_0x142749[_0x51fd('0x2d')],qs[_0x51fd('0x32')](_0x1e6bf2[_0x51fd('0x2e')][_0x51fd('0x32')]));_0x9fc591[_0x51fd('0x31')]=_0x9fc591[_0x51fd('0x31')]['length']?_0x9fc591['attributes']:_0x142749[_0x51fd('0x2d')];if(_0x1e6bf2['query'][_0x51fd('0x3c')]){_0x9fc591[_0x51fd('0x3d')]=[{'all':!![]}];}_0x9fc591=_['merge']({},_0x9fc591,_0x1e6bf2[_0x51fd('0x42')]);return db[_0x51fd('0x29')]['find'](_0x9fc591)[_0x51fd('0x21')](handleEntityNotFound(_0x3d68c2,null))['then'](respondWithResult(_0x3d68c2,null))[_0x51fd('0x3e')](handleError(_0x3d68c2,null));};exports[_0x51fd('0x43')]=function(_0x24999d,_0x367ea8){return db[_0x51fd('0x29')]['create'](_0x24999d[_0x51fd('0x44')],{})[_0x51fd('0x21')](function(_0x5ce93a){var _0x5a119a=_0x24999d[_0x51fd('0x45')]['get']({'plain':!![]});if(!_0x5a119a)throw new Error(_0x51fd('0x46'));if(_0x5a119a['role']===_0x51fd('0x45')){var _0x1d4362=_0x5ce93a[_0x51fd('0x47')]({'plain':!![]});var _0x44070a=_0x51fd('0x22');return db[_0x51fd('0x48')]['find']({'where':{'name':_0x44070a,'userProfileId':_0x5a119a['userProfileId']},'raw':!![]})[_0x51fd('0x21')](function(_0x11b41b){if(_0x11b41b&&_0x11b41b[_0x51fd('0x49')]===0x0){return db['UserProfileResource'][_0x51fd('0x43')]({'name':_0x1d4362[_0x51fd('0x25')],'resourceId':_0x1d4362['id'],'type':_0x11b41b[_0x51fd('0x25')],'sectionId':_0x11b41b['id']},{})['then'](function(){return _0x5ce93a;});}else{return _0x5ce93a;}})['catch'](function(_0x61e9bb){logger[_0x51fd('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x61e9bb);throw _0x61e9bb;});}return _0x5ce93a;})['then'](respondWithResult(_0x367ea8,0xc9))[_0x51fd('0x3e')](handleError(_0x367ea8,null));};exports[_0x51fd('0x20')]=function(_0x41341e,_0x4338ab){if(_0x41341e['body']['id']){delete _0x41341e['body']['id'];}return db[_0x51fd('0x29')][_0x51fd('0x4b')]({'where':{'id':_0x41341e[_0x51fd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4338ab,null))[_0x51fd('0x21')](saveUpdates(_0x41341e[_0x51fd('0x44')],null))[_0x51fd('0x21')](respondWithResult(_0x4338ab,null))['catch'](handleError(_0x4338ab,null));};exports[_0x51fd('0x24')]=function(_0x30af30,_0x5abea3){return db[_0x51fd('0x29')][_0x51fd('0x4b')]({'where':{'id':_0x30af30[_0x51fd('0x40')]['id']}})[_0x51fd('0x21')](handleEntityNotFound(_0x5abea3,null))[_0x51fd('0x21')](removeEntity(_0x5abea3,null))['catch'](handleError(_0x5abea3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3f79844..d6b2cee 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 _0x5e5a=['./variable.attributes','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x4ce011,_0x3f5f19){var _0x236423=function(_0x4261d2){while(--_0x4261d2){_0x4ce011['push'](_0x4ce011['shift']());}};_0x236423(++_0x3f5f19);}(_0x5e5a,0x85));var _0xa5e5=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x5e5a[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xa5e5('0x0'));var util=require(_0xa5e5('0x1'));var logger=require(_0xa5e5('0x2'))(_0xa5e5('0x3'));var moment=require('moment');var BPromise=require(_0xa5e5('0x4'));var rp=require(_0xa5e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa5e5('0x6'));var attributes=require(_0xa5e5('0x7'));module['exports']=function(_0x4e7caf,_0x25f5b1){return _0x4e7caf['define'](_0xa5e5('0x8'),attributes,{'tableName':_0xa5e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ade=['moment','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api'];(function(_0x51667b,_0x4409ec){var _0x3ec7ff=function(_0x265e31){while(--_0x265e31){_0x51667b['push'](_0x51667b['shift']());}};_0x3ec7ff(++_0x4409ec);}(_0x3ade,0x1d0));var _0xe3ad=function(_0x1c1777,_0x4f345b){_0x1c1777=_0x1c1777-0x0;var _0x1e634c=_0x3ade[_0x1c1777];return _0x1e634c;};'use strict';var _=require(_0xe3ad('0x0'));var util=require(_0xe3ad('0x1'));var logger=require(_0xe3ad('0x2'))(_0xe3ad('0x3'));var moment=require(_0xe3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3ad('0x5'));var fs=require('fs');var path=require(_0xe3ad('0x6'));var rimraf=require('rimraf');var config=require(_0xe3ad('0x7'));var attributes=require(_0xe3ad('0x8'));module[_0xe3ad('0x9')]=function(_0x4af002,_0x1a578c){return _0x4af002[_0xe3ad('0xa')](_0xe3ad('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 3f91d88..53ac4f9 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x1d3a09,_0x3907da){var _0x16ded8=function(_0x9b9aad){while(--_0x9b9aad){_0x1d3a09['push'](_0x1d3a09['shift']());}};_0x16ded8(++_0x3907da);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3f7686,_0x20a6fc){var _0x28a7d4=function(_0x160ef0){while(--_0x160ef0){_0x3f7686['push'](_0x3f7686['shift']());}};_0x28a7d4(++_0x20a6fc);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1bbbe8c..5568ae6 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 _0x27fa=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get'];(function(_0x10ec09,_0x492ddb){var _0x8b5ed4=function(_0x12a4e3){while(--_0x12a4e3){_0x10ec09['push'](_0x10ec09['shift']());}};_0x8b5ed4(++_0x492ddb);}(_0x27fa,0x17d));var _0xa27f=function(_0x146243,_0x2e393a){_0x146243=_0x146243-0x0;var _0x5385b3=_0x27fa[_0x146243];return _0x5385b3;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa27f('0x0'));var controller=require(_0xa27f('0x1'));router[_0xa27f('0x2')]('/',controller[_0xa27f('0x3')]);router[_0xa27f('0x2')](_0xa27f('0x4'),auth[_0xa27f('0x5')](),auth[_0xa27f('0x6')](),controller[_0xa27f('0x7')]);router['get'](_0xa27f('0x8'),auth[_0xa27f('0x5')](),auth[_0xa27f('0x6')](),controller[_0xa27f('0x9')]);router[_0xa27f('0x2')](_0xa27f('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa27f('0xb')]);router[_0xa27f('0x2')]('/restart',auth['isAuthenticated'](),controller[_0xa27f('0xc')]);router[_0xa27f('0x2')](_0xa27f('0xd'),controller[_0xa27f('0xe')]);module[_0xa27f('0xf')]=router; \ No newline at end of file +var _0x9837=['reset','/pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','/reset','canUpdate'];(function(_0x366daf,_0x56e78f){var _0x14d1d5=function(_0x46ff5d){while(--_0x46ff5d){_0x366daf['push'](_0x366daf['shift']());}};_0x14d1d5(++_0x56e78f);}(_0x9837,0x166));var _0x7983=function(_0x47bb77,_0x28a3b6){_0x47bb77=_0x47bb77-0x0;var _0x524a15=_0x9837[_0x47bb77];return _0x524a15;};'use strict';var express=require(_0x7983('0x0'));var router=express[_0x7983('0x1')]();var auth=require(_0x7983('0x2'));var controller=require(_0x7983('0x3'));router[_0x7983('0x4')]('/',controller[_0x7983('0x5')]);router[_0x7983('0x4')](_0x7983('0x6'),auth[_0x7983('0x7')](),auth['canUpdate'](),controller['fetch']);router[_0x7983('0x4')](_0x7983('0x8'),auth[_0x7983('0x7')](),auth[_0x7983('0x9')](),controller[_0x7983('0xa')]);router[_0x7983('0x4')](_0x7983('0xb'),auth[_0x7983('0x7')](),auth[_0x7983('0x9')](),controller['pull']);router[_0x7983('0x4')](_0x7983('0xc'),auth['isAuthenticated'](),controller[_0x7983('0xd')]);router[_0x7983('0x4')](_0x7983('0xe'),controller[_0x7983('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ed8e06f..3bbcc75 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 _0xaedf=['fetch','tags','latest','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','pull','npm\x20install\x20--production','error','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','version','query'];(function(_0x502ca2,_0x9d1d12){var _0x449adc=function(_0x548214){while(--_0x548214){_0x502ca2['push'](_0x502ca2['shift']());}};_0x449adc(++_0x9d1d12);}(_0xaedf,0xf6));var _0xfaed=function(_0x3dae39,_0x149215){_0x3dae39=_0x3dae39-0x0;var _0x3ba039=_0xaedf[_0x3dae39];return _0x3ba039;};'use strict';var Umzug=require(_0xfaed('0x0'));var path=require(_0xfaed('0x1'));var fs=require('fs');var _=require(_0xfaed('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xfaed('0x3'))['exec'];var db=require(_0xfaed('0x4'))['db'];var config=require(_0xfaed('0x5'));var pm2=require(_0xfaed('0x6'));var logger=require('../../config/logger')(_0xfaed('0x7'));var git=require(_0xfaed('0x8'))(config[_0xfaed('0x9')]);exports[_0xfaed('0xa')]=function(_0x282ec0,_0x13a2f4){var _0x557898={'current':module[_0xfaed('0xb')][_0xfaed('0xc')],'phonebar':0x2};if(_0x282ec0[_0xfaed('0xd')]&&_0x282ec0[_0xfaed('0xd')]['latest']){return git[_0xfaed('0xe')]()[_0xfaed('0xf')](function(_0x529547,_0x3c1e35){_0x557898[_0xfaed('0x10')]=(_0x529547?module[_0xfaed('0xb')][_0xfaed('0xc')]:_0x3c1e35['latest'])||'2.0.0';return _0x13a2f4[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')](_0x557898);});}else{return _0x13a2f4['status'](0xc8)[_0xfaed('0x12')](_0x557898);}};exports[_0xfaed('0xe')]=function(_0x3dd1df,_0x586c08){return git[_0xfaed('0xe')]([_0xfaed('0x13'),_0xfaed('0x14')],function(_0x4bebf8){if(_0x4bebf8){logger['error'](_0x4bebf8);return _0x586c08['status'](0x1f4)[_0xfaed('0x12')](_0x4bebf8);}logger[_0xfaed('0x15')](_0xfaed('0x16'));return _0x586c08[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':_0xfaed('0x17')});});};exports[_0xfaed('0x18')]=function(_0x4afbc2,_0x52baac){return git[_0xfaed('0x18')](['--hard',_0xfaed('0x19')],function(_0x28d4c8){if(_0x28d4c8){logger['error'](_0x28d4c8);return _0x52baac[_0xfaed('0x11')](0x1f4)[_0xfaed('0x12')](_0x28d4c8);}logger[_0xfaed('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x52baac[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xfaed('0x1a')]=function(_0x253010,_0x50f226){exec(_0xfaed('0x1b'),function(_0x31ed00,_0x233c51,_0x26ab14){logger['info'](_0x233c51);logger['info'](_0x26ab14);if(_0x31ed00){logger[_0xfaed('0x1c')](_0x31ed00);return _0x50f226[_0xfaed('0x11')](0x1f4)[_0xfaed('0x12')](_0x31ed00);}return _0x50f226[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':_0x233c51});});};exports[_0xfaed('0x1d')]=function(_0x1ec7f0,_0x51f5d8){return pm2['restart'](_0xfaed('0x1e'))['then'](function(_0x42807f){logger[_0xfaed('0x15')](_0xfaed('0x1f'),_0x42807f);return _0x51f5d8[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':_0xfaed('0x20')});})[_0xfaed('0x21')](function(_0x26ddc7){logger[_0xfaed('0x1c')](_0x26ddc7);return _0x51f5d8[_0xfaed('0x11')](0x1f4)['json'](_0x26ddc7);});};exports[_0xfaed('0x22')]=function(_0x4aa6e3,_0xec2c57){var _0x576502=fs[_0xfaed('0x23')](path[_0xfaed('0x24')](config[_0xfaed('0x9')],_0xfaed('0x25'),'migrations'));var _0x1ed061=[];for(var _0x4e2506=0x0;_0x4e2506<_0x576502[_0xfaed('0x26')];_0x4e2506++){var _0x259b27=_0x576502[_0x4e2506]['replace'](_0xfaed('0x27'),'');if(compareVersions(module[_0xfaed('0xb')][_0xfaed('0xc')],_0x259b27)===-0x1){_0x1ed061[_0xfaed('0x28')](_0x259b27);}}if(_0x1ed061[_0xfaed('0x26')]){var _0x39af8f=_0x1ed061[_0xfaed('0x29')](compareVersions);var _0x5c5bbc=new Umzug({'storage':_0xfaed('0x2a'),'storageOptions':{'model':db[_0xfaed('0x2b')],'modelName':_0xfaed('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xfaed('0x2a')]['getQueryInterface'](),db['sequelize'][_0xfaed('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xfaed('0x24')](config[_0xfaed('0x9')],_0xfaed('0x25'),_0xfaed('0x22')),'pattern':/\.js$/}});_0x5c5bbc['up']({'migrations':_[_0xfaed('0x2d')](_0x39af8f,function(_0x3b0b39){return _0x3b0b39+_0xfaed('0x27');})})[_0xfaed('0x2e')](function(){return _0xec2c57[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':_0xfaed('0x2f')+module[_0xfaed('0xb')][_0xfaed('0xc')]+_0xfaed('0x30')+_[_0xfaed('0x31')](_0x39af8f),'migrations':_[_0xfaed('0x24')](_0x39af8f)});})['catch'](function(_0x19890e){if(_0x19890e instanceof db[_0xfaed('0x2a')][_0xfaed('0x32')]){return _0xec2c57[_0xfaed('0x11')](0xc8)[_0xfaed('0x12')]({'output':_0xfaed('0x33')});}else{return _0xec2c57['status'](0x1f4)['json'](_0x19890e);}});}else{return _0xec2c57['status'](0xc8)[_0xfaed('0x12')]({'output':_0xfaed('0x33')});}}; \ No newline at end of file +var _0x607a=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','version','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x607a,0x192));var _0xa607=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x607a[_0x4b369d];return _0x571a98;};'use strict';var Umzug=require(_0xa607('0x0'));var path=require(_0xa607('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xa607('0x2'));var exec=require(_0xa607('0x3'))[_0xa607('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xa607('0x5'));var pm2=require(_0xa607('0x6'));var logger=require(_0xa607('0x7'))(_0xa607('0x8'));var git=require('simple-git')(config[_0xa607('0x9')]);exports['index']=function(_0x485a1b,_0x12f8ab){var _0x2a9368={'current':module[_0xa607('0xa')]['version'],'phonebar':0x2};if(_0x485a1b[_0xa607('0xb')]&&_0x485a1b['query'][_0xa607('0xc')]){return git[_0xa607('0xd')]()[_0xa607('0xe')](function(_0x3e6c8d,_0x1abffd){_0x2a9368[_0xa607('0xc')]=(_0x3e6c8d?module[_0xa607('0xa')]['version']:_0x1abffd[_0xa607('0xc')])||_0xa607('0xf');return _0x12f8ab[_0xa607('0x10')](0xc8)[_0xa607('0x11')](_0x2a9368);});}else{return _0x12f8ab[_0xa607('0x10')](0xc8)['json'](_0x2a9368);}};exports[_0xa607('0xd')]=function(_0x35d69f,_0x1ba210){return git[_0xa607('0xd')]([_0xa607('0x12'),'master'],function(_0x185010){if(_0x185010){logger[_0xa607('0x13')](_0x185010);return _0x1ba210[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x185010);}logger['info'](_0xa607('0x14'));return _0x1ba210[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x15')});});};exports[_0xa607('0x16')]=function(_0x160e7b,_0x315657){return git[_0xa607('0x16')]([_0xa607('0x17'),_0xa607('0x18')],function(_0x597a88){if(_0x597a88){logger['error'](_0x597a88);return _0x315657['status'](0x1f4)['json'](_0x597a88);}logger[_0xa607('0x19')](_0xa607('0x1a'));return _0x315657['status'](0xc8)[_0xa607('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0xa607('0x1b')]=function(_0x595fbf,_0x1ac238){exec(_0xa607('0x1c'),function(_0x124a1b,_0x24a0be,_0x179afb){logger[_0xa607('0x19')](_0x24a0be);logger[_0xa607('0x19')](_0x179afb);if(_0x124a1b){logger['error'](_0x124a1b);return _0x1ac238[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x124a1b);}return _0x1ac238[_0xa607('0x10')](0xc8)['json']({'output':_0x24a0be});});};exports[_0xa607('0x1d')]=function(_0x37fc3c,_0x3df999){return pm2[_0xa607('0x1d')](_0xa607('0x1e'))[_0xa607('0x1f')](function(_0x149b4b){logger[_0xa607('0x19')](_0xa607('0x20'),_0x149b4b);return _0x3df999[_0xa607('0x10')](0xc8)['json']({'output':_0xa607('0x21')});})[_0xa607('0x22')](function(_0x60d6da){logger[_0xa607('0x13')](_0x60d6da);return _0x3df999[_0xa607('0x10')](0x1f4)['json'](_0x60d6da);});};exports[_0xa607('0x23')]=function(_0x58953e,_0x4d305e){var _0x531eeb=fs['readdirSync'](path[_0xa607('0x24')](config[_0xa607('0x9')],'server','migrations'));var _0x1e3ddc=[];for(var _0x3881f1=0x0;_0x3881f1<_0x531eeb[_0xa607('0x25')];_0x3881f1++){var _0x205bfa=_0x531eeb[_0x3881f1][_0xa607('0x26')](_0xa607('0x27'),'');if(compareVersions(module[_0xa607('0xa')][_0xa607('0x28')],_0x205bfa)===-0x1){_0x1e3ddc[_0xa607('0x29')](_0x205bfa);}}if(_0x1e3ddc[_0xa607('0x25')]){var _0x2277ee=_0x1e3ddc[_0xa607('0x2a')](compareVersions);var _0x78dcfb=new Umzug({'storage':_0xa607('0x2b'),'storageOptions':{'model':db[_0xa607('0x2c')],'modelName':'Migration','columnName':_0xa607('0x28')},'migrations':{'params':[db[_0xa607('0x2b')][_0xa607('0x2d')](),db[_0xa607('0x2b')][_0xa607('0x2e')],function(){throw new Error(_0xa607('0x2f'));}],'path':path[_0xa607('0x24')](config[_0xa607('0x9')],_0xa607('0x30'),_0xa607('0x23')),'pattern':/\.js$/}});_0x78dcfb['up']({'migrations':_[_0xa607('0x31')](_0x2277ee,function(_0xac146b){return _0xac146b+_0xa607('0x27');})})[_0xa607('0x1f')](function(){return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x32')+module[_0xa607('0xa')][_0xa607('0x28')]+_0xa607('0x33')+_[_0xa607('0x34')](_0x2277ee),'migrations':_[_0xa607('0x24')](_0x2277ee)});})[_0xa607('0x22')](function(_0x349d20){if(_0x349d20 instanceof db['sequelize']['UniqueConstraintError']){return _0x4d305e[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}else{return _0x4d305e['status'](0x1f4)[_0xa607('0x11')](_0x349d20);}});}else{return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index bdb24d7..4268559 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 _0x1f8f=['./voiceAgentReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4e00de,_0x768a7d){var _0x2fd981=function(_0x2bc4e4){while(--_0x2bc4e4){_0x4e00de['push'](_0x4e00de['shift']());}};_0x2fd981(++_0x768a7d);}(_0x1f8f,0x19c));var _0xf1f8=function(_0x41ef4a,_0x2184a2){_0x41ef4a=_0x41ef4a-0x0;var _0x2cbead=_0x1f8f[_0x41ef4a];return _0x2cbead;};'use strict';var multer=require(_0xf1f8('0x0'));var util=require(_0xf1f8('0x1'));var path=require('path');var timeout=require(_0xf1f8('0x2'));var express=require(_0xf1f8('0x3'));var router=express[_0xf1f8('0x4')]();var fs_extra=require(_0xf1f8('0x5'));var auth=require(_0xf1f8('0x6'));var interaction=require(_0xf1f8('0x7'));var config=require('../../config/environment');var controller=require(_0xf1f8('0x8'));router['get']('/',auth[_0xf1f8('0x9')](),controller[_0xf1f8('0xa')]);router[_0xf1f8('0xb')]('/describe',auth[_0xf1f8('0x9')](),controller[_0xf1f8('0xc')]);router[_0xf1f8('0xb')](_0xf1f8('0xd'),auth[_0xf1f8('0x9')](),controller[_0xf1f8('0xe')]);router[_0xf1f8('0xf')]('/',auth[_0xf1f8('0x9')](),controller[_0xf1f8('0x10')]);router['put'](_0xf1f8('0xd'),auth[_0xf1f8('0x9')](),controller[_0xf1f8('0x11')]);router[_0xf1f8('0x12')](_0xf1f8('0xd'),auth[_0xf1f8('0x9')](),controller[_0xf1f8('0x13')]);module[_0xf1f8('0x14')]=router; \ No newline at end of file +var _0x3b1a=['util','path','express','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4fa72d,_0x22ebbf){var _0x175aa3=function(_0x4afd9c){while(--_0x4afd9c){_0x4fa72d['push'](_0x4fa72d['shift']());}};_0x175aa3(++_0x22ebbf);}(_0x3b1a,0x18f));var _0xa3b1=function(_0x425c5b,_0x5a23a5){_0x425c5b=_0x425c5b-0x0;var _0x3ec47a=_0x3b1a[_0x425c5b];return _0x3ec47a;};'use strict';var multer=require(_0xa3b1('0x0'));var util=require(_0xa3b1('0x1'));var path=require(_0xa3b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3b1('0x3'));var router=express[_0xa3b1('0x4')]();var fs_extra=require(_0xa3b1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3b1('0x6'));var controller=require(_0xa3b1('0x7'));router[_0xa3b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa3b1('0x9'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xb')]);router[_0xa3b1('0x8')](_0xa3b1('0xc'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xd')]);router[_0xa3b1('0xe')]('/',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xf')]);router['put'](_0xa3b1('0xc'),auth['isAuthenticated'](),controller[_0xa3b1('0x10')]);router[_0xa3b1('0x11')]('/:id',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x12')]);module[_0xa3b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9cf1b5f..531921a 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 _0xa30a=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'type':{'type':Sequelize[_0xaa30('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaa30('0x2')]},'calleridname':{'type':Sequelize[_0xaa30('0x2')]},'queue':{'type':Sequelize[_0xaa30('0x2')]},'interface':{'type':Sequelize[_0xaa30('0x2')]},'membername':{'type':Sequelize[_0xaa30('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaa30('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaa30('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xaa30('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xaa30('0x4')]},'agentcomplete':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaa30('0x4')]},'agentacw':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaa30('0x4')]},'reason':{'type':Sequelize[_0xaa30('0x2')]},'lastevent':{'type':Sequelize[_0xaa30('0x2')]},'channel':{'type':Sequelize[_0xaa30('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaa30('0x2')]},'accountcode':{'type':Sequelize[_0xaa30('0x2')]},'context':{'type':Sequelize[_0xaa30('0x2')]},'exten':{'type':Sequelize[_0xaa30('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xaa30('0x2')]},'destchannelstate':{'type':Sequelize[_0xaa30('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xaa30('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa30('0x2')]},'destlanguage':{'type':Sequelize[_0xaa30('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa30('0x2')]},'destcontext':{'type':Sequelize[_0xaa30('0x2')]},'destexten':{'type':Sequelize[_0xaa30('0x2')]},'destpriority':{'type':Sequelize[_0xaa30('0x2')]},'destuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaa30('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'agententerreason':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x47d6=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x47d6,0x13f));var _0x647d=function(_0x1177cd,_0xec72e1){_0x1177cd=_0x1177cd-0x0;var _0x37d3cc=_0x47d6[_0x1177cd];return _0x37d3cc;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'type':{'type':Sequelize[_0x647d('0x2')]},'uniqueid':{'type':Sequelize[_0x647d('0x2')]},'calleridnum':{'type':Sequelize[_0x647d('0x2')]},'calleridname':{'type':Sequelize[_0x647d('0x2')]},'queue':{'type':Sequelize[_0x647d('0x2')]},'interface':{'type':Sequelize[_0x647d('0x2')]},'membername':{'type':Sequelize[_0x647d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x647d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x647d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x647d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x647d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x647d('0x3')]},'holdtime':{'type':Sequelize[_0x647d('0x4')]},'agentcomplete':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x647d('0x4')]},'agentacw':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x647d('0x4')]},'reason':{'type':Sequelize[_0x647d('0x2')]},'lastevent':{'type':Sequelize[_0x647d('0x2')]},'channel':{'type':Sequelize[_0x647d('0x2')]},'channelstate':{'type':Sequelize[_0x647d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'connectedlinename':{'type':Sequelize[_0x647d('0x2')]},'language':{'type':Sequelize[_0x647d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x647d('0x2')]},'priority':{'type':Sequelize[_0x647d('0x2')]},'destchannel':{'type':Sequelize[_0x647d('0x2')]},'destchannelstate':{'type':Sequelize[_0x647d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x647d('0x2')]},'destcalleridname':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x647d('0x2')]},'destaccountcode':{'type':Sequelize[_0x647d('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x647d('0x2')]},'destpriority':{'type':Sequelize[_0x647d('0x2')]},'destuniqueid':{'type':Sequelize[_0x647d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x647d('0x2')],'comment':_0x647d('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x647d('0x2')]},'agententerreason':{'type':Sequelize[_0x647d('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 368e35c..85b166e 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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 7968eec..a5ec42a 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 _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x42c160,_0x474d23){var _0x4f6527=function(_0x16d8c9){while(--_0x16d8c9){_0x42c160['push'](_0x42c160['shift']());}};_0x4f6527(++_0x474d23);}(_0xcea5,0xed));var _0x5cea=function(_0xeb8615,_0x764e95){_0xeb8615=_0xeb8615-0x0;var _0x519cee=_0xcea5[_0xeb8615];return _0x519cee;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5cea('0xa'),_0x5cea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c46=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api','request-promise'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8c46,0x171));var _0x68c4=function(_0x50769b,_0x1428ce){_0x50769b=_0x50769b-0x0;var _0x144202=_0x8c46[_0x50769b];return _0x144202;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x68c4('0xa'),_0x68c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6d56a2a..847faf9 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 _0x345b=['../../config/environment','jayson/promise','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ad9ae,_0x2e237c){var _0x2babe0=function(_0x5cc7f0){while(--_0x5cc7f0){_0x1ad9ae['push'](_0x1ad9ae['shift']());}};_0x2babe0(++_0x2e237c);}(_0x345b,0x177));var _0xb345=function(_0x4dc149,_0x534f6){_0x4dc149=_0x4dc149-0x0;var _0x41c349=_0x345b[_0x4dc149];return _0x41c349;};'use strict';var _=require('lodash');var util=require(_0xb345('0x0'));var moment=require(_0xb345('0x1'));var BPromise=require(_0xb345('0x2'));var rs=require(_0xb345('0x3'));var fs=require('fs');var Redis=require(_0xb345('0x4'));var db=require(_0xb345('0x5'))['db'];var utils=require(_0xb345('0x6'));var logger=require(_0xb345('0x7'))(_0xb345('0x8'));var config=require(_0xb345('0x9'));var jayson=require(_0xb345('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x279d18,_0x321b17,_0x1b7bd6){return new BPromise(function(_0x517631,_0x4eeb63){return client['request'](_0x279d18,_0x1b7bd6)[_0xb345('0xb')](function(_0x4d6c6a){logger['info'](_0xb345('0xc'),_0x321b17,_0xb345('0xd'));logger[_0xb345('0xe')](_0xb345('0xf'),_0x321b17,_0xb345('0xd'),JSON[_0xb345('0x10')](_0x4d6c6a));if(_0x4d6c6a['error']){if(_0x4d6c6a['error']['code']===0x1f4){logger[_0xb345('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x321b17,_0x4d6c6a[_0xb345('0x11')][_0xb345('0x12')]);return _0x4eeb63(_0x4d6c6a[_0xb345('0x11')][_0xb345('0x12')]);}logger[_0xb345('0x11')](_0xb345('0xc'),_0x321b17,_0x4d6c6a[_0xb345('0x11')][_0xb345('0x12')]);return _0x517631(_0x4d6c6a[_0xb345('0x11')][_0xb345('0x12')]);}else{logger[_0xb345('0x13')](_0xb345('0xc'),_0x321b17,_0xb345('0xd'));_0x517631(_0x4d6c6a['result'][_0xb345('0x12')]);}})[_0xb345('0x14')](function(_0x13e828){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x321b17,_0x13e828);_0x4eeb63(_0x13e828);});});}exports['CreateVoiceAgentReport']=function(_0x2a951c){var _0x4b7ca1=this;return new Promise(function(_0x3d7acd,_0x4d76c9){return db['VoiceAgentReport'][_0xb345('0x15')](_0x2a951c[_0xb345('0x16')],{'raw':_0x2a951c[_0xb345('0x17')]?_0x2a951c[_0xb345('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4eadb9){logger['info'](_0xb345('0x18'),_0x2a951c);logger[_0xb345('0xe')](_0xb345('0x18'),_0x2a951c,JSON[_0xb345('0x10')](_0x4eadb9));_0x3d7acd(_0x4eadb9);})[_0xb345('0x14')](function(_0x3e73a7){logger[_0xb345('0x11')](_0xb345('0x18'),_0x3e73a7['message'],_0x2a951c);_0x4d76c9(_0x4b7ca1['error'](0x1f4,_0x3e73a7[_0xb345('0x12')]));});});};exports[_0xb345('0x19')]=function(_0x253144){var _0x37d7e5=this;return new Promise(function(_0x3414b9,_0x7d7400){return db[_0xb345('0x1a')][_0xb345('0x1b')](_0x253144[_0xb345('0x16')],{'raw':_0x253144[_0xb345('0x17')]?_0x253144['options'][_0xb345('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253144[_0xb345('0x17')]?_0x253144[_0xb345('0x17')][_0xb345('0x1d')]||null:null,'attributes':_0x253144[_0xb345('0x17')]?_0x253144[_0xb345('0x17')][_0xb345('0x1e')]||null:null,'limit':_0x253144[_0xb345('0x17')]?_0x253144[_0xb345('0x17')][_0xb345('0x1f')]||null:null})[_0xb345('0xb')](function(_0x4424b8){logger[_0xb345('0x13')](_0xb345('0x19'),_0x253144);logger['debug'](_0xb345('0x19'),_0x253144,JSON['stringify'](_0x4424b8));_0x3414b9(_0x4424b8);})['catch'](function(_0x353d1d){logger[_0xb345('0x11')](_0xb345('0x19'),_0x353d1d[_0xb345('0x12')],_0x253144);_0x7d7400(_0x37d7e5[_0xb345('0x11')](0x1f4,_0x353d1d[_0xb345('0x12')]));});});}; \ No newline at end of file +var _0x50b5=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring'];(function(_0x4d86d3,_0x2e9f10){var _0x81b4c0=function(_0x5b6e60){while(--_0x5b6e60){_0x4d86d3['push'](_0x4d86d3['shift']());}};_0x81b4c0(++_0x2e9f10);}(_0x50b5,0x150));var _0x550b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x50b5[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x550b('0x0'));var util=require(_0x550b('0x1'));var moment=require(_0x550b('0x2'));var BPromise=require('bluebird');var rs=require(_0x550b('0x3'));var fs=require('fs');var Redis=require(_0x550b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x550b('0x5'));var logger=require(_0x550b('0x6'))(_0x550b('0x7'));var config=require(_0x550b('0x8'));var jayson=require(_0x550b('0x9'));var client=jayson[_0x550b('0xa')][_0x550b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x346ab7,_0x47bd82,_0x2b4f6c){return new BPromise(function(_0x14ff30,_0x33ad41){return client['request'](_0x346ab7,_0x2b4f6c)[_0x550b('0xc')](function(_0x32fcd9){logger[_0x550b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x47bd82,_0x550b('0xe'));logger[_0x550b('0xf')](_0x550b('0x10'),_0x47bd82,'request\x20sent',JSON[_0x550b('0x11')](_0x32fcd9));if(_0x32fcd9['error']){if(_0x32fcd9[_0x550b('0x12')]['code']===0x1f4){logger[_0x550b('0x12')](_0x550b('0x13'),_0x47bd82,_0x32fcd9['error'][_0x550b('0x14')]);return _0x33ad41(_0x32fcd9[_0x550b('0x12')][_0x550b('0x14')]);}logger[_0x550b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x47bd82,_0x32fcd9['error'][_0x550b('0x14')]);return _0x14ff30(_0x32fcd9[_0x550b('0x12')][_0x550b('0x14')]);}else{logger['info'](_0x550b('0x13'),_0x47bd82,'request\x20sent');_0x14ff30(_0x32fcd9[_0x550b('0x15')][_0x550b('0x14')]);}})[_0x550b('0x16')](function(_0x1de8e4){logger[_0x550b('0x12')](_0x550b('0x13'),_0x47bd82,_0x1de8e4);_0x33ad41(_0x1de8e4);});});}exports[_0x550b('0x17')]=function(_0x430894){var _0x28d38e=this;return new Promise(function(_0x4f1eba,_0x1087d7){return db['VoiceAgentReport'][_0x550b('0x18')](_0x430894[_0x550b('0x19')],{'raw':_0x430894[_0x550b('0x1a')]?_0x430894[_0x550b('0x1a')][_0x550b('0x1b')]===undefined?!![]:![]:!![]})[_0x550b('0xc')](function(_0x305dbc){logger[_0x550b('0xd')](_0x550b('0x17'),_0x430894);logger[_0x550b('0xf')](_0x550b('0x17'),_0x430894,JSON[_0x550b('0x11')](_0x305dbc));_0x4f1eba(_0x305dbc);})['catch'](function(_0x3e8aba){logger[_0x550b('0x12')]('CreateVoiceAgentReport',_0x3e8aba[_0x550b('0x14')],_0x430894);_0x1087d7(_0x28d38e['error'](0x1f4,_0x3e8aba[_0x550b('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3e8788){var _0x29b915=this;return new Promise(function(_0x47ca4a,_0x23efed){return db[_0x550b('0x1c')][_0x550b('0x1d')](_0x3e8788[_0x550b('0x19')],{'raw':_0x3e8788[_0x550b('0x1a')]?_0x3e8788['options'][_0x550b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e8788['options']?_0x3e8788[_0x550b('0x1a')][_0x550b('0x1e')]||null:null,'attributes':_0x3e8788['options']?_0x3e8788['options'][_0x550b('0x1f')]||null:null,'limit':_0x3e8788[_0x550b('0x1a')]?_0x3e8788[_0x550b('0x1a')][_0x550b('0x20')]||null:null})[_0x550b('0xc')](function(_0x4c2cc3){logger[_0x550b('0xd')]('UpdateVoiceAgentReport',_0x3e8788);logger[_0x550b('0xf')](_0x550b('0x21'),_0x3e8788,JSON[_0x550b('0x11')](_0x4c2cc3));_0x47ca4a(_0x4c2cc3);})[_0x550b('0x16')](function(_0x1029c8){logger[_0x550b('0x12')](_0x550b('0x21'),_0x1029c8[_0x550b('0x14')],_0x3e8788);_0x23efed(_0x29b915['error'](0x1f4,_0x1029c8[_0x550b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 45755e2..5c145b2 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 _0x1f35=['post','create','put','update','/with-retry/:id','delete','destroy','express','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0xce4fa,_0x300615){var _0x1e1b0a=function(_0x3eec9f){while(--_0x3eec9f){_0xce4fa['push'](_0xce4fa['shift']());}};_0x1e1b0a(++_0x300615);}(_0x1f35,0x1ba));var _0x51f3=function(_0x3d7a38,_0x256e0f){_0x3d7a38=_0x3d7a38-0x0;var _0x538ca7=_0x1f35[_0x3d7a38];return _0x538ca7;};'use strict';var express=require(_0x51f3('0x0'));var router=express['Router']();var auth=require(_0x51f3('0x1'));var controller=require(_0x51f3('0x2'));router[_0x51f3('0x3')]('/',auth[_0x51f3('0x4')](),controller[_0x51f3('0x5')]);router[_0x51f3('0x3')]('/describe',auth[_0x51f3('0x4')](),controller['describe']);router['get'](_0x51f3('0x6'),auth['isAuthenticated'](),controller[_0x51f3('0x7')]);router[_0x51f3('0x8')]('/',auth[_0x51f3('0x4')](),controller[_0x51f3('0x9')]);router[_0x51f3('0xa')](_0x51f3('0x6'),auth['isAuthenticated'](),controller[_0x51f3('0xb')]);router['put'](_0x51f3('0xc'),auth['isAuthenticated'](),controller['updateWithRetry']);router[_0x51f3('0xd')](_0x51f3('0x6'),auth[_0x51f3('0x4')](),controller[_0x51f3('0xe')]);module['exports']=router; \ No newline at end of file +var _0x200e=['exports','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','destroy'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x200e,0x181));var _0xe200=function(_0x43d4a8,_0x4256ad){_0x43d4a8=_0x43d4a8-0x0;var _0x293b96=_0x200e[_0x43d4a8];return _0x293b96;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe200('0x0'));var controller=require(_0xe200('0x1'));router[_0xe200('0x2')]('/',auth[_0xe200('0x3')](),controller['index']);router[_0xe200('0x2')](_0xe200('0x4'),auth[_0xe200('0x3')](),controller[_0xe200('0x5')]);router[_0xe200('0x2')](_0xe200('0x6'),auth['isAuthenticated'](),controller[_0xe200('0x7')]);router[_0xe200('0x8')]('/',auth['isAuthenticated'](),controller[_0xe200('0x9')]);router[_0xe200('0xa')](_0xe200('0x6'),auth[_0xe200('0x3')](),controller[_0xe200('0xb')]);router[_0xe200('0xa')](_0xe200('0xc'),auth[_0xe200('0x3')](),controller[_0xe200('0xd')]);router['delete'](_0xe200('0x6'),auth[_0xe200('0x3')](),controller[_0xe200('0xe')]);module[_0xe200('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6043262..0c6f9c2 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 _0x27de=['sequelize','exports','ENUM','internal','inbound-fax','STRING','TEXT','DATE','INTEGER'];(function(_0x3da144,_0x578cbd){var _0x13fdc7=function(_0x2d2919){while(--_0x2d2919){_0x3da144['push'](_0x3da144['shift']());}};_0x13fdc7(++_0x578cbd);}(_0x27de,0x1b0));var _0xe27d=function(_0x348aaf,_0x2e1a54){_0x348aaf=_0x348aaf-0x0;var _0x9a670b=_0x27de[_0x348aaf];return _0x9a670b;};'use strict';var Sequelize=require(_0xe27d('0x0'));module[_0xe27d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe27d('0x2')]('inbound',_0xe27d('0x3'),'outbound',_0xe27d('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xe27d('0x5')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xe27d('0x5')]},'destination':{'type':Sequelize[_0xe27d('0x5')]},'destinationcontext':{'type':Sequelize[_0xe27d('0x5')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe27d('0x5')]},'destinationchannel':{'type':Sequelize[_0xe27d('0x5')]},'lastapplication':{'type':Sequelize[_0xe27d('0x5')]},'lastdata':{'type':Sequelize[_0xe27d('0x6')]},'starttime':{'type':Sequelize[_0xe27d('0x7')]},'systemanswertime':{'type':Sequelize[_0xe27d('0x7')]},'answertime':{'type':Sequelize[_0xe27d('0x7')]},'endtime':{'type':Sequelize[_0xe27d('0x7')]},'duration':{'type':Sequelize[_0xe27d('0x8')]},'billableseconds':{'type':Sequelize[_0xe27d('0x8')]},'mohtime':{'type':Sequelize[_0xe27d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xe27d('0x5')]},'userfield':{'type':Sequelize[_0xe27d('0x5')]},'userDisposition':{'type':Sequelize[_0xe27d('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xe27d('0x5')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe27d('0x5')]},'prefix':{'type':Sequelize[_0xe27d('0x5')]},'routeid':{'type':Sequelize[_0xe27d('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x439f=['INTEGER','sequelize','STRING','ENUM','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x439f,0x1c3));var _0xf439=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0x439f[_0x2250da];return _0x573dc5;};'use strict';var Sequelize=require(_0xf439('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf439('0x1')]},'type':{'type':Sequelize[_0xf439('0x2')]('inbound','internal',_0xf439('0x3'),_0xf439('0x4'),_0xf439('0x5'),_0xf439('0x6'))},'tag':{'type':Sequelize[_0xf439('0x1')]},'accountcode':{'type':Sequelize[_0xf439('0x1')]},'source':{'type':Sequelize[_0xf439('0x1')]},'destination':{'type':Sequelize[_0xf439('0x1')]},'destinationcontext':{'type':Sequelize[_0xf439('0x1')]},'callerid':{'type':Sequelize[_0xf439('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xf439('0x1')]},'lastapplication':{'type':Sequelize[_0xf439('0x1')]},'lastdata':{'type':Sequelize[_0xf439('0x7')]},'starttime':{'type':Sequelize[_0xf439('0x8')]},'systemanswertime':{'type':Sequelize[_0xf439('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf439('0x8')]},'duration':{'type':Sequelize[_0xf439('0x9')]},'billableseconds':{'type':Sequelize[_0xf439('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf439('0x1')]},'amaflags':{'type':Sequelize[_0xf439('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf439('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xf439('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xf439('0x1')]},'note':{'type':Sequelize[_0xf439('0x1')]},'prefix':{'type':Sequelize[_0xf439('0x1')]},'routeid':{'type':Sequelize[_0xf439('0x9')]},'sipcallid':{'type':Sequelize[_0xf439('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d9b1b1a..c437572 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 _0xba37=['options','User','findAll','rows','catch','show','length','includeAll','create','body','find','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../config/logger','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','VoiceCallReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x46cb21,_0x482f03){var _0x6dc6dc=function(_0x56e557){while(--_0x56e557){_0x46cb21['push'](_0x46cb21['shift']());}};_0x6dc6dc(++_0x482f03);}(_0xba37,0xb6));var _0x7ba3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xba37[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7ba3('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x7ba3('0x1'))('api');var db=require(_0x7ba3('0x2'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x543868,_0x413255){_0x413255=_0x413255||0xc8;return function(_0x318802){if(_0x318802){return _0x543868[_0x7ba3('0x3')](_0x413255)[_0x7ba3('0x4')](_0x318802);}};}function respondWithFilteredResult(_0x58b96a,_0x401c33){return function(_0x47b38c){if(_0x47b38c){var _0x4b4052=typeof _0x401c33[_0x7ba3('0x5')]===_0x7ba3('0x6')&&typeof _0x401c33['limit']===_0x7ba3('0x6');var _0x3dd81e=_0x47b38c[_0x7ba3('0x7')];var _0x108326=_0x4b4052?0x0:_0x401c33[_0x7ba3('0x5')];var _0x1da57b=_0x4b4052?_0x47b38c[_0x7ba3('0x7')]:_0x401c33[_0x7ba3('0x5')]+_0x401c33[_0x7ba3('0x8')];var _0x5cc931;if(_0x1da57b>=_0x3dd81e){_0x1da57b=_0x3dd81e;_0x5cc931=0xc8;}else{_0x5cc931=0xce;}_0x58b96a[_0x7ba3('0x3')](_0x5cc931);return _0x58b96a[_0x7ba3('0x9')](_0x7ba3('0xa'),_0x108326+'-'+_0x1da57b+'/'+_0x3dd81e)[_0x7ba3('0x4')](_0x47b38c);}return null;};}function saveUpdates(_0x4b038c){return function(_0x21bdf2){if(_0x21bdf2){return _0x21bdf2[_0x7ba3('0xb')](_0x4b038c)[_0x7ba3('0xc')](function(_0x349a18){return _0x349a18;});}return null;};}function removeEntity(_0x28c94a){return function(_0x2b26de){if(_0x2b26de){return _0x2b26de[_0x7ba3('0xd')]()['then'](function(){_0x28c94a[_0x7ba3('0x3')](0xcc)[_0x7ba3('0xe')]();});}};}function handleEntityNotFound(_0x1f9b6f){return function(_0x3346fd){if(!_0x3346fd){_0x1f9b6f[_0x7ba3('0xf')](0x194);}return _0x3346fd;};}function handleError(_0x3dc7fb,_0x1b678f){_0x1b678f=_0x1b678f||0x1f4;return function(_0x10afdd){logger['error'](_0x10afdd['stack']);if(_0x10afdd[_0x7ba3('0x10')]){delete _0x10afdd[_0x7ba3('0x10')];}_0x3dc7fb[_0x7ba3('0x3')](_0x1b678f)[_0x7ba3('0x11')](_0x10afdd);};}exports[_0x7ba3('0x12')]=function(_0x5e41f0,_0x3e8a79){var _0x3081e3={},_0x53c137={},_0x10e965={'count':0x0,'rows':[]};var _0x5039b5=_[_0x7ba3('0x13')](db[_0x7ba3('0x14')][_0x7ba3('0x15')],function(_0x549016){return{'name':_0x549016['fieldName'],'type':_0x549016[_0x7ba3('0x16')]['key']};});_0x53c137[_0x7ba3('0x17')]=_['map'](_0x5039b5,_0x7ba3('0x10'));_0x53c137['query']=_[_0x7ba3('0x18')](_0x5e41f0[_0x7ba3('0x19')]);_0x53c137[_0x7ba3('0x1a')]=_[_0x7ba3('0x1b')](_0x53c137[_0x7ba3('0x17')],_0x53c137[_0x7ba3('0x19')]);_0x3081e3[_0x7ba3('0x1c')]=_[_0x7ba3('0x1b')](_0x53c137['model'],qs[_0x7ba3('0x1d')](_0x5e41f0[_0x7ba3('0x19')][_0x7ba3('0x1d')]));_0x3081e3[_0x7ba3('0x1c')]=_0x3081e3['attributes']['length']?_0x3081e3['attributes']:_0x53c137['model'];if(!_0x5e41f0['query'][_0x7ba3('0x1e')](_0x7ba3('0x1f'))){_0x3081e3['limit']=qs['limit'](_0x5e41f0[_0x7ba3('0x19')]['limit']);_0x3081e3['offset']=qs[_0x7ba3('0x5')](_0x5e41f0[_0x7ba3('0x19')][_0x7ba3('0x5')]);}_0x3081e3[_0x7ba3('0x20')]=qs[_0x7ba3('0x21')](_0x5e41f0[_0x7ba3('0x19')][_0x7ba3('0x21')]);_0x3081e3[_0x7ba3('0x22')]=qs[_0x7ba3('0x1a')](_[_0x7ba3('0x23')](_0x5e41f0['query'],_0x53c137[_0x7ba3('0x1a')]),_0x5039b5);if(_0x5e41f0['query'][_0x7ba3('0x24')]){_0x3081e3['where']=_['merge'](_0x3081e3['where'],{'$or':_[_0x7ba3('0x13')](_0x5039b5,function(_0x136604){if(_0x136604['type']!=='VIRTUAL'){var _0x175aa5={};_0x175aa5[_0x136604['name']]={'$like':'%'+_0x5e41f0[_0x7ba3('0x19')]['filter']+'%'};return _0x175aa5;}})});}_0x3081e3=_[_0x7ba3('0x25')]({},_0x3081e3,_0x5e41f0[_0x7ba3('0x26')]);var _0x29adfd={'where':_0x3081e3[_0x7ba3('0x22')]};return db[_0x7ba3('0x14')][_0x7ba3('0x7')](_0x29adfd)[_0x7ba3('0xc')](function(_0x222b4a){_0x10e965[_0x7ba3('0x7')]=_0x222b4a;if(_0x5e41f0[_0x7ba3('0x19')]['includeAll']){_0x3081e3['include']=[{'attributes':['id',_0x7ba3('0x10'),'fullname','alias'],'model':db[_0x7ba3('0x27')],'as':_0x7ba3('0x27')}];}return db[_0x7ba3('0x14')][_0x7ba3('0x28')](_0x3081e3);})[_0x7ba3('0xc')](function(_0x4f1f41){_0x10e965[_0x7ba3('0x29')]=_0x4f1f41;return _0x10e965;})['then'](respondWithFilteredResult(_0x3e8a79,_0x3081e3))[_0x7ba3('0x2a')](handleError(_0x3e8a79,null));};exports[_0x7ba3('0x2b')]=function(_0x115522,_0x42c500){var _0x3496a0={'raw':!![],'where':{'id':_0x115522['params']['id']}},_0x2865f2={};_0x2865f2[_0x7ba3('0x17')]=_[_0x7ba3('0x18')](db[_0x7ba3('0x14')][_0x7ba3('0x15')]);_0x2865f2[_0x7ba3('0x19')]=_[_0x7ba3('0x18')](_0x115522[_0x7ba3('0x19')]);_0x2865f2[_0x7ba3('0x1a')]=_[_0x7ba3('0x1b')](_0x2865f2[_0x7ba3('0x17')],_0x2865f2['query']);_0x3496a0[_0x7ba3('0x1c')]=_[_0x7ba3('0x1b')](_0x2865f2['model'],qs['fields'](_0x115522[_0x7ba3('0x19')][_0x7ba3('0x1d')]));_0x3496a0['attributes']=_0x3496a0[_0x7ba3('0x1c')][_0x7ba3('0x2c')]?_0x3496a0[_0x7ba3('0x1c')]:_0x2865f2['model'];if(_0x115522[_0x7ba3('0x19')][_0x7ba3('0x2d')]){_0x3496a0['include']=[{'all':!![]}];}_0x3496a0=_[_0x7ba3('0x25')]({},_0x3496a0,_0x115522[_0x7ba3('0x26')]);return db['VoiceCallReport']['find'](_0x3496a0)['then'](handleEntityNotFound(_0x42c500,null))[_0x7ba3('0xc')](respondWithResult(_0x42c500,null))[_0x7ba3('0x2a')](handleError(_0x42c500,null));};exports[_0x7ba3('0x2e')]=function(_0x1af72e,_0x1e1c2b){return db[_0x7ba3('0x14')]['create'](_0x1af72e[_0x7ba3('0x2f')],{})['then'](respondWithResult(_0x1e1c2b,0xc9))[_0x7ba3('0x2a')](handleError(_0x1e1c2b,null));};exports[_0x7ba3('0xd')]=function(_0x5a15fa,_0x5ed5e8){return db[_0x7ba3('0x14')][_0x7ba3('0x30')]({'where':{'id':_0x5a15fa[_0x7ba3('0x31')]['id']}})[_0x7ba3('0xc')](handleEntityNotFound(_0x5ed5e8,null))[_0x7ba3('0xc')](removeEntity(_0x5ed5e8,null))['catch'](handleError(_0x5ed5e8,null));};exports[_0x7ba3('0x32')]=function(_0x443ac4,_0xc59ee0){return db['VoiceCallReport'][_0x7ba3('0x32')]()[_0x7ba3('0xc')](respondWithResult(_0xc59ee0,null))['catch'](handleError(_0xc59ee0,null));};function findForUpdate(_0x1bca0f){return db[_0x7ba3('0x14')][_0x7ba3('0x30')]({'where':{'uniqueid':_0x1bca0f['params']['id'],'UserId':{'$or':[null,_0x1bca0f[_0x7ba3('0x33')]['id']]}}});}exports[_0x7ba3('0xb')]=function(_0x4ff91a,_0xc57b6d){if(_0x4ff91a[_0x7ba3('0x2f')][_0x7ba3('0x34')]){delete _0x4ff91a[_0x7ba3('0x2f')][_0x7ba3('0x34')];}return findForUpdate(_0x4ff91a)[_0x7ba3('0xc')](handleEntityNotFound(_0xc57b6d,null))['then'](saveUpdates(_0x4ff91a[_0x7ba3('0x2f')],null))['then'](respondWithResult(_0xc57b6d,null))[_0x7ba3('0x2a')](handleError(_0xc57b6d,null));};exports[_0x7ba3('0x35')]=function(_0x31f211,_0x584a9b,_0xc7edfb){if(_0x31f211[_0x7ba3('0x2f')]['uniqueid']){delete _0x31f211[_0x7ba3('0x2f')][_0x7ba3('0x34')];}promiseRetry(function(_0x32abcb){return findForUpdate(_0x31f211)[_0x7ba3('0xc')](function(_0xb6dcbe){if(_0xb6dcbe!==null){return _0xb6dcbe;}else{_0x32abcb(new Error(_0x7ba3('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x7ba3('0xc')](function(_0x37c19a){if(!_0x37c19a){return new Promise(function(_0x37c79a){_0x37c79a(handleEntityNotFound(_0x584a9b)());});}else{return _0x37c19a[_0x7ba3('0xb')](_0x31f211[_0x7ba3('0x2f')])[_0x7ba3('0xc')](function(_0x57f825){return respondWithResult(_0x584a9b)(_0x57f825);});}},function(){handleEntityNotFound(_0x584a9b)();});}; \ No newline at end of file +var _0xd7d1=['VoiceCallReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','fullname','alias','User','rows','catch','show','params','include','find','destroy','describe','user','update','body','updateWithRetry','uniqueid','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','index','map'];(function(_0x24b13c,_0x2568fc){var _0x5377f6=function(_0x3a4232){while(--_0x3a4232){_0x24b13c['push'](_0x24b13c['shift']());}};_0x5377f6(++_0x2568fc);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x12827d,_0x22da9a){_0x12827d=_0x12827d-0x0;var _0x14d08c=_0xd7d1[_0x12827d];return _0x14d08c;};'use strict';var _=require(_0x1d7d('0x0'));var qs=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var db=require(_0x1d7d('0x4'))['db'];const promiseRetry=require(_0x1d7d('0x5'));function respondWithResult(_0x222e84,_0x27b5d8){_0x27b5d8=_0x27b5d8||0xc8;return function(_0x1ac097){if(_0x1ac097){return _0x222e84[_0x1d7d('0x6')](_0x27b5d8)[_0x1d7d('0x7')](_0x1ac097);}};}function respondWithFilteredResult(_0x1a2564,_0x14b2b9){return function(_0x5a8cf3){if(_0x5a8cf3){var _0x462ef8=typeof _0x14b2b9[_0x1d7d('0x8')]===_0x1d7d('0x9')&&typeof _0x14b2b9[_0x1d7d('0xa')]===_0x1d7d('0x9');var _0x268732=_0x5a8cf3[_0x1d7d('0xb')];var _0xa44223=_0x462ef8?0x0:_0x14b2b9[_0x1d7d('0x8')];var _0x8b258b=_0x462ef8?_0x5a8cf3[_0x1d7d('0xb')]:_0x14b2b9['offset']+_0x14b2b9[_0x1d7d('0xa')];var _0x4c6809;if(_0x8b258b>=_0x268732){_0x8b258b=_0x268732;_0x4c6809=0xc8;}else{_0x4c6809=0xce;}_0x1a2564[_0x1d7d('0x6')](_0x4c6809);return _0x1a2564[_0x1d7d('0xc')](_0x1d7d('0xd'),_0xa44223+'-'+_0x8b258b+'/'+_0x268732)[_0x1d7d('0x7')](_0x5a8cf3);}return null;};}function saveUpdates(_0x5c7445){return function(_0x11b83f){if(_0x11b83f){return _0x11b83f['update'](_0x5c7445)['then'](function(_0x19e6bc){return _0x19e6bc;});}return null;};}function removeEntity(_0x4049be){return function(_0x5dd438){if(_0x5dd438){return _0x5dd438['destroy']()[_0x1d7d('0xe')](function(){_0x4049be[_0x1d7d('0x6')](0xcc)[_0x1d7d('0xf')]();});}};}function handleEntityNotFound(_0x183fc6){return function(_0xeb05b3){if(!_0xeb05b3){_0x183fc6['sendStatus'](0x194);}return _0xeb05b3;};}function handleError(_0x28adf3,_0x1de6cc){_0x1de6cc=_0x1de6cc||0x1f4;return function(_0x51cbca){logger[_0x1d7d('0x10')](_0x51cbca[_0x1d7d('0x11')]);if(_0x51cbca[_0x1d7d('0x12')]){delete _0x51cbca[_0x1d7d('0x12')];}_0x28adf3[_0x1d7d('0x6')](_0x1de6cc)['send'](_0x51cbca);};}exports[_0x1d7d('0x13')]=function(_0x191024,_0x5cbb8f){var _0x495212={},_0x2406dd={},_0x1a5101={'count':0x0,'rows':[]};var _0x2a9f2b=_[_0x1d7d('0x14')](db[_0x1d7d('0x15')][_0x1d7d('0x16')],function(_0x54d401){return{'name':_0x54d401[_0x1d7d('0x17')],'type':_0x54d401[_0x1d7d('0x18')][_0x1d7d('0x19')]};});_0x2406dd['model']=_[_0x1d7d('0x14')](_0x2a9f2b,_0x1d7d('0x12'));_0x2406dd['query']=_['keys'](_0x191024[_0x1d7d('0x1a')]);_0x2406dd[_0x1d7d('0x1b')]=_[_0x1d7d('0x1c')](_0x2406dd['model'],_0x2406dd[_0x1d7d('0x1a')]);_0x495212[_0x1d7d('0x1d')]=_[_0x1d7d('0x1c')](_0x2406dd[_0x1d7d('0x1e')],qs['fields'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x1f')]));_0x495212['attributes']=_0x495212['attributes'][_0x1d7d('0x20')]?_0x495212['attributes']:_0x2406dd[_0x1d7d('0x1e')];if(!_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x21')](_0x1d7d('0x22'))){_0x495212[_0x1d7d('0xa')]=qs['limit'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0xa')]);_0x495212[_0x1d7d('0x8')]=qs['offset'](_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x8')]);}_0x495212[_0x1d7d('0x23')]=qs['sort'](_0x191024['query']['sort']);_0x495212[_0x1d7d('0x24')]=qs[_0x1d7d('0x1b')](_['pick'](_0x191024[_0x1d7d('0x1a')],_0x2406dd[_0x1d7d('0x1b')]),_0x2a9f2b);if(_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x25')]){_0x495212[_0x1d7d('0x24')]=_[_0x1d7d('0x26')](_0x495212[_0x1d7d('0x24')],{'$or':_[_0x1d7d('0x14')](_0x2a9f2b,function(_0xd701e1){if(_0xd701e1[_0x1d7d('0x18')]!=='VIRTUAL'){var _0x57c22e={};_0x57c22e[_0xd701e1[_0x1d7d('0x12')]]={'$like':'%'+_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x25')]+'%'};return _0x57c22e;}})});}_0x495212=_[_0x1d7d('0x26')]({},_0x495212,_0x191024[_0x1d7d('0x27')]);var _0x16d652={'where':_0x495212[_0x1d7d('0x24')]};return db[_0x1d7d('0x15')][_0x1d7d('0xb')](_0x16d652)['then'](function(_0x2ac533){_0x1a5101[_0x1d7d('0xb')]=_0x2ac533;if(_0x191024[_0x1d7d('0x1a')][_0x1d7d('0x28')]){_0x495212['include']=[{'attributes':['id','name',_0x1d7d('0x29'),_0x1d7d('0x2a')],'model':db['User'],'as':_0x1d7d('0x2b')}];}return db[_0x1d7d('0x15')]['findAll'](_0x495212);})['then'](function(_0x26f81c){_0x1a5101[_0x1d7d('0x2c')]=_0x26f81c;return _0x1a5101;})[_0x1d7d('0xe')](respondWithFilteredResult(_0x5cbb8f,_0x495212))[_0x1d7d('0x2d')](handleError(_0x5cbb8f,null));};exports[_0x1d7d('0x2e')]=function(_0x3427eb,_0x46c796){var _0x37d003={'raw':!![],'where':{'id':_0x3427eb[_0x1d7d('0x2f')]['id']}},_0x405125={};_0x405125['model']=_['keys'](db['VoiceCallReport']['rawAttributes']);_0x405125[_0x1d7d('0x1a')]=_['keys'](_0x3427eb[_0x1d7d('0x1a')]);_0x405125[_0x1d7d('0x1b')]=_[_0x1d7d('0x1c')](_0x405125['model'],_0x405125[_0x1d7d('0x1a')]);_0x37d003[_0x1d7d('0x1d')]=_[_0x1d7d('0x1c')](_0x405125['model'],qs[_0x1d7d('0x1f')](_0x3427eb[_0x1d7d('0x1a')][_0x1d7d('0x1f')]));_0x37d003[_0x1d7d('0x1d')]=_0x37d003['attributes'][_0x1d7d('0x20')]?_0x37d003[_0x1d7d('0x1d')]:_0x405125[_0x1d7d('0x1e')];if(_0x3427eb[_0x1d7d('0x1a')]['includeAll']){_0x37d003[_0x1d7d('0x30')]=[{'all':!![]}];}_0x37d003=_['merge']({},_0x37d003,_0x3427eb[_0x1d7d('0x27')]);return db[_0x1d7d('0x15')][_0x1d7d('0x31')](_0x37d003)[_0x1d7d('0xe')](handleEntityNotFound(_0x46c796,null))[_0x1d7d('0xe')](respondWithResult(_0x46c796,null))['catch'](handleError(_0x46c796,null));};exports['create']=function(_0x33582a,_0xe57fa5){return db[_0x1d7d('0x15')]['create'](_0x33582a['body'],{})[_0x1d7d('0xe')](respondWithResult(_0xe57fa5,0xc9))['catch'](handleError(_0xe57fa5,null));};exports[_0x1d7d('0x32')]=function(_0x379e75,_0x1d1064){return db[_0x1d7d('0x15')][_0x1d7d('0x31')]({'where':{'id':_0x379e75[_0x1d7d('0x2f')]['id']}})[_0x1d7d('0xe')](handleEntityNotFound(_0x1d1064,null))['then'](removeEntity(_0x1d1064,null))[_0x1d7d('0x2d')](handleError(_0x1d1064,null));};exports[_0x1d7d('0x33')]=function(_0x49de57,_0x17c68b){return db[_0x1d7d('0x15')][_0x1d7d('0x33')]()[_0x1d7d('0xe')](respondWithResult(_0x17c68b,null))[_0x1d7d('0x2d')](handleError(_0x17c68b,null));};function findForUpdate(_0x464fb9){return db[_0x1d7d('0x15')][_0x1d7d('0x31')]({'where':{'uniqueid':_0x464fb9[_0x1d7d('0x2f')]['id'],'UserId':{'$or':[null,_0x464fb9[_0x1d7d('0x34')]['id']]}}});}exports[_0x1d7d('0x35')]=function(_0x13fca1,_0x52149b){if(_0x13fca1[_0x1d7d('0x36')]['uniqueid']){delete _0x13fca1[_0x1d7d('0x36')]['uniqueid'];}return findForUpdate(_0x13fca1)[_0x1d7d('0xe')](handleEntityNotFound(_0x52149b,null))[_0x1d7d('0xe')](saveUpdates(_0x13fca1[_0x1d7d('0x36')],null))[_0x1d7d('0xe')](respondWithResult(_0x52149b,null))['catch'](handleError(_0x52149b,null));};exports[_0x1d7d('0x37')]=function(_0x5535d4,_0x48cfe3,_0x3b47e1){if(_0x5535d4['body']['uniqueid']){delete _0x5535d4[_0x1d7d('0x36')][_0x1d7d('0x38')];}promiseRetry(function(_0x506564){return findForUpdate(_0x5535d4)[_0x1d7d('0xe')](function(_0x1383f9){if(_0x1383f9!==null){return _0x1383f9;}else{_0x506564(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x1d7d('0xe')](function(_0x2b9faa){if(!_0x2b9faa){return new Promise(function(_0xa64dbe){_0xa64dbe(handleEntityNotFound(_0x48cfe3)());});}else{return _0x2b9faa[_0x1d7d('0x35')](_0x5535d4['body'])['then'](function(_0x3f73eb){return respondWithResult(_0x48cfe3)(_0x3f73eb);});}},function(){handleEntityNotFound(_0x48cfe3)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c978b3f..e8ee89d 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 _0xe3ee=['api','request-promise','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','../../config/logger'];(function(_0x111eff,_0x14ca9e){var _0x412e24=function(_0x3ac226){while(--_0x3ac226){_0x111eff['push'](_0x111eff['shift']());}};_0x412e24(++_0x14ca9e);}(_0xe3ee,0x116));var _0xee3e=function(_0x4fbf8a,_0x272ff5){_0x4fbf8a=_0x4fbf8a-0x0;var _0x4b18db=_0xe3ee[_0x4fbf8a];return _0x4b18db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee3e('0x3'));var attributes=require('./voiceCallReport.attributes');module[_0xee3e('0x4')]=function(_0x352eca,_0x3907a7){return _0x352eca[_0xee3e('0x5')](_0xee3e('0x6'),attributes,{'tableName':_0xee3e('0x7'),'paranoid':![],'indexes':[{'fields':[_0xee3e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1333=['api','bluebird','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x3a2d01,_0x441012){var _0x1f4816=function(_0x314a40){while(--_0x314a40){_0x3a2d01['push'](_0x3a2d01['shift']());}};_0x1f4816(++_0x441012);}(_0x1333,0x112));var _0x3133=function(_0x2d31bb,_0x155b01){_0x2d31bb=_0x2d31bb-0x0;var _0x1e7425=_0x1333[_0x2d31bb];return _0x1e7425;};'use strict';var _=require(_0x3133('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3133('0x1'));var moment=require('moment');var BPromise=require(_0x3133('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3133('0x3'));var rimraf=require(_0x3133('0x4'));var config=require('../../config/environment');var attributes=require(_0x3133('0x5'));module[_0x3133('0x6')]=function(_0x31d610,_0xda2a3c){return _0x31d610[_0x3133('0x7')](_0x3133('0x8'),attributes,{'tableName':_0x3133('0x9'),'paranoid':![],'indexes':[{'fields':[_0x3133('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index fbf828a..13b97ac 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 _0x26f3=['limit','include','map','model','attributes','debug','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','VoiceCallReport','findAll','options','raw','where'];(function(_0x46c96f,_0x5891ce){var _0x2b5d95=function(_0x1129b1){while(--_0x1129b1){_0x46c96f['push'](_0x46c96f['shift']());}};_0x2b5d95(++_0x5891ce);}(_0x26f3,0x174));var _0x326f=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x26f3[_0x26b622];return _0x58a028;};'use strict';var _=require('lodash');var util=require(_0x326f('0x0'));var moment=require(_0x326f('0x1'));var BPromise=require(_0x326f('0x2'));var rs=require(_0x326f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x326f('0x4'))['db'];var utils=require(_0x326f('0x5'));var logger=require(_0x326f('0x6'))(_0x326f('0x7'));var config=require(_0x326f('0x8'));var jayson=require(_0x326f('0x9'));var client=jayson[_0x326f('0xa')][_0x326f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x361e99,_0x3af854,_0x28c212){return new BPromise(function(_0x26cb1f,_0x1ab8d8){return client[_0x326f('0xc')](_0x361e99,_0x28c212)[_0x326f('0xd')](function(_0xd2f493){logger[_0x326f('0xe')](_0x326f('0xf'),_0x3af854,'request\x20sent');logger['debug'](_0x326f('0x10'),_0x3af854,'request\x20sent',JSON[_0x326f('0x11')](_0xd2f493));if(_0xd2f493[_0x326f('0x12')]){if(_0xd2f493[_0x326f('0x12')][_0x326f('0x13')]===0x1f4){logger[_0x326f('0x12')](_0x326f('0xf'),_0x3af854,_0xd2f493['error'][_0x326f('0x14')]);return _0x1ab8d8(_0xd2f493[_0x326f('0x12')][_0x326f('0x14')]);}logger[_0x326f('0x12')](_0x326f('0xf'),_0x3af854,_0xd2f493[_0x326f('0x12')]['message']);return _0x26cb1f(_0xd2f493['error'][_0x326f('0x14')]);}else{logger[_0x326f('0xe')](_0x326f('0xf'),_0x3af854,_0x326f('0x15'));_0x26cb1f(_0xd2f493['result'][_0x326f('0x14')]);}})[_0x326f('0x16')](function(_0x256724){logger[_0x326f('0x12')](_0x326f('0xf'),_0x3af854,_0x256724);_0x1ab8d8(_0x256724);});});}exports['GetVoiceCallReport']=function(_0x43003c){var _0x26d9ca=this;return new Promise(function(_0x4839f7,_0x1d582c){return db[_0x326f('0x17')][_0x326f('0x18')]({'raw':_0x43003c[_0x326f('0x19')]?_0x43003c['options'][_0x326f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43003c[_0x326f('0x19')]?_0x43003c[_0x326f('0x19')][_0x326f('0x1b')]||null:null,'attributes':_0x43003c[_0x326f('0x19')]?_0x43003c[_0x326f('0x19')]['attributes']||null:null,'limit':_0x43003c[_0x326f('0x19')]?_0x43003c[_0x326f('0x19')][_0x326f('0x1c')]||null:null,'include':_0x43003c[_0x326f('0x19')]?_0x43003c['options'][_0x326f('0x1d')]?_[_0x326f('0x1e')](_0x43003c[_0x326f('0x19')][_0x326f('0x1d')],function(_0x103ece){return{'model':db[_0x103ece[_0x326f('0x1f')]],'as':_0x103ece['as'],'attributes':_0x103ece[_0x326f('0x20')],'include':_0x103ece['include']?_[_0x326f('0x1e')](_0x103ece[_0x326f('0x1d')],function(_0x2093ba){return{'model':db[_0x2093ba[_0x326f('0x1f')]],'as':_0x2093ba['as'],'attributes':_0x2093ba[_0x326f('0x20')],'include':_0x2093ba[_0x326f('0x1d')]?_[_0x326f('0x1e')](_0x2093ba['include'],function(_0x5b187b){return{'model':db[_0x5b187b[_0x326f('0x1f')]],'as':_0x5b187b['as'],'attributes':_0x5b187b[_0x326f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x326f('0xd')](function(_0x35a4a6){logger[_0x326f('0xe')]('GetVoiceCallReport',_0x43003c);logger[_0x326f('0x21')](_0x326f('0x22'),_0x43003c,JSON[_0x326f('0x11')](_0x35a4a6));_0x4839f7(_0x35a4a6);})[_0x326f('0x16')](function(_0xcf6252){logger[_0x326f('0x12')](_0x326f('0x22'),_0xcf6252[_0x326f('0x14')],_0x43003c);_0x1d582c(_0x26d9ca[_0x326f('0x12')](0x1f4,_0xcf6252[_0x326f('0x14')]));});});};exports[_0x326f('0x23')]=function(_0x1fc78d){var _0x5272c8=this;return new Promise(function(_0xcff6ef,_0x1aa10e){return db[_0x326f('0x17')][_0x326f('0x24')](_0x1fc78d[_0x326f('0x25')],{'raw':_0x1fc78d[_0x326f('0x19')]?_0x1fc78d[_0x326f('0x19')][_0x326f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x38b868){logger['info'](_0x326f('0x23'),_0x1fc78d);logger[_0x326f('0x21')]('CreateVoiceCallReport',_0x1fc78d,JSON[_0x326f('0x11')](_0x38b868));_0xcff6ef(_0x38b868);})['catch'](function(_0x2048e1){logger['error'](_0x326f('0x23'),_0x2048e1['message'],_0x1fc78d);_0x1aa10e(_0x5272c8[_0x326f('0x12')](0x1f4,_0x2048e1[_0x326f('0x14')]));});});};exports[_0x326f('0x26')]=function(_0x11e516){var _0x4c4cbb=this;return new Promise(function(_0x2463f5,_0x3f3c4c){return db['VoiceCallReport'][_0x326f('0x27')](_0x11e516['body'],{'raw':_0x11e516['options']?_0x11e516[_0x326f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e516[_0x326f('0x19')]?_0x11e516['options'][_0x326f('0x1b')]||null:null,'attributes':_0x11e516['options']?_0x11e516[_0x326f('0x19')][_0x326f('0x20')]||null:null,'limit':_0x11e516[_0x326f('0x19')]?_0x11e516[_0x326f('0x19')][_0x326f('0x1c')]||null:null})[_0x326f('0xd')](function(_0x5dd23f){logger[_0x326f('0xe')](_0x326f('0x26'),_0x11e516);logger[_0x326f('0x21')]('UpdateVoiceCallReport',_0x11e516,JSON['stringify'](_0x5dd23f));_0x2463f5(_0x5dd23f);})[_0x326f('0x16')](function(_0x1564f6){logger['error'](_0x326f('0x26'),_0x1564f6['message'],_0x11e516);_0x3f3c4c(_0x4c4cbb[_0x326f('0x12')](0x1f4,_0x1564f6[_0x326f('0x14')]));});});}; \ No newline at end of file +var _0x058a=['then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0xee7ed1,_0x19ccc1){var _0x342949=function(_0x2189fe){while(--_0x2189fe){_0xee7ed1['push'](_0xee7ed1['shift']());}};_0x342949(++_0x19ccc1);}(_0x058a,0x68));var _0xa058=function(_0x897c62,_0x3472d6){_0x897c62=_0x897c62-0x0;var _0x133bc9=_0x058a[_0x897c62];return _0x133bc9;};'use strict';var _=require(_0xa058('0x0'));var util=require(_0xa058('0x1'));var moment=require(_0xa058('0x2'));var BPromise=require(_0xa058('0x3'));var rs=require(_0xa058('0x4'));var fs=require('fs');var Redis=require(_0xa058('0x5'));var db=require(_0xa058('0x6'))['db'];var utils=require(_0xa058('0x7'));var logger=require(_0xa058('0x8'))('rpc');var config=require(_0xa058('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa058('0xa')][_0xa058('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f7ad5,_0x3d87d4,_0x58d948){return new BPromise(function(_0x26d62d,_0x384be4){return client[_0xa058('0xc')](_0x4f7ad5,_0x58d948)[_0xa058('0xd')](function(_0x40d2d5){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0xa058('0xe'));logger[_0xa058('0xf')](_0xa058('0x10'),_0x3d87d4,_0xa058('0xe'),JSON[_0xa058('0x11')](_0x40d2d5));if(_0x40d2d5[_0xa058('0x12')]){if(_0x40d2d5[_0xa058('0x12')]['code']===0x1f4){logger['error'](_0xa058('0x13'),_0x3d87d4,_0x40d2d5[_0xa058('0x12')]['message']);return _0x384be4(_0x40d2d5[_0xa058('0x12')]['message']);}logger[_0xa058('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0x40d2d5[_0xa058('0x12')][_0xa058('0x14')]);return _0x26d62d(_0x40d2d5[_0xa058('0x12')][_0xa058('0x14')]);}else{logger[_0xa058('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0xa058('0xe'));_0x26d62d(_0x40d2d5[_0xa058('0x16')][_0xa058('0x14')]);}})[_0xa058('0x17')](function(_0x26bda8){logger[_0xa058('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3d87d4,_0x26bda8);_0x384be4(_0x26bda8);});});}exports[_0xa058('0x18')]=function(_0x4a6c6a){var _0x22acb9=this;return new Promise(function(_0x3a603a,_0x20295d){return db['VoiceCallReport'][_0xa058('0x19')]({'raw':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1c')]||null:null,'attributes':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1d')]||null:null,'limit':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1e')]||null:null,'include':_0x4a6c6a[_0xa058('0x1a')]?_0x4a6c6a['options'][_0xa058('0x1f')]?_[_0xa058('0x20')](_0x4a6c6a[_0xa058('0x1a')][_0xa058('0x1f')],function(_0x4f070b){return{'model':db[_0x4f070b[_0xa058('0x21')]],'as':_0x4f070b['as'],'attributes':_0x4f070b[_0xa058('0x1d')],'include':_0x4f070b[_0xa058('0x1f')]?_[_0xa058('0x20')](_0x4f070b[_0xa058('0x1f')],function(_0xa42741){return{'model':db[_0xa42741[_0xa058('0x21')]],'as':_0xa42741['as'],'attributes':_0xa42741['attributes'],'include':_0xa42741[_0xa058('0x1f')]?_[_0xa058('0x20')](_0xa42741[_0xa058('0x1f')],function(_0x387175){return{'model':db[_0x387175[_0xa058('0x21')]],'as':_0x387175['as'],'attributes':_0x387175[_0xa058('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa058('0xd')](function(_0x2f7bd6){logger[_0xa058('0x15')]('GetVoiceCallReport',_0x4a6c6a);logger[_0xa058('0xf')]('GetVoiceCallReport',_0x4a6c6a,JSON[_0xa058('0x11')](_0x2f7bd6));_0x3a603a(_0x2f7bd6);})[_0xa058('0x17')](function(_0x537068){logger[_0xa058('0x12')](_0xa058('0x18'),_0x537068[_0xa058('0x14')],_0x4a6c6a);_0x20295d(_0x22acb9[_0xa058('0x12')](0x1f4,_0x537068[_0xa058('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x334ade){var _0x4bc29b=this;return new Promise(function(_0x5b3c37,_0x195469){return db[_0xa058('0x22')][_0xa058('0x23')](_0x334ade[_0xa058('0x24')],{'raw':_0x334ade[_0xa058('0x1a')]?_0x334ade[_0xa058('0x1a')][_0xa058('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x463556){logger[_0xa058('0x15')]('CreateVoiceCallReport',_0x334ade);logger[_0xa058('0xf')]('CreateVoiceCallReport',_0x334ade,JSON[_0xa058('0x11')](_0x463556));_0x5b3c37(_0x463556);})[_0xa058('0x17')](function(_0x1c50a0){logger[_0xa058('0x12')]('CreateVoiceCallReport',_0x1c50a0[_0xa058('0x14')],_0x334ade);_0x195469(_0x4bc29b['error'](0x1f4,_0x1c50a0[_0xa058('0x14')]));});});};exports[_0xa058('0x25')]=function(_0x5e65c1){var _0x321fbd=this;return new Promise(function(_0x3a84df,_0x5351af){return db[_0xa058('0x22')][_0xa058('0x26')](_0x5e65c1[_0xa058('0x24')],{'raw':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1[_0xa058('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1[_0xa058('0x1a')]['where']||null:null,'attributes':_0x5e65c1[_0xa058('0x1a')]?_0x5e65c1['options'][_0xa058('0x1d')]||null:null,'limit':_0x5e65c1['options']?_0x5e65c1[_0xa058('0x1a')][_0xa058('0x1e')]||null:null})[_0xa058('0xd')](function(_0x85918a){logger[_0xa058('0x15')](_0xa058('0x25'),_0x5e65c1);logger[_0xa058('0xf')](_0xa058('0x25'),_0x5e65c1,JSON[_0xa058('0x11')](_0x85918a));_0x3a84df(_0x85918a);})['catch'](function(_0x552e7b){logger[_0xa058('0x12')]('UpdateVoiceCallReport',_0x552e7b['message'],_0x5e65c1);_0x5351af(_0x321fbd[_0xa058('0x12')](0x1f4,_0x552e7b[_0xa058('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index fd88a5d..567f298 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 _0xaa44=['Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','show','post','isAuthenticated','create','update','exports','multer','util','path'];(function(_0x2e045c,_0x3dcbb5){var _0x3118cd=function(_0x5801c6){while(--_0x5801c6){_0x2e045c['push'](_0x2e045c['shift']());}};_0x3118cd(++_0x3dcbb5);}(_0xaa44,0x14d));var _0x4aa4=function(_0x11072e,_0x3f7081){_0x11072e=_0x11072e-0x0;var _0x89a15=_0xaa44[_0x11072e];return _0x89a15;};'use strict';var multer=require(_0x4aa4('0x0'));var util=require(_0x4aa4('0x1'));var path=require(_0x4aa4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4aa4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4aa4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4aa4('0x5'));var controller=require(_0x4aa4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4aa4('0x7')]);router[_0x4aa4('0x8')](_0x4aa4('0x9'),auth['isAuthenticated'](),controller[_0x4aa4('0xa')]);router[_0x4aa4('0xb')]('/',auth[_0x4aa4('0xc')](),controller[_0x4aa4('0xd')]);router['put'](_0x4aa4('0x9'),auth[_0x4aa4('0xc')](),controller[_0x4aa4('0xe')]);router['delete'](_0x4aa4('0x9'),auth[_0x4aa4('0xc')](),controller['destroy']);module[_0x4aa4('0xf')]=router; \ No newline at end of file +var _0x131a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x131a,0x13e));var _0xa131=function(_0x5c7c72,_0x544fea){_0x5c7c72=_0x5c7c72-0x0;var _0x5e430f=_0x131a[_0x5c7c72];return _0x5e430f;};'use strict';var multer=require(_0xa131('0x0'));var util=require('util');var path=require(_0xa131('0x1'));var timeout=require(_0xa131('0x2'));var express=require(_0xa131('0x3'));var router=express[_0xa131('0x4')]();var fs_extra=require(_0xa131('0x5'));var auth=require(_0xa131('0x6'));var interaction=require(_0xa131('0x7'));var config=require(_0xa131('0x8'));var controller=require(_0xa131('0x9'));router['get']('/',auth[_0xa131('0xa')](),controller[_0xa131('0xb')]);router[_0xa131('0xc')](_0xa131('0xd'),auth[_0xa131('0xa')](),controller[_0xa131('0xe')]);router['post']('/',auth[_0xa131('0xa')](),controller[_0xa131('0xf')]);router['put'](_0xa131('0xd'),auth['isAuthenticated'](),controller[_0xa131('0x10')]);router['delete']('/:id',auth[_0xa131('0xa')](),controller[_0xa131('0x11')]);module[_0xa131('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index aa3d435..2e61b06 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 _0xdd6f=['exports','STRING','name','setDataValue','options','getDataValue','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdd6f,0x7f));var _0xfdd6=function(_0x1ced63,_0x689760){_0x1ced63=_0x1ced63-0x0;var _0xee200b=_0xdd6f[_0x1ced63];return _0xee200b;};'use strict';var Sequelize=require(_0xfdd6('0x0'));module[_0xfdd6('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xfdd6('0x2')],'unique':_0xfdd6('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5733a8){this[_0xfdd6('0x4')](_0xfdd6('0x5'),_0x5733a8?_0x5733a8['join'](''):[]);},'get':function(){return this[_0xfdd6('0x6')]('options')?this[_0xfdd6('0x6')](_0xfdd6('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0xfdd6('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xfdd6('0x2')]},'record':{'type':Sequelize[_0xfdd6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xfdd6('0x2')]},'description':{'type':Sequelize[_0xfdd6('0x2')]}}; \ No newline at end of file +var _0x90a5=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x38abb3,_0x1146e3){var _0x51cf98=function(_0x48c264){while(--_0x48c264){_0x38abb3['push'](_0x38abb3['shift']());}};_0x51cf98(++_0x1146e3);}(_0x90a5,0xb9));var _0x590a=function(_0x425526,_0x13871b){_0x425526=_0x425526-0x0;var _0x48f879=_0x90a5[_0x425526];return _0x48f879;};'use strict';var Sequelize=require(_0x590a('0x0'));module[_0x590a('0x1')]={'name':{'type':Sequelize[_0x590a('0x2')]},'prefix':{'type':Sequelize[_0x590a('0x2')],'unique':_0x590a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x590a('0x2')],'set':function(_0x491183){this[_0x590a('0x4')](_0x590a('0x5'),_0x491183?_0x491183[_0x590a('0x6')](''):[]);},'get':function(){return this[_0x590a('0x7')](_0x590a('0x5'))?this[_0x590a('0x7')](_0x590a('0x5'))[_0x590a('0x8')](''):[];}},'auth':{'type':Sequelize[_0x590a('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x590a('0x2')]},'record':{'type':Sequelize[_0x590a('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x590a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d7e1236..0bb25af 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 _0x6c50=['params','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','error','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','findAll','rows','catch','show'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x6c50,0xa4));var _0x06c5=function(_0x5e6d75,_0x2548f9){_0x5e6d75=_0x5e6d75-0x0;var _0x2c79eb=_0x6c50[_0x5e6d75];return _0x2c79eb;};'use strict';var emlformat=require(_0x06c5('0x0'));var rimraf=require(_0x06c5('0x1'));var zipdir=require(_0x06c5('0x2'));var jsonpatch=require(_0x06c5('0x3'));var rp=require('request-promise');var moment=require(_0x06c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06c5('0x5'));var util=require(_0x06c5('0x6'));var path=require(_0x06c5('0x7'));var sox=require(_0x06c5('0x8'));var csv=require(_0x06c5('0x9'));var ejs=require(_0x06c5('0xa'));var fs=require('fs');var fs_extra=require(_0x06c5('0xb'));var _=require(_0x06c5('0xc'));var squel=require(_0x06c5('0xd'));var crypto=require(_0x06c5('0xe'));var jsforce=require(_0x06c5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x06c5('0x9'));var querystring=require(_0x06c5('0x10'));var Papa=require(_0x06c5('0x11'));var Redis=require(_0x06c5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06c5('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x06c5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x06c5('0x15'))['db'];function respondWithStatusCode(_0x2d7502,_0x68194e){_0x68194e=_0x68194e||0xcc;return function(_0x4ce581){if(_0x4ce581){return _0x2d7502[_0x06c5('0x16')](_0x68194e);}return _0x2d7502[_0x06c5('0x17')](_0x68194e)[_0x06c5('0x18')]();};}function respondWithResult(_0x39e176,_0x5d456e){_0x5d456e=_0x5d456e||0xc8;return function(_0x4e8669){if(_0x4e8669){return _0x39e176[_0x06c5('0x17')](_0x5d456e)[_0x06c5('0x19')](_0x4e8669);}};}function respondWithFilteredResult(_0x13a8d4,_0x4eeeca){return function(_0x16c36e){if(_0x16c36e){var _0x117371=typeof _0x4eeeca['offset']===_0x06c5('0x1a')&&typeof _0x4eeeca[_0x06c5('0x1b')]===_0x06c5('0x1a');var _0xb48b48=_0x16c36e[_0x06c5('0x1c')];var _0x36b9e9=_0x117371?0x0:_0x4eeeca[_0x06c5('0x1d')];var _0x18a070=_0x117371?_0x16c36e[_0x06c5('0x1c')]:_0x4eeeca[_0x06c5('0x1d')]+_0x4eeeca[_0x06c5('0x1b')];var _0x46471b;if(_0x18a070>=_0xb48b48){_0x18a070=_0xb48b48;_0x46471b=0xc8;}else{_0x46471b=0xce;}_0x13a8d4[_0x06c5('0x17')](_0x46471b);return _0x13a8d4[_0x06c5('0x1e')](_0x06c5('0x1f'),_0x36b9e9+'-'+_0x18a070+'/'+_0xb48b48)[_0x06c5('0x19')](_0x16c36e);}return null;};}function patchUpdates(_0x26a653){return function(_0x4ba7e9){try{jsonpatch[_0x06c5('0x20')](_0x4ba7e9,_0x26a653,!![]);}catch(_0x3c2d52){return BPromise[_0x06c5('0x21')](_0x3c2d52);}return _0x4ba7e9[_0x06c5('0x22')]();};}function saveUpdates(_0xa3659b,_0x3c9e49){return function(_0x29db18){if(_0x29db18){return _0x29db18['update'](_0xa3659b)[_0x06c5('0x23')](function(_0x1b0cc7){return _0x1b0cc7;});}return null;};}function removeEntity(_0x414dda,_0x20ba9e){return function(_0x368e2f){if(_0x368e2f){return _0x368e2f[_0x06c5('0x24')]()[_0x06c5('0x23')](function(){var _0x51f2a6=_0x368e2f[_0x06c5('0x25')]({'plain':!![]});var _0x5aeb6c='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5aeb6c,'resourceId':_0x51f2a6['id']}})[_0x06c5('0x23')](function(){return _0x368e2f;});})[_0x06c5('0x23')](function(){_0x414dda[_0x06c5('0x17')](0xcc)[_0x06c5('0x18')]();});}};}function handleEntityNotFound(_0x2ead19,_0x547661){return function(_0x221965){if(!_0x221965){_0x2ead19[_0x06c5('0x16')](0x194);}return _0x221965;};}function handleError(_0x2731c7,_0xfaa540){_0xfaa540=_0xfaa540||0x1f4;return function(_0x2f8ac9){logger['error'](_0x2f8ac9[_0x06c5('0x26')]);if(_0x2f8ac9[_0x06c5('0x27')]){delete _0x2f8ac9[_0x06c5('0x27')];}_0x2731c7['status'](_0xfaa540)[_0x06c5('0x28')](_0x2f8ac9);};}exports[_0x06c5('0x29')]=function(_0x22a29c,_0x5766ca){var _0x59e2ee={},_0x48cf98={},_0x2e57ad={'count':0x0,'rows':[]};var _0x5e76ed=_[_0x06c5('0x2a')](db['VoiceChanSpy'][_0x06c5('0x2b')],function(_0x573011){return{'name':_0x573011[_0x06c5('0x2c')],'type':_0x573011['type']['key']};});_0x48cf98[_0x06c5('0x2d')]=_['map'](_0x5e76ed,'name');_0x48cf98[_0x06c5('0x2e')]=_[_0x06c5('0x2f')](_0x22a29c[_0x06c5('0x2e')]);_0x48cf98[_0x06c5('0x30')]=_[_0x06c5('0x31')](_0x48cf98[_0x06c5('0x2d')],_0x48cf98[_0x06c5('0x2e')]);_0x59e2ee['attributes']=_[_0x06c5('0x31')](_0x48cf98['model'],qs['fields'](_0x22a29c[_0x06c5('0x2e')][_0x06c5('0x32')]));_0x59e2ee[_0x06c5('0x33')]=_0x59e2ee[_0x06c5('0x33')][_0x06c5('0x34')]?_0x59e2ee[_0x06c5('0x33')]:_0x48cf98[_0x06c5('0x2d')];if(!_0x22a29c['query']['hasOwnProperty'](_0x06c5('0x35'))){_0x59e2ee[_0x06c5('0x1b')]=qs['limit'](_0x22a29c['query'][_0x06c5('0x1b')]);_0x59e2ee[_0x06c5('0x1d')]=qs[_0x06c5('0x1d')](_0x22a29c['query'][_0x06c5('0x1d')]);}_0x59e2ee[_0x06c5('0x36')]=qs[_0x06c5('0x37')](_0x22a29c['query'][_0x06c5('0x37')]);_0x59e2ee[_0x06c5('0x38')]=qs['filters'](_['pick'](_0x22a29c[_0x06c5('0x2e')],_0x48cf98['filters']),_0x5e76ed);if(_0x22a29c[_0x06c5('0x2e')]['filter']){_0x59e2ee[_0x06c5('0x38')]=_[_0x06c5('0x39')](_0x59e2ee[_0x06c5('0x38')],{'$or':_[_0x06c5('0x2a')](_0x5e76ed,function(_0xfa67da){if(_0xfa67da[_0x06c5('0x3a')]!==_0x06c5('0x3b')){var _0x54c56c={};_0x54c56c[_0xfa67da[_0x06c5('0x27')]]={'$like':'%'+_0x22a29c['query']['filter']+'%'};return _0x54c56c;}})});}_0x59e2ee=_[_0x06c5('0x39')]({},_0x59e2ee,_0x22a29c[_0x06c5('0x3c')]);var _0x1764ae={'where':_0x59e2ee[_0x06c5('0x38')]};return db[_0x06c5('0x3d')][_0x06c5('0x1c')](_0x1764ae)[_0x06c5('0x23')](function(_0x5efe34){_0x2e57ad['count']=_0x5efe34;if(_0x22a29c['query'][_0x06c5('0x3e')]){_0x59e2ee['include']=[{'all':!![]}];}return db[_0x06c5('0x3d')][_0x06c5('0x3f')](_0x59e2ee);})[_0x06c5('0x23')](function(_0x579e32){_0x2e57ad[_0x06c5('0x40')]=_0x579e32;return _0x2e57ad;})[_0x06c5('0x23')](respondWithFilteredResult(_0x5766ca,_0x59e2ee))[_0x06c5('0x41')](handleError(_0x5766ca,null));};exports[_0x06c5('0x42')]=function(_0x184d42,_0x51e273){var _0x1a2014={'raw':![],'where':{'id':_0x184d42[_0x06c5('0x43')]['id']}},_0x1594e1={};_0x1594e1['model']=_[_0x06c5('0x2f')](db[_0x06c5('0x3d')]['rawAttributes']);_0x1594e1[_0x06c5('0x2e')]=_[_0x06c5('0x2f')](_0x184d42[_0x06c5('0x2e')]);_0x1594e1['filters']=_[_0x06c5('0x31')](_0x1594e1[_0x06c5('0x2d')],_0x1594e1[_0x06c5('0x2e')]);_0x1a2014[_0x06c5('0x33')]=_[_0x06c5('0x31')](_0x1594e1['model'],qs[_0x06c5('0x32')](_0x184d42[_0x06c5('0x2e')][_0x06c5('0x32')]));_0x1a2014[_0x06c5('0x33')]=_0x1a2014[_0x06c5('0x33')][_0x06c5('0x34')]?_0x1a2014['attributes']:_0x1594e1[_0x06c5('0x2d')];if(_0x184d42['query'][_0x06c5('0x3e')]){_0x1a2014['include']=[{'all':!![]}];}_0x1a2014=_['merge']({},_0x1a2014,_0x184d42[_0x06c5('0x3c')]);return db[_0x06c5('0x3d')]['find'](_0x1a2014)[_0x06c5('0x23')](handleEntityNotFound(_0x51e273,null))['then'](respondWithResult(_0x51e273,null))['catch'](handleError(_0x51e273,null));};exports[_0x06c5('0x44')]=function(_0x26a491,_0x12cc74){return db[_0x06c5('0x3d')][_0x06c5('0x44')](_0x26a491[_0x06c5('0x45')],{})[_0x06c5('0x23')](function(_0x123044){var _0xc5cdab=_0x26a491[_0x06c5('0x46')][_0x06c5('0x25')]({'plain':!![]});if(!_0xc5cdab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc5cdab[_0x06c5('0x47')]===_0x06c5('0x46')){var _0x5c4dff=_0x123044[_0x06c5('0x25')]({'plain':!![]});var _0x370efc=_0x06c5('0x48');return db[_0x06c5('0x49')]['find']({'where':{'name':_0x370efc,'userProfileId':_0xc5cdab[_0x06c5('0x4a')]},'raw':!![]})['then'](function(_0x10f1da){if(_0x10f1da&&_0x10f1da['autoAssociation']===0x0){return db['UserProfileResource'][_0x06c5('0x44')]({'name':_0x5c4dff[_0x06c5('0x27')],'resourceId':_0x5c4dff['id'],'type':_0x10f1da[_0x06c5('0x27')],'sectionId':_0x10f1da['id']},{})[_0x06c5('0x23')](function(){return _0x123044;});}else{return _0x123044;}})[_0x06c5('0x41')](function(_0x5cfac8){logger[_0x06c5('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cfac8);throw _0x5cfac8;});}return _0x123044;})['then'](respondWithResult(_0x12cc74,0xc9))[_0x06c5('0x41')](handleError(_0x12cc74,null));};exports['update']=function(_0x105d09,_0x3b7d84){if(_0x105d09[_0x06c5('0x45')]['id']){delete _0x105d09['body']['id'];}return db[_0x06c5('0x3d')]['find']({'where':{'id':_0x105d09['params']['id']}})[_0x06c5('0x23')](handleEntityNotFound(_0x3b7d84,null))[_0x06c5('0x23')](saveUpdates(_0x105d09[_0x06c5('0x45')],null))[_0x06c5('0x23')](respondWithResult(_0x3b7d84,null))[_0x06c5('0x41')](handleError(_0x3b7d84,null));};exports[_0x06c5('0x24')]=function(_0x407de0,_0xb5e675){return db[_0x06c5('0x3d')][_0x06c5('0x4c')]({'where':{'id':_0x407de0[_0x06c5('0x43')]['id']}})[_0x06c5('0x23')](handleEntityNotFound(_0xb5e675,null))['then'](removeEntity(_0xb5e675,null))[_0x06c5('0x41')](handleError(_0xb5e675,null));}; \ No newline at end of file +var _0xb07f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','VoiceChanSpy','findAll','rows','catch','show','params','keys','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb07f,0x109));var _0xfb07=function(_0x5106c1,_0x53a8bd){_0x5106c1=_0x5106c1-0x0;var _0x3539fc=_0xb07f[_0x5106c1];return _0x3539fc;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x17'))(_0xfb07('0x18'));var utils=require('../../config/utils');var config=require(_0xfb07('0x19'));var licenseUtil=require(_0xfb07('0x1a'));var db=require(_0xfb07('0x1b'))['db'];function respondWithStatusCode(_0x13275d,_0x2ad2cf){_0x2ad2cf=_0x2ad2cf||0xcc;return function(_0x35fd11){if(_0x35fd11){return _0x13275d[_0xfb07('0x1c')](_0x2ad2cf);}return _0x13275d['status'](_0x2ad2cf)[_0xfb07('0x1d')]();};}function respondWithResult(_0x40bf71,_0x3c69db){_0x3c69db=_0x3c69db||0xc8;return function(_0x2c35e4){if(_0x2c35e4){return _0x40bf71[_0xfb07('0x1e')](_0x3c69db)[_0xfb07('0x1f')](_0x2c35e4);}};}function respondWithFilteredResult(_0x29cbae,_0x228e2a){return function(_0x2363d6){if(_0x2363d6){var _0x6a14e0=typeof _0x228e2a[_0xfb07('0x20')]===_0xfb07('0x21')&&typeof _0x228e2a[_0xfb07('0x22')]===_0xfb07('0x21');var _0x4ebcc3=_0x2363d6['count'];var _0x3e747e=_0x6a14e0?0x0:_0x228e2a[_0xfb07('0x20')];var _0x197f12=_0x6a14e0?_0x2363d6['count']:_0x228e2a[_0xfb07('0x20')]+_0x228e2a[_0xfb07('0x22')];var _0x527c4e;if(_0x197f12>=_0x4ebcc3){_0x197f12=_0x4ebcc3;_0x527c4e=0xc8;}else{_0x527c4e=0xce;}_0x29cbae['status'](_0x527c4e);return _0x29cbae[_0xfb07('0x23')](_0xfb07('0x24'),_0x3e747e+'-'+_0x197f12+'/'+_0x4ebcc3)[_0xfb07('0x1f')](_0x2363d6);}return null;};}function patchUpdates(_0x2c6c44){return function(_0x388995){try{jsonpatch[_0xfb07('0x25')](_0x388995,_0x2c6c44,!![]);}catch(_0x15e153){return BPromise[_0xfb07('0x26')](_0x15e153);}return _0x388995[_0xfb07('0x27')]();};}function saveUpdates(_0x578bb2,_0x45806a){return function(_0x56d0c4){if(_0x56d0c4){return _0x56d0c4[_0xfb07('0x28')](_0x578bb2)[_0xfb07('0x29')](function(_0x428c85){return _0x428c85;});}return null;};}function removeEntity(_0x301c1a,_0xb2063a){return function(_0x508d3b){if(_0x508d3b){return _0x508d3b[_0xfb07('0x2a')]()[_0xfb07('0x29')](function(){var _0x10835a=_0x508d3b[_0xfb07('0x2b')]({'plain':!![]});var _0x3b14fa=_0xfb07('0x2c');return db['UserProfileResource'][_0xfb07('0x2a')]({'where':{'type':_0x3b14fa,'resourceId':_0x10835a['id']}})[_0xfb07('0x29')](function(){return _0x508d3b;});})['then'](function(){_0x301c1a[_0xfb07('0x1e')](0xcc)[_0xfb07('0x1d')]();});}};}function handleEntityNotFound(_0xe813a7,_0x149ac0){return function(_0x46927a){if(!_0x46927a){_0xe813a7[_0xfb07('0x1c')](0x194);}return _0x46927a;};}function handleError(_0x20f01a,_0x24ff99){_0x24ff99=_0x24ff99||0x1f4;return function(_0x95f1d){logger[_0xfb07('0x2d')](_0x95f1d[_0xfb07('0x2e')]);if(_0x95f1d['name']){delete _0x95f1d[_0xfb07('0x2f')];}_0x20f01a[_0xfb07('0x1e')](_0x24ff99)[_0xfb07('0x30')](_0x95f1d);};}exports[_0xfb07('0x31')]=function(_0x5dd4c9,_0x46d57e){var _0xd5290c={},_0x4ce9a4={},_0x36da2a={'count':0x0,'rows':[]};var _0x5dc353=_[_0xfb07('0x32')](db['VoiceChanSpy'][_0xfb07('0x33')],function(_0x4a8d4c){return{'name':_0x4a8d4c[_0xfb07('0x34')],'type':_0x4a8d4c[_0xfb07('0x35')][_0xfb07('0x36')]};});_0x4ce9a4[_0xfb07('0x37')]=_[_0xfb07('0x32')](_0x5dc353,_0xfb07('0x2f'));_0x4ce9a4['query']=_['keys'](_0x5dd4c9[_0xfb07('0x38')]);_0x4ce9a4[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],_0x4ce9a4['query']);_0xd5290c['attributes']=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3b')]));_0xd5290c[_0xfb07('0x3c')]=_0xd5290c['attributes']['length']?_0xd5290c['attributes']:_0x4ce9a4[_0xfb07('0x37')];if(!_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3d')](_0xfb07('0x3e'))){_0xd5290c['limit']=qs['limit'](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x22')]);_0xd5290c['offset']=qs['offset'](_0x5dd4c9['query'][_0xfb07('0x20')]);}_0xd5290c[_0xfb07('0x3f')]=qs['sort'](_0x5dd4c9['query'][_0xfb07('0x40')]);_0xd5290c[_0xfb07('0x41')]=qs[_0xfb07('0x39')](_[_0xfb07('0x42')](_0x5dd4c9[_0xfb07('0x38')],_0x4ce9a4['filters']),_0x5dc353);if(_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]){_0xd5290c[_0xfb07('0x41')]=_[_0xfb07('0x44')](_0xd5290c['where'],{'$or':_['map'](_0x5dc353,function(_0x2d40cb){if(_0x2d40cb[_0xfb07('0x35')]!==_0xfb07('0x45')){var _0xc5df59={};_0xc5df59[_0x2d40cb[_0xfb07('0x2f')]]={'$like':'%'+_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]+'%'};return _0xc5df59;}})});}_0xd5290c=_['merge']({},_0xd5290c,_0x5dd4c9['options']);var _0x44dafb={'where':_0xd5290c[_0xfb07('0x41')]};return db['VoiceChanSpy']['count'](_0x44dafb)[_0xfb07('0x29')](function(_0x20d682){_0x36da2a[_0xfb07('0x46')]=_0x20d682;if(_0x5dd4c9['query']['includeAll']){_0xd5290c[_0xfb07('0x47')]=[{'all':!![]}];}return db[_0xfb07('0x48')][_0xfb07('0x49')](_0xd5290c);})[_0xfb07('0x29')](function(_0xb87b68){_0x36da2a[_0xfb07('0x4a')]=_0xb87b68;return _0x36da2a;})[_0xfb07('0x29')](respondWithFilteredResult(_0x46d57e,_0xd5290c))[_0xfb07('0x4b')](handleError(_0x46d57e,null));};exports[_0xfb07('0x4c')]=function(_0x492f1b,_0x41df3f){var _0x12c588={'raw':![],'where':{'id':_0x492f1b[_0xfb07('0x4d')]['id']}},_0x3d6372={};_0x3d6372[_0xfb07('0x37')]=_[_0xfb07('0x4e')](db[_0xfb07('0x48')][_0xfb07('0x33')]);_0x3d6372[_0xfb07('0x38')]=_[_0xfb07('0x4e')](_0x492f1b['query']);_0x3d6372['filters']=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],_0x3d6372['query']);_0x12c588[_0xfb07('0x3c')]=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x492f1b[_0xfb07('0x38')]['fields']));_0x12c588['attributes']=_0x12c588[_0xfb07('0x3c')][_0xfb07('0x4f')]?_0x12c588[_0xfb07('0x3c')]:_0x3d6372[_0xfb07('0x37')];if(_0x492f1b[_0xfb07('0x38')][_0xfb07('0x50')]){_0x12c588[_0xfb07('0x47')]=[{'all':!![]}];}_0x12c588=_[_0xfb07('0x44')]({},_0x12c588,_0x492f1b[_0xfb07('0x51')]);return db[_0xfb07('0x48')]['find'](_0x12c588)['then'](handleEntityNotFound(_0x41df3f,null))['then'](respondWithResult(_0x41df3f,null))[_0xfb07('0x4b')](handleError(_0x41df3f,null));};exports['create']=function(_0x2397f8,_0x31cca8){return db[_0xfb07('0x48')][_0xfb07('0x52')](_0x2397f8[_0xfb07('0x53')],{})[_0xfb07('0x29')](function(_0x4d464e){var _0x3b2cce=_0x2397f8[_0xfb07('0x54')][_0xfb07('0x2b')]({'plain':!![]});if(!_0x3b2cce)throw new Error(_0xfb07('0x55'));if(_0x3b2cce[_0xfb07('0x56')]==='user'){var _0x3cfb89=_0x4d464e[_0xfb07('0x2b')]({'plain':!![]});var _0x40fa4a=_0xfb07('0x2c');return db[_0xfb07('0x57')]['find']({'where':{'name':_0x40fa4a,'userProfileId':_0x3b2cce[_0xfb07('0x58')]},'raw':!![]})[_0xfb07('0x29')](function(_0x38b30e){if(_0x38b30e&&_0x38b30e[_0xfb07('0x59')]===0x0){return db[_0xfb07('0x5a')]['create']({'name':_0x3cfb89[_0xfb07('0x2f')],'resourceId':_0x3cfb89['id'],'type':_0x38b30e[_0xfb07('0x2f')],'sectionId':_0x38b30e['id']},{})[_0xfb07('0x29')](function(){return _0x4d464e;});}else{return _0x4d464e;}})[_0xfb07('0x4b')](function(_0x4e597d){logger[_0xfb07('0x2d')](_0xfb07('0x5b'),_0x4e597d);throw _0x4e597d;});}return _0x4d464e;})[_0xfb07('0x29')](respondWithResult(_0x31cca8,0xc9))[_0xfb07('0x4b')](handleError(_0x31cca8,null));};exports[_0xfb07('0x28')]=function(_0x165628,_0x353b33){if(_0x165628[_0xfb07('0x53')]['id']){delete _0x165628[_0xfb07('0x53')]['id'];}return db[_0xfb07('0x48')]['find']({'where':{'id':_0x165628[_0xfb07('0x4d')]['id']}})['then'](handleEntityNotFound(_0x353b33,null))[_0xfb07('0x29')](saveUpdates(_0x165628[_0xfb07('0x53')],null))[_0xfb07('0x29')](respondWithResult(_0x353b33,null))[_0xfb07('0x4b')](handleError(_0x353b33,null));};exports[_0xfb07('0x2a')]=function(_0x7746bb,_0x1c76af){return db['VoiceChanSpy']['find']({'where':{'id':_0x7746bb['params']['id']}})[_0xfb07('0x29')](handleEntityNotFound(_0x1c76af,null))[_0xfb07('0x29')](removeEntity(_0x1c76af,null))[_0xfb07('0x4b')](handleError(_0x1c76af,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 604e42e..a4094dd 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 _0x53b8=['models','define','voice_chanspy','then','VoiceExtension','catch','destroy','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','push','merge','Set','format','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','exports'];(function(_0x147392,_0xd07058){var _0x412995=function(_0x214443){while(--_0x214443){_0x147392['push'](_0x147392['shift']());}};_0x412995(++_0xd07058);}(_0x53b8,0xf5));var _0x853b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x53b8[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x853b('0x0'));var attributes=require(_0x853b('0x1'));var getUserApplications=function(_0x5c2513,_0x3d701d,_0x5a5a3a){var _0x75557e=0x1;var _0xcde032=[];var _0x1cfe2d={'context':_0x3d701d['context']||_0x853b('0x2'),'exten':util['format'](_0x853b('0x3'),_0x5c2513[_0x853b('0x4')],_0x5a5a3a),'type':'system','isApp':![],'ChanSpyId':_0x5c2513['id'],'UserId':_0x3d701d['id']};_0xcde032[_0x853b('0x5')](_[_0x853b('0x6')]({'app':_0x853b('0x7'),'appdata':util[_0x853b('0x8')](_0x853b('0x9'),'chanspy'),'priority':_0x75557e++},_0x1cfe2d));if(_0x5c2513[_0x853b('0xa')]){_0xcde032['push'](_['merge']({'app':_0x853b('0xb'),'appdata':util['format'](_0x853b('0xc'),_0x5c2513['recordingFormat']),'priority':_0x75557e++},_0x1cfe2d));}if(_0x5c2513[_0x853b('0xd')]){_0xcde032[_0x853b('0x5')](_[_0x853b('0x6')]({'app':_0x853b('0xe'),'appdata':_0x5c2513[_0x853b('0xf')],'priority':_0x75557e++},_0x1cfe2d));}_0xcde032[_0x853b('0x5')](_[_0x853b('0x6')]({'app':_0x853b('0x10'),'appdata':util['format'](_0x853b('0x11'),_0x3d701d[_0x853b('0x12')],_0x5c2513[_0x853b('0x13')]?_0x5c2513['options'][_0x853b('0x14')](''):''),'priority':_0x75557e++},_0x1cfe2d));if(_0x5c2513['record']){_0xcde032[_0x853b('0x5')](_['merge']({'app':_0x853b('0x15'),'priority':_0x75557e++},_0x1cfe2d));}return _0xcde032;};var getChanSpyApplications=function(_0x5182c0,_0x4e3271){var _0x86f460=[];for(var _0x19fe67=0x0,_0x9da70c=0x1;_0x19fe67<_0x4e3271[_0x853b('0x16')];_0x19fe67++,_0x9da70c=0x1){_0x86f460=_0x86f460[_0x853b('0x17')](getUserApplications(_0x5182c0,_0x4e3271[_0x19fe67],_0x4e3271[_0x19fe67][_0x853b('0x18')]));if(_0x4e3271[_0x19fe67]['internal']!=_0x4e3271[_0x19fe67]['name']){_0x86f460=_0x86f460[_0x853b('0x17')](getUserApplications(_0x5182c0,_0x4e3271[_0x19fe67],_0x4e3271[_0x19fe67][_0x853b('0x12')]));}}return _0x86f460;};var getChanSpyPromise=function(_0x3ae471,_0x4a2836){return new BPromise(function(_0x333db5,_0x4a0c4d){return _0x3ae471[_0x853b('0x19')]['findAll']({'attributes':['id',_0x853b('0x12'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x3149e8){if(_0x3149e8){return _0x333db5(getChanSpyApplications(_0x4a2836,_0x3149e8));}return _0x333db5([]);})['catch'](function(_0x1da5c1){_0x4a0c4d(_0x1da5c1);});});};module[_0x853b('0x1a')]=function(_0x1d18fa,_0x2d491e){var _0x5391c2=_0x1d18fa[_0x853b('0x1b')];return _0x1d18fa[_0x853b('0x1c')]('VoiceChanSpy',attributes,{'tableName':_0x853b('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x485a3c,_0x913a07,_0x548b3c){return getChanSpyPromise(_0x5391c2,_0x485a3c)[_0x853b('0x1e')](function(_0x37f350){if(_0x37f350&&_0x37f350[_0x853b('0x16')]){return _0x5391c2[_0x853b('0x1f')]['bulkCreate'](_0x37f350);}})[_0x853b('0x1e')](function(){_0x548b3c();})[_0x853b('0x20')](function(_0x3e1224){_0x548b3c(_0x3e1224);});},'afterUpdate':function(_0xcb38c3,_0x4298eb,_0x2d46b0){return _0x5391c2['VoiceExtension'][_0x853b('0x21')]({'where':{'ChanSpyId':_0xcb38c3['id']}})[_0x853b('0x1e')](function(){return getChanSpyPromise(_0x5391c2,_0xcb38c3);})[_0x853b('0x1e')](function(_0x310c7f){if(_0x310c7f&&_0x310c7f[_0x853b('0x16')]){return _0x5391c2[_0x853b('0x1f')]['bulkCreate'](_0x310c7f);}})[_0x853b('0x1e')](function(){_0x2d46b0();})['catch'](function(_0x50db21){_0x2d46b0(_0x50db21);});},'afterDestroy':function(_0x5cd046,_0x2e9a9e,_0x452adf){return _0x5391c2[_0x853b('0x1f')][_0x853b('0x21')]({'where':{'ChanSpyId':_0x5cd046['id']}})[_0x853b('0x1e')](function(){_0x452adf();})[_0x853b('0x20')](function(_0xe6facf){_0x452adf(_0xe6facf);});}}});}; \ No newline at end of file +var _0xcc57=['bluebird','from-sip','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','agent','catch','VoiceChanSpy','then','VoiceExtension','bulkCreate','destroy','lodash','util'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0xcc57,0x8a));var _0x7cc5=function(_0x201b53,_0x2536f9){_0x201b53=_0x201b53-0x0;var _0x3b2e6b=_0xcc57[_0x201b53];return _0x3b2e6b;};'use strict';var _=require(_0x7cc5('0x0'));var util=require(_0x7cc5('0x1'));var BPromise=require(_0x7cc5('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3da8f6,_0x34430f,_0x2c5aed){var _0x133075=0x1;var _0x3948ef=[];var _0x39c40f={'context':_0x34430f['context']||_0x7cc5('0x3'),'exten':util[_0x7cc5('0x4')](_0x7cc5('0x5'),_0x3da8f6[_0x7cc5('0x6')],_0x2c5aed),'type':_0x7cc5('0x7'),'isApp':![],'ChanSpyId':_0x3da8f6['id'],'UserId':_0x34430f['id']};_0x3948ef[_0x7cc5('0x8')](_['merge']({'app':'Set','appdata':util['format'](_0x7cc5('0x9'),_0x7cc5('0xa')),'priority':_0x133075++},_0x39c40f));if(_0x3da8f6[_0x7cc5('0xb')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0xd'),'appdata':util[_0x7cc5('0x4')](_0x7cc5('0xe'),_0x3da8f6[_0x7cc5('0xf')]),'priority':_0x133075++},_0x39c40f));}if(_0x3da8f6[_0x7cc5('0x10')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x11'),'appdata':_0x3da8f6[_0x7cc5('0x12')],'priority':_0x133075++},_0x39c40f));}_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x13'),'appdata':util[_0x7cc5('0x4')]('SIP/%s,%s',_0x34430f[_0x7cc5('0x14')],_0x3da8f6['options']?_0x3da8f6[_0x7cc5('0x15')][_0x7cc5('0x16')](''):''),'priority':_0x133075++},_0x39c40f));if(_0x3da8f6[_0x7cc5('0xb')]){_0x3948ef[_0x7cc5('0x8')](_[_0x7cc5('0xc')]({'app':_0x7cc5('0x17'),'priority':_0x133075++},_0x39c40f));}return _0x3948ef;};var getChanSpyApplications=function(_0x2001c7,_0x576f40){var _0x5e7c45=[];for(var _0x5dcd85=0x0,_0x4256e9=0x1;_0x5dcd85<_0x576f40[_0x7cc5('0x18')];_0x5dcd85++,_0x4256e9=0x1){_0x5e7c45=_0x5e7c45[_0x7cc5('0x19')](getUserApplications(_0x2001c7,_0x576f40[_0x5dcd85],_0x576f40[_0x5dcd85][_0x7cc5('0x1a')]));if(_0x576f40[_0x5dcd85][_0x7cc5('0x1a')]!=_0x576f40[_0x5dcd85][_0x7cc5('0x14')]){_0x5e7c45=_0x5e7c45[_0x7cc5('0x19')](getUserApplications(_0x2001c7,_0x576f40[_0x5dcd85],_0x576f40[_0x5dcd85][_0x7cc5('0x14')]));}}return _0x5e7c45;};var getChanSpyPromise=function(_0x3d9fba,_0x205318){return new BPromise(function(_0x362606,_0x3be72c){return _0x3d9fba[_0x7cc5('0x1b')]['findAll']({'attributes':['id',_0x7cc5('0x14'),_0x7cc5('0x1a')],'where':{'role':_0x7cc5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x923798){if(_0x923798){return _0x362606(getChanSpyApplications(_0x205318,_0x923798));}return _0x362606([]);})[_0x7cc5('0x1d')](function(_0x2b541c){_0x3be72c(_0x2b541c);});});};module['exports']=function(_0x3d6d74,_0x202326){var _0x564581=_0x3d6d74['models'];return _0x3d6d74['define'](_0x7cc5('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d3bf1,_0x391072,_0x3e7e17){return getChanSpyPromise(_0x564581,_0x1d3bf1)[_0x7cc5('0x1f')](function(_0x3f4041){if(_0x3f4041&&_0x3f4041[_0x7cc5('0x18')]){return _0x564581['VoiceExtension']['bulkCreate'](_0x3f4041);}})[_0x7cc5('0x1f')](function(){_0x3e7e17();})[_0x7cc5('0x1d')](function(_0x4eb4d1){_0x3e7e17(_0x4eb4d1);});},'afterUpdate':function(_0x1d12ce,_0x175b9e,_0x1e0b91){return _0x564581[_0x7cc5('0x20')]['destroy']({'where':{'ChanSpyId':_0x1d12ce['id']}})[_0x7cc5('0x1f')](function(){return getChanSpyPromise(_0x564581,_0x1d12ce);})[_0x7cc5('0x1f')](function(_0x966ad5){if(_0x966ad5&&_0x966ad5[_0x7cc5('0x18')]){return _0x564581[_0x7cc5('0x20')][_0x7cc5('0x21')](_0x966ad5);}})['then'](function(){_0x1e0b91();})[_0x7cc5('0x1d')](function(_0xd95733){_0x1e0b91(_0xd95733);});},'afterDestroy':function(_0x21dece,_0x202c2c,_0x3e11fb){return _0x564581[_0x7cc5('0x20')][_0x7cc5('0x22')]({'where':{'ChanSpyId':_0x21dece['id']}})['then'](function(){_0x3e11fb();})['catch'](function(_0x38a7bb){_0x3e11fb(_0x38a7bb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b165e9c..b85c58d 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 _0xbb53=['http','then','info','request\x20sent','stringify','error','message','VoiceChanSpy,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbb53,0x121));var _0x3bb5=function(_0x4f9ed2,_0x1ce182){_0x4f9ed2=_0x4f9ed2-0x0;var _0x1ed9f6=_0xbb53[_0x4f9ed2];return _0x1ed9f6;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file +var _0xb9a7=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0xb9a7,0x112));var _0x7b9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb9a7[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2cb8002..ef8bdb3 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 _0x7753=['/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x7753,0xe2));var _0x3775=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0x7753[_0xd63e3a];return _0x19c178;};'use strict';var multer=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var path=require(_0x3775('0x2'));var timeout=require(_0x3775('0x3'));var express=require(_0x3775('0x4'));var router=express[_0x3775('0x5')]();var fs_extra=require(_0x3775('0x6'));var auth=require(_0x3775('0x7'));var interaction=require(_0x3775('0x8'));var config=require(_0x3775('0x9'));var controller=require(_0x3775('0xa'));router[_0x3775('0xb')]('/',auth[_0x3775('0xc')](),controller[_0x3775('0xd')]);router[_0x3775('0xb')](_0x3775('0xe'),auth[_0x3775('0xc')](),controller['show']);router[_0x3775('0xf')]('/',auth[_0x3775('0xc')](),controller['create']);router[_0x3775('0x10')](_0x3775('0xe'),auth['isAuthenticated'](),controller[_0x3775('0x11')]);router[_0x3775('0x12')](_0x3775('0xe'),auth[_0x3775('0xc')](),controller[_0x3775('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf1ce=['/:id','isAuthenticated','post','create','put','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf1ce,0x167));var _0xef1c=function(_0x30c201,_0x3acd9a){_0x30c201=_0x30c201-0x0;var _0x49c290=_0xf1ce[_0x30c201];return _0x49c290;};'use strict';var multer=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef1c('0x2')]();var fs_extra=require(_0xef1c('0x3'));var auth=require(_0xef1c('0x4'));var interaction=require(_0xef1c('0x5'));var config=require('../../config/environment');var controller=require(_0xef1c('0x6'));router[_0xef1c('0x7')]('/',auth['isAuthenticated'](),controller[_0xef1c('0x8')]);router[_0xef1c('0x7')](_0xef1c('0x9'),auth[_0xef1c('0xa')](),controller['show']);router[_0xef1c('0xb')]('/',auth[_0xef1c('0xa')](),controller[_0xef1c('0xc')]);router[_0xef1c('0xd')](_0xef1c('0x9'),auth[_0xef1c('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xef1c('0xe')]);module[_0xef1c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index d3567e0..67dff16 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 _0x50ce=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x2c9cc6,_0x5ab576){var _0x1856d0=function(_0x140cbd){while(--_0x140cbd){_0x2c9cc6['push'](_0x2c9cc6['shift']());}};_0x1856d0(++_0x5ab576);}(_0x50ce,0xde));var _0xe50c=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x50ce[_0x575057];return _0x49dbc8;};'use strict';var Sequelize=require(_0xe50c('0x0'));module[_0xe50c('0x1')]={'name':{'type':Sequelize[_0xe50c('0x2')],'unique':_0xe50c('0x3')},'description':{'type':Sequelize[_0xe50c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe50c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2dbe=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dbe,0x1bb));var _0xe2db=function(_0x26ce74,_0x3988a5){_0x26ce74=_0x26ce74-0x0;var _0x356ff5=_0x2dbe[_0x26ce74];return _0x356ff5;};'use strict';var Sequelize=require(_0xe2db('0x0'));module[_0xe2db('0x1')]={'name':{'type':Sequelize[_0xe2db('0x2')],'unique':_0xe2db('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2db('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a8429b7..d3d7422 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 _0xb794=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','Contexts','UserProfileResource','destroy','sendStatus','stack','name','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','includeAll','find','create','body','readFileSync','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','findAll','join','server/files/templates/context.ejs','params','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x1d5208,_0xc47693){var _0xd021a3=function(_0x2b74b0){while(--_0x2b74b0){_0x1d5208['push'](_0x1d5208['shift']());}};_0xd021a3(++_0xc47693);}(_0xb794,0x138));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b79('0x0'));var rimraf=require(_0x4b79('0x1'));var zipdir=require(_0x4b79('0x2'));var jsonpatch=require(_0x4b79('0x3'));var rp=require(_0x4b79('0x4'));var moment=require(_0x4b79('0x5'));var BPromise=require(_0x4b79('0x6'));var Mustache=require(_0x4b79('0x7'));var util=require('util');var path=require(_0x4b79('0x8'));var sox=require(_0x4b79('0x9'));var csv=require(_0x4b79('0xa'));var ejs=require(_0x4b79('0xb'));var fs=require('fs');var fs_extra=require(_0x4b79('0xc'));var _=require(_0x4b79('0xd'));var squel=require('squel');var crypto=require(_0x4b79('0xe'));var jsforce=require(_0x4b79('0xf'));var deskjs=require(_0x4b79('0x10'));var toCsv=require(_0x4b79('0xa'));var querystring=require(_0x4b79('0x11'));var Papa=require(_0x4b79('0x12'));var Redis=require('ioredis');var authService=require(_0x4b79('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4b79('0x14'));var hardwareService=require(_0x4b79('0x15'));var logger=require('../../config/logger')(_0x4b79('0x16'));var utils=require(_0x4b79('0x17'));var config=require(_0x4b79('0x18'));var licenseUtil=require(_0x4b79('0x19'));var db=require(_0x4b79('0x1a'))['db'];var jayson=require(_0x4b79('0x1b'));var client=jayson[_0x4b79('0x1c')][_0x4b79('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x85e2e1,_0x5bcdb7,_0x325aca,_0x2ae8f6){return new BPromise(function(_0x342bbb,_0x4568fb){var _0x66dc18=_0x2ae8f6||client;return _0x66dc18[_0x4b79('0x1e')](_0x85e2e1,_0x325aca)[_0x4b79('0x1f')](function(_0x53acc4){logger[_0x4b79('0x20')](_0x4b79('0x21'),_0x5bcdb7,_0x4b79('0x22'));logger[_0x4b79('0x23')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5bcdb7,_0x4b79('0x22'),JSON[_0x4b79('0x24')](_0x53acc4));if(_0x53acc4['error']){if(_0x53acc4[_0x4b79('0x25')][_0x4b79('0x26')]===0x1f4){logger[_0x4b79('0x25')](_0x4b79('0x21'),_0x5bcdb7,_0x53acc4[_0x4b79('0x25')][_0x4b79('0x27')]);return _0x4568fb(_0x53acc4['error'][_0x4b79('0x27')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5bcdb7,_0x53acc4[_0x4b79('0x25')][_0x4b79('0x27')]);return _0x342bbb(_0x53acc4[_0x4b79('0x25')][_0x4b79('0x27')]);}else{logger[_0x4b79('0x20')](_0x4b79('0x21'),_0x5bcdb7,_0x4b79('0x22'));_0x342bbb(_0x53acc4[_0x4b79('0x28')]['message']);}})['catch'](function(_0x4e4fec){logger[_0x4b79('0x25')]('VoiceContext,\x20%s,\x20%s',_0x5bcdb7,_0x4e4fec);_0x4568fb(_0x4e4fec);});});}function respondWithStatusCode(_0x1bb562,_0x15703a){_0x15703a=_0x15703a||0xcc;return function(_0x553708){if(_0x553708){return _0x1bb562['sendStatus'](_0x15703a);}return _0x1bb562[_0x4b79('0x29')](_0x15703a)[_0x4b79('0x2a')]();};}function respondWithResult(_0x1e2b18,_0x672d0a){_0x672d0a=_0x672d0a||0xc8;return function(_0x29adc1){if(_0x29adc1){return _0x1e2b18['status'](_0x672d0a)[_0x4b79('0x2b')](_0x29adc1);}};}function respondWithFilteredResult(_0x3d60c0,_0x1009cc){return function(_0x451dd2){if(_0x451dd2){var _0xda7c90=typeof _0x1009cc[_0x4b79('0x2c')]===_0x4b79('0x2d')&&typeof _0x1009cc[_0x4b79('0x2e')]===_0x4b79('0x2d');var _0x807baf=_0x451dd2[_0x4b79('0x2f')];var _0xe6fb9b=_0xda7c90?0x0:_0x1009cc['offset'];var _0x4afcd3=_0xda7c90?_0x451dd2[_0x4b79('0x2f')]:_0x1009cc[_0x4b79('0x2c')]+_0x1009cc[_0x4b79('0x2e')];var _0x2fa82d;if(_0x4afcd3>=_0x807baf){_0x4afcd3=_0x807baf;_0x2fa82d=0xc8;}else{_0x2fa82d=0xce;}_0x3d60c0[_0x4b79('0x29')](_0x2fa82d);return _0x3d60c0[_0x4b79('0x30')](_0x4b79('0x31'),_0xe6fb9b+'-'+_0x4afcd3+'/'+_0x807baf)[_0x4b79('0x2b')](_0x451dd2);}return null;};}function patchUpdates(_0x302b8f){return function(_0x3576f0){try{jsonpatch['apply'](_0x3576f0,_0x302b8f,!![]);}catch(_0x14773e){return BPromise[_0x4b79('0x32')](_0x14773e);}return _0x3576f0[_0x4b79('0x33')]();};}function saveUpdates(_0x906b99,_0x11bb52){return function(_0x430896){if(_0x430896){return _0x430896[_0x4b79('0x34')](_0x906b99)[_0x4b79('0x1f')](function(_0x3bb082){return _0x3bb082;});}return null;};}function removeEntity(_0xf02c06,_0xba367f){return function(_0xe28818){if(_0xe28818){return _0xe28818['destroy']()['then'](function(){var _0x20e37f=_0xe28818['get']({'plain':!![]});var _0x563d68=_0x4b79('0x35');return db[_0x4b79('0x36')][_0x4b79('0x37')]({'where':{'type':_0x563d68,'resourceId':_0x20e37f['id']}})[_0x4b79('0x1f')](function(){return _0xe28818;});})[_0x4b79('0x1f')](function(){_0xf02c06[_0x4b79('0x29')](0xcc)[_0x4b79('0x2a')]();});}};}function handleEntityNotFound(_0x2d2f8b,_0x56f34c){return function(_0x19e4f1){if(!_0x19e4f1){_0x2d2f8b[_0x4b79('0x38')](0x194);}return _0x19e4f1;};}function handleError(_0x3eb0c8,_0x3afcb5){_0x3afcb5=_0x3afcb5||0x1f4;return function(_0x4a9913){logger['error'](_0x4a9913[_0x4b79('0x39')]);if(_0x4a9913['name']){delete _0x4a9913[_0x4b79('0x3a')];}_0x3eb0c8[_0x4b79('0x29')](_0x3afcb5)['send'](_0x4a9913);};}exports['index']=function(_0x180f75,_0x564c45){var _0x58e928={},_0x2021ae={},_0x53668b={'count':0x0,'rows':[]};var _0x5ae8a9=_[_0x4b79('0x3b')](db[_0x4b79('0x3c')][_0x4b79('0x3d')],function(_0x4631db){return{'name':_0x4631db[_0x4b79('0x3e')],'type':_0x4631db['type'][_0x4b79('0x3f')]};});_0x2021ae[_0x4b79('0x40')]=_[_0x4b79('0x3b')](_0x5ae8a9,_0x4b79('0x3a'));_0x2021ae[_0x4b79('0x41')]=_[_0x4b79('0x42')](_0x180f75['query']);_0x2021ae[_0x4b79('0x43')]=_[_0x4b79('0x44')](_0x2021ae[_0x4b79('0x40')],_0x2021ae[_0x4b79('0x41')]);_0x58e928[_0x4b79('0x45')]=_['intersection'](_0x2021ae[_0x4b79('0x40')],qs['fields'](_0x180f75['query'][_0x4b79('0x46')]));_0x58e928[_0x4b79('0x45')]=_0x58e928[_0x4b79('0x45')]['length']?_0x58e928['attributes']:_0x2021ae[_0x4b79('0x40')];if(!_0x180f75[_0x4b79('0x41')][_0x4b79('0x47')](_0x4b79('0x48'))){_0x58e928[_0x4b79('0x2e')]=qs[_0x4b79('0x2e')](_0x180f75[_0x4b79('0x41')][_0x4b79('0x2e')]);_0x58e928[_0x4b79('0x2c')]=qs[_0x4b79('0x2c')](_0x180f75[_0x4b79('0x41')][_0x4b79('0x2c')]);}_0x58e928[_0x4b79('0x49')]=qs[_0x4b79('0x4a')](_0x180f75[_0x4b79('0x41')][_0x4b79('0x4a')]);_0x58e928[_0x4b79('0x4b')]=qs['filters'](_[_0x4b79('0x4c')](_0x180f75['query'],_0x2021ae[_0x4b79('0x43')]),_0x5ae8a9);if(_0x180f75[_0x4b79('0x41')][_0x4b79('0x4d')]){_0x58e928['where']=_[_0x4b79('0x4e')](_0x58e928['where'],{'$or':_[_0x4b79('0x3b')](_0x5ae8a9,function(_0x16a1a0){if(_0x16a1a0[_0x4b79('0x4f')]!==_0x4b79('0x50')){var _0x3124d2={};_0x3124d2[_0x16a1a0[_0x4b79('0x3a')]]={'$like':'%'+_0x180f75[_0x4b79('0x41')][_0x4b79('0x4d')]+'%'};return _0x3124d2;}})});}_0x58e928=_['merge']({},_0x58e928,_0x180f75[_0x4b79('0x51')]);var _0x1cef94={'where':_0x58e928[_0x4b79('0x4b')]};return db[_0x4b79('0x3c')][_0x4b79('0x2f')](_0x1cef94)[_0x4b79('0x1f')](function(_0x3b9a79){_0x53668b[_0x4b79('0x2f')]=_0x3b9a79;if(_0x180f75[_0x4b79('0x41')]['includeAll']){_0x58e928[_0x4b79('0x52')]=[{'all':!![]}];}return db[_0x4b79('0x3c')]['findAll'](_0x58e928);})[_0x4b79('0x1f')](function(_0x41cad2){_0x53668b[_0x4b79('0x53')]=_0x41cad2;return _0x53668b;})['then'](respondWithFilteredResult(_0x564c45,_0x58e928))[_0x4b79('0x54')](handleError(_0x564c45,null));};exports['show']=function(_0x918392,_0x51174c){var _0x46fc88={'raw':![],'where':{'id':_0x918392['params']['id']}},_0x40974c={};_0x40974c[_0x4b79('0x40')]=_[_0x4b79('0x42')](db['VoiceContext'][_0x4b79('0x3d')]);_0x40974c[_0x4b79('0x41')]=_[_0x4b79('0x42')](_0x918392[_0x4b79('0x41')]);_0x40974c[_0x4b79('0x43')]=_[_0x4b79('0x44')](_0x40974c[_0x4b79('0x40')],_0x40974c[_0x4b79('0x41')]);_0x46fc88[_0x4b79('0x45')]=_[_0x4b79('0x44')](_0x40974c[_0x4b79('0x40')],qs[_0x4b79('0x46')](_0x918392[_0x4b79('0x41')][_0x4b79('0x46')]));_0x46fc88[_0x4b79('0x45')]=_0x46fc88[_0x4b79('0x45')]['length']?_0x46fc88[_0x4b79('0x45')]:_0x40974c['model'];if(_0x918392[_0x4b79('0x41')][_0x4b79('0x55')]){_0x46fc88[_0x4b79('0x52')]=[{'all':!![]}];}_0x46fc88=_[_0x4b79('0x4e')]({},_0x46fc88,_0x918392['options']);return db[_0x4b79('0x3c')][_0x4b79('0x56')](_0x46fc88)[_0x4b79('0x1f')](handleEntityNotFound(_0x51174c,null))[_0x4b79('0x1f')](respondWithResult(_0x51174c,null))[_0x4b79('0x54')](handleError(_0x51174c,null));};exports[_0x4b79('0x57')]=function(_0x364762,_0x2d5944,_0x2904d7){var _0x164090;return db[_0x4b79('0x3c')]['create'](_0x364762[_0x4b79('0x58')],{'raw':!![]})[_0x4b79('0x1f')](function(_0x52ade0){_0x164090=_0x52ade0;return db[_0x4b79('0x3c')]['findAll']({'raw':!![]});})[_0x4b79('0x1f')](function(_0x51bd02){var _0x4505f6=fs[_0x4b79('0x59')](path['join'](config[_0x4b79('0x5a')],'server/files/templates/context.ejs'),_0x4b79('0x5b'));var _0x469c77=ejs[_0x4b79('0x5c')](_0x4505f6,{'contexts':_0x51bd02||[]});fs['writeFileSync'](_0x4b79('0x5d'),_0x469c77);})['then'](function(){return respondWithRpcPromise(_0x4b79('0x5e'),_0x4b79('0x57'),{'module':_0x4b79('0x5f')});})['then'](function(){var _0x48e554=_0x364762[_0x4b79('0x60')][_0x4b79('0x61')]({'plain':!![]});if(!_0x48e554)throw new Error(_0x4b79('0x62'));if(_0x48e554[_0x4b79('0x63')]===_0x4b79('0x60')){var _0x1cf04b=_0x164090[_0x4b79('0x61')]({'plain':!![]});return db[_0x4b79('0x64')][_0x4b79('0x56')]({'where':{'name':_0x4b79('0x35'),'userProfileId':_0x48e554['userProfileId']},'raw':!![]})[_0x4b79('0x1f')](function(_0x2891d9){if(_0x2891d9&&_0x2891d9[_0x4b79('0x65')]===0x0){return db[_0x4b79('0x36')]['create']({'name':_0x1cf04b[_0x4b79('0x3a')],'resourceId':_0x1cf04b['id'],'type':_0x2891d9['name'],'sectionId':_0x2891d9['id']},{})[_0x4b79('0x1f')](function(){return _0x164090;});}else{return _0x164090;}})['catch'](function(_0x3ea1d3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ea1d3);throw _0x3ea1d3;});}return _0x164090;})[_0x4b79('0x1f')](respondWithResult(_0x2d5944,0xc9))['catch'](handleError(_0x2d5944,null));};exports[_0x4b79('0x34')]=function(_0x571ed0,_0x497ffa,_0x4bc229){var _0x3256fa;return db[_0x4b79('0x3c')][_0x4b79('0x56')]({'where':{'id':_0x571ed0['params']['id']}})['then'](handleEntityNotFound(_0x497ffa,null))[_0x4b79('0x1f')](saveUpdates(_0x571ed0[_0x4b79('0x58')],null))['then'](function(_0x2e3048){if(_0x2e3048){_0x3256fa=_0x2e3048;return db[_0x4b79('0x3c')][_0x4b79('0x66')]({'raw':!![]});}})[_0x4b79('0x1f')](function(_0x130dac){var _0x3d9562=fs['readFileSync'](path[_0x4b79('0x67')](config[_0x4b79('0x5a')],_0x4b79('0x68')),_0x4b79('0x5b'));var _0x363542=ejs['render'](_0x3d9562,{'contexts':_0x130dac||[]});fs['writeFileSync'](_0x4b79('0x5d'),_0x363542);})[_0x4b79('0x1f')](function(){return respondWithRpcPromise(_0x4b79('0x5e'),'update',{'module':_0x4b79('0x5f')});})[_0x4b79('0x1f')](function(){return _0x3256fa;})[_0x4b79('0x1f')](respondWithResult(_0x497ffa,null))[_0x4b79('0x54')](handleError(_0x497ffa,null));};exports[_0x4b79('0x37')]=function(_0x5ecb5e,_0x106362,_0x41173c){var _0x4b90aa;return db[_0x4b79('0x3c')][_0x4b79('0x56')]({'where':{'id':_0x5ecb5e[_0x4b79('0x69')]['id']}})[_0x4b79('0x1f')](handleEntityNotFound(_0x106362,null))[_0x4b79('0x1f')](removeEntity(_0x106362,null))[_0x4b79('0x1f')](function(){return db[_0x4b79('0x3c')][_0x4b79('0x66')]({'raw':!![]});})[_0x4b79('0x1f')](function(_0xe56bef){var _0x3353b3=fs[_0x4b79('0x59')](path[_0x4b79('0x67')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x2db4e4=ejs[_0x4b79('0x5c')](_0x3353b3,{'contexts':_0xe56bef});fs[_0x4b79('0x6a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2db4e4);return respondWithRpcPromise('Reload','destroy',{'module':_0x4b79('0x5f')});})[_0x4b79('0x54')](handleError(_0x106362,null));}; \ No newline at end of file +var _0xf0f5=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','readFileSync','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','render','Reload','join','utf8','eml-format','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','../../components/parsers/qs','../../config/utils','../../config/environment','jayson/promise','client','then','info','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','json','reject','save','update','destroy','get','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0xf0f5,0x85));var _0x5f0f=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xf0f5[_0x524021];return _0x269c3e;};'use strict';var emlformat=require(_0x5f0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f0f('0x1'));var jsonpatch=require(_0x5f0f('0x2'));var rp=require(_0x5f0f('0x3'));var moment=require(_0x5f0f('0x4'));var BPromise=require(_0x5f0f('0x5'));var Mustache=require(_0x5f0f('0x6'));var util=require(_0x5f0f('0x7'));var path=require(_0x5f0f('0x8'));var sox=require(_0x5f0f('0x9'));var csv=require('to-csv');var ejs=require(_0x5f0f('0xa'));var fs=require('fs');var fs_extra=require(_0x5f0f('0xb'));var _=require(_0x5f0f('0xc'));var squel=require(_0x5f0f('0xd'));var crypto=require(_0x5f0f('0xe'));var jsforce=require(_0x5f0f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f0f('0x10'));var querystring=require(_0x5f0f('0x11'));var Papa=require(_0x5f0f('0x12'));var Redis=require(_0x5f0f('0x13'));var authService=require(_0x5f0f('0x14'));var qs=require(_0x5f0f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5f0f('0x16'));var config=require(_0x5f0f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x5f0f('0x18'));var client=jayson[_0x5f0f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47cf01,_0x1605c3,_0x31a728,_0x35b820){return new BPromise(function(_0xb08a61,_0x23c880){var _0x5d3bdf=_0x35b820||client;return _0x5d3bdf['request'](_0x47cf01,_0x31a728)[_0x5f0f('0x1a')](function(_0xd7ee48){logger[_0x5f0f('0x1b')](_0x5f0f('0x1c'),_0x1605c3,_0x5f0f('0x1d'));logger[_0x5f0f('0x1e')](_0x5f0f('0x1f'),_0x1605c3,_0x5f0f('0x1d'),JSON[_0x5f0f('0x20')](_0xd7ee48));if(_0xd7ee48[_0x5f0f('0x21')]){if(_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x22')]===0x1f4){logger[_0x5f0f('0x21')](_0x5f0f('0x1c'),_0x1605c3,_0xd7ee48[_0x5f0f('0x21')]['message']);return _0x23c880(_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x23')]);}logger['error'](_0x5f0f('0x1c'),_0x1605c3,_0xd7ee48[_0x5f0f('0x21')][_0x5f0f('0x23')]);return _0xb08a61(_0xd7ee48[_0x5f0f('0x21')]['message']);}else{logger['info'](_0x5f0f('0x1c'),_0x1605c3,_0x5f0f('0x1d'));_0xb08a61(_0xd7ee48[_0x5f0f('0x24')][_0x5f0f('0x23')]);}})[_0x5f0f('0x25')](function(_0xee098b){logger[_0x5f0f('0x21')](_0x5f0f('0x1c'),_0x1605c3,_0xee098b);_0x23c880(_0xee098b);});});}function respondWithStatusCode(_0x232b17,_0x3c178b){_0x3c178b=_0x3c178b||0xcc;return function(_0x542bbc){if(_0x542bbc){return _0x232b17[_0x5f0f('0x26')](_0x3c178b);}return _0x232b17[_0x5f0f('0x27')](_0x3c178b)[_0x5f0f('0x28')]();};}function respondWithResult(_0x2b8ffd,_0x35d1d6){_0x35d1d6=_0x35d1d6||0xc8;return function(_0x255337){if(_0x255337){return _0x2b8ffd['status'](_0x35d1d6)['json'](_0x255337);}};}function respondWithFilteredResult(_0x1221b6,_0x27dd2f){return function(_0x152ee6){if(_0x152ee6){var _0x55aebc=typeof _0x27dd2f[_0x5f0f('0x29')]===_0x5f0f('0x2a')&&typeof _0x27dd2f[_0x5f0f('0x2b')]===_0x5f0f('0x2a');var _0x34a663=_0x152ee6[_0x5f0f('0x2c')];var _0x2883e1=_0x55aebc?0x0:_0x27dd2f[_0x5f0f('0x29')];var _0x1b23a6=_0x55aebc?_0x152ee6[_0x5f0f('0x2c')]:_0x27dd2f[_0x5f0f('0x29')]+_0x27dd2f[_0x5f0f('0x2b')];var _0x49e01d;if(_0x1b23a6>=_0x34a663){_0x1b23a6=_0x34a663;_0x49e01d=0xc8;}else{_0x49e01d=0xce;}_0x1221b6[_0x5f0f('0x27')](_0x49e01d);return _0x1221b6[_0x5f0f('0x2d')]('Content-Range',_0x2883e1+'-'+_0x1b23a6+'/'+_0x34a663)[_0x5f0f('0x2e')](_0x152ee6);}return null;};}function patchUpdates(_0x1b3e61){return function(_0x5d2a80){try{jsonpatch['apply'](_0x5d2a80,_0x1b3e61,!![]);}catch(_0x96e82e){return BPromise[_0x5f0f('0x2f')](_0x96e82e);}return _0x5d2a80[_0x5f0f('0x30')]();};}function saveUpdates(_0x4d9073,_0x2eae2d){return function(_0xd0785a){if(_0xd0785a){return _0xd0785a[_0x5f0f('0x31')](_0x4d9073)[_0x5f0f('0x1a')](function(_0x1900d7){return _0x1900d7;});}return null;};}function removeEntity(_0x2b0127,_0x2918bb){return function(_0x4c6f9f){if(_0x4c6f9f){return _0x4c6f9f[_0x5f0f('0x32')]()[_0x5f0f('0x1a')](function(){var _0x4c4306=_0x4c6f9f[_0x5f0f('0x33')]({'plain':!![]});var _0x1523f7='Contexts';return db['UserProfileResource'][_0x5f0f('0x32')]({'where':{'type':_0x1523f7,'resourceId':_0x4c4306['id']}})[_0x5f0f('0x1a')](function(){return _0x4c6f9f;});})[_0x5f0f('0x1a')](function(){_0x2b0127[_0x5f0f('0x27')](0xcc)[_0x5f0f('0x28')]();});}};}function handleEntityNotFound(_0x57dd2d,_0x17474b){return function(_0x491f1c){if(!_0x491f1c){_0x57dd2d[_0x5f0f('0x26')](0x194);}return _0x491f1c;};}function handleError(_0x1608b5,_0x1d72b8){_0x1d72b8=_0x1d72b8||0x1f4;return function(_0x559589){logger['error'](_0x559589['stack']);if(_0x559589['name']){delete _0x559589[_0x5f0f('0x34')];}_0x1608b5[_0x5f0f('0x27')](_0x1d72b8)[_0x5f0f('0x35')](_0x559589);};}exports[_0x5f0f('0x36')]=function(_0xc5b98,_0x7c0a93){var _0x3788b5={},_0x562f73={},_0x212702={'count':0x0,'rows':[]};var _0x57ff74=_[_0x5f0f('0x37')](db[_0x5f0f('0x38')][_0x5f0f('0x39')],function(_0x1a1586){return{'name':_0x1a1586[_0x5f0f('0x3a')],'type':_0x1a1586[_0x5f0f('0x3b')][_0x5f0f('0x3c')]};});_0x562f73[_0x5f0f('0x3d')]=_[_0x5f0f('0x37')](_0x57ff74,_0x5f0f('0x34'));_0x562f73[_0x5f0f('0x3e')]=_[_0x5f0f('0x3f')](_0xc5b98[_0x5f0f('0x3e')]);_0x562f73[_0x5f0f('0x40')]=_[_0x5f0f('0x41')](_0x562f73['model'],_0x562f73[_0x5f0f('0x3e')]);_0x3788b5[_0x5f0f('0x42')]=_['intersection'](_0x562f73[_0x5f0f('0x3d')],qs[_0x5f0f('0x43')](_0xc5b98['query'][_0x5f0f('0x43')]));_0x3788b5[_0x5f0f('0x42')]=_0x3788b5['attributes'][_0x5f0f('0x44')]?_0x3788b5[_0x5f0f('0x42')]:_0x562f73[_0x5f0f('0x3d')];if(!_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x45')](_0x5f0f('0x46'))){_0x3788b5[_0x5f0f('0x2b')]=qs[_0x5f0f('0x2b')](_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x2b')]);_0x3788b5[_0x5f0f('0x29')]=qs['offset'](_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x29')]);}_0x3788b5[_0x5f0f('0x47')]=qs[_0x5f0f('0x48')](_0xc5b98[_0x5f0f('0x3e')]['sort']);_0x3788b5[_0x5f0f('0x49')]=qs[_0x5f0f('0x40')](_[_0x5f0f('0x4a')](_0xc5b98[_0x5f0f('0x3e')],_0x562f73['filters']),_0x57ff74);if(_0xc5b98['query'][_0x5f0f('0x4b')]){_0x3788b5['where']=_[_0x5f0f('0x4c')](_0x3788b5[_0x5f0f('0x49')],{'$or':_[_0x5f0f('0x37')](_0x57ff74,function(_0x41af1a){if(_0x41af1a[_0x5f0f('0x3b')]!==_0x5f0f('0x4d')){var _0x5676b6={};_0x5676b6[_0x41af1a[_0x5f0f('0x34')]]={'$like':'%'+_0xc5b98[_0x5f0f('0x3e')][_0x5f0f('0x4b')]+'%'};return _0x5676b6;}})});}_0x3788b5=_['merge']({},_0x3788b5,_0xc5b98[_0x5f0f('0x4e')]);var _0xe0cedd={'where':_0x3788b5[_0x5f0f('0x49')]};return db[_0x5f0f('0x38')]['count'](_0xe0cedd)[_0x5f0f('0x1a')](function(_0x592469){_0x212702[_0x5f0f('0x2c')]=_0x592469;if(_0xc5b98[_0x5f0f('0x3e')]['includeAll']){_0x3788b5[_0x5f0f('0x4f')]=[{'all':!![]}];}return db[_0x5f0f('0x38')][_0x5f0f('0x50')](_0x3788b5);})['then'](function(_0x65f3cb){_0x212702[_0x5f0f('0x51')]=_0x65f3cb;return _0x212702;})[_0x5f0f('0x1a')](respondWithFilteredResult(_0x7c0a93,_0x3788b5))[_0x5f0f('0x25')](handleError(_0x7c0a93,null));};exports['show']=function(_0x2f4ff9,_0x2084cc){var _0x7537ed={'raw':![],'where':{'id':_0x2f4ff9[_0x5f0f('0x52')]['id']}},_0xd96967={};_0xd96967[_0x5f0f('0x3d')]=_[_0x5f0f('0x3f')](db['VoiceContext'][_0x5f0f('0x39')]);_0xd96967[_0x5f0f('0x3e')]=_['keys'](_0x2f4ff9[_0x5f0f('0x3e')]);_0xd96967[_0x5f0f('0x40')]=_['intersection'](_0xd96967[_0x5f0f('0x3d')],_0xd96967[_0x5f0f('0x3e')]);_0x7537ed['attributes']=_[_0x5f0f('0x41')](_0xd96967[_0x5f0f('0x3d')],qs[_0x5f0f('0x43')](_0x2f4ff9['query']['fields']));_0x7537ed[_0x5f0f('0x42')]=_0x7537ed['attributes'][_0x5f0f('0x44')]?_0x7537ed[_0x5f0f('0x42')]:_0xd96967[_0x5f0f('0x3d')];if(_0x2f4ff9[_0x5f0f('0x3e')][_0x5f0f('0x53')]){_0x7537ed[_0x5f0f('0x4f')]=[{'all':!![]}];}_0x7537ed=_['merge']({},_0x7537ed,_0x2f4ff9['options']);return db['VoiceContext'][_0x5f0f('0x54')](_0x7537ed)[_0x5f0f('0x1a')](handleEntityNotFound(_0x2084cc,null))['then'](respondWithResult(_0x2084cc,null))['catch'](handleError(_0x2084cc,null));};exports['create']=function(_0x34ae96,_0x44b2fa,_0xb6a574){var _0x5e5743;return db[_0x5f0f('0x38')][_0x5f0f('0x55')](_0x34ae96[_0x5f0f('0x56')],{'raw':!![]})[_0x5f0f('0x1a')](function(_0x36c3bf){_0x5e5743=_0x36c3bf;return db['VoiceContext'][_0x5f0f('0x50')]({'raw':!![]});})[_0x5f0f('0x1a')](function(_0x3f3bf0){var _0x4d42f1=fs[_0x5f0f('0x57')](path['join'](config['root'],_0x5f0f('0x58')),'utf8');var _0xf2c2a4=ejs['render'](_0x4d42f1,{'contexts':_0x3f3bf0||[]});fs[_0x5f0f('0x59')](_0x5f0f('0x5a'),_0xf2c2a4);})[_0x5f0f('0x1a')](function(){return respondWithRpcPromise('Reload',_0x5f0f('0x55'),{'module':_0x5f0f('0x5b')});})['then'](function(){var _0x327e22=_0x34ae96['user']['get']({'plain':!![]});if(!_0x327e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x327e22['role']===_0x5f0f('0x5c')){var _0x2253a5=_0x5e5743[_0x5f0f('0x33')]({'plain':!![]});return db[_0x5f0f('0x5d')]['find']({'where':{'name':'Contexts','userProfileId':_0x327e22[_0x5f0f('0x5e')]},'raw':!![]})['then'](function(_0x111f1f){if(_0x111f1f&&_0x111f1f[_0x5f0f('0x5f')]===0x0){return db['UserProfileResource'][_0x5f0f('0x55')]({'name':_0x2253a5[_0x5f0f('0x34')],'resourceId':_0x2253a5['id'],'type':_0x111f1f[_0x5f0f('0x34')],'sectionId':_0x111f1f['id']},{})[_0x5f0f('0x1a')](function(){return _0x5e5743;});}else{return _0x5e5743;}})['catch'](function(_0x55226f){logger[_0x5f0f('0x21')](_0x5f0f('0x60'),_0x55226f);throw _0x55226f;});}return _0x5e5743;})[_0x5f0f('0x1a')](respondWithResult(_0x44b2fa,0xc9))[_0x5f0f('0x25')](handleError(_0x44b2fa,null));};exports[_0x5f0f('0x31')]=function(_0x2375b1,_0x41ed4c,_0x5953bd){var _0x37d64e;return db[_0x5f0f('0x38')][_0x5f0f('0x54')]({'where':{'id':_0x2375b1[_0x5f0f('0x52')]['id']}})[_0x5f0f('0x1a')](handleEntityNotFound(_0x41ed4c,null))[_0x5f0f('0x1a')](saveUpdates(_0x2375b1[_0x5f0f('0x56')],null))['then'](function(_0x5b99eb){if(_0x5b99eb){_0x37d64e=_0x5b99eb;return db[_0x5f0f('0x38')][_0x5f0f('0x50')]({'raw':!![]});}})[_0x5f0f('0x1a')](function(_0x154edb){var _0x4a7e80=fs['readFileSync'](path['join'](config[_0x5f0f('0x61')],'server/files/templates/context.ejs'),'utf8');var _0x44eb74=ejs[_0x5f0f('0x62')](_0x4a7e80,{'contexts':_0x154edb||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x44eb74);})[_0x5f0f('0x1a')](function(){return respondWithRpcPromise(_0x5f0f('0x63'),_0x5f0f('0x31'),{'module':_0x5f0f('0x5b')});})['then'](function(){return _0x37d64e;})[_0x5f0f('0x1a')](respondWithResult(_0x41ed4c,null))[_0x5f0f('0x25')](handleError(_0x41ed4c,null));};exports['destroy']=function(_0x3cec17,_0x2b4c17,_0x52450b){var _0x3eb9da;return db[_0x5f0f('0x38')][_0x5f0f('0x54')]({'where':{'id':_0x3cec17[_0x5f0f('0x52')]['id']}})[_0x5f0f('0x1a')](handleEntityNotFound(_0x2b4c17,null))[_0x5f0f('0x1a')](removeEntity(_0x2b4c17,null))[_0x5f0f('0x1a')](function(){return db['VoiceContext'][_0x5f0f('0x50')]({'raw':!![]});})[_0x5f0f('0x1a')](function(_0xcf388a){var _0x249a2e=fs[_0x5f0f('0x57')](path[_0x5f0f('0x64')](config[_0x5f0f('0x61')],_0x5f0f('0x58')),_0x5f0f('0x65'));var _0x505292=ejs['render'](_0x249a2e,{'contexts':_0xcf388a});fs[_0x5f0f('0x59')](_0x5f0f('0x5a'),_0x505292);return respondWithRpcPromise(_0x5f0f('0x63'),_0x5f0f('0x32'),{'module':_0x5f0f('0x5b')});})[_0x5f0f('0x25')](handleError(_0x2b4c17,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a88bb95..ab76054 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 _0x1588=['path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0x56a7a6,_0xbc3817){var _0x2a2baf=function(_0x32811a){while(--_0x32811a){_0x56a7a6['push'](_0x56a7a6['shift']());}};_0x2a2baf(++_0xbc3817);}(_0x1588,0xc1));var _0x8158=function(_0x3098cb,_0x2f8f40){_0x3098cb=_0x3098cb-0x0;var _0x317f4a=_0x1588[_0x3098cb];return _0x317f4a;};'use strict';var _=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));var logger=require(_0x8158('0x2'))(_0x8158('0x3'));var moment=require(_0x8158('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8158('0x5'));var rimraf=require(_0x8158('0x6'));var config=require(_0x8158('0x7'));var attributes=require(_0x8158('0x8'));module['exports']=function(_0x1c2b25,_0x5d32d1){return _0x1c2b25[_0x8158('0x9')](_0x8158('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1afc=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1afc,0x177));var _0xc1af=function(_0x45a465,_0x394ea8){_0x45a465=_0x45a465-0x0;var _0x4ecaa7=_0x1afc[_0x45a465];return _0x4ecaa7;};'use strict';var _=require(_0xc1af('0x0'));var util=require(_0xc1af('0x1'));var logger=require(_0xc1af('0x2'))('api');var moment=require(_0xc1af('0x3'));var BPromise=require(_0xc1af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1af('0x5'));var rimraf=require(_0xc1af('0x6'));var config=require(_0xc1af('0x7'));var attributes=require(_0xc1af('0x8'));module[_0xc1af('0x9')]=function(_0x5d9bf0,_0x40f185){return _0x5d9bf0[_0xc1af('0xa')](_0xc1af('0xb'),attributes,{'tableName':_0xc1af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0be9354..57e0a6a 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 _0x1042=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x1bd70f,_0x15c81e){var _0x21a5cc=function(_0x3cc6dc){while(--_0x3cc6dc){_0x1bd70f['push'](_0x1bd70f['shift']());}};_0x21a5cc(++_0x15c81e);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require(_0x2104('0x1'));var moment=require(_0x2104('0x2'));var BPromise=require(_0x2104('0x3'));var rs=require(_0x2104('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2104('0x5'));var logger=require(_0x2104('0x6'))(_0x2104('0x7'));var config=require(_0x2104('0x8'));var jayson=require(_0x2104('0x9'));var client=jayson[_0x2104('0xa')][_0x2104('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b491,_0x543b64,_0x397603){return new BPromise(function(_0x1f6927,_0x5897da){return client[_0x2104('0xc')](_0x18b491,_0x397603)[_0x2104('0xd')](function(_0x16f93f){logger[_0x2104('0xe')]('VoiceContext,\x20%s,\x20%s',_0x543b64,_0x2104('0xf'));logger[_0x2104('0x10')](_0x2104('0x11'),_0x543b64,_0x2104('0xf'),JSON[_0x2104('0x12')](_0x16f93f));if(_0x16f93f['error']){if(_0x16f93f[_0x2104('0x13')][_0x2104('0x14')]===0x1f4){logger[_0x2104('0x13')]('VoiceContext,\x20%s,\x20%s',_0x543b64,_0x16f93f[_0x2104('0x13')]['message']);return _0x5897da(_0x16f93f[_0x2104('0x13')]['message']);}logger[_0x2104('0x13')](_0x2104('0x15'),_0x543b64,_0x16f93f[_0x2104('0x13')]['message']);return _0x1f6927(_0x16f93f[_0x2104('0x13')][_0x2104('0x16')]);}else{logger[_0x2104('0xe')]('VoiceContext,\x20%s,\x20%s',_0x543b64,_0x2104('0xf'));_0x1f6927(_0x16f93f[_0x2104('0x17')][_0x2104('0x16')]);}})['catch'](function(_0x3fea9b){logger[_0x2104('0x13')](_0x2104('0x15'),_0x543b64,_0x3fea9b);_0x5897da(_0x3fea9b);});});} \ No newline at end of file +var _0xb5c6=['catch','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s'];(function(_0x990c76,_0x3145de){var _0x6c3f34=function(_0x21ba7f){while(--_0x21ba7f){_0x990c76['push'](_0x990c76['shift']());}};_0x6c3f34(++_0x3145de);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb5c6[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x6b5c('0x0'));var moment=require(_0x6b5c('0x1'));var BPromise=require(_0x6b5c('0x2'));var rs=require(_0x6b5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b5c('0x4'));var config=require(_0x6b5c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6b5c('0x6')][_0x6b5c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c93ca,_0x17fed5,_0x45cdf1){return new BPromise(function(_0x2a13d0,_0xa530){return client[_0x6b5c('0x8')](_0x4c93ca,_0x45cdf1)[_0x6b5c('0x9')](function(_0x329f33){logger[_0x6b5c('0xa')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));logger['debug'](_0x6b5c('0xc'),_0x17fed5,_0x6b5c('0xb'),JSON[_0x6b5c('0xd')](_0x329f33));if(_0x329f33[_0x6b5c('0xe')]){if(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0xf')]===0x1f4){logger[_0x6b5c('0xe')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x329f33['error'][_0x6b5c('0x10')]);return _0xa530(_0x329f33[_0x6b5c('0xe')]['message']);}logger[_0x6b5c('0xe')](_0x6b5c('0x11'),_0x17fed5,_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);return _0x2a13d0(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);}else{logger[_0x6b5c('0xa')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));_0x2a13d0(_0x329f33['result'][_0x6b5c('0x10')]);}})[_0x6b5c('0x12')](function(_0x5eefc6){logger[_0x6b5c('0xe')]('VoiceContext,\x20%s,\x20%s',_0x17fed5,_0x5eefc6);_0xa530(_0x5eefc6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 71c4363..a6cf8e9 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 _0x46a4=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x1d7278,_0x56bd9a){var _0x52d75e=function(_0x3f5bcc){while(--_0x3f5bcc){_0x1d7278['push'](_0x1d7278['shift']());}};_0x52d75e(++_0x56bd9a);}(_0x46a4,0x190));var _0x446a=function(_0x3cac48,_0x1b8e73){_0x3cac48=_0x3cac48-0x0;var _0x5d92fb=_0x46a4[_0x3cac48];return _0x5d92fb;};'use strict';var multer=require(_0x446a('0x0'));var util=require(_0x446a('0x1'));var path=require('path');var timeout=require(_0x446a('0x2'));var express=require(_0x446a('0x3'));var router=express[_0x446a('0x4')]();var fs_extra=require(_0x446a('0x5'));var auth=require(_0x446a('0x6'));var interaction=require(_0x446a('0x7'));var config=require(_0x446a('0x8'));var controller=require('./voiceDialReport.controller');router[_0x446a('0x9')]('/',auth['isAuthenticated'](),controller[_0x446a('0xa')]);router[_0x446a('0x9')](_0x446a('0xb'),auth[_0x446a('0xc')](),controller[_0x446a('0xd')]);router[_0x446a('0x9')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0xf')]);router[_0x446a('0x10')]('/',auth[_0x446a('0xc')](),controller[_0x446a('0x11')]);router[_0x446a('0x12')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x13')]);router[_0x446a('0x14')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x15')]);module[_0x446a('0x16')]=router; \ No newline at end of file +var _0xcb31=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x16d8d1,_0xfc8da6){var _0x17dc79=function(_0x2c36c6){while(--_0x2c36c6){_0x16d8d1['push'](_0x16d8d1['shift']());}};_0x17dc79(++_0xfc8da6);}(_0xcb31,0x149));var _0x1cb3=function(_0x46028a,_0x579e3f){_0x46028a=_0x46028a-0x0;var _0x577123=_0xcb31[_0x46028a];return _0x577123;};'use strict';var multer=require(_0x1cb3('0x0'));var util=require(_0x1cb3('0x1'));var path=require(_0x1cb3('0x2'));var timeout=require(_0x1cb3('0x3'));var express=require(_0x1cb3('0x4'));var router=express[_0x1cb3('0x5')]();var fs_extra=require(_0x1cb3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1cb3('0x7'));var config=require(_0x1cb3('0x8'));var controller=require(_0x1cb3('0x9'));router[_0x1cb3('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb3('0xb')]);router['get']('/describe',auth[_0x1cb3('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1cb3('0xd')]);router[_0x1cb3('0xe')]('/',auth[_0x1cb3('0xc')](),controller[_0x1cb3('0xf')]);router[_0x1cb3('0x10')]('/:id',auth[_0x1cb3('0xc')](),controller[_0x1cb3('0x11')]);router[_0x1cb3('0x12')](_0x1cb3('0x13'),auth['isAuthenticated'](),controller[_0x1cb3('0x14')]);module[_0x1cb3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 674c13d..a79d0b3 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x400a4b,_0x5a2180){var _0x5117bd=function(_0x12f5d7){while(--_0x12f5d7){_0x400a4b['push'](_0x400a4b['shift']());}};_0x5117bd(++_0x5a2180);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x4b84[_0x1d94d1];return _0x23c397;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x273c44,_0x9dcd9c){var _0x5d3212=function(_0x43eb67){while(--_0x43eb67){_0x273c44['push'](_0x273c44['shift']());}};_0x5d3212(++_0x9dcd9c);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1da8db5..c3bad93 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 _0x21ac=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','VoiceDialReport','include','findAll','rows','catch','rawAttributes','intersection','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x21ac,0x1ad));var _0xc21a=function(_0x34c9cc,_0x4e0fc4){_0x34c9cc=_0x34c9cc-0x0;var _0x3bdd16=_0x21ac[_0x34c9cc];return _0x3bdd16;};'use strict';var emlformat=require(_0xc21a('0x0'));var rimraf=require(_0xc21a('0x1'));var zipdir=require(_0xc21a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc21a('0x3'));var moment=require(_0xc21a('0x4'));var BPromise=require(_0xc21a('0x5'));var Mustache=require(_0xc21a('0x6'));var util=require('util');var path=require(_0xc21a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc21a('0x8'));var fs=require('fs');var fs_extra=require(_0xc21a('0x9'));var _=require(_0xc21a('0xa'));var squel=require(_0xc21a('0xb'));var crypto=require('crypto');var jsforce=require(_0xc21a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc21a('0xd'));var querystring=require(_0xc21a('0xe'));var Papa=require(_0xc21a('0xf'));var Redis=require(_0xc21a('0x10'));var authService=require(_0xc21a('0x11'));var qs=require(_0xc21a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21a('0x13'))(_0xc21a('0x14'));var utils=require('../../config/utils');var config=require(_0xc21a('0x15'));var licenseUtil=require(_0xc21a('0x16'));var db=require(_0xc21a('0x17'))['db'];function respondWithStatusCode(_0x17922f,_0x10af38){_0x10af38=_0x10af38||0xcc;return function(_0x10d3d0){if(_0x10d3d0){return _0x17922f['sendStatus'](_0x10af38);}return _0x17922f[_0xc21a('0x18')](_0x10af38)[_0xc21a('0x19')]();};}function respondWithResult(_0x123a57,_0x3b25d5){_0x3b25d5=_0x3b25d5||0xc8;return function(_0x365e0b){if(_0x365e0b){return _0x123a57[_0xc21a('0x18')](_0x3b25d5)[_0xc21a('0x1a')](_0x365e0b);}};}function respondWithFilteredResult(_0x18f075,_0x2859d6){return function(_0x293fcd){if(_0x293fcd){var _0x286fcc=typeof _0x2859d6[_0xc21a('0x1b')]==='undefined'&&typeof _0x2859d6[_0xc21a('0x1c')]===_0xc21a('0x1d');var _0xef71e4=_0x293fcd[_0xc21a('0x1e')];var _0x4ffc5c=_0x286fcc?0x0:_0x2859d6['offset'];var _0x268209=_0x286fcc?_0x293fcd[_0xc21a('0x1e')]:_0x2859d6['offset']+_0x2859d6[_0xc21a('0x1c')];var _0x2ea9c7;if(_0x268209>=_0xef71e4){_0x268209=_0xef71e4;_0x2ea9c7=0xc8;}else{_0x2ea9c7=0xce;}_0x18f075[_0xc21a('0x18')](_0x2ea9c7);return _0x18f075[_0xc21a('0x1f')](_0xc21a('0x20'),_0x4ffc5c+'-'+_0x268209+'/'+_0xef71e4)['json'](_0x293fcd);}return null;};}function patchUpdates(_0x190129){return function(_0x5031a3){try{jsonpatch[_0xc21a('0x21')](_0x5031a3,_0x190129,!![]);}catch(_0x5ecf49){return BPromise[_0xc21a('0x22')](_0x5ecf49);}return _0x5031a3[_0xc21a('0x23')]();};}function saveUpdates(_0x111316,_0x3dc1c0){return function(_0x11f0c4){if(_0x11f0c4){return _0x11f0c4[_0xc21a('0x24')](_0x111316)[_0xc21a('0x25')](function(_0xd3a951){return _0xd3a951;});}return null;};}function removeEntity(_0x3afb2e,_0x33eb8f){return function(_0x1d89ae){if(_0x1d89ae){return _0x1d89ae[_0xc21a('0x26')]()[_0xc21a('0x25')](function(){_0x3afb2e[_0xc21a('0x18')](0xcc)[_0xc21a('0x19')]();});}};}function handleEntityNotFound(_0x8d5c02,_0x167fca){return function(_0x289e9e){if(!_0x289e9e){_0x8d5c02[_0xc21a('0x27')](0x194);}return _0x289e9e;};}function handleError(_0x1e5bfa,_0x28bc70){_0x28bc70=_0x28bc70||0x1f4;return function(_0x35ebbf){logger['error'](_0x35ebbf[_0xc21a('0x28')]);if(_0x35ebbf[_0xc21a('0x29')]){delete _0x35ebbf['name'];}_0x1e5bfa[_0xc21a('0x18')](_0x28bc70)[_0xc21a('0x2a')](_0x35ebbf);};}exports[_0xc21a('0x2b')]=function(_0x487646,_0x5c968a){var _0x5d0eb9={},_0x177ea1={},_0x30c09c={'count':0x0,'rows':[]};var _0x2f1480=_[_0xc21a('0x2c')](db['VoiceDialReport']['rawAttributes'],function(_0x1f033e){return{'name':_0x1f033e['fieldName'],'type':_0x1f033e[_0xc21a('0x2d')][_0xc21a('0x2e')]};});_0x177ea1[_0xc21a('0x2f')]=_['map'](_0x2f1480,_0xc21a('0x29'));_0x177ea1[_0xc21a('0x30')]=_[_0xc21a('0x31')](_0x487646[_0xc21a('0x30')]);_0x177ea1[_0xc21a('0x32')]=_['intersection'](_0x177ea1[_0xc21a('0x2f')],_0x177ea1[_0xc21a('0x30')]);_0x5d0eb9[_0xc21a('0x33')]=_['intersection'](_0x177ea1[_0xc21a('0x2f')],qs[_0xc21a('0x34')](_0x487646[_0xc21a('0x30')]['fields']));_0x5d0eb9['attributes']=_0x5d0eb9['attributes'][_0xc21a('0x35')]?_0x5d0eb9[_0xc21a('0x33')]:_0x177ea1[_0xc21a('0x2f')];if(!_0x487646[_0xc21a('0x30')][_0xc21a('0x36')]('nolimit')){_0x5d0eb9[_0xc21a('0x1c')]=qs['limit'](_0x487646[_0xc21a('0x30')]['limit']);_0x5d0eb9['offset']=qs[_0xc21a('0x1b')](_0x487646[_0xc21a('0x30')][_0xc21a('0x1b')]);}_0x5d0eb9[_0xc21a('0x37')]=qs[_0xc21a('0x38')](_0x487646[_0xc21a('0x30')][_0xc21a('0x38')]);_0x5d0eb9[_0xc21a('0x39')]=qs[_0xc21a('0x32')](_[_0xc21a('0x3a')](_0x487646[_0xc21a('0x30')],_0x177ea1[_0xc21a('0x32')]),_0x2f1480);if(_0x487646[_0xc21a('0x30')][_0xc21a('0x3b')]){_0x5d0eb9[_0xc21a('0x39')]=_['merge'](_0x5d0eb9[_0xc21a('0x39')],{'$or':_[_0xc21a('0x2c')](_0x2f1480,function(_0x2bded2){if(_0x2bded2[_0xc21a('0x2d')]!==_0xc21a('0x3c')){var _0x438119={};_0x438119[_0x2bded2[_0xc21a('0x29')]]={'$like':'%'+_0x487646['query']['filter']+'%'};return _0x438119;}})});}_0x5d0eb9=_[_0xc21a('0x3d')]({},_0x5d0eb9,_0x487646['options']);var _0x1d5faf={'where':_0x5d0eb9['where']};return db[_0xc21a('0x3e')]['count'](_0x1d5faf)['then'](function(_0x185a82){_0x30c09c[_0xc21a('0x1e')]=_0x185a82;if(_0x487646[_0xc21a('0x30')]['includeAll']){_0x5d0eb9[_0xc21a('0x3f')]=[{'all':!![]}];}return db[_0xc21a('0x3e')][_0xc21a('0x40')](_0x5d0eb9);})[_0xc21a('0x25')](function(_0x2b2410){_0x30c09c[_0xc21a('0x41')]=_0x2b2410;return _0x30c09c;})[_0xc21a('0x25')](respondWithFilteredResult(_0x5c968a,_0x5d0eb9))[_0xc21a('0x42')](handleError(_0x5c968a,null));};exports['show']=function(_0x57b63e,_0x1b90a3){var _0x3371ff={'raw':!![],'where':{'id':_0x57b63e['params']['id']}},_0x2cc5fa={};_0x2cc5fa['model']=_[_0xc21a('0x31')](db[_0xc21a('0x3e')][_0xc21a('0x43')]);_0x2cc5fa[_0xc21a('0x30')]=_['keys'](_0x57b63e[_0xc21a('0x30')]);_0x2cc5fa['filters']=_[_0xc21a('0x44')](_0x2cc5fa[_0xc21a('0x2f')],_0x2cc5fa[_0xc21a('0x30')]);_0x3371ff[_0xc21a('0x33')]=_['intersection'](_0x2cc5fa[_0xc21a('0x2f')],qs[_0xc21a('0x34')](_0x57b63e[_0xc21a('0x30')][_0xc21a('0x34')]));_0x3371ff[_0xc21a('0x33')]=_0x3371ff[_0xc21a('0x33')][_0xc21a('0x35')]?_0x3371ff[_0xc21a('0x33')]:_0x2cc5fa[_0xc21a('0x2f')];if(_0x57b63e[_0xc21a('0x30')][_0xc21a('0x45')]){_0x3371ff[_0xc21a('0x3f')]=[{'all':!![]}];}_0x3371ff=_[_0xc21a('0x3d')]({},_0x3371ff,_0x57b63e['options']);return db[_0xc21a('0x3e')][_0xc21a('0x46')](_0x3371ff)[_0xc21a('0x25')](handleEntityNotFound(_0x1b90a3,null))[_0xc21a('0x25')](respondWithResult(_0x1b90a3,null))[_0xc21a('0x42')](handleError(_0x1b90a3,null));};exports[_0xc21a('0x47')]=function(_0x36ba65,_0x3cc63c){return db[_0xc21a('0x3e')][_0xc21a('0x47')](_0x36ba65[_0xc21a('0x48')],{})[_0xc21a('0x25')](respondWithResult(_0x3cc63c,0xc9))['catch'](handleError(_0x3cc63c,null));};exports['update']=function(_0x20d432,_0x51a2c5){if(_0x20d432[_0xc21a('0x48')]['id']){delete _0x20d432[_0xc21a('0x48')]['id'];}return db[_0xc21a('0x3e')][_0xc21a('0x46')]({'where':{'id':_0x20d432[_0xc21a('0x49')]['id']}})[_0xc21a('0x25')](handleEntityNotFound(_0x51a2c5,null))[_0xc21a('0x25')](saveUpdates(_0x20d432['body'],null))[_0xc21a('0x25')](respondWithResult(_0x51a2c5,null))[_0xc21a('0x42')](handleError(_0x51a2c5,null));};exports[_0xc21a('0x26')]=function(_0x3af45c,_0x107d69){return db[_0xc21a('0x3e')]['find']({'where':{'id':_0x3af45c[_0xc21a('0x49')]['id']}})['then'](handleEntityNotFound(_0x107d69,null))[_0xc21a('0x25')](removeEntity(_0x107d69,null))['catch'](handleError(_0x107d69,null));};exports[_0xc21a('0x4a')]=function(_0x329553,_0x33c28a){return db['VoiceDialReport'][_0xc21a('0x4a')]()['then'](respondWithResult(_0x33c28a,null))[_0xc21a('0x42')](handleError(_0x33c28a,null));}; \ No newline at end of file +var _0x3b96=['sort','where','pick','merge','filter','options','VoiceDialReport','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0xedad0f,_0xd2a73d){var _0x1d657e=function(_0x2c98ce){while(--_0x2c98ce){_0xedad0f['push'](_0xedad0f['shift']());}};_0x1d657e(++_0xd2a73d);}(_0x3b96,0x1cc));var _0x63b9=function(_0x2007ba,_0x49eaed){_0x2007ba=_0x2007ba-0x0;var _0x3b2f60=_0x3b96[_0x2007ba];return _0x3b2f60;};'use strict';var emlformat=require(_0x63b9('0x0'));var rimraf=require(_0x63b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63b9('0x2'));var rp=require(_0x63b9('0x3'));var moment=require('moment');var BPromise=require(_0x63b9('0x4'));var Mustache=require(_0x63b9('0x5'));var util=require(_0x63b9('0x6'));var path=require(_0x63b9('0x7'));var sox=require(_0x63b9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63b9('0x9'));var squel=require(_0x63b9('0xa'));var crypto=require(_0x63b9('0xb'));var jsforce=require(_0x63b9('0xc'));var deskjs=require(_0x63b9('0xd'));var toCsv=require(_0x63b9('0xe'));var querystring=require('querystring');var Papa=require(_0x63b9('0xf'));var Redis=require('ioredis');var authService=require(_0x63b9('0x10'));var qs=require(_0x63b9('0x11'));var as=require(_0x63b9('0x12'));var hardwareService=require(_0x63b9('0x13'));var logger=require(_0x63b9('0x14'))(_0x63b9('0x15'));var utils=require(_0x63b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x63b9('0x17'));var db=require(_0x63b9('0x18'))['db'];function respondWithStatusCode(_0x361a27,_0x464d5f){_0x464d5f=_0x464d5f||0xcc;return function(_0x2a5ac2){if(_0x2a5ac2){return _0x361a27[_0x63b9('0x19')](_0x464d5f);}return _0x361a27[_0x63b9('0x1a')](_0x464d5f)[_0x63b9('0x1b')]();};}function respondWithResult(_0x42d32a,_0x4f9107){_0x4f9107=_0x4f9107||0xc8;return function(_0x4b564b){if(_0x4b564b){return _0x42d32a[_0x63b9('0x1a')](_0x4f9107)['json'](_0x4b564b);}};}function respondWithFilteredResult(_0x5e93e9,_0x1f5a92){return function(_0x420ede){if(_0x420ede){var _0xd7e140=typeof _0x1f5a92[_0x63b9('0x1c')]===_0x63b9('0x1d')&&typeof _0x1f5a92[_0x63b9('0x1e')]===_0x63b9('0x1d');var _0x23ee12=_0x420ede[_0x63b9('0x1f')];var _0x1b9be7=_0xd7e140?0x0:_0x1f5a92['offset'];var _0x80a4ec=_0xd7e140?_0x420ede['count']:_0x1f5a92['offset']+_0x1f5a92['limit'];var _0x3bdd0a;if(_0x80a4ec>=_0x23ee12){_0x80a4ec=_0x23ee12;_0x3bdd0a=0xc8;}else{_0x3bdd0a=0xce;}_0x5e93e9[_0x63b9('0x1a')](_0x3bdd0a);return _0x5e93e9[_0x63b9('0x20')]('Content-Range',_0x1b9be7+'-'+_0x80a4ec+'/'+_0x23ee12)[_0x63b9('0x21')](_0x420ede);}return null;};}function patchUpdates(_0x3c8077){return function(_0x53991f){try{jsonpatch[_0x63b9('0x22')](_0x53991f,_0x3c8077,!![]);}catch(_0x53c868){return BPromise[_0x63b9('0x23')](_0x53c868);}return _0x53991f[_0x63b9('0x24')]();};}function saveUpdates(_0x3e295b,_0x1fe4d9){return function(_0x30e1d3){if(_0x30e1d3){return _0x30e1d3[_0x63b9('0x25')](_0x3e295b)[_0x63b9('0x26')](function(_0x24e4a5){return _0x24e4a5;});}return null;};}function removeEntity(_0x11346c,_0x476af2){return function(_0xcf0001){if(_0xcf0001){return _0xcf0001[_0x63b9('0x27')]()[_0x63b9('0x26')](function(){_0x11346c[_0x63b9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa17fb9,_0x1cdb9f){return function(_0x44a204){if(!_0x44a204){_0xa17fb9[_0x63b9('0x19')](0x194);}return _0x44a204;};}function handleError(_0x4990f5,_0x1e41d6){_0x1e41d6=_0x1e41d6||0x1f4;return function(_0x39850e){logger[_0x63b9('0x28')](_0x39850e[_0x63b9('0x29')]);if(_0x39850e[_0x63b9('0x2a')]){delete _0x39850e[_0x63b9('0x2a')];}_0x4990f5[_0x63b9('0x1a')](_0x1e41d6)['send'](_0x39850e);};}exports[_0x63b9('0x2b')]=function(_0x4a6ad8,_0x540f2c){var _0x4ffbcb={},_0x250189={},_0x250ce4={'count':0x0,'rows':[]};var _0x4b5423=_['map'](db['VoiceDialReport'][_0x63b9('0x2c')],function(_0x13b448){return{'name':_0x13b448['fieldName'],'type':_0x13b448[_0x63b9('0x2d')][_0x63b9('0x2e')]};});_0x250189[_0x63b9('0x2f')]=_[_0x63b9('0x30')](_0x4b5423,_0x63b9('0x2a'));_0x250189[_0x63b9('0x31')]=_[_0x63b9('0x32')](_0x4a6ad8[_0x63b9('0x31')]);_0x250189[_0x63b9('0x33')]=_['intersection'](_0x250189['model'],_0x250189[_0x63b9('0x31')]);_0x4ffbcb[_0x63b9('0x34')]=_[_0x63b9('0x35')](_0x250189[_0x63b9('0x2f')],qs[_0x63b9('0x36')](_0x4a6ad8[_0x63b9('0x31')]['fields']));_0x4ffbcb['attributes']=_0x4ffbcb[_0x63b9('0x34')][_0x63b9('0x37')]?_0x4ffbcb[_0x63b9('0x34')]:_0x250189[_0x63b9('0x2f')];if(!_0x4a6ad8[_0x63b9('0x31')]['hasOwnProperty'](_0x63b9('0x38'))){_0x4ffbcb[_0x63b9('0x1e')]=qs['limit'](_0x4a6ad8['query'][_0x63b9('0x1e')]);_0x4ffbcb[_0x63b9('0x1c')]=qs['offset'](_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x1c')]);}_0x4ffbcb[_0x63b9('0x39')]=qs['sort'](_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x3a')]);_0x4ffbcb[_0x63b9('0x3b')]=qs[_0x63b9('0x33')](_[_0x63b9('0x3c')](_0x4a6ad8[_0x63b9('0x31')],_0x250189['filters']),_0x4b5423);if(_0x4a6ad8[_0x63b9('0x31')]['filter']){_0x4ffbcb['where']=_[_0x63b9('0x3d')](_0x4ffbcb[_0x63b9('0x3b')],{'$or':_[_0x63b9('0x30')](_0x4b5423,function(_0x2a2bbe){if(_0x2a2bbe[_0x63b9('0x2d')]!=='VIRTUAL'){var _0x4c08a5={};_0x4c08a5[_0x2a2bbe[_0x63b9('0x2a')]]={'$like':'%'+_0x4a6ad8[_0x63b9('0x31')][_0x63b9('0x3e')]+'%'};return _0x4c08a5;}})});}_0x4ffbcb=_[_0x63b9('0x3d')]({},_0x4ffbcb,_0x4a6ad8[_0x63b9('0x3f')]);var _0x23fb28={'where':_0x4ffbcb['where']};return db[_0x63b9('0x40')][_0x63b9('0x1f')](_0x23fb28)[_0x63b9('0x26')](function(_0x24a388){_0x250ce4[_0x63b9('0x1f')]=_0x24a388;if(_0x4a6ad8[_0x63b9('0x31')]['includeAll']){_0x4ffbcb[_0x63b9('0x41')]=[{'all':!![]}];}return db[_0x63b9('0x40')][_0x63b9('0x42')](_0x4ffbcb);})['then'](function(_0x392150){_0x250ce4[_0x63b9('0x43')]=_0x392150;return _0x250ce4;})['then'](respondWithFilteredResult(_0x540f2c,_0x4ffbcb))['catch'](handleError(_0x540f2c,null));};exports['show']=function(_0x1a6105,_0x4978c3){var _0x4de0ff={'raw':!![],'where':{'id':_0x1a6105['params']['id']}},_0x4770e4={};_0x4770e4['model']=_[_0x63b9('0x32')](db['VoiceDialReport'][_0x63b9('0x2c')]);_0x4770e4[_0x63b9('0x31')]=_[_0x63b9('0x32')](_0x1a6105[_0x63b9('0x31')]);_0x4770e4[_0x63b9('0x33')]=_[_0x63b9('0x35')](_0x4770e4[_0x63b9('0x2f')],_0x4770e4['query']);_0x4de0ff[_0x63b9('0x34')]=_['intersection'](_0x4770e4['model'],qs[_0x63b9('0x36')](_0x1a6105[_0x63b9('0x31')][_0x63b9('0x36')]));_0x4de0ff[_0x63b9('0x34')]=_0x4de0ff['attributes'][_0x63b9('0x37')]?_0x4de0ff[_0x63b9('0x34')]:_0x4770e4[_0x63b9('0x2f')];if(_0x1a6105[_0x63b9('0x31')]['includeAll']){_0x4de0ff['include']=[{'all':!![]}];}_0x4de0ff=_[_0x63b9('0x3d')]({},_0x4de0ff,_0x1a6105[_0x63b9('0x3f')]);return db['VoiceDialReport'][_0x63b9('0x44')](_0x4de0ff)[_0x63b9('0x26')](handleEntityNotFound(_0x4978c3,null))['then'](respondWithResult(_0x4978c3,null))[_0x63b9('0x45')](handleError(_0x4978c3,null));};exports[_0x63b9('0x46')]=function(_0x2adace,_0x34b279){return db['VoiceDialReport']['create'](_0x2adace[_0x63b9('0x47')],{})[_0x63b9('0x26')](respondWithResult(_0x34b279,0xc9))[_0x63b9('0x45')](handleError(_0x34b279,null));};exports[_0x63b9('0x25')]=function(_0x27a2da,_0x1d5ed4){if(_0x27a2da['body']['id']){delete _0x27a2da[_0x63b9('0x47')]['id'];}return db[_0x63b9('0x40')][_0x63b9('0x44')]({'where':{'id':_0x27a2da[_0x63b9('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d5ed4,null))[_0x63b9('0x26')](saveUpdates(_0x27a2da[_0x63b9('0x47')],null))['then'](respondWithResult(_0x1d5ed4,null))[_0x63b9('0x45')](handleError(_0x1d5ed4,null));};exports[_0x63b9('0x27')]=function(_0xadcc67,_0xd5ef31){return db[_0x63b9('0x40')]['find']({'where':{'id':_0xadcc67[_0x63b9('0x48')]['id']}})[_0x63b9('0x26')](handleEntityNotFound(_0xd5ef31,null))[_0x63b9('0x26')](removeEntity(_0xd5ef31,null))[_0x63b9('0x45')](handleError(_0xd5ef31,null));};exports[_0x63b9('0x49')]=function(_0x3aac26,_0x323555){return db[_0x63b9('0x40')][_0x63b9('0x49')]()['then'](respondWithResult(_0x323555,null))[_0x63b9('0x45')](handleError(_0x323555,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5e8c9a2..d80cbdf 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 _0xe616=['moment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api'];(function(_0x1e8ea5,_0x5c5d7a){var _0x426e66=function(_0x755e5b){while(--_0x755e5b){_0x1e8ea5['push'](_0x1e8ea5['shift']());}};_0x426e66(++_0x5c5d7a);}(_0xe616,0x178));var _0x6e61=function(_0x390dd3,_0x5a387c){_0x390dd3=_0x390dd3-0x0;var _0x6eb299=_0xe616[_0x390dd3];return _0x6eb299;};'use strict';var _=require(_0x6e61('0x0'));var util=require(_0x6e61('0x1'));var logger=require(_0x6e61('0x2'))(_0x6e61('0x3'));var moment=require(_0x6e61('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e61('0x5'));module[_0x6e61('0x6')]=function(_0x55449f,_0x2934d4){return _0x55449f[_0x6e61('0x7')](_0x6e61('0x8'),attributes,{'tableName':_0x6e61('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d1e=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5baadf,_0x1bb942){var _0x3cd985=function(_0x15810c){while(--_0x15810c){_0x5baadf['push'](_0x5baadf['shift']());}};_0x3cd985(++_0x1bb942);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x4cce3d,_0x1e84ea){_0x4cce3d=_0x4cce3d-0x0;var _0x39b6df=_0x1d1e[_0x4cce3d];return _0x39b6df;};'use strict';var _=require('lodash');var util=require(_0xe1d1('0x0'));var logger=require(_0xe1d1('0x1'))(_0xe1d1('0x2'));var moment=require('moment');var BPromise=require(_0xe1d1('0x3'));var rp=require(_0xe1d1('0x4'));var fs=require('fs');var path=require(_0xe1d1('0x5'));var rimraf=require(_0xe1d1('0x6'));var config=require(_0xe1d1('0x7'));var attributes=require(_0xe1d1('0x8'));module[_0xe1d1('0x9')]=function(_0xd8a4be,_0x2828fe){return _0xd8a4be[_0xe1d1('0xa')](_0xe1d1('0xb'),attributes,{'tableName':_0xe1d1('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe1d1('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 5509372..65fd5cc 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 _0x38ce=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x38ce,0xa7));var _0xe38c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38ce[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var moment=require(_0xe38c('0x2'));var BPromise=require(_0xe38c('0x3'));var rs=require(_0xe38c('0x4'));var fs=require('fs');var Redis=require(_0xe38c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe38c('0x6'));var logger=require(_0xe38c('0x7'))(_0xe38c('0x8'));var config=require(_0xe38c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5374d9,_0x5e87ca,_0x206260){return new BPromise(function(_0x4d1fe6,_0x33951b){return client[_0xe38c('0xa')](_0x5374d9,_0x206260)[_0xe38c('0xb')](function(_0x169e90){logger['info'](_0xe38c('0xc'),_0x5e87ca,_0xe38c('0xd'));logger[_0xe38c('0xe')](_0xe38c('0xf'),_0x5e87ca,_0xe38c('0xd'),JSON[_0xe38c('0x10')](_0x169e90));if(_0x169e90[_0xe38c('0x11')]){if(_0x169e90['error'][_0xe38c('0x12')]===0x1f4){logger[_0xe38c('0x11')](_0xe38c('0xc'),_0x5e87ca,_0x169e90[_0xe38c('0x11')][_0xe38c('0x13')]);return _0x33951b(_0x169e90[_0xe38c('0x11')][_0xe38c('0x13')]);}logger[_0xe38c('0x11')](_0xe38c('0xc'),_0x5e87ca,_0x169e90[_0xe38c('0x11')]['message']);return _0x4d1fe6(_0x169e90['error'][_0xe38c('0x13')]);}else{logger[_0xe38c('0x14')](_0xe38c('0xc'),_0x5e87ca,_0xe38c('0xd'));_0x4d1fe6(_0x169e90[_0xe38c('0x15')][_0xe38c('0x13')]);}})[_0xe38c('0x16')](function(_0x409f5f){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5e87ca,_0x409f5f);_0x33951b(_0x409f5f);});});}exports[_0xe38c('0x17')]=function(_0x1e2fb0){var _0x55b16d=this;return new Promise(function(_0x52386c,_0x206d9c){return db[_0xe38c('0x18')][_0xe38c('0x19')](_0x1e2fb0[_0xe38c('0x1a')],{'raw':_0x1e2fb0[_0xe38c('0x1b')]?_0x1e2fb0['options'][_0xe38c('0x1c')]===undefined?!![]:![]:!![]})[_0xe38c('0xb')](function(_0x437139){logger[_0xe38c('0x14')]('CreateVoiceDialReport',_0x1e2fb0);logger[_0xe38c('0xe')](_0xe38c('0x17'),_0x1e2fb0,JSON[_0xe38c('0x10')](_0x437139));_0x52386c(_0x437139);})['catch'](function(_0x2a261c){logger[_0xe38c('0x11')]('CreateVoiceDialReport',_0x2a261c['message'],_0x1e2fb0);_0x206d9c(_0x55b16d['error'](0x1f4,_0x2a261c[_0xe38c('0x13')]));});});};exports[_0xe38c('0x1d')]=function(_0x1c37d9){var _0x10aa5d=this;return new Promise(function(_0x477d67,_0xbccdf2){return db[_0xe38c('0x18')][_0xe38c('0x1e')](_0x1c37d9[_0xe38c('0x1a')],{'raw':_0x1c37d9[_0xe38c('0x1b')]?_0x1c37d9[_0xe38c('0x1b')][_0xe38c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c37d9[_0xe38c('0x1b')]?_0x1c37d9['options']['where']||null:null,'attributes':_0x1c37d9['options']?_0x1c37d9[_0xe38c('0x1b')][_0xe38c('0x1f')]||null:null,'limit':_0x1c37d9['options']?_0x1c37d9[_0xe38c('0x1b')][_0xe38c('0x20')]||null:null})['then'](function(_0x22671a){logger[_0xe38c('0x14')]('UpdateVoiceDialReport',_0x1c37d9);logger[_0xe38c('0xe')](_0xe38c('0x1d'),_0x1c37d9,JSON[_0xe38c('0x10')](_0x22671a));_0x477d67(_0x22671a);})[_0xe38c('0x16')](function(_0x4a89fa){logger[_0xe38c('0x11')]('UpdateVoiceDialReport',_0x4a89fa[_0xe38c('0x13')],_0x1c37d9);_0xbccdf2(_0x10aa5d[_0xe38c('0x11')](0x1f4,_0x4a89fa[_0xe38c('0x13')]));});});}; \ No newline at end of file +var _0xbba5=['client','http','then','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','body','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0xfc13ed,_0x4b17d9){var _0x5188bf=function(_0x54d5dd){while(--_0x54d5dd){_0xfc13ed['push'](_0xfc13ed['shift']());}};_0x5188bf(++_0x4b17d9);}(_0xbba5,0xe8));var _0x5bba=function(_0x24e210,_0xa3693c){_0x24e210=_0x24e210-0x0;var _0x46bb2c=_0xbba5[_0x24e210];return _0x46bb2c;};'use strict';var _=require(_0x5bba('0x0'));var util=require(_0x5bba('0x1'));var moment=require(_0x5bba('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bba('0x3'));var fs=require('fs');var Redis=require(_0x5bba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bba('0x5'));var logger=require(_0x5bba('0x6'))('rpc');var config=require(_0x5bba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5bba('0x8')][_0x5bba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59b261,_0x18ecdb,_0x37c152){return new BPromise(function(_0x4ba662,_0x1a78b7){return client['request'](_0x59b261,_0x37c152)[_0x5bba('0xa')](function(_0x53ef52){logger['info'](_0x5bba('0xb'),_0x18ecdb,'request\x20sent');logger['debug'](_0x5bba('0xc'),_0x18ecdb,_0x5bba('0xd'),JSON['stringify'](_0x53ef52));if(_0x53ef52['error']){if(_0x53ef52[_0x5bba('0xe')]['code']===0x1f4){logger[_0x5bba('0xe')](_0x5bba('0xb'),_0x18ecdb,_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);return _0x1a78b7(_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x18ecdb,_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);return _0x4ba662(_0x53ef52[_0x5bba('0xe')][_0x5bba('0xf')]);}else{logger[_0x5bba('0x10')](_0x5bba('0xb'),_0x18ecdb,_0x5bba('0xd'));_0x4ba662(_0x53ef52[_0x5bba('0x11')][_0x5bba('0xf')]);}})['catch'](function(_0x1c3cc9){logger[_0x5bba('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x18ecdb,_0x1c3cc9);_0x1a78b7(_0x1c3cc9);});});}exports[_0x5bba('0x12')]=function(_0x2a4c17){var _0x435028=this;return new Promise(function(_0x551cb7,_0x56f6ff){return db[_0x5bba('0x13')][_0x5bba('0x14')](_0x2a4c17['body'],{'raw':_0x2a4c17[_0x5bba('0x15')]?_0x2a4c17[_0x5bba('0x15')][_0x5bba('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xb886c){logger[_0x5bba('0x10')](_0x5bba('0x12'),_0x2a4c17);logger['debug']('CreateVoiceDialReport',_0x2a4c17,JSON[_0x5bba('0x17')](_0xb886c));_0x551cb7(_0xb886c);})[_0x5bba('0x18')](function(_0x44c5a1){logger[_0x5bba('0xe')]('CreateVoiceDialReport',_0x44c5a1[_0x5bba('0xf')],_0x2a4c17);_0x56f6ff(_0x435028[_0x5bba('0xe')](0x1f4,_0x44c5a1[_0x5bba('0xf')]));});});};exports[_0x5bba('0x19')]=function(_0x58f360){var _0x542ee8=this;return new Promise(function(_0x420fff,_0x58d695){return db['VoiceDialReport']['update'](_0x58f360[_0x5bba('0x1a')],{'raw':_0x58f360[_0x5bba('0x15')]?_0x58f360[_0x5bba('0x15')][_0x5bba('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f360[_0x5bba('0x15')]?_0x58f360['options'][_0x5bba('0x1b')]||null:null,'attributes':_0x58f360[_0x5bba('0x15')]?_0x58f360[_0x5bba('0x15')][_0x5bba('0x1c')]||null:null,'limit':_0x58f360[_0x5bba('0x15')]?_0x58f360['options']['limit']||null:null})[_0x5bba('0xa')](function(_0x36af79){logger['info'](_0x5bba('0x19'),_0x58f360);logger[_0x5bba('0x1d')](_0x5bba('0x19'),_0x58f360,JSON[_0x5bba('0x17')](_0x36af79));_0x420fff(_0x36af79);})['catch'](function(_0x45b594){logger[_0x5bba('0xe')](_0x5bba('0x19'),_0x45b594[_0x5bba('0xf')],_0x58f360);_0x58d695(_0x542ee8['error'](0x1f4,_0x45b594['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b2c7b1b..2c88e08 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 _0x9b34=['show','post','create','addApplications','put','update','delete','exports','multer','util','path','connect-timeout','express','get','isAuthenticated','/:id'];(function(_0x2e2a2b,_0x411307){var _0x47bbca=function(_0x47e9b4){while(--_0x47e9b4){_0x2e2a2b['push'](_0x2e2a2b['shift']());}};_0x47bbca(++_0x411307);}(_0x9b34,0x118));var _0x49b3=function(_0x4d3398,_0x3ec356){_0x4d3398=_0x4d3398-0x0;var _0x543649=_0x9b34[_0x4d3398];return _0x543649;};'use strict';var multer=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var path=require(_0x49b3('0x2'));var timeout=require(_0x49b3('0x3'));var express=require(_0x49b3('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('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x49b3('0x5')]('/',auth[_0x49b3('0x6')](),controller['index']);router[_0x49b3('0x5')](_0x49b3('0x7'),auth['isAuthenticated'](),controller[_0x49b3('0x8')]);router[_0x49b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x49b3('0xa')]);router[_0x49b3('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x49b3('0xb')]);router[_0x49b3('0xc')](_0x49b3('0x7'),auth[_0x49b3('0x6')](),controller[_0x49b3('0xd')]);router[_0x49b3('0xe')](_0x49b3('0x7'),auth[_0x49b3('0x6')](),controller['destroy']);module[_0x49b3('0xf')]=router; \ No newline at end of file +var _0xaac7=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','delete','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5704b9,_0x31e95a){var _0x447f98=function(_0x418d11){while(--_0x418d11){_0x5704b9['push'](_0x5704b9['shift']());}};_0x447f98(++_0x31e95a);}(_0xaac7,0x10a));var _0x7aac=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xaac7[_0x173f10];return _0x53142d;};'use strict';var multer=require(_0x7aac('0x0'));var util=require(_0x7aac('0x1'));var path=require(_0x7aac('0x2'));var timeout=require(_0x7aac('0x3'));var express=require(_0x7aac('0x4'));var router=express['Router']();var fs_extra=require(_0x7aac('0x5'));var auth=require(_0x7aac('0x6'));var interaction=require(_0x7aac('0x7'));var config=require(_0x7aac('0x8'));var controller=require(_0x7aac('0x9'));router[_0x7aac('0xa')]('/',auth[_0x7aac('0xb')](),controller[_0x7aac('0xc')]);router[_0x7aac('0xa')]('/:id',auth[_0x7aac('0xb')](),controller[_0x7aac('0xd')]);router[_0x7aac('0xe')]('/',auth[_0x7aac('0xb')](),controller['create']);router[_0x7aac('0xe')](_0x7aac('0xf'),auth[_0x7aac('0xb')](),controller[_0x7aac('0x10')]);router[_0x7aac('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7aac('0x12')](_0x7aac('0x13'),auth[_0x7aac('0xb')](),controller[_0x7aac('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7135c6e..c8a323d 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xcb91=['outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound'];(function(_0x249a17,_0x106e34){var _0x1b3952=function(_0x1b5a84){while(--_0x1b5a84){_0x249a17['push'](_0x249a17['shift']());}};_0x1b3952(++_0x106e34);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xcb91[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x1cb9('0x1')},'tag':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x2')},'appdata':{'type':Sequelize[_0x1cb9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1cb9('0x3'),_0x1cb9('0x4'),'internal',_0x1cb9('0x5'),_0x1cb9('0x6'),'system',_0x1cb9('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x8')},'IntervalId':{'type':Sequelize[_0x1cb9('0x9')]},'isApp':{'type':Sequelize[_0x1cb9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1cb9('0x9')]},'recordingFormat':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':_0x1cb9('0xb')},'answer':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1cb9('0xc')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0148107..3eafd2e 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 _0x555e=['finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','type','name','UserProfileResource','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','startsWith','exten','body','create','get','role','inbound','UserProfileSection','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','cast(priority\x20as\x20unsigned)'];(function(_0x1440ce,_0x136aee){var _0x389c35=function(_0x73dfaf){while(--_0x73dfaf){_0x1440ce['push'](_0x1440ce['shift']());}};_0x389c35(++_0x136aee);}(_0x555e,0x1c3));var _0xe555=function(_0x2f418e,_0x16a528){_0x2f418e=_0x2f418e-0x0;var _0x325dde=_0x555e[_0x2f418e];return _0x325dde;};'use strict';var _=require(_0xe555('0x0'));var Redis=require(_0xe555('0x1'));var qs=require(_0xe555('0x2'));var logger=require(_0xe555('0x3'))('api');var config=require(_0xe555('0x4'));var db=require(_0xe555('0x5'))['db'];config[_0xe555('0x6')]=_[_0xe555('0x7')](config[_0xe555('0x6')],{'host':_0xe555('0x8'),'port':0x18eb});var socket=require(_0xe555('0x9'))(new Redis(config['redis']));require(_0xe555('0xa'))[_0xe555('0xb')](socket);function respondWithStatusCode(_0x13e07e,_0x6c1fa9){_0x6c1fa9=_0x6c1fa9||0xcc;return function(_0x5ee547){if(_0x5ee547){return _0x13e07e[_0xe555('0xc')](_0x6c1fa9);}return _0x13e07e[_0xe555('0xd')](_0x6c1fa9)[_0xe555('0xe')]();};}function respondWithResult(_0x52ca6d,_0x2316bd){_0x2316bd=_0x2316bd||0xc8;return function(_0x1692ef){if(_0x1692ef){return _0x52ca6d[_0xe555('0xd')](_0x2316bd)[_0xe555('0xf')](_0x1692ef);}};}function respondWithFilteredResult(_0x72b7c3,_0x474679){return function(_0x396a4c){if(_0x396a4c){var _0xa3e3da=typeof _0x474679[_0xe555('0x10')]===_0xe555('0x11')&&typeof _0x474679[_0xe555('0x12')]==='undefined';var _0x4dbc41=_0x396a4c[_0xe555('0x13')];var _0x3bf3aa=_0xa3e3da?0x0:_0x474679[_0xe555('0x10')];var _0x24c6e3=_0xa3e3da?_0x396a4c[_0xe555('0x13')]:_0x474679['offset']+_0x474679[_0xe555('0x12')];var _0x5f1113;if(_0x24c6e3>=_0x4dbc41){_0x24c6e3=_0x4dbc41;_0x5f1113=0xc8;}else{_0x5f1113=0xce;}_0x72b7c3[_0xe555('0xd')](_0x5f1113);return _0x72b7c3[_0xe555('0x14')]('Content-Range',_0x3bf3aa+'-'+_0x24c6e3+'/'+_0x4dbc41)['json'](_0x396a4c);}return null;};}function removeEntity(_0x3e6f56){return function(_0x19ca7f){if(_0x19ca7f){return _0x19ca7f[_0xe555('0x15')]()[_0xe555('0x16')](function(){var _0x5d2366=_0x19ca7f['get']({'plain':!![]});var _0x4f548a=[{'name':_0xe555('0x17'),'value':'inbound','ignore':![]},{'name':_0xe555('0x18'),'value':_0xe555('0x19'),'ignore':![]},{'name':_0xe555('0x1a'),'value':_0xe555('0x1b'),'ignore':![]}];var _0x3ac440=_(_0x4f548a)['filter']('ignore')[_0xe555('0x1c')](_0xe555('0x1d'))[_0xe555('0x1d')]();if(_[_0xe555('0x1e')](_0x3ac440,_0x5d2366[_0xe555('0x1f')])){return;}var _0xc57430=_['find'](_0x4f548a,[_0xe555('0x1d'),_0x5d2366[_0xe555('0x1f')]])[_0xe555('0x20')];return db[_0xe555('0x21')][_0xe555('0x15')]({'where':{'type':_0xc57430,'resourceId':_0x5d2366['id']}})[_0xe555('0x16')](function(){return _0x19ca7f;});})['then'](function(){_0x3e6f56[_0xe555('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484984){return function(_0x280e8d){if(!_0x280e8d){_0x484984[_0xe555('0xc')](0x194);}return _0x280e8d;};}function handleError(_0x1b7cc6,_0x5b4d7a){_0x5b4d7a=_0x5b4d7a||0x1f4;return function(_0x583d0d){logger[_0xe555('0x22')](_0x583d0d[_0xe555('0x23')]);if(_0x583d0d[_0xe555('0x20')]){delete _0x583d0d[_0xe555('0x20')];}_0x1b7cc6[_0xe555('0xd')](_0x5b4d7a)[_0xe555('0x24')](_0x583d0d);};}exports['index']=function(_0x25427b,_0x3f8528){var _0xab2d53={},_0x417c9e={},_0x317727={'count':0x0,'rows':[]};var _0x795b4b=_['map'](db[_0xe555('0x25')][_0xe555('0x26')],function(_0x40b494){return{'name':_0x40b494[_0xe555('0x27')],'type':_0x40b494[_0xe555('0x1f')][_0xe555('0x28')]};});_0x417c9e[_0xe555('0x29')]=_[_0xe555('0x1c')](_0x795b4b,'name');_0x417c9e[_0xe555('0x2a')]=_[_0xe555('0x2b')](_0x25427b[_0xe555('0x2a')]);_0x417c9e[_0xe555('0x2c')]=_[_0xe555('0x2d')](_0x417c9e[_0xe555('0x29')],_0x417c9e[_0xe555('0x2a')]);_0xab2d53[_0xe555('0x2e')]=_['intersection'](_0x417c9e[_0xe555('0x29')],qs['fields'](_0x25427b[_0xe555('0x2a')][_0xe555('0x2f')]));_0xab2d53[_0xe555('0x2e')]=_0xab2d53[_0xe555('0x2e')]['length']?_0xab2d53[_0xe555('0x2e')]:_0x417c9e[_0xe555('0x29')];if(!_0x25427b['query'][_0xe555('0x30')](_0xe555('0x31'))){_0xab2d53[_0xe555('0x12')]=qs['limit'](_0x25427b[_0xe555('0x2a')][_0xe555('0x12')]);_0xab2d53[_0xe555('0x10')]=qs[_0xe555('0x10')](_0x25427b[_0xe555('0x2a')][_0xe555('0x10')]);}_0xab2d53[_0xe555('0x32')]=qs['sort'](_0x25427b[_0xe555('0x2a')][_0xe555('0x33')]);_0xab2d53[_0xe555('0x34')]=qs[_0xe555('0x2c')](_[_0xe555('0x35')](_0x25427b[_0xe555('0x2a')],_0x417c9e[_0xe555('0x2c')]),_0x795b4b);if(_0x25427b['query'][_0xe555('0x36')]){_0xab2d53[_0xe555('0x34')]=_[_0xe555('0x37')](_0xab2d53[_0xe555('0x34')],{'$or':_[_0xe555('0x1c')](_0x795b4b,function(_0x3bf9f1){if(_0x3bf9f1[_0xe555('0x1f')]!==_0xe555('0x38')){var _0x4112a8={};_0x4112a8[_0x3bf9f1[_0xe555('0x20')]]={'$like':'%'+_0x25427b[_0xe555('0x2a')]['filter']+'%'};return _0x4112a8;}})});}_0xab2d53=_['merge']({},_0xab2d53,_0x25427b[_0xe555('0x39')]);var _0x38b159={'where':_0xab2d53[_0xe555('0x34')]};return db[_0xe555('0x25')][_0xe555('0x13')](_0x38b159)[_0xe555('0x16')](function(_0x568306){_0x317727[_0xe555('0x13')]=_0x568306;if(_0x25427b[_0xe555('0x2a')][_0xe555('0x3a')]){_0xab2d53[_0xe555('0x3b')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0xab2d53);})[_0xe555('0x16')](function(_0x400c6b){_0x317727[_0xe555('0x3c')]=_0x400c6b;return _0x317727;})[_0xe555('0x16')](respondWithFilteredResult(_0x3f8528,_0xab2d53))[_0xe555('0x3d')](handleError(_0x3f8528,null));};exports[_0xe555('0x3e')]=function(_0x281e7c,_0x5854db){var _0x481ee4={'raw':![],'where':{'id':_0x281e7c[_0xe555('0x3f')]['id']}},_0xd7fce3={};_0xd7fce3[_0xe555('0x29')]=_['keys'](db[_0xe555('0x25')][_0xe555('0x26')]);_0xd7fce3[_0xe555('0x2a')]=_[_0xe555('0x2b')](_0x281e7c['query']);_0xd7fce3['filters']=_[_0xe555('0x2d')](_0xd7fce3[_0xe555('0x29')],_0xd7fce3['query']);_0x481ee4[_0xe555('0x2e')]=_[_0xe555('0x2d')](_0xd7fce3['model'],qs['fields'](_0x281e7c[_0xe555('0x2a')][_0xe555('0x2f')]));_0x481ee4[_0xe555('0x2e')]=_0x481ee4[_0xe555('0x2e')]['length']?_0x481ee4[_0xe555('0x2e')]:_0xd7fce3[_0xe555('0x29')];if(_0x281e7c[_0xe555('0x2a')][_0xe555('0x3a')]){_0x481ee4[_0xe555('0x3b')]=[{'all':!![]}];}_0x481ee4=_[_0xe555('0x37')]({},_0x481ee4,_0x281e7c['options']);return db[_0xe555('0x25')][_0xe555('0x40')](_0x481ee4)['then'](handleEntityNotFound(_0x5854db,null))[_0xe555('0x16')](respondWithResult(_0x5854db,null))['catch'](handleError(_0x5854db,null));};exports[_0xe555('0x15')]=function(_0x3c4715,_0x510b56){return db[_0xe555('0x25')][_0xe555('0x40')]({'where':{'id':_0x3c4715[_0xe555('0x3f')]['id']}})['then'](handleEntityNotFound(_0x510b56,null))[_0xe555('0x16')](removeEntity(_0x510b56,null))[_0xe555('0x3d')](handleError(_0x510b56,null));};exports['create']=function(_0x3ea0a7,_0x34c85d){if(_0x3ea0a7['body']['type']===_0xe555('0x19')&&!_[_0xe555('0x41')](_0x3ea0a7['body'][_0xe555('0x42')],'_')){_0x3ea0a7[_0xe555('0x43')][_0xe555('0x42')]='_'['concat'](_0x3ea0a7[_0xe555('0x43')]['exten']);}return db[_0xe555('0x25')][_0xe555('0x44')](_0x3ea0a7[_0xe555('0x43')],{'raw':![]})[_0xe555('0x16')](function(_0x169482){var _0x28c366=_0x3ea0a7['user'][_0xe555('0x45')]({'plain':!![]});if(!_0x28c366)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28c366[_0xe555('0x46')]==='user'){var _0x106b4e=_0x169482[_0xe555('0x45')]({'plain':!![]});var _0x3555f5=[{'name':_0xe555('0x17'),'value':_0xe555('0x47')},{'name':_0xe555('0x18'),'value':_0xe555('0x19')},{'name':_0xe555('0x1a'),'value':_0xe555('0x1b')}];var _0x5b9bfb=_[_0xe555('0x40')](_0x3555f5,[_0xe555('0x1d'),_0x106b4e[_0xe555('0x1f')]])[_0xe555('0x20')];return db[_0xe555('0x48')]['find']({'where':{'name':_0x5b9bfb,'userProfileId':_0x28c366[_0xe555('0x49')]},'raw':!![]})[_0xe555('0x16')](function(_0x29dcc8){if(_0x29dcc8&&_0x29dcc8[_0xe555('0x4a')]===0x0){return db[_0xe555('0x21')][_0xe555('0x44')]({'name':_0x106b4e[_0xe555('0x20')],'resourceId':_0x106b4e['id'],'type':_0x29dcc8[_0xe555('0x20')],'sectionId':_0x29dcc8['id']},{})[_0xe555('0x16')](function(){return _0x169482;});}else{return _0x169482;}})[_0xe555('0x3d')](function(_0x3bcce7){logger[_0xe555('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcce7);throw _0x3bcce7;});}return _0x169482;})[_0xe555('0x16')](respondWithResult(_0x34c85d,0xc9))[_0xe555('0x3d')](handleError(_0x34c85d,null));};exports[_0xe555('0x4b')]=function(_0x3850a2,_0x483fa8){if(_0x3850a2[_0xe555('0x43')]['id']){delete _0x3850a2[_0xe555('0x43')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3850a2['params']['id']}})[_0xe555('0x16')](handleEntityNotFound(_0x483fa8,null))[_0xe555('0x16')](function(_0x45e9ee){if(_0x45e9ee){return db['VoiceExtension'][_0xe555('0x4b')](_[_0xe555('0x35')](_0x3850a2[_0xe555('0x43')],[_0xe555('0x42'),_0xe555('0x4c'),_0xe555('0x4d'),_0xe555('0x4e'),_0xe555('0x4f'),_0xe555('0x50'),_0xe555('0x51')]),{'where':{'context':_0x45e9ee[_0xe555('0x4c')],'exten':_0x45e9ee[_0xe555('0x42')]},'individualHooks':!![]})[_0xe555('0x16')](function(_0x229ce6){return _0x229ce6;});}return null;})[_0xe555('0x16')](respondWithStatusCode(_0x483fa8,null))['catch'](handleError(_0x483fa8,null));};exports['addApplications']=function(_0x13ce3d,_0xf69bfc){var _0x2af67c=_0x13ce3d[_0xe555('0x3f')]['id'];var _0x2a664e=_0x13ce3d['body'];var _0x31e8d2=0xc8;var _0x3e47c3=null;return db[_0xe555('0x52')][_0xe555('0x53')]({'isolationLevel':db[_0xe555('0x52')][_0xe555('0x54')]['ISOLATION_LEVELS'][_0xe555('0x55')]},function(_0xa60aa9){return db['VoiceExtension']['findOne']({'where':{'id':_0x2af67c},'transaction':_0xa60aa9})[_0xe555('0x16')](function(_0x5dec26){if(_0x5dec26){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x2af67c},'transaction':_0xa60aa9})[_0xe555('0x16')](function(){var _0x79531e=_[_0xe555('0x1c')](_0x2a664e,function(_0x1469a9){_0x1469a9[_0xe555('0x56')]=_0x2af67c;_0x1469a9[_0xe555('0x57')]=!![];return _0x1469a9;});return _0x5dec26['createRouting'](_0x79531e);})[_0xe555('0x16')](function(_0x2d2f62){return db[_0xe555('0x25')]['bulkCreate'](_0x2d2f62,{'transaction':_0xa60aa9});});}else{_0x31e8d2=0x194;_0x3e47c3=[];}});})[_0xe555('0x16')](function(){if(_0x31e8d2!==0x194){return db[_0xe555('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2af67c},'order':_0xe555('0x58')})[_0xe555('0x16')](function(_0x31fa9d){_0x3e47c3=_0x31fa9d;});}})['catch'](function(_0x12ad39){_0x31e8d2=0x1f4;logger['error'](_0x12ad39[_0xe555('0x23')]);if(_0x12ad39[_0xe555('0x20')]){delete _0x12ad39[_0xe555('0x20')];}_0x3e47c3=_0x12ad39;})[_0xe555('0x59')](function(){if(_0x3e47c3===null){_0xf69bfc[_0xe555('0xc')](_0x31e8d2);}else{if(_0x31e8d2===0x1f4){_0xf69bfc[_0xe555('0xd')](_0x31e8d2)[_0xe555('0x24')](_0x3e47c3);}else{_0xf69bfc[_0xe555('0xd')](_0x31e8d2)['json'](_0x3e47c3);}}});}; \ No newline at end of file +var _0x5781=['findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','type','find','name','then','error','stack','send','index','VoiceExtension','rawAttributes','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','destroy','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','value','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate'];(function(_0x1815de,_0x7f309f){var _0x2a8e84=function(_0x134f7b){while(--_0x134f7b){_0x1815de['push'](_0x1815de['shift']());}};_0x2a8e84(++_0x7f309f);}(_0x5781,0x1d9));var _0x1578=function(_0x2bd994,_0x37e8cd){_0x2bd994=_0x2bd994-0x0;var _0x4b3ebf=_0x5781[_0x2bd994];return _0x4b3ebf;};'use strict';var _=require('lodash');var Redis=require(_0x1578('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x1578('0x1'))(_0x1578('0x2'));var config=require(_0x1578('0x3'));var db=require(_0x1578('0x4'))['db'];config[_0x1578('0x5')]=_[_0x1578('0x6')](config['redis'],{'host':_0x1578('0x7'),'port':0x18eb});var socket=require(_0x1578('0x8'))(new Redis(config[_0x1578('0x5')]));require(_0x1578('0x9'))[_0x1578('0xa')](socket);function respondWithStatusCode(_0x37ed63,_0x5d8e77){_0x5d8e77=_0x5d8e77||0xcc;return function(_0x1693d1){if(_0x1693d1){return _0x37ed63[_0x1578('0xb')](_0x5d8e77);}return _0x37ed63[_0x1578('0xc')](_0x5d8e77)[_0x1578('0xd')]();};}function respondWithResult(_0x441b7a,_0x3f5f47){_0x3f5f47=_0x3f5f47||0xc8;return function(_0x389184){if(_0x389184){return _0x441b7a[_0x1578('0xc')](_0x3f5f47)[_0x1578('0xe')](_0x389184);}};}function respondWithFilteredResult(_0x79d670,_0x8b559f){return function(_0x687485){if(_0x687485){var _0x26d658=typeof _0x8b559f[_0x1578('0xf')]===_0x1578('0x10')&&typeof _0x8b559f[_0x1578('0x11')]===_0x1578('0x10');var _0x352448=_0x687485[_0x1578('0x12')];var _0x59c024=_0x26d658?0x0:_0x8b559f['offset'];var _0x5bd003=_0x26d658?_0x687485[_0x1578('0x12')]:_0x8b559f[_0x1578('0xf')]+_0x8b559f[_0x1578('0x11')];var _0x5a6f96;if(_0x5bd003>=_0x352448){_0x5bd003=_0x352448;_0x5a6f96=0xc8;}else{_0x5a6f96=0xce;}_0x79d670['status'](_0x5a6f96);return _0x79d670['set']('Content-Range',_0x59c024+'-'+_0x5bd003+'/'+_0x352448)[_0x1578('0xe')](_0x687485);}return null;};}function removeEntity(_0x2c9889){return function(_0x42b84f){if(_0x42b84f){return _0x42b84f['destroy']()['then'](function(){var _0x2a97c7=_0x42b84f[_0x1578('0x13')]({'plain':!![]});var _0x263857=[{'name':'InboundRoutes','value':_0x1578('0x14'),'ignore':![]},{'name':_0x1578('0x15'),'value':_0x1578('0x16'),'ignore':![]},{'name':_0x1578('0x17'),'value':_0x1578('0x18'),'ignore':![]}];var _0x39159c=_(_0x263857)[_0x1578('0x19')](_0x1578('0x1a'))[_0x1578('0x1b')]('value')['value']();if(_['includes'](_0x39159c,_0x2a97c7[_0x1578('0x1c')])){return;}var _0x4ed603=_[_0x1578('0x1d')](_0x263857,['value',_0x2a97c7[_0x1578('0x1c')]])[_0x1578('0x1e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4ed603,'resourceId':_0x2a97c7['id']}})[_0x1578('0x1f')](function(){return _0x42b84f;});})[_0x1578('0x1f')](function(){_0x2c9889['status'](0xcc)[_0x1578('0xd')]();});}};}function handleEntityNotFound(_0x5e0c23){return function(_0x478bfc){if(!_0x478bfc){_0x5e0c23['sendStatus'](0x194);}return _0x478bfc;};}function handleError(_0x495842,_0x4ac1a6){_0x4ac1a6=_0x4ac1a6||0x1f4;return function(_0x4d0358){logger[_0x1578('0x20')](_0x4d0358[_0x1578('0x21')]);if(_0x4d0358[_0x1578('0x1e')]){delete _0x4d0358['name'];}_0x495842[_0x1578('0xc')](_0x4ac1a6)[_0x1578('0x22')](_0x4d0358);};}exports[_0x1578('0x23')]=function(_0x5c872e,_0x327731){var _0x41f178={},_0x4600a9={},_0x513c82={'count':0x0,'rows':[]};var _0x59a1c3=_[_0x1578('0x1b')](db[_0x1578('0x24')][_0x1578('0x25')],function(_0x1fb25f){return{'name':_0x1fb25f['fieldName'],'type':_0x1fb25f[_0x1578('0x1c')]['key']};});_0x4600a9[_0x1578('0x26')]=_[_0x1578('0x1b')](_0x59a1c3,'name');_0x4600a9['query']=_[_0x1578('0x27')](_0x5c872e[_0x1578('0x28')]);_0x4600a9[_0x1578('0x29')]=_[_0x1578('0x2a')](_0x4600a9[_0x1578('0x26')],_0x4600a9[_0x1578('0x28')]);_0x41f178['attributes']=_[_0x1578('0x2a')](_0x4600a9['model'],qs[_0x1578('0x2b')](_0x5c872e[_0x1578('0x28')][_0x1578('0x2b')]));_0x41f178['attributes']=_0x41f178['attributes'][_0x1578('0x2c')]?_0x41f178[_0x1578('0x2d')]:_0x4600a9[_0x1578('0x26')];if(!_0x5c872e['query'][_0x1578('0x2e')](_0x1578('0x2f'))){_0x41f178[_0x1578('0x11')]=qs[_0x1578('0x11')](_0x5c872e[_0x1578('0x28')][_0x1578('0x11')]);_0x41f178['offset']=qs[_0x1578('0xf')](_0x5c872e[_0x1578('0x28')][_0x1578('0xf')]);}_0x41f178[_0x1578('0x30')]=qs[_0x1578('0x31')](_0x5c872e[_0x1578('0x28')][_0x1578('0x31')]);_0x41f178[_0x1578('0x32')]=qs[_0x1578('0x29')](_[_0x1578('0x33')](_0x5c872e[_0x1578('0x28')],_0x4600a9[_0x1578('0x29')]),_0x59a1c3);if(_0x5c872e[_0x1578('0x28')][_0x1578('0x19')]){_0x41f178['where']=_['merge'](_0x41f178[_0x1578('0x32')],{'$or':_[_0x1578('0x1b')](_0x59a1c3,function(_0x1cb4fc){if(_0x1cb4fc[_0x1578('0x1c')]!==_0x1578('0x34')){var _0x447435={};_0x447435[_0x1cb4fc[_0x1578('0x1e')]]={'$like':'%'+_0x5c872e[_0x1578('0x28')]['filter']+'%'};return _0x447435;}})});}_0x41f178=_['merge']({},_0x41f178,_0x5c872e[_0x1578('0x35')]);var _0x1278d0={'where':_0x41f178[_0x1578('0x32')]};return db[_0x1578('0x24')][_0x1578('0x12')](_0x1278d0)[_0x1578('0x1f')](function(_0xd01f12){_0x513c82['count']=_0xd01f12;if(_0x5c872e[_0x1578('0x28')]['includeAll']){_0x41f178[_0x1578('0x36')]=[{'all':!![]}];}return db[_0x1578('0x24')][_0x1578('0x37')](_0x41f178);})['then'](function(_0x9fbcc3){_0x513c82[_0x1578('0x38')]=_0x9fbcc3;return _0x513c82;})['then'](respondWithFilteredResult(_0x327731,_0x41f178))['catch'](handleError(_0x327731,null));};exports[_0x1578('0x39')]=function(_0x21c131,_0x15415d){var _0x5ba47a={'raw':![],'where':{'id':_0x21c131[_0x1578('0x3a')]['id']}},_0x1146a9={};_0x1146a9['model']=_[_0x1578('0x27')](db[_0x1578('0x24')][_0x1578('0x25')]);_0x1146a9[_0x1578('0x28')]=_[_0x1578('0x27')](_0x21c131[_0x1578('0x28')]);_0x1146a9[_0x1578('0x29')]=_[_0x1578('0x2a')](_0x1146a9[_0x1578('0x26')],_0x1146a9[_0x1578('0x28')]);_0x5ba47a[_0x1578('0x2d')]=_[_0x1578('0x2a')](_0x1146a9['model'],qs[_0x1578('0x2b')](_0x21c131['query'][_0x1578('0x2b')]));_0x5ba47a[_0x1578('0x2d')]=_0x5ba47a['attributes'][_0x1578('0x2c')]?_0x5ba47a[_0x1578('0x2d')]:_0x1146a9[_0x1578('0x26')];if(_0x21c131[_0x1578('0x28')][_0x1578('0x3b')]){_0x5ba47a[_0x1578('0x36')]=[{'all':!![]}];}_0x5ba47a=_['merge']({},_0x5ba47a,_0x21c131['options']);return db[_0x1578('0x24')][_0x1578('0x1d')](_0x5ba47a)['then'](handleEntityNotFound(_0x15415d,null))['then'](respondWithResult(_0x15415d,null))[_0x1578('0x3c')](handleError(_0x15415d,null));};exports[_0x1578('0x3d')]=function(_0x2c9ea8,_0x487f95){return db['VoiceExtension'][_0x1578('0x1d')]({'where':{'id':_0x2c9ea8[_0x1578('0x3a')]['id']}})['then'](handleEntityNotFound(_0x487f95,null))[_0x1578('0x1f')](removeEntity(_0x487f95,null))[_0x1578('0x3c')](handleError(_0x487f95,null));};exports[_0x1578('0x3e')]=function(_0x50bf15,_0x259c32){if(_0x50bf15[_0x1578('0x3f')][_0x1578('0x1c')]===_0x1578('0x16')&&!_[_0x1578('0x40')](_0x50bf15[_0x1578('0x3f')]['exten'],'_')){_0x50bf15[_0x1578('0x3f')][_0x1578('0x41')]='_'[_0x1578('0x42')](_0x50bf15[_0x1578('0x3f')][_0x1578('0x41')]);}return db[_0x1578('0x24')][_0x1578('0x3e')](_0x50bf15['body'],{'raw':![]})['then'](function(_0x54ff34){var _0xf793ac=_0x50bf15[_0x1578('0x43')][_0x1578('0x13')]({'plain':!![]});if(!_0xf793ac)throw new Error(_0x1578('0x44'));if(_0xf793ac['role']==='user'){var _0x4586c8=_0x54ff34['get']({'plain':!![]});var _0x176170=[{'name':_0x1578('0x45'),'value':_0x1578('0x14')},{'name':_0x1578('0x15'),'value':_0x1578('0x16')},{'name':_0x1578('0x17'),'value':'internal'}];var _0xa40290=_['find'](_0x176170,[_0x1578('0x46'),_0x4586c8['type']])[_0x1578('0x1e')];return db[_0x1578('0x47')][_0x1578('0x1d')]({'where':{'name':_0xa40290,'userProfileId':_0xf793ac[_0x1578('0x48')]},'raw':!![]})['then'](function(_0x2b56a0){if(_0x2b56a0&&_0x2b56a0[_0x1578('0x49')]===0x0){return db[_0x1578('0x4a')][_0x1578('0x3e')]({'name':_0x4586c8[_0x1578('0x1e')],'resourceId':_0x4586c8['id'],'type':_0x2b56a0['name'],'sectionId':_0x2b56a0['id']},{})[_0x1578('0x1f')](function(){return _0x54ff34;});}else{return _0x54ff34;}})[_0x1578('0x3c')](function(_0xc08176){logger[_0x1578('0x20')](_0x1578('0x4b'),_0xc08176);throw _0xc08176;});}return _0x54ff34;})[_0x1578('0x1f')](respondWithResult(_0x259c32,0xc9))[_0x1578('0x3c')](handleError(_0x259c32,null));};exports[_0x1578('0x4c')]=function(_0x32a032,_0x43a40d){if(_0x32a032[_0x1578('0x3f')]['id']){delete _0x32a032[_0x1578('0x3f')]['id'];}return db[_0x1578('0x24')][_0x1578('0x1d')]({'where':{'id':_0x32a032['params']['id']}})[_0x1578('0x1f')](handleEntityNotFound(_0x43a40d,null))['then'](function(_0x3235b1){if(_0x3235b1){return db[_0x1578('0x24')]['update'](_[_0x1578('0x33')](_0x32a032['body'],[_0x1578('0x41'),_0x1578('0x4d'),_0x1578('0x4e'),_0x1578('0x4f'),_0x1578('0x50'),'mandatoryDisposition',_0x1578('0x51')]),{'where':{'context':_0x3235b1[_0x1578('0x4d')],'exten':_0x3235b1[_0x1578('0x41')]},'individualHooks':!![]})[_0x1578('0x1f')](function(_0x12ce2f){return _0x12ce2f;});}return null;})[_0x1578('0x1f')](respondWithStatusCode(_0x43a40d,null))[_0x1578('0x3c')](handleError(_0x43a40d,null));};exports[_0x1578('0x52')]=function(_0x4d1463,_0x154576){var _0x518e20=_0x4d1463['params']['id'];var _0x24fae5=_0x4d1463[_0x1578('0x3f')];var _0xb31b9e=0xc8;var _0x458ea8=null;return db[_0x1578('0x53')][_0x1578('0x54')]({'isolationLevel':db[_0x1578('0x53')][_0x1578('0x55')][_0x1578('0x56')][_0x1578('0x57')]},function(_0x3ac81){return db[_0x1578('0x24')]['findOne']({'where':{'id':_0x518e20},'transaction':_0x3ac81})[_0x1578('0x1f')](function(_0x332da2){if(_0x332da2){return db[_0x1578('0x24')][_0x1578('0x3d')]({'where':{'VoiceExtensionId':_0x518e20},'transaction':_0x3ac81})[_0x1578('0x1f')](function(){var _0x2e9fd4=_[_0x1578('0x1b')](_0x24fae5,function(_0x2e8df2){_0x2e8df2['VoiceExtensionId']=_0x518e20;_0x2e8df2[_0x1578('0x58')]=!![];return _0x2e8df2;});return _0x332da2[_0x1578('0x59')](_0x2e9fd4);})['then'](function(_0x52ddde){return db[_0x1578('0x24')][_0x1578('0x5a')](_0x52ddde,{'transaction':_0x3ac81});});}else{_0xb31b9e=0x194;_0x458ea8=[];}});})[_0x1578('0x1f')](function(){if(_0xb31b9e!==0x194){return db[_0x1578('0x24')][_0x1578('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x518e20},'order':_0x1578('0x5c')})[_0x1578('0x1f')](function(_0xf6d6af){_0x458ea8=_0xf6d6af;});}})['catch'](function(_0x31420e){_0xb31b9e=0x1f4;logger[_0x1578('0x20')](_0x31420e['stack']);if(_0x31420e[_0x1578('0x1e')]){delete _0x31420e[_0x1578('0x1e')];}_0x458ea8=_0x31420e;})[_0x1578('0x5d')](function(){if(_0x458ea8===null){_0x154576[_0x1578('0xb')](_0xb31b9e);}else{if(_0xb31b9e===0x1f4){_0x154576[_0x1578('0xc')](_0xb31b9e)['send'](_0x458ea8);}else{_0x154576[_0x1578('0xc')](_0xb31b9e)['json'](_0x458ea8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3280ad5..6ada3fd 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 _0x72c6=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','update','emit'];(function(_0x577b83,_0x13d6aa){var _0x53731b=function(_0x35cd12){while(--_0x35cd12){_0x577b83['push'](_0x577b83['shift']());}};_0x53731b(++_0x13d6aa);}(_0x72c6,0x6a));var _0x672c=function(_0x543f81,_0x348817){_0x543f81=_0x543f81-0x0;var _0x181efd=_0x72c6[_0x543f81];return _0x181efd;};'use strict';var EventEmitter=require(_0x672c('0x0'));var VoiceExtension=require(_0x672c('0x1'))['db'][_0x672c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x672c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x672c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49d025){return function(_0x300244,_0x3174dc,_0x10aecf){VoiceExtensionEvents['emit'](_0x49d025+':'+_0x300244['id'],_0x300244);VoiceExtensionEvents[_0x672c('0x5')](_0x49d025,_0x300244);_0x10aecf(null);};}for(var e in events){if(events[_0x672c('0x6')](e)){var event=events[e];VoiceExtension[_0x672c('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x3764=['update','emit','hook','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x40e5fd,_0x4e1c90){var _0x3fbd71=function(_0x3abdff){while(--_0x3abdff){_0x40e5fd['push'](_0x40e5fd['shift']());}};_0x3fbd71(++_0x4e1c90);}(_0x3764,0x1a7));var _0x4376=function(_0x3de123,_0x227df9){_0x3de123=_0x3de123-0x0;var _0x583817=_0x3764[_0x3de123];return _0x583817;};'use strict';var EventEmitter=require(_0x4376('0x0'));var VoiceExtension=require(_0x4376('0x1'))['db'][_0x4376('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4376('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4376('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17a7cb){return function(_0x567e69,_0x51bec6,_0xc377ef){VoiceExtensionEvents['emit'](_0x17a7cb+':'+_0x567e69['id'],_0x567e69);VoiceExtensionEvents[_0x4376('0x5')](_0x17a7cb,_0x567e69);_0xc377ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x4376('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c731785..12a8977 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 _0xe6d5=['VoiceExtension','voice_extensions','get','concat','exports','models','type','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','name','param','prefix','phone','SIP','join','none','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define'];(function(_0xc0087f,_0x2b3dfb){var _0x3e59b4=function(_0xfe519){while(--_0xfe519){_0xc0087f['push'](_0xc0087f['shift']());}};_0x3e59b4(++_0x2b3dfb);}(_0xe6d5,0x1de));var _0x5e6d=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0xe6d5[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x5e6d('0x0')]=function(_0x2296b4){var _0x2a4c5b=_0x2296b4[_0x5e6d('0x1')];function _0xb7f466(_0x1a5cb3){var _0x2275a6=0x2;var _0x25340d=[{'type':_0x1a5cb3[_0x5e6d('0x2')],'app':'Set','appdata':'CDR(type)='+_0x1a5cb3['type'],'context':_0x1a5cb3[_0x5e6d('0x3')],'exten':_0x1a5cb3[_0x5e6d('0x4')],'priority':_0x2275a6++,'VoiceExtensionId':_0x1a5cb3['id']}];if(_0x1a5cb3['type']===_0x5e6d('0x5')){_0x25340d[_0x5e6d('0x6')]({'type':'inbound','app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x8')+_0x1a5cb3['id'],'context':_0x1a5cb3[_0x5e6d('0x3')],'exten':_0x1a5cb3[_0x5e6d('0x4')],'priority':_0x2275a6++,'VoiceExtensionId':_0x1a5cb3['id']});}_0x25340d[_0x5e6d('0x6')]({'type':_0x1a5cb3['type'],'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x9'),'context':_0x1a5cb3[_0x5e6d('0x3')],'exten':_0x1a5cb3[_0x5e6d('0x4')],'priority':_0x2275a6++,'VoiceExtensionId':_0x1a5cb3['id']},{'type':_0x1a5cb3['type'],'app':_0x5e6d('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1a5cb3[_0x5e6d('0x3')],'exten':_0x1a5cb3['exten'],'priority':_0x2275a6++,'VoiceExtensionId':_0x1a5cb3['id']},{'type':_0x1a5cb3[_0x5e6d('0x2')],'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0xa'),'context':_0x1a5cb3[_0x5e6d('0x3')],'exten':_0x1a5cb3[_0x5e6d('0x4')],'priority':_0x2275a6++,'VoiceExtensionId':_0x1a5cb3['id']});return _0x25340d;}function _0x39bdc9(_0x4d35ff){var _0x303675=0x2;var _0x1c629c=[{'type':'outbound','app':_0x5e6d('0x7'),'appdata':_0x5e6d('0xb'),'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0xd')+(_0x4d35ff[_0x5e6d('0xe')]?_0x5e6d('0xf')+_0x4d35ff[_0x5e6d('0xe')]+'}':_0x5e6d('0x10')),'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x8')+_0x4d35ff['id'],'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff[_0x5e6d('0x4')],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x11'),'appdata':_0x5e6d('0x12')+(_0x303675+0x2)+_0x5e6d('0x13')+(_0x303675+0x1)+')','context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff[_0x5e6d('0x4')],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':_0x4d35ff['cutdigits']?_0x5e6d('0x14')+_0x4d35ff['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff[_0x5e6d('0x4')],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff[_0x5e6d('0x4')],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':'outbound','app':_0x5e6d('0x7'),'appdata':_0x5e6d('0xa'),'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x15')+_0x4d35ff['id'],'context':_0x4d35ff['context'],'exten':_0x4d35ff[_0x5e6d('0x4')],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']}];if(_0x4d35ff[_0x5e6d('0x16')](_0x5e6d('0x17'))&&_0x4d35ff[_0x5e6d('0x17')]!=='none'){_0x1c629c['push']({'type':_0x5e6d('0xc'),'app':'Set','appdata':_0x5e6d('0x18'),'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']},{'type':_0x5e6d('0xc'),'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x19')+_0x4d35ff[_0x5e6d('0x17')]||_0x5e6d('0x1a'),'context':_0x4d35ff[_0x5e6d('0x3')],'exten':_0x4d35ff['exten'],'priority':_0x303675++,'VoiceExtensionId':_0x4d35ff['id']});}return _0x1c629c;}function _0x36a1bf(_0x15977a,_0x2d34d0){var _0x454fd6=[{'name':_0x5e6d('0x1b'),'param':0x0},{'name':_0x5e6d('0x1c'),'param':0x1},{'name':_0x5e6d('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x3f9688={};var _0x2c0e50=_0x2d34d0[_0x5e6d('0x1e')](',');var _0x93afad=[];for(var _0xc657fa=0x0;_0xc657fa<_0x454fd6['length'];_0xc657fa++){switch(_0x454fd6[_0xc657fa][_0x5e6d('0x1f')]){case'trunk':_0x3f9688[_0x5e6d('0x1b')]=_0x2c0e50[_0x454fd6[_0xc657fa]['param']][_0x5e6d('0x1e')]('/')[0x1];_0x3f9688['phone']=_0x2c0e50[_0x454fd6[_0xc657fa][_0x5e6d('0x20')]][_0x5e6d('0x1e')]('/')[0x2];_0x3f9688[_0x5e6d('0x21')]=_0x3f9688[_0x5e6d('0x22')]?_0x3f9688[_0x5e6d('0x22')][_0x5e6d('0x1e')]('$')[0x0]:undefined;_0x3f9688[_0x5e6d('0x22')]=_0x15977a['cutdigits']?(_0x3f9688[_0x5e6d('0x21')]||'')+_0x5e6d('0xf')+_0x15977a[_0x5e6d('0xe')]+'}':(_0x3f9688[_0x5e6d('0x21')]||'')+_0x5e6d('0x10');_0x93afad[_0x454fd6[_0xc657fa]['param']]=[_0x5e6d('0x23'),_0x3f9688[_0x5e6d('0x1b')],_0x3f9688[_0x5e6d('0x22')]][_0x5e6d('0x24')]('/');break;case _0x5e6d('0x1d'):_0x3f9688[_0x5e6d('0x1d')]=_0x2c0e50[_0x454fd6[_0xc657fa][_0x5e6d('0x20')]];if(_0x15977a['recordingFormat']!==_0x5e6d('0x25')){if(_0x3f9688[_0x5e6d('0x1d')]['indexOf'](_0x5e6d('0x26'))<0x0){_0x3f9688['options']+=_0x5e6d('0x26');}}else{_0x3f9688['options']=_0x3f9688[_0x5e6d('0x1d')][_0x5e6d('0x27')](_0x5e6d('0x26'),'');}_0x93afad[_0x454fd6[_0xc657fa]['param']]=_0x3f9688[_0x5e6d('0x1d')];break;default:_0x93afad[_0x454fd6[_0xc657fa][_0x5e6d('0x20')]]=_0x2c0e50[_0x454fd6[_0xc657fa][_0x5e6d('0x20')]];}}return _0x93afad[_0x5e6d('0x24')](',');}function _0x361fd3(_0x58449e,_0x180334,_0xfee7df){return new Promise(function(_0x2126a3,_0x210a74){var _0x3352bf=[];if(_[_0x5e6d('0x28')](_0x180334))return _0x2126a3(_0x3352bf);_0x2a4c5b[_0x5e6d('0x29')][_0x5e6d('0x2a')]({'attributes':['id',_0x5e6d('0x2b'),_0x5e6d('0x2c')],'raw':!![]})[_0x5e6d('0x2d')](function(_0x3f0979){for(var _0x21b5fc=0x0,_0x45bb32=0x0;_0x21b5fc<_0x180334[_0x5e6d('0x2e')];_0x21b5fc++,_0x45bb32=0x0){var _0x44b413=_0x180334[_0x21b5fc];var _0x5b9174=[];var _0x29e6c2=[];delete _0x44b413['id'];if(_0x44b413['interval']!==_0x5e6d('0x2f')){_0x44b413[_0x5e6d('0x30')]=[_0x44b413[_0x5e6d('0x2b')]];}else{_0x44b413['intervals']=_0x44b413[_0x5e6d('0x2c')]?_[_0x5e6d('0x31')](_[_0x5e6d('0x32')](_0x3f0979,{'IntervalId':_0x44b413[_0x5e6d('0x2c')]}),_0x5e6d('0x2b')):[];}_0x44b413[_0x5e6d('0x3')]=_0x58449e['context'];_0x44b413['exten']=_0x58449e[_0x5e6d('0x4')];if(_0x44b413[_0x5e6d('0x2')])_0x44b413['type']=_0x44b413[_0x5e6d('0x2')]['toLowerCase']();if(_0x58449e[_0x5e6d('0x2')]==='outbound'){if(_0x44b413[_0x5e6d('0x16')](_0x5e6d('0x33'))&&_0x44b413['tag']&&_0x44b413[_0x5e6d('0x33')]!=='--'){_0x5b9174[_0x5e6d('0x6')]({'type':_0x44b413[_0x5e6d('0x2')][_0x5e6d('0x34')](),'app':'Set','appdata':_0x5e6d('0x35')+_0x44b413[_0x5e6d('0x33')],'context':_0x58449e[_0x5e6d('0x3')],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413[_0x5e6d('0x30')][_0x5e6d('0x2e')]+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});}_0x5b9174[_0x5e6d('0x6')]({'type':_0x44b413['type'][_0x5e6d('0x34')](),'app':'ExecIf','appdata':_0x5e6d('0x36')+(_0x44b413[_0x5e6d('0x37')]?_0x5e6d('0x38')+_0x44b413[_0x5e6d('0x37')]+')':_0x5e6d('0x39')),'context':_0x58449e['context'],'exten':_0x58449e['exten'],'priority':_0x44b413[_0x5e6d('0x30')][_0x5e6d('0x2e')]+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});}else{if(_0x44b413[_0x5e6d('0x16')](_0x5e6d('0x3a'))){if([_0x5e6d('0x3b'),_0x5e6d('0x3c')][_0x5e6d('0x3d')](_0x44b413[_0x5e6d('0x3e')][_0x5e6d('0x34')]())&&_0x44b413[_0x5e6d('0x3f')]!=='custom'){if(_0x44b413[_0x5e6d('0x3a')]){_0x5b9174['push']({'type':_0x44b413[_0x5e6d('0x2')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x58449e[_0x5e6d('0x3')],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413[_0x5e6d('0x30')][_0x5e6d('0x2e')]+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});_0x5b9174['push']({'type':_0x44b413['type'][_0x5e6d('0x34')](),'app':_0x5e6d('0x7'),'appdata':_0x5e6d('0x40'),'context':_0x58449e[_0x5e6d('0x3')],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413[_0x5e6d('0x30')]['length']+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});}else{_0x5b9174[_0x5e6d('0x6')]({'type':_0x44b413[_0x5e6d('0x2')][_0x5e6d('0x34')](),'app':_0x5e6d('0x11'),'appdata':_0x5e6d('0x41'),'context':_0x58449e[_0x5e6d('0x3')],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413[_0x5e6d('0x30')][_0x5e6d('0x2e')]+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});_0x5b9174[_0x5e6d('0x6')]({'type':_0x44b413[_0x5e6d('0x2')][_0x5e6d('0x34')](),'app':_0x5e6d('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x58449e['context'],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413[_0x5e6d('0x30')]['length']+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});}}}}for(var _0x4d3102=0x0;_0x4d3102<_0x44b413[_0x5e6d('0x30')][_0x5e6d('0x2e')];_0x4d3102++){var _0xfe8fc8=_0xfee7df+_0x44b413['intervals'][_0x5e6d('0x2e')];var _0x1f3fbd=_0x4d3102===_0x44b413['intervals'][_0x5e6d('0x2e')]-0x1?_0xfee7df+_0x5b9174[_0x5e6d('0x2e')]+_0x29e6c2['length']+0x2:_0xfee7df+_0x4d3102+0x1;_0x5b9174['splice'](_0x4d3102,0x0,{'type':_0x58449e[_0x5e6d('0x2')],'app':'GotoIfTime','appdata':_0x44b413[_0x5e6d('0x30')][_0x4d3102]+'?'+_0x58449e[_0x5e6d('0x3')]+_0x5e6d('0x42')+_0xfe8fc8+':'+_0x58449e[_0x5e6d('0x3')]+_0x5e6d('0x42')+_0x1f3fbd,'exten':_0x58449e['exten'],'context':_0x58449e[_0x5e6d('0x3')],'priority':_0xfee7df+_0x4d3102,'VoiceExtensionId':_0x58449e['id']});}if(_0x44b413[_0x5e6d('0x3f')]===_0x5e6d('0x43')){_0x44b413[_0x5e6d('0x44')]=_0x36a1bf(_0x58449e,_0x44b413[_0x5e6d('0x44')]);}if(_0x44b413[_0x5e6d('0x3f')]===_0x5e6d('0x45')){_0x5b9174[_0x5e6d('0x6')]({'type':_0x44b413['type']['toLowerCase'](),'app':'Set','appdata':_0x5e6d('0x46'),'context':_0x58449e['context'],'exten':_0x58449e[_0x5e6d('0x4')],'priority':_0x44b413['intervals'][_0x5e6d('0x2e')]+_0xfee7df+_0x45bb32++,'VoiceExtensionId':_0x58449e['id']});}_0x44b413[_0x5e6d('0x47')]=_0x5b9174[_0x5e6d('0x2e')]?_['last'](_0x5b9174)[_0x5e6d('0x47')]+0x1:_0xfee7df;_0x3352bf=_['concat'](_0x3352bf,_0x5b9174,[_0x44b413],_0x29e6c2);_0xfee7df=_[_0x5e6d('0x48')](_0x3352bf)[_0x5e6d('0x47')]+0x1;}return _0x2126a3(_0x3352bf);})[_0x5e6d('0x49')](function(_0x1a776b){_0x210a74(_0x1a776b);});});}return _0x2296b4[_0x5e6d('0x4a')](_0x5e6d('0x4b'),attributes,{'tableName':_0x5e6d('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1e08ca){var _0x4634ea=this[_0x5e6d('0x4d')]({'plain':!![]});var _0x311bed=_0x4634ea[_0x5e6d('0x2')]==='outbound'?_0x39bdc9(_0x4634ea):_0xb7f466(_0x4634ea);return _0x361fd3(_0x4634ea,_0x1e08ca,_[_0x5e6d('0x48')](_0x311bed)[_0x5e6d('0x47')]+0x1)[_0x5e6d('0x2d')](function(_0x42158f){var _0x5bf71f=_[_0x5e6d('0x4e')](_0x311bed,_0x42158f);_0x5bf71f[_0x5e6d('0x6')]({'type':_0x4634ea[_0x5e6d('0x2')],'app':'Hangup','exten':_0x4634ea[_0x5e6d('0x4')],'context':_0x4634ea[_0x5e6d('0x3')],'priority':_[_0x5e6d('0x48')](_0x5bf71f)[_0x5e6d('0x47')]+0x1,'VoiceExtensionId':_0x4634ea['id']});return _0x5bf71f;});}}});}; \ No newline at end of file +var _0xf9ca=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','models','type','Set','CDR(type)=','exten','push','inbound','CDR(routeid)=','context','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','split','length','name','trunk','param','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xf9ca,0x1d3));var _0xaf9c=function(_0x4f6e0c,_0x35ae78){_0x4f6e0c=_0x4f6e0c-0x0;var _0x207946=_0xf9ca[_0x4f6e0c];return _0x207946;};'use strict';var _=require('lodash');var attributes=require(_0xaf9c('0x0'));module['exports']=function(_0x31be64){var _0xbe164c=_0x31be64[_0xaf9c('0x1')];function _0x57f92d(_0x420366){var _0x55ed3d=0x2;var _0x3eef47=[{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x4')+_0x420366['type'],'context':_0x420366['context'],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']}];if(_0x420366['type']==='inbound'){_0x3eef47[_0xaf9c('0x6')]({'type':_0xaf9c('0x7'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x8')+_0x420366['id'],'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366['exten'],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']});}_0x3eef47[_0xaf9c('0x6')]({'type':_0x420366['type'],'app':_0xaf9c('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']},{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xa'),'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366[_0xaf9c('0x5')],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']},{'type':_0x420366[_0xaf9c('0x2')],'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xb'),'context':_0x420366[_0xaf9c('0x9')],'exten':_0x420366['exten'],'priority':_0x55ed3d++,'VoiceExtensionId':_0x420366['id']});return _0x3eef47;}function _0x103447(_0x38e3ad){var _0x3d39ee=0x2;var _0x9b9e9c=[{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xd'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xe')+(_0x38e3ad[_0xaf9c('0xf')]?_0xaf9c('0x10')+_0x38e3ad['cutdigits']+'}':_0xaf9c('0x11')),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':'Set','appdata':_0xaf9c('0x8')+_0x38e3ad['id'],'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x12'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d39ee+0x2)+_0xaf9c('0x13')+(_0x3d39ee+0x1)+')','context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':'outbound','app':_0xaf9c('0x3'),'appdata':_0x38e3ad['cutdigits']?_0xaf9c('0x14')+_0x38e3ad['cutdigits']+'}':_0xaf9c('0x15'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x16'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xa'),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0xb'),'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':'outbound','app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x17')+_0x38e3ad['id'],'context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad['exten'],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']}];if(_0x38e3ad[_0xaf9c('0x18')](_0xaf9c('0x19'))&&_0x38e3ad[_0xaf9c('0x19')]!==_0xaf9c('0x1a')){_0x9b9e9c[_0xaf9c('0x6')]({'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x1b'),'context':_0x38e3ad['context'],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']},{'type':_0xaf9c('0xc'),'app':_0xaf9c('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x38e3ad[_0xaf9c('0x19')]||'wav','context':_0x38e3ad[_0xaf9c('0x9')],'exten':_0x38e3ad[_0xaf9c('0x5')],'priority':_0x3d39ee++,'VoiceExtensionId':_0x38e3ad['id']});}return _0x9b9e9c;}function _0xdd13a7(_0x3a97b9,_0x4782ed){var _0x22d085=[{'name':'trunk','param':0x0},{'name':_0xaf9c('0x1c'),'param':0x1},{'name':_0xaf9c('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x32be0c={};var _0x1dc4f8=_0x4782ed[_0xaf9c('0x1e')](',');var _0x5a8d07=[];for(var _0x1943ab=0x0;_0x1943ab<_0x22d085[_0xaf9c('0x1f')];_0x1943ab++){switch(_0x22d085[_0x1943ab][_0xaf9c('0x20')]){case _0xaf9c('0x21'):_0x32be0c[_0xaf9c('0x21')]=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]['split']('/')[0x1];_0x32be0c['phone']=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]][_0xaf9c('0x1e')]('/')[0x2];_0x32be0c['prefix']=_0x32be0c[_0xaf9c('0x23')]?_0x32be0c['phone'][_0xaf9c('0x1e')]('$')[0x0]:undefined;_0x32be0c[_0xaf9c('0x23')]=_0x3a97b9[_0xaf9c('0xf')]?(_0x32be0c['prefix']||'')+_0xaf9c('0x10')+_0x3a97b9[_0xaf9c('0xf')]+'}':(_0x32be0c['prefix']||'')+'${EXTEN}';_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=[_0xaf9c('0x24'),_0x32be0c[_0xaf9c('0x21')],_0x32be0c[_0xaf9c('0x23')]][_0xaf9c('0x25')]('/');break;case'options':_0x32be0c[_0xaf9c('0x1d')]=_0x1dc4f8[_0x22d085[_0x1943ab]['param']];if(_0x3a97b9[_0xaf9c('0x19')]!==_0xaf9c('0x1a')){if(_0x32be0c['options'][_0xaf9c('0x26')](_0xaf9c('0x27'))<0x0){_0x32be0c[_0xaf9c('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x32be0c[_0xaf9c('0x1d')]=_0x32be0c[_0xaf9c('0x1d')]['replace']('U(xcally-mixmonitor-context)','');}_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=_0x32be0c[_0xaf9c('0x1d')];break;default:_0x5a8d07[_0x22d085[_0x1943ab][_0xaf9c('0x22')]]=_0x1dc4f8[_0x22d085[_0x1943ab][_0xaf9c('0x22')]];}}return _0x5a8d07[_0xaf9c('0x25')](',');}function _0x4673a8(_0x436136,_0x29e633,_0x3baca3){return new Promise(function(_0x43ac65,_0x66f266){var _0x5c7e62=[];if(_[_0xaf9c('0x28')](_0x29e633))return _0x43ac65(_0x5c7e62);_0xbe164c[_0xaf9c('0x29')][_0xaf9c('0x2a')]({'attributes':['id','interval',_0xaf9c('0x2b')],'raw':!![]})[_0xaf9c('0x2c')](function(_0x2b2ea7){for(var _0x2cfc1d=0x0,_0x1741f3=0x0;_0x2cfc1d<_0x29e633['length'];_0x2cfc1d++,_0x1741f3=0x0){var _0x3eecdc=_0x29e633[_0x2cfc1d];var _0x443786=[];var _0x227bc9=[];delete _0x3eecdc['id'];if(_0x3eecdc['interval']!==_0xaf9c('0x2d')){_0x3eecdc[_0xaf9c('0x2e')]=[_0x3eecdc['interval']];}else{_0x3eecdc[_0xaf9c('0x2e')]=_0x3eecdc[_0xaf9c('0x2b')]?_['map'](_['filter'](_0x2b2ea7,{'IntervalId':_0x3eecdc['IntervalId']}),'interval'):[];}_0x3eecdc[_0xaf9c('0x9')]=_0x436136[_0xaf9c('0x9')];_0x3eecdc['exten']=_0x436136[_0xaf9c('0x5')];if(_0x3eecdc['type'])_0x3eecdc[_0xaf9c('0x2')]=_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')]();if(_0x436136[_0xaf9c('0x2')]===_0xaf9c('0xc')){if(_0x3eecdc[_0xaf9c('0x18')](_0xaf9c('0x30'))&&_0x3eecdc[_0xaf9c('0x30')]&&_0x3eecdc[_0xaf9c('0x30')]!=='--'){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')]['toLowerCase'](),'app':_0xaf9c('0x3'),'appdata':'CDR(tag)='+_0x3eecdc[_0xaf9c('0x30')],'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136['exten'],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3eecdc[_0xaf9c('0x31')]?_0xaf9c('0x32')+_0x3eecdc['callerID']+')':_0xaf9c('0x33')),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}else{if(_0x3eecdc[_0xaf9c('0x18')](_0xaf9c('0x34'))){if(['queue',_0xaf9c('0x35')][_0xaf9c('0x36')](_0x3eecdc[_0xaf9c('0x37')]['toLowerCase']())&&_0x3eecdc[_0xaf9c('0x38')]!==_0xaf9c('0x39')){if(_0x3eecdc[_0xaf9c('0x34')]){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')]['toLowerCase'](),'app':_0xaf9c('0x12'),'appdata':_0xaf9c('0x3a'),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')]['length']+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x3b'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc['intervals'][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}else{_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x12'),'appdata':_0xaf9c('0x3c'),'context':_0x436136[_0xaf9c('0x9')],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x3d'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}}}}for(var _0x176916=0x0;_0x176916<_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')];_0x176916++){var _0x4536a1=_0x3baca3+_0x3eecdc[_0xaf9c('0x2e')][_0xaf9c('0x1f')];var _0x5f0938=_0x176916===_0x3eecdc['intervals'][_0xaf9c('0x1f')]-0x1?_0x3baca3+_0x443786['length']+_0x227bc9['length']+0x2:_0x3baca3+_0x176916+0x1;_0x443786['splice'](_0x176916,0x0,{'type':_0x436136[_0xaf9c('0x2')],'app':_0xaf9c('0x3e'),'appdata':_0x3eecdc['intervals'][_0x176916]+'?'+_0x436136[_0xaf9c('0x9')]+_0xaf9c('0x3f')+_0x4536a1+':'+_0x436136['context']+_0xaf9c('0x3f')+_0x5f0938,'exten':_0x436136[_0xaf9c('0x5')],'context':_0x436136[_0xaf9c('0x9')],'priority':_0x3baca3+_0x176916,'VoiceExtensionId':_0x436136['id']});}if(_0x3eecdc[_0xaf9c('0x38')]===_0xaf9c('0x40')){_0x3eecdc[_0xaf9c('0x41')]=_0xdd13a7(_0x436136,_0x3eecdc[_0xaf9c('0x41')]);}if(_0x3eecdc['appType']===_0xaf9c('0x42')){_0x443786[_0xaf9c('0x6')]({'type':_0x3eecdc[_0xaf9c('0x2')][_0xaf9c('0x2f')](),'app':_0xaf9c('0x3'),'appdata':_0xaf9c('0x43'),'context':_0x436136['context'],'exten':_0x436136[_0xaf9c('0x5')],'priority':_0x3eecdc['intervals'][_0xaf9c('0x1f')]+_0x3baca3+_0x1741f3++,'VoiceExtensionId':_0x436136['id']});}_0x3eecdc[_0xaf9c('0x44')]=_0x443786[_0xaf9c('0x1f')]?_[_0xaf9c('0x45')](_0x443786)[_0xaf9c('0x44')]+0x1:_0x3baca3;_0x5c7e62=_[_0xaf9c('0x46')](_0x5c7e62,_0x443786,[_0x3eecdc],_0x227bc9);_0x3baca3=_[_0xaf9c('0x45')](_0x5c7e62)['priority']+0x1;}return _0x43ac65(_0x5c7e62);})['catch'](function(_0x4c99e1){_0x66f266(_0x4c99e1);});});}return _0x31be64['define'](_0xaf9c('0x47'),attributes,{'tableName':_0xaf9c('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x374478){var _0x2a7645=this[_0xaf9c('0x49')]({'plain':!![]});var _0x25e2fd=_0x2a7645[_0xaf9c('0x2')]===_0xaf9c('0xc')?_0x103447(_0x2a7645):_0x57f92d(_0x2a7645);return _0x4673a8(_0x2a7645,_0x374478,_['last'](_0x25e2fd)[_0xaf9c('0x44')]+0x1)['then'](function(_0x3e6021){var _0x1bdd0f=_['concat'](_0x25e2fd,_0x3e6021);_0x1bdd0f[_0xaf9c('0x6')]({'type':_0x2a7645[_0xaf9c('0x2')],'app':_0xaf9c('0x4a'),'exten':_0x2a7645['exten'],'context':_0x2a7645[_0xaf9c('0x9')],'priority':_['last'](_0x1bdd0f)['priority']+0x1,'VoiceExtensionId':_0x2a7645['id']});return _0x1bdd0f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f56a9cf..2a6cb45 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 _0x8c46=['options','raw','where','attributes','limit','include','model','map','then','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension'];(function(_0x3a55ea,_0x1a5fbc){var _0x2e413b=function(_0x2c979c){while(--_0x2c979c){_0x3a55ea['push'](_0x3a55ea['shift']());}};_0x2e413b(++_0x1a5fbc);}(_0x8c46,0x171));var _0x68c4=function(_0x49bc4e,_0x24ea0d){_0x49bc4e=_0x49bc4e-0x0;var _0x5dbd2f=_0x8c46[_0x49bc4e];return _0x5dbd2f;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68c4('0x2'))['db'];var utils=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var jayson=require(_0x68c4('0x7'));var client=jayson[_0x68c4('0x8')][_0x68c4('0x9')]({'port':0x232a});config[_0x68c4('0xa')]=_[_0x68c4('0xb')](config['redis'],{'host':_0x68c4('0xc'),'port':0x18eb});var socket=require(_0x68c4('0xd'))(new Redis(config[_0x68c4('0xa')]));require('./voiceExtension.socket')[_0x68c4('0xe')](socket);function respondWithRpcPromise(_0x43f969,_0x245c02,_0x5b5626){return new BPromise(function(_0x50b0df,_0x3f44f0){return client[_0x68c4('0xf')](_0x43f969,_0x5b5626)['then'](function(_0x58c8e0){logger[_0x68c4('0x10')](_0x68c4('0x11'),_0x245c02,_0x68c4('0x12'));logger['debug'](_0x68c4('0x13'),_0x245c02,_0x68c4('0x12'),JSON[_0x68c4('0x14')](_0x58c8e0));if(_0x58c8e0['error']){if(_0x58c8e0[_0x68c4('0x15')][_0x68c4('0x16')]===0x1f4){logger[_0x68c4('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x245c02,_0x58c8e0[_0x68c4('0x15')][_0x68c4('0x17')]);return _0x3f44f0(_0x58c8e0['error'][_0x68c4('0x17')]);}logger['error'](_0x68c4('0x11'),_0x245c02,_0x58c8e0['error']['message']);return _0x50b0df(_0x58c8e0[_0x68c4('0x15')][_0x68c4('0x17')]);}else{logger['info'](_0x68c4('0x11'),_0x245c02,_0x68c4('0x12'));_0x50b0df(_0x58c8e0[_0x68c4('0x18')][_0x68c4('0x17')]);}})[_0x68c4('0x19')](function(_0x10f0a7){logger[_0x68c4('0x15')](_0x68c4('0x11'),_0x245c02,_0x10f0a7);_0x3f44f0(_0x10f0a7);});});}exports[_0x68c4('0x1a')]=function(_0x3befda){var _0x29cb55=this;return new Promise(function(_0x58f87d,_0x398a71){return db['VoiceExtension']['findAll']({'raw':_0x3befda[_0x68c4('0x1b')]?_0x3befda[_0x68c4('0x1b')][_0x68c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x3befda[_0x68c4('0x1b')]?_0x3befda['options'][_0x68c4('0x1d')]||null:null,'attributes':_0x3befda[_0x68c4('0x1b')]?_0x3befda['options'][_0x68c4('0x1e')]||null:null,'limit':_0x3befda[_0x68c4('0x1b')]?_0x3befda[_0x68c4('0x1b')][_0x68c4('0x1f')]||null:null,'include':_0x3befda[_0x68c4('0x1b')]?_0x3befda[_0x68c4('0x1b')][_0x68c4('0x20')]?_['map'](_0x3befda[_0x68c4('0x1b')]['include'],function(_0xf16a78){return{'model':db[_0xf16a78[_0x68c4('0x21')]],'as':_0xf16a78['as'],'attributes':_0xf16a78[_0x68c4('0x1e')],'include':_0xf16a78['include']?_[_0x68c4('0x22')](_0xf16a78[_0x68c4('0x20')],function(_0x496f4d){return{'model':db[_0x496f4d[_0x68c4('0x21')]],'as':_0x496f4d['as'],'attributes':_0x496f4d[_0x68c4('0x1e')],'include':_0x496f4d[_0x68c4('0x20')]?_[_0x68c4('0x22')](_0x496f4d['include'],function(_0x26d56b){return{'model':db[_0x26d56b['model']],'as':_0x26d56b['as'],'attributes':_0x26d56b[_0x68c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x68c4('0x23')](function(_0x56ed70){logger[_0x68c4('0x10')](_0x68c4('0x1a'),_0x3befda);logger['debug'](_0x68c4('0x1a'),_0x3befda,JSON[_0x68c4('0x14')](_0x56ed70));_0x58f87d(_0x56ed70);})[_0x68c4('0x19')](function(_0x1d2b40){logger[_0x68c4('0x15')](_0x68c4('0x1a'),_0x1d2b40[_0x68c4('0x17')],_0x3befda);_0x398a71(_0x29cb55[_0x68c4('0x15')](0x1f4,_0x1d2b40[_0x68c4('0x17')]));});});}; \ No newline at end of file +var _0xf3a7=['socket.io-emitter','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','map','include','model','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x137219,_0x3042d3){var _0x4a1eac=function(_0x58be7f){while(--_0x58be7f){_0x137219['push'](_0x137219['shift']());}};_0x4a1eac(++_0x3042d3);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7f3a('0x0'));var moment=require(_0x7f3a('0x1'));var BPromise=require(_0x7f3a('0x2'));var rs=require(_0x7f3a('0x3'));var fs=require('fs');var Redis=require(_0x7f3a('0x4'));var db=require(_0x7f3a('0x5'))['db'];var utils=require(_0x7f3a('0x6'));var logger=require(_0x7f3a('0x7'))(_0x7f3a('0x8'));var config=require(_0x7f3a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f3a('0xa')][_0x7f3a('0xb')]({'port':0x232a});config[_0x7f3a('0xc')]=_[_0x7f3a('0xd')](config[_0x7f3a('0xc')],{'host':_0x7f3a('0xe'),'port':0x18eb});var socket=require(_0x7f3a('0xf'))(new Redis(config['redis']));require(_0x7f3a('0x10'))[_0x7f3a('0x11')](socket);function respondWithRpcPromise(_0x59a5dc,_0x5abe24,_0x265fb7){return new BPromise(function(_0x2c9726,_0x5e8521){return client[_0x7f3a('0x12')](_0x59a5dc,_0x265fb7)['then'](function(_0x3d3c13){logger['info'](_0x7f3a('0x13'),_0x5abe24,_0x7f3a('0x14'));logger[_0x7f3a('0x15')](_0x7f3a('0x16'),_0x5abe24,_0x7f3a('0x14'),JSON[_0x7f3a('0x17')](_0x3d3c13));if(_0x3d3c13[_0x7f3a('0x18')]){if(_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x19')]===0x1f4){logger['error'](_0x7f3a('0x13'),_0x5abe24,_0x3d3c13['error'][_0x7f3a('0x1a')]);return _0x5e8521(_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x1a')]);}logger[_0x7f3a('0x18')](_0x7f3a('0x13'),_0x5abe24,_0x3d3c13[_0x7f3a('0x18')][_0x7f3a('0x1a')]);return _0x2c9726(_0x3d3c13['error'][_0x7f3a('0x1a')]);}else{logger[_0x7f3a('0x1b')]('VoiceExtension,\x20%s,\x20%s',_0x5abe24,_0x7f3a('0x14'));_0x2c9726(_0x3d3c13[_0x7f3a('0x1c')][_0x7f3a('0x1a')]);}})[_0x7f3a('0x1d')](function(_0x54f5e5){logger['error'](_0x7f3a('0x13'),_0x5abe24,_0x54f5e5);_0x5e8521(_0x54f5e5);});});}exports[_0x7f3a('0x1e')]=function(_0xf6d87c){var _0xfaedca=this;return new Promise(function(_0x3f5ad9,_0x48032d){return db[_0x7f3a('0x1f')][_0x7f3a('0x20')]({'raw':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x22')]===undefined?!![]:![]:!![],'where':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x23')]||null:null,'attributes':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')]['attributes']||null:null,'limit':_0xf6d87c['options']?_0xf6d87c['options'][_0x7f3a('0x24')]||null:null,'include':_0xf6d87c[_0x7f3a('0x21')]?_0xf6d87c[_0x7f3a('0x21')]['include']?_[_0x7f3a('0x25')](_0xf6d87c[_0x7f3a('0x21')][_0x7f3a('0x26')],function(_0x3479dc){return{'model':db[_0x3479dc[_0x7f3a('0x27')]],'as':_0x3479dc['as'],'attributes':_0x3479dc[_0x7f3a('0x28')],'include':_0x3479dc[_0x7f3a('0x26')]?_[_0x7f3a('0x25')](_0x3479dc[_0x7f3a('0x26')],function(_0x4a9dd1){return{'model':db[_0x4a9dd1[_0x7f3a('0x27')]],'as':_0x4a9dd1['as'],'attributes':_0x4a9dd1[_0x7f3a('0x28')],'include':_0x4a9dd1[_0x7f3a('0x26')]?_[_0x7f3a('0x25')](_0x4a9dd1[_0x7f3a('0x26')],function(_0x440e28){return{'model':db[_0x440e28[_0x7f3a('0x27')]],'as':_0x440e28['as'],'attributes':_0x440e28[_0x7f3a('0x28')]};}):[]};}):[]};}):[]:[]})[_0x7f3a('0x29')](function(_0x42c06a){logger[_0x7f3a('0x1b')](_0x7f3a('0x1e'),_0xf6d87c);logger[_0x7f3a('0x15')](_0x7f3a('0x1e'),_0xf6d87c,JSON['stringify'](_0x42c06a));_0x3f5ad9(_0x42c06a);})[_0x7f3a('0x1d')](function(_0x1e1420){logger['error']('GetVoiceExtension',_0x1e1420[_0x7f3a('0x1a')],_0xf6d87c);_0x48032d(_0xfaedca[_0x7f3a('0x18')](0x1f4,_0x1e1420[_0x7f3a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a1a3838..0a25e61 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x1564f4,_0x25be57){var _0x3c62ac=function(_0x140682){while(--_0x140682){_0x1564f4['push'](_0x1564f4['shift']());}};_0x3c62ac(++_0x25be57);}(_0x4975,0x86));var _0x5497=function(_0x1080c8,_0x438fa5){_0x1080c8=_0x1080c8-0x0;var _0x4bb208=_0x4975[_0x1080c8];return _0x4bb208;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x42b3ba,_0x165b31){var _0xcadf9a=function(_0x37eb65){while(--_0x37eb65){_0x42b3ba['push'](_0x42b3ba['shift']());}};_0xcadf9a(++_0x165b31);}(_0x1261,0x144));var _0x1126=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x1261[_0x2ca616];return _0x53155f;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 77822d0..1b722b4 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 _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0xdac489,_0x2e6c5a){var _0x4d995e=function(_0x5b4207){while(--_0x5b4207){_0xdac489['push'](_0xdac489['shift']());}};_0x4d995e(++_0x2e6c5a);}(_0x1893,0xa2));var _0x3189=function(_0x1ffb10,_0x28ce2c){_0x1ffb10=_0x1ffb10-0x0;var _0x390ad0=_0x1893[_0x1ffb10];return _0x390ad0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file +var _0x66fa=['isAuthenticated','index','get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a3634,_0x3a5fe7){var _0x2338c7=function(_0x5ee63d){while(--_0x5ee63d){_0x1a3634['push'](_0x1a3634['shift']());}};_0x2338c7(++_0x3a5fe7);}(_0x66fa,0x117));var _0xa66f=function(_0x43d9a6,_0x197d7b){_0x43d9a6=_0x43d9a6-0x0;var _0x522f70=_0x66fa[_0x43d9a6];return _0x522f70;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/messages',auth[_0xa66f('0x9')](),controller['getMessages']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 041f500..3559b57 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 _0x3b41=['mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue'];(function(_0x415005,_0x595685){var _0x50002f=function(_0x68b2a2){while(--_0x68b2a2){_0x415005['push'](_0x415005['shift']());}};_0x50002f(++_0x595685);}(_0x3b41,0x1dc));var _0x13b4=function(_0x3a412f,_0x1634db){_0x3a412f=_0x3a412f-0x0;var _0x41ddbf=_0x3b41[_0x3a412f];return _0x41ddbf;};'use strict';var Sequelize=require('sequelize');module[_0x13b4('0x0')]={'customer_id':{'type':Sequelize[_0x13b4('0x1')]},'context':{'type':Sequelize[_0x13b4('0x1')],'defaultValue':_0x13b4('0x2'),'unique':_0x13b4('0x3')},'mailbox':{'type':Sequelize[_0x13b4('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x13b4('0x1')]},'fullname':{'type':Sequelize[_0x13b4('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2adf14){this[_0x13b4('0x4')](_0x13b4('0x5'),typeof _0x2adf14===_0x13b4('0x6')&&_0x2adf14[_0x13b4('0x7')]()?_0x2adf14[_0x13b4('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x13b4('0x1')],'defaultValue':_0x13b4('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x13b4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x13b4('0x1')]},'callback':{'type':Sequelize[_0x13b4('0x1')]},'review':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x13b4('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':_0x13b4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x13b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x13b4('0xa')](_0x13b4('0x9'),'no'),'defaultValue':_0x13b4('0x9'),'allowNull':![]},'stamp':{'type':_0x13b4('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x13b4('0x1')]},'maxsecs':{'type':Sequelize[_0x13b4('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x13b4('0xe')],'get':function(){return this['getDataValue'](_0x13b4('0xf'))+_0x13b4('0x10')+this[_0x13b4('0x11')](_0x13b4('0x12'));}}}; \ No newline at end of file +var _0x9242=['VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail','setDataValue','email','string','trim','yes','ENUM','TIMESTAMP','INTEGER'];(function(_0x4a29f1,_0x23e312){var _0xe71461=function(_0x552bff){while(--_0x552bff){_0x4a29f1['push'](_0x4a29f1['shift']());}};_0xe71461(++_0x23e312);}(_0x9242,0x1f3));var _0x2924=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x9242[_0x5f3de3];return _0x287e0d;};'use strict';var Sequelize=require(_0x2924('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2924('0x1')],'defaultValue':_0x2924('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x2924('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2924('0x1')]},'fullname':{'type':Sequelize[_0x2924('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x200a53){this[_0x2924('0x3')](_0x2924('0x4'),typeof _0x200a53===_0x2924('0x5')&&_0x200a53['trim']()?_0x200a53[_0x2924('0x6')]():null);}},'pager':{'type':Sequelize[_0x2924('0x1')]},'tz':{'type':Sequelize[_0x2924('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2924('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':_0x2924('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2924('0x8')](_0x2924('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2924('0x9')},'emailsubject':{'type':Sequelize[_0x2924('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x2924('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2924('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2924('0xb')],'get':function(){return this[_0x2924('0xc')](_0x2924('0xd'))+_0x2924('0xe')+this[_0x2924('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 62c7002..b61025c 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 _0x4024=['limit','count','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2e2051,_0x26b49e){var _0x199c53=function(_0xdd97cc){while(--_0xdd97cc){_0x2e2051['push'](_0x2e2051['shift']());}};_0x199c53(++_0x26b49e);}(_0x4024,0x89));var _0x4402=function(_0x4372e4,_0x1e9752){_0x4372e4=_0x4372e4-0x0;var _0x3a77c6=_0x4024[_0x4372e4];return _0x3a77c6;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){var _0x4d6846=_0x289a3e[_0x4402('0x21')]({'plain':!![]});var _0x4e1c04=_0x4402('0x22');return db[_0x4402('0x23')][_0x4402('0x20')]({'where':{'type':_0x4e1c04,'resourceId':_0x4d6846['id']}})[_0x4402('0x1f')](function(){return _0x289a3e;});})['then'](function(){_0x258d10[_0x4402('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d52f,_0x1be54d){return function(_0x395e49){if(!_0x395e49){_0x59d52f[_0x4402('0x13')](0x194);}return _0x395e49;};}function handleError(_0xabf61b,_0x3eb796){_0x3eb796=_0x3eb796||0x1f4;return function(_0x514e41){logger[_0x4402('0x24')](_0x514e41['stack']);if(_0x514e41[_0x4402('0x25')]){delete _0x514e41[_0x4402('0x25')];}_0xabf61b[_0x4402('0x14')](_0x3eb796)['send'](_0x514e41);};}exports[_0x4402('0x26')]=function(_0x6c87f6,_0x316239){var _0x3f4bcb={},_0x2526d1={},_0x605702={'count':0x0,'rows':[]};var _0x1189b8=_[_0x4402('0x27')](db[_0x4402('0x28')][_0x4402('0x29')],function(_0xcea26b){return{'name':_0xcea26b['fieldName'],'type':_0xcea26b[_0x4402('0x2a')]['key']};});_0x2526d1[_0x4402('0x2b')]=_['map'](_0x1189b8,_0x4402('0x25'));_0x2526d1[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x6c87f6[_0x4402('0x2c')]);_0x2526d1[_0x4402('0x2e')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],_0x2526d1[_0x4402('0x2c')]);_0x3f4bcb[_0x4402('0x2f')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x6c87f6['query'][_0x4402('0x30')]));_0x3f4bcb[_0x4402('0x2f')]=_0x3f4bcb[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f4bcb[_0x4402('0x2f')]:_0x2526d1[_0x4402('0x2b')];if(!_0x6c87f6[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3f4bcb['limit']=qs[_0x4402('0x19')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x19')]);_0x3f4bcb['offset']=qs[_0x4402('0x17')](_0x6c87f6[_0x4402('0x2c')]['offset']);}_0x3f4bcb['order']=qs[_0x4402('0x34')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x34')]);_0x3f4bcb[_0x4402('0x35')]=qs['filters'](_['pick'](_0x6c87f6['query'],_0x2526d1[_0x4402('0x2e')]),_0x1189b8);if(_0x6c87f6[_0x4402('0x2c')][_0x4402('0x36')]){_0x3f4bcb[_0x4402('0x35')]=_['merge'](_0x3f4bcb[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x1189b8,function(_0x35f877){if(_0x35f877['type']!==_0x4402('0x37')){var _0x5aca7b={};_0x5aca7b[_0x35f877[_0x4402('0x25')]]={'$like':'%'+_0x6c87f6[_0x4402('0x2c')]['filter']+'%'};return _0x5aca7b;}})});}_0x3f4bcb=_[_0x4402('0x38')]({},_0x3f4bcb,_0x6c87f6['options']);var _0x423628={'where':_0x3f4bcb[_0x4402('0x35')]};return db['VoiceMail'][_0x4402('0x1a')](_0x423628)[_0x4402('0x1f')](function(_0x250f09){_0x605702[_0x4402('0x1a')]=_0x250f09;if(_0x6c87f6['query']['includeAll']){_0x3f4bcb[_0x4402('0x39')]=[{'all':!![]}];}return db['VoiceMail'][_0x4402('0x3a')](_0x3f4bcb);})[_0x4402('0x1f')](function(_0xb9cf85){_0x605702[_0x4402('0x3b')]=_0xb9cf85;return _0x605702;})[_0x4402('0x1f')](respondWithFilteredResult(_0x316239,_0x3f4bcb))[_0x4402('0x3c')](handleError(_0x316239,null));};exports[_0x4402('0x3d')]=function(_0x390169,_0x1f9b3e){var _0x42812b={'raw':!![],'where':{'id':_0x390169[_0x4402('0x3e')]['id']}},_0x486e43={};_0x486e43[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x28')][_0x4402('0x29')]);_0x486e43['query']=_[_0x4402('0x2d')](_0x390169[_0x4402('0x2c')]);_0x486e43[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],_0x486e43['query']);_0x42812b[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x390169[_0x4402('0x2c')][_0x4402('0x30')]));_0x42812b[_0x4402('0x2f')]=_0x42812b[_0x4402('0x2f')][_0x4402('0x31')]?_0x42812b[_0x4402('0x2f')]:_0x486e43[_0x4402('0x2b')];if(_0x390169['query'][_0x4402('0x40')]){_0x42812b['include']=[{'all':!![]}];}_0x42812b=_[_0x4402('0x38')]({},_0x42812b,_0x390169[_0x4402('0x41')]);return db['VoiceMail'][_0x4402('0x42')](_0x42812b)[_0x4402('0x1f')](handleEntityNotFound(_0x1f9b3e,null))[_0x4402('0x1f')](respondWithResult(_0x1f9b3e,null))[_0x4402('0x3c')](handleError(_0x1f9b3e,null));};exports[_0x4402('0x43')]=function(_0x2503eb,_0x5b094b){return db[_0x4402('0x28')][_0x4402('0x43')](_0x2503eb[_0x4402('0x44')],{})[_0x4402('0x1f')](function(_0x2b2ed3){var _0x24d51c=_0x2503eb[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0x24d51c)throw new Error(_0x4402('0x46'));if(_0x24d51c['role']==='user'){var _0x5ab12b=_0x2b2ed3['get']({'plain':!![]});var _0x257010=_0x4402('0x22');return db[_0x4402('0x47')][_0x4402('0x42')]({'where':{'name':_0x257010,'userProfileId':_0x24d51c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x12d6de){if(_0x12d6de&&_0x12d6de[_0x4402('0x48')]===0x0){return db[_0x4402('0x23')][_0x4402('0x43')]({'name':_0x5ab12b[_0x4402('0x25')],'resourceId':_0x5ab12b['id'],'type':_0x12d6de[_0x4402('0x25')],'sectionId':_0x12d6de['id']},{})['then'](function(){return _0x2b2ed3;});}else{return _0x2b2ed3;}})[_0x4402('0x3c')](function(_0x2a8085){logger[_0x4402('0x24')](_0x4402('0x49'),_0x2a8085);throw _0x2a8085;});}return _0x2b2ed3;})[_0x4402('0x1f')](respondWithResult(_0x5b094b,0xc9))[_0x4402('0x3c')](handleError(_0x5b094b,null));};exports['update']=function(_0xe8a8e9,_0x642ab4){if(_0xe8a8e9[_0x4402('0x44')]['id']){delete _0xe8a8e9[_0x4402('0x44')]['id'];}return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0xe8a8e9[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x642ab4,null))['then'](saveUpdates(_0xe8a8e9[_0x4402('0x44')],null))[_0x4402('0x1f')](respondWithResult(_0x642ab4,null))[_0x4402('0x3c')](handleError(_0x642ab4,null));};exports['destroy']=function(_0x5a076a,_0x258926){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x5a076a[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x258926,null))[_0x4402('0x1f')](removeEntity(_0x258926,null))[_0x4402('0x3c')](handleError(_0x258926,null));};exports[_0x4402('0x4a')]=function(_0x394ac9,_0x3f2599,_0x353679){return db[_0x4402('0x28')][_0x4402('0x4b')]({'where':{'id':_0x394ac9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3f2599,null))['then'](function(_0xe4530a){var _0x55922e;var _0x3fb9f0={},_0x1e5891={};_0x1e5891[_0x4402('0x2b')]=_[_0x4402('0x2d')](db[_0x4402('0x4c')][_0x4402('0x29')]);_0x1e5891['query']=_[_0x4402('0x2d')](_0x394ac9[_0x4402('0x2c')]);_0x1e5891[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],_0x1e5891['query']);_0x3fb9f0[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x394ac9[_0x4402('0x2c')][_0x4402('0x30')]));_0x3fb9f0[_0x4402('0x2f')]=_0x3fb9f0[_0x4402('0x2f')]['length']?_0x3fb9f0[_0x4402('0x2f')]:_0x1e5891[_0x4402('0x2b')];if(!_0x394ac9['query'][_0x4402('0x32')](_0x4402('0x33'))){_0x3fb9f0['limit']=qs['limit'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x19')]);_0x3fb9f0[_0x4402('0x17')]=qs['offset'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x17')]);}_0x3fb9f0[_0x4402('0x4d')]=qs['sort'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x34')]);_0x3fb9f0[_0x4402('0x35')]=qs['filters'](_[_0x4402('0x4e')](_0x394ac9[_0x4402('0x2c')],_0x1e5891['filters']));if(_0x394ac9['query'][_0x4402('0x36')]){_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'$or':_['map'](_0x3fb9f0['attributes'],function(_0x432c2e){var _0x42cdd6={};_0x42cdd6[_0x432c2e]={'$like':'%'+_0x394ac9[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x42cdd6;})});}_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'mailboxuser':_0xe4530a[_0x4402('0x4f')]});_0x3fb9f0=_[_0x4402('0x38')]({},_0x3fb9f0,_0x394ac9[_0x4402('0x41')]);return db[_0x4402('0x4c')][_0x4402('0x50')](_0x3fb9f0)['then'](respondWithFilteredResult(_0x3f2599,_0x3fb9f0));})[_0x4402('0x3c')](handleError(_0x3f2599,null));}; \ No newline at end of file +var _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x8f3c4,_0x1e4c2e){var _0x471ea2=function(_0x471bc2){while(--_0x471bc2){_0x8f3c4['push'](_0x8f3c4['shift']());}};_0x471ea2(++_0x1e4c2e);}(_0xea28,0x13a));var _0x8ea2=function(_0x3ed556,_0x4b0872){_0x3ed556=_0x3ed556-0x0;var _0x2d8b9f=_0xea28[_0x3ed556];return _0x2d8b9f;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8886c83..117c16b 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 _0x31da=['mailbox_context','mailbox','lodash','../../config/logger','moment','bluebird','path','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x31da,0xc2));var _0xa31d=function(_0x159623,_0x64abde){_0x159623=_0x159623-0x0;var _0x8b403c=_0x31da[_0x159623];return _0x8b403c;};'use strict';var _=require(_0xa31d('0x0'));var util=require('util');var logger=require(_0xa31d('0x1'))('api');var moment=require(_0xa31d('0x2'));var BPromise=require(_0xa31d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa31d('0x4'));var rimraf=require(_0xa31d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa31d('0x6'));module['exports']=function(_0x2d4dcf,_0x178829){return _0x2d4dcf[_0xa31d('0x7')](_0xa31d('0x8'),attributes,{'tableName':_0xa31d('0x9'),'paranoid':![],'indexes':[{'name':_0xa31d('0xa'),'fields':[_0xa31d('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8377=['./voiceMail.attributes','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1fcbe0,_0x5b43be){var _0xbcf95b=function(_0x1c631d){while(--_0x1c631d){_0x1fcbe0['push'](_0x1fcbe0['shift']());}};_0xbcf95b(++_0x5b43be);}(_0x8377,0xc9));var _0x7837=function(_0xd0ebcd,_0x37863c){_0xd0ebcd=_0xd0ebcd-0x0;var _0x1204fa=_0x8377[_0xd0ebcd];return _0x1204fa;};'use strict';var _=require(_0x7837('0x0'));var util=require(_0x7837('0x1'));var logger=require(_0x7837('0x2'))(_0x7837('0x3'));var moment=require(_0x7837('0x4'));var BPromise=require(_0x7837('0x5'));var rp=require(_0x7837('0x6'));var fs=require('fs');var path=require(_0x7837('0x7'));var rimraf=require(_0x7837('0x8'));var config=require('../../config/environment');var attributes=require(_0x7837('0x9'));module['exports']=function(_0x2a7057,_0x29105d){return _0x2a7057['define'](_0x7837('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x7837('0xb'),'fields':[_0x7837('0xc'),_0x7837('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e3e055b..3de5ba6 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 _0x0cfa=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0cfa,0x112));var _0xa0cf=function(_0x6b18cc,_0x17833c){_0x6b18cc=_0x6b18cc-0x0;var _0x5b316c=_0x0cfa[_0x6b18cc];return _0x5b316c;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var moment=require(_0xa0cf('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0cf('0x4'))['db'];var utils=require(_0xa0cf('0x5'));var logger=require(_0xa0cf('0x6'))('rpc');var config=require(_0xa0cf('0x7'));var jayson=require(_0xa0cf('0x8'));var client=jayson[_0xa0cf('0x9')][_0xa0cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x544e07,_0x1c4cfa,_0xbb6046){return new BPromise(function(_0x21b659,_0x59443e){return client[_0xa0cf('0xb')](_0x544e07,_0xbb6046)[_0xa0cf('0xc')](function(_0x31cc9a){logger[_0xa0cf('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1c4cfa,_0xa0cf('0xe'));logger[_0xa0cf('0xf')](_0xa0cf('0x10'),_0x1c4cfa,_0xa0cf('0xe'),JSON[_0xa0cf('0x11')](_0x31cc9a));if(_0x31cc9a[_0xa0cf('0x12')]){if(_0x31cc9a[_0xa0cf('0x12')][_0xa0cf('0x13')]===0x1f4){logger[_0xa0cf('0x12')]('VoiceMail,\x20%s,\x20%s',_0x1c4cfa,_0x31cc9a[_0xa0cf('0x12')]['message']);return _0x59443e(_0x31cc9a[_0xa0cf('0x12')]['message']);}logger[_0xa0cf('0x12')](_0xa0cf('0x14'),_0x1c4cfa,_0x31cc9a['error'][_0xa0cf('0x15')]);return _0x21b659(_0x31cc9a[_0xa0cf('0x12')][_0xa0cf('0x15')]);}else{logger[_0xa0cf('0xd')](_0xa0cf('0x14'),_0x1c4cfa,'request\x20sent');_0x21b659(_0x31cc9a[_0xa0cf('0x16')][_0xa0cf('0x15')]);}})['catch'](function(_0x2f296c){logger[_0xa0cf('0x12')](_0xa0cf('0x14'),_0x1c4cfa,_0x2f296c);_0x59443e(_0x2f296c);});});} \ No newline at end of file +var _0xbcbb=['stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x46fe66,_0x4b0d58){var _0x4aff52=function(_0x20f329){while(--_0x20f329){_0x46fe66['push'](_0x46fe66['shift']());}};_0x4aff52(++_0x4b0d58);}(_0xbcbb,0x180));var _0xbbcb=function(_0x3a2fe5,_0x4f3adf){_0x3a2fe5=_0x3a2fe5-0x0;var _0x5aacd1=_0xbcbb[_0x3a2fe5];return _0x5aacd1;};'use strict';var _=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var moment=require(_0xbbcb('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbcb('0x3'));var fs=require('fs');var Redis=require(_0xbbcb('0x4'));var db=require(_0xbbcb('0x5'))['db'];var utils=require(_0xbbcb('0x6'));var logger=require('../../config/logger')(_0xbbcb('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbcb('0x8'));var client=jayson[_0xbbcb('0x9')][_0xbbcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575394,_0x872e11,_0x461b7b){return new BPromise(function(_0xff318d,_0x40d49b){return client[_0xbbcb('0xb')](_0x575394,_0x461b7b)[_0xbbcb('0xc')](function(_0x37172c){logger['info'](_0xbbcb('0xd'),_0x872e11,_0xbbcb('0xe'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x872e11,_0xbbcb('0xe'),JSON[_0xbbcb('0xf')](_0x37172c));if(_0x37172c[_0xbbcb('0x10')]){if(_0x37172c[_0xbbcb('0x10')]['code']===0x1f4){logger['error'](_0xbbcb('0xd'),_0x872e11,_0x37172c[_0xbbcb('0x10')][_0xbbcb('0x11')]);return _0x40d49b(_0x37172c['error']['message']);}logger[_0xbbcb('0x10')](_0xbbcb('0xd'),_0x872e11,_0x37172c['error'][_0xbbcb('0x11')]);return _0xff318d(_0x37172c[_0xbbcb('0x10')][_0xbbcb('0x11')]);}else{logger['info'](_0xbbcb('0xd'),_0x872e11,_0xbbcb('0xe'));_0xff318d(_0x37172c[_0xbbcb('0x12')][_0xbbcb('0x11')]);}})['catch'](function(_0x42e00f){logger[_0xbbcb('0x10')](_0xbbcb('0xd'),_0x872e11,_0x42e00f);_0x40d49b(_0x42e00f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6802405..32086d5 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 _0xc05b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xc05b,0x96));var _0xbc05=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xc05b[_0x334599];return _0x4cdff2;};'use strict';var multer=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var path=require(_0xbc05('0x2'));var timeout=require(_0xbc05('0x3'));var express=require(_0xbc05('0x4'));var router=express[_0xbc05('0x5')]();var fs_extra=require(_0xbc05('0x6'));var auth=require(_0xbc05('0x7'));var interaction=require(_0xbc05('0x8'));var config=require('../../config/environment');var controller=require(_0xbc05('0x9'));router[_0xbc05('0xa')]('/',auth[_0xbc05('0xb')](),controller[_0xbc05('0xc')]);router[_0xbc05('0xa')](_0xbc05('0xd'),auth[_0xbc05('0xb')](),controller[_0xbc05('0xe')]);router[_0xbc05('0xa')](_0xbc05('0xf'),auth[_0xbc05('0xb')](),controller[_0xbc05('0x10')]);router[_0xbc05('0x11')]('/',auth[_0xbc05('0xb')](),controller[_0xbc05('0x12')]);router['put'](_0xbc05('0xd'),auth[_0xbc05('0xb')](),controller['update']);router[_0xbc05('0x13')](_0xbc05('0xd'),auth['isAuthenticated'](),controller[_0xbc05('0x14')]);module[_0xbc05('0x15')]=router; \ No newline at end of file +var _0x6055=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x6055,0xf2));var _0x5605=function(_0x4745e8,_0x1553cb){_0x4745e8=_0x4745e8-0x0;var _0x2f5b37=_0x6055[_0x4745e8];return _0x2f5b37;};'use strict';var multer=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var path=require('path');var timeout=require(_0x5605('0x2'));var express=require(_0x5605('0x3'));var router=express[_0x5605('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5605('0x5'));var controller=require(_0x5605('0x6'));router[_0x5605('0x7')]('/',auth[_0x5605('0x8')](),controller[_0x5605('0x9')]);router[_0x5605('0x7')](_0x5605('0xa'),auth['isAuthenticated'](),controller[_0x5605('0xb')]);router['get']('/:id/download',auth[_0x5605('0x8')](),controller[_0x5605('0xc')]);router[_0x5605('0xd')]('/',auth[_0x5605('0x8')](),controller[_0x5605('0xe')]);router[_0x5605('0xf')](_0x5605('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5605('0x10')](_0x5605('0xa'),auth[_0x5605('0x8')](),controller[_0x5605('0x11')]);module[_0x5605('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8cdbe25..9011773 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 _0x1e8a=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1e8a,0x16a));var _0xa1e8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1e8a[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xa1e8('0x0'));module[_0xa1e8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4eb92c){return this[_0xa1e8('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa1e8('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa1e8('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa1e8('0x4')],'defaultValue':''},'stamp':{'type':_0xa1e8('0x6'),'defaultValue':Sequelize[_0xa1e8('0x7')](_0xa1e8('0x8'))}}; \ No newline at end of file +var _0xa70a=['literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa70a,0x12d));var _0xaa70=function(_0x81117a,_0x5ebc90){_0x81117a=_0x81117a-0x0;var _0x5ca829=_0xa70a[_0x81117a];return _0x5ca829;};'use strict';var Sequelize=require(_0xaa70('0x0'));module[_0xaa70('0x1')]={'name':{'type':Sequelize[_0xaa70('0x2')],'get':function(_0x5c2e45){return this[_0xaa70('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xaa70('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xaa70('0x6')](_0xaa70('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xaa70('0x5')],'defaultValue':''},'stamp':{'type':_0xaa70('0x8'),'defaultValue':Sequelize[_0xaa70('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d0a59a7..1534935 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 _0xd8c7=['fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xd8c7,0x145));var _0x7d8c=function(_0x5daae8,_0x46ca08){_0x5daae8=_0x5daae8-0x0;var _0x30a227=_0xd8c7[_0x5daae8];return _0x30a227;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d8c('0x0'));var jsonpatch=require(_0x7d8c('0x1'));var rp=require(_0x7d8c('0x2'));var moment=require('moment');var BPromise=require(_0x7d8c('0x3'));var Mustache=require('mustache');var util=require(_0x7d8c('0x4'));var path=require('path');var sox=require(_0x7d8c('0x5'));var csv=require('to-csv');var ejs=require(_0x7d8c('0x6'));var fs=require('fs');var fs_extra=require(_0x7d8c('0x7'));var _=require(_0x7d8c('0x8'));var squel=require(_0x7d8c('0x9'));var crypto=require(_0x7d8c('0xa'));var jsforce=require(_0x7d8c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7d8c('0xc'));var querystring=require(_0x7d8c('0xd'));var Papa=require('papaparse');var Redis=require(_0x7d8c('0xe'));var authService=require(_0x7d8c('0xf'));var qs=require(_0x7d8c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d8c('0x11'))(_0x7d8c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d8c('0x13'));var db=require(_0x7d8c('0x14'))['db'];function respondWithStatusCode(_0xfeb3fb,_0x52dc63){_0x52dc63=_0x52dc63||0xcc;return function(_0x31be91){if(_0x31be91){return _0xfeb3fb[_0x7d8c('0x15')](_0x52dc63);}return _0xfeb3fb[_0x7d8c('0x16')](_0x52dc63)[_0x7d8c('0x17')]();};}function respondWithResult(_0xf08850,_0x5f3aa5){_0x5f3aa5=_0x5f3aa5||0xc8;return function(_0x3824f7){if(_0x3824f7){return _0xf08850[_0x7d8c('0x16')](_0x5f3aa5)[_0x7d8c('0x18')](_0x3824f7);}};}function respondWithFilteredResult(_0x43d09e,_0x47fe80){return function(_0x2b41ee){if(_0x2b41ee){var _0x581b6f=typeof _0x47fe80[_0x7d8c('0x19')]==='undefined'&&typeof _0x47fe80[_0x7d8c('0x1a')]===_0x7d8c('0x1b');var _0x397f4d=_0x2b41ee[_0x7d8c('0x1c')];var _0x502ff0=_0x581b6f?0x0:_0x47fe80[_0x7d8c('0x19')];var _0x4fda43=_0x581b6f?_0x2b41ee[_0x7d8c('0x1c')]:_0x47fe80[_0x7d8c('0x19')]+_0x47fe80[_0x7d8c('0x1a')];var _0x3f9a34;if(_0x4fda43>=_0x397f4d){_0x4fda43=_0x397f4d;_0x3f9a34=0xc8;}else{_0x3f9a34=0xce;}_0x43d09e['status'](_0x3f9a34);return _0x43d09e['set'](_0x7d8c('0x1d'),_0x502ff0+'-'+_0x4fda43+'/'+_0x397f4d)['json'](_0x2b41ee);}return null;};}function patchUpdates(_0x5073c6){return function(_0x46816c){try{jsonpatch['apply'](_0x46816c,_0x5073c6,!![]);}catch(_0x25df9b){return BPromise[_0x7d8c('0x1e')](_0x25df9b);}return _0x46816c[_0x7d8c('0x1f')]();};}function saveUpdates(_0x54de5b,_0x2554fa){return function(_0x1c94b3){if(_0x1c94b3){return _0x1c94b3['update'](_0x54de5b)[_0x7d8c('0x20')](function(_0x21d5c7){return _0x21d5c7;});}return null;};}function removeEntity(_0x493b56,_0xd2366e){return function(_0x22c7f6){if(_0x22c7f6){return _0x22c7f6[_0x7d8c('0x21')]()[_0x7d8c('0x20')](function(){_0x493b56[_0x7d8c('0x16')](0xcc)[_0x7d8c('0x17')]();});}};}function handleEntityNotFound(_0x3df4c7,_0x4f2350){return function(_0x1144a1){if(!_0x1144a1){_0x3df4c7['sendStatus'](0x194);}return _0x1144a1;};}function handleError(_0x16697d,_0x337020){_0x337020=_0x337020||0x1f4;return function(_0x2bb682){logger[_0x7d8c('0x22')](_0x2bb682[_0x7d8c('0x23')]);if(_0x2bb682[_0x7d8c('0x24')]){delete _0x2bb682[_0x7d8c('0x24')];}_0x16697d[_0x7d8c('0x16')](_0x337020)['send'](_0x2bb682);};}exports[_0x7d8c('0x25')]=function(_0x4f3bb8,_0xa0e65a){var _0x1ba42c={},_0x5b677e={},_0x5e926a={'count':0x0,'rows':[]};var _0x400845=_[_0x7d8c('0x26')](db[_0x7d8c('0x27')]['rawAttributes'],function(_0x339650){return{'name':_0x339650[_0x7d8c('0x28')],'type':_0x339650[_0x7d8c('0x29')][_0x7d8c('0x2a')]};});_0x5b677e[_0x7d8c('0x2b')]=_[_0x7d8c('0x2c')](_[_0x7d8c('0x26')](_0x400845,_0x7d8c('0x24')),[_0x7d8c('0x24')]);_0x5b677e['query']=_[_0x7d8c('0x2d')](_0x4f3bb8[_0x7d8c('0x2e')]);_0x5b677e['filters']=_[_0x7d8c('0x2f')](_0x5b677e[_0x7d8c('0x2b')],_0x5b677e[_0x7d8c('0x2e')]);_0x1ba42c['attributes']=_['intersection'](_0x5b677e[_0x7d8c('0x2b')],qs[_0x7d8c('0x30')](_0x4f3bb8['query'][_0x7d8c('0x30')]));_0x1ba42c[_0x7d8c('0x31')]=_0x1ba42c[_0x7d8c('0x31')]['length']?_0x1ba42c['attributes']:_0x5b677e[_0x7d8c('0x2b')];if(!_0x4f3bb8[_0x7d8c('0x2e')][_0x7d8c('0x32')](_0x7d8c('0x33'))){_0x1ba42c[_0x7d8c('0x1a')]=qs[_0x7d8c('0x1a')](_0x4f3bb8[_0x7d8c('0x2e')]['limit']);_0x1ba42c[_0x7d8c('0x19')]=qs['offset'](_0x4f3bb8['query'][_0x7d8c('0x19')]);}_0x1ba42c[_0x7d8c('0x34')]=qs[_0x7d8c('0x35')](_0x4f3bb8[_0x7d8c('0x2e')][_0x7d8c('0x35')]);_0x1ba42c[_0x7d8c('0x36')]=qs['filters'](_[_0x7d8c('0x37')](_0x4f3bb8[_0x7d8c('0x2e')],_0x5b677e[_0x7d8c('0x38')]),_0x400845);if(_0x4f3bb8['query'][_0x7d8c('0x39')]){_0x1ba42c[_0x7d8c('0x36')]=_[_0x7d8c('0x3a')](_0x1ba42c['where'],{'$or':_[_0x7d8c('0x26')](_0x400845,function(_0x25dc45){if(_0x25dc45[_0x7d8c('0x29')]!==_0x7d8c('0x3b')){var _0x5e01b4={};_0x5e01b4[_0x25dc45[_0x7d8c('0x24')]]={'$like':'%'+_0x4f3bb8[_0x7d8c('0x2e')][_0x7d8c('0x39')]+'%'};return _0x5e01b4;}})});}_0x1ba42c=_[_0x7d8c('0x3a')]({},_0x1ba42c,_0x4f3bb8[_0x7d8c('0x3c')]);var _0x11bfa3={'where':_0x1ba42c['where']};return db[_0x7d8c('0x27')][_0x7d8c('0x1c')](_0x11bfa3)['then'](function(_0x4c4e67){_0x5e926a[_0x7d8c('0x1c')]=_0x4c4e67;if(_0x4f3bb8[_0x7d8c('0x2e')]['includeAll']){_0x1ba42c[_0x7d8c('0x3d')]=[{'all':!![]}];}return db[_0x7d8c('0x27')][_0x7d8c('0x3e')](_0x1ba42c);})[_0x7d8c('0x20')](function(_0x3dad14){_0x5e926a[_0x7d8c('0x3f')]=_0x3dad14;return _0x5e926a;})['then'](respondWithFilteredResult(_0xa0e65a,_0x1ba42c))[_0x7d8c('0x40')](handleError(_0xa0e65a,null));};exports[_0x7d8c('0x41')]=function(_0xf5e322,_0x2a3c3d){var _0x3eaa08={'raw':!![],'where':{'id':_0xf5e322['params']['id']}},_0x15195e={};_0x15195e[_0x7d8c('0x2b')]=_[_0x7d8c('0x2d')](db[_0x7d8c('0x27')][_0x7d8c('0x42')]);_0x15195e[_0x7d8c('0x2e')]=_[_0x7d8c('0x2d')](_0xf5e322[_0x7d8c('0x2e')]);_0x15195e['filters']=_[_0x7d8c('0x2f')](_0x15195e[_0x7d8c('0x2b')],_0x15195e['query']);_0x3eaa08[_0x7d8c('0x31')]=_[_0x7d8c('0x2f')](_0x15195e[_0x7d8c('0x2b')],qs[_0x7d8c('0x30')](_0xf5e322[_0x7d8c('0x2e')][_0x7d8c('0x30')]));_0x3eaa08['attributes']=_0x3eaa08[_0x7d8c('0x31')][_0x7d8c('0x43')]?_0x3eaa08[_0x7d8c('0x31')]:_0x15195e['model'];if(_0xf5e322[_0x7d8c('0x2e')][_0x7d8c('0x44')]){_0x3eaa08[_0x7d8c('0x3d')]=[{'all':!![]}];}_0x3eaa08=_[_0x7d8c('0x3a')]({},_0x3eaa08,_0xf5e322[_0x7d8c('0x3c')]);return db[_0x7d8c('0x27')][_0x7d8c('0x45')](_0x3eaa08)[_0x7d8c('0x20')](handleEntityNotFound(_0x2a3c3d,null))[_0x7d8c('0x20')](respondWithResult(_0x2a3c3d,null))['catch'](handleError(_0x2a3c3d,null));};exports[_0x7d8c('0x46')]=function(_0x249455,_0x411b67){return db[_0x7d8c('0x27')][_0x7d8c('0x46')](_0x249455[_0x7d8c('0x47')],{})[_0x7d8c('0x20')](respondWithResult(_0x411b67,0xc9))[_0x7d8c('0x40')](handleError(_0x411b67,null));};exports['update']=function(_0x583fbc,_0xe1ecf0){if(_0x583fbc[_0x7d8c('0x47')]['id']){delete _0x583fbc['body']['id'];}return db[_0x7d8c('0x27')][_0x7d8c('0x45')]({'where':{'id':_0x583fbc['params']['id']}})[_0x7d8c('0x20')](handleEntityNotFound(_0xe1ecf0,null))['then'](saveUpdates(_0x583fbc[_0x7d8c('0x47')],null))['then'](respondWithResult(_0xe1ecf0,null))[_0x7d8c('0x40')](handleError(_0xe1ecf0,null));};exports[_0x7d8c('0x21')]=function(_0x4cccb8,_0x1edb3a){return db['VoiceMailMessage'][_0x7d8c('0x45')]({'where':{'id':_0x4cccb8[_0x7d8c('0x48')]['id']}})[_0x7d8c('0x20')](handleEntityNotFound(_0x1edb3a,null))[_0x7d8c('0x20')](removeEntity(_0x1edb3a,null))['catch'](handleError(_0x1edb3a,null));};exports[_0x7d8c('0x49')]=function(_0x117482,_0x118e6d,_0x3ddca6){return db[_0x7d8c('0x27')][_0x7d8c('0x45')]({'where':{'id':_0x117482[_0x7d8c('0x48')]['id']},'attributes':['id',_0x7d8c('0x4a'),_0x7d8c('0x4b')]})[_0x7d8c('0x20')](handleEntityNotFound(_0x118e6d,null))[_0x7d8c('0x20')](function(_0x3d2a39){if(_0x3d2a39){if(!_0x3d2a39[_0x7d8c('0x4a')]){throw new db[(_0x7d8c('0x4c'))]['ValidationError'](_0x7d8c('0x4d'));}var _0x53e9be={'Content-Type':_0x7d8c('0x4e'),'Content-Disposition':'attachment'};if(_0x3d2a39[_0x7d8c('0x4b')]){_0x53e9be[_0x7d8c('0x4f')]=_0x7d8c('0x50')+_0x3d2a39[_0x7d8c('0x4b')]+_0x7d8c('0x51');}_0x118e6d[_0x7d8c('0x52')](_0x53e9be);return _0x118e6d['send'](new Buffer(_0x3d2a39[_0x7d8c('0x4a')]));}})[_0x7d8c('0x40')](handleError(_0x118e6d,null));}; \ No newline at end of file +var _0x9f0c=['download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','name','send','VoiceMailMessage','type','key','model','differenceBy','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','body'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0x9f0c,0x155));var _0xc9f0=function(_0x54c31f,_0x380def){_0x54c31f=_0x54c31f-0x0;var _0x101899=_0x9f0c[_0x54c31f];return _0x101899;};'use strict';var emlformat=require(_0xc9f0('0x0'));var rimraf=require(_0xc9f0('0x1'));var zipdir=require(_0xc9f0('0x2'));var jsonpatch=require(_0xc9f0('0x3'));var rp=require(_0xc9f0('0x4'));var moment=require(_0xc9f0('0x5'));var BPromise=require(_0xc9f0('0x6'));var Mustache=require('mustache');var util=require(_0xc9f0('0x7'));var path=require(_0xc9f0('0x8'));var sox=require('sox');var csv=require(_0xc9f0('0x9'));var ejs=require(_0xc9f0('0xa'));var fs=require('fs');var fs_extra=require(_0xc9f0('0xb'));var _=require(_0xc9f0('0xc'));var squel=require(_0xc9f0('0xd'));var crypto=require(_0xc9f0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9f0('0x9'));var querystring=require(_0xc9f0('0xf'));var Papa=require(_0xc9f0('0x10'));var Redis=require(_0xc9f0('0x11'));var authService=require(_0xc9f0('0x12'));var qs=require(_0xc9f0('0x13'));var as=require(_0xc9f0('0x14'));var hardwareService=require(_0xc9f0('0x15'));var logger=require(_0xc9f0('0x16'))('api');var utils=require(_0xc9f0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9f0('0x18'))['db'];function respondWithStatusCode(_0x55a329,_0x1c1835){_0x1c1835=_0x1c1835||0xcc;return function(_0x3d7f41){if(_0x3d7f41){return _0x55a329[_0xc9f0('0x19')](_0x1c1835);}return _0x55a329[_0xc9f0('0x1a')](_0x1c1835)[_0xc9f0('0x1b')]();};}function respondWithResult(_0x1ba860,_0x336a37){_0x336a37=_0x336a37||0xc8;return function(_0x3fc56f){if(_0x3fc56f){return _0x1ba860[_0xc9f0('0x1a')](_0x336a37)['json'](_0x3fc56f);}};}function respondWithFilteredResult(_0x3adbfc,_0x4ae727){return function(_0x49a1a0){if(_0x49a1a0){var _0x11dc08=typeof _0x4ae727[_0xc9f0('0x1c')]==='undefined'&&typeof _0x4ae727['limit']===_0xc9f0('0x1d');var _0x5f4b01=_0x49a1a0[_0xc9f0('0x1e')];var _0x5b0ce9=_0x11dc08?0x0:_0x4ae727['offset'];var _0x488bb2=_0x11dc08?_0x49a1a0['count']:_0x4ae727['offset']+_0x4ae727[_0xc9f0('0x1f')];var _0x3c625c;if(_0x488bb2>=_0x5f4b01){_0x488bb2=_0x5f4b01;_0x3c625c=0xc8;}else{_0x3c625c=0xce;}_0x3adbfc[_0xc9f0('0x1a')](_0x3c625c);return _0x3adbfc['set'](_0xc9f0('0x20'),_0x5b0ce9+'-'+_0x488bb2+'/'+_0x5f4b01)[_0xc9f0('0x21')](_0x49a1a0);}return null;};}function patchUpdates(_0x4dcb72){return function(_0x1775c8){try{jsonpatch[_0xc9f0('0x22')](_0x1775c8,_0x4dcb72,!![]);}catch(_0x49e6cf){return BPromise['reject'](_0x49e6cf);}return _0x1775c8[_0xc9f0('0x23')]();};}function saveUpdates(_0xdcfd79,_0x20a1d9){return function(_0x308470){if(_0x308470){return _0x308470[_0xc9f0('0x24')](_0xdcfd79)[_0xc9f0('0x25')](function(_0x27e26){return _0x27e26;});}return null;};}function removeEntity(_0x5abc96,_0x286b05){return function(_0x5344a5){if(_0x5344a5){return _0x5344a5[_0xc9f0('0x26')]()['then'](function(){_0x5abc96[_0xc9f0('0x1a')](0xcc)[_0xc9f0('0x1b')]();});}};}function handleEntityNotFound(_0x24ca44,_0x133456){return function(_0x2628e){if(!_0x2628e){_0x24ca44[_0xc9f0('0x19')](0x194);}return _0x2628e;};}function handleError(_0x20044d,_0x39df0c){_0x39df0c=_0x39df0c||0x1f4;return function(_0x56279d){logger[_0xc9f0('0x27')](_0x56279d['stack']);if(_0x56279d['name']){delete _0x56279d[_0xc9f0('0x28')];}_0x20044d[_0xc9f0('0x1a')](_0x39df0c)[_0xc9f0('0x29')](_0x56279d);};}exports['index']=function(_0x585eeb,_0x55964c){var _0x2cb604={},_0x411a0c={},_0x483e6d={'count':0x0,'rows':[]};var _0x56a00f=_['map'](db[_0xc9f0('0x2a')]['rawAttributes'],function(_0xda5d67){return{'name':_0xda5d67['fieldName'],'type':_0xda5d67[_0xc9f0('0x2b')][_0xc9f0('0x2c')]};});_0x411a0c[_0xc9f0('0x2d')]=_[_0xc9f0('0x2e')](_[_0xc9f0('0x2f')](_0x56a00f,_0xc9f0('0x28')),[_0xc9f0('0x28')]);_0x411a0c[_0xc9f0('0x30')]=_['keys'](_0x585eeb[_0xc9f0('0x30')]);_0x411a0c['filters']=_[_0xc9f0('0x31')](_0x411a0c[_0xc9f0('0x2d')],_0x411a0c[_0xc9f0('0x30')]);_0x2cb604[_0xc9f0('0x32')]=_[_0xc9f0('0x31')](_0x411a0c[_0xc9f0('0x2d')],qs[_0xc9f0('0x33')](_0x585eeb['query'][_0xc9f0('0x33')]));_0x2cb604[_0xc9f0('0x32')]=_0x2cb604[_0xc9f0('0x32')][_0xc9f0('0x34')]?_0x2cb604[_0xc9f0('0x32')]:_0x411a0c[_0xc9f0('0x2d')];if(!_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x35')](_0xc9f0('0x36'))){_0x2cb604[_0xc9f0('0x1f')]=qs['limit'](_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x1f')]);_0x2cb604[_0xc9f0('0x1c')]=qs['offset'](_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x1c')]);}_0x2cb604[_0xc9f0('0x37')]=qs[_0xc9f0('0x38')](_0x585eeb['query'][_0xc9f0('0x38')]);_0x2cb604['where']=qs[_0xc9f0('0x39')](_[_0xc9f0('0x3a')](_0x585eeb[_0xc9f0('0x30')],_0x411a0c[_0xc9f0('0x39')]),_0x56a00f);if(_0x585eeb[_0xc9f0('0x30')]['filter']){_0x2cb604[_0xc9f0('0x3b')]=_[_0xc9f0('0x3c')](_0x2cb604[_0xc9f0('0x3b')],{'$or':_[_0xc9f0('0x2f')](_0x56a00f,function(_0xa163ba){if(_0xa163ba['type']!==_0xc9f0('0x3d')){var _0x4b2349={};_0x4b2349[_0xa163ba[_0xc9f0('0x28')]]={'$like':'%'+_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x3e')]+'%'};return _0x4b2349;}})});}_0x2cb604=_[_0xc9f0('0x3c')]({},_0x2cb604,_0x585eeb['options']);var _0x5092f6={'where':_0x2cb604['where']};return db[_0xc9f0('0x2a')]['count'](_0x5092f6)[_0xc9f0('0x25')](function(_0x59f386){_0x483e6d[_0xc9f0('0x1e')]=_0x59f386;if(_0x585eeb[_0xc9f0('0x30')][_0xc9f0('0x3f')]){_0x2cb604[_0xc9f0('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xc9f0('0x41')](_0x2cb604);})[_0xc9f0('0x25')](function(_0x5e904d){_0x483e6d['rows']=_0x5e904d;return _0x483e6d;})['then'](respondWithFilteredResult(_0x55964c,_0x2cb604))['catch'](handleError(_0x55964c,null));};exports[_0xc9f0('0x42')]=function(_0x55226e,_0x5733ef){var _0x6ce606={'raw':!![],'where':{'id':_0x55226e[_0xc9f0('0x43')]['id']}},_0x5af9f0={};_0x5af9f0[_0xc9f0('0x2d')]=_[_0xc9f0('0x44')](db[_0xc9f0('0x2a')][_0xc9f0('0x45')]);_0x5af9f0[_0xc9f0('0x30')]=_[_0xc9f0('0x44')](_0x55226e[_0xc9f0('0x30')]);_0x5af9f0[_0xc9f0('0x39')]=_[_0xc9f0('0x31')](_0x5af9f0[_0xc9f0('0x2d')],_0x5af9f0[_0xc9f0('0x30')]);_0x6ce606[_0xc9f0('0x32')]=_[_0xc9f0('0x31')](_0x5af9f0[_0xc9f0('0x2d')],qs[_0xc9f0('0x33')](_0x55226e[_0xc9f0('0x30')][_0xc9f0('0x33')]));_0x6ce606['attributes']=_0x6ce606[_0xc9f0('0x32')][_0xc9f0('0x34')]?_0x6ce606[_0xc9f0('0x32')]:_0x5af9f0['model'];if(_0x55226e[_0xc9f0('0x30')][_0xc9f0('0x3f')]){_0x6ce606[_0xc9f0('0x40')]=[{'all':!![]}];}_0x6ce606=_['merge']({},_0x6ce606,_0x55226e[_0xc9f0('0x46')]);return db[_0xc9f0('0x2a')][_0xc9f0('0x47')](_0x6ce606)[_0xc9f0('0x25')](handleEntityNotFound(_0x5733ef,null))['then'](respondWithResult(_0x5733ef,null))[_0xc9f0('0x48')](handleError(_0x5733ef,null));};exports['create']=function(_0x6c2d7c,_0x58cd77){return db[_0xc9f0('0x2a')]['create'](_0x6c2d7c['body'],{})[_0xc9f0('0x25')](respondWithResult(_0x58cd77,0xc9))[_0xc9f0('0x48')](handleError(_0x58cd77,null));};exports['update']=function(_0x595f9e,_0x4587a4){if(_0x595f9e[_0xc9f0('0x49')]['id']){delete _0x595f9e[_0xc9f0('0x49')]['id'];}return db[_0xc9f0('0x2a')][_0xc9f0('0x47')]({'where':{'id':_0x595f9e[_0xc9f0('0x43')]['id']}})[_0xc9f0('0x25')](handleEntityNotFound(_0x4587a4,null))[_0xc9f0('0x25')](saveUpdates(_0x595f9e[_0xc9f0('0x49')],null))[_0xc9f0('0x25')](respondWithResult(_0x4587a4,null))[_0xc9f0('0x48')](handleError(_0x4587a4,null));};exports[_0xc9f0('0x26')]=function(_0x31004c,_0x3a10c2){return db[_0xc9f0('0x2a')][_0xc9f0('0x47')]({'where':{'id':_0x31004c[_0xc9f0('0x43')]['id']}})[_0xc9f0('0x25')](handleEntityNotFound(_0x3a10c2,null))['then'](removeEntity(_0x3a10c2,null))[_0xc9f0('0x48')](handleError(_0x3a10c2,null));};exports[_0xc9f0('0x4a')]=function(_0x4dbce6,_0x293dd5,_0x1f105e){return db[_0xc9f0('0x2a')]['find']({'where':{'id':_0x4dbce6[_0xc9f0('0x43')]['id']},'attributes':['id',_0xc9f0('0x4b'),_0xc9f0('0x4c')]})[_0xc9f0('0x25')](handleEntityNotFound(_0x293dd5,null))[_0xc9f0('0x25')](function(_0x32c221){if(_0x32c221){if(!_0x32c221['recording']){throw new db[(_0xc9f0('0x4d'))][(_0xc9f0('0x4e'))](_0xc9f0('0x4f'));}var _0x8b7b12={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x32c221[_0xc9f0('0x4c')]){_0x8b7b12[_0xc9f0('0x50')]=_0xc9f0('0x51')+_0x32c221['msg_id']+_0xc9f0('0x52');}_0x293dd5['set'](_0x8b7b12);return _0x293dd5['send'](new Buffer(_0x32c221[_0xc9f0('0x4b')]));}})['catch'](handleError(_0x293dd5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 064ab8e..6e0544a 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 _0x6a8f=['VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x424bd3,_0x8760d8){var _0x1fdade=function(_0x510862){while(--_0x510862){_0x424bd3['push'](_0x424bd3['shift']());}};_0x1fdade(++_0x8760d8);}(_0x6a8f,0x101));var _0xf6a8=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0x6a8f[_0x26dd9a];return _0x32c5f8;};'use strict';var _=require(_0xf6a8('0x0'));var util=require(_0xf6a8('0x1'));var logger=require(_0xf6a8('0x2'))(_0xf6a8('0x3'));var moment=require(_0xf6a8('0x4'));var BPromise=require(_0xf6a8('0x5'));var rp=require(_0xf6a8('0x6'));var fs=require('fs');var path=require(_0xf6a8('0x7'));var rimraf=require(_0xf6a8('0x8'));var config=require(_0xf6a8('0x9'));var attributes=require(_0xf6a8('0xa'));module[_0xf6a8('0xb')]=function(_0x18df7a,_0x4f29a6){return _0x18df7a[_0xf6a8('0xc')](_0xf6a8('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf6a8('0xe'),'fields':[_0xf6a8('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf111=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x4a6a1a,_0x36d024){var _0x2b02f6=function(_0x2ea1f3){while(--_0x2ea1f3){_0x4a6a1a['push'](_0x4a6a1a['shift']());}};_0x2b02f6(++_0x36d024);}(_0xf111,0xb6));var _0x1f11=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xf111[_0x239dba];return _0x1ceb11;};'use strict';var _=require(_0x1f11('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1f11('0x1'));var moment=require(_0x1f11('0x2'));var BPromise=require(_0x1f11('0x3'));var rp=require(_0x1f11('0x4'));var fs=require('fs');var path=require(_0x1f11('0x5'));var rimraf=require(_0x1f11('0x6'));var config=require(_0x1f11('0x7'));var attributes=require(_0x1f11('0x8'));module[_0x1f11('0x9')]=function(_0x26f5d3,_0x536f35){return _0x26f5d3[_0x1f11('0xa')](_0x1f11('0xb'),attributes,{'tableName':_0x1f11('0xc'),'paranoid':![],'indexes':[{'name':_0x1f11('0xd'),'fields':[_0x1f11('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4325f4f..cacf4ca 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 _0x6c43=['message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x6c43,0x96));var _0x36c4=function(_0x25096c,_0x4b39ad){_0x25096c=_0x25096c-0x0;var _0x20319d=_0x6c43[_0x25096c];return _0x20319d;};'use strict';var _=require('lodash');var util=require(_0x36c4('0x0'));var moment=require(_0x36c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x36c4('0x2'));var fs=require('fs');var Redis=require(_0x36c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x36c4('0x4'));var logger=require(_0x36c4('0x5'))(_0x36c4('0x6'));var config=require(_0x36c4('0x7'));var jayson=require(_0x36c4('0x8'));var client=jayson[_0x36c4('0x9')][_0x36c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17f1d5,_0x36299b,_0x323b08){return new BPromise(function(_0x4e85c7,_0x110b87){return client['request'](_0x17f1d5,_0x323b08)['then'](function(_0x48e337){logger[_0x36c4('0xb')](_0x36c4('0xc'),_0x36299b,_0x36c4('0xd'));logger[_0x36c4('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x36299b,_0x36c4('0xd'),JSON[_0x36c4('0xf')](_0x48e337));if(_0x48e337['error']){if(_0x48e337[_0x36c4('0x10')][_0x36c4('0x11')]===0x1f4){logger['error'](_0x36c4('0xc'),_0x36299b,_0x48e337['error'][_0x36c4('0x12')]);return _0x110b87(_0x48e337['error'][_0x36c4('0x12')]);}logger['error'](_0x36c4('0xc'),_0x36299b,_0x48e337['error'][_0x36c4('0x12')]);return _0x4e85c7(_0x48e337['error'][_0x36c4('0x12')]);}else{logger[_0x36c4('0xb')](_0x36c4('0xc'),_0x36299b,_0x36c4('0xd'));_0x4e85c7(_0x48e337[_0x36c4('0x13')][_0x36c4('0x12')]);}})[_0x36c4('0x14')](function(_0x397cbc){logger['error'](_0x36c4('0xc'),_0x36299b,_0x397cbc);_0x110b87(_0x397cbc);});});} \ No newline at end of file +var _0xf8ff=['message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x13c98a,_0x5ec21c){var _0x5e9cbf=function(_0x378e8c){while(--_0x378e8c){_0x13c98a['push'](_0x13c98a['shift']());}};_0x5e9cbf(++_0x5ec21c);}(_0xf8ff,0x1bb));var _0xff8f=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf8ff[_0x13b7fd];return _0x32a74a;};'use strict';var _=require(_0xff8f('0x0'));var util=require('util');var moment=require(_0xff8f('0x1'));var BPromise=require(_0xff8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff8f('0x3'));var db=require(_0xff8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff8f('0x5'))(_0xff8f('0x6'));var config=require(_0xff8f('0x7'));var jayson=require(_0xff8f('0x8'));var client=jayson['client'][_0xff8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x266b8c,_0x285dce,_0x4d95ae){return new BPromise(function(_0x43e8db,_0x31bf68){return client[_0xff8f('0xa')](_0x266b8c,_0x4d95ae)[_0xff8f('0xb')](function(_0x2db775){logger[_0xff8f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x285dce,_0xff8f('0xd'));logger[_0xff8f('0xe')](_0xff8f('0xf'),_0x285dce,_0xff8f('0xd'),JSON[_0xff8f('0x10')](_0x2db775));if(_0x2db775[_0xff8f('0x11')]){if(_0x2db775[_0xff8f('0x11')]['code']===0x1f4){logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0x2db775['error'][_0xff8f('0x13')]);return _0x31bf68(_0x2db775[_0xff8f('0x11')]['message']);}logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0x2db775['error'][_0xff8f('0x13')]);return _0x43e8db(_0x2db775[_0xff8f('0x11')][_0xff8f('0x13')]);}else{logger['info'](_0xff8f('0x12'),_0x285dce,_0xff8f('0xd'));_0x43e8db(_0x2db775['result'][_0xff8f('0x13')]);}})[_0xff8f('0x14')](function(_0xf949b4){logger[_0xff8f('0x11')](_0xff8f('0x12'),_0x285dce,_0xf949b4);_0x31bf68(_0xf949b4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bcf6742..759b9e8 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 _0xebe1=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','removeSound','exports','multer'];(function(_0x620ae1,_0x55d56a){var _0x215500=function(_0x357fa6){while(--_0x357fa6){_0x620ae1['push'](_0x620ae1['shift']());}};_0x215500(++_0x55d56a);}(_0xebe1,0x1c1));var _0x1ebe=function(_0x3ca5f4,_0x4d3bc7){_0x3ca5f4=_0x3ca5f4-0x0;var _0x59cfac=_0xebe1[_0x3ca5f4];return _0x59cfac;};'use strict';var multer=require(_0x1ebe('0x0'));var util=require(_0x1ebe('0x1'));var path=require('path');var timeout=require(_0x1ebe('0x2'));var express=require(_0x1ebe('0x3'));var router=express[_0x1ebe('0x4')]();var fs_extra=require(_0x1ebe('0x5'));var auth=require(_0x1ebe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ebe('0x7'));var controller=require(_0x1ebe('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ebe('0x9')]);router[_0x1ebe('0xa')](_0x1ebe('0xb'),auth[_0x1ebe('0xc')](),controller[_0x1ebe('0xd')]);router[_0x1ebe('0xa')](_0x1ebe('0xe'),auth[_0x1ebe('0xc')](),controller[_0x1ebe('0xf')]);router[_0x1ebe('0x10')]('/',auth[_0x1ebe('0xc')](),controller[_0x1ebe('0x11')]);router[_0x1ebe('0x10')]('/:id/sounds',auth[_0x1ebe('0xc')](),controller[_0x1ebe('0x12')]);router[_0x1ebe('0x13')](_0x1ebe('0xb'),auth['isAuthenticated'](),controller[_0x1ebe('0x14')]);router[_0x1ebe('0x15')]('/:id',auth[_0x1ebe('0xc')](),controller[_0x1ebe('0x16')]);router[_0x1ebe('0x15')]('/:id/sounds/:id2',auth[_0x1ebe('0xc')](),controller[_0x1ebe('0x17')]);module[_0x1ebe('0x18')]=router; \ No newline at end of file +var _0xfbf1=['create','addSound','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post'];(function(_0x3f696b,_0x2a9051){var _0x57aa53=function(_0x4b46b3){while(--_0x4b46b3){_0x3f696b['push'](_0x3f696b['shift']());}};_0x57aa53(++_0x2a9051);}(_0xfbf1,0x139));var _0x1fbf=function(_0x32f2c7,_0x4bdbcc){_0x32f2c7=_0x32f2c7-0x0;var _0x17c296=_0xfbf1[_0x32f2c7];return _0x17c296;};'use strict';var multer=require(_0x1fbf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1fbf('0x1'));var router=express['Router']();var fs_extra=require(_0x1fbf('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1fbf('0x3'));var config=require('../../config/environment');var controller=require(_0x1fbf('0x4'));router[_0x1fbf('0x5')]('/',auth[_0x1fbf('0x6')](),controller['index']);router[_0x1fbf('0x5')](_0x1fbf('0x7'),auth[_0x1fbf('0x6')](),controller['show']);router[_0x1fbf('0x5')](_0x1fbf('0x8'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0x9')]);router[_0x1fbf('0xa')]('/',auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xb')]);router['post'](_0x1fbf('0x8'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xc')]);router[_0x1fbf('0xd')](_0x1fbf('0x7'),auth[_0x1fbf('0x6')](),controller[_0x1fbf('0xe')]);router[_0x1fbf('0xf')](_0x1fbf('0x7'),auth['isAuthenticated'](),controller[_0x1fbf('0x10')]);router[_0x1fbf('0xf')]('/:id/sounds/:id2',auth[_0x1fbf('0x6')](),controller['removeSound']);module[_0x1fbf('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 17d4112..aeab2fc 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 _0x6bbb=['name','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports'];(function(_0x40ddcd,_0x18afb1){var _0x36ca16=function(_0x49f70b){while(--_0x49f70b){_0x40ddcd['push'](_0x40ddcd['shift']());}};_0x36ca16(++_0x18afb1);}(_0x6bbb,0x148));var _0xb6bb=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0x6bbb[_0x114d1f];return _0x5b91d4;};'use strict';var Sequelize=require(_0xb6bb('0x0'));module[_0xb6bb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb6bb('0x2')},'mode':{'type':Sequelize['ENUM']('custom',_0xb6bb('0x3'),_0xb6bb('0x4'),'quietmp3nb',_0xb6bb('0x5'),_0xb6bb('0x6')),'allowNull':!![],'defaultValue':_0xb6bb('0x3')},'directory':{'type':Sequelize[_0xb6bb('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xb6bb('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb6bb('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb6bb('0x7')],'allowNull':!![],'defaultValue':_0xb6bb('0x8')},'format':{'type':Sequelize[_0xb6bb('0x7')],'allowNull':!![]},'stamp':{'type':_0xb6bb('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaacd=['exports','STRING','name','ENUM','custom','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xaacd,0x108));var _0xdaac=function(_0x26c791,_0x4a1f96){_0x26c791=_0x26c791-0x0;var _0x3dbf38=_0xaacd[_0x26c791];return _0x3dbf38;};'use strict';var Sequelize=require('sequelize');module[_0xdaac('0x0')]={'name':{'type':Sequelize[_0xdaac('0x1')],'allowNull':![],'unique':_0xdaac('0x2')},'mode':{'type':Sequelize[_0xdaac('0x3')](_0xdaac('0x4'),'files','mp3nb','quietmp3nb',_0xdaac('0x5'),_0xdaac('0x6')),'allowNull':!![],'defaultValue':_0xdaac('0x7')},'directory':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdaac('0x8')},'format':{'type':Sequelize[_0xdaac('0x1')],'allowNull':!![]},'stamp':{'type':_0xdaac('0x9')},'defaultEntry':{'type':Sequelize[_0xdaac('0xa')],'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 0adc549..41e8359 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 _0x4ea8=['server/files/moh','create','mkdirSync','directory','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','Sound','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','Sequelize','removeSound','findOne','id2','createdAt','getSounds','rawAttributes','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','body','sequelize','transaction','mode','files','join','root'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x4ea8,0x95));var _0x84ea=function(_0x439c81,_0x528b45){_0x439c81=_0x439c81-0x0;var _0x984bfa=_0x4ea8[_0x439c81];return _0x984bfa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84ea('0x0'));var zipdir=require(_0x84ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84ea('0x2'));var BPromise=require(_0x84ea('0x3'));var Mustache=require('mustache');var util=require(_0x84ea('0x4'));var path=require(_0x84ea('0x5'));var sox=require(_0x84ea('0x6'));var csv=require(_0x84ea('0x7'));var ejs=require(_0x84ea('0x8'));var fs=require('fs');var fs_extra=require(_0x84ea('0x9'));var _=require(_0x84ea('0xa'));var squel=require(_0x84ea('0xb'));var crypto=require(_0x84ea('0xc'));var jsforce=require(_0x84ea('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x84ea('0xe'));var Papa=require(_0x84ea('0xf'));var Redis=require(_0x84ea('0x10'));var authService=require(_0x84ea('0x11'));var qs=require(_0x84ea('0x12'));var as=require(_0x84ea('0x13'));var hardwareService=require(_0x84ea('0x14'));var logger=require('../../config/logger')(_0x84ea('0x15'));var utils=require(_0x84ea('0x16'));var config=require(_0x84ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x84ea('0x18'))['db'];function respondWithStatusCode(_0x132a6d,_0x244938){_0x244938=_0x244938||0xcc;return function(_0x5bf7c3){if(_0x5bf7c3){return _0x132a6d[_0x84ea('0x19')](_0x244938);}return _0x132a6d[_0x84ea('0x1a')](_0x244938)[_0x84ea('0x1b')]();};}function respondWithResult(_0xc84afa,_0xeecedb){_0xeecedb=_0xeecedb||0xc8;return function(_0x40c67c){if(_0x40c67c){return _0xc84afa[_0x84ea('0x1a')](_0xeecedb)[_0x84ea('0x1c')](_0x40c67c);}};}function respondWithFilteredResult(_0x17b3d4,_0x1d352a){return function(_0x531ef0){if(_0x531ef0){var _0x213043=typeof _0x1d352a[_0x84ea('0x1d')]==='undefined'&&typeof _0x1d352a[_0x84ea('0x1e')]==='undefined';var _0x425352=_0x531ef0['count'];var _0x3e7adb=_0x213043?0x0:_0x1d352a['offset'];var _0x36211d=_0x213043?_0x531ef0[_0x84ea('0x1f')]:_0x1d352a['offset']+_0x1d352a[_0x84ea('0x1e')];var _0xe51593;if(_0x36211d>=_0x425352){_0x36211d=_0x425352;_0xe51593=0xc8;}else{_0xe51593=0xce;}_0x17b3d4['status'](_0xe51593);return _0x17b3d4[_0x84ea('0x20')](_0x84ea('0x21'),_0x3e7adb+'-'+_0x36211d+'/'+_0x425352)[_0x84ea('0x1c')](_0x531ef0);}return null;};}function patchUpdates(_0x4e5e9d){return function(_0x3ee42c){try{jsonpatch[_0x84ea('0x22')](_0x3ee42c,_0x4e5e9d,!![]);}catch(_0x276159){return BPromise[_0x84ea('0x23')](_0x276159);}return _0x3ee42c[_0x84ea('0x24')]();};}function saveUpdates(_0x178f43,_0x57d756){return function(_0x3728a0){if(_0x3728a0){return _0x3728a0[_0x84ea('0x25')](_0x178f43)[_0x84ea('0x26')](function(_0x26cb10){return _0x26cb10;});}return null;};}function removeEntity(_0x436caa,_0x5916f0){return function(_0x128114){if(_0x128114){return _0x128114[_0x84ea('0x27')]()[_0x84ea('0x26')](function(){var _0x509b83=_0x128114['get']({'plain':!![]});var _0x326311=_0x84ea('0x28');return db[_0x84ea('0x29')][_0x84ea('0x27')]({'where':{'type':_0x326311,'resourceId':_0x509b83['id']}})['then'](function(){return _0x128114;});})[_0x84ea('0x26')](function(){_0x436caa[_0x84ea('0x1a')](0xcc)[_0x84ea('0x1b')]();});}};}function handleEntityNotFound(_0x219547,_0x3186ca){return function(_0x5b98a7){if(!_0x5b98a7){_0x219547[_0x84ea('0x19')](0x194);}return _0x5b98a7;};}function handleError(_0x1b41c5,_0x44a34a){_0x44a34a=_0x44a34a||0x1f4;return function(_0x3d25f2){logger[_0x84ea('0x2a')](_0x3d25f2[_0x84ea('0x2b')]);if(_0x3d25f2[_0x84ea('0x2c')]){delete _0x3d25f2[_0x84ea('0x2c')];}_0x1b41c5['status'](_0x44a34a)[_0x84ea('0x2d')](_0x3d25f2);};}exports[_0x84ea('0x2e')]=function(_0x540272,_0x1c2859){var _0x27173c={},_0x5a7bf7={},_0x246dff={'count':0x0,'rows':[]};var _0x2eec5c=_[_0x84ea('0x2f')](db[_0x84ea('0x30')]['rawAttributes'],function(_0x2097e6){return{'name':_0x2097e6[_0x84ea('0x31')],'type':_0x2097e6[_0x84ea('0x32')]['key']};});_0x5a7bf7[_0x84ea('0x33')]=_[_0x84ea('0x2f')](_0x2eec5c,'name');_0x5a7bf7[_0x84ea('0x34')]=_[_0x84ea('0x35')](_0x540272[_0x84ea('0x34')]);_0x5a7bf7[_0x84ea('0x36')]=_[_0x84ea('0x37')](_0x5a7bf7[_0x84ea('0x33')],_0x5a7bf7['query']);_0x27173c[_0x84ea('0x38')]=_[_0x84ea('0x37')](_0x5a7bf7[_0x84ea('0x33')],qs['fields'](_0x540272['query'][_0x84ea('0x39')]));_0x27173c[_0x84ea('0x38')]=_0x27173c[_0x84ea('0x38')][_0x84ea('0x3a')]?_0x27173c[_0x84ea('0x38')]:_0x5a7bf7[_0x84ea('0x33')];if(!_0x540272[_0x84ea('0x34')][_0x84ea('0x3b')](_0x84ea('0x3c'))){_0x27173c[_0x84ea('0x1e')]=qs[_0x84ea('0x1e')](_0x540272[_0x84ea('0x34')][_0x84ea('0x1e')]);_0x27173c[_0x84ea('0x1d')]=qs[_0x84ea('0x1d')](_0x540272[_0x84ea('0x34')][_0x84ea('0x1d')]);}_0x27173c[_0x84ea('0x3d')]=qs[_0x84ea('0x3e')](_0x540272['query']['sort']);delete _0x540272[_0x84ea('0x34')][_0x84ea('0x3e')];_0x27173c[_0x84ea('0x3f')]=qs[_0x84ea('0x36')](_[_0x84ea('0x40')](_0x540272[_0x84ea('0x34')],_0x5a7bf7[_0x84ea('0x36')]),_0x2eec5c);if(_0x540272[_0x84ea('0x34')][_0x84ea('0x41')]){_0x27173c[_0x84ea('0x3f')]=_['merge'](_0x27173c[_0x84ea('0x3f')],{'$or':_[_0x84ea('0x2f')](_0x2eec5c,function(_0x26c027){if(_0x26c027[_0x84ea('0x32')]!==_0x84ea('0x42')){var _0x400e40={};_0x400e40[_0x26c027[_0x84ea('0x2c')]]={'$like':'%'+_0x540272[_0x84ea('0x34')][_0x84ea('0x41')]+'%'};return _0x400e40;}})});}_0x27173c=_[_0x84ea('0x43')]({},_0x27173c,_0x540272[_0x84ea('0x44')]);var _0x31ef8a={'where':_0x27173c['where']};return db[_0x84ea('0x30')][_0x84ea('0x1f')](_0x31ef8a)[_0x84ea('0x26')](function(_0x3ced9a){_0x246dff[_0x84ea('0x1f')]=_0x3ced9a;if(_0x540272[_0x84ea('0x34')][_0x84ea('0x45')]){_0x27173c[_0x84ea('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x27173c);})[_0x84ea('0x26')](function(_0x22fd06){_0x246dff[_0x84ea('0x47')]=_0x22fd06;return _0x246dff;})[_0x84ea('0x26')](respondWithFilteredResult(_0x1c2859,_0x27173c))[_0x84ea('0x48')](handleError(_0x1c2859,null));};exports[_0x84ea('0x49')]=function(_0x11f052,_0x50036e){var _0xe44425={'raw':![],'where':{'id':_0x11f052[_0x84ea('0x4a')]['id']}},_0x5239e3={};_0x5239e3[_0x84ea('0x33')]=_[_0x84ea('0x35')](db['VoiceMusicOnHold']['rawAttributes']);_0x5239e3[_0x84ea('0x34')]=_[_0x84ea('0x35')](_0x11f052['query']);_0x5239e3[_0x84ea('0x36')]=_[_0x84ea('0x37')](_0x5239e3[_0x84ea('0x33')],_0x5239e3[_0x84ea('0x34')]);_0xe44425['attributes']=_[_0x84ea('0x37')](_0x5239e3[_0x84ea('0x33')],qs[_0x84ea('0x39')](_0x11f052[_0x84ea('0x34')][_0x84ea('0x39')]));_0xe44425[_0x84ea('0x38')]=_0xe44425[_0x84ea('0x38')][_0x84ea('0x3a')]?_0xe44425[_0x84ea('0x38')]:_0x5239e3[_0x84ea('0x33')];if(_0x11f052[_0x84ea('0x34')][_0x84ea('0x45')]){_0xe44425[_0x84ea('0x46')]=[{'all':!![]}];}_0xe44425=_[_0x84ea('0x43')]({},_0xe44425,_0x11f052[_0x84ea('0x44')]);return db['VoiceMusicOnHold'][_0x84ea('0x4b')](_0xe44425)[_0x84ea('0x26')](handleEntityNotFound(_0x50036e,null))[_0x84ea('0x26')](respondWithResult(_0x50036e,null))[_0x84ea('0x48')](handleError(_0x50036e,null));};exports[_0x84ea('0x25')]=function(_0x5d7dcc,_0x2ab0bd){if(_0x5d7dcc[_0x84ea('0x4c')]['id']){delete _0x5d7dcc['body']['id'];}return db['VoiceMusicOnHold'][_0x84ea('0x4b')]({'where':{'id':_0x5d7dcc['params']['id']}})[_0x84ea('0x26')](handleEntityNotFound(_0x2ab0bd,null))[_0x84ea('0x26')](saveUpdates(_0x5d7dcc['body'],null))[_0x84ea('0x26')](respondWithResult(_0x2ab0bd,null))['catch'](handleError(_0x2ab0bd,null));};exports['create']=function(_0x3ef77d,_0x367ada,_0x453267){return db[_0x84ea('0x4d')][_0x84ea('0x4e')](function(_0x10c1a1){if(_0x3ef77d[_0x84ea('0x4c')][_0x84ea('0x4f')]===_0x84ea('0x50')){_0x3ef77d['body']['directory']=path[_0x84ea('0x51')](config[_0x84ea('0x52')],_0x84ea('0x53'),_0x3ef77d[_0x84ea('0x4c')][_0x84ea('0x2c')]);}return db[_0x84ea('0x30')][_0x84ea('0x54')](_0x3ef77d[_0x84ea('0x4c')],{'transaction':_0x10c1a1})[_0x84ea('0x26')](function(_0x29bc53){if(_0x3ef77d[_0x84ea('0x4c')][_0x84ea('0x4f')]===_0x84ea('0x50')){fs[_0x84ea('0x55')](_0x29bc53[_0x84ea('0x56')],parseInt('0777',0x8));}var _0x1f491b=_0x3ef77d[_0x84ea('0x57')][_0x84ea('0x58')]({'plain':!![]});if(!_0x1f491b)throw new Error(_0x84ea('0x59'));if(_0x1f491b[_0x84ea('0x5a')]==='user'){var _0x2e3f7b=_0x29bc53['get']({'plain':!![]});return db[_0x84ea('0x5b')][_0x84ea('0x4b')]({'where':{'name':_0x84ea('0x28'),'userProfileId':_0x1f491b[_0x84ea('0x5c')]},'raw':!![]})[_0x84ea('0x26')](function(_0x496808){if(_0x496808&&_0x496808[_0x84ea('0x5d')]===0x0){return db[_0x84ea('0x29')][_0x84ea('0x54')]({'name':_0x2e3f7b[_0x84ea('0x2c')],'resourceId':_0x2e3f7b['id'],'type':_0x496808[_0x84ea('0x2c')],'sectionId':_0x496808['id']},{})[_0x84ea('0x26')](function(){return _0x29bc53;});}else{return _0x29bc53;}})[_0x84ea('0x48')](function(_0x537902){logger[_0x84ea('0x2a')](_0x84ea('0x5e'),_0x537902);});}return _0x29bc53;});})[_0x84ea('0x26')](respondWithResult(_0x367ada,0xc9))[_0x84ea('0x48')](handleError(_0x367ada,null));};exports['destroy']=function(_0x3b01b6,_0x4ed9f8,_0x4c006a){var _0x24df87;return db[_0x84ea('0x30')][_0x84ea('0x4b')]({'where':{'id':_0x3b01b6[_0x84ea('0x4a')]['id']}})[_0x84ea('0x26')](function(_0x3b445a){if(_0x3b445a){return db[_0x84ea('0x4d')][_0x84ea('0x4e')](function(_0x24d2e9){return _0x3b445a[_0x84ea('0x27')]({'transaction':_0x24d2e9,'raw':!![]})[_0x84ea('0x26')](function(_0x371d50){if(_0x371d50[_0x84ea('0x56')]){fs[_0x84ea('0x5f')](_0x371d50[_0x84ea('0x56')])[_0x84ea('0x60')](function(_0x463646){fs[_0x84ea('0x61')](path[_0x84ea('0x51')](_0x371d50['directory'],_0x463646));});fs[_0x84ea('0x62')](_0x371d50[_0x84ea('0x56')]);}return _0x371d50;});})['catch'](function(_0x42f556){throw new db['Sequelize'][(_0x84ea('0x63'))](_0x42f556[_0x84ea('0x64')]);});}})['then'](handleEntityNotFound(_0x4ed9f8,null))[_0x84ea('0x26')](removeEntity(_0x4ed9f8,null))['catch'](handleError(_0x4ed9f8,null));};exports['addSound']=function(_0x4629ed,_0x2c3bf4,_0x5e3af9){return db['sequelize'][_0x84ea('0x4e')](function(_0x4366b9){var _0x45c0ca;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x4629ed[_0x84ea('0x4a')]['id']}})[_0x84ea('0x26')](function(_0x2d4790){if(_0x2d4790){_0x45c0ca=_0x2d4790;return _0x2d4790['addSound'](_0x4629ed[_0x84ea('0x4c')]['id'],{'transaction':_0x4366b9});}})[_0x84ea('0x26')](function(_0xe514e0){if(_0xe514e0){return db[_0x84ea('0x65')]['findOne']({'where':{'id':_0x4629ed[_0x84ea('0x4c')]['id']},'attributes':['id',_0x84ea('0x2c'),_0x84ea('0x66'),_0x84ea('0x67'),'createdAt'],'raw':!![]});}})[_0x84ea('0x26')](function(_0x420185){if(_0x420185){var _0x4b4ddf=path[_0x84ea('0x51')](config[_0x84ea('0x52')],_0x84ea('0x68'),util[_0x84ea('0x69')](_0x84ea('0x6a'),path[_0x84ea('0x6b')](_0x420185[_0x84ea('0x66')],path['extname'](_0x420185[_0x84ea('0x66')])),_0x420185[_0x84ea('0x67')]));var _0x41da8c=path['join'](config[_0x84ea('0x52')],_0x84ea('0x53'),_0x45c0ca['name'],util[_0x84ea('0x69')](_0x84ea('0x6a'),_0x420185[_0x84ea('0x2c')],_0x420185['converted_format']));fs[_0x84ea('0x6c')](_0x4b4ddf,_0x41da8c);return _0x420185;}})[_0x84ea('0x48')](function(_0xe77381){throw new db[(_0x84ea('0x6d'))][(_0x84ea('0x63'))](_0xe77381['message']);});})[_0x84ea('0x26')](handleEntityNotFound(_0x2c3bf4,null))['then'](respondWithResult(_0x2c3bf4,0xc9))[_0x84ea('0x48')](handleError(_0x2c3bf4,null));};exports[_0x84ea('0x6e')]=function(_0x420683,_0x57e32d,_0x73650b){return db[_0x84ea('0x4d')][_0x84ea('0x4e')](function(_0x1e0eaf){var _0x1f1efa;return db[_0x84ea('0x30')][_0x84ea('0x6f')]({'where':{'id':_0x420683['params']['id']}})[_0x84ea('0x26')](handleEntityNotFound(_0x57e32d,null))[_0x84ea('0x26')](function(_0x21677c){if(_0x21677c){_0x1f1efa=_0x21677c;return _0x21677c[_0x84ea('0x6e')](_0x420683[_0x84ea('0x4a')][_0x84ea('0x70')]);}})[_0x84ea('0x26')](function(_0x361524){if(_0x361524){return db[_0x84ea('0x65')][_0x84ea('0x6f')]({'where':{'id':_0x420683[_0x84ea('0x4a')][_0x84ea('0x70')]},'attributes':['id',_0x84ea('0x2c'),_0x84ea('0x66'),_0x84ea('0x67'),_0x84ea('0x71')],'raw':!![]});}})['then'](function(_0x44360e){if(_0x44360e){fs['unlinkSync'](path['join'](_0x1f1efa[_0x84ea('0x56')],util['format']('%s.%s',_0x44360e['name'],_0x44360e[_0x84ea('0x67')])));return _0x44360e;}})[_0x84ea('0x48')](function(_0x464d0c){throw new db['Sequelize']['ValidationError'](_0x464d0c[_0x84ea('0x64')]);});})[_0x84ea('0x26')](handleEntityNotFound(_0x57e32d,null))[_0x84ea('0x26')](respondWithStatusCode(_0x57e32d,0xcc))[_0x84ea('0x48')](handleError(_0x57e32d,null));};exports[_0x84ea('0x72')]=function(_0x140adf,_0x59c777,_0x31cfc2){var _0x43719b={};var _0x363a10={};var _0x2de886;var _0x3c8137;return db[_0x84ea('0x30')][_0x84ea('0x6f')]({'where':{'id':_0x140adf[_0x84ea('0x4a')]['id']}})[_0x84ea('0x26')](handleEntityNotFound(_0x59c777,null))['then'](function(_0x2feb4b){if(_0x2feb4b){_0x2de886=_0x2feb4b;_0x363a10[_0x84ea('0x33')]=_[_0x84ea('0x35')](db[_0x84ea('0x65')][_0x84ea('0x73')]);_0x363a10[_0x84ea('0x34')]=_[_0x84ea('0x35')](_0x140adf['query']);_0x363a10[_0x84ea('0x36')]=_[_0x84ea('0x37')](_0x363a10[_0x84ea('0x33')],_0x363a10[_0x84ea('0x34')]);_0x43719b[_0x84ea('0x38')]=_[_0x84ea('0x37')](_0x363a10['model'],qs['fields'](_0x140adf[_0x84ea('0x34')][_0x84ea('0x39')]));_0x43719b[_0x84ea('0x38')]=_0x43719b[_0x84ea('0x38')][_0x84ea('0x3a')]?_0x43719b[_0x84ea('0x38')]:_0x363a10[_0x84ea('0x33')];_0x43719b[_0x84ea('0x3d')]=qs[_0x84ea('0x3e')](_0x140adf['query']['sort']);_0x43719b['where']=qs[_0x84ea('0x36')](_[_0x84ea('0x40')](_0x140adf['query'],_0x363a10[_0x84ea('0x36')]));if(_0x140adf[_0x84ea('0x34')][_0x84ea('0x41')]){_0x43719b['where']=_[_0x84ea('0x43')](_0x43719b[_0x84ea('0x3f')],{'$or':_[_0x84ea('0x2f')](_0x43719b[_0x84ea('0x38')],function(_0x13f26d){var _0x1c4258={};_0x1c4258[_0x13f26d]={'$like':'%'+_0x140adf[_0x84ea('0x34')][_0x84ea('0x41')]+'%'};return _0x1c4258;})});}_0x43719b=_['merge']({},_0x43719b,_0x140adf[_0x84ea('0x44')]);return _0x2de886[_0x84ea('0x72')](_0x43719b);}})[_0x84ea('0x26')](function(_0x4ff186){if(_0x4ff186){_0x3c8137=_0x4ff186[_0x84ea('0x3a')];if(!_0x140adf[_0x84ea('0x34')]['hasOwnProperty'](_0x84ea('0x3c'))){_0x43719b[_0x84ea('0x1e')]=qs[_0x84ea('0x1e')](_0x140adf[_0x84ea('0x34')][_0x84ea('0x1e')]);_0x43719b[_0x84ea('0x1d')]=qs['offset'](_0x140adf['query'][_0x84ea('0x1d')]);}return _0x2de886[_0x84ea('0x72')](_0x43719b);}})[_0x84ea('0x26')](function(_0x12ba96){if(_0x12ba96){return _0x12ba96?{'count':_0x3c8137,'rows':_0x12ba96}:null;}})['then'](respondWithResult(_0x59c777,null))['catch'](handleError(_0x59c777,null));}; \ No newline at end of file +var _0x1c5f=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','MusicOnHolds','error','name','send','index','VoiceMusicOnHold','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','catch','body','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync','0777','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','root','format','%s.%s','save_name','extname','symlinkSync','findOne','removeSound','id2','getSounds','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto'];(function(_0xbd7690,_0x3fa1dd){var _0x2d16cf=function(_0x5956d3){while(--_0x5956d3){_0xbd7690['push'](_0xbd7690['shift']());}};_0x2d16cf(++_0x3fa1dd);}(_0x1c5f,0x143));var _0xf1c5=function(_0x3ee55f,_0x21736c){_0x3ee55f=_0x3ee55f-0x0;var _0x39367c=_0x1c5f[_0x3ee55f];return _0x39367c;};'use strict';var emlformat=require(_0xf1c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1c5('0x1'));var jsonpatch=require(_0xf1c5('0x2'));var rp=require(_0xf1c5('0x3'));var moment=require(_0xf1c5('0x4'));var BPromise=require(_0xf1c5('0x5'));var Mustache=require(_0xf1c5('0x6'));var util=require(_0xf1c5('0x7'));var path=require(_0xf1c5('0x8'));var sox=require('sox');var csv=require(_0xf1c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1c5('0xa'));var squel=require(_0xf1c5('0xb'));var crypto=require(_0xf1c5('0xc'));var jsforce=require(_0xf1c5('0xd'));var deskjs=require(_0xf1c5('0xe'));var toCsv=require(_0xf1c5('0x9'));var querystring=require(_0xf1c5('0xf'));var Papa=require(_0xf1c5('0x10'));var Redis=require('ioredis');var authService=require(_0xf1c5('0x11'));var qs=require(_0xf1c5('0x12'));var as=require(_0xf1c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf1c5('0x14'));var config=require(_0xf1c5('0x15'));var licenseUtil=require(_0xf1c5('0x16'));var db=require(_0xf1c5('0x17'))['db'];function respondWithStatusCode(_0x9d8b12,_0x32201e){_0x32201e=_0x32201e||0xcc;return function(_0x5317dd){if(_0x5317dd){return _0x9d8b12[_0xf1c5('0x18')](_0x32201e);}return _0x9d8b12['status'](_0x32201e)[_0xf1c5('0x19')]();};}function respondWithResult(_0x305965,_0x2a249e){_0x2a249e=_0x2a249e||0xc8;return function(_0x4c1d26){if(_0x4c1d26){return _0x305965[_0xf1c5('0x1a')](_0x2a249e)[_0xf1c5('0x1b')](_0x4c1d26);}};}function respondWithFilteredResult(_0x1d4fc5,_0x40edf0){return function(_0x1432af){if(_0x1432af){var _0x15e6bb=typeof _0x40edf0[_0xf1c5('0x1c')]===_0xf1c5('0x1d')&&typeof _0x40edf0[_0xf1c5('0x1e')]===_0xf1c5('0x1d');var _0x75c476=_0x1432af[_0xf1c5('0x1f')];var _0x217367=_0x15e6bb?0x0:_0x40edf0['offset'];var _0x57590a=_0x15e6bb?_0x1432af['count']:_0x40edf0[_0xf1c5('0x1c')]+_0x40edf0[_0xf1c5('0x1e')];var _0xb8c057;if(_0x57590a>=_0x75c476){_0x57590a=_0x75c476;_0xb8c057=0xc8;}else{_0xb8c057=0xce;}_0x1d4fc5['status'](_0xb8c057);return _0x1d4fc5[_0xf1c5('0x20')]('Content-Range',_0x217367+'-'+_0x57590a+'/'+_0x75c476)['json'](_0x1432af);}return null;};}function patchUpdates(_0x5b33fc){return function(_0x1c39b1){try{jsonpatch[_0xf1c5('0x21')](_0x1c39b1,_0x5b33fc,!![]);}catch(_0x562e99){return BPromise[_0xf1c5('0x22')](_0x562e99);}return _0x1c39b1['save']();};}function saveUpdates(_0x526794,_0x1fbfa6){return function(_0x2df0d5){if(_0x2df0d5){return _0x2df0d5[_0xf1c5('0x23')](_0x526794)[_0xf1c5('0x24')](function(_0x406438){return _0x406438;});}return null;};}function removeEntity(_0x2ceee4,_0x4eb36e){return function(_0x3d4d99){if(_0x3d4d99){return _0x3d4d99[_0xf1c5('0x25')]()[_0xf1c5('0x24')](function(){var _0x1d95b5=_0x3d4d99[_0xf1c5('0x26')]({'plain':!![]});var _0x1c27c2=_0xf1c5('0x27');return db['UserProfileResource'][_0xf1c5('0x25')]({'where':{'type':_0x1c27c2,'resourceId':_0x1d95b5['id']}})[_0xf1c5('0x24')](function(){return _0x3d4d99;});})[_0xf1c5('0x24')](function(){_0x2ceee4[_0xf1c5('0x1a')](0xcc)[_0xf1c5('0x19')]();});}};}function handleEntityNotFound(_0x3a704d,_0x1acff6){return function(_0x334e6a){if(!_0x334e6a){_0x3a704d[_0xf1c5('0x18')](0x194);}return _0x334e6a;};}function handleError(_0x46702f,_0x3bae0b){_0x3bae0b=_0x3bae0b||0x1f4;return function(_0x3a3b97){logger[_0xf1c5('0x28')](_0x3a3b97['stack']);if(_0x3a3b97['name']){delete _0x3a3b97[_0xf1c5('0x29')];}_0x46702f[_0xf1c5('0x1a')](_0x3bae0b)[_0xf1c5('0x2a')](_0x3a3b97);};}exports[_0xf1c5('0x2b')]=function(_0xe1af38,_0x4b6e93){var _0x51ef4a={},_0x589ab8={},_0x428712={'count':0x0,'rows':[]};var _0x3295cd=_['map'](db[_0xf1c5('0x2c')]['rawAttributes'],function(_0x4abc95){return{'name':_0x4abc95[_0xf1c5('0x2d')],'type':_0x4abc95[_0xf1c5('0x2e')][_0xf1c5('0x2f')]};});_0x589ab8[_0xf1c5('0x30')]=_['map'](_0x3295cd,_0xf1c5('0x29'));_0x589ab8[_0xf1c5('0x31')]=_['keys'](_0xe1af38['query']);_0x589ab8['filters']=_[_0xf1c5('0x32')](_0x589ab8['model'],_0x589ab8[_0xf1c5('0x31')]);_0x51ef4a[_0xf1c5('0x33')]=_[_0xf1c5('0x32')](_0x589ab8[_0xf1c5('0x30')],qs[_0xf1c5('0x34')](_0xe1af38[_0xf1c5('0x31')]['fields']));_0x51ef4a[_0xf1c5('0x33')]=_0x51ef4a['attributes'][_0xf1c5('0x35')]?_0x51ef4a[_0xf1c5('0x33')]:_0x589ab8[_0xf1c5('0x30')];if(!_0xe1af38[_0xf1c5('0x31')]['hasOwnProperty']('nolimit')){_0x51ef4a['limit']=qs[_0xf1c5('0x1e')](_0xe1af38[_0xf1c5('0x31')]['limit']);_0x51ef4a['offset']=qs['offset'](_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x1c')]);}_0x51ef4a[_0xf1c5('0x36')]=qs[_0xf1c5('0x37')](_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x37')]);delete _0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x37')];_0x51ef4a[_0xf1c5('0x38')]=qs[_0xf1c5('0x39')](_[_0xf1c5('0x3a')](_0xe1af38[_0xf1c5('0x31')],_0x589ab8['filters']),_0x3295cd);if(_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x3b')]){_0x51ef4a[_0xf1c5('0x38')]=_['merge'](_0x51ef4a[_0xf1c5('0x38')],{'$or':_[_0xf1c5('0x3c')](_0x3295cd,function(_0x146291){if(_0x146291['type']!==_0xf1c5('0x3d')){var _0x251416={};_0x251416[_0x146291[_0xf1c5('0x29')]]={'$like':'%'+_0xe1af38['query'][_0xf1c5('0x3b')]+'%'};return _0x251416;}})});}_0x51ef4a=_[_0xf1c5('0x3e')]({},_0x51ef4a,_0xe1af38[_0xf1c5('0x3f')]);var _0x5d9c6c={'where':_0x51ef4a['where']};return db[_0xf1c5('0x2c')][_0xf1c5('0x1f')](_0x5d9c6c)['then'](function(_0x42b9dc){_0x428712['count']=_0x42b9dc;if(_0xe1af38[_0xf1c5('0x31')][_0xf1c5('0x40')]){_0x51ef4a['include']=[{'all':!![]}];}return db[_0xf1c5('0x2c')][_0xf1c5('0x41')](_0x51ef4a);})[_0xf1c5('0x24')](function(_0x20d454){_0x428712[_0xf1c5('0x42')]=_0x20d454;return _0x428712;})[_0xf1c5('0x24')](respondWithFilteredResult(_0x4b6e93,_0x51ef4a))['catch'](handleError(_0x4b6e93,null));};exports[_0xf1c5('0x43')]=function(_0x295d71,_0x38da48){var _0x42b126={'raw':![],'where':{'id':_0x295d71[_0xf1c5('0x44')]['id']}},_0x365efb={};_0x365efb[_0xf1c5('0x30')]=_[_0xf1c5('0x45')](db[_0xf1c5('0x2c')][_0xf1c5('0x46')]);_0x365efb['query']=_[_0xf1c5('0x45')](_0x295d71[_0xf1c5('0x31')]);_0x365efb[_0xf1c5('0x39')]=_['intersection'](_0x365efb[_0xf1c5('0x30')],_0x365efb[_0xf1c5('0x31')]);_0x42b126[_0xf1c5('0x33')]=_['intersection'](_0x365efb[_0xf1c5('0x30')],qs[_0xf1c5('0x34')](_0x295d71[_0xf1c5('0x31')][_0xf1c5('0x34')]));_0x42b126[_0xf1c5('0x33')]=_0x42b126['attributes']['length']?_0x42b126['attributes']:_0x365efb[_0xf1c5('0x30')];if(_0x295d71['query']['includeAll']){_0x42b126['include']=[{'all':!![]}];}_0x42b126=_[_0xf1c5('0x3e')]({},_0x42b126,_0x295d71['options']);return db[_0xf1c5('0x2c')]['find'](_0x42b126)[_0xf1c5('0x24')](handleEntityNotFound(_0x38da48,null))[_0xf1c5('0x24')](respondWithResult(_0x38da48,null))[_0xf1c5('0x47')](handleError(_0x38da48,null));};exports[_0xf1c5('0x23')]=function(_0x59779f,_0x2f3a1f){if(_0x59779f[_0xf1c5('0x48')]['id']){delete _0x59779f[_0xf1c5('0x48')]['id'];}return db[_0xf1c5('0x2c')]['find']({'where':{'id':_0x59779f[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x2f3a1f,null))['then'](saveUpdates(_0x59779f['body'],null))['then'](respondWithResult(_0x2f3a1f,null))['catch'](handleError(_0x2f3a1f,null));};exports['create']=function(_0x172ae7,_0x1f1e75,_0xa249d0){return db[_0xf1c5('0x49')][_0xf1c5('0x4a')](function(_0x47e3a6){if(_0x172ae7['body'][_0xf1c5('0x4b')]===_0xf1c5('0x4c')){_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x4d')]=path[_0xf1c5('0x4e')](config['root'],_0xf1c5('0x4f'),_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x29')]);}return db[_0xf1c5('0x2c')][_0xf1c5('0x50')](_0x172ae7[_0xf1c5('0x48')],{'transaction':_0x47e3a6})[_0xf1c5('0x24')](function(_0x1362d8){if(_0x172ae7[_0xf1c5('0x48')][_0xf1c5('0x4b')]===_0xf1c5('0x4c')){fs[_0xf1c5('0x51')](_0x1362d8[_0xf1c5('0x4d')],parseInt(_0xf1c5('0x52'),0x8));}var _0x559f01=_0x172ae7[_0xf1c5('0x53')][_0xf1c5('0x26')]({'plain':!![]});if(!_0x559f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x559f01[_0xf1c5('0x54')]===_0xf1c5('0x53')){var _0x3e2390=_0x1362d8[_0xf1c5('0x26')]({'plain':!![]});return db[_0xf1c5('0x55')][_0xf1c5('0x56')]({'where':{'name':_0xf1c5('0x27'),'userProfileId':_0x559f01[_0xf1c5('0x57')]},'raw':!![]})[_0xf1c5('0x24')](function(_0x43895c){if(_0x43895c&&_0x43895c[_0xf1c5('0x58')]===0x0){return db[_0xf1c5('0x59')]['create']({'name':_0x3e2390[_0xf1c5('0x29')],'resourceId':_0x3e2390['id'],'type':_0x43895c[_0xf1c5('0x29')],'sectionId':_0x43895c['id']},{})[_0xf1c5('0x24')](function(){return _0x1362d8;});}else{return _0x1362d8;}})[_0xf1c5('0x47')](function(_0x1ceb0e){logger[_0xf1c5('0x28')](_0xf1c5('0x5a'),_0x1ceb0e);});}return _0x1362d8;});})['then'](respondWithResult(_0x1f1e75,0xc9))[_0xf1c5('0x47')](handleError(_0x1f1e75,null));};exports['destroy']=function(_0x386580,_0x2df58c,_0x1090ca){var _0x36d6a5;return db[_0xf1c5('0x2c')][_0xf1c5('0x56')]({'where':{'id':_0x386580[_0xf1c5('0x44')]['id']}})['then'](function(_0x18a9b3){if(_0x18a9b3){return db[_0xf1c5('0x49')][_0xf1c5('0x4a')](function(_0x1bd28c){return _0x18a9b3[_0xf1c5('0x25')]({'transaction':_0x1bd28c,'raw':!![]})[_0xf1c5('0x24')](function(_0x25b891){if(_0x25b891['directory']){fs[_0xf1c5('0x5b')](_0x25b891[_0xf1c5('0x4d')])[_0xf1c5('0x5c')](function(_0x3d36d6){fs[_0xf1c5('0x5d')](path[_0xf1c5('0x4e')](_0x25b891[_0xf1c5('0x4d')],_0x3d36d6));});fs['rmdirSync'](_0x25b891[_0xf1c5('0x4d')]);}return _0x25b891;});})['catch'](function(_0x5b85d8){throw new db[(_0xf1c5('0x5e'))][(_0xf1c5('0x5f'))](_0x5b85d8[_0xf1c5('0x60')]);});}})[_0xf1c5('0x24')](handleEntityNotFound(_0x2df58c,null))[_0xf1c5('0x24')](removeEntity(_0x2df58c,null))[_0xf1c5('0x47')](handleError(_0x2df58c,null));};exports['addSound']=function(_0xb2e898,_0x3a31b9,_0x4ae14b){return db[_0xf1c5('0x49')]['transaction'](function(_0x3afcfa){var _0x2e2114;return db[_0xf1c5('0x2c')][_0xf1c5('0x56')]({'where':{'id':_0xb2e898[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](function(_0x2eff3d){if(_0x2eff3d){_0x2e2114=_0x2eff3d;return _0x2eff3d[_0xf1c5('0x61')](_0xb2e898[_0xf1c5('0x48')]['id'],{'transaction':_0x3afcfa});}})[_0xf1c5('0x24')](function(_0x3550c9){if(_0x3550c9){return db[_0xf1c5('0x62')]['findOne']({'where':{'id':_0xb2e898[_0xf1c5('0x48')]['id']},'attributes':['id',_0xf1c5('0x29'),'save_name',_0xf1c5('0x63'),'createdAt'],'raw':!![]});}})[_0xf1c5('0x24')](function(_0x5ed44e){if(_0x5ed44e){var _0x2aed40=path[_0xf1c5('0x4e')](config[_0xf1c5('0x64')],'server/files/sounds/converted',util[_0xf1c5('0x65')](_0xf1c5('0x66'),path['basename'](_0x5ed44e[_0xf1c5('0x67')],path[_0xf1c5('0x68')](_0x5ed44e['save_name'])),_0x5ed44e['converted_format']));var _0x4d9918=path[_0xf1c5('0x4e')](config[_0xf1c5('0x64')],_0xf1c5('0x4f'),_0x2e2114[_0xf1c5('0x29')],util[_0xf1c5('0x65')]('%s.%s',_0x5ed44e['name'],_0x5ed44e[_0xf1c5('0x63')]));fs[_0xf1c5('0x69')](_0x2aed40,_0x4d9918);return _0x5ed44e;}})[_0xf1c5('0x47')](function(_0x1a4bd6){throw new db[(_0xf1c5('0x5e'))][(_0xf1c5('0x5f'))](_0x1a4bd6['message']);});})[_0xf1c5('0x24')](handleEntityNotFound(_0x3a31b9,null))['then'](respondWithResult(_0x3a31b9,0xc9))['catch'](handleError(_0x3a31b9,null));};exports['removeSound']=function(_0x26a7e5,_0x5a0aa6,_0x39aa3c){return db['sequelize'][_0xf1c5('0x4a')](function(_0x49813d){var _0x5cd203;return db[_0xf1c5('0x2c')][_0xf1c5('0x6a')]({'where':{'id':_0x26a7e5[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x5a0aa6,null))[_0xf1c5('0x24')](function(_0xef93b5){if(_0xef93b5){_0x5cd203=_0xef93b5;return _0xef93b5[_0xf1c5('0x6b')](_0x26a7e5[_0xf1c5('0x44')][_0xf1c5('0x6c')]);}})[_0xf1c5('0x24')](function(_0x4a1ea2){if(_0x4a1ea2){return db[_0xf1c5('0x62')]['findOne']({'where':{'id':_0x26a7e5['params']['id2']},'attributes':['id','name',_0xf1c5('0x67'),_0xf1c5('0x63'),'createdAt'],'raw':!![]});}})[_0xf1c5('0x24')](function(_0x5bffb2){if(_0x5bffb2){fs[_0xf1c5('0x5d')](path['join'](_0x5cd203[_0xf1c5('0x4d')],util[_0xf1c5('0x65')](_0xf1c5('0x66'),_0x5bffb2['name'],_0x5bffb2[_0xf1c5('0x63')])));return _0x5bffb2;}})[_0xf1c5('0x47')](function(_0x431317){throw new db['Sequelize']['ValidationError'](_0x431317[_0xf1c5('0x60')]);});})[_0xf1c5('0x24')](handleEntityNotFound(_0x5a0aa6,null))[_0xf1c5('0x24')](respondWithStatusCode(_0x5a0aa6,0xcc))[_0xf1c5('0x47')](handleError(_0x5a0aa6,null));};exports[_0xf1c5('0x6d')]=function(_0x462d88,_0x3cc00f,_0x393ce2){var _0x561799={};var _0x176739={};var _0x167854;var _0x15bada;return db[_0xf1c5('0x2c')][_0xf1c5('0x6a')]({'where':{'id':_0x462d88[_0xf1c5('0x44')]['id']}})[_0xf1c5('0x24')](handleEntityNotFound(_0x3cc00f,null))[_0xf1c5('0x24')](function(_0xff24fb){if(_0xff24fb){_0x167854=_0xff24fb;_0x176739[_0xf1c5('0x30')]=_[_0xf1c5('0x45')](db[_0xf1c5('0x62')][_0xf1c5('0x46')]);_0x176739[_0xf1c5('0x31')]=_[_0xf1c5('0x45')](_0x462d88[_0xf1c5('0x31')]);_0x176739[_0xf1c5('0x39')]=_[_0xf1c5('0x32')](_0x176739['model'],_0x176739[_0xf1c5('0x31')]);_0x561799[_0xf1c5('0x33')]=_[_0xf1c5('0x32')](_0x176739['model'],qs['fields'](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x34')]));_0x561799[_0xf1c5('0x33')]=_0x561799[_0xf1c5('0x33')]['length']?_0x561799[_0xf1c5('0x33')]:_0x176739[_0xf1c5('0x30')];_0x561799[_0xf1c5('0x36')]=qs[_0xf1c5('0x37')](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x37')]);_0x561799[_0xf1c5('0x38')]=qs[_0xf1c5('0x39')](_[_0xf1c5('0x3a')](_0x462d88[_0xf1c5('0x31')],_0x176739[_0xf1c5('0x39')]));if(_0x462d88[_0xf1c5('0x31')]['filter']){_0x561799[_0xf1c5('0x38')]=_[_0xf1c5('0x3e')](_0x561799[_0xf1c5('0x38')],{'$or':_[_0xf1c5('0x3c')](_0x561799[_0xf1c5('0x33')],function(_0x691596){var _0x26af9a={};_0x26af9a[_0x691596]={'$like':'%'+_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x3b')]+'%'};return _0x26af9a;})});}_0x561799=_[_0xf1c5('0x3e')]({},_0x561799,_0x462d88[_0xf1c5('0x3f')]);return _0x167854[_0xf1c5('0x6d')](_0x561799);}})['then'](function(_0x502ece){if(_0x502ece){_0x15bada=_0x502ece[_0xf1c5('0x35')];if(!_0x462d88['query'][_0xf1c5('0x6e')](_0xf1c5('0x6f'))){_0x561799[_0xf1c5('0x1e')]=qs[_0xf1c5('0x1e')](_0x462d88[_0xf1c5('0x31')][_0xf1c5('0x1e')]);_0x561799['offset']=qs['offset'](_0x462d88['query'][_0xf1c5('0x1c')]);}return _0x167854[_0xf1c5('0x6d')](_0x561799);}})[_0xf1c5('0x24')](function(_0x115b28){if(_0x115b28){return _0x115b28?{'count':_0x15bada,'rows':_0x115b28}:null;}})['then'](respondWithResult(_0x3cc00f,null))[_0xf1c5('0x47')](handleError(_0x3cc00f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index be0b376..2693886 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 _0x8de7=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8de7,0xf9));var _0x78de=function(_0x3173a5,_0x4d7458){_0x3173a5=_0x3173a5-0x0;var _0x2d4cf4=_0x8de7[_0x3173a5];return _0x2d4cf4;};'use strict';var _=require(_0x78de('0x0'));var util=require(_0x78de('0x1'));var logger=require(_0x78de('0x2'))('api');var moment=require(_0x78de('0x3'));var BPromise=require('bluebird');var rp=require(_0x78de('0x4'));var fs=require('fs');var path=require(_0x78de('0x5'));var rimraf=require(_0x78de('0x6'));var config=require(_0x78de('0x7'));var attributes=require(_0x78de('0x8'));module[_0x78de('0x9')]=function(_0x5162a0,_0x55bfa7){return _0x5162a0['define'](_0x78de('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35a9=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a5d43,_0x5f01a5){var _0x2b572c=function(_0x35ebeb){while(--_0x35ebeb){_0x4a5d43['push'](_0x4a5d43['shift']());}};_0x2b572c(++_0x5f01a5);}(_0x35a9,0xdb));var _0x935a=function(_0x4513e9,_0x3e3553){_0x4513e9=_0x4513e9-0x0;var _0x431795=_0x35a9[_0x4513e9];return _0x431795;};'use strict';var _=require(_0x935a('0x0'));var util=require(_0x935a('0x1'));var logger=require(_0x935a('0x2'))(_0x935a('0x3'));var moment=require(_0x935a('0x4'));var BPromise=require(_0x935a('0x5'));var rp=require(_0x935a('0x6'));var fs=require('fs');var path=require(_0x935a('0x7'));var rimraf=require(_0x935a('0x8'));var config=require(_0x935a('0x9'));var attributes=require(_0x935a('0xa'));module[_0x935a('0xb')]=function(_0x3ad576,_0x13cf16){return _0x3ad576[_0x935a('0xc')](_0x935a('0xd'),attributes,{'tableName':_0x935a('0xe'),'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 d15eb1a..b958c01 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x15b15b,_0x150bef){var _0x1e79fa=function(_0x4d4f5d){while(--_0x4d4f5d){_0x15b15b['push'](_0x15b15b['shift']());}};_0x1e79fa(++_0x150bef);}(_0x70e0,0x17b));var _0x070e=function(_0x3f7d52,_0x60a62d){_0x3f7d52=_0x3f7d52-0x0;var _0xb6274a=_0x70e0[_0x3f7d52];return _0xb6274a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _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(_0x2d939d,_0x26707a){var _0x149362=function(_0x323fa7){while(--_0x323fa7){_0x2d939d['push'](_0x2d939d['shift']());}};_0x149362(++_0x26707a);}(_0xedd9,0xfc));var _0x9edd=function(_0x52a742,_0x402e3d){_0x52a742=_0x52a742-0x0;var _0x47d29c=_0xedd9[_0x52a742];return _0x47d29c;};'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 9c6e96e..b898da4 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 _0xe8f7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','post','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer'];(function(_0x4349c4,_0xa930cd){var _0x17e05d=function(_0xe6cd14){while(--_0xe6cd14){_0x4349c4['push'](_0x4349c4['shift']());}};_0x17e05d(++_0xa930cd);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7e8f('0x0'));var util=require('util');var path=require(_0x7e8f('0x1'));var timeout=require(_0x7e8f('0x2'));var express=require(_0x7e8f('0x3'));var router=express[_0x7e8f('0x4')]();var fs_extra=require(_0x7e8f('0x5'));var auth=require(_0x7e8f('0x6'));var interaction=require(_0x7e8f('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x7e8f('0x8')]('/',auth[_0x7e8f('0x9')](),controller['index']);router[_0x7e8f('0x8')](_0x7e8f('0xa'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0xb')]);router[_0x7e8f('0x8')](_0x7e8f('0xc'),auth[_0x7e8f('0x9')](),controller['show']);router[_0x7e8f('0x8')](_0x7e8f('0xd'),auth['isAuthenticated'](),controller[_0x7e8f('0xe')]);router[_0x7e8f('0x8')](_0x7e8f('0xf'),auth[_0x7e8f('0x9')](),controller['getTeams']);router[_0x7e8f('0x10')]('/',auth[_0x7e8f('0x9')](),controller['create']);router[_0x7e8f('0x10')](_0x7e8f('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7e8f('0x10')](_0x7e8f('0xf'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0x11')]);router[_0x7e8f('0x12')](_0x7e8f('0xc'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0x13')]);router[_0x7e8f('0x14')](_0x7e8f('0xc'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0x15')]);router[_0x7e8f('0x14')](_0x7e8f('0xd'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0x16')]);router['delete'](_0x7e8f('0xf'),auth[_0x7e8f('0x9')](),controller[_0x7e8f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9335=['post','create','addAgents','addTeams','update','destroy','removeAgents','delete','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x2d2abe,_0x15de0d){var _0x19ec3a=function(_0x3aea3f){while(--_0x3aea3f){_0x2d2abe['push'](_0x2d2abe['shift']());}};_0x19ec3a(++_0x15de0d);}(_0x9335,0xab));var _0x5933=function(_0x2b1072,_0xc2d76){_0x2b1072=_0x2b1072-0x0;var _0x268e4e=_0x9335[_0x2b1072];return _0x268e4e;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./voicePrefix.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['describe']);router[_0x5933('0x9')](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0x9')](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x9')](_0x5933('0x10'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);router[_0x5933('0x12')]('/',auth['isAuthenticated'](),controller[_0x5933('0x13')]);router['post'](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0x14')]);router['post'](_0x5933('0x10'),auth['isAuthenticated'](),controller[_0x5933('0x15')]);router['put'](_0x5933('0xc'),auth['isAuthenticated'](),controller[_0x5933('0x16')]);router['delete'](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0x17')]);router['delete']('/:id/users',auth[_0x5933('0xb')](),controller[_0x5933('0x18')]);router[_0x5933('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5933('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ec9b453..56c8094 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 _0xcea7=['system-','getDataValue','INTEGER','exports','STRING','name','VIRTUAL'];(function(_0x2933e7,_0x4d2199){var _0x40ae19=function(_0x159f11){while(--_0x159f11){_0x2933e7['push'](_0x2933e7['shift']());}};_0x40ae19(++_0x4d2199);}(_0xcea7,0x137));var _0x7cea=function(_0x570fde,_0x239878){_0x570fde=_0x570fde-0x0;var _0x2fd611=_0xcea7[_0x570fde];return _0x2fd611;};'use strict';var Sequelize=require('sequelize');module[_0x7cea('0x0')]={'name':{'type':Sequelize[_0x7cea('0x1')],'allowNull':![],'unique':_0x7cea('0x2')},'prefix':{'type':Sequelize[_0x7cea('0x3')],'get':function(_0x2b9a76){return _0x7cea('0x4')+this[_0x7cea('0x5')](_0x7cea('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x7cea('0x6')]}}; \ No newline at end of file +var _0x82f1=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x10485c,_0x5c905b){var _0x2f4c1d=function(_0x21a55d){while(--_0x21a55d){_0x10485c['push'](_0x10485c['shift']());}};_0x2f4c1d(++_0x5c905b);}(_0x82f1,0x8f));var _0x182f=function(_0x5b5e91,_0x180334){_0x5b5e91=_0x5b5e91-0x0;var _0x1c269a=_0x82f1[_0x5b5e91];return _0x1c269a;};'use strict';var Sequelize=require(_0x182f('0x0'));module[_0x182f('0x1')]={'name':{'type':Sequelize[_0x182f('0x2')],'allowNull':![],'unique':_0x182f('0x3')},'prefix':{'type':Sequelize[_0x182f('0x4')],'get':function(_0x4b4aac){return _0x182f('0x5')+this[_0x182f('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x182f('0x2')]},'callerIdAll':{'type':Sequelize[_0x182f('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x182f('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index bd92521..552c967 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 _0xcf66=['error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','emit','userVoicePrefix:remove','findOne','User','getAgents','Team','getTeams','online','voicePause','interface','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','sendStatus'];(function(_0x379426,_0x1f9e36){var _0x5f4638=function(_0x4f344c){while(--_0x4f344c){_0x379426['push'](_0x379426['shift']());}};_0x5f4638(++_0x1f9e36);}(_0xcf66,0x71));var _0x6cf6=function(_0x2086b2,_0x746852){_0x2086b2=_0x2086b2-0x0;var _0x564ded=_0xcf66[_0x2086b2];return _0x564ded;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6cf6('0x14')]=_[_0x6cf6('0x15')](config[_0x6cf6('0x14')],{'host':_0x6cf6('0x16'),'port':0x18eb});var socket=require(_0x6cf6('0x17'))(new Redis(config[_0x6cf6('0x14')]));require('./voicePrefix.socket')[_0x6cf6('0x18')](socket);function respondWithStatusCode(_0x494ece,_0x4dbae8){_0x4dbae8=_0x4dbae8||0xcc;return function(_0x18360e){if(_0x18360e){return _0x494ece['sendStatus'](_0x4dbae8);}return _0x494ece[_0x6cf6('0x19')](_0x4dbae8)[_0x6cf6('0x1a')]();};}function respondWithResult(_0x2d23ab,_0x74486a){_0x74486a=_0x74486a||0xc8;return function(_0x2b6d7b){if(_0x2b6d7b){return _0x2d23ab[_0x6cf6('0x19')](_0x74486a)[_0x6cf6('0x1b')](_0x2b6d7b);}};}function respondWithFilteredResult(_0x39ec25,_0x18c2f9){return function(_0x2ca2b1){if(_0x2ca2b1){var _0x5e8b11=typeof _0x18c2f9[_0x6cf6('0x1c')]===_0x6cf6('0x1d')&&typeof _0x18c2f9[_0x6cf6('0x1e')]==='undefined';var _0x18abd9=_0x2ca2b1[_0x6cf6('0x1f')];var _0x101e39=_0x5e8b11?0x0:_0x18c2f9[_0x6cf6('0x1c')];var _0x440634=_0x5e8b11?_0x2ca2b1[_0x6cf6('0x1f')]:_0x18c2f9[_0x6cf6('0x1c')]+_0x18c2f9['limit'];var _0x19f2cd;if(_0x440634>=_0x18abd9){_0x440634=_0x18abd9;_0x19f2cd=0xc8;}else{_0x19f2cd=0xce;}_0x39ec25[_0x6cf6('0x19')](_0x19f2cd);return _0x39ec25[_0x6cf6('0x20')](_0x6cf6('0x21'),_0x101e39+'-'+_0x440634+'/'+_0x18abd9)[_0x6cf6('0x1b')](_0x2ca2b1);}return null;};}function patchUpdates(_0x470ea4){return function(_0x41344f){try{jsonpatch[_0x6cf6('0x22')](_0x41344f,_0x470ea4,!![]);}catch(_0x5b2767){return BPromise['reject'](_0x5b2767);}return _0x41344f[_0x6cf6('0x23')]();};}function saveUpdates(_0x59f838,_0x45ce6e){return function(_0x18c8cd){if(_0x18c8cd){return _0x18c8cd[_0x6cf6('0x24')](_0x59f838)[_0x6cf6('0x25')](function(_0x3f9871){return _0x3f9871;});}return null;};}function removeEntity(_0x565fad,_0x1c966e){return function(_0x4e0e85){if(_0x4e0e85){return _0x4e0e85[_0x6cf6('0x26')]()[_0x6cf6('0x25')](function(){var _0x3eaa31=_0x4e0e85['get']({'plain':!![]});var _0xf4eec5=_0x6cf6('0x27');return db[_0x6cf6('0x28')][_0x6cf6('0x26')]({'where':{'type':_0xf4eec5,'resourceId':_0x3eaa31['id']}})['then'](function(){return _0x4e0e85;});})['then'](function(){_0x565fad[_0x6cf6('0x19')](0xcc)[_0x6cf6('0x1a')]();});}};}function handleEntityNotFound(_0x57099f,_0x5869e9){return function(_0x5ccc8f){if(!_0x5ccc8f){_0x57099f[_0x6cf6('0x29')](0x194);}return _0x5ccc8f;};}function handleError(_0x52717d,_0x4ceeb9){_0x4ceeb9=_0x4ceeb9||0x1f4;return function(_0x519a70){logger[_0x6cf6('0x2a')](_0x519a70[_0x6cf6('0x2b')]);if(_0x519a70[_0x6cf6('0x2c')]){delete _0x519a70[_0x6cf6('0x2c')];}_0x52717d[_0x6cf6('0x19')](_0x4ceeb9)['send'](_0x519a70);};}exports[_0x6cf6('0x2d')]=function(_0x2ae422,_0x356340){var _0x535b28={},_0x3c4b7a={},_0x145363={'count':0x0,'rows':[]};var _0xfcb0e5=_[_0x6cf6('0x2e')](db[_0x6cf6('0x2f')][_0x6cf6('0x30')],function(_0x11f66d){return{'name':_0x11f66d[_0x6cf6('0x31')],'type':_0x11f66d[_0x6cf6('0x32')][_0x6cf6('0x33')]};});_0x3c4b7a[_0x6cf6('0x34')]=_[_0x6cf6('0x2e')](_0xfcb0e5,_0x6cf6('0x2c'));_0x3c4b7a[_0x6cf6('0x35')]=_[_0x6cf6('0x36')](_0x2ae422[_0x6cf6('0x35')]);_0x3c4b7a[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x3c4b7a['model'],_0x3c4b7a[_0x6cf6('0x35')]);_0x535b28[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x3c4b7a[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x535b28[_0x6cf6('0x39')]=_0x535b28[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x535b28[_0x6cf6('0x39')]:_0x3c4b7a['model'];if(!_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3c')](_0x6cf6('0x3d'))){_0x535b28[_0x6cf6('0x1e')]=qs[_0x6cf6('0x1e')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x1e')]);_0x535b28[_0x6cf6('0x1c')]=qs[_0x6cf6('0x1c')](_0x2ae422['query'][_0x6cf6('0x1c')]);}_0x535b28[_0x6cf6('0x3e')]=qs[_0x6cf6('0x3f')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x535b28[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_[_0x6cf6('0x41')](_0x2ae422[_0x6cf6('0x35')],_0x3c4b7a['filters']),_0xfcb0e5);if(_0x2ae422[_0x6cf6('0x35')]['filter']){_0x535b28[_0x6cf6('0x40')]=_[_0x6cf6('0x42')](_0x535b28[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0xfcb0e5,function(_0x2cf96b){if(_0x2cf96b[_0x6cf6('0x32')]!==_0x6cf6('0x43')){var _0x26b817={};_0x26b817[_0x2cf96b['name']]={'$like':'%'+_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x44')]+'%'};return _0x26b817;}})});}_0x535b28=_['merge']({},_0x535b28,_0x2ae422[_0x6cf6('0x45')]);var _0x41c16a={'where':_0x535b28[_0x6cf6('0x40')]};return db['VoicePrefix'][_0x6cf6('0x1f')](_0x41c16a)[_0x6cf6('0x25')](function(_0x51d915){_0x145363[_0x6cf6('0x1f')]=_0x51d915;if(_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x46')]){_0x535b28[_0x6cf6('0x47')]=[{'all':!![]}];}return db[_0x6cf6('0x2f')][_0x6cf6('0x48')](_0x535b28);})[_0x6cf6('0x25')](function(_0x5a2ef8){_0x145363[_0x6cf6('0x49')]=_0x5a2ef8;return _0x145363;})['then'](respondWithFilteredResult(_0x356340,_0x535b28))[_0x6cf6('0x4a')](handleError(_0x356340,null));};exports[_0x6cf6('0x4b')]=function(_0x4927d4,_0x18efca){var _0x14dd21={'raw':![],'where':{'id':_0x4927d4[_0x6cf6('0x4c')]['id']}},_0x235f37={};_0x235f37[_0x6cf6('0x34')]=_['keys'](db[_0x6cf6('0x2f')][_0x6cf6('0x30')]);_0x235f37[_0x6cf6('0x35')]=_['keys'](_0x4927d4[_0x6cf6('0x35')]);_0x235f37[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x235f37['model'],_0x235f37[_0x6cf6('0x35')]);_0x14dd21['attributes']=_['intersection'](_0x235f37[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x4927d4[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x14dd21[_0x6cf6('0x39')]=_0x14dd21[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x14dd21[_0x6cf6('0x39')]:_0x235f37[_0x6cf6('0x34')];if(_0x4927d4[_0x6cf6('0x35')][_0x6cf6('0x46')]){_0x14dd21[_0x6cf6('0x47')]=[{'all':!![]}];}_0x14dd21=_[_0x6cf6('0x42')]({},_0x14dd21,_0x4927d4['options']);return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')](_0x14dd21)['then'](handleEntityNotFound(_0x18efca,null))['then'](respondWithResult(_0x18efca,null))[_0x6cf6('0x4a')](handleError(_0x18efca,null));};exports[_0x6cf6('0x26')]=function(_0x1db524,_0x20a106){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x1db524['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x20a106,null))[_0x6cf6('0x25')](removeEntity(_0x20a106,null))[_0x6cf6('0x4a')](handleError(_0x20a106,null));};exports['describe']=function(_0x5df6d3,_0x211b89){return db[_0x6cf6('0x2f')][_0x6cf6('0x4e')]()[_0x6cf6('0x25')](respondWithResult(_0x211b89,null))[_0x6cf6('0x4a')](handleError(_0x211b89,null));};exports[_0x6cf6('0x4f')]=function(_0x2cb470,_0x3e8aee){var _0x3800fe;return db[_0x6cf6('0x50')]['transaction'](function(_0x217072){return db[_0x6cf6('0x2f')][_0x6cf6('0x4f')](_0x2cb470[_0x6cf6('0x51')],{'transaction':_0x217072})[_0x6cf6('0x25')](function(_0x31947d){_0x3800fe=_0x31947d[_0x6cf6('0x52')]({'plain':!![]});return db[_0x6cf6('0x53')][_0x6cf6('0x4d')]({'where':{'id':_0x3800fe[_0x6cf6('0x54')]},'raw':!![]})[_0x6cf6('0x25')](function(_0x4fb831){return createVoicePrefixExtensions(_0x3800fe,_0x4fb831,_0x217072);});});})[_0x6cf6('0x25')](function(){var _0x4ec56b=_0x2cb470[_0x6cf6('0x55')][_0x6cf6('0x52')]({'plain':!![]});if(!_0x4ec56b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec56b[_0x6cf6('0x56')]===_0x6cf6('0x55')){var _0x4699d5=_0x3800fe;return db[_0x6cf6('0x57')][_0x6cf6('0x4d')]({'where':{'name':_0x6cf6('0x27'),'userProfileId':_0x4ec56b['userProfileId']},'raw':!![]})[_0x6cf6('0x25')](function(_0x167356){if(_0x167356&&_0x167356[_0x6cf6('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x4699d5[_0x6cf6('0x2c')],'resourceId':_0x4699d5['id'],'type':_0x167356[_0x6cf6('0x2c')],'sectionId':_0x167356['id']},{})['then'](function(){return _0x3800fe;});}else{return _0x3800fe;}})[_0x6cf6('0x4a')](function(_0x3559ab){logger[_0x6cf6('0x2a')](_0x6cf6('0x59'),_0x3559ab);throw _0x3559ab;});}return _0x3800fe;})[_0x6cf6('0x25')](respondWithResult(_0x3e8aee,null))['catch'](handleError(_0x3e8aee,null));};function Extension(_0x3e7e5b,_0x40b31f,_0x57f26b,_0x4cd6fe){this[_0x6cf6('0x5a')]=_0x6cf6('0x5b');this[_0x6cf6('0x5c')]=_0x3e7e5b;this[_0x6cf6('0x5d')]=_0x57f26b;this[_0x6cf6('0x32')]='system';this['description']=_0x6cf6('0x5e');this[_0x6cf6('0x5f')]=_0x40b31f;this[_0x6cf6('0x60')]=_0x4cd6fe;}function createVoicePrefixExtensions(_0x238002,_0xf8c052,_0x591a24){return new BPromise(function(_0x51dfcf,_0x52df24){var _0x39c857=new Extension(formatPrefixName(_0x238002[_0x6cf6('0x61')]),0x1,_0x6cf6('0x62'),_0x6cf6('0x63'));_0x39c857['VoicePrefixId']=_0x238002['id'];return db[_0x6cf6('0x53')]['create'](_0x39c857,{'transaction':_0x591a24})[_0x6cf6('0x25')](function(_0x54ef08){var _0x3842ff=_0x54ef08[_0x6cf6('0x52')]({'plain':!![]});var _0x2f2ee3=_[_0x6cf6('0x2e')](addVoicePrefixExtensions(_0x238002,_0xf8c052),function(_0x38ebcc){_0x38ebcc['VoiceExtensionId']=_0x3842ff['id'];_0x38ebcc[_0x6cf6('0x64')]=_0x238002['id'];return _0x38ebcc;});return db['VoiceExtension'][_0x6cf6('0x65')](_0x2f2ee3,{'transaction':_0x591a24})['then'](function(_0x4363f7){if(!_0x4363f7){return _0x52df24('Extensions\x20creation\x20failed');}else{return _0x51dfcf(_0x4363f7);}})[_0x6cf6('0x4a')](function(_0x42daab){return _0x52df24(_0x42daab);});});;});};function addVoicePrefixExtensions(_0x5df21f,_0x3b4cb){var _0x15ae6c=[];var _0x1c98c2=formatPrefixName(_0x5df21f[_0x6cf6('0x61')]);_0x15ae6c[_0x6cf6('0x66')](new Extension(_0x1c98c2,0x2,_0x6cf6('0x67'),_0x6cf6('0x68')+_0x5df21f['name']));if(_0x5df21f['callerIdAll']){_0x15ae6c[_0x6cf6('0x66')](new Extension(_0x1c98c2,0x3,_0x6cf6('0x67'),'PREFIX-CALLERIDALL='+_0x5df21f[_0x6cf6('0x69')]));}else{_0x15ae6c['push'](new Extension(_0x1c98c2,0x3,'NoOp',_0x6cf6('0x6a')));}_0x15ae6c['push'](new Extension(_0x1c98c2,0x4,'goto',_0x3b4cb[_0x6cf6('0x5a')]+','+_0x6cf6('0x6b')+(0x8+_0x5df21f[_0x6cf6('0x2c')]['length'])+'}'+','+0x1));return _0x15ae6c;}function formatPrefixName(_0x18b60c){var _0x4a2451='_';for(var _0x2dedba=0x0;_0x2dedba<_0x18b60c[_0x6cf6('0x3b')];_0x2dedba++){if(_0x18b60c['charAt'](_0x2dedba)=='-'){_0x4a2451+=_0x18b60c[_0x6cf6('0x6c')](_0x2dedba);}else{_0x4a2451+='['+_0x18b60c[_0x6cf6('0x6c')](_0x2dedba)+']';}}_0x4a2451+='.';return _0x4a2451;}exports[_0x6cf6('0x24')]=function(_0x421819,_0xa36ee1,_0x40ea5e){var _0x59180d=_0x421819[_0x6cf6('0x51')];_0x59180d[_0x6cf6('0x61')]=_0x6cf6('0x6d')+_0x59180d[_0x6cf6('0x2c')]+'-';return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0x55ea84){return db['VoicePrefix']['update'](_0x59180d,{'where':{'id':_0x59180d['id']},'transaction':_0x55ea84})[_0x6cf6('0x25')](function(){return db['VoiceExtension'][_0x6cf6('0x26')]({'where':{'VoicePrefixId':_0x59180d['id']},'transaction':_0x55ea84})['then'](function(){return db[_0x6cf6('0x53')][_0x6cf6('0x4d')]({'where':{'id':_0x59180d['VoiceExtensionId']},'raw':!![]})[_0x6cf6('0x25')](function(_0xd11d4b){return createVoicePrefixExtensions(_0x59180d,_0xd11d4b,_0x55ea84);});});});})[_0x6cf6('0x25')](function(){return db['VoicePrefix'][_0x6cf6('0x6f')](_0x59180d['id']);})['then'](respondWithResult(_0xa36ee1,null))[_0x6cf6('0x4a')](handleError(_0xa36ee1,null));};exports[_0x6cf6('0x70')]=function(_0x1635dc,_0x308076,_0x33b436){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x1635dc['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x308076,null))['then'](function(_0x3f3d67){if(_0x3f3d67){return _0x3f3d67[_0x6cf6('0x70')](_0x1635dc[_0x6cf6('0x51')][_0x6cf6('0x71')],_['omit'](_0x1635dc['body'],[_0x6cf6('0x71'),'id'])||{})[_0x6cf6('0x72')](function(_0x1a0c49){for(var _0x3060d=0x0;_0x3060d<_0x1635dc[_0x6cf6('0x51')][_0x6cf6('0x71')]['length'];_0x3060d+=0x1){socket['emit'](_0x6cf6('0x73'),{'UserId':Number(_0x1635dc['body'][_0x6cf6('0x71')][_0x3060d]),'VoicePrefixId':Number(_0x1635dc[_0x6cf6('0x4c')]['id'])});}return _0x1a0c49;});}})[_0x6cf6('0x25')](respondWithResult(_0x308076,null))[_0x6cf6('0x4a')](handleError(_0x308076,null));};exports['removeAgents']=function(_0x4435bc,_0x4c5f0d,_0x49cf03){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x4435bc['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x4c5f0d,null))[_0x6cf6('0x25')](function(_0x37fa59){if(_0x37fa59){return _0x37fa59['removeAgents'](_0x4435bc[_0x6cf6('0x35')][_0x6cf6('0x71')])[_0x6cf6('0x25')](function(){if(_['isArray'](_0x4435bc['query'][_0x6cf6('0x71')])){for(var _0x5189b6=0x0;_0x5189b6<_0x4435bc['query'][_0x6cf6('0x71')][_0x6cf6('0x3b')];_0x5189b6+=0x1){socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':Number(_0x4435bc[_0x6cf6('0x35')][_0x6cf6('0x71')][_0x5189b6]),'VoicePrefixId':Number(_0x4435bc[_0x6cf6('0x4c')]['id'])});}}else{socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':Number(_0x4435bc['query'][_0x6cf6('0x71')]),'VoicePrefixId':Number(_0x4435bc[_0x6cf6('0x4c')]['id'])});}});}})[_0x6cf6('0x25')](respondWithStatusCode(_0x4c5f0d,null))['catch'](handleError(_0x4c5f0d,null));};exports['getAgents']=function(_0x38b830,_0x169a33,_0x204f3d){var _0x1c254d={};var _0x38652f={};var _0x1fee93;var _0x5e953e;return db[_0x6cf6('0x2f')][_0x6cf6('0x76')]({'where':{'id':_0x38b830[_0x6cf6('0x4c')]['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x169a33,null))[_0x6cf6('0x25')](function(_0x260a62){if(_0x260a62){_0x1fee93=_0x260a62;_0x38652f[_0x6cf6('0x34')]=_['keys'](db[_0x6cf6('0x77')][_0x6cf6('0x30')]);_0x38652f['query']=_[_0x6cf6('0x36')](_0x38b830[_0x6cf6('0x35')]);_0x38652f[_0x6cf6('0x37')]=_['intersection'](_0x38652f[_0x6cf6('0x34')],_0x38652f[_0x6cf6('0x35')]);_0x1c254d[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x38652f[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x38b830['query']['fields']));_0x1c254d['attributes']=_0x1c254d[_0x6cf6('0x39')]['length']?_0x1c254d[_0x6cf6('0x39')]:_0x38652f[_0x6cf6('0x34')];_0x1c254d['order']=qs[_0x6cf6('0x3f')](_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x1c254d[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_['pick'](_0x38b830[_0x6cf6('0x35')],_0x38652f[_0x6cf6('0x37')]));if(_0x38b830[_0x6cf6('0x35')]['filter']){_0x1c254d['where']=_[_0x6cf6('0x42')](_0x1c254d[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0x1c254d[_0x6cf6('0x39')],function(_0x296664){var _0x1841b5={};_0x1841b5[_0x296664]={'$like':'%'+_0x38b830[_0x6cf6('0x35')]['filter']+'%'};return _0x1841b5;})});}_0x1c254d=_[_0x6cf6('0x42')]({},_0x1c254d,_0x38b830[_0x6cf6('0x45')]);return _0x1fee93[_0x6cf6('0x78')](_0x1c254d);}})['then'](function(_0x27c0cb){if(_0x27c0cb){_0x5e953e=_0x27c0cb[_0x6cf6('0x3b')];if(!_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x3c')]('nolimit')){_0x1c254d[_0x6cf6('0x1e')]=qs[_0x6cf6('0x1e')](_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x1e')]);_0x1c254d[_0x6cf6('0x1c')]=qs[_0x6cf6('0x1c')](_0x38b830[_0x6cf6('0x35')]['offset']);}return _0x1fee93['getAgents'](_0x1c254d);}})['then'](function(_0x5b1385){if(_0x5b1385){return _0x5b1385?{'count':_0x5e953e,'rows':_0x5b1385}:null;}})[_0x6cf6('0x25')](respondWithResult(_0x169a33,null))[_0x6cf6('0x4a')](handleError(_0x169a33,null));};exports['getTeams']=function(_0x165121,_0x16f407,_0x558601){var _0x41b355={};var _0x4fb1d9={};var _0x5b4b7c;var _0x267856;return db[_0x6cf6('0x2f')][_0x6cf6('0x76')]({'where':{'id':_0x165121[_0x6cf6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16f407,null))[_0x6cf6('0x25')](function(_0x12196d){if(_0x12196d){_0x5b4b7c=_0x12196d;_0x4fb1d9['model']=_[_0x6cf6('0x36')](db[_0x6cf6('0x79')]['rawAttributes']);_0x4fb1d9[_0x6cf6('0x35')]=_['keys'](_0x165121[_0x6cf6('0x35')]);_0x4fb1d9['filters']=_[_0x6cf6('0x38')](_0x4fb1d9[_0x6cf6('0x34')],_0x4fb1d9['query']);_0x41b355[_0x6cf6('0x39')]=_['intersection'](_0x4fb1d9['model'],qs[_0x6cf6('0x3a')](_0x165121[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x41b355[_0x6cf6('0x39')]=_0x41b355['attributes'][_0x6cf6('0x3b')]?_0x41b355[_0x6cf6('0x39')]:_0x4fb1d9[_0x6cf6('0x34')];_0x41b355[_0x6cf6('0x3e')]=qs[_0x6cf6('0x3f')](_0x165121[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x41b355[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_[_0x6cf6('0x41')](_0x165121[_0x6cf6('0x35')],_0x4fb1d9[_0x6cf6('0x37')]));if(_0x165121[_0x6cf6('0x35')][_0x6cf6('0x44')]){_0x41b355[_0x6cf6('0x40')]=_[_0x6cf6('0x42')](_0x41b355[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0x41b355[_0x6cf6('0x39')],function(_0x44ec79){var _0x506275={};_0x506275[_0x44ec79]={'$like':'%'+_0x165121[_0x6cf6('0x35')][_0x6cf6('0x44')]+'%'};return _0x506275;})});}_0x41b355=_[_0x6cf6('0x42')]({},_0x41b355,_0x165121[_0x6cf6('0x45')]);return _0x5b4b7c[_0x6cf6('0x7a')](_0x41b355);}})[_0x6cf6('0x25')](function(_0x1013cb){if(_0x1013cb){_0x267856=_0x1013cb['length'];if(!_0x165121['query']['hasOwnProperty'](_0x6cf6('0x3d'))){_0x41b355['limit']=qs[_0x6cf6('0x1e')](_0x165121[_0x6cf6('0x35')]['limit']);_0x41b355['offset']=qs[_0x6cf6('0x1c')](_0x165121['query'][_0x6cf6('0x1c')]);}return _0x5b4b7c[_0x6cf6('0x7a')](_0x41b355);}})[_0x6cf6('0x25')](function(_0x1ff190){if(_0x1ff190){return _0x1ff190?{'count':_0x267856,'rows':_0x1ff190}:null;}})[_0x6cf6('0x25')](respondWithResult(_0x16f407,null))[_0x6cf6('0x4a')](handleError(_0x16f407,null));};exports['addTeams']=function(_0x14cafd,_0x43e3ff,_0x5bf895){var _0x42098b=_0x14cafd[_0x6cf6('0x51')]['ids'];var _0x200234;return db[_0x6cf6('0x79')][_0x6cf6('0x48')]({'where':{'id':_0x42098b},'attributes':['id'],'include':[{'model':db[_0x6cf6('0x77')],'as':'Agents','attributes':['id',_0x6cf6('0x2c'),_0x6cf6('0x7b'),_0x6cf6('0x7c'),_0x6cf6('0x7d')],'raw':!![]}]})['then'](function(_0xc0ecf4){if(_0xc0ecf4){_0x200234=_0xc0ecf4;var _0x17b193=_[_0x6cf6('0x7e')](_0xc0ecf4,function(_0x2b083f){var _0x54422f=_0x2b083f['get']({'plain':!![]});return _0x54422f[_0x6cf6('0x7f')];});return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x14cafd[_0x6cf6('0x4c')]['id']}})['then'](function(_0x4a5e51){return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0xb9cbc3){return _0x4a5e51[_0x6cf6('0x80')](_0x42098b,{'transaction':_0xb9cbc3})[_0x6cf6('0x25')](function(){return BPromise[_0x6cf6('0x81')](_0x200234,function(_0x53f0a3){return db[_0x6cf6('0x82')][_0x6cf6('0x83')]({'TeamId':_0x53f0a3['id'],'VoicePrefixId':_0x14cafd[_0x6cf6('0x4c')]['id']},{'transaction':_0xb9cbc3});});})[_0x6cf6('0x25')](function(){return BPromise[_0x6cf6('0x81')](_0x17b193,function(_0x450ffb){return db[_0x6cf6('0x84')][_0x6cf6('0x85')]({'where':{'UserId':_0x450ffb['id'],'VoicePrefixId':_0x14cafd[_0x6cf6('0x4c')]['id']},'transaction':_0xb9cbc3});});})[_0x6cf6('0x25')](function(){_0x17b193[_0x6cf6('0x86')](function(_0x476abd){socket[_0x6cf6('0x74')](_0x6cf6('0x73'),{'UserId':_0x476abd['id'],'VoicePrefixId':_0x4a5e51['id']});});});});});}})[_0x6cf6('0x25')](respondWithStatusCode(_0x43e3ff,null))[_0x6cf6('0x4a')](handleError(_0x43e3ff,null));};exports['removeTeams']=function(_0x17b497,_0x1f5c50,_0x46ecdb){return db['Team']['findAll']({'where':{'id':_0x17b497['query'][_0x6cf6('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6cf6('0x25')](handleEntityNotFound(_0x1f5c50,null))[_0x6cf6('0x25')](function(_0x41aae0){var _0x208719=_['map'](_0x41aae0,'id');var _0x395343=[];var _0x4669b2=[];var _0x91f143=squel[_0x6cf6('0x87')]();_0x91f143[_0x6cf6('0x88')](_0x6cf6('0x89'))[_0x6cf6('0x8a')](_0x6cf6('0x8b'),'tq')[_0x6cf6('0x8c')](_0x6cf6('0x8d'),'ut',_0x6cf6('0x8e'))[_0x6cf6('0x40')](_0x6cf6('0x8f'),_0x17b497['params']['id']);for(var _0x210578=0x0;_0x210578<_0x41aae0['length'];_0x210578+=0x1){let _0xeff7c=_0x41aae0[_0x210578];for(var _0x5e90f0=0x0;_0x5e90f0<_0xeff7c[_0x6cf6('0x7f')][_0x6cf6('0x3b')];_0x5e90f0+=0x1){let _0x193ad7=_0xeff7c['Agents'][_0x5e90f0];var _0x50def2=_0x91f143[_0x6cf6('0x90')]();_0x50def2[_0x6cf6('0x40')](_0x6cf6('0x91'),_0x193ad7['id']);_0x4669b2[_0x6cf6('0x66')](db['sequelize']['query'](_0x50def2[_0x6cf6('0x92')](),{'type':db['sequelize'][_0x6cf6('0x93')][_0x6cf6('0x94')]})[_0x6cf6('0x25')](function(_0x279675){if(_0x279675[_0x6cf6('0x3b')]===0x1){return _0x193ad7['id'];}else{var _0x3e0d2d=_[_0x6cf6('0x95')](_[_0x6cf6('0x2e')](_0x279675,'TeamId'),function(_0x414e9e){return _[_0x6cf6('0x96')](_0x208719,_0x414e9e);});if(_0x3e0d2d){return _0x193ad7['id'];}}}));}}return BPromise[_0x6cf6('0x97')](_0x4669b2)[_0x6cf6('0x25')](function(_0x1b32e6){_0x395343=_(_0x395343)['union'](_0x1b32e6)[_0x6cf6('0x98')]()['value']();return db['VoicePrefix'][_0x6cf6('0x4d')]({'where':{'id':_0x17b497['params']['id']}})['then'](function(_0x2ca336){return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0x3a1d61){return _0x2ca336['removeTeams'](_0x17b497[_0x6cf6('0x35')]['ids'],{'transaction':_0x3a1d61})[_0x6cf6('0x25')](function(){if(!_[_0x6cf6('0x99')](_0x395343)){return _0x2ca336[_0x6cf6('0x9a')](_0x395343,{'transaction':_0x3a1d61});}})[_0x6cf6('0x25')](function(){_0x395343[_0x6cf6('0x86')](function(_0x48e595){socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':_0x48e595,'VoicePrefixId':_0x2ca336['id']});});});});});});})[_0x6cf6('0x25')](respondWithStatusCode(_0x1f5c50,null))[_0x6cf6('0x4a')](handleError(_0x1f5c50,null));}; \ No newline at end of file +var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x2a57a5,_0x795b7f){var _0x110fae=function(_0x2d39d4){while(--_0x2d39d4){_0x2a57a5['push'](_0x2a57a5['shift']());}};_0x110fae(++_0x795b7f);}(_0x2032,0xd9));var _0x2203=function(_0x44d9dc,_0x37f590){_0x44d9dc=_0x44d9dc-0x0;var _0x379386=_0x2032[_0x44d9dc];return _0x379386;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1cfdb8f..c32b0ed 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 _0x1b6e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x1d0b2e,_0x1a6a14){var _0x58e36c=function(_0x13187c){while(--_0x13187c){_0x1d0b2e['push'](_0x1d0b2e['shift']());}};_0x58e36c(++_0x1a6a14);}(_0x1b6e,0x101));var _0xe1b6=function(_0x4f8219,_0x31ac49){_0x4f8219=_0x4f8219-0x0;var _0x524760=_0x1b6e[_0x4f8219];return _0x524760;};'use strict';var EventEmitter=require(_0xe1b6('0x0'));var VoicePrefix=require(_0xe1b6('0x1'))['db'][_0xe1b6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1b6('0x3'),'afterUpdate':_0xe1b6('0x4'),'afterDestroy':_0xe1b6('0x5')};function emitEvent(_0x3547ed){return function(_0x2307e2,_0x1a97f8,_0xd155ee){VoicePrefixEvents[_0xe1b6('0x6')](_0x3547ed+':'+_0x2307e2['id'],_0x2307e2);VoicePrefixEvents[_0xe1b6('0x6')](_0x3547ed,_0x2307e2);_0xd155ee(null);};}for(var e in events){if(events[_0xe1b6('0x7')](e)){var event=events[e];VoicePrefix[_0xe1b6('0x8')](e,emitEvent(event));}}module[_0xe1b6('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x00a2=['save','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2be720,_0x4b5c86){var _0x53a4db=function(_0x214a65){while(--_0x214a65){_0x2be720['push'](_0x2be720['shift']());}};_0x53a4db(++_0x4b5c86);}(_0x00a2,0x1b0));var _0x200a=function(_0x457c78,_0x318d65){_0x457c78=_0x457c78-0x0;var _0x235cf5=_0x00a2[_0x457c78];return _0x235cf5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x200a('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x200a('0x1')](0x0);var events={'afterCreate':_0x200a('0x2'),'afterUpdate':'update','afterDestroy':_0x200a('0x3')};function emitEvent(_0x4a6cf2){return function(_0x6295fa,_0x4a71e8,_0x3f4756){VoicePrefixEvents[_0x200a('0x4')](_0x4a6cf2+':'+_0x6295fa['id'],_0x6295fa);VoicePrefixEvents[_0x200a('0x4')](_0x4a6cf2,_0x6295fa);_0x3f4756(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x200a('0x5')](e,emitEvent(event));}}module[_0x200a('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 94940f3..e40f2d8 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 _0x9011=['bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','api'];(function(_0x4228b4,_0x39d707){var _0x1ccc00=function(_0x3783af){while(--_0x3783af){_0x4228b4['push'](_0x4228b4['shift']());}};_0x1ccc00(++_0x39d707);}(_0x9011,0xdb));var _0x1901=function(_0x34513e,_0x482878){_0x34513e=_0x34513e-0x0;var _0x30e3a6=_0x9011[_0x34513e];return _0x30e3a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1901('0x0'));var moment=require('moment');var BPromise=require(_0x1901('0x1'));var rp=require(_0x1901('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1901('0x3'));var config=require(_0x1901('0x4'));var attributes=require(_0x1901('0x5'));module[_0x1901('0x6')]=function(_0x340cea,_0x3182ee){return _0x340cea[_0x1901('0x7')](_0x1901('0x8'),attributes,{'tableName':_0x1901('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x230c=['api','request-promise','rimraf','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3285e2,_0x18f568){var _0x23be75=function(_0x2dfd24){while(--_0x2dfd24){_0x3285e2['push'](_0x3285e2['shift']());}};_0x23be75(++_0x18f568);}(_0x230c,0x151));var _0xc230=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x230c[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0xc230('0x0'));var util=require(_0xc230('0x1'));var logger=require(_0xc230('0x2'))(_0xc230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc230('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xc230('0x6')]=function(_0x26704b,_0x20f8e5){return _0x26704b[_0xc230('0x7')](_0xc230('0x8'),attributes,{'tableName':_0xc230('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 0d8ca59..21491ad 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 _0x44c2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','socket.io-emitter','redis','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x28de75,_0x103055){var _0xa1b275=function(_0x2b7dda){while(--_0x2b7dda){_0x28de75['push'](_0x28de75['shift']());}};_0xa1b275(++_0x103055);}(_0x44c2,0x100));var _0x244c=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x44c2[_0x3cea78];return _0x33b66b;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});config['redis']=_[_0x244c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x244c('0xc'))(new Redis(config[_0x244c('0xd')]));require('./voicePrefix.socket')[_0x244c('0xe')](socket);function respondWithRpcPromise(_0x5b873e,_0x519feb,_0x10a810){return new BPromise(function(_0x4d7289,_0x16c6f9){return client['request'](_0x5b873e,_0x10a810)[_0x244c('0xf')](function(_0x53c038){logger['info'](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));logger[_0x244c('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x519feb,_0x244c('0x11'),JSON[_0x244c('0x13')](_0x53c038));if(_0x53c038[_0x244c('0x14')]){if(_0x53c038[_0x244c('0x14')][_0x244c('0x15')]===0x1f4){logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038['error'][_0x244c('0x16')]);return _0x16c6f9(_0x53c038['error']['message']);}logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038[_0x244c('0x14')][_0x244c('0x16')]);return _0x4d7289(_0x53c038['error'][_0x244c('0x16')]);}else{logger[_0x244c('0x17')](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));_0x4d7289(_0x53c038[_0x244c('0x18')]['message']);}})[_0x244c('0x19')](function(_0x2af7eb){logger[_0x244c('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x519feb,_0x2af7eb);_0x16c6f9(_0x2af7eb);});});} \ No newline at end of file +var _0x8fcd=['rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x4ff860,_0x428bd4){_0x4ff860=_0x4ff860-0x0;var _0x5ac8aa=_0x8fcd[_0x4ff860];return _0x5ac8aa;};'use strict';var _=require(_0xd8fc('0x0'));var util=require(_0xd8fc('0x1'));var moment=require(_0xd8fc('0x2'));var BPromise=require(_0xd8fc('0x3'));var rs=require(_0xd8fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8fc('0x5'));var logger=require(_0xd8fc('0x6'))(_0xd8fc('0x7'));var config=require(_0xd8fc('0x8'));var jayson=require(_0xd8fc('0x9'));var client=jayson[_0xd8fc('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd8fc('0xb')](config['redis'],{'host':_0xd8fc('0xc'),'port':0x18eb});var socket=require(_0xd8fc('0xd'))(new Redis(config[_0xd8fc('0xe')]));require(_0xd8fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ce1ee,_0x16ef0c,_0x575049){return new BPromise(function(_0x49ac65,_0x1a1927){return client[_0xd8fc('0x10')](_0x5ce1ee,_0x575049)['then'](function(_0x4f3823){logger[_0xd8fc('0x11')](_0xd8fc('0x12'),_0x16ef0c,'request\x20sent');logger[_0xd8fc('0x13')](_0xd8fc('0x14'),_0x16ef0c,_0xd8fc('0x15'),JSON[_0xd8fc('0x16')](_0x4f3823));if(_0x4f3823[_0xd8fc('0x17')]){if(_0x4f3823['error'][_0xd8fc('0x18')]===0x1f4){logger['error'](_0xd8fc('0x12'),_0x16ef0c,_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);return _0x1a1927(_0x4f3823['error'][_0xd8fc('0x19')]);}logger[_0xd8fc('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x16ef0c,_0x4f3823['error'][_0xd8fc('0x19')]);return _0x49ac65(_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);}else{logger['info'](_0xd8fc('0x12'),_0x16ef0c,_0xd8fc('0x15'));_0x49ac65(_0x4f3823[_0xd8fc('0x1a')][_0xd8fc('0x19')]);}})[_0xd8fc('0x1b')](function(_0x373654){logger[_0xd8fc('0x17')](_0xd8fc('0x12'),_0x16ef0c,_0x373654);_0x1a1927(_0x373654);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b0ec993..0ecc41b 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 _0x063c=['voicePrefix:','save','remove','update','length'];(function(_0x3e5c23,_0xf5b71d){var _0x4f7a0c=function(_0x14ef28){while(--_0x14ef28){_0x3e5c23['push'](_0x3e5c23['shift']());}};_0x4f7a0c(++_0xf5b71d);}(_0x063c,0xba));var _0xc063=function(_0x3505a5,_0x1c52bf){_0x3505a5=_0x3505a5-0x0;var _0xb1fdc3=_0x063c[_0x3505a5];return _0xb1fdc3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc063('0x0'),_0xc063('0x1'),_0xc063('0x2')];function createListener(_0x25e61c,_0x314f1b){return function(_0x33d075){_0x314f1b['emit'](_0x25e61c,_0x33d075);};}function removeListener(_0x3803ac,_0x5ec48e){return function(){VoicePrefixEvents['removeListener'](_0x3803ac,_0x5ec48e);};}exports['register']=function(_0x182d20){for(var _0xe2a646=0x0,_0x57ba85=events[_0xc063('0x3')];_0xe2a646<_0x57ba85;_0xe2a646++){var _0x10716b=events[_0xe2a646];var _0x3f286a=createListener(_0xc063('0x4')+_0x10716b,_0x182d20);VoicePrefixEvents['on'](_0x10716b,_0x3f286a);}}; \ No newline at end of file +var _0x6d2e=['voicePrefix:','save','remove','update','register','length'];(function(_0x54c32f,_0x59dd58){var _0x2b3f6c=function(_0x9db75a){while(--_0x9db75a){_0x54c32f['push'](_0x54c32f['shift']());}};_0x2b3f6c(++_0x59dd58);}(_0x6d2e,0x97));var _0xe6d2=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x6d2e[_0x1085db];return _0x392a60;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xe6d2('0x0'),_0xe6d2('0x1'),_0xe6d2('0x2')];function createListener(_0x3ff4b6,_0x412889){return function(_0xf81df7){_0x412889['emit'](_0x3ff4b6,_0xf81df7);};}function removeListener(_0x2dee74,_0x5dc6e4){return function(){VoicePrefixEvents['removeListener'](_0x2dee74,_0x5dc6e4);};}exports[_0xe6d2('0x3')]=function(_0x2b4bf0){for(var _0x3c0fab=0x0,_0x4d9c9f=events[_0xe6d2('0x4')];_0x3c0fab<_0x4d9c9f;_0x3c0fab++){var _0x53906e=events[_0x3c0fab];var _0x2e227e=createListener(_0xe6d2('0x5')+_0x53906e,_0x2b4bf0);VoicePrefixEvents['on'](_0x53906e,_0x2e227e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ceb5dc3..de2fe35 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(_0x59117e,_0x444da3){var _0x59cf49=function(_0x53f9ba){while(--_0x53f9ba){_0x59117e['push'](_0x59117e['shift']());}};_0x59cf49(++_0x444da3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x418b15,_0x5e73d3){var _0x2f5d3d=function(_0x3fe1b6){while(--_0x3fe1b6){_0x418b15['push'](_0x418b15['shift']());}};_0x2f5d3d(++_0x5e73d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 a25bb6d..95ff5f2 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 _0x333c=['#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\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','strategy','type','dialMethod','getDataValue','preview','roundrobin','setDataValue','INTEGER','yes','all','ENUM','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','power','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','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)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#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'];(function(_0xeee8f2,_0x351024){var _0x16102b=function(_0x1617cc){while(--_0x1617cc){_0xeee8f2['push'](_0xeee8f2['shift']());}};_0x16102b(++_0x351024);}(_0x333c,0x1e2));var _0xc333=function(_0x23f98f,_0x2aefba){_0x23f98f=_0x23f98f-0x0;var _0x43540f=_0x333c[_0x23f98f];return _0x43540f;};'use strict';var Sequelize=require(_0xc333('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc333('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc333('0x2'),_0xc333('0x3')),'allowNull':![],'defaultValue':_0xc333('0x2')},'musiconhold':{'type':Sequelize[_0xc333('0x4')],'defaultValue':_0xc333('0x5')},'announce':{'type':Sequelize[_0xc333('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xc333('0x6'),_0xc333('0x7'),_0xc333('0x8'),_0xc333('0x9'),_0xc333('0xa'),'linear',_0xc333('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0xc333('0x6'),'set':function(_0x15b260){this['setDataValue'](_0xc333('0xc'),_0x15b260?_0x15b260:_0xc333('0xa'));},'get':function(){var _0x54931a=this['getDataValue'](_0xc333('0xd'));var _0x406e6f=this['getDataValue'](_0xc333('0xe'));var _0x364822=this[_0xc333('0xf')](_0xc333('0xc'));if(_0x54931a===_0xc333('0x3')){if(_0x406e6f===_0xc333('0x10')){return null;}if(_0x406e6f==='booked'&&![_0xc333('0xa'),_0xc333('0x11')]['includes'](_0x364822)){this[_0xc333('0x12')](_0xc333('0xc'),_0xc333('0xa'));}}return _0x364822;}},'servicelevel':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc333('0x13')](0xb)},'timeout':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc333('0x14'),'no'),'defaultValue':_0xc333('0x14')},'autopause':{'type':Sequelize['ENUM'](_0xc333('0x14'),'no',_0xc333('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc333('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc333('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc333('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xc333('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no',_0xc333('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc333('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xc333('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc333('0x16')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc333('0x4')]},'queue_youarenext':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc333('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc333('0x4')]},'queue_quantity1':{'type':Sequelize[_0xc333('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc333('0x4')]},'queue_less_than':{'type':Sequelize[_0xc333('0x4')]},'periodic_announce':{'type':Sequelize[_0xc333('0x18')],'set':function(_0x14a2c1){this['setDataValue'](_0xc333('0x19'),_0x14a2c1?_0x14a2c1[_0xc333('0x1a')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this['getDataValue']('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0xc333('0x4')],'defaultValue':'yes','set':function(_0x5c0bc1){this['setDataValue']('joinempty',_0x5c0bc1?_0x5c0bc1[_0xc333('0x1a')](','):undefined);},'get':function(){return this[_0xc333('0xf')](_0xc333('0x1b'))?this[_0xc333('0xf')](_0xc333('0x1b'))[_0xc333('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc333('0x4')],'defaultValue':'no','set':function(_0x2f12d7){this['setDataValue'](_0xc333('0x1d'),_0x2f12d7?_0x2f12d7[_0xc333('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xc333('0x1d'))?this[_0xc333('0xf')](_0xc333('0x1d'))[_0xc333('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc333('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3a8301){this[_0xc333('0x12')]('acw',_0x3a8301);if(_0x3a8301){if(this[_0xc333('0xf')](_0xc333('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc333('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x10'),'progressive',_0xc333('0x20'),'predictive',_0xc333('0x21')),'defaultValue':_0xc333('0x22'),'comment':_0xc333('0x23')},'dialLimitChannel':{'type':Sequelize[_0xc333('0x13')](0x4)[_0xc333('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc333('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc333('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc333('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc333('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xc333('0x16')](_0xc333('0x28'),_0xc333('0x29')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc333('0x2a')](0x2)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xc333('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc333('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc333('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc333('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xc333('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xc333('0x4')],'defaultValue':_0xc333('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x2d')},'dialQueueProject':{'type':Sequelize[_0xc333('0x4')],'comment':_0xc333('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc333('0x13')](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc333('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc333('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'comment':_0xc333('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc333('0x13')](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc333('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc333('0x4')],'defaultValue':_0xc333('0x34')},'dialPrefix':{'type':Sequelize[_0xc333('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc333('0x16')]('always',_0xc333('0x35'),_0xc333('0x36')),'defaultValue':_0xc333('0x37')},'dialAMDActive':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':0x0,'comment':_0xc333('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xc333('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc333('0x13')](0x9)[_0xc333('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc333('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc333('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc333('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc333('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc333('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc333('0x13')](0x9)[_0xc333('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc333('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc333('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc333('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc333('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc333('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc333('0x13')](0x9)[_0xc333('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc333('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xc333('0x13')](0x5)[_0xc333('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc333('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':0x0,'comment':_0xc333('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc333('0x42'),_0xc333('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc333('0x4')],'comment':_0xc333('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc333('0x44')},'dialCutDigit':{'type':Sequelize[_0xc333('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc333('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc333('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc333('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc333('0x13')](0x5)[_0xc333('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc333('0x13')],'allowNull':!![],'comment':_0xc333('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x268d34){if(!_0x268d34)this[_0xc333('0x12')](_0xc333('0x4c'),null);this[_0xc333('0x12')](_0xc333('0x4d'),_0x268d34);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc333('0x13')](0x3)[_0xc333('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc333('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x1005=['outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','join','joinempty','leavewhenempty','split','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound'];(function(_0x4bd440,_0x54a806){var _0x1b5f2a=function(_0x3bffe2){while(--_0x3bffe2){_0x4bd440['push'](_0x4bd440['shift']());}};_0x1b5f2a(++_0x54a806);}(_0x1005,0x9a));var _0x5100=function(_0x534673,_0x17ab56){_0x534673=_0x534673-0x0;var _0x241540=_0x1005[_0x534673];return _0x241540;};'use strict';var Sequelize=require(_0x5100('0x0'));module[_0x5100('0x1')]={'name':{'type':Sequelize[_0x5100('0x2')],'allowNull':![],'unique':_0x5100('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x5'),_0x5100('0x6')),'allowNull':![],'defaultValue':_0x5100('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x5100('0x7')},'announce':{'type':Sequelize[_0x5100('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5100('0x4')]('rr',_0x5100('0x8'),_0x5100('0x9'),_0x5100('0xa'),'random',_0x5100('0xb'),_0x5100('0xc'),'wrandom',_0x5100('0xd')),'allowNull':![],'defaultValue':_0x5100('0x8'),'set':function(_0x5078e8){this['setDataValue'](_0x5100('0xe'),_0x5078e8?_0x5078e8:_0x5100('0xb'));},'get':function(){var _0x5855db=this[_0x5100('0xf')](_0x5100('0x10'));var _0x482f44=this[_0x5100('0xf')](_0x5100('0x11'));var _0x242828=this[_0x5100('0xf')](_0x5100('0xe'));if(_0x5855db===_0x5100('0x6')){if(_0x482f44===_0x5100('0x12')){return null;}if(_0x482f44===_0x5100('0x13')&&!['rrmemory',_0x5100('0x14')][_0x5100('0x15')](_0x242828)){this['setDataValue'](_0x5100('0xe'),_0x5100('0xb'));}}return _0x242828;}},'servicelevel':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5100('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5100('0x2')]},'weight':{'type':Sequelize[_0x5100('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':_0x5100('0x17')},'autopause':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5100('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5100('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5100('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':_0x5100('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x5100('0x17'),'no',_0x5100('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x5100('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5100('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5100('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5100('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x5100('0x2')]},'queue_quantity2':{'type':Sequelize[_0x5100('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5100('0x2')]},'periodic_announce':{'type':Sequelize[_0x5100('0x19')],'set':function(_0x1a9982){this[_0x5100('0x1a')](_0x5100('0x1b'),_0x1a9982?_0x1a9982[_0x5100('0x1c')](','):[]);},'get':function(){return this[_0x5100('0xf')]('periodic_announce')?this['getDataValue']('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x5100('0x2')],'defaultValue':_0x5100('0x17'),'set':function(_0x253a3e){this[_0x5100('0x1a')]('joinempty',_0x253a3e?_0x253a3e[_0x5100('0x1c')](','):undefined);},'get':function(){return this[_0x5100('0xf')]('joinempty')?this[_0x5100('0xf')](_0x5100('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5100('0x2')],'defaultValue':'no','set':function(_0x59c5ca){this[_0x5100('0x1a')](_0x5100('0x1e'),_0x59c5ca?_0x59c5ca[_0x5100('0x1c')](','):undefined);},'get':function(){return this[_0x5100('0xf')](_0x5100('0x1e'))?this[_0x5100('0xf')](_0x5100('0x1e'))[_0x5100('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5100('0x2')]},'description':{'type':Sequelize[_0x5100('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2a9936){this[_0x5100('0x1a')]('acw',_0x2a9936);if(_0x2a9936){if(this[_0x5100('0xf')](_0x5100('0x20'))<0x2){this[_0x5100('0x1a')](_0x5100('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5100('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x22')},'dialMethod':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x12'),_0x5100('0x23'),'power',_0x5100('0x24'),_0x5100('0x13')),'defaultValue':_0x5100('0x23'),'comment':_0x5100('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x5100('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5100('0x27')},'dialLimitQueue':{'type':Sequelize[_0x5100('0x16')](0x4)[_0x5100('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5100('0x28')},'dialPowerLevel':{'type':Sequelize[_0x5100('0x29')](0x2)[_0x5100('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5100('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x5100('0x4')](_0x5100('0x2b'),_0x5100('0x2c')),'defaultValue':_0x5100('0x2c'),'comment':_0x5100('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5100('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5100('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5100('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x5100('0x2')],'defaultValue':'tTxX','comment':_0x5100('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x5100('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5100('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x5100('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5100('0x4')]('always',_0x5100('0x37'),_0x5100('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5100('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5100('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5100('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5100('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5100('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5100('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5100('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5100('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5100('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5100('0x16')](0x9)[_0x5100('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5100('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5100('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x5100('0x21')],'defaultValue':0x0,'comment':_0x5100('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5100('0x4')]('DESC',_0x5100('0x43')),'defaultValue':_0x5100('0x44')},'dialQueueProject2':{'type':Sequelize[_0x5100('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5100('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5100('0x45')},'dialCutDigit':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5100('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5100('0x16')](0x5)[_0x5100('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5100('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5100('0x16')],'allowNull':!![],'comment':_0x5100('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x5100('0x21')],'defaultValue':![],'comment':_0x5100('0x4d'),'set':function(_0x4ad1b2){if(!_0x4ad1b2)this[_0x5100('0x1a')](_0x5100('0x4e'),null);this[_0x5100('0x1a')](_0x5100('0x4f'),_0x4ad1b2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5100('0x16')](0x3)[_0x5100('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5100('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5100('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 7521465..c846091 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 _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','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','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6aa7,0x178));var _0x76aa=function(_0x13488d,_0x5154d3){_0x13488d=_0x13488d-0x0;var _0x44f04b=_0x6aa7[_0x13488d];return _0x44f04b;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file +var _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0xf7d075,_0x539abc){var _0x173271=function(_0x57ce31){while(--_0x57ce31){_0xf7d075['push'](_0xf7d075['shift']());}};_0x173271(++_0x539abc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5e6108,_0x163a06){_0x5e6108=_0x5e6108-0x0;var _0xefdc5a=_0x8ef6[_0x5e6108];return _0xefdc5a;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 647d8f9..731ea7c 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 _0x9f4b=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1fbc86,_0x3dfd34){var _0x385e3c=function(_0x572484){while(--_0x572484){_0x1fbc86['push'](_0x1fbc86['shift']());}};_0x385e3c(++_0x3dfd34);}(_0x9f4b,0x110));var _0xb9f4=function(_0x3be351,_0x55282e){_0x3be351=_0x3be351-0x0;var _0x1f5e81=_0x9f4b[_0x3be351];return _0x1f5e81;};'use strict';var EventEmitter=require(_0xb9f4('0x0'));var VoiceQueue=require(_0xb9f4('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb9f4('0x2')](0x0);var events={'afterCreate':_0xb9f4('0x3'),'afterUpdate':'update','afterDestroy':_0xb9f4('0x4')};function emitEvent(_0x1d9c31){return function(_0x10d7cd,_0x1fd61d,_0x346599){VoiceQueueEvents[_0xb9f4('0x5')](_0x1d9c31+':'+_0x10d7cd['id'],_0x10d7cd);VoiceQueueEvents[_0xb9f4('0x5')](_0x1d9c31,_0x10d7cd);_0x346599(null);};}for(var e in events){if(events[_0xb9f4('0x6')](e)){var event=events[e];VoiceQueue[_0xb9f4('0x7')](e,emitEvent(event));}}module[_0xb9f4('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x00b4=['hook','exports','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x00b4,0x16a));var _0x400b=function(_0x1fd79c,_0x45c7f1){_0x1fd79c=_0x1fd79c-0x0;var _0x17b4e7=_0x00b4[_0x1fd79c];return _0x17b4e7;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x400b('0x0'))['db'][_0x400b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x400b('0x2'),'afterUpdate':_0x400b('0x3'),'afterDestroy':_0x400b('0x4')};function emitEvent(_0x4a6d55){return function(_0x31187d,_0xeb17eb,_0x43f8de){VoiceQueueEvents[_0x400b('0x5')](_0x4a6d55+':'+_0x31187d['id'],_0x31187d);VoiceQueueEvents['emit'](_0x4a6d55,_0x31187d);_0x43f8de(null);};}for(var e in events){if(events[_0x400b('0x6')](e)){var event=events[e];VoiceQueue[_0x400b('0x7')](e,emitEvent(event));}}module[_0x400b('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 4567537..768a6a8 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x27d4b8,_0xd5a5bc){var _0x57ceba=function(_0x47aea0){while(--_0x47aea0){_0x27d4b8['push'](_0x27d4b8['shift']());}};_0x57ceba(++_0xd5a5bc);}(_0x34e8,0x12c));var _0x834e=function(_0x2cf0b9,_0x2351b6){_0x2cf0b9=_0x2cf0b9-0x0;var _0x3c15e1=_0x34e8[_0x2cf0b9];return _0x3c15e1;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5eeb19,_0x4e1c27){var _0x1f85bc=function(_0x1f4dfe){while(--_0x1f4dfe){_0x5eeb19['push'](_0x5eeb19['shift']());}};_0x1f85bc(++_0x4e1c27);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a460937..92c9a40 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 _0xddcd=['then','stringify','GetVoiceQueue','find','ShowVoiceQueue','lodash','bluebird','randomstring','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','VoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','VoiceQueue','findAll','options','raw','where','include','map','attributes','model'];(function(_0x249e94,_0x36ecd1){var _0x8f3411=function(_0x246bf9){while(--_0x246bf9){_0x249e94['push'](_0x249e94['shift']());}};_0x8f3411(++_0x36ecd1);}(_0xddcd,0xd1));var _0xdddc=function(_0x32976e,_0x4ec333){_0x32976e=_0x32976e-0x0;var _0x17449b=_0xddcd[_0x32976e];return _0x17449b;};'use strict';var _=require(_0xdddc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdddc('0x1'));var rs=require(_0xdddc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdddc('0x3'));var config=require('../../config/environment');var jayson=require(_0xdddc('0x4'));var client=jayson[_0xdddc('0x5')][_0xdddc('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdddc('0x7')],{'host':_0xdddc('0x8'),'port':0x18eb});var socket=require(_0xdddc('0x9'))(new Redis(config[_0xdddc('0x7')]));require('./voiceQueue.socket')[_0xdddc('0xa')](socket);function respondWithRpcPromise(_0x59b47e,_0x235e1b,_0x11f278){return new BPromise(function(_0x543ebd,_0x59d702){return client['request'](_0x59b47e,_0x11f278)['then'](function(_0x203885){logger[_0xdddc('0xb')]('VoiceQueue,\x20%s,\x20%s',_0x235e1b,'request\x20sent');logger[_0xdddc('0xc')](_0xdddc('0xd'),_0x235e1b,'request\x20sent',JSON['stringify'](_0x203885));if(_0x203885[_0xdddc('0xe')]){if(_0x203885['error']['code']===0x1f4){logger[_0xdddc('0xe')](_0xdddc('0xf'),_0x235e1b,_0x203885[_0xdddc('0xe')][_0xdddc('0x10')]);return _0x59d702(_0x203885['error']['message']);}logger[_0xdddc('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x235e1b,_0x203885[_0xdddc('0xe')]['message']);return _0x543ebd(_0x203885[_0xdddc('0xe')][_0xdddc('0x10')]);}else{logger[_0xdddc('0xb')](_0xdddc('0xf'),_0x235e1b,_0xdddc('0x11'));_0x543ebd(_0x203885[_0xdddc('0x12')][_0xdddc('0x10')]);}})[_0xdddc('0x13')](function(_0x4d5646){logger[_0xdddc('0xe')](_0xdddc('0xf'),_0x235e1b,_0x4d5646);_0x59d702(_0x4d5646);});});}exports['GetVoiceQueue']=function(_0x5841f8){var _0x4294fa=this;return new Promise(function(_0x4bb214,_0x5ac629){return db[_0xdddc('0x14')][_0xdddc('0x15')]({'raw':_0x5841f8['options']?_0x5841f8[_0xdddc('0x16')][_0xdddc('0x17')]===undefined?!![]:![]:!![],'where':_0x5841f8['options']?_0x5841f8[_0xdddc('0x16')][_0xdddc('0x18')]||null:null,'attributes':_0x5841f8[_0xdddc('0x16')]?_0x5841f8[_0xdddc('0x16')]['attributes']||null:null,'limit':_0x5841f8[_0xdddc('0x16')]?_0x5841f8['options']['limit']||null:null,'include':_0x5841f8[_0xdddc('0x16')]?_0x5841f8['options'][_0xdddc('0x19')]?_['map'](_0x5841f8[_0xdddc('0x16')]['include'],function(_0x5c0264){return{'model':db[_0x5c0264['model']],'as':_0x5c0264['as'],'attributes':_0x5c0264['attributes'],'include':_0x5c0264[_0xdddc('0x19')]?_[_0xdddc('0x1a')](_0x5c0264[_0xdddc('0x19')],function(_0x87a16f){return{'model':db[_0x87a16f['model']],'as':_0x87a16f['as'],'attributes':_0x87a16f[_0xdddc('0x1b')],'include':_0x87a16f[_0xdddc('0x19')]?_[_0xdddc('0x1a')](_0x87a16f['include'],function(_0x2d7eed){return{'model':db[_0x2d7eed[_0xdddc('0x1c')]],'as':_0x2d7eed['as'],'attributes':_0x2d7eed[_0xdddc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdddc('0x1d')](function(_0x148508){logger[_0xdddc('0xb')]('GetVoiceQueue',_0x5841f8);logger[_0xdddc('0xc')]('GetVoiceQueue',_0x5841f8,JSON[_0xdddc('0x1e')](_0x148508));_0x4bb214(_0x148508);})[_0xdddc('0x13')](function(_0x456cc7){logger[_0xdddc('0xe')](_0xdddc('0x1f'),_0x456cc7[_0xdddc('0x10')],_0x5841f8);_0x5ac629(_0x4294fa['error'](0x1f4,_0x456cc7[_0xdddc('0x10')]));});});};exports['ShowVoiceQueue']=function(_0x442f1d){var _0x506c9d=this;return new Promise(function(_0x5dca25,_0x18fd02){return db[_0xdddc('0x14')][_0xdddc('0x20')]({'raw':_0x442f1d[_0xdddc('0x16')]?_0x442f1d[_0xdddc('0x16')][_0xdddc('0x17')]===undefined?!![]:![]:!![],'where':_0x442f1d[_0xdddc('0x16')]?_0x442f1d[_0xdddc('0x16')]['where']||null:null,'attributes':_0x442f1d['options']?_0x442f1d[_0xdddc('0x16')]['attributes']||null:null,'include':_0x442f1d[_0xdddc('0x16')]?_0x442f1d['options'][_0xdddc('0x19')]?_['map'](_0x442f1d[_0xdddc('0x16')]['include'],function(_0x5d2bc5){return{'model':db[_0x5d2bc5[_0xdddc('0x1c')]],'as':_0x5d2bc5['as'],'attributes':_0x5d2bc5[_0xdddc('0x1b')],'include':_0x5d2bc5['include']?_[_0xdddc('0x1a')](_0x5d2bc5[_0xdddc('0x19')],function(_0x3a0f19){return{'model':db[_0x3a0f19['model']],'as':_0x3a0f19['as'],'attributes':_0x3a0f19[_0xdddc('0x1b')],'include':_0x3a0f19[_0xdddc('0x19')]?_['map'](_0x3a0f19[_0xdddc('0x19')],function(_0x57b09b){return{'model':db[_0x57b09b[_0xdddc('0x1c')]],'as':_0x57b09b['as'],'attributes':_0x57b09b[_0xdddc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdddc('0x1d')](function(_0x1facc4){logger[_0xdddc('0xb')]('ShowVoiceQueue',_0x442f1d);logger['debug']('ShowVoiceQueue',_0x442f1d,JSON['stringify'](_0x1facc4));_0x5dca25(_0x1facc4);})[_0xdddc('0x13')](function(_0x5853b0){logger[_0xdddc('0xe')](_0xdddc('0x21'),_0x5853b0[_0xdddc('0x10')],_0x442f1d);_0x18fd02(_0x506c9d[_0xdddc('0xe')](0x1f4,_0x5853b0[_0xdddc('0x10')]));});});}; \ No newline at end of file +var _0x3578=['localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowVoiceQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x56ce94,_0x1a819b){var _0xd6b6d2=function(_0x397b43){while(--_0x397b43){_0x56ce94['push'](_0x56ce94['shift']());}};_0xd6b6d2(++_0x1a819b);}(_0x3578,0x1bc));var _0x8357=function(_0x10244a,_0x3e96f4){_0x10244a=_0x10244a-0x0;var _0x4daacd=_0x3578[_0x10244a];return _0x4daacd;};'use strict';var _=require(_0x8357('0x0'));var util=require(_0x8357('0x1'));var moment=require(_0x8357('0x2'));var BPromise=require(_0x8357('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8357('0x4'))['db'];var utils=require(_0x8357('0x5'));var logger=require('../../config/logger')(_0x8357('0x6'));var config=require(_0x8357('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8357('0x8')][_0x8357('0x9')]({'port':0x232a});config[_0x8357('0xa')]=_[_0x8357('0xb')](config[_0x8357('0xa')],{'host':_0x8357('0xc'),'port':0x18eb});var socket=require(_0x8357('0xd'))(new Redis(config[_0x8357('0xa')]));require('./voiceQueue.socket')[_0x8357('0xe')](socket);function respondWithRpcPromise(_0x529a9d,_0x2b7301,_0x549e49){return new BPromise(function(_0x2c94a2,_0x154b08){return client[_0x8357('0xf')](_0x529a9d,_0x549e49)['then'](function(_0x2b7f93){logger[_0x8357('0x10')](_0x8357('0x11'),_0x2b7301,_0x8357('0x12'));logger[_0x8357('0x13')](_0x8357('0x14'),_0x2b7301,_0x8357('0x12'),JSON[_0x8357('0x15')](_0x2b7f93));if(_0x2b7f93[_0x8357('0x16')]){if(_0x2b7f93['error']['code']===0x1f4){logger[_0x8357('0x16')](_0x8357('0x11'),_0x2b7301,_0x2b7f93['error'][_0x8357('0x17')]);return _0x154b08(_0x2b7f93[_0x8357('0x16')][_0x8357('0x17')]);}logger[_0x8357('0x16')](_0x8357('0x11'),_0x2b7301,_0x2b7f93[_0x8357('0x16')]['message']);return _0x2c94a2(_0x2b7f93[_0x8357('0x16')][_0x8357('0x17')]);}else{logger['info'](_0x8357('0x11'),_0x2b7301,'request\x20sent');_0x2c94a2(_0x2b7f93[_0x8357('0x18')][_0x8357('0x17')]);}})[_0x8357('0x19')](function(_0x1d1915){logger[_0x8357('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2b7301,_0x1d1915);_0x154b08(_0x1d1915);});});}exports[_0x8357('0x1a')]=function(_0x48bc00){var _0xfc7800=this;return new Promise(function(_0x44b1cf,_0x2dde27){return db['VoiceQueue'][_0x8357('0x1b')]({'raw':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1d')]===undefined?!![]:![]:!![],'where':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1e')]||null:null,'attributes':_0x48bc00['options']?_0x48bc00[_0x8357('0x1c')]['attributes']||null:null,'limit':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x1f')]||null:null,'include':_0x48bc00[_0x8357('0x1c')]?_0x48bc00[_0x8357('0x1c')][_0x8357('0x20')]?_[_0x8357('0x21')](_0x48bc00[_0x8357('0x1c')]['include'],function(_0x2ba9a6){return{'model':db[_0x2ba9a6['model']],'as':_0x2ba9a6['as'],'attributes':_0x2ba9a6[_0x8357('0x22')],'include':_0x2ba9a6[_0x8357('0x20')]?_['map'](_0x2ba9a6[_0x8357('0x20')],function(_0x22ef98){return{'model':db[_0x22ef98['model']],'as':_0x22ef98['as'],'attributes':_0x22ef98['attributes'],'include':_0x22ef98['include']?_[_0x8357('0x21')](_0x22ef98['include'],function(_0x65d6b0){return{'model':db[_0x65d6b0[_0x8357('0x23')]],'as':_0x65d6b0['as'],'attributes':_0x65d6b0[_0x8357('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8357('0x24')](function(_0x1aa1ad){logger[_0x8357('0x10')](_0x8357('0x1a'),_0x48bc00);logger[_0x8357('0x13')](_0x8357('0x1a'),_0x48bc00,JSON[_0x8357('0x15')](_0x1aa1ad));_0x44b1cf(_0x1aa1ad);})[_0x8357('0x19')](function(_0x57f87e){logger[_0x8357('0x16')](_0x8357('0x1a'),_0x57f87e['message'],_0x48bc00);_0x2dde27(_0xfc7800[_0x8357('0x16')](0x1f4,_0x57f87e[_0x8357('0x17')]));});});};exports[_0x8357('0x25')]=function(_0x25d9e2){var _0x352070=this;return new Promise(function(_0x4cb65e,_0x116641){return db['VoiceQueue']['find']({'raw':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')][_0x8357('0x1d')]===undefined?!![]:![]:!![],'where':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')][_0x8357('0x1e')]||null:null,'attributes':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2['options'][_0x8357('0x22')]||null:null,'include':_0x25d9e2[_0x8357('0x1c')]?_0x25d9e2[_0x8357('0x1c')]['include']?_['map'](_0x25d9e2[_0x8357('0x1c')][_0x8357('0x20')],function(_0x5772d3){return{'model':db[_0x5772d3[_0x8357('0x23')]],'as':_0x5772d3['as'],'attributes':_0x5772d3[_0x8357('0x22')],'include':_0x5772d3[_0x8357('0x20')]?_['map'](_0x5772d3[_0x8357('0x20')],function(_0x2fa777){return{'model':db[_0x2fa777[_0x8357('0x23')]],'as':_0x2fa777['as'],'attributes':_0x2fa777[_0x8357('0x22')],'include':_0x2fa777[_0x8357('0x20')]?_[_0x8357('0x21')](_0x2fa777[_0x8357('0x20')],function(_0x596a1a){return{'model':db[_0x596a1a[_0x8357('0x23')]],'as':_0x596a1a['as'],'attributes':_0x596a1a[_0x8357('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8357('0x24')](function(_0x584c0b){logger[_0x8357('0x10')]('ShowVoiceQueue',_0x25d9e2);logger['debug'](_0x8357('0x25'),_0x25d9e2,JSON[_0x8357('0x15')](_0x584c0b));_0x4cb65e(_0x584c0b);})['catch'](function(_0x483f3b){logger[_0x8357('0x16')]('ShowVoiceQueue',_0x483f3b['message'],_0x25d9e2);_0x116641(_0x352070['error'](0x1f4,_0x483f3b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3ffb4a9..a994c36 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 _0x88f4=['save','remove','length','voiceQueue:','./voiceQueue.events'];(function(_0x4853b1,_0x42a3e2){var _0x20bfcb=function(_0x2eef15){while(--_0x2eef15){_0x4853b1['push'](_0x4853b1['shift']());}};_0x20bfcb(++_0x42a3e2);}(_0x88f4,0x86));var _0x488f=function(_0x3f6dec,_0x3b07df){_0x3f6dec=_0x3f6dec-0x0;var _0x4b98b4=_0x88f4[_0x3f6dec];return _0x4b98b4;};'use strict';var VoiceQueueEvents=require(_0x488f('0x0'));var events=[_0x488f('0x1'),_0x488f('0x2'),'update'];function createListener(_0x395ac2,_0x3feb67){return function(_0x104f12){_0x3feb67['emit'](_0x395ac2,_0x104f12);};}function removeListener(_0x126455,_0xcb99f6){return function(){VoiceQueueEvents['removeListener'](_0x126455,_0xcb99f6);};}exports['register']=function(_0x4832cc){for(var _0x58c0f5=0x0,_0x58d213=events[_0x488f('0x3')];_0x58c0f5<_0x58d213;_0x58c0f5++){var _0x357272=events[_0x58c0f5];var _0x2110fa=createListener(_0x488f('0x4')+_0x357272,_0x4832cc);VoiceQueueEvents['on'](_0x357272,_0x2110fa);}}; \ No newline at end of file +var _0xa6d4=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','update'];(function(_0xa0aea2,_0xb8c80){var _0x49c5be=function(_0x47f08f){while(--_0x47f08f){_0xa0aea2['push'](_0xa0aea2['shift']());}};_0x49c5be(++_0xb8c80);}(_0xa6d4,0x13f));var _0x4a6d=function(_0x50ef65,_0x3de6e2){_0x50ef65=_0x50ef65-0x0;var _0x3db934=_0xa6d4[_0x50ef65];return _0x3db934;};'use strict';var VoiceQueueEvents=require(_0x4a6d('0x0'));var events=[_0x4a6d('0x1'),'remove',_0x4a6d('0x2')];function createListener(_0x527597,_0x442c10){return function(_0x2caa42){_0x442c10[_0x4a6d('0x3')](_0x527597,_0x2caa42);};}function removeListener(_0x5a0cbe,_0x242c88){return function(){VoiceQueueEvents[_0x4a6d('0x4')](_0x5a0cbe,_0x242c88);};}exports[_0x4a6d('0x5')]=function(_0x4cadb5){for(var _0x48709e=0x0,_0x56f4cb=events['length'];_0x48709e<_0x56f4cb;_0x48709e++){var _0x287fcb=events[_0x48709e];var _0x36a9cd=createListener(_0x4a6d('0x6')+_0x287fcb,_0x4cadb5);VoiceQueueEvents['on'](_0x287fcb,_0x36a9cd);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4a3e311..8575b33 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 _0xc627=['get','index','/describe','isAuthenticated','getVoiceQueuesReport','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12e90e,_0x432bee){var _0x4d7032=function(_0x56a401){while(--_0x56a401){_0x12e90e['push'](_0x12e90e['shift']());}};_0x4d7032(++_0x432bee);}(_0xc627,0x187));var _0x7c62=function(_0x5c5fc5,_0x45b33e){_0x5c5fc5=_0x5c5fc5-0x0;var _0x1c57fa=_0xc627[_0x5c5fc5];return _0x1c57fa;};'use strict';var multer=require(_0x7c62('0x0'));var util=require(_0x7c62('0x1'));var path=require(_0x7c62('0x2'));var timeout=require(_0x7c62('0x3'));var express=require(_0x7c62('0x4'));var router=express[_0x7c62('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7c62('0x6'));var interaction=require(_0x7c62('0x7'));var config=require(_0x7c62('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x7c62('0x9')]('/',auth['isAuthenticated'](),controller[_0x7c62('0xa')]);router[_0x7c62('0x9')](_0x7c62('0xb'),auth[_0x7c62('0xc')](),controller['describe']);router[_0x7c62('0x9')]('/index',auth[_0x7c62('0xc')](),controller[_0x7c62('0xd')]);router[_0x7c62('0x9')]('/:id',auth[_0x7c62('0xc')](),controller['show']);router[_0x7c62('0xe')]('/',auth[_0x7c62('0xc')](),controller[_0x7c62('0xf')]);router[_0x7c62('0x10')](_0x7c62('0x11'),auth[_0x7c62('0xc')](),controller['update']);router[_0x7c62('0x12')](_0x7c62('0x11'),auth[_0x7c62('0xc')](),controller[_0x7c62('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcd7f=['getVoiceQueuesReport','/:id','show','post','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','describe'];(function(_0x483807,_0x3f7e0c){var _0x42e7e9=function(_0x250198){while(--_0x250198){_0x483807['push'](_0x483807['shift']());}};_0x42e7e9(++_0x3f7e0c);}(_0xcd7f,0x188));var _0xfcd7=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xcd7f[_0x2ad008];return _0x4538cf;};'use strict';var multer=require(_0xfcd7('0x0'));var util=require(_0xfcd7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfcd7('0x2'));var router=express[_0xfcd7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfcd7('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xfcd7('0x5')]('/',auth[_0xfcd7('0x6')](),controller['index']);router['get']('/describe',auth[_0xfcd7('0x6')](),controller[_0xfcd7('0x7')]);router[_0xfcd7('0x5')]('/index',auth['isAuthenticated'](),controller[_0xfcd7('0x8')]);router[_0xfcd7('0x5')](_0xfcd7('0x9'),auth[_0xfcd7('0x6')](),controller[_0xfcd7('0xa')]);router[_0xfcd7('0xb')]('/',auth[_0xfcd7('0x6')](),controller['create']);router['put'](_0xfcd7('0x9'),auth['isAuthenticated'](),controller[_0xfcd7('0xc')]);router[_0xfcd7('0xd')](_0xfcd7('0x9'),auth[_0xfcd7('0x6')](),controller[_0xfcd7('0xe')]);module[_0xfcd7('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 476c6f1..963189b 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 _0xae49=['queuecallerjoinAt','format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue'];(function(_0x27e0ab,_0x4bc8a4){var _0x12ee2b=function(_0x3b0d7f){while(--_0x3b0d7f){_0x27e0ab['push'](_0x27e0ab['shift']());}};_0x12ee2b(++_0x4bc8a4);}(_0xae49,0x105));var _0x9ae4=function(_0x1d6dc9,_0x492d2b){_0x1d6dc9=_0x1d6dc9-0x0;var _0x347583=_0xae49[_0x1d6dc9];return _0x347583;};'use strict';var Sequelize=require(_0x9ae4('0x0'));var moment=require(_0x9ae4('0x1'));module['exports']={'type':{'type':Sequelize[_0x9ae4('0x2')]},'uniqueid':{'type':Sequelize[_0x9ae4('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9ae4('0x2')]},'queue':{'type':Sequelize[_0x9ae4('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x9ae4('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x9ae4('0x3')],'set':function(_0x1e0d5c){var _0x4c0623=moment(_0x1e0d5c);var _0x397493=moment(this[_0x9ae4('0x4')](_0x9ae4('0x5')))[_0x9ae4('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2935eb=_0x4c0623['diff'](_0x397493,_0x9ae4('0x7'));this['setDataValue']('queuecallerleaveAt',_0x1e0d5c);this[_0x9ae4('0x8')](_0x9ae4('0x9'),_0x2935eb||null);}},'position':{'type':Sequelize[_0x9ae4('0xa')]},'count':{'type':Sequelize[_0x9ae4('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x9ae4('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9ae4('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x9ae4('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x9ae4('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9ae4('0x2')],'comment':_0x9ae4('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9ae4('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9ae4('0x2')]},'connectedlinename':{'type':Sequelize[_0x9ae4('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9ae4('0x2')]},'exten':{'type':Sequelize[_0x9ae4('0x2')]},'priority':{'type':Sequelize[_0x9ae4('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9ae4('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9ae4('0x2')]},'transfer':{'type':Sequelize[_0x9ae4('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9ae4('0xd')},'transferexten':{'type':Sequelize[_0x9ae4('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9ae4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9ae4('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9ae4('0x2')]}}; \ No newline at end of file +var _0xbcc1=['diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fc2a8,_0x75ddea){var _0x331d6d=function(_0x241cf7){while(--_0x241cf7){_0x2fc2a8['push'](_0x2fc2a8['shift']());}};_0x331d6d(++_0x75ddea);}(_0xbcc1,0xac));var _0x1bcc=function(_0xdc19d4,_0x4afa8e){_0xdc19d4=_0xdc19d4-0x0;var _0x1e9ff9=_0xbcc1[_0xdc19d4];return _0x1e9ff9;};'use strict';var Sequelize=require(_0x1bcc('0x0'));var moment=require('moment');module[_0x1bcc('0x1')]={'type':{'type':Sequelize[_0x1bcc('0x2')]},'uniqueid':{'type':Sequelize[_0x1bcc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1bcc('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1bcc('0x3')],'set':function(_0x423734){var _0x4076ac=moment(_0x423734);var _0x4414ef=moment(this[_0x1bcc('0x4')](_0x1bcc('0x5')))[_0x1bcc('0x6')](_0x1bcc('0x7'));var _0x293127=_0x4076ac[_0x1bcc('0x8')](_0x4414ef,_0x1bcc('0x9'));this[_0x1bcc('0xa')](_0x1bcc('0xb'),_0x423734);this[_0x1bcc('0xa')]('holdtime',_0x293127||null);}},'position':{'type':Sequelize[_0x1bcc('0xc')]},'count':{'type':Sequelize[_0x1bcc('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x1bcc('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1bcc('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1bcc('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x1bcc('0xc')]},'channel':{'type':Sequelize[_0x1bcc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1bcc('0x2')]},'connectedlinename':{'type':Sequelize[_0x1bcc('0x2')]},'accountcode':{'type':Sequelize[_0x1bcc('0x2')]},'context':{'type':Sequelize[_0x1bcc('0x2')]},'exten':{'type':Sequelize[_0x1bcc('0x2')]},'priority':{'type':Sequelize[_0x1bcc('0x2')]},'holdtime':{'type':Sequelize[_0x1bcc('0xc')]},'mohtime':{'type':Sequelize[_0x1bcc('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1bcc('0x2')]},'transfer':{'type':Sequelize[_0x1bcc('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1bcc('0x2')],'comment':_0x1bcc('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1bcc('0x2')]},'secondDisposition':{'type':Sequelize[_0x1bcc('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1bcc('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1bcc('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1bcc('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 17dbfcb..e4ae9ad 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 _0xbf77=['keys','filters','intersection','query','fields','attributes','length','model','limit','order','sort','pick','filter','merge','type','VIRTUAL','where','includeAll','include','VoiceQueueReport','findAll','rows','catch','options','find','create','body','params','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','map','rawAttributes','fieldName','key','name'];(function(_0x468a64,_0x64311a){var _0x2b3973=function(_0x32e183){while(--_0x32e183){_0x468a64['push'](_0x468a64['shift']());}};_0x2b3973(++_0x64311a);}(_0xbf77,0x163));var _0x7bf7=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xbf77[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x7bf7('0x0'));var rimraf=require(_0x7bf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bf7('0x2'));var rp=require(_0x7bf7('0x3'));var moment=require(_0x7bf7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7bf7('0x5'));var sox=require(_0x7bf7('0x6'));var csv=require(_0x7bf7('0x7'));var ejs=require(_0x7bf7('0x8'));var fs=require('fs');var fs_extra=require(_0x7bf7('0x9'));var _=require(_0x7bf7('0xa'));var squel=require(_0x7bf7('0xb'));var crypto=require('crypto');var jsforce=require(_0x7bf7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7bf7('0x7'));var querystring=require(_0x7bf7('0xd'));var Papa=require(_0x7bf7('0xe'));var Redis=require(_0x7bf7('0xf'));var authService=require(_0x7bf7('0x10'));var qs=require(_0x7bf7('0x11'));var as=require(_0x7bf7('0x12'));var hardwareService=require(_0x7bf7('0x13'));var logger=require(_0x7bf7('0x14'))(_0x7bf7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7bf7('0x16'));var db=require(_0x7bf7('0x17'))['db'];config['redis']=_[_0x7bf7('0x18')](config['redis'],{'host':_0x7bf7('0x19'),'port':0x18eb});var socket=require(_0x7bf7('0x1a'))(new Redis(config[_0x7bf7('0x1b')]));require('./voiceQueueReport.socket')[_0x7bf7('0x1c')](socket);function respondWithStatusCode(_0x12b8f0,_0x48a8d7){_0x48a8d7=_0x48a8d7||0xcc;return function(_0xe20518){if(_0xe20518){return _0x12b8f0[_0x7bf7('0x1d')](_0x48a8d7);}return _0x12b8f0[_0x7bf7('0x1e')](_0x48a8d7)[_0x7bf7('0x1f')]();};}function respondWithResult(_0x4b5746,_0x5c68a7){_0x5c68a7=_0x5c68a7||0xc8;return function(_0x5046a3){if(_0x5046a3){return _0x4b5746[_0x7bf7('0x1e')](_0x5c68a7)[_0x7bf7('0x20')](_0x5046a3);}};}function respondWithFilteredResult(_0x5314f0,_0x1ff4df){return function(_0x410d1e){if(_0x410d1e){var _0x33e8e4=typeof _0x1ff4df[_0x7bf7('0x21')]===_0x7bf7('0x22')&&typeof _0x1ff4df['limit']===_0x7bf7('0x22');var _0x179d91=_0x410d1e[_0x7bf7('0x23')];var _0x39ba34=_0x33e8e4?0x0:_0x1ff4df[_0x7bf7('0x21')];var _0x598991=_0x33e8e4?_0x410d1e[_0x7bf7('0x23')]:_0x1ff4df[_0x7bf7('0x21')]+_0x1ff4df['limit'];var _0x591148;if(_0x598991>=_0x179d91){_0x598991=_0x179d91;_0x591148=0xc8;}else{_0x591148=0xce;}_0x5314f0['status'](_0x591148);return _0x5314f0['set'](_0x7bf7('0x24'),_0x39ba34+'-'+_0x598991+'/'+_0x179d91)[_0x7bf7('0x20')](_0x410d1e);}return null;};}function patchUpdates(_0x47bded){return function(_0x490ccc){try{jsonpatch[_0x7bf7('0x25')](_0x490ccc,_0x47bded,!![]);}catch(_0x8e9b41){return BPromise[_0x7bf7('0x26')](_0x8e9b41);}return _0x490ccc[_0x7bf7('0x27')]();};}function saveUpdates(_0x5bc1a8,_0x123352){return function(_0x5b1e7c){if(_0x5b1e7c){return _0x5b1e7c[_0x7bf7('0x28')](_0x5bc1a8)[_0x7bf7('0x29')](function(_0x4f2cf6){return _0x4f2cf6;});}return null;};}function removeEntity(_0x31055b,_0x18e4ea){return function(_0x405520){if(_0x405520){return _0x405520[_0x7bf7('0x2a')]()[_0x7bf7('0x29')](function(){_0x31055b['status'](0xcc)[_0x7bf7('0x1f')]();});}};}function handleEntityNotFound(_0xb4bb3b,_0x3adb5a){return function(_0x25fff8){if(!_0x25fff8){_0xb4bb3b['sendStatus'](0x194);}return _0x25fff8;};}function handleError(_0x447190,_0x162e39){_0x162e39=_0x162e39||0x1f4;return function(_0x4cec53){logger[_0x7bf7('0x2b')](_0x4cec53[_0x7bf7('0x2c')]);if(_0x4cec53['name']){delete _0x4cec53['name'];}_0x447190[_0x7bf7('0x1e')](_0x162e39)['send'](_0x4cec53);};}exports['index']=function(_0x22d2a3,_0x25d035){var _0x317cd0={},_0x1cd50b={},_0x28f07a={'count':0x0,'rows':[]};var _0x4f0abc=_[_0x7bf7('0x2d')](db['VoiceQueueReport'][_0x7bf7('0x2e')],function(_0x40375b){return{'name':_0x40375b[_0x7bf7('0x2f')],'type':_0x40375b['type'][_0x7bf7('0x30')]};});_0x1cd50b['model']=_[_0x7bf7('0x2d')](_0x4f0abc,_0x7bf7('0x31'));_0x1cd50b['query']=_[_0x7bf7('0x32')](_0x22d2a3['query']);_0x1cd50b[_0x7bf7('0x33')]=_[_0x7bf7('0x34')](_0x1cd50b['model'],_0x1cd50b[_0x7bf7('0x35')]);_0x317cd0['attributes']=_[_0x7bf7('0x34')](_0x1cd50b['model'],qs[_0x7bf7('0x36')](_0x22d2a3['query'][_0x7bf7('0x36')]));_0x317cd0[_0x7bf7('0x37')]=_0x317cd0['attributes'][_0x7bf7('0x38')]?_0x317cd0['attributes']:_0x1cd50b[_0x7bf7('0x39')];if(!_0x22d2a3[_0x7bf7('0x35')]['hasOwnProperty']('nolimit')){_0x317cd0[_0x7bf7('0x3a')]=qs[_0x7bf7('0x3a')](_0x22d2a3[_0x7bf7('0x35')][_0x7bf7('0x3a')]);_0x317cd0[_0x7bf7('0x21')]=qs[_0x7bf7('0x21')](_0x22d2a3[_0x7bf7('0x35')][_0x7bf7('0x21')]);}_0x317cd0[_0x7bf7('0x3b')]=qs[_0x7bf7('0x3c')](_0x22d2a3[_0x7bf7('0x35')][_0x7bf7('0x3c')]);_0x317cd0['where']=qs[_0x7bf7('0x33')](_[_0x7bf7('0x3d')](_0x22d2a3[_0x7bf7('0x35')],_0x1cd50b[_0x7bf7('0x33')]),_0x4f0abc);if(_0x22d2a3[_0x7bf7('0x35')][_0x7bf7('0x3e')]){_0x317cd0['where']=_[_0x7bf7('0x3f')](_0x317cd0['where'],{'$or':_[_0x7bf7('0x2d')](_0x4f0abc,function(_0x5dc14d){if(_0x5dc14d[_0x7bf7('0x40')]!==_0x7bf7('0x41')){var _0x1e1642={};_0x1e1642[_0x5dc14d['name']]={'$like':'%'+_0x22d2a3[_0x7bf7('0x35')][_0x7bf7('0x3e')]+'%'};return _0x1e1642;}})});}_0x317cd0=_[_0x7bf7('0x3f')]({},_0x317cd0,_0x22d2a3['options']);var _0x2b6d50={'where':_0x317cd0[_0x7bf7('0x42')]};return db['VoiceQueueReport']['count'](_0x2b6d50)[_0x7bf7('0x29')](function(_0xda6c74){_0x28f07a[_0x7bf7('0x23')]=_0xda6c74;if(_0x22d2a3['query'][_0x7bf7('0x43')]){_0x317cd0[_0x7bf7('0x44')]=[{'all':!![]}];}return db[_0x7bf7('0x45')][_0x7bf7('0x46')](_0x317cd0);})['then'](function(_0x5c2e64){_0x28f07a[_0x7bf7('0x47')]=_0x5c2e64;return _0x28f07a;})[_0x7bf7('0x29')](respondWithFilteredResult(_0x25d035,_0x317cd0))[_0x7bf7('0x48')](handleError(_0x25d035,null));};exports['show']=function(_0x413a17,_0x48c6f6){var _0x120f88={'raw':![],'where':{'id':_0x413a17['params']['id']}},_0x447b6e={};_0x447b6e[_0x7bf7('0x39')]=_[_0x7bf7('0x32')](db[_0x7bf7('0x45')][_0x7bf7('0x2e')]);_0x447b6e['query']=_[_0x7bf7('0x32')](_0x413a17['query']);_0x447b6e[_0x7bf7('0x33')]=_[_0x7bf7('0x34')](_0x447b6e[_0x7bf7('0x39')],_0x447b6e[_0x7bf7('0x35')]);_0x120f88['attributes']=_[_0x7bf7('0x34')](_0x447b6e[_0x7bf7('0x39')],qs[_0x7bf7('0x36')](_0x413a17['query'][_0x7bf7('0x36')]));_0x120f88[_0x7bf7('0x37')]=_0x120f88['attributes'][_0x7bf7('0x38')]?_0x120f88[_0x7bf7('0x37')]:_0x447b6e[_0x7bf7('0x39')];if(_0x413a17[_0x7bf7('0x35')][_0x7bf7('0x43')]){_0x120f88[_0x7bf7('0x44')]=[{'all':!![]}];}_0x120f88=_[_0x7bf7('0x3f')]({},_0x120f88,_0x413a17[_0x7bf7('0x49')]);return db[_0x7bf7('0x45')][_0x7bf7('0x4a')](_0x120f88)[_0x7bf7('0x29')](handleEntityNotFound(_0x48c6f6,null))[_0x7bf7('0x29')](respondWithResult(_0x48c6f6,null))[_0x7bf7('0x48')](handleError(_0x48c6f6,null));};exports[_0x7bf7('0x4b')]=function(_0xbf1b45,_0x297cdf){return db['VoiceQueueReport'][_0x7bf7('0x4b')](_0xbf1b45[_0x7bf7('0x4c')],{})[_0x7bf7('0x29')](respondWithResult(_0x297cdf,0xc9))[_0x7bf7('0x48')](handleError(_0x297cdf,null));};exports['update']=function(_0x3ac14f,_0x18e2f3){if(_0x3ac14f[_0x7bf7('0x4c')]['id']){delete _0x3ac14f[_0x7bf7('0x4c')]['id'];}return db[_0x7bf7('0x45')][_0x7bf7('0x4a')]({'where':{'id':_0x3ac14f[_0x7bf7('0x4d')]['id']}})[_0x7bf7('0x29')](handleEntityNotFound(_0x18e2f3,null))[_0x7bf7('0x29')](saveUpdates(_0x3ac14f[_0x7bf7('0x4c')],null))[_0x7bf7('0x29')](respondWithResult(_0x18e2f3,null))[_0x7bf7('0x48')](handleError(_0x18e2f3,null));};exports['destroy']=function(_0x45482b,_0x3a20ea){return db['VoiceQueueReport'][_0x7bf7('0x4a')]({'where':{'id':_0x45482b['params']['id']}})[_0x7bf7('0x29')](handleEntityNotFound(_0x3a20ea,null))[_0x7bf7('0x29')](removeEntity(_0x3a20ea,null))[_0x7bf7('0x48')](handleError(_0x3a20ea,null));};exports[_0x7bf7('0x4e')]=function(_0x527d57,_0x5a6d17){return db[_0x7bf7('0x45')][_0x7bf7('0x4e')]()[_0x7bf7('0x29')](respondWithResult(_0x5a6d17,null))['catch'](handleError(_0x5a6d17,null));};exports[_0x7bf7('0x4f')]=function(_0xdad7df,_0x5a688a){var _0x579415={},_0x4b5c27={},_0x5e4f27={'count':0x0,'rows':[]};_0x4b5c27['model']=_[_0x7bf7('0x32')](db[_0x7bf7('0x45')][_0x7bf7('0x2e')]);_0x4b5c27[_0x7bf7('0x35')]=_[_0x7bf7('0x32')](_0xdad7df['query']);_0x4b5c27['filters']=_[_0x7bf7('0x34')](_0x4b5c27[_0x7bf7('0x39')],_0x4b5c27['query']);_0x579415['attributes']=_['intersection'](_0x4b5c27[_0x7bf7('0x39')],qs[_0x7bf7('0x36')](_0xdad7df['query'][_0x7bf7('0x36')]));_0x579415[_0x7bf7('0x37')]=_0x579415[_0x7bf7('0x37')][_0x7bf7('0x38')]?_0x579415['attributes']:_0x4b5c27[_0x7bf7('0x39')];if(!_0xdad7df['query'][_0x7bf7('0x50')]('nolimit')){_0x579415['limit']=qs['limit'](_0xdad7df[_0x7bf7('0x35')]['limit']);_0x579415[_0x7bf7('0x21')]=qs[_0x7bf7('0x21')](_0xdad7df['query'][_0x7bf7('0x21')]);}_0x579415[_0x7bf7('0x3b')]=qs[_0x7bf7('0x3c')](_0xdad7df[_0x7bf7('0x35')]['sort']);_0x579415[_0x7bf7('0x42')]=qs[_0x7bf7('0x33')](_['pick'](_0xdad7df['query'],_0x4b5c27[_0x7bf7('0x33')]));if(_0xdad7df[_0x7bf7('0x35')]['filter']){_0x579415[_0x7bf7('0x42')]=_[_0x7bf7('0x3f')](_0x579415[_0x7bf7('0x42')],{'$or':_[_0x7bf7('0x2d')](_0x579415[_0x7bf7('0x37')],function(_0xe06b5){var _0x1a3d08={};_0x1a3d08[_0xe06b5]={'$like':'%'+_0xdad7df[_0x7bf7('0x35')][_0x7bf7('0x3e')]+'%'};return _0x1a3d08;})});}_0x579415=_['merge']({},_0x579415,_0xdad7df['options']);var _0x17904f={'where':_0x579415[_0x7bf7('0x42')]};return db['VoiceQueueReport'][_0x7bf7('0x23')](_0x17904f)['then'](function(_0x1a2316){_0x5e4f27[_0x7bf7('0x23')]=_0x1a2316;if(_0xdad7df[_0x7bf7('0x35')][_0x7bf7('0x43')]){_0x579415[_0x7bf7('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7bf7('0x46')](_0x579415);})[_0x7bf7('0x29')](function(_0x20f82e){_0x5e4f27[_0x7bf7('0x47')]=_0x20f82e;return _0x5e4f27;})['then'](respondWithFilteredResult(_0x5a688a,_0x579415,_0x7bf7('0x4f')))['catch'](handleError(_0x5a688a,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x458f=['offset','set','apply','save','destroy','then','stack','name','send','index','VoiceQueueReport','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x458f,0xda));var _0xf458=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x458f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf458('0x0'));var rimraf=require(_0xf458('0x1'));var zipdir=require(_0xf458('0x2'));var jsonpatch=require(_0xf458('0x3'));var rp=require(_0xf458('0x4'));var moment=require(_0xf458('0x5'));var BPromise=require(_0xf458('0x6'));var Mustache=require(_0xf458('0x7'));var util=require(_0xf458('0x8'));var path=require('path');var sox=require(_0xf458('0x9'));var csv=require('to-csv');var ejs=require(_0xf458('0xa'));var fs=require('fs');var fs_extra=require(_0xf458('0xb'));var _=require(_0xf458('0xc'));var squel=require(_0xf458('0xd'));var crypto=require(_0xf458('0xe'));var jsforce=require(_0xf458('0xf'));var deskjs=require(_0xf458('0x10'));var toCsv=require(_0xf458('0x11'));var querystring=require('querystring');var Papa=require(_0xf458('0x12'));var Redis=require(_0xf458('0x13'));var authService=require(_0xf458('0x14'));var qs=require(_0xf458('0x15'));var as=require(_0xf458('0x16'));var hardwareService=require(_0xf458('0x17'));var logger=require(_0xf458('0x18'))(_0xf458('0x19'));var utils=require('../../config/utils');var config=require(_0xf458('0x1a'));var licenseUtil=require(_0xf458('0x1b'));var db=require('../../mysqldb')['db'];config[_0xf458('0x1c')]=_[_0xf458('0x1d')](config[_0xf458('0x1c')],{'host':_0xf458('0x1e'),'port':0x18eb});var socket=require(_0xf458('0x1f'))(new Redis(config[_0xf458('0x1c')]));require('./voiceQueueReport.socket')[_0xf458('0x20')](socket);function respondWithStatusCode(_0x2206f1,_0x4a9f62){_0x4a9f62=_0x4a9f62||0xcc;return function(_0x3c7da1){if(_0x3c7da1){return _0x2206f1[_0xf458('0x21')](_0x4a9f62);}return _0x2206f1[_0xf458('0x22')](_0x4a9f62)[_0xf458('0x23')]();};}function respondWithResult(_0x588571,_0x534d61){_0x534d61=_0x534d61||0xc8;return function(_0x2aa599){if(_0x2aa599){return _0x588571[_0xf458('0x22')](_0x534d61)[_0xf458('0x24')](_0x2aa599);}};}function respondWithFilteredResult(_0x4c5a58,_0x4bbf27){return function(_0x274056){if(_0x274056){var _0x56467a=typeof _0x4bbf27['offset']===_0xf458('0x25')&&typeof _0x4bbf27[_0xf458('0x26')]===_0xf458('0x25');var _0x48541f=_0x274056[_0xf458('0x27')];var _0x49ab2c=_0x56467a?0x0:_0x4bbf27['offset'];var _0x2e954d=_0x56467a?_0x274056[_0xf458('0x27')]:_0x4bbf27[_0xf458('0x28')]+_0x4bbf27[_0xf458('0x26')];var _0xcb9a1c;if(_0x2e954d>=_0x48541f){_0x2e954d=_0x48541f;_0xcb9a1c=0xc8;}else{_0xcb9a1c=0xce;}_0x4c5a58['status'](_0xcb9a1c);return _0x4c5a58[_0xf458('0x29')]('Content-Range',_0x49ab2c+'-'+_0x2e954d+'/'+_0x48541f)[_0xf458('0x24')](_0x274056);}return null;};}function patchUpdates(_0x449835){return function(_0x3caf24){try{jsonpatch[_0xf458('0x2a')](_0x3caf24,_0x449835,!![]);}catch(_0x5ba58e){return BPromise['reject'](_0x5ba58e);}return _0x3caf24[_0xf458('0x2b')]();};}function saveUpdates(_0x4e41df,_0x26bdbd){return function(_0x16bd28){if(_0x16bd28){return _0x16bd28['update'](_0x4e41df)['then'](function(_0x4b30d6){return _0x4b30d6;});}return null;};}function removeEntity(_0x564ac0,_0x4c5bd7){return function(_0x6a1f5e){if(_0x6a1f5e){return _0x6a1f5e[_0xf458('0x2c')]()[_0xf458('0x2d')](function(){_0x564ac0[_0xf458('0x22')](0xcc)[_0xf458('0x23')]();});}};}function handleEntityNotFound(_0x175666,_0x434c31){return function(_0x270b5c){if(!_0x270b5c){_0x175666[_0xf458('0x21')](0x194);}return _0x270b5c;};}function handleError(_0x5a5554,_0x298396){_0x298396=_0x298396||0x1f4;return function(_0x5284e1){logger['error'](_0x5284e1[_0xf458('0x2e')]);if(_0x5284e1[_0xf458('0x2f')]){delete _0x5284e1[_0xf458('0x2f')];}_0x5a5554[_0xf458('0x22')](_0x298396)[_0xf458('0x30')](_0x5284e1);};}exports[_0xf458('0x31')]=function(_0x5d08a3,_0x167bf9){var _0x15f517={},_0x47aaea={},_0x41cd01={'count':0x0,'rows':[]};var _0x3c805f=_['map'](db[_0xf458('0x32')]['rawAttributes'],function(_0x4886e4){return{'name':_0x4886e4[_0xf458('0x33')],'type':_0x4886e4[_0xf458('0x34')]['key']};});_0x47aaea[_0xf458('0x35')]=_['map'](_0x3c805f,_0xf458('0x2f'));_0x47aaea[_0xf458('0x36')]=_[_0xf458('0x37')](_0x5d08a3[_0xf458('0x36')]);_0x47aaea['filters']=_[_0xf458('0x38')](_0x47aaea[_0xf458('0x35')],_0x47aaea['query']);_0x15f517['attributes']=_[_0xf458('0x38')](_0x47aaea['model'],qs[_0xf458('0x39')](_0x5d08a3[_0xf458('0x36')][_0xf458('0x39')]));_0x15f517[_0xf458('0x3a')]=_0x15f517[_0xf458('0x3a')][_0xf458('0x3b')]?_0x15f517[_0xf458('0x3a')]:_0x47aaea[_0xf458('0x35')];if(!_0x5d08a3[_0xf458('0x36')]['hasOwnProperty']('nolimit')){_0x15f517['limit']=qs[_0xf458('0x26')](_0x5d08a3[_0xf458('0x36')]['limit']);_0x15f517[_0xf458('0x28')]=qs[_0xf458('0x28')](_0x5d08a3[_0xf458('0x36')]['offset']);}_0x15f517[_0xf458('0x3c')]=qs[_0xf458('0x3d')](_0x5d08a3['query'][_0xf458('0x3d')]);_0x15f517[_0xf458('0x3e')]=qs[_0xf458('0x3f')](_[_0xf458('0x40')](_0x5d08a3[_0xf458('0x36')],_0x47aaea[_0xf458('0x3f')]),_0x3c805f);if(_0x5d08a3[_0xf458('0x36')][_0xf458('0x41')]){_0x15f517['where']=_[_0xf458('0x42')](_0x15f517[_0xf458('0x3e')],{'$or':_[_0xf458('0x43')](_0x3c805f,function(_0x30b2b3){if(_0x30b2b3[_0xf458('0x34')]!==_0xf458('0x44')){var _0x3963bf={};_0x3963bf[_0x30b2b3[_0xf458('0x2f')]]={'$like':'%'+_0x5d08a3[_0xf458('0x36')]['filter']+'%'};return _0x3963bf;}})});}_0x15f517=_[_0xf458('0x42')]({},_0x15f517,_0x5d08a3[_0xf458('0x45')]);var _0x4fabcc={'where':_0x15f517[_0xf458('0x3e')]};return db[_0xf458('0x32')][_0xf458('0x27')](_0x4fabcc)[_0xf458('0x2d')](function(_0x54f708){_0x41cd01[_0xf458('0x27')]=_0x54f708;if(_0x5d08a3[_0xf458('0x36')]['includeAll']){_0x15f517[_0xf458('0x46')]=[{'all':!![]}];}return db[_0xf458('0x32')]['findAll'](_0x15f517);})[_0xf458('0x2d')](function(_0x11a21d){_0x41cd01[_0xf458('0x47')]=_0x11a21d;return _0x41cd01;})[_0xf458('0x2d')](respondWithFilteredResult(_0x167bf9,_0x15f517))[_0xf458('0x48')](handleError(_0x167bf9,null));};exports[_0xf458('0x49')]=function(_0x842fd1,_0x4aa47c){var _0x7c9043={'raw':![],'where':{'id':_0x842fd1[_0xf458('0x4a')]['id']}},_0x4b7805={};_0x4b7805[_0xf458('0x35')]=_['keys'](db[_0xf458('0x32')][_0xf458('0x4b')]);_0x4b7805[_0xf458('0x36')]=_[_0xf458('0x37')](_0x842fd1[_0xf458('0x36')]);_0x4b7805[_0xf458('0x3f')]=_[_0xf458('0x38')](_0x4b7805[_0xf458('0x35')],_0x4b7805[_0xf458('0x36')]);_0x7c9043[_0xf458('0x3a')]=_[_0xf458('0x38')](_0x4b7805[_0xf458('0x35')],qs['fields'](_0x842fd1['query'][_0xf458('0x39')]));_0x7c9043[_0xf458('0x3a')]=_0x7c9043[_0xf458('0x3a')][_0xf458('0x3b')]?_0x7c9043[_0xf458('0x3a')]:_0x4b7805[_0xf458('0x35')];if(_0x842fd1['query'][_0xf458('0x4c')]){_0x7c9043[_0xf458('0x46')]=[{'all':!![]}];}_0x7c9043=_['merge']({},_0x7c9043,_0x842fd1[_0xf458('0x45')]);return db[_0xf458('0x32')][_0xf458('0x4d')](_0x7c9043)[_0xf458('0x2d')](handleEntityNotFound(_0x4aa47c,null))[_0xf458('0x2d')](respondWithResult(_0x4aa47c,null))[_0xf458('0x48')](handleError(_0x4aa47c,null));};exports[_0xf458('0x4e')]=function(_0x252dce,_0x54caf3){return db[_0xf458('0x32')][_0xf458('0x4e')](_0x252dce[_0xf458('0x4f')],{})[_0xf458('0x2d')](respondWithResult(_0x54caf3,0xc9))[_0xf458('0x48')](handleError(_0x54caf3,null));};exports[_0xf458('0x50')]=function(_0x417417,_0x57cfd1){if(_0x417417['body']['id']){delete _0x417417[_0xf458('0x4f')]['id'];}return db['VoiceQueueReport'][_0xf458('0x4d')]({'where':{'id':_0x417417[_0xf458('0x4a')]['id']}})[_0xf458('0x2d')](handleEntityNotFound(_0x57cfd1,null))[_0xf458('0x2d')](saveUpdates(_0x417417['body'],null))['then'](respondWithResult(_0x57cfd1,null))[_0xf458('0x48')](handleError(_0x57cfd1,null));};exports['destroy']=function(_0x3e8f5e,_0x4765a9){return db['VoiceQueueReport'][_0xf458('0x4d')]({'where':{'id':_0x3e8f5e[_0xf458('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4765a9,null))['then'](removeEntity(_0x4765a9,null))[_0xf458('0x48')](handleError(_0x4765a9,null));};exports[_0xf458('0x51')]=function(_0x456b2a,_0xb4eaed){return db[_0xf458('0x32')][_0xf458('0x51')]()[_0xf458('0x2d')](respondWithResult(_0xb4eaed,null))[_0xf458('0x48')](handleError(_0xb4eaed,null));};exports[_0xf458('0x52')]=function(_0x5d6fcb,_0x4bfac2){var _0x2c6661={},_0x3b64fb={},_0x37a205={'count':0x0,'rows':[]};_0x3b64fb[_0xf458('0x35')]=_[_0xf458('0x37')](db[_0xf458('0x32')][_0xf458('0x4b')]);_0x3b64fb[_0xf458('0x36')]=_['keys'](_0x5d6fcb[_0xf458('0x36')]);_0x3b64fb[_0xf458('0x3f')]=_[_0xf458('0x38')](_0x3b64fb[_0xf458('0x35')],_0x3b64fb['query']);_0x2c6661[_0xf458('0x3a')]=_[_0xf458('0x38')](_0x3b64fb[_0xf458('0x35')],qs['fields'](_0x5d6fcb['query'][_0xf458('0x39')]));_0x2c6661['attributes']=_0x2c6661['attributes'][_0xf458('0x3b')]?_0x2c6661[_0xf458('0x3a')]:_0x3b64fb[_0xf458('0x35')];if(!_0x5d6fcb['query'][_0xf458('0x53')](_0xf458('0x54'))){_0x2c6661['limit']=qs['limit'](_0x5d6fcb[_0xf458('0x36')]['limit']);_0x2c6661[_0xf458('0x28')]=qs[_0xf458('0x28')](_0x5d6fcb[_0xf458('0x36')][_0xf458('0x28')]);}_0x2c6661[_0xf458('0x3c')]=qs[_0xf458('0x3d')](_0x5d6fcb[_0xf458('0x36')][_0xf458('0x3d')]);_0x2c6661[_0xf458('0x3e')]=qs[_0xf458('0x3f')](_[_0xf458('0x40')](_0x5d6fcb['query'],_0x3b64fb['filters']));if(_0x5d6fcb[_0xf458('0x36')][_0xf458('0x41')]){_0x2c6661['where']=_[_0xf458('0x42')](_0x2c6661[_0xf458('0x3e')],{'$or':_[_0xf458('0x43')](_0x2c6661['attributes'],function(_0xe78178){var _0x1fd303={};_0x1fd303[_0xe78178]={'$like':'%'+_0x5d6fcb[_0xf458('0x36')]['filter']+'%'};return _0x1fd303;})});}_0x2c6661=_[_0xf458('0x42')]({},_0x2c6661,_0x5d6fcb[_0xf458('0x45')]);var _0x377589={'where':_0x2c6661[_0xf458('0x3e')]};return db['VoiceQueueReport']['count'](_0x377589)['then'](function(_0x21a6af){_0x37a205[_0xf458('0x27')]=_0x21a6af;if(_0x5d6fcb[_0xf458('0x36')][_0xf458('0x4c')]){_0x2c6661['include']=[{'all':!![]}];}return db[_0xf458('0x32')][_0xf458('0x55')](_0x2c6661);})['then'](function(_0x125c2f){_0x37a205[_0xf458('0x47')]=_0x125c2f;return _0x37a205;})[_0xf458('0x2d')](respondWithFilteredResult(_0x4bfac2,_0x2c6661,_0xf458('0x52')))[_0xf458('0x48')](handleError(_0x4bfac2,null,_0xf458('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5ae6a39..98e60b4 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 _0xa756=['emit','hasOwnProperty','hook','events','VoiceQueueReport','save','update','remove'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xa756,0x1f3));var _0x6a75=function(_0x1475be,_0x4ed47c){_0x1475be=_0x1475be-0x0;var _0x306b4e=_0xa756[_0x1475be];return _0x306b4e;};'use strict';var EventEmitter=require(_0x6a75('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x6a75('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a75('0x2'),'afterUpdate':_0x6a75('0x3'),'afterDestroy':_0x6a75('0x4')};function emitEvent(_0x290be7){return function(_0x366822,_0x4a42d5,_0x5a10d0){VoiceQueueReportEvents[_0x6a75('0x5')](_0x290be7+':'+_0x366822['id'],_0x366822);VoiceQueueReportEvents['emit'](_0x290be7,_0x366822);_0x5a10d0(null);};}for(var e in events){if(events[_0x6a75('0x6')](e)){var event=events[e];VoiceQueueReport[_0x6a75('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x0725=['VoiceQueueReport','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x0725,0x116));var _0x5072=function(_0x496862,_0xdac590){_0x496862=_0x496862-0x0;var _0x4785c0=_0x0725[_0x496862];return _0x4785c0;};'use strict';var EventEmitter=require(_0x5072('0x0'));var VoiceQueueReport=require(_0x5072('0x1'))['db'][_0x5072('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5072('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1519d3){return function(_0xaa2ef1,_0x498686,_0x442116){VoiceQueueReportEvents[_0x5072('0x4')](_0x1519d3+':'+_0xaa2ef1['id'],_0xaa2ef1);VoiceQueueReportEvents[_0x5072('0x4')](_0x1519d3,_0xaa2ef1);_0x442116(null);};}for(var e in events){if(events[_0x5072('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5072('0x6')](e,emitEvent(event));}}module[_0x5072('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 883383b..25abea2 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 _0x7a88=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid','calleridnum'];(function(_0x341a5a,_0x4ae5ed){var _0x53f85b=function(_0x24899d){while(--_0x24899d){_0x341a5a['push'](_0x341a5a['shift']());}};_0x53f85b(++_0x4ae5ed);}(_0x7a88,0xb4));var _0x87a8=function(_0x2f90ed,_0x90af12){_0x2f90ed=_0x2f90ed-0x0;var _0x4cda45=_0x7a88[_0x2f90ed];return _0x4cda45;};'use strict';var _=require(_0x87a8('0x0'));var util=require(_0x87a8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x87a8('0x2'));var rp=require(_0x87a8('0x3'));var fs=require('fs');var path=require(_0x87a8('0x4'));var rimraf=require(_0x87a8('0x5'));var config=require(_0x87a8('0x6'));var attributes=require(_0x87a8('0x7'));module[_0x87a8('0x8')]=function(_0x1c03e4,_0x2829e8){return _0x1c03e4['define']('VoiceQueueReport',attributes,{'tableName':_0x87a8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x87a8('0xa')]},{'fields':[_0x87a8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2644=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x17f415,_0x1e98f7){var _0x4310a6=function(_0x318a68){while(--_0x318a68){_0x17f415['push'](_0x17f415['shift']());}};_0x4310a6(++_0x1e98f7);}(_0x2644,0xba));var _0x4264=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x2644[_0xf23ae0];return _0x441c81;};'use strict';var _=require(_0x4264('0x0'));var util=require(_0x4264('0x1'));var logger=require('../../config/logger')(_0x4264('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4264('0x3'));var fs=require('fs');var path=require(_0x4264('0x4'));var rimraf=require('rimraf');var config=require(_0x4264('0x5'));var attributes=require(_0x4264('0x6'));module[_0x4264('0x7')]=function(_0x123c46,_0x2c8585){return _0x123c46[_0x4264('0x8')](_0x4264('0x9'),attributes,{'tableName':_0x4264('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4264('0xb')]},{'fields':[_0x4264('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ff1ed83..6b18a97 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 _0xdd0b=['client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','limit','map','model','include','stringify','CreateVoiceQueueReport','create','body','debug','update','where','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdd0b,0x14f));var _0xbdd0=function(_0x5a35e2,_0x2131cd){_0x5a35e2=_0x5a35e2-0x0;var _0x19406a=_0xdd0b[_0x5a35e2];return _0x19406a;};'use strict';var _=require(_0xbdd0('0x0'));var util=require(_0xbdd0('0x1'));var moment=require(_0xbdd0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdd0('0x3'));var fs=require('fs');var Redis=require(_0xbdd0('0x4'));var db=require(_0xbdd0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd0('0x6'))(_0xbdd0('0x7'));var config=require(_0xbdd0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbdd0('0x9')][_0xbdd0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbdd0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdd0('0xc'))(new Redis(config['redis']));require(_0xbdd0('0xd'))[_0xbdd0('0xe')](socket);function respondWithRpcPromise(_0x56542f,_0x1264c2,_0x23cca9){return new BPromise(function(_0x48393c,_0x2c24de){return client[_0xbdd0('0xf')](_0x56542f,_0x23cca9)[_0xbdd0('0x10')](function(_0x28846e){logger[_0xbdd0('0x11')](_0xbdd0('0x12'),_0x1264c2,'request\x20sent');logger['debug'](_0xbdd0('0x13'),_0x1264c2,_0xbdd0('0x14'),JSON['stringify'](_0x28846e));if(_0x28846e['error']){if(_0x28846e[_0xbdd0('0x15')][_0xbdd0('0x16')]===0x1f4){logger['error'](_0xbdd0('0x12'),_0x1264c2,_0x28846e[_0xbdd0('0x15')][_0xbdd0('0x17')]);return _0x2c24de(_0x28846e[_0xbdd0('0x15')]['message']);}logger[_0xbdd0('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1264c2,_0x28846e[_0xbdd0('0x15')][_0xbdd0('0x17')]);return _0x48393c(_0x28846e[_0xbdd0('0x15')][_0xbdd0('0x17')]);}else{logger['info'](_0xbdd0('0x12'),_0x1264c2,_0xbdd0('0x14'));_0x48393c(_0x28846e[_0xbdd0('0x18')][_0xbdd0('0x17')]);}})[_0xbdd0('0x19')](function(_0x42ecf1){logger[_0xbdd0('0x15')](_0xbdd0('0x12'),_0x1264c2,_0x42ecf1);_0x2c24de(_0x42ecf1);});});}exports[_0xbdd0('0x1a')]=function(_0x2ee5fb){var _0x21f563=this;return new Promise(function(_0x336513,_0x4ce7b7){return db[_0xbdd0('0x1b')]['findAll']({'raw':_0x2ee5fb[_0xbdd0('0x1c')]?_0x2ee5fb[_0xbdd0('0x1c')][_0xbdd0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ee5fb[_0xbdd0('0x1c')]?_0x2ee5fb[_0xbdd0('0x1c')]['where']||null:null,'attributes':_0x2ee5fb['options']?_0x2ee5fb[_0xbdd0('0x1c')][_0xbdd0('0x1e')]||null:null,'limit':_0x2ee5fb['options']?_0x2ee5fb['options'][_0xbdd0('0x1f')]||null:null,'include':_0x2ee5fb[_0xbdd0('0x1c')]?_0x2ee5fb[_0xbdd0('0x1c')]['include']?_[_0xbdd0('0x20')](_0x2ee5fb[_0xbdd0('0x1c')]['include'],function(_0x142422){return{'model':db[_0x142422[_0xbdd0('0x21')]],'as':_0x142422['as'],'attributes':_0x142422[_0xbdd0('0x1e')],'include':_0x142422[_0xbdd0('0x22')]?_[_0xbdd0('0x20')](_0x142422['include'],function(_0x55f261){return{'model':db[_0x55f261[_0xbdd0('0x21')]],'as':_0x55f261['as'],'attributes':_0x55f261['attributes'],'include':_0x55f261[_0xbdd0('0x22')]?_[_0xbdd0('0x20')](_0x55f261[_0xbdd0('0x22')],function(_0x334ae9){return{'model':db[_0x334ae9['model']],'as':_0x334ae9['as'],'attributes':_0x334ae9[_0xbdd0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbdd0('0x10')](function(_0x119577){logger[_0xbdd0('0x11')](_0xbdd0('0x1a'),_0x2ee5fb);logger['debug'](_0xbdd0('0x1a'),_0x2ee5fb,JSON[_0xbdd0('0x23')](_0x119577));_0x336513(_0x119577);})['catch'](function(_0x1e840b){logger[_0xbdd0('0x15')](_0xbdd0('0x1a'),_0x1e840b['message'],_0x2ee5fb);_0x4ce7b7(_0x21f563[_0xbdd0('0x15')](0x1f4,_0x1e840b[_0xbdd0('0x17')]));});});};exports[_0xbdd0('0x24')]=function(_0x2c58f2){var _0x51edbf=this;return new Promise(function(_0x5ab124,_0x3df42a){return db['VoiceQueueReport'][_0xbdd0('0x25')](_0x2c58f2[_0xbdd0('0x26')],{'raw':_0x2c58f2[_0xbdd0('0x1c')]?_0x2c58f2[_0xbdd0('0x1c')][_0xbdd0('0x1d')]===undefined?!![]:![]:!![]})[_0xbdd0('0x10')](function(_0x179819){logger[_0xbdd0('0x11')]('CreateVoiceQueueReport',_0x2c58f2);logger[_0xbdd0('0x27')]('CreateVoiceQueueReport',_0x2c58f2,JSON[_0xbdd0('0x23')](_0x179819));_0x5ab124(_0x179819);})[_0xbdd0('0x19')](function(_0x4c1609){logger[_0xbdd0('0x15')](_0xbdd0('0x24'),_0x4c1609[_0xbdd0('0x17')],_0x2c58f2);_0x3df42a(_0x51edbf['error'](0x1f4,_0x4c1609['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x33768f){var _0x2d3faa=this;return new Promise(function(_0x50d929,_0xfb394c){return db[_0xbdd0('0x1b')][_0xbdd0('0x28')](_0x33768f[_0xbdd0('0x26')],{'raw':_0x33768f[_0xbdd0('0x1c')]?_0x33768f['options'][_0xbdd0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33768f[_0xbdd0('0x1c')]?_0x33768f['options'][_0xbdd0('0x29')]||null:null,'attributes':_0x33768f[_0xbdd0('0x1c')]?_0x33768f[_0xbdd0('0x1c')][_0xbdd0('0x1e')]||null:null,'limit':_0x33768f['options']?_0x33768f[_0xbdd0('0x1c')][_0xbdd0('0x1f')]||null:null})[_0xbdd0('0x10')](function(_0xa76f91){logger[_0xbdd0('0x11')](_0xbdd0('0x2a'),_0x33768f);logger[_0xbdd0('0x27')](_0xbdd0('0x2a'),_0x33768f,JSON[_0xbdd0('0x23')](_0xa76f91));_0x50d929(_0xa76f91);})[_0xbdd0('0x19')](function(_0x325233){logger[_0xbdd0('0x15')]('UpdateVoiceQueueReport',_0x325233[_0xbdd0('0x17')],_0x33768f);_0xfb394c(_0x2d3faa['error'](0x1f4,_0x325233[_0xbdd0('0x17')]));});});}; \ No newline at end of file +var _0x0a39=['then','debug','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x2ccb4d,_0x4e2e9c){var _0x7a0915=function(_0x473e50){while(--_0x473e50){_0x2ccb4d['push'](_0x2ccb4d['shift']());}};_0x7a0915(++_0x4e2e9c);}(_0x0a39,0xf3));var _0x90a3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0a39[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x90a3('0x0'));var util=require('util');var moment=require(_0x90a3('0x1'));var BPromise=require(_0x90a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90a3('0x3'));var db=require(_0x90a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x90a3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x90a3('0x6'));var client=jayson[_0x90a3('0x7')]['http']({'port':0x232a});config[_0x90a3('0x8')]=_['defaults'](config['redis'],{'host':_0x90a3('0x9'),'port':0x18eb});var socket=require(_0x90a3('0xa'))(new Redis(config['redis']));require(_0x90a3('0xb'))[_0x90a3('0xc')](socket);function respondWithRpcPromise(_0x260c30,_0x489e6e,_0x468c9d){return new BPromise(function(_0x58f3ea,_0x4bef86){return client['request'](_0x260c30,_0x468c9d)['then'](function(_0x1b2d75){logger[_0x90a3('0xd')](_0x90a3('0xe'),_0x489e6e,_0x90a3('0xf'));logger['debug'](_0x90a3('0x10'),_0x489e6e,'request\x20sent',JSON[_0x90a3('0x11')](_0x1b2d75));if(_0x1b2d75[_0x90a3('0x12')]){if(_0x1b2d75[_0x90a3('0x12')]['code']===0x1f4){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);return _0x4bef86(_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);}logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x1b2d75[_0x90a3('0x12')]['message']);return _0x58f3ea(_0x1b2d75[_0x90a3('0x12')][_0x90a3('0x13')]);}else{logger[_0x90a3('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x489e6e,_0x90a3('0xf'));_0x58f3ea(_0x1b2d75[_0x90a3('0x14')][_0x90a3('0x13')]);}})['catch'](function(_0x38b115){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x489e6e,_0x38b115);_0x4bef86(_0x38b115);});});}exports[_0x90a3('0x15')]=function(_0x229a00){var _0x503b31=this;return new Promise(function(_0x52f768,_0x53f966){return db['VoiceQueueReport'][_0x90a3('0x16')]({'raw':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')][_0x90a3('0x18')]===undefined?!![]:![]:!![],'where':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')]['where']||null:null,'attributes':_0x229a00[_0x90a3('0x17')]?_0x229a00['options'][_0x90a3('0x19')]||null:null,'limit':_0x229a00[_0x90a3('0x17')]?_0x229a00[_0x90a3('0x17')][_0x90a3('0x1a')]||null:null,'include':_0x229a00[_0x90a3('0x17')]?_0x229a00['options'][_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x229a00[_0x90a3('0x17')][_0x90a3('0x1b')],function(_0x4a6aeb){return{'model':db[_0x4a6aeb['model']],'as':_0x4a6aeb['as'],'attributes':_0x4a6aeb['attributes'],'include':_0x4a6aeb[_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x4a6aeb[_0x90a3('0x1b')],function(_0x1a869f){return{'model':db[_0x1a869f[_0x90a3('0x1d')]],'as':_0x1a869f['as'],'attributes':_0x1a869f[_0x90a3('0x19')],'include':_0x1a869f[_0x90a3('0x1b')]?_[_0x90a3('0x1c')](_0x1a869f[_0x90a3('0x1b')],function(_0x8b9bd4){return{'model':db[_0x8b9bd4['model']],'as':_0x8b9bd4['as'],'attributes':_0x8b9bd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x90a3('0x1e')](function(_0x175a0b){logger[_0x90a3('0xd')](_0x90a3('0x15'),_0x229a00);logger[_0x90a3('0x1f')](_0x90a3('0x15'),_0x229a00,JSON[_0x90a3('0x11')](_0x175a0b));_0x52f768(_0x175a0b);})[_0x90a3('0x20')](function(_0xe1ba26){logger[_0x90a3('0x12')]('GetVoiceQueueReport',_0xe1ba26[_0x90a3('0x13')],_0x229a00);_0x53f966(_0x503b31['error'](0x1f4,_0xe1ba26[_0x90a3('0x13')]));});});};exports[_0x90a3('0x21')]=function(_0x5c86fa){var _0x382ba9=this;return new Promise(function(_0x2a6cc9,_0x53ed1a){return db['VoiceQueueReport'][_0x90a3('0x22')](_0x5c86fa[_0x90a3('0x23')],{'raw':_0x5c86fa[_0x90a3('0x17')]?_0x5c86fa[_0x90a3('0x17')][_0x90a3('0x18')]===undefined?!![]:![]:!![]})[_0x90a3('0x1e')](function(_0x28d58d){logger[_0x90a3('0xd')]('CreateVoiceQueueReport',_0x5c86fa);logger[_0x90a3('0x1f')](_0x90a3('0x21'),_0x5c86fa,JSON[_0x90a3('0x11')](_0x28d58d));_0x2a6cc9(_0x28d58d);})[_0x90a3('0x20')](function(_0x3a1c18){logger[_0x90a3('0x12')](_0x90a3('0x21'),_0x3a1c18[_0x90a3('0x13')],_0x5c86fa);_0x53ed1a(_0x382ba9['error'](0x1f4,_0x3a1c18[_0x90a3('0x13')]));});});};exports[_0x90a3('0x24')]=function(_0x4131b7){var _0x707bb=this;return new Promise(function(_0x23c5ff,_0x8d3069){return db[_0x90a3('0x25')][_0x90a3('0x26')](_0x4131b7['body'],{'raw':_0x4131b7[_0x90a3('0x17')]?_0x4131b7['options'][_0x90a3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')]['where']||null:null,'attributes':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')][_0x90a3('0x19')]||null:null,'limit':_0x4131b7[_0x90a3('0x17')]?_0x4131b7[_0x90a3('0x17')][_0x90a3('0x1a')]||null:null})['then'](function(_0xf45c80){logger[_0x90a3('0xd')](_0x90a3('0x24'),_0x4131b7);logger[_0x90a3('0x1f')](_0x90a3('0x24'),_0x4131b7,JSON[_0x90a3('0x11')](_0xf45c80));_0x23c5ff(_0xf45c80);})[_0x90a3('0x20')](function(_0x4dc27c){logger['error']('UpdateVoiceQueueReport',_0x4dc27c['message'],_0x4131b7);_0x8d3069(_0x707bb['error'](0x1f4,_0x4dc27c[_0x90a3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4a38a5c..68dc9d5 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 _0x131a=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x3decd0,_0x252a58){var _0x57e158=function(_0x3a0067){while(--_0x3a0067){_0x3decd0['push'](_0x3decd0['shift']());}};_0x57e158(++_0x252a58);}(_0x131a,0x18b));var _0xa131=function(_0x493ae0,_0x13bc00){_0x493ae0=_0x493ae0-0x0;var _0x19e1ef=_0x131a[_0x493ae0];return _0x19e1ef;};'use strict';var VoiceQueueReportEvents=require(_0xa131('0x0'));var events=[_0xa131('0x1'),_0xa131('0x2'),_0xa131('0x3')];function createListener(_0x2bc3d1,_0x47b042){return function(_0x38a99b){_0x47b042['emit'](_0x2bc3d1,_0x38a99b);};}function removeListener(_0x20560e,_0x1bf41d){return function(){VoiceQueueReportEvents['removeListener'](_0x20560e,_0x1bf41d);};}exports[_0xa131('0x4')]=function(_0xdb263c){for(var _0x1a51cf=0x0,_0x273875=events[_0xa131('0x5')];_0x1a51cf<_0x273875;_0x1a51cf++){var _0x43ac6c=events[_0x1a51cf];var _0x26bdfb=createListener(_0xa131('0x6')+_0x43ac6c,_0xdb263c);VoiceQueueReportEvents['on'](_0x43ac6c,_0x26bdfb);}}; \ No newline at end of file +var _0xa2ae=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','removeListener','register'];(function(_0x52be59,_0x334bc9){var _0x324031=function(_0xc48ad9){while(--_0xc48ad9){_0x52be59['push'](_0x52be59['shift']());}};_0x324031(++_0x334bc9);}(_0xa2ae,0x95));var _0xea2a=function(_0x29e398,_0x890225){_0x29e398=_0x29e398-0x0;var _0xd799e2=_0xa2ae[_0x29e398];return _0xd799e2;};'use strict';var VoiceQueueReportEvents=require(_0xea2a('0x0'));var events=[_0xea2a('0x1'),'remove',_0xea2a('0x2')];function createListener(_0x3f62e2,_0x408dfb){return function(_0x22ef58){_0x408dfb['emit'](_0x3f62e2,_0x22ef58);};}function removeListener(_0xe5813c,_0x171fe6){return function(){VoiceQueueReportEvents[_0xea2a('0x3')](_0xe5813c,_0x171fe6);};}exports[_0xea2a('0x4')]=function(_0x115f66){for(var _0x40c61a=0x0,_0x2fea7c=events[_0xea2a('0x5')];_0x40c61a<_0x2fea7c;_0x40c61a++){var _0x1ecf9f=events[_0x40c61a];var _0x26d892=createListener(_0xea2a('0x6')+_0x1ecf9f,_0x115f66);VoiceQueueReportEvents['on'](_0x1ecf9f,_0x26d892);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 777a25b..478aa53 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 _0x9af6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5eebe6,_0x4a3d7a){var _0x3678db=function(_0x1383b5){while(--_0x1383b5){_0x5eebe6['push'](_0x5eebe6['shift']());}};_0x3678db(++_0x4a3d7a);}(_0x9af6,0xb5));var _0x69af=function(_0x1b8c1d,_0x1c71f2){_0x1b8c1d=_0x1b8c1d-0x0;var _0x54baf1=_0x9af6[_0x1b8c1d];return _0x54baf1;};'use strict';var multer=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var path=require(_0x69af('0x2'));var timeout=require(_0x69af('0x3'));var express=require(_0x69af('0x4'));var router=express['Router']();var fs_extra=require(_0x69af('0x5'));var auth=require(_0x69af('0x6'));var interaction=require(_0x69af('0x7'));var config=require(_0x69af('0x8'));var controller=require(_0x69af('0x9'));router[_0x69af('0xa')]('/',auth[_0x69af('0xb')](),controller[_0x69af('0xc')]);router['get'](_0x69af('0xd'),auth[_0x69af('0xb')](),controller['show']);router[_0x69af('0xe')]('/',auth[_0x69af('0xb')](),controller['create']);router[_0x69af('0xf')](_0x69af('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x69af('0xd'),auth[_0x69af('0xb')](),controller[_0x69af('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0a9f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','post','put','delete','destroy','exports','multer','util','path'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x556dda,_0x3180e8){_0x556dda=_0x556dda-0x0;var _0x3405ce=_0x0a9f[_0x556dda];return _0x3405ce;};'use strict';var multer=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var path=require(_0xf0a9('0x2'));var timeout=require(_0xf0a9('0x3'));var express=require(_0xf0a9('0x4'));var router=express[_0xf0a9('0x5')]();var fs_extra=require(_0xf0a9('0x6'));var auth=require(_0xf0a9('0x7'));var interaction=require(_0xf0a9('0x8'));var config=require(_0xf0a9('0x9'));var controller=require(_0xf0a9('0xa'));router[_0xf0a9('0xb')]('/',auth['isAuthenticated'](),controller[_0xf0a9('0xc')]);router['get'](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller['show']);router[_0xf0a9('0xf')]('/',auth[_0xf0a9('0xe')](),controller['create']);router[_0xf0a9('0x10')](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller['update']);router[_0xf0a9('0x11')](_0xf0a9('0xd'),auth[_0xf0a9('0xe')](),controller[_0xf0a9('0x12')]);module[_0xf0a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c7647ac..7aaaf5f 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 _0xb42e=['exports','STRING','DATE','literal','sequelize'];(function(_0xe55934,_0x26aaad){var _0x59f18e=function(_0xb6b1c8){while(--_0xb6b1c8){_0xe55934['push'](_0xe55934['shift']());}};_0x59f18e(++_0x26aaad);}(_0xb42e,0x1cb));var _0xeb42=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xb42e[_0xbb9dbf];return _0x30223c;};'use strict';var Sequelize=require(_0xeb42('0x0'));var moment=require('moment');module[_0xeb42('0x1')]={'time':{'type':Sequelize[_0xeb42('0x2')]},'callid':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xeb42('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xeb42('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xeb42('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xefc6=['DATE','literal','sequelize','moment','exports','STRING'];(function(_0xef7317,_0x56e3de){var _0x2f1680=function(_0xa9d9fe){while(--_0xa9d9fe){_0xef7317['push'](_0xef7317['shift']());}};_0x2f1680(++_0x56e3de);}(_0xefc6,0x10a));var _0x6efc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xefc6[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x6efc('0x0'));var moment=require(_0x6efc('0x1'));module[_0x6efc('0x2')]={'time':{'type':Sequelize[_0x6efc('0x3')]},'callid':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6efc('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6efc('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x6efc('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c8174a5..ce80ce7 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 _0xf1fb=['intersection','model','attributes','fields','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys'];(function(_0x141993,_0x5cd8c2){var _0x55203a=function(_0x1797cd){while(--_0x1797cd){_0x141993['push'](_0x141993['shift']());}};_0x55203a(++_0x5cd8c2);}(_0xf1fb,0xf1));var _0xbf1f=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf1fb[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require(_0xbf1f('0x0'));var rimraf=require(_0xbf1f('0x1'));var zipdir=require(_0xbf1f('0x2'));var jsonpatch=require(_0xbf1f('0x3'));var rp=require('request-promise');var moment=require(_0xbf1f('0x4'));var BPromise=require(_0xbf1f('0x5'));var Mustache=require(_0xbf1f('0x6'));var util=require('util');var path=require(_0xbf1f('0x7'));var sox=require('sox');var csv=require(_0xbf1f('0x8'));var ejs=require(_0xbf1f('0x9'));var fs=require('fs');var fs_extra=require(_0xbf1f('0xa'));var _=require(_0xbf1f('0xb'));var squel=require(_0xbf1f('0xc'));var crypto=require('crypto');var jsforce=require(_0xbf1f('0xd'));var deskjs=require(_0xbf1f('0xe'));var toCsv=require(_0xbf1f('0x8'));var querystring=require(_0xbf1f('0xf'));var Papa=require(_0xbf1f('0x10'));var Redis=require(_0xbf1f('0x11'));var authService=require(_0xbf1f('0x12'));var qs=require(_0xbf1f('0x13'));var as=require(_0xbf1f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf1f('0x15'))(_0xbf1f('0x16'));var utils=require(_0xbf1f('0x17'));var config=require(_0xbf1f('0x18'));var licenseUtil=require(_0xbf1f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ad43,_0x14656a){_0x14656a=_0x14656a||0xcc;return function(_0x515223){if(_0x515223){return _0x32ad43['sendStatus'](_0x14656a);}return _0x32ad43[_0xbf1f('0x1a')](_0x14656a)[_0xbf1f('0x1b')]();};}function respondWithResult(_0x1df5d5,_0x2ce9c9){_0x2ce9c9=_0x2ce9c9||0xc8;return function(_0x4bc38c){if(_0x4bc38c){return _0x1df5d5[_0xbf1f('0x1a')](_0x2ce9c9)[_0xbf1f('0x1c')](_0x4bc38c);}};}function respondWithFilteredResult(_0x41b56d,_0x3210d0){return function(_0x52a913){if(_0x52a913){var _0x1392f7=typeof _0x3210d0[_0xbf1f('0x1d')]===_0xbf1f('0x1e')&&typeof _0x3210d0[_0xbf1f('0x1f')]===_0xbf1f('0x1e');var _0x1d2d0f=_0x52a913[_0xbf1f('0x20')];var _0x152bf3=_0x1392f7?0x0:_0x3210d0[_0xbf1f('0x1d')];var _0x2449e7=_0x1392f7?_0x52a913[_0xbf1f('0x20')]:_0x3210d0[_0xbf1f('0x1d')]+_0x3210d0[_0xbf1f('0x1f')];var _0x33ccf1;if(_0x2449e7>=_0x1d2d0f){_0x2449e7=_0x1d2d0f;_0x33ccf1=0xc8;}else{_0x33ccf1=0xce;}_0x41b56d['status'](_0x33ccf1);return _0x41b56d[_0xbf1f('0x21')]('Content-Range',_0x152bf3+'-'+_0x2449e7+'/'+_0x1d2d0f)[_0xbf1f('0x1c')](_0x52a913);}return null;};}function patchUpdates(_0x1c20cf){return function(_0x43954f){try{jsonpatch[_0xbf1f('0x22')](_0x43954f,_0x1c20cf,!![]);}catch(_0x3e940d){return BPromise[_0xbf1f('0x23')](_0x3e940d);}return _0x43954f[_0xbf1f('0x24')]();};}function saveUpdates(_0x19a00e,_0x3f71a2){return function(_0x33b55c){if(_0x33b55c){return _0x33b55c['update'](_0x19a00e)[_0xbf1f('0x25')](function(_0x10993a){return _0x10993a;});}return null;};}function removeEntity(_0x2b9c71,_0x43aa35){return function(_0x325339){if(_0x325339){return _0x325339['destroy']()[_0xbf1f('0x25')](function(){_0x2b9c71['status'](0xcc)[_0xbf1f('0x1b')]();});}};}function handleEntityNotFound(_0x55f071,_0x1a33d4){return function(_0x4f3dd0){if(!_0x4f3dd0){_0x55f071[_0xbf1f('0x26')](0x194);}return _0x4f3dd0;};}function handleError(_0x143dc6,_0x6f557){_0x6f557=_0x6f557||0x1f4;return function(_0x1e5918){logger[_0xbf1f('0x27')](_0x1e5918[_0xbf1f('0x28')]);if(_0x1e5918[_0xbf1f('0x29')]){delete _0x1e5918[_0xbf1f('0x29')];}_0x143dc6[_0xbf1f('0x1a')](_0x6f557)[_0xbf1f('0x2a')](_0x1e5918);};}exports['index']=function(_0x849985,_0x109cc0){var _0x108945={},_0x31e294={},_0x46920c={'count':0x0,'rows':[]};var _0x52bd46=_[_0xbf1f('0x2b')](db[_0xbf1f('0x2c')][_0xbf1f('0x2d')],function(_0x17b4ad){return{'name':_0x17b4ad[_0xbf1f('0x2e')],'type':_0x17b4ad[_0xbf1f('0x2f')][_0xbf1f('0x30')]};});_0x31e294['model']=_[_0xbf1f('0x2b')](_0x52bd46,'name');_0x31e294[_0xbf1f('0x31')]=_[_0xbf1f('0x32')](_0x849985['query']);_0x31e294['filters']=_[_0xbf1f('0x33')](_0x31e294[_0xbf1f('0x34')],_0x31e294[_0xbf1f('0x31')]);_0x108945[_0xbf1f('0x35')]=_[_0xbf1f('0x33')](_0x31e294[_0xbf1f('0x34')],qs[_0xbf1f('0x36')](_0x849985[_0xbf1f('0x31')]['fields']));_0x108945[_0xbf1f('0x35')]=_0x108945['attributes']['length']?_0x108945[_0xbf1f('0x35')]:_0x31e294[_0xbf1f('0x34')];if(!_0x849985[_0xbf1f('0x31')]['hasOwnProperty']('nolimit')){_0x108945[_0xbf1f('0x1f')]=qs[_0xbf1f('0x1f')](_0x849985['query'][_0xbf1f('0x1f')]);_0x108945[_0xbf1f('0x1d')]=qs['offset'](_0x849985[_0xbf1f('0x31')][_0xbf1f('0x1d')]);}_0x108945[_0xbf1f('0x37')]=qs[_0xbf1f('0x38')](_0x849985['query'][_0xbf1f('0x38')]);_0x108945[_0xbf1f('0x39')]=qs['filters'](_[_0xbf1f('0x3a')](_0x849985['query'],_0x31e294[_0xbf1f('0x3b')]),_0x52bd46);if(_0x849985[_0xbf1f('0x31')][_0xbf1f('0x3c')]){_0x108945[_0xbf1f('0x39')]=_[_0xbf1f('0x3d')](_0x108945[_0xbf1f('0x39')],{'$or':_[_0xbf1f('0x2b')](_0x52bd46,function(_0x368bb2){if(_0x368bb2['type']!==_0xbf1f('0x3e')){var _0x544e3e={};_0x544e3e[_0x368bb2[_0xbf1f('0x29')]]={'$like':'%'+_0x849985['query'][_0xbf1f('0x3c')]+'%'};return _0x544e3e;}})});}_0x108945=_['merge']({},_0x108945,_0x849985[_0xbf1f('0x3f')]);var _0x4a6ed0={'where':_0x108945['where']};return db[_0xbf1f('0x2c')]['count'](_0x4a6ed0)[_0xbf1f('0x25')](function(_0x595669){_0x46920c[_0xbf1f('0x20')]=_0x595669;if(_0x849985[_0xbf1f('0x31')][_0xbf1f('0x40')]){_0x108945[_0xbf1f('0x41')]=[{'all':!![]}];}return db[_0xbf1f('0x2c')]['findAll'](_0x108945);})[_0xbf1f('0x25')](function(_0x117e37){_0x46920c['rows']=_0x117e37;return _0x46920c;})[_0xbf1f('0x25')](respondWithFilteredResult(_0x109cc0,_0x108945))['catch'](handleError(_0x109cc0,null));};exports[_0xbf1f('0x42')]=function(_0x2b18e0,_0x5bc924){var _0x4cd7ec={'raw':!![],'where':{'id':_0x2b18e0['params']['id']}},_0x38a3b7={};_0x38a3b7['model']=_[_0xbf1f('0x32')](db['VoiceQueuesLog']['rawAttributes']);_0x38a3b7['query']=_['keys'](_0x2b18e0[_0xbf1f('0x31')]);_0x38a3b7['filters']=_[_0xbf1f('0x33')](_0x38a3b7[_0xbf1f('0x34')],_0x38a3b7['query']);_0x4cd7ec[_0xbf1f('0x35')]=_[_0xbf1f('0x33')](_0x38a3b7[_0xbf1f('0x34')],qs[_0xbf1f('0x36')](_0x2b18e0[_0xbf1f('0x31')][_0xbf1f('0x36')]));_0x4cd7ec[_0xbf1f('0x35')]=_0x4cd7ec[_0xbf1f('0x35')][_0xbf1f('0x43')]?_0x4cd7ec['attributes']:_0x38a3b7[_0xbf1f('0x34')];if(_0x2b18e0[_0xbf1f('0x31')][_0xbf1f('0x40')]){_0x4cd7ec[_0xbf1f('0x41')]=[{'all':!![]}];}_0x4cd7ec=_[_0xbf1f('0x3d')]({},_0x4cd7ec,_0x2b18e0[_0xbf1f('0x3f')]);return db[_0xbf1f('0x2c')][_0xbf1f('0x44')](_0x4cd7ec)[_0xbf1f('0x25')](handleEntityNotFound(_0x5bc924,null))[_0xbf1f('0x25')](respondWithResult(_0x5bc924,null))[_0xbf1f('0x45')](handleError(_0x5bc924,null));};exports[_0xbf1f('0x46')]=function(_0x1f7a73,_0x42eee0){return db[_0xbf1f('0x2c')][_0xbf1f('0x46')](_0x1f7a73[_0xbf1f('0x47')],{})[_0xbf1f('0x25')](respondWithResult(_0x42eee0,0xc9))[_0xbf1f('0x45')](handleError(_0x42eee0,null));};exports['update']=function(_0x446eef,_0x2094d9){if(_0x446eef[_0xbf1f('0x47')]['id']){delete _0x446eef[_0xbf1f('0x47')]['id'];}return db[_0xbf1f('0x2c')][_0xbf1f('0x44')]({'where':{'id':_0x446eef[_0xbf1f('0x48')]['id']}})[_0xbf1f('0x25')](handleEntityNotFound(_0x2094d9,null))[_0xbf1f('0x25')](saveUpdates(_0x446eef[_0xbf1f('0x47')],null))[_0xbf1f('0x25')](respondWithResult(_0x2094d9,null))[_0xbf1f('0x45')](handleError(_0x2094d9,null));};exports['destroy']=function(_0x2f32cd,_0x348ded){return db[_0xbf1f('0x2c')]['find']({'where':{'id':_0x2f32cd['params']['id']}})[_0xbf1f('0x25')](handleEntityNotFound(_0x348ded,null))[_0xbf1f('0x25')](removeEntity(_0x348ded,null))[_0xbf1f('0x45')](handleError(_0x348ded,null));}; \ No newline at end of file +var _0xf8f6=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','keys','includeAll','include','find','create','body','catch','update','params','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf8f6,0x73));var _0x6f8f=function(_0xfab12e,_0x2905b0){_0xfab12e=_0xfab12e-0x0;var _0x1933bd=_0xf8f6[_0xfab12e];return _0x1933bd;};'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(_0x6f8f('0x0'));var moment=require(_0x6f8f('0x1'));var BPromise=require(_0x6f8f('0x2'));var Mustache=require(_0x6f8f('0x3'));var util=require(_0x6f8f('0x4'));var path=require(_0x6f8f('0x5'));var sox=require(_0x6f8f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f8f('0x7'));var squel=require(_0x6f8f('0x8'));var crypto=require(_0x6f8f('0x9'));var jsforce=require(_0x6f8f('0xa'));var deskjs=require(_0x6f8f('0xb'));var toCsv=require(_0x6f8f('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f8f('0xd'));var as=require(_0x6f8f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f8f('0xf'))(_0x6f8f('0x10'));var utils=require(_0x6f8f('0x11'));var config=require(_0x6f8f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9074,_0x166564){_0x166564=_0x166564||0xcc;return function(_0x346455){if(_0x346455){return _0x3c9074[_0x6f8f('0x13')](_0x166564);}return _0x3c9074['status'](_0x166564)[_0x6f8f('0x14')]();};}function respondWithResult(_0xb9a3e9,_0x434bd3){_0x434bd3=_0x434bd3||0xc8;return function(_0x2722b0){if(_0x2722b0){return _0xb9a3e9[_0x6f8f('0x15')](_0x434bd3)[_0x6f8f('0x16')](_0x2722b0);}};}function respondWithFilteredResult(_0x4f478f,_0x31b61e){return function(_0x5d126d){if(_0x5d126d){var _0xf931f6=typeof _0x31b61e[_0x6f8f('0x17')]===_0x6f8f('0x18')&&typeof _0x31b61e[_0x6f8f('0x19')]===_0x6f8f('0x18');var _0x52490c=_0x5d126d[_0x6f8f('0x1a')];var _0x283be2=_0xf931f6?0x0:_0x31b61e[_0x6f8f('0x17')];var _0x4c266c=_0xf931f6?_0x5d126d[_0x6f8f('0x1a')]:_0x31b61e[_0x6f8f('0x17')]+_0x31b61e[_0x6f8f('0x19')];var _0x1a5390;if(_0x4c266c>=_0x52490c){_0x4c266c=_0x52490c;_0x1a5390=0xc8;}else{_0x1a5390=0xce;}_0x4f478f[_0x6f8f('0x15')](_0x1a5390);return _0x4f478f[_0x6f8f('0x1b')](_0x6f8f('0x1c'),_0x283be2+'-'+_0x4c266c+'/'+_0x52490c)[_0x6f8f('0x16')](_0x5d126d);}return null;};}function patchUpdates(_0x2e732f){return function(_0x1911c1){try{jsonpatch['apply'](_0x1911c1,_0x2e732f,!![]);}catch(_0x502f51){return BPromise[_0x6f8f('0x1d')](_0x502f51);}return _0x1911c1[_0x6f8f('0x1e')]();};}function saveUpdates(_0x272464,_0x125c2c){return function(_0x22d731){if(_0x22d731){return _0x22d731['update'](_0x272464)[_0x6f8f('0x1f')](function(_0x30efb5){return _0x30efb5;});}return null;};}function removeEntity(_0x59d8ce,_0x5487bf){return function(_0x58bd58){if(_0x58bd58){return _0x58bd58[_0x6f8f('0x20')]()[_0x6f8f('0x1f')](function(){_0x59d8ce[_0x6f8f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fa35,_0x42fb36){return function(_0x1f7259){if(!_0x1f7259){_0x22fa35[_0x6f8f('0x13')](0x194);}return _0x1f7259;};}function handleError(_0x5a1be2,_0x1f373e){_0x1f373e=_0x1f373e||0x1f4;return function(_0x153868){logger[_0x6f8f('0x21')](_0x153868[_0x6f8f('0x22')]);if(_0x153868[_0x6f8f('0x23')]){delete _0x153868[_0x6f8f('0x23')];}_0x5a1be2['status'](_0x1f373e)[_0x6f8f('0x24')](_0x153868);};}exports['index']=function(_0x5410d4,_0x530d6a){var _0x2e1927={},_0x4e3afe={},_0x35cc48={'count':0x0,'rows':[]};var _0x9e138f=_[_0x6f8f('0x25')](db[_0x6f8f('0x26')][_0x6f8f('0x27')],function(_0x2f3676){return{'name':_0x2f3676['fieldName'],'type':_0x2f3676[_0x6f8f('0x28')][_0x6f8f('0x29')]};});_0x4e3afe[_0x6f8f('0x2a')]=_['map'](_0x9e138f,'name');_0x4e3afe[_0x6f8f('0x2b')]=_['keys'](_0x5410d4[_0x6f8f('0x2b')]);_0x4e3afe[_0x6f8f('0x2c')]=_['intersection'](_0x4e3afe[_0x6f8f('0x2a')],_0x4e3afe[_0x6f8f('0x2b')]);_0x2e1927['attributes']=_[_0x6f8f('0x2d')](_0x4e3afe[_0x6f8f('0x2a')],qs[_0x6f8f('0x2e')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x2e')]));_0x2e1927[_0x6f8f('0x2f')]=_0x2e1927[_0x6f8f('0x2f')][_0x6f8f('0x30')]?_0x2e1927['attributes']:_0x4e3afe[_0x6f8f('0x2a')];if(!_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x31')]('nolimit')){_0x2e1927['limit']=qs[_0x6f8f('0x19')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x19')]);_0x2e1927[_0x6f8f('0x17')]=qs[_0x6f8f('0x17')](_0x5410d4[_0x6f8f('0x2b')]['offset']);}_0x2e1927[_0x6f8f('0x32')]=qs[_0x6f8f('0x33')](_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x33')]);_0x2e1927[_0x6f8f('0x34')]=qs[_0x6f8f('0x2c')](_[_0x6f8f('0x35')](_0x5410d4[_0x6f8f('0x2b')],_0x4e3afe['filters']),_0x9e138f);if(_0x5410d4[_0x6f8f('0x2b')]['filter']){_0x2e1927[_0x6f8f('0x34')]=_[_0x6f8f('0x36')](_0x2e1927[_0x6f8f('0x34')],{'$or':_['map'](_0x9e138f,function(_0x5049ed){if(_0x5049ed[_0x6f8f('0x28')]!==_0x6f8f('0x37')){var _0x16a86f={};_0x16a86f[_0x5049ed[_0x6f8f('0x23')]]={'$like':'%'+_0x5410d4[_0x6f8f('0x2b')][_0x6f8f('0x38')]+'%'};return _0x16a86f;}})});}_0x2e1927=_[_0x6f8f('0x36')]({},_0x2e1927,_0x5410d4[_0x6f8f('0x39')]);var _0x3cc7ce={'where':_0x2e1927[_0x6f8f('0x34')]};return db[_0x6f8f('0x26')][_0x6f8f('0x1a')](_0x3cc7ce)[_0x6f8f('0x1f')](function(_0x3f252b){_0x35cc48[_0x6f8f('0x1a')]=_0x3f252b;if(_0x5410d4[_0x6f8f('0x2b')]['includeAll']){_0x2e1927['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x2e1927);})[_0x6f8f('0x1f')](function(_0x31d5c0){_0x35cc48['rows']=_0x31d5c0;return _0x35cc48;})[_0x6f8f('0x1f')](respondWithFilteredResult(_0x530d6a,_0x2e1927))['catch'](handleError(_0x530d6a,null));};exports['show']=function(_0x49ef97,_0x1eea67){var _0xf9a9fa={'raw':!![],'where':{'id':_0x49ef97['params']['id']}},_0x290098={};_0x290098[_0x6f8f('0x2a')]=_['keys'](db[_0x6f8f('0x26')][_0x6f8f('0x27')]);_0x290098[_0x6f8f('0x2b')]=_[_0x6f8f('0x3a')](_0x49ef97[_0x6f8f('0x2b')]);_0x290098['filters']=_[_0x6f8f('0x2d')](_0x290098[_0x6f8f('0x2a')],_0x290098['query']);_0xf9a9fa[_0x6f8f('0x2f')]=_[_0x6f8f('0x2d')](_0x290098['model'],qs[_0x6f8f('0x2e')](_0x49ef97[_0x6f8f('0x2b')]['fields']));_0xf9a9fa[_0x6f8f('0x2f')]=_0xf9a9fa[_0x6f8f('0x2f')][_0x6f8f('0x30')]?_0xf9a9fa[_0x6f8f('0x2f')]:_0x290098['model'];if(_0x49ef97[_0x6f8f('0x2b')][_0x6f8f('0x3b')]){_0xf9a9fa[_0x6f8f('0x3c')]=[{'all':!![]}];}_0xf9a9fa=_[_0x6f8f('0x36')]({},_0xf9a9fa,_0x49ef97['options']);return db[_0x6f8f('0x26')][_0x6f8f('0x3d')](_0xf9a9fa)['then'](handleEntityNotFound(_0x1eea67,null))[_0x6f8f('0x1f')](respondWithResult(_0x1eea67,null))['catch'](handleError(_0x1eea67,null));};exports[_0x6f8f('0x3e')]=function(_0x28eae6,_0x3c9cb0){return db[_0x6f8f('0x26')][_0x6f8f('0x3e')](_0x28eae6[_0x6f8f('0x3f')],{})[_0x6f8f('0x1f')](respondWithResult(_0x3c9cb0,0xc9))[_0x6f8f('0x40')](handleError(_0x3c9cb0,null));};exports[_0x6f8f('0x41')]=function(_0x2fd83d,_0x3a69ba){if(_0x2fd83d[_0x6f8f('0x3f')]['id']){delete _0x2fd83d['body']['id'];}return db[_0x6f8f('0x26')][_0x6f8f('0x3d')]({'where':{'id':_0x2fd83d[_0x6f8f('0x42')]['id']}})[_0x6f8f('0x1f')](handleEntityNotFound(_0x3a69ba,null))['then'](saveUpdates(_0x2fd83d[_0x6f8f('0x3f')],null))['then'](respondWithResult(_0x3a69ba,null))[_0x6f8f('0x40')](handleError(_0x3a69ba,null));};exports['destroy']=function(_0x4e7441,_0x3b427f){return db['VoiceQueuesLog'][_0x6f8f('0x3d')]({'where':{'id':_0x4e7441[_0x6f8f('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b427f,null))[_0x6f8f('0x1f')](removeEntity(_0x3b427f,null))[_0x6f8f('0x40')](handleError(_0x3b427f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 489a999..effdaa3 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 _0x1bf8=['path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x365cb6,_0x155187){var _0x33407f=function(_0x404b92){while(--_0x404b92){_0x365cb6['push'](_0x365cb6['shift']());}};_0x33407f(++_0x155187);}(_0x1bf8,0x161));var _0x81bf=function(_0x2fe21a,_0x8ab4a6){_0x2fe21a=_0x2fe21a-0x0;var _0x4efd1c=_0x1bf8[_0x2fe21a];return _0x4efd1c;};'use strict';var _=require(_0x81bf('0x0'));var util=require(_0x81bf('0x1'));var logger=require(_0x81bf('0x2'))(_0x81bf('0x3'));var moment=require(_0x81bf('0x4'));var BPromise=require(_0x81bf('0x5'));var rp=require(_0x81bf('0x6'));var fs=require('fs');var path=require(_0x81bf('0x7'));var rimraf=require('rimraf');var config=require(_0x81bf('0x8'));var attributes=require(_0x81bf('0x9'));module[_0x81bf('0xa')]=function(_0x4a3e3d,_0x5e1ee3){return _0x4a3e3d[_0x81bf('0xb')](_0x81bf('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x81bf('0xd'),_0x81bf('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdc91=['api','moment','request-promise','path','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event','lodash','util','../../config/logger'];(function(_0x53594d,_0xb372ae){var _0x3b2544=function(_0x33359f){while(--_0x33359f){_0x53594d['push'](_0x53594d['shift']());}};_0x3b2544(++_0xb372ae);}(_0xdc91,0x183));var _0x1dc9=function(_0x2ead66,_0x134456){_0x2ead66=_0x2ead66-0x0;var _0x6321e4=_0xdc91[_0x2ead66];return _0x6321e4;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require(_0x1dc9('0x2'))(_0x1dc9('0x3'));var moment=require(_0x1dc9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dc9('0x5'));var fs=require('fs');var path=require(_0x1dc9('0x6'));var rimraf=require(_0x1dc9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1dc9('0x8'));module['exports']=function(_0x167133,_0x1a596b){return _0x167133[_0x1dc9('0x9')](_0x1dc9('0xa'),attributes,{'tableName':_0x1dc9('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x1dc9('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 54205fe..137d6c7 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 _0xdb1a=['error','code','message','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x1a3a9c,_0x4d1ad7){var _0xe1dd66=function(_0x1f1940){while(--_0x1f1940){_0x1a3a9c['push'](_0x1a3a9c['shift']());}};_0xe1dd66(++_0x4d1ad7);}(_0xdb1a,0x1bc));var _0xadb1=function(_0x5c69e1,_0x51d535){_0x5c69e1=_0x5c69e1-0x0;var _0x42059e=_0xdb1a[_0x5c69e1];return _0x42059e;};'use strict';var _=require('lodash');var util=require(_0xadb1('0x0'));var moment=require(_0xadb1('0x1'));var BPromise=require(_0xadb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xadb1('0x4'));var logger=require(_0xadb1('0x5'))(_0xadb1('0x6'));var config=require(_0xadb1('0x7'));var jayson=require(_0xadb1('0x8'));var client=jayson[_0xadb1('0x9')][_0xadb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359a08,_0x4f8172,_0x61f591){return new BPromise(function(_0x41b157,_0x5aa649){return client[_0xadb1('0xb')](_0x359a08,_0x61f591)[_0xadb1('0xc')](function(_0x30882e){logger[_0xadb1('0xd')](_0xadb1('0xe'),_0x4f8172,_0xadb1('0xf'));logger[_0xadb1('0x10')](_0xadb1('0x11'),_0x4f8172,_0xadb1('0xf'),JSON['stringify'](_0x30882e));if(_0x30882e[_0xadb1('0x12')]){if(_0x30882e[_0xadb1('0x12')][_0xadb1('0x13')]===0x1f4){logger['error'](_0xadb1('0xe'),_0x4f8172,_0x30882e[_0xadb1('0x12')][_0xadb1('0x14')]);return _0x5aa649(_0x30882e[_0xadb1('0x12')][_0xadb1('0x14')]);}logger['error'](_0xadb1('0xe'),_0x4f8172,_0x30882e[_0xadb1('0x12')][_0xadb1('0x14')]);return _0x41b157(_0x30882e[_0xadb1('0x12')]['message']);}else{logger[_0xadb1('0xd')](_0xadb1('0xe'),_0x4f8172,_0xadb1('0xf'));_0x41b157(_0x30882e['result'][_0xadb1('0x14')]);}})['catch'](function(_0x38905b){logger['error'](_0xadb1('0xe'),_0x4f8172,_0x38905b);_0x5aa649(_0x38905b);});});} \ No newline at end of file +var _0x8728=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x26369b,_0x13ecb8){var _0x67a398=function(_0x324bc7){while(--_0x324bc7){_0x26369b['push'](_0x26369b['shift']());}};_0x67a398(++_0x13ecb8);}(_0x8728,0x14a));var _0x8872=function(_0x498cbf,_0x2d9099){_0x498cbf=_0x498cbf-0x0;var _0x204c21=_0x8728[_0x498cbf];return _0x204c21;};'use strict';var _=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var moment=require('moment');var BPromise=require(_0x8872('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8872('0x3'));var db=require(_0x8872('0x4'))['db'];var utils=require(_0x8872('0x5'));var logger=require(_0x8872('0x6'))(_0x8872('0x7'));var config=require(_0x8872('0x8'));var jayson=require(_0x8872('0x9'));var client=jayson[_0x8872('0xa')][_0x8872('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb24383,_0x4d421a,_0x44c113){return new BPromise(function(_0x20bc33,_0x4068c1){return client['request'](_0xb24383,_0x44c113)[_0x8872('0xc')](function(_0x246e75){logger[_0x8872('0xd')](_0x8872('0xe'),_0x4d421a,_0x8872('0xf'));logger[_0x8872('0x10')](_0x8872('0x11'),_0x4d421a,_0x8872('0xf'),JSON['stringify'](_0x246e75));if(_0x246e75[_0x8872('0x12')]){if(_0x246e75[_0x8872('0x12')][_0x8872('0x13')]===0x1f4){logger[_0x8872('0x12')](_0x8872('0xe'),_0x4d421a,_0x246e75['error'][_0x8872('0x14')]);return _0x4068c1(_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);}logger[_0x8872('0x12')](_0x8872('0xe'),_0x4d421a,_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);return _0x20bc33(_0x246e75[_0x8872('0x12')][_0x8872('0x14')]);}else{logger[_0x8872('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d421a,'request\x20sent');_0x20bc33(_0x246e75[_0x8872('0x15')]['message']);}})[_0x8872('0x16')](function(_0x3dffab){logger['error'](_0x8872('0xe'),_0x4d421a,_0x3dffab);_0x4068c1(_0x3dffab);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index cd08b0d..476faa6 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 _0x5e9f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','util','Router'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5e9f,0xd6));var _0xf5e9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5e9f[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xf5e9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf5e9('0x1')]();var fs_extra=require(_0xf5e9('0x2'));var auth=require(_0xf5e9('0x3'));var interaction=require(_0xf5e9('0x4'));var config=require(_0xf5e9('0x5'));var controller=require(_0xf5e9('0x6'));router[_0xf5e9('0x7')]('/',auth[_0xf5e9('0x8')](),controller[_0xf5e9('0x9')]);router[_0xf5e9('0x7')]('/describe',auth[_0xf5e9('0x8')](),controller[_0xf5e9('0xa')]);router[_0xf5e9('0x7')](_0xf5e9('0xb'),auth[_0xf5e9('0x8')](),controller[_0xf5e9('0xc')]);router[_0xf5e9('0x7')](_0xf5e9('0xd'),auth[_0xf5e9('0x8')](),controller[_0xf5e9('0xe')]);router['get']('/:id/downloads',controller['downloads']);router[_0xf5e9('0x7')](_0xf5e9('0xf'),auth['isAuthenticated'](),controller[_0xf5e9('0x10')]);router[_0xf5e9('0x11')]('/',auth[_0xf5e9('0x8')](),controller[_0xf5e9('0x12')]);router[_0xf5e9('0x11')](_0xf5e9('0xf'),auth[_0xf5e9('0x8')](),controller[_0xf5e9('0x13')]);router[_0xf5e9('0x14')]('/:id',auth[_0xf5e9('0x8')](),controller[_0xf5e9('0x15')]);router['delete'](_0xf5e9('0xb'),auth[_0xf5e9('0x8')](),controller[_0xf5e9('0x16')]);module[_0xf5e9('0x17')]=router; \ No newline at end of file +var _0xb2e1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','/:id/transcribe','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x3ceac1,_0x15d3d9){var _0x14cc22=function(_0x31e403){while(--_0x31e403){_0x3ceac1['push'](_0x3ceac1['shift']());}};_0x14cc22(++_0x15d3d9);}(_0xb2e1,0x1bd));var _0x1b2e=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0xb2e1[_0x122415];return _0x3ac79d;};'use strict';var multer=require(_0x1b2e('0x0'));var util=require('util');var path=require(_0x1b2e('0x1'));var timeout=require(_0x1b2e('0x2'));var express=require(_0x1b2e('0x3'));var router=express[_0x1b2e('0x4')]();var fs_extra=require(_0x1b2e('0x5'));var auth=require(_0x1b2e('0x6'));var interaction=require(_0x1b2e('0x7'));var config=require(_0x1b2e('0x8'));var controller=require(_0x1b2e('0x9'));router[_0x1b2e('0xa')]('/',auth[_0x1b2e('0xb')](),controller[_0x1b2e('0xc')]);router[_0x1b2e('0xa')](_0x1b2e('0xd'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0xe')]);router[_0x1b2e('0xa')](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x10')]);router['get'](_0x1b2e('0x11'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x12')]);router[_0x1b2e('0xa')](_0x1b2e('0x13'),controller[_0x1b2e('0x14')]);router[_0x1b2e('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x1b2e('0x15')]);router[_0x1b2e('0x16')]('/',auth[_0x1b2e('0xb')](),controller['create']);router[_0x1b2e('0x16')](_0x1b2e('0x17'),auth[_0x1b2e('0xb')](),controller['runTranscribe']);router[_0x1b2e('0x18')](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x19')]);router['delete'](_0x1b2e('0xf'),auth[_0x1b2e('0xb')](),controller[_0x1b2e('0x1a')]);module[_0x1b2e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 67f313e..1c596d5 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(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 51cdae2..386d20c 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 _0xf037=['filter','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','end','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0xf037,0xf5));var _0x7f03=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0xf037[_0x326d35];return _0xd3f8f3;};'use strict';var emlformat=require(_0x7f03('0x0'));var rimraf=require(_0x7f03('0x1'));var zipdir=require(_0x7f03('0x2'));var jsonpatch=require(_0x7f03('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f03('0x4'));var Mustache=require(_0x7f03('0x5'));var util=require(_0x7f03('0x6'));var path=require('path');var sox=require(_0x7f03('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f03('0x8'));var _=require(_0x7f03('0x9'));var squel=require(_0x7f03('0xa'));var crypto=require(_0x7f03('0xb'));var jsforce=require(_0x7f03('0xc'));var deskjs=require(_0x7f03('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f03('0xe'));var AWS=require(_0x7f03('0xf'));var uuidv4=require(_0x7f03('0x10'));var Redis=require(_0x7f03('0x11'));var authService=require(_0x7f03('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f03('0x13'))(_0x7f03('0x14'));var utils=require(_0x7f03('0x15'));var config=require(_0x7f03('0x16'));var licenseUtil=require(_0x7f03('0x17'));var db=require(_0x7f03('0x18'))['db'];function respondWithStatusCode(_0x13d368,_0x8fe8cb){_0x8fe8cb=_0x8fe8cb||0xcc;return function(_0x4a5f8d){if(_0x4a5f8d){return _0x13d368[_0x7f03('0x19')](_0x8fe8cb);}return _0x13d368[_0x7f03('0x1a')](_0x8fe8cb)['end']();};}function respondWithResult(_0x4ec715,_0x9909a2){_0x9909a2=_0x9909a2||0xc8;return function(_0x5bde62){if(_0x5bde62){return _0x4ec715[_0x7f03('0x1a')](_0x9909a2)[_0x7f03('0x1b')](_0x5bde62);}};}function respondWithFilteredResult(_0x562b38,_0x5a6c3e){return function(_0x3c0e8f){if(_0x3c0e8f){var _0x2bbbbe=typeof _0x5a6c3e[_0x7f03('0x1c')]==='undefined'&&typeof _0x5a6c3e[_0x7f03('0x1d')]===_0x7f03('0x1e');var _0x31a7b3=_0x3c0e8f[_0x7f03('0x1f')];var _0x3ac18f=_0x2bbbbe?0x0:_0x5a6c3e['offset'];var _0x4855b0=_0x2bbbbe?_0x3c0e8f[_0x7f03('0x1f')]:_0x5a6c3e[_0x7f03('0x1c')]+_0x5a6c3e[_0x7f03('0x1d')];var _0x1fc4a4;if(_0x4855b0>=_0x31a7b3){_0x4855b0=_0x31a7b3;_0x1fc4a4=0xc8;}else{_0x1fc4a4=0xce;}_0x562b38[_0x7f03('0x1a')](_0x1fc4a4);return _0x562b38[_0x7f03('0x20')]('Content-Range',_0x3ac18f+'-'+_0x4855b0+'/'+_0x31a7b3)[_0x7f03('0x1b')](_0x3c0e8f);}return null;};}function patchUpdates(_0x3f9f7e){return function(_0x4efd47){try{jsonpatch['apply'](_0x4efd47,_0x3f9f7e,!![]);}catch(_0x3fb6f6){return BPromise[_0x7f03('0x21')](_0x3fb6f6);}return _0x4efd47[_0x7f03('0x22')]();};}function saveUpdates(_0x59a959,_0x3300bc){return function(_0x31c2a0){if(_0x31c2a0){return _0x31c2a0[_0x7f03('0x23')](_0x59a959)[_0x7f03('0x24')](function(_0x30f1c0){return _0x30f1c0;});}return null;};}function removeEntity(_0xc4956b,_0x536fc2){return function(_0x32c6df){if(_0x32c6df){return _0x32c6df[_0x7f03('0x25')]()['then'](function(){_0xc4956b[_0x7f03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee330,_0x2ca809){return function(_0x24e10d){if(!_0x24e10d){_0x2ee330[_0x7f03('0x19')](0x194);}return _0x24e10d;};}function handleError(_0x6c8629,_0x5a48f4){_0x5a48f4=_0x5a48f4||0x1f4;return function(_0x2e7d2e){logger[_0x7f03('0x26')](_0x2e7d2e[_0x7f03('0x27')]);if(_0x2e7d2e[_0x7f03('0x28')]){delete _0x2e7d2e[_0x7f03('0x28')];}_0x6c8629['status'](_0x5a48f4)[_0x7f03('0x29')](_0x2e7d2e);};}exports[_0x7f03('0x2a')]=function(_0x126620,_0x3e13ac){var _0x4b043d={},_0x1309d7={},_0x5f0f3b={'count':0x0,'rows':[]};var _0x1868ad=_[_0x7f03('0x2b')](db[_0x7f03('0x2c')][_0x7f03('0x2d')],function(_0x206f0b){return{'name':_0x206f0b[_0x7f03('0x2e')],'type':_0x206f0b[_0x7f03('0x2f')][_0x7f03('0x30')]};});_0x1309d7[_0x7f03('0x31')]=_['differenceBy'](_[_0x7f03('0x2b')](_0x1868ad,_0x7f03('0x28')),[_0x7f03('0x32')]);_0x1309d7[_0x7f03('0x33')]=_[_0x7f03('0x34')](_0x126620[_0x7f03('0x33')]);_0x1309d7[_0x7f03('0x35')]=_[_0x7f03('0x36')](_0x1309d7['model'],_0x1309d7[_0x7f03('0x33')]);_0x4b043d[_0x7f03('0x37')]=_[_0x7f03('0x36')](_0x1309d7[_0x7f03('0x31')],qs['fields'](_0x126620[_0x7f03('0x33')][_0x7f03('0x38')]));_0x4b043d['attributes']=_0x4b043d['attributes'][_0x7f03('0x39')]?_0x4b043d[_0x7f03('0x37')]:_0x1309d7[_0x7f03('0x31')];if(!_0x126620[_0x7f03('0x33')]['hasOwnProperty'](_0x7f03('0x3a'))){_0x4b043d[_0x7f03('0x1d')]=qs['limit'](_0x126620['query'][_0x7f03('0x1d')]);_0x4b043d[_0x7f03('0x1c')]=qs['offset'](_0x126620[_0x7f03('0x33')][_0x7f03('0x1c')]);}_0x4b043d[_0x7f03('0x3b')]=qs[_0x7f03('0x3c')](_0x126620[_0x7f03('0x33')][_0x7f03('0x3c')]);_0x4b043d[_0x7f03('0x3d')]=qs['filters'](_[_0x7f03('0x3e')](_0x126620[_0x7f03('0x33')],_0x1309d7[_0x7f03('0x35')]),_0x1868ad);if(_0x126620[_0x7f03('0x33')][_0x7f03('0x3f')]){_0x4b043d[_0x7f03('0x3d')]=_[_0x7f03('0x40')](_0x4b043d[_0x7f03('0x3d')],{'$or':_[_0x7f03('0x2b')](_0x1868ad,function(_0x294244){if(_0x294244[_0x7f03('0x2f')]!==_0x7f03('0x41')){var _0x5b2030={};_0x5b2030[_0x294244[_0x7f03('0x28')]]={'$like':'%'+_0x126620['query'][_0x7f03('0x3f')]+'%'};return _0x5b2030;}})});}_0x4b043d=_['merge']({},_0x4b043d,_0x126620['options']);var _0x176593={'where':_0x4b043d[_0x7f03('0x3d')]};return db[_0x7f03('0x2c')]['count'](_0x176593)[_0x7f03('0x24')](function(_0x596b88){_0x5f0f3b[_0x7f03('0x1f')]=_0x596b88;if(_0x126620[_0x7f03('0x33')][_0x7f03('0x42')]){_0x4b043d[_0x7f03('0x43')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4b043d);})['then'](function(_0x256a4f){_0x5f0f3b['rows']=_0x256a4f;return _0x5f0f3b;})[_0x7f03('0x24')](respondWithFilteredResult(_0x3e13ac,_0x4b043d))[_0x7f03('0x44')](handleError(_0x3e13ac,null));};exports[_0x7f03('0x45')]=function(_0x5cf5c9,_0x3ecf13){var _0x521777={'raw':![],'where':{'id':_0x5cf5c9['params']['id']}},_0x2851cc={};_0x2851cc[_0x7f03('0x31')]=_[_0x7f03('0x34')](db['VoiceRecording'][_0x7f03('0x2d')]);_0x2851cc[_0x7f03('0x33')]=_[_0x7f03('0x34')](_0x5cf5c9[_0x7f03('0x33')]);_0x2851cc[_0x7f03('0x35')]=_[_0x7f03('0x36')](_0x2851cc[_0x7f03('0x31')],_0x2851cc[_0x7f03('0x33')]);_0x521777[_0x7f03('0x37')]=_[_0x7f03('0x36')](_0x2851cc['model'],qs[_0x7f03('0x38')](_0x5cf5c9['query'][_0x7f03('0x38')]));_0x521777['attributes']=_0x521777[_0x7f03('0x37')][_0x7f03('0x39')]?_0x521777[_0x7f03('0x37')]:_0x2851cc[_0x7f03('0x31')];if(_0x5cf5c9[_0x7f03('0x33')][_0x7f03('0x42')]){_0x521777[_0x7f03('0x43')]=[{'all':!![]}];}_0x521777=_[_0x7f03('0x40')]({},_0x521777,_0x5cf5c9['options']);return db[_0x7f03('0x2c')][_0x7f03('0x46')](_0x521777)[_0x7f03('0x24')](handleEntityNotFound(_0x3ecf13,null))[_0x7f03('0x24')](respondWithResult(_0x3ecf13,null))[_0x7f03('0x44')](handleError(_0x3ecf13,null));};exports[_0x7f03('0x47')]=function(_0x539852,_0x54d26c){return db[_0x7f03('0x2c')][_0x7f03('0x47')](_0x539852[_0x7f03('0x48')],{})['then'](respondWithResult(_0x54d26c,0xc9))[_0x7f03('0x44')](handleError(_0x54d26c,null));};exports[_0x7f03('0x23')]=function(_0x43eace,_0x355e6f){if(_0x43eace['body']['id']){delete _0x43eace[_0x7f03('0x48')]['id'];}return db[_0x7f03('0x2c')]['find']({'where':{'id':_0x43eace[_0x7f03('0x49')]['id']}})[_0x7f03('0x24')](handleEntityNotFound(_0x355e6f,null))[_0x7f03('0x24')](saveUpdates(_0x43eace[_0x7f03('0x48')],null))[_0x7f03('0x24')](respondWithResult(_0x355e6f,null))[_0x7f03('0x44')](handleError(_0x355e6f,null));};exports[_0x7f03('0x4a')]=function(_0x16b534,_0x514e39){return db[_0x7f03('0x2c')]['describe']()[_0x7f03('0x24')](respondWithResult(_0x514e39,null))[_0x7f03('0x44')](handleError(_0x514e39,null));};exports[_0x7f03('0x4b')]=function(_0x169d15,_0x4adab4,_0xd9e42f){var _0x1b18ff=require(_0x7f03('0x4c'));var _0x5cb4aa=![];var _0x4d846b={};if(_0x169d15['query'][_0x7f03('0x2f')]&&_0x169d15[_0x7f03('0x33')]['type']===_0x7f03('0x4d')){_0x4d846b[_0x7f03('0x4d')]=_0x169d15['params']['id'];}else{_0x4d846b['id']=_0x169d15[_0x7f03('0x49')]['id'];}return db[_0x7f03('0x2c')][_0x7f03('0x46')]({'where':_0x4d846b,'attributes':['id',_0x7f03('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x4adab4,null))[_0x7f03('0x24')](function(_0x2b493e){if(_0x2b493e){var _0x2d0439=_0x2b493e[_0x7f03('0x4e')];var _0x236dd9=util[_0x7f03('0x32')](_0x7f03('0x4f'),_0x2d0439);if(fs[_0x7f03('0x50')](_0x236dd9)){_0x5cb4aa=!![];return _0x1b18ff[_0x7f03('0x51')](_0x236dd9,_0x2d0439,config[_0x7f03('0x52')][_0x7f03('0x53')])[_0x7f03('0x24')](function(){return _0x2b493e;});}return _0x2b493e;}})[_0x7f03('0x24')](function(_0x53bbc2){if(_0x53bbc2){var _0x316a2b=_0x53bbc2[_0x7f03('0x4e')];if(!fs[_0x7f03('0x50')](_0x316a2b)){throw new db[(_0x7f03('0x54'))][(_0x7f03('0x55'))](_0x7f03('0x56'));}if(_0x53bbc2['filename']){return _0x4adab4[_0x7f03('0x4b')](_0x316a2b,_0x53bbc2[_0x7f03('0x57')]+path[_0x7f03('0x58')](_0x316a2b),function(){if(_0x5cb4aa){fs[_0x7f03('0x59')](_0x316a2b);}});}else{return _0x4adab4[_0x7f03('0x4b')](_0x316a2b,function(_0x43897d){if(_0x5cb4aa){fs[_0x7f03('0x59')](_0x316a2b);}});}}})[_0x7f03('0x44')](function(_0x13fbfd){if(_0x13fbfd[_0x7f03('0x5a')]===_0x7f03('0x56')){_0x4adab4[_0x7f03('0x1a')](0x194)[_0x7f03('0x29')](_0x7f03('0x5b'));}else{return handleError(_0x4adab4,null);}});};exports[_0x7f03('0x5c')]=function(_0x507300,_0x397d24,_0x443c6a){var _0x378ec5=require('../../components/encryptor');var _0x2f76e4=![];var _0x2a60fe={'$and':[db[_0x7f03('0x5d')][_0x7f03('0x3d')](db[_0x7f03('0x5d')]['fn'](_0x7f03('0x5e'),db[_0x7f03('0x5d')][_0x7f03('0x5f')]('uniqueid')),_0x507300[_0x7f03('0x33')][_0x7f03('0x60')])]};if(_0x507300[_0x7f03('0x33')][_0x7f03('0x2f')]&&_0x507300[_0x7f03('0x33')][_0x7f03('0x2f')]===_0x7f03('0x4d')){_0x2a60fe['$and']['push']({'uniqueid':_0x507300[_0x7f03('0x49')]['id']});}else{_0x2a60fe[_0x7f03('0x61')][_0x7f03('0x62')]({'id':_0x507300['params']['id']});}return db[_0x7f03('0x2c')]['find']({'where':_0x2a60fe,'attributes':['id',_0x7f03('0x4e')],'raw':!![]})[_0x7f03('0x24')](handleEntityNotFound(_0x397d24,null))[_0x7f03('0x24')](function(_0x6e56b2){if(_0x6e56b2){var _0x48b4d8=util['format'](_0x7f03('0x4f'),_0x6e56b2[_0x7f03('0x4e')]);if(fs[_0x7f03('0x50')](_0x48b4d8)){_0x2f76e4=!![];return _0x378ec5[_0x7f03('0x51')](_0x48b4d8,_0x6e56b2[_0x7f03('0x4e')],config[_0x7f03('0x52')]['recording'])[_0x7f03('0x24')](function(){return _0x6e56b2;});}return _0x6e56b2;}})[_0x7f03('0x24')](function(_0x5108f4){if(_0x5108f4){if(!fs['existsSync'](_0x5108f4['value'])){throw new db[(_0x7f03('0x54'))]['ValidationError'](_0x7f03('0x56'));}if(_0x5108f4[_0x7f03('0x57')]){return _0x397d24[_0x7f03('0x4b')](_0x5108f4[_0x7f03('0x4e')],_0x5108f4[_0x7f03('0x57')]+path[_0x7f03('0x58')](_0x5108f4['value']),function(){if(_0x2f76e4){fs['unlink'](_0x5108f4['value']);}});}else{return _0x397d24[_0x7f03('0x4b')](_0x5108f4[_0x7f03('0x4e')],function(_0x38c5be){if(_0x2f76e4){fs[_0x7f03('0x59')](_0x5108f4['value']);}});}}})[_0x7f03('0x44')](handleError(_0x397d24,null));};exports[_0x7f03('0x25')]=function(_0x488c19,_0x26e576){return db[_0x7f03('0x2c')][_0x7f03('0x46')]({'where':{'id':_0x488c19['params']['id']}})[_0x7f03('0x24')](function(_0xe92e21){if(_[_0x7f03('0x63')](_0xe92e21)){throw new ReferenceError('Entity\x20not\x20found');}return _0xe92e21;})[_0x7f03('0x24')](function(_0x517614){var _0x45eb7c=_0x517614[_0x7f03('0x4e')];logger[_0x7f03('0x64')](_0x7f03('0x65'),_0x45eb7c);if(!_[_0x7f03('0x63')](_0x517614['value'])&&fs[_0x7f03('0x50')](_0x45eb7c)){logger[_0x7f03('0x64')]('File:\x20\x22'+_0x45eb7c+_0x7f03('0x66'));fs['unlinkSync'](_0x45eb7c);}_0x45eb7c=_0x45eb7c+_0x7f03('0x67');if(!_[_0x7f03('0x63')](_0x517614[_0x7f03('0x4e')])&&fs[_0x7f03('0x50')](_0x45eb7c)){logger[_0x7f03('0x64')](_0x7f03('0x68')+_0x45eb7c+_0x7f03('0x66'));fs[_0x7f03('0x69')](_0x45eb7c);}return _0x517614;})[_0x7f03('0x24')](function(_0x1ed9ad){if(!_0x1ed9ad)throw new InternalError();return _0x1ed9ad[_0x7f03('0x25')]();})[_0x7f03('0x24')](function(){_0x26e576[_0x7f03('0x1a')](0xcc)[_0x7f03('0x6a')]();})['catch'](handleError(_0x26e576,null));};function getBucketslist(_0x33619e,_0x17bd0b,_0x5e8ef3){return new Promise(function(_0x1b3e62,_0x4a179a){var _0xfc16e8=new AWS['S3']({'accessKeyId':_0x17bd0b,'secretAccessKey':_0x33619e,'region':_0x5e8ef3});_0xfc16e8['listBuckets']({},function(_0x49d3e0,_0x30c97f){if(_0x49d3e0){return _0x4a179a(_0x49d3e0);}else{return _0x1b3e62(_0x30c97f);}});});}function createBucket(_0x1218ce,_0x2533b7,_0x41715d,_0x45f5c2){return new Promise(function(_0x2f746e,_0x464e1b){var _0x148e74=new AWS['S3']({'accessKeyId':_0x2533b7,'secretAccessKey':_0x1218ce,'region':_0x41715d});_0x148e74[_0x7f03('0x6b')]({'Bucket':_0x45f5c2},function(_0x1bb68e,_0x2d085e){if(_0x1bb68e){return _0x464e1b(_0x1bb68e);}else{return _0x2f746e(_0x2d085e);}});});}function uploadFile(_0x1800a6,_0x290ba4,_0x1adf67,_0x286aea,_0x54dc9c,_0x5efb64){return new Promise(function(_0x3effba,_0x3442de){var _0x101937=new AWS['S3']({'accessKeyId':_0x290ba4,'secretAccessKey':_0x1800a6,'region':_0x1adf67});_0x101937['upload']({'Bucket':_0x286aea,'Key':_0x54dc9c,'Body':_0x5efb64},function(_0x3d4f42,_0x28efa1){if(_0x3d4f42){return _0x3442de(_0x3d4f42);}else{return _0x3effba(_0x28efa1);}});});}function startTranscribe(_0x7c1fcb,_0x3dcf0c,_0x3a5047,_0x42663f,_0x45e4f4,_0x576ca3){return new Promise(function(_0x290052,_0x29c89c){var _0x23bf5f=new AWS[(_0x7f03('0x6c'))]({'accessKeyId':_0x3dcf0c,'secretAccessKey':_0x7c1fcb,'region':_0x3a5047});_0x23bf5f[_0x7f03('0x6d')]({'TranscriptionJobName':_0x42663f,'LanguageCode':_0x45e4f4,'Media':{'MediaFileUri':_0x576ca3}},function(_0x4d21ba,_0x2e2f51){if(_0x4d21ba){return _0x29c89c(_0x4d21ba);}else{return _0x290052(_0x2e2f51);}});});}function transcribe(_0x505de1,_0x2eb5c5,_0x1e1b33,_0x31011b,_0x26ee22,_0x1b9f31,_0x5f0a91){return new Promise(function(_0x32f1a7,_0x20d283){var _0xdd335d={};logger['info'](util['format'](_0x7f03('0x6e'),_0x505de1,_0x26ee22));return uploadFile(_0x2eb5c5,_0x1e1b33,_0x31011b,_0x26ee22,path[_0x7f03('0x6f')](_0x1b9f31),fs[_0x7f03('0x70')](_0x1b9f31))[_0x7f03('0x24')](function(_0x5e6783){logger[_0x7f03('0x64')](util[_0x7f03('0x32')](_0x7f03('0x71'),_0x505de1,_0x26ee22,_0x5e6783['Location']));_0xdd335d[_0x7f03('0x72')]=_0x5e6783['Bucket'];_0xdd335d[_0x7f03('0x73')]=_0x5e6783[_0x7f03('0x74')];logger[_0x7f03('0x64')](util['format'](_0x7f03('0x75'),_0x505de1));return startTranscribe(_0x2eb5c5,_0x1e1b33,_0x31011b,uuidv4(),_0x5f0a91,_0x5e6783[_0x7f03('0x74')]);})[_0x7f03('0x24')](function(_0x4660e2){logger[_0x7f03('0x64')](util[_0x7f03('0x32')](_0x7f03('0x76'),_0x505de1,_0x4660e2[_0x7f03('0x77')]['TranscriptionJobName']));_0xdd335d[_0x7f03('0x78')]=_0x4660e2[_0x7f03('0x77')]['TranscriptionJobName'];_0xdd335d[_0x7f03('0x79')]=_0x4660e2[_0x7f03('0x77')][_0x7f03('0x7a')];return _0x32f1a7(_0xdd335d);})['catch'](function(_0x4d58a6){return _0x20d283(_0x4d58a6);});});}exports[_0x7f03('0x7b')]=function(_0x20b717,_0x51b6f1,_0x5dd1fe){var _0x295b43;var _0x5247f5;var _0x1009a9;var _0x595dac=require(_0x7f03('0x4c'));return db[_0x7f03('0x2c')][_0x7f03('0x7c')]({'where':{'id':_0x20b717[_0x7f03('0x49')]['id']}})['then'](function(_0x57d1c5){if(_0x57d1c5){var _0x1d9f3c=util[_0x7f03('0x32')](_0x7f03('0x4f'),_0x57d1c5['value']);if(fs[_0x7f03('0x50')](_0x1d9f3c)){cypher=!![];return _0x595dac[_0x7f03('0x51')](_0x1d9f3c,_0x57d1c5[_0x7f03('0x4e')],config[_0x7f03('0x52')][_0x7f03('0x53')])['then'](function(){return _0x57d1c5;});}return _0x57d1c5;}})[_0x7f03('0x24')](function(_0x1e5dd2){if(!_0x1e5dd2){throw new db[(_0x7f03('0x54'))][(_0x7f03('0x55'))](_0x7f03('0x7d'));}_0x5247f5=_0x1e5dd2;return db[_0x7f03('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x7f03('0x24')](handleEntityNotFound(_0x51b6f1,null))['then'](function(_0x555ef0){if(_0x555ef0){_0x295b43=_0x555ef0;if(!_0x295b43[_0x7f03('0x7f')]||!_0x295b43[_0x7f03('0x80')]||!_0x295b43[_0x7f03('0x81')]||!_0x295b43[_0x7f03('0x82')]||!_0x295b43[_0x7f03('0x72')]){throw new db[(_0x7f03('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x20b717['body'][_0x7f03('0x83')]&&(!_0x295b43[_0x7f03('0x84')]||!_0x295b43[_0x7f03('0x85')]||!_0x295b43['sentimentRegion']||!_0x295b43[_0x7f03('0x82')]||!_0x295b43[_0x7f03('0x72')])){throw new db[(_0x7f03('0x54'))][(_0x7f03('0x55'))](_0x7f03('0x86'));}return db[_0x7f03('0x87')][_0x7f03('0x7c')]({'where':{'id':_0x295b43['transcribeAccountId']}});}})['then'](function(_0xef77dd){if(!_0xef77dd){throw new db['Sequelize'][(_0x7f03('0x55'))](_0x7f03('0x88'));}if(!_0xef77dd[_0x7f03('0x89')]||!_0xef77dd[_0x7f03('0x8a')]){throw new db['Sequelize'][(_0x7f03('0x55'))](_0x7f03('0x8b'));}_0x1009a9=_0xef77dd;return getBucketslist(_0x1009a9[_0x7f03('0x89')],_0x1009a9[_0x7f03('0x8a')],_0x295b43['transcribeRegion']);})[_0x7f03('0x24')](function(_0x5d637f){if(_0x5d637f&&_0x5d637f[_0x7f03('0x8c')]){var _0x4d40c5=_[_0x7f03('0x46')](_0x5d637f[_0x7f03('0x8c')],function(_0x5ee12e){return _0x5ee12e[_0x7f03('0x8d')]===_0x295b43[_0x7f03('0x72')];});if(!_0x4d40c5){logger[_0x7f03('0x64')](util[_0x7f03('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x20b717[_0x7f03('0x49')]['id'],_0x295b43[_0x7f03('0x72')]));return createBucket(_0x1009a9[_0x7f03('0x89')],_0x1009a9[_0x7f03('0x8a')],_0x295b43['transcribeRegion'],_0x295b43[_0x7f03('0x72')]);}logger[_0x7f03('0x64')](util[_0x7f03('0x32')](_0x7f03('0x8e'),_0x20b717['params']['id'],_0x295b43['bucket']));return;}})[_0x7f03('0x24')](function(_0x3666e7){if(_0x5247f5[_0x7f03('0x79')]===_0x7f03('0x8f')){return transcribe(_0x20b717[_0x7f03('0x49')]['id'],_0x1009a9['data1'],_0x1009a9[_0x7f03('0x8a')],_0x295b43[_0x7f03('0x81')],_0x295b43['bucket'],_0x5247f5[_0x7f03('0x4e')],_0x295b43['language']);}else{logger[_0x7f03('0x64')](util['format'](_0x7f03('0x90'),_0x20b717['params']['id']));return{'transcribeStatus':_0x7f03('0x91')};}})[_0x7f03('0x24')](function(_0x57ef5b){if(_0x57ef5b){_0x57ef5b[_0x7f03('0x92')]=_0x20b717['body'][_0x7f03('0x83')];return _0x5247f5[_0x7f03('0x93')](_0x57ef5b);}})[_0x7f03('0x24')](respondWithResult(_0x51b6f1,null))['catch'](handleError(_0x51b6f1,null));};function writeFile(_0x562476,_0x37b4c9){return new Promise(function(_0xf1758c,_0x39a39d){fs[_0x7f03('0x94')](_0x37b4c9,_0x562476,function(_0x4154c7,_0x239e83){if(_0x4154c7){return _0x39a39d(_0x4154c7);}else{return _0xf1758c(_0x239e83);}});});}exports[_0x7f03('0x95')]=function(_0x50ac31,_0x3b1a24,_0x321c89){return db[_0x7f03('0x2c')][_0x7f03('0x7c')]({'where':{'id':_0x50ac31['params']['id']}})[_0x7f03('0x24')](handleEntityNotFound(_0x3b1a24))['then'](function(_0x7dd0ae){if(_0x7dd0ae&&_0x7dd0ae[_0x7f03('0x96')]){var _0x20519d=_0x7dd0ae[_0x7f03('0x96')];var _0x526c9f=config[_0x7f03('0x97')]+_0x7f03('0x98')+_0x7dd0ae['id']+_0x7f03('0x99');if(fs[_0x7f03('0x50')](_0x526c9f)){return _0x526c9f;}return writeFile(_0x20519d,_0x526c9f)[_0x7f03('0x24')](function(){return _0x526c9f;});}else{throw new db[(_0x7f03('0x54'))][(_0x7f03('0x55'))]('Transcript\x20not\x20available');}})[_0x7f03('0x24')](function(_0x36362f){return _0x3b1a24['download'](_0x36362f);})[_0x7f03('0x44')](handleError(_0x3b1a24));}; \ No newline at end of file +var _0xee38=['find','params','describe','download','../../components/encryptor','type','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','MD5','sequelize','col','uniqueid','token','$and','push','recording','Sequelize','destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','index','map','rawAttributes','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','keys','create','body','update'];(function(_0x40efe3,_0x51bf95){var _0x47c613=function(_0x1a9fec){while(--_0x1a9fec){_0x40efe3['push'](_0x40efe3['shift']());}};_0x47c613(++_0x51bf95);}(_0xee38,0xef));var _0x8ee3=function(_0x5bc37b,_0xc5e3fc){_0x5bc37b=_0x5bc37b-0x0;var _0x19e63e=_0xee38[_0x5bc37b];return _0x19e63e;};'use strict';var emlformat=require(_0x8ee3('0x0'));var rimraf=require(_0x8ee3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ee3('0x2'));var rp=require(_0x8ee3('0x3'));var moment=require(_0x8ee3('0x4'));var BPromise=require(_0x8ee3('0x5'));var Mustache=require(_0x8ee3('0x6'));var util=require(_0x8ee3('0x7'));var path=require(_0x8ee3('0x8'));var sox=require(_0x8ee3('0x9'));var csv=require('to-csv');var ejs=require(_0x8ee3('0xa'));var fs=require('fs');var fs_extra=require(_0x8ee3('0xb'));var _=require(_0x8ee3('0xc'));var squel=require(_0x8ee3('0xd'));var crypto=require(_0x8ee3('0xe'));var jsforce=require(_0x8ee3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ee3('0x10'));var Papa=require(_0x8ee3('0x11'));var AWS=require(_0x8ee3('0x12'));var uuidv4=require(_0x8ee3('0x13'));var Redis=require('ioredis');var authService=require(_0x8ee3('0x14'));var qs=require(_0x8ee3('0x15'));var as=require(_0x8ee3('0x16'));var hardwareService=require(_0x8ee3('0x17'));var logger=require(_0x8ee3('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x8ee3('0x19'));var licenseUtil=require(_0x8ee3('0x1a'));var db=require(_0x8ee3('0x1b'))['db'];function respondWithStatusCode(_0x227e7b,_0x3020e2){_0x3020e2=_0x3020e2||0xcc;return function(_0x1485de){if(_0x1485de){return _0x227e7b[_0x8ee3('0x1c')](_0x3020e2);}return _0x227e7b[_0x8ee3('0x1d')](_0x3020e2)[_0x8ee3('0x1e')]();};}function respondWithResult(_0x2f6a79,_0x3a6528){_0x3a6528=_0x3a6528||0xc8;return function(_0x3124a6){if(_0x3124a6){return _0x2f6a79[_0x8ee3('0x1d')](_0x3a6528)[_0x8ee3('0x1f')](_0x3124a6);}};}function respondWithFilteredResult(_0x281366,_0xe56161){return function(_0x596f6b){if(_0x596f6b){var _0x570d2e=typeof _0xe56161[_0x8ee3('0x20')]===_0x8ee3('0x21')&&typeof _0xe56161[_0x8ee3('0x22')]===_0x8ee3('0x21');var _0x51cc22=_0x596f6b[_0x8ee3('0x23')];var _0x2df956=_0x570d2e?0x0:_0xe56161['offset'];var _0x5964e0=_0x570d2e?_0x596f6b[_0x8ee3('0x23')]:_0xe56161[_0x8ee3('0x20')]+_0xe56161[_0x8ee3('0x22')];var _0x2b3126;if(_0x5964e0>=_0x51cc22){_0x5964e0=_0x51cc22;_0x2b3126=0xc8;}else{_0x2b3126=0xce;}_0x281366[_0x8ee3('0x1d')](_0x2b3126);return _0x281366[_0x8ee3('0x24')](_0x8ee3('0x25'),_0x2df956+'-'+_0x5964e0+'/'+_0x51cc22)[_0x8ee3('0x1f')](_0x596f6b);}return null;};}function patchUpdates(_0x231c92){return function(_0x53126f){try{jsonpatch[_0x8ee3('0x26')](_0x53126f,_0x231c92,!![]);}catch(_0x3abb57){return BPromise['reject'](_0x3abb57);}return _0x53126f[_0x8ee3('0x27')]();};}function saveUpdates(_0x1968cc,_0x203d26){return function(_0x2eed9d){if(_0x2eed9d){return _0x2eed9d['update'](_0x1968cc)[_0x8ee3('0x28')](function(_0x41efe7){return _0x41efe7;});}return null;};}function removeEntity(_0x31d696,_0x2f62fa){return function(_0x185e68){if(_0x185e68){return _0x185e68['destroy']()[_0x8ee3('0x28')](function(){_0x31d696[_0x8ee3('0x1d')](0xcc)[_0x8ee3('0x1e')]();});}};}function handleEntityNotFound(_0xfbe43e,_0x5dc526){return function(_0x2094e7){if(!_0x2094e7){_0xfbe43e[_0x8ee3('0x1c')](0x194);}return _0x2094e7;};}function handleError(_0x17f524,_0x51b1e2){_0x51b1e2=_0x51b1e2||0x1f4;return function(_0x14e509){logger[_0x8ee3('0x29')](_0x14e509[_0x8ee3('0x2a')]);if(_0x14e509[_0x8ee3('0x2b')]){delete _0x14e509[_0x8ee3('0x2b')];}_0x17f524[_0x8ee3('0x1d')](_0x51b1e2)['send'](_0x14e509);};}exports[_0x8ee3('0x2c')]=function(_0xf6ac8c,_0x2ae76d){var _0x28c80e={},_0x412878={},_0x4c593c={'count':0x0,'rows':[]};var _0x54d469=_[_0x8ee3('0x2d')](db['VoiceRecording'][_0x8ee3('0x2e')],function(_0x244c2c){return{'name':_0x244c2c['fieldName'],'type':_0x244c2c['type']['key']};});_0x412878[_0x8ee3('0x2f')]=_[_0x8ee3('0x30')](_[_0x8ee3('0x2d')](_0x54d469,_0x8ee3('0x2b')),[_0x8ee3('0x31')]);_0x412878[_0x8ee3('0x32')]=_['keys'](_0xf6ac8c[_0x8ee3('0x32')]);_0x412878[_0x8ee3('0x33')]=_[_0x8ee3('0x34')](_0x412878[_0x8ee3('0x2f')],_0x412878[_0x8ee3('0x32')]);_0x28c80e['attributes']=_[_0x8ee3('0x34')](_0x412878[_0x8ee3('0x2f')],qs['fields'](_0xf6ac8c['query'][_0x8ee3('0x35')]));_0x28c80e[_0x8ee3('0x36')]=_0x28c80e[_0x8ee3('0x36')][_0x8ee3('0x37')]?_0x28c80e['attributes']:_0x412878['model'];if(!_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x38')](_0x8ee3('0x39'))){_0x28c80e[_0x8ee3('0x22')]=qs[_0x8ee3('0x22')](_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x22')]);_0x28c80e[_0x8ee3('0x20')]=qs[_0x8ee3('0x20')](_0xf6ac8c[_0x8ee3('0x32')]['offset']);}_0x28c80e[_0x8ee3('0x3a')]=qs['sort'](_0xf6ac8c[_0x8ee3('0x32')]['sort']);_0x28c80e[_0x8ee3('0x3b')]=qs[_0x8ee3('0x33')](_[_0x8ee3('0x3c')](_0xf6ac8c['query'],_0x412878[_0x8ee3('0x33')]),_0x54d469);if(_0xf6ac8c[_0x8ee3('0x32')]['filter']){_0x28c80e[_0x8ee3('0x3b')]=_[_0x8ee3('0x3d')](_0x28c80e[_0x8ee3('0x3b')],{'$or':_['map'](_0x54d469,function(_0x2c6957){if(_0x2c6957['type']!==_0x8ee3('0x3e')){var _0x31d152={};_0x31d152[_0x2c6957[_0x8ee3('0x2b')]]={'$like':'%'+_0xf6ac8c['query']['filter']+'%'};return _0x31d152;}})});}_0x28c80e=_[_0x8ee3('0x3d')]({},_0x28c80e,_0xf6ac8c[_0x8ee3('0x3f')]);var _0x35b129={'where':_0x28c80e[_0x8ee3('0x3b')]};return db[_0x8ee3('0x40')][_0x8ee3('0x23')](_0x35b129)['then'](function(_0x32a11a){_0x4c593c[_0x8ee3('0x23')]=_0x32a11a;if(_0xf6ac8c[_0x8ee3('0x32')][_0x8ee3('0x41')]){_0x28c80e[_0x8ee3('0x42')]=[{'all':!![]}];}return db[_0x8ee3('0x40')][_0x8ee3('0x43')](_0x28c80e);})[_0x8ee3('0x28')](function(_0x1e0061){_0x4c593c[_0x8ee3('0x44')]=_0x1e0061;return _0x4c593c;})[_0x8ee3('0x28')](respondWithFilteredResult(_0x2ae76d,_0x28c80e))[_0x8ee3('0x45')](handleError(_0x2ae76d,null));};exports[_0x8ee3('0x46')]=function(_0x2b0625,_0x6ccbc1){var _0x619093={'raw':![],'where':{'id':_0x2b0625['params']['id']}},_0x186a6d={};_0x186a6d[_0x8ee3('0x2f')]=_[_0x8ee3('0x47')](db['VoiceRecording'][_0x8ee3('0x2e')]);_0x186a6d['query']=_['keys'](_0x2b0625[_0x8ee3('0x32')]);_0x186a6d['filters']=_['intersection'](_0x186a6d[_0x8ee3('0x2f')],_0x186a6d[_0x8ee3('0x32')]);_0x619093[_0x8ee3('0x36')]=_[_0x8ee3('0x34')](_0x186a6d[_0x8ee3('0x2f')],qs[_0x8ee3('0x35')](_0x2b0625[_0x8ee3('0x32')]['fields']));_0x619093[_0x8ee3('0x36')]=_0x619093[_0x8ee3('0x36')]['length']?_0x619093[_0x8ee3('0x36')]:_0x186a6d[_0x8ee3('0x2f')];if(_0x2b0625[_0x8ee3('0x32')][_0x8ee3('0x41')]){_0x619093[_0x8ee3('0x42')]=[{'all':!![]}];}_0x619093=_[_0x8ee3('0x3d')]({},_0x619093,_0x2b0625[_0x8ee3('0x3f')]);return db[_0x8ee3('0x40')]['find'](_0x619093)['then'](handleEntityNotFound(_0x6ccbc1,null))[_0x8ee3('0x28')](respondWithResult(_0x6ccbc1,null))[_0x8ee3('0x45')](handleError(_0x6ccbc1,null));};exports['create']=function(_0x332346,_0x4ba718){return db[_0x8ee3('0x40')][_0x8ee3('0x48')](_0x332346[_0x8ee3('0x49')],{})['then'](respondWithResult(_0x4ba718,0xc9))[_0x8ee3('0x45')](handleError(_0x4ba718,null));};exports[_0x8ee3('0x4a')]=function(_0x217ad6,_0x3345ef){if(_0x217ad6[_0x8ee3('0x49')]['id']){delete _0x217ad6['body']['id'];}return db[_0x8ee3('0x40')][_0x8ee3('0x4b')]({'where':{'id':_0x217ad6[_0x8ee3('0x4c')]['id']}})[_0x8ee3('0x28')](handleEntityNotFound(_0x3345ef,null))[_0x8ee3('0x28')](saveUpdates(_0x217ad6[_0x8ee3('0x49')],null))[_0x8ee3('0x28')](respondWithResult(_0x3345ef,null))[_0x8ee3('0x45')](handleError(_0x3345ef,null));};exports[_0x8ee3('0x4d')]=function(_0x262dd8,_0x2b1f6b){return db[_0x8ee3('0x40')][_0x8ee3('0x4d')]()['then'](respondWithResult(_0x2b1f6b,null))[_0x8ee3('0x45')](handleError(_0x2b1f6b,null));};exports[_0x8ee3('0x4e')]=function(_0x9294c3,_0x2e8b18,_0xc7d61a){var _0x37d1e7=require(_0x8ee3('0x4f'));var _0x3b8982=![];var _0x59a3ed={};if(_0x9294c3['query'][_0x8ee3('0x50')]&&_0x9294c3[_0x8ee3('0x32')]['type']==='uniqueid'){_0x59a3ed['uniqueid']=_0x9294c3[_0x8ee3('0x4c')]['id'];}else{_0x59a3ed['id']=_0x9294c3[_0x8ee3('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':_0x59a3ed,'attributes':['id',_0x8ee3('0x51')],'raw':!![]})[_0x8ee3('0x28')](handleEntityNotFound(_0x2e8b18,null))[_0x8ee3('0x28')](function(_0x19fb03){if(_0x19fb03){var _0x2a31bf=_0x19fb03['value'];var _0x274bf3=util['format'](_0x8ee3('0x52'),_0x2a31bf);if(fs[_0x8ee3('0x53')](_0x274bf3)){_0x3b8982=!![];return _0x37d1e7[_0x8ee3('0x54')](_0x274bf3,_0x2a31bf,config[_0x8ee3('0x55')]['recording'])[_0x8ee3('0x28')](function(){return _0x19fb03;});}return _0x19fb03;}})['then'](function(_0x4cc601){if(_0x4cc601){var _0x58e75f=_0x4cc601[_0x8ee3('0x51')];if(!fs['existsSync'](_0x58e75f)){throw new db['Sequelize'][(_0x8ee3('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4cc601[_0x8ee3('0x57')]){return _0x2e8b18[_0x8ee3('0x4e')](_0x58e75f,_0x4cc601[_0x8ee3('0x57')]+path[_0x8ee3('0x58')](_0x58e75f),function(){if(_0x3b8982){fs[_0x8ee3('0x59')](_0x58e75f);}});}else{return _0x2e8b18[_0x8ee3('0x4e')](_0x58e75f,function(_0x147ce1){if(_0x3b8982){fs['unlink'](_0x58e75f);}});}}})[_0x8ee3('0x45')](function(_0x290f7a){if(_0x290f7a[_0x8ee3('0x5a')]===_0x8ee3('0x5b')){_0x2e8b18[_0x8ee3('0x1d')](0x194)[_0x8ee3('0x5c')](_0x8ee3('0x5d'));}else{return handleError(_0x2e8b18,null);}});};exports[_0x8ee3('0x5e')]=function(_0x486608,_0xc6c81c,_0x12cb73){var _0x401389=require(_0x8ee3('0x4f'));var _0x254a93=![];var _0x4152da={'$and':[db['sequelize'][_0x8ee3('0x3b')](db['sequelize']['fn'](_0x8ee3('0x5f'),db[_0x8ee3('0x60')][_0x8ee3('0x61')](_0x8ee3('0x62'))),_0x486608[_0x8ee3('0x32')][_0x8ee3('0x63')])]};if(_0x486608[_0x8ee3('0x32')][_0x8ee3('0x50')]&&_0x486608[_0x8ee3('0x32')]['type']==='uniqueid'){_0x4152da[_0x8ee3('0x64')][_0x8ee3('0x65')]({'uniqueid':_0x486608[_0x8ee3('0x4c')]['id']});}else{_0x4152da['$and'][_0x8ee3('0x65')]({'id':_0x486608[_0x8ee3('0x4c')]['id']});}return db[_0x8ee3('0x40')]['find']({'where':_0x4152da,'attributes':['id',_0x8ee3('0x51')],'raw':!![]})[_0x8ee3('0x28')](handleEntityNotFound(_0xc6c81c,null))['then'](function(_0x4e64c6){if(_0x4e64c6){var _0xd0d96b=util[_0x8ee3('0x31')]('%s.cypher',_0x4e64c6[_0x8ee3('0x51')]);if(fs[_0x8ee3('0x53')](_0xd0d96b)){_0x254a93=!![];return _0x401389['decryptFile'](_0xd0d96b,_0x4e64c6[_0x8ee3('0x51')],config[_0x8ee3('0x55')][_0x8ee3('0x66')])[_0x8ee3('0x28')](function(){return _0x4e64c6;});}return _0x4e64c6;}})['then'](function(_0x3bc2ae){if(_0x3bc2ae){if(!fs[_0x8ee3('0x53')](_0x3bc2ae['value'])){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x5b'));}if(_0x3bc2ae[_0x8ee3('0x57')]){return _0xc6c81c['download'](_0x3bc2ae[_0x8ee3('0x51')],_0x3bc2ae[_0x8ee3('0x57')]+path[_0x8ee3('0x58')](_0x3bc2ae[_0x8ee3('0x51')]),function(){if(_0x254a93){fs[_0x8ee3('0x59')](_0x3bc2ae[_0x8ee3('0x51')]);}});}else{return _0xc6c81c[_0x8ee3('0x4e')](_0x3bc2ae[_0x8ee3('0x51')],function(_0x1d95e9){if(_0x254a93){fs[_0x8ee3('0x59')](_0x3bc2ae[_0x8ee3('0x51')]);}});}}})[_0x8ee3('0x45')](handleError(_0xc6c81c,null));};exports[_0x8ee3('0x68')]=function(_0x2c817a,_0x518906){return db[_0x8ee3('0x40')][_0x8ee3('0x4b')]({'where':{'id':_0x2c817a[_0x8ee3('0x4c')]['id']}})['then'](function(_0xf96cd1){if(_[_0x8ee3('0x69')](_0xf96cd1)){throw new ReferenceError(_0x8ee3('0x6a'));}return _0xf96cd1;})[_0x8ee3('0x28')](function(_0x1937df){var _0x4af1d0=_0x1937df[_0x8ee3('0x51')];logger[_0x8ee3('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0x4af1d0);if(!_['isNil'](_0x1937df['value'])&&fs['existsSync'](_0x4af1d0)){logger[_0x8ee3('0x6b')]('File:\x20\x22'+_0x4af1d0+_0x8ee3('0x6c'));fs[_0x8ee3('0x6d')](_0x4af1d0);}_0x4af1d0=_0x4af1d0+_0x8ee3('0x6e');if(!_['isNil'](_0x1937df[_0x8ee3('0x51')])&&fs['existsSync'](_0x4af1d0)){logger[_0x8ee3('0x6b')](_0x8ee3('0x6f')+_0x4af1d0+_0x8ee3('0x6c'));fs[_0x8ee3('0x6d')](_0x4af1d0);}return _0x1937df;})[_0x8ee3('0x28')](function(_0x38bca7){if(!_0x38bca7)throw new InternalError();return _0x38bca7[_0x8ee3('0x68')]();})[_0x8ee3('0x28')](function(){_0x518906[_0x8ee3('0x1d')](0xcc)[_0x8ee3('0x1e')]();})[_0x8ee3('0x45')](handleError(_0x518906,null));};function getBucketslist(_0x5d73c8,_0x41e140,_0x804efd){return new Promise(function(_0x20812e,_0x1ad3de){var _0xe5d036=new AWS['S3']({'accessKeyId':_0x41e140,'secretAccessKey':_0x5d73c8,'region':_0x804efd});_0xe5d036[_0x8ee3('0x70')]({},function(_0x5063c9,_0xd56484){if(_0x5063c9){return _0x1ad3de(_0x5063c9);}else{return _0x20812e(_0xd56484);}});});}function createBucket(_0x4c602b,_0x28f772,_0xab142b,_0x274c9a){return new Promise(function(_0x5329d2,_0x3813b6){var _0x2d0ba2=new AWS['S3']({'accessKeyId':_0x28f772,'secretAccessKey':_0x4c602b,'region':_0xab142b});_0x2d0ba2[_0x8ee3('0x71')]({'Bucket':_0x274c9a},function(_0x581b52,_0x40c075){if(_0x581b52){return _0x3813b6(_0x581b52);}else{return _0x5329d2(_0x40c075);}});});}function uploadFile(_0x4681b5,_0x26b14f,_0x3f48eb,_0x2a559b,_0x1e93b5,_0x55c06b){return new Promise(function(_0x223cd8,_0x3df59d){var _0x24b9f3=new AWS['S3']({'accessKeyId':_0x26b14f,'secretAccessKey':_0x4681b5,'region':_0x3f48eb});_0x24b9f3[_0x8ee3('0x72')]({'Bucket':_0x2a559b,'Key':_0x1e93b5,'Body':_0x55c06b},function(_0x8cf704,_0x3404ca){if(_0x8cf704){return _0x3df59d(_0x8cf704);}else{return _0x223cd8(_0x3404ca);}});});}function startTranscribe(_0x1c9036,_0x5d85cd,_0x3464aa,_0x12e3c7,_0x11c774,_0xe5451c){return new Promise(function(_0x412240,_0x1558c4){var _0x5015bb=new AWS['TranscribeService']({'accessKeyId':_0x5d85cd,'secretAccessKey':_0x1c9036,'region':_0x3464aa});_0x5015bb[_0x8ee3('0x73')]({'TranscriptionJobName':_0x12e3c7,'LanguageCode':_0x11c774,'Media':{'MediaFileUri':_0xe5451c}},function(_0x2cae51,_0x4cef39){if(_0x2cae51){return _0x1558c4(_0x2cae51);}else{return _0x412240(_0x4cef39);}});});}function transcribe(_0x22ac38,_0x52c1cf,_0x1aca84,_0x28c0a4,_0x266f7c,_0x3c119d,_0x2ad548){return new Promise(function(_0x57185a,_0x2d04b8){var _0x5f3df0={};logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x74'),_0x22ac38,_0x266f7c));return uploadFile(_0x52c1cf,_0x1aca84,_0x28c0a4,_0x266f7c,path['basename'](_0x3c119d),fs[_0x8ee3('0x75')](_0x3c119d))[_0x8ee3('0x28')](function(_0xcffcbc){logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x76'),_0x22ac38,_0x266f7c,_0xcffcbc['Location']));_0x5f3df0['bucket']=_0xcffcbc[_0x8ee3('0x77')];_0x5f3df0[_0x8ee3('0x78')]=_0xcffcbc[_0x8ee3('0x79')];logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x22ac38));return startTranscribe(_0x52c1cf,_0x1aca84,_0x28c0a4,uuidv4(),_0x2ad548,_0xcffcbc[_0x8ee3('0x79')]);})[_0x8ee3('0x28')](function(_0x11439d){logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x7a'),_0x22ac38,_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7c')]));_0x5f3df0[_0x8ee3('0x7d')]=_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7c')];_0x5f3df0[_0x8ee3('0x7e')]=_0x11439d[_0x8ee3('0x7b')][_0x8ee3('0x7f')];return _0x57185a(_0x5f3df0);})[_0x8ee3('0x45')](function(_0x2ba52a){return _0x2d04b8(_0x2ba52a);});});}exports[_0x8ee3('0x80')]=function(_0x309348,_0x21ebe4,_0x1014e8){var _0x31abdd;var _0x5d0fbe;var _0x3e44eb;var _0x1bd7d9=require(_0x8ee3('0x4f'));return db[_0x8ee3('0x40')][_0x8ee3('0x81')]({'where':{'id':_0x309348['params']['id']}})['then'](function(_0x4bbcbc){if(_0x4bbcbc){var _0x554cca=util[_0x8ee3('0x31')](_0x8ee3('0x52'),_0x4bbcbc[_0x8ee3('0x51')]);if(fs[_0x8ee3('0x53')](_0x554cca)){cypher=!![];return _0x1bd7d9[_0x8ee3('0x54')](_0x554cca,_0x4bbcbc[_0x8ee3('0x51')],config['secrets'][_0x8ee3('0x66')])[_0x8ee3('0x28')](function(){return _0x4bbcbc;});}return _0x4bbcbc;}})[_0x8ee3('0x28')](function(_0x18cc83){if(!_0x18cc83){throw new db[(_0x8ee3('0x67'))]['ValidationError'](_0x8ee3('0x82'));}_0x5d0fbe=_0x18cc83;return db[_0x8ee3('0x83')]['findOne']({'where':{'id':0x1}});})[_0x8ee3('0x28')](handleEntityNotFound(_0x21ebe4,null))[_0x8ee3('0x28')](function(_0x6e0930){if(_0x6e0930){_0x31abdd=_0x6e0930;if(!_0x31abdd['transcribe']||!_0x31abdd[_0x8ee3('0x84')]||!_0x31abdd[_0x8ee3('0x85')]||!_0x31abdd['language']||!_0x31abdd['bucket']){throw new db['Sequelize'][(_0x8ee3('0x56'))](_0x8ee3('0x86'));}if(_0x309348[_0x8ee3('0x49')][_0x8ee3('0x87')]&&(!_0x31abdd[_0x8ee3('0x88')]||!_0x31abdd['sentimentAccountId']||!_0x31abdd['sentimentRegion']||!_0x31abdd[_0x8ee3('0x89')]||!_0x31abdd['bucket'])){throw new db['Sequelize'][(_0x8ee3('0x56'))](_0x8ee3('0x8a'));}return db[_0x8ee3('0x8b')][_0x8ee3('0x81')]({'where':{'id':_0x31abdd[_0x8ee3('0x84')]}});}})[_0x8ee3('0x28')](function(_0x65fcc4){if(!_0x65fcc4){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x8c'));}if(!_0x65fcc4[_0x8ee3('0x8d')]||!_0x65fcc4[_0x8ee3('0x8e')]){throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x8f'));}_0x3e44eb=_0x65fcc4;return getBucketslist(_0x3e44eb['data1'],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')]);})['then'](function(_0x5622db){if(_0x5622db&&_0x5622db['Buckets']){var _0x2e99e6=_[_0x8ee3('0x4b')](_0x5622db[_0x8ee3('0x90')],function(_0x22a84c){return _0x22a84c['Name']===_0x31abdd[_0x8ee3('0x91')];});if(!_0x2e99e6){logger['info'](util[_0x8ee3('0x31')](_0x8ee3('0x92'),_0x309348[_0x8ee3('0x4c')]['id'],_0x31abdd['bucket']));return createBucket(_0x3e44eb[_0x8ee3('0x8d')],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')],_0x31abdd[_0x8ee3('0x91')]);}logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x93'),_0x309348['params']['id'],_0x31abdd['bucket']));return;}})[_0x8ee3('0x28')](function(_0x5c8914){if(_0x5d0fbe['transcribeStatus']===_0x8ee3('0x94')){return transcribe(_0x309348['params']['id'],_0x3e44eb['data1'],_0x3e44eb[_0x8ee3('0x8e')],_0x31abdd[_0x8ee3('0x85')],_0x31abdd[_0x8ee3('0x91')],_0x5d0fbe['value'],_0x31abdd[_0x8ee3('0x89')]);}else{logger[_0x8ee3('0x6b')](util[_0x8ee3('0x31')](_0x8ee3('0x95'),_0x309348[_0x8ee3('0x4c')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x13b0e0){if(_0x13b0e0){_0x13b0e0['tempSentiment']=_0x309348['body'][_0x8ee3('0x87')];return _0x5d0fbe['updateAttributes'](_0x13b0e0);}})[_0x8ee3('0x28')](respondWithResult(_0x21ebe4,null))[_0x8ee3('0x45')](handleError(_0x21ebe4,null));};function writeFile(_0x485c6a,_0x32f62c){return new Promise(function(_0x42da2d,_0x4343e1){fs[_0x8ee3('0x96')](_0x32f62c,_0x485c6a,function(_0x4618b4,_0x7a6484){if(_0x4618b4){return _0x4343e1(_0x4618b4);}else{return _0x42da2d(_0x7a6484);}});});}exports[_0x8ee3('0x97')]=function(_0x485787,_0x1b0e35,_0x4e1e2f){return db[_0x8ee3('0x40')][_0x8ee3('0x81')]({'where':{'id':_0x485787['params']['id']}})[_0x8ee3('0x28')](handleEntityNotFound(_0x1b0e35))['then'](function(_0x4ea775){if(_0x4ea775&&_0x4ea775['fileText']){var _0x23c28c=_0x4ea775[_0x8ee3('0x98')];var _0x58a834=config[_0x8ee3('0x99')]+_0x8ee3('0x9a')+_0x4ea775['id']+_0x8ee3('0x9b');if(fs[_0x8ee3('0x53')](_0x58a834)){return _0x58a834;}return writeFile(_0x23c28c,_0x58a834)[_0x8ee3('0x28')](function(){return _0x58a834;});}else{throw new db[(_0x8ee3('0x67'))][(_0x8ee3('0x56'))](_0x8ee3('0x9c'));}})[_0x8ee3('0x28')](function(_0x577ec7){return _0x1b0e35[_0x8ee3('0x4e')](_0x577ec7);})[_0x8ee3('0x45')](handleError(_0x1b0e35));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 73ffbea..19edebc 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 _0x32ef=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x32ef,0xf9));var _0xf32e=function(_0x67f47f,_0x5c57d2){_0x67f47f=_0x67f47f-0x0;var _0x1bdcd9=_0x32ef[_0x67f47f];return _0x1bdcd9;};'use strict';var attributes=require(_0xf32e('0x0'));module[_0xf32e('0x1')]=function(_0x1ec4de,_0x2aaadd){return _0x1ec4de[_0xf32e('0x2')](_0xf32e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf32e('0x4'),'fields':[_0xf32e('0x4')]},{'name':'transcribeStatus','fields':[_0xf32e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b75=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0xf06a64,_0x1fc0c7){var _0x1d1206=function(_0x4a481f){while(--_0x4a481f){_0xf06a64['push'](_0xf06a64['shift']());}};_0x1d1206(++_0x1fc0c7);}(_0x3b75,0x144));var _0x53b7=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x3b75[_0x22e9fe];return _0x47cd19;};'use strict';var attributes=require(_0x53b7('0x0'));module[_0x53b7('0x1')]=function(_0x43da7f,_0x9db663){return _0x43da7f[_0x53b7('0x2')](_0x53b7('0x3'),attributes,{'tableName':_0x53b7('0x4'),'paranoid':![],'indexes':[{'name':_0x53b7('0x5'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x53b7('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 e3e7236..060bacd 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 _0xd4a2=['client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','UpdateVoiceRecording','update','body','options','raw','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1c6457,_0x427be6){_0x1c6457=_0x1c6457-0x0;var _0x3573fb=_0xd4a2[_0x1c6457];return _0x3573fb;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});}exports[_0x2d4a('0x13')]=function(_0x2188b2){var _0x388371=this;return new Promise(function(_0x498956,_0x4fd169){return db['VoiceRecording'][_0x2d4a('0x14')](_0x2188b2[_0x2d4a('0x15')],{'raw':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2['options']['where']||null:null,'attributes':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x18')]||null:null,'limit':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x19')]||null:null})[_0x2d4a('0xa')](function(_0xa43fb1){logger['info'](_0x2d4a('0x13'),_0x2188b2);logger[_0x2d4a('0xe')](_0x2d4a('0x13'),_0x2188b2,JSON[_0x2d4a('0x1a')](_0xa43fb1));_0x498956(_0xa43fb1);})[_0x2d4a('0x1b')](function(_0xed2822){logger[_0x2d4a('0x10')](_0x2d4a('0x13'),_0xed2822['message'],_0x2188b2);_0x4fd169(_0x388371['error'](0x1f4,_0xed2822['message']));});});};exports[_0x2d4a('0x1c')]=function(_0x5029f3){var _0x410f7d=this;return new Promise(function(_0x3a2fd3,_0x3d5558){var _0x1d2fa6=require(_0x2d4a('0x1d'));var _0x326c38;return db[_0x2d4a('0x1e')][_0x2d4a('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x2d4a('0xa')](function(_0x5ce262){_0x326c38=_0x5ce262;return db[_0x2d4a('0x20')][_0x2d4a('0x21')](_0x5029f3[_0x2d4a('0x15')]);})[_0x2d4a('0xa')](function(_0x101382){if(_0x326c38[_0x2d4a('0x22')]&&fs[_0x2d4a('0x23')](_0x101382[_0x2d4a('0x24')])){var _0x51b447=util[_0x2d4a('0x25')](_0x2d4a('0x26'),_0x101382[_0x2d4a('0x24')]);return _0x1d2fa6[_0x2d4a('0x27')](_0x101382[_0x2d4a('0x24')],_0x51b447,config['secrets'][_0x2d4a('0x28')])[_0x2d4a('0xa')](function(){fs[_0x2d4a('0x29')](_0x101382[_0x2d4a('0x24')]);logger[_0x2d4a('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x101382;});}return _0x101382;})[_0x2d4a('0xa')](function(_0x2ae694){logger[_0x2d4a('0xb')](_0x2d4a('0x1c'),_0x5029f3);logger[_0x2d4a('0xe')](_0x2d4a('0x1c'),_0x5029f3,JSON['stringify'](_0x2ae694));_0x3a2fd3(_0x2ae694);})[_0x2d4a('0x1b')](function(_0x28955f){logger[_0x2d4a('0x10')](_0x2d4a('0x1c'),_0x28955f[_0x2d4a('0x12')],_0x5029f3);_0x3d5558(_0x410f7d['error'](0x1f4,_0x28955f[_0x2d4a('0x12')]));});});}; \ No newline at end of file +var _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x22b1ec,_0x5cb1be){var _0x48a2b4=function(_0x4607fd){while(--_0x4607fd){_0x22b1ec['push'](_0x22b1ec['shift']());}};_0x48a2b4(++_0x5cb1be);}(_0xdf55,0x83));var _0x5df5=function(_0x2afccc,_0x443a1a){_0x2afccc=_0x2afccc-0x0;var _0x485666=_0xdf55[_0x2afccc];return _0x485666;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 23a0468..68915b2 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 _0x8b76=['get','index','/describe','isAuthenticated','/:id','show','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x31642b,_0x10df2c){var _0x1f68c6=function(_0x252ca1){while(--_0x252ca1){_0x31642b['push'](_0x31642b['shift']());}};_0x1f68c6(++_0x10df2c);}(_0x8b76,0xe6));var _0x68b7=function(_0x289c41,_0x5799b5){_0x289c41=_0x289c41-0x0;var _0x552a38=_0x8b76[_0x289c41];return _0x552a38;};'use strict';var multer=require(_0x68b7('0x0'));var util=require(_0x68b7('0x1'));var path=require('path');var timeout=require(_0x68b7('0x2'));var express=require(_0x68b7('0x3'));var router=express[_0x68b7('0x4')]();var fs_extra=require(_0x68b7('0x5'));var auth=require(_0x68b7('0x6'));var interaction=require(_0x68b7('0x7'));var config=require(_0x68b7('0x8'));var controller=require(_0x68b7('0x9'));router[_0x68b7('0xa')]('/',auth['isAuthenticated'](),controller[_0x68b7('0xb')]);router['get'](_0x68b7('0xc'),auth[_0x68b7('0xd')](),controller['describe']);router[_0x68b7('0xa')](_0x68b7('0xe'),auth[_0x68b7('0xd')](),controller[_0x68b7('0xf')]);router['post']('/',auth[_0x68b7('0xd')](),controller[_0x68b7('0x10')]);router[_0x68b7('0x11')]('/:id',auth[_0x68b7('0xd')](),controller['update']);router[_0x68b7('0x12')](_0x68b7('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x68b7('0x13')]=router; \ No newline at end of file +var _0x1d4a=['put','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x295642,_0x7b4dc5){var _0x3333db=function(_0x3a3377){while(--_0x3a3377){_0x295642['push'](_0x295642['shift']());}};_0x3333db(++_0x7b4dc5);}(_0x1d4a,0x146));var _0xa1d4=function(_0x9aa28b,_0x12180b){_0x9aa28b=_0x9aa28b-0x0;var _0x685b5e=_0x1d4a[_0x9aa28b];return _0x685b5e;};'use strict';var multer=require('multer');var util=require(_0xa1d4('0x0'));var path=require(_0xa1d4('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1d4('0x2'));var router=express[_0xa1d4('0x3')]();var fs_extra=require(_0xa1d4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa1d4('0x5'));var config=require('../../config/environment');var controller=require(_0xa1d4('0x6'));router[_0xa1d4('0x7')]('/',auth[_0xa1d4('0x8')](),controller[_0xa1d4('0x9')]);router['get'](_0xa1d4('0xa'),auth[_0xa1d4('0x8')](),controller[_0xa1d4('0xb')]);router[_0xa1d4('0x7')](_0xa1d4('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa1d4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1d4('0xe')]('/:id',auth[_0xa1d4('0x8')](),controller['update']);router[_0xa1d4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa1d4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b38efd6..7b71d6c 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 _0x4551=['STRING','Yes','moment','exports','ENUM','blind'];(function(_0x1206cd,_0x9e8346){var _0x5a438f=function(_0x2e5276){while(--_0x2e5276){_0x1206cd['push'](_0x1206cd['shift']());}};_0x5a438f(++_0x9e8346);}(_0x4551,0x158));var _0x1455=function(_0x2e3b38,_0x2ee366){_0x2e3b38=_0x2e3b38-0x0;var _0x53a79c=_0x4551[_0x2e3b38];return _0x53a79c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1455('0x0'));module[_0x1455('0x1')]={'type':{'type':Sequelize[_0x1455('0x2')](_0x1455('0x3'),'attended')},'result':{'type':Sequelize[_0x1455('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x1455('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1455('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1455('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1455('0x4')]},'transferercontext':{'type':Sequelize[_0x1455('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1455('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1455('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1455('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1455('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x1455('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1455('0x4')]},'isexternal':{'type':Sequelize[_0x1455('0x2')](_0x1455('0x5'),'No')},'context':{'type':Sequelize[_0x1455('0x4')]},'extension':{'type':Sequelize[_0x1455('0x4')]}}; \ No newline at end of file +var _0x2cdd=['ENUM','blind','STRING','Yes','exports'];(function(_0x5a4036,_0x1a3694){var _0x4bdec0=function(_0x2206a8){while(--_0x2206a8){_0x5a4036['push'](_0x5a4036['shift']());}};_0x4bdec0(++_0x1a3694);}(_0x2cdd,0xa9));var _0xd2cd=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x2cdd[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd2cd('0x0')]={'type':{'type':Sequelize[_0xd2cd('0x1')](_0xd2cd('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xd2cd('0x3')]},'transferercalleridname':{'type':Sequelize[_0xd2cd('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd2cd('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xd2cd('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd2cd('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd2cd('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xd2cd('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xd2cd('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xd2cd('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd2cd('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xd2cd('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xd2cd('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xd2cd('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xd2cd('0x4'),'No')},'context':{'type':Sequelize[_0xd2cd('0x3')]},'extension':{'type':Sequelize[_0xd2cd('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ffc302a..b447d5c 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 _0xf631=['map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','VoiceTransferReport','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','error','stack','name','send','index'];(function(_0x3e03cd,_0x150068){var _0x435745=function(_0x18e6d8){while(--_0x18e6d8){_0x3e03cd['push'](_0x3e03cd['shift']());}};_0x435745(++_0x150068);}(_0xf631,0x1db));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1f63('0x0'));var rimraf=require(_0x1f63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f63('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f63('0x3'));var Mustache=require(_0x1f63('0x4'));var util=require(_0x1f63('0x5'));var path=require(_0x1f63('0x6'));var sox=require(_0x1f63('0x7'));var csv=require(_0x1f63('0x8'));var ejs=require(_0x1f63('0x9'));var fs=require('fs');var fs_extra=require(_0x1f63('0xa'));var _=require('lodash');var squel=require(_0x1f63('0xb'));var crypto=require(_0x1f63('0xc'));var jsforce=require(_0x1f63('0xd'));var deskjs=require(_0x1f63('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f63('0xf'));var Papa=require(_0x1f63('0x10'));var Redis=require('ioredis');var authService=require(_0x1f63('0x11'));var qs=require(_0x1f63('0x12'));var as=require(_0x1f63('0x13'));var hardwareService=require(_0x1f63('0x14'));var logger=require('../../config/logger')(_0x1f63('0x15'));var utils=require('../../config/utils');var config=require(_0x1f63('0x16'));var licenseUtil=require(_0x1f63('0x17'));var db=require(_0x1f63('0x18'))['db'];function respondWithStatusCode(_0xaa4d4b,_0x4612a5){_0x4612a5=_0x4612a5||0xcc;return function(_0x4f90c9){if(_0x4f90c9){return _0xaa4d4b[_0x1f63('0x19')](_0x4612a5);}return _0xaa4d4b['status'](_0x4612a5)[_0x1f63('0x1a')]();};}function respondWithResult(_0x33f6db,_0x40fc5a){_0x40fc5a=_0x40fc5a||0xc8;return function(_0x13e495){if(_0x13e495){return _0x33f6db[_0x1f63('0x1b')](_0x40fc5a)['json'](_0x13e495);}};}function respondWithFilteredResult(_0x24e0ea,_0x315aa0){return function(_0x485c55){if(_0x485c55){var _0x1c5219=typeof _0x315aa0[_0x1f63('0x1c')]===_0x1f63('0x1d')&&typeof _0x315aa0[_0x1f63('0x1e')]===_0x1f63('0x1d');var _0xf1e388=_0x485c55[_0x1f63('0x1f')];var _0x374a14=_0x1c5219?0x0:_0x315aa0[_0x1f63('0x1c')];var _0x555a11=_0x1c5219?_0x485c55[_0x1f63('0x1f')]:_0x315aa0[_0x1f63('0x1c')]+_0x315aa0[_0x1f63('0x1e')];var _0xc1e3de;if(_0x555a11>=_0xf1e388){_0x555a11=_0xf1e388;_0xc1e3de=0xc8;}else{_0xc1e3de=0xce;}_0x24e0ea['status'](_0xc1e3de);return _0x24e0ea['set'](_0x1f63('0x20'),_0x374a14+'-'+_0x555a11+'/'+_0xf1e388)[_0x1f63('0x21')](_0x485c55);}return null;};}function patchUpdates(_0x766432){return function(_0x12d473){try{jsonpatch[_0x1f63('0x22')](_0x12d473,_0x766432,!![]);}catch(_0x1c134b){return BPromise[_0x1f63('0x23')](_0x1c134b);}return _0x12d473['save']();};}function saveUpdates(_0x1d5e5b,_0x5164d5){return function(_0x231b3d){if(_0x231b3d){return _0x231b3d[_0x1f63('0x24')](_0x1d5e5b)[_0x1f63('0x25')](function(_0xf7b6a8){return _0xf7b6a8;});}return null;};}function removeEntity(_0x9136e7,_0xca9008){return function(_0xd33f9d){if(_0xd33f9d){return _0xd33f9d['destroy']()[_0x1f63('0x25')](function(){_0x9136e7[_0x1f63('0x1b')](0xcc)[_0x1f63('0x1a')]();});}};}function handleEntityNotFound(_0xb7985a,_0x21c004){return function(_0x538b46){if(!_0x538b46){_0xb7985a[_0x1f63('0x19')](0x194);}return _0x538b46;};}function handleError(_0x5579f8,_0x385e4c){_0x385e4c=_0x385e4c||0x1f4;return function(_0x410718){logger[_0x1f63('0x26')](_0x410718[_0x1f63('0x27')]);if(_0x410718['name']){delete _0x410718[_0x1f63('0x28')];}_0x5579f8[_0x1f63('0x1b')](_0x385e4c)[_0x1f63('0x29')](_0x410718);};}exports[_0x1f63('0x2a')]=function(_0x5221f1,_0x83e5c6){var _0xfd8e77={},_0x4f57de={},_0x3b8ea9={'count':0x0,'rows':[]};var _0x5087e9=_[_0x1f63('0x2b')](db['VoiceTransferReport'][_0x1f63('0x2c')],function(_0x1a3e50){return{'name':_0x1a3e50['fieldName'],'type':_0x1a3e50['type'][_0x1f63('0x2d')]};});_0x4f57de[_0x1f63('0x2e')]=_[_0x1f63('0x2b')](_0x5087e9,_0x1f63('0x28'));_0x4f57de[_0x1f63('0x2f')]=_[_0x1f63('0x30')](_0x5221f1[_0x1f63('0x2f')]);_0x4f57de[_0x1f63('0x31')]=_[_0x1f63('0x32')](_0x4f57de['model'],_0x4f57de['query']);_0xfd8e77[_0x1f63('0x33')]=_[_0x1f63('0x32')](_0x4f57de['model'],qs[_0x1f63('0x34')](_0x5221f1['query']['fields']));_0xfd8e77[_0x1f63('0x33')]=_0xfd8e77[_0x1f63('0x33')]['length']?_0xfd8e77[_0x1f63('0x33')]:_0x4f57de['model'];if(!_0x5221f1[_0x1f63('0x2f')][_0x1f63('0x35')]('nolimit')){_0xfd8e77[_0x1f63('0x1e')]=qs[_0x1f63('0x1e')](_0x5221f1['query']['limit']);_0xfd8e77[_0x1f63('0x1c')]=qs[_0x1f63('0x1c')](_0x5221f1['query'][_0x1f63('0x1c')]);}_0xfd8e77['order']=qs['sort'](_0x5221f1[_0x1f63('0x2f')][_0x1f63('0x36')]);_0xfd8e77[_0x1f63('0x37')]=qs[_0x1f63('0x31')](_[_0x1f63('0x38')](_0x5221f1[_0x1f63('0x2f')],_0x4f57de[_0x1f63('0x31')]),_0x5087e9);if(_0x5221f1[_0x1f63('0x2f')][_0x1f63('0x39')]){_0xfd8e77[_0x1f63('0x37')]=_[_0x1f63('0x3a')](_0xfd8e77[_0x1f63('0x37')],{'$or':_['map'](_0x5087e9,function(_0x129500){if(_0x129500[_0x1f63('0x3b')]!==_0x1f63('0x3c')){var _0x4198f8={};_0x4198f8[_0x129500['name']]={'$like':'%'+_0x5221f1['query'][_0x1f63('0x39')]+'%'};return _0x4198f8;}})});}_0xfd8e77=_[_0x1f63('0x3a')]({},_0xfd8e77,_0x5221f1[_0x1f63('0x3d')]);var _0x19839d={'where':_0xfd8e77[_0x1f63('0x37')]};return db['VoiceTransferReport'][_0x1f63('0x1f')](_0x19839d)[_0x1f63('0x25')](function(_0x5417ff){_0x3b8ea9[_0x1f63('0x1f')]=_0x5417ff;if(_0x5221f1['query']['includeAll']){_0xfd8e77[_0x1f63('0x3e')]=[{'all':!![]}];}return db[_0x1f63('0x3f')]['findAll'](_0xfd8e77);})[_0x1f63('0x25')](function(_0x26088f){_0x3b8ea9[_0x1f63('0x40')]=_0x26088f;return _0x3b8ea9;})[_0x1f63('0x25')](respondWithFilteredResult(_0x83e5c6,_0xfd8e77))[_0x1f63('0x41')](handleError(_0x83e5c6,null));};exports[_0x1f63('0x42')]=function(_0x4b5a03,_0x45aa09){var _0xbcd7e8={'raw':!![],'where':{'id':_0x4b5a03['params']['id']}},_0x4529b5={};_0x4529b5[_0x1f63('0x2e')]=_[_0x1f63('0x30')](db[_0x1f63('0x3f')]['rawAttributes']);_0x4529b5[_0x1f63('0x2f')]=_[_0x1f63('0x30')](_0x4b5a03[_0x1f63('0x2f')]);_0x4529b5[_0x1f63('0x31')]=_['intersection'](_0x4529b5['model'],_0x4529b5[_0x1f63('0x2f')]);_0xbcd7e8[_0x1f63('0x33')]=_['intersection'](_0x4529b5[_0x1f63('0x2e')],qs[_0x1f63('0x34')](_0x4b5a03[_0x1f63('0x2f')]['fields']));_0xbcd7e8[_0x1f63('0x33')]=_0xbcd7e8[_0x1f63('0x33')][_0x1f63('0x43')]?_0xbcd7e8[_0x1f63('0x33')]:_0x4529b5[_0x1f63('0x2e')];if(_0x4b5a03[_0x1f63('0x2f')]['includeAll']){_0xbcd7e8[_0x1f63('0x3e')]=[{'all':!![]}];}_0xbcd7e8=_['merge']({},_0xbcd7e8,_0x4b5a03[_0x1f63('0x3d')]);return db[_0x1f63('0x3f')][_0x1f63('0x44')](_0xbcd7e8)['then'](handleEntityNotFound(_0x45aa09,null))['then'](respondWithResult(_0x45aa09,null))[_0x1f63('0x41')](handleError(_0x45aa09,null));};exports[_0x1f63('0x45')]=function(_0x470e26,_0x10b465){return db[_0x1f63('0x3f')][_0x1f63('0x45')](_0x470e26[_0x1f63('0x46')],{})[_0x1f63('0x25')](respondWithResult(_0x10b465,0xc9))[_0x1f63('0x41')](handleError(_0x10b465,null));};exports[_0x1f63('0x24')]=function(_0x13632c,_0x29a556){if(_0x13632c[_0x1f63('0x46')]['id']){delete _0x13632c[_0x1f63('0x46')]['id'];}return db[_0x1f63('0x3f')][_0x1f63('0x44')]({'where':{'id':_0x13632c[_0x1f63('0x47')]['id']}})[_0x1f63('0x25')](handleEntityNotFound(_0x29a556,null))[_0x1f63('0x25')](saveUpdates(_0x13632c[_0x1f63('0x46')],null))[_0x1f63('0x25')](respondWithResult(_0x29a556,null))[_0x1f63('0x41')](handleError(_0x29a556,null));};exports[_0x1f63('0x48')]=function(_0x3f2079,_0x49b082){return db['VoiceTransferReport']['find']({'where':{'id':_0x3f2079[_0x1f63('0x47')]['id']}})[_0x1f63('0x25')](handleEntityNotFound(_0x49b082,null))[_0x1f63('0x25')](removeEntity(_0x49b082,null))[_0x1f63('0x41')](handleError(_0x49b082,null));};exports[_0x1f63('0x49')]=function(_0x5404d0,_0xd2edec){return db[_0x1f63('0x3f')][_0x1f63('0x49')]()['then'](respondWithResult(_0xd2edec,null))[_0x1f63('0x41')](handleError(_0xd2edec,null));}; \ No newline at end of file +var _0x47b4=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','describe','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceTransferReport','fieldName'];(function(_0x3c3c20,_0x3d41e1){var _0x11fbd=function(_0x4c01f7){while(--_0x4c01f7){_0x3c3c20['push'](_0x3c3c20['shift']());}};_0x11fbd(++_0x3d41e1);}(_0x47b4,0x144));var _0x447b=function(_0x3a4425,_0x1de5cb){_0x3a4425=_0x3a4425-0x0;var _0x26976d=_0x47b4[_0x3a4425];return _0x26976d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x447b('0x0'));var rp=require(_0x447b('0x1'));var moment=require(_0x447b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x447b('0x3'));var sox=require(_0x447b('0x4'));var csv=require(_0x447b('0x5'));var ejs=require(_0x447b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x447b('0x7'));var squel=require(_0x447b('0x8'));var crypto=require(_0x447b('0x9'));var jsforce=require(_0x447b('0xa'));var deskjs=require(_0x447b('0xb'));var toCsv=require(_0x447b('0x5'));var querystring=require(_0x447b('0xc'));var Papa=require('papaparse');var Redis=require(_0x447b('0xd'));var authService=require(_0x447b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x447b('0xf'));var hardwareService=require(_0x447b('0x10'));var logger=require(_0x447b('0x11'))('api');var utils=require(_0x447b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x447b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f47a,_0xdbb083){_0xdbb083=_0xdbb083||0xcc;return function(_0x5a62a3){if(_0x5a62a3){return _0x16f47a[_0x447b('0x14')](_0xdbb083);}return _0x16f47a[_0x447b('0x15')](_0xdbb083)[_0x447b('0x16')]();};}function respondWithResult(_0x24f492,_0x1f8dc3){_0x1f8dc3=_0x1f8dc3||0xc8;return function(_0x2f0f39){if(_0x2f0f39){return _0x24f492['status'](_0x1f8dc3)[_0x447b('0x17')](_0x2f0f39);}};}function respondWithFilteredResult(_0x3f0674,_0x4b4d64){return function(_0x531309){if(_0x531309){var _0x4cbd0b=typeof _0x4b4d64[_0x447b('0x18')]==='undefined'&&typeof _0x4b4d64[_0x447b('0x19')]==='undefined';var _0x560e39=_0x531309[_0x447b('0x1a')];var _0xbdab4d=_0x4cbd0b?0x0:_0x4b4d64['offset'];var _0x244fbc=_0x4cbd0b?_0x531309['count']:_0x4b4d64['offset']+_0x4b4d64[_0x447b('0x19')];var _0x579e0a;if(_0x244fbc>=_0x560e39){_0x244fbc=_0x560e39;_0x579e0a=0xc8;}else{_0x579e0a=0xce;}_0x3f0674['status'](_0x579e0a);return _0x3f0674[_0x447b('0x1b')]('Content-Range',_0xbdab4d+'-'+_0x244fbc+'/'+_0x560e39)[_0x447b('0x17')](_0x531309);}return null;};}function patchUpdates(_0x21d661){return function(_0x45a9d9){try{jsonpatch[_0x447b('0x1c')](_0x45a9d9,_0x21d661,!![]);}catch(_0x2ff583){return BPromise[_0x447b('0x1d')](_0x2ff583);}return _0x45a9d9[_0x447b('0x1e')]();};}function saveUpdates(_0x1c4197,_0x3cc690){return function(_0x3778ca){if(_0x3778ca){return _0x3778ca[_0x447b('0x1f')](_0x1c4197)['then'](function(_0x5ed61a){return _0x5ed61a;});}return null;};}function removeEntity(_0x413064,_0xdc7acc){return function(_0x3b5cf2){if(_0x3b5cf2){return _0x3b5cf2[_0x447b('0x20')]()[_0x447b('0x21')](function(){_0x413064[_0x447b('0x15')](0xcc)[_0x447b('0x16')]();});}};}function handleEntityNotFound(_0x368992,_0x54a8e8){return function(_0x24d669){if(!_0x24d669){_0x368992['sendStatus'](0x194);}return _0x24d669;};}function handleError(_0x1a7f9b,_0x33dfd6){_0x33dfd6=_0x33dfd6||0x1f4;return function(_0x21bd0a){logger[_0x447b('0x22')](_0x21bd0a[_0x447b('0x23')]);if(_0x21bd0a[_0x447b('0x24')]){delete _0x21bd0a[_0x447b('0x24')];}_0x1a7f9b['status'](_0x33dfd6)[_0x447b('0x25')](_0x21bd0a);};}exports['index']=function(_0x2a6fd7,_0x553640){var _0x2a71ff={},_0x37d8fc={},_0x4fc7b2={'count':0x0,'rows':[]};var _0x9bcfc4=_[_0x447b('0x26')](db[_0x447b('0x27')]['rawAttributes'],function(_0x104126){return{'name':_0x104126[_0x447b('0x28')],'type':_0x104126[_0x447b('0x29')][_0x447b('0x2a')]};});_0x37d8fc[_0x447b('0x2b')]=_[_0x447b('0x26')](_0x9bcfc4,'name');_0x37d8fc[_0x447b('0x2c')]=_[_0x447b('0x2d')](_0x2a6fd7['query']);_0x37d8fc[_0x447b('0x2e')]=_[_0x447b('0x2f')](_0x37d8fc[_0x447b('0x2b')],_0x37d8fc[_0x447b('0x2c')]);_0x2a71ff[_0x447b('0x30')]=_['intersection'](_0x37d8fc[_0x447b('0x2b')],qs[_0x447b('0x31')](_0x2a6fd7['query'][_0x447b('0x31')]));_0x2a71ff[_0x447b('0x30')]=_0x2a71ff['attributes']['length']?_0x2a71ff['attributes']:_0x37d8fc['model'];if(!_0x2a6fd7['query'][_0x447b('0x32')](_0x447b('0x33'))){_0x2a71ff[_0x447b('0x19')]=qs[_0x447b('0x19')](_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x19')]);_0x2a71ff[_0x447b('0x18')]=qs[_0x447b('0x18')](_0x2a6fd7[_0x447b('0x2c')]['offset']);}_0x2a71ff[_0x447b('0x34')]=qs[_0x447b('0x35')](_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x35')]);_0x2a71ff['where']=qs[_0x447b('0x2e')](_[_0x447b('0x36')](_0x2a6fd7[_0x447b('0x2c')],_0x37d8fc[_0x447b('0x2e')]),_0x9bcfc4);if(_0x2a6fd7['query']['filter']){_0x2a71ff[_0x447b('0x37')]=_[_0x447b('0x38')](_0x2a71ff[_0x447b('0x37')],{'$or':_[_0x447b('0x26')](_0x9bcfc4,function(_0x32f0ce){if(_0x32f0ce['type']!==_0x447b('0x39')){var _0x41b207={};_0x41b207[_0x32f0ce[_0x447b('0x24')]]={'$like':'%'+_0x2a6fd7[_0x447b('0x2c')][_0x447b('0x3a')]+'%'};return _0x41b207;}})});}_0x2a71ff=_['merge']({},_0x2a71ff,_0x2a6fd7[_0x447b('0x3b')]);var _0x5c76cd={'where':_0x2a71ff[_0x447b('0x37')]};return db[_0x447b('0x27')][_0x447b('0x1a')](_0x5c76cd)[_0x447b('0x21')](function(_0x20aa2e){_0x4fc7b2[_0x447b('0x1a')]=_0x20aa2e;if(_0x2a6fd7[_0x447b('0x2c')]['includeAll']){_0x2a71ff[_0x447b('0x3c')]=[{'all':!![]}];}return db[_0x447b('0x27')][_0x447b('0x3d')](_0x2a71ff);})[_0x447b('0x21')](function(_0x381b2b){_0x4fc7b2[_0x447b('0x3e')]=_0x381b2b;return _0x4fc7b2;})[_0x447b('0x21')](respondWithFilteredResult(_0x553640,_0x2a71ff))[_0x447b('0x3f')](handleError(_0x553640,null));};exports[_0x447b('0x40')]=function(_0x35aa51,_0x459510){var _0x34bb01={'raw':!![],'where':{'id':_0x35aa51['params']['id']}},_0x31f790={};_0x31f790[_0x447b('0x2b')]=_[_0x447b('0x2d')](db['VoiceTransferReport'][_0x447b('0x41')]);_0x31f790[_0x447b('0x2c')]=_[_0x447b('0x2d')](_0x35aa51['query']);_0x31f790['filters']=_[_0x447b('0x2f')](_0x31f790[_0x447b('0x2b')],_0x31f790[_0x447b('0x2c')]);_0x34bb01[_0x447b('0x30')]=_[_0x447b('0x2f')](_0x31f790[_0x447b('0x2b')],qs[_0x447b('0x31')](_0x35aa51[_0x447b('0x2c')][_0x447b('0x31')]));_0x34bb01['attributes']=_0x34bb01['attributes'][_0x447b('0x42')]?_0x34bb01[_0x447b('0x30')]:_0x31f790[_0x447b('0x2b')];if(_0x35aa51['query'][_0x447b('0x43')]){_0x34bb01[_0x447b('0x3c')]=[{'all':!![]}];}_0x34bb01=_['merge']({},_0x34bb01,_0x35aa51[_0x447b('0x3b')]);return db[_0x447b('0x27')][_0x447b('0x44')](_0x34bb01)[_0x447b('0x21')](handleEntityNotFound(_0x459510,null))[_0x447b('0x21')](respondWithResult(_0x459510,null))[_0x447b('0x3f')](handleError(_0x459510,null));};exports[_0x447b('0x45')]=function(_0x1255ad,_0x3e4e46){return db[_0x447b('0x27')][_0x447b('0x45')](_0x1255ad['body'],{})[_0x447b('0x21')](respondWithResult(_0x3e4e46,0xc9))['catch'](handleError(_0x3e4e46,null));};exports[_0x447b('0x1f')]=function(_0x1ad0e3,_0x5c7ed3){if(_0x1ad0e3[_0x447b('0x46')]['id']){delete _0x1ad0e3['body']['id'];}return db['VoiceTransferReport'][_0x447b('0x44')]({'where':{'id':_0x1ad0e3[_0x447b('0x47')]['id']}})[_0x447b('0x21')](handleEntityNotFound(_0x5c7ed3,null))[_0x447b('0x21')](saveUpdates(_0x1ad0e3[_0x447b('0x46')],null))[_0x447b('0x21')](respondWithResult(_0x5c7ed3,null))['catch'](handleError(_0x5c7ed3,null));};exports['destroy']=function(_0x2720b,_0x4c03b1){return db[_0x447b('0x27')]['find']({'where':{'id':_0x2720b['params']['id']}})['then'](handleEntityNotFound(_0x4c03b1,null))[_0x447b('0x21')](removeEntity(_0x4c03b1,null))[_0x447b('0x3f')](handleError(_0x4c03b1,null));};exports[_0x447b('0x48')]=function(_0x23b027,_0x580801){return db[_0x447b('0x27')][_0x447b('0x48')]()[_0x447b('0x21')](respondWithResult(_0x580801,null))[_0x447b('0x3f')](handleError(_0x580801,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a762c0a..c333703 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 _0x0637=['./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x0637,0x11c));var _0x7063=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0637[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7063('0x0'));var logger=require(_0x7063('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7063('0x2'));var rp=require(_0x7063('0x3'));var fs=require('fs');var path=require(_0x7063('0x4'));var rimraf=require(_0x7063('0x5'));var config=require('../../config/environment');var attributes=require(_0x7063('0x6'));module[_0x7063('0x7')]=function(_0x21e923,_0x2817cd){return _0x21e923['define'](_0x7063('0x8'),attributes,{'tableName':_0x7063('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9977=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x9977,0x78));var _0x7997=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x9977[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x7997('0x0'));var util=require(_0x7997('0x1'));var logger=require(_0x7997('0x2'))(_0x7997('0x3'));var moment=require('moment');var BPromise=require(_0x7997('0x4'));var rp=require(_0x7997('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7997('0x6'));var config=require('../../config/environment');var attributes=require(_0x7997('0x7'));module[_0x7997('0x8')]=function(_0x105248,_0x4cc5e7){return _0x105248[_0x7997('0x9')](_0x7997('0xa'),attributes,{'tableName':_0x7997('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 74a1319..7bef1d7 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 _0x1621=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','then','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2f0975,_0x2c9987){var _0x3d8691=function(_0x1be829){while(--_0x1be829){_0x2f0975['push'](_0x2f0975['shift']());}};_0x3d8691(++_0x2c9987);}(_0x1621,0x1c3));var _0x1162=function(_0x1af1e1,_0x37bc24){_0x1af1e1=_0x1af1e1-0x0;var _0x5f3450=_0x1621[_0x1af1e1];return _0x5f3450;};'use strict';var _=require(_0x1162('0x0'));var util=require(_0x1162('0x1'));var moment=require('moment');var BPromise=require(_0x1162('0x2'));var rs=require(_0x1162('0x3'));var fs=require('fs');var Redis=require(_0x1162('0x4'));var db=require(_0x1162('0x5'))['db'];var utils=require(_0x1162('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1162('0x7'));var client=jayson[_0x1162('0x8')][_0x1162('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3e24,_0x113092,_0x59765e){return new BPromise(function(_0x199f39,_0x1e8c77){return client[_0x1162('0xa')](_0x3f3e24,_0x59765e)['then'](function(_0x2a1be9){logger[_0x1162('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x113092,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x113092,'request\x20sent',JSON[_0x1162('0xc')](_0x2a1be9));if(_0x2a1be9[_0x1162('0xd')]){if(_0x2a1be9['error'][_0x1162('0xe')]===0x1f4){logger[_0x1162('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x113092,_0x2a1be9['error'][_0x1162('0xf')]);return _0x1e8c77(_0x2a1be9[_0x1162('0xd')][_0x1162('0xf')]);}logger[_0x1162('0xd')](_0x1162('0x10'),_0x113092,_0x2a1be9['error'][_0x1162('0xf')]);return _0x199f39(_0x2a1be9[_0x1162('0xd')][_0x1162('0xf')]);}else{logger[_0x1162('0xb')](_0x1162('0x10'),_0x113092,_0x1162('0x11'));_0x199f39(_0x2a1be9[_0x1162('0x12')][_0x1162('0xf')]);}})[_0x1162('0x13')](function(_0x3767f8){logger[_0x1162('0xd')](_0x1162('0x10'),_0x113092,_0x3767f8);_0x1e8c77(_0x3767f8);});});}exports[_0x1162('0x14')]=function(_0x4d4c8){var _0x14935f=this;return new Promise(function(_0x561446,_0x4a7bb0){return db[_0x1162('0x15')]['create'](_0x4d4c8['body'],{'raw':_0x4d4c8[_0x1162('0x16')]?_0x4d4c8[_0x1162('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1162('0x17')](function(_0x279578){logger[_0x1162('0xb')](_0x1162('0x14'),_0x4d4c8);logger['debug'](_0x1162('0x14'),_0x4d4c8,JSON[_0x1162('0xc')](_0x279578));_0x561446(_0x279578);})['catch'](function(_0x1b45c8){logger[_0x1162('0xd')](_0x1162('0x14'),_0x1b45c8['message'],_0x4d4c8);_0x4a7bb0(_0x14935f[_0x1162('0xd')](0x1f4,_0x1b45c8[_0x1162('0xf')]));});});}; \ No newline at end of file +var _0x424a=['error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x424a,0x191));var _0xa424=function(_0x213a44,_0x3a9c9c){_0x213a44=_0x213a44-0x0;var _0x14851d=_0x424a[_0x213a44];return _0x14851d;};'use strict';var _=require(_0xa424('0x0'));var util=require('util');var moment=require(_0xa424('0x1'));var BPromise=require(_0xa424('0x2'));var rs=require(_0xa424('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa424('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa424('0x5'));var client=jayson['client'][_0xa424('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x36f839,_0x35fb9f,_0x113011){return new BPromise(function(_0x5218c1,_0x5e23ac){return client[_0xa424('0x7')](_0x36f839,_0x113011)['then'](function(_0x455f0b){logger['info'](_0xa424('0x8'),_0x35fb9f,_0xa424('0x9'));logger[_0xa424('0xa')](_0xa424('0xb'),_0x35fb9f,'request\x20sent',JSON[_0xa424('0xc')](_0x455f0b));if(_0x455f0b[_0xa424('0xd')]){if(_0x455f0b[_0xa424('0xd')]['code']===0x1f4){logger['error'](_0xa424('0x8'),_0x35fb9f,_0x455f0b[_0xa424('0xd')]['message']);return _0x5e23ac(_0x455f0b[_0xa424('0xd')][_0xa424('0xe')]);}logger[_0xa424('0xd')](_0xa424('0x8'),_0x35fb9f,_0x455f0b['error'][_0xa424('0xe')]);return _0x5218c1(_0x455f0b[_0xa424('0xd')][_0xa424('0xe')]);}else{logger['info'](_0xa424('0x8'),_0x35fb9f,_0xa424('0x9'));_0x5218c1(_0x455f0b[_0xa424('0xf')][_0xa424('0xe')]);}})[_0xa424('0x10')](function(_0x55c3b7){logger[_0xa424('0xd')](_0xa424('0x8'),_0x35fb9f,_0x55c3b7);_0x5e23ac(_0x55c3b7);});});}exports[_0xa424('0x11')]=function(_0x2344d0){var _0x5c1e2e=this;return new Promise(function(_0x47385e,_0x4ac8e8){return db[_0xa424('0x12')][_0xa424('0x13')](_0x2344d0[_0xa424('0x14')],{'raw':_0x2344d0['options']?_0x2344d0[_0xa424('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x33965){logger[_0xa424('0x16')](_0xa424('0x11'),_0x2344d0);logger['debug'](_0xa424('0x11'),_0x2344d0,JSON[_0xa424('0xc')](_0x33965));_0x47385e(_0x33965);})[_0xa424('0x10')](function(_0xcb08fd){logger[_0xa424('0xd')]('CreateVoiceTransferReport',_0xcb08fd[_0xa424('0xe')],_0x2344d0);_0x4ac8e8(_0x5c1e2e[_0xa424('0xd')](0x1f4,_0xcb08fd[_0xa424('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 40b5349..5abdcf8 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 _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x4d5b76,_0x15f098){var _0x4f95d5=function(_0x114688){while(--_0x114688){_0x4d5b76['push'](_0x4d5b76['shift']());}};_0x4f95d5(++_0x15f098);}(_0x9a19,0x114));var _0x99a1=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x9a19[_0x4fe19c];return _0x952ac7;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file +var _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x5e715c,_0x49a48f){var _0x3fed99=function(_0x13b3c4){while(--_0x13b3c4){_0x5e715c['push'](_0x5e715c['shift']());}};_0x3fed99(++_0x49a48f);}(_0x5b02,0xe9));var _0x25b0=function(_0x3df65a,_0x2964c1){_0x3df65a=_0x3df65a-0x0;var _0x29c280=_0x5b02[_0x3df65a];return _0x29c280;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index ca110de..1b8cf9e 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 _0xb977=['hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','webbar:hold','unhold\x20fired:','webbar:unhold','calls','VoiceChannels','conference','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','info','stringify','log','handleError:','error','name','status','send','NotFound','request','code','message','catch','then','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','entityFound:','format','user:%s','originate\x20executed!'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb977,0xd7));var _0x7b97=function(_0x226a3a,_0x29ba28){_0x226a3a=_0x226a3a-0x0;var _0x3cd063=_0xb977[_0x226a3a];return _0x3cd063;};'use strict';var path=require(_0x7b97('0x0'));var fs=require('fs');var _=require(_0x7b97('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x7b97('0x2'));var util=require(_0x7b97('0x3'));var BPromise=require(_0x7b97('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x7b97('0x5')][_0x7b97('0x6')]({'port':0x232a});var logger=require(_0x7b97('0x7'))(_0x7b97('0x8'));var Redis=require(_0x7b97('0x9'));config[_0x7b97('0xa')]=_[_0x7b97('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7b97('0xc'))(new Redis(config['redis']));var Schema=require(_0x7b97('0xd'));var originateValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x7b97('0xf'),'required':[!![],_0x7b97('0x10')]},'callerId':{'type':_0x7b97('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],_0x7b97('0x11')]},'sessionId':{'type':_0x7b97('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],_0x7b97('0x11')]},'sessionId':{'type':_0x7b97('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x7b97('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],_0x7b97('0x11')]},'sessionId':{'type':_0x7b97('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],_0x7b97('0x11')]},'sessionId':{'type':_0x7b97('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7b97('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7b97('0xe'),'required':[!![],_0x7b97('0x11')]}});function emit(_0x2d6d69,_0x101a70,_0x21f20e){logger[_0x7b97('0x12')](_0x2d6d69,_0x101a70,JSON[_0x7b97('0x13')](_0x21f20e));io['to'](_0x2d6d69)['emit'](_0x101a70,_0x21f20e);}function handleError(_0x17d092){return function(_0x680b62){console[_0x7b97('0x14')](_0x7b97('0x15'),_0x680b62,_0x680b62 instanceof RangeError);logger[_0x7b97('0x16')](_0x680b62['stack']);if(_0x680b62 instanceof RangeError){if(_0x680b62[_0x7b97('0x17')]){delete _0x680b62['name'];}_0x17d092[_0x7b97('0x18')](0x194)[_0x7b97('0x19')](_0x680b62);}else{if(_0x680b62[_0x7b97('0x17')]){delete _0x680b62[_0x7b97('0x17')];}_0x17d092[_0x7b97('0x18')](0x1f4)[_0x7b97('0x19')](_0x680b62);}};}function checkError(){return function(_0x3834ea){if(!_0x3834ea){throw new RangeError(_0x7b97('0x1a'));}return _0x3834ea;};}function respondWithRpcPromise(_0x2f8e06,_0x129ab3){return new BPromise(function(_0x2a7b19,_0x1d550e){var _0x436650=amiClient;return _0x436650[_0x7b97('0x1b')](_0x2f8e06,_0x129ab3)['then'](function(_0x3777bb){if(_0x3777bb[_0x7b97('0x16')]){if(_0x3777bb[_0x7b97('0x16')][_0x7b97('0x1c')]===0x1f4){return _0x1d550e(_0x3777bb[_0x7b97('0x16')][_0x7b97('0x1d')]);}return _0x2a7b19(_0x3777bb[_0x7b97('0x16')][_0x7b97('0x1d')]);}else{_0x2a7b19(_0x3777bb['result']);}})[_0x7b97('0x1e')](function(_0x81f708){_0x1d550e(_0x81f708);});});}function getAgent(_0x12547d){return db['User']['findOne']({'where':{'id':_0x12547d,'role':'agent'}})[_0x7b97('0x1f')](checkError());}function getAgentCheckSession(_0x4fbd1a,_0x487d4b){return new BPromise(function(_0x534d2f,_0xd97873){var _0x1dd598=respondWithRpcPromise('VoiceChannels');var _0x3914fa=getAgent(_0x4fbd1a);Promise[_0x7b97('0x20')]([_0x1dd598,_0x3914fa])[_0x7b97('0x1f')](function(_0xd453df){var _0xcf3ecf=_0xd453df[0x0];var _0x4d2fbf=_0xd453df[0x1];var _0x258c5d=_[_0x7b97('0x21')](_0xcf3ecf[_0x7b97('0x22')],function(_0x3c53fc){return _0x3c53fc[_0x7b97('0x23')]==_0x4d2fbf['id']&&_0x3c53fc[_0x7b97('0x24')]==_0x487d4b;});if(_0x258c5d[_0x7b97('0x25')]==0x1){_0x534d2f(_0x4d2fbf);}else{_0xd97873(new RangeError(_0x7b97('0x26')+_0x487d4b+_0x7b97('0x27')));}});});}exports[_0x7b97('0x28')]=function(_0x2bc950,_0x10697d){logger[_0x7b97('0x12')](_0x7b97('0x29'),_0x2bc950[_0x7b97('0x2a')]);var _0x1d6b0d=originateValidation['validate'](_0x2bc950['body']);if(_0x1d6b0d[_0x7b97('0x25')]>0x0){return _0x10697d['status'](0x190)[_0x7b97('0x2b')](_0x1d6b0d);}var _0x23e005=_0x2bc950[_0x7b97('0x2a')][_0x7b97('0x2c')];var _0x3733c8=_0x2bc950[_0x7b97('0x2a')]['callNumber'];var _0x4bf1e8=_0x2bc950[_0x7b97('0x2a')]['callerId'];var _0x470df0=_0x2bc950[_0x7b97('0x2a')]['callbackUrl'];return getAgent(_0x23e005)['then'](function(_0xbce572){logger[_0x7b97('0x12')](_0x7b97('0x2d'),_0xbce572['name']);emit(util[_0x7b97('0x2e')](_0x7b97('0x2f'),_0xbce572['name']),'webbar:originate',{'callNumber':_0x3733c8,'callerId':_0x4bf1e8,'callbackUrl':_0x470df0});return _0x10697d[_0x7b97('0x18')](0xc8)[_0x7b97('0x2b')]({'error':![],'message':_0x7b97('0x30')});})['catch'](handleError(_0x10697d));};exports[_0x7b97('0x31')]=function(_0x5a20f9,_0x781cab){logger['info'](_0x7b97('0x32'),_0x5a20f9['body']);var _0x440e97=hangupValidation[_0x7b97('0xd')](_0x5a20f9[_0x7b97('0x2a')]);if(_0x440e97[_0x7b97('0x25')]>0x0){return _0x781cab[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x440e97);}var _0x3d6847=_0x5a20f9[_0x7b97('0x2a')][_0x7b97('0x2c')];var _0x18279d=_0x5a20f9[_0x7b97('0x2a')][_0x7b97('0x24')];return getAgent(_0x3d6847)[_0x7b97('0x1f')](function(_0x800b36){logger[_0x7b97('0x12')](_0x7b97('0x2d'),_0x800b36[_0x7b97('0x17')]);emit(util[_0x7b97('0x2e')](_0x7b97('0x2f'),_0x800b36[_0x7b97('0x17')]),_0x7b97('0x33'),{'sessionId':_0x18279d});return _0x781cab['status'](0xc8)['json']({'error':![],'message':_0x7b97('0x34')});})[_0x7b97('0x1e')](handleError(_0x781cab));};exports['answer']=function(_0x1b29b3,_0x4b215b){logger['info'](_0x7b97('0x35'),_0x1b29b3['body']);var _0x4c0af2=answerValidation[_0x7b97('0xd')](_0x1b29b3['body']);if(_0x4c0af2[_0x7b97('0x25')]>0x0){return _0x4b215b[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x4c0af2);}var _0x3a87b5=_0x1b29b3[_0x7b97('0x2a')][_0x7b97('0x2c')];var _0x10a959=_0x1b29b3[_0x7b97('0x2a')][_0x7b97('0x24')];return getAgent(_0x3a87b5)[_0x7b97('0x1f')](function(_0x55351c){logger[_0x7b97('0x12')]('entityFound:',_0x55351c[_0x7b97('0x17')]);emit(util[_0x7b97('0x2e')](_0x7b97('0x2f'),_0x55351c[_0x7b97('0x17')]),_0x7b97('0x36'),{'sessionId':_0x10a959});return _0x4b215b[_0x7b97('0x18')](0xc8)[_0x7b97('0x2b')]({'error':![],'message':'answer\x20executed!'});})[_0x7b97('0x1e')](handleError(_0x4b215b));};exports['hold']=function(_0x196d68,_0x17ccba){logger[_0x7b97('0x12')]('hold\x20fired:',_0x196d68['body']);var _0x1e2936=holdValidation['validate'](_0x196d68[_0x7b97('0x2a')]);if(_0x1e2936[_0x7b97('0x25')]>0x0){return _0x17ccba[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x1e2936);}var _0x3355d5=_0x196d68[_0x7b97('0x2a')][_0x7b97('0x2c')];var _0x5416c0=_0x196d68[_0x7b97('0x2a')][_0x7b97('0x24')];return getAgent(_0x3355d5)[_0x7b97('0x1f')](function(_0x31ee85){logger[_0x7b97('0x12')](_0x7b97('0x2d'),_0x31ee85['name']);emit(util[_0x7b97('0x2e')](_0x7b97('0x2f'),_0x31ee85[_0x7b97('0x17')]),_0x7b97('0x37'),{'sessionId':_0x5416c0});return _0x17ccba['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x7b97('0x1e')](handleError(_0x17ccba));};exports['unhold']=function(_0x38494c,_0x31db3b){logger[_0x7b97('0x12')](_0x7b97('0x38'),_0x38494c['body']);var _0x3b9393=unholdValidation[_0x7b97('0xd')](_0x38494c[_0x7b97('0x2a')]);if(_0x3b9393[_0x7b97('0x25')]>0x0){return _0x31db3b[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x3b9393);}var _0x30a652=_0x38494c[_0x7b97('0x2a')]['userId'];var _0x5c773b=_0x38494c['body'][_0x7b97('0x24')];return getAgent(_0x30a652)[_0x7b97('0x1f')](function(_0x939cf){logger[_0x7b97('0x12')](_0x7b97('0x2d'),_0x939cf[_0x7b97('0x17')]);emit(util[_0x7b97('0x2e')]('user:%s',_0x939cf[_0x7b97('0x17')]),_0x7b97('0x39'),{'sessionId':_0x5c773b});return _0x31db3b[_0x7b97('0x18')](0xc8)[_0x7b97('0x2b')]({'error':![],'message':'unhold\x20executed!'});})[_0x7b97('0x1e')](handleError(_0x31db3b));};exports[_0x7b97('0x3a')]=function(_0x3766f5,_0x2c237a){logger[_0x7b97('0x12')]('calls\x20fired:',_0x2c237a[_0x7b97('0x2a')]);var _0x27be9b=callsValidation[_0x7b97('0xd')](_0x3766f5['body']);if(_0x27be9b[_0x7b97('0x25')]>0x0){return _0x2c237a[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x27be9b);}var _0x4355c9=_0x3766f5[_0x7b97('0x2a')][_0x7b97('0x2c')];var _0xf66109=respondWithRpcPromise(_0x7b97('0x3b'));var _0x46b837=getAgent(_0x4355c9);return Promise[_0x7b97('0x20')]([_0xf66109,_0x46b837])['then'](function(_0x22801c){var _0x352b6a=_0x22801c[0x0];var _0x5f2550=_0x22801c[0x1];var _0x2b11c4=_[_0x7b97('0x21')](_0x352b6a[_0x7b97('0x22')],function(_0x3266f1){return _0x3266f1['UserId']==_0x5f2550['id'];});return _0x2c237a[_0x7b97('0x18')](0xc8)['json']({'count':_0x2b11c4['length'],'rows':_0x2b11c4});})[_0x7b97('0x1e')](handleError(_0x2c237a));};exports[_0x7b97('0x3c')]=function(_0x5a73de,_0x263feb){logger[_0x7b97('0x12')]('conference\x20fired:',_0x5a73de[_0x7b97('0x2a')]);var _0x455d65=conferenceValidation['validate'](_0x5a73de[_0x7b97('0x2a')]);if(_0x455d65['length']>0x0){return _0x263feb[_0x7b97('0x18')](0x190)[_0x7b97('0x2b')](_0x455d65);}var _0x458bbc=_0x5a73de[_0x7b97('0x2a')][_0x7b97('0x2c')];return getAgent(_0x458bbc)[_0x7b97('0x1f')](function(_0x4a085c){logger[_0x7b97('0x12')](_0x7b97('0x2d'),_0x4a085c['name']);emit(util['format'](_0x7b97('0x2f'),_0x4a085c[_0x7b97('0x17')]),_0x7b97('0x3d'));return _0x263feb[_0x7b97('0x18')](0xc8)[_0x7b97('0x2b')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x263feb));};exports[_0x7b97('0x3e')]=function(_0x54597d,_0x5a9d2e){logger['info']('transfer\x20fired:',_0x54597d[_0x7b97('0x2a')]);var _0x55e8fa=transferValidation[_0x7b97('0xd')](_0x54597d[_0x7b97('0x2a')]);if(_0x55e8fa[_0x7b97('0x25')]>0x0){return _0x5a9d2e['status'](0x190)[_0x7b97('0x2b')](_0x55e8fa);}var _0x1b07ba=_0x54597d['body'][_0x7b97('0x2c')];var _0x1ddb5b=_0x54597d['body'][_0x7b97('0x24')];var _0x4a4213=_0x54597d[_0x7b97('0x2a')][_0x7b97('0x3f')];return getAgent(_0x1b07ba)[_0x7b97('0x1f')](function(_0x346583){logger[_0x7b97('0x12')]('entityFound:',_0x346583[_0x7b97('0x17')]);emit(util[_0x7b97('0x2e')](_0x7b97('0x2f'),_0x346583[_0x7b97('0x17')]),_0x7b97('0x40'),{'sessionId':_0x1ddb5b,'transferNumber':_0x4a4213});return _0x5a9d2e['status'](0xc8)[_0x7b97('0x2b')]({'error':![],'message':_0x7b97('0x41')});})[_0x7b97('0x1e')](handleError(_0x5a9d2e));}; \ No newline at end of file +var _0x064a=['number','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','NotFound','code','message','result','catch','User','findOne','agent','then','filter','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','http','webbarapi','redis','localhost','socket.io-emitter','validate'];(function(_0x5c6c68,_0x44d361){var _0xa6fc9b=function(_0xb75388){while(--_0xb75388){_0x5c6c68['push'](_0x5c6c68['shift']());}};_0xa6fc9b(++_0x44d361);}(_0x064a,0x168));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xa064('0x0'));var fs=require('fs');var _=require(_0xa064('0x1'));var db=require(_0xa064('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa064('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xa064('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xa064('0x5'));var Redis=require('ioredis');config[_0xa064('0x6')]=_['defaults'](config[_0xa064('0x6')],{'host':_0xa064('0x7'),'port':0x18eb});var io=require(_0xa064('0x8'))(new Redis(config[_0xa064('0x6')]));var Schema=require(_0xa064('0x9'));var originateValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xa064('0xb')]},'callerId':{'type':_0xa064('0xc')},'callbackUrl':{'type':_0xa064('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa064('0xc'),'required':[!![],_0xa064('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa064('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa064('0xa'),'required':[!![],_0xa064('0xd')]}});function emit(_0x91c28c,_0x283e22,_0x26f784){logger[_0xa064('0xf')](_0x91c28c,_0x283e22,JSON['stringify'](_0x26f784));io['to'](_0x91c28c)[_0xa064('0x10')](_0x283e22,_0x26f784);}function handleError(_0x14212d){return function(_0x259938){console[_0xa064('0x11')]('handleError:',_0x259938,_0x259938 instanceof RangeError);logger[_0xa064('0x12')](_0x259938[_0xa064('0x13')]);if(_0x259938 instanceof RangeError){if(_0x259938[_0xa064('0x14')]){delete _0x259938[_0xa064('0x14')];}_0x14212d[_0xa064('0x15')](0x194)[_0xa064('0x16')](_0x259938);}else{if(_0x259938[_0xa064('0x14')]){delete _0x259938[_0xa064('0x14')];}_0x14212d['status'](0x1f4)[_0xa064('0x16')](_0x259938);}};}function checkError(){return function(_0x9d9162){if(!_0x9d9162){throw new RangeError(_0xa064('0x17'));}return _0x9d9162;};}function respondWithRpcPromise(_0xe78199,_0x344507){return new BPromise(function(_0x337c4d,_0x4cd459){var _0x41e115=amiClient;return _0x41e115['request'](_0xe78199,_0x344507)['then'](function(_0x408eb2){if(_0x408eb2[_0xa064('0x12')]){if(_0x408eb2[_0xa064('0x12')][_0xa064('0x18')]===0x1f4){return _0x4cd459(_0x408eb2[_0xa064('0x12')][_0xa064('0x19')]);}return _0x337c4d(_0x408eb2[_0xa064('0x12')][_0xa064('0x19')]);}else{_0x337c4d(_0x408eb2[_0xa064('0x1a')]);}})[_0xa064('0x1b')](function(_0x48ae05){_0x4cd459(_0x48ae05);});});}function getAgent(_0x125076){return db[_0xa064('0x1c')][_0xa064('0x1d')]({'where':{'id':_0x125076,'role':_0xa064('0x1e')}})[_0xa064('0x1f')](checkError());}function getAgentCheckSession(_0x3c0b13,_0xdf0fc4){return new BPromise(function(_0x1c8993,_0x841e3b){var _0x49086e=respondWithRpcPromise('VoiceChannels');var _0x576bf7=getAgent(_0x3c0b13);Promise['all']([_0x49086e,_0x576bf7])[_0xa064('0x1f')](function(_0x2ac8f4){var _0x2deab0=_0x2ac8f4[0x0];var _0x20cc19=_0x2ac8f4[0x1];var _0x5ef378=_[_0xa064('0x20')](_0x2deab0['rows'],function(_0x58f7ee){return _0x58f7ee['UserId']==_0x20cc19['id']&&_0x58f7ee[_0xa064('0x21')]==_0xdf0fc4;});if(_0x5ef378[_0xa064('0x22')]==0x1){_0x1c8993(_0x20cc19);}else{_0x841e3b(new RangeError('sessionId\x20'+_0xdf0fc4+_0xa064('0x23')));}});});}exports[_0xa064('0x24')]=function(_0x1211b5,_0x23dabd){logger[_0xa064('0xf')](_0xa064('0x25'),_0x1211b5[_0xa064('0x26')]);var _0x22274c=originateValidation[_0xa064('0x9')](_0x1211b5['body']);if(_0x22274c['length']>0x0){return _0x23dabd['status'](0x190)[_0xa064('0x27')](_0x22274c);}var _0xcd96c4=_0x1211b5[_0xa064('0x26')][_0xa064('0x28')];var _0x21d86d=_0x1211b5[_0xa064('0x26')][_0xa064('0x29')];var _0x141a62=_0x1211b5[_0xa064('0x26')][_0xa064('0x2a')];var _0x260c29=_0x1211b5['body'][_0xa064('0x2b')];return getAgent(_0xcd96c4)['then'](function(_0x5b4405){logger['info'](_0xa064('0x2c'),_0x5b4405[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x5b4405[_0xa064('0x14')]),_0xa064('0x2f'),{'callNumber':_0x21d86d,'callerId':_0x141a62,'callbackUrl':_0x260c29});return _0x23dabd['status'](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x30')});})[_0xa064('0x1b')](handleError(_0x23dabd));};exports['hangup']=function(_0x5da894,_0xe9ad38){logger[_0xa064('0xf')]('hangup\x20fired:',_0x5da894['body']);var _0x9d81ad=hangupValidation[_0xa064('0x9')](_0x5da894[_0xa064('0x26')]);if(_0x9d81ad[_0xa064('0x22')]>0x0){return _0xe9ad38[_0xa064('0x15')](0x190)['json'](_0x9d81ad);}var _0x534529=_0x5da894[_0xa064('0x26')][_0xa064('0x28')];var _0x1efe82=_0x5da894[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x534529)[_0xa064('0x1f')](function(_0xbfe810){logger[_0xa064('0xf')](_0xa064('0x2c'),_0xbfe810[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0xbfe810[_0xa064('0x14')]),_0xa064('0x31'),{'sessionId':_0x1efe82});return _0xe9ad38['status'](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x32')});})[_0xa064('0x1b')](handleError(_0xe9ad38));};exports[_0xa064('0x33')]=function(_0x59fc5a,_0x6594a6){logger[_0xa064('0xf')](_0xa064('0x34'),_0x59fc5a['body']);var _0x146752=answerValidation[_0xa064('0x9')](_0x59fc5a[_0xa064('0x26')]);if(_0x146752[_0xa064('0x22')]>0x0){return _0x6594a6[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x146752);}var _0x3254a4=_0x59fc5a['body'][_0xa064('0x28')];var _0x18e297=_0x59fc5a[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x3254a4)[_0xa064('0x1f')](function(_0x51e261){logger[_0xa064('0xf')](_0xa064('0x2c'),_0x51e261[_0xa064('0x14')]);emit(util['format']('user:%s',_0x51e261['name']),_0xa064('0x35'),{'sessionId':_0x18e297});return _0x6594a6[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x36')});})['catch'](handleError(_0x6594a6));};exports[_0xa064('0x37')]=function(_0xbd4158,_0x3b0211){logger['info'](_0xa064('0x38'),_0xbd4158[_0xa064('0x26')]);var _0x1d702b=holdValidation[_0xa064('0x9')](_0xbd4158[_0xa064('0x26')]);if(_0x1d702b['length']>0x0){return _0x3b0211[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x1d702b);}var _0x69cf27=_0xbd4158[_0xa064('0x26')][_0xa064('0x28')];var _0x5638b3=_0xbd4158[_0xa064('0x26')]['sessionId'];return getAgent(_0x69cf27)['then'](function(_0xa69a1f){logger[_0xa064('0xf')]('entityFound:',_0xa69a1f[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0xa69a1f[_0xa064('0x14')]),_0xa064('0x39'),{'sessionId':_0x5638b3});return _0x3b0211[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x3a')});})[_0xa064('0x1b')](handleError(_0x3b0211));};exports[_0xa064('0x3b')]=function(_0x24eead,_0x353f8a){logger[_0xa064('0xf')]('unhold\x20fired:',_0x24eead[_0xa064('0x26')]);var _0x4fde60=unholdValidation['validate'](_0x24eead[_0xa064('0x26')]);if(_0x4fde60['length']>0x0){return _0x353f8a['status'](0x190)[_0xa064('0x27')](_0x4fde60);}var _0x5cdc13=_0x24eead[_0xa064('0x26')]['userId'];var _0x364be6=_0x24eead[_0xa064('0x26')][_0xa064('0x21')];return getAgent(_0x5cdc13)['then'](function(_0x5d065b){logger[_0xa064('0xf')](_0xa064('0x2c'),_0x5d065b[_0xa064('0x14')]);emit(util['format']('user:%s',_0x5d065b[_0xa064('0x14')]),_0xa064('0x3c'),{'sessionId':_0x364be6});return _0x353f8a[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x3d')});})[_0xa064('0x1b')](handleError(_0x353f8a));};exports[_0xa064('0x3e')]=function(_0x4e76f2,_0x5da5ff){logger[_0xa064('0xf')](_0xa064('0x3f'),_0x5da5ff[_0xa064('0x26')]);var _0x3f705e=callsValidation[_0xa064('0x9')](_0x4e76f2[_0xa064('0x26')]);if(_0x3f705e[_0xa064('0x22')]>0x0){return _0x5da5ff[_0xa064('0x15')](0x190)[_0xa064('0x27')](_0x3f705e);}var _0x17fb2c=_0x4e76f2['body'][_0xa064('0x28')];var _0x1c5779=respondWithRpcPromise(_0xa064('0x40'));var _0x52e5bd=getAgent(_0x17fb2c);return Promise[_0xa064('0x41')]([_0x1c5779,_0x52e5bd])[_0xa064('0x1f')](function(_0x12398d){var _0x5479be=_0x12398d[0x0];var _0x2ad2b4=_0x12398d[0x1];var _0x245b00=_['filter'](_0x5479be['rows'],function(_0x115589){return _0x115589['UserId']==_0x2ad2b4['id'];});return _0x5da5ff[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'count':_0x245b00[_0xa064('0x22')],'rows':_0x245b00});})[_0xa064('0x1b')](handleError(_0x5da5ff));};exports[_0xa064('0x42')]=function(_0x5ab270,_0x8c7ea5){logger['info'](_0xa064('0x43'),_0x5ab270[_0xa064('0x26')]);var _0x193b67=conferenceValidation[_0xa064('0x9')](_0x5ab270[_0xa064('0x26')]);if(_0x193b67['length']>0x0){return _0x8c7ea5['status'](0x190)[_0xa064('0x27')](_0x193b67);}var _0x527be0=_0x5ab270['body'][_0xa064('0x28')];return getAgent(_0x527be0)[_0xa064('0x1f')](function(_0x42eb6e){logger['info'](_0xa064('0x2c'),_0x42eb6e[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x42eb6e[_0xa064('0x14')]),'webbar:conference');return _0x8c7ea5[_0xa064('0x15')](0xc8)['json']({'error':![],'message':_0xa064('0x44')});})[_0xa064('0x1b')](handleError(_0x8c7ea5));};exports[_0xa064('0x45')]=function(_0x347820,_0x18d3a2){logger['info'](_0xa064('0x46'),_0x347820['body']);var _0x39dbec=transferValidation[_0xa064('0x9')](_0x347820[_0xa064('0x26')]);if(_0x39dbec[_0xa064('0x22')]>0x0){return _0x18d3a2['status'](0x190)[_0xa064('0x27')](_0x39dbec);}var _0x1fd3b6=_0x347820[_0xa064('0x26')][_0xa064('0x28')];var _0x50e8fd=_0x347820[_0xa064('0x26')][_0xa064('0x21')];var _0x27dbb8=_0x347820[_0xa064('0x26')][_0xa064('0x47')];return getAgent(_0x1fd3b6)[_0xa064('0x1f')](function(_0x528131){logger[_0xa064('0xf')]('entityFound:',_0x528131[_0xa064('0x14')]);emit(util[_0xa064('0x2d')](_0xa064('0x2e'),_0x528131[_0xa064('0x14')]),_0xa064('0x48'),{'sessionId':_0x50e8fd,'transferNumber':_0x27dbb8});return _0x18d3a2[_0xa064('0x15')](0xc8)[_0xa064('0x27')]({'error':![],'message':_0xa064('0x49')});})['catch'](handleError(_0x18d3a2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f496f75..5937589 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 _0xa15b=['create','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','/:id/send','put','update','delete','removeDispositions','removeAnswers','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','isAuthenticated','getAnswers','getAgents','/:id/applications','post'];(function(_0x217116,_0x29f7ca){var _0x556ac5=function(_0x25d337){while(--_0x25d337){_0x217116['push'](_0x217116['shift']());}};_0x556ac5(++_0x29f7ca);}(_0xa15b,0x8d));var _0xba15=function(_0x5322de,_0x564705){_0x5322de=_0x5322de-0x0;var _0x3ded50=_0xa15b[_0x5322de];return _0x3ded50;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba15('0x0'));var timeout=require(_0xba15('0x1'));var express=require('express');var router=express[_0xba15('0x2')]();var fs_extra=require(_0xba15('0x3'));var auth=require(_0xba15('0x4'));var interaction=require(_0xba15('0x5'));var config=require(_0xba15('0x6'));var controller=require('./whatsappAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xba15('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xba15('0x8')]);router[_0xba15('0x9')](_0xba15('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xba15('0xb'),auth['isAuthenticated'](),controller[_0xba15('0xc')]);router['get'](_0xba15('0xd'),auth[_0xba15('0xe')](),controller[_0xba15('0xf')]);router[_0xba15('0x9')]('/:id/users',auth[_0xba15('0xe')](),controller[_0xba15('0x10')]);router['get'](_0xba15('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xba15('0x12')]('/',auth[_0xba15('0xe')](),controller[_0xba15('0x13')]);router['post'](_0xba15('0xb'),auth[_0xba15('0xe')](),controller['addDisposition']);router['post'](_0xba15('0xd'),auth[_0xba15('0xe')](),controller[_0xba15('0x14')]);router[_0xba15('0x12')](_0xba15('0x15'),auth[_0xba15('0xe')](),controller[_0xba15('0x16')]);router[_0xba15('0x12')]('/:id/applications',auth['isAuthenticated'](),controller[_0xba15('0x17')]);router[_0xba15('0x12')](_0xba15('0x18'),controller['notify']);router[_0xba15('0x12')](_0xba15('0x19'),auth[_0xba15('0xe')](),controller['send']);router[_0xba15('0x1a')](_0xba15('0xa'),auth['isAuthenticated'](),controller[_0xba15('0x1b')]);router[_0xba15('0x1c')](_0xba15('0xa'),auth[_0xba15('0xe')](),controller['destroy']);router['delete'](_0xba15('0xb'),auth[_0xba15('0xe')](),controller[_0xba15('0x1d')]);router[_0xba15('0x1c')](_0xba15('0xd'),auth[_0xba15('0xe')](),controller[_0xba15('0x1e')]);router['delete']('/:id/users',auth[_0xba15('0xe')](),controller['removeAgents']);module[_0xba15('0x1f')]=router; \ No newline at end of file +var _0x7091=['put','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','Router','fs-extra','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send'];(function(_0x3615e1,_0x5d6f76){var _0x3189d4=function(_0x13cb1b){while(--_0x13cb1b){_0x3615e1['push'](_0x3615e1['shift']());}};_0x3189d4(++_0x5d6f76);}(_0x7091,0x1c1));var _0x1709=function(_0x5337c2,_0x8747e){_0x5337c2=_0x5337c2-0x0;var _0x5ef773=_0x7091[_0x5337c2];return _0x5ef773;};'use strict';var multer=require('multer');var util=require(_0x1709('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1709('0x1')]();var fs_extra=require(_0x1709('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1709('0x3'));router[_0x1709('0x4')]('/',auth[_0x1709('0x5')](),controller[_0x1709('0x6')]);router['get'](_0x1709('0x7'),auth[_0x1709('0x5')](),controller['describe']);router[_0x1709('0x4')](_0x1709('0x8'),auth[_0x1709('0x5')](),controller['show']);router[_0x1709('0x4')]('/:id/dispositions',auth[_0x1709('0x5')](),controller[_0x1709('0x9')]);router[_0x1709('0x4')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0xb')]);router[_0x1709('0x4')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0xd')]);router[_0x1709('0x4')](_0x1709('0xe'),auth[_0x1709('0x5')](),controller[_0x1709('0xf')]);router[_0x1709('0x10')]('/',auth[_0x1709('0x5')](),controller[_0x1709('0x11')]);router[_0x1709('0x10')](_0x1709('0x12'),auth['isAuthenticated'](),controller[_0x1709('0x13')]);router[_0x1709('0x10')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0x14')]);router[_0x1709('0x10')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0x15')]);router[_0x1709('0x10')](_0x1709('0xe'),auth['isAuthenticated'](),controller[_0x1709('0x16')]);router[_0x1709('0x10')](_0x1709('0x17'),controller[_0x1709('0x18')]);router[_0x1709('0x10')](_0x1709('0x19'),auth[_0x1709('0x5')](),controller[_0x1709('0x1a')]);router[_0x1709('0x1b')](_0x1709('0x8'),auth[_0x1709('0x5')](),controller[_0x1709('0x1c')]);router['delete'](_0x1709('0x8'),auth[_0x1709('0x5')](),controller['destroy']);router['delete'](_0x1709('0x12'),auth[_0x1709('0x5')](),controller[_0x1709('0x1d')]);router[_0x1709('0x1e')](_0x1709('0xa'),auth[_0x1709('0x5')](),controller[_0x1709('0x1f')]);router[_0x1709('0x1e')](_0x1709('0xc'),auth[_0x1709('0x5')](),controller[_0x1709('0x20')]);module[_0x1709('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1df96a0..28f6302 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 _0xd022=['STRING','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x15dd32,_0x468423){var _0x47002c=function(_0x3251a0){while(--_0x3251a0){_0x15dd32['push'](_0x15dd32['shift']());}};_0x47002c(++_0x468423);}(_0xd022,0xa6));var _0x2d02=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd022[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x2d02('0x0'));var rs=require(_0x2d02('0x1'));module[_0x2d02('0x2')]={'name':{'type':Sequelize[_0x2d02('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2d02('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2d02('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2d02('0x3')]},'type':{'type':Sequelize[_0x2d02('0x4')](_0x2d02('0x5'),_0x2d02('0x6'))},'accountSid':{'type':Sequelize[_0x2d02('0x3')]},'baseUrl':{'type':Sequelize[_0x2d02('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2d02('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2d02('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d02('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2d02('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d02('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d02('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d02('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2d02('0xa'),'set':function(_0x338706){if(!_0x338706){this[_0x2d02('0xb')](_0x2d02('0xc'),null);}this[_0x2d02('0xb')]('mandatoryDisposition',_0x338706);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc48=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc48,0x97));var _0x8bc4=function(_0x327ef7,_0xda9a90){_0x327ef7=_0x327ef7-0x0;var _0x14289a=_0xbc48[_0x327ef7];return _0x14289a;};'use strict';var Sequelize=require(_0x8bc4('0x0'));var rs=require(_0x8bc4('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8bc4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8bc4('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8bc4('0x3')]();}},'phone':{'type':Sequelize[_0x8bc4('0x2')]},'type':{'type':Sequelize[_0x8bc4('0x4')](_0x8bc4('0x5'),_0x8bc4('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8bc4('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8bc4('0x7')],'defaultValue':function(){return _0x8bc4('0x8');}},'notificationSound':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8bc4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8bc4('0xa')],'comment':_0x8bc4('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x8bc4('0x9')],'defaultValue':![],'comment':_0x8bc4('0xc'),'set':function(_0x808402){if(!_0x808402){this[_0x8bc4('0xd')](_0x8bc4('0xe'),null);}this[_0x8bc4('0xd')](_0x8bc4('0xf'),_0x808402);}},'description':{'type':Sequelize[_0x8bc4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6415cff..96c332b 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 _0xbfa1=['findAll','rows','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','findOne','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','unmanaged','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','Content-Type','\x0a','CmList','List','defaults','out','Messages','dataValues','push','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','stack','send','index','Pause','mandatoryDispositionPause','map','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','WhatsappAccount','include'];(function(_0x1ad93b,_0x56bee2){var _0x5c83a3=function(_0x425765){while(--_0x425765){_0x1ad93b['push'](_0x1ad93b['shift']());}};_0x5c83a3(++_0x56bee2);}(_0xbfa1,0x140));var _0x1bfa=function(_0x19e1d7,_0xee2378){_0x19e1d7=_0x19e1d7-0x0;var _0x13ea3b=_0xbfa1[_0x19e1d7];return _0x13ea3b;};'use strict';var emlformat=require(_0x1bfa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bfa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1bfa('0x2'));var BPromise=require(_0x1bfa('0x3'));var Mustache=require(_0x1bfa('0x4'));var util=require(_0x1bfa('0x5'));var path=require(_0x1bfa('0x6'));var sox=require(_0x1bfa('0x7'));var csv=require('to-csv');var ejs=require(_0x1bfa('0x8'));var fs=require('fs');var fs_extra=require(_0x1bfa('0x9'));var _=require(_0x1bfa('0xa'));var squel=require('squel');var crypto=require(_0x1bfa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1bfa('0xc'));var toCsv=require(_0x1bfa('0xd'));var querystring=require(_0x1bfa('0xe'));var Papa=require(_0x1bfa('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1bfa('0x10'));var as=require(_0x1bfa('0x11'));var hardwareService=require(_0x1bfa('0x12'));var logger=require(_0x1bfa('0x13'))(_0x1bfa('0x14'));var utils=require(_0x1bfa('0x15'));var config=require(_0x1bfa('0x16'));var licenseUtil=require(_0x1bfa('0x17'));var db=require(_0x1bfa('0x18'))['db'];config['redis']=_['defaults'](config[_0x1bfa('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bfa('0x1a'))(new Redis(config[_0x1bfa('0x19')]));require(_0x1bfa('0x1b'))[_0x1bfa('0x1c')](socket);var jayson=require(_0x1bfa('0x1d'));var client=jayson[_0x1bfa('0x1e')][_0x1bfa('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x293291,_0x42f10c,_0x2f771d,_0x49e167){return new BPromise(function(_0x39e747,_0x33c1fd){var _0x381072=_0x49e167||client;return _0x381072[_0x1bfa('0x20')](_0x293291,_0x2f771d)[_0x1bfa('0x21')](function(_0xa9d565){logger[_0x1bfa('0x22')](_0x1bfa('0x23'),_0x42f10c,_0x1bfa('0x24'));logger[_0x1bfa('0x25')](_0x1bfa('0x26'),_0x42f10c,_0x1bfa('0x24'),JSON['stringify'](_0xa9d565));if(_0xa9d565[_0x1bfa('0x27')]){if(_0xa9d565[_0x1bfa('0x27')]['code']===0x1f4){logger['error'](_0x1bfa('0x23'),_0x42f10c,_0xa9d565[_0x1bfa('0x27')]['message']);return _0x33c1fd(_0xa9d565['error'][_0x1bfa('0x28')]);}logger[_0x1bfa('0x27')](_0x1bfa('0x23'),_0x42f10c,_0xa9d565[_0x1bfa('0x27')][_0x1bfa('0x28')]);return _0x39e747(_0xa9d565[_0x1bfa('0x27')][_0x1bfa('0x28')]);}else{logger[_0x1bfa('0x22')](_0x1bfa('0x23'),_0x42f10c,_0x1bfa('0x24'));_0x39e747(_0xa9d565[_0x1bfa('0x29')][_0x1bfa('0x28')]);}})[_0x1bfa('0x2a')](function(_0x25ea2e){logger[_0x1bfa('0x27')](_0x1bfa('0x23'),_0x42f10c,_0x25ea2e);_0x33c1fd(_0x25ea2e);});});}function respondWithStatusCode(_0x5d9ea0,_0x31c219){_0x31c219=_0x31c219||0xcc;return function(_0x32f277){if(_0x32f277){return _0x5d9ea0[_0x1bfa('0x2b')](_0x31c219);}return _0x5d9ea0[_0x1bfa('0x2c')](_0x31c219)[_0x1bfa('0x2d')]();};}function respondWithResult(_0x25e242,_0x17e9c6){_0x17e9c6=_0x17e9c6||0xc8;return function(_0x4086c0){if(_0x4086c0){return _0x25e242[_0x1bfa('0x2c')](_0x17e9c6)['json'](_0x4086c0);}};}function respondWithFilteredResult(_0x4bb3e2,_0x2ec5c4){return function(_0x4139ed){if(_0x4139ed){var _0x5397e4=typeof _0x2ec5c4[_0x1bfa('0x2e')]==='undefined'&&typeof _0x2ec5c4[_0x1bfa('0x2f')]===_0x1bfa('0x30');var _0x5d0a47=_0x4139ed[_0x1bfa('0x31')];var _0x348431=_0x5397e4?0x0:_0x2ec5c4[_0x1bfa('0x2e')];var _0x8b3e4f=_0x5397e4?_0x4139ed[_0x1bfa('0x31')]:_0x2ec5c4['offset']+_0x2ec5c4[_0x1bfa('0x2f')];var _0x3dda2a;if(_0x8b3e4f>=_0x5d0a47){_0x8b3e4f=_0x5d0a47;_0x3dda2a=0xc8;}else{_0x3dda2a=0xce;}_0x4bb3e2[_0x1bfa('0x2c')](_0x3dda2a);return _0x4bb3e2[_0x1bfa('0x32')](_0x1bfa('0x33'),_0x348431+'-'+_0x8b3e4f+'/'+_0x5d0a47)[_0x1bfa('0x34')](_0x4139ed);}return null;};}function patchUpdates(_0x3c128d){return function(_0x420783){try{jsonpatch[_0x1bfa('0x35')](_0x420783,_0x3c128d,!![]);}catch(_0x15a24b){return BPromise[_0x1bfa('0x36')](_0x15a24b);}return _0x420783[_0x1bfa('0x37')]();};}function saveUpdates(_0x1caf23,_0x26fc70){return function(_0x5b77bd){if(_0x5b77bd){return _0x5b77bd[_0x1bfa('0x38')](_0x1caf23)['then'](function(_0x12cc24){return _0x12cc24;});}return null;};}function removeEntity(_0xafa8de,_0x13302a){return function(_0x24a396){if(_0x24a396){return _0x24a396[_0x1bfa('0x39')]()['then'](function(){var _0x48d069=_0x24a396[_0x1bfa('0x3a')]({'plain':!![]});var _0x34b478='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x34b478,'resourceId':_0x48d069['id']}})[_0x1bfa('0x21')](function(){return _0x24a396;});})[_0x1bfa('0x21')](function(){_0xafa8de[_0x1bfa('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3832b8,_0x392fc4){return function(_0x47d7b1){if(!_0x47d7b1){_0x3832b8[_0x1bfa('0x2b')](0x194);}return _0x47d7b1;};}function handleError(_0x1ec80e,_0x6dc8ca){_0x6dc8ca=_0x6dc8ca||0x1f4;return function(_0x1d624a){logger['error'](_0x1d624a[_0x1bfa('0x3b')]);if(_0x1d624a['name']){delete _0x1d624a['name'];}_0x1ec80e['status'](_0x6dc8ca)[_0x1bfa('0x3c')](_0x1d624a);};}exports[_0x1bfa('0x3d')]=function(_0x364a95,_0x42491c){var _0x52fe0d={'include':[{'model':db[_0x1bfa('0x3e')],'as':_0x1bfa('0x3f')}]},_0x5110fa={},_0x206840={'count':0x0,'rows':[]};var _0x10b069=_[_0x1bfa('0x40')](db['WhatsappAccount']['rawAttributes'],function(_0xea5831){return{'name':_0xea5831['fieldName'],'type':_0xea5831[_0x1bfa('0x41')][_0x1bfa('0x42')]};});_0x5110fa[_0x1bfa('0x43')]=_[_0x1bfa('0x40')](_0x10b069,_0x1bfa('0x44'));_0x5110fa['query']=_[_0x1bfa('0x45')](_0x364a95[_0x1bfa('0x46')]);_0x5110fa[_0x1bfa('0x47')]=_[_0x1bfa('0x48')](_0x5110fa[_0x1bfa('0x43')],_0x5110fa['query']);_0x52fe0d[_0x1bfa('0x49')]=_[_0x1bfa('0x48')](_0x5110fa[_0x1bfa('0x43')],qs['fields'](_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x4a')]));_0x52fe0d['attributes']=_0x52fe0d['attributes'][_0x1bfa('0x4b')]?_0x52fe0d[_0x1bfa('0x49')]:_0x5110fa[_0x1bfa('0x43')];if(!_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x4c')](_0x1bfa('0x4d'))){_0x52fe0d[_0x1bfa('0x2f')]=qs[_0x1bfa('0x2f')](_0x364a95[_0x1bfa('0x46')]['limit']);_0x52fe0d['offset']=qs['offset'](_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x2e')]);}_0x52fe0d['order']=qs[_0x1bfa('0x4e')](_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x4e')]);_0x52fe0d['where']=qs['filters'](_[_0x1bfa('0x4f')](_0x364a95[_0x1bfa('0x46')],_0x5110fa[_0x1bfa('0x47')]),_0x10b069);if(_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x50')]){_0x52fe0d[_0x1bfa('0x51')]=_[_0x1bfa('0x52')](_0x52fe0d[_0x1bfa('0x51')],{'$or':_[_0x1bfa('0x40')](_0x10b069,function(_0x2d3024){if(_0x2d3024[_0x1bfa('0x41')]!=='VIRTUAL'){var _0x583d70={};_0x583d70[_0x2d3024[_0x1bfa('0x44')]]={'$like':'%'+_0x364a95[_0x1bfa('0x46')][_0x1bfa('0x50')]+'%'};return _0x583d70;}})});}_0x52fe0d=_[_0x1bfa('0x52')]({},_0x52fe0d,_0x364a95[_0x1bfa('0x53')]);var _0x1694c7={'where':_0x52fe0d[_0x1bfa('0x51')]};return db[_0x1bfa('0x54')]['count'](_0x1694c7)[_0x1bfa('0x21')](function(_0x19090d){_0x206840[_0x1bfa('0x31')]=_0x19090d;if(_0x364a95[_0x1bfa('0x46')]['includeAll']){_0x52fe0d[_0x1bfa('0x55')]=[{'all':!![]}];}return db[_0x1bfa('0x54')][_0x1bfa('0x56')](_0x52fe0d);})[_0x1bfa('0x21')](function(_0x57d471){_0x206840[_0x1bfa('0x57')]=_0x57d471;return _0x206840;})['then'](respondWithFilteredResult(_0x42491c,_0x52fe0d))['catch'](handleError(_0x42491c,null));};exports[_0x1bfa('0x58')]=function(_0x125e88,_0x578a01){var _0x183aa0={'raw':![],'where':{'id':_0x125e88[_0x1bfa('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x1bfa('0x3f')}]},_0xd07ead={};_0xd07ead[_0x1bfa('0x43')]=_[_0x1bfa('0x45')](db[_0x1bfa('0x54')][_0x1bfa('0x5a')]);_0xd07ead[_0x1bfa('0x46')]=_[_0x1bfa('0x45')](_0x125e88[_0x1bfa('0x46')]);_0xd07ead[_0x1bfa('0x47')]=_[_0x1bfa('0x48')](_0xd07ead[_0x1bfa('0x43')],_0xd07ead[_0x1bfa('0x46')]);_0x183aa0['attributes']=_[_0x1bfa('0x48')](_0xd07ead[_0x1bfa('0x43')],qs[_0x1bfa('0x4a')](_0x125e88[_0x1bfa('0x46')][_0x1bfa('0x4a')]));_0x183aa0[_0x1bfa('0x49')]=_0x183aa0[_0x1bfa('0x49')][_0x1bfa('0x4b')]?_0x183aa0[_0x1bfa('0x49')]:_0xd07ead['model'];if(_0x125e88[_0x1bfa('0x46')][_0x1bfa('0x5b')]){_0x183aa0['include']=[{'all':!![]}];}_0x183aa0=_[_0x1bfa('0x52')]({},_0x183aa0,_0x125e88['options']);return db[_0x1bfa('0x54')][_0x1bfa('0x5c')](_0x183aa0)[_0x1bfa('0x21')](handleEntityNotFound(_0x578a01,null))[_0x1bfa('0x21')](respondWithResult(_0x578a01,null))[_0x1bfa('0x2a')](handleError(_0x578a01,null));};exports[_0x1bfa('0x5d')]=function(_0x576fee,_0x124b54){return db[_0x1bfa('0x54')][_0x1bfa('0x5d')](_0x576fee[_0x1bfa('0x5e')],{})[_0x1bfa('0x21')](function(_0x26636b){var _0x1d7556=_0x576fee[_0x1bfa('0x5f')][_0x1bfa('0x3a')]({'plain':!![]});if(!_0x1d7556)throw new Error(_0x1bfa('0x60'));if(_0x1d7556[_0x1bfa('0x61')]===_0x1bfa('0x5f')){var _0x9b56e1=_0x26636b[_0x1bfa('0x3a')]({'plain':!![]});var _0x5df590=_0x1bfa('0x62');return db[_0x1bfa('0x63')][_0x1bfa('0x5c')]({'where':{'name':_0x5df590,'userProfileId':_0x1d7556[_0x1bfa('0x64')]},'raw':!![]})[_0x1bfa('0x21')](function(_0xeee60e){if(_0xeee60e&&_0xeee60e['autoAssociation']===0x0){return db[_0x1bfa('0x65')][_0x1bfa('0x5d')]({'name':_0x9b56e1[_0x1bfa('0x44')],'resourceId':_0x9b56e1['id'],'type':_0xeee60e[_0x1bfa('0x44')],'sectionId':_0xeee60e['id']},{})[_0x1bfa('0x21')](function(){return _0x26636b;});}else{return _0x26636b;}})[_0x1bfa('0x2a')](function(_0x5e9f8d){logger['error'](_0x1bfa('0x66'),_0x5e9f8d);throw _0x5e9f8d;});}return _0x26636b;})[_0x1bfa('0x21')](respondWithResult(_0x124b54,0xc9))[_0x1bfa('0x2a')](handleError(_0x124b54,null));};exports['update']=function(_0x2f2716,_0x126c20){if(_0x2f2716['body']['id']){delete _0x2f2716[_0x1bfa('0x5e')]['id'];}return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0x2f2716[_0x1bfa('0x59')]['id']},'include':[{'model':db[_0x1bfa('0x3e')],'as':_0x1bfa('0x3f')}]})[_0x1bfa('0x21')](handleEntityNotFound(_0x126c20,null))[_0x1bfa('0x21')](saveUpdates(_0x2f2716[_0x1bfa('0x5e')],null))[_0x1bfa('0x21')](respondWithResult(_0x126c20,null))[_0x1bfa('0x2a')](handleError(_0x126c20,null));};exports[_0x1bfa('0x39')]=function(_0x1cfcf3,_0x520265){return db['WhatsappAccount'][_0x1bfa('0x5c')]({'where':{'id':_0x1cfcf3['params']['id']}})['then'](handleEntityNotFound(_0x520265,null))['then'](removeEntity(_0x520265,null))[_0x1bfa('0x2a')](handleError(_0x520265,null));};exports[_0x1bfa('0x67')]=function(_0x302f65,_0x59d155){return db['WhatsappAccount']['describe']()[_0x1bfa('0x21')](respondWithResult(_0x59d155,null))[_0x1bfa('0x2a')](handleError(_0x59d155,null));};exports[_0x1bfa('0x68')]=function(_0x24456b,_0x21c0bb,_0x1998ee){if(_0x24456b['body']['id']){delete _0x24456b['body']['id'];}return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0x24456b[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x21c0bb,null))[_0x1bfa('0x21')](function(_0xdd3ed){if(_0xdd3ed){_0x24456b[_0x1bfa('0x5e')][_0x1bfa('0x69')]=_0xdd3ed['id'];return db[_0x1bfa('0x6a')][_0x1bfa('0x5d')](_0x24456b[_0x1bfa('0x5e')]);}})[_0x1bfa('0x21')](respondWithResult(_0x21c0bb,null))['catch'](handleError(_0x21c0bb,null));};exports['getDispositions']=function(_0x3fbbfa,_0x227324,_0x16352d){var _0x5631a8={'raw':![],'where':{}};var _0x56a01c={};var _0x5bb2b7={'count':0x0,'rows':[]};return db[_0x1bfa('0x54')][_0x1bfa('0x6b')]({'where':{'id':_0x3fbbfa[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x227324,null))['then'](function(_0x2a2c32){if(_0x2a2c32){_0x56a01c['model']=_[_0x1bfa('0x45')](db['Disposition']['rawAttributes']);_0x56a01c[_0x1bfa('0x46')]=_[_0x1bfa('0x45')](_0x3fbbfa[_0x1bfa('0x46')]);_0x56a01c[_0x1bfa('0x47')]=_[_0x1bfa('0x48')](_0x56a01c[_0x1bfa('0x43')],_0x56a01c[_0x1bfa('0x46')]);_0x5631a8[_0x1bfa('0x49')]=_[_0x1bfa('0x48')](_0x56a01c[_0x1bfa('0x43')],qs[_0x1bfa('0x4a')](_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x4a')]));_0x5631a8['attributes']=_0x5631a8[_0x1bfa('0x49')][_0x1bfa('0x4b')]?_0x5631a8[_0x1bfa('0x49')]:_0x56a01c[_0x1bfa('0x43')];if(!_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x4c')](_0x1bfa('0x4d'))){_0x5631a8[_0x1bfa('0x2f')]=qs[_0x1bfa('0x2f')](_0x3fbbfa[_0x1bfa('0x46')]['limit']);_0x5631a8[_0x1bfa('0x2e')]=qs[_0x1bfa('0x2e')](_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x2e')]);}_0x5631a8[_0x1bfa('0x6c')]=qs[_0x1bfa('0x4e')](_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x4e')]);_0x5631a8[_0x1bfa('0x51')]=qs['filters'](_['pick'](_0x3fbbfa['query'],_0x56a01c['filters']));_0x5631a8[_0x1bfa('0x51')][_0x1bfa('0x69')]=_0x2a2c32['id'];if(_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x50')]){_0x5631a8[_0x1bfa('0x51')]=_[_0x1bfa('0x52')](_0x5631a8[_0x1bfa('0x51')],{'$or':_[_0x1bfa('0x40')](_0x5631a8[_0x1bfa('0x49')],function(_0x435c0a){var _0xf096ba={};_0xf096ba[_0x435c0a]={'$like':'%'+_0x3fbbfa['query'][_0x1bfa('0x50')]+'%'};return _0xf096ba;})});}_0x5631a8=_['merge']({},_0x5631a8,_0x3fbbfa[_0x1bfa('0x53')]);return db[_0x1bfa('0x6a')][_0x1bfa('0x31')]({'where':_0x5631a8[_0x1bfa('0x51')]})[_0x1bfa('0x21')](function(_0x5b1ecc){_0x5bb2b7['count']=_0x5b1ecc;if(_0x3fbbfa[_0x1bfa('0x46')][_0x1bfa('0x5b')]){_0x5631a8['include']=[{'all':!![]}];}return db[_0x1bfa('0x6a')]['findAll'](_0x5631a8);})[_0x1bfa('0x21')](function(_0x3b13a6){_0x5bb2b7[_0x1bfa('0x57')]=_0x3b13a6;return _0x5bb2b7;});}})[_0x1bfa('0x21')](respondWithFilteredResult(_0x227324,_0x5631a8))[_0x1bfa('0x2a')](handleError(_0x227324,null));};exports['removeDispositions']=function(_0x5a78a3,_0x208167,_0x3fb6bf){return db[_0x1bfa('0x54')]['find']({'where':{'id':_0x5a78a3[_0x1bfa('0x59')]['id']}})['then'](handleEntityNotFound(_0x208167,null))['then'](function(_0x4a7b54){if(_0x4a7b54){return _0x4a7b54[_0x1bfa('0x6d')](_0x5a78a3[_0x1bfa('0x46')]['ids']);}})[_0x1bfa('0x21')](respondWithStatusCode(_0x208167,null))[_0x1bfa('0x2a')](handleError(_0x208167,null));};exports[_0x1bfa('0x6e')]=function(_0x4a7e16,_0x309ab6,_0x39f3e8){if(_0x4a7e16[_0x1bfa('0x5e')]['id']){delete _0x4a7e16[_0x1bfa('0x5e')]['id'];}return db[_0x1bfa('0x54')]['find']({'where':{'id':_0x4a7e16[_0x1bfa('0x59')]['id']}})['then'](handleEntityNotFound(_0x309ab6,null))[_0x1bfa('0x21')](function(_0x53af5e){if(_0x53af5e){_0x4a7e16[_0x1bfa('0x5e')][_0x1bfa('0x69')]=_0x53af5e['id'];return db[_0x1bfa('0x6f')][_0x1bfa('0x5d')](_0x4a7e16[_0x1bfa('0x5e')]);}})[_0x1bfa('0x21')](respondWithResult(_0x309ab6,null))[_0x1bfa('0x2a')](handleError(_0x309ab6,null));};exports[_0x1bfa('0x70')]=function(_0x35af4c,_0x59be36,_0x198eca){var _0x321faf={'raw':![],'where':{}};var _0x2bb08f={};var _0x3944e8={'count':0x0,'rows':[]};return db[_0x1bfa('0x54')][_0x1bfa('0x6b')]({'where':{'id':_0x35af4c['params']['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x59be36,null))[_0x1bfa('0x21')](function(_0x471524){if(_0x471524){_0x2bb08f[_0x1bfa('0x43')]=_[_0x1bfa('0x45')](db['CannedAnswer'][_0x1bfa('0x5a')]);_0x2bb08f[_0x1bfa('0x46')]=_[_0x1bfa('0x45')](_0x35af4c[_0x1bfa('0x46')]);_0x2bb08f[_0x1bfa('0x47')]=_['intersection'](_0x2bb08f[_0x1bfa('0x43')],_0x2bb08f[_0x1bfa('0x46')]);_0x321faf[_0x1bfa('0x49')]=_[_0x1bfa('0x48')](_0x2bb08f[_0x1bfa('0x43')],qs['fields'](_0x35af4c['query'][_0x1bfa('0x4a')]));_0x321faf['attributes']=_0x321faf['attributes'][_0x1bfa('0x4b')]?_0x321faf[_0x1bfa('0x49')]:_0x2bb08f[_0x1bfa('0x43')];if(!_0x35af4c[_0x1bfa('0x46')][_0x1bfa('0x4c')](_0x1bfa('0x4d'))){_0x321faf[_0x1bfa('0x2f')]=qs[_0x1bfa('0x2f')](_0x35af4c[_0x1bfa('0x46')][_0x1bfa('0x2f')]);_0x321faf['offset']=qs[_0x1bfa('0x2e')](_0x35af4c['query'][_0x1bfa('0x2e')]);}_0x321faf[_0x1bfa('0x6c')]=qs[_0x1bfa('0x4e')](_0x35af4c[_0x1bfa('0x46')][_0x1bfa('0x4e')]);_0x321faf['where']=qs[_0x1bfa('0x47')](_[_0x1bfa('0x4f')](_0x35af4c[_0x1bfa('0x46')],_0x2bb08f[_0x1bfa('0x47')]));_0x321faf[_0x1bfa('0x51')][_0x1bfa('0x69')]=_0x471524['id'];if(_0x35af4c[_0x1bfa('0x46')][_0x1bfa('0x50')]){_0x321faf[_0x1bfa('0x51')]=_[_0x1bfa('0x52')](_0x321faf['where'],{'$or':_[_0x1bfa('0x40')](_0x321faf[_0x1bfa('0x49')],function(_0x513f1e){var _0x2c17af={};_0x2c17af[_0x513f1e]={'$like':'%'+_0x35af4c[_0x1bfa('0x46')]['filter']+'%'};return _0x2c17af;})});}_0x321faf=_[_0x1bfa('0x52')]({},_0x321faf,_0x35af4c[_0x1bfa('0x53')]);return db[_0x1bfa('0x6f')][_0x1bfa('0x31')]({'where':_0x321faf['where']})[_0x1bfa('0x21')](function(_0x2ef17){_0x3944e8['count']=_0x2ef17;if(_0x35af4c[_0x1bfa('0x46')]['includeAll']){_0x321faf[_0x1bfa('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1bfa('0x56')](_0x321faf);})[_0x1bfa('0x21')](function(_0x28a160){_0x3944e8[_0x1bfa('0x57')]=_0x28a160;return _0x3944e8;});}})[_0x1bfa('0x21')](respondWithFilteredResult(_0x59be36,_0x321faf))[_0x1bfa('0x2a')](handleError(_0x59be36,null));};exports[_0x1bfa('0x71')]=function(_0x1f9d16,_0x54c981,_0x547b6d){return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0x1f9d16[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x54c981,null))[_0x1bfa('0x21')](function(_0x2f687d){if(_0x2f687d){return _0x2f687d[_0x1bfa('0x71')](_0x1f9d16[_0x1bfa('0x46')][_0x1bfa('0x72')]);}})[_0x1bfa('0x21')](respondWithStatusCode(_0x54c981,null))[_0x1bfa('0x2a')](handleError(_0x54c981,null));};exports[_0x1bfa('0x73')]=function(_0xd4887c,_0x5adbe2,_0x2032cc){return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0xd4887c[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x5adbe2,null))[_0x1bfa('0x21')](function(_0x45eb66){if(_0x45eb66){return _0x45eb66['addAgents'](_0xd4887c[_0x1bfa('0x5e')][_0x1bfa('0x72')],_['omit'](_0xd4887c[_0x1bfa('0x5e')],['ids','id'])||{})[_0x1bfa('0x74')](function(_0x3e9093){for(var _0x51305e=0x0;_0x51305e<_0xd4887c['body']['ids'][_0x1bfa('0x4b')];_0x51305e+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0xd4887c[_0x1bfa('0x5e')][_0x1bfa('0x72')][_0x51305e]),'WhatsappAccountId':Number(_0xd4887c['params']['id'])});}return _0x3e9093;});}})[_0x1bfa('0x21')](respondWithResult(_0x5adbe2,null))[_0x1bfa('0x2a')](handleError(_0x5adbe2,null));};exports[_0x1bfa('0x75')]=function(_0xd1abf1,_0x9406,_0x203d4f){return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0xd1abf1[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x9406,null))[_0x1bfa('0x21')](function(_0x474d2d){if(_0x474d2d){return _0x474d2d[_0x1bfa('0x75')](_0xd1abf1[_0x1bfa('0x46')]['ids'])['then'](function(){if(_[_0x1bfa('0x76')](_0xd1abf1['query']['ids'])){for(var _0xa2d392=0x0;_0xa2d392<_0xd1abf1[_0x1bfa('0x46')][_0x1bfa('0x72')][_0x1bfa('0x4b')];_0xa2d392+=0x1){socket['emit'](_0x1bfa('0x77'),{'UserId':Number(_0xd1abf1[_0x1bfa('0x46')][_0x1bfa('0x72')][_0xa2d392]),'WhatsappAccountId':Number(_0xd1abf1[_0x1bfa('0x59')]['id'])});}}else{socket[_0x1bfa('0x78')](_0x1bfa('0x77'),{'UserId':Number(_0xd1abf1[_0x1bfa('0x46')][_0x1bfa('0x72')]),'WhatsappAccountId':Number(_0xd1abf1[_0x1bfa('0x59')]['id'])});}});}})[_0x1bfa('0x21')](respondWithStatusCode(_0x9406,null))['catch'](handleError(_0x9406,null));};exports[_0x1bfa('0x79')]=function(_0x4b5657,_0x1ae415,_0x4bc83a){var _0x2878ca={};var _0x509dbd={};var _0x4fc908;var _0x65050a;return db[_0x1bfa('0x54')][_0x1bfa('0x6b')]({'where':{'id':_0x4b5657['params']['id']}})['then'](handleEntityNotFound(_0x1ae415,null))[_0x1bfa('0x21')](function(_0x1ffa77){if(_0x1ffa77){_0x4fc908=_0x1ffa77;_0x509dbd[_0x1bfa('0x43')]=_['keys'](db[_0x1bfa('0x7a')][_0x1bfa('0x5a')]);_0x509dbd[_0x1bfa('0x46')]=_['keys'](_0x4b5657['query']);_0x509dbd['filters']=_[_0x1bfa('0x48')](_0x509dbd['model'],_0x509dbd[_0x1bfa('0x46')]);_0x2878ca['attributes']=_[_0x1bfa('0x48')](_0x509dbd[_0x1bfa('0x43')],qs[_0x1bfa('0x4a')](_0x4b5657[_0x1bfa('0x46')][_0x1bfa('0x4a')]));_0x2878ca[_0x1bfa('0x49')]=_0x2878ca['attributes'][_0x1bfa('0x4b')]?_0x2878ca['attributes']:_0x509dbd[_0x1bfa('0x43')];_0x2878ca[_0x1bfa('0x6c')]=qs[_0x1bfa('0x4e')](_0x4b5657[_0x1bfa('0x46')][_0x1bfa('0x4e')]);_0x2878ca['where']=qs[_0x1bfa('0x47')](_[_0x1bfa('0x4f')](_0x4b5657[_0x1bfa('0x46')],_0x509dbd[_0x1bfa('0x47')]));if(_0x4b5657[_0x1bfa('0x46')]['filter']){_0x2878ca[_0x1bfa('0x51')]=_[_0x1bfa('0x52')](_0x2878ca[_0x1bfa('0x51')],{'$or':_[_0x1bfa('0x40')](_0x2878ca[_0x1bfa('0x49')],function(_0x16e18a){var _0xa54454={};_0xa54454[_0x16e18a]={'$like':'%'+_0x4b5657[_0x1bfa('0x46')][_0x1bfa('0x50')]+'%'};return _0xa54454;})});}_0x2878ca=_[_0x1bfa('0x52')]({},_0x2878ca,_0x4b5657['options']);return _0x4fc908[_0x1bfa('0x79')](_0x2878ca);}})[_0x1bfa('0x21')](function(_0x5a7840){if(_0x5a7840){_0x65050a=_0x5a7840[_0x1bfa('0x4b')];if(!_0x4b5657['query'][_0x1bfa('0x4c')](_0x1bfa('0x4d'))){_0x2878ca[_0x1bfa('0x2f')]=qs[_0x1bfa('0x2f')](_0x4b5657['query']['limit']);_0x2878ca[_0x1bfa('0x2e')]=qs[_0x1bfa('0x2e')](_0x4b5657[_0x1bfa('0x46')]['offset']);}return _0x4fc908[_0x1bfa('0x79')](_0x2878ca);}})[_0x1bfa('0x21')](function(_0x3bf39e){if(_0x3bf39e){return _0x3bf39e?{'count':_0x65050a,'rows':_0x3bf39e}:null;}})['then'](respondWithResult(_0x1ae415,null))[_0x1bfa('0x2a')](handleError(_0x1ae415,null));};exports[_0x1bfa('0x7b')]=function(_0x32ba2c,_0x497070){var _0x399ca4=_0x32ba2c[_0x1bfa('0x59')]['id'];var _0x4ffc50=_0x32ba2c[_0x1bfa('0x5e')];var _0x348d52=0xc8;var _0x356970=null;return db[_0x1bfa('0x7c')][_0x1bfa('0x7d')]({'isolationLevel':db[_0x1bfa('0x7c')][_0x1bfa('0x7e')][_0x1bfa('0x7f')][_0x1bfa('0x80')]},function(_0x27f40d){return db[_0x1bfa('0x54')][_0x1bfa('0x6b')]({'where':{'id':_0x399ca4},'transaction':_0x27f40d})['then'](function(_0x46dac2){if(_0x46dac2){return db[_0x1bfa('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x399ca4},'transaction':_0x27f40d})[_0x1bfa('0x21')](function(){var _0x3ad0f4=_[_0x1bfa('0x40')](_0x4ffc50,function(_0x3711d0){_0x3711d0[_0x1bfa('0x69')]=_0x399ca4;return _0x3711d0;});return db[_0x1bfa('0x81')][_0x1bfa('0x82')](_0x3ad0f4,{'transaction':_0x27f40d});});}else{_0x348d52=0x194;_0x356970=[];}});})[_0x1bfa('0x21')](function(){if(_0x348d52!==0x194){return db[_0x1bfa('0x81')][_0x1bfa('0x83')]({'where':{'WhatsappAccountId':_0x399ca4},'order':_0x1bfa('0x84')})[_0x1bfa('0x21')](function(_0x52974f){_0x356970=_0x52974f;});}})['catch'](function(_0x47e5f9){_0x348d52=0x1f4;logger[_0x1bfa('0x27')](_0x47e5f9[_0x1bfa('0x3b')]);if(_0x47e5f9['name']){delete _0x47e5f9[_0x1bfa('0x44')];}_0x356970=_0x47e5f9;})[_0x1bfa('0x85')](function(){if(_0x356970===null){_0x497070[_0x1bfa('0x2b')](_0x348d52);}else{if(_0x348d52===0x1f4){_0x497070[_0x1bfa('0x2c')](_0x348d52)[_0x1bfa('0x3c')](_0x356970);}else{_0x497070[_0x1bfa('0x2c')](_0x348d52)['json'](_0x356970);}}});};exports[_0x1bfa('0x86')]=function(_0x2469cc,_0x405a1b,_0x153cb7){var _0x425460={};var _0x4e98af={};var _0x55672c;var _0x567584;return db['WhatsappAccount'][_0x1bfa('0x6b')]({'where':{'id':_0x2469cc[_0x1bfa('0x59')]['id']}})[_0x1bfa('0x21')](handleEntityNotFound(_0x405a1b,null))[_0x1bfa('0x21')](function(_0x1887c5){if(_0x1887c5){_0x55672c=_0x1887c5;_0x4e98af[_0x1bfa('0x43')]=_[_0x1bfa('0x45')](db[_0x1bfa('0x81')][_0x1bfa('0x5a')]);_0x4e98af[_0x1bfa('0x46')]=_[_0x1bfa('0x45')](_0x2469cc['query']);_0x4e98af[_0x1bfa('0x47')]=_['intersection'](_0x4e98af[_0x1bfa('0x43')],_0x4e98af[_0x1bfa('0x46')]);_0x425460[_0x1bfa('0x49')]=_[_0x1bfa('0x48')](_0x4e98af[_0x1bfa('0x43')],qs[_0x1bfa('0x4a')](_0x2469cc[_0x1bfa('0x46')][_0x1bfa('0x4a')]));_0x425460[_0x1bfa('0x49')]=_0x425460[_0x1bfa('0x49')][_0x1bfa('0x4b')]?_0x425460[_0x1bfa('0x49')]:_0x4e98af[_0x1bfa('0x43')];_0x425460['order']=qs[_0x1bfa('0x4e')](_0x2469cc[_0x1bfa('0x46')]['sort']);_0x425460[_0x1bfa('0x51')]=qs[_0x1bfa('0x47')](_[_0x1bfa('0x4f')](_0x2469cc[_0x1bfa('0x46')],_0x4e98af[_0x1bfa('0x47')]));if(_0x2469cc[_0x1bfa('0x46')][_0x1bfa('0x50')]){_0x425460[_0x1bfa('0x51')]=_['merge'](_0x425460['where'],{'$or':_['map'](_0x425460[_0x1bfa('0x49')],function(_0x579159){var _0x70f322={};_0x70f322[_0x579159]={'$like':'%'+_0x2469cc[_0x1bfa('0x46')][_0x1bfa('0x50')]+'%'};return _0x70f322;})});}_0x425460=_['merge']({},_0x425460,_0x2469cc[_0x1bfa('0x53')]);return _0x55672c[_0x1bfa('0x86')](_0x425460);}})[_0x1bfa('0x21')](function(_0x529b3c){if(_0x529b3c){_0x567584=_0x529b3c[_0x1bfa('0x4b')];if(!_0x2469cc[_0x1bfa('0x46')][_0x1bfa('0x4c')](_0x1bfa('0x4d'))){_0x425460['limit']=qs[_0x1bfa('0x2f')](_0x2469cc[_0x1bfa('0x46')][_0x1bfa('0x2f')]);_0x425460[_0x1bfa('0x2e')]=qs[_0x1bfa('0x2e')](_0x2469cc[_0x1bfa('0x46')]['offset']);}return _0x55672c[_0x1bfa('0x86')](_0x425460);}})[_0x1bfa('0x21')](function(_0x59c7bb){if(_0x59c7bb){return _0x59c7bb?{'count':_0x567584,'rows':_0x59c7bb}:null;}})['then'](respondWithResult(_0x405a1b,null))[_0x1bfa('0x2a')](handleError(_0x405a1b,null));};exports[_0x1bfa('0x87')]=function(_0x1b4844,_0x5f2a8f,_0x51b02b){var _0x56e1b3={'channel':_0x1bfa('0x88')};var _0x294174=[];var _0x2b36a0=[];var _0x214470={};return db[_0x1bfa('0x54')][_0x1bfa('0x5c')]({'where':{'id':_0x1b4844['params']['id']},'include':[{'model':db[_0x1bfa('0x81')],'as':_0x1bfa('0x89')}]})['then'](handleEntityNotFound(_0x5f2a8f,null))['then'](function(_0x13e10b){_0x56e1b3['account']=_0x13e10b;if(_0x56e1b3[_0x1bfa('0x8a')]&&_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0x41')]===_0x1bfa('0x8b')&&_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0x8c')]){if(_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0x8c')][_0x1bfa('0x4b')]===0x0)return;if(_0x1b4844[_0x1bfa('0x5e')]['statuses'][0x0]['state']!==_0x1bfa('0x8d'))return;return db['WhatsappMessage'][_0x1bfa('0x38')]({'read':!![],'readAt':_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x1b4844['body'][_0x1bfa('0x8c')][0x0][_0x1bfa('0x8e')]},'individualHooks':!![]})[_0x1bfa('0x21')](function(_0x40e2ba){return _0x5f2a8f[_0x1bfa('0x2c')](0xc8)['json'](_0x40e2ba);});}_0x56e1b3[_0x1bfa('0x8f')]=_[_0x1bfa('0x90')](_0x13e10b[_0x1bfa('0x89')],[_0x1bfa('0x84')],[_0x1bfa('0x91')]);if(_0x56e1b3['account'][_0x1bfa('0x89')]){delete _0x56e1b3[_0x1bfa('0x8a')]['Applications'];}return db[_0x1bfa('0x92')][_0x1bfa('0x67')]()['then'](function(_0x42a956){if(!_0x42a956){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))](_0x1bfa('0x95'));}_0x294174=_[_0x1bfa('0x96')](_[_0x1bfa('0x45')](_0x42a956),[_0x1bfa('0x97'),_0x1bfa('0x98')]);_0x2b36a0=_[_0x1bfa('0x96')](_[_0x1bfa('0x45')](_0x42a956),['createdAt',_0x1bfa('0x98'),_0x1bfa('0x99'),'ListId']);_0x56e1b3[_0x1bfa('0x5e')]={'mapKey':'mobile'};if(_0x56e1b3['account']&&_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0x41')]===_0x1bfa('0x9a')){_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x9b')]=_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0x9c')][_0x1bfa('0x9d')](_0x1bfa('0x9e'),'');_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x5e')]=_0x1b4844['body']['Body'];_0x56e1b3['body'][_0x1bfa('0x9f')]=_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0xa0')];}if(_0x56e1b3['account']&&_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0x41')]===_0x1bfa('0x8b')){_0x56e1b3['body'][_0x1bfa('0x9b')]=_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0xa1')][0x0][_0x1bfa('0x9b')];_0x56e1b3['body']['body']=_0x1b4844['body'][_0x1bfa('0xa1')][0x0][_0x1bfa('0x28')]['body'];_0x56e1b3[_0x1bfa('0x5e')]['messageId']=_0x1b4844[_0x1bfa('0x5e')][_0x1bfa('0xa1')][0x0][_0x1bfa('0x8e')];}if(_0x56e1b3[_0x1bfa('0x5e')]['id']){delete _0x56e1b3[_0x1bfa('0x5e')]['id'];}if(_[_0x1bfa('0xa2')](_0x56e1b3[_0x1bfa('0x5e')]['from'])){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))](_0x1bfa('0xa3'));}if(_[_0x1bfa('0xa2')](_0x56e1b3[_0x1bfa('0x5e')]['body'])||_0x56e1b3['body'][_0x1bfa('0x5e')]===''){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))](_0x1bfa('0xa4'));}if(_[_0x1bfa('0xa2')](_0x56e1b3[_0x1bfa('0x5e')]['mapKey'])){throw new db[(_0x1bfa('0x93'))]['ValidationError'](_0x1bfa('0xa5')+_0x2b36a0);}if(!_[_0x1bfa('0xa6')](_0x2b36a0,_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0xa7')])){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))](_0x1bfa('0xa8')+_0x2b36a0);}_0x214470[_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0xa7')]]=_0x56e1b3['body'][_0x1bfa('0x9b')];return db['CmList'][_0x1bfa('0x5c')]({'where':{'id':_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0xa9')]},'include':[{'model':db[_0x1bfa('0x92')],'as':'Contacts','where':_0x214470,'limit':0x1,'order':[[_0x1bfa('0x98'),_0x1bfa('0xaa')]]}]});})[_0x1bfa('0x21')](handleEntityNotFound(_0x5f2a8f,null))[_0x1bfa('0x21')](function(_0x1a239e){if(_0x1a239e){_0x56e1b3[_0x1bfa('0xab')]=_['omit'](_0x1a239e,[_0x1bfa('0xac')]);if(_0x1a239e[_0x1bfa('0xac')]['length']){return _0x1a239e[_0x1bfa('0xac')][0x0];}var _0x23d57e=_['defaults'](_0x56e1b3[_0x1bfa('0x5e')],{'firstName':_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x9b')],'ListId':_0x1a239e['id']});_0x23d57e[_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0xa7')]]=_0x56e1b3[_0x1bfa('0x5e')]['from'];return db['CmContact'][_0x1bfa('0x5d')](_0x23d57e,{'fields':_0x294174,'raw':!![]});}})[_0x1bfa('0x21')](handleEntityNotFound(_0x5f2a8f,null))['then'](function(_0x41c961){if(_0x41c961){_0x56e1b3[_0x1bfa('0xad')]=_0x41c961;var _0x3fcc76={'ContactId':_0x41c961['id'],'phone':_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x9b')],'WhatsappAccountId':_0x1b4844[_0x1bfa('0x59')]['id']};var _0x302881={'ContactId':_0x41c961['id'],'WhatsappAccountId':_0x1b4844[_0x1bfa('0x59')]['id'],'closed':![]};return db[_0x1bfa('0xae')][_0x1bfa('0x5c')]({'where':_0x302881})[_0x1bfa('0x21')](function(_0x2c9c95){if(_0x2c9c95){return[_0x2c9c95,![]];}return db[_0x1bfa('0xae')][_0x1bfa('0x5d')](_0x3fcc76)['then'](function(_0x1d84ce){return[_0x1d84ce,!![]];});});}})[_0x1bfa('0x74')](function(_0x1991ef,_0x3ea50a){_0x56e1b3[_0x1bfa('0xaf')]=_0x1991ef[_0x1bfa('0x3a')]({'plain':!![]});_0x56e1b3[_0x1bfa('0xaf')]['created']=![];if(_0x3ea50a){if(_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0xb0')]){_0x56e1b3['applications']['push']({'id':0x0,'priority':_0x56e1b3[_0x1bfa('0x8f')][_0x1bfa('0x4b')]+0x1,'app':'close','appdata':_0x1bfa('0xb1'),'interval':'*,*,*,*'});}_0x56e1b3[_0x1bfa('0xaf')][_0x1bfa('0xb2')]=!![];}return db[_0x1bfa('0xb3')][_0x1bfa('0x5d')]({'phone':_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x9b')],'messageId':_0x56e1b3[_0x1bfa('0x5e')][_0x1bfa('0x9f')],'body':_0x56e1b3['body'][_0x1bfa('0x5e')],'WhatsappAccountId':_0x1b4844['params']['id'],'WhatsappInteractionId':_0x1991ef['id'],'direction':'in','ContactId':_0x1991ef[_0x1bfa('0xb4')],'AttachmentId':_0x56e1b3['body'][_0x1bfa('0xb5')]});})[_0x1bfa('0x21')](function(_0x50d525){_0x56e1b3['message']=_0x50d525;if(!_0x56e1b3[_0x1bfa('0xaf')][_0x1bfa('0xb6')])return;return db['User']['find']({'attributes':['id',_0x1bfa('0x44')],'where':{'id':_0x56e1b3[_0x1bfa('0xaf')]['UserId']}});})['then'](function(_0x433854){if(_0x433854){_0x56e1b3['applications'][_0x1bfa('0xb7')]({'id':0x0,'priority':0x0,'app':_0x1bfa('0xb8'),'appdata':_0x433854['name']+','+(_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0xb9')]||0xa),'interval':_0x1bfa('0xba')});}if(!_0x56e1b3[_0x1bfa('0xaf')][_0x1bfa('0xbb')])return;return db[_0x1bfa('0xbc')][_0x1bfa('0x5c')]({'attributes':['id',_0x1bfa('0x44')],'where':{'id':_0x56e1b3[_0x1bfa('0xaf')][_0x1bfa('0xbb')]}});})[_0x1bfa('0x21')](function(_0x9f6e1b){if(_0x9f6e1b){_0x56e1b3[_0x1bfa('0x8f')][_0x1bfa('0xb7')]({'id':0x0,'priority':0x1,'app':_0x1bfa('0xbd'),'appdata':_0x9f6e1b[_0x1bfa('0x44')]+','+(_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0xbe')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1bfa('0xbf'),_0x1bfa('0xc0'),_0x56e1b3);})[_0x1bfa('0x21')](function(_0x14ddf8){if(_0x14ddf8){var _0x5e1f59=0xc8;var _0x4a8df9='receiveMessage';logger[_0x1bfa('0x22')](_0x1bfa('0x26'),_0x4a8df9,_0x5e1f59,_0x1bfa('0xc1'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4a8df9,_0x5e1f59,_0x1bfa('0xc1'),JSON['stringify'](_0x14ddf8));if(_0x56e1b3[_0x1bfa('0x8a')][_0x1bfa('0x41')]===_0x1bfa('0x9a')){return _0x5f2a8f[_0x1bfa('0x2c')](_0x5e1f59)[_0x1bfa('0x32')](_0x1bfa('0xc2'),'text/xml')[_0x1bfa('0x3c')](_0x1bfa('0xc3'));}else{return _0x5f2a8f['status'](_0x5e1f59)['json'](_0x14ddf8);}}});})[_0x1bfa('0x2a')](handleError(_0x5f2a8f,null));};exports[_0x1bfa('0x3c')]=function(_0xd7b005,_0x4db287,_0x6a71c){var _0x35227e,_0x633ce0,_0x4a664a;if(_[_0x1bfa('0xa2')](_0xd7b005[_0x1bfa('0x5e')]['body'])||_0xd7b005['body'][_0x1bfa('0x5e')]===''){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))](_0x1bfa('0xa4'));}if(_[_0x1bfa('0xa2')](_0xd7b005[_0x1bfa('0x5e')]['to'])){throw new db[(_0x1bfa('0x93'))][(_0x1bfa('0x94'))]('to\x20is\x20mandatory');}_0x35227e=_0xd7b005[_0x1bfa('0x5e')]['to'];return db['WhatsappAccount'][_0x1bfa('0x5c')]({'where':{'id':_0xd7b005[_0x1bfa('0x59')]['id']},'include':[{'model':db[_0x1bfa('0xc4')],'as':_0x1bfa('0xc5'),'include':[{'model':db[_0x1bfa('0x92')],'as':_0x1bfa('0xac'),'where':{'mobile':_0x35227e},'limit':0x1,'order':[[_0x1bfa('0x98'),_0x1bfa('0xaa')]]}]}]})[_0x1bfa('0x21')](handleEntityNotFound(_0x4db287,null))[_0x1bfa('0x21')](function(_0x2f0d70){if(_0x2f0d70&&_0x2f0d70['List']){_0x633ce0=_0x2f0d70[_0x1bfa('0x3a')]({'plain':!![]});if(_0x633ce0[_0x1bfa('0xc5')]&&_0x633ce0[_0x1bfa('0xc5')][_0x1bfa('0xac')][_0x1bfa('0x4b')]){return _0x633ce0['List'][_0x1bfa('0xac')][0x0];}return db[_0x1bfa('0x92')][_0x1bfa('0x5d')](_[_0x1bfa('0xc6')](_0xd7b005[_0x1bfa('0x5e')],{'firstName':_0x35227e,'mobile':_0x35227e,'phone':_0x35227e,'ListId':_0x633ce0[_0x1bfa('0xa9')]}));}})[_0x1bfa('0x21')](handleEntityNotFound(_0x4db287,null))[_0x1bfa('0x21')](function(_0x3db15a){if(_0x3db15a){_0x4a664a=_0x3db15a;return db[_0x1bfa('0xae')]['find']({'where':{'ContactId':_0x4a664a['id'],'closed':![],'WhatsappAccountId':_0x633ce0['id']}})['then'](function(_0x25c3f0){if(_0x25c3f0){return[_0x25c3f0,![]];}return db[_0x1bfa('0xae')][_0x1bfa('0x5d')]({'UserId':_0xd7b005[_0x1bfa('0x5f')]['id'],'ContactId':_0x4a664a['id'],'WhatsappAccountId':_0x633ce0['id'],'phone':_0x35227e,'firstMsgDirection':_0x1bfa('0xc7'),'Messages':[_[_0x1bfa('0x52')](_0xd7b005[_0x1bfa('0x5e')],{'read':![],'body':_0xd7b005[_0x1bfa('0x5e')][_0x1bfa('0x5e')],'phone':_0x35227e,'WhatsappAccountId':_0x633ce0['id'],'UserId':_0xd7b005[_0x1bfa('0x5f')]['id'],'ContactId':_0x4a664a['id']})]},{'include':[{'model':db[_0x1bfa('0xb3')],'as':_0x1bfa('0xc8')}]})[_0x1bfa('0x21')](function(_0xbde417){return[_0xbde417,!![]];});});}})[_0x1bfa('0x74')](function(_0x59dde5,_0x36146a){if(_0x36146a){return _0x59dde5;}return db['WhatsappMessage'][_0x1bfa('0x5d')](_['merge'](_0xd7b005['body'],{'read':![],'body':_0xd7b005['body'][_0x1bfa('0x5e')],'phone':_0x35227e,'WhatsappAccountId':_0x633ce0['id'],'WhatsappInteractionId':_0x59dde5['id'],'UserId':_0xd7b005[_0x1bfa('0x5f')]['id'],'ContactId':_0x4a664a['id']}))['then'](function(_0x590811){_0x59dde5[_0x1bfa('0xc9')][_0x1bfa('0xc8')]=[];_0x59dde5[_0x1bfa('0xc9')][_0x1bfa('0xc8')][_0x1bfa('0xca')](_0x590811[_0x1bfa('0xc9')]);return _0x59dde5;});})[_0x1bfa('0x21')](respondWithResult(_0x4db287,null))['catch'](handleError(_0x4db287,null));}; \ No newline at end of file +var _0x1691=['findAndCountAll','priority','finally','send','json','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','stringify','code','error','message','info','request\x20sent','catch','sendStatus','status','offset','undefined','limit','count','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','params','Pause','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate'];(function(_0x4fde41,_0x2c1c5d){var _0x29a865=function(_0x466bbb){while(--_0x466bbb){_0x4fde41['push'](_0x4fde41['shift']());}};_0x29a865(++_0x2c1c5d);}(_0x1691,0x1ed));var _0x1169=function(_0x5c647a,_0x346e5f){_0x5c647a=_0x5c647a-0x0;var _0x3d11a0=_0x1691[_0x5c647a];return _0x3d11a0;};'use strict';var emlformat=require(_0x1169('0x0'));var rimraf=require(_0x1169('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1169('0x2'));var rp=require(_0x1169('0x3'));var moment=require(_0x1169('0x4'));var BPromise=require(_0x1169('0x5'));var Mustache=require(_0x1169('0x6'));var util=require(_0x1169('0x7'));var path=require(_0x1169('0x8'));var sox=require(_0x1169('0x9'));var csv=require('to-csv');var ejs=require(_0x1169('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1169('0xb'));var squel=require('squel');var crypto=require(_0x1169('0xc'));var jsforce=require(_0x1169('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1169('0xe'));var querystring=require(_0x1169('0xf'));var Papa=require(_0x1169('0x10'));var Redis=require(_0x1169('0x11'));var authService=require(_0x1169('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1169('0x13'));var hardwareService=require(_0x1169('0x14'));var logger=require('../../config/logger')(_0x1169('0x15'));var utils=require('../../config/utils');var config=require(_0x1169('0x16'));var licenseUtil=require(_0x1169('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1169('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1169('0x19'))(new Redis(config[_0x1169('0x18')]));require('./whatsappAccount.socket')[_0x1169('0x1a')](socket);var jayson=require(_0x1169('0x1b'));var client=jayson[_0x1169('0x1c')][_0x1169('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4fc690,_0x4c4b90,_0x34462b,_0x31a3e9){return new BPromise(function(_0x1be17b,_0x14d651){var _0x243481=_0x31a3e9||client;return _0x243481[_0x1169('0x1e')](_0x4fc690,_0x34462b)[_0x1169('0x1f')](function(_0x45bb3d){logger['info'](_0x1169('0x20'),_0x4c4b90,'request\x20sent');logger[_0x1169('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4c4b90,'request\x20sent',JSON[_0x1169('0x22')](_0x45bb3d));if(_0x45bb3d['error']){if(_0x45bb3d['error'][_0x1169('0x23')]===0x1f4){logger['error'](_0x1169('0x20'),_0x4c4b90,_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);return _0x14d651(_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);}logger[_0x1169('0x24')](_0x1169('0x20'),_0x4c4b90,_0x45bb3d[_0x1169('0x24')]['message']);return _0x1be17b(_0x45bb3d[_0x1169('0x24')][_0x1169('0x25')]);}else{logger[_0x1169('0x26')](_0x1169('0x20'),_0x4c4b90,_0x1169('0x27'));_0x1be17b(_0x45bb3d['result']['message']);}})[_0x1169('0x28')](function(_0x5e235c){logger[_0x1169('0x24')](_0x1169('0x20'),_0x4c4b90,_0x5e235c);_0x14d651(_0x5e235c);});});}function respondWithStatusCode(_0x4a8a41,_0x49afe4){_0x49afe4=_0x49afe4||0xcc;return function(_0x2b736d){if(_0x2b736d){return _0x4a8a41[_0x1169('0x29')](_0x49afe4);}return _0x4a8a41[_0x1169('0x2a')](_0x49afe4)['end']();};}function respondWithResult(_0x29c9c4,_0x3172c2){_0x3172c2=_0x3172c2||0xc8;return function(_0x494e2a){if(_0x494e2a){return _0x29c9c4['status'](_0x3172c2)['json'](_0x494e2a);}};}function respondWithFilteredResult(_0x4d89c7,_0xa60282){return function(_0x1c5499){if(_0x1c5499){var _0x316bc4=typeof _0xa60282[_0x1169('0x2b')]===_0x1169('0x2c')&&typeof _0xa60282[_0x1169('0x2d')]===_0x1169('0x2c');var _0x562b44=_0x1c5499['count'];var _0x40fa6d=_0x316bc4?0x0:_0xa60282[_0x1169('0x2b')];var _0x23f6a7=_0x316bc4?_0x1c5499[_0x1169('0x2e')]:_0xa60282[_0x1169('0x2b')]+_0xa60282[_0x1169('0x2d')];var _0x2dae81;if(_0x23f6a7>=_0x562b44){_0x23f6a7=_0x562b44;_0x2dae81=0xc8;}else{_0x2dae81=0xce;}_0x4d89c7['status'](_0x2dae81);return _0x4d89c7['set']('Content-Range',_0x40fa6d+'-'+_0x23f6a7+'/'+_0x562b44)['json'](_0x1c5499);}return null;};}function patchUpdates(_0x494748){return function(_0x205e53){try{jsonpatch[_0x1169('0x2f')](_0x205e53,_0x494748,!![]);}catch(_0x421c28){return BPromise['reject'](_0x421c28);}return _0x205e53[_0x1169('0x30')]();};}function saveUpdates(_0xba5292,_0x1906ea){return function(_0x17fdc1){if(_0x17fdc1){return _0x17fdc1[_0x1169('0x31')](_0xba5292)[_0x1169('0x1f')](function(_0x3dee8d){return _0x3dee8d;});}return null;};}function removeEntity(_0x13a2bd,_0x14e3ce){return function(_0x27e5d2){if(_0x27e5d2){return _0x27e5d2[_0x1169('0x32')]()['then'](function(){var _0x4ed2e0=_0x27e5d2[_0x1169('0x33')]({'plain':!![]});var _0x4e4afa=_0x1169('0x34');return db[_0x1169('0x35')][_0x1169('0x32')]({'where':{'type':_0x4e4afa,'resourceId':_0x4ed2e0['id']}})[_0x1169('0x1f')](function(){return _0x27e5d2;});})[_0x1169('0x1f')](function(){_0x13a2bd['status'](0xcc)[_0x1169('0x36')]();});}};}function handleEntityNotFound(_0x597877,_0x828b65){return function(_0x5b7e00){if(!_0x5b7e00){_0x597877[_0x1169('0x29')](0x194);}return _0x5b7e00;};}function handleError(_0x27ba64,_0x70dc21){_0x70dc21=_0x70dc21||0x1f4;return function(_0x102862){logger['error'](_0x102862[_0x1169('0x37')]);if(_0x102862[_0x1169('0x38')]){delete _0x102862[_0x1169('0x38')];}_0x27ba64['status'](_0x70dc21)['send'](_0x102862);};}exports[_0x1169('0x39')]=function(_0x10cdd1,_0xb5b441){var _0x405c13={'include':[{'model':db['Pause'],'as':_0x1169('0x3a')}]},_0xcd4f28={},_0x22a479={'count':0x0,'rows':[]};var _0x521a22=_[_0x1169('0x3b')](db[_0x1169('0x3c')]['rawAttributes'],function(_0x120815){return{'name':_0x120815[_0x1169('0x3d')],'type':_0x120815[_0x1169('0x3e')][_0x1169('0x3f')]};});_0xcd4f28['model']=_[_0x1169('0x3b')](_0x521a22,_0x1169('0x38'));_0xcd4f28['query']=_['keys'](_0x10cdd1[_0x1169('0x40')]);_0xcd4f28[_0x1169('0x41')]=_['intersection'](_0xcd4f28['model'],_0xcd4f28['query']);_0x405c13['attributes']=_[_0x1169('0x42')](_0xcd4f28[_0x1169('0x43')],qs[_0x1169('0x44')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x44')]));_0x405c13[_0x1169('0x45')]=_0x405c13[_0x1169('0x45')][_0x1169('0x46')]?_0x405c13[_0x1169('0x45')]:_0xcd4f28[_0x1169('0x43')];if(!_0x10cdd1[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x405c13['limit']=qs[_0x1169('0x2d')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x2d')]);_0x405c13[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x10cdd1['query']['offset']);}_0x405c13[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x10cdd1[_0x1169('0x40')][_0x1169('0x4a')]);_0x405c13[_0x1169('0x4b')]=qs['filters'](_['pick'](_0x10cdd1[_0x1169('0x40')],_0xcd4f28['filters']),_0x521a22);if(_0x10cdd1['query'][_0x1169('0x4c')]){_0x405c13[_0x1169('0x4b')]=_['merge'](_0x405c13[_0x1169('0x4b')],{'$or':_['map'](_0x521a22,function(_0x154993){if(_0x154993[_0x1169('0x3e')]!=='VIRTUAL'){var _0x1ca725={};_0x1ca725[_0x154993[_0x1169('0x38')]]={'$like':'%'+_0x10cdd1[_0x1169('0x40')]['filter']+'%'};return _0x1ca725;}})});}_0x405c13=_[_0x1169('0x4d')]({},_0x405c13,_0x10cdd1[_0x1169('0x4e')]);var _0x2de50c={'where':_0x405c13[_0x1169('0x4b')]};return db['WhatsappAccount'][_0x1169('0x2e')](_0x2de50c)[_0x1169('0x1f')](function(_0x3784dd){_0x22a479[_0x1169('0x2e')]=_0x3784dd;if(_0x10cdd1[_0x1169('0x40')][_0x1169('0x4f')]){_0x405c13[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x3c')][_0x1169('0x51')](_0x405c13);})[_0x1169('0x1f')](function(_0x142d34){_0x22a479['rows']=_0x142d34;return _0x22a479;})[_0x1169('0x1f')](respondWithFilteredResult(_0xb5b441,_0x405c13))[_0x1169('0x28')](handleError(_0xb5b441,null));};exports['show']=function(_0x29455b,_0x294ff3){var _0x8d4099={'raw':![],'where':{'id':_0x29455b[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0x53')],'as':_0x1169('0x3a')}]},_0x24efe7={};_0x24efe7[_0x1169('0x43')]=_[_0x1169('0x54')](db[_0x1169('0x3c')][_0x1169('0x55')]);_0x24efe7['query']=_[_0x1169('0x54')](_0x29455b[_0x1169('0x40')]);_0x24efe7[_0x1169('0x41')]=_[_0x1169('0x42')](_0x24efe7[_0x1169('0x43')],_0x24efe7[_0x1169('0x40')]);_0x8d4099[_0x1169('0x45')]=_[_0x1169('0x42')](_0x24efe7[_0x1169('0x43')],qs[_0x1169('0x44')](_0x29455b['query']['fields']));_0x8d4099[_0x1169('0x45')]=_0x8d4099[_0x1169('0x45')][_0x1169('0x46')]?_0x8d4099[_0x1169('0x45')]:_0x24efe7[_0x1169('0x43')];if(_0x29455b['query'][_0x1169('0x4f')]){_0x8d4099[_0x1169('0x50')]=[{'all':!![]}];}_0x8d4099=_[_0x1169('0x4d')]({},_0x8d4099,_0x29455b[_0x1169('0x4e')]);return db[_0x1169('0x3c')][_0x1169('0x56')](_0x8d4099)[_0x1169('0x1f')](handleEntityNotFound(_0x294ff3,null))[_0x1169('0x1f')](respondWithResult(_0x294ff3,null))['catch'](handleError(_0x294ff3,null));};exports[_0x1169('0x57')]=function(_0x247e23,_0x5c9d97){return db['WhatsappAccount'][_0x1169('0x57')](_0x247e23[_0x1169('0x58')],{})[_0x1169('0x1f')](function(_0x51979e){var _0x290c01=_0x247e23[_0x1169('0x59')]['get']({'plain':!![]});if(!_0x290c01)throw new Error(_0x1169('0x5a'));if(_0x290c01[_0x1169('0x5b')]===_0x1169('0x59')){var _0x8fadc8=_0x51979e[_0x1169('0x33')]({'plain':!![]});var _0x1e05db=_0x1169('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x1e05db,'userProfileId':_0x290c01[_0x1169('0x5c')]},'raw':!![]})[_0x1169('0x1f')](function(_0x15dfca){if(_0x15dfca&&_0x15dfca[_0x1169('0x5d')]===0x0){return db[_0x1169('0x35')][_0x1169('0x57')]({'name':_0x8fadc8[_0x1169('0x38')],'resourceId':_0x8fadc8['id'],'type':_0x15dfca[_0x1169('0x38')],'sectionId':_0x15dfca['id']},{})['then'](function(){return _0x51979e;});}else{return _0x51979e;}})[_0x1169('0x28')](function(_0x56d42a){logger[_0x1169('0x24')](_0x1169('0x5e'),_0x56d42a);throw _0x56d42a;});}return _0x51979e;})[_0x1169('0x1f')](respondWithResult(_0x5c9d97,0xc9))['catch'](handleError(_0x5c9d97,null));};exports['update']=function(_0x2cf9b7,_0x40c6f7){if(_0x2cf9b7[_0x1169('0x58')]['id']){delete _0x2cf9b7[_0x1169('0x58')]['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x2cf9b7[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0x53')],'as':_0x1169('0x3a')}]})[_0x1169('0x1f')](handleEntityNotFound(_0x40c6f7,null))['then'](saveUpdates(_0x2cf9b7[_0x1169('0x58')],null))[_0x1169('0x1f')](respondWithResult(_0x40c6f7,null))[_0x1169('0x28')](handleError(_0x40c6f7,null));};exports[_0x1169('0x32')]=function(_0x5d2d08,_0x5726da){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x5d2d08['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x5726da,null))[_0x1169('0x1f')](removeEntity(_0x5726da,null))[_0x1169('0x28')](handleError(_0x5726da,null));};exports['describe']=function(_0x4bf570,_0x29cb25){return db[_0x1169('0x3c')][_0x1169('0x5f')]()[_0x1169('0x1f')](respondWithResult(_0x29cb25,null))[_0x1169('0x28')](handleError(_0x29cb25,null));};exports[_0x1169('0x60')]=function(_0x5cf6c7,_0x4ae5df,_0x3e0cb0){if(_0x5cf6c7[_0x1169('0x58')]['id']){delete _0x5cf6c7['body']['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x5cf6c7['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x4ae5df,null))[_0x1169('0x1f')](function(_0x459051){if(_0x459051){_0x5cf6c7[_0x1169('0x58')][_0x1169('0x61')]=_0x459051['id'];return db[_0x1169('0x62')][_0x1169('0x57')](_0x5cf6c7['body']);}})['then'](respondWithResult(_0x4ae5df,null))['catch'](handleError(_0x4ae5df,null));};exports[_0x1169('0x63')]=function(_0x413414,_0x149ce7,_0xeed73){var _0x3ac07d={'raw':![],'where':{}};var _0xaa342c={};var _0x4e9bf9={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x413414['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x149ce7,null))[_0x1169('0x1f')](function(_0x16d64b){if(_0x16d64b){_0xaa342c[_0x1169('0x43')]=_[_0x1169('0x54')](db[_0x1169('0x62')]['rawAttributes']);_0xaa342c[_0x1169('0x40')]=_[_0x1169('0x54')](_0x413414[_0x1169('0x40')]);_0xaa342c['filters']=_[_0x1169('0x42')](_0xaa342c['model'],_0xaa342c['query']);_0x3ac07d[_0x1169('0x45')]=_[_0x1169('0x42')](_0xaa342c[_0x1169('0x43')],qs['fields'](_0x413414[_0x1169('0x40')][_0x1169('0x44')]));_0x3ac07d[_0x1169('0x45')]=_0x3ac07d[_0x1169('0x45')][_0x1169('0x46')]?_0x3ac07d[_0x1169('0x45')]:_0xaa342c['model'];if(!_0x413414[_0x1169('0x40')]['hasOwnProperty']('nolimit')){_0x3ac07d[_0x1169('0x2d')]=qs[_0x1169('0x2d')](_0x413414[_0x1169('0x40')]['limit']);_0x3ac07d[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x413414[_0x1169('0x40')][_0x1169('0x2b')]);}_0x3ac07d[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x413414[_0x1169('0x40')]['sort']);_0x3ac07d[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x413414[_0x1169('0x40')],_0xaa342c[_0x1169('0x41')]));_0x3ac07d[_0x1169('0x4b')][_0x1169('0x61')]=_0x16d64b['id'];if(_0x413414[_0x1169('0x40')][_0x1169('0x4c')]){_0x3ac07d[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x3ac07d[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x3ac07d[_0x1169('0x45')],function(_0x3cbce6){var _0x367373={};_0x367373[_0x3cbce6]={'$like':'%'+_0x413414['query'][_0x1169('0x4c')]+'%'};return _0x367373;})});}_0x3ac07d=_[_0x1169('0x4d')]({},_0x3ac07d,_0x413414[_0x1169('0x4e')]);return db[_0x1169('0x62')]['count']({'where':_0x3ac07d[_0x1169('0x4b')]})[_0x1169('0x1f')](function(_0x1585fe){_0x4e9bf9[_0x1169('0x2e')]=_0x1585fe;if(_0x413414['query'][_0x1169('0x4f')]){_0x3ac07d[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x62')][_0x1169('0x51')](_0x3ac07d);})['then'](function(_0x1a3c90){_0x4e9bf9['rows']=_0x1a3c90;return _0x4e9bf9;});}})[_0x1169('0x1f')](respondWithFilteredResult(_0x149ce7,_0x3ac07d))[_0x1169('0x28')](handleError(_0x149ce7,null));};exports[_0x1169('0x66')]=function(_0x19438e,_0x1a0439,_0x462b19){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x19438e[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x1a0439,null))['then'](function(_0x2a8b02){if(_0x2a8b02){return _0x2a8b02[_0x1169('0x66')](_0x19438e[_0x1169('0x40')][_0x1169('0x67')]);}})[_0x1169('0x1f')](respondWithStatusCode(_0x1a0439,null))[_0x1169('0x28')](handleError(_0x1a0439,null));};exports[_0x1169('0x68')]=function(_0x41f49d,_0x287caa,_0x20682f){if(_0x41f49d[_0x1169('0x58')]['id']){delete _0x41f49d[_0x1169('0x58')]['id'];}return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x41f49d[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x287caa,null))[_0x1169('0x1f')](function(_0x5489ad){if(_0x5489ad){_0x41f49d['body'][_0x1169('0x61')]=_0x5489ad['id'];return db[_0x1169('0x69')][_0x1169('0x57')](_0x41f49d[_0x1169('0x58')]);}})[_0x1169('0x1f')](respondWithResult(_0x287caa,null))['catch'](handleError(_0x287caa,null));};exports[_0x1169('0x6a')]=function(_0x4e7e6e,_0x54f154,_0x2f9fbc){var _0x1e98ee={'raw':![],'where':{}};var _0x2eb8b5={};var _0x5a093e={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x4e7e6e[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x54f154,null))['then'](function(_0x22393c){if(_0x22393c){_0x2eb8b5[_0x1169('0x43')]=_[_0x1169('0x54')](db['CannedAnswer'][_0x1169('0x55')]);_0x2eb8b5['query']=_[_0x1169('0x54')](_0x4e7e6e[_0x1169('0x40')]);_0x2eb8b5['filters']=_['intersection'](_0x2eb8b5[_0x1169('0x43')],_0x2eb8b5['query']);_0x1e98ee[_0x1169('0x45')]=_[_0x1169('0x42')](_0x2eb8b5[_0x1169('0x43')],qs['fields'](_0x4e7e6e[_0x1169('0x40')][_0x1169('0x44')]));_0x1e98ee[_0x1169('0x45')]=_0x1e98ee[_0x1169('0x45')]['length']?_0x1e98ee[_0x1169('0x45')]:_0x2eb8b5['model'];if(!_0x4e7e6e[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x1e98ee[_0x1169('0x2d')]=qs['limit'](_0x4e7e6e['query'][_0x1169('0x2d')]);_0x1e98ee[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x4e7e6e[_0x1169('0x40')][_0x1169('0x2b')]);}_0x1e98ee[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x4e7e6e[_0x1169('0x40')]['sort']);_0x1e98ee[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x4e7e6e[_0x1169('0x40')],_0x2eb8b5[_0x1169('0x41')]));_0x1e98ee[_0x1169('0x4b')][_0x1169('0x61')]=_0x22393c['id'];if(_0x4e7e6e[_0x1169('0x40')][_0x1169('0x4c')]){_0x1e98ee[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x1e98ee[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x1e98ee['attributes'],function(_0x1d4bfc){var _0x44b712={};_0x44b712[_0x1d4bfc]={'$like':'%'+_0x4e7e6e[_0x1169('0x40')][_0x1169('0x4c')]+'%'};return _0x44b712;})});}_0x1e98ee=_[_0x1169('0x4d')]({},_0x1e98ee,_0x4e7e6e[_0x1169('0x4e')]);return db['CannedAnswer'][_0x1169('0x2e')]({'where':_0x1e98ee[_0x1169('0x4b')]})[_0x1169('0x1f')](function(_0xe05b48){_0x5a093e['count']=_0xe05b48;if(_0x4e7e6e[_0x1169('0x40')]['includeAll']){_0x1e98ee[_0x1169('0x50')]=[{'all':!![]}];}return db[_0x1169('0x69')]['findAll'](_0x1e98ee);})[_0x1169('0x1f')](function(_0x424ccc){_0x5a093e[_0x1169('0x6b')]=_0x424ccc;return _0x5a093e;});}})[_0x1169('0x1f')](respondWithFilteredResult(_0x54f154,_0x1e98ee))[_0x1169('0x28')](handleError(_0x54f154,null));};exports[_0x1169('0x6c')]=function(_0x1380c8,_0x2cbd5d,_0x554dde){return db[_0x1169('0x3c')]['find']({'where':{'id':_0x1380c8[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x2cbd5d,null))[_0x1169('0x1f')](function(_0x1a11f9){if(_0x1a11f9){return _0x1a11f9[_0x1169('0x6c')](_0x1380c8[_0x1169('0x40')][_0x1169('0x67')]);}})['then'](respondWithStatusCode(_0x2cbd5d,null))['catch'](handleError(_0x2cbd5d,null));};exports[_0x1169('0x6d')]=function(_0x1e0f78,_0x27805f,_0x105ad1){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x1e0f78[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x27805f,null))['then'](function(_0x39a7b0){if(_0x39a7b0){return _0x39a7b0[_0x1169('0x6d')](_0x1e0f78[_0x1169('0x58')][_0x1169('0x67')],_['omit'](_0x1e0f78[_0x1169('0x58')],['ids','id'])||{})[_0x1169('0x6e')](function(_0x10c81e){for(var _0x295fa0=0x0;_0x295fa0<_0x1e0f78[_0x1169('0x58')]['ids'][_0x1169('0x46')];_0x295fa0+=0x1){socket[_0x1169('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x1e0f78['body']['ids'][_0x295fa0]),'WhatsappAccountId':Number(_0x1e0f78['params']['id'])});}return _0x10c81e;});}})[_0x1169('0x1f')](respondWithResult(_0x27805f,null))['catch'](handleError(_0x27805f,null));};exports[_0x1169('0x70')]=function(_0x501916,_0x81946a,_0x18b726){return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x501916[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x81946a,null))[_0x1169('0x1f')](function(_0x5b6885){if(_0x5b6885){return _0x5b6885[_0x1169('0x70')](_0x501916[_0x1169('0x40')][_0x1169('0x67')])[_0x1169('0x1f')](function(){if(_['isArray'](_0x501916[_0x1169('0x40')][_0x1169('0x67')])){for(var _0x3831fb=0x0;_0x3831fb<_0x501916[_0x1169('0x40')][_0x1169('0x67')]['length'];_0x3831fb+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x501916[_0x1169('0x40')][_0x1169('0x67')][_0x3831fb]),'WhatsappAccountId':Number(_0x501916[_0x1169('0x52')]['id'])});}}else{socket['emit'](_0x1169('0x71'),{'UserId':Number(_0x501916[_0x1169('0x40')]['ids']),'WhatsappAccountId':Number(_0x501916[_0x1169('0x52')]['id'])});}});}})[_0x1169('0x1f')](respondWithStatusCode(_0x81946a,null))[_0x1169('0x28')](handleError(_0x81946a,null));};exports[_0x1169('0x72')]=function(_0x4133c1,_0x58d677,_0x178d31){var _0x175e44={};var _0xf5b5af={};var _0x464656;var _0xea3603;return db[_0x1169('0x3c')][_0x1169('0x64')]({'where':{'id':_0x4133c1[_0x1169('0x52')]['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x58d677,null))[_0x1169('0x1f')](function(_0x466d30){if(_0x466d30){_0x464656=_0x466d30;_0xf5b5af[_0x1169('0x43')]=_[_0x1169('0x54')](db['User'][_0x1169('0x55')]);_0xf5b5af[_0x1169('0x40')]=_[_0x1169('0x54')](_0x4133c1[_0x1169('0x40')]);_0xf5b5af[_0x1169('0x41')]=_[_0x1169('0x42')](_0xf5b5af[_0x1169('0x43')],_0xf5b5af[_0x1169('0x40')]);_0x175e44['attributes']=_[_0x1169('0x42')](_0xf5b5af[_0x1169('0x43')],qs[_0x1169('0x44')](_0x4133c1[_0x1169('0x40')]['fields']));_0x175e44[_0x1169('0x45')]=_0x175e44[_0x1169('0x45')][_0x1169('0x46')]?_0x175e44[_0x1169('0x45')]:_0xf5b5af['model'];_0x175e44[_0x1169('0x49')]=qs['sort'](_0x4133c1[_0x1169('0x40')][_0x1169('0x4a')]);_0x175e44[_0x1169('0x4b')]=qs[_0x1169('0x41')](_[_0x1169('0x65')](_0x4133c1[_0x1169('0x40')],_0xf5b5af[_0x1169('0x41')]));if(_0x4133c1[_0x1169('0x40')][_0x1169('0x4c')]){_0x175e44[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x175e44[_0x1169('0x4b')],{'$or':_['map'](_0x175e44[_0x1169('0x45')],function(_0x103c30){var _0x13b282={};_0x13b282[_0x103c30]={'$like':'%'+_0x4133c1[_0x1169('0x40')][_0x1169('0x4c')]+'%'};return _0x13b282;})});}_0x175e44=_['merge']({},_0x175e44,_0x4133c1['options']);return _0x464656[_0x1169('0x72')](_0x175e44);}})[_0x1169('0x1f')](function(_0xae13ec){if(_0xae13ec){_0xea3603=_0xae13ec[_0x1169('0x46')];if(!_0x4133c1[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x175e44[_0x1169('0x2d')]=qs[_0x1169('0x2d')](_0x4133c1[_0x1169('0x40')][_0x1169('0x2d')]);_0x175e44[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x4133c1[_0x1169('0x40')][_0x1169('0x2b')]);}return _0x464656['getAgents'](_0x175e44);}})[_0x1169('0x1f')](function(_0x66956c){if(_0x66956c){return _0x66956c?{'count':_0xea3603,'rows':_0x66956c}:null;}})['then'](respondWithResult(_0x58d677,null))['catch'](handleError(_0x58d677,null));};exports[_0x1169('0x73')]=function(_0x396f69,_0x5d1435){var _0x174927=_0x396f69[_0x1169('0x52')]['id'];var _0x4021af=_0x396f69[_0x1169('0x58')];var _0x576509=0xc8;var _0x2ccf16=null;return db[_0x1169('0x74')][_0x1169('0x75')]({'isolationLevel':db[_0x1169('0x74')][_0x1169('0x76')]['ISOLATION_LEVELS'][_0x1169('0x77')]},function(_0x48dd9d){return db['WhatsappAccount'][_0x1169('0x64')]({'where':{'id':_0x174927},'transaction':_0x48dd9d})[_0x1169('0x1f')](function(_0x5d7822){if(_0x5d7822){return db['WhatsappApplication'][_0x1169('0x32')]({'where':{'WhatsappAccountId':_0x174927},'transaction':_0x48dd9d})[_0x1169('0x1f')](function(){var _0x4b7732=_[_0x1169('0x3b')](_0x4021af,function(_0x114c63){_0x114c63[_0x1169('0x61')]=_0x174927;return _0x114c63;});return db[_0x1169('0x78')][_0x1169('0x79')](_0x4b7732,{'transaction':_0x48dd9d});});}else{_0x576509=0x194;_0x2ccf16=[];}});})['then'](function(){if(_0x576509!==0x194){return db[_0x1169('0x78')][_0x1169('0x7a')]({'where':{'WhatsappAccountId':_0x174927},'order':_0x1169('0x7b')})[_0x1169('0x1f')](function(_0x268f40){_0x2ccf16=_0x268f40;});}})['catch'](function(_0x24d704){_0x576509=0x1f4;logger['error'](_0x24d704[_0x1169('0x37')]);if(_0x24d704[_0x1169('0x38')]){delete _0x24d704[_0x1169('0x38')];}_0x2ccf16=_0x24d704;})[_0x1169('0x7c')](function(){if(_0x2ccf16===null){_0x5d1435[_0x1169('0x29')](_0x576509);}else{if(_0x576509===0x1f4){_0x5d1435[_0x1169('0x2a')](_0x576509)[_0x1169('0x7d')](_0x2ccf16);}else{_0x5d1435[_0x1169('0x2a')](_0x576509)[_0x1169('0x7e')](_0x2ccf16);}}});};exports[_0x1169('0x7f')]=function(_0x59a0dc,_0x8e28ea,_0x5c4e54){var _0x58b3c6={};var _0x109dc6={};var _0x489320;var _0x48702b;return db['WhatsappAccount'][_0x1169('0x64')]({'where':{'id':_0x59a0dc['params']['id']}})[_0x1169('0x1f')](handleEntityNotFound(_0x8e28ea,null))[_0x1169('0x1f')](function(_0x56504e){if(_0x56504e){_0x489320=_0x56504e;_0x109dc6[_0x1169('0x43')]=_['keys'](db[_0x1169('0x78')][_0x1169('0x55')]);_0x109dc6['query']=_[_0x1169('0x54')](_0x59a0dc['query']);_0x109dc6[_0x1169('0x41')]=_['intersection'](_0x109dc6[_0x1169('0x43')],_0x109dc6[_0x1169('0x40')]);_0x58b3c6['attributes']=_[_0x1169('0x42')](_0x109dc6[_0x1169('0x43')],qs['fields'](_0x59a0dc[_0x1169('0x40')][_0x1169('0x44')]));_0x58b3c6['attributes']=_0x58b3c6[_0x1169('0x45')][_0x1169('0x46')]?_0x58b3c6[_0x1169('0x45')]:_0x109dc6[_0x1169('0x43')];_0x58b3c6[_0x1169('0x49')]=qs[_0x1169('0x4a')](_0x59a0dc['query'][_0x1169('0x4a')]);_0x58b3c6[_0x1169('0x4b')]=qs['filters'](_[_0x1169('0x65')](_0x59a0dc[_0x1169('0x40')],_0x109dc6['filters']));if(_0x59a0dc[_0x1169('0x40')]['filter']){_0x58b3c6[_0x1169('0x4b')]=_[_0x1169('0x4d')](_0x58b3c6[_0x1169('0x4b')],{'$or':_[_0x1169('0x3b')](_0x58b3c6['attributes'],function(_0x2fba80){var _0x25d715={};_0x25d715[_0x2fba80]={'$like':'%'+_0x59a0dc[_0x1169('0x40')]['filter']+'%'};return _0x25d715;})});}_0x58b3c6=_[_0x1169('0x4d')]({},_0x58b3c6,_0x59a0dc['options']);return _0x489320['getApplications'](_0x58b3c6);}})[_0x1169('0x1f')](function(_0x353cc7){if(_0x353cc7){_0x48702b=_0x353cc7['length'];if(!_0x59a0dc[_0x1169('0x40')][_0x1169('0x47')](_0x1169('0x48'))){_0x58b3c6['limit']=qs[_0x1169('0x2d')](_0x59a0dc[_0x1169('0x40')][_0x1169('0x2d')]);_0x58b3c6[_0x1169('0x2b')]=qs[_0x1169('0x2b')](_0x59a0dc[_0x1169('0x40')][_0x1169('0x2b')]);}return _0x489320[_0x1169('0x7f')](_0x58b3c6);}})[_0x1169('0x1f')](function(_0x3cddb3){if(_0x3cddb3){return _0x3cddb3?{'count':_0x48702b,'rows':_0x3cddb3}:null;}})[_0x1169('0x1f')](respondWithResult(_0x8e28ea,null))[_0x1169('0x28')](handleError(_0x8e28ea,null));};exports[_0x1169('0x80')]=function(_0xf1bf1f,_0xde0670,_0x1bb575){var _0x1585b2={'channel':_0x1169('0x81')};var _0x2a2473=[];var _0x422eda=[];var _0x309c66={};return db['WhatsappAccount'][_0x1169('0x56')]({'where':{'id':_0xf1bf1f[_0x1169('0x52')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1169('0x82')}]})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))[_0x1169('0x1f')](function(_0x54e769){_0x1585b2[_0x1169('0x83')]=_0x54e769;if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2['account'][_0x1169('0x3e')]==='sinch'&&_0xf1bf1f['body'][_0x1169('0x84')]){if(_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][_0x1169('0x46')]===0x0)return;if(_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][0x0][_0x1169('0x85')]!==_0x1169('0x86'))return;return db[_0x1169('0x87')]['update']({'read':!![],'readAt':_0xf1bf1f[_0x1169('0x58')][_0x1169('0x84')][0x0][_0x1169('0x88')]},{'where':{'messageId':_0xf1bf1f[_0x1169('0x58')]['statuses'][0x0][_0x1169('0x89')]},'individualHooks':!![]})[_0x1169('0x1f')](function(_0x19aa5d){return _0xde0670['status'](0xc8)[_0x1169('0x7e')](_0x19aa5d);});}_0x1585b2[_0x1169('0x8a')]=_['orderBy'](_0x54e769[_0x1169('0x82')],[_0x1169('0x7b')],[_0x1169('0x8b')]);if(_0x1585b2[_0x1169('0x83')][_0x1169('0x82')]){delete _0x1585b2[_0x1169('0x83')][_0x1169('0x82')];}return db[_0x1169('0x8c')][_0x1169('0x5f')]()[_0x1169('0x1f')](function(_0xdee68c){if(!_0xdee68c){throw new db[(_0x1169('0x8d'))]['ValidationError'](_0x1169('0x8e'));}_0x2a2473=_[_0x1169('0x8f')](_[_0x1169('0x54')](_0xdee68c),[_0x1169('0x90'),_0x1169('0x91')]);_0x422eda=_['difference'](_[_0x1169('0x54')](_0xdee68c),[_0x1169('0x90'),_0x1169('0x91'),_0x1169('0x92'),_0x1169('0x93')]);_0x1585b2[_0x1169('0x58')]={'mapKey':_0x1169('0x94')};if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2[_0x1169('0x83')][_0x1169('0x3e')]===_0x1169('0x95')){_0x1585b2[_0x1169('0x58')][_0x1169('0x96')]=_0xf1bf1f['body']['From'][_0x1169('0x97')](_0x1169('0x98'),'');_0x1585b2[_0x1169('0x58')][_0x1169('0x58')]=_0xf1bf1f[_0x1169('0x58')][_0x1169('0x99')];_0x1585b2[_0x1169('0x58')][_0x1169('0x9a')]=_0xf1bf1f['body'][_0x1169('0x9b')];}if(_0x1585b2[_0x1169('0x83')]&&_0x1585b2['account']['type']===_0x1169('0x9c')){_0x1585b2[_0x1169('0x58')]['from']=_0xf1bf1f[_0x1169('0x58')][_0x1169('0x9d')][0x0][_0x1169('0x96')];_0x1585b2[_0x1169('0x58')]['body']=_0xf1bf1f[_0x1169('0x58')]['notifications'][0x0][_0x1169('0x25')]['body'];_0x1585b2[_0x1169('0x58')][_0x1169('0x9a')]=_0xf1bf1f[_0x1169('0x58')]['notifications'][0x0][_0x1169('0x89')];}if(_0x1585b2[_0x1169('0x58')]['id']){delete _0x1585b2[_0x1169('0x58')]['id'];}if(_['isNil'](_0x1585b2['body'][_0x1169('0x96')])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0x9f'));}if(_[_0x1169('0xa0')](_0x1585b2[_0x1169('0x58')][_0x1169('0x58')])||_0x1585b2['body'][_0x1169('0x58')]===''){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1169('0xa0')](_0x1585b2[_0x1169('0x58')][_0x1169('0xa1')])){throw new db['Sequelize'][(_0x1169('0x9e'))](_0x1169('0xa2')+_0x422eda);}if(!_[_0x1169('0xa3')](_0x422eda,_0x1585b2['body']['mapKey'])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x422eda);}_0x309c66[_0x1585b2[_0x1169('0x58')][_0x1169('0xa1')]]=_0x1585b2[_0x1169('0x58')]['from'];return db['CmList'][_0x1169('0x56')]({'where':{'id':_0x1585b2[_0x1169('0x83')][_0x1169('0x93')]},'include':[{'model':db[_0x1169('0x8c')],'as':_0x1169('0xa4'),'where':_0x309c66,'limit':0x1,'order':[['updatedAt',_0x1169('0xa5')]]}]});})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))['then'](function(_0x2959ab){if(_0x2959ab){_0x1585b2[_0x1169('0xa6')]=_[_0x1169('0xa7')](_0x2959ab,[_0x1169('0xa4')]);if(_0x2959ab['Contacts'][_0x1169('0x46')]){return _0x2959ab[_0x1169('0xa4')][0x0];}var _0x49f190=_[_0x1169('0xa8')](_0x1585b2[_0x1169('0x58')],{'firstName':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'ListId':_0x2959ab['id']});_0x49f190[_0x1585b2['body'][_0x1169('0xa1')]]=_0x1585b2[_0x1169('0x58')][_0x1169('0x96')];return db[_0x1169('0x8c')][_0x1169('0x57')](_0x49f190,{'fields':_0x2a2473,'raw':!![]});}})[_0x1169('0x1f')](handleEntityNotFound(_0xde0670,null))[_0x1169('0x1f')](function(_0x18306f){if(_0x18306f){_0x1585b2[_0x1169('0xa9')]=_0x18306f;var _0x1f5a11={'ContactId':_0x18306f['id'],'phone':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id']};var _0x251c3c={'ContactId':_0x18306f['id'],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id'],'closed':![]};return db[_0x1169('0xaa')][_0x1169('0x56')]({'where':_0x251c3c})[_0x1169('0x1f')](function(_0x226235){if(_0x226235){return[_0x226235,![]];}return db[_0x1169('0xaa')][_0x1169('0x57')](_0x1f5a11)[_0x1169('0x1f')](function(_0x508a91){return[_0x508a91,!![]];});});}})['spread'](function(_0x13d847,_0x5728b4){_0x1585b2[_0x1169('0xab')]=_0x13d847[_0x1169('0x33')]({'plain':!![]});_0x1585b2[_0x1169('0xab')]['created']=![];if(_0x5728b4){if(_0x1585b2[_0x1169('0x83')][_0x1169('0xac')]){_0x1585b2['applications'][_0x1169('0xad')]({'id':0x0,'priority':_0x1585b2[_0x1169('0x8a')][_0x1169('0x46')]+0x1,'app':_0x1169('0xae'),'appdata':_0x1169('0xaf'),'interval':'*,*,*,*'});}_0x1585b2[_0x1169('0xab')][_0x1169('0xb0')]=!![];}return db[_0x1169('0x87')]['create']({'phone':_0x1585b2[_0x1169('0x58')][_0x1169('0x96')],'messageId':_0x1585b2['body'][_0x1169('0x9a')],'body':_0x1585b2[_0x1169('0x58')][_0x1169('0x58')],'WhatsappAccountId':_0xf1bf1f[_0x1169('0x52')]['id'],'WhatsappInteractionId':_0x13d847['id'],'direction':'in','ContactId':_0x13d847[_0x1169('0xb1')],'AttachmentId':_0x1585b2['body'][_0x1169('0xb2')]});})['then'](function(_0xf2373f){_0x1585b2[_0x1169('0x25')]=_0xf2373f;if(!_0x1585b2['interaction']['UserId'])return;return db[_0x1169('0xb3')][_0x1169('0x56')]({'attributes':['id',_0x1169('0x38')],'where':{'id':_0x1585b2[_0x1169('0xab')][_0x1169('0xb4')]}});})['then'](function(_0x311764){if(_0x311764){_0x1585b2[_0x1169('0x8a')][_0x1169('0xb5')]({'id':0x0,'priority':0x0,'app':_0x1169('0xb6'),'appdata':_0x311764['name']+','+(_0x1585b2[_0x1169('0x83')][_0x1169('0xb7')]||0xa),'interval':'*,*,*,*'});}if(!_0x1585b2[_0x1169('0xab')][_0x1169('0xb8')])return;return db[_0x1169('0xb9')][_0x1169('0x56')]({'attributes':['id','name'],'where':{'id':_0x1585b2['interaction'][_0x1169('0xb8')]}});})[_0x1169('0x1f')](function(_0x50de0b){if(_0x50de0b){_0x1585b2['applications'][_0x1169('0xb5')]({'id':0x0,'priority':0x1,'app':_0x1169('0xba'),'appdata':_0x50de0b[_0x1169('0x38')]+','+(_0x1585b2[_0x1169('0x83')][_0x1169('0xbb')]||0x12c),'interval':_0x1169('0xbc')});}return respondWithRpcPromise(_0x1169('0xbd'),'startRouting',_0x1585b2);})[_0x1169('0x1f')](function(_0x1cf98a){if(_0x1cf98a){var _0x4a99f4=0xc8;var _0x20c04e=_0x1169('0xbe');logger[_0x1169('0x26')](_0x1169('0xbf'),_0x20c04e,_0x4a99f4,_0x1169('0xc0'));logger[_0x1169('0x21')](_0x1169('0xc1'),_0x20c04e,_0x4a99f4,_0x1169('0xc0'),JSON[_0x1169('0x22')](_0x1cf98a));if(_0x1585b2['account'][_0x1169('0x3e')]===_0x1169('0x95')){return _0xde0670[_0x1169('0x2a')](_0x4a99f4)[_0x1169('0xc2')](_0x1169('0xc3'),_0x1169('0xc4'))[_0x1169('0x7d')](_0x1169('0xc5'));}else{return _0xde0670[_0x1169('0x2a')](_0x4a99f4)[_0x1169('0x7e')](_0x1cf98a);}}});})[_0x1169('0x28')](handleError(_0xde0670,null));};exports[_0x1169('0x7d')]=function(_0x3765f2,_0x43379c,_0x51390c){var _0x52de63,_0x51c2cd,_0x133984;if(_[_0x1169('0xa0')](_0x3765f2[_0x1169('0x58')][_0x1169('0x58')])||_0x3765f2[_0x1169('0x58')][_0x1169('0x58')]===''){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0xc6'));}if(_['isNil'](_0x3765f2[_0x1169('0x58')]['to'])){throw new db[(_0x1169('0x8d'))][(_0x1169('0x9e'))](_0x1169('0xc7'));}_0x52de63=_0x3765f2[_0x1169('0x58')]['to'];return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x3765f2[_0x1169('0x52')]['id']},'include':[{'model':db[_0x1169('0xc8')],'as':_0x1169('0xc9'),'include':[{'model':db[_0x1169('0x8c')],'as':'Contacts','where':{'mobile':_0x52de63},'limit':0x1,'order':[[_0x1169('0x91'),_0x1169('0xa5')]]}]}]})[_0x1169('0x1f')](handleEntityNotFound(_0x43379c,null))['then'](function(_0x4ddd01){if(_0x4ddd01&&_0x4ddd01[_0x1169('0xc9')]){_0x51c2cd=_0x4ddd01[_0x1169('0x33')]({'plain':!![]});if(_0x51c2cd[_0x1169('0xc9')]&&_0x51c2cd[_0x1169('0xc9')][_0x1169('0xa4')][_0x1169('0x46')]){return _0x51c2cd[_0x1169('0xc9')][_0x1169('0xa4')][0x0];}return db[_0x1169('0x8c')][_0x1169('0x57')](_['defaults'](_0x3765f2[_0x1169('0x58')],{'firstName':_0x52de63,'mobile':_0x52de63,'phone':_0x52de63,'ListId':_0x51c2cd['ListId']}));}})[_0x1169('0x1f')](handleEntityNotFound(_0x43379c,null))[_0x1169('0x1f')](function(_0x52de55){if(_0x52de55){_0x133984=_0x52de55;return db[_0x1169('0xaa')][_0x1169('0x56')]({'where':{'ContactId':_0x133984['id'],'closed':![],'WhatsappAccountId':_0x51c2cd['id']}})[_0x1169('0x1f')](function(_0x23f1a9){if(_0x23f1a9){return[_0x23f1a9,![]];}return db['WhatsappInteraction'][_0x1169('0x57')]({'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id'],'WhatsappAccountId':_0x51c2cd['id'],'phone':_0x52de63,'firstMsgDirection':_0x1169('0xca'),'Messages':[_['merge'](_0x3765f2[_0x1169('0x58')],{'read':![],'body':_0x3765f2[_0x1169('0x58')][_0x1169('0x58')],'phone':_0x52de63,'WhatsappAccountId':_0x51c2cd['id'],'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x1169('0x1f')](function(_0x49d17b){return[_0x49d17b,!![]];});});}})['spread'](function(_0x22d777,_0x50885f){if(_0x50885f){return _0x22d777;}return db['WhatsappMessage']['create'](_[_0x1169('0x4d')](_0x3765f2[_0x1169('0x58')],{'read':![],'body':_0x3765f2[_0x1169('0x58')][_0x1169('0x58')],'phone':_0x52de63,'WhatsappAccountId':_0x51c2cd['id'],'WhatsappInteractionId':_0x22d777['id'],'UserId':_0x3765f2[_0x1169('0x59')]['id'],'ContactId':_0x133984['id']}))['then'](function(_0x2e0b81){_0x22d777[_0x1169('0xcb')][_0x1169('0xcc')]=[];_0x22d777['dataValues']['Messages'][_0x1169('0xad')](_0x2e0b81[_0x1169('0xcb')]);return _0x22d777;});})[_0x1169('0x1f')](respondWithResult(_0x43379c,null))[_0x1169('0x28')](handleError(_0x43379c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 64ef615..122eeda 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 _0xdbf5=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xdbf5,0x8e));var _0x5dbf=function(_0x50f888,_0x559bec){_0x50f888=_0x50f888-0x0;var _0x52fa21=_0xdbf5[_0x50f888];return _0x52fa21;};'use strict';var EventEmitter=require(_0x5dbf('0x0'));var WhatsappAccount=require(_0x5dbf('0x1'))['db'][_0x5dbf('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5dbf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5dbf('0x4'),'afterDestroy':_0x5dbf('0x5')};function emitEvent(_0x98be7e){return function(_0x593c36,_0x1b3452,_0x510ac8){WhatsappAccountEvents[_0x5dbf('0x6')](_0x98be7e+':'+_0x593c36['id'],_0x593c36);WhatsappAccountEvents['emit'](_0x98be7e,_0x593c36);_0x510ac8(null);};}for(var e in events){if(events[_0x5dbf('0x7')](e)){var event=events[e];WhatsappAccount[_0x5dbf('0x8')](e,emitEvent(event));}}module[_0x5dbf('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x49c5=['setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x49c5,0x97));var _0x549c=function(_0x17a871,_0x4a74dc){_0x17a871=_0x17a871-0x0;var _0x4b75fa=_0x49c5[_0x17a871];return _0x4b75fa;};'use strict';var EventEmitter=require(_0x549c('0x0'));var WhatsappAccount=require(_0x549c('0x1'))['db'][_0x549c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x549c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x305f76){return function(_0x307600,_0x81f0d7,_0x2be70c){WhatsappAccountEvents[_0x549c('0x4')](_0x305f76+':'+_0x307600['id'],_0x307600);WhatsappAccountEvents[_0x549c('0x4')](_0x305f76,_0x307600);_0x2be70c(null);};}for(var e in events){if(events[_0x549c('0x5')](e)){var event=events[e];WhatsappAccount[_0x549c('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2e17c14..6dc014f 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 _0x956e=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e0028,_0x1f9f0f){var _0x3ccce3=function(_0x1065c3){while(--_0x1065c3){_0x3e0028['push'](_0x3e0028['shift']());}};_0x3ccce3(++_0x1f9f0f);}(_0x956e,0x1b3));var _0xe956=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x956e[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require(_0xe956('0x0'));var logger=require('../../config/logger')(_0xe956('0x1'));var moment=require(_0xe956('0x2'));var BPromise=require(_0xe956('0x3'));var rp=require(_0xe956('0x4'));var fs=require('fs');var path=require(_0xe956('0x5'));var rimraf=require(_0xe956('0x6'));var config=require(_0xe956('0x7'));var attributes=require(_0xe956('0x8'));module[_0xe956('0x9')]=function(_0x1207a9,_0x277d6d){return _0x1207a9[_0xe956('0xa')](_0xe956('0xb'),attributes,{'tableName':_0xe956('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x773b=['define','WhatsappAccount','whatsapp_accounts','../../config/logger','api','bluebird','request-promise','path','./whatsappAccount.attributes'];(function(_0x21b74b,_0x543c76){var _0x518cc6=function(_0x5b3010){while(--_0x5b3010){_0x21b74b['push'](_0x21b74b['shift']());}};_0x518cc6(++_0x543c76);}(_0x773b,0x1f2));var _0xb773=function(_0x5abada,_0x461da6){_0x5abada=_0x5abada-0x0;var _0x445ffd=_0x773b[_0x5abada];return _0x445ffd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb773('0x0'))(_0xb773('0x1'));var moment=require('moment');var BPromise=require(_0xb773('0x2'));var rp=require(_0xb773('0x3'));var fs=require('fs');var path=require(_0xb773('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb773('0x5'));module['exports']=function(_0x1adf88,_0x19cff0){return _0x1adf88[_0xb773('0x6')](_0xb773('0x7'),attributes,{'tableName':_0xb773('0x8'),'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 c0d825e..9485593 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 _0x8066=['error','code','WhatsappAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','debug','stringify'];(function(_0x1bae2f,_0x14d13b){var _0x5d36f=function(_0x5f055e){while(--_0x5f055e){_0x1bae2f['push'](_0x1bae2f['shift']());}};_0x5d36f(++_0x14d13b);}(_0x8066,0x192));var _0x6806=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x8066[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x6806('0x0'));var util=require(_0x6806('0x1'));var moment=require(_0x6806('0x2'));var BPromise=require(_0x6806('0x3'));var rs=require(_0x6806('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6806('0x5'))('rpc');var config=require(_0x6806('0x6'));var jayson=require(_0x6806('0x7'));var client=jayson[_0x6806('0x8')][_0x6806('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6806('0xa')],{'host':_0x6806('0xb'),'port':0x18eb});var socket=require(_0x6806('0xc'))(new Redis(config['redis']));require(_0x6806('0xd'))[_0x6806('0xe')](socket);function respondWithRpcPromise(_0x5353ed,_0x41f61a,_0x103b3e){return new BPromise(function(_0x24d005,_0x8cb8ec){return client['request'](_0x5353ed,_0x103b3e)[_0x6806('0xf')](function(_0x1aace0){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x41f61a,'request\x20sent');logger[_0x6806('0x10')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x41f61a,'request\x20sent',JSON[_0x6806('0x11')](_0x1aace0));if(_0x1aace0[_0x6806('0x12')]){if(_0x1aace0[_0x6806('0x12')][_0x6806('0x13')]===0x1f4){logger['error'](_0x6806('0x14'),_0x41f61a,_0x1aace0[_0x6806('0x12')][_0x6806('0x15')]);return _0x8cb8ec(_0x1aace0[_0x6806('0x12')][_0x6806('0x15')]);}logger[_0x6806('0x12')](_0x6806('0x14'),_0x41f61a,_0x1aace0['error'][_0x6806('0x15')]);return _0x24d005(_0x1aace0[_0x6806('0x12')][_0x6806('0x15')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x41f61a,_0x6806('0x16'));_0x24d005(_0x1aace0[_0x6806('0x17')][_0x6806('0x15')]);}})[_0x6806('0x18')](function(_0xa8e762){logger[_0x6806('0x12')](_0x6806('0x14'),_0x41f61a,_0xa8e762);_0x8cb8ec(_0xa8e762);});});}exports[_0x6806('0x19')]=function(_0x4910fb){var _0x18fc29=this;return new Promise(function(_0x2034dc,_0x3db6df){return db[_0x6806('0x1a')]['find']({'raw':_0x4910fb[_0x6806('0x1b')]?_0x4910fb[_0x6806('0x1b')][_0x6806('0x1c')]===undefined?!![]:![]:!![],'where':_0x4910fb[_0x6806('0x1b')]?_0x4910fb[_0x6806('0x1b')][_0x6806('0x1d')]||null:null,'attributes':_0x4910fb[_0x6806('0x1b')]?_0x4910fb[_0x6806('0x1b')][_0x6806('0x1e')]||null:null,'include':_0x4910fb[_0x6806('0x1b')]?_0x4910fb[_0x6806('0x1b')][_0x6806('0x1f')]?_[_0x6806('0x20')](_0x4910fb[_0x6806('0x1b')][_0x6806('0x1f')],function(_0x3fa9d7){return{'model':db[_0x3fa9d7['model']],'as':_0x3fa9d7['as'],'attributes':_0x3fa9d7[_0x6806('0x1e')],'include':_0x3fa9d7['include']?_[_0x6806('0x20')](_0x3fa9d7[_0x6806('0x1f')],function(_0x14bc35){return{'model':db[_0x14bc35[_0x6806('0x21')]],'as':_0x14bc35['as'],'attributes':_0x14bc35[_0x6806('0x1e')],'include':_0x14bc35['include']?_['map'](_0x14bc35['include'],function(_0x586ba7){return{'model':db[_0x586ba7[_0x6806('0x21')]],'as':_0x586ba7['as'],'attributes':_0x586ba7[_0x6806('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6806('0xf')](function(_0x3c85d8){logger[_0x6806('0x22')](_0x6806('0x19'),_0x4910fb);logger[_0x6806('0x10')](_0x6806('0x19'),_0x4910fb,JSON['stringify'](_0x3c85d8));_0x2034dc(_0x3c85d8);})[_0x6806('0x18')](function(_0x336920){logger[_0x6806('0x12')](_0x6806('0x19'),_0x336920[_0x6806('0x15')],_0x4910fb);_0x3db6df(_0x18fc29[_0x6806('0x12')](0x1f4,_0x336920[_0x6806('0x15')]));});});}; \ No newline at end of file +var _0x79bb=['ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','then','ShowWhatsappAccount','util','moment','bluebird','randomstring'];(function(_0x2e850b,_0x186b89){var _0x5ccf6f=function(_0x21b84b){while(--_0x21b84b){_0x2e850b['push'](_0x2e850b['shift']());}};_0x5ccf6f(++_0x186b89);}(_0x79bb,0x1dd));var _0xb79b=function(_0x327dec,_0x4687f4){_0x327dec=_0x327dec-0x0;var _0x1052a8=_0x79bb[_0x327dec];return _0x1052a8;};'use strict';var _=require('lodash');var util=require(_0xb79b('0x0'));var moment=require(_0xb79b('0x1'));var BPromise=require(_0xb79b('0x2'));var rs=require(_0xb79b('0x3'));var fs=require('fs');var Redis=require(_0xb79b('0x4'));var db=require(_0xb79b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb79b('0x6'))(_0xb79b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb79b('0x8')][_0xb79b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb79b('0xa')],{'host':_0xb79b('0xb'),'port':0x18eb});var socket=require(_0xb79b('0xc'))(new Redis(config[_0xb79b('0xa')]));require(_0xb79b('0xd'))[_0xb79b('0xe')](socket);function respondWithRpcPromise(_0x509349,_0x420a37,_0x56a08c){return new BPromise(function(_0x3dcb96,_0x47f855){return client[_0xb79b('0xf')](_0x509349,_0x56a08c)['then'](function(_0x45bce6){logger[_0xb79b('0x10')](_0xb79b('0x11'),_0x420a37,_0xb79b('0x12'));logger[_0xb79b('0x13')](_0xb79b('0x14'),_0x420a37,_0xb79b('0x12'),JSON[_0xb79b('0x15')](_0x45bce6));if(_0x45bce6[_0xb79b('0x16')]){if(_0x45bce6[_0xb79b('0x16')][_0xb79b('0x17')]===0x1f4){logger['error'](_0xb79b('0x11'),_0x420a37,_0x45bce6['error'][_0xb79b('0x18')]);return _0x47f855(_0x45bce6[_0xb79b('0x16')]['message']);}logger[_0xb79b('0x16')](_0xb79b('0x11'),_0x420a37,_0x45bce6['error'][_0xb79b('0x18')]);return _0x3dcb96(_0x45bce6['error']['message']);}else{logger[_0xb79b('0x10')](_0xb79b('0x11'),_0x420a37,_0xb79b('0x12'));_0x3dcb96(_0x45bce6[_0xb79b('0x19')][_0xb79b('0x18')]);}})[_0xb79b('0x1a')](function(_0x33c1bd){logger[_0xb79b('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x420a37,_0x33c1bd);_0x47f855(_0x33c1bd);});});}exports['ShowWhatsappAccount']=function(_0x1af83e){var _0x1fdf75=this;return new Promise(function(_0x162cb2,_0x463eb3){return db['WhatsappAccount'][_0xb79b('0x1b')]({'raw':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1af83e['options']?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1e')]||null:null,'attributes':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x1f')]||null:null,'include':_0x1af83e[_0xb79b('0x1c')]?_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x20')]?_[_0xb79b('0x21')](_0x1af83e[_0xb79b('0x1c')][_0xb79b('0x20')],function(_0xde77e0){return{'model':db[_0xde77e0['model']],'as':_0xde77e0['as'],'attributes':_0xde77e0['attributes'],'include':_0xde77e0['include']?_['map'](_0xde77e0[_0xb79b('0x20')],function(_0x3424c2){return{'model':db[_0x3424c2[_0xb79b('0x22')]],'as':_0x3424c2['as'],'attributes':_0x3424c2[_0xb79b('0x1f')],'include':_0x3424c2[_0xb79b('0x20')]?_[_0xb79b('0x21')](_0x3424c2[_0xb79b('0x20')],function(_0x33ae02){return{'model':db[_0x33ae02[_0xb79b('0x22')]],'as':_0x33ae02['as'],'attributes':_0x33ae02[_0xb79b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb79b('0x23')](function(_0x195fbf){logger['info'](_0xb79b('0x24'),_0x1af83e);logger[_0xb79b('0x13')](_0xb79b('0x24'),_0x1af83e,JSON[_0xb79b('0x15')](_0x195fbf));_0x162cb2(_0x195fbf);})[_0xb79b('0x1a')](function(_0x43c58b){logger[_0xb79b('0x16')](_0xb79b('0x24'),_0x43c58b[_0xb79b('0x18')],_0x1af83e);_0x463eb3(_0x1fdf75['error'](0x1f4,_0x43c58b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d643899..1770fbe 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 _0x2885=['emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','update'];(function(_0x43c0d4,_0xfa643a){var _0x1dd564=function(_0x2f0bc2){while(--_0x2f0bc2){_0x43c0d4['push'](_0x43c0d4['shift']());}};_0x1dd564(++_0xfa643a);}(_0x2885,0x162));var _0x5288=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x2885[_0x2e4aa2];return _0x5e6092;};'use strict';var WhatsappAccountEvents=require(_0x5288('0x0'));var events=[_0x5288('0x1'),'remove',_0x5288('0x2')];function createListener(_0x55f4e2,_0x486ee8){return function(_0x56c9b4){_0x486ee8[_0x5288('0x3')](_0x55f4e2,_0x56c9b4);};}function removeListener(_0x3b8d4c,_0x2d4b16){return function(){WhatsappAccountEvents[_0x5288('0x4')](_0x3b8d4c,_0x2d4b16);};}exports[_0x5288('0x5')]=function(_0x31f85f){for(var _0x3052a8=0x0,_0x444a69=events['length'];_0x3052a8<_0x444a69;_0x3052a8++){var _0x59f286=events[_0x3052a8];var _0x2c9887=createListener(_0x5288('0x6')+_0x59f286,_0x31f85f);WhatsappAccountEvents['on'](_0x59f286,_0x2c9887);}}; \ No newline at end of file +var _0x612f=['register','length','./whatsappAccount.events','save','update','emit'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x612f,0xf2));var _0xf612=function(_0x1549ae,_0x4ea436){_0x1549ae=_0x1549ae-0x0;var _0x141302=_0x612f[_0x1549ae];return _0x141302;};'use strict';var WhatsappAccountEvents=require(_0xf612('0x0'));var events=[_0xf612('0x1'),'remove',_0xf612('0x2')];function createListener(_0x45aa8b,_0x16d4c5){return function(_0x54fab3){_0x16d4c5[_0xf612('0x3')](_0x45aa8b,_0x54fab3);};}function removeListener(_0x47ca2b,_0xc8684a){return function(){WhatsappAccountEvents['removeListener'](_0x47ca2b,_0xc8684a);};}exports[_0xf612('0x4')]=function(_0x293b7c){for(var _0xaf1a49=0x0,_0x555f5b=events[_0xf612('0x5')];_0xaf1a49<_0x555f5b;_0xaf1a49++){var _0xd44303=events[_0xaf1a49];var _0x25ff21=createListener('whatsappAccount:'+_0xd44303,_0x293b7c);WhatsappAccountEvents['on'](_0xd44303,_0x25ff21);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0232555..8db1e08 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 _0x4ee9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xbbbcaf,_0x279ddf){var _0x10ecfa=function(_0x5c5be9){while(--_0x5c5be9){_0xbbbcaf['push'](_0xbbbcaf['shift']());}};_0x10ecfa(++_0x279ddf);}(_0x4ee9,0x162));var _0x94ee=function(_0x37c2f,_0x2d5b93){_0x37c2f=_0x37c2f-0x0;var _0x1e2529=_0x4ee9[_0x37c2f];return _0x1e2529;};'use strict';var multer=require(_0x94ee('0x0'));var util=require(_0x94ee('0x1'));var path=require(_0x94ee('0x2'));var timeout=require(_0x94ee('0x3'));var express=require(_0x94ee('0x4'));var router=express['Router']();var fs_extra=require(_0x94ee('0x5'));var auth=require(_0x94ee('0x6'));var interaction=require(_0x94ee('0x7'));var config=require(_0x94ee('0x8'));var controller=require('./whatsappApplication.controller');router[_0x94ee('0x9')]('/',auth[_0x94ee('0xa')](),controller[_0x94ee('0xb')]);router[_0x94ee('0x9')]('/:id',auth[_0x94ee('0xa')](),controller['show']);router[_0x94ee('0xc')]('/',auth[_0x94ee('0xa')](),controller[_0x94ee('0xd')]);router[_0x94ee('0xe')](_0x94ee('0xf'),auth[_0x94ee('0xa')](),controller[_0x94ee('0x10')]);router[_0x94ee('0x11')]('/:id',auth[_0x94ee('0xa')](),controller['destroy']);module[_0x94ee('0x12')]=router; \ No newline at end of file +var _0x5fb5=['Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x428a5f,_0x56c9cf){var _0x1a591b=function(_0x2f47d4){while(--_0x2f47d4){_0x428a5f['push'](_0x428a5f['shift']());}};_0x1a591b(++_0x56c9cf);}(_0x5fb5,0x1e2));var _0x55fb=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x5fb5[_0x59f0dc];return _0x5b5445;};'use strict';var multer=require(_0x55fb('0x0'));var util=require(_0x55fb('0x1'));var path=require(_0x55fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x55fb('0x3'));var router=express[_0x55fb('0x4')]();var fs_extra=require(_0x55fb('0x5'));var auth=require(_0x55fb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x55fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x55fb('0x8')]);router['get'](_0x55fb('0x9'),auth[_0x55fb('0xa')](),controller[_0x55fb('0xb')]);router[_0x55fb('0xc')]('/',auth[_0x55fb('0xa')](),controller[_0x55fb('0xd')]);router[_0x55fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x55fb('0xf')]);router[_0x55fb('0x10')](_0x55fb('0x9'),auth[_0x55fb('0xa')](),controller[_0x55fb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ce63073..84c0988 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 _0x8871=['sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x4fc569,_0x337667){var _0x2f9e16=function(_0x173461){while(--_0x173461){_0x4fc569['push'](_0x4fc569['shift']());}};_0x2f9e16(++_0x337667);}(_0x8871,0xe1));var _0x1887=function(_0x550651,_0x32926b){_0x550651=_0x550651-0x0;var _0x53edcf=_0x8871[_0x550651];return _0x53edcf;};'use strict';var Sequelize=require(_0x1887('0x0'));module[_0x1887('0x1')]={'priority':{'type':Sequelize[_0x1887('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1887('0x3')]()},'description':{'type':Sequelize[_0x1887('0x4')]},'interval':{'type':Sequelize[_0x1887('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7665=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x5bf6e4,_0x551cdd){var _0x4af264=function(_0x533a90){while(--_0x533a90){_0x5bf6e4['push'](_0x5bf6e4['shift']());}};_0x4af264(++_0x551cdd);}(_0x7665,0xc1));var _0x5766=function(_0x4e443a,_0x10c88a){_0x4e443a=_0x4e443a-0x0;var _0x1998f6=_0x7665[_0x4e443a];return _0x1998f6;};'use strict';var Sequelize=require(_0x5766('0x0'));module[_0x5766('0x1')]={'priority':{'type':Sequelize[_0x5766('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5766('0x3')],'allowNull':![],'defaultValue':_0x5766('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5766('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a526caf..42bd3a1 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 _0x15ef=['bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappApplication','include','findAll','catch','show','params','length','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x15ef,0x80));var _0xf15e=function(_0x1b4dd9,_0x2bc170){_0x1b4dd9=_0x1b4dd9-0x0;var _0x2b962f=_0x15ef[_0x1b4dd9];return _0x2b962f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15e('0x0'));var zipdir=require(_0xf15e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var BPromise=require(_0xf15e('0x4'));var Mustache=require(_0xf15e('0x5'));var util=require(_0xf15e('0x6'));var path=require('path');var sox=require(_0xf15e('0x7'));var csv=require(_0xf15e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0x8'));var querystring=require(_0xf15e('0xc'));var Papa=require(_0xf15e('0xd'));var Redis=require(_0xf15e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0xf'));var logger=require(_0xf15e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x11'));var db=require(_0xf15e('0x12'))['db'];function respondWithStatusCode(_0x8551e2,_0x5809f7){_0x5809f7=_0x5809f7||0xcc;return function(_0x442d51){if(_0x442d51){return _0x8551e2[_0xf15e('0x13')](_0x5809f7);}return _0x8551e2[_0xf15e('0x14')](_0x5809f7)['end']();};}function respondWithResult(_0x1ec4ad,_0x1d76e9){_0x1d76e9=_0x1d76e9||0xc8;return function(_0x3e1b34){if(_0x3e1b34){return _0x1ec4ad[_0xf15e('0x14')](_0x1d76e9)[_0xf15e('0x15')](_0x3e1b34);}};}function respondWithFilteredResult(_0x1cbcc3,_0x17c241){return function(_0x2d6bd7){if(_0x2d6bd7){var _0x54b94c=typeof _0x17c241[_0xf15e('0x16')]===_0xf15e('0x17')&&typeof _0x17c241['limit']===_0xf15e('0x17');var _0x4356ca=_0x2d6bd7[_0xf15e('0x18')];var _0x487018=_0x54b94c?0x0:_0x17c241['offset'];var _0x3ad067=_0x54b94c?_0x2d6bd7[_0xf15e('0x18')]:_0x17c241['offset']+_0x17c241[_0xf15e('0x19')];var _0x1f1f33;if(_0x3ad067>=_0x4356ca){_0x3ad067=_0x4356ca;_0x1f1f33=0xc8;}else{_0x1f1f33=0xce;}_0x1cbcc3[_0xf15e('0x14')](_0x1f1f33);return _0x1cbcc3['set']('Content-Range',_0x487018+'-'+_0x3ad067+'/'+_0x4356ca)[_0xf15e('0x15')](_0x2d6bd7);}return null;};}function patchUpdates(_0x3fa737){return function(_0x499658){try{jsonpatch[_0xf15e('0x1a')](_0x499658,_0x3fa737,!![]);}catch(_0x56e8c9){return BPromise['reject'](_0x56e8c9);}return _0x499658[_0xf15e('0x1b')]();};}function saveUpdates(_0x239d41,_0x389489){return function(_0x9ece34){if(_0x9ece34){return _0x9ece34['update'](_0x239d41)[_0xf15e('0x1c')](function(_0xa09c0c){return _0xa09c0c;});}return null;};}function removeEntity(_0x302b70,_0x51c06a){return function(_0x248c4b){if(_0x248c4b){return _0x248c4b[_0xf15e('0x1d')]()['then'](function(){_0x302b70['status'](0xcc)[_0xf15e('0x1e')]();});}};}function handleEntityNotFound(_0xb36af,_0x1fd237){return function(_0x471079){if(!_0x471079){_0xb36af[_0xf15e('0x13')](0x194);}return _0x471079;};}function handleError(_0x58877f,_0x48764e){_0x48764e=_0x48764e||0x1f4;return function(_0x3f9d64){logger[_0xf15e('0x1f')](_0x3f9d64['stack']);if(_0x3f9d64[_0xf15e('0x20')]){delete _0x3f9d64[_0xf15e('0x20')];}_0x58877f[_0xf15e('0x14')](_0x48764e)[_0xf15e('0x21')](_0x3f9d64);};}exports[_0xf15e('0x22')]=function(_0xff4c07,_0x1e6a63){var _0x40321a={},_0x5dd9cf={},_0x3567d5={'count':0x0,'rows':[]};var _0x17f112=_[_0xf15e('0x23')](db['WhatsappApplication'][_0xf15e('0x24')],function(_0x203711){return{'name':_0x203711['fieldName'],'type':_0x203711[_0xf15e('0x25')][_0xf15e('0x26')]};});_0x5dd9cf[_0xf15e('0x27')]=_['map'](_0x17f112,_0xf15e('0x20'));_0x5dd9cf[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0xff4c07[_0xf15e('0x28')]);_0x5dd9cf['filters']=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],_0x5dd9cf['query']);_0x40321a[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],qs['fields'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2c')]));_0x40321a['attributes']=_0x40321a[_0xf15e('0x2b')]['length']?_0x40321a[_0xf15e('0x2b')]:_0x5dd9cf[_0xf15e('0x27')];if(!_0xff4c07['query']['hasOwnProperty'](_0xf15e('0x2d'))){_0x40321a[_0xf15e('0x19')]=qs['limit'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x19')]);_0x40321a[_0xf15e('0x16')]=qs[_0xf15e('0x16')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x16')]);}_0x40321a['order']=qs[_0xf15e('0x2e')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2e')]);_0x40321a[_0xf15e('0x2f')]=qs[_0xf15e('0x30')](_[_0xf15e('0x31')](_0xff4c07[_0xf15e('0x28')],_0x5dd9cf[_0xf15e('0x30')]),_0x17f112);if(_0xff4c07['query'][_0xf15e('0x32')]){_0x40321a['where']=_[_0xf15e('0x33')](_0x40321a[_0xf15e('0x2f')],{'$or':_[_0xf15e('0x23')](_0x17f112,function(_0x40e707){if(_0x40e707[_0xf15e('0x25')]!==_0xf15e('0x34')){var _0x4d411f={};_0x4d411f[_0x40e707[_0xf15e('0x20')]]={'$like':'%'+_0xff4c07[_0xf15e('0x28')][_0xf15e('0x32')]+'%'};return _0x4d411f;}})});}_0x40321a=_[_0xf15e('0x33')]({},_0x40321a,_0xff4c07['options']);var _0x52ebab={'where':_0x40321a[_0xf15e('0x2f')]};return db[_0xf15e('0x35')][_0xf15e('0x18')](_0x52ebab)['then'](function(_0x514c68){_0x3567d5['count']=_0x514c68;if(_0xff4c07['query']['includeAll']){_0x40321a[_0xf15e('0x36')]=[{'all':!![]}];}return db[_0xf15e('0x35')][_0xf15e('0x37')](_0x40321a);})['then'](function(_0x3a56bd){_0x3567d5['rows']=_0x3a56bd;return _0x3567d5;})[_0xf15e('0x1c')](respondWithFilteredResult(_0x1e6a63,_0x40321a))[_0xf15e('0x38')](handleError(_0x1e6a63,null));};exports[_0xf15e('0x39')]=function(_0x180d7a,_0x52bbc4){var _0xf32fc5={'raw':!![],'where':{'id':_0x180d7a[_0xf15e('0x3a')]['id']}},_0x37f0a6={};_0x37f0a6[_0xf15e('0x27')]=_[_0xf15e('0x29')](db['WhatsappApplication'][_0xf15e('0x24')]);_0x37f0a6[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0x180d7a[_0xf15e('0x28')]);_0x37f0a6[_0xf15e('0x30')]=_[_0xf15e('0x2a')](_0x37f0a6[_0xf15e('0x27')],_0x37f0a6['query']);_0xf32fc5[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x37f0a6['model'],qs['fields'](_0x180d7a[_0xf15e('0x28')]['fields']));_0xf32fc5['attributes']=_0xf32fc5[_0xf15e('0x2b')][_0xf15e('0x3b')]?_0xf32fc5['attributes']:_0x37f0a6[_0xf15e('0x27')];if(_0x180d7a[_0xf15e('0x28')][_0xf15e('0x3c')]){_0xf32fc5[_0xf15e('0x36')]=[{'all':!![]}];}_0xf32fc5=_[_0xf15e('0x33')]({},_0xf32fc5,_0x180d7a[_0xf15e('0x3d')]);return db[_0xf15e('0x35')][_0xf15e('0x3e')](_0xf32fc5)[_0xf15e('0x1c')](handleEntityNotFound(_0x52bbc4,null))['then'](respondWithResult(_0x52bbc4,null))[_0xf15e('0x38')](handleError(_0x52bbc4,null));};exports[_0xf15e('0x3f')]=function(_0x3b79a8,_0x5b31c9){return db['WhatsappApplication'][_0xf15e('0x3f')](_0x3b79a8[_0xf15e('0x40')],{})[_0xf15e('0x1c')](respondWithResult(_0x5b31c9,0xc9))[_0xf15e('0x38')](handleError(_0x5b31c9,null));};exports[_0xf15e('0x41')]=function(_0xac7515,_0x3b5c7b){if(_0xac7515[_0xf15e('0x40')]['id']){delete _0xac7515['body']['id'];}return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0xac7515['params']['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3b5c7b,null))['then'](saveUpdates(_0xac7515[_0xf15e('0x40')],null))[_0xf15e('0x1c')](respondWithResult(_0x3b5c7b,null))[_0xf15e('0x38')](handleError(_0x3b5c7b,null));};exports['destroy']=function(_0x46e6e9,_0x3e2fd6){return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0x46e6e9[_0xf15e('0x3a')]['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3e2fd6,null))[_0xf15e('0x1c')](removeEntity(_0x3e2fd6,null))[_0xf15e('0x38')](handleError(_0x3e2fd6,null));}; \ No newline at end of file +var _0xb422=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','update','body','fast-json-patch','bluebird','util'];(function(_0x223704,_0x382bfa){var _0xe47fc6=function(_0x21d834){while(--_0x21d834){_0x223704['push'](_0x223704['shift']());}};_0xe47fc6(++_0x382bfa);}(_0xb422,0x85));var _0x2b42=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0xb422[_0x58ceb9];return _0x3d0ff5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b42('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b42('0x1'));var Mustache=require('mustache');var util=require(_0x2b42('0x2'));var path=require('path');var sox=require(_0x2b42('0x3'));var csv=require('to-csv');var ejs=require(_0x2b42('0x4'));var fs=require('fs');var fs_extra=require(_0x2b42('0x5'));var _=require(_0x2b42('0x6'));var squel=require('squel');var crypto=require(_0x2b42('0x7'));var jsforce=require(_0x2b42('0x8'));var deskjs=require(_0x2b42('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b42('0xa'));var Redis=require('ioredis');var authService=require(_0x2b42('0xb'));var qs=require(_0x2b42('0xc'));var as=require(_0x2b42('0xd'));var hardwareService=require(_0x2b42('0xe'));var logger=require('../../config/logger')(_0x2b42('0xf'));var utils=require(_0x2b42('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b42('0x11'));var db=require(_0x2b42('0x12'))['db'];function respondWithStatusCode(_0x22272e,_0x176efa){_0x176efa=_0x176efa||0xcc;return function(_0x4b8a04){if(_0x4b8a04){return _0x22272e['sendStatus'](_0x176efa);}return _0x22272e[_0x2b42('0x13')](_0x176efa)[_0x2b42('0x14')]();};}function respondWithResult(_0x5dec9a,_0x232c58){_0x232c58=_0x232c58||0xc8;return function(_0x17d103){if(_0x17d103){return _0x5dec9a[_0x2b42('0x13')](_0x232c58)[_0x2b42('0x15')](_0x17d103);}};}function respondWithFilteredResult(_0x4cb695,_0xc7e610){return function(_0x84b092){if(_0x84b092){var _0x1b93d5=typeof _0xc7e610[_0x2b42('0x16')]===_0x2b42('0x17')&&typeof _0xc7e610['limit']===_0x2b42('0x17');var _0x11fdec=_0x84b092[_0x2b42('0x18')];var _0x3e3426=_0x1b93d5?0x0:_0xc7e610[_0x2b42('0x16')];var _0x3ab83c=_0x1b93d5?_0x84b092[_0x2b42('0x18')]:_0xc7e610[_0x2b42('0x16')]+_0xc7e610['limit'];var _0x22b8d6;if(_0x3ab83c>=_0x11fdec){_0x3ab83c=_0x11fdec;_0x22b8d6=0xc8;}else{_0x22b8d6=0xce;}_0x4cb695[_0x2b42('0x13')](_0x22b8d6);return _0x4cb695['set'](_0x2b42('0x19'),_0x3e3426+'-'+_0x3ab83c+'/'+_0x11fdec)['json'](_0x84b092);}return null;};}function patchUpdates(_0x38d41c){return function(_0x13422a){try{jsonpatch[_0x2b42('0x1a')](_0x13422a,_0x38d41c,!![]);}catch(_0x50fd94){return BPromise['reject'](_0x50fd94);}return _0x13422a[_0x2b42('0x1b')]();};}function saveUpdates(_0x24061b,_0x24ac96){return function(_0x2ee957){if(_0x2ee957){return _0x2ee957['update'](_0x24061b)[_0x2b42('0x1c')](function(_0x355859){return _0x355859;});}return null;};}function removeEntity(_0x5063b6,_0x2b9531){return function(_0x2e9aa1){if(_0x2e9aa1){return _0x2e9aa1[_0x2b42('0x1d')]()[_0x2b42('0x1c')](function(){_0x5063b6[_0x2b42('0x13')](0xcc)[_0x2b42('0x14')]();});}};}function handleEntityNotFound(_0x5367f0,_0x20ee74){return function(_0x319692){if(!_0x319692){_0x5367f0[_0x2b42('0x1e')](0x194);}return _0x319692;};}function handleError(_0x256fc9,_0x1d37b9){_0x1d37b9=_0x1d37b9||0x1f4;return function(_0x807625){logger[_0x2b42('0x1f')](_0x807625[_0x2b42('0x20')]);if(_0x807625[_0x2b42('0x21')]){delete _0x807625[_0x2b42('0x21')];}_0x256fc9[_0x2b42('0x13')](_0x1d37b9)['send'](_0x807625);};}exports['index']=function(_0x162efa,_0xcb30f5){var _0x8293e2={},_0x352ef7={},_0x4b43b0={'count':0x0,'rows':[]};var _0x286223=_[_0x2b42('0x22')](db[_0x2b42('0x23')]['rawAttributes'],function(_0x5588ce){return{'name':_0x5588ce[_0x2b42('0x24')],'type':_0x5588ce[_0x2b42('0x25')][_0x2b42('0x26')]};});_0x352ef7[_0x2b42('0x27')]=_['map'](_0x286223,_0x2b42('0x21'));_0x352ef7[_0x2b42('0x28')]=_[_0x2b42('0x29')](_0x162efa['query']);_0x352ef7[_0x2b42('0x2a')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],_0x352ef7[_0x2b42('0x28')]);_0x8293e2[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x162efa[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x8293e2[_0x2b42('0x2c')]=_0x8293e2['attributes'][_0x2b42('0x2e')]?_0x8293e2['attributes']:_0x352ef7['model'];if(!_0x162efa[_0x2b42('0x28')][_0x2b42('0x2f')]('nolimit')){_0x8293e2['limit']=qs['limit'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x30')]);_0x8293e2[_0x2b42('0x16')]=qs['offset'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x16')]);}_0x8293e2['order']=qs['sort'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x31')]);_0x8293e2[_0x2b42('0x32')]=qs['filters'](_[_0x2b42('0x33')](_0x162efa[_0x2b42('0x28')],_0x352ef7[_0x2b42('0x2a')]),_0x286223);if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]){_0x8293e2['where']=_[_0x2b42('0x35')](_0x8293e2[_0x2b42('0x32')],{'$or':_[_0x2b42('0x22')](_0x286223,function(_0x3971ee){if(_0x3971ee[_0x2b42('0x25')]!==_0x2b42('0x36')){var _0x45fb9f={};_0x45fb9f[_0x3971ee[_0x2b42('0x21')]]={'$like':'%'+_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]+'%'};return _0x45fb9f;}})});}_0x8293e2=_['merge']({},_0x8293e2,_0x162efa['options']);var _0x17b9b1={'where':_0x8293e2[_0x2b42('0x32')]};return db[_0x2b42('0x23')][_0x2b42('0x18')](_0x17b9b1)['then'](function(_0x1188d9){_0x4b43b0[_0x2b42('0x18')]=_0x1188d9;if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x37')]){_0x8293e2[_0x2b42('0x38')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2b42('0x39')](_0x8293e2);})['then'](function(_0x35e745){_0x4b43b0[_0x2b42('0x3a')]=_0x35e745;return _0x4b43b0;})['then'](respondWithFilteredResult(_0xcb30f5,_0x8293e2))['catch'](handleError(_0xcb30f5,null));};exports[_0x2b42('0x3b')]=function(_0x10fad1,_0x4dc92e){var _0x5c525b={'raw':!![],'where':{'id':_0x10fad1[_0x2b42('0x3c')]['id']}},_0x3cc07e={};_0x3cc07e[_0x2b42('0x27')]=_[_0x2b42('0x29')](db[_0x2b42('0x23')][_0x2b42('0x3d')]);_0x3cc07e['query']=_[_0x2b42('0x29')](_0x10fad1[_0x2b42('0x28')]);_0x3cc07e['filters']=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],_0x3cc07e[_0x2b42('0x28')]);_0x5c525b[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x10fad1[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x5c525b[_0x2b42('0x2c')]=_0x5c525b[_0x2b42('0x2c')][_0x2b42('0x2e')]?_0x5c525b[_0x2b42('0x2c')]:_0x3cc07e[_0x2b42('0x27')];if(_0x10fad1[_0x2b42('0x28')]['includeAll']){_0x5c525b['include']=[{'all':!![]}];}_0x5c525b=_['merge']({},_0x5c525b,_0x10fad1[_0x2b42('0x3e')]);return db[_0x2b42('0x23')][_0x2b42('0x3f')](_0x5c525b)[_0x2b42('0x1c')](handleEntityNotFound(_0x4dc92e,null))[_0x2b42('0x1c')](respondWithResult(_0x4dc92e,null))[_0x2b42('0x40')](handleError(_0x4dc92e,null));};exports['create']=function(_0x11da42,_0x466e49){return db['WhatsappApplication'][_0x2b42('0x41')](_0x11da42['body'],{})[_0x2b42('0x1c')](respondWithResult(_0x466e49,0xc9))[_0x2b42('0x40')](handleError(_0x466e49,null));};exports[_0x2b42('0x42')]=function(_0x45fecd,_0x2890d2){if(_0x45fecd[_0x2b42('0x43')]['id']){delete _0x45fecd[_0x2b42('0x43')]['id'];}return db[_0x2b42('0x23')]['find']({'where':{'id':_0x45fecd[_0x2b42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2890d2,null))[_0x2b42('0x1c')](saveUpdates(_0x45fecd[_0x2b42('0x43')],null))[_0x2b42('0x1c')](respondWithResult(_0x2890d2,null))['catch'](handleError(_0x2890d2,null));};exports[_0x2b42('0x1d')]=function(_0x3e09f3,_0x212b03){return db[_0x2b42('0x23')]['find']({'where':{'id':_0x3e09f3['params']['id']}})[_0x2b42('0x1c')](handleEntityNotFound(_0x212b03,null))[_0x2b42('0x1c')](removeEntity(_0x212b03,null))[_0x2b42('0x40')](handleError(_0x212b03,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 90ae018..5db2d4e 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 _0x68f5=['bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x12b8e8,_0x3e07b4){var _0x52d2c2=function(_0x1c1aa3){while(--_0x1c1aa3){_0x12b8e8['push'](_0x12b8e8['shift']());}};_0x52d2c2(++_0x3e07b4);}(_0x68f5,0x11a));var _0x568f=function(_0x17c012,_0x581e0d){_0x17c012=_0x17c012-0x0;var _0x19e62c=_0x68f5[_0x17c012];return _0x19e62c;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('WhatsappApplication',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x568f('0xb'),'collate':_0x568f('0xc')});}; \ No newline at end of file +var _0x79d3=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x79d3,0x15f));var _0x379d=function(_0x413ff0,_0x1e782d){_0x413ff0=_0x413ff0-0x0;var _0x3826d4=_0x79d3[_0x413ff0];return _0x3826d4;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x379d('0xa'),'collate':_0x379d('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9202550..2b2cadd 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2061e7,_0x54a195){var _0x40b072=function(_0x4ea88d){while(--_0x4ea88d){_0x2061e7['push'](_0x2061e7['shift']());}};_0x40b072(++_0x54a195);}(_0x54ef,0x112));var _0xf54e=function(_0x4d3f37,_0x2c3eee){_0x4d3f37=_0x4d3f37-0x0;var _0x48e59=_0x54ef[_0x4d3f37];return _0x48e59;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0xfd5a12,_0x3178ff){var _0x5ba1ad=function(_0x4032aa){while(--_0x4032aa){_0xfd5a12['push'](_0xfd5a12['shift']());}};_0x5ba1ad(++_0x3178ff);}(_0x0e85,0x7c));var _0x50e8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0e85[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a044266..ac1e2ad 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 _0x199c=['tracked','whatsapp','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','/:id/tags'];(function(_0x56836f,_0x2d3554){var _0x5b9db4=function(_0x35f856){while(--_0x35f856){_0x56836f['push'](_0x56836f['shift']());}};_0x5b9db4(++_0x2d3554);}(_0x199c,0x1d8));var _0xc199=function(_0x31e077,_0x582ca4){_0x31e077=_0x31e077-0x0;var _0x2a6d19=_0x199c[_0x31e077];return _0x2a6d19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var fs_extra=require(_0xc199('0x4'));var auth=require(_0xc199('0x5'));var interaction=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller['index']);router['get'](_0xc199('0xa'),auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')](_0xc199('0xc'),auth[_0xc199('0x9')](),controller[_0xc199('0xd')]);router[_0xc199('0x8')]('/:id/messages',auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router[_0xc199('0x8')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x10')]);router['post']('/',auth[_0xc199('0x9')](),controller[_0xc199('0x11')]);router[_0xc199('0x12')](_0xc199('0x13'),auth[_0xc199('0x9')](),controller['addMessage']);router[_0xc199('0x12')](_0xc199('0x14'),auth[_0xc199('0x9')](),interaction[_0xc199('0x15')](_0xc199('0x16'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc199('0x17')]('/:id',auth[_0xc199('0x9')](),interaction[_0xc199('0x15')]('whatsapp',_0xc199('0x18')),controller['update']);router[_0xc199('0x19')](_0xc199('0xc'),auth[_0xc199('0x9')](),interaction[_0xc199('0x15')](_0xc199('0x16'),_0xc199('0x1a')),controller[_0xc199('0x1b')]);router[_0xc199('0x19')](_0xc199('0x14'),auth[_0xc199('0x9')](),controller[_0xc199('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0x7da7,0x10d));var _0x77da=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x7da7[_0x1305e3];return _0x1068e9;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x77da('0x7')]('/',auth[_0x77da('0x8')](),controller['index']);router[_0x77da('0x7')]('/describe',auth[_0x77da('0x8')](),controller[_0x77da('0x9')]);router[_0x77da('0x7')](_0x77da('0xa'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x7')](_0x77da('0xb'),auth[_0x77da('0x8')](),controller['getMessages']);router[_0x77da('0x7')](_0x77da('0xc'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x8')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x77da('0x10')]);router[_0x77da('0xf')]('/:id/tags',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x13')),controller['addTags']);router[_0x77da('0x14')]('/:id',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x15')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x16')),controller[_0x77da('0x17')]);router[_0x77da('0x18')](_0x77da('0x19'),auth[_0x77da('0x8')](),controller[_0x77da('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b898897..fa1d0c3 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 _0x7033=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize','moment'];(function(_0x4dc515,_0xed38da){var _0x13506b=function(_0x822fa0){while(--_0x822fa0){_0x4dc515['push'](_0x4dc515['shift']());}};_0x13506b(++_0xed38da);}(_0x7033,0x19e));var _0x3703=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7033[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3703('0x0'));var moment=require(_0x3703('0x1'));module[_0x3703('0x2')]={'closed':{'type':Sequelize[_0x3703('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3703('0x4')]},'secondDisposition':{'type':Sequelize[_0x3703('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3703('0x4')]},'note':{'type':Sequelize[_0x3703('0x4')]},'phone':{'type':Sequelize[_0x3703('0x4')]},'read1stAt':{'type':Sequelize[_0x3703('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x3703('0x6')]('in',_0x3703('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3703('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x3703('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf3f9=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize','moment'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x3ffceb,_0x419f85){_0x3ffceb=_0x3ffceb-0x0;var _0x2ebaf0=_0xf3f9[_0x3ffceb];return _0x2ebaf0;};'use strict';var Sequelize=require(_0x9f3f('0x0'));var moment=require(_0x9f3f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9f3f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f3f('0x3')]},'disposition':{'type':Sequelize[_0x9f3f('0x4')]},'secondDisposition':{'type':Sequelize[_0x9f3f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9f3f('0x4')]},'note':{'type':Sequelize[_0x9f3f('0x4')]},'phone':{'type':Sequelize[_0x9f3f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f3f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9f3f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f3f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9f3f('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 70796d3..3b4c19b 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 _0xfd23=['value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','order','WhatsappInteractionId','where','$gte','split','includeAll','include','rows','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','Contact','firstName','Attachment','Messages','createdAt','secret','read','push','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','createWriteStream','format','direction','User','System','lastName','out'];(function(_0x47abc5,_0x56b515){var _0x3bd4ef=function(_0x599d94){while(--_0x599d94){_0x47abc5['push'](_0x47abc5['shift']());}};_0x3bd4ef(++_0x56b515);}(_0xfd23,0x17b));var _0x3fd2=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xfd23[_0x382a62];return _0x490a25;};'use strict';var rimraf=require(_0x3fd2('0x0'));var zipdir=require(_0x3fd2('0x1'));var moment=require(_0x3fd2('0x2'));var BPromise=require('bluebird');var util=require(_0x3fd2('0x3'));var path=require(_0x3fd2('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fd2('0x5'));var Redis=require(_0x3fd2('0x6'));var interaction=require(_0x3fd2('0x7'));var qs=require(_0x3fd2('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x3fd2('0x9'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3fd2('0xa')]=_['defaults'](config[_0x3fd2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fd2('0xb'))(new Redis(config['redis']));require(_0x3fd2('0xc'))[_0x3fd2('0xd')](socket);function respondWithStatusCode(_0x3c2fdb,_0x47beae){_0x47beae=_0x47beae||0xcc;return function(_0x105a14){if(_0x105a14){return _0x3c2fdb[_0x3fd2('0xe')](_0x47beae);}return _0x3c2fdb[_0x3fd2('0xf')](_0x47beae)[_0x3fd2('0x10')]();};}function respondWithResult(_0xd7a42f,_0x20324c){_0x20324c=_0x20324c||0xc8;return function(_0x4e4e27){if(_0x4e4e27){return _0xd7a42f[_0x3fd2('0xf')](_0x20324c)[_0x3fd2('0x11')](_0x4e4e27);}};}function respondWithFilteredResult(_0x59eef1,_0x449bf2){return function(_0x16c628){if(_0x16c628){var _0x1887d9=typeof _0x449bf2[_0x3fd2('0x12')]===_0x3fd2('0x13')&&typeof _0x449bf2['limit']==='undefined';var _0x1a151b=_0x16c628[_0x3fd2('0x14')];var _0x3a0185=_0x1887d9?0x0:_0x449bf2[_0x3fd2('0x12')];var _0x39bfea=_0x1887d9?_0x16c628['count']:_0x449bf2[_0x3fd2('0x12')]+_0x449bf2[_0x3fd2('0x15')];var _0x2b6fcb;if(_0x39bfea>=_0x1a151b){_0x39bfea=_0x1a151b;_0x2b6fcb=0xc8;}else{_0x2b6fcb=0xce;}_0x59eef1['status'](_0x2b6fcb);return _0x59eef1[_0x3fd2('0x16')](_0x3fd2('0x17'),_0x3a0185+'-'+_0x39bfea+'/'+_0x1a151b)[_0x3fd2('0x11')](_0x16c628);}return null;};}function saveUpdates(_0x543f49){return function(_0x247740){if(_0x247740){return _0x247740[_0x3fd2('0x18')](_0x543f49)[_0x3fd2('0x19')](function(_0x4e4f56){return _0x4e4f56;});}return null;};}function removeEntity(_0x4a90d6){return function(_0x6983f0){if(_0x6983f0){return _0x6983f0['destroy']()[_0x3fd2('0x19')](function(){_0x4a90d6[_0x3fd2('0xf')](0xcc)[_0x3fd2('0x10')]();});}};}function handleEntityNotFound(_0x3a8803){return function(_0x218f10){if(!_0x218f10){_0x3a8803['sendStatus'](0x194);}return _0x218f10;};}function handleError(_0x37f5c9,_0x4b379a){_0x4b379a=_0x4b379a||0x1f4;return function(_0x51d966){logger[_0x3fd2('0x1a')](_0x51d966[_0x3fd2('0x1b')]);if(_0x51d966['name']){delete _0x51d966[_0x3fd2('0x1c')];}_0x37f5c9['status'](_0x4b379a)[_0x3fd2('0x1d')](_0x51d966);};}exports[_0x3fd2('0x1e')]=function(_0x46e470,_0x2b2a22){var _0x47dfc2={};var _0x4678b9=_[_0x3fd2('0x1f')](db[_0x3fd2('0x20')][_0x3fd2('0x21')],function(_0x3e4ff9){return{'name':_0x3e4ff9[_0x3fd2('0x22')],'type':_0x3e4ff9['type'][_0x3fd2('0x23')]};});_0x47dfc2=qs[_0x3fd2('0x24')](_0x4678b9,_0x46e470);return interaction[_0x3fd2('0x25')](_0x3fd2('0x26'),_0x46e470[_0x3fd2('0x27')],_0x46e470[_0x3fd2('0x28')],_0x47dfc2,_0x4678b9)[_0x3fd2('0x19')](respondWithFilteredResult(_0x2b2a22,_0x47dfc2))[_0x3fd2('0x29')](handleError(_0x2b2a22,null));};exports[_0x3fd2('0x2a')]=function(_0x5e46be,_0x912bbf){var _0x248f02={'raw':![],'where':{'id':_0x5e46be[_0x3fd2('0x2b')]['id']}},_0x3020c8={};_0x3020c8[_0x3fd2('0x2c')]=_[_0x3fd2('0x2d')](db[_0x3fd2('0x20')][_0x3fd2('0x21')]);_0x3020c8['query']=_[_0x3fd2('0x2d')](_0x5e46be[_0x3fd2('0x27')]);_0x3020c8[_0x3fd2('0x2e')]=_[_0x3fd2('0x2f')](_0x3020c8[_0x3fd2('0x2c')],_0x3020c8[_0x3fd2('0x27')]);_0x248f02[_0x3fd2('0x30')]=_[_0x3fd2('0x2f')](_0x3020c8[_0x3fd2('0x2c')],qs['fields'](_0x5e46be[_0x3fd2('0x27')][_0x3fd2('0x31')]));_0x248f02[_0x3fd2('0x30')]=_0x248f02[_0x3fd2('0x30')][_0x3fd2('0x32')]?_0x248f02[_0x3fd2('0x30')]:_0x3020c8[_0x3fd2('0x2c')];if(_0x5e46be[_0x3fd2('0x27')]['includeAll']){_0x248f02['include']=[{'all':!![]}];}_0x248f02=_[_0x3fd2('0x33')]({},_0x248f02,_0x5e46be[_0x3fd2('0x34')]);return db[_0x3fd2('0x20')][_0x3fd2('0x35')](_0x248f02)['then'](handleEntityNotFound(_0x912bbf,null))[_0x3fd2('0x19')](respondWithResult(_0x912bbf,null))[_0x3fd2('0x29')](handleError(_0x912bbf,null));};exports[_0x3fd2('0x36')]=function(_0x4bfcc1,_0x124d80){return db[_0x3fd2('0x20')][_0x3fd2('0x36')](_0x4bfcc1[_0x3fd2('0x37')],{})[_0x3fd2('0x19')](respondWithResult(_0x124d80,0xc9))['catch'](handleError(_0x124d80,null));};exports[_0x3fd2('0x18')]=function(_0x1b3d3a,_0x201065){if(_0x1b3d3a[_0x3fd2('0x37')]['id']){delete _0x1b3d3a[_0x3fd2('0x37')]['id'];}return db[_0x3fd2('0x20')]['find']({'where':{'id':_0x1b3d3a[_0x3fd2('0x2b')]['id']}})[_0x3fd2('0x19')](handleEntityNotFound(_0x201065,null))[_0x3fd2('0x19')](saveUpdates(_0x1b3d3a[_0x3fd2('0x37')],null))[_0x3fd2('0x19')](respondWithResult(_0x201065,null))[_0x3fd2('0x29')](handleError(_0x201065,null));};exports[_0x3fd2('0x38')]=function(_0x1447a3,_0x2db450){return db[_0x3fd2('0x20')]['find']({'where':{'id':_0x1447a3[_0x3fd2('0x2b')]['id']}})[_0x3fd2('0x19')](handleEntityNotFound(_0x2db450,null))[_0x3fd2('0x19')](removeEntity(_0x2db450,null))['catch'](handleError(_0x2db450,null));};exports['describe']=function(_0x209696,_0x169557){return db[_0x3fd2('0x20')][_0x3fd2('0x39')]()[_0x3fd2('0x19')](respondWithResult(_0x169557,null))[_0x3fd2('0x29')](handleError(_0x169557,null));};exports[_0x3fd2('0x3a')]=function(_0x530957,_0x4c387d){return db[_0x3fd2('0x3b')][_0x3fd2('0x35')]({'where':{'id':_0x530957[_0x3fd2('0x2b')]['id']}})[_0x3fd2('0x19')](handleEntityNotFound(_0x4c387d,null))[_0x3fd2('0x19')](function(_0x2b2bf3){if(_0x2b2bf3){return _0x2b2bf3[_0x3fd2('0x3a')](_0x530957[_0x3fd2('0x37')][_0x3fd2('0x3c')],_[_0x3fd2('0x3d')](_0x530957[_0x3fd2('0x37')],[_0x3fd2('0x3c'),'id'])||{});}})[_0x3fd2('0x19')](respondWithResult(_0x4c387d,null))['catch'](handleError(_0x4c387d,null));};exports[_0x3fd2('0x3e')]=function(_0x32d3f9,_0x2aa07d){var _0x485740={'raw':![],'where':{}};var _0x177057={};var _0x336ae8={'count':0x0,'rows':[]};return db[_0x3fd2('0x20')][_0x3fd2('0x3f')]({'where':{'id':_0x32d3f9[_0x3fd2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2aa07d,null))['then'](function(_0x221cd8){if(_0x221cd8){_0x177057[_0x3fd2('0x2c')]=_['keys'](db[_0x3fd2('0x3b')][_0x3fd2('0x21')]);_0x177057[_0x3fd2('0x27')]=_[_0x3fd2('0x2d')](_0x32d3f9[_0x3fd2('0x27')]);_0x177057['filters']=_['intersection'](_0x177057['model'],_0x177057[_0x3fd2('0x27')]);_0x485740[_0x3fd2('0x30')]=_['intersection'](_0x177057[_0x3fd2('0x2c')],qs[_0x3fd2('0x31')](_0x32d3f9[_0x3fd2('0x27')][_0x3fd2('0x31')]));_0x485740[_0x3fd2('0x30')]=_0x485740['attributes'][_0x3fd2('0x32')]?_0x485740['attributes']:_0x177057[_0x3fd2('0x2c')];if(!_0x32d3f9['query']['hasOwnProperty'](_0x3fd2('0x40'))){_0x485740[_0x3fd2('0x15')]=qs[_0x3fd2('0x15')](_0x32d3f9[_0x3fd2('0x27')][_0x3fd2('0x15')]);_0x485740[_0x3fd2('0x12')]=qs['offset'](_0x32d3f9['query'][_0x3fd2('0x12')]);}_0x485740[_0x3fd2('0x41')]=qs['sort'](_0x32d3f9[_0x3fd2('0x27')]['sort']);_0x485740['where']=qs['filters'](_['pick'](_0x32d3f9[_0x3fd2('0x27')],_0x177057[_0x3fd2('0x2e')]));_0x485740['where'][_0x3fd2('0x42')]=_0x221cd8['id'];if(_0x32d3f9['query']['filter']){_0x485740[_0x3fd2('0x43')]=_[_0x3fd2('0x33')](_0x485740[_0x3fd2('0x43')],{'$or':_[_0x3fd2('0x1f')](_0x485740['attributes'],function(_0x1bc01c){var _0x4bb73d={};_0x4bb73d[_0x1bc01c]={'$like':'%'+_0x32d3f9[_0x3fd2('0x27')]['filter']+'%'};return _0x4bb73d;})});}if(_0x32d3f9[_0x3fd2('0x27')][_0x3fd2('0x44')]){var _0x553c93=_0x32d3f9[_0x3fd2('0x27')][_0x3fd2('0x44')][_0x3fd2('0x45')](',');var _0x2ffcc1={};_0x2ffcc1[_0x553c93[0x0]]={'$gte':moment(_0x553c93[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x485740['where']=_['merge'](_0x485740[_0x3fd2('0x43')],_0x2ffcc1);}_0x485740=_[_0x3fd2('0x33')]({},_0x485740,_0x32d3f9[_0x3fd2('0x34')]);return db['WhatsappMessage']['count']({'where':_0x485740[_0x3fd2('0x43')]})[_0x3fd2('0x19')](function(_0x30e098){_0x336ae8[_0x3fd2('0x14')]=_0x30e098;if(_0x32d3f9[_0x3fd2('0x27')][_0x3fd2('0x46')]){_0x485740[_0x3fd2('0x47')]=[{'all':!![]}];}return db[_0x3fd2('0x3b')]['findAll'](_0x485740);})[_0x3fd2('0x19')](function(_0x2cfbea){_0x336ae8[_0x3fd2('0x48')]=_0x2cfbea;return _0x336ae8;});}})['then'](respondWithFilteredResult(_0x2aa07d,_0x485740))[_0x3fd2('0x29')](handleError(_0x2aa07d,null));};exports[_0x3fd2('0x49')]=function(_0xa08269,_0x52aedf){return db[_0x3fd2('0x20')][_0x3fd2('0x35')]({'where':{'id':_0xa08269[_0x3fd2('0x2b')]['id']}})[_0x3fd2('0x19')](handleEntityNotFound(_0x52aedf,null))['then'](function(_0x4c889b){if(_0x4c889b){return _0x4c889b[_0x3fd2('0x4a')](_0xa08269['body'][_0x3fd2('0x3c')],_[_0x3fd2('0x3d')](_0xa08269[_0x3fd2('0x37')],[_0x3fd2('0x3c'),'id'])||{})[_0x3fd2('0x4b')](function(){return db['Tag'][_0x3fd2('0x25')]({'attributes':['id',_0x3fd2('0x1c'),'color'],'where':{'id':_0xa08269[_0x3fd2('0x37')][_0x3fd2('0x3c')]}});})['then'](function(_0x5ef6c6){socket[_0x3fd2('0x4c')](_0x3fd2('0x4d'),{'id':Number(_0xa08269['params']['id']),'tags':_0x5ef6c6||[]});return{'id':Number(_0xa08269[_0x3fd2('0x2b')]['id']),'tags':_0x5ef6c6||[]};});}})[_0x3fd2('0x19')](respondWithResult(_0x52aedf,null))[_0x3fd2('0x29')](handleError(_0x52aedf,null));};exports['removeTags']=function(_0x407767,_0x527e9f){return db['WhatsappInteraction']['find']({'where':{'id':_0x407767[_0x3fd2('0x2b')]['id']}})[_0x3fd2('0x19')](handleEntityNotFound(_0x527e9f,null))[_0x3fd2('0x19')](function(_0x4ea22f){if(_0x4ea22f){return _0x4ea22f[_0x3fd2('0x4e')](_0x407767[_0x3fd2('0x27')][_0x3fd2('0x3c')]);}})[_0x3fd2('0x19')](respondWithStatusCode(_0x527e9f,null))['catch'](handleError(_0x527e9f,null));};exports[_0x3fd2('0x4f')]=function(_0x331039,_0x5a8669){var _0x29953f=moment()[_0x3fd2('0x50')]()[_0x3fd2('0x51')]();var _0x2de0d8=path[_0x3fd2('0x52')](config[_0x3fd2('0x53')],_0x3fd2('0x54'),_0x3fd2('0x55'),_0x3fd2('0x56'));var _0x1ed9c9=path[_0x3fd2('0x52')](config['root'],_0x3fd2('0x54'),'files',_0x3fd2('0x57'));var _0x2a9d22=path[_0x3fd2('0x52')](_0x2de0d8,_0x29953f);var _0x33261d=util['format'](_0x3fd2('0x58'),_0x331039[_0x3fd2('0x2b')]['id'],_0x29953f);var _0x5e4079=path[_0x3fd2('0x52')](_0x2de0d8,_0x33261d);var _0x13babe=[];_0x13babe['push']({'model':db['User'],'as':'User','attributes':['id',_0x3fd2('0x59')],'raw':!![]});_0x13babe['push']({'model':db['CmContact'],'as':_0x3fd2('0x5a'),'attributes':['id',_0x3fd2('0x5b'),'lastName'],'raw':!![]});if(_0x331039[_0x3fd2('0x27')][_0x3fd2('0x57')]){_0x13babe['push']({'model':db['Attachment'],'as':_0x3fd2('0x5c'),'raw':!![]});}var _0x34b9da=[{'model':db[_0x3fd2('0x3b')],'as':_0x3fd2('0x5d'),'attributes':['id',_0x3fd2('0x37'),_0x3fd2('0x5e'),'direction',_0x3fd2('0x5f'),_0x3fd2('0x60')],'include':_0x13babe}];_0x34b9da[_0x3fd2('0x61')]({'model':db[_0x3fd2('0x62')],'as':_0x3fd2('0x63'),'attributes':['id','name']});_0x34b9da['push']({'model':db['User'],'as':_0x3fd2('0x64'),'attributes':['id',_0x3fd2('0x59')]});return db[_0x3fd2('0x20')][_0x3fd2('0x35')]({'where':{'id':_0x331039[_0x3fd2('0x2b')]['id']},'include':_0x34b9da})[_0x3fd2('0x19')](handleEntityNotFound(_0x5a8669,null))[_0x3fd2('0x19')](function(_0x4e8cc0){if(_0x4e8cc0){var _0x4c6d26=_0x4e8cc0[_0x3fd2('0x65')]({'plain':!![]});fs[_0x3fd2('0x66')](_0x2a9d22);var _0x46c105={'channel':'Whatsapp','account':_0x4c6d26['Account']['name'],'agent':_0x4c6d26[_0x3fd2('0x64')]?_0x4c6d26['Owner'][_0x3fd2('0x59')]:_0x3fd2('0x67'),'createdAt':moment(_0x4c6d26['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4c6d26[_0x3fd2('0x68')]?moment(_0x4c6d26[_0x3fd2('0x69')])['format'](_0x3fd2('0x6a'))[_0x3fd2('0x51')]():'','disposition':_0x4c6d26[_0x3fd2('0x6b')],'messages':_(_0x4c6d26[_0x3fd2('0x5d')])['filter']({'secret':![]})[_0x3fd2('0x1f')](function(_0x411d7){if(_0x411d7['Attachment']){var _0x5817f8=path[_0x3fd2('0x52')](_0x1ed9c9,_0x411d7[_0x3fd2('0x5c')][_0x3fd2('0x6c')]);if(fs[_0x3fd2('0x6d')](_0x5817f8)){fs['createReadStream'](_0x5817f8)['pipe'](fs[_0x3fd2('0x6e')](path['join'](_0x2a9d22,_0x411d7[_0x3fd2('0x5c')][_0x3fd2('0x6c')])));}}return{'date':moment(_0x411d7['createdAt'])[_0x3fd2('0x6f')](_0x3fd2('0x6a'))[_0x3fd2('0x51')](),'sender':_0x411d7[_0x3fd2('0x70')]==='out'?_0x411d7[_0x3fd2('0x71')]?_0x411d7[_0x3fd2('0x71')][_0x3fd2('0x59')]:_0x3fd2('0x72'):_0x411d7[_0x3fd2('0x5a')][_0x3fd2('0x5b')]+(_0x411d7[_0x3fd2('0x5a')][_0x3fd2('0x73')]?'\x20'+_0x411d7['Contact'][_0x3fd2('0x73')]:''),'body':_0x411d7['Attachment']?_0x411d7[_0x3fd2('0x5c')][_0x3fd2('0x6c')]:_0x411d7[_0x3fd2('0x37')],'direction':_0x411d7[_0x3fd2('0x70')]===_0x3fd2('0x74')?'A':'C','secret':_0x411d7[_0x3fd2('0x5f')],'read':_0x411d7[_0x3fd2('0x60')],'attachment':_0x411d7[_0x3fd2('0x5c')]};})[_0x3fd2('0x75')]()};return ejs[_0x3fd2('0x76')](path['join'](config[_0x3fd2('0x53')],'server',_0x3fd2('0x77'),_0x3fd2('0x78')),{'interaction':_0x46c105})[_0x3fd2('0x19')](function(_0x4a6f74){var _0x163a24=path[_0x3fd2('0x52')](_0x2a9d22,_0x3fd2('0x79')+_0x4c6d26['id']+'-'+_0x29953f+_0x3fd2('0x7a'));var _0x4a362f={'path':_0x163a24,'channel':'Whatsapp','interactionId':_0x4c6d26['id']};return pdf['createPdfFromHTML'](_0x4a6f74,_0x4a362f);})[_0x3fd2('0x19')](function(){return new BPromise(function(_0x1cc1b2,_0x4577ac){zipdir(_0x2a9d22,{'saveTo':_0x5e4079},function(_0x255f13,_0x234be0){if(_0x255f13)return _0x4577ac(_0x255f13);return _0x1cc1b2(_0x234be0);});})[_0x3fd2('0x19')](function(){return new BPromise(function(_0x6be916,_0x456c17){rimraf(_0x2a9d22,function(_0x488576){if(_0x488576)_0x456c17(_0x488576);return _0x6be916();});});})[_0x3fd2('0x19')](function(){return _0x5a8669['download'](_0x5e4079,_0x33261d,function(_0x52e004){if(_0x52e004){console[_0x3fd2('0x7b')]('err',_0x52e004);}else{fs['unlinkSync'](_0x5e4079);}});});});}else{return _0x5a8669[_0x3fd2('0xe')](0xc8);}})[_0x3fd2('0x29')](handleError(_0x5a8669,null));}; \ No newline at end of file +var _0xa673=['ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','fieldName','type','key','getOptions','findAll','user','show','params','keys','WhatsappInteraction','rawAttributes','query','filters','intersection','attributes','fields','model','include','merge','options','find','catch','create','body','describe','addMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','secret','read','WhatsappAccount','Account','fullname','get','mkdirSync','Owner','createdAt','closedAt','disposition','Messages','Attachment','basename','existsSync','pipe','createWriteStream','direction','System','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','moment','bluebird','util'];(function(_0x3eb03f,_0x3a2f91){var _0x56140c=function(_0x5bef45){while(--_0x5bef45){_0x3eb03f['push'](_0x3eb03f['shift']());}};_0x56140c(++_0x3a2f91);}(_0xa673,0x17b));var _0x3a67=function(_0x371761,_0x42a66f){_0x371761=_0x371761-0x0;var _0x279921=_0xa673[_0x371761];return _0x279921;};'use strict';var rimraf=require(_0x3a67('0x0'));var zipdir=require(_0x3a67('0x1'));var moment=require(_0x3a67('0x2'));var BPromise=require(_0x3a67('0x3'));var util=require(_0x3a67('0x4'));var path=require('path');var ejs=require(_0x3a67('0x5'));var fs=require('fs');var _=require(_0x3a67('0x6'));var Redis=require(_0x3a67('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3a67('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x3a67('0x9'))(_0x3a67('0xa'));var config=require('../../config/environment');var db=require(_0x3a67('0xb'))['db'];config[_0x3a67('0xc')]=_['defaults'](config[_0x3a67('0xc')],{'host':_0x3a67('0xd'),'port':0x18eb});var socket=require(_0x3a67('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x3a67('0xf')](socket);function respondWithStatusCode(_0x27f828,_0x1884e2){_0x1884e2=_0x1884e2||0xcc;return function(_0x1774f4){if(_0x1774f4){return _0x27f828[_0x3a67('0x10')](_0x1884e2);}return _0x27f828[_0x3a67('0x11')](_0x1884e2)['end']();};}function respondWithResult(_0x5c7d72,_0x3b1caa){_0x3b1caa=_0x3b1caa||0xc8;return function(_0x54ea28){if(_0x54ea28){return _0x5c7d72['status'](_0x3b1caa)[_0x3a67('0x12')](_0x54ea28);}};}function respondWithFilteredResult(_0x56b816,_0x510f9a){return function(_0x32a77e){if(_0x32a77e){var _0x482768=typeof _0x510f9a[_0x3a67('0x13')]===_0x3a67('0x14')&&typeof _0x510f9a[_0x3a67('0x15')]==='undefined';var _0x3389e2=_0x32a77e[_0x3a67('0x16')];var _0x3d9244=_0x482768?0x0:_0x510f9a[_0x3a67('0x13')];var _0x58c7e5=_0x482768?_0x32a77e['count']:_0x510f9a[_0x3a67('0x13')]+_0x510f9a[_0x3a67('0x15')];var _0x29b88d;if(_0x58c7e5>=_0x3389e2){_0x58c7e5=_0x3389e2;_0x29b88d=0xc8;}else{_0x29b88d=0xce;}_0x56b816[_0x3a67('0x11')](_0x29b88d);return _0x56b816[_0x3a67('0x17')](_0x3a67('0x18'),_0x3d9244+'-'+_0x58c7e5+'/'+_0x3389e2)[_0x3a67('0x12')](_0x32a77e);}return null;};}function saveUpdates(_0x11ff72){return function(_0x1b7403){if(_0x1b7403){return _0x1b7403[_0x3a67('0x19')](_0x11ff72)[_0x3a67('0x1a')](function(_0x3ef811){return _0x3ef811;});}return null;};}function removeEntity(_0x3b4641){return function(_0x2b9813){if(_0x2b9813){return _0x2b9813[_0x3a67('0x1b')]()[_0x3a67('0x1a')](function(){_0x3b4641[_0x3a67('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7663cd){return function(_0x347f37){if(!_0x347f37){_0x7663cd[_0x3a67('0x10')](0x194);}return _0x347f37;};}function handleError(_0x1670d4,_0x98167f){_0x98167f=_0x98167f||0x1f4;return function(_0x5a48c9){logger[_0x3a67('0x1c')](_0x5a48c9['stack']);if(_0x5a48c9[_0x3a67('0x1d')]){delete _0x5a48c9[_0x3a67('0x1d')];}_0x1670d4[_0x3a67('0x11')](_0x98167f)[_0x3a67('0x1e')](_0x5a48c9);};}exports[_0x3a67('0x1f')]=function(_0x225481,_0x106f6d){var _0x4d9e7c={};var _0x306b0b=_[_0x3a67('0x20')](db['WhatsappInteraction']['rawAttributes'],function(_0x52b400){return{'name':_0x52b400[_0x3a67('0x21')],'type':_0x52b400[_0x3a67('0x22')][_0x3a67('0x23')]};});_0x4d9e7c=qs[_0x3a67('0x24')](_0x306b0b,_0x225481);return interaction[_0x3a67('0x25')]('whatsapp',_0x225481['query'],_0x225481[_0x3a67('0x26')],_0x4d9e7c,_0x306b0b)['then'](respondWithFilteredResult(_0x106f6d,_0x4d9e7c))['catch'](handleError(_0x106f6d,null));};exports[_0x3a67('0x27')]=function(_0x57c96c,_0x52a16f){var _0x2b72ad={'raw':![],'where':{'id':_0x57c96c[_0x3a67('0x28')]['id']}},_0x5074da={};_0x5074da['model']=_[_0x3a67('0x29')](db[_0x3a67('0x2a')][_0x3a67('0x2b')]);_0x5074da[_0x3a67('0x2c')]=_[_0x3a67('0x29')](_0x57c96c['query']);_0x5074da[_0x3a67('0x2d')]=_[_0x3a67('0x2e')](_0x5074da['model'],_0x5074da['query']);_0x2b72ad[_0x3a67('0x2f')]=_[_0x3a67('0x2e')](_0x5074da['model'],qs[_0x3a67('0x30')](_0x57c96c[_0x3a67('0x2c')]['fields']));_0x2b72ad[_0x3a67('0x2f')]=_0x2b72ad[_0x3a67('0x2f')]['length']?_0x2b72ad[_0x3a67('0x2f')]:_0x5074da[_0x3a67('0x31')];if(_0x57c96c[_0x3a67('0x2c')]['includeAll']){_0x2b72ad[_0x3a67('0x32')]=[{'all':!![]}];}_0x2b72ad=_[_0x3a67('0x33')]({},_0x2b72ad,_0x57c96c[_0x3a67('0x34')]);return db[_0x3a67('0x2a')][_0x3a67('0x35')](_0x2b72ad)[_0x3a67('0x1a')](handleEntityNotFound(_0x52a16f,null))['then'](respondWithResult(_0x52a16f,null))[_0x3a67('0x36')](handleError(_0x52a16f,null));};exports[_0x3a67('0x37')]=function(_0x53f921,_0x5a9d8a){return db[_0x3a67('0x2a')][_0x3a67('0x37')](_0x53f921[_0x3a67('0x38')],{})[_0x3a67('0x1a')](respondWithResult(_0x5a9d8a,0xc9))[_0x3a67('0x36')](handleError(_0x5a9d8a,null));};exports[_0x3a67('0x19')]=function(_0x150250,_0x291a8f){if(_0x150250[_0x3a67('0x38')]['id']){delete _0x150250['body']['id'];}return db[_0x3a67('0x2a')][_0x3a67('0x35')]({'where':{'id':_0x150250['params']['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x291a8f,null))['then'](saveUpdates(_0x150250[_0x3a67('0x38')],null))[_0x3a67('0x1a')](respondWithResult(_0x291a8f,null))[_0x3a67('0x36')](handleError(_0x291a8f,null));};exports[_0x3a67('0x1b')]=function(_0x13d997,_0x1d7cb7){return db['WhatsappInteraction']['find']({'where':{'id':_0x13d997[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x1d7cb7,null))[_0x3a67('0x1a')](removeEntity(_0x1d7cb7,null))['catch'](handleError(_0x1d7cb7,null));};exports[_0x3a67('0x39')]=function(_0x2410c4,_0x589aa5){return db['WhatsappInteraction'][_0x3a67('0x39')]()[_0x3a67('0x1a')](respondWithResult(_0x589aa5,null))[_0x3a67('0x36')](handleError(_0x589aa5,null));};exports[_0x3a67('0x3a')]=function(_0x1e0eb8,_0x31a7fe){return db['WhatsappMessage'][_0x3a67('0x35')]({'where':{'id':_0x1e0eb8['params']['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x31a7fe,null))[_0x3a67('0x1a')](function(_0x3a63f4){if(_0x3a63f4){return _0x3a63f4[_0x3a67('0x3a')](_0x1e0eb8[_0x3a67('0x38')]['ids'],_[_0x3a67('0x3b')](_0x1e0eb8[_0x3a67('0x38')],[_0x3a67('0x3c'),'id'])||{});}})[_0x3a67('0x1a')](respondWithResult(_0x31a7fe,null))['catch'](handleError(_0x31a7fe,null));};exports[_0x3a67('0x3d')]=function(_0x55bd20,_0x22fe62){var _0xa7f41d={'raw':![],'where':{}};var _0x3a97b2={};var _0x24f703={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3a67('0x3e')]({'where':{'id':_0x55bd20[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x22fe62,null))['then'](function(_0x408c87){if(_0x408c87){_0x3a97b2[_0x3a67('0x31')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x3a97b2[_0x3a67('0x2c')]=_[_0x3a67('0x29')](_0x55bd20[_0x3a67('0x2c')]);_0x3a97b2[_0x3a67('0x2d')]=_[_0x3a67('0x2e')](_0x3a97b2[_0x3a67('0x31')],_0x3a97b2['query']);_0xa7f41d[_0x3a67('0x2f')]=_[_0x3a67('0x2e')](_0x3a97b2[_0x3a67('0x31')],qs[_0x3a67('0x30')](_0x55bd20[_0x3a67('0x2c')]['fields']));_0xa7f41d[_0x3a67('0x2f')]=_0xa7f41d[_0x3a67('0x2f')][_0x3a67('0x3f')]?_0xa7f41d[_0x3a67('0x2f')]:_0x3a97b2['model'];if(!_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x40')](_0x3a67('0x41'))){_0xa7f41d[_0x3a67('0x15')]=qs['limit'](_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x15')]);_0xa7f41d[_0x3a67('0x13')]=qs[_0x3a67('0x13')](_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x13')]);}_0xa7f41d[_0x3a67('0x42')]=qs[_0x3a67('0x43')](_0x55bd20['query'][_0x3a67('0x43')]);_0xa7f41d[_0x3a67('0x44')]=qs[_0x3a67('0x2d')](_[_0x3a67('0x45')](_0x55bd20[_0x3a67('0x2c')],_0x3a97b2[_0x3a67('0x2d')]));_0xa7f41d['where'][_0x3a67('0x46')]=_0x408c87['id'];if(_0x55bd20['query'][_0x3a67('0x47')]){_0xa7f41d[_0x3a67('0x44')]=_[_0x3a67('0x33')](_0xa7f41d[_0x3a67('0x44')],{'$or':_[_0x3a67('0x20')](_0xa7f41d[_0x3a67('0x2f')],function(_0x3e1f77){var _0x20e6e4={};_0x20e6e4[_0x3e1f77]={'$like':'%'+_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x47')]+'%'};return _0x20e6e4;})});}if(_0x55bd20[_0x3a67('0x2c')][_0x3a67('0x48')]){var _0xeabbff=_0x55bd20[_0x3a67('0x2c')]['$gte'][_0x3a67('0x49')](',');var _0x417f77={};_0x417f77[_0xeabbff[0x0]]={'$gte':moment(_0xeabbff[0x1])[_0x3a67('0x4a')](_0x3a67('0x4b'))};_0xa7f41d['where']=_[_0x3a67('0x33')](_0xa7f41d[_0x3a67('0x44')],_0x417f77);}_0xa7f41d=_[_0x3a67('0x33')]({},_0xa7f41d,_0x55bd20[_0x3a67('0x34')]);return db[_0x3a67('0x4c')]['count']({'where':_0xa7f41d['where']})[_0x3a67('0x1a')](function(_0x443033){_0x24f703['count']=_0x443033;if(_0x55bd20[_0x3a67('0x2c')]['includeAll']){_0xa7f41d[_0x3a67('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3a67('0x25')](_0xa7f41d);})[_0x3a67('0x1a')](function(_0x3d3e4a){_0x24f703['rows']=_0x3d3e4a;return _0x24f703;});}})['then'](respondWithFilteredResult(_0x22fe62,_0xa7f41d))[_0x3a67('0x36')](handleError(_0x22fe62,null));};exports[_0x3a67('0x4d')]=function(_0xd69879,_0x451b43){return db[_0x3a67('0x2a')][_0x3a67('0x35')]({'where':{'id':_0xd69879[_0x3a67('0x28')]['id']}})[_0x3a67('0x1a')](handleEntityNotFound(_0x451b43,null))[_0x3a67('0x1a')](function(_0x51915f){if(_0x51915f){return _0x51915f[_0x3a67('0x4e')](_0xd69879[_0x3a67('0x38')][_0x3a67('0x3c')],_[_0x3a67('0x3b')](_0xd69879[_0x3a67('0x38')],[_0x3a67('0x3c'),'id'])||{})['spread'](function(){return db[_0x3a67('0x4f')][_0x3a67('0x25')]({'attributes':['id',_0x3a67('0x1d'),_0x3a67('0x50')],'where':{'id':_0xd69879['body'][_0x3a67('0x3c')]}});})[_0x3a67('0x1a')](function(_0x1b22a3){socket[_0x3a67('0x51')](_0x3a67('0x52'),{'id':Number(_0xd69879[_0x3a67('0x28')]['id']),'tags':_0x1b22a3||[]});return{'id':Number(_0xd69879[_0x3a67('0x28')]['id']),'tags':_0x1b22a3||[]};});}})['then'](respondWithResult(_0x451b43,null))[_0x3a67('0x36')](handleError(_0x451b43,null));};exports['removeTags']=function(_0x463ad2,_0x1a83ec){return db['WhatsappInteraction'][_0x3a67('0x35')]({'where':{'id':_0x463ad2['params']['id']}})['then'](handleEntityNotFound(_0x1a83ec,null))[_0x3a67('0x1a')](function(_0x323de1){if(_0x323de1){return _0x323de1[_0x3a67('0x53')](_0x463ad2[_0x3a67('0x2c')][_0x3a67('0x3c')]);}})[_0x3a67('0x1a')](respondWithStatusCode(_0x1a83ec,null))[_0x3a67('0x36')](handleError(_0x1a83ec,null));};exports['download']=function(_0x40d725,_0x3e99b3){var _0x467aff=moment()[_0x3a67('0x54')]()[_0x3a67('0x55')]();var _0x30b560=path['join'](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x58'),_0x3a67('0x59'));var _0x52a0cc=path[_0x3a67('0x5a')](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x58'),_0x3a67('0x5b'));var _0x3f393a=path[_0x3a67('0x5a')](_0x30b560,_0x467aff);var _0x36c527=util['format'](_0x3a67('0x5c'),_0x40d725[_0x3a67('0x28')]['id'],_0x467aff);var _0x34c1e8=path['join'](_0x30b560,_0x36c527);var _0x528eca=[];_0x528eca['push']({'model':db[_0x3a67('0x5d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x528eca[_0x3a67('0x5e')]({'model':db[_0x3a67('0x5f')],'as':'Contact','attributes':['id',_0x3a67('0x60'),_0x3a67('0x61')],'raw':!![]});if(_0x40d725['query'][_0x3a67('0x5b')]){_0x528eca['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x293ab1=[{'model':db[_0x3a67('0x4c')],'as':'Messages','attributes':['id',_0x3a67('0x38'),'createdAt','direction',_0x3a67('0x62'),_0x3a67('0x63')],'include':_0x528eca}];_0x293ab1[_0x3a67('0x5e')]({'model':db[_0x3a67('0x64')],'as':_0x3a67('0x65'),'attributes':['id',_0x3a67('0x1d')]});_0x293ab1[_0x3a67('0x5e')]({'model':db[_0x3a67('0x5d')],'as':'Owner','attributes':['id',_0x3a67('0x66')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x40d725[_0x3a67('0x28')]['id']},'include':_0x293ab1})['then'](handleEntityNotFound(_0x3e99b3,null))[_0x3a67('0x1a')](function(_0x5e4ab5){if(_0x5e4ab5){var _0x583dc2=_0x5e4ab5[_0x3a67('0x67')]({'plain':!![]});fs[_0x3a67('0x68')](_0x3f393a);var _0x252e15={'channel':'Whatsapp','account':_0x583dc2[_0x3a67('0x65')][_0x3a67('0x1d')],'agent':_0x583dc2[_0x3a67('0x69')]?_0x583dc2[_0x3a67('0x69')][_0x3a67('0x66')]:'N.A.','createdAt':moment(_0x583dc2[_0x3a67('0x6a')])[_0x3a67('0x4a')](_0x3a67('0x4b'))[_0x3a67('0x55')](),'closedAt':_0x583dc2['closed']?moment(_0x583dc2[_0x3a67('0x6b')])[_0x3a67('0x4a')](_0x3a67('0x4b'))['toString']():'','disposition':_0x583dc2[_0x3a67('0x6c')],'messages':_(_0x583dc2[_0x3a67('0x6d')])[_0x3a67('0x47')]({'secret':![]})[_0x3a67('0x20')](function(_0x1c0496){if(_0x1c0496[_0x3a67('0x6e')]){var _0x3dabcb=path[_0x3a67('0x5a')](_0x52a0cc,_0x1c0496['Attachment'][_0x3a67('0x6f')]);if(fs[_0x3a67('0x70')](_0x3dabcb)){fs['createReadStream'](_0x3dabcb)[_0x3a67('0x71')](fs[_0x3a67('0x72')](path['join'](_0x3f393a,_0x1c0496[_0x3a67('0x6e')]['basename'])));}}return{'date':moment(_0x1c0496['createdAt'])[_0x3a67('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1c0496[_0x3a67('0x73')]==='out'?_0x1c0496[_0x3a67('0x5d')]?_0x1c0496['User']['fullname']:_0x3a67('0x74'):_0x1c0496[_0x3a67('0x75')][_0x3a67('0x60')]+(_0x1c0496[_0x3a67('0x75')]['lastName']?'\x20'+_0x1c0496[_0x3a67('0x75')][_0x3a67('0x61')]:''),'body':_0x1c0496['Attachment']?_0x1c0496[_0x3a67('0x6e')]['basename']:_0x1c0496[_0x3a67('0x38')],'direction':_0x1c0496[_0x3a67('0x73')]==='out'?'A':'C','secret':_0x1c0496['secret'],'read':_0x1c0496[_0x3a67('0x63')],'attachment':_0x1c0496[_0x3a67('0x6e')]};})[_0x3a67('0x76')]()};return ejs[_0x3a67('0x77')](path[_0x3a67('0x5a')](config[_0x3a67('0x56')],_0x3a67('0x57'),_0x3a67('0x78'),_0x3a67('0x79')),{'interaction':_0x252e15})[_0x3a67('0x1a')](function(_0x4878ba){var _0xf2b72e=path[_0x3a67('0x5a')](_0x3f393a,_0x3a67('0x7a')+_0x583dc2['id']+'-'+_0x467aff+_0x3a67('0x7b'));var _0x1c598e={'path':_0xf2b72e,'channel':'Whatsapp','interactionId':_0x583dc2['id']};return pdf[_0x3a67('0x7c')](_0x4878ba,_0x1c598e);})[_0x3a67('0x1a')](function(){return new BPromise(function(_0x3f3637,_0x11932a){zipdir(_0x3f393a,{'saveTo':_0x34c1e8},function(_0x2907c9,_0x2f08ce){if(_0x2907c9)return _0x11932a(_0x2907c9);return _0x3f3637(_0x2f08ce);});})[_0x3a67('0x1a')](function(){return new BPromise(function(_0x3c3277,_0x35df39){rimraf(_0x3f393a,function(_0x11c880){if(_0x11c880)_0x35df39(_0x11c880);return _0x3c3277();});});})[_0x3a67('0x1a')](function(){return _0x3e99b3[_0x3a67('0x7d')](_0x34c1e8,_0x36c527,function(_0xefc882){if(_0xefc882){console[_0x3a67('0x7e')](_0x3a67('0x7f'),_0xefc882);}else{fs['unlinkSync'](_0x34c1e8);}});});});}else{return _0x3e99b3['sendStatus'](0xc8);}})['catch'](handleError(_0x3e99b3,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e5c6604..f503db4 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 _0x9354=['save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x33011d,_0x2d484f){var _0x3113a4=function(_0x2bd3ca){while(--_0x2bd3ca){_0x33011d['push'](_0x33011d['shift']());}};_0x3113a4(++_0x2d484f);}(_0x9354,0x96));var _0x4935=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0x9354[_0x48168a];return _0x346d98;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x4935('0x0'))['db'][_0x4935('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x4935('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4935('0x3')](0x0);var events={'afterCreate':_0x4935('0x4'),'afterUpdate':_0x4935('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46c7f9){return function(_0x2d509b,_0x127226,_0x2d518a){_0x2d509b[_0x4935('0x6')]({'attributes':['id'],'raw':!![]})[_0x4935('0x7')](function(_0x118d36){_0x2d509b[_0x4935('0x8')](_0x4935('0x9'),_0x118d36['map'](function(_0x30c8b9){return{'id':_0x30c8b9['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2d509b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4935('0x7')](function(_0x38de96){_0x2d509b[_0x4935('0x8')](_0x4935('0xa'),_0x38de96[_0x4935('0xb')]);WhatsappInteractionEvents[_0x4935('0xc')](_0x46c7f9+':'+_0x2d509b['id'],_0x2d509b);WhatsappInteractionEvents['emit'](_0x46c7f9,_0x2d509b);_0x2d518a(null);})['catch'](_0x2d518a(null));};}for(var e in events){if(events[_0x4935('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x76a3=['getUsers','then','Users','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x56b913,_0x3ddf4e){var _0x4d2bcf=function(_0x5994db){while(--_0x5994db){_0x56b913['push'](_0x56b913['shift']());}};_0x4d2bcf(++_0x3ddf4e);}(_0x76a3,0xf8));var _0x376a=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x76a3[_0x254b22];return _0x1279db;};'use strict';var EventEmitter=require(_0x376a('0x0'));var WhatsappInteraction=require(_0x376a('0x1'))['db'][_0x376a('0x2')];var WhatsappMessage=require(_0x376a('0x1'))['db'][_0x376a('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x376a('0x4')](0x0);var events={'afterCreate':_0x376a('0x5'),'afterUpdate':_0x376a('0x6'),'afterDestroy':_0x376a('0x7')};function emitEvent(_0x17f183){return function(_0x5b2249,_0x50b7b3,_0x19ea68){_0x5b2249[_0x376a('0x8')]({'attributes':['id'],'raw':!![]})[_0x376a('0x9')](function(_0x3cb57e){_0x5b2249['setDataValue'](_0x376a('0xa'),_0x3cb57e[_0x376a('0xb')](function(_0x249623){return{'id':_0x249623['id']};}));return WhatsappMessage[_0x376a('0xc')]({'where':{'WhatsappInteractionId':_0x5b2249['id'],'direction':'in','read':![]},'raw':!![]});})[_0x376a('0x9')](function(_0x15286f){_0x5b2249['setDataValue']('unreadMessages',_0x15286f['length']);WhatsappInteractionEvents[_0x376a('0xd')](_0x17f183+':'+_0x5b2249['id'],_0x5b2249);WhatsappInteractionEvents[_0x376a('0xd')](_0x17f183,_0x5b2249);_0x19ea68(null);})['catch'](_0x19ea68(null));};}for(var e in events){if(events[_0x376a('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x376a('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b6a666a..252554e 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 _0x4e8f=['../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11fdb4,_0x126ff0){var _0x7a2344=function(_0x415772){while(--_0x415772){_0x11fdb4['push'](_0x11fdb4['shift']());}};_0x7a2344(++_0x126ff0);}(_0x4e8f,0xa1));var _0xf4e8=function(_0x941b53,_0x2190c9){_0x941b53=_0x941b53-0x0;var _0xce1d5c=_0x4e8f[_0x941b53];return _0xce1d5c;};'use strict';var _=require(_0xf4e8('0x0'));var util=require(_0xf4e8('0x1'));var logger=require(_0xf4e8('0x2'))(_0xf4e8('0x3'));var moment=require(_0xf4e8('0x4'));var BPromise=require(_0xf4e8('0x5'));var rp=require(_0xf4e8('0x6'));var fs=require('fs');var path=require(_0xf4e8('0x7'));var rimraf=require(_0xf4e8('0x8'));var config=require(_0xf4e8('0x9'));var attributes=require('./whatsappInteraction.attributes');module[_0xf4e8('0xa')]=function(_0x108db7,_0x9514e1){return _0x108db7['define'](_0xf4e8('0xb'),attributes,{'tableName':_0xf4e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39c085,_0x5c83bb,_0x26dede){if(_0x39c085['changed'](_0xf4e8('0xd'))){_0x39c085[_0xf4e8('0xe')]=moment()[_0xf4e8('0xf')](_0xf4e8('0x10'));}_0x26dede(null,_0x39c085);}}});}; \ No newline at end of file +var _0x3eae=['bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api'];(function(_0x11029d,_0x342076){var _0x19d5e8=function(_0x38ba86){while(--_0x38ba86){_0x11029d['push'](_0x11029d['shift']());}};_0x19d5e8(++_0x342076);}(_0x3eae,0x66));var _0xe3ea=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x3eae[_0x24f326];return _0x488e2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3ea('0x0'))(_0xe3ea('0x1'));var moment=require('moment');var BPromise=require(_0xe3ea('0x2'));var rp=require(_0xe3ea('0x3'));var fs=require('fs');var path=require(_0xe3ea('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3ea('0x5'));module[_0xe3ea('0x6')]=function(_0x5a6fba,_0x271dff){return _0x5a6fba[_0xe3ea('0x7')]('WhatsappInteraction',attributes,{'tableName':_0xe3ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47f24d,_0x42e89f,_0x3bed63){if(_0x47f24d[_0xe3ea('0x9')]('closed')){_0x47f24d[_0xe3ea('0xa')]=moment()[_0xe3ea('0xb')](_0xe3ea('0xc'));}_0x3bed63(null,_0x47f24d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index eeecb89..9462f82 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 _0x709d=['AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','UpdateWhatsappInteraction','body','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','ids','omit'];(function(_0x1f11bf,_0x278c69){var _0x1ef7d4=function(_0x2962c5){while(--_0x2962c5){_0x1f11bf['push'](_0x1f11bf['shift']());}};_0x1ef7d4(++_0x278c69);}(_0x709d,0x6d));var _0xd709=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x709d[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xd709('0x0'));var util=require('util');var moment=require(_0xd709('0x1'));var BPromise=require(_0xd709('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd709('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd709('0x4'));var logger=require(_0xd709('0x5'))(_0xd709('0x6'));var config=require(_0xd709('0x7'));var jayson=require(_0xd709('0x8'));var client=jayson[_0xd709('0x9')][_0xd709('0xa')]({'port':0x232a});config[_0xd709('0xb')]=_['defaults'](config[_0xd709('0xb')],{'host':_0xd709('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd709('0xb')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x464309,_0x4d3954,_0x2b3e94){return new BPromise(function(_0x3ce5f7,_0x24fe16){return client[_0xd709('0xd')](_0x464309,_0x2b3e94)[_0xd709('0xe')](function(_0x3bb5c7){logger['info'](_0xd709('0xf'),_0x4d3954,_0xd709('0x10'));logger[_0xd709('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4d3954,_0xd709('0x10'),JSON['stringify'](_0x3bb5c7));if(_0x3bb5c7['error']){if(_0x3bb5c7[_0xd709('0x12')]['code']===0x1f4){logger['error'](_0xd709('0xf'),_0x4d3954,_0x3bb5c7[_0xd709('0x12')][_0xd709('0x13')]);return _0x24fe16(_0x3bb5c7['error'][_0xd709('0x13')]);}logger[_0xd709('0x12')](_0xd709('0xf'),_0x4d3954,_0x3bb5c7[_0xd709('0x12')][_0xd709('0x13')]);return _0x3ce5f7(_0x3bb5c7[_0xd709('0x12')][_0xd709('0x13')]);}else{logger[_0xd709('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d3954,_0xd709('0x10'));_0x3ce5f7(_0x3bb5c7[_0xd709('0x15')][_0xd709('0x13')]);}})[_0xd709('0x16')](function(_0x21b38a){logger['error'](_0xd709('0xf'),_0x4d3954,_0x21b38a);_0x24fe16(_0x21b38a);});});}exports[_0xd709('0x17')]=function(_0x56f4ef){var _0x18486d=this;return new Promise(function(_0x59bf85,_0x24afee){return db['WhatsappInteraction']['update'](_0x56f4ef[_0xd709('0x18')],{'raw':_0x56f4ef[_0xd709('0x19')]?_0x56f4ef[_0xd709('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f4ef[_0xd709('0x19')]?_0x56f4ef[_0xd709('0x19')][_0xd709('0x1a')]||null:null,'attributes':_0x56f4ef[_0xd709('0x19')]?_0x56f4ef[_0xd709('0x19')][_0xd709('0x1b')]||null:null,'limit':_0x56f4ef['options']?_0x56f4ef[_0xd709('0x19')][_0xd709('0x1c')]||null:null})[_0xd709('0xe')](function(_0x255f39){logger[_0xd709('0x14')](_0xd709('0x17'),_0x56f4ef);logger[_0xd709('0x11')](_0xd709('0x17'),_0x56f4ef,JSON[_0xd709('0x1d')](_0x255f39));_0x59bf85(_0x255f39);})[_0xd709('0x16')](function(_0x284c67){logger[_0xd709('0x12')](_0xd709('0x17'),_0x284c67[_0xd709('0x13')],_0x56f4ef);_0x24afee(_0x18486d['error'](0x1f4,_0x284c67[_0xd709('0x13')]));});});};exports[_0xd709('0x1e')]=function(_0x75cfe4){return new Promise(function(_0x477340,_0x529f7b){return db[_0xd709('0x1f')]['find']({'where':_0x75cfe4[_0xd709('0x19')]?_0x75cfe4['options'][_0xd709('0x1a')]||null:null})['then'](function(_0x4234ad){if(_0x4234ad){return _0x4234ad[_0xd709('0x20')](_0x75cfe4[_0xd709('0x18')][_0xd709('0x21')],_[_0xd709('0x22')](_0x75cfe4[_0xd709('0x18')],[_0xd709('0x21'),'id'])||{});}})['spread'](function(_0x56de1f){logger[_0xd709('0x14')]('AddTags',_0x75cfe4);logger[_0xd709('0x11')](_0xd709('0x23'),_0x75cfe4,JSON[_0xd709('0x1d')](_0x56de1f));_0x477340(_0x56de1f);})['catch'](function(_0x4670b5){logger[_0xd709('0x12')](_0xd709('0x23'),_0x4670b5[_0xd709('0x13')],_0x75cfe4);_0x529f7b(_this[_0xd709('0x12')](0x1f4,_0x4670b5[_0xd709('0x13')]));});});}; \ No newline at end of file +var _0xd667=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3414c2,_0x1d81f9){var _0x4db52e=function(_0x26c9c7){while(--_0x26c9c7){_0x3414c2['push'](_0x3414c2['shift']());}};_0x4db52e(++_0x1d81f9);}(_0xd667,0x187));var _0x7d66=function(_0x428496,_0x12e5a6){_0x428496=_0x428496-0x0;var _0x396ff1=_0xd667[_0x428496];return _0x396ff1;};'use strict';var _=require(_0x7d66('0x0'));var util=require(_0x7d66('0x1'));var moment=require(_0x7d66('0x2'));var BPromise=require(_0x7d66('0x3'));var rs=require(_0x7d66('0x4'));var fs=require('fs');var Redis=require(_0x7d66('0x5'));var db=require(_0x7d66('0x6'))['db'];var utils=require(_0x7d66('0x7'));var logger=require(_0x7d66('0x8'))(_0x7d66('0x9'));var config=require(_0x7d66('0xa'));var jayson=require(_0x7d66('0xb'));var client=jayson[_0x7d66('0xc')][_0x7d66('0xd')]({'port':0x232a});config[_0x7d66('0xe')]=_[_0x7d66('0xf')](config[_0x7d66('0xe')],{'host':_0x7d66('0x10'),'port':0x18eb});var socket=require(_0x7d66('0x11'))(new Redis(config[_0x7d66('0xe')]));require('./whatsappInteraction.socket')[_0x7d66('0x12')](socket);function respondWithRpcPromise(_0x30db65,_0x144cf4,_0x22ee96){return new BPromise(function(_0x2d4992,_0x25781b){return client[_0x7d66('0x13')](_0x30db65,_0x22ee96)[_0x7d66('0x14')](function(_0x4a9b39){logger[_0x7d66('0x15')](_0x7d66('0x16'),_0x144cf4,_0x7d66('0x17'));logger[_0x7d66('0x18')](_0x7d66('0x19'),_0x144cf4,_0x7d66('0x17'),JSON['stringify'](_0x4a9b39));if(_0x4a9b39[_0x7d66('0x1a')]){if(_0x4a9b39[_0x7d66('0x1a')][_0x7d66('0x1b')]===0x1f4){logger['error'](_0x7d66('0x16'),_0x144cf4,_0x4a9b39['error']['message']);return _0x25781b(_0x4a9b39[_0x7d66('0x1a')][_0x7d66('0x1c')]);}logger[_0x7d66('0x1a')](_0x7d66('0x16'),_0x144cf4,_0x4a9b39['error'][_0x7d66('0x1c')]);return _0x2d4992(_0x4a9b39['error']['message']);}else{logger[_0x7d66('0x15')](_0x7d66('0x16'),_0x144cf4,_0x7d66('0x17'));_0x2d4992(_0x4a9b39[_0x7d66('0x1d')][_0x7d66('0x1c')]);}})[_0x7d66('0x1e')](function(_0x19a707){logger['error'](_0x7d66('0x16'),_0x144cf4,_0x19a707);_0x25781b(_0x19a707);});});}exports[_0x7d66('0x1f')]=function(_0x4f7bc7){var _0x5920fb=this;return new Promise(function(_0x9fff4,_0xbc12b){return db['WhatsappInteraction'][_0x7d66('0x20')](_0x4f7bc7[_0x7d66('0x21')],{'raw':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7[_0x7d66('0x22')][_0x7d66('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7[_0x7d66('0x22')][_0x7d66('0x24')]||null:null,'attributes':_0x4f7bc7['options']?_0x4f7bc7['options'][_0x7d66('0x25')]||null:null,'limit':_0x4f7bc7[_0x7d66('0x22')]?_0x4f7bc7['options'][_0x7d66('0x26')]||null:null})[_0x7d66('0x14')](function(_0x20106a){logger[_0x7d66('0x15')](_0x7d66('0x1f'),_0x4f7bc7);logger[_0x7d66('0x18')]('UpdateWhatsappInteraction',_0x4f7bc7,JSON['stringify'](_0x20106a));_0x9fff4(_0x20106a);})[_0x7d66('0x1e')](function(_0x13417c){logger[_0x7d66('0x1a')](_0x7d66('0x1f'),_0x13417c['message'],_0x4f7bc7);_0xbc12b(_0x5920fb[_0x7d66('0x1a')](0x1f4,_0x13417c['message']));});});};exports[_0x7d66('0x27')]=function(_0x48fc9c){return new Promise(function(_0x9f212,_0x49ebb0){return db[_0x7d66('0x28')]['find']({'where':_0x48fc9c['options']?_0x48fc9c[_0x7d66('0x22')][_0x7d66('0x24')]||null:null})['then'](function(_0x3209ab){if(_0x3209ab){return _0x3209ab['addTags'](_0x48fc9c[_0x7d66('0x21')][_0x7d66('0x29')],_[_0x7d66('0x2a')](_0x48fc9c['body'],['ids','id'])||{});}})[_0x7d66('0x2b')](function(_0x2d5f9f){logger[_0x7d66('0x15')](_0x7d66('0x2c'),_0x48fc9c);logger['debug'](_0x7d66('0x2c'),_0x48fc9c,JSON['stringify'](_0x2d5f9f));_0x9f212(_0x2d5f9f);})[_0x7d66('0x1e')](function(_0x1ce09f){logger[_0x7d66('0x1a')](_0x7d66('0x2c'),_0x1ce09f[_0x7d66('0x1c')],_0x48fc9c);_0x49ebb0(_this['error'](0x1f4,_0x1ce09f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8bbc2c5..5ea8a98 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 _0x423a=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x423035,_0x51ddeb){var _0x3645fc=function(_0x2205f8){while(--_0x2205f8){_0x423035['push'](_0x423035['shift']());}};_0x3645fc(++_0x51ddeb);}(_0x423a,0x154));var _0xa423=function(_0x47887f,_0x24e02d){_0x47887f=_0x47887f-0x0;var _0x42ac51=_0x423a[_0x47887f];return _0x42ac51;};'use strict';var WhatsappInteractionEvents=require(_0xa423('0x0'));var events=[_0xa423('0x1'),_0xa423('0x2'),_0xa423('0x3')];function createListener(_0x55b1c5,_0x5a669e){return function(_0x2b6dbf){_0x5a669e[_0xa423('0x4')](_0x55b1c5,_0x2b6dbf);};}function removeListener(_0x49fed3,_0x32ceb3){return function(){WhatsappInteractionEvents[_0xa423('0x5')](_0x49fed3,_0x32ceb3);};}exports[_0xa423('0x6')]=function(_0x109973){for(var _0xc5eec3=0x0,_0x3495fc=events['length'];_0xc5eec3<_0x3495fc;_0xc5eec3++){var _0x50411f=events[_0xc5eec3];var _0x4abdea=createListener(_0xa423('0x7')+_0x50411f,_0x109973);WhatsappInteractionEvents['on'](_0x50411f,_0x4abdea);}}; \ No newline at end of file +var _0xd384=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x5aa860,_0x132e3b){var _0x30de9e=function(_0x2979f0){while(--_0x2979f0){_0x5aa860['push'](_0x5aa860['shift']());}};_0x30de9e(++_0x132e3b);}(_0xd384,0x95));var _0x4d38=function(_0x2f9949,_0x408bfb){_0x2f9949=_0x2f9949-0x0;var _0x37e6d0=_0xd384[_0x2f9949];return _0x37e6d0;};'use strict';var WhatsappInteractionEvents=require(_0x4d38('0x0'));var events=[_0x4d38('0x1'),_0x4d38('0x2'),'update'];function createListener(_0x27d489,_0x32c03c){return function(_0x484c73){_0x32c03c[_0x4d38('0x3')](_0x27d489,_0x484c73);};}function removeListener(_0x100491,_0x3fab89){return function(){WhatsappInteractionEvents[_0x4d38('0x4')](_0x100491,_0x3fab89);};}exports['register']=function(_0x46de99){for(var _0x14ae7b=0x0,_0x28dce7=events[_0x4d38('0x5')];_0x14ae7b<_0x28dce7;_0x14ae7b++){var _0x363e70=events[_0x14ae7b];var _0xebf7e9=createListener(_0x4d38('0x6')+_0x363e70,_0x46de99);WhatsappInteractionEvents['on'](_0x363e70,_0xebf7e9);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index db2b8ad..eaf62ae 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 _0xb645=['get','index','/describe','/:id','show','post','isAuthenticated','tracked','whatsapp','whatsappmessage:create','create','status','update','put','/:id/accept','/:id/reject','reject','destroy','multer','path','connect-timeout','express','Router','fs-extra','./whatsappMessage.controller'];(function(_0x17edc1,_0xc6dacb){var _0x5f003a=function(_0x1e2c3e){while(--_0x1e2c3e){_0x17edc1['push'](_0x17edc1['shift']());}};_0x5f003a(++_0xc6dacb);}(_0xb645,0x13e));var _0x5b64=function(_0x807f18,_0x26bfe4){_0x807f18=_0x807f18-0x0;var _0x5077a7=_0xb645[_0x807f18];return _0x5077a7;};'use strict';var multer=require(_0x5b64('0x0'));var util=require('util');var path=require(_0x5b64('0x1'));var timeout=require(_0x5b64('0x2'));var express=require(_0x5b64('0x3'));var router=express[_0x5b64('0x4')]();var fs_extra=require(_0x5b64('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b64('0x6'));router[_0x5b64('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b64('0x8')]);router['get'](_0x5b64('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5b64('0x7')](_0x5b64('0xa'),auth['isAuthenticated'](),controller[_0x5b64('0xb')]);router[_0x5b64('0xc')]('/',auth[_0x5b64('0xd')](),interaction[_0x5b64('0xe')](_0x5b64('0xf'),_0x5b64('0x10')),controller[_0x5b64('0x11')]);router[_0x5b64('0xc')]('/:id/status',controller[_0x5b64('0x12')]);router['put'](_0x5b64('0xa'),auth[_0x5b64('0xd')](),controller[_0x5b64('0x13')]);router[_0x5b64('0x14')](_0x5b64('0x15'),auth[_0x5b64('0xd')](),controller['accept']);router['put'](_0x5b64('0x16'),auth['isAuthenticated'](),controller[_0x5b64('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5b64('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0738=['reject','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','accept','/:id/reject'];(function(_0x1e0bb9,_0x24088b){var _0x24901d=function(_0x2c280c){while(--_0x2c280c){_0x1e0bb9['push'](_0x1e0bb9['shift']());}};_0x24901d(++_0x24088b);}(_0x0738,0x108));var _0x8073=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0x0738[_0x842858];return _0x46c2a2;};'use strict';var multer=require('multer');var util=require(_0x8073('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8073('0x1'));var router=express[_0x8073('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8073('0x3'));var interaction=require(_0x8073('0x4'));var config=require(_0x8073('0x5'));var controller=require(_0x8073('0x6'));router['get']('/',auth[_0x8073('0x7')](),controller['index']);router[_0x8073('0x8')](_0x8073('0x9'),auth[_0x8073('0x7')](),controller[_0x8073('0xa')]);router[_0x8073('0x8')](_0x8073('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8073('0xc')]('/',auth[_0x8073('0x7')](),interaction[_0x8073('0xd')](_0x8073('0xe'),_0x8073('0xf')),controller[_0x8073('0x10')]);router[_0x8073('0xc')]('/:id/status',controller[_0x8073('0x11')]);router[_0x8073('0x12')](_0x8073('0xb'),auth[_0x8073('0x7')](),controller[_0x8073('0x13')]);router[_0x8073('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x8073('0x14')]);router[_0x8073('0x12')](_0x8073('0x15'),auth['isAuthenticated'](),controller[_0x8073('0x16')]);router[_0x8073('0x17')](_0x8073('0xb'),auth[_0x8073('0x7')](),controller[_0x8073('0x18')]);module[_0x8073('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 925da1f..f1f5b65 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 _0xf849=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x96094f,_0x5e1cf9){var _0x320fb2=function(_0x35416c){while(--_0x35416c){_0x96094f['push'](_0x96094f['shift']());}};_0x320fb2(++_0x5e1cf9);}(_0xf849,0x193));var _0x9f84=function(_0x4fe5b5,_0x41efab){_0x4fe5b5=_0x4fe5b5-0x0;var _0x221fbe=_0xf849[_0x4fe5b5];return _0x221fbe;};'use strict';var Sequelize=require(_0x9f84('0x0'));module[_0x9f84('0x1')]={'body':{'type':Sequelize[_0x9f84('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9f84('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9f84('0x4')]('in',_0x9f84('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9f84('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9f84('0x2')]}}; \ No newline at end of file +var _0x1625=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x50a99e,_0x3b8636){var _0x297630=function(_0x29496e){while(--_0x29496e){_0x50a99e['push'](_0x50a99e['shift']());}};_0x297630(++_0x3b8636);}(_0x1625,0xa7));var _0x5162=function(_0x332802,_0x11ce71){_0x332802=_0x332802-0x0;var _0x43f28a=_0x1625[_0x332802];return _0x43f28a;};'use strict';var Sequelize=require(_0x5162('0x0'));module['exports']={'body':{'type':Sequelize[_0x5162('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5162('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5162('0x3')]('in',_0x5162('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5162('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x5162('0x6')]},'secret':{'type':Sequelize[_0x5162('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5162('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index bf61f38..edbac1f 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 _0x09a5=['../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','undefined','limit','count','offset','end','sendStatus','stack','name','index','WhatsappMessage','rawAttributes','fieldName','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','update','body','destroy','describe','accept','whatsapp','reject','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','util','lodash','../../components/parsers/qs'];(function(_0x409dfa,_0x3a16a5){var _0x36ec21=function(_0x4d00d4){while(--_0x4d00d4){_0x409dfa['push'](_0x409dfa['shift']());}};_0x36ec21(++_0x3a16a5);}(_0x09a5,0x6d));var _0x509a=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x09a5[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0x509a('0x0'));var _=require(_0x509a('0x1'));var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require(_0x509a('0x2'));var logger=require(_0x509a('0x3'))(_0x509a('0x4'));var config=require(_0x509a('0x5'));var db=require(_0x509a('0x6'))['db'];config['redis']=_[_0x509a('0x7')](config[_0x509a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x509a('0x9'))(new Redis(config['redis']));require(_0x509a('0xa'))[_0x509a('0xb')](socket);var jayson=require(_0x509a('0xc'));var client=jayson[_0x509a('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x509a('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x509a('0x3'))('whatsapp-interactions');function respondWithRpcPromise(_0xef9353,_0x20fb5a,_0x3481b2,_0x2c20b9){return new Promise(function(_0x45c190,_0x37ba9c){var _0x13ecaf=_0x2c20b9||client;return _0x13ecaf['request'](_0xef9353,_0x3481b2)[_0x509a('0xe')](function(_0x4d9d8a){logger['info'](_0x509a('0xf'),_0x20fb5a,_0x509a('0x10'));logger[_0x509a('0x11')](_0x509a('0x12'),_0x20fb5a,_0x509a('0x10'),JSON[_0x509a('0x13')](_0x4d9d8a));if(_0x4d9d8a['error']){if(_0x4d9d8a[_0x509a('0x14')]['code']===0x1f4){logger['error'](_0x509a('0xf'),_0x20fb5a,_0x4d9d8a[_0x509a('0x14')][_0x509a('0x15')]);return _0x37ba9c(_0x4d9d8a[_0x509a('0x14')]['message']);}logger['error'](_0x509a('0xf'),_0x20fb5a,_0x4d9d8a[_0x509a('0x14')][_0x509a('0x15')]);return _0x45c190(_0x4d9d8a[_0x509a('0x14')][_0x509a('0x15')]);}else{logger[_0x509a('0x16')](_0x509a('0xf'),_0x20fb5a,_0x509a('0x10'));_0x45c190(_0x4d9d8a[_0x509a('0x17')][_0x509a('0x15')]);}})[_0x509a('0x18')](function(_0x24025a){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20fb5a,_0x24025a);_0x37ba9c(_0x24025a);});});}function respondWithResult(_0x2dc80a,_0x4ab5f2){_0x4ab5f2=_0x4ab5f2||0xc8;return function(_0x7f5ec3){if(_0x7f5ec3){return _0x2dc80a[_0x509a('0x19')](_0x4ab5f2)[_0x509a('0x1a')](_0x7f5ec3);}};}function respondWithFilteredResult(_0x6a211f,_0x51462e){return function(_0x43fe09){if(_0x43fe09){var _0x529e8d=typeof _0x51462e['offset']===_0x509a('0x1b')&&typeof _0x51462e[_0x509a('0x1c')]===_0x509a('0x1b');var _0x5b597f=_0x43fe09[_0x509a('0x1d')];var _0x5bb3ad=_0x529e8d?0x0:_0x51462e[_0x509a('0x1e')];var _0x3dbc57=_0x529e8d?_0x43fe09[_0x509a('0x1d')]:_0x51462e[_0x509a('0x1e')]+_0x51462e['limit'];var _0x2fdc44;if(_0x3dbc57>=_0x5b597f){_0x3dbc57=_0x5b597f;_0x2fdc44=0xc8;}else{_0x2fdc44=0xce;}_0x6a211f[_0x509a('0x19')](_0x2fdc44);return _0x6a211f['set']('Content-Range',_0x5bb3ad+'-'+_0x3dbc57+'/'+_0x5b597f)['json'](_0x43fe09);}return null;};}function saveUpdates(_0xe353a8){return function(_0x1ca9fc){if(_0x1ca9fc){return _0x1ca9fc['update'](_0xe353a8)['then'](function(_0x23d24d){return _0x23d24d;});}return null;};}function removeEntity(_0x3b0551){return function(_0x5d7a20){if(_0x5d7a20){return _0x5d7a20['destroy']()[_0x509a('0xe')](function(){_0x3b0551['status'](0xcc)[_0x509a('0x1f')]();});}};}function handleEntityNotFound(_0x27c5fc){return function(_0x1b307a){if(!_0x1b307a){_0x27c5fc[_0x509a('0x20')](0x194);}return _0x1b307a;};}function handleError(_0x50daff,_0x4793dd){_0x4793dd=_0x4793dd||0x1f4;return function(_0x1a46c3){logger[_0x509a('0x14')](_0x1a46c3[_0x509a('0x21')]);if(_0x1a46c3[_0x509a('0x22')]){delete _0x1a46c3[_0x509a('0x22')];}_0x50daff[_0x509a('0x19')](_0x4793dd)['send'](_0x1a46c3);};}exports[_0x509a('0x23')]=function(_0x4f8a31,_0x39e4b1){var _0x2b1770={},_0x2fb454={},_0x252110={'count':0x0,'rows':[]};var _0x5d8ccc=_['map'](db[_0x509a('0x24')][_0x509a('0x25')],function(_0x68f361){return{'name':_0x68f361[_0x509a('0x26')],'type':_0x68f361['type'][_0x509a('0x27')]};});_0x2fb454['model']=_[_0x509a('0x28')](_0x5d8ccc,_0x509a('0x22'));_0x2fb454['query']=_[_0x509a('0x29')](_0x4f8a31[_0x509a('0x2a')]);_0x2fb454[_0x509a('0x2b')]=_['intersection'](_0x2fb454[_0x509a('0x2c')],_0x2fb454[_0x509a('0x2a')]);_0x2b1770[_0x509a('0x2d')]=_[_0x509a('0x2e')](_0x2fb454[_0x509a('0x2c')],qs['fields'](_0x4f8a31[_0x509a('0x2a')][_0x509a('0x2f')]));_0x2b1770[_0x509a('0x2d')]=_0x2b1770['attributes'][_0x509a('0x30')]?_0x2b1770[_0x509a('0x2d')]:_0x2fb454['model'];if(!_0x4f8a31[_0x509a('0x2a')][_0x509a('0x31')](_0x509a('0x32'))){_0x2b1770[_0x509a('0x1c')]=qs[_0x509a('0x1c')](_0x4f8a31[_0x509a('0x2a')]['limit']);_0x2b1770[_0x509a('0x1e')]=qs[_0x509a('0x1e')](_0x4f8a31[_0x509a('0x2a')][_0x509a('0x1e')]);}_0x2b1770[_0x509a('0x33')]=qs[_0x509a('0x34')](_0x4f8a31[_0x509a('0x2a')][_0x509a('0x34')]);_0x2b1770[_0x509a('0x35')]=qs[_0x509a('0x2b')](_[_0x509a('0x36')](_0x4f8a31[_0x509a('0x2a')],_0x2fb454[_0x509a('0x2b')]),_0x5d8ccc);if(_0x4f8a31[_0x509a('0x2a')][_0x509a('0x37')]){_0x2b1770['where']=_['merge'](_0x2b1770[_0x509a('0x35')],{'$or':_[_0x509a('0x28')](_0x5d8ccc,function(_0x29aa5f){if(_0x29aa5f[_0x509a('0x38')]!==_0x509a('0x39')){var _0x1f3487={};_0x1f3487[_0x29aa5f['name']]={'$like':'%'+_0x4f8a31[_0x509a('0x2a')][_0x509a('0x37')]+'%'};return _0x1f3487;}})});}_0x2b1770=_[_0x509a('0x3a')]({},_0x2b1770,_0x4f8a31[_0x509a('0x3b')]);var _0x387191={'where':_0x2b1770['where']};return db[_0x509a('0x24')][_0x509a('0x1d')](_0x387191)['then'](function(_0x4b9faa){_0x252110[_0x509a('0x1d')]=_0x4b9faa;if(_0x4f8a31['query'][_0x509a('0x3c')]){_0x2b1770[_0x509a('0x3d')]=[{'all':!![]}];}return db[_0x509a('0x24')][_0x509a('0x3e')](_0x2b1770);})[_0x509a('0xe')](function(_0x1e979c){_0x252110[_0x509a('0x3f')]=_0x1e979c;return _0x252110;})[_0x509a('0xe')](respondWithFilteredResult(_0x39e4b1,_0x2b1770))[_0x509a('0x18')](handleError(_0x39e4b1,null));};exports[_0x509a('0x40')]=function(_0x33390c,_0x391ab5){var _0x1705f2={'raw':!![],'where':{'id':_0x33390c[_0x509a('0x41')]['id']}},_0x15a023={};_0x15a023[_0x509a('0x2c')]=_[_0x509a('0x29')](db[_0x509a('0x24')][_0x509a('0x25')]);_0x15a023[_0x509a('0x2a')]=_[_0x509a('0x29')](_0x33390c[_0x509a('0x2a')]);_0x15a023[_0x509a('0x2b')]=_[_0x509a('0x2e')](_0x15a023['model'],_0x15a023['query']);_0x1705f2[_0x509a('0x2d')]=_[_0x509a('0x2e')](_0x15a023[_0x509a('0x2c')],qs[_0x509a('0x2f')](_0x33390c['query'][_0x509a('0x2f')]));_0x1705f2[_0x509a('0x2d')]=_0x1705f2['attributes'][_0x509a('0x30')]?_0x1705f2[_0x509a('0x2d')]:_0x15a023[_0x509a('0x2c')];if(_0x33390c[_0x509a('0x2a')][_0x509a('0x3c')]){_0x1705f2['include']=[{'all':!![]}];}_0x1705f2=_[_0x509a('0x3a')]({},_0x1705f2,_0x33390c[_0x509a('0x3b')]);return db[_0x509a('0x24')][_0x509a('0x42')](_0x1705f2)[_0x509a('0xe')](handleEntityNotFound(_0x391ab5,null))[_0x509a('0xe')](respondWithResult(_0x391ab5,null))[_0x509a('0x18')](handleError(_0x391ab5,null));};exports[_0x509a('0x43')]=function(_0x46e093,_0x35d147){return db[_0x509a('0x24')][_0x509a('0x43')](_0x46e093['body'],{})['then'](respondWithResult(_0x35d147,0xc9))[_0x509a('0x18')](handleError(_0x35d147,null));};exports[_0x509a('0x44')]=function(_0x70ba6e,_0x122077){if(_0x70ba6e[_0x509a('0x45')]['id']){delete _0x70ba6e[_0x509a('0x45')]['id'];}return db[_0x509a('0x24')][_0x509a('0x42')]({'where':{'id':_0x70ba6e['params']['id']}})['then'](handleEntityNotFound(_0x122077,null))['then'](saveUpdates(_0x70ba6e[_0x509a('0x45')],null))[_0x509a('0xe')](respondWithResult(_0x122077,null))[_0x509a('0x18')](handleError(_0x122077,null));};exports[_0x509a('0x46')]=function(_0x228659,_0x2e784a){return db['WhatsappMessage']['find']({'where':{'id':_0x228659[_0x509a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e784a,null))[_0x509a('0xe')](removeEntity(_0x2e784a,null))[_0x509a('0x18')](handleError(_0x2e784a,null));};exports['describe']=function(_0x24f890,_0x3bacae){return db[_0x509a('0x24')][_0x509a('0x47')]()[_0x509a('0xe')](respondWithResult(_0x3bacae,null))[_0x509a('0x18')](handleError(_0x3bacae,null));};exports[_0x509a('0x48')]=function(_0x2f2f71,_0x34fbec){var _0x389cec=_0x509a('0x49');return interactionService['acceptMessage'](_0x2f2f71,_0x389cec)[_0x509a('0xe')](respondWithResult(_0x34fbec,null))[_0x509a('0x18')](handleError(_0x34fbec,null));};exports[_0x509a('0x4a')]=function(_0x1f01d3,_0x15016a){var _0x45e795={'agent':{},'channel':'whatsapp'};if(_0x1f01d3[_0x509a('0x45')]['id']){delete _0x1f01d3[_0x509a('0x45')]['id'];}_0x1f01d3[_0x509a('0x45')][_0x509a('0x4b')]=_0x1f01d3[_0x509a('0x45')][_0x509a('0x4b')]||_0x1f01d3[_0x509a('0x4c')]['id'];_0x45e795['agent']['id']=_0x1f01d3[_0x509a('0x45')][_0x509a('0x4b')];return db[_0x509a('0x24')][_0x509a('0x42')]({'where':{'id':_0x1f01d3['params']['id'],'UserId':null}})[_0x509a('0xe')](handleEntityNotFound(_0x15016a,null))[_0x509a('0xe')](function(_0x301e12){if(_0x301e12){_0x45e795[_0x509a('0x15')]=_0x301e12[_0x509a('0x4d')]({'plain':!![]});return db[_0x509a('0x4e')][_0x509a('0x42')]({'where':{'id':_0x301e12[_0x509a('0x4f')]}});}return null;})[_0x509a('0xe')](handleEntityNotFound(_0x15016a,null))[_0x509a('0xe')](function(_0x5063b1){if(_0x5063b1){_0x45e795[_0x509a('0x50')]=_0x5063b1['get']({'plain':!![]});interaction_log['info'](_0x509a('0x51'),_0x1f01d3[_0x509a('0x4c')]['id'],_0x1f01d3[_0x509a('0x4c')][_0x509a('0x22')],_0x1f01d3['user'][_0x509a('0x52')],_0x45e795['interaction']['id'],_0x1f01d3['body']?JSON[_0x509a('0x13')](_0x1f01d3[_0x509a('0x45')]):_0x509a('0x53'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x45e795);}return null;})[_0x509a('0xe')](function(_0x383f4e){var _0x55f23a=_0x509a('0x54')+_0x383f4e[_0x509a('0x15')]['ContactId'];return db['sequelize'][_0x509a('0x2a')](_0x55f23a,{'type':db[_0x509a('0x55')][_0x509a('0x56')][_0x509a('0x57')],'raw':!![]})['then'](function(_0x4c59b9){return _0x4c59b9;});})[_0x509a('0xe')](function(_0x326946){if(_0x326946){_0x45e795[_0x509a('0x15')][_0x509a('0x58')]=_0x326946[0x0];if(!_0x1f01d3[_0x509a('0x45')]['UserId'])return;return db[_0x509a('0x59')][_0x509a('0x42')]({'where':{'id':_0x1f01d3[_0x509a('0x45')][_0x509a('0x4b')],'role':_0x509a('0x5a')},'attributes':['id','name',_0x509a('0x5b'),_0x509a('0x5c'),_0x509a('0x5d')],'raw':!![]});}return null;})[_0x509a('0xe')](function(_0x42e468){if(!_0x42e468)return null;_0x45e795[_0x509a('0x15')]['agent']=_0x42e468;return _0x45e795;})[_0x509a('0xe')](function(_0x5d505e){if(_0x5d505e){_0x5d505e[_0x509a('0x15')][_0x509a('0x5e')]=util[_0x509a('0x5f')](_0x509a('0x60'),_0x1f01d3[_0x509a('0x4c')][_0x509a('0x22')]);_0x5d505e[_0x509a('0x15')][_0x509a('0x61')]=_0x45e795[_0x509a('0x61')];_0x5d505e['message'][_0x509a('0x62')]=_0x45e795['channel'];_0x5d505e[_0x509a('0x15')][_0x509a('0x63')]=_0x509a('0x4a');respondWithRpcPromise(_0x509a('0x64'),_0x509a('0x64'),{'event':_0x509a('0x65'),'message':_0x5d505e[_0x509a('0x15')]},client9002);return _0x45e795;}return null;})[_0x509a('0xe')](respondWithResult(_0x15016a,null))[_0x509a('0x18')](handleError(_0x15016a,null));};exports[_0x509a('0x19')]=function(_0x5c2108,_0x2d69c6){if(_0x5c2108[_0x509a('0x45')]['id']){delete _0x5c2108['body']['id'];}var _0x5d3d91;return db[_0x509a('0x24')][_0x509a('0x42')]({'where':{'id':_0x5c2108[_0x509a('0x41')]['id']}})[_0x509a('0xe')](handleEntityNotFound(_0x2d69c6,null))[_0x509a('0xe')](function(_0x432aca){if(_0x432aca){_0x5d3d91=_0x432aca;return db[_0x509a('0x66')][_0x509a('0x42')]({'where':{'id':_0x432aca[_0x509a('0x67')]}});}})['then'](handleEntityNotFound(_0x2d69c6,null))[_0x509a('0xe')](function(_0x3c8078){if(_0x3c8078){logger[_0x509a('0x11')](_0x509a('0x68'),'status',_0x509a('0x69'),_0x3c8078[_0x509a('0x38')],util[_0x509a('0x6a')](_0x5c2108[_0x509a('0x45')],{'showHidden':![],'depth':null}));switch(_0x3c8078[_0x509a('0x38')]){case _0x509a('0x6b'):if(_0x5c2108['body'][_0x509a('0x6c')]&&_0x5c2108['body'][_0x509a('0x6c')]===_0x5d3d91[_0x509a('0x6d')]&&_0x5c2108[_0x509a('0x45')][_0x509a('0x6e')]&&_0x5c2108[_0x509a('0x45')][_0x509a('0x6e')]===_0x509a('0x6f')){return _0x5d3d91['update']({'read':!![]});}else{logger[_0x509a('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x509a('0x19'),_0x509a('0x6b'),util[_0x509a('0x6a')](_0x5c2108[_0x509a('0x45')],{'showHidden':![],'depth':null}));}break;}return _0x5d3d91;}})['then'](respondWithResult(_0x2d69c6,null))['catch'](handleError(_0x2d69c6,null));}; \ No newline at end of file +var _0xbe85=['WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','read','update','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','util','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','whatsapp-interactions','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','Content-Range','then','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','find','create','body','destroy','params','describe','accept','acceptMessage','reject','whatsapp','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','agent','fullname','email','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xbe85,0x1b8));var _0x5be8=function(_0x444395,_0x4d6a71){_0x444395=_0x444395-0x0;var _0x331379=_0xbe85[_0x444395];return _0x331379;};'use strict';var util=require(_0x5be8('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0x5be8('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5be8('0x2'))(_0x5be8('0x3'));var config=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5be8('0x6'),'port':0x18eb});var socket=require(_0x5be8('0x7'))(new Redis(config[_0x5be8('0x8')]));require('./whatsappMessage.socket')[_0x5be8('0x9')](socket);var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232c});var client9002=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});var interaction_log=require(_0x5be8('0x2'))(_0x5be8('0xd'));function respondWithRpcPromise(_0x2814f2,_0x2d04eb,_0x446140,_0x1ff1e5){return new Promise(function(_0x110ee9,_0x312306){var _0x361caa=_0x1ff1e5||client;return _0x361caa[_0x5be8('0xe')](_0x2814f2,_0x446140)['then'](function(_0x439a7d){logger[_0x5be8('0xf')](_0x5be8('0x10'),_0x2d04eb,_0x5be8('0x11'));logger[_0x5be8('0x12')](_0x5be8('0x13'),_0x2d04eb,_0x5be8('0x11'),JSON[_0x5be8('0x14')](_0x439a7d));if(_0x439a7d['error']){if(_0x439a7d[_0x5be8('0x15')][_0x5be8('0x16')]===0x1f4){logger[_0x5be8('0x15')](_0x5be8('0x10'),_0x2d04eb,_0x439a7d['error'][_0x5be8('0x17')]);return _0x312306(_0x439a7d[_0x5be8('0x15')][_0x5be8('0x17')]);}logger[_0x5be8('0x15')](_0x5be8('0x10'),_0x2d04eb,_0x439a7d[_0x5be8('0x15')]['message']);return _0x110ee9(_0x439a7d[_0x5be8('0x15')]['message']);}else{logger[_0x5be8('0xf')](_0x5be8('0x10'),_0x2d04eb,_0x5be8('0x11'));_0x110ee9(_0x439a7d[_0x5be8('0x18')][_0x5be8('0x17')]);}})['catch'](function(_0x22e64b){logger['error'](_0x5be8('0x10'),_0x2d04eb,_0x22e64b);_0x312306(_0x22e64b);});});}function respondWithResult(_0x2168df,_0x57ad71){_0x57ad71=_0x57ad71||0xc8;return function(_0x3b640c){if(_0x3b640c){return _0x2168df[_0x5be8('0x19')](_0x57ad71)[_0x5be8('0x1a')](_0x3b640c);}};}function respondWithFilteredResult(_0x24f7c2,_0x5afe86){return function(_0x3fd2d4){if(_0x3fd2d4){var _0x360343=typeof _0x5afe86[_0x5be8('0x1b')]===_0x5be8('0x1c')&&typeof _0x5afe86['limit']===_0x5be8('0x1c');var _0x442ae9=_0x3fd2d4[_0x5be8('0x1d')];var _0x392ad5=_0x360343?0x0:_0x5afe86['offset'];var _0x98d894=_0x360343?_0x3fd2d4['count']:_0x5afe86['offset']+_0x5afe86['limit'];var _0x16a0a6;if(_0x98d894>=_0x442ae9){_0x98d894=_0x442ae9;_0x16a0a6=0xc8;}else{_0x16a0a6=0xce;}_0x24f7c2[_0x5be8('0x19')](_0x16a0a6);return _0x24f7c2['set'](_0x5be8('0x1e'),_0x392ad5+'-'+_0x98d894+'/'+_0x442ae9)[_0x5be8('0x1a')](_0x3fd2d4);}return null;};}function saveUpdates(_0x34bf16){return function(_0x5a5530){if(_0x5a5530){return _0x5a5530['update'](_0x34bf16)['then'](function(_0x343f74){return _0x343f74;});}return null;};}function removeEntity(_0x2b149d){return function(_0x3aab78){if(_0x3aab78){return _0x3aab78['destroy']()[_0x5be8('0x1f')](function(){_0x2b149d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fca5){return function(_0x58509b){if(!_0x58509b){_0x40fca5['sendStatus'](0x194);}return _0x58509b;};}function handleError(_0x4130ca,_0x45e252){_0x45e252=_0x45e252||0x1f4;return function(_0x4c3b69){logger[_0x5be8('0x15')](_0x4c3b69[_0x5be8('0x20')]);if(_0x4c3b69[_0x5be8('0x21')]){delete _0x4c3b69['name'];}_0x4130ca[_0x5be8('0x19')](_0x45e252)[_0x5be8('0x22')](_0x4c3b69);};}exports[_0x5be8('0x23')]=function(_0x70b520,_0x5b8e75){var _0x56723f={},_0x280dbc={},_0x4a3edd={'count':0x0,'rows':[]};var _0x3bd21b=_[_0x5be8('0x24')](db[_0x5be8('0x25')][_0x5be8('0x26')],function(_0xbece99){return{'name':_0xbece99[_0x5be8('0x27')],'type':_0xbece99[_0x5be8('0x28')][_0x5be8('0x29')]};});_0x280dbc[_0x5be8('0x2a')]=_[_0x5be8('0x24')](_0x3bd21b,'name');_0x280dbc[_0x5be8('0x2b')]=_[_0x5be8('0x2c')](_0x70b520[_0x5be8('0x2b')]);_0x280dbc[_0x5be8('0x2d')]=_[_0x5be8('0x2e')](_0x280dbc[_0x5be8('0x2a')],_0x280dbc['query']);_0x56723f[_0x5be8('0x2f')]=_['intersection'](_0x280dbc['model'],qs[_0x5be8('0x30')](_0x70b520[_0x5be8('0x2b')]['fields']));_0x56723f['attributes']=_0x56723f[_0x5be8('0x2f')][_0x5be8('0x31')]?_0x56723f[_0x5be8('0x2f')]:_0x280dbc[_0x5be8('0x2a')];if(!_0x70b520[_0x5be8('0x2b')]['hasOwnProperty'](_0x5be8('0x32'))){_0x56723f[_0x5be8('0x33')]=qs[_0x5be8('0x33')](_0x70b520['query']['limit']);_0x56723f[_0x5be8('0x1b')]=qs[_0x5be8('0x1b')](_0x70b520['query'][_0x5be8('0x1b')]);}_0x56723f[_0x5be8('0x34')]=qs['sort'](_0x70b520[_0x5be8('0x2b')][_0x5be8('0x35')]);_0x56723f['where']=qs['filters'](_[_0x5be8('0x36')](_0x70b520[_0x5be8('0x2b')],_0x280dbc['filters']),_0x3bd21b);if(_0x70b520['query'][_0x5be8('0x37')]){_0x56723f[_0x5be8('0x38')]=_['merge'](_0x56723f[_0x5be8('0x38')],{'$or':_['map'](_0x3bd21b,function(_0x5c6d51){if(_0x5c6d51[_0x5be8('0x28')]!==_0x5be8('0x39')){var _0x545d5f={};_0x545d5f[_0x5c6d51[_0x5be8('0x21')]]={'$like':'%'+_0x70b520[_0x5be8('0x2b')][_0x5be8('0x37')]+'%'};return _0x545d5f;}})});}_0x56723f=_[_0x5be8('0x3a')]({},_0x56723f,_0x70b520[_0x5be8('0x3b')]);var _0x23476e={'where':_0x56723f[_0x5be8('0x38')]};return db[_0x5be8('0x25')]['count'](_0x23476e)['then'](function(_0x144c58){_0x4a3edd[_0x5be8('0x1d')]=_0x144c58;if(_0x70b520['query']['includeAll']){_0x56723f[_0x5be8('0x3c')]=[{'all':!![]}];}return db[_0x5be8('0x25')][_0x5be8('0x3d')](_0x56723f);})[_0x5be8('0x1f')](function(_0x421d8e){_0x4a3edd['rows']=_0x421d8e;return _0x4a3edd;})[_0x5be8('0x1f')](respondWithFilteredResult(_0x5b8e75,_0x56723f))[_0x5be8('0x3e')](handleError(_0x5b8e75,null));};exports[_0x5be8('0x3f')]=function(_0x39288e,_0x2448ec){var _0xc34b0c={'raw':!![],'where':{'id':_0x39288e['params']['id']}},_0xa859ba={};_0xa859ba[_0x5be8('0x2a')]=_[_0x5be8('0x2c')](db[_0x5be8('0x25')][_0x5be8('0x26')]);_0xa859ba[_0x5be8('0x2b')]=_[_0x5be8('0x2c')](_0x39288e[_0x5be8('0x2b')]);_0xa859ba[_0x5be8('0x2d')]=_[_0x5be8('0x2e')](_0xa859ba['model'],_0xa859ba[_0x5be8('0x2b')]);_0xc34b0c[_0x5be8('0x2f')]=_[_0x5be8('0x2e')](_0xa859ba[_0x5be8('0x2a')],qs[_0x5be8('0x30')](_0x39288e[_0x5be8('0x2b')][_0x5be8('0x30')]));_0xc34b0c[_0x5be8('0x2f')]=_0xc34b0c[_0x5be8('0x2f')][_0x5be8('0x31')]?_0xc34b0c[_0x5be8('0x2f')]:_0xa859ba[_0x5be8('0x2a')];if(_0x39288e[_0x5be8('0x2b')]['includeAll']){_0xc34b0c['include']=[{'all':!![]}];}_0xc34b0c=_[_0x5be8('0x3a')]({},_0xc34b0c,_0x39288e[_0x5be8('0x3b')]);return db[_0x5be8('0x25')][_0x5be8('0x40')](_0xc34b0c)[_0x5be8('0x1f')](handleEntityNotFound(_0x2448ec,null))['then'](respondWithResult(_0x2448ec,null))['catch'](handleError(_0x2448ec,null));};exports[_0x5be8('0x41')]=function(_0x429e82,_0x1e7a04){return db[_0x5be8('0x25')][_0x5be8('0x41')](_0x429e82['body'],{})[_0x5be8('0x1f')](respondWithResult(_0x1e7a04,0xc9))[_0x5be8('0x3e')](handleError(_0x1e7a04,null));};exports['update']=function(_0x4bf699,_0x3b3167){if(_0x4bf699[_0x5be8('0x42')]['id']){delete _0x4bf699[_0x5be8('0x42')]['id'];}return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x4bf699['params']['id']}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3b3167,null))['then'](saveUpdates(_0x4bf699['body'],null))[_0x5be8('0x1f')](respondWithResult(_0x3b3167,null))['catch'](handleError(_0x3b3167,null));};exports[_0x5be8('0x43')]=function(_0x27eb36,_0x23d7d1){return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x27eb36[_0x5be8('0x44')]['id']}})['then'](handleEntityNotFound(_0x23d7d1,null))[_0x5be8('0x1f')](removeEntity(_0x23d7d1,null))[_0x5be8('0x3e')](handleError(_0x23d7d1,null));};exports['describe']=function(_0x3b4814,_0x322428){return db[_0x5be8('0x25')][_0x5be8('0x45')]()[_0x5be8('0x1f')](respondWithResult(_0x322428,null))[_0x5be8('0x3e')](handleError(_0x322428,null));};exports[_0x5be8('0x46')]=function(_0x3425d7,_0x4b6a7a){var _0x5a2b80='whatsapp';return interactionService[_0x5be8('0x47')](_0x3425d7,_0x5a2b80)[_0x5be8('0x1f')](respondWithResult(_0x4b6a7a,null))[_0x5be8('0x3e')](handleError(_0x4b6a7a,null));};exports[_0x5be8('0x48')]=function(_0x49d88d,_0x489a53){var _0x289c25={'agent':{},'channel':_0x5be8('0x49')};if(_0x49d88d[_0x5be8('0x42')]['id']){delete _0x49d88d[_0x5be8('0x42')]['id'];}_0x49d88d[_0x5be8('0x42')][_0x5be8('0x4a')]=_0x49d88d['body'][_0x5be8('0x4a')]||_0x49d88d[_0x5be8('0x4b')]['id'];_0x289c25['agent']['id']=_0x49d88d[_0x5be8('0x42')][_0x5be8('0x4a')];return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x49d88d[_0x5be8('0x44')]['id'],'UserId':null}})[_0x5be8('0x1f')](handleEntityNotFound(_0x489a53,null))[_0x5be8('0x1f')](function(_0xb025f){if(_0xb025f){_0x289c25[_0x5be8('0x17')]=_0xb025f[_0x5be8('0x4c')]({'plain':!![]});return db[_0x5be8('0x4d')][_0x5be8('0x40')]({'where':{'id':_0xb025f[_0x5be8('0x4e')]}});}return null;})['then'](handleEntityNotFound(_0x489a53,null))[_0x5be8('0x1f')](function(_0x23f72b){if(_0x23f72b){_0x289c25['interaction']=_0x23f72b[_0x5be8('0x4c')]({'plain':!![]});interaction_log[_0x5be8('0xf')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49d88d[_0x5be8('0x4b')]['id'],_0x49d88d[_0x5be8('0x4b')][_0x5be8('0x21')],_0x49d88d['user'][_0x5be8('0x4f')],_0x289c25['interaction']['id'],_0x49d88d[_0x5be8('0x42')]?JSON[_0x5be8('0x14')](_0x49d88d[_0x5be8('0x42')]):'null');return respondWithRpcPromise(_0x5be8('0x50'),_0x5be8('0x51'),_0x289c25);}return null;})['then'](function(_0xbf9d2b){var _0x59e846=_0x5be8('0x52')+_0xbf9d2b[_0x5be8('0x17')][_0x5be8('0x53')];return db[_0x5be8('0x54')][_0x5be8('0x2b')](_0x59e846,{'type':db[_0x5be8('0x55')]['QueryTypes'][_0x5be8('0x56')],'raw':!![]})[_0x5be8('0x1f')](function(_0x1d7b30){return _0x1d7b30;});})[_0x5be8('0x1f')](function(_0x175cfe){if(_0x175cfe){_0x289c25['message'][_0x5be8('0x57')]=_0x175cfe[0x0];if(!_0x49d88d[_0x5be8('0x42')]['UserId'])return;return db['User'][_0x5be8('0x40')]({'where':{'id':_0x49d88d[_0x5be8('0x42')]['UserId'],'role':_0x5be8('0x58')},'attributes':['id',_0x5be8('0x21'),_0x5be8('0x59'),_0x5be8('0x5a'),_0x5be8('0x5b')],'raw':!![]});}return null;})['then'](function(_0x469f33){if(!_0x469f33)return null;_0x289c25[_0x5be8('0x17')][_0x5be8('0x58')]=_0x469f33;return _0x289c25;})[_0x5be8('0x1f')](function(_0x1d4892){if(_0x1d4892){_0x1d4892[_0x5be8('0x17')]['interface']=util[_0x5be8('0x5c')]('SIP/%s',_0x49d88d['user'][_0x5be8('0x21')]);_0x1d4892[_0x5be8('0x17')][_0x5be8('0x5d')]=_0x289c25['channel'];_0x1d4892[_0x5be8('0x17')][_0x5be8('0x5e')]=_0x289c25[_0x5be8('0x5d')];_0x1d4892['message'][_0x5be8('0x5f')]=_0x5be8('0x48');respondWithRpcPromise(_0x5be8('0x60'),_0x5be8('0x60'),{'event':_0x5be8('0x61'),'message':_0x1d4892[_0x5be8('0x17')]},client9002);return _0x289c25;}return null;})[_0x5be8('0x1f')](respondWithResult(_0x489a53,null))[_0x5be8('0x3e')](handleError(_0x489a53,null));};exports['status']=function(_0x3a483,_0x3199df){if(_0x3a483[_0x5be8('0x42')]['id']){delete _0x3a483[_0x5be8('0x42')]['id'];}var _0xd5814c;return db[_0x5be8('0x25')][_0x5be8('0x40')]({'where':{'id':_0x3a483[_0x5be8('0x44')]['id']}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3199df,null))[_0x5be8('0x1f')](function(_0x1241e9){if(_0x1241e9){_0xd5814c=_0x1241e9;return db[_0x5be8('0x62')][_0x5be8('0x40')]({'where':{'id':_0x1241e9[_0x5be8('0x63')]}});}})[_0x5be8('0x1f')](handleEntityNotFound(_0x3199df,null))[_0x5be8('0x1f')](function(_0x2e0aa1){if(_0x2e0aa1){logger[_0x5be8('0x12')](_0x5be8('0x64'),'status','received\x20delivery\x20report\x20from',_0x2e0aa1[_0x5be8('0x28')],util['inspect'](_0x3a483[_0x5be8('0x42')],{'showHidden':![],'depth':null}));switch(_0x2e0aa1[_0x5be8('0x28')]){case'twilio':if(_0x3a483['body'][_0x5be8('0x65')]&&_0x3a483[_0x5be8('0x42')][_0x5be8('0x65')]===_0xd5814c[_0x5be8('0x66')]&&_0x3a483[_0x5be8('0x42')]['MessageStatus']&&_0x3a483[_0x5be8('0x42')][_0x5be8('0x67')]===_0x5be8('0x68')){return _0xd5814c[_0x5be8('0x69')]({'read':!![]});}else{logger['error'](_0x5be8('0x6a'),_0x5be8('0x19'),'twilio',util[_0x5be8('0x6b')](_0x3a483[_0x5be8('0x42')],{'showHidden':![],'depth':null}));}break;}return _0xd5814c;}})[_0x5be8('0x1f')](respondWithResult(_0x3199df,null))[_0x5be8('0x3e')](handleError(_0x3199df,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index eda20f3..922eb60 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 _0xe3d4=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x308c6a,_0xe04d64){_0x308c6a=_0x308c6a-0x0;var _0x257b4d=_0xe3d4[_0x308c6a];return _0x257b4d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4e3d('0x0'))['db'][_0x4e3d('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4e3d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e3d('0x3'),'afterDestroy':_0x4e3d('0x4')};function emitEvent(_0x5a7634){return function(_0x1db7a4,_0x4ece82,_0x438b9a){WhatsappMessageEvents[_0x4e3d('0x5')](_0x5a7634+':'+_0x1db7a4['id'],_0x1db7a4);WhatsappMessageEvents['emit'](_0x5a7634,_0x1db7a4);_0x438b9a(null);};}for(var e in events){if(events[_0x4e3d('0x6')](e)){var event=events[e];WhatsappMessage[_0x4e3d('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xee5b=['remove','emit','hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','update'];(function(_0x3d8680,_0x3ca47d){var _0x76dbf5=function(_0x2dd5c1){while(--_0x2dd5c1){_0x3d8680['push'](_0x3d8680['shift']());}};_0x76dbf5(++_0x3ca47d);}(_0xee5b,0x1f4));var _0xbee5=function(_0x51b783,_0x361cbd){_0x51b783=_0x51b783-0x0;var _0x2d478=_0xee5b[_0x51b783];return _0x2d478;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbee5('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){WhatsappMessageEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);WhatsappMessageEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];WhatsappMessage[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c6c4339..d89063a 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 _0x25b2=['fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x25b2,0x12e));var _0x225b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x25b2[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x225b('0x0'))(_0x225b('0x1'));var moment=require(_0x225b('0x2'));var BPromise=require(_0x225b('0x3'));var rp=require('request-promise');var fetch=require(_0x225b('0x4'));var fs=require('fs');var path=require(_0x225b('0x5'));var rimraf=require(_0x225b('0x6'));var config=require(_0x225b('0x7'));var attributes=require(_0x225b('0x8'));module[_0x225b('0x9')]=function(_0x21cd95,_0x174f7c){return _0x21cd95['define'](_0x225b('0xa'),attributes,{'tableName':_0x225b('0xb'),'paranoid':![],'indexes':[{'name':_0x225b('0xc'),'fields':[_0x225b('0xc')]},{'name':_0x225b('0xd'),'fields':[_0x225b('0xe')],'type':_0x225b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x114781,_0x3dcd04,_0x50f299){var _0x9ef6f2=_0x21cd95[_0x225b('0x10')];var _0x49d045=_0x114781[_0x225b('0x11')]({'plain':!![]});if(_0x49d045[_0x225b('0x12')]['toLowerCase']()==='in'||_0x49d045['direction'][_0x225b('0x13')]()==='out'&&!_0x49d045['secret']&&!_[_0x225b('0x14')](_0x49d045[_0x225b('0x15')])){_0x9ef6f2[_0x225b('0x16')]['findOne']({'where':{'id':_0x49d045[_0x225b('0x17')]}})[_0x225b('0x18')](function(_0x51e5ab){if(_0x51e5ab){_0x51e5ab['update']({'lastMsgAt':_0x49d045[_0x225b('0x19')],'lastMsgDirection':_0x49d045['direction'][_0x225b('0x13')]()});}})['catch'](function(_0x31723a){console[_0x225b('0x1a')](_0x31723a);});}if(_0x49d045['direction']===_0x225b('0x1b')&&!_0x49d045[_0x225b('0x1c')]){var _0x2d4760;_0x9ef6f2[_0x225b('0x1d')][_0x225b('0x1e')]({'where':{'id':_0x49d045[_0x225b('0x1f')]},'raw':!![]})['then'](function(_0xdfa4f6){_0x2d4760=_0xdfa4f6;if(_0x2d4760&&_0x2d4760[_0x225b('0x20')]){switch(_0x2d4760[_0x225b('0x20')]){case _0x225b('0x21'):var _0x435551=require(_0x225b('0x21'));if(_0x2d4760[_0x225b('0x22')]&&_0x2d4760[_0x225b('0x23')]&&_0x2d4760[_0x225b('0x24')]){var _0x3cc4b1=new _0x435551(_0x2d4760[_0x225b('0x22')],_0x2d4760['authToken']);_0x3cc4b1[_0x225b('0x25')][_0x225b('0x26')]({'body':_0x49d045[_0x225b('0xe')],'to':_0x225b('0x27')+_0x49d045[_0x225b('0x24')],'from':'whatsapp:'+_0x2d4760[_0x225b('0x24')],'statusCallback':_0x2d4760[_0x225b('0x28')]+'/api/whatsapp/messages/'+_0x49d045['id']+_0x225b('0x29')+_0x2d4760[_0x225b('0x2a')]})['then'](function(_0x44b551){if(_0x44b551[_0x225b('0x2b')]){return _0x114781[_0x225b('0x2c')]({'messageId':_0x44b551[_0x225b('0x2b')]});}})['catch'](function(_0xdbcd3f){logger['error'](_0x225b('0x2d'),_0x225b('0x2e'),_0x225b('0x21'),util[_0x225b('0x2f')](_0xdbcd3f,{'showHidden':![],'depth':null}));});}else{logger[_0x225b('0x1a')](_0x225b('0x2d'),'afterCreate',_0x225b('0x21'),_0x225b('0x30'));}break;case _0x225b('0x31'):var _0x2d4529=_0x2d4760[_0x225b('0x22')];var _0xc5021d=_0x2d4760['authToken'];var _0x2b0109=_0x2d4760[_0x225b('0x32')]+'/whatsapp/v1/'+_0x2d4529+_0x225b('0x33');var _0x8bb534={'to':[_0x49d045[_0x225b('0x24')]],'message':{'type':_0x225b('0x34'),'text':_0x49d045[_0x225b('0xe')]}};var _0x3a83bc={'method':_0x225b('0x35'),'uri':_0x2b0109,'headers':{'Authorization':_0x225b('0x36')+_0xc5021d,'Content-Type':'application/json'},'body':_0x8bb534,'json':!![]};rp(_0x3a83bc)[_0x225b('0x18')](function(_0x1d204e){if(_0x1d204e[_0x225b('0x37')][0x0][_0x225b('0x38')]){return _0x114781[_0x225b('0x2c')]({'messageId':_0x1d204e['statuses'][0x0][_0x225b('0x38')]});}})[_0x225b('0x39')](function(_0x10d328){logger[_0x225b('0x3a')](_0x225b('0x3b'),_0x10d328);});break;}}})[_0x225b('0x3c')](function(){_0x50f299();});}else{_0x50f299();}}},'charset':_0x225b('0x3d'),'collate':_0x225b('0x3e')});}; \ No newline at end of file +var _0x820b=['fti_whatsapp_messages','body','get','toLowerCase','direction','out','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x820b,0x190));var _0xb820=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x820b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb820('0x0'));var util=require('util');var logger=require(_0xb820('0x1'))('api');var moment=require(_0xb820('0x2'));var BPromise=require(_0xb820('0x3'));var rp=require('request-promise');var fetch=require(_0xb820('0x4'));var fs=require('fs');var path=require(_0xb820('0x5'));var rimraf=require('rimraf');var config=require(_0xb820('0x6'));var attributes=require(_0xb820('0x7'));module[_0xb820('0x8')]=function(_0x22e0cb,_0x3cc1b6){return _0x22e0cb[_0xb820('0x9')](_0xb820('0xa'),attributes,{'tableName':_0xb820('0xb'),'paranoid':![],'indexes':[{'name':_0xb820('0xc'),'fields':['messageId']},{'name':_0xb820('0xd'),'fields':[_0xb820('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48179a,_0x36f27d,_0x1574ec){var _0x345be8=_0x22e0cb['models'];var _0x1b5a61=_0x48179a[_0xb820('0xf')]({'plain':!![]});if(_0x1b5a61['direction'][_0xb820('0x10')]()==='in'||_0x1b5a61[_0xb820('0x11')]['toLowerCase']()===_0xb820('0x12')&&!_0x1b5a61['secret']&&!_[_0xb820('0x13')](_0x1b5a61[_0xb820('0x14')])){_0x345be8['WhatsappInteraction'][_0xb820('0x15')]({'where':{'id':_0x1b5a61[_0xb820('0x16')]}})[_0xb820('0x17')](function(_0x1414e2){if(_0x1414e2){_0x1414e2[_0xb820('0x18')]({'lastMsgAt':_0x1b5a61[_0xb820('0x19')],'lastMsgDirection':_0x1b5a61[_0xb820('0x11')][_0xb820('0x10')]()});}})[_0xb820('0x1a')](function(_0x199b12){console[_0xb820('0x1b')](_0x199b12);});}if(_0x1b5a61[_0xb820('0x11')]===_0xb820('0x12')&&!_0x1b5a61[_0xb820('0x1c')]){var _0x4a1698;_0x345be8[_0xb820('0x1d')][_0xb820('0x1e')]({'where':{'id':_0x1b5a61[_0xb820('0x1f')]},'raw':!![]})['then'](function(_0xf96975){_0x4a1698=_0xf96975;if(_0x4a1698&&_0x4a1698[_0xb820('0x20')]){switch(_0x4a1698['type']){case'twilio':var _0xea91dc=require('twilio');if(_0x4a1698[_0xb820('0x21')]&&_0x4a1698[_0xb820('0x22')]&&_0x4a1698[_0xb820('0x23')]){var _0x384609=new _0xea91dc(_0x4a1698[_0xb820('0x21')],_0x4a1698[_0xb820('0x22')]);_0x384609[_0xb820('0x24')][_0xb820('0x25')]({'body':_0x1b5a61[_0xb820('0xe')],'to':_0xb820('0x26')+_0x1b5a61[_0xb820('0x23')],'from':_0xb820('0x26')+_0x4a1698['phone'],'statusCallback':_0x4a1698[_0xb820('0x27')]+_0xb820('0x28')+_0x1b5a61['id']+'/status?token='+_0x4a1698[_0xb820('0x29')]})[_0xb820('0x17')](function(_0x12d640){if(_0x12d640[_0xb820('0x2a')]){return _0x48179a['update']({'messageId':_0x12d640[_0xb820('0x2a')]});}})['catch'](function(_0x50e4dd){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0xb820('0x2b')](_0x50e4dd,{'showHidden':![],'depth':null}));});}else{logger[_0xb820('0x1b')](_0xb820('0x2c'),_0xb820('0x2d'),_0xb820('0x2e'),_0xb820('0x2f'));}break;case _0xb820('0x30'):var _0x7eaa7f=_0x4a1698[_0xb820('0x21')];var _0x904ff8=_0x4a1698['authToken'];var _0x119939=_0x4a1698['baseUrl']+_0xb820('0x31')+_0x7eaa7f+_0xb820('0x32');var _0x14c7f2={'to':[_0x1b5a61[_0xb820('0x23')]],'message':{'type':'text','text':_0x1b5a61[_0xb820('0xe')]}};var _0x37e3bc={'method':_0xb820('0x33'),'uri':_0x119939,'headers':{'Authorization':_0xb820('0x34')+_0x904ff8,'Content-Type':_0xb820('0x35')},'body':_0x14c7f2,'json':!![]};rp(_0x37e3bc)[_0xb820('0x17')](function(_0x4aa942){if(_0x4aa942[_0xb820('0x36')][0x0]['message_id']){return _0x48179a[_0xb820('0x18')]({'messageId':_0x4aa942['statuses'][0x0]['message_id']});}})[_0xb820('0x1a')](function(_0x5ee3a1){logger['err'](_0xb820('0x37'),_0x5ee3a1);});break;}}})[_0xb820('0x38')](function(){_0x1574ec();});}else{_0x1574ec();}}},'charset':_0xb820('0x39'),'collate':_0xb820('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 64deebb..80b2fc0 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 _0xf749=['WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch'];(function(_0x2c0750,_0x56f22){var _0x1f62d9=function(_0x318ba0){while(--_0x318ba0){_0x2c0750['push'](_0x2c0750['shift']());}};_0x1f62d9(++_0x56f22);}(_0xf749,0xd3));var _0x9f74=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf749[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x9f74('0x0'));var moment=require(_0x9f74('0x1'));var BPromise=require(_0x9f74('0x2'));var rs=require(_0x9f74('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f74('0x4'))['db'];var utils=require(_0x9f74('0x5'));var logger=require(_0x9f74('0x6'))(_0x9f74('0x7'));var config=require(_0x9f74('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f74('0x9')][_0x9f74('0xa')]({'port':0x232a});config['redis']=_[_0x9f74('0xb')](config['redis'],{'host':_0x9f74('0xc'),'port':0x18eb});var socket=require(_0x9f74('0xd'))(new Redis(config[_0x9f74('0xe')]));require('./whatsappMessage.socket')[_0x9f74('0xf')](socket);function respondWithRpcPromise(_0x3d8126,_0xbb9685,_0x27abd2){return new BPromise(function(_0x3e781d,_0x3047d3){return client['request'](_0x3d8126,_0x27abd2)[_0x9f74('0x10')](function(_0x515c46){logger[_0x9f74('0x11')](_0x9f74('0x12'),_0xbb9685,'request\x20sent');logger[_0x9f74('0x13')](_0x9f74('0x14'),_0xbb9685,'request\x20sent',JSON['stringify'](_0x515c46));if(_0x515c46[_0x9f74('0x15')]){if(_0x515c46['error'][_0x9f74('0x16')]===0x1f4){logger[_0x9f74('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xbb9685,_0x515c46[_0x9f74('0x15')]['message']);return _0x3047d3(_0x515c46[_0x9f74('0x15')][_0x9f74('0x17')]);}logger[_0x9f74('0x15')](_0x9f74('0x12'),_0xbb9685,_0x515c46['error'][_0x9f74('0x17')]);return _0x3e781d(_0x515c46['error']['message']);}else{logger[_0x9f74('0x11')](_0x9f74('0x12'),_0xbb9685,_0x9f74('0x18'));_0x3e781d(_0x515c46[_0x9f74('0x19')][_0x9f74('0x17')]);}})[_0x9f74('0x1a')](function(_0xc14ec2){logger['error'](_0x9f74('0x12'),_0xbb9685,_0xc14ec2);_0x3047d3(_0xc14ec2);});});}exports['CreateWhatsappMessage']=function(_0x302a99){var _0x221b01=this;return new Promise(function(_0x291623,_0x3f2b16){return db[_0x9f74('0x1b')][_0x9f74('0x1c')](_0x302a99[_0x9f74('0x1d')],{'raw':_0x302a99[_0x9f74('0x1e')]?_0x302a99[_0x9f74('0x1e')][_0x9f74('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x12ef48){logger['info'](_0x9f74('0x20'),_0x302a99);logger[_0x9f74('0x13')](_0x9f74('0x20'),_0x302a99,JSON[_0x9f74('0x21')](_0x12ef48));_0x291623(_0x12ef48);})[_0x9f74('0x1a')](function(_0x4eae1b){logger[_0x9f74('0x15')](_0x9f74('0x20'),_0x4eae1b[_0x9f74('0x17')],_0x302a99);_0x3f2b16(_0x221b01[_0x9f74('0x15')](0x1f4,_0x4eae1b['message']));});});}; \ No newline at end of file +var _0x5633=['catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x5633,0x1f2));var _0x3563=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x5633[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x3563('0x0'));var util=require(_0x3563('0x1'));var moment=require(_0x3563('0x2'));var BPromise=require(_0x3563('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3563('0x4'));var db=require(_0x3563('0x5'))['db'];var utils=require(_0x3563('0x6'));var logger=require(_0x3563('0x7'))(_0x3563('0x8'));var config=require('../../config/environment');var jayson=require(_0x3563('0x9'));var client=jayson[_0x3563('0xa')][_0x3563('0xb')]({'port':0x232a});config['redis']=_[_0x3563('0xc')](config[_0x3563('0xd')],{'host':_0x3563('0xe'),'port':0x18eb});var socket=require(_0x3563('0xf'))(new Redis(config[_0x3563('0xd')]));require(_0x3563('0x10'))[_0x3563('0x11')](socket);function respondWithRpcPromise(_0x266f29,_0x4e6e71,_0x3a5cb3){return new BPromise(function(_0x2ea60b,_0x3ab430){return client['request'](_0x266f29,_0x3a5cb3)['then'](function(_0x38be84){logger[_0x3563('0x12')](_0x3563('0x13'),_0x4e6e71,_0x3563('0x14'));logger['debug'](_0x3563('0x15'),_0x4e6e71,_0x3563('0x14'),JSON[_0x3563('0x16')](_0x38be84));if(_0x38be84[_0x3563('0x17')]){if(_0x38be84['error'][_0x3563('0x18')]===0x1f4){logger[_0x3563('0x17')](_0x3563('0x13'),_0x4e6e71,_0x38be84['error'][_0x3563('0x19')]);return _0x3ab430(_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);}logger['error'](_0x3563('0x13'),_0x4e6e71,_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);return _0x2ea60b(_0x38be84[_0x3563('0x17')][_0x3563('0x19')]);}else{logger[_0x3563('0x12')](_0x3563('0x13'),_0x4e6e71,_0x3563('0x14'));_0x2ea60b(_0x38be84[_0x3563('0x1a')][_0x3563('0x19')]);}})[_0x3563('0x1b')](function(_0x2bf635){logger[_0x3563('0x17')](_0x3563('0x13'),_0x4e6e71,_0x2bf635);_0x3ab430(_0x2bf635);});});}exports[_0x3563('0x1c')]=function(_0x25d14b){var _0x36e437=this;return new Promise(function(_0x2cc032,_0x11c62a){return db[_0x3563('0x1d')]['create'](_0x25d14b[_0x3563('0x1e')],{'raw':_0x25d14b[_0x3563('0x1f')]?_0x25d14b[_0x3563('0x1f')][_0x3563('0x20')]===undefined?!![]:![]:!![]})[_0x3563('0x21')](function(_0x26dc40){logger[_0x3563('0x12')](_0x3563('0x1c'),_0x25d14b);logger[_0x3563('0x22')](_0x3563('0x1c'),_0x25d14b,JSON[_0x3563('0x16')](_0x26dc40));_0x2cc032(_0x26dc40);})[_0x3563('0x1b')](function(_0x329bb6){logger[_0x3563('0x17')](_0x3563('0x1c'),_0x329bb6[_0x3563('0x19')],_0x25d14b);_0x11c62a(_0x36e437[_0x3563('0x17')](0x1f4,_0x329bb6[_0x3563('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8492de4..4e91697 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 _0xd70d=['save','remove','update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x137f74,_0x55292b){var _0x2d11a1=function(_0x266ec2){while(--_0x266ec2){_0x137f74['push'](_0x137f74['shift']());}};_0x2d11a1(++_0x55292b);}(_0xd70d,0x1c7));var _0xdd70=function(_0x2a911a,_0x599d1d){_0x2a911a=_0x2a911a-0x0;var _0x335a00=_0xd70d[_0x2a911a];return _0x335a00;};'use strict';var WhatsappMessageEvents=require(_0xdd70('0x0'));var events=[_0xdd70('0x1'),_0xdd70('0x2'),_0xdd70('0x3')];function createListener(_0x452c87,_0x5c1ac3){return function(_0x30135d){_0x5c1ac3[_0xdd70('0x4')](_0x452c87,_0x30135d);};}function removeListener(_0x4cfdb3,_0x28d791){return function(){WhatsappMessageEvents[_0xdd70('0x5')](_0x4cfdb3,_0x28d791);};}exports['register']=function(_0x2a66c2){for(var _0x4bb52f=0x0,_0x5c4d45=events[_0xdd70('0x6')];_0x4bb52f<_0x5c4d45;_0x4bb52f++){var _0x35b36f=events[_0x4bb52f];var _0xd893db=createListener(_0xdd70('0x7')+_0x35b36f,_0x2a66c2);WhatsappMessageEvents['on'](_0x35b36f,_0xd893db);}}; \ No newline at end of file +var _0x2662=['register','whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener'];(function(_0x7e32e7,_0x38dd3b){var _0x549de2=function(_0x4a28c4){while(--_0x4a28c4){_0x7e32e7['push'](_0x7e32e7['shift']());}};_0x549de2(++_0x38dd3b);}(_0x2662,0x159));var _0x2266=function(_0x22890f,_0x4ffd4f){_0x22890f=_0x22890f-0x0;var _0x5cf0a3=_0x2662[_0x22890f];return _0x5cf0a3;};'use strict';var WhatsappMessageEvents=require(_0x2266('0x0'));var events=[_0x2266('0x1'),'remove',_0x2266('0x2')];function createListener(_0x284a85,_0xeff31e){return function(_0x41cd57){_0xeff31e[_0x2266('0x3')](_0x284a85,_0x41cd57);};}function removeListener(_0x4eafa8,_0x18234c){return function(){WhatsappMessageEvents[_0x2266('0x4')](_0x4eafa8,_0x18234c);};}exports[_0x2266('0x5')]=function(_0x12ee21){for(var _0x306e80=0x0,_0x430a2a=events['length'];_0x306e80<_0x430a2a;_0x306e80++){var _0x4862b8=events[_0x306e80];var _0xc57137=createListener(_0x2266('0x6')+_0x4862b8,_0x12ee21);WhatsappMessageEvents['on'](_0x4862b8,_0xc57137);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 3b6313a..5247825 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 _0x81d9=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','update','delete','removeTeams','/:id/users'];(function(_0x4c373b,_0x6c985f){var _0x2f303d=function(_0x3077e7){while(--_0x3077e7){_0x4c373b['push'](_0x4c373b['shift']());}};_0x2f303d(++_0x6c985f);}(_0x81d9,0x146));var _0x981d=function(_0x16ae5b,_0x140ffd){_0x16ae5b=_0x16ae5b-0x0;var _0x4650d2=_0x81d9[_0x16ae5b];return _0x4650d2;};'use strict';var multer=require(_0x981d('0x0'));var util=require(_0x981d('0x1'));var path=require(_0x981d('0x2'));var timeout=require(_0x981d('0x3'));var express=require('express');var router=express[_0x981d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x981d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x981d('0x6'));var controller=require('./whatsappQueue.controller');router[_0x981d('0x7')]('/',auth[_0x981d('0x8')](),controller[_0x981d('0x9')]);router['get']('/describe',auth[_0x981d('0x8')](),controller['describe']);router[_0x981d('0x7')](_0x981d('0xa'),auth[_0x981d('0x8')](),controller[_0x981d('0xb')]);router[_0x981d('0x7')](_0x981d('0xc'),auth[_0x981d('0x8')](),controller[_0x981d('0xd')]);router[_0x981d('0x7')](_0x981d('0xe'),auth[_0x981d('0x8')](),controller[_0x981d('0xf')]);router[_0x981d('0x7')]('/:id/users',auth[_0x981d('0x8')](),controller['getAgents']);router[_0x981d('0x10')]('/',auth[_0x981d('0x8')](),controller[_0x981d('0x11')]);router[_0x981d('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x981d('0x12')]);router[_0x981d('0x10')]('/:id/users',auth[_0x981d('0x8')](),controller[_0x981d('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x981d('0x14')]);router[_0x981d('0x15')](_0x981d('0xa'),auth[_0x981d('0x8')](),controller['destroy']);router['delete'](_0x981d('0xe'),auth['isAuthenticated'](),controller[_0x981d('0x16')]);router['delete'](_0x981d('0x17'),auth[_0x981d('0x8')](),controller['removeAgents']);module[_0x981d('0x18')]=router; \ No newline at end of file +var _0x62fa=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer'];(function(_0x3b70ad,_0x4aa3b0){var _0x8bb384=function(_0x176bbf){while(--_0x176bbf){_0x3b70ad['push'](_0x3b70ad['shift']());}};_0x8bb384(++_0x4aa3b0);}(_0x62fa,0x1ec));var _0xa62f=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0x62fa[_0x4a79fd];return _0xef2f88;};'use strict';var multer=require(_0xa62f('0x0'));var util=require(_0xa62f('0x1'));var path=require(_0xa62f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa62f('0x3')]();var fs_extra=require(_0xa62f('0x4'));var auth=require(_0xa62f('0x5'));var interaction=require(_0xa62f('0x6'));var config=require(_0xa62f('0x7'));var controller=require('./whatsappQueue.controller');router[_0xa62f('0x8')]('/',auth[_0xa62f('0x9')](),controller[_0xa62f('0xa')]);router['get'](_0xa62f('0xb'),auth[_0xa62f('0x9')](),controller['describe']);router[_0xa62f('0x8')]('/:id',auth[_0xa62f('0x9')](),controller['show']);router[_0xa62f('0x8')](_0xa62f('0xc'),auth[_0xa62f('0x9')](),controller[_0xa62f('0xd')]);router[_0xa62f('0x8')](_0xa62f('0xe'),auth['isAuthenticated'](),controller[_0xa62f('0xf')]);router[_0xa62f('0x8')](_0xa62f('0x10'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x11')]);router[_0xa62f('0x12')]('/',auth[_0xa62f('0x9')](),controller[_0xa62f('0x13')]);router[_0xa62f('0x12')](_0xa62f('0xe'),auth['isAuthenticated'](),controller[_0xa62f('0x14')]);router['post'](_0xa62f('0x10'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x15')]);router[_0xa62f('0x16')](_0xa62f('0x17'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x18')]);router[_0xa62f('0x19')]('/:id',auth[_0xa62f('0x9')](),controller['destroy']);router['delete'](_0xa62f('0xe'),auth[_0xa62f('0x9')](),controller[_0xa62f('0x1a')]);router['delete']('/:id/users',auth[_0xa62f('0x9')](),controller[_0xa62f('0x1b')]);module[_0xa62f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5ead22a..2fe139e 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 _0x5127=['name','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x33d5ad,_0x9c60dc){var _0x72a8a=function(_0x1fbb46){while(--_0x1fbb46){_0x33d5ad['push'](_0x33d5ad['shift']());}};_0x72a8a(++_0x9c60dc);}(_0x5127,0x18f));var _0x7512=function(_0x2f3947,_0x2ee083){_0x2f3947=_0x2f3947-0x0;var _0x3e6ab7=_0x5127[_0x2f3947];return _0x3e6ab7;};'use strict';var Sequelize=require(_0x7512('0x0'));module[_0x7512('0x1')]={'name':{'type':Sequelize[_0x7512('0x2')],'unique':_0x7512('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7512('0x4'),'beepall',_0x7512('0x5'))},'description':{'type':Sequelize[_0x7512('0x2')]}}; \ No newline at end of file +var _0xc2cc=['ENUM','beepall','exports','STRING','name'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xc2cc,0x70));var _0xcc2c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc2cc[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xcc2c('0x0')]={'name':{'type':Sequelize[_0xcc2c('0x1')],'unique':_0xcc2c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc2c('0x3')]('rrmemory',_0xcc2c('0x4'),'roundrobin')},'description':{'type':Sequelize[_0xcc2c('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c3d68a0..a392172 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 _0x3ab6=['undefined','limit','count','set','Content-Range','update','destroy','then','get','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','attributes','fields','length','merge','options','find','create','body','user','WhatsappQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','getTeams','Team','intersection','order','sort','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','field','from','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset'];(function(_0x3e8384,_0x509b08){var _0x71f391=function(_0x326c0e){while(--_0x326c0e){_0x3e8384['push'](_0x3e8384['shift']());}};_0x71f391(++_0x509b08);}(_0x3ab6,0x14d));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x63ab('0x0'));var util=require('util');var _=require(_0x63ab('0x1'));var squel=require(_0x63ab('0x2'));var Redis=require('ioredis');var qs=require(_0x63ab('0x3'));var logger=require('../../config/logger')(_0x63ab('0x4'));var config=require(_0x63ab('0x5'));var db=require(_0x63ab('0x6'))['db'];config[_0x63ab('0x7')]=_[_0x63ab('0x8')](config[_0x63ab('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x63ab('0x9'))(new Redis(config[_0x63ab('0x7')]));require('./whatsappQueue.socket')[_0x63ab('0xa')](socket);function respondWithStatusCode(_0x297736,_0x3e555d){_0x3e555d=_0x3e555d||0xcc;return function(_0x108a42){if(_0x108a42){return _0x297736[_0x63ab('0xb')](_0x3e555d);}return _0x297736[_0x63ab('0xc')](_0x3e555d)['end']();};}function respondWithResult(_0x5a12dd,_0x4c4f58){_0x4c4f58=_0x4c4f58||0xc8;return function(_0x1d693c){if(_0x1d693c){return _0x5a12dd['status'](_0x4c4f58)[_0x63ab('0xd')](_0x1d693c);}};}function respondWithFilteredResult(_0x276563,_0x38cc40){return function(_0x19ae46){if(_0x19ae46){var _0x275720=typeof _0x38cc40[_0x63ab('0xe')]===_0x63ab('0xf')&&typeof _0x38cc40[_0x63ab('0x10')]===_0x63ab('0xf');var _0x38317c=_0x19ae46['count'];var _0x275dc1=_0x275720?0x0:_0x38cc40[_0x63ab('0xe')];var _0x421d9a=_0x275720?_0x19ae46[_0x63ab('0x11')]:_0x38cc40[_0x63ab('0xe')]+_0x38cc40[_0x63ab('0x10')];var _0x30cfa3;if(_0x421d9a>=_0x38317c){_0x421d9a=_0x38317c;_0x30cfa3=0xc8;}else{_0x30cfa3=0xce;}_0x276563['status'](_0x30cfa3);return _0x276563[_0x63ab('0x12')](_0x63ab('0x13'),_0x275dc1+'-'+_0x421d9a+'/'+_0x38317c)[_0x63ab('0xd')](_0x19ae46);}return null;};}function saveUpdates(_0x1ae081){return function(_0x2321f9){if(_0x2321f9){return _0x2321f9[_0x63ab('0x14')](_0x1ae081)['then'](function(_0x1394e8){return _0x1394e8;});}return null;};}function removeEntity(_0x2e0258){return function(_0x2df89e){if(_0x2df89e){return _0x2df89e[_0x63ab('0x15')]()[_0x63ab('0x16')](function(){var _0x15e6e2=_0x2df89e[_0x63ab('0x17')]({'plain':!![]});var _0x36be3e='WhatsappQueues';return db[_0x63ab('0x18')]['destroy']({'where':{'type':_0x36be3e,'resourceId':_0x15e6e2['id']}})[_0x63ab('0x16')](function(){return _0x2df89e;});})[_0x63ab('0x16')](function(){_0x2e0258[_0x63ab('0xc')](0xcc)[_0x63ab('0x19')]();});}};}function handleEntityNotFound(_0x311b9c){return function(_0x589c06){if(!_0x589c06){_0x311b9c[_0x63ab('0xb')](0x194);}return _0x589c06;};}function handleError(_0x45853e,_0x57b819){_0x57b819=_0x57b819||0x1f4;return function(_0x754184){logger[_0x63ab('0x1a')](_0x754184['stack']);if(_0x754184[_0x63ab('0x1b')]){delete _0x754184[_0x63ab('0x1b')];}_0x45853e[_0x63ab('0xc')](_0x57b819)[_0x63ab('0x1c')](_0x754184);};}exports[_0x63ab('0x1d')]=function(_0x2b72f3,_0x399ef3){var _0x40d875={};var _0x4a4bfa={'count':0x0,'rows':[]};var _0x4c2d49=_[_0x63ab('0x1e')](db[_0x63ab('0x1f')][_0x63ab('0x20')],function(_0x294756){return{'name':_0x294756[_0x63ab('0x21')],'type':_0x294756[_0x63ab('0x22')][_0x63ab('0x23')]};});_0x40d875=qs[_0x63ab('0x24')](_0x4c2d49,_0x2b72f3);var _0x5a4a97={'where':_0x40d875[_0x63ab('0x25')]};return db[_0x63ab('0x1f')][_0x63ab('0x11')](_0x5a4a97)[_0x63ab('0x16')](function(_0x48a347){_0x4a4bfa[_0x63ab('0x11')]=_0x48a347;_0x40d875[_0x63ab('0x26')]=qs[_0x63ab('0x26')](_0x2b72f3['query']);return db[_0x63ab('0x1f')][_0x63ab('0x27')](_0x40d875);})[_0x63ab('0x16')](function(_0x4e6c8f){_0x4a4bfa[_0x63ab('0x28')]=_0x4e6c8f;return _0x4a4bfa;})[_0x63ab('0x16')](respondWithFilteredResult(_0x399ef3,_0x40d875))[_0x63ab('0x29')](handleError(_0x399ef3,null));};exports[_0x63ab('0x2a')]=function(_0x56ca58,_0x373240){var _0x122960={'raw':!![],'where':{'id':_0x56ca58[_0x63ab('0x2b')]['id']}},_0x5b561f={};_0x5b561f[_0x63ab('0x2c')]=_[_0x63ab('0x2d')](db['WhatsappQueue'][_0x63ab('0x20')]);_0x5b561f['query']=_['keys'](_0x56ca58[_0x63ab('0x2e')]);_0x5b561f[_0x63ab('0x2f')]=_['intersection'](_0x5b561f[_0x63ab('0x2c')],_0x5b561f[_0x63ab('0x2e')]);_0x122960[_0x63ab('0x30')]=_['intersection'](_0x5b561f[_0x63ab('0x2c')],qs['fields'](_0x56ca58['query'][_0x63ab('0x31')]));_0x122960['attributes']=_0x122960[_0x63ab('0x30')][_0x63ab('0x32')]?_0x122960[_0x63ab('0x30')]:_0x5b561f[_0x63ab('0x2c')];if(_0x56ca58[_0x63ab('0x2e')]['includeAll']){_0x122960[_0x63ab('0x26')]=[{'all':!![]}];}_0x122960=_[_0x63ab('0x33')]({},_0x122960,_0x56ca58[_0x63ab('0x34')]);return db[_0x63ab('0x1f')][_0x63ab('0x35')](_0x122960)[_0x63ab('0x16')](handleEntityNotFound(_0x373240,null))[_0x63ab('0x16')](respondWithResult(_0x373240,null))[_0x63ab('0x29')](handleError(_0x373240,null));};exports[_0x63ab('0x36')]=function(_0x4b9135,_0x223b25){return db[_0x63ab('0x1f')][_0x63ab('0x36')](_0x4b9135[_0x63ab('0x37')],{})['then'](function(_0x414c1f){var _0x4b4929=_0x4b9135[_0x63ab('0x38')][_0x63ab('0x17')]({'plain':!![]});if(!_0x4b4929)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b4929['role']===_0x63ab('0x38')){var _0x116d00=_0x414c1f['get']({'plain':!![]});var _0x2ad522=_0x63ab('0x39');return db['UserProfileSection'][_0x63ab('0x35')]({'where':{'name':_0x2ad522,'userProfileId':_0x4b4929[_0x63ab('0x3a')]},'raw':!![]})['then'](function(_0x15d7c2){if(_0x15d7c2&&_0x15d7c2['autoAssociation']===0x0){return db['UserProfileResource'][_0x63ab('0x36')]({'name':_0x116d00['name'],'resourceId':_0x116d00['id'],'type':_0x15d7c2[_0x63ab('0x1b')],'sectionId':_0x15d7c2['id']},{})['then'](function(){return _0x414c1f;});}else{return _0x414c1f;}})['catch'](function(_0x5b2727){logger['error'](_0x63ab('0x3b'),_0x5b2727);throw _0x5b2727;});}return _0x414c1f;})['then'](respondWithResult(_0x223b25,0xc9))[_0x63ab('0x29')](handleError(_0x223b25,null));};exports[_0x63ab('0x14')]=function(_0x23b40b,_0x112ab1){if(_0x23b40b[_0x63ab('0x37')]['id']){delete _0x23b40b[_0x63ab('0x37')]['id'];}return db[_0x63ab('0x1f')][_0x63ab('0x35')]({'where':{'id':_0x23b40b[_0x63ab('0x2b')]['id']}})['then'](handleEntityNotFound(_0x112ab1,null))['then'](saveUpdates(_0x23b40b[_0x63ab('0x37')],null))[_0x63ab('0x16')](respondWithResult(_0x112ab1,null))['catch'](handleError(_0x112ab1,null));};exports['destroy']=function(_0x90237c,_0x19e96d){return db[_0x63ab('0x1f')][_0x63ab('0x35')]({'where':{'id':_0x90237c[_0x63ab('0x2b')]['id']}})['then'](handleEntityNotFound(_0x19e96d,null))[_0x63ab('0x16')](removeEntity(_0x19e96d,null))[_0x63ab('0x29')](handleError(_0x19e96d,null));};exports[_0x63ab('0x3c')]=function(_0x1b51fa,_0x3f6ee4){return db['WhatsappQueue']['describe']()[_0x63ab('0x16')](respondWithResult(_0x3f6ee4,null))[_0x63ab('0x29')](handleError(_0x3f6ee4,null));};exports[_0x63ab('0x3d')]=function(_0x5a2448,_0x5afebd){var _0x5b4002={'raw':!![],'where':{}},_0x258f79={},_0x47439b;return db[_0x63ab('0x1f')][_0x63ab('0x3e')]({'where':{'id':_0x5a2448[_0x63ab('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5afebd,null))[_0x63ab('0x16')](function(_0x4faf62){if(_0x4faf62){_0x47439b=_0x4faf62[_0x63ab('0x17')]({'plain':!![]});_0x258f79[_0x63ab('0x2c')]=_[_0x63ab('0x2d')](db['UserWhatsappQueue'][_0x63ab('0x20')]);_0x258f79[_0x63ab('0x2e')]=_[_0x63ab('0x2d')](_0x5a2448['query']);_0x258f79['filters']=_['intersection'](_0x258f79[_0x63ab('0x2c')],_0x258f79[_0x63ab('0x2e')]);_0x5b4002[_0x63ab('0x30')]=_['intersection'](_0x258f79[_0x63ab('0x2c')],qs[_0x63ab('0x31')](_0x5a2448['query'][_0x63ab('0x31')]));_0x5b4002['attributes']=_0x5b4002['attributes']['length']?_0x5b4002[_0x63ab('0x30')]:_0x258f79[_0x63ab('0x2c')];if(!_0x5a2448[_0x63ab('0x2e')][_0x63ab('0x3f')](_0x63ab('0x40'))){_0x5b4002[_0x63ab('0x10')]=qs['limit'](_0x5a2448[_0x63ab('0x2e')]['limit']);_0x5b4002['offset']=qs[_0x63ab('0xe')](_0x5a2448[_0x63ab('0x2e')]['offset']);}_0x5b4002['order']=qs['sort'](_0x5a2448['query']['sort']);_0x5b4002[_0x63ab('0x25')]=qs[_0x63ab('0x2f')](_[_0x63ab('0x41')](_0x5a2448[_0x63ab('0x2e')],_0x258f79[_0x63ab('0x2f')]));_0x5b4002['where'][_0x63ab('0x42')]=_0x4faf62['id'];if(_0x5a2448[_0x63ab('0x2e')]['filter']){_0x5b4002['where']=_['merge'](_0x5b4002[_0x63ab('0x25')],{'$or':_['map'](_0x5b4002[_0x63ab('0x30')],function(_0x7c7993){var _0x451a9b={};_0x451a9b[_0x7c7993]={'$like':'%'+_0x5a2448[_0x63ab('0x2e')][_0x63ab('0x43')]+'%'};return _0x451a9b;})});}_0x5b4002=_[_0x63ab('0x33')]({},_0x5b4002,_0x5a2448[_0x63ab('0x34')]);return db[_0x63ab('0x44')][_0x63ab('0x27')](_0x5b4002);}})[_0x63ab('0x16')](function(_0x33d875){if(_0x33d875){return db[_0x63ab('0x45')][_0x63ab('0x46')]({'where':{'id':_[_0x63ab('0x1e')](_0x33d875,_0x63ab('0x47')),'role':_0x63ab('0x48')},'attributes':['id',_0x63ab('0x1b'),_0x63ab('0x49'),_0x63ab('0x4a'),_0x63ab('0x4b')]});}})['then'](function(_0x4c0a6d){if(_0x4c0a6d){return{'count':_0x4c0a6d[_0x63ab('0x11')],'rows':_[_0x63ab('0x1e')](_0x4c0a6d[_0x63ab('0x28')],function(_0x370a3b){return{'membername':_0x370a3b[_0x63ab('0x1b')],'UserId':_0x370a3b['id'],'queue_name':_0x47439b[_0x63ab('0x1b')],'WhatsappQueueId':_0x47439b['id'],'interface':util['format'](_0x63ab('0x4c'),'SIP',_0x370a3b[_0x63ab('0x1b')]),'penalty':0x0,'paused':_0x370a3b['whatsappPause'],'createdAt':_0x370a3b[_0x63ab('0x4b')],'updatedAt':_0x370a3b[_0x63ab('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x63ab('0x16')](respondWithFilteredResult(_0x5afebd,_0x5b4002))[_0x63ab('0x29')](handleError(_0x5afebd,null));};exports[_0x63ab('0x4d')]=function(_0x30f180,_0x5a6a73){var _0x541bcd={};var _0x4cb2ff={};var _0x35ea4c;var _0x2ea090;return db[_0x63ab('0x1f')]['findOne']({'where':{'id':_0x30f180['params']['id']}})[_0x63ab('0x16')](handleEntityNotFound(_0x5a6a73,null))[_0x63ab('0x16')](function(_0x1d2722){if(_0x1d2722){_0x35ea4c=_0x1d2722;_0x4cb2ff['model']=_[_0x63ab('0x2d')](db[_0x63ab('0x4e')][_0x63ab('0x20')]);_0x4cb2ff[_0x63ab('0x2e')]=_[_0x63ab('0x2d')](_0x30f180[_0x63ab('0x2e')]);_0x4cb2ff[_0x63ab('0x2f')]=_[_0x63ab('0x4f')](_0x4cb2ff[_0x63ab('0x2c')],_0x4cb2ff[_0x63ab('0x2e')]);_0x541bcd[_0x63ab('0x30')]=_['intersection'](_0x4cb2ff['model'],qs['fields'](_0x30f180['query'][_0x63ab('0x31')]));_0x541bcd[_0x63ab('0x30')]=_0x541bcd[_0x63ab('0x30')][_0x63ab('0x32')]?_0x541bcd[_0x63ab('0x30')]:_0x4cb2ff[_0x63ab('0x2c')];_0x541bcd[_0x63ab('0x50')]=qs[_0x63ab('0x51')](_0x30f180[_0x63ab('0x2e')][_0x63ab('0x51')]);_0x541bcd[_0x63ab('0x25')]=qs[_0x63ab('0x2f')](_[_0x63ab('0x41')](_0x30f180['query'],_0x4cb2ff[_0x63ab('0x2f')]));if(_0x30f180[_0x63ab('0x2e')]['filter']){_0x541bcd[_0x63ab('0x25')]=_['merge'](_0x541bcd[_0x63ab('0x25')],{'$or':_[_0x63ab('0x1e')](_0x541bcd[_0x63ab('0x30')],function(_0xe5b806){var _0x46e562={};_0x46e562[_0xe5b806]={'$like':'%'+_0x30f180[_0x63ab('0x2e')][_0x63ab('0x43')]+'%'};return _0x46e562;})});}_0x541bcd=_[_0x63ab('0x33')]({},_0x541bcd,_0x30f180[_0x63ab('0x34')]);return _0x35ea4c[_0x63ab('0x4d')](_0x541bcd);}})['then'](function(_0x5aff5a){if(_0x5aff5a){_0x2ea090=_0x5aff5a[_0x63ab('0x32')];if(!_0x30f180[_0x63ab('0x2e')]['hasOwnProperty']('nolimit')){_0x541bcd['limit']=qs[_0x63ab('0x10')](_0x30f180[_0x63ab('0x2e')]['limit']);_0x541bcd[_0x63ab('0xe')]=qs[_0x63ab('0xe')](_0x30f180[_0x63ab('0x2e')][_0x63ab('0xe')]);}return _0x35ea4c[_0x63ab('0x4d')](_0x541bcd);}})[_0x63ab('0x16')](function(_0x1b6ac0){if(_0x1b6ac0){return _0x1b6ac0?{'count':_0x2ea090,'rows':_0x1b6ac0}:null;}})['then'](respondWithResult(_0x5a6a73,null))['catch'](handleError(_0x5a6a73,null));};exports['addTeams']=function(_0x53b990,_0x2fcbaa){var _0x465b86=_0x53b990['body']['ids'];return db['Team'][_0x63ab('0x27')]({'where':{'id':_0x465b86},'attributes':['id'],'include':[{'model':db['User'],'as':_0x63ab('0x52'),'attributes':['id','name',_0x63ab('0x53'),_0x63ab('0x54'),_0x63ab('0x55')],'raw':!![]}]})['then'](function(_0x40fcf1){if(_0x40fcf1){var _0x55f51c=_[_0x63ab('0x56')](_0x40fcf1,function(_0x2964da){var _0x5c89b7=_0x2964da[_0x63ab('0x17')]({'plain':!![]});return _0x5c89b7[_0x63ab('0x52')];});return db[_0x63ab('0x1f')][_0x63ab('0x35')]({'where':{'id':_0x53b990[_0x63ab('0x2b')]['id']}})[_0x63ab('0x16')](function(_0x441f82){return db[_0x63ab('0x57')][_0x63ab('0x58')](function(_0x5acd89){return _0x441f82[_0x63ab('0x59')](_0x465b86,{'transaction':_0x5acd89})[_0x63ab('0x16')](function(){return BPromise['each'](_0x55f51c,function(_0x3f8f86){return db[_0x63ab('0x44')][_0x63ab('0x5a')]({'where':{'UserId':_0x3f8f86['id'],'WhatsappQueueId':_0x53b990['params']['id']},'transaction':_0x5acd89});});})[_0x63ab('0x16')](function(){_0x55f51c[_0x63ab('0x5b')](function(_0x2d5c61){socket[_0x63ab('0x5c')](_0x63ab('0x5d'),{'UserId':_0x2d5c61['id'],'WhatsappQueueId':_0x441f82['id']});});});});});}})['then'](respondWithStatusCode(_0x2fcbaa,null))[_0x63ab('0x29')](handleError(_0x2fcbaa,null));};exports['removeTeams']=function(_0x2f9a7f,_0x249faa){return db[_0x63ab('0x4e')][_0x63ab('0x27')]({'where':{'id':_0x2f9a7f[_0x63ab('0x2e')][_0x63ab('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x63ab('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x249faa,null))[_0x63ab('0x16')](function(_0x5b1c6f){var _0x5d80a5=_[_0x63ab('0x1e')](_0x5b1c6f,'id');var _0x543843=[];var _0x4f6895=[];var _0x540bf7=squel['select']();_0x540bf7[_0x63ab('0x5f')]('tq.TeamId')[_0x63ab('0x60')]('team_has_whatsapp_queues','tq')[_0x63ab('0x61')](_0x63ab('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x63ab('0x63'),_0x2f9a7f[_0x63ab('0x2b')]['id']);for(var _0x29e3b8=0x0;_0x29e3b8<_0x5b1c6f[_0x63ab('0x32')];_0x29e3b8+=0x1){let _0x250ab2=_0x5b1c6f[_0x29e3b8];for(var _0x4db1b5=0x0;_0x4db1b5<_0x250ab2[_0x63ab('0x52')][_0x63ab('0x32')];_0x4db1b5+=0x1){let _0x4c3d8b=_0x250ab2['Agents'][_0x4db1b5];var _0x5ed2a3=_0x540bf7['clone']();_0x5ed2a3[_0x63ab('0x25')](_0x63ab('0x64'),_0x4c3d8b['id']);_0x4f6895['push'](db[_0x63ab('0x57')][_0x63ab('0x2e')](_0x5ed2a3[_0x63ab('0x65')](),{'type':db[_0x63ab('0x57')]['QueryTypes'][_0x63ab('0x66')]})[_0x63ab('0x16')](function(_0x2e3724){if(_0x2e3724[_0x63ab('0x32')]===0x1){return _0x4c3d8b['id'];}else{var _0x214c3a=_[_0x63ab('0x67')](_[_0x63ab('0x1e')](_0x2e3724,_0x63ab('0x68')),function(_0x3071ad){return _['includes'](_0x5d80a5,_0x3071ad);});if(_0x214c3a){return _0x4c3d8b['id'];}}}));}}return BPromise[_0x63ab('0x69')](_0x4f6895)[_0x63ab('0x16')](function(_0x538b68){_0x543843=_(_0x543843)[_0x63ab('0x6a')](_0x538b68)['compact']()['value']();return db['WhatsappQueue'][_0x63ab('0x35')]({'where':{'id':_0x2f9a7f[_0x63ab('0x2b')]['id']}})[_0x63ab('0x16')](function(_0x39d73d){return db[_0x63ab('0x57')][_0x63ab('0x58')](function(_0x53dc2f){return _0x39d73d[_0x63ab('0x6b')](_0x2f9a7f['query']['ids'],{'transaction':_0x53dc2f})[_0x63ab('0x16')](function(){if(!_[_0x63ab('0x6c')](_0x543843)){return _0x39d73d['removeAgents'](_0x543843,{'transaction':_0x53dc2f});}})[_0x63ab('0x16')](function(){_0x543843[_0x63ab('0x5b')](function(_0x371a13){socket[_0x63ab('0x5c')](_0x63ab('0x6d'),{'UserId':_0x371a13,'WhatsappQueueId':_0x39d73d['id']});});});});});});})['then'](respondWithStatusCode(_0x249faa,null))[_0x63ab('0x29')](handleError(_0x249faa,null));};exports[_0x63ab('0x6e')]=function(_0x258bdc,_0x3633ed){return db[_0x63ab('0x1f')][_0x63ab('0x35')]({'where':{'id':_0x258bdc[_0x63ab('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3633ed,null))['then'](function(_0x5ba18b){if(_0x5ba18b){return _0x5ba18b[_0x63ab('0x6e')](_0x258bdc['body'][_0x63ab('0x5e')],_[_0x63ab('0x6f')](_0x258bdc['body'],[_0x63ab('0x5e'),'id'])||{})[_0x63ab('0x70')](function(_0x525f0c){for(var _0x2a5c7f=0x0;_0x2a5c7f<_0x258bdc['body'][_0x63ab('0x5e')][_0x63ab('0x32')];_0x2a5c7f+=0x1){socket[_0x63ab('0x5c')]('userWhatsappQueue:save',{'UserId':Number(_0x258bdc[_0x63ab('0x37')][_0x63ab('0x5e')][_0x2a5c7f]),'WhatsappQueueId':Number(_0x258bdc[_0x63ab('0x2b')]['id'])});}return _0x525f0c;});}})[_0x63ab('0x16')](respondWithResult(_0x3633ed,null))[_0x63ab('0x29')](handleError(_0x3633ed,null));};exports[_0x63ab('0x71')]=function(_0x10b6f8,_0x2600ed){return db[_0x63ab('0x1f')]['find']({'where':{'id':_0x10b6f8['params']['id']}})['then'](handleEntityNotFound(_0x2600ed,null))[_0x63ab('0x16')](function(_0x3e528a){if(_0x3e528a){return _0x3e528a[_0x63ab('0x71')](_0x10b6f8[_0x63ab('0x2e')]['ids'])['then'](function(){if(_[_0x63ab('0x72')](_0x10b6f8['query']['ids'])){for(var _0xdaf00a=0x0;_0xdaf00a<_0x10b6f8[_0x63ab('0x2e')][_0x63ab('0x5e')][_0x63ab('0x32')];_0xdaf00a+=0x1){socket[_0x63ab('0x5c')](_0x63ab('0x6d'),{'UserId':Number(_0x10b6f8[_0x63ab('0x2e')][_0x63ab('0x5e')][_0xdaf00a]),'WhatsappQueueId':Number(_0x10b6f8[_0x63ab('0x2b')]['id'])});}}else{socket[_0x63ab('0x5c')]('userWhatsappQueue:remove',{'UserId':Number(_0x10b6f8[_0x63ab('0x2e')][_0x63ab('0x5e')]),'WhatsappQueueId':Number(_0x10b6f8[_0x63ab('0x2b')]['id'])});}});}})[_0x63ab('0x16')](respondWithStatusCode(_0x2600ed,null))[_0x63ab('0x29')](handleError(_0x2600ed,null));};exports['getAgents']=function(_0xa8217f,_0x5bd936){var _0xbf226d={};var _0xa1c6c1={};var _0x337f15;var _0x7e2c10;return db[_0x63ab('0x1f')]['findOne']({'where':{'id':_0xa8217f['params']['id']}})[_0x63ab('0x16')](handleEntityNotFound(_0x5bd936,null))['then'](function(_0x1248e0){if(_0x1248e0){_0x337f15=_0x1248e0;_0xa1c6c1[_0x63ab('0x2c')]=_[_0x63ab('0x2d')](db[_0x63ab('0x45')]['rawAttributes']);_0xa1c6c1[_0x63ab('0x2e')]=_[_0x63ab('0x2d')](_0xa8217f['query']);_0xa1c6c1[_0x63ab('0x2f')]=_[_0x63ab('0x4f')](_0xa1c6c1['model'],_0xa1c6c1[_0x63ab('0x2e')]);_0xbf226d[_0x63ab('0x30')]=_[_0x63ab('0x4f')](_0xa1c6c1['model'],qs['fields'](_0xa8217f[_0x63ab('0x2e')][_0x63ab('0x31')]));_0xbf226d['attributes']=_0xbf226d[_0x63ab('0x30')][_0x63ab('0x32')]?_0xbf226d[_0x63ab('0x30')]:_0xa1c6c1[_0x63ab('0x2c')];_0xbf226d[_0x63ab('0x50')]=qs[_0x63ab('0x51')](_0xa8217f['query'][_0x63ab('0x51')]);_0xbf226d[_0x63ab('0x25')]=qs[_0x63ab('0x2f')](_['pick'](_0xa8217f[_0x63ab('0x2e')],_0xa1c6c1[_0x63ab('0x2f')]));if(_0xa8217f[_0x63ab('0x2e')][_0x63ab('0x43')]){_0xbf226d['where']=_[_0x63ab('0x33')](_0xbf226d[_0x63ab('0x25')],{'$or':_[_0x63ab('0x1e')](_0xbf226d['attributes'],function(_0x38bd73){var _0x5f306b={};_0x5f306b[_0x38bd73]={'$like':'%'+_0xa8217f['query']['filter']+'%'};return _0x5f306b;})});}_0xbf226d=_[_0x63ab('0x33')]({},_0xbf226d,_0xa8217f[_0x63ab('0x34')]);return _0x337f15[_0x63ab('0x73')](_0xbf226d);}})['then'](function(_0xce78df){if(_0xce78df){_0x7e2c10=_0xce78df[_0x63ab('0x32')];if(!_0xa8217f[_0x63ab('0x2e')][_0x63ab('0x3f')](_0x63ab('0x40'))){_0xbf226d[_0x63ab('0x10')]=qs[_0x63ab('0x10')](_0xa8217f[_0x63ab('0x2e')][_0x63ab('0x10')]);_0xbf226d[_0x63ab('0xe')]=qs[_0x63ab('0xe')](_0xa8217f[_0x63ab('0x2e')][_0x63ab('0xe')]);}return _0x337f15[_0x63ab('0x73')](_0xbf226d);}})[_0x63ab('0x16')](function(_0x1822ed){if(_0x1822ed){return _0x1822ed?{'count':_0x7e2c10,'rows':_0x1822ed}:null;}})[_0x63ab('0x16')](respondWithResult(_0x5bd936,null))[_0x63ab('0x29')](handleError(_0x5bd936,null));}; \ No newline at end of file +var _0x9aba=['addAgents','omit','userWhatsappQueue:remove','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','get','WhatsappQueues','destroy','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','filter','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','whatsappPause','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x9aba,0xf8));var _0xa9ab=function(_0x2d777c,_0x321c1f){_0x2d777c=_0x2d777c-0x0;var _0x44d238=_0x9aba[_0x2d777c];return _0x44d238;};'use strict';var BPromise=require(_0xa9ab('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xa9ab('0x1'));var Redis=require(_0xa9ab('0x2'));var qs=require(_0xa9ab('0x3'));var logger=require(_0xa9ab('0x4'))(_0xa9ab('0x5'));var config=require(_0xa9ab('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa9ab('0x7')](config[_0xa9ab('0x8')],{'host':_0xa9ab('0x9'),'port':0x18eb});var socket=require(_0xa9ab('0xa'))(new Redis(config[_0xa9ab('0x8')]));require('./whatsappQueue.socket')[_0xa9ab('0xb')](socket);function respondWithStatusCode(_0x5b27bc,_0x502111){_0x502111=_0x502111||0xcc;return function(_0x33b064){if(_0x33b064){return _0x5b27bc[_0xa9ab('0xc')](_0x502111);}return _0x5b27bc[_0xa9ab('0xd')](_0x502111)['end']();};}function respondWithResult(_0x5c3e71,_0x261c21){_0x261c21=_0x261c21||0xc8;return function(_0x283c35){if(_0x283c35){return _0x5c3e71['status'](_0x261c21)['json'](_0x283c35);}};}function respondWithFilteredResult(_0x1a0d26,_0x28e728){return function(_0x3ff50a){if(_0x3ff50a){var _0x48c094=typeof _0x28e728[_0xa9ab('0xe')]===_0xa9ab('0xf')&&typeof _0x28e728[_0xa9ab('0x10')]===_0xa9ab('0xf');var _0x1e0564=_0x3ff50a[_0xa9ab('0x11')];var _0x1d9660=_0x48c094?0x0:_0x28e728[_0xa9ab('0xe')];var _0x28c044=_0x48c094?_0x3ff50a['count']:_0x28e728[_0xa9ab('0xe')]+_0x28e728[_0xa9ab('0x10')];var _0x5a9bcc;if(_0x28c044>=_0x1e0564){_0x28c044=_0x1e0564;_0x5a9bcc=0xc8;}else{_0x5a9bcc=0xce;}_0x1a0d26[_0xa9ab('0xd')](_0x5a9bcc);return _0x1a0d26[_0xa9ab('0x12')](_0xa9ab('0x13'),_0x1d9660+'-'+_0x28c044+'/'+_0x1e0564)[_0xa9ab('0x14')](_0x3ff50a);}return null;};}function saveUpdates(_0x2ae035){return function(_0x3a5c7e){if(_0x3a5c7e){return _0x3a5c7e['update'](_0x2ae035)[_0xa9ab('0x15')](function(_0x2db314){return _0x2db314;});}return null;};}function removeEntity(_0x6a8dad){return function(_0x2b52d4){if(_0x2b52d4){return _0x2b52d4['destroy']()[_0xa9ab('0x15')](function(){var _0x2e7dd4=_0x2b52d4[_0xa9ab('0x16')]({'plain':!![]});var _0x2e176b=_0xa9ab('0x17');return db['UserProfileResource'][_0xa9ab('0x18')]({'where':{'type':_0x2e176b,'resourceId':_0x2e7dd4['id']}})[_0xa9ab('0x15')](function(){return _0x2b52d4;});})[_0xa9ab('0x15')](function(){_0x6a8dad[_0xa9ab('0xd')](0xcc)[_0xa9ab('0x19')]();});}};}function handleEntityNotFound(_0x4eaf8d){return function(_0x4dee42){if(!_0x4dee42){_0x4eaf8d[_0xa9ab('0xc')](0x194);}return _0x4dee42;};}function handleError(_0x353a8a,_0x13cd30){_0x13cd30=_0x13cd30||0x1f4;return function(_0x431532){logger[_0xa9ab('0x1a')](_0x431532[_0xa9ab('0x1b')]);if(_0x431532[_0xa9ab('0x1c')]){delete _0x431532[_0xa9ab('0x1c')];}_0x353a8a['status'](_0x13cd30)[_0xa9ab('0x1d')](_0x431532);};}exports[_0xa9ab('0x1e')]=function(_0x5af390,_0xa3df99){var _0x5b24ea={};var _0x1c3f5c={'count':0x0,'rows':[]};var _0x2b5ef7=_[_0xa9ab('0x1f')](db[_0xa9ab('0x20')][_0xa9ab('0x21')],function(_0x37ee5e){return{'name':_0x37ee5e[_0xa9ab('0x22')],'type':_0x37ee5e[_0xa9ab('0x23')][_0xa9ab('0x24')]};});_0x5b24ea=qs['getOptions'](_0x2b5ef7,_0x5af390);var _0x16761b={'where':_0x5b24ea[_0xa9ab('0x25')]};return db[_0xa9ab('0x20')][_0xa9ab('0x11')](_0x16761b)[_0xa9ab('0x15')](function(_0x23cb54){_0x1c3f5c['count']=_0x23cb54;_0x5b24ea[_0xa9ab('0x26')]=qs['include'](_0x5af390[_0xa9ab('0x27')]);return db[_0xa9ab('0x20')][_0xa9ab('0x28')](_0x5b24ea);})[_0xa9ab('0x15')](function(_0x41bdef){_0x1c3f5c[_0xa9ab('0x29')]=_0x41bdef;return _0x1c3f5c;})[_0xa9ab('0x15')](respondWithFilteredResult(_0xa3df99,_0x5b24ea))[_0xa9ab('0x2a')](handleError(_0xa3df99,null));};exports[_0xa9ab('0x2b')]=function(_0x594c84,_0x1da95a){var _0x2b6f71={'raw':!![],'where':{'id':_0x594c84[_0xa9ab('0x2c')]['id']}},_0x15a2bb={};_0x15a2bb[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x20')][_0xa9ab('0x21')]);_0x15a2bb[_0xa9ab('0x27')]=_[_0xa9ab('0x2e')](_0x594c84[_0xa9ab('0x27')]);_0x15a2bb[_0xa9ab('0x2f')]=_['intersection'](_0x15a2bb['model'],_0x15a2bb['query']);_0x2b6f71[_0xa9ab('0x30')]=_[_0xa9ab('0x31')](_0x15a2bb['model'],qs[_0xa9ab('0x32')](_0x594c84['query'][_0xa9ab('0x32')]));_0x2b6f71[_0xa9ab('0x30')]=_0x2b6f71['attributes'][_0xa9ab('0x33')]?_0x2b6f71[_0xa9ab('0x30')]:_0x15a2bb[_0xa9ab('0x2d')];if(_0x594c84[_0xa9ab('0x27')][_0xa9ab('0x34')]){_0x2b6f71[_0xa9ab('0x26')]=[{'all':!![]}];}_0x2b6f71=_[_0xa9ab('0x35')]({},_0x2b6f71,_0x594c84['options']);return db[_0xa9ab('0x20')][_0xa9ab('0x36')](_0x2b6f71)[_0xa9ab('0x15')](handleEntityNotFound(_0x1da95a,null))['then'](respondWithResult(_0x1da95a,null))['catch'](handleError(_0x1da95a,null));};exports[_0xa9ab('0x37')]=function(_0x260bc8,_0x4c7a1a){return db[_0xa9ab('0x20')][_0xa9ab('0x37')](_0x260bc8[_0xa9ab('0x38')],{})[_0xa9ab('0x15')](function(_0x23766d){var _0x53c34b=_0x260bc8[_0xa9ab('0x39')][_0xa9ab('0x16')]({'plain':!![]});if(!_0x53c34b)throw new Error(_0xa9ab('0x3a'));if(_0x53c34b['role']===_0xa9ab('0x39')){var _0x9c3edc=_0x23766d[_0xa9ab('0x16')]({'plain':!![]});var _0x49bc65=_0xa9ab('0x17');return db[_0xa9ab('0x3b')][_0xa9ab('0x36')]({'where':{'name':_0x49bc65,'userProfileId':_0x53c34b[_0xa9ab('0x3c')]},'raw':!![]})['then'](function(_0x304af5){if(_0x304af5&&_0x304af5['autoAssociation']===0x0){return db[_0xa9ab('0x3d')][_0xa9ab('0x37')]({'name':_0x9c3edc[_0xa9ab('0x1c')],'resourceId':_0x9c3edc['id'],'type':_0x304af5[_0xa9ab('0x1c')],'sectionId':_0x304af5['id']},{})['then'](function(){return _0x23766d;});}else{return _0x23766d;}})[_0xa9ab('0x2a')](function(_0x558705){logger[_0xa9ab('0x1a')](_0xa9ab('0x3e'),_0x558705);throw _0x558705;});}return _0x23766d;})['then'](respondWithResult(_0x4c7a1a,0xc9))[_0xa9ab('0x2a')](handleError(_0x4c7a1a,null));};exports[_0xa9ab('0x3f')]=function(_0x78d834,_0xb97579){if(_0x78d834[_0xa9ab('0x38')]['id']){delete _0x78d834[_0xa9ab('0x38')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x78d834[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xb97579,null))[_0xa9ab('0x15')](saveUpdates(_0x78d834[_0xa9ab('0x38')],null))[_0xa9ab('0x15')](respondWithResult(_0xb97579,null))['catch'](handleError(_0xb97579,null));};exports[_0xa9ab('0x18')]=function(_0x3cb2df,_0xb55479){return db['WhatsappQueue'][_0xa9ab('0x36')]({'where':{'id':_0x3cb2df[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xb55479,null))[_0xa9ab('0x15')](removeEntity(_0xb55479,null))[_0xa9ab('0x2a')](handleError(_0xb55479,null));};exports[_0xa9ab('0x40')]=function(_0x235e39,_0x1d2b95){return db[_0xa9ab('0x20')][_0xa9ab('0x40')]()[_0xa9ab('0x15')](respondWithResult(_0x1d2b95,null))[_0xa9ab('0x2a')](handleError(_0x1d2b95,null));};exports[_0xa9ab('0x41')]=function(_0x294c8d,_0xe02981){var _0x47dbf4={'raw':!![],'where':{}},_0x425b2d={},_0x8c2199;return db['WhatsappQueue'][_0xa9ab('0x42')]({'where':{'id':_0x294c8d[_0xa9ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0xe02981,null))[_0xa9ab('0x15')](function(_0x1516b9){if(_0x1516b9){_0x8c2199=_0x1516b9[_0xa9ab('0x16')]({'plain':!![]});_0x425b2d[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x43')][_0xa9ab('0x21')]);_0x425b2d['query']=_[_0xa9ab('0x2e')](_0x294c8d[_0xa9ab('0x27')]);_0x425b2d[_0xa9ab('0x2f')]=_['intersection'](_0x425b2d[_0xa9ab('0x2d')],_0x425b2d['query']);_0x47dbf4[_0xa9ab('0x30')]=_[_0xa9ab('0x31')](_0x425b2d[_0xa9ab('0x2d')],qs['fields'](_0x294c8d['query'][_0xa9ab('0x32')]));_0x47dbf4[_0xa9ab('0x30')]=_0x47dbf4[_0xa9ab('0x30')][_0xa9ab('0x33')]?_0x47dbf4[_0xa9ab('0x30')]:_0x425b2d[_0xa9ab('0x2d')];if(!_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x44')](_0xa9ab('0x45'))){_0x47dbf4[_0xa9ab('0x10')]=qs['limit'](_0x294c8d['query'][_0xa9ab('0x10')]);_0x47dbf4[_0xa9ab('0xe')]=qs[_0xa9ab('0xe')](_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0xe')]);}_0x47dbf4[_0xa9ab('0x46')]=qs['sort'](_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x47')]);_0x47dbf4[_0xa9ab('0x25')]=qs['filters'](_[_0xa9ab('0x48')](_0x294c8d[_0xa9ab('0x27')],_0x425b2d[_0xa9ab('0x2f')]));_0x47dbf4[_0xa9ab('0x25')]['WhatsappQueueId']=_0x1516b9['id'];if(_0x294c8d[_0xa9ab('0x27')]['filter']){_0x47dbf4[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x47dbf4['where'],{'$or':_[_0xa9ab('0x1f')](_0x47dbf4[_0xa9ab('0x30')],function(_0x199651){var _0x326c25={};_0x326c25[_0x199651]={'$like':'%'+_0x294c8d[_0xa9ab('0x27')][_0xa9ab('0x49')]+'%'};return _0x326c25;})});}_0x47dbf4=_[_0xa9ab('0x35')]({},_0x47dbf4,_0x294c8d[_0xa9ab('0x4a')]);return db[_0xa9ab('0x43')]['findAll'](_0x47dbf4);}})[_0xa9ab('0x15')](function(_0x55016f){if(_0x55016f){return db[_0xa9ab('0x4b')][_0xa9ab('0x4c')]({'where':{'id':_[_0xa9ab('0x1f')](_0x55016f,_0xa9ab('0x4d')),'role':_0xa9ab('0x4e')},'attributes':['id','name','whatsappPause',_0xa9ab('0x4f'),_0xa9ab('0x50')]});}})[_0xa9ab('0x15')](function(_0x2f36e8){if(_0x2f36e8){return{'count':_0x2f36e8['count'],'rows':_[_0xa9ab('0x1f')](_0x2f36e8[_0xa9ab('0x29')],function(_0x28967d){return{'membername':_0x28967d['name'],'UserId':_0x28967d['id'],'queue_name':_0x8c2199[_0xa9ab('0x1c')],'WhatsappQueueId':_0x8c2199['id'],'interface':util[_0xa9ab('0x51')](_0xa9ab('0x52'),'SIP',_0x28967d[_0xa9ab('0x1c')]),'penalty':0x0,'paused':_0x28967d[_0xa9ab('0x53')],'createdAt':_0x28967d[_0xa9ab('0x50')],'updatedAt':_0x28967d[_0xa9ab('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe02981,_0x47dbf4))['catch'](handleError(_0xe02981,null));};exports['getTeams']=function(_0x59a38f,_0x4e9521){var _0x3daef0={};var _0x200423={};var _0x4c7fa7;var _0x1f4751;return db['WhatsappQueue'][_0xa9ab('0x42')]({'where':{'id':_0x59a38f[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0x4e9521,null))[_0xa9ab('0x15')](function(_0x55d512){if(_0x55d512){_0x4c7fa7=_0x55d512;_0x200423[_0xa9ab('0x2d')]=_['keys'](db[_0xa9ab('0x54')][_0xa9ab('0x21')]);_0x200423['query']=_[_0xa9ab('0x2e')](_0x59a38f[_0xa9ab('0x27')]);_0x200423[_0xa9ab('0x2f')]=_['intersection'](_0x200423[_0xa9ab('0x2d')],_0x200423[_0xa9ab('0x27')]);_0x3daef0[_0xa9ab('0x30')]=_['intersection'](_0x200423[_0xa9ab('0x2d')],qs[_0xa9ab('0x32')](_0x59a38f[_0xa9ab('0x27')][_0xa9ab('0x32')]));_0x3daef0[_0xa9ab('0x30')]=_0x3daef0[_0xa9ab('0x30')][_0xa9ab('0x33')]?_0x3daef0[_0xa9ab('0x30')]:_0x200423[_0xa9ab('0x2d')];_0x3daef0[_0xa9ab('0x46')]=qs[_0xa9ab('0x47')](_0x59a38f[_0xa9ab('0x27')]['sort']);_0x3daef0[_0xa9ab('0x25')]=qs[_0xa9ab('0x2f')](_[_0xa9ab('0x48')](_0x59a38f[_0xa9ab('0x27')],_0x200423[_0xa9ab('0x2f')]));if(_0x59a38f[_0xa9ab('0x27')][_0xa9ab('0x49')]){_0x3daef0[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x3daef0[_0xa9ab('0x25')],{'$or':_[_0xa9ab('0x1f')](_0x3daef0[_0xa9ab('0x30')],function(_0x330869){var _0xc619a4={};_0xc619a4[_0x330869]={'$like':'%'+_0x59a38f[_0xa9ab('0x27')]['filter']+'%'};return _0xc619a4;})});}_0x3daef0=_[_0xa9ab('0x35')]({},_0x3daef0,_0x59a38f[_0xa9ab('0x4a')]);return _0x4c7fa7[_0xa9ab('0x55')](_0x3daef0);}})[_0xa9ab('0x15')](function(_0x15fa6d){if(_0x15fa6d){_0x1f4751=_0x15fa6d[_0xa9ab('0x33')];if(!_0x59a38f[_0xa9ab('0x27')]['hasOwnProperty'](_0xa9ab('0x45'))){_0x3daef0[_0xa9ab('0x10')]=qs[_0xa9ab('0x10')](_0x59a38f[_0xa9ab('0x27')]['limit']);_0x3daef0[_0xa9ab('0xe')]=qs[_0xa9ab('0xe')](_0x59a38f['query'][_0xa9ab('0xe')]);}return _0x4c7fa7[_0xa9ab('0x55')](_0x3daef0);}})[_0xa9ab('0x15')](function(_0x2712bd){if(_0x2712bd){return _0x2712bd?{'count':_0x1f4751,'rows':_0x2712bd}:null;}})[_0xa9ab('0x15')](respondWithResult(_0x4e9521,null))['catch'](handleError(_0x4e9521,null));};exports['addTeams']=function(_0x5a0b1e,_0x2a16b3){var _0x54bdfb=_0x5a0b1e[_0xa9ab('0x38')][_0xa9ab('0x56')];return db[_0xa9ab('0x54')][_0xa9ab('0x28')]({'where':{'id':_0x54bdfb},'attributes':['id'],'include':[{'model':db[_0xa9ab('0x4b')],'as':_0xa9ab('0x57'),'attributes':['id','name',_0xa9ab('0x58'),_0xa9ab('0x59'),_0xa9ab('0x5a')],'raw':!![]}]})['then'](function(_0x469122){if(_0x469122){var _0x3f10c2=_[_0xa9ab('0x5b')](_0x469122,function(_0x277a84){var _0xca05cf=_0x277a84[_0xa9ab('0x16')]({'plain':!![]});return _0xca05cf[_0xa9ab('0x57')];});return db[_0xa9ab('0x20')][_0xa9ab('0x36')]({'where':{'id':_0x5a0b1e['params']['id']}})[_0xa9ab('0x15')](function(_0x2ca55e){return db[_0xa9ab('0x5c')]['transaction'](function(_0x5a88bc){return _0x2ca55e[_0xa9ab('0x5d')](_0x54bdfb,{'transaction':_0x5a88bc})['then'](function(){return BPromise['each'](_0x3f10c2,function(_0x14c9b7){return db[_0xa9ab('0x43')][_0xa9ab('0x5e')]({'where':{'UserId':_0x14c9b7['id'],'WhatsappQueueId':_0x5a0b1e['params']['id']},'transaction':_0x5a88bc});});})['then'](function(){_0x3f10c2[_0xa9ab('0x5f')](function(_0x66561b){socket[_0xa9ab('0x60')](_0xa9ab('0x61'),{'UserId':_0x66561b['id'],'WhatsappQueueId':_0x2ca55e['id']});});});});});}})[_0xa9ab('0x15')](respondWithStatusCode(_0x2a16b3,null))[_0xa9ab('0x2a')](handleError(_0x2a16b3,null));};exports[_0xa9ab('0x62')]=function(_0x8299fd,_0x178223){return db['Team'][_0xa9ab('0x28')]({'where':{'id':_0x8299fd[_0xa9ab('0x27')][_0xa9ab('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa9ab('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa9ab('0x15')](handleEntityNotFound(_0x178223,null))[_0xa9ab('0x15')](function(_0x169aec){var _0x3f1dda=_[_0xa9ab('0x1f')](_0x169aec,'id');var _0xb35249=[];var _0x405ac2=[];var _0x3c4abf=squel['select']();_0x3c4abf[_0xa9ab('0x63')](_0xa9ab('0x64'))[_0xa9ab('0x65')]('team_has_whatsapp_queues','tq')[_0xa9ab('0x66')](_0xa9ab('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa9ab('0x25')]('WhatsappQueueId\x20=\x20?',_0x8299fd[_0xa9ab('0x2c')]['id']);for(var _0x13bdb6=0x0;_0x13bdb6<_0x169aec[_0xa9ab('0x33')];_0x13bdb6+=0x1){let _0x10cbf8=_0x169aec[_0x13bdb6];for(var _0x7b175d=0x0;_0x7b175d<_0x10cbf8[_0xa9ab('0x57')][_0xa9ab('0x33')];_0x7b175d+=0x1){let _0x147172=_0x10cbf8['Agents'][_0x7b175d];var _0x187dc2=_0x3c4abf[_0xa9ab('0x68')]();_0x187dc2[_0xa9ab('0x25')]('ut.UserId\x20=\x20?',_0x147172['id']);_0x405ac2[_0xa9ab('0x69')](db[_0xa9ab('0x5c')][_0xa9ab('0x27')](_0x187dc2[_0xa9ab('0x6a')](),{'type':db[_0xa9ab('0x5c')][_0xa9ab('0x6b')][_0xa9ab('0x6c')]})['then'](function(_0x37560d){if(_0x37560d['length']===0x1){return _0x147172['id'];}else{var _0x41e1f4=_[_0xa9ab('0x6d')](_['map'](_0x37560d,_0xa9ab('0x6e')),function(_0x51b560){return _[_0xa9ab('0x6f')](_0x3f1dda,_0x51b560);});if(_0x41e1f4){return _0x147172['id'];}}}));}}return BPromise[_0xa9ab('0x70')](_0x405ac2)[_0xa9ab('0x15')](function(_0x31a602){_0xb35249=_(_0xb35249)['union'](_0x31a602)[_0xa9ab('0x71')]()[_0xa9ab('0x72')]();return db['WhatsappQueue'][_0xa9ab('0x36')]({'where':{'id':_0x8299fd[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](function(_0x3f6337){return db[_0xa9ab('0x5c')][_0xa9ab('0x73')](function(_0x153fd4){return _0x3f6337[_0xa9ab('0x62')](_0x8299fd[_0xa9ab('0x27')][_0xa9ab('0x56')],{'transaction':_0x153fd4})[_0xa9ab('0x15')](function(){if(!_[_0xa9ab('0x74')](_0xb35249)){return _0x3f6337[_0xa9ab('0x75')](_0xb35249,{'transaction':_0x153fd4});}})[_0xa9ab('0x15')](function(){_0xb35249[_0xa9ab('0x5f')](function(_0x5741d4){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x5741d4,'WhatsappQueueId':_0x3f6337['id']});});});});});});})[_0xa9ab('0x15')](respondWithStatusCode(_0x178223,null))['catch'](handleError(_0x178223,null));};exports[_0xa9ab('0x76')]=function(_0x396eae,_0xf9c14){return db[_0xa9ab('0x20')]['find']({'where':{'id':_0x396eae[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0xf9c14,null))[_0xa9ab('0x15')](function(_0x4e303d){if(_0x4e303d){return _0x4e303d[_0xa9ab('0x76')](_0x396eae['body']['ids'],_[_0xa9ab('0x77')](_0x396eae['body'],[_0xa9ab('0x56'),'id'])||{})['spread'](function(_0x1118db){for(var _0x1b49f4=0x0;_0x1b49f4<_0x396eae[_0xa9ab('0x38')][_0xa9ab('0x56')][_0xa9ab('0x33')];_0x1b49f4+=0x1){socket[_0xa9ab('0x60')](_0xa9ab('0x61'),{'UserId':Number(_0x396eae[_0xa9ab('0x38')][_0xa9ab('0x56')][_0x1b49f4]),'WhatsappQueueId':Number(_0x396eae[_0xa9ab('0x2c')]['id'])});}return _0x1118db;});}})[_0xa9ab('0x15')](respondWithResult(_0xf9c14,null))[_0xa9ab('0x2a')](handleError(_0xf9c14,null));};exports[_0xa9ab('0x75')]=function(_0x545923,_0x1cb09e){return db[_0xa9ab('0x20')][_0xa9ab('0x36')]({'where':{'id':_0x545923[_0xa9ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1cb09e,null))[_0xa9ab('0x15')](function(_0x23062f){if(_0x23062f){return _0x23062f['removeAgents'](_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')])[_0xa9ab('0x15')](function(){if(_['isArray'](_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')])){for(var _0xf2bed2=0x0;_0xf2bed2<_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')]['length'];_0xf2bed2+=0x1){socket[_0xa9ab('0x60')](_0xa9ab('0x78'),{'UserId':Number(_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')][_0xf2bed2]),'WhatsappQueueId':Number(_0x545923[_0xa9ab('0x2c')]['id'])});}}else{socket[_0xa9ab('0x60')](_0xa9ab('0x78'),{'UserId':Number(_0x545923[_0xa9ab('0x27')][_0xa9ab('0x56')]),'WhatsappQueueId':Number(_0x545923[_0xa9ab('0x2c')]['id'])});}});}})[_0xa9ab('0x15')](respondWithStatusCode(_0x1cb09e,null))['catch'](handleError(_0x1cb09e,null));};exports[_0xa9ab('0x79')]=function(_0x1b222d,_0x572490){var _0x5d2699={};var _0x2aba34={};var _0x59093e;var _0x1f6cbc;return db[_0xa9ab('0x20')][_0xa9ab('0x42')]({'where':{'id':_0x1b222d[_0xa9ab('0x2c')]['id']}})[_0xa9ab('0x15')](handleEntityNotFound(_0x572490,null))[_0xa9ab('0x15')](function(_0x3b0a6e){if(_0x3b0a6e){_0x59093e=_0x3b0a6e;_0x2aba34[_0xa9ab('0x2d')]=_[_0xa9ab('0x2e')](db[_0xa9ab('0x4b')]['rawAttributes']);_0x2aba34[_0xa9ab('0x27')]=_[_0xa9ab('0x2e')](_0x1b222d['query']);_0x2aba34['filters']=_[_0xa9ab('0x31')](_0x2aba34['model'],_0x2aba34['query']);_0x5d2699[_0xa9ab('0x30')]=_['intersection'](_0x2aba34[_0xa9ab('0x2d')],qs[_0xa9ab('0x32')](_0x1b222d['query'][_0xa9ab('0x32')]));_0x5d2699[_0xa9ab('0x30')]=_0x5d2699[_0xa9ab('0x30')]['length']?_0x5d2699[_0xa9ab('0x30')]:_0x2aba34[_0xa9ab('0x2d')];_0x5d2699[_0xa9ab('0x46')]=qs[_0xa9ab('0x47')](_0x1b222d[_0xa9ab('0x27')][_0xa9ab('0x47')]);_0x5d2699[_0xa9ab('0x25')]=qs[_0xa9ab('0x2f')](_[_0xa9ab('0x48')](_0x1b222d[_0xa9ab('0x27')],_0x2aba34[_0xa9ab('0x2f')]));if(_0x1b222d[_0xa9ab('0x27')]['filter']){_0x5d2699[_0xa9ab('0x25')]=_[_0xa9ab('0x35')](_0x5d2699[_0xa9ab('0x25')],{'$or':_[_0xa9ab('0x1f')](_0x5d2699[_0xa9ab('0x30')],function(_0x1d9a64){var _0x1194b3={};_0x1194b3[_0x1d9a64]={'$like':'%'+_0x1b222d[_0xa9ab('0x27')]['filter']+'%'};return _0x1194b3;})});}_0x5d2699=_[_0xa9ab('0x35')]({},_0x5d2699,_0x1b222d[_0xa9ab('0x4a')]);return _0x59093e[_0xa9ab('0x79')](_0x5d2699);}})[_0xa9ab('0x15')](function(_0x16d484){if(_0x16d484){_0x1f6cbc=_0x16d484['length'];if(!_0x1b222d['query'][_0xa9ab('0x44')](_0xa9ab('0x45'))){_0x5d2699[_0xa9ab('0x10')]=qs[_0xa9ab('0x10')](_0x1b222d[_0xa9ab('0x27')][_0xa9ab('0x10')]);_0x5d2699[_0xa9ab('0xe')]=qs['offset'](_0x1b222d['query']['offset']);}return _0x59093e[_0xa9ab('0x79')](_0x5d2699);}})[_0xa9ab('0x15')](function(_0x40a6d0){if(_0x40a6d0){return _0x40a6d0?{'count':_0x1f6cbc,'rows':_0x40a6d0}:null;}})['then'](respondWithResult(_0x572490,null))[_0xa9ab('0x2a')](handleError(_0x572490,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2a52c3c..02649f0 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 _0x7632=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit'];(function(_0x460b24,_0xceb132){var _0x5d0a4d=function(_0x306571){while(--_0x306571){_0x460b24['push'](_0x460b24['shift']());}};_0x5d0a4d(++_0xceb132);}(_0x7632,0x157));var _0x2763=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0x7632[_0x8854f2];return _0x38505d;};'use strict';var EventEmitter=require(_0x2763('0x0'));var WhatsappQueue=require(_0x2763('0x1'))['db'][_0x2763('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2763('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2763('0x4'),'afterDestroy':_0x2763('0x5')};function emitEvent(_0x2787a6){return function(_0x14ac92,_0x3d44dd,_0x321cc7){WhatsappQueueEvents[_0x2763('0x6')](_0x2787a6+':'+_0x14ac92['id'],_0x14ac92);WhatsappQueueEvents[_0x2763('0x6')](_0x2787a6,_0x14ac92);_0x321cc7(null);};}for(var e in events){if(events[_0x2763('0x7')](e)){var event=events[e];WhatsappQueue[_0x2763('0x8')](e,emitEvent(event));}}module[_0x2763('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x72e3=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty'];(function(_0x5cfe5c,_0x252417){var _0x39d36c=function(_0x210288){while(--_0x210288){_0x5cfe5c['push'](_0x5cfe5c['shift']());}};_0x39d36c(++_0x252417);}(_0x72e3,0x19e));var _0x372e=function(_0x87ce60,_0xeb9bd7){_0x87ce60=_0x87ce60-0x0;var _0x1e8fd8=_0x72e3[_0x87ce60];return _0x1e8fd8;};'use strict';var EventEmitter=require(_0x372e('0x0'));var WhatsappQueue=require(_0x372e('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x372e('0x2'),'afterUpdate':_0x372e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x452883){return function(_0x40da06,_0x326100,_0xabffa5){WhatsappQueueEvents[_0x372e('0x4')](_0x452883+':'+_0x40da06['id'],_0x40da06);WhatsappQueueEvents[_0x372e('0x4')](_0x452883,_0x40da06);_0xabffa5(null);};}for(var e in events){if(events[_0x372e('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x372e('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2b3dff5..ba94d71 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 _0xd452=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd452,0x17f));var _0x2d45=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xd452[_0x40911a];return _0x27e8e3;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var logger=require(_0x2d45('0x2'))(_0x2d45('0x3'));var moment=require(_0x2d45('0x4'));var BPromise=require(_0x2d45('0x5'));var rp=require(_0x2d45('0x6'));var fs=require('fs');var path=require(_0x2d45('0x7'));var rimraf=require(_0x2d45('0x8'));var config=require(_0x2d45('0x9'));var attributes=require(_0x2d45('0xa'));module[_0x2d45('0xb')]=function(_0x2d8885,_0x2b8922){return _0x2d8885[_0x2d45('0xc')](_0x2d45('0xd'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3599=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3599,0xab));var _0x9359=function(_0x28b695,_0x84a381){_0x28b695=_0x28b695-0x0;var _0x5c308e=_0x3599[_0x28b695];return _0x5c308e;};'use strict';var _=require(_0x9359('0x0'));var util=require('util');var logger=require(_0x9359('0x1'))(_0x9359('0x2'));var moment=require('moment');var BPromise=require(_0x9359('0x3'));var rp=require(_0x9359('0x4'));var fs=require('fs');var path=require(_0x9359('0x5'));var rimraf=require(_0x9359('0x6'));var config=require(_0x9359('0x7'));var attributes=require(_0x9359('0x8'));module[_0x9359('0x9')]=function(_0x3f8f60,_0x1e84c6){return _0x3f8f60[_0x9359('0xa')]('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 df9827b..d94418f 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 _0xd688=['localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x48f067,_0x1e526b){var _0x1abc20=function(_0x5bf22d){while(--_0x5bf22d){_0x48f067['push'](_0x48f067['shift']());}};_0x1abc20(++_0x1e526b);}(_0xd688,0x160));var _0x8d68=function(_0x2ae117,_0x3aab9b){_0x2ae117=_0x2ae117-0x0;var _0x59448e=_0xd688[_0x2ae117];return _0x59448e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d68('0x0'));var fs=require('fs');var Redis=require(_0x8d68('0x1'));var db=require(_0x8d68('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d68('0x3'))(_0x8d68('0x4'));var config=require(_0x8d68('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8d68('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8d68('0x7')],{'host':_0x8d68('0x8'),'port':0x18eb});var socket=require(_0x8d68('0x9'))(new Redis(config['redis']));require(_0x8d68('0xa'))['register'](socket);function respondWithRpcPromise(_0x5ca109,_0x5cebb0,_0x391c4f){return new BPromise(function(_0x1d5e20,_0x3d6dc9){return client[_0x8d68('0xb')](_0x5ca109,_0x391c4f)[_0x8d68('0xc')](function(_0xc6765){logger[_0x8d68('0xd')](_0x8d68('0xe'),_0x5cebb0,_0x8d68('0xf'));logger[_0x8d68('0x10')](_0x8d68('0x11'),_0x5cebb0,_0x8d68('0xf'),JSON[_0x8d68('0x12')](_0xc6765));if(_0xc6765[_0x8d68('0x13')]){if(_0xc6765[_0x8d68('0x13')]['code']===0x1f4){logger[_0x8d68('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x5cebb0,_0xc6765[_0x8d68('0x13')]['message']);return _0x3d6dc9(_0xc6765[_0x8d68('0x13')][_0x8d68('0x14')]);}logger[_0x8d68('0x13')](_0x8d68('0xe'),_0x5cebb0,_0xc6765[_0x8d68('0x13')][_0x8d68('0x14')]);return _0x1d5e20(_0xc6765[_0x8d68('0x13')][_0x8d68('0x14')]);}else{logger[_0x8d68('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x5cebb0,'request\x20sent');_0x1d5e20(_0xc6765[_0x8d68('0x15')]['message']);}})[_0x8d68('0x16')](function(_0x36f93c){logger[_0x8d68('0x13')](_0x8d68('0xe'),_0x5cebb0,_0x36f93c);_0x3d6dc9(_0x36f93c);});});}exports[_0x8d68('0x17')]=function(_0x474d43){var _0x23528d=this;return new Promise(function(_0x55b155,_0x5ef8b5){return db[_0x8d68('0x18')][_0x8d68('0x19')]({'raw':_0x474d43['options']?_0x474d43[_0x8d68('0x1a')][_0x8d68('0x1b')]===undefined?!![]:![]:!![],'where':_0x474d43[_0x8d68('0x1a')]?_0x474d43['options'][_0x8d68('0x1c')]||null:null,'attributes':_0x474d43[_0x8d68('0x1a')]?_0x474d43[_0x8d68('0x1a')][_0x8d68('0x1d')]||null:null,'limit':_0x474d43[_0x8d68('0x1a')]?_0x474d43[_0x8d68('0x1a')][_0x8d68('0x1e')]||null:null,'include':_0x474d43[_0x8d68('0x1a')]?_0x474d43['options'][_0x8d68('0x1f')]?_[_0x8d68('0x20')](_0x474d43[_0x8d68('0x1a')][_0x8d68('0x1f')],function(_0x1a82e2){return{'model':db[_0x1a82e2[_0x8d68('0x21')]],'as':_0x1a82e2['as'],'attributes':_0x1a82e2[_0x8d68('0x1d')],'include':_0x1a82e2['include']?_[_0x8d68('0x20')](_0x1a82e2[_0x8d68('0x1f')],function(_0x231bd7){return{'model':db[_0x231bd7[_0x8d68('0x21')]],'as':_0x231bd7['as'],'attributes':_0x231bd7[_0x8d68('0x1d')],'include':_0x231bd7['include']?_['map'](_0x231bd7[_0x8d68('0x1f')],function(_0x22a92a){return{'model':db[_0x22a92a[_0x8d68('0x21')]],'as':_0x22a92a['as'],'attributes':_0x22a92a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d68('0xc')](function(_0x29a59a){logger[_0x8d68('0xd')](_0x8d68('0x17'),_0x474d43);logger[_0x8d68('0x10')](_0x8d68('0x17'),_0x474d43,JSON['stringify'](_0x29a59a));_0x55b155(_0x29a59a);})[_0x8d68('0x16')](function(_0x431a79){logger['error']('GetWhatsappQueue',_0x431a79['message'],_0x474d43);_0x5ef8b5(_0x23528d[_0x8d68('0x13')](0x1f4,_0x431a79[_0x8d68('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x231bb7){var _0xba4af6=this;return new Promise(function(_0x143f41,_0x3986c2){return db[_0x8d68('0x18')][_0x8d68('0x22')]({'raw':_0x231bb7[_0x8d68('0x1a')]?_0x231bb7[_0x8d68('0x1a')][_0x8d68('0x1b')]===undefined?!![]:![]:!![],'where':_0x231bb7[_0x8d68('0x1a')]?_0x231bb7[_0x8d68('0x1a')][_0x8d68('0x1c')]||null:null,'attributes':_0x231bb7['options']?_0x231bb7[_0x8d68('0x1a')]['attributes']||null:null,'include':_0x231bb7['options']?_0x231bb7[_0x8d68('0x1a')][_0x8d68('0x1f')]?_[_0x8d68('0x20')](_0x231bb7[_0x8d68('0x1a')][_0x8d68('0x1f')],function(_0x2c8128){return{'model':db[_0x2c8128[_0x8d68('0x21')]],'as':_0x2c8128['as'],'attributes':_0x2c8128[_0x8d68('0x1d')],'include':_0x2c8128[_0x8d68('0x1f')]?_[_0x8d68('0x20')](_0x2c8128['include'],function(_0x547810){return{'model':db[_0x547810[_0x8d68('0x21')]],'as':_0x547810['as'],'attributes':_0x547810[_0x8d68('0x1d')],'include':_0x547810[_0x8d68('0x1f')]?_[_0x8d68('0x20')](_0x547810[_0x8d68('0x1f')],function(_0x11a45a){return{'model':db[_0x11a45a[_0x8d68('0x21')]],'as':_0x11a45a['as'],'attributes':_0x11a45a[_0x8d68('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d68('0xc')](function(_0x1ae6a2){logger[_0x8d68('0xd')](_0x8d68('0x23'),_0x231bb7);logger[_0x8d68('0x10')](_0x8d68('0x23'),_0x231bb7,JSON[_0x8d68('0x12')](_0x1ae6a2));_0x143f41(_0x1ae6a2);})[_0x8d68('0x16')](function(_0x225274){logger['error']('ShowWhatsappQueue',_0x225274[_0x8d68('0x14')],_0x231bb7);_0x3986c2(_0xba4af6[_0x8d68('0x13')](0x1f4,_0x225274['message']));});});}; \ No newline at end of file +var _0x4ddb=['../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappQueue','options','where','attributes','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b74b6,_0x3ee400){var _0x28e1f8=function(_0x132d79){while(--_0x132d79){_0x1b74b6['push'](_0x1b74b6['shift']());}};_0x28e1f8(++_0x3ee400);}(_0x4ddb,0x176));var _0xb4dd=function(_0x59a40c,_0x35999f){_0x59a40c=_0x59a40c-0x0;var _0x3cf340=_0x4ddb[_0x59a40c];return _0x3cf340;};'use strict';var _=require(_0xb4dd('0x0'));var util=require(_0xb4dd('0x1'));var moment=require(_0xb4dd('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4dd('0x3'));var fs=require('fs');var Redis=require(_0xb4dd('0x4'));var db=require(_0xb4dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4dd('0x6'))(_0xb4dd('0x7'));var config=require(_0xb4dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb4dd('0x9')][_0xb4dd('0xa')]({'port':0x232a});config[_0xb4dd('0xb')]=_['defaults'](config[_0xb4dd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4dd('0xc'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xb4dd('0xd')](socket);function respondWithRpcPromise(_0x5660a9,_0x392607,_0x359528){return new BPromise(function(_0x5b7c8b,_0x28fc0e){return client[_0xb4dd('0xe')](_0x5660a9,_0x359528)[_0xb4dd('0xf')](function(_0x55bf14){logger[_0xb4dd('0x10')](_0xb4dd('0x11'),_0x392607,_0xb4dd('0x12'));logger[_0xb4dd('0x13')](_0xb4dd('0x14'),_0x392607,_0xb4dd('0x12'),JSON['stringify'](_0x55bf14));if(_0x55bf14['error']){if(_0x55bf14['error'][_0xb4dd('0x15')]===0x1f4){logger[_0xb4dd('0x16')](_0xb4dd('0x11'),_0x392607,_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);return _0x28fc0e(_0x55bf14[_0xb4dd('0x16')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x392607,_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);return _0x5b7c8b(_0x55bf14[_0xb4dd('0x16')][_0xb4dd('0x17')]);}else{logger[_0xb4dd('0x10')](_0xb4dd('0x11'),_0x392607,_0xb4dd('0x12'));_0x5b7c8b(_0x55bf14[_0xb4dd('0x18')]['message']);}})[_0xb4dd('0x19')](function(_0x5babac){logger[_0xb4dd('0x16')](_0xb4dd('0x11'),_0x392607,_0x5babac);_0x28fc0e(_0x5babac);});});}exports['GetWhatsappQueue']=function(_0x50dcc4){var _0x37630c=this;return new Promise(function(_0x55490f,_0x39a2d8){return db[_0xb4dd('0x1a')]['findAll']({'raw':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4['options']['raw']===undefined?!![]:![]:!![],'where':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1c')]||null:null,'attributes':_0x50dcc4['options']?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1d')]||null:null,'limit':_0x50dcc4[_0xb4dd('0x1b')]?_0x50dcc4[_0xb4dd('0x1b')]['limit']||null:null,'include':_0x50dcc4['options']?_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x50dcc4[_0xb4dd('0x1b')][_0xb4dd('0x1e')],function(_0x2a17d6){return{'model':db[_0x2a17d6[_0xb4dd('0x20')]],'as':_0x2a17d6['as'],'attributes':_0x2a17d6[_0xb4dd('0x1d')],'include':_0x2a17d6['include']?_[_0xb4dd('0x1f')](_0x2a17d6['include'],function(_0x59d15a){return{'model':db[_0x59d15a[_0xb4dd('0x20')]],'as':_0x59d15a['as'],'attributes':_0x59d15a[_0xb4dd('0x1d')],'include':_0x59d15a[_0xb4dd('0x1e')]?_['map'](_0x59d15a[_0xb4dd('0x1e')],function(_0x68a950){return{'model':db[_0x68a950[_0xb4dd('0x20')]],'as':_0x68a950['as'],'attributes':_0x68a950[_0xb4dd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb4dd('0xf')](function(_0x27334b){logger[_0xb4dd('0x10')](_0xb4dd('0x21'),_0x50dcc4);logger[_0xb4dd('0x13')](_0xb4dd('0x21'),_0x50dcc4,JSON[_0xb4dd('0x22')](_0x27334b));_0x55490f(_0x27334b);})[_0xb4dd('0x19')](function(_0x342549){logger[_0xb4dd('0x16')](_0xb4dd('0x21'),_0x342549[_0xb4dd('0x17')],_0x50dcc4);_0x39a2d8(_0x37630c[_0xb4dd('0x16')](0x1f4,_0x342549[_0xb4dd('0x17')]));});});};exports[_0xb4dd('0x23')]=function(_0x3305e4){var _0x5108a7=this;return new Promise(function(_0xfef2e,_0xb8d829){return db['WhatsappQueue'][_0xb4dd('0x24')]({'raw':_0x3305e4['options']?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x25')]===undefined?!![]:![]:!![],'where':_0x3305e4['options']?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1c')]||null:null,'attributes':_0x3305e4[_0xb4dd('0x1b')]?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1d')]||null:null,'include':_0x3305e4[_0xb4dd('0x1b')]?_0x3305e4[_0xb4dd('0x1b')][_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x3305e4[_0xb4dd('0x1b')]['include'],function(_0x2852be){return{'model':db[_0x2852be['model']],'as':_0x2852be['as'],'attributes':_0x2852be[_0xb4dd('0x1d')],'include':_0x2852be['include']?_['map'](_0x2852be[_0xb4dd('0x1e')],function(_0x1f691c){return{'model':db[_0x1f691c[_0xb4dd('0x20')]],'as':_0x1f691c['as'],'attributes':_0x1f691c['attributes'],'include':_0x1f691c[_0xb4dd('0x1e')]?_[_0xb4dd('0x1f')](_0x1f691c[_0xb4dd('0x1e')],function(_0xbfd1a2){return{'model':db[_0xbfd1a2[_0xb4dd('0x20')]],'as':_0xbfd1a2['as'],'attributes':_0xbfd1a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4dd('0xf')](function(_0x3bfab8){logger[_0xb4dd('0x10')](_0xb4dd('0x23'),_0x3305e4);logger[_0xb4dd('0x13')](_0xb4dd('0x23'),_0x3305e4,JSON[_0xb4dd('0x22')](_0x3bfab8));_0xfef2e(_0x3bfab8);})[_0xb4dd('0x19')](function(_0x312498){logger[_0xb4dd('0x16')](_0xb4dd('0x23'),_0x312498[_0xb4dd('0x17')],_0x3305e4);_0xb8d829(_0x5108a7[_0xb4dd('0x16')](0x1f4,_0x312498[_0xb4dd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ae46bed..a2b6eb4 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 _0x63d3=['update','emit','removeListener','register','length','whatsappQueue:','save','remove'];(function(_0x46bfc2,_0x18ee96){var _0x244331=function(_0x3695f2){while(--_0x3695f2){_0x46bfc2['push'](_0x46bfc2['shift']());}};_0x244331(++_0x18ee96);}(_0x63d3,0x1a6));var _0x363d=function(_0xf04123,_0x5cd161){_0xf04123=_0xf04123-0x0;var _0x198bfd=_0x63d3[_0xf04123];return _0x198bfd;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x363d('0x0'),_0x363d('0x1'),_0x363d('0x2')];function createListener(_0x16e8f9,_0x3abb77){return function(_0x4e7dc7){_0x3abb77[_0x363d('0x3')](_0x16e8f9,_0x4e7dc7);};}function removeListener(_0x5ccb85,_0xee7f57){return function(){WhatsappQueueEvents[_0x363d('0x4')](_0x5ccb85,_0xee7f57);};}exports[_0x363d('0x5')]=function(_0x372917){for(var _0x3ed0c6=0x0,_0x281b4e=events[_0x363d('0x6')];_0x3ed0c6<_0x281b4e;_0x3ed0c6++){var _0x52798a=events[_0x3ed0c6];var _0x92c7c3=createListener(_0x363d('0x7')+_0x52798a,_0x372917);WhatsappQueueEvents['on'](_0x52798a,_0x92c7c3);}}; \ No newline at end of file +var _0x5b1b=['update','removeListener','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x5b1b,0x1ca));var _0xb5b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b1b[_0x4a9fb1];return _0x348672;};'use strict';var WhatsappQueueEvents=require(_0xb5b1('0x0'));var events=[_0xb5b1('0x1'),'remove',_0xb5b1('0x2')];function createListener(_0x4a9aa9,_0x535e63){return function(_0x2eb46a){_0x535e63['emit'](_0x4a9aa9,_0x2eb46a);};}function removeListener(_0x5ea92d,_0x3e4452){return function(){WhatsappQueueEvents[_0xb5b1('0x3')](_0x5ea92d,_0x3e4452);};}exports['register']=function(_0x27e104){for(var _0x5d0fd3=0x0,_0x1bab63=events['length'];_0x5d0fd3<_0x1bab63;_0x5d0fd3++){var _0x2786ff=events[_0x5d0fd3];var _0x3a6ebd=createListener(_0xb5b1('0x4')+_0x2786ff,_0x27e104);WhatsappQueueEvents['on'](_0x2786ff,_0x3a6ebd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9515c49..37fb900 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 _0xf3b6=['path','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','destroy','exports','multer','util'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0xf3b6,0x1b8));var _0x6f3b=function(_0x1f902b,_0x56ebca){_0x1f902b=_0x1f902b-0x0;var _0x2b36c0=_0xf3b6[_0x1f902b];return _0x2b36c0;};'use strict';var multer=require(_0x6f3b('0x0'));var util=require(_0x6f3b('0x1'));var path=require(_0x6f3b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f3b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f3b('0x4'));var interaction=require(_0x6f3b('0x5'));var config=require('../../config/environment');var controller=require(_0x6f3b('0x6'));router[_0x6f3b('0x7')]('/',auth[_0x6f3b('0x8')](),controller['index']);router[_0x6f3b('0x7')](_0x6f3b('0x9'),auth['isAuthenticated'](),controller[_0x6f3b('0xa')]);router[_0x6f3b('0x7')](_0x6f3b('0xb'),auth[_0x6f3b('0x8')](),controller[_0x6f3b('0xc')]);router['post']('/',auth[_0x6f3b('0x8')](),controller[_0x6f3b('0xd')]);router[_0x6f3b('0xe')]('/:id',auth[_0x6f3b('0x8')](),controller['update']);router['delete'](_0x6f3b('0xb'),auth[_0x6f3b('0x8')](),controller[_0x6f3b('0xf')]);module[_0x6f3b('0x10')]=router; \ No newline at end of file +var _0xa978=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3b78a7,_0x5dea18){var _0x38591d=function(_0x2b7c31){while(--_0x2b7c31){_0x3b78a7['push'](_0x3b78a7['shift']());}};_0x38591d(++_0x5dea18);}(_0xa978,0x145));var _0x8a97=function(_0x99b4c0,_0x3bc8a4){_0x99b4c0=_0x99b4c0-0x0;var _0x1eb122=_0xa978[_0x99b4c0];return _0x1eb122;};'use strict';var multer=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var path=require(_0x8a97('0x2'));var timeout=require(_0x8a97('0x3'));var express=require('express');var router=express[_0x8a97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a97('0x5'));var interaction=require(_0x8a97('0x6'));var config=require(_0x8a97('0x7'));var controller=require(_0x8a97('0x8'));router[_0x8a97('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a97('0xa')]);router[_0x8a97('0x9')](_0x8a97('0xb'),auth[_0x8a97('0xc')](),controller[_0x8a97('0xd')]);router[_0x8a97('0x9')](_0x8a97('0xe'),auth['isAuthenticated'](),controller[_0x8a97('0xf')]);router[_0x8a97('0x10')]('/',auth[_0x8a97('0xc')](),controller['create']);router[_0x8a97('0x11')](_0x8a97('0xe'),auth[_0x8a97('0xc')](),controller[_0x8a97('0x12')]);router[_0x8a97('0x13')](_0x8a97('0xe'),auth[_0x8a97('0xc')](),controller[_0x8a97('0x14')]);module[_0x8a97('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 d75f305..2bfb1f8 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(_0x16464b,_0x402d48){var _0x192390=function(_0x23c8a1){while(--_0x23c8a1){_0x16464b['push'](_0x16464b['shift']());}};_0x192390(++_0x402d48);}(_0x7a54,0x106));var _0x47a5=function(_0x4b5765,_0x1f00bd){_0x4b5765=_0x4b5765-0x0;var _0x1ff429=_0x7a54[_0x4b5765];return _0x1ff429;};'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(_0x5db28d,_0xb8f363){var _0x174e92=function(_0x112a1b){while(--_0x112a1b){_0x5db28d['push'](_0x5db28d['shift']());}};_0x174e92(++_0xb8f363);}(_0x7a54,0x106));var _0x47a5=function(_0x523ac5,_0xe1eb23){_0x523ac5=_0x523ac5-0x0;var _0x27bebe=_0x7a54[_0x523ac5];return _0x27bebe;};'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 c435d5a..9d3495f 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 _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x48f31f,_0x406faa){var _0x4483e1=function(_0x3ba7f8){while(--_0x3ba7f8){_0x48f31f['push'](_0x48f31f['shift']());}};_0x4483e1(++_0x406faa);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5c49ea,_0x497de8){_0x5c49ea=_0x5c49ea-0x0;var _0x5cd26f=_0x2e54[_0x5c49ea];return _0x5cd26f;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file +var _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x4024,0x89));var _0x4402=function(_0xda7f4f,_0x13c5c7){_0xda7f4f=_0xda7f4f-0x0;var _0x1b9e6e=_0x4024[_0xda7f4f];return _0x1b9e6e;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){_0x258d10['status'](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x4e1c04,_0x3733cd){return function(_0x5ab28d){if(!_0x5ab28d){_0x4e1c04[_0x4402('0x13')](0x194);}return _0x5ab28d;};}function handleError(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0x1f4;return function(_0x15c19f){logger['error'](_0x15c19f['stack']);if(_0x15c19f[_0x4402('0x21')]){delete _0x15c19f[_0x4402('0x21')];}_0x211424[_0x4402('0x14')](_0x5a43d0)[_0x4402('0x22')](_0x15c19f);};}exports[_0x4402('0x23')]=function(_0x514e41,_0x41de44){var _0x52e625={},_0x71da2f={},_0x1e2340={'count':0x0,'rows':[]};var _0x42dd32=_['map'](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x316239){return{'name':_0x316239[_0x4402('0x26')],'type':_0x316239[_0x4402('0x27')][_0x4402('0x28')]};});_0x71da2f[_0x4402('0x29')]=_[_0x4402('0x2a')](_0x42dd32,_0x4402('0x21'));_0x71da2f[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x514e41['query']);_0x71da2f[_0x4402('0x2d')]=_['intersection'](_0x71da2f[_0x4402('0x29')],_0x71da2f['query']);_0x52e625[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x71da2f[_0x4402('0x29')],qs[_0x4402('0x30')](_0x514e41[_0x4402('0x2b')]['fields']));_0x52e625[_0x4402('0x2e')]=_0x52e625[_0x4402('0x2e')][_0x4402('0x31')]?_0x52e625['attributes']:_0x71da2f[_0x4402('0x29')];if(!_0x514e41[_0x4402('0x2b')]['hasOwnProperty'](_0x4402('0x32'))){_0x52e625[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x514e41[_0x4402('0x2b')][_0x4402('0x19')]);_0x52e625[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x514e41[_0x4402('0x2b')][_0x4402('0x17')]);}_0x52e625['order']=qs[_0x4402('0x33')](_0x514e41[_0x4402('0x2b')][_0x4402('0x33')]);_0x52e625['where']=qs[_0x4402('0x2d')](_[_0x4402('0x34')](_0x514e41['query'],_0x71da2f['filters']),_0x42dd32);if(_0x514e41[_0x4402('0x2b')][_0x4402('0x35')]){_0x52e625[_0x4402('0x36')]=_[_0x4402('0x37')](_0x52e625['where'],{'$or':_['map'](_0x42dd32,function(_0x4b0672){if(_0x4b0672[_0x4402('0x27')]!==_0x4402('0x38')){var _0xcbfa06={};_0xcbfa06[_0x4b0672[_0x4402('0x21')]]={'$like':'%'+_0x514e41['query'][_0x4402('0x35')]+'%'};return _0xcbfa06;}})});}_0x52e625=_[_0x4402('0x37')]({},_0x52e625,_0x514e41[_0x4402('0x39')]);var _0x57843d={'where':_0x52e625[_0x4402('0x36')]};return db['WhatsappQueueReport'][_0x4402('0x1a')](_0x57843d)[_0x4402('0x1f')](function(_0x5c74b1){_0x1e2340[_0x4402('0x1a')]=_0x5c74b1;if(_0x514e41['query'][_0x4402('0x3a')]){_0x52e625[_0x4402('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4402('0x3c')](_0x52e625);})[_0x4402('0x1f')](function(_0x250f09){_0x1e2340[_0x4402('0x3d')]=_0x250f09;return _0x1e2340;})['then'](respondWithFilteredResult(_0x41de44,_0x52e625))['catch'](handleError(_0x41de44,null));};exports[_0x4402('0x3e')]=function(_0x47a3a3,_0x3a589b){var _0x2a6d78={'raw':!![],'where':{'id':_0x47a3a3[_0x4402('0x3f')]['id']}},_0xb9cf85={};_0xb9cf85[_0x4402('0x29')]=_[_0x4402('0x2c')](db[_0x4402('0x24')][_0x4402('0x25')]);_0xb9cf85[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x47a3a3['query']);_0xb9cf85[_0x4402('0x2d')]=_[_0x4402('0x2f')](_0xb9cf85['model'],_0xb9cf85[_0x4402('0x2b')]);_0x2a6d78[_0x4402('0x2e')]=_['intersection'](_0xb9cf85[_0x4402('0x29')],qs[_0x4402('0x30')](_0x47a3a3[_0x4402('0x2b')][_0x4402('0x30')]));_0x2a6d78[_0x4402('0x2e')]=_0x2a6d78['attributes'][_0x4402('0x31')]?_0x2a6d78[_0x4402('0x2e')]:_0xb9cf85[_0x4402('0x29')];if(_0x47a3a3[_0x4402('0x2b')][_0x4402('0x3a')]){_0x2a6d78[_0x4402('0x3b')]=[{'all':!![]}];}_0x2a6d78=_[_0x4402('0x37')]({},_0x2a6d78,_0x47a3a3[_0x4402('0x39')]);return db[_0x4402('0x24')][_0x4402('0x40')](_0x2a6d78)[_0x4402('0x1f')](handleEntityNotFound(_0x3a589b,null))['then'](respondWithResult(_0x3a589b,null))[_0x4402('0x41')](handleError(_0x3a589b,null));};exports['create']=function(_0xc45af6,_0x34ce00){return db['WhatsappQueueReport'][_0x4402('0x42')](_0xc45af6[_0x4402('0x43')],{})[_0x4402('0x1f')](respondWithResult(_0x34ce00,0xc9))[_0x4402('0x41')](handleError(_0x34ce00,null));};exports[_0x4402('0x1e')]=function(_0x2503eb,_0x5b094b){if(_0x2503eb[_0x4402('0x43')]['id']){delete _0x2503eb[_0x4402('0x43')]['id'];}return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x2503eb[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b094b,null))[_0x4402('0x1f')](saveUpdates(_0x2503eb[_0x4402('0x43')],null))[_0x4402('0x1f')](respondWithResult(_0x5b094b,null))['catch'](handleError(_0x5b094b,null));};exports['destroy']=function(_0x5ab12b,_0x4c2d2e){return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x5ab12b[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4c2d2e,null))['then'](removeEntity(_0x4c2d2e,null))[_0x4402('0x41')](handleError(_0x4c2d2e,null));};exports[_0x4402('0x44')]=function(_0x203b33,_0x2a4ea7){return db[_0x4402('0x24')][_0x4402('0x44')]()[_0x4402('0x1f')](respondWithResult(_0x2a4ea7,null))['catch'](handleError(_0x2a4ea7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a4608c2..4b67f95 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 _0x056a=['report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x28b542,_0x5c7fbb){var _0xac2058=function(_0x3c20eb){while(--_0x3c20eb){_0x28b542['push'](_0x28b542['shift']());}};_0xac2058(++_0x5c7fbb);}(_0x056a,0x6b));var _0xa056=function(_0x4512dc,_0x374cde){_0x4512dc=_0x4512dc-0x0;var _0x4d799f=_0x056a[_0x4512dc];return _0x4d799f;};'use strict';var _=require('lodash');var util=require(_0xa056('0x0'));var logger=require(_0xa056('0x1'))(_0xa056('0x2'));var moment=require(_0xa056('0x3'));var BPromise=require(_0xa056('0x4'));var rp=require(_0xa056('0x5'));var fs=require('fs');var path=require(_0xa056('0x6'));var rimraf=require(_0xa056('0x7'));var config=require(_0xa056('0x8'));var attributes=require(_0xa056('0x9'));module[_0xa056('0xa')]=function(_0x44af42,_0x485316){return _0x44af42[_0xa056('0xb')](_0xa056('0xc'),attributes,{'tableName':_0xa056('0xd'),'paranoid':![],'indexes':[{'name':_0xa056('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b7b=['exports','define','WhatsappQueueReport','uniqueid','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b7b,0x16c));var _0xb4b7=function(_0x571a27,_0x2dcdfe){_0x571a27=_0x571a27-0x0;var _0x46aef0=_0x4b7b[_0x571a27];return _0x46aef0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb4b7('0x0'));var moment=require(_0xb4b7('0x1'));var BPromise=require(_0xb4b7('0x2'));var rp=require(_0xb4b7('0x3'));var fs=require('fs');var path=require(_0xb4b7('0x4'));var rimraf=require(_0xb4b7('0x5'));var config=require(_0xb4b7('0x6'));var attributes=require(_0xb4b7('0x7'));module[_0xb4b7('0x8')]=function(_0x58552c,_0x287bb0){return _0x58552c[_0xb4b7('0x9')](_0xb4b7('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb4b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c24e546..c517dc1 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 _0x89bf=['where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateWhatsappQueueReport','create','body','options','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw'];(function(_0x19fed4,_0x5b33bc){var _0xf99fd8=function(_0x1c9a89){while(--_0x1c9a89){_0x19fed4['push'](_0x19fed4['shift']());}};_0xf99fd8(++_0x5b33bc);}(_0x89bf,0x112));var _0xf89b=function(_0x30e15b,_0x596870){_0x30e15b=_0x30e15b-0x0;var _0x415eb1=_0x89bf[_0x30e15b];return _0x415eb1;};'use strict';var _=require(_0xf89b('0x0'));var util=require('util');var moment=require(_0xf89b('0x1'));var BPromise=require(_0xf89b('0x2'));var rs=require(_0xf89b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf89b('0x4'))['db'];var utils=require(_0xf89b('0x5'));var logger=require(_0xf89b('0x6'))(_0xf89b('0x7'));var config=require(_0xf89b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf89b('0x9')][_0xf89b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x264c08,_0x58f6fc,_0x2e5761){return new BPromise(function(_0xc4dd7e,_0x50763d){return client[_0xf89b('0xb')](_0x264c08,_0x2e5761)[_0xf89b('0xc')](function(_0x537aba){logger[_0xf89b('0xd')](_0xf89b('0xe'),_0x58f6fc,'request\x20sent');logger[_0xf89b('0xf')](_0xf89b('0x10'),_0x58f6fc,_0xf89b('0x11'),JSON[_0xf89b('0x12')](_0x537aba));if(_0x537aba[_0xf89b('0x13')]){if(_0x537aba[_0xf89b('0x13')][_0xf89b('0x14')]===0x1f4){logger[_0xf89b('0x13')](_0xf89b('0xe'),_0x58f6fc,_0x537aba[_0xf89b('0x13')][_0xf89b('0x15')]);return _0x50763d(_0x537aba[_0xf89b('0x13')][_0xf89b('0x15')]);}logger['error'](_0xf89b('0xe'),_0x58f6fc,_0x537aba[_0xf89b('0x13')][_0xf89b('0x15')]);return _0xc4dd7e(_0x537aba['error']['message']);}else{logger['info'](_0xf89b('0xe'),_0x58f6fc,'request\x20sent');_0xc4dd7e(_0x537aba[_0xf89b('0x16')][_0xf89b('0x15')]);}})['catch'](function(_0x1a4484){logger[_0xf89b('0x13')](_0xf89b('0xe'),_0x58f6fc,_0x1a4484);_0x50763d(_0x1a4484);});});}exports[_0xf89b('0x17')]=function(_0x161d7a){var _0x293cb1=this;return new Promise(function(_0x9794a3,_0x251e48){return db['WhatsappQueueReport'][_0xf89b('0x18')](_0x161d7a[_0xf89b('0x19')],{'raw':_0x161d7a[_0xf89b('0x1a')]?_0x161d7a[_0xf89b('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x379f71){logger[_0xf89b('0xd')](_0xf89b('0x17'),_0x161d7a);logger[_0xf89b('0xf')]('CreateWhatsappQueueReport',_0x161d7a,JSON[_0xf89b('0x12')](_0x379f71));_0x9794a3(_0x379f71);})[_0xf89b('0x1b')](function(_0x41188c){logger[_0xf89b('0x13')]('CreateWhatsappQueueReport',_0x41188c['message'],_0x161d7a);_0x251e48(_0x293cb1['error'](0x1f4,_0x41188c[_0xf89b('0x15')]));});});};exports[_0xf89b('0x1c')]=function(_0x887111){var _0x856057=this;return new Promise(function(_0x15058f,_0x33e821){return db[_0xf89b('0x1d')][_0xf89b('0x1e')](_0x887111['body'],{'raw':_0x887111[_0xf89b('0x1a')]?_0x887111['options'][_0xf89b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x887111[_0xf89b('0x1a')]?_0x887111['options'][_0xf89b('0x20')]||null:null,'attributes':_0x887111[_0xf89b('0x1a')]?_0x887111[_0xf89b('0x1a')][_0xf89b('0x21')]||null:null,'limit':_0x887111[_0xf89b('0x1a')]?_0x887111[_0xf89b('0x1a')]['limit']||null:null})[_0xf89b('0xc')](function(_0x39a847){logger[_0xf89b('0xd')](_0xf89b('0x1c'),_0x887111);logger[_0xf89b('0xf')]('UpdateWhatsappQueueReport',_0x887111,JSON[_0xf89b('0x12')](_0x39a847));_0x15058f(_0x39a847);})['catch'](function(_0x18dedc){logger[_0xf89b('0x13')]('UpdateWhatsappQueueReport',_0x18dedc[_0xf89b('0x15')],_0x887111);_0x33e821(_0x856057[_0xf89b('0x13')](0x1f4,_0x18dedc['message']));});});}; \ No newline at end of file +var _0x0c49=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment'];(function(_0x32aa8b,_0x1041d1){var _0x1a8c56=function(_0x2f87f0){while(--_0x2f87f0){_0x32aa8b['push'](_0x32aa8b['shift']());}};_0x1a8c56(++_0x1041d1);}(_0x0c49,0x13e));var _0x90c4=function(_0x6ed7f7,_0x38aabf){_0x6ed7f7=_0x6ed7f7-0x0;var _0x7fd93=_0x0c49[_0x6ed7f7];return _0x7fd93;};'use strict';var _=require(_0x90c4('0x0'));var util=require('util');var moment=require(_0x90c4('0x1'));var BPromise=require(_0x90c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90c4('0x3'))['db'];var utils=require(_0x90c4('0x4'));var logger=require('../../config/logger')(_0x90c4('0x5'));var config=require(_0x90c4('0x6'));var jayson=require(_0x90c4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x146d97,_0x1e9126,_0x1e6a2e){return new BPromise(function(_0x2ebb33,_0x3f4b01){return client[_0x90c4('0x8')](_0x146d97,_0x1e6a2e)[_0x90c4('0x9')](function(_0xb9d0f2){logger[_0x90c4('0xa')](_0x90c4('0xb'),_0x1e9126,_0x90c4('0xc'));logger[_0x90c4('0xd')](_0x90c4('0xe'),_0x1e9126,'request\x20sent',JSON[_0x90c4('0xf')](_0xb9d0f2));if(_0xb9d0f2[_0x90c4('0x10')]){if(_0xb9d0f2['error'][_0x90c4('0x11')]===0x1f4){logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0xb9d0f2[_0x90c4('0x10')]['message']);return _0x3f4b01(_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);}logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);return _0x2ebb33(_0xb9d0f2[_0x90c4('0x10')][_0x90c4('0x12')]);}else{logger[_0x90c4('0xa')](_0x90c4('0xb'),_0x1e9126,_0x90c4('0xc'));_0x2ebb33(_0xb9d0f2[_0x90c4('0x13')]['message']);}})[_0x90c4('0x14')](function(_0x20c44d){logger[_0x90c4('0x10')](_0x90c4('0xb'),_0x1e9126,_0x20c44d);_0x3f4b01(_0x20c44d);});});}exports[_0x90c4('0x15')]=function(_0x27acf7){var _0x468420=this;return new Promise(function(_0x2bfb43,_0x5c2765){return db[_0x90c4('0x16')][_0x90c4('0x17')](_0x27acf7[_0x90c4('0x18')],{'raw':_0x27acf7[_0x90c4('0x19')]?_0x27acf7[_0x90c4('0x19')][_0x90c4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2001af){logger[_0x90c4('0xa')](_0x90c4('0x15'),_0x27acf7);logger[_0x90c4('0xd')](_0x90c4('0x15'),_0x27acf7,JSON[_0x90c4('0xf')](_0x2001af));_0x2bfb43(_0x2001af);})[_0x90c4('0x14')](function(_0x9fd373){logger[_0x90c4('0x10')]('CreateWhatsappQueueReport',_0x9fd373[_0x90c4('0x12')],_0x27acf7);_0x5c2765(_0x468420[_0x90c4('0x10')](0x1f4,_0x9fd373[_0x90c4('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x555356){var _0x48b2b5=this;return new Promise(function(_0x3c3b40,_0x55ef2f){return db[_0x90c4('0x16')][_0x90c4('0x1b')](_0x555356[_0x90c4('0x18')],{'raw':_0x555356['options']?_0x555356[_0x90c4('0x19')][_0x90c4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555356['options']?_0x555356[_0x90c4('0x19')][_0x90c4('0x1c')]||null:null,'attributes':_0x555356[_0x90c4('0x19')]?_0x555356[_0x90c4('0x19')][_0x90c4('0x1d')]||null:null,'limit':_0x555356[_0x90c4('0x19')]?_0x555356['options'][_0x90c4('0x1e')]||null:null})['then'](function(_0x1a778a){logger[_0x90c4('0xa')](_0x90c4('0x1f'),_0x555356);logger['debug'](_0x90c4('0x1f'),_0x555356,JSON[_0x90c4('0xf')](_0x1a778a));_0x3c3b40(_0x1a778a);})[_0x90c4('0x14')](function(_0x48d25b){logger[_0x90c4('0x10')](_0x90c4('0x1f'),_0x48d25b[_0x90c4('0x12')],_0x555356);_0x55ef2f(_0x48b2b5['error'](0x1f4,_0x48d25b[_0x90c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5c79aa1..3982650 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 _0x8ced=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x3a0438,_0xd6bec2){var _0x5c50a4=function(_0x36edd2){while(--_0x36edd2){_0x3a0438['push'](_0x3a0438['shift']());}};_0x5c50a4(++_0xd6bec2);}(_0x8ced,0x157));var _0xd8ce=function(_0x46723d,_0x3d6bd5){_0x46723d=_0x46723d-0x0;var _0x5e2b3a=_0x8ced[_0x46723d];return _0x5e2b3a;};'use strict';var multer=require(_0xd8ce('0x0'));var util=require(_0xd8ce('0x1'));var path=require(_0xd8ce('0x2'));var timeout=require(_0xd8ce('0x3'));var express=require(_0xd8ce('0x4'));var router=express['Router']();var fs_extra=require(_0xd8ce('0x5'));var auth=require(_0xd8ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd8ce('0x7'));var controller=require(_0xd8ce('0x8'));router[_0xd8ce('0x9')]('/',auth[_0xd8ce('0xa')](),controller[_0xd8ce('0xb')]);router[_0xd8ce('0x9')]('/describe',auth[_0xd8ce('0xa')](),controller['describe']);router[_0xd8ce('0x9')](_0xd8ce('0xc'),auth['isAuthenticated'](),controller[_0xd8ce('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8ce('0xe')]);router['put'](_0xd8ce('0xc'),auth['isAuthenticated'](),controller[_0xd8ce('0xf')]);router[_0xd8ce('0x10')](_0xd8ce('0xc'),auth[_0xd8ce('0xa')](),controller[_0xd8ce('0x11')]);module[_0xd8ce('0x12')]=router; \ No newline at end of file +var _0x7667=['/describe','isAuthenticated','describe','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','index','get'];(function(_0xbfd9b8,_0x25772a){var _0x3f021=function(_0x5a55ef){while(--_0x5a55ef){_0xbfd9b8['push'](_0xbfd9b8['shift']());}};_0x3f021(++_0x25772a);}(_0x7667,0x19a));var _0x7766=function(_0x30d385,_0x74aea){_0x30d385=_0x30d385-0x0;var _0x4c594c=_0x7667[_0x30d385];return _0x4c594c;};'use strict';var multer=require(_0x7766('0x0'));var util=require('util');var path=require(_0x7766('0x1'));var timeout=require(_0x7766('0x2'));var express=require('express');var router=express[_0x7766('0x3')]();var fs_extra=require(_0x7766('0x4'));var auth=require(_0x7766('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7766('0x6'));var controller=require(_0x7766('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7766('0x8')]);router[_0x7766('0x9')](_0x7766('0xa'),auth[_0x7766('0xb')](),controller[_0x7766('0xc')]);router[_0x7766('0x9')]('/:id',auth[_0x7766('0xb')](),controller[_0x7766('0xd')]);router['post']('/',auth[_0x7766('0xb')](),controller[_0x7766('0xe')]);router[_0x7766('0xf')](_0x7766('0x10'),auth[_0x7766('0xb')](),controller[_0x7766('0x11')]);router['delete'](_0x7766('0x10'),auth[_0x7766('0xb')](),controller[_0x7766('0x12')]);module[_0x7766('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 a31c9b4..68078f6 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 _0x2faf=['agent','DATE','sequelize','exports','STRING','account'];(function(_0xecfad6,_0xbb711b){var _0xa8e2d5=function(_0x42140a){while(--_0x42140a){_0xecfad6['push'](_0xecfad6['shift']());}};_0xa8e2d5(++_0xbb711b);}(_0x2faf,0xb0));var _0xf2fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2faf[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf2fa('0x0'));module[_0xf2fa('0x1')]={'uniqueid':{'type':Sequelize[_0xf2fa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf2fa('0x3'),_0xf2fa('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf2fa('0x5')]}}; \ No newline at end of file +var _0xc2da=['queue','DATE','sequelize','STRING','account'];(function(_0x315a14,_0x1e079b){var _0x505bec=function(_0x4f4ed9){while(--_0x4f4ed9){_0x315a14['push'](_0x315a14['shift']());}};_0x505bec(++_0x1e079b);}(_0xc2da,0x124));var _0xac2d=function(_0x526876,_0x2473ec){_0x526876=_0x526876-0x0;var _0x379ab5=_0xc2da[_0x526876];return _0x379ab5;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xac2d('0x2'),'agent',_0xac2d('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xac2d('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 84d7970..58bb049 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 _0xd506=['create','body','update','find','describe','eml-format','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','save','destroy','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd506,0x197));var _0x6d50=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xd506[_0x9fd887];return _0x1a54ab;};'use strict';var emlformat=require(_0x6d50('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6d50('0x1'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6d50('0x2'));var fs=require('fs');var fs_extra=require(_0x6d50('0x3'));var _=require(_0x6d50('0x4'));var squel=require('squel');var crypto=require(_0x6d50('0x5'));var jsforce=require(_0x6d50('0x6'));var deskjs=require(_0x6d50('0x7'));var toCsv=require('to-csv');var querystring=require(_0x6d50('0x8'));var Papa=require('papaparse');var Redis=require(_0x6d50('0x9'));var authService=require(_0x6d50('0xa'));var qs=require(_0x6d50('0xb'));var as=require(_0x6d50('0xc'));var hardwareService=require(_0x6d50('0xd'));var logger=require(_0x6d50('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d50('0xf'));var db=require(_0x6d50('0x10'))['db'];function respondWithStatusCode(_0x39e10e,_0xf9f397){_0xf9f397=_0xf9f397||0xcc;return function(_0x5d7ad1){if(_0x5d7ad1){return _0x39e10e[_0x6d50('0x11')](_0xf9f397);}return _0x39e10e['status'](_0xf9f397)[_0x6d50('0x12')]();};}function respondWithResult(_0x5f5dcf,_0x5adb8e){_0x5adb8e=_0x5adb8e||0xc8;return function(_0x4da1c4){if(_0x4da1c4){return _0x5f5dcf[_0x6d50('0x13')](_0x5adb8e)['json'](_0x4da1c4);}};}function respondWithFilteredResult(_0x3d8e17,_0x3807a3){return function(_0x59090d){if(_0x59090d){var _0x599f10=typeof _0x3807a3[_0x6d50('0x14')]===_0x6d50('0x15')&&typeof _0x3807a3[_0x6d50('0x16')]==='undefined';var _0x2ee037=_0x59090d[_0x6d50('0x17')];var _0x466d5f=_0x599f10?0x0:_0x3807a3[_0x6d50('0x14')];var _0x46e254=_0x599f10?_0x59090d['count']:_0x3807a3['offset']+_0x3807a3[_0x6d50('0x16')];var _0xb87dad;if(_0x46e254>=_0x2ee037){_0x46e254=_0x2ee037;_0xb87dad=0xc8;}else{_0xb87dad=0xce;}_0x3d8e17['status'](_0xb87dad);return _0x3d8e17[_0x6d50('0x18')]('Content-Range',_0x466d5f+'-'+_0x46e254+'/'+_0x2ee037)[_0x6d50('0x19')](_0x59090d);}return null;};}function patchUpdates(_0x37a0a5){return function(_0x138e7d){try{jsonpatch['apply'](_0x138e7d,_0x37a0a5,!![]);}catch(_0x4fbe30){return BPromise['reject'](_0x4fbe30);}return _0x138e7d[_0x6d50('0x1a')]();};}function saveUpdates(_0x3e70b6,_0x582bca){return function(_0x48d452){if(_0x48d452){return _0x48d452['update'](_0x3e70b6)['then'](function(_0x171fa2){return _0x171fa2;});}return null;};}function removeEntity(_0x198cc5,_0x2095e3){return function(_0x35b711){if(_0x35b711){return _0x35b711[_0x6d50('0x1b')]()[_0x6d50('0x1c')](function(){_0x198cc5[_0x6d50('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee589,_0x3d4704){return function(_0x54d67e){if(!_0x54d67e){_0x1ee589[_0x6d50('0x11')](0x194);}return _0x54d67e;};}function handleError(_0xaa4971,_0x4ad017){_0x4ad017=_0x4ad017||0x1f4;return function(_0x5c6b39){logger[_0x6d50('0x1d')](_0x5c6b39[_0x6d50('0x1e')]);if(_0x5c6b39[_0x6d50('0x1f')]){delete _0x5c6b39['name'];}_0xaa4971['status'](_0x4ad017)[_0x6d50('0x20')](_0x5c6b39);};}exports[_0x6d50('0x21')]=function(_0x315be1,_0x1d1e73){var _0x377334={},_0x287d3c={},_0x151555={'count':0x0,'rows':[]};var _0x41d20b=_['map'](db[_0x6d50('0x22')][_0x6d50('0x23')],function(_0x24cb9b){return{'name':_0x24cb9b['fieldName'],'type':_0x24cb9b[_0x6d50('0x24')][_0x6d50('0x25')]};});_0x287d3c[_0x6d50('0x26')]=_[_0x6d50('0x27')](_0x41d20b,_0x6d50('0x1f'));_0x287d3c[_0x6d50('0x28')]=_[_0x6d50('0x29')](_0x315be1[_0x6d50('0x28')]);_0x287d3c[_0x6d50('0x2a')]=_[_0x6d50('0x2b')](_0x287d3c['model'],_0x287d3c[_0x6d50('0x28')]);_0x377334[_0x6d50('0x2c')]=_[_0x6d50('0x2b')](_0x287d3c[_0x6d50('0x26')],qs[_0x6d50('0x2d')](_0x315be1[_0x6d50('0x28')]['fields']));_0x377334[_0x6d50('0x2c')]=_0x377334[_0x6d50('0x2c')][_0x6d50('0x2e')]?_0x377334[_0x6d50('0x2c')]:_0x287d3c[_0x6d50('0x26')];if(!_0x315be1['query']['hasOwnProperty'](_0x6d50('0x2f'))){_0x377334[_0x6d50('0x16')]=qs['limit'](_0x315be1[_0x6d50('0x28')][_0x6d50('0x16')]);_0x377334[_0x6d50('0x14')]=qs[_0x6d50('0x14')](_0x315be1[_0x6d50('0x28')][_0x6d50('0x14')]);}_0x377334['order']=qs['sort'](_0x315be1[_0x6d50('0x28')][_0x6d50('0x30')]);_0x377334[_0x6d50('0x31')]=qs[_0x6d50('0x2a')](_[_0x6d50('0x32')](_0x315be1['query'],_0x287d3c[_0x6d50('0x2a')]),_0x41d20b);if(_0x315be1['query']['filter']){_0x377334['where']=_[_0x6d50('0x33')](_0x377334[_0x6d50('0x31')],{'$or':_[_0x6d50('0x27')](_0x41d20b,function(_0x55f4ca){if(_0x55f4ca['type']!==_0x6d50('0x34')){var _0x22c89b={};_0x22c89b[_0x55f4ca[_0x6d50('0x1f')]]={'$like':'%'+_0x315be1['query'][_0x6d50('0x35')]+'%'};return _0x22c89b;}})});}_0x377334=_[_0x6d50('0x33')]({},_0x377334,_0x315be1[_0x6d50('0x36')]);var _0x40fe26={'where':_0x377334[_0x6d50('0x31')]};return db['WhatsappTransferReport']['count'](_0x40fe26)[_0x6d50('0x1c')](function(_0x36fa13){_0x151555[_0x6d50('0x17')]=_0x36fa13;if(_0x315be1[_0x6d50('0x28')][_0x6d50('0x37')]){_0x377334[_0x6d50('0x38')]=[{'all':!![]}];}return db[_0x6d50('0x22')][_0x6d50('0x39')](_0x377334);})[_0x6d50('0x1c')](function(_0x2e82c3){_0x151555[_0x6d50('0x3a')]=_0x2e82c3;return _0x151555;})['then'](respondWithFilteredResult(_0x1d1e73,_0x377334))[_0x6d50('0x3b')](handleError(_0x1d1e73,null));};exports[_0x6d50('0x3c')]=function(_0x50bf8c,_0x435fff){var _0x5323d1={'raw':!![],'where':{'id':_0x50bf8c[_0x6d50('0x3d')]['id']}},_0x51fd2a={};_0x51fd2a['model']=_[_0x6d50('0x29')](db[_0x6d50('0x22')]['rawAttributes']);_0x51fd2a[_0x6d50('0x28')]=_[_0x6d50('0x29')](_0x50bf8c[_0x6d50('0x28')]);_0x51fd2a['filters']=_['intersection'](_0x51fd2a[_0x6d50('0x26')],_0x51fd2a[_0x6d50('0x28')]);_0x5323d1[_0x6d50('0x2c')]=_['intersection'](_0x51fd2a[_0x6d50('0x26')],qs[_0x6d50('0x2d')](_0x50bf8c[_0x6d50('0x28')][_0x6d50('0x2d')]));_0x5323d1[_0x6d50('0x2c')]=_0x5323d1['attributes'][_0x6d50('0x2e')]?_0x5323d1[_0x6d50('0x2c')]:_0x51fd2a[_0x6d50('0x26')];if(_0x50bf8c[_0x6d50('0x28')]['includeAll']){_0x5323d1['include']=[{'all':!![]}];}_0x5323d1=_[_0x6d50('0x33')]({},_0x5323d1,_0x50bf8c[_0x6d50('0x36')]);return db['WhatsappTransferReport']['find'](_0x5323d1)['then'](handleEntityNotFound(_0x435fff,null))['then'](respondWithResult(_0x435fff,null))[_0x6d50('0x3b')](handleError(_0x435fff,null));};exports[_0x6d50('0x3e')]=function(_0x3c9839,_0x574ab7){return db[_0x6d50('0x22')][_0x6d50('0x3e')](_0x3c9839[_0x6d50('0x3f')],{})['then'](respondWithResult(_0x574ab7,0xc9))[_0x6d50('0x3b')](handleError(_0x574ab7,null));};exports[_0x6d50('0x40')]=function(_0xd10795,_0x4b895a){if(_0xd10795['body']['id']){delete _0xd10795[_0x6d50('0x3f')]['id'];}return db[_0x6d50('0x22')][_0x6d50('0x41')]({'where':{'id':_0xd10795[_0x6d50('0x3d')]['id']}})[_0x6d50('0x1c')](handleEntityNotFound(_0x4b895a,null))[_0x6d50('0x1c')](saveUpdates(_0xd10795[_0x6d50('0x3f')],null))[_0x6d50('0x1c')](respondWithResult(_0x4b895a,null))[_0x6d50('0x3b')](handleError(_0x4b895a,null));};exports[_0x6d50('0x1b')]=function(_0x5306fa,_0x14ed34){return db[_0x6d50('0x22')][_0x6d50('0x41')]({'where':{'id':_0x5306fa[_0x6d50('0x3d')]['id']}})[_0x6d50('0x1c')](handleEntityNotFound(_0x14ed34,null))[_0x6d50('0x1c')](removeEntity(_0x14ed34,null))['catch'](handleError(_0x14ed34,null));};exports[_0x6d50('0x42')]=function(_0x3d832e,_0x428950){return db['WhatsappTransferReport']['describe']()[_0x6d50('0x1c')](respondWithResult(_0x428950,null))[_0x6d50('0x3b')](handleError(_0x428950,null));}; \ No newline at end of file +var _0xdd34=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../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','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','merge','where','options','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdd34,0x1db));var _0x4dd3=function(_0x424a38,_0x4b82f0){_0x424a38=_0x424a38-0x0;var _0x928447=_0xdd34[_0x424a38];return _0x928447;};'use strict';var emlformat=require(_0x4dd3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4dd3('0x1'));var rp=require('request-promise');var moment=require(_0x4dd3('0x2'));var BPromise=require(_0x4dd3('0x3'));var Mustache=require(_0x4dd3('0x4'));var util=require('util');var path=require(_0x4dd3('0x5'));var sox=require(_0x4dd3('0x6'));var csv=require(_0x4dd3('0x7'));var ejs=require(_0x4dd3('0x8'));var fs=require('fs');var fs_extra=require(_0x4dd3('0x9'));var _=require(_0x4dd3('0xa'));var squel=require(_0x4dd3('0xb'));var crypto=require(_0x4dd3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4dd3('0x7'));var querystring=require(_0x4dd3('0xd'));var Papa=require(_0x4dd3('0xe'));var Redis=require('ioredis');var authService=require(_0x4dd3('0xf'));var qs=require(_0x4dd3('0x10'));var as=require(_0x4dd3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dd3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4dd3('0x13'));var licenseUtil=require(_0x4dd3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b90e6,_0x555c2d){_0x555c2d=_0x555c2d||0xcc;return function(_0x283316){if(_0x283316){return _0x3b90e6[_0x4dd3('0x15')](_0x555c2d);}return _0x3b90e6[_0x4dd3('0x16')](_0x555c2d)[_0x4dd3('0x17')]();};}function respondWithResult(_0x2f12e9,_0x15adc1){_0x15adc1=_0x15adc1||0xc8;return function(_0x1c50b5){if(_0x1c50b5){return _0x2f12e9['status'](_0x15adc1)[_0x4dd3('0x18')](_0x1c50b5);}};}function respondWithFilteredResult(_0x3d0ee0,_0x546e77){return function(_0x18fc3e){if(_0x18fc3e){var _0x5a330a=typeof _0x546e77['offset']===_0x4dd3('0x19')&&typeof _0x546e77[_0x4dd3('0x1a')]===_0x4dd3('0x19');var _0x39895b=_0x18fc3e[_0x4dd3('0x1b')];var _0x12bc9b=_0x5a330a?0x0:_0x546e77[_0x4dd3('0x1c')];var _0x2d18fd=_0x5a330a?_0x18fc3e['count']:_0x546e77[_0x4dd3('0x1c')]+_0x546e77['limit'];var _0x58c46c;if(_0x2d18fd>=_0x39895b){_0x2d18fd=_0x39895b;_0x58c46c=0xc8;}else{_0x58c46c=0xce;}_0x3d0ee0['status'](_0x58c46c);return _0x3d0ee0[_0x4dd3('0x1d')](_0x4dd3('0x1e'),_0x12bc9b+'-'+_0x2d18fd+'/'+_0x39895b)[_0x4dd3('0x18')](_0x18fc3e);}return null;};}function patchUpdates(_0x4a1f6f){return function(_0x34c2c8){try{jsonpatch[_0x4dd3('0x1f')](_0x34c2c8,_0x4a1f6f,!![]);}catch(_0x15a108){return BPromise[_0x4dd3('0x20')](_0x15a108);}return _0x34c2c8[_0x4dd3('0x21')]();};}function saveUpdates(_0x3a18e1,_0x2ccd3c){return function(_0x2c5cd4){if(_0x2c5cd4){return _0x2c5cd4[_0x4dd3('0x22')](_0x3a18e1)[_0x4dd3('0x23')](function(_0x496eae){return _0x496eae;});}return null;};}function removeEntity(_0x2cb19a,_0x230915){return function(_0x480ca2){if(_0x480ca2){return _0x480ca2[_0x4dd3('0x24')]()[_0x4dd3('0x23')](function(){_0x2cb19a[_0x4dd3('0x16')](0xcc)[_0x4dd3('0x17')]();});}};}function handleEntityNotFound(_0x5a91ce,_0x5ba486){return function(_0x40577d){if(!_0x40577d){_0x5a91ce['sendStatus'](0x194);}return _0x40577d;};}function handleError(_0x1ee0f6,_0x2fecdc){_0x2fecdc=_0x2fecdc||0x1f4;return function(_0xcd086b){logger[_0x4dd3('0x25')](_0xcd086b['stack']);if(_0xcd086b[_0x4dd3('0x26')]){delete _0xcd086b[_0x4dd3('0x26')];}_0x1ee0f6[_0x4dd3('0x16')](_0x2fecdc)[_0x4dd3('0x27')](_0xcd086b);};}exports['index']=function(_0x49eb37,_0x164734){var _0x81fb1f={},_0x535189={},_0x2b2674={'count':0x0,'rows':[]};var _0x254e7a=_[_0x4dd3('0x28')](db['WhatsappTransferReport'][_0x4dd3('0x29')],function(_0x2a09ff){return{'name':_0x2a09ff[_0x4dd3('0x2a')],'type':_0x2a09ff['type'][_0x4dd3('0x2b')]};});_0x535189[_0x4dd3('0x2c')]=_[_0x4dd3('0x28')](_0x254e7a,_0x4dd3('0x26'));_0x535189[_0x4dd3('0x2d')]=_[_0x4dd3('0x2e')](_0x49eb37[_0x4dd3('0x2d')]);_0x535189[_0x4dd3('0x2f')]=_['intersection'](_0x535189[_0x4dd3('0x2c')],_0x535189[_0x4dd3('0x2d')]);_0x81fb1f['attributes']=_[_0x4dd3('0x30')](_0x535189[_0x4dd3('0x2c')],qs[_0x4dd3('0x31')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x31')]));_0x81fb1f['attributes']=_0x81fb1f[_0x4dd3('0x32')]['length']?_0x81fb1f[_0x4dd3('0x32')]:_0x535189[_0x4dd3('0x2c')];if(!_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x33')]('nolimit')){_0x81fb1f[_0x4dd3('0x1a')]=qs[_0x4dd3('0x1a')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x1a')]);_0x81fb1f[_0x4dd3('0x1c')]=qs['offset'](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x1c')]);}_0x81fb1f[_0x4dd3('0x34')]=qs[_0x4dd3('0x35')](_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x35')]);_0x81fb1f['where']=qs[_0x4dd3('0x2f')](_['pick'](_0x49eb37[_0x4dd3('0x2d')],_0x535189['filters']),_0x254e7a);if(_0x49eb37[_0x4dd3('0x2d')][_0x4dd3('0x36')]){_0x81fb1f['where']=_[_0x4dd3('0x37')](_0x81fb1f[_0x4dd3('0x38')],{'$or':_['map'](_0x254e7a,function(_0x482c87){if(_0x482c87['type']!=='VIRTUAL'){var _0x282254={};_0x282254[_0x482c87[_0x4dd3('0x26')]]={'$like':'%'+_0x49eb37['query'][_0x4dd3('0x36')]+'%'};return _0x282254;}})});}_0x81fb1f=_[_0x4dd3('0x37')]({},_0x81fb1f,_0x49eb37[_0x4dd3('0x39')]);var _0x19e61a={'where':_0x81fb1f[_0x4dd3('0x38')]};return db[_0x4dd3('0x3a')][_0x4dd3('0x1b')](_0x19e61a)[_0x4dd3('0x23')](function(_0x3a1831){_0x2b2674[_0x4dd3('0x1b')]=_0x3a1831;if(_0x49eb37['query'][_0x4dd3('0x3b')]){_0x81fb1f[_0x4dd3('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x4dd3('0x3d')](_0x81fb1f);})[_0x4dd3('0x23')](function(_0x441525){_0x2b2674['rows']=_0x441525;return _0x2b2674;})['then'](respondWithFilteredResult(_0x164734,_0x81fb1f))[_0x4dd3('0x3e')](handleError(_0x164734,null));};exports[_0x4dd3('0x3f')]=function(_0x8a3380,_0x27f578){var _0x4748e3={'raw':!![],'where':{'id':_0x8a3380[_0x4dd3('0x40')]['id']}},_0x1c39b6={};_0x1c39b6[_0x4dd3('0x2c')]=_[_0x4dd3('0x2e')](db[_0x4dd3('0x3a')][_0x4dd3('0x29')]);_0x1c39b6[_0x4dd3('0x2d')]=_[_0x4dd3('0x2e')](_0x8a3380[_0x4dd3('0x2d')]);_0x1c39b6[_0x4dd3('0x2f')]=_[_0x4dd3('0x30')](_0x1c39b6[_0x4dd3('0x2c')],_0x1c39b6[_0x4dd3('0x2d')]);_0x4748e3['attributes']=_['intersection'](_0x1c39b6[_0x4dd3('0x2c')],qs[_0x4dd3('0x31')](_0x8a3380[_0x4dd3('0x2d')][_0x4dd3('0x31')]));_0x4748e3[_0x4dd3('0x32')]=_0x4748e3[_0x4dd3('0x32')][_0x4dd3('0x41')]?_0x4748e3[_0x4dd3('0x32')]:_0x1c39b6[_0x4dd3('0x2c')];if(_0x8a3380[_0x4dd3('0x2d')]['includeAll']){_0x4748e3[_0x4dd3('0x3c')]=[{'all':!![]}];}_0x4748e3=_[_0x4dd3('0x37')]({},_0x4748e3,_0x8a3380[_0x4dd3('0x39')]);return db[_0x4dd3('0x3a')][_0x4dd3('0x42')](_0x4748e3)[_0x4dd3('0x23')](handleEntityNotFound(_0x27f578,null))[_0x4dd3('0x23')](respondWithResult(_0x27f578,null))[_0x4dd3('0x3e')](handleError(_0x27f578,null));};exports[_0x4dd3('0x43')]=function(_0x213a31,_0x436503){return db[_0x4dd3('0x3a')][_0x4dd3('0x43')](_0x213a31['body'],{})[_0x4dd3('0x23')](respondWithResult(_0x436503,0xc9))[_0x4dd3('0x3e')](handleError(_0x436503,null));};exports[_0x4dd3('0x22')]=function(_0xfa7551,_0x19299e){if(_0xfa7551[_0x4dd3('0x44')]['id']){delete _0xfa7551[_0x4dd3('0x44')]['id'];}return db['WhatsappTransferReport'][_0x4dd3('0x42')]({'where':{'id':_0xfa7551[_0x4dd3('0x40')]['id']}})[_0x4dd3('0x23')](handleEntityNotFound(_0x19299e,null))[_0x4dd3('0x23')](saveUpdates(_0xfa7551[_0x4dd3('0x44')],null))['then'](respondWithResult(_0x19299e,null))[_0x4dd3('0x3e')](handleError(_0x19299e,null));};exports['destroy']=function(_0x186856,_0x5c5a4a){return db[_0x4dd3('0x3a')][_0x4dd3('0x42')]({'where':{'id':_0x186856[_0x4dd3('0x40')]['id']}})[_0x4dd3('0x23')](handleEntityNotFound(_0x5c5a4a,null))[_0x4dd3('0x23')](removeEntity(_0x5c5a4a,null))['catch'](handleError(_0x5c5a4a,null));};exports[_0x4dd3('0x45')]=function(_0x13ed34,_0x4182af){return db[_0x4dd3('0x3a')][_0x4dd3('0x45')]()[_0x4dd3('0x23')](respondWithResult(_0x4182af,null))[_0x4dd3('0x3e')](handleError(_0x4182af,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 313b160..9d8ac29 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 _0xe980=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x27acbf,_0xe7afec){var _0xf93fc8=function(_0x1a91f7){while(--_0x1a91f7){_0x27acbf['push'](_0x27acbf['shift']());}};_0xf93fc8(++_0xe7afec);}(_0xe980,0x132));var _0x0e98=function(_0x8bb4d2,_0x3b48d){_0x8bb4d2=_0x8bb4d2-0x0;var _0x2d0e0c=_0xe980[_0x8bb4d2];return _0x2d0e0c;};'use strict';var _=require(_0x0e98('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0e98('0x1'));var BPromise=require(_0x0e98('0x2'));var rp=require(_0x0e98('0x3'));var fs=require('fs');var path=require(_0x0e98('0x4'));var rimraf=require(_0x0e98('0x5'));var config=require('../../config/environment');var attributes=require(_0x0e98('0x6'));module[_0x0e98('0x7')]=function(_0x11c607,_0x28bbbc){return _0x11c607[_0x0e98('0x8')](_0x0e98('0x9'),attributes,{'tableName':_0x0e98('0xa'),'paranoid':![],'indexes':[{'name':_0x0e98('0xb'),'fields':[_0x0e98('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9248=['moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9248,0xc1));var _0x8924=function(_0x576e1a,_0x1b28cb){_0x576e1a=_0x576e1a-0x0;var _0x56d579=_0x9248[_0x576e1a];return _0x56d579;};'use strict';var _=require(_0x8924('0x0'));var util=require('util');var logger=require(_0x8924('0x1'))(_0x8924('0x2'));var moment=require(_0x8924('0x3'));var BPromise=require(_0x8924('0x4'));var rp=require(_0x8924('0x5'));var fs=require('fs');var path=require(_0x8924('0x6'));var rimraf=require(_0x8924('0x7'));var config=require('../../config/environment');var attributes=require(_0x8924('0x8'));module[_0x8924('0x9')]=function(_0x1e42fd,_0x33a962){return _0x1e42fd[_0x8924('0xa')](_0x8924('0xb'),attributes,{'tableName':_0x8924('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8924('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e1f787f..1d9a756 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 _0xf979=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x5aaf95,_0x5e8f9b){var _0x1eb0c5=function(_0x593d43){while(--_0x593d43){_0x5aaf95['push'](_0x5aaf95['shift']());}};_0x1eb0c5(++_0x5e8f9b);}(_0xf979,0xb4));var _0x9f97=function(_0x42330a,_0x57455f){_0x42330a=_0x42330a-0x0;var _0x327521=_0xf979[_0x42330a];return _0x327521;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9f97('0x0'));var rs=require(_0x9f97('0x1'));var fs=require('fs');var Redis=require(_0x9f97('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f97('0x3'));var logger=require(_0x9f97('0x4'))(_0x9f97('0x5'));var config=require(_0x9f97('0x6'));var jayson=require(_0x9f97('0x7'));var client=jayson[_0x9f97('0x8')][_0x9f97('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee53f,_0xab1e21,_0x57f7a1){return new BPromise(function(_0x397a4d,_0x6bc230){return client[_0x9f97('0xa')](_0x1ee53f,_0x57f7a1)['then'](function(_0x1916f0){logger[_0x9f97('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0xab1e21,_0x9f97('0xc'));logger[_0x9f97('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xab1e21,_0x9f97('0xc'),JSON[_0x9f97('0xe')](_0x1916f0));if(_0x1916f0['error']){if(_0x1916f0[_0x9f97('0xf')]['code']===0x1f4){logger[_0x9f97('0xf')](_0x9f97('0x10'),_0xab1e21,_0x1916f0[_0x9f97('0xf')][_0x9f97('0x11')]);return _0x6bc230(_0x1916f0[_0x9f97('0xf')][_0x9f97('0x11')]);}logger[_0x9f97('0xf')](_0x9f97('0x10'),_0xab1e21,_0x1916f0[_0x9f97('0xf')]['message']);return _0x397a4d(_0x1916f0[_0x9f97('0xf')]['message']);}else{logger[_0x9f97('0xb')](_0x9f97('0x10'),_0xab1e21,_0x9f97('0xc'));_0x397a4d(_0x1916f0['result'][_0x9f97('0x11')]);}})['catch'](function(_0x32c327){logger['error'](_0x9f97('0x10'),_0xab1e21,_0x32c327);_0x6bc230(_0x32c327);});});} \ No newline at end of file +var _0xe7d6=['client','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0xe7d6,0x14e));var _0x6e7d=function(_0x384cf4,_0x36d5f4){_0x384cf4=_0x384cf4-0x0;var _0x2918c7=_0xe7d6[_0x384cf4];return _0x2918c7;};'use strict';var _=require(_0x6e7d('0x0'));var util=require('util');var moment=require(_0x6e7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e7d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e7d('0x3'));var logger=require(_0x6e7d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e7d('0x5'));var client=jayson[_0x6e7d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54ff84,_0x45d3b1,_0x65ad3b){return new BPromise(function(_0x2a6083,_0x22b597){return client['request'](_0x54ff84,_0x65ad3b)['then'](function(_0x4672c8){logger[_0x6e7d('0x7')](_0x6e7d('0x8'),_0x45d3b1,_0x6e7d('0x9'));logger[_0x6e7d('0xa')](_0x6e7d('0xb'),_0x45d3b1,_0x6e7d('0x9'),JSON[_0x6e7d('0xc')](_0x4672c8));if(_0x4672c8['error']){if(_0x4672c8[_0x6e7d('0xd')]['code']===0x1f4){logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x4672c8[_0x6e7d('0xd')][_0x6e7d('0xe')]);return _0x22b597(_0x4672c8[_0x6e7d('0xd')][_0x6e7d('0xe')]);}logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x4672c8['error'][_0x6e7d('0xe')]);return _0x2a6083(_0x4672c8[_0x6e7d('0xd')]['message']);}else{logger[_0x6e7d('0x7')](_0x6e7d('0x8'),_0x45d3b1,_0x6e7d('0x9'));_0x2a6083(_0x4672c8[_0x6e7d('0xf')][_0x6e7d('0xe')]);}})[_0x6e7d('0x10')](function(_0x59d5dc){logger[_0x6e7d('0xd')](_0x6e7d('0x8'),_0x45d3b1,_0x59d5dc);_0x22b597(_0x59d5dc);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ea89ef3..dd01145 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8efc=['Offline\x20apps:','map','status','online','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./config/seedDB','./rpc','./config/logger','app','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','start','info','filter','exitCode','number','length','pm2_env','name'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x8efc,0x8f));var _0xc8ef=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x8efc[_0x12d6c2];return _0x1c9825;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0xc8ef('0x0'));var checkLicense=require('./config/license');var rpc=require(_0xc8ef('0x1'));var config=require('./config/environment');var logger=require(_0xc8ef('0x2'))(_0xc8ef('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xc8ef('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xc8ef('0x5'));var transcribe=require(_0xc8ef('0x6'));var provider=require(_0xc8ef('0x7'));function main(){return db[_0xc8ef('0x8')][_0xc8ef('0x9')]()['then'](function(){if(config[_0xc8ef('0xa')]){return seedDb['default']();}})[_0xc8ef('0xb')](function(){return checkLicense[_0xc8ef('0xc')]();})[_0xc8ef('0xb')](function(){return rpc[_0xc8ef('0xd')]();})['then'](function(_0x504d31){logger['info'](_0x504d31);return chat[_0xc8ef('0xe')]();})[_0xc8ef('0xb')](function(){return whatsapp[_0xc8ef('0xe')]();})[_0xc8ef('0xb')](function(){return schedule['start']();})[_0xc8ef('0xb')](function(){return transcribe[_0xc8ef('0xe')]();})[_0xc8ef('0xb')](function(){return provider[_0xc8ef('0xe')]();})[_0xc8ef('0xb')](function(_0x242be4){logger[_0xc8ef('0xf')](_0x242be4);return pm2[_0xc8ef('0xe')](pm2Config);})['then'](function(_0x562685){var _0xc4572e=_0x562685[_0xc8ef('0x10')](function(_0x3ff131){return typeof _0x3ff131[_0xc8ef('0x11')]===_0xc8ef('0x12')&&_0x3ff131[_0xc8ef('0x11')]>=0x0;});if(_0xc4572e[_0xc8ef('0x13')]>0x0){throw new Error(_0xc4572e[_0xc8ef('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0xc4572e,function(_0x38cad6){return'\x22'+_0x38cad6[_0xc8ef('0x14')][_0xc8ef('0x15')]+'\x22';}));}logger[_0xc8ef('0xf')]('Online\x20apps:',_['map'](_['filter'](_0x562685,{'status':'online'}),_0xc8ef('0x15'))['join']());logger[_0xc8ef('0xf')](_0xc8ef('0x16'),_[_0xc8ef('0x17')](_['filter'](_0x562685,function(_0x3a75ed){return _0x3a75ed[_0xc8ef('0x18')]!==_0xc8ef('0x19');}),_0xc8ef('0x15'))[_0xc8ef('0x1a')]()||_0xc8ef('0x1b'));console[_0xc8ef('0x1c')](_0xc8ef('0x1d'));})[_0xc8ef('0x1e')](function(_0x2dd230){console[_0xc8ef('0x1c')](_0xc8ef('0x1f'),_0x2dd230);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2dd230);process[_0xc8ef('0x20')](0x1);});}main(); \ No newline at end of file +var _0x975f=['./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','online','name','Offline\x20apps:','join','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config'];(function(_0x1acefc,_0x5da0bf){var _0x543527=function(_0x27040d){while(--_0x27040d){_0x1acefc['push'](_0x1acefc['shift']());}};_0x543527(++_0x5da0bf);}(_0x975f,0x109));var _0xf975=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x975f[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0xf975('0x0'));var db=require(_0xf975('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xf975('0x2'));var config=require(_0xf975('0x3'));var logger=require('./config/logger')(_0xf975('0x4'));var pm2=require(_0xf975('0x5'));var pm2Config=require(_0xf975('0x6'));var schedule=require(_0xf975('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf975('0x8'));var transcribe=require(_0xf975('0x9'));var provider=require(_0xf975('0xa'));function main(){return db[_0xf975('0xb')]['sync']()[_0xf975('0xc')](function(){if(config[_0xf975('0xd')]){return seedDb[_0xf975('0xe')]();}})['then'](function(){return checkLicense[_0xf975('0xe')]();})[_0xf975('0xc')](function(){return rpc['listen']();})[_0xf975('0xc')](function(_0x13af53){logger[_0xf975('0xf')](_0x13af53);return chat[_0xf975('0x10')]();})[_0xf975('0xc')](function(){return whatsapp[_0xf975('0x10')]();})[_0xf975('0xc')](function(){return schedule['start']();})[_0xf975('0xc')](function(){return transcribe[_0xf975('0x10')]();})['then'](function(){return provider[_0xf975('0x10')]();})[_0xf975('0xc')](function(_0x12d0e8){logger[_0xf975('0xf')](_0x12d0e8);return pm2[_0xf975('0x10')](pm2Config);})[_0xf975('0xc')](function(_0xa84361){var _0x525e4a=_0xa84361[_0xf975('0x11')](function(_0x5e63c1){return typeof _0x5e63c1['exitCode']===_0xf975('0x12')&&_0x5e63c1[_0xf975('0x13')]>=0x0;});if(_0x525e4a[_0xf975('0x14')]>0x0){throw new Error(_0x525e4a[_0xf975('0x14')]+_0xf975('0x15')+_[_0xf975('0x16')](_0x525e4a,function(_0x2cffb6){return'\x22'+_0x2cffb6['pm2_env']['name']+'\x22';}));}logger[_0xf975('0xf')](_0xf975('0x17'),_[_0xf975('0x16')](_[_0xf975('0x11')](_0xa84361,{'status':_0xf975('0x18')}),_0xf975('0x19'))['join']());logger[_0xf975('0xf')](_0xf975('0x1a'),_[_0xf975('0x16')](_[_0xf975('0x11')](_0xa84361,function(_0x4fb599){return _0x4fb599['status']!==_0xf975('0x18');}),_0xf975('0x19'))[_0xf975('0x1b')]()||_0xf975('0x1c'));console[_0xf975('0x1d')]('App\x20Ready!');})[_0xf975('0x1e')](function(_0x2906ce){console[_0xf975('0x1d')](_0xf975('0x1f'),_0x2906ce);logger['error'](_0xf975('0x20'),_0x2906ce);process[_0xf975('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6a24768..59b1151 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 _0xc7d0=['faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','query','forceDownload','status','Unmanaged.','catch','headers','authorization','User','authenticate','pass','json','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','findOne','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','use','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','floor','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xc7d0,0x16a));var _0x0c7d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc7d0[_0x57b54c];return _0x59cc19;};'use strict';var db=require(_0x0c7d('0x0'))['db'];var config=require(_0x0c7d('0x1'));var hardwareConf=require(_0x0c7d('0x2'));var licenseUtil=require(_0x0c7d('0x3'));var encryptor=require(_0x0c7d('0x4'));var _=require(_0x0c7d('0x5'));var jwt=require(_0x0c7d('0x6'));var expressJwt=require(_0x0c7d('0x7'));var compose=require(_0x0c7d('0x8'));var basicAuth=require(_0x0c7d('0x9'));var crypto=require(_0x0c7d('0xa'));var BPromise=require(_0x0c7d('0xb'));var util=require('util');var moment=require(_0x0c7d('0xc'));var validateJwt=expressJwt({'secret':config[_0x0c7d('0xd')][_0x0c7d('0xe')]});var userAttributes=['id',_0x0c7d('0xf'),_0x0c7d('0x10'),_0x0c7d('0x11'),'internal',_0x0c7d('0x12'),_0x0c7d('0x13'),_0x0c7d('0x14'),_0x0c7d('0x15'),_0x0c7d('0x16'),_0x0c7d('0x17'),_0x0c7d('0x18'),_0x0c7d('0x19'),_0x0c7d('0x1a'),'openchannelPause',_0x0c7d('0x1b'),_0x0c7d('0x1c'),_0x0c7d('0x1d'),_0x0c7d('0x1e'),'crudPermissions',_0x0c7d('0x1f'),_0x0c7d('0x20'),_0x0c7d('0x21'),_0x0c7d('0x22'),'phoneBarAutoAnswerDelay',_0x0c7d('0x23'),'phoneBarEnableRecording',_0x0c7d('0x24'),'phoneBarEnableSettings',_0x0c7d('0x25'),_0x0c7d('0x26'),_0x0c7d('0x27'),_0x0c7d('0x28'),_0x0c7d('0x29'),_0x0c7d('0x2a'),_0x0c7d('0x2b'),_0x0c7d('0x2c'),_0x0c7d('0x2d'),_0x0c7d('0x2e'),_0x0c7d('0x2f'),'downloadOmnichannelInteractions',_0x0c7d('0x30'),_0x0c7d('0x31'),_0x0c7d('0x32'),_0x0c7d('0x33'),_0x0c7d('0x34'),_0x0c7d('0x35'),_0x0c7d('0x36'),'smsAutoanswer','smsAutoanswerDelay',_0x0c7d('0x37'),_0x0c7d('0x38'),_0x0c7d('0x39'),_0x0c7d('0x3a'),_0x0c7d('0x3b'),_0x0c7d('0x3c'),_0x0c7d('0x3d')];exports[_0x0c7d('0x3e')]=function(){return this[_0x0c7d('0x3f')](!![])['use'](function(_0x12db5b,_0x3fbd71,_0x13d110){if(_0x12db5b[_0x0c7d('0x40')]){_0x13d110();}else{return db[_0x0c7d('0x41')]['findOne']({'where':{'id':_0x12db5b[_0x0c7d('0x42')]['id']},'attributes':['id','closed',_0x0c7d('0x43')],'raw':!![]})[_0x0c7d('0x44')](function(_0x24322f){if(_0x24322f&&_0x24322f[_0x0c7d('0x45')]&&!_0x12db5b[_0x0c7d('0x46')][_0x0c7d('0x47')]){return _0x3fbd71[_0x0c7d('0x48')](_0x24322f[_0x0c7d('0x43')]==='unmanaged'?0x195:0x193)['json']({'message':_0x24322f[_0x0c7d('0x43')]==='unmanaged'?_0x0c7d('0x49'):'Forbidden.'});}else{_0x13d110();}})[_0x0c7d('0x4a')](function(_0x2a3888){_0x13d110(_0x2a3888);});}});};exports['isAuthenticated']=function isAuthenticated(_0x13965a){return compose()['use'](function(_0xebd81a,_0x18a8c9,_0x48dd4f){var _0x95f7b4;if(_0xebd81a[_0x0c7d('0x4b')][_0x0c7d('0x4c')]){if(_['startsWith'](_0xebd81a[_0x0c7d('0x4b')][_0x0c7d('0x4c')],'Basic')){var _0xfd0d7=basicAuth(_0xebd81a);db[_0x0c7d('0x4d')]['find']({'where':{'name':_0xfd0d7['name']}})['then'](function(_0x449f21){if(!_0x449f21||!_0x449f21[_0x0c7d('0x4e')](_0xfd0d7[_0x0c7d('0x4f')])){return _0x18a8c9['status'](0x191)[_0x0c7d('0x50')]({'message':_0x0c7d('0x51')});}_0xebd81a['user']={'id':_0x449f21['id']};_0x48dd4f();})['catch'](function(_0x3ad9a2){_0x48dd4f(_0x3ad9a2);});}else if(_[_0x0c7d('0x52')](_0xebd81a[_0x0c7d('0x4b')][_0x0c7d('0x4c')],_0x0c7d('0x53'))){validateJwt(_0xebd81a,_0x18a8c9,_0x48dd4f);}else{if(_0x13965a){_0x48dd4f();}else{return _0x18a8c9[_0x0c7d('0x48')](0x193)[_0x0c7d('0x50')]({'message':_0x0c7d('0x54')});}}}else if(_0xebd81a[_0x0c7d('0x46')][_0x0c7d('0x55')]){try{var _0x9dcb2e={'audience':hardwareConf[_0x0c7d('0x56')](),'issuer':hardwareConf[_0x0c7d('0x56')]()};verifyJwt(_0xebd81a[_0x0c7d('0x46')][_0x0c7d('0x55')],_0x9dcb2e)['then'](function(_0x1167e6){return db['User'][_0x0c7d('0x57')]({'where':{'id':_0x1167e6[_0x0c7d('0x58')]}})[_0x0c7d('0x44')](function(_0x307043){_0x95f7b4=_0x307043;return db[_0x0c7d('0x59')][_0x0c7d('0x5a')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x0c7d('0x44')](function(_0x409b90){if(!_0x95f7b4||!_[_0x0c7d('0x5b')](_0x95f7b4[_0x0c7d('0x5c')],_0x1167e6[_0x0c7d('0x5d')])){return _0x18a8c9['status'](0x191)[_0x0c7d('0x50')]({'message':_0x0c7d('0x5e')});}if(_0x95f7b4[_0x0c7d('0x5f')]){return _0x18a8c9[_0x0c7d('0x48')](0x191)['json']({'message':_0x0c7d('0x60')});}if(_0x95f7b4[_0x0c7d('0x61')]){if(_0x409b90['blockDuration']>0x0){if(moment(_0x95f7b4[_0x0c7d('0x62')])[_0x0c7d('0x63')](_0x409b90['blockDuration'],'minutes')>moment()){return _0x18a8c9[_0x0c7d('0x48')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x18a8c9[_0x0c7d('0x48')](0x191)['json']({'message':_0x0c7d('0x60')});}}_0xebd81a[_0x0c7d('0x40')]={'id':_0x95f7b4['id']};_0x48dd4f();});})[_0x0c7d('0x4a')](function(){return _0x18a8c9['status'](0x191)[_0x0c7d('0x50')]({'message':_0x0c7d('0x60')});});}catch(_0xa64ab0){_0x48dd4f(_0xa64ab0);}}else if(_0x13965a){_0x48dd4f();}else{return _0x18a8c9['status'](0x193)[_0x0c7d('0x50')]({'message':'Unknown\x20authorization\x20format'});}})[_0x0c7d('0x64')](function(_0x3cb6dd,_0x3c00dd,_0x553341){if(_0x3cb6dd['user']){db[_0x0c7d('0x4d')][_0x0c7d('0x57')]({'where':{'id':_0x3cb6dd[_0x0c7d('0x40')]['id']},'attributes':userAttributes})[_0x0c7d('0x44')](function(_0x42e2b2){if(!_0x42e2b2){return _0x3c00dd['status'](0x194)[_0x0c7d('0x50')]({'message':_0x0c7d('0x65')});}_0x3cb6dd['user']=_0x42e2b2;_0x553341();})[_0x0c7d('0x4a')](function(_0x32663d){_0x553341(_0x32663d);});}else if(_0x13965a){_0x553341();}else{return _0x3c00dd[_0x0c7d('0x48')](0x194)[_0x0c7d('0x50')]({'message':_0x0c7d('0x66')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x0c7d('0x64')](function(_0x395221,_0x2b89f4,_0x2015c9){return licenseUtil[_0x0c7d('0x67')]()['then'](function(_0x4ec85e){if(_0x4ec85e['update']){_0x2015c9();}else{return _0x2b89f4['status'](0x193)[_0x0c7d('0x50')]({'message':_0x0c7d('0x68')});}})[_0x0c7d('0x4a')](function(_0x42ca25){_0x2015c9(_0x42ca25);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x0c7d('0x64')](function(_0x59feb1,_0x43ef95,_0x3ed8fc){return licenseUtil[_0x0c7d('0x67')]()['then'](function(_0x5afe27){if(_0x5afe27[_0x0c7d('0x69')]){_0x3ed8fc();}else{return _0x43ef95['status'](0x193)[_0x0c7d('0x50')]({'message':_0x0c7d('0x68')});}})[_0x0c7d('0x4a')](function(_0x3da7bf){_0x3ed8fc(_0x3da7bf);});});};exports[_0x0c7d('0x6a')]=function(_0x497052,_0x5ec622,_0x2cb366){_0x497052[_0x0c7d('0x6a')]=!![];return _0x2cb366();};exports['signToken']=function signToken(_0x459916){return signJwt(_0x459916);};exports[_0x0c7d('0x6b')]=function(_0x13f22a,_0x539b01){if(!_0x13f22a[_0x0c7d('0x40')]){return _0x539b01[_0x0c7d('0x48')](0x194)[_0x0c7d('0x50')]({'message':_0x0c7d('0x6c')});}var _0x5225ad={'payload':{'id':_0x13f22a['user']['id'],'role':_0x13f22a[_0x0c7d('0x40')][_0x0c7d('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5225ad)[_0x0c7d('0x44')](function(_0x387b10){_0x539b01[_0x0c7d('0x6d')](_0x0c7d('0x6e'),_0x387b10);_0x539b01[_0x0c7d('0x6f')](_0x0c7d('0x70'));})['catch'](function(_0x211f5d){return _0x539b01['status'](0x1f4)[_0x0c7d('0x71')](_0x211f5d);});};exports[_0x0c7d('0x72')]=function(_0x4cbd85){if(_[_0x0c7d('0x73')](_0x4cbd85[_0x0c7d('0x5c')])||_[_0x0c7d('0x73')](_0x4cbd85[_0x0c7d('0x74')])){return null;}else{return createJwt(_0x4cbd85);}};exports[_0x0c7d('0x75')]=function(_0x1a8f5d){_0x1a8f5d[_0x0c7d('0x5c')]=generateNonce();_0x1a8f5d['apiKeyIat']=generateIssuedAt();return createJwt(_0x1a8f5d);};exports['regenerateApiKey']=function(_0x4a1dc8,_0x143898){var _0x2249c4=_0x4a1dc8[_0x0c7d('0x46')]['apikey'];if(_0x2249c4){var _0xa4f21f={'nonce':_0x143898[_0x0c7d('0x5c')],'iat':_0x143898[_0x0c7d('0x74')],'audience':hardwareConf[_0x0c7d('0x56')](),'issuer':hardwareConf[_0x0c7d('0x56')]()};return verifyJwt(_0x2249c4,_0xa4f21f)[_0x0c7d('0x44')](function(){return generateApiKey(_0x143898);});}else{throw{'message':_0x0c7d('0x76')};}};exports['validatePasswordPattern']=function(_0x46f19a){var _0x1ec447=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ec447[_0x0c7d('0x77')](_0x46f19a))throw new db[(_0x0c7d('0x78'))][(_0x0c7d('0x79'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x0c7d('0x7a')]=function(_0x2c8ce2,_0x3c1981,_0x30687e){var _0xff1943=encryptor[_0x0c7d('0x7b')](_0x3c1981)[_0x0c7d('0x7c')](',');for(var _0x11b509=0x0;_0x11b509<_0x30687e;_0x11b509++){if(!_0xff1943[_0x11b509])break;if(_0x2c8ce2['toLowerCase']()===_0xff1943[_0x11b509][_0x0c7d('0x7d')]()){var _0x585eca=util[_0x0c7d('0x7e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x30687e);if(_0x30687e===0x1){_0x585eca=_0x0c7d('0x7f');}throw new db[(_0x0c7d('0x78'))][(_0x0c7d('0x79'))](_0x585eca);}}return;};exports[_0x0c7d('0x80')]=function(_0x22b434,_0x3bdf26){var _0x1bcf10=_0x3bdf26?encryptor['decryptString'](_0x3bdf26)[_0x0c7d('0x7c')](','):[];if(_0x1bcf10[_0x0c7d('0x81')]===0x5){_0x1bcf10[_0x0c7d('0x82')](-0x1,0x1);}_0x1bcf10['unshift'](_0x22b434);return encryptor[_0x0c7d('0x83')](_0x1bcf10['join'](','));};function signJwt(_0x1528d5){var _0x365561=BPromise[_0x0c7d('0x84')](jwt[_0x0c7d('0x85')],{'context':jwt});var _0x14b632=_0x1528d5[_0x0c7d('0x86')]||config[_0x0c7d('0xd')][_0x0c7d('0xe')];return new BPromise(function(_0x43a9d4,_0x51d129){_0x365561(_0x1528d5[_0x0c7d('0x87')],_0x14b632,_0x1528d5[_0x0c7d('0x88')])[_0x0c7d('0x44')](function(_0x4e5fe6){_0x43a9d4(_0x4e5fe6);})[_0x0c7d('0x4a')](function(_0x61911c){_0x51d129(_0x61911c);});});}function verifyJwt(_0x44428c,_0x2ad10f,_0xee1d61){var _0x3f39a6=BPromise[_0x0c7d('0x84')](jwt['verify'],{'context':jwt});var _0x15c664=_0xee1d61||config[_0x0c7d('0xd')][_0x0c7d('0xe')];return new BPromise(function(_0x16db52,_0x25546e){_0x3f39a6(_0x44428c,_0x15c664,_0x2ad10f)['then'](function(_0x5922cc){_0x16db52(_0x5922cc);})[_0x0c7d('0x4a')](function(_0x4542f9){_0x25546e(_0x4542f9);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x0c7d('0x89')](Date[_0x0c7d('0x8a')]()/0x3e8)[_0x0c7d('0x8b')]();}function createJwt(_0xcc932e){var _0x5dd6f4={'payload':{'iat':_0xcc932e[_0x0c7d('0x74')],'nonce':_0xcc932e[_0x0c7d('0x5c')]},'options':{'algorithm':'HS512','subject':_0xcc932e['id'][_0x0c7d('0x8b')](),'issuer':hardwareConf[_0x0c7d('0x56')](),'audience':hardwareConf[_0x0c7d('0x56')]()}};return signJwt(_0x5dd6f4)[_0x0c7d('0x44')](function(_0x3bc319){return{'iat':_0xcc932e['apiKeyIat'],'nonce':_0xcc932e[_0x0c7d('0x5c')],'token':_0x3bc319};});} \ No newline at end of file +var _0x0fc2=['alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','use','headers','authorization','startsWith','Basic','User','find','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','secrets','session','role','fullname','name','email','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt'];(function(_0x49434f,_0x1d1eb5){var _0x246d04=function(_0xa0a69b){while(--_0xa0a69b){_0x49434f['push'](_0x49434f['shift']());}};_0x246d04(++_0x1d1eb5);}(_0x0fc2,0x70));var _0x20fc=function(_0x1833dc,_0x11b4cd){_0x1833dc=_0x1833dc-0x0;var _0x4905e0=_0x0fc2[_0x1833dc];return _0x4905e0;};'use strict';var db=require(_0x20fc('0x0'))['db'];var config=require(_0x20fc('0x1'));var hardwareConf=require(_0x20fc('0x2'));var licenseUtil=require(_0x20fc('0x3'));var encryptor=require(_0x20fc('0x4'));var _=require(_0x20fc('0x5'));var jwt=require(_0x20fc('0x6'));var expressJwt=require(_0x20fc('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x20fc('0x8'));var crypto=require(_0x20fc('0x9'));var BPromise=require('bluebird');var util=require(_0x20fc('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x20fc('0xb')][_0x20fc('0xc')]});var userAttributes=['id',_0x20fc('0xd'),_0x20fc('0xe'),_0x20fc('0xf'),'internal',_0x20fc('0x10'),'userpic',_0x20fc('0x11'),_0x20fc('0x12'),_0x20fc('0x13'),'chatPause',_0x20fc('0x14'),_0x20fc('0x15'),_0x20fc('0x16'),_0x20fc('0x17'),_0x20fc('0x18'),_0x20fc('0x19'),_0x20fc('0x1a'),_0x20fc('0x1b'),_0x20fc('0x1c'),_0x20fc('0x1d'),_0x20fc('0x1e'),_0x20fc('0x1f'),'phoneBarAutoAnswer',_0x20fc('0x20'),_0x20fc('0x21'),_0x20fc('0x22'),'phoneBarEnableDtmfTone',_0x20fc('0x23'),_0x20fc('0x24'),_0x20fc('0x25'),_0x20fc('0x26'),_0x20fc('0x27'),_0x20fc('0x28'),_0x20fc('0x29'),_0x20fc('0x2a'),_0x20fc('0x2b'),_0x20fc('0x2c'),_0x20fc('0x2d'),_0x20fc('0x2e'),_0x20fc('0x2f'),_0x20fc('0x30'),'ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer',_0x20fc('0x31'),_0x20fc('0x32'),_0x20fc('0x33'),_0x20fc('0x34'),_0x20fc('0x35'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x20fc('0x36'),'faxAutoanswerDelay',_0x20fc('0x37'),'whatsappAutoanswerDelay',_0x20fc('0x38')];exports[_0x20fc('0x39')]=function(){return this[_0x20fc('0x3a')](!![])['use'](function(_0xd156fa,_0xff38d1,_0x20e865){if(_0xd156fa[_0x20fc('0x3b')]){_0x20e865();}else{return db[_0x20fc('0x3c')][_0x20fc('0x3d')]({'where':{'id':_0xd156fa[_0x20fc('0x3e')]['id']},'attributes':['id',_0x20fc('0x3f'),_0x20fc('0x40')],'raw':!![]})[_0x20fc('0x41')](function(_0xe8fe11){if(_0xe8fe11&&_0xe8fe11[_0x20fc('0x3f')]&&!_0xd156fa['query']['forceDownload']){return _0xff38d1[_0x20fc('0x42')](_0xe8fe11['disposition']===_0x20fc('0x43')?0x195:0x193)[_0x20fc('0x44')]({'message':_0xe8fe11['disposition']===_0x20fc('0x43')?_0x20fc('0x45'):'Forbidden.'});}else{_0x20e865();}})[_0x20fc('0x46')](function(_0xfcb781){_0x20e865(_0xfcb781);});}});};exports[_0x20fc('0x3a')]=function isAuthenticated(_0x19f50d){return compose()[_0x20fc('0x47')](function(_0x1317c4,_0x1943ee,_0x37c75c){var _0x46a9aa;if(_0x1317c4[_0x20fc('0x48')][_0x20fc('0x49')]){if(_[_0x20fc('0x4a')](_0x1317c4['headers'][_0x20fc('0x49')],_0x20fc('0x4b'))){var _0x76746d=basicAuth(_0x1317c4);db[_0x20fc('0x4c')][_0x20fc('0x4d')]({'where':{'name':_0x76746d['name']}})[_0x20fc('0x41')](function(_0x285567){if(!_0x285567||!_0x285567['authenticate'](_0x76746d['pass'])){return _0x1943ee[_0x20fc('0x42')](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x4e')});}_0x1317c4[_0x20fc('0x3b')]={'id':_0x285567['id']};_0x37c75c();})['catch'](function(_0x4e7ba4){_0x37c75c(_0x4e7ba4);});}else if(_['startsWith'](_0x1317c4[_0x20fc('0x48')][_0x20fc('0x49')],'Bearer')){validateJwt(_0x1317c4,_0x1943ee,_0x37c75c);}else{if(_0x19f50d){_0x37c75c();}else{return _0x1943ee[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':_0x20fc('0x4f')});}}}else if(_0x1317c4[_0x20fc('0x50')][_0x20fc('0x51')]){try{var _0x529976={'audience':hardwareConf[_0x20fc('0x52')](),'issuer':hardwareConf[_0x20fc('0x52')]()};verifyJwt(_0x1317c4['query'][_0x20fc('0x51')],_0x529976)[_0x20fc('0x41')](function(_0x22d044){return db[_0x20fc('0x4c')][_0x20fc('0x4d')]({'where':{'id':_0x22d044[_0x20fc('0x53')]}})[_0x20fc('0x41')](function(_0x341f2f){_0x46a9aa=_0x341f2f;return db[_0x20fc('0x54')][_0x20fc('0x3d')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x301fd4){if(!_0x46a9aa||!_['isEqual'](_0x46a9aa[_0x20fc('0x55')],_0x22d044[_0x20fc('0x56')])){return _0x1943ee['status'](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x57')});}if(_0x46a9aa[_0x20fc('0x58')]){return _0x1943ee[_0x20fc('0x42')](0x191)['json']({'message':_0x20fc('0x59')});}if(_0x46a9aa[_0x20fc('0x5a')]){if(_0x301fd4[_0x20fc('0x5b')]>0x0){if(moment(_0x46a9aa[_0x20fc('0x5c')])[_0x20fc('0x5d')](_0x301fd4[_0x20fc('0x5b')],_0x20fc('0x5e'))>moment()){return _0x1943ee[_0x20fc('0x42')](0x191)[_0x20fc('0x44')]({'message':_0x20fc('0x59')});}}else{return _0x1943ee['status'](0x191)[_0x20fc('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1317c4[_0x20fc('0x3b')]={'id':_0x46a9aa['id']};_0x37c75c();});})[_0x20fc('0x46')](function(){return _0x1943ee[_0x20fc('0x42')](0x191)['json']({'message':_0x20fc('0x59')});});}catch(_0x55487a){_0x37c75c(_0x55487a);}}else if(_0x19f50d){_0x37c75c();}else{return _0x1943ee[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x4a3778,_0x5eae44,_0x6bc1f){if(_0x4a3778[_0x20fc('0x3b')]){db[_0x20fc('0x4c')]['find']({'where':{'id':_0x4a3778[_0x20fc('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x4d39c3){if(!_0x4d39c3){return _0x5eae44[_0x20fc('0x42')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4a3778[_0x20fc('0x3b')]=_0x4d39c3;_0x6bc1f();})[_0x20fc('0x46')](function(_0x2af610){_0x6bc1f(_0x2af610);});}else if(_0x19f50d){_0x6bc1f();}else{return _0x5eae44[_0x20fc('0x42')](0x194)['json']({'message':_0x20fc('0x5f')});}});};exports[_0x20fc('0x60')]=function canUpdate(){return compose()[_0x20fc('0x47')](function(_0x261e1a,_0x3f97b8,_0x168436){return licenseUtil[_0x20fc('0x61')]()[_0x20fc('0x41')](function(_0x5a535b){if(_0x5a535b[_0x20fc('0x62')]){_0x168436();}else{return _0x3f97b8[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':_0x20fc('0x63')});}})[_0x20fc('0x46')](function(_0x49f01e){_0x168436(_0x49f01e);});});};exports[_0x20fc('0x64')]=function isWebrtcLicence(){return compose()['use'](function(_0x542e6a,_0x1d1fed,_0xb1dcfa){return licenseUtil[_0x20fc('0x61')]()[_0x20fc('0x41')](function(_0x356b98){if(_0x356b98[_0x20fc('0x65')]){_0xb1dcfa();}else{return _0x1d1fed[_0x20fc('0x42')](0x193)[_0x20fc('0x44')]({'message':'Forbidden'});}})[_0x20fc('0x46')](function(_0x48894a){_0xb1dcfa(_0x48894a);});});};exports[_0x20fc('0x66')]=function(_0x532e2c,_0xa7763c,_0x5bef1b){_0x532e2c['isMiddleware']=!![];return _0x5bef1b();};exports[_0x20fc('0x67')]=function signToken(_0x4af2b2){return signJwt(_0x4af2b2);};exports[_0x20fc('0x68')]=function(_0x7d3daa,_0x1a71b4){if(!_0x7d3daa[_0x20fc('0x3b')]){return _0x1a71b4[_0x20fc('0x42')](0x194)[_0x20fc('0x44')]({'message':_0x20fc('0x69')});}var _0x4a00d2={'payload':{'id':_0x7d3daa[_0x20fc('0x3b')]['id'],'role':_0x7d3daa[_0x20fc('0x3b')][_0x20fc('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a00d2)[_0x20fc('0x41')](function(_0x4d7510){_0x1a71b4[_0x20fc('0x6a')](_0x20fc('0x6b'),_0x4d7510);_0x1a71b4[_0x20fc('0x6c')]('/dashboards/general');})['catch'](function(_0x596b76){return _0x1a71b4[_0x20fc('0x42')](0x1f4)[_0x20fc('0x6d')](_0x596b76);});};exports[_0x20fc('0x6e')]=function(_0xf7e08b){if(_['isNil'](_0xf7e08b['apiKeyNonce'])||_[_0x20fc('0x6f')](_0xf7e08b['apiKeyIat'])){return null;}else{return createJwt(_0xf7e08b);}};exports[_0x20fc('0x70')]=function(_0x11639e){_0x11639e[_0x20fc('0x55')]=generateNonce();_0x11639e[_0x20fc('0x71')]=generateIssuedAt();return createJwt(_0x11639e);};exports['regenerateApiKey']=function(_0x4e9eb6,_0x31e402){var _0x11dac3=_0x4e9eb6[_0x20fc('0x50')][_0x20fc('0x51')];if(_0x11dac3){var _0x121e2b={'nonce':_0x31e402[_0x20fc('0x55')],'iat':_0x31e402[_0x20fc('0x71')],'audience':hardwareConf[_0x20fc('0x52')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x11dac3,_0x121e2b)[_0x20fc('0x41')](function(){return generateApiKey(_0x31e402);});}else{throw{'message':_0x20fc('0x72')};}};exports[_0x20fc('0x73')]=function(_0xc9aeb4){var _0x4671b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4671b2[_0x20fc('0x74')](_0xc9aeb4))throw new db[(_0x20fc('0x75'))]['ValidationError'](_0x20fc('0x76'));return;};exports[_0x20fc('0x77')]=function(_0x4a10a2,_0x1aba71,_0x32e029){var _0x289f8f=encryptor['decryptString'](_0x1aba71)[_0x20fc('0x78')](',');for(var _0x5a6fe0=0x0;_0x5a6fe0<_0x32e029;_0x5a6fe0++){if(!_0x289f8f[_0x5a6fe0])break;if(_0x4a10a2[_0x20fc('0x79')]()===_0x289f8f[_0x5a6fe0][_0x20fc('0x79')]()){var _0x4dade0=util[_0x20fc('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x32e029);if(_0x32e029===0x1){_0x4dade0=_0x20fc('0x7b');}throw new db[(_0x20fc('0x75'))]['ValidationError'](_0x4dade0);}}return;};exports[_0x20fc('0x7c')]=function(_0x233955,_0x374fce){var _0x50fd0a=_0x374fce?encryptor[_0x20fc('0x7d')](_0x374fce)[_0x20fc('0x78')](','):[];if(_0x50fd0a[_0x20fc('0x7e')]===0x5){_0x50fd0a[_0x20fc('0x7f')](-0x1,0x1);}_0x50fd0a[_0x20fc('0x80')](_0x233955);return encryptor[_0x20fc('0x81')](_0x50fd0a[_0x20fc('0x82')](','));};function signJwt(_0x3a5519){var _0x18c220=BPromise[_0x20fc('0x83')](jwt[_0x20fc('0x84')],{'context':jwt});var _0x18fc66=_0x3a5519[_0x20fc('0x85')]||config[_0x20fc('0xb')][_0x20fc('0xc')];return new BPromise(function(_0x56ea84,_0x49c140){_0x18c220(_0x3a5519[_0x20fc('0x86')],_0x18fc66,_0x3a5519[_0x20fc('0x87')])[_0x20fc('0x41')](function(_0x382009){_0x56ea84(_0x382009);})[_0x20fc('0x46')](function(_0x49302d){_0x49c140(_0x49302d);});});}function verifyJwt(_0x3fbeb8,_0x109700,_0x2f6b53){var _0x2d4093=BPromise['promisify'](jwt[_0x20fc('0x88')],{'context':jwt});var _0x5b4583=_0x2f6b53||config[_0x20fc('0xb')][_0x20fc('0xc')];return new BPromise(function(_0x91ed2f,_0xc5dfc2){_0x2d4093(_0x3fbeb8,_0x5b4583,_0x109700)[_0x20fc('0x41')](function(_0x3d066d){_0x91ed2f(_0x3d066d);})[_0x20fc('0x46')](function(_0x433a3f){_0xc5dfc2(_0x433a3f);});});}function generateNonce(){return crypto[_0x20fc('0x89')](0x10)['toString'](_0x20fc('0x8a'));}function generateIssuedAt(){return Math[_0x20fc('0x8b')](Date[_0x20fc('0x8c')]()/0x3e8)[_0x20fc('0x8d')]();}function createJwt(_0x3b63a3){var _0x33af05={'payload':{'iat':_0x3b63a3[_0x20fc('0x71')],'nonce':_0x3b63a3[_0x20fc('0x55')]},'options':{'algorithm':_0x20fc('0x8e'),'subject':_0x3b63a3['id'][_0x20fc('0x8d')](),'issuer':hardwareConf[_0x20fc('0x52')](),'audience':hardwareConf[_0x20fc('0x52')]()}};return signJwt(_0x33af05)[_0x20fc('0x41')](function(_0x444ea1){return{'iat':_0x3b63a3['apiKeyIat'],'nonce':_0x3b63a3[_0x20fc('0x55')],'token':_0x444ea1};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4b5a41f..a5deb66 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 _0xf74d=['clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','rows','catch','describe','CmContact','filter','map','CmCustomField','slice','all','length','cf_','fieldType','type','keys','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','user'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xf74d,0x137));var _0xdf74=function(_0x4c4f3f,_0x362325){_0x4c4f3f=_0x4c4f3f-0x0;var _0x8e1e2f=_0xf74d[_0x4c4f3f];return _0x8e1e2f;};'use strict';var _=require(_0xdf74('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xdf74('0x1'))['db'];exports[_0xdf74('0x2')]=function(_0x4580ea,_0x325482,_0x5ea2f9,_0xa9013b){var _0x46b349={'count':0x0,'rows':[]};var _0x3b4e72=sqlUtils[_0xdf74('0x3')](_0x325482,_0x4580ea);if(_0x3b4e72){return Promise[_0xdf74('0x4')](_0x46b349);}var _0x433d2d=sqlUtils['getContactsSubquery']();var _0x2f8e62={};var _0x1366c9=![];var _0x51aab7=![];return Promise['resolve']()[_0xdf74('0x5')](function(){if(_0x4580ea[_0xdf74('0x6')]){return sqlUtils[_0xdf74('0x7')](_0x4580ea['search'],_0xa9013b);}else{return sqlUtils[_0xdf74('0x8')](_0x4580ea,_0xa9013b);}})['then'](function(_0x43bd94){_0x433d2d[_0xdf74('0x9')](_0x43bd94[_0xdf74('0xa')]);_0x433d2d['where'](_0x43bd94[_0xdf74('0xb')]);_0x433d2d[_0xdf74('0x9')](_0x43bd94['filter']);_0x433d2d[_0xdf74('0x9')](_0x43bd94[_0xdf74('0xc')][_0xdf74('0xd')]);_0x2f8e62=_0x43bd94[_0xdf74('0xe')];_0x51aab7=_0x43bd94[_0xdf74('0xc')][_0xdf74('0xf')];return sqlUtils[_0xdf74('0x10')](_0x325482,_0x4580ea,_0x51aab7);})[_0xdf74('0x5')](function(_0x25bcd2){_0x433d2d[_0xdf74('0x9')](_0x25bcd2);var _0x6cbb89=_0x4580ea['search']?_0x2f8e62[_0xdf74('0x11')]:_0x4580ea[_0xdf74('0x12')];_0x1366c9=_0x6cbb89?!![]:![];return sqlUtils[_0xdf74('0x13')](_0x433d2d,_0x6cbb89);})[_0xdf74('0x5')](function(_0x452414){_0x46b349[_0xdf74('0x14')]=_0x452414;if(_0x46b349[_0xdf74('0x14')]===0x0){return;}if(_0x4580ea[_0xdf74('0x15')]){_0x51aab7=!![];}return sqlUtils['buildContactsQuery'](_0x433d2d,_0x4580ea[_0xdf74('0xb')],_0x5ea2f9,_0x1366c9,_0x2f8e62[_0xdf74('0xd')],_0x51aab7);})[_0xdf74('0x5')](function(_0x10dcce){if(!_0x10dcce){return[];}return sqlUtils['getFilteredContacts'](_0x10dcce,_0x4580ea,_0x5ea2f9);})['then'](function(_0x1b7581){_0x46b349[_0xdf74('0x16')]=_0x1b7581;return _0x46b349;})[_0xdf74('0x17')](function(_0x531142){throw _0x531142;});};exports[_0xdf74('0x18')]=function(){var _0x28facb={};var _0xc1a18d=[];return db[_0xdf74('0x19')][_0xdf74('0x18')]()[_0xdf74('0x5')](function(_0x2341b3){_0x28facb=_0x2341b3;var _0x334bfe=Object['keys'](_0x28facb)[_0xdf74('0x1a')](function(_0x225c69){return _['startsWith'](_0x225c69,'cf_')?_0x225c69:undefined;});var _0x16a5b1=_0x334bfe[_0xdf74('0x1b')](function(_0x1e4e83){return db[_0xdf74('0x1c')]['findOne']({'where':{'id':_0x1e4e83[_0xdf74('0x1d')](0x3)},'raw':!![]});});return Promise[_0xdf74('0x1e')](_0x16a5b1);})[_0xdf74('0x5')](function(_0x3507b2){for(var _0x3585f0=0x0;_0x3585f0<_0x3507b2[_0xdf74('0x1f')];_0x3585f0++){if(_0x3507b2[_0x3585f0]){var _0x531bf4=_0xdf74('0x20')+_0x3507b2[_0x3585f0]['id'];_0x28facb[_0x531bf4][_0xdf74('0x21')]=_0x3507b2[_0x3585f0][_0xdf74('0x22')];}}_0xc1a18d=_['map'](Object[_0xdf74('0x23')](_0x28facb),function(_0x467c68){return{'name':_0x467c68,'type':_0x28facb[_0x467c68][_0xdf74('0x22')]};});return _0xc1a18d;})[_0xdf74('0x17')](function(_0x5d21ab){throw _0x5d21ab;});}; \ No newline at end of file +var _0x2a80=['search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','rows','catch','describe','CmContact','startsWith','map','CmCustomField','findOne','slice','all','length','cf_','fieldType','type','keys','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x2a80,0xe3));var _0x02a8=function(_0x41434e,_0x57cbe5){_0x41434e=_0x41434e-0x0;var _0x2e570b=_0x2a80[_0x41434e];return _0x2e570b;};'use strict';var _=require(_0x02a8('0x0'));var sqlUtils=require(_0x02a8('0x1'));var db=require(_0x02a8('0x2'))['db'];exports[_0x02a8('0x3')]=function(_0x5053a7,_0x32deea,_0x2d3624,_0x33c53b){var _0xcac269={'count':0x0,'rows':[]};var _0x52117b=sqlUtils[_0x02a8('0x4')](_0x32deea,_0x5053a7);if(_0x52117b){return Promise[_0x02a8('0x5')](_0xcac269);}var _0x146eb8=sqlUtils[_0x02a8('0x6')]();var _0x559674={};var _0xc2aa44=![];var _0x542214=![];return Promise['resolve']()['then'](function(){if(_0x5053a7[_0x02a8('0x7')]){return sqlUtils[_0x02a8('0x8')](_0x5053a7[_0x02a8('0x7')],_0x33c53b);}else{return sqlUtils[_0x02a8('0x9')](_0x5053a7,_0x33c53b);}})[_0x02a8('0xa')](function(_0x441e70){_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xc')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xd')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xe')]);_0x146eb8[_0x02a8('0xb')](_0x441e70[_0x02a8('0xf')][_0x02a8('0x10')]);_0x559674=_0x441e70[_0x02a8('0x11')];_0x542214=_0x441e70[_0x02a8('0xf')][_0x02a8('0x12')];return sqlUtils[_0x02a8('0x13')](_0x32deea,_0x5053a7,_0x542214);})[_0x02a8('0xa')](function(_0x39a26e){_0x146eb8[_0x02a8('0xb')](_0x39a26e);var _0x1603c8=_0x5053a7[_0x02a8('0x7')]?_0x559674['ids']:_0x5053a7[_0x02a8('0x14')];_0xc2aa44=_0x1603c8?!![]:![];return sqlUtils[_0x02a8('0x15')](_0x146eb8,_0x1603c8);})[_0x02a8('0xa')](function(_0x4c0448){_0xcac269[_0x02a8('0x16')]=_0x4c0448;if(_0xcac269['count']===0x0){return;}if(_0x5053a7[_0x02a8('0x17')]){_0x542214=!![];}return sqlUtils['buildContactsQuery'](_0x146eb8,_0x5053a7[_0x02a8('0xd')],_0x2d3624,_0xc2aa44,_0x559674['clause'],_0x542214);})[_0x02a8('0xa')](function(_0x302aeb){if(!_0x302aeb){return[];}return sqlUtils['getFilteredContacts'](_0x302aeb,_0x5053a7,_0x2d3624);})['then'](function(_0x374aae){_0xcac269[_0x02a8('0x18')]=_0x374aae;return _0xcac269;})[_0x02a8('0x19')](function(_0x5a8816){throw _0x5a8816;});};exports[_0x02a8('0x1a')]=function(){var _0x3713e5={};var _0x234e91=[];return db[_0x02a8('0x1b')][_0x02a8('0x1a')]()['then'](function(_0x125498){_0x3713e5=_0x125498;var _0x215092=Object['keys'](_0x3713e5)[_0x02a8('0xe')](function(_0x45dc45){return _[_0x02a8('0x1c')](_0x45dc45,'cf_')?_0x45dc45:undefined;});var _0x280be3=_0x215092[_0x02a8('0x1d')](function(_0x5e8b1c){return db[_0x02a8('0x1e')][_0x02a8('0x1f')]({'where':{'id':_0x5e8b1c[_0x02a8('0x20')](0x3)},'raw':!![]});});return Promise[_0x02a8('0x21')](_0x280be3);})[_0x02a8('0xa')](function(_0x5b4468){for(var _0x3ed136=0x0;_0x3ed136<_0x5b4468[_0x02a8('0x22')];_0x3ed136++){if(_0x5b4468[_0x3ed136]){var _0x478f8f=_0x02a8('0x23')+_0x5b4468[_0x3ed136]['id'];_0x3713e5[_0x478f8f][_0x02a8('0x24')]=_0x5b4468[_0x3ed136][_0x02a8('0x25')];}}_0x234e91=_[_0x02a8('0x1d')](Object[_0x02a8('0x26')](_0x3713e5),function(_0x11b8d8){return{'name':_0x11b8d8,'type':_0x3713e5[_0x11b8d8][_0x02a8('0x25')]};});return _0x234e91;})['catch'](function(_0x192596){throw _0x192596;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3662eaa..4ae34ea 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 _0xb437=['fields','tag','filter','getLists','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry','findAll','Sequelize','sequelize','query','toString','Tags','COUNT(*)','c.id','isEmpty','QueryTypes','SELECT','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','firstName','lastName','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','escapeLIKESpecialChars','split','length','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.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','text','value','start','end','Tag','map','tags','clause','user','and','uc.UserId\x20=\x20?','skip','some','compact','User','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then'];(function(_0x3340c8,_0x3d67d7){var _0x30ca8a=function(_0x435fff){while(--_0x435fff){_0x3340c8['push'](_0x3340c8['shift']());}};_0x30ca8a(++_0x3d67d7);}(_0xb437,0x80));var _0x7b43=function(_0x16ace0,_0x5a64c8){_0x16ace0=_0x16ace0-0x0;var _0x2748d8=_0xb437[_0x16ace0];return _0x2748d8;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x7b43('0x0'));var qs=require(_0x7b43('0x1'));var utils=require(_0x7b43('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1319af,_0x38096e){var _0x1227d7=![];if(_0x1319af[_0x7b43('0x3')]===_0x7b43('0x4')&&!_0x38096e[_0x7b43('0x5')]&&!_0x38096e[_0x7b43('0x6')]&&_0x38096e[_0x7b43('0x7')]!==_0x7b43('0x8')){_0x1227d7=!![];}return _0x1227d7;}function getContactsSubquery(){return squel[_0x7b43('0x9')]()[_0x7b43('0xa')]('cm_contacts','c')[_0x7b43('0xb')](_0x7b43('0xc'));}function applyJoinClauses(_0x3ffbf2,_0x30d0e2){var _0x43b474=_0x30d0e2?'c':'subqry';_0x3ffbf2[_0x7b43('0xd')](_0x7b43('0xe'),'uc',_0x7b43('0xf')+_0x43b474+'.id')[_0x7b43('0xd')](_0x7b43('0x10'),'ct',_0x7b43('0x11')+_0x43b474+_0x7b43('0x12'))[_0x7b43('0xd')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x3ffbf2;}function addFieldsToQuery(_0x1a01ea,_0x746c96,_0x28a84f,_0x2858fa,_0x4e13a3){var _0x4d6554=_0x4e13a3?'c':'subqry';if(!_0x746c96){_0x746c96=['id',_0x7b43('0x13'),_0x7b43('0x14'),'phone','mobile',_0x7b43('0x15'),_0x7b43('0x16'),_0x7b43('0x6'),_0x7b43('0x17'),_0x7b43('0x18'),'updatedAt',_0x7b43('0x19'),_0x7b43('0x1a')];}else if(!_0x746c96[_0x7b43('0x1b')]('id')){_0x746c96[_0x7b43('0x1c')]('id');}var _0x3270d2=_0x28a84f&&_0x4e13a3||!_0x28a84f&&!_0x4e13a3;if(_0x2858fa){_0x3270d2=_0x2858fa&&_0x4e13a3||!_0x2858fa&&!_0x4e13a3;}_0x746c96[_0x7b43('0x1d')](function(_0x59bce1){if(_0x59bce1===_0x7b43('0x1a')){if(_0x3270d2){_0x1a01ea['field'](_0x7b43('0x1e'),_0x59bce1);}else if(_0x28a84f||_0x2858fa){_0x1a01ea['field'](_0x4d6554+'.'+_0x59bce1);}}else{_0x1a01ea[_0x7b43('0x1f')](_0x4d6554+'.'+_0x59bce1);}});return _0x1a01ea;}function getSqlClauses(){var _0x1a565b={'default':squel[_0x7b43('0x20')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x7b43('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1a565b;}function parseTagParameter(_0x113c6b){var _0x540230=squel['expr']();if(_0x113c6b){var _0x8c5d9c=utils[_0x7b43('0x21')](_0x113c6b);_0x8c5d9c[_0x7b43('0x1d')](function(_0x3b4f2e){_0x540230['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b4f2e+',%');});}return _0x540230;}function parseSearchFilter(_0x90d52b){var _0x284e76=squel['expr']();if(_0x90d52b){var _0x1ba0c3=_0x90d52b[_0x7b43('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x1a6f6a=qs[_0x7b43('0x23')](_0x1ba0c3);if(_0x1ba0c3[_0x7b43('0x24')]('\x20')[_0x7b43('0x25')]>0x1){_0x284e76['or'](_0x7b43('0x26'),qs[_0x7b43('0x27')](_0x1ba0c3,!![]),null);}else{if(qs['isNumeric'](_0x1ba0c3)){_0x284e76['or'](_0x7b43('0x28'),_0x1a6f6a+'%');_0x284e76['or']('c.phone\x20LIKE\x20?',_0x1a6f6a+'%');_0x284e76['or'](_0x7b43('0x29'),_0x1a6f6a+'%');_0x284e76['or']('c.fax\x20LIKE\x20?',_0x1a6f6a+'%');}else if(qs[_0x7b43('0x2a')](_0x1ba0c3)){_0x284e76['or'](_0x7b43('0x2b'),_0x1a6f6a+'%');}else{_0x284e76['or'](_0x7b43('0x2c'),'%'+_0x1a6f6a+'%');_0x284e76['or'](_0x7b43('0x2d'),'%'+_0x1a6f6a+'%');_0x284e76['or'](_0x7b43('0x2b'),'%'+_0x1a6f6a+'%');}}}return _0x284e76;}function parseAdvancedSearchFilter(_0x501704,_0x8f39f4){var _0x188bcb=getSqlClauses();var _0x76f699=as[_0x7b43('0x2e')](_0x501704);var _0x3a87c2=_0x76f699['sqlOperator'];for(var _0x237a27=0x0;_0x237a27<_0x76f699[_0x7b43('0x2f')][_0x7b43('0x25')];_0x237a27++){var _0x50240b=_0x76f699[_0x7b43('0x2f')][_0x237a27];var _0x35db3f='c';var _0x45c3d2=_[_0x7b43('0x30')](_0x8f39f4,[_0x7b43('0x31'),_0x50240b['field']]);if(_0x45c3d2){if(_0x50240b[_0x7b43('0x1f')]===_0x7b43('0x32')||_0x45c3d2[_0x7b43('0x33')]===_0x7b43('0x34')){_0x50240b[_0x7b43('0x35')]=_0x7b43('0x36');}var _0x5cdcae=as[_0x7b43('0x37')](_0x35db3f,_0x45c3d2['type'],_0x50240b);_0x188bcb['default'][_0x3a87c2](_0x5cdcae[_0x7b43('0x38')],_0x5cdcae[_0x7b43('0x39')][_0x7b43('0x3a')],_0x5cdcae[_0x7b43('0x39')][_0x7b43('0x3b')]);}else{if(_0x50240b[_0x7b43('0x1f')]===_0x7b43('0x3c')){var _0x19a932=_0x50240b['value']['split'](',')[_0x7b43('0x3d')](function(_0x2f4389){return Number(_0x2f4389);});var _0x150568=parseTagParameter(_0x19a932);_0x188bcb[_0x7b43('0x3e')][_0x7b43('0x3f')]['and'](_0x150568);_0x188bcb['tags']['ids']=_0x19a932;}else if(_0x50240b[_0x7b43('0x1f')]==='User'){_0x188bcb[_0x7b43('0x40')][_0x7b43('0x3f')][_0x7b43('0x41')](_0x7b43('0x42'),_0x50240b[_0x7b43('0x39')]);_0x188bcb[_0x7b43('0x40')][_0x7b43('0x43')]=!![];}}}return _0x188bcb;}function parseModelFields(_0x3ccedb,_0x40ab1a){var _0x24b981=squel[_0x7b43('0x20')]();var _0x3fb6ab=_(_0x3ccedb)['keys']()[_0x7b43('0x3d')](function(_0x5c8c50){return _[_0x7b43('0x44')](_0x40ab1a,[_0x7b43('0x31'),_0x5c8c50])?_0x5c8c50:undefined;})[_0x7b43('0x45')]()[_0x7b43('0x39')]();if(_0x3ccedb['Contact']){_0x3fb6ab[_0x7b43('0x1c')]('Contact');}if(_0x3ccedb[_0x7b43('0x46')]){_0x3fb6ab[_0x7b43('0x1c')](_0x7b43('0x46'));}if(_0x3fb6ab['length']>0x0){_0x3fb6ab[_0x7b43('0x1d')](function(_0x260113){if(_0x260113===_0x7b43('0x6')){_0x24b981[_0x7b43('0x41')](_0x7b43('0x47'),[][_0x7b43('0x48')](_0x3ccedb[_0x260113]));}else if(_0x260113===_0x7b43('0x49')){var _0x1c40ae='%'+_0x3ccedb[_0x260113]+'%';_0x24b981[_0x7b43('0x41')](_0x7b43('0x4a'),_0x1c40ae);}else if(_0x260113==='User'){_0x24b981[_0x7b43('0x41')](_0x7b43('0x42'),_0x3ccedb[_0x260113]);}else{_0x24b981['and']('c.'+_0x260113+_0x7b43('0x4b'),_0x3ccedb[_0x260113]);}});}return _0x24b981;}function parseQueryParameters(_0x4a3665,_0x4889f4){var _0x3cb58c=getSqlClauses();return Promise[_0x7b43('0x4c')]()['then'](function(){return parseModelFields(_0x4a3665,_0x4889f4);})[_0x7b43('0x4d')](function(_0x66cca0){_0x3cb58c[_0x7b43('0x4e')][_0x7b43('0x41')](_0x66cca0);return parseTagParameter(_0x4a3665[_0x7b43('0x4f')]);})[_0x7b43('0x4d')](function(_0x4907db){_0x3cb58c[_0x7b43('0x3e')]['clause'][_0x7b43('0x41')](_0x4907db);return parseSearchFilter(_0x4a3665[_0x7b43('0x50')]);})[_0x7b43('0x4d')](function(_0x18c1b2){_0x3cb58c[_0x7b43('0x50')]=_0x18c1b2;return _0x3cb58c;});}function checkListsRestrictions(_0x345efe,_0x55a656,_0x4ae63f){var _0x253328=squel[_0x7b43('0x20')]();return Promise[_0x7b43('0x4c')]()['then'](function(){if(_0x55a656['search']&&_0x345efe[_0x7b43('0x3')]===_0x7b43('0x4')&&!_0x4ae63f){return _0x345efe[_0x7b43('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x7b43('0x4d')](function(_0x5bbacb){if(_0x5bbacb){if(_0x5bbacb['length']===0x0){_0x253328['and']('c.ListId\x20IS\x20NULL');}else{_0x253328[_0x7b43('0x41')](_0x7b43('0x47'),_[_0x7b43('0x3d')](_0x5bbacb,'id'));}}})['then'](function(){return _0x253328;});}function buildContactsQuery(_0x382e3d,_0x420734,_0x5cba21,_0x1329d5,_0x27eab6,_0x99294d){if(_0x420734){_0x420734=_0x5cba21[_0x7b43('0x52')];}_0x382e3d=addFieldsToQuery(_0x382e3d,_0x420734,_0x1329d5,_0x99294d,!![]);var _0x559698=squel[_0x7b43('0x9')]();_0x559698=addFieldsToQuery(_0x559698,_0x420734,_0x1329d5,_0x99294d,![]);if(_0x1329d5||_0x99294d){_0x382e3d=applyJoinClauses(_0x382e3d,!![]);_0x382e3d[_0x7b43('0x53')]('c.id');if(_0x5cba21[_0x7b43('0x54')]){_0x559698[_0x7b43('0x54')](_0x5cba21['limit']);}if(_0x5cba21[_0x7b43('0x55')]){_0x559698[_0x7b43('0x55')](_0x5cba21[_0x7b43('0x55')]);}}else{_0x559698=applyJoinClauses(_0x559698,![]);_0x559698[_0x7b43('0x53')](_0x7b43('0x56'));if(_0x5cba21[_0x7b43('0x54')]){_0x382e3d[_0x7b43('0x54')](_0x5cba21[_0x7b43('0x54')]);}if(_0x5cba21[_0x7b43('0x55')]){_0x382e3d['offset'](_0x5cba21[_0x7b43('0x55')]);}}_0x559698[_0x7b43('0x57')](_0x27eab6);if(_0x5cba21[_0x7b43('0x58')]){_0x5cba21[_0x7b43('0x58')][_0x7b43('0x1d')](function(_0x2d354c){_0x382e3d[_0x7b43('0x58')]('c.'+_0x2d354c[0x0],_0x2d354c[0x1]==='DESC'?![]:!![]);_0x559698['order']('subqry.'+_0x2d354c[0x0],_0x2d354c[0x1]===_0x7b43('0x59')?![]:!![]);});}_0x559698[_0x7b43('0xa')](_0x382e3d,_0x7b43('0x5a'));return _0x559698;}function getFilteredContacts(_0x3a5673){var _0x106d16=[];return db['Tag'][_0x7b43('0x5b')]({'attributes':['id',_0x7b43('0x31'),'color'],'raw':!![]})[_0x7b43('0x4d')](function(_0x913368){_0x106d16=_['keyBy'](_0x913368,'id');var _0x1ea0db={'type':db[_0x7b43('0x5c')]['QueryTypes']['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7b43('0x5d')][_0x7b43('0x5e')](_0x3a5673[_0x7b43('0x5f')](),_0x1ea0db);})[_0x7b43('0x4d')](function(_0x341851){_0x341851[_0x7b43('0x1d')](function(_0x1527a1){if(_0x1527a1[_0x7b43('0x1a')]){_0x1527a1[_0x7b43('0x60')]=[];_0x1527a1[_0x7b43('0x1a')][_0x7b43('0x24')](',')[_0x7b43('0x1d')](function(_0x3c38b3){_0x1527a1[_0x7b43('0x60')]['push'](_0x106d16[_0x3c38b3]);});}delete _0x1527a1[_0x7b43('0x1a')];});return _0x341851;});}function countFilteredContacts(_0x4ec0bb,_0x9bf193){var _0x4519c7=_0x4ec0bb['clone']();_0x4519c7[_0x7b43('0x1f')](_0x7b43('0x61'));_0x4519c7=applyJoinClauses(_0x4519c7,!![]);_0x4ec0bb[_0x7b43('0x53')](_0x7b43('0x62'));var _0x1daa6f=utils[_0x7b43('0x21')](_0x9bf193);if(!_[_0x7b43('0x63')](_0x1daa6f)){_0x4519c7[_0x7b43('0xb')]('t.id\x20IN\x20?',_0x1daa6f);}var _0x3f9299={'type':db[_0x7b43('0x5c')][_0x7b43('0x64')][_0x7b43('0x65')],'raw':!![]};return db['sequelize'][_0x7b43('0x5e')](_0x4519c7[_0x7b43('0x5f')](),_0x3f9299)[_0x7b43('0x4d')](function(_0x3a94ab){return _0x3a94ab[0x0][_0x7b43('0x61')];});}module[_0x7b43('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xf14e=['length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','value','start','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','tag','filter','role','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','DESC','order','subqry.','from','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','isEmpty','query','exports','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','ListId','CompanyId','createdAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split'];(function(_0x3903ef,_0x30063f){var _0x5a340b=function(_0x14ef71){while(--_0x14ef71){_0x3903ef['push'](_0x3903ef['shift']());}};_0x5a340b(++_0x30063f);}(_0xf14e,0x17e));var _0xef14=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xf14e[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var squel=require(_0xef14('0x0'));var as=require(_0xef14('0x1'));var qs=require(_0xef14('0x2'));var utils=require('../interaction/utils');var db=require(_0xef14('0x3'))['db'];function skipContactsQuery(_0x4ac2a3,_0x3fa614){var _0xe2d467=![];if(_0x4ac2a3['role']===_0xef14('0x4')&&!_0x3fa614[_0xef14('0x5')]&&!_0x3fa614['ListId']&&_0x3fa614['autocomplete']!=='true'){_0xe2d467=!![];}return _0xe2d467;}function getContactsSubquery(){return squel[_0xef14('0x6')]()['from'](_0xef14('0x7'),'c')[_0xef14('0x8')](_0xef14('0x9'));}function applyJoinClauses(_0x4fe9f4,_0x341839){var _0x4ca4ef=_0x341839?'c':_0xef14('0xa');_0x4fe9f4[_0xef14('0xb')]('cm_user_has_contacts','uc',_0xef14('0xc')+_0x4ca4ef+_0xef14('0xd'))[_0xef14('0xb')](_0xef14('0xe'),'ct','ct.CmContactId\x20=\x20'+_0x4ca4ef+'.id')['left_join']('tools_tags','t',_0xef14('0xf'));return _0x4fe9f4;}function addFieldsToQuery(_0x5dbc81,_0x5e9c6e,_0x3053e2,_0x1b8281,_0x2d869e){var _0x2f51c3=_0x2d869e?'c':'subqry';if(!_0x5e9c6e){_0x5e9c6e=['id',_0xef14('0x10'),_0xef14('0x11'),_0xef14('0x12'),_0xef14('0x13'),'fax','email',_0xef14('0x14'),_0xef14('0x15'),_0xef14('0x16'),'updatedAt',_0xef14('0x17'),_0xef14('0x18')];}else if(!_0x5e9c6e['includes']('id')){_0x5e9c6e['push']('id');}var _0x4121eb=_0x3053e2&&_0x2d869e||!_0x3053e2&&!_0x2d869e;if(_0x1b8281){_0x4121eb=_0x1b8281&&_0x2d869e||!_0x1b8281&&!_0x2d869e;}_0x5e9c6e[_0xef14('0x19')](function(_0x3e4a84){if(_0x3e4a84===_0xef14('0x18')){if(_0x4121eb){_0x5dbc81[_0xef14('0x1a')](_0xef14('0x1b'),_0x3e4a84);}else if(_0x3053e2||_0x1b8281){_0x5dbc81[_0xef14('0x1a')](_0x2f51c3+'.'+_0x3e4a84);}}else{_0x5dbc81[_0xef14('0x1a')](_0x2f51c3+'.'+_0x3e4a84);}});return _0x5dbc81;}function getSqlClauses(){var _0x4b0e64={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xef14('0x1c')](),'tags':{'clause':squel[_0xef14('0x1c')](),'ids':null},'user':{'clause':squel[_0xef14('0x1c')](),'skip':![]}};return _0x4b0e64;}function parseTagParameter(_0x5763d7){var _0x4882ed=squel[_0xef14('0x1c')]();if(_0x5763d7){var _0x4c2957=utils[_0xef14('0x1d')](_0x5763d7);_0x4c2957[_0xef14('0x19')](function(_0x4095a7){_0x4882ed['or'](_0xef14('0x1e'),'%,'+_0x4095a7+',%');});}return _0x4882ed;}function parseSearchFilter(_0x3c5978){var _0x177fa2=squel[_0xef14('0x1c')]();if(_0x3c5978){var _0x5841b8=_0x3c5978[_0xef14('0x1f')]('\x5c','\x5c\x5c')[_0xef14('0x1f')](/'/g,'\x27\x27');var _0x814907=qs[_0xef14('0x20')](_0x5841b8);if(_0x5841b8[_0xef14('0x21')]('\x20')[_0xef14('0x22')]>0x1){_0x177fa2['or'](_0xef14('0x23'),qs[_0xef14('0x24')](_0x5841b8,!![]),null);}else{if(qs[_0xef14('0x25')](_0x5841b8)){_0x177fa2['or'](_0xef14('0x26'),_0x814907+'%');_0x177fa2['or'](_0xef14('0x27'),_0x814907+'%');_0x177fa2['or']('c.mobile\x20LIKE\x20?',_0x814907+'%');_0x177fa2['or']('c.fax\x20LIKE\x20?',_0x814907+'%');}else if(qs['isEmail'](_0x5841b8)){_0x177fa2['or'](_0xef14('0x28'),_0x814907+'%');}else{_0x177fa2['or'](_0xef14('0x29'),'%'+_0x814907+'%');_0x177fa2['or'](_0xef14('0x2a'),'%'+_0x814907+'%');_0x177fa2['or'](_0xef14('0x28'),'%'+_0x814907+'%');}}}return _0x177fa2;}function parseAdvancedSearchFilter(_0x1f57dd,_0x45db24){var _0x2d848c=getSqlClauses();var _0x4ee379=as['parseSearch'](_0x1f57dd);var _0x353434=_0x4ee379[_0xef14('0x2b')];for(var _0x24fdc9=0x0;_0x24fdc9<_0x4ee379['conditions'][_0xef14('0x22')];_0x24fdc9++){var _0x37ce41=_0x4ee379[_0xef14('0x2c')][_0x24fdc9];var _0x11c211='c';var _0xd2e4ee=_[_0xef14('0x2d')](_0x45db24,[_0xef14('0x2e'),_0x37ce41[_0xef14('0x1a')]]);if(_0xd2e4ee){if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x2f')||_0xd2e4ee[_0xef14('0x30')]===_0xef14('0x31')){_0x37ce41[_0xef14('0x32')]=_0xef14('0x33');}var _0x3aa523=as[_0xef14('0x34')](_0x11c211,_0xd2e4ee[_0xef14('0x35')],_0x37ce41);_0x2d848c['default'][_0x353434](_0x3aa523['text'],_0x3aa523[_0xef14('0x36')][_0xef14('0x37')],_0x3aa523[_0xef14('0x36')][_0xef14('0x38')]);}else{if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x39')){var _0x4075d2=_0x37ce41[_0xef14('0x36')][_0xef14('0x21')](',')[_0xef14('0x3a')](function(_0xe265b7){return Number(_0xe265b7);});var _0x9aecbc=parseTagParameter(_0x4075d2);_0x2d848c[_0xef14('0x3b')][_0xef14('0x3c')][_0xef14('0x3d')](_0x9aecbc);_0x2d848c[_0xef14('0x3b')][_0xef14('0x3e')]=_0x4075d2;}else if(_0x37ce41[_0xef14('0x1a')]===_0xef14('0x3f')){_0x2d848c[_0xef14('0x40')][_0xef14('0x3c')][_0xef14('0x3d')](_0xef14('0x41'),_0x37ce41[_0xef14('0x36')]);_0x2d848c['user'][_0xef14('0x42')]=!![];}}}return _0x2d848c;}function parseModelFields(_0x5238a2,_0x50ea28){var _0xc823c3=squel[_0xef14('0x1c')]();var _0x1e6b45=_(_0x5238a2)[_0xef14('0x43')]()[_0xef14('0x3a')](function(_0x3d556d){return _[_0xef14('0x44')](_0x50ea28,[_0xef14('0x2e'),_0x3d556d])?_0x3d556d:undefined;})['compact']()[_0xef14('0x36')]();if(_0x5238a2[_0xef14('0x45')]){_0x1e6b45['push'](_0xef14('0x45'));}if(_0x5238a2[_0xef14('0x3f')]){_0x1e6b45[_0xef14('0x46')](_0xef14('0x3f'));}if(_0x1e6b45[_0xef14('0x22')]>0x0){_0x1e6b45[_0xef14('0x19')](function(_0x4384da){if(_0x4384da===_0xef14('0x14')){_0xc823c3[_0xef14('0x3d')](_0xef14('0x47'),[][_0xef14('0x48')](_0x5238a2[_0x4384da]));}else if(_0x4384da===_0xef14('0x45')){var _0x3ce8ac='%'+_0x5238a2[_0x4384da]+'%';_0xc823c3[_0xef14('0x3d')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3ce8ac);}else if(_0x4384da===_0xef14('0x3f')){_0xc823c3[_0xef14('0x3d')]('uc.UserId\x20=\x20?',_0x5238a2[_0x4384da]);}else{_0xc823c3[_0xef14('0x3d')]('c.'+_0x4384da+_0xef14('0x49'),_0x5238a2[_0x4384da]);}});}return _0xc823c3;}function parseQueryParameters(_0x41410e,_0x512df0){var _0x3ad054=getSqlClauses();return Promise[_0xef14('0x4a')]()[_0xef14('0x4b')](function(){return parseModelFields(_0x41410e,_0x512df0);})[_0xef14('0x4b')](function(_0x2db054){_0x3ad054['fields'][_0xef14('0x3d')](_0x2db054);return parseTagParameter(_0x41410e[_0xef14('0x4c')]);})['then'](function(_0x279fcf){_0x3ad054[_0xef14('0x3b')][_0xef14('0x3c')][_0xef14('0x3d')](_0x279fcf);return parseSearchFilter(_0x41410e[_0xef14('0x4d')]);})[_0xef14('0x4b')](function(_0x5aa577){_0x3ad054[_0xef14('0x4d')]=_0x5aa577;return _0x3ad054;});}function checkListsRestrictions(_0x38aa9d,_0x4356cf,_0x39b191){var _0x52c73d=squel[_0xef14('0x1c')]();return Promise[_0xef14('0x4a')]()['then'](function(){if(_0x4356cf[_0xef14('0x5')]&&_0x38aa9d[_0xef14('0x4e')]===_0xef14('0x4')&&!_0x39b191){return _0x38aa9d['getLists']({'attributes':['id'],'raw':!![]});}})[_0xef14('0x4b')](function(_0x377cf2){if(_0x377cf2){if(_0x377cf2[_0xef14('0x22')]===0x0){_0x52c73d['and'](_0xef14('0x4f'));}else{_0x52c73d[_0xef14('0x3d')]('c.ListId\x20IN\x20?',_[_0xef14('0x3a')](_0x377cf2,'id'));}}})[_0xef14('0x4b')](function(){return _0x52c73d;});}function buildContactsQuery(_0x255906,_0x629806,_0x455ce3,_0x88500a,_0x2b56ac,_0x2ed8a6){if(_0x629806){_0x629806=_0x455ce3[_0xef14('0x50')];}_0x255906=addFieldsToQuery(_0x255906,_0x629806,_0x88500a,_0x2ed8a6,!![]);var _0x5adb8f=squel['select']();_0x5adb8f=addFieldsToQuery(_0x5adb8f,_0x629806,_0x88500a,_0x2ed8a6,![]);if(_0x88500a||_0x2ed8a6){_0x255906=applyJoinClauses(_0x255906,!![]);_0x255906[_0xef14('0x51')](_0xef14('0x52'));if(_0x455ce3[_0xef14('0x53')]){_0x5adb8f[_0xef14('0x53')](_0x455ce3[_0xef14('0x53')]);}if(_0x455ce3[_0xef14('0x54')]){_0x5adb8f[_0xef14('0x54')](_0x455ce3[_0xef14('0x54')]);}}else{_0x5adb8f=applyJoinClauses(_0x5adb8f,![]);_0x5adb8f[_0xef14('0x51')](_0xef14('0x55'));if(_0x455ce3[_0xef14('0x53')]){_0x255906[_0xef14('0x53')](_0x455ce3[_0xef14('0x53')]);}if(_0x455ce3[_0xef14('0x54')]){_0x255906[_0xef14('0x54')](_0x455ce3[_0xef14('0x54')]);}}_0x5adb8f[_0xef14('0x56')](_0x2b56ac);if(_0x455ce3['order']){_0x455ce3['order'][_0xef14('0x19')](function(_0xc0b453){_0x255906['order']('c.'+_0xc0b453[0x0],_0xc0b453[0x1]===_0xef14('0x57')?![]:!![]);_0x5adb8f[_0xef14('0x58')](_0xef14('0x59')+_0xc0b453[0x0],_0xc0b453[0x1]==='DESC'?![]:!![]);});}_0x5adb8f[_0xef14('0x5a')](_0x255906,_0xef14('0xa'));return _0x5adb8f;}function getFilteredContacts(_0x2b4ce3){var _0x14f37e=[];return db[_0xef14('0x39')][_0xef14('0x5b')]({'attributes':['id',_0xef14('0x2e'),_0xef14('0x5c')],'raw':!![]})[_0xef14('0x4b')](function(_0x222e03){_0x14f37e=_[_0xef14('0x5d')](_0x222e03,'id');var _0x61fea8={'type':db[_0xef14('0x5e')]['QueryTypes'][_0xef14('0x5f')],'model':db[_0xef14('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xef14('0x61')]['query'](_0x2b4ce3[_0xef14('0x62')](),_0x61fea8);})[_0xef14('0x4b')](function(_0x1521ae){_0x1521ae[_0xef14('0x19')](function(_0x2d304a){if(_0x2d304a[_0xef14('0x18')]){_0x2d304a[_0xef14('0x63')]=[];_0x2d304a[_0xef14('0x18')]['split'](',')['forEach'](function(_0x28adac){_0x2d304a[_0xef14('0x63')][_0xef14('0x46')](_0x14f37e[_0x28adac]);});}delete _0x2d304a[_0xef14('0x18')];});return _0x1521ae;});}function countFilteredContacts(_0x514747,_0x476c9e){var _0x69f105=_0x514747[_0xef14('0x64')]();_0x69f105[_0xef14('0x1a')]('COUNT(*)');_0x69f105=applyJoinClauses(_0x69f105,!![]);_0x514747[_0xef14('0x51')](_0xef14('0x52'));var _0x474944=utils[_0xef14('0x1d')](_0x476c9e);if(!_[_0xef14('0x65')](_0x474944)){_0x69f105[_0xef14('0x8')]('t.id\x20IN\x20?',_0x474944);}var _0x34999e={'type':db[_0xef14('0x5e')]['QueryTypes'][_0xef14('0x5f')],'raw':!![]};return db[_0xef14('0x61')][_0xef14('0x66')](_0x69f105['toString'](),_0x34999e)[_0xef14('0x4b')](function(_0x5b2d8b){return _0x5b2d8b[0x0]['COUNT(*)'];});}module[_0xef14('0x67')]={'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 f62cf39..df011d4 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 _0xb065=['lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','end','final','close','unlink','decryptFile','createDecipher','data','write','encryptString','utf8','base64','decryptString','bluebird'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0xb065,0x10f));var _0x5b06=function(_0x5b9f97,_0x4ab02a){_0x5b9f97=_0x5b9f97-0x0;var _0x2d8ba6=_0xb065[_0x5b9f97];return _0x2d8ba6;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x5b06('0x0'));var _=require(_0x5b06('0x1'));var config=require('../../config/environment');var logger=require(_0x5b06('0x2'))(_0x5b06('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5b06('0x4')][_0x5b06('0x5')],'algorithm':_0x5b06('0x6')};const fileOptions={'algorithm':_0x5b06('0x7')};if(config[_0x5b06('0x8')]&&config[_0x5b06('0x8')][_0x5b06('0x9')]){var isSupported=isAlgorithmSupported(config[_0x5b06('0x8')][_0x5b06('0x9')]);if(isSupported){fileOptions[_0x5b06('0x9')]=config[_0x5b06('0x8')][_0x5b06('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5b06('0xa')](',\x20');logger[_0x5b06('0xb')](config[_0x5b06('0x8')]['algorithm'],_0x5b06('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x1cf725){return AES_SUPPORTED_RX[_0x5b06('0xd')](_0x1cf725);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xac95f1){return getSupportedCiphers()[_0x5b06('0xe')](_0xac95f1)>-0x1;}function combineOptions(_0x1c5a53){var _0x20acfe={};for(var _0x47cd6b in fileOptions){if(fileOptions['hasOwnProperty'](_0x47cd6b)){_0x20acfe[_0x47cd6b]=fileOptions[_0x47cd6b];}}if(_0x1c5a53){for(var _0x5a2334 in _0x1c5a53){if(_0x1c5a53[_0x5b06('0xf')](_0x5a2334)){_0x20acfe[_0x5a2334]=_0x1c5a53[_0x5a2334];}}}return _0x20acfe;}exports[_0x5b06('0x10')]=function(_0x51e716,_0x36c726,_0x438665,_0x352d48){return new BPromise(function(_0x23d9ff,_0x485beb){_0x352d48=combineOptions(_0x352d48);var _0x133c76=new Buffer(_0x438665);var _0x114eac=fs[_0x5b06('0x11')](_0x51e716);var _0x141ed3=fs[_0x5b06('0x12')](_0x36c726);var _0x5ba855=crypto[_0x5b06('0x13')](_0x352d48[_0x5b06('0x9')],_0x133c76);_0x114eac['on']('data',function(_0x4be16e){var _0x53ba2f=new Buffer(_0x5ba855[_0x5b06('0x14')](_0x4be16e),_0x5b06('0x15'));_0x141ed3['write'](_0x53ba2f);});_0x114eac['on'](_0x5b06('0x16'),function(){try{var _0x5dee8b=new Buffer(_0x5ba855[_0x5b06('0x17')](_0x5b06('0x15')),_0x5b06('0x15'));_0x141ed3['write'](_0x5dee8b);_0x141ed3[_0x5b06('0x16')]();_0x141ed3['on'](_0x5b06('0x18'),function(){return _0x23d9ff(_0x36c726);});}catch(_0x25f6a6){fs[_0x5b06('0x19')](_0x36c726);return _0x485beb(_0x25f6a6);}});});};exports[_0x5b06('0x1a')]=function(_0x227438,_0x2d8ff7,_0x31a03c,_0x43a9df){return new BPromise(function(_0x5a56d4,_0x59b391){_0x43a9df=combineOptions(_0x43a9df);var _0x198b18=new Buffer(_0x31a03c);var _0x862efe=fs[_0x5b06('0x11')](_0x227438);var _0x596c35=fs[_0x5b06('0x12')](_0x2d8ff7);var _0x10fdb2=crypto[_0x5b06('0x1b')](_0x43a9df[_0x5b06('0x9')],_0x198b18);_0x862efe['on'](_0x5b06('0x1c'),function(_0x39e02){var _0x692f76=new Buffer(_0x10fdb2['update'](_0x39e02),_0x5b06('0x15'));_0x596c35[_0x5b06('0x1d')](_0x692f76);});_0x862efe['on'](_0x5b06('0x16'),function(){try{var _0x178fc4=new Buffer(_0x10fdb2[_0x5b06('0x17')](_0x5b06('0x15')),_0x5b06('0x15'));_0x596c35[_0x5b06('0x1d')](_0x178fc4);_0x596c35[_0x5b06('0x16')]();_0x596c35['on']('close',function(){return _0x5a56d4(_0x2d8ff7);});}catch(_0x4afc88){fs[_0x5b06('0x19')](_0x2d8ff7);return _0x59b391(_0x4afc88);}});});};exports[_0x5b06('0x1e')]=function(_0x2748bf,_0x9ade75,_0x4ad4e6){var _0x156ef9=_0x4ad4e6||stringOptions[_0x5b06('0x9')];var _0x39b73d=_0x9ade75||stringOptions['secret'];var _0x5c733f=crypto[_0x5b06('0x13')](_0x156ef9,_0x39b73d);var _0x3e6b61=_0x5c733f[_0x5b06('0x14')](_0x2748bf,_0x5b06('0x1f'),_0x5b06('0x20'));_0x3e6b61+=_0x5c733f[_0x5b06('0x17')](_0x5b06('0x20'));return _0x3e6b61;};exports[_0x5b06('0x21')]=function(_0x2f0a60,_0x26f151,_0x2cba2){var _0xd0474f=_0x2cba2||stringOptions[_0x5b06('0x9')];var _0x4ff07e=_0x26f151||stringOptions['secret'];var _0x27801a=crypto['createDecipher'](_0xd0474f,_0x4ff07e);var _0x24ef4b=_0x27801a[_0x5b06('0x14')](_0x2f0a60,_0x5b06('0x20'),_0x5b06('0x1f'));_0x24ef4b+=_0x27801a[_0x5b06('0x17')](_0x5b06('0x1f'));return _0x24ef4b;}; \ No newline at end of file +var _0x8f7f=['secrets','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','update','binary','write','end','final','unlink','createReadStream','data','close','encryptString','secret','createCipher','base64','decryptString','createDecipher','utf8','crypto','bluebird','../../config/environment','../../config/logger'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x8f7f,0x167));var _0xf8f7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f7f[_0x2641f9];return _0x585741;};'use strict';var crypto=require(_0xf8f7('0x0'));var fs=require('fs');var BPromise=require(_0xf8f7('0x1'));var _=require('lodash');var config=require(_0xf8f7('0x2'));var logger=require(_0xf8f7('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf8f7('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xf8f7('0x5')};if(config['encrypt']&&config[_0xf8f7('0x6')][_0xf8f7('0x7')]){var isSupported=isAlgorithmSupported(config[_0xf8f7('0x6')][_0xf8f7('0x7')]);if(isSupported){fileOptions[_0xf8f7('0x7')]=config[_0xf8f7('0x6')][_0xf8f7('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf8f7('0x8')](',\x20');logger['error'](config[_0xf8f7('0x6')][_0xf8f7('0x7')],_0xf8f7('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x3c1214){return AES_SUPPORTED_RX[_0xf8f7('0xa')](_0x3c1214);}function getSupportedCiphers(){return crypto[_0xf8f7('0xb')]()[_0xf8f7('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x354e4b){return getSupportedCiphers()[_0xf8f7('0xd')](_0x354e4b)>-0x1;}function combineOptions(_0x4aa561){var _0x338dde={};for(var _0x29f6b8 in fileOptions){if(fileOptions[_0xf8f7('0xe')](_0x29f6b8)){_0x338dde[_0x29f6b8]=fileOptions[_0x29f6b8];}}if(_0x4aa561){for(var _0x8b9c98 in _0x4aa561){if(_0x4aa561[_0xf8f7('0xe')](_0x8b9c98)){_0x338dde[_0x8b9c98]=_0x4aa561[_0x8b9c98];}}}return _0x338dde;}exports[_0xf8f7('0xf')]=function(_0x278007,_0x40b359,_0xdf1965,_0xc968ea){return new BPromise(function(_0x31055e,_0x235789){_0xc968ea=combineOptions(_0xc968ea);var _0x1521bf=new Buffer(_0xdf1965);var _0x41d93e=fs['createReadStream'](_0x278007);var _0x178ec8=fs[_0xf8f7('0x10')](_0x40b359);var _0x248eeb=crypto['createCipher'](_0xc968ea[_0xf8f7('0x7')],_0x1521bf);_0x41d93e['on']('data',function(_0x327eda){var _0x4ed27c=new Buffer(_0x248eeb[_0xf8f7('0x11')](_0x327eda),_0xf8f7('0x12'));_0x178ec8[_0xf8f7('0x13')](_0x4ed27c);});_0x41d93e['on'](_0xf8f7('0x14'),function(){try{var _0x2ed140=new Buffer(_0x248eeb[_0xf8f7('0x15')](_0xf8f7('0x12')),'binary');_0x178ec8['write'](_0x2ed140);_0x178ec8[_0xf8f7('0x14')]();_0x178ec8['on']('close',function(){return _0x31055e(_0x40b359);});}catch(_0x4b932d){fs[_0xf8f7('0x16')](_0x40b359);return _0x235789(_0x4b932d);}});});};exports['decryptFile']=function(_0xc1c5f0,_0x2a477c,_0x25a76b,_0xf8fb9){return new BPromise(function(_0x3c1055,_0x261a66){_0xf8fb9=combineOptions(_0xf8fb9);var _0x416cb3=new Buffer(_0x25a76b);var _0x21de44=fs[_0xf8f7('0x17')](_0xc1c5f0);var _0x1e78f3=fs[_0xf8f7('0x10')](_0x2a477c);var _0x3ee44c=crypto['createDecipher'](_0xf8fb9['algorithm'],_0x416cb3);_0x21de44['on'](_0xf8f7('0x18'),function(_0x3a3082){var _0x42047a=new Buffer(_0x3ee44c[_0xf8f7('0x11')](_0x3a3082),_0xf8f7('0x12'));_0x1e78f3['write'](_0x42047a);});_0x21de44['on'](_0xf8f7('0x14'),function(){try{var _0x396246=new Buffer(_0x3ee44c[_0xf8f7('0x15')](_0xf8f7('0x12')),_0xf8f7('0x12'));_0x1e78f3[_0xf8f7('0x13')](_0x396246);_0x1e78f3[_0xf8f7('0x14')]();_0x1e78f3['on'](_0xf8f7('0x19'),function(){return _0x3c1055(_0x2a477c);});}catch(_0x33e061){fs[_0xf8f7('0x16')](_0x2a477c);return _0x261a66(_0x33e061);}});});};exports[_0xf8f7('0x1a')]=function(_0x360c7b,_0x1e7953,_0x29e264){var _0x2899f7=_0x29e264||stringOptions[_0xf8f7('0x7')];var _0x516fdc=_0x1e7953||stringOptions[_0xf8f7('0x1b')];var _0x225991=crypto[_0xf8f7('0x1c')](_0x2899f7,_0x516fdc);var _0x3bc97f=_0x225991[_0xf8f7('0x11')](_0x360c7b,'utf8',_0xf8f7('0x1d'));_0x3bc97f+=_0x225991['final'](_0xf8f7('0x1d'));return _0x3bc97f;};exports[_0xf8f7('0x1e')]=function(_0x599844,_0x5ef66a,_0x6cb9ff){var _0x117fa1=_0x6cb9ff||stringOptions[_0xf8f7('0x7')];var _0x2584be=_0x5ef66a||stringOptions[_0xf8f7('0x1b')];var _0x5e65ba=crypto[_0xf8f7('0x1f')](_0x117fa1,_0x2584be);var _0x29f16f=_0x5e65ba[_0xf8f7('0x11')](_0x599844,'base64',_0xf8f7('0x20'));_0x29f16f+=_0x5e65ba[_0xf8f7('0x15')](_0xf8f7('0x20'));return _0x29f16f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3b9e794..263397f 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 _0x381e=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','info','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','query','format','sequelize','QueryTypes','SELECT','num','Empty','range','forEach'];(function(_0x5e17fb,_0x6d27d2){var _0x351db1=function(_0x2062f9){while(--_0x2062f9){_0x5e17fb['push'](_0x5e17fb['shift']());}};_0x351db1(++_0x6d27d2);}(_0x381e,0x13d));var _0xe381=function(_0x3320cb,_0x281a47){_0x3320cb=_0x3320cb-0x0;var _0x1eaea1=_0x381e[_0x3320cb];return _0x1eaea1;};'use strict';var util=require(_0xe381('0x0'));var path=require(_0xe381('0x1'));var _=require(_0xe381('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe381('0x3'));var rimraf=require(_0xe381('0x4'));var db=require(_0xe381('0x5'))['db'];var dbH=require(_0xe381('0x5'))[_0xe381('0x6')];var logger=require(_0xe381('0x7'))(_0xe381('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe381('0x9')][0x2]);var QUERY=process[_0xe381('0x9')][0x3];var PATH=process[_0xe381('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b9258,_0x528b0e){var _0x4027dd={'status':_0x5b9258};var _0x1d1ce4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x528b0e){_0x4027dd[_0xe381('0xa')]=_0x528b0e;}return db['AnalyticExtractedReport'][_0xe381('0xb')](_0x4027dd,_0x1d1ce4);}function main(){var _0x4321e7=0x1388;var _0x5ddc36;logger['info'](util['format'](_0xe381('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xe381('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe381('0xe'),_0xe381('0xf')]})[_0xe381('0x10')](function(_0x51d4cd){if(_0x51d4cd){_0x5ddc36=_0x51d4cd;_0x4321e7=_0x5ddc36[_0xe381('0xf')]||0x1388;}})[_0xe381('0x10')](function(){return dbH['sequelize'][_0xe381('0x11')](util[_0xe381('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe381('0x13')][_0xe381('0x14')][_0xe381('0x15')]});})['then'](function(_0x346b48){if(!_0x346b48[0x0][_0xe381('0x16')]){return analyticExtractedReport(_0xe381('0x17'));}var _0x46dfba=[];var _0x1bbdea=0x0;if(_0x5ddc36[_0xe381('0xe')]){if(_0x346b48&&_0x346b48['length']){var _0x4f8fc4=_[_0xe381('0x18')](_0x346b48[0x0][_0xe381('0x16')]/_0x4321e7);var _0x3e9d9a=Number['isInteger'](_0x346b48[0x0][_0xe381('0x16')]/_0x4321e7)?_0x346b48[0x0][_0xe381('0x16')]%_0x4321e7:0x0;_0x4f8fc4[_0xe381('0x19')](function(_0x30d979){if(_0x30d979>0x0){_0x1bbdea+=_0x4321e7;}_0x46dfba[_0xe381('0x1a')](dbH['sequelize'][_0xe381('0x11')](util['format'](_0xe381('0x1b'),QUERY,_0x4321e7,_0x1bbdea),{'type':dbH[_0xe381('0x13')][_0xe381('0x14')][_0xe381('0x15')]}));});if(_0x3e9d9a>0x0){_0x1bbdea+=_0x4321e7;_0x46dfba[_0xe381('0x1a')](dbH[_0xe381('0x13')][_0xe381('0x11')](util['format'](_0xe381('0x1b'),QUERY,_0x3e9d9a,_0x1bbdea),{'type':dbH[_0xe381('0x13')][_0xe381('0x14')][_0xe381('0x15')]}));}}}else{_0x46dfba[_0xe381('0x1a')](dbH['sequelize'][_0xe381('0x11')](QUERY,{'type':dbH[_0xe381('0x13')][_0xe381('0x14')][_0xe381('0x15')]}));}var _0x2f9c53=path[_0xe381('0x1c')](PATH);var _0x492513=path[_0xe381('0x1d')](PATH,_0xe381('0x1e'));var _0x29e7d0=_0x5ddc36[_0xe381('0xe')]&&_0x46dfba[_0xe381('0x1f')]>0x1;var _0x33905d=[];if(!fs[_0xe381('0x20')](path[_0xe381('0x21')](_0x2f9c53,_0x492513))&&_0x29e7d0){fs[_0xe381('0x22')](path[_0xe381('0x21')](_0x2f9c53,_0x492513));}return BPromise[_0xe381('0x23')](_0x46dfba,function(_0x37c9f9){_0x33905d[_0xe381('0x1a')](_0x37c9f9);})[_0xe381('0x10')](function(){for(var _0x47ab7d=0x0;_0x47ab7d<_0x33905d[_0xe381('0x1f')];_0x47ab7d+=0x1){var _0x3e7de2;var _0x10b743=_0x33905d[_0x47ab7d];if(_0x29e7d0){_0x3e7de2=path[_0xe381('0x21')](_0x2f9c53,_0x492513,util[_0xe381('0x12')](_0xe381('0x24'),_0x492513,_0x47ab7d,_0xe381('0x25')));}else{_0x3e7de2=path[_0xe381('0x21')](_0x2f9c53,util[_0xe381('0x12')](_0xe381('0x26'),_0x492513,_0xe381('0x25')));}fs[_0xe381('0x27')](_0x3e7de2,csv(_0x10b743));}})['then'](function(){if(_0x29e7d0){return new Promise(function(_0x15aeeb){zipdir(path['join'](_0x2f9c53,_0x492513),{'saveTo':path[_0xe381('0x21')](_0x2f9c53,util[_0xe381('0x12')](_0xe381('0x26'),_0x492513,_0xe381('0x28')))},function(_0x4a654e,_0x4a347a){rimraf(path[_0xe381('0x21')](_0x2f9c53,_0x492513),function(){});_0x15aeeb('zip\x20finished');});});}})['then'](function(){logger[_0xe381('0x29')](util[_0xe381('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe381('0x2a')));return analyticExtractedReport(_0xe381('0x2b'),_0x29e7d0?util[_0xe381('0x12')]('%s.%s',_0x492513,_0x29e7d0?_0xe381('0x28'):'csv'):null);});})[_0xe381('0x2c')](function(_0x2a5a16){logger[_0xe381('0x29')](util[_0xe381('0x12')](_0xe381('0x2d'),EXTRACTED_REPORT_ID,_0xe381('0x2a')),util[_0xe381('0x2e')](_0x2a5a16,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe381('0x2f')](function(){process[_0xe381('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe2be=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xe2be,0xd2));var _0xee2b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe2be[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0xee2b('0x0'));var path=require('path');var _=require(_0xee2b('0x1'));var csv=require(_0xee2b('0x2'));var fs=require('fs');var BPromise=require(_0xee2b('0x3'));var zipdir=require(_0xee2b('0x4'));var rimraf=require(_0xee2b('0x5'));var db=require(_0xee2b('0x6'))['db'];var dbH=require('../../mysqldb')[_0xee2b('0x7')];var logger=require(_0xee2b('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xee2b('0x9')][0x2]);var QUERY=process[_0xee2b('0x9')][0x3];var PATH=process[_0xee2b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d9e3f,_0x4d59d5){var _0x53e1ba={'status':_0x5d9e3f};var _0x208042={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d59d5){_0x53e1ba[_0xee2b('0xa')]=_0x4d59d5;}return db['AnalyticExtractedReport']['update'](_0x53e1ba,_0x208042);}function main(){var _0x42070e=0x1388;var _0x387e57;logger['info'](util[_0xee2b('0xb')](_0xee2b('0xc'),EXTRACTED_REPORT_ID,_0xee2b('0xd')));return db[_0xee2b('0xe')][_0xee2b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee2b('0x10'),_0xee2b('0x11')]})[_0xee2b('0x12')](function(_0x39dcb4){if(_0x39dcb4){_0x387e57=_0x39dcb4;_0x42070e=_0x387e57[_0xee2b('0x11')]||0x1388;}})[_0xee2b('0x12')](function(){return dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x15'),QUERY),{'type':dbH[_0xee2b('0x13')][_0xee2b('0x16')][_0xee2b('0x17')]});})[_0xee2b('0x12')](function(_0x131205){if(!_0x131205[0x0]['num']){return analyticExtractedReport(_0xee2b('0x18'));}var _0x5cfe7b=[];var _0x1bbc82=0x0;if(_0x387e57[_0xee2b('0x10')]){if(_0x131205&&_0x131205[_0xee2b('0x19')]){var _0x3b47e1=_[_0xee2b('0x1a')](_0x131205[0x0][_0xee2b('0x1b')]/_0x42070e);var _0x5c4d36=Number['isInteger'](_0x131205[0x0][_0xee2b('0x1b')]/_0x42070e)?_0x131205[0x0][_0xee2b('0x1b')]%_0x42070e:0x0;_0x3b47e1[_0xee2b('0x1c')](function(_0x358381){if(_0x358381>0x0){_0x1bbc82+=_0x42070e;}_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x1e'),QUERY,_0x42070e,_0x1bbc82),{'type':dbH['sequelize'][_0xee2b('0x16')][_0xee2b('0x17')]}));});if(_0x5c4d36>0x0){_0x1bbc82+=_0x42070e;_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](util['format'](_0xee2b('0x1e'),QUERY,_0x5c4d36,_0x1bbc82),{'type':dbH[_0xee2b('0x13')][_0xee2b('0x16')][_0xee2b('0x17')]}));}}}else{_0x5cfe7b[_0xee2b('0x1d')](dbH[_0xee2b('0x13')][_0xee2b('0x14')](QUERY,{'type':dbH['sequelize'][_0xee2b('0x16')]['SELECT']}));}var _0x51570a=path[_0xee2b('0x1f')](PATH);var _0x4e81f9=path[_0xee2b('0x20')](PATH,'.csv');var _0x428a3e=_0x387e57[_0xee2b('0x10')]&&_0x5cfe7b['length']>0x1;var _0x126561=[];if(!fs[_0xee2b('0x21')](path[_0xee2b('0x22')](_0x51570a,_0x4e81f9))&&_0x428a3e){fs[_0xee2b('0x23')](path[_0xee2b('0x22')](_0x51570a,_0x4e81f9));}return BPromise['each'](_0x5cfe7b,function(_0x55ae52){_0x126561['push'](_0x55ae52);})[_0xee2b('0x12')](function(){for(var _0x158fde=0x0;_0x158fde<_0x126561[_0xee2b('0x19')];_0x158fde+=0x1){var _0x1f4a80;var _0x5f32fe=_0x126561[_0x158fde];if(_0x428a3e){_0x1f4a80=path[_0xee2b('0x22')](_0x51570a,_0x4e81f9,util[_0xee2b('0xb')](_0xee2b('0x24'),_0x4e81f9,_0x158fde,_0xee2b('0x25')));}else{_0x1f4a80=path[_0xee2b('0x22')](_0x51570a,util['format'](_0xee2b('0x26'),_0x4e81f9,_0xee2b('0x25')));}fs['writeFileSync'](_0x1f4a80,csv(_0x5f32fe));}})[_0xee2b('0x12')](function(){if(_0x428a3e){return new Promise(function(_0x358f59){zipdir(path[_0xee2b('0x22')](_0x51570a,_0x4e81f9),{'saveTo':path['join'](_0x51570a,util['format'](_0xee2b('0x26'),_0x4e81f9,_0xee2b('0x27')))},function(_0x237c80,_0x282144){rimraf(path[_0xee2b('0x22')](_0x51570a,_0x4e81f9),function(){});_0x358f59(_0xee2b('0x28'));});});}})[_0xee2b('0x12')](function(){logger['info'](util[_0xee2b('0xb')](_0xee2b('0x29'),EXTRACTED_REPORT_ID,_0xee2b('0xd')));return analyticExtractedReport(_0xee2b('0x2a'),_0x428a3e?util[_0xee2b('0xb')](_0xee2b('0x26'),_0x4e81f9,_0x428a3e?_0xee2b('0x27'):_0xee2b('0x25')):null);});})['catch'](function(_0x2c50a0){logger[_0xee2b('0x2b')](util[_0xee2b('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xee2b('0xd')),util[_0xee2b('0x2c')](_0x2c50a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xee2b('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1e07651..4251e67 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 _0x97fb=['splitSizePdf','then','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','.pdf','split','mkdirSync','each','flatten','join','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','path','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','endDate','pageBreak','before','margin','footer','black','right','num','Empty','Setting','find'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x97fb,0x8c));var _0xb97f=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0x97fb[_0x3fe6df];return _0x372a0e;};'use strict';var _=require(_0xb97f('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xb97f('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xb97f('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xb97f('0x3'));var rimraf=require(_0xb97f('0x4'));var JSDOM=require(_0xb97f('0x5'))[_0xb97f('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0xb97f('0x7'))['db'];var dbH=require(_0xb97f('0x7'))[_0xb97f('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb97f('0x9')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a19b7,_0x92af2c){var _0x3567c9={'status':_0x3a19b7};var _0x8dc6cd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x92af2c){_0x3567c9[_0xb97f('0xa')]=_0x92af2c;}return db[_0xb97f('0xb')][_0xb97f('0xc')](_0x3567c9,_0x8dc6cd);}function getHeaders(_0x4becfa){return _['map'](_0x4becfa,function(_0x9af061){return{'text':_0x9af061,'style':_0xb97f('0xd')};});}function getRows(_0x93d85b,_0x236920){return _[_0xb97f('0xe')](_0x236920,function(_0x94eee8){return _(_0x94eee8)[_0xb97f('0xf')](_0x93d85b)[_0xb97f('0xe')](function(_0x2f73ac){return _0x2f73ac?_[_0xb97f('0x10')](_0x2f73ac):'';})[_0xb97f('0x11')]();});}function createTable(_0x390abf,_0x22469f){var _0x32f7ce={'widths':_[_0xb97f('0x12')](Array(_0x390abf[_0xb97f('0x13')]),0x91),'heights':function(_0x26508a){return _0x26508a===0x0?_0xb97f('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4cb807=getHeaders(_0x390abf);_0x32f7ce[_0xb97f('0x15')][_0xb97f('0x16')](_0x4cb807);var _0x4160ed=getRows(_0x390abf,_0x22469f);_0x32f7ce[_0xb97f('0x15')]=_0x32f7ce['body'][_0xb97f('0x17')](_0x4160ed);return _0x32f7ce;}function createTables(_0x2a7bb5){var _0x229104=[];var _0x1139c5=_[_0xb97f('0x18')](Object[_0xb97f('0x19')](_0x2a7bb5[0x0]),0x5);_0x1139c5[_0xb97f('0x1a')](function(_0x453d77){_0x229104[_0xb97f('0x16')](createTable(_0x453d77,_0x2a7bb5));});return _0x229104;}function getPDFDocDefinition(_0x388e94){var _0x17e321=util[_0xb97f('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xb97f('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xb97f('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0xb97f('0x1d')])['format'](FORMAT));var _0x236f7a=[];for(var _0xbb8d4=0x0;_0xbb8d4<_0x388e94[_0xb97f('0x13')];_0xbb8d4++){var _0x28e89a=[];if(_0xbb8d4===0x0){_0x28e89a[_0xb97f('0x16')]({'text':_0x17e321,'style':'header'});}var _0x5e9c51={'table':_0x388e94[_0xbb8d4]};if(_0xbb8d4>0x0){_0x5e9c51[_0xb97f('0x1e')]=_0xb97f('0x1f');_0x5e9c51[_0xb97f('0x20')]=[0x0,0x46,0x0,0x0];}_0x28e89a['push'](_0x5e9c51);_0x236f7a[_0xb97f('0x16')](_0x28e89a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x236f7a,'footer':function(_0x2eb954,_0x350ab1){return{'text':_0x2eb954[_0xb97f('0x10')]()+'\x20/\x20'+_0x350ab1,'style':_0xb97f('0x21')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb97f('0x22')},'footer':{'alignment':_0xb97f('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5be3f2){var _0x254546=0x1388;var _0x1a5dc8;if(!_0x5be3f2[0x0][_0xb97f('0x24')]){return analyticExtractedReport(_0xb97f('0x25'));}return db[_0xb97f('0x26')][_0xb97f('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb97f('0x28')]})[_0xb97f('0x29')](function(_0x36436a){if(_0x36436a){_0x1a5dc8=_0x36436a;_0x254546=_0x1a5dc8[_0xb97f('0x28')]||0x3e8;}})[_0xb97f('0x29')](function(){var _0x536ec8=[];var _0x28c5d9=0x0;if(_0x1a5dc8['split']){if(_0x5be3f2&&_0x5be3f2[_0xb97f('0x13')]){var _0x188c22=_[_0xb97f('0x2a')](_0x5be3f2[0x0][_0xb97f('0x24')]/_0x254546);var _0x7caa5c=Number[_0xb97f('0x2b')](_0x5be3f2[0x0][_0xb97f('0x24')]/_0x254546)?_0x5be3f2[0x0][_0xb97f('0x24')]%_0x254546:0x0;_0x188c22[_0xb97f('0x1a')](function(_0x179ba3){if(_0x179ba3>0x0){_0x28c5d9+=_0x254546;}_0x536ec8[_0xb97f('0x16')](dbH[_0xb97f('0x2c')]['query'](util['format'](_0xb97f('0x2d'),QUERY,_0x254546,_0x28c5d9),{'type':dbH[_0xb97f('0x2c')][_0xb97f('0x2e')][_0xb97f('0x2f')]}));});if(_0x7caa5c>0x0){_0x28c5d9+=_0x254546;_0x536ec8[_0xb97f('0x16')](dbH[_0xb97f('0x2c')][_0xb97f('0x30')](util[_0xb97f('0x1b')](_0xb97f('0x2d'),QUERY,_0x7caa5c,_0x28c5d9),{'type':dbH['sequelize'][_0xb97f('0x2e')][_0xb97f('0x2f')]}));}}}else{_0x536ec8[_0xb97f('0x16')](dbH[_0xb97f('0x2c')][_0xb97f('0x30')](QUERY,{'type':dbH[_0xb97f('0x2c')][_0xb97f('0x2e')]['SELECT']}));}var _0x36585b=path[_0xb97f('0x31')](PATH);var _0x23fc39=path['basename'](PATH,_0xb97f('0x32'));var _0x391749=_0x1a5dc8[_0xb97f('0x33')]&&_0x536ec8[_0xb97f('0x13')]>0x1;var _0x20cc59=[];if(!fs['existsSync'](path['join'](_0x36585b,_0x23fc39))&&_0x391749){fs[_0xb97f('0x34')](path['join'](_0x36585b,_0x23fc39));}return BPromise[_0xb97f('0x35')](_0x536ec8,function(_0x540aef){_0x20cc59[_0xb97f('0x16')](_0x540aef);})['then'](function(){var _0x2716be=[];for(var _0x36d77d=0x0;_0x36d77d<_0x20cc59[_0xb97f('0x13')];_0x36d77d+=0x1){var _0x4f6100=_0x20cc59[_0x36d77d];var _0x5b2636=createTables(_[_0xb97f('0x36')](_0x4f6100));var _0x1390b5;var _0x3ad33b=getPDFDocDefinition(_0x5b2636);var _0xba00f=getPDFPrinter();var _0x46ddf0=_0xba00f['createPdfKitDocument'](_0x3ad33b);if(_0x391749){_0x1390b5=path[_0xb97f('0x37')](_0x36585b,_0x23fc39,util['format'](_0xb97f('0x38'),_0x23fc39,_0x36d77d,'pdf'));}else{_0x1390b5=path[_0xb97f('0x37')](_0x36585b,util[_0xb97f('0x1b')](_0xb97f('0x39'),_0x23fc39,_0xb97f('0x3a')));}_0x2716be[_0xb97f('0x16')](writePDFDocument(_0x46ddf0,_0x1390b5));}return Promise[_0xb97f('0x3b')](_0x2716be);})[_0xb97f('0x29')](function(){if(_0x391749){return new Promise(function(_0x633b1e){zipdir(path[_0xb97f('0x37')](_0x36585b,_0x23fc39),{'saveTo':path[_0xb97f('0x37')](_0x36585b,util[_0xb97f('0x1b')](_0xb97f('0x39'),_0x23fc39,_0xb97f('0x3c')))},function(){rimraf(path[_0xb97f('0x37')](_0x36585b,_0x23fc39),function(){});_0x633b1e(_0xb97f('0x3d'));});});}})[_0xb97f('0x29')](function(){if(!_0x391749)return;rimraf(path[_0xb97f('0x37')](_0x36585b,_0x23fc39),function(){});})[_0xb97f('0x29')](function(){logger[_0xb97f('0x3e')](util[_0xb97f('0x1b')](_0xb97f('0x3f'),EXTRACTED_REPORT_ID,_0xb97f('0x40')));return analyticExtractedReport(_0xb97f('0x41'),_0x391749?util[_0xb97f('0x1b')](_0xb97f('0x39'),_0x23fc39,_0x391749?_0xb97f('0x3c'):_0xb97f('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb97f('0x3e')](util[_0xb97f('0x1b')](_0xb97f('0x42'),EXTRACTED_REPORT_ID,_0xb97f('0x40')));return db[_0xb97f('0xb')][_0xb97f('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5dde15){EXTRACTED_REPORT=_0x5dde15;return dbH[_0xb97f('0x2c')][_0xb97f('0x30')](util[_0xb97f('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb97f('0x2c')][_0xb97f('0x2e')]['SELECT']});})[_0xb97f('0x29')](extractReport)[_0xb97f('0x44')](function(_0xc91143){logger[_0xb97f('0x3e')](util[_0xb97f('0x1b')](_0xb97f('0x45'),EXTRACTED_REPORT_ID,_0xb97f('0x40')),util[_0xb97f('0x46')](_0xc91143,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb97f('0x47')](function(){process[_0xb97f('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x50f52e=new PdfPrinter({'Arial':{'normal':__dirname+_0xb97f('0x49'),'bold':__dirname+_0xb97f('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x50f52e;}function getPDFDocDefinitionFromHTML(_0x91b393,_0x374fc9){var _0x3e7269=util['format'](_0xb97f('0x4b'),_0x374fc9[_0xb97f('0x4c')],_0x374fc9[_0xb97f('0x4d')]);var _0x36f629=moment()[_0xb97f('0x1b')](_0xb97f('0x4e'))['toString']();var _0x185259=htmlToPdfmake(_0x91b393,{'window':window,'tableAutoSize':!![]});return{'content':[_0x185259],'defaultStyle':{'font':_0xb97f('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb97f('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb97f('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb97f('0x50')}},'header':function(){return[{'text':_0xb97f('0x51'),'style':_0xb97f('0x52')}];},'footer':function(_0x25db23,_0x4229f0){return[{'text':util[_0xb97f('0x1b')](_0xb97f('0x53'),_0x3e7269,_0x25db23,_0x4229f0,_0x36f629),'style':'footer'}];}};}function writePDFDocument(_0x426651,_0x29de0b){return new Promise(function(_0x36baf2,_0x5da3b5){var _0x49b04b=_0x426651[_0xb97f('0x54')](fs['createWriteStream'](_0x29de0b));_0x49b04b['on'](_0xb97f('0x55'),function(){_0x36baf2(_0xb97f('0x55'));});_0x49b04b['on'](_0xb97f('0x56'),function(_0x9198d0){_0x5da3b5(_0x9198d0);});_0x426651[_0xb97f('0x57')]();});}exports[_0xb97f('0x58')]=function(_0x248c0f,_0x33e3ed){var _0x2cf835=getPDFPrinter();var _0xad06a9=getPDFDocDefinitionFromHTML(_0x248c0f,_0x33e3ed);var _0x33643b=_0x2cf835[_0xb97f('0x59')](_0xad06a9);return writePDFDocument(_0x33643b,_0x33e3ed[_0xb97f('0x1')])[_0xb97f('0x44')](function(_0x1d0fdc){throw _0x1d0fdc;});}; \ No newline at end of file +var _0xed9f=['%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','landscape','\x20/\x20','Arial','black','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','existsSync','join','mkdirSync','each','createPdfKitDocument'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed9f,0xd1));var _0xfed9=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xed9f[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xfed9('0x0'));var fs=require('fs');var util=require(_0xfed9('0x1'));var path=require(_0xfed9('0x2'));var moment=require(_0xfed9('0x3'));var htmlToPdfmake=require(_0xfed9('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xfed9('0x5'));var rimraf=require(_0xfed9('0x6'));var JSDOM=require('jsdom')[_0xfed9('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xfed9('0x8'));var db=require(_0xfed9('0x9'))['db'];var dbH=require('../../mysqldb')[_0xfed9('0xa')];var logger=require(_0xfed9('0xb'))(_0xfed9('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xfed9('0xd')][0x2]);var QUERY=process[_0xfed9('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xfed9('0xd')][0x5];var FORMAT=_0xfed9('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b358e,_0x3da781){var _0x959843={'status':_0x2b358e};var _0x138be1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3da781){_0x959843['savename']=_0x3da781;}return db[_0xfed9('0xf')]['update'](_0x959843,_0x138be1);}function getHeaders(_0x5f5015){return _[_0xfed9('0x10')](_0x5f5015,function(_0x1078af){return{'text':_0x1078af,'style':_0xfed9('0x11')};});}function getRows(_0x20743c,_0x366025){return _[_0xfed9('0x10')](_0x366025,function(_0x1ba246){return _(_0x1ba246)[_0xfed9('0x12')](_0x20743c)['map'](function(_0x518263){return _0x518263?_[_0xfed9('0x13')](_0x518263):'';})[_0xfed9('0x14')]();});}function createTable(_0x1f915b,_0x57ece1){var _0x52223b={'widths':_[_0xfed9('0x15')](Array(_0x1f915b[_0xfed9('0x16')]),0x91),'heights':function(_0x5c0198){return _0x5c0198===0x0?_0xfed9('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1bf636=getHeaders(_0x1f915b);_0x52223b[_0xfed9('0x18')][_0xfed9('0x19')](_0x1bf636);var _0x5815d3=getRows(_0x1f915b,_0x57ece1);_0x52223b[_0xfed9('0x18')]=_0x52223b['body'][_0xfed9('0x1a')](_0x5815d3);return _0x52223b;}function createTables(_0x343be1){var _0x2db4f4=[];var _0x5830a3=_[_0xfed9('0x1b')](Object[_0xfed9('0x1c')](_0x343be1[0x0]),0x5);_0x5830a3[_0xfed9('0x1d')](function(_0x9be7b0){_0x2db4f4[_0xfed9('0x19')](createTable(_0x9be7b0,_0x343be1));});return _0x2db4f4;}function getPDFDocDefinition(_0x599b51){var _0x4cb463=util[_0xfed9('0x1e')](_0xfed9('0x1f'),NAME,EXTRACTED_REPORT[_0xfed9('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xfed9('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xfed9('0x21')])['format'](FORMAT));var _0x55d094=[];for(var _0x73fee7=0x0;_0x73fee7<_0x599b51[_0xfed9('0x16')];_0x73fee7++){var _0x725efc=[];if(_0x73fee7===0x0){_0x725efc['push']({'text':_0x4cb463,'style':_0xfed9('0x22')});}var _0x371c7c={'table':_0x599b51[_0x73fee7]};if(_0x73fee7>0x0){_0x371c7c['pageBreak']='before';_0x371c7c['margin']=[0x0,0x46,0x0,0x0];}_0x725efc[_0xfed9('0x19')](_0x371c7c);_0x55d094[_0xfed9('0x19')](_0x725efc);}return{'pageSize':'A4','pageOrientation':_0xfed9('0x23'),'content':_0x55d094,'footer':function(_0x2f0a6e,_0x38700a){return{'text':_0x2f0a6e[_0xfed9('0x13')]()+_0xfed9('0x24')+_0x38700a,'style':'footer'};},'defaultStyle':{'font':_0xfed9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfed9('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1b69d1){var _0x17507b=0x1388;var _0x30c315;if(!_0x1b69d1[0x0][_0xfed9('0x27')]){return analyticExtractedReport(_0xfed9('0x28'));}return db[_0xfed9('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfed9('0x2a'),_0xfed9('0x2b')]})[_0xfed9('0x2c')](function(_0x4c1f2d){if(_0x4c1f2d){_0x30c315=_0x4c1f2d;_0x17507b=_0x30c315[_0xfed9('0x2b')]||0x3e8;}})['then'](function(){var _0x15dc5e=[];var _0xa4101c=0x0;if(_0x30c315[_0xfed9('0x2a')]){if(_0x1b69d1&&_0x1b69d1['length']){var _0x44bcb4=_[_0xfed9('0x2d')](_0x1b69d1[0x0][_0xfed9('0x27')]/_0x17507b);var _0x5b4c3b=Number[_0xfed9('0x2e')](_0x1b69d1[0x0][_0xfed9('0x27')]/_0x17507b)?_0x1b69d1[0x0][_0xfed9('0x27')]%_0x17507b:0x0;_0x44bcb4['forEach'](function(_0x2c6d31){if(_0x2c6d31>0x0){_0xa4101c+=_0x17507b;}_0x15dc5e[_0xfed9('0x19')](dbH['sequelize']['query'](util[_0xfed9('0x1e')](_0xfed9('0x2f'),QUERY,_0x17507b,_0xa4101c),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')][_0xfed9('0x32')]}));});if(_0x5b4c3b>0x0){_0xa4101c+=_0x17507b;_0x15dc5e[_0xfed9('0x19')](dbH[_0xfed9('0x30')][_0xfed9('0x33')](util[_0xfed9('0x1e')](_0xfed9('0x2f'),QUERY,_0x5b4c3b,_0xa4101c),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')][_0xfed9('0x32')]}));}}}else{_0x15dc5e[_0xfed9('0x19')](dbH[_0xfed9('0x30')][_0xfed9('0x33')](QUERY,{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')]['SELECT']}));}var _0x4da09c=path['dirname'](PATH);var _0x43554d=path[_0xfed9('0x34')](PATH,'.pdf');var _0x9378e6=_0x30c315['split']&&_0x15dc5e[_0xfed9('0x16')]>0x1;var _0x54b736=[];if(!fs[_0xfed9('0x35')](path[_0xfed9('0x36')](_0x4da09c,_0x43554d))&&_0x9378e6){fs[_0xfed9('0x37')](path[_0xfed9('0x36')](_0x4da09c,_0x43554d));}return BPromise[_0xfed9('0x38')](_0x15dc5e,function(_0x296f18){_0x54b736[_0xfed9('0x19')](_0x296f18);})[_0xfed9('0x2c')](function(){var _0x4ce398=[];for(var _0x486624=0x0;_0x486624<_0x54b736[_0xfed9('0x16')];_0x486624+=0x1){var _0x46c5e3=_0x54b736[_0x486624];var _0x2f159f=createTables(_['flatten'](_0x46c5e3));var _0x32517b;var _0x1cb32c=getPDFDocDefinition(_0x2f159f);var _0x2175b4=getPDFPrinter();var _0xc3698=_0x2175b4[_0xfed9('0x39')](_0x1cb32c);if(_0x9378e6){_0x32517b=path['join'](_0x4da09c,_0x43554d,util[_0xfed9('0x1e')](_0xfed9('0x3a'),_0x43554d,_0x486624,_0xfed9('0x3b')));}else{_0x32517b=path['join'](_0x4da09c,util[_0xfed9('0x1e')](_0xfed9('0x3c'),_0x43554d,_0xfed9('0x3b')));}_0x4ce398[_0xfed9('0x19')](writePDFDocument(_0xc3698,_0x32517b));}return Promise[_0xfed9('0x3d')](_0x4ce398);})['then'](function(){if(_0x9378e6){return new Promise(function(_0x5780cd){zipdir(path['join'](_0x4da09c,_0x43554d),{'saveTo':path[_0xfed9('0x36')](_0x4da09c,util[_0xfed9('0x1e')](_0xfed9('0x3c'),_0x43554d,_0xfed9('0x3e')))},function(){rimraf(path[_0xfed9('0x36')](_0x4da09c,_0x43554d),function(){});_0x5780cd(_0xfed9('0x3f'));});});}})[_0xfed9('0x2c')](function(){if(!_0x9378e6)return;rimraf(path[_0xfed9('0x36')](_0x4da09c,_0x43554d),function(){});})[_0xfed9('0x2c')](function(){logger[_0xfed9('0x40')](util['format'](_0xfed9('0x41'),EXTRACTED_REPORT_ID,_0xfed9('0x42')));return analyticExtractedReport(_0xfed9('0x43'),_0x9378e6?util[_0xfed9('0x1e')]('%s.%s',_0x43554d,_0x9378e6?_0xfed9('0x3e'):_0xfed9('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xfed9('0x1e')](_0xfed9('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xfed9('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2b512f){EXTRACTED_REPORT=_0x2b512f;return dbH['sequelize'][_0xfed9('0x33')](util[_0xfed9('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xfed9('0x30')][_0xfed9('0x31')]['SELECT']});})['then'](extractReport)[_0xfed9('0x45')](function(_0x48e60f){logger['info'](util[_0xfed9('0x1e')](_0xfed9('0x46'),EXTRACTED_REPORT_ID,_0xfed9('0x42')),util['inspect'](_0x48e60f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfed9('0x47'));})[_0xfed9('0x48')](function(){process[_0xfed9('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xe0dd36=new PdfPrinter({'Arial':{'normal':__dirname+_0xfed9('0x4a'),'bold':__dirname+_0xfed9('0x4b'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xe0dd36;}function getPDFDocDefinitionFromHTML(_0xdadb62,_0x18d88a){var _0x28623c=util[_0xfed9('0x1e')](_0xfed9('0x4c'),_0x18d88a[_0xfed9('0x4d')],_0x18d88a[_0xfed9('0x4e')]);var _0x2b2c21=moment()[_0xfed9('0x1e')](_0xfed9('0x4f'))[_0xfed9('0x13')]();var _0x1e532a=htmlToPdfmake(_0xdadb62,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e532a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfed9('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfed9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfed9('0x50')}},'header':function(){return[{'text':_0xfed9('0x51'),'style':_0xfed9('0x22')}];},'footer':function(_0x397cff,_0x175d45){return[{'text':util[_0xfed9('0x1e')](_0xfed9('0x52'),_0x28623c,_0x397cff,_0x175d45,_0x2b2c21),'style':'footer'}];}};}function writePDFDocument(_0x339480,_0x3274cd){return new Promise(function(_0x448a51,_0x501b10){var _0x2d053c=_0x339480[_0xfed9('0x53')](fs[_0xfed9('0x54')](_0x3274cd));_0x2d053c['on'](_0xfed9('0x55'),function(){_0x448a51(_0xfed9('0x55'));});_0x2d053c['on'](_0xfed9('0x56'),function(_0x29528e){_0x501b10(_0x29528e);});_0x339480[_0xfed9('0x57')]();});}exports[_0xfed9('0x58')]=function(_0x24205d,_0x26347c){var _0x2879b8=getPDFPrinter();var _0x384240=getPDFDocDefinitionFromHTML(_0x24205d,_0x26347c);var _0x215190=_0x2879b8[_0xfed9('0x39')](_0x384240);return writePDFDocument(_0x215190,_0x26347c[_0xfed9('0x2')])['catch'](function(_0x5c8ca5){throw _0x5c8ca5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5d8b2f1..f7d38db 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 _0x5158=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','dirname','basename','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Setting','find','split','splitSizeXlsx'];(function(_0x319891,_0x9b28dc){var _0x8df70c=function(_0x3301f4){while(--_0x3301f4){_0x319891['push'](_0x319891['shift']());}};_0x8df70c(++_0x9b28dc);}(_0x5158,0x1d7));var _0x8515=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x5158[_0x44bcb0];return _0xfaf881;};'use strict';var util=require(_0x8515('0x0'));var path=require(_0x8515('0x1'));var _=require(_0x8515('0x2'));var fs=require('fs');var json2xls=require(_0x8515('0x3'));var BPromise=require(_0x8515('0x4'));var zipdir=require(_0x8515('0x5'));var rimraf=require(_0x8515('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8515('0x7'))[_0x8515('0x8')];var logger=require(_0x8515('0x9'))(_0x8515('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8515('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xaaeb9c,_0x12a758){var _0x4ee732={'status':_0xaaeb9c};var _0x4fbf81={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12a758){_0x4ee732['savename']=_0x12a758;}return db['AnalyticExtractedReport'][_0x8515('0xc')](_0x4ee732,_0x4fbf81);}function main(){var _0x32bef5=0x1388;var _0x5db24c;logger[_0x8515('0xd')](util[_0x8515('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x8515('0xf')][_0x8515('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8515('0x11'),_0x8515('0x12')]})['then'](function(_0x55e18e){if(_0x55e18e){_0x5db24c=_0x55e18e;_0x32bef5=_0x5db24c[_0x8515('0x12')]||0x1388;}})[_0x8515('0x13')](function(){return dbH[_0x8515('0x14')][_0x8515('0x15')](util['format'](_0x8515('0x16'),QUERY),{'type':dbH['sequelize'][_0x8515('0x17')][_0x8515('0x18')]});})[_0x8515('0x13')](function(_0x3e9ffc){if(!_0x3e9ffc[0x0][_0x8515('0x19')]){return analyticExtractedReport(_0x8515('0x1a'));}var _0x206228=[];var _0xc0aee3=0x0;if(_0x5db24c['split']){if(_0x3e9ffc&&_0x3e9ffc[_0x8515('0x1b')]){var _0x3f7bcf=_['range'](_0x3e9ffc[0x0]['num']/_0x32bef5);var _0x22ca97=Number[_0x8515('0x1c')](_0x3e9ffc[0x0][_0x8515('0x19')]/_0x32bef5)?_0x3e9ffc[0x0]['num']%_0x32bef5:0x0;_0x3f7bcf[_0x8515('0x1d')](function(_0x46b636){if(_0x46b636>0x0){_0xc0aee3+=_0x32bef5;}_0x206228[_0x8515('0x1e')](dbH[_0x8515('0x14')][_0x8515('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x32bef5,_0xc0aee3),{'type':dbH['sequelize'][_0x8515('0x17')][_0x8515('0x18')]}));});if(_0x22ca97>0x0){_0xc0aee3+=_0x32bef5;_0x206228[_0x8515('0x1e')](dbH[_0x8515('0x14')][_0x8515('0x15')](util[_0x8515('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x22ca97,_0xc0aee3),{'type':dbH[_0x8515('0x14')]['QueryTypes'][_0x8515('0x18')]}));}}}else{_0x206228[_0x8515('0x1e')](dbH['sequelize'][_0x8515('0x15')](QUERY,{'type':dbH['sequelize'][_0x8515('0x17')][_0x8515('0x18')]}));}var _0x1803dd=path[_0x8515('0x1f')](PATH);var _0x2b11a0=path[_0x8515('0x20')](PATH,'.xlsx');var _0x4f9f47=_0x5db24c['split']&&_0x206228['length']>0x1;var _0x98f15f=[];if(!fs[_0x8515('0x21')](path[_0x8515('0x22')](_0x1803dd,_0x2b11a0))&&_0x4f9f47){fs['mkdirSync'](path[_0x8515('0x22')](_0x1803dd,_0x2b11a0));}return BPromise[_0x8515('0x23')](_0x206228,function(_0x1d96d7){_0x98f15f[_0x8515('0x1e')](_0x1d96d7);})[_0x8515('0x13')](function(){for(var _0x2eb1e6=0x0;_0x2eb1e6<_0x98f15f[_0x8515('0x1b')];_0x2eb1e6+=0x1){var _0x4cc03a;var _0x280f2b=_0x98f15f[_0x2eb1e6];if(_0x4f9f47){_0x4cc03a=path[_0x8515('0x22')](_0x1803dd,_0x2b11a0,util[_0x8515('0xe')](_0x8515('0x24'),_0x2b11a0,_0x2eb1e6,_0x8515('0x25')));}else{_0x4cc03a=path[_0x8515('0x22')](_0x1803dd,util['format'](_0x8515('0x26'),_0x2b11a0,_0x8515('0x25')));}fs[_0x8515('0x27')](_0x4cc03a,json2xls(_0x280f2b),_0x8515('0x28'));}})['then'](function(){if(_0x4f9f47){return new Promise(function(_0x226f44){zipdir(path['join'](_0x1803dd,_0x2b11a0),{'saveTo':path[_0x8515('0x22')](_0x1803dd,util[_0x8515('0xe')](_0x8515('0x26'),_0x2b11a0,_0x8515('0x29')))},function(_0x33e6c6,_0x2a12ff){rimraf(path[_0x8515('0x22')](_0x1803dd,_0x2b11a0),function(){});_0x226f44(_0x8515('0x2a'));});});}})[_0x8515('0x13')](function(){logger[_0x8515('0xd')](util['format'](_0x8515('0x2b'),EXTRACTED_REPORT_ID,_0x8515('0x2c')));return analyticExtractedReport(_0x8515('0x2d'),_0x4f9f47?util[_0x8515('0xe')]('%s.%s',_0x2b11a0,_0x4f9f47?'zip':_0x8515('0x25')):null);});})[_0x8515('0x2e')](function(_0x17056f){logger[_0x8515('0xd')](util[_0x8515('0xe')](_0x8515('0x2f'),EXTRACTED_REPORT_ID,_0x8515('0x2c')),util['inspect'](_0x17056f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x8515('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x29ce=['Empty','range','num','forEach','push','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','each','xlsx','join','%s.%s','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT'];(function(_0x59e3eb,_0x113485){var _0x3ce496=function(_0x30a4fc){while(--_0x30a4fc){_0x59e3eb['push'](_0x59e3eb['shift']());}};_0x3ce496(++_0x113485);}(_0x29ce,0x1e7));var _0xe29c=function(_0x516f60,_0x2dc44d){_0x516f60=_0x516f60-0x0;var _0x583288=_0x29ce[_0x516f60];return _0x583288;};'use strict';var util=require(_0xe29c('0x0'));var path=require(_0xe29c('0x1'));var _=require(_0xe29c('0x2'));var fs=require('fs');var json2xls=require(_0xe29c('0x3'));var BPromise=require(_0xe29c('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xe29c('0x5'));var db=require(_0xe29c('0x6'))['db'];var dbH=require(_0xe29c('0x6'))[_0xe29c('0x7')];var logger=require(_0xe29c('0x8'))(_0xe29c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe29c('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe29c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1534f6,_0x253159){var _0x53b4f4={'status':_0x1534f6};var _0x3d4ae1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x253159){_0x53b4f4['savename']=_0x253159;}return db[_0xe29c('0xb')][_0xe29c('0xc')](_0x53b4f4,_0x3d4ae1);}function main(){var _0xa4a1df=0x1388;var _0x40fdec;logger['info'](util[_0xe29c('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe29c('0xe')));return db[_0xe29c('0xf')][_0xe29c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe29c('0x11'),_0xe29c('0x12')]})[_0xe29c('0x13')](function(_0x2f90df){if(_0x2f90df){_0x40fdec=_0x2f90df;_0xa4a1df=_0x40fdec['splitSizeXlsx']||0x1388;}})[_0xe29c('0x13')](function(){return dbH['sequelize']['query'](util[_0xe29c('0xd')](_0xe29c('0x14'),QUERY),{'type':dbH[_0xe29c('0x15')]['QueryTypes'][_0xe29c('0x16')]});})[_0xe29c('0x13')](function(_0x267a6e){if(!_0x267a6e[0x0]['num']){return analyticExtractedReport(_0xe29c('0x17'));}var _0x3654fb=[];var _0x3b7a12=0x0;if(_0x40fdec['split']){if(_0x267a6e&&_0x267a6e['length']){var _0x40362d=_[_0xe29c('0x18')](_0x267a6e[0x0][_0xe29c('0x19')]/_0xa4a1df);var _0x57f95a=Number['isInteger'](_0x267a6e[0x0][_0xe29c('0x19')]/_0xa4a1df)?_0x267a6e[0x0]['num']%_0xa4a1df:0x0;_0x40362d[_0xe29c('0x1a')](function(_0x16862c){if(_0x16862c>0x0){_0x3b7a12+=_0xa4a1df;}_0x3654fb[_0xe29c('0x1b')](dbH['sequelize'][_0xe29c('0x1c')](util[_0xe29c('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa4a1df,_0x3b7a12),{'type':dbH[_0xe29c('0x15')][_0xe29c('0x1d')][_0xe29c('0x16')]}));});if(_0x57f95a>0x0){_0x3b7a12+=_0xa4a1df;_0x3654fb[_0xe29c('0x1b')](dbH[_0xe29c('0x15')][_0xe29c('0x1c')](util['format'](_0xe29c('0x1e'),QUERY,_0x57f95a,_0x3b7a12),{'type':dbH[_0xe29c('0x15')][_0xe29c('0x1d')][_0xe29c('0x16')]}));}}}else{_0x3654fb[_0xe29c('0x1b')](dbH[_0xe29c('0x15')][_0xe29c('0x1c')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe29c('0x16')]}));}var _0x4b8411=path[_0xe29c('0x1f')](PATH);var _0x46c6fd=path[_0xe29c('0x20')](PATH,'.xlsx');var _0x3419c1=_0x40fdec[_0xe29c('0x11')]&&_0x3654fb[_0xe29c('0x21')]>0x1;var _0x178716=[];if(!fs[_0xe29c('0x22')](path['join'](_0x4b8411,_0x46c6fd))&&_0x3419c1){fs['mkdirSync'](path['join'](_0x4b8411,_0x46c6fd));}return BPromise[_0xe29c('0x23')](_0x3654fb,function(_0x3a94e1){_0x178716[_0xe29c('0x1b')](_0x3a94e1);})['then'](function(){for(var _0x4b419d=0x0;_0x4b419d<_0x178716[_0xe29c('0x21')];_0x4b419d+=0x1){var _0x17abf0;var _0x582536=_0x178716[_0x4b419d];if(_0x3419c1){_0x17abf0=path['join'](_0x4b8411,_0x46c6fd,util[_0xe29c('0xd')]('%s%d.%s',_0x46c6fd,_0x4b419d,_0xe29c('0x24')));}else{_0x17abf0=path[_0xe29c('0x25')](_0x4b8411,util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,'xlsx'));}fs[_0xe29c('0x27')](_0x17abf0,json2xls(_0x582536),_0xe29c('0x28'));}})[_0xe29c('0x13')](function(){if(_0x3419c1){return new Promise(function(_0x528643){zipdir(path[_0xe29c('0x25')](_0x4b8411,_0x46c6fd),{'saveTo':path[_0xe29c('0x25')](_0x4b8411,util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,'zip'))},function(_0x2d06b7,_0x4089f9){rimraf(path['join'](_0x4b8411,_0x46c6fd),function(){});_0x528643(_0xe29c('0x29'));});});}})[_0xe29c('0x13')](function(){logger[_0xe29c('0x2a')](util['format'](_0xe29c('0x2b'),EXTRACTED_REPORT_ID,_0xe29c('0xe')));return analyticExtractedReport(_0xe29c('0x2c'),_0x3419c1?util[_0xe29c('0xd')](_0xe29c('0x26'),_0x46c6fd,_0x3419c1?_0xe29c('0x2d'):'xlsx'):null);});})[_0xe29c('0x2e')](function(_0x452b66){logger[_0xe29c('0x2a')](util[_0xe29c('0xd')](_0xe29c('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xe29c('0x30')](_0x452b66,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe29c('0x31'));})['finally'](function(){process[_0xe29c('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 00d968c..91106b7 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 _0x15ec=['error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','priority','extensions','extension','find','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','push','CDR(routeid)=','Set','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','length','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','sortBy'];(function(_0x1f76ad,_0x51cfef){var _0x4a5398=function(_0x5d30df){while(--_0x5d30df){_0x1f76ad['push'](_0x1f76ad['shift']());}};_0x4a5398(++_0x51cfef);}(_0x15ec,0x1ac));var _0xc15e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x15ec[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xc15e('0x0'));var util=require(_0xc15e('0x1'));function rewrite(_0x13466f,_0xba7cd6){var _0x49ad34=this;return _0x13466f[_0xc15e('0x2')]['Interval'][_0xc15e('0x3')]({'raw':!![]})['then'](function(_0x51c926){_0x49ad34[_0xc15e('0x4')]=_0x51c926;return _0x13466f[_0xc15e('0x2')][_0xc15e('0x5')][_0xc15e('0x3')]({'where':{'IntervalId':_0xba7cd6[_0xc15e('0x6')]},'raw':!![]});})[_0xc15e('0x7')](function(_0x428fec){return _0x13466f['models'][_0xc15e('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xc15e('0x8')](_[_0xc15e('0x9')](_0x428fec,_0xc15e('0xa')))}},'order':[{'raw':_0xc15e('0xb')}],'raw':!![]});})[_0xc15e('0x7')](function(_0x14f362){var _0x282f3c=_[_0xc15e('0xc')](_0x14f362,{'priority':'1'});var _0xcf22f1=_[_0xc15e('0xc')](_0x14f362,{'isApp':0x1});var _0x1339ae=_[_0xc15e('0xd')](_0xcf22f1,_0xc15e('0xa'));var _0x4468c7=[_0xc15e('0xe'),'playback'];var _0x127002=[];var _0x2247e7=[];for(var _0x2c4246 in _0x1339ae){if(_0x1339ae['hasOwnProperty'](_0x2c4246)){_0x49ad34[_0xc15e('0xf')]=0x2;_0x49ad34[_0xc15e('0x10')]=[];_0x49ad34[_0xc15e('0x11')]=_[_0xc15e('0x12')](_0x282f3c,{'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')]});_0x49ad34[_0xc15e('0x10')]['push']({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':'Set','appdata':util[_0xc15e('0x14')](_0xc15e('0x15'),_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')]),'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0]['exten'],'priority':_0x49ad34['priority']++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});if(_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')]===_0xc15e('0x18')){_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':'Set','appdata':_0xc15e('0x1a')+_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')],'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});}else if(_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')]==='outbound'){if(_0x49ad34[_0xc15e('0x11')]){_0x49ad34['extensions'][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x1c')+(_0x49ad34[_0xc15e('0x11')]['cutdigits']?'${EXTEN:'+_0x49ad34['extension'][_0xc15e('0x1d')]+'}':'${EXTEN}'),'context':_0x1339ae[_0x2c4246][0x0]['context'],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0]['VoiceExtensionId']});}_0x49ad34['extensions'][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x1a')+_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')],'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34['priority']++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});var _0x570496=_0x49ad34['priority']++;_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1e'),'appdata':_0xc15e('0x1f')+(_0x570496+0x2)+_0xc15e('0x20')+(_0x570496+0x1)+')','context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x570496,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0]['VoiceExtensionId']});if(_0x49ad34[_0xc15e('0x11')]){_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0x49ad34[_0xc15e('0x11')][_0xc15e('0x1d')]?_0xc15e('0x21')+_0x49ad34['extension'][_0xc15e('0x1d')]+'}':_0xc15e('0x22'),'context':_0x1339ae[_0x2c4246][0x0]['context'],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});}_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x23')+_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')],'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});if(_0x49ad34['extension']&&_0x49ad34[_0xc15e('0x11')][_0xc15e('0x24')]('recordingFormat')&&_0x49ad34[_0xc15e('0x11')][_0xc15e('0x25')]!==_0xc15e('0x26')){_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0]['type'],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x27'),'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0]['type'],'app':_0xc15e('0x1b'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x49ad34[_0xc15e('0x11')][_0xc15e('0x25')]||_0xc15e('0x28'),'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0]['VoiceExtensionId']});}}_0x49ad34['extensions'][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':'Set','appdata':_0xc15e('0x29'),'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x2a'),'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1339ae[_0x2c4246][0x0]['context'],'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'priority':_0x49ad34[_0xc15e('0xf')]++,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});for(var _0xbe809b=0x0,_0x497b8b=0x0;_0xbe809b<_0x1339ae[_0x2c4246]['length'];_0xbe809b+=0x1,_0x497b8b=0x0){var _0xf0d131=_0x1339ae[_0x2c4246][_0xbe809b];if(_0xf0d131[_0xc15e('0x13')]){_0xf0d131['type']=_0xf0d131[_0xc15e('0x13')]['toLowerCase']();}var _0x5430e8=[];var _0x5659e0=[];delete _0xf0d131['id'];delete _0xf0d131['createdAt'];delete _0xf0d131[_0xc15e('0x2b')];var _0x5da36e=_0xf0d131[_0xc15e('0x2c')]!==_0xc15e('0x2d')?[_0xf0d131['interval']]:_0xf0d131[_0xc15e('0x6')]?_[_0xc15e('0x9')](_[_0xc15e('0xc')](_0x49ad34[_0xc15e('0x4')],{'IntervalId':_0xf0d131[_0xc15e('0x6')]}),'interval'):[];if(_0xf0d131[_0xc15e('0x24')]('tag')){if(_0xf0d131[_0xc15e('0x2e')]&&_0xf0d131[_0xc15e('0x2e')]!=='--'){_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131['type'],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x2f')+_0xf0d131[_0xc15e('0x2e')],'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131[_0xc15e('0xa')],'priority':_0x5da36e['length']+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131['VoiceExtensionId']});}}if(_0xf0d131[_0xc15e('0x13')]===_0xc15e('0x30')&&_0xf0d131[_0xc15e('0x24')](_0xc15e('0x31'))){if(_0xf0d131[_0xc15e('0x31')]){_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xf0d131['callerID']+')','context':_0xf0d131['context'],'exten':_0xf0d131[_0xc15e('0xa')],'priority':_0x5da36e['length']+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131[_0xc15e('0x17')]});}else{_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131[_0xc15e('0x13')],'app':_0xc15e('0x1e'),'appdata':_0xc15e('0x32'),'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131['exten'],'priority':_0x5da36e[_0xc15e('0x33')]+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131['VoiceExtensionId']});}}if(_0xf0d131[_0xc15e('0x24')](_0xc15e('0x34'))){if(_0x4468c7[_0xc15e('0x35')](_0xf0d131[_0xc15e('0x36')][_0xc15e('0x37')]())>=0x0&&_0xf0d131[_0xc15e('0x38')]!==_0xc15e('0x39')){if(_0xf0d131[_0xc15e('0x34')]){_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131['type'],'app':_0xc15e('0x1e'),'appdata':_0xc15e('0x3a'),'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131[_0xc15e('0xa')],'priority':_0x5da36e[_0xc15e('0x33')]+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131['VoiceExtensionId']});_0x5430e8['push']({'type':_0xf0d131[_0xc15e('0x13')],'app':_0xc15e('0x1b'),'appdata':_0xc15e('0x3b'),'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131[_0xc15e('0xa')],'priority':_0x5da36e[_0xc15e('0x33')]+_0x49ad34['priority']+_0x497b8b++,'VoiceExtensionId':_0xf0d131[_0xc15e('0x17')]});}else{_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131['type'],'app':_0xc15e('0x1e'),'appdata':_0xc15e('0x3c'),'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131['exten'],'priority':_0x5da36e[_0xc15e('0x33')]+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131[_0xc15e('0x17')]});_0x5430e8[_0xc15e('0x19')]({'type':_0xf0d131[_0xc15e('0x13')],'app':'Set','appdata':_0xc15e('0x3d'),'context':_0xf0d131[_0xc15e('0x16')],'exten':_0xf0d131[_0xc15e('0xa')],'priority':_0x5da36e['length']+_0x49ad34[_0xc15e('0xf')]+_0x497b8b++,'VoiceExtensionId':_0xf0d131[_0xc15e('0x17')]});}}}for(var _0x1de5ac=0x0;_0x1de5ac<_0x5da36e[_0xc15e('0x33')];_0x1de5ac+=0x1){var _0x5448c7=_0x49ad34[_0xc15e('0xf')]+_0x5da36e[_0xc15e('0x33')];var _0x2d170f=_0x1de5ac===_0x5da36e[_0xc15e('0x33')]-0x1?_0x49ad34[_0xc15e('0xf')]+_0x5430e8[_0xc15e('0x33')]+_0x5659e0[_0xc15e('0x33')]+0x2:_0x49ad34[_0xc15e('0xf')]+_0x1de5ac+0x1;_0x5430e8[_0xc15e('0x3e')](_0x1de5ac,0x0,{'type':_0xf0d131[_0xc15e('0x13')],'app':_0xc15e('0x3f'),'appdata':_0x5da36e[_0x1de5ac]+'?'+_0xf0d131[_0xc15e('0x16')]+_0xc15e('0x40')+_0x5448c7+':'+_0xf0d131[_0xc15e('0x16')]+',${EXTEN},'+_0x2d170f,'exten':_0xf0d131[_0xc15e('0xa')],'context':_0xf0d131['context'],'priority':_0x49ad34[_0xc15e('0xf')]+_0x1de5ac,'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]});}_0xf0d131[_0xc15e('0xf')]=_0x5430e8[_0xc15e('0x33')]?_['last'](_0x5430e8)[_0xc15e('0xf')]+0x1:_0x49ad34[_0xc15e('0xf')];_0x49ad34[_0xc15e('0xf')]=(_0x5659e0['length']?_[_0xc15e('0x41')](_0x5659e0)['priority']:_0xf0d131['priority'])+0x1;_0x49ad34['extensions']=_['concat'](_0x49ad34['extensions'],_0x5430e8,[_0xf0d131],_0x5659e0);}_0x49ad34[_0xc15e('0x10')][_0xc15e('0x19')]({'type':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x13')],'app':_0xc15e('0x42'),'exten':_0x1339ae[_0x2c4246][0x0][_0xc15e('0xa')],'context':_0x1339ae[_0x2c4246][0x0][_0xc15e('0x16')],'priority':_0x49ad34[_0xc15e('0xf')],'VoiceExtensionId':_0x1339ae[_0x2c4246][0x0]['VoiceExtensionId']});_0x127002[_0xc15e('0x19')](_0x1339ae[_0x2c4246][0x0][_0xc15e('0x17')]);_0x2247e7=_['concat'](_0x2247e7,_0x49ad34['extensions']);}}return _0x13466f[_0xc15e('0x43')](function(_0x10fe85){return _0x13466f['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x127002}},'transaction':_0x10fe85})[_0xc15e('0x7')](function(_0x428cde){return _0x13466f[_0xc15e('0x2')][_0xc15e('0x5')]['bulkCreate'](_[_0xc15e('0x44')](_0x2247e7,_0xc15e('0xf')),{'transaction':_0x10fe85});});});})['catch'](function(_0x2fd605){console[_0xc15e('0x45')](_0x2fd605);});}exports[_0xc15e('0x46')]=rewrite; \ No newline at end of file +var _0x315f=['context','VoiceExtensionId','CDR(routeid)=','outbound','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x315f,0x6c));var _0xf315=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x315f[_0x1fcf1b];return _0x5d2952;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');function rewrite(_0x349a1f,_0x38f65c){var _0x3c42c4=this;return _0x349a1f[_0xf315('0x1')][_0xf315('0x2')][_0xf315('0x3')]({'raw':!![]})[_0xf315('0x4')](function(_0x5d6648){_0x3c42c4['intervals']=_0x5d6648;return _0x349a1f['models'][_0xf315('0x5')][_0xf315('0x3')]({'where':{'IntervalId':_0x38f65c[_0xf315('0x6')]},'raw':!![]});})['then'](function(_0x5dac5e){return _0x349a1f[_0xf315('0x1')]['VoiceExtension'][_0xf315('0x3')]({'where':{'exten':{'$in':_[_0xf315('0x7')](_['map'](_0x5dac5e,_0xf315('0x8')))}},'order':[{'raw':_0xf315('0x9')}],'raw':!![]});})[_0xf315('0x4')](function(_0x4ed055){var _0x4a087b=_[_0xf315('0xa')](_0x4ed055,{'priority':'1'});var _0xde15c7=_['filter'](_0x4ed055,{'isApp':0x1});var _0x35500b=_['groupBy'](_0xde15c7,_0xf315('0x8'));var _0x404e0d=[_0xf315('0xb'),'playback'];var _0x311263=[];var _0x20ff2a=[];for(var _0x383feb in _0x35500b){if(_0x35500b[_0xf315('0xc')](_0x383feb)){_0x3c42c4[_0xf315('0xd')]=0x2;_0x3c42c4[_0xf315('0xe')]=[];_0x3c42c4[_0xf315('0xf')]=_[_0xf315('0x10')](_0x4a087b,{'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':util[_0xf315('0x14')](_0xf315('0x15'),_0x35500b[_0x383feb][0x0][_0xf315('0x12')]),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x35500b[_0x383feb][0x0]['type']==='inbound'){_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x18')+_0x35500b[_0x383feb][0x0][_0xf315('0x17')],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});}else if(_0x35500b[_0x383feb][0x0][_0xf315('0x12')]===_0xf315('0x19')){if(_0x3c42c4[_0xf315('0xf')]){_0x3c42c4['extensions'][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':'CDR(destination)='+(_0x3c42c4['extension'][_0xf315('0x1a')]?'${EXTEN:'+_0x3c42c4[_0xf315('0xf')][_0xf315('0x1a')]+'}':'${EXTEN}'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0]['type'],'app':'Set','appdata':_0xf315('0x18')+_0x35500b[_0x383feb][0x0]['VoiceExtensionId'],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});var _0x5d2f17=_0x3c42c4['priority']++;_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d2f17+0x2)+_0xf315('0x1c')+(_0x5d2f17+0x1)+')','context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x5d2f17,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x3c42c4[_0xf315('0xf')]){_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0x3c42c4['extension'][_0xf315('0x1a')]?_0xf315('0x1d')+_0x3c42c4['extension'][_0xf315('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':'Set','appdata':_0xf315('0x1e')+_0x35500b[_0x383feb][0x0]['VoiceExtensionId'],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});if(_0x3c42c4[_0xf315('0xf')]&&_0x3c42c4[_0xf315('0xf')][_0xf315('0xc')](_0xf315('0x1f'))&&_0x3c42c4[_0xf315('0xf')][_0xf315('0x1f')]!==_0xf315('0x20')){_0x3c42c4[_0xf315('0xe')]['push']({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x21'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':'Set','appdata':_0xf315('0x22')+_0x3c42c4[_0xf315('0xf')][_0xf315('0x1f')]||_0xf315('0x23'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0]['exten'],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});}}_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0]['type'],'app':_0xf315('0x13'),'appdata':_0xf315('0x24'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x25'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4[_0xf315('0xd')]++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x3c42c4[_0xf315('0xe')][_0xf315('0x11')]({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x26'),'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'priority':_0x3c42c4['priority']++,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});for(var _0x224af0=0x0,_0x1d3614=0x0;_0x224af0<_0x35500b[_0x383feb][_0xf315('0x27')];_0x224af0+=0x1,_0x1d3614=0x0){var _0x31c5e6=_0x35500b[_0x383feb][_0x224af0];if(_0x31c5e6[_0xf315('0x12')]){_0x31c5e6[_0xf315('0x12')]=_0x31c5e6[_0xf315('0x12')][_0xf315('0x28')]();}var _0x12c81f=[];var _0x16726b=[];delete _0x31c5e6['id'];delete _0x31c5e6['createdAt'];delete _0x31c5e6[_0xf315('0x29')];var _0x38d395=_0x31c5e6['interval']!=='*,*,*,*'?[_0x31c5e6[_0xf315('0x2a')]]:_0x31c5e6['IntervalId']?_[_0xf315('0x2b')](_[_0xf315('0xa')](_0x3c42c4['intervals'],{'IntervalId':_0x31c5e6[_0xf315('0x6')]}),_0xf315('0x2a')):[];if(_0x31c5e6[_0xf315('0xc')](_0xf315('0x2c'))){if(_0x31c5e6['tag']&&_0x31c5e6['tag']!=='--'){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':'CDR(tag)='+_0x31c5e6[_0xf315('0x2c')],'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}}if(_0x31c5e6[_0xf315('0x12')]===_0xf315('0x19')&&_0x31c5e6[_0xf315('0xc')](_0xf315('0x2d'))){if(_0x31c5e6[_0xf315('0x2d')]){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x2e')+_0x31c5e6[_0xf315('0x2d')]+')','context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6['exten'],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}else{_0x12c81f['push']({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x2f'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}}if(_0x31c5e6[_0xf315('0xc')](_0xf315('0x30'))){if(_0x404e0d[_0xf315('0x31')](_0x31c5e6[_0xf315('0x32')][_0xf315('0x28')]())>=0x0&&_0x31c5e6[_0xf315('0x33')]!=='custom'){if(_0x31c5e6[_0xf315('0x30')]){_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6['type'],'app':_0xf315('0x13'),'appdata':_0xf315('0x34'),'context':_0x31c5e6['context'],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});}else{_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x1b'),'appdata':_0xf315('0x35'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6['exten'],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4['priority']+_0x1d3614++,'VoiceExtensionId':_0x31c5e6[_0xf315('0x17')]});_0x12c81f[_0xf315('0x11')]({'type':_0x31c5e6[_0xf315('0x12')],'app':_0xf315('0x13'),'appdata':_0xf315('0x36'),'context':_0x31c5e6[_0xf315('0x16')],'exten':_0x31c5e6[_0xf315('0x8')],'priority':_0x38d395[_0xf315('0x27')]+_0x3c42c4[_0xf315('0xd')]+_0x1d3614++,'VoiceExtensionId':_0x31c5e6['VoiceExtensionId']});}}}for(var _0x427776=0x0;_0x427776<_0x38d395[_0xf315('0x27')];_0x427776+=0x1){var _0x4ee2f5=_0x3c42c4[_0xf315('0xd')]+_0x38d395[_0xf315('0x27')];var _0x4a2db5=_0x427776===_0x38d395[_0xf315('0x27')]-0x1?_0x3c42c4[_0xf315('0xd')]+_0x12c81f['length']+_0x16726b[_0xf315('0x27')]+0x2:_0x3c42c4[_0xf315('0xd')]+_0x427776+0x1;_0x12c81f[_0xf315('0x37')](_0x427776,0x0,{'type':_0x31c5e6[_0xf315('0x12')],'app':'GotoIfTime','appdata':_0x38d395[_0x427776]+'?'+_0x31c5e6['context']+_0xf315('0x38')+_0x4ee2f5+':'+_0x31c5e6[_0xf315('0x16')]+_0xf315('0x38')+_0x4a2db5,'exten':_0x31c5e6[_0xf315('0x8')],'context':_0x31c5e6['context'],'priority':_0x3c42c4[_0xf315('0xd')]+_0x427776,'VoiceExtensionId':_0x35500b[_0x383feb][0x0]['VoiceExtensionId']});}_0x31c5e6[_0xf315('0xd')]=_0x12c81f['length']?_[_0xf315('0x39')](_0x12c81f)['priority']+0x1:_0x3c42c4[_0xf315('0xd')];_0x3c42c4[_0xf315('0xd')]=(_0x16726b[_0xf315('0x27')]?_[_0xf315('0x39')](_0x16726b)['priority']:_0x31c5e6[_0xf315('0xd')])+0x1;_0x3c42c4[_0xf315('0xe')]=_[_0xf315('0x3a')](_0x3c42c4[_0xf315('0xe')],_0x12c81f,[_0x31c5e6],_0x16726b);}_0x3c42c4[_0xf315('0xe')]['push']({'type':_0x35500b[_0x383feb][0x0][_0xf315('0x12')],'app':_0xf315('0x3b'),'exten':_0x35500b[_0x383feb][0x0][_0xf315('0x8')],'context':_0x35500b[_0x383feb][0x0][_0xf315('0x16')],'priority':_0x3c42c4[_0xf315('0xd')],'VoiceExtensionId':_0x35500b[_0x383feb][0x0][_0xf315('0x17')]});_0x311263[_0xf315('0x11')](_0x35500b[_0x383feb][0x0][_0xf315('0x17')]);_0x20ff2a=_[_0xf315('0x3a')](_0x20ff2a,_0x3c42c4[_0xf315('0xe')]);}}return _0x349a1f[_0xf315('0x3c')](function(_0x23d021){return _0x349a1f[_0xf315('0x1')][_0xf315('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x311263}},'transaction':_0x23d021})[_0xf315('0x4')](function(_0x391766){return _0x349a1f[_0xf315('0x1')][_0xf315('0x5')][_0xf315('0x3d')](_[_0xf315('0x3e')](_0x20ff2a,'priority'),{'transaction':_0x23d021});});});})['catch'](function(_0x4b8290){console[_0xf315('0x3f')](_0x4b8290);});}exports[_0xf315('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index cfcef97..d4e5a71 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 _0x9d5a=['generalCheckHopper','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','NOW()','field','toString','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','createdAt','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','get','Campaign','Lists','CampaignId'];(function(_0x1ed0d3,_0x7fceb2){var _0x3a1c39=function(_0x4f51f4){while(--_0x4f51f4){_0x1ed0d3['push'](_0x1ed0d3['shift']());}};_0x3a1c39(++_0x7fceb2);}(_0x9d5a,0x7c));var _0xa9d5=function(_0x2e39e8,_0xd7987e){_0x2e39e8=_0x2e39e8-0x0;var _0x2e1a83=_0x9d5a[_0x2e39e8];return _0x2e1a83;};'use strict';var BPromise=require('bluebird');var util=require(_0xa9d5('0x0'));var _=require(_0xa9d5('0x1'));var fs=require('fs');var squel=require(_0xa9d5('0x2'));var Papa=require(_0xa9d5('0x3'));var Redis=require('ioredis');var db=require(_0xa9d5('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xa9d5('0x5'))(_0xa9d5('0x6'));config[_0xa9d5('0x7')]=_['defaults'](config[_0xa9d5('0x7')],{'host':_0xa9d5('0x8'),'port':0x18eb});var socket=require(_0xa9d5('0x9'))(new Redis(config[_0xa9d5('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0xa9d5('0xa')](socket);try{if(!process[_0xa9d5('0xb')][0x2]||process[_0xa9d5('0xb')][0x2]===_0xa9d5('0xc')||process[_0xa9d5('0xb')][0x2]===_0xa9d5('0xd')){throw new Error(_0xa9d5('0xe'));}var FILEPATH=process[_0xa9d5('0xb')][0x2];if(!process[_0xa9d5('0xb')][0x3]||process[_0xa9d5('0xb')][0x3]==='undefined'||process[_0xa9d5('0xb')][0x3]===_0xa9d5('0xd')||!process[_0xa9d5('0xb')][0x4]||process[_0xa9d5('0xb')][0x4]===_0xa9d5('0xc')||process[_0xa9d5('0xb')][0x4]===_0xa9d5('0xd')){throw new Error(_0xa9d5('0xf'));}var FIELDS=_[_0xa9d5('0x10')](process[_0xa9d5('0xb')][0x3]['split'](','),process[_0xa9d5('0xb')][0x4]['split'](','));if(!process[_0xa9d5('0xb')][0x5]||process[_0xa9d5('0xb')][0x5]===_0xa9d5('0xc')||process['argv'][0x5]===_0xa9d5('0xd')){throw new Error(_0xa9d5('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xa9d5('0xb')][0x6]!==_0xa9d5('0xc')&&process['argv'][0x6]!==_0xa9d5('0xd')?process[_0xa9d5('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xa9d5('0xb')][0x7]!==_0xa9d5('0xc')&&process[_0xa9d5('0xb')][0x7]!==_0xa9d5('0xd')?process[_0xa9d5('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xa9d5('0xc')||process[_0xa9d5('0xb')][0x8]===_0xa9d5('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2726ec){logger['error'](_0x2726ec);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(_0x27e0ee,_0x492ddf,_0x481717,_0xf95a2){var _0x33a3ea={'message':_0x492ddf};_0x33a3ea[_0x27e0ee]=!![];if(_0x481717){_0x33a3ea[_0xa9d5('0x12')]=_0x481717;}if(_0xf95a2){_0x33a3ea[_0xa9d5('0x13')]=_0xf95a2;}return _0x33a3ea;}function isEmail(_0xf58e15){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))*$/[_0xa9d5('0x14')](_0xf58e15);}function checkRow(_0x536cb3,_0x219de3,_0x5eaed8){return new BPromise(function(_0x44f149,_0x8035d9){if(_['isNil'](_0x536cb3)){return _0x8035d9(handleCheckRowError(_0xa9d5('0x15'),_0xa9d5('0x16'),null,_0x5eaed8));}if(_0x536cb3[_0xa9d5('0x17')]&&_0x536cb3[_0xa9d5('0x17')][_0xa9d5('0x18')]){var _0x4d9062=_[_0xa9d5('0x19')](_0x536cb3[_0xa9d5('0x17')],'message')['join'](';');return _0x8035d9(handleCheckRowError(_0xa9d5('0x15'),_0x4d9062,null,_0x5eaed8));}var _0x48e8df={};for(var _0xe86720 in FIELDS){if(FIELDS[_0xa9d5('0x1a')](_0xe86720)&&FIELDS[_0xe86720]){_0x48e8df[_0xe86720]=_0x536cb3[_0xa9d5('0x1b')][0x0][FIELDS[_0xe86720]]||_0x536cb3['data'][0x0]['\ufeff'+FIELDS[_0xe86720]];}}if(!_0x48e8df['firstName']){return _0x8035d9(handleCheckRowError(_0xa9d5('0x15'),'firstName\x20not\x20specified!',null,_0x5eaed8));}if(!_0x48e8df[_0xa9d5('0x1c')]){return _0x8035d9(handleCheckRowError(_0xa9d5('0x15'),'phone\x20not\x20specified!',null,_0x5eaed8));}if(_0x48e8df['birthDate']){var _0x24cc23=moment(_0x48e8df[_0xa9d5('0x1d')],_0xa9d5('0x1e'));if(!_0x24cc23[_0xa9d5('0x1f')]()){return _0x8035d9(handleCheckRowError('error',_0xa9d5('0x20'),null,_0x5eaed8));}}if(_0x48e8df[_0xa9d5('0x21')]){if(!isEmail(_0x48e8df[_0xa9d5('0x21')])){return _0x8035d9(handleCheckRowError(_0xa9d5('0x15'),_0xa9d5('0x22'),null,_0x5eaed8));}}_0x48e8df[_0xa9d5('0x23')]=LISTID;_0x48e8df[_0xa9d5('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa9d5('0x18')]&&_0x219de3){var _0x432618={};for(var _0x1eeb14=0x0,_0x262220=DUPLICATES[_0xa9d5('0x18')];_0x1eeb14<_0x262220;_0x1eeb14+=0x1){_0x432618[DUPLICATES[_0x1eeb14]]=_0x48e8df[DUPLICATES[_0x1eeb14]];}var _0x1b017a=_['find'](_0x219de3,_0x432618);if(_0x1b017a){return _0x8035d9(handleCheckRowError(_0xa9d5('0x25'),_0xa9d5('0x26'),_0x1b017a,_0x5eaed8));}}return db[_0xa9d5('0x27')]['create'](_0x48e8df,{'raw':!![],'hooks':![],'fields':_[_0xa9d5('0x28')](_0x48e8df)})[_0xa9d5('0x29')](function(_0x290db2){if(DUPLICATES&&DUPLICATES[_0xa9d5('0x18')]&&_0x219de3){_0x219de3[_0xa9d5('0x2a')](_['pick'](_0x48e8df,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x290db2['id'];return _0x44f149();})[_0xa9d5('0x2b')](function(_0x489dab){return _0x8035d9(handleCheckRowError('error',_0xa9d5('0x2c')+(_0x489dab[_0xa9d5('0x2d')]||JSON[_0xa9d5('0x2e')](_0x489dab)),null,_0x5eaed8));});});}function checkHopper(){function _0x8913fb(){return function(_0x13b561){logger['error'](_0xa9d5('0x2f'),_0xa9d5('0x30'),util[_0xa9d5('0x31')](_0x13b561,{'showHidden':![],'depth':null}));};}var _0x106993=function(_0x1987b1,_0x31464f){var _0x4e6f45=squel[_0xa9d5('0x32')]()['into'](_0xa9d5('0x33'))[_0xa9d5('0x34')]([_0xa9d5('0x1c'),_0xa9d5('0x35'),_0xa9d5('0x36'),_0xa9d5('0x23'),_0x31464f,'createdAt',_0xa9d5('0x37')],squel[_0xa9d5('0x38')]()['field'](_0xa9d5('0x1c'),_0xa9d5('0x1c'))['field'](_0xa9d5('0x39'),_0xa9d5('0x35'))[_0xa9d5('0x3a')]('id',_0xa9d5('0x36'))['field'](LISTID[_0xa9d5('0x3b')](),_0xa9d5('0x23'))[_0xa9d5('0x3a')](_0x1987b1['id']['toString'](),_0x31464f)[_0xa9d5('0x3a')](_0xa9d5('0x39'),'createdAt')['field'](_0xa9d5('0x39'),_0xa9d5('0x37'))['from'](_0xa9d5('0x3c'))[_0xa9d5('0x3d')]('deletedAt\x20IS\x20NULL')[_0xa9d5('0x3d')]('ListId\x20=\x20?',LISTID[_0xa9d5('0x3b')]())[_0xa9d5('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xa9d5('0x3d')](_0xa9d5('0x3e'),squel[_0xa9d5('0x38')]()[_0xa9d5('0x3a')](_0xa9d5('0x1c'))[_0xa9d5('0x3f')](_0xa9d5('0x33'))['where'](_0x31464f+_0xa9d5('0x40'),_0x1987b1['id'][_0xa9d5('0x3b')]())))[_0xa9d5('0x3b')]();return _0x4e6f45;};var _0x35f281=function(_0x39c255,_0x55dcb9){var _0x2238ac=squel[_0xa9d5('0x32')]()[_0xa9d5('0x41')](_0xa9d5('0x33'))['fromQuery']([_0xa9d5('0x1c'),_0xa9d5('0x35'),_0xa9d5('0x36'),_0xa9d5('0x23'),_0x55dcb9,_0xa9d5('0x42'),_0xa9d5('0x37')],squel[_0xa9d5('0x38')]()[_0xa9d5('0x3a')](_0xa9d5('0x1c'),_0xa9d5('0x1c'))['field'](_0xa9d5('0x39'),_0xa9d5('0x35'))[_0xa9d5('0x3a')]('id','ContactId')[_0xa9d5('0x3a')](LISTID[_0xa9d5('0x3b')](),_0xa9d5('0x23'))[_0xa9d5('0x3a')](_0x39c255['id']['toString'](),_0x55dcb9)[_0xa9d5('0x3a')](_0xa9d5('0x39'),_0xa9d5('0x42'))[_0xa9d5('0x3a')](_0xa9d5('0x39'),_0xa9d5('0x37'))['from'](_0xa9d5('0x3c'))[_0xa9d5('0x3d')]('deletedAt\x20IS\x20NULL')[_0xa9d5('0x3d')]('ListId\x20=\x20?',LISTID[_0xa9d5('0x3b')]())[_0xa9d5('0x3d')](_0xa9d5('0x43'),squel[_0xa9d5('0x44')](hopperContacts))['where'](_0xa9d5('0x45'))[_0xa9d5('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa9d5('0x38')]()[_0xa9d5('0x3a')]('calleridnum')[_0xa9d5('0x3f')](_0xa9d5('0x46'))[_0xa9d5('0x3d')](_0x55dcb9+'\x20=\x20?',_0x39c255['id'][_0xa9d5('0x3b')]()))[_0xa9d5('0x3d')](_0xa9d5('0x3e'),squel['select']()[_0xa9d5('0x3a')](_0xa9d5('0x1c'))['from'](_0xa9d5('0x33'))[_0xa9d5('0x3d')](_0x55dcb9+_0xa9d5('0x40'),_0x39c255['id'][_0xa9d5('0x3b')]())))[_0xa9d5('0x3b')]();return _0x2238ac;};function _0x50446d(_0x1254b9,_0x59d2b2){var _0x38984d=squel[_0xa9d5('0x32')]()[_0xa9d5('0x41')](_0xa9d5('0x33'))[_0xa9d5('0x34')]([_0xa9d5('0x1c'),_0xa9d5('0x35'),_0xa9d5('0x36'),_0xa9d5('0x23'),_0x59d2b2,_0xa9d5('0x42'),_0xa9d5('0x37')],squel[_0xa9d5('0x38')]()['field'](_0xa9d5('0x1c'),_0xa9d5('0x1c'))['field'](_0xa9d5('0x39'),_0xa9d5('0x35'))[_0xa9d5('0x3a')]('id','ContactId')['field'](LISTID['toString'](),_0xa9d5('0x23'))[_0xa9d5('0x3a')](_0x1254b9['id'][_0xa9d5('0x3b')](),_0x59d2b2)[_0xa9d5('0x3a')]('NOW()',_0xa9d5('0x42'))[_0xa9d5('0x3a')](_0xa9d5('0x39'),'updatedAt')['from'](_0xa9d5('0x3c'))[_0xa9d5('0x3d')](_0xa9d5('0x47'))[_0xa9d5('0x3d')](_0xa9d5('0x48'),LISTID['toString']())['where'](_0xa9d5('0x43'),squel[_0xa9d5('0x44')](hopperContacts))[_0xa9d5('0x3d')](_0xa9d5('0x45')))[_0xa9d5('0x3b')]();return _0x38984d;}function _0x1fe1ed(_0x2d747f,_0x418f4f){var _0x34cb36=squel[_0xa9d5('0x32')]()[_0xa9d5('0x41')](_0xa9d5('0x49'))[_0xa9d5('0x34')]([_0xa9d5('0x1c'),_0xa9d5('0x36'),_0xa9d5('0x23'),_0x418f4f,_0xa9d5('0x42'),_0xa9d5('0x37')],squel[_0xa9d5('0x38')]()[_0xa9d5('0x3a')](_0xa9d5('0x1c'),_0xa9d5('0x1c'))[_0xa9d5('0x3a')]('id','ContactId')[_0xa9d5('0x3a')](LISTID[_0xa9d5('0x3b')](),'ListId')['field'](_0x2d747f['id'][_0xa9d5('0x3b')](),_0x418f4f)[_0xa9d5('0x3a')](_0xa9d5('0x39'),_0xa9d5('0x42'))[_0xa9d5('0x3a')]('NOW()',_0xa9d5('0x37'))[_0xa9d5('0x3f')](_0xa9d5('0x3c'))[_0xa9d5('0x3d')](_0xa9d5('0x47'))[_0xa9d5('0x3d')](_0xa9d5('0x48'),LISTID[_0xa9d5('0x3b')]())[_0xa9d5('0x3d')](_0xa9d5('0x43'),squel[_0xa9d5('0x44')](hopperContacts))[_0xa9d5('0x3d')](_0xa9d5('0x45')))[_0xa9d5('0x3b')]();return _0x34cb36;}return db[_0xa9d5('0x4a')][_0xa9d5('0x4b')]({'where':{'type':_0xa9d5('0x4c')},'attributes':['id',_0xa9d5('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xa9d5('0x29')](function(_0x2218c9){var _0x4a7941=[];if(_0x2218c9){var _0x176d03;for(var _0x465ddc=0x0,_0x497860;_0x465ddc<_0x2218c9[_0xa9d5('0x18')];_0x465ddc+=0x1){_0x497860=_0x2218c9[_0x465ddc]['get']({'plain':!![]});switch(_0x497860[_0xa9d5('0x4d')]){case _0xa9d5('0x4e'):_0x4a7941[_0xa9d5('0x2a')](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x35f281(_0x497860,_0xa9d5('0x51')))[_0xa9d5('0x29')](function(){})[_0xa9d5('0x2b')](_0x8913fb()));break;case _0xa9d5('0x52'):_0x4a7941['push'](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x106993(_0x497860,'VoiceQueueId'))['then'](function(){})[_0xa9d5('0x2b')](_0x8913fb()));break;default:_0x4a7941['push'](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x50446d(_0x497860,_0xa9d5('0x51')))['then'](function(){})[_0xa9d5('0x2b')](_0x8913fb()));}}}return _0x4a7941;})[_0xa9d5('0x53')]()['then'](function(){return db[_0xa9d5('0x4a')][_0xa9d5('0x4b')]({'where':{'type':_0xa9d5('0x4c')},'attributes':['id'],'include':[{'model':db[_0xa9d5('0x54')],'as':_0xa9d5('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x412208){var _0x5a9415=[];if(_0x412208){var _0x182ea2;for(var _0x5ab1eb=0x0,_0x243967;_0x5ab1eb<_0x412208['length'];_0x5ab1eb+=0x1){_0x243967=_0x412208[_0x5ab1eb][_0xa9d5('0x56')]({'plain':!![]});_0x5a9415[_0xa9d5('0x2a')](db[_0xa9d5('0x4f')]['query'](_0x1fe1ed(_0x243967,'VoiceQueueId'))['then'](function(){})[_0xa9d5('0x2b')](_0x8913fb()));}}return _0x5a9415;})[_0xa9d5('0x53')]();})[_0xa9d5('0x29')](function(){return db[_0xa9d5('0x57')][_0xa9d5('0x4b')]({'attributes':['id',_0xa9d5('0x4d')],'include':[{'model':db['CmList'],'as':_0xa9d5('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x7da902){var _0x4dfcef=[];if(_0x7da902){for(var _0x225de9=0x0,_0x393817;_0x225de9<_0x7da902[_0xa9d5('0x18')];_0x225de9+=0x1){_0x393817=_0x7da902[_0x225de9][_0xa9d5('0x56')]({'plain':!![]});switch(_0x393817['dialCheckDuplicateType']){case _0xa9d5('0x4e'):_0x4dfcef[_0xa9d5('0x2a')](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x35f281(_0x393817,'CampaignId'))[_0xa9d5('0x29')](function(){})[_0xa9d5('0x2b')](_0x8913fb()));break;case _0xa9d5('0x52'):_0x4dfcef[_0xa9d5('0x2a')](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x106993(_0x393817,_0xa9d5('0x59')))[_0xa9d5('0x29')](function(){})[_0xa9d5('0x2b')](_0x8913fb()));break;default:_0x4dfcef[_0xa9d5('0x2a')](db['sequelize'][_0xa9d5('0x50')](_0x50446d(_0x393817,_0xa9d5('0x59')))[_0xa9d5('0x29')](function(){})[_0xa9d5('0x2b')](_0x8913fb()));}}}return _0x4dfcef;})[_0xa9d5('0x53')]();})[_0xa9d5('0x29')](function(){return db[_0xa9d5('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa9d5('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa9d5('0x29')](function(_0x124340){var _0x2eac0b=[];if(_0x124340){for(var _0x1b7dfe=0x0,_0x5c3b10;_0x1b7dfe<_0x124340[_0xa9d5('0x18')];_0x1b7dfe+=0x1){_0x5c3b10=_0x124340[_0x1b7dfe]['get']({'plain':!![]});_0x2eac0b[_0xa9d5('0x2a')](db[_0xa9d5('0x4f')][_0xa9d5('0x50')](_0x1fe1ed(_0x5c3b10,'CampaignId'))[_0xa9d5('0x29')](function(){})[_0xa9d5('0x2b')](_0x8913fb()));}}return _0x2eac0b;})[_0xa9d5('0x53')]();})[_0xa9d5('0x2b')](function(_0x1226c6){logger['error']('cmContact,\x20%s,\x20%s',_0xa9d5('0x5a'),_0x1226c6['message']);});}var processPromises=function(_0x42c1a4){return BPromise[_0xa9d5('0x53')](promises)['then'](function(_0x52670f){})['catch'](function(_0x35016b){logger[_0xa9d5('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x35016b));})[_0xa9d5('0x5b')](function(){socket[_0xa9d5('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x42c1a4){return _0x42c1a4[_0xa9d5('0x5d')]();}});};var endCsv=function(){return BPromise[_0xa9d5('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xa9d5('0x29')](function(){socket[_0xa9d5('0x5c')](_0xa9d5('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa9d5('0x60')](FILEPATH);}catch(_0x95a61e){logger[_0xa9d5('0x15')](_0xa9d5('0x61'),JSON[_0xa9d5('0x2e')](_0x95a61e));}finally{process[_0xa9d5('0x62')](0x0);}});};process['on'](_0xa9d5('0x63'),function(){logger[_0xa9d5('0x64')](_0xa9d5('0x65'));endCsv();});function main(){return BPromise[_0xa9d5('0x5e')]()[_0xa9d5('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa9d5('0x66')](',');return db[_0xa9d5('0x27')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa9d5('0x29')](function(_0x1795b0){var _0x5dd1f7=fs[_0xa9d5('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5dd1f7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x14a348,_0x59db91){total+=0x1;var _0xa94282=total;promises[_0xa9d5('0x2a')](checkRow(_0x14a348,_0x1795b0,_0xa94282)['then'](function(){success+=0x1;})['catch'](function(_0x1e1e3b){if(_0x1e1e3b['error']){errors+=0x1;delete _0x1e1e3b[_0xa9d5('0x15')];}else if(_0x1e1e3b[_0xa9d5('0x25')]){duplicates+=0x1;delete _0x1e1e3b[_0xa9d5('0x25')];}rows[_0xa9d5('0x2a')](_0x1e1e3b);}));if(total%0xc8===0x0){_0x59db91[_0xa9d5('0x68')]();return processPromises(_0x59db91);}},'complete':function(){return processPromises()[_0xa9d5('0x29')](function(){logger[_0xa9d5('0x64')](_0xa9d5('0x69'));endCsv();});},'error':function(_0x2752ab,_0x4471aa){logger[_0xa9d5('0x64')]('CSV\x20parse\x20error',JSON['stringify'](_0x2752ab));endCsv();}});})[_0xa9d5('0x2b')](function(_0x417de5){logger[_0xa9d5('0x15')](_0xa9d5('0x6a'),JSON[_0xa9d5('0x2e')](_0x417de5));});}main(); \ No newline at end of file +var _0x3ede=['resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','scheduledAt','cm_contacts','str','phone\x20IS\x20NOT\x20NULL','calleridnum','id\x20IN\x20?','VoiceQueue','findAll','outbound','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','BlackLists','dialCheckDuplicateType','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume'];(function(_0x3fed34,_0x3809be){var _0x49e89e=function(_0x334c5e){while(--_0x334c5e){_0x3fed34['push'](_0x3fed34['shift']());}};_0x49e89e(++_0x3809be);}(_0x3ede,0x1c3));var _0xe3ed=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x3ede[_0x2eea9a];return _0x1ec61e;};'use strict';var BPromise=require('bluebird');var util=require(_0xe3ed('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xe3ed('0x1'));var Papa=require(_0xe3ed('0x2'));var Redis=require(_0xe3ed('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xe3ed('0x4'));var logger=require('../../../config/logger')('api');config['redis']=_[_0xe3ed('0x5')](config['redis'],{'host':_0xe3ed('0x6'),'port':0x18eb});var socket=require(_0xe3ed('0x7'))(new Redis(config[_0xe3ed('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xe3ed('0x9')](socket);try{if(!process[_0xe3ed('0xa')][0x2]||process[_0xe3ed('0xa')][0x2]===_0xe3ed('0xb')||process[_0xe3ed('0xa')][0x2]===_0xe3ed('0xc')){throw new Error(_0xe3ed('0xd'));}var FILEPATH=process[_0xe3ed('0xa')][0x2];if(!process[_0xe3ed('0xa')][0x3]||process[_0xe3ed('0xa')][0x3]===_0xe3ed('0xb')||process[_0xe3ed('0xa')][0x3]===_0xe3ed('0xc')||!process[_0xe3ed('0xa')][0x4]||process[_0xe3ed('0xa')][0x4]===_0xe3ed('0xb')||process['argv'][0x4]==='null'){throw new Error(_0xe3ed('0xe'));}var FIELDS=_['zipObject'](process[_0xe3ed('0xa')][0x3][_0xe3ed('0xf')](','),process[_0xe3ed('0xa')][0x4]['split'](','));if(!process[_0xe3ed('0xa')][0x5]||process['argv'][0x5]==='undefined'||process[_0xe3ed('0xa')][0x5]===_0xe3ed('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xe3ed('0xa')][0x6]!==_0xe3ed('0xc')?process[_0xe3ed('0xa')][0x6]:null;var DUPLICATES=process[_0xe3ed('0xa')][0x7]&&process[_0xe3ed('0xa')][0x7]!==_0xe3ed('0xb')&&process['argv'][0x7]!==_0xe3ed('0xc')?process[_0xe3ed('0xa')][0x7]:null;if(!process[_0xe3ed('0xa')][0x8]||process[_0xe3ed('0xa')][0x8]==='undefined'||process[_0xe3ed('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xe3ed('0xa')][0x8];}catch(_0x58561d){logger['error'](_0x58561d);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(_0x3d2f41,_0x2660f2,_0x443365,_0x3abb6a){var _0x2230b7={'message':_0x2660f2};_0x2230b7[_0x3d2f41]=!![];if(_0x443365){_0x2230b7[_0xe3ed('0x10')]=_0x443365;}if(_0x3abb6a){_0x2230b7[_0xe3ed('0x11')]=_0x3abb6a;}return _0x2230b7;}function isEmail(_0x3ab850){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))*$/[_0xe3ed('0x12')](_0x3ab850);}function checkRow(_0x576b3a,_0x4a949d,_0x4b17a3){return new BPromise(function(_0x30eec4,_0x3c48d7){if(_[_0xe3ed('0x13')](_0x576b3a)){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x15'),null,_0x4b17a3));}if(_0x576b3a[_0xe3ed('0x16')]&&_0x576b3a[_0xe3ed('0x16')]['length']){var _0x37f733=_[_0xe3ed('0x17')](_0x576b3a[_0xe3ed('0x16')],_0xe3ed('0x18'))[_0xe3ed('0x19')](';');return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0x37f733,null,_0x4b17a3));}var _0x16fa53={};for(var _0x4ef82d in FIELDS){if(FIELDS[_0xe3ed('0x1a')](_0x4ef82d)&&FIELDS[_0x4ef82d]){_0x16fa53[_0x4ef82d]=_0x576b3a[_0xe3ed('0x1b')][0x0][FIELDS[_0x4ef82d]]||_0x576b3a[_0xe3ed('0x1b')][0x0]['\ufeff'+FIELDS[_0x4ef82d]];}}if(!_0x16fa53[_0xe3ed('0x1c')]){return _0x3c48d7(handleCheckRowError('error',_0xe3ed('0x1d'),null,_0x4b17a3));}if(!_0x16fa53[_0xe3ed('0x1e')]){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x1f'),null,_0x4b17a3));}if(_0x16fa53['birthDate']){var _0x3c6f07=moment(_0x16fa53[_0xe3ed('0x20')],_0xe3ed('0x21'));if(!_0x3c6f07[_0xe3ed('0x22')]()){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x23'),null,_0x4b17a3));}}if(_0x16fa53[_0xe3ed('0x24')]){if(!isEmail(_0x16fa53[_0xe3ed('0x24')])){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x25'),null,_0x4b17a3));}}_0x16fa53[_0xe3ed('0x26')]=LISTID;_0x16fa53[_0xe3ed('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe3ed('0x28')]&&_0x4a949d){var _0xf99c18={};for(var _0xb45690=0x0,_0x246933=DUPLICATES[_0xe3ed('0x28')];_0xb45690<_0x246933;_0xb45690+=0x1){_0xf99c18[DUPLICATES[_0xb45690]]=_0x16fa53[DUPLICATES[_0xb45690]];}var _0x4870fa=_[_0xe3ed('0x29')](_0x4a949d,_0xf99c18);if(_0x4870fa){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x2a'),_0xe3ed('0x2b'),_0x4870fa,_0x4b17a3));}}return db[_0xe3ed('0x2c')][_0xe3ed('0x2d')](_0x16fa53,{'raw':!![],'hooks':![],'fields':_[_0xe3ed('0x2e')](_0x16fa53)})[_0xe3ed('0x2f')](function(_0x608489){if(DUPLICATES&&DUPLICATES[_0xe3ed('0x28')]&&_0x4a949d){_0x4a949d[_0xe3ed('0x30')](_['pick'](_0x16fa53,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x608489['id'];return _0x30eec4();})[_0xe3ed('0x31')](function(_0x5cf347){return _0x3c48d7(handleCheckRowError(_0xe3ed('0x14'),_0xe3ed('0x32')+(_0x5cf347[_0xe3ed('0x18')]||JSON[_0xe3ed('0x33')](_0x5cf347)),null,_0x4b17a3));});});}function checkHopper(){function _0x19864a(){return function(_0x23cbdf){logger[_0xe3ed('0x14')](_0xe3ed('0x34'),_0xe3ed('0x35'),util[_0xe3ed('0x36')](_0x23cbdf,{'showHidden':![],'depth':null}));};}var _0x34fbff=function(_0x4bcdce,_0x507611){var _0x2a96c2=squel['insert']()[_0xe3ed('0x37')](_0xe3ed('0x38'))[_0xe3ed('0x39')](['phone','scheduledAt',_0xe3ed('0x3a'),_0xe3ed('0x26'),_0x507611,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'scheduledAt')[_0xe3ed('0x3e')]('id',_0xe3ed('0x3a'))[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))['field'](_0x4bcdce['id'][_0xe3ed('0x40')](),_0x507611)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3b'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')]('cm_contacts')[_0xe3ed('0x42')](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'))[_0xe3ed('0x41')](_0xe3ed('0x38'))[_0xe3ed('0x42')](_0x507611+_0xe3ed('0x46'),_0x4bcdce['id'][_0xe3ed('0x40')]())))[_0xe3ed('0x40')]();return _0x2a96c2;};var _0xf88546=function(_0x378a59,_0xe6697a){var _0x3758f1=squel[_0xe3ed('0x47')]()['into'](_0xe3ed('0x38'))[_0xe3ed('0x39')]([_0xe3ed('0x1e'),_0xe3ed('0x48'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0xe6697a,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()['field'](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'scheduledAt')[_0xe3ed('0x3e')]('id','ContactId')[_0xe3ed('0x3e')](LISTID['toString'](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x378a59['id'][_0xe3ed('0x40')](),_0xe6697a)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'createdAt')[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')](_0xe3ed('0x49'))[_0xe3ed('0x42')](_0xe3ed('0x43'))['where'](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')]('id\x20IN\x20?',squel[_0xe3ed('0x4a')](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b'))[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()['field'](_0xe3ed('0x4c'))['from']('cm_hopper_final')['where'](_0xe6697a+_0xe3ed('0x46'),_0x378a59['id'][_0xe3ed('0x40')]()))[_0xe3ed('0x42')](_0xe3ed('0x45'),squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'))[_0xe3ed('0x41')](_0xe3ed('0x38'))[_0xe3ed('0x42')](_0xe6697a+_0xe3ed('0x46'),_0x378a59['id']['toString']())))[_0xe3ed('0x40')]();return _0x3758f1;};function _0x580ce7(_0x37c374,_0xaa2246){var _0xf4ad4c=squel[_0xe3ed('0x47')]()[_0xe3ed('0x37')](_0xe3ed('0x38'))[_0xe3ed('0x39')]([_0xe3ed('0x1e'),_0xe3ed('0x48'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0xaa2246,'createdAt',_0xe3ed('0x3c')],squel[_0xe3ed('0x3d')]()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x48'))[_0xe3ed('0x3e')]('id','ContactId')[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x37c374['id'][_0xe3ed('0x40')](),_0xaa2246)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3b'))['field'](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')]('cm_contacts')[_0xe3ed('0x42')](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID[_0xe3ed('0x40')]())[_0xe3ed('0x42')](_0xe3ed('0x4d'),squel[_0xe3ed('0x4a')](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b')))[_0xe3ed('0x40')]();return _0xf4ad4c;}function _0x4d3f54(_0x22c3df,_0x4f3835){var _0x1786a0=squel[_0xe3ed('0x47')]()['into']('cm_hopper_black')['fromQuery']([_0xe3ed('0x1e'),_0xe3ed('0x3a'),_0xe3ed('0x26'),_0x4f3835,_0xe3ed('0x3b'),_0xe3ed('0x3c')],squel['select']()[_0xe3ed('0x3e')](_0xe3ed('0x1e'),_0xe3ed('0x1e'))[_0xe3ed('0x3e')]('id',_0xe3ed('0x3a'))[_0xe3ed('0x3e')](LISTID[_0xe3ed('0x40')](),_0xe3ed('0x26'))[_0xe3ed('0x3e')](_0x22c3df['id'][_0xe3ed('0x40')](),_0x4f3835)[_0xe3ed('0x3e')](_0xe3ed('0x3f'),'createdAt')[_0xe3ed('0x3e')](_0xe3ed('0x3f'),_0xe3ed('0x3c'))[_0xe3ed('0x41')](_0xe3ed('0x49'))['where'](_0xe3ed('0x43'))[_0xe3ed('0x42')](_0xe3ed('0x44'),LISTID['toString']())[_0xe3ed('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xe3ed('0x42')](_0xe3ed('0x4b')))[_0xe3ed('0x40')]();return _0x1786a0;}return db[_0xe3ed('0x4e')][_0xe3ed('0x4f')]({'where':{'type':_0xe3ed('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xe3ed('0x51'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x17ba2f){var _0x33b7e8=[];if(_0x17ba2f){var _0x2c5803;for(var _0x3450df=0x0,_0x375834;_0x3450df<_0x17ba2f[_0xe3ed('0x28')];_0x3450df+=0x1){_0x375834=_0x17ba2f[_0x3450df][_0xe3ed('0x52')]({'plain':!![]});switch(_0x375834['dialCheckDuplicateType']){case _0xe3ed('0x53'):_0x33b7e8['push'](db[_0xe3ed('0x54')]['query'](_0xf88546(_0x375834,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;case _0xe3ed('0x56'):_0x33b7e8[_0xe3ed('0x30')](db['sequelize'][_0xe3ed('0x57')](_0x34fbff(_0x375834,'VoiceQueueId'))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;default:_0x33b7e8[_0xe3ed('0x30')](db['sequelize']['query'](_0x580ce7(_0x375834,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}}return _0x33b7e8;})[_0xe3ed('0x58')]()[_0xe3ed('0x2f')](function(){return db['VoiceQueue'][_0xe3ed('0x4f')]({'where':{'type':_0xe3ed('0x50')},'attributes':['id'],'include':[{'model':db[_0xe3ed('0x59')],'as':_0xe3ed('0x5a'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x24cf58){var _0x4df31d=[];if(_0x24cf58){var _0x4ca11c;for(var _0x2e40de=0x0,_0x3df811;_0x2e40de<_0x24cf58['length'];_0x2e40de+=0x1){_0x3df811=_0x24cf58[_0x2e40de][_0xe3ed('0x52')]({'plain':!![]});_0x4df31d['push'](db['sequelize'][_0xe3ed('0x57')](_0x4d3f54(_0x3df811,_0xe3ed('0x55')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));}}return _0x4df31d;})[_0xe3ed('0x58')]();})[_0xe3ed('0x2f')](function(){return db['Campaign'][_0xe3ed('0x4f')]({'attributes':['id',_0xe3ed('0x5b')],'include':[{'model':db[_0xe3ed('0x59')],'as':'Lists','where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x1dc1d1){var _0x5c2b35=[];if(_0x1dc1d1){for(var _0x65ba85=0x0,_0x331218;_0x65ba85<_0x1dc1d1['length'];_0x65ba85+=0x1){_0x331218=_0x1dc1d1[_0x65ba85]['get']({'plain':!![]});switch(_0x331218['dialCheckDuplicateType']){case _0xe3ed('0x53'):_0x5c2b35['push'](db[_0xe3ed('0x54')]['query'](_0xf88546(_0x331218,'CampaignId'))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;case _0xe3ed('0x56'):_0x5c2b35[_0xe3ed('0x30')](db[_0xe3ed('0x54')][_0xe3ed('0x57')](_0x34fbff(_0x331218,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})[_0xe3ed('0x31')](_0x19864a()));break;default:_0x5c2b35[_0xe3ed('0x30')](db['sequelize'][_0xe3ed('0x57')](_0x580ce7(_0x331218,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}}return _0x5c2b35;})[_0xe3ed('0x58')]();})[_0xe3ed('0x2f')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xe3ed('0x59')],'as':_0xe3ed('0x5a'),'where':{'id':LISTID}}]})[_0xe3ed('0x2f')](function(_0x13e0e1){var _0x4703e3=[];if(_0x13e0e1){for(var _0x32b37b=0x0,_0x10419a;_0x32b37b<_0x13e0e1[_0xe3ed('0x28')];_0x32b37b+=0x1){_0x10419a=_0x13e0e1[_0x32b37b][_0xe3ed('0x52')]({'plain':!![]});_0x4703e3['push'](db[_0xe3ed('0x54')][_0xe3ed('0x57')](_0x4d3f54(_0x10419a,_0xe3ed('0x5c')))[_0xe3ed('0x2f')](function(){})['catch'](_0x19864a()));}}return _0x4703e3;})[_0xe3ed('0x58')]();})[_0xe3ed('0x31')](function(_0x3dbaa4){logger[_0xe3ed('0x14')](_0xe3ed('0x5d'),_0xe3ed('0x5e'),_0x3dbaa4['message']);});}var processPromises=function(_0x520aff){return BPromise['all'](promises)[_0xe3ed('0x2f')](function(_0x2e9e0c){})[_0xe3ed('0x31')](function(_0x5535ec){logger[_0xe3ed('0x14')](_0xe3ed('0x5f'),JSON[_0xe3ed('0x33')](_0x5535ec));})['finally'](function(){socket[_0xe3ed('0x60')](_0xe3ed('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x520aff){return _0x520aff[_0xe3ed('0x62')]();}});};var endCsv=function(){return BPromise[_0xe3ed('0x63')]()[_0xe3ed('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xe3ed('0x2f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe3ed('0x64')](FILEPATH);}catch(_0x2171a3){logger[_0xe3ed('0x14')](_0xe3ed('0x65'),JSON[_0xe3ed('0x33')](_0x2171a3));}finally{process[_0xe3ed('0x66')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xe3ed('0x67'));endCsv();});function main(){return BPromise[_0xe3ed('0x63')]()[_0xe3ed('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe3ed('0xf')](',');return db[_0xe3ed('0x2c')][_0xe3ed('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe3ed('0x2f')](function(_0x3c7afc){var _0x98da7d=fs[_0xe3ed('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x98da7d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1146fc,_0x3649b1){total+=0x1;var _0x58f964=total;promises['push'](checkRow(_0x1146fc,_0x3c7afc,_0x58f964)[_0xe3ed('0x2f')](function(){success+=0x1;})['catch'](function(_0x29796d){if(_0x29796d['error']){errors+=0x1;delete _0x29796d[_0xe3ed('0x14')];}else if(_0x29796d['duplicate']){duplicates+=0x1;delete _0x29796d['duplicate'];}rows['push'](_0x29796d);}));if(total%0xc8===0x0){_0x3649b1[_0xe3ed('0x69')]();return processPromises(_0x3649b1);}},'complete':function(){return processPromises()[_0xe3ed('0x2f')](function(){logger[_0xe3ed('0x6a')](_0xe3ed('0x6b'));endCsv();});},'error':function(_0x442f93,_0x5da77c){logger['info'](_0xe3ed('0x6c'),JSON[_0xe3ed('0x33')](_0x442f93));endCsv();}});})[_0xe3ed('0x31')](function(_0x49c6e7){logger[_0xe3ed('0x14')](_0xe3ed('0x6d'),JSON['stringify'](_0x49c6e7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d21aee1..8902862 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 _0xe85c=['keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','name','_description','header','writeFileSync','data','rows','find','hasOwnProperty','trim','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','replace','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','all','AdditionalPhones','split','push','CmContactHasItem','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat'];(function(_0x2ca077,_0x47b4c7){var _0x1518f7=function(_0x43cc2b){while(--_0x43cc2b){_0x2ca077['push'](_0x2ca077['shift']());}};_0x1518f7(++_0x47b4c7);}(_0xe85c,0x1d2));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xce85('0x0'));var _=require(_0xce85('0x1'));var Papa=require(_0xce85('0x2'));var util=require(_0xce85('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xce85('0x4'));var Redis=require(_0xce85('0x5'));var db=require(_0xce85('0x6'))['db'];var config=require(_0xce85('0x7'));var shared=require(_0xce85('0x8'));var logger=require(_0xce85('0x9'))(_0xce85('0xa'));config[_0xce85('0xb')]=_[_0xce85('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce85('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xce85('0xd')](_0xce85('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xce85('0xd')](_0xce85('0xe'));function isEmail(_0x32f737){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))*$/[_0xce85('0xf')](_0x32f737);}function selectNotIn(_0x2cb99e,_0x5267e2,_0xbfcabe,_0x5cedc7,_0x2da952){return squel[_0xce85('0x10')]()[_0xce85('0x11')](_0xce85('0x12'))[_0xce85('0x13')](_0x5cedc7)[_0xce85('0x14')](_0x5267e2,null,_0x5267e2+_0xce85('0x15')+_0x5cedc7+'.'+_0xbfcabe)[_0xce85('0x16')](_0x5cedc7+'.'+_0xbfcabe+_0xce85('0x17')+_0x2cb99e+'.'+_0xbfcabe)['where'](_0x5267e2+_0xce85('0x18')+_0x2da952[_0xce85('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b8e2c,_0x3fba8a){promisesAdditionalPhones=[];return db[_0xce85('0x19')][_0xce85('0x1a')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xce85('0x1b')](function(_0x403c5a){if(_0x403c5a!==null){var _0x4859f3=[];for(var _0x8412cb=0x0;_0x8412cb<_0x403c5a[_0xce85('0x1c')];_0x8412cb++){var _0x14285b=_0x403c5a[_0x8412cb];_0x4859f3['push'](insertAdditionalPhones(_0x14285b));}}Promise[_0xce85('0x1d')](_0x4859f3)[_0xce85('0x1b')](function(){_0x5b8e2c({'val':0x1});});});});}function insertAdditionalPhones(_0x3077eb){return new Promise(function(_0x19e4f9,_0x28f1b3){var _0x56fca9=_0x3077eb[_0xce85('0x1e')];var _0x4d3ee9=_0x56fca9[_0xce85('0x1f')](';');var _0x1ffb42=[];orderBy=0x0;for(var _0x294b63=0x0;_0x294b63<_0x4d3ee9[_0xce85('0x1c')];_0x294b63++){_0x1ffb42[_0xce85('0x20')](splitAdditionalPhone(_0x3077eb['id'],_0x4d3ee9[_0x294b63]));}Promise[_0xce85('0x1d')](_0x1ffb42)[_0xce85('0x1b')](function(){_0x19e4f9({'val':_0x4d3ee9[_0xce85('0x1c')]});});});}function splitAdditionalPhone(_0x2526be,_0x36d328){return new Promise(function(_0x3028f4,_0x27ab50){var _0x309b50=_0x36d328[_0xce85('0x1f')](':');var _0x2b1e49=_0x309b50[0x0];var _0x532b86=_0x309b50[0x1];if(!_['isNil'](_0x532b86)){var _0x11aef0=_0x532b86[_0xce85('0x1f')]('|');var _0x50a5ad=[];for(var _0x2d457d=0x0;_0x2d457d<_0x11aef0[_0xce85('0x1c')];_0x2d457d++){if(_0x11aef0[_0x2d457d]!==''){var _0x16ccaf=_['filter'](promisesAdditionalPhones,{'contactId':_0x2526be,'phone':_0x11aef0[_0x2d457d]});if(_0x16ccaf['length']==0x0){orderBy++;promisesAdditionalPhones[_0xce85('0x20')]({'contactId':_0x2526be,'contactTypeId':_0x2b1e49,'phone':_0x11aef0[_0x2d457d],'orderBy':orderBy});}}}_0x3028f4({'ok':0x1});}else _0x3028f4({'res':0x0});});}function createAdditionalPhone(_0x431bc2,_0x5db313,_0x46efe4,_0x5873f2){var _0x497286='';var _0x5ccc0c='';var _0x315360=_0x46efe4['split']('§');_0x497286=_0x315360[0x0];if(_0x315360['length']==0x2)_0x5ccc0c=_0x315360[0x1];return new Promise(function(_0x261a6b,_0x292bff){return db[_0xce85('0x21')]['findOne']({'where':{'CmContactId':_0x431bc2,'item':_0x497286}})[_0xce85('0x1b')](function(_0x4405a1){if(_0x4405a1){return db['CmContactHasItem'][_0xce85('0x22')]({'ItemTypeId':_0x5db313,'description':_0x5ccc0c,'OrderBy':_0x5873f2},{'where':{'CmContactId':_0x431bc2,'item':_0x497286}})[_0xce85('0x1b')](function(_0x4525c9){_0x261a6b({'res':_0xce85('0x23')});});}else{return db['CmContactHasItem'][_0xce85('0x24')]({'CmContactId':_0x431bc2,'item':_0x497286,'description':_0x5ccc0c,'ItemTypeId':_0x5db313,'OrderBy':_0x5873f2,'ItemClass':_0xce85('0x25')})['then'](function(_0x1080db){_0x261a6b({'res':'inserted'});});}});});}function insertCmHopper(_0x5c7773,_0x5c177a,_0x1b3853,_0x582e55,_0x4ed518){var _0x419bcc=[_0xce85('0x26'),_0xce85('0x27'),_0xce85('0x28'),_0xce85('0x29'),_0x5c177a+'.'+_0x582e55,_0xce85('0x2a'),_0xce85('0x2b'),'cm_contacts.priority',_0xce85('0x2c'),'\x22'+_0x4ed518+'\x22'];return squel[_0xce85('0x2d')]()[_0xce85('0x2e')]('cm_hopper')[_0xce85('0x2f')]([_0xce85('0x12'),_0xce85('0x30'),_0xce85('0x31'),_0xce85('0x32'),_0x582e55,_0xce85('0x33'),_0xce85('0x34'),_0xce85('0x35'),_0xce85('0x36'),_0xce85('0x37')],squel['select']()[_0xce85('0x38')](_0x419bcc)['from'](_0x5c177a)['join'](_0xce85('0x39'),null,_0xce85('0x3a')+_0x5c177a+_0xce85('0x3b'))[_0xce85('0x14')](_0x1b3853,null,_0x1b3853+_0xce85('0x15')+_0x5c177a+'.'+_0x582e55)[_0xce85('0x16')](_0x5c177a+_0xce85('0x3c'),_0x5c7773)[_0xce85('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xce85('0x3d'),selectNotIn(_0x5c177a,_0x1b3853,_0x582e55,_0xce85('0x3e'),[_0xce85('0x3f'),_0xce85('0x40')]))[_0xce85('0x16')](_0xce85('0x3d'),selectNotIn(_0x5c177a,_0x1b3853,_0x582e55,'cm_hopper',[_0xce85('0x3f')])))['toString']();}function insertCmHopperBlack(_0xf29621,_0x1e8f70,_0xdbdb97,_0x131cf7){var _0x42e4a3=[_0xce85('0x26'),'cm_contacts.id',_0xce85('0x29'),_0x1e8f70+'.'+_0x131cf7,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xce85('0x2d')]()['into'](_0xce85('0x41'))[_0xce85('0x2f')](['phone',_0xce85('0x31'),_0xce85('0x32'),_0x131cf7,'createdAt','updatedAt'],squel[_0xce85('0x10')]()['fields'](_0x42e4a3)[_0xce85('0x13')](_0x1e8f70)[_0xce85('0x14')](_0xce85('0x39'),null,_0xce85('0x3a')+_0x1e8f70+'.CmListId')[_0xce85('0x14')](_0xdbdb97,null,_0xdbdb97+_0xce85('0x15')+_0x1e8f70+'.'+_0x131cf7)['where'](_0x1e8f70+'.CmListId\x20=\x20?',_0xf29621)[_0xce85('0x16')](_0xce85('0x42'),NOW)[_0xce85('0x16')](_0xce85('0x3d'),squel[_0xce85('0x10')]()[_0xce85('0x11')](_0xce85('0x12'))[_0xce85('0x13')]('cm_hopper_black')['where'](_0xce85('0x43'),_0xf29621)[_0xce85('0x16')](_0x131cf7+'\x20=\x20'+_0x1e8f70+'.'+_0x131cf7)))[_0xce85('0x44')]();}function insertTzCmHopper(_0x43dfc5,_0x202c1c,_0x3a0700,_0x58d7f6,_0x265bb8,_0x3fdc04){var _0xbf7b91=[_0xce85('0x26'),_0xce85('0x45')+_0x3fdc04+_0xce85('0x46'),_0xce85('0x28'),_0xce85('0x29'),_0x202c1c+'.'+_0x58d7f6,_0xce85('0x2a'),_0xce85('0x2b'),'cm_contacts.priority',_0xce85('0x2c'),'\x22'+_0x265bb8+'\x22'];var _0x390428=squel['insert']()['into']('cm_hopper')[_0xce85('0x2f')](['phone',_0xce85('0x30'),_0xce85('0x31'),'ListId',_0x58d7f6,_0xce85('0x33'),'updatedAt',_0xce85('0x35'),'UserId','recallme'],squel[_0xce85('0x10')]()[_0xce85('0x38')](_0xbf7b91)[_0xce85('0x13')](_0x202c1c)[_0xce85('0x14')](_0xce85('0x39'),null,_0xce85('0x3a')+_0x202c1c+'.CmListId')[_0xce85('0x14')](_0x3a0700,null,_0x3a0700+_0xce85('0x15')+_0x202c1c+'.'+_0x58d7f6)[_0xce85('0x14')](_0x3fdc04,null,_0x3fdc04+_0xce85('0x15')+_0x202c1c+'.'+_0x58d7f6)['where'](_0x202c1c+'.CmListId\x20=\x20?',_0x43dfc5)[_0xce85('0x16')](_0xce85('0x42'),NOW)[_0xce85('0x16')](_0xce85('0x3d'),selectNotIn(_0x202c1c,_0x3a0700,_0x58d7f6,_0xce85('0x3e'),[_0xce85('0x3f'),_0xce85('0x40')]))[_0xce85('0x16')](_0xce85('0x3d'),selectNotIn(_0x202c1c,_0x3a0700,_0x58d7f6,'cm_hopper',['\x22always\x22'])))[_0xce85('0x44')]();return _0x390428;}function insertTzCmHopperBlack(_0x2028c0,_0x1445d8,_0x33e7ce,_0x144280){var _0x9336d3=[_0xce85('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x1445d8+'.'+_0x144280,_0xce85('0x2a'),_0xce85('0x2b')];return squel[_0xce85('0x2d')]()[_0xce85('0x2e')](_0xce85('0x41'))[_0xce85('0x2f')](['phone',_0xce85('0x31'),'ListId',_0x144280,_0xce85('0x33'),_0xce85('0x34')],squel[_0xce85('0x10')]()[_0xce85('0x38')](_0x9336d3)['from'](_0x1445d8)[_0xce85('0x14')](_0xce85('0x39'),null,_0xce85('0x3a')+_0x1445d8+'.CmListId')[_0xce85('0x14')](_0x33e7ce,null,_0x33e7ce+_0xce85('0x15')+_0x1445d8+'.'+_0x144280)[_0xce85('0x16')](_0x1445d8+_0xce85('0x3c'),_0x2028c0)[_0xce85('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xce85('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xce85('0x10')]()[_0xce85('0x11')](_0xce85('0x12'))['from'](_0xce85('0x41'))[_0xce85('0x16')](_0xce85('0x43'),_0x2028c0)[_0xce85('0x16')](_0x144280+_0xce85('0x17')+_0x1445d8+'.'+_0x144280)))[_0xce85('0x44')]();}function insertCmHopperAdditionalPhones(_0x4e6b9f){var _0x2abac5=['cm_hopper.id',_0xce85('0x47'),_0xce85('0x48'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0xce85('0x2e')](_0xce85('0x49'))[_0xce85('0x2f')](['CmHopperId','phone',_0xce85('0x4a'),_0xce85('0x33'),_0xce85('0x34')],squel[_0xce85('0x10')]()['fields'](_0x2abac5)[_0xce85('0x13')]('cm_hopper')[_0xce85('0x14')](_0xce85('0x39'),null,_0xce85('0x4b'))[_0xce85('0x14')](_0xce85('0x4c'),null,_0xce85('0x4d'))[_0xce85('0x16')](_0xce85('0x4e'),_0x4e6b9f)[_0xce85('0x16')](_0xce85('0x42'),NOW))['toString']();}function insertCmContact(_0x3e9a86,_0x41c6eb,_0x1dabd1,_0x50fb48){var _0x476ad7=_[_0xce85('0x4f')](_[_0xce85('0x50')](_0x50fb48),[_0xce85('0x32'),_0xce85('0x51'),_0xce85('0x33'),_0xce85('0x34'),_0xce85('0x52')]);return squel[_0xce85('0x2d')]()[_0xce85('0x2e')](_0xce85('0x39'))['fromQuery'](_0x476ad7,squel[_0xce85('0x10')]()['fields'](_0x476ad7)[_0xce85('0x13')](_0x41c6eb)['where']('('+_0x1dabd1[_0xce85('0x14')](',')+_0xce85('0x53'),squel[_0xce85('0x10')]()['fields'](_0x1dabd1)['from'](_0xce85('0x39'))[_0xce85('0x16')](_0xce85('0x43'),_0x3e9a86)[_0xce85('0x16')](_0xce85('0x54')))[_0xce85('0x16')]('id\x20IN\x20?',squel[_0xce85('0x10')]()[_0xce85('0x11')](_0xce85('0x55'),_0xce85('0x56'))[_0xce85('0x13')](_0x41c6eb)[_0xce85('0x57')](_0x1dabd1[_0xce85('0x14')](','))))[_0xce85('0x44')]();}function handleStop(){logger[_0xce85('0x58')](_0xce85('0x59'));stopped=!![];}function handleUncaughtException(_0x319c9d){logger[_0xce85('0x5a')](_0x319c9d[_0xce85('0x5b')]);process[_0xce85('0x5c')](0x1);}function handleError(_0x556f9f,_0xc3a31a){stats[_0xce85('0x5d')][_0xce85('0x20')]({'name':_0xc3a31a[_0xce85('0x5e')],'message':_0xc3a31a[_0xce85('0x5b')],'row':_0x556f9f});}function handleQuery(_0x561e9f){logger[_0xce85('0x58')](_0x561e9f);return db['sequelize'][_0xce85('0x5f')](_0x561e9f)[_0xce85('0x60')](function(_0x3d262c){results[_0xce85('0x20')](_0x3d262c);})['catch'](function(_0x285eab){logger['error'](_0x285eab[_0xce85('0x5b')]);});}function updateTzCampaigns(_0x3db55c){return new Promise(function(_0x14a95c,_0x29e80e){var _0x51541d=squel['select']()['fields']([_0xce85('0x61'),_0xce85('0x62')])[_0xce85('0x13')](_0xce85('0x63'))[_0xce85('0x14')](_0xce85('0x64'),null,_0xce85('0x65'))[_0xce85('0x16')]('campaigns_has_cm_lists.CmListId='+_0x3db55c);db[_0xce85('0x66')][_0xce85('0x5f')](_0x51541d['toString']())['spread'](function(_0x5632de){var _0x53c660=[];for(var _0x4cee8b=0x0;_0x4cee8b<_0x5632de[_0xce85('0x1c')];_0x4cee8b++){_0x53c660['push'](getTimezoneData(_0x5632de[_0x4cee8b],tmp_campaigns));}BPromise[_0xce85('0x1d')](_0x53c660)[_0xce85('0x1b')](function(){_0x14a95c({'val':0x1});});})[_0xce85('0x67')](function(_0x3eb431){logger[_0xce85('0x5a')](_0x3eb431[_0xce85('0x5b')]);_0x14a95c({'val':0x0});});});}function updateTzVoiceQueues(_0x303234){return new Promise(function(_0x169b14,_0xbba857){var _0x349366=squel['select']()[_0xce85('0x38')]([_0xce85('0x68'),_0xce85('0x69')])[_0xce85('0x13')](_0xce85('0x6a'))[_0xce85('0x14')](_0xce85('0x6b'),null,_0xce85('0x6c'))['where'](_0xce85('0x6d')+_0x303234);db[_0xce85('0x66')][_0xce85('0x5f')](_0x349366[_0xce85('0x44')]())[_0xce85('0x60')](function(_0x26c88e){var _0x1227cd=[];for(var _0x1fa3cc=0x0;_0x1fa3cc<_0x26c88e['length'];_0x1fa3cc++){_0x1227cd[_0xce85('0x20')](getTimezoneData(_0x26c88e[_0x1fa3cc],tmp_voice_queues));}BPromise[_0xce85('0x1d')](_0x1227cd)['then'](function(){_0x169b14({'val':0x1});});})['catch'](function(_0x30608e){logger[_0xce85('0x5a')](_0x30608e[_0xce85('0x5b')]);_0x169b14({'val':0x0});});});}function getTimezoneData(_0x5da7d7,_0x222b70){return new Promise(function(_0x6dac53,_0x59ac5e){var _0x378c36=shared[_0xce85('0x6e')];var _0x2649d0=_0x378c36[_0x5da7d7[_0xce85('0x6f')]];if(_[_0xce85('0x70')](_0x2649d0)){_0x6dac53({'ret':0x1});}else{var _0x303981=_0x2649d0[_0xce85('0x71')];var _0x50f5f6=squel['insert']()[_0xce85('0x2e')](_0x222b70)[_0xce85('0x72')]('id',_0x5da7d7['id'])[_0xce85('0x72')](_0xce85('0x73'),_0x303981)['set']('dialTimezone',_0x5da7d7[_0xce85('0x6f')])['toString']();return db[_0xce85('0x66')][_0xce85('0x5f')](_0x50f5f6)[_0xce85('0x60')](function(_0x18fe5b){_0x6dac53({'ret':0x1});})[_0xce85('0x67')](function(_0x3bb6b0){logger['error'](_0x3bb6b0[_0xce85('0x5b')]);_0x59ac5e({'ret':0x1});});}});}function handleTZQuery(_0x1f4380){logger[_0xce85('0x58')](_0x1f4380);return db[_0xce85('0x66')][_0xce85('0x5f')](_0x1f4380)[_0xce85('0x60')](function(_0x3c8f96){})[_0xce85('0x67')](function(_0x5dcf5c){logger[_0xce85('0x5a')](_0x5dcf5c[_0xce85('0x5b')]);});}function main(_0x482b18,_0x2595ac,_0x5cdeaa,_0x56b471){logger[_0xce85('0x58')](_0xce85('0x74'),_0x482b18,JSON[_0xce85('0x75')](_0x2595ac));process[_0xce85('0x76')](_0xce85('0x77'));var _0xd1fefb=_0x2595ac['binding'];var _0x43abcd=_['clone'](_0xd1fefb);var _0x15cbb4=_0x2595ac[_0xce85('0x78')];var _0xbc3d2b=path[_0xce85('0x14')](config[_0xce85('0x79')],_0xce85('0x7a'),_0x15cbb4+_0xce85('0x7b'));hasTZ=_[_0xce85('0x50')](_0xd1fefb)['includes']('dialTimezone');var _0x43fca8=_['keys'](_0xd1fefb)[_0xce85('0x14')]();logger[_0xce85('0x58')]('header',_0x43fca8);db['ContactItemType'][_0xce85('0x1a')]({'raw':!![],'attributes':['id','name']})[_0xce85('0x1b')](function(_0x2fdbe4){for(var _0x34e2b4=0x0;_0x34e2b4<_0x2fdbe4[_0xce85('0x1c')];_0x34e2b4++){if(_0x2fdbe4[_0x34e2b4][_0xce85('0x7c')]in _0xd1fefb){contactItemTypes[_0xce85('0x20')](_0x2fdbe4[_0x34e2b4]);delete _0x43abcd[_0x2fdbe4[_0x34e2b4][_0xce85('0x7c')]];hasAdditionalPhones=!![];}for(var _0x5a482b in _0xd1fefb){if(_0x2fdbe4[_0x34e2b4][_0xce85('0x7c')]+_0xce85('0x7d')===_0x5a482b){phoneDescriptions['push']({'itemTypeId':_0x2fdbe4[_0x34e2b4]['id'],'description':_0x5a482b});delete _0x43abcd[_0x5a482b];}}}if(hasAdditionalPhones)_0x43abcd[_0xce85('0x1e')]='';var _0x228ef8=_[_0xce85('0x50')](_0x43abcd)[_0xce85('0x14')]();logger[_0xce85('0x58')](_0xce85('0x7e'),_0x228ef8);fs[_0xce85('0x7f')](_0xbc3d2b,_0x228ef8+'\x0a');Papa['parse'](fs['createReadStream'](_0x482b18),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b3cd3,_0x253921){try{for(var _0x587f63=0x0,_0x2c8c92=[];_0x587f63<_0x3b3cd3[_0xce85('0x80')][_0xce85('0x1c')];_0x587f63++){stats[_0xce85('0x81')]+=0x1;if(_0x3b3cd3[_0xce85('0x5d')][_0x587f63]){handleError(_0x3b3cd3[_0xce85('0x80')][_0x587f63],_0x3b3cd3[_0xce85('0x5d')][_0x587f63]);}else{var _0x57d471=[];var _0x35ff99=[];var _0x1df5bd={};for(var _0x3686b1 in _0xd1fefb){let _0x58ced4=contactItemTypes[_0xce85('0x82')](_0x2a6cd2=>_0x2a6cd2[_0xce85('0x7c')]===_0x3686b1);let _0x449860=contactItemTypes[_0xce85('0x82')](_0x36776d=>_0x36776d['name']+_0xce85('0x7d')===_0x3686b1);if(_['isNil'](_0x58ced4)&&_['isNil'](_0x449860)){if(_0xd1fefb[_0xce85('0x83')](_0x3686b1)){if(_0x3b3cd3[_0xce85('0x80')][_0x587f63][_0xd1fefb[_0x3686b1]]){var _0x587b0f=_[_0xce85('0x84')](_0x3b3cd3['data'][_0x587f63][_0xd1fefb[_0x3686b1]]['replace'](/"/g,'\x27'));switch(_0x3686b1){case'scheduledat':var _0x5c9897=moment(_0x587b0f,_0xce85('0xe'),!![]);if(_0x5c9897[_0xce85('0x85')]()){_0x2c8c92['push']('\x22'+_0x587b0f+'\x22');}else{_0x57d471[_0xce85('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xce85('0x35'):var _0x598848=parseInt(_0x587b0f);_0x587b0f=_[_0xce85('0x86')](_0x598848)||_0x598848<0x0||_0x598848>0x4?_0x56b471?0x3:0x2:_0x598848;_0x2c8c92[_0xce85('0x20')]('\x22'+_0x587b0f+'\x22');break;case _0xce85('0x36'):var _0x85c966=parseInt(_0x587b0f);if(_[_0xce85('0x87')](_0x85c966)&&_[_0xce85('0x88')](_0x5cdeaa,_0x85c966)){_0x2c8c92['push']('\x22'+_0x85c966+'\x22');}else{_0x57d471[_0xce85('0x20')](_0xce85('0x89'));}break;case _0xce85('0x8a'):if(isEmail(_0x587b0f)){_0x2c8c92[_0xce85('0x20')]('\x22'+_0x587b0f+'\x22');}else{_0x57d471[_0xce85('0x20')](_0xce85('0x8b'));}break;case _0xce85('0x8c'):var _0x18efde=moment(_0x587b0f,_0xce85('0x8d'),!![]);if(_0x18efde[_0xce85('0x85')]()){_0x2c8c92[_0xce85('0x20')]('\x22'+_0x587b0f+'\x22');}else{_0x57d471['push'](_0xce85('0x8e'));}break;case _0xce85('0x6f'):var _0x22f414=shared[_0xce85('0x6e')];var _0x864b24=_0x22f414[_0x587b0f];if(!_[_0xce85('0x70')](_0x864b24)){var _0x5f50ff=_0x864b24[_0xce85('0x71')];_0x2c8c92[_0xce85('0x20')]('\x22'+_0x587b0f+'\x22');_0x2c8c92[_0xce85('0x20')]('\x22'+_0x5f50ff+'\x22');}break;default:_0x2c8c92[_0xce85('0x20')]('\x22'+_0x587b0f+'\x22');}}else{switch(_0x3686b1){case _0xce85('0x8f'):case _0xce85('0x12'):_0x57d471[_0xce85('0x20')](_0x3686b1+_0xce85('0x90'));break;default:_0x2c8c92[_0xce85('0x20')]('\x22\x22');}}}}else{var _0x2502ae='';if(!_[_0xce85('0x70')](_0x58ced4)){if(!_0x1df5bd['hasOwnProperty'](_0x58ced4['id'])){if(!_[_0xce85('0x70')](_0x3b3cd3[_0xce85('0x80')][_0x587f63][_0xd1fefb[_0x3686b1]])){var _0x587b0f=_[_0xce85('0x84')](_0x3b3cd3[_0xce85('0x80')][_0x587f63][_0xd1fefb[_0x3686b1]]['replace'](/"/g,'\x27'));var _0x43cd8b=phoneDescriptions[_0xce85('0x82')](_0x230455=>_0x230455['itemTypeId']===_0x58ced4['id']);if(!_[_0xce85('0x70')](_0x43cd8b)){var _0x33f1e7=_['trim'](_0x3b3cd3['data'][_0x587f63][_0xd1fefb[_0x43cd8b[_0xce85('0x91')]]][_0xce85('0x92')](/"/g,'\x27'));if(!_['isNil'](_0x33f1e7))_0x587b0f=_0x587b0f+'§'+_0x33f1e7;}if(_0x2502ae=='')_0x2502ae=_0x587b0f;else _0x2502ae+='|'+_0x587b0f;}_0x35ff99[_0xce85('0x20')](_0x58ced4['id']+':'+_0x2502ae);_0x1df5bd[_0x58ced4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2c8c92['push']('\x22'+_0x35ff99[_0xce85('0x14')](';')+'\x22');}if(_0x57d471['length']){handleError(_0x3b3cd3[_0xce85('0x80')][_0x587f63],{'code':'SystemRow','message':_0x57d471[_0xce85('0x14')]()});}else{fs[_0xce85('0x93')](_0xbc3d2b,_0x2c8c92[_0xce85('0x14')]()+'\x0a');}_0x2c8c92=[];}if(!(stats[_0xce85('0x81')]%0xc8)){socket['emit'](_0xce85('0x94')+_0x15cbb4,stats);stats[_0xce85('0x5d')]=[];}}if(stopped){logger[_0xce85('0x58')](_0xce85('0x95'));_0x253921[_0xce85('0x96')]();}}catch(_0x2c6c67){handleError(_0x3b3cd3[_0xce85('0x80')][_0x587f63],{'code':_0xce85('0x97'),'message':_0x2c6c67[_0xce85('0x5b')]});logger[_0xce85('0x5a')](_0xce85('0x98'),_0x2c6c67['message']);}},'complete':function(){try{var _0x135836=[];var _0x5bcd6f=[];var _0x3ab978=_0xce85('0x39');if(_0x2595ac[_0xce85('0x99')]&&_0x2595ac[_0xce85('0x99')][_0xce85('0x1c')]){_0x3ab978='cm_contacts_'+_0x15cbb4;_0x135836[_0xce85('0x20')](_0xce85('0x9a')+_0x3ab978+_0xce85('0x9b'));}tmp_campaigns=_0xce85('0x9c')+_0x15cbb4;tmp_voice_queues='voice_queues_'+_0x15cbb4;_0x5bcd6f[_0xce85('0x20')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x5bcd6f[_0xce85('0x20')](_0xce85('0x9a')+tmp_voice_queues+_0xce85('0x9d'));BPromise['each'](_0x5bcd6f,handleTZQuery)['then'](function(_0x32620a){updateTzCampaigns(_0x2595ac[_0xce85('0x32')])[_0xce85('0x1b')](function(_0x44f3c1){updateTzVoiceQueues(_0x2595ac[_0xce85('0x32')])[_0xce85('0x1b')](function(_0xf8569c){if(hasTZ)_0x228ef8=_0x228ef8[_0xce85('0x92')](_0xce85('0x6f'),'dialTimezone,utcOffset');var _0x239c1e=util[_0xce85('0xd')](_0xce85('0x9e'),_0xbc3d2b,_0x3ab978,_0x228ef8,_0x2595ac[_0xce85('0x32')],_0x2595ac[_0xce85('0x51')]||null,NOW,NOW);if(_[_0xce85('0x70')](_0xd1fefb[_0xce85('0x30')])){_0x239c1e+=',\x20scheduledAt\x20=\x20NOW()';}_0x135836[_0xce85('0x20')](_0x239c1e);if(_0x2595ac[_0xce85('0x99')]&&_0x2595ac[_0xce85('0x99')][_0xce85('0x1c')]){_0x135836['push'](insertCmContact(_0x2595ac[_0xce85('0x32')],_0x3ab978,_0x2595ac['duplicates'],_0xd1fefb));_0x135836[_0xce85('0x20')](_0xce85('0x9f')+_0x3ab978+';');}BPromise[_0xce85('0xa0')](_0x135836,handleQuery)['then'](function(_0x57afdc){BPromise[_0xce85('0x1d')]([handleAdditionalPhones()])[_0xce85('0x1b')](function(){_0x135836=[];for(var _0x46be36=0x0;_0x46be36\x20\x20');}var _0x3a52b7=path[_0xce85('0x14')](config[_0xce85('0x79')],_0xce85('0x7a'),process[_0xce85('0xab')][0x2]);if(!fs[_0xce85('0xac')](_0x3a52b7)){throw new Error(_0xce85('0xad'));}var _0x2396c9={};try{_0x2396c9=JSON[_0xce85('0xae')](process['argv'][0x3]);if(!_0x2396c9[_0xce85('0xaf')]){throw new Error(_0xce85('0xb0'));}if(!_0x2396c9['binding'][_0xce85('0x12')]){throw new Error(_0xce85('0xb1'));}if(!_0x2396c9[_0xce85('0xaf')][_0xce85('0x8f')]){throw new Error(_0xce85('0xb2'));}var _0x126fbe=0x0;if(_0x2396c9[_0xce85('0xaf')][_0xce85('0x36')]){_0x126fbe=0x1;}if(!_0x2396c9[_0xce85('0x32')]){throw new Error(_0xce85('0xb3'));}}catch(_0x2ae68e){throw new Error(_0xce85('0xb4'));}var _0x24a152=[];try{_0x24a152=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x1e08e5){logger[_0xce85('0x58')]('No\x20agent\x20available');}main(_0x3a52b7,_0x2396c9,_0x24a152,_0x126fbe);}validate();process['on']('SIGINT',handleStop);process['on'](_0xce85('0xb5'),handleUncaughtException); \ No newline at end of file +var _0xdcfb=['cm_hopper_additional_phones','CmHopperId','OrderBy','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','info','message','exit','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','spread','timezones','dialTimezone','utcOffset','offset','set','sequelize','main','stringify','send','binding','server/files/tmp','.csv','header','name','_description','writeFileSync','createReadStream','data','rows','errors','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','voice_queues','affectedRows','emit','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','length','split','isNil','filter','CmContactHasItem','findOne','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','insert','cm_hopper_black','.CmListId','ListId\x20=\x20?','scheduledat','priority','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];(function(_0x110275,_0x3eb1a8){var _0x3aaf46=function(_0x47f832){while(--_0x47f832){_0x110275['push'](_0x110275['shift']());}};_0x3aaf46(++_0x3eb1a8);}(_0xdcfb,0x68));var _0xbdcf=function(_0x3fb150,_0x5e32ed){_0x3fb150=_0x3fb150-0x0;var _0x56f4a8=_0xdcfb[_0x3fb150];return _0x56f4a8;};'use strict';var fs=require('fs');var path=require(_0xbdcf('0x0'));var _=require(_0xbdcf('0x1'));var Papa=require(_0xbdcf('0x2'));var util=require(_0xbdcf('0x3'));var BPromise=require(_0xbdcf('0x4'));var moment=require('moment');var squel=require(_0xbdcf('0x5'));var Redis=require(_0xbdcf('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xbdcf('0x7'));var shared=require(_0xbdcf('0x8'));var logger=require(_0xbdcf('0x9'))(_0xbdcf('0xa'));config[_0xbdcf('0xb')]=_[_0xbdcf('0xc')](config[_0xbdcf('0xb')],{'host':_0xbdcf('0xd'),'port':0x18eb});var socket=require(_0xbdcf('0xe'))(new Redis(config[_0xbdcf('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xbdcf('0xf')](_0xbdcf('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbdcf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3fecb5){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'](_0x3fecb5);}function selectNotIn(_0x5d3c40,_0x1c7581,_0x3f9fdb,_0x53c54,_0x20115e){return squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')](_0xbdcf('0x13'))[_0xbdcf('0x14')](_0x53c54)['join'](_0x1c7581,null,_0x1c7581+'.id\x20=\x20'+_0x53c54+'.'+_0x3f9fdb)[_0xbdcf('0x15')](_0x53c54+'.'+_0x3f9fdb+_0xbdcf('0x16')+_0x5d3c40+'.'+_0x3f9fdb)[_0xbdcf('0x15')](_0x1c7581+_0xbdcf('0x17')+_0x20115e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43dc1e,_0x111346){promisesAdditionalPhones=[];return db[_0xbdcf('0x18')][_0xbdcf('0x19')]({'raw':!![],'attributes':['id',_0xbdcf('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbdcf('0x1b')](function(_0x48ba7e){if(_0x48ba7e!==null){var _0x1af2ca=[];for(var _0x516320=0x0;_0x516320<_0x48ba7e['length'];_0x516320++){var _0x575ee1=_0x48ba7e[_0x516320];_0x1af2ca[_0xbdcf('0x1c')](insertAdditionalPhones(_0x575ee1));}}Promise[_0xbdcf('0x1d')](_0x1af2ca)[_0xbdcf('0x1b')](function(){_0x43dc1e({'val':0x1});});});});}function insertAdditionalPhones(_0x35427a){return new Promise(function(_0x2b5a32,_0x56a5f3){var _0x8b94c3=_0x35427a[_0xbdcf('0x1a')];var _0x111756=_0x8b94c3['split'](';');var _0x2a7e5c=[];orderBy=0x0;for(var _0x45972d=0x0;_0x45972d<_0x111756[_0xbdcf('0x1e')];_0x45972d++){_0x2a7e5c[_0xbdcf('0x1c')](splitAdditionalPhone(_0x35427a['id'],_0x111756[_0x45972d]));}Promise['all'](_0x2a7e5c)[_0xbdcf('0x1b')](function(){_0x2b5a32({'val':_0x111756[_0xbdcf('0x1e')]});});});}function splitAdditionalPhone(_0x5e30cd,_0x5b16f0){return new Promise(function(_0x4af3ed,_0x1dadf2){var _0xc70ac=_0x5b16f0[_0xbdcf('0x1f')](':');var _0x5d1e70=_0xc70ac[0x0];var _0x5bd832=_0xc70ac[0x1];if(!_[_0xbdcf('0x20')](_0x5bd832)){var _0x4b42f7=_0x5bd832[_0xbdcf('0x1f')]('|');var _0x2262ab=[];for(var _0x8de2d4=0x0;_0x8de2d4<_0x4b42f7[_0xbdcf('0x1e')];_0x8de2d4++){if(_0x4b42f7[_0x8de2d4]!==''){var _0x47a788=_[_0xbdcf('0x21')](promisesAdditionalPhones,{'contactId':_0x5e30cd,'phone':_0x4b42f7[_0x8de2d4]});if(_0x47a788['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbdcf('0x1c')]({'contactId':_0x5e30cd,'contactTypeId':_0x5d1e70,'phone':_0x4b42f7[_0x8de2d4],'orderBy':orderBy});}}}_0x4af3ed({'ok':0x1});}else _0x4af3ed({'res':0x0});});}function createAdditionalPhone(_0x52ccf6,_0x790375,_0x329972,_0x82fa2f){var _0x19ad9c='';var _0x42184f='';var _0x13db54=_0x329972[_0xbdcf('0x1f')]('§');_0x19ad9c=_0x13db54[0x0];if(_0x13db54['length']==0x2)_0x42184f=_0x13db54[0x1];return new Promise(function(_0x4a5122,_0x2d20f0){return db[_0xbdcf('0x22')][_0xbdcf('0x23')]({'where':{'CmContactId':_0x52ccf6,'item':_0x19ad9c}})['then'](function(_0x5d4272){if(_0x5d4272){return db[_0xbdcf('0x22')]['update']({'ItemTypeId':_0x790375,'description':_0x42184f,'OrderBy':_0x82fa2f},{'where':{'CmContactId':_0x52ccf6,'item':_0x19ad9c}})[_0xbdcf('0x1b')](function(_0x502d9a){_0x4a5122({'res':'updated'});});}else{return db[_0xbdcf('0x22')][_0xbdcf('0x24')]({'CmContactId':_0x52ccf6,'item':_0x19ad9c,'description':_0x42184f,'ItemTypeId':_0x790375,'OrderBy':_0x82fa2f,'ItemClass':_0xbdcf('0x25')})[_0xbdcf('0x1b')](function(_0x4331c4){_0x4a5122({'res':_0xbdcf('0x26')});});}});});}function insertCmHopper(_0x2b0030,_0x533fa8,_0x41a6a4,_0x25abb0,_0x4c7684){var _0x446c34=[_0xbdcf('0x27'),_0xbdcf('0x28'),_0xbdcf('0x29'),'cm_contacts.ListId',_0x533fa8+'.'+_0x25abb0,'cm_contacts.createdAt',_0xbdcf('0x2a'),_0xbdcf('0x2b'),_0xbdcf('0x2c'),'\x22'+_0x4c7684+'\x22'];return squel['insert']()[_0xbdcf('0x2d')](_0xbdcf('0x2e'))[_0xbdcf('0x2f')]([_0xbdcf('0x13'),'scheduledat',_0xbdcf('0x30'),_0xbdcf('0x31'),_0x25abb0,_0xbdcf('0x32'),_0xbdcf('0x33'),'priority',_0xbdcf('0x34'),_0xbdcf('0x35')],squel['select']()[_0xbdcf('0x36')](_0x446c34)[_0xbdcf('0x14')](_0x533fa8)[_0xbdcf('0x37')](_0xbdcf('0x38'),null,_0xbdcf('0x39')+_0x533fa8+'.CmListId')['join'](_0x41a6a4,null,_0x41a6a4+_0xbdcf('0x3a')+_0x533fa8+'.'+_0x25abb0)['where'](_0x533fa8+_0xbdcf('0x3b'),_0x2b0030)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0x533fa8,_0x41a6a4,_0x25abb0,_0xbdcf('0x2e'),[_0xbdcf('0x3e'),_0xbdcf('0x3f')]))[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0x533fa8,_0x41a6a4,_0x25abb0,'cm_hopper',[_0xbdcf('0x3e')])))[_0xbdcf('0x40')]();}function insertCmHopperBlack(_0x57abcb,_0xfa74f6,_0x5e63e0,_0x517fe7){var _0x45fad1=[_0xbdcf('0x27'),_0xbdcf('0x29'),_0xbdcf('0x41'),_0xfa74f6+'.'+_0x517fe7,_0xbdcf('0x42'),_0xbdcf('0x2a')];return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x44'))[_0xbdcf('0x2f')](['phone',_0xbdcf('0x30'),_0xbdcf('0x31'),_0x517fe7,_0xbdcf('0x32'),_0xbdcf('0x33')],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x45fad1)[_0xbdcf('0x14')](_0xfa74f6)[_0xbdcf('0x37')](_0xbdcf('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0xfa74f6+_0xbdcf('0x45'))[_0xbdcf('0x37')](_0x5e63e0,null,_0x5e63e0+'.id\x20=\x20'+_0xfa74f6+'.'+_0x517fe7)[_0xbdcf('0x15')](_0xfa74f6+'.CmListId\x20=\x20?',_0x57abcb)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')](_0xbdcf('0x13'))[_0xbdcf('0x14')](_0xbdcf('0x44'))[_0xbdcf('0x15')](_0xbdcf('0x46'),_0x57abcb)[_0xbdcf('0x15')](_0x517fe7+_0xbdcf('0x16')+_0xfa74f6+'.'+_0x517fe7)))[_0xbdcf('0x40')]();}function insertTzCmHopper(_0x27ac4c,_0xde590f,_0x10f348,_0xf849c6,_0xe409f4,_0x18ae4f){var _0x53e9f3=[_0xbdcf('0x27'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x18ae4f+'.offset-cm_contacts.utcOffset\x20minute)',_0xbdcf('0x29'),'cm_contacts.ListId',_0xde590f+'.'+_0xf849c6,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xbdcf('0x2b'),_0xbdcf('0x2c'),'\x22'+_0xe409f4+'\x22'];var _0x3a8e36=squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x2e'))[_0xbdcf('0x2f')](['phone',_0xbdcf('0x47'),_0xbdcf('0x30'),'ListId',_0xf849c6,'createdAt',_0xbdcf('0x33'),_0xbdcf('0x48'),_0xbdcf('0x34'),_0xbdcf('0x35')],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x53e9f3)[_0xbdcf('0x14')](_0xde590f)[_0xbdcf('0x37')]('cm_contacts',null,_0xbdcf('0x39')+_0xde590f+_0xbdcf('0x45'))['join'](_0x10f348,null,_0x10f348+'.id\x20=\x20'+_0xde590f+'.'+_0xf849c6)[_0xbdcf('0x37')](_0x18ae4f,null,_0x18ae4f+'.id\x20=\x20'+_0xde590f+'.'+_0xf849c6)['where'](_0xde590f+_0xbdcf('0x3b'),_0x27ac4c)['where'](_0xbdcf('0x3c'),NOW)['where'](_0xbdcf('0x3d'),selectNotIn(_0xde590f,_0x10f348,_0xf849c6,_0xbdcf('0x2e'),[_0xbdcf('0x3e'),'\x22onlyIfOpen\x22']))[_0xbdcf('0x15')](_0xbdcf('0x3d'),selectNotIn(_0xde590f,_0x10f348,_0xf849c6,_0xbdcf('0x2e'),['\x22always\x22'])))[_0xbdcf('0x40')]();return _0x3a8e36;}function insertTzCmHopperBlack(_0x403bef,_0x4aac2,_0x29408c,_0x448f22){var _0x73cd02=['cm_contacts.phone','cm_contacts.id',_0xbdcf('0x41'),_0x4aac2+'.'+_0x448f22,_0xbdcf('0x42'),_0xbdcf('0x2a')];return squel['insert']()[_0xbdcf('0x2d')]('cm_hopper_black')[_0xbdcf('0x2f')]([_0xbdcf('0x13'),_0xbdcf('0x30'),_0xbdcf('0x31'),_0x448f22,_0xbdcf('0x32'),'updatedAt'],squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x73cd02)[_0xbdcf('0x14')](_0x4aac2)[_0xbdcf('0x37')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4aac2+_0xbdcf('0x45'))[_0xbdcf('0x37')](_0x29408c,null,_0x29408c+'.id\x20=\x20'+_0x4aac2+'.'+_0x448f22)[_0xbdcf('0x15')](_0x4aac2+_0xbdcf('0x3b'),_0x403bef)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW)[_0xbdcf('0x15')](_0xbdcf('0x3d'),squel[_0xbdcf('0x11')]()[_0xbdcf('0x12')]('phone')[_0xbdcf('0x14')](_0xbdcf('0x44'))[_0xbdcf('0x15')](_0xbdcf('0x46'),_0x403bef)[_0xbdcf('0x15')](_0x448f22+_0xbdcf('0x16')+_0x4aac2+'.'+_0x448f22)))['toString']();}function insertCmHopperAdditionalPhones(_0x5723ca){var _0x56ecbe=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xbdcf('0x49'),_0xbdcf('0x4a')];return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x4b'))['fromQuery']([_0xbdcf('0x4c'),'phone',_0xbdcf('0x4d'),_0xbdcf('0x32'),_0xbdcf('0x33')],squel['select']()[_0xbdcf('0x36')](_0x56ecbe)[_0xbdcf('0x14')]('cm_hopper')['join'](_0xbdcf('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xbdcf('0x37')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbdcf('0x15')](_0xbdcf('0x4e'),_0x5723ca)[_0xbdcf('0x15')](_0xbdcf('0x3c'),NOW))['toString']();}function insertCmContact(_0x47e5f4,_0x1496f9,_0x51fc20,_0x2c36d0){var _0x3550c4=_[_0xbdcf('0x4f')](_[_0xbdcf('0x50')](_0x2c36d0),[_0xbdcf('0x31'),_0xbdcf('0x51'),_0xbdcf('0x32'),_0xbdcf('0x33'),_0xbdcf('0x52')]);return squel[_0xbdcf('0x43')]()[_0xbdcf('0x2d')](_0xbdcf('0x38'))[_0xbdcf('0x2f')](_0x3550c4,squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')](_0x3550c4)['from'](_0x1496f9)[_0xbdcf('0x15')]('('+_0x51fc20[_0xbdcf('0x37')](',')+_0xbdcf('0x53'),squel['select']()[_0xbdcf('0x36')](_0x51fc20)[_0xbdcf('0x14')](_0xbdcf('0x38'))[_0xbdcf('0x15')]('ListId\x20=\x20?',_0x47e5f4)[_0xbdcf('0x15')](_0xbdcf('0x54')))[_0xbdcf('0x15')]('id\x20IN\x20?',squel['select']()[_0xbdcf('0x12')]('MIN(id)','min_id')[_0xbdcf('0x14')](_0x1496f9)['group'](_0x51fc20['join'](','))))['toString']();}function handleStop(){logger[_0xbdcf('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3f2b11){logger['error'](_0x3f2b11[_0xbdcf('0x56')]);process[_0xbdcf('0x57')](0x1);}function handleError(_0x275fc0,_0x297075){stats['errors'][_0xbdcf('0x1c')]({'name':_0x297075['code'],'message':_0x297075['message'],'row':_0x275fc0});}function handleQuery(_0x2179bc){logger[_0xbdcf('0x55')](_0x2179bc);return db['sequelize'][_0xbdcf('0x58')](_0x2179bc)['spread'](function(_0x14ac7c){results[_0xbdcf('0x1c')](_0x14ac7c);})[_0xbdcf('0x59')](function(_0x1a9f9a){logger[_0xbdcf('0x5a')](_0x1a9f9a[_0xbdcf('0x56')]);});}function updateTzCampaigns(_0x5640e8){return new Promise(function(_0x5c4634,_0x2aeec6){var _0x1d5feb=squel[_0xbdcf('0x11')]()[_0xbdcf('0x36')]([_0xbdcf('0x5b'),_0xbdcf('0x5c')])[_0xbdcf('0x14')](_0xbdcf('0x5d'))[_0xbdcf('0x37')](_0xbdcf('0x5e'),null,_0xbdcf('0x5f'))[_0xbdcf('0x15')](_0xbdcf('0x60')+_0x5640e8);db['sequelize'][_0xbdcf('0x58')](_0x1d5feb[_0xbdcf('0x40')]())['spread'](function(_0x5e4a7f){var _0x849ad=[];for(var _0x2c702f=0x0;_0x2c702f<_0x5e4a7f[_0xbdcf('0x1e')];_0x2c702f++){_0x849ad[_0xbdcf('0x1c')](getTimezoneData(_0x5e4a7f[_0x2c702f],tmp_campaigns));}BPromise['all'](_0x849ad)[_0xbdcf('0x1b')](function(){_0x5c4634({'val':0x1});});})[_0xbdcf('0x59')](function(_0x3954e4){logger[_0xbdcf('0x5a')](_0x3954e4[_0xbdcf('0x56')]);_0x5c4634({'val':0x0});});});}function updateTzVoiceQueues(_0x7344b){return new Promise(function(_0x3f4279,_0x5a2b22){var _0x4e42a0=squel[_0xbdcf('0x11')]()['fields'](['voice_queues.id',_0xbdcf('0x61')])[_0xbdcf('0x14')]('voice_queues')[_0xbdcf('0x37')]('voice_queues_has_cm_lists',null,_0xbdcf('0x62'))[_0xbdcf('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x7344b);db['sequelize'][_0xbdcf('0x58')](_0x4e42a0[_0xbdcf('0x40')]())[_0xbdcf('0x63')](function(_0x40f301){var _0x46bc1e=[];for(var _0x431934=0x0;_0x431934<_0x40f301[_0xbdcf('0x1e')];_0x431934++){_0x46bc1e['push'](getTimezoneData(_0x40f301[_0x431934],tmp_voice_queues));}BPromise[_0xbdcf('0x1d')](_0x46bc1e)['then'](function(){_0x3f4279({'val':0x1});});})['catch'](function(_0x5ebde1){logger[_0xbdcf('0x5a')](_0x5ebde1[_0xbdcf('0x56')]);_0x3f4279({'val':0x0});});});}function getTimezoneData(_0x308dd9,_0x46ee9b){return new Promise(function(_0x20c690,_0x29465){var _0x10f684=shared[_0xbdcf('0x64')];var _0xeba841=_0x10f684[_0x308dd9[_0xbdcf('0x65')]];if(_[_0xbdcf('0x20')](_0xeba841)){_0x20c690({'ret':0x1});}else{var _0x5975eb=_0xeba841[_0xbdcf('0x66')];var _0x21fc74=squel['insert']()[_0xbdcf('0x2d')](_0x46ee9b)['set']('id',_0x308dd9['id'])['set'](_0xbdcf('0x67'),_0x5975eb)[_0xbdcf('0x68')]('dialTimezone',_0x308dd9[_0xbdcf('0x65')])['toString']();return db[_0xbdcf('0x69')][_0xbdcf('0x58')](_0x21fc74)[_0xbdcf('0x63')](function(_0x45eac6){_0x20c690({'ret':0x1});})['catch'](function(_0x2d8d48){logger[_0xbdcf('0x5a')](_0x2d8d48[_0xbdcf('0x56')]);_0x29465({'ret':0x1});});}});}function handleTZQuery(_0x1c1f9e){logger['info'](_0x1c1f9e);return db[_0xbdcf('0x69')][_0xbdcf('0x58')](_0x1c1f9e)[_0xbdcf('0x63')](function(_0x1b7dc5){})[_0xbdcf('0x59')](function(_0x5bf211){logger['error'](_0x5bf211[_0xbdcf('0x56')]);});}function main(_0x4e6ccf,_0x447cc3,_0x184ec0,_0x506ae6){logger['info'](_0xbdcf('0x6a'),_0x4e6ccf,JSON[_0xbdcf('0x6b')](_0x447cc3));process[_0xbdcf('0x6c')]('start');var _0x32f026=_0x447cc3[_0xbdcf('0x6d')];var _0x4ecc5d=_['clone'](_0x32f026);var _0x4c2895=_0x447cc3['socket_timestamp'];var _0x526e0c=path[_0xbdcf('0x37')](config['root'],_0xbdcf('0x6e'),_0x4c2895+_0xbdcf('0x6f'));hasTZ=_[_0xbdcf('0x50')](_0x32f026)['includes'](_0xbdcf('0x65'));var _0x31206e=_[_0xbdcf('0x50')](_0x32f026)[_0xbdcf('0x37')]();logger[_0xbdcf('0x55')](_0xbdcf('0x70'),_0x31206e);db['ContactItemType'][_0xbdcf('0x19')]({'raw':!![],'attributes':['id','name']})[_0xbdcf('0x1b')](function(_0x511cf6){for(var _0x50cc8c=0x0;_0x50cc8c<_0x511cf6['length'];_0x50cc8c++){if(_0x511cf6[_0x50cc8c][_0xbdcf('0x71')]in _0x32f026){contactItemTypes[_0xbdcf('0x1c')](_0x511cf6[_0x50cc8c]);delete _0x4ecc5d[_0x511cf6[_0x50cc8c]['name']];hasAdditionalPhones=!![];}for(var _0x563729 in _0x32f026){if(_0x511cf6[_0x50cc8c]['name']+_0xbdcf('0x72')===_0x563729){phoneDescriptions[_0xbdcf('0x1c')]({'itemTypeId':_0x511cf6[_0x50cc8c]['id'],'description':_0x563729});delete _0x4ecc5d[_0x563729];}}}if(hasAdditionalPhones)_0x4ecc5d['AdditionalPhones']='';var _0x276b4e=_[_0xbdcf('0x50')](_0x4ecc5d)[_0xbdcf('0x37')]();logger['info'](_0xbdcf('0x70'),_0x276b4e);fs[_0xbdcf('0x73')](_0x526e0c,_0x276b4e+'\x0a');Papa['parse'](fs[_0xbdcf('0x74')](_0x4e6ccf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34897b,_0x5e3e31){try{for(var _0x2aef42=0x0,_0x6004f0=[];_0x2aef42<_0x34897b[_0xbdcf('0x75')]['length'];_0x2aef42++){stats[_0xbdcf('0x76')]+=0x1;if(_0x34897b['errors'][_0x2aef42]){handleError(_0x34897b[_0xbdcf('0x75')][_0x2aef42],_0x34897b[_0xbdcf('0x77')][_0x2aef42]);}else{var _0x52e7ee=[];var _0x292a1d=[];var _0x18399e={};for(var _0x3e5c33 in _0x32f026){let _0x1474b2=contactItemTypes[_0xbdcf('0x78')](_0x43a8c=>_0x43a8c[_0xbdcf('0x71')]===_0x3e5c33);let _0x3169a4=contactItemTypes[_0xbdcf('0x78')](_0x107af0=>_0x107af0[_0xbdcf('0x71')]+_0xbdcf('0x72')===_0x3e5c33);if(_[_0xbdcf('0x20')](_0x1474b2)&&_['isNil'](_0x3169a4)){if(_0x32f026[_0xbdcf('0x79')](_0x3e5c33)){if(_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]]){var _0x1d633=_['trim'](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]][_0xbdcf('0x7a')](/"/g,'\x27'));switch(_0x3e5c33){case'scheduledat':var _0x75e5c2=moment(_0x1d633,_0xbdcf('0x10'),!![]);if(_0x75e5c2[_0xbdcf('0x7b')]()){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x7c'));}break;case _0xbdcf('0x48'):var _0x1af364=parseInt(_0x1d633);_0x1d633=_[_0xbdcf('0x7d')](_0x1af364)||_0x1af364<0x0||_0x1af364>0x4?_0x506ae6?0x3:0x2:_0x1af364;_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');break;case _0xbdcf('0x34'):var _0x513511=parseInt(_0x1d633);if(_[_0xbdcf('0x7e')](_0x513511)&&_[_0xbdcf('0x7f')](_0x184ec0,_0x513511)){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x513511+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x80'));}break;case _0xbdcf('0x81'):if(isEmail(_0x1d633)){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x82'));}break;case _0xbdcf('0x83'):var _0x106e88=moment(_0x1d633,_0xbdcf('0x84'),!![]);if(_0x106e88[_0xbdcf('0x7b')]()){_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}else{_0x52e7ee[_0xbdcf('0x1c')](_0xbdcf('0x85'));}break;case _0xbdcf('0x65'):var _0x5e7b8e=shared['timezones'];var _0x5f165e=_0x5e7b8e[_0x1d633];if(!_[_0xbdcf('0x20')](_0x5f165e)){var _0xad4d7d=_0x5f165e['utcOffset'];_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0xad4d7d+'\x22');}break;default:_0x6004f0[_0xbdcf('0x1c')]('\x22'+_0x1d633+'\x22');}}else{switch(_0x3e5c33){case _0xbdcf('0x86'):case'phone':_0x52e7ee[_0xbdcf('0x1c')](_0x3e5c33+_0xbdcf('0x87'));break;default:_0x6004f0['push']('\x22\x22');}}}}else{var _0x453eaa='';if(!_[_0xbdcf('0x20')](_0x1474b2)){if(!_0x18399e['hasOwnProperty'](_0x1474b2['id'])){if(!_[_0xbdcf('0x20')](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x3e5c33]])){var _0x1d633=_[_0xbdcf('0x88')](_0x34897b['data'][_0x2aef42][_0x32f026[_0x3e5c33]][_0xbdcf('0x7a')](/"/g,'\x27'));var _0x4f0f15=phoneDescriptions[_0xbdcf('0x78')](_0x17c83d=>_0x17c83d['itemTypeId']===_0x1474b2['id']);if(!_[_0xbdcf('0x20')](_0x4f0f15)){var _0x14f435=_[_0xbdcf('0x88')](_0x34897b[_0xbdcf('0x75')][_0x2aef42][_0x32f026[_0x4f0f15['description']]][_0xbdcf('0x7a')](/"/g,'\x27'));if(!_[_0xbdcf('0x20')](_0x14f435))_0x1d633=_0x1d633+'§'+_0x14f435;}if(_0x453eaa=='')_0x453eaa=_0x1d633;else _0x453eaa+='|'+_0x1d633;}_0x292a1d['push'](_0x1474b2['id']+':'+_0x453eaa);_0x18399e[_0x1474b2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x6004f0['push']('\x22'+_0x292a1d['join'](';')+'\x22');}if(_0x52e7ee[_0xbdcf('0x1e')]){handleError(_0x34897b['data'][_0x2aef42],{'code':_0xbdcf('0x89'),'message':_0x52e7ee[_0xbdcf('0x37')]()});}else{fs['appendFileSync'](_0x526e0c,_0x6004f0['join']()+'\x0a');}_0x6004f0=[];}if(!(stats[_0xbdcf('0x76')]%0xc8)){socket['emit'](_0xbdcf('0x8a')+_0x4c2895,stats);stats['errors']=[];}}if(stopped){logger[_0xbdcf('0x55')](_0xbdcf('0x8b'));_0x5e3e31[_0xbdcf('0x8c')]();}}catch(_0x2c8c16){handleError(_0x34897b[_0xbdcf('0x75')][_0x2aef42],{'code':_0xbdcf('0x8d'),'message':_0x2c8c16['message']});logger[_0xbdcf('0x5a')](_0xbdcf('0x8e'),_0x2c8c16[_0xbdcf('0x56')]);}},'complete':function(){try{var _0x220b9f=[];var _0x26e9e2=[];var _0x336e47=_0xbdcf('0x38');if(_0x447cc3[_0xbdcf('0x8f')]&&_0x447cc3[_0xbdcf('0x8f')][_0xbdcf('0x1e')]){_0x336e47=_0xbdcf('0x90')+_0x4c2895;_0x220b9f['push'](_0xbdcf('0x91')+_0x336e47+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xbdcf('0x92')+_0x4c2895;tmp_voice_queues=_0xbdcf('0x93')+_0x4c2895;_0x26e9e2[_0xbdcf('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x26e9e2[_0xbdcf('0x1c')](_0xbdcf('0x91')+tmp_voice_queues+_0xbdcf('0x94'));BPromise[_0xbdcf('0x95')](_0x26e9e2,handleTZQuery)[_0xbdcf('0x1b')](function(_0x290e56){updateTzCampaigns(_0x447cc3[_0xbdcf('0x31')])['then'](function(_0x1241c9){updateTzVoiceQueues(_0x447cc3[_0xbdcf('0x31')])[_0xbdcf('0x1b')](function(_0x210168){if(hasTZ)_0x276b4e=_0x276b4e[_0xbdcf('0x7a')](_0xbdcf('0x65'),_0xbdcf('0x96'));var _0x5538fe=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x526e0c,_0x336e47,_0x276b4e,_0x447cc3['ListId'],_0x447cc3['CompanyId']||null,NOW,NOW);if(_[_0xbdcf('0x20')](_0x32f026[_0xbdcf('0x47')])){_0x5538fe+=_0xbdcf('0x97');}_0x220b9f[_0xbdcf('0x1c')](_0x5538fe);if(_0x447cc3[_0xbdcf('0x8f')]&&_0x447cc3[_0xbdcf('0x8f')][_0xbdcf('0x1e')]){_0x220b9f[_0xbdcf('0x1c')](insertCmContact(_0x447cc3[_0xbdcf('0x31')],_0x336e47,_0x447cc3[_0xbdcf('0x8f')],_0x32f026));_0x220b9f[_0xbdcf('0x1c')](_0xbdcf('0x98')+_0x336e47+';');}BPromise[_0xbdcf('0x95')](_0x220b9f,handleQuery)[_0xbdcf('0x1b')](function(_0x2c185c){BPromise[_0xbdcf('0x1d')]([handleAdditionalPhones()])[_0xbdcf('0x1b')](function(){_0x220b9f=[];for(var _0x1852cb=0x0;_0x1852cb\x20\x20');}var _0x221502=path[_0xbdcf('0x37')](config[_0xbdcf('0xa7')],_0xbdcf('0x6e'),process[_0xbdcf('0xa6')][0x2]);if(!fs[_0xbdcf('0xa8')](_0x221502)){throw new Error(_0xbdcf('0xa9'));}var _0x25983e={};try{_0x25983e=JSON[_0xbdcf('0xaa')](process['argv'][0x3]);if(!_0x25983e[_0xbdcf('0x6d')]){throw new Error(_0xbdcf('0xab'));}if(!_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x13')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x86')]){throw new Error(_0xbdcf('0xac'));}var _0x3baf7b=0x0;if(_0x25983e[_0xbdcf('0x6d')][_0xbdcf('0x34')]){_0x3baf7b=0x1;}if(!_0x25983e[_0xbdcf('0x31')]){throw new Error(_0xbdcf('0xad'));}}catch(_0x3c0619){throw new Error(_0xbdcf('0xae'));}var _0x3da068=[];try{_0x3da068=_[_0xbdcf('0xaf')](JSON[_0xbdcf('0xaa')](process['argv'][0x4]),'id');}catch(_0x7a6fb2){logger[_0xbdcf('0x55')](_0xbdcf('0xb0'));}main(_0x221502,_0x25983e,_0x3da068,_0x3baf7b);}validate();process['on'](_0xbdcf('0xb1'),handleStop);process['on'](_0xbdcf('0xb2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 901ff37..5e0d757 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5276=['agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','find','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','message','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','from','join','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','fromQuery','ListId','fields','cm_contacts','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.updatedAt','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','findAll','name','_description','keys','header','createReadStream','data','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5276,0x163));var _0x6527=function(_0x327d91,_0x11a3f5){_0x327d91=_0x327d91-0x0;var _0x420559=_0x5276[_0x327d91];return _0x420559;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x6527('0x0'));var util=require(_0x6527('0x1'));var BPromise=require(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var squel=require(_0x6527('0x4'));var Redis=require(_0x6527('0x5'));var db=require(_0x6527('0x6'))['db'];var config=require(_0x6527('0x7'));var logger=require(_0x6527('0x8'))(_0x6527('0x9'));config[_0x6527('0xa')]=_[_0x6527('0xb')](config[_0x6527('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6527('0xc'))(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()[_0x6527('0xd')](_0x6527('0xe'));var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x523ce2){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))*$/[_0x6527('0xf')](_0x523ce2);}function selectNotIn(_0x1169a4,_0x270ecb,_0x39afb6,_0x5df67b,_0x4a106b){return squel[_0x6527('0x10')]()[_0x6527('0x11')](_0x6527('0x12'))['from'](_0x5df67b)['join'](_0x270ecb,null,_0x270ecb+'.id\x20=\x20'+_0x5df67b+'.'+_0x39afb6)[_0x6527('0x13')](_0x5df67b+'.'+_0x39afb6+_0x6527('0x14')+_0x1169a4+'.'+_0x39afb6)['where'](_0x270ecb+_0x6527('0x15')+_0x4a106b['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3b56ee,_0x2bd94d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6527('0x16')][_0x6527('0x17')](_0x6527('0x18')+tempTableName)[_0x6527('0x19')](function(_0x495c14){if(_0x495c14!==null){var _0x3dd2cd=[];for(var _0x52a5d3=0x0;_0x52a5d3<_0x495c14[_0x6527('0x1a')];_0x52a5d3++){var _0x40eab1=_0x495c14[_0x52a5d3];if(!_[_0x6527('0x1b')](_0x40eab1[_0x6527('0x12')])){if(!_['isNil'](_0x40eab1[_0x6527('0x1c')]))_0x3dd2cd[_0x6527('0x1d')](insertAdditionalPhones(_0x40eab1));promisesContact[_0x6527('0x1d')]({'contact':_0x40eab1});}}}Promise[_0x6527('0x1e')](_0x3dd2cd)[_0x6527('0x1f')](function(){_0x3b56ee({'val':0x1});});})['catch'](function(_0x4b9a09){logger[_0x6527('0x20')](_0x4b9a09[_0x6527('0x21')]);});});}function insertAdditionalPhones(_0x7af757){return new Promise(function(_0x20ef21,_0x3352e4){var _0x1850a8=_0x7af757[_0x6527('0x1c')];if(_[_0x6527('0x1b')](_0x1850a8))_0x3352e4({'val':0x0});else{var _0xf61204=_0x1850a8[_0x6527('0x22')](';');var _0xa731f8=[];orderBy=0x0;for(var _0x2e7450=0x0;_0x2e7450<_0xf61204['length'];_0x2e7450++){_0xa731f8[_0x6527('0x1d')](splitAdditionalPhone(_0x7af757['id'],_0xf61204[_0x2e7450]));}Promise[_0x6527('0x1e')](_0xa731f8)['then'](function(){_0x20ef21({'val':_0xf61204[_0x6527('0x1a')]});});}});}function splitAdditionalPhone(_0x188c3a,_0x5986ac){return new Promise(function(_0x623d35,_0x2b1294){var _0x3c247c=_0x5986ac[_0x6527('0x22')](':');var _0x2a3383=_0x3c247c[0x0];var _0x553537=_0x3c247c[0x1];if(_0x553537!==''){var _0x1375d7=_0x553537[_0x6527('0x22')]('|');var _0x2bd14c=[];for(var _0x3141fe=0x0;_0x3141fe<_0x1375d7['length'];_0x3141fe++){if(_0x1375d7[_0x3141fe]!==''){var _0xcc7305=_['filter'](promisesAdditionalPhones,{'contactId':_0x188c3a,'phone':_0x1375d7[_0x3141fe]});if(_0xcc7305['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6527('0x1d')]({'contactId':_0x188c3a,'contactTypeId':_0x2a3383,'phone':_0x1375d7[_0x3141fe],'orderBy':orderBy});}}}_0x623d35({'ok':0x1});}else _0x623d35({'res':0x0});});}function createAdditionalPhone(_0x38b8be,_0x3130e6,_0x4e3616,_0x224b6e){var _0x3c2b06='';var _0x44b154='';var _0xc2cbad=_0x4e3616[_0x6527('0x22')]('§');_0x3c2b06=_0xc2cbad[0x0];if(_0xc2cbad[_0x6527('0x1a')]==0x2)_0x44b154=_0xc2cbad[0x1];return new Promise(function(_0x5b5833,_0x25b08b){return db[_0x6527('0x23')][_0x6527('0x24')]({'where':{'CmContactId':_0x38b8be,'item':_0x3c2b06}})[_0x6527('0x1f')](function(_0x99997a){if(_0x99997a){return db['CmContactHasItem'][_0x6527('0x25')]({'ItemTypeId':_0x3130e6,'description':_0x44b154,'OrderBy':_0x224b6e},{'where':{'CmContactId':_0x38b8be,'item':_0x3c2b06}})[_0x6527('0x1f')](function(_0x4c1f00){_0x5b5833({'res':_0x6527('0x26')});});}else{return db[_0x6527('0x23')][_0x6527('0x27')]({'CmContactId':_0x38b8be,'item':_0x3c2b06,'ItemTypeId':_0x3130e6,'description':_0x44b154,'OrderBy':_0x224b6e,'ItemClass':_0x6527('0x28')})[_0x6527('0x1f')](function(_0x116937){_0x5b5833({'res':_0x6527('0x29')});});}});});}function updateContact(_0x243777){return new Promise(function(_0x3211d3,_0x49763f){var _0x2c506d=_0x243777['id'];delete _0x243777['id'];return db[_0x6527('0x2a')][_0x6527('0x25')](_0x243777,{'where':{'id':_0x2c506d}})[_0x6527('0x1f')](function(_0x5b2add){updatedRows+=0x1;return db['CmHopper'][_0x6527('0x25')]({'phone':_0x243777['phone']},{'where':{'ContactId':_0x2c506d}})[_0x6527('0x1f')](function(_0x4c68fe){_0x3211d3({'ret':'OK'});});});});}function insertCmHopper(_0x5d59d3,_0x42c26a,_0x463305,_0x4c1b74,_0x318d05){var _0x230f85=[_0x6527('0x2b'),_0x6527('0x2c'),_0x6527('0x2d'),_0x6527('0x2e'),_0x42c26a+'.'+_0x4c1b74,_0x6527('0x2f'),_0x6527('0x30'),_0x6527('0x31'),_0x6527('0x32'),'\x22'+_0x318d05+'\x22'];return squel['insert']()[_0x6527('0x33')](_0x6527('0x34'))['fromQuery']([_0x6527('0x12'),_0x6527('0x35'),_0x6527('0x36'),'ListId',_0x4c1b74,_0x6527('0x37'),_0x6527('0x38'),_0x6527('0x39'),_0x6527('0x3a'),'recallme'],squel['select']()['fields'](_0x230f85)[_0x6527('0x3b')](_0x42c26a)[_0x6527('0x3c')]('cm_contacts',null,_0x6527('0x3d')+_0x42c26a+_0x6527('0x3e'))[_0x6527('0x3c')](_0x463305,null,_0x463305+_0x6527('0x3f')+_0x42c26a+'.'+_0x4c1b74)['where'](_0x42c26a+_0x6527('0x40'),_0x5d59d3)['where'](_0x6527('0x41'),NOW)[_0x6527('0x13')](_0x6527('0x42'),selectNotIn(_0x42c26a,_0x463305,_0x4c1b74,_0x6527('0x34'),[_0x6527('0x43'),_0x6527('0x44')]))[_0x6527('0x13')](_0x6527('0x42'),selectNotIn(_0x42c26a,_0x463305,_0x4c1b74,_0x6527('0x34'),[_0x6527('0x43')])))[_0x6527('0x45')]();}function insertCmHopperBlack(_0x14347c,_0x452c09,_0x33aa84,_0xa904a0){var _0x21a9f9=[_0x6527('0x2b'),_0x6527('0x2d'),_0x6527('0x2e'),_0x452c09+'.'+_0xa904a0,_0x6527('0x2f'),'cm_contacts.updatedAt'];return squel[_0x6527('0x46')]()[_0x6527('0x33')](_0x6527('0x47'))[_0x6527('0x48')]([_0x6527('0x12'),_0x6527('0x36'),_0x6527('0x49'),_0xa904a0,_0x6527('0x37'),_0x6527('0x38')],squel[_0x6527('0x10')]()[_0x6527('0x4a')](_0x21a9f9)[_0x6527('0x3b')](_0x452c09)[_0x6527('0x3c')](_0x6527('0x4b'),null,'cm_contacts.ListId\x20=\x20'+_0x452c09+'.CmListId')[_0x6527('0x3c')](_0x33aa84,null,_0x33aa84+_0x6527('0x3f')+_0x452c09+'.'+_0xa904a0)[_0x6527('0x13')](_0x452c09+_0x6527('0x40'),_0x14347c)['where'](_0x6527('0x41'),NOW)['where'](_0x6527('0x42'),squel[_0x6527('0x10')]()[_0x6527('0x11')]('phone')['from'](_0x6527('0x47'))[_0x6527('0x13')](_0x6527('0x4c'),_0x14347c)[_0x6527('0x13')](_0xa904a0+_0x6527('0x4d'),_0x452c09+'.'+_0xa904a0)))['toString']();}function insertCmHopperAdditionalPhones(_0x5ac848){var _0x5665a0=['cm_hopper.id',_0x6527('0x4e'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x6527('0x4f')];return squel[_0x6527('0x46')]()['into']('cm_hopper_additional_phones')[_0x6527('0x48')](['CmHopperId',_0x6527('0x12'),_0x6527('0x50'),_0x6527('0x37'),_0x6527('0x38')],squel[_0x6527('0x10')]()[_0x6527('0x4a')](_0x5665a0)[_0x6527('0x3b')](_0x6527('0x34'))[_0x6527('0x3c')](_0x6527('0x4b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6527('0x3c')](_0x6527('0x51'),null,_0x6527('0x52'))['where'](_0x6527('0x53'),_0x5ac848)[_0x6527('0x13')](_0x6527('0x41'),NOW))[_0x6527('0x45')]();}function insertCmContact(_0x113d33,_0x5162f8,_0x2159df,_0x3cb5c0){var _0x5e6cda=_['concat'](_['keys'](_0x3cb5c0),[_0x6527('0x49'),'CompanyId',_0x6527('0x37'),_0x6527('0x38')]);return squel['insert']()[_0x6527('0x33')](_0x6527('0x4b'))[_0x6527('0x48')](_0x5e6cda,squel['select']()['fields'](_0x5e6cda)[_0x6527('0x3b')](_0x5162f8)[_0x6527('0x13')]('('+_0x2159df[_0x6527('0x3c')](',')+_0x6527('0x54'),squel['select']()['fields'](_0x2159df)[_0x6527('0x3b')](_0x6527('0x4b'))[_0x6527('0x13')](_0x6527('0x4c'),_0x113d33))[_0x6527('0x13')](_0x6527('0x55'),squel[_0x6527('0x10')]()['field'](_0x6527('0x56'),_0x6527('0x57'))[_0x6527('0x3b')](_0x5162f8)[_0x6527('0x58')](_0x2159df['join'](','))))[_0x6527('0x45')]();}function handleStop(){logger[_0x6527('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x37226d){logger[_0x6527('0x20')](_0x37226d[_0x6527('0x21')]);process[_0x6527('0x5a')](0x1);}function handleError(_0x366110,_0x3d325a){stats[_0x6527('0x5b')][_0x6527('0x1d')]({'name':_0x3d325a[_0x6527('0x5c')],'message':_0x3d325a['message'],'row':_0x366110});}function handleQuery(_0x1d15f4){logger[_0x6527('0x59')](_0x1d15f4);return db[_0x6527('0x16')][_0x6527('0x17')](_0x1d15f4)[_0x6527('0x19')](function(_0x82ade1){results['push'](_0x82ade1);})[_0x6527('0x5d')](function(_0xb1845d){logger[_0x6527('0x20')](_0xb1845d[_0x6527('0x21')]);});}function main(_0x2ac14e,_0x38f87b,_0x5d8206,_0x1af5ec){logger[_0x6527('0x59')]('main',_0x2ac14e,JSON[_0x6527('0x5e')](_0x38f87b));process[_0x6527('0x5f')](_0x6527('0x60'));var _0x506305=_0x38f87b['binding'];var _0x46354a=_['clone'](_0x506305);var _0x1e81ff=_0x38f87b[_0x6527('0x61')];var _0x5814e1=path['join'](config[_0x6527('0x62')],_0x6527('0x63'),_0x1e81ff+_0x6527('0x64'));logger[_0x6527('0x59')]('body',_0x38f87b);db['ContactItemType'][_0x6527('0x65')]({'raw':!![],'attributes':['id',_0x6527('0x66')]})[_0x6527('0x1f')](function(_0x4e6a81){for(var _0x2f4684=0x0;_0x2f4684<_0x4e6a81[_0x6527('0x1a')];_0x2f4684++){if(_0x4e6a81[_0x2f4684]['name']in _0x506305){contactItemTypes[_0x6527('0x1d')](_0x4e6a81[_0x2f4684]);delete _0x46354a[_0x4e6a81[_0x2f4684][_0x6527('0x66')]];hasAdditionalPhones=!![];}for(var _0x7f96cf in _0x506305){if(_0x4e6a81[_0x2f4684][_0x6527('0x66')]+_0x6527('0x67')===_0x7f96cf){phoneDescriptions[_0x6527('0x1d')]({'itemTypeId':_0x4e6a81[_0x2f4684]['id'],'description':_0x7f96cf});delete _0x46354a[_0x7f96cf];}}}if(hasAdditionalPhones)_0x46354a['AdditionalPhones']='';var _0x431949=_[_0x6527('0x68')](_0x46354a)[_0x6527('0x3c')]();logger[_0x6527('0x59')](_0x6527('0x69'),_0x431949);fs['writeFileSync'](_0x5814e1,_0x431949+'\x0a');Papa['parse'](fs[_0x6527('0x6a')](_0x2ac14e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f1f1e,_0x5e7bc5){try{for(var _0x2a5613=0x0,_0x346cb7=[];_0x2a5613<_0x1f1f1e[_0x6527('0x6b')][_0x6527('0x1a')];_0x2a5613++){stats[_0x6527('0x6c')]+=0x1;if(_0x1f1f1e[_0x6527('0x5b')][_0x2a5613]){handleError(_0x1f1f1e[_0x6527('0x6b')][_0x2a5613],_0x1f1f1e[_0x6527('0x5b')][_0x2a5613]);}else{var _0x26b784=[];var _0x119aaa=[];var _0xd32215={};for(var _0x4e424e in _0x506305){let _0x49aa42=contactItemTypes['find'](_0x5681a7=>_0x5681a7[_0x6527('0x66')]===_0x4e424e);let _0x216080=contactItemTypes['find'](_0x21a71d=>_0x21a71d[_0x6527('0x66')]+_0x6527('0x67')===_0x4e424e);if(_[_0x6527('0x1b')](_0x49aa42)&&_[_0x6527('0x1b')](_0x216080)){if(_0x506305[_0x6527('0x6d')](_0x4e424e)){if(_0x1f1f1e[_0x6527('0x6b')][_0x2a5613][_0x506305[_0x4e424e]]){var _0x37bec2=_[_0x6527('0x6e')](_0x1f1f1e[_0x6527('0x6b')][_0x2a5613][_0x506305[_0x4e424e]][_0x6527('0x6f')](/"/g,'\x27'));switch(_0x4e424e){case _0x6527('0x35'):var _0x6a9fc0=moment(_0x37bec2,_0x6527('0xe'),!![]);if(_0x6a9fc0['isValid']()){_0x346cb7[_0x6527('0x1d')]('\x22'+_0x37bec2+'\x22');}else{_0x26b784[_0x6527('0x1d')](_0x6527('0x70'));}break;case _0x6527('0x39'):var _0x9e9b9b=parseInt(_0x37bec2);_0x37bec2=_[_0x6527('0x71')](_0x9e9b9b)||_0x9e9b9b<0x0||_0x9e9b9b>0x4?_0x1af5ec?0x3:0x2:_0x9e9b9b;_0x346cb7['push']('\x22'+_0x37bec2+'\x22');break;case _0x6527('0x3a'):var _0x56e162=parseInt(_0x37bec2);if(_[_0x6527('0x72')](_0x56e162)&&_[_0x6527('0x73')](_0x5d8206,_0x56e162)){_0x346cb7['push']('\x22'+_0x56e162+'\x22');}else{_0x26b784[_0x6527('0x1d')](_0x6527('0x74'));}break;case _0x6527('0x75'):if(isEmail(_0x37bec2)){_0x346cb7[_0x6527('0x1d')]('\x22'+_0x37bec2+'\x22');}else{_0x26b784[_0x6527('0x1d')](_0x6527('0x76'));}break;case _0x6527('0x77'):var _0x3927d0=moment(_0x37bec2,_0x6527('0x78'),!![]);if(_0x3927d0[_0x6527('0x79')]()){_0x346cb7[_0x6527('0x1d')]('\x22'+_0x37bec2+'\x22');}else{_0x26b784[_0x6527('0x1d')](_0x6527('0x7a'));}break;default:_0x346cb7[_0x6527('0x1d')]('\x22'+_0x37bec2+'\x22');}}else{switch(_0x4e424e){case _0x6527('0x7b'):case'phone':_0x26b784[_0x6527('0x1d')](_0x4e424e+'\x20not\x20specified');break;default:_0x346cb7['push']('\x22\x22');}}}}else{var _0x49b765='';if(!_[_0x6527('0x1b')](_0x49aa42)){if(!_0xd32215[_0x6527('0x6d')](_0x49aa42['id'])){for(var _0x2c5c78=0x0;_0x2c5c78<_0x506305[_0x4e424e][_0x6527('0x1a')];_0x2c5c78++){var _0x37bec2=_[_0x6527('0x6e')](_0x1f1f1e['data'][_0x2a5613][_0x506305[_0x4e424e][_0x2c5c78]][_0x6527('0x6f')](/"/g,'\x27'));var _0x1207f3=phoneDescriptions[_0x6527('0x7c')](_0x155856=>_0x155856[_0x6527('0x7d')]===_0x49aa42['id']);if(!_['isNil'](_0x1207f3)){var _0x50fe07=_[_0x6527('0x6e')](_0x1f1f1e['data'][_0x2a5613][_0x506305[_0x1207f3[_0x6527('0x7e')]][0x0]][_0x6527('0x6f')](/"/g,'\x27'));if(!_[_0x6527('0x1b')](_0x50fe07))_0x37bec2=_0x37bec2+'§'+_0x50fe07;}if(_0x49b765=='')_0x49b765=_0x37bec2;else _0x49b765+='|'+_0x37bec2;}_0x119aaa['push'](_0x49aa42['id']+':'+_0x49b765);_0xd32215[_0x49aa42['id']]=0x1;}}}}if(hasAdditionalPhones){_0x346cb7[_0x6527('0x1d')]('\x22'+_0x119aaa[_0x6527('0x3c')](';')+'\x22');}if(_0x26b784[_0x6527('0x1a')]){handleError(_0x1f1f1e['data'][_0x2a5613],{'code':_0x6527('0x7f'),'message':_0x26b784[_0x6527('0x3c')]()});}else{fs[_0x6527('0x80')](_0x5814e1,_0x346cb7[_0x6527('0x3c')]()+'\x0a');}_0x346cb7=[];}if(!(stats[_0x6527('0x6c')]%0xc8)){socket['emit'](_0x6527('0x81')+_0x1e81ff,stats);stats[_0x6527('0x5b')]=[];}}if(stopped){logger[_0x6527('0x59')](_0x6527('0x82'));_0x5e7bc5[_0x6527('0x83')]();}}catch(_0x403d03){handleError(_0x1f1f1e[_0x6527('0x6b')][_0x2a5613],{'code':'SystemError','message':_0x403d03[_0x6527('0x21')]});logger['error'](_0x6527('0x84'),_0x403d03[_0x6527('0x21')]);}},'complete':function(){try{var _0x2523af=[];var _0x51ba65=tempTableName;_0x2523af[_0x6527('0x1d')](_0x6527('0x85')+_0x51ba65+_0x6527('0x86'));logger[_0x6527('0x59')](_0x6527('0x87'),contactItemTypes[_0x6527('0x1a')]);var _0x1d5c96=util[_0x6527('0xd')](_0x6527('0x88'),_0x5814e1,_0x51ba65,_0x431949,_0x38f87b[_0x6527('0x49')],_0x38f87b[_0x6527('0x89')]||null,NOW,NOW);if(_[_0x6527('0x1b')](_0x506305[_0x6527('0x35')])){_0x1d5c96+=_0x6527('0x8a');}_0x2523af[_0x6527('0x1d')](_0x1d5c96);BPromise[_0x6527('0x8b')](_0x2523af,handleQuery)['then'](function(_0x57a192){BPromise[_0x6527('0x1e')]([handleAdditionalPhones()])[_0x6527('0x1f')](function(){_0x2523af=[];for(var _0x22ea22=0x0;_0x22ea22\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','create','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\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','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','cm_contacts','MIN(id)','min_id','group','Received\x20SIGINT','message','errors','code','info','spread','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','replace'];(function(_0x56f927,_0xdfcfa4){var _0x363231=function(_0x221598){while(--_0x221598){_0x56f927['push'](_0x56f927['shift']());}};_0x363231(++_0xdfcfa4);}(_0x5df3,0x15f));var _0x35df=function(_0x5d3306,_0x6e1379){_0x5d3306=_0x5d3306-0x0;var _0x6968f7=_0x5df3[_0x5d3306];return _0x6968f7;};'use strict';var fs=require('fs');var path=require(_0x35df('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x35df('0x1'));var BPromise=require(_0x35df('0x2'));var moment=require(_0x35df('0x3'));var squel=require(_0x35df('0x4'));var Redis=require(_0x35df('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x35df('0x6'))(_0x35df('0x7'));config[_0x35df('0x8')]=_['defaults'](config[_0x35df('0x8')],{'host':_0x35df('0x9'),'port':0x18eb});var socket=require(_0x35df('0xa'))(new Redis(config[_0x35df('0x8')]));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()[_0x35df('0xb')](_0x35df('0xc'));var tempTableName=_0x35df('0xd')+moment()[_0x35df('0xb')](_0x35df('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1654c5){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))*$/[_0x35df('0xf')](_0x1654c5);}function selectNotIn(_0x5f43e6,_0x4ad28f,_0x46efdd,_0x17ae6c,_0xaab2ea){return squel[_0x35df('0x10')]()[_0x35df('0x11')]('phone')[_0x35df('0x12')](_0x17ae6c)[_0x35df('0x13')](_0x4ad28f,null,_0x4ad28f+_0x35df('0x14')+_0x17ae6c+'.'+_0x46efdd)[_0x35df('0x15')](_0x17ae6c+'.'+_0x46efdd+_0x35df('0x16')+_0x5f43e6+'.'+_0x46efdd)[_0x35df('0x15')](_0x4ad28f+_0x35df('0x17')+_0xaab2ea[_0x35df('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x566c11,_0x321f32){promisesAdditionalPhones=[];promisesContact=[];return db[_0x35df('0x18')][_0x35df('0x19')](_0x35df('0x1a')+tempTableName)['spread'](function(_0x5228db){if(_0x5228db!==null){var _0x2e2d7a=[];for(var _0x232889=0x0;_0x232889<_0x5228db[_0x35df('0x1b')];_0x232889++){var _0x1a56b5=_0x5228db[_0x232889];if(!_[_0x35df('0x1c')](_0x1a56b5[_0x35df('0x1d')])){if(!_[_0x35df('0x1c')](_0x1a56b5[_0x35df('0x1e')]))_0x2e2d7a[_0x35df('0x1f')](insertAdditionalPhones(_0x1a56b5));promisesContact[_0x35df('0x1f')]({'contact':_0x1a56b5});}}}Promise[_0x35df('0x20')](_0x2e2d7a)[_0x35df('0x21')](function(){_0x566c11({'val':0x1});});})[_0x35df('0x22')](function(_0x5a445f){logger[_0x35df('0x23')](_0x5a445f['message']);});});}function insertAdditionalPhones(_0x4fd9c7){return new Promise(function(_0x3d7c4c,_0x5000cb){var _0x48727f=_0x4fd9c7[_0x35df('0x1e')];if(_[_0x35df('0x1c')](_0x48727f))_0x5000cb({'val':0x0});else{var _0x3c2dc2=_0x48727f[_0x35df('0x24')](';');var _0x47b575=[];orderBy=0x0;for(var _0x6c0ab0=0x0;_0x6c0ab0<_0x3c2dc2[_0x35df('0x1b')];_0x6c0ab0++){_0x47b575['push'](splitAdditionalPhone(_0x4fd9c7['id'],_0x3c2dc2[_0x6c0ab0]));}Promise[_0x35df('0x20')](_0x47b575)[_0x35df('0x21')](function(){_0x3d7c4c({'val':_0x3c2dc2[_0x35df('0x1b')]});});}});}function splitAdditionalPhone(_0x1546cb,_0x1c5f2a){return new Promise(function(_0x774389,_0x2d1009){var _0x37dd08=_0x1c5f2a[_0x35df('0x24')](':');var _0x24f173=_0x37dd08[0x0];var _0x15a8fd=_0x37dd08[0x1];if(_0x15a8fd!==''){var _0x713be5=_0x15a8fd[_0x35df('0x24')]('|');var _0x3875ae=[];for(var _0x7f9fe3=0x0;_0x7f9fe3<_0x713be5[_0x35df('0x1b')];_0x7f9fe3++){if(_0x713be5[_0x7f9fe3]!==''){var _0x5104f4=_[_0x35df('0x25')](promisesAdditionalPhones,{'contactId':_0x1546cb,'phone':_0x713be5[_0x7f9fe3]});if(_0x5104f4[_0x35df('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x35df('0x1f')]({'contactId':_0x1546cb,'contactTypeId':_0x24f173,'phone':_0x713be5[_0x7f9fe3],'orderBy':orderBy});}}}_0x774389({'ok':0x1});}else _0x774389({'res':0x0});});}function createAdditionalPhone(_0x492829,_0x399000,_0x510862,_0x2012d8){var _0xe285be='';var _0x27ce22='';var _0x553960=_0x510862[_0x35df('0x24')]('§');_0xe285be=_0x553960[0x0];if(_0x553960[_0x35df('0x1b')]==0x2)_0x27ce22=_0x553960[0x1];return new Promise(function(_0x230acf,_0x51cd66){return db[_0x35df('0x26')][_0x35df('0x27')]({'where':{'CmContactId':_0x492829,'item':_0xe285be}})[_0x35df('0x21')](function(_0x4a6673){if(_0x4a6673){return db[_0x35df('0x26')][_0x35df('0x28')]({'ItemTypeId':_0x399000,'description':_0x27ce22,'OrderBy':_0x2012d8},{'where':{'CmContactId':_0x492829,'item':_0xe285be}})[_0x35df('0x21')](function(_0x379040){_0x230acf({'res':_0x35df('0x29')});});}else{return db['CmContactHasItem'][_0x35df('0x2a')]({'CmContactId':_0x492829,'item':_0xe285be,'ItemTypeId':_0x399000,'description':_0x27ce22,'OrderBy':_0x2012d8,'ItemClass':'PHONE'})[_0x35df('0x21')](function(_0x74a9c2){_0x230acf({'res':'inserted'});});}});});}function updateContact(_0x1983df){return new Promise(function(_0x4dd48f,_0x4c204a){var _0x37d6c1=_0x1983df['id'];delete _0x1983df['id'];return db[_0x35df('0x2b')][_0x35df('0x28')](_0x1983df,{'where':{'id':_0x37d6c1}})[_0x35df('0x21')](function(_0x2426bb){updatedRows+=0x1;return db[_0x35df('0x2c')][_0x35df('0x28')]({'phone':_0x1983df[_0x35df('0x1d')]},{'where':{'ContactId':_0x37d6c1}})['then'](function(_0x32fd77){_0x4dd48f({'ret':'OK'});});});});}function insertCmHopper(_0x25c44b,_0x285cce,_0x4f10d1,_0x47e5f3,_0x2059ce){var _0x2d864e=[_0x35df('0x2d'),_0x35df('0x2e'),'cm_contacts.id',_0x35df('0x2f'),_0x285cce+'.'+_0x47e5f3,_0x35df('0x30'),'cm_contacts.updatedAt',_0x35df('0x31'),_0x35df('0x32'),'\x22'+_0x2059ce+'\x22'];return squel[_0x35df('0x33')]()[_0x35df('0x34')](_0x35df('0x35'))[_0x35df('0x36')]([_0x35df('0x1d'),'scheduledat',_0x35df('0x37'),_0x35df('0x38'),_0x47e5f3,'createdAt',_0x35df('0x39'),_0x35df('0x3a'),'UserId',_0x35df('0x3b')],squel['select']()[_0x35df('0x3c')](_0x2d864e)[_0x35df('0x12')](_0x285cce)[_0x35df('0x13')]('cm_contacts',null,_0x35df('0x3d')+_0x285cce+_0x35df('0x3e'))[_0x35df('0x13')](_0x4f10d1,null,_0x4f10d1+_0x35df('0x14')+_0x285cce+'.'+_0x47e5f3)['where'](_0x285cce+'.CmListId\x20=\x20?',_0x25c44b)[_0x35df('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x35df('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x285cce,_0x4f10d1,_0x47e5f3,_0x35df('0x35'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x35df('0x15')](_0x35df('0x3f'),selectNotIn(_0x285cce,_0x4f10d1,_0x47e5f3,_0x35df('0x35'),[_0x35df('0x40')])))[_0x35df('0x41')]();}function insertCmHopperBlack(_0x300cf6,_0x94d005,_0x260201,_0x206366){var _0x43bc57=[_0x35df('0x2d'),'cm_contacts.id','cm_contacts.ListId',_0x94d005+'.'+_0x206366,_0x35df('0x30'),_0x35df('0x42')];return squel[_0x35df('0x33')]()['into'](_0x35df('0x43'))[_0x35df('0x36')]([_0x35df('0x1d'),_0x35df('0x37'),_0x35df('0x38'),_0x206366,_0x35df('0x44'),_0x35df('0x39')],squel['select']()[_0x35df('0x3c')](_0x43bc57)[_0x35df('0x12')](_0x94d005)['join']('cm_contacts',null,_0x35df('0x3d')+_0x94d005+_0x35df('0x3e'))[_0x35df('0x13')](_0x260201,null,_0x260201+_0x35df('0x14')+_0x94d005+'.'+_0x206366)['where'](_0x94d005+'.CmListId\x20=\x20?',_0x300cf6)[_0x35df('0x15')](_0x35df('0x45'),NOW)[_0x35df('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x35df('0x10')]()[_0x35df('0x11')](_0x35df('0x1d'))['from'](_0x35df('0x43'))[_0x35df('0x15')](_0x35df('0x46'),_0x300cf6)[_0x35df('0x15')](_0x206366+_0x35df('0x47'),_0x94d005+'.'+_0x206366)))[_0x35df('0x41')]();}function insertCmHopperAdditionalPhones(_0x460307){var _0x45deac=[_0x35df('0x48'),_0x35df('0x49'),_0x35df('0x4a'),_0x35df('0x4b'),_0x35df('0x4c')];return squel[_0x35df('0x33')]()[_0x35df('0x34')]('cm_hopper_additional_phones')[_0x35df('0x36')]([_0x35df('0x4d'),'phone',_0x35df('0x4e'),'createdAt','updatedAt'],squel[_0x35df('0x10')]()[_0x35df('0x3c')](_0x45deac)[_0x35df('0x12')](_0x35df('0x35'))[_0x35df('0x13')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x35df('0x13')]('cm_contact_has_items',null,_0x35df('0x4f'))[_0x35df('0x15')](_0x35df('0x50'),_0x460307)[_0x35df('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x35df('0x41')]();}function insertCmContact(_0x10c8e9,_0x277ac6,_0x59727c,_0x554188){var _0x4936c0=_['concat'](_[_0x35df('0x51')](_0x554188),[_0x35df('0x38'),'CompanyId','createdAt',_0x35df('0x39')]);return squel[_0x35df('0x33')]()[_0x35df('0x34')](_0x35df('0x52'))[_0x35df('0x36')](_0x4936c0,squel['select']()[_0x35df('0x3c')](_0x4936c0)['from'](_0x277ac6)[_0x35df('0x15')]('('+_0x59727c[_0x35df('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x35df('0x10')]()[_0x35df('0x3c')](_0x59727c)[_0x35df('0x12')](_0x35df('0x52'))[_0x35df('0x15')](_0x35df('0x46'),_0x10c8e9))[_0x35df('0x15')]('id\x20IN\x20?',squel['select']()[_0x35df('0x11')](_0x35df('0x53'),_0x35df('0x54'))[_0x35df('0x12')](_0x277ac6)[_0x35df('0x55')](_0x59727c[_0x35df('0x13')](','))))[_0x35df('0x41')]();}function handleStop(){logger['info'](_0x35df('0x56'));stopped=!![];}function handleUncaughtException(_0x564ad4){logger[_0x35df('0x23')](_0x564ad4[_0x35df('0x57')]);process['exit'](0x1);}function handleError(_0x5a6160,_0x44397c){stats[_0x35df('0x58')]['push']({'name':_0x44397c[_0x35df('0x59')],'message':_0x44397c[_0x35df('0x57')],'row':_0x5a6160});}function handleQuery(_0x152b67){logger[_0x35df('0x5a')](_0x152b67);return db['sequelize'][_0x35df('0x19')](_0x152b67)[_0x35df('0x5b')](function(_0x249a49){results[_0x35df('0x1f')](_0x249a49);})[_0x35df('0x22')](function(_0x19c9d0){logger[_0x35df('0x23')](_0x19c9d0['message']);});}function main(_0x4078e4,_0x275ba2,_0x7cec0c,_0x15cb89){logger[_0x35df('0x5a')](_0x35df('0x5c'),_0x4078e4,JSON[_0x35df('0x5d')](_0x275ba2));process['send'](_0x35df('0x5e'));var _0x3b4305=_0x275ba2['binding'];var _0x4e2799=_[_0x35df('0x5f')](_0x3b4305);var _0x2a6c04=_0x275ba2[_0x35df('0x60')];var _0x1a9b23=path[_0x35df('0x13')](config[_0x35df('0x61')],_0x35df('0x62'),_0x2a6c04+_0x35df('0x63'));logger[_0x35df('0x5a')](_0x35df('0x64'),_0x275ba2);db[_0x35df('0x65')]['findAll']({'raw':!![],'attributes':['id',_0x35df('0x66')]})['then'](function(_0x39858c){for(var _0x5aacb5=0x0;_0x5aacb5<_0x39858c['length'];_0x5aacb5++){if(_0x39858c[_0x5aacb5][_0x35df('0x66')]in _0x3b4305){contactItemTypes[_0x35df('0x1f')](_0x39858c[_0x5aacb5]);delete _0x4e2799[_0x39858c[_0x5aacb5][_0x35df('0x66')]];hasAdditionalPhones=!![];}for(var _0x27ef1c in _0x3b4305){if(_0x39858c[_0x5aacb5]['name']+_0x35df('0x67')===_0x27ef1c){phoneDescriptions[_0x35df('0x1f')]({'itemTypeId':_0x39858c[_0x5aacb5]['id'],'description':_0x27ef1c});delete _0x4e2799[_0x27ef1c];}}}if(hasAdditionalPhones)_0x4e2799[_0x35df('0x1e')]='';var _0x36a8de=_[_0x35df('0x51')](_0x4e2799)['join']();logger[_0x35df('0x5a')](_0x35df('0x68'),_0x36a8de);fs[_0x35df('0x69')](_0x1a9b23,_0x36a8de+'\x0a');Papa[_0x35df('0x6a')](fs[_0x35df('0x6b')](_0x4078e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30c3d9,_0x2d2014){try{for(var _0x3d18e4=0x0,_0x59f3f1=[];_0x3d18e4<_0x30c3d9[_0x35df('0x6c')][_0x35df('0x1b')];_0x3d18e4++){stats[_0x35df('0x6d')]+=0x1;if(_0x30c3d9[_0x35df('0x58')][_0x3d18e4]){handleError(_0x30c3d9['data'][_0x3d18e4],_0x30c3d9['errors'][_0x3d18e4]);}else{var _0x59cec0=[];var _0x3477ba=[];var _0x3f166d={};for(var _0x553134 in _0x3b4305){let _0x1491c9=contactItemTypes[_0x35df('0x6e')](_0x3bf689=>_0x3bf689[_0x35df('0x66')]===_0x553134);let _0x5769fc=contactItemTypes[_0x35df('0x6e')](_0xc3ac15=>_0xc3ac15['name']+_0x35df('0x67')===_0x553134);if(_[_0x35df('0x1c')](_0x1491c9)&&_['isNil'](_0x5769fc)){if(_0x3b4305[_0x35df('0x6f')](_0x553134)){if(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4][_0x3b4305[_0x553134]]){var _0x182934=_[_0x35df('0x70')](_0x30c3d9[_0x35df('0x6c')][_0x3d18e4][_0x3b4305[_0x553134]]['replace'](/"/g,'\x27'));switch(_0x553134){case _0x35df('0x71'):var _0x10d6aa=moment(_0x182934,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x10d6aa[_0x35df('0x72')]()){_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');}else{_0x59cec0[_0x35df('0x1f')](_0x35df('0x73'));}break;case _0x35df('0x3a'):var _0x13ddf0=parseInt(_0x182934);_0x182934=_[_0x35df('0x74')](_0x13ddf0)||_0x13ddf0<0x0||_0x13ddf0>0x4?_0x15cb89?0x3:0x2:_0x13ddf0;_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');break;case _0x35df('0x75'):var _0xf80487=parseInt(_0x182934);if(_['isNumber'](_0xf80487)&&_[_0x35df('0x76')](_0x7cec0c,_0xf80487)){_0x59f3f1['push']('\x22'+_0xf80487+'\x22');}else{_0x59cec0['push'](_0x35df('0x77'));}break;case _0x35df('0x78'):if(isEmail(_0x182934)){_0x59f3f1['push']('\x22'+_0x182934+'\x22');}else{_0x59cec0['push']('email\x20wrong\x20format');}break;case _0x35df('0x79'):var _0x16190b=moment(_0x182934,_0x35df('0x7a'),!![]);if(_0x16190b[_0x35df('0x72')]()){_0x59f3f1['push']('\x22'+_0x182934+'\x22');}else{_0x59cec0['push'](_0x35df('0x7b'));}break;default:_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x182934+'\x22');}}else{switch(_0x553134){case _0x35df('0x7c'):case _0x35df('0x1d'):_0x59cec0[_0x35df('0x1f')](_0x553134+_0x35df('0x7d'));break;default:_0x59f3f1[_0x35df('0x1f')]('\x22\x22');}}}}else{var _0x5c0e95='';if(!_[_0x35df('0x1c')](_0x1491c9)){if(!_0x3f166d[_0x35df('0x6f')](_0x1491c9['id'])){for(var _0x37179a=0x0;_0x37179a<_0x3b4305[_0x553134][_0x35df('0x1b')];_0x37179a++){var _0x182934=_[_0x35df('0x70')](_0x30c3d9['data'][_0x3d18e4][_0x3b4305[_0x553134][_0x37179a]]['replace'](/"/g,'\x27'));var _0x4d9a1d=phoneDescriptions[_0x35df('0x6e')](_0x3fd908=>_0x3fd908[_0x35df('0x7e')]===_0x1491c9['id']);if(!_['isNil'](_0x4d9a1d)){var _0x15584c=_[_0x35df('0x70')](_0x30c3d9['data'][_0x3d18e4][_0x3b4305[_0x4d9a1d[_0x35df('0x7f')]][0x0]][_0x35df('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x15584c))_0x182934=_0x182934+'§'+_0x15584c;}if(_0x5c0e95=='')_0x5c0e95=_0x182934;else _0x5c0e95+='|'+_0x182934;}_0x3477ba[_0x35df('0x1f')](_0x1491c9['id']+':'+_0x5c0e95);_0x3f166d[_0x1491c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59f3f1[_0x35df('0x1f')]('\x22'+_0x3477ba[_0x35df('0x13')](';')+'\x22');}if(_0x59cec0[_0x35df('0x1b')]){handleError(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4],{'code':_0x35df('0x81'),'message':_0x59cec0[_0x35df('0x13')]()});}else{fs[_0x35df('0x82')](_0x1a9b23,_0x59f3f1[_0x35df('0x13')]()+'\x0a');}_0x59f3f1=[];}if(!(stats[_0x35df('0x6d')]%0xc8)){socket[_0x35df('0x83')](_0x35df('0x84')+_0x2a6c04,stats);stats[_0x35df('0x58')]=[];}}if(stopped){logger[_0x35df('0x5a')](_0x35df('0x85'));_0x2d2014[_0x35df('0x86')]();}}catch(_0x50f9c1){handleError(_0x30c3d9[_0x35df('0x6c')][_0x3d18e4],{'code':'SystemError','message':_0x50f9c1[_0x35df('0x57')]});logger['error'](_0x35df('0x87'),_0x50f9c1['message']);}},'complete':function(){try{var _0x3f7e52=[];var _0x4d2dc8=tempTableName;_0x3f7e52[_0x35df('0x1f')](_0x35df('0x88')+_0x4d2dc8+_0x35df('0x89'));logger[_0x35df('0x5a')](_0x35df('0x8a'),contactItemTypes['length']);var _0x205717=util[_0x35df('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1a9b23,_0x4d2dc8,_0x36a8de,_0x275ba2[_0x35df('0x38')],_0x275ba2[_0x35df('0x8b')]||null,NOW,NOW);if(_['isNil'](_0x3b4305[_0x35df('0x71')])){_0x205717+=',\x20scheduledAt\x20=\x20NOW()';}_0x3f7e52[_0x35df('0x1f')](_0x205717);BPromise[_0x35df('0x8c')](_0x3f7e52,handleQuery)[_0x35df('0x21')](function(_0x5cc6d6){BPromise[_0x35df('0x20')]([handleAdditionalPhones()])[_0x35df('0x21')](function(){_0x3f7e52=[];for(var _0x46e008=0x0;_0x46e008\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.attach','i.lastMsgAt','i.subject','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','field','name','color','from','tools_tags','user_has_','select','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','map','getInteractionFK','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','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'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8c51,0x10b));var _0x18c5=function(_0x150dfb,_0xcb9836){_0x150dfb=_0x150dfb-0x0;var _0x2f7814=_0x8c51[_0x150dfb];return _0x2f7814;};'use strict';var _=require(_0x18c5('0x0'));var squel=require(_0x18c5('0x1'));var as=require(_0x18c5('0x2'));var qs=require(_0x18c5('0x3'));var updateInteraction=require(_0x18c5('0x4'))['updateInteraction'];var utils=require(_0x18c5('0x5'));var db=require(_0x18c5('0x6'))['db'];function skipInteractionsQuery(_0x8a0394,_0x93f155,_0x1d4ced){var _0xf2c8a2=![];var _0x315b3a=utils[_0x18c5('0x7')](_0x8a0394);if(_0x93f155[_0x18c5('0x8')]===_0x18c5('0x9')&&!_0x1d4ced[_0x18c5('0xa')]&&!_0x1d4ced[_0x315b3a]){_0xf2c8a2=!![];}return _0xf2c8a2;}function getTagsQuery(){return squel['select']()[_0x18c5('0xb')]('id')[_0x18c5('0xb')](_0x18c5('0xc'))[_0x18c5('0xb')](_0x18c5('0xd'))[_0x18c5('0xe')](_0x18c5('0xf'));}function getUsersQuery(_0x2795a4,_0x3e5e7e){var _0x5e11ec=utils['getInteractionFK'](_0x2795a4);var _0x2fa566=_0x18c5('0x10')+_0x2795a4+'_interactions';var _0x553783=squel[_0x18c5('0x11')]()[_0x18c5('0xb')]('u.id')['field'](_0x18c5('0x12'))[_0x18c5('0xb')](_0x18c5('0x13')+_0x5e11ec)[_0x18c5('0xe')](_0x2fa566,'ui')[_0x18c5('0x14')]('users','u',_0x18c5('0x15'));if(_0x3e5e7e[_0x18c5('0x16')]>0x0){_0x553783[_0x18c5('0x17')](_0x18c5('0x13')+_0x5e11ec+'\x20IN\x20?',_[_0x18c5('0x18')](_0x3e5e7e,'id'));}return _0x553783;}function getInteractionsQuery(_0xd4940d){var _0x3437c5=utils['getInteractionsTables'](_0xd4940d);var _0x5c1bbb=utils['getAccountFK'](_0xd4940d);var _0x571d08=utils[_0x18c5('0x19')](_0xd4940d);return squel[_0x18c5('0x11')]()['from'](_0x3437c5['interactions'],'i')[_0x18c5('0x14')](_0x18c5('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x18c5('0x1b'),'o',_0x18c5('0x1c'))[_0x18c5('0x14')](_0x3437c5[_0x18c5('0x1d')],'a','a.id\x20=\x20i.'+_0x5c1bbb)[_0x18c5('0x14')](_0x3437c5['messages'],'me','me.'+_0x571d08+_0x18c5('0x1e'))[_0x18c5('0x14')](_0x3437c5[_0x18c5('0x1f')],'it',_0x18c5('0x20')+_0x571d08+'\x20=\x20i.id')[_0x18c5('0x14')](_0x18c5('0xf'),'t',_0x18c5('0x21'));}function getSqlClauses(){var _0x1788ef={'body':squel[_0x18c5('0x22')](),'contact':squel[_0x18c5('0x22')](),'default':squel[_0x18c5('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x18c5('0x22')]()};return _0x1788ef;}function parseTagParameter(_0x40b03b){var _0x1abb80=squel[_0x18c5('0x22')]();if(_0x40b03b){var _0x3f1d00=utils[_0x18c5('0x23')](_0x40b03b);_0x3f1d00[_0x18c5('0x24')](function(_0x21f545){_0x1abb80['or'](_0x18c5('0x25'),'%,'+_0x21f545+',%');});}return _0x1abb80;}function parseReadParameter(_0x54182a){var _0xd34e37='';if(_0x54182a){_0xd34e37='unreadMessages\x20{OPERATOR}\x200';if(_0x54182a==='1'){_0xd34e37=_0xd34e37['replace'](_0x18c5('0x26'),'=');}else{_0xd34e37=_0xd34e37['replace'](_0x18c5('0x26'),'>');}}return _0xd34e37;}function parseSearchFilter(_0xd139,_0x55de3c){var _0x29bb08=squel[_0x18c5('0x22')]();if(_0x55de3c){var _0x1afadb=_0x55de3c[_0x18c5('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x5c1152=qs[_0x18c5('0x28')](_0x1afadb);if(qs[_0x18c5('0x29')](_0x1afadb)){_0x29bb08['or'](_0x18c5('0x2a'),_0x5c1152+'%');if(['sms',_0x18c5('0x2b')][_0x18c5('0x2c')](_0xd139)){_0x29bb08['or']('i.phone\x20LIKE\x20?',_0x5c1152+'%');}else if(_0xd139===_0x18c5('0x2d')){_0x29bb08['or']('i.fax\x20LIKE\x20?',_0x5c1152+'%');}else if(_0xd139===_0x18c5('0x2e')){_0x29bb08['or'](_0x18c5('0x2f'),_0x5c1152+'%');}}else if(_0xd139===_0x18c5('0x30')&&qs[_0x18c5('0x31')](_0x1afadb)){_0x29bb08['or'](_0x18c5('0x32'),_0x5c1152+'%');}else{if(_0xd139==='mail'){_0x29bb08['or'](_0x18c5('0x33'),qs[_0x18c5('0x34')](_0x1afadb,!![]))['or'](_0x18c5('0x35'),qs[_0x18c5('0x34')](_0x1afadb));}else if(_0xd139!==_0x18c5('0x2d')){_0x29bb08['or'](_0x18c5('0x36'),qs[_0x18c5('0x34')](_0x1afadb));}_0x29bb08['or'](_0x18c5('0x37'),qs[_0x18c5('0x34')](_0x1afadb,!![]),null);}}return _0x29bb08;}function parseAdvancedSearchFilter(_0x460c84,_0x3a3fa3){var _0x5f1328=getSqlClauses();var _0x3fbeb7=as[_0x18c5('0x38')](_0x460c84);var _0x49499e=_0x3fbeb7[_0x18c5('0x39')];for(var _0x1b5065=0x0;_0x1b5065<_0x3fbeb7[_0x18c5('0x3a')][_0x18c5('0x16')];_0x1b5065++){var _0x5caeed=_0x3fbeb7[_0x18c5('0x3a')][_0x1b5065];var _0x50ba32='i';var _0x389f73=_[_0x18c5('0x3b')](_0x3a3fa3,['name',_0x5caeed['field']]);if(_0x389f73){var _0x54f17e=as[_0x18c5('0x3c')](_0x50ba32,_0x389f73['type'],_0x5caeed);_0x5f1328[_0x18c5('0x3d')][_0x49499e](_0x54f17e['text'],_0x54f17e[_0x18c5('0x3e')][_0x18c5('0x3f')],_0x54f17e[_0x18c5('0x3e')]['end']);}else{switch(_0x5caeed['field']){case _0x18c5('0x40'):var _0x119628=parseReadParameter(_0x5caeed['value']);_0x5f1328[_0x18c5('0x41')][_0x18c5('0x42')](_0x119628);break;case _0x18c5('0x43'):if(_0x5caeed[_0x18c5('0x44')]===_0x18c5('0x45')){if(_0x5caeed['value']['split']('\x20')[_0x18c5('0x16')]>0x1){_0x5f1328['contact'][_0x49499e](_0x18c5('0x37'),qs['getFullTextValue'](_0x5caeed[_0x18c5('0x3e')],!![]),null);}else{var _0x10f6d6='%'+_0x5caeed[_0x18c5('0x3e')]+'%';_0x5f1328['contact'][_0x49499e](_0x18c5('0x46'),_0x10f6d6,_0x10f6d6,_0x10f6d6);}}else{_0x389f73=_[_0x18c5('0x3b')](_0x3a3fa3,[_0x18c5('0xc'),'ContactId']);_0x5caeed['field']='ContactId';_0x54f17e=as[_0x18c5('0x3c')](_0x50ba32,_0x389f73[_0x18c5('0x47')],_0x5caeed);_0x5f1328['contact'][_0x49499e](_0x54f17e['text'],_0x54f17e[_0x18c5('0x3e')][_0x18c5('0x3f')],_0x54f17e[_0x18c5('0x3e')]['end']);}break;case _0x18c5('0x48'):var _0x5e4fa2=_0x5caeed[_0x18c5('0x3e')][_0x18c5('0x49')](',')[_0x18c5('0x18')](function(_0x404972){return Number(_0x404972);});var _0x4abf85=parseTagParameter(_0x5e4fa2);_0x5f1328[_0x18c5('0x4a')]['clause']['and'](_0x4abf85);_0x5f1328[_0x18c5('0x4a')][_0x18c5('0x4b')]=_0x5e4fa2;break;case'User':if(_0x5caeed[_0x18c5('0x44')]===_0x18c5('0x45')){_0x5f1328[_0x18c5('0x4c')][_0x49499e](_0x18c5('0x4d'),'%'+_0x5caeed['value']+'%',null);}else{_0x389f73=_['find'](_0x3a3fa3,['name',_0x18c5('0x4e')]);_0x5caeed[_0x18c5('0xb')]=_0x18c5('0x4e');_0x54f17e=as[_0x18c5('0x3c')](_0x50ba32,_0x389f73[_0x18c5('0x47')],_0x5caeed);_0x5f1328['user'][_0x49499e](_0x54f17e[_0x18c5('0x4f')],_0x54f17e[_0x18c5('0x3e')]['start'],_0x54f17e[_0x18c5('0x3e')]['end']);}break;case'body':case _0x18c5('0x50'):_0x54f17e=as[_0x18c5('0x3c')]('me',null,_0x5caeed);_0x5f1328[_0x18c5('0x51')][_0x49499e](_0x54f17e[_0x18c5('0x4f')],_0x54f17e['value'][_0x18c5('0x3f')],_0x54f17e[_0x18c5('0x3e')][_0x18c5('0x52')]);break;}}}return _0x5f1328;}function parseModelFields(_0x2ed949,_0x5970b9,_0x1d95ea){var _0x5ee57e=utils[_0x18c5('0x7')](_0x2ed949);var _0x4edbc3=squel[_0x18c5('0x22')]();var _0x34f472=_(_0x5970b9)[_0x18c5('0x53')]()[_0x18c5('0x18')](function(_0x22a676){return _[_0x18c5('0x54')](_0x1d95ea,['name',_0x22a676])?_0x22a676:undefined;})['compact']()[_0x18c5('0x3e')]();if(_0x34f472['length']>0x0){_0x34f472[_0x18c5('0x24')](function(_0x40f440){if(_0x40f440===_0x5ee57e){_0x4edbc3[_0x18c5('0x42')]('i.'+_0x5ee57e+_0x18c5('0x55'),[][_0x18c5('0x56')](_0x5970b9[_0x40f440]));}else if(_0x40f440===_0x18c5('0x57')){var _0x28e4b6=JSON[_0x18c5('0x58')](_0x5970b9[_0x40f440])['$gte'];var _0x2be368=JSON['parse'](_0x5970b9[_0x40f440])[_0x18c5('0x59')];_0x4edbc3[_0x18c5('0x42')](_0x18c5('0x5a'),_0x28e4b6,_0x2be368);}else{if(_0x5970b9[_0x40f440]===_0x18c5('0x5b')){_0x4edbc3[_0x18c5('0x42')]('i.'+_0x40f440+_0x18c5('0x5c'));}else{_0x4edbc3['and']('i.'+_0x40f440+_0x18c5('0x5d'),_0x5970b9[_0x40f440]);}}});}return _0x4edbc3;}function parseQueryParameters(_0x1b770c,_0x325f85,_0xe0b98){var _0x560cf8=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x1b770c,_0x325f85,_0xe0b98);})['then'](function(_0x484828){_0x560cf8[_0x18c5('0x5e')]['and'](_0x484828);return parseReadParameter(_0x325f85['read']);})['then'](function(_0x4f9e3b){_0x560cf8[_0x18c5('0x41')][_0x18c5('0x42')](_0x4f9e3b);return parseTagParameter(_0x325f85[_0x18c5('0x5f')]);})[_0x18c5('0x60')](function(_0x4eb814){_0x560cf8[_0x18c5('0x4a')]['clause']['and'](_0x4eb814);return parseSearchFilter(_0x1b770c,_0x325f85['filter']);})[_0x18c5('0x60')](function(_0x3ab37f){_0x560cf8[_0x18c5('0x61')]=_0x3ab37f;return _0x560cf8;});}function checkAccountsRestrictions(_0x517eae,_0x5d21de,_0x50c39a){var _0x3d6254=utils['getAccountFK'](_0x517eae);var _0x1798ab=_0x18c5('0x62')+_[_0x18c5('0x63')](_0x517eae)+(_0x517eae===_0x18c5('0x64')?_0x18c5('0x65'):_0x18c5('0x66'));var _0x28a980=squel[_0x18c5('0x22')]();return Promise['resolve']()[_0x18c5('0x60')](function(){if(_0x50c39a['search']&&_0x5d21de['role']==='agent'){return _0x5d21de[_0x1798ab]({'attributes':['id'],'raw':!![]});}})[_0x18c5('0x60')](function(_0x3c910a){if(_0x3c910a){if(_0x3c910a['length']===0x0){_0x28a980[_0x18c5('0x42')]('i.'+_0x3d6254+_0x18c5('0x5c'));}else{_0x28a980['and']('i.'+_0x3d6254+_0x18c5('0x55'),_[_0x18c5('0x18')](_0x3c910a,'id'));}}else if(!_0x50c39a[_0x3d6254]){_0x28a980[_0x18c5('0x42')]('i.'+_0x3d6254+_0x18c5('0x67'));}})[_0x18c5('0x60')](function(){return _0x28a980;});}function getClosedOrderClause(_0x8b3330,_0x4585f2){var _0x1d6744='';var _0x4f5e5e=[_0x18c5('0x68'),_0x18c5('0x69'),_0x18c5('0x6a')];if(_0x8b3330===_0x18c5('0x30')){_0x4f5e5e['unshift']('i.substatus');}if(_0x4585f2[_0x18c5('0x6b')]==='0'&&_0x8b3330===_0x18c5('0x30')){_0x1d6744=_0x18c5('0x6c');}else{if(_0x4585f2[_0x18c5('0x6b')]==='1'){_0x4f5e5e[_0x18c5('0x6d')]();}_0x1d6744='CONCAT_WS(\x27\x27,\x20'+_0x4f5e5e[_0x18c5('0x6e')](',\x20')+')';}return _0x1d6744;}function getFilteredInteractions(_0x225d4f,_0x3408ab,_0x4eb72b,_0x330fcc){var _0x179a95=utils[_0x18c5('0x19')](_0x225d4f);var _0x2b4e72=_['capitalize'](_0x225d4f)+_0x18c5('0x6f');var _0x53e693=[];var _0x319e3f=getTagsQuery();var _0x104507={'type':db[_0x18c5('0x70')][_0x18c5('0x71')]['SELECT'],'raw':!![]};var _0xb9dd87=[];var _0x2eb9ad=[];return db[_0x18c5('0x72')][_0x18c5('0x73')](_0x319e3f[_0x18c5('0x74')](),_0x104507)[_0x18c5('0x60')](function(_0x4ca178){_0x53e693=_[_0x18c5('0x75')](_0x4ca178,'id');_0x104507=_[_0x18c5('0x76')](_0x104507,{'model':db[_0x2b4e72],'mapToModel':!![],'nest':!![]});if(_0x4eb72b[_0x18c5('0x5e')]){_0x330fcc[_0x18c5('0x77')]['forEach'](function(_0x380e18){_0x3408ab[_0x18c5('0xb')]('i.'+_0x380e18);});}else{_0x3408ab[_0x18c5('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3408ab[_0x18c5('0xb')]('a.key',_0x18c5('0x78'));_0x3408ab[_0x18c5('0xb')]('a.mandatoryDisposition',_0x18c5('0x79'));if(_0x225d4f===_0x18c5('0x30')){_0x3408ab[_0x18c5('0xb')](_0x18c5('0x7a'),_0x18c5('0x7b'));_0x3408ab['field'](_0x18c5('0x7c'),_0x18c5('0x7d'));_0x3408ab[_0x18c5('0xb')]('i.id');_0x3408ab[_0x18c5('0xb')](_0x18c5('0x7e'));_0x3408ab['field']('i.updatedAt');_0x3408ab[_0x18c5('0xb')]('i.closed');_0x3408ab[_0x18c5('0xb')]('i.closedAt');_0x3408ab[_0x18c5('0xb')](_0x18c5('0x7f'));_0x3408ab['field'](_0x18c5('0x80'));_0x3408ab[_0x18c5('0xb')]('i.lastMsgDirection');_0x3408ab[_0x18c5('0xb')](_0x18c5('0x81'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x6a'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x69'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x68'));_0x3408ab['field'](_0x18c5('0x6c'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x82'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x83'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x84'));_0x3408ab['field']('i.UserId');}else if(_0x225d4f===_0x18c5('0x2e')){_0x3408ab[_0x18c5('0xb')](_0x18c5('0x85'),_0x18c5('0x7d'));}else{_0x3408ab[_0x18c5('0xb')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x18c5('0x7d'));}if(_0x225d4f!==_0x18c5('0x30')){_0x3408ab[_0x18c5('0xb')](_0x18c5('0x86'));}_0x3408ab[_0x18c5('0xb')](_0x18c5('0x87'),_0x18c5('0x88'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x89'),_0x18c5('0x8a'));_0x3408ab['field'](_0x18c5('0x8b'),_0x18c5('0x8c'));_0x3408ab[_0x18c5('0xb')]('c.phone',_0x18c5('0x8d'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x8e'),_0x18c5('0x8f'));_0x3408ab['field']('c.fax',_0x18c5('0x90'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x91'),'Owner.fullname');_0x3408ab[_0x18c5('0xb')](_0x18c5('0x92'),_0x18c5('0x93'));_0x3408ab[_0x18c5('0xb')](_0x18c5('0x94'),_0x18c5('0x95'));}if(_0x330fcc[_0x18c5('0x96')]){_0x3408ab['limit'](_0x330fcc['limit']);}if(_0x330fcc[_0x18c5('0x97')]){_0x3408ab['offset'](_0x330fcc[_0x18c5('0x97')]);}return db[_0x18c5('0x72')][_0x18c5('0x73')](_0x3408ab['toString'](),_0x104507);})[_0x18c5('0x60')](function(_0x3929cb){_0xb9dd87=_0x3929cb;var _0x14f027=getUsersQuery(_0x225d4f,_0xb9dd87);return db[_0x18c5('0x72')][_0x18c5('0x73')](_0x14f027[_0x18c5('0x74')](),_0x104507);})[_0x18c5('0x60')](function(_0xb9a41a){_0x2eb9ad=_[_0x18c5('0x98')](_0xb9a41a,_0x179a95);if(_0x225d4f===_0x18c5('0x30')){return db[_0x18c5('0x99')][_0x18c5('0x9a')]({'attributes':[_0x18c5('0x9b')],'raw':!![]});}})[_0x18c5('0x60')](function(_0x420abc){var _0x455aa6=_0x420abc?_0x420abc[_0x18c5('0x9b')]:undefined;var _0x630a0e=_0xb9dd87[_0x18c5('0x18')](function(_0x2de2e6){return updateInteraction(_0x2de2e6,_0x53e693,_0x2eb9ad,_0x455aa6);});return Promise['all'](_0x630a0e);});}function countFilteredInteractions(_0x28d82e,_0x3fd147){var _0x3ccf75=_0x28d82e[_0x18c5('0x9c')]();_0x3ccf75[_0x18c5('0xb')](_0x18c5('0x9d'));_0x3ccf75['field'](_0x18c5('0x9e'),_0x18c5('0x40'));var _0x11a8a0=utils[_0x18c5('0x23')](_0x3fd147);if(!_['isEmpty'](_0x11a8a0)){_0x3ccf75['where'](_0x18c5('0x9f'),_0x11a8a0);}var _0x4432cf={'type':db['Sequelize'][_0x18c5('0x71')][_0x18c5('0xa0')],'raw':!![]};return db[_0x18c5('0x72')][_0x18c5('0x73')](_0x3ccf75['toString'](),_0x4432cf);}module[_0x18c5('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf511=['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','length','buildExpression','type','default','text','value','start','end','unreadMessages','and','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','clause','tags','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','filter','get','capitalize','chat','Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','field','name','color','from','tools_tags','getInteractionFK','select','ui.','left_join','users','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf511,0x1bd));var _0x1f51=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0xf511[_0x4cefc3];return _0x1cc779;};'use strict';var _=require(_0x1f51('0x0'));var squel=require(_0x1f51('0x1'));var as=require(_0x1f51('0x2'));var qs=require(_0x1f51('0x3'));var updateInteraction=require(_0x1f51('0x4'))['updateInteraction'];var utils=require(_0x1f51('0x5'));var db=require(_0x1f51('0x6'))['db'];function skipInteractionsQuery(_0x3cc0a3,_0x313c8e,_0x2f29c5){var _0x3b7e0b=![];var _0x187795=utils[_0x1f51('0x7')](_0x3cc0a3);if(_0x313c8e[_0x1f51('0x8')]==='agent'&&!_0x2f29c5[_0x1f51('0x9')]&&!_0x2f29c5[_0x187795]){_0x3b7e0b=!![];}return _0x3b7e0b;}function getTagsQuery(){return squel['select']()[_0x1f51('0xa')]('id')['field'](_0x1f51('0xb'))[_0x1f51('0xa')](_0x1f51('0xc'))[_0x1f51('0xd')](_0x1f51('0xe'));}function getUsersQuery(_0x3dc930,_0x4e7894){var _0x12bb68=utils[_0x1f51('0xf')](_0x3dc930);var _0x10d927='user_has_'+_0x3dc930+'_interactions';var _0x4d8e5f=squel[_0x1f51('0x10')]()['field']('u.id')[_0x1f51('0xa')]('u.fullname')[_0x1f51('0xa')](_0x1f51('0x11')+_0x12bb68)[_0x1f51('0xd')](_0x10d927,'ui')[_0x1f51('0x12')](_0x1f51('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x4e7894['length']>0x0){_0x4d8e5f[_0x1f51('0x14')]('ui.'+_0x12bb68+_0x1f51('0x15'),_[_0x1f51('0x16')](_0x4e7894,'id'));}return _0x4d8e5f;}function getInteractionsQuery(_0x1eb728){var _0x225166=utils[_0x1f51('0x17')](_0x1eb728);var _0x5ae83e=utils['getAccountFK'](_0x1eb728);var _0x566b8c=utils[_0x1f51('0xf')](_0x1eb728);return squel[_0x1f51('0x10')]()[_0x1f51('0xd')](_0x225166[_0x1f51('0x18')],'i')[_0x1f51('0x12')]('cm_contacts','c',_0x1f51('0x19'))[_0x1f51('0x12')](_0x1f51('0x13'),'o',_0x1f51('0x1a'))[_0x1f51('0x12')](_0x225166[_0x1f51('0x1b')],'a',_0x1f51('0x1c')+_0x5ae83e)[_0x1f51('0x12')](_0x225166[_0x1f51('0x1d')],'me','me.'+_0x566b8c+_0x1f51('0x1e'))['left_join'](_0x225166[_0x1f51('0x1f')],'it',_0x1f51('0x20')+_0x566b8c+_0x1f51('0x1e'))[_0x1f51('0x12')](_0x1f51('0xe'),'t',_0x1f51('0x21'));}function getSqlClauses(){var _0x16da07={'body':squel[_0x1f51('0x22')](),'contact':squel[_0x1f51('0x22')](),'default':squel[_0x1f51('0x22')](),'fields':squel['expr'](),'filter':squel[_0x1f51('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0x1f51('0x22')](),'ids':null},'user':squel[_0x1f51('0x22')]()};return _0x16da07;}function parseTagParameter(_0x5aebb){var _0x1b73a3=squel[_0x1f51('0x22')]();if(_0x5aebb){var _0x5a9a45=utils[_0x1f51('0x23')](_0x5aebb);_0x5a9a45[_0x1f51('0x24')](function(_0x456a53){_0x1b73a3['or'](_0x1f51('0x25'),'%,'+_0x456a53+',%');});}return _0x1b73a3;}function parseReadParameter(_0x5f25a0){var _0x8a5583='';if(_0x5f25a0){_0x8a5583=_0x1f51('0x26');if(_0x5f25a0==='1'){_0x8a5583=_0x8a5583[_0x1f51('0x27')](_0x1f51('0x28'),'=');}else{_0x8a5583=_0x8a5583[_0x1f51('0x27')](_0x1f51('0x28'),'>');}}return _0x8a5583;}function parseSearchFilter(_0x3e6211,_0x8f4e9f){var _0x2d5a8a=squel[_0x1f51('0x22')]();if(_0x8f4e9f){var _0x5da69a=_0x8f4e9f[_0x1f51('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x4e9a5e=qs[_0x1f51('0x29')](_0x5da69a);if(qs[_0x1f51('0x2a')](_0x5da69a)){_0x2d5a8a['or'](_0x1f51('0x2b'),_0x4e9a5e+'%');if([_0x1f51('0x2c'),_0x1f51('0x2d')][_0x1f51('0x2e')](_0x3e6211)){_0x2d5a8a['or'](_0x1f51('0x2f'),_0x4e9a5e+'%');}else if(_0x3e6211===_0x1f51('0x30')){_0x2d5a8a['or']('i.fax\x20LIKE\x20?',_0x4e9a5e+'%');}else if(_0x3e6211===_0x1f51('0x31')){_0x2d5a8a['or'](_0x1f51('0x32'),_0x4e9a5e+'%');}}else if(_0x3e6211==='mail'&&qs['isEmail'](_0x5da69a)){_0x2d5a8a['or'](_0x1f51('0x33'),_0x4e9a5e+'%');}else{if(_0x3e6211===_0x1f51('0x34')){_0x2d5a8a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1f51('0x35')](_0x5da69a,!![]))['or'](_0x1f51('0x36'),qs[_0x1f51('0x35')](_0x5da69a));}else if(_0x3e6211!==_0x1f51('0x30')){_0x2d5a8a['or'](_0x1f51('0x37'),qs[_0x1f51('0x35')](_0x5da69a));}_0x2d5a8a['or'](_0x1f51('0x38'),qs[_0x1f51('0x35')](_0x5da69a,!![]),null);}}return _0x2d5a8a;}function parseAdvancedSearchFilter(_0x34d9b4,_0x246548){var _0x249bcc=getSqlClauses();var _0x57f7f7=as[_0x1f51('0x39')](_0x34d9b4);var _0x439f6b=_0x57f7f7[_0x1f51('0x3a')];for(var _0xbf0610=0x0;_0xbf0610<_0x57f7f7['conditions'][_0x1f51('0x3b')];_0xbf0610++){var _0x11cc28=_0x57f7f7['conditions'][_0xbf0610];var _0x5f33bc='i';var _0x458e37=_['find'](_0x246548,[_0x1f51('0xb'),_0x11cc28[_0x1f51('0xa')]]);if(_0x458e37){var _0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc[_0x1f51('0x3e')][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x42')]);}else{switch(_0x11cc28[_0x1f51('0xa')]){case _0x1f51('0x43'):var _0x401a2c=parseReadParameter(_0x11cc28[_0x1f51('0x40')]);_0x249bcc['read'][_0x1f51('0x44')](_0x401a2c);break;case'Contact':if(_0x11cc28[_0x1f51('0x45')]===_0x1f51('0x46')){if(_0x11cc28[_0x1f51('0x40')][_0x1f51('0x47')]('\x20')['length']>0x1){_0x249bcc[_0x1f51('0x48')][_0x439f6b](_0x1f51('0x38'),qs['getFullTextValue'](_0x11cc28['value'],!![]),null);}else{var _0x13a60f='%'+_0x11cc28[_0x1f51('0x40')]+'%';_0x249bcc['contact'][_0x439f6b](_0x1f51('0x49'),_0x13a60f,_0x13a60f,_0x13a60f);}}else{_0x458e37=_[_0x1f51('0x4a')](_0x246548,[_0x1f51('0xb'),_0x1f51('0x4b')]);_0x11cc28[_0x1f51('0xa')]='ContactId';_0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc[_0x1f51('0x48')][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2['value'][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')]['end']);}break;case _0x1f51('0x4c'):var _0x45b749=_0x11cc28['value'][_0x1f51('0x47')](',')[_0x1f51('0x16')](function(_0x264bc8){return Number(_0x264bc8);});var _0x57d968=parseTagParameter(_0x45b749);_0x249bcc['tags'][_0x1f51('0x4d')][_0x1f51('0x44')](_0x57d968);_0x249bcc[_0x1f51('0x4e')][_0x1f51('0x4f')]=_0x45b749;break;case _0x1f51('0x50'):if(_0x11cc28[_0x1f51('0x45')]===_0x1f51('0x46')){_0x249bcc['user'][_0x439f6b](_0x1f51('0x51'),'%'+_0x11cc28[_0x1f51('0x40')]+'%',null);}else{_0x458e37=_[_0x1f51('0x4a')](_0x246548,[_0x1f51('0xb'),_0x1f51('0x52')]);_0x11cc28[_0x1f51('0xa')]='UserId';_0x92de2=as[_0x1f51('0x3c')](_0x5f33bc,_0x458e37[_0x1f51('0x3d')],_0x11cc28);_0x249bcc['user'][_0x439f6b](_0x92de2['text'],_0x92de2[_0x1f51('0x40')]['start'],_0x92de2['value']['end']);}break;case _0x1f51('0x53'):case _0x1f51('0x54'):_0x92de2=as['buildExpression']('me',null,_0x11cc28);_0x249bcc['body'][_0x439f6b](_0x92de2[_0x1f51('0x3f')],_0x92de2['value'][_0x1f51('0x41')],_0x92de2[_0x1f51('0x40')][_0x1f51('0x42')]);break;}}}return _0x249bcc;}function parseModelFields(_0x2e2c5e,_0x11751b,_0xc49801){var _0x141083=utils['getAccountFK'](_0x2e2c5e);var _0x2162f3=squel[_0x1f51('0x22')]();var _0x352844=_(_0x11751b)[_0x1f51('0x55')]()[_0x1f51('0x16')](function(_0x1aeb3e){return _[_0x1f51('0x56')](_0xc49801,[_0x1f51('0xb'),_0x1aeb3e])?_0x1aeb3e:undefined;})[_0x1f51('0x57')]()['value']();if(_0x352844[_0x1f51('0x3b')]>0x0){_0x352844['forEach'](function(_0x77c7a4){if(_0x77c7a4===_0x141083){_0x2162f3[_0x1f51('0x44')]('i.'+_0x141083+_0x1f51('0x15'),[][_0x1f51('0x58')](_0x11751b[_0x77c7a4]));}else if(_0x77c7a4==='createdAt'){var _0x4a81ee=JSON['parse'](_0x11751b[_0x77c7a4])['$gte'];var _0x15e126=JSON[_0x1f51('0x59')](_0x11751b[_0x77c7a4])[_0x1f51('0x5a')];_0x2162f3['and'](_0x1f51('0x5b'),_0x4a81ee,_0x15e126);}else{if(_0x11751b[_0x77c7a4]===_0x1f51('0x5c')){_0x2162f3[_0x1f51('0x44')]('i.'+_0x77c7a4+_0x1f51('0x5d'));}else{_0x2162f3[_0x1f51('0x44')]('i.'+_0x77c7a4+_0x1f51('0x5e'),_0x11751b[_0x77c7a4]);}}});}return _0x2162f3;}function parseQueryParameters(_0x268cd0,_0x2ec6cc,_0x35a09a){var _0x1220d1=getSqlClauses();return Promise[_0x1f51('0x5f')]()['then'](function(){return parseModelFields(_0x268cd0,_0x2ec6cc,_0x35a09a);})[_0x1f51('0x60')](function(_0x256afd){_0x1220d1['fields']['and'](_0x256afd);return parseReadParameter(_0x2ec6cc['read']);})['then'](function(_0x318fc7){_0x1220d1[_0x1f51('0x61')][_0x1f51('0x44')](_0x318fc7);return parseTagParameter(_0x2ec6cc['tag']);})[_0x1f51('0x60')](function(_0x52f7be){_0x1220d1[_0x1f51('0x4e')][_0x1f51('0x4d')][_0x1f51('0x44')](_0x52f7be);return parseSearchFilter(_0x268cd0,_0x2ec6cc[_0x1f51('0x62')]);})[_0x1f51('0x60')](function(_0x54654d){_0x1220d1[_0x1f51('0x62')]=_0x54654d;return _0x1220d1;});}function checkAccountsRestrictions(_0x2c8c31,_0x298b70,_0x37eec5){var _0x24b8ad=utils[_0x1f51('0x7')](_0x2c8c31);var _0x19b1c0=_0x1f51('0x63')+_[_0x1f51('0x64')](_0x2c8c31)+(_0x2c8c31===_0x1f51('0x65')?'Websites':_0x1f51('0x66'));var _0x48b081=squel[_0x1f51('0x22')]();return Promise[_0x1f51('0x5f')]()[_0x1f51('0x60')](function(){if(_0x37eec5[_0x1f51('0x9')]&&_0x298b70['role']===_0x1f51('0x67')){return _0x298b70[_0x19b1c0]({'attributes':['id'],'raw':!![]});}})[_0x1f51('0x60')](function(_0xc46201){if(_0xc46201){if(_0xc46201[_0x1f51('0x3b')]===0x0){_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x5d'));}else{_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x15'),_[_0x1f51('0x16')](_0xc46201,'id'));}}else if(!_0x37eec5[_0x24b8ad]){_0x48b081[_0x1f51('0x44')]('i.'+_0x24b8ad+_0x1f51('0x68'));}})[_0x1f51('0x60')](function(){return _0x48b081;});}function getClosedOrderClause(_0x4bf4c9,_0x2c8e58){var _0x1e9dd8='';var _0x5a19d3=['i.thirdDisposition',_0x1f51('0x69'),_0x1f51('0x6a')];if(_0x4bf4c9===_0x1f51('0x34')){_0x5a19d3[_0x1f51('0x6b')](_0x1f51('0x6c'));}if(_0x2c8e58[_0x1f51('0x6d')]==='0'&&_0x4bf4c9==='mail'){_0x1e9dd8=_0x1f51('0x6c');}else{if(_0x2c8e58[_0x1f51('0x6d')]==='1'){_0x5a19d3[_0x1f51('0x6e')]();}_0x1e9dd8=_0x1f51('0x6f')+_0x5a19d3[_0x1f51('0x70')](',\x20')+')';}return _0x1e9dd8;}function getFilteredInteractions(_0x1aebaf,_0x3685a5,_0x2b10a3,_0x1c6776){var _0x29f00f=utils[_0x1f51('0xf')](_0x1aebaf);var _0xdf751c=_['capitalize'](_0x1aebaf)+_0x1f51('0x71');var _0x9b27bf=[];var _0x11308c=getTagsQuery();var _0x384fdf={'type':db[_0x1f51('0x72')][_0x1f51('0x73')][_0x1f51('0x74')],'raw':!![]};var _0x2e8c02=[];var _0x1a0572=[];return db[_0x1f51('0x75')][_0x1f51('0x76')](_0x11308c[_0x1f51('0x77')](),_0x384fdf)[_0x1f51('0x60')](function(_0x5d4bd4){_0x9b27bf=_['keyBy'](_0x5d4bd4,'id');_0x384fdf=_['merge'](_0x384fdf,{'model':db[_0xdf751c],'mapToModel':!![],'nest':!![]});if(_0x2b10a3[_0x1f51('0x78')]){_0x1c6776[_0x1f51('0x79')]['forEach'](function(_0x933a){_0x3685a5[_0x1f51('0xa')]('i.'+_0x933a);});}else{_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7a'),_0x1f51('0x43'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7b'),_0x1f51('0x7c'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7d'),_0x1f51('0x7e'));if(_0x1aebaf===_0x1f51('0x34')){_0x3685a5[_0x1f51('0xa')](_0x1f51('0x7f'),_0x1f51('0x80'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x81'),'contactName');_0x3685a5[_0x1f51('0xa')]('i.id');_0x3685a5['field']('i.createdAt');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x82'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x83'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x84'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x85'));_0x3685a5[_0x1f51('0xa')]('i.lastMsgAt');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x86'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x87'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x6a'));_0x3685a5['field'](_0x1f51('0x69'));_0x3685a5['field']('i.thirdDisposition');_0x3685a5[_0x1f51('0xa')](_0x1f51('0x6c'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x88'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x89'));_0x3685a5['field'](_0x1f51('0x8a'));_0x3685a5['field'](_0x1f51('0x8b'));}else if(_0x1aebaf===_0x1f51('0x31')){_0x3685a5[_0x1f51('0xa')](_0x1f51('0x8c'),_0x1f51('0x8d'));}else{_0x3685a5[_0x1f51('0xa')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x1f51('0x8d'));}if(_0x1aebaf!==_0x1f51('0x34')){_0x3685a5['field'](_0x1f51('0x8e'));}_0x3685a5[_0x1f51('0xa')](_0x1f51('0x8f'),_0x1f51('0x90'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x91'),_0x1f51('0x92'));_0x3685a5[_0x1f51('0xa')]('c.email',_0x1f51('0x93'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x94'),_0x1f51('0x95'));_0x3685a5[_0x1f51('0xa')]('c.mobile',_0x1f51('0x96'));_0x3685a5[_0x1f51('0xa')]('c.fax',_0x1f51('0x97'));_0x3685a5[_0x1f51('0xa')]('o.fullname',_0x1f51('0x98'));_0x3685a5[_0x1f51('0xa')](_0x1f51('0x99'),_0x1f51('0x9a'));_0x3685a5['field'](_0x1f51('0x9b'),'TagIds');}if(_0x1c6776[_0x1f51('0x9c')]){_0x3685a5['limit'](_0x1c6776[_0x1f51('0x9c')]);}if(_0x1c6776['offset']){_0x3685a5['offset'](_0x1c6776['offset']);}return db['sequelize'][_0x1f51('0x76')](_0x3685a5[_0x1f51('0x77')](),_0x384fdf);})[_0x1f51('0x60')](function(_0x4a35e1){_0x2e8c02=_0x4a35e1;var _0x17adf2=getUsersQuery(_0x1aebaf,_0x2e8c02);return db[_0x1f51('0x75')][_0x1f51('0x76')](_0x17adf2[_0x1f51('0x77')](),_0x384fdf);})[_0x1f51('0x60')](function(_0x4c979c){_0x1a0572=_[_0x1f51('0x9d')](_0x4c979c,_0x29f00f);if(_0x1aebaf==='mail'){return db[_0x1f51('0x9e')][_0x1f51('0x9f')]({'attributes':[_0x1f51('0xa0')],'raw':!![]});}})[_0x1f51('0x60')](function(_0x24296e){var _0x27cd31=_0x24296e?_0x24296e[_0x1f51('0xa0')]:undefined;var _0x905047=_0x2e8c02[_0x1f51('0x16')](function(_0x285600){return updateInteraction(_0x285600,_0x9b27bf,_0x1a0572,_0x27cd31);});return Promise[_0x1f51('0xa1')](_0x905047);});}function countFilteredInteractions(_0x57418b,_0x1eb30f){var _0xda4c4e=_0x57418b[_0x1f51('0xa2')]();_0xda4c4e[_0x1f51('0xa')](_0x1f51('0xa3'));_0xda4c4e['field'](_0x1f51('0x7a'),_0x1f51('0x43'));var _0x34c4bb=utils['getSelectedTags'](_0x1eb30f);if(!_['isEmpty'](_0x34c4bb)){_0xda4c4e[_0x1f51('0x14')](_0x1f51('0xa4'),_0x34c4bb);}var _0x1495d7={'type':db[_0x1f51('0x72')][_0x1f51('0x73')][_0x1f51('0x74')],'raw':!![]};return db[_0x1f51('0x75')][_0x1f51('0x76')](_0xda4c4e[_0x1f51('0x77')](),_0x1495d7);}module[_0x1f51('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 9fbda99..22dcafc 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 _0x77c4=['updateInteraction','Users','TagIds','Tags','../../mysqldb','fullname','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch'];(function(_0x4b4154,_0x38a122){var _0x340ed7=function(_0x1250b9){while(--_0x1250b9){_0x4b4154['push'](_0x4b4154['shift']());}};_0x340ed7(++_0x38a122);}(_0x77c4,0x1e4));var _0x477c=function(_0x7223be,_0x364cde){_0x7223be=_0x7223be-0x0;var _0x3b7e8e=_0x77c4[_0x7223be];return _0x3b7e8e;};'use strict';var _=require('lodash');var db=require(_0x477c('0x0'))['db'];function getInteractionUsers(_0x2e2d32,_0x34f93a){return new Promise(function(_0x1f86e4,_0x2e267f){try{var _0x214601=[];if(_0x34f93a[_0x2e2d32]){_0x214601=_0x34f93a[_0x2e2d32]['map'](function(_0x426f22){return{'id':_0x426f22['id'],'fullname':_0x426f22[_0x477c('0x1')]};});}return _0x1f86e4(_0x214601);}catch(_0x2c4382){_0x2e267f(_0x2c4382);}});}function getInteractionTags(_0xe6df6f,_0x4da5b6){var _0x76bd12=[];if(_0xe6df6f){_0xe6df6f['split'](',')['forEach'](function(_0x5db68e){_0x76bd12[_0x477c('0x2')](_0x4da5b6[_0x5db68e]);});}return _0x76bd12;}function updateWaitingCounter(_0x992af1){if(_0x992af1[_0x477c('0x3')]){_0x992af1[_0x477c('0x3')]-=0x1;}}function updateInteractionCounters(_0x1c3b78){_0x1c3b78[_0x477c('0x3')]=0x0;_0x1c3b78[_0x477c('0x4')]=0x0;_0x1c3b78[_0x477c('0x5')]=0x0;_0x1c3b78[_0x477c('0x6')]=0x0;_0x1c3b78[_0x477c('0x7')]=0x0;_0x1c3b78[_0x477c('0x8')]=0x0;if(_0x1c3b78[_0x477c('0x9')]){if(_0x1c3b78[_0x477c('0xa')]===_0x477c('0x7')){_0x1c3b78[_0x477c('0x7')]+=0x1;updateWaitingCounter(_0x1c3b78);}if(_0x1c3b78['UserId']){_0x1c3b78[_0x477c('0x5')]+=0x1;if(_0x1c3b78[_0x477c('0x4')]){_0x1c3b78[_0x477c('0x4')]-=0x1;}}else{if(_0x1c3b78[_0x477c('0xa')]){_0x1c3b78['unmanaged']+=0x1;updateWaitingCounter(_0x1c3b78);}}}else{if(!_0x1c3b78[_0x477c('0xb')]){_0x1c3b78[_0x477c('0x3')]+=0x1;}if(_0x1c3b78[_0x477c('0xb')]){_0x1c3b78['talking']+=0x1;updateWaitingCounter(_0x1c3b78);}}_0x1c3b78['total']+=0x1;return _0x1c3b78;}function getLastMessageText(_0x4c4892){return db[_0x477c('0xc')][_0x477c('0xd')]({'where':{'$and':[{'MailInteractionId':_0x4c4892['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x477c('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x477c('0xf')],'order':_0x477c('0x10'),'raw':!![]})[_0x477c('0x11')](function(_0x1d42f3){if(_0x1d42f3&&_0x1d42f3['plainBody']){_0x4c4892['lastMsgText']=_[_0x477c('0x12')](_0x1d42f3[_0x477c('0xf')]);}return _0x4c4892;})[_0x477c('0x13')](function(_0x13f339){throw _0x13f339;});}exports[_0x477c('0x14')]=function(_0x5f4a8f,_0x4ab072,_0x5a7d14,_0x2db897){return new Promise(function(_0x59e3e1,_0x5a05ba){return getInteractionUsers(_0x5f4a8f['id'],_0x5a7d14)[_0x477c('0x11')](function(_0xd7abf5){_0x5f4a8f[_0x477c('0x15')]=_0xd7abf5;return getInteractionTags(_0x5f4a8f[_0x477c('0x16')],_0x4ab072);})[_0x477c('0x11')](function(_0x5a2405){_0x5f4a8f[_0x477c('0x17')]=_0x5a2405;delete _0x5f4a8f[_0x477c('0x16')];return updateInteractionCounters(_0x5f4a8f);})['then'](function(_0x40b3c1){if(_0x2db897){return getLastMessageText(_0x40b3c1);}else{return _0x40b3c1;}})['then'](function(_0x4cccc0){_0x59e3e1(_0x4cccc0);})[_0x477c('0x13')](function(_0x22a960){_0x5a05ba(_0x22a960);});});}; \ No newline at end of file +var _0x6fd6=['waiting','talking','unmanaged','total','closed','disposition','UserId','answered','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','then','lodash','../../mysqldb','map','fullname','split','forEach'];(function(_0x427272,_0x5a5946){var _0x41252f=function(_0x3f0ffa){while(--_0x3f0ffa){_0x427272['push'](_0x427272['shift']());}};_0x41252f(++_0x5a5946);}(_0x6fd6,0x81));var _0x66fd=function(_0x59cca4,_0x25319f){_0x59cca4=_0x59cca4-0x0;var _0x543df0=_0x6fd6[_0x59cca4];return _0x543df0;};'use strict';var _=require(_0x66fd('0x0'));var db=require(_0x66fd('0x1'))['db'];function getInteractionUsers(_0x2636aa,_0x14afd9){return new Promise(function(_0x1023d5,_0x1785e1){try{var _0x1ead8f=[];if(_0x14afd9[_0x2636aa]){_0x1ead8f=_0x14afd9[_0x2636aa][_0x66fd('0x2')](function(_0xdde160){return{'id':_0xdde160['id'],'fullname':_0xdde160[_0x66fd('0x3')]};});}return _0x1023d5(_0x1ead8f);}catch(_0x1801f1){_0x1785e1(_0x1801f1);}});}function getInteractionTags(_0x5172f4,_0x3c8118){var _0x150d26=[];if(_0x5172f4){_0x5172f4[_0x66fd('0x4')](',')[_0x66fd('0x5')](function(_0x42d509){_0x150d26['push'](_0x3c8118[_0x42d509]);});}return _0x150d26;}function updateWaitingCounter(_0x49b0da){if(_0x49b0da[_0x66fd('0x6')]){_0x49b0da[_0x66fd('0x6')]-=0x1;}}function updateInteractionCounters(_0x2fe5a3){_0x2fe5a3[_0x66fd('0x6')]=0x0;_0x2fe5a3[_0x66fd('0x7')]=0x0;_0x2fe5a3['answered']=0x0;_0x2fe5a3[_0x66fd('0x8')]=0x0;_0x2fe5a3['abandoned']=0x0;_0x2fe5a3[_0x66fd('0x9')]=0x0;if(_0x2fe5a3[_0x66fd('0xa')]){if(_0x2fe5a3[_0x66fd('0xb')]==='abandoned'){_0x2fe5a3['abandoned']+=0x1;updateWaitingCounter(_0x2fe5a3);}if(_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3[_0x66fd('0xd')]+=0x1;if(_0x2fe5a3[_0x66fd('0x7')]){_0x2fe5a3[_0x66fd('0x7')]-=0x1;}}else{if(_0x2fe5a3['disposition']){_0x2fe5a3[_0x66fd('0x8')]+=0x1;updateWaitingCounter(_0x2fe5a3);}}}else{if(!_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3['waiting']+=0x1;}if(_0x2fe5a3[_0x66fd('0xc')]){_0x2fe5a3['talking']+=0x1;updateWaitingCounter(_0x2fe5a3);}}_0x2fe5a3[_0x66fd('0x9')]+=0x1;return _0x2fe5a3;}function getLastMessageText(_0x40756d){return db[_0x66fd('0xe')][_0x66fd('0xf')]({'where':{'$and':[{'MailInteractionId':_0x40756d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x66fd('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x66fd('0x11')],'order':_0x66fd('0x12'),'raw':!![]})['then'](function(_0x4ad6f7){if(_0x4ad6f7&&_0x4ad6f7['plainBody']){_0x40756d[_0x66fd('0x13')]=_[_0x66fd('0x14')](_0x4ad6f7['plainBody']);}return _0x40756d;})[_0x66fd('0x15')](function(_0x485017){throw _0x485017;});}exports[_0x66fd('0x16')]=function(_0x3eb32e,_0xb23f7a,_0x47be30,_0x52a731){return new Promise(function(_0x22b397,_0x1b4c36){return getInteractionUsers(_0x3eb32e['id'],_0x47be30)['then'](function(_0x8c9b94){_0x3eb32e[_0x66fd('0x17')]=_0x8c9b94;return getInteractionTags(_0x3eb32e[_0x66fd('0x18')],_0xb23f7a);})['then'](function(_0x2e24ee){_0x3eb32e[_0x66fd('0x19')]=_0x2e24ee;delete _0x3eb32e[_0x66fd('0x18')];return updateInteractionCounters(_0x3eb32e);})[_0x66fd('0x1a')](function(_0x24d564){if(_0x52a731){return getLastMessageText(_0x24d564);}else{return _0x24d564;}})[_0x66fd('0x1a')](function(_0x5582ea){_0x22b397(_0x5582ea);})[_0x66fd('0x15')](function(_0x31cd68){_0x1b4c36(_0x31cd68);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c6f419a..b858240 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 _0xc22a=['upperFirst','unknown','websites','_interactions','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','then','error','name','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20body=','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId'];(function(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0xc22a,0x7b));var _0xac22=function(_0x3d339b,_0x37b1ac){_0x3d339b=_0x3d339b-0x0;var _0x2b7f0f=_0xc22a[_0x3d339b];return _0x2b7f0f;};'use strict';var _=require(_0xac22('0x0'));var db=require(_0xac22('0x1'))['db'];var loggers={'openchannel':require(_0xac22('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xac22('0x3')),'fax':require('../../config/logger')(_0xac22('0x4')),'sms':require(_0xac22('0x2'))(_0xac22('0x5')),'chat':require(_0xac22('0x2'))(_0xac22('0x6')),'whatsapp':require(_0xac22('0x2'))(_0xac22('0x7'))};function getAccountFK(_0x2234f4){return _['capitalize'](_0x2234f4)+(_0x2234f4===_0xac22('0x8')?_0xac22('0x9'):_0xac22('0xa'))+'Id';}function getInteractionFK(_0x14e25b){return _[_0xac22('0xb')](_0x14e25b)+_0xac22('0xc');}function getInteractionId(_0x35c758,_0x524582,_0x2b787c){if(_0x35c758&&_0x35c758[_[_0xac22('0xd')](_0x2b787c)+'InteractionId']){return _0x35c758[_['upperFirst'](_0x2b787c)+_0xac22('0xc')];}else if(_0x35c758&&_0x35c758['id']){return _0x35c758['id'];}else if(_0x524582&&_0x524582['id']){return _0x524582['id'];}else{return _0xac22('0xe');}}function getInteractionsTables(_0x5edb03){return{'accounts':_0x5edb03+'_'+(_0x5edb03===_0xac22('0x8')?_0xac22('0xf'):'accounts'),'interactions':_0x5edb03+_0xac22('0x10'),'interactionsTags':_0x5edb03+'_interaction_has_tags','messages':_0x5edb03+_0xac22('0x11'),'userInteractions':_0xac22('0x12')+_0x5edb03+_0xac22('0x10')};}function getSelectedTags(_0x522cbf){var _0x93ab57=[];if(_0x522cbf){_0x93ab57=Array[_0xac22('0x13')](_0x522cbf)?_0x522cbf:[_0x522cbf];}return _0x93ab57;}function log(_0x598cfd,_0xb9e3a7,_0x2d07ab,_0x4eefce,_0x510121,_0xae7133){loggers[_0x510121[_0xac22('0x14')]()][_0x598cfd](_0xac22('0x15'),_0xae7133[_0xac22('0x16')](),_0xb9e3a7?_0xb9e3a7['id']:null,_0xb9e3a7?_0xb9e3a7['name']:null,_0xb9e3a7?_0xb9e3a7[_0xac22('0x17')]:null,getInteractionId(_0x2d07ab,_0x4eefce,_0x510121),_0x2d07ab?JSON['stringify'](_0x2d07ab):_0xac22('0x18'));}function updateUser(_0x592613,_0x131c22,_0x4dc06b,_0x500af4,_0x531bec){db[_['upperFirst'](_0x500af4)+_0xac22('0x19')]['findOne']({'where':{'id':getInteractionId(_0x131c22,_0x4dc06b,_0x500af4)}})[_0xac22('0x1a')](function(_0x3b3534){if(_0x3b3534){return _0x3b3534['update']({'UserId':_0x592613?_0x592613['id']:null});}})[_0xac22('0x1a')](function(_0x438c0a){if(_0x438c0a){log('info',_0x592613,_0x131c22,_0x4dc06b,_0x500af4,_0x531bec);}})['catch'](function(){log(_0xac22('0x1b'),_0x592613,_0x131c22,_0x4dc06b,_0x500af4,_0x531bec);});}function logAcceptMessage(_0x4a5895,_0x56af58,_0x57b54c,_0x265983){var _0x1e2ad7=loggers[_0x4a5895['toLowerCase']()];var _0x2cf696=_0x56af58['id'];var _0x17a895=_0x56af58[_0xac22('0x1c')];var _0x23b9f1=_0x56af58[_0xac22('0x17')];var _0x2f2c6b=JSON['stringify'](_0x265983||null);_0x1e2ad7[_0xac22('0x1d')]('['+_0x4a5895[_0xac22('0x16')]()+_0xac22('0x1e')+_0x2cf696+_0xac22('0x1f')+_0x17a895+_0xac22('0x20')+_0x23b9f1+'\x20interaction='+_0x57b54c+_0xac22('0x21')+_0x2f2c6b);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0xe8fa=['chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','info','catch','toUpperCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x27fb36,_0x3ba193){var _0x45697f=function(_0x4b66c2){while(--_0x4b66c2){_0x27fb36['push'](_0x27fb36['shift']());}};_0x45697f(++_0x3ba193);}(_0xe8fa,0x17f));var _0xae8f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xe8fa[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0xae8f('0x0'));var db=require(_0xae8f('0x1'))['db'];var loggers={'openchannel':require(_0xae8f('0x2'))(_0xae8f('0x3')),'mail':require(_0xae8f('0x2'))(_0xae8f('0x4')),'fax':require('../../config/logger')(_0xae8f('0x5')),'sms':require(_0xae8f('0x2'))(_0xae8f('0x6')),'chat':require(_0xae8f('0x2'))(_0xae8f('0x7')),'whatsapp':require(_0xae8f('0x2'))('whatsapp-interactions')};function getAccountFK(_0xb58773){return _[_0xae8f('0x8')](_0xb58773)+(_0xb58773===_0xae8f('0x9')?_0xae8f('0xa'):_0xae8f('0xb'))+'Id';}function getInteractionFK(_0x451e7c){return _[_0xae8f('0x8')](_0x451e7c)+_0xae8f('0xc');}function getInteractionId(_0x44110f,_0x16928f,_0x3d0023){if(_0x44110f&&_0x44110f[_[_0xae8f('0xd')](_0x3d0023)+'InteractionId']){return _0x44110f[_['upperFirst'](_0x3d0023)+'InteractionId'];}else if(_0x44110f&&_0x44110f['id']){return _0x44110f['id'];}else if(_0x16928f&&_0x16928f['id']){return _0x16928f['id'];}else{return _0xae8f('0xe');}}function getInteractionsTables(_0x21f5df){return{'accounts':_0x21f5df+'_'+(_0x21f5df===_0xae8f('0x9')?_0xae8f('0xf'):_0xae8f('0x10')),'interactions':_0x21f5df+_0xae8f('0x11'),'interactionsTags':_0x21f5df+_0xae8f('0x12'),'messages':_0x21f5df+_0xae8f('0x13'),'userInteractions':'user_has_'+_0x21f5df+_0xae8f('0x11')};}function getSelectedTags(_0x20191b){var _0x1aadb6=[];if(_0x20191b){_0x1aadb6=Array[_0xae8f('0x14')](_0x20191b)?_0x20191b:[_0x20191b];}return _0x1aadb6;}function log(_0x16105b,_0x3bc6dc,_0x5a2b42,_0x255b6d,_0x1ef838,_0x1326ea){loggers[_0x1ef838[_0xae8f('0x15')]()][_0x16105b](_0xae8f('0x16'),_0x1326ea['toUpperCase'](),_0x3bc6dc?_0x3bc6dc['id']:null,_0x3bc6dc?_0x3bc6dc[_0xae8f('0x17')]:null,_0x3bc6dc?_0x3bc6dc[_0xae8f('0x18')]:null,getInteractionId(_0x5a2b42,_0x255b6d,_0x1ef838),_0x5a2b42?JSON[_0xae8f('0x19')](_0x5a2b42):_0xae8f('0x1a'));}function updateUser(_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f){db[_[_0xae8f('0xd')](_0xd7e8d2)+_0xae8f('0x1b')][_0xae8f('0x1c')]({'where':{'id':getInteractionId(_0x1beb49,_0x48f34b,_0xd7e8d2)}})[_0xae8f('0x1d')](function(_0x183d1d){if(_0x183d1d){return _0x183d1d[_0xae8f('0x1e')]({'UserId':_0x3244af?_0x3244af['id']:null});}})[_0xae8f('0x1d')](function(_0x3a8a99){if(_0x3a8a99){log(_0xae8f('0x1f'),_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f);}})[_0xae8f('0x20')](function(){log('error',_0x3244af,_0x1beb49,_0x48f34b,_0xd7e8d2,_0x212d9f);});}function logAcceptMessage(_0x2c19b8,_0x1155d2,_0x2924a4,_0x5b14c5){var _0x5a1867=loggers[_0x2c19b8[_0xae8f('0x15')]()];var _0x70bd80=_0x1155d2['id'];var _0x3af725=_0x1155d2['name'];var _0xf5a57d=_0x1155d2['role'];var _0x865a7d=JSON[_0xae8f('0x19')](_0x5b14c5||null);_0x5a1867[_0xae8f('0x1f')]('['+_0x2c19b8[_0xae8f('0x21')]()+_0xae8f('0x22')+_0x70bd80+_0xae8f('0x23')+_0x3af725+_0xae8f('0x24')+_0xf5a57d+'\x20interaction='+_0x2924a4+_0xae8f('0x25')+_0x865a7d);}module[_0xae8f('0x26')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 192afad..7c8d0f6 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 _0x712d=['catch','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x712d,0x1f2));var _0xd712=function(_0x1a57e8,_0x387366){_0x1a57e8=_0x1a57e8-0x0;var _0x14af02=_0x712d[_0x1a57e8];return _0x14af02;};'use strict';var crypto=require(_0xd712('0x0'));var util=require(_0xd712('0x1'));var compose=require(_0xd712('0x2'));var db=require(_0xd712('0x3'))['db'];var config=require(_0xd712('0x4'));function getValueFromLicense(_0x4a348b,_0x3b1c4f){if(_0x4a348b&&_0x3b1c4f){if(_0x3b1c4f[_0xd712('0x5')]&&_0x3b1c4f['license']){var _0x53f863=_0x3b1c4f['data1'];var _0x47e807=_0x3b1c4f['license'];var _0x2e2c13=_0x53f863[_0xd712('0x6')]('-')[0x4];var _0x373c44=_0x53f863[_0xd712('0x6')]('-')[0x0];var _0x2c8a9b=crypto['createDecipher'](_0xd712('0x7'),util[_0xd712('0x8')](_0xd712('0x9'),_0x2e2c13,_0x53f863,_0x373c44));var _0x42347e=_0x2c8a9b[_0xd712('0xa')](_0x47e807,_0xd712('0xb'),_0xd712('0xc'));_0x42347e+=_0x2c8a9b[_0xd712('0xd')]('utf8');var _0x5b5782=JSON[_0xd712('0xe')](_0x42347e);return _0x5b5782[_0xd712('0xf')](_0x4a348b)?_0x5b5782[_0x4a348b]:null;}}return null;}function isLimit(_0x110e7e,_0x1ca1e1,_0x2e2fde,_0xa005dc){var _0x14ed1c=_0x1ca1e1;return compose()[_0xd712('0x10')](function(_0x4a78af,_0x4f10c4,_0x2c5ae6){return db[_0xd712('0x11')][_0xd712('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xd712('0x13')](function(_0x2b6187){var _0xc06930=getValueFromLicense(_0x110e7e,_0x2b6187);return _0xc06930?_0xc06930:_0x14ed1c;})[_0xd712('0x13')](function(_0x9565fb){_0x14ed1c=_0x9565fb;return _0x2e2fde[_0xd712('0x14')](_0xa005dc);})[_0xd712('0x13')](function(_0x5e5ee3){if(_0x5e5ee3>=_0x14ed1c){return _0x4f10c4[_0xd712('0x15')](0x193)[_0xd712('0x16')]({'message':util[_0xd712('0x8')](_0xd712('0x17'),_0x110e7e)});}_0x2c5ae6();})[_0xd712('0x18')](function(_0x23863f){_0x2c5ae6(_0x23863f);});});}function isUserLimit(){return isLimit(_0xd712('0x19'),0x1,db[_0xd712('0x1a')],{'where':{'$or':[{'role':_0xd712('0x1b')},{'role':'user'}]}});}exports[_0xd712('0x1c')]=isUserLimit; \ No newline at end of file +var _0xf8c4=['format','update','utf8','final','parse','License','findOne','then','count','User','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr'];(function(_0x1efd6f,_0x539485){var _0x44c2d9=function(_0x59e226){while(--_0x59e226){_0x1efd6f['push'](_0x1efd6f['shift']());}};_0x44c2d9(++_0x539485);}(_0xf8c4,0x1a9));var _0x4f8c=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0xf8c4[_0x4492af];return _0x216729;};'use strict';var crypto=require('crypto');var util=require(_0x4f8c('0x0'));var compose=require(_0x4f8c('0x1'));var db=require(_0x4f8c('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xd934b1,_0x25db0f){if(_0xd934b1&&_0x25db0f){if(_0x25db0f[_0x4f8c('0x3')]&&_0x25db0f[_0x4f8c('0x4')]){var _0x53f4e1=_0x25db0f[_0x4f8c('0x3')];var _0x543f00=_0x25db0f[_0x4f8c('0x4')];var _0x4f4f97=_0x53f4e1[_0x4f8c('0x5')]('-')[0x4];var _0x5241a9=_0x53f4e1[_0x4f8c('0x5')]('-')[0x0];var _0x51bc78=crypto['createDecipher'](_0x4f8c('0x6'),util[_0x4f8c('0x7')]('%s:%s:%s',_0x4f4f97,_0x53f4e1,_0x5241a9));var _0x38d5b9=_0x51bc78[_0x4f8c('0x8')](_0x543f00,'base64',_0x4f8c('0x9'));_0x38d5b9+=_0x51bc78[_0x4f8c('0xa')](_0x4f8c('0x9'));var _0x1f869a=JSON[_0x4f8c('0xb')](_0x38d5b9);return _0x1f869a['hasOwnProperty'](_0xd934b1)?_0x1f869a[_0xd934b1]:null;}}return null;}function isLimit(_0x39bd19,_0x3347f4,_0x2a73e8,_0x55d1c5){var _0x2be9bd=_0x3347f4;return compose()['use'](function(_0x41bc01,_0x57a6e9,_0x4e0db4){return db[_0x4f8c('0xc')][_0x4f8c('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x4f8c('0xe')](function(_0xb411d2){var _0x1536be=getValueFromLicense(_0x39bd19,_0xb411d2);return _0x1536be?_0x1536be:_0x2be9bd;})[_0x4f8c('0xe')](function(_0x3825f0){_0x2be9bd=_0x3825f0;return _0x2a73e8[_0x4f8c('0xf')](_0x55d1c5);})[_0x4f8c('0xe')](function(_0xff0a82){if(_0xff0a82>=_0x2be9bd){return _0x57a6e9['status'](0x193)['json']({'message':util[_0x4f8c('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x39bd19)});}_0x4e0db4();})['catch'](function(_0x480534){_0x4e0db4(_0x480534);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4f8c('0x10')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x4f8c('0x11')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3129ab3..787b963 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 _0xe0b6=['$gte','$between','start','shift','pop','utcOffset','hours','add','seconds','lodash','moment','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','filter','indexOf','map','conditions','DATE','operator','$eq','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe0b6,0x112));var _0x6e0b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe0b6[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x6e0b('0x0'));var moment=require(_0x6e0b('0x1'));exports['parseSearch']=function(_0x1d00b2){var _0x1b8be2={'conditions':[]};_0x1b8be2[_0x6e0b('0x2')]=_['startsWith'](_0x1d00b2,_0x6e0b('0x3'))?'or':_0x6e0b('0x4');var _0x463e37=_0x1d00b2[_0x6e0b('0x5')](_0x6e0b('0x6'),'')[_0x6e0b('0x5')]('[$or]','')[_0x6e0b('0x7')]('||');for(var _0x277d91=0x0;_0x277d91<_0x463e37[_0x6e0b('0x8')];_0x277d91++){var _0x5c9f0e=_0x463e37[_0x277d91][_0x6e0b('0x7')](':=');var _0x228fdf=_0x5c9f0e[0x0];var _0x3b98fb=_0x5c9f0e[_0x6e0b('0x9')](0x1);_0x3b98fb[_0x6e0b('0xa')](function(_0x47f288){var _0x42beca=_0x47f288[_0x6e0b('0x7')]('[')['shift']();var _0xee6b73=_0x47f288['match'](/\[(.*?)\]/g);_0xee6b73[_0x6e0b('0xa')](function(_0x5c2d1e){var _0x5b9115=_0x5c2d1e[_0x6e0b('0x7')]('[')[_0x6e0b('0xb')](function(_0x40c3a0){return _0x40c3a0[_0x6e0b('0xc')](']')>-0x1;})[_0x6e0b('0xd')](function(_0x26237c){return _0x26237c['split'](']')[0x0];})[0x0];_0x1b8be2[_0x6e0b('0xe')]['push']({'field':_0x228fdf,'operator':_0x42beca,'value':_0x5b9115});});});}return _0x1b8be2;};exports['buildExpression']=function(_0x4bb244,_0x485f9c,_0x4b8c61){var _0x1efb63={};if(_0x485f9c===_0x6e0b('0xf')){if(_0x4b8c61[_0x6e0b('0x10')]===_0x6e0b('0x11')){_0x4b8c61[_0x6e0b('0x10')]='$between';_0x4b8c61[_0x6e0b('0x12')]+=','+_0x4b8c61[_0x6e0b('0x12')];}else if(_[_0x6e0b('0x13')]([_0x6e0b('0x14'),'$lte'],_0x4b8c61[_0x6e0b('0x10')])){_0x4b8c61[_0x6e0b('0x12')]=moment(_0x4b8c61[_0x6e0b('0x12')])['add'](0x1,_0x6e0b('0x15'))[_0x6e0b('0x16')](_0x6e0b('0x17'));}}if(_0x4b8c61[_0x6e0b('0x18')]){_0x485f9c=_0x4b8c61[_0x6e0b('0x18')];_0x1efb63[_0x6e0b('0x19')]=_0x6e0b('0x1a')+_0x4bb244+'.'+_0x4b8c61[_0x6e0b('0x1b')]+_0x6e0b('0x1c')+_0x4b8c61[_0x6e0b('0x18')]+')\x20'+parseOperator(_0x4b8c61[_0x6e0b('0x10')]);}else{_0x1efb63[_0x6e0b('0x19')]=_0x4bb244+'.'+_0x4b8c61[_0x6e0b('0x1b')]+'\x20'+parseOperator(_0x4b8c61[_0x6e0b('0x10')]);}if(_[_0x6e0b('0x13')]([_0x6e0b('0x1d'),'$notIn'],_0x4b8c61['operator']))_0x1efb63[_0x6e0b('0x19')]='('+_0x1efb63[_0x6e0b('0x19')]+_0x6e0b('0x1e')+_0x4bb244+'.'+_0x4b8c61['field']+_0x6e0b('0x1f');_0x1efb63[_0x6e0b('0x12')]=parseValue(_0x485f9c,_0x4b8c61[_0x6e0b('0x10')],_0x4b8c61['value']);return _0x1efb63;};function parseOperator(_0x40c18d){var _0x1b1f9e;switch(_0x40c18d){case _0x6e0b('0x20'):_0x1b1f9e='IN\x20?';break;case'$notIn':_0x1b1f9e=_0x6e0b('0x21');break;case'$eq':_0x1b1f9e=_0x6e0b('0x22');break;case _0x6e0b('0x1d'):_0x1b1f9e=_0x6e0b('0x23');break;case _0x6e0b('0x24'):case _0x6e0b('0x25'):case _0x6e0b('0x26'):_0x1b1f9e=_0x6e0b('0x27');break;case'$lt':_0x1b1f9e=_0x6e0b('0x28');break;case _0x6e0b('0x14'):_0x1b1f9e=_0x6e0b('0x29');break;case _0x6e0b('0x2a'):_0x1b1f9e=_0x6e0b('0x2b');break;case _0x6e0b('0x2c'):_0x1b1f9e='>=\x20?';break;case _0x6e0b('0x2d'):_0x1b1f9e='BETWEEN\x20?\x20AND\x20?';break;}return _0x1b1f9e;}function parseValue(_0x37f79a,_0x4a0850,_0x330a79){var _0x1f6c41={'start':undefined,'end':undefined};switch(_0x4a0850){case'$in':case'$notIn':_0x1f6c41[_0x6e0b('0x2e')]=_0x330a79['split'](',');break;case'$substring':_0x1f6c41['start']='%'+_0x330a79+'%';break;case _0x6e0b('0x25'):_0x1f6c41[_0x6e0b('0x2e')]=_0x330a79+'%';break;case _0x6e0b('0x26'):_0x1f6c41[_0x6e0b('0x2e')]='%'+_0x330a79;break;case _0x6e0b('0x2d'):var _0x57bab0=_0x330a79['split'](',');var _0x330a79=_0x57bab0[_0x6e0b('0x2f')]();var _0x2427fa=_0x57bab0[_0x6e0b('0x30')]();if(_0x37f79a===_0x6e0b('0xf')){_0x330a79=moment(_0x330a79)[_0x6e0b('0x31')](0x0,!![])[_0x6e0b('0x16')]();_0x2427fa=moment(_0x2427fa)[_0x6e0b('0x31')](0x0,!![])['add'](0x17,_0x6e0b('0x32'))[_0x6e0b('0x33')](0x3b,'minutes')[_0x6e0b('0x33')](0x3b,_0x6e0b('0x34'))[_0x6e0b('0x16')]();}_0x1f6c41={'start':_0x330a79,'end':_0x2427fa};break;default:_0x1f6c41[_0x6e0b('0x2e')]=_0x330a79;break;}return _0x1f6c41;} \ No newline at end of file +var _0x93ad=['shift','match','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','[$or]','replace','[$and]','split','length','slice','forEach'];(function(_0x24c80a,_0x3e2fb5){var _0x56a264=function(_0x17a311){while(--_0x17a311){_0x24c80a['push'](_0x24c80a['shift']());}};_0x56a264(++_0x3e2fb5);}(_0x93ad,0x123));var _0xd93a=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0x93ad[_0x5bda3b];return _0x431bb9;};'use strict';var _=require(_0xd93a('0x0'));var moment=require(_0xd93a('0x1'));exports['parseSearch']=function(_0xde964c){var _0x58c06e={'conditions':[]};_0x58c06e['sqlOperator']=_['startsWith'](_0xde964c,_0xd93a('0x2'))?'or':'and';var _0x15cfa2=_0xde964c[_0xd93a('0x3')](_0xd93a('0x4'),'')[_0xd93a('0x3')](_0xd93a('0x2'),'')[_0xd93a('0x5')]('||');for(var _0x28ff28=0x0;_0x28ff28<_0x15cfa2[_0xd93a('0x6')];_0x28ff28++){var _0x46550c=_0x15cfa2[_0x28ff28][_0xd93a('0x5')](':=');var _0x4f7a6c=_0x46550c[0x0];var _0x42592e=_0x46550c[_0xd93a('0x7')](0x1);_0x42592e[_0xd93a('0x8')](function(_0xdbfab9){var _0x52953c=_0xdbfab9['split']('[')[_0xd93a('0x9')]();var _0xa56066=_0xdbfab9[_0xd93a('0xa')](/\[(.*?)\]/g);_0xa56066[_0xd93a('0x8')](function(_0x3f618b){var _0x29ea5a=_0x3f618b['split']('[')['filter'](function(_0x32c848){return _0x32c848[_0xd93a('0xb')](']')>-0x1;})[_0xd93a('0xc')](function(_0x4491b3){return _0x4491b3['split'](']')[0x0];})[0x0];_0x58c06e[_0xd93a('0xd')]['push']({'field':_0x4f7a6c,'operator':_0x52953c,'value':_0x29ea5a});});});}return _0x58c06e;};exports[_0xd93a('0xe')]=function(_0x44d8fb,_0x9289f7,_0x49499a){var _0x46d69d={};if(_0x9289f7===_0xd93a('0xf')){if(_0x49499a[_0xd93a('0x10')]==='$eq'){_0x49499a[_0xd93a('0x10')]=_0xd93a('0x11');_0x49499a[_0xd93a('0x12')]+=','+_0x49499a[_0xd93a('0x12')];}else if(_[_0xd93a('0x13')]([_0xd93a('0x14'),_0xd93a('0x15')],_0x49499a['operator'])){_0x49499a[_0xd93a('0x12')]=moment(_0x49499a[_0xd93a('0x12')])[_0xd93a('0x16')](0x1,'days')[_0xd93a('0x17')]('YYYY-MM-DD');}}if(_0x49499a[_0xd93a('0x18')]){_0x9289f7=_0x49499a[_0xd93a('0x18')];_0x46d69d[_0xd93a('0x19')]=_0xd93a('0x1a')+_0x44d8fb+'.'+_0x49499a[_0xd93a('0x1b')]+_0xd93a('0x1c')+_0x49499a[_0xd93a('0x18')]+')\x20'+parseOperator(_0x49499a[_0xd93a('0x10')]);}else{_0x46d69d[_0xd93a('0x19')]=_0x44d8fb+'.'+_0x49499a['field']+'\x20'+parseOperator(_0x49499a[_0xd93a('0x10')]);}if(_[_0xd93a('0x13')]([_0xd93a('0x1d'),_0xd93a('0x1e')],_0x49499a[_0xd93a('0x10')]))_0x46d69d[_0xd93a('0x19')]='('+_0x46d69d[_0xd93a('0x19')]+'\x20OR\x20'+_0x44d8fb+'.'+_0x49499a['field']+_0xd93a('0x1f');_0x46d69d[_0xd93a('0x12')]=parseValue(_0x9289f7,_0x49499a[_0xd93a('0x10')],_0x49499a[_0xd93a('0x12')]);return _0x46d69d;};function parseOperator(_0xa75fdc){var _0x2a1bee;switch(_0xa75fdc){case _0xd93a('0x20'):_0x2a1bee=_0xd93a('0x21');break;case _0xd93a('0x1e'):_0x2a1bee='NOT\x20IN\x20?';break;case _0xd93a('0x22'):_0x2a1bee=_0xd93a('0x23');break;case _0xd93a('0x1d'):_0x2a1bee='<>\x20?';break;case _0xd93a('0x24'):case _0xd93a('0x25'):case _0xd93a('0x26'):_0x2a1bee=_0xd93a('0x27');break;case _0xd93a('0x28'):_0x2a1bee=_0xd93a('0x29');break;case'$gt':_0x2a1bee=_0xd93a('0x2a');break;case _0xd93a('0x15'):_0x2a1bee='<=\x20?';break;case _0xd93a('0x2b'):_0x2a1bee=_0xd93a('0x2c');break;case _0xd93a('0x11'):_0x2a1bee='BETWEEN\x20?\x20AND\x20?';break;}return _0x2a1bee;}function parseValue(_0x1bef77,_0x55be73,_0x11fdf0){var _0x117797={'start':undefined,'end':undefined};switch(_0x55be73){case _0xd93a('0x20'):case _0xd93a('0x1e'):_0x117797[_0xd93a('0x2d')]=_0x11fdf0[_0xd93a('0x5')](',');break;case'$substring':_0x117797[_0xd93a('0x2d')]='%'+_0x11fdf0+'%';break;case _0xd93a('0x25'):_0x117797[_0xd93a('0x2d')]=_0x11fdf0+'%';break;case'$endsWith':_0x117797[_0xd93a('0x2d')]='%'+_0x11fdf0;break;case _0xd93a('0x11'):var _0xa1b6c0=_0x11fdf0[_0xd93a('0x5')](',');var _0x11fdf0=_0xa1b6c0[_0xd93a('0x9')]();var _0x9150e9=_0xa1b6c0[_0xd93a('0x2e')]();if(_0x1bef77===_0xd93a('0xf')){_0x11fdf0=moment(_0x11fdf0)[_0xd93a('0x2f')](0x0,!![])[_0xd93a('0x17')]();_0x9150e9=moment(_0x9150e9)['utcOffset'](0x0,!![])[_0xd93a('0x16')](0x17,'hours')[_0xd93a('0x16')](0x3b,_0xd93a('0x30'))[_0xd93a('0x16')](0x3b,_0xd93a('0x31'))[_0xd93a('0x17')]();}_0x117797={'start':_0x11fdf0,'end':_0x9150e9};break;default:_0x117797['start']=_0x11fdf0;break;}return _0x117797;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7802e4e..c86bbfc 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 _0x1edb=['DESC','col','unsigned','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','push','join','getOptions','query','$id','map','intersection','attributes','fields','nolimit','order','pick','filter','object','columns','merge','type','VIRTUAL','where','lower','options','include','includeAll','lodash','sequelize','moment','parse','includes','keys','model','alias','split','filters','isEmpty','forOwn','DATE','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','limit','offset','sort','indexOf','priority','cast','substr'];(function(_0xd8c600,_0x335c19){var _0x3efb17=function(_0x4a4b61){while(--_0x4a4b61){_0xd8c600['push'](_0xd8c600['shift']());}};_0x3efb17(++_0x335c19);}(_0x1edb,0xf8));var _0xb1ed=function(_0x3b0667,_0x3f5959){_0x3b0667=_0x3b0667-0x0;var _0x44c2ba=_0x1edb[_0x3b0667];return _0x44c2ba;};'use strict';var _=require(_0xb1ed('0x0'));var sequelize=require(_0xb1ed('0x1'));var moment=require(_0xb1ed('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x40898e){var _0x44c7a7=['ne'];try{var _0x203703=JSON[_0xb1ed('0x3')](_0x40898e);var _0xa3a807=Object['keys'](_0x203703)[0x0];return _0x44c7a7[_0xb1ed('0x4')](_0xa3a807);}catch(_0x48a08f){return![];}}function getOperatorValue(_0x3b3249){var _0x3a1f49=JSON['parse'](_0x3b3249);var _0x3f838e=Object[_0xb1ed('0x5')](_0x3a1f49)[0x0];var _0x523bb1=_0x3a1f49[_0x3f838e];return{['$'+_0x3f838e]:_0x523bb1};}function parseIncludeModel(_0x201f40){var _0x2bd9d9=JSON[_0xb1ed('0x3')](_0x201f40);return{'model':db[_0x2bd9d9[_0xb1ed('0x6')]],'as':_0x2bd9d9[_0xb1ed('0x7')],'attributes':_0x2bd9d9['fields'],'raw':_0x2bd9d9['raw']};}exports['fields']=function(_0x22c965){var _0x45a9c9=null;if(_0x22c965){_0x45a9c9=_0x22c965[_0xb1ed('0x8')](',');}return _0x45a9c9;};exports[_0xb1ed('0x9')]=function(_0x2f8384,_0x53ee38){var _0x39e060={};if(!_[_0xb1ed('0xa')](_0x2f8384)){_[_0xb1ed('0xb')](_0x2f8384,function(_0x143ac6,_0x15d68e){try{if(_0x53ee38){var _0x54d002=_['find'](_0x53ee38,{'name':_0x15d68e})||{};if(hasSequelizeOperator(_0x143ac6)){_0x39e060[_0x15d68e]=getOperatorValue(_0x143ac6);}else if(_0x54d002['type']===_0xb1ed('0xc')&&_['isPlainObject'](_0x143ac6)){var _0xe74be9=JSON[_0xb1ed('0x3')](_0x143ac6);var _0x596cb3={'$gte':moment(moment(_0xe74be9[_0xb1ed('0xd')])['format'](_0xb1ed('0xe')))[_0xb1ed('0xf')]()[_0xb1ed('0x10')](),'$lte':moment(moment(_0xe74be9[_0xb1ed('0x11')])[_0xb1ed('0x10')](_0xb1ed('0xe')))[_0xb1ed('0xf')]()[_0xb1ed('0x12')](0x1,'s')[_0xb1ed('0x10')]()};_0x39e060[_0x15d68e]=_0x596cb3;}else if(_0x54d002[_0xb1ed('0x13')]===_0xb1ed('0x14')){_0x39e060[_0x15d68e]=_0x143ac6;}else{_0x39e060[_0x15d68e]=_['isArray'](_0x143ac6)?_0x143ac6:JSON[_0xb1ed('0x3')](_0x143ac6);}}else{_0x39e060[_0x15d68e]=_['isArray'](_0x143ac6)?_0x143ac6:JSON[_0xb1ed('0x3')](_0x143ac6);}}catch(_0x386d20){_0x39e060[_0x15d68e]=_0x143ac6['split'](',');}});}return _0x39e060;};exports[_0xb1ed('0x15')]=function(_0x175fb8){_0x175fb8=parseInt(_0x175fb8,0xa);if(!_0x175fb8||_0x175fb8<0x0){_0x175fb8=LIMIT_VALUE;}return _0x175fb8;};exports[_0xb1ed('0x16')]=function(_0x43d2db){_0x43d2db=parseInt(_0x43d2db,0xa);if(!_0x43d2db||_0x43d2db<0x0){_0x43d2db=0x0;}return _0x43d2db;};exports[_0xb1ed('0x17')]=function(_0x14e2c2){var _0x5384b4,_0x47ddc8=null;if(_0x14e2c2){_0x5384b4=_0x14e2c2['split'](',');_0x47ddc8=_['map'](_0x5384b4,function(_0x514afe){if(_0x514afe[_0xb1ed('0x18')]('-')===0x0){return[_0x514afe===_0xb1ed('0x19')?sequelize[_0xb1ed('0x1a')](sequelize['col']('priority'),'unsigned'):_0x514afe[_0xb1ed('0x1b')](0x1),_0xb1ed('0x1c')];}else{return[_0x514afe==='priority'?sequelize[_0xb1ed('0x1a')](sequelize[_0xb1ed('0x1d')](_0xb1ed('0x19')),_0xb1ed('0x1e')):_0x514afe,_0xb1ed('0x1f')];}});}return _0x47ddc8;};exports[_0xb1ed('0x20')]=function(_0x132316,_0x182040){if(_[_0xb1ed('0xa')](_0x132316)){return _0x132316;}if(_[_0xb1ed('0x21')](_0x132316)){for(var _0x42ef6e=0x0;_0x42ef6e<_0x132316[_0xb1ed('0x22')];_0x42ef6e+=0x1){_0x132316[_0x42ef6e]=this[_0xb1ed('0x20')](_0x132316[_0x42ef6e],_0x182040);}return _0x132316;}if(!_[_0xb1ed('0x23')](_0x132316)){return _0x132316;}if(_[_0xb1ed('0x24')](_0x182040)){_0x182040=[_0x182040];}if(!_['isArray'](_0x182040)){return _0x132316;}for(var _0x5f17ec=0x0;_0x5f17ec<_0x182040['length'];_0x5f17ec+=0x1){_['unset'](_0x132316,_0x182040[_0x5f17ec]);}for(var _0x5850f2 in _0x132316){if(_0x132316[_0xb1ed('0x25')](_0x5850f2)){_0x132316[_0x5850f2]=this['omit'](_0x132316[_0x5850f2],_0x182040);}}return _0x132316;};exports['isNumeric']=function(_0xb8ceb){return _0xb8ceb['match'](RegExp(_0xb1ed('0x26')))?!![]:![];};exports[_0xb1ed('0x27')]=function(_0x257749){return _0x257749[_0xb1ed('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0xb1ed('0x29')]=function(_0x29050d,_0x3ee782){var _0x17947d=[];var _0xf90e83=/([^:]")"+/g;var _0x14e72f=/[*<>~@-]/g;var _0x501f0f=/[ `!@#$%^&*()_\-?~<>]/;var _0x59e554=/[ ,]+/;var _0x541b2f=_0x3ee782?_0xb1ed('0x2a'):_0xb1ed('0x2b');if(_0x3ee782){_0x29050d=_0x29050d[_0xb1ed('0x2c')](_0x14e72f,'\x20')[_0xb1ed('0x2d')]();}_0x29050d[_0xb1ed('0x8')](_0x59e554)['forEach'](function(_0x5ebb32){_0x5ebb32=_0x5ebb32[_0xb1ed('0x2c')](_0xf90e83,'$1');_0x5ebb32='+'+_0x5ebb32+'*';var _0x1ee37a=_0x5ebb32['match'](_0x501f0f);if(_0x1ee37a){_0x5ebb32='\x22'+_0x5ebb32+'\x22';}_0x17947d[_0xb1ed('0x2e')](_0x5ebb32);});_0x541b2f=_0x541b2f['replace'](_0xb1ed('0x2b'),_0x17947d[_0xb1ed('0x2f')]('\x20'));return _0x541b2f;};exports[_0xb1ed('0x30')]=function(_0x330e7b,_0x3cb9f0,_0x391a4e){var _0x574482={},_0x4c2774={};if(_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x32')]){_0x3cb9f0[_0xb1ed('0x31')]['id']=_0x3cb9f0[_0xb1ed('0x31')]['$id'];delete _0x3cb9f0['query']['$id'];}_0x574482[_0xb1ed('0x6')]=_[_0xb1ed('0x33')](_0x330e7b,_0xb1ed('0x13'));_0x574482[_0xb1ed('0x31')]=_[_0xb1ed('0x5')](_0x3cb9f0[_0xb1ed('0x31')]);_0x574482[_0xb1ed('0x9')]=_[_0xb1ed('0x34')](_0x574482[_0xb1ed('0x6')],_0x574482[_0xb1ed('0x31')]);_0x4c2774[_0xb1ed('0x35')]=_[_0xb1ed('0x34')](_0x574482['model'],this[_0xb1ed('0x36')](_0x3cb9f0['query'][_0xb1ed('0x36')]));_0x4c2774[_0xb1ed('0x35')]=_0x4c2774[_0xb1ed('0x35')][_0xb1ed('0x22')]?_0x4c2774['attributes']:_0x574482[_0xb1ed('0x6')];if(!_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x25')](_0xb1ed('0x37'))){_0x4c2774[_0xb1ed('0x15')]=this[_0xb1ed('0x15')](_0x3cb9f0['query'][_0xb1ed('0x15')]);_0x4c2774[_0xb1ed('0x16')]=this[_0xb1ed('0x16')](_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x16')]);}_0x4c2774[_0xb1ed('0x38')]=this['sort'](_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x17')]);_0x4c2774['where']=this[_0xb1ed('0x9')](_[_0xb1ed('0x39')](_0x3cb9f0[_0xb1ed('0x31')],_0x574482[_0xb1ed('0x9')]),_0x330e7b);if(_0x3cb9f0[_0xb1ed('0x31')]['filter']){var _0x16958a=_0x330e7b;var _0x2b895e=_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x3a')];if(typeof _0x2b895e===_0xb1ed('0x3b')){_0x16958a=_[_0xb1ed('0x3a')](_0x330e7b,function(_0x5cc8fa){return _[_0xb1ed('0x4')](_0x2b895e[_0xb1ed('0x3c')],_0x5cc8fa[_0xb1ed('0x13')]);});_0x2b895e=_0x2b895e['value'];}_0x4c2774['where']=_[_0xb1ed('0x3d')](_0x4c2774['where'],{'$or':_[_0xb1ed('0x33')](_0x16958a,function(_0x15f29b){if(_0x15f29b[_0xb1ed('0x3e')]!==_0xb1ed('0x3f')){if(_0x391a4e){return sequelize[_0xb1ed('0x40')](sequelize['fn'](_0xb1ed('0x41'),sequelize[_0xb1ed('0x1d')](_0x15f29b['name'])),{'$like':sequelize['fn'](_0xb1ed('0x41'),'%'+_0x3cb9f0[_0xb1ed('0x31')][_0xb1ed('0x3a')]+'%')});}else{var _0x1b949d={};_0x1b949d[_0x15f29b[_0xb1ed('0x13')]]={'$like':'%'+_0x3cb9f0[_0xb1ed('0x31')]['filter']+'%'};return _0x1b949d;}}})});}_0x4c2774=_[_0xb1ed('0x3d')]({},_0x4c2774,_0x3cb9f0[_0xb1ed('0x42')]);return _0x4c2774;};exports[_0xb1ed('0x43')]=function(_0x394065){var _0x2dd85b=[];if(_0x394065[_0xb1ed('0x44')]){_0x2dd85b['push']({'all':!![]});}else if(_0x394065['include']){if(Array[_0xb1ed('0x21')](_0x394065['include'])){_0x2dd85b=Object[_0xb1ed('0x5')](_0x394065[_0xb1ed('0x43')])[_0xb1ed('0x33')](function(_0x2d8823){return parseIncludeModel(_0x394065[_0xb1ed('0x43')][_0x2d8823]);});}else{var _0x4fd142=parseIncludeModel(_0x394065['include']);_0x2dd85b[_0xb1ed('0x2e')](_0x4fd142);}}return _0x2dd85b;};exports['escapeLIKESpecialChars']=function(_0x1720f1){return _0x1720f1[_0xb1ed('0x2c')](/[%_^-]/g,function(_0x1bd127){return'\x5c'+_0x1bd127;});}; \ No newline at end of file +var _0xfae0=['name','uniqueid','isArray','split','offset','sort','map','indexOf','priority','cast','unsigned','col','omit','isString','length','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','replace','push','join','getOptions','query','$id','intersection','attributes','fields','nolimit','limit','order','where','pick','object','filter','value','merge','type','lower','options','include','escapeLIKESpecialChars','sequelize','moment','../../mysqldb','parse','includes','keys','model','alias','raw','filters','isEmpty','forOwn','find','isPlainObject','format','$lte','YYYY-MM-DD','utc'];(function(_0x13cf5f,_0x5427f5){var _0x4c5537=function(_0x17432c){while(--_0x17432c){_0x13cf5f['push'](_0x13cf5f['shift']());}};_0x4c5537(++_0x5427f5);}(_0xfae0,0xab));var _0x0fae=function(_0x2eb35d,_0x4a7a45){_0x2eb35d=_0x2eb35d-0x0;var _0x1f9854=_0xfae0[_0x2eb35d];return _0x1f9854;};'use strict';var _=require('lodash');var sequelize=require(_0x0fae('0x0'));var moment=require(_0x0fae('0x1'));var db=require(_0x0fae('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xa9a45f){var _0x25c5e4=['ne'];try{var _0xefac5e=JSON[_0x0fae('0x3')](_0xa9a45f);var _0x3e1ee4=Object['keys'](_0xefac5e)[0x0];return _0x25c5e4[_0x0fae('0x4')](_0x3e1ee4);}catch(_0xdaab17){return![];}}function getOperatorValue(_0x44a444){var _0x4c5fa2=JSON[_0x0fae('0x3')](_0x44a444);var _0x1d5f0b=Object[_0x0fae('0x5')](_0x4c5fa2)[0x0];var _0x4716b9=_0x4c5fa2[_0x1d5f0b];return{['$'+_0x1d5f0b]:_0x4716b9};}function parseIncludeModel(_0x38567e){var _0x443055=JSON['parse'](_0x38567e);return{'model':db[_0x443055[_0x0fae('0x6')]],'as':_0x443055[_0x0fae('0x7')],'attributes':_0x443055['fields'],'raw':_0x443055[_0x0fae('0x8')]};}exports['fields']=function(_0x2d3301){var _0x224319=null;if(_0x2d3301){_0x224319=_0x2d3301['split'](',');}return _0x224319;};exports[_0x0fae('0x9')]=function(_0x5ed454,_0x3d83bb){var _0x5dfaed={};if(!_[_0x0fae('0xa')](_0x5ed454)){_[_0x0fae('0xb')](_0x5ed454,function(_0x4d595f,_0x41bdf4){try{if(_0x3d83bb){var _0x316179=_[_0x0fae('0xc')](_0x3d83bb,{'name':_0x41bdf4})||{};if(hasSequelizeOperator(_0x4d595f)){_0x5dfaed[_0x41bdf4]=getOperatorValue(_0x4d595f);}else if(_0x316179['type']==='DATE'&&_[_0x0fae('0xd')](_0x4d595f)){var _0x3c62ba=JSON[_0x0fae('0x3')](_0x4d595f);var _0x5b0f0f={'$gte':moment(moment(_0x3c62ba['$gte'])[_0x0fae('0xe')]('YYYY-MM-DD'))['utc']()[_0x0fae('0xe')](),'$lte':moment(moment(_0x3c62ba[_0x0fae('0xf')])[_0x0fae('0xe')](_0x0fae('0x10')))[_0x0fae('0x11')]()['subtract'](0x1,'s')[_0x0fae('0xe')]()};_0x5dfaed[_0x41bdf4]=_0x5b0f0f;}else if(_0x316179[_0x0fae('0x12')]===_0x0fae('0x13')){_0x5dfaed[_0x41bdf4]=_0x4d595f;}else{_0x5dfaed[_0x41bdf4]=_['isArray'](_0x4d595f)?_0x4d595f:JSON['parse'](_0x4d595f);}}else{_0x5dfaed[_0x41bdf4]=_[_0x0fae('0x14')](_0x4d595f)?_0x4d595f:JSON[_0x0fae('0x3')](_0x4d595f);}}catch(_0x57cd07){_0x5dfaed[_0x41bdf4]=_0x4d595f[_0x0fae('0x15')](',');}});}return _0x5dfaed;};exports['limit']=function(_0x34239a){_0x34239a=parseInt(_0x34239a,0xa);if(!_0x34239a||_0x34239a<0x0){_0x34239a=LIMIT_VALUE;}return _0x34239a;};exports[_0x0fae('0x16')]=function(_0x5d813d){_0x5d813d=parseInt(_0x5d813d,0xa);if(!_0x5d813d||_0x5d813d<0x0){_0x5d813d=0x0;}return _0x5d813d;};exports[_0x0fae('0x17')]=function(_0x133398){var _0x2b57d5,_0x4812e6=null;if(_0x133398){_0x2b57d5=_0x133398[_0x0fae('0x15')](',');_0x4812e6=_[_0x0fae('0x18')](_0x2b57d5,function(_0x33893e){if(_0x33893e[_0x0fae('0x19')]('-')===0x0){return[_0x33893e===_0x0fae('0x1a')?sequelize[_0x0fae('0x1b')](sequelize['col'](_0x0fae('0x1a')),_0x0fae('0x1c')):_0x33893e['substr'](0x1),'DESC'];}else{return[_0x33893e===_0x0fae('0x1a')?sequelize[_0x0fae('0x1b')](sequelize[_0x0fae('0x1d')](_0x0fae('0x1a')),_0x0fae('0x1c')):_0x33893e,'ASC'];}});}return _0x4812e6;};exports[_0x0fae('0x1e')]=function(_0x2adde9,_0x158aca){if(_['isEmpty'](_0x2adde9)){return _0x2adde9;}if(_[_0x0fae('0x14')](_0x2adde9)){for(var _0x5d3557=0x0;_0x5d3557<_0x2adde9['length'];_0x5d3557+=0x1){_0x2adde9[_0x5d3557]=this[_0x0fae('0x1e')](_0x2adde9[_0x5d3557],_0x158aca);}return _0x2adde9;}if(!_['isObject'](_0x2adde9)){return _0x2adde9;}if(_[_0x0fae('0x1f')](_0x158aca)){_0x158aca=[_0x158aca];}if(!_[_0x0fae('0x14')](_0x158aca)){return _0x2adde9;}for(var _0x20f332=0x0;_0x20f332<_0x158aca[_0x0fae('0x20')];_0x20f332+=0x1){_[_0x0fae('0x21')](_0x2adde9,_0x158aca[_0x20f332]);}for(var _0x1fa978 in _0x2adde9){if(_0x2adde9[_0x0fae('0x22')](_0x1fa978)){_0x2adde9[_0x1fa978]=this['omit'](_0x2adde9[_0x1fa978],_0x158aca);}}return _0x2adde9;};exports['isNumeric']=function(_0x4e32af){return _0x4e32af['match'](RegExp(_0x0fae('0x23')))?!![]:![];};exports[_0x0fae('0x24')]=function(_0x1d8b06){return _0x1d8b06[_0x0fae('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x0fae('0x26')]=function(_0x2e8232,_0x984a8c){var _0x5b03d0=[];var _0x3c3db3=/([^:]")"+/g;var _0x26de10=/[*<>~@-]/g;var _0x1692df=/[ `!@#$%^&*()_\-?~<>]/;var _0x3869b9=/[ ,]+/;var _0x5491e4=_0x984a8c?'\x22{EXPR}\x22':_0x0fae('0x27');if(_0x984a8c){_0x2e8232=_0x2e8232[_0x0fae('0x28')](_0x26de10,'\x20')['trim']();}_0x2e8232['split'](_0x3869b9)['forEach'](function(_0x477e03){_0x477e03=_0x477e03[_0x0fae('0x28')](_0x3c3db3,'$1');_0x477e03='+'+_0x477e03+'*';var _0x439ada=_0x477e03[_0x0fae('0x25')](_0x1692df);if(_0x439ada){_0x477e03='\x22'+_0x477e03+'\x22';}_0x5b03d0[_0x0fae('0x29')](_0x477e03);});_0x5491e4=_0x5491e4[_0x0fae('0x28')](_0x0fae('0x27'),_0x5b03d0[_0x0fae('0x2a')]('\x20'));return _0x5491e4;};exports[_0x0fae('0x2b')]=function(_0x3744b6,_0x5f2c9f,_0x4ef82e){var _0x1a31bd={},_0x4b8e8b={};if(_0x5f2c9f[_0x0fae('0x2c')]['$id']){_0x5f2c9f[_0x0fae('0x2c')]['id']=_0x5f2c9f['query'][_0x0fae('0x2d')];delete _0x5f2c9f['query'][_0x0fae('0x2d')];}_0x1a31bd['model']=_[_0x0fae('0x18')](_0x3744b6,_0x0fae('0x12'));_0x1a31bd['query']=_['keys'](_0x5f2c9f['query']);_0x1a31bd['filters']=_[_0x0fae('0x2e')](_0x1a31bd[_0x0fae('0x6')],_0x1a31bd[_0x0fae('0x2c')]);_0x4b8e8b[_0x0fae('0x2f')]=_[_0x0fae('0x2e')](_0x1a31bd['model'],this[_0x0fae('0x30')](_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x30')]));_0x4b8e8b['attributes']=_0x4b8e8b[_0x0fae('0x2f')][_0x0fae('0x20')]?_0x4b8e8b[_0x0fae('0x2f')]:_0x1a31bd['model'];if(!_0x5f2c9f[_0x0fae('0x2c')]['hasOwnProperty'](_0x0fae('0x31'))){_0x4b8e8b[_0x0fae('0x32')]=this[_0x0fae('0x32')](_0x5f2c9f[_0x0fae('0x2c')]['limit']);_0x4b8e8b[_0x0fae('0x16')]=this['offset'](_0x5f2c9f['query'][_0x0fae('0x16')]);}_0x4b8e8b[_0x0fae('0x33')]=this[_0x0fae('0x17')](_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x17')]);_0x4b8e8b[_0x0fae('0x34')]=this[_0x0fae('0x9')](_[_0x0fae('0x35')](_0x5f2c9f[_0x0fae('0x2c')],_0x1a31bd[_0x0fae('0x9')]),_0x3744b6);if(_0x5f2c9f[_0x0fae('0x2c')]['filter']){var _0x4714ce=_0x3744b6;var _0x282d69=_0x5f2c9f['query']['filter'];if(typeof _0x282d69===_0x0fae('0x36')){_0x4714ce=_[_0x0fae('0x37')](_0x3744b6,function(_0x2c651d){return _[_0x0fae('0x4')](_0x282d69['columns'],_0x2c651d[_0x0fae('0x12')]);});_0x282d69=_0x282d69[_0x0fae('0x38')];}_0x4b8e8b[_0x0fae('0x34')]=_[_0x0fae('0x39')](_0x4b8e8b[_0x0fae('0x34')],{'$or':_[_0x0fae('0x18')](_0x4714ce,function(_0x4b7a07){if(_0x4b7a07[_0x0fae('0x3a')]!=='VIRTUAL'){if(_0x4ef82e){return sequelize[_0x0fae('0x34')](sequelize['fn'](_0x0fae('0x3b'),sequelize[_0x0fae('0x1d')](_0x4b7a07[_0x0fae('0x12')])),{'$like':sequelize['fn'](_0x0fae('0x3b'),'%'+_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x37')]+'%')});}else{var _0x37a143={};_0x37a143[_0x4b7a07['name']]={'$like':'%'+_0x5f2c9f[_0x0fae('0x2c')][_0x0fae('0x37')]+'%'};return _0x37a143;}}})});}_0x4b8e8b=_[_0x0fae('0x39')]({},_0x4b8e8b,_0x5f2c9f[_0x0fae('0x3c')]);return _0x4b8e8b;};exports['include']=function(_0x8347c3){var _0x57fb64=[];if(_0x8347c3['includeAll']){_0x57fb64['push']({'all':!![]});}else if(_0x8347c3[_0x0fae('0x3d')]){if(Array['isArray'](_0x8347c3[_0x0fae('0x3d')])){_0x57fb64=Object[_0x0fae('0x5')](_0x8347c3['include'])['map'](function(_0x84d9fa){return parseIncludeModel(_0x8347c3[_0x0fae('0x3d')][_0x84d9fa]);});}else{var _0x236f85=parseIncludeModel(_0x8347c3['include']);_0x57fb64[_0x0fae('0x29')](_0x236f85);}}return _0x57fb64;};exports[_0x0fae('0x3e')]=function(_0x1e200f){return _0x1e200f['replace'](/[%_^-]/g,function(_0x2d9c21){return'\x5c'+_0x2d9c21;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8e3f656..debe0c3 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 _0x7fb3=['ASC','fullname,internal','fullname','substring','indexOf','internal','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','screenrecording','pick','value','filterAgentAttributes','role','lastLoginAt','faxStatusTime','voiceStatusTime','chatCapacity','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','voiceStatus','pause','every','chatStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','getAgentStatus','isArray','startCase','findOne','getAgents','all','flatten','map','uniq','getAgentIdsByQueues','includes','busy','getAgentIdsByStatus','resolve','User','findAll','name','whatsappPause','pauseType','globalStatus','split','fields','order','startsWith'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fb3,0xf9));var _0x37fb=function(_0x4c8833,_0x14e755){_0x4c8833=_0x4c8833-0x0;var _0x30df54=_0x7fb3[_0x4c8833];return _0x30df54;};'use strict';var _=require(_0x37fb('0x0'));var jayson=require(_0x37fb('0x1'));var db=require(_0x37fb('0x2'))['db'];var amiClient=jayson[_0x37fb('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x37fb('0x3')][_0x37fb('0x4')]({'port':0x232c});function isAgentPaused(_0x45b389,_0x1457c3){var _0x5c7d76=[_0x45b389[_0x37fb('0x5')],_0x45b389[_0x37fb('0x6')],_0x45b389[_0x37fb('0x7')],_0x45b389[_0x37fb('0x8')],_0x45b389[_0x37fb('0x9')],_0x45b389[_0x37fb('0xa')],_0x45b389['whatsappPause']];if(!_0x1457c3)return _['every'](_0x5c7d76);var _0x4ee5e0=_[_0x37fb('0xb')](_0x5c7d76);return _0x4ee5e0[_0x37fb('0xc')]>0x0&&_0x4ee5e0[_0x37fb('0xc')]<_0x5c7d76[_0x37fb('0xc')]?!![]:![];}function isIdle(_0xdfb3d0){return _0xdfb3d0===_0x37fb('0xd')||_0xdfb3d0===_0x37fb('0xe')||_0xdfb3d0===_0x37fb('0xf')||_0xdfb3d0==='ringing'||_['isNil'](_0xdfb3d0);}function isAgentIdle(_0x37905f){if(_0x37905f[_0x37fb('0x10')]!==_0x37fb('0xd')&&_0x37905f[_0x37fb('0xa')]){_0x37905f[_0x37fb('0x10')]=_0x37fb('0x11');return![];}return _[_0x37fb('0x12')]([_0x37905f[_0x37fb('0x13')],_0x37905f['faxStatus'],_0x37905f['mailStatus'],_0x37905f[_0x37fb('0x14')],_0x37905f[_0x37fb('0x15')],_0x37905f[_0x37fb('0x10')],_0x37905f[_0x37fb('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x37fb('0x17'),{})['then'](function(_0x2efec0){if(_0x2efec0[_0x37fb('0x18')]){throw new Error(_0x37fb('0x19'));}var _0xae35e=_0x2efec0[_0x37fb('0x1a')];return routingClient[_0x37fb('0x1b')](_0x37fb('0x17'),{})[_0x37fb('0x1c')](function(_0x100977){if(_0x100977[_0x37fb('0x18')]){throw new Error(_0x37fb('0x1d'));}var _0x2ea308=_0x100977[_0x37fb('0x1a')];return _[_0x37fb('0x1e')]({},_0xae35e,_0x2ea308);});})[_0x37fb('0x1f')](function(_0x85b030){throw _0x85b030;});}exports[_0x37fb('0x20')]=getRealtimeAgents;function getAgentStatus(_0xd55293){var _0x25b8f5=_0x37fb('0xe');if(isAgentPaused(_0xd55293))_0x25b8f5=_0x37fb('0x11');else if(isAgentPaused(_0xd55293,!![]))_0x25b8f5='*pause';else if(isAgentIdle(_0xd55293))_0x25b8f5=_0x37fb('0xd');else _0x25b8f5='busy';return _0x25b8f5;}exports[_0x37fb('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x19014b,_0x1d68b5){var _0x215cd0=_[_0x37fb('0x22')](_0x19014b)?_0x19014b:[_0x19014b];var _0xad9b69=_[_0x37fb('0x23')](_0x1d68b5)+'Queue';var _0x2b483e=_['map'](_0x215cd0,function(_0x496320){return db[_0xad9b69][_0x37fb('0x24')]({'where':{'id':_0x496320}})['then'](function(_0x2bbb78){if(!_0x2bbb78)return[];return _0x2bbb78[_0x37fb('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x37fb('0x26')](_0x2b483e)[_0x37fb('0x1c')](function(_0x408024){var _0x1bc6e1=_(_0x408024)[_0x37fb('0x27')]()[_0x37fb('0x28')]('id')[_0x37fb('0x29')]()['value']();return _0x1bc6e1;});}exports[_0x37fb('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x283af9,_0x4e620b,_0x5f189a){try{if(_0x4e620b[_0x37fb('0xc')]>0x0){_0x283af9=_0x283af9[_0x37fb('0xb')](function(_0xfe4421){return _0x4e620b[_0x37fb('0x2b')](_0xfe4421['id']);});}var _0x38988f=_0x283af9[_0x37fb('0xb')](function(_0x531e03){var _0x915b0d=_0x37fb('0x2c');if(isAgentIdle(_0x531e03)){_0x915b0d=_0x37fb('0xd');}return _0x915b0d===_0x5f189a;});return _['map'](_0x38988f,'id');}catch(_0x435614){throw _0x435614;}}exports[_0x37fb('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x23e7f2,_0x203a00,_0x3abd59){return Promise[_0x37fb('0x2e')]()[_0x37fb('0x1c')](function(){if(_0x203a00[_0x37fb('0xc')]>0x0){_0x23e7f2=_0x23e7f2[_0x37fb('0xb')](function(_0xafe001){return _0x203a00[_0x37fb('0x2b')](_0xafe001['id']);});}return _0x23e7f2;})['then'](function(){return db[_0x37fb('0x2f')][_0x37fb('0x30')]({'attributes':['id',_0x37fb('0x31'),'fullname',_0x37fb('0x5'),_0x37fb('0x6'),'mailPause',_0x37fb('0x8'),_0x37fb('0x9'),_0x37fb('0xa'),_0x37fb('0x32'),_0x37fb('0x33')],'where':{'id':{'$in':_['map'](_0x23e7f2,'id')}},'raw':!![]});})[_0x37fb('0x1c')](function(_0x2b879a){return _0x2b879a[_0x37fb('0x28')](function(_0x49d5b0){var _0x3eee02=_['find'](_0x23e7f2,['id',_0x49d5b0['id']]);var _0x25213a=filterAgentAttributes(_0x3eee02);_['merge'](_0x49d5b0,_0x25213a);_0x49d5b0[_0x37fb('0x34')]=getAgentStatus(_0x49d5b0);return _0x49d5b0;});})['then'](function(_0x20d125){var _0x2ad8ae=sortAgentsByStatus(_0x20d125,_0x3abd59);return _['map'](_0x2ad8ae,'id');})['catch'](function(_0x2b7464){throw _0x2b7464;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5a755){var _0x13b622={'fields':[],'order':null};var _0x3dca12=_0x5a755[_0x37fb('0x35')](',');_0x13b622[_0x37fb('0x36')]=_[_0x37fb('0xb')](_0x3dca12,function(_0x5cb19c){if(!_0x5cb19c['includes'](_0x37fb('0x34'))){return!![];}_0x13b622[_0x37fb('0x37')]=_[_0x37fb('0x38')](_0x5cb19c,'-')?'DESC':_0x37fb('0x39');return![];});return _0x13b622;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x29efbc){if(!_0x29efbc){_0x29efbc=_0x37fb('0x3a');}if(_0x29efbc[_0x37fb('0x2b')](_0x37fb('0x3b'))&&!_0x29efbc['includes']('internal')){var _0x4a0d40=_0x29efbc[_0x37fb('0x3c')](0x0,_0x29efbc[_0x37fb('0x3d')](_0x37fb('0x3b')));_0x29efbc+=','+_0x4a0d40+_0x37fb('0x3e');}return _0x29efbc;}exports[_0x37fb('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x43d607,_0xec05c6){var _0x27847e=_0x43d607[_0x37fb('0x40')](function(_0x50dc83,_0x5e14ff){if(_0x50dc83[_0x37fb('0x34')]===_0x5e14ff['globalStatus']){if(_0x50dc83[_0x37fb('0x34')]===_0x37fb('0x11')){if(_0xec05c6===_0x37fb('0x41')){return(_0x50dc83[_0x37fb('0x33')]||'')<(_0x5e14ff['pauseType']||'')||_0x50dc83[_0x37fb('0x3b')]['toLowerCase']()>_0x5e14ff[_0x37fb('0x3b')][_0x37fb('0x42')]()?0x1:-0x1;}else{return(_0x50dc83[_0x37fb('0x33')]||'')<(_0x5e14ff[_0x37fb('0x33')]||'')||_0x50dc83[_0x37fb('0x3b')]['toLowerCase']()>_0x5e14ff[_0x37fb('0x3b')][_0x37fb('0x42')]()?-0x1:0x1;}}else{if(_0xec05c6==='DESC'){return _0x50dc83[_0x37fb('0x3b')][_0x37fb('0x42')]()<_0x5e14ff[_0x37fb('0x3b')][_0x37fb('0x42')]()?0x1:-0x1;}else{return _0x50dc83[_0x37fb('0x3b')][_0x37fb('0x42')]()<_0x5e14ff[_0x37fb('0x3b')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0xec05c6===_0x37fb('0x41')){return _0x50dc83[_0x37fb('0x34')]<_0x5e14ff['globalStatus']?0x1:-0x1;}else{return _0x50dc83[_0x37fb('0x34')]<_0x5e14ff[_0x37fb('0x34')]?-0x1:0x1;}}});return _0x27847e;}exports[_0x37fb('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x105632){var _0x48220f=[_0x37fb('0x44'),_0x37fb('0x45'),'lastLoginAt',_0x37fb('0x46'),_0x37fb('0x33'),_0x37fb('0x46'),_0x37fb('0x3e'),_0x37fb('0x47'),'chatPause','openchannelPause',_0x37fb('0x7'),_0x37fb('0x9'),_0x37fb('0x32'),'faxPause',_0x37fb('0xa'),'chatCapacity',_0x37fb('0x48'),_0x37fb('0x49'),_0x37fb('0x4a'),_0x37fb('0x4b'),'faxCapacity',_0x37fb('0x4c'),_0x37fb('0x4d'),_0x37fb('0x4e'),_0x37fb('0x4f'),_0x37fb('0x50'),_0x37fb('0x51'),_0x37fb('0x13'),_0x37fb('0x14'),_0x37fb('0x52'),_0x37fb('0x15'),'whatsappStatus',_0x37fb('0x53'),'voiceStatus',_0x37fb('0x54'),_0x37fb('0x55'),_0x37fb('0x56'),_0x37fb('0x57'),_0x37fb('0x58'),'faxStatusTime','voiceStatusTime',_0x37fb('0x59'),'destconnectedlinenum',_0x37fb('0x5a'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording'];var _0x4ed531=[_0x37fb('0x5'),_0x37fb('0x8'),_0x37fb('0x7'),_0x37fb('0x9'),_0x37fb('0x32'),_0x37fb('0x6'),_0x37fb('0xa'),_0x37fb('0x45')];var _0x39b429=_(_0x105632)['omit'](_0x4ed531)[_0x37fb('0x5b')](_0x48220f)[_0x37fb('0x5c')]();return _0x39b429;}exports[_0x37fb('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x37fb('0x3b'),_0x37fb('0x5e'),_0x37fb('0x3e'),_0x37fb('0x45'),_0x37fb('0x34'),_0x37fb('0x44'),_0x37fb('0x5f'),'pauseType',_0x37fb('0x46'),_0x37fb('0x6'),'chatPause',_0x37fb('0x7'),_0x37fb('0x8'),_0x37fb('0x9'),_0x37fb('0xa'),_0x37fb('0x32'),_0x37fb('0x13'),'faxStatus','mailStatus',_0x37fb('0x14'),_0x37fb('0x15'),_0x37fb('0x10'),'whatsappStatus','chatStatusTime',_0x37fb('0x60'),_0x37fb('0x56'),_0x37fb('0x55'),_0x37fb('0x57'),_0x37fb('0x61'),_0x37fb('0x58'),_0x37fb('0x62'),'faxCapacity','mailCapacity','openchannelCapacity',_0x37fb('0x4a'),_0x37fb('0x4b'),_0x37fb('0x4c'),_0x37fb('0x51'),_0x37fb('0x4e'),_0x37fb('0x4d'),_0x37fb('0x4f'),'whatsappCurrentCapacity',_0x37fb('0x63'),_0x37fb('0x64'),'destconnectedlinenum','onhold','queue',_0x37fb('0x5a')];}exports[_0x37fb('0x65')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x1c01=['destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','value','filterAgentAttributes','role','faxStatusTime','faxCapacity','openchannelCapacity','whatsappCapacity','onhold','queue','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','chatPause','faxPause','mailPause','smsPause','whatsappPause','length','unknown','unavailable','ringing','isNil','idle','voicePause','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','filter','includes','resolve','User','name','openchannelPause','pauseType','find','globalStatus','catch','split','fields','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','fullname','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1c01,0x190));var _0x11c0=function(_0x110a96,_0x178352){_0x110a96=_0x110a96-0x0;var _0x2dd9a9=_0x1c01[_0x110a96];return _0x2dd9a9;};'use strict';var _=require(_0x11c0('0x0'));var jayson=require(_0x11c0('0x1'));var db=require(_0x11c0('0x2'))['db'];var amiClient=jayson[_0x11c0('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x11c0('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x484b2c,_0x218e37){var _0x15f4c1=[_0x484b2c[_0x11c0('0x4')],_0x484b2c[_0x11c0('0x5')],_0x484b2c[_0x11c0('0x6')],_0x484b2c['openchannelPause'],_0x484b2c[_0x11c0('0x7')],_0x484b2c['voicePause'],_0x484b2c[_0x11c0('0x8')]];if(!_0x218e37)return _['every'](_0x15f4c1);var _0x127b2f=_['filter'](_0x15f4c1);return _0x127b2f[_0x11c0('0x9')]>0x0&&_0x127b2f['length']<_0x15f4c1['length']?!![]:![];}function isIdle(_0xba38f){return _0xba38f==='idle'||_0xba38f===_0x11c0('0xa')||_0xba38f===_0x11c0('0xb')||_0xba38f===_0x11c0('0xc')||_[_0x11c0('0xd')](_0xba38f);}function isAgentIdle(_0x3cc04b){if(_0x3cc04b['voiceStatus']!==_0x11c0('0xe')&&_0x3cc04b[_0x11c0('0xf')]){_0x3cc04b[_0x11c0('0x10')]=_0x11c0('0x11');return![];}return _['every']([_0x3cc04b['chatStatus'],_0x3cc04b[_0x11c0('0x12')],_0x3cc04b[_0x11c0('0x13')],_0x3cc04b[_0x11c0('0x14')],_0x3cc04b[_0x11c0('0x15')],_0x3cc04b[_0x11c0('0x10')],_0x3cc04b[_0x11c0('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x11c0('0x17')]('Agents',{})[_0x11c0('0x18')](function(_0x5da595){if(_0x5da595[_0x11c0('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x345389=_0x5da595[_0x11c0('0x1a')];return routingClient[_0x11c0('0x17')]('Agents',{})[_0x11c0('0x18')](function(_0xe9958e){if(_0xe9958e[_0x11c0('0x19')]){throw new Error(_0x11c0('0x1b'));}var _0x14c192=_0xe9958e[_0x11c0('0x1a')];return _['merge']({},_0x345389,_0x14c192);});})['catch'](function(_0x165860){throw _0x165860;});}exports[_0x11c0('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x369562){var _0x205f6a=_0x11c0('0xa');if(isAgentPaused(_0x369562))_0x205f6a=_0x11c0('0x11');else if(isAgentPaused(_0x369562,!![]))_0x205f6a=_0x11c0('0x1d');else if(isAgentIdle(_0x369562))_0x205f6a=_0x11c0('0xe');else _0x205f6a='busy';return _0x205f6a;}exports[_0x11c0('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x1f6ae1,_0x57b6bd){var _0x1d27dc=_[_0x11c0('0x1f')](_0x1f6ae1)?_0x1f6ae1:[_0x1f6ae1];var _0x303c1b=_[_0x11c0('0x20')](_0x57b6bd)+_0x11c0('0x21');var _0x4f8c9d=_[_0x11c0('0x22')](_0x1d27dc,function(_0x3c3dd7){return db[_0x303c1b][_0x11c0('0x23')]({'where':{'id':_0x3c3dd7}})[_0x11c0('0x18')](function(_0x5952dc){if(!_0x5952dc)return[];return _0x5952dc[_0x11c0('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x11c0('0x25')](_0x4f8c9d)[_0x11c0('0x18')](function(_0x5730a2){var _0x349ecc=_(_0x5730a2)[_0x11c0('0x26')]()['map']('id')['uniq']()['value']();return _0x349ecc;});}exports[_0x11c0('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x229427,_0x73df10,_0x1099fe){try{if(_0x73df10[_0x11c0('0x9')]>0x0){_0x229427=_0x229427[_0x11c0('0x28')](function(_0x3bf582){return _0x73df10[_0x11c0('0x29')](_0x3bf582['id']);});}var _0x2fbe0c=_0x229427['filter'](function(_0x1b9316){var _0x1059dc='busy';if(isAgentIdle(_0x1b9316)){_0x1059dc=_0x11c0('0xe');}return _0x1059dc===_0x1099fe;});return _[_0x11c0('0x22')](_0x2fbe0c,'id');}catch(_0x299d6d){throw _0x299d6d;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x50fd9e,_0x4540dc,_0x3c6f6e){return Promise[_0x11c0('0x2a')]()[_0x11c0('0x18')](function(){if(_0x4540dc['length']>0x0){_0x50fd9e=_0x50fd9e[_0x11c0('0x28')](function(_0x579c02){return _0x4540dc[_0x11c0('0x29')](_0x579c02['id']);});}return _0x50fd9e;})[_0x11c0('0x18')](function(){return db[_0x11c0('0x2b')]['findAll']({'attributes':['id',_0x11c0('0x2c'),'fullname',_0x11c0('0x4'),'faxPause',_0x11c0('0x6'),_0x11c0('0x2d'),_0x11c0('0x7'),_0x11c0('0xf'),_0x11c0('0x8'),_0x11c0('0x2e')],'where':{'id':{'$in':_['map'](_0x50fd9e,'id')}},'raw':!![]});})[_0x11c0('0x18')](function(_0x590e02){return _0x590e02[_0x11c0('0x22')](function(_0x569d0f){var _0x2b7ace=_[_0x11c0('0x2f')](_0x50fd9e,['id',_0x569d0f['id']]);var _0x480a3c=filterAgentAttributes(_0x2b7ace);_['merge'](_0x569d0f,_0x480a3c);_0x569d0f[_0x11c0('0x30')]=getAgentStatus(_0x569d0f);return _0x569d0f;});})['then'](function(_0x3a1e64){var _0x3e715e=sortAgentsByStatus(_0x3a1e64,_0x3c6f6e);return _[_0x11c0('0x22')](_0x3e715e,'id');})[_0x11c0('0x31')](function(_0xa0f6d4){throw _0xa0f6d4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x569b2e){var _0x1ffcea={'fields':[],'order':null};var _0x2b6f4c=_0x569b2e[_0x11c0('0x32')](',');_0x1ffcea[_0x11c0('0x33')]=_[_0x11c0('0x28')](_0x2b6f4c,function(_0x308e40){if(!_0x308e40[_0x11c0('0x29')](_0x11c0('0x30'))){return!![];}_0x1ffcea['order']=_[_0x11c0('0x34')](_0x308e40,'-')?_0x11c0('0x35'):'ASC';return![];});return _0x1ffcea;}exports[_0x11c0('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x4ef2fb){if(!_0x4ef2fb){_0x4ef2fb=_0x11c0('0x37');}if(_0x4ef2fb[_0x11c0('0x29')]('fullname')&&!_0x4ef2fb[_0x11c0('0x29')](_0x11c0('0x38'))){var _0x565818=_0x4ef2fb[_0x11c0('0x39')](0x0,_0x4ef2fb[_0x11c0('0x3a')](_0x11c0('0x3b')));_0x4ef2fb+=','+_0x565818+'internal';}return _0x4ef2fb;}exports[_0x11c0('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x58f530,_0x2645e9){var _0x50a00c=_0x58f530['sort'](function(_0x4659a5,_0x2e68f4){if(_0x4659a5[_0x11c0('0x30')]===_0x2e68f4[_0x11c0('0x30')]){if(_0x4659a5[_0x11c0('0x30')]===_0x11c0('0x11')){if(_0x2645e9===_0x11c0('0x35')){return(_0x4659a5[_0x11c0('0x2e')]||'')<(_0x2e68f4[_0x11c0('0x2e')]||'')||_0x4659a5['fullname'][_0x11c0('0x3d')]()>_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?0x1:-0x1;}else{return(_0x4659a5[_0x11c0('0x2e')]||'')<(_0x2e68f4['pauseType']||'')||_0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()>_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?-0x1:0x1;}}else{if(_0x2645e9===_0x11c0('0x35')){return _0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()<_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?0x1:-0x1;}else{return _0x4659a5[_0x11c0('0x3b')][_0x11c0('0x3d')]()<_0x2e68f4[_0x11c0('0x3b')][_0x11c0('0x3d')]()?-0x1:0x1;}}}else{if(_0x2645e9===_0x11c0('0x35')){return _0x4659a5[_0x11c0('0x30')]<_0x2e68f4[_0x11c0('0x30')]?0x1:-0x1;}else{return _0x4659a5[_0x11c0('0x30')]<_0x2e68f4[_0x11c0('0x30')]?-0x1:0x1;}}});return _0x50a00c;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x2979a4){var _0x60f728=[_0x11c0('0x3e'),'online',_0x11c0('0x3f'),_0x11c0('0x40'),_0x11c0('0x2e'),_0x11c0('0x40'),_0x11c0('0x38'),_0x11c0('0x41'),_0x11c0('0x4'),_0x11c0('0x2d'),_0x11c0('0x6'),'smsPause','whatsappPause',_0x11c0('0x5'),_0x11c0('0xf'),_0x11c0('0x42'),'openchannelCapacity',_0x11c0('0x43'),_0x11c0('0x44'),'whatsappCapacity','faxCapacity',_0x11c0('0x45'),_0x11c0('0x46'),'mailCurrentCapacity',_0x11c0('0x47'),_0x11c0('0x48'),_0x11c0('0x49'),_0x11c0('0x4a'),_0x11c0('0x14'),_0x11c0('0x13'),_0x11c0('0x15'),_0x11c0('0x16'),_0x11c0('0x12'),_0x11c0('0x10'),_0x11c0('0x4b'),'openchannelStatusTime',_0x11c0('0x4c'),_0x11c0('0x4d'),_0x11c0('0x4e'),'faxStatusTime',_0x11c0('0x4f'),'queue',_0x11c0('0x50'),_0x11c0('0x51'),_0x11c0('0x52'),_0x11c0('0x53')];var _0xb152c=['chatPause','openchannelPause',_0x11c0('0x6'),_0x11c0('0x7'),'whatsappPause',_0x11c0('0x5'),_0x11c0('0xf'),_0x11c0('0x54')];var _0x3615db=_(_0x2979a4)[_0x11c0('0x55')](_0xb152c)['pick'](_0x60f728)[_0x11c0('0x56')]();return _0x3615db;}exports[_0x11c0('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x11c0('0x2c'),'fullname',_0x11c0('0x58'),_0x11c0('0x38'),_0x11c0('0x54'),_0x11c0('0x30'),'userpic',_0x11c0('0x3f'),_0x11c0('0x2e'),_0x11c0('0x40'),'faxPause',_0x11c0('0x4'),_0x11c0('0x6'),_0x11c0('0x2d'),_0x11c0('0x7'),'voicePause',_0x11c0('0x8'),_0x11c0('0x4a'),'faxStatus','mailStatus',_0x11c0('0x14'),_0x11c0('0x15'),_0x11c0('0x10'),'whatsappStatus',_0x11c0('0x4b'),_0x11c0('0x59'),'mailStatusTime','openchannelStatusTime',_0x11c0('0x4d'),'voiceStatusTime',_0x11c0('0x4e'),_0x11c0('0x42'),_0x11c0('0x5a'),'mailCapacity',_0x11c0('0x5b'),_0x11c0('0x44'),_0x11c0('0x5c'),_0x11c0('0x45'),_0x11c0('0x49'),'mailCurrentCapacity',_0x11c0('0x46'),_0x11c0('0x47'),_0x11c0('0x48'),'phoneBarEnableScreenRecordingByAgent',_0x11c0('0x53'),'destconnectedlinenum',_0x11c0('0x5d'),_0x11c0('0x5e'),_0x11c0('0x51')];}exports[_0x11c0('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9024f5b..7426bfd 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 _0x0cdc=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','outbound','find','merge','pick','initializeQueues','lodash','util','http','client','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','ringing','talking','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x50cf61,_0x44e813){var _0x25b7ce=function(_0x301749){while(--_0x301749){_0x50cf61['push'](_0x50cf61['shift']());}};_0x25b7ce(++_0x44e813);}(_0x0cdc,0x164));var _0xc0cd=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x0cdc[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xc0cd('0x0'));var jayson=require('jayson/promise');var util=require(_0xc0cd('0x1'));var amiClient=jayson['client'][_0xc0cd('0x2')]({'port':0x232a});var routingClient=jayson[_0xc0cd('0x3')][_0xc0cd('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xc0cd('0x4'),_0xc0cd('0x5'),_0xc0cd('0x6'),_0xc0cd('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xc0cd('0x8'),_0xc0cd('0x9'),_0xc0cd('0xa'),_0xc0cd('0xb'),'notInUse','onHold',_0xc0cd('0xc'),'ringInUse',_0xc0cd('0xd'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xc0cd('0xe'),_0xc0cd('0xf'),_0xc0cd('0x10'),_0xc0cd('0x11'),_0xc0cd('0x12'),_0xc0cd('0x13'),_0xc0cd('0x14'),'startPredictive',_0xc0cd('0x15'),_0xc0cd('0x16'),_0xc0cd('0x17'),_0xc0cd('0x18'),'erlangBusyFactor',_0xc0cd('0x19'),_0xc0cd('0x1a'),_0xc0cd('0x1b'),_0xc0cd('0x1c'),_0xc0cd('0x1d'),_0xc0cd('0x1e'),_0xc0cd('0x1f'),_0xc0cd('0x20'),_0xc0cd('0x21'),_0xc0cd('0x22')];function getRealtimeQueues(_0x8f0129,_0x20992e){var _0x424702=_0x20992e===_0xc0cd('0x23')?amiClient:routingClient;return _0x424702[_0xc0cd('0x24')](_[_0xc0cd('0x25')](_0x20992e)+_0xc0cd('0x26'),_0x8f0129)[_0xc0cd('0x27')](function(_0x202fb1){if(_0x202fb1[_0xc0cd('0x28')])throw new Error(util[_0xc0cd('0x29')](_0xc0cd('0x2a'),_0x20992e));return _0x202fb1[_0xc0cd('0x2b')];})[_0xc0cd('0x2c')](function(_0x30a006){throw _0x30a006;});}exports[_0xc0cd('0x2d')]=getRealtimeQueues;function initializeQueues(_0x229696,_0x7a5f7e,_0xbc3459,_0x4582e3){var _0xd20978=DEFAULT_QUEUE_ATTRIBUTES;if(_0xbc3459===_0xc0cd('0x23')){if(_0x4582e3===_0xc0cd('0x2e')){_0xd20978=_0xd20978[_0xc0cd('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4582e3==='outbound'){_0xd20978=_0xd20978[_0xc0cd('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x229696[_0xc0cd('0x30')](function(_0x180dfb){var _0x50503b=_0x180dfb[_0xc0cd('0x31')]({'plain':!![]});_0x50503b['paused']=0x0;_0x50503b[_0xc0cd('0xb')]=0x0;_0x50503b[_0xc0cd('0x5')]=0x0;_0x50503b[_0xc0cd('0x4')]=0x0;_0x50503b[_0xc0cd('0x7')]=0x0;if(_0xbc3459==='voice'){_0x50503b['talking']=0x0;_0x50503b[_0xc0cd('0x8')]=0x0;if(_0x4582e3===_0xc0cd('0x32')){_0x50503b[_0xc0cd('0xe')]=0x0;_0x50503b[_0xc0cd('0xf')]=0x0;}}var _0x3f0773=_[_0xc0cd('0x33')](_0x7a5f7e,['id',_0x50503b['id']]);if(_0x3f0773){_[_0xc0cd('0x34')](_0x50503b,_[_0xc0cd('0x35')](_0x3f0773,_0xd20978));}return _0x50503b;});}exports[_0xc0cd('0x36')]=initializeQueues; \ No newline at end of file +var _0xa1dd=['loggedInDb','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','notInUse','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','then','result','getRealtimeQueues','inbound','concat','outbound','get'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xa1dd,0x66));var _0xda1d=function(_0x5803d2,_0x4e37aa){_0x5803d2=_0x5803d2-0x0;var _0x40b803=_0xa1dd[_0x5803d2];return _0x40b803;};'use strict';var _=require(_0xda1d('0x0'));var jayson=require(_0xda1d('0x1'));var util=require(_0xda1d('0x2'));var amiClient=jayson[_0xda1d('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xda1d('0x3')][_0xda1d('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xda1d('0x5'),_0xda1d('0x6'),_0xda1d('0x7'),_0xda1d('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xda1d('0x9'),_0xda1d('0xa'),'invalid','loggedInDb',_0xda1d('0xb'),'onHold','ringing',_0xda1d('0xc'),'talking',_0xda1d('0xd'),_0xda1d('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xda1d('0xf'),_0xda1d('0x10'),_0xda1d('0x11'),_0xda1d('0x12'),'dialActive',_0xda1d('0x13'),'Trunk',_0xda1d('0x14'),_0xda1d('0x15'),'erlangCalls',_0xda1d('0x16'),_0xda1d('0x17'),'erlangBusyFactor',_0xda1d('0x18'),_0xda1d('0x19'),_0xda1d('0x1a'),_0xda1d('0x1b'),_0xda1d('0x1c'),_0xda1d('0x1d'),_0xda1d('0x1e'),_0xda1d('0x1f'),'predictiveIntervalAvgHoldtime',_0xda1d('0x20')];function getRealtimeQueues(_0x5336fa,_0x4e107b){var _0xc5159b=_0x4e107b===_0xda1d('0x21')?amiClient:routingClient;return _0xc5159b[_0xda1d('0x22')](_['startCase'](_0x4e107b)+'Queues',_0x5336fa)[_0xda1d('0x23')](function(_0x4ec2cc){if(_0x4ec2cc['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4e107b));return _0x4ec2cc[_0xda1d('0x24')];})['catch'](function(_0x4db022){throw _0x4db022;});}exports[_0xda1d('0x25')]=getRealtimeQueues;function initializeQueues(_0x19e442,_0x59962c,_0x572db8,_0x46415a){var _0x270a57=DEFAULT_QUEUE_ATTRIBUTES;if(_0x572db8===_0xda1d('0x21')){if(_0x46415a===_0xda1d('0x26')){_0x270a57=_0x270a57[_0xda1d('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x46415a===_0xda1d('0x28')){_0x270a57=_0x270a57[_0xda1d('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x19e442['map'](function(_0x18a636){var _0x455694=_0x18a636[_0xda1d('0x29')]({'plain':!![]});_0x455694[_0xda1d('0x7')]=0x0;_0x455694[_0xda1d('0x2a')]=0x0;_0x455694[_0xda1d('0x6')]=0x0;_0x455694[_0xda1d('0x5')]=0x0;_0x455694[_0xda1d('0x8')]=0x0;if(_0x572db8===_0xda1d('0x21')){_0x455694[_0xda1d('0x2b')]=0x0;_0x455694[_0xda1d('0x9')]=0x0;if(_0x46415a===_0xda1d('0x28')){_0x455694[_0xda1d('0xf')]=0x0;_0x455694[_0xda1d('0x10')]=0x0;}}var _0x516ab5=_[_0xda1d('0x2c')](_0x59962c,['id',_0x455694['id']]);if(_0x516ab5){_[_0xda1d('0x2d')](_0x455694,_[_0xda1d('0x2e')](_0x516ab5,_0x270a57));}return _0x455694;});}exports[_0xda1d('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ff2e68a..13949a7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3929648..60c2c63 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 _0xfa6e=['networkInterfaces','orderBy','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','md5','update','substring','crypto','bimedia-machine-uuid','child_process','../environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfa6e,0x11c));var _0xefa6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa6e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xefa6('0x0'));var machine=require(_0xefa6('0x1'));var exec=require(_0xefa6('0x2'))['execSync'];var config=require(_0xefa6('0x3'));function getInterfaces(){var _0x2ecb72=[];var _0x1c088c=os[_0xefa6('0x4')]();var _0x4555db=_[_0xefa6('0x5')](_[_0xefa6('0x6')](_0x1c088c));for(var _0x596cd8=0x0;_0x596cd8<_0x4555db[_0xefa6('0x7')];_0x596cd8++){var _0x2ff33c=_0x1c088c[_0x4555db[_0x596cd8]]['filter'](function(_0x18142f){return _0x18142f[_0xefa6('0x8')]==='IPv4'&&_0x18142f[_0xefa6('0x9')]===![];});_0x2ecb72=_0x2ecb72[_0xefa6('0xa')](_0x2ff33c);}return _0x2ecb72;}function getFirstInterface(){var _0x5de14d=_[_0xefa6('0xb')](getInterfaces());return{'macAddress':_0x5de14d&&_0x5de14d[_0xefa6('0xc')]?_0x5de14d[_0xefa6('0xc')]:_0xefa6('0xd'),'ipAddress':_0x5de14d&&_0x5de14d[_0xefa6('0xe')]?_0x5de14d['address']:_0xefa6('0xf')};}exports[_0xefa6('0x10')]=getFirstInterface;function getCPUhash(){var _0xc67560=_[_0xefa6('0x5')](os[_0xefa6('0x11')]()[_0xefa6('0x12')](function(_0x43ce31){return _0x43ce31[_0xefa6('0x13')];}))[_0xefa6('0x14')](':');return crypto['createHash']('md5')['update'](_0xc67560)[_0xefa6('0x15')](_0xefa6('0x16'));}exports[_0xefa6('0x17')]=function(){var _0x2f83cf=os[_0xefa6('0x18')]();var _0x4bd9bf=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4bd9bf[_0xefa6('0x19')](config[_0xefa6('0x1a')])){return config[_0xefa6('0x1a')];}else if(_0x2f83cf===_0xefa6('0x1b')){return exec(_0xefa6('0x1c'),{'encoding':_0xefa6('0x1d')})[_0xefa6('0x1e')]('\x0d\x0a','');}else{var _0x4641aa=getFirstInterface();var _0x357d0d=getCPUhash();var _0x53aa16=_0x357d0d+'|'+os['hostname']()+'|'+_0x4641aa[_0xefa6('0x1f')]+'|'+_0x4641aa[_0xefa6('0x20')];var _0x3b2f89=crypto['createHash'](_0xefa6('0x21'))[_0xefa6('0x22')](_0x53aa16)['digest']('hex');return _0x3b2f89[_0xefa6('0x23')](0x0,0x8)+'-'+_0x3b2f89['substring'](0x8,0xc)+'-'+_0x3b2f89[_0xefa6('0x23')](0xc,0x10)+'-'+_0x3b2f89[_0xefa6('0x23')](0x10,0x14)+'-'+_0x3b2f89[_0xefa6('0x23')](0x14);}}; \ No newline at end of file +var _0xc440=['IPv4','internal','concat','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','model','join','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family'];(function(_0xee0fdb,_0x4aa492){var _0x4d7fbf=function(_0x22693d){while(--_0x22693d){_0xee0fdb['push'](_0xee0fdb['shift']());}};_0x4d7fbf(++_0x4aa492);}(_0xc440,0xc1));var _0x0c44=function(_0x2bb336,_0x4d2edf){_0x2bb336=_0x2bb336-0x0;var _0x412f98=_0xc440[_0x2bb336];return _0x412f98;};'use strict';var _=require(_0x0c44('0x0'));var os=require('os');var crypto=require(_0x0c44('0x1'));var machine=require(_0x0c44('0x2'));var exec=require(_0x0c44('0x3'))['execSync'];var config=require(_0x0c44('0x4'));function getInterfaces(){var _0x42a87f=[];var _0x1304ad=os[_0x0c44('0x5')]();var _0x3d80a8=_[_0x0c44('0x6')](_[_0x0c44('0x7')](_0x1304ad));for(var _0x232318=0x0;_0x232318<_0x3d80a8[_0x0c44('0x8')];_0x232318++){var _0x4bbc4d=_0x1304ad[_0x3d80a8[_0x232318]][_0x0c44('0x9')](function(_0x52668c){return _0x52668c[_0x0c44('0xa')]===_0x0c44('0xb')&&_0x52668c[_0x0c44('0xc')]===![];});_0x42a87f=_0x42a87f[_0x0c44('0xd')](_0x4bbc4d);}return _0x42a87f;}function getFirstInterface(){var _0x4577da=_[_0x0c44('0xe')](getInterfaces());return{'macAddress':_0x4577da&&_0x4577da[_0x0c44('0xf')]?_0x4577da[_0x0c44('0xf')]:_0x0c44('0x10'),'ipAddress':_0x4577da&&_0x4577da['address']?_0x4577da['address']:'127.0.0.1'};}exports[_0x0c44('0x11')]=getFirstInterface;function getCPUhash(){var _0x5f2fb5=_[_0x0c44('0x6')](os[_0x0c44('0x12')]()[_0x0c44('0x13')](function(_0x12568c){return _0x12568c[_0x0c44('0x14')];}))[_0x0c44('0x15')](':');return crypto['createHash']('md5')['update'](_0x5f2fb5)[_0x0c44('0x16')](_0x0c44('0x17'));}exports[_0x0c44('0x18')]=function(){var _0x2eed64=os[_0x0c44('0x19')]();var _0x362ca1=/[0-9a-f-]{36}/;if(config[_0x0c44('0x1a')]&&_0x362ca1[_0x0c44('0x1b')](config[_0x0c44('0x1a')])){return config[_0x0c44('0x1a')];}else if(_0x2eed64===_0x0c44('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x0c44('0x1d')})['replace']('\x0d\x0a','');}else{var _0x4dbf41=getFirstInterface();var _0x4a61e0=getCPUhash();var _0xadcf56=_0x4a61e0+'|'+os[_0x0c44('0x1e')]()+'|'+_0x4dbf41[_0x0c44('0x1f')]+'|'+_0x4dbf41[_0x0c44('0x20')];var _0x512a10=crypto['createHash']('md5')['update'](_0xadcf56)[_0x0c44('0x16')](_0x0c44('0x17'));return _0x512a10[_0x0c44('0x21')](0x0,0x8)+'-'+_0x512a10[_0x0c44('0x21')](0x8,0xc)+'-'+_0x512a10['substring'](0xc,0x10)+'-'+_0x512a10[_0x0c44('0x21')](0x10,0x14)+'-'+_0x512a10[_0x0c44('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b40298c..a9efcbe 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 _0x734d=['../logger','license','format','%s/api/servers/%s/check?version=%s','exports','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb'];(function(_0x2a19d1,_0x545ae7){var _0x1a1805=function(_0x551eec){while(--_0x551eec){_0x2a19d1['push'](_0x2a19d1['shift']());}};_0x1a1805(++_0x545ae7);}(_0x734d,0x129));var _0xd734=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x734d[_0x1c1913];return _0x3b352a;};'use strict';var util=require(_0xd734('0x0'));var moment=require(_0xd734('0x1'));var rp=require(_0xd734('0x2'));var BPromise=require(_0xd734('0x3'));var pkginfo=require(_0xd734('0x4'))(module,_0xd734('0x5'));var db=require(_0xd734('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xd734('0x7'))(_0xd734('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x22e0c1){return new BPromise(function(_0x1aa5df,_0x175fd8){var _0x134eb0=util[_0xd734('0x9')](_0xd734('0xa'),HOST,_0x22e0c1,module[_0xd734('0xb')][_0xd734('0x5')]);if(oldToken){_0x134eb0=util[_0xd734('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x22e0c1,module[_0xd734('0xb')][_0xd734('0x5')],oldToken);}var _0x2b0e49={'uri':_0x134eb0,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2b0e49)['then'](function(_0x2fc987){_0x1aa5df(_0x2fc987);})[_0xd734('0xc')](function(_0x1d05da){_0x175fd8(_0x1d05da);});});}function manageLicense(_0x4415a3,_0x409e78){var _0x2fbb0a=_0x409e78[_0xd734('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x2fbb0a[_0xd734('0xe')]!==_0x4415a3&&!_0x2fbb0a[_0xd734('0xf')]){oldToken=_0x2fbb0a['data1'];}httpRequest(_0x4415a3)[_0xd734('0x10')](function(_0x134e86){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x134e86[_0xd734('0x11')]){isOldTokenSent=![];if(!_0x2fbb0a['license']&&_0x2fbb0a[_0xd734('0x8')]!=_0x134e86[_0xd734('0x8')]||_0x2fbb0a[_0xd734('0x8')]&&_0x2fbb0a[_0xd734('0xf')]){logger[_0xd734('0x12')](_0xd734('0x13'));}if(_0x2fbb0a['license']&&!_0x2fbb0a[_0xd734('0xf')]&&_0x2fbb0a[_0xd734('0x8')]!=_0x134e86['license']){logger[_0xd734('0x12')](_0xd734('0x14'));}if(_0x2fbb0a['license']&&!_0x2fbb0a[_0xd734('0xf')]&&_0x2fbb0a[_0xd734('0x8')]==_0x134e86[_0xd734('0x8')]){return _0x409e78;}return _0x409e78[_0xd734('0x15')]({'data1':_0x4415a3,'data2':null,'license':_0x134e86[_0xd734('0x8')]});}else{if(_0x134e86['license']||_0x2fbb0a[_0xd734('0x8')]){if(!_0x2fbb0a[_0xd734('0xf')]){if(_0x2fbb0a[_0xd734('0xe')]==_0x4415a3){GRAY_PERIOD_REASON=_0xd734('0x16');logger[_0xd734('0x12')](_0xd734('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2fbb0a[_0xd734('0xe')],_0x4415a3);}logger[_0xd734('0x12')](_0xd734('0x18'),GRAY_PERIOD_REASON[_0xd734('0x19')](),moment()[_0xd734('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x409e78[_0xd734('0x15')]({'data2':encryptor['encryptString'](moment()['format'](_0xd734('0x1a')))});}else{if(moment()[_0xd734('0x1b')](encryptor[_0xd734('0x1c')](_0x2fbb0a[_0xd734('0xf')]),_0xd734('0x1d'))>DAYS){logger[_0xd734('0x12')](_0xd734('0x1e'),moment()[_0xd734('0x9')](_0xd734('0x1a')));isOldTokenSent=![];return _0x409e78[_0xd734('0x15')]({'data1':_0x4415a3,'data2':null,'license':null});}}}else{if(_0x2fbb0a[_0xd734('0xe')]!=_0x4415a3){logger[_0xd734('0x12')](_0xd734('0x1f'),_0x2fbb0a['data1'],_0x4415a3);return _0x409e78[_0xd734('0x15')]({'data1':_0x4415a3,'data2':null,'license':null});}}}return _0x409e78;})[_0xd734('0x10')](function(_0x4ebef3){_0x409e78=_0x4ebef3;})[_0xd734('0xc')](function(_0x3e5e70){logger[_0xd734('0x20')](_0x3e5e70['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xd734('0x21')](),_0x409e78);},TIME);});}function defaultLicense(){var _0x24f90c=hardware[_0xd734('0x21')]();if(_0x24f90c){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x24f90c}})[_0xd734('0x22')](function(_0xc1e175,_0x2f4fa6){logger[_0xd734('0x12')](_0xd734('0x23'),_0x24f90c);manageLicense(_0x24f90c,_0xc1e175);})[_0xd734('0xc')](function(_0x4a33da){logger[_0xd734('0x20')](_0x4a33da[_0xd734('0x24')]);});}}exports[_0xd734('0x25')]=defaultLicense; \ No newline at end of file +var _0xd896=['./hardware','../logger','license','https://www.xcallymotion.com','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','request-promise','../../mysqldb','../../components/encryptor'];(function(_0x1e1d31,_0x9b8d53){var _0x3ab3af=function(_0x461b0d){while(--_0x461b0d){_0x1e1d31['push'](_0x1e1d31['shift']());}};_0x3ab3af(++_0x9b8d53);}(_0xd896,0x15b));var _0x6d89=function(_0x549ddb,_0x15eeb1){_0x549ddb=_0x549ddb-0x0;var _0x222552=_0xd896[_0x549ddb];return _0x222552;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x6d89('0x0'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require(_0x6d89('0x1'))['db'];var encryptor=require(_0x6d89('0x2'));var hardware=require(_0x6d89('0x3'));var logger=require(_0x6d89('0x4'))(_0x6d89('0x5'));var HOST=_0x6d89('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xed9c5e){return new BPromise(function(_0x236bea,_0x3e3073){var _0x19a66f=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0xed9c5e,module[_0x6d89('0x7')][_0x6d89('0x8')]);if(oldToken){_0x19a66f=util[_0x6d89('0x9')](_0x6d89('0xa'),HOST,_0xed9c5e,module['exports'][_0x6d89('0x8')],oldToken);}var _0x4da00d={'uri':_0x19a66f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4da00d)[_0x6d89('0xb')](function(_0x19cb73){_0x236bea(_0x19cb73);})['catch'](function(_0xe44774){_0x3e3073(_0xe44774);});});}function manageLicense(_0x1c98d1,_0x1ebecd){var _0x4ddf5f=_0x1ebecd['get']({'plain':!![]});if(!isOldTokenSent&&_0x4ddf5f[_0x6d89('0xc')]!==_0x1c98d1&&!_0x4ddf5f[_0x6d89('0xd')]){oldToken=_0x4ddf5f['data1'];}httpRequest(_0x1c98d1)[_0x6d89('0xb')](function(_0x203078){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x203078['active']){isOldTokenSent=![];if(!_0x4ddf5f[_0x6d89('0x5')]&&_0x4ddf5f[_0x6d89('0x5')]!=_0x203078[_0x6d89('0x5')]||_0x4ddf5f[_0x6d89('0x5')]&&_0x4ddf5f['data2']){logger[_0x6d89('0xe')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4ddf5f['license']&&!_0x4ddf5f[_0x6d89('0xd')]&&_0x4ddf5f[_0x6d89('0x5')]!=_0x203078['license']){logger[_0x6d89('0xe')](_0x6d89('0xf'));}if(_0x4ddf5f[_0x6d89('0x5')]&&!_0x4ddf5f[_0x6d89('0xd')]&&_0x4ddf5f['license']==_0x203078['license']){return _0x1ebecd;}return _0x1ebecd[_0x6d89('0x10')]({'data1':_0x1c98d1,'data2':null,'license':_0x203078[_0x6d89('0x5')]});}else{if(_0x203078[_0x6d89('0x5')]||_0x4ddf5f[_0x6d89('0x5')]){if(!_0x4ddf5f[_0x6d89('0xd')]){if(_0x4ddf5f[_0x6d89('0xc')]==_0x1c98d1){GRAY_PERIOD_REASON=_0x6d89('0x11');logger[_0x6d89('0xe')](_0x6d89('0x12'));}else{GRAY_PERIOD_REASON=_0x6d89('0x13');logger[_0x6d89('0xe')](_0x6d89('0x14'),_0x4ddf5f['data1'],_0x1c98d1);}logger[_0x6d89('0xe')](_0x6d89('0x15'),GRAY_PERIOD_REASON[_0x6d89('0x16')](),moment()[_0x6d89('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x1ebecd['update']({'data2':encryptor['encryptString'](moment()[_0x6d89('0x9')](_0x6d89('0x17')))});}else{if(moment()[_0x6d89('0x18')](encryptor[_0x6d89('0x19')](_0x4ddf5f['data2']),_0x6d89('0x1a'))>DAYS){logger[_0x6d89('0xe')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6d89('0x9')](_0x6d89('0x17')));isOldTokenSent=![];return _0x1ebecd['update']({'data1':_0x1c98d1,'data2':null,'license':null});}}}else{if(_0x4ddf5f[_0x6d89('0xc')]!=_0x1c98d1){logger['info'](_0x6d89('0x14'),_0x4ddf5f[_0x6d89('0xc')],_0x1c98d1);return _0x1ebecd[_0x6d89('0x10')]({'data1':_0x1c98d1,'data2':null,'license':null});}}}return _0x1ebecd;})[_0x6d89('0xb')](function(_0x14a9ba){_0x1ebecd=_0x14a9ba;})[_0x6d89('0x1b')](function(_0x2f140b){logger[_0x6d89('0x1c')](_0x2f140b[_0x6d89('0x1d')]);})[_0x6d89('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x6d89('0x1f')](),_0x1ebecd);},TIME);});}function defaultLicense(){var _0x54f520=hardware[_0x6d89('0x1f')]();if(_0x54f520){return db['License'][_0x6d89('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x54f520}})[_0x6d89('0x21')](function(_0x57193f,_0x495139){logger[_0x6d89('0xe')](_0x6d89('0x22'),_0x54f520);manageLicense(_0x54f520,_0x57193f);})['catch'](function(_0x4cea7a){logger[_0x6d89('0x1c')](_0x4cea7a[_0x6d89('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 434df25..575f9f8 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 _0x2b2c=['%s:%s:%s','parse','machineUuid','gray','days','format','grayReason','changed','message','then','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','lodash','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','catch','uuid','data1','license','isEmpty','split','decryptString'];(function(_0x3aa220,_0x58c85f){var _0x17bf15=function(_0x226bb3){while(--_0x226bb3){_0x3aa220['push'](_0x3aa220['shift']());}};_0x17bf15(++_0x58c85f);}(_0x2b2c,0x162));var _0xc2b2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2b2c[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0xc2b2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xc2b2('0x1'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc2b2('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc2b2('0x3'),'machineUuid':hardware[_0xc2b2('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc2b2('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc2b2('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1d9930){return new BPromise(function(_0x33b80f,_0xc67e9e){return db[_0xc2b2('0x6')][_0xc2b2('0x7')](_['defaults'](_0x1d9930,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x42a796){return checkLicense(_0x42a796,null);})['then'](function(_0x4d3253){_0x33b80f(_0x4d3253);return;})[_0xc2b2('0x8')](function(_0x1b72d3){_0xc67e9e(_0x1b72d3);});});}function checkLicense(_0x2e3848,_0x1da011){if(!_0x2e3848){demoLicense[_0xc2b2('0x9')]=_0x2e3848[_0xc2b2('0xa')];return demoLicense;}try{var _0x44e497=_0x1da011||_0x2e3848[_0xc2b2('0xb')];if(_[_0xc2b2('0xc')](_0x44e497)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x56ae51=_0x2e3848[_0xc2b2('0xa')];var _0x4dfa98=_0x2e3848['data2'];var _0x2c034c=_0x56ae51[_0xc2b2('0xd')]('-')[0x4];var _0x303fc6=_0x56ae51['split']('-')[0x0];var _0x50cba3=encryptor[_0xc2b2('0xe')](_0x44e497,util['format'](_0xc2b2('0xf'),_0x2c034c,_0x56ae51,_0x303fc6));var _0x24c429=JSON[_0xc2b2('0x10')](_0x50cba3);_0x24c429['demo']=![];_0x24c429['uuid']=_0x56ae51;_0x24c429[_0xc2b2('0x11')]=hardware['getUuid']();if(_0x4dfa98){var _0x4c5f14=encryptor['decryptString'](_0x4dfa98);_0x24c429[_0xc2b2('0x12')]=_0x4c5f14;_0x24c429['deadline']=moment(_0x4c5f14)['add'](0x7,_0xc2b2('0x13'))[_0xc2b2('0x14')]();_0x24c429[_0xc2b2('0x15')]=_0x24c429[_0xc2b2('0x9')]!=_0x24c429[_0xc2b2('0x11')]?_0xc2b2('0x16'):'disabled';}return _0x24c429;}catch(_0x2b05b5){breakingLicense[_0xc2b2('0x9')]=_0x2e3848[_0xc2b2('0xa')];breakingLicense[_0xc2b2('0x17')]=_0x2b05b5[_0xc2b2('0x17')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1d617c,_0x2bf71b){getLicense()[_0xc2b2('0x18')](function(_0x5e8c31){return db[_0xc2b2('0x19')][_0xc2b2('0x1a')]({'attributes':[_0xc2b2('0x1b'),[db[_0xc2b2('0x1c')]['fn'](_0xc2b2('0x1d'),db['sequelize'][_0xc2b2('0x1e')](_0xc2b2('0x1b'))),_0xc2b2('0x1f')]],'group':_0xc2b2('0x1b'),'where':{'role':{'$or':[_0xc2b2('0x20'),'user',_0xc2b2('0x21')]}},'raw':!![]})['then'](function(_0x3886f3){var _0x423fee={'user':_0x5e8c31['users']||0x0,'telephone':_0x5e8c31[_0xc2b2('0x22')]||0x0};_0x3886f3[_0xc2b2('0x23')](function(_0x4015fa){var _0x396833=_0x4015fa[_0xc2b2('0x1b')]===_0xc2b2('0x20')?_0xc2b2('0x24'):_0x4015fa[_0xc2b2('0x1b')];_0x423fee[_0x396833]-=_0x4015fa[_0xc2b2('0x1f')];if(_0x423fee[_0x396833]<0x0)_0x423fee[_0x396833]=0x0;});_0x1d617c(_0x423fee);return;});})['catch'](function(_0x253ca7){_0x2bf71b(_0x253ca7);});});}function checkUserLimits(_0x278e72){return new BPromise(function(_0x361a01,_0x2c9ab1){getLimits()[_0xc2b2('0x18')](function(_0x536c24){var _0x4ada3a=_[_0xc2b2('0x25')](_[_0xc2b2('0x26')](_0x278e72,_0xc2b2('0x1b')),[_0xc2b2('0x20'),'user',_0xc2b2('0x21')]);var _0x5444e8=(_0x4ada3a['admin']||0x0)+(_0x4ada3a['user']||0x0);var _0x283e03=_0x4ada3a[_0xc2b2('0x21')]||0x0;if(_0x5444e8>_0x536c24[_0xc2b2('0x24')])return _0x2c9ab1(_0xc2b2('0x27'));if(_0x283e03>_0x536c24[_0xc2b2('0x21')])return _0x2c9ab1(_0xc2b2('0x28'));return _0x361a01();})['catch'](function(_0x25ce69){_0x2c9ab1(_0x25ce69);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x04fc=['../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird'];(function(_0x59e5a4,_0x1e6cde){var _0x43d707=function(_0x239a6e){while(--_0x239a6e){_0x59e5a4['push'](_0x59e5a4['shift']());}};_0x43d707(++_0x1e6cde);}(_0x04fc,0x17d));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc04f('0x0'));var _=require('lodash');var moment=require(_0xc04f('0x1'));var BPromise=require(_0xc04f('0x2'));var hardware=require('./hardware');var encryptor=require(_0xc04f('0x3'));var db=require(_0xc04f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc04f('0x5'),'machineUuid':hardware[_0xc04f('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc04f('0x7'),'machineUuid':hardware[_0xc04f('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x349fd4){return new BPromise(function(_0x4e0bed,_0x5873db){return db[_0xc04f('0x8')][_0xc04f('0x9')](_[_0xc04f('0xa')](_0x349fd4,{'raw':!![],'where':{'id':0x1}}))[_0xc04f('0xb')](function(_0x4eeea9){return checkLicense(_0x4eeea9,null);})[_0xc04f('0xb')](function(_0x39398b){_0x4e0bed(_0x39398b);return;})[_0xc04f('0xc')](function(_0x33b9cc){_0x5873db(_0x33b9cc);});});}function checkLicense(_0x117090,_0x1140b9){if(!_0x117090){demoLicense[_0xc04f('0xd')]=_0x117090['data1'];return demoLicense;}try{var _0x50cc5f=_0x1140b9||_0x117090[_0xc04f('0xe')];if(_[_0xc04f('0xf')](_0x50cc5f)){throw new Error(_0xc04f('0x10'));}var _0xc1c5dd=_0x117090[_0xc04f('0x11')];var _0x8600d5=_0x117090[_0xc04f('0x12')];var _0x39ce8d=_0xc1c5dd[_0xc04f('0x13')]('-')[0x4];var _0x40936b=_0xc1c5dd['split']('-')[0x0];var _0xf906b9=encryptor[_0xc04f('0x14')](_0x50cc5f,util[_0xc04f('0x15')]('%s:%s:%s',_0x39ce8d,_0xc1c5dd,_0x40936b));var _0xc43d28=JSON['parse'](_0xf906b9);_0xc43d28[_0xc04f('0x16')]=![];_0xc43d28['uuid']=_0xc1c5dd;_0xc43d28[_0xc04f('0x17')]=hardware[_0xc04f('0x6')]();if(_0x8600d5){var _0xf75bff=encryptor[_0xc04f('0x14')](_0x8600d5);_0xc43d28[_0xc04f('0x18')]=_0xf75bff;_0xc43d28[_0xc04f('0x19')]=moment(_0xf75bff)[_0xc04f('0x1a')](0x7,_0xc04f('0x1b'))[_0xc04f('0x15')]();_0xc43d28['grayReason']=_0xc43d28[_0xc04f('0xd')]!=_0xc43d28['machineUuid']?_0xc04f('0x1c'):_0xc04f('0x1d');}return _0xc43d28;}catch(_0xbefbd1){breakingLicense[_0xc04f('0xd')]=_0x117090['data1'];breakingLicense[_0xc04f('0x1e')]=_0xbefbd1[_0xc04f('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x32fcbb,_0xe52227){getLicense()[_0xc04f('0xb')](function(_0x32d4f8){return db[_0xc04f('0x1f')][_0xc04f('0x20')]({'attributes':[_0xc04f('0x21'),[db['sequelize']['fn'](_0xc04f('0x22'),db[_0xc04f('0x23')][_0xc04f('0x24')](_0xc04f('0x21'))),_0xc04f('0x25')]],'group':_0xc04f('0x21'),'where':{'role':{'$or':[_0xc04f('0x26'),_0xc04f('0x27'),_0xc04f('0x28')]}},'raw':!![]})[_0xc04f('0xb')](function(_0x5d60e0){var _0x5dd0d7={'user':_0x32d4f8[_0xc04f('0x29')]||0x0,'telephone':_0x32d4f8[_0xc04f('0x2a')]||0x0};_0x5d60e0[_0xc04f('0x2b')](function(_0x2cea4){var _0x2d6cf8=_0x2cea4[_0xc04f('0x21')]===_0xc04f('0x26')?'user':_0x2cea4['role'];_0x5dd0d7[_0x2d6cf8]-=_0x2cea4[_0xc04f('0x25')];if(_0x5dd0d7[_0x2d6cf8]<0x0)_0x5dd0d7[_0x2d6cf8]=0x0;});_0x32fcbb(_0x5dd0d7);return;});})[_0xc04f('0xc')](function(_0x750d3){_0xe52227(_0x750d3);});});}function checkUserLimits(_0x3e0a17){return new BPromise(function(_0x163b84,_0x1c1955){getLimits()[_0xc04f('0xb')](function(_0x2ae69a){var _0x47b359=_[_0xc04f('0x2c')](_[_0xc04f('0x2d')](_0x3e0a17,_0xc04f('0x21')),[_0xc04f('0x26'),'user','telephone']);var _0x119177=(_0x47b359[_0xc04f('0x26')]||0x0)+(_0x47b359['user']||0x0);var _0x437914=_0x47b359['telephone']||0x0;if(_0x119177>_0x2ae69a['user'])return _0x1c1955(_0xc04f('0x2e'));if(_0x437914>_0x2ae69a[_0xc04f('0x28')])return _0x1c1955(_0xc04f('0x2f'));return _0x163b84();})['catch'](function(_0x29b1ac){_0x1c1955(_0x29b1ac);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f3e7d9f..105efe8 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 _0xea28=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x2c24dd,_0x4080cc){var _0x1a47da=function(_0x58fe21){while(--_0x58fe21){_0x2c24dd['push'](_0x2c24dd['shift']());}};_0x1a47da(++_0x4080cc);}(_0xea28,0x13a));var _0x8ea2=function(_0x502e96,_0x3c7eea){_0x502e96=_0x502e96-0x0;var _0x5cca46=_0xea28[_0x502e96];return _0x5cca46;};'use strict';module[_0x8ea2('0x0')]={'DOMAIN':_0x8ea2('0x1'),'SESSION_SECRET':_0x8ea2('0x2'),'GOOGLE_ID':_0x8ea2('0x3'),'GOOGLE_SECRET':_0x8ea2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x36ee=['myappanuglar-secret','secret'];(function(_0x3f5640,_0x2cc66d){var _0x171259=function(_0x45166f){while(--_0x45166f){_0x3f5640['push'](_0x3f5640['shift']());}};_0x171259(++_0x2cc66d);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 723667e..ae707f8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3894=['exports','../utils/loggers','fileLogger'];(function(_0x1500a5,_0x1583c4){var _0x5b9a89=function(_0xd08be6){while(--_0xd08be6){_0x1500a5['push'](_0x1500a5['shift']());}};_0x5b9a89(++_0x1583c4);}(_0x3894,0x76));var _0x4389=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x3894[_0x15b192];return _0x396e73;};'use strict';var fileLogger=require(_0x4389('0x0'))[_0x4389('0x1')];module[_0x4389('0x2')]=fileLogger; \ No newline at end of file +var _0x21ac=['fileLogger','../utils/loggers'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x21ac,0x123));var _0xc21a=function(_0x4aaffc,_0x55b239){_0x4aaffc=_0x4aaffc-0x0;var _0x41bfdd=_0x21ac[_0x4aaffc];return _0x41bfdd;};'use strict';var fileLogger=require(_0xc21a('0x0'))[_0xc21a('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e53f1a4..163043c 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 _0x6f27=['xdr','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x10e957,_0x245bd9){var _0x46e4f8=function(_0x2545cb){while(--_0x2545cb){_0x10e957['push'](_0x10e957['shift']());}};_0x46e4f8(++_0x245bd9);}(_0x6f27,0x1a2));var _0x76f2=function(_0x254f73,_0x532104){_0x254f73=_0x254f73-0x0;var _0x472f28=_0x6f27[_0x254f73];return _0x472f28;};'use strict';var path=require(_0x76f2('0x0'));var cfg=require(_0x76f2('0x1'));var env={'NODE_PATH':path[_0x76f2('0x2')](path[_0x76f2('0x3')](cfg[_0x76f2('0x4')],_0x76f2('0x5')))};var pm2config={'apps':[{'name':_0x76f2('0x6'),'script':path[_0x76f2('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x76f2('0x7'),'script':path['join'](__dirname,_0x76f2('0x8')),'env':env},{'name':_0x76f2('0x9'),'script':path[_0x76f2('0x3')](__dirname,_0x76f2('0xa')),'env':env},{'name':'email','script':path[_0x76f2('0x3')](__dirname,_0x76f2('0xb')),'env':env},{'name':_0x76f2('0xc'),'script':path['join'](__dirname,_0x76f2('0xd')),'env':env},{'name':_0x76f2('0xe'),'script':path[_0x76f2('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x76f2('0xf')]=pm2config; \ No newline at end of file +var _0x13fa=['ami','join','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','legacy-libs','express','../../services/express/index.js'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x13fa,0x6b));var _0xa13f=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x13fa[_0x57ee1d];return _0x12a933;};'use strict';var path=require(_0xa13f('0x0'));var cfg=require(_0xa13f('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg['root'],_0xa13f('0x2')))};var pm2config={'apps':[{'name':_0xa13f('0x3'),'script':path['join'](__dirname,_0xa13f('0x4')),'env':env},{'name':_0xa13f('0x5'),'script':path[_0xa13f('0x6')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xa13f('0x7'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xa13f('0x8'),'script':path['join'](__dirname,_0xa13f('0x9')),'env':env},{'name':_0xa13f('0xa'),'script':path[_0xa13f('0x6')](__dirname,_0xa13f('0xb')),'env':env},{'name':_0xa13f('0xc'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xa13f('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5c5dfa2..ae75c3c 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 _0xd4e6=['dump','saved','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x706615,_0x55a0fe){var _0x160181=function(_0xa3df56){while(--_0xa3df56){_0x706615['push'](_0x706615['shift']());}};_0x160181(++_0x55a0fe);}(_0xd4e6,0x122));var _0x6d4e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xd4e6[_0x92c450];return _0x2a9599;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x432306,_0x202f3f){return pm2[_0x6d4e('0x0')](function(_0x276d10){if(_0x276d10){return _0x202f3f(_0x276d10);}return _0x432306(_0x6d4e('0x1'));});});};exports[_0x6d4e('0x2')]=function(_0x838bfa){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x46a1ee,_0x39344c){return pm2[_0x6d4e('0x2')](_0x838bfa,function(_0x405cf8,_0x5b0f34){if(_0x405cf8){return _0x39344c(_0x405cf8);}pm2[_0x6d4e('0x4')]();return _0x46a1ee(_0x5b0f34);});});});};exports[_0x6d4e('0x5')]=function(_0x1e4414){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x51a9e3,_0x10225d){return pm2[_0x6d4e('0x5')](_0x1e4414,function(_0x3de943,_0x435e9b){if(_0x3de943){return _0x10225d(_0x3de943);}pm2[_0x6d4e('0x4')]();return _0x51a9e3(_0x435e9b);});});});};exports[_0x6d4e('0x6')]=function(_0xcf608c){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x2d2c13,_0xc967dc){return pm2[_0x6d4e('0x6')](_0xcf608c,function(_0x12ca20,_0x4c36d8){if(_0x12ca20){return _0xc967dc(_0x12ca20);}pm2['disconnect']();return _0x2d2c13(_0x4c36d8);});});});};exports[_0x6d4e('0x7')]=function(){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x2ec9b7,_0x37bdb2){return pm2['list'](function(_0x1bbda3,_0x12d7fe){if(_0x1bbda3){return _0x37bdb2(_0x1bbda3);}pm2[_0x6d4e('0x4')]();return _0x2ec9b7(_0x12d7fe);});});});};exports[_0x6d4e('0x8')]=function(_0x25d8e4){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x3b6ef9,_0x4d1ce1){return pm2[_0x6d4e('0x8')](_0x25d8e4,function(_0x153da2,_0x2accba){if(_0x153da2){return _0x4d1ce1(_0x153da2);}pm2[_0x6d4e('0x4')]();return _0x3b6ef9(_0x2accba);});});});};exports[_0x6d4e('0x9')]=function(_0x3da17b){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x4bb731,_0x3715b9){return pm2[_0x6d4e('0x9')](_0x3da17b,function(_0xee2c6e,_0x2e6653){if(_0xee2c6e){return _0x3715b9(_0xee2c6e);}pm2[_0x6d4e('0x4')]();return _0x4bb731(_0x2e6653);});});});};exports['dump']=function(){return connect()[_0x6d4e('0x3')](function(){return new BPromise(function(_0x43b0b8,_0x447178){return pm2[_0x6d4e('0xa')](function(_0x10b936){if(_0x10b936){return _0x447178(_0x10b936);}return _0x43b0b8(_0x6d4e('0xb'));});});});}; \ No newline at end of file +var _0x0979=['delete','./config','connect','then','start','stop','disconnect','restart','list','describe'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0979,0xdd));var _0x9097=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x0979[_0x33f1f1];return _0x3052d4;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x9097('0x0'));function connect(){return new BPromise(function(_0x2d1349,_0x2c616b){return pm2[_0x9097('0x1')](function(_0xcdd020){if(_0xcdd020){return _0x2c616b(_0xcdd020);}return _0x2d1349('connected');});});};exports['start']=function(_0x4702d6){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x4c2f71,_0x301ea0){return pm2[_0x9097('0x3')](_0x4702d6,function(_0x2999b5,_0x461ec2){if(_0x2999b5){return _0x301ea0(_0x2999b5);}pm2['disconnect']();return _0x4c2f71(_0x461ec2);});});});};exports[_0x9097('0x4')]=function(_0x3b333b){return connect()['then'](function(){return new BPromise(function(_0x53dcdd,_0x1be775){return pm2[_0x9097('0x4')](_0x3b333b,function(_0x4e1f23,_0x49324f){if(_0x4e1f23){return _0x1be775(_0x4e1f23);}pm2[_0x9097('0x5')]();return _0x53dcdd(_0x49324f);});});});};exports[_0x9097('0x6')]=function(_0x4452a4){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0xda5b63,_0x3ac4fa){return pm2[_0x9097('0x6')](_0x4452a4,function(_0xf24b86,_0x1ade91){if(_0xf24b86){return _0x3ac4fa(_0xf24b86);}pm2[_0x9097('0x5')]();return _0xda5b63(_0x1ade91);});});});};exports[_0x9097('0x7')]=function(){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x369947,_0x21681f){return pm2[_0x9097('0x7')](function(_0x566556,_0x3a2270){if(_0x566556){return _0x21681f(_0x566556);}pm2[_0x9097('0x5')]();return _0x369947(_0x3a2270);});});});};exports[_0x9097('0x8')]=function(_0x57fe62){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x5331f2,_0x360c1a){return pm2['describe'](_0x57fe62,function(_0x146fb0,_0x3fcd9b){if(_0x146fb0){return _0x360c1a(_0x146fb0);}pm2[_0x9097('0x5')]();return _0x5331f2(_0x3fcd9b);});});});};exports[_0x9097('0x9')]=function(_0x3cda79){return connect()[_0x9097('0x2')](function(){return new BPromise(function(_0x5adfe2,_0x106e5e){return pm2[_0x9097('0x9')](_0x3cda79,function(_0x24b898,_0x3f0896){if(_0x24b898){return _0x106e5e(_0x24b898);}pm2['disconnect']();return _0x5adfe2(_0x3f0896);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x4bea79,_0x2fc163){return pm2['dump'](function(_0x11bd21){if(_0x11bd21){return _0x2fc163(_0x11bd21);}return _0x4bea79('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 494aa9f..02aedbb 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 _0x91e0=['[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91e0,0x156));var _0x091e=function(_0x36b736,_0x556f11){_0x36b736=_0x36b736-0x0;var _0x4d65e6=_0x91e0[_0x36b736];return _0x4d65e6;};'use strict';var _=require(_0x091e('0x0'));var moment=require(_0x091e('0x1'));var Redis=require(_0x091e('0x2'));var util=require(_0x091e('0x3'));var config=require(_0x091e('0x4'));var db=require(_0x091e('0x5'))['db'];var logger=require(_0x091e('0x6'))(_0x091e('0x7'));config['redis']=_[_0x091e('0x8')](config[_0x091e('0x9')],{'host':_0x091e('0xa'),'port':0x18eb});var io=require(_0x091e('0xb'))(new Redis(config[_0x091e('0x9')]));function closeInteractions(){var _0x2ade2e=0x0;var _0x40349b=[];return db[_0x091e('0xc')][_0x091e('0xd')]({'raw':!![],'attributes':['id',_0x091e('0xe')],'where':{'id':0x1}})[_0x091e('0xf')](function(_0x443115){_0x2ade2e=_0x443115[_0x091e('0xe')];if(_0x2ade2e){return db[_0x091e('0x10')][_0x091e('0x11')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x091e('0x12')](_0x443115[_0x091e('0xe')],_0x091e('0x13'))}}});}else{return[];}})[_0x091e('0xf')](function(_0xa589fd){if(_0xa589fd&&_0xa589fd[_0x091e('0x14')]){_0x40349b=_[_0x091e('0x15')](_0xa589fd||[],'id');logger['info'](_0x091e('0x16'),_0x40349b[_0x091e('0x17')]());return db[_0x091e('0x10')][_0x091e('0x18')]({'closeReason':_0x091e('0x19'),'disposition':_0x091e('0x1a'),'closed':!![],'closedAt':moment()['format'](_0x091e('0x1b'))},{'where':{'id':_0x40349b}});}})[_0x091e('0xf')](function(){if(_0x40349b&&_0x40349b[_0x091e('0x14')]){logger[_0x091e('0x1c')](_0x091e('0x1d'),_0x40349b['join']());for(var _0x1c587c=0x0;_0x1c587c<_0x40349b[_0x091e('0x14')];_0x1c587c++){io[_0x091e('0x1e')](_0x091e('0x1f'),{'id':_0x40349b[_0x1c587c],'closed':!![]});}}})['catch'](function(_0x1d9879){logger['error'](_0x091e('0x20'),_0x1d9879?util['inspect'](_0x1d9879,{'showHidden':![],'depth':null}):'');});}exports[_0x091e('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe520=['start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','then','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe520,0x1f1));var _0x0e52=function(_0x4255e9,_0x1a9d71){_0x4255e9=_0x4255e9-0x0;var _0x245bff=_0xe520[_0x4255e9];return _0x245bff;};'use strict';var _=require('lodash');var moment=require(_0x0e52('0x0'));var Redis=require(_0x0e52('0x1'));var util=require(_0x0e52('0x2'));var config=require(_0x0e52('0x3'));var db=require(_0x0e52('0x4'))['db'];var logger=require(_0x0e52('0x5'))('schedule');config['redis']=_[_0x0e52('0x6')](config[_0x0e52('0x7')],{'host':_0x0e52('0x8'),'port':0x18eb});var io=require(_0x0e52('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4dd65a=0x0;var _0x56eced=[];return db[_0x0e52('0xa')]['find']({'raw':!![],'attributes':['id',_0x0e52('0xb')],'where':{'id':0x1}})['then'](function(_0x3fc4d5){_0x4dd65a=_0x3fc4d5[_0x0e52('0xb')];if(_0x4dd65a){return db[_0x0e52('0xc')][_0x0e52('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0e52('0xe')](_0x3fc4d5[_0x0e52('0xb')],_0x0e52('0xf'))}}});}else{return[];}})['then'](function(_0xb2986e){if(_0xb2986e&&_0xb2986e['length']){_0x56eced=_[_0x0e52('0x10')](_0xb2986e||[],'id');logger['info'](_0x0e52('0x11'),_0x56eced[_0x0e52('0x12')]());return db[_0x0e52('0xc')][_0x0e52('0x13')]({'closeReason':'system','disposition':_0x0e52('0x14'),'closed':!![],'closedAt':moment()[_0x0e52('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x56eced}});}})[_0x0e52('0x16')](function(){if(_0x56eced&&_0x56eced[_0x0e52('0x17')]){logger[_0x0e52('0x18')](_0x0e52('0x19'),_0x56eced[_0x0e52('0x12')]());for(var _0x349ad9=0x0;_0x349ad9<_0x56eced[_0x0e52('0x17')];_0x349ad9++){io[_0x0e52('0x1a')](_0x0e52('0x1b'),{'id':_0x56eced[_0x349ad9],'closed':!![]});}}})[_0x0e52('0x1c')](function(_0x503758){logger[_0x0e52('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x503758?util['inspect'](_0x503758,{'showHidden':![],'depth':null}):'');});}exports[_0x0e52('0x1e')]=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 aab4515..9b3de89 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 _0x788a=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x428a75,_0x158a1a){var _0x3bffd0=function(_0x2043f1){while(--_0x2043f1){_0x428a75['push'](_0x428a75['shift']());}};_0x3bffd0(++_0x158a1a);}(_0x788a,0x93));var _0xa788=function(_0x26a51d,_0x5aaa3a){_0x26a51d=_0x26a51d-0x0;var _0x1d8bef=_0x788a[_0x26a51d];return _0x1d8bef;};'use strict';function start(){var _0x5c49bc=require(_0xa788('0x0'));return _0x5c49bc['startAllRefreshIntervals']();}module[_0xa788('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xa0d3=['exports'];(function(_0x527957,_0x5ddfb4){var _0x48b5c0=function(_0x4f8d5c){while(--_0x4f8d5c){_0x527957['push'](_0x527957['shift']());}};_0x48b5c0(++_0x5ddfb4);}(_0xa0d3,0xab));var _0x3a0d=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xa0d3[_0x999b85];return _0x1d7124;};'use strict';function start(){var _0x46a182=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x46a182['startAllRefreshIntervals']();}module[_0x3a0d('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 50f005a..3e401e5 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 _0x0a6a=['dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','toString','keyBy','intersection','difference','exists','deleteJob','delete\x20cron','toRun','length','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','run','start','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','then','catch','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','stringify','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','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','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','[handleSendEmail]\x20Unrecognized\x20status:','SendMail','error','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retries','data','operation','stop','still\x20loading','job','case\x20failed','Unrecognized\x20status:','entity'];(function(_0x1f0e4f,_0x12be3b){var _0x26fad7=function(_0xc2b297){while(--_0xc2b297){_0x1f0e4f['push'](_0x1f0e4f['shift']());}};_0x26fad7(++_0x12be3b);}(_0x0a6a,0x96));var _0xa0a6=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0x0a6a[_0x1b4bef];return _0xf377eb;};'use strict';var fs=require('fs');var util=require(_0xa0a6('0x0'));var path=require(_0xa0a6('0x1'));var _=require(_0xa0a6('0x2'));var moment=require(_0xa0a6('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xa0a6('0x4'));var BPromise=require(_0xa0a6('0x5'));var logger=require(_0xa0a6('0x6'))(_0xa0a6('0x7'));var db=require(_0xa0a6('0x8'))['db'];const retry=require(_0xa0a6('0x9'));var analyticCustomReportController=require(_0xa0a6('0xa'));var analyticDefaultReportController=require(_0xa0a6('0xb'));var client=jayson['client'][_0xa0a6('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x521563){const _0x2a2046={};if(typeof _0x521563===_0xa0a6('0xd')){_0x2a2046['id']=_0x521563;}return db[_0xa0a6('0xe')]['findOne']({'where':_0x2a2046})[_0xa0a6('0xf')](function(_0xa3324b){return _0xa3324b;})[_0xa0a6('0x10')](function(_0x209f13){logger['error'](_0x209f13);});}function handleSendEmail(_0x3f1fc9,_0x1e626c){logger[_0xa0a6('0x11')](_0xa0a6('0x12'),_0x3f1fc9[_0xa0a6('0x13')]);var _0x4ad83f=!![];var _0x32823f=_0x3f1fc9['MailAccount'][_0xa0a6('0x14')]();var _0x4c58d7={'account':_0x32823f,'message':{'from':util[_0xa0a6('0x15')](_0xa0a6('0x16'),_0x3f1fc9[_0xa0a6('0x17')][_0xa0a6('0x18')],_0x3f1fc9[_0xa0a6('0x17')][_0xa0a6('0x13')]||_0x3f1fc9[_0xa0a6('0x17')][_0xa0a6('0x19')][_0xa0a6('0x1a')]),'to':_0x3f1fc9[_0xa0a6('0x13')],'cc':_0x3f1fc9['cc'],'bcc':_0x3f1fc9['bcc'],'subject':util[_0xa0a6('0x15')](_0xa0a6('0x1b'),_0x1e626c[_0xa0a6('0x18')],_0x3f1fc9[_0xa0a6('0x1c')],_0x3f1fc9[_0xa0a6('0x1d')])}};var _0x3ac828=path[_0xa0a6('0x1e')](__dirname,_0xa0a6('0x1f'));var _0x31e978=_0x1e626c[_0xa0a6('0x20')];var _0x2a15f3=util[_0xa0a6('0x15')](_0xa0a6('0x21'),path[_0xa0a6('0x22')](_0x1e626c['savename'],path[_0xa0a6('0x23')](_0x1e626c['savename'])),_0xa0a6('0x24'));var _0x37e0dc=path[_0xa0a6('0x1e')](_0x3ac828,_0x31e978);var _0x5125c4=path[_0xa0a6('0x1e')](_0x3ac828,_0x2a15f3);if(fs[_0xa0a6('0x25')](_0x37e0dc)){_0x1e626c[_0xa0a6('0x26')]=_0xa0a6('0x27');_0x4c58d7[_0xa0a6('0x28')]['attachments']=[{'filename':_0x31e978,'path':_0x37e0dc}];_0x4c58d7[_0xa0a6('0x28')][_0xa0a6('0x29')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xa0a6('0x2a')](_0x1e626c,null,0x2));}else if(fs['existsSync'](_0x5125c4)){_0x1e626c[_0xa0a6('0x26')]='Sent';_0x4c58d7[_0xa0a6('0x28')][_0xa0a6('0x2b')]=[{'filename':_0x2a15f3,'path':_0x5125c4}];}else{if(_0x1e626c['status']===_0xa0a6('0x2c')){_0x4c58d7[_0xa0a6('0x28')][_0xa0a6('0x29')]=_0xa0a6('0x2d');if(!_0x3f1fc9['sendIfEmpty']){_0x4ad83f=![];logger['info'](_0xa0a6('0x2e'));}}else if(_0x1e626c[_0xa0a6('0x26')]==='Loading'){_0x4c58d7['message']['text']=_0xa0a6('0x2f');}else if(_0x1e626c[_0xa0a6('0x26')]==='Completed'){_0x4c58d7[_0xa0a6('0x28')]['text']=_0xa0a6('0x30');}else if(_0x1e626c[_0xa0a6('0x26')]===_0xa0a6('0x31')){_0x4c58d7[_0xa0a6('0x28')][_0xa0a6('0x29')]='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['error'](_0xa0a6('0x32'),_0x1e626c[_0xa0a6('0x26')]);}}if(_0x4ad83f){return client['request'](_0xa0a6('0x33'),_0x4c58d7)[_0xa0a6('0xf')](function(_0xeb98d1){if(_0xeb98d1[_0xa0a6('0x34')]){return logger['error'](_0xa0a6('0x35'),JSON[_0xa0a6('0x2a')](_0xeb98d1));}return logger[_0xa0a6('0x11')](_0xa0a6('0x36'));})[_0xa0a6('0x10')](function(_0x21d5cf){return logger['error'](_0xa0a6('0x35'),JSON['stringify'](_0x21d5cf));});}}function handleError(){return function(_0x18e682){return logger[_0xa0a6('0x34')](JSON[_0xa0a6('0x2a')](_0x18e682));};}function loading(_0x18bbe1){logger['info'](_0xa0a6('0x37'));if(_0x18bbe1[_0xa0a6('0x38')]===_0x18bbe1['retryOptions'][_0xa0a6('0x39')]){handleSendEmail(_0x18bbe1['job'],_0x18bbe1[_0xa0a6('0x3a')]);_0x18bbe1[_0xa0a6('0x3b')][_0xa0a6('0x3c')]();}else{_0x18bbe1[_0xa0a6('0x3b')]['retry'](_0xa0a6('0x3d'));}}function completed(_0x4730bb){logger[_0xa0a6('0x11')]('case\x20completed');handleSendEmail(_0x4730bb[_0xa0a6('0x3e')],_0x4730bb[_0xa0a6('0x3a')]);_0x4730bb['operation']['stop']();}function empty(_0x2e5f50){logger[_0xa0a6('0x11')]('case\x20empty');handleSendEmail(_0x2e5f50[_0xa0a6('0x3e')],_0x2e5f50[_0xa0a6('0x3a')]);_0x2e5f50[_0xa0a6('0x3b')][_0xa0a6('0x3c')]();}function failed(_0x563a4f){logger[_0xa0a6('0x11')](_0xa0a6('0x3f'));handleSendEmail(_0x563a4f[_0xa0a6('0x3e')],_0x563a4f[_0xa0a6('0x3a')]);_0x563a4f[_0xa0a6('0x3b')][_0xa0a6('0x3c')]();}function urecognized(_0x53a8ad){logger[_0xa0a6('0x34')](_0xa0a6('0x40'),_0x53a8ad[_0xa0a6('0x41')][_0xa0a6('0x42')][_0xa0a6('0x26')]);_0x53a8ad[_0xa0a6('0x3b')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2fa06c,_0x27c4ed){const _0x1beae2={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x17ac82=retry[_0xa0a6('0x3b')](_0x1beae2);_0x17ac82['attempt'](_0x2c4fc9=>{logger['info'](_0xa0a6('0x43')+_0x2fa06c['id']+_0xa0a6('0x44')+_0x2c4fc9);try{getReportData(_0x27c4ed['id'])[_0xa0a6('0xf')](function(_0x2f0e68){_0x27c4ed=_0x2f0e68;logger['info'](_0xa0a6('0x45'),_0x2f0e68[_0xa0a6('0x42')][_0xa0a6('0x26')]);if(!reportStatusStrategies[_0x2f0e68[_0xa0a6('0x42')][_0xa0a6('0x26')]]){logger[_0xa0a6('0x34')](_0xa0a6('0x45'),_0x2f0e68[_0xa0a6('0x42')]['status']);_0x17ac82[_0xa0a6('0x9')]();}reportStatusStrategies[_0x2f0e68[_0xa0a6('0x42')][_0xa0a6('0x26')]]({'operation':_0x17ac82,'currentAttempt':_0x2c4fc9,'retryOptions':_0x1beae2,'job':_0x2fa06c,'data':_0x27c4ed,'entity':_0x2f0e68});});}catch(_0x359368){_0x17ac82[_0xa0a6('0x9')](_0x359368);}});}function handleResult(_0x59894e){return function(_0x2dba90){if(_0x59894e[_0xa0a6('0x46')]&&_0x59894e[_0xa0a6('0x17')]&&_0x59894e[_0xa0a6('0x17')][_0xa0a6('0x19')]&&!_[_0xa0a6('0x47')](_0x59894e[_0xa0a6('0x13')])){retryer(_0x59894e,_0x2dba90);}};}function handleJob(_0x2a2837){return function(){try{if(_[_0xa0a6('0x47')](_0x2a2837[_0xa0a6('0x1c')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x2a2837[_0xa0a6('0x1d')])){return logger[_0xa0a6('0x11')](_0xa0a6('0x48'));}var _0x174492={'startDate':moment()[_0xa0a6('0x49')](_0x2a2837[_0xa0a6('0x1c')],_0x2a2837['subtractUnit'])[_0xa0a6('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa0a6('0x15')](_0xa0a6('0x4a')),'type':_0xa0a6('0x4b'),'output':_0x2a2837[_0xa0a6('0x4c')],'name':_0x2a2837[_0xa0a6('0x18')]};if(!_['isNil'](_0x2a2837[_0xa0a6('0x4d')])){logger[_0xa0a6('0x11')](_0xa0a6('0x4e'),_0x2a2837[_0xa0a6('0x4d')]);return analyticDefaultReportController[_0xa0a6('0x4f')]({'id':_0x2a2837['DefaultReportId']},_0x174492)[_0xa0a6('0xf')](handleResult(_0x2a2837))['catch'](handleError());}if(!_[_0xa0a6('0x47')](_0x2a2837[_0xa0a6('0x50')])){logger['info'](_0xa0a6('0x51'),_0x2a2837[_0xa0a6('0x50')]);return analyticCustomReportController[_0xa0a6('0x4f')]({'id':_0x2a2837[_0xa0a6('0x50')]},_0x174492)['then'](handleResult(_0x2a2837))[_0xa0a6('0x10')](handleError());}}catch(_0x56dbad){logger[_0xa0a6('0x34')](JSON[_0xa0a6('0x2a')](_0x56dbad));}return logger[_0xa0a6('0x11')](_0xa0a6('0x52'));};}function getJobs(_0x15f4e7){var _0x492273={};if(_0x15f4e7){_0x492273['id']=_0x15f4e7;}return db[_0xa0a6('0x53')][_0xa0a6('0x54')]({'where':_0x492273,'include':[{'model':db[_0xa0a6('0x17')],'attributes':['id',_0xa0a6('0x18'),_0xa0a6('0x13')],'include':[{'model':db['MailServerOut'],'as':_0xa0a6('0x19'),'include':[{'model':db[_0xa0a6('0x55')],'as':_0xa0a6('0x55')}]}]}]})[_0xa0a6('0xf')](function(_0x3a800f){var _0x55af0c=_[_0xa0a6('0x56')](manager['jobs']);var _0x1c6db8=_[_0xa0a6('0x57')](_0x3a800f,function(_0x1e3d61){return _0x1e3d61['id'][_0xa0a6('0x58')]();});var _0x19b2a5=_[_0xa0a6('0x59')](_0x3a800f,function(_0x1d9ba7){return _0x1d9ba7['id']['toString']();});var _0x5c5e5b=_0x15f4e7?_0x1c6db8:_['difference'](_0x1c6db8,_0x55af0c);var _0x5606bb=_[_0xa0a6('0x5a')](_0x1c6db8,_0x55af0c);var _0x3f5d7b=_[_0xa0a6('0x5b')](_0x55af0c,_0x1c6db8);var _0x20ef68;var _0x10738d;for(_0x20ef68=0x0;_0x20ef68<_0x3f5d7b['length']&&!_0x15f4e7;_0x20ef68+=0x1){_0x10738d=_0x3f5d7b[_0x20ef68][_0xa0a6('0x58')]();if(manager[_0xa0a6('0x5c')](_0x10738d)){manager[_0xa0a6('0x3c')](_0x10738d);manager[_0xa0a6('0x5d')](_0x10738d);logger[_0xa0a6('0x11')](_0xa0a6('0x5e'),_0x10738d);}}logger[_0xa0a6('0x11')](_0xa0a6('0x5f'),JSON[_0xa0a6('0x2a')](_0x5c5e5b));for(_0x20ef68=0x0;_0x20ef68<_0x5c5e5b[_0xa0a6('0x60')];_0x20ef68+=0x1){_0x10738d=_0x5c5e5b[_0x20ef68][_0xa0a6('0x58')]();if(_0x15f4e7){logger[_0xa0a6('0x11')](JSON[_0xa0a6('0x2a')](_0x19b2a5[_0x10738d]));BPromise['resolve']()['then'](handleJob(_0x19b2a5[_0x10738d]));logger[_0xa0a6('0x11')]('run\x20job',_0x19b2a5[_0x10738d][_0xa0a6('0x18')],_0x19b2a5[_0x10738d][_0xa0a6('0x61')]);}else if(_0x19b2a5[_0x10738d][_0xa0a6('0x61')]&&_0x19b2a5[_0x10738d][_0xa0a6('0x62')]&&moment()[_0xa0a6('0x63')](_0x19b2a5[_0x10738d][_0xa0a6('0x64')],_0x19b2a5[_0x10738d][_0xa0a6('0x65')])){manager[_0xa0a6('0x66')](_0x10738d,_0x19b2a5[_0x10738d]['cron'],handleJob(_0x19b2a5[_0x10738d]));manager['start'](_0x10738d);logger['info'](_0xa0a6('0x67'),_0x19b2a5[_0x10738d][_0xa0a6('0x18')],_0x19b2a5[_0x10738d][_0xa0a6('0x61')]);}else if(manager[_0xa0a6('0x5c')](_0x10738d)){manager['stop'](_0x10738d);manager['deleteJob'](_0x10738d);logger[_0xa0a6('0x11')](_0xa0a6('0x68'),_0x19b2a5[_0x10738d]['name'],_0x19b2a5[_0x10738d][_0xa0a6('0x61')]);}}for(_0x20ef68=0x0,_0x10738d;_0x20ef68<_0x5606bb[_0xa0a6('0x60')]&&!_0x15f4e7;_0x20ef68+=0x1){_0x10738d=_0x5606bb[_0x20ef68][_0xa0a6('0x58')]();if(manager[_0xa0a6('0x5c')](_0x10738d)){if(_0x19b2a5[_0x10738d][_0xa0a6('0x61')]&&_0x19b2a5[_0x10738d][_0xa0a6('0x62')]&&moment()['isBetween'](_0x19b2a5[_0x10738d][_0xa0a6('0x64')],_0x19b2a5[_0x10738d][_0xa0a6('0x65')])){manager[_0xa0a6('0x69')](_0x10738d,_0x19b2a5[_0x10738d][_0xa0a6('0x61')],handleJob(_0x19b2a5[_0x10738d]));logger['info']('update\x20cron',_0x19b2a5[_0x10738d][_0xa0a6('0x18')],_0x19b2a5[_0x10738d][_0xa0a6('0x61')]);}else{manager[_0xa0a6('0x3c')](_0x10738d);manager[_0xa0a6('0x5d')](_0x10738d);logger[_0xa0a6('0x11')](_0xa0a6('0x68'),_0x19b2a5[_0x10738d]['name'],_0x19b2a5[_0x10738d][_0xa0a6('0x61')]);}}}})[_0xa0a6('0x10')](function(_0x47324d){logger['error'](JSON[_0xa0a6('0x2a')](_0x47324d));});}exports[_0xa0a6('0x6a')]=function(_0x400dd8){return getJobs(_0x400dd8);};exports[_0xa0a6('0x6b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa740=['Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retryOptions','job','data','operation','stop','case\x20completed','Unrecognized\x20status:','dataValues','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','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'];(function(_0x1f1398,_0x5cbe5e){var _0xdabd3c=function(_0x5ba839){while(--_0x5ba839){_0x1f1398['push'](_0x1f1398['shift']());}};_0xdabd3c(++_0x5cbe5e);}(_0xa740,0x10b));var _0x0a74=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0xa740[_0x1dd4de];return _0xf23408;};'use strict';var fs=require('fs');var util=require(_0x0a74('0x0'));var path=require(_0x0a74('0x1'));var _=require(_0x0a74('0x2'));var moment=require('moment');var CronJobManager=require(_0x0a74('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x0a74('0x4'));var logger=require('../logger')(_0x0a74('0x5'));var db=require(_0x0a74('0x6'))['db'];const retry=require(_0x0a74('0x7'));var analyticCustomReportController=require(_0x0a74('0x8'));var analyticDefaultReportController=require(_0x0a74('0x9'));var client=jayson['client'][_0x0a74('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1b7775){const _0x4d3a07={};if(typeof _0x1b7775===_0x0a74('0xb')){_0x4d3a07['id']=_0x1b7775;}return db[_0x0a74('0xc')][_0x0a74('0xd')]({'where':_0x4d3a07})[_0x0a74('0xe')](function(_0x318810){return _0x318810;})['catch'](function(_0x66d346){logger[_0x0a74('0xf')](_0x66d346);});}function handleSendEmail(_0x33e29e,_0x1cb695){logger[_0x0a74('0x10')](_0x0a74('0x11'),_0x33e29e[_0x0a74('0x12')]);var _0x5022b4=!![];var _0x1a8864=_0x33e29e[_0x0a74('0x13')][_0x0a74('0x14')]();var _0xf42250={'account':_0x1a8864,'message':{'from':util[_0x0a74('0x15')]('\x22%s\x22\x20<%s>',_0x33e29e[_0x0a74('0x13')][_0x0a74('0x16')],_0x33e29e['MailAccount'][_0x0a74('0x12')]||_0x33e29e[_0x0a74('0x13')][_0x0a74('0x17')][_0x0a74('0x18')]),'to':_0x33e29e[_0x0a74('0x12')],'cc':_0x33e29e['cc'],'bcc':_0x33e29e['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x1cb695['name'],_0x33e29e[_0x0a74('0x19')],_0x33e29e[_0x0a74('0x1a')])}};var _0x89e4a=path[_0x0a74('0x1b')](__dirname,_0x0a74('0x1c'));var _0x3957c7=_0x1cb695[_0x0a74('0x1d')];var _0x5db1e3=util[_0x0a74('0x15')](_0x0a74('0x1e'),path[_0x0a74('0x1f')](_0x1cb695[_0x0a74('0x1d')],path[_0x0a74('0x20')](_0x1cb695[_0x0a74('0x1d')])),_0x0a74('0x21'));var _0x4c17f3=path[_0x0a74('0x1b')](_0x89e4a,_0x3957c7);var _0x3db459=path[_0x0a74('0x1b')](_0x89e4a,_0x5db1e3);if(fs[_0x0a74('0x22')](_0x4c17f3)){_0x1cb695['status']=_0x0a74('0x23');_0xf42250[_0x0a74('0x24')]['attachments']=[{'filename':_0x3957c7,'path':_0x4c17f3}];_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=util[_0x0a74('0x15')](_0x0a74('0x26'),JSON[_0x0a74('0x27')](_0x1cb695,null,0x2));}else if(fs[_0x0a74('0x22')](_0x3db459)){_0x1cb695['status']=_0x0a74('0x23');_0xf42250[_0x0a74('0x24')][_0x0a74('0x28')]=[{'filename':_0x5db1e3,'path':_0x3db459}];}else{if(_0x1cb695[_0x0a74('0x29')]==='Empty'){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2a');if(!_0x33e29e[_0x0a74('0x2b')]){_0x5022b4=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x2c')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2d');}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x2e')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x2f');}else if(_0x1cb695[_0x0a74('0x29')]===_0x0a74('0x30')){_0xf42250[_0x0a74('0x24')][_0x0a74('0x25')]=_0x0a74('0x31');}else{logger['error'](_0x0a74('0x32'),_0x1cb695[_0x0a74('0x29')]);}}if(_0x5022b4){return client[_0x0a74('0x33')](_0x0a74('0x34'),_0xf42250)[_0x0a74('0xe')](function(_0xdf9647){if(_0xdf9647[_0x0a74('0xf')]){return logger[_0x0a74('0xf')](_0x0a74('0x35'),JSON[_0x0a74('0x27')](_0xdf9647));}return logger[_0x0a74('0x10')](_0x0a74('0x36'));})[_0x0a74('0x37')](function(_0x138794){return logger[_0x0a74('0xf')](_0x0a74('0x35'),JSON['stringify'](_0x138794));});}}function handleError(){return function(_0x328bcd){return logger[_0x0a74('0xf')](JSON['stringify'](_0x328bcd));};}function loading(_0x3e1e48){logger[_0x0a74('0x10')](_0x0a74('0x38'));if(_0x3e1e48[_0x0a74('0x39')]===_0x3e1e48[_0x0a74('0x3a')]['retries']){handleSendEmail(_0x3e1e48[_0x0a74('0x3b')],_0x3e1e48[_0x0a74('0x3c')]);_0x3e1e48[_0x0a74('0x3d')][_0x0a74('0x3e')]();}else{_0x3e1e48[_0x0a74('0x3d')][_0x0a74('0x7')]('still\x20loading');}}function completed(_0x1f492d){logger[_0x0a74('0x10')](_0x0a74('0x3f'));handleSendEmail(_0x1f492d[_0x0a74('0x3b')],_0x1f492d[_0x0a74('0x3c')]);_0x1f492d['operation']['stop']();}function empty(_0x21e9b6){logger[_0x0a74('0x10')]('case\x20empty');handleSendEmail(_0x21e9b6[_0x0a74('0x3b')],_0x21e9b6[_0x0a74('0x3c')]);_0x21e9b6[_0x0a74('0x3d')][_0x0a74('0x3e')]();}function failed(_0x3eca0b){logger[_0x0a74('0x10')]('case\x20failed');handleSendEmail(_0x3eca0b[_0x0a74('0x3b')],_0x3eca0b['data']);_0x3eca0b['operation']['stop']();}function urecognized(_0x472355){logger[_0x0a74('0xf')](_0x0a74('0x40'),_0x472355['entity'][_0x0a74('0x41')]['status']);_0x472355[_0x0a74('0x3d')][_0x0a74('0x3e')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xd9c336,_0x468fbe){const _0x3310b0={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xdbc992=retry['operation'](_0x3310b0);_0xdbc992['attempt'](_0x17ef8f=>{logger[_0x0a74('0x10')](_0x0a74('0x42')+_0xd9c336['id']+'\x20Attempt\x20#:'+_0x17ef8f);try{getReportData(_0x468fbe['id'])['then'](function(_0x2a480c){_0x468fbe=_0x2a480c;logger['info'](_0x0a74('0x43'),_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]);if(!reportStatusStrategies[_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]]){logger[_0x0a74('0xf')](_0x0a74('0x43'),_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]);_0xdbc992[_0x0a74('0x7')]();}reportStatusStrategies[_0x2a480c[_0x0a74('0x41')][_0x0a74('0x29')]]({'operation':_0xdbc992,'currentAttempt':_0x17ef8f,'retryOptions':_0x3310b0,'job':_0xd9c336,'data':_0x468fbe,'entity':_0x2a480c});});}catch(_0xfb9a5c){_0xdbc992['retry'](_0xfb9a5c);}});}function handleResult(_0x40d9ee){return function(_0x177e8b){if(_0x40d9ee[_0x0a74('0x44')]&&_0x40d9ee['MailAccount']&&_0x40d9ee['MailAccount'][_0x0a74('0x17')]&&!_[_0x0a74('0x45')](_0x40d9ee[_0x0a74('0x12')])){retryer(_0x40d9ee,_0x177e8b);}};}function handleJob(_0x9d867c){return function(){try{if(_['isNil'](_0x9d867c[_0x0a74('0x19')])){return logger[_0x0a74('0x10')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0a74('0x45')](_0x9d867c[_0x0a74('0x1a')])){return logger['info'](_0x0a74('0x46'));}var _0xcafd6c={'startDate':moment()[_0x0a74('0x47')](_0x9d867c['subtractNumber'],_0x9d867c[_0x0a74('0x1a')])['format'](_0x0a74('0x48')),'endDate':moment()[_0x0a74('0x15')](_0x0a74('0x48')),'type':_0x0a74('0x49'),'output':_0x9d867c['output'],'name':_0x9d867c['name']};if(!_[_0x0a74('0x45')](_0x9d867c[_0x0a74('0x4a')])){logger[_0x0a74('0x10')]('exec\x20defaul\x20report\x20id:%s',_0x9d867c[_0x0a74('0x4a')]);return analyticDefaultReportController['runReport']({'id':_0x9d867c['DefaultReportId']},_0xcafd6c)[_0x0a74('0xe')](handleResult(_0x9d867c))['catch'](handleError());}if(!_['isNil'](_0x9d867c[_0x0a74('0x4b')])){logger[_0x0a74('0x10')]('exec\x20custom\x20report\x20id:%s',_0x9d867c['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x9d867c[_0x0a74('0x4b')]},_0xcafd6c)['then'](handleResult(_0x9d867c))[_0x0a74('0x37')](handleError());}}catch(_0x222242){logger[_0x0a74('0xf')](JSON[_0x0a74('0x27')](_0x222242));}return logger[_0x0a74('0x10')](_0x0a74('0x4c'));};}function getJobs(_0x277118){var _0x290ac1={};if(_0x277118){_0x290ac1['id']=_0x277118;}return db[_0x0a74('0x4d')][_0x0a74('0x4e')]({'where':_0x290ac1,'include':[{'model':db[_0x0a74('0x13')],'attributes':['id',_0x0a74('0x16'),_0x0a74('0x12')],'include':[{'model':db['MailServerOut'],'as':_0x0a74('0x17'),'include':[{'model':db[_0x0a74('0x4f')],'as':'CloudProvider'}]}]}]})['then'](function(_0x1711be){var _0x45bfeb=_[_0x0a74('0x50')](manager[_0x0a74('0x51')]);var _0x3b8d4e=_[_0x0a74('0x52')](_0x1711be,function(_0x466cce){return _0x466cce['id'][_0x0a74('0x53')]();});var _0x12036a=_['keyBy'](_0x1711be,function(_0x3716c1){return _0x3716c1['id'][_0x0a74('0x53')]();});var _0x23ad82=_0x277118?_0x3b8d4e:_[_0x0a74('0x54')](_0x3b8d4e,_0x45bfeb);var _0x555f67=_[_0x0a74('0x55')](_0x3b8d4e,_0x45bfeb);var _0x50ccee=_[_0x0a74('0x54')](_0x45bfeb,_0x3b8d4e);var _0x4a9412;var _0x2684c3;for(_0x4a9412=0x0;_0x4a9412<_0x50ccee[_0x0a74('0x56')]&&!_0x277118;_0x4a9412+=0x1){_0x2684c3=_0x50ccee[_0x4a9412][_0x0a74('0x53')]();if(manager[_0x0a74('0x57')](_0x2684c3)){manager['stop'](_0x2684c3);manager[_0x0a74('0x58')](_0x2684c3);logger[_0x0a74('0x10')](_0x0a74('0x59'),_0x2684c3);}}logger[_0x0a74('0x10')](_0x0a74('0x5a'),JSON[_0x0a74('0x27')](_0x23ad82));for(_0x4a9412=0x0;_0x4a9412<_0x23ad82[_0x0a74('0x56')];_0x4a9412+=0x1){_0x2684c3=_0x23ad82[_0x4a9412]['toString']();if(_0x277118){logger[_0x0a74('0x10')](JSON[_0x0a74('0x27')](_0x12036a[_0x2684c3]));BPromise[_0x0a74('0x5b')]()[_0x0a74('0xe')](handleJob(_0x12036a[_0x2684c3]));logger[_0x0a74('0x10')](_0x0a74('0x5c'),_0x12036a[_0x2684c3]['name'],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else if(_0x12036a[_0x2684c3][_0x0a74('0x5d')]&&_0x12036a[_0x2684c3][_0x0a74('0x5e')]&&moment()[_0x0a74('0x5f')](_0x12036a[_0x2684c3][_0x0a74('0x60')],_0x12036a[_0x2684c3][_0x0a74('0x61')])){manager[_0x0a74('0x62')](_0x2684c3,_0x12036a[_0x2684c3]['cron'],handleJob(_0x12036a[_0x2684c3]));manager[_0x0a74('0x63')](_0x2684c3);logger['info'](_0x0a74('0x64'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else if(manager[_0x0a74('0x57')](_0x2684c3)){manager['stop'](_0x2684c3);manager['deleteJob'](_0x2684c3);logger['info'](_0x0a74('0x65'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}}for(_0x4a9412=0x0,_0x2684c3;_0x4a9412<_0x555f67[_0x0a74('0x56')]&&!_0x277118;_0x4a9412+=0x1){_0x2684c3=_0x555f67[_0x4a9412][_0x0a74('0x53')]();if(manager[_0x0a74('0x57')](_0x2684c3)){if(_0x12036a[_0x2684c3]['cron']&&_0x12036a[_0x2684c3]['active']&&moment()[_0x0a74('0x5f')](_0x12036a[_0x2684c3][_0x0a74('0x60')],_0x12036a[_0x2684c3]['endAt'])){manager[_0x0a74('0x66')](_0x2684c3,_0x12036a[_0x2684c3][_0x0a74('0x5d')],handleJob(_0x12036a[_0x2684c3]));logger['info'](_0x0a74('0x67'),_0x12036a[_0x2684c3][_0x0a74('0x16')],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}else{manager[_0x0a74('0x3e')](_0x2684c3);manager[_0x0a74('0x58')](_0x2684c3);logger[_0x0a74('0x10')]('stop\x20cron',_0x12036a[_0x2684c3]['name'],_0x12036a[_0x2684c3][_0x0a74('0x5d')]);}}}})[_0x0a74('0x37')](function(_0x3020ea){logger[_0x0a74('0xf')](JSON[_0x0a74('0x27')](_0x3020ea));});}exports[_0x0a74('0x68')]=function(_0x4eb810){return getJobs(_0x4eb810);};exports[_0x0a74('0x63')]=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 d8a9126..84aabee 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 _0xd668=['detectSentiment','substring','info','format','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','sentiment','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','COMPLETED','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','Comprehend'];(function(_0x138f1c,_0x27cca5){var _0x49e771=function(_0x16df59){while(--_0x16df59){_0x138f1c['push'](_0x138f1c['shift']());}};_0x49e771(++_0x27cca5);}(_0xd668,0x108));var _0x8d66=function(_0x527fa6,_0x288ba9){_0x527fa6=_0x527fa6-0x0;var _0x3484e3=_0xd668[_0x527fa6];return _0x3484e3;};var _=require(_0x8d66('0x0'));var AWS=require(_0x8d66('0x1'));var rp=require(_0x8d66('0x2'));var util=require(_0x8d66('0x3'));var BPromise=require(_0x8d66('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8d66('0x5'));function getTranscriptionJob(_0x1b25be,_0x41b1e2,_0x28df74,_0x486c9b){return new Promise(function(_0x5dc979,_0x1432e3){var _0x32c816=new AWS[(_0x8d66('0x6'))]({'accessKeyId':_0x41b1e2,'secretAccessKey':_0x1b25be,'region':_0x28df74});_0x32c816['getTranscriptionJob']({'TranscriptionJobName':_0x486c9b},function(_0x10e4cf,_0x34d28d){if(_0x10e4cf){return _0x1432e3(_0x10e4cf);}else{return _0x5dc979(_0x34d28d);}});});}function sentiment(_0x250844,_0x442c93,_0x5bc248,_0xf23bd5,_0x224af3){return new Promise(function(_0xdeb7dc,_0x354d88){var _0x5919a1=new AWS[(_0x8d66('0x7'))]({'accessKeyId':_0x442c93,'secretAccessKey':_0x250844,'region':_0x5bc248});_0x5919a1[_0x8d66('0x8')]({'Text':_0xf23bd5,'LanguageCode':_0x224af3[_0x8d66('0x9')](0x0,0x2)},function(_0x463ce7,_0x4ac289){if(_0x463ce7){return _0x354d88(_0x463ce7);}else{return _0xdeb7dc(_0x4ac289);}});});}function checkTranscribeJob(_0x2bedf8,_0x23709b,_0x414d03){var _0x5e1616;return new BPromise(function(_0x31f84f,_0x2f4863){logger[_0x8d66('0xa')](util[_0x8d66('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2bedf8['id'],_0x2bedf8['transcribeName']));return getTranscriptionJob(_0x414d03['data1'],_0x414d03[_0x8d66('0xc')],_0x23709b[_0x8d66('0xd')],_0x2bedf8[_0x8d66('0xe')])[_0x8d66('0xf')](function(_0x542e11){logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x10'),_0x2bedf8['id'],_0x2bedf8[_0x8d66('0xe')],_0x542e11['TranscriptionJob'][_0x8d66('0x11')]));if(!_0x2bedf8[_0x8d66('0x12')]){switch(_0x542e11['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x457f32={'transcribeStatus':_0x542e11[_0x8d66('0x13')][_0x8d66('0x11')],'fileUri':_0x542e11[_0x8d66('0x13')][_0x8d66('0x14')][_0x8d66('0x15')]};logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x16'),_0x2bedf8['id']));return rp({'uri':_0x542e11[_0x8d66('0x13')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x8d66('0xf')](function(_0x5f1a5f){logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x17'),_0x2bedf8['id']));if(_0x5f1a5f&&_0x5f1a5f[_0x8d66('0x18')]&&_0x5f1a5f[_0x8d66('0x18')]['transcripts']&&_0x5f1a5f[_0x8d66('0x18')][_0x8d66('0x19')][_0x8d66('0x1a')]){_0x457f32[_0x8d66('0x12')]='';for(var _0x36443e=0x0;_0x36443e<_0x5f1a5f[_0x8d66('0x18')]['transcripts'][_0x8d66('0x1a')];_0x36443e++){_0x457f32[_0x8d66('0x12')]+=_0x5f1a5f[_0x8d66('0x18')][_0x8d66('0x19')][_0x36443e][_0x8d66('0x1b')]+'';}}return _0x2bedf8[_0x8d66('0x1c')](_0x457f32);})[_0x8d66('0xf')](function(){logger[_0x8d66('0xa')](util['format'](_0x8d66('0x1d'),_0x2bedf8['id']));if(!_0x2bedf8['tempSentiment']){throw new db[(_0x8d66('0x1e'))]['ValidationError'](_0x8d66('0x1f'));}if(!_0x23709b['sentiment']||!_0x23709b['sentimentAccountId']||!_0x23709b[_0x8d66('0x20')]||!_0x23709b[_0x8d66('0x21')]||!_0x23709b[_0x8d66('0x22')]){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x24'));}if(!_0x457f32[_0x8d66('0x12')]){throw new Error(_0x8d66('0x25'));}if(_0x23709b[_0x8d66('0x26')]===_0x414d03['id']){return _0x414d03;}else{return db[_0x8d66('0x27')]['findOne']({'where':{'id':_settings[_0x8d66('0x26')]}});}})[_0x8d66('0xf')](function(_0x1fd203){if(!_0x1fd203){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x28'));}if(!_0x1fd203[_0x8d66('0x29')]||!_0x1fd203['data2']){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x2a'));}_0x5e1616=_0x1fd203;logger[_0x8d66('0xa')](util[_0x8d66('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2bedf8['id']));return sentiment(_0x5e1616[_0x8d66('0x29')],_0x5e1616[_0x8d66('0xc')],_0x23709b[_0x8d66('0x20')],_0x457f32['fileText'],_0x23709b[_0x8d66('0x21')]);})['then'](function(_0x14241f){logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x2b'),_0x2bedf8['id']));return _0x2bedf8[_0x8d66('0x1c')]({'sentiment':_0x14241f[_0x8d66('0x2c')],'sPositive':_0x14241f[_0x8d66('0x2d')][_0x8d66('0x2e')],'sNegative':_0x14241f[_0x8d66('0x2d')]['Negative'],'sMixed':_0x14241f[_0x8d66('0x2d')]['Mixed'],'sNeutral':_0x14241f[_0x8d66('0x2d')]['Neutral']});})['then'](function(){logger[_0x8d66('0xa')](util['format'](_0x8d66('0x1d'),_0x2bedf8['id']));_0x31f84f();});case _0x8d66('0x2f'):return _0x2bedf8['update']({'transcribeStatus':_0x8d66('0x2f'),'failureReason':_0x542e11[_0x8d66('0x13')]['FailureReason']})[_0x8d66('0xf')](function(){logger[_0x8d66('0xa')](util[_0x8d66('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2bedf8['id']));_0x31f84f();});default:logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x30'),_0x2bedf8['id']));break;}}else{return BPromise[_0x8d66('0x31')]()[_0x8d66('0xf')](function(){if(!_0x2bedf8[_0x8d66('0x32')]){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x1f'));}if(!_0x23709b[_0x8d66('0x33')]||!_0x23709b['sentimentAccountId']||!_0x23709b[_0x8d66('0x20')]||!_0x23709b[_0x8d66('0x21')]||!_0x23709b[_0x8d66('0x22')]){throw new db[(_0x8d66('0x1e'))]['ValidationError'](_0x8d66('0x24'));}if(!_0x2bedf8['fileText']){throw new Error(_0x8d66('0x25'));}if(_0x23709b['sentimentAccountId']===_0x414d03['id']){return _0x414d03;}else{return db['CloudProvider'][_0x8d66('0x34')]({'where':{'id':_settings[_0x8d66('0x26')]}});}})[_0x8d66('0xf')](function(_0x4d658b){if(!_0x4d658b){throw new db['Sequelize']['ValidationError'](_0x8d66('0x28'));}if(!_0x4d658b[_0x8d66('0x29')]||!_0x4d658b['data2']){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x2a'));}_0x5e1616=_0x4d658b;logger[_0x8d66('0xa')](util[_0x8d66('0xb')](_0x8d66('0x35'),_0x2bedf8['id']));return sentiment(_0x5e1616[_0x8d66('0x29')],_0x5e1616['data2'],_0x23709b['sentimentRegion'],_0x2bedf8[_0x8d66('0x12')],_0x23709b[_0x8d66('0x21')]);})[_0x8d66('0xf')](function(_0x335fd4){logger[_0x8d66('0xa')](util['format'](_0x8d66('0x2b'),_0x2bedf8['id']));return _0x2bedf8['update']({'sentiment':_0x335fd4[_0x8d66('0x2c')],'sPositive':_0x335fd4[_0x8d66('0x2d')][_0x8d66('0x2e')],'sNegative':_0x335fd4['SentimentScore']['Negative'],'sMixed':_0x335fd4[_0x8d66('0x2d')]['Mixed'],'sNeutral':_0x335fd4[_0x8d66('0x2d')]['Neutral'],'transcribeStatus':_0x8d66('0x36')});})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2bedf8['id']));_0x31f84f();});}})[_0x8d66('0x37')](function(_0x1e9e33){if(_0x1e9e33){if(!_0x1e9e33['name']||_0x1e9e33[_0x8d66('0x38')]!==_0x8d66('0x39')){logger[_0x8d66('0x3a')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2bedf8['id']),util['inspect'](_0x1e9e33,{'showHidden':![],'depth':null}));}}_0x31f84f();});});}function checkTranscribe(){var _0x5d29ee;var _0x4801cc;var _0x24d988;return db[_0x8d66('0x3b')][_0x8d66('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x8d66('0xf')](function(_0x4ac1b0){if(!_0x4ac1b0||!_0x4ac1b0[_0x8d66('0x1a')]){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5d29ee=_0x4ac1b0;return db[_0x8d66('0x3d')][_0x8d66('0x34')]({'where':{'id':0x1}});})[_0x8d66('0xf')](function(_0x3a631a){if(!_0x3a631a){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))](_0x8d66('0x3e'));}_0x4801cc=_0x3a631a;if(!_0x4801cc[_0x8d66('0x5')]||!_0x4801cc['transcribeAccountId']||!_0x4801cc[_0x8d66('0xd')]||!_0x4801cc[_0x8d66('0x21')]||!_0x4801cc[_0x8d66('0x22')]){throw new db[(_0x8d66('0x1e'))][(_0x8d66('0x23'))]('Transcribe\x20not\x20configured');}return db[_0x8d66('0x27')][_0x8d66('0x34')]({'where':{'id':_0x4801cc[_0x8d66('0x3f')]}});})[_0x8d66('0xf')](function(_0x3378b5){if(!_0x3378b5){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3378b5[_0x8d66('0x29')]||!_0x3378b5[_0x8d66('0xc')]){throw new db[(_0x8d66('0x1e'))]['ValidationError'](_0x8d66('0x2a'));}_0x24d988=_0x3378b5;var _0x30260f=[];_0x5d29ee[_0x8d66('0x40')](function(_0x4daed6){_0x30260f[_0x8d66('0x41')](checkTranscribeJob(_0x4daed6,_0x4801cc,_0x24d988));});return BPromise['all'](_0x30260f);})['catch'](function(_0x24d86b){if(_0x24d86b){if(!_0x24d86b['name']||_0x24d86b[_0x8d66('0x38')]!==_0x8d66('0x39')){logger['error'](util[_0x8d66('0x42')](_0x24d86b,{'showHidden':![],'depth':null}));}}});}exports[_0x8d66('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8eba=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x333bbf,_0x46babc){var _0x24e3ff=function(_0x22cd7f){while(--_0x22cd7f){_0x333bbf['push'](_0x333bbf['shift']());}};_0x24e3ff(++_0x46babc);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x8eba[_0x1cd47d];return _0x29d52f;};var _=require(_0xa8eb('0x0'));var AWS=require(_0xa8eb('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xa8eb('0x2'))['db'];var logger=require(_0xa8eb('0x3'))(_0xa8eb('0x4'));function getTranscriptionJob(_0x2cdf40,_0x52533a,_0x3a665b,_0x187bf0){return new Promise(function(_0x5abab9,_0x321f2f){var _0x5ece80=new AWS[(_0xa8eb('0x5'))]({'accessKeyId':_0x52533a,'secretAccessKey':_0x2cdf40,'region':_0x3a665b});_0x5ece80[_0xa8eb('0x6')]({'TranscriptionJobName':_0x187bf0},function(_0x509b54,_0x8b2ae9){if(_0x509b54){return _0x321f2f(_0x509b54);}else{return _0x5abab9(_0x8b2ae9);}});});}function sentiment(_0x5d6360,_0x21e416,_0x3010d0,_0x5eb605,_0x47032d){return new Promise(function(_0x796060,_0x3e45e7){var _0x4693d6=new AWS['Comprehend']({'accessKeyId':_0x21e416,'secretAccessKey':_0x5d6360,'region':_0x3010d0});_0x4693d6[_0xa8eb('0x7')]({'Text':_0x5eb605,'LanguageCode':_0x47032d['substring'](0x0,0x2)},function(_0x20a4ca,_0x501134){if(_0x20a4ca){return _0x3e45e7(_0x20a4ca);}else{return _0x796060(_0x501134);}});});}function checkTranscribeJob(_0x193a53,_0x47149c,_0x5b21fc){var _0x2c7cff;return new BPromise(function(_0x490c4f,_0x289ed3){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0xa'),_0x193a53['id'],_0x193a53['transcribeName']));return getTranscriptionJob(_0x5b21fc[_0xa8eb('0xb')],_0x5b21fc['data2'],_0x47149c[_0xa8eb('0xc')],_0x193a53[_0xa8eb('0xd')])[_0xa8eb('0xe')](function(_0x102a81){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0xf'),_0x193a53['id'],_0x193a53[_0xa8eb('0xd')],_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]));if(!_0x193a53['fileText']){switch(_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]){case _0xa8eb('0x12'):var _0x445cc6={'transcribeStatus':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')],'fileUri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0xa8eb('0x14'),_0x193a53['id']));return rp({'uri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri'],'json':!![]})[_0xa8eb('0xe')](function(_0x1025ef){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x15'),_0x193a53['id']));if(_0x1025ef&&_0x1025ef[_0xa8eb('0x16')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xa8eb('0x18')]){_0x445cc6[_0xa8eb('0x19')]='';for(var _0xee9db2=0x0;_0xee9db2<_0x1025ef['results'][_0xa8eb('0x17')][_0xa8eb('0x18')];_0xee9db2++){_0x445cc6[_0xa8eb('0x19')]+=_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xee9db2]['transcript']+'';}}return _0x193a53[_0xa8eb('0x1a')](_0x445cc6);})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x1b'),_0x193a53['id']));if(!_0x193a53['tempSentiment']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x1d'));}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x23'));}if(!_0x445cc6[_0xa8eb('0x19')]){throw new Error(_0xa8eb('0x24'));}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db['CloudProvider'][_0xa8eb('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa8eb('0xe')](function(_0xdd5171){if(!_0xdd5171){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd5171[_0xa8eb('0xb')]||!_0xdd5171[_0xa8eb('0x26')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c7cff=_0xdd5171;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x445cc6['fileText'],_0x47149c[_0xa8eb('0x28')]);})['then'](function(_0x4a2a65){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x4a2a65[_0xa8eb('0x2a')],'sPositive':_0x4a2a65[_0xa8eb('0x2b')]['Positive'],'sNegative':_0x4a2a65['SentimentScore'][_0xa8eb('0x2c')],'sMixed':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2e')]});})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});case'FAILED':return _0x193a53[_0xa8eb('0x1a')]({'transcribeStatus':_0xa8eb('0x2f'),'failureReason':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x30')]})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});default:logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x31'),_0x193a53['id']));break;}}else{return BPromise['resolve']()[_0xa8eb('0xe')](function(){if(!_0x193a53[_0xa8eb('0x32')]){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db['Sequelize']['ValidationError'](_0xa8eb('0x23'));}if(!_0x193a53[_0xa8eb('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db[_0xa8eb('0x33')][_0xa8eb('0x25')]({'where':{'id':_settings[_0xa8eb('0x1f')]}});}})[_0xa8eb('0xe')](function(_0x141986){if(!_0x141986){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x34'));}if(!_0x141986[_0xa8eb('0xb')]||!_0x141986['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x2c7cff=_0x141986;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x193a53['fileText'],_0x47149c['language']);})[_0xa8eb('0xe')](function(_0x1548b5){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x1548b5[_0xa8eb('0x2a')],'sPositive':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x36')],'sNegative':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2c')],'sMixed':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x1548b5['SentimentScore'][_0xa8eb('0x2e')],'transcribeStatus':'COMPLETED'});})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x193a53['id']));_0x490c4f();});}})[_0xa8eb('0x37')](function(_0x1b3c2b){if(_0x1b3c2b){if(!_0x1b3c2b[_0xa8eb('0x38')]||_0x1b3c2b[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x9')](_0xa8eb('0x3b'),_0x193a53['id']),util[_0xa8eb('0x3c')](_0x1b3c2b,{'showHidden':![],'depth':null}));}}_0x490c4f();});});}function checkTranscribe(){var _0x54ae6b;var _0x481560;var _0x273fd0;return db[_0xa8eb('0x3d')][_0xa8eb('0x3e')]({'where':{'transcribeStatus':_0xa8eb('0x3f')}})['then'](function(_0x53dc8a){if(!_0x53dc8a||!_0x53dc8a['length']){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x40'));}_0x54ae6b=_0x53dc8a;return db[_0xa8eb('0x41')][_0xa8eb('0x25')]({'where':{'id':0x1}});})[_0xa8eb('0xe')](function(_0x31b4f7){if(!_0x31b4f7){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x42'));}_0x481560=_0x31b4f7;if(!_0x481560[_0xa8eb('0x4')]||!_0x481560[_0xa8eb('0x43')]||!_0x481560[_0xa8eb('0xc')]||!_0x481560[_0xa8eb('0x28')]||!_0x481560[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x44'));}return db[_0xa8eb('0x33')]['findOne']({'where':{'id':_0x481560['transcribeAccountId']}});})[_0xa8eb('0xe')](function(_0x5edfbe){if(!_0x5edfbe){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x34'));}if(!_0x5edfbe[_0xa8eb('0xb')]||!_0x5edfbe['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x273fd0=_0x5edfbe;var _0x1251cd=[];_0x54ae6b[_0xa8eb('0x45')](function(_0x3a52d2){_0x1251cd[_0xa8eb('0x46')](checkTranscribeJob(_0x3a52d2,_0x481560,_0x273fd0));});return BPromise[_0xa8eb('0x47')](_0x1251cd);})[_0xa8eb('0x37')](function(_0x18e535){if(_0x18e535){if(!_0x18e535[_0xa8eb('0x38')]||_0x18e535[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x3c')](_0x18e535,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 29eb988..0556d11 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 _0x5a2f=['findAll','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','inspect','start','lodash','moment','util','../../config/environment','../logger','redis','socket.io-emitter'];(function(_0x211237,_0x1370ab){var _0x450fa3=function(_0x342417){while(--_0x342417){_0x211237['push'](_0x211237['shift']());}};_0x450fa3(++_0x1370ab);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x2c0b11,_0x41042a){_0x2c0b11=_0x2c0b11-0x0;var _0x231a35=_0x5a2f[_0x2c0b11];return _0x231a35;};'use strict';var _=require(_0xf5a2('0x0'));var moment=require(_0xf5a2('0x1'));var Redis=require('ioredis');var util=require(_0xf5a2('0x2'));var config=require(_0xf5a2('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xf5a2('0x4'))('schedule');config[_0xf5a2('0x5')]=_['defaults'](config[_0xf5a2('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf5a2('0x6'))(new Redis(config[_0xf5a2('0x5')]));function closeInteractions(){var _0x310122=[];return db['WhatsappInteraction'][_0xf5a2('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf5a2('0x8'))}}})[_0xf5a2('0x9')](function(_0x1aaf96){if(_0x1aaf96&&_0x1aaf96[_0xf5a2('0xa')]){_0x310122=_[_0xf5a2('0xb')](_0x1aaf96||[],'id');logger[_0xf5a2('0xc')](_0xf5a2('0xd'),_0x310122[_0xf5a2('0xe')]());return db[_0xf5a2('0xf')][_0xf5a2('0x10')]({'closeReason':_0xf5a2('0x11'),'disposition':_0xf5a2('0x12'),'closed':!![],'closedAt':moment()[_0xf5a2('0x13')](_0xf5a2('0x14'))},{'where':{'id':_0x310122}});}})['then'](function(){if(_0x310122&&_0x310122[_0xf5a2('0xa')]){logger[_0xf5a2('0xc')](_0xf5a2('0x15'),_0x310122[_0xf5a2('0xe')]());for(var _0x4e7422=0x0;_0x4e7422<_0x310122[_0xf5a2('0xa')];_0x4e7422++){io[_0xf5a2('0x16')](_0xf5a2('0x17'),{'id':_0x310122[_0x4e7422],'closed':!![]});}}})['catch'](function(_0x30c63f){logger[_0xf5a2('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x30c63f?util[_0xf5a2('0x19')](_0x30c63f,{'showHidden':![],'depth':null}):'');});}exports[_0xf5a2('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1f60=['moment','util','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0x4970ea,_0x3315e7){var _0xf34b5c=function(_0x2f1def){while(--_0x2f1def){_0x4970ea['push'](_0x4970ea['shift']());}};_0xf34b5c(++_0x3315e7);}(_0x1f60,0x1bf));var _0x01f6=function(_0x502df3,_0x4319a1){_0x502df3=_0x502df3-0x0;var _0x5eb274=_0x1f60[_0x502df3];return _0x5eb274;};'use strict';var _=require(_0x01f6('0x0'));var moment=require(_0x01f6('0x1'));var Redis=require('ioredis');var util=require(_0x01f6('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x01f6('0x3'))(_0x01f6('0x4'));config[_0x01f6('0x5')]=_[_0x01f6('0x6')](config[_0x01f6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x01f6('0x7'))(new Redis(config[_0x01f6('0x5')]));function closeInteractions(){var _0x122f5f=[];return db[_0x01f6('0x8')][_0x01f6('0x9')]({'raw':!![],'attributes':['id',_0x01f6('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x01f6('0xb')](0x18,_0x01f6('0xc'))}}})[_0x01f6('0xd')](function(_0x2934b4){if(_0x2934b4&&_0x2934b4[_0x01f6('0xe')]){_0x122f5f=_['map'](_0x2934b4||[],'id');logger[_0x01f6('0xf')](_0x01f6('0x10'),_0x122f5f[_0x01f6('0x11')]());return db[_0x01f6('0x8')][_0x01f6('0x12')]({'closeReason':'system','disposition':_0x01f6('0x13'),'closed':!![],'closedAt':moment()[_0x01f6('0x14')](_0x01f6('0x15'))},{'where':{'id':_0x122f5f}});}})[_0x01f6('0xd')](function(){if(_0x122f5f&&_0x122f5f[_0x01f6('0xe')]){logger[_0x01f6('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x122f5f[_0x01f6('0x11')]());for(var _0x1873b0=0x0;_0x1873b0<_0x122f5f[_0x01f6('0xe')];_0x1873b0++){io[_0x01f6('0x16')](_0x01f6('0x17'),{'id':_0x122f5f[_0x1873b0],'closed':!![]});}}})[_0x01f6('0x18')](function(_0x36e95c){logger[_0x01f6('0x19')](_0x01f6('0x1a'),_0x36e95c?util[_0x01f6('0x1b')](_0x36e95c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 829244a..c2d06a3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30bd=['contacts1','CmHopper','hopper1','log','contacts2','catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate','finished\x20populating'];(function(_0xb599bb,_0xafcc38){var _0x34b3c0=function(_0x2b8cec){while(--_0x2b8cec){_0xb599bb['push'](_0xb599bb['shift']());}};_0x34b3c0(++_0xafcc38);}(_0x30bd,0x1a4));var _0xd30b=function(_0xed6da,_0x4c57db){_0xed6da=_0xed6da-0x0;var _0x3b30a8=_0x30bd[_0xed6da];return _0x3b30a8;};'use strict';var util=require('util');var db=require(_0xd30b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd30b('0x1')+i,'phone':0xf879fb460+i,'email':_0xd30b('0x2')+i+_0xd30b('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd30b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xd30b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd30b('0x5')](),'updatedAt':Date[_0xd30b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd30b('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xd30b('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd30b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xd30b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd30b('0x5')]()});}db[_0xd30b('0x7')][_0xd30b('0x8')]({'where':{}})[_0xd30b('0x9')](function(){return db['CmContact'][_0xd30b('0xa')](contacts);})['then'](function(){console['log'](_0xd30b('0xb'),_0xd30b('0xc'));return db[_0xd30b('0xd')][_0xd30b('0x8')]({'where':{}});})[_0xd30b('0x9')](function(){return db[_0xd30b('0xd')]['bulkCreate'](hopper);})[_0xd30b('0x9')](function(){console['log'](_0xd30b('0xb'),_0xd30b('0xe'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console[_0xd30b('0xf')]('finished\x20populating',_0xd30b('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console['log'](_0xd30b('0xb'),'hopper2');})[_0xd30b('0x11')](function(_0x502122){console['log'](_0x502122);}); \ No newline at end of file +var _0x214d=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util'];(function(_0xb2ba86,_0x44bebd){var _0x51c55b=function(_0x392045){while(--_0x392045){_0xb2ba86['push'](_0xb2ba86['shift']());}};_0x51c55b(++_0x44bebd);}(_0x214d,0xf6));var _0xd214=function(_0x285d2a,_0x53a9d0){_0x285d2a=_0x285d2a-0x0;var _0x4e1869=_0x214d[_0x285d2a];return _0x4e1869;};'use strict';var util=require(_0xd214('0x0'));var db=require(_0xd214('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd214('0x2')]({'id':i,'firstName':_0xd214('0x3')+i,'lastName':_0xd214('0x4')+i,'phone':0xf879fb460+i,'email':_0xd214('0x5')+i+_0xd214('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd214('0x7')](),'updatedAt':Date[_0xd214('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd214('0x3')+i,'lastName':_0xd214('0x4')+i,'phone':0xf879fb460+i,'email':_0xd214('0x5')+i+_0xd214('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd214('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd214('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd214('0x7')](),'updatedAt':Date[_0xd214('0x7')]()});}db[_0xd214('0x8')][_0xd214('0x9')]({'where':{}})[_0xd214('0xa')](function(){return db[_0xd214('0x8')][_0xd214('0xb')](contacts);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),_0xd214('0xe'));return db[_0xd214('0xf')][_0xd214('0x9')]({'where':{}});})[_0xd214('0xa')](function(){return db['CmHopper'][_0xd214('0xb')](hopper);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),_0xd214('0x10'));return db[_0xd214('0x8')]['bulkCreate'](contacts2);})[_0xd214('0xa')](function(){console[_0xd214('0xc')](_0xd214('0xd'),'contacts2');return db[_0xd214('0xf')]['bulkCreate'](hopper2);})['then'](function(){console[_0xd214('0xc')]('finished\x20populating',_0xd214('0x11'));})[_0xd214('0x12')](function(_0x870174){console[_0xd214('0xc')](_0x870174);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4640118..2c8d3be 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39a7=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','%s%s','format','agent','%s%s@xcally.com','password','friend','wss','all','yes'];(function(_0x2d922a,_0x56d246){var _0x255743=function(_0x302cfa){while(--_0x302cfa){_0x2d922a['push'](_0x2d922a['shift']());}};_0x255743(++_0x56d246);}(_0x39a7,0x1d7));var _0x739a=function(_0x1486ce,_0x233c7f){_0x1486ce=_0x1486ce-0x0;var _0x10a7b2=_0x39a7[_0x1486ce];return _0x10a7b2;};'use strict';var util=require(_0x739a('0x0'));var db=require(_0x739a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x739a('0x2')]({'name':util['format'](_0x739a('0x3'),'agent',i),'fullname':util[_0x739a('0x4')]('%s%s',_0x739a('0x5'),i),'email':util[_0x739a('0x4')](_0x739a('0x6'),_0x739a('0x5'),i),'role':_0x739a('0x5'),'password':_0x739a('0x7'),'internal':0xfa0+i,'type':_0x739a('0x8'),'transport':['udp','ws',_0x739a('0x9')],'disallow':[_0x739a('0xa')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x739a('0x5'),i),'encryption':_0x739a('0xb'),'avpf':_0x739a('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x739a('0xb'),'dtlsverify':'no','dtlscertfile':_0x739a('0xc'),'dtlsprivatekey':_0x739a('0xd'),'dtlssetup':_0x739a('0xe'),'callerid':util['format'](_0x739a('0xf'),util[_0x739a('0x4')](_0x739a('0x3'),'agent',i),0xfa0+i)});}db[_0x739a('0x10')][_0x739a('0x11')](users)['then'](function(){console[_0x739a('0x12')](_0x739a('0x13'));})[_0x739a('0x14')](function(_0x50c15a){console[_0x739a('0x12')](_0x50c15a);}); \ No newline at end of file +var _0x0e8d=['\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x44bcff,_0x425c81){var _0x3e4e7d=function(_0x348829){while(--_0x348829){_0x44bcff['push'](_0x44bcff['shift']());}};_0x3e4e7d(++_0x425c81);}(_0x0e8d,0x1a9));var _0xd0e8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0e8d[_0x11005e];return _0x29338f;};'use strict';var util=require(_0xd0e8('0x0'));var db=require(_0xd0e8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd0e8('0x2')]({'name':util[_0xd0e8('0x3')]('%s%s',_0xd0e8('0x4'),i),'fullname':util[_0xd0e8('0x3')](_0xd0e8('0x5'),_0xd0e8('0x4'),i),'email':util[_0xd0e8('0x3')](_0xd0e8('0x6'),'agent',i),'role':'agent','password':_0xd0e8('0x7'),'internal':0xfa0+i,'type':_0xd0e8('0x8'),'transport':['udp','ws','wss'],'disallow':[_0xd0e8('0x9')],'allow':[_0xd0e8('0xa')],'defaultuser':util[_0xd0e8('0x3')](_0xd0e8('0x5'),_0xd0e8('0x4'),i),'encryption':_0xd0e8('0xb'),'avpf':_0xd0e8('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd0e8('0xb'),'dtlsverify':'no','dtlscertfile':_0xd0e8('0xc'),'dtlsprivatekey':_0xd0e8('0xd'),'dtlssetup':_0xd0e8('0xe'),'callerid':util['format'](_0xd0e8('0xf'),util[_0xd0e8('0x3')](_0xd0e8('0x5'),'agent',i),0xfa0+i)});}db['User'][_0xd0e8('0x10')](users)['then'](function(){console[_0xd0e8('0x11')](_0xd0e8('0x12'));})[_0xd0e8('0x13')](function(_0x2c1619){console['log'](_0x2c1619);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 79beb63..80e762b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52aa=['FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','SmsQueue','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','telephone','Campaign','then','format','%s:queue:%s','length','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x52aa,0x113));var _0xa52a=function(_0x1004d0,_0x3f66cc){_0x1004d0=_0x1004d0-0x0;var _0x356c98=_0x52aa[_0x1004d0];return _0x356c98;};'use strict';var _=require('lodash');var util=require(_0xa52a('0x0'));var BPromise=require(_0xa52a('0x1'));var db=require(_0xa52a('0x2'))['db'];var config=require(_0xa52a('0x3'));var queryQueues={'attributes':['id',_0xa52a('0x4')],'include':[{'as':_0xa52a('0x5'),'model':db[_0xa52a('0x6')],'attributes':['id',_0xa52a('0x4'),_0xa52a('0x7')],'raw':!![],'where':{'role':_0xa52a('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa52a('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xa52a('0x4')],'where':{'role':_0xa52a('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa52a('0x4'),_0xa52a('0x9')],'where':{'type':_0xa52a('0xa')}};function getAssociatedResources(_0x398a62,_0x44465c,_0xd006ed){return db[_0xa52a('0xb')][_0xa52a('0xc')]({'where':{'name':_0x398a62,'userProfileId':_0x44465c},'raw':!![]})['then'](function(_0x430d35){if(_0x430d35){if(_0x430d35['autoAssociation']){switch(_0x398a62){case _0xa52a('0xd'):case _0xa52a('0xe'):case _0xa52a('0xf'):case _0xa52a('0x10'):case _0xa52a('0x11'):case _0xa52a('0x12'):case _0xa52a('0x13'):return db[_0xd006ed][_0xa52a('0x14')](queryQueues);case _0xa52a('0x15'):return db[_0xd006ed][_0xa52a('0x14')](queryTelephones);case _0xa52a('0x16'):return db[_0xd006ed][_0xa52a('0x14')](queryTrunks);case _0xa52a('0x17'):return db[_0xd006ed]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xa52a('0x14')]({'attributes':[_0xa52a('0x18')],'where':{'sectionId':_0x430d35['id']},'raw':!![]})['then'](function(_0x2b9dc0){if(_0x2b9dc0){var _0x24cffa={'where':{'id':_[_0xa52a('0x19')](_0x2b9dc0,_0xa52a('0x18'))},'raw':!![]};switch(_0xd006ed){case _0xa52a('0x6'):_0x24cffa[_0xa52a('0x1a')][_0xa52a('0x7')]=_0xa52a('0x1b');break;case _0xa52a('0x1c'):_0x24cffa[_0xa52a('0x1a')]['type']=_0xa52a('0xa');break;}return db[_0xd006ed][_0xa52a('0x14')](_0x24cffa);}else{return[];}});}}else{return[];}})[_0xa52a('0x1d')](function(_0x11daae){return _0x11daae;});}function joinOrLeaveQueues(_0xf726ff,_0xa0fd2d,_0x5d0fe4,_0x357887){_0xf726ff[_0xa0fd2d](util[_0xa52a('0x1e')](_0xa52a('0x1f'),_0x5d0fe4,_0x357887[_0xa52a('0x4')]));if(_0x357887['Agents']){for(var _0x340129=0x0;_0x340129<_0x357887[_0xa52a('0x5')][_0xa52a('0x20')];_0x340129+=0x1){_0xf726ff[_0xa0fd2d](util[_0xa52a('0x1e')](_0xa52a('0x21'),_0x357887['Agents'][_0x340129][_0xa52a('0x4')]));}}}function joinOrLeave(_0x5de947,_0x56f900,_0x300faa){var _0x1de0a5;if(_0x5de947['handshake']['query']['id']){db[_0xa52a('0x6')][_0xa52a('0x22')]({'attributes':['id','name',_0xa52a('0x7'),_0xa52a('0x23')],'where':{'id':_0x5de947[_0xa52a('0x24')][_0xa52a('0x25')]['id']},'include':[{'model':db[_0xa52a('0x26')],'as':_0xa52a('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xa52a('0x28')],'as':_0xa52a('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xa52a('0x2a')],'as':_0xa52a('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xa52a('0x2c')],'as':_0xa52a('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0xa52a('0x2e')],'as':_0xa52a('0x2f'),'attributes':['id'],'raw':!![]},{'model':db[_0xa52a('0x30')],'as':_0xa52a('0x31'),'attributes':['id'],'raw':!![]}]})[_0xa52a('0x1d')](function(_0x950f7e){if(_0x950f7e){_0x1de0a5=_0x950f7e;_0x5de947[_0x56f900](util['format'](_0xa52a('0x21'),_0x950f7e[_0xa52a('0x4')]));var _0x45bbbe=[];switch(_0x950f7e['role']){case'admin':_0x5de947[_0x56f900](_0xa52a('0x32'));_0x5de947[_0x56f900](_0xa52a('0x33'));if(queryQueues[_0xa52a('0x34')]('include')){delete queryQueues[_0xa52a('0x35')];}_0x45bbbe[_0xa52a('0x36')](db['VoiceQueue'][_0xa52a('0x14')](queryQueues));_0x45bbbe[_0xa52a('0x36')](db[_0xa52a('0x37')][_0xa52a('0x14')](queryQueues));_0x45bbbe[_0xa52a('0x36')](db[_0xa52a('0x38')][_0xa52a('0x14')](queryQueues));_0x45bbbe[_0xa52a('0x36')](db['SmsQueue'][_0xa52a('0x14')](queryQueues));_0x45bbbe['push'](db['MailQueue'][_0xa52a('0x14')](queryQueues));_0x45bbbe[_0xa52a('0x36')](db[_0xa52a('0x39')][_0xa52a('0x14')](queryQueues));_0x45bbbe['push'](db[_0xa52a('0x3a')]['findAll'](queryQueues));_0x45bbbe[_0xa52a('0x36')](db['User'][_0xa52a('0x14')](queryTelephones));_0x45bbbe[_0xa52a('0x36')](db[_0xa52a('0x3b')]['findAll'](queryTrunks));_0x45bbbe['push'](db[_0xa52a('0x1c')][_0xa52a('0x14')](queryCampaigns));_0x45bbbe[_0xa52a('0x36')](db[_0xa52a('0x6')][_0xa52a('0x14')](queryAgents));break;case _0xa52a('0x3c'):_0x5de947[_0x56f900](_0xa52a('0x32'));_0x5de947[_0x56f900](_0xa52a('0x33'));_0x45bbbe['push'](getAssociatedResources('VoiceQueues',_0x950f7e['userProfileId'],_0xa52a('0x3d')));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources('ChatQueues',_0x950f7e['userProfileId'],_0xa52a('0x37')));_0x45bbbe['push'](getAssociatedResources(_0xa52a('0xf'),_0x950f7e[_0xa52a('0x23')],_0xa52a('0x38')));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources('SmsQueues',_0x950f7e[_0xa52a('0x23')],_0xa52a('0x3e')));_0x45bbbe['push'](getAssociatedResources('MailQueues',_0x950f7e[_0xa52a('0x23')],_0xa52a('0x3f')));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources('OpenchannelQueues',_0x950f7e[_0xa52a('0x23')],'OpenchannelQueue'));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources(_0xa52a('0x13'),_0x950f7e[_0xa52a('0x23')],_0xa52a('0x3a')));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources(_0xa52a('0x15'),_0x950f7e[_0xa52a('0x23')],_0xa52a('0x6')));_0x45bbbe['push'](getAssociatedResources(_0xa52a('0x16'),_0x950f7e[_0xa52a('0x23')],_0xa52a('0x3b')));_0x45bbbe[_0xa52a('0x36')](getAssociatedResources('IvrCampaigns',_0x950f7e[_0xa52a('0x23')],'Campaign'));_0x45bbbe[_0xa52a('0x36')](db['User']['findAll'](queryAgents));break;case _0xa52a('0x8'):_0x5de947[_0x56f900]('voice:inbound');_0x5de947[_0x56f900](_0xa52a('0x33'));_0x45bbbe[_0xa52a('0x36')](_0x950f7e[_0xa52a('0x40')]({'attributes':['id',_0xa52a('0x4')]}));_0x45bbbe['push'](_0x950f7e[_0xa52a('0x41')]({'attributes':['id','name']}));_0x45bbbe[_0xa52a('0x36')](_0x950f7e[_0xa52a('0x42')]({'attributes':['id',_0xa52a('0x4')]}));_0x45bbbe[_0xa52a('0x36')](_0x950f7e[_0xa52a('0x43')]({'attributes':['id',_0xa52a('0x4')]}));_0x45bbbe[_0xa52a('0x36')](_0x950f7e['getMailQueues']({'attributes':['id',_0xa52a('0x4')]}));_0x45bbbe[_0xa52a('0x36')](_0x950f7e['getOpenchannelQueues']({'attributes':['id','name']}));_0x45bbbe['push'](_0x950f7e[_0xa52a('0x44')]({'attributes':['id',_0xa52a('0x4')]}));break;}return BPromise[_0xa52a('0x45')](_0x45bbbe);}})['then'](function(_0x2a3f0f){if(_0x2a3f0f&&_0x2a3f0f[_0xa52a('0x20')]){for(var _0x53f61a=0x0;_0x53f61a<_0x2a3f0f['length'];_0x53f61a+=0x1){for(var _0x3769bb=0x0;_0x3769bb<_0x2a3f0f[_0x53f61a][_0xa52a('0x20')];_0x3769bb+=0x1){switch(_0x53f61a){case 0x0:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x46'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x1:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x47'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x2:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x48'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x3:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x49'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x4:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x4a'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x5:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x4b'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x6:joinOrLeaveQueues(_0x5de947,_0x56f900,_0xa52a('0x4c'),_0x2a3f0f[_0x53f61a][_0x3769bb]);break;case 0x7:if(_0x1de0a5['role']!==_0xa52a('0x8'))_0x5de947[_0x56f900](util[_0xa52a('0x1e')](_0xa52a('0x4d'),_0x2a3f0f[_0x53f61a][_0x3769bb][_0xa52a('0x4')]));break;case 0x8:if(_0x1de0a5[_0xa52a('0x7')]!=='agent')_0x5de947[_0x56f900](util[_0xa52a('0x1e')](_0xa52a('0x4e'),_0x2a3f0f[_0x53f61a][_0x3769bb][_0xa52a('0x4')]));break;case 0x9:if(_0x1de0a5[_0xa52a('0x7')]!==_0xa52a('0x8'))_0x5de947[_0x56f900](util[_0xa52a('0x1e')](_0xa52a('0x4f'),_0x2a3f0f[_0x53f61a][_0x3769bb][_0xa52a('0x9')],_0x2a3f0f[_0x53f61a][_0x3769bb]['name']));break;case 0xa:_0x5de947[_0x56f900](util[_0xa52a('0x1e')](_0xa52a('0x21'),_0x2a3f0f[_0x53f61a][_0x3769bb]['name']));break;}}}}})['then'](function(){if(_0x56f900===_0xa52a('0x50')){var _0x52bb1f=_['map'](_0x1de0a5['ChatInteractions'],'id');return _0x1de0a5[_0xa52a('0x51')](_0x52bb1f)[_0xa52a('0x1d')](function(){for(var _0x50c158=0x0;_0x50c158<_0x52bb1f[_0xa52a('0x20')];_0x50c158+=0x1){_0x300faa[_0xa52a('0x52')](_0xa52a('0x53'),{'ChatInteractionId':Number(_0x52bb1f[_0x50c158]),'UserId':Number(_0x1de0a5['id'])});}});}})[_0xa52a('0x1d')](function(){if(_0x56f900===_0xa52a('0x50')){var _0x1266c3=_[_0xa52a('0x19')](_0x1de0a5[_0xa52a('0x29')],'id');return _0x1de0a5[_0xa52a('0x54')](_0x1266c3)[_0xa52a('0x1d')](function(){for(var _0x5243e0=0x0;_0x5243e0<_0x1266c3[_0xa52a('0x20')];_0x5243e0+=0x1){_0x300faa[_0xa52a('0x52')](_0xa52a('0x55'),{'MailInteractionId':Number(_0x1266c3[_0x5243e0]),'UserId':Number(_0x1de0a5['id'])});}});}})['then'](function(){if(_0x56f900==='leave'){var _0x1e9124=_[_0xa52a('0x19')](_0x1de0a5[_0xa52a('0x2b')],'id');return _0x1de0a5['removeFaxInteractions'](_0x1e9124)[_0xa52a('0x1d')](function(){for(var _0x3c9c1d=0x0;_0x3c9c1d<_0x1e9124['length'];_0x3c9c1d+=0x1){_0x300faa['emit'](_0xa52a('0x56'),{'FaxInteractionId':Number(_0x1e9124[_0x3c9c1d]),'UserId':Number(_0x1de0a5['id'])});}});}})[_0xa52a('0x1d')](function(){if(_0x56f900===_0xa52a('0x50')){var _0x2cdd4f=_[_0xa52a('0x19')](_0x1de0a5[_0xa52a('0x2d')],'id');return _0x1de0a5[_0xa52a('0x57')](_0x2cdd4f)[_0xa52a('0x1d')](function(){for(var _0x131a0a=0x0;_0x131a0a<_0x2cdd4f[_0xa52a('0x20')];_0x131a0a+=0x1){_0x300faa[_0xa52a('0x52')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2cdd4f[_0x131a0a]),'UserId':Number(_0x1de0a5['id'])});}});}})[_0xa52a('0x1d')](function(){if(_0x56f900===_0xa52a('0x50')){var _0x1a9b6c=_[_0xa52a('0x19')](_0x1de0a5[_0xa52a('0x2f')],'id');return _0x1de0a5[_0xa52a('0x58')](_0x1a9b6c)['then'](function(){for(var _0x48f869=0x0;_0x48f869<_0x1a9b6c[_0xa52a('0x20')];_0x48f869+=0x1){_0x300faa['emit'](_0xa52a('0x59'),{'OpenchannelInteractionId':Number(_0x1a9b6c[_0x48f869]),'UserId':Number(_0x1de0a5['id'])});}});}})[_0xa52a('0x1d')](function(){if(_0x56f900===_0xa52a('0x50')){var _0x27efc5=_[_0xa52a('0x19')](_0x1de0a5['WhatsappInteractions'],'id');return _0x1de0a5[_0xa52a('0x5a')](_0x27efc5)[_0xa52a('0x1d')](function(){for(var _0xb650aa=0x0;_0xb650aa<_0x27efc5['length'];_0xb650aa+=0x1){_0x300faa['emit'](_0xa52a('0x5b'),{'WhatsappInteractionId':Number(_0x27efc5[_0xb650aa]),'UserId':Number(_0x1de0a5['id'])});}});}})[_0xa52a('0x5c')](function(_0xb5678f){_0x5de947['log'](_0xb5678f);});}}function onDisconnect(_0x1358f6,_0x17edf8){joinOrLeave(_0x1358f6,_0xa52a('0x50'),_0x17edf8);}function onConnect(_0x3eb3ae){joinOrLeave(_0x3eb3ae,_0xa52a('0x5d'));}exports[_0xa52a('0x5e')]=function(_0x3ac50c){_0x3ac50c['on'](_0xa52a('0x5f'),function(_0x2a3265){_0x2a3265[_0xa52a('0x60')](0x0);_0x2a3265[_0xa52a('0x61')]=_0x2a3265[_0xa52a('0x62')][_0xa52a('0x5f')][_0xa52a('0x63')]+':'+_0x2a3265['request'][_0xa52a('0x5f')][_0xa52a('0x64')];_0x2a3265[_0xa52a('0x65')]=new Date();_0x2a3265[_0xa52a('0x66')]=function(_0xd0db3d){console[_0xa52a('0x66')](_0xa52a('0x67')+_0x2a3265[_0xa52a('0x68')][_0xa52a('0x4')]+'['+_0x2a3265['address']+']',_0xd0db3d);};_0x2a3265['on']('disconnect',function(){onDisconnect(_0x2a3265,_0x3ac50c);_0x2a3265[_0xa52a('0x66')]('DISCONNECTED');});onConnect(_0x2a3265);_0x2a3265[_0xa52a('0x66')](_0xa52a('0x69'));});}; \ No newline at end of file +var _0x83d4=['push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:inbound','VoiceQueues','FaxQueue','MailQueues','OpenchannelQueues','IvrCampaigns','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','nsp','lodash','../mysqldb','name','User','role','agent','type','ivr','findOne','autoAssociation','ChatQueues','FaxQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','where','telephone','format','%s:queue:%s','Agents','length','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','then','user:%s','admin','hasOwnProperty','include'];(function(_0x1ee2ae,_0x17c0eb){var _0x1780e5=function(_0x5c592b){while(--_0x5c592b){_0x1ee2ae['push'](_0x1ee2ae['shift']());}};_0x1780e5(++_0x17c0eb);}(_0x83d4,0xf1));var _0x483d=function(_0x59e18a,_0x43a94b){_0x59e18a=_0x59e18a-0x0;var _0x15434e=_0x83d4[_0x59e18a];return _0x15434e;};'use strict';var _=require(_0x483d('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x483d('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x483d('0x2')],'include':[{'as':'Agents','model':db[_0x483d('0x3')],'attributes':['id',_0x483d('0x2'),_0x483d('0x4')],'raw':!![],'where':{'role':_0x483d('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x483d('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x483d('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x483d('0x2')],'where':{'role':_0x483d('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x483d('0x2'),_0x483d('0x6')],'where':{'type':_0x483d('0x7')}};function getAssociatedResources(_0x29ace9,_0x2331a2,_0x2da88b){return db['UserProfileSection'][_0x483d('0x8')]({'where':{'name':_0x29ace9,'userProfileId':_0x2331a2},'raw':!![]})['then'](function(_0x404f5f){if(_0x404f5f){if(_0x404f5f[_0x483d('0x9')]){switch(_0x29ace9){case'VoiceQueues':case _0x483d('0xa'):case _0x483d('0xb'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x483d('0xc'):return db[_0x2da88b]['findAll'](queryQueues);case _0x483d('0xd'):return db[_0x2da88b][_0x483d('0xe')](queryTelephones);case _0x483d('0xf'):return db[_0x2da88b][_0x483d('0xe')](queryTrunks);case'IvrCampaigns':return db[_0x2da88b][_0x483d('0xe')](queryCampaigns);}}else{return db[_0x483d('0x10')][_0x483d('0xe')]({'attributes':[_0x483d('0x11')],'where':{'sectionId':_0x404f5f['id']},'raw':!![]})['then'](function(_0x1aed6d){if(_0x1aed6d){var _0x659927={'where':{'id':_['map'](_0x1aed6d,'resourceId')},'raw':!![]};switch(_0x2da88b){case'User':_0x659927[_0x483d('0x12')][_0x483d('0x4')]=_0x483d('0x13');break;case'Campaign':_0x659927[_0x483d('0x12')][_0x483d('0x6')]=_0x483d('0x7');break;}return db[_0x2da88b]['findAll'](_0x659927);}else{return[];}});}}else{return[];}})['then'](function(_0x273135){return _0x273135;});}function joinOrLeaveQueues(_0x3de114,_0x4f51dd,_0x579f8a,_0x227328){_0x3de114[_0x4f51dd](util[_0x483d('0x14')](_0x483d('0x15'),_0x579f8a,_0x227328[_0x483d('0x2')]));if(_0x227328[_0x483d('0x16')]){for(var _0x16f966=0x0;_0x16f966<_0x227328[_0x483d('0x16')][_0x483d('0x17')];_0x16f966+=0x1){_0x3de114[_0x4f51dd](util[_0x483d('0x14')]('user:%s',_0x227328['Agents'][_0x16f966]['name']));}}}function joinOrLeave(_0x52c579,_0x475731,_0x438189){var _0x43b7b6;if(_0x52c579[_0x483d('0x18')]['query']['id']){db['User'][_0x483d('0x19')]({'attributes':['id','name',_0x483d('0x4'),_0x483d('0x1a')],'where':{'id':_0x52c579[_0x483d('0x18')][_0x483d('0x1b')]['id']},'include':[{'model':db[_0x483d('0x1c')],'as':_0x483d('0x1d'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x483d('0x1e')],'as':_0x483d('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x483d('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x483d('0x21')],'as':_0x483d('0x22'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x483d('0x23'),'attributes':['id'],'raw':!![]}]})[_0x483d('0x24')](function(_0x24435a){if(_0x24435a){_0x43b7b6=_0x24435a;_0x52c579[_0x475731](util['format'](_0x483d('0x25'),_0x24435a[_0x483d('0x2')]));var _0x11483e=[];switch(_0x24435a[_0x483d('0x4')]){case _0x483d('0x26'):_0x52c579[_0x475731]('voice:inbound');_0x52c579[_0x475731]('voice:outbound');if(queryQueues[_0x483d('0x27')](_0x483d('0x28'))){delete queryQueues['include'];}_0x11483e[_0x483d('0x29')](db[_0x483d('0x2a')]['findAll'](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2b')][_0x483d('0xe')](queryQueues));_0x11483e['push'](db['FaxQueue'][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2c')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2d')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2e')][_0x483d('0xe')](queryQueues));_0x11483e[_0x483d('0x29')](db[_0x483d('0x2f')][_0x483d('0xe')](queryQueues));_0x11483e['push'](db[_0x483d('0x3')][_0x483d('0xe')](queryTelephones));_0x11483e[_0x483d('0x29')](db[_0x483d('0x30')][_0x483d('0xe')](queryTrunks));_0x11483e['push'](db[_0x483d('0x31')][_0x483d('0xe')](queryCampaigns));_0x11483e[_0x483d('0x29')](db[_0x483d('0x3')][_0x483d('0xe')](queryAgents));break;case'user':_0x52c579[_0x475731](_0x483d('0x32'));_0x52c579[_0x475731]('voice:outbound');_0x11483e['push'](getAssociatedResources(_0x483d('0x33'),_0x24435a['userProfileId'],_0x483d('0x2a')));_0x11483e['push'](getAssociatedResources(_0x483d('0xa'),_0x24435a[_0x483d('0x1a')],'ChatQueue'));_0x11483e[_0x483d('0x29')](getAssociatedResources('FaxQueues',_0x24435a[_0x483d('0x1a')],_0x483d('0x34')));_0x11483e[_0x483d('0x29')](getAssociatedResources('SmsQueues',_0x24435a[_0x483d('0x1a')],'SmsQueue'));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x35'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2d')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x36'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2e')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xc'),_0x24435a[_0x483d('0x1a')],_0x483d('0x2f')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xd'),_0x24435a['userProfileId'],_0x483d('0x3')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0xf'),_0x24435a[_0x483d('0x1a')],_0x483d('0x30')));_0x11483e[_0x483d('0x29')](getAssociatedResources(_0x483d('0x37'),_0x24435a['userProfileId'],_0x483d('0x31')));_0x11483e['push'](db[_0x483d('0x3')][_0x483d('0xe')](queryAgents));break;case'agent':_0x52c579[_0x475731](_0x483d('0x32'));_0x52c579[_0x475731](_0x483d('0x38'));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x39')]({'attributes':['id','name']}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3a')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3b')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3c')]({'attributes':['id','name']}));_0x11483e['push'](_0x24435a[_0x483d('0x3d')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e[_0x483d('0x29')](_0x24435a[_0x483d('0x3e')]({'attributes':['id',_0x483d('0x2')]}));_0x11483e['push'](_0x24435a[_0x483d('0x3f')]({'attributes':['id',_0x483d('0x2')]}));break;}return BPromise['all'](_0x11483e);}})[_0x483d('0x24')](function(_0xdc070a){if(_0xdc070a&&_0xdc070a[_0x483d('0x17')]){for(var _0x18b7e7=0x0;_0x18b7e7<_0xdc070a[_0x483d('0x17')];_0x18b7e7+=0x1){for(var _0x320530=0x0;_0x320530<_0xdc070a[_0x18b7e7][_0x483d('0x17')];_0x320530+=0x1){switch(_0x18b7e7){case 0x0:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x40'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x1:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x41'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x2:joinOrLeaveQueues(_0x52c579,_0x475731,'fax',_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x3:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x42'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x4:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x43'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x5:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x44'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x6:joinOrLeaveQueues(_0x52c579,_0x475731,_0x483d('0x45'),_0xdc070a[_0x18b7e7][_0x320530]);break;case 0x7:if(_0x43b7b6[_0x483d('0x4')]!=='agent')_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x46'),_0xdc070a[_0x18b7e7][_0x320530]['name']));break;case 0x8:if(_0x43b7b6[_0x483d('0x4')]!==_0x483d('0x5'))_0x52c579[_0x475731](util['format']('trunk:%s',_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x2')]));break;case 0x9:if(_0x43b7b6[_0x483d('0x4')]!=='agent')_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x47'),_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x6')],_0xdc070a[_0x18b7e7][_0x320530][_0x483d('0x2')]));break;case 0xa:_0x52c579[_0x475731](util[_0x483d('0x14')](_0x483d('0x25'),_0xdc070a[_0x18b7e7][_0x320530]['name']));break;}}}}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x558330=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x1d')],'id');return _0x43b7b6['removeChatInteractions'](_0x558330)[_0x483d('0x24')](function(){for(var _0x677e61=0x0;_0x677e61<_0x558330['length'];_0x677e61+=0x1){_0x438189[_0x483d('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x558330[_0x677e61]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x56c23d=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x4b')],'id');return _0x43b7b6[_0x483d('0x4c')](_0x56c23d)[_0x483d('0x24')](function(){for(var _0x4fbd75=0x0;_0x4fbd75<_0x56c23d[_0x483d('0x17')];_0x4fbd75+=0x1){_0x438189[_0x483d('0x4a')](_0x483d('0x4d'),{'MailInteractionId':Number(_0x56c23d[_0x4fbd75]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731==='leave'){var _0x1cb6b9=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x1f')],'id');return _0x43b7b6[_0x483d('0x4e')](_0x1cb6b9)[_0x483d('0x24')](function(){for(var _0x4c7836=0x0;_0x4c7836<_0x1cb6b9[_0x483d('0x17')];_0x4c7836+=0x1){_0x438189[_0x483d('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1cb6b9[_0x4c7836]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x3c501c=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x20')],'id');return _0x43b7b6[_0x483d('0x4f')](_0x3c501c)[_0x483d('0x24')](function(){for(var _0x1e17ec=0x0;_0x1e17ec<_0x3c501c[_0x483d('0x17')];_0x1e17ec+=0x1){_0x438189[_0x483d('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3c501c[_0x1e17ec]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731===_0x483d('0x48')){var _0x3b7537=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x22')],'id');return _0x43b7b6[_0x483d('0x50')](_0x3b7537)['then'](function(){for(var _0x53f07b=0x0;_0x53f07b<_0x3b7537[_0x483d('0x17')];_0x53f07b+=0x1){_0x438189[_0x483d('0x4a')](_0x483d('0x51'),{'OpenchannelInteractionId':Number(_0x3b7537[_0x53f07b]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x24')](function(){if(_0x475731==='leave'){var _0x4ac1fd=_[_0x483d('0x49')](_0x43b7b6[_0x483d('0x23')],'id');return _0x43b7b6[_0x483d('0x52')](_0x4ac1fd)[_0x483d('0x24')](function(){for(var _0x21c494=0x0;_0x21c494<_0x4ac1fd['length'];_0x21c494+=0x1){_0x438189[_0x483d('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4ac1fd[_0x21c494]),'UserId':Number(_0x43b7b6['id'])});}});}})[_0x483d('0x53')](function(_0x53736b){_0x52c579[_0x483d('0x54')](_0x53736b);});}}function onDisconnect(_0x50a46c,_0x143c7f){joinOrLeave(_0x50a46c,_0x483d('0x48'),_0x143c7f);}function onConnect(_0x3a72c6){joinOrLeave(_0x3a72c6,_0x483d('0x55'));}exports[_0x483d('0x56')]=function(_0xcf95f4){_0xcf95f4['on'](_0x483d('0x57'),function(_0x4d1452){_0x4d1452[_0x483d('0x58')](0x0);_0x4d1452[_0x483d('0x59')]=_0x4d1452[_0x483d('0x5a')][_0x483d('0x57')]['remoteAddress']+':'+_0x4d1452['request']['connection'][_0x483d('0x5b')];_0x4d1452[_0x483d('0x5c')]=new Date();_0x4d1452['log']=function(_0x3f002a){console[_0x483d('0x54')]('SocketIO\x20'+_0x4d1452[_0x483d('0x5d')]['name']+'['+_0x4d1452[_0x483d('0x59')]+']',_0x3f002a);};_0x4d1452['on']('disconnect',function(){onDisconnect(_0x4d1452,_0xcf95f4);_0x4d1452[_0x483d('0x54')]('DISCONNECTED');});onConnect(_0x4d1452);_0x4d1452[_0x483d('0x54')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f3324ab..a1243ce 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 _0x5d32=['error','code','Trigger,\x20%s','catch','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','interface','format','SIP/%s','name','AfterCreateMessage','get','opened','query','contact','agent','AfterCreate','changed','closed','substatus','User','find','fullname','email','internal','default','length','model','hook','callback','util','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info'];(function(_0x4494bd,_0x5d4c66){var _0x49ede9=function(_0x360670){while(--_0x360670){_0x4494bd['push'](_0x4494bd['shift']());}};_0x49ede9(++_0x5d4c66);}(_0x5d32,0x1cd));var _0x25d3=function(_0x5316d3,_0x5cba98){_0x5316d3=_0x5316d3-0x0;var _0x27d9fa=_0x5d32[_0x5316d3];return _0x27d9fa;};'use strict';var util=require(_0x25d3('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x25d3('0x1'));var logger=require('../logger')(_0x25d3('0x2'));var client=jayson[_0x25d3('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x25d3('0x4'),'model':_0x25d3('0x5'),'event':_0x25d3('0x6'),'condition':_0x25d3('0x7'),'callback':afterCreate},{'channel':_0x25d3('0x4'),'model':_0x25d3('0x5'),'event':_0x25d3('0x8'),'condition':_0x25d3('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x25d3('0xa'),'event':_0x25d3('0x6'),'condition':_0x25d3('0xb'),'callback':afterCreateMessage},{'channel':_0x25d3('0x4'),'model':_0x25d3('0xc'),'event':_0x25d3('0x6'),'condition':_0x25d3('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x25d3('0xd'),'model':_0x25d3('0xe'),'event':_0x25d3('0x6'),'condition':_0x25d3('0x7'),'callback':afterCreate},{'channel':_0x25d3('0xd'),'model':_0x25d3('0xe'),'event':_0x25d3('0x8'),'condition':_0x25d3('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x25d3('0xf'),'event':'afterCreate','condition':_0x25d3('0xb'),'callback':afterCreateMessage},{'channel':_0x25d3('0x10'),'model':_0x25d3('0x11'),'event':_0x25d3('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x25d3('0x10'),'model':_0x25d3('0x11'),'event':_0x25d3('0x8'),'condition':_0x25d3('0x9'),'callback':afterUpdate},{'channel':_0x25d3('0x10'),'model':_0x25d3('0x12'),'event':_0x25d3('0x6'),'condition':_0x25d3('0xb'),'callback':afterCreateMessage},{'channel':_0x25d3('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':_0x25d3('0x7'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x25d3('0x8'),'condition':_0x25d3('0x9'),'callback':afterUpdate},{'channel':_0x25d3('0x13'),'model':'FaxMessage','event':_0x25d3('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x25d3('0x14'),'model':'MailInteraction','event':_0x25d3('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x25d3('0x14'),'model':_0x25d3('0x15'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x25d3('0x14'),'model':_0x25d3('0x16'),'event':_0x25d3('0x6'),'condition':_0x25d3('0xb'),'callback':afterCreateMessage},{'channel':_0x25d3('0x17'),'model':_0x25d3('0x18'),'event':_0x25d3('0x6'),'condition':_0x25d3('0x7'),'callback':afterCreate},{'channel':_0x25d3('0x17'),'model':_0x25d3('0x18'),'event':_0x25d3('0x8'),'condition':_0x25d3('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x25d3('0x19'),'event':'afterCreate','condition':_0x25d3('0xb'),'callback':afterCreateMessage}];function request(_0x2387c3){return client['request'](_0x25d3('0x1a'),_0x2387c3)[_0x25d3('0x1b')](function(_0x33d19e){logger[_0x25d3('0x1c')]('Trigger,\x20%s',_0x25d3('0x1a'),_0x33d19e);if(_0x33d19e[_0x25d3('0x1d')]){if(_0x33d19e[_0x25d3('0x1d')][_0x25d3('0x1e')]===0x1f4){logger[_0x25d3('0x1d')](_0x25d3('0x1f'),_0x25d3('0x1a'),_0x33d19e['error']);}}})[_0x25d3('0x20')](function(_0x1bbca6){logger[_0x25d3('0x1d')](_0x25d3('0x1f'),'EventManager',_0x1bbca6);});}function afterCreateMessage(_0x1a6250){return function(_0x30a776){_0x30a776=_0x30a776['get']({'plain':!![]});_0x30a776[_0x25d3('0x21')]=_0x1a6250;_0x30a776[_0x25d3('0x22')]=_0x1a6250;_0x30a776[_0x25d3('0x23')]=_0x30a776[_0x25d3('0x24')];Promise[_0x25d3('0x25')]()[_0x25d3('0x1b')](function(){if(typeof _0x30a776[_0x25d3('0x26')]===_0x25d3('0x27'))return null;var _0x76fb2d=_0x25d3('0x28')+_0x30a776[_0x25d3('0x26')];return db[_0x25d3('0x29')]['query'](_0x76fb2d,{'type':db[_0x25d3('0x2a')][_0x25d3('0x2b')][_0x25d3('0x2c')],'raw':!![]});})['then'](function(_0x3e67f4){if(_0x3e67f4){_0x30a776['contact']=_0x3e67f4[0x0];}if(typeof _0x30a776[_0x25d3('0x2d')]==='undefined')return;return getAgent(_0x30a776[_0x25d3('0x2d')]);})[_0x25d3('0x1b')](function(_0x6077a1){if(_0x6077a1){_0x30a776[_0x25d3('0x2e')]=util[_0x25d3('0x2f')](_0x25d3('0x30'),_0x6077a1[_0x25d3('0x31')]);_0x30a776['agent']=_0x6077a1;_0x30a776[_0x25d3('0x21')]=_0x1a6250;return request({'event':'incomingmessage','message':_0x30a776});}else{return request({'event':'outgoingmessage','message':_0x30a776});}})[_0x25d3('0x20')](function(_0x3651fb){logger[_0x25d3('0x1d')](_0x25d3('0x1f'),_0x25d3('0x32'),_0x3651fb);});};}function afterCreateOfflineMessage(_0x104a61){return function(_0x2a0b02){_0x2a0b02=_0x2a0b02['get']({'plain':!![]});_0x2a0b02[_0x25d3('0x21')]=_0x104a61;_0x2a0b02[_0x25d3('0x22')]=_0x104a61;_0x2a0b02[_0x25d3('0x23')]='offlineMessage';return request({'event':_0x2a0b02[_0x25d3('0x23')],'message':_0x2a0b02});};}function afterCreate(_0x11411d,_0x4526cf){return function(_0x1b473b){var _0xbb8c78=_0x1b473b[_0x25d3('0x33')]({'plain':!![]});_0xbb8c78['channel']=_0x11411d;_0xbb8c78[_0x25d3('0x22')]=_0x11411d;_0xbb8c78[_0x25d3('0x23')]=_0x25d3('0x34');Promise['resolve']()[_0x25d3('0x1b')](function(){var _0x4888e1=_0x25d3('0x28')+_0xbb8c78[_0x25d3('0x26')];return db['sequelize'][_0x25d3('0x35')](_0x4888e1,{'type':db[_0x25d3('0x2a')]['QueryTypes'][_0x25d3('0x2c')],'raw':!![]});})[_0x25d3('0x1b')](function(_0x19336a){if(_0x19336a){_0xbb8c78[_0x25d3('0x36')]=_0x19336a[0x0];}if(_0xbb8c78['UserId']){return getAgent(_0xbb8c78[_0x25d3('0x2d')]);}return;})[_0x25d3('0x1b')](function(_0x3333e4){if(_0x3333e4){_0xbb8c78[_0x25d3('0x2e')]=util['format'](_0x25d3('0x30'),_0x3333e4[_0x25d3('0x31')]);_0xbb8c78[_0x25d3('0x37')]=_0x3333e4;}return request({'event':_0x4526cf,'message':_0xbb8c78});})[_0x25d3('0x20')](function(_0x2e98f8){logger[_0x25d3('0x1d')](_0x25d3('0x1f'),_0x25d3('0x38'),_0x2e98f8);});};}function afterUpdate(_0x2034df){return function(_0xbe8c14){var _0x97456c=_0xbe8c14[_0x25d3('0x39')]('closed')&&_0xbe8c14[_0x25d3('0x3a')];var _0x4ed047=_0xbe8c14[_0x25d3('0x39')]('substatus');if(_0x97456c||_0x4ed047){var _0x1354fc=_0x97456c?'closedinteraction':_0x25d3('0x3b');var _0x302c70=_0xbe8c14[_0x25d3('0x33')]({'plain':!![]});_0x302c70[_0x25d3('0x21')]=_0x2034df;_0x302c70['motionChannel']=_0x2034df;_0x302c70[_0x25d3('0x23')]=_0x97456c?_0x25d3('0x3a'):'substatus';var _0x568645=_0x25d3('0x28')+_0x302c70[_0x25d3('0x26')];return db[_0x25d3('0x29')][_0x25d3('0x35')](_0x568645,{'type':db[_0x25d3('0x2a')][_0x25d3('0x2b')][_0x25d3('0x2c')],'raw':!![]})[_0x25d3('0x1b')](function(_0x277abe){if(_0x277abe){_0x302c70['contact']=_0x277abe[0x0];}if(typeof _0x302c70[_0x25d3('0x2d')]===_0x25d3('0x27'))return;return getAgent(_0x302c70[_0x25d3('0x2d')]);})[_0x25d3('0x1b')](function(_0x317318){if(_0x317318){_0x302c70['interface']=util[_0x25d3('0x2f')](_0x25d3('0x30'),_0x317318[_0x25d3('0x31')]);_0x302c70[_0x25d3('0x37')]=_0x317318;}return request({'event':_0x1354fc,'message':_0x302c70});})[_0x25d3('0x20')](function(_0x2330b2){logger[_0x25d3('0x1d')](_0x25d3('0x1f'),'AfterUpdate',_0x2330b2);});}};}function getAgent(_0xc2a5f4){return db[_0x25d3('0x3c')][_0x25d3('0x3d')]({'where':{'id':_0xc2a5f4},'attributes':['id',_0x25d3('0x31'),_0x25d3('0x3e'),_0x25d3('0x3f'),_0x25d3('0x40')],'raw':!![]})[_0x25d3('0x1b')](function(_0x4b9aa2){return _0x4b9aa2;});}exports[_0x25d3('0x41')]=function(){for(var _0x396b04=0x0;_0x396b04=_0x57a423['agents']){throw Error(_0x5f35('0x14'));}_0x1cfba2(_0x18937b);})[_0x5f35('0x15')](function(_0x4cc167){_0x29db29(_0x4cc167);});});}; \ No newline at end of file +var _0xb78d=['openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then','catch','lodash','bluebird','./license/util','voice','mail','whatsapp'];(function(_0x545eb3,_0x2d590c){var _0x24beed=function(_0x4fe828){while(--_0x4fe828){_0x545eb3['push'](_0x545eb3['shift']());}};_0x24beed(++_0x2d590c);}(_0xb78d,0x9a));var _0xdb78=function(_0x17d7b6,_0x336557){_0x17d7b6=_0x17d7b6-0x0;var _0x16ee4b=_0xb78d[_0x17d7b6];return _0x16ee4b;};'use strict';var _=require(_0xdb78('0x0'));var BPromise=require(_0xdb78('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xdb78('0x2'));var channels=[_0xdb78('0x3'),_0xdb78('0x4'),'chat','fax','sms',_0xdb78('0x5'),_0xdb78('0x6')];exports[_0xdb78('0x7')]=function(){return channels;};exports[_0xdb78('0x8')]=function(_0x14bf3a){_0x14bf3a=_0x14bf3a[_0xdb78('0x9')]();return _[_0xdb78('0xa')](channels,_0x14bf3a);};exports['clearBlockUser']=function(_0x487376,_0x96736c,_0x8eeab5,_0xea0859){var _0x115ec3={'loginAttempts':_0x96736c,'blocked':_0x8eeab5};if(!_[_0xdb78('0xb')](_0xea0859)){_0x115ec3[_0xdb78('0xc')]=_0xea0859;}return _0x487376[_0xdb78('0xd')](_0x115ec3);};exports[_0xdb78('0xe')]=function(_0x174e02){return new BPromise(function(_0x30e99a,_0x2814df){var _0x22e695=0x0;if(_0x174e02[_0xdb78('0xf')]!==_0xdb78('0x10')){_0x30e99a(_0x174e02);}db['User'][_0xdb78('0x11')]({'where':{'role':_0xdb78('0x10'),'online':!![],'id':{'$ne':_0x174e02['id']}}})[_0xdb78('0x12')](function(_0x419cf9){_0x22e695=_0x419cf9;return util[_0xdb78('0xe')]();})['then'](function(_0x56b687){if(_0x56b687&&_0x56b687['agents']&&_0x22e695>=_0x56b687['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x30e99a(_0x174e02);})[_0xdb78('0x13')](function(_0x467a61){_0x2814df(_0x467a61);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 9f07145..3c556f8 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd996=['Resource\x20Conflict','Conflict','error','stack','statusMessage','status','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval'];(function(_0x1d34f1,_0x1abe4e){var _0x4be244=function(_0x38a4b0){while(--_0x38a4b0){_0x1d34f1['push'](_0x1d34f1['shift']());}};_0x4be244(++_0x1abe4e);}(_0xd996,0x1e7));var _0x6d99=function(_0x3fcc96,_0x1c65d4){_0x3fcc96=_0x3fcc96-0x0;var _0x5caa7a=_0xd996[_0x3fcc96];return _0x5caa7a;};'use strict';var util=require(_0x6d99('0x0'));var logger=require(_0x6d99('0x1'))('api');var APIError=function(_0x4d465e,_0x438a31){this[_0x6d99('0x2')]=_0x4d465e||_0x6d99('0x3');this[_0x6d99('0x4')]=_0x438a31||'Error';util[_0x6d99('0x5')](APIError,Error);};var APIBadRequestError=function(_0x365e5e){this[_0x6d99('0x2')]=_0x365e5e||_0x6d99('0x6');this['name']=_0x6d99('0x6');util[_0x6d99('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x48b333){this[_0x6d99('0x2')]=_0x48b333||_0x6d99('0x7');this[_0x6d99('0x4')]=_0x6d99('0x7');util[_0x6d99('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x43df06){this[_0x6d99('0x2')]=_0x43df06||'Entity\x20not\x20found';this['name']=_0x6d99('0x8');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2fbf13){this[_0x6d99('0x2')]=_0x2fbf13||_0x6d99('0x9');this[_0x6d99('0x4')]=_0x6d99('0xa');this[_0x6d99('0xb')]=0x193;this['details']={'type':_0x6d99('0xc')};util[_0x6d99('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x44877f){this[_0x6d99('0x2')]=_0x44877f||_0x6d99('0xd');this[_0x6d99('0x4')]=_0x6d99('0xe');util[_0x6d99('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x239baf){switch(_0x239baf){case _0x6d99('0x6'):return 0x190;case _0x6d99('0x7'),_0x6d99('0xa'):return 0x193;case _0x6d99('0x8'):return 0x194;case _0x6d99('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x132c18){if(_0x132c18===_0x6d99('0xa'))return _0x132c18;return null;}function handleError(_0x41047b){return function(_0x36c7f9){logger[_0x6d99('0xf')](_0x36c7f9[_0x6d99('0x10')]);var _0x4e1f9e=getStatusCode(_0x36c7f9[_0x6d99('0x4')]);var _0x58d383=getCustomStatusMessage(_0x36c7f9[_0x6d99('0x4')]);if(_0x36c7f9[_0x6d99('0x4')]){delete _0x36c7f9[_0x6d99('0x4')];}if(_0x58d383){_0x41047b[_0x6d99('0x11')]=_0x58d383;}return _0x41047b[_0x6d99('0x12')](_0x4e1f9e)['send'](_0x36c7f9);};}module[_0x6d99('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x7a6e=['Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','Forbidden','name','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error','stack','send','exports','../config/logger','message'];(function(_0x55e5ea,_0x3e471d){var _0x50ec12=function(_0x537505){while(--_0x537505){_0x55e5ea['push'](_0x55e5ea['shift']());}};_0x50ec12(++_0x3e471d);}(_0x7a6e,0x18d));var _0xe7a6=function(_0x14d19b,_0x5de038){_0x14d19b=_0x14d19b-0x0;var _0x455d60=_0x7a6e[_0x14d19b];return _0x455d60;};'use strict';var util=require('util');var logger=require(_0xe7a6('0x0'))('api');var APIError=function(_0x1db605,_0x5585a9){this[_0xe7a6('0x1')]=_0x1db605||_0xe7a6('0x2');this['name']=_0x5585a9||_0xe7a6('0x3');util[_0xe7a6('0x4')](APIError,Error);};var APIBadRequestError=function(_0x2eb006){this[_0xe7a6('0x1')]=_0x2eb006||_0xe7a6('0x5');this['name']=_0xe7a6('0x5');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3e7149){this['message']=_0x3e7149||_0xe7a6('0x6');this[_0xe7a6('0x7')]=_0xe7a6('0x6');util[_0xe7a6('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5f04dc){this[_0xe7a6('0x1')]=_0x5f04dc||_0xe7a6('0x8');this[_0xe7a6('0x7')]=_0xe7a6('0x9');util[_0xe7a6('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xbee56f){this[_0xe7a6('0x1')]=_0xbee56f||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xe7a6('0x7')]=_0xe7a6('0xa');this[_0xe7a6('0xb')]=0x193;this[_0xe7a6('0xc')]={'type':'OutOfInterval'};util[_0xe7a6('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4fedc4){this[_0xe7a6('0x1')]=_0x4fedc4||_0xe7a6('0xd');this[_0xe7a6('0x7')]=_0xe7a6('0xe');util[_0xe7a6('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x443910){switch(_0x443910){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe7a6('0xa'):return 0x193;case _0xe7a6('0x9'):return 0x194;case _0xe7a6('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x117b33){if(_0x117b33===_0xe7a6('0xa'))return _0x117b33;return null;}function handleError(_0x5c876e){return function(_0x96a38e){logger[_0xe7a6('0xf')](_0x96a38e[_0xe7a6('0x10')]);var _0x14158e=getStatusCode(_0x96a38e[_0xe7a6('0x7')]);var _0x25f2d4=getCustomStatusMessage(_0x96a38e[_0xe7a6('0x7')]);if(_0x96a38e['name']){delete _0x96a38e[_0xe7a6('0x7')];}if(_0x25f2d4){_0x5c876e['statusMessage']=_0x25f2d4;}return _0x5c876e['status'](_0x14158e)[_0xe7a6('0x11')](_0x96a38e);};}module[_0xe7a6('0x12')]={'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 9383899..5cb6652 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c5f=['render','json','send','exports','status'];(function(_0x142ea5,_0x4cc50b){var _0x49b720=function(_0x188c8e){while(--_0x188c8e){_0x142ea5['push'](_0x142ea5['shift']());}};_0x49b720(++_0x4cc50b);}(_0x2c5f,0x139));var _0xf2c5=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2c5f[_0x21549c];return _0x426cbd;};'use strict';module[_0xf2c5('0x0')][0x194]=function pageNotFound(_0x455479,_0x50c06c){var _0x19e021='404';var _0x25fa6e=0x194;var _0x58325b={'status':_0x25fa6e};_0x50c06c[_0xf2c5('0x1')](_0x58325b[_0xf2c5('0x1')]);_0x50c06c[_0xf2c5('0x2')](_0x19e021,{},function(_0x1a660,_0x13a626){if(_0x1a660){return _0x50c06c[_0xf2c5('0x1')](_0x58325b[_0xf2c5('0x1')])[_0xf2c5('0x3')](_0x58325b);}_0x50c06c[_0xf2c5('0x4')](_0x13a626);});}; \ No newline at end of file +var _0xfba1=['send','404','status','json'];(function(_0x4f9779,_0x52808a){var _0x13f3cc=function(_0x5d0136){while(--_0x5d0136){_0x4f9779['push'](_0x4f9779['shift']());}};_0x13f3cc(++_0x52808a);}(_0xfba1,0x1e5));var _0x1fba=function(_0x35ef08,_0x2cb5ef){_0x35ef08=_0x35ef08-0x0;var _0x198be4=_0xfba1[_0x35ef08];return _0x198be4;};'use strict';module['exports'][0x194]=function pageNotFound(_0x17e119,_0x49d344){var _0x92a962=_0x1fba('0x0');var _0x391b47=0x194;var _0x271b50={'status':_0x391b47};_0x49d344[_0x1fba('0x1')](_0x271b50[_0x1fba('0x1')]);_0x49d344['render'](_0x92a962,{},function(_0x3511cd,_0x249c69){if(_0x3511cd){return _0x49d344['status'](_0x271b50[_0x1fba('0x1')])[_0x1fba('0x2')](_0x271b50);}_0x49d344[_0x1fba('0x3')](_0x249c69);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0ac5ad5..5ca7134 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9651=['SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','userSetting','UserId','hasMany','Recordings','Extensions','cascade','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','ChatGroup','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','VoiceQueueId','CmHopper','HopperFinals','CmHopperHistory','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackupId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','List','Template','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','Teams','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','DashboardItem','Items','FaxAccountId','CannedAnswer','Exntensions','FaxMessage','ListId','FaxInteractionId','fax_interaction_has_tags','Users','team_has_fax_queues','SmsAccountId','TagId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','CmContactHasItem','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','Campaign','All','OneAll','AutomationAllId','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceConfiguration','DescriptionId','Subject','Description','Field','FieldId','VariableId','Descriptions','int_desk_configuration_has_tags','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','FreshsalesAccount','ChatQueueReport','ToId','SessionId','ProjectId','VoiceQueues','team_has_openchannel_queues','team_has_whatsapp_queues','CampaignId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','sequelizeHistory','utf8','utf8_general_ci','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration'];(function(_0x4cddc2,_0x2be761){var _0x392fb3=function(_0x219373){while(--_0x219373){_0x4cddc2['push'](_0x4cddc2['shift']());}};_0x392fb3(++_0x2be761);}(_0x9651,0x166));var _0x1965=function(_0xa3b0b7,_0x3d3dd0){_0xa3b0b7=_0xa3b0b7-0x0;var _0x5e0e34=_0x9651[_0xa3b0b7];return _0x5e0e34;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x1965('0x0'));var _=require('lodash');var jstz=require(_0x1965('0x1'));var timezone=jstz[_0x1965('0x2')]();config['sequelize']=_[_0x1965('0x3')](config[_0x1965('0x0')],{'database':_0x1965('0x4'),'username':_0x1965('0x5'),'password':_0x1965('0x6'),'options':{'host':_0x1965('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1965('0x8')},'logging':![],'timezone':timezone[_0x1965('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x1965('0xa')]=_[_0x1965('0x3')](config[_0x1965('0xa')],{'database':_0x1965('0x4'),'username':_0x1965('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1965('0x8')},'logging':![],'timezone':timezone[_0x1965('0x9')](),'define':{'charset':_0x1965('0xb'),'collate':_0x1965('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1965('0x0')][_0x1965('0xd')],config[_0x1965('0x0')]['username'],config[_0x1965('0x0')][_0x1965('0xe')],config['sequelize'][_0x1965('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1965('0xa')][_0x1965('0xd')],config[_0x1965('0xa')]['username'],config[_0x1965('0xa')][_0x1965('0xe')],config[_0x1965('0xa')][_0x1965('0xf')])};db[_0x1965('0x10')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x12'));db[_0x1965('0x13')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x14'));db[_0x1965('0x15')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x16'));db[_0x1965('0x17')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x18'));db['VoiceMusicOnHold']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x19'));db[_0x1965('0x1a')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x1b'));db[_0x1965('0x1c')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x1d'));db[_0x1965('0x1e')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x1965('0x0')]['import'](_0x1965('0x1f'));db[_0x1965('0x20')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x21'));db[_0x1965('0x22')]=db[_0x1965('0x0')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x1965('0x23')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x24'));db[_0x1965('0x25')]=db[_0x1965('0x0')]['import'](_0x1965('0x26'));db['VoiceQueueReport']=db[_0x1965('0x0')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1965('0x27')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x28'));db['Trunk']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x29'));db['VoiceTransferReport']=db[_0x1965('0x0')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x1965('0x2a')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x2b'));db[_0x1965('0x2c')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x2d'));db[_0x1965('0x2e')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x2f'));db[_0x1965('0x30')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x31'));db[_0x1965('0x32')]=db[_0x1965('0x0')]['import'](_0x1965('0x33'));db[_0x1965('0x34')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x35'));db[_0x1965('0x36')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x37'));db[_0x1965('0x38')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x39'));db['MailServerIn']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x3a'));db[_0x1965('0x3b')]=db[_0x1965('0x0')]['import'](_0x1965('0x3c'));db['MailAccount']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x3d'));db[_0x1965('0x3e')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x3f'));db[_0x1965('0x40')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1965('0x41')]=db['sequelize']['import'](_0x1965('0x42'));db[_0x1965('0x43')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x44'));db[_0x1965('0x45')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/mailApplication/mailApplication.model');db[_0x1965('0x46')]=db['sequelize'][_0x1965('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0x1965('0x47')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x48'));db['DashboardItem']=db['sequelize'][_0x1965('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0x1965('0x49')]=db[_0x1965('0x0')]['import'](_0x1965('0x4a'));db[_0x1965('0x4b')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x4c'));db[_0x1965('0x4d')]=db['sequelize'][_0x1965('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x1965('0x0')]['import'](_0x1965('0x4e'));db[_0x1965('0x4f')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x50'));db[_0x1965('0x51')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x52'));db[_0x1965('0x53')]=db[_0x1965('0x0')]['import'](_0x1965('0x54'));db[_0x1965('0x55')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/smsApplication/smsApplication.model');db[_0x1965('0x56')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x57'));db[_0x1965('0x58')]=db[_0x1965('0x0')]['import'](_0x1965('0x59'));db[_0x1965('0x5a')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x5b'));db[_0x1965('0x5c')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/openchannelAccount/openchannelAccount.model');db[_0x1965('0x5d')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0x1965('0x5e')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x1965('0x5f')]=db[_0x1965('0x0')]['import'](_0x1965('0x60'));db[_0x1965('0x61')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x62'));db['ChatWebsite']=db[_0x1965('0x0')][_0x1965('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x1965('0x63')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x64'));db[_0x1965('0x65')]=db[_0x1965('0x0')]['import'](_0x1965('0x66'));db[_0x1965('0x67')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x68'));db[_0x1965('0x69')]=db[_0x1965('0x0')]['import'](_0x1965('0x6a'));db[_0x1965('0x6b')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x6c'));db['ChatQueue']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x6d'));db['ChatGroup']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x6e'));db[_0x1965('0x6f')]=db['sequelize'][_0x1965('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x1965('0x70')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x71'));db[_0x1965('0x72')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0x1965('0x11')](_0x1965('0x73'));db[_0x1965('0x74')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x75'));db[_0x1965('0x76')]=db['sequelize'][_0x1965('0x11')](_0x1965('0x77'));db['CmHopperHistory']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x78'));db[_0x1965('0x79')]=db['sequelize']['import'](_0x1965('0x7a'));db['CmCustomField']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x7b'));db[_0x1965('0x7c')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x7d'));db[_0x1965('0x7e')]=db[_0x1965('0x0')]['import'](_0x1965('0x7f'));db['CannedAnswer']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x80'));db['Disposition']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x81'));db[_0x1965('0x82')]=db[_0x1965('0x0')]['import'](_0x1965('0x83'));db[_0x1965('0x84')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x85'));db[_0x1965('0x86')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x87'));db[_0x1965('0x88')]=db['sequelize']['import'](_0x1965('0x89'));db['VoiceQueuesLog']=db['sequelize']['import'](_0x1965('0x8a'));db[_0x1965('0x8b')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/schedule/schedule.model');db['Sound']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x8c'));db[_0x1965('0x8d')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x8e'));db['ContactItemType']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x8f'));db['CmContactHasItem']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x90'));db[_0x1965('0x91')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x92'));db['Template']=db[_0x1965('0x0')][_0x1965('0x11')]('../api/template/template.model');db[_0x1965('0x93')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/trigger/trigger.model');db[_0x1965('0x94')]=db['sequelize'][_0x1965('0x11')]('../api/variable/variable.model');db[_0x1965('0x95')]=db['sequelize']['import'](_0x1965('0x96'));db[_0x1965('0x97')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/integrationReport/integrationReport.model');db[_0x1965('0x98')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x99'));db['AnalyticDefaultReport']=db[_0x1965('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x1965('0x0')]['import'](_0x1965('0x9a'));db[_0x1965('0x9b')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x1965('0x0')]['import'](_0x1965('0x9c'));db[_0x1965('0x9d')]=db[_0x1965('0x0')]['import'](_0x1965('0x9e'));db[_0x1965('0x9f')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xa0'));db['SalesforceConfiguration']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xa1'));db[_0x1965('0xa2')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1965('0xa3')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xa4'));db[_0x1965('0xa5')]=db[_0x1965('0x0')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x1965('0xa6')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xa7'));db[_0x1965('0xa8')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xa9'));db[_0x1965('0xaa')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xab'));db[_0x1965('0xac')]=db[_0x1965('0x0')]['import'](_0x1965('0xad'));db[_0x1965('0xae')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xaf'));db[_0x1965('0xb0')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xb1'));db[_0x1965('0xb2')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xb3'));db['ZendeskAccount']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xb4'));db[_0x1965('0xb5')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xb6'));db[_0x1965('0xb7')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xb8'));db[_0x1965('0xb9')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xba'));db[_0x1965('0xbb')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x1965('0xbc')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xbd'));db[_0x1965('0xbe')]=db['sequelize'][_0x1965('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x1965('0xbf')]=db['sequelize']['import'](_0x1965('0xc0'));db['VtigerField']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xc1'));db[_0x1965('0xc2')]=db['sequelize']['import'](_0x1965('0xc3'));db['ServicenowConfiguration']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xc4'));db[_0x1965('0xc5')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xc6'));db[_0x1965('0xc7')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xc8'));db[_0x1965('0xc9')]=db[_0x1965('0x0')]['import'](_0x1965('0xca'));db[_0x1965('0xcb')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xcc'));db['FreshsalesAccount']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xcd'));db[_0x1965('0xce')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xcf'));db[_0x1965('0xd0')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xd1'));db['Integration']=db[_0x1965('0x0')]['import'](_0x1965('0x96'));db[_0x1965('0xd2')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xd3'));db['ChatQueueReport']=db[_0x1965('0x0')]['import'](_0x1965('0xd4'));db[_0x1965('0xd5')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xd6'));db[_0x1965('0xd7')]=db['sequelize'][_0x1965('0x11')](_0x1965('0xd8'));db[_0x1965('0xd9')]=db[_0x1965('0x0')]['import'](_0x1965('0xda'));db['JscriptySessionReport']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xdb'));db[_0x1965('0xdc')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xdd'));db[_0x1965('0xde')]=db[_0x1965('0x0')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x1965('0x0')]['import'](_0x1965('0xdf'));db[_0x1965('0xe0')]=db[_0x1965('0x0')]['import'](_0x1965('0xe1'));db[_0x1965('0xe2')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0x1965('0x11')]('../api/squareOdbc/squareOdbc.model');db[_0x1965('0xe3')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xe4'));db[_0x1965('0xe5')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xe6'));db[_0x1965('0xe7')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/squareMessage/squareMessage.model');db[_0x1965('0xe8')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xe9'));db['License']=db[_0x1965('0x0')]['import'](_0x1965('0xea'));db['Campaign']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xeb'));db['Migration']=db[_0x1965('0x0')][_0x1965('0x11')]('../api/migration/migration.model');db[_0x1965('0xec')]=db['sequelize'][_0x1965('0x11')]('../api/attachment/attachment.model');db[_0x1965('0xed')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xee'));db[_0x1965('0xef')]=db['sequelize'][_0x1965('0x11')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xf0'));db[_0x1965('0xf1')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xf2'));db[_0x1965('0xf3')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xf4'));db[_0x1965('0xf5')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xf6'));db['CmList']=db[_0x1965('0x0')][_0x1965('0x11')]('../api/cmList/cmList.model');db[_0x1965('0xf7')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xf8'));db[_0x1965('0xf9')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xfa'));db[_0x1965('0xfb')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0xfc'));db[_0x1965('0xfd')]=db[_0x1965('0x0')]['import'](_0x1965('0xfe'));db[_0x1965('0xff')]=db[_0x1965('0x0')]['import'](_0x1965('0x100'));db['WhatsappApplication']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x101'));db[_0x1965('0x102')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x103'));db[_0x1965('0x104')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x105'));db['WhatsappQueueReport']=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x106'));db[_0x1965('0x107')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x108'));db[_0x1965('0x109')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x10a'));db[_0x1965('0x10b')]=db['sequelize']['import'](_0x1965('0x10c'));db[_0x1965('0x10d')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x10e'));db[_0x1965('0x10f')]=db['sequelize']['import'](_0x1965('0x110'));db[_0x1965('0x111')]=db[_0x1965('0x0')][_0x1965('0x11')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x1965('0x112')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x113'));db[_0x1965('0x114')]=db[_0x1965('0x0')][_0x1965('0x11')](_0x1965('0x115'));db[_0x1965('0x10')][_0x1965('0x116')](db[_0x1965('0x117')],{'as':_0x1965('0x117'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x1965('0x10')][_0x1965('0x116')](db[_0x1965('0x112')],{'as':_0x1965('0x118'),'onDelete':'cascade','foreignKey':_0x1965('0x119')});db['User'][_0x1965('0x11a')](db[_0x1965('0x1c')],{'as':_0x1965('0x11b'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x17')],{'as':_0x1965('0x11c'),'onDelete':_0x1965('0x11d'),'hooks':!![]});db['User'][_0x1965('0x11a')](db[_0x1965('0x76')],{'as':'HopperFinals','foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db['CmHopperHistory'],{'as':_0x1965('0x11e'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')]['hasMany'](db[_0x1965('0x79')],{'as':_0x1965('0x79'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x5e')],{'as':_0x1965('0x11f'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x67')],{'as':_0x1965('0x120'),'foreignKey':_0x1965('0x119')});db['User']['hasMany'](db[_0x1965('0x56')],{'as':_0x1965('0x121'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x4d')],{'as':_0x1965('0x122'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x41')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x1965('0x10')][_0x1965('0x11a')](db[_0x1965('0x102')],{'as':'WhatsappInteractions','foreignKey':_0x1965('0x119')});db[_0x1965('0x10')][_0x1965('0x11a')](db['UserNotification'],{'as':_0x1965('0x123'),'foreignKey':_0x1965('0x124')});db[_0x1965('0x10')][_0x1965('0x11a')](db['CmHopper'],{'as':_0x1965('0x125'),'foreignKey':_0x1965('0x119'),'onDelete':_0x1965('0x126')});db[_0x1965('0x10')][_0x1965('0x127')](db[_0x1965('0xf9')],{'as':_0x1965('0xf9'),'foreignKey':_0x1965('0x128')});db[_0x1965('0x10')]['belongsToMany'](db[_0x1965('0x129')],{'as':_0x1965('0x12a'),'through':_0x1965('0x12b')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x72')],{'as':'Contacts','through':_0x1965('0x12d')});db[_0x1965('0x10')]['belongsToMany'](db[_0x1965('0x12e')],{'as':_0x1965('0x12f'),'through':_0x1965('0x130')});db['User']['belongsToMany'](db[_0x1965('0xe8')],{'through':_0x1965('0x131')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x41')],{'as':_0x1965('0x132'),'through':_0x1965('0x133')});db[_0x1965('0x10')][_0x1965('0x12c')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x1965('0x134')});db[_0x1965('0x10')]['belongsToMany'](db['FaxInteraction'],{'as':_0x1965('0x122'),'through':_0x1965('0x135')});db[_0x1965('0x10')]['belongsToMany'](db[_0x1965('0x56')],{'as':_0x1965('0x121'),'through':'user_has_sms_interactions'});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x5e')],{'as':_0x1965('0x11f'),'through':_0x1965('0x136')});db[_0x1965('0x10')]['belongsToMany'](db[_0x1965('0x102')],{'as':_0x1965('0x137'),'through':_0x1965('0x138')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x1a')],{'as':'VoiceQueues','through':_0x1965('0x2c'),'required':![]});db['User']['belongsToMany'](db[_0x1965('0xf7')],{'as':_0x1965('0x139'),'through':_0x1965('0x111'),'required':![]});db['User'][_0x1965('0x12c')](db[_0x1965('0x3e')],{'as':_0x1965('0x13a'),'through':_0x1965('0x30'),'required':![]});db['User'][_0x1965('0x12c')](db[_0x1965('0x13b')],{'as':_0x1965('0x13c'),'through':_0x1965('0x2e'),'required':![],'hooks':!![]});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x4f')],{'as':_0x1965('0x13d'),'through':_0x1965('0x32'),'required':![]});db[_0x1965('0x10')]['belongsToMany'](db[_0x1965('0x5a')],{'as':_0x1965('0x13e'),'through':'UserSmsQueue','required':![]});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x61')],{'as':_0x1965('0x13f'),'through':_0x1965('0x36'),'required':![]});db[_0x1965('0x10')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x1965('0x140'),'through':_0x1965('0x38'),'required':![]});db[_0x1965('0x10')]['belongsToMany'](db['CmList'],{'through':_0x1965('0x130')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x141')],{'as':_0x1965('0x142'),'through':_0x1965('0x143')});db[_0x1965('0x10')][_0x1965('0x12c')](db['FaxAccount'],{'as':_0x1965('0x144'),'through':_0x1965('0x145')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x146')],{'as':_0x1965('0x147'),'through':_0x1965('0x148')});db[_0x1965('0x10')][_0x1965('0x12c')](db[_0x1965('0x5c')],{'as':_0x1965('0x149'),'through':'user_has_openchannel_accounts'});db[_0x1965('0x10')][_0x1965('0x12c')](db['SmsAccount'],{'as':_0x1965('0x14a'),'through':_0x1965('0x14b')});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x1965('0x14c')});db[_0x1965('0x13')][_0x1965('0x11a')](db[_0x1965('0x17')],{'as':_0x1965('0x14d'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x14e')});db[_0x1965('0x15')][_0x1965('0x11a')](db[_0x1965('0x17')],{'onDelete':_0x1965('0x11d')});db['VoiceExtension'][_0x1965('0x11a')](db[_0x1965('0x17')],{'as':_0x1965('0x14f'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x1965('0x12c')](db[_0x1965('0x150')],{'as':_0x1965('0x151'),'through':'moh_has_sounds'});db[_0x1965('0x1a')][_0x1965('0x11a')](db[_0x1965('0x2a')],{'as':'Members','foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')][_0x1965('0x11a')](db[_0x1965('0x153')],{'as':_0x1965('0x125'),'foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')][_0x1965('0x11a')](db[_0x1965('0x76')],{'as':_0x1965('0x154'),'foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')]['hasMany'](db[_0x1965('0x155')],{'as':'HopperHistories','foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')][_0x1965('0x11a')](db[_0x1965('0x79')],{'as':_0x1965('0x79'),'foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')]['hasMany'](db['CmHopperBlack'],{'as':_0x1965('0x156'),'foreignKey':'VoiceQueueId'});db[_0x1965('0x1a')][_0x1965('0x11a')](db[_0x1965('0x157')],{'as':_0x1965('0x158'),'foreignKey':_0x1965('0x152')});db[_0x1965('0x1a')][_0x1965('0x127')](db[_0x1965('0x159')],{'as':_0x1965('0x159'),'foreignKey':_0x1965('0x15a')});db[_0x1965('0x1a')]['belongsTo'](db[_0x1965('0x159')],{'as':'TrunkBackup','foreignKey':_0x1965('0x15b')});db[_0x1965('0x1a')][_0x1965('0x127')](db[_0x1965('0x84')],{'as':_0x1965('0x84'),'foreignKey':'IntervalId'});db[_0x1965('0x1a')][_0x1965('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x1965('0x1a')]['belongsToMany'](db[_0x1965('0x12e')],{'as':_0x1965('0x12f'),'through':_0x1965('0x15c')});db[_0x1965('0x1a')]['belongsToMany'](db['User'],{'as':_0x1965('0x15d'),'through':_0x1965('0x2c')});db[_0x1965('0x1a')][_0x1965('0x12c')](db[_0x1965('0xe8')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x1965('0x1a')][_0x1965('0x12c')](db['CmList'],{'as':_0x1965('0x15e'),'through':_0x1965('0x15f')});db['VoiceRecording'][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x10'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x1e')][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x10'),'foreignKey':'UserId'});db[_0x1965('0x117')][_0x1965('0x11a')](db[_0x1965('0x20')],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x161'),'sourceKey':_0x1965('0x162')});db[_0x1965('0x20')][_0x1965('0x127')](db['VoiceMail'],{'foreignKey':_0x1965('0x161'),'targetKey':_0x1965('0x162')});db[_0x1965('0x22')][_0x1965('0x11a')](db[_0x1965('0x163')],{'as':_0x1965('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0x1965('0x22')][_0x1965('0x11a')](db['VoiceAgentReport'],{'as':_0x1965('0x165'),'foreignKey':_0x1965('0x166'),'constraints':![]});db[_0x1965('0x22')][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x10'),'foreignKey':'UserId'});db[_0x1965('0x22')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':'Contact','foreignKey':_0x1965('0x167')});db[_0x1965('0x168')]['belongsTo'](db['MailAccount'],{'as':_0x1965('0x146'),'foreignKey':_0x1965('0x169')});db['MailServerIn'][_0x1965('0x127')](db[_0x1965('0x10b')],{'as':_0x1965('0x10b'),'foreignKey':_0x1965('0x16a'),'onDelete':'restrict'});db[_0x1965('0x3b')][_0x1965('0x127')](db[_0x1965('0x146')],{'as':_0x1965('0x146'),'foreignKey':_0x1965('0x169')});db['MailServerOut'][_0x1965('0x127')](db[_0x1965('0x10b')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x1965('0x16b')});db[_0x1965('0x146')][_0x1965('0x116')](db[_0x1965('0x168')],{'as':_0x1965('0x16c'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x146')][_0x1965('0x116')](db[_0x1965('0x3b')],{'as':_0x1965('0x16d'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x146')][_0x1965('0x11a')](db[_0x1965('0x16e')],{'as':_0x1965('0x16f'),'foreignKey':_0x1965('0x169'),'onDelete':'cascade'});db[_0x1965('0x146')][_0x1965('0x11a')](db['CannedAnswer'],{'as':_0x1965('0x170'),'foreignKey':_0x1965('0x169')});db[_0x1965('0x146')][_0x1965('0x11a')](db['MailMessage'],{'as':_0x1965('0x160'),'foreignKey':'MailAccountId'});db[_0x1965('0x146')][_0x1965('0x11a')](db[_0x1965('0x41')],{'as':_0x1965('0x171')});db[_0x1965('0x146')]['hasMany'](db[_0x1965('0x45')],{'as':_0x1965('0x14f'),'foreignKey':_0x1965('0x169'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x146')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':'ListId'});db[_0x1965('0x146')][_0x1965('0x127')](db[_0x1965('0x173')],{'as':_0x1965('0x173'),'foreignKey':'TemplateId'});db[_0x1965('0x146')][_0x1965('0x127')](db[_0x1965('0x86')],{'as':_0x1965('0x174'),'foreignKey':_0x1965('0x175')});db[_0x1965('0x146')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0x1965('0x30')});db['MailQueue']['belongsToMany'](db[_0x1965('0xe8')],{'through':_0x1965('0x176'),'as':_0x1965('0x177')});db[_0x1965('0x41')]['hasMany'](db[_0x1965('0x43')],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x178')});db[_0x1965('0x41')][_0x1965('0x127')](db[_0x1965('0x146')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x169')});db['MailInteraction'][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':'ContactId'});db[_0x1965('0x41')]['belongsTo'](db['User'],{'as':_0x1965('0x17b'),'foreignKey':_0x1965('0x119')});db['MailInteraction'][_0x1965('0x12c')](db['Tag'],{'through':_0x1965('0x17c'),'as':_0x1965('0x17d')});db[_0x1965('0x41')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x17c'),'as':_0x1965('0x17e')});db[_0x1965('0x41')][_0x1965('0x12c')](db['User'],{'as':'Users','through':_0x1965('0x133'),'foreignKey':_0x1965('0x178')});db[_0x1965('0x43')][_0x1965('0x11a')](db['Attachment'],{'as':_0x1965('0x17f'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x43')][_0x1965('0x127')](db['User'],{'as':_0x1965('0x10')});db[_0x1965('0x43')][_0x1965('0x127')](db[_0x1965('0x72')],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x17a')});db[_0x1965('0x43')][_0x1965('0x127')](db['MailInteraction'],{'as':_0x1965('0x180'),'foreignKey':_0x1965('0x178')});db['MailMessage']['belongsTo'](db[_0x1965('0x146')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x169')});db[_0x1965('0x43')]['belongsTo'](db['ChatWebsite'],{'as':_0x1965('0x141'),'foreignKey':_0x1965('0x181')});db['MailMessage'][_0x1965('0x127')](db[_0x1965('0x6b')],{'as':_0x1965('0x6b'),'foreignKey':_0x1965('0x182')});db[_0x1965('0x45')][_0x1965('0x127')](db[_0x1965('0x10')],{'onDelete':_0x1965('0x16b')});db['MailApplication']['belongsTo'](db[_0x1965('0x3e')],{'onDelete':'restrict'});db[_0x1965('0x45')]['belongsTo'](db[_0x1965('0x146')],{'onDelete':_0x1965('0x16b')});db[_0x1965('0x45')][_0x1965('0x127')](db[_0x1965('0x84')],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x45')][_0x1965('0x127')](db[_0x1965('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x1965('0x46')][_0x1965('0x127')](db[_0x1965('0x146')],{});db[_0x1965('0x46')][_0x1965('0x127')](db['CmList'],{'as':_0x1965('0x172'),'foreignKey':'ListId'});db[_0x1965('0x46')][_0x1965('0x127')](db['CmContact'],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x46')][_0x1965('0x127')](db[_0x1965('0x41')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0x1965('0x127')](db['User'],{});db[_0x1965('0x46')][_0x1965('0x127')](db[_0x1965('0x3e')],{});db[_0x1965('0x47')][_0x1965('0x11a')](db[_0x1965('0x184')],{'as':_0x1965('0x185'),'onDelete':_0x1965('0x11d')});db['FaxAccount'][_0x1965('0x11a')](db[_0x1965('0x16e')],{'as':'Dispositions','foreignKey':_0x1965('0x186'),'onDelete':'cascade'});db[_0x1965('0x49')][_0x1965('0x11a')](db[_0x1965('0x187')],{'as':'Answers','foreignKey':_0x1965('0x186')});db['FaxAccount'][_0x1965('0x11a')](db['FaxInteraction'],{'as':'Interactions'});db[_0x1965('0x49')][_0x1965('0x11a')](db[_0x1965('0x4b')],{'as':_0x1965('0x14f'),'foreignKey':_0x1965('0x186'),'onDelete':'cascade'});db[_0x1965('0x49')]['hasMany'](db[_0x1965('0x17')],{'as':_0x1965('0x188'),'onDelete':'cascade'});db[_0x1965('0x49')][_0x1965('0x11a')](db[_0x1965('0x189')],{'as':_0x1965('0x160')});db[_0x1965('0x49')][_0x1965('0x127')](db[_0x1965('0x159')],{'as':_0x1965('0x159')});db[_0x1965('0x49')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db['FaxAccount'][_0x1965('0x127')](db[_0x1965('0x86')],{'as':_0x1965('0x174'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1965('0x49')][_0x1965('0x12c')](db['User'],{'as':_0x1965('0x15d'),'through':_0x1965('0x145')});db[_0x1965('0x4b')][_0x1965('0x127')](db[_0x1965('0x10')],{'onDelete':'restrict'});db[_0x1965('0x4b')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x1965('0x16b')});db[_0x1965('0x4b')][_0x1965('0x127')](db['FaxAccount'],{'onDelete':_0x1965('0x16b')});db['FaxApplication'][_0x1965('0x127')](db[_0x1965('0x8d')],{'onDelete':_0x1965('0x16b'),'foreignKey':'TagId'});db[_0x1965('0x4d')][_0x1965('0x11a')](db[_0x1965('0x189')],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x18b')});db[_0x1965('0x4d')][_0x1965('0x127')](db[_0x1965('0x49')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x186')});db['FaxInteraction']['belongsTo'](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x4d')][_0x1965('0x127')](db['User'],{'as':_0x1965('0x17b'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x4d')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':'fax_interaction_has_tags','as':_0x1965('0x17d')});db[_0x1965('0x4d')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x18c'),'as':_0x1965('0x17e')});db[_0x1965('0x4d')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x18d'),'through':_0x1965('0x135'),'foreignKey':_0x1965('0x18b')});db['FaxMessage'][_0x1965('0x127')](db[_0x1965('0x10')],{'onDelete':_0x1965('0x11d'),'as':'User'});db[_0x1965('0x189')]['belongsTo'](db['FaxInteraction'],{'as':_0x1965('0x180'),'foreignKey':_0x1965('0x18b')});db[_0x1965('0x189')]['belongsTo'](db[_0x1965('0x72')],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x17a')});db[_0x1965('0x189')]['belongsTo'](db[_0x1965('0xec')],{'as':_0x1965('0xec'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x1965('0x127')](db[_0x1965('0x49')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x186')});db[_0x1965('0x4f')]['belongsToMany'](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':_0x1965('0x32')});db[_0x1965('0x4f')][_0x1965('0x12c')](db[_0x1965('0xe8')],{'through':_0x1965('0x18e'),'as':_0x1965('0x177')});db[_0x1965('0x51')][_0x1965('0x127')](db['FaxAccount'],{});db[_0x1965('0x51')]['belongsTo'](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db['FaxQueueReport']['belongsTo'](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x51')][_0x1965('0x127')](db[_0x1965('0x4d')],{});db['FaxQueueReport'][_0x1965('0x127')](db[_0x1965('0x189')],{});db[_0x1965('0x51')]['belongsTo'](db['User'],{});db[_0x1965('0x51')][_0x1965('0x127')](db[_0x1965('0x4f')],{});db[_0x1965('0x53')][_0x1965('0x11a')](db['Disposition'],{'as':_0x1965('0x16f'),'foreignKey':_0x1965('0x18f'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x53')]['hasMany'](db[_0x1965('0x187')],{'as':_0x1965('0x170'),'foreignKey':'SmsAccountId'});db[_0x1965('0x53')][_0x1965('0x11a')](db[_0x1965('0x58')],{'as':_0x1965('0x160'),'foreignKey':'SmsAccountId'});db[_0x1965('0x53')][_0x1965('0x11a')](db['SmsInteraction'],{'as':_0x1965('0x171')});db['SmsAccount'][_0x1965('0x11a')](db[_0x1965('0x55')],{'as':_0x1965('0x14f'),'foreignKey':_0x1965('0x18f'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x53')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':'List','foreignKey':_0x1965('0x18a')});db[_0x1965('0x53')]['belongsTo'](db[_0x1965('0x86')],{'as':_0x1965('0x174'),'foreignKey':_0x1965('0x175')});db[_0x1965('0x53')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x1965('0x14b')});db[_0x1965('0x55')][_0x1965('0x127')](db['User'],{'onDelete':_0x1965('0x16b')});db[_0x1965('0x55')]['belongsTo'](db[_0x1965('0x5a')],{'onDelete':_0x1965('0x16b')});db['SmsApplication'][_0x1965('0x127')](db[_0x1965('0x53')],{'onDelete':_0x1965('0x16b')});db[_0x1965('0x55')][_0x1965('0x127')](db['Interval'],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x183')});db['SmsApplication'][_0x1965('0x127')](db[_0x1965('0x8d')],{'onDelete':'restrict','foreignKey':_0x1965('0x190')});db['SmsInteraction'][_0x1965('0x11a')](db[_0x1965('0x58')],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x191')});db[_0x1965('0x56')][_0x1965('0x127')](db['SmsAccount'],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x18f')});db[_0x1965('0x56')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db['SmsInteraction'][_0x1965('0x127')](db['User'],{'as':_0x1965('0x17b'),'foreignKey':_0x1965('0x119')});db['SmsInteraction'][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x192'),'as':_0x1965('0x17d')});db[_0x1965('0x56')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':'sms_interaction_has_tags','as':_0x1965('0x17e')});db[_0x1965('0x56')]['belongsToMany'](db[_0x1965('0x10')],{'as':_0x1965('0x18d'),'through':_0x1965('0x193'),'foreignKey':'SmsInteractionId'});db[_0x1965('0x58')][_0x1965('0x127')](db['User'],{'as':_0x1965('0x10')});db[_0x1965('0x58')]['belongsTo'](db[_0x1965('0x72')],{'onDelete':'cascade','as':_0x1965('0x17a')});db[_0x1965('0x58')]['belongsTo'](db[_0x1965('0x56')],{'onDelete':'cascade','as':_0x1965('0x180'),'foreignKey':_0x1965('0x191')});db['SmsMessage'][_0x1965('0x127')](db[_0x1965('0x53')],{'as':_0x1965('0x179'),'foreignKey':'SmsAccountId'});db[_0x1965('0x5a')][_0x1965('0x12c')](db['User'],{'as':_0x1965('0x15d'),'through':_0x1965('0x34'),'foreignKey':_0x1965('0x194')});db[_0x1965('0x5a')][_0x1965('0x12c')](db[_0x1965('0xe8')],{'through':_0x1965('0x195'),'as':_0x1965('0x177')});db[_0x1965('0x5c')]['hasMany'](db[_0x1965('0x16e')],{'as':'Dispositions','foreignKey':_0x1965('0x196'),'onDelete':'cascade'});db[_0x1965('0x5c')][_0x1965('0x11a')](db[_0x1965('0x187')],{'as':_0x1965('0x170'),'foreignKey':_0x1965('0x196')});db[_0x1965('0x5c')][_0x1965('0x11a')](db['OpenchannelInteraction'],{'as':_0x1965('0x171'),'foreignKey':_0x1965('0x196')});db[_0x1965('0x5c')]['hasMany'](db[_0x1965('0x5f')],{'as':_0x1965('0x160'),'foreignKey':_0x1965('0x196')});db[_0x1965('0x5c')][_0x1965('0x11a')](db['OpenchannelApplication'],{'as':_0x1965('0x14f'),'foreignKey':_0x1965('0x196'),'onDelete':_0x1965('0x11d')});db['OpenchannelAccount']['belongsTo'](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db[_0x1965('0x5c')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1965('0x175')});db[_0x1965('0x5c')]['belongsToMany'](db['User'],{'as':_0x1965('0x15d'),'through':_0x1965('0x197')});db['OpenchannelApplication'][_0x1965('0x127')](db[_0x1965('0x10')],{'onDelete':'restrict'});db[_0x1965('0x5d')][_0x1965('0x127')](db['OpenchannelQueue'],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x198')});db['OpenchannelApplication'][_0x1965('0x127')](db[_0x1965('0x5c')],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x196')});db[_0x1965('0x5d')][_0x1965('0x127')](db['Interval'],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x5d')][_0x1965('0x127')](db[_0x1965('0x8d')],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x190')});db[_0x1965('0x5e')][_0x1965('0x11a')](db[_0x1965('0x5f')],{'as':_0x1965('0x160'),'onDelete':'cascade','foreignKey':_0x1965('0x199')});db['OpenchannelInteraction'][_0x1965('0x127')](db[_0x1965('0x5c')],{'as':'Account','foreignKey':_0x1965('0x196')});db[_0x1965('0x5e')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1965('0x5e')][_0x1965('0x127')](db[_0x1965('0x10')],{'as':'Owner','foreignKey':_0x1965('0x119')});db[_0x1965('0x5e')][_0x1965('0x12c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x1965('0x17d')});db[_0x1965('0x5e')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x19a'),'as':_0x1965('0x17e')});db[_0x1965('0x5e')][_0x1965('0x12c')](db['User'],{'as':_0x1965('0x18d'),'through':_0x1965('0x136'),'foreignKey':_0x1965('0x199')});db[_0x1965('0x5f')][_0x1965('0x127')](db['User'],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x10')});db[_0x1965('0x5f')][_0x1965('0x127')](db['CmContact'],{'onDelete':_0x1965('0x11d'),'as':'Contact'});db['OpenchannelMessage'][_0x1965('0x127')](db[_0x1965('0x5e')],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x180'),'foreignKey':'OpenchannelInteractionId'});db[_0x1965('0x5f')]['belongsTo'](db[_0x1965('0xec')],{'as':_0x1965('0xec'),'foreignKey':_0x1965('0x19b')});db[_0x1965('0x5f')][_0x1965('0x127')](db[_0x1965('0x5c')],{'as':'Account','foreignKey':_0x1965('0x196')});db[_0x1965('0x61')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':'UserOpenchannelQueue','foreignKey':_0x1965('0x198')});db[_0x1965('0x61')]['belongsToMany'](db[_0x1965('0xe8')],{'through':'team_has_openchannel_queues','as':_0x1965('0x177')});db[_0x1965('0x141')][_0x1965('0x11a')](db[_0x1965('0x16e')],{'as':_0x1965('0x16f'),'foreignKey':_0x1965('0x181'),'onDelete':'cascade'});db[_0x1965('0x141')][_0x1965('0x11a')](db[_0x1965('0x187')],{'as':_0x1965('0x170'),'foreignKey':'ChatWebsiteId'});db[_0x1965('0x141')]['hasMany'](db[_0x1965('0x6f')],{'as':_0x1965('0x19c')});db['ChatWebsite'][_0x1965('0x11a')](db[_0x1965('0x67')],{'as':_0x1965('0x171')});db[_0x1965('0x141')][_0x1965('0x11a')](db['ChatApplication'],{'as':'Applications','foreignKey':_0x1965('0x181'),'onDelete':'cascade'});db[_0x1965('0x141')][_0x1965('0x11a')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db[_0x1965('0x141')][_0x1965('0x127')](db[_0x1965('0x84')],{'as':'Interval','foreignKey':_0x1965('0x183')});db[_0x1965('0x141')][_0x1965('0x127')](db[_0x1965('0x146')],{'as':_0x1965('0x146'),'foreignKey':_0x1965('0x169')});db[_0x1965('0x141')][_0x1965('0x127')](db[_0x1965('0x86')],{'as':_0x1965('0x174'),'foreignKey':_0x1965('0x175')});db[_0x1965('0x141')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':'user_has_chat_websites'});db[_0x1965('0x63')]['belongsTo'](db[_0x1965('0x5c')],{});db['OpenchannelQueueReport'][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db[_0x1965('0x63')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x63')][_0x1965('0x127')](db[_0x1965('0x5e')],{});db[_0x1965('0x63')]['belongsTo'](db[_0x1965('0x5f')],{});db[_0x1965('0x63')][_0x1965('0x127')](db[_0x1965('0x10')],{});db[_0x1965('0x63')][_0x1965('0x127')](db[_0x1965('0x61')],{});db[_0x1965('0x65')]['belongsTo'](db[_0x1965('0x10')],{'as':_0x1965('0x19d'),'foreignKey':_0x1965('0x119'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x65')][_0x1965('0x127')](db['ChatQueue'],{'as':_0x1965('0x19e'),'foreignKey':_0x1965('0x19f'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x65')][_0x1965('0x127')](db['ChatWebsite'],{'as':_0x1965('0x1a0'),'foreignKey':_0x1965('0x181'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x65')]['belongsTo'](db['Tag'],{'onDelete':_0x1965('0x16b'),'foreignKey':_0x1965('0x190')});db[_0x1965('0x67')][_0x1965('0x11a')](db['ChatMessage'],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1a1')});db[_0x1965('0x67')][_0x1965('0x127')](db[_0x1965('0x141')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x181')});db[_0x1965('0x67')]['belongsTo'](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db['ChatInteraction'][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x17b'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x67')][_0x1965('0x12c')](db['Tag'],{'through':_0x1965('0x1a2'),'as':_0x1965('0x17d')});db[_0x1965('0x67')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x1a2'),'as':_0x1965('0x17e')});db[_0x1965('0x67')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x18d'),'through':_0x1965('0x134'),'foreignKey':_0x1965('0x1a1')});db[_0x1965('0x69')][_0x1965('0x127')](db['User'],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x10')});db['ChatMessage'][_0x1965('0x127')](db[_0x1965('0x72')],{'onDelete':_0x1965('0x11d'),'as':'Contact','foreignKey':_0x1965('0x167')});db[_0x1965('0x69')][_0x1965('0x127')](db[_0x1965('0x67')],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x180'),'foreignKey':_0x1965('0x1a1')});db['ChatMessage']['belongsTo'](db[_0x1965('0xec')],{'as':_0x1965('0xec'),'foreignKey':_0x1965('0x19b')});db[_0x1965('0x69')]['belongsTo'](db[_0x1965('0x141')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x181')});db['ChatOfflineMessage'][_0x1965('0x11a')](db[_0x1965('0xec')],{'as':_0x1965('0x17f'),'foreignKey':_0x1965('0x182'),'onDelete':_0x1965('0x11d'),'hooks':!![]});db['ChatOfflineMessage'][_0x1965('0x127')](db['CmContact'],{'onDelete':_0x1965('0x11d'),'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x6b')]['belongsTo'](db[_0x1965('0x141')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x181')});db[_0x1965('0x13b')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':_0x1965('0x2e'),'hooks':!![]});db[_0x1965('0x13b')][_0x1965('0x12c')](db[_0x1965('0xe8')],{'through':_0x1965('0x1a3'),'as':_0x1965('0x177')});db[_0x1965('0x129')][_0x1965('0x11a')](db[_0x1965('0xd5')],{'as':_0x1965('0x160'),'foreignKey':_0x1965('0x1a4'),'onDelete':'cascade'});db[_0x1965('0x129')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x1a5'),'through':_0x1965('0x12b')});db[_0x1965('0x6f')][_0x1965('0x127')](db['ChatWebsite'],{'as':_0x1965('0x1a0'),'foreignKey':_0x1965('0x181')});db[_0x1965('0x70')]['hasMany'](db[_0x1965('0x72')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x1a6')],{'as':_0x1965('0x1a7'),'foreignKey':_0x1965('0x1a8')});db['CmContact'][_0x1965('0x11a')](db[_0x1965('0x153')],{'as':_0x1965('0x125'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x76')],{'as':_0x1965('0x154'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x155')],{'as':_0x1965('0x1a9'),'foreignKey':_0x1965('0x167')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0x1965('0x79'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x72')][_0x1965('0x11a')](db['JscriptySessionReport'],{'as':_0x1965('0x158'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x5e')],{'as':_0x1965('0x11f'),'foreignKey':_0x1965('0x167'),'onDelete':'restrict'});db['CmContact'][_0x1965('0x11a')](db['ChatInteraction'],{'as':_0x1965('0x120'),'foreignKey':'ContactId','onDelete':_0x1965('0x16b')});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x56')],{'as':_0x1965('0x121'),'foreignKey':_0x1965('0x167'),'onDelete':_0x1965('0x16b')});db['CmContact']['hasMany'](db[_0x1965('0x4d')],{'as':'FaxInteractions','foreignKey':_0x1965('0x167'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x72')][_0x1965('0x11a')](db[_0x1965('0x41')],{'as':_0x1965('0x132'),'foreignKey':_0x1965('0x167'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x72')]['belongsTo'](db[_0x1965('0x70')],{'as':_0x1965('0x1aa'),'foreignKey':'CompanyId'});db['CmContact'][_0x1965('0x127')](db['CmList'],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a'),'onDelete':_0x1965('0x11d')});db['CmContact']['belongsToMany'](db[_0x1965('0x10')],{'as':_0x1965('0x18d'),'through':_0x1965('0x12d')});db[_0x1965('0x72')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'as':_0x1965('0x17d'),'through':_0x1965('0x1ab')});db[_0x1965('0x72')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':_0x1965('0x1ab'),'as':_0x1965('0x17e')});db[_0x1965('0x153')]['hasMany'](db[_0x1965('0x91')],{'as':_0x1965('0x1ac'),'foreignKey':'CmHopperId'});db[_0x1965('0x153')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167'),'onDelete':'cascade'});db[_0x1965('0x153')][_0x1965('0x127')](db['CmList'],{'as':'List','foreignKey':_0x1965('0x18a'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x153')][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x19d'),'foreignKey':'UserId'});db['CmHopper']['belongsTo'](db[_0x1965('0x1a')],{'as':_0x1965('0x19e'),'foreignKey':_0x1965('0x152'),'onDelete':'cascade'});db['CmHopper'][_0x1965('0x127')](db[_0x1965('0x1ad')],{'as':_0x1965('0x1ad'),'foreignKey':'CampaignId','onDelete':_0x1965('0x11d')});db['CmHopper']['belongsTo'](db[_0x1965('0x10')],{'as':'Owner','foreignKey':'OwnerId'});db[_0x1965('0x74')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a'),'onDelete':_0x1965('0x11d')});db['CmHopperBlack'][_0x1965('0x127')](db[_0x1965('0x1a')],{'as':_0x1965('0x19e'),'foreignKey':_0x1965('0x152'),'onDelete':_0x1965('0x11d')});db[_0x1965('0x74')]['belongsTo'](db[_0x1965('0x1ad')],{'as':_0x1965('0x1ad'),'foreignKey':'CampaignId','onDelete':_0x1965('0x11d')});db[_0x1965('0x7e')][_0x1965('0x11a')](db[_0x1965('0x82')],{'as':{'plural':_0x1965('0x1ae'),'singular':_0x1965('0x1af')},'foreignKey':_0x1965('0x1b0'),'onDelete':_0x1965('0x11d'),'hooks':!![]});db['Automation'][_0x1965('0x11a')](db[_0x1965('0x82')],{'as':{'plural':'Any','singular':_0x1965('0x1b1')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x1965('0x7e')][_0x1965('0x11a')](db['Action'],{'as':_0x1965('0x1b2'),'foreignKey':'AutomationId','onDelete':_0x1965('0x11d'),'hooks':!![]});db[_0x1965('0x16e')][_0x1965('0x11a')](db[_0x1965('0x16e')],{'as':_0x1965('0x16f'),'foreignKey':_0x1965('0x1b3'),'onDelete':'cascade'});db['Interval'][_0x1965('0x11a')](db['Interval'],{'as':_0x1965('0x1b4'),'foreignKey':_0x1965('0x183'),'onDelete':_0x1965('0x11d'),'hooks':!![],'required':![]});db[_0x1965('0x84')][_0x1965('0x11a')](db[_0x1965('0x17')],{'as':_0x1965('0x11c'),'foreignKey':_0x1965('0x183'),'onDelete':'restrict'});db[_0x1965('0x84')][_0x1965('0x11a')](db[_0x1965('0x45')],{'as':_0x1965('0x1b5'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x84')][_0x1965('0x11a')](db[_0x1965('0x65')],{'as':_0x1965('0x1b6'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x84')][_0x1965('0x11a')](db[_0x1965('0x4b')],{'as':_0x1965('0x1b7'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x84')][_0x1965('0x11a')](db[_0x1965('0x55')],{'as':_0x1965('0x1b8'),'foreignKey':_0x1965('0x183')});db[_0x1965('0x8b')]['belongsTo'](db[_0x1965('0x146')],{});db[_0x1965('0x8b')]['belongsTo'](db[_0x1965('0x1b9')],{'foreignKey':_0x1965('0x1ba')});db[_0x1965('0x8b')]['belongsTo'](db[_0x1965('0x98')],{'foreignKey':_0x1965('0x1bb')});db[_0x1965('0x150')][_0x1965('0x12c')](db['VoiceMusicOnHold'],{'as':_0x1965('0x1bc'),'through':_0x1965('0x1bd'),'onDelete':_0x1965('0x16b')});db[_0x1965('0x8d')][_0x1965('0x12c')](db[_0x1965('0x72')],{'through':_0x1965('0x1ab')});db[_0x1965('0x8d')][_0x1965('0x12c')](db[_0x1965('0x67')],{'through':_0x1965('0x1a2')});db[_0x1965('0x8d')][_0x1965('0x12c')](db[_0x1965('0x41')],{'through':_0x1965('0x17c')});db['Tag'][_0x1965('0x12c')](db[_0x1965('0x56')],{'through':_0x1965('0x192')});db[_0x1965('0x8d')][_0x1965('0x12c')](db['FaxInteraction'],{'through':_0x1965('0x18c')});db['Tag'][_0x1965('0x12c')](db[_0x1965('0x5e')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x1965('0x12c')](db[_0x1965('0x102')],{'through':_0x1965('0x1be')});db['CmContactHasItem'][_0x1965('0x127')](db['ContactItemType'],{'as':_0x1965('0x1bf'),'foreignKey':_0x1965('0x1c0')});db[_0x1965('0x91')][_0x1965('0x127')](db['CmHopper'],{'as':_0x1965('0x1c1'),'foreignKey':_0x1965('0x1c2')});db[_0x1965('0x1a6')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':'Contact','foreignKey':_0x1965('0x1a8')});db['Trigger'][_0x1965('0x11a')](db[_0x1965('0x82')],{'as':{'plural':_0x1965('0x1c3'),'singular':_0x1965('0x1c4')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x1965('0x93')]['hasMany'](db[_0x1965('0x82')],{'as':{'plural':_0x1965('0x1c5'),'singular':_0x1965('0x1c6')},'foreignKey':_0x1965('0x1c7'),'onDelete':_0x1965('0x11d'),'hooks':!![]});db[_0x1965('0x93')][_0x1965('0x11a')](db['Action'],{'as':_0x1965('0x1b2'),'foreignKey':_0x1965('0x1c8'),'onDelete':'cascade','hooks':!![]});db[_0x1965('0x98')]['hasMany'](db[_0x1965('0x1c9')],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1bb'),'hooks':!![]});db[_0x1965('0x1b9')][_0x1965('0x11a')](db[_0x1965('0x1c9')],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1ba')});db[_0x1965('0x9b')]['hasMany'](db[_0x1965('0x1c9')],{'as':'Fields','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cb')});db['AnalyticFieldReport'][_0x1965('0x127')](db['AnalyticMetric'],{'foreignKey':_0x1965('0x1cb')});db[_0x1965('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x1965('0x1cc'),'onDelete':'cascade','foreignKey':_0x1965('0x1cd')});db['SalesforceConfiguration'][_0x1965('0x11a')](db[_0x1965('0xa2')],{'as':_0x1965('0x1ce'),'onDelete':'cascade','foreignKey':_0x1965('0x1cf')});db[_0x1965('0x1d0')][_0x1965('0x11a')](db[_0x1965('0xa2')],{'as':'Descriptions','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d1')});db['SalesforceConfiguration'][_0x1965('0x11a')](db['SalesforceField'],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':'FieldId'});db[_0x1965('0x1d0')]['belongsTo'](db['SalesforceAccount'],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0xa2')][_0x1965('0x11a')](db[_0x1965('0xa2')],{'as':_0x1965('0x1d2'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xa2')]['hasMany'](db[_0x1965('0xa2')],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xa2')][_0x1965('0x11a')](db[_0x1965('0xa2')],{'as':_0x1965('0x1d4'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0xa2')]['belongsTo'](db[_0x1965('0x94')],{'as':'Variable','foreignKey':_0x1965('0x1d6')});db['SugarcrmAccount'][_0x1965('0x11a')](db[_0x1965('0xa5')],{'as':_0x1965('0x1cc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1965('0xa5')][_0x1965('0x11a')](db[_0x1965('0xa6')],{'as':'Subjects','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xa5')][_0x1965('0x11a')](db[_0x1965('0xa6')],{'as':_0x1965('0x1d7'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xa5')][_0x1965('0x11a')](db[_0x1965('0xa6')],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':'FieldId'});db[_0x1965('0xa5')][_0x1965('0x127')](db[_0x1965('0xa3')],{'as':'Account','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xa6')][_0x1965('0x11a')](db[_0x1965('0xa6')],{'as':_0x1965('0x1d2'),'foreignKey':'SubjectId'});db[_0x1965('0xa6')][_0x1965('0x11a')](db['SugarcrmField'],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xa6')][_0x1965('0x11a')](db[_0x1965('0xa6')],{'as':_0x1965('0x1d4'),'foreignKey':'FieldId'});db[_0x1965('0xa6')]['belongsTo'](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db['DeskAccount'][_0x1965('0x11a')](db[_0x1965('0xaa')],{'as':_0x1965('0x1cc'),'onDelete':'cascade','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xaa')][_0x1965('0x11a')](db[_0x1965('0xac')],{'as':_0x1965('0x1ce'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xaa')][_0x1965('0x11a')](db[_0x1965('0xac')],{'as':'Descriptions','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d1')});db['DeskConfiguration']['hasMany'](db[_0x1965('0xac')],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':'FieldId'});db[_0x1965('0xaa')][_0x1965('0x127')](db[_0x1965('0xa8')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0xaa')][_0x1965('0x12c')](db['Tag'],{'through':_0x1965('0x1d8')});db[_0x1965('0xac')][_0x1965('0x11a')](db[_0x1965('0xac')],{'as':'Subject','foreignKey':_0x1965('0x1cf')});db[_0x1965('0xac')][_0x1965('0x11a')](db['DeskField'],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xac')][_0x1965('0x11a')](db['DeskField'],{'as':'Field','foreignKey':_0x1965('0x1d5')});db[_0x1965('0xac')][_0x1965('0x127')](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db['ZohoAccount'][_0x1965('0x11a')](db[_0x1965('0xb0')],{'as':_0x1965('0x1cc'),'onDelete':_0x1965('0x11d'),'foreignKey':'AccountId'});db[_0x1965('0xb0')][_0x1965('0x11a')](db[_0x1965('0xb2')],{'as':'Subjects','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xb0')][_0x1965('0x11a')](db[_0x1965('0xb2')],{'as':_0x1965('0x1d7'),'onDelete':'cascade','foreignKey':_0x1965('0x1d1')});db[_0x1965('0xb0')][_0x1965('0x11a')](db[_0x1965('0xb2')],{'as':_0x1965('0x1ca'),'onDelete':_0x1965('0x11d'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x1965('0x127')](db['ZohoAccount'],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0xb2')]['hasMany'](db[_0x1965('0xb2')],{'as':_0x1965('0x1d2'),'foreignKey':'SubjectId'});db[_0x1965('0xb2')][_0x1965('0x11a')](db[_0x1965('0xb2')],{'as':_0x1965('0x1d3'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x1965('0x1d4'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0xb2')][_0x1965('0x127')](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db[_0x1965('0x1d9')][_0x1965('0x11a')](db[_0x1965('0xb5')],{'as':_0x1965('0x1cc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1965('0xb5')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':'Subjects','foreignKey':_0x1965('0x1cf')});db[_0x1965('0xb5')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':'Descriptions','foreignKey':_0x1965('0x1d1')});db[_0x1965('0xb5')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':'Fields','foreignKey':_0x1965('0x1d5')});db[_0x1965('0xb5')][_0x1965('0x127')](db[_0x1965('0x1d9')],{'as':_0x1965('0x179'),'foreignKey':'AccountId'});db[_0x1965('0xb5')][_0x1965('0x12c')](db[_0x1965('0x8d')],{'through':'int_zendesk_configuration_has_tags'});db[_0x1965('0xb7')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':_0x1965('0x1d2'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xb7')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xb7')][_0x1965('0x11a')](db[_0x1965('0xb7')],{'as':_0x1965('0x1d4'),'foreignKey':_0x1965('0x1d5')});db['ZendeskField'][_0x1965('0x127')](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':'VariableId'});db[_0x1965('0xb9')][_0x1965('0x11a')](db[_0x1965('0xbb')],{'as':_0x1965('0x1cc'),'onDelete':'cascade','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xbb')]['hasMany'](db[_0x1965('0xbc')],{'as':_0x1965('0x1ce'),'onDelete':_0x1965('0x11d'),'foreignKey':'SubjectId'});db[_0x1965('0xbb')][_0x1965('0x11a')](db[_0x1965('0xbc')],{'as':_0x1965('0x1d7'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xbb')][_0x1965('0x11a')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0xbb')][_0x1965('0x127')](db[_0x1965('0xb9')],{'as':'Account','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xbb')]['belongsToMany'](db[_0x1965('0x8d')],{'through':_0x1965('0x1da')});db[_0x1965('0xbc')][_0x1965('0x11a')](db['FreshdeskField'],{'as':_0x1965('0x1d2'),'foreignKey':_0x1965('0x1cf')});db['FreshdeskField'][_0x1965('0x11a')](db[_0x1965('0xbc')],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db['FreshdeskField']['hasMany'](db[_0x1965('0xbc')],{'as':_0x1965('0x1d4'),'foreignKey':'FieldId'});db[_0x1965('0xbc')][_0x1965('0x127')](db['Variable'],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db[_0x1965('0xbe')]['hasMany'](db[_0x1965('0xbf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xbf')][_0x1965('0x11a')](db[_0x1965('0x1db')],{'as':_0x1965('0x1ce'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xbf')][_0x1965('0x11a')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x1965('0x1d1')});db[_0x1965('0xbf')]['hasMany'](db[_0x1965('0x1db')],{'as':_0x1965('0x1ca'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0xbf')][_0x1965('0x127')](db[_0x1965('0xbe')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0x1db')][_0x1965('0x11a')](db['VtigerField'],{'as':_0x1965('0x1d2'),'foreignKey':'SubjectId'});db[_0x1965('0x1db')][_0x1965('0x11a')](db[_0x1965('0x1db')],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0x1db')][_0x1965('0x11a')](db[_0x1965('0x1db')],{'as':_0x1965('0x1d4'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0x1db')][_0x1965('0x127')](db[_0x1965('0x94')],{'as':'Variable','foreignKey':_0x1965('0x1d6')});db[_0x1965('0xc2')]['hasMany'](db[_0x1965('0x1dc')],{'as':_0x1965('0x1cc'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0x1dc')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':_0x1965('0x1ce'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0x1dc')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':_0x1965('0x1d7'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0x1dc')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x1965('0x127')](db[_0x1965('0xc2')],{'as':'Account','foreignKey':_0x1965('0x1cd')});db[_0x1965('0xc5')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':_0x1965('0x1d2'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xc5')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':_0x1965('0x1d3'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xc5')][_0x1965('0x11a')](db[_0x1965('0xc5')],{'as':_0x1965('0x1d4'),'foreignKey':_0x1965('0x1d5')});db[_0x1965('0xc5')][_0x1965('0x127')](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db[_0x1965('0xc7')][_0x1965('0x11a')](db['Dynamics365Configuration'],{'as':_0x1965('0x1cc'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0xc7')][_0x1965('0x127')](db[_0x1965('0x10b')],{'as':_0x1965('0x10b'),'foreignKey':_0x1965('0x16a')});db['Dynamics365Configuration'][_0x1965('0x11a')](db[_0x1965('0xcb')],{'as':_0x1965('0x1ce'),'onDelete':_0x1965('0x11d'),'foreignKey':'SubjectId'});db[_0x1965('0xc9')][_0x1965('0x11a')](db[_0x1965('0xcb')],{'as':_0x1965('0x1d7'),'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xc9')][_0x1965('0x11a')](db[_0x1965('0xcb')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1965('0x1d5')});db[_0x1965('0xc9')][_0x1965('0x127')](db['Dynamics365Account'],{'as':_0x1965('0x179'),'foreignKey':'AccountId'});db[_0x1965('0xcb')][_0x1965('0x11a')](db['Dynamics365Field'],{'as':_0x1965('0x1d2'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xcb')][_0x1965('0x11a')](db[_0x1965('0xcb')],{'as':'Description','foreignKey':_0x1965('0x1d1')});db[_0x1965('0xcb')][_0x1965('0x11a')](db[_0x1965('0xcb')],{'as':_0x1965('0x1d4'),'foreignKey':'FieldId'});db[_0x1965('0xcb')]['belongsTo'](db[_0x1965('0x94')],{'as':_0x1965('0x94'),'foreignKey':_0x1965('0x1d6')});db[_0x1965('0x1dd')][_0x1965('0x11a')](db[_0x1965('0xce')],{'as':_0x1965('0x1cc'),'onDelete':_0x1965('0x11d'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x1965('0x1ce'),'foreignKey':_0x1965('0x1cf')});db[_0x1965('0xce')][_0x1965('0x11a')](db['FreshsalesField'],{'as':_0x1965('0x1d7'),'foreignKey':_0x1965('0x1d1')});db[_0x1965('0xce')][_0x1965('0x11a')](db[_0x1965('0xd0')],{'as':'Fields','foreignKey':_0x1965('0x1d5')});db['FreshsalesConfiguration'][_0x1965('0x127')](db[_0x1965('0x1dd')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x1cd')});db[_0x1965('0xd0')][_0x1965('0x11a')](db[_0x1965('0xd0')],{'as':'Subject','foreignKey':_0x1965('0x1cf')});db['FreshsalesField']['hasMany'](db[_0x1965('0xd0')],{'as':_0x1965('0x1d3'),'foreignKey':'DescriptionId'});db[_0x1965('0xd0')][_0x1965('0x11a')](db[_0x1965('0xd0')],{'as':'Field','foreignKey':_0x1965('0x1d5')});db[_0x1965('0xd0')][_0x1965('0x127')](db[_0x1965('0x94')],{'as':'Variable','foreignKey':_0x1965('0x1d6')});db[_0x1965('0x1de')][_0x1965('0x127')](db[_0x1965('0x141')],{});db['ChatQueueReport']['belongsTo'](db[_0x1965('0x12e')],{'as':'List','foreignKey':_0x1965('0x18a')});db[_0x1965('0x1de')][_0x1965('0x127')](db[_0x1965('0x72')],{'as':'Contact','foreignKey':_0x1965('0x167')});db[_0x1965('0x1de')][_0x1965('0x127')](db['ChatInteraction'],{});db[_0x1965('0x1de')]['belongsTo'](db[_0x1965('0x69')],{});db[_0x1965('0x1de')][_0x1965('0x127')](db[_0x1965('0x10')],{});db['ChatQueueReport'][_0x1965('0x127')](db[_0x1965('0x13b')],{});db[_0x1965('0xd5')][_0x1965('0x127')](db[_0x1965('0x10')],{'onDelete':_0x1965('0x11d'),'foreignKey':'FromId'});db[_0x1965('0xd5')]['belongsTo'](db['User'],{'onDelete':_0x1965('0x11d'),'foreignKey':_0x1965('0x1df')});db['JscriptySessionReport'][_0x1965('0x11a')](db[_0x1965('0xd9')],{'foreignKey':'SessionId','onDelete':_0x1965('0x11d')});db['JscriptySessionReport']['hasMany'](db[_0x1965('0xd7')],{'foreignKey':_0x1965('0x1e0'),'onDelete':_0x1965('0x11d')});db[_0x1965('0xdc')][_0x1965('0x127')](db[_0x1965('0x53')],{});db[_0x1965('0xdc')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':'List','foreignKey':_0x1965('0x18a')});db[_0x1965('0xdc')][_0x1965('0x127')](db['CmContact'],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db['SmsQueueReport'][_0x1965('0x127')](db[_0x1965('0x56')],{});db[_0x1965('0xdc')][_0x1965('0x127')](db[_0x1965('0x58')],{});db[_0x1965('0xdc')][_0x1965('0x127')](db[_0x1965('0x10')],{});db[_0x1965('0xdc')][_0x1965('0x127')](db[_0x1965('0x5a')],{});db['JscriptyProject'][_0x1965('0x11a')](db[_0x1965('0x157')],{'foreignKey':_0x1965('0x1e1')});db[_0x1965('0xe0')]['hasMany'](db[_0x1965('0xd9')],{'foreignKey':_0x1965('0x1e1')});db[_0x1965('0xe0')][_0x1965('0x11a')](db[_0x1965('0xd7')],{'foreignKey':_0x1965('0x1e1')});db[_0x1965('0xe8')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':_0x1965('0x131')});db[_0x1965('0xe8')][_0x1965('0x12c')](db[_0x1965('0x1a')],{'through':_0x1965('0x10d'),'as':_0x1965('0x1e2')});db[_0x1965('0xe8')][_0x1965('0x12c')](db[_0x1965('0x3e')],{'through':'team_has_mail_queues','as':_0x1965('0x13a')});db[_0x1965('0xe8')][_0x1965('0x12c')](db[_0x1965('0x13b')],{'through':_0x1965('0x1a3'),'as':_0x1965('0x13c')});db['Team'][_0x1965('0x12c')](db[_0x1965('0x4f')],{'through':_0x1965('0x18e'),'as':_0x1965('0x13d')});db['Team'][_0x1965('0x12c')](db[_0x1965('0x5a')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team'][_0x1965('0x12c')](db['OpenchannelQueue'],{'through':_0x1965('0x1e3'),'as':_0x1965('0x13f')});db[_0x1965('0xe8')][_0x1965('0x12c')](db['WhatsappQueue'],{'through':_0x1965('0x1e4'),'as':_0x1965('0x140')});db['Team']['belongsToMany'](db[_0x1965('0xf7')],{'through':_0x1965('0x10f'),'as':'VoicePrefixes'});db[_0x1965('0x1ad')][_0x1965('0x11a')](db['CmHopper'],{'as':_0x1965('0x125'),'foreignKey':_0x1965('0x1e5')});db[_0x1965('0x1ad')]['hasMany'](db[_0x1965('0x76')],{'as':_0x1965('0x154'),'foreignKey':_0x1965('0x1e5')});db[_0x1965('0x1ad')][_0x1965('0x11a')](db[_0x1965('0x155')],{'as':'HopperHistories','foreignKey':_0x1965('0x1e5')});db[_0x1965('0x1ad')][_0x1965('0x11a')](db[_0x1965('0x74')],{'as':_0x1965('0x156'),'foreignKey':_0x1965('0x1e5')});db[_0x1965('0x1ad')][_0x1965('0x127')](db[_0x1965('0x159')],{'as':_0x1965('0x159'),'foreignKey':_0x1965('0x15a')});db['Campaign'][_0x1965('0x127')](db[_0x1965('0x159')],{'as':_0x1965('0x1e6'),'foreignKey':_0x1965('0x15b')});db['Campaign'][_0x1965('0x127')](db[_0x1965('0x84')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x1965('0x1ad')][_0x1965('0x127')](db[_0x1965('0xe3')],{'as':_0x1965('0xe3'),'foreignKey':_0x1965('0x1e7')});db[_0x1965('0x1ad')][_0x1965('0x12c')](db[_0x1965('0x12e')],{'as':_0x1965('0x12f'),'through':_0x1965('0x1e8')});db[_0x1965('0x1ad')][_0x1965('0x12c')](db['CmList'],{'as':_0x1965('0x15e'),'through':_0x1965('0x1e9')});db['Attachment']['belongsTo'](db[_0x1965('0x6b')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x1965('0x127')](db[_0x1965('0x43')],{});db[_0x1965('0xef')][_0x1965('0x127')](db['MailInteraction'],{});db[_0x1965('0xef')][_0x1965('0x127')](db[_0x1965('0x146')],{'foreignKey':_0x1965('0x1ea'),'as':_0x1965('0x1eb')});db[_0x1965('0xef')][_0x1965('0x127')](db['User'],{'foreignKey':_0x1965('0x1ec'),'as':'FromAgent'});db[_0x1965('0xef')]['belongsTo'](db[_0x1965('0x10')],{'foreignKey':_0x1965('0x1ed'),'as':_0x1965('0x1ee')});db[_0x1965('0xef')][_0x1965('0x127')](db[_0x1965('0x3e')],{'foreignKey':_0x1965('0x1ef'),'as':'ToQueue'});db[_0x1965('0xef')][_0x1965('0x127')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x1965('0x1f0')});db['ChatTransferReport']['belongsTo'](db[_0x1965('0x69')],{});db['ChatTransferReport']['belongsTo'](db[_0x1965('0x67')],{});db[_0x1965('0x1f1')]['belongsTo'](db[_0x1965('0x141')],{'foreignKey':_0x1965('0x1f2'),'as':'FromAccount'});db['ChatTransferReport'][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':_0x1965('0x1ec'),'as':_0x1965('0x1f3')});db[_0x1965('0x1f1')][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':_0x1965('0x1ed'),'as':_0x1965('0x1ee')});db[_0x1965('0x1f1')]['belongsTo'](db[_0x1965('0x13b')],{'foreignKey':_0x1965('0x1f4'),'as':_0x1965('0x1f5')});db['ChatTransferReport']['belongsTo'](db[_0x1965('0x141')],{'foreignKey':_0x1965('0x1f6'),'as':'ToAccount'});db['FaxTransferReport']['belongsTo'](db[_0x1965('0x189')],{});db[_0x1965('0xf1')]['belongsTo'](db[_0x1965('0x4d')],{});db[_0x1965('0xf1')][_0x1965('0x127')](db[_0x1965('0x49')],{'foreignKey':_0x1965('0x1f7'),'as':_0x1965('0x1eb')});db[_0x1965('0xf1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1965('0xf1')]['belongsTo'](db[_0x1965('0x10')],{'foreignKey':_0x1965('0x1ed'),'as':_0x1965('0x1ee')});db[_0x1965('0xf1')][_0x1965('0x127')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x1965('0xf1')]['belongsTo'](db[_0x1965('0x49')],{'foreignKey':'ToFaxAccountId','as':_0x1965('0x1f0')});db[_0x1965('0xf3')][_0x1965('0x127')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x1965('0x127')](db[_0x1965('0x5e')],{});db[_0x1965('0xf3')][_0x1965('0x127')](db[_0x1965('0x5c')],{'foreignKey':_0x1965('0x1f8'),'as':_0x1965('0x1eb')});db[_0x1965('0xf3')][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':'FromUserId','as':_0x1965('0x1f3')});db[_0x1965('0xf3')][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':_0x1965('0x1ed'),'as':_0x1965('0x1ee')});db[_0x1965('0xf3')][_0x1965('0x127')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x1965('0x1f5')});db[_0x1965('0xf3')]['belongsTo'](db[_0x1965('0x5c')],{'foreignKey':_0x1965('0x1f9'),'as':'ToAccount'});db[_0x1965('0xf5')]['belongsTo'](db[_0x1965('0x58')],{});db['SmsTransferReport']['belongsTo'](db[_0x1965('0x56')],{});db[_0x1965('0xf5')][_0x1965('0x127')](db[_0x1965('0x53')],{'foreignKey':_0x1965('0x1fa'),'as':'FromAccount'});db[_0x1965('0xf5')][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':'FromUserId','as':_0x1965('0x1f3')});db[_0x1965('0xf5')][_0x1965('0x127')](db['User'],{'foreignKey':_0x1965('0x1ed'),'as':_0x1965('0x1ee')});db[_0x1965('0xf5')][_0x1965('0x127')](db['SmsQueue'],{'foreignKey':_0x1965('0x1fb'),'as':_0x1965('0x1f5')});db[_0x1965('0xf5')][_0x1965('0x127')](db['SmsAccount'],{'foreignKey':_0x1965('0x1fc'),'as':_0x1965('0x1f0')});db[_0x1965('0x12e')][_0x1965('0x11a')](db[_0x1965('0x16e')],{'as':_0x1965('0x16f'),'foreignKey':'ListId','onDelete':_0x1965('0x11d')});db[_0x1965('0x12e')][_0x1965('0x11a')](db[_0x1965('0x1fd')],{'as':'CustomFields','foreignKey':_0x1965('0x18a')});db[_0x1965('0x12e')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x1965('0x11d'),'foreignKey':'ListId'});db[_0x1965('0x12e')][_0x1965('0x11a')](db[_0x1965('0x76')],{'as':_0x1965('0x154'),'foreignKey':_0x1965('0x18a')});db[_0x1965('0x12e')][_0x1965('0x11a')](db[_0x1965('0x155')],{'as':_0x1965('0x11e'),'foreignKey':_0x1965('0x18a')});db['CmList'][_0x1965('0x11a')](db[_0x1965('0x79')],{'as':_0x1965('0x79'),'foreignKey':_0x1965('0x18a')});db['CmList'][_0x1965('0x12c')](db[_0x1965('0x1a')],{'as':_0x1965('0x1fe'),'through':_0x1965('0x15c')});db[_0x1965('0x12e')]['belongsToMany'](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':_0x1965('0x130')});db[_0x1965('0xf7')]['hasMany'](db['VoiceExtension'],{'as':_0x1965('0x11c'),'onDelete':'cascade'});db[_0x1965('0xf7')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':_0x1965('0x111')});db[_0x1965('0xf7')][_0x1965('0x12c')](db[_0x1965('0xe8')],{'through':_0x1965('0x10f'),'as':'Teams'});db[_0x1965('0xf9')][_0x1965('0x11a')](db[_0x1965('0x10')],{'as':'Users','foreignKey':_0x1965('0x128')});db[_0x1965('0xf9')][_0x1965('0x11a')](db[_0x1965('0x1ff')],{'as':_0x1965('0x200'),'foreignKey':_0x1965('0x128'),'onDelete':_0x1965('0x11d')});db['UserProfileSection'][_0x1965('0x11a')](db[_0x1965('0xfb')],{'as':'Resources','foreignKey':_0x1965('0x201'),'onDelete':'cascade'});db[_0x1965('0xff')][_0x1965('0x11a')](db['Disposition'],{'as':_0x1965('0x16f'),'foreignKey':_0x1965('0x202'),'onDelete':_0x1965('0x11d')});db[_0x1965('0xff')][_0x1965('0x11a')](db[_0x1965('0x187')],{'as':'Answers','foreignKey':_0x1965('0x202')});db['WhatsappAccount'][_0x1965('0x11a')](db[_0x1965('0x104')],{'as':'Messages','foreignKey':_0x1965('0x202')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x1965('0xff')][_0x1965('0x11a')](db[_0x1965('0x203')],{'as':'Applications','foreignKey':'WhatsappAccountId','onDelete':_0x1965('0x11d')});db[_0x1965('0xff')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':_0x1965('0x172'),'foreignKey':_0x1965('0x18a')});db['WhatsappAccount'][_0x1965('0x127')](db[_0x1965('0x86')],{'as':_0x1965('0x174'),'foreignKey':_0x1965('0x175')});db[_0x1965('0xff')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x15d'),'through':'user_has_whatsapp_accounts'});db[_0x1965('0x203')][_0x1965('0x127')](db['User'],{'onDelete':_0x1965('0x16b')});db['WhatsappApplication'][_0x1965('0x127')](db[_0x1965('0x109')],{'onDelete':_0x1965('0x16b')});db['WhatsappApplication']['belongsTo'](db[_0x1965('0xff')],{'onDelete':_0x1965('0x16b')});db[_0x1965('0x203')][_0x1965('0x127')](db[_0x1965('0x84')],{'onDelete':'restrict','foreignKey':_0x1965('0x183')});db[_0x1965('0x203')][_0x1965('0x127')](db[_0x1965('0x8d')],{'onDelete':'restrict','foreignKey':_0x1965('0x190')});db[_0x1965('0x102')][_0x1965('0x11a')](db[_0x1965('0x104')],{'as':_0x1965('0x160'),'onDelete':_0x1965('0x11d'),'foreignKey':'WhatsappInteractionId'});db[_0x1965('0x102')][_0x1965('0x127')](db[_0x1965('0xff')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x202')});db[_0x1965('0x102')]['belongsTo'](db['CmContact'],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x102')]['belongsTo'](db[_0x1965('0x10')],{'as':_0x1965('0x17b'),'foreignKey':_0x1965('0x119')});db[_0x1965('0x102')]['belongsToMany'](db[_0x1965('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x1965('0x17d')});db[_0x1965('0x102')][_0x1965('0x12c')](db['Tag'],{'through':_0x1965('0x1be'),'as':_0x1965('0x17e')});db[_0x1965('0x102')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':_0x1965('0x18d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x1965('0x204')});db[_0x1965('0x104')][_0x1965('0x127')](db['User'],{'as':_0x1965('0x10')});db[_0x1965('0x104')][_0x1965('0x127')](db['CmContact'],{'onDelete':_0x1965('0x11d'),'as':'Contact'});db[_0x1965('0x104')][_0x1965('0x127')](db[_0x1965('0x102')],{'onDelete':_0x1965('0x11d'),'as':'Interaction','foreignKey':_0x1965('0x204')});db[_0x1965('0x104')]['belongsTo'](db[_0x1965('0xff')],{'as':_0x1965('0x179'),'foreignKey':_0x1965('0x202')});db['WhatsappQueueReport'][_0x1965('0x127')](db[_0x1965('0xff')],{});db[_0x1965('0x205')][_0x1965('0x127')](db[_0x1965('0x12e')],{'as':'List','foreignKey':'ListId'});db['WhatsappQueueReport'][_0x1965('0x127')](db[_0x1965('0x72')],{'as':_0x1965('0x17a'),'foreignKey':_0x1965('0x167')});db[_0x1965('0x205')][_0x1965('0x127')](db[_0x1965('0x102')],{});db['WhatsappQueueReport'][_0x1965('0x127')](db[_0x1965('0x109')],{});db[_0x1965('0x205')]['belongsTo'](db[_0x1965('0x104')],{});db[_0x1965('0x205')][_0x1965('0x127')](db[_0x1965('0x10')],{});db[_0x1965('0x107')][_0x1965('0x127')](db[_0x1965('0x104')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1965('0x102')],{});db[_0x1965('0x107')][_0x1965('0x127')](db[_0x1965('0xff')],{'foreignKey':_0x1965('0x206'),'as':_0x1965('0x1eb')});db[_0x1965('0x107')][_0x1965('0x127')](db[_0x1965('0xff')],{'foreignKey':_0x1965('0x207'),'as':_0x1965('0x1f0')});db[_0x1965('0x107')][_0x1965('0x127')](db[_0x1965('0x109')],{'foreignKey':_0x1965('0x208'),'as':_0x1965('0x1f5')});db['WhatsappTransferReport'][_0x1965('0x127')](db['User'],{'foreignKey':_0x1965('0x1ec'),'as':'FromAgent'});db[_0x1965('0x107')][_0x1965('0x127')](db[_0x1965('0x10')],{'foreignKey':'ToUserId','as':_0x1965('0x1ee')});db[_0x1965('0x109')][_0x1965('0x12c')](db[_0x1965('0x10')],{'as':'Agents','through':_0x1965('0x38'),'foreignKey':_0x1965('0x209')});db[_0x1965('0x109')]['belongsToMany'](db[_0x1965('0xe8')],{'through':'team_has_whatsapp_queues','as':_0x1965('0x177')});db['UserSetting'][_0x1965('0x127')](db[_0x1965('0x10')],{'as':_0x1965('0x20a'),'foreignKey':_0x1965('0x119'),'onDelete':_0x1965('0x11d'),'hooks':!![]});db[_0x1965('0x10b')]['hasOne'](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x1965('0x16b')});db[_0x1965('0x10b')][_0x1965('0x116')](db[_0x1965('0x168')],{'as':'Imap','onDelete':_0x1965('0x16b')});db[_0x1965('0x10b')]['hasOne'](db[_0x1965('0x3b')],{'as':_0x1965('0x16d'),'onDelete':_0x1965('0x16b')});module[_0x1965('0x20b')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3958=['chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','cm_user_has_lists','Team','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','UserVoicePrefix','MailQueues','ChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueue','WhatsappQueues','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','VoiceExtension','Sound','Sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','VoiceCallReport','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Answers','MailMessage','Interactions','MailApplication','Applications','Template','TemplateId','mandatoryDispositionPauseId','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Attachments','ChatOfflineMessageId','TagId','List','ListId','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','Tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmContactId','JscriptySessionReport','JscriptySessions','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','Any','OneAny','Action','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','Trigger','AllConditions','AllCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','AccountId','Subjects','DescriptionId','FieldId','Subject','Description','Variable','VariableId','SubjectId','Descriptions','Field','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Configurations','VtigerConfiguration','Dynamics365Configuration','Dynamics365Field','FreshsalesField','FromId','ToId','ProjectId','user_has_teams','team_has_mail_queues','team_has_chat_queues','team_has_whatsapp_queues','VoicePrefixes','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','Queues','voice_queues_has_cm_lists','UserProfileSections','userProfileId','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','options','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../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','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../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','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','Recordings','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','belongsToMany','Groups'];(function(_0x18cfd4,_0x467d5a){var _0x826847=function(_0x11249d){while(--_0x11249d){_0x18cfd4['push'](_0x18cfd4['shift']());}};_0x826847(++_0x467d5a);}(_0x3958,0xe0));var _0x8395=function(_0x29792f,_0x5ab098){_0x29792f=_0x29792f-0x0;var _0x300e7b=_0x3958[_0x29792f];return _0x300e7b;};'use strict';var config=require(_0x8395('0x0'));var Sequelize=require(_0x8395('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x8395('0x2')]();config[_0x8395('0x1')]=_[_0x8395('0x3')](config[_0x8395('0x1')],{'database':_0x8395('0x4'),'username':_0x8395('0x5'),'password':_0x8395('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8395('0x7'),'dialectOptions':{'charset':_0x8395('0x8')},'logging':![],'timezone':timezone[_0x8395('0x9')](),'define':{'charset':_0x8395('0xa'),'collate':_0x8395('0xb')}}});config[_0x8395('0xc')]=_[_0x8395('0x3')](config[_0x8395('0xc')],{'database':_0x8395('0x4'),'username':_0x8395('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8395('0x7'),'dialectOptions':{'charset':_0x8395('0x8')},'logging':![],'timezone':timezone[_0x8395('0x9')](),'define':{'charset':_0x8395('0xa'),'collate':_0x8395('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8395('0x1')]['database'],config[_0x8395('0x1')]['username'],config['sequelize']['password'],config[_0x8395('0x1')][_0x8395('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8395('0xc')][_0x8395('0xe')],config[_0x8395('0xc')][_0x8395('0xf')],config[_0x8395('0xc')][_0x8395('0x10')],config[_0x8395('0xc')][_0x8395('0xd')])};db[_0x8395('0x11')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x13'));db[_0x8395('0x14')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x15'));db[_0x8395('0x16')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x17'));db[_0x8395('0x18')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8395('0x19')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1a'));db[_0x8395('0x1b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1c'));db[_0x8395('0x1d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x1e'));db[_0x8395('0x1f')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceMail/voiceMail.model');db[_0x8395('0x20')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x21'));db['VoiceCallReport']=db[_0x8395('0x1')]['import'](_0x8395('0x22'));db[_0x8395('0x23')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x24'));db['VoiceAgentReport']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8395('0x25')]=db['sequelize'][_0x8395('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x8395('0x26')]=db['sequelize'][_0x8395('0x12')]('../api/memberReport/memberReport.model');db[_0x8395('0x27')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x28'));db[_0x8395('0x29')]=db[_0x8395('0x1')]['import'](_0x8395('0x2a'));db[_0x8395('0x2b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x2c'));db[_0x8395('0x2d')]=db[_0x8395('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8395('0x2e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x2f'));db[_0x8395('0x30')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x31'));db[_0x8395('0x32')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x33'));db[_0x8395('0x34')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x35'));db[_0x8395('0x36')]=db['sequelize']['import'](_0x8395('0x37'));db[_0x8395('0x38')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x39'));db['MailServerIn']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3a'));db[_0x8395('0x3b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3c'));db[_0x8395('0x3d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x3e'));db[_0x8395('0x3f')]=db[_0x8395('0x1')]['import'](_0x8395('0x40'));db['MailSubstatus']=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x8395('0x41')]=db['sequelize']['import'](_0x8395('0x42'));db['MailMessage']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x43'));db['MailApplication']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailApplication/mailApplication.model');db[_0x8395('0x44')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0x8395('0x45')]=db[_0x8395('0x1')]['import'](_0x8395('0x46'));db[_0x8395('0x47')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x48'));db['FaxAccount']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x49'));db[_0x8395('0x4a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x4b'));db[_0x8395('0x4c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x4d'));db[_0x8395('0x4e')]=db[_0x8395('0x1')]['import'](_0x8395('0x4f'));db[_0x8395('0x50')]=db['sequelize']['import'](_0x8395('0x51'));db['FaxQueueReport']=db[_0x8395('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x8395('0x52')]=db['sequelize'][_0x8395('0x12')]('../api/smsAccount/smsAccount.model');db[_0x8395('0x53')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x54'));db[_0x8395('0x55')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x56'));db[_0x8395('0x57')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x8395('0x58')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x59'));db[_0x8395('0x5a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5b'));db[_0x8395('0x5c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5d'));db[_0x8395('0x5e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x5f'));db[_0x8395('0x60')]=db[_0x8395('0x1')]['import'](_0x8395('0x61'));db['OpenchannelQueue']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x8395('0x62')]=db[_0x8395('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x8395('0x63')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x64'));db['ChatApplication']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x65'));db[_0x8395('0x66')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x67'));db[_0x8395('0x68')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x69'));db[_0x8395('0x6a')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x6b'));db['ChatQueue']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x6c'));db[_0x8395('0x6d')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/chatGroup/chatGroup.model');db[_0x8395('0x6e')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x8395('0x6f')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x70'));db['CmContact']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x71'));db[_0x8395('0x72')]=db[_0x8395('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x8395('0x73')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x74'));db[_0x8395('0x75')]=db[_0x8395('0x1')]['import'](_0x8395('0x76'));db[_0x8395('0x77')]=db[_0x8395('0x1')]['import'](_0x8395('0x78'));db[_0x8395('0x79')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x7a'));db[_0x8395('0x7b')]=db['sequelize']['import'](_0x8395('0x7c'));db['Action']=db['sequelize']['import'](_0x8395('0x7d'));db[_0x8395('0x7e')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x7f'));db[_0x8395('0x80')]=db[_0x8395('0x1')]['import'](_0x8395('0x81'));db[_0x8395('0x82')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x83'));db[_0x8395('0x84')]=db[_0x8395('0x1')]['import'](_0x8395('0x85'));db[_0x8395('0x86')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x8395('0x87')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x88'));db[_0x8395('0x89')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8a'));db[_0x8395('0x8b')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8c'));db[_0x8395('0x8d')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x8e'));db['Sound']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/sound/sound.model');db[_0x8395('0x8f')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x90'));db[_0x8395('0x91')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/contactItemType/contactItemType.model');db[_0x8395('0x92')]=db[_0x8395('0x1')]['import'](_0x8395('0x93'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x8395('0x12')](_0x8395('0x94'));db['Template']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x95'));db['Trigger']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x96'));db['Variable']=db[_0x8395('0x1')]['import'](_0x8395('0x97'));db[_0x8395('0x98')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x99'));db[_0x8395('0x9a')]=db['sequelize']['import'](_0x8395('0x9b'));db[_0x8395('0x9c')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x9d'));db[_0x8395('0x9e')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x9f'));db[_0x8395('0xa0')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xa1'));db[_0x8395('0xa2')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x8395('0x1')]['import'](_0x8395('0xa3'));db[_0x8395('0xa4')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xa5'));db[_0x8395('0xa6')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xa7'));db[_0x8395('0xa8')]=db['sequelize']['import'](_0x8395('0xa9'));db[_0x8395('0xaa')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xab'));db[_0x8395('0xac')]=db['sequelize'][_0x8395('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x8395('0xad')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xae'));db[_0x8395('0xaf')]=db['sequelize']['import'](_0x8395('0xb0'));db[_0x8395('0xb1')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb2'));db[_0x8395('0xb3')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x8395('0xb4')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb5'));db['ZohoConfiguration']=db['sequelize']['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x8395('0xb6')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xb7'));db['ZendeskAccount']=db[_0x8395('0x1')]['import'](_0x8395('0xb8'));db[_0x8395('0xb9')]=db[_0x8395('0x1')]['import'](_0x8395('0xba'));db[_0x8395('0xbb')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xbc'));db[_0x8395('0xbd')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xbe'));db['FreshdeskConfiguration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xbf'));db[_0x8395('0xc0')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8395('0xc1')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xc2'));db['VtigerConfiguration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xc3'));db[_0x8395('0xc4')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xc5'));db[_0x8395('0xc6')]=db[_0x8395('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8395('0xc7')]=db[_0x8395('0x1')]['import'](_0x8395('0xc8'));db[_0x8395('0xc9')]=db['sequelize']['import'](_0x8395('0xca'));db[_0x8395('0xcb')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xcc'));db['Dynamics365Configuration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xcd'));db['Dynamics365Field']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x8395('0xce')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xcf'));db[_0x8395('0xd0')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd1'));db['FreshsalesField']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd2'));db['Integration']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x99'));db[_0x8395('0xd3')]=db[_0x8395('0x1')]['import'](_0x8395('0xd4'));db[_0x8395('0xd5')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd6'));db[_0x8395('0xd7')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xd8'));db[_0x8395('0xd9')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xda'));db[_0x8395('0xdb')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xdc'));db['JscriptySessionReport']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8395('0xdd')]=db['sequelize'][_0x8395('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x8395('0xde')]=db[_0x8395('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x8395('0xdf')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xe0'));db[_0x8395('0xe1')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xe2'));db['Setting']=db['sequelize'][_0x8395('0x12')](_0x8395('0xe3'));db[_0x8395('0xe4')]=db['sequelize']['import'](_0x8395('0xe5'));db[_0x8395('0xe6')]=db['sequelize']['import'](_0x8395('0xe7'));db[_0x8395('0xe8')]=db[_0x8395('0x1')]['import'](_0x8395('0xe9'));db['SquareMessage']=db['sequelize'][_0x8395('0x12')](_0x8395('0xea'));db['Team']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xeb'));db[_0x8395('0xec')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xed'));db['Campaign']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xee'));db[_0x8395('0xef')]=db[_0x8395('0x1')]['import'](_0x8395('0xf0'));db[_0x8395('0xf1')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf2'));db['Plugin']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf3'));db[_0x8395('0xf4')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8395('0xf5')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf6'));db[_0x8395('0xf7')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xf8'));db[_0x8395('0xf9')]=db['sequelize']['import'](_0x8395('0xfa'));db['SmsTransferReport']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0xfb'));db['CmList']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x8395('0x1')][_0x8395('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x8395('0xfc')]=db['sequelize'][_0x8395('0x12')](_0x8395('0xfd'));db[_0x8395('0xfe')]=db[_0x8395('0x1')]['import'](_0x8395('0xff'));db[_0x8395('0x100')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x101'));db[_0x8395('0x102')]=db['sequelize']['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x8395('0x1')]['import'](_0x8395('0x103'));db['WhatsappApplication']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x104'));db[_0x8395('0x105')]=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x106'));db[_0x8395('0x107')]=db['sequelize']['import'](_0x8395('0x108'));db[_0x8395('0x109')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x10a'));db[_0x8395('0x10b')]=db[_0x8395('0x1')][_0x8395('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x8395('0x12')](_0x8395('0x10c'));db['CloudProvider']=db[_0x8395('0x1')]['import'](_0x8395('0x10d'));db['TeamVoiceQueue']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x10e'));db[_0x8395('0x10f')]=db[_0x8395('0x1')]['import'](_0x8395('0x110'));db['UserVoicePrefix']=db[_0x8395('0x1')][_0x8395('0x12')](_0x8395('0x111'));db[_0x8395('0x112')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x113'));db[_0x8395('0x114')]=db['sequelize'][_0x8395('0x12')](_0x8395('0x115'));db[_0x8395('0x11')][_0x8395('0x116')](db[_0x8395('0x1f')],{'as':_0x8395('0x1f'),'onDelete':_0x8395('0x117'),'foreignKey':'UserId'});db[_0x8395('0x11')][_0x8395('0x116')](db[_0x8395('0x112')],{'as':'userSetting','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x1b')],{'as':_0x8395('0x119'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['VoiceExtension'],{'as':_0x8395('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x75')],{'as':_0x8395('0x11c'),'foreignKey':'UserId'});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x77')],{'as':_0x8395('0x11d'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'foreignKey':'UserId'});db['User'][_0x8395('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8395('0x118')});db[_0x8395('0x11')]['hasMany'](db[_0x8395('0x55')],{'as':_0x8395('0x11f'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['FaxInteraction'],{'as':_0x8395('0x120'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x41')],{'as':_0x8395('0x121'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db['WhatsappInteraction'],{'as':_0x8395('0x122'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x102')],{'as':_0x8395('0x123'),'foreignKey':_0x8395('0x124')});db[_0x8395('0x11')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x8395('0x11')]['belongsTo'](db[_0x8395('0xfc')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x6d')],{'as':_0x8395('0x127'),'through':_0x8395('0x128')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x129')],{'as':_0x8395('0x12a'),'through':_0x8395('0x12b')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':'Lists','through':_0x8395('0x12d')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x12e')],{'through':'user_has_teams'});db['User'][_0x8395('0x126')](db['MailInteraction'],{'as':'MailInteractions','through':_0x8395('0x12f')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x66')],{'as':_0x8395('0x130'),'through':_0x8395('0x131')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x4c')],{'as':_0x8395('0x120'),'through':_0x8395('0x132')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x55')],{'as':_0x8395('0x11f'),'through':_0x8395('0x133')});db['User'][_0x8395('0x126')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'through':_0x8395('0x134')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x105')],{'as':_0x8395('0x122'),'through':_0x8395('0x135')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x19')],{'as':_0x8395('0x136'),'through':_0x8395('0x2d'),'required':![]});db['User'][_0x8395('0x126')](db[_0x8395('0x137')],{'as':'VoicePrefixes','through':_0x8395('0x138'),'required':![]});db['User'][_0x8395('0x126')](db['MailQueue'],{'as':_0x8395('0x139'),'through':_0x8395('0x30'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x13a')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8395('0x11')][_0x8395('0x126')](db['FaxQueue'],{'as':_0x8395('0x13b'),'through':_0x8395('0x32'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db['SmsQueue'],{'as':_0x8395('0x13c'),'through':_0x8395('0x34'),'required':![]});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x13d')],{'as':'OpenchannelQueues','through':_0x8395('0x36'),'required':![]});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x13e')],{'as':_0x8395('0x13f'),'through':_0x8395('0x38'),'required':![]});db['User'][_0x8395('0x126')](db[_0x8395('0x12c')],{'through':'cm_user_has_lists'});db['User'][_0x8395('0x126')](db['ChatWebsite'],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x140')],{'as':'FaxAccounts','through':_0x8395('0x141')});db['User'][_0x8395('0x126')](db['MailAccount'],{'as':_0x8395('0x142'),'through':_0x8395('0x143')});db[_0x8395('0x11')][_0x8395('0x126')](db[_0x8395('0x5a')],{'as':_0x8395('0x144'),'through':_0x8395('0x145')});db[_0x8395('0x11')]['belongsToMany'](db[_0x8395('0x52')],{'as':_0x8395('0x146'),'through':_0x8395('0x147')});db[_0x8395('0x11')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x8395('0x148'),'through':'user_has_whatsapp_accounts'});db[_0x8395('0x14')][_0x8395('0x11a')](db['VoiceExtension'],{'as':_0x8395('0x149'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x14a')});db[_0x8395('0x16')]['hasMany'](db[_0x8395('0x14b')],{'onDelete':_0x8395('0x117')});db[_0x8395('0x14b')][_0x8395('0x11a')](db[_0x8395('0x14b')],{'as':'Applications','onDelete':_0x8395('0x117')});db[_0x8395('0x18')][_0x8395('0x126')](db[_0x8395('0x14c')],{'as':_0x8395('0x14d'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x8395('0x11a')](db['UserVoiceQueueRt'],{'as':_0x8395('0x14e'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')][_0x8395('0x11a')](db['CmHopperFinal'],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')]['hasMany'](db[_0x8395('0x77')],{'as':_0x8395('0x150'),'foreignKey':_0x8395('0x14f')});db[_0x8395('0x19')]['hasMany'](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x14f')});db['VoiceQueue']['hasMany'](db[_0x8395('0x73')],{'as':_0x8395('0x151'),'foreignKey':'VoiceQueueId'});db[_0x8395('0x19')][_0x8395('0x11a')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x8395('0x19')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x27'),'foreignKey':_0x8395('0x152')});db[_0x8395('0x19')][_0x8395('0x153')](db[_0x8395('0x27')],{'as':_0x8395('0x154'),'foreignKey':_0x8395('0x155')});db[_0x8395('0x19')][_0x8395('0x153')](db[_0x8395('0x86')],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db['VoiceQueue']['belongsTo'](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8395('0x19')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':_0x8395('0x158'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x2d')});db['VoiceQueue'][_0x8395('0x126')](db[_0x8395('0x12e')],{'as':'Teams','through':_0x8395('0x15a')});db[_0x8395('0x19')][_0x8395('0x126')](db[_0x8395('0x12c')],{'as':_0x8395('0x15b'),'through':_0x8395('0x15c')});db[_0x8395('0x1b')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x1d')]['belongsTo'](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x1f')]['hasMany'](db[_0x8395('0x20')],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x15e'),'sourceKey':_0x8395('0x15f')});db[_0x8395('0x20')][_0x8395('0x153')](db['VoiceMail'],{'foreignKey':_0x8395('0x15e'),'targetKey':_0x8395('0x15f')});db['VoiceCallReport'][_0x8395('0x11a')](db[_0x8395('0x25')],{'as':_0x8395('0x160'),'foreignKey':'uniqueid','constraints':![]});db[_0x8395('0x161')][_0x8395('0x11a')](db[_0x8395('0x162')],{'as':_0x8395('0x163'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x11'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['MailServerIn'][_0x8395('0x153')](db[_0x8395('0x3d')],{'as':_0x8395('0x3d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x167')][_0x8395('0x153')](db[_0x8395('0x168')],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169'),'onDelete':_0x8395('0x16a')});db['MailServerOut']['belongsTo'](db[_0x8395('0x3d')],{'as':_0x8395('0x3d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x3b')]['belongsTo'](db['CloudProvider'],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x3d')][_0x8395('0x116')](db['MailServerIn'],{'as':_0x8395('0x16b'),'onDelete':'cascade'});db[_0x8395('0x3d')][_0x8395('0x116')](db[_0x8395('0x3b')],{'as':_0x8395('0x16c'),'onDelete':'cascade'});db[_0x8395('0x3d')]['hasMany'](db[_0x8395('0x82')],{'as':'Dispositions','foreignKey':_0x8395('0x166'),'onDelete':_0x8395('0x117')});db[_0x8395('0x3d')][_0x8395('0x11a')](db['CannedAnswer'],{'as':_0x8395('0x16d'),'foreignKey':_0x8395('0x166')});db[_0x8395('0x3d')][_0x8395('0x11a')](db[_0x8395('0x16e')],{'as':_0x8395('0x15d'),'foreignKey':'MailAccountId'});db[_0x8395('0x3d')][_0x8395('0x11a')](db['MailInteraction'],{'as':_0x8395('0x16f')});db[_0x8395('0x3d')]['hasMany'](db[_0x8395('0x170')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x166'),'onDelete':_0x8395('0x117')});db[_0x8395('0x3d')]['belongsTo'](db[_0x8395('0x12c')],{'as':'List','foreignKey':'ListId'});db[_0x8395('0x3d')][_0x8395('0x153')](db[_0x8395('0x172')],{'as':_0x8395('0x172'),'foreignKey':_0x8395('0x173')});db[_0x8395('0x3d')]['belongsTo'](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x3d')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x30')});db[_0x8395('0x3f')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':'team_has_mail_queues','as':_0x8395('0x175')});db[_0x8395('0x41')][_0x8395('0x11a')](db['MailMessage'],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x176')});db[_0x8395('0x41')][_0x8395('0x153')](db[_0x8395('0x3d')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x166')});db['MailInteraction'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x41')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x179'),'as':'Tags'});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x179'),'as':_0x8395('0x17a')});db[_0x8395('0x41')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':'Users','through':_0x8395('0x12f'),'foreignKey':_0x8395('0x176')});db[_0x8395('0x16e')][_0x8395('0x11a')](db[_0x8395('0xf1')],{'as':_0x8395('0x17b'),'onDelete':_0x8395('0x117')});db[_0x8395('0x16e')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'User'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x129')],{'onDelete':'cascade','as':_0x8395('0x164')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x3d')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x166')});db['MailMessage'][_0x8395('0x153')](db[_0x8395('0x62')],{'as':_0x8395('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x8395('0x16e')]['belongsTo'](db[_0x8395('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x8395('0x17c')});db['MailApplication']['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x170')]['belongsTo'](db['MailQueue'],{'onDelete':_0x8395('0x16a')});db['MailApplication'][_0x8395('0x153')](db[_0x8395('0x3d')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x170')]['belongsTo'](db['Interval'],{'onDelete':_0x8395('0x16a'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0x8395('0x8f')],{'onDelete':'restrict','foreignKey':_0x8395('0x17d')});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x3d')],{});db['MailQueueReport'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x44')]['belongsTo'](db[_0x8395('0x41')],{});db[_0x8395('0x44')]['belongsTo'](db[_0x8395('0x16e')],{});db[_0x8395('0x44')][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0x44')][_0x8395('0x153')](db['MailQueue'],{});db[_0x8395('0x45')][_0x8395('0x11a')](db[_0x8395('0x47')],{'as':_0x8395('0x180'),'onDelete':_0x8395('0x117')});db[_0x8395('0x140')]['hasMany'](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x182'),'onDelete':_0x8395('0x117')});db['FaxAccount'][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'FaxAccountId'});db[_0x8395('0x140')][_0x8395('0x11a')](db[_0x8395('0x4c')],{'as':_0x8395('0x16f')});db[_0x8395('0x140')]['hasMany'](db[_0x8395('0x4a')],{'as':'Applications','foreignKey':_0x8395('0x182'),'onDelete':'cascade'});db[_0x8395('0x140')][_0x8395('0x11a')](db[_0x8395('0x14b')],{'as':_0x8395('0x183'),'onDelete':'cascade'});db['FaxAccount'][_0x8395('0x11a')](db['FaxMessage'],{'as':'Messages'});db[_0x8395('0x140')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x27')});db[_0x8395('0x140')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db['FaxAccount'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x140')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x141')});db[_0x8395('0x4a')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x4a')][_0x8395('0x153')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0x8395('0x153')](db[_0x8395('0x140')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x4a')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x4c')][_0x8395('0x11a')](db['FaxMessage'],{'as':'Messages','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x184')});db[_0x8395('0x4c')]['belongsTo'](db['FaxAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x182')});db[_0x8395('0x4c')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x4c')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x4c')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x185'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x8395('0x8f')],{'through':'fax_interaction_has_tags','as':_0x8395('0x17a')});db['FaxInteraction'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':'User'});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x4c')],{'as':_0x8395('0x187'),'foreignKey':_0x8395('0x184')});db[_0x8395('0x4e')][_0x8395('0x153')](db['CmContact'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x4e')]['belongsTo'](db[_0x8395('0xf1')],{'as':_0x8395('0xf1'),'foreignKey':_0x8395('0x188')});db[_0x8395('0x4e')][_0x8395('0x153')](db[_0x8395('0x140')],{'as':'Account','foreignKey':_0x8395('0x182')});db[_0x8395('0x50')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x32')});db[_0x8395('0x50')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x189'),'as':_0x8395('0x175')});db[_0x8395('0x18a')][_0x8395('0x153')](db[_0x8395('0x140')],{});db[_0x8395('0x18a')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db['FaxQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x8395('0x165')});db[_0x8395('0x18a')]['belongsTo'](db[_0x8395('0x4c')],{});db['FaxQueueReport'][_0x8395('0x153')](db[_0x8395('0x4e')],{});db['FaxQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db['FaxQueueReport']['belongsTo'](db[_0x8395('0x50')],{});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':'Dispositions','foreignKey':_0x8395('0x18b'),'onDelete':'cascade'});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x57')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x52')][_0x8395('0x11a')](db[_0x8395('0x55')],{'as':_0x8395('0x16f')});db['SmsAccount'][_0x8395('0x11a')](db[_0x8395('0x53')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x18b'),'onDelete':_0x8395('0x117')});db[_0x8395('0x52')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f')});db[_0x8395('0x52')]['belongsTo'](db[_0x8395('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8395('0x52')][_0x8395('0x126')](db['User'],{'as':'Agents','through':_0x8395('0x147')});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':'restrict'});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x58')],{'onDelete':_0x8395('0x16a')});db['SmsApplication'][_0x8395('0x153')](db['SmsAccount'],{'onDelete':_0x8395('0x16a')});db['SmsApplication'][_0x8395('0x153')](db[_0x8395('0x86')],{'onDelete':'restrict','foreignKey':_0x8395('0x156')});db[_0x8395('0x53')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x55')][_0x8395('0x11a')](db[_0x8395('0x57')],{'as':_0x8395('0x15d'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x52')],{'as':'Account','foreignKey':_0x8395('0x18b')});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':'Contact','foreignKey':_0x8395('0x165')});db[_0x8395('0x55')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x55')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x18c'),'as':_0x8395('0x18d')});db[_0x8395('0x55')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':'sms_interaction_has_tags','as':_0x8395('0x17a')});db[_0x8395('0x55')]['belongsToMany'](db['User'],{'as':_0x8395('0x186'),'through':_0x8395('0x133'),'foreignKey':_0x8395('0x18e')});db[_0x8395('0x57')]['belongsTo'](db[_0x8395('0x11')],{'as':_0x8395('0x11')});db['SmsMessage'][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x57')][_0x8395('0x153')](db['SmsInteraction'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x187'),'foreignKey':_0x8395('0x18e')});db[_0x8395('0x57')][_0x8395('0x153')](db[_0x8395('0x52')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x18b')});db[_0x8395('0x58')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x8395('0x58')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x18f'),'as':_0x8395('0x175')});db[_0x8395('0x5a')]['hasMany'](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x190'),'onDelete':_0x8395('0x117')});db[_0x8395('0x5a')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x8395('0x5a')]['hasMany'](db[_0x8395('0x5e')],{'as':'Interactions','foreignKey':_0x8395('0x190')});db['OpenchannelAccount'][_0x8395('0x11a')](db[_0x8395('0x60')],{'as':_0x8395('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x8395('0x5a')][_0x8395('0x11a')](db[_0x8395('0x5c')],{'as':'Applications','foreignKey':_0x8395('0x190'),'onDelete':'cascade'});db[_0x8395('0x5a')][_0x8395('0x153')](db['CmList'],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x5a')][_0x8395('0x153')](db['Pause'],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x5a')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x13d')],{'onDelete':'restrict','foreignKey':_0x8395('0x191')});db[_0x8395('0x5c')][_0x8395('0x153')](db['OpenchannelAccount'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x190')});db[_0x8395('0x5c')][_0x8395('0x153')](db[_0x8395('0x86')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x156')});db['OpenchannelApplication'][_0x8395('0x153')](db['Tag'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db['OpenchannelInteraction'][_0x8395('0x11a')](db['OpenchannelMessage'],{'as':_0x8395('0x15d'),'onDelete':'cascade','foreignKey':_0x8395('0x192')});db[_0x8395('0x5e')]['belongsTo'](db[_0x8395('0x5a')],{'as':'Account','foreignKey':_0x8395('0x190')});db[_0x8395('0x5e')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x5e')][_0x8395('0x153')](db['User'],{'as':'Owner','foreignKey':_0x8395('0x118')});db[_0x8395('0x5e')]['belongsToMany'](db[_0x8395('0x8f')],{'through':_0x8395('0x193'),'as':_0x8395('0x18d')});db[_0x8395('0x5e')][_0x8395('0x126')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x8395('0x17a')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':'user_has_openchannel_interactions','foreignKey':_0x8395('0x192')});db['OpenchannelMessage'][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x11')});db[_0x8395('0x60')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x60')][_0x8395('0x153')](db[_0x8395('0x5e')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x187'),'foreignKey':'OpenchannelInteractionId'});db[_0x8395('0x60')][_0x8395('0x153')](db['Attachment'],{'as':'Attachment','foreignKey':_0x8395('0x188')});db[_0x8395('0x60')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x190')});db[_0x8395('0x13d')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x36'),'foreignKey':_0x8395('0x191')});db[_0x8395('0x13d')][_0x8395('0x126')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x8395('0x175')});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x194'),'onDelete':_0x8395('0x117')});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x6e')],{'as':_0x8395('0x195')});db[_0x8395('0x62')]['hasMany'](db[_0x8395('0x66')],{'as':'Interactions'});db[_0x8395('0x62')]['hasMany'](db[_0x8395('0x196')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x194'),'onDelete':'cascade'});db[_0x8395('0x62')][_0x8395('0x11a')](db[_0x8395('0x68')],{'as':_0x8395('0x15d')});db['ChatWebsite'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x62')]['belongsTo'](db[_0x8395('0x86')],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x62')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db['ChatWebsite'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x8395('0x159'),'through':_0x8395('0x197')});db[_0x8395('0x63')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['OpenchannelQueueReport'][_0x8395('0x153')](db[_0x8395('0x5e')],{});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x60')],{});db[_0x8395('0x63')][_0x8395('0x153')](db['User'],{});db[_0x8395('0x63')][_0x8395('0x153')](db[_0x8395('0x13d')],{});db[_0x8395('0x196')][_0x8395('0x153')](db['User'],{'as':_0x8395('0x198'),'foreignKey':_0x8395('0x118'),'onDelete':_0x8395('0x16a')});db['ChatApplication'][_0x8395('0x153')](db[_0x8395('0x13a')],{'as':_0x8395('0x199'),'foreignKey':_0x8395('0x19a'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x196')]['belongsTo'](db['ChatWebsite'],{'as':_0x8395('0x19b'),'foreignKey':_0x8395('0x194'),'onDelete':'restrict'});db['ChatApplication'][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db['ChatInteraction'][_0x8395('0x11a')](db['ChatMessage'],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x66')]['belongsTo'](db[_0x8395('0x62')],{'as':'Account','foreignKey':_0x8395('0x194')});db[_0x8395('0x66')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['ChatInteraction'][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x19d'),'as':_0x8395('0x18d')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x19d'),'as':_0x8395('0x17a')});db[_0x8395('0x66')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':_0x8395('0x131'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x68')]['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x11')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x66')],{'onDelete':'cascade','as':_0x8395('0x187'),'foreignKey':_0x8395('0x19c')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0xf1')],{'as':_0x8395('0xf1'),'foreignKey':_0x8395('0x188')});db[_0x8395('0x68')][_0x8395('0x153')](db[_0x8395('0x62')],{'as':'Account','foreignKey':_0x8395('0x194')});db[_0x8395('0x6a')][_0x8395('0x11a')](db[_0x8395('0xf1')],{'as':_0x8395('0x17b'),'foreignKey':_0x8395('0x17c'),'onDelete':_0x8395('0x117'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db['ChatOfflineMessage']['belongsTo'](db[_0x8395('0x62')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x194')});db[_0x8395('0x13a')][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x2e'),'hooks':!![]});db[_0x8395('0x13a')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x8395('0x6d')][_0x8395('0x11a')](db[_0x8395('0xd7')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x19e'),'onDelete':_0x8395('0x117')});db['ChatGroup'][_0x8395('0x126')](db['User'],{'as':_0x8395('0x14e'),'through':_0x8395('0x128')});db['ChatProactiveAction'][_0x8395('0x153')](db[_0x8395('0x62')],{'as':_0x8395('0x19b'),'foreignKey':_0x8395('0x194')});db[_0x8395('0x6f')][_0x8395('0x11a')](db[_0x8395('0x129')],{'as':'Contacts','foreignKey':_0x8395('0x19f')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x92')],{'as':'Phones','foreignKey':_0x8395('0x1a0')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':_0x8395('0x125'),'foreignKey':'ContactId'});db[_0x8395('0x129')][_0x8395('0x11a')](db['CmHopperFinal'],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x165')});db['CmContact'][_0x8395('0x11a')](db['CmHopperHistory'],{'as':_0x8395('0x150'),'foreignKey':'ContactId'});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':_0x8395('0x79'),'foreignKey':_0x8395('0x165')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x1a1')],{'as':_0x8395('0x1a2'),'foreignKey':_0x8395('0x165')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x5e')],{'as':_0x8395('0x11e'),'foreignKey':_0x8395('0x165'),'onDelete':'restrict'});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x66')],{'as':_0x8395('0x130'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')]['hasMany'](db['SmsInteraction'],{'as':_0x8395('0x11f'),'foreignKey':'ContactId','onDelete':_0x8395('0x16a')});db['CmContact'][_0x8395('0x11a')](db[_0x8395('0x4c')],{'as':_0x8395('0x120'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')][_0x8395('0x11a')](db[_0x8395('0x41')],{'as':_0x8395('0x121'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x16a')});db[_0x8395('0x129')][_0x8395('0x153')](db[_0x8395('0x6f')],{'as':'Company','foreignKey':_0x8395('0x19f')});db[_0x8395('0x129')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':'List','foreignKey':'ListId','onDelete':_0x8395('0x117')});db['CmContact'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x186'),'through':_0x8395('0x12b')});db[_0x8395('0x129')]['belongsToMany'](db[_0x8395('0x8f')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x8395('0x129')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1a3'),'as':'ThroughTags'});db[_0x8395('0x72')][_0x8395('0x11a')](db['CmHopperAdditionalPhone'],{'as':_0x8395('0x1a4'),'foreignKey':_0x8395('0x1a5')});db['CmHopper']['belongsTo'](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165'),'onDelete':_0x8395('0x117')});db[_0x8395('0x72')]['belongsTo'](db[_0x8395('0x12c')],{'as':'List','foreignKey':_0x8395('0x17f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x72')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'Agent','foreignKey':_0x8395('0x118')});db[_0x8395('0x72')][_0x8395('0x153')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x8395('0x14f'),'onDelete':'cascade'});db[_0x8395('0x72')][_0x8395('0x153')](db['Campaign'],{'as':_0x8395('0x1a6'),'foreignKey':'CampaignId','onDelete':_0x8395('0x117')});db[_0x8395('0x72')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x1a7')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId','onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':'ListId','onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db[_0x8395('0x19')],{'as':_0x8395('0x199'),'foreignKey':_0x8395('0x14f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x73')][_0x8395('0x153')](db['Campaign'],{'as':_0x8395('0x1a6'),'foreignKey':_0x8395('0x1a8'),'onDelete':_0x8395('0x117')});db[_0x8395('0x7e')][_0x8395('0x11a')](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1a9'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x8395('0x7e')]['hasMany'](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1aa'),'singular':_0x8395('0x1ab')},'foreignKey':'AutomationAnyId','onDelete':_0x8395('0x117'),'hooks':!![]});db['Automation'][_0x8395('0x11a')](db[_0x8395('0x1ac')],{'as':'Actions','foreignKey':_0x8395('0x1ad'),'onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x82')][_0x8395('0x11a')](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x1ae'),'onDelete':_0x8395('0x117')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x86')],{'as':_0x8395('0x1af'),'foreignKey':_0x8395('0x156'),'onDelete':_0x8395('0x117'),'hooks':!![],'required':![]});db[_0x8395('0x86')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x8395('0x156'),'onDelete':'restrict'});db[_0x8395('0x86')][_0x8395('0x11a')](db[_0x8395('0x170')],{'as':_0x8395('0x1b0'),'foreignKey':_0x8395('0x156')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x196')],{'as':_0x8395('0x1b1'),'foreignKey':_0x8395('0x156')});db['Interval'][_0x8395('0x11a')](db[_0x8395('0x4a')],{'as':_0x8395('0x1b2'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x86')][_0x8395('0x11a')](db[_0x8395('0x53')],{'as':_0x8395('0x1b3'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x8d')][_0x8395('0x153')](db[_0x8395('0x3d')],{});db[_0x8395('0x8d')][_0x8395('0x153')](db[_0x8395('0x9e')],{'foreignKey':_0x8395('0x1b4')});db['Schedule'][_0x8395('0x153')](db[_0x8395('0x9c')],{'foreignKey':_0x8395('0x1b5')});db[_0x8395('0x14c')]['belongsToMany'](db[_0x8395('0x18')],{'as':_0x8395('0x1b6'),'through':_0x8395('0x1b7'),'onDelete':'restrict'});db[_0x8395('0x8f')][_0x8395('0x126')](db['CmContact'],{'through':_0x8395('0x1a3')});db[_0x8395('0x8f')][_0x8395('0x126')](db['ChatInteraction'],{'through':_0x8395('0x19d')});db[_0x8395('0x8f')][_0x8395('0x126')](db[_0x8395('0x41')],{'through':_0x8395('0x179')});db[_0x8395('0x8f')][_0x8395('0x126')](db['SmsInteraction'],{'through':_0x8395('0x18c')});db[_0x8395('0x8f')][_0x8395('0x126')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x8395('0x8f')]['belongsToMany'](db[_0x8395('0x5e')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x8395('0x126')](db[_0x8395('0x105')],{'through':_0x8395('0x1b8')});db[_0x8395('0x92')]['belongsTo'](db[_0x8395('0x91')],{'as':_0x8395('0x1b9'),'foreignKey':_0x8395('0x1ba')});db[_0x8395('0x1bb')][_0x8395('0x153')](db[_0x8395('0x72')],{'as':_0x8395('0x1bc'),'foreignKey':_0x8395('0x1a5')});db[_0x8395('0x92')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x1a0')});db[_0x8395('0x1bd')]['hasMany'](db[_0x8395('0x84')],{'as':{'plural':_0x8395('0x1be'),'singular':_0x8395('0x1bf')},'foreignKey':'TriggerAllId','onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x1bd')][_0x8395('0x11a')](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x8395('0x1c0'),'onDelete':_0x8395('0x117'),'hooks':!![]});db[_0x8395('0x1bd')][_0x8395('0x11a')](db[_0x8395('0x1ac')],{'as':_0x8395('0x1c1'),'foreignKey':_0x8395('0x1c2'),'onDelete':_0x8395('0x117'),'hooks':!![]});db['AnalyticCustomReport'][_0x8395('0x11a')](db[_0x8395('0x1c3')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1b5'),'hooks':!![]});db[_0x8395('0x9e')]['hasMany'](db[_0x8395('0x1c3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8395('0x1b4')});db[_0x8395('0xa2')][_0x8395('0x11a')](db[_0x8395('0x1c3')],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c5')});db['AnalyticFieldReport'][_0x8395('0x153')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x8395('0xa6')][_0x8395('0x11a')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db['SalesforceConfiguration']['hasMany'](db[_0x8395('0xaa')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':'SubjectId'});db[_0x8395('0xa8')]['hasMany'](db[_0x8395('0xaa')],{'as':'Descriptions','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xa8')][_0x8395('0x11a')](db[_0x8395('0xaa')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xa8')][_0x8395('0x153')](db[_0x8395('0xa6')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db[_0x8395('0xaa')]['hasMany'](db[_0x8395('0xaa')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x8395('0x11a')](db[_0x8395('0xaa')],{'as':'Field','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xaa')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0xac')][_0x8395('0x11a')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x8395('0x11a')](db['SugarcrmField'],{'as':_0x8395('0x1c7'),'onDelete':'cascade','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xad')][_0x8395('0x11a')](db['SugarcrmField'],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db['SugarcrmConfiguration'][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xad')][_0x8395('0x153')](db[_0x8395('0xac')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xaf')]['hasMany'](db[_0x8395('0xaf')],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xaf')][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xaf')][_0x8395('0x11a')](db[_0x8395('0xaf')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xaf')]['belongsTo'](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['DeskAccount'][_0x8395('0x11a')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb3')][_0x8395('0x11a')](db['DeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8395('0x1ce')});db['DeskConfiguration'][_0x8395('0x11a')](db[_0x8395('0xb4')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb3')][_0x8395('0x11a')](db['DeskField'],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb3')]['belongsTo'](db[_0x8395('0xb1')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb3')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d1')});db[_0x8395('0xb4')][_0x8395('0x11a')](db['DeskField'],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xb4')][_0x8395('0x11a')](db[_0x8395('0xb4')],{'as':'Description','foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb4')]['hasMany'](db[_0x8395('0xb4')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb4')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db[_0x8395('0x1d2')][_0x8395('0x11a')](db[_0x8395('0x1d3')],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1d3')][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1d3')][_0x8395('0x11a')](db['ZohoField'],{'as':'Fields','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d3')][_0x8395('0x153')](db[_0x8395('0x1d2')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb6')]['hasMany'](db[_0x8395('0xb6')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db['ZohoField'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['ZohoField'][_0x8395('0x11a')](db[_0x8395('0xb6')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb6')][_0x8395('0x153')](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0x1d4')][_0x8395('0x11a')](db[_0x8395('0xb9')],{'as':'Configurations','onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xb9')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x8395('0x1ce')});db[_0x8395('0xb9')][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0xb9')][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':'Fields','foreignKey':_0x8395('0x1c9')});db[_0x8395('0xb9')][_0x8395('0x153')](db[_0x8395('0x1d4')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db['ZendeskConfiguration'][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d5')});db['ZendeskField']['hasMany'](db[_0x8395('0xbb')],{'as':'Subject','foreignKey':_0x8395('0x1ce')});db['ZendeskField'][_0x8395('0x11a')](db[_0x8395('0xbb')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['ZendeskField']['hasMany'](db[_0x8395('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0x8395('0xbb')][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db[_0x8395('0xbd')][_0x8395('0x11a')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1d6')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1c7'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1d6')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1cf'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c8')});db['FreshdeskConfiguration']['hasMany'](db[_0x8395('0xc0')],{'as':_0x8395('0x1c4'),'onDelete':'cascade','foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d6')][_0x8395('0x153')](db[_0x8395('0xbd')],{'as':_0x8395('0x177'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1d7')});db[_0x8395('0xc0')][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x8395('0x11a')](db[_0x8395('0xc0')],{'as':_0x8395('0x1d0'),'foreignKey':'FieldId'});db[_0x8395('0xc0')]['belongsTo'](db[_0x8395('0x1cc')],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['VtigerAccount'][_0x8395('0x11a')](db['VtigerConfiguration'],{'as':_0x8395('0x1d8'),'onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1d9')]['hasMany'](db[_0x8395('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x8395('0x1d9')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1d9')]['hasMany'](db[_0x8395('0xc4')],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1d9')]['belongsTo'](db[_0x8395('0xc1')],{'as':'Account','foreignKey':_0x8395('0x1c6')});db[_0x8395('0xc4')]['hasMany'](db[_0x8395('0xc4')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0xc4')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8395('0xc4')][_0x8395('0x11a')](db[_0x8395('0xc4')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xc4')][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['ServicenowAccount'][_0x8395('0x11a')](db[_0x8395('0xc7')],{'as':_0x8395('0x1d8'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c6')});db['ServicenowConfiguration']['hasMany'](db[_0x8395('0xc9')],{'as':_0x8395('0x1c7'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0xc7')][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1cf'),'foreignKey':_0x8395('0x1c8')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xc7')][_0x8395('0x153')](db[_0x8395('0xc6')],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x1c6')});db[_0x8395('0xc9')][_0x8395('0x11a')](db['ServicenowField'],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1cb'),'foreignKey':'DescriptionId'});db[_0x8395('0xc9')][_0x8395('0x11a')](db[_0x8395('0xc9')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db['ServicenowField'][_0x8395('0x153')](db['Variable'],{'as':_0x8395('0x1cc'),'foreignKey':_0x8395('0x1cd')});db['Dynamics365Account'][_0x8395('0x11a')](db[_0x8395('0x1da')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8395('0x1c6')});db[_0x8395('0xcb')]['belongsTo'](db['CloudProvider'],{'as':_0x8395('0x168'),'foreignKey':_0x8395('0x169')});db[_0x8395('0x1da')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x8395('0x117'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1da')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1c4'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1da')][_0x8395('0x153')](db[_0x8395('0xcb')],{'as':'Account','foreignKey':_0x8395('0x1c6')});db[_0x8395('0x1db')]['hasMany'](db[_0x8395('0x1db')],{'as':_0x8395('0x1ca'),'foreignKey':_0x8395('0x1ce')});db[_0x8395('0x1db')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db[_0x8395('0x1db')][_0x8395('0x11a')](db[_0x8395('0x1db')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db['Dynamics365Field']['belongsTo'](db[_0x8395('0x1cc')],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db[_0x8395('0xce')]['hasMany'](db[_0x8395('0xd0')],{'as':_0x8395('0x1d8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8395('0xd0')]['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1c7'),'foreignKey':'SubjectId'});db[_0x8395('0xd0')][_0x8395('0x11a')](db[_0x8395('0x1dc')],{'as':_0x8395('0x1cf'),'foreignKey':'DescriptionId'});db[_0x8395('0xd0')]['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1c4'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0xd0')]['belongsTo'](db[_0x8395('0xce')],{'as':_0x8395('0x177'),'foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1ca'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x8395('0x11a')](db[_0x8395('0x1dc')],{'as':_0x8395('0x1cb'),'foreignKey':_0x8395('0x1c8')});db['FreshsalesField']['hasMany'](db[_0x8395('0x1dc')],{'as':_0x8395('0x1d0'),'foreignKey':_0x8395('0x1c9')});db[_0x8395('0x1dc')][_0x8395('0x153')](db['Variable'],{'as':'Variable','foreignKey':_0x8395('0x1cd')});db['ChatQueueReport']['belongsTo'](db[_0x8395('0x62')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db['CmList'],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x66')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db[_0x8395('0x68')],{});db['ChatQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0xd5')][_0x8395('0x153')](db[_0x8395('0x13a')],{});db[_0x8395('0xd7')][_0x8395('0x153')](db['User'],{'onDelete':'cascade','foreignKey':_0x8395('0x1dd')});db[_0x8395('0xd7')]['belongsTo'](db[_0x8395('0x11')],{'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x1de')});db[_0x8395('0x1a1')]['hasMany'](db[_0x8395('0xdb')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0x8395('0x11a')](db[_0x8395('0xd9')],{'foreignKey':'SessionId','onDelete':_0x8395('0x117')});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsAccount'],{});db['SmsQueueReport'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db[_0x8395('0xdd')]['belongsTo'](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':_0x8395('0x165')});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsInteraction'],{});db[_0x8395('0xdd')][_0x8395('0x153')](db[_0x8395('0x57')],{});db[_0x8395('0xdd')][_0x8395('0x153')](db['User'],{});db[_0x8395('0xdd')][_0x8395('0x153')](db['SmsQueue'],{});db[_0x8395('0xe1')]['hasMany'](db[_0x8395('0x1a1')],{'foreignKey':'ProjectId'});db[_0x8395('0xe1')]['hasMany'](db[_0x8395('0xdb')],{'foreignKey':_0x8395('0x1df')});db[_0x8395('0xe1')][_0x8395('0x11a')](db[_0x8395('0xd9')],{'foreignKey':_0x8395('0x1df')});db['Team']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x1e0')});db[_0x8395('0x12e')]['belongsToMany'](db[_0x8395('0x19')],{'through':_0x8395('0x15a'),'as':_0x8395('0x136')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x3f')],{'through':_0x8395('0x1e1'),'as':_0x8395('0x139')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13a')],{'through':_0x8395('0x1e2'),'as':'ChatQueues'});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x50')],{'through':_0x8395('0x189'),'as':_0x8395('0x13b')});db[_0x8395('0x12e')]['belongsToMany'](db[_0x8395('0x58')],{'through':_0x8395('0x18f'),'as':_0x8395('0x13c')});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13d')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x8395('0x12e')][_0x8395('0x126')](db[_0x8395('0x13e')],{'through':_0x8395('0x1e3'),'as':'WhatsappQueues'});db['Team'][_0x8395('0x126')](db[_0x8395('0x137')],{'through':_0x8395('0x10f'),'as':_0x8395('0x1e4')});db['Campaign'][_0x8395('0x11a')](db[_0x8395('0x72')],{'as':'Hoppers','foreignKey':_0x8395('0x1a8')});db['Campaign']['hasMany'](db[_0x8395('0x75')],{'as':'HopperFinals','foreignKey':_0x8395('0x1a8')});db[_0x8395('0x1a6')]['hasMany'](db[_0x8395('0x77')],{'as':'HopperHistories','foreignKey':_0x8395('0x1a8')});db[_0x8395('0x1a6')][_0x8395('0x11a')](db[_0x8395('0x73')],{'as':_0x8395('0x151'),'foreignKey':'CampaignId'});db[_0x8395('0x1a6')]['belongsTo'](db[_0x8395('0x27')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x8395('0x1a6')]['belongsTo'](db[_0x8395('0x27')],{'as':_0x8395('0x154'),'foreignKey':_0x8395('0x155')});db[_0x8395('0x1a6')]['belongsTo'](db['Interval'],{'as':_0x8395('0x86'),'foreignKey':_0x8395('0x156')});db['Campaign'][_0x8395('0x153')](db['SquareProject'],{'as':_0x8395('0xe6'),'foreignKey':'SquareProjectId'});db[_0x8395('0x1a6')]['belongsToMany'](db[_0x8395('0x12c')],{'as':_0x8395('0x158'),'through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0x8395('0x12c')],{'as':'BlackLists','through':_0x8395('0x1e5')});db[_0x8395('0xf1')][_0x8395('0x153')](db[_0x8395('0x6a')],{'as':_0x8395('0x6a'),'foreignKey':_0x8395('0x17c')});db[_0x8395('0xf4')][_0x8395('0x153')](db['MailMessage'],{});db[_0x8395('0xf4')][_0x8395('0x153')](db[_0x8395('0x41')],{});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x3d')],{'foreignKey':'FromMailAccountId','as':_0x8395('0x1e6')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db['MailTransferReport'][_0x8395('0x153')](db[_0x8395('0x3f')],{'foreignKey':_0x8395('0x1eb'),'as':_0x8395('0x1ec')});db[_0x8395('0xf4')]['belongsTo'](db[_0x8395('0x3d')],{'foreignKey':_0x8395('0x1ed'),'as':_0x8395('0x1ee')});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x68')],{});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x66')],{});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x62')],{'foreignKey':_0x8395('0x1ef'),'as':'FromAccount'});db[_0x8395('0xf5')]['belongsTo'](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db[_0x8395('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db[_0x8395('0xf5')][_0x8395('0x153')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x8395('0xf5')][_0x8395('0x153')](db[_0x8395('0x62')],{'foreignKey':_0x8395('0x1f0'),'as':_0x8395('0x1ee')});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x4e')],{});db['FaxTransferReport'][_0x8395('0x153')](db[_0x8395('0x4c')],{});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x140')],{'foreignKey':'FromFaxAccountId','as':_0x8395('0x1e6')});db[_0x8395('0xf7')][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db[_0x8395('0xf7')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db[_0x8395('0xf7')]['belongsTo'](db[_0x8395('0x50')],{'foreignKey':_0x8395('0x1f1'),'as':_0x8395('0x1ec')});db[_0x8395('0xf7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8395('0x1f2'),'as':_0x8395('0x1ee')});db[_0x8395('0xf9')][_0x8395('0x153')](db['OpenchannelMessage'],{});db[_0x8395('0xf9')][_0x8395('0x153')](db[_0x8395('0x5e')],{});db[_0x8395('0xf9')][_0x8395('0x153')](db[_0x8395('0x5a')],{'foreignKey':_0x8395('0x1f3'),'as':_0x8395('0x1e6')});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x13d')],{'foreignKey':_0x8395('0x1f4'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x8395('0x153')](db[_0x8395('0x5a')],{'foreignKey':_0x8395('0x1f5'),'as':_0x8395('0x1ee')});db[_0x8395('0x1f6')][_0x8395('0x153')](db['SmsMessage'],{});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x55')],{});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x52')],{'foreignKey':_0x8395('0x1f7'),'as':_0x8395('0x1e6')});db['SmsTransferReport'][_0x8395('0x153')](db['User'],{'foreignKey':'FromUserId','as':_0x8395('0x1e8')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x11')],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x58')],{'foreignKey':_0x8395('0x1f8'),'as':_0x8395('0x1ec')});db[_0x8395('0x1f6')][_0x8395('0x153')](db[_0x8395('0x52')],{'foreignKey':'ToSmsAccountId','as':_0x8395('0x1ee')});db[_0x8395('0x12c')][_0x8395('0x11a')](db['Disposition'],{'as':_0x8395('0x181'),'foreignKey':_0x8395('0x17f'),'onDelete':_0x8395('0x117')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x7b')],{'as':'CustomFields','foreignKey':_0x8395('0x17f')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x129')],{'as':_0x8395('0x12a'),'onDelete':_0x8395('0x117'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x8395('0x75')],{'as':_0x8395('0x11c'),'foreignKey':_0x8395('0x17f')});db['CmList']['hasMany'](db[_0x8395('0x77')],{'as':'HopperHistory','foreignKey':_0x8395('0x17f')});db[_0x8395('0x12c')][_0x8395('0x11a')](db[_0x8395('0x79')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x8395('0x12c')][_0x8395('0x126')](db[_0x8395('0x19')],{'as':_0x8395('0x1f9'),'through':_0x8395('0x1fa')});db['CmList']['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x12d')});db[_0x8395('0x137')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x8395('0x137')]['belongsToMany'](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':_0x8395('0x138')});db[_0x8395('0x137')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x10f'),'as':'Teams'});db[_0x8395('0xfc')][_0x8395('0x11a')](db[_0x8395('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0x8395('0xfc')]['hasMany'](db[_0x8395('0xfe')],{'as':_0x8395('0x1fb'),'foreignKey':_0x8395('0x1fc'),'onDelete':_0x8395('0x117')});db[_0x8395('0xfe')]['hasMany'](db[_0x8395('0x100')],{'as':_0x8395('0x1fd'),'foreignKey':_0x8395('0x1fe'),'onDelete':'cascade'});db['WhatsappAccount'][_0x8395('0x11a')](db[_0x8395('0x82')],{'as':_0x8395('0x181'),'foreignKey':'WhatsappAccountId','onDelete':_0x8395('0x117')});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x80')],{'as':_0x8395('0x16d'),'foreignKey':'WhatsappAccountId'});db[_0x8395('0x1ff')][_0x8395('0x11a')](db[_0x8395('0x107')],{'as':_0x8395('0x15d'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x105')],{'as':'Interactions'});db[_0x8395('0x1ff')]['hasMany'](db[_0x8395('0x201')],{'as':_0x8395('0x171'),'foreignKey':_0x8395('0x200'),'onDelete':_0x8395('0x117')});db['WhatsappAccount'][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':_0x8395('0x17f')});db['WhatsappAccount'][_0x8395('0x153')](db[_0x8395('0x87')],{'as':_0x8395('0x157'),'foreignKey':_0x8395('0x174')});db[_0x8395('0x1ff')][_0x8395('0x126')](db['User'],{'as':_0x8395('0x159'),'through':_0x8395('0x202')});db['WhatsappApplication'][_0x8395('0x153')](db[_0x8395('0x11')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8395('0x153')](db[_0x8395('0x13e')],{'onDelete':_0x8395('0x16a')});db[_0x8395('0x201')][_0x8395('0x153')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x8395('0x201')][_0x8395('0x153')](db['Interval'],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x156')});db[_0x8395('0x201')][_0x8395('0x153')](db[_0x8395('0x8f')],{'onDelete':_0x8395('0x16a'),'foreignKey':_0x8395('0x17d')});db[_0x8395('0x105')]['hasMany'](db[_0x8395('0x107')],{'as':_0x8395('0x15d'),'onDelete':_0x8395('0x117'),'foreignKey':_0x8395('0x203')});db[_0x8395('0x105')]['belongsTo'](db['WhatsappAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x105')][_0x8395('0x153')](db[_0x8395('0x129')],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db[_0x8395('0x105')][_0x8395('0x153')](db['User'],{'as':_0x8395('0x178'),'foreignKey':_0x8395('0x118')});db[_0x8395('0x105')][_0x8395('0x126')](db['Tag'],{'through':_0x8395('0x1b8'),'as':'Tags'});db[_0x8395('0x105')][_0x8395('0x126')](db[_0x8395('0x8f')],{'through':_0x8395('0x1b8'),'as':_0x8395('0x17a')});db[_0x8395('0x105')][_0x8395('0x126')](db['User'],{'as':_0x8395('0x186'),'through':_0x8395('0x135'),'foreignKey':_0x8395('0x203')});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x11')],{'as':'User'});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x129')],{'onDelete':_0x8395('0x117'),'as':_0x8395('0x164')});db[_0x8395('0x107')][_0x8395('0x153')](db[_0x8395('0x105')],{'onDelete':_0x8395('0x117'),'as':'Interaction','foreignKey':_0x8395('0x203')});db[_0x8395('0x107')][_0x8395('0x153')](db['WhatsappAccount'],{'as':_0x8395('0x177'),'foreignKey':_0x8395('0x200')});db[_0x8395('0x109')][_0x8395('0x153')](db['WhatsappAccount'],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x12c')],{'as':_0x8395('0x17e'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x8395('0x153')](db['CmContact'],{'as':_0x8395('0x164'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x8395('0x153')](db[_0x8395('0x105')],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x13e')],{});db[_0x8395('0x109')][_0x8395('0x153')](db[_0x8395('0x107')],{});db['WhatsappQueueReport'][_0x8395('0x153')](db[_0x8395('0x11')],{});db[_0x8395('0x10b')][_0x8395('0x153')](db['WhatsappMessage'],{});db[_0x8395('0x10b')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x8395('0x10b')][_0x8395('0x153')](db[_0x8395('0x1ff')],{'foreignKey':_0x8395('0x204'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x8395('0x153')](db[_0x8395('0x1ff')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport'][_0x8395('0x153')](db[_0x8395('0x13e')],{'foreignKey':_0x8395('0x205'),'as':_0x8395('0x1ec')});db[_0x8395('0x10b')]['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e7'),'as':_0x8395('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8395('0x1e9'),'as':_0x8395('0x1ea')});db['WhatsappQueue'][_0x8395('0x126')](db[_0x8395('0x11')],{'as':_0x8395('0x159'),'through':'UserWhatsappQueue','foreignKey':_0x8395('0x206')});db[_0x8395('0x13e')][_0x8395('0x126')](db[_0x8395('0x12e')],{'through':_0x8395('0x1e3'),'as':_0x8395('0x175')});db[_0x8395('0x112')]['belongsTo'](db['User'],{'as':_0x8395('0x207'),'foreignKey':'UserId','onDelete':_0x8395('0x117'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x8395('0xcb')],{'as':_0x8395('0xcb'),'onDelete':'restrict'});db['CloudProvider'][_0x8395('0x116')](db[_0x8395('0x167')],{'as':_0x8395('0x16b'),'onDelete':_0x8395('0x16a')});db['CloudProvider'][_0x8395('0x116')](db[_0x8395('0x3b')],{'as':'Smtp','onDelete':_0x8395('0x16a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2ae69a3..afbc591 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6b0=['/api/cm/custom_fields','/api/actions','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/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/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./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/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./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/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','3.13.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','path','express','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_history','./api/cmHopperHistory'];(function(_0x1215cd,_0x35dc1f){var _0x52ecef=function(_0x51ac88){while(--_0x51ac88){_0x1215cd['push'](_0x1215cd['shift']());}};_0x52ecef(++_0x35dc1f);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x11bfdc,_0x5d1501){_0x11bfdc=_0x11bfdc-0x0;var _0x51b01b=_0xa6b0[_0x11bfdc];return _0x51b01b;};'use strict';var path=require(_0x0a6b('0x0'));var express=require(_0x0a6b('0x1'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x0a6b('0x2'))[_0x0a6b('0x3')];var clientSideLogs=require(_0x0a6b('0x4'));exports['default']=function(_0x29ff80){return setupLoggers(_0x29ff80)[_0x0a6b('0x5')](function(){_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x7'),require(_0x0a6b('0x8')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x9'),require(_0x0a6b('0xa')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb'),require(_0x0a6b('0xc')));_0x29ff80[_0x0a6b('0x6')]('/api/voice/extensions',require('./api/voiceExtension'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xd'),require(_0x0a6b('0xe')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf'),require(_0x0a6b('0x10')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x11'),require(_0x0a6b('0x12')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x13'),require(_0x0a6b('0x14')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x15'),require('./api/voiceMail'));_0x29ff80['use'](_0x0a6b('0x16'),require(_0x0a6b('0x17')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x18'),require(_0x0a6b('0x19')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x1a'),require(_0x0a6b('0x1b')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x1c'),require('./api/voiceAgentReport'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x1d'),require('./api/voiceQueueReport'));_0x29ff80[_0x0a6b('0x6')]('/api/members/reports',require(_0x0a6b('0x1e')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x1f'),require(_0x0a6b('0x20')));_0x29ff80['use'](_0x0a6b('0x21'),require(_0x0a6b('0x22')));_0x29ff80['use'](_0x0a6b('0x23'),require(_0x0a6b('0x24')));_0x29ff80[_0x0a6b('0x6')]('/api/mail/accounts',require(_0x0a6b('0x25')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x26'),require('./api/mailQueue'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x27'),require(_0x0a6b('0x28')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x29'),require('./api/mailInteraction'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x2a'),require(_0x0a6b('0x2b')));_0x29ff80['use'](_0x0a6b('0x2c'),require(_0x0a6b('0x2d')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x2e'),require(_0x0a6b('0x2f')));_0x29ff80['use'](_0x0a6b('0x30'),require(_0x0a6b('0x31')));_0x29ff80[_0x0a6b('0x6')]('/api/dashboards/items',require(_0x0a6b('0x32')));_0x29ff80['use'](_0x0a6b('0x33'),require(_0x0a6b('0x34')));_0x29ff80[_0x0a6b('0x6')]('/api/fax/applications',require('./api/faxApplication'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x35'),require(_0x0a6b('0x36')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x37'),require(_0x0a6b('0x38')));_0x29ff80['use'](_0x0a6b('0x39'),require(_0x0a6b('0x3a')));_0x29ff80['use'](_0x0a6b('0x3b'),require('./api/faxQueueReport'));_0x29ff80['use'](_0x0a6b('0x3c'),require(_0x0a6b('0x3d')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x3e'),require(_0x0a6b('0x3f')));_0x29ff80['use']('/api/sms/interactions',require(_0x0a6b('0x40')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x41'),require(_0x0a6b('0x42')));_0x29ff80['use'](_0x0a6b('0x43'),require(_0x0a6b('0x44')));_0x29ff80['use']('/api/openchannel/accounts',require(_0x0a6b('0x45')));_0x29ff80[_0x0a6b('0x6')]('/api/openchannel/applications',require(_0x0a6b('0x46')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x47'),require(_0x0a6b('0x48')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x49'),require(_0x0a6b('0x4a')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x4b'),require(_0x0a6b('0x4c')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x4d'),require('./api/chatWebsite'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x4e'),require('./api/openchannelQueueReport'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x4f'),require(_0x0a6b('0x50')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x51'),require(_0x0a6b('0x52')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x53'),require(_0x0a6b('0x54')));_0x29ff80['use'](_0x0a6b('0x55'),require(_0x0a6b('0x56')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x57'),require(_0x0a6b('0x58')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x59'),require(_0x0a6b('0x5a')));_0x29ff80[_0x0a6b('0x6')]('/api/chat/proactive_actions',require(_0x0a6b('0x5b')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x5c'),require(_0x0a6b('0x5d')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x5e'),require(_0x0a6b('0x5f')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x60'),require('./api/cmHopper'));_0x29ff80[_0x0a6b('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x29ff80[_0x0a6b('0x6')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x61'),require(_0x0a6b('0x62')));_0x29ff80['use'](_0x0a6b('0x63'),require('./api/cmCustomField'));_0x29ff80['use'](_0x0a6b('0x64'),require('./api/action'));_0x29ff80[_0x0a6b('0x6')]('/api/automations',require(_0x0a6b('0x65')));_0x29ff80['use']('/api/canned_answers',require(_0x0a6b('0x66')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x67'),require(_0x0a6b('0x68')));_0x29ff80['use'](_0x0a6b('0x69'),require(_0x0a6b('0x6a')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x6b'),require(_0x0a6b('0x6c')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x6d'),require('./api/pause'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x6e'),require(_0x0a6b('0x6f')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x70'),require(_0x0a6b('0x71')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x72'),require(_0x0a6b('0x73')));_0x29ff80['use'](_0x0a6b('0x74'),require(_0x0a6b('0x75')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x76'),require(_0x0a6b('0x77')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x78'),require('./api/contactItemType'));_0x29ff80['use'](_0x0a6b('0x79'),require(_0x0a6b('0x7a')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x7b'),require(_0x0a6b('0x7c')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x7d'),require(_0x0a6b('0x7e')));_0x29ff80[_0x0a6b('0x6')]('/api/triggers',require(_0x0a6b('0x7f')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x80'),require(_0x0a6b('0x81')));_0x29ff80[_0x0a6b('0x6')]('/api/integrations',require(_0x0a6b('0x82')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x83'),require(_0x0a6b('0x84')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x85'),require(_0x0a6b('0x86')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x87'),require(_0x0a6b('0x88')));_0x29ff80['use']('/api/analytics/extracted_reports',require(_0x0a6b('0x89')));_0x29ff80['use'](_0x0a6b('0x8a'),require('./api/analyticMetric'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x8b'),require(_0x0a6b('0x8c')));_0x29ff80['use'](_0x0a6b('0x8d'),require(_0x0a6b('0x8e')));_0x29ff80['use'](_0x0a6b('0x8f'),require('./api/intSalesforceAccount'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x90'),require('./api/intSalesforceConfiguration'));_0x29ff80[_0x0a6b('0x6')]('/api/integrations/salesforce/fields',require(_0x0a6b('0x91')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x92'),require('./api/intSugarcrmAccount'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x93'),require(_0x0a6b('0x94')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x95'),require(_0x0a6b('0x96')));_0x29ff80['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x29ff80[_0x0a6b('0x6')]('/api/integrations/desk/configurations',require(_0x0a6b('0x97')));_0x29ff80[_0x0a6b('0x6')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x29ff80['use'](_0x0a6b('0x98'),require(_0x0a6b('0x99')));_0x29ff80['use'](_0x0a6b('0x9a'),require(_0x0a6b('0x9b')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x9c'),require(_0x0a6b('0x9d')));_0x29ff80['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x9e'),require('./api/intZendeskConfiguration'));_0x29ff80[_0x0a6b('0x6')]('/api/integrations/zendesk/fields',require(_0x0a6b('0x9f')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xa0'),require(_0x0a6b('0xa1')));_0x29ff80[_0x0a6b('0x6')]('/api/integrations/freshdesk/configurations',require(_0x0a6b('0xa2')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xa3'),require(_0x0a6b('0xa4')));_0x29ff80['use'](_0x0a6b('0xa5'),require(_0x0a6b('0xa6')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xa7'),require(_0x0a6b('0xa8')));_0x29ff80['use'](_0x0a6b('0xa9'),require(_0x0a6b('0xaa')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xab'),require(_0x0a6b('0xac')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xad'),require(_0x0a6b('0xae')));_0x29ff80['use'](_0x0a6b('0xaf'),require(_0x0a6b('0xb0')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb1'),require('./api/intDynamics365Account'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb2'),require(_0x0a6b('0xb3')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb4'),require(_0x0a6b('0xb5')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb6'),require(_0x0a6b('0xb7')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xb8'),require(_0x0a6b('0xb9')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xba'),require(_0x0a6b('0xbb')));_0x29ff80['use']('/api/networks',require(_0x0a6b('0xbc')));_0x29ff80[_0x0a6b('0x6')]('/api/chat/reports/queue',require(_0x0a6b('0xbd')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xbe'),require(_0x0a6b('0xbf')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xc0'),require(_0x0a6b('0xc1')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xc2'),require(_0x0a6b('0xc3')));_0x29ff80[_0x0a6b('0x6')]('/api/jscripty/sessions/reports',require(_0x0a6b('0xc4')));_0x29ff80['use'](_0x0a6b('0xc5'),require(_0x0a6b('0xc6')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xc7'),require(_0x0a6b('0xc8')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xc9'),require('./api/squareReportDetail'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xca'),require(_0x0a6b('0xcb')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xcc'),require('./api/setting'));_0x29ff80[_0x0a6b('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xcd'),require(_0x0a6b('0xce')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xcf'),require(_0x0a6b('0xd0')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xd1'),require(_0x0a6b('0xd2')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xd3'),require(_0x0a6b('0xd4')));_0x29ff80['use'](_0x0a6b('0xd5'),require(_0x0a6b('0xd6')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xd7'),require('./api/campaign'));_0x29ff80[_0x0a6b('0x6')]('/api/migrations',require(_0x0a6b('0xd8')));_0x29ff80[_0x0a6b('0x6')]('/api/attachments',require('./api/attachment'));_0x29ff80[_0x0a6b('0x6')]('/api/plugins',require(_0x0a6b('0xd9')));_0x29ff80['use'](_0x0a6b('0xda'),require('./api/mailTransferReport'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xdb'),require('./api/chatTransferReport'));_0x29ff80['use'](_0x0a6b('0xdc'),require(_0x0a6b('0xdd')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xde'),require('./api/openchannelTransferReport'));_0x29ff80[_0x0a6b('0x6')]('/api/sms/reports/transfer',require(_0x0a6b('0xdf')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xe0'),require(_0x0a6b('0xe1')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xe2'),require(_0x0a6b('0xe3')));_0x29ff80[_0x0a6b('0x6')]('/api/userProfiles',require(_0x0a6b('0xe4')));_0x29ff80['use'](_0x0a6b('0xe5'),require(_0x0a6b('0xe6')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xe7'),require('./api/userProfileResource'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xe8'),require('./api/userNotification'));_0x29ff80[_0x0a6b('0x6')]('/api/whatsapp/accounts',require(_0x0a6b('0xe9')));_0x29ff80[_0x0a6b('0x6')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xea'),require('./api/whatsappInteraction'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xeb'),require('./api/whatsappMessage'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xec'),require(_0x0a6b('0xed')));_0x29ff80['use'](_0x0a6b('0xee'),require(_0x0a6b('0xef')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf0'),require('./api/whatsappQueue'));_0x29ff80[_0x0a6b('0x6')]('/api/cloudProviders',require('./api/cloudProvider'));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf1'),require(_0x0a6b('0xf2')));_0x29ff80[_0x0a6b('0x6')]('/api/user-settings',require(_0x0a6b('0xf3')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf4'),require(_0x0a6b('0xf5')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf6'),require(_0x0a6b('0xf7')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xf8'),require(_0x0a6b('0xf9')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0xfa'),require(_0x0a6b('0xfb')));_0x29ff80['use']('/api/jira',require(_0x0a6b('0xfc')));_0x29ff80['use'](_0x0a6b('0xfd'),require(_0x0a6b('0xfe')));_0x29ff80['use'](_0x0a6b('0xff'),require(_0x0a6b('0x100')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x101'),require('./api/system'));_0x29ff80[_0x0a6b('0x6')]('/api/pm2',require(_0x0a6b('0x102')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x103'),require(_0x0a6b('0x104')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x105'),clientSideLogs);_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x106'),express[_0x0a6b('0x107')](path[_0x0a6b('0x108')](config[_0x0a6b('0x109')],_0x0a6b('0x106'))));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x10a'),express['static'](path[_0x0a6b('0x108')](config[_0x0a6b('0x109')],'/www')));_0x29ff80[_0x0a6b('0x6')](_0x0a6b('0x10b'),express[_0x0a6b('0x107')](path['join'](config[_0x0a6b('0x109')],_0x0a6b('0x10b'))));_0x29ff80[_0x0a6b('0x6')]('/snippet',express[_0x0a6b('0x107')](path['join'](config[_0x0a6b('0x109')],'snippet',_0x0a6b('0x10c'))));_0x29ff80[_0x0a6b('0x6')]('/plugins',express['static'](path['join'](config[_0x0a6b('0x109')],_0x0a6b('0x10d'))));_0x29ff80[_0x0a6b('0x10e')](_0x0a6b('0x10f'))[_0x0a6b('0x110')](errors[0x194]);_0x29ff80[_0x0a6b('0x10e')]('/*')[_0x0a6b('0x110')](function(_0x4b9e79,_0x474342){_0x474342[_0x0a6b('0x111')](path['resolve'](_0x29ff80[_0x0a6b('0x110')]('appPath')+'/index.html'));});return _0x29ff80;});}; \ No newline at end of file +var _0x4bd3=['./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.13.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','use','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/sound','/api/tags','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./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/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields'];(function(_0x40be79,_0x389794){var _0x28537f=function(_0x40a702){while(--_0x40a702){_0x40be79['push'](_0x40be79['shift']());}};_0x28537f(++_0x389794);}(_0x4bd3,0x174));var _0x34bd=function(_0x3fa85d,_0x20e177){_0x3fa85d=_0x3fa85d-0x0;var _0x5e3d1a=_0x4bd3[_0x3fa85d];return _0x5e3d1a;};'use strict';var path=require(_0x34bd('0x0'));var express=require('express');var errors=require(_0x34bd('0x1'));var config=require(_0x34bd('0x2'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x34bd('0x3')]=function(_0x44854a){return setupLoggers(_0x44854a)[_0x34bd('0x4')](function(){_0x44854a['use'](_0x34bd('0x5'),require(_0x34bd('0x6')));_0x44854a['use'](_0x34bd('0x7'),require(_0x34bd('0x8')));_0x44854a['use'](_0x34bd('0x9'),require(_0x34bd('0xa')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc'),require(_0x34bd('0xd')));_0x44854a[_0x34bd('0xb')]('/api/voice/mohs',require(_0x34bd('0xe')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf'),require(_0x34bd('0x10')));_0x44854a['use']('/api/voice/recordings',require(_0x34bd('0x11')));_0x44854a['use']('/api/screen/recordings',require(_0x34bd('0x12')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x13'),require(_0x34bd('0x14')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x15'),require(_0x34bd('0x16')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x17'),require('./api/voiceCallReport'));_0x44854a[_0x34bd('0xb')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x18'),require(_0x34bd('0x19')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1a'),require(_0x34bd('0x1b')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1c'),require(_0x34bd('0x1d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1e'),require('./api/trunk'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x1f'),require(_0x34bd('0x20')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x21'),require(_0x34bd('0x22')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x23'),require(_0x34bd('0x24')));_0x44854a['use'](_0x34bd('0x25'),require(_0x34bd('0x26')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x27'),require(_0x34bd('0x28')));_0x44854a['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x44854a['use'](_0x34bd('0x29'),require('./api/mailMessage'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2a'),require(_0x34bd('0x2b')));_0x44854a['use'](_0x34bd('0x2c'),require(_0x34bd('0x2d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2e'),require('./api/dashboard'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x2f'),require(_0x34bd('0x30')));_0x44854a[_0x34bd('0xb')]('/api/fax/accounts',require(_0x34bd('0x31')));_0x44854a[_0x34bd('0xb')]('/api/fax/applications',require(_0x34bd('0x32')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x33'),require(_0x34bd('0x34')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x35'),require(_0x34bd('0x36')));_0x44854a['use'](_0x34bd('0x37'),require(_0x34bd('0x38')));_0x44854a['use']('/api/fax/reports/queue',require(_0x34bd('0x39')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3a'),require('./api/smsAccount'));_0x44854a['use'](_0x34bd('0x3b'),require(_0x34bd('0x3c')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3d'),require('./api/smsInteraction'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x3e'),require(_0x34bd('0x3f')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x40'),require(_0x34bd('0x41')));_0x44854a['use'](_0x34bd('0x42'),require('./api/openchannelAccount'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x43'),require(_0x34bd('0x44')));_0x44854a['use'](_0x34bd('0x45'),require(_0x34bd('0x46')));_0x44854a['use'](_0x34bd('0x47'),require(_0x34bd('0x48')));_0x44854a[_0x34bd('0xb')]('/api/openchannel/queues',require(_0x34bd('0x49')));_0x44854a[_0x34bd('0xb')]('/api/chat/websites',require(_0x34bd('0x4a')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4b'),require(_0x34bd('0x4c')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4d'),require('./api/chatApplication'));_0x44854a['use']('/api/chat/interactions',require(_0x34bd('0x4e')));_0x44854a[_0x34bd('0xb')]('/api/chat/messages',require('./api/chatMessage'));_0x44854a[_0x34bd('0xb')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x4f'),require(_0x34bd('0x50')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x51'),require('./api/chatGroup'));_0x44854a['use'](_0x34bd('0x52'),require('./api/chatProactiveAction'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x53'),require(_0x34bd('0x54')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x55'),require('./api/cmContact'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x56'),require(_0x34bd('0x57')));_0x44854a[_0x34bd('0xb')]('/api/cm/hopper_black',require(_0x34bd('0x58')));_0x44854a['use'](_0x34bd('0x59'),require(_0x34bd('0x5a')));_0x44854a['use'](_0x34bd('0x5b'),require('./api/cmHopperHistory'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x5c'),require(_0x34bd('0x5d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x5e'),require(_0x34bd('0x5f')));_0x44854a[_0x34bd('0xb')]('/api/automations',require('./api/automation'));_0x44854a['use'](_0x34bd('0x60'),require(_0x34bd('0x61')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x62'),require('./api/disposition'));_0x44854a[_0x34bd('0xb')](_0x34bd('0x63'),require(_0x34bd('0x64')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x65'),require('./api/interval'));_0x44854a[_0x34bd('0xb')]('/api/pauses',require('./api/pause'));_0x44854a[_0x34bd('0xb')]('/api/cdr',require(_0x34bd('0x66')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x67'),require(_0x34bd('0x68')));_0x44854a[_0x34bd('0xb')]('/api/schedules',require('./api/schedule'));_0x44854a[_0x34bd('0xb')]('/api/sounds',require(_0x34bd('0x69')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x6a'),require('./api/tag'));_0x44854a['use']('/api/contact_item_types',require('./api/contactItemType'));_0x44854a[_0x34bd('0xb')]('/api/cm_contact_has_items',require(_0x34bd('0x6b')));_0x44854a['use'](_0x34bd('0x6c'),require(_0x34bd('0x6d')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x6e'),require(_0x34bd('0x6f')));_0x44854a['use'](_0x34bd('0x70'),require(_0x34bd('0x71')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x72'),require(_0x34bd('0x73')));_0x44854a['use'](_0x34bd('0x74'),require(_0x34bd('0x75')));_0x44854a['use'](_0x34bd('0x76'),require(_0x34bd('0x77')));_0x44854a['use']('/api/analytics/custom_reports',require(_0x34bd('0x78')));_0x44854a['use']('/api/analytics/default_reports',require(_0x34bd('0x79')));_0x44854a[_0x34bd('0xb')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x44854a['use']('/api/analytics/metrics',require(_0x34bd('0x7a')));_0x44854a[_0x34bd('0xb')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x44854a['use'](_0x34bd('0x7b'),require(_0x34bd('0x7c')));_0x44854a['use'](_0x34bd('0x7d'),require(_0x34bd('0x7e')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x7f'),require(_0x34bd('0x80')));_0x44854a[_0x34bd('0xb')]('/api/integrations/salesforce/fields',require(_0x34bd('0x81')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x82'),require(_0x34bd('0x83')));_0x44854a['use'](_0x34bd('0x84'),require('./api/intSugarcrmConfiguration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/sugarcrm/fields',require(_0x34bd('0x85')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x86'),require(_0x34bd('0x87')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x88'),require(_0x34bd('0x89')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x8a'),require(_0x34bd('0x8b')));_0x44854a[_0x34bd('0xb')]('/api/integrations/zoho/accounts',require(_0x34bd('0x8c')));_0x44854a['use'](_0x34bd('0x8d'),require('./api/intZohoConfiguration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/zoho/fields',require(_0x34bd('0x8e')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x8f'),require(_0x34bd('0x90')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x91'),require(_0x34bd('0x92')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x93'),require(_0x34bd('0x94')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x95'),require(_0x34bd('0x96')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x97'),require('./api/intFreshdeskConfiguration'));_0x44854a['use'](_0x34bd('0x98'),require(_0x34bd('0x99')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x9a'),require(_0x34bd('0x9b')));_0x44854a['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x44854a['use'](_0x34bd('0x9c'),require(_0x34bd('0x9d')));_0x44854a['use'](_0x34bd('0x9e'),require(_0x34bd('0x9f')));_0x44854a[_0x34bd('0xb')]('/api/integrations/servicenow/configurations',require(_0x34bd('0xa0')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa1'),require(_0x34bd('0xa2')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa3'),require(_0x34bd('0xa4')));_0x44854a[_0x34bd('0xb')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x44854a[_0x34bd('0xb')]('/api/integrations/dynamics365/fields',require(_0x34bd('0xa5')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa6'),require('./api/intFreshsalesAccount'));_0x44854a['use'](_0x34bd('0xa7'),require(_0x34bd('0xa8')));_0x44854a[_0x34bd('0xb')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xa9'),require(_0x34bd('0xaa')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xab'),require(_0x34bd('0xac')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xad'),require(_0x34bd('0xae')));_0x44854a['use']('/api/jscripty/answers/reports',require(_0x34bd('0xaf')));_0x44854a['use'](_0x34bd('0xb0'),require(_0x34bd('0xb1')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xb2'),require('./api/jscriptySessionReport'));_0x44854a['use'](_0x34bd('0xb3'),require(_0x34bd('0xb4')));_0x44854a[_0x34bd('0xb')]('/api/square/reports',require(_0x34bd('0xb5')));_0x44854a['use'](_0x34bd('0xb6'),require(_0x34bd('0xb7')));_0x44854a[_0x34bd('0xb')]('/api/jscripty/projects',require(_0x34bd('0xb8')));_0x44854a['use']('/api/settings',require(_0x34bd('0xb9')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xba'),require('./api/squareOdbc'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xbb'),require(_0x34bd('0xbc')));_0x44854a['use'](_0x34bd('0xbd'),require(_0x34bd('0xbe')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xbf'),require(_0x34bd('0xc0')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc1'),require(_0x34bd('0xc2')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc3'),require(_0x34bd('0xc4')));_0x44854a['use'](_0x34bd('0xc5'),require('./api/campaign'));_0x44854a[_0x34bd('0xb')]('/api/migrations',require(_0x34bd('0xc6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc7'),require(_0x34bd('0xc8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xc9'),require(_0x34bd('0xca')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xcb'),require(_0x34bd('0xcc')));_0x44854a['use']('/api/chat/reports/transfer',require(_0x34bd('0xcd')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xce'),require('./api/faxTransferReport'));_0x44854a['use']('/api/openchannel/reports/transfer',require(_0x34bd('0xcf')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xd0'),require(_0x34bd('0xd1')));_0x44854a[_0x34bd('0xb')]('/api/cm/lists',require(_0x34bd('0xd2')));_0x44854a['use'](_0x34bd('0xd3'),require(_0x34bd('0xd4')));_0x44854a['use'](_0x34bd('0xd5'),require('./api/userProfile'));_0x44854a[_0x34bd('0xb')]('/api/userProfile/sections',require(_0x34bd('0xd6')));_0x44854a['use'](_0x34bd('0xd7'),require(_0x34bd('0xd8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xd9'),require(_0x34bd('0xda')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xdb'),require(_0x34bd('0xdc')));_0x44854a['use'](_0x34bd('0xdd'),require(_0x34bd('0xde')));_0x44854a[_0x34bd('0xb')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x44854a['use'](_0x34bd('0xdf'),require(_0x34bd('0xe0')));_0x44854a['use'](_0x34bd('0xe1'),require('./api/whatsappQueueReport'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe2'),require(_0x34bd('0xe3')));_0x44854a['use'](_0x34bd('0xe4'),require('./api/whatsappQueue'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe5'),require(_0x34bd('0xe6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe7'),require(_0x34bd('0xe8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xe9'),require(_0x34bd('0xea')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xeb'),require(_0x34bd('0xec')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xed'),require('./api/authLocal'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xee'),require(_0x34bd('0xef')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf0'),require('./api/authActiveDirectory'));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf1'),require(_0x34bd('0xf2')));_0x44854a[_0x34bd('0xb')]('/api/rpc',require(_0x34bd('0xf3')));_0x44854a['use']('/api/version',require('./api/version'));_0x44854a['use'](_0x34bd('0xf4'),require(_0x34bd('0xf5')));_0x44854a[_0x34bd('0xb')]('/api/pm2',require(_0x34bd('0xf6')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf7'),require(_0x34bd('0xf8')));_0x44854a[_0x34bd('0xb')](_0x34bd('0xf9'),clientSideLogs);_0x44854a[_0x34bd('0xb')](_0x34bd('0xfa'),express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],'/apidoc')));_0x44854a['use'](_0x34bd('0xfe'),express['static'](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],_0x34bd('0xfe'))));_0x44854a[_0x34bd('0xb')](_0x34bd('0xff'),express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],'/demo')));_0x44854a[_0x34bd('0xb')](_0x34bd('0x100'),express[_0x34bd('0xfb')](path['join'](config[_0x34bd('0xfd')],_0x34bd('0x101'),_0x34bd('0x102'))));_0x44854a[_0x34bd('0xb')]('/plugins',express[_0x34bd('0xfb')](path[_0x34bd('0xfc')](config[_0x34bd('0xfd')],_0x34bd('0x103'))));_0x44854a[_0x34bd('0x104')](_0x34bd('0x105'))[_0x34bd('0x106')](errors[0x194]);_0x44854a[_0x34bd('0x104')]('/*')[_0x34bd('0x106')](function(_0x3b95f6,_0x4b4347){_0x4b4347[_0x34bd('0x107')](path[_0x34bd('0x108')](_0x44854a[_0x34bd('0x106')](_0x34bd('0x109'))+_0x34bd('0x10a')));});return _0x44854a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8d093c5..13290d2 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8be5=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','../config/triggers','default','jayson/promise','lodash','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x27dbdd,_0x1ef352){var _0xd544a9=function(_0x84c293){while(--_0x84c293){_0x27dbdd['push'](_0x27dbdd['shift']());}};_0xd544a9(++_0x1ef352);}(_0x8be5,0x191));var _0x58be=function(_0x20fced,_0x26ea15){_0x20fced=_0x20fced-0x0;var _0x3c2268=_0x8be5[_0x20fced];return _0x3c2268;};'use strict';var jayson=require(_0x58be('0x0'));var _=require(_0x58be('0x1'));var config=require('../config/environment');exports[_0x58be('0x2')]=function(){return new Promise(function(_0xed543,_0x4cc0dc){var _0x574370={};_0x574370=_['merge'](_0x574370,require('../api/user/user.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/voiceExtension/voiceExtension.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x4')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x5')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x6')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x7')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x8')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x9')));_0x574370=_['merge'](_0x574370,require(_0x58be('0xa')));_0x574370=_['merge'](_0x574370,require(_0x58be('0xb')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0xc')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x574370=_['merge'](_0x574370,require(_0x58be('0xd')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0xe')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0xf')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x10')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/mailMessage/mailMessage.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x11')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x12')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/faxAccount/faxAccount.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x13')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x14')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x15')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x16')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x17')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x18')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x19')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x1a')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x1b')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x1c')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x1d')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x1e')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x1f')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/chatInteraction/chatInteraction.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x20')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x21')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x22')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x23')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x24')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x25')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x26')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x27')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x28')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x29')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x2a')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x2b')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x2c')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x2d')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/variable/variable.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x2e')));_0x574370=_['merge'](_0x574370,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x574370=_['merge'](_0x574370,require(_0x58be('0x2f')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x30')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x31')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x32')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x33')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x34')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x35')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x36')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x37')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/squareOdbc/squareOdbc.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x38')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x39')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x3a')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x3b')));_0x574370=_['merge'](_0x574370,require('../api/attachment/attachment.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/plugin/plugin.rpc'));_0x574370=_['merge'](_0x574370,require(_0x58be('0x3c')));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x3d')));_0x574370=_[_0x58be('0x3')](_0x574370,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x574370=_[_0x58be('0x3')](_0x574370,require(_0x58be('0x3e')));_0x574370=_['merge'](_0x574370,require(_0x58be('0x3f')));var _0x16b85a=jayson[_0x58be('0x40')](_0x574370)['http']();var _0x298e6c=config[_0x58be('0x41')]['port']||config[_0x58be('0x42')]+0x1;var _0x2e6384=config[_0x58be('0x41')]['ip']||_0x58be('0x43');_0x16b85a['on'](_0x58be('0x44'),function(_0xeb9617){return _0x4cc0dc(_0xeb9617);});_0x16b85a[_0x58be('0x2')](_0x298e6c,_0x2e6384,function(){console[_0x58be('0x45')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2e6384,_0x298e6c);require(_0x58be('0x46'))[_0x58be('0x47')]();return _0xed543('RPC\x20listening\x20on\x20'+_0x2e6384+':'+_0x298e6c);});});}; \ No newline at end of file +var _0xc550=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.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/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.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/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0xd7e057,_0xd71681){var _0x4f8e85=function(_0x24f7c8){while(--_0x24f7c8){_0xd7e057['push'](_0xd7e057['shift']());}};_0x4f8e85(++_0xd71681);}(_0xc550,0x1f2));var _0x0c55=function(_0x58fe86,_0x19655f){_0x58fe86=_0x58fe86-0x0;var _0x3f0732=_0xc550[_0x58fe86];return _0x3f0732;};'use strict';var jayson=require(_0x0c55('0x0'));var _=require(_0x0c55('0x1'));var config=require(_0x0c55('0x2'));exports['listen']=function(){return new Promise(function(_0x5620e4,_0x242b88){var _0x524e00={};_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x4')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/voiceExtension/voiceExtension.rpc'));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x5')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x6')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x7')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x8')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x9')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xa')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/memberReport/memberReport.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xb')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xc')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xd')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0xe')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0xf')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x10')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x11')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x12')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x13')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x14')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/faxAccount/faxAccount.rpc'));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x15')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x16')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x17')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/faxQueue/faxQueue.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x18')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x19')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1a')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1c')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1d')));_0x524e00=_['merge'](_0x524e00,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1e')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x1f')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x20')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/chatInteraction/chatInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x21')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x22')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x23')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x24')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x25')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x26')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x27')));_0x524e00=_['merge'](_0x524e00,require('../api/interval/interval.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x28')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x29')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/template/template.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/trigger/trigger.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/variable/variable.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2a')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x2b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x524e00=_['merge'](_0x524e00,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2c')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x2d')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2e')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x2f')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x30')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x31')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/squareReport/squareReport.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x32')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x33')));_0x524e00=_['merge'](_0x524e00,require(_0x0c55('0x34')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x35')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x36')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x37')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x38')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/attachment/attachment.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x39')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3a')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3b')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3c')));_0x524e00=_[_0x0c55('0x3')](_0x524e00,require(_0x0c55('0x3d')));var _0x4f5a29=jayson['server'](_0x524e00)[_0x0c55('0x3e')]();var _0x2afcb9=config[_0x0c55('0x3f')][_0x0c55('0x40')]||config['port']+0x1;var _0x965084=config[_0x0c55('0x3f')]['ip']||_0x0c55('0x41');_0x4f5a29['on'](_0x0c55('0x42'),function(_0x4d95c1){return _0x242b88(_0x4d95c1);});_0x4f5a29[_0x0c55('0x43')](_0x2afcb9,_0x965084,function(){console[_0x0c55('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x965084,_0x2afcb9);require(_0x0c55('0x45'))[_0x0c55('0x46')]();return _0x5620e4(_0x0c55('0x47')+_0x965084+':'+_0x2afcb9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 220e55a..5baa2a1 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 _0x179d=['E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','answer','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','startsWith','split','match','error','emit','code','close'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x179d,0x85));var _0xd179=function(_0x127d51,_0x3d2160){_0x127d51=_0x127d51-0x0;var _0x2eb69e=_0x179d[_0x127d51];return _0x2eb69e;};'use strict';var util=require('util');var _=require(_0xd179('0x0'));var EventEmitter=require(_0xd179('0x1'))[_0xd179('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xd179('0x3'));function AGIChannel(_0x491297){var _0x595fd6=this,_0x3f667f=new AGIReply(),_0x45aab8=![],_0x3dcc18={};EventEmitter[_0xd179('0x4')](_0x595fd6);_0x491297[_0xd179('0x5')](_0xd179('0x6'));_0x491297[_0xd179('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3f667f[_0xd179('0x5')](_0xd179('0x6'));_0x3f667f['on'](_0xd179('0x8'),function(_0x1eeb07){for(var _0x3bafa5 in _0x1eeb07){_0x595fd6[_0x3bafa5]=_0x1eeb07[_0x3bafa5];}_0x595fd6['emit'](_0xd179('0x9'));});_0x3f667f['on'](_0xd179('0xa'),function(_0x5519f4){if(_0x5519f4[_0xd179('0xb')]()==_0xd179('0xc')){_0x595fd6['emit']('hangup');return;}if(_0x5519f4['substring'](0x0,0xb)==_0xd179('0xd')){_0x45aab8=!![];}if(_0x45aab8){_0x3dcc18['rx']+=_0x5519f4+'\x0a';if(_0x5519f4['search'](_0xd179('0xe'))!=-0x1){_0x45aab8=![];}}else{_0x3dcc18['rx']=_0x5519f4;}if(_0x45aab8){return;}if(typeof _0x3dcc18['cb']==_0xd179('0xf')){var _0x35c1e2=_0x3dcc18['rx'][_0xd179('0x10')](0x0,0x3),_0x3392f7=null,_0xdb90c3=null;_0x35c1e2=parseInt(_0x35c1e2);if(isNaN(_0x35c1e2)){_0x3dcc18['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd179('0x11')});return;}if(_0x35c1e2!=0xc8){_0x3dcc18['cb'](null,{'code':_0x35c1e2,'result':-0x1,'extra':'KO'});return;}_0x3392f7=_0x3dcc18['rx']['substring'](0x4)[_0xd179('0x12')](_0xd179('0x13'),'');if(_0x3392f7['indexOf']('\x20')!=-0x1){_0x3392f7=_0x3392f7['substr'](0x0,_0x3392f7['indexOf']('\x20'));}if(_[_0xd179('0x14')](_0x3392f7,'-1')){_0x3392f7=parseInt(_0x3392f7);}_0xdb90c3=_0x3dcc18['rx'][_0xd179('0x15')]('\x20');if(_0xdb90c3['length']==0x3){_0xdb90c3=_0xdb90c3[0x2][_0xd179('0x10')](0x1,_0xdb90c3[0x2]['length']-0x1);}else if(_0xdb90c3['length']>0x3){var _0x386d2e=/\((.+)\)/;var _0x1fa3c2=_0x3dcc18['rx'][_0xd179('0x16')](_0x386d2e);if(_0x1fa3c2){_0xdb90c3=_0x1fa3c2[0x1];}else{_0xdb90c3=null;}}else{_0xdb90c3=null;}_0x3dcc18['cb'](null,{'code':_0x35c1e2,'result':_0x3392f7,'extra':_0xdb90c3});}});_0x491297['on'](_0xd179('0x17'),function(_0x283faf){_0x595fd6[_0xd179('0x18')](_0xd179('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x283faf[_0xd179('0x19')]));});_0x491297['on'](_0xd179('0x1a'),function(){_0x595fd6[_0xd179('0x18')](_0xd179('0x1a'),new AGIError(_0xd179('0x1b')));});_0x491297['on']('timeout',function(){_0x595fd6[_0xd179('0x18')]('timeout',new AGIError(_0xd179('0x1c')));_0x491297[_0xd179('0x1d')]();});_0x491297[_0xd179('0x1e')](_0x3f667f);this[_0xd179('0x1f')]=function(_0x2fee98,_0x1ebe0f){var _0x2fee98=_0x2fee98||'',_0x1ebe0f=typeof _0x1ebe0f==_0xd179('0xf')?_0x1ebe0f:new Function();_0x3dcc18={'tx':_0x2fee98,'rx':'','cb':_0x1ebe0f};_0x491297[_0xd179('0x20')](_0x2fee98+'\x0a');},this[_0xd179('0x1a')]=function(){_0x491297[_0xd179('0x1d')]();};}util[_0xd179('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xd179('0x22')]=function(_0x1a85eb){return this[_0xd179('0x1f')][_0xd179('0x23')](this,_0x1a85eb);};AGIChannel['prototype'][_0xd179('0x24')]=function(){return this[_0xd179('0x22')](_0xd179('0x25'));};AGIChannel[_0xd179('0x26')][_0xd179('0x27')]=function(_0x5bb0f0,_0x45dbcc,_0x5b5d58){_0x5bb0f0=_0x5bb0f0===undefined?_0xd179('0x28'):_0x5bb0f0;_0x45dbcc=_0x45dbcc===undefined?'5':_0x45dbcc;_0x5b5d58=_0x5b5d58===undefined?'1':_0x5b5d58;return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x2a'),_0x5bb0f0,_0x45dbcc*0x3e8,_0x5b5d58));};AGIChannel[_0xd179('0x26')][_0xd179('0x2b')]=function(_0x4e9311){_0x4e9311=_0x4e9311||_0xd179('0x2c');return this[_0xd179('0x22')](util['format']('VERBOSE\x20\x22%s\x22',_0x4e9311));};AGIChannel[_0xd179('0x26')][_0xd179('0x2d')]=function(_0x2fa825,_0x30961c){if(_[_0xd179('0x2e')](_0x30961c)){return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x2f'),_0x2fa825,_0x30961c[_0xd179('0x30')](',')));}return this[_0xd179('0x22')](util[_0xd179('0x29')]('EXEC\x20%s\x20%s',_0x2fa825,_0x30961c));};AGIChannel['prototype'][_0xd179('0x31')]=function(_0x538bbc){return this[_0xd179('0x22')](util['format'](_0xd179('0x32'),_0x538bbc));};AGIChannel[_0xd179('0x26')]['setExtension']=function(_0x3468b6){return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x33'),_0x3468b6));};AGIChannel['prototype'][_0xd179('0x34')]=function(_0xb5f627){return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x35'),_0xb5f627));};AGIChannel[_0xd179('0x26')]['hangup']=function(){return this[_0xd179('0x22')](_0xd179('0x36'));};AGIChannel['prototype'][_0xd179('0x37')]=function(_0x268e23,_0x5a98ca){var _0x34010a=_[_0xd179('0x38')](_0x5a98ca)||_[_0xd179('0x39')](_0x5a98ca)?_0x5a98ca[_0xd179('0x3a')]():_0x5a98ca;return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x3b'),_0x268e23,_0x34010a?_0x34010a['toString']()[_0xd179('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x59b0f8,_0x2399a1){return this[_0xd179('0x22')](util['format'](_0xd179('0x3c'),_0x59b0f8,_0x2399a1));};AGIChannel[_0xd179('0x26')][_0xd179('0x3d')]=function(_0x1b5717,_0x395053){return this[_0xd179('0x22')](util['format'](_0xd179('0x3e'),_0x1b5717,_0x395053));};AGIChannel[_0xd179('0x26')][_0xd179('0x3f')]=function(_0x323748,_0x24de09){return this[_0xd179('0x22')](util[_0xd179('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x323748,_0x24de09));};AGIChannel[_0xd179('0x26')][_0xd179('0x40')]=function(_0x21ee3e,_0x3250c0,_0x530801){_0x3250c0=_0x3250c0||this[_0xd179('0x41')];_0x530801=_0x530801||0x1;this[_0xd179('0x31')](_0x21ee3e);this['setExtension'](_0x3250c0);this[_0xd179('0x34')](_0x530801);return this['noop'](util[_0xd179('0x29')](_0xd179('0x42'),_0x21ee3e,_0x3250c0,_0x530801));};AGIChannel[_0xd179('0x26')][_0xd179('0x43')]=function(_0x204483){return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x44'),_0x204483));};AGIChannel[_0xd179('0x26')][_0xd179('0x45')]=function(_0x341e68,_0x15c586,_0x135b05,_0x59d3f4,_0x4a1ffb,_0x970085){_0x15c586=_0x15c586||_0xd179('0x46');_0x135b05=_0x135b05||'';_0x59d3f4=_0x59d3f4===undefined?-0x1:_0x59d3f4==='-1'?-0x1:_0x59d3f4*0x3e8;_0x4a1ffb=_0x4a1ffb===undefined?'':'s='+_0x4a1ffb;_0x970085=_0x970085?_0xd179('0x47'):'';return this[_0xd179('0x22')](util[_0xd179('0x29')](_0xd179('0x48'),_0x341e68,_0x15c586,_0x135b05,_0x59d3f4,_0x970085,_0x4a1ffb));};AGIChannel[_0xd179('0x26')][_0xd179('0x49')]=function(_0x38698b,_0x342f3d){_0x342f3d=_0x342f3d||'';return this[_0xd179('0x22')](util['format'](_0xd179('0x4a'),_0x38698b,_0x342f3d));};AGIChannel[_0xd179('0x26')][_0xd179('0x4b')]=function(_0x15ec5d){return this['exec']('AGI',_0x15ec5d);};AGIChannel[_0xd179('0x26')]['wait']=function(_0x5b8c5b){return this[_0xd179('0x2d')](_0xd179('0x4c'),_0x5b8c5b);};AGIChannel[_0xd179('0x26')][_0xd179('0x17')]=function(_0x5d7485,_0x4a4b26){this[_0xd179('0x2b')](util[_0xd179('0x29')](_0xd179('0x4d'),_0x5d7485['id'],_0x5d7485[_0xd179('0x4e')],_0x4a4b26));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xd179('0x4f')]=AGIChannel; \ No newline at end of file +var _0xf9f9=['setEncoding','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','sendRequest','sync','answer','prototype','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout'];(function(_0x55cdc5,_0x2b2297){var _0x29acd5=function(_0x405234){while(--_0x405234){_0x55cdc5['push'](_0x55cdc5['shift']());}};_0x29acd5(++_0x2b2297);}(_0xf9f9,0x16f));var _0x9f9f=function(_0x22ad6c,_0x32fe9f){_0x22ad6c=_0x22ad6c-0x0;var _0x1dc229=_0xf9f9[_0x22ad6c];return _0x1dc229;};'use strict';var util=require('util');var _=require(_0x9f9f('0x0'));var EventEmitter=require(_0x9f9f('0x1'))[_0x9f9f('0x2')];var AGIReply=require(_0x9f9f('0x3'));var AGIError=require(_0x9f9f('0x4'));function AGIChannel(_0x739f32){var _0x1d8be4=this,_0x424d97=new AGIReply(),_0x34c695=![],_0x4480d5={};EventEmitter[_0x9f9f('0x5')](_0x1d8be4);_0x739f32['setEncoding'](_0x9f9f('0x6'));_0x739f32[_0x9f9f('0x7')](0x8*0x3c*0x3c*0x3e8);_0x424d97[_0x9f9f('0x8')]('utf8');_0x424d97['on'](_0x9f9f('0x9'),function(_0x3ae152){for(var _0xbccdf4 in _0x3ae152){_0x1d8be4[_0xbccdf4]=_0x3ae152[_0xbccdf4];}_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0xb'));});_0x424d97['on'](_0x9f9f('0xc'),function(_0x4ee109){if(_0x4ee109['toLowerCase']()==_0x9f9f('0xd')){_0x1d8be4['emit'](_0x9f9f('0xd'));return;}if(_0x4ee109[_0x9f9f('0xe')](0x0,0xb)==_0x9f9f('0xf')){_0x34c695=!![];}if(_0x34c695){_0x4480d5['rx']+=_0x4ee109+'\x0a';if(_0x4ee109[_0x9f9f('0x10')](_0x9f9f('0x11'))!=-0x1){_0x34c695=![];}}else{_0x4480d5['rx']=_0x4ee109;}if(_0x34c695){return;}if(typeof _0x4480d5['cb']==_0x9f9f('0x12')){var _0x56b0f6=_0x4480d5['rx'][_0x9f9f('0xe')](0x0,0x3),_0xf3a834=null,_0x552379=null;_0x56b0f6=parseInt(_0x56b0f6);if(isNaN(_0x56b0f6)){_0x4480d5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x56b0f6!=0xc8){_0x4480d5['cb'](null,{'code':_0x56b0f6,'result':-0x1,'extra':'KO'});return;}_0xf3a834=_0x4480d5['rx']['substring'](0x4)[_0x9f9f('0x13')](_0x9f9f('0x14'),'');if(_0xf3a834[_0x9f9f('0x15')]('\x20')!=-0x1){_0xf3a834=_0xf3a834[_0x9f9f('0x16')](0x0,_0xf3a834[_0x9f9f('0x15')]('\x20'));}if(_[_0x9f9f('0x17')](_0xf3a834,'-1')){_0xf3a834=parseInt(_0xf3a834);}_0x552379=_0x4480d5['rx']['split']('\x20');if(_0x552379[_0x9f9f('0x18')]==0x3){_0x552379=_0x552379[0x2]['substring'](0x1,_0x552379[0x2][_0x9f9f('0x18')]-0x1);}else if(_0x552379[_0x9f9f('0x18')]>0x3){var _0x161525=/\((.+)\)/;var _0x1c9065=_0x4480d5['rx'][_0x9f9f('0x19')](_0x161525);if(_0x1c9065){_0x552379=_0x1c9065[0x1];}else{_0x552379=null;}}else{_0x552379=null;}_0x4480d5['cb'](null,{'code':_0x56b0f6,'result':_0xf3a834,'extra':_0x552379});}});_0x739f32['on'](_0x9f9f('0x1a'),function(_0x1fa920){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x1fa920[_0x9f9f('0x1b')]));});_0x739f32['on'](_0x9f9f('0x1c'),function(){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1c'),new AGIError(_0x9f9f('0x1d')));});_0x739f32['on'](_0x9f9f('0x1e'),function(){_0x1d8be4[_0x9f9f('0xa')](_0x9f9f('0x1e'),new AGIError(_0x9f9f('0x1f')));_0x739f32[_0x9f9f('0x20')]();});_0x739f32['pipe'](_0x424d97);this[_0x9f9f('0x21')]=function(_0x35a0be,_0xda50d3){var _0x35a0be=_0x35a0be||'',_0xda50d3=typeof _0xda50d3=='function'?_0xda50d3:new Function();_0x4480d5={'tx':_0x35a0be,'rx':'','cb':_0xda50d3};_0x739f32[_0x9f9f('0x22')](_0x35a0be+'\x0a');},this[_0x9f9f('0x1c')]=function(){_0x739f32['destroy']();};}util[_0x9f9f('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x9f9f('0x24')]=function(_0x55bcec){return this['command'][_0x9f9f('0x25')](this,_0x55bcec);};AGIChannel['prototype'][_0x9f9f('0x26')]=function(){return this[_0x9f9f('0x24')]('ANSWER');};AGIChannel[_0x9f9f('0x27')]['getData']=function(_0x40c53d,_0x577865,_0x43577b){_0x40c53d=_0x40c53d===undefined?'beep':_0x40c53d;_0x577865=_0x577865===undefined?'5':_0x577865;_0x43577b=_0x43577b===undefined?'1':_0x43577b;return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x29'),_0x40c53d,_0x577865*0x3e8,_0x43577b));};AGIChannel['prototype']['noop']=function(_0x2d2589){_0x2d2589=_0x2d2589||_0x9f9f('0x2a');return this[_0x9f9f('0x24')](util['format'](_0x9f9f('0x2b'),_0x2d2589));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x2c')]=function(_0x5cf66b,_0x286672){if(_[_0x9f9f('0x2d')](_0x286672)){return this['sendRequest'](util[_0x9f9f('0x28')](_0x9f9f('0x2e'),_0x5cf66b,_0x286672[_0x9f9f('0x2f')](',')));}return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')]('EXEC\x20%s\x20%s',_0x5cf66b,_0x286672));};AGIChannel['prototype'][_0x9f9f('0x30')]=function(_0x556a03){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x31'),_0x556a03));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x32')]=function(_0x347701){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x33'),_0x347701));};AGIChannel['prototype'][_0x9f9f('0x34')]=function(_0x35d56b){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x35'),_0x35d56b));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0xd')]=function(){return this[_0x9f9f('0x24')](_0x9f9f('0x36'));};AGIChannel['prototype'][_0x9f9f('0x37')]=function(_0x1f5aa7,_0x576e38){var _0x4ad749=_[_0x9f9f('0x38')](_0x576e38)||_[_0x9f9f('0x39')](_0x576e38)?_0x576e38[_0x9f9f('0x3a')]():_0x576e38;return this[_0x9f9f('0x24')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1f5aa7,_0x4ad749?_0x4ad749[_0x9f9f('0x3a')]()[_0x9f9f('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x3b')]=function(_0x458040,_0x2becd0){return this[_0x9f9f('0x24')](util['format'](_0x9f9f('0x3c'),_0x458040,_0x2becd0));};AGIChannel[_0x9f9f('0x27')]['sayDigits']=function(_0x27d236,_0x486f60){return this[_0x9f9f('0x24')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x27d236,_0x486f60));};AGIChannel['prototype']['sayPhonetic']=function(_0x38a2e6,_0x53c3e0){return this[_0x9f9f('0x24')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x38a2e6,_0x53c3e0));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x3d')]=function(_0x3a6fb7,_0x5422a4,_0x1808f0){_0x5422a4=_0x5422a4||this[_0x9f9f('0x3e')];_0x1808f0=_0x1808f0||0x1;this[_0x9f9f('0x30')](_0x3a6fb7);this[_0x9f9f('0x32')](_0x5422a4);this[_0x9f9f('0x34')](_0x1808f0);return this[_0x9f9f('0x3f')](util[_0x9f9f('0x28')](_0x9f9f('0x40'),_0x3a6fb7,_0x5422a4,_0x1808f0));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x41')]=function(_0x3449ba){return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3449ba));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x42')]=function(_0xd5dba2,_0x5d0bc0,_0x5a648b,_0x53c678,_0x150e71,_0x128367){_0x5d0bc0=_0x5d0bc0||_0x9f9f('0x43');_0x5a648b=_0x5a648b||'';_0x53c678=_0x53c678===undefined?-0x1:_0x53c678==='-1'?-0x1:_0x53c678*0x3e8;_0x150e71=_0x150e71===undefined?'':'s='+_0x150e71;_0x128367=_0x128367?_0x9f9f('0x44'):'';return this[_0x9f9f('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xd5dba2,_0x5d0bc0,_0x5a648b,_0x53c678,_0x128367,_0x150e71));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x45')]=function(_0x12a074,_0x7dec45){_0x7dec45=_0x7dec45||'';return this[_0x9f9f('0x24')](util[_0x9f9f('0x28')](_0x9f9f('0x46'),_0x12a074,_0x7dec45));};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x47')]=function(_0x2004b3){return this['exec'](_0x9f9f('0x48'),_0x2004b3);};AGIChannel[_0x9f9f('0x27')]['wait']=function(_0x47281a){return this[_0x9f9f('0x2c')](_0x9f9f('0x49'),_0x47281a);};AGIChannel[_0x9f9f('0x27')][_0x9f9f('0x1a')]=function(_0x17ff5e,_0x3e5de5){this['noop'](util[_0x9f9f('0x28')](_0x9f9f('0x4a'),_0x17ff5e['id'],_0x17ff5e['label'],_0x3e5de5));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 c30629e..8e78759 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 _0x56c9=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x167772,_0x4fcaea){var _0xcbc80e=function(_0x1bf907){while(--_0x1bf907){_0x167772['push'](_0x167772['shift']());}};_0xcbc80e(++_0x4fcaea);}(_0x56c9,0x134));var _0x956c=function(_0x40ef2e,_0x104fef){_0x40ef2e=_0x40ef2e-0x0;var _0x23ad4c=_0x56c9[_0x40ef2e];return _0x23ad4c;};'use strict';var util=require(_0x956c('0x0'));var error={'E_AGI_UNDEFINED':_0x956c('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x956c('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x956c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x956c('0x4'),'E_AGI_SOCKET_ERROR':_0x956c('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x956c('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x956c('0x7'),'E_AGI_IVR_ENTRY':_0x956c('0x8')};function AGIError(_0x16c2ea){var _0x16c2ea=_0x16c2ea||null,_0x4464ee=_0x4464ee||[],_0x597257=0x1,_0x42962f='';if(!error[_0x16c2ea]){_0x16c2ea='E_AGI_UNDEFINED';}_0x4464ee[_0x956c('0x9')](error[_0x16c2ea]);while(arguments[_0x597257]){_0x4464ee[_0x956c('0x9')](arguments[_0x597257]);_0x597257++;}_0x42962f=util[_0x956c('0xa')][_0x956c('0xb')](util,_0x4464ee);this[_0x956c('0xc')]=_0x42962f;this['name']=_0x16c2ea;}module['exports']=AGIError; \ No newline at end of file +var _0xeb8e=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','name','util','Undefined\x20error.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4b9afb,_0x438bef){var _0x3397f7=function(_0x21997e){while(--_0x21997e){_0x4b9afb['push'](_0x4b9afb['shift']());}};_0x3397f7(++_0x438bef);}(_0xeb8e,0x89));var _0xeeb8=function(_0x52f7fc,_0x3868ec){_0x52f7fc=_0x52f7fc-0x0;var _0x4926df=_0xeb8e[_0x52f7fc];return _0x4926df;};'use strict';var util=require(_0xeeb8('0x0'));var error={'E_AGI_UNDEFINED':_0xeeb8('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xeeb8('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xeeb8('0x3'),'E_AGI_SOCKET_TIMEOUT':_0xeeb8('0x4'),'E_AGI_COMMAND_EMPTY':_0xeeb8('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xeeb8('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3b1373){var _0x3b1373=_0x3b1373||null,_0x17ce91=_0x17ce91||[],_0x562f75=0x1,_0x547df3='';if(!error[_0x3b1373]){_0x3b1373=_0xeeb8('0x7');}_0x17ce91[_0xeeb8('0x8')](error[_0x3b1373]);while(arguments[_0x562f75]){_0x17ce91[_0xeeb8('0x8')](arguments[_0x562f75]);_0x562f75++;}_0x547df3=util['format'][_0xeeb8('0x9')](util,_0x17ce91);this['message']=_0x547df3;this[_0xeeb8('0xa')]=_0x3b1373;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d914952..196a3f0 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 _0x360a=['E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','subscribe','agi','emit','error'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x360a,0x1c4));var _0xa360=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x360a[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xa360('0x0'));var EventEmitter=require(_0xa360('0x1'))[_0xa360('0x2')];var Redis=require(_0xa360('0x3'));var AGIError=require(_0xa360('0x4'));var config=require('../../config/environment');config[_0xa360('0x5')]=_[_0xa360('0x6')](config[_0xa360('0x5')],{'host':_0xa360('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa360('0x5')]);sub[_0xa360('0x8')](_0xa360('0x9'),function(_0x18aaaa){if(_0x18aaaa)return eventEmitter[_0xa360('0xa')](_0xa360('0xb'),new AGIError(_0xa360('0xc'),_0x18aaaa));});sub['on'](_0xa360('0xd'),function(_0x5398fd,_0x47bb1e){if(_0x5398fd!=='agi')return;try{var _0x208f5b=JSON[_0xa360('0xe')](_0x47bb1e);eventEmitter[_0xa360('0xa')](_0xa360('0xf'),_0x208f5b);}catch(_0x176913){eventEmitter[_0xa360('0xa')]('error',new AGIError(_0xa360('0xc'),_0x176913));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x993e=['EventEmitter','ioredis','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','E_AGI_SERVER_ERROR','exports'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x993e,0x1ba));var _0xe993=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x993e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xe993('0x0')];var Redis=require(_0xe993('0x1'));var AGIError=require('./error');var config=require('../../config/environment');config[_0xe993('0x2')]=_[_0xe993('0x3')](config[_0xe993('0x2')],{'host':_0xe993('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe993('0x2')]);sub[_0xe993('0x5')](_0xe993('0x6'),function(_0x194e68){if(_0x194e68)return eventEmitter[_0xe993('0x7')](_0xe993('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x194e68));});sub['on'](_0xe993('0x9'),function(_0x1e4b3d,_0x50c0b8){if(_0x1e4b3d!==_0xe993('0x6'))return;try{var _0x4134e4=JSON[_0xe993('0xa')](_0x50c0b8);eventEmitter[_0xe993('0x7')]('projectUpdate',_0x4134e4);}catch(_0x3e9513){eventEmitter[_0xe993('0x7')]('error',new AGIError(_0xe993('0xb'),_0x3e9513));}});module[_0xe993('0xc')]={'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 ff9d681..6e0d31f 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 _0x4864=['getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4864,0x10c));var _0x4486=function(_0x923991,_0x481465){_0x923991=_0x923991-0x0;var _0x191cfc=_0x4864[_0x923991];return _0x191cfc;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x4486('0x0'));var verticesWithRetry=[_0x4486('0x1'),_0x4486('0x2'),_0x4486('0x3')];var Graph=function(){this[_0x4486('0x4')]={};this[_0x4486('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x4486('0x6')][_0x4486('0x7')]=function(_0x4fbedd){this[_0x4486('0x4')][_0x4fbedd['id']]=_0x4fbedd;this[_0x4486('0x5')][_0x4fbedd['id']]=[];};Graph[_0x4486('0x6')][_0x4486('0x8')]=function(_0x30f037,_0x3c5664,_0x27f71f){this[_0x4486('0x5')][_0x30f037][_0x4486('0x9')]({'target':_0x3c5664,'condition':_0x27f71f});this[_0x4486('0xa')]+=0x1;};Graph['prototype']['size']=function(){return _[_0x4486('0xb')](this['vertices']);};Graph[_0x4486('0x6')][_0x4486('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x4486('0x6')][_0x4486('0xd')]=function(_0x6f442d){return this[_0x4486('0x4')][_0x6f442d];};Graph[_0x4486('0x6')][_0x4486('0xe')]=function(_0x566d1b,_0x4be7c4){if(!this['vertices'][_0x566d1b]){return logger[_0x4486('0xf')]('no\x20vertex\x20found');}var _0x297a32=_0x4be7c4(this[_0x4486('0x4')][_0x566d1b]);if(!_0x297a32){return logger[_0x4486('0xf')](_0x4486('0x10'));}if(this[_0x4486('0x5')][_0x566d1b][_0x4486('0x11')]===0x0){return logger[_0x4486('0xf')](_0x4486('0x12'));}for(var _0x539363=0x0,_0x59e6ec=[],_0x2997b2=![];_0x539363\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','lodash','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','push','env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x23c4f5,_0x50f6ac){var _0x247d82=function(_0x567aae){while(--_0x567aae){_0x23c4f5['push'](_0x23c4f5['shift']());}};_0x247d82(++_0x50f6ac);}(_0xeb74,0x150));var _0x4eb7=function(_0x38e729,_0x4f5cf1){_0x38e729=_0x38e729-0x0;var _0x1bccb0=_0xeb74[_0x38e729];return _0x1bccb0;};'use strict';var _=require(_0x4eb7('0x0'));var syncho=require('syncho');var util=require(_0x4eb7('0x1'));var config=require(_0x4eb7('0x2'));var logger=require(_0x4eb7('0x3'))('agi');var utilLicense=require(_0x4eb7('0x4'));var rpc=require('./rpc');var Project=require(_0x4eb7('0x5'));var AGIEmitter=require(_0x4eb7('0x6'))[_0x4eb7('0x7')];var projects=[];config[_0x4eb7('0x8')]=_[_0x4eb7('0x9')](config[_0x4eb7('0x8')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x4eb7('0xa'),projectUpdateHandler);function connectionHandler(_0x397dcf){process[_0x4eb7('0xb')](function(){syncho(function(){try{setChannelVariables(_0x397dcf);agiHandler(_0x397dcf);}catch(_0x204697){logger[_0x4eb7('0xc')](_0x204697[_0x4eb7('0xd')]);}});});}function projectUpdateHandler(_0x216d7e){try{var _0xfb06ad=_[_0x4eb7('0xe')](projects,['id',_0x216d7e['id']]);if(_0xfb06ad>-0x1){if(_0x216d7e[_0x4eb7('0xf')]===!![]){projects['splice'](_0xfb06ad,0x1);}else{projects[_0xfb06ad]=_0x216d7e;}}else{projects[_0x4eb7('0x10')](_0x216d7e);}}catch(_0x217595){logger[_0x4eb7('0xc')](_0x217595[_0x4eb7('0xd')]);}}function listeningHandler(){var _0x4cff49=config[_0x4eb7('0x11')]===_0x4eb7('0x12')||![];console['log'](_0x4eb7('0x13'),config[_0x4eb7('0x8')][_0x4eb7('0x14')]);logger[_0x4eb7('0x15')](util[_0x4eb7('0x16')](_0x4eb7('0x17'),_0x4cff49?config[_0x4eb7('0x8')]['ip']:'host.docker.internal',config[_0x4eb7('0x8')]['port']));}function errorHandler(_0x5718f2){if(_0x5718f2&&_0x5718f2['name']&&_0x5718f2['message']){logger[_0x4eb7('0xc')](util['format'](_0x4eb7('0x18'),_0x5718f2[_0x4eb7('0x19')],_0x5718f2[_0x4eb7('0x1a')]));}else{logger[_0x4eb7('0xc')](util[_0x4eb7('0x16')]('[ERROR]\x20%s',_0x5718f2['stack']));}}function closeHandler(){logger[_0x4eb7('0x15')](util['format'](_0x4eb7('0x1b'),this[_0x4eb7('0x1c')],this[_0x4eb7('0x1d')],this[_0x4eb7('0x1e')],this[_0x4eb7('0x1f')],this[_0x4eb7('0x20')]));try{createSquareReport(this);}catch(_0x12a810){logger['error'](_0x12a810['stack']);}}function timeoutHandler(){logger[_0x4eb7('0x15')](util[_0x4eb7('0x16')](_0x4eb7('0x21'),this[_0x4eb7('0x1c')],this[_0x4eb7('0x1d')],this[_0x4eb7('0x1e')],this['dnid'],this[_0x4eb7('0x20')]));}function hangupHandler(){logger[_0x4eb7('0x15')](util[_0x4eb7('0x16')](_0x4eb7('0x22'),this[_0x4eb7('0x1c')],this[_0x4eb7('0x1d')],this[_0x4eb7('0x1e')],this['dnid'],this[_0x4eb7('0x20')]));this[_0x4eb7('0x23')]=!![];}function createSquareReport(_0x20a002,_0x11b69){rpc[_0x4eb7('0x24')](_0x20a002)[_0x4eb7('0x25')](function(_0x3ae0aa){if(_0x11b69){_0x11b69(null,_0x3ae0aa);}})[_0x4eb7('0x26')](function(_0xddc247){if(_0x11b69){_0x11b69(null,_0xddc247);}});}function setChannelVariables(_0x1d153c){for(var _0x1393c6 in _0x1d153c){if(_0x1d153c[_0x4eb7('0x27')](_0x1393c6)){if(_0x1393c6['indexOf'](_0x4eb7('0x28'))===0x0){_0x1d153c[_0x1393c6[_0x4eb7('0x29')](0x4)]=_0x1d153c[_0x1393c6];delete _0x1d153c[_0x1393c6];}}}}function agiHandler(_0x1f4f8f){logger[_0x4eb7('0x2a')](_0x4eb7('0x2b'),JSON[_0x4eb7('0x2c')](_0x1f4f8f,null,0x2));logger[_0x4eb7('0x15')](util[_0x4eb7('0x16')](_0x4eb7('0x2d'),_0x1f4f8f['arg_1'],_0x1f4f8f[_0x4eb7('0x1d')],_0x1f4f8f[_0x4eb7('0x1e')],_0x1f4f8f[_0x4eb7('0x1f')],_0x1f4f8f[_0x4eb7('0x20')]));_0x1f4f8f['on'](_0x4eb7('0xc'),errorHandler);_0x1f4f8f['on'](_0x4eb7('0x2e'),closeHandler);_0x1f4f8f['on'](_0x4eb7('0x2f'),timeoutHandler);_0x1f4f8f['evtHangup']=![];_0x1f4f8f['on']('hangup',hangupHandler);var _0x58daa9=_[_0x4eb7('0x30')](projects,[_0x4eb7('0x19'),_0x1f4f8f['arg_1']]);if(!_0x58daa9)return Project[_0x4eb7('0x31')](_0x1f4f8f);if(!_0x58daa9[_0x4eb7('0x12')])return Project[_0x4eb7('0x32')](_0x1f4f8f);return Project[_0x4eb7('0x33')](_0x58daa9,_0x1f4f8f);}function main(){var _0x213f19;return utilLicense['getLicense']()[_0x4eb7('0x25')](function(_0x49ddda){if(!_0x49ddda)return;if(_0x49ddda[_0x4eb7('0x34')]){if(_0x49ddda[_0x4eb7('0x35')]&&_0x49ddda['callysquare']>0x0){logger[_0x4eb7('0x15')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x49ddda[_0x4eb7('0x35')]));_0x213f19=_0x49ddda[_0x4eb7('0x35')];}else{logger[_0x4eb7('0x15')](_0x4eb7('0x36'));}}else{logger[_0x4eb7('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x213f19=-0x1;}})[_0x4eb7('0x25')](function(){return Project[_0x4eb7('0x37')]();})[_0x4eb7('0x25')](function(_0x35df82){projects=_0x35df82;return;})[_0x4eb7('0x26')](function(_0x2be6a1){logger['error'](_0x4eb7('0x38'),_0x2be6a1['stack']);})['finally'](function(){var _0x195769=require(_0x4eb7('0x39'))(config[_0x4eb7('0x8')]['port'],config[_0x4eb7('0x8')]['ip'],_0x213f19);_0x195769['on'](_0x4eb7('0xc'),errorHandler);_0x195769['on'](_0x4eb7('0x3a'),listeningHandler);_0x195769['on'](_0x4eb7('0x3b'),connectionHandler);_0x195769['on'](_0x4eb7('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0xede6=['substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','close','lodash','../../config/environment','../../config/logger','agi','./rpc','./project','EventEmitter','defaults','127.0.0.1','nextTick','stack','findIndex','deleted','push','error','env','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','then','hasOwnProperty','indexOf','agi_'];(function(_0x4f844b,_0xbe7cc7){var _0x19a8ae=function(_0x1c69fe){while(--_0x1c69fe){_0x4f844b['push'](_0x4f844b['shift']());}};_0x19a8ae(++_0xbe7cc7);}(_0xede6,0xc4));var _0x6ede=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xede6[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x6ede('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x6ede('0x1'));var logger=require(_0x6ede('0x2'))(_0x6ede('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6ede('0x4'));var Project=require(_0x6ede('0x5'));var AGIEmitter=require('./events')[_0x6ede('0x6')];var projects=[];config[_0x6ede('0x3')]=_[_0x6ede('0x7')](config[_0x6ede('0x3')],{'ip':_0x6ede('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x156da3){process[_0x6ede('0x9')](function(){syncho(function(){try{setChannelVariables(_0x156da3);agiHandler(_0x156da3);}catch(_0x44cfa8){logger['error'](_0x44cfa8[_0x6ede('0xa')]);}});});}function projectUpdateHandler(_0x2659d6){try{var _0x25eb4f=_[_0x6ede('0xb')](projects,['id',_0x2659d6['id']]);if(_0x25eb4f>-0x1){if(_0x2659d6[_0x6ede('0xc')]===!![]){projects['splice'](_0x25eb4f,0x1);}else{projects[_0x25eb4f]=_0x2659d6;}}else{projects[_0x6ede('0xd')](_0x2659d6);}}catch(_0x22d906){logger[_0x6ede('0xe')](_0x22d906[_0x6ede('0xa')]);}}function listeningHandler(){var _0x33e06c=config[_0x6ede('0xf')]==='production'||![];console[_0x6ede('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6ede('0x3')][_0x6ede('0x11')]);logger[_0x6ede('0x12')](util[_0x6ede('0x13')](_0x6ede('0x14'),_0x33e06c?config[_0x6ede('0x3')]['ip']:'host.docker.internal',config[_0x6ede('0x3')][_0x6ede('0x11')]));}function errorHandler(_0x4bfe83){if(_0x4bfe83&&_0x4bfe83[_0x6ede('0x15')]&&_0x4bfe83[_0x6ede('0x16')]){logger[_0x6ede('0xe')](util[_0x6ede('0x13')](_0x6ede('0x17'),_0x4bfe83[_0x6ede('0x15')],_0x4bfe83[_0x6ede('0x16')]));}else{logger[_0x6ede('0xe')](util['format'](_0x6ede('0x18'),_0x4bfe83['stack']));}}function closeHandler(){logger[_0x6ede('0x12')](util[_0x6ede('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6ede('0x19')],this['calleridname'],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));try{createSquareReport(this);}catch(_0x184ee4){logger['error'](_0x184ee4['stack']);}}function timeoutHandler(){logger[_0x6ede('0x12')](util[_0x6ede('0x13')](_0x6ede('0x1d'),this['arg_1'],this['calleridname'],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));}function hangupHandler(){logger['info'](util[_0x6ede('0x13')](_0x6ede('0x1e'),this[_0x6ede('0x19')],this[_0x6ede('0x1f')],this[_0x6ede('0x1a')],this[_0x6ede('0x1b')],this[_0x6ede('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x3d3f80,_0x574bc9){rpc['createSquareReport'](_0x3d3f80)[_0x6ede('0x20')](function(_0x380935){if(_0x574bc9){_0x574bc9(null,_0x380935);}})['catch'](function(_0x4a64e9){if(_0x574bc9){_0x574bc9(null,_0x4a64e9);}});}function setChannelVariables(_0x38f728){for(var _0x58bf07 in _0x38f728){if(_0x38f728[_0x6ede('0x21')](_0x58bf07)){if(_0x58bf07[_0x6ede('0x22')](_0x6ede('0x23'))===0x0){_0x38f728[_0x58bf07[_0x6ede('0x24')](0x4)]=_0x38f728[_0x58bf07];delete _0x38f728[_0x58bf07];}}}}function agiHandler(_0x176752){logger[_0x6ede('0x25')](_0x6ede('0x26'),JSON[_0x6ede('0x27')](_0x176752,null,0x2));logger['info'](util[_0x6ede('0x13')](_0x6ede('0x28'),_0x176752[_0x6ede('0x19')],_0x176752['calleridname'],_0x176752[_0x6ede('0x1a')],_0x176752['dnid'],_0x176752[_0x6ede('0x1c')]));_0x176752['on'](_0x6ede('0xe'),errorHandler);_0x176752['on']('close',closeHandler);_0x176752['on'](_0x6ede('0x29'),timeoutHandler);_0x176752[_0x6ede('0x2a')]=![];_0x176752['on'](_0x6ede('0x2b'),hangupHandler);var _0x26d4e0=_[_0x6ede('0x2c')](projects,[_0x6ede('0x15'),_0x176752[_0x6ede('0x19')]]);if(!_0x26d4e0)return Project[_0x6ede('0x2d')](_0x176752);if(!_0x26d4e0['production'])return Project['handleUnpublished'](_0x176752);return Project[_0x6ede('0x2e')](_0x26d4e0,_0x176752);}function main(){var _0x249de2;return utilLicense['getLicense']()[_0x6ede('0x20')](function(_0x5e9af8){if(!_0x5e9af8)return;if(_0x5e9af8[_0x6ede('0x2f')]){if(_0x5e9af8['callysquare']&&_0x5e9af8[_0x6ede('0x30')]>0x0){logger['info'](util[_0x6ede('0x13')](_0x6ede('0x31'),_0x5e9af8['callysquare']));_0x249de2=_0x5e9af8[_0x6ede('0x30')];}else{logger[_0x6ede('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6ede('0x12')](_0x6ede('0x32'));_0x249de2=-0x1;}})['then'](function(){return Project[_0x6ede('0x33')]();})[_0x6ede('0x20')](function(_0x5caa97){projects=_0x5caa97;return;})[_0x6ede('0x34')](function(_0x533a26){logger[_0x6ede('0xe')]('[LICENSE]',_0x533a26[_0x6ede('0xa')]);})[_0x6ede('0x35')](function(){var _0x2c33b4=require(_0x6ede('0x36'))(config[_0x6ede('0x3')]['port'],config[_0x6ede('0x3')]['ip'],_0x249de2);_0x2c33b4['on'](_0x6ede('0xe'),errorHandler);_0x2c33b4['on'](_0x6ede('0x37'),listeningHandler);_0x2c33b4['on'](_0x6ede('0x38'),connectionHandler);_0x2c33b4['on'](_0x6ede('0x39'),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 55423d8..8c19dac 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 _0x19c0=['message','result','sendMailMessage','SendMail','jayson/promise','client','http','error'];(function(_0x57ef42,_0x402438){var _0x5c1859=function(_0x32b18b){while(--_0x32b18b){_0x57ef42['push'](_0x57ef42['shift']());}};_0x5c1859(++_0x402438);}(_0x19c0,0x1dc));var _0x019c=function(_0x56b5c8,_0x33466a){_0x56b5c8=_0x56b5c8-0x0;var _0xf5d8e7=_0x19c0[_0x56b5c8];return _0xf5d8e7;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x019c('0x0'));var client=jayson[_0x019c('0x1')][_0x019c('0x2')]({'port':0x232b});function request(_0x45760b,_0x417f41){return new BPromise(function(_0x5345bd,_0x4d8b4b){return client['request'](_0x45760b,_0x417f41)['then'](function(_0x2f02fc){if(_0x2f02fc[_0x019c('0x3')]){return _0x4d8b4b(_0x2f02fc['error'][_0x019c('0x4')]);}else{return _0x5345bd(_0x2f02fc[_0x019c('0x5')]);}})['catch'](function(_0x1bd3a5){return _0x4d8b4b(_0x1bd3a5);});});}exports[_0x019c('0x6')]=function(_0x244936,_0x2d6aad){return request(_0x019c('0x7'),{'account':_0x244936,'message':_0x2d6aad});}; \ No newline at end of file +var _0x5858=['SendMail','bluebird','http','request','error','message','result'];(function(_0x478125,_0x3eb48c){var _0x11b219=function(_0x46c6ee){while(--_0x46c6ee){_0x478125['push'](_0x478125['shift']());}};_0x11b219(++_0x3eb48c);}(_0x5858,0x119));var _0x8585=function(_0x1cb3e9,_0x87cf67){_0x1cb3e9=_0x1cb3e9-0x0;var _0x566802=_0x5858[_0x1cb3e9];return _0x566802;};'use strict';var BPromise=require(_0x8585('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8585('0x1')]({'port':0x232b});function request(_0xbe1dd8,_0x5c6707){return new BPromise(function(_0x55608e,_0x5437b1){return client[_0x8585('0x2')](_0xbe1dd8,_0x5c6707)['then'](function(_0x13603d){if(_0x13603d[_0x8585('0x3')]){return _0x5437b1(_0x13603d[_0x8585('0x3')][_0x8585('0x4')]);}else{return _0x55608e(_0x13603d[_0x8585('0x5')]);}})['catch'](function(_0x5f135c){return _0x5437b1(_0x5f135c);});});}exports['sendMailMessage']=function(_0x3c209d,_0x5b7b03){return request(_0x8585('0x6'),{'account':_0x3c209d,'message':_0x5b7b03});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 3603403..5d06f38 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 _0x5c36=['gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','isUndefined','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','moment','util','../../config/logger','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c36,0xc7));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var moment=require(_0x65c3('0x0'));var parser=require('xml2json');var util=require(_0x65c3('0x1'));var logger=require(_0x65c3('0x2'))('agi');var rpc=require(_0x65c3('0x3'));var mailRpc=require(_0x65c3('0x4'));var Graph=require(_0x65c3('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x65c3('0x6')]()[_0x65c3('0x7')](function(_0x2420c3){logger[_0x65c3('0x8')](_0x65c3('0x9'),_0x2420c3['stack']);return[];});}function addVertex(_0x3ecb48,_0x45bdd8,_0x5e6800){_0x45bdd8[_0x65c3('0xa')]=_0x5e6800;if(_0x45bdd8[_0x65c3('0xb')]('retry')){_0x45bdd8[_0x65c3('0xc')]=parseInt(_0x45bdd8[_0x65c3('0xd')],0xa);}_0x3ecb48['addVertex'](_['omit'](_0x45bdd8,_0x65c3('0xe')));}function initGraph(_0x10a8e6,_0xfeefd3){var _0x2c6224=new Graph();for(var _0x4afc3e in _0x10a8e6){if(_0x10a8e6['hasOwnProperty'](_0x4afc3e)){if(_[_0x65c3('0xf')](_0x10a8e6[_0x4afc3e])){for(var _0x303dd4=0x0;_0x303dd4<_0x10a8e6[_0x4afc3e]['length'];_0x303dd4+=0x1){addVertex(_0x2c6224,_0x10a8e6[_0x4afc3e][_0x303dd4],_0x4afc3e);}}else{addVertex(_0x2c6224,_0x10a8e6[_0x4afc3e],_0x4afc3e);}}}for(var _0x1cff18=0x0;_0x1cff18<_0xfeefd3[_0x65c3('0x10')];_0x1cff18+=0x1){if(_0xfeefd3[_0x1cff18][_0x65c3('0x11')]&&_0xfeefd3[_0x1cff18]['target']){_0x2c6224[_0x65c3('0x12')](_0xfeefd3[_0x1cff18][_0x65c3('0x11')],_0xfeefd3[_0x1cff18][_0x65c3('0x13')],_0xfeefd3[_0x1cff18][_0x65c3('0x14')]);}}return _0x2c6224;}function getRoot(_0x4967c3){return parser[_0x65c3('0x15')](_0x4967c3,{'object':!![]})[_0x65c3('0x16')][_0x65c3('0x17')];}function inspect(_0x55459c){return util['inspect'](_0x55459c,{'showHidden':![],'depth':null});}function initialize(_0x262172,_0x2b6f4a){var _0x4bb08c=getRoot(_0x262172[_0x65c3('0x18')]);if(!_0x4bb08c||!_0x4bb08c[_0x65c3('0x19')])return;var _0x33e9df,_0x53e4f2,_0x1994f3;logger[_0x65c3('0x1a')](_0x65c3('0x17'),JSON[_0x65c3('0x1b')](_0x4bb08c,null,0x2));_0x2b6f4a[_0x65c3('0x1c')]=moment()['format'](_0x65c3('0x1d'));_0x33e9df=initGraph(_[_0x65c3('0x1e')](_0x4bb08c,_0x65c3('0xe')),_0x4bb08c['mxCell']);_0x53e4f2=new Vertices(_0x2b6f4a,rpc,mailRpc);logger[_0x65c3('0x1f')](util[_0x65c3('0x20')](_0x65c3('0x21'),_0x2b6f4a[_0x65c3('0x22')],_0x2b6f4a[_0x65c3('0x23')],_0x2b6f4a[_0x65c3('0x24')],_0x2b6f4a['dnid'],_0x2b6f4a[_0x65c3('0x25')]));_0x33e9df[_0x65c3('0x26')](_0x4bb08c['start']['id'],function(_0x49badc){try{_0x49badc=_0x53e4f2[_0x65c3('0x27')](_0x49badc);logger[_0x65c3('0x1a')](_0x65c3('0x28'),JSON['stringify'](_0x49badc,null,0x2));if(_0x49badc[_0x65c3('0xa')]===_0x65c3('0x29')){logger['info'](_0x65c3('0x2a'));_0x2b6f4a[_0x65c3('0x2b')]=_0x49badc[_0x65c3('0x2b')]||_0x2b6f4a[_0x65c3('0x2b')];_0x2b6f4a[_0x65c3('0x2c')]=_0x49badc[_0x65c3('0x2c')];_0x2b6f4a[_0x65c3('0x2d')]=_0x49badc[_0x65c3('0x2d')]?_0x49badc[_0x65c3('0x2d')]-0x1:0x1;return null;}else if(_0x49badc&&_0x53e4f2[_0x49badc[_0x65c3('0xa')]]){_0x1994f3=_0x53e4f2[_0x49badc[_0x65c3('0xa')]](_0x49badc);logger[_0x65c3('0x1f')](_0x65c3('0x2e'),JSON[_0x65c3('0x1b')](_0x1994f3,null,0x2));if(_0x1994f3&&_0x1994f3['code']===AGI_CODE_SUCCESS&&_0x1994f3[_0x65c3('0x2f')]!==AGI_RESULT_ERROR&&!_0x2b6f4a['evtHangup']){logger[_0x65c3('0x1a')](_0x65c3('0x2e'),inspect(_0x1994f3));return _['isUndefined'](_0x1994f3[_0x65c3('0x2f')])?null:_0x1994f3[_0x65c3('0x2f')][_0x65c3('0x30')]();}else{logger['error'](_0x65c3('0x2e'),inspect(_0x1994f3));return null;}}else{logger[_0x65c3('0x8')](_0x65c3('0x31'));return null;}}catch(_0x3854b1){logger['error'](_0x3854b1[_0x65c3('0x32')]);return null;}});if(_0x4bb08c[_0x65c3('0x33')]){logger[_0x65c3('0x1f')](util[_0x65c3('0x20')](_0x65c3('0x34'),_0x2b6f4a['arg_1'],_0x2b6f4a[_0x65c3('0x23')],_0x2b6f4a[_0x65c3('0x24')],_0x2b6f4a[_0x65c3('0x35')],_0x2b6f4a[_0x65c3('0x25')]));_0x33e9df['traverseBFS'](_0x4bb08c['finally']['id'],function(_0x2eaa04){try{_0x2eaa04=_0x53e4f2[_0x65c3('0x27')](_0x2eaa04);logger[_0x65c3('0x1a')](_0x65c3('0x28'),JSON[_0x65c3('0x1b')](_0x2eaa04,null,0x2));if(_0x2eaa04&&_0x53e4f2[_0x2eaa04[_0x65c3('0xa')]]){_0x1994f3=_0x53e4f2[_0x2eaa04[_0x65c3('0xa')]](_0x2eaa04);if(_0x1994f3){logger['debug'](_0x65c3('0x2e'),inspect(_0x1994f3));return _[_0x65c3('0x36')](_0x1994f3[_0x65c3('0x2f')])?null:_0x1994f3['result'][_0x65c3('0x30')]();}else{logger[_0x65c3('0x8')](_0x65c3('0x2e'),inspect(_0x1994f3));return null;}}else{logger['error'](_0x65c3('0x31'));return null;}}catch(_0x216719){logger[_0x65c3('0x8')](_0x216719['stack']);return null;}});}logger[_0x65c3('0x1f')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2b6f4a[_0x65c3('0x22')],_0x2b6f4a[_0x65c3('0x23')],_0x2b6f4a[_0x65c3('0x24')],_0x2b6f4a[_0x65c3('0x35')],_0x2b6f4a[_0x65c3('0x25')]));logger[_0x65c3('0x1f')](util[_0x65c3('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2b6f4a[_0x65c3('0x2b')],_0x2b6f4a['extension'],parseInt(_0x2b6f4a[_0x65c3('0x2d')],0xa)+0x1));_0x2b6f4a[_0x65c3('0x37')](_0x2b6f4a['context'],_0x2b6f4a[_0x65c3('0x2c')],parseInt(_0x2b6f4a[_0x65c3('0x2d')],0xa)+0x1);_0x2b6f4a['close']();}function handleNotFound(_0x510360){logger['error'](util['format'](_0x65c3('0x38'),_0x510360['arg_1']));_0x510360[_0x65c3('0x37')](_0x510360[_0x65c3('0x2b')],_0x510360[_0x65c3('0x2c')],parseInt(_0x510360[_0x65c3('0x2d')],0xa)+0x1);_0x510360[_0x65c3('0x39')]();}function handleUnpublished(_0x26ea0c){logger[_0x65c3('0x8')](util[_0x65c3('0x20')](_0x65c3('0x3a'),_0x26ea0c[_0x65c3('0x22')]));_0x26ea0c[_0x65c3('0x37')](_0x26ea0c[_0x65c3('0x2b')],_0x26ea0c[_0x65c3('0x2c')],parseInt(_0x26ea0c['priority'],0xa)+0x1);_0x26ea0c[_0x65c3('0x39')]();}module[_0x65c3('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7eb9=['uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','calleridname','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid'];(function(_0x12034d,_0x6d4771){var _0x4fce64=function(_0x4eb8e8){while(--_0x4eb8e8){_0x12034d['push'](_0x12034d['shift']());}};_0x4fce64(++_0x6d4771);}(_0x7eb9,0x1c4));var _0x97eb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7eb9[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0x97eb('0x0'));var parser=require(_0x97eb('0x1'));var util=require(_0x97eb('0x2'));var logger=require(_0x97eb('0x3'))(_0x97eb('0x4'));var rpc=require(_0x97eb('0x5'));var mailRpc=require(_0x97eb('0x6'));var Graph=require(_0x97eb('0x7'));var Vertices=require(_0x97eb('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x97eb('0x9')]()[_0x97eb('0xa')](function(_0x2559d6){logger[_0x97eb('0xb')](_0x97eb('0xc'),_0x2559d6[_0x97eb('0xd')]);return[];});}function addVertex(_0xe20f1,_0x588b42,_0x5b0d6e){_0x588b42[_0x97eb('0xe')]=_0x5b0d6e;if(_0x588b42[_0x97eb('0xf')](_0x97eb('0x10'))){_0x588b42['maxRetry']=parseInt(_0x588b42[_0x97eb('0x10')],0xa);}_0xe20f1[_0x97eb('0x11')](_[_0x97eb('0x12')](_0x588b42,_0x97eb('0x13')));}function initGraph(_0x36d163,_0x464518){var _0x4cc17b=new Graph();for(var _0xb1e440 in _0x36d163){if(_0x36d163['hasOwnProperty'](_0xb1e440)){if(_[_0x97eb('0x14')](_0x36d163[_0xb1e440])){for(var _0x2fdffc=0x0;_0x2fdffc<_0x36d163[_0xb1e440][_0x97eb('0x15')];_0x2fdffc+=0x1){addVertex(_0x4cc17b,_0x36d163[_0xb1e440][_0x2fdffc],_0xb1e440);}}else{addVertex(_0x4cc17b,_0x36d163[_0xb1e440],_0xb1e440);}}}for(var _0x452741=0x0;_0x452741<_0x464518['length'];_0x452741+=0x1){if(_0x464518[_0x452741][_0x97eb('0x16')]&&_0x464518[_0x452741]['target']){_0x4cc17b[_0x97eb('0x17')](_0x464518[_0x452741][_0x97eb('0x16')],_0x464518[_0x452741][_0x97eb('0x18')],_0x464518[_0x452741][_0x97eb('0x19')]);}}return _0x4cc17b;}function getRoot(_0x3a3b1f){return parser['toJson'](_0x3a3b1f,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x40571f){return util['inspect'](_0x40571f,{'showHidden':![],'depth':null});}function initialize(_0x334a9f,_0x4a82a8){var _0x36d59c=getRoot(_0x334a9f['production']);if(!_0x36d59c||!_0x36d59c[_0x97eb('0x1a')])return;var _0x3257b8,_0x22147c,_0x3015dd;logger[_0x97eb('0x1b')](_0x97eb('0x1c'),JSON['stringify'](_0x36d59c,null,0x2));_0x4a82a8[_0x97eb('0x1d')]=moment()['format'](_0x97eb('0x1e'));_0x3257b8=initGraph(_[_0x97eb('0x12')](_0x36d59c,'mxCell'),_0x36d59c[_0x97eb('0x13')]);_0x22147c=new Vertices(_0x4a82a8,rpc,mailRpc);logger[_0x97eb('0x1f')](util[_0x97eb('0x20')](_0x97eb('0x21'),_0x4a82a8[_0x97eb('0x22')],_0x4a82a8['calleridname'],_0x4a82a8[_0x97eb('0x23')],_0x4a82a8['dnid'],_0x4a82a8[_0x97eb('0x24')]));_0x3257b8[_0x97eb('0x25')](_0x36d59c['start']['id'],function(_0x40ccf7){try{_0x40ccf7=_0x22147c[_0x97eb('0x26')](_0x40ccf7);logger[_0x97eb('0x1b')](_0x97eb('0x27'),JSON[_0x97eb('0x28')](_0x40ccf7,null,0x2));if(_0x40ccf7['agicommand']===_0x97eb('0x29')){logger[_0x97eb('0x1f')](_0x97eb('0x2a'));_0x4a82a8[_0x97eb('0x2b')]=_0x40ccf7[_0x97eb('0x2b')]||_0x4a82a8[_0x97eb('0x2b')];_0x4a82a8[_0x97eb('0x2c')]=_0x40ccf7['extension'];_0x4a82a8['priority']=_0x40ccf7['priority']?_0x40ccf7[_0x97eb('0x2d')]-0x1:0x1;return null;}else if(_0x40ccf7&&_0x22147c[_0x40ccf7['agicommand']]){_0x3015dd=_0x22147c[_0x40ccf7[_0x97eb('0xe')]](_0x40ccf7);logger[_0x97eb('0x1f')](_0x97eb('0x2e'),JSON[_0x97eb('0x28')](_0x3015dd,null,0x2));if(_0x3015dd&&_0x3015dd[_0x97eb('0x2f')]===AGI_CODE_SUCCESS&&_0x3015dd[_0x97eb('0x30')]!==AGI_RESULT_ERROR&&!_0x4a82a8[_0x97eb('0x31')]){logger[_0x97eb('0x1b')](_0x97eb('0x2e'),inspect(_0x3015dd));return _[_0x97eb('0x32')](_0x3015dd[_0x97eb('0x30')])?null:_0x3015dd['result'][_0x97eb('0x33')]();}else{logger[_0x97eb('0xb')]('response',inspect(_0x3015dd));return null;}}else{logger[_0x97eb('0xb')](_0x97eb('0x34'));return null;}}catch(_0x13d05f){logger[_0x97eb('0xb')](_0x13d05f['stack']);return null;}});if(_0x36d59c[_0x97eb('0x35')]){logger['info'](util[_0x97eb('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a82a8[_0x97eb('0x22')],_0x4a82a8[_0x97eb('0x36')],_0x4a82a8[_0x97eb('0x23')],_0x4a82a8[_0x97eb('0x37')],_0x4a82a8[_0x97eb('0x24')]));_0x3257b8['traverseBFS'](_0x36d59c[_0x97eb('0x35')]['id'],function(_0x2641b7){try{_0x2641b7=_0x22147c[_0x97eb('0x26')](_0x2641b7);logger[_0x97eb('0x1b')](_0x97eb('0x27'),JSON[_0x97eb('0x28')](_0x2641b7,null,0x2));if(_0x2641b7&&_0x22147c[_0x2641b7[_0x97eb('0xe')]]){_0x3015dd=_0x22147c[_0x2641b7[_0x97eb('0xe')]](_0x2641b7);if(_0x3015dd){logger[_0x97eb('0x1b')]('response',inspect(_0x3015dd));return _[_0x97eb('0x32')](_0x3015dd['result'])?null:_0x3015dd[_0x97eb('0x30')][_0x97eb('0x33')]();}else{logger[_0x97eb('0xb')](_0x97eb('0x2e'),inspect(_0x3015dd));return null;}}else{logger['error'](_0x97eb('0x34'));return null;}}catch(_0x4cedc1){logger['error'](_0x4cedc1['stack']);return null;}});}logger[_0x97eb('0x1f')](util[_0x97eb('0x20')](_0x97eb('0x38'),_0x4a82a8[_0x97eb('0x22')],_0x4a82a8[_0x97eb('0x36')],_0x4a82a8['callerid'],_0x4a82a8['dnid'],_0x4a82a8[_0x97eb('0x24')]));logger[_0x97eb('0x1f')](util[_0x97eb('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4a82a8[_0x97eb('0x2b')],_0x4a82a8['extension'],parseInt(_0x4a82a8[_0x97eb('0x2d')],0xa)+0x1));_0x4a82a8[_0x97eb('0x39')](_0x4a82a8[_0x97eb('0x2b')],_0x4a82a8['extension'],parseInt(_0x4a82a8['priority'],0xa)+0x1);_0x4a82a8['close']();}function handleNotFound(_0x23e706){logger[_0x97eb('0xb')](util[_0x97eb('0x20')](_0x97eb('0x3a'),_0x23e706['arg_1']));_0x23e706[_0x97eb('0x39')](_0x23e706[_0x97eb('0x2b')],_0x23e706[_0x97eb('0x2c')],parseInt(_0x23e706[_0x97eb('0x2d')],0xa)+0x1);_0x23e706[_0x97eb('0x3b')]();}function handleUnpublished(_0x27114f){logger[_0x97eb('0xb')](util[_0x97eb('0x20')](_0x97eb('0x3c'),_0x27114f['arg_1']));_0x27114f[_0x97eb('0x39')](_0x27114f[_0x97eb('0x2b')],_0x27114f[_0x97eb('0x2c')],parseInt(_0x27114f[_0x97eb('0x2d')],0xa)+0x1);_0x27114f[_0x97eb('0x3b')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index dce8856..e92a365 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 _0x89f3=['inherits','prototype','_transform','toString','_inBody','indexOf','substring','split','slice','length','emit','headers','line','exports','stream','Transform','call','_localBuffer'];(function(_0x4b1f9c,_0x422fc9){var _0x3e0632=function(_0x480a6f){while(--_0x480a6f){_0x4b1f9c['push'](_0x4b1f9c['shift']());}};_0x3e0632(++_0x422fc9);}(_0x89f3,0x1ac));var _0x389f=function(_0x1ada1a,_0x4040c0){_0x1ada1a=_0x1ada1a-0x0;var _0x1f8a12=_0x89f3[_0x1ada1a];return _0x1f8a12;};'use strict';var util=require('util');var Transform=require(_0x389f('0x0'))[_0x389f('0x1')];function AGIReply(_0x406e00){Transform[_0x389f('0x2')](this,_0x406e00);this[_0x389f('0x3')]='';this['_inBody']=![];}util[_0x389f('0x4')](AGIReply,Transform);AGIReply[_0x389f('0x5')][_0x389f('0x6')]=function(_0x425657,_0x1d16f8,_0x5aa54e){var _0x21ab75='\x0a',_0x56882e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x2d62b5=-0x1,_0x14e36a=-0x1,_0xef6f4b='',_0x1ebeac=0x0,_0x20b0f3='',_0x2f7f60='';this['_localBuffer']+=_0x425657[_0x389f('0x7')]();_0x20b0f3=this[_0x389f('0x3')];if(!this[_0x389f('0x8')]){_0x1ebeac=0x0;while(_0x56882e[_0x1ebeac]){while((_0x14e36a=_0x20b0f3[_0x389f('0x9')](_0x56882e[_0x1ebeac]))!=-0x1){_0xef6f4b=_0x56882e[_0x1ebeac];_0x2f7f60=_0x20b0f3[_0x389f('0xa')](0x0,_0x14e36a);_0x20b0f3=_0x20b0f3[_0x389f('0xa')](_0x14e36a+_0xef6f4b['length']);var _0x4859b9=_0x2f7f60[_0x389f('0xb')](_0x21ab75),_0x45e6ea=0x0,_0x107ff0={},_0x2b191e='',_0x3cdcd1='',_0x524f17=-0x1;while(_0x4859b9[_0x45e6ea]){_0x524f17=_0x4859b9[_0x45e6ea][_0x389f('0x9')](':');if(_0x524f17!=-0x1){_0x2b191e=_0x4859b9[_0x45e6ea]['slice'](0x0,_0x524f17)['trim']();_0x3cdcd1=_0x4859b9[_0x45e6ea][_0x389f('0xc')](_0x524f17+0x1)['trim']();if(_0x2b191e[_0x389f('0xd')]>0x0){_0x107ff0[_0x2b191e]=_0x3cdcd1;}}else{}_0x45e6ea++;}this[_0x389f('0xe')](_0x389f('0xf'),_0x107ff0);this[_0x389f('0x8')]=!![];}_0x1ebeac++;}this['_localBuffer']=_0x20b0f3;}else{while((_0x2d62b5=_0x20b0f3['indexOf'](_0x21ab75))!=-0x1){_0x2f7f60=_0x20b0f3[_0x389f('0xa')](0x0,_0x2d62b5);this[_0x389f('0xe')](_0x389f('0x10'),_0x2f7f60);_0x20b0f3=_0x20b0f3[_0x389f('0xa')](_0x2d62b5+_0x21ab75['length']);}this['_localBuffer']=_0x20b0f3;}_0x5aa54e();};module[_0x389f('0x11')]=AGIReply; \ No newline at end of file +var _0xd959=['headers','util','stream','Transform','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd959,0xd3));var _0x9d95=function(_0x1a7fd0,_0x30c701){_0x1a7fd0=_0x1a7fd0-0x0;var _0x3e23fa=_0xd959[_0x1a7fd0];return _0x3e23fa;};'use strict';var util=require(_0x9d95('0x0'));var Transform=require(_0x9d95('0x1'))[_0x9d95('0x2')];function AGIReply(_0x1a69d1){Transform['call'](this,_0x1a69d1);this[_0x9d95('0x3')]='';this[_0x9d95('0x4')]=![];}util[_0x9d95('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x46d03f,_0x4a246e,_0x1d3afa){var _0x4e94ee='\x0a',_0x1e4f68=['\x0a\x0a',_0x9d95('0x6')],_0x4e6126=-0x1,_0x203822=-0x1,_0x3a338f='',_0xe79021=0x0,_0x5a79de='',_0x5d8fa4='';this[_0x9d95('0x3')]+=_0x46d03f[_0x9d95('0x7')]();_0x5a79de=this['_localBuffer'];if(!this[_0x9d95('0x4')]){_0xe79021=0x0;while(_0x1e4f68[_0xe79021]){while((_0x203822=_0x5a79de[_0x9d95('0x8')](_0x1e4f68[_0xe79021]))!=-0x1){_0x3a338f=_0x1e4f68[_0xe79021];_0x5d8fa4=_0x5a79de[_0x9d95('0x9')](0x0,_0x203822);_0x5a79de=_0x5a79de['substring'](_0x203822+_0x3a338f[_0x9d95('0xa')]);var _0x203606=_0x5d8fa4['split'](_0x4e94ee),_0x41d216=0x0,_0x21bdb9={},_0x4cdc42='',_0x3b7efc='',_0xf2c7ce=-0x1;while(_0x203606[_0x41d216]){_0xf2c7ce=_0x203606[_0x41d216]['indexOf'](':');if(_0xf2c7ce!=-0x1){_0x4cdc42=_0x203606[_0x41d216][_0x9d95('0xb')](0x0,_0xf2c7ce)['trim']();_0x3b7efc=_0x203606[_0x41d216][_0x9d95('0xb')](_0xf2c7ce+0x1)[_0x9d95('0xc')]();if(_0x4cdc42[_0x9d95('0xa')]>0x0){_0x21bdb9[_0x4cdc42]=_0x3b7efc;}}else{}_0x41d216++;}this[_0x9d95('0xd')](_0x9d95('0xe'),_0x21bdb9);this[_0x9d95('0x4')]=!![];}_0xe79021++;}this[_0x9d95('0x3')]=_0x5a79de;}else{while((_0x4e6126=_0x5a79de['indexOf'](_0x4e94ee))!=-0x1){_0x5d8fa4=_0x5a79de['substring'](0x0,_0x4e6126);this[_0x9d95('0xd')]('line',_0x5d8fa4);_0x5a79de=_0x5a79de[_0x9d95('0x9')](_0x4e6126+_0x4e94ee['length']);}this['_localBuffer']=_0x5a79de;}_0x1d3afa();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 42a31c9..4b49456 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 _0xed95=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport'];(function(_0xf5fbb7,_0xdb7f69){var _0x330d55=function(_0x45fd85){while(--_0x45fd85){_0xf5fbb7['push'](_0xf5fbb7['shift']());}};_0x330d55(++_0xdb7f69);}(_0xed95,0xb9));var _0x5ed9=function(_0xbbd4c7,_0x5dfb6b){_0xbbd4c7=_0xbbd4c7-0x0;var _0x15be19=_0xed95[_0xbbd4c7];return _0x15be19;};'use strict';var _=require(_0x5ed9('0x0'));var moment=require(_0x5ed9('0x1'));var jayson=require(_0x5ed9('0x2'));var client=jayson[_0x5ed9('0x3')][_0x5ed9('0x4')]({'port':0x2329});function request(_0x7b6960,_0x453f85){return new Promise(function(_0x3e2272,_0x2a28e9){return client[_0x5ed9('0x5')](_0x7b6960,_0x453f85)[_0x5ed9('0x6')](function(_0x15b734){if(_0x15b734['error']){return _0x2a28e9(_0x15b734['error'][_0x5ed9('0x7')]);}else{return _0x3e2272(_0x15b734[_0x5ed9('0x8')]);}})[_0x5ed9('0x9')](function(_0x34688d){return _0x2a28e9(_0x34688d);});});}exports[_0x5ed9('0xa')]=function(){return request(_0x5ed9('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x5ed9('0xc')]=function(_0xbe4c01){return request(_0x5ed9('0xd'),{'options':{'raw':![],'where':{'name':_0xbe4c01},'attributes':[_0x5ed9('0xe')]}});};exports['getMailAccountById']=function(_0x575782){return request(_0x5ed9('0xf'),{'options':{'raw':![],'where':{'id':_0x575782},'include':[{'model':_0x5ed9('0x10'),'as':_0x5ed9('0x11'),'include':[{'model':_0x5ed9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x5ed9('0x13'),_0x5ed9('0x14')],'smtp':!![]}});};exports[_0x5ed9('0x15')]=function(_0x5e463c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e463c},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x16')]=function(_0x5e952c){return request(_0x5ed9('0x17'),{'options':{'where':{'id':_0x5e952c},'attributes':[_0x5ed9('0x13')]}});};exports['getVariableById']=function(_0x57692b){return request(_0x5ed9('0x18'),{'options':{'where':{'id':_0x57692b},'attributes':[_0x5ed9('0x13')]}});};exports['getSquareOdbcById']=function(_0x3de09e){return request(_0x5ed9('0x19'),{'options':{'where':{'id':_0x3de09e},'attributes':['dsn']}});};exports[_0x5ed9('0x1a')]=function(_0xc6e591){return request('ShowUser',{'options':{'where':{'id':_0xc6e591},'attributes':['name']}});};exports['getContactByPhone']=function(_0x510ffe){return request(_0x5ed9('0x1b'),{'options':{'where':{'phone':_0x510ffe[_0x5ed9('0x1c')]},'attributes':['id']}});};exports[_0x5ed9('0x1d')]=function(_0x44b8ca){return request('ShowTrunk',{'options':{'where':{'id':_0x44b8ca},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x1e')]=function(_0x5cb2c1){return request('ShowSound',{'options':{'where':{'id':_0x5cb2c1},'attributes':['save_name']}});};exports[_0x5ed9('0x1f')]=function(_0x26a3c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26a3c8},'include':[{'model':_0x5ed9('0x20'),'as':_0x5ed9('0x21')}]}});};exports[_0x5ed9('0x22')]=function(_0x71e104){return request('ShowSmsAccount',{'options':{'where':{'id':_0x71e104},'attributes':['id',_0x5ed9('0x13')]}});};exports[_0x5ed9('0x23')]=function(_0x38b462){return request(_0x5ed9('0x24'),{'body':_0x38b462});};exports[_0x5ed9('0x25')]=function(_0x14ae7b){return request('CreateSquareDetailsReport',{'body':_0x14ae7b});};exports['createSquareReport']=function(_0x36d7d5){return request(_0x5ed9('0x26'),{'body':_[_0x5ed9('0x27')](_0x36d7d5,{'project_name':_0x36d7d5['arg_1'],'prev_project_name':_0x36d7d5['arg_2']||'','is_subproject':_0x36d7d5[_0x5ed9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ed9('0x29')](_0x5ed9('0x2a'))})});};exports['createSquareRecording']=function(_0x1bc137){return request(_0x5ed9('0x2b'),{'body':_0x1bc137});};exports[_0x5ed9('0x2c')]=function(_0x5a805b){return request(_0x5ed9('0x2d'),{'body':_0x5a805b});};exports[_0x5ed9('0x2e')]=function(_0x411729){return request(_0x5ed9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x411729['phone'],'ListId':_0x411729['ListId']}}})[_0x5ed9('0x6')](function(_0x5d6599){if(_0x5d6599){return _0x5d6599;}return request(_0x5ed9('0x30'),{'body':_0x411729});});};exports[_0x5ed9('0x31')]=function(_0x1585e3){return request(_0x5ed9('0x32'),{'options':{'where':{'id':_0x1585e3},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x33')]=function(_0xba5b97,_0x4a47f5){return request('LoginUser',{'body':{'interface':_0x4a47f5},'options':{'where':_0xba5b97}});};exports['agentPause']=function(_0x39771f,_0x36d050,_0x2cb3d2){return request('PauseUser',{'body':{'type':_0x36d050,'uniqueid':_0x2cb3d2},'options':{'where':_0x39771f}});};exports[_0x5ed9('0x34')]=function(_0x53575b){return request(_0x5ed9('0x35'),{'body':{},'options':{'where':_0x53575b}});};exports[_0x5ed9('0x36')]=function(_0x3061cd){return request(_0x5ed9('0x37'),{'body':{},'options':{'where':_0x3061cd}});}; \ No newline at end of file +var _0x0c02=['format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','getSquareProjects','GetSquareProjects','name','production','getSquareProject','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2'];(function(_0x3146f6,_0x437cde){var _0x4a509a=function(_0x4a8756){while(--_0x4a8756){_0x3146f6['push'](_0x3146f6['shift']());}};_0x4a509a(++_0x437cde);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x20c0('0x0'));var jayson=require(_0x20c0('0x1'));var client=jayson['client'][_0x20c0('0x2')]({'port':0x2329});function request(_0x5c8750,_0x454922){return new Promise(function(_0x6d03d0,_0x38022e){return client[_0x20c0('0x3')](_0x5c8750,_0x454922)[_0x20c0('0x4')](function(_0x1474f7){if(_0x1474f7[_0x20c0('0x5')]){return _0x38022e(_0x1474f7[_0x20c0('0x5')]['message']);}else{return _0x6d03d0(_0x1474f7['result']);}})['catch'](function(_0x4db532){return _0x38022e(_0x4db532);});});}exports[_0x20c0('0x6')]=function(){return request(_0x20c0('0x7'),{'options':{'raw':![],'attributes':['id',_0x20c0('0x8'),_0x20c0('0x9')]}});};exports[_0x20c0('0xa')]=function(_0xedd21d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xedd21d},'attributes':['production']}});};exports['getMailAccountById']=function(_0x578592){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x578592},'include':[{'model':_0x20c0('0xb'),'as':_0x20c0('0xc'),'include':[{'model':_0x20c0('0xd'),'as':_0x20c0('0xd')}]}],'attributes':['id','name',_0x20c0('0xe')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5c9ee6){return request(_0x20c0('0xf'),{'options':{'where':{'id':_0x5c9ee6},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x10')]=function(_0x3b2bba){return request(_0x20c0('0x11'),{'options':{'where':{'id':_0x3b2bba},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x12')]=function(_0x105839){return request(_0x20c0('0x13'),{'options':{'where':{'id':_0x105839},'attributes':['name']}});};exports[_0x20c0('0x14')]=function(_0xc78626){return request(_0x20c0('0x15'),{'options':{'where':{'id':_0xc78626},'attributes':[_0x20c0('0x16')]}});};exports[_0x20c0('0x17')]=function(_0xeff5b9){return request('ShowUser',{'options':{'where':{'id':_0xeff5b9},'attributes':['name']}});};exports['getContactByPhone']=function(_0x10a921){return request(_0x20c0('0x18'),{'options':{'where':{'phone':_0x10a921[_0x20c0('0x19')]},'attributes':['id']}});};exports[_0x20c0('0x1a')]=function(_0x5b3725){return request(_0x20c0('0x1b'),{'options':{'where':{'id':_0x5b3725},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x1c')]=function(_0x5851eb){return request('ShowSound',{'options':{'where':{'id':_0x5851eb},'attributes':[_0x20c0('0x1d')]}});};exports[_0x20c0('0x1e')]=function(_0x1407d3){return request(_0x20c0('0x1f'),{'options':{'raw':![],'where':{'id':_0x1407d3},'include':[{'model':_0x20c0('0x20'),'as':'Intervals'}]}});};exports[_0x20c0('0x21')]=function(_0x28959a){return request(_0x20c0('0x22'),{'options':{'where':{'id':_0x28959a},'attributes':['id',_0x20c0('0x8')]}});};exports['createSmsMessage']=function(_0xfea1eb){return request(_0x20c0('0x23'),{'body':_0xfea1eb});};exports[_0x20c0('0x24')]=function(_0x114ff9){return request(_0x20c0('0x25'),{'body':_0x114ff9});};exports[_0x20c0('0x26')]=function(_0x14c676){return request('CreateSquareReport',{'body':_[_0x20c0('0x27')](_0x14c676,{'project_name':_0x14c676[_0x20c0('0x28')],'prev_project_name':_0x14c676[_0x20c0('0x29')]||'','is_subproject':_0x14c676[_0x20c0('0x29')]?!![]:![],'leaveAt':moment()[_0x20c0('0x2a')](_0x20c0('0x2b'))})});};exports['createSquareRecording']=function(_0x4e0cbb){return request(_0x20c0('0x2c'),{'body':_0x4e0cbb});};exports[_0x20c0('0x2d')]=function(_0x1e3790){return request('CreateSquareMessage',{'body':_0x1e3790});};exports[_0x20c0('0x2e')]=function(_0x25592b){return request(_0x20c0('0x2f'),{'options':{'raw':![],'where':{'phone':_0x25592b[_0x20c0('0x19')],'ListId':_0x25592b['ListId']}}})['then'](function(_0x29d8ee){if(_0x29d8ee){return _0x29d8ee;}return request(_0x20c0('0x30'),{'body':_0x25592b});});};exports[_0x20c0('0x31')]=function(_0xe961ad){return request(_0x20c0('0x32'),{'options':{'where':{'id':_0xe961ad},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x33')]=function(_0x40c0a7,_0x3ac0a4){return request(_0x20c0('0x34'),{'body':{'interface':_0x3ac0a4},'options':{'where':_0x40c0a7}});};exports[_0x20c0('0x35')]=function(_0x32448b,_0x1fef93,_0x45fa64){return request('PauseUser',{'body':{'type':_0x1fef93,'uniqueid':_0x45fa64},'options':{'where':_0x32448b}});};exports[_0x20c0('0x36')]=function(_0x1ad64f){return request(_0x20c0('0x37'),{'body':{},'options':{'where':_0x1ad64f}});};exports[_0x20c0('0x38')]=function(_0x59406e){return request(_0x20c0('0x39'),{'body':{},'options':{'where':_0x59406e}});}; \ 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 f3ad633..bd313ae 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 _0x647c=['exports','./polly'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x647c,0x1d3));var _0xc647=function(_0x169f86,_0xadf81f){_0x169f86=_0x169f86-0x0;var _0x30cced=_0x647c[_0x169f86];return _0x30cced;};var polly=require(_0xc647('0x0'));var lex=require('./lex');module[_0xc647('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xd046=['exports','./lex'];(function(_0x3c09ba,_0x357168){var _0x1e7de9=function(_0x25f851){while(--_0x25f851){_0x3c09ba['push'](_0x3c09ba['shift']());}};_0x1e7de9(++_0x357168);}(_0xd046,0x129));var _0x6d04=function(_0x504546,_0x23c419){_0x504546=_0x504546-0x0;var _0x22d39c=_0xd046[_0x504546];return _0x22d39c;};var polly=require('./polly');var lex=require(_0x6d04('0x0'));module[_0x6d04('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b925ad5..07e1e5f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa571,0x107));var _0x1a57=function(_0x2a2424,_0x2c537b){_0x2a2424=_0x2a2424-0x0;var _0x3722a7=_0xa571[_0x2a2424];return _0x3722a7;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ 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 ece8787..b6d2d08 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(_0x3cf13f,_0x4f6283){var _0x1185db=function(_0x5adf01){while(--_0x5adf01){_0x3cf13f['push'](_0x3cf13f['shift']());}};_0x1185db(++_0x4f6283);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x4f04f4,_0xab5d45){var _0x18f560=function(_0x1eada4){while(--_0x1eada4){_0x4f04f4['push'](_0x4f04f4['shift']());}};_0x18f560(++_0xab5d45);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 5b9b3d2..90bc678 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 _0xa1e8=['./lib/api','exports'];(function(_0x3e06df,_0x2eccea){var _0x355447=function(_0xc90e6f){while(--_0xc90e6f){_0x3e06df['push'](_0x3e06df['shift']());}};_0x355447(++_0x2eccea);}(_0xa1e8,0x1c4));var _0x8a1e=function(_0x192f99,_0x5dd2f3){_0x192f99=_0x192f99-0x0;var _0xd5debd=_0xa1e8[_0x192f99];return _0xd5debd;};'use strict';var polly=require(_0x8a1e('0x0'));module[_0x8a1e('0x1')]=function(_0x477def,_0x14bdc0,_0x23febb,_0x7ca1f,_0x26c3ee,_0x2bc6a6,_0x236339){return polly(_0x477def,_0x14bdc0,_0x23febb,_0x7ca1f,_0x26c3ee,_0x2bc6a6,_0x236339);}; \ No newline at end of file +var _0x7492=['./lib/api'];(function(_0xd9910e,_0x3afa81){var _0x2537e2=function(_0x13d716){while(--_0x13d716){_0xd9910e['push'](_0xd9910e['shift']());}};_0x2537e2(++_0x3afa81);}(_0x7492,0xad));var _0x2749=function(_0x124f16,_0x53e08e){_0x124f16=_0x124f16-0x0;var _0x3a5d62=_0x7492[_0x124f16];return _0x3a5d62;};'use strict';var polly=require(_0x2749('0x0'));module['exports']=function(_0x570012,_0x51a14f,_0x390b0b,_0xc6be38,_0x5eb9bb,_0x1d0d2e,_0x53a8e0){return polly(_0x570012,_0x51a14f,_0x390b0b,_0xc6be38,_0x5eb9bb,_0x1d0d2e,_0x53a8e0);}; \ 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 2063801..0004799 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 _0x174b=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','exports','Polly'];(function(_0x1fcab8,_0x51b766){var _0x509884=function(_0x4b696e){while(--_0x4b696e){_0x1fcab8['push'](_0x1fcab8['shift']());}};_0x509884(++_0x51b766);}(_0x174b,0xbd));var _0xb174=function(_0x30c2b3,_0xafc713){_0x30c2b3=_0x30c2b3-0x0;var _0x44eab8=_0x174b[_0x30c2b3];return _0x44eab8;};'use strict';var fs=require('fs');var path=require(_0xb174('0x0'));var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var AWS=require(_0xb174('0x3'));function pollyResult(_0x490404,_0x1d3a03,_0x539ea2){return new BPromise(function(_0x2f68e0,_0x19969e){_0x490404[_0xb174('0x4')](_0x1d3a03,function(_0x13de0e,_0x33ce24){if(_0x13de0e){_0x19969e(_0x13de0e);}else if(_0x33ce24){if(_0x33ce24[_0xb174('0x5')]instanceof Buffer){fs[_0xb174('0x6')](_0x539ea2,_0x33ce24[_0xb174('0x5')],function(_0x14fff1){if(_0x14fff1){_0x19969e(_0x14fff1);}else{_0x2f68e0();}});}else{_0x19969e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x19969e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xb174('0x7')]=function(_0x26fe13,_0x56b689,_0x1c29e3,_0x386809,_0x581a4f,_0x23a6f8,_0x43e326){var _0x15c0c3=new AWS[(_0xb174('0x8'))]({'accessKeyId':_0x26fe13,'secretAccessKey':_0x56b689,'region':_0x1c29e3});var _0x3013dd={'Text':_0x581a4f,'TextType':_0x23a6f8||_0xb174('0x9'),'OutputFormat':_0xb174('0xa'),'VoiceId':_0x386809};return pollyResult(_0x15c0c3,_0x3013dd,_0x43e326);}; \ No newline at end of file +var _0x12c0=['Polly','text','bluebird','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x24c22c,_0x56ca7a){var _0x1a5654=function(_0x3cbdd3){while(--_0x3cbdd3){_0x24c22c['push'](_0x24c22c['shift']());}};_0x1a5654(++_0x56ca7a);}(_0x12c0,0x18e));var _0x012c=function(_0x471843,_0x1ead53){_0x471843=_0x471843-0x0;var _0x37945b=_0x12c0[_0x471843];return _0x37945b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x012c('0x0'));var rs=require('randomstring');var AWS=require(_0x012c('0x1'));function pollyResult(_0x97c038,_0x2c5126,_0x42115e){return new BPromise(function(_0x199857,_0x5a7581){_0x97c038['synthesizeSpeech'](_0x2c5126,function(_0x28cb2d,_0x4f0b9b){if(_0x28cb2d){_0x5a7581(_0x28cb2d);}else if(_0x4f0b9b){if(_0x4f0b9b[_0x012c('0x2')]instanceof Buffer){fs[_0x012c('0x3')](_0x42115e,_0x4f0b9b[_0x012c('0x2')],function(_0x1d7758){if(_0x1d7758){_0x5a7581(_0x1d7758);}else{_0x199857();}});}else{_0x5a7581(new Error(_0x012c('0x4')));}}else{_0x5a7581(new Error(_0x012c('0x5')));}});});}module[_0x012c('0x6')]=function(_0x4ce48d,_0x48649b,_0x37e85c,_0x2dca65,_0x2a7723,_0x2d8cc8,_0x290740){var _0x3bc8a2=new AWS[(_0x012c('0x7'))]({'accessKeyId':_0x4ce48d,'secretAccessKey':_0x48649b,'region':_0x37e85c});var _0x4d22ca={'Text':_0x2a7723,'TextType':_0x2d8cc8||_0x012c('0x8'),'OutputFormat':'mp3','VoiceId':_0x2dca65};return pollyResult(_0x3bc8a2,_0x4d22ca,_0x290740);}; \ 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 2142064..2c8edff 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 _0x3c56=['./lib/api'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x3c56,0x86));var _0x63c5=function(_0x3720f2,_0x4f5f50){_0x3720f2=_0x3720f2-0x0;var _0xae4d8a=_0x3c56[_0x3720f2];return _0xae4d8a;};'use strict';var asr=require(_0x63c5('0x0'));module['exports']=function(_0x39ec73,_0x54540e,_0x1ab803,_0x3bc9e4){return asr(_0x39ec73,_0x54540e,_0x1ab803);}; \ No newline at end of file +var _0xb544=['./lib/api'];(function(_0x148bcc,_0x58d6f7){var _0x3a60fb=function(_0x371331){while(--_0x371331){_0x148bcc['push'](_0x148bcc['shift']());}};_0x3a60fb(++_0x58d6f7);}(_0xb544,0xd5));var _0x4b54=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb544[_0x1caf6a];return _0x1bf493;};'use strict';var asr=require(_0x4b54('0x0'));module['exports']=function(_0x2872f5,_0x193dfd,_0x31e514,_0x17081e){return asr(_0x2872f5,_0x193dfd,_0x31e514);}; \ 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 a4737de..f06b7e8 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 _0xe43c=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','toString','base64','LINEAR16','url'];(function(_0x75c71f,_0x52573f){var _0x1e864a=function(_0xaaecd0){while(--_0xaaecd0){_0x75c71f['push'](_0x75c71f['shift']());}};_0x1e864a(++_0x52573f);}(_0xe43c,0x180));var _0xce43=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xe43c[_0x16b9ed];return _0x66b1f8;};'use strict';var url=require(_0xce43('0x0'));var BPromise=require(_0xce43('0x1'));var fs=require('fs');var host=_0xce43('0x2');module[_0xce43('0x3')]=function(_0x6f053b,_0x357837,_0x5baedd){return new BPromise(function(_0x415941,_0x4eed68){var _0x32b4d4;if(typeof _0x6f053b!==_0xce43('0x4')||_0x6f053b[_0xce43('0x5')]===0x0){return _0x4eed68(_0xce43('0x6'));}if(typeof _0x357837!=='string'||_0x357837[_0xce43('0x5')]===0x0){return _0x4eed68('key\x20should\x20be\x20a\x20string');}if(typeof _0x5baedd!==_0xce43('0x7')&&(typeof _0x5baedd!=='string'||_0x5baedd[_0xce43('0x5')]===0x0)){return _0x4eed68('lang\x20should\x20be\x20a\x20string');}try{_0x32b4d4=fs['readFileSync'](_0x6f053b)[_0xce43('0x8')](_0xce43('0x9'));}catch(_0x4a62bd){return _0x4eed68(_0x4a62bd);}return _0x415941({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x357837,'body':{'config':{'encoding':_0xce43('0xa'),'sampleRateHertz':'8000','languageCode':_0x5baedd},'audio':{'content':_0x32b4d4}},'json':!![]});});}; \ No newline at end of file +var _0x1b73=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1b73,0x1d5));var _0x31b7=function(_0xc5f0a4,_0x2c6af4){_0xc5f0a4=_0xc5f0a4-0x0;var _0x21d1bb=_0x1b73[_0xc5f0a4];return _0x21d1bb;};'use strict';var url=require('url');var BPromise=require(_0x31b7('0x0'));var fs=require('fs');var host=_0x31b7('0x1');module[_0x31b7('0x2')]=function(_0x5c767e,_0x4bf5ae,_0x17c0ef){return new BPromise(function(_0x59e606,_0x40fef2){var _0x3682cc;if(typeof _0x5c767e!=='string'||_0x5c767e[_0x31b7('0x3')]===0x0){return _0x40fef2(_0x31b7('0x4'));}if(typeof _0x4bf5ae!==_0x31b7('0x5')||_0x4bf5ae['length']===0x0){return _0x40fef2(_0x31b7('0x6'));}if(typeof _0x17c0ef!==_0x31b7('0x7')&&(typeof _0x17c0ef!==_0x31b7('0x5')||_0x17c0ef[_0x31b7('0x3')]===0x0)){return _0x40fef2(_0x31b7('0x8'));}try{_0x3682cc=fs[_0x31b7('0x9')](_0x5c767e)[_0x31b7('0xa')]('base64');}catch(_0x268428){return _0x40fef2(_0x268428);}return _0x59e606({'method':_0x31b7('0xb'),'uri':host+_0x31b7('0xc')+_0x4bf5ae,'body':{'config':{'encoding':_0x31b7('0xd'),'sampleRateHertz':_0x31b7('0xe'),'languageCode':_0x17c0ef},'audio':{'content':_0x3682cc}},'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 0aa3431..dd41ecd 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 _0x424a=['exports','./asr'];(function(_0x4323c9,_0x2c5612){var _0x1bdd3a=function(_0x3bf93f){while(--_0x3bf93f){_0x4323c9['push'](_0x4323c9['shift']());}};_0x1bdd3a(++_0x2c5612);}(_0x424a,0xf7));var _0xa424=function(_0x1dee2e,_0x124408){_0x1dee2e=_0x1dee2e-0x0;var _0x4ce591=_0x424a[_0x1dee2e];return _0x4ce591;};var asr=require(_0xa424('0x0'));module[_0xa424('0x1')]={'asr':asr}; \ No newline at end of file +var _0x100f=['./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x100f,0x72));var _0xf100=function(_0x57b7d8,_0x26e29f){_0x57b7d8=_0x57b7d8-0x0;var _0x4f43b8=_0x100f[_0x57b7d8];return _0x4f43b8;};var asr=require(_0xf100('0x0'));module['exports']={'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 984bb3f..b25a454 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 _0xb5a8=['Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','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','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','statusMessage','transcode','wav','finish\x20to\x20convert','tmp','generate','.wav','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','source','resolvedQuery','result','action','fulfillment','status','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR'];(function(_0x54b4f2,_0x5ce22f){var _0x1753c6=function(_0x553d12){while(--_0x553d12){_0x54b4f2['push'](_0x54b4f2['shift']());}};_0x1753c6(++_0x5ce22f);}(_0xb5a8,0x1a1));var _0x8b5a=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xb5a8[_0x4dbaad];return _0x226c72;};'use strict';var apiai=require(_0x8b5a('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x8b5a('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require(_0x8b5a('0x2'));var rs=require(_0x8b5a('0x3'));var sox=require('sox');var tts=require(_0x8b5a('0x4'));var urlParse=require('url')[_0x8b5a('0x5')];var util=require(_0x8b5a('0x6'));var aws=require(_0x8b5a('0x7'));var google=require(_0x8b5a('0x8'));var sestek=require(_0x8b5a('0x9'));var tilde=require(_0x8b5a('0xa'));var logger=require(_0x8b5a('0xb'))('agi');var ISPEECH_API=_0x8b5a('0xc');function downloadFile(_0x387709,_0x59190d){return new BPromise(function(_0x183f74,_0x104e3e){var _0x11aa86=urlParse(_0x387709);var _0x168414=_0x11aa86[_0x8b5a('0xd')]===_0x8b5a('0xe')?https:http;var _0x398f8d={'host':_0x11aa86[_0x8b5a('0xf')],'path':_0x11aa86[_0x8b5a('0x10')],'headers':{'user-agent':_0x8b5a('0x11')}};_0x168414[_0x8b5a('0x12')](_0x398f8d,function(_0xb1109d){if(_0xb1109d[_0x8b5a('0x13')]!==0xc8){logger[_0x8b5a('0x14')](_0x8b5a('0x15')+_0x387709+_0x8b5a('0x16')+_0xb1109d[_0x8b5a('0x13')]+'\x20('+_0xb1109d['statusMessage']+')');_0x104e3e(new Error(_0x8b5a('0x15')+_0x387709+'\x20failed,\x20status\x20code\x20=\x20'+_0xb1109d[_0x8b5a('0x13')]+'\x20('+_0xb1109d['statusMessage']+')'));return;}var _0x291e41=fs[_0x8b5a('0x17')](_0x59190d);_0x291e41['on'](_0x8b5a('0x18'),function(){logger[_0x8b5a('0x19')](_0x8b5a('0x1a'));_0x291e41[_0x8b5a('0x1b')](_0x183f74);});_0x291e41['on'](_0x8b5a('0x14'),function(_0x3ddc6a){fs[_0x8b5a('0x1c')](_0x59190d);logger[_0x8b5a('0x14')](_0x8b5a('0x1d'),_0x3ddc6a);_0x104e3e(_0x3ddc6a);});_0xb1109d[_0x8b5a('0x1e')](_0x291e41);})['on'](_0x8b5a('0x14'),function(_0x3ef4d7){logger[_0x8b5a('0x14')](_0x3ef4d7);_0x104e3e(_0x3ef4d7);})[_0x8b5a('0x1f')]();});}function uploadFile(_0x282f9e){return new BPromise(function(_0x547a90,_0x2106d5){var _0x5ad9bc=urlParse(_0x282f9e);var _0xc9ff0f=_0x5ad9bc['protocol']===_0x8b5a('0xe')?https:http;var _0x9b524c={'host':_0x5ad9bc[_0x8b5a('0xf')],'path':_0x5ad9bc[_0x8b5a('0x10')],'headers':{'user-agent':_0x8b5a('0x11')}};_0xc9ff0f[_0x8b5a('0x12')](_0x9b524c,function(_0x2d4bfa){if(_0x2d4bfa[_0x8b5a('0x13')]!==0xc8){_0x2106d5(new Error(_0x8b5a('0x15')+_0x282f9e+_0x8b5a('0x16')+_0x2d4bfa['statusCode']+'\x20('+_0x2d4bfa[_0x8b5a('0x20')]+')'));return;}var _0x125a70='';_0x2d4bfa['on']('data',function(_0x2d531b){_0x125a70+=_0x2d531b;});_0x2d4bfa['on']('end',function(){_0x547a90(_0x125a70);});})['on'](_0x8b5a('0x14'),function(_0xd97aba){_0x2106d5(_0xd97aba);})[_0x8b5a('0x1f')]();});}function convertFile(_0x5741e8,_0xe445a3){return new BPromise(function(_0x4e358a,_0x4da80a){var _0x2a58f2=sox[_0x8b5a('0x21')](_0x5741e8,_0xe445a3,{'sampleRate':0x1f40,'format':_0x8b5a('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a58f2['on'](_0x8b5a('0x14'),function(_0x539fbc){logger[_0x8b5a('0x14')]('error\x20convert',_0x539fbc);_0x4da80a(_0x539fbc);});_0x2a58f2['on'](_0x8b5a('0x1f'),function(){logger['info'](_0x8b5a('0x23'));_0x4e358a();});_0x2a58f2['start']();});}function base64Decode(_0x4fac78,_0x161337){var _0x16c1c6=path['resolve'](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x26'));fs['writeFileSync'](_0x16c1c6,_0x4fac78,_0x8b5a('0x27'));return convertFile(_0x16c1c6,_0x161337)[_0x8b5a('0x28')](function(){try{fs[_0x8b5a('0x1c')](_0x16c1c6);fs[_0x8b5a('0x29')](_0x161337,_0x8b5a('0x2a'));}catch(_0x1a1791){logger[_0x8b5a('0x14')](_0x1a1791);}return _0x161337['split']('.')[0x0];});}function base64Encode(_0x2a8024){var _0x534fce=fs[_0x8b5a('0x2b')](_0x2a8024);return new Buffer(_0x534fce)[_0x8b5a('0x2c')]('base64');}exports[_0x8b5a('0x2d')]=function(_0x391159,_0x4072a6,_0x10e9ea,_0x22db1c,_0x5c4194,_0xfce13b){var _0x33eca5,_0x450d3d;var _0x8469cb='https://texttospeech.googleapis.com/v1/';var _0xef8945=_0x8b5a('0x2e')+_0x391159;var _0x509c0d={};if(_0x4072a6===_0x8b5a('0x2f')){_0x509c0d[_0x8b5a('0x30')]={'ssml':_0x10e9ea};}else{_0x509c0d['input']={'text':_0x10e9ea};};_0x509c0d[_0x8b5a('0x31')]={'languageCode':_0x22db1c,'ssmlGender':_0x5c4194};_0x509c0d[_0x8b5a('0x32')]={'audioEncoding':_0x8b5a('0x33'),'sampleRateHertz':0x1f40};var _0x47363e={'url':_0x8469cb+_0x8b5a('0x34')+_0xef8945,'method':_0x8b5a('0x35'),'json':!![],'body':_0x509c0d};return rp(_0x47363e)['then'](function(_0x5dec45){return new BPromise(function(_0x18ad23,_0xda1407){_0x33eca5=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x37'));var _0xad735=Buffer[_0x8b5a('0x38')](_0x5dec45['audioContent'],'base64');return fs[_0x8b5a('0x39')](_0x33eca5,_0xad735,function(_0x2d5ecb){_0xda1407(_0x2d5ecb);},function(_0x1e2977){fs[_0x8b5a('0x29')](_0x33eca5,'777');_0x18ad23(_0x1e2977);});});})[_0x8b5a('0x28')](function(_0x221f5d){_0x450d3d=path['resolve'](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x26'));return convertFile(_0x33eca5,_0x450d3d);})[_0x8b5a('0x28')](function(){try{fs[_0x8b5a('0x1c')](_0x33eca5);fs[_0x8b5a('0x29')](_0x450d3d,_0x8b5a('0x2a'));}catch(_0x517236){logger[_0x8b5a('0x14')](_0x517236);}logger['info'](_0x8b5a('0x3a'),_0x450d3d[_0x8b5a('0x3b')]('.')[0x0]);return _0x450d3d[_0x8b5a('0x3b')]('.')[0x0];});};exports[_0x8b5a('0x3c')]=function(_0x20236b,_0x41b45a){var _0x13e062=_0x8b5a('0x3d');var _0x9207bc,_0x366564;var _0x2ed86b;var _0x5ad9d2={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x13e062,'headers':{'Content-Type':_0x8b5a('0x3e')},'body':'f.req='+encodeURIComponent(JSON[_0x8b5a('0x3f')]([[[_0x8b5a('0x40'),JSON[_0x8b5a('0x3f')]([_0x20236b,_0x41b45a||'en',![],_0x8b5a('0x41')]),null,_0x8b5a('0x42')]]]))};return rp(_0x5ad9d2)[_0x8b5a('0x28')](function(_0x21baf5){try{_0x2ed86b=eval(_0x21baf5[_0x8b5a('0x43')](0x5))[0x0][0x2];}catch(_0x3466f7){throw new Error(_0x8b5a('0x44')+_0x21baf5[_0x8b5a('0x45')]);}if(!_0x2ed86b){if(_0x20236b[_0x8b5a('0x46')]>0xc8){throw new Error(_0x8b5a('0x47'));}else{throw new Error('lang\x20\x22'+_0x41b45a+'\x22\x20might\x20not\x20exist');}}try{_0x2ed86b=eval(_0x2ed86b)[0x0];}catch(_0x319848){throw new Error(_0x8b5a('0x44')+res[_0x8b5a('0x45')]);}const _0xd7941a=_0x2ed86b;_0x9207bc=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x37'));fs[_0x8b5a('0x48')](_0x9207bc,_0x2ed86b,{'encoding':'base64'});_0x366564=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs['generate'](0x4)+_0x8b5a('0x26'));return convertFile(_0x9207bc,_0x366564);})['then'](function(){try{fs[_0x8b5a('0x1c')](_0x9207bc);fs[_0x8b5a('0x29')](_0x366564,_0x8b5a('0x2a'));}catch(_0x518970){logger[_0x8b5a('0x14')](_0x518970);}logger[_0x8b5a('0x19')](_0x8b5a('0x49'),_0x366564[_0x8b5a('0x3b')]('.')[0x0]);return _0x366564['split']('.')[0x0];});};exports[_0x8b5a('0x4a')]=function(_0x54047e,_0x19ebe8,_0x3bbd08){return google[_0x8b5a('0x4b')](_0x54047e,_0x19ebe8,_0x3bbd08)[_0x8b5a('0x28')](function(_0xbb9df1){logger[_0x8b5a('0x19')](_0xbb9df1[_0x8b5a('0x4c')]);return rp(_0xbb9df1);})['then'](function(_0x173516){var _0x2b5807='';var _0x26bc4b=0x0;try{fs['unlink'](_0x54047e);}catch(_0x3480b2){logger['error'](_0x3480b2);}if(_0x173516&&_0x173516[_0x8b5a('0x4d')]){_0x2b5807=_0x173516[_0x8b5a('0x4d')][_0x8b5a('0x4e')](function(_0x1f4dd4){return _0x1f4dd4&&_0x1f4dd4[_0x8b5a('0x4f')][0x0]&&_0x1f4dd4['alternatives'][0x0][_0x8b5a('0x50')]?_0x1f4dd4[_0x8b5a('0x4f')][0x0][_0x8b5a('0x50')]:'';})[_0x8b5a('0x51')]('\x0a');_0x26bc4b=_0x173516[_0x8b5a('0x4d')]['map'](function(_0x131f2f){return _0x131f2f&&_0x131f2f['alternatives'][0x0]&&_0x131f2f['alternatives'][0x0][_0x8b5a('0x52')]?_0x131f2f[_0x8b5a('0x4f')][0x0]['confidence']:0x0;})[_0x8b5a('0x51')]('\x0a');}logger[_0x8b5a('0x19')](_0x8b5a('0x53'),_0x2b5807);logger[_0x8b5a('0x19')](_0x8b5a('0x54'),_0x26bc4b);return{'transcript':_0x2b5807,'confidence':_0x26bc4b};})['catch'](function(_0x440a9f){logger[_0x8b5a('0x14')](_0x8b5a('0x55'),_0x440a9f[_0x8b5a('0x13')],_0x440a9f[_0x8b5a('0x56')],_0x440a9f[_0x8b5a('0x57')]);});};exports['googleDialogflow']=function(_0x57657d,_0x43704e,_0x5b4d96,_0x4a557a){var _0x67bc3b=apiai(_0x43704e,{'language':_0x4a557a||'en'});return _0x67bc3b[_0x8b5a('0x58')](_0x5b4d96,{'sessionId':md5(_0x57657d)})[_0x8b5a('0x28')](function(_0x24d5fd){logger[_0x8b5a('0x19')](JSON[_0x8b5a('0x3f')](_0x24d5fd));return{'source':_0x24d5fd['result'][_0x8b5a('0x59')],'resolvedQuery':_0x24d5fd['result'][_0x8b5a('0x5a')],'action':_0x24d5fd[_0x8b5a('0x5b')][_0x8b5a('0x5c')],'actionIncomplete':_0x24d5fd[_0x8b5a('0x5b')]['actionIncomplete'],'speech':_0x24d5fd['result'][_0x8b5a('0x5d')]['speech'],'score':_0x24d5fd[_0x8b5a('0x5b')]['score'],'statusCode':_0x24d5fd[_0x8b5a('0x5e')][_0x8b5a('0x5f')],'endConversation':_0x24d5fd['result']['metadata'][_0x8b5a('0x60')]||![],'isFallbackIntent':_0x24d5fd[_0x8b5a('0x5b')]['metadata'][_0x8b5a('0x61')]};});};exports[_0x8b5a('0x62')]=function(_0x4670b8,_0x52d589,_0x57941c,_0x4558a7,_0x115dee,_0x101f8d){var _0x5d242b=_0x4558a7[_0x8b5a('0x63')](/\\n/g,'\x0a');var _0x4423aa={'credentials':{'private_key':_0x5d242b,'client_email':_0x57941c}};var _0x3faa83=new dialogflow[(_0x8b5a('0x64'))](_0x4423aa);var _0x3e347b=_0x3faa83['sessionPath'](_0x52d589,md5(_0x4670b8));var _0x11e8a3={'session':_0x3e347b,'queryInput':{'text':{'text':_0x115dee,'languageCode':_0x101f8d}}};return _0x3faa83[_0x8b5a('0x65')](_0x11e8a3)[_0x8b5a('0x28')](function(_0x45e9fc){if(_0x45e9fc&&_0x45e9fc[_0x8b5a('0x46')]){logger[_0x8b5a('0x19')](_0x8b5a('0x66'),JSON[_0x8b5a('0x3f')](_0x45e9fc));var _0x232531=_0x45e9fc[0x0];if(_0x232531){var _0x4bb68f={'action':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x5c')],'allRequiredParamsPresent':_0x232531[_0x8b5a('0x67')]['allRequiredParamsPresent'],'endConversation':_0x232531['queryResult'][_0x8b5a('0x68')]&&_0x232531[_0x8b5a('0x67')][_0x8b5a('0x68')][_0x8b5a('0x69')]?_0x232531[_0x8b5a('0x67')][_0x8b5a('0x68')]['fields'][_0x8b5a('0x6a')]['boolValue']:![],'fulfillmentText':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x6b')],'intentName':_0x232531['queryResult'][_0x8b5a('0x6c')][_0x8b5a('0x56')],'intentDisplayName':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x6c')]['displayName'],'isFallbackIntent':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x6c')][_0x8b5a('0x6d')],'languageCode':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x6e')],'queryText':_0x232531['queryResult'][_0x8b5a('0x6f')],'responseId':_0x232531[_0x8b5a('0x70')],'score':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x71')],'speech':_0x232531[_0x8b5a('0x67')][_0x8b5a('0x6b')],'providerResponse':JSON[_0x8b5a('0x3f')](_0x45e9fc)};return _0x4bb68f;}}});};exports[_0x8b5a('0x72')]=function(_0x2d0215,_0x47af80,_0x373b26,_0x491664){return tilde[_0x8b5a('0x4b')](_0x2d0215,_0x47af80,_0x373b26,_0x491664)[_0x8b5a('0x28')](function(_0x24cb3f){try{fs['unlink'](_0x2d0215);}catch(_0x3f3688){logger[_0x8b5a('0x14')](_0x3f3688);}logger[_0x8b5a('0x19')](_0x8b5a('0x73'),_0x24cb3f[_0x8b5a('0x50')]);logger[_0x8b5a('0x19')](_0x8b5a('0x74'),_0x24cb3f[_0x8b5a('0x52')]);return _0x24cb3f;});};exports[_0x8b5a('0x75')]=function(_0x3c9413,_0x20ee6b,_0x3a6712,_0x3cc267,_0x3b029d,_0x34e39b){var _0x3f1359=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x37'));var _0x47eae8;return aws[_0x8b5a('0x76')](_0x3c9413,_0x20ee6b,_0x3a6712,_0x3cc267,_0x3b029d,_0x34e39b,_0x3f1359)[_0x8b5a('0x28')](function(){_0x47eae8=path['resolve'](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x26'));return convertFile(_0x3f1359,_0x47eae8);})['then'](function(){try{fs[_0x8b5a('0x1c')](_0x3f1359);fs[_0x8b5a('0x29')](_0x47eae8,_0x8b5a('0x2a'));}catch(_0x44756d){logger[_0x8b5a('0x14')](_0x44756d);}return _0x47eae8['split']('.')[0x0];});};exports['awsLex']=function(_0x4657b8,_0x3eafff,_0x3dd611,_0x471fd0,_0x3eb877,_0x251ecf){return aws[_0x8b5a('0x77')](_0x4657b8,_0x3eafff,_0x3dd611,_0x471fd0,_0x3eb877,_0x251ecf)[_0x8b5a('0x28')](function(_0x29a686){logger[_0x8b5a('0x19')](JSON[_0x8b5a('0x3f')](_0x29a686));return _0x29a686;});};exports[_0x8b5a('0x78')]=function(_0x113cc8,_0x1865a9,_0x4036a9,_0x4e9e32){var _0xa7b989=util[_0x8b5a('0x79')](_0x8b5a('0x7a'),ISPEECH_API,_0x113cc8,encodeURIComponent(_0x1865a9),_0x4036a9,_0x4e9e32);var _0x5c3fa8=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs['generate'](0x4)+_0x8b5a('0x37'));var _0x4ada0e;return downloadFile(_0xa7b989,_0x5c3fa8)[_0x8b5a('0x28')](function(){_0x4ada0e=path[_0x8b5a('0x36')](__dirname,_0x8b5a('0x24'),rs[_0x8b5a('0x25')](0x4)+_0x8b5a('0x26'));return convertFile(_0x5c3fa8,_0x4ada0e);})[_0x8b5a('0x28')](function(){try{fs[_0x8b5a('0x1c')](_0x5c3fa8);fs[_0x8b5a('0x29')](_0x4ada0e,'777');}catch(_0x114a2f){logger[_0x8b5a('0x14')](_0x114a2f);}return _0x4ada0e['split']('.')[0x0];});};exports[_0x8b5a('0x7b')]=function(_0x4e840c,_0x2eda4a,_0x5567f4,_0x490de8){var _0x597c5f=util['format'](_0x8b5a('0x7c'),ISPEECH_API,_0x2eda4a,_0x5567f4,base64Encode(_0x4e840c),_0x490de8?util[_0x8b5a('0x79')]('model=%s',encodeURIComponent(_0x490de8)):_0x8b5a('0x7d'));return uploadFile(_0x597c5f)[_0x8b5a('0x28')](function(_0x2495d0){return querystring[_0x8b5a('0x5')](_0x2495d0);});};exports[_0x8b5a('0x7e')]=function(_0x354dfa,_0x31a088){return sestek[_0x8b5a('0x7f')](_0x354dfa,_0x31a088)[_0x8b5a('0x28')](function(_0x5cf9e4){logger[_0x8b5a('0x19')](JSON[_0x8b5a('0x3f')](_0x5cf9e4));var _0x313a28={'speech':_0x5cf9e4['text'],'action':_0x5cf9e4[_0x8b5a('0x80')]?_0x5cf9e4[_0x8b5a('0x80')][_0x8b5a('0x81')]:undefined,'actiondata':_0x5cf9e4['channelData']?_0x5cf9e4[_0x8b5a('0x80')]['CustomActionData']:undefined};if(_0x5cf9e4[_0x8b5a('0x80')]&&_0x5cf9e4[_0x8b5a('0x80')]['AudioFromTts']){return base64Decode(_0x5cf9e4['channelData'][_0x8b5a('0x82')][_0x8b5a('0x83')],path['resolve'](__dirname,'tmp',rs[_0x8b5a('0x25')](0x4)+'.wav'))[_0x8b5a('0x28')](function(_0x4533ba){_0x313a28[_0x8b5a('0x84')]=_0x4533ba;return _0x313a28;});}return _0x313a28;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x7f27=['queryText','responseId','intentDetectionConfidence','fulfillmentText','asr','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','base64','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','then','resolve','.mp3','audioContent','777','.wav','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','results','alternatives','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','status','code','metadata','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f27,0x195));var _0x77f2=function(_0x1e2e5a,_0x11296d){_0x1e2e5a=_0x1e2e5a-0x0;var _0x56a04e=_0x7f27[_0x1e2e5a];return _0x56a04e;};'use strict';var apiai=require(_0x77f2('0x0'));var BPromise=require(_0x77f2('0x1'));var dialogflow=require(_0x77f2('0x2'));var fs=require('fs');var http=require(_0x77f2('0x3'));var https=require('https');var md5=require('md5');var path=require(_0x77f2('0x4'));var querystring=require(_0x77f2('0x5'));var rp=require(_0x77f2('0x6'));var rs=require(_0x77f2('0x7'));var sox=require(_0x77f2('0x8'));var tts=require(_0x77f2('0x9'));var urlParse=require(_0x77f2('0xa'))[_0x77f2('0xb')];var util=require('util');var aws=require(_0x77f2('0xc'));var google=require(_0x77f2('0xd'));var sestek=require('./sestek');var tilde=require(_0x77f2('0xe'));var logger=require('../../../config/logger')(_0x77f2('0xf'));var ISPEECH_API=_0x77f2('0x10');function downloadFile(_0x2e6ea7,_0x2a76a2){return new BPromise(function(_0x7ef75,_0x34ca51){var _0x2b62cf=urlParse(_0x2e6ea7);var _0x4078a5=_0x2b62cf[_0x77f2('0x11')]===_0x77f2('0x12')?https:http;var _0x142928={'host':_0x2b62cf['host'],'path':_0x2b62cf[_0x77f2('0x4')],'headers':{'user-agent':_0x77f2('0x13')}};_0x4078a5[_0x77f2('0x14')](_0x142928,function(_0xb2e8e4){if(_0xb2e8e4[_0x77f2('0x15')]!==0xc8){logger[_0x77f2('0x16')](_0x77f2('0x17')+_0x2e6ea7+_0x77f2('0x18')+_0xb2e8e4[_0x77f2('0x15')]+'\x20('+_0xb2e8e4[_0x77f2('0x19')]+')');_0x34ca51(new Error('request\x20to\x20'+_0x2e6ea7+_0x77f2('0x18')+_0xb2e8e4[_0x77f2('0x15')]+'\x20('+_0xb2e8e4['statusMessage']+')'));return;}var _0x1e46a2=fs['createWriteStream'](_0x2a76a2);_0x1e46a2['on']('finish',function(){logger[_0x77f2('0x1a')]('finish\x20download\x20file');_0x1e46a2[_0x77f2('0x1b')](_0x7ef75);});_0x1e46a2['on'](_0x77f2('0x16'),function(_0x5b17c5){fs[_0x77f2('0x1c')](_0x2a76a2);logger[_0x77f2('0x16')](_0x77f2('0x1d'),_0x5b17c5);_0x34ca51(_0x5b17c5);});_0xb2e8e4[_0x77f2('0x1e')](_0x1e46a2);})['on'](_0x77f2('0x16'),function(_0x223e96){logger['error'](_0x223e96);_0x34ca51(_0x223e96);})[_0x77f2('0x1f')]();});}function uploadFile(_0xba2a58){return new BPromise(function(_0x4bae18,_0xf746ef){var _0x33a9ce=urlParse(_0xba2a58);var _0x27d037=_0x33a9ce[_0x77f2('0x11')]===_0x77f2('0x12')?https:http;var _0xe9e347={'host':_0x33a9ce['host'],'path':_0x33a9ce[_0x77f2('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x27d037[_0x77f2('0x14')](_0xe9e347,function(_0x1cb005){if(_0x1cb005[_0x77f2('0x15')]!==0xc8){_0xf746ef(new Error(_0x77f2('0x17')+_0xba2a58+_0x77f2('0x18')+_0x1cb005['statusCode']+'\x20('+_0x1cb005[_0x77f2('0x19')]+')'));return;}var _0x45c712='';_0x1cb005['on'](_0x77f2('0x20'),function(_0x16e7f3){_0x45c712+=_0x16e7f3;});_0x1cb005['on']('end',function(){_0x4bae18(_0x45c712);});})['on']('error',function(_0x2aa63f){_0xf746ef(_0x2aa63f);})[_0x77f2('0x1f')]();});}function convertFile(_0x5223e0,_0x12976d){return new BPromise(function(_0x1993ae,_0x25654c){var _0x51c91d=sox[_0x77f2('0x21')](_0x5223e0,_0x12976d,{'sampleRate':0x1f40,'format':_0x77f2('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51c91d['on'](_0x77f2('0x16'),function(_0x3b065c){logger[_0x77f2('0x16')](_0x77f2('0x23'),_0x3b065c);_0x25654c(_0x3b065c);});_0x51c91d['on'](_0x77f2('0x1f'),function(){logger['info'](_0x77f2('0x24'));_0x1993ae();});_0x51c91d[_0x77f2('0x25')]();});}function base64Decode(_0x1c224e,_0xdcb594){var _0x4c4759=path['resolve'](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+'.wav');fs[_0x77f2('0x28')](_0x4c4759,_0x1c224e,_0x77f2('0x29'));return convertFile(_0x4c4759,_0xdcb594)['then'](function(){try{fs[_0x77f2('0x1c')](_0x4c4759);fs['chmodSync'](_0xdcb594,'777');}catch(_0x54c7d9){logger[_0x77f2('0x16')](_0x54c7d9);}return _0xdcb594[_0x77f2('0x2a')]('.')[0x0];});}function base64Encode(_0x498787){var _0x546ded=fs[_0x77f2('0x2b')](_0x498787);return new Buffer(_0x546ded)[_0x77f2('0x2c')](_0x77f2('0x29'));}exports['googleCloudTTS']=function(_0x5c1c59,_0x127cb9,_0x2334f9,_0x3ad9df,_0x3b2dc6,_0x445019){var _0xce35e1,_0x4e60ed;var _0x5a63bf=_0x77f2('0x2d');var _0x231246=_0x77f2('0x2e')+_0x5c1c59;var _0x4ceffc={};if(_0x127cb9===_0x77f2('0x2f')){_0x4ceffc['input']={'ssml':_0x2334f9};}else{_0x4ceffc[_0x77f2('0x30')]={'text':_0x2334f9};};_0x4ceffc[_0x77f2('0x31')]={'languageCode':_0x3ad9df,'ssmlGender':_0x3b2dc6};_0x4ceffc['audioConfig']={'audioEncoding':_0x77f2('0x32'),'sampleRateHertz':0x1f40};var _0x2be2ab={'url':_0x5a63bf+'text:synthesize'+_0x231246,'method':'POST','json':!![],'body':_0x4ceffc};return rp(_0x2be2ab)[_0x77f2('0x33')](function(_0x5b0ad7){return new BPromise(function(_0x13f78c,_0x49a489){_0xce35e1=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));var _0x309513=Buffer['from'](_0x5b0ad7[_0x77f2('0x36')],_0x77f2('0x29'));return fs['writeFile'](_0xce35e1,_0x309513,function(_0xa33d49){_0x49a489(_0xa33d49);},function(_0x2f2563){fs['chmodSync'](_0xce35e1,_0x77f2('0x37'));_0x13f78c(_0x2f2563);});});})[_0x77f2('0x33')](function(_0x33bcda){_0x4e60ed=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38'));return convertFile(_0xce35e1,_0x4e60ed);})['then'](function(){try{fs['unlink'](_0xce35e1);fs[_0x77f2('0x39')](_0x4e60ed,_0x77f2('0x37'));}catch(_0x1e78a5){logger[_0x77f2('0x16')](_0x1e78a5);}logger[_0x77f2('0x1a')](_0x77f2('0x3a'),_0x4e60ed[_0x77f2('0x2a')]('.')[0x0]);return _0x4e60ed[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x3b')]=function(_0x3ba700,_0x28a893){var _0x45a7b6=_0x77f2('0x3c');var _0x3b9abe,_0x3c0dfa;var _0x3ecbc2;var _0x6c2337={'encoding':_0x77f2('0x3d'),'method':_0x77f2('0x3e'),'timeout':0x2710,'url':_0x45a7b6,'headers':{'Content-Type':_0x77f2('0x3f')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x77f2('0x40'),JSON[_0x77f2('0x41')]([_0x3ba700,_0x28a893||'en',![],_0x77f2('0x42')]),null,_0x77f2('0x43')]]]))};return rp(_0x6c2337)['then'](function(_0x21c1a4){try{_0x3ecbc2=eval(_0x21c1a4['slice'](0x5))[0x0][0x2];}catch(_0x153dc5){throw new Error(_0x77f2('0x44')+_0x21c1a4[_0x77f2('0x20')]);}if(!_0x3ecbc2){if(_0x3ba700[_0x77f2('0x45')]>0xc8){throw new Error(_0x77f2('0x46'));}else{throw new Error(_0x77f2('0x47')+_0x28a893+_0x77f2('0x48'));}}try{_0x3ecbc2=eval(_0x3ecbc2)[0x0];}catch(_0x42322b){throw new Error(_0x77f2('0x44')+res['data']);}const _0x24e233=_0x3ecbc2;_0x3b9abe=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));fs[_0x77f2('0x28')](_0x3b9abe,_0x3ecbc2,{'encoding':_0x77f2('0x29')});_0x3c0dfa=path[_0x77f2('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x77f2('0x38'));return convertFile(_0x3b9abe,_0x3c0dfa);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0x3b9abe);fs[_0x77f2('0x39')](_0x3c0dfa,_0x77f2('0x37'));}catch(_0x216014){logger[_0x77f2('0x16')](_0x216014);}logger['info']('goggleTTS\x20path',_0x3c0dfa['split']('.')[0x0]);return _0x3c0dfa[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x49')]=function(_0xaf2bbf,_0x3a8b6f,_0x259b33){return google['asr'](_0xaf2bbf,_0x3a8b6f,_0x259b33)[_0x77f2('0x33')](function(_0x3ddd9d){logger[_0x77f2('0x1a')](_0x3ddd9d['uri']);return rp(_0x3ddd9d);})[_0x77f2('0x33')](function(_0x4220c9){var _0x3f331d='';var _0x568093=0x0;try{fs[_0x77f2('0x1c')](_0xaf2bbf);}catch(_0x47803f){logger[_0x77f2('0x16')](_0x47803f);}if(_0x4220c9&&_0x4220c9[_0x77f2('0x4a')]){_0x3f331d=_0x4220c9[_0x77f2('0x4a')]['map'](function(_0x215310){return _0x215310&&_0x215310[_0x77f2('0x4b')][0x0]&&_0x215310[_0x77f2('0x4b')][0x0]['transcript']?_0x215310[_0x77f2('0x4b')][0x0]['transcript']:'';})[_0x77f2('0x4c')]('\x0a');_0x568093=_0x4220c9[_0x77f2('0x4a')][_0x77f2('0x4d')](function(_0x20d8ce){return _0x20d8ce&&_0x20d8ce[_0x77f2('0x4b')][0x0]&&_0x20d8ce[_0x77f2('0x4b')][0x0]['confidence']?_0x20d8ce[_0x77f2('0x4b')][0x0][_0x77f2('0x4e')]:0x0;})['join']('\x0a');}logger[_0x77f2('0x1a')](_0x77f2('0x4f'),_0x3f331d);logger[_0x77f2('0x1a')](_0x77f2('0x50'),_0x568093);return{'transcript':_0x3f331d,'confidence':_0x568093};})['catch'](function(_0x59eac3){logger[_0x77f2('0x16')](_0x77f2('0x51'),_0x59eac3[_0x77f2('0x15')],_0x59eac3[_0x77f2('0x52')],_0x59eac3[_0x77f2('0x53')]);});};exports['googleDialogflow']=function(_0x13c3fb,_0x1c32a2,_0x37e6fc,_0x4d5123){var _0x23951c=apiai(_0x1c32a2,{'language':_0x4d5123||'en'});return _0x23951c[_0x77f2('0x54')](_0x37e6fc,{'sessionId':md5(_0x13c3fb)})['then'](function(_0x5a638d){logger[_0x77f2('0x1a')](JSON[_0x77f2('0x41')](_0x5a638d));return{'source':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x56')],'resolvedQuery':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x57')],'action':_0x5a638d[_0x77f2('0x55')]['action'],'actionIncomplete':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x58')],'speech':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x59')]['speech'],'score':_0x5a638d[_0x77f2('0x55')]['score'],'statusCode':_0x5a638d[_0x77f2('0x5a')][_0x77f2('0x5b')],'endConversation':_0x5a638d[_0x77f2('0x55')][_0x77f2('0x5c')]['endConversation']||![],'isFallbackIntent':_0x5a638d[_0x77f2('0x55')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x2081f4,_0xb1cfcc,_0x42bb4f,_0x32c635,_0x19b16f,_0x333899){var _0x4328fa=_0x32c635[_0x77f2('0x5d')](/\\n/g,'\x0a');var _0x25907a={'credentials':{'private_key':_0x4328fa,'client_email':_0x42bb4f}};var _0x2fefac=new dialogflow[(_0x77f2('0x5e'))](_0x25907a);var _0x1b5fce=_0x2fefac['sessionPath'](_0xb1cfcc,md5(_0x2081f4));var _0xa17879={'session':_0x1b5fce,'queryInput':{'text':{'text':_0x19b16f,'languageCode':_0x333899}}};return _0x2fefac[_0x77f2('0x5f')](_0xa17879)[_0x77f2('0x33')](function(_0x53257e){if(_0x53257e&&_0x53257e['length']){logger[_0x77f2('0x1a')](_0x77f2('0x60'),JSON[_0x77f2('0x41')](_0x53257e));var _0xc4c3ed=_0x53257e[0x0];if(_0xc4c3ed){var _0x1672f6={'action':_0xc4c3ed['queryResult'][_0x77f2('0x61')],'allRequiredParamsPresent':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x63')],'endConversation':_0xc4c3ed[_0x77f2('0x62')]['diagnosticInfo']&&_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x64')]['fields']?_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x64')][_0x77f2('0x65')][_0x77f2('0x66')]['boolValue']:![],'fulfillmentText':_0xc4c3ed[_0x77f2('0x62')]['fulfillmentText'],'intentName':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x67')]['name'],'intentDisplayName':_0xc4c3ed[_0x77f2('0x62')]['intent'][_0x77f2('0x68')],'isFallbackIntent':_0xc4c3ed['queryResult'][_0x77f2('0x67')][_0x77f2('0x69')],'languageCode':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6a')],'queryText':_0xc4c3ed['queryResult'][_0x77f2('0x6b')],'responseId':_0xc4c3ed[_0x77f2('0x6c')],'score':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6d')],'speech':_0xc4c3ed[_0x77f2('0x62')][_0x77f2('0x6e')],'providerResponse':JSON[_0x77f2('0x41')](_0x53257e)};return _0x1672f6;}}});};exports['tildeASR']=function(_0xaa898c,_0x249c07,_0x152f85,_0x372271){return tilde[_0x77f2('0x6f')](_0xaa898c,_0x249c07,_0x152f85,_0x372271)[_0x77f2('0x33')](function(_0x361840){try{fs['unlink'](_0xaa898c);}catch(_0x38ad98){logger[_0x77f2('0x16')](_0x38ad98);}logger['info'](_0x77f2('0x70'),_0x361840[_0x77f2('0x71')]);logger['info'](_0x77f2('0x72'),_0x361840[_0x77f2('0x4e')]);return _0x361840;});};exports['awsPolly']=function(_0x45d94a,_0x127c37,_0x2d6142,_0x4c0102,_0x42f98b,_0x5b00c4){var _0xe784c6=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x35'));var _0x2bc2f6;return aws[_0x77f2('0x73')](_0x45d94a,_0x127c37,_0x2d6142,_0x4c0102,_0x42f98b,_0x5b00c4,_0xe784c6)[_0x77f2('0x33')](function(){_0x2bc2f6=path[_0x77f2('0x34')](__dirname,'tmp',rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38'));return convertFile(_0xe784c6,_0x2bc2f6);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0xe784c6);fs[_0x77f2('0x39')](_0x2bc2f6,_0x77f2('0x37'));}catch(_0x1f5002){logger[_0x77f2('0x16')](_0x1f5002);}return _0x2bc2f6[_0x77f2('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x3e3765,_0x247d66,_0x50066a,_0x2b1b1e,_0x403ace,_0x25d2c5){return aws[_0x77f2('0x74')](_0x3e3765,_0x247d66,_0x50066a,_0x2b1b1e,_0x403ace,_0x25d2c5)[_0x77f2('0x33')](function(_0x26eb5d){logger[_0x77f2('0x1a')](JSON[_0x77f2('0x41')](_0x26eb5d));return _0x26eb5d;});};exports[_0x77f2('0x75')]=function(_0xbd8df6,_0xd5132,_0x253789,_0x4457c4){var _0x1c4bc2=util['format'](_0x77f2('0x76'),ISPEECH_API,_0xbd8df6,encodeURIComponent(_0xd5132),_0x253789,_0x4457c4);var _0x2429ea=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs['generate'](0x4)+_0x77f2('0x35'));var _0x16c8e7;return downloadFile(_0x1c4bc2,_0x2429ea)['then'](function(){_0x16c8e7=path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+'.wav');return convertFile(_0x2429ea,_0x16c8e7);})[_0x77f2('0x33')](function(){try{fs[_0x77f2('0x1c')](_0x2429ea);fs[_0x77f2('0x39')](_0x16c8e7,_0x77f2('0x37'));}catch(_0x2ae56a){logger[_0x77f2('0x16')](_0x2ae56a);}return _0x16c8e7[_0x77f2('0x2a')]('.')[0x0];});};exports[_0x77f2('0x77')]=function(_0x59d348,_0x44dfdb,_0x193fa9,_0x4fb392){var _0x5641b2=util[_0x77f2('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x44dfdb,_0x193fa9,base64Encode(_0x59d348),_0x4fb392?util[_0x77f2('0x78')]('model=%s',encodeURIComponent(_0x4fb392)):'freeform=3');return uploadFile(_0x5641b2)[_0x77f2('0x33')](function(_0x1271ff){return querystring[_0x77f2('0xb')](_0x1271ff);});};exports['sestekNDA']=function(_0x5cc467,_0x4bf71a){return sestek[_0x77f2('0x79')](_0x5cc467,_0x4bf71a)[_0x77f2('0x33')](function(_0xb4722f){logger['info'](JSON[_0x77f2('0x41')](_0xb4722f));var _0x5fa09d={'speech':_0xb4722f['text'],'action':_0xb4722f['channelData']?_0xb4722f[_0x77f2('0x7a')]['CustomAction']:undefined,'actiondata':_0xb4722f[_0x77f2('0x7a')]?_0xb4722f[_0x77f2('0x7a')][_0x77f2('0x7b')]:undefined};if(_0xb4722f['channelData']&&_0xb4722f[_0x77f2('0x7a')]['AudioFromTts']){return base64Decode(_0xb4722f[_0x77f2('0x7a')][_0x77f2('0x7c')][_0x77f2('0x7d')],path[_0x77f2('0x34')](__dirname,_0x77f2('0x26'),rs[_0x77f2('0x27')](0x4)+_0x77f2('0x38')))[_0x77f2('0x33')](function(_0x101d72){_0x5fa09d[_0x77f2('0x7e')]=_0x101d72;return _0x5fa09d;});}return _0x5fa09d;});};exports[_0x77f2('0x7f')]=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 e1d5cf3..3fb3138 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 _0x6b63=['exports','./nda'];(function(_0x486d87,_0x255d5e){var _0x20b59e=function(_0x3f2a55){while(--_0x3f2a55){_0x486d87['push'](_0x486d87['shift']());}};_0x20b59e(++_0x255d5e);}(_0x6b63,0x1db));var _0x36b6=function(_0x465c30,_0x37a7ac){_0x465c30=_0x465c30-0x0;var _0x34b074=_0x6b63[_0x465c30];return _0x34b074;};var nda=require(_0x36b6('0x0'));module[_0x36b6('0x1')]={'nda':nda}; \ No newline at end of file +var _0x9763=['./nda'];(function(_0x45ce91,_0x1c8c8b){var _0xc17b51=function(_0x38527f){while(--_0x38527f){_0x45ce91['push'](_0x45ce91['shift']());}};_0xc17b51(++_0x1c8c8b);}(_0x9763,0x10c));var _0x3976=function(_0x27470d,_0x20ad27){_0x27470d=_0x27470d-0x0;var _0x2cab2b=_0x9763[_0x27470d];return _0x2cab2b;};var nda=require(_0x3976('0x0'));module['exports']={'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 b27676d..ed89476 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 _0xfd6f=['ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','dnid','extension','text','access_token','project','channelData'];(function(_0x496b5a,_0x298e55){var _0x3d1b5d=function(_0x2da3d9){while(--_0x2da3d9){_0x496b5a['push'](_0x496b5a['shift']());}};_0x3d1b5d(++_0x298e55);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5e7e1d,_0x163b9a){_0x5e7e1d=_0x5e7e1d-0x0;var _0x2850d0=_0xfd6f[_0x5e7e1d];return _0x2850d0;};'use strict';var rp=require(_0xffd6('0x0'));var url=require(_0xffd6('0x1'));var logger=require(_0xffd6('0x2'))(_0xffd6('0x3'));module[_0xffd6('0x4')]=function(_0x595470,_0xb84411){var _0x1e3b9b={'method':_0xffd6('0x5'),'uri':url[_0xffd6('0x6')](_0xb84411['ndauth_url'],_0xffd6('0x7')),'form':{'grant_type':_0xffd6('0x8'),'username':_0xb84411[_0xffd6('0x9')],'password':_0xb84411[_0xffd6('0x8')]},'json':!![]};return rp(_0x1e3b9b)['then'](function(_0x3f9538){var _0x534a1b={'method':'POST','uri':url['resolve'](_0xb84411[_0xffd6('0xa')],_0xffd6('0xb')),'body':{'type':_0xb84411[_0xffd6('0xc')]||_0xffd6('0xd'),'channelId':'Nda','conversation':{'id':_0x595470[_0xffd6('0xe')]},'from':{'id':_0x595470['callerid'],'name':_0x595470['calleridname']},'recipient':{'id':_0x595470[_0xffd6('0xf')],'name':_0x595470[_0xffd6('0x10')]},'text':_0xb84411[_0xffd6('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3f9538[_0xffd6('0x12')]},'json':!![]};if(_0xb84411[_0xffd6('0x13')]){_0x534a1b['body'][_0xffd6('0x14')][_0xffd6('0x15')]=_0xb84411[_0xffd6('0x13')];}if(_0xb84411[_0xffd6('0x16')]=='1'){_0x534a1b['body']['channelData'][_0xffd6('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xffd6('0x18')};}if(_0xb84411[_0xffd6('0x19')]){_0x534a1b['body'][_0xffd6('0x14')][_0xffd6('0x1a')]=_0xb84411['custom_action'];if(_0xb84411[_0xffd6('0x1b')]){_0x534a1b['body'][_0xffd6('0x14')][_0xffd6('0x1c')]=_0xb84411[_0xffd6('0x1b')];}}logger[_0xffd6('0x1d')](JSON[_0xffd6('0x1e')](_0x534a1b));return rp(_0x534a1b);});}; \ No newline at end of file +var _0xb74d=['uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message'];(function(_0x2b9b86,_0x5943e7){var _0xca3f2d=function(_0x5c3b1f){while(--_0x5c3b1f){_0x2b9b86['push'](_0x2b9b86['shift']());}};_0xca3f2d(++_0x5943e7);}(_0xb74d,0x16e));var _0xdb74=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xb74d[_0x819464];return _0x49dcc0;};'use strict';var rp=require(_0xdb74('0x0'));var url=require('url');var logger=require(_0xdb74('0x1'))('agi');module[_0xdb74('0x2')]=function(_0x5700f0,_0x1ba155){var _0x30d1e5={'method':_0xdb74('0x3'),'uri':url['resolve'](_0x1ba155[_0xdb74('0x4')],_0xdb74('0x5')),'form':{'grant_type':_0xdb74('0x6'),'username':_0x1ba155['username'],'password':_0x1ba155['password']},'json':!![]};return rp(_0x30d1e5)[_0xdb74('0x7')](function(_0x4bf15e){var _0x3e44b7={'method':_0xdb74('0x3'),'uri':url['resolve'](_0x1ba155[_0xdb74('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1ba155[_0xdb74('0x9')]||_0xdb74('0xa'),'channelId':'Nda','conversation':{'id':_0x5700f0[_0xdb74('0xb')]},'from':{'id':_0x5700f0[_0xdb74('0xc')],'name':_0x5700f0[_0xdb74('0xd')]},'recipient':{'id':_0x5700f0['dnid'],'name':_0x5700f0['extension']},'text':_0x1ba155[_0xdb74('0xe')],'channelData':{}},'headers':{'Authorization':_0xdb74('0xf')+_0x4bf15e[_0xdb74('0x10')]},'json':!![]};if(_0x1ba155[_0xdb74('0x11')]){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x14')]=_0x1ba155[_0xdb74('0x11')];}if(_0x1ba155[_0xdb74('0x15')]=='1'){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdb74('0x17')};}if(_0x1ba155['custom_action']){_0x3e44b7[_0xdb74('0x12')][_0xdb74('0x13')][_0xdb74('0x18')]=_0x1ba155[_0xdb74('0x19')];if(_0x1ba155['custom_action_data']){_0x3e44b7['body'][_0xdb74('0x13')][_0xdb74('0x1a')]=_0x1ba155['custom_action_data'];}}logger[_0xdb74('0x1b')](JSON[_0xdb74('0x1c')](_0x3e44b7));return rp(_0x3e44b7);});}; \ 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 d15d905..8661c44 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 _0x211e=['./lib/api','exports'];(function(_0x1786b8,_0x106a07){var _0x1098fe=function(_0x5af92b){while(--_0x5af92b){_0x1786b8['push'](_0x1786b8['shift']());}};_0x1098fe(++_0x106a07);}(_0x211e,0xb8));var _0xe211=function(_0x3f4aa6,_0x2ed693){_0x3f4aa6=_0x3f4aa6-0x0;var _0x4b4c0a=_0x211e[_0x3f4aa6];return _0x4b4c0a;};'use strict';var asr=require(_0xe211('0x0'));module[_0xe211('0x1')]=function(_0x20c88f,_0x58e6f0,_0x418e76,_0x557472){return asr(_0x20c88f,_0x58e6f0,_0x418e76,_0x557472);}; \ No newline at end of file +var _0x793c=['./lib/api','exports'];(function(_0x276b4d,_0x37b351){var _0x1e9c0f=function(_0x18c230){while(--_0x18c230){_0x276b4d['push'](_0x276b4d['shift']());}};_0x1e9c0f(++_0x37b351);}(_0x793c,0xe8));var _0xc793=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x793c[_0x17928f];return _0x500b63;};'use strict';var asr=require(_0xc793('0x0'));module[_0xc793('0x1')]=function(_0x3e9e39,_0x3b7e28,_0x2de319,_0x58950d){return asr(_0x3e9e39,_0x3b7e28,_0x2de319,_0x58950d);}; \ 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 b975bf5..52a2c30 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 _0x23de=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x23de,0x8b));var _0xe23d=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x23de[_0x4429e0];return _0x51a5b3;};'use strict';var BPromise=require('bluebird');var _=require(_0xe23d('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xe23d('0x1'));module['exports']=function(_0x17167f,_0x26d9d9,_0x158f78,_0x4b4e5b){return new BPromise(function(_0x178057,_0x2831b8){logger[_0xe23d('0x2')]('Tilde\x20URI',_0x4b4e5b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3fd4f1=new WebSocket(_0x4b4e5b||_0xe23d('0x3'),{'perMessageDeflate':![]});var _0x25fabb='';var _0x20778e='0';var _0x27ddd9='1';var _0x401355=_0xe23d('0x4');function _0x32f84e(_0x17bd7b){var _0x30fae8=crypto[_0xe23d('0x5')](_0xe23d('0x6'));_0x30fae8[_0xe23d('0x7')](_0x17bd7b);return _0x30fae8['digest'](_0xe23d('0x8'));}function _0x23e4ad(){try{logger[_0xe23d('0x2')](_0xe23d('0x9'));var _0x580c2c=moment()[_0xe23d('0xa')]();var _0x1f90c7=_0x32f84e(_0x580c2c+_0x26d9d9+_0x158f78);_0x3fd4f1[_0xe23d('0xb')](JSON[_0xe23d('0xc')]({'appID':_0x26d9d9,'timestamp':_0x580c2c,'appKey':_0x1f90c7}));var _0x462ef2=fs['createReadStream'](_0x17167f);_0x462ef2['on'](_0xe23d('0xd'),function(_0x6e2da3){_0x3fd4f1['send'](_0x6e2da3);});_0x462ef2['on'](_0xe23d('0xe'),function(){_0x3fd4f1[_0xe23d('0xb')](_0xe23d('0xf'));});}catch(_0x4f4c87){logger[_0xe23d('0x10')]('Tilde\x20ASR\x20send\x20error',JSON[_0xe23d('0xc')](_0x4f4c87));_0x3fd4f1[_0xe23d('0x11')]();}}function _0x1a491f(_0x5aba07){try{if(_0x5aba07){var _0x395673=JSON['parse'](_0x5aba07);switch(_0x395673[_0xe23d('0x12')]){case 0x0:if(_0x395673[_0xe23d('0x13')]){if(_0x395673[_0xe23d('0x13')][_0xe23d('0x14')]){logger[_0xe23d('0x2')](_0xe23d('0x15'),JSON[_0xe23d('0xc')](_0x395673[_0xe23d('0x13')][_0xe23d('0x16')]));_0x25fabb=_0x395673[_0xe23d('0x13')]['hypotheses'][0x0][_0xe23d('0x17')];_0x20778e=_0x395673['result'][_0xe23d('0x16')][0x0][_0xe23d('0x18')];_0x27ddd9='0';_0x401355='Success.';_0x3fd4f1[_0xe23d('0x11')]();}}break;case 0x1:logger[_0xe23d('0x2')](_0xe23d('0x4'));_0x27ddd9='1';_0x401355=_0xe23d('0x4');break;case 0x2:logger['info'](_0xe23d('0x19'));_0x27ddd9='2';_0x401355=_0xe23d('0x19');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x27ddd9='9';_0x401355='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe23d('0x2')]('Authentication\x20failed.');_0x27ddd9='10';_0x401355=_0xe23d('0x1a');break;case 0xb:logger[_0xe23d('0x2')](_0xe23d('0x1b'));_0x27ddd9='11';_0x401355=_0xe23d('0x1b');}}}catch(_0x1c0cc5){logger['error'](_0xe23d('0x1c'),JSON[_0xe23d('0xc')](_0x1c0cc5));_0x3fd4f1['terminate']();}}function _0x484feb(){logger[_0xe23d('0x2')](_0xe23d('0x1d'));_0x178057({'transcript':_0x25fabb,'confidence':_0x20778e,'status':_0x27ddd9,'status_message':_0x401355});}function _0x2b6120(_0x25e51e){logger[_0xe23d('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xe23d('0x1e')](_0x25e51e)){logger[_0xe23d('0x10')](_[_0xe23d('0x1f')](_0x25e51e)?JSON[_0xe23d('0xc')](_0x25e51e):_0x25e51e);}}_0x3fd4f1['on'](_0xe23d('0x20'),_0x23e4ad);_0x3fd4f1['on']('message',_0x1a491f);_0x3fd4f1['on'](_0xe23d('0xe'),_0x484feb);_0x3fd4f1['on'](_0xe23d('0x10'),_0x2b6120);});}; \ No newline at end of file +var _0x9056=['agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x5f4deb,_0x5a46c3){var _0x1c8aa5=function(_0x2d8d4a){while(--_0x2d8d4a){_0x5f4deb['push'](_0x5f4deb['shift']());}};_0x1c8aa5(++_0x5a46c3);}(_0x9056,0xba));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0x6905('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6905('0x1'));var crypto=require(_0x6905('0x2'));var logger=require(_0x6905('0x3'))(_0x6905('0x4'));module['exports']=function(_0x4f38b3,_0x59c51e,_0x3486a7,_0x18f69a){return new BPromise(function(_0x50f6f4,_0x571c33){logger[_0x6905('0x5')]('Tilde\x20URI',_0x18f69a||_0x6905('0x6'));var _0x4d2158=new WebSocket(_0x18f69a||_0x6905('0x6'),{'perMessageDeflate':![]});var _0x20d8a1='';var _0x426f5b='0';var _0x1f552f='1';var _0x38a0b8=_0x6905('0x7');function _0x4ddf19(_0x101687){var _0x53f765=crypto[_0x6905('0x8')]('sha1');_0x53f765[_0x6905('0x9')](_0x101687);return _0x53f765[_0x6905('0xa')]('hex');}function _0x347955(){try{logger[_0x6905('0x5')](_0x6905('0xb'));var _0x462dc2=moment()[_0x6905('0xc')]();var _0x9b4b09=_0x4ddf19(_0x462dc2+_0x59c51e+_0x3486a7);_0x4d2158[_0x6905('0xd')](JSON[_0x6905('0xe')]({'appID':_0x59c51e,'timestamp':_0x462dc2,'appKey':_0x9b4b09}));var _0xb0463c=fs[_0x6905('0xf')](_0x4f38b3);_0xb0463c['on'](_0x6905('0x10'),function(_0x349fb0){_0x4d2158[_0x6905('0xd')](_0x349fb0);});_0xb0463c['on'](_0x6905('0x11'),function(){_0x4d2158[_0x6905('0xd')](_0x6905('0x12'));});}catch(_0x2d8dba){logger['error'](_0x6905('0x13'),JSON[_0x6905('0xe')](_0x2d8dba));_0x4d2158['terminate']();}}function _0x5c4ed3(_0x13276c){try{if(_0x13276c){var _0x4e8abe=JSON[_0x6905('0x14')](_0x13276c);switch(_0x4e8abe[_0x6905('0x15')]){case 0x0:if(_0x4e8abe['result']){if(_0x4e8abe[_0x6905('0x16')][_0x6905('0x17')]){logger[_0x6905('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4e8abe['result']['hypotheses']));_0x20d8a1=_0x4e8abe[_0x6905('0x16')][_0x6905('0x18')][0x0][_0x6905('0x19')];_0x426f5b=_0x4e8abe['result'][_0x6905('0x18')][0x0][_0x6905('0x1a')];_0x1f552f='0';_0x38a0b8=_0x6905('0x1b');_0x4d2158[_0x6905('0x1c')]();}}break;case 0x1:logger[_0x6905('0x5')](_0x6905('0x7'));_0x1f552f='1';_0x38a0b8=_0x6905('0x7');break;case 0x2:logger['info'](_0x6905('0x1d'));_0x1f552f='2';_0x38a0b8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x6905('0x1e'));_0x1f552f='9';_0x38a0b8=_0x6905('0x1e');break;case 0xa:logger[_0x6905('0x5')](_0x6905('0x1f'));_0x1f552f='10';_0x38a0b8='Authentication\x20failed.';break;case 0xb:logger['info'](_0x6905('0x20'));_0x1f552f='11';_0x38a0b8=_0x6905('0x20');}}}catch(_0x28f848){logger['error'](_0x6905('0x21'),JSON[_0x6905('0xe')](_0x28f848));_0x4d2158[_0x6905('0x1c')]();}}function _0x4b9a59(){logger['info'](_0x6905('0x22'));_0x50f6f4({'transcript':_0x20d8a1,'confidence':_0x426f5b,'status':_0x1f552f,'status_message':_0x38a0b8});}function _0x5dafc2(_0x32f60f){logger['error'](_0x6905('0x23'));if(!_[_0x6905('0x24')](_0x32f60f)){logger['error'](_[_0x6905('0x25')](_0x32f60f)?JSON['stringify'](_0x32f60f):_0x32f60f);}}_0x4d2158['on']('open',_0x347955);_0x4d2158['on']('message',_0x5c4ed3);_0x4d2158['on']('close',_0x4b9a59);_0x4d2158['on']('error',_0x5dafc2);});}; \ 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 1e75345..093d56b 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 _0xbb09=['exports','./asr'];(function(_0x65eae,_0x32dc5f){var _0x18e82b=function(_0x2b3bed){while(--_0x2b3bed){_0x65eae['push'](_0x65eae['shift']());}};_0x18e82b(++_0x32dc5f);}(_0xbb09,0xa3));var _0x9bb0=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xbb09[_0x5834bc];return _0x3e183a;};var asr=require(_0x9bb0('0x0'));module[_0x9bb0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5d72=['exports','./asr'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x5d72,0xff));var _0x25d7=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x5d72[_0x34bc94];return _0xee41e7;};var asr=require(_0x25d7('0x0'));module[_0x25d7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ba96109..65e63ac 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 _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(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0xe706,0xa3));var _0x6e70=function(_0x97d6d5,_0x4453e7){_0x97d6d5=_0x97d6d5-0x0;var _0x3baaa2=_0xe706[_0x97d6d5];return _0x3baaa2;};'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 +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(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d5d695e..197fef8 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 _0x89c3=['custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INSTANCE()','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','message','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','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','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','split','replaceAll','extra','toString','result','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x89c3,0xff));var _0x389c=function(_0x4e4712,_0x4e1afa){_0x4e4712=_0x4e4712-0x0;var _0x233dd1=_0x89c3[_0x4e4712];return _0x233dd1;};'use strict';var fs=require('fs');var util=require(_0x389c('0x0'));var _=require(_0x389c('0x1'));var sh=require(_0x389c('0x2'));var odbc=require(_0x389c('0x3'))();var rs=require(_0x389c('0x4'));var moment=require(_0x389c('0x5'));var Mustache=require(_0x389c('0x6'));var rp=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var scripts=require(_0x389c('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x389c('0xa')];var verticesWithRetry=['menu','getdigits',_0x389c('0xb')];var AGIVertices=function(_0x41b63b,_0x28d373,_0x2efa82){this[_0x389c('0xc')]=_0x41b63b;this[_0x389c('0xd')]=_0x28d373;this[_0x389c('0xe')]=_0x2efa82;};AGIVertices[_0x389c('0xf')][_0x389c('0x10')]=function(_0x564686,_0x202742){this[_0x389c('0xd')][_0x389c('0x11')](_0x564686)[_0x389c('0x12')](function(_0x37f595){_0x202742(null,_0x37f595?_0x37f595['name']:![]);})['catch'](function(_0x2a2d7d){_0x202742(_0x2a2d7d);});};AGIVertices[_0x389c('0xf')][_0x389c('0x13')]=function(_0x501dc8,_0x3f2391){this['rpc'][_0x389c('0x14')](_0x501dc8)[_0x389c('0x12')](function(_0x4d5de3){_0x3f2391(null,_0x4d5de3?_0x4d5de3[_0x389c('0x15')]:![]);})[_0x389c('0x16')](function(_0x36c118){_0x3f2391(_0x36c118);});};AGIVertices['prototype'][_0x389c('0x17')]=function(_0x1ecb4c,_0xf3bc0d){this[_0x389c('0xd')][_0x389c('0x18')](_0x1ecb4c)['then'](function(_0x5b6ef8){_0xf3bc0d(null,_0x5b6ef8?_0x5b6ef8['name']:![]);})[_0x389c('0x16')](function(_0x2e23d2){_0xf3bc0d(_0x2e23d2);});};AGIVertices['prototype'][_0x389c('0x19')]=function(_0x11d40e,_0x421f5f){this[_0x389c('0xd')][_0x389c('0x1a')](_0x11d40e)[_0x389c('0x12')](function(_0x14b845){_0x421f5f(null,_0x14b845?_0x14b845[_0x389c('0x1b')]:![]);})[_0x389c('0x16')](function(_0x4fc960){_0x421f5f(_0x4fc960);});};AGIVertices[_0x389c('0xf')][_0x389c('0x1c')]=function(_0x33fffa,_0xef720){this[_0x389c('0xd')][_0x389c('0x1d')](_0x33fffa)['then'](function(_0x18e06b){_0xef720(null,_0x18e06b?_0x18e06b[_0x389c('0x15')]:![]);})[_0x389c('0x16')](function(_0x2dcd88){_0xef720(_0x2dcd88);});};AGIVertices['prototype'][_0x389c('0x1e')]=function(_0x2729bd,_0x4e09c0){this[_0x389c('0xd')]['getTrunkById'](_0x2729bd)[_0x389c('0x12')](function(_0x307113){_0x4e09c0(null,_0x307113?_0x307113[_0x389c('0x15')]:![]);})[_0x389c('0x16')](function(_0x21ab93){_0x4e09c0(_0x21ab93);});};AGIVertices['prototype'][_0x389c('0x1f')]=function(_0xcc1b60,_0x29e9f8){var _0x23382f=this;this[_0x389c('0xd')]['getSoundById'](_0xcc1b60)[_0x389c('0x12')](function(_0x4e30da){_0x29e9f8(null,_0x4e30da?_0x23382f[_0x389c('0x20')](_0x4e30da[_0x389c('0x21')]):![]);})[_0x389c('0x16')](function(_0xeac171){_0x29e9f8(_0xeac171);});};AGIVertices['prototype'][_0x389c('0x22')]=function(_0x80a2e1,_0x594f6a){this[_0x389c('0xd')][_0x389c('0x23')](_0x80a2e1)[_0x389c('0x12')](function(_0xa1cf2b){_0x594f6a(null,_0xa1cf2b?_0xa1cf2b:![]);})[_0x389c('0x16')](function(_0x2219f3){_0x594f6a(_0x2219f3);});};AGIVertices[_0x389c('0xf')][_0x389c('0x24')]=function(_0x22220d,_0x6c7d45,_0x34885e){this[_0x389c('0xe')]['sendMailMessage'](_0x22220d,_0x6c7d45)['then'](function(){_0x34885e(null);})['catch'](function(_0x19a63f){_0x34885e(_0x19a63f);});};AGIVertices['prototype'][_0x389c('0x25')]=function(_0x4973c5,_0xadda60){this[_0x389c('0xd')][_0x389c('0x26')](_0x4973c5)[_0x389c('0x12')](function(_0x4b5b6c){if(_0x4b5b6c){if(_0x4b5b6c[_0x389c('0x27')]){_0xadda60(null,[_0x4b5b6c[_0x389c('0x28')]]);}else{_0xadda60(null,_[_0x389c('0x29')](_0x4b5b6c[_0x389c('0x2a')],_0x389c('0x28')));}}else{_0xadda60(null,![]);}})[_0x389c('0x16')](function(_0x4d0217){_0xadda60(_0x4d0217);});};AGIVertices['prototype'][_0x389c('0x20')]=function(_0x192009){return util[_0x389c('0x2b')](_0x389c('0x2c'),FILES_PATH,_0x192009);};AGIVertices[_0x389c('0xf')][_0x389c('0x2d')]=function(_0x418a84,_0x337f81,_0x22341d){odbc[_0x389c('0x2e')](_0x418a84,function(_0x3eec96){if(_0x3eec96){logger[_0x389c('0x2f')](_0x389c('0x30'),_0x3eec96);_0x22341d(_0x3eec96);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x389c('0x31')](_0x337f81,function(_0x5b819f,_0x451c13){if(_0x5b819f){logger[_0x389c('0x32')](_0x389c('0x33'),_0x337f81);_0x22341d(_0x5b819f);}else{logger[_0x389c('0x32')]('Query\x20executed\x20correctly\x20%s',_0x337f81);odbc['close'](function(_0x31b0fa){if(_0x31b0fa){logger[_0x389c('0x2f')](_0x389c('0x34'),_0x31b0fa);}_0x22341d(null,_0x451c13);});}});}});};AGIVertices['prototype'][_0x389c('0x35')]=function(_0x2884c4,_0x37f4d7){this[_0x389c('0xd')][_0x389c('0x36')](_0x2884c4)[_0x389c('0x12')](function(_0x4c67cf){_0x37f4d7(null,_0x4c67cf?_0x4c67cf:![]);})[_0x389c('0x16')](function(_0x1c73b9){_0x37f4d7(_0x1c73b9);});};AGIVertices[_0x389c('0xf')][_0x389c('0x37')]=function(_0x56ea80,_0x195b4e){this['rpc'][_0x389c('0x37')](_0x56ea80)[_0x389c('0x12')](function(_0x2ff312){_0x195b4e(null,_0x2ff312);})[_0x389c('0x16')](function(_0x850845){_0x195b4e(_0x850845);});};AGIVertices[_0x389c('0xf')][_0x389c('0x38')]=function(_0x176110,_0x2fc644,_0x213bd9){this[_0x389c('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x389c('0xc')][_0x389c('0x39')],'node':_0x176110['label'],'application':_0x176110[_0x389c('0x3a')],'data':_0x2fc644||null,'project_name':this['channel'][_0x389c('0x3b')],'callerid':this[_0x389c('0xc')][_0x389c('0x3c')]})[_0x389c('0x12')](function(_0x2f708b){if(_0x213bd9){_0x213bd9(null,_0x2f708b);}})[_0x389c('0x16')](function(_0xc2ef3c){if(_0x213bd9){_0x213bd9(_0xc2ef3c);}});};AGIVertices[_0x389c('0xf')][_0x389c('0x3d')]=function(_0x439ff7,_0x127fc5,_0x368503,_0x3c9003){this['rpc']['createSquareRecording']({'uniqueid':this[_0x389c('0xc')][_0x389c('0x39')],'callerid':this[_0x389c('0xc')]['callerid'],'calleridname':this[_0x389c('0xc')][_0x389c('0x3e')],'context':this[_0x389c('0xc')][_0x389c('0x3f')],'extension':this['channel']['extension'],'priority':this['channel']['priority'],'accountcode':this[_0x389c('0xc')]['accountcode'],'dnid':this['channel'][_0x389c('0x40')],'projectName':this[_0x389c('0xc')][_0x389c('0x3b')],'saveName':_0x127fc5,'filename':_0x439ff7[_0x389c('0x41')]||_0x127fc5,'savePath':_0x368503})[_0x389c('0x12')](function(_0xd37a48){_0x3c9003(null,_0xd37a48);})[_0x389c('0x16')](function(_0x556928){_0x3c9003(_0x556928);});};AGIVertices[_0x389c('0xf')][_0x389c('0x42')]=function(_0x28e449,_0x10581a,_0x3efa0f,_0x26f7cc,_0x483eb8){this[_0x389c('0xd')]['createSquareMessage']({'uniqueid':this[_0x389c('0xc')]['uniqueid'],'body':_0x28e449,'direction':_0x10581a,'providerName':_0x3efa0f,'providerResponse':_0x26f7cc})[_0x389c('0x12')](function(_0x1589eb){if(_0x483eb8){_0x483eb8(null,_0x1589eb);}})[_0x389c('0x16')](function(_0x3c684c){if(_0x483eb8){_0x483eb8(_0x3c684c);}});};AGIVertices[_0x389c('0xf')][_0x389c('0x43')]=function(_0x5ad065,_0x151829){this[_0x389c('0xd')]['createCmContact']({'firstName':_[_0x389c('0x44')](_0x5ad065[_0x389c('0x15')])||_[_0x389c('0x45')](_0x5ad065['name'])?_0x389c('0x46')+Math[_0x389c('0x47')]():_0x5ad065['name'],'lastName':_[_0x389c('0x44')](_0x5ad065[_0x389c('0x48')])||_['isNil'](_0x5ad065[_0x389c('0x48')])?null:_0x5ad065[_0x389c('0x48')],'phone':_0x5ad065[_0x389c('0x49')],'ListId':_0x5ad065[_0x389c('0x4a')],'scheduledat':_0x5ad065[_0x389c('0x4b')],'callbackUniqueid':this[_0x389c('0xc')][_0x389c('0x39')],'tags':_0x389c('0x4c'),'description':_0x389c('0x4d')+_0x5ad065[_0x389c('0x4b')]['toString'](),'priority':_0x5ad065[_0x389c('0x4e')]})[_0x389c('0x12')](function(_0x3c2469){_0x151829(null,_0x3c2469);})['catch'](function(_0x407816){_0x151829(_0x407816);});};AGIVertices['prototype']['getPause']=function(_0x37cac6,_0x33a7a1){this[_0x389c('0xd')][_0x389c('0x4f')](_0x37cac6)[_0x389c('0x12')](function(_0x56c31a){_0x33a7a1(null,_0x56c31a?_0x56c31a[_0x389c('0x15')]:![]);})[_0x389c('0x16')](function(_0x19a92c){_0x33a7a1(_0x19a92c);});};AGIVertices['prototype'][_0x389c('0x50')]=function(_0x3a1f8d,_0x2d1444,_0x645ded){var _0x47c6c6={'role':_0x389c('0x51')};_0x47c6c6[_0x3a1f8d]=this[_0x389c('0xc')][_0x389c('0x3c')];this[_0x389c('0xd')][_0x389c('0x50')](_0x47c6c6,_0x2d1444,this['channel']['uniqueid'])[_0x389c('0x12')](function(_0x4bf9ec){_0x645ded(null,_[_0x389c('0x45')](_0x4bf9ec)?![]:!![]);})[_0x389c('0x16')](function(_0x2f7483){logger['error'](_0x2f7483);_0x645ded(null,![]);});};AGIVertices[_0x389c('0xf')]['agentUnpause']=function(_0x18d3d7,_0x5e24a6){var _0x41e244={'role':'agent'};_0x41e244[_0x18d3d7]=this[_0x389c('0xc')][_0x389c('0x3c')];this[_0x389c('0xd')][_0x389c('0x52')](_0x41e244)['then'](function(_0x34a05a){_0x5e24a6(null,_[_0x389c('0x45')](_0x34a05a)?![]:!![]);})['catch'](function(_0x1bd349){logger['error'](_0x1bd349);_0x5e24a6(null,![]);});};AGIVertices['prototype'][_0x389c('0x53')]=function(_0x2b7358,_0x2ef819){var _0x4ce5fd={'role':_0x389c('0x51')};_0x4ce5fd[_0x2b7358]=this[_0x389c('0xc')][_0x389c('0x3c')];this[_0x389c('0xd')]['agentLogout'](_0x4ce5fd)[_0x389c('0x12')](function(_0x4d9230){_0x2ef819(null,_['isNil'](_0x4d9230)?![]:!![]);})[_0x389c('0x16')](function(_0x42c4f6){logger['error'](_0x42c4f6);_0x2ef819(null,![]);});};AGIVertices[_0x389c('0xf')][_0x389c('0x54')]=function(_0x4ede90,_0x480b5e){var _0x3d08b0={'role':_0x389c('0x51')};_0x3d08b0[_0x4ede90]=this[_0x389c('0xc')][_0x389c('0x3c')];var _0x3d9f99=_0x4ede90!=_0x389c('0x55')?util[_0x389c('0x2b')](_0x389c('0x56'),_0x389c('0x57'),this[_0x389c('0xc')][_0x389c('0x3c')]):undefined;this['rpc'][_0x389c('0x54')](_0x3d08b0,_0x3d9f99)[_0x389c('0x12')](function(_0x3c2844){_0x480b5e(null,_['isNil'](_0x3c2844)?![]:!![]);})[_0x389c('0x16')](function(_0xa8265c){logger[_0x389c('0x2f')](_0xa8265c);_0x480b5e(null,![]);});};AGIVertices[_0x389c('0xf')]['shellCommand']=function(_0x2112b6,_0x136966){sh['exec'](_[_0x389c('0x58')](_0x2112b6),function(_0x3acab3,_0x3abf92){var _0x351748=_0x3abf92[_0x389c('0x59')](/(\r\n|\n|\r)/gm,'');_0x136966(null,_0x351748);});};AGIVertices[_0x389c('0xf')][_0x389c('0x5a')]=function(_0xe6c8b4,_0x33ef0c){scripts[_0x389c('0x5a')](_0xe6c8b4[_0x389c('0x5b')],_0xe6c8b4['google_cloud_tts_text_type']||_0x389c('0x5c'),_0xe6c8b4['text'],_0xe6c8b4[_0x389c('0x5d')]||_0x389c('0x5e'),_0xe6c8b4[_0x389c('0x5f')]||'MALE',_0xe6c8b4[_0x389c('0x60')]||_0x389c('0x61'))['then'](function(_0x2f99ea){_0x33ef0c(null,_0x2f99ea);})['catch'](function(_0x5492a9){_0x33ef0c(_0x5492a9);});};AGIVertices[_0x389c('0xf')][_0x389c('0x62')]=function(_0x526dbe,_0x5a755f){scripts[_0x389c('0x62')](_0x526dbe[_0x389c('0x5c')],_0x526dbe[_0x389c('0x63')]||'en',0x1)[_0x389c('0x12')](function(_0x211347){_0x5a755f(null,_0x211347);})[_0x389c('0x16')](function(_0x57a80f){_0x5a755f(_0x57a80f);});};AGIVertices[_0x389c('0xf')][_0x389c('0x64')]=function(_0x135ebd,_0xe3b7b2){var _0x58885f={'uri':_0x135ebd[_0x389c('0x65')],'method':_0x135ebd['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x135ebd[_0x389c('0x66')])===_0x389c('0x67')&&parseInt(_0x135ebd[_0x389c('0x66')])>=0x1?parseInt(_0x135ebd[_0x389c('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x389c('0x68')]([_0x389c('0x69'),'PUT'],_0x58885f['method'][_0x389c('0x6a')]())){try{_0x58885f[_0x389c('0x6b')]=_0x135ebd[_0x389c('0xa')]?JSON['parse'](_0x135ebd[_0x389c('0xa')]):{};}catch(_0x232794){logger['error'](_0x389c('0x6c'),_0x232794);}}try{_0x58885f[_0x389c('0x6d')]=_0x135ebd[_0x389c('0x6e')]?JSON[_0x389c('0x6f')](_0x135ebd[_0x389c('0x6e')]):{};}catch(_0x48ac95){logger[_0x389c('0x2f')](_0x389c('0x70'),_0x48ac95);}if(_0x135ebd['computedVariables']){try{var _0x12ae7b=require(_0x135ebd[_0x389c('0x71')])[_0x389c('0x72')](this,_0x58885f);_0x58885f[_0x389c('0x73')]=Mustache[_0x389c('0x74')](_0x135ebd[_0x389c('0x65')],_0x12ae7b,{},['$$','$$']);if(_0x58885f[_0x389c('0x6d')]){_0x58885f[_0x389c('0x6d')]=JSON['parse'](Mustache[_0x389c('0x74')](JSON[_0x389c('0x75')](_0x58885f[_0x389c('0x6d')]),_0x12ae7b,{},['$$','$$']));}if(_0x58885f[_0x389c('0x6b')]){_0x58885f[_0x389c('0x6b')]=JSON['parse'](Mustache['render'](JSON[_0x389c('0x75')](_0x58885f[_0x389c('0x6b')]),_0x12ae7b,{},['$$','$$']));}}catch(_0x63cb59){logger[_0x389c('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x63cb59);}}rp(_0x58885f)[_0x389c('0x12')](function(_0x398859){var _0x300389={'statusCode':_0x398859[_0x389c('0x76')]||0xc8,'statusMessage':_0x398859[_0x389c('0x77')]||'OK','headers':_0x398859['headers']||{},'body':_0x398859['body']||{}};_0xe3b7b2(null,_0x300389);})[_0x389c('0x16')](function(_0x24197e){var _0x3e71c6={'statusCode':_0x24197e[_0x389c('0x76')]||0x1f4,'statusMessage':_0x24197e['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x24197e[_0x389c('0x78')][_0x389c('0x6d')]||{},'body':_0x24197e[_0x389c('0x78')][_0x389c('0x6b')]||{}};_0xe3b7b2(null,_0x3e71c6);});};AGIVertices[_0x389c('0xf')][_0x389c('0x79')]=function(_0x589598,_0x1f8960){scripts[_0x389c('0x79')](this[_0x389c('0xc')][_0x389c('0x39')],_0x589598[_0x389c('0x7a')],_0x589598[_0x389c('0x5c')],_0x589598['dialogflow_language']||'en')[_0x389c('0x12')](function(_0x14a652){_0x1f8960(null,_0x14a652);})[_0x389c('0x16')](function(_0x3379cf){_0x1f8960(_0x3379cf);});};AGIVertices[_0x389c('0xf')][_0x389c('0x7b')]=function(_0x2ea6d8,_0x34adf5){scripts[_0x389c('0x7b')](this['channel'][_0x389c('0x39')],_0x2ea6d8[_0x389c('0x7c')],_0x2ea6d8[_0x389c('0x7d')],_0x2ea6d8[_0x389c('0x7e')],_0x2ea6d8[_0x389c('0x5c')],_0x2ea6d8[_0x389c('0x7f')]||'en')['then'](function(_0x511663){_0x34adf5(null,_0x511663);})[_0x389c('0x16')](function(_0x363111){_0x34adf5(_0x363111);});};AGIVertices['prototype'][_0x389c('0x80')]=function(_0xfc98f,_0x327390){scripts[_0x389c('0x80')](this[_0x389c('0xc')],_0xfc98f)[_0x389c('0x12')](function(_0x5c7532){_0x327390(null,_0x5c7532);})[_0x389c('0x16')](function(_0x508599){_0x327390(_0x508599);});};AGIVertices['prototype'][_0x389c('0x81')]=function(_0x2fa0d0,_0x5e37cf){scripts[_0x389c('0x81')](_0x2fa0d0['key'],_0x2fa0d0[_0x389c('0x5c')],_0x2fa0d0['ispeech_tts_language']||_0x389c('0x5e'),_0x2fa0d0['speed'])['then'](function(_0x4d8c35){_0x5e37cf(null,_0x4d8c35);})[_0x389c('0x16')](function(_0x20a220){_0x5e37cf(_0x20a220);});};AGIVertices['prototype'][_0x389c('0x82')]=function(_0x474a6a,_0x5c5fd0,_0x4e6b13){scripts[_0x389c('0x82')](_0x5c5fd0,_0x474a6a['key'],_0x474a6a[_0x389c('0x83')]||_0x389c('0x5e'),this[_0x389c('0x84')](_0x474a6a['model'])?_0x474a6a[_0x389c('0x85')]:undefined)['then'](function(_0x149eed){_0x4e6b13(null,_0x149eed);})[_0x389c('0x16')](function(_0x413f54){_0x4e6b13(_0x413f54);});};AGIVertices[_0x389c('0xf')][_0x389c('0x86')]=function(_0x356666,_0x2a6c0f){scripts[_0x389c('0x86')](_0x356666['aws_access_key_id'],_0x356666[_0x389c('0x87')],_0x356666[_0x389c('0x88')],_0x356666[_0x389c('0x89')]||_0x389c('0x8a'),_0x356666[_0x389c('0x5c')],_0x356666[_0x389c('0x8b')]||'text')[_0x389c('0x12')](function(_0x118fdd){_0x2a6c0f(null,_0x118fdd);})['catch'](function(_0x2e5d54){_0x2a6c0f(_0x2e5d54);});};AGIVertices['prototype'][_0x389c('0x8c')]=function(_0x57af6d,_0x1c1cd2){scripts[_0x389c('0x8c')](this['channel'][_0x389c('0x39')],_0x57af6d[_0x389c('0x8d')],_0x57af6d[_0x389c('0x87')],_0x57af6d[_0x389c('0x8e')],_0x57af6d[_0x389c('0x5c')],_0x57af6d['aws_bot_name'])[_0x389c('0x12')](function(_0x2e3d0e){_0x1c1cd2(null,_0x2e3d0e);})[_0x389c('0x16')](function(_0x5e61d2){_0x1c1cd2(_0x5e61d2);});};AGIVertices[_0x389c('0xf')][_0x389c('0x8f')]=function(_0x385c63,_0x4a13f8,_0x2440f4){scripts[_0x389c('0x8f')](_0x4a13f8,_0x385c63['key'],_0x385c63[_0x389c('0x90')]||_0x389c('0x5e'))[_0x389c('0x12')](function(_0x17ee16){_0x2440f4(null,_0x17ee16);})[_0x389c('0x16')](function(_0x34eefc){_0x2440f4(_0x34eefc);});};AGIVertices[_0x389c('0xf')][_0x389c('0x91')]=function(_0x20bac8,_0x520455,_0x5e417b){scripts[_0x389c('0x91')](_0x520455,_0x20bac8[_0x389c('0x92')],_0x20bac8[_0x389c('0x93')],_0x20bac8[_0x389c('0x73')])[_0x389c('0x12')](function(_0x574f51){_0x5e417b(null,_0x574f51);})[_0x389c('0x16')](function(_0x1db5ce){_0x5e417b(_0x1db5ce);});};AGIVertices[_0x389c('0xf')][_0x389c('0x94')]=function(_0x26f61b){var _0x1149c7=_[_0x389c('0x68')](verticesWithRetry,_0x26f61b[_0x389c('0x3a')])?_0x26f61b:_[_0x389c('0x95')](_0x26f61b);for(var _0xd7c1a7 in _0x1149c7){if(_0x1149c7[_0x389c('0x96')](_0xd7c1a7)){if(_0x1149c7[_0xd7c1a7]&&_[_0x389c('0x97')](_0x1149c7[_0xd7c1a7])){if(_['includes'](recursiveMapAttributes,_0xd7c1a7)){_0x1149c7[_0xd7c1a7]=this[_0x389c('0x98')](_0x1149c7[_0xd7c1a7]);}else{_0x1149c7[_0xd7c1a7]=this[_0x389c('0x99')](_0x1149c7[_0xd7c1a7]);}}}}return _0x1149c7;};AGIVertices[_0x389c('0xf')][_0x389c('0x9a')]=function(_0x4c583f){for(var _0x1125da in _0x4c583f){if(_0x4c583f[_0x389c('0x96')](_0x1125da)){if(_['isPlainObject'](_0x4c583f[_0x1125da])){this['recursiveNodeIndex'](_0x4c583f[_0x1125da]);}else if(_[_0x389c('0x9b')](_0x4c583f[_0x1125da])){for(var _0x1d1b58=0x0;_0x1d1b58<_0x4c583f[_0x1125da][_0x389c('0x9c')];_0x1d1b58++){this[_0x389c('0x9a')](_0x4c583f[_0x1125da][_0x1d1b58]);}}else if(_[_0x389c('0x97')](_0x4c583f[_0x1125da])){_0x4c583f[_0x1125da]=this[_0x389c('0x99')](_0x4c583f[_0x1125da]);}}}};AGIVertices[_0x389c('0xf')][_0x389c('0x9d')]=function(_0x123f77,_0x1443cd){for(var _0x4ba851 in _0x123f77){if(_0x123f77[_0x389c('0x96')](_0x4ba851)){if(_[_0x389c('0x9e')](_0x123f77[_0x4ba851])){if(!_['isEmpty'](_0x123f77[_0x4ba851])){this[_0x389c('0x9d')](_0x123f77[_0x4ba851],util[_0x389c('0x2b')](_0x389c('0x9f'),_0x1443cd,_0x4ba851));}}else if(_[_0x389c('0x9b')](_0x123f77[_0x4ba851])){for(var _0x348664=0x0;_0x348664<_0x123f77[_0x4ba851][_0x389c('0x9c')];_0x348664++){this[_0x389c('0x9d')](_0x123f77[_0x4ba851][_0x348664],util[_0x389c('0x2b')]('%s.%s',_0x1443cd,_0x4ba851+'['+_0x348664+']'));}}else{if(!_['isNil'](_0x123f77[_0x4ba851])){this[_0x389c('0xc')]['setVariable'](util['format'](_0x389c('0x9f'),_0x1443cd,_0x4ba851),_0x123f77[_0x4ba851]);}}}}};AGIVertices[_0x389c('0xf')]['replaceObjectAllVariables']=function(_0x7074af){try{var _0x2490db=JSON['parse'](_0x7074af);this['recursiveNodeIndex'](_0x2490db);return JSON[_0x389c('0x75')](_0x2490db);}catch(_0x3c48f2){return this[_0x389c('0x99')](_0x7074af);}};AGIVertices[_0x389c('0xf')][_0x389c('0x99')]=function(_0x28006f){var _0x3cec43=_0x28006f[_0x389c('0xa0')]('{');for(var _0x3e1dbb=0x1;_0x3e1dbb<_0x3cec43[_0x389c('0x9c')];_0x3e1dbb+=0x1){var _0x347c9d=_0x3cec43[_0x3e1dbb][_0x389c('0xa0')]('}');if(_0x347c9d[_0x389c('0x9c')]>0x1){_0x28006f=_0x28006f[_0x389c('0xa1')]('{'+_0x347c9d[0x0]+'}',this[_0x389c('0xc')][_0x389c('0x10')](_0x347c9d[0x0])[_0x389c('0xa2')]||_0x347c9d[0x0]);}}if(_0x3cec43[_0x389c('0x9c')]===0x1){return _0x28006f[_0x389c('0xa3')]();}return this['replaceAllVariables'](_0x28006f);};AGIVertices[_0x389c('0xf')]['getAndSetVariable']=function(_0x4b0728,_0x226030){var _0x1bc21f=this[_0x389c('0xc')][_0x389c('0x10')](_0x4b0728);if(_0x1bc21f[_0x389c('0xa4')]===-0x1){return _0x1bc21f;}logger[_0x389c('0x32')](util[_0x389c('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x226030,_0x1bc21f[_0x389c('0xa2')]));return this[_0x389c('0xc')][_0x389c('0xa5')](_0x226030,_0x1bc21f[_0x389c('0xa2')]);};AGIVertices[_0x389c('0xf')][_0x389c('0x84')]=function(_0xdcdbc0){return _0xdcdbc0&&_0xdcdbc0!=='0'&&_0xdcdbc0!=='-1'&&_0xdcdbc0!=='';};AGIVertices[_0x389c('0xf')][_0x389c('0xa6')]=function(_0x4dcfe0){this[_0x389c('0x38')]['sync'](this,_0x4dcfe0,'-');_0x4dcfe0['retry']=_0x4dcfe0[_0x389c('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x389c('0xa7')]=function(_0x25cba4){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xa8'),_0x25cba4[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x25cba4[_0x389c('0x5c')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xab'));}var _0x138db7='\x22'+_0x25cba4['text']+'\x22';if(this[_0x389c('0x84')](_0x25cba4['options'])){_0x138db7+=','+_0x25cba4[_0x389c('0x78')];}var _0x2fb476=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0xad'),_0x138db7);if(_0x2fb476['result']===-0x1){return _0x2fb476;}return this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0xae'),_0x138db7));};AGIVertices[_0x389c('0xf')][_0x389c('0xaf')]=function(_0x30529e){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xb0'),_0x30529e[_0x389c('0xa9')]));if(!this['isConfigured'](_0x30529e[_0x389c('0xb1')])){return this[_0x389c('0xc')][_0x389c('0xaa')]('no\x20grammar\x20configured');}var _0x4b4a57=_0x30529e[_0x389c('0xb1')];if(this[_0x389c('0x84')](_0x30529e[_0x389c('0x78')])){_0x4b4a57+=','+_0x30529e[_0x389c('0x78')];}var _0x222875=this[_0x389c('0xc')]['exec']('MRCPRecog',_0x4b4a57);if(_0x222875[_0x389c('0xa4')]===-0x1){return _0x222875;}var _0x10d8a3=this[_0x389c('0xb2')]('RECOG_CONFIDENCE()',_0x389c('0xb3'));if(_0x10d8a3[_0x389c('0xa4')]===-0x1){return _0x10d8a3;}var _0x55ba23=this[_0x389c('0xb2')](_0x389c('0xb4'),_0x389c('0xb5'));if(_0x55ba23[_0x389c('0xa4')]===-0x1){return _0x55ba23;}var _0x108a38=this[_0x389c('0xb2')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x108a38[_0x389c('0xa4')]===-0x1){return _0x108a38;}return this[_0x389c('0xc')]['noop'](util['format'](_0x389c('0xb6'),_0x4b4a57));};AGIVertices['prototype'][_0x389c('0x8')]=function(_0x1b354d){logger['info'](util[_0x389c('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1b354d['label']));return this[_0x389c('0xc')][_0x389c('0x8')]([_0x1b354d[_0x389c('0xb7')],_0x1b354d['args']]);};AGIVertices[_0x389c('0xf')]['answer']=function(_0x16ea6e){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xb8'),_0x16ea6e['label']));if(this[_0x389c('0x84')](_0x16ea6e['timeout'])){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xb9'),_0x16ea6e[_0x389c('0x66')]));var _0x30af2e=this[_0x389c('0xc')]['wait'](_0x16ea6e[_0x389c('0x66')]);if(_0x30af2e[_0x389c('0xa4')]===-0x1){return _0x30af2e;}}return this[_0x389c('0xc')][_0x389c('0xba')]();};AGIVertices[_0x389c('0xf')][_0x389c('0x4c')]=function(_0x29618f){logger[_0x389c('0x32')](util['format'](_0x389c('0xbb'),_0x29618f[_0x389c('0xa9')]));if(!this['isConfigured'](_0x29618f['list_id'])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x29618f,_0x389c('0xbc'));}_0x29618f['scheduledAt']=moment();if(this['isConfigured'](_0x29618f['delay'])){_0x29618f[_0x389c('0x4b')]=moment()[_0x389c('0xbd')](_0x29618f[_0x389c('0xbe')],_0x389c('0xbf'));}if(!this[_0x389c('0x84')](_0x29618f['callback_priority'])){_0x29618f[_0x389c('0x4e')]=0x2;}this[_0x389c('0x43')]['sync'](this,_0x29618f);return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x29618f['phone'],_0x29618f[_0x389c('0x4a')],_0x29618f[_0x389c('0x4b')]));};AGIVertices[_0x389c('0xf')][_0x389c('0xc0')]=function(_0x53aa76){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xc1'),_0x53aa76['label']));var _0x29d58e=this['channel']['exec'](_0x53aa76[_0x389c('0xc2')],_0x53aa76['options']);if(_0x29d58e['result']===-0x1){return _0x29d58e;}return this[_0x389c('0xc')]['noop'](util['format'](_0x389c('0xc3'),_0x53aa76[_0x389c('0xc2')],_0x53aa76[_0x389c('0x78')]));};AGIVertices[_0x389c('0xf')][_0x389c('0xc4')]=function(_0x5e9a64){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xc5'),_0x5e9a64[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x5e9a64[_0x389c('0x5c')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xab'));}var _0x2d3342='\x22'+_0x5e9a64[_0x389c('0x5c')]+'\x22';if(this[_0x389c('0x84')](_0x5e9a64[_0x389c('0x78')])){_0x2d3342+=','+_0x5e9a64[_0x389c('0x78')];}var _0x3bd0f7=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0xad'),_0x2d3342);if(_0x3bd0f7['result']===-0x1){return _0x3bd0f7;}return this['channel'][_0x389c('0xaa')](util['format'](_0x389c('0xae'),_0x2d3342));};AGIVertices[_0x389c('0xf')][_0x389c('0xc6')]=function(_0x56f4ff){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xc7'),_0x56f4ff[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x56f4ff[_0x389c('0x5c')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xab'));}var _0x5ac901='\x22'+_0x56f4ff['text']+'\x22';if(this['isConfigured'](_0x56f4ff[_0x389c('0x78')])){_0x5ac901+=','+_0x56f4ff['options'];}var _0x2adb6e=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0xad'),_0x5ac901);if(_0x2adb6e[_0x389c('0xa4')]===-0x1){return _0x2adb6e;}return this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5ac901));};AGIVertices['prototype']['lumenvoxasr']=function(_0x4a2371){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xc8'),_0x4a2371[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x4a2371[_0x389c('0xb1')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xc9'));}var _0x31b726=_0x4a2371['grammar'];if(this[_0x389c('0x84')](_0x4a2371[_0x389c('0x78')])){_0x31b726+=','+_0x4a2371['options'];}var _0x86911b=this['channel'][_0x389c('0xac')](_0x389c('0xca'),_0x31b726);if(_0x86911b[_0x389c('0xa4')]===-0x1){return _0x86911b;}var _0x21948d=this[_0x389c('0xb2')](_0x389c('0xcb'),'LUMENVOX_ASR_CONFIDENCE');if(_0x21948d[_0x389c('0xa4')]===-0x1){return _0x21948d;}var _0x28492e=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x28492e['result']===-0x1){return _0x28492e;}var _0xbe1a42=this[_0x389c('0xb2')](_0x389c('0xcc'),'LUMENVOX_ASR_INSTANCE');if(_0xbe1a42[_0x389c('0xa4')]===-0x1){return _0xbe1a42;}return this['channel'][_0x389c('0xaa')](util['format'](_0x389c('0xb6'),_0x31b726));};AGIVertices['prototype'][_0x389c('0xcd')]=function(_0x522e5f){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x522e5f[_0x389c('0xa9')]));if(!this['isConfigured'](_0x522e5f[_0x389c('0xb1')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xc9'));}var _0x5d0142=_0x522e5f[_0x389c('0xb1')];if(this[_0x389c('0x84')](_0x522e5f['options'])){_0x5d0142+=','+_0x522e5f[_0x389c('0x78')];}var _0x2bd77b=this['channel'][_0x389c('0xac')]('MRCPRecog',_0x5d0142);if(_0x2bd77b[_0x389c('0xa4')]===-0x1){return _0x2bd77b;}var _0x3d2d5a=this[_0x389c('0xb2')](_0x389c('0xcb'),_0x389c('0xce'));if(_0x3d2d5a['result']===-0x1){return _0x3d2d5a;}var _0x1428a9=this[_0x389c('0xb2')](_0x389c('0xb4'),_0x389c('0xcf'));if(_0x1428a9['result']===-0x1){return _0x1428a9;}var _0xe77c2d=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0xe77c2d[_0x389c('0xa4')]===-0x1){return _0xe77c2d;}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5d0142));};AGIVertices['prototype']['database']=function(_0x12fe64){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xd0'),_0x12fe64[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x12fe64[_0x389c('0xd1')])){return this[_0x389c('0xc')]['error'](_0x12fe64,'no\x20database\x20selected');}var _0x20c679=this['getSquareOdbc'][_0x389c('0x72')](this,_0x12fe64[_0x389c('0xd1')]);if(!_0x20c679){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x12fe64,'no\x20odbc\x20database\x20found');}if(!this[_0x389c('0x84')](_0x12fe64[_0x389c('0x31')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x12fe64,'no\x20query\x20configured');}var _0x129898=_0x12fe64[_0x389c('0x31')][_0x389c('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')]('query:\x20%s',_0x129898));var _0x6b774f=this[_0x389c('0x2d')][_0x389c('0x72')](this,_0x20c679,_0x129898);this[_0x389c('0x38')]['sync'](this,_0x12fe64,_0x129898);if(!this[_0x389c('0x84')](_0x12fe64['variable_id'])){return this['channel']['noop'](_0x389c('0xd2'));}var _0x2fd51f=this[_0x389c('0x10')][_0x389c('0x72')](this,_0x12fe64[_0x389c('0xd3')]);if(!_0x2fd51f){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x12fe64,_0x389c('0xd4'));}var _0x23b887=this;_0x6b774f[_0x389c('0xd5')](function(_0x5bd10f,_0x53b7c6){Object['keys'](_0x5bd10f)[_0x389c('0xd5')](function(_0x3410be){_0x23b887[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0xd6'),_0x2fd51f,_0x53b7c6,_0x3410be),_0x5bd10f[_0x3410be]);});});this[_0x389c('0xc')][_0x389c('0xa5')](util['format']('%s_ROWS_COUNT',_0x2fd51f),_0x6b774f['length']);return this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')]('variable\x20%s\x20set',_0x2fd51f));};AGIVertices[_0x389c('0xf')][_0x389c('0xd7')]=function(_0x3f38fb){logger[_0x389c('0xd8')](util['format'](_0x389c('0xd9'),_0x3f38fb['label']));if(!this[_0x389c('0x84')](_0x3f38fb[_0x389c('0xda')])){return this['channel'][_0x389c('0x2f')](_0x3f38fb,'no\x20user\x20selected');}var _0x5ccfe4=this[_0x389c('0x1c')][_0x389c('0x72')](this,_0x3f38fb[_0x389c('0xda')]);if(!_0x5ccfe4){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x3f38fb,_0x389c('0xdb'));}var _0xb7fe87=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0xdc'),[util[_0x389c('0x2b')](_0x389c('0xdd'),_0x5ccfe4),_0x3f38fb[_0x389c('0x66')],_0x3f38fb[_0x389c('0xde')],_0x3f38fb[_0x389c('0x65')]]);if(_0xb7fe87[_0x389c('0xa4')]===-0x1){return _0xb7fe87;}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('Executed\x20command\x20%s',_0x389c('0xdc')));};AGIVertices[_0x389c('0xf')][_0x389c('0xdf')]=function(_0x36b804){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x36b804[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x36b804[_0x389c('0x7a')])){return this[_0x389c('0xc')][_0x389c('0xaa')]('no\x20key\x20configured');}if(!this[_0x389c('0x84')](_0x36b804[_0x389c('0x5c')])){return this[_0x389c('0xc')]['noop'](_0x389c('0xab'));}this[_0x389c('0xc')][_0x389c('0xe0')]=!![];this['createSquareDetailsReport'](_0x36b804);this[_0x389c('0x42')](_0x36b804[_0x389c('0x5c')],'in','','');this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0xe1'),_0x36b804['text']));var _0x129845=this['googleDialogflow'][_0x389c('0x72')](this,_0x36b804);if(_0x129845){for(var _0x3674d6 in _0x129845){if(_0x129845[_0x389c('0x96')](_0x3674d6)){this[_0x389c('0xc')]['setVariable'](util[_0x389c('0x2b')](_0x389c('0xe2'),_0x3674d6[_0x389c('0x6a')]()),_0x129845[_0x3674d6]);}}this[_0x389c('0x42')](_0x129845[_0x389c('0xe3')],'out',_0x389c('0xdf'),'');return this['channel'][_0x389c('0xaa')](util['format']('Dialogflow\x20Result\x20%s',_0x129845['speech']));}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x36b804,_0x389c('0xe4'));};AGIVertices[_0x389c('0xf')][_0x389c('0xe5')]=function(_0x3a8470){logger['info'](util['format'](_0x389c('0xe6'),_0x3a8470['label']));if(!this[_0x389c('0x84')](_0x3a8470['dialogflowV2_project_id'])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xe7'));}if(!this[_0x389c('0x84')](_0x3a8470[_0x389c('0x7d')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xe8'));}if(!this[_0x389c('0x84')](_0x3a8470[_0x389c('0x7e')])){return this[_0x389c('0xc')][_0x389c('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x389c('0x84')](_0x3a8470[_0x389c('0x7f')])){return this['channel'][_0x389c('0xaa')]('no\x20anguage\x20configured');}if(!this[_0x389c('0x84')](_0x3a8470['text'])){return this[_0x389c('0xc')]['noop'](_0x389c('0xab'));}this['channel'][_0x389c('0xe0')]=!![];this['createSquareDetailsReport'](_0x3a8470);this['createSquareMessage'](_0x3a8470[_0x389c('0x5c')],'in','','');this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0xe9'),_0x3a8470[_0x389c('0x5c')]));var _0xf0af39=this['googleDialogflowV2'][_0x389c('0x72')](this,_0x3a8470);if(_0xf0af39){for(var _0x2f53fd in _0xf0af39){if(_0xf0af39[_0x389c('0x96')](_0x2f53fd)){if(_0x2f53fd!==_0x389c('0xea')){this[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0xe2'),_0x2f53fd[_0x389c('0x6a')]()),_0xf0af39[_0x2f53fd]);}}}this['createSquareMessage'](_0xf0af39[_0x389c('0xe3')],'out',_0x389c('0xe5'),_0xf0af39[_0x389c('0xea')]);return this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')]('DialogflowV2\x20Result\x20%s',_0xf0af39['speech']));}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x3a8470,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x389c('0xeb')]=function(_0x5c5aef){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0xec'),_0x5c5aef[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x5c5aef[_0x389c('0xed')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xee'));}if(!this['isConfigured'](_0x5c5aef[_0x389c('0xef')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xf0'));}if(!this[_0x389c('0x84')](_0x5c5aef[_0x389c('0xf1')])){return this[_0x389c('0xc')]['noop'](_0x389c('0xf2'));}if(!this[_0x389c('0x84')](_0x5c5aef['ndassistant_url'])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xab'));}this[_0x389c('0xc')][_0x389c('0xe0')]=!![];this['createSquareDetailsReport'](_0x5c5aef);this[_0x389c('0x42')](_0x5c5aef['text'],'in','','');this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0xf3'),_0x5c5aef['text']));var _0x23ef80=this[_0x389c('0x80')][_0x389c('0x72')](this,_0x5c5aef);if(_0x23ef80){for(var _0x433bd5 in _0x23ef80){if(_0x23ef80[_0x389c('0x96')](_0x433bd5)){this[_0x389c('0xc')][_0x389c('0xa5')](util['format'](_0x389c('0xf4'),_0x433bd5[_0x389c('0x6a')]()),_0x23ef80[_0x433bd5]);}}this['createSquareMessage'](_0x23ef80[_0x389c('0xe3')],_0x389c('0xf5'),_0x389c('0xeb'),'');if(_0x23ef80[_0x389c('0xf6')]){this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0xf7'),_0x23ef80[_0x389c('0xf6')]));var _0x522612=this[_0x389c('0xc')][_0x389c('0xf8')](_0x23ef80['audiofile']);try{fs[_0x389c('0xf9')](_0x23ef80[_0x389c('0xf6')]+_0x389c('0xfa'));}catch(_0x22e7d0){logger[_0x389c('0x2f')](_0x22e7d0);}return _0x522612;}else{return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0xfb'),_0x23ef80['speech']));}}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x5c5aef,_0x389c('0xfc'));};AGIVertices[_0x389c('0xf')]['end']=function(_0x3bf3b8){logger['info'](util[_0x389c('0x2b')](_0x389c('0xfd'),_0x3bf3b8[_0x389c('0xa9')]));return this[_0x389c('0xc')]['noop']('end');};AGIVertices['prototype'][_0x389c('0xfe')]=function(_0x242048){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x242048['label']));var _0x5da474='';if(_0x242048[_0x389c('0xff')]){if(!this[_0x389c('0x84')](_0x242048[_0x389c('0xff')])){return this['channel'][_0x389c('0x2f')](_0x242048,_0x389c('0x100'));}else{var _0x328faa=parseInt(_0x242048[_0x389c('0xff')],0xa);if(isNaN(_0x328faa)){_0x5da474=_0x242048[_0x389c('0xff')];}else{_0x5da474=this[_0x389c('0x1e')][_0x389c('0x72')](this,_0x242048[_0x389c('0xff')]);if(!_0x5da474){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x242048,'no\x20trunk\x20found');}}}}else if(_0x242048[_0x389c('0x101')]){_0x5da474=_0x242048['trunk_name'];}else{return this[_0x389c('0xc')][_0x389c('0x2f')](_0x242048,_0x389c('0x100'));}var _0x1421cf=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0xdc'),[util['format'](_0x389c('0x102'),_0x5da474,_0x242048[_0x389c('0x49')]),_0x242048[_0x389c('0x66')],_0x242048[_0x389c('0xde')],_0x242048[_0x389c('0x65')]]);if(_0x1421cf[_0x389c('0xa4')]===-0x1){return _0x1421cf;}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x389c('0xf')][_0x389c('0x103')]=function(_0x11c925){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x11c925[_0x389c('0xa9')]));return this[_0x389c('0xc')][_0x389c('0xaa')]('finally');};AGIVertices[_0x389c('0xf')][_0x389c('0x104')]=function(_0x4843ce){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x105'),_0x4843ce['label']));if(_0x4843ce[_0x389c('0x106')]===0x0){return this[_0x389c('0xa6')](_0x4843ce);}_0x4843ce[_0x389c('0x106')]-=0x1;if(!this[_0x389c('0x84')](_0x4843ce[_0x389c('0x107')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4843ce,'no\x20file\x20audio\x20selected');}var _0x55713e=this[_0x389c('0x1f')][_0x389c('0x72')](this,_0x4843ce[_0x389c('0x107')]);if(!_0x55713e){return this['channel'][_0x389c('0x2f')](_0x4843ce,_0x389c('0x108'));}if(!this['isConfigured'](_0x4843ce[_0x389c('0xd3')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x389c('0xd2'));}var _0x3b3e27=this[_0x389c('0xc')][_0x389c('0x109')](_0x55713e,_0x4843ce[_0x389c('0x10a')],_0x4843ce['maxdigit']);var _0x45d2ed=_0x3b3e27[_0x389c('0xa4')]?_0x3b3e27[_0x389c('0xa4')][_0x389c('0xa3')]():'';logger[_0x389c('0x32')](_0x389c('0x10b'),JSON[_0x389c('0x75')](_0x3b3e27));if(_0x3b3e27[_0x389c('0xa4')]===-0x1){this[_0x389c('0x38')]['sync'](this,_0x4843ce,_0x45d2ed);return _0x3b3e27;}else if(_0x3b3e27[_0x389c('0xa2')]===_0x389c('0x66')){_0x3b3e27[_0x389c('0xa4')]=_0x45d2ed[_0x389c('0x9c')]>=parseInt(_0x4843ce[_0x389c('0x10c')])?'x':'i';}else{_0x3b3e27[_0x389c('0xa4')]=_0x45d2ed[_0x389c('0x9c')]>=parseInt(_0x4843ce[_0x389c('0x10c')])&&_0x45d2ed[_0x389c('0x9c')]<=parseInt(_0x4843ce[_0x389c('0x10d')])?'x':'i';}var _0x4e29b1=this[_0x389c('0x10')]['sync'](this,_0x4843ce['variable_id']);if(!_0x4e29b1){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4843ce,_0x389c('0xd4'));}this[_0x389c('0xc')][_0x389c('0xa5')](_0x4e29b1,_0x45d2ed);if(this['isConfigured'](_0x4843ce['hiddendigitsnum'])){var _0x28c01c=parseInt(_0x4843ce['hiddendigitsnum'],0xa);var _0x345d70=rs[_0x389c('0x10e')]({'charset':'*','length':_0x28c01c});var _0x595aea=_0x45d2ed[_0x389c('0x9c')];if(_0x595aea>0x0){if(_0x595aea>_0x28c01c){this[_0x389c('0x38')][_0x389c('0x72')](this,_0x4843ce,_0x4843ce[_0x389c('0x10f')]==='first'?_0x345d70+_0x45d2ed[_0x389c('0x110')](_0x28c01c):_0x45d2ed[_0x389c('0x110')](0x0,_0x595aea-_0x28c01c)+_0x345d70);}else{this[_0x389c('0x38')][_0x389c('0x72')](this,_0x4843ce,rs[_0x389c('0x10e')]({'charset':'*','length':_0x595aea}));}}else{this[_0x389c('0x38')][_0x389c('0x72')](this,_0x4843ce,'');}}else{this[_0x389c('0x38')][_0x389c('0x72')](this,_0x4843ce,_0x45d2ed);}return _0x3b3e27;};AGIVertices['prototype'][_0x389c('0xb')]=function(_0x41bcab){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41bcab[_0x389c('0xa9')]));return this[_0x389c('0x104')](_0x41bcab);};AGIVertices[_0x389c('0xf')][_0x389c('0x111')]=function(_0x109410){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x112'),_0x109410[_0x389c('0xa9')]));this[_0x389c('0x38')]['sync'](this,_0x109410,_0x109410[_0x389c('0x113')]);return this['channel']['noop'](util[_0x389c('0x2b')](_0x389c('0x114'),_0x109410[_0x389c('0x113')]));};AGIVertices['prototype'][_0x389c('0x115')]=function(_0xdc0f1d){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xdc0f1d[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0xdc0f1d[_0x389c('0x8d')])||!this['isConfigured'](_0xdc0f1d[_0x389c('0x87')])){return this['channel'][_0x389c('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xdc0f1d[_0x389c('0x5c')])){return this['channel'][_0x389c('0xaa')]('no\x20text\x20configured');}this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x116'),_0xdc0f1d[_0x389c('0x5c')]));var _0x377435=this[_0x389c('0x86')][_0x389c('0x72')](this,_0xdc0f1d);if(_0x377435){this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x117'),_0x377435));var _0x1db53b=this[_0x389c('0xc')][_0x389c('0xf8')](_0x377435);try{fs['unlink'](_0x377435+'.wav');}catch(_0x447b63){logger[_0x389c('0x2f')](_0x447b63);}return _0x1db53b;}return this['channel']['error'](_0xdc0f1d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x389c('0xf')][_0x389c('0x118')]=function(_0xc637f8){logger[_0x389c('0x32')](util['format'](_0x389c('0x119'),_0xc637f8[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0xc637f8[_0x389c('0x8d')])||!this[_0x389c('0x84')](_0xc637f8[_0x389c('0x87')])){return this[_0x389c('0xc')][_0x389c('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xc637f8[_0x389c('0x11a')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x11b'));}if(!this[_0x389c('0x84')](_0xc637f8[_0x389c('0x5c')])){return this[_0x389c('0xc')][_0x389c('0xaa')]('no\x20text\x20configured');}this[_0x389c('0xc')][_0x389c('0xe0')]=!![];this[_0x389c('0x38')](_0xc637f8);this[_0x389c('0x42')](_0xc637f8[_0x389c('0x5c')],'in','','');this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0xc637f8['text']));var _0x544ba4=this[_0x389c('0x8c')][_0x389c('0x72')](this,_0xc637f8);if(_0x544ba4){for(var _0x35df85 in _0x544ba4){if(_0x544ba4[_0x389c('0x96')](_0x35df85)&&_[_0x389c('0x97')](_0x544ba4[_0x35df85])){this[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0x11c'),_0x35df85[_0x389c('0x6a')]()),_0x544ba4[_0x35df85]);}}if(_[_0x389c('0x45')](_0x544ba4['message'])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x11d'));}else{this['createSquareMessage'](_0x544ba4['message'],_0x389c('0xf5'),_0x389c('0x11e'),'');return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x11f'),_0x544ba4[_0x389c('0x120')]));}}return this[_0x389c('0xc')][_0x389c('0x2f')](_0xc637f8,_0x389c('0x121'));};AGIVertices[_0x389c('0xf')]['googleasr']=function(_0x119972){logger[_0x389c('0x32')](util['format'](_0x389c('0x122'),_0x119972[_0x389c('0xa9')],_0x119972[_0x389c('0x66')]));if(!this[_0x389c('0x84')](_0x119972[_0x389c('0x7a')])){return this['channel'][_0x389c('0xaa')](_0x389c('0x123'));}var _0x30faaf='wav';var _0xf3ed10=util[_0x389c('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x389c('0x10e')](0x4));var _0x46b2d8=util[_0x389c('0x2b')](_0x389c('0x9f'),_0xf3ed10,_0x30faaf);var _0x9b57b4=!![];if(_0x119972[_0x389c('0x124')]===_0x389c('0x125')){_0x9b57b4=![];}var _0x11577f=this['channel'][_0x389c('0x126')](_0xf3ed10,_0x30faaf,_0x119972[_0x389c('0x127')],_0x119972[_0x389c('0x66')],undefined,_0x9b57b4);if(_0x11577f['result']!==-0x1){this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0x128'),_0x46b2d8));var _0x5818dd=this[_0x389c('0x8f')][_0x389c('0x72')](this,_0x119972,_0x46b2d8);if(_0x5818dd){for(var _0x4764f9 in _0x5818dd){if(_0x5818dd[_0x389c('0x96')](_0x4764f9)){this['channel'][_0x389c('0xa5')](util['format'](_0x389c('0x129'),_0x4764f9[_0x389c('0x6a')]()),_0x5818dd[_0x4764f9]);}}return this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0x12a'),JSON[_0x389c('0x75')](_0x5818dd)));}}return _0x11577f;};AGIVertices[_0x389c('0xf')][_0x389c('0x12b')]=function(_0x387ee0){logger['info'](util['format'](_0x389c('0x12c'),_0x387ee0[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x387ee0[_0x389c('0x92')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x12d'));}if(!this['isConfigured'](_0x387ee0[_0x389c('0x93')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x12e'));}var _0x482d9f=_0x389c('0x12f');var _0x4c8e67=util[_0x389c('0x2b')](_0x389c('0x130'),FILES_PATH,rs[_0x389c('0x10e')](0x4));var _0x3776ef=util[_0x389c('0x2b')]('%s.%s',_0x4c8e67,_0x482d9f);var _0x288d92=!![];if(_0x387ee0[_0x389c('0x124')]==='NOBEEP'){_0x288d92=![];}var _0xda75c7=this[_0x389c('0xc')][_0x389c('0x126')](_0x4c8e67,_0x482d9f,_0x387ee0[_0x389c('0x127')],_0x387ee0[_0x389c('0x66')],undefined,_0x288d92);if(_0xda75c7[_0x389c('0xa4')]!==-0x1){this[_0x389c('0xc')]['noop'](util['format'](_0x389c('0x131'),_0x3776ef));var _0x5166d7=this['tildeASR'][_0x389c('0x72')](this,_0x387ee0,_0x3776ef);if(_0x5166d7){for(var _0x54fe10 in _0x5166d7){if(_0x5166d7[_0x389c('0x96')](_0x54fe10)){this[_0x389c('0xc')]['setVariable'](util[_0x389c('0x2b')](_0x389c('0x132'),_0x54fe10[_0x389c('0x6a')]()),_0x5166d7[_0x54fe10]);}}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x133'),JSON[_0x389c('0x75')](_0x5166d7)));}}return _0xda75c7;};AGIVertices[_0x389c('0xf')]['gotoc']=function(_0x5769c7){logger['info'](util[_0x389c('0x2b')](_0x389c('0x134'),_0x5769c7[_0x389c('0xa9')]));return this[_0x389c('0xc')][_0x389c('0x135')](_0x5769c7[_0x389c('0x3f')],_0x5769c7[_0x389c('0x136')],_0x5769c7['priority']);};AGIVertices[_0x389c('0xf')][_0x389c('0x137')]=function(_0x4d5a75){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4d5a75[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x4d5a75['condition'])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4d5a75,_0x389c('0x138'));}try{var _0xbdafe3=eval(_0x4d5a75[_0x389c('0x139')])?_0x389c('0x13a'):_0x389c('0x13b');this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x13c'),_0x4d5a75[_0x389c('0x139')],_0xbdafe3));return{'code':0xc8,'result':_0xbdafe3};}catch(_0x1cfeab){return{'code':0xc8,'result':_0x389c('0x13b')};}};AGIVertices[_0x389c('0xf')][_0x389c('0x13d')]=function(_0x20d1ad){logger[_0x389c('0x32')](util['format'](_0x389c('0x13e'),_0x20d1ad[_0x389c('0xa9')]));if(!this['isConfigured'](_0x20d1ad[_0x389c('0x13f')])){return this[_0x389c('0xc')]['error'](_0x20d1ad,_0x389c('0x140'));}var _0x4c5788=this[_0x389c('0x25')][_0x389c('0x72')](this,_0x20d1ad[_0x389c('0x13f')]);if(!_0x4c5788){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x20d1ad,_0x389c('0x141'));}for(var _0x58aadd=0x0;_0x58aadd<_0x4c5788[_0x389c('0x9c')];_0x58aadd+=0x1){var _0x47cdc0=this[_0x389c('0xc')][_0x389c('0x10')](util[_0x389c('0x2b')](_0x389c('0x142'),_0x4c5788[_0x58aadd]));if(_0x47cdc0[_0x389c('0xa4')]===-0x1){return _0x47cdc0;}logger[_0x389c('0x32')](util['format'](_0x389c('0x143'),_0x4c5788[_0x58aadd],_0x47cdc0[_0x389c('0xa2')]));if(_0x47cdc0[_0x389c('0xa2')]===_0x389c('0x13a')){logger['info'](util[_0x389c('0x2b')]('IFTIME\x20%s\x20%s',_0x4c5788[_0x58aadd],_0x389c('0x13a')));this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x143'),_0x4c5788[_0x58aadd],'true'));return{'code':0xc8,'result':_0x389c('0x13a')};}else{logger[_0x389c('0x32')](util['format'](_0x389c('0x143'),_0x4c5788[_0x58aadd],_0x389c('0x13b')));this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0x143'),_0x4c5788[_0x58aadd],_0x389c('0x13b')));}}return{'code':0xc8,'result':_0x389c('0x13b')};};AGIVertices[_0x389c('0xf')][_0x389c('0x144')]=function(_0x44946a){logger[_0x389c('0x32')](util['format'](_0x389c('0x145'),_0x44946a[_0x389c('0xa9')]));return this[_0x389c('0xc')]['hangup']();};AGIVertices[_0x389c('0xf')][_0x389c('0x146')]=function(_0x2a0854){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x147'),_0x2a0854[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x2a0854[_0x389c('0x7a')])){return this['channel'][_0x389c('0xaa')](_0x389c('0x123'));}var _0x59fb5b=_0x389c('0x12f');var _0x8f6642=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x389c('0x10e')](0x4));var _0x3ef508=util[_0x389c('0x2b')](_0x389c('0x9f'),_0x8f6642,_0x59fb5b);var _0x463482=!![];if(_0x2a0854[_0x389c('0x124')]==='NOBEEP'){_0x463482=![];}var _0x1eb926=this[_0x389c('0xc')][_0x389c('0x126')](_0x8f6642,_0x59fb5b,_0x2a0854[_0x389c('0x127')],_0x2a0854[_0x389c('0x66')],undefined,_0x463482);if(_0x1eb926['result']!==-0x1){this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x148'),_0x3ef508));var _0x14e30d=this['ispeechASR']['sync'](this,_0x2a0854,_0x3ef508);if(_0x14e30d){for(var _0x309669 in _0x14e30d){if(_0x14e30d[_0x389c('0x96')](_0x309669)){this[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0x149'),_0x309669['toUpperCase']()),_0x14e30d[_0x309669]);}}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x14a'),JSON['stringify'](_0x14e30d)));}}return _0x1eb926;};AGIVertices[_0x389c('0xf')][_0x389c('0x14b')]=function(_0x35bb35){logger[_0x389c('0x32')](util['format'](_0x389c('0x14c'),_0x35bb35[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x35bb35['key'])){return this['channel'][_0x389c('0xaa')](_0x389c('0x123'));}if(!this[_0x389c('0x84')](_0x35bb35[_0x389c('0x5c')])){return this[_0x389c('0xc')]['noop'](_0x389c('0xab'));}this['channel']['noop'](util[_0x389c('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x35bb35['text']));var _0x1a0e66=this[_0x389c('0x81')][_0x389c('0x72')](this,_0x35bb35);if(_0x1a0e66){this[_0x389c('0xc')][_0x389c('0xaa')](util['format']('ispeech\x20%s\x20file\x20created',_0x1a0e66));var _0x83707e=this['channel'][_0x389c('0xf8')](_0x1a0e66,_0x35bb35[_0x389c('0x127')]);try{fs['unlink'](_0x1a0e66+_0x389c('0xfa'));}catch(_0x5dff19){logger[_0x389c('0x2f')](_0x5dff19);}return _0x83707e;}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x35bb35,_0x389c('0x14d'));};AGIVertices[_0x389c('0xf')][_0x389c('0x14e')]=function(_0x1aef79){logger[_0x389c('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1aef79[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x1aef79[_0x389c('0x14f')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x1aef79,_0x389c('0x150'));}logger['info'](util['format'](_0x389c('0x151'),this[_0x389c('0xc')][_0x389c('0x3c')],_0x1aef79[_0x389c('0x14f')]));var _0x4262d5=this[_0x389c('0x54')]['sync'](this,_0x1aef79[_0x389c('0x14f')]);if(_0x4262d5){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x152'),this[_0x389c('0xc')]['callerid'],_0x1aef79['findBy']));this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x152'),this[_0x389c('0xc')][_0x389c('0x3c')],_0x1aef79[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x153')};}else{logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x154'),this[_0x389c('0xc')][_0x389c('0x3c')],_0x1aef79[_0x389c('0x14f')]));this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0x154'),this[_0x389c('0xc')][_0x389c('0x3c')],_0x1aef79[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x155')};}};AGIVertices[_0x389c('0xf')][_0x389c('0x156')]=function(_0xf54331){logger[_0x389c('0x32')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xf54331['label']));if(!this[_0x389c('0x84')](_0xf54331[_0x389c('0x14f')])){return this[_0x389c('0xc')]['error'](_0xf54331,'no\x20find\x20by\x20configured');}logger[_0x389c('0x32')](util[_0x389c('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x389c('0xc')][_0x389c('0x3c')],_0xf54331['findBy']));var _0x582345=this[_0x389c('0x53')][_0x389c('0x72')](this,_0xf54331[_0x389c('0x14f')]);if(_0x582345){logger['info'](util[_0x389c('0x2b')](_0x389c('0x152'),this[_0x389c('0xc')][_0x389c('0x3c')],_0xf54331[_0x389c('0x14f')]));this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x152'),this['channel']['callerid'],_0xf54331[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x153')};}else{logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x154'),this[_0x389c('0xc')]['callerid'],_0xf54331[_0x389c('0x14f')]));this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x154'),this[_0x389c('0xc')]['callerid'],_0xf54331[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x155')};}};AGIVertices[_0x389c('0xf')]['math']=function(_0x5f0652){logger['info'](util[_0x389c('0x2b')](_0x389c('0x157'),_0x5f0652[_0x389c('0xa9')]));if(!this['isConfigured'](_0x5f0652[_0x389c('0x158')])){return this['channel']['error'](_0x5f0652,_0x389c('0x159'));}this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x15a'),_0x5f0652[_0x389c('0x158')]));var _0x3410bc=eval(_0x5f0652[_0x389c('0x158')]);if(!this['isConfigured'](_0x5f0652[_0x389c('0xd3')])){return this['channel'][_0x389c('0xaa')](_0x389c('0xd2'));}var _0x90e488=this[_0x389c('0x10')]['sync'](this,_0x5f0652[_0x389c('0xd3')]);if(!_0x90e488){return this[_0x389c('0xc')]['error'](_0x5f0652,_0x389c('0xd4'));}if(_[_0x389c('0x9b')](_0x3410bc)){var _0x25f6d6=this;_0x3410bc[_0x389c('0xd5')](function(_0x489782,_0x38c599){_0x25f6d6[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0x15b'),_0x90e488,_0x38c599),_0x489782);});return this[_0x389c('0xc')]['noop'](util['format'](_0x389c('0x15c'),_0x90e488));}else{return this[_0x389c('0xc')][_0x389c('0xa5')](_0x90e488,_0x3410bc);}};AGIVertices[_0x389c('0xf')]['menu']=function(_0x288439){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x15d'),_0x288439['label']));if(_0x288439[_0x389c('0x106')]===0x0){return this[_0x389c('0xa6')](_0x288439);}_0x288439['retry']-=0x1;if(!this[_0x389c('0x84')](_0x288439[_0x389c('0x107')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x288439,_0x389c('0x15e'));}var _0x5d3fa5=this[_0x389c('0x1f')][_0x389c('0x72')](this,_0x288439[_0x389c('0x107')]);if(!_0x5d3fa5){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x288439,_0x389c('0x108'));}var _0x32eff9=this[_0x389c('0xc')][_0x389c('0x109')](_0x5d3fa5,_0x288439['response'],_0x288439['digit']);var _0x22bbac=_0x32eff9[_0x389c('0xa4')];if(_0x32eff9['result']===-0x1){this[_0x389c('0x38')][_0x389c('0x72')](this,_0x288439,'-1');return _0x32eff9;}else if(_0x32eff9['extra']===_0x389c('0x66')){_0x32eff9[_0x389c('0xa4')]=_0x32eff9[_0x389c('0xa4')][_0x389c('0x9c')]>0x0?_0x32eff9['result']:'t';}else if(_['isEmpty'](_0x32eff9['result'])){_0x32eff9['result']='#';_0x22bbac='#';}if(!this[_0x389c('0x84')](_0x288439[_0x389c('0xd3')])){this[_0x389c('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x55696a=this[_0x389c('0x10')]['sync'](this,_0x288439[_0x389c('0xd3')]);if(!_0x55696a){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x288439,_0x389c('0xd4'));}this[_0x389c('0xc')][_0x389c('0xa5')](_0x55696a,_0x22bbac);}this['createSquareDetailsReport']['sync'](this,_0x288439,_0x22bbac);return _0x32eff9;};AGIVertices[_0x389c('0xf')]['noop']=function(_0x2d34a8){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x15f'),_0x2d34a8['label']));return this[_0x389c('0xc')][_0x389c('0xaa')](_0x2d34a8[_0x389c('0x160')]||_0x2d34a8['label']);};AGIVertices[_0x389c('0xf')]['pause']=function(_0x21e0b0){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x161'),_0x21e0b0['label']));if(!this['isConfigured'](_0x21e0b0[_0x389c('0x14f')])){return this[_0x389c('0xc')]['error'](_0x21e0b0,'no\x20find\x20by\x20configured');}logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x151'),this['channel'][_0x389c('0x3c')],_0x21e0b0[_0x389c('0x14f')]));var _0x591950=this['getPause']['sync'](this,_0x21e0b0['pause_id']);var _0x57787c=this['agentPause'][_0x389c('0x72')](this,_0x21e0b0[_0x389c('0x14f')],_0x591950);if(_0x57787c){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x152'),this[_0x389c('0xc')]['callerid'],_0x21e0b0['findBy']));this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x152'),this['channel'][_0x389c('0x3c')],_0x21e0b0[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x153')};}else{logger[_0x389c('0x32')](util['format'](_0x389c('0x154'),this[_0x389c('0xc')][_0x389c('0x3c')],_0x21e0b0[_0x389c('0x14f')]));this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0x152'),this[_0x389c('0xc')]['callerid'],_0x21e0b0[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x155')};}};AGIVertices['prototype'][_0x389c('0x162')]=function(_0x100709){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x163'),_0x100709[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x100709['file_id'])){return this[_0x389c('0xc')]['error'](_0x100709,_0x389c('0x15e'));}var _0x256eaa=this[_0x389c('0x1f')][_0x389c('0x72')](this,_0x100709[_0x389c('0x107')]);if(!_0x256eaa){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x100709,_0x389c('0x108'));}var _0x237276=this[_0x389c('0xc')]['exec'](_0x389c('0x164'),[_0x256eaa,_0x100709['opts']]);if(_0x237276[_0x389c('0xa4')]===-0x1){return _0x237276;}return this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0xc3'),_0x389c('0x164'),_0x256eaa));};AGIVertices[_0x389c('0xf')][_0x389c('0x165')]=function(_0x1d6e82){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x166'),_0x1d6e82[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x1d6e82[_0x389c('0x167')])){return this['channel'][_0x389c('0x2f')](_0x1d6e82,_0x389c('0x168'));}var _0x1e7e61='';var _0x1c161b=parseInt(_0x1d6e82['queue_id'],0xa);if(isNaN(_0x1c161b)){_0x1e7e61=_0x1d6e82[_0x389c('0x167')];}else{_0x1e7e61=this[_0x389c('0x13')][_0x389c('0x72')](this,_0x1d6e82['queue_id']);if(!_0x1e7e61){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x1d6e82,_0x389c('0x169'));}}var _0x2eb08b='';if(this[_0x389c('0x84')](_0x1d6e82[_0x389c('0x107')])){var _0x4938b5=this[_0x389c('0x1f')]['sync'](this,_0x1d6e82[_0x389c('0x107')]);if(_0x4938b5){_0x2eb08b=_0x4938b5;}}this[_0x389c('0x38')][_0x389c('0x72')](this,_0x1d6e82,_0x1e7e61);if(_0x1d6e82['opts'][_0x389c('0x16a')]('x')<0x0){_0x1d6e82[_0x389c('0xde')]+='x';}if(_0x1d6e82['opts'][_0x389c('0x16a')]('X')<0x0){_0x1d6e82[_0x389c('0xde')]+='X';}this['channel'][_0x389c('0xa5')](_0x389c('0x16b'),_0x1e7e61?_0x1e7e61[_0x389c('0x16c')]():'');var _0x48de88=this[_0x389c('0xc')]['exec']('QUEUE',[_0x1e7e61,_0x1d6e82[_0x389c('0xde')],_0x1d6e82[_0x389c('0x65')],_0x2eb08b,_0x1d6e82[_0x389c('0x66')],_0x1d6e82['agi'],_0x1d6e82['macro'],_0x1d6e82['gosub'],'',_0x1d6e82[_0x389c('0x16d')]]);if(_0x48de88[_0x389c('0xa4')]===-0x1){return _0x48de88;}return this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0xc3'),_0x389c('0x16e'),_0x1e7e61));};AGIVertices[_0x389c('0xf')][_0x389c('0x16f')]=function(_0x29d09e){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x170'),_0x29d09e[_0x389c('0xa9')]));var _0x432845=_0x29d09e[_0x389c('0x171')]||_0x389c('0x12f');var _0x5c20b8=util['format'](_0x389c('0x172'),this['channel'][_0x389c('0x39')],rs[_0x389c('0x10e')](0x5));var _0x36863b=util[_0x389c('0x2b')](_0x389c('0x173'),FILES_PATH,_0x5c20b8,_0x432845);var _0x4943f2=util[_0x389c('0x2b')](_0x389c('0x130'),FILES_PATH,_0x5c20b8);this[_0x389c('0x3d')][_0x389c('0x72')](this,_0x29d09e,_0x5c20b8,_0x36863b);this[_0x389c('0xc')]['setVariable'](_0x389c('0x174'),_0x5c20b8);logger[_0x389c('0x32')](_0x389c('0x175'),_0x4943f2,_0x432845,_0x29d09e[_0x389c('0x176')],_0x29d09e[_0x389c('0x66')]);return this[_0x389c('0xc')][_0x389c('0x126')](_0x4943f2,_0x432845,_0x29d09e[_0x389c('0x176')],_0x29d09e['timeout'],undefined,!![]);};AGIVertices[_0x389c('0xf')][_0x389c('0x177')]=function(_0x4d615f){logger['info'](util[_0x389c('0x2b')](_0x389c('0x178'),_0x4d615f[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x4d615f[_0x389c('0x65')])){return this['channel'][_0x389c('0xaa')](_0x389c('0x179'));}var _0x2a4e8f=this[_0x389c('0x64')][_0x389c('0x72')](this,_0x4d615f);logger[_0x389c('0x32')](util['format'](_0x389c('0x17a'),util['inspect'](_0x2a4e8f,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d615f[_0x389c('0xd3')])){return this['channel']['noop'](_0x389c('0x17b'));}var _0x4090bc=this[_0x389c('0x10')]['sync'](this,_0x4d615f[_0x389c('0xd3')]);if(!_0x4090bc){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4d615f,_0x389c('0xd4'));}this[_0x389c('0xc')][_0x389c('0xa5')](util[_0x389c('0x2b')](_0x389c('0x17c'),_0x4090bc),_0x2a4e8f['statusCode']?_0x2a4e8f['statusCode']:_0x389c('0x17d'));this[_0x389c('0xc')]['setVariable'](util[_0x389c('0x2b')](_0x389c('0x17e'),_0x4090bc),_0x2a4e8f[_0x389c('0x77')]?_0x2a4e8f[_0x389c('0x77')]:'OK');if(_0x2a4e8f['body']){try{this['saveRestApiResult'](_0x2a4e8f['body'],_0x4090bc);}catch(_0x2e8127){logger[_0x389c('0x2f')](util['format'](_0x389c('0x17f'),_0x4090bc));}}return this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0x180'),_0x4090bc));};AGIVertices[_0x389c('0xf')][_0x389c('0x181')]=function(_0x51578f){logger[_0x389c('0x32')](util['format'](_0x389c('0x182'),_0x51578f['label']));return this['channel'][_0x389c('0x183')](_0x51578f[_0x389c('0x184')][_0x389c('0x59')](/\s+/g,''),_0x51578f[_0x389c('0x176')]);};AGIVertices['prototype']['saynumber']=function(_0x1024b0){logger[_0x389c('0x32')](util['format'](_0x389c('0x185'),_0x1024b0[_0x389c('0xa9')]));return this[_0x389c('0xc')][_0x389c('0x186')](_0x1024b0[_0x389c('0x67')][_0x389c('0x59')](/\s+/g,''),_0x1024b0['escape_digits']);};AGIVertices[_0x389c('0xf')][_0x389c('0x187')]=function(_0x44c210){logger['info'](util[_0x389c('0x2b')](_0x389c('0x188'),_0x44c210['label']));return this[_0x389c('0xc')]['sayPhonetic'](_0x44c210['text'],_0x44c210[_0x389c('0x176')]);};AGIVertices[_0x389c('0xf')]['sendMail']=function(_0x43b4f5){logger[_0x389c('0x32')](util['format'](_0x389c('0x189'),_0x43b4f5[_0x389c('0xa9')]));if(!this['isConfigured'](_0x43b4f5[_0x389c('0x18a')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x18b'));}var _0x149fbb=this[_0x389c('0x22')][_0x389c('0x72')](this,_0x43b4f5[_0x389c('0x18a')]);if(!_0x149fbb||!_0x149fbb[_0x389c('0x18c')]){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x43b4f5,'no\x20mail\x20account\x20found');}var _0x19958c={'from':util['format'](_0x389c('0x18d'),_0x149fbb[_0x389c('0x15')],_0x149fbb['email']||_0x149fbb[_0x389c('0x18c')][_0x389c('0x18e')]),'to':_0x43b4f5['to']||'','cc':_0x43b4f5['cc']||'','bcc':_0x43b4f5[_0x389c('0x18f')]||'','subject':_0x43b4f5[_0x389c('0x190')],'html':_0x43b4f5[_0x389c('0x5c')],'text':_0x43b4f5[_0x389c('0x5c')]};if(this[_0x389c('0x84')](_0x43b4f5[_0x389c('0x191')])){}logger['debug']('sendMail\x20message',JSON[_0x389c('0x75')](_0x19958c));this[_0x389c('0x38')][_0x389c('0x72')](this,_0x43b4f5,_0x43b4f5[_0x389c('0x18a')]);this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0x192'),_0x149fbb['name']));this[_0x389c('0x24')][_0x389c('0x72')](this,_0x149fbb[_0x389c('0x193')],_0x19958c);return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x194'));};AGIVertices['prototype']['sendFax']=function(_0x12872a){logger[_0x389c('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x12872a['label']));return this['channel'][_0x389c('0xaa')](_0x389c('0x195'));};AGIVertices[_0x389c('0xf')][_0x389c('0x196')]=function(_0x38625c){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x38625c['label']));if(!this[_0x389c('0x84')](_0x38625c[_0x389c('0x197')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x198'));}var _0x37e07d=this[_0x389c('0x35')][_0x389c('0x72')](this,_0x38625c['sms_account_id']);if(!_0x37e07d){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x38625c,'no\x20sms\x20account\x20found');}var _0x93cd4={'body':_0x38625c['sms_text'],'phone':_0x38625c['to']||'','SmsAccountId':_0x37e07d['id']};logger['debug']('sendSMS\x20message',JSON[_0x389c('0x75')](_0x93cd4));this[_0x389c('0x38')][_0x389c('0x72')](this,_0x38625c,_0x38625c[_0x389c('0x197')]);this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x37e07d['name']));this[_0x389c('0x37')][_0x389c('0x72')](this,_0x93cd4);return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x199'));};AGIVertices['prototype'][_0x389c('0x19a')]=function(_0x1a847c){logger['info'](util['format'](_0x389c('0x19b'),_0x1a847c[_0x389c('0xa9')]));if(!this['isConfigured'](_0x1a847c[_0x389c('0xd3')])){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x1a847c,'no\x20variable\x20selected');}var _0x5dafcd=this[_0x389c('0x10')]['sync'](this,_0x1a847c[_0x389c('0xd3')]);if(!_0x5dafcd){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x1a847c,'no\x20variable\x20found');}return this['channel']['setVariable'](_0x5dafcd,_0x1a847c[_0x389c('0x19c')]);};AGIVertices[_0x389c('0xf')][_0x389c('0x19d')]=function(_0x253849){logger['info'](util['format'](_0x389c('0x19e'),_0x253849[_0x389c('0xa9')]));this[_0x389c('0xc')]['noop']('START\x20CALLY\x20SQUARE');var _0x90c1a5=this[_0x389c('0xc')][_0x389c('0x10')]('XMCS-UNIQUEID');if(!_[_0x389c('0x44')](_0x90c1a5[_0x389c('0xa2')])){this[_0x389c('0xc')][_0x389c('0x39')]=_0x90c1a5[_0x389c('0xa2')];}if(_0x253849[_0x389c('0xba')]==='yes'){this['channel']['noop']('Answer');return this[_0x389c('0xc')][_0x389c('0xba')]();}return this[_0x389c('0xc')]['noop'](_0x389c('0x19f'));};AGIVertices[_0x389c('0xf')][_0x389c('0x1a0')]=function(_0x4f02b6){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x1a1'),_0x4f02b6[_0x389c('0xa9')]));if(!this['isConfigured'](_0x4f02b6['project_id'])){return this['channel']['error'](_0x4f02b6,_0x389c('0x1a2'));}var _0x4b5838=this[_0x389c('0x17')]['sync'](this,_0x4f02b6[_0x389c('0x1a3')]);if(!this[_0x389c('0x84')](_0x4b5838)){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4f02b6,util['format'](_0x389c('0x1a4'),_0x4f02b6[_0x389c('0x1a3')]));}if(_0x4b5838===this['channel']['arg_1']){return this[_0x389c('0xc')][_0x389c('0x2f')](_0x4f02b6,_0x389c('0x1a5'));}this[_0x389c('0x38')][_0x389c('0x72')](this,_0x4f02b6,_0x4b5838);var _0x413291=this[_0x389c('0xc')]['exec']('AGI',util[_0x389c('0x2b')](_0x389c('0x1a6'),config['agi']['host']||_0x389c('0x1a7'),_0x4b5838,this[_0x389c('0xc')][_0x389c('0x3b')]));if(_0x413291['result']===-0x1){return _0x413291;}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0xc3'),_0x389c('0x1a8'),_0x4b5838));};AGIVertices['prototype'][_0x389c('0x1a9')]=function(_0x45b6d1){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x1aa'),_0x45b6d1[_0x389c('0xa9')]));var _0x4ea551=this[_0x389c('0x1ab')]['sync'](this,_0x45b6d1[_0x389c('0xb7')]);this['createSquareDetailsReport'][_0x389c('0x72')](this,_0x45b6d1,_0x45b6d1[_0x389c('0xb7')]);if(this[_0x389c('0x84')](_0x45b6d1[_0x389c('0xd3')])){var _0xf178d6=this[_0x389c('0x10')][_0x389c('0x72')](this,_0x45b6d1[_0x389c('0xd3')]);if(_0xf178d6){this[_0x389c('0xc')]['setVariable'](_0xf178d6,_0x4ea551);return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x1ac'),_0x45b6d1['command'],_0xf178d6));}}return this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x1ad'),_0x45b6d1[_0x389c('0xb7')]));};AGIVertices[_0x389c('0xf')][_0x389c('0x1ae')]=function(_0x5e6bae){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x1af'),_0x5e6bae[_0x389c('0xa9')]));_0x5e6bae[_0x389c('0x5c')]=_0x5e6bae[_0x389c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5e6bae[_0x389c('0x5b')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0x1b0'));}if(!this[_0x389c('0x84')](_0x5e6bae[_0x389c('0x5c')])){return this[_0x389c('0xc')][_0x389c('0xaa')](_0x389c('0xab'));}this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5e6bae[_0x389c('0x5c')]));var _0x3de074=this[_0x389c('0x5a')][_0x389c('0x72')](this,_0x5e6bae);if(_0x3de074){this[_0x389c('0xc')][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x1b1'),_0x3de074));var _0xa4148a=this[_0x389c('0xc')][_0x389c('0xf8')](_0x3de074);try{fs[_0x389c('0xf9')](_0x3de074+_0x389c('0xfa'));}catch(_0x272dff){logger[_0x389c('0x2f')](_0x272dff);}return _0xa4148a;}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x5e6bae,_0x389c('0x1b2'));};AGIVertices['prototype']['tts']=function(_0x298922){logger['info'](util[_0x389c('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x298922[_0x389c('0xa9')]));_0x298922[_0x389c('0x5c')]=_0x298922[_0x389c('0x5c')][_0x389c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x389c('0x84')](_0x298922[_0x389c('0x5c')])){return this['channel']['noop'](_0x389c('0xab'));}this[_0x389c('0xc')][_0x389c('0xaa')](util['format'](_0x389c('0x1b3'),_0x298922[_0x389c('0x5c')]));var _0x5ce7da=this[_0x389c('0x62')][_0x389c('0x72')](this,_0x298922);if(_0x5ce7da){this[_0x389c('0xc')]['noop'](util[_0x389c('0x2b')](_0x389c('0x1b4'),_0x5ce7da));var _0x4e3e28=this[_0x389c('0xc')]['streamFile'](_0x5ce7da);try{fs['unlink'](_0x5ce7da+'.wav');}catch(_0x3bccc4){logger[_0x389c('0x2f')](_0x3bccc4);}return _0x4e3e28;}return this[_0x389c('0xc')][_0x389c('0x2f')](_0x298922,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x389c('0xf')][_0x389c('0x1b5')]=function(_0x5abe9a){logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x1b6'),_0x5abe9a['label']));if(!this[_0x389c('0x84')](_0x5abe9a[_0x389c('0x14f')])){return this['channel'][_0x389c('0x2f')](_0x5abe9a,'no\x20find\x20by\x20configured');}logger['info'](util[_0x389c('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x389c('0xc')]['callerid'],_0x5abe9a[_0x389c('0x14f')]));var _0x3c4057=this[_0x389c('0x52')][_0x389c('0x72')](this,_0x5abe9a[_0x389c('0x14f')]);if(_0x3c4057){logger[_0x389c('0x32')](util[_0x389c('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x389c('0x3c')],_0x5abe9a[_0x389c('0x14f')]));this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')](_0x389c('0x152'),this[_0x389c('0xc')]['callerid'],_0x5abe9a[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x153')};}else{logger[_0x389c('0x32')](util[_0x389c('0x2b')](_0x389c('0x154'),this['channel'][_0x389c('0x3c')],_0x5abe9a[_0x389c('0x14f')]));this['channel']['noop'](util[_0x389c('0x2b')](_0x389c('0x154'),this['channel'][_0x389c('0x3c')],_0x5abe9a[_0x389c('0x14f')]));return{'code':0xc8,'result':_0x389c('0x155')};}};AGIVertices['prototype'][_0x389c('0x1b7')]=function(_0x24ea36){logger[_0x389c('0x32')](util['format'](_0x389c('0x1b8'),_0x24ea36[_0x389c('0xa9')]));var _0x2b896c=this[_0x389c('0xc')][_0x389c('0xac')](_0x389c('0x1b9'),[_0x24ea36[_0x389c('0x1ba')],_0x24ea36[_0x389c('0x78')]]);if(_0x2b896c[_0x389c('0xa4')]===-0x1){return _0x2b896c;}return this['channel'][_0x389c('0xaa')](util[_0x389c('0x2b')]('Executed\x20command\x20%s\x20%s',_0x389c('0x1b9'),_0x24ea36['mailbox']));};AGIVertices[_0x389c('0xf')][_0x389c('0x1bb')]=function(_0x177e29){logger['info'](util[_0x389c('0x2b')](_0x389c('0x1bc'),_0x177e29[_0x389c('0xa9')]));if(!this[_0x389c('0x84')](_0x177e29[_0x389c('0xd3')])){return this['channel'][_0x389c('0x2f')](_0x177e29,'no\x20variable\x20selected');}var _0x4efe11=this[_0x389c('0x10')][_0x389c('0x72')](this,_0x177e29[_0x389c('0xd3')]);if(!_0x4efe11){return this['channel'][_0x389c('0x2f')](_0x177e29,_0x389c('0xd4'));}var _0x95bb23=this[_0x389c('0xc')][_0x389c('0x10')](_0x4efe11);return{'code':0xc8,'result':_0x95bb23['extra']?_0x95bb23[_0x389c('0xa2')]:'-'};};String[_0x389c('0xf')]['replaceAll']=function(_0x25a0f2,_0x538c48){return this[_0x389c('0xa0')](_0x25a0f2)[_0x389c('0x1bd')](_0x538c48);};module[_0x389c('0x1be')]=AGIVertices; \ No newline at end of file +var _0xf021=['callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','private_key','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','clone','hasOwnProperty','isString','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','length','replaceAll','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','add','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_secret_access_key','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','generate','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring','mustache','../../config/logger','agi','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','prototype','getVariable','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','createSquareRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf021,0x18f));var _0x1f02=function(_0x59d12e,_0x1128ff){_0x59d12e=_0x59d12e-0x0;var _0x2f5ee4=_0xf021[_0x59d12e];return _0x2f5ee4;};'use strict';var fs=require('fs');var util=require(_0x1f02('0x0'));var _=require(_0x1f02('0x1'));var sh=require(_0x1f02('0x2'));var odbc=require(_0x1f02('0x3'))();var rs=require(_0x1f02('0x4'));var moment=require('moment');var Mustache=require(_0x1f02('0x5'));var rp=require('request-promise');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x1f02('0x8');var recursiveMapAttributes=['rawHeaders',_0x1f02('0x9')];var verticesWithRetry=[_0x1f02('0xa'),_0x1f02('0xb'),_0x1f02('0xc')];var AGIVertices=function(_0x1f1cec,_0x4ec071,_0x154f8a){this['channel']=_0x1f1cec;this['rpc']=_0x4ec071;this['mailRpc']=_0x154f8a;};AGIVertices[_0x1f02('0xd')][_0x1f02('0xe')]=function(_0x1a93ec,_0x19ee35){this[_0x1f02('0xf')]['getVariableById'](_0x1a93ec)[_0x1f02('0x10')](function(_0x395432){_0x19ee35(null,_0x395432?_0x395432[_0x1f02('0x11')]:![]);})['catch'](function(_0x24e9b8){_0x19ee35(_0x24e9b8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x12')]=function(_0x567f8a,_0x5b12e8){this['rpc'][_0x1f02('0x13')](_0x567f8a)[_0x1f02('0x10')](function(_0x354ad1){_0x5b12e8(null,_0x354ad1?_0x354ad1[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x45bae1){_0x5b12e8(_0x45bae1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x15')]=function(_0x4b76f7,_0x2e602d){this['rpc']['getSquareProjectById'](_0x4b76f7)['then'](function(_0x5f4e55){_0x2e602d(null,_0x5f4e55?_0x5f4e55[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x3033a2){_0x2e602d(_0x3033a2);});};AGIVertices['prototype'][_0x1f02('0x16')]=function(_0x2c5474,_0x356444){this[_0x1f02('0xf')]['getSquareOdbcById'](_0x2c5474)['then'](function(_0x221e0f){_0x356444(null,_0x221e0f?_0x221e0f[_0x1f02('0x17')]:![]);})['catch'](function(_0x5b399a){_0x356444(_0x5b399a);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x18')]=function(_0x2f637d,_0xbabbd7){this['rpc'][_0x1f02('0x19')](_0x2f637d)[_0x1f02('0x10')](function(_0x1ae73b){_0xbabbd7(null,_0x1ae73b?_0x1ae73b[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x134398){_0xbabbd7(_0x134398);});};AGIVertices[_0x1f02('0xd')]['getTrunk']=function(_0x29c784,_0x3a8c57){this['rpc'][_0x1f02('0x1a')](_0x29c784)[_0x1f02('0x10')](function(_0x575a86){_0x3a8c57(null,_0x575a86?_0x575a86['name']:![]);})[_0x1f02('0x14')](function(_0x36c8c1){_0x3a8c57(_0x36c8c1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b')]=function(_0x3f5c5e,_0x3f5577){var _0x297cf4=this;this['rpc']['getSoundById'](_0x3f5c5e)['then'](function(_0x3ef4bf){_0x3f5577(null,_0x3ef4bf?_0x297cf4[_0x1f02('0x1c')](_0x3ef4bf[_0x1f02('0x1d')]):![]);})['catch'](function(_0x5c2c42){_0x3f5577(_0x5c2c42);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1e')]=function(_0x1605cf,_0x433a1e){this[_0x1f02('0xf')][_0x1f02('0x1f')](_0x1605cf)[_0x1f02('0x10')](function(_0x23fa22){_0x433a1e(null,_0x23fa22?_0x23fa22:![]);})[_0x1f02('0x14')](function(_0x2869b0){_0x433a1e(_0x2869b0);});};AGIVertices['prototype'][_0x1f02('0x20')]=function(_0x5ab7a2,_0xa61d8f,_0x3b3b57){this[_0x1f02('0x21')][_0x1f02('0x20')](_0x5ab7a2,_0xa61d8f)[_0x1f02('0x10')](function(){_0x3b3b57(null);})[_0x1f02('0x14')](function(_0x58f332){_0x3b3b57(_0x58f332);});};AGIVertices['prototype'][_0x1f02('0x22')]=function(_0x15e655,_0x4da1ea){this[_0x1f02('0xf')]['getIntervalById'](_0x15e655)[_0x1f02('0x10')](function(_0x4e7add){if(_0x4e7add){if(_0x4e7add[_0x1f02('0x23')]){_0x4da1ea(null,[_0x4e7add['interval']]);}else{_0x4da1ea(null,_['map'](_0x4e7add[_0x1f02('0x24')],_0x1f02('0x25')));}}else{_0x4da1ea(null,![]);}})[_0x1f02('0x14')](function(_0x2b32c6){_0x4da1ea(_0x2b32c6);});};AGIVertices['prototype'][_0x1f02('0x1c')]=function(_0x2f0079){return util[_0x1f02('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x2f0079);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x27')]=function(_0x2a82fa,_0x390686,_0x4292b7){odbc[_0x1f02('0x28')](_0x2a82fa,function(_0x590e26){if(_0x590e26){logger[_0x1f02('0x29')](_0x1f02('0x2a'),_0x590e26);_0x4292b7(_0x590e26);}else{logger[_0x1f02('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x1f02('0x2c')](_0x390686,function(_0x4fa7a9,_0x1e4fe5){if(_0x4fa7a9){logger['info']('Error\x20executing\x20query\x20%s',_0x390686);_0x4292b7(_0x4fa7a9);}else{logger[_0x1f02('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x390686);odbc['close'](function(_0x3ec5bd){if(_0x3ec5bd){logger[_0x1f02('0x29')](_0x1f02('0x2d'),_0x3ec5bd);}_0x4292b7(null,_0x1e4fe5);});}});}});};AGIVertices[_0x1f02('0xd')]['getSmsAccount']=function(_0x2b48a3,_0x4c17ad){this[_0x1f02('0xf')][_0x1f02('0x2e')](_0x2b48a3)[_0x1f02('0x10')](function(_0x43e7bf){_0x4c17ad(null,_0x43e7bf?_0x43e7bf:![]);})[_0x1f02('0x14')](function(_0xa89533){_0x4c17ad(_0xa89533);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x2f')]=function(_0x26bb8d,_0x5e9371){this[_0x1f02('0xf')]['createSmsMessage'](_0x26bb8d)[_0x1f02('0x10')](function(_0x544301){_0x5e9371(null,_0x544301);})[_0x1f02('0x14')](function(_0x124c09){_0x5e9371(_0x124c09);});};AGIVertices[_0x1f02('0xd')]['createSquareDetailsReport']=function(_0x5938e1,_0x1c3f09,_0x1dc9cc){this[_0x1f02('0xf')][_0x1f02('0x30')]({'uniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'node':_0x5938e1[_0x1f02('0x33')],'application':_0x5938e1[_0x1f02('0x34')],'data':_0x1c3f09||null,'project_name':this[_0x1f02('0x31')]['arg_1'],'callerid':this[_0x1f02('0x31')]['callerid']})['then'](function(_0xf59107){if(_0x1dc9cc){_0x1dc9cc(null,_0xf59107);}})['catch'](function(_0x584d9c){if(_0x1dc9cc){_0x1dc9cc(_0x584d9c);}});};AGIVertices[_0x1f02('0xd')]['createSquareRecording']=function(_0x4be37b,_0x46ba5a,_0x45450e,_0x5169dc){this[_0x1f02('0xf')][_0x1f02('0x35')]({'uniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'callerid':this['channel'][_0x1f02('0x36')],'calleridname':this[_0x1f02('0x31')][_0x1f02('0x37')],'context':this[_0x1f02('0x31')][_0x1f02('0x38')],'extension':this[_0x1f02('0x31')][_0x1f02('0x39')],'priority':this[_0x1f02('0x31')][_0x1f02('0x3a')],'accountcode':this[_0x1f02('0x31')][_0x1f02('0x3b')],'dnid':this[_0x1f02('0x31')][_0x1f02('0x3c')],'projectName':this[_0x1f02('0x31')]['arg_1'],'saveName':_0x46ba5a,'filename':_0x4be37b[_0x1f02('0x3d')]||_0x46ba5a,'savePath':_0x45450e})['then'](function(_0x37759d){_0x5169dc(null,_0x37759d);})['catch'](function(_0x346d4f){_0x5169dc(_0x346d4f);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x3e')]=function(_0x32dac3,_0x40bf99,_0x1b8b61,_0x217d85,_0x2178b2){this[_0x1f02('0xf')][_0x1f02('0x3e')]({'uniqueid':this[_0x1f02('0x31')]['uniqueid'],'body':_0x32dac3,'direction':_0x40bf99,'providerName':_0x1b8b61,'providerResponse':_0x217d85})[_0x1f02('0x10')](function(_0x297957){if(_0x2178b2){_0x2178b2(null,_0x297957);}})[_0x1f02('0x14')](function(_0x102551){if(_0x2178b2){_0x2178b2(_0x102551);}});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x3f')]=function(_0x2201b4,_0x5f2409){this[_0x1f02('0xf')]['createCmContact']({'firstName':_[_0x1f02('0x40')](_0x2201b4[_0x1f02('0x11')])||_[_0x1f02('0x41')](_0x2201b4[_0x1f02('0x11')])?_0x1f02('0x42')+Math['random']():_0x2201b4[_0x1f02('0x11')],'lastName':_['isEmpty'](_0x2201b4[_0x1f02('0x43')])||_[_0x1f02('0x41')](_0x2201b4[_0x1f02('0x43')])?null:_0x2201b4[_0x1f02('0x43')],'phone':_0x2201b4[_0x1f02('0x44')],'ListId':_0x2201b4[_0x1f02('0x45')],'scheduledat':_0x2201b4[_0x1f02('0x46')],'callbackUniqueid':this[_0x1f02('0x31')][_0x1f02('0x32')],'tags':_0x1f02('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x2201b4['scheduledAt']['toString'](),'priority':_0x2201b4[_0x1f02('0x48')]})['then'](function(_0x238911){_0x5f2409(null,_0x238911);})[_0x1f02('0x14')](function(_0x587873){_0x5f2409(_0x587873);});};AGIVertices[_0x1f02('0xd')]['getPause']=function(_0x52e236,_0x4929be){this[_0x1f02('0xf')][_0x1f02('0x49')](_0x52e236)[_0x1f02('0x10')](function(_0x390df6){_0x4929be(null,_0x390df6?_0x390df6[_0x1f02('0x11')]:![]);})[_0x1f02('0x14')](function(_0x5ea9a3){_0x4929be(_0x5ea9a3);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4a')]=function(_0x496e3c,_0x5c2745,_0x2b0e0d){var _0x34e76e={'role':_0x1f02('0x4b')};_0x34e76e[_0x496e3c]=this['channel'][_0x1f02('0x36')];this['rpc'][_0x1f02('0x4a')](_0x34e76e,_0x5c2745,this['channel'][_0x1f02('0x32')])[_0x1f02('0x10')](function(_0xd7be3b){_0x2b0e0d(null,_[_0x1f02('0x41')](_0xd7be3b)?![]:!![]);})[_0x1f02('0x14')](function(_0x46674e){logger[_0x1f02('0x29')](_0x46674e);_0x2b0e0d(null,![]);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4c')]=function(_0xdd0ac0,_0x3d4c6f){var _0x254bf4={'role':_0x1f02('0x4b')};_0x254bf4[_0xdd0ac0]=this[_0x1f02('0x31')][_0x1f02('0x36')];this[_0x1f02('0xf')][_0x1f02('0x4c')](_0x254bf4)[_0x1f02('0x10')](function(_0x245413){_0x3d4c6f(null,_[_0x1f02('0x41')](_0x245413)?![]:!![]);})['catch'](function(_0xf59e60){logger[_0x1f02('0x29')](_0xf59e60);_0x3d4c6f(null,![]);});};AGIVertices['prototype'][_0x1f02('0x4d')]=function(_0x9c04cf,_0x4a25d8){var _0x2b804e={'role':_0x1f02('0x4b')};_0x2b804e[_0x9c04cf]=this[_0x1f02('0x31')]['callerid'];this['rpc'][_0x1f02('0x4d')](_0x2b804e)[_0x1f02('0x10')](function(_0x1eabea){_0x4a25d8(null,_[_0x1f02('0x41')](_0x1eabea)?![]:!![]);})[_0x1f02('0x14')](function(_0x2f971c){logger[_0x1f02('0x29')](_0x2f971c);_0x4a25d8(null,![]);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x4e')]=function(_0x2ed1d7,_0x494aae){var _0x2cbb39={'role':'agent'};_0x2cbb39[_0x2ed1d7]=this['channel'][_0x1f02('0x36')];var _0xe7dde7=_0x2ed1d7!=_0x1f02('0x4f')?util[_0x1f02('0x26')](_0x1f02('0x50'),_0x1f02('0x51'),this[_0x1f02('0x31')][_0x1f02('0x36')]):undefined;this[_0x1f02('0xf')][_0x1f02('0x4e')](_0x2cbb39,_0xe7dde7)[_0x1f02('0x10')](function(_0x30deb9){_0x494aae(null,_[_0x1f02('0x41')](_0x30deb9)?![]:!![]);})['catch'](function(_0x5d4777){logger[_0x1f02('0x29')](_0x5d4777);_0x494aae(null,![]);});};AGIVertices[_0x1f02('0xd')]['shellCommand']=function(_0x554ec1,_0x5819fe){sh[_0x1f02('0x52')](_[_0x1f02('0x53')](_0x554ec1),function(_0x1b3bfd,_0x3ad421){var _0x34694a=_0x3ad421['replace'](/(\r\n|\n|\r)/gm,'');_0x5819fe(null,_0x34694a);});};AGIVertices[_0x1f02('0xd')]['googleCloudTTS']=function(_0x386df5,_0x4562c1){scripts[_0x1f02('0x54')](_0x386df5[_0x1f02('0x55')],_0x386df5[_0x1f02('0x56')]||_0x1f02('0x57'),_0x386df5[_0x1f02('0x57')],_0x386df5['languageCode']||_0x1f02('0x58'),_0x386df5[_0x1f02('0x59')]||_0x1f02('0x5a'),_0x386df5[_0x1f02('0x5b')]||_0x1f02('0x5c'))[_0x1f02('0x10')](function(_0xea49c1){_0x4562c1(null,_0xea49c1);})[_0x1f02('0x14')](function(_0x2d927f){_0x4562c1(_0x2d927f);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x5d')]=function(_0x48655c,_0x572965){scripts[_0x1f02('0x5d')](_0x48655c[_0x1f02('0x57')],_0x48655c[_0x1f02('0x5e')]||'en',0x1)[_0x1f02('0x10')](function(_0x1ea4b5){_0x572965(null,_0x1ea4b5);})[_0x1f02('0x14')](function(_0x4261f2){_0x572965(_0x4261f2);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x5f')]=function(_0xb9a76f,_0x1ef39a){var _0x3c6100={'uri':_0xb9a76f[_0x1f02('0x60')],'method':_0xb9a76f[_0x1f02('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xb9a76f[_0x1f02('0x62')])===_0x1f02('0x63')&&parseInt(_0xb9a76f[_0x1f02('0x62')])>=0x1?parseInt(_0xb9a76f[_0x1f02('0x62')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x1f02('0x64')],_0x3c6100[_0x1f02('0x61')]['toUpperCase']())){try{_0x3c6100[_0x1f02('0x65')]=_0xb9a76f[_0x1f02('0x9')]?JSON[_0x1f02('0x66')](_0xb9a76f[_0x1f02('0x9')]):{};}catch(_0x30eb49){logger[_0x1f02('0x29')](_0x1f02('0x67'),_0x30eb49);}}try{_0x3c6100[_0x1f02('0x68')]=_0xb9a76f['rawHeaders']?JSON[_0x1f02('0x66')](_0xb9a76f[_0x1f02('0x69')]):{};}catch(_0x5a719d){logger[_0x1f02('0x29')](_0x1f02('0x6a'),_0x5a719d);}if(_0xb9a76f[_0x1f02('0x6b')]){try{var _0xd0921b=require(_0xb9a76f[_0x1f02('0x6b')])[_0x1f02('0x6c')](this,_0x3c6100);_0x3c6100['uri']=Mustache[_0x1f02('0x6d')](_0xb9a76f[_0x1f02('0x60')],_0xd0921b,{},['$$','$$']);if(_0x3c6100['headers']){_0x3c6100[_0x1f02('0x68')]=JSON['parse'](Mustache[_0x1f02('0x6d')](JSON[_0x1f02('0x6e')](_0x3c6100[_0x1f02('0x68')]),_0xd0921b,{},['$$','$$']));}if(_0x3c6100[_0x1f02('0x65')]){_0x3c6100[_0x1f02('0x65')]=JSON[_0x1f02('0x66')](Mustache[_0x1f02('0x6d')](JSON[_0x1f02('0x6e')](_0x3c6100[_0x1f02('0x65')]),_0xd0921b,{},['$$','$$']));}}catch(_0x40b351){logger[_0x1f02('0x29')](_0x1f02('0x6f'),_0x40b351);}}rp(_0x3c6100)[_0x1f02('0x10')](function(_0x25f4d9){var _0x3af2fa={'statusCode':_0x25f4d9[_0x1f02('0x70')]||0xc8,'statusMessage':_0x25f4d9[_0x1f02('0x71')]||'OK','headers':_0x25f4d9[_0x1f02('0x68')]||{},'body':_0x25f4d9[_0x1f02('0x65')]||{}};_0x1ef39a(null,_0x3af2fa);})[_0x1f02('0x14')](function(_0x13a46f){var _0x257cb7={'statusCode':_0x13a46f[_0x1f02('0x70')]||0x1f4,'statusMessage':_0x13a46f[_0x1f02('0x72')]||_0x1f02('0x73'),'headers':_0x13a46f[_0x1f02('0x74')]['headers']||{},'body':_0x13a46f[_0x1f02('0x74')][_0x1f02('0x65')]||{}};_0x1ef39a(null,_0x257cb7);});};AGIVertices[_0x1f02('0xd')]['googleDialogflow']=function(_0x2c719a,_0x362548){scripts[_0x1f02('0x75')](this[_0x1f02('0x31')][_0x1f02('0x32')],_0x2c719a[_0x1f02('0x76')],_0x2c719a['text'],_0x2c719a['dialogflow_language']||'en')[_0x1f02('0x10')](function(_0x1c0c8d){_0x362548(null,_0x1c0c8d);})['catch'](function(_0x980ce1){_0x362548(_0x980ce1);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x77')]=function(_0x5d4b90,_0x127e74){scripts[_0x1f02('0x77')](this[_0x1f02('0x31')][_0x1f02('0x32')],_0x5d4b90['dialogflowV2_project_id'],_0x5d4b90['client_email'],_0x5d4b90[_0x1f02('0x78')],_0x5d4b90[_0x1f02('0x57')],_0x5d4b90['dialogflowV2_language']||'en')['then'](function(_0x169919){_0x127e74(null,_0x169919);})[_0x1f02('0x14')](function(_0x14dae8){_0x127e74(_0x14dae8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x79')]=function(_0x5a18c7,_0x28ebe6){scripts['sestekNDA'](this[_0x1f02('0x31')],_0x5a18c7)[_0x1f02('0x10')](function(_0xd30f92){_0x28ebe6(null,_0xd30f92);})['catch'](function(_0x8046ae){_0x28ebe6(_0x8046ae);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7a')]=function(_0x55764d,_0x1eca0f){scripts[_0x1f02('0x7a')](_0x55764d[_0x1f02('0x76')],_0x55764d[_0x1f02('0x57')],_0x55764d['ispeech_tts_language']||_0x1f02('0x58'),_0x55764d['speed'])[_0x1f02('0x10')](function(_0x4939a1){_0x1eca0f(null,_0x4939a1);})[_0x1f02('0x14')](function(_0x5d794c){_0x1eca0f(_0x5d794c);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7b')]=function(_0x482def,_0x42feae,_0x21bae3){scripts[_0x1f02('0x7b')](_0x42feae,_0x482def[_0x1f02('0x76')],_0x482def[_0x1f02('0x7c')]||'en-US',this[_0x1f02('0x7d')](_0x482def[_0x1f02('0x7e')])?_0x482def[_0x1f02('0x7e')]:undefined)[_0x1f02('0x10')](function(_0x2198eb){_0x21bae3(null,_0x2198eb);})['catch'](function(_0x1149e8){_0x21bae3(_0x1149e8);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7f')]=function(_0x1baf5d,_0x4e2aab){scripts['awsPolly'](_0x1baf5d[_0x1f02('0x80')],_0x1baf5d['aws_secret_access_key'],_0x1baf5d[_0x1f02('0x81')],_0x1baf5d[_0x1f02('0x82')]||_0x1f02('0x83'),_0x1baf5d[_0x1f02('0x57')],_0x1baf5d[_0x1f02('0x84')]||_0x1f02('0x57'))[_0x1f02('0x10')](function(_0x262bd6){_0x4e2aab(null,_0x262bd6);})['catch'](function(_0x1507e4){_0x4e2aab(_0x1507e4);});};AGIVertices[_0x1f02('0xd')]['awsLex']=function(_0x49d155,_0x349423){scripts['awsLex'](this[_0x1f02('0x31')]['uniqueid'],_0x49d155[_0x1f02('0x80')],_0x49d155['aws_secret_access_key'],_0x49d155[_0x1f02('0x85')],_0x49d155[_0x1f02('0x57')],_0x49d155[_0x1f02('0x86')])['then'](function(_0x3cc8da){_0x349423(null,_0x3cc8da);})[_0x1f02('0x14')](function(_0x4bc0c4){_0x349423(_0x4bc0c4);});};AGIVertices[_0x1f02('0xd')][_0x1f02('0x87')]=function(_0x2a57e4,_0xe4f778,_0xe69c4a){scripts[_0x1f02('0x87')](_0xe4f778,_0x2a57e4[_0x1f02('0x76')],_0x2a57e4[_0x1f02('0x88')]||_0x1f02('0x58'))['then'](function(_0x1e1637){_0xe69c4a(null,_0x1e1637);})[_0x1f02('0x14')](function(_0x262f18){_0xe69c4a(_0x262f18);});};AGIVertices['prototype'][_0x1f02('0x89')]=function(_0x40a945,_0x23ad42,_0x1f9e2f){scripts[_0x1f02('0x89')](_0x23ad42,_0x40a945[_0x1f02('0x8a')],_0x40a945[_0x1f02('0x8b')],_0x40a945[_0x1f02('0x8c')])[_0x1f02('0x10')](function(_0x5da287){_0x1f9e2f(null,_0x5da287);})[_0x1f02('0x14')](function(_0x12a2ec){_0x1f9e2f(_0x12a2ec);});};AGIVertices[_0x1f02('0xd')]['clear']=function(_0x3b2a8f){var _0x5bc60a=_[_0x1f02('0x8d')](verticesWithRetry,_0x3b2a8f[_0x1f02('0x34')])?_0x3b2a8f:_[_0x1f02('0x8e')](_0x3b2a8f);for(var _0x32d4d1 in _0x5bc60a){if(_0x5bc60a[_0x1f02('0x8f')](_0x32d4d1)){if(_0x5bc60a[_0x32d4d1]&&_[_0x1f02('0x90')](_0x5bc60a[_0x32d4d1])){if(_['includes'](recursiveMapAttributes,_0x32d4d1)){_0x5bc60a[_0x32d4d1]=this['replaceObjectAllVariables'](_0x5bc60a[_0x32d4d1]);}else{_0x5bc60a[_0x32d4d1]=this[_0x1f02('0x91')](_0x5bc60a[_0x32d4d1]);}}}}return _0x5bc60a;};AGIVertices[_0x1f02('0xd')]['recursiveNodeIndex']=function(_0x31ecc1){for(var _0x3c0a13 in _0x31ecc1){if(_0x31ecc1[_0x1f02('0x8f')](_0x3c0a13)){if(_[_0x1f02('0x92')](_0x31ecc1[_0x3c0a13])){this[_0x1f02('0x93')](_0x31ecc1[_0x3c0a13]);}else if(_[_0x1f02('0x94')](_0x31ecc1[_0x3c0a13])){for(var _0x1aeee5=0x0;_0x1aeee5<_0x31ecc1[_0x3c0a13]['length'];_0x1aeee5++){this[_0x1f02('0x93')](_0x31ecc1[_0x3c0a13][_0x1aeee5]);}}else if(_['isString'](_0x31ecc1[_0x3c0a13])){_0x31ecc1[_0x3c0a13]=this[_0x1f02('0x91')](_0x31ecc1[_0x3c0a13]);}}}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x95')]=function(_0x9edbac,_0x1a790d){for(var _0x35cb3b in _0x9edbac){if(_0x9edbac[_0x1f02('0x8f')](_0x35cb3b)){if(_[_0x1f02('0x92')](_0x9edbac[_0x35cb3b])){if(!_[_0x1f02('0x40')](_0x9edbac[_0x35cb3b])){this[_0x1f02('0x95')](_0x9edbac[_0x35cb3b],util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b));}}else if(_[_0x1f02('0x94')](_0x9edbac[_0x35cb3b])){for(var _0x1fcdbd=0x0;_0x1fcdbd<_0x9edbac[_0x35cb3b]['length'];_0x1fcdbd++){this['saveRestApiResult'](_0x9edbac[_0x35cb3b][_0x1fcdbd],util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b+'['+_0x1fcdbd+']'));}}else{if(!_[_0x1f02('0x41')](_0x9edbac[_0x35cb3b])){this['channel'][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x96'),_0x1a790d,_0x35cb3b),_0x9edbac[_0x35cb3b]);}}}}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x98')]=function(_0x15002d){try{var _0x2973de=JSON[_0x1f02('0x66')](_0x15002d);this[_0x1f02('0x93')](_0x2973de);return JSON[_0x1f02('0x6e')](_0x2973de);}catch(_0x406158){return this[_0x1f02('0x91')](_0x15002d);}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x91')]=function(_0x43936c){var _0x5e8066=_0x43936c[_0x1f02('0x99')]('{');for(var _0x4b484c=0x1;_0x4b484c<_0x5e8066[_0x1f02('0x9a')];_0x4b484c+=0x1){var _0x4bde90=_0x5e8066[_0x4b484c][_0x1f02('0x99')]('}');if(_0x4bde90['length']>0x1){_0x43936c=_0x43936c[_0x1f02('0x9b')]('{'+_0x4bde90[0x0]+'}',this[_0x1f02('0x31')][_0x1f02('0xe')](_0x4bde90[0x0])['extra']||_0x4bde90[0x0]);}}if(_0x5e8066[_0x1f02('0x9a')]===0x1){return _0x43936c[_0x1f02('0x9c')]();}return this['replaceAllVariables'](_0x43936c);};AGIVertices['prototype'][_0x1f02('0x9d')]=function(_0x9d3b77,_0x3ced2a){var _0x5d4ac1=this[_0x1f02('0x31')][_0x1f02('0xe')](_0x9d3b77);if(_0x5d4ac1[_0x1f02('0x9e')]===-0x1){return _0x5d4ac1;}logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x9f'),_0x3ced2a,_0x5d4ac1[_0x1f02('0xa0')]));return this[_0x1f02('0x31')][_0x1f02('0x97')](_0x3ced2a,_0x5d4ac1['extra']);};AGIVertices['prototype'][_0x1f02('0x7d')]=function(_0x2ee07e){return _0x2ee07e&&_0x2ee07e!=='0'&&_0x2ee07e!=='-1'&&_0x2ee07e!=='';};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa1')]=function(_0x1ac192){this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x1ac192,'-');_0x1ac192[_0x1f02('0xa2')]=_0x1ac192[_0x1f02('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1f02('0xd')]['mrcpsynth']=function(_0x162c8d){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xa3'),_0x162c8d[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x162c8d[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}var _0x291876='\x22'+_0x162c8d[_0x1f02('0x57')]+'\x22';if(this[_0x1f02('0x7d')](_0x162c8d[_0x1f02('0x74')])){_0x291876+=','+_0x162c8d['options'];}var _0x23aa99=this[_0x1f02('0x31')][_0x1f02('0x52')]('MRCPSynth',_0x291876);if(_0x23aa99[_0x1f02('0x9e')]===-0x1){return _0x23aa99;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x291876));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa6')]=function(_0x341e65){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0xa7'),_0x341e65[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x341e65[_0x1f02('0xa8')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20grammar\x20configured');}var _0x2a338d=_0x341e65[_0x1f02('0xa8')];if(this[_0x1f02('0x7d')](_0x341e65[_0x1f02('0x74')])){_0x2a338d+=','+_0x341e65['options'];}var _0x1e39a0=this[_0x1f02('0x31')]['exec']('MRCPRecog',_0x2a338d);if(_0x1e39a0[_0x1f02('0x9e')]===-0x1){return _0x1e39a0;}var _0x584b66=this[_0x1f02('0x9d')](_0x1f02('0xa9'),_0x1f02('0xaa'));if(_0x584b66[_0x1f02('0x9e')]===-0x1){return _0x584b66;}var _0x4a870c=this[_0x1f02('0x9d')]('RECOG_INPUT()',_0x1f02('0xab'));if(_0x4a870c[_0x1f02('0x9e')]===-0x1){return _0x4a870c;}var _0x27b592=this[_0x1f02('0x9d')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x27b592[_0x1f02('0x9e')]===-0x1){return _0x27b592;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xac'),_0x2a338d));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x7')]=function(_0x501e9b){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xad'),_0x501e9b[_0x1f02('0x33')]));return this['channel'][_0x1f02('0x7')]([_0x501e9b[_0x1f02('0xae')],_0x501e9b[_0x1f02('0xaf')]]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb0')]=function(_0x55f769){logger['info'](util[_0x1f02('0x26')](_0x1f02('0xb1'),_0x55f769['label']));if(this[_0x1f02('0x7d')](_0x55f769[_0x1f02('0x62')])){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x55f769[_0x1f02('0x62')]));var _0x22e91e=this[_0x1f02('0x31')][_0x1f02('0xb2')](_0x55f769[_0x1f02('0x62')]);if(_0x22e91e['result']===-0x1){return _0x22e91e;}}return this[_0x1f02('0x31')][_0x1f02('0xb0')]();};AGIVertices['prototype'][_0x1f02('0x47')]=function(_0x3d514b){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3d514b[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x3d514b[_0x1f02('0x45')])){return this[_0x1f02('0x31')]['error'](_0x3d514b,_0x1f02('0xb3'));}_0x3d514b['scheduledAt']=moment();if(this['isConfigured'](_0x3d514b['delay'])){_0x3d514b[_0x1f02('0x46')]=moment()[_0x1f02('0xb4')](_0x3d514b[_0x1f02('0xb5')],_0x1f02('0xb6'));}if(!this[_0x1f02('0x7d')](_0x3d514b['callback_priority'])){_0x3d514b[_0x1f02('0x48')]=0x2;}this[_0x1f02('0x3f')]['sync'](this,_0x3d514b);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xb7'),_0x3d514b[_0x1f02('0x44')],_0x3d514b[_0x1f02('0x45')],_0x3d514b[_0x1f02('0x46')]));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb8')]=function(_0x3e96e8){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0xb9'),_0x3e96e8[_0x1f02('0x33')]));var _0x39b66a=this[_0x1f02('0x31')]['exec'](_0x3e96e8[_0x1f02('0xba')],_0x3e96e8['options']);if(_0x39b66a['result']===-0x1){return _0x39b66a;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xbb'),_0x3e96e8[_0x1f02('0xba')],_0x3e96e8['options']));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xbc')]=function(_0x396416){logger['info'](util['format'](_0x1f02('0xbd'),_0x396416[_0x1f02('0x33')]));if(!this['isConfigured'](_0x396416['text'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20text\x20configured');}var _0x4ec7bd='\x22'+_0x396416[_0x1f02('0x57')]+'\x22';if(this['isConfigured'](_0x396416['options'])){_0x4ec7bd+=','+_0x396416[_0x1f02('0x74')];}var _0x8474c2=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xbe'),_0x4ec7bd);if(_0x8474c2['result']===-0x1){return _0x8474c2;}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xbf'),_0x4ec7bd));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xc0')]=function(_0x2c7a77){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2c7a77[_0x1f02('0x33')]));if(!this['isConfigured'](_0x2c7a77[_0x1f02('0x57')])){return this['channel']['noop'](_0x1f02('0xa5'));}var _0x5b799e='\x22'+_0x2c7a77[_0x1f02('0x57')]+'\x22';if(this[_0x1f02('0x7d')](_0x2c7a77['options'])){_0x5b799e+=','+_0x2c7a77[_0x1f02('0x74')];}var _0x3fb1b1=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xbe'),_0x5b799e);if(_0x3fb1b1[_0x1f02('0x9e')]===-0x1){return _0x3fb1b1;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xbf'),_0x5b799e));};AGIVertices[_0x1f02('0xd')]['lumenvoxasr']=function(_0x5f3d87){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5f3d87[_0x1f02('0x33')]));if(!this['isConfigured'](_0x5f3d87['grammar'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xc1'));}var _0x558918=_0x5f3d87[_0x1f02('0xa8')];if(this['isConfigured'](_0x5f3d87[_0x1f02('0x74')])){_0x558918+=','+_0x5f3d87[_0x1f02('0x74')];}var _0x16c042=this[_0x1f02('0x31')]['exec'](_0x1f02('0xc2'),_0x558918);if(_0x16c042['result']===-0x1){return _0x16c042;}var _0x25ad86=this[_0x1f02('0x9d')]('RECOG_CONFIDENCE()',_0x1f02('0xc3'));if(_0x25ad86[_0x1f02('0x9e')]===-0x1){return _0x25ad86;}var _0x4af053=this['getAndSetVariable'](_0x1f02('0xc4'),_0x1f02('0xc5'));if(_0x4af053['result']===-0x1){return _0x4af053;}var _0x49a520=this[_0x1f02('0x9d')](_0x1f02('0xc6'),_0x1f02('0xc7'));if(_0x49a520[_0x1f02('0x9e')]===-0x1){return _0x49a520;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xac'),_0x558918));};AGIVertices['prototype'][_0x1f02('0xc8')]=function(_0x41e41d){logger['info'](util[_0x1f02('0x26')](_0x1f02('0xc9'),_0x41e41d['label']));if(!this[_0x1f02('0x7d')](_0x41e41d[_0x1f02('0xa8')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xc1'));}var _0x51799f=_0x41e41d[_0x1f02('0xa8')];if(this['isConfigured'](_0x41e41d[_0x1f02('0x74')])){_0x51799f+=','+_0x41e41d[_0x1f02('0x74')];}var _0x2cd0a3=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xc2'),_0x51799f);if(_0x2cd0a3[_0x1f02('0x9e')]===-0x1){return _0x2cd0a3;}var _0x240f7e=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x240f7e['result']===-0x1){return _0x240f7e;}var _0x19b15a=this[_0x1f02('0x9d')](_0x1f02('0xc4'),_0x1f02('0xca'));if(_0x19b15a[_0x1f02('0x9e')]===-0x1){return _0x19b15a;}var _0x1d769b=this[_0x1f02('0x9d')](_0x1f02('0xc6'),_0x1f02('0xcb'));if(_0x1d769b['result']===-0x1){return _0x1d769b;}return this['channel'][_0x1f02('0xa4')](util['format'](_0x1f02('0xac'),_0x51799f));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xcc')]=function(_0x4a69b1){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xcd'),_0x4a69b1[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x4a69b1[_0x1f02('0xce')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,'no\x20database\x20selected');}var _0x1e52bb=this['getSquareOdbc']['sync'](this,_0x4a69b1[_0x1f02('0xce')]);if(!_0x1e52bb){return this['channel'][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xcf'));}if(!this[_0x1f02('0x7d')](_0x4a69b1[_0x1f02('0x2c')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xd0'));}var _0x51e4a8=_0x4a69b1[_0x1f02('0x2c')][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xd2'),_0x51e4a8));var _0xe9e2f6=this['getQueryOdbc'][_0x1f02('0x6c')](this,_0x1e52bb,_0x51e4a8);this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x4a69b1,_0x51e4a8);if(!this['isConfigured'](_0x4a69b1['variable_id'])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}var _0x1d1c89=this['getVariable']['sync'](this,_0x4a69b1[_0x1f02('0xd4')]);if(!_0x1d1c89){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x4a69b1,_0x1f02('0xd5'));}var _0x3aa39c=this;_0xe9e2f6[_0x1f02('0xd6')](function(_0x5a9223,_0x2872b8){Object[_0x1f02('0xd7')](_0x5a9223)['forEach'](function(_0x3fcc15){_0x3aa39c[_0x1f02('0x31')][_0x1f02('0x97')](util['format']('%s[%s][%s]',_0x1d1c89,_0x2872b8,_0x3fcc15),_0x5a9223[_0x3fcc15]);});});this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('%s_ROWS_COUNT',_0x1d1c89),_0xe9e2f6[_0x1f02('0x9a')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xd8'),_0x1d1c89));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xd9')]=function(_0x5035f9){logger['debug'](util['format'](_0x1f02('0xda'),_0x5035f9[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x5035f9[_0x1f02('0xdb')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x5035f9,_0x1f02('0xdc'));}var _0x25c421=this[_0x1f02('0x18')][_0x1f02('0x6c')](this,_0x5035f9[_0x1f02('0xdb')]);if(!_0x25c421){return this[_0x1f02('0x31')]['error'](_0x5035f9,_0x1f02('0xdd'));}var _0x205372=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0xde'),[util[_0x1f02('0x26')](_0x1f02('0xdf'),_0x25c421),_0x5035f9['timeout'],_0x5035f9[_0x1f02('0xe0')],_0x5035f9[_0x1f02('0x60')]]);if(_0x205372[_0x1f02('0x9e')]===-0x1){return _0x205372;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xe1'),_0x1f02('0xde')));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xe2')]=function(_0x1f7276){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1f7276[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1f7276['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}if(!this['isConfigured'](_0x1f7276[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this['channel'][_0x1f02('0xe4')]=!![];this[_0x1f02('0x30')](_0x1f7276);this[_0x1f02('0x3e')](_0x1f7276[_0x1f02('0x57')],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xe5'),_0x1f7276['text']));var _0x9665c4=this[_0x1f02('0x75')]['sync'](this,_0x1f7276);if(_0x9665c4){for(var _0x15c2bf in _0x9665c4){if(_0x9665c4[_0x1f02('0x8f')](_0x15c2bf)){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0xe6'),_0x15c2bf[_0x1f02('0xe7')]()),_0x9665c4[_0x15c2bf]);}}this[_0x1f02('0x3e')](_0x9665c4[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xe2'),'');return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Dialogflow\x20Result\x20%s',_0x9665c4[_0x1f02('0xe8')]));}return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1f7276,_0x1f02('0xea'));};AGIVertices['prototype']['dialogflowV2']=function(_0x1ecd32){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xeb'),_0x1ecd32[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1ecd32['dialogflowV2_project_id'])){return this['channel'][_0x1f02('0xa4')]('no\x20project_id\x20configured');}if(!this[_0x1f02('0x7d')](_0x1ecd32[_0x1f02('0xec')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xed'));}if(!this['isConfigured'](_0x1ecd32[_0x1f02('0x78')])){return this['channel'][_0x1f02('0xa4')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x1ecd32['dialogflowV2_language'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xee'));}if(!this['isConfigured'](_0x1ecd32[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')]['bot']=!![];this['createSquareDetailsReport'](_0x1ecd32);this['createSquareMessage'](_0x1ecd32['text'],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x1ecd32[_0x1f02('0x57')]));var _0x1e5743=this['googleDialogflowV2']['sync'](this,_0x1ecd32);if(_0x1e5743){for(var _0x1b05b3 in _0x1e5743){if(_0x1e5743[_0x1f02('0x8f')](_0x1b05b3)){if(_0x1b05b3!==_0x1f02('0xef')){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('DIALOGFLOW_%s',_0x1b05b3[_0x1f02('0xe7')]()),_0x1e5743[_0x1b05b3]);}}}this[_0x1f02('0x3e')](_0x1e5743[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xf0'),_0x1e5743[_0x1f02('0xef')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0xf1'),_0x1e5743[_0x1f02('0xe8')]));}return this['channel'][_0x1f02('0x29')](_0x1ecd32,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1f02('0xd')][_0x1f02('0xf2')]=function(_0x26f4c0){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0xf3'),_0x26f4c0['label']));if(!this[_0x1f02('0x7d')](_0x26f4c0[_0x1f02('0xf4')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x26f4c0[_0x1f02('0xf5')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xf6'));}if(!this['isConfigured'](_0x26f4c0[_0x1f02('0xf7')])){return this['channel'][_0x1f02('0xa4')]('no\x20password\x20configured');}if(!this[_0x1f02('0x7d')](_0x26f4c0[_0x1f02('0xf8')])){return this[_0x1f02('0x31')]['noop'](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xe4')]=!![];this[_0x1f02('0x30')](_0x26f4c0);this[_0x1f02('0x3e')](_0x26f4c0[_0x1f02('0x57')],'in','','');this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Trying\x20SestekNDA:\x20%s',_0x26f4c0['text']));var _0x55aec4=this[_0x1f02('0x79')][_0x1f02('0x6c')](this,_0x26f4c0);if(_0x55aec4){for(var _0x361502 in _0x55aec4){if(_0x55aec4[_0x1f02('0x8f')](_0x361502)){this[_0x1f02('0x31')]['setVariable'](util[_0x1f02('0x26')]('SESTEK_NDA_%s',_0x361502[_0x1f02('0xe7')]()),_0x55aec4[_0x361502]);}}this[_0x1f02('0x3e')](_0x55aec4[_0x1f02('0xe8')],_0x1f02('0xe9'),_0x1f02('0xf2'),'');if(_0x55aec4[_0x1f02('0xf9')]){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xfa'),_0x55aec4['audiofile']));var _0x258e30=this['channel']['streamFile'](_0x55aec4[_0x1f02('0xf9')]);try{fs[_0x1f02('0xfb')](_0x55aec4['audiofile']+_0x1f02('0xfc'));}catch(_0x496fec){logger['error'](_0x496fec);}return _0x258e30;}else{return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xfd'),_0x55aec4[_0x1f02('0xe8')]));}}return this[_0x1f02('0x31')]['error'](_0x26f4c0,_0x1f02('0xfe'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xff')]=function(_0x15a331){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x100'),_0x15a331[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')]('end');};AGIVertices['prototype'][_0x1f02('0x101')]=function(_0x1152b5){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x102'),_0x1152b5[_0x1f02('0x33')]));var _0xb4b4a5='';if(_0x1152b5[_0x1f02('0x103')]){if(!this[_0x1f02('0x7d')](_0x1152b5[_0x1f02('0x103')])){return this['channel']['error'](_0x1152b5,_0x1f02('0x104'));}else{var _0x271e0c=parseInt(_0x1152b5[_0x1f02('0x103')],0xa);if(isNaN(_0x271e0c)){_0xb4b4a5=_0x1152b5[_0x1f02('0x103')];}else{_0xb4b4a5=this['getTrunk']['sync'](this,_0x1152b5[_0x1f02('0x103')]);if(!_0xb4b4a5){return this[_0x1f02('0x31')]['error'](_0x1152b5,_0x1f02('0x105'));}}}}else if(_0x1152b5['trunk_name']){_0xb4b4a5=_0x1152b5['trunk_name'];}else{return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1152b5,_0x1f02('0x104'));}var _0x2e1024=this['channel'][_0x1f02('0x52')](_0x1f02('0xde'),[util[_0x1f02('0x26')](_0x1f02('0x106'),_0xb4b4a5,_0x1152b5[_0x1f02('0x44')]),_0x1152b5[_0x1f02('0x62')],_0x1152b5[_0x1f02('0xe0')],_0x1152b5[_0x1f02('0x60')]]);if(_0x2e1024['result']===-0x1){return _0x2e1024;}return this['channel']['noop'](util['format'](_0x1f02('0xe1'),_0x1f02('0xde')));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x107')]=function(_0x141a84){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x108'),_0x141a84[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x107'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0xb')]=function(_0x36665a){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x109'),_0x36665a[_0x1f02('0x33')]));if(_0x36665a['retry']===0x0){return this[_0x1f02('0xa1')](_0x36665a);}_0x36665a[_0x1f02('0xa2')]-=0x1;if(!this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0x10a')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x36665a,_0x1f02('0x10b'));}var _0x308f5a=this[_0x1f02('0x1b')]['sync'](this,_0x36665a['file_id']);if(!_0x308f5a){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x36665a,_0x1f02('0x10c'));}if(!this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0xd4')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1f02('0xd3'));}var _0x4e2f04=this[_0x1f02('0x31')][_0x1f02('0x10d')](_0x308f5a,_0x36665a['response'],_0x36665a[_0x1f02('0x10e')]);var _0x64def1=_0x4e2f04[_0x1f02('0x9e')]?_0x4e2f04[_0x1f02('0x9e')][_0x1f02('0x9c')]():'';logger[_0x1f02('0x2b')](_0x1f02('0x10f'),JSON[_0x1f02('0x6e')](_0x4e2f04));if(_0x4e2f04[_0x1f02('0x9e')]===-0x1){this[_0x1f02('0x30')]['sync'](this,_0x36665a,_0x64def1);return _0x4e2f04;}else if(_0x4e2f04[_0x1f02('0xa0')]===_0x1f02('0x62')){_0x4e2f04[_0x1f02('0x9e')]=_0x64def1['length']>=parseInt(_0x36665a[_0x1f02('0x110')])?'x':'i';}else{_0x4e2f04[_0x1f02('0x9e')]=_0x64def1['length']>=parseInt(_0x36665a[_0x1f02('0x110')])&&_0x64def1[_0x1f02('0x9a')]<=parseInt(_0x36665a['maxdigit'])?'x':'i';}var _0x1d576b=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x36665a[_0x1f02('0xd4')]);if(!_0x1d576b){return this[_0x1f02('0x31')]['error'](_0x36665a,_0x1f02('0xd5'));}this[_0x1f02('0x31')][_0x1f02('0x97')](_0x1d576b,_0x64def1);if(this[_0x1f02('0x7d')](_0x36665a[_0x1f02('0x111')])){var _0xd5282d=parseInt(_0x36665a['hiddendigitsnum'],0xa);var _0x18e4b6=rs['generate']({'charset':'*','length':_0xd5282d});var _0x1109e4=_0x64def1['length'];if(_0x1109e4>0x0){if(_0x1109e4>_0xd5282d){this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x36665a,_0x36665a[_0x1f02('0x112')]===_0x1f02('0x113')?_0x18e4b6+_0x64def1['substr'](_0xd5282d):_0x64def1[_0x1f02('0x114')](0x0,_0x1109e4-_0xd5282d)+_0x18e4b6);}else{this[_0x1f02('0x30')]['sync'](this,_0x36665a,rs['generate']({'charset':'*','length':_0x1109e4}));}}else{this[_0x1f02('0x30')]['sync'](this,_0x36665a,'');}}else{this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x36665a,_0x64def1);}return _0x4e2f04;};AGIVertices[_0x1f02('0xd')]['getsecretdigits']=function(_0x174a92){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x115'),_0x174a92[_0x1f02('0x33')]));return this[_0x1f02('0xb')](_0x174a92);};AGIVertices['prototype'][_0x1f02('0x116')]=function(_0x345f13){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x345f13[_0x1f02('0x33')]));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x345f13,_0x345f13[_0x1f02('0x117')]);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x118'),_0x345f13[_0x1f02('0x117')]));};AGIVertices[_0x1f02('0xd')]['awspolly']=function(_0x85b43e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x119'),_0x85b43e[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x85b43e['aws_access_key_id'])||!this[_0x1f02('0x7d')](_0x85b43e['aws_secret_access_key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x11a'));}if(!this[_0x1f02('0x7d')](_0x85b43e[_0x1f02('0x57')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xa5'));}this['channel']['noop'](util[_0x1f02('0x26')](_0x1f02('0x11b'),_0x85b43e[_0x1f02('0x57')]));var _0x834de6=this['awsPolly'][_0x1f02('0x6c')](this,_0x85b43e);if(_0x834de6){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x834de6));var _0x31c1d6=this[_0x1f02('0x31')][_0x1f02('0x11c')](_0x834de6);try{fs[_0x1f02('0xfb')](_0x834de6+_0x1f02('0xfc'));}catch(_0x2ccd72){logger[_0x1f02('0x29')](_0x2ccd72);}return _0x31c1d6;}return this['channel'][_0x1f02('0x29')](_0x85b43e,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x16a2f8){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x11d'),_0x16a2f8[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x16a2f8['aws_access_key_id'])||!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x11e')])){return this[_0x1f02('0x31')]['noop'](_0x1f02('0x11a'));}if(!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x86')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20bot\x20name\x20configured');}if(!this[_0x1f02('0x7d')](_0x16a2f8[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xe4')]=!![];this['createSquareDetailsReport'](_0x16a2f8);this[_0x1f02('0x3e')](_0x16a2f8[_0x1f02('0x57')],'in','','');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x11f'),_0x16a2f8[_0x1f02('0x57')]));var _0x6dee9b=this['awsLex'][_0x1f02('0x6c')](this,_0x16a2f8);if(_0x6dee9b){for(var _0x566cdb in _0x6dee9b){if(_0x6dee9b['hasOwnProperty'](_0x566cdb)&&_['isString'](_0x6dee9b[_0x566cdb])){this['channel'][_0x1f02('0x97')](util['format'](_0x1f02('0x120'),_0x566cdb[_0x1f02('0xe7')]()),_0x6dee9b[_0x566cdb]);}}if(_[_0x1f02('0x41')](_0x6dee9b[_0x1f02('0x72')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1f02('0x3e')](_0x6dee9b[_0x1f02('0x72')],_0x1f02('0xe9'),_0x1f02('0x121'),'');return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x122'),_0x6dee9b['message']));}}return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x16a2f8,_0x1f02('0x123'));};AGIVertices[_0x1f02('0xd')]['googleasr']=function(_0x24d3b9){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x124'),_0x24d3b9[_0x1f02('0x33')],_0x24d3b9[_0x1f02('0x62')]));if(!this[_0x1f02('0x7d')](_0x24d3b9['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20key\x20configured');}var _0x2860c1=_0x1f02('0x125');var _0x3753df=util[_0x1f02('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x12f785=util['format'](_0x1f02('0x96'),_0x3753df,_0x2860c1);var _0x9a5e31=!![];if(_0x24d3b9['beep']===_0x1f02('0x127')){_0x9a5e31=![];}var _0x9a077e=this[_0x1f02('0x31')]['recordFile'](_0x3753df,_0x2860c1,_0x24d3b9[_0x1f02('0x128')],_0x24d3b9[_0x1f02('0x62')],undefined,_0x9a5e31);if(_0x9a077e['result']!==-0x1){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x129'),_0x12f785));var _0x30c50d=this[_0x1f02('0x87')][_0x1f02('0x6c')](this,_0x24d3b9,_0x12f785);if(_0x30c50d){for(var _0x10d3a1 in _0x30c50d){if(_0x30c50d[_0x1f02('0x8f')](_0x10d3a1)){this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')]('GOOGLE_ASR_%s',_0x10d3a1[_0x1f02('0xe7')]()),_0x30c50d[_0x10d3a1]);}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x12a'),JSON[_0x1f02('0x6e')](_0x30c50d)));}}return _0x9a077e;};AGIVertices[_0x1f02('0xd')][_0x1f02('0x12b')]=function(_0xb3363a){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x12c'),_0xb3363a[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0xb3363a[_0x1f02('0x8a')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x12d'));}if(!this['isConfigured'](_0xb3363a[_0x1f02('0x8b')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0x12e'));}var _0x3bcd5f=_0x1f02('0x125');var _0x188729=util[_0x1f02('0x26')](_0x1f02('0x12f'),FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x33c851=util[_0x1f02('0x26')](_0x1f02('0x96'),_0x188729,_0x3bcd5f);var _0x585503=!![];if(_0xb3363a[_0x1f02('0x130')]===_0x1f02('0x127')){_0x585503=![];}var _0x320a4b=this[_0x1f02('0x31')][_0x1f02('0x131')](_0x188729,_0x3bcd5f,_0xb3363a[_0x1f02('0x128')],_0xb3363a[_0x1f02('0x62')],undefined,_0x585503);if(_0x320a4b['result']!==-0x1){this['channel']['noop'](util[_0x1f02('0x26')](_0x1f02('0x132'),_0x33c851));var _0x4e6c62=this[_0x1f02('0x89')][_0x1f02('0x6c')](this,_0xb3363a,_0x33c851);if(_0x4e6c62){for(var _0x4ff839 in _0x4e6c62){if(_0x4e6c62[_0x1f02('0x8f')](_0x4ff839)){this[_0x1f02('0x31')]['setVariable'](util['format'](_0x1f02('0x133'),_0x4ff839['toUpperCase']()),_0x4e6c62[_0x4ff839]);}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x134'),JSON[_0x1f02('0x6e')](_0x4e6c62)));}}return _0x320a4b;};AGIVertices[_0x1f02('0xd')][_0x1f02('0x135')]=function(_0x2b7831){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x136'),_0x2b7831[_0x1f02('0x33')]));return this[_0x1f02('0x31')]['continueAt'](_0x2b7831[_0x1f02('0x38')],_0x2b7831['extension'],_0x2b7831[_0x1f02('0x3a')]);};AGIVertices['prototype'][_0x1f02('0x137')]=function(_0x1767e4){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x138'),_0x1767e4[_0x1f02('0x33')]));if(!this['isConfigured'](_0x1767e4[_0x1f02('0x139')])){return this[_0x1f02('0x31')]['error'](_0x1767e4,_0x1f02('0x13a'));}try{var _0x5614c2=eval(_0x1767e4['condition'])?_0x1f02('0x13b'):_0x1f02('0x13c');this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x13d'),_0x1767e4[_0x1f02('0x139')],_0x5614c2));return{'code':0xc8,'result':_0x5614c2};}catch(_0x2c018f){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x21e6c2){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x13e'),_0x21e6c2[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x21e6c2[_0x1f02('0x13f')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x21e6c2,_0x1f02('0x140'));}var _0xc7868f=this[_0x1f02('0x22')]['sync'](this,_0x21e6c2[_0x1f02('0x13f')]);if(!_0xc7868f){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x21e6c2,'no\x20intervals\x20found');}for(var _0x4252a7=0x0;_0x4252a7<_0xc7868f[_0x1f02('0x9a')];_0x4252a7+=0x1){var _0x47d5de=this[_0x1f02('0x31')][_0x1f02('0xe')](util['format'](_0x1f02('0x141'),_0xc7868f[_0x4252a7]));if(_0x47d5de['result']===-0x1){return _0x47d5de;}logger['info'](util['format'](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x47d5de['extra']));if(_0x47d5de[_0x1f02('0xa0')]===_0x1f02('0x13b')){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('IFTIME\x20%s\x20%s',_0xc7868f[_0x4252a7],'true'));this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x1f02('0x13b')));return{'code':0xc8,'result':_0x1f02('0x13b')};}else{logger['info'](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],'false'));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x142'),_0xc7868f[_0x4252a7],_0x1f02('0x13c')));}}return{'code':0xc8,'result':_0x1f02('0x13c')};};AGIVertices[_0x1f02('0xd')][_0x1f02('0x143')]=function(_0x2c9ca2){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x144'),_0x2c9ca2[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x143')]();};AGIVertices[_0x1f02('0xd')][_0x1f02('0x145')]=function(_0x414ee3){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x146'),_0x414ee3['label']));if(!this[_0x1f02('0x7d')](_0x414ee3['key'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}var _0x1d40be=_0x1f02('0x125');var _0x5b012e=util[_0x1f02('0x26')](_0x1f02('0x12f'),FILES_PATH,rs[_0x1f02('0x126')](0x4));var _0x572151=util[_0x1f02('0x26')](_0x1f02('0x96'),_0x5b012e,_0x1d40be);var _0x9e0038=!![];if(_0x414ee3[_0x1f02('0x130')]==='NOBEEP'){_0x9e0038=![];}var _0x5a6fec=this[_0x1f02('0x31')]['recordFile'](_0x5b012e,_0x1d40be,_0x414ee3[_0x1f02('0x128')],_0x414ee3[_0x1f02('0x62')],undefined,_0x9e0038);if(_0x5a6fec[_0x1f02('0x9e')]!==-0x1){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x572151));var _0x4898ab=this[_0x1f02('0x7b')][_0x1f02('0x6c')](this,_0x414ee3,_0x572151);if(_0x4898ab){for(var _0x38d9d3 in _0x4898ab){if(_0x4898ab[_0x1f02('0x8f')](_0x38d9d3)){this[_0x1f02('0x31')]['setVariable'](util[_0x1f02('0x26')](_0x1f02('0x147'),_0x38d9d3[_0x1f02('0xe7')]()),_0x4898ab[_0x38d9d3]);}}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x148'),JSON[_0x1f02('0x6e')](_0x4898ab)));}}return _0x5a6fec;};AGIVertices[_0x1f02('0xd')]['ispeechtts']=function(_0x4a8978){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4a8978[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x4a8978[_0x1f02('0x76')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xe3'));}if(!this[_0x1f02('0x7d')](_0x4a8978[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20text\x20configured');}this['channel'][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x149'),_0x4a8978['text']));var _0x160f2b=this[_0x1f02('0x7a')][_0x1f02('0x6c')](this,_0x4a8978);if(_0x160f2b){this['channel']['noop'](util[_0x1f02('0x26')]('ispeech\x20%s\x20file\x20created',_0x160f2b));var _0x2fbb6c=this[_0x1f02('0x31')][_0x1f02('0x11c')](_0x160f2b,_0x4a8978[_0x1f02('0x128')]);try{fs[_0x1f02('0xfb')](_0x160f2b+_0x1f02('0xfc'));}catch(_0x4085fa){logger[_0x1f02('0x29')](_0x4085fa);}return _0x2fbb6c;}return this['channel'][_0x1f02('0x29')](_0x4a8978,_0x1f02('0x14a'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x14b')]=function(_0x541976){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x14c'),_0x541976[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x541976[_0x1f02('0x14d')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x541976,'no\x20find\x20by\x20configured');}logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x14e'),this['channel'][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));var _0x4ef577=this['agentLogin'][_0x1f02('0x6c')](this,_0x541976[_0x1f02('0x14d')]);if(_0x4ef577){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));this['channel']['noop'](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger[_0x1f02('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x541976[_0x1f02('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x151')]=function(_0x5c4eb4){logger['info'](util[_0x1f02('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5c4eb4['label']));if(!this['isConfigured'](_0x5c4eb4['findBy'])){return this['channel'][_0x1f02('0x29')](_0x5c4eb4,_0x1f02('0x152'));}logger['info'](util[_0x1f02('0x26')](_0x1f02('0x14e'),this[_0x1f02('0x31')]['callerid'],_0x5c4eb4[_0x1f02('0x14d')]));var _0x4bd535=this[_0x1f02('0x4d')][_0x1f02('0x6c')](this,_0x5c4eb4[_0x1f02('0x14d')]);if(_0x4bd535){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5c4eb4[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger['info'](util['format'](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x5c4eb4['findBy']));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices['prototype']['math']=function(_0x47197c){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x155'),_0x47197c[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x47197c[_0x1f02('0x156')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x47197c,_0x1f02('0x157'));}this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x158'),_0x47197c[_0x1f02('0x156')]));var _0x40b22d=eval(_0x47197c[_0x1f02('0x156')]);if(!this['isConfigured'](_0x47197c[_0x1f02('0xd4')])){return this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}var _0x219ffd=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x47197c[_0x1f02('0xd4')]);if(!_0x219ffd){return this['channel'][_0x1f02('0x29')](_0x47197c,'no\x20variable\x20found');}if(_[_0x1f02('0x94')](_0x40b22d)){var _0x2a936e=this;_0x40b22d[_0x1f02('0xd6')](function(_0x13f1a3,_0xa0cebe){_0x2a936e[_0x1f02('0x31')][_0x1f02('0x97')](util['format'](_0x1f02('0x159'),_0x219ffd,_0xa0cebe),_0x13f1a3);});return this[_0x1f02('0x31')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x219ffd));}else{return this[_0x1f02('0x31')][_0x1f02('0x97')](_0x219ffd,_0x40b22d);}};AGIVertices['prototype']['menu']=function(_0x1eaa43){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x15a'),_0x1eaa43[_0x1f02('0x33')]));if(_0x1eaa43[_0x1f02('0xa2')]===0x0){return this[_0x1f02('0xa1')](_0x1eaa43);}_0x1eaa43[_0x1f02('0xa2')]-=0x1;if(!this[_0x1f02('0x7d')](_0x1eaa43['file_id'])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0x10b'));}var _0x2f2d3f=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x1eaa43['file_id']);if(!_0x2f2d3f){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0x10c'));}var _0x100748=this['channel'][_0x1f02('0x10d')](_0x2f2d3f,_0x1eaa43[_0x1f02('0x15b')],_0x1eaa43['digit']);var _0x2e55a8=_0x100748['result'];if(_0x100748['result']===-0x1){this[_0x1f02('0x30')]['sync'](this,_0x1eaa43,'-1');return _0x100748;}else if(_0x100748[_0x1f02('0xa0')]===_0x1f02('0x62')){_0x100748[_0x1f02('0x9e')]=_0x100748[_0x1f02('0x9e')][_0x1f02('0x9a')]>0x0?_0x100748['result']:'t';}else if(_['isEmpty'](_0x100748[_0x1f02('0x9e')])){_0x100748[_0x1f02('0x9e')]='#';_0x2e55a8='#';}if(!this[_0x1f02('0x7d')](_0x1eaa43['variable_id'])){this['channel'][_0x1f02('0xa4')](_0x1f02('0xd3'));}else{var _0x458575=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x1eaa43[_0x1f02('0xd4')]);if(!_0x458575){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x1eaa43,_0x1f02('0xd5'));}this[_0x1f02('0x31')][_0x1f02('0x97')](_0x458575,_0x2e55a8);}this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x1eaa43,_0x2e55a8);return _0x100748;};AGIVertices[_0x1f02('0xd')][_0x1f02('0xa4')]=function(_0x5abfa8){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x15c'),_0x5abfa8[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x5abfa8[_0x1f02('0x15d')]||_0x5abfa8[_0x1f02('0x33')]);};AGIVertices[_0x1f02('0xd')]['pause']=function(_0x1a07ef){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x15e'),_0x1a07ef[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x1a07ef['findBy'])){return this['channel'][_0x1f02('0x29')](_0x1a07ef,_0x1f02('0x152'));}logger[_0x1f02('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));var _0x2bc745=this[_0x1f02('0x15f')][_0x1f02('0x6c')](this,_0x1a07ef[_0x1f02('0x160')]);var _0x200640=this[_0x1f02('0x4a')][_0x1f02('0x6c')](this,_0x1a07ef[_0x1f02('0x14d')],_0x2bc745);if(_0x200640){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')]['callerid'],_0x1a07ef[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x1f02('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x1a07ef[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x161')]=function(_0x427731){logger['info'](util[_0x1f02('0x26')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x427731['label']));if(!this['isConfigured'](_0x427731[_0x1f02('0x10a')])){return this['channel']['error'](_0x427731,_0x1f02('0x10b'));}var _0x1ef94a=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x427731[_0x1f02('0x10a')]);if(!_0x1ef94a){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x427731,'no\x20file\x20audio\x20found');}var _0x3c8d12=this[_0x1f02('0x31')]['exec'](_0x1f02('0x162'),[_0x1ef94a,_0x427731[_0x1f02('0xe0')]]);if(_0x3c8d12['result']===-0x1){return _0x3c8d12;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Executed\x20command\x20%s\x20%s',_0x1f02('0x162'),_0x1ef94a));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x163')]=function(_0x477346){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x164'),_0x477346[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x477346[_0x1f02('0x165')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x477346,_0x1f02('0x166'));}var _0x222b77='';var _0x3df626=parseInt(_0x477346[_0x1f02('0x165')],0xa);if(isNaN(_0x3df626)){_0x222b77=_0x477346['queue_id'];}else{_0x222b77=this[_0x1f02('0x12')]['sync'](this,_0x477346[_0x1f02('0x165')]);if(!_0x222b77){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x477346,_0x1f02('0x167'));}}var _0x53c515='';if(this[_0x1f02('0x7d')](_0x477346[_0x1f02('0x10a')])){var _0x2a6b61=this[_0x1f02('0x1b')][_0x1f02('0x6c')](this,_0x477346[_0x1f02('0x10a')]);if(_0x2a6b61){_0x53c515=_0x2a6b61;}}this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x477346,_0x222b77);if(_0x477346[_0x1f02('0xe0')]['indexOf']('x')<0x0){_0x477346[_0x1f02('0xe0')]+='x';}if(_0x477346[_0x1f02('0xe0')][_0x1f02('0x168')]('X')<0x0){_0x477346['opts']+='X';}this['channel'][_0x1f02('0x97')](_0x1f02('0x169'),_0x222b77?_0x222b77[_0x1f02('0x16a')]():'');var _0x2be586=this[_0x1f02('0x31')]['exec'](_0x1f02('0x16b'),[_0x222b77,_0x477346[_0x1f02('0xe0')],_0x477346[_0x1f02('0x60')],_0x53c515,_0x477346[_0x1f02('0x62')],_0x477346[_0x1f02('0x7')],_0x477346[_0x1f02('0x16c')],_0x477346[_0x1f02('0x16d')],'',_0x477346[_0x1f02('0x16e')]]);if(_0x2be586[_0x1f02('0x9e')]===-0x1){return _0x2be586;}return this['channel'][_0x1f02('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x1f02('0x16b'),_0x222b77));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x16f')]=function(_0xd01a3d){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x170'),_0xd01a3d['label']));var _0x49d028=_0xd01a3d[_0x1f02('0x171')]||_0x1f02('0x125');var _0x46c396=util[_0x1f02('0x26')](_0x1f02('0x172'),this[_0x1f02('0x31')]['uniqueid'],rs['generate'](0x5));var _0x104f90=util[_0x1f02('0x26')](_0x1f02('0x173'),FILES_PATH,_0x46c396,_0x49d028);var _0x1c34ab=util[_0x1f02('0x26')]('%s/recordings/%s',FILES_PATH,_0x46c396);this[_0x1f02('0x35')][_0x1f02('0x6c')](this,_0xd01a3d,_0x46c396,_0x104f90);this[_0x1f02('0x31')]['setVariable'](_0x1f02('0x174'),_0x46c396);logger[_0x1f02('0x2b')](_0x1f02('0x175'),_0x1c34ab,_0x49d028,_0xd01a3d[_0x1f02('0x176')],_0xd01a3d[_0x1f02('0x62')]);return this['channel'][_0x1f02('0x131')](_0x1c34ab,_0x49d028,_0xd01a3d[_0x1f02('0x176')],_0xd01a3d[_0x1f02('0x62')],undefined,!![]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x177')]=function(_0x47a4cb){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x178'),_0x47a4cb[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x47a4cb[_0x1f02('0x60')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20url\x20configured');}var _0x4675c3=this['restAPI']['sync'](this,_0x47a4cb);logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x179'),util[_0x1f02('0x17a')](_0x4675c3,{'showHidden':![],'depth':null})));if(!this[_0x1f02('0x7d')](_0x47a4cb[_0x1f02('0xd4')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x522d10=this[_0x1f02('0xe')]['sync'](this,_0x47a4cb[_0x1f02('0xd4')]);if(!_0x522d10){return this['channel']['error'](_0x47a4cb,'no\x20variable\x20found');}this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x17b'),_0x522d10),_0x4675c3[_0x1f02('0x70')]?_0x4675c3['statusCode']:_0x1f02('0x17c'));this[_0x1f02('0x31')][_0x1f02('0x97')](util[_0x1f02('0x26')](_0x1f02('0x17d'),_0x522d10),_0x4675c3['statusMessage']?_0x4675c3[_0x1f02('0x71')]:'OK');if(_0x4675c3[_0x1f02('0x65')]){try{this[_0x1f02('0x95')](_0x4675c3[_0x1f02('0x65')],_0x522d10);}catch(_0x44d180){logger[_0x1f02('0x29')](util[_0x1f02('0x26')](_0x1f02('0x17e'),_0x522d10));}}return this[_0x1f02('0x31')]['noop'](util['format']('variable\x20%s\x20set',_0x522d10));};AGIVertices['prototype']['saydigits']=function(_0x4489bc){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x17f'),_0x4489bc['label']));return this['channel'][_0x1f02('0x180')](_0x4489bc[_0x1f02('0x181')][_0x1f02('0xd1')](/\s+/g,''),_0x4489bc['escape_digits']);};AGIVertices[_0x1f02('0xd')]['saynumber']=function(_0xd945e3){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x182'),_0xd945e3[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x183')](_0xd945e3[_0x1f02('0x63')][_0x1f02('0xd1')](/\s+/g,''),_0xd945e3['escape_digits']);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x184')]=function(_0x4f31f4){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4f31f4[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0x185')](_0x4f31f4[_0x1f02('0x57')],_0x4f31f4[_0x1f02('0x176')]);};AGIVertices[_0x1f02('0xd')][_0x1f02('0x186')]=function(_0x487acd){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x487acd[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x487acd[_0x1f02('0x187')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')]('no\x20mail\x20account\x20configured');}var _0x59c067=this['getMailAccount'][_0x1f02('0x6c')](this,_0x487acd[_0x1f02('0x187')]);if(!_0x59c067||!_0x59c067[_0x1f02('0x188')]){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x487acd,_0x1f02('0x189'));}var _0x53dddd={'from':util[_0x1f02('0x26')](_0x1f02('0x18a'),_0x59c067[_0x1f02('0x11')],_0x59c067[_0x1f02('0x18b')]||_0x59c067[_0x1f02('0x188')][_0x1f02('0x18c')]),'to':_0x487acd['to']||'','cc':_0x487acd['cc']||'','bcc':_0x487acd[_0x1f02('0x18d')]||'','subject':_0x487acd[_0x1f02('0x18e')],'html':_0x487acd[_0x1f02('0x57')],'text':_0x487acd[_0x1f02('0x57')]};if(this['isConfigured'](_0x487acd['template_id'])){}logger[_0x1f02('0x18f')]('sendMail\x20message',JSON['stringify'](_0x53dddd));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x487acd,_0x487acd[_0x1f02('0x187')]);this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x190'),_0x59c067[_0x1f02('0x11')]));this[_0x1f02('0x20')][_0x1f02('0x6c')](this,_0x59c067[_0x1f02('0x191')],_0x53dddd);return this['channel'][_0x1f02('0xa4')](_0x1f02('0x192'));};AGIVertices['prototype'][_0x1f02('0x193')]=function(_0x53f733){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x53f733[_0x1f02('0x33')]));return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x194'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x195')]=function(_0x31c49e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x196'),_0x31c49e[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x31c49e['sms_account_id'])){return this['channel']['noop'](_0x1f02('0x197'));}var _0x2c2b75=this['getSmsAccount']['sync'](this,_0x31c49e[_0x1f02('0x198')]);if(!_0x2c2b75){return this[_0x1f02('0x31')]['error'](_0x31c49e,_0x1f02('0x199'));}var _0xb276e={'body':_0x31c49e[_0x1f02('0x19a')],'phone':_0x31c49e['to']||'','SmsAccountId':_0x2c2b75['id']};logger['debug'](_0x1f02('0x19b'),JSON[_0x1f02('0x6e')](_0xb276e));this[_0x1f02('0x30')][_0x1f02('0x6c')](this,_0x31c49e,_0x31c49e[_0x1f02('0x198')]);this[_0x1f02('0x31')]['noop'](util['format'](_0x1f02('0x19c'),_0x2c2b75[_0x1f02('0x11')]));this[_0x1f02('0x2f')][_0x1f02('0x6c')](this,_0xb276e);return this['channel'][_0x1f02('0xa4')](_0x1f02('0x19d'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x19e')]=function(_0x411f05){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x411f05[_0x1f02('0x33')]));if(!this['isConfigured'](_0x411f05[_0x1f02('0xd4')])){return this['channel'][_0x1f02('0x29')](_0x411f05,_0x1f02('0x19f'));}var _0x385d3c=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x411f05[_0x1f02('0xd4')]);if(!_0x385d3c){return this['channel']['error'](_0x411f05,_0x1f02('0xd5'));}return this['channel'][_0x1f02('0x97')](_0x385d3c,_0x411f05[_0x1f02('0x1a0')]);};AGIVertices[_0x1f02('0xd')]['start']=function(_0x46d4dc){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1a1'),_0x46d4dc['label']));this[_0x1f02('0x31')][_0x1f02('0xa4')]('START\x20CALLY\x20SQUARE');var _0x14cd84=this['channel'][_0x1f02('0xe')](_0x1f02('0x1a2'));if(!_[_0x1f02('0x40')](_0x14cd84[_0x1f02('0xa0')])){this['channel'][_0x1f02('0x32')]=_0x14cd84[_0x1f02('0xa0')];}if(_0x46d4dc[_0x1f02('0xb0')]===_0x1f02('0x1a3')){this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x1a4'));return this[_0x1f02('0x31')][_0x1f02('0xb0')]();}return this['channel'][_0x1f02('0xa4')](_0x1f02('0x1a5'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1a6')]=function(_0x299ac1){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x1a7'),_0x299ac1[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x299ac1[_0x1f02('0x1a8')])){return this['channel'][_0x1f02('0x29')](_0x299ac1,'no\x20subproject\x20selected');}var _0xb854e6=this[_0x1f02('0x15')][_0x1f02('0x6c')](this,_0x299ac1[_0x1f02('0x1a8')]);if(!this[_0x1f02('0x7d')](_0xb854e6)){return this['channel'][_0x1f02('0x29')](_0x299ac1,util[_0x1f02('0x26')](_0x1f02('0x1a9'),_0x299ac1[_0x1f02('0x1a8')]));}if(_0xb854e6===this['channel'][_0x1f02('0x1aa')]){return this[_0x1f02('0x31')]['error'](_0x299ac1,_0x1f02('0x1ab'));}this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x299ac1,_0xb854e6);var _0x3ec105=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0x1ac'),util['format'](_0x1f02('0x1ad'),config[_0x1f02('0x7')][_0x1f02('0x1ae')]||_0x1f02('0x1af'),_0xb854e6,this[_0x1f02('0x31')]['arg_1']));if(_0x3ec105['result']===-0x1){return _0x3ec105;}return this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0xbb'),_0x1f02('0x1ac'),_0xb854e6));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b0')]=function(_0x548b28){logger['info'](util[_0x1f02('0x26')](_0x1f02('0x1b1'),_0x548b28[_0x1f02('0x33')]));var _0x4379d3=this[_0x1f02('0x1b2')][_0x1f02('0x6c')](this,_0x548b28[_0x1f02('0xae')]);this['createSquareDetailsReport'][_0x1f02('0x6c')](this,_0x548b28,_0x548b28[_0x1f02('0xae')]);if(this[_0x1f02('0x7d')](_0x548b28[_0x1f02('0xd4')])){var _0x15117a=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x548b28[_0x1f02('0xd4')]);if(_0x15117a){this['channel'][_0x1f02('0x97')](_0x15117a,_0x4379d3);return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x548b28[_0x1f02('0xae')],_0x15117a));}}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x1b3'),_0x548b28[_0x1f02('0xae')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x21a2e1){logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x1b4'),_0x21a2e1[_0x1f02('0x33')]));_0x21a2e1['text']=_0x21a2e1[_0x1f02('0x57')][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1f02('0x7d')](_0x21a2e1[_0x1f02('0x55')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0x1b5'));}if(!this[_0x1f02('0x7d')](_0x21a2e1['text'])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')]['noop'](util[_0x1f02('0x26')](_0x1f02('0x1b6'),_0x21a2e1[_0x1f02('0x57')]));var _0x5846f7=this[_0x1f02('0x54')]['sync'](this,_0x21a2e1);if(_0x5846f7){this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5846f7));var _0x3f8295=this[_0x1f02('0x31')]['streamFile'](_0x5846f7);try{fs[_0x1f02('0xfb')](_0x5846f7+_0x1f02('0xfc'));}catch(_0x34ccc3){logger[_0x1f02('0x29')](_0x34ccc3);}return _0x3f8295;}return this['channel']['error'](_0x21a2e1,_0x1f02('0x1b7'));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1b8')]=function(_0x4c6dda){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1b9'),_0x4c6dda[_0x1f02('0x33')]));_0x4c6dda['text']=_0x4c6dda['text'][_0x1f02('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4c6dda[_0x1f02('0x57')])){return this[_0x1f02('0x31')][_0x1f02('0xa4')](_0x1f02('0xa5'));}this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x1ba'),_0x4c6dda[_0x1f02('0x57')]));var _0x37a92b=this[_0x1f02('0x5d')][_0x1f02('0x6c')](this,_0x4c6dda);if(_0x37a92b){this[_0x1f02('0x31')][_0x1f02('0xa4')](util['format'](_0x1f02('0x1bb'),_0x37a92b));var _0x318c58=this['channel'][_0x1f02('0x11c')](_0x37a92b);try{fs['unlink'](_0x37a92b+_0x1f02('0xfc'));}catch(_0x5d6c61){logger[_0x1f02('0x29')](_0x5d6c61);}return _0x318c58;}return this[_0x1f02('0x31')]['error'](_0x4c6dda,_0x1f02('0x1bc'));};AGIVertices['prototype']['unpause']=function(_0x41486a){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1bd'),_0x41486a[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x41486a[_0x1f02('0x14d')])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x41486a,_0x1f02('0x152'));}logger[_0x1f02('0x2b')](util['format'](_0x1f02('0x14e'),this['channel'][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));var _0x41ad3b=this[_0x1f02('0x4c')]['sync'](this,_0x41486a[_0x1f02('0x14d')]);if(_0x41ad3b){logger['info'](util[_0x1f02('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0x153'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x14f')};}else{logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x150'),this[_0x1f02('0x31')][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));this[_0x1f02('0x31')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1f02('0x36')],_0x41486a[_0x1f02('0x14d')]));return{'code':0xc8,'result':_0x1f02('0x154')};}};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1be')]=function(_0x26532e){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1bf'),_0x26532e[_0x1f02('0x33')]));var _0x1808d6=this[_0x1f02('0x31')][_0x1f02('0x52')](_0x1f02('0x1c0'),[_0x26532e[_0x1f02('0x1c1')],_0x26532e['options']]);if(_0x1808d6['result']===-0x1){return _0x1808d6;}return this[_0x1f02('0x31')][_0x1f02('0xa4')](util[_0x1f02('0x26')](_0x1f02('0xbb'),_0x1f02('0x1c0'),_0x26532e[_0x1f02('0x1c1')]));};AGIVertices[_0x1f02('0xd')][_0x1f02('0x1c2')]=function(_0x56016f){logger[_0x1f02('0x2b')](util[_0x1f02('0x26')](_0x1f02('0x1c3'),_0x56016f[_0x1f02('0x33')]));if(!this[_0x1f02('0x7d')](_0x56016f['variable_id'])){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x56016f,_0x1f02('0x19f'));}var _0x12ccdb=this[_0x1f02('0xe')][_0x1f02('0x6c')](this,_0x56016f[_0x1f02('0xd4')]);if(!_0x12ccdb){return this[_0x1f02('0x31')][_0x1f02('0x29')](_0x56016f,_0x1f02('0xd5'));}var _0x3ef629=this[_0x1f02('0x31')][_0x1f02('0xe')](_0x12ccdb);return{'code':0xc8,'result':_0x3ef629[_0x1f02('0xa0')]?_0x3ef629['extra']:'-'};};String[_0x1f02('0xd')][_0x1f02('0x9b')]=function(_0x2d9bf1,_0x1dddd3){return this[_0x1f02('0x99')](_0x2d9bf1)['join'](_0x1dddd3);};module[_0x1f02('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1caa5fa..cba4af6 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 _0xd2bc=['voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','catch','acwTimeout','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','destlinkedid','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','error','startAcw','interface','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent'];(function(_0x166976,_0x5c38c9){var _0x2b4dad=function(_0x2a3d96){while(--_0x2a3d96){_0x166976['push'](_0x166976['shift']());}};_0x2b4dad(++_0x5c38c9);}(_0xd2bc,0xd5));var _0xcd2b=function(_0x6252f6,_0x2beb98){_0x6252f6=_0x6252f6-0x0;var _0x21c2dc=_0xd2bc[_0x6252f6];return _0x21c2dc;};'use strict';var _=require(_0xcd2b('0x0'));var moment=require(_0xcd2b('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xcd2b('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5ddb0e){this['voiceQueues']=_0x5ddb0e[_0xcd2b('0x3')];this[_0xcd2b('0x4')]=_0x5ddb0e['agents'];this[_0xcd2b('0x5')]=_0x5ddb0e[_0xcd2b('0x5')];this[_0xcd2b('0x6')]={};ami['on'](_0xcd2b('0x7'),this[_0xcd2b('0x8')][_0xcd2b('0x9')](this));ami['on']('hanguprequest',this[_0xcd2b('0xa')][_0xcd2b('0x9')](this));ami['on'](_0xcd2b('0xb'),this[_0xcd2b('0xc')]['bind'](this));ami['on'](_0xcd2b('0xd'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('attendedtransfer',this[_0xcd2b('0xe')][_0xcd2b('0x9')](this));ami['on'](_0xcd2b('0xf'),this[_0xcd2b('0x10')][_0xcd2b('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xcd2b('0x11')]['bind'](this));}function getDiff(_0x54f38e){var _0x2dbf0f=moment()[_0xcd2b('0x12')](0x0);var _0x3e4bbb=moment(_0x54f38e)[_0xcd2b('0x12')](0x0);return _0x2dbf0f[_0xcd2b('0x13')](_0x3e4bbb,_0xcd2b('0x14'));}Acw['prototype'][_0xcd2b('0x15')]=function(_0x4a7ee0,_0x2eee84){var _0xaa8d06=this;var _0x335ef2=getDiff(_0xaa8d06[_0xcd2b('0x5')][_0x4a7ee0]['lastPauseAt']);clearTimeout(_0xaa8d06[_0xcd2b('0x5')][_0x4a7ee0][_0xcd2b('0x16')]);_0xaa8d06['timers'][_0x4a7ee0][_0xcd2b('0x16')]=![];return RpcVoiceAgentReport[_0xcd2b('0x17')]({'acwtime':_0x335ef2},_0xaa8d06[_0xcd2b('0x5')][_0x4a7ee0][_0xcd2b('0x18')],_0x4a7ee0)[_0xcd2b('0x19')](function(_0x326988){logger['info'](_0xcd2b('0x1a'),_0x2eee84,_0x335ef2,_0x326988);})['catch'](function(_0x206dad){logger[_0xcd2b('0x1b')]('[%s][UPDATE][ERRORS:%s]',_0x2eee84,_0x206dad);})['finally'](function(){delete _0xaa8d06[_0xcd2b('0x5')][_0x4a7ee0];});};Acw['prototype'][_0xcd2b('0x1c')]=function(_0x1d5d12){try{var _0x2be4be=this;var _0x5b2eef=this[_0xcd2b('0x6')][_0x1d5d12][_0xcd2b('0x1d')];var _0x5e6593=this[_0xcd2b('0x6')][_0x1d5d12]['queue'];var _0x459c57=this['voiceQueues'][_0x5e6593];var _0x228fe9=![];var _0x20b6bb='ACW';if(_0x459c57[_0xcd2b('0x1e')]&&_0x459c57['mandatoryDispositionPause'][_0xcd2b('0x1f')]){_0x228fe9=!![];_0x20b6bb=_0x459c57[_0xcd2b('0x20')][_0xcd2b('0x1f')];}return ami[_0xcd2b('0x21')]({'action':_0xcd2b('0x22'),'interface':_0x5b2eef,'paused':!![],'reason':_0x20b6bb})['then'](function(){if(_0x2be4be[_0xcd2b('0x4')][_0x5b2eef]){return RpcUser[_0xcd2b('0x23')](_0x2be4be[_0xcd2b('0x4')][_0x5b2eef]['id'])[_0xcd2b('0x19')](function(_0xf1fc06){if(!_0xf1fc06||_0xf1fc06[_0xcd2b('0x24')]){logger[_0xcd2b('0x25')](_0xcd2b('0x26'),_0x1d5d12,_0x5b2eef,_0x5e6593);return;}logger[_0xcd2b('0x25')](_0xcd2b('0x27'),_0x1d5d12,_0x5b2eef,_0x5e6593);var _0x294a7c=_0x2be4be[_0xcd2b('0x6')][_0x1d5d12][_0xcd2b('0x28')]&&_0x2be4be[_0xcd2b('0x6')][_0x1d5d12]['destlinkedid']?_0x2be4be['channels'][_0x1d5d12]['destlinkedid']:_0x1d5d12;return RpcUser[_0xcd2b('0x29')](_0x2be4be[_0xcd2b('0x4')][_0x5b2eef],_0x20b6bb,_0x294a7c)['then'](function(_0x20e45a){_0x2be4be[_0xcd2b('0x3')][_0x5e6593]['available']-=0x1;_0x2be4be[_0xcd2b('0x3')][_0x5e6593][_0xcd2b('0x2a')]+=0x1;return _0x20e45a;});})[_0xcd2b('0x19')](function(_0x359a1b){if(_0x228fe9||!_0x359a1b){return;}_0x2be4be[_0xcd2b('0x5')][_0x5b2eef]={};logger[_0xcd2b('0x25')](_0xcd2b('0x2b'),_0x1d5d12,_0x2be4be[_0xcd2b('0x3')][_0x5e6593]['acwTimeout'],_0x5b2eef,_0x5e6593);_0x2be4be[_0xcd2b('0x5')][_0x5b2eef][_0xcd2b('0x16')]=setTimeout(_0x2be4be[_0xcd2b('0x2c')][_0xcd2b('0x9')](_0x2be4be,_0x5b2eef),_0x2be4be[_0xcd2b('0x3')][_0x5e6593]['acwTimeout']*0x3e8);_0x2be4be[_0xcd2b('0x5')][_0x5b2eef]['lastPauseAt']=moment()[_0xcd2b('0x2d')](_0xcd2b('0x2e'));_0x2be4be[_0xcd2b('0x5')][_0x5b2eef][_0xcd2b('0x18')]=_0x1d5d12;_0x2be4be[_0xcd2b('0x5')][_0x5b2eef][_0xcd2b('0x2f')]=_0x5e6593;_0x2be4be[_0xcd2b('0x5')][_0x5b2eef][_0xcd2b('0x15')]=_0x2be4be['updateAcw']['bind'](_0x2be4be,_0x5b2eef,_0x1d5d12);});}})[_0xcd2b('0x30')](function(){logger[_0xcd2b('0x1b')](_0xcd2b('0x2b'),_0x1d5d12,_0x2be4be[_0xcd2b('0x3')][_0x5e6593][_0xcd2b('0x31')],_0x5b2eef,_0x5e6593);})[_0xcd2b('0x32')](function(){delete _0x2be4be['channels'][_0x1d5d12];});}catch(_0x3fb76f){logger['error'](_0xcd2b('0x33'),_0x3fb76f[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0x2c')]=function(_0xbc130f){try{var _0xcf2bf1=this;if(_0xcf2bf1[_0xcd2b('0x5')][_0xbc130f]){_0xcf2bf1['timers'][_0xbc130f][_0xcd2b('0x16')]=![];var _0x3a2192=_0xcf2bf1['timers'][_0xbc130f][_0xcd2b('0x18')];var _0x40c25e=_0xcf2bf1[_0xcd2b('0x5')][_0xbc130f][_0xcd2b('0x2f')];var _0x4898ba=_0xcf2bf1[_0xcd2b('0x3')][_0x40c25e][_0xcd2b('0x31')];logger[_0xcd2b('0x25')](_0xcd2b('0x36'),_0x3a2192,_0xbc130f);RpcUser[_0xcd2b('0x23')](this['agents'][_0xbc130f]['id'])[_0xcd2b('0x19')](function(_0x1d9677){if(_0x1d9677['pauseType']==='ACW'){return RpcUser[_0xcd2b('0x37')](_0xcf2bf1['agents'][_0xbc130f]);}});RpcVoiceAgentReport[_0xcd2b('0x17')]({'acwtime':_0x4898ba,'agentacw':!![]},_0x3a2192,_0xbc130f)[_0xcd2b('0x19')](function(_0x36e0ff){logger['info'](_0xcd2b('0x1a'),_0x3a2192,_0x4898ba,_0x36e0ff);})[_0xcd2b('0x30')](function(_0x3d1cab){logger['error'](_0xcd2b('0x38'),_0x3a2192,_0x3d1cab);});}else{logger['error'](_0xcd2b('0x39'),_0xbc130f);if(_0xcf2bf1[_0xcd2b('0x5')]){logger[_0xcd2b('0x25')](_0xcd2b('0x3a'),JSON[_0xcd2b('0x3b')](_0xcf2bf1[_0xcd2b('0x5')]));}}}catch(_0x485963){logger[_0xcd2b('0x1b')](_0xcd2b('0x3c'),_0x485963[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0x8')]=function(_0x554e4c){try{if(this[_0xcd2b('0x3')][_0x554e4c[_0xcd2b('0x2f')]]&&(this[_0xcd2b('0x3')][_0x554e4c[_0xcd2b('0x2f')]][_0xcd2b('0x2')]||this[_0xcd2b('0x3')][_0x554e4c[_0xcd2b('0x2f')]][_0xcd2b('0x1e')])){if(this[_0xcd2b('0x4')][_0x554e4c['interface']]){this['channels'][_0x554e4c[_0xcd2b('0x18')]]={'queue':_0x554e4c['queue'],'interface':_0x554e4c[_0xcd2b('0x1d')],'destlinkedid':_0x554e4c[_0xcd2b('0x3d')]};}}}catch(_0xccbb23){logger[_0xcd2b('0x1b')]('[ACW][syncAgentConnect]\x20%s',_0xccbb23[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0x11')]=function(_0x3ebcc1){try{if(this[_0xcd2b('0x3')][_0x3ebcc1[_0xcd2b('0x2f')]]&&(this[_0xcd2b('0x3')][_0x3ebcc1[_0xcd2b('0x2f')]][_0xcd2b('0x2')]||this[_0xcd2b('0x3')][_0x3ebcc1[_0xcd2b('0x2f')]][_0xcd2b('0x1e')])){if(this[_0xcd2b('0x4')][_0x3ebcc1[_0xcd2b('0x1d')]]){this[_0xcd2b('0x6')][_0x3ebcc1[_0xcd2b('0x18')]]={'queue':_0x3ebcc1[_0xcd2b('0x2f')],'interface':_0x3ebcc1[_0xcd2b('0x1d')]};}}}catch(_0x4f170e){logger[_0xcd2b('0x1b')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4f170e['message']);}};Acw[_0xcd2b('0x35')][_0xcd2b('0xa')]=function(_0x5790a3){try{if(this[_0xcd2b('0x6')][_0x5790a3[_0xcd2b('0x18')]]&&_[_0xcd2b('0x3e')](this['channels'][_0x5790a3[_0xcd2b('0x18')]][_0xcd2b('0x28')])){logger[_0xcd2b('0x25')](_0xcd2b('0x3f'),_0x5790a3['uniqueid']);this['startAcw'](_0x5790a3[_0xcd2b('0x18')]);}else if(this[_0xcd2b('0x6')][_0x5790a3['linkedid']]&&_[_0xcd2b('0x3e')](this[_0xcd2b('0x6')][_0x5790a3[_0xcd2b('0x40')]][_0xcd2b('0x28')])){logger[_0xcd2b('0x25')](_0xcd2b('0x41'),_0x5790a3[_0xcd2b('0x40')]);this[_0xcd2b('0x1c')](_0x5790a3[_0xcd2b('0x40')]);}}catch(_0x115d70){logger[_0xcd2b('0x1b')]('[ACW][syncHangupRequest]\x20%s',_0x115d70['message']);}};Acw['prototype'][_0xcd2b('0xc')]=function(_0x337624){try{if(this[_0xcd2b('0x6')][_0x337624[_0xcd2b('0x18')]]&&this[_0xcd2b('0x6')][_0x337624[_0xcd2b('0x18')]]['attended']){logger[_0xcd2b('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x337624[_0xcd2b('0x18')]);this[_0xcd2b('0x1c')](_0x337624['uniqueid']);}else if(this[_0xcd2b('0x6')][_0x337624[_0xcd2b('0x40')]]&&this[_0xcd2b('0x6')][_0x337624[_0xcd2b('0x40')]]['attended']){logger['info'](_0xcd2b('0x42'),_0x337624[_0xcd2b('0x40')]);this[_0xcd2b('0x1c')](_0x337624[_0xcd2b('0x40')]);}}catch(_0x1afcfe){logger['error']('[ACW][syncHangup]\x20%s',_0x1afcfe[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0xe')]=function(_0x5a6f57){try{if(!_['isNil'](this[_0xcd2b('0x6')][_0x5a6f57[_0xcd2b('0x43')]])){this[_0xcd2b('0x1c')](_0x5a6f57[_0xcd2b('0x43')]);if(this[_0xcd2b('0x6')][_0x5a6f57[_0xcd2b('0x44')]]){this['channels'][_0x5a6f57[_0xcd2b('0x44')]][_0xcd2b('0x28')]=!![];this['channels'][_0x5a6f57[_0xcd2b('0x45')]]=this[_0xcd2b('0x6')][_0x5a6f57[_0xcd2b('0x44')]];this[_0xcd2b('0x46')](_0x5a6f57[_0xcd2b('0x44')]);}}else if(!_[_0xcd2b('0x47')](this[_0xcd2b('0x6')][_0x5a6f57['transfertargetuniqueid']])){this['startAcw'](_0x5a6f57[_0xcd2b('0x45')]);if(this[_0xcd2b('0x6')][_0x5a6f57[_0xcd2b('0x48')]]){this[_0xcd2b('0x6')][_0x5a6f57['origtransfereruniqueid']][_0xcd2b('0x28')]=!![];this[_0xcd2b('0x6')][_0x5a6f57[_0xcd2b('0x43')]]=this['channels'][_0x5a6f57[_0xcd2b('0x48')]];this[_0xcd2b('0x46')](_0x5a6f57[_0xcd2b('0x48')]);}}}catch(_0x54cda2){logger[_0xcd2b('0x1b')](_0xcd2b('0x49'),_0x54cda2[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0x10')]=function(_0x495e8b){try{if(this[_0xcd2b('0x6')][_0x495e8b['transfereruniqueid']]){logger[_0xcd2b('0x25')](_0xcd2b('0x4a'),JSON[_0xcd2b('0x3b')](_0x495e8b[_0xcd2b('0x4b')]));this['startAcw'](_0x495e8b[_0xcd2b('0x4b')]);}else if(this['channels'][_0x495e8b[_0xcd2b('0x4c')]]){logger[_0xcd2b('0x25')](_0xcd2b('0x4d'),JSON[_0xcd2b('0x3b')](_0x495e8b[_0xcd2b('0x4c')]));this[_0xcd2b('0x1c')](_0x495e8b[_0xcd2b('0x4c')]);}}catch(_0x133958){logger[_0xcd2b('0x1b')](_0xcd2b('0x4e'),_0x133958[_0xcd2b('0x34')]);}};Acw['prototype'][_0xcd2b('0x4f')]=function(_0x3eee4b){try{if(this[_0xcd2b('0x3')][_0x3eee4b[_0xcd2b('0x2f')]]&&this[_0xcd2b('0x3')][_0x3eee4b[_0xcd2b('0x2f')]][_0xcd2b('0x50')]==='all'){if(this[_0xcd2b('0x4')][_0x3eee4b[_0xcd2b('0x1d')]]){logger['info'](_0xcd2b('0x51'),_0x3eee4b[_0xcd2b('0x18')],_0x3eee4b['interface'],_0x3eee4b['queue']);return RpcUser[_0xcd2b('0x29')](this[_0xcd2b('0x4')][_0x3eee4b['interface']],'Auto-Pause',_0x3eee4b[_0xcd2b('0x18')]);}}}catch(_0x506d0f){logger[_0xcd2b('0x1b')](_0xcd2b('0x52'),_0x506d0f[_0xcd2b('0x34')]);}};Acw[_0xcd2b('0x35')][_0xcd2b('0x46')]=function(_0x6c773b,_0x24baef=0x2710){if(this[_0xcd2b('0x6')][_0x6c773b]){setTimeout(()=>{delete this['channels'][_0x6c773b];},_0x24baef);}};module['exports']=Acw; \ No newline at end of file +var _0x4821=['mandatoryDispositionPause','Action','agents','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','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','message','pauseType','saveUnpause','catch','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','ACW','mandatoryDisposition','name'];(function(_0x40460f,_0x4a19a5){var _0x6be019=function(_0xf4f830){while(--_0xf4f830){_0x40460f['push'](_0x40460f['shift']());}};_0x6be019(++_0x4a19a5);}(_0x4821,0xe3));var _0x1482=function(_0x39c50a,_0x3ae47f){_0x39c50a=_0x39c50a-0x0;var _0x1caa61=_0x4821[_0x39c50a];return _0x1caa61;};'use strict';var _=require(_0x1482('0x0'));var moment=require(_0x1482('0x1'));var ami=require(_0x1482('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x1482('0x3'));var RpcVoiceAgentReport=require(_0x1482('0x4'));function Acw(_0x26d204){this[_0x1482('0x5')]=_0x26d204[_0x1482('0x5')];this['agents']=_0x26d204['agents'];this[_0x1482('0x6')]=_0x26d204[_0x1482('0x6')];this['channels']={};ami['on']('agentconnect',this[_0x1482('0x7')][_0x1482('0x8')](this));ami['on'](_0x1482('0x9'),this[_0x1482('0xa')]['bind'](this));ami['on']('hangup',this[_0x1482('0xb')]['bind'](this));ami['on']('agentringnoanswer',this[_0x1482('0xc')]['bind'](this));ami['on'](_0x1482('0xd'),this[_0x1482('0xe')][_0x1482('0x8')](this));ami['on']('blindtransfer',this[_0x1482('0xf')][_0x1482('0x8')](this));ami['on'](_0x1482('0x10'),this['syncAgentConnectPreview'][_0x1482('0x8')](this));}function getDiff(_0x38f793){var _0x1c6840=moment()[_0x1482('0x11')](0x0);var _0x56f755=moment(_0x38f793)[_0x1482('0x11')](0x0);return _0x1c6840[_0x1482('0x12')](_0x56f755,_0x1482('0x13'));}Acw[_0x1482('0x14')][_0x1482('0x15')]=function(_0x5ed0c9,_0x52a1bd){var _0x1bb058=this;var _0x363867=getDiff(_0x1bb058[_0x1482('0x6')][_0x5ed0c9]['lastPauseAt']);clearTimeout(_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x16')]);_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x16')]=![];return RpcVoiceAgentReport[_0x1482('0x17')]({'acwtime':_0x363867},_0x1bb058[_0x1482('0x6')][_0x5ed0c9][_0x1482('0x18')],_0x5ed0c9)[_0x1482('0x19')](function(_0x4cb088){logger[_0x1482('0x1a')](_0x1482('0x1b'),_0x52a1bd,_0x363867,_0x4cb088);})['catch'](function(_0x2eaf8e){logger[_0x1482('0x1c')](_0x1482('0x1d'),_0x52a1bd,_0x2eaf8e);})[_0x1482('0x1e')](function(){delete _0x1bb058[_0x1482('0x6')][_0x5ed0c9];});};Acw[_0x1482('0x14')][_0x1482('0x1f')]=function(_0x592f58){try{var _0x3f5aff=this;var _0x557f73=this[_0x1482('0x20')][_0x592f58][_0x1482('0x21')];var _0x288930=this[_0x1482('0x20')][_0x592f58]['queue'];var _0x105cd9=this['voiceQueues'][_0x288930];var _0x1f7832=![];var _0x26ab6f=_0x1482('0x22');if(_0x105cd9[_0x1482('0x23')]&&_0x105cd9['mandatoryDispositionPause'][_0x1482('0x24')]){_0x1f7832=!![];_0x26ab6f=_0x105cd9[_0x1482('0x25')][_0x1482('0x24')];}return ami[_0x1482('0x26')]({'action':'QueuePause','interface':_0x557f73,'paused':!![],'reason':_0x26ab6f})[_0x1482('0x19')](function(){if(_0x3f5aff[_0x1482('0x27')][_0x557f73]){return RpcUser[_0x1482('0x28')](_0x3f5aff[_0x1482('0x27')][_0x557f73]['id'])[_0x1482('0x19')](function(_0x495c55){if(!_0x495c55||_0x495c55['voicePause']){logger['info'](_0x1482('0x29'),_0x592f58,_0x557f73,_0x288930);return;}logger[_0x1482('0x1a')](_0x1482('0x2a'),_0x592f58,_0x557f73,_0x288930);var _0x1048ef=_0x3f5aff[_0x1482('0x20')][_0x592f58][_0x1482('0x2b')]&&_0x3f5aff['channels'][_0x592f58]['destlinkedid']?_0x3f5aff[_0x1482('0x20')][_0x592f58][_0x1482('0x2c')]:_0x592f58;return RpcUser[_0x1482('0x2d')](_0x3f5aff['agents'][_0x557f73],_0x26ab6f,_0x1048ef)[_0x1482('0x19')](function(_0x3b9a9d){_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x2e')]-=0x1;_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x2f')]+=0x1;return _0x3b9a9d;});})[_0x1482('0x19')](function(_0x1e108a){if(_0x1f7832||!_0x1e108a){return;}_0x3f5aff['timers'][_0x557f73]={};logger[_0x1482('0x1a')](_0x1482('0x30'),_0x592f58,_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x31')],_0x557f73,_0x288930);_0x3f5aff[_0x1482('0x6')][_0x557f73]['timer']=setTimeout(_0x3f5aff[_0x1482('0x32')][_0x1482('0x8')](_0x3f5aff,_0x557f73),_0x3f5aff[_0x1482('0x5')][_0x288930][_0x1482('0x31')]*0x3e8);_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x33')]=moment()[_0x1482('0x34')](_0x1482('0x35'));_0x3f5aff[_0x1482('0x6')][_0x557f73]['uniqueid']=_0x592f58;_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x36')]=_0x288930;_0x3f5aff[_0x1482('0x6')][_0x557f73][_0x1482('0x15')]=_0x3f5aff[_0x1482('0x15')][_0x1482('0x8')](_0x3f5aff,_0x557f73,_0x592f58);});}})['catch'](function(){logger[_0x1482('0x1c')](_0x1482('0x30'),_0x592f58,_0x3f5aff[_0x1482('0x5')][_0x288930]['acwTimeout'],_0x557f73,_0x288930);})[_0x1482('0x1e')](function(){delete _0x3f5aff[_0x1482('0x20')][_0x592f58];});}catch(_0x533974){logger[_0x1482('0x1c')]('[ACW][START]\x20%s',_0x533974[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0x32')]=function(_0x1b6f0c){try{var _0x1c5fb9=this;if(_0x1c5fb9[_0x1482('0x6')][_0x1b6f0c]){_0x1c5fb9[_0x1482('0x6')][_0x1b6f0c]['timer']=![];var _0x1668cf=_0x1c5fb9['timers'][_0x1b6f0c][_0x1482('0x18')];var _0x256e7f=_0x1c5fb9['timers'][_0x1b6f0c][_0x1482('0x36')];var _0x1e0f63=_0x1c5fb9['voiceQueues'][_0x256e7f][_0x1482('0x31')];logger[_0x1482('0x1a')]('[%s][TIMER][STOP][AGENT:%s]',_0x1668cf,_0x1b6f0c);RpcUser[_0x1482('0x28')](this[_0x1482('0x27')][_0x1b6f0c]['id'])[_0x1482('0x19')](function(_0x52eb0d){if(_0x52eb0d[_0x1482('0x38')]===_0x1482('0x22')){return RpcUser[_0x1482('0x39')](_0x1c5fb9[_0x1482('0x27')][_0x1b6f0c]);}});RpcVoiceAgentReport[_0x1482('0x17')]({'acwtime':_0x1e0f63,'agentacw':!![]},_0x1668cf,_0x1b6f0c)[_0x1482('0x19')](function(_0x472598){logger['info'](_0x1482('0x1b'),_0x1668cf,_0x1e0f63,_0x472598);})[_0x1482('0x3a')](function(_0x46c852){logger[_0x1482('0x1c')]('[%s][UPDATE][ERRORS:%s]',_0x1668cf,_0x46c852);});}else{logger[_0x1482('0x1c')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1b6f0c);if(_0x1c5fb9[_0x1482('0x6')]){logger[_0x1482('0x1a')](_0x1482('0x3b'),JSON['stringify'](_0x1c5fb9[_0x1482('0x6')]));}}}catch(_0x4940b5){logger[_0x1482('0x1c')](_0x1482('0x3c'),_0x4940b5['message']);}};Acw['prototype'][_0x1482('0x7')]=function(_0x1b31b7){try{if(this[_0x1482('0x5')][_0x1b31b7[_0x1482('0x36')]]&&(this[_0x1482('0x5')][_0x1b31b7[_0x1482('0x36')]][_0x1482('0x3d')]||this['voiceQueues'][_0x1b31b7[_0x1482('0x36')]][_0x1482('0x23')])){if(this['agents'][_0x1b31b7[_0x1482('0x21')]]){this[_0x1482('0x20')][_0x1b31b7[_0x1482('0x18')]]={'queue':_0x1b31b7[_0x1482('0x36')],'interface':_0x1b31b7[_0x1482('0x21')],'destlinkedid':_0x1b31b7[_0x1482('0x2c')]};}}}catch(_0x1e3be7){logger[_0x1482('0x1c')](_0x1482('0x3e'),_0x1e3be7['message']);}};Acw['prototype'][_0x1482('0x3f')]=function(_0x5a2e5c){try{if(this[_0x1482('0x5')][_0x5a2e5c[_0x1482('0x36')]]&&(this[_0x1482('0x5')][_0x5a2e5c[_0x1482('0x36')]]['acw']||this['voiceQueues'][_0x5a2e5c[_0x1482('0x36')]][_0x1482('0x23')])){if(this['agents'][_0x5a2e5c[_0x1482('0x21')]]){this[_0x1482('0x20')][_0x5a2e5c['uniqueid']]={'queue':_0x5a2e5c[_0x1482('0x36')],'interface':_0x5a2e5c[_0x1482('0x21')]};}}}catch(_0x50e1e9){logger[_0x1482('0x1c')](_0x1482('0x40'),_0x50e1e9[_0x1482('0x37')]);}};Acw[_0x1482('0x14')]['syncHangupRequest']=function(_0x7f6e96){try{if(this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x18')]]&&_['isUndefined'](this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x18')]][_0x1482('0x2b')])){logger[_0x1482('0x1a')](_0x1482('0x41'),_0x7f6e96[_0x1482('0x18')]);this['startAcw'](_0x7f6e96[_0x1482('0x18')]);}else if(this['channels'][_0x7f6e96[_0x1482('0x42')]]&&_['isUndefined'](this[_0x1482('0x20')][_0x7f6e96[_0x1482('0x42')]][_0x1482('0x2b')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x7f6e96[_0x1482('0x42')]);this[_0x1482('0x1f')](_0x7f6e96[_0x1482('0x42')]);}}catch(_0x1490b3){logger['error'](_0x1482('0x43'),_0x1490b3[_0x1482('0x37')]);}};Acw[_0x1482('0x14')]['syncHangup']=function(_0x50c61f){try{if(this['channels'][_0x50c61f['uniqueid']]&&this[_0x1482('0x20')][_0x50c61f[_0x1482('0x18')]][_0x1482('0x2b')]){logger[_0x1482('0x1a')](_0x1482('0x44'),_0x50c61f[_0x1482('0x18')]);this['startAcw'](_0x50c61f[_0x1482('0x18')]);}else if(this[_0x1482('0x20')][_0x50c61f[_0x1482('0x42')]]&&this['channels'][_0x50c61f['linkedid']][_0x1482('0x2b')]){logger[_0x1482('0x1a')](_0x1482('0x45'),_0x50c61f[_0x1482('0x42')]);this[_0x1482('0x1f')](_0x50c61f['linkedid']);}}catch(_0x74f4c3){logger[_0x1482('0x1c')](_0x1482('0x46'),_0x74f4c3[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0xe')]=function(_0x357123){try{if(!_[_0x1482('0x47')](this[_0x1482('0x20')][_0x357123[_0x1482('0x48')]])){this[_0x1482('0x1f')](_0x357123[_0x1482('0x48')]);if(this['channels'][_0x357123['secondtransfereruniqueid']]){this['channels'][_0x357123['secondtransfereruniqueid']][_0x1482('0x2b')]=!![];this['channels'][_0x357123[_0x1482('0x49')]]=this[_0x1482('0x20')][_0x357123[_0x1482('0x4a')]];this[_0x1482('0x4b')](_0x357123[_0x1482('0x4a')]);}}else if(!_[_0x1482('0x47')](this[_0x1482('0x20')][_0x357123[_0x1482('0x49')]])){this[_0x1482('0x1f')](_0x357123[_0x1482('0x49')]);if(this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]]){this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]][_0x1482('0x2b')]=!![];this['channels'][_0x357123[_0x1482('0x48')]]=this[_0x1482('0x20')][_0x357123[_0x1482('0x4c')]];this[_0x1482('0x4b')](_0x357123['origtransfereruniqueid']);}}}catch(_0x216d70){logger['error'](_0x1482('0x4d'),_0x216d70[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0xf')]=function(_0x20d24c){try{if(this[_0x1482('0x20')][_0x20d24c['transfereruniqueid']]){logger[_0x1482('0x1a')](_0x1482('0x4e'),JSON[_0x1482('0x4f')](_0x20d24c[_0x1482('0x50')]));this[_0x1482('0x1f')](_0x20d24c['transfereruniqueid']);}else if(this['channels'][_0x20d24c['transfererlinkedid']]){logger[_0x1482('0x1a')](_0x1482('0x51'),JSON['stringify'](_0x20d24c[_0x1482('0x52')]));this[_0x1482('0x1f')](_0x20d24c['transfererlinkedid']);}}catch(_0x3f0408){logger[_0x1482('0x1c')](_0x1482('0x53'),_0x3f0408['message']);}};Acw['prototype'][_0x1482('0xc')]=function(_0x49cb94){try{if(this[_0x1482('0x5')][_0x49cb94['queue']]&&this[_0x1482('0x5')][_0x49cb94['queue']]['autopause']===_0x1482('0x54')){if(this[_0x1482('0x27')][_0x49cb94[_0x1482('0x21')]]){logger['info'](_0x1482('0x55'),_0x49cb94['uniqueid'],_0x49cb94['interface'],_0x49cb94[_0x1482('0x36')]);return RpcUser[_0x1482('0x2d')](this[_0x1482('0x27')][_0x49cb94[_0x1482('0x21')]],_0x1482('0x56'),_0x49cb94[_0x1482('0x18')]);}}}catch(_0x10afa4){logger[_0x1482('0x1c')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x10afa4[_0x1482('0x37')]);}};Acw[_0x1482('0x14')][_0x1482('0x4b')]=function(_0x2b1e2c,_0x4c68e2=0x2710){if(this[_0x1482('0x20')][_0x2b1e2c]){setTimeout(()=>{delete this['channels'][_0x2b1e2c];},_0x4c68e2);}};module[_0x1482('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 66fa2ae..d165c28 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 _0x9013=['connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','bluebird','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x9013,0x1eb));var _0x3901=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9013[_0x17b6e3];return _0x3906f3;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x3901('0x0'));var util=require('util');var logger=require(_0x3901('0x1'))('ami');var config=require(_0x3901('0x2'));var ami=new Manager(config[_0x3901('0x3')][_0x3901('0x4')],config[_0x3901('0x3')]['ip'],config[_0x3901('0x3')][_0x3901('0x5')],config[_0x3901('0x3')][_0x3901('0x6')],!![]);ami[_0x3901('0x7')]();ami['Action']=BPromise[_0x3901('0x8')](ami['action']);function error(_0x32551a){logger[_0x3901('0x9')](util['format'](_0x3901('0xa'),config['asterisk'][_0x3901('0x5')],config['asterisk']['ip'],config[_0x3901('0x3')][_0x3901('0x4')],util['inspect'](_0x32551a,![],null)));}function close(){logger[_0x3901('0x9')](util[_0x3901('0xb')](_0x3901('0xc'),config[_0x3901('0x3')]['username'],config[_0x3901('0x3')]['ip'],config[_0x3901('0x3')][_0x3901('0x4')]));}ami[_0x3901('0xd')]=function(){return function(){return ami[_0x3901('0xe')]({'action':_0x3901('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x3901('0xe')]({'action':_0x3901('0x10')});};};ami[_0x3901('0x11')]=function(){return function(){return ami[_0x3901('0xe')]({'action':_0x3901('0x12')});};};ami[_0x3901('0x13')]=function(){return function(){return ami['Action']({'action':_0x3901('0x14')});};};ami[_0x3901('0x15')]=function(){return function(){return ami[_0x3901('0xe')]({'action':_0x3901('0x16')});};};function connect(){logger[_0x3901('0x17')](util[_0x3901('0xb')](_0x3901('0x18'),config['asterisk'][_0x3901('0x5')],config[_0x3901('0x3')]['ip'],config[_0x3901('0x3')][_0x3901('0x4')]));ami[_0x3901('0x19')](_0x3901('0x9'),error);ami[_0x3901('0x19')](_0x3901('0x1a'),close);}ami['on'](_0x3901('0x1b'),connect);ami['on'](_0x3901('0x1c'),function(_0x17035f){logger[_0x3901('0x17')](util[_0x3901('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x3901('0x3')][_0x3901('0x5')],config[_0x3901('0x3')]['ip'],config[_0x3901('0x3')][_0x3901('0x4')],util[_0x3901('0x1d')](_0x17035f,![],null)));});ami['on'](_0x3901('0x1e'),function(){logger[_0x3901('0x17')](util['format'](_0x3901('0x1f'),config[_0x3901('0x3')][_0x3901('0x5')],config[_0x3901('0x3')]['ip'],config[_0x3901('0x3')][_0x3901('0x4')]));return Promise[_0x3901('0x20')]()[_0x3901('0x21')](ami[_0x3901('0xd')]())['then'](ami['actionDeviceStateList']())[_0x3901('0x21')](ami[_0x3901('0x11')]())[_0x3901('0x21')](ami[_0x3901('0x13')]())[_0x3901('0x21')](ami[_0x3901('0x15')]())[_0x3901('0x22')](function(_0x1d2446){logger['error'](_0x3901('0x23'),util[_0x3901('0x1d')](_0x1d2446,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3901('0x19')](_0x3901('0x1a'),close);module[_0x3901('0x24')]=ami; \ No newline at end of file +var _0x4405=['bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','exports','asterisk-manager'];(function(_0x437fc7,_0x58370f){var _0x79fd67=function(_0x58c1e3){while(--_0x58c1e3){_0x437fc7['push'](_0x437fc7['shift']());}};_0x79fd67(++_0x58370f);}(_0x4405,0x1d3));var _0x5440=function(_0x8dc5bf,_0x1b6ca6){_0x8dc5bf=_0x8dc5bf-0x0;var _0x58837b=_0x4405[_0x8dc5bf];return _0x58837b;};'use strict';var Manager=require(_0x5440('0x0'));var BPromise=require(_0x5440('0x1'));var util=require(_0x5440('0x2'));var logger=require(_0x5440('0x3'))(_0x5440('0x4'));var config=require(_0x5440('0x5'));var ami=new Manager(config[_0x5440('0x6')][_0x5440('0x7')],config[_0x5440('0x6')]['ip'],config[_0x5440('0x6')]['username'],config[_0x5440('0x6')]['password'],!![]);ami[_0x5440('0x8')]();ami[_0x5440('0x9')]=BPromise[_0x5440('0xa')](ami[_0x5440('0xb')]);function error(_0x4ee82c){logger[_0x5440('0xc')](util['format'](_0x5440('0xd'),config['asterisk'][_0x5440('0xe')],config['asterisk']['ip'],config[_0x5440('0x6')]['port'],util[_0x5440('0xf')](_0x4ee82c,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x5440('0x6')][_0x5440('0xe')],config['asterisk']['ip'],config[_0x5440('0x6')][_0x5440('0x7')]));}ami[_0x5440('0x10')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x11')});};};ami[_0x5440('0x12')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x5440('0x14')});};};ami[_0x5440('0x15')]=function(){return function(){return ami[_0x5440('0x9')]({'action':'queuesummary'});};};ami[_0x5440('0x16')]=function(){return function(){return ami[_0x5440('0x9')]({'action':_0x5440('0x17')});};};function connect(){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x1a'),config[_0x5440('0x6')][_0x5440('0xe')],config[_0x5440('0x6')]['ip'],config['asterisk'][_0x5440('0x7')]));ami[_0x5440('0x1b')](_0x5440('0xc'),error);ami[_0x5440('0x1b')](_0x5440('0x1c'),close);}ami['on'](_0x5440('0x1d'),connect);ami['on']('shutdown',function(_0x24a717){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x1e'),config[_0x5440('0x6')]['username'],config[_0x5440('0x6')]['ip'],config['asterisk'][_0x5440('0x7')],util[_0x5440('0xf')](_0x24a717,![],null)));});ami['on'](_0x5440('0x1f'),function(){logger[_0x5440('0x18')](util[_0x5440('0x19')](_0x5440('0x20'),config[_0x5440('0x6')][_0x5440('0xe')],config[_0x5440('0x6')]['ip'],config[_0x5440('0x6')][_0x5440('0x7')]));return Promise[_0x5440('0x21')]()[_0x5440('0x22')](ami['actionSipShowRegistry']())['then'](ami[_0x5440('0x12')]())['then'](ami[_0x5440('0x23')]())[_0x5440('0x22')](ami[_0x5440('0x15')]())[_0x5440('0x22')](ami[_0x5440('0x16')]())[_0x5440('0x24')](function(_0x4a30a0){logger[_0x5440('0xc')](_0x5440('0x25'),util[_0x5440('0xf')](_0x4a30a0,{'showHidden':![],'depth':null}));});});ami[_0x5440('0x1b')]('error',error);ami[_0x5440('0x1b')](_0x5440('0x1c'),close);module[_0x5440('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f3654a5..39bdb30 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x4e05df,_0x3654f3){var _0xb2e1df=function(_0xe94b33){while(--_0xe94b33){_0x4e05df['push'](_0x4e05df['shift']());}};_0xb2e1df(++_0x3654f3);}(_0xaa88,0x137));var _0x8aa8=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0xaa88[_0x1db481];return _0x3db95b;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xcb91[_0x13ce0c];return _0x4388fb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c725a53..bb49e59 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 _0x8bb2=['[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','milliseconds','[handlePredictive]','checkContactBlack','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','[actionOriginateIvr]','floor','dialLimitQueue','not_inuse','checkContactEmpty','countReScheduled','checkIsBlackList','[actionOriginate]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]','[getContactCampaign2]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','type','outbound','debug','inspect','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','format','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','Error','isTrunkReachable','active','reachable','status','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Intervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','length','push','Action','command','iftime\x20%s,%s','then','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','campaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','voiceQueues','[syncAgentConnect]','answertime','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','countabandonedretry','countglobal','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','add','[rescheduleContact][Abandoned]','Abandoned','createHistory','actions','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','paused','stateinterface','locked','rrmemory','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','reason\x2019\x20machine....','syncHangup','ivrAnswerCallsDay','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangup2]','outboundUnknownCallsDay','cause-txt','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','talking','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','handlePreviewRecallNotifications','user:%s','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8bb2,0x69));var _0x28bb=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x8bb2[_0x4fdcc0];return _0xc0ce94;};'use strict';var util=require(_0x28bb('0x0'));var _=require(_0x28bb('0x1'));var uuid=require('uuid');var moment=require(_0x28bb('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x28bb('0x3'));var hopperUtils=require(_0x28bb('0x4'));var ut=require(_0x28bb('0x5'));var config=require(_0x28bb('0x6'));var logger=require(_0x28bb('0x7'))(_0x28bb('0x8'));var loggerBooked=require(_0x28bb('0x7'))(_0x28bb('0x9'));var loggerPredictive=require(_0x28bb('0x7'))(_0x28bb('0xa'));var loggerPredictiveCalls=require(_0x28bb('0x7'))(_0x28bb('0xb'));var loggerSyncQueueSummary=require(_0x28bb('0x7'))(_0x28bb('0xc'));var ami=require('../ami');config[_0x28bb('0xd')]=_[_0x28bb('0xe')](config[_0x28bb('0xd')],{'host':_0x28bb('0xf'),'port':0x18eb});var io=require(_0x28bb('0x10'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x28bb('0x11'));var RpcSetting=require(_0x28bb('0x12'));var Interval=require(_0x28bb('0x13'));var Action=require(_0x28bb('0x14'));var History=require(_0x28bb('0x15'));var Final=require(_0x28bb('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x28bb('0x17'));var Hangup=require(_0x28bb('0x18'));var ipAgi=process['env'][_0x28bb('0x19')]||_0x28bb('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x28bb('0x1b')][_0x28bb('0x1c')]=function(_0x598bbe){this[_0x28bb('0x1d')]=this[_0x28bb('0x1d')]?this['tail'][_0x28bb('0x1e')](_0x598bbe):_0x598bbe();};function Dialer(_0xee83dc,_0x2de3ba){this[_0x28bb('0x1f')]=new Sequence();this[_0x28bb('0x20')]=_0x2de3ba;this['voiceQueues']=_0xee83dc['voiceQueues'];this['campaigns']=_0xee83dc['campaigns'];this[_0x28bb('0x21')]=_0xee83dc['agents'];this[_0x28bb('0x22')]=_0xee83dc[_0x28bb('0x22')];this[_0x28bb('0x23')]=config[_0x28bb('0x23')]||0x2;this[_0x28bb('0x24')]={};this['actions']={};this['contactsId']={};this[_0x28bb('0x25')]={};this[_0x28bb('0x26')]={};this['startPredictive']={};this[_0x28bb('0x27')]={};this[_0x28bb('0x28')]={};this[_0x28bb('0x29')]={};this[_0x28bb('0x2a')]={};this[_0x28bb('0x2b')]={};ami['on'](_0x28bb('0x2c'),this[_0x28bb('0x2d')][_0x28bb('0x2e')](this));ami['on'](_0x28bb('0x2f'),this[_0x28bb('0x30')]['bind'](this));ami['on'](_0x28bb('0x31'),this[_0x28bb('0x32')][_0x28bb('0x2e')](this));ami['on']('agentcomplete',this[_0x28bb('0x33')][_0x28bb('0x2e')](this));ami['on'](_0x28bb('0x34'),this[_0x28bb('0xc')]['bind'](this));ami['on'](_0x28bb('0x35'),this['syncQueueSummaryComplete'][_0x28bb('0x2e')](this));ami['on']('hangup',this['syncHangup'][_0x28bb('0x2e')](this));ami['on']('newexten',this[_0x28bb('0x36')][_0x28bb('0x2e')](this));ami['on'](_0x28bb('0x37'),this[_0x28bb('0x38')][_0x28bb('0x2e')](this));ami['on'](_0x28bb('0x39'),this['syncQueueMember'][_0x28bb('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x28bb('0x3a')][_0x28bb('0x2e')](this));this[_0x28bb('0x3b')]();this[_0x28bb('0x3c')]();RpcSetting[_0x28bb('0x3d')]()['then'](function(_0x12c3a1){previewRecallmeReminderInterval=_0x12c3a1[_0x28bb('0x3e')];});}function isNotNull(_0x563f89){return _0x563f89!==null&&!_['isUndefined'](_0x563f89);}function msgResponse(_0x50b19a,_0x2f9221,_0x3cb29c){return{'action':_0x50b19a,'response':_0x2f9221,'message':_0x3cb29c,'stack':_0x3cb29c};}function emit(_0x34c76e,_0x33b1d6,_0x5e775a){io['to'](_0x34c76e)['emit'](_0x33b1d6,_0x5e775a);}function emitOutboundVoiceQueueSummary(_0x456999){if(_0x456999[_0x28bb('0x3f')]===_0x28bb('0x40')){logger[_0x28bb('0x41')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x28bb('0x42')](_0x456999,{'showHidden':![],'depth':null}));emit(util['format'](_0x28bb('0x43'),_0x456999[_0x28bb('0x44')]),'voice_queue:save',_0x456999);}}function checkGetDataPredictive(_0x20c0e5){if(isNotNull(_0x20c0e5)&&!_[_0x28bb('0x45')](_0x20c0e5)){loggerPredictive['info'](_0x28bb('0x46'));loggerPredictive[_0x28bb('0x47')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20c0e5[_0x28bb('0x48')]);loggerPredictive['info'](_0x28bb('0x49'),_0x20c0e5[_0x28bb('0x4a')]);loggerPredictive['info'](_0x28bb('0x4b'),_0x20c0e5[_0x28bb('0x4c')]);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x4d'),_0x20c0e5[_0x28bb('0x4e')]);loggerPredictive[_0x28bb('0x47')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20c0e5[_0x28bb('0x4f')]);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x50'),_0x20c0e5[_0x28bb('0x51')]);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x52'));if(_0x20c0e5[_0x28bb('0x48')]>0x0){if(!_[_0x28bb('0x53')](_0x20c0e5[_0x28bb('0x51')])&&_0x20c0e5[_0x28bb('0x51')]>0x0){return!![];}loggerPredictive[_0x28bb('0x47')](_0x28bb('0x54'));if(!_[_0x28bb('0x53')](_0x20c0e5[_0x28bb('0x4f')])&&_0x20c0e5[_0x28bb('0x4f')]>0x0){return!![];}loggerPredictive[_0x28bb('0x47')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x28bb('0x47')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x28bb('0x47')](_0x28bb('0x55'));}return![];}function mergeDataErlangB(_0x11c5ee){return function(_0x1eef6d){loggerPredictive[_0x28bb('0x47')](_0x28bb('0x56'));loggerPredictive['info'](_0x28bb('0x57'),_0x1eef6d[_0x28bb('0x58')]);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x59'),_0x1eef6d['erlangCallToSecond']);loggerPredictive[_0x28bb('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1eef6d[_0x28bb('0x5a')]);loggerPredictive[_0x28bb('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1eef6d[_0x28bb('0x5b')]);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x5c'),_0x1eef6d['erlangAbandonmentRate']);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x52'));_['merge'](_0x11c5ee,_0x1eef6d);};}function ifInterval(_0x895555,_0x1cd8e6){if(_['isUndefined'](_0x1cd8e6)){return![];}return utils[_0x28bb('0x5d')](undefined,_0x1cd8e6)<_0x895555*0x3c;}function clearPredictiveAttributes(_0x23fa87){if(_0x23fa87['startProgressive']){_0x23fa87[_0x28bb('0x27')]=undefined;loggerPredictive['debug'](_0x23fa87[_0x28bb('0x44')],_0x28bb('0x5e'));}if(_0x23fa87[_0x28bb('0x5f')]){_0x23fa87[_0x28bb('0x5f')]=undefined;loggerPredictive['debug'](_0x23fa87[_0x28bb('0x44')],_0x28bb('0x60'));}if(_0x23fa87[_0x28bb('0x61')]){clearInterval(_0x23fa87['handlePredictive']);_0x23fa87[_0x28bb('0x61')]=undefined;loggerPredictive[_0x28bb('0x41')](_0x23fa87[_0x28bb('0x44')],_0x28bb('0x62'));}}function loggerCatchPredictive(_0x4f20a8,_0x51b720){return function(_0x3df6b3){loggerPredictive['error'](_0x51b720[_0x28bb('0x44')],_0x4f20a8);loggerPredictive[_0x28bb('0x63')](_0x3df6b3[_0x28bb('0x64')]);clearPredictiveAttributes(_0x51b720);};}function loggerCatch(_0x4c264e){return function(_0x49ec04){logger[_0x28bb('0x63')](_0x4c264e,util[_0x28bb('0x42')](_0x49ec04,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5af03c){return function(_0x39bf9d){if(isNotNull(_0x39bf9d)&&isNotNull(_0x39bf9d[0x0])){if(_0x39bf9d[0x0][_0x28bb('0x65')]>0x0){_0x5af03c['message']=utils['CAMPAIGN_STATUS'][_0x28bb('0x66')];logger[_0x28bb('0x47')](_0x28bb('0x67')+_0x5af03c['name'],_0x39bf9d[0x0]['contactsRescheduled'],'contacts');}else{_0x5af03c[_0x28bb('0x68')]=utils[_0x28bb('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0x28bb('0x47')](_0x28bb('0x6a')+_0x5af03c[_0x28bb('0x44')]);}}};}function createObjHistory(_0x3a8279,_0x3aa71b,_0x11c0a6,_0x3bbf43,_0x32f2a2){_0x3a8279[_0x28bb('0x68')]=_0x11c0a6;var _0x2a2be7=new Action(_0x3a8279,_0x3aa71b);var _0x1079af=new History(_0x2a2be7);_0x1079af[_0x28bb('0x6b')]=_0x3bbf43;_0x1079af[_0x28bb('0x6c')]=_0x32f2a2;_0x1079af[_0x28bb('0x6d')]=_0x2a2be7[_0x28bb('0x6e')];return _0x1079af;}function unlockQueueStatus(_0x241d3c,_0x358513){setTimeout(function(){if(_['isUndefined'](_0x241d3c[_0x28bb('0x6f')])){loggerBooked[_0x28bb('0x63')](_0x28bb('0x70'),_0x358513);}_0x241d3c['queueStatusComplete']=!![];loggerBooked[_0x28bb('0x47')]('[booked][unlockQueueStatus]',_0x358513,JSON[_0x28bb('0x71')](_[_0x28bb('0x72')](_0x241d3c,[_0x28bb('0x44'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x37327e){return function(){if(!isNotNull(_0x37327e[_0x28bb('0x73')])){_0x37327e['message']=utils[_0x28bb('0x69')][_0x28bb('0x74')];throw _0x37327e[_0x28bb('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x37327e['Interval']['Intervals'])){_0x37327e[_0x28bb('0x68')]=utils['CAMPAIGN_STATUS'][_0x28bb('0x74')];throw _0x37327e[_0x28bb('0x44')]+_0x28bb('0x75');}if(!isNotNull(_['isEmpty'](_0x37327e[_0x28bb('0x73')]['Intervals']))){_0x37327e['message']=utils[_0x28bb('0x69')][_0x28bb('0x74')];throw _0x37327e['name']+_0x28bb('0x75');}};}function checkIsIVRCampaignActive(_0x504bae){return function(){if(!utils['isIVRCampaignActive'](_0x504bae)){_0x504bae['message']=utils['CAMPAIGN_STATUS'][_0x28bb('0x76')];throw _0x504bae[_0x28bb('0x44')]+_0x28bb('0x77');}};}function emitCampaignSummary(_0x5d0333){if(utils['isIVRCampaign'](_0x5d0333)){emit(util[_0x28bb('0x78')]('campaign:ivr:%s',_0x5d0333[_0x28bb('0x44')]),'campaign:save',_0x5d0333);}}function loggerCatchQueueSummary(_0x4731d9,_0x3393cc){return function(_0x11ffd2){clearPredictiveAttributes(_0x3393cc);emitCampaignSummary(_0x3393cc);loggerSyncQueueSummary[_0x28bb('0x41')](_0x4731d9,util[_0x28bb('0x42')](_0x11ffd2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1e8613){if(_0x1e8613[_0x28bb('0x79')]){if(_0x1e8613[_0x28bb('0x7a')]===0x0){_0x1e8613[_0x28bb('0x79')]=![];_0x1e8613[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x76')];loggerSyncQueueSummary[_0x28bb('0x41')](_0x28bb('0x7b'),_0x1e8613['name'],_0x28bb('0x7c'));}else{_0x1e8613[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x7d')];loggerSyncQueueSummary[_0x28bb('0x41')](_0x28bb('0x7b'),_0x1e8613['name'],'is\x20deactivated');}emitCampaignSummary(_0x1e8613);}}function myreject(_0x41e4d1){return function(_0x203f7d){return _0x41e4d1(msgResponse('[ifTime][Action]',_0x28bb('0x7e'),JSON[_0x28bb('0x71')](_0x203f7d)));};}Dialer[_0x28bb('0x1b')][_0x28bb('0x7f')]=function(_0x34912d){return!_['isUndefined'](_0x34912d)&&_0x34912d&&!_[_0x28bb('0x53')](_0x34912d[_0x28bb('0x44')])&&!_[_0x28bb('0x53')](_0x34912d['active'])&&_0x34912d[_0x28bb('0x80')]&&(this[_0x28bb('0x22')][util[_0x28bb('0x78')]('SIP/%s',_0x34912d[_0x28bb('0x44')])]['status']===_0x28bb('0x81')||this['trunks'][util[_0x28bb('0x78')]('SIP/%s',_0x34912d[_0x28bb('0x44')])][_0x28bb('0x82')]==='unmonitored');};Dialer[_0x28bb('0x1b')][_0x28bb('0x83')]=function(_0x16b156){var _0x469f03=this;return function(){if(!_0x469f03['isTrunkReachable'](_0x16b156[_0x28bb('0x84')])){if(!_0x469f03[_0x28bb('0x7f')](_0x16b156['TrunkBackup'])){_0x16b156[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x85')];throw _0x16b156['name']+_0x28bb('0x86');}}};};Dialer['prototype'][_0x28bb('0x87')]=function(_0x40ec79,_0xa34221,_0xbfaadd,_0x49ac37){var _0x43e2a1=this;return function(){var _0x3291d9=!![];return _0x43e2a1[_0x28bb('0x88')](_0x40ec79,_0xa34221,_0xbfaadd,_0x49ac37,_0x3291d9);};};Dialer[_0x28bb('0x1b')]['checkIfTimeIntervals']=function(_0x22b237,_0x174f80,_0x237d27,_0x50e497){var _0x361c47=this;return function(){var _0x611264=![];return _0x361c47[_0x28bb('0x88')](_0x22b237[_0x28bb('0x89')],_0x174f80,_0x237d27,_0x50e497,_0x611264);};};Dialer[_0x28bb('0x1b')][_0x28bb('0x88')]=function(_0xd4b8b7,_0x8a5b35,_0x267c05,_0x35d904,_0x15bc1f){var _0xac8057=[];return new Promise(function(_0x5051d8,_0x17b061){if(!isNotNull(_0xd4b8b7)){_0x35d904[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x74')];return _0x17b061(msgResponse(_0x28bb('0x8a'),_0x28bb('0x8b'),_0x267c05+_0x28bb('0x8c')));}if(_[_0x28bb('0x45')](_0xd4b8b7)){_0x35d904[_0x28bb('0x68')]=utils[_0x28bb('0x69')]['EMPTY_INTERVAL'];return _0x17b061(msgResponse(_0x28bb('0x8a'),_0x28bb('0x8b'),_0x267c05+'\x20Intervals\x20is\x20empty\x20'));}if(_0x8a5b35&&_[_0x28bb('0x53')](config[_0x28bb('0x8d')][_0x8a5b35])){_0x35d904[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x8e')];return _0x17b061(msgResponse(_0x28bb('0x8a'),'Failure',_0x267c05+'\x20Timezone\x20unknow\x20'+_0x8a5b35));}if(_['isArray'](_0xd4b8b7)){for(var _0x53b13f=0x0;_0x53b13f<_0xd4b8b7[_0x28bb('0x8f')];_0x53b13f+=0x1){_0xac8057[_0x28bb('0x90')](ami[_0x28bb('0x91')]({'action':_0x28bb('0x92'),'command':util[_0x28bb('0x78')](_0x28bb('0x93'),_0xd4b8b7[_0x53b13f]['interval'],!_[_0x28bb('0x53')](config[_0x28bb('0x8d')][_0x8a5b35])?_0x8a5b35:'')})[_0x28bb('0x94')](function(_0x177e36){return _0x177e36[_0x28bb('0x95')][_0x28bb('0x96')](_0x28bb('0x97'))>=0x0;})[_0x28bb('0x98')](myreject(_0x17b061)));}}else{_0xac8057[_0x28bb('0x90')](ami[_0x28bb('0x91')]({'action':_0x28bb('0x92'),'command':util[_0x28bb('0x78')](_0x28bb('0x93'),_0xd4b8b7,!_[_0x28bb('0x53')](config[_0x28bb('0x8d')][_0x8a5b35])?_0x8a5b35:'')})[_0x28bb('0x94')](function(_0xa5b2e4){return _0xa5b2e4[_0x28bb('0x95')][_0x28bb('0x96')](_0x28bb('0x97'))>=0x0;})[_0x28bb('0x98')](myreject(_0x17b061)));}Promise['all'](_0xac8057)['then'](function(_0x2c60a3){var _0x493593=_[_0x28bb('0x99')](_0x2c60a3);if(_0x493593){return _0x5051d8(_0x493593);}else{_0x35d904[_0x28bb('0x68')]=_0x15bc1f?utils[_0x28bb('0x69')][_0x28bb('0x9a')]:utils[_0x28bb('0x69')][_0x28bb('0x9b')];return _0x17b061(msgResponse(_0x28bb('0x9c'),_0x28bb('0x8b'),_0x28bb('0x9d')+_0x15bc1f+'\x20'+_0x267c05+_0x28bb('0x9e')+util[_0x28bb('0x42')](_0xd4b8b7,{'showHidden':![],'depth':null})+_0x28bb('0x9f')+_0x8a5b35));}})[_0x28bb('0x98')](function(_0x5bec27){return _0x17b061(msgResponse('ifTime',_0x28bb('0x8b'),JSON['stringify'](_0x5bec27)));});});};Dialer[_0x28bb('0x1b')][_0x28bb('0x3b')]=function(){var _0x43055b=this;return cmHopper[_0x28bb('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0x28bb('0x94')](function(){setInterval(function(){_0x43055b[_0x28bb('0xa1')]();},0x3e8);});};Dialer[_0x28bb('0x1b')][_0x28bb('0xa1')]=function(){var _0x183b39=this;var _0x2921bd;for(var _0x125540 in this[_0x28bb('0xa2')]){if(typeof this['campaigns'][_0x125540]!==_0x28bb('0xa3')){_0x2921bd=this[_0x28bb('0xa2')][_0x125540];if(utils['isIVRCampaign'](_0x2921bd)&&utils[_0x28bb('0xa4')](_0x2921bd)){_0x2921bd[_0x28bb('0x79')]=!![];Promise[_0x28bb('0xa5')]()[_0x28bb('0x94')](checkIsIVRCampaignActive(_0x2921bd))[_0x28bb('0x94')](checkInterval(_0x2921bd))['then'](_0x183b39['checkIsTrunkReachable'](_0x2921bd))[_0x28bb('0x94')](_0x183b39[_0x28bb('0x87')](_0x2921bd[_0x28bb('0xa6')],_0x2921bd['dialTimezone'],_0x2921bd['name'],_0x2921bd))['then'](_0x183b39[_0x28bb('0xa7')](_0x2921bd[_0x28bb('0x73')],_0x2921bd[_0x28bb('0xa8')],_0x2921bd[_0x28bb('0x44')],_0x2921bd))[_0x28bb('0x94')](_0x183b39[_0x28bb('0xa9')](_0x2921bd))['catch'](loggerCatchQueueSummary(_0x28bb('0xaa'),_0x2921bd));}else{notSendMessagesCampaign(_0x2921bd);}}}};Dialer[_0x28bb('0x1b')][_0x28bb('0xab')]=function(_0x802a6a){if(_0x802a6a[_0x28bb('0xac')]!==_0x28bb('0xa')){clearPredictiveAttributes(_0x802a6a);}switch(_0x802a6a['dialMethod']){case'progressive':this[_0x28bb('0xad')](_0x802a6a,0x1);break;case _0x28bb('0xae'):this[_0x28bb('0xad')](_0x802a6a,_0x802a6a[_0x28bb('0xaf')]);break;case _0x28bb('0xa'):this[_0x28bb('0xa')](_0x802a6a);break;case _0x28bb('0x9'):this['handlePower'](_0x802a6a,0x1);break;default:logger[_0x28bb('0x63')]('Queue',_0x802a6a[_0x28bb('0x44')],_0x28bb('0xb0'));}};Dialer[_0x28bb('0x1b')]['ifTime']=function(_0x4876e3,_0x414864){var _0x27a1d3=_0x4876e3[_0x28bb('0xa8')];var _0x2fe784=_0x414864?_0x4876e3[_0x28bb('0xa6')]:_0x4876e3[_0x28bb('0x73')][_0x28bb('0x89')];logger['silly'](_0x28bb('0xb1'),_0x2fe784,_0x27a1d3,_0x4876e3[_0x28bb('0x44')],util[_0x28bb('0x78')](_0x28bb('0xb2'),_0x4876e3['name'],_0x4876e3['id']));var _0x5f0741=null;return Interval[_0x28bb('0xb3')](_0x2fe784,_0x27a1d3)[_0x28bb('0x94')](function(_0x5f3c38){if(_0x5f3c38===!![]){return _0x5f3c38;}else{_0x4876e3['message']=_0x414864?utils[_0x28bb('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x28bb('0x69')]['OVERTIME_INTERVAL'];_0x5f0741=msgResponse(_0x28bb('0x9c'),'Failure',_0x28bb('0x9d')+_0x414864+'\x20'+_0x4876e3[_0x28bb('0x44')]+_0x28bb('0x9e')+util[_0x28bb('0x42')](_0x2fe784,{'showHidden':![],'depth':null})+_0x28bb('0x9f')+_0x27a1d3);}if(_0x5f0741!==null){logger[_0x28bb('0xb4')](_0x28bb('0xb5'),_0x5f0741);_0x5f0741[_0x28bb('0xb6')]=_0x414864;throw _0x5f0741;}})[_0x28bb('0x98')](function(_0x17c18b){logger['error'](_0x28bb('0xb7'),_0x17c18b);throw msgResponse(_0x28bb('0xb8'),_0x28bb('0x7e'),util[_0x28bb('0x42')](_0x17c18b,{'showHidden':![],'depth':null}));});};Dialer[_0x28bb('0x1b')][_0x28bb('0x2d')]=function(_0x39eb34){if(this['voiceQueues'][_0x39eb34[_0x28bb('0xb9')]]){if(this[_0x28bb('0x25')][_0x39eb34[_0x28bb('0xba')]]&&this['uniqueId'][_0x39eb34['uniqueid']][_0x28bb('0x3f')]!==_0x28bb('0xbb')){utils['decrementOriginate'](this[_0x28bb('0xbc')][_0x39eb34['queue']],_0x28bb('0xbd'));this[_0x28bb('0x25')][_0x39eb34[_0x28bb('0xba')]][_0x28bb('0xbe')]=moment()[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x28bb('0x33')]=function(_0x6e89fa){var _0x1ddd12=this[_0x28bb('0x25')][_0x6e89fa[_0x28bb('0xba')]];if(this['voiceQueues'][_0x6e89fa[_0x28bb('0xb9')]]){if(_0x1ddd12&&_0x1ddd12[_0x28bb('0x3f')]!==_0x28bb('0xbb')){delete this[_0x28bb('0x25')][_0x6e89fa['uniqueid']];this['voiceQueues'][_0x6e89fa[_0x28bb('0xb9')]][_0x28bb('0xbf')]+=0x1;var _0x4a3045=new AgentComplete(_0x1ddd12,_0x6e89fa);if(_0x6e89fa['reason']===_0x28bb('0xc0')){_0x4a3045[_0x28bb('0xc1')]=this[_0x28bb('0xbc')][_0x6e89fa[_0x28bb('0xb9')]][_0x28bb('0xc2')]&&this[_0x28bb('0xbc')][_0x6e89fa[_0x28bb('0xb9')]][_0x28bb('0xc3')]?moment()['format'](_0x28bb('0xc4')):undefined;}hopperUtils['createHistory'](_0x4a3045)[_0x28bb('0x98')](loggerCatch(_0x28bb('0xc5')));hopperUtils[_0x28bb('0xc6')](_0x4a3045)[_0x28bb('0x98')](loggerCatch(_0x28bb('0xc7')));}}};Dialer[_0x28bb('0x1b')][_0x28bb('0x30')]=function(_0x262caf){var _0x3641f6=this[_0x28bb('0x25')][_0x262caf[_0x28bb('0xba')]];var _0x3c3fbc=this;var _0x11a4cd=![];var _0x480f7d;var _0x314083;if(this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]]){if(_0x3641f6&&_0x3641f6[_0x28bb('0x3f')]!==_0x28bb('0xbb')){delete this[_0x28bb('0x25')][_0x262caf['uniqueid']];utils[_0x28bb('0xc8')](this['voiceQueues'][_0x262caf[_0x28bb('0xb9')]],_0x28bb('0xc9'));_0x3641f6[_0x28bb('0xca')]=moment()[_0x28bb('0x78')](_0x28bb('0xc4'));var _0x2290ee=new QueueCallerAbandon(_0x3641f6,_0x262caf);if(utils[_0x28bb('0x5d')](_0x3641f6[_0x28bb('0xca')],_0x3641f6['responsetime'])>=_0x3641f6[_0x28bb('0xcb')]){this['voiceQueues'][_0x262caf[_0x28bb('0xb9')]][_0x28bb('0x4c')]+=0x1;this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x262caf['queue']][_0x28bb('0xcc')]+=0x1;_0x2290ee['state']=0xa;_0x2290ee[_0x28bb('0x6c')]='Drop';_0x2290ee[_0x28bb('0xcd')]='TIMEOUT';_0x2290ee['agiafterat']=this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]][_0x28bb('0xc2')]?moment()[_0x28bb('0x78')](_0x28bb('0xc4')):undefined;_0x2290ee[_0x28bb('0xce')]+=0x1;_0x2290ee['countglobal']+=0x1;_0x480f7d=this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]][_0x28bb('0xcf')];_0x314083=this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x28bb('0xd0')](_0x2290ee,_0x2290ee[_0x28bb('0x6b')],_0x3641f6[_0x28bb('0xd1')])['then'](function(_0x2c16ff){_0x11a4cd=_0x2c16ff[_0x28bb('0xd2')]==0x1;if(_0x2290ee['countdropretry']>=_0x3c3fbc[_0x28bb('0xbc')][_0x262caf['queue']][_0x28bb('0xd3')]){_0x3c3fbc[_0x28bb('0xd4')](_0x2290ee,_0x2c16ff[_0x28bb('0xd2')]);}else{hopperUtils[_0x28bb('0xd5')]({'active':![],'countdropretry':_0x2290ee[_0x28bb('0xce')],'scheduledat':moment()['add'](_0x3c3fbc[_0x28bb('0xbc')][_0x262caf['queue']][_0x28bb('0xcf')],'minutes')[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3641f6[_0x28bb('0xd6')],'ListId':_0x3641f6[_0x28bb('0xd7')],'VoiceQueueId':_0x3641f6[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3641f6[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0xda')));var _0x5597ec=new History(_0x2290ee);_0x5597ec[_0x28bb('0x6b')]=0xa;_0x5597ec['statedesc']='Drop';_0x5597ec['starttime']=moment()[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x5597ec['endtime']=_0x5597ec[_0x28bb('0x6e')];_0x5597ec[_0x28bb('0xdb')]=_0x2290ee['calleridname'];_0x5597ec[_0x28bb('0xdc')]=_0x2290ee['calleridnum'];hopperUtils['createHistory'](_0x5597ec)['catch'](loggerCatch(_0x28bb('0xdd')));}})[_0x28bb('0x94')](function(){if(_0x11a4cd)hopperUtils[_0x28bb('0xde')](_0x2290ee,_0x480f7d,_0x314083)[_0x28bb('0x94')](function(){return 0x1;});});}else{this['voiceQueues'][_0x262caf['queue']][_0x28bb('0x4e')]+=0x1;this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]][_0x28bb('0xdf')]+=0x1;_0x2290ee[_0x28bb('0x6b')]=0xb;_0x2290ee[_0x28bb('0x6c')]='Abandoned';_0x2290ee[_0x28bb('0xcd')]='CALLEREXIT';_0x2290ee[_0x28bb('0xe0')]+=0x1;_0x2290ee[_0x28bb('0xe1')]+=0x1;_0x480f7d=this[_0x28bb('0xbc')][_0x262caf['queue']][_0x28bb('0xe2')];_0x314083=this[_0x28bb('0xbc')][_0x262caf[_0x28bb('0xb9')]][_0x28bb('0xe3')];hopperUtils[_0x28bb('0xd0')](_0x2290ee,_0x2290ee['state'],_0x3641f6['voiceQueue'])[_0x28bb('0x94')](function(_0x14cfac){if(_0x2290ee['countabandonedretry']>=_0x3c3fbc[_0x28bb('0xbc')][_0x262caf['queue']][_0x28bb('0xe4')]){_0x3c3fbc[_0x28bb('0xd4')](_0x2290ee,_0x14cfac[_0x28bb('0xd2')]);}else{hopperUtils[_0x28bb('0xd5')]({'active':![],'countabandonedretry':_0x2290ee[_0x28bb('0xe0')],'scheduledat':moment()[_0x28bb('0xe5')](_0x3c3fbc[_0x28bb('0xbc')][_0x262caf['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3641f6[_0x28bb('0xd6')],'ListId':_0x3641f6[_0x28bb('0xd7')],'VoiceQueueId':_0x3641f6[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3641f6['CampaignId']||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0xe6')));var _0x63eb5f=new History(_0x2290ee);_0x63eb5f['state']=0xb;_0x63eb5f['statedesc']=_0x28bb('0xe7');_0x63eb5f[_0x28bb('0x6e')]=moment()[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x63eb5f[_0x28bb('0x6d')]=_0x63eb5f['starttime'];_0x63eb5f[_0x28bb('0xdb')]=_0x2290ee[_0x28bb('0xdb')];_0x63eb5f[_0x28bb('0xdc')]=_0x2290ee[_0x28bb('0xdc')];hopperUtils[_0x28bb('0xe8')](_0x63eb5f)[_0x28bb('0x98')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x28bb('0x94')](function(){if(_0x11a4cd)hopperUtils[_0x28bb('0xde')](_0x2290ee,_0x480f7d,_0x314083)[_0x28bb('0x94')](function(){return 0x1;});});}}}};Dialer[_0x28bb('0x1b')][_0x28bb('0x36')]=function(_0x4219da){if(this[_0x28bb('0xe9')][_0x4219da['uniqueid']]){this['actions'][_0x4219da[_0x28bb('0xba')]][_0x28bb('0xea')]=_0x4219da[_0x28bb('0xea')];}if(this[_0x28bb('0x25')][_0x4219da[_0x28bb('0xba')]]){this[_0x28bb('0x25')][_0x4219da[_0x28bb('0xba')]][_0x28bb('0xea')]=_0x4219da[_0x28bb('0xea')];}};Dialer[_0x28bb('0x1b')][_0x28bb('0xeb')]=function(_0x208d29){if(!this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]]){return;}var _0x1507e0=this[_0x28bb('0xbc')][this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]][_0x28bb('0xb9')]][_0x28bb('0xed')]||'rrmemory';if(_0x1507e0===_0x28bb('0xee')){if(this[_0x28bb('0xe9')][_0x208d29['actionid']]&&_[_0x28bb('0xef')](this['actions'][_0x208d29['actionid']]['locked'])&&_0x208d29['status']==='1'&&_0x208d29[_0x28bb('0xf0')]==='0'){if(this['agents'][_0x208d29[_0x28bb('0xf1')]]){if(!this[_0x28bb('0x21')][_0x208d29[_0x28bb('0xf1')]][_0x28bb('0xf2')]){this[_0x28bb('0x21')][_0x208d29[_0x28bb('0xf1')]][_0x28bb('0xf2')]=!![];this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]][_0x28bb('0xf2')]=!![];this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]][_0x28bb('0xf1')]=_0x208d29[_0x28bb('0xf1')];}}}}else if(_0x1507e0===_0x28bb('0xf3')){if(this['actions'][_0x208d29[_0x28bb('0xec')]]){if(this[_0x28bb('0x21')][_0x208d29['stateinterface']]){this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]]['stateinterface']=_0x208d29[_0x28bb('0xf1')];if(_[_0x28bb('0xef')](this[_0x28bb('0x29')][this['actions'][_0x208d29[_0x28bb('0xec')]][_0x28bb('0xb9')]])){this[_0x28bb('0x29')][this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]]['queue']]=[];}this[_0x28bb('0x29')][this['actions'][_0x208d29[_0x28bb('0xec')]][_0x28bb('0xb9')]]['push'](_[_0x28bb('0xf4')](_[_0x28bb('0x72')](this[_0x28bb('0xe9')][_0x208d29[_0x28bb('0xec')]],[_0x28bb('0xf5'),_0x28bb('0xf1')]),{'status':_0x208d29['status'],'paused':_0x208d29['paused']}));}}}};Dialer[_0x28bb('0x1b')][_0x28bb('0x3a')]=function(_0x46a6d2){if(!this[_0x28bb('0xe9')][_0x46a6d2['actionid']]){return;}var _0x550ebd=this;var _0x4adb44=this[_0x28bb('0xbc')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]];var _0x4f0342=_0x4adb44[_0x28bb('0xed')]||_0x28bb('0xf3');if(_0x4f0342===_0x28bb('0xee')){if(this['actions'][_0x46a6d2['actionid']]&&this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xf1')]){this[_0x28bb('0x20')][_0x28bb('0xf6')](this['actions'][_0x46a6d2['actionid']]['idHopper'],this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xf1')])[_0x28bb('0x98')](function(_0x4c5323){logger[_0x28bb('0x63')](_0x28bb('0xf7'),util[_0x28bb('0x42')](_0x4c5323,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x28bb('0xc8')](_0x550ebd[_0x28bb('0xbc')][_0x550ebd[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]],_0x28bb('0xf8'));_0x550ebd[_0x28bb('0x21')][_0x550ebd[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xf1')]][_0x28bb('0xf2')]=![];delete _0x550ebd[_0x28bb('0xe9')][_0x46a6d2['actionid']];unlockQueueStatus(_0x4adb44);});}else{utils[_0x28bb('0xc8')](this[_0x28bb('0xbc')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]],_0x28bb('0xf8'));hopperUtils[_0x28bb('0xd5')]({'active':![],'ContactId':this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xd6')],'ListId':this[_0x28bb('0xe9')][_0x46a6d2['actionid']][_0x28bb('0xd7')],'VoiceQueueId':this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xd8')]||undefined,'CampaignId':this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]];unlockQueueStatus(_0x4adb44);}}else if(_0x4f0342==='rrmemory'){var _0x4564fc;if(this[_0x28bb('0xe9')][_0x46a6d2['actionid']]&&!_[_0x28bb('0x45')](this[_0x28bb('0x29')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]])){if(this['queueBookedRR'][_0x550ebd[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]]){this[_0x28bb('0x2a')][_0x550ebd['actions'][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]]=this[_0x28bb('0x2a')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]]['queue']]?this[_0x28bb('0x2a')][this['actions'][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]]:this[_0x28bb('0x29')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]]?this[_0x28bb('0x29')][this[_0x28bb('0xe9')][_0x46a6d2['actionid']][_0x28bb('0xb9')]][_0x28bb('0xf9')]||0x0:0x0;}this[_0x28bb('0x29')][this['actions'][_0x46a6d2['actionid']]['queue']][_0x28bb('0xf9')]=this[_0x28bb('0x2a')][this[_0x28bb('0xe9')][_0x46a6d2[_0x28bb('0xec')]][_0x28bb('0xb9')]];for(var _0x675f5e=0x0;_0x675f5e=_0x3accce[_0x28bb('0x123')]){_0x2ac37b['stateGlobal'](_0x53cc0e,_0x49ac04,_0x312835,_0x28bb('0x124'));}else{if(_0x53cc0e[_0x28bb('0x121')]>=_0x3accce[_0x28bb('0x125')]){_0x2ac37b[_0x28bb('0x126')](_0x53cc0e,_0x49ac04,_0x312835,'reason\x2019\x20machine....');}else{hopperUtils[_0x28bb('0xd5')]({'active':![],'countmachineretry':_0x53cc0e[_0x28bb('0x121')],'scheduledat':moment()[_0x28bb('0xe5')](_0x3accce[_0x28bb('0x127')],_0x28bb('0x128'))['format'](_0x28bb('0xc4')),'ContactId':_0x53cc0e['ContactId'],'ListId':_0x53cc0e[_0x28bb('0xd7')],'VoiceQueueId':_0x53cc0e[_0x28bb('0xd8')]||undefined,'CampaignId':_0x53cc0e[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0x129')));_0x49ac04({'reschedule':0x1});}}});}if(_0x51adb6[_0x28bb('0x3f')]==='ivr'&&this[_0x28bb('0xa2')][_0x51adb6[_0x28bb('0xb9')]][_0x28bb('0x10d')]&&_0x5b2c51[_0x28bb('0x10e')]===_0x28bb('0x10f')){delete this[_0x28bb('0x25')][_0x5b2c51[_0x28bb('0xba')]];utils[_0x28bb('0xc8')](this[_0x28bb('0xa2')][_0x51adb6[_0x28bb('0xb9')]],_0x28bb('0x110'));_0x3ae872=new Hangup(_0x51adb6,_0x5b2c51);_0x3ae872[_0x28bb('0x6b')]=0x12;_0x3ae872[_0x28bb('0x6c')]=_0x28bb('0x112');_0x3ae872['membername']=_0x28bb('0x114');ami[_0x28bb('0x115')](_0x28bb('0x116'),ut[_0x28bb('0x117')](_0x3ae872,_0x28bb('0x118')));this[_0x28bb('0x119')](_0x3ae872,_0x28bb('0x12a'),'[syncHangupInAMDIvr]');}if(_0x51adb6[_0x28bb('0x3f')]===_0x28bb('0xbb')&&this[_0x28bb('0xa2')][_0x51adb6['queue']][_0x28bb('0x10d')]&&_0x5b2c51['value']===_0x28bb('0x12b')){return new Promise(function(_0x2b2a8f,_0x5aeafc){delete _0x2ac37b['uniqueId'][_0x5b2c51[_0x28bb('0xba')]];utils[_0x28bb('0xc8')](_0x2ac37b[_0x28bb('0xa2')][_0x51adb6[_0x28bb('0xb9')]],'[syncVarSet]');_0x2ac37b[_0x28bb('0xa2')][_0x51adb6[_0x28bb('0xb9')]][_0x28bb('0xbf')]+=0x1;_0x2ac37b['campaigns'][_0x51adb6[_0x28bb('0xb9')]][_0x28bb('0x111')]+=0x1;var _0x10c44c=_0x2ac37b[_0x28bb('0xa2')][_0x51adb6[_0x28bb('0xb9')]];var _0x10d9bf=new Hangup(_0x51adb6,_0x5b2c51);_0x10d9bf[_0x28bb('0x6b')]=0x13;_0x10d9bf[_0x28bb('0x6c')]=_0x28bb('0x12c');_0x10d9bf[_0x28bb('0x113')]=_0x28bb('0x114');_0x10d9bf[_0x28bb('0x121')]+=0x1;_0x10d9bf[_0x28bb('0xe1')]+=0x1;_0x10d9bf[_0x28bb('0x118')]=!![];ami['emit'](_0x28bb('0x116'),ut[_0x28bb('0x117')](_0x10d9bf,_0x28bb('0x118')));hopperUtils['createHistory'](_0x10d9bf)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x11c')));if(_0x10d9bf[_0x28bb('0x11d')]+_0x10d9bf['countcongestionretry']+_0x10d9bf['countnoanswerretry']+_0x10d9bf[_0x28bb('0x120')]+_0x10d9bf[_0x28bb('0xce')]+_0x10d9bf['countabandonedretry']+_0x10d9bf['countmachineretry']+_0x10d9bf[_0x28bb('0x122')]>=_0x10c44c['dialGlobalMaxRetry']){_0x2ac37b['stateGlobal'](_0x10d9bf,_0x2b2a8f,_0x5aeafc,_0x28bb('0x124'));}else{if(_0x10d9bf[_0x28bb('0x121')]>=_0x10c44c[_0x28bb('0x125')]){_0x2ac37b['createStateFinal'](_0x10d9bf,_0x2b2a8f,_0x5aeafc,_0x28bb('0x12d'));}else{hopperUtils[_0x28bb('0xd5')]({'active':![],'countmachineretry':_0x10d9bf[_0x28bb('0x121')],'scheduledat':moment()['add'](_0x10c44c[_0x28bb('0x127')],_0x28bb('0x128'))['format'](_0x28bb('0xc4')),'ContactId':_0x10d9bf[_0x28bb('0xd6')],'ListId':_0x10d9bf['ListId'],'VoiceQueueId':_0x10d9bf[_0x28bb('0xd8')]||undefined,'CampaignId':_0x10d9bf[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0x129')));_0x2b2a8f({'reschedule':0x1});}}});}}};Dialer[_0x28bb('0x1b')][_0x28bb('0x12e')]=function(_0x4bcce8){var _0x53ad1b=this[_0x28bb('0x25')][_0x4bcce8[_0x28bb('0xba')]];var _0x561493;if(!_0x53ad1b){return;}if(_0x53ad1b[_0x28bb('0x3f')]==='ivr'){delete this['uniqueId'][_0x4bcce8[_0x28bb('0xba')]];utils['decrementOriginate'](this[_0x28bb('0xa2')][_0x53ad1b['queue']],'[syncHangup]');this[_0x28bb('0xa2')][_0x53ad1b[_0x28bb('0xb9')]][_0x28bb('0x12f')]+=0x1;if(_0x4bcce8['cause-txt']==='Normal\x20Clearing'){const _0x2ee2bd=new AgentComplete(_0x53ad1b,_0x4bcce8);_0x2ee2bd[_0x28bb('0xd9')]=this[_0x28bb('0xa2')][_0x53ad1b[_0x28bb('0xb9')]]['id'];hopperUtils[_0x28bb('0xe8')](_0x2ee2bd)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x130')));hopperUtils['moveContactManagedDialer'](_0x2ee2bd)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x131')));}else{_0x561493=new Hangup(_0x53ad1b,_0x4bcce8);hopperUtils[_0x28bb('0xe8')](_0x561493)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x132')));hopperUtils[_0x28bb('0xc6')](_0x561493)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x133')));}}else{if(isNotNull(this[_0x28bb('0xbc')][_0x53ad1b[_0x28bb('0xb9')]][_0x28bb('0x134')])){delete this[_0x28bb('0x25')][_0x4bcce8[_0x28bb('0xba')]];utils[_0x28bb('0xc8')](this[_0x28bb('0xbc')][_0x53ad1b['queue']],_0x28bb('0x135'));this[_0x28bb('0xbc')][_0x53ad1b[_0x28bb('0xb9')]][_0x28bb('0xbf')]+=0x1;this['voiceQueues'][_0x53ad1b['queue']][_0x28bb('0x111')]+=0x1;_0x561493=new Hangup(_0x53ad1b,_0x4bcce8);_0x561493[_0x28bb('0x6b')]=0x10;_0x561493[_0x28bb('0x6c')]=_0x28bb('0x136');_0x561493[_0x28bb('0x113')]=_0x28bb('0x137');hopperUtils['createHistory'](_0x561493)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x132')));hopperUtils['moveContactManagedDialer'](_0x561493)[_0x28bb('0x98')](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x4bcce8[_0x28bb('0xba')]];utils[_0x28bb('0xc8')](this[_0x28bb('0xbc')][_0x53ad1b[_0x28bb('0xb9')]],_0x28bb('0x138'));if(_0x4bcce8['cause-txt']==='Normal\x20Clearing'){this[_0x28bb('0xbc')][_0x53ad1b[_0x28bb('0xb9')]][_0x28bb('0xbf')]+=0x1;const _0x24afef=new AgentComplete(_0x53ad1b,_0x4bcce8);_0x24afef['VoiceQueueId']=this[_0x28bb('0xbc')][_0x53ad1b[_0x28bb('0xb9')]]['id'];hopperUtils[_0x28bb('0xe8')](_0x24afef)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x28bb('0xc6')](_0x24afef)['catch'](loggerCatch(_0x28bb('0xc7')));}else{this[_0x28bb('0xbc')][_0x53ad1b['queue']][_0x28bb('0x139')]+=0x1;_0x561493=new Hangup(_0x53ad1b,_0x4bcce8);_0x561493[_0x28bb('0x6b')]=0xc;_0x561493[_0x28bb('0x6c')]=_0x4bcce8[_0x28bb('0x13a')];_0x561493[_0x28bb('0x113')]=_0x28bb('0x13b');hopperUtils[_0x28bb('0xe8')](_0x561493)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x13c')));hopperUtils[_0x28bb('0xc6')](_0x561493)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x135')));}}}};Dialer[_0x28bb('0x1b')][_0x28bb('0xc')]=function(_0x2eb69a){var _0x218868=this;if(!_0x218868[_0x28bb('0x2b')][_0x2eb69a[_0x28bb('0x44')]]){_0x218868[_0x28bb('0x2b')][_0x2eb69a['name']]={'running':![]};}else if(_0x218868[_0x28bb('0x2b')][_0x2eb69a[_0x28bb('0x44')]]['running']===!![]){return;}else if(_0x218868[_0x28bb('0x2b')][_0x2eb69a[_0x28bb('0x44')]]['running']===![]){_0x218868['queuesSummary'][_0x2eb69a[_0x28bb('0x44')]][_0x28bb('0x13d')]=!![];}var _0x240188=_0x218868[_0x28bb('0xbc')][_0x2eb69a[_0x28bb('0x44')]];var _0x28f957=_0x240188[_0x28bb('0x68')]!==utils[_0x28bb('0x69')]['INACTIVE'];var _0x5b5542=utils[_0x28bb('0x13e')](_0x240188);_0x240188[_0x28bb('0x13f')]=utils[_0x28bb('0x140')](_0x240188,_0x218868[_0x28bb('0x22')]);Promise['resolve']()[_0x28bb('0x94')](function(){if(_0x240188['statusMessage']===utils['CAMPAIGN_STATUS'][_0x28bb('0x76')]){if(_0x28f957){clearPredictiveAttributes(_0x240188);_0x2eb69a[_0x28bb('0x5f')]=undefined;_0x2eb69a[_0x28bb('0x27')]=undefined;}if(_0x240188['statusMessage']===utils[_0x28bb('0x69')][_0x28bb('0x76')]){_0x2eb69a['available']=0x0;_0x2eb69a[_0x28bb('0xf0')]=0x0;_0x2eb69a['inUse']=0x0;_0x2eb69a[_0x28bb('0x141')]=0x0;_0x2eb69a[_0x28bb('0x142')]=0x0;}}else if(_0x240188[_0x28bb('0x13f')]===utils[_0x28bb('0x69')][_0x28bb('0x143')]&&!_0x5b5542){return _0x218868['ifTime'](_0x240188,!![])[_0x28bb('0x94')](function(){return _0x218868[_0x28bb('0x8a')](_0x240188,![]);})[_0x28bb('0x94')](function(){return _0x218868[_0x28bb('0xab')](_0x240188);})['catch'](function(_0x55c575){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util['inspect'](_0x55c575,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x240188);});}else{clearPredictiveAttributes(_0x240188);}})[_0x28bb('0x94')](function(){var _0x45d21a=_0x2eb69a['compareToOutboundQueue'](_0x240188);if(_0x45d21a||_0x240188['queueSummaryCountersUpdated']){_0x240188[_0x28bb('0x144')]=![];_0x2eb69a[_0x28bb('0x145')](_0x240188);Object['assign'](_0x240188,_0x2eb69a);emitOutboundVoiceQueueSummary(_0x2eb69a);}_0x218868[_0x28bb('0x2b')][_0x240188[_0x28bb('0x44')]]['running']=![];})[_0x28bb('0x98')](function(_0x3f1cd0){logger[_0x28bb('0x63')](_0x28bb('0x146'),util[_0x28bb('0x42')](_0x3f1cd0,{'showHidden':![],'depth':null}));_0x218868[_0x28bb('0x2b')][_0x240188[_0x28bb('0x44')]]['running']=![];});};Dialer[_0x28bb('0x1b')]['syncQueueSummaryComplete']=_[_0x28bb('0x147')](function(){var _0x1edd13=_[_0x28bb('0x148')](this['voiceQueues'],function(_0x338500){return _0x338500[_0x28bb('0x149')];});var _0x3f930d=_[_0x28bb('0x148')](this[_0x28bb('0x21')],function(_0x21d4a6){return _0x21d4a6['online']&&_0x21d4a6[_0x28bb('0x82')]===_0x28bb('0x81');});if(_0x1edd13[_0x28bb('0x8f')]>0x0&&_0x3f930d['length']>0x0){return Promise[_0x28bb('0xa5')]()[_0x28bb('0x94')](cmHopper['handlePreviewRecallNotifications'](_[_0x28bb('0x14a')](_0x1edd13,'id'),previewRecallmeReminderInterval,_[_0x28bb('0x14a')](_0x3f930d,'id')))[_0x28bb('0x94')](function(_0x23fe49){for(var _0x5d168e=0x0;_0x5d168e<_0x23fe49['length'];_0x5d168e++){var _0x3fc019=_0x23fe49[_0x5d168e][_0x28bb('0x14b')][_0x28bb('0x44')];if(_0x3fc019)io['to'](util[_0x28bb('0x78')]('user:%s',_0x3fc019))[_0x28bb('0x115')](_0x28bb('0x14c'),{'hopper':_0x23fe49[_0x5d168e]});}})['catch'](function(_0x4b4c57){logger[_0x28bb('0x63')](_0x28bb('0x14d'),_0x4b4c57);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x28bb('0x1b')]['loopClearZombieChannels']=function(){var _0x153435=this;setInterval(function(){_0x153435[_0x28bb('0x14e')](_0x153435[_0x28bb('0x25')],_0x28bb('0x14f'));_0x153435[_0x28bb('0x14e')](_0x153435[_0x28bb('0xe9')],_0x28bb('0x150'));},0x32c8);};Dialer['prototype'][_0x28bb('0x14e')]=function(_0x241383,_0x4654b8){var _0x227aa4=this;for(var _0x320183 in _0x241383){if(typeof _0x241383[_0x320183]!==_0x28bb('0xa3')){this[_0x28bb('0x1f')][_0x28bb('0x1c')](function(){if(!_['isNil'](_0x241383[_0x320183])){return ami[_0x28bb('0x91')]({'action':_0x28bb('0x82'),'channel':_0x241383[_0x320183][_0x28bb('0xea')]})[_0x28bb('0x98')](function(_0x44fd46){if(_0x44fd46['message']===_0x28bb('0x151')){setTimeout(function(){if(_0x241383[_0x320183]&&_0x241383[_0x320183][_0x28bb('0x3f')]!==_0x28bb('0xbb')){utils[_0x28bb('0xc8')](_0x227aa4[_0x28bb('0xbc')][_0x241383[_0x320183][_0x28bb('0xb9')]],_0x28bb('0x152'));logger['error'](_0x28bb('0x153'),_0x4654b8,_0x320183,_0x241383[_0x320183][_0x28bb('0xb9')]);delete _0x241383[_0x320183];}if(_0x241383[_0x320183]&&_0x241383[_0x320183][_0x28bb('0x3f')]===_0x28bb('0xbb')){utils[_0x28bb('0xc8')](_0x227aa4['campaigns'][_0x241383[_0x320183][_0x28bb('0xb9')]],_0x28bb('0x152'));logger[_0x28bb('0x63')](_0x28bb('0x154'),_0x4654b8,_0x320183,_0x241383[_0x320183][_0x28bb('0xb9')]);delete _0x241383[_0x320183];}},0x2328);}});}});}}};Dialer[_0x28bb('0x1b')]['getVoiceQueueRtPauses']=function(_0x4e05b4){return Promise[_0x28bb('0xa5')]()[_0x28bb('0x94')](voiceQueueRt['getVoiceQueueRtPauses'](_0x4e05b4))[_0x28bb('0x98')](loggerCatch(_0x28bb('0x155')));};Dialer[_0x28bb('0x1b')][_0x28bb('0x156')]=function(_0x301689,_0x35bc83,_0x256935){var _0x6f6ed={'state':0x19,'statedesc':_0x28bb('0x157')};utils[_0x28bb('0xc8')](_0x35bc83,'[emptyContact]'+_0x301689);this['saveInDb'](_['merge'](_0x6f6ed,_[_0x28bb('0x72')](_0x256935,['ContactId',_0x28bb('0xd7'),_0x28bb('0x158'),'VoiceQueueId','CampaignId'])),_0x28bb('0x159'),_0x28bb('0x15a'));logger[_0x28bb('0x63')](_0x301689);};Dialer[_0x28bb('0x1b')][_0x28bb('0x119')]=function(_0x283adb,_0x2b3ddb,_0x3c7ad5){hopperUtils[_0x28bb('0xe8')](_0x283adb)[_0x28bb('0x98')](loggerCatch(_0x2b3ddb));hopperUtils[_0x28bb('0xc6')](_0x283adb)[_0x28bb('0x98')](loggerCatch(_0x3c7ad5));};Dialer[_0x28bb('0x1b')][_0x28bb('0xd4')]=function(_0x4bf57b,_0x14bef0){hopperUtils[_0x28bb('0xe8')](_0x4bf57b)[_0x28bb('0x98')](loggerCatch(_0x28bb('0xc5')));if(_0x14bef0==0x0){hopperUtils[_0x28bb('0xc6')](_0x4bf57b)[_0x28bb('0x98')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x28bb('0x1b')][_0x28bb('0x14d')]=function(_0x214736){return Promise[_0x28bb('0xa5')]()[_0x28bb('0x94')](cmHopper[_0x28bb('0x15b')](_0x214736['id'],previewRecallmeReminderInterval))[_0x28bb('0x94')](function(_0x2775d7){for(var _0x29aab6=0x0;_0x29aab6<_0x2775d7[_0x28bb('0x8f')];_0x29aab6++){var _0xb05894=_0x2775d7[_0x29aab6][_0x28bb('0x14b')][_0x28bb('0x44')];if(_0xb05894)io['to'](util[_0x28bb('0x78')](_0x28bb('0x15c'),_0xb05894))['emit'](_0x28bb('0x14c'),{'hopper':_0x2775d7[_0x29aab6]});}})[_0x28bb('0x98')](function(){});};Dialer['prototype'][_0x28bb('0xa9')]=function(_0x4f4cd6){var _0x21d773=this;return function(){_0x21d773[_0x28bb('0x15d')](_0x4f4cd6);};};Dialer[_0x28bb('0x1b')][_0x28bb('0x15e')]=function(_0x4ecd04,_0x3f61e5){var _0x206991=this;var _0x3d8c5c=uuid['v4']();this['actions'][_0x3d8c5c]=new Action(_0x4ecd04,_0x3f61e5,_0x3d8c5c);return new Promise(function(_0x57597d,_0x182a98){if(_[_0x28bb('0x53')](_0x4ecd04)&&typeof _0x4ecd04!==_0x28bb('0x15f')){return _0x182a98(msgResponse(_0x28bb('0x160'),_0x28bb('0x8b'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x3f61e5[_0x28bb('0x161')])||_0x3f61e5[_0x28bb('0x161')]===null){return _0x182a98(msgResponse(_0x28bb('0x160'),'Failure',_0x28bb('0x162')));}var _0xa15ad9={'XMD-CALLERID':_0x206991[_0x28bb('0xe9')][_0x3d8c5c][_0x28bb('0x163')](),'XMD-AGI':_0x4ecd04[_0x28bb('0x134')]?util[_0x28bb('0x78')](_0x28bb('0x164'),ipAgi,_0x4ecd04[_0x28bb('0x134')]):_0x28bb('0x165'),'XMD-AGIAFTER':_0x4ecd04[_0x28bb('0xc2')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4ecd04[_0x28bb('0xc2')]):'NONE','XMD-QUEUE':utils[_0x28bb('0x166')](_0x4ecd04)?util[_0x28bb('0x78')](_0x28bb('0x167'),_0x4ecd04[_0x28bb('0x44')],_0x4ecd04[_0x28bb('0x168')]||'',_0x4ecd04[_0x28bb('0xc3')]?'c':'',_0x4ecd04[_0x28bb('0xcb')]||0x3):_0x28bb('0x165'),'XMD-CONTACTID':_0x3f61e5[_0x28bb('0xd6')],'XMD-CDRTYPE':_0x28bb('0x8'),'CALLERID(all)':_0x206991['actions'][_0x3d8c5c]['getCaller'](),'XMD-AMD':_0x4ecd04['dialAMDActive']?_0x28bb('0x143'):'NONE','XMD-DESTINATION':_0x28bb('0x10c')};if(_0x4ecd04[_0x28bb('0x10d')]){_0xa15ad9[_0x28bb('0x169')]=_0x4ecd04[_0x28bb('0x16a')]||0x9c4;_0xa15ad9[_0x28bb('0x16b')]=_0x4ecd04['dialAMDGreeting']||0x5dc;_0xa15ad9['XMD-AMDAFTERGREETINGSILENCE']=_0x4ecd04[_0x28bb('0x16c')]||0x320;_0xa15ad9[_0x28bb('0x16d')]=_0x4ecd04['dialAMDTotalAnalysisTime']||0x1388;_0xa15ad9[_0x28bb('0x16e')]=_0x4ecd04['dialAMDMinWordLength']||0x64;_0xa15ad9[_0x28bb('0x16f')]=_0x4ecd04[_0x28bb('0x170')]||0x32;_0xa15ad9['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4ecd04[_0x28bb('0x171')]||0x3;_0xa15ad9[_0x28bb('0x172')]=_0x4ecd04[_0x28bb('0x173')]||0x100;_0xa15ad9[_0x28bb('0x174')]=_0x4ecd04[_0x28bb('0x175')]||0x1388;}if(utils[_0x28bb('0x166')](_0x4ecd04)){_0xa15ad9[_0x28bb('0x176')]=_0x3f61e5[_0x28bb('0xd8')];}else{_0xa15ad9[_0x28bb('0x177')]=_0x3f61e5['CampaignId'];}var _0x58e5d3=utils[_0x28bb('0x178')](_0x3f61e5['Contact']);Object['assign'](_0xa15ad9,_0x58e5d3);var _0x1fbda7=_0x206991['isTrunkReachable'](_0x4ecd04[_0x28bb('0x84')])?utils['getCallerId'](_0x4ecd04['Trunk'][_0x28bb('0x179')],_0x4ecd04['dialOriginateCallerIdName'],_0x4ecd04[_0x28bb('0x17a')]>0x0?utils[_0x28bb('0x17b')](_0x4ecd04[_0x28bb('0x17c')],_0x4ecd04[_0x28bb('0x17a')]):_0x4ecd04[_0x28bb('0x17c')]):utils[_0x28bb('0x17d')](_['isNil'](_0x4ecd04[_0x28bb('0x17e')])?_0x4ecd04[_0x28bb('0x84')][_0x28bb('0x179')]:_0x4ecd04['TrunkBackup'][_0x28bb('0x179')],_0x4ecd04[_0x28bb('0x17f')],_0x4ecd04['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x28bb('0x17b')](_0x4ecd04[_0x28bb('0x17c')],_0x4ecd04['dialRandomLastDigitCallerIdNumber']):_0x4ecd04[_0x28bb('0x17c')]);if(_0x1fbda7){_0xa15ad9[_0x28bb('0x180')]=_0x206991['actions'][_0x3d8c5c][_0x28bb('0x181')]=utils[_0x28bb('0x182')](_0x1fbda7);_0xa15ad9['XMD-ORIGINATECALLERIDNUM']=_0x3f61e5[_0x28bb('0x161')];}_0x4ecd04['variables']=_0xa15ad9;return ami[_0x28bb('0x91')]({'actionid':_0x3d8c5c,'action':_0x28bb('0x160'),'channel':_0x206991[_0x28bb('0x7f')](_0x4ecd04['Trunk'])?util['format']('SIP/%s/%s%s',_0x4ecd04[_0x28bb('0x84')][_0x28bb('0x44')],isNotNull(_0x4ecd04[_0x28bb('0x183')])?_0x4ecd04[_0x28bb('0x183')][_0x28bb('0x184')]()||'':'',_0x4ecd04[_0x28bb('0x185')]>0x0?_0x3f61e5[_0x28bb('0x161')][_0x28bb('0x186')](_0x4ecd04[_0x28bb('0x185')]):_0x3f61e5['phone']):util[_0x28bb('0x78')](_0x28bb('0x187'),_['isNil'](_0x4ecd04[_0x28bb('0x17e')])?_0x4ecd04[_0x28bb('0x84')][_0x28bb('0x44')]:_0x4ecd04[_0x28bb('0x17e')][_0x28bb('0x44')],isNotNull(_0x4ecd04[_0x28bb('0x183')])?_0x4ecd04[_0x28bb('0x183')][_0x28bb('0x184')]()||'':'',_0x4ecd04[_0x28bb('0x185')]>0x0?_0x3f61e5[_0x28bb('0x161')][_0x28bb('0x186')](_0x4ecd04[_0x28bb('0x185')]):_0x3f61e5[_0x28bb('0x161')]),'callerid':_0x1fbda7,'Exten':_0x28bb('0x10c'),'Context':_0x28bb('0x188'),'Priority':'1','variable':_0xa15ad9,'timeout':(_0x4ecd04[_0x28bb('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3d8c5c})[_0x28bb('0x94')](function(_0xe3d73a){return _0x57597d(_0xe3d73a);})[_0x28bb('0x98')](function(_0x3072b5){_0x4ecd04['outboundOriginateFailureCallsDay']+=0x1;var _0x4e83fd=new History(_0x206991['actions'][_0x3d8c5c]);logger['error'](util[_0x28bb('0x78')](_0x28bb('0x18a'),JSON[_0x28bb('0x71')](_0x3072b5)));_0x4e83fd['state']=0xe;_0x4e83fd['statedesc']=_0x28bb('0x18b');_0x4e83fd[_0x28bb('0x6e')]=moment()[_0x28bb('0x78')](_0x28bb('0xc4'));_0x4e83fd[_0x28bb('0x6d')]=_0x4e83fd[_0x28bb('0x6e')];hopperUtils[_0x28bb('0xe8')](_0x4e83fd)['catch'](loggerCatch(_0x28bb('0x18c')));_0x206991[_0x28bb('0xc6')](_0x4e83fd)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x18c')))['finally'](function(){delete _0x206991[_0x28bb('0xe9')][_0x3d8c5c];return _0x182a98(msgResponse(_0x28bb('0x160'),_0x28bb('0x7e'),_0x28bb('0x18d')));});});});};Dialer[_0x28bb('0x1b')][_0x28bb('0x18e')]=function(_0x3970c8,_0x1f33ad,_0x1d542a){var _0x3dcf85=new History(_0x1f33ad);if(_0x3dcf85[_0x28bb('0x11d')]+_0x3dcf85[_0x28bb('0x11e')]+_0x3dcf85[_0x28bb('0x11f')]+_0x3dcf85[_0x28bb('0x120')]+_0x3dcf85[_0x28bb('0xce')]+_0x3dcf85[_0x28bb('0xe0')]+_0x3dcf85['countmachineretry']+_0x3dcf85[_0x28bb('0x122')]>=_0x1d542a[_0x28bb('0x123')]-0x1){return!![];}switch(_0x3970c8){case 0x3:if(_0x3dcf85[_0x28bb('0x11f')]>=_0x1d542a[_0x28bb('0x18f')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countnoanswerretry':_0x3dcf85[_0x28bb('0x11f')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a[_0x28bb('0x190')],'minutes')[_0x28bb('0x78')](_0x28bb('0xc4')),'ContactId':_0x3dcf85[_0x28bb('0xd6')],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3dcf85['countbusyretry']>=_0x1d542a[_0x28bb('0x191')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countbusyretry':_0x3dcf85[_0x28bb('0x11d')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a['dialBusyRetryFrequency'],_0x28bb('0x128'))['format'](_0x28bb('0xc4')),'ContactId':_0x3dcf85[_0x28bb('0xd6')],'ListId':_0x3dcf85['ListId'],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0x192')));break;case 0x8:if(_0x3dcf85[_0x28bb('0x11e')]>=_0x1d542a[_0x28bb('0x193')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countcongestionretry':_0x3dcf85[_0x28bb('0x11e')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a[_0x28bb('0x194')],'minutes')[_0x28bb('0x78')](_0x28bb('0xc4')),'ContactId':_0x3dcf85[_0x28bb('0xd6')],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0x195')));break;case 0x0:if(_0x3dcf85[_0x28bb('0x120')]>=_0x1d542a[_0x28bb('0x196')]-0x1){return!![];}else{hopperUtils[_0x28bb('0xd5')]({'active':![],'countnosuchnumberretry':_0x3dcf85['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x1d542a[_0x28bb('0x197')],_0x28bb('0x128'))['format'](_0x28bb('0xc4')),'ContactId':_0x3dcf85[_0x28bb('0xd6')],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3dcf85['countdropretry']>=_0x1d542a[_0x28bb('0xd3')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countdropretry':_0x3dcf85[_0x28bb('0xce')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a[_0x28bb('0xcf')],_0x28bb('0x128'))[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3dcf85['ContactId'],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})['catch'](loggerCatch(_0x28bb('0xda')));break;case 0xb:if(_0x3dcf85[_0x28bb('0xe0')]>=_0x1d542a['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countabandonedretry':_0x3dcf85[_0x28bb('0xe0')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a[_0x28bb('0xe2')],_0x28bb('0x128'))[_0x28bb('0x78')](_0x28bb('0xc4')),'ContactId':_0x3dcf85['ContactId'],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85[_0x28bb('0xd8')]||undefined,'CampaignId':_0x3dcf85[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3dcf85[_0x28bb('0x121')]>=_0x1d542a[_0x28bb('0x125')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countmachineretry':_0x3dcf85['countmachineretry']+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a['dialMachineRetryFrequency'],_0x28bb('0x128'))[_0x28bb('0x78')](_0x28bb('0xc4')),'ContactId':_0x3dcf85['ContactId'],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85['VoiceQueueId']||undefined,'CampaignId':_0x3dcf85['CampaignId']||undefined})[_0x28bb('0x98')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3dcf85[_0x28bb('0x122')]>=_0x1d542a[_0x28bb('0x198')]-0x1){return!![];}hopperUtils[_0x28bb('0xd5')]({'active':![],'countagentrejectretry':_0x3dcf85[_0x28bb('0x122')]+=0x1,'scheduledat':moment()[_0x28bb('0xe5')](_0x1d542a[_0x28bb('0x199')],'minutes')['format'](_0x28bb('0xc4')),'ContactId':_0x3dcf85[_0x28bb('0xd6')],'ListId':_0x3dcf85[_0x28bb('0xd7')],'VoiceQueueId':_0x3dcf85['VoiceQueueId']||undefined,'CampaignId':_0x3dcf85['CampaignId']||undefined})['catch'](loggerCatch(_0x28bb('0x19a')));break;default:return!![];}};Dialer['prototype'][_0x28bb('0x108')]=function(_0x2424a6,_0x1af9f8,_0xa333a4){var _0x5bd5b3=this;var _0x326103=new History(_0x2424a6);var _0x593bf5=![];var _0x36efee;var _0x410e12;return new Promise(function(_0x3b9c4a,_0x441f64){if(_[_0x28bb('0x53')](_0x1af9f8)&&typeof _0x1af9f8!=='object'){return _0x441f64(msgResponse(_0x28bb('0x19b'),'Failure','entity\x20is\x20undefine'));}if(_[_0x28bb('0x53')](_0xa333a4)&&typeof _0xa333a4!==_0x28bb('0x15f')){return _0x441f64(msgResponse('[callProgressDetecting]',_0x28bb('0x8b'),_0x28bb('0x19c')));}hopperUtils['verifyAdditionalPhones'](_0x326103,_0xa333a4[_0x28bb('0x19d')],_0x1af9f8)[_0x28bb('0x94')](function(_0x2905a2){if(_0x2905a2[_0x28bb('0xd2')]==0x1)_0x593bf5=!![];switch(_0xa333a4[_0x28bb('0x19d')]){case'0':_0x1af9f8[_0x28bb('0x19e')]+=0x1;_0x326103['state']=0x0;_0x326103[_0x28bb('0x6c')]=_0x28bb('0x19f');_0x326103[_0x28bb('0x120')]+=0x1;_0x326103['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x28bb('0x117')](_0x2424a6,_0x28bb('0x1a0')));_0x36efee=_0x1af9f8[_0x28bb('0x197')];_0x410e12=_0x1af9f8[_0x28bb('0xe3')];hopperUtils[_0x28bb('0xe8')](_0x326103)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x11c')));if(_0x5bd5b3['checkRetriveMax'](0x0,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x120')]>=_0x1af9f8[_0x28bb('0x196')]){_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,'reason\x200\x20no\x20such\x20number....');}else{_0x5bd5b3['stateGlobal'](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1a1'));}}break;case'3':_0x1af9f8[_0x28bb('0x1a2')]+=0x1;_0x326103[_0x28bb('0x6b')]=0x3;_0x326103[_0x28bb('0x6c')]=_0x28bb('0x1a3');_0x326103[_0x28bb('0x11f')]+=0x1;_0x326103[_0x28bb('0xe1')]+=0x1;var _0x2a597d=ut[_0x28bb('0x1a4')](_0x2424a6,_0x1af9f8);ami[_0x28bb('0x115')]('custom:agentnoanswer',_0x2a597d);_0x36efee=_0x1af9f8[_0x28bb('0x190')];_0x410e12=_0x1af9f8[_0x28bb('0xe3')];hopperUtils[_0x28bb('0xe8')](_0x326103)['catch'](loggerCatch(_0x28bb('0x1a5')));if(_0x5bd5b3['checkRetriveMax'](0x3,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x11f')]>=_0x1af9f8['dialNoAnswerMaxRetry']){_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1a6'));}else{_0x5bd5b3[_0x28bb('0x1a7')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1a6'));}}break;case'5':_0x1af9f8[_0x28bb('0x1a8')]+=0x1;_0x326103[_0x28bb('0x6b')]=0x5;_0x326103[_0x28bb('0x6c')]='Busy';_0x326103[_0x28bb('0x11d')]+=0x1;_0x326103[_0x28bb('0xe1')]+=0x1;ami[_0x28bb('0x115')](_0x28bb('0x1a9'),ut[_0x28bb('0x117')](_0x2424a6,_0x28bb('0x1aa')));_0x36efee=_0x1af9f8[_0x28bb('0x1ab')];_0x410e12=_0x1af9f8['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x326103)[_0x28bb('0x98')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5bd5b3['checkRetriveMax'](0x5,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x11d')]>=_0x1af9f8[_0x28bb('0x191')]){_0x5bd5b3['createStateFinal'](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1ac'));}else{_0x5bd5b3[_0x28bb('0x1a7')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1ac'));}}break;case'8':_0x1af9f8[_0x28bb('0x1ad')]+=0x1;_0x326103[_0x28bb('0x6b')]=0x8;_0x326103[_0x28bb('0x6c')]=_0x28bb('0x1ae');_0x326103[_0x28bb('0x11e')]+=0x1;_0x326103['countglobal']+=0x1;_0x36efee=_0x1af9f8[_0x28bb('0x194')];_0x410e12=_0x1af9f8['callAdditionalPhoneAfterMin'];ami[_0x28bb('0x115')](_0x28bb('0x1af'),ut[_0x28bb('0x117')](_0x2424a6,_0x28bb('0x1b0')));hopperUtils[_0x28bb('0xe8')](_0x326103)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1b1')));if(_0x5bd5b3['checkRetriveMax'](0x8,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x11e')]>=_0x1af9f8[_0x28bb('0x193')]){_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1b2'));}else{_0x5bd5b3[_0x28bb('0x1a7')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1b2'));}}break;case'11':_0x1af9f8['outboundAbandonedCallsDay']+=0x1;_0x326103[_0x28bb('0x6b')]=0xb;_0x326103[_0x28bb('0x6c')]=_0x28bb('0xe7');_0x326103[_0x28bb('0xe0')]+=0x1;_0x326103[_0x28bb('0xe1')]+=0x1;_0x36efee=_0x1af9f8[_0x28bb('0xe2')];_0x410e12=_0x1af9f8[_0x28bb('0xe3')];hopperUtils[_0x28bb('0xe8')](_0x326103)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1b3')));if(_0x5bd5b3[_0x28bb('0x18e')](0xb,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0xe0')]>=_0x1af9f8['dialAbandonedMaxRetry']){_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,'reason\x2011\x20abandoned');}else{_0x5bd5b3['stateGlobal'](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1b4'));}}break;case'20':_0x1af9f8[_0x28bb('0x1b5')]+=0x1;_0x326103[_0x28bb('0x6b')]=0x14;_0x326103[_0x28bb('0x6c')]='AgentReject';_0x326103[_0x28bb('0x122')]+=0x1;_0x326103['countglobal']+=0x1;_0x36efee=_0x1af9f8['dialAgentRejectRetryFrequency'];_0x410e12=_0x1af9f8[_0x28bb('0xe3')];ami[_0x28bb('0x115')]('custom:agentreject',ut[_0x28bb('0x117')](_0x2424a6,_0x28bb('0x1b6')));hopperUtils[_0x28bb('0xe8')](_0x326103)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1b7')));if(_0x5bd5b3[_0x28bb('0x18e')](0x14,_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x122')]>=_0x1af9f8['dialAgentRejectMaxRetry']){_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,'reason\x2020\x20agentreject');}else{_0x5bd5b3[_0x28bb('0x1a7')](_0x326103,_0x3b9c4a,_0x441f64,_0x28bb('0x1b8'));}}break;default:_0x1af9f8[_0x28bb('0x139')]+=0x1;_0x326103[_0x28bb('0x6b')]=0xc;_0x326103[_0x28bb('0x6c')]=_0xa333a4[_0x28bb('0x19d')];_0x36efee=_0x1af9f8[_0x28bb('0x199')];_0x410e12=_0x1af9f8[_0x28bb('0xe3')];hopperUtils[_0x28bb('0xe8')](_0x326103)[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1b9')));if(_0x5bd5b3[_0x28bb('0x18e')](_0xa333a4[_0x28bb('0x19d')],_0x2424a6,_0x1af9f8)&&!_0x593bf5){if(_0x326103[_0x28bb('0x11d')]+_0x326103[_0x28bb('0x11e')]+_0x326103[_0x28bb('0x11f')]+_0x326103['countnosuchnumberretry']+_0x326103[_0x28bb('0xce')]+_0x326103[_0x28bb('0xe0')]+_0x326103[_0x28bb('0x121')]+_0x326103[_0x28bb('0x122')]>=_0x1af9f8['dialGlobalMaxRetry']){_0x5bd5b3[_0x28bb('0x1a7')](_0x326103,_0x3b9c4a,_0x441f64,_0xa333a4[_0x28bb('0x19d')]);}else{_0x5bd5b3[_0x28bb('0x126')](_0x326103,_0x3b9c4a,_0x441f64,_0xa333a4[_0x28bb('0x19d')]);}}}})[_0x28bb('0x94')](function(){if(_0x593bf5){hopperUtils['swapAdditionalPhones'](_0x326103,_0x36efee,_0x410e12)[_0x28bb('0x94')](function(){return _0x3b9c4a(0x1);});}});});};Dialer[_0x28bb('0x1b')][_0x28bb('0x1a7')]=function(_0x3ca136,_0x5d9668,_0xb08982,_0x149b30){var _0x5cca4c=new Final(_0x3ca136);_0x5cca4c[_0x28bb('0x6b')]=0xf;_0x5cca4c['statedesc']=_0x28bb('0x1ba');this[_0x28bb('0x126')](_0x5cca4c,_0x5d9668,_0xb08982,_0x149b30);};Dialer['prototype'][_0x28bb('0x126')]=function(_0x41fdd0,_0x51d1c6,_0x234c7d,_0x2ef6f3){hopperUtils[_0x28bb('0xc6')](_0x41fdd0)[_0x28bb('0x94')](function(){return _0x51d1c6(msgResponse(_0x28bb('0x19b'),_0x28bb('0x106'),_0x2ef6f3));})['catch'](function(){return _0x234c7d(msgResponse(_0x28bb('0x1bb'),_0x28bb('0x8b'),_0x28bb('0x1bc')));});};Dialer['prototype']['predictive']=function(_0x10887e){var _0x418ae0=_0x10887e[_0x28bb('0x1bd')]/0x64;var _0x1a91e4=_0x10887e['outboundDropCallsDayTimeout']/(_0x10887e['outboundDropCallsDayTimeout']+_0x10887e[_0x28bb('0xbf')]);var _0x490d5f=Math['round'](_0x10887e[_0x28bb('0x1be')]*(_0x10887e[_0x28bb('0x1bf')]/0x64));var _0x3d4d16=Math[_0x28bb('0x1c0')](_0x10887e[_0x28bb('0x1be')]*(_0x10887e[_0x28bb('0x1c1')]/0x64));var _0x404d8d=_0x10887e[_0x28bb('0x1c2')]+_0x10887e[_0x28bb('0x141')];var _0x129506=Math['floor'](_0x10887e['erlangCalls']*_0x10887e['erlangAbandonmentRate']*_0x10887e[_0x28bb('0x1c3')]*_0x10887e[_0x28bb('0x1c4')]);if(_[_0x28bb('0x53')](_0x10887e[_0x28bb('0x27')])){if(!_[_0x28bb('0x53')](_0x10887e[_0x28bb('0x5f')])){_0x10887e[_0x28bb('0x5f')]=undefined;loggerPredictive[_0x28bb('0x63')]('[startMethodPredictive][StartProgressive]',_0x28bb('0x1c5'));}if(!_['isUndefined'](_0x10887e['handlePredictive'])){loggerPredictive[_0x28bb('0x63')]('[startMethodPredictive][StartProgressive]',_0x28bb('0x1c6'));clearInterval(_0x10887e['handlePredictive']);_0x10887e[_0x28bb('0x61')]=undefined;}_0x10887e[_0x28bb('0x27')]=moment()[_0x28bb('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x28bb('0x47')](_0x10887e[_0x28bb('0x44')],_0x28bb('0x1c7'),_0x10887e[_0x28bb('0x27')]);this['handlePower'](_0x10887e,0x1);}else if(ifInterval(_0x10887e['dialPredictiveInterval'],_0x10887e['startProgressive'])){this[_0x28bb('0xad')](_0x10887e,0x1);loggerPredictiveCalls[_0x28bb('0x47')](_0x28bb('0x1c8'),_0x10887e[_0x28bb('0x27')],_0x10887e[_0x28bb('0x44')]);_0x10887e[_0x28bb('0x58')]=0x0;_0x10887e[_0x28bb('0xcc')]=0x0;}else if(_0x418ae0<_0x1a91e4&&_0x10887e[_0x28bb('0x1c9')]==='dropRate'){clearPredictiveAttributes(_0x10887e);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x1ca'),_0x28bb('0x1cb'),_0x1a91e4,_0x28bb('0x27'),_0x10887e[_0x28bb('0x44')]);}else if(_0x129506<_0x10887e[_0x28bb('0xcc')]&&_0x10887e[_0x28bb('0x1c9')]===_0x28bb('0x1cc')){clearPredictiveAttributes(_0x10887e);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x1cd'),_0x28bb('0x1ce'),_0x129506,'Drop\x20in\x20this\x20interval',_0x10887e[_0x28bb('0xcc')],_0x28bb('0x27'),_0x10887e[_0x28bb('0x44')]);}else if(!ifInterval(_0x10887e[_0x28bb('0x1cf')],_0x10887e[_0x28bb('0x27')])&&_['isUndefined'](_0x10887e[_0x28bb('0x5f')])&&!_['isUndefined'](_0x10887e[_0x28bb('0x27')])){_0x10887e[_0x28bb('0x5f')]=moment()[_0x28bb('0x78')](_0x28bb('0xc4'));loggerPredictive['info'](_0x10887e['name'],'started\x20in\x20predictive\x20at',_0x10887e[_0x28bb('0x5f')]);hopperUtils['avgHandleTime'](_0x10887e['dialPredictiveInterval'])['then'](this[_0x28bb('0x1d0')](_0x10887e))['then'](mergeDataErlangB(_0x10887e))[_0x28bb('0x94')](this[_0x28bb('0x1d1')](_0x10887e))[_0x28bb('0x98')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x10887e));}else if(!ifInterval(_0x10887e[_0x28bb('0x1cf')],_0x10887e[_0x28bb('0x5f')])){_0x10887e[_0x28bb('0xcc')]=0x0;_0x10887e['startPredictive']=moment()['format'](_0x28bb('0xc4'));loggerPredictive[_0x28bb('0x47')](_0x10887e[_0x28bb('0x44')],_0x28bb('0x1d2'),_0x10887e[_0x28bb('0x5f')]);clearInterval(_0x10887e[_0x28bb('0x61')]);_0x10887e[_0x28bb('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x10887e[_0x28bb('0x1cf')])[_0x28bb('0x94')](this[_0x28bb('0x1d0')](_0x10887e))[_0x28bb('0x94')](mergeDataErlangB(_0x10887e))[_0x28bb('0x94')](this['startMethodPredictive'](_0x10887e))['catch'](loggerCatchPredictive(_0x28bb('0x1d3'),_0x10887e));}else if(_0x10887e['predictiveIntervalAvailable']&&_0x404d8d<_0x10887e[_0x28bb('0x1be')]-_0x3d4d16){clearPredictiveAttributes(_0x10887e);loggerPredictive['info'](_0x10887e[_0x28bb('0x44')],_0x28bb('0x1d4'),_0x404d8d,')\x20are\x20less\x20than\x20threshold\x20(',_0x10887e[_0x28bb('0x1be')],'-',_0x3d4d16,'=',_0x10887e[_0x28bb('0x1be')]-_0x3d4d16,')');}else if(_0x10887e[_0x28bb('0x1be')]&&_0x404d8d>_0x10887e[_0x28bb('0x1be')]+_0x490d5f){clearPredictiveAttributes(_0x10887e);loggerPredictive[_0x28bb('0x47')](_0x10887e[_0x28bb('0x44')],_0x28bb('0x1d4'),_0x404d8d,_0x28bb('0x1d5'),_0x10887e['predictiveIntervalAvailable'],'+',_0x490d5f,'=',_0x10887e[_0x28bb('0x1be')]+_0x490d5f,')');}};Dialer['prototype'][_0x28bb('0x1d0')]=function(_0x289fdc){var _0xb40b76=this;return function(_0x3107fd){return new Promise(function(_0x4c2f67,_0x26e78a){_['merge'](_0x289fdc,_0x3107fd[0x0]);if(checkGetDataPredictive(_0x3107fd[0x0])){var _0x1f737f=_0x289fdc[_0x28bb('0x1be')]=_0x289fdc[_0x28bb('0x141')]+_0x289fdc[_0x28bb('0x1c2')];var _0x2819e1=_0x289fdc['dialPredictiveInterval']*0x3c;var _0x29f073=_0x3107fd[0x0][_0x28bb('0x51')]+_0x3107fd[0x0]['predictiveIntervalAvgHoldtime'];var _0x16511b=(_0x3107fd[0x0]['predictiveIntervalAnsweredCalls']+_0x3107fd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3107fd[0x0][_0x28bb('0x4e')])/_0x3107fd[0x0][_0x28bb('0x48')];_0x289fdc[_0x28bb('0x1c3')]=_0x16511b>0x0?_0x16511b:0x1;switch(_0x289fdc['dialPredictiveOptimization']){case _0x28bb('0x1cc'):var _0x3dbdcd=_0x289fdc['dialPredictiveOptimizationPercentage']/0x64;return _0xb40b76['abandonmentRate'](_0x1f737f,_0x2819e1,_0x29f073,_0x16511b,_0x3dbdcd)[_0x28bb('0x94')](function(_0x247ad9){return _0x4c2f67(_0x247ad9);});case'agentBusyFactor':var _0x3399b7=_0x289fdc[_0x28bb('0x1bd')]/0x64;return _0xb40b76['busyFactor'](_0x1f737f,_0x2819e1,_0x29f073,_0x16511b,_0x3399b7)[_0x28bb('0x94')](function(_0x1d2999){return _0x4c2f67(_0x1d2999);});default:return _0x26e78a(msgResponse('[getDataPredictive]','Failure',_0x28bb('0x1d6')));}}else{return _0x26e78a(msgResponse(_0x28bb('0x1d7'),_0x28bb('0x8b'),_0x28bb('0x1d8')));}});};};Dialer[_0x28bb('0x1b')]['getDataPredictiveOld']=function(_0x5e2de3){var _0x40f3c2=this;return function(_0x5f552e){return new Promise(function(_0x1e2063,_0x1e92e6){_[_0x28bb('0xf4')](_0x5e2de3,_0x5f552e[0x0]);if(checkGetDataPredictive(_0x5f552e[0x0])){loggerPredictive['info'](JSON[_0x28bb('0x71')](_0x5f552e[0x0]));if(_0x5e2de3['dialPredictiveOptimization']===_0x28bb('0x1cc')){return _0x40f3c2['getVoiceQueueRtPauses'](_0x5e2de3['id'])[_0x28bb('0x94')](function(_0x2fbfca){var _0xd6f76=_0x5e2de3[_0x28bb('0x1d9')]-_0x2fbfca[0x0][_0x28bb('0x1da')];var _0x38ae0a=_0x5e2de3[_0x28bb('0x1cf')]*0x3c;var _0x40fb19=_0x5f552e[0x0][_0x28bb('0x51')]+_0x5f552e[0x0]['predictiveIntervalAvgHoldtime'];var _0x5c40b8=(_0x5f552e[0x0][_0x28bb('0x4a')]+_0x5f552e[0x0][_0x28bb('0x4c')]+_0x5f552e[0x0][_0x28bb('0x4e')])/_0x5f552e[0x0][_0x28bb('0x48')];var _0x5487b5=_0x5e2de3[_0x28bb('0x1bd')]/0x64;_0x5e2de3[_0x28bb('0x1db')]=_0x2fbfca[0x0][_0x28bb('0x1da')]||0x0;_0x5e2de3[_0x28bb('0x1c3')]=_0x5c40b8>0x0?_0x5c40b8:0x1;return _0x40f3c2['abandonmentRate'](_0xd6f76,_0x38ae0a,_0x40fb19,_0x5c40b8,_0x5487b5);})[_0x28bb('0x94')](function(_0x4be504){return _0x1e2063(_0x4be504);})['catch'](function(_0x59ff41){return _0x1e92e6(msgResponse(_0x28bb('0x1dc'),_0x28bb('0x8b'),JSON[_0x28bb('0x71')](_0x59ff41)));});}if(_0x5e2de3['dialPredictiveOptimization']===_0x28bb('0x1dd')){return _0x40f3c2['getVoiceQueueRtPauses'](_0x5e2de3['id'])['then'](function(_0x8453ed){var _0x12f9a4=_0x5e2de3[_0x28bb('0x1d9')]-_0x8453ed[0x0][_0x28bb('0x1da')];var _0x1bc78e=_0x5e2de3[_0x28bb('0x1cf')]*0x3c;var _0x37c0c8=_0x5f552e[0x0]['predictiveIntervalAvgTalktime']+_0x5f552e[0x0][_0x28bb('0x4f')];var _0x28da06=(_0x5f552e[0x0][_0x28bb('0x4a')]+_0x5f552e[0x0][_0x28bb('0x4c')]+_0x5f552e[0x0][_0x28bb('0x4e')])/_0x5f552e[0x0][_0x28bb('0x48')];var _0x25fbba=_0x5e2de3['dialPredictiveOptimizationPercentage']/0x64;_0x5e2de3[_0x28bb('0x1db')]=_0x8453ed[0x0]['outboundQueuePauses']||0x0;_0x5e2de3[_0x28bb('0x1c3')]=_0x28da06>0x0?_0x28da06:0x1;return _0x40f3c2['busyFactor'](_0x12f9a4,_0x1bc78e,_0x37c0c8,_0x28da06,_0x25fbba);})['then'](function(_0x200784){return _0x1e2063(_0x200784);})[_0x28bb('0x98')](function(_0x15b8ff){return _0x1e92e6(msgResponse(_0x28bb('0x1dc'),_0x28bb('0x8b'),JSON[_0x28bb('0x71')](_0x15b8ff)));});}}else{return _0x1e92e6(msgResponse(_0x28bb('0x1d7'),_0x28bb('0x8b'),_0x28bb('0x1d8')));}});};};Dialer[_0x28bb('0x1b')][_0x28bb('0x1d1')]=function(_0x44ec0d){var _0x7a58e0=this;return function(){var _0x22681c=0x0;var _0xc40ac6=Math['floor'](_0x44ec0d['erlangCallToSecond']*0x3e8);if(_0xc40ac6>0x0){_0xc40ac6=_0xc40ac6<0x64?0x64:_0xc40ac6;loggerPredictive[_0x28bb('0x47')](_0x44ec0d[_0x28bb('0x44')],'one\x20call\x20every:',_0xc40ac6,_0x28bb('0x1de'));_0x44ec0d[_0x28bb('0x61')]=setInterval(function(){_0x7a58e0[_0x28bb('0x61')](_0x44ec0d);loggerPredictiveCalls[_0x28bb('0x47')](_0x28bb('0x1df'),_0x22681c+=0x1);},_0xc40ac6);}else{loggerPredictive[_0x28bb('0x47')](_0x44ec0d['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x28bb('0x1b')][_0x28bb('0x1e0')]=function(_0x34446b,_0x6e3084){var _0x2dcc34=this;return function(_0x3038b9){if(_[_0x28bb('0x45')](_0x3038b9)){if(_['isNil'](_0x6e3084['UserId'])||!_0x6e3084['recallme']){if(_0x34446b[_0x28bb('0xac')]===_0x28bb('0x9')){_0x34446b[_0x28bb('0x6f')]=_[_0x28bb('0x53')](_0x34446b['queueStatusComplete'])?!![]:_0x34446b[_0x28bb('0x6f')];var _0x7d71e9=uuid['v4']();_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9]=new Action(_0x34446b,_0x6e3084,_0x7d71e9);loggerBooked[_0x28bb('0x47')]('[booked][checkContactBlack]',_0x7d71e9,'queueStatusComplete:\x20',JSON[_0x28bb('0x71')](_0x34446b[_0x28bb('0x6f')]),'Queue:\x20',_0x34446b[_0x28bb('0x44')]);if(_0x34446b[_0x28bb('0x6f')]){_0x34446b[_0x28bb('0x6f')]=![];_0x2dcc34[_0x28bb('0x29')][_0x2dcc34['actions'][_0x7d71e9][_0x28bb('0xb9')]]=[];ami[_0x28bb('0x91')]({'actionid':_0x7d71e9,'action':_0x28bb('0x1e1'),'queue':_0x34446b[_0x28bb('0x44')]})[_0x28bb('0x98')](function(){utils['decrementOriginate'](_0x34446b,_0x28bb('0x1e2'));hopperUtils[_0x28bb('0xd5')]({'active':![],'ContactId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9][_0x28bb('0xd6')],'ListId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9]['ListId'],'VoiceQueueId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9]['VoiceQueueId']||undefined,'CampaignId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9][_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1e3')));delete _0x2dcc34[_0x28bb('0xe9')][_0x7d71e9];});}else{loggerBooked[_0x28bb('0x47')]('[booked][checkContactBlack][else]',JSON[_0x28bb('0x71')](_0x34446b[_0x28bb('0x6f')]),_0x28bb('0x1e4'),_0x34446b[_0x28bb('0x44')]);utils[_0x28bb('0xc8')](_0x34446b,_0x28bb('0x1e2'));hopperUtils[_0x28bb('0xd5')]({'active':![],'ContactId':_0x2dcc34['actions'][_0x7d71e9][_0x28bb('0xd6')],'ListId':_0x2dcc34['actions'][_0x7d71e9][_0x28bb('0xd7')],'VoiceQueueId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9]['VoiceQueueId']||undefined,'CampaignId':_0x2dcc34[_0x28bb('0xe9')][_0x7d71e9]['CampaignId']||undefined})[_0x28bb('0x98')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2dcc34[_0x28bb('0xe9')][_0x7d71e9];}}else{return _0x2dcc34['actionOriginate'](_0x34446b,_0x6e3084);}}else{if(utils['getSeconds'](undefined,_0x6e3084['scheduledat'])<_0x34446b[_0x28bb('0x1e5')]*0x3c){if(_0x6e3084[_0x28bb('0x14b')]&&!_0x6e3084[_0x28bb('0x14b')][_0x28bb('0x1e6')]){_0x2dcc34['preview']['run'](_0x6e3084['id'])[_0x28bb('0x1e')](function(){utils[_0x28bb('0xc8')](_0x34446b,_0x28bb('0x1e2'));});}else{hopperUtils[_0x28bb('0x1e7')]({'active':![]},_0x6e3084['id'],0x1)[_0x28bb('0x1e')](function(){utils['decrementOriginate'](_0x34446b,_0x28bb('0x1e2'));});}}else{_0x34446b[_0x28bb('0x1e8')]+=0x1;utils[_0x28bb('0xc8')](_0x34446b,_0x28bb('0x1e2'));if(_0x34446b['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x6e3084[_0x28bb('0xd6')],'ListId':_0x6e3084[_0x28bb('0xd7')],'VoiceQueueId':_0x6e3084['VoiceQueueId']||undefined,'CampaignId':_0x6e3084[_0x28bb('0xd9')]||undefined})[_0x28bb('0x98')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x28bb('0xe8')](createObjHistory(_0x34446b,_0x6e3084,utils['CAMPAIGN_STATUS'][_0x28bb('0x1e9')],0x17,_0x28bb('0x1ea')))[_0x28bb('0x98')](loggerCatch(_0x28bb('0x1eb')));}else{_0x2dcc34[_0x28bb('0x119')](createObjHistory(_0x34446b,_0x6e3084,utils['CAMPAIGN_STATUS'][_0x28bb('0x1ec')],0x16,_0x28bb('0x1ed')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x34446b[_0x28bb('0x1ee')]+=0x1;_0x2dcc34[_0x28bb('0x119')](createObjHistory(_0x34446b,_0x6e3084,utils[_0x28bb('0x69')][_0x28bb('0x1ef')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x28bb('0x1f0'));throw _0x28bb('0x1f1');}};};Dialer['prototype'][_0x28bb('0x15d')]=function(_0x5cb566){var _0x4275a9=this;var _0x5a0578=_0x5cb566[_0x28bb('0x1f2')]-_0x5cb566['originated'];emitCampaignSummary(_0x5cb566);if(_0x5a0578>0x0&&_0x5cb566[_0x28bb('0x1f3')]==0x0){if(_0x5a0578>this[_0x28bb('0x23')]){_0x5a0578=this[_0x28bb('0x23')];}_0x5cb566[_0x28bb('0x1f3')]=0x1;hopperUtils[_0x28bb('0x1f4')](_0x5cb566,_0x5a0578)[_0x28bb('0x94')](function(_0x44aa09){_0x5cb566[_0x28bb('0x1f3')]=0x0;if(_0x44aa09){if(!utils['checkContactEmpty'](_0x44aa09)){_0x5cb566[_0x28bb('0x68')]=utils['CAMPAIGN_STATUS'][_0x28bb('0x1f5')];logger[_0x28bb('0x47')](_0x28bb('0x1f6')+_0x5cb566[_0x28bb('0x44')]);}else{_0x5cb566[_0x28bb('0x7a')]+=_0x44aa09[_0x28bb('0x8f')];_0x5cb566['message']=utils[_0x28bb('0x69')][_0x28bb('0x1f7')];for(var _0x36dd87=0x0;_0x36dd87<_0x44aa09['length'];_0x36dd87+=0x1){_0x5cb566[_0x28bb('0x1f8')]+=0x1;if(_[_0x28bb('0xef')](_0x44aa09[_0x36dd87])||_[_0x28bb('0xef')](_0x44aa09[_0x36dd87][_0x28bb('0x1f9')])||_[_0x28bb('0xef')](_0x44aa09[_0x36dd87]['phone'])){_0x4275a9[_0x28bb('0x156')](_0x28bb('0x1fa'),_0x5cb566,_0x44aa09[_0x36dd87]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x28bb('0x72')](_0x44aa09[_0x36dd87],[_0x28bb('0xd9'),_0x28bb('0x161')]))['then'](_0x4275a9[_0x28bb('0x1e0')](_0x5cb566,_0x44aa09[_0x36dd87]))[_0x28bb('0x98')](function(_0xba8366){logger[_0x28bb('0x63')](_0x28bb('0x1fb'),_0xba8366);utils[_0x28bb('0xc8')](_0x5cb566,'[handleIvr]');});}}}}})[_0x28bb('0x98')](function(_0x53a050){_0x5cb566[_0x28bb('0x1f3')]=0x0;logger[_0x28bb('0x63')]('[getContactCampaign2]',_0x53a050);});}};Dialer[_0x28bb('0x1b')][_0x28bb('0xad')]=function(_0x43d439,_0x12d344){var _0x3a58e7=this;var _0x1670d0=[];if(_0x12d344<0x1||_0x43d439[_0x28bb('0xac')]===_0x28bb('0x9')){_0x12d344=0x1;}var _0x2eafa3=Math[_0x28bb('0x1fc')](_0x43d439[_0x28bb('0x1c2')]*_0x12d344)-_0x43d439[_0x28bb('0x7a')];if(_0x43d439['dialLimitQueue']>0x0){var _0x5e09f7=_0x43d439[_0x28bb('0x1fd')]-_0x43d439['originated']-_0x43d439[_0x28bb('0x141')]-_0x43d439[_0x28bb('0x142')];if(_0x2eafa3>_0x5e09f7){_0x2eafa3=_0x5e09f7;}}if(_0x2eafa3>0x0&&_0x43d439[_0x28bb('0x1f3')]==0x0){if(_0x43d439['dialMethod']===_0x28bb('0x9')){_0x2eafa3=0x1;}if(_0x2eafa3>this[_0x28bb('0x23')]){_0x2eafa3=this[_0x28bb('0x23')];}for(var _0x9f32b2 in this['agents']){if(typeof this[_0x28bb('0x21')][_0x9f32b2]!==_0x28bb('0xa3')){if(this[_0x28bb('0x21')][_0x9f32b2][_0x28bb('0x6b')]===_0x28bb('0x1fe')&&this['agents'][_0x9f32b2]['status']==='reachable'){_0x1670d0['push'](this[_0x28bb('0x21')][_0x9f32b2]['id']);}}}_0x43d439[_0x28bb('0x1f3')]=0x1;hopperUtils['getContactDialer'](_0x43d439,_0x1670d0,_0x2eafa3)[_0x28bb('0x94')](function(_0x7ef4b4){_0x43d439[_0x28bb('0x1f3')]=0x0;if(_0x7ef4b4){if(!utils[_0x28bb('0x1ff')](_0x7ef4b4)){hopperUtils[_0x28bb('0x200')](_0x43d439)[_0x28bb('0x94')](sendMessageReschedule(_0x43d439))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x43d439[_0x28bb('0x7a')]+=_0x7ef4b4[_0x28bb('0x8f')];_0x43d439[_0x28bb('0x68')]=_0x43d439['dialMethod']==='booked'?utils[_0x28bb('0x69')][_0x28bb('0x143')]:utils[_0x28bb('0x69')][_0x28bb('0x1f7')];for(var _0x2423b6=0x0;_0x2423b6<_0x7ef4b4['length'];_0x2423b6+=0x1){if(_['isNil'](_0x7ef4b4[_0x2423b6])||_[_0x28bb('0xef')](_0x7ef4b4[_0x2423b6]['Contact'])||_[_0x28bb('0xef')](_0x7ef4b4[_0x2423b6][_0x28bb('0x161')])){_0x3a58e7[_0x28bb('0x156')](_0x28bb('0x1fa'),_0x43d439,_0x7ef4b4[_0x2423b6]);}else{hopperUtils[_0x28bb('0x201')](_[_0x28bb('0x72')](_0x7ef4b4[_0x2423b6],[_0x28bb('0xd8'),'phone']))['then'](_0x3a58e7[_0x28bb('0x1e0')](_0x43d439,_0x7ef4b4[_0x2423b6]))['catch'](function(_0x1c5df9){logger[_0x28bb('0x63')](_0x28bb('0x202'),_0x1c5df9);utils[_0x28bb('0xc8')](_0x43d439,'[handlePower]');});}}}}})['catch'](function(_0x41e2ce){_0x43d439[_0x28bb('0x1f3')]=0x0;logger['error']('[getContactCampaign2]',_0x41e2ce);});}};Dialer[_0x28bb('0x1b')]['handlePredictive']=function(_0x523370){if(_0x523370[_0x28bb('0x1fd')]>0x0){var _0x3118c6=_0x523370[_0x28bb('0x1fd')]-_0x523370[_0x28bb('0x7a')]-_0x523370['talking'];if(_0x3118c6>0x0&&_0x523370[_0x28bb('0x1f3')]==0x0){this['tryOriginatePredictive'](_0x523370);}else{loggerPredictiveCalls['info'](_0x28bb('0x203'));}}else{this[_0x28bb('0x204')](_0x523370);}};Dialer[_0x28bb('0x1b')][_0x28bb('0x204')]=function(_0x23bd06){var _0x2fb5f9=this;var _0x55f930=[];_0x23bd06[_0x28bb('0x7a')]+=0x1;for(var _0x4a7828 in this[_0x28bb('0x21')]){if(typeof this[_0x28bb('0x21')][_0x4a7828]!==_0x28bb('0xa3')){if(this[_0x28bb('0x21')][_0x4a7828][_0x28bb('0x6b')]===_0x28bb('0x1fe')&&this[_0x28bb('0x21')][_0x4a7828][_0x28bb('0x82')]===_0x28bb('0x81')){_0x55f930[_0x28bb('0x90')](this[_0x28bb('0x21')][_0x4a7828]['id']);}}}_0x23bd06['temp']=0x1;return this[_0x28bb('0x205')](_0x23bd06['id'],_0x55f930,0x1,_0x23bd06[_0x28bb('0x206')],_0x23bd06)[_0x28bb('0x94')](function(_0x524f29){_0x23bd06[_0x28bb('0x1f3')]=0x1;if(_0x524f29){if(!utils[_0x28bb('0x1ff')](_0x524f29)){utils[_0x28bb('0x207')](_0x23bd06,0x1,0x0);return hopperUtils[_0x28bb('0x200')](_0x23bd06)[_0x28bb('0x94')](sendMessageReschedule(_0x23bd06))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x23bd06[_0x28bb('0x68')]=utils[_0x28bb('0x69')][_0x28bb('0x1f7')];if(_[_0x28bb('0xef')](_0x524f29[0x0])||_[_0x28bb('0xef')](_0x524f29[0x0][_0x28bb('0x1f9')])||_[_0x28bb('0xef')](_0x524f29[0x0][_0x28bb('0x161')])){_0x2fb5f9['emptyContact'](_0x28bb('0x1fa'),_0x23bd06,_0x524f29[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x28bb('0x72')](_0x524f29[0x0],[_0x28bb('0xd8'),_0x28bb('0x161')]))[_0x28bb('0x94')](_0x2fb5f9[_0x28bb('0x1e0')](_0x23bd06,_0x524f29[0x0]))[_0x28bb('0x98')](function(_0x21c94e){logger[_0x28bb('0x63')]('[actionOriginatePredictive]',_0x21c94e);utils[_0x28bb('0xc8')](_0x23bd06,_0x28bb('0x208'));});}}}})['catch'](function(_0x20bab4){_0x23bd06[_0x28bb('0x1f3')]=0x0;logger['error'](_0x28bb('0x209'),_0x20bab4);});};Dialer[_0x28bb('0x1b')][_0x28bb('0x20a')]=function(_0xa85045,_0x1f4757,_0x3ce103,_0x40a31b,_0x517ff2,_0x2b7c2d){loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20b'));loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20c'),_0xa85045);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20d'),_0x1f4757);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20e'),_0x3ce103);loggerPredictive['info'](_0x28bb('0x20f'),_0x40a31b);loggerPredictive[_0x28bb('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x517ff2);loggerPredictive['info']('---------------------------');return new Promise(function(_0x18c56e,_0x3bb658){if(_0xa85045<=0x0||isNaN(_0xa85045)){return _0x3bb658(msgResponse(_0x28bb('0x210'),_0x28bb('0x7e'),_0x28bb('0x211')+_0xa85045));}if(_0x3ce103<=0x0||isNaN(_0x3ce103)){return _0x3bb658(msgResponse(_0x28bb('0x210'),_0x28bb('0x7e'),'Ts\x20=\x20'+_0x3ce103));}if(_0x40a31b<=0x0||isNaN(_0x40a31b)){return _0x3bb658(msgResponse(_0x28bb('0x210'),_0x28bb('0x7e'),_0x28bb('0x212')+_0x40a31b));}if(_0x1f4757<=0x0||isNaN(_0x1f4757)){return _0x3bb658(msgResponse('[abandonmentRate]',_0x28bb('0x7e'),'interval\x20=\x20'+_0x1f4757));}if(_0x517ff2<=0x0||isNaN(_0x517ff2)){return _0x3bb658(msgResponse(_0x28bb('0x210'),_0x28bb('0x7e'),_0x28bb('0x213')+_0x517ff2));}_0x2b7c2d=_0x2b7c2d||0x0;var _0x459dee=0x1/_0x3ce103;var _0x211a69=0x0;var _0x35168c=0x0;var _0x1c3c4b=0x0;var _0x3d3f22=0x0;for(var _0x3cc4a4=0x0;_0x1c3c4b<_0x517ff2;_0x3cc4a4+=0x1){_0x35168c=_0x3cc4a4/_0x1f4757;_0x211a69=(_0x40a31b*_0x35168c+_0x2b7c2d)/_0x459dee;_0x1c3c4b=utils[_0x28bb('0x214')](_0x211a69,_0xa85045);_0x3d3f22=_0x211a69/_0xa85045*(0x1-utils['erlangb'](_0x211a69,_0xa85045));}return _0x18c56e({'erlangCalls':_0x3cc4a4,'erlangCallToSecond':_0x1f4757/_0x3cc4a4,'erlangAbandonmentRate':_0x1c3c4b,'erlangBusyFactor':_0x3d3f22});});};Dialer[_0x28bb('0x1b')][_0x28bb('0x215')]=function(_0x531aa8,_0x1d55c8,_0x25ff9b,_0x70af8c,_0x3c8039,_0x531233){loggerPredictive[_0x28bb('0x47')](_0x28bb('0x216'));loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20c'),_0x531aa8);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x20d'),_0x1d55c8);loggerPredictive[_0x28bb('0x47')]('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',_0x25ff9b);loggerPredictive[_0x28bb('0x47')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x70af8c);loggerPredictive['info'](_0x28bb('0x217'),_0x3c8039);loggerPredictive[_0x28bb('0x47')](_0x28bb('0x52'));return new Promise(function(_0x229ab4,_0x4d2d23){if(_0x531aa8<=0x0||isNaN(_0x531aa8)){return _0x4d2d23(msgResponse(_0x28bb('0x218'),_0x28bb('0x7e'),_0x28bb('0x211')+_0x531aa8));}if(_0x25ff9b<=0x0||isNaN(_0x25ff9b)){return _0x4d2d23(msgResponse('[busyFactor]',_0x28bb('0x7e'),_0x28bb('0x219')+_0x25ff9b));}if(_0x70af8c<=0x0||isNaN(_0x70af8c)){return _0x4d2d23(msgResponse(_0x28bb('0x218'),'Error',_0x28bb('0x212')+_0x70af8c));}if(_0x1d55c8<=0x0||isNaN(_0x1d55c8)){return _0x4d2d23(msgResponse(_0x28bb('0x218'),'Error','interval\x20=\x20'+_0x1d55c8));}if(_0x3c8039<=0x0||isNaN(_0x3c8039)){return _0x4d2d23(msgResponse(_0x28bb('0x218'),'Error',_0x28bb('0x21a')+_0x3c8039));}_0x531233=_0x531233||0x0;var _0x4c3925=0x1/_0x25ff9b;var _0x583f53=0x0;var _0x26b5aa=0x0;var _0x70216=0x0;var _0x4dd6a0=0x0;for(var _0x132810=0x0;_0x4dd6a0<_0x3c8039;_0x132810+=0x1){_0x26b5aa=_0x132810/_0x1d55c8;_0x583f53=(_0x70af8c*_0x26b5aa+_0x531233)/_0x4c3925;_0x70216=utils[_0x28bb('0x214')](_0x583f53,_0x531aa8);_0x4dd6a0=_0x583f53/_0x531aa8*(0x1-utils[_0x28bb('0x214')](_0x583f53,_0x531aa8));}return _0x229ab4({'erlangCalls':_0x132810,'erlangCallToSecond':_0x1d55c8/_0x132810,'erlangAbandonmentRate':_0x70216,'erlangBusyFactor':_0x4dd6a0});});};module[_0x28bb('0x21b')]=Dialer; \ No newline at end of file +var _0x6bc9=['[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','[checkContactBlack]','getSeconds','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginateIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','emptyContact','[actionOriginate]\x20','checkIsBlackList','[handlePower]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','is\x20not\x20active','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','content','true','Action','iftime\x20%s,%s','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','\x20Interval\x20is\x20overtime:\x20','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','CampaignId','Drop','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','ContactId','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','idHopper','run','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','[booked][unlock2]','rescheduleContact','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','response','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','[syncVarSet]','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','buildObj','countcongestionretry','countagentrejectretry','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundAnswerAgiCallsDay','AnswerAGI','AGI','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','statusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','online','handlePreviewRecallNotifications','map','user:%s','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-CAMPAIGNID','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originate][error]','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject'];(function(_0x3e9d4b,_0x154bbe){var _0x51f812=function(_0x5e620e){while(--_0x5e620e){_0x3e9d4b['push'](_0x3e9d4b['shift']());}};_0x51f812(++_0x154bbe);}(_0x6bc9,0x6f));var _0x96bc=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x6bc9[_0x786e9];return _0x1f891b;};'use strict';var util=require(_0x96bc('0x0'));var _=require(_0x96bc('0x1'));var uuid=require(_0x96bc('0x2'));var moment=require(_0x96bc('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x96bc('0x4'));var hopperUtils=require(_0x96bc('0x5'));var ut=require('../preview/util/util');var config=require(_0x96bc('0x6'));var logger=require('../../../config/logger')(_0x96bc('0x7'));var loggerBooked=require(_0x96bc('0x8'))(_0x96bc('0x9'));var loggerPredictive=require(_0x96bc('0x8'))(_0x96bc('0xa'));var loggerPredictiveCalls=require(_0x96bc('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x96bc('0x8'))(_0x96bc('0xb'));var ami=require('../ami');config[_0x96bc('0xc')]=_[_0x96bc('0xd')](config[_0x96bc('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x96bc('0xe'))(new Redis(config[_0x96bc('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x96bc('0xf'));var RpcSetting=require(_0x96bc('0x10'));var Interval=require(_0x96bc('0x11'));var Action=require(_0x96bc('0x12'));var History=require(_0x96bc('0x13'));var Final=require(_0x96bc('0x14'));var AgentComplete=require(_0x96bc('0x15'));var QueueCallerAbandon=require(_0x96bc('0x16'));var Hangup=require(_0x96bc('0x17'));var ipAgi=process[_0x96bc('0x18')][_0x96bc('0x19')]||_0x96bc('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x96bc('0x1b')]['enqueue']=function(_0x124454){this[_0x96bc('0x1c')]=this[_0x96bc('0x1c')]?this[_0x96bc('0x1c')]['finally'](_0x124454):_0x124454();};function Dialer(_0x479235,_0x3a2dad){this[_0x96bc('0x1d')]=new Sequence();this[_0x96bc('0x1e')]=_0x3a2dad;this[_0x96bc('0x1f')]=_0x479235['voiceQueues'];this[_0x96bc('0x20')]=_0x479235[_0x96bc('0x20')];this[_0x96bc('0x21')]=_0x479235[_0x96bc('0x21')];this[_0x96bc('0x22')]=_0x479235[_0x96bc('0x22')];this[_0x96bc('0x23')]=config['maxNumberOriginate']||0x2;this[_0x96bc('0x24')]={};this['actions']={};this[_0x96bc('0x25')]={};this['uniqueId']={};this[_0x96bc('0x26')]={};this[_0x96bc('0x27')]={};this[_0x96bc('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0x96bc('0x29')]={};ami['on'](_0x96bc('0x2a'),this[_0x96bc('0x2b')][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x2d'),this[_0x96bc('0x2e')][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x2f'),this['syncOriginateResponse'][_0x96bc('0x2c')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x96bc('0x2c')](this));ami['on'](_0x96bc('0x30'),this[_0x96bc('0xb')]['bind'](this));ami['on'](_0x96bc('0x31'),this[_0x96bc('0x32')]['bind'](this));ami['on'](_0x96bc('0x33'),this['syncHangup']['bind'](this));ami['on'](_0x96bc('0x34'),this[_0x96bc('0x35')]['bind'](this));ami['on'](_0x96bc('0x36'),this[_0x96bc('0x37')][_0x96bc('0x2c')](this));ami['on']('queuemember',this['syncQueueMember'][_0x96bc('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x96bc('0x38')]['bind'](this));this[_0x96bc('0x39')]();this['loopClearZombieChannels']();RpcSetting[_0x96bc('0x3a')]()[_0x96bc('0x3b')](function(_0x173fef){previewRecallmeReminderInterval=_0x173fef[_0x96bc('0x3c')];});}function isNotNull(_0x52ef0a){return _0x52ef0a!==null&&!_[_0x96bc('0x3d')](_0x52ef0a);}function msgResponse(_0xd7d35a,_0x577c0f,_0xa5b8){return{'action':_0xd7d35a,'response':_0x577c0f,'message':_0xa5b8,'stack':_0xa5b8};}function emit(_0x1c9f87,_0x7c25e9,_0x27bea0){io['to'](_0x1c9f87)[_0x96bc('0x3e')](_0x7c25e9,_0x27bea0);}function emitOutboundVoiceQueueSummary(_0x29cec2){if(_0x29cec2[_0x96bc('0x3f')]===_0x96bc('0x40')){logger[_0x96bc('0x41')](_0x96bc('0x42'),util[_0x96bc('0x43')](_0x29cec2,{'showHidden':![],'depth':null}));emit(util[_0x96bc('0x44')](_0x96bc('0x45'),_0x29cec2['name']),'voice_queue:save',_0x29cec2);}}function checkGetDataPredictive(_0x12fc28){if(isNotNull(_0x12fc28)&&!_[_0x96bc('0x46')](_0x12fc28)){loggerPredictive['info'](_0x96bc('0x47'));loggerPredictive[_0x96bc('0x48')](_0x96bc('0x49'),_0x12fc28[_0x96bc('0x4a')]);loggerPredictive[_0x96bc('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12fc28[_0x96bc('0x4b')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x4c'),_0x12fc28[_0x96bc('0x4d')]);loggerPredictive['info'](_0x96bc('0x4e'),_0x12fc28[_0x96bc('0x4f')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x50'),_0x12fc28[_0x96bc('0x51')]);loggerPredictive['info'](_0x96bc('0x52'),_0x12fc28[_0x96bc('0x53')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));if(_0x12fc28[_0x96bc('0x4a')]>0x0){if(!_[_0x96bc('0x3d')](_0x12fc28['predictiveIntervalAvgTalktime'])&&_0x12fc28['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x96bc('0x55'));if(!_['isUndefined'](_0x12fc28[_0x96bc('0x51')])&&_0x12fc28[_0x96bc('0x51')]>0x0){return!![];}loggerPredictive['info'](_0x96bc('0x56'));}else{loggerPredictive[_0x96bc('0x48')](_0x96bc('0x57'));}}else{loggerPredictive['info'](_0x96bc('0x58'));}return![];}function mergeDataErlangB(_0x14b81d){return function(_0x21d2f3){loggerPredictive[_0x96bc('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x96bc('0x48')](_0x96bc('0x59'),_0x21d2f3['erlangCalls']);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x5a'),_0x21d2f3['erlangCallToSecond']);loggerPredictive[_0x96bc('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21d2f3['erlangAbandonmentRate']);loggerPredictive[_0x96bc('0x48')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21d2f3[_0x96bc('0x5b')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x5c'),_0x21d2f3[_0x96bc('0x5d')]);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));_[_0x96bc('0x5e')](_0x14b81d,_0x21d2f3);};}function ifInterval(_0x1ca088,_0x23b388){if(_[_0x96bc('0x3d')](_0x23b388)){return![];}return utils['getSeconds'](undefined,_0x23b388)<_0x1ca088*0x3c;}function clearPredictiveAttributes(_0x3b43de){if(_0x3b43de[_0x96bc('0x28')]){_0x3b43de[_0x96bc('0x28')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de[_0x96bc('0x5f')],_0x96bc('0x60'));}if(_0x3b43de[_0x96bc('0x27')]){_0x3b43de[_0x96bc('0x27')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de['name'],_0x96bc('0x61'));}if(_0x3b43de[_0x96bc('0x62')]){clearInterval(_0x3b43de['handlePredictive']);_0x3b43de[_0x96bc('0x62')]=undefined;loggerPredictive[_0x96bc('0x41')](_0x3b43de[_0x96bc('0x5f')],_0x96bc('0x63'));}}function loggerCatchPredictive(_0x2db083,_0x24ff5d){return function(_0x54637e){loggerPredictive[_0x96bc('0x64')](_0x24ff5d[_0x96bc('0x5f')],_0x2db083);loggerPredictive[_0x96bc('0x64')](_0x54637e['stack']);clearPredictiveAttributes(_0x24ff5d);};}function loggerCatch(_0x578525){return function(_0x577e7c){logger[_0x96bc('0x64')](_0x578525,util[_0x96bc('0x43')](_0x577e7c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x20529b){return function(_0xda6f41){if(isNotNull(_0xda6f41)&&isNotNull(_0xda6f41[0x0])){if(_0xda6f41[0x0][_0x96bc('0x65')]>0x0){_0x20529b['message']=utils[_0x96bc('0x66')][_0x96bc('0x67')];logger[_0x96bc('0x48')](_0x96bc('0x68')+_0x20529b[_0x96bc('0x5f')],_0xda6f41[0x0][_0x96bc('0x65')],_0x96bc('0x69'));}else{_0x20529b[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x6b')];logger[_0x96bc('0x48')](_0x96bc('0x6c')+_0x20529b[_0x96bc('0x5f')]);}}};}function createObjHistory(_0x10205c,_0x4dcd13,_0x307360,_0x58c4b3,_0x36ae1f){_0x10205c[_0x96bc('0x6a')]=_0x307360;var _0x25414a=new Action(_0x10205c,_0x4dcd13);var _0xe51053=new History(_0x25414a);_0xe51053['state']=_0x58c4b3;_0xe51053[_0x96bc('0x6d')]=_0x36ae1f;_0xe51053[_0x96bc('0x6e')]=_0x25414a[_0x96bc('0x6f')];return _0xe51053;}function unlockQueueStatus(_0x8ab052,_0x4af223){setTimeout(function(){if(_['isUndefined'](_0x8ab052[_0x96bc('0x70')])){loggerBooked[_0x96bc('0x64')](_0x96bc('0x71'),_0x4af223);}_0x8ab052[_0x96bc('0x70')]=!![];loggerBooked[_0x96bc('0x48')](_0x96bc('0x72'),_0x4af223,JSON[_0x96bc('0x73')](_[_0x96bc('0x74')](_0x8ab052,[_0x96bc('0x5f'),_0x96bc('0x70')])));},0x1f3);}function checkInterval(_0x5d5856){return function(){if(!isNotNull(_0x5d5856[_0x96bc('0x75')])){_0x5d5856[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x76')];throw _0x5d5856[_0x96bc('0x5f')]+_0x96bc('0x77');}if(!isNotNull(_0x5d5856[_0x96bc('0x75')][_0x96bc('0x78')])){_0x5d5856[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x76')];throw _0x5d5856[_0x96bc('0x5f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x5d5856[_0x96bc('0x75')][_0x96bc('0x78')]))){_0x5d5856[_0x96bc('0x6a')]=utils[_0x96bc('0x66')]['NULL_INTERVAL'];throw _0x5d5856[_0x96bc('0x5f')]+_0x96bc('0x77');}};}function checkIsIVRCampaignActive(_0x4123b8){return function(){if(!utils[_0x96bc('0x79')](_0x4123b8)){_0x4123b8[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x7a')];throw _0x4123b8[_0x96bc('0x5f')]+_0x96bc('0x7b');}};}function emitCampaignSummary(_0x4e6ca1){if(utils[_0x96bc('0x7c')](_0x4e6ca1)){emit(util[_0x96bc('0x44')](_0x96bc('0x7d'),_0x4e6ca1[_0x96bc('0x5f')]),_0x96bc('0x7e'),_0x4e6ca1);}}function loggerCatchQueueSummary(_0x122a86,_0x5a085a){return function(_0x4906f0){clearPredictiveAttributes(_0x5a085a);emitCampaignSummary(_0x5a085a);loggerSyncQueueSummary[_0x96bc('0x41')](_0x122a86,util[_0x96bc('0x43')](_0x4906f0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x238f12){if(_0x238f12[_0x96bc('0x7f')]){if(_0x238f12['originated']===0x0){_0x238f12[_0x96bc('0x7f')]=![];_0x238f12['message']=utils[_0x96bc('0x66')][_0x96bc('0x7a')];loggerSyncQueueSummary[_0x96bc('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x238f12['name'],_0x96bc('0x80'));}else{_0x238f12[_0x96bc('0x6a')]=utils[_0x96bc('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x96bc('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x238f12[_0x96bc('0x5f')],_0x96bc('0x81'));}emitCampaignSummary(_0x238f12);}}function myreject(_0x2fe3e6){return function(_0x401a4e){return _0x2fe3e6(msgResponse(_0x96bc('0x82'),_0x96bc('0x83'),JSON['stringify'](_0x401a4e)));};}Dialer[_0x96bc('0x1b')][_0x96bc('0x84')]=function(_0x567dac){return!_[_0x96bc('0x3d')](_0x567dac)&&_0x567dac&&!_[_0x96bc('0x3d')](_0x567dac[_0x96bc('0x5f')])&&!_[_0x96bc('0x3d')](_0x567dac[_0x96bc('0x85')])&&_0x567dac['active']&&(this[_0x96bc('0x22')][util[_0x96bc('0x44')](_0x96bc('0x86'),_0x567dac[_0x96bc('0x5f')])][_0x96bc('0x87')]===_0x96bc('0x88')||this[_0x96bc('0x22')][util[_0x96bc('0x44')](_0x96bc('0x86'),_0x567dac[_0x96bc('0x5f')])][_0x96bc('0x87')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x1cad87){var _0x149891=this;return function(){if(!_0x149891[_0x96bc('0x84')](_0x1cad87['Trunk'])){if(!_0x149891[_0x96bc('0x84')](_0x1cad87[_0x96bc('0x89')])){_0x1cad87[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x8a')];throw _0x1cad87[_0x96bc('0x5f')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8b')]=function(_0x5a7e4a,_0x556e28,_0xd53e5e,_0x4936e9){var _0x485141=this;return function(){var _0x3a5f1d=!![];return _0x485141[_0x96bc('0x8c')](_0x5a7e4a,_0x556e28,_0xd53e5e,_0x4936e9,_0x3a5f1d);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8d')]=function(_0x13157c,_0x59606b,_0x3d866f,_0xab0cc8){var _0x146ded=this;return function(){var _0x3a250d=![];return _0x146ded[_0x96bc('0x8c')](_0x13157c[_0x96bc('0x78')],_0x59606b,_0x3d866f,_0xab0cc8,_0x3a250d);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x8c')]=function(_0x58a3bc,_0x16ca1b,_0x539e89,_0x5098b8,_0x38f400){var _0x6bbd2f=[];return new Promise(function(_0x13c592,_0x377328){if(!isNotNull(_0x58a3bc)){_0x5098b8[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x76')];return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),_0x539e89+_0x96bc('0x90')));}if(_['isEmpty'](_0x58a3bc)){_0x5098b8[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x91')];return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),_0x539e89+_0x96bc('0x92')));}if(_0x16ca1b&&_['isUndefined'](config[_0x96bc('0x93')][_0x16ca1b])){_0x5098b8[_0x96bc('0x6a')]=utils['CAMPAIGN_STATUS'][_0x96bc('0x94')];return _0x377328(msgResponse(_0x96bc('0x8e'),'Failure',_0x539e89+_0x96bc('0x95')+_0x16ca1b));}if(_[_0x96bc('0x96')](_0x58a3bc)){for(var _0x4de6f2=0x0;_0x4de6f2<_0x58a3bc[_0x96bc('0x97')];_0x4de6f2+=0x1){_0x6bbd2f[_0x96bc('0x98')](ami['Action']({'action':_0x96bc('0x99'),'command':util['format']('iftime\x20%s,%s',_0x58a3bc[_0x4de6f2]['interval'],!_[_0x96bc('0x3d')](config[_0x96bc('0x93')][_0x16ca1b])?_0x16ca1b:'')})[_0x96bc('0x3b')](function(_0x4208c9){return _0x4208c9[_0x96bc('0x9a')]['indexOf'](_0x96bc('0x9b'))>=0x0;})['catch'](myreject(_0x377328)));}}else{_0x6bbd2f[_0x96bc('0x98')](ami[_0x96bc('0x9c')]({'action':'command','command':util[_0x96bc('0x44')](_0x96bc('0x9d'),_0x58a3bc,!_[_0x96bc('0x3d')](config[_0x96bc('0x93')][_0x16ca1b])?_0x16ca1b:'')})[_0x96bc('0x3b')](function(_0x5aeb8d){return _0x5aeb8d['content'][_0x96bc('0x9e')](_0x96bc('0x9b'))>=0x0;})[_0x96bc('0x9f')](myreject(_0x377328)));}Promise[_0x96bc('0xa0')](_0x6bbd2f)[_0x96bc('0x3b')](function(_0x4d3ab8){var _0x20449f=_[_0x96bc('0xa1')](_0x4d3ab8);if(_0x20449f){return _0x13c592(_0x20449f);}else{_0x5098b8[_0x96bc('0x6a')]=_0x38f400?utils[_0x96bc('0x66')][_0x96bc('0xa2')]:utils[_0x96bc('0x66')][_0x96bc('0xa3')];return _0x377328(msgResponse(_0x96bc('0xa4'),'Failure',_0x96bc('0xa5')+_0x38f400+'\x20'+_0x539e89+'\x20Interval\x20is\x20overtime:\x20'+util[_0x96bc('0x43')](_0x58a3bc,{'showHidden':![],'depth':null})+_0x96bc('0xa6')+_0x16ca1b));}})[_0x96bc('0x9f')](function(_0x569080){return _0x377328(msgResponse(_0x96bc('0x8e'),_0x96bc('0x8f'),JSON['stringify'](_0x569080)));});});};Dialer['prototype'][_0x96bc('0x39')]=function(){var _0x2d419f=this;return cmHopper[_0x96bc('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0x96bc('0x3b')](function(){setInterval(function(){_0x2d419f[_0x96bc('0xa8')]();},0x3e8);});};Dialer[_0x96bc('0x1b')][_0x96bc('0xa8')]=function(){var _0x510d09=this;var _0x284c44;for(var _0xaa38e1 in this[_0x96bc('0x20')]){if(typeof this['campaigns'][_0xaa38e1]!==_0x96bc('0xa9')){_0x284c44=this[_0x96bc('0x20')][_0xaa38e1];if(utils[_0x96bc('0x7c')](_0x284c44)&&utils[_0x96bc('0x79')](_0x284c44)){_0x284c44[_0x96bc('0x7f')]=!![];Promise[_0x96bc('0xaa')]()['then'](checkIsIVRCampaignActive(_0x284c44))[_0x96bc('0x3b')](checkInterval(_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0xab')](_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0x8b')](_0x284c44['dialGlobalInterval'],_0x284c44[_0x96bc('0xac')],_0x284c44[_0x96bc('0x5f')],_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0x8d')](_0x284c44[_0x96bc('0x75')],_0x284c44['dialTimezone'],_0x284c44[_0x96bc('0x5f')],_0x284c44))[_0x96bc('0x3b')](_0x510d09[_0x96bc('0xad')](_0x284c44))[_0x96bc('0x9f')](loggerCatchQueueSummary('[syncCampaigns]',_0x284c44));}else{notSendMessagesCampaign(_0x284c44);}}}};Dialer[_0x96bc('0x1b')][_0x96bc('0xae')]=function(_0x30f79e){if(_0x30f79e[_0x96bc('0xaf')]!==_0x96bc('0xa')){clearPredictiveAttributes(_0x30f79e);}switch(_0x30f79e[_0x96bc('0xaf')]){case _0x96bc('0xb0'):this[_0x96bc('0xb1')](_0x30f79e,0x1);break;case _0x96bc('0xb2'):this[_0x96bc('0xb1')](_0x30f79e,_0x30f79e[_0x96bc('0xb3')]);break;case _0x96bc('0xa'):this['predictive'](_0x30f79e);break;case _0x96bc('0x9'):this['handlePower'](_0x30f79e,0x1);break;default:logger[_0x96bc('0x64')](_0x96bc('0xb4'),_0x30f79e[_0x96bc('0x5f')],_0x96bc('0xb5'));}};Dialer[_0x96bc('0x1b')]['ifTime']=function(_0x12368b,_0x2cd8ca){var _0x14c7f2=_0x12368b[_0x96bc('0xac')];var _0xd3d592=_0x2cd8ca?_0x12368b[_0x96bc('0xb6')]:_0x12368b[_0x96bc('0x75')][_0x96bc('0x78')];logger[_0x96bc('0xb7')](_0x96bc('0xb8'),_0xd3d592,_0x14c7f2,_0x12368b[_0x96bc('0x5f')],util[_0x96bc('0x44')]('Voice\x20Queue\x20%s\x20$s',_0x12368b[_0x96bc('0x5f')],_0x12368b['id']));var _0x13fd4b=null;return Interval['intervalIftime'](_0xd3d592,_0x14c7f2)[_0x96bc('0x3b')](function(_0x14a0c1){if(_0x14a0c1===!![]){return _0x14a0c1;}else{_0x12368b[_0x96bc('0x6a')]=_0x2cd8ca?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x96bc('0x66')][_0x96bc('0xa3')];_0x13fd4b=msgResponse(_0x96bc('0xa4'),_0x96bc('0x8f'),'Global:\x20'+_0x2cd8ca+'\x20'+_0x12368b[_0x96bc('0x5f')]+_0x96bc('0xb9')+util[_0x96bc('0x43')](_0xd3d592,{'showHidden':![],'depth':null})+_0x96bc('0xa6')+_0x14c7f2);}if(_0x13fd4b!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x13fd4b);_0x13fd4b['isGlobal']=_0x2cd8ca;throw _0x13fd4b;}})[_0x96bc('0x9f')](function(_0x2951b2){logger[_0x96bc('0x64')]('AMI\x20IfTime',_0x2951b2);throw msgResponse(_0x96bc('0x82'),'Error',util[_0x96bc('0x43')](_0x2951b2,{'showHidden':![],'depth':null}));});};Dialer[_0x96bc('0x1b')][_0x96bc('0x2b')]=function(_0x34921d){if(this[_0x96bc('0x1f')][_0x34921d[_0x96bc('0xba')]]){if(this[_0x96bc('0xbb')][_0x34921d['uniqueid']]&&this['uniqueId'][_0x34921d[_0x96bc('0xbc')]]['type']!==_0x96bc('0xbd')){utils[_0x96bc('0xbe')](this[_0x96bc('0x1f')][_0x34921d[_0x96bc('0xba')]],_0x96bc('0xbf'));this['uniqueId'][_0x34921d[_0x96bc('0xbc')]]['answertime']=moment()['format'](_0x96bc('0xc0'));}}};Dialer['prototype'][_0x96bc('0xc1')]=function(_0x3326fe){var _0x4aad27=this[_0x96bc('0xbb')][_0x3326fe['uniqueid']];if(this[_0x96bc('0x1f')][_0x3326fe[_0x96bc('0xba')]]){if(_0x4aad27&&_0x4aad27[_0x96bc('0x3f')]!=='ivr'){delete this[_0x96bc('0xbb')][_0x3326fe[_0x96bc('0xbc')]];this['voiceQueues'][_0x3326fe[_0x96bc('0xba')]][_0x96bc('0xc2')]+=0x1;var _0x453c68=new AgentComplete(_0x4aad27,_0x3326fe);if(_0x3326fe[_0x96bc('0xc3')]===_0x96bc('0xc4')){_0x453c68[_0x96bc('0xc5')]=this[_0x96bc('0x1f')][_0x3326fe[_0x96bc('0xba')]][_0x96bc('0xc6')]&&this[_0x96bc('0x1f')][_0x3326fe['queue']][_0x96bc('0xc7')]?moment()[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x96bc('0xc8')](_0x453c68)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));hopperUtils[_0x96bc('0xca')](_0x453c68)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xcb')));}}};Dialer[_0x96bc('0x1b')][_0x96bc('0x2e')]=function(_0x2ee9da){var _0xc12bd4=this[_0x96bc('0xbb')][_0x2ee9da[_0x96bc('0xbc')]];var _0x387297=this;var _0x5e24f4=![];var _0xc69518;var _0xb5a7c3;if(this[_0x96bc('0x1f')][_0x2ee9da['queue']]){if(_0xc12bd4&&_0xc12bd4[_0x96bc('0x3f')]!==_0x96bc('0xbd')){delete this['uniqueId'][_0x2ee9da[_0x96bc('0xbc')]];utils[_0x96bc('0xbe')](this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]],'[syncQueueCallerAbandon]');_0xc12bd4[_0x96bc('0xcc')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));var _0x4cd11e=new QueueCallerAbandon(_0xc12bd4,_0x2ee9da);if(utils['getSeconds'](_0xc12bd4['droptime'],_0xc12bd4['responsetime'])>=_0xc12bd4[_0x96bc('0xcd')]){this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0x4d')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0xce')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xcf')]+=0x1;_0x4cd11e[_0x96bc('0xd0')]=0xa;_0x4cd11e[_0x96bc('0x6d')]='Drop';_0x4cd11e['dropreason']='TIMEOUT';_0x4cd11e['agiafterat']=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xc6')]?moment()[_0x96bc('0x44')](_0x96bc('0xc0')):undefined;_0x4cd11e[_0x96bc('0xd1')]+=0x1;_0x4cd11e[_0x96bc('0xd2')]+=0x1;_0xc69518=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd3')];_0xb5a7c3=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x96bc('0xd4')](_0x4cd11e,_0x4cd11e[_0x96bc('0xd0')],_0xc12bd4[_0x96bc('0xd5')])[_0x96bc('0x3b')](function(_0x1e1d0c){_0x5e24f4=_0x1e1d0c[_0x96bc('0xd6')]==0x1;if(_0x4cd11e[_0x96bc('0xd1')]>=_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd7')]){_0x387297[_0x96bc('0xd8')](_0x4cd11e,_0x1e1d0c['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4cd11e[_0x96bc('0xd1')],'scheduledat':moment()[_0x96bc('0xd9')](_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xd3')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0xc12bd4['ContactId'],'ListId':_0xc12bd4['ListId'],'VoiceQueueId':_0xc12bd4['VoiceQueueId']||undefined,'CampaignId':_0xc12bd4[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch('[rescheduleContact][Drop]'));var _0x4d0b80=new History(_0x4cd11e);_0x4d0b80['state']=0xa;_0x4d0b80[_0x96bc('0x6d')]=_0x96bc('0xdc');_0x4d0b80[_0x96bc('0x6f')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));_0x4d0b80[_0x96bc('0x6e')]=_0x4d0b80[_0x96bc('0x6f')];_0x4d0b80[_0x96bc('0xdd')]=_0x4cd11e[_0x96bc('0xdd')];_0x4d0b80[_0x96bc('0xde')]=_0x4cd11e[_0x96bc('0xde')];hopperUtils[_0x96bc('0xc8')](_0x4d0b80)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x96bc('0x3b')](function(){if(_0x5e24f4)hopperUtils[_0x96bc('0xdf')](_0x4cd11e,_0xc69518,_0xb5a7c3)[_0x96bc('0x3b')](function(){return 0x1;});});}else{this[_0x96bc('0x1f')][_0x2ee9da['queue']][_0x96bc('0x4f')]+=0x1;this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe0')]+=0x1;_0x4cd11e[_0x96bc('0xd0')]=0xb;_0x4cd11e[_0x96bc('0x6d')]=_0x96bc('0xe1');_0x4cd11e[_0x96bc('0xe2')]=_0x96bc('0xe3');_0x4cd11e[_0x96bc('0xe4')]+=0x1;_0x4cd11e['countglobal']+=0x1;_0xc69518=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe5')];_0xb5a7c3=this[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe6')];hopperUtils[_0x96bc('0xd4')](_0x4cd11e,_0x4cd11e[_0x96bc('0xd0')],_0xc12bd4[_0x96bc('0xd5')])['then'](function(_0x1cf4a6){if(_0x4cd11e[_0x96bc('0xe4')]>=_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]][_0x96bc('0xe7')]){_0x387297[_0x96bc('0xd8')](_0x4cd11e,_0x1cf4a6[_0x96bc('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4cd11e[_0x96bc('0xe4')],'scheduledat':moment()[_0x96bc('0xd9')](_0x387297[_0x96bc('0x1f')][_0x2ee9da[_0x96bc('0xba')]]['dialAbandonedRetryFrequency'],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0xc12bd4[_0x96bc('0xe8')],'ListId':_0xc12bd4[_0x96bc('0xe9')],'VoiceQueueId':_0xc12bd4[_0x96bc('0xea')]||undefined,'CampaignId':_0xc12bd4[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xeb')));var _0x4c06ab=new History(_0x4cd11e);_0x4c06ab['state']=0xb;_0x4c06ab[_0x96bc('0x6d')]='Abandoned';_0x4c06ab[_0x96bc('0x6f')]=moment()['format'](_0x96bc('0xc0'));_0x4c06ab[_0x96bc('0x6e')]=_0x4c06ab['starttime'];_0x4c06ab[_0x96bc('0xdd')]=_0x4cd11e['calleridname'];_0x4c06ab[_0x96bc('0xde')]=_0x4cd11e[_0x96bc('0xde')];hopperUtils[_0x96bc('0xc8')](_0x4c06ab)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x96bc('0x3b')](function(){if(_0x5e24f4)hopperUtils['swapAdditionalPhones'](_0x4cd11e,_0xc69518,_0xb5a7c3)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x96bc('0x35')]=function(_0x336f58){if(this['actions'][_0x336f58[_0x96bc('0xbc')]]){this[_0x96bc('0xec')][_0x336f58[_0x96bc('0xbc')]][_0x96bc('0xed')]=_0x336f58[_0x96bc('0xed')];}if(this[_0x96bc('0xbb')][_0x336f58['uniqueid']]){this[_0x96bc('0xbb')][_0x336f58[_0x96bc('0xbc')]][_0x96bc('0xed')]=_0x336f58[_0x96bc('0xed')];}};Dialer[_0x96bc('0x1b')][_0x96bc('0xee')]=function(_0x3997f0){if(!this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]){return;}var _0x37f1aa=this[_0x96bc('0x1f')][this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]][_0x96bc('0xf0')]||_0x96bc('0xf1');if(_0x37f1aa===_0x96bc('0xf2')){if(this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]&&_['isNil'](this[_0x96bc('0xec')][_0x3997f0['actionid']][_0x96bc('0xf3')])&&_0x3997f0['status']==='1'&&_0x3997f0[_0x96bc('0xf4')]==='0'){if(this[_0x96bc('0x21')][_0x3997f0[_0x96bc('0xf5')]]){if(!this[_0x96bc('0x21')][_0x3997f0['stateinterface']][_0x96bc('0xf3')]){this[_0x96bc('0x21')][_0x3997f0[_0x96bc('0xf5')]]['locked']=!![];this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf3')]=!![];this['actions'][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf5')]=_0x3997f0[_0x96bc('0xf5')];}}}}else if(_0x37f1aa===_0x96bc('0xf1')){if(this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]]){if(this['agents'][_0x3997f0[_0x96bc('0xf5')]]){this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xf5')]=_0x3997f0['stateinterface'];if(_[_0x96bc('0xf6')](this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x3997f0['actionid']][_0x96bc('0xba')]])){this['queueBooked'][this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]]=[];}this[_0x96bc('0xf7')][this['actions'][_0x3997f0[_0x96bc('0xef')]][_0x96bc('0xba')]][_0x96bc('0x98')](_[_0x96bc('0x5e')](_[_0x96bc('0x74')](this[_0x96bc('0xec')][_0x3997f0[_0x96bc('0xef')]],[_0x96bc('0xf8'),_0x96bc('0xf5')]),{'status':_0x3997f0[_0x96bc('0x87')],'paused':_0x3997f0['paused']}));}}}};Dialer[_0x96bc('0x1b')][_0x96bc('0x38')]=function(_0x5ed70e){if(!this['actions'][_0x5ed70e['actionid']]){return;}var _0x46e78d=this;var _0x3cb487=this['voiceQueues'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['queue']];var _0x592004=_0x3cb487['strategy']||_0x96bc('0xf1');if(_0x592004===_0x96bc('0xf2')){if(this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]&&this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xf5')]){this[_0x96bc('0x1e')][_0x96bc('0xf9')](this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xf8')],this['actions'][_0x5ed70e[_0x96bc('0xef')]]['stateinterface'])['catch'](function(_0x1e89a6){logger[_0x96bc('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x96bc('0x43')](_0x1e89a6,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x96bc('0xbe')](_0x46e78d[_0x96bc('0x1f')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]],_0x96bc('0xfa'));_0x46e78d[_0x96bc('0x21')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['stateinterface']][_0x96bc('0xf3')]=![];delete _0x46e78d[_0x96bc('0xec')][_0x5ed70e['actionid']];unlockQueueStatus(_0x3cb487);});}else{utils[_0x96bc('0xbe')](this['voiceQueues'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]],_0x96bc('0xfa'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xe8')],'ListId':this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]['ListId'],'VoiceQueueId':this['actions'][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xea')]||undefined,'CampaignId':this['actions'][_0x5ed70e[_0x96bc('0xef')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0xfb')));delete this['actions'][_0x5ed70e['actionid']];unlockQueueStatus(_0x3cb487);}}else if(_0x592004===_0x96bc('0xf1')){var _0x407e12;if(this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]]&&!_[_0x96bc('0x46')](this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]])){if(this[_0x96bc('0xfc')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]){this[_0x96bc('0xfc')][_0x46e78d[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]=this[_0x96bc('0xfc')][this['actions'][_0x5ed70e['actionid']][_0x96bc('0xba')]]?this[_0x96bc('0xfc')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]]:this['queueBooked'][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]?this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]]['_rr']||0x0:0x0;}this[_0x96bc('0xf7')][this[_0x96bc('0xec')][_0x5ed70e['actionid']][_0x96bc('0xba')]][_0x96bc('0xfd')]=this[_0x96bc('0xfc')][this[_0x96bc('0xec')][_0x5ed70e[_0x96bc('0xef')]][_0x96bc('0xba')]];for(var _0x2b6b4d=0x0;_0x2b6b4d=_0x3d6ab4[_0x96bc('0x124')]){_0x34d1a0[_0x96bc('0x125')](_0x312a48,_0x296df5,_0x5e4c5c,_0x96bc('0x126'));}else{if(_0x312a48[_0x96bc('0x120')]>=_0x3d6ab4[_0x96bc('0x127')]){_0x34d1a0[_0x96bc('0x128')](_0x312a48,_0x296df5,_0x5e4c5c,_0x96bc('0x129'));}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x312a48['countmachineretry'],'scheduledat':moment()[_0x96bc('0xd9')](_0x3d6ab4[_0x96bc('0x12a')],'minutes')[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x312a48[_0x96bc('0xe8')],'ListId':_0x312a48[_0x96bc('0xe9')],'VoiceQueueId':_0x312a48[_0x96bc('0xea')]||undefined,'CampaignId':_0x312a48[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x12b')));_0x296df5({'reschedule':0x1});}}});}if(_0x1142b8[_0x96bc('0x3f')]===_0x96bc('0xbd')&&this[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]][_0x96bc('0x11d')]&&_0xeed896[_0x96bc('0x113')]==='HANGUP'){delete this[_0x96bc('0xbb')][_0xeed896['uniqueid']];utils[_0x96bc('0xbe')](this['campaigns'][_0x1142b8[_0x96bc('0xba')]],'[syncVarSet]');_0x2c2bd6=new Hangup(_0x1142b8,_0xeed896);_0x2c2bd6[_0x96bc('0xd0')]=0x12;_0x2c2bd6[_0x96bc('0x6d')]=_0x96bc('0x115');_0x2c2bd6[_0x96bc('0x116')]='AMD';ami[_0x96bc('0x3e')](_0x96bc('0x118'),ut['buildObj'](_0x2c2bd6,'amd'));this[_0x96bc('0x11a')](_0x2c2bd6,_0x96bc('0x12c'),_0x96bc('0x12d'));}if(_0x1142b8[_0x96bc('0x3f')]==='ivr'&&this[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]][_0x96bc('0x11d')]&&_0xeed896[_0x96bc('0x113')]===_0x96bc('0x11e')){return new Promise(function(_0x326fa7,_0x521211){delete _0x34d1a0[_0x96bc('0xbb')][_0xeed896[_0x96bc('0xbc')]];utils['decrementOriginate'](_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]],'[syncVarSet]');_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x496783=_0x34d1a0[_0x96bc('0x20')][_0x1142b8[_0x96bc('0xba')]];var _0x3837b9=new Hangup(_0x1142b8,_0xeed896);_0x3837b9[_0x96bc('0xd0')]=0x13;_0x3837b9[_0x96bc('0x6d')]=_0x96bc('0x11f');_0x3837b9[_0x96bc('0x116')]=_0x96bc('0x117');_0x3837b9[_0x96bc('0x120')]+=0x1;_0x3837b9['countglobal']+=0x1;_0x3837b9[_0x96bc('0x119')]=!![];ami[_0x96bc('0x3e')](_0x96bc('0x118'),ut[_0x96bc('0x12e')](_0x3837b9,_0x96bc('0x119')));hopperUtils[_0x96bc('0xc8')](_0x3837b9)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3837b9[_0x96bc('0x122')]+_0x3837b9[_0x96bc('0x12f')]+_0x3837b9[_0x96bc('0x123')]+_0x3837b9['countnosuchnumberretry']+_0x3837b9[_0x96bc('0xd1')]+_0x3837b9[_0x96bc('0xe4')]+_0x3837b9[_0x96bc('0x120')]+_0x3837b9[_0x96bc('0x130')]>=_0x496783['dialGlobalMaxRetry']){_0x34d1a0[_0x96bc('0x125')](_0x3837b9,_0x326fa7,_0x521211,'reason19\x20machine....');}else{if(_0x3837b9[_0x96bc('0x120')]>=_0x496783['dialMachineMaxRetry']){_0x34d1a0['createStateFinal'](_0x3837b9,_0x326fa7,_0x521211,_0x96bc('0x129'));}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x3837b9[_0x96bc('0x120')],'scheduledat':moment()[_0x96bc('0xd9')](_0x496783['dialMachineRetryFrequency'],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x3837b9[_0x96bc('0xe8')],'ListId':_0x3837b9[_0x96bc('0xe9')],'VoiceQueueId':_0x3837b9['VoiceQueueId']||undefined,'CampaignId':_0x3837b9[_0x96bc('0xdb')]||undefined})['catch'](loggerCatch(_0x96bc('0x12b')));_0x326fa7({'reschedule':0x1});}}});}}};Dialer[_0x96bc('0x1b')]['syncHangup']=function(_0x39d151){var _0x807451=this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];var _0x383498;if(!_0x807451){return;}if(_0x807451[_0x96bc('0x3f')]===_0x96bc('0xbd')){delete this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];utils[_0x96bc('0xbe')](this['campaigns'][_0x807451[_0x96bc('0xba')]],_0x96bc('0x131'));this[_0x96bc('0x20')][_0x807451['queue']][_0x96bc('0x132')]+=0x1;if(_0x39d151[_0x96bc('0x133')]===_0x96bc('0x134')){const _0xfa3caa=new AgentComplete(_0x807451,_0x39d151);_0xfa3caa[_0x96bc('0xdb')]=this[_0x96bc('0x20')][_0x807451[_0x96bc('0xba')]]['id'];hopperUtils[_0x96bc('0xc8')](_0xfa3caa)['catch'](loggerCatch(_0x96bc('0x135')));hopperUtils[_0x96bc('0xca')](_0xfa3caa)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x136')));}else{_0x383498=new Hangup(_0x807451,_0x39d151);hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x137')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x138')));}}else{if(isNotNull(this[_0x96bc('0x1f')][_0x807451['queue']][_0x96bc('0x139')])){delete this[_0x96bc('0xbb')][_0x39d151['uniqueid']];utils['decrementOriginate'](this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]],'[syncHangup]');this[_0x96bc('0x1f')][_0x807451['queue']][_0x96bc('0xc2')]+=0x1;this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]][_0x96bc('0x13a')]+=0x1;_0x383498=new Hangup(_0x807451,_0x39d151);_0x383498[_0x96bc('0xd0')]=0x10;_0x383498[_0x96bc('0x6d')]=_0x96bc('0x13b');_0x383498['membername']=_0x96bc('0x13c');hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x137')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x138')));}else{delete this[_0x96bc('0xbb')][_0x39d151[_0x96bc('0xbc')]];utils['decrementOriginate'](this['voiceQueues'][_0x807451[_0x96bc('0xba')]],_0x96bc('0x13d'));if(_0x39d151['cause-txt']===_0x96bc('0x134')){this[_0x96bc('0x1f')][_0x807451['queue']]['outboundAnswerCallsDay']+=0x1;const _0x16a747=new AgentComplete(_0x807451,_0x39d151);_0x16a747[_0x96bc('0xea')]=this[_0x96bc('0x1f')][_0x807451['queue']]['id'];hopperUtils[_0x96bc('0xc8')](_0x16a747)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));hopperUtils['moveContactManagedDialer'](_0x16a747)['catch'](loggerCatch(_0x96bc('0xcb')));}else{this[_0x96bc('0x1f')][_0x807451[_0x96bc('0xba')]][_0x96bc('0x13e')]+=0x1;_0x383498=new Hangup(_0x807451,_0x39d151);_0x383498[_0x96bc('0xd0')]=0xc;_0x383498[_0x96bc('0x6d')]=_0x39d151['cause-txt'];_0x383498[_0x96bc('0x116')]=_0x96bc('0x13f');hopperUtils['createHistory'](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x140')));hopperUtils[_0x96bc('0xca')](_0x383498)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x131')));}}}};Dialer['prototype'][_0x96bc('0xb')]=function(_0x2dccb8){var _0x5a82a6=this;if(!_0x5a82a6[_0x96bc('0x29')][_0x2dccb8['name']]){_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]]={'running':![]};}else if(_0x5a82a6['queuesSummary'][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]===!![]){return;}else if(_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]===![]){_0x5a82a6[_0x96bc('0x29')][_0x2dccb8[_0x96bc('0x5f')]][_0x96bc('0x141')]=!![];}var _0x5d3b8a=_0x5a82a6[_0x96bc('0x1f')][_0x2dccb8[_0x96bc('0x5f')]];var _0x354bcf=_0x5d3b8a[_0x96bc('0x6a')]!==utils['CAMPAIGN_STATUS'][_0x96bc('0x7a')];var _0x2fc91b=utils['isPreviewCampaign'](_0x5d3b8a);_0x5d3b8a[_0x96bc('0x142')]=utils['getQueueCampaignStatusMessage'](_0x5d3b8a,_0x5a82a6[_0x96bc('0x22')]);Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](function(){if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')][_0x96bc('0x7a')]){if(_0x354bcf){clearPredictiveAttributes(_0x5d3b8a);_0x2dccb8[_0x96bc('0x27')]=undefined;_0x2dccb8[_0x96bc('0x28')]=undefined;}if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')]['INACTIVE']){_0x2dccb8['available']=0x0;_0x2dccb8['paused']=0x0;_0x2dccb8[_0x96bc('0x143')]=0x0;_0x2dccb8[_0x96bc('0x144')]=0x0;_0x2dccb8[_0x96bc('0x145')]=0x0;}}else if(_0x5d3b8a[_0x96bc('0x142')]===utils[_0x96bc('0x66')][_0x96bc('0x146')]&&!_0x2fc91b){return _0x5a82a6[_0x96bc('0x8e')](_0x5d3b8a,!![])[_0x96bc('0x3b')](function(){return _0x5a82a6['ifTime'](_0x5d3b8a,![]);})[_0x96bc('0x3b')](function(){return _0x5a82a6[_0x96bc('0xae')](_0x5d3b8a);})['catch'](function(_0x379c9e){loggerSyncQueueSummary['debug'](_0x96bc('0x147'),util[_0x96bc('0x43')](_0x379c9e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5d3b8a);});}else{clearPredictiveAttributes(_0x5d3b8a);}})[_0x96bc('0x3b')](function(){var _0x183997=_0x2dccb8[_0x96bc('0x148')](_0x5d3b8a);if(_0x183997||_0x5d3b8a[_0x96bc('0x149')]){_0x5d3b8a['queueSummaryCountersUpdated']=![];_0x2dccb8[_0x96bc('0x14a')](_0x5d3b8a);Object[_0x96bc('0x14b')](_0x5d3b8a,_0x2dccb8);emitOutboundVoiceQueueSummary(_0x2dccb8);}_0x5a82a6[_0x96bc('0x29')][_0x5d3b8a[_0x96bc('0x5f')]][_0x96bc('0x141')]=![];})[_0x96bc('0x9f')](function(_0x2bb3d9){logger[_0x96bc('0x64')](_0x96bc('0x147'),util['inspect'](_0x2bb3d9,{'showHidden':![],'depth':null}));_0x5a82a6['queuesSummary'][_0x5d3b8a[_0x96bc('0x5f')]][_0x96bc('0x141')]=![];});};Dialer[_0x96bc('0x1b')][_0x96bc('0x32')]=_[_0x96bc('0x14c')](function(){var _0x3f8add=_['filter'](this[_0x96bc('0x1f')],function(_0x4df443){return _0x4df443['dialPreviewRecallmeReminder'];});var _0x436d01=_['filter'](this[_0x96bc('0x21')],function(_0x2a877d){return _0x2a877d[_0x96bc('0x14d')]&&_0x2a877d[_0x96bc('0x87')]===_0x96bc('0x88');});if(_0x3f8add[_0x96bc('0x97')]>0x0&&_0x436d01[_0x96bc('0x97')]>0x0){return Promise['resolve']()[_0x96bc('0x3b')](cmHopper[_0x96bc('0x14e')](_[_0x96bc('0x14f')](_0x3f8add,'id'),previewRecallmeReminderInterval,_[_0x96bc('0x14f')](_0x436d01,'id')))[_0x96bc('0x3b')](function(_0x2a77fb){for(var _0xcc6511=0x0;_0xcc6511<_0x2a77fb['length'];_0xcc6511++){var _0x2f805b=_0x2a77fb[_0xcc6511]['Agent'][_0x96bc('0x5f')];if(_0x2f805b)io['to'](util[_0x96bc('0x44')](_0x96bc('0x150'),_0x2f805b))[_0x96bc('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x2a77fb[_0xcc6511]});}})[_0x96bc('0x9f')](function(_0x4008db){logger[_0x96bc('0x64')]('checkPreviewRecallReminder',_0x4008db);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x96bc('0x151')]=function(){var _0x17bb6a=this;setInterval(function(){_0x17bb6a[_0x96bc('0x152')](_0x17bb6a[_0x96bc('0xbb')],_0x96bc('0x153'));_0x17bb6a[_0x96bc('0x152')](_0x17bb6a[_0x96bc('0xec')],_0x96bc('0x154'));},0x32c8);};Dialer[_0x96bc('0x1b')][_0x96bc('0x152')]=function(_0xabd083,_0x36102c){var _0x46cadf=this;for(var _0x2120ad in _0xabd083){if(typeof _0xabd083[_0x2120ad]!==_0x96bc('0xa9')){this[_0x96bc('0x1d')][_0x96bc('0x155')](function(){if(!_[_0x96bc('0xf6')](_0xabd083[_0x2120ad])){return ami[_0x96bc('0x9c')]({'action':_0x96bc('0x87'),'channel':_0xabd083[_0x2120ad][_0x96bc('0xed')]})[_0x96bc('0x9f')](function(_0x303354){if(_0x303354[_0x96bc('0x6a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xabd083[_0x2120ad]&&_0xabd083[_0x2120ad][_0x96bc('0x3f')]!==_0x96bc('0xbd')){utils[_0x96bc('0xbe')](_0x46cadf['voiceQueues'][_0xabd083[_0x2120ad][_0x96bc('0xba')]],_0x96bc('0x156'));logger['error'](_0x96bc('0x157'),_0x36102c,_0x2120ad,_0xabd083[_0x2120ad][_0x96bc('0xba')]);delete _0xabd083[_0x2120ad];}if(_0xabd083[_0x2120ad]&&_0xabd083[_0x2120ad][_0x96bc('0x3f')]===_0x96bc('0xbd')){utils[_0x96bc('0xbe')](_0x46cadf[_0x96bc('0x20')][_0xabd083[_0x2120ad][_0x96bc('0xba')]],_0x96bc('0x156'));logger['error']('[Dialer][checkChannel][ivr]',_0x36102c,_0x2120ad,_0xabd083[_0x2120ad][_0x96bc('0xba')]);delete _0xabd083[_0x2120ad];}},0x2328);}});}});}}};Dialer['prototype'][_0x96bc('0x158')]=function(_0x31df34){return Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](voiceQueueRt[_0x96bc('0x158')](_0x31df34))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['emptyContact']=function(_0x95b78c,_0x14ba33,_0x4954fc){var _0x3bc09f={'state':0x19,'statedesc':_0x96bc('0x159')};utils[_0x96bc('0xbe')](_0x14ba33,_0x96bc('0x15a')+_0x95b78c);this['saveInDb'](_[_0x96bc('0x5e')](_0x3bc09f,_[_0x96bc('0x74')](_0x4954fc,[_0x96bc('0xe8'),'ListId',_0x96bc('0x15b'),_0x96bc('0xea'),_0x96bc('0xdb')])),_0x96bc('0x15c'),_0x96bc('0x15a'));logger[_0x96bc('0x64')](_0x95b78c);};Dialer['prototype'][_0x96bc('0x11a')]=function(_0x44ae35,_0x17bf9a,_0x48037b){hopperUtils[_0x96bc('0xc8')](_0x44ae35)[_0x96bc('0x9f')](loggerCatch(_0x17bf9a));hopperUtils[_0x96bc('0xca')](_0x44ae35)[_0x96bc('0x9f')](loggerCatch(_0x48037b));};Dialer[_0x96bc('0x1b')][_0x96bc('0xd8')]=function(_0x58efd3,_0x149b33){hopperUtils[_0x96bc('0xc8')](_0x58efd3)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xc9')));if(_0x149b33==0x0){hopperUtils[_0x96bc('0xca')](_0x58efd3)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x15d')));}};Dialer[_0x96bc('0x1b')]['checkPreviewRecallReminder']=function(_0x48580a){return Promise[_0x96bc('0xaa')]()[_0x96bc('0x3b')](cmHopper[_0x96bc('0x14e')](_0x48580a['id'],previewRecallmeReminderInterval))[_0x96bc('0x3b')](function(_0x1d9c39){for(var _0x4cf4f3=0x0;_0x4cf4f3<_0x1d9c39[_0x96bc('0x97')];_0x4cf4f3++){var _0x11e215=_0x1d9c39[_0x4cf4f3]['Agent'][_0x96bc('0x5f')];if(_0x11e215)io['to'](util[_0x96bc('0x44')]('user:%s',_0x11e215))[_0x96bc('0x3e')](_0x96bc('0x15e'),{'hopper':_0x1d9c39[_0x4cf4f3]});}})['catch'](function(){});};Dialer[_0x96bc('0x1b')][_0x96bc('0xad')]=function(_0x230f41){var _0x4e92c7=this;return function(){_0x4e92c7[_0x96bc('0x15f')](_0x230f41);};};Dialer[_0x96bc('0x1b')][_0x96bc('0x160')]=function(_0x3e785b,_0x5aa91b){var _0x231dcb=this;var _0x1491e4=uuid['v4']();this[_0x96bc('0xec')][_0x1491e4]=new Action(_0x3e785b,_0x5aa91b,_0x1491e4);return new Promise(function(_0x29d2bd,_0x1bc16f){if(_[_0x96bc('0x3d')](_0x3e785b)&&typeof _0x3e785b!=='object'){return _0x1bc16f(msgResponse(_0x96bc('0x161'),_0x96bc('0x8f'),_0x96bc('0x162')));}if(_[_0x96bc('0x3d')](_0x5aa91b['phone'])||_0x5aa91b[_0x96bc('0x163')]===null){return _0x1bc16f(msgResponse(_0x96bc('0x161'),'Failure','contact\x20is\x20undefine'));}var _0x139dab={'XMD-CALLERID':_0x231dcb[_0x96bc('0xec')][_0x1491e4]['getCaller'](),'XMD-AGI':_0x3e785b['dialQueueProject']?util[_0x96bc('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e785b['dialQueueProject']):_0x96bc('0x164'),'XMD-AGIAFTER':_0x3e785b[_0x96bc('0xc6')]?util[_0x96bc('0x44')](_0x96bc('0x165'),ipAgi,_0x3e785b[_0x96bc('0xc6')]):'NONE','XMD-QUEUE':utils[_0x96bc('0x166')](_0x3e785b)?util[_0x96bc('0x44')](_0x96bc('0x167'),_0x3e785b['name'],_0x3e785b['dialQueueOptions']||'',_0x3e785b['dialAgiAfterHangupAgent']?'c':'',_0x3e785b[_0x96bc('0xcd')]||0x3):_0x96bc('0x164'),'XMD-CONTACTID':_0x5aa91b[_0x96bc('0xe8')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x231dcb[_0x96bc('0xec')][_0x1491e4][_0x96bc('0x168')](),'XMD-AMD':_0x3e785b[_0x96bc('0x11d')]?_0x96bc('0x146'):_0x96bc('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3e785b[_0x96bc('0x11d')]){_0x139dab[_0x96bc('0x169')]=_0x3e785b['dialAMDInitialSilence']||0x9c4;_0x139dab[_0x96bc('0x16a')]=_0x3e785b[_0x96bc('0x16b')]||0x5dc;_0x139dab[_0x96bc('0x16c')]=_0x3e785b[_0x96bc('0x16d')]||0x320;_0x139dab[_0x96bc('0x16e')]=_0x3e785b['dialAMDTotalAnalysisTime']||0x1388;_0x139dab[_0x96bc('0x16f')]=_0x3e785b[_0x96bc('0x170')]||0x64;_0x139dab[_0x96bc('0x171')]=_0x3e785b[_0x96bc('0x172')]||0x32;_0x139dab[_0x96bc('0x173')]=_0x3e785b['dialAMDMaximumNumberOfWords']||0x3;_0x139dab['XMD-AMDSILENCETHRESHOLD']=_0x3e785b['dialAMDSilenceThreshold']||0x100;_0x139dab['XMD-AMDMAXIMUMWORDLENGTH']=_0x3e785b['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x96bc('0x166')](_0x3e785b)){_0x139dab['XMD-VOICEQUEUEID']=_0x5aa91b[_0x96bc('0xea')];}else{_0x139dab[_0x96bc('0x174')]=_0x5aa91b[_0x96bc('0xdb')];}var _0x55b36a=utils['setXMDContactVariables'](_0x5aa91b['Contact']);Object[_0x96bc('0x14b')](_0x139dab,_0x55b36a);var _0x45c0f2=_0x231dcb[_0x96bc('0x84')](_0x3e785b[_0x96bc('0x175')])?utils[_0x96bc('0x176')](_0x3e785b[_0x96bc('0x175')][_0x96bc('0x177')],_0x3e785b[_0x96bc('0x178')],_0x3e785b[_0x96bc('0x179')]>0x0?utils[_0x96bc('0x17a')](_0x3e785b[_0x96bc('0x17b')],_0x3e785b[_0x96bc('0x179')]):_0x3e785b[_0x96bc('0x17b')]):utils['getCallerId'](_[_0x96bc('0xf6')](_0x3e785b[_0x96bc('0x89')])?_0x3e785b[_0x96bc('0x175')][_0x96bc('0x177')]:_0x3e785b[_0x96bc('0x89')][_0x96bc('0x177')],_0x3e785b[_0x96bc('0x178')],_0x3e785b[_0x96bc('0x179')]>0x0?utils[_0x96bc('0x17a')](_0x3e785b[_0x96bc('0x17b')],_0x3e785b[_0x96bc('0x179')]):_0x3e785b[_0x96bc('0x17b')]);if(_0x45c0f2){_0x139dab[_0x96bc('0x17c')]=_0x231dcb[_0x96bc('0xec')][_0x1491e4][_0x96bc('0x17d')]=utils[_0x96bc('0x17e')](_0x45c0f2);_0x139dab[_0x96bc('0x17f')]=_0x5aa91b[_0x96bc('0x163')];}_0x3e785b['variables']=_0x139dab;return ami['Action']({'actionid':_0x1491e4,'action':_0x96bc('0x161'),'channel':_0x231dcb[_0x96bc('0x84')](_0x3e785b[_0x96bc('0x175')])?util['format'](_0x96bc('0x180'),_0x3e785b[_0x96bc('0x175')][_0x96bc('0x5f')],isNotNull(_0x3e785b['dialPrefix'])?_0x3e785b[_0x96bc('0x181')][_0x96bc('0x182')]()||'':'',_0x3e785b[_0x96bc('0x183')]>0x0?_0x5aa91b[_0x96bc('0x163')]['substring'](_0x3e785b[_0x96bc('0x183')]):_0x5aa91b[_0x96bc('0x163')]):util[_0x96bc('0x44')](_0x96bc('0x180'),_[_0x96bc('0xf6')](_0x3e785b[_0x96bc('0x89')])?_0x3e785b['Trunk'][_0x96bc('0x5f')]:_0x3e785b[_0x96bc('0x89')][_0x96bc('0x5f')],isNotNull(_0x3e785b['dialPrefix'])?_0x3e785b['dialPrefix'][_0x96bc('0x182')]()||'':'',_0x3e785b[_0x96bc('0x183')]>0x0?_0x5aa91b[_0x96bc('0x163')][_0x96bc('0x184')](_0x3e785b[_0x96bc('0x183')]):_0x5aa91b[_0x96bc('0x163')]),'callerid':_0x45c0f2,'Exten':_0x96bc('0x112'),'Context':'from-sip','Priority':'1','variable':_0x139dab,'timeout':(_0x3e785b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1491e4})[_0x96bc('0x3b')](function(_0x3b816d){return _0x29d2bd(_0x3b816d);})[_0x96bc('0x9f')](function(_0x22edc1){_0x3e785b['outboundOriginateFailureCallsDay']+=0x1;var _0x17afbb=new History(_0x231dcb['actions'][_0x1491e4]);logger[_0x96bc('0x64')](util['format']('[originateError]:\x20%s',JSON[_0x96bc('0x73')](_0x22edc1)));_0x17afbb[_0x96bc('0xd0')]=0xe;_0x17afbb[_0x96bc('0x6d')]='OriginateError';_0x17afbb[_0x96bc('0x6f')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));_0x17afbb[_0x96bc('0x6e')]=_0x17afbb[_0x96bc('0x6f')];hopperUtils['createHistory'](_0x17afbb)['catch'](loggerCatch(_0x96bc('0x185')));_0x231dcb[_0x96bc('0xca')](_0x17afbb)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x185')))['finally'](function(){delete _0x231dcb[_0x96bc('0xec')][_0x1491e4];return _0x1bc16f(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x96bc('0x186')]=function(_0x4fde62,_0x430d9f,_0x22befc){var _0x590cc3=new History(_0x430d9f);if(_0x590cc3[_0x96bc('0x122')]+_0x590cc3[_0x96bc('0x12f')]+_0x590cc3[_0x96bc('0x123')]+_0x590cc3['countnosuchnumberretry']+_0x590cc3['countdropretry']+_0x590cc3[_0x96bc('0xe4')]+_0x590cc3[_0x96bc('0x120')]+_0x590cc3['countagentrejectretry']>=_0x22befc[_0x96bc('0x124')]-0x1){return!![];}switch(_0x4fde62){case 0x3:if(_0x590cc3[_0x96bc('0x123')]>=_0x22befc['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x590cc3['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x22befc[_0x96bc('0x187')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x188')));break;case 0x5:if(_0x590cc3['countbusyretry']>=_0x22befc[_0x96bc('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x590cc3['countbusyretry']+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x18a')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0x18b')));break;case 0x8:if(_0x590cc3['countcongestionretry']>=_0x22befc['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countcongestionretry':_0x590cc3[_0x96bc('0x12f')]+=0x1,'scheduledat':moment()['add'](_0x22befc[_0x96bc('0x18c')],_0x96bc('0xda'))[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x18d')));break;case 0x0:if(_0x590cc3[_0x96bc('0x18e')]>=_0x22befc[_0x96bc('0x18f')]-0x1){return!![];}else{hopperUtils[_0x96bc('0x106')]({'active':![],'countnosuchnumberretry':_0x590cc3[_0x96bc('0x18e')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x190')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3['ListId'],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x590cc3[_0x96bc('0xd1')]>=_0x22befc['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x590cc3[_0x96bc('0xd1')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0xd3')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x191')));break;case 0xb:if(_0x590cc3['countabandonedretry']>=_0x22befc['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countabandonedretry':_0x590cc3[_0x96bc('0xe4')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0xe5')],_0x96bc('0xda'))[_0x96bc('0x44')](_0x96bc('0xc0')),'ContactId':_0x590cc3['ContactId'],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0xeb')));break;case 0x13:if(_0x590cc3['countmachineretry']>=_0x22befc[_0x96bc('0x127')]-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countmachineretry':_0x590cc3[_0x96bc('0x120')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc[_0x96bc('0x12a')],_0x96bc('0xda'))[_0x96bc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x12b')));break;case 0x14:if(_0x590cc3[_0x96bc('0x130')]>=_0x22befc[_0x96bc('0x192')]-0x1){return!![];}hopperUtils[_0x96bc('0x106')]({'active':![],'countagentrejectretry':_0x590cc3[_0x96bc('0x130')]+=0x1,'scheduledat':moment()[_0x96bc('0xd9')](_0x22befc['dialAgentRejectRetryFrequency'],_0x96bc('0xda'))['format'](_0x96bc('0xc0')),'ContactId':_0x590cc3[_0x96bc('0xe8')],'ListId':_0x590cc3[_0x96bc('0xe9')],'VoiceQueueId':_0x590cc3[_0x96bc('0xea')]||undefined,'CampaignId':_0x590cc3[_0x96bc('0xdb')]||undefined})['catch'](loggerCatch(_0x96bc('0x193')));break;default:return!![];}};Dialer[_0x96bc('0x1b')][_0x96bc('0x10d')]=function(_0x2cddd6,_0x42e750,_0x3b709c){var _0xced859=this;var _0xf3140d=new History(_0x2cddd6);var _0x5762d5=![];var _0x431c93;var _0x1deb48;return new Promise(function(_0x3d6f95,_0x421cae){if(_[_0x96bc('0x3d')](_0x42e750)&&typeof _0x42e750!=='object'){return _0x421cae(msgResponse(_0x96bc('0x194'),_0x96bc('0x8f'),_0x96bc('0x195')));}if(_[_0x96bc('0x3d')](_0x3b709c)&&typeof _0x3b709c!=='object'){return _0x421cae(msgResponse(_0x96bc('0x194'),_0x96bc('0x8f'),'evt\x20is\x20undefine'));}hopperUtils[_0x96bc('0xd4')](_0xf3140d,_0x3b709c['reason'],_0x42e750)[_0x96bc('0x3b')](function(_0x53d31b){if(_0x53d31b[_0x96bc('0xd6')]==0x1)_0x5762d5=!![];switch(_0x3b709c[_0x96bc('0xc3')]){case'0':_0x42e750[_0x96bc('0x196')]+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x0;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x197');_0xf3140d['countnosuchnumberretry']+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;ami[_0x96bc('0x3e')](_0x96bc('0x198'),ut['buildObj'](_0x2cddd6,_0x96bc('0x199')));_0x431c93=_0x42e750[_0x96bc('0x190')];_0x1deb48=_0x42e750['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x121')));if(_0xced859['checkRetriveMax'](0x0,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countnosuchnumberretry']>=_0x42e750[_0x96bc('0x18f')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x19a'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x42e750['outboundNoAnswerCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x3;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x19b');_0xf3140d[_0x96bc('0x123')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;var _0x5eaa00=ut[_0x96bc('0x19c')](_0x2cddd6,_0x42e750);ami[_0x96bc('0x3e')](_0x96bc('0x19d'),_0x5eaa00);_0x431c93=_0x42e750['dialNoAnswerRetryFrequency'];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x19e')));if(_0xced859[_0x96bc('0x186')](0x3,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countnoanswerretry']>=_0x42e750[_0x96bc('0x19f')]){_0xced859['createStateFinal'](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a0'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a0'));}}break;case'5':_0x42e750[_0x96bc('0x1a1')]+=0x1;_0xf3140d['state']=0x5;_0xf3140d['statedesc']=_0x96bc('0x1a2');_0xf3140d[_0x96bc('0x122')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;ami[_0x96bc('0x3e')](_0x96bc('0x1a3'),ut[_0x96bc('0x12e')](_0x2cddd6,'busy'));_0x431c93=_0x42e750[_0x96bc('0x18a')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1a4')));if(_0xced859[_0x96bc('0x186')](0x5,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countbusyretry']>=_0x42e750[_0x96bc('0x189')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x205\x20busy');}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1a5'));}}break;case'8':_0x42e750['outboundCongestionCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x8;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x1a6');_0xf3140d['countcongestionretry']+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;_0x431c93=_0x42e750['dialCongestionRetryFrequency'];_0x1deb48=_0x42e750[_0x96bc('0xe6')];ami[_0x96bc('0x3e')](_0x96bc('0x1a7'),ut['buildObj'](_0x2cddd6,_0x96bc('0x1a8')));hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xced859['checkRetriveMax'](0x8,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0x12f')]>=_0x42e750[_0x96bc('0x1a9')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x208\x20congestion');}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1aa'));}}break;case'11':_0x42e750[_0x96bc('0x1ab')]+=0x1;_0xf3140d['state']=0xb;_0xf3140d[_0x96bc('0x6d')]='Abandoned';_0xf3140d[_0x96bc('0xe4')]+=0x1;_0xf3140d['countglobal']+=0x1;_0x431c93=_0x42e750[_0x96bc('0xe5')];_0x1deb48=_0x42e750['callAdditionalPhoneAfterMin'];hopperUtils[_0x96bc('0xc8')](_0xf3140d)['catch'](loggerCatch(_0x96bc('0x1ac')));if(_0xced859[_0x96bc('0x186')](0xb,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0xe4')]>=_0x42e750[_0x96bc('0xe7')]){_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1ad'));}else{_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1ad'));}}break;case'20':_0x42e750['outboundRejectCallsDay']+=0x1;_0xf3140d[_0x96bc('0xd0')]=0x14;_0xf3140d[_0x96bc('0x6d')]=_0x96bc('0x1ae');_0xf3140d[_0x96bc('0x130')]+=0x1;_0xf3140d[_0x96bc('0xd2')]+=0x1;_0x431c93=_0x42e750[_0x96bc('0x1af')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];ami[_0x96bc('0x3e')](_0x96bc('0x1b0'),ut[_0x96bc('0x12e')](_0x2cddd6,'agentreject'));hopperUtils[_0x96bc('0xc8')](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1b1')));if(_0xced859[_0x96bc('0x186')](0x14,_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d[_0x96bc('0x130')]>=_0x42e750[_0x96bc('0x192')]){_0xced859['createStateFinal'](_0xf3140d,_0x3d6f95,_0x421cae,_0x96bc('0x1b2'));}else{_0xced859['stateGlobal'](_0xf3140d,_0x3d6f95,_0x421cae,'reason\x2020\x20agentreject');}}break;default:_0x42e750[_0x96bc('0x13e')]+=0x1;_0xf3140d[_0x96bc('0xd0')]=0xc;_0xf3140d[_0x96bc('0x6d')]=_0x3b709c[_0x96bc('0xc3')];_0x431c93=_0x42e750[_0x96bc('0x1af')];_0x1deb48=_0x42e750[_0x96bc('0xe6')];hopperUtils['createHistory'](_0xf3140d)[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1b3')));if(_0xced859[_0x96bc('0x186')](_0x3b709c[_0x96bc('0xc3')],_0x2cddd6,_0x42e750)&&!_0x5762d5){if(_0xf3140d['countbusyretry']+_0xf3140d[_0x96bc('0x12f')]+_0xf3140d[_0x96bc('0x123')]+_0xf3140d[_0x96bc('0x18e')]+_0xf3140d[_0x96bc('0xd1')]+_0xf3140d[_0x96bc('0xe4')]+_0xf3140d[_0x96bc('0x120')]+_0xf3140d[_0x96bc('0x130')]>=_0x42e750['dialGlobalMaxRetry']){_0xced859[_0x96bc('0x125')](_0xf3140d,_0x3d6f95,_0x421cae,_0x3b709c[_0x96bc('0xc3')]);}else{_0xced859[_0x96bc('0x128')](_0xf3140d,_0x3d6f95,_0x421cae,_0x3b709c[_0x96bc('0xc3')]);}}}})['then'](function(){if(_0x5762d5){hopperUtils[_0x96bc('0xdf')](_0xf3140d,_0x431c93,_0x1deb48)['then'](function(){return _0x3d6f95(0x1);});}});});};Dialer[_0x96bc('0x1b')][_0x96bc('0x125')]=function(_0x2da9c4,_0x2b6d43,_0x64d830,_0x49e77b){var _0x3b0126=new Final(_0x2da9c4);_0x3b0126[_0x96bc('0xd0')]=0xf;_0x3b0126['statedesc']=_0x96bc('0x1b4');this[_0x96bc('0x128')](_0x3b0126,_0x2b6d43,_0x64d830,_0x49e77b);};Dialer[_0x96bc('0x1b')][_0x96bc('0x128')]=function(_0x4da542,_0xd68f72,_0x11945e,_0x476624){hopperUtils[_0x96bc('0xca')](_0x4da542)['then'](function(){return _0xd68f72(msgResponse(_0x96bc('0x194'),'Success',_0x476624));})['catch'](function(){return _0x11945e(msgResponse('[moveContactManagedDialer][0]',_0x96bc('0x8f'),'contact\x20not\x20moved'));});};Dialer[_0x96bc('0x1b')][_0x96bc('0xa')]=function(_0x39c071){var _0x4ad716=_0x39c071[_0x96bc('0x1b5')]/0x64;var _0x36b303=_0x39c071[_0x96bc('0xce')]/(_0x39c071[_0x96bc('0xce')]+_0x39c071['outboundAnswerCallsDay']);var _0x4cbb7b=Math[_0x96bc('0x1b6')](_0x39c071[_0x96bc('0x1b7')]*(_0x39c071['predictiveIntervalMaxThreshold']/0x64));var _0x6a9059=Math[_0x96bc('0x1b6')](_0x39c071[_0x96bc('0x1b7')]*(_0x39c071[_0x96bc('0x1b8')]/0x64));var _0x505311=_0x39c071[_0x96bc('0x1b9')]+_0x39c071[_0x96bc('0x144')];var _0x2f0997=Math[_0x96bc('0x1ba')](_0x39c071[_0x96bc('0x1bb')]*_0x39c071[_0x96bc('0x5d')]*_0x39c071[_0x96bc('0x1bc')]*_0x39c071['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x39c071[_0x96bc('0x28')])){if(!_[_0x96bc('0x3d')](_0x39c071[_0x96bc('0x27')])){_0x39c071[_0x96bc('0x27')]=undefined;loggerPredictive[_0x96bc('0x64')](_0x96bc('0x1bd'),_0x96bc('0x1be'));}if(!_['isUndefined'](_0x39c071[_0x96bc('0x62')])){loggerPredictive[_0x96bc('0x64')](_0x96bc('0x1bd'),_0x96bc('0x1bf'));clearInterval(_0x39c071['handlePredictive']);_0x39c071[_0x96bc('0x62')]=undefined;}_0x39c071[_0x96bc('0x28')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));loggerPredictive['info'](_0x39c071['name'],_0x96bc('0x1c0'),_0x39c071[_0x96bc('0x28')]);this[_0x96bc('0xb1')](_0x39c071,0x1);}else if(ifInterval(_0x39c071['dialPredictiveInterval'],_0x39c071[_0x96bc('0x28')])){this[_0x96bc('0xb1')](_0x39c071,0x1);loggerPredictiveCalls['info'](_0x96bc('0x1c1'),_0x39c071['startProgressive'],_0x39c071[_0x96bc('0x5f')]);_0x39c071['erlangCalls']=0x0;_0x39c071[_0x96bc('0xcf')]=0x0;}else if(_0x4ad716<_0x36b303&&_0x39c071[_0x96bc('0x1c2')]===_0x96bc('0x1c3')){clearPredictiveAttributes(_0x39c071);loggerPredictive['info'](_0x96bc('0x1c4'),_0x96bc('0x1c5'),_0x36b303,'startProgressive',_0x39c071[_0x96bc('0x5f')]);}else if(_0x2f0997<_0x39c071[_0x96bc('0xcf')]&&_0x39c071[_0x96bc('0x1c2')]===_0x96bc('0x1c3')){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x1c6'),_0x96bc('0x1c7'),_0x2f0997,_0x96bc('0x1c8'),_0x39c071[_0x96bc('0xcf')],_0x96bc('0x28'),_0x39c071[_0x96bc('0x5f')]);}else if(!ifInterval(_0x39c071[_0x96bc('0x1c9')],_0x39c071['startProgressive'])&&_[_0x96bc('0x3d')](_0x39c071['startPredictive'])&&!_[_0x96bc('0x3d')](_0x39c071['startProgressive'])){_0x39c071[_0x96bc('0x27')]=moment()[_0x96bc('0x44')](_0x96bc('0xc0'));loggerPredictive[_0x96bc('0x48')](_0x39c071['name'],_0x96bc('0x1ca'),_0x39c071[_0x96bc('0x27')]);hopperUtils['avgHandleTime'](_0x39c071[_0x96bc('0x1c9')])[_0x96bc('0x3b')](this[_0x96bc('0x1cb')](_0x39c071))[_0x96bc('0x3b')](mergeDataErlangB(_0x39c071))[_0x96bc('0x3b')](this[_0x96bc('0x1cc')](_0x39c071))[_0x96bc('0x9f')](loggerCatchPredictive(_0x96bc('0x1cd'),_0x39c071));}else if(!ifInterval(_0x39c071[_0x96bc('0x1c9')],_0x39c071[_0x96bc('0x27')])){_0x39c071['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x39c071[_0x96bc('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1ce'),_0x39c071['startPredictive']);clearInterval(_0x39c071['handlePredictive']);_0x39c071[_0x96bc('0x62')]=undefined;hopperUtils[_0x96bc('0x1cf')](_0x39c071[_0x96bc('0x1c9')])['then'](this[_0x96bc('0x1cb')](_0x39c071))[_0x96bc('0x3b')](mergeDataErlangB(_0x39c071))[_0x96bc('0x3b')](this[_0x96bc('0x1cc')](_0x39c071))[_0x96bc('0x9f')](loggerCatchPredictive(_0x96bc('0x1d0'),_0x39c071));}else if(_0x39c071[_0x96bc('0x1b7')]&&_0x505311<_0x39c071[_0x96bc('0x1b7')]-_0x6a9059){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1d1'),_0x505311,')\x20are\x20less\x20than\x20threshold\x20(',_0x39c071[_0x96bc('0x1b7')],'-',_0x6a9059,'=',_0x39c071[_0x96bc('0x1b7')]-_0x6a9059,')');}else if(_0x39c071['predictiveIntervalAvailable']&&_0x505311>_0x39c071[_0x96bc('0x1b7')]+_0x4cbb7b){clearPredictiveAttributes(_0x39c071);loggerPredictive[_0x96bc('0x48')](_0x39c071[_0x96bc('0x5f')],_0x96bc('0x1d1'),_0x505311,_0x96bc('0x1d2'),_0x39c071[_0x96bc('0x1b7')],'+',_0x4cbb7b,'=',_0x39c071[_0x96bc('0x1b7')]+_0x4cbb7b,')');}};Dialer[_0x96bc('0x1b')][_0x96bc('0x1cb')]=function(_0x2ed98f){var _0x3ca588=this;return function(_0x49a503){return new Promise(function(_0x3cd693,_0x40e895){_[_0x96bc('0x5e')](_0x2ed98f,_0x49a503[0x0]);if(checkGetDataPredictive(_0x49a503[0x0])){var _0x5975e5=_0x2ed98f[_0x96bc('0x1b7')]=_0x2ed98f[_0x96bc('0x144')]+_0x2ed98f[_0x96bc('0x1b9')];var _0x409525=_0x2ed98f['dialPredictiveInterval']*0x3c;var _0x7895f7=_0x49a503[0x0][_0x96bc('0x53')]+_0x49a503[0x0][_0x96bc('0x51')];var _0x4e3050=(_0x49a503[0x0][_0x96bc('0x4b')]+_0x49a503[0x0][_0x96bc('0x4d')]+_0x49a503[0x0][_0x96bc('0x4f')])/_0x49a503[0x0][_0x96bc('0x4a')];_0x2ed98f[_0x96bc('0x1bc')]=_0x4e3050>0x0?_0x4e3050:0x1;switch(_0x2ed98f[_0x96bc('0x1c2')]){case'dropRate':var _0x31020e=_0x2ed98f[_0x96bc('0x1b5')]/0x64;return _0x3ca588[_0x96bc('0x1d3')](_0x5975e5,_0x409525,_0x7895f7,_0x4e3050,_0x31020e)['then'](function(_0x45dbf3){return _0x3cd693(_0x45dbf3);});case _0x96bc('0x1d4'):var _0x369864=_0x2ed98f[_0x96bc('0x1b5')]/0x64;return _0x3ca588[_0x96bc('0x1d5')](_0x5975e5,_0x409525,_0x7895f7,_0x4e3050,_0x369864)['then'](function(_0x3f2704){return _0x3cd693(_0x3f2704);});default:return _0x40e895(msgResponse('[getDataPredictive]',_0x96bc('0x8f'),_0x96bc('0x1d6')));}}else{return _0x40e895(msgResponse(_0x96bc('0x1d7'),_0x96bc('0x8f'),'check\x20failure'));}});};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d8')]=function(_0x473b69){var _0x39635f=this;return function(_0xa69318){return new Promise(function(_0x579f88,_0x121884){_['merge'](_0x473b69,_0xa69318[0x0]);if(checkGetDataPredictive(_0xa69318[0x0])){loggerPredictive[_0x96bc('0x48')](JSON[_0x96bc('0x73')](_0xa69318[0x0]));if(_0x473b69['dialPredictiveOptimization']===_0x96bc('0x1c3')){return _0x39635f[_0x96bc('0x158')](_0x473b69['id'])['then'](function(_0x297aaf){var _0x392736=_0x473b69[_0x96bc('0x1d9')]-_0x297aaf[0x0][_0x96bc('0x1da')];var _0x1daf34=_0x473b69[_0x96bc('0x1c9')]*0x3c;var _0x411a3a=_0xa69318[0x0][_0x96bc('0x53')]+_0xa69318[0x0]['predictiveIntervalAvgHoldtime'];var _0xd433e9=(_0xa69318[0x0]['predictiveIntervalAnsweredCalls']+_0xa69318[0x0][_0x96bc('0x4d')]+_0xa69318[0x0][_0x96bc('0x4f')])/_0xa69318[0x0][_0x96bc('0x4a')];var _0x35e11f=_0x473b69[_0x96bc('0x1b5')]/0x64;_0x473b69[_0x96bc('0x1db')]=_0x297aaf[0x0][_0x96bc('0x1da')]||0x0;_0x473b69[_0x96bc('0x1bc')]=_0xd433e9>0x0?_0xd433e9:0x1;return _0x39635f[_0x96bc('0x1d3')](_0x392736,_0x1daf34,_0x411a3a,_0xd433e9,_0x35e11f);})['then'](function(_0x516b45){return _0x579f88(_0x516b45);})['catch'](function(_0x463c39){return _0x121884(msgResponse(_0x96bc('0x1dc'),_0x96bc('0x8f'),JSON[_0x96bc('0x73')](_0x463c39)));});}if(_0x473b69[_0x96bc('0x1c2')]===_0x96bc('0x1d4')){return _0x39635f['getVoiceQueueRtPauses'](_0x473b69['id'])['then'](function(_0x20b522){var _0x2f4ea2=_0x473b69[_0x96bc('0x1d9')]-_0x20b522[0x0][_0x96bc('0x1da')];var _0x27b7a9=_0x473b69[_0x96bc('0x1c9')]*0x3c;var _0x4f9884=_0xa69318[0x0][_0x96bc('0x53')]+_0xa69318[0x0][_0x96bc('0x51')];var _0x5c949a=(_0xa69318[0x0][_0x96bc('0x4b')]+_0xa69318[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xa69318[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xa69318[0x0]['predictiveIntervalTotalCalls'];var _0x66924a=_0x473b69[_0x96bc('0x1b5')]/0x64;_0x473b69[_0x96bc('0x1db')]=_0x20b522[0x0]['outboundQueuePauses']||0x0;_0x473b69['predictiveIntervalHitRate']=_0x5c949a>0x0?_0x5c949a:0x1;return _0x39635f[_0x96bc('0x1d5')](_0x2f4ea2,_0x27b7a9,_0x4f9884,_0x5c949a,_0x66924a);})[_0x96bc('0x3b')](function(_0x46e75f){return _0x579f88(_0x46e75f);})[_0x96bc('0x9f')](function(_0x2b3c6e){return _0x121884(msgResponse(_0x96bc('0x1dc'),_0x96bc('0x8f'),JSON[_0x96bc('0x73')](_0x2b3c6e)));});}}else{return _0x121884(msgResponse(_0x96bc('0x1d7'),_0x96bc('0x8f'),'check\x20failure'));}});};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1cc')]=function(_0x28e861){var _0x2170ff=this;return function(){var _0x46ffb1=0x0;var _0x48bfdd=Math['floor'](_0x28e861['erlangCallToSecond']*0x3e8);if(_0x48bfdd>0x0){_0x48bfdd=_0x48bfdd<0x64?0x64:_0x48bfdd;loggerPredictive[_0x96bc('0x48')](_0x28e861[_0x96bc('0x5f')],_0x96bc('0x1dd'),_0x48bfdd,_0x96bc('0x1de'));_0x28e861[_0x96bc('0x62')]=setInterval(function(){_0x2170ff[_0x96bc('0x62')](_0x28e861);loggerPredictiveCalls[_0x96bc('0x48')](_0x96bc('0x1df'),_0x46ffb1+=0x1);},_0x48bfdd);}else{loggerPredictive[_0x96bc('0x48')](_0x28e861['name'],_0x96bc('0x1e0'));}};};Dialer[_0x96bc('0x1b')][_0x96bc('0x1e1')]=function(_0xe43189,_0x1e8130){var _0x1b6429=this;return function(_0x14f360){if(_[_0x96bc('0x46')](_0x14f360)){if(_[_0x96bc('0xf6')](_0x1e8130[_0x96bc('0x15b')])||!_0x1e8130[_0x96bc('0x1e2')]){if(_0xe43189['dialMethod']==='booked'){_0xe43189['queueStatusComplete']=_['isUndefined'](_0xe43189[_0x96bc('0x70')])?!![]:_0xe43189[_0x96bc('0x70')];var _0x518ad9=uuid['v4']();_0x1b6429[_0x96bc('0xec')][_0x518ad9]=new Action(_0xe43189,_0x1e8130,_0x518ad9);loggerBooked[_0x96bc('0x48')]('[booked][checkContactBlack]',_0x518ad9,'queueStatusComplete:\x20',JSON[_0x96bc('0x73')](_0xe43189[_0x96bc('0x70')]),_0x96bc('0x1e3'),_0xe43189[_0x96bc('0x5f')]);if(_0xe43189[_0x96bc('0x70')]){_0xe43189[_0x96bc('0x70')]=![];_0x1b6429[_0x96bc('0xf7')][_0x1b6429[_0x96bc('0xec')][_0x518ad9]['queue']]=[];ami[_0x96bc('0x9c')]({'actionid':_0x518ad9,'action':_0x96bc('0x1e4'),'queue':_0xe43189['name']})['catch'](function(){utils['decrementOriginate'](_0xe43189,'[checkContactBlack]');hopperUtils[_0x96bc('0x106')]({'active':![],'ContactId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe8')],'ListId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe9')],'VoiceQueueId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xea')]||undefined,'CampaignId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1e5')));delete _0x1b6429[_0x96bc('0xec')][_0x518ad9];});}else{loggerBooked['info'](_0x96bc('0x1e6'),JSON[_0x96bc('0x73')](_0xe43189[_0x96bc('0x70')]),_0x96bc('0x1e3'),_0xe43189['name']);utils[_0x96bc('0xbe')](_0xe43189,_0x96bc('0x1e7'));hopperUtils[_0x96bc('0x106')]({'active':![],'ContactId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xe8')],'ListId':_0x1b6429['actions'][_0x518ad9][_0x96bc('0xe9')],'VoiceQueueId':_0x1b6429[_0x96bc('0xec')][_0x518ad9][_0x96bc('0xea')]||undefined,'CampaignId':_0x1b6429[_0x96bc('0xec')][_0x518ad9]['CampaignId']||undefined})['catch'](loggerCatch(_0x96bc('0x1e5')));delete _0x1b6429[_0x96bc('0xec')][_0x518ad9];}}else{return _0x1b6429['actionOriginate'](_0xe43189,_0x1e8130);}}else{if(utils[_0x96bc('0x1e8')](undefined,_0x1e8130[_0x96bc('0x1e9')])<_0xe43189[_0x96bc('0x1ea')]*0x3c){if(_0x1e8130[_0x96bc('0x1eb')]&&!_0x1e8130[_0x96bc('0x1eb')][_0x96bc('0x1ec')]){_0x1b6429['preview'][_0x96bc('0xf9')](_0x1e8130['id'])['finally'](function(){utils['decrementOriginate'](_0xe43189,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x1e8130['id'],0x1)[_0x96bc('0x103')](function(){utils[_0x96bc('0xbe')](_0xe43189,'[checkContactBlack]');});}}else{_0xe43189[_0x96bc('0x1ed')]+=0x1;utils['decrementOriginate'](_0xe43189,_0x96bc('0x1e7'));if(_0xe43189[_0x96bc('0x1ee')]){hopperUtils[_0x96bc('0x106')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e8130['ContactId'],'ListId':_0x1e8130[_0x96bc('0xe9')],'VoiceQueueId':_0x1e8130[_0x96bc('0xea')]||undefined,'CampaignId':_0x1e8130[_0x96bc('0xdb')]||undefined})[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x1ef')));hopperUtils[_0x96bc('0xc8')](createObjHistory(_0xe43189,_0x1e8130,utils['CAMPAIGN_STATUS'][_0x96bc('0x1f0')],0x17,_0x96bc('0x1f1')))['catch'](loggerCatch(_0x96bc('0x1f2')));}else{_0x1b6429[_0x96bc('0x11a')](createObjHistory(_0xe43189,_0x1e8130,utils[_0x96bc('0x66')][_0x96bc('0x1f3')],0x16,_0x96bc('0x1f4')),_0x96bc('0x1f5'),_0x96bc('0x1f6'));}}}}else{_0xe43189['outboundBlacklistCallsDay']+=0x1;_0x1b6429[_0x96bc('0x11a')](createObjHistory(_0xe43189,_0x1e8130,utils['CAMPAIGN_STATUS'][_0x96bc('0x1f7')],0xd,'Blacklist'),_0x96bc('0x1f8'),'[Originate][MoveBlacklist]');throw _0x96bc('0x1f9');}};};Dialer[_0x96bc('0x1b')]['handleIvr']=function(_0x14db78){var _0x48a8bc=this;var _0x481f04=_0x14db78[_0x96bc('0x1fa')]-_0x14db78[_0x96bc('0x1fb')];emitCampaignSummary(_0x14db78);if(_0x481f04>0x0&&_0x14db78['temp']==0x0){if(_0x481f04>this[_0x96bc('0x23')]){_0x481f04=this[_0x96bc('0x23')];}_0x14db78[_0x96bc('0x1fc')]=0x1;hopperUtils[_0x96bc('0x1fd')](_0x14db78,_0x481f04)[_0x96bc('0x3b')](function(_0x76ba80){_0x14db78['temp']=0x0;if(_0x76ba80){if(!utils[_0x96bc('0x1fe')](_0x76ba80)){_0x14db78[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x6b')];logger[_0x96bc('0x48')](_0x96bc('0x1ff')+_0x14db78[_0x96bc('0x5f')]);}else{_0x14db78[_0x96bc('0x1fb')]+=_0x76ba80[_0x96bc('0x97')];_0x14db78[_0x96bc('0x6a')]=utils[_0x96bc('0x66')][_0x96bc('0x200')];for(var _0x9d84e0=0x0;_0x9d84e0<_0x76ba80[_0x96bc('0x97')];_0x9d84e0+=0x1){_0x14db78['ivrTotalCallsDays']+=0x1;if(_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0])||_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0][_0x96bc('0x201')])||_[_0x96bc('0xf6')](_0x76ba80[_0x9d84e0][_0x96bc('0x163')])){_0x48a8bc['emptyContact']('[actionOriginate]\x20',_0x14db78,_0x76ba80[_0x9d84e0]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x96bc('0x74')](_0x76ba80[_0x9d84e0],[_0x96bc('0xdb'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x48a8bc[_0x96bc('0x1e1')](_0x14db78,_0x76ba80[_0x9d84e0]))['catch'](function(_0x18e192){logger[_0x96bc('0x64')](_0x96bc('0x202'),_0x18e192);utils[_0x96bc('0xbe')](_0x14db78,'[handleIvr]');});}}}}})[_0x96bc('0x9f')](function(_0x45a6c2){_0x14db78[_0x96bc('0x1fc')]=0x0;logger[_0x96bc('0x64')](_0x96bc('0x203'),_0x45a6c2);});}};Dialer[_0x96bc('0x1b')][_0x96bc('0xb1')]=function(_0x31d634,_0x50c92e){var _0x61a29a=this;var _0x2726c9=[];if(_0x50c92e<0x1||_0x31d634[_0x96bc('0xaf')]==='booked'){_0x50c92e=0x1;}var _0xc773bf=Math['floor'](_0x31d634[_0x96bc('0x1b9')]*_0x50c92e)-_0x31d634[_0x96bc('0x1fb')];if(_0x31d634[_0x96bc('0x204')]>0x0){var _0x1b709d=_0x31d634[_0x96bc('0x204')]-_0x31d634[_0x96bc('0x1fb')]-_0x31d634['talking']-_0x31d634['pTalking'];if(_0xc773bf>_0x1b709d){_0xc773bf=_0x1b709d;}}if(_0xc773bf>0x0&&_0x31d634[_0x96bc('0x1fc')]==0x0){if(_0x31d634[_0x96bc('0xaf')]===_0x96bc('0x9')){_0xc773bf=0x1;}if(_0xc773bf>this[_0x96bc('0x23')]){_0xc773bf=this['maxNumberOriginate'];}for(var _0x870856 in this[_0x96bc('0x21')]){if(typeof this[_0x96bc('0x21')][_0x870856]!==_0x96bc('0xa9')){if(this[_0x96bc('0x21')][_0x870856][_0x96bc('0xd0')]===_0x96bc('0x205')&&this['agents'][_0x870856][_0x96bc('0x87')]===_0x96bc('0x88')){_0x2726c9['push'](this['agents'][_0x870856]['id']);}}}_0x31d634[_0x96bc('0x1fc')]=0x1;hopperUtils[_0x96bc('0x206')](_0x31d634,_0x2726c9,_0xc773bf)[_0x96bc('0x3b')](function(_0x2b3062){_0x31d634[_0x96bc('0x1fc')]=0x0;if(_0x2b3062){if(!utils['checkContactEmpty'](_0x2b3062)){hopperUtils['countReScheduled'](_0x31d634)[_0x96bc('0x3b')](sendMessageReschedule(_0x31d634))[_0x96bc('0x9f')](loggerCatch(_0x96bc('0x207')));}else{_0x31d634[_0x96bc('0x1fb')]+=_0x2b3062['length'];_0x31d634[_0x96bc('0x6a')]=_0x31d634[_0x96bc('0xaf')]===_0x96bc('0x9')?utils[_0x96bc('0x66')][_0x96bc('0x146')]:utils[_0x96bc('0x66')]['RUNNING'];for(var _0x49860f=0x0;_0x49860f<_0x2b3062['length'];_0x49860f+=0x1){if(_[_0x96bc('0xf6')](_0x2b3062[_0x49860f])||_[_0x96bc('0xf6')](_0x2b3062[_0x49860f][_0x96bc('0x201')])||_[_0x96bc('0xf6')](_0x2b3062[_0x49860f][_0x96bc('0x163')])){_0x61a29a[_0x96bc('0x208')](_0x96bc('0x209'),_0x31d634,_0x2b3062[_0x49860f]);}else{hopperUtils[_0x96bc('0x20a')](_['pick'](_0x2b3062[_0x49860f],[_0x96bc('0xea'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x61a29a[_0x96bc('0x1e1')](_0x31d634,_0x2b3062[_0x49860f]))[_0x96bc('0x9f')](function(_0x3e13b6){logger[_0x96bc('0x64')]('[actionOriginate]',_0x3e13b6);utils['decrementOriginate'](_0x31d634,_0x96bc('0x20b'));});}}}}})[_0x96bc('0x9f')](function(_0x2a84ac){_0x31d634[_0x96bc('0x1fc')]=0x0;logger['error']('[getContactCampaign2]',_0x2a84ac);});}};Dialer[_0x96bc('0x1b')][_0x96bc('0x62')]=function(_0x10e22c){if(_0x10e22c[_0x96bc('0x204')]>0x0){var _0x22b697=_0x10e22c[_0x96bc('0x204')]-_0x10e22c['originated']-_0x10e22c['talking'];if(_0x22b697>0x0&&_0x10e22c[_0x96bc('0x1fc')]==0x0){this['tryOriginatePredictive'](_0x10e22c);}else{loggerPredictiveCalls[_0x96bc('0x48')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x10e22c);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x36f910){var _0x54bc0f=this;var _0x1684fe=[];_0x36f910[_0x96bc('0x1fb')]+=0x1;for(var _0x13bd0c in this[_0x96bc('0x21')]){if(typeof this['agents'][_0x13bd0c]!=='undefined'){if(this[_0x96bc('0x21')][_0x13bd0c][_0x96bc('0xd0')]===_0x96bc('0x205')&&this[_0x96bc('0x21')][_0x13bd0c][_0x96bc('0x87')]===_0x96bc('0x88')){_0x1684fe[_0x96bc('0x98')](this[_0x96bc('0x21')][_0x13bd0c]['id']);}}}_0x36f910[_0x96bc('0x1fc')]=0x1;return this[_0x96bc('0x206')](_0x36f910['id'],_0x1684fe,0x1,_0x36f910[_0x96bc('0x20c')],_0x36f910)[_0x96bc('0x3b')](function(_0x32622e){_0x36f910[_0x96bc('0x1fc')]=0x1;if(_0x32622e){if(!utils[_0x96bc('0x1fe')](_0x32622e)){utils[_0x96bc('0x20d')](_0x36f910,0x1,0x0);return hopperUtils[_0x96bc('0x20e')](_0x36f910)[_0x96bc('0x3b')](sendMessageReschedule(_0x36f910))[_0x96bc('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x36f910['message']=utils[_0x96bc('0x66')][_0x96bc('0x200')];if(_['isNil'](_0x32622e[0x0])||_[_0x96bc('0xf6')](_0x32622e[0x0]['Contact'])||_[_0x96bc('0xf6')](_0x32622e[0x0][_0x96bc('0x163')])){_0x54bc0f[_0x96bc('0x208')](_0x96bc('0x209'),_0x36f910,_0x32622e[0x0]);}else{return hopperUtils[_0x96bc('0x20a')](_[_0x96bc('0x74')](_0x32622e[0x0],[_0x96bc('0xea'),_0x96bc('0x163')]))[_0x96bc('0x3b')](_0x54bc0f[_0x96bc('0x1e1')](_0x36f910,_0x32622e[0x0]))[_0x96bc('0x9f')](function(_0x137728){logger['error']('[actionOriginatePredictive]',_0x137728);utils[_0x96bc('0xbe')](_0x36f910,_0x96bc('0x20f'));});}}}})[_0x96bc('0x9f')](function(_0x1b3168){_0x36f910[_0x96bc('0x1fc')]=0x0;logger[_0x96bc('0x64')]('[getContactCampaign2]',_0x1b3168);});};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d3')]=function(_0x1bc18d,_0xd9946d,_0xc07bdd,_0x36699c,_0x24aa92,_0x1ff4e1){loggerPredictive[_0x96bc('0x48')](_0x96bc('0x210'));loggerPredictive[_0x96bc('0x48')](_0x96bc('0x211'),_0x1bc18d);loggerPredictive['info'](_0x96bc('0x212'),_0xd9946d);loggerPredictive['info'](_0x96bc('0x213'),_0xc07bdd);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x214'),_0x36699c);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24aa92);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));return new Promise(function(_0x41f64d,_0x48d8a8){if(_0x1bc18d<=0x0||isNaN(_0x1bc18d)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x216')+_0x1bc18d));}if(_0xc07bdd<=0x0||isNaN(_0xc07bdd)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x217')+_0xc07bdd));}if(_0x36699c<=0x0||isNaN(_0x36699c)){return _0x48d8a8(msgResponse('[abandonmentRate]',_0x96bc('0x83'),_0x96bc('0x218')+_0x36699c));}if(_0xd9946d<=0x0||isNaN(_0xd9946d)){return _0x48d8a8(msgResponse(_0x96bc('0x215'),_0x96bc('0x83'),_0x96bc('0x219')+_0xd9946d));}if(_0x24aa92<=0x0||isNaN(_0x24aa92)){return _0x48d8a8(msgResponse('[abandonmentRate]',_0x96bc('0x83'),_0x96bc('0x21a')+_0x24aa92));}_0x1ff4e1=_0x1ff4e1||0x0;var _0x56afca=0x1/_0xc07bdd;var _0x3b9a3d=0x0;var _0x40fec9=0x0;var _0x150659=0x0;var _0x2eb51d=0x0;for(var _0x28889b=0x0;_0x150659<_0x24aa92;_0x28889b+=0x1){_0x40fec9=_0x28889b/_0xd9946d;_0x3b9a3d=(_0x36699c*_0x40fec9+_0x1ff4e1)/_0x56afca;_0x150659=utils[_0x96bc('0x21b')](_0x3b9a3d,_0x1bc18d);_0x2eb51d=_0x3b9a3d/_0x1bc18d*(0x1-utils[_0x96bc('0x21b')](_0x3b9a3d,_0x1bc18d));}return _0x41f64d({'erlangCalls':_0x28889b,'erlangCallToSecond':_0xd9946d/_0x28889b,'erlangAbandonmentRate':_0x150659,'erlangBusyFactor':_0x2eb51d});});};Dialer[_0x96bc('0x1b')][_0x96bc('0x1d5')]=function(_0x8f92d3,_0xd9d67d,_0x238eb5,_0x409004,_0x2ff7db,_0x2e07d1){loggerPredictive[_0x96bc('0x48')](_0x96bc('0x21c'));loggerPredictive['info'](_0x96bc('0x211'),_0x8f92d3);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x212'),_0xd9d67d);loggerPredictive[_0x96bc('0x48')]('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',_0x238eb5);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x214'),_0x409004);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ff7db);loggerPredictive[_0x96bc('0x48')](_0x96bc('0x54'));return new Promise(function(_0x506aa8,_0x199ece){if(_0x8f92d3<=0x0||isNaN(_0x8f92d3)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),_0x96bc('0x216')+_0x8f92d3));}if(_0x238eb5<=0x0||isNaN(_0x238eb5)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),'Ts\x20=\x20'+_0x238eb5));}if(_0x409004<=0x0||isNaN(_0x409004)){return _0x199ece(msgResponse(_0x96bc('0x21d'),'Error',_0x96bc('0x218')+_0x409004));}if(_0xd9d67d<=0x0||isNaN(_0xd9d67d)){return _0x199ece(msgResponse(_0x96bc('0x21d'),_0x96bc('0x83'),_0x96bc('0x219')+_0xd9d67d));}if(_0x2ff7db<=0x0||isNaN(_0x2ff7db)){return _0x199ece(msgResponse('[busyFactor]',_0x96bc('0x83'),_0x96bc('0x21e')+_0x2ff7db));}_0x2e07d1=_0x2e07d1||0x0;var _0xe126c2=0x1/_0x238eb5;var _0x29a376=0x0;var _0x304070=0x0;var _0x14ab1a=0x0;var _0xe482f2=0x0;for(var _0x29ff68=0x0;_0xe482f2<_0x2ff7db;_0x29ff68+=0x1){_0x304070=_0x29ff68/_0xd9d67d;_0x29a376=(_0x409004*_0x304070+_0x2e07d1)/_0xe126c2;_0x14ab1a=utils[_0x96bc('0x21b')](_0x29a376,_0x8f92d3);_0xe482f2=_0x29a376/_0x8f92d3*(0x1-utils[_0x96bc('0x21b')](_0x29a376,_0x8f92d3));}return _0x506aa8({'erlangCalls':_0x29ff68,'erlangCallToSecond':_0xd9d67d/_0x29ff68,'erlangAbandonmentRate':_0x14ab1a,'erlangBusyFactor':_0xe482f2});});};module[_0x96bc('0x21f')]=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 70de0f5..01282c0 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 _0xfd10=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','Contact','phone','lastName','number','queue','name','active','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'];(function(_0x47f587,_0x33ec3a){var _0x2a26d3=function(_0x3154f0){while(--_0x3154f0){_0x47f587['push'](_0x47f587['shift']());}};_0x2a26d3(++_0x33ec3a);}(_0xfd10,0x16c));var _0x0fd1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfd10[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var _=require(_0x0fd1('0x0'));var moment=require(_0x0fd1('0x1'));function checkNameSurname(_0x5d6b89,_0x5ad727,_0xbd62){var _0x371a64='';if(!_[_0x0fd1('0x2')](_0x5ad727)&&_0x0fd1('0x3')===typeof _0x5ad727){_0x371a64+=_0x5ad727;}if(!_[_0x0fd1('0x2')](_0xbd62)&&'string'===typeof _0xbd62){_0x371a64+='\x20'+_0xbd62;}if(_0x371a64!==''){return _0x371a64;}return _0x5d6b89;}function Action(_0x4686e0,_0x2c977f,_0x131bfc){this[_0x0fd1('0x4')]=_0x4686e0;this['uniqueid']=_0x131bfc||undefined;this['name']=checkNameSurname(_0x2c977f[_0x0fd1('0x5')][_0x0fd1('0x6')],_0x2c977f[_0x0fd1('0x5')]['firstName'],_0x2c977f['Contact'][_0x0fd1('0x7')]);this[_0x0fd1('0x8')]=_0x2c977f[_0x0fd1('0x6')];this[_0x0fd1('0x9')]=_0x4686e0[_0x0fd1('0xa')];this[_0x0fd1('0xb')]=_0x2c977f[_0x0fd1('0xb')]||![];this[_0x0fd1('0xc')]=_0x4686e0[_0x0fd1('0xc')];this[_0x0fd1('0xd')]=_0x4686e0['dialQueueTimeout']||0x3;this['scheduledat']=_0x2c977f[_0x0fd1('0xe')];this[_0x0fd1('0xf')]=_0x2c977f[_0x0fd1('0xf')];this[_0x0fd1('0x10')]=_0x2c977f[_0x0fd1('0x10')];this[_0x0fd1('0x11')]=_0x2c977f['countnoanswerretry'];this[_0x0fd1('0x12')]=_0x2c977f[_0x0fd1('0x12')];this[_0x0fd1('0x13')]=_0x2c977f[_0x0fd1('0x13')];this[_0x0fd1('0x14')]=_0x2c977f['countabandonedretry'];this[_0x0fd1('0x15')]=_0x2c977f[_0x0fd1('0x15')];this[_0x0fd1('0x16')]=_0x2c977f['countagentrejectretry'];this[_0x0fd1('0x17')]=_0x2c977f['ContactId'];this['ListId']=_0x2c977f[_0x0fd1('0x18')];this[_0x0fd1('0x19')]=_0x2c977f['UserId'];this[_0x0fd1('0x1a')]=_0x2c977f[_0x0fd1('0x1a')];this['CampaignId']=_0x2c977f[_0x0fd1('0x1b')];this['idHopper']=_0x2c977f['id'];this[_0x0fd1('0x1c')]=_0x2c977f['Contact'][_0x0fd1('0x1d')]||'';this['starttime']=moment()[_0x0fd1('0x1e')](_0x0fd1('0x1f'));this[_0x0fd1('0x20')]=_0x2c977f['callback'];this[_0x0fd1('0x21')]=_0x2c977f['callbackuniqueid'];this[_0x0fd1('0x22')]=_0x2c977f[_0x0fd1('0x22')];this[_0x0fd1('0x23')]=_0x2c977f[_0x0fd1('0x23')];this[_0x0fd1('0x24')]='';this[_0x0fd1('0x25')]='';}Action[_0x0fd1('0x26')][_0x0fd1('0x27')]=function(){return util[_0x0fd1('0x1e')](_0x0fd1('0x28'),this[_0x0fd1('0xa')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x0fd1('0x8')][_0x0fd1('0x29')](this[_0x0fd1('0x4')]['dialCutDigit']):this['number']);};Action['prototype'][_0x0fd1('0x2a')]=function(){return this[_0x0fd1('0x9')];};module[_0x0fd1('0x2b')]=Action; \ No newline at end of file +var _0x05b7=['number','queue','active','type','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName'];(function(_0x126428,_0x36064f){var _0x4f8544=function(_0x38f987){while(--_0x38f987){_0x126428['push'](_0x126428['shift']());}};_0x4f8544(++_0x36064f);}(_0x05b7,0x1c3));var _0x705b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x05b7[_0x2763f2];return _0x3ef471;};'use strict';var util=require(_0x705b('0x0'));var _=require(_0x705b('0x1'));var moment=require(_0x705b('0x2'));function checkNameSurname(_0x56b8fd,_0x42c613,_0x18da95){var _0xc8aa75='';if(!_['isNil'](_0x42c613)&&'string'===typeof _0x42c613){_0xc8aa75+=_0x42c613;}if(!_[_0x705b('0x3')](_0x18da95)&&_0x705b('0x4')===typeof _0x18da95){_0xc8aa75+='\x20'+_0x18da95;}if(_0xc8aa75!==''){return _0xc8aa75;}return _0x56b8fd;}function Action(_0x344092,_0x489be4,_0x1ed8bf){this[_0x705b('0x5')]=_0x344092;this[_0x705b('0x6')]=_0x1ed8bf||undefined;this[_0x705b('0x7')]=checkNameSurname(_0x489be4['Contact'][_0x705b('0x8')],_0x489be4[_0x705b('0x9')]['firstName'],_0x489be4['Contact'][_0x705b('0xa')]);this[_0x705b('0xb')]=_0x489be4[_0x705b('0x8')];this[_0x705b('0xc')]=_0x344092[_0x705b('0x7')];this['active']=_0x489be4[_0x705b('0xd')]||![];this[_0x705b('0xe')]=_0x344092['type'];this['dialQueueTimeout']=_0x344092['dialQueueTimeout']||0x3;this[_0x705b('0xf')]=_0x489be4['scheduledat'];this[_0x705b('0x10')]=_0x489be4[_0x705b('0x10')];this['countcongestionretry']=_0x489be4['countcongestionretry'];this[_0x705b('0x11')]=_0x489be4[_0x705b('0x11')];this['countnosuchnumberretry']=_0x489be4[_0x705b('0x12')];this[_0x705b('0x13')]=_0x489be4['countdropretry'];this[_0x705b('0x14')]=_0x489be4[_0x705b('0x14')];this['countmachineretry']=_0x489be4[_0x705b('0x15')];this['countagentrejectretry']=_0x489be4['countagentrejectretry'];this[_0x705b('0x16')]=_0x489be4[_0x705b('0x16')];this[_0x705b('0x17')]=_0x489be4[_0x705b('0x17')];this[_0x705b('0x18')]=_0x489be4['UserId'];this['VoiceQueueId']=_0x489be4[_0x705b('0x19')];this[_0x705b('0x1a')]=_0x489be4[_0x705b('0x1a')];this['idHopper']=_0x489be4['id'];this[_0x705b('0x1b')]=_0x489be4[_0x705b('0x9')][_0x705b('0x1c')]||'';this[_0x705b('0x1d')]=moment()[_0x705b('0x1e')](_0x705b('0x1f'));this[_0x705b('0x20')]=_0x489be4['callback'];this[_0x705b('0x21')]=_0x489be4[_0x705b('0x21')];this['callbackat']=_0x489be4[_0x705b('0x22')];this[_0x705b('0x23')]=_0x489be4[_0x705b('0x23')];this[_0x705b('0x24')]='';this['originatecalleridname']='';}Action[_0x705b('0x25')]['getCaller']=function(){return util['format'](_0x705b('0x26'),this[_0x705b('0x7')],this[_0x705b('0x5')][_0x705b('0x27')]>0x0?this[_0x705b('0xb')][_0x705b('0x28')](this[_0x705b('0x5')]['dialCutDigit']):this[_0x705b('0xb')]);};Action[_0x705b('0x25')]['getQueue']=function(){return this[_0x705b('0xc')];};module[_0x705b('0x29')]=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 967ec49..72352fc 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 _0x3134=['talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x3134,0x151));var _0x4313=function(_0x7fa74d,_0x4fee19){_0x7fa74d=_0x7fa74d-0x0;var _0x505032=_0x3134[_0x7fa74d];return _0x505032;};'use strict';var moment=require('moment');var utils=require(_0x4313('0x0'));function AgentComplete(_0x1824c9,_0x407d0e){this[_0x4313('0x1')]=0x4;this[_0x4313('0x2')]=_0x4313('0x3');this[_0x4313('0x4')]=_0x1824c9[_0x4313('0x4')];this[_0x4313('0x5')]=_0x1824c9[_0x4313('0x5')];this[_0x4313('0x6')]=_0x1824c9['type']===_0x4313('0x7')?_0x4313('0x8'):_0x1824c9[_0x4313('0x5')];this['countbusyretry']=_0x1824c9[_0x4313('0x9')];this[_0x4313('0xa')]=_0x1824c9[_0x4313('0xa')];this[_0x4313('0xb')]=_0x1824c9[_0x4313('0xb')];this[_0x4313('0xc')]=_0x1824c9[_0x4313('0x9')]+_0x1824c9[_0x4313('0xa')]+_0x1824c9[_0x4313('0xb')]+_0x1824c9['countnosuchnumberretry']+_0x1824c9[_0x4313('0xd')]+_0x1824c9[_0x4313('0xe')]+_0x1824c9[_0x4313('0xf')]+_0x1824c9[_0x4313('0x10')];this[_0x4313('0x11')]=_0x1824c9[_0x4313('0x11')];this[_0x4313('0xd')]=_0x1824c9[_0x4313('0xd')];this[_0x4313('0xe')]=_0x1824c9[_0x4313('0xe')];this[_0x4313('0xf')]=_0x1824c9[_0x4313('0xf')];this[_0x4313('0x10')]=_0x1824c9[_0x4313('0x10')];this['uniqueid']=_0x407d0e[_0x4313('0x12')];this[_0x4313('0x13')]=_0x1824c9[_0x4313('0x14')];this[_0x4313('0x15')]=_0x1824c9[_0x4313('0x16')];this[_0x4313('0x17')]=_0x1824c9['starttime'];this[_0x4313('0x18')]=_0x1824c9[_0x4313('0x18')];this[_0x4313('0x19')]=_0x1824c9[_0x4313('0x19')];this[_0x4313('0x1a')]=moment()['format'](_0x4313('0x1b'));this[_0x4313('0x1c')]=utils[_0x4313('0x1d')](_0x1824c9[_0x4313('0x18')],_0x1824c9[_0x4313('0x17')]);this[_0x4313('0x1e')]=utils[_0x4313('0x1d')](_0x1824c9[_0x4313('0x19')],_0x1824c9['responsetime']);this[_0x4313('0x1f')]=utils[_0x4313('0x1d')](this[_0x4313('0x1a')],_0x1824c9[_0x4313('0x19')]);this[_0x4313('0x8')]=_0x407d0e[_0x4313('0x8')];this['membername']=_0x407d0e['membername'];this['reason']=_0x407d0e[_0x4313('0x20')];this['callback']=_0x1824c9[_0x4313('0x21')];this[_0x4313('0x22')]=_0x1824c9[_0x4313('0x22')];this['callbackat']=_0x1824c9[_0x4313('0x23')];this['recallme']=_0x1824c9[_0x4313('0x24')];this[_0x4313('0x25')]=_0x1824c9[_0x4313('0x25')];this[_0x4313('0x26')]=_0x1824c9[_0x4313('0x26')];this[_0x4313('0x27')]=_0x1824c9[_0x4313('0x27')];this['VoiceQueueId']=_0x1824c9[_0x4313('0x28')];this[_0x4313('0x29')]=_0x1824c9[_0x4313('0x29')];this[_0x4313('0x2a')]=_0x1824c9['originatecalleridnum']||'';this['originatecalleridname']=_0x1824c9[_0x4313('0x2b')]||'';this[_0x4313('0x2c')]=_0x1824c9['agiafterat'];}module[_0x4313('0x2d')]=AgentComplete; \ No newline at end of file +var _0x56e9=['state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x56e9,0x10c));var _0x956e=function(_0x16438a,_0x3544be){_0x16438a=_0x16438a-0x0;var _0x9d2e74=_0x56e9[_0x16438a];return _0x9d2e74;};'use strict';var moment=require(_0x956e('0x0'));var utils=require(_0x956e('0x1'));function AgentComplete(_0xe99a48,_0x46ca4c){this[_0x956e('0x2')]=0x4;this[_0x956e('0x3')]='Answer';this[_0x956e('0x4')]=_0xe99a48[_0x956e('0x4')];this['type']=_0xe99a48[_0x956e('0x5')];this[_0x956e('0x6')]=_0xe99a48[_0x956e('0x5')]===_0x956e('0x7')?_0x956e('0x8'):_0xe99a48[_0x956e('0x5')];this[_0x956e('0x9')]=_0xe99a48['countbusyretry'];this[_0x956e('0xa')]=_0xe99a48['countcongestionretry'];this['countnoanswerretry']=_0xe99a48[_0x956e('0xb')];this[_0x956e('0xc')]=_0xe99a48['countbusyretry']+_0xe99a48[_0x956e('0xa')]+_0xe99a48[_0x956e('0xb')]+_0xe99a48[_0x956e('0xd')]+_0xe99a48['countdropretry']+_0xe99a48[_0x956e('0xe')]+_0xe99a48['countmachineretry']+_0xe99a48[_0x956e('0xf')];this[_0x956e('0xd')]=_0xe99a48[_0x956e('0xd')];this['countdropretry']=_0xe99a48[_0x956e('0x10')];this[_0x956e('0xe')]=_0xe99a48[_0x956e('0xe')];this[_0x956e('0x11')]=_0xe99a48[_0x956e('0x11')];this[_0x956e('0xf')]=_0xe99a48[_0x956e('0xf')];this[_0x956e('0x12')]=_0x46ca4c['uniqueid'];this[_0x956e('0x13')]=_0xe99a48[_0x956e('0x14')];this[_0x956e('0x15')]=_0xe99a48[_0x956e('0x16')];this[_0x956e('0x17')]=_0xe99a48[_0x956e('0x17')];this[_0x956e('0x18')]=_0xe99a48[_0x956e('0x18')];this['answertime']=_0xe99a48[_0x956e('0x19')];this[_0x956e('0x1a')]=moment()['format'](_0x956e('0x1b'));this[_0x956e('0x1c')]=utils[_0x956e('0x1d')](_0xe99a48['responsetime'],_0xe99a48[_0x956e('0x17')]);this['holdtime']=utils[_0x956e('0x1d')](_0xe99a48[_0x956e('0x19')],_0xe99a48[_0x956e('0x18')]);this[_0x956e('0x1e')]=utils[_0x956e('0x1d')](this[_0x956e('0x1a')],_0xe99a48['answertime']);this['queue']=_0x46ca4c[_0x956e('0x8')];this[_0x956e('0x1f')]=_0x46ca4c[_0x956e('0x1f')];this[_0x956e('0x20')]=_0x46ca4c[_0x956e('0x20')];this['callback']=_0xe99a48['callback'];this[_0x956e('0x21')]=_0xe99a48[_0x956e('0x21')];this['callbackat']=_0xe99a48[_0x956e('0x22')];this['recallme']=_0xe99a48[_0x956e('0x23')];this[_0x956e('0x24')]=_0xe99a48[_0x956e('0x24')];this[_0x956e('0x25')]=_0xe99a48['ListId'];this[_0x956e('0x26')]=_0xe99a48[_0x956e('0x26')];this[_0x956e('0x27')]=_0xe99a48['VoiceQueueId'];this['CampaignId']=_0xe99a48[_0x956e('0x28')];this[_0x956e('0x29')]=_0xe99a48['originatecalleridnum']||'';this[_0x956e('0x2a')]=_0xe99a48[_0x956e('0x2a')]||'';this[_0x956e('0x2b')]=_0xe99a48[_0x956e('0x2b')];}module[_0x956e('0x2c')]=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 094f021..c0233b0 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 _0x2b96=['CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x2b96,0x149));var _0x62b9=function(_0x49cba4,_0x10ede8){_0x49cba4=_0x49cba4-0x0;var _0x1efbc7=_0x2b96[_0x49cba4];return _0x1efbc7;};'use strict';function Final(_0x4c0a11){this[_0x62b9('0x0')]=_0x4c0a11[_0x62b9('0x0')];this[_0x62b9('0x1')]=_0x4c0a11[_0x62b9('0x1')];this[_0x62b9('0x2')]=_0x4c0a11[_0x62b9('0x2')];this[_0x62b9('0x3')]=_0x4c0a11[_0x62b9('0x2')]===_0x62b9('0x4')?'queue':_0x4c0a11[_0x62b9('0x2')];this[_0x62b9('0x5')]=_0x4c0a11['countbusyretry'];this[_0x62b9('0x6')]=_0x4c0a11[_0x62b9('0x6')];this[_0x62b9('0x7')]=_0x4c0a11[_0x62b9('0x7')];this[_0x62b9('0x8')]=_0x4c0a11[_0x62b9('0x5')]+_0x4c0a11['countcongestionretry']+_0x4c0a11[_0x62b9('0x7')]+_0x4c0a11[_0x62b9('0x9')]+_0x4c0a11[_0x62b9('0xa')]+_0x4c0a11['countabandonedretry']+_0x4c0a11['countmachineretry']+_0x4c0a11[_0x62b9('0xb')];this['countnosuchnumberretry']=_0x4c0a11['countnosuchnumberretry'];this['countdropretry']=_0x4c0a11[_0x62b9('0xa')];this[_0x62b9('0xc')]=_0x4c0a11[_0x62b9('0xc')];this[_0x62b9('0xd')]=_0x4c0a11[_0x62b9('0xd')];this[_0x62b9('0xb')]=_0x4c0a11['countagentrejectretry'];this[_0x62b9('0xe')]=_0x4c0a11[_0x62b9('0xe')];this['calleridname']=_0x4c0a11[_0x62b9('0xf')];this[_0x62b9('0x10')]=_0x4c0a11[_0x62b9('0x10')];this[_0x62b9('0x11')]=_0x4c0a11[_0x62b9('0x11')];this[_0x62b9('0x12')]=_0x4c0a11[_0x62b9('0x12')];this[_0x62b9('0x13')]=_0x4c0a11[_0x62b9('0x12')];this[_0x62b9('0x14')]=_0x4c0a11['ringtime']||0x0;this[_0x62b9('0x15')]=_0x4c0a11['holdtime']||0x0;this['talktime']=_0x4c0a11[_0x62b9('0x16')]||0x0;this['callback']=_0x4c0a11[_0x62b9('0x17')];this[_0x62b9('0x18')]=_0x4c0a11[_0x62b9('0x18')];this[_0x62b9('0x19')]=_0x4c0a11[_0x62b9('0x19')];this[_0x62b9('0x1a')]=_0x4c0a11[_0x62b9('0x1a')];this[_0x62b9('0x1b')]=_0x4c0a11[_0x62b9('0x1b')];this[_0x62b9('0x1c')]=_0x4c0a11[_0x62b9('0x1c')];this['UserId']=_0x4c0a11[_0x62b9('0x1d')];this[_0x62b9('0x1e')]=_0x4c0a11[_0x62b9('0x1e')];this[_0x62b9('0x1f')]=_0x4c0a11[_0x62b9('0x1f')];this['originatecalleridnum']=_0x4c0a11[_0x62b9('0x20')]||'';this['originatecalleridname']=_0x4c0a11[_0x62b9('0x21')]||'';this[_0x62b9('0x22')]=_0x4c0a11[_0x62b9('0x22')];this['statedesc']=_0x4c0a11['statedesc'];}module[_0x62b9('0x23')]=Final; \ No newline at end of file +var _0x4559=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid'];(function(_0x2c10b8,_0x5ed5a3){var _0x2a58f8=function(_0x1be8c0){while(--_0x1be8c0){_0x2c10b8['push'](_0x2c10b8['shift']());}};_0x2a58f8(++_0x5ed5a3);}(_0x4559,0x13a));var _0x9455=function(_0x2f0f28,_0x37df9c){_0x2f0f28=_0x2f0f28-0x0;var _0x13b38e=_0x4559[_0x2f0f28];return _0x13b38e;};'use strict';function Final(_0x56a3b3){this[_0x9455('0x0')]=_0x56a3b3[_0x9455('0x0')];this[_0x9455('0x1')]=_0x56a3b3['scheduledat'];this['type']=_0x56a3b3[_0x9455('0x2')];this['campaigntype']=_0x56a3b3[_0x9455('0x2')]===_0x9455('0x3')?_0x9455('0x4'):_0x56a3b3[_0x9455('0x2')];this[_0x9455('0x5')]=_0x56a3b3['countbusyretry'];this[_0x9455('0x6')]=_0x56a3b3[_0x9455('0x6')];this[_0x9455('0x7')]=_0x56a3b3[_0x9455('0x7')];this[_0x9455('0x8')]=_0x56a3b3[_0x9455('0x5')]+_0x56a3b3[_0x9455('0x6')]+_0x56a3b3[_0x9455('0x7')]+_0x56a3b3[_0x9455('0x9')]+_0x56a3b3['countdropretry']+_0x56a3b3[_0x9455('0xa')]+_0x56a3b3[_0x9455('0xb')]+_0x56a3b3['countagentrejectretry'];this['countnosuchnumberretry']=_0x56a3b3[_0x9455('0x9')];this[_0x9455('0xc')]=_0x56a3b3[_0x9455('0xc')];this[_0x9455('0xa')]=_0x56a3b3[_0x9455('0xa')];this['countmachineretry']=_0x56a3b3[_0x9455('0xb')];this[_0x9455('0xd')]=_0x56a3b3[_0x9455('0xd')];this[_0x9455('0x4')]=_0x56a3b3[_0x9455('0x4')];this['calleridname']=_0x56a3b3[_0x9455('0xe')];this['calleridnum']=_0x56a3b3[_0x9455('0xf')];this['starttime']=_0x56a3b3[_0x9455('0x10')];this['responsetime']=_0x56a3b3[_0x9455('0x11')];this[_0x9455('0x12')]=_0x56a3b3['responsetime'];this[_0x9455('0x13')]=_0x56a3b3[_0x9455('0x13')]||0x0;this[_0x9455('0x14')]=_0x56a3b3[_0x9455('0x14')]||0x0;this[_0x9455('0x15')]=_0x56a3b3[_0x9455('0x15')]||0x0;this[_0x9455('0x16')]=_0x56a3b3['callback'];this[_0x9455('0x17')]=_0x56a3b3[_0x9455('0x17')];this[_0x9455('0x18')]=_0x56a3b3[_0x9455('0x18')];this['recallme']=_0x56a3b3[_0x9455('0x19')];this['ContactId']=_0x56a3b3[_0x9455('0x1a')];this['ListId']=_0x56a3b3[_0x9455('0x1b')];this[_0x9455('0x1c')]=_0x56a3b3[_0x9455('0x1c')];this['VoiceQueueId']=_0x56a3b3[_0x9455('0x1d')];this[_0x9455('0x1e')]=_0x56a3b3['CampaignId'];this['originatecalleridnum']=_0x56a3b3['originatecalleridnum']||'';this[_0x9455('0x1f')]=_0x56a3b3['originatecalleridname']||'';this['state']=_0x56a3b3[_0x9455('0x20')];this['statedesc']=_0x56a3b3[_0x9455('0x21')];}module[_0x9455('0x22')]=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 490b93f..56e6e90 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 _0x83ac=['ringtime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x83ac,0xbb));var _0xc83a=function(_0x1febb4,_0xe09531){_0x1febb4=_0x1febb4-0x0;var _0xa9d95c=_0x83ac[_0x1febb4];return _0xa9d95c;};'use strict';var moment=require(_0xc83a('0x0'));var utils=require(_0xc83a('0x1'));function Hangup(_0x1672f7,_0x3e57b8){this[_0xc83a('0x2')]=0x4;this[_0xc83a('0x3')]=_0xc83a('0x4');this[_0xc83a('0x5')]=_0x1672f7[_0xc83a('0x5')];this[_0xc83a('0x6')]=_0x1672f7[_0xc83a('0x6')];this[_0xc83a('0x7')]=_0x1672f7[_0xc83a('0x6')]===_0xc83a('0x8')?_0xc83a('0x9'):_0x1672f7[_0xc83a('0x6')];this['amd']=_0x1672f7['amd']||![];this[_0xc83a('0xa')]=_0x1672f7[_0xc83a('0xa')];this['countcongestionretry']=_0x1672f7[_0xc83a('0xb')];this['countnoanswerretry']=_0x1672f7[_0xc83a('0xc')];this[_0xc83a('0xd')]=_0x1672f7[_0xc83a('0xa')]+_0x1672f7['countcongestionretry']+_0x1672f7['countnoanswerretry']+_0x1672f7[_0xc83a('0xe')]+_0x1672f7[_0xc83a('0xf')]+_0x1672f7[_0xc83a('0x10')]+_0x1672f7['countmachineretry']+_0x1672f7[_0xc83a('0x11')];this[_0xc83a('0xe')]=_0x1672f7[_0xc83a('0xe')];this['countdropretry']=_0x1672f7[_0xc83a('0xf')];this[_0xc83a('0x10')]=_0x1672f7['countabandonedretry'];this[_0xc83a('0x12')]=_0x1672f7[_0xc83a('0x12')];this['countagentrejectretry']=_0x1672f7['countagentrejectretry'];this['uniqueid']=_0x3e57b8[_0xc83a('0x13')];this[_0xc83a('0x14')]=_0x1672f7[_0xc83a('0x15')];this[_0xc83a('0x16')]=_0x1672f7[_0xc83a('0x17')];this[_0xc83a('0x18')]=_0x1672f7['starttime'];this[_0xc83a('0x19')]=_0x1672f7['responsetime'];this[_0xc83a('0x1a')]=moment()[_0xc83a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc83a('0x1c')]=utils[_0xc83a('0x1d')](_0x1672f7[_0xc83a('0x19')],_0x1672f7[_0xc83a('0x18')]);this['holdtime']=0x0;this['talktime']=utils[_0xc83a('0x1d')](this[_0xc83a('0x1a')],_0x1672f7[_0xc83a('0x19')]);this[_0xc83a('0x9')]=_0x1672f7[_0xc83a('0x9')];this[_0xc83a('0x1e')]=_0xc83a('0x1f');this[_0xc83a('0x20')]=_0x3e57b8[_0xc83a('0x21')];this[_0xc83a('0x22')]=_0x1672f7['callback'];this[_0xc83a('0x23')]=_0x1672f7[_0xc83a('0x23')];this[_0xc83a('0x24')]=_0x1672f7[_0xc83a('0x24')];this[_0xc83a('0x25')]=_0x1672f7[_0xc83a('0x25')];this['ContactId']=_0x1672f7[_0xc83a('0x26')];this[_0xc83a('0x27')]=_0x1672f7[_0xc83a('0x27')];this['UserId']=_0x1672f7[_0xc83a('0x28')];this[_0xc83a('0x29')]=_0x1672f7[_0xc83a('0x29')];this['CampaignId']=_0x1672f7[_0xc83a('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0xe905=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','IVR'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xe905,0x147));var _0x5e90=function(_0x476ccf,_0x5cd3cf){_0x476ccf=_0x476ccf-0x0;var _0x223814=_0xe905[_0x476ccf];return _0x223814;};'use strict';var moment=require(_0x5e90('0x0'));var utils=require(_0x5e90('0x1'));function Hangup(_0x597595,_0x5c83fd){this['state']=0x4;this[_0x5e90('0x2')]='Answer';this[_0x5e90('0x3')]=_0x597595[_0x5e90('0x3')];this[_0x5e90('0x4')]=_0x597595[_0x5e90('0x4')];this[_0x5e90('0x5')]=_0x597595[_0x5e90('0x4')]===_0x5e90('0x6')?_0x5e90('0x7'):_0x597595[_0x5e90('0x4')];this[_0x5e90('0x8')]=_0x597595[_0x5e90('0x8')]||![];this[_0x5e90('0x9')]=_0x597595[_0x5e90('0x9')];this[_0x5e90('0xa')]=_0x597595[_0x5e90('0xa')];this[_0x5e90('0xb')]=_0x597595[_0x5e90('0xb')];this[_0x5e90('0xc')]=_0x597595[_0x5e90('0x9')]+_0x597595[_0x5e90('0xa')]+_0x597595[_0x5e90('0xb')]+_0x597595[_0x5e90('0xd')]+_0x597595[_0x5e90('0xe')]+_0x597595[_0x5e90('0xf')]+_0x597595[_0x5e90('0x10')]+_0x597595[_0x5e90('0x11')];this['countnosuchnumberretry']=_0x597595['countnosuchnumberretry'];this['countdropretry']=_0x597595[_0x5e90('0xe')];this[_0x5e90('0xf')]=_0x597595[_0x5e90('0xf')];this[_0x5e90('0x10')]=_0x597595['countmachineretry'];this[_0x5e90('0x11')]=_0x597595['countagentrejectretry'];this['uniqueid']=_0x5c83fd[_0x5e90('0x12')];this[_0x5e90('0x13')]=_0x597595[_0x5e90('0x14')];this[_0x5e90('0x15')]=_0x597595[_0x5e90('0x16')];this[_0x5e90('0x17')]=_0x597595['starttime'];this[_0x5e90('0x18')]=_0x597595[_0x5e90('0x18')];this[_0x5e90('0x19')]=moment()[_0x5e90('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5e90('0x1b')]=utils[_0x5e90('0x1c')](_0x597595[_0x5e90('0x18')],_0x597595[_0x5e90('0x17')]);this[_0x5e90('0x1d')]=0x0;this[_0x5e90('0x1e')]=utils[_0x5e90('0x1c')](this[_0x5e90('0x19')],_0x597595[_0x5e90('0x18')]);this[_0x5e90('0x7')]=_0x597595[_0x5e90('0x7')];this[_0x5e90('0x1f')]=_0x5e90('0x20');this[_0x5e90('0x21')]=_0x5c83fd[_0x5e90('0x22')];this[_0x5e90('0x23')]=_0x597595[_0x5e90('0x23')];this[_0x5e90('0x24')]=_0x597595[_0x5e90('0x24')];this['callbackat']=_0x597595[_0x5e90('0x25')];this[_0x5e90('0x26')]=_0x597595[_0x5e90('0x26')];this[_0x5e90('0x27')]=_0x597595[_0x5e90('0x27')];this['ListId']=_0x597595[_0x5e90('0x28')];this[_0x5e90('0x29')]=_0x597595[_0x5e90('0x29')];this[_0x5e90('0x2a')]=_0x597595[_0x5e90('0x2a')];this[_0x5e90('0x2b')]=_0x597595['CampaignId'];}module[_0x5e90('0x2c')]=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 34493ee..bd5b8e7 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 _0xd7e2=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xd7e2,0xe1));var _0x2d7e=function(_0x326110,_0x5588e4){_0x326110=_0x326110-0x0;var _0x367dcc=_0xd7e2[_0x326110];return _0x367dcc;};'use strict';var utils=require(_0x2d7e('0x0'));function History(_0xafbc5d){this[_0x2d7e('0x1')]=_0xafbc5d['uniqueid'];this[_0x2d7e('0x2')]=_0xafbc5d[_0x2d7e('0x2')]||undefined;this['type']=_0xafbc5d[_0x2d7e('0x3')];this['campaigntype']=_0xafbc5d[_0x2d7e('0x3')]==='outbound'?_0x2d7e('0x4'):_0xafbc5d['type'];this[_0x2d7e('0x5')]=_0xafbc5d[_0x2d7e('0x5')];this[_0x2d7e('0x6')]=_0xafbc5d[_0x2d7e('0x6')];this[_0x2d7e('0x7')]=_0xafbc5d['countnoanswerretry'];this['countglobal']=_0xafbc5d[_0x2d7e('0x5')]+_0xafbc5d[_0x2d7e('0x6')]+_0xafbc5d['countnoanswerretry']+_0xafbc5d[_0x2d7e('0x8')]+_0xafbc5d['countdropretry']+_0xafbc5d['countabandonedretry']+_0xafbc5d['countmachineretry']+_0xafbc5d[_0x2d7e('0x9')];this[_0x2d7e('0x8')]=_0xafbc5d[_0x2d7e('0x8')];this[_0x2d7e('0xa')]=_0xafbc5d['countdropretry'];this[_0x2d7e('0xb')]=_0xafbc5d[_0x2d7e('0xb')];this['countmachineretry']=_0xafbc5d[_0x2d7e('0xc')];this['countagentrejectretry']=_0xafbc5d['countagentrejectretry'];this[_0x2d7e('0x4')]=_0xafbc5d['queue'];this[_0x2d7e('0xd')]=_0xafbc5d['name'];this[_0x2d7e('0xe')]=_0xafbc5d[_0x2d7e('0xf')];this[_0x2d7e('0x10')]=_0xafbc5d[_0x2d7e('0x10')];this[_0x2d7e('0x11')]=_0xafbc5d[_0x2d7e('0x11')];this[_0x2d7e('0x12')]=_0xafbc5d['responsetime'];this[_0x2d7e('0x13')]=utils['getSeconds'](_0xafbc5d[_0x2d7e('0x11')],_0xafbc5d['starttime']);this['holdtime']=0x0;this[_0x2d7e('0x14')]=0x0;this[_0x2d7e('0x15')]=_0xafbc5d[_0x2d7e('0x15')];this[_0x2d7e('0x16')]=_0xafbc5d[_0x2d7e('0x16')];this[_0x2d7e('0x17')]=_0xafbc5d[_0x2d7e('0x17')];this[_0x2d7e('0x18')]=_0xafbc5d[_0x2d7e('0x18')];this[_0x2d7e('0x19')]=_0xafbc5d[_0x2d7e('0x19')];this[_0x2d7e('0x1a')]=_0xafbc5d[_0x2d7e('0x1a')];this['UserId']=_0xafbc5d[_0x2d7e('0x1b')];this[_0x2d7e('0x1c')]=_0xafbc5d[_0x2d7e('0x1c')];this[_0x2d7e('0x1d')]=_0xafbc5d['CampaignId'];this[_0x2d7e('0x1e')]=_0xafbc5d[_0x2d7e('0x1e')]||'';this[_0x2d7e('0x1f')]=_0xafbc5d[_0x2d7e('0x1f')]||'';this[_0x2d7e('0x20')]=_0xafbc5d['state'];this[_0x2d7e('0x21')]=_0xafbc5d['statedesc'];}module[_0x2d7e('0x22')]=History; \ No newline at end of file +var _0xa846=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','getSeconds','holdtime'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0xa846,0x183));var _0x6a84=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0xa846[_0x244e2d];return _0x3df084;};'use strict';var utils=require('../utils');function History(_0xf5eda8){this['uniqueid']=_0xf5eda8[_0x6a84('0x0')];this['scheduledat']=_0xf5eda8[_0x6a84('0x1')]||undefined;this[_0x6a84('0x2')]=_0xf5eda8['type'];this[_0x6a84('0x3')]=_0xf5eda8[_0x6a84('0x2')]===_0x6a84('0x4')?_0x6a84('0x5'):_0xf5eda8[_0x6a84('0x2')];this['countbusyretry']=_0xf5eda8['countbusyretry'];this['countcongestionretry']=_0xf5eda8['countcongestionretry'];this[_0x6a84('0x6')]=_0xf5eda8[_0x6a84('0x6')];this[_0x6a84('0x7')]=_0xf5eda8['countbusyretry']+_0xf5eda8[_0x6a84('0x8')]+_0xf5eda8[_0x6a84('0x6')]+_0xf5eda8[_0x6a84('0x9')]+_0xf5eda8[_0x6a84('0xa')]+_0xf5eda8[_0x6a84('0xb')]+_0xf5eda8[_0x6a84('0xc')]+_0xf5eda8['countagentrejectretry'];this[_0x6a84('0x9')]=_0xf5eda8[_0x6a84('0x9')];this[_0x6a84('0xa')]=_0xf5eda8[_0x6a84('0xa')];this[_0x6a84('0xb')]=_0xf5eda8['countabandonedretry'];this[_0x6a84('0xc')]=_0xf5eda8['countmachineretry'];this['countagentrejectretry']=_0xf5eda8[_0x6a84('0xd')];this['queue']=_0xf5eda8[_0x6a84('0x5')];this[_0x6a84('0xe')]=_0xf5eda8['name'];this['calleridnum']=_0xf5eda8[_0x6a84('0xf')];this['starttime']=_0xf5eda8[_0x6a84('0x10')];this[_0x6a84('0x11')]=_0xf5eda8[_0x6a84('0x11')];this[_0x6a84('0x12')]=_0xf5eda8['responsetime'];this['ringtime']=utils[_0x6a84('0x13')](_0xf5eda8[_0x6a84('0x11')],_0xf5eda8[_0x6a84('0x10')]);this[_0x6a84('0x14')]=0x0;this['talktime']=0x0;this[_0x6a84('0x15')]=_0xf5eda8[_0x6a84('0x15')];this[_0x6a84('0x16')]=_0xf5eda8[_0x6a84('0x16')];this[_0x6a84('0x17')]=_0xf5eda8[_0x6a84('0x17')];this[_0x6a84('0x18')]=_0xf5eda8[_0x6a84('0x18')];this[_0x6a84('0x19')]=_0xf5eda8[_0x6a84('0x19')];this[_0x6a84('0x1a')]=_0xf5eda8[_0x6a84('0x1a')];this[_0x6a84('0x1b')]=_0xf5eda8[_0x6a84('0x1b')];this['VoiceQueueId']=_0xf5eda8['VoiceQueueId'];this[_0x6a84('0x1c')]=_0xf5eda8[_0x6a84('0x1c')];this[_0x6a84('0x1d')]=_0xf5eda8[_0x6a84('0x1d')]||'';this[_0x6a84('0x1e')]=_0xf5eda8[_0x6a84('0x1e')]||'';this[_0x6a84('0x1f')]=_0xf5eda8[_0x6a84('0x1f')];this[_0x6a84('0x20')]=_0xf5eda8[_0x6a84('0x20')];}module[_0x6a84('0x21')]=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 41bf957..bf406b7 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 _0x0624=['../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports'];(function(_0x1c0b34,_0x425ab7){var _0x148223=function(_0x5092fa){while(--_0x5092fa){_0x1c0b34['push'](_0x1c0b34['shift']());}};_0x148223(++_0x425ab7);}(_0x0624,0x126));var _0x4062=function(_0x588a3c,_0xec73a8){_0x588a3c=_0x588a3c-0x0;var _0x257904=_0x0624[_0x588a3c];return _0x257904;};'use strict';var utils=require(_0x4062('0x0'));function QueueCallerAbandon(_0x1c9602,_0x27a07a){this[_0x4062('0x1')]=_0x1c9602[_0x4062('0x1')];this['type']=_0x1c9602[_0x4062('0x2')];this[_0x4062('0x3')]=_0x1c9602[_0x4062('0x2')]===_0x4062('0x4')?_0x4062('0x5'):_0x1c9602[_0x4062('0x2')];this[_0x4062('0x6')]=_0x1c9602[_0x4062('0x6')];this[_0x4062('0x7')]=_0x1c9602['countcongestionretry'];this[_0x4062('0x8')]=_0x1c9602[_0x4062('0x8')];this['countglobal']=_0x1c9602['countbusyretry']+_0x1c9602['countcongestionretry']+_0x1c9602[_0x4062('0x8')]+_0x1c9602[_0x4062('0x9')]+_0x1c9602[_0x4062('0xa')]+_0x1c9602[_0x4062('0xb')]+_0x1c9602['countmachineretry']+_0x1c9602[_0x4062('0xc')];this[_0x4062('0x9')]=_0x1c9602[_0x4062('0x9')];this[_0x4062('0xa')]=_0x1c9602[_0x4062('0xa')];this['countabandonedretry']=_0x1c9602[_0x4062('0xb')];this[_0x4062('0xd')]=_0x1c9602['countmachineretry'];this[_0x4062('0xc')]=_0x1c9602[_0x4062('0xc')];this[_0x4062('0xe')]=_0x27a07a['uniqueid'];this['calleridname']=_0x1c9602[_0x4062('0xf')];this['calleridnum']=_0x1c9602[_0x4062('0x10')];this[_0x4062('0x11')]=_0x1c9602[_0x4062('0x11')];this[_0x4062('0x12')]=_0x1c9602['responsetime'];this[_0x4062('0x13')]=_0x1c9602[_0x4062('0x13')];this[_0x4062('0x14')]=_0x1c9602[_0x4062('0x14')];this[_0x4062('0x15')]=this[_0x4062('0x13')];this[_0x4062('0x16')]=utils['getSeconds'](_0x1c9602[_0x4062('0x12')],_0x1c9602[_0x4062('0x11')]);this[_0x4062('0x17')]=utils['getSeconds'](this[_0x4062('0x13')],_0x1c9602[_0x4062('0x12')]);this[_0x4062('0x18')]=0x0;this[_0x4062('0x5')]=_0x27a07a[_0x4062('0x5')];this[_0x4062('0x19')]=_0x27a07a[_0x4062('0x1a')];this['reason']=_0x27a07a['reason'];this[_0x4062('0x1b')]=_0x1c9602['callback'];this[_0x4062('0x1c')]=_0x1c9602[_0x4062('0x1c')];this[_0x4062('0x1d')]=_0x1c9602[_0x4062('0x1d')];this[_0x4062('0x1e')]=_0x1c9602[_0x4062('0x1e')];this['ContactId']=_0x1c9602[_0x4062('0x1f')];this[_0x4062('0x20')]=_0x1c9602['ListId'];this[_0x4062('0x21')]=_0x1c9602[_0x4062('0x21')];this['VoiceQueueId']=_0x1c9602[_0x4062('0x22')];this[_0x4062('0x23')]=_0x1c9602['CampaignId'];this[_0x4062('0x24')]=_0x1c9602[_0x4062('0x24')]||'';this[_0x4062('0x25')]=_0x1c9602['originatecalleridname']||'';this[_0x4062('0x26')]=_0x1c9602[_0x4062('0x26')];this[_0x4062('0x27')]=_0x1c9602[_0x4062('0x27')];this[_0x4062('0x28')]=_0x1c9602['statedesc'];}module[_0x4062('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x66d8=['originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66d8,0x1a8));var _0x866d=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x66d8[_0x529f1c];return _0x4d57ab;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1c4921,_0xcde37d){this['scheduledat']=_0x1c4921[_0x866d('0x0')];this[_0x866d('0x1')]=_0x1c4921['type'];this[_0x866d('0x2')]=_0x1c4921[_0x866d('0x1')]==='outbound'?'queue':_0x1c4921[_0x866d('0x1')];this[_0x866d('0x3')]=_0x1c4921[_0x866d('0x3')];this[_0x866d('0x4')]=_0x1c4921[_0x866d('0x4')];this['countnoanswerretry']=_0x1c4921[_0x866d('0x5')];this[_0x866d('0x6')]=_0x1c4921['countbusyretry']+_0x1c4921[_0x866d('0x4')]+_0x1c4921[_0x866d('0x5')]+_0x1c4921[_0x866d('0x7')]+_0x1c4921[_0x866d('0x8')]+_0x1c4921[_0x866d('0x9')]+_0x1c4921[_0x866d('0xa')]+_0x1c4921[_0x866d('0xb')];this['countnosuchnumberretry']=_0x1c4921[_0x866d('0x7')];this['countdropretry']=_0x1c4921['countdropretry'];this[_0x866d('0x9')]=_0x1c4921[_0x866d('0x9')];this[_0x866d('0xa')]=_0x1c4921[_0x866d('0xa')];this[_0x866d('0xb')]=_0x1c4921[_0x866d('0xb')];this['uniqueid']=_0xcde37d[_0x866d('0xc')];this[_0x866d('0xd')]=_0x1c4921[_0x866d('0xe')];this[_0x866d('0xf')]=_0x1c4921[_0x866d('0x10')];this[_0x866d('0x11')]=_0x1c4921[_0x866d('0x11')];this['responsetime']=_0x1c4921[_0x866d('0x12')];this[_0x866d('0x13')]=_0x1c4921[_0x866d('0x13')];this[_0x866d('0x14')]=_0x1c4921[_0x866d('0x14')];this[_0x866d('0x15')]=this['droptime'];this[_0x866d('0x16')]=utils['getSeconds'](_0x1c4921[_0x866d('0x12')],_0x1c4921[_0x866d('0x11')]);this[_0x866d('0x17')]=utils[_0x866d('0x18')](this['droptime'],_0x1c4921['responsetime']);this['talktime']=0x0;this[_0x866d('0x19')]=_0xcde37d[_0x866d('0x19')];this[_0x866d('0x1a')]=_0xcde37d[_0x866d('0x1b')];this[_0x866d('0x1c')]=_0xcde37d[_0x866d('0x1c')];this[_0x866d('0x1d')]=_0x1c4921[_0x866d('0x1d')];this[_0x866d('0x1e')]=_0x1c4921[_0x866d('0x1e')];this[_0x866d('0x1f')]=_0x1c4921[_0x866d('0x1f')];this[_0x866d('0x20')]=_0x1c4921[_0x866d('0x20')];this['ContactId']=_0x1c4921['ContactId'];this[_0x866d('0x21')]=_0x1c4921[_0x866d('0x21')];this[_0x866d('0x22')]=_0x1c4921[_0x866d('0x22')];this[_0x866d('0x23')]=_0x1c4921[_0x866d('0x23')];this[_0x866d('0x24')]=_0x1c4921[_0x866d('0x24')];this[_0x866d('0x25')]=_0x1c4921[_0x866d('0x25')]||'';this[_0x866d('0x26')]=_0x1c4921[_0x866d('0x26')]||'';this[_0x866d('0x27')]=_0x1c4921[_0x866d('0x27')];this[_0x866d('0x28')]=_0x1c4921['state'];this[_0x866d('0x29')]=_0x1c4921[_0x866d('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index b9cc273..844a898 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 _0xe2fe=['[countReScheduled]','countReScheduled','[rescheduleContact]','unlockContact','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','error','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xee2f('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xee2f('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xee2f('0x2'));var cmHopperHistory=require(_0xee2f('0x3'));function inspectError(_0xe5ad8a){return util[_0xee2f('0x4')](_0xe5ad8a,{'showHidden':![],'depth':null});}function getContactDialer(_0xcb45e6,_0x4ba89f,_0x311a2f){return cmHopper[_0xee2f('0x5')](_0xcb45e6['id'],_0x4ba89f,_0x311a2f,_0xcb45e6['dialOrderByScheduledAt'])[_0xee2f('0x6')](function(_0x2e1c8c){_0xcb45e6['temp']=0x0;logger[_0xee2f('0x7')]('[getContactDialer]',inspectError(_0x2e1c8c));});}exports[_0xee2f('0x5')]=getContactDialer;function getContactDialerIvr(_0x36920f,_0x53f7dd){return cmHopper[_0xee2f('0x8')](_0x36920f['id'],_0x53f7dd,_0x36920f[_0xee2f('0x9')])['catch'](function(_0x5597ea){_0x36920f['temp']=0x0;logger['error'](_0xee2f('0xa'),inspectError(_0x5597ea));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x481ea7){return cmHopper['countReScheduled'](_0x481ea7)[_0xee2f('0x6')](function(_0x346dbc){logger[_0xee2f('0x7')](_0xee2f('0xb'),inspectError(_0x346dbc));});}exports[_0xee2f('0xc')]=countReScheduled;function rescheduleContact(_0x3ab91f){return cmHopper['rescheduleContact'](_0x3ab91f)[_0xee2f('0x6')](function(_0x531c3a){logger[_0xee2f('0x7')](_0xee2f('0xd'),inspectError(_0x531c3a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x445ba8,_0x145241,_0x28b614){return cmHopper[_0xee2f('0xe')](_0x445ba8,_0x145241,_0x28b614)[_0xee2f('0x6')](function(_0x58f42a){logger[_0xee2f('0x7')]('[unlockContact]',inspectError(_0x58f42a));});}exports[_0xee2f('0xe')]=unlockContact;function moveContactManagedDialer(_0x3359ff){return cmHopper['moveContactManagedDialer'](_0x3359ff)['catch'](function(_0x40b5bc){logger['error'](_0xee2f('0xf'),inspectError(_0x40b5bc));});}exports[_0xee2f('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x28549d){return cmHopperBlack['checkIsBlackList'](_0x28549d)[_0xee2f('0x6')](function(_0x1e70aa){logger[_0xee2f('0x7')](_0xee2f('0x11'),inspectError(_0x1e70aa));});}exports[_0xee2f('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x5d36d4){return cmHopperBlack['checkIsBlackListIvr'](_0x5d36d4)[_0xee2f('0x6')](function(_0x3a1852){logger[_0xee2f('0x7')](_0xee2f('0x13'),inspectError(_0x3a1852));});}exports[_0xee2f('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xf278cc,_0x39a39c,_0x4d68d3){return cmHopperAdditionalPhone[_0xee2f('0x15')](_0xf278cc,_0x39a39c,_0x4d68d3)[_0xee2f('0x6')](function(_0x15ceda){logger[_0xee2f('0x7')](_0xee2f('0x16'),inspectError(_0x15ceda));});}exports[_0xee2f('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x15a1b1,_0x13013f,_0x382174){return cmHopperAdditionalPhone[_0xee2f('0x17')](_0x15a1b1,_0x13013f,_0x382174)[_0xee2f('0x6')](function(_0x168adc){logger[_0xee2f('0x7')](_0xee2f('0x18'),inspectError(_0x168adc));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x4ef690){return cmHopperHistory['avgHandleTime'](_0x4ef690)[_0xee2f('0x6')](function(_0x18ff19){logger[_0xee2f('0x7')](_0xee2f('0x19'),inspectError(_0x18ff19));});}exports[_0xee2f('0x1a')]=avgHandleTime;function createHistory(_0x3737fd){return cmHopperHistory['createHistory'](_0x3737fd)[_0xee2f('0x6')](function(_0x52e1fa){logger[_0xee2f('0x7')](_0xee2f('0x1b'),inspectError(_0x52e1fa));});}exports[_0xee2f('0x1c')]=createHistory; \ No newline at end of file +var _0x6455=['[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x3a5460,_0x5c3b2d){var _0x480711=function(_0x97c56f){while(--_0x97c56f){_0x3a5460['push'](_0x3a5460['shift']());}};_0x480711(++_0x5c3b2d);}(_0x6455,0x97));var _0x5645=function(_0x117982,_0x20fb5e){_0x117982=_0x117982-0x0;var _0x2cbe41=_0x6455[_0x117982];return _0x2cbe41;};'use strict';var util=require(_0x5645('0x0'));var logger=require('../../../../config/logger')(_0x5645('0x1'));var cmHopper=require(_0x5645('0x2'));var cmHopperAdditionalPhone=require(_0x5645('0x3'));var cmHopperBlack=require(_0x5645('0x4'));var cmHopperHistory=require(_0x5645('0x5'));function inspectError(_0x35c21e){return util['inspect'](_0x35c21e,{'showHidden':![],'depth':null});}function getContactDialer(_0x233875,_0x29cefe,_0x282ef3){return cmHopper[_0x5645('0x6')](_0x233875['id'],_0x29cefe,_0x282ef3,_0x233875[_0x5645('0x7')])[_0x5645('0x8')](function(_0xa14a06){_0x233875[_0x5645('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa14a06));});}exports[_0x5645('0x6')]=getContactDialer;function getContactDialerIvr(_0x37c03a,_0x38c07a){return cmHopper[_0x5645('0xa')](_0x37c03a['id'],_0x38c07a,_0x37c03a[_0x5645('0x7')])[_0x5645('0x8')](function(_0x587c61){_0x37c03a[_0x5645('0x9')]=0x0;logger[_0x5645('0xb')](_0x5645('0xc'),inspectError(_0x587c61));});}exports[_0x5645('0xa')]=getContactDialerIvr;function countReScheduled(_0x5a6092){return cmHopper[_0x5645('0xd')](_0x5a6092)['catch'](function(_0x42f5cd){logger[_0x5645('0xb')](_0x5645('0xe'),inspectError(_0x42f5cd));});}exports[_0x5645('0xd')]=countReScheduled;function rescheduleContact(_0x2d982f){return cmHopper[_0x5645('0xf')](_0x2d982f)[_0x5645('0x8')](function(_0x2270a1){logger['error'](_0x5645('0x10'),inspectError(_0x2270a1));});}exports[_0x5645('0xf')]=rescheduleContact;function unlockContact(_0x25863f,_0x4cbd46,_0x4b3be6){return cmHopper[_0x5645('0x11')](_0x25863f,_0x4cbd46,_0x4b3be6)[_0x5645('0x8')](function(_0x511aed){logger[_0x5645('0xb')](_0x5645('0x12'),inspectError(_0x511aed));});}exports[_0x5645('0x11')]=unlockContact;function moveContactManagedDialer(_0x5179fd){return cmHopper[_0x5645('0x13')](_0x5179fd)[_0x5645('0x8')](function(_0x22a6cf){logger[_0x5645('0xb')]('[moveContactManagedDialer]',inspectError(_0x22a6cf));});}exports[_0x5645('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x52ac46){return cmHopperBlack['checkIsBlackList'](_0x52ac46)[_0x5645('0x8')](function(_0x1e2cba){logger[_0x5645('0xb')]('[checkIsBlackList]',inspectError(_0x1e2cba));});}exports[_0x5645('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x50ed38){return cmHopperBlack[_0x5645('0x15')](_0x50ed38)['catch'](function(_0x4f82d0){logger[_0x5645('0xb')]('[checkIsBlackListIvr]',inspectError(_0x4f82d0));});}exports[_0x5645('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x379cbd,_0x502c2e,_0x18680f){return cmHopperAdditionalPhone[_0x5645('0x16')](_0x379cbd,_0x502c2e,_0x18680f)[_0x5645('0x8')](function(_0x50fa82){logger[_0x5645('0xb')](_0x5645('0x17'),inspectError(_0x50fa82));});}exports[_0x5645('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x46b33a,_0x568fd6,_0x4bc484){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46b33a,_0x568fd6,_0x4bc484)['catch'](function(_0x472982){logger['error']('[swapAdditionalPhone]',inspectError(_0x472982));});}exports[_0x5645('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x12f43a){return cmHopperHistory[_0x5645('0x19')](_0x12f43a)[_0x5645('0x8')](function(_0x3a5c61){logger[_0x5645('0xb')](_0x5645('0x1a'),inspectError(_0x3a5c61));});}exports[_0x5645('0x19')]=avgHandleTime;function createHistory(_0x4493e6){return cmHopperHistory[_0x5645('0x1b')](_0x4493e6)[_0x5645('0x8')](function(_0x2154a7){logger[_0x5645('0xb')](_0x5645('0x1c'),inspectError(_0x2154a7));});}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 02e9d5a..297e481 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 _0x8418=['Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','description','length','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','active','milliseconds','diff','seconds','dialActive','message','available','loggedInDb','talking','pTalking','waiting','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval'];(function(_0x3ba566,_0x5e009d){var _0x480317=function(_0x2fc8de){while(--_0x2fc8de){_0x3ba566['push'](_0x3ba566['shift']());}};_0x480317(++_0x5e009d);}(_0x8418,0x10e));var _0x8841=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0x8418[_0x375325];return _0x228f57;};'use strict';var _=require(_0x8841('0x0'));var moment=require(_0x8841('0x1'));var util=require(_0x8841('0x2'));var logger=require('../../../../config/logger')(_0x8841('0x3'));var timezones=require(_0x8841('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x8841('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x8841('0x6'),'DEACTIVATED':_0x8841('0x7'),'DISACTIVED':_0x8841('0x8'),'EMPTY_INTERVAL':_0x8841('0x9'),'INACTIVE':_0x8841('0xa'),'NO_AGENTS_LOGGED':_0x8841('0xb'),'NO_AVAILABLE_CONTACTS':_0x8841('0xc'),'NULL_INTERVAL':_0x8841('0xd'),'OVERTIME_INTERVAL':_0x8841('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x8841('0xf'),'QUEUE_RECALL':_0x8841('0x10'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x8841('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0xa65574){return _0xa65574[_0x8841('0x12')]===_0x8841('0x13');}exports[_0x8841('0x14')]=isPreviewCampaign;function isIVRCampaign(_0xc524a4){return _0xc524a4[_0x8841('0x15')]===_0x8841('0x16');}exports[_0x8841('0x17')]=isIVRCampaign;function isOutboundQueue(_0x5b299b){return _0x5b299b[_0x8841('0x15')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x59787d){return _0x59787d['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x8d33d8){return _0x8d33d8[_0x8841('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3e528b,_0x4f20dc){var _0x590fc1=moment(_0x3e528b)[_0x8841('0x19')](0x0);var _0x2779b9=moment(_0x4f20dc)[_0x8841('0x19')](0x0);return _0x590fc1[_0x8841('0x1a')](_0x2779b9,_0x8841('0x1b'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x161486,_0x165864){var _0x29335e=![];var _0x4e1c22=_0x161486[_0x8841('0x12')]!==_0x165864[_0x8841('0x12')]||_0x161486[_0x8841('0x1c')]!==_0x165864['dialActive']||_0x161486['message']!==_0x165864[_0x8841('0x1d')];var _0x16e829=_0x161486[_0x8841('0x1e')]!==_0x165864[_0x8841('0x1e')]||_0x161486['loggedIn']!==_0x165864['loggedIn']||_0x161486['loggedInDb']!==_0x165864[_0x8841('0x1f')]||_0x161486['paused']!==_0x165864['paused']||_0x161486['talking']!==_0x165864[_0x8841('0x20')]||_0x161486[_0x8841('0x21')]!==_0x165864[_0x8841('0x21')]||_0x161486[_0x8841('0x22')]!==_0x165864[_0x8841('0x22')]||_0x161486['inUse']!==_0x165864['inUse']||_0x161486[_0x8841('0x23')]!==_0x165864['originated'];if(_0x161486['Trunk']&&_0x165864['Trunk']){_0x29335e=_0x161486[_0x8841('0x24')]['name']!==_0x165864[_0x8841('0x24')][_0x8841('0x25')]||_0x161486[_0x8841('0x24')][_0x8841('0x18')]!==_0x165864[_0x8841('0x24')]['active'];}return _0x4e1c22||_0x16e829||_0x29335e;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x384388){var _0x2a93e3=null;var _0x51fea2=_0x384388[_0x8841('0x26')];if(_[_0x8841('0x27')](_0x384388[_0x8841('0x28')])||_[_0x8841('0x27')](_0x384388[_0x8841('0x29')])||_['isNil'](_0x384388[_0x8841('0x29')][_0x8841('0x2a')])){_0x2a93e3=CAMPAIGN_STATUS[_0x8841('0x2b')];}else if(_[_0x8841('0x2c')](_0x384388[_0x8841('0x28')])||_['isEmpty'](_0x384388['Interval'][_0x8841('0x2a')])){_0x2a93e3=CAMPAIGN_STATUS[_0x8841('0x2d')];}else if(_0x51fea2&&!timezones[_0x51fea2]){_0x2a93e3=CAMPAIGN_STATUS[_0x8841('0x2e')];}return _0x2a93e3;}function checkAnyValidTrunk(_0x24c796,_0x3ab14f){var _0x1893ef=null;var _0x115203=_0x8841('0x2f');var _0x358e55=[_0x8841('0x30'),'unmonitored'];var _0x46182f=!![];if(_0x24c796[_0x8841('0x24')]&&_0x24c796[_0x8841('0x24')][_0x8841('0x18')]){_0x115203+=_0x24c796[_0x8841('0x24')][_0x8841('0x25')];_0x1893ef=_0x3ab14f[_0x115203];_0x46182f=_0x358e55['includes'](_0x1893ef['status']);}else if(_0x24c796[_0x8841('0x31')]&&_0x24c796[_0x8841('0x31')][_0x8841('0x18')]){_0x115203+=_0x24c796[_0x8841('0x31')][_0x8841('0x25')];_0x1893ef=_0x3ab14f[_0x115203];_0x46182f=_0x358e55['includes'](_0x1893ef['status']);}return _0x46182f;}function getQueueCampaignStatusMessage(_0x1db4a9,_0x1ec629){var _0x2fbfad=CAMPAIGN_STATUS['ACTIVE'];var _0x31ece8=isPreviewCampaign(_0x1db4a9);if(!isQueueCampaignActive(_0x1db4a9)){if(_0x31ece8){_0x2fbfad=CAMPAIGN_STATUS[_0x8841('0x32')];}else{if(_0x1db4a9[_0x8841('0x23')]===0x0&&_0x1db4a9[_0x8841('0x20')]===0x0&&_0x1db4a9[_0x8841('0x22')]===0x0&&(_0x1db4a9[_0x8841('0x21')]||0x0)===0x0){_0x2fbfad=CAMPAIGN_STATUS[_0x8841('0x32')];}else{_0x2fbfad=CAMPAIGN_STATUS[_0x8841('0x33')];}}}else if(_0x1db4a9['loggedIn']===0x0){_0x2fbfad=CAMPAIGN_STATUS[_0x8841('0x34')];}else if(!checkAnyValidTrunk(_0x1db4a9,_0x1ec629)){_0x2fbfad=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x1db4a9)){var _0x1e67fd=checkAnyValidQueueCampaignInterval(_0x1db4a9);if(_0x1e67fd){_0x2fbfad=_0x1e67fd;}}return _0x2fbfad;}exports[_0x8841('0x35')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x58d7c9){var _0x20f9cb=CAMPAIGN_STATUS[_0x8841('0x33')];if(_0x58d7c9[_0x8841('0x23')]===0x0&&_0x58d7c9[_0x8841('0x20')]===0x0&&_0x58d7c9[_0x8841('0x22')]===0x0&&(_0x58d7c9[_0x8841('0x21')]||0x0)===0x0){_0x20f9cb=CAMPAIGN_STATUS[_0x8841('0x32')];}return _0x20f9cb;}exports[_0x8841('0x36')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x14745c){var _0x3f4332=_0x14745c[_0x8841('0x37')](/"(.*?)"/);return _0x3f4332?_0x3f4332[0x1]:_0x14745c;}exports[_0x8841('0x38')]=extractCalleridName;function getCallerId(_0x1d9c92,_0x1251af,_0x26d4ab){if(!_[_0x8841('0x39')](_0x26d4ab)&&typeof _0x26d4ab==='string'&&!_['isEmpty'](_0x26d4ab)){if(!_[_0x8841('0x39')](_0x1251af)&&typeof _0x1251af==='string'&&!_[_0x8841('0x2c')](_0x1251af)){return util[_0x8841('0x3a')](_0x8841('0x3b'),_0x1251af,_0x26d4ab);}return util[_0x8841('0x3a')](_0x8841('0x3b'),_0x26d4ab,_0x26d4ab);}if(!_[_0x8841('0x39')](_0x1d9c92)&&typeof _0x1d9c92===_0x8841('0x3c')&&!_[_0x8841('0x2c')](_0x1d9c92)){return _0x1d9c92;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x4fc612,_0x5da1f1){var _0x4ff656;var _0x46d01f;var _0x1bea06;if(_0x5da1f1<=0x0){_0x5da1f1=0x1;}_0x4ff656=new RegExp(_0x8841('0x3d')+_0x5da1f1+'}$');_0x46d01f=Math[_0x8841('0x3e')](0xa,_0x5da1f1-0x1);_0x1bea06=Math[_0x8841('0x3e')](0xa,_0x5da1f1)-0x1;return util[_0x8841('0x3a')]('%s',_['replace'](_0x4fc612,_0x4ff656,_[_0x8841('0x3f')](_0x46d01f,_0x1bea06)[_0x8841('0x40')]()));}exports[_0x8841('0x41')]=getCallerIdRandom;function decrementOriginate(_0x5a65a0,_0x2bc154){if(_0x5a65a0['originated']&&_0x5a65a0[_0x8841('0x23')]>0x0){_0x5a65a0['originated']-=0x1;}else{logger[_0x8841('0x42')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x2bc154);}}exports[_0x8841('0x43')]=decrementOriginate;function checkContactEmpty(_0x2d11bf){return _0x2d11bf&&_0x2d11bf['length']>0x0;}exports[_0x8841('0x44')]=checkContactEmpty;function erlangb(_0x1b19a6,_0x53e62d){if(_0x53e62d===0x0){return 0x0;}var _0x47a314=0x1;for(var _0x5e88ab=0x1;_0x5e88ab<=_0x53e62d;_0x5e88ab+=0x1){_0x47a314=0x1+_0x47a314*_0x5e88ab/_0x1b19a6;}return 0x1/_0x47a314;}exports[_0x8841('0x45')]=erlangb;function checkContactLowerLimitOriginate(_0x2b83c1,_0x170bac,_0x40c431){if(_0x170bac>_0x40c431){for(var _0x2d6ef2=0x0;_0x2d6ef2<_0x170bac-_0x40c431;_0x2d6ef2+=0x1){decrementOriginate(_0x2b83c1,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0x8841('0x46')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x38c3c7){var _0x3566ba={};var _0x1ef823=['id',_0x8841('0x47'),_0x8841('0x48'),'updatedAt'];const _0x4fd057=0xfa;if(_0x38c3c7){for(var _0x1213a6 in _0x38c3c7){if(typeof _0x38c3c7[_0x1213a6]!=='undefined'){if(!_[_0x8841('0x27')](_0x38c3c7[_0x1213a6])&&!_0x1ef823['includes'](_0x1213a6)){if(_0x1213a6===_0x8841('0x49')&&_0x38c3c7[_0x1213a6][_0x8841('0x4a')]>_0x4fd057){_0x3566ba[_0x8841('0x4b')+_0x1213a6[_0x8841('0x4c')]()]=_0x38c3c7[_0x1213a6]['toString']()['substring'](0x0,_0x4fd057);}else{_0x3566ba[_0x8841('0x4b')+_0x1213a6[_0x8841('0x4c')]()]=_0x38c3c7[_0x1213a6];}}}}}return _0x3566ba;}exports[_0x8841('0x4d')]=setXMDContactVariables; \ No newline at end of file +var _0x7133=['extractCalleridName','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','XMD-','toUpperCase','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedInDb','paused','talking','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','Intervals','EMPTY_INTERVAL','SIP/','reachable','status','TrunkBackup','includes','pTalking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','waiting','INACTIVE','match'];(function(_0xb8aff9,_0x1c12ea){var _0x3038c5=function(_0x76a22e){while(--_0x76a22e){_0xb8aff9['push'](_0xb8aff9['shift']());}};_0x3038c5(++_0x1c12ea);}(_0x7133,0xc5));var _0x3713=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7133[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x3713('0x0'));var moment=require(_0x3713('0x1'));var util=require('util');var logger=require(_0x3713('0x2'))(_0x3713('0x3'));var timezones=require(_0x3713('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x3713('0x5'),'BLACKLIST':_0x3713('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x3713('0x7'),'EMPTY_INTERVAL':_0x3713('0x8'),'INACTIVE':_0x3713('0x9'),'NO_AGENTS_LOGGED':_0x3713('0xa'),'NO_AVAILABLE_CONTACTS':_0x3713('0xb'),'NULL_INTERVAL':_0x3713('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x3713('0xd'),'QUEUE_RECALL':_0x3713('0xe'),'RECALL_TIMEOUT':_0x3713('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x3713('0x10'),'UNREACHABLE_TRUNK':_0x3713('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x51f923){return _0x51f923[_0x3713('0x12')]==='preview';}exports[_0x3713('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x49243f){return _0x49243f[_0x3713('0x14')]===_0x3713('0x15');}exports[_0x3713('0x16')]=isIVRCampaign;function isOutboundQueue(_0x25846c){return _0x25846c['type']===_0x3713('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x559685){return _0x559685[_0x3713('0x18')];}exports[_0x3713('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3932be){return _0x3932be['active'];}exports[_0x3713('0x1a')]=isIVRCampaignActive;function getSeconds(_0x5d9962,_0x5199f0){var _0x4b6529=moment(_0x5d9962)[_0x3713('0x1b')](0x0);var _0x3c7668=moment(_0x5199f0)[_0x3713('0x1b')](0x0);return _0x4b6529[_0x3713('0x1c')](_0x3c7668,_0x3713('0x1d'));}exports[_0x3713('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x1a548c,_0x4d8416){var _0x238816=![];var _0x772831=_0x1a548c[_0x3713('0x12')]!==_0x4d8416[_0x3713('0x12')]||_0x1a548c[_0x3713('0x18')]!==_0x4d8416['dialActive']||_0x1a548c['message']!==_0x4d8416[_0x3713('0x1f')];var _0x2c2b71=_0x1a548c[_0x3713('0x20')]!==_0x4d8416[_0x3713('0x20')]||_0x1a548c['loggedIn']!==_0x4d8416['loggedIn']||_0x1a548c[_0x3713('0x21')]!==_0x4d8416['loggedInDb']||_0x1a548c[_0x3713('0x22')]!==_0x4d8416['paused']||_0x1a548c[_0x3713('0x23')]!==_0x4d8416[_0x3713('0x23')]||_0x1a548c['pTalking']!==_0x4d8416['pTalking']||_0x1a548c['waiting']!==_0x4d8416['waiting']||_0x1a548c[_0x3713('0x24')]!==_0x4d8416[_0x3713('0x24')]||_0x1a548c[_0x3713('0x25')]!==_0x4d8416[_0x3713('0x25')];if(_0x1a548c[_0x3713('0x26')]&&_0x4d8416['Trunk']){_0x238816=_0x1a548c[_0x3713('0x26')]['name']!==_0x4d8416[_0x3713('0x26')][_0x3713('0x27')]||_0x1a548c[_0x3713('0x26')][_0x3713('0x28')]!==_0x4d8416[_0x3713('0x26')][_0x3713('0x28')];}return _0x772831||_0x2c2b71||_0x238816;}exports[_0x3713('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xaaf3ef){var _0x1e8365=null;var _0x50b8ae=_0xaaf3ef[_0x3713('0x2a')];if(_[_0x3713('0x2b')](_0xaaf3ef[_0x3713('0x2c')])||_[_0x3713('0x2b')](_0xaaf3ef['Interval'])||_[_0x3713('0x2b')](_0xaaf3ef[_0x3713('0x2d')]['Intervals'])){_0x1e8365=CAMPAIGN_STATUS[_0x3713('0x2e')];}else if(_['isEmpty'](_0xaaf3ef['dialGlobalInterval'])||_['isEmpty'](_0xaaf3ef[_0x3713('0x2d')][_0x3713('0x2f')])){_0x1e8365=CAMPAIGN_STATUS[_0x3713('0x30')];}else if(_0x50b8ae&&!timezones[_0x50b8ae]){_0x1e8365=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1e8365;}function checkAnyValidTrunk(_0x572d88,_0x330101){var _0x4cb271=null;var _0x47165a=_0x3713('0x31');var _0xde7104=[_0x3713('0x32'),'unmonitored'];var _0x46bf99=!![];if(_0x572d88[_0x3713('0x26')]&&_0x572d88[_0x3713('0x26')][_0x3713('0x28')]){_0x47165a+=_0x572d88[_0x3713('0x26')][_0x3713('0x27')];_0x4cb271=_0x330101[_0x47165a];_0x46bf99=_0xde7104['includes'](_0x4cb271[_0x3713('0x33')]);}else if(_0x572d88['TrunkBackup']&&_0x572d88[_0x3713('0x34')][_0x3713('0x28')]){_0x47165a+=_0x572d88['TrunkBackup'][_0x3713('0x27')];_0x4cb271=_0x330101[_0x47165a];_0x46bf99=_0xde7104[_0x3713('0x35')](_0x4cb271[_0x3713('0x33')]);}return _0x46bf99;}function getQueueCampaignStatusMessage(_0x5ace67,_0x2549ac){var _0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x5')];var _0x28d719=isPreviewCampaign(_0x5ace67);if(!isQueueCampaignActive(_0x5ace67)){if(_0x28d719){_0x11c1bc=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5ace67['originated']===0x0&&_0x5ace67['talking']===0x0&&_0x5ace67['waiting']===0x0&&(_0x5ace67[_0x3713('0x36')]||0x0)===0x0){_0x11c1bc=CAMPAIGN_STATUS['INACTIVE'];}else{_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x37')];}}}else if(_0x5ace67['loggedIn']===0x0){_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x38')];}else if(!checkAnyValidTrunk(_0x5ace67,_0x2549ac)){_0x11c1bc=CAMPAIGN_STATUS[_0x3713('0x39')];}else if(!isPreviewCampaign(_0x5ace67)){var _0x1830fc=checkAnyValidQueueCampaignInterval(_0x5ace67);if(_0x1830fc){_0x11c1bc=_0x1830fc;}}return _0x11c1bc;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1f36a9){var _0x5cfe31=CAMPAIGN_STATUS[_0x3713('0x37')];if(_0x1f36a9[_0x3713('0x25')]===0x0&&_0x1f36a9['talking']===0x0&&_0x1f36a9[_0x3713('0x3a')]===0x0&&(_0x1f36a9[_0x3713('0x36')]||0x0)===0x0){_0x5cfe31=CAMPAIGN_STATUS[_0x3713('0x3b')];}return _0x5cfe31;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4d1788){var _0x297ab4=_0x4d1788[_0x3713('0x3c')](/"(.*?)"/);return _0x297ab4?_0x297ab4[0x1]:_0x4d1788;}exports[_0x3713('0x3d')]=extractCalleridName;function getCallerId(_0x26f6a7,_0x26aa97,_0x96406e){if(!_[_0x3713('0x3e')](_0x96406e)&&typeof _0x96406e===_0x3713('0x3f')&&!_[_0x3713('0x40')](_0x96406e)){if(!_['isUndefined'](_0x26aa97)&&typeof _0x26aa97===_0x3713('0x3f')&&!_['isEmpty'](_0x26aa97)){return util[_0x3713('0x41')](_0x3713('0x42'),_0x26aa97,_0x96406e);}return util[_0x3713('0x41')](_0x3713('0x42'),_0x96406e,_0x96406e);}if(!_[_0x3713('0x3e')](_0x26f6a7)&&typeof _0x26f6a7==='string'&&!_[_0x3713('0x40')](_0x26f6a7)){return _0x26f6a7;}return _0x3713('0x43');}exports[_0x3713('0x44')]=getCallerId;function getCallerIdRandom(_0x27ebbe,_0x55ea9f){var _0x2deedb;var _0x14a06b;var _0x15e5c8;if(_0x55ea9f<=0x0){_0x55ea9f=0x1;}_0x2deedb=new RegExp(_0x3713('0x45')+_0x55ea9f+'}$');_0x14a06b=Math[_0x3713('0x46')](0xa,_0x55ea9f-0x1);_0x15e5c8=Math[_0x3713('0x46')](0xa,_0x55ea9f)-0x1;return util['format']('%s',_[_0x3713('0x47')](_0x27ebbe,_0x2deedb,_[_0x3713('0x48')](_0x14a06b,_0x15e5c8)[_0x3713('0x49')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x2907d6,_0x2e7a54){if(_0x2907d6[_0x3713('0x25')]&&_0x2907d6[_0x3713('0x25')]>0x0){_0x2907d6['originated']-=0x1;}else{logger[_0x3713('0x4a')](_0x3713('0x4b'),_0x2e7a54);}}exports[_0x3713('0x4c')]=decrementOriginate;function checkContactEmpty(_0x368173){return _0x368173&&_0x368173[_0x3713('0x4d')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x319dfe,_0x448314){if(_0x448314===0x0){return 0x0;}var _0x5e2f01=0x1;for(var _0x16795e=0x1;_0x16795e<=_0x448314;_0x16795e+=0x1){_0x5e2f01=0x1+_0x5e2f01*_0x16795e/_0x319dfe;}return 0x1/_0x5e2f01;}exports[_0x3713('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x45a0ca,_0x306dc4,_0x4eeae7){if(_0x306dc4>_0x4eeae7){for(var _0x1d8725=0x0;_0x1d8725<_0x306dc4-_0x4eeae7;_0x1d8725+=0x1){decrementOriginate(_0x45a0ca,_0x3713('0x4f'));}}}exports[_0x3713('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x98e00){var _0x1a1596={};var _0x3129e9=['id',_0x3713('0x51'),'tags',_0x3713('0x52')];const _0x22e4a3=0xfa;if(_0x98e00){for(var _0x1c608e in _0x98e00){if(typeof _0x98e00[_0x1c608e]!==_0x3713('0x53')){if(!_['isNil'](_0x98e00[_0x1c608e])&&!_0x3129e9['includes'](_0x1c608e)){if(_0x1c608e==='description'&&_0x98e00[_0x1c608e][_0x3713('0x4d')]>_0x22e4a3){_0x1a1596[_0x3713('0x54')+_0x1c608e[_0x3713('0x55')]()]=_0x98e00[_0x1c608e][_0x3713('0x49')]()['substring'](0x0,_0x22e4a3);}else{_0x1a1596['XMD-'+_0x1c608e['toUpperCase']()]=_0x98e00[_0x1c608e];}}}}}return _0x1a1596;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index bbb5e1f..7b8b03b 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(_0xb1da29,_0x5c1338){var _0x36316f=function(_0xdedc28){while(--_0xdedc28){_0xb1da29['push'](_0xb1da29['shift']());}};_0x36316f(++_0x5c1338);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x17c01b,_0x427c27){var _0x4a9783=function(_0x1684b8){while(--_0x1684b8){_0x17c01b['push'](_0x17c01b['shift']());}};_0x4a9783(++_0x427c27);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 9f6c328..0f01e0c 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 _0xa0a7=['error','stringify','\x20receiveFax\x20','actions','merge','pick','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','finally','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','name','\x20syncNewchannel\x20','channel','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','catch'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0xa0a7,0xa7));var _0x7a0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0a7[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x7a0a('0x0'));var _=require('lodash');var BPromise=require(_0x7a0a('0x1'));var uuid=require(_0x7a0a('0x2'));var moment=require(_0x7a0a('0x3'));var path=require(_0x7a0a('0x4'));var tiff2pdf=require(_0x7a0a('0x5'));var gs=require('./util/gs');var logger=require(_0x7a0a('0x6'))(_0x7a0a('0x7'));var ami=require(_0x7a0a('0x8'));var rpcDb=require(_0x7a0a('0x9'));var Channel=require(_0x7a0a('0xa'));var ut=require(_0x7a0a('0xb'));var Action=require(_0x7a0a('0xc'));var faxAccount=require(_0x7a0a('0xd'));var attachment=require(_0x7a0a('0xe'));var faxMessage=require(_0x7a0a('0xf'));function Fax(_0x11d4ca){this['channels']={};this[_0x7a0a('0x10')]=_0x11d4ca[_0x7a0a('0x10')];this[_0x7a0a('0x11')]=_0x11d4ca['trunks'];this['actions']={};ami['on'](_0x7a0a('0x12'),this[_0x7a0a('0x13')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x15'),this[_0x7a0a('0x16')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x17'),this[_0x7a0a('0x18')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x19'),this[_0x7a0a('0x1a')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x1b'),this[_0x7a0a('0x1c')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x1d'),this[_0x7a0a('0x1e')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x1f'),this[_0x7a0a('0x20')][_0x7a0a('0x14')](this));ami['on'](_0x7a0a('0x21'),this[_0x7a0a('0x22')][_0x7a0a('0x14')](this));}Fax[_0x7a0a('0x23')][_0x7a0a('0x13')]=function(_0x4b37cf){if(_0x4b37cf[_0x7a0a('0x24')]===_0x7a0a('0x25')){for(var _0x4cf048 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x4cf048)){if(_0x4b37cf['exten']===this['faxAccounts'][_0x4cf048][_0x7a0a('0x26')]){this[_0x7a0a('0x27')][_0x4b37cf[_0x7a0a('0x28')]]={};this['channels'][_0x4b37cf['uniqueid']]['channel']=_0x4b37cf['channel'];this[_0x7a0a('0x27')][_0x4b37cf[_0x7a0a('0x28')]]['id']=this[_0x7a0a('0x10')][_0x4cf048]['id'];this[_0x7a0a('0x27')][_0x4b37cf['uniqueid']][_0x7a0a('0x29')]=this['faxAccounts'][_0x4cf048][_0x7a0a('0x29')];logger['info'](_0x4b37cf[_0x7a0a('0x28')],_0x7a0a('0x2a'));}}}}if(this['actions'][_0x4b37cf[_0x7a0a('0x28')]]){this[_0x7a0a('0x27')][_0x4b37cf[_0x7a0a('0x28')]]={};this['channels'][_0x4b37cf[_0x7a0a('0x28')]][_0x7a0a('0x2b')]=_0x4b37cf[_0x7a0a('0x2b')];logger[_0x7a0a('0x2c')](_0x4b37cf[_0x7a0a('0x28')],_0x7a0a('0x2a'));}};Fax[_0x7a0a('0x23')][_0x7a0a('0x16')]=function(_0x2ba4ac){if(this[_0x7a0a('0x27')][_0x2ba4ac[_0x7a0a('0x28')]]){for(var _0x2fa857 in _0x2ba4ac['variable']){if(_0x2ba4ac[_0x7a0a('0x2d')][_0x7a0a('0x2e')](_0x2fa857)){this[_0x7a0a('0x27')][_0x2ba4ac[_0x7a0a('0x28')]][_0x2fa857]=_0x2ba4ac[_0x7a0a('0x2f')];}}}};Fax['prototype'][_0x7a0a('0x18')]=function(_0x3fc110){if(this[_0x7a0a('0x27')][_0x3fc110[_0x7a0a('0x28')]]){this['channels'][_0x3fc110[_0x7a0a('0x28')]]['channelstate']=_0x3fc110[_0x7a0a('0x30')];this[_0x7a0a('0x27')][_0x3fc110[_0x7a0a('0x28')]][_0x7a0a('0x31')]=_0x3fc110[_0x7a0a('0x31')];}};Fax[_0x7a0a('0x23')][_0x7a0a('0x1a')]=function(_0x11f7cf){if(this[_0x7a0a('0x27')][_0x11f7cf[_0x7a0a('0x28')]]){for(var _0x916d0f in _0x11f7cf['variable']){if(_0x11f7cf['variable']['hasOwnProperty'](_0x916d0f)){this[_0x7a0a('0x27')][_0x11f7cf[_0x7a0a('0x28')]][_0x916d0f]=_0x11f7cf[_0x7a0a('0x2f')];}}}};Fax['prototype'][_0x7a0a('0x1c')]=function(_0x367281){if(this['channels'][_0x367281['uniqueid']]){this['channels'][_0x367281[_0x7a0a('0x28')]]['operation']=_0x367281[_0x7a0a('0x32')];this[_0x7a0a('0x27')][_0x367281[_0x7a0a('0x28')]][_0x7a0a('0x33')]=_0x367281[_0x7a0a('0x33')];this['channels'][_0x367281[_0x7a0a('0x28')]][_0x7a0a('0x26')]=_0x367281[_0x7a0a('0x26')];this['channels'][_0x367281[_0x7a0a('0x28')]][_0x7a0a('0x34')]=_0x367281[_0x7a0a('0x34')];logger[_0x7a0a('0x2c')](_0x367281[_0x7a0a('0x28')],_0x7a0a('0x35'));}};Fax[_0x7a0a('0x23')][_0x7a0a('0x1e')]=function(_0x49f546){var _0x3b0ae2=this;if(this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]]){var _0x301f58=this['channels'][_0x49f546[_0x7a0a('0x28')]]['id'];this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]][_0x7a0a('0x36')]=_0x49f546[_0x7a0a('0x36')];this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]]['pagestransferred']=_0x49f546[_0x7a0a('0x37')];this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]]['localstationid']=_0x49f546[_0x7a0a('0x26')];this['channels'][_0x49f546[_0x7a0a('0x28')]][_0x7a0a('0x38')]=_0x49f546[_0x7a0a('0x38')];this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]]['transferrate']=_0x49f546[_0x7a0a('0x39')];this['channels'][_0x49f546['uniqueid']][_0x7a0a('0x34')]=_0x49f546[_0x7a0a('0x34')];this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]][_0x7a0a('0x3a')]=_0x49f546[_0x7a0a('0x3a')];if(this[_0x7a0a('0x27')][_0x49f546[_0x7a0a('0x28')]][_0x7a0a('0x37')]>0x0){tiff2pdf(_0x49f546[_0x7a0a('0x34')],_0x7a0a('0x3b'),function(_0x49fbb6){logger[_0x7a0a('0x2c')](_0x49f546[_0x7a0a('0x28')],_0x7a0a('0x3c'),_0x49fbb6[_0x7a0a('0x3d')]);attachment['create']({'name':path['parse'](_0x49f546[_0x7a0a('0x34')])['name'],'basename':path[_0x7a0a('0x3e')](_0x49f546[_0x7a0a('0x34')])[_0x7a0a('0x29')]+_0x7a0a('0x3f'),'type':_0x7a0a('0x40')})[_0x7a0a('0x41')](function(_0x27086a){faxAccount['notify'](_0x301f58,{'from':_0x49f546[_0x7a0a('0x3a')],'mapKey':'fax','body':path['parse'](_0x49f546[_0x7a0a('0x34')])['name']+_0x7a0a('0x3f'),'AttachmentId':_0x27086a['id']})[_0x7a0a('0x42')](function(_0x77c3e9){logger[_0x7a0a('0x43')](_0x49f546[_0x7a0a('0x28')],'\x20notify\x20',JSON[_0x7a0a('0x44')](_0x77c3e9));});})[_0x7a0a('0x42')](function(_0x26d770){logger[_0x7a0a('0x43')](_0x49f546[_0x7a0a('0x28')],_0x7a0a('0x45'),JSON[_0x7a0a('0x44')](_0x26d770));});});}logger['info'](_0x49f546[_0x7a0a('0x28')],_0x7a0a('0x45'));}};Fax[_0x7a0a('0x23')][_0x7a0a('0x22')]=function(_0x38fe35){if(this[_0x7a0a('0x46')][_0x38fe35[_0x7a0a('0x28')]]){_[_0x7a0a('0x47')](this[_0x7a0a('0x27')][_0x38fe35['uniqueid']],_[_0x7a0a('0x48')](_0x38fe35,['response','reason']));}};function updateStatus(_0x5c6022){if(_0x5c6022[_0x7a0a('0x49')]){faxMessage['update'](_0x5c6022[_0x7a0a('0x49')],{'failMessage':_0x7a0a('0x4a')})[_0x7a0a('0x41')](function(_0x44a2f1){ut[_0x7a0a('0x4b')](_0x7a0a('0x4c'),_0x44a2f1);})[_0x7a0a('0x42')](function(_0x1891ab){ut[_0x7a0a('0x4b')](_0x7a0a('0x4d'),_0x1891ab);});}else{ut[_0x7a0a('0x4b')](_0x7a0a('0x4e'));}}Fax[_0x7a0a('0x23')][_0x7a0a('0x4f')]=function(_0x46e840,_0x40c9da,_0xc12cb2){var _0x3964da=this;var _0x3b02f9={};if(_0x40c9da){_0x3b02f9={'read':_0x40c9da};}else{_0x3b02f9={'failMessage':_0xc12cb2};}if(this[_0x7a0a('0x46')][_0x46e840][_0x7a0a('0x49')]){faxMessage[_0x7a0a('0x50')](this[_0x7a0a('0x46')][_0x46e840]['AttachmentId'],_0x3b02f9)[_0x7a0a('0x41')](function(_0x46b3fa){ut[_0x7a0a('0x4b')]('[Fax][Message][Updated]',_0x46b3fa);})[_0x7a0a('0x42')](function(_0xf327e6){ut[_0x7a0a('0x4b')]('[Fax][Message][NoUpdate1]',_0xf327e6);})[_0x7a0a('0x51')](function(){delete _0x3964da[_0x7a0a('0x27')][_0x46e840];delete _0x3964da[_0x7a0a('0x46')][_0x46e840];});}else{ut['logger']('[Fax][Message][NoUpdate2]');this[_0x7a0a('0x52')](_0x46e840);delete this[_0x7a0a('0x46')][_0x46e840];}};Fax['prototype']['syncHangup']=function(_0x1c20c3){var _0x5df29d=this;if(this[_0x7a0a('0x27')][_0x1c20c3[_0x7a0a('0x28')]]){if(this[_0x7a0a('0x46')][_0x1c20c3['uniqueid']]){this[_0x7a0a('0x27')][_0x1c20c3[_0x7a0a('0x28')]]['id']=this[_0x7a0a('0x46')][_0x1c20c3[_0x7a0a('0x28')]]['id'];this[_0x7a0a('0x27')][_0x1c20c3[_0x7a0a('0x28')]][_0x7a0a('0x29')]=this[_0x7a0a('0x46')][_0x1c20c3[_0x7a0a('0x28')]][_0x7a0a('0x29')];}logger[_0x7a0a('0x2c')](_0x1c20c3['uniqueid'],this['actions'][_0x1c20c3[_0x7a0a('0x28')]]?'\x20hangup\x20sendFile\x20':_0x7a0a('0x53'),JSON[_0x7a0a('0x44')](this['channels'][_0x1c20c3[_0x7a0a('0x28')]]));if(this[_0x7a0a('0x46')][_0x1c20c3['uniqueid']]){if(this[_0x7a0a('0x27')][_0x1c20c3[_0x7a0a('0x28')]]['faxpages']>0x0&&this['channels'][_0x1c20c3[_0x7a0a('0x28')]][_0x7a0a('0x1b')]==='SUCCESS'){this[_0x7a0a('0x4f')](_0x1c20c3[_0x7a0a('0x28')],!![]);}else{this['updateStatus'](_0x1c20c3['uniqueid'],![],this[_0x7a0a('0x27')][_0x1c20c3['uniqueid']]['faxstatusstring']?_0x7a0a('0x54')+this[_0x7a0a('0x27')][_0x1c20c3[_0x7a0a('0x28')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x7a0a('0x23')][_0x7a0a('0x55')]=function(_0x43fc65){var _0x4c176a=this;return new BPromise(function(_0x360e81,_0xc92b0f){_0x4c176a[_0x7a0a('0x56')](_0x43fc65,_0x4c176a[_0x7a0a('0x10')][_0x43fc65[_0x7a0a('0x57')]])[_0x7a0a('0x41')](function(_0x16e2da){ut[_0x7a0a('0x4b')](_0x7a0a('0x58'),_0x16e2da);_0x360e81(ut['message'](_0x7a0a('0x59')));})[_0x7a0a('0x42')](function(_0x45859d){ut[_0x7a0a('0x4b')](_0x7a0a('0x5a'),_0x45859d);updateStatus(_0x43fc65);_0xc92b0f(ut[_0x7a0a('0x3d')](_0x7a0a('0x5b')));});});};Fax['prototype']['checkAfterSend']=function(_0x3d18e7){var _0x4c5eab=this;return new BPromise(function(_0x43cca5,_0x2a4293){var _0x247998=_0x4c5eab[_0x7a0a('0x5c')](_0x4c5eab['faxAccounts'][_0x3d18e7[_0x7a0a('0x57')]]['Trunk'],_0x3d18e7);if(_0x247998[_0x7a0a('0x5d')]){_0x43cca5(ut[_0x7a0a('0x3d')](_0x7a0a('0x5e')));}else{_0x2a4293(ut[_0x7a0a('0x3d')](_0x247998[_0x7a0a('0x3d')]));}});};function originate(_0x5bf7b3,_0x58c8f2,_0x5bd126){return new BPromise(function(_0x16f911,_0x150116){if(_0x5bd126){var _0x3277e1=util[_0x7a0a('0x5f')](_0x7a0a('0x60'),path['parse'](_0x5bf7b3[_0x7a0a('0x4')])['name'],_0x5bf7b3[_0x7a0a('0x4')]);gs[_0x7a0a('0x61')](_0x3277e1)['then'](function(){_0x5bf7b3['path']=util['format'](_0x7a0a('0x62'),path[_0x7a0a('0x3e')](_0x5bf7b3['path'])[_0x7a0a('0x63')],path['parse'](_0x5bf7b3[_0x7a0a('0x4')])[_0x7a0a('0x29')]);_0x58c8f2['XMF-PATH']=_0x5bf7b3[_0x7a0a('0x4')];ut[_0x7a0a('0x4b')](_0x7a0a('0x64'),'');ami['Action'](ut[_0x7a0a('0x65')](_0x5bf7b3,_0x58c8f2))[_0x7a0a('0x41')](function(_0x309fd5){_0x16f911(_0x309fd5);})[_0x7a0a('0x42')](function(_0x37c276){_0x150116(_0x37c276);});})[_0x7a0a('0x42')](function(_0x3c26a6){_0x150116(_0x3c26a6);});}else{ami[_0x7a0a('0x66')](ut[_0x7a0a('0x65')](_0x5bf7b3,_0x58c8f2))[_0x7a0a('0x41')](function(_0x3b8b88){_0x16f911(_0x3b8b88);})[_0x7a0a('0x42')](function(_0x1cc1d4){_0x150116(_0x1cc1d4);});}});}Fax[_0x7a0a('0x23')][_0x7a0a('0x56')]=function(_0x127b2f,_0x10f85e){var _0x587a33=this;return new BPromise(function(_0x5666a1,_0x3e4dc6){var _0x179dd3=uuid['v4']();var _0x42b6c7=ut[_0x7a0a('0x67')](_0x127b2f,_0x10f85e);_0x587a33[_0x7a0a('0x46')][_0x179dd3]=new Action(_0x179dd3,_0x10f85e,_0x127b2f);var _0x239377=_0x587a33[_0x7a0a('0x46')][_0x179dd3];if(path[_0x7a0a('0x3e')](_0x127b2f['path'])[_0x7a0a('0x68')]==='.pdf'){originate(_0x239377,_0x42b6c7,!![])[_0x7a0a('0x41')](function(_0x5e5877){_0x5666a1(_0x5e5877);})[_0x7a0a('0x42')](function(_0x288883){_0x3e4dc6(_0x288883);});}else{originate(_0x239377,_0x42b6c7,![])[_0x7a0a('0x41')](function(_0x26aa09){_0x5666a1(_0x26aa09);})[_0x7a0a('0x42')](function(_0x1a3d7e){_0x3e4dc6(_0x1a3d7e);});}});};Fax[_0x7a0a('0x23')]['isTrunkReachable']=function(_0x1b7337){return!_[_0x7a0a('0x69')](_0x1b7337)&&!_[_0x7a0a('0x69')](_0x1b7337['name'])&&!_['isNil'](_0x1b7337[_0x7a0a('0x6a')])&&_0x1b7337['active']&&!_[_0x7a0a('0x69')](this['trunks'][util['format'](_0x7a0a('0x6b'),_0x1b7337[_0x7a0a('0x29')])])&&!_[_0x7a0a('0x69')](this['trunks'][util[_0x7a0a('0x5f')]('SIP/%s',_0x1b7337[_0x7a0a('0x29')])]['status'])&&(this[_0x7a0a('0x11')][util['format'](_0x7a0a('0x6b'),_0x1b7337['name'])][_0x7a0a('0x33')]===_0x7a0a('0x6c')||this['trunks'][util[_0x7a0a('0x5f')](_0x7a0a('0x6b'),_0x1b7337['name'])]['status']==='unmonitored');};Fax[_0x7a0a('0x23')]['checkTrunk']=function(_0xee4dbb,_0x40f42e){if(!this['isTrunkReachable'](_0xee4dbb)){ut[_0x7a0a('0x4b')](_0x7a0a('0x6d'),_[_0x7a0a('0x69')](_0xee4dbb)?'':_0xee4dbb[_0x7a0a('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x7a0a('0x6e')};}if(_[_0x7a0a('0x69')](_0x40f42e[_0x7a0a('0x7')])){ut['logger'](_0x7a0a('0x6f'),JSON[_0x7a0a('0x44')](_0x40f42e));return{'isValid':![],'message':_0x7a0a('0x70')};}if(_[_0x7a0a('0x69')](_0x40f42e[_0x7a0a('0x4')])){ut[_0x7a0a('0x4b')](_0x7a0a('0x71'),JSON['stringify'](_0x40f42e));return{'isValid':![],'message':_0x7a0a('0x72')};}return{'isValid':!![],'message':_0x7a0a('0x73')};};Fax['prototype'][_0x7a0a('0x52')]=function(_0x4db42e,_0x5812c4=0x2710){if(this['channels'][_0x4db42e]){setTimeout(()=>{delete this[_0x7a0a('0x27')][_0x4db42e];},_0x5812c4);}};module[_0x7a0a('0x74')]=Fax; \ No newline at end of file +var _0x1d33=['channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','context','from-voip-provider','exten','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','operation','status','localstationid','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','stringify','catch','error','\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment'];(function(_0x51c129,_0x41657c){var _0x53e24c=function(_0x5c5ce5){while(--_0x5c5ce5){_0x51c129['push'](_0x51c129['shift']());}};_0x53e24c(++_0x41657c);}(_0x1d33,0x1cd));var _0x31d3=function(_0xb9bda1,_0x4f32e3){_0xb9bda1=_0xb9bda1-0x0;var _0x353bcc=_0x1d33[_0xb9bda1];return _0x353bcc;};'use strict';var util=require(_0x31d3('0x0'));var _=require(_0x31d3('0x1'));var BPromise=require(_0x31d3('0x2'));var uuid=require(_0x31d3('0x3'));var moment=require(_0x31d3('0x4'));var path=require(_0x31d3('0x5'));var tiff2pdf=require(_0x31d3('0x6'));var gs=require(_0x31d3('0x7'));var logger=require(_0x31d3('0x8'))('fax');var ami=require(_0x31d3('0x9'));var rpcDb=require(_0x31d3('0xa'));var Channel=require(_0x31d3('0xb'));var ut=require(_0x31d3('0xc'));var Action=require('./action');var faxAccount=require(_0x31d3('0xd'));var attachment=require(_0x31d3('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x34b7d2){this[_0x31d3('0xf')]={};this[_0x31d3('0x10')]=_0x34b7d2[_0x31d3('0x10')];this[_0x31d3('0x11')]=_0x34b7d2['trunks'];this[_0x31d3('0x12')]={};ami['on']('newchannel',this[_0x31d3('0x13')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x15'),this[_0x31d3('0x16')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x17'),this[_0x31d3('0x18')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x19'),this[_0x31d3('0x1a')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x1b'),this[_0x31d3('0x1c')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x1d'),this[_0x31d3('0x1e')][_0x31d3('0x14')](this));ami['on']('hangup',this[_0x31d3('0x1f')][_0x31d3('0x14')](this));ami['on'](_0x31d3('0x20'),this['syncOriginateResponse'][_0x31d3('0x14')](this));}Fax['prototype'][_0x31d3('0x13')]=function(_0x20f3d2){if(_0x20f3d2[_0x31d3('0x21')]===_0x31d3('0x22')){for(var _0x41e6f9 in this[_0x31d3('0x10')]){if(this[_0x31d3('0x10')]['hasOwnProperty'](_0x41e6f9)){if(_0x20f3d2[_0x31d3('0x23')]===this[_0x31d3('0x10')][_0x41e6f9]['localstationid']){this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]]={};this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]][_0x31d3('0x25')]=_0x20f3d2[_0x31d3('0x25')];this['channels'][_0x20f3d2[_0x31d3('0x24')]]['id']=this[_0x31d3('0x10')][_0x41e6f9]['id'];this[_0x31d3('0xf')][_0x20f3d2['uniqueid']][_0x31d3('0x26')]=this[_0x31d3('0x10')][_0x41e6f9][_0x31d3('0x26')];logger['info'](_0x20f3d2[_0x31d3('0x24')],_0x31d3('0x27'));}}}}if(this[_0x31d3('0x12')][_0x20f3d2[_0x31d3('0x24')]]){this['channels'][_0x20f3d2['uniqueid']]={};this[_0x31d3('0xf')][_0x20f3d2[_0x31d3('0x24')]][_0x31d3('0x25')]=_0x20f3d2[_0x31d3('0x25')];logger['info'](_0x20f3d2[_0x31d3('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x31d3('0x28')][_0x31d3('0x16')]=function(_0x2edf51){if(this[_0x31d3('0xf')][_0x2edf51['uniqueid']]){for(var _0x312231 in _0x2edf51[_0x31d3('0x29')]){if(_0x2edf51['variable'][_0x31d3('0x2a')](_0x312231)){this[_0x31d3('0xf')][_0x2edf51[_0x31d3('0x24')]][_0x312231]=_0x2edf51[_0x31d3('0x2b')];}}}};Fax[_0x31d3('0x28')]['syncNewState']=function(_0x5b99dc){if(this[_0x31d3('0xf')][_0x5b99dc[_0x31d3('0x24')]]){this['channels'][_0x5b99dc['uniqueid']][_0x31d3('0x2c')]=_0x5b99dc[_0x31d3('0x2c')];this['channels'][_0x5b99dc[_0x31d3('0x24')]]['channelstatedesc']=_0x5b99dc['channelstatedesc'];}};Fax[_0x31d3('0x28')][_0x31d3('0x1a')]=function(_0xd95f68){if(this[_0x31d3('0xf')][_0xd95f68[_0x31d3('0x24')]]){for(var _0x28e89c in _0xd95f68[_0x31d3('0x29')]){if(_0xd95f68['variable']['hasOwnProperty'](_0x28e89c)){this[_0x31d3('0xf')][_0xd95f68[_0x31d3('0x24')]][_0x28e89c]=_0xd95f68['value'];}}}};Fax[_0x31d3('0x28')][_0x31d3('0x1c')]=function(_0x1e03c9){if(this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]]){this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]][_0x31d3('0x2d')]=_0x1e03c9[_0x31d3('0x2d')];this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]]['status']=_0x1e03c9[_0x31d3('0x2e')];this[_0x31d3('0xf')][_0x1e03c9['uniqueid']][_0x31d3('0x2f')]=_0x1e03c9[_0x31d3('0x2f')];this[_0x31d3('0xf')][_0x1e03c9[_0x31d3('0x24')]][_0x31d3('0x30')]=_0x1e03c9[_0x31d3('0x30')];logger[_0x31d3('0x31')](_0x1e03c9['uniqueid'],_0x31d3('0x32'));}};Fax[_0x31d3('0x28')][_0x31d3('0x1e')]=function(_0x5ba853){var _0x3b2243=this;if(this['channels'][_0x5ba853[_0x31d3('0x24')]]){var _0x51ce54=this['channels'][_0x5ba853[_0x31d3('0x24')]]['id'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x33')]=_0x5ba853['remotestationid'];this['channels'][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x34')]=_0x5ba853[_0x31d3('0x34')];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x2f')]=_0x5ba853[_0x31d3('0x2f')];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]]['resolution']=_0x5ba853[_0x31d3('0x35')];this['channels'][_0x5ba853[_0x31d3('0x24')]]['transferrate']=_0x5ba853['transferrate'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]]['filename']=_0x5ba853['filename'];this[_0x31d3('0xf')][_0x5ba853[_0x31d3('0x24')]][_0x31d3('0x36')]=_0x5ba853['calleridnum'];if(this[_0x31d3('0xf')][_0x5ba853['uniqueid']][_0x31d3('0x34')]>0x0){tiff2pdf(_0x5ba853[_0x31d3('0x30')],_0x31d3('0x37'),function(_0x328716){logger[_0x31d3('0x31')](_0x5ba853[_0x31d3('0x24')],_0x31d3('0x38'),_0x328716[_0x31d3('0x39')]);attachment['create']({'name':path[_0x31d3('0x3a')](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')],'basename':path['parse'](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')]+_0x31d3('0x3b'),'type':_0x31d3('0x3c')})[_0x31d3('0x3d')](function(_0xff1084){faxAccount['notify'](_0x51ce54,{'from':_0x5ba853[_0x31d3('0x36')],'mapKey':'fax','body':path[_0x31d3('0x3a')](_0x5ba853[_0x31d3('0x30')])[_0x31d3('0x26')]+_0x31d3('0x3b'),'AttachmentId':_0xff1084['id']})['catch'](function(_0x1a0a81){logger['error'](_0x5ba853[_0x31d3('0x24')],'\x20notify\x20',JSON[_0x31d3('0x3e')](_0x1a0a81));});})[_0x31d3('0x3f')](function(_0x80ec03){logger[_0x31d3('0x40')](_0x5ba853[_0x31d3('0x24')],_0x31d3('0x41'),JSON['stringify'](_0x80ec03));});});}logger[_0x31d3('0x31')](_0x5ba853['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x31d3('0x28')][_0x31d3('0x42')]=function(_0x8c4d18){if(this[_0x31d3('0x12')][_0x8c4d18[_0x31d3('0x24')]]){_[_0x31d3('0x43')](this[_0x31d3('0xf')][_0x8c4d18[_0x31d3('0x24')]],_['pick'](_0x8c4d18,[_0x31d3('0x44'),_0x31d3('0x45')]));}};function updateStatus(_0x5a2dd8){if(_0x5a2dd8[_0x31d3('0x46')]){faxMessage[_0x31d3('0x47')](_0x5a2dd8[_0x31d3('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x31d3('0x3d')](function(_0x124b0d){ut[_0x31d3('0x48')](_0x31d3('0x49'),_0x124b0d);})['catch'](function(_0x55bcc1){ut['logger'](_0x31d3('0x4a'),_0x55bcc1);});}else{ut[_0x31d3('0x48')](_0x31d3('0x4b'));}}Fax[_0x31d3('0x28')][_0x31d3('0x4c')]=function(_0x5a4988,_0x1be217,_0x43f454){var _0x2f0343=this;var _0xd273a4={};if(_0x1be217){_0xd273a4={'read':_0x1be217};}else{_0xd273a4={'failMessage':_0x43f454};}if(this['actions'][_0x5a4988][_0x31d3('0x46')]){faxMessage[_0x31d3('0x47')](this['actions'][_0x5a4988][_0x31d3('0x46')],_0xd273a4)[_0x31d3('0x3d')](function(_0x161cdd){ut[_0x31d3('0x48')](_0x31d3('0x4d'),_0x161cdd);})[_0x31d3('0x3f')](function(_0x5c75de){ut[_0x31d3('0x48')](_0x31d3('0x4e'),_0x5c75de);})[_0x31d3('0x4f')](function(){delete _0x2f0343['channels'][_0x5a4988];delete _0x2f0343[_0x31d3('0x12')][_0x5a4988];});}else{ut['logger'](_0x31d3('0x50'));this[_0x31d3('0x51')](_0x5a4988);delete this['actions'][_0x5a4988];}};Fax[_0x31d3('0x28')][_0x31d3('0x1f')]=function(_0xf41e08){var _0x336792=this;if(this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]]){if(this[_0x31d3('0x12')][_0xf41e08[_0x31d3('0x24')]]){this[_0x31d3('0xf')][_0xf41e08['uniqueid']]['id']=this['actions'][_0xf41e08[_0x31d3('0x24')]]['id'];this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x26')]=this['actions'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x26')];}logger['info'](_0xf41e08[_0x31d3('0x24')],this['actions'][_0xf41e08[_0x31d3('0x24')]]?'\x20hangup\x20sendFile\x20':_0x31d3('0x52'),JSON['stringify'](this[_0x31d3('0xf')][_0xf41e08['uniqueid']]));if(this[_0x31d3('0x12')][_0xf41e08[_0x31d3('0x24')]]){if(this['channels'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x53')]>0x0&&this['channels'][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x1b')]===_0x31d3('0x54')){this['updateStatus'](_0xf41e08[_0x31d3('0x24')],!![]);}else{this[_0x31d3('0x4c')](_0xf41e08['uniqueid'],![],this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x55')]?_0x31d3('0x56')+this[_0x31d3('0xf')][_0xf41e08[_0x31d3('0x24')]][_0x31d3('0x55')]:_0x31d3('0x57'));}}}};Fax[_0x31d3('0x28')][_0x31d3('0x58')]=function(_0x294cee){var _0x505cbe=this;return new BPromise(function(_0x383d17,_0x5a1c86){_0x505cbe[_0x31d3('0x59')](_0x294cee,_0x505cbe[_0x31d3('0x10')][_0x294cee[_0x31d3('0x5a')]])[_0x31d3('0x3d')](function(_0x47cac1){ut[_0x31d3('0x48')](_0x31d3('0x5b'),_0x47cac1);_0x383d17(ut[_0x31d3('0x39')](_0x31d3('0x5c')));})[_0x31d3('0x3f')](function(_0x4e6347){ut[_0x31d3('0x48')](_0x31d3('0x5d'),_0x4e6347);updateStatus(_0x294cee);_0x5a1c86(ut[_0x31d3('0x39')](_0x31d3('0x5e')));});});};Fax[_0x31d3('0x28')][_0x31d3('0x5f')]=function(_0x336f0c){var _0x328f43=this;return new BPromise(function(_0xc39caf,_0x2915bd){var _0x9ca93f=_0x328f43[_0x31d3('0x60')](_0x328f43[_0x31d3('0x10')][_0x336f0c[_0x31d3('0x5a')]][_0x31d3('0x61')],_0x336f0c);if(_0x9ca93f['isValid']){_0xc39caf(ut[_0x31d3('0x39')](_0x31d3('0x62')));}else{_0x2915bd(ut[_0x31d3('0x39')](_0x9ca93f[_0x31d3('0x39')]));}});};function originate(_0x177661,_0x410b1c,_0x488387){return new BPromise(function(_0x318af6,_0x4dc746){if(_0x488387){var _0x29494b=util[_0x31d3('0x63')](_0x31d3('0x64'),path[_0x31d3('0x3a')](_0x177661[_0x31d3('0x5')])['name'],_0x177661[_0x31d3('0x5')]);gs['execute'](_0x29494b)[_0x31d3('0x3d')](function(){_0x177661[_0x31d3('0x5')]=util[_0x31d3('0x63')](_0x31d3('0x65'),path['parse'](_0x177661[_0x31d3('0x5')])[_0x31d3('0x66')],path[_0x31d3('0x3a')](_0x177661[_0x31d3('0x5')])[_0x31d3('0x26')]);_0x410b1c[_0x31d3('0x67')]=_0x177661[_0x31d3('0x5')];ut[_0x31d3('0x48')](_0x31d3('0x68'),'');ami[_0x31d3('0x69')](ut[_0x31d3('0x6a')](_0x177661,_0x410b1c))[_0x31d3('0x3d')](function(_0x4a57eb){_0x318af6(_0x4a57eb);})[_0x31d3('0x3f')](function(_0x1826a3){_0x4dc746(_0x1826a3);});})[_0x31d3('0x3f')](function(_0x2c0b4a){_0x4dc746(_0x2c0b4a);});}else{ami[_0x31d3('0x69')](ut[_0x31d3('0x6a')](_0x177661,_0x410b1c))[_0x31d3('0x3d')](function(_0x599d2b){_0x318af6(_0x599d2b);})[_0x31d3('0x3f')](function(_0x11abde){_0x4dc746(_0x11abde);});}});}Fax[_0x31d3('0x28')][_0x31d3('0x59')]=function(_0x296231,_0x35979c){var _0x19f7c2=this;return new BPromise(function(_0x4c2393,_0x1df52d){var _0x518a40=uuid['v4']();var _0x53e864=ut[_0x31d3('0x6b')](_0x296231,_0x35979c);_0x19f7c2[_0x31d3('0x12')][_0x518a40]=new Action(_0x518a40,_0x35979c,_0x296231);var _0x2b54fd=_0x19f7c2[_0x31d3('0x12')][_0x518a40];if(path[_0x31d3('0x3a')](_0x296231['path'])[_0x31d3('0x6c')]===_0x31d3('0x3b')){originate(_0x2b54fd,_0x53e864,!![])[_0x31d3('0x3d')](function(_0x5baea0){_0x4c2393(_0x5baea0);})['catch'](function(_0x1f43cd){_0x1df52d(_0x1f43cd);});}else{originate(_0x2b54fd,_0x53e864,![])['then'](function(_0x3e5ea6){_0x4c2393(_0x3e5ea6);})[_0x31d3('0x3f')](function(_0xbe4ec0){_0x1df52d(_0xbe4ec0);});}});};Fax[_0x31d3('0x28')][_0x31d3('0x6d')]=function(_0x2cc28b){return!_['isNil'](_0x2cc28b)&&!_[_0x31d3('0x6e')](_0x2cc28b[_0x31d3('0x26')])&&!_['isNil'](_0x2cc28b['active'])&&_0x2cc28b['active']&&!_['isNil'](this[_0x31d3('0x11')][util[_0x31d3('0x63')]('SIP/%s',_0x2cc28b[_0x31d3('0x26')])])&&!_[_0x31d3('0x6e')](this['trunks'][util['format'](_0x31d3('0x6f'),_0x2cc28b['name'])][_0x31d3('0x2e')])&&(this['trunks'][util[_0x31d3('0x63')](_0x31d3('0x6f'),_0x2cc28b[_0x31d3('0x26')])][_0x31d3('0x2e')]===_0x31d3('0x70')||this[_0x31d3('0x11')][util[_0x31d3('0x63')]('SIP/%s',_0x2cc28b[_0x31d3('0x26')])][_0x31d3('0x2e')]==='unmonitored');};Fax[_0x31d3('0x28')][_0x31d3('0x60')]=function(_0x593b20,_0x50463b){if(!this['isTrunkReachable'](_0x593b20)){ut['logger'](_0x31d3('0x71'),_[_0x31d3('0x6e')](_0x593b20)?'':_0x593b20[_0x31d3('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x31d3('0x6e')](_0x50463b[_0x31d3('0x72')])){ut['logger'](_0x31d3('0x73'),JSON['stringify'](_0x50463b));return{'isValid':![],'message':_0x31d3('0x74')};}if(_[_0x31d3('0x6e')](_0x50463b[_0x31d3('0x5')])){ut[_0x31d3('0x48')](_0x31d3('0x75'),JSON['stringify'](_0x50463b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x31d3('0x76')};};Fax['prototype'][_0x31d3('0x51')]=function(_0x4c988f,_0x15c501=0x2710){if(this[_0x31d3('0xf')][_0x4c988f]){setTimeout(()=>{delete this['channels'][_0x4c988f];},_0x15c501);}};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 086aaf2..4a7b356 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 _0x834d=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20'];(function(_0x52fde8,_0x291dca){var _0x2cbf75=function(_0x4690d2){while(--_0x4690d2){_0x52fde8['push'](_0x52fde8['shift']());}};_0x2cbf75(++_0x291dca);}(_0x834d,0xe4));var _0xd834=function(_0x1cafd1,_0x5b1bfb){_0x1cafd1=_0x1cafd1-0x0;var _0x58362c=_0x834d[_0x1cafd1];return _0x58362c;};'use strict';var util=require(_0xd834('0x0'));var BPromise=require(_0xd834('0x1'));var logger=require(_0xd834('0x2'))(_0xd834('0x3'));var _=require(_0xd834('0x4'));var faxAccount=require(_0xd834('0x5'));function loggerCatch(_0x21fd5c){return function(_0x20f198){logger[_0xd834('0x6')](_0x21fd5c,util['inspect'](_0x20f198,{'showHidden':![],'depth':null}));};}exports[_0xd834('0x7')]=function(_0x4d8217,_0x4f85e2){return BPromise[_0xd834('0x8')]()[_0xd834('0x9')](faxAccount['notify'](_0x4d8217,_0x4f85e2))[_0xd834('0xa')](loggerCatch(_0xd834('0xb')));}; \ No newline at end of file +var _0x4169=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x4a79fa,_0xfc16ca){var _0x39a03d=function(_0x448439){while(--_0x448439){_0x4a79fa['push'](_0x4a79fa['shift']());}};_0x39a03d(++_0xfc16ca);}(_0x4169,0x1bc));var _0x9416=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4169[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x9416('0x0'));var BPromise=require(_0x9416('0x1'));var logger=require(_0x9416('0x2'))(_0x9416('0x3'));var _=require('lodash');var faxAccount=require(_0x9416('0x4'));function loggerCatch(_0x85b978){return function(_0x424cd2){logger[_0x9416('0x5')](_0x85b978,util[_0x9416('0x6')](_0x424cd2,{'showHidden':![],'depth':null}));};}exports[_0x9416('0x7')]=function(_0x5219f2,_0x5e0705){return BPromise[_0x9416('0x8')]()[_0x9416('0x9')](faxAccount[_0x9416('0x7')](_0x5219f2,_0x5e0705))[_0x9416('0xa')](loggerCatch(_0x9416('0xb')));}; \ 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 d0799ff..e23cb7d 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 _0x5110=['../../../../config/logger','bluebird','exec','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x26eeb7,_0x11054b){var _0x31090=function(_0x2e6c90){while(--_0x2e6c90){_0x26eeb7['push'](_0x26eeb7['shift']());}};_0x31090(++_0x11054b);}(_0x5110,0xd8));var _0x0511=function(_0x2a378f,_0x7b403f){_0x2a378f=_0x2a378f-0x0;var _0x452538=_0x5110[_0x2a378f];return _0x452538;};'use strict';var util=require(_0x0511('0x0'));var logger=require(_0x0511('0x1'))('fax');var BPromise=require(_0x0511('0x2'));var exec=require('child_process')[_0x0511('0x3')];exports['execute']=function(_0x435d2f){return new BPromise(function(_0x199ca8,_0x4c3bac){exec(_0x435d2f,function(_0x50b471,_0x9f447b,_0x23e422){logger['info']('Exec\x20gs',_0x9f447b);if(_0x50b471){logger['info'](_0x0511('0x4'),_0x0511('0x5'),util[_0x0511('0x6')](_0x50b471,{'showHidden':![],'depth':null}),_0x9f447b,_0x23e422);_0x4c3bac(_0x50b471);}_0x199ca8(_0x9f447b);});});}; \ No newline at end of file +var _0xc65f=['info','Exec\x20gs','util','../../../../config/logger','fax','exec'];(function(_0x5ed9f0,_0x4b0b0a){var _0x5b817d=function(_0x34e73b){while(--_0x34e73b){_0x5ed9f0['push'](_0x5ed9f0['shift']());}};_0x5b817d(++_0x4b0b0a);}(_0xc65f,0x152));var _0xfc65=function(_0x4ba8f3,_0x40f5cc){_0x4ba8f3=_0x4ba8f3-0x0;var _0x4571c7=_0xc65f[_0x4ba8f3];return _0x4571c7;};'use strict';var util=require(_0xfc65('0x0'));var logger=require(_0xfc65('0x1'))(_0xfc65('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xfc65('0x3')];exports['execute']=function(_0x2377ff){return new BPromise(function(_0x280543,_0x585398){exec(_0x2377ff,function(_0x435cbf,_0xdd27f,_0x56a2f4){logger[_0xfc65('0x4')]('Exec\x20gs',_0xdd27f);if(_0x435cbf){logger['info'](_0xfc65('0x5'),'\x20Error\x20:',util['inspect'](_0x435cbf,{'showHidden':![],'depth':null}),_0xdd27f,_0x56a2f4);_0x585398(_0x435cbf);}_0x280543(_0xdd27f);});});}; \ 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 05ec976..3cf4fae 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 _0xd40f=['maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','channel','uniqueid','util','lodash','moment','../../../../config/logger','logger','info','inspect','addVariables','headerinfo'];(function(_0x53f1bc,_0x38e4a3){var _0x5507cf=function(_0x51ccd3){while(--_0x51ccd3){_0x53f1bc['push'](_0x53f1bc['shift']());}};_0x5507cf(++_0x38e4a3);}(_0xd40f,0x160));var _0xfd40=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0xd40f[_0x21b14f];return _0x4c0fd0;};'use strict';var util=require(_0xfd40('0x0'));var _=require(_0xfd40('0x1'));var moment=require(_0xfd40('0x2'));var logger=require(_0xfd40('0x3'))('fax');exports['message']=function(_0x86eb9c){return{'message':_0x86eb9c};};exports[_0xfd40('0x4')]=function(_0x135e31,_0x1b727a){logger[_0xfd40('0x5')](_0x135e31,util[_0xfd40('0x6')](_0x1b727a,{'showHidden':![],'depth':null}));};exports[_0xfd40('0x7')]=function(_0x47b065,_0x28311a){var _0x3c5083={'XMF-ECM':_0x28311a['ecm'],'XMF-HEADERINFO':_0x28311a[_0xfd40('0x8')],'XMF-MINRATE':_0x28311a['minrate'],'XMF-MAXRATE':_0x28311a[_0xfd40('0x9')],'XMF-MODEM':util[_0xfd40('0xa')](_0xfd40('0xb'),_0x28311a[_0xfd40('0xc')]),'XMF-GATEWAY':_0x28311a[_0xfd40('0xd')],'XMF-FAXDETECT':_0x28311a['faxdetect'],'XMF-T38TIMEOUT':_0x28311a[_0xfd40('0xe')],'XMF-LOCALSTATIONID':_0x28311a[_0xfd40('0xf')],'XMF-PATH':_0x47b065[_0xfd40('0x10')]};return _0x3c5083;};exports['variablesAction']=function(_0x53299f,_0x33404b){return{'actionid':_0x53299f['uniqueid'],'action':'originate','channel':_0x53299f[_0xfd40('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x53299f['headerinfo']?_0x53299f['headerinfo']:'',_0x53299f[_0xfd40('0xf')]),'variable':_0x33404b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x53299f[_0xfd40('0x12')]};}; \ No newline at end of file +var _0x4ac5=['localstationid','path','variablesAction','uniqueid','originate','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','message','info','inspect','ecm','minrate','format','\x22%s\x22','modem'];(function(_0x35e793,_0x2cd49e){var _0x4effe8=function(_0x215c03){while(--_0x215c03){_0x35e793['push'](_0x35e793['shift']());}};_0x4effe8(++_0x2cd49e);}(_0x4ac5,0x1ed));var _0x54ac=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0x4ac5[_0x25d4ee];return _0x214a35;};'use strict';var util=require(_0x54ac('0x0'));var _=require(_0x54ac('0x1'));var moment=require(_0x54ac('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x54ac('0x3')]=function(_0x58dbef){return{'message':_0x58dbef};};exports['logger']=function(_0x550cb6,_0x2ba68f){logger[_0x54ac('0x4')](_0x550cb6,util[_0x54ac('0x5')](_0x2ba68f,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4a518d,_0x408b97){var _0x59bc6a={'XMF-ECM':_0x408b97[_0x54ac('0x6')],'XMF-HEADERINFO':_0x408b97['headerinfo'],'XMF-MINRATE':_0x408b97[_0x54ac('0x7')],'XMF-MAXRATE':_0x408b97['maxrate'],'XMF-MODEM':util[_0x54ac('0x8')](_0x54ac('0x9'),_0x408b97[_0x54ac('0xa')]),'XMF-GATEWAY':_0x408b97['gateway'],'XMF-FAXDETECT':_0x408b97['faxdetect'],'XMF-T38TIMEOUT':_0x408b97['t38timeout'],'XMF-LOCALSTATIONID':_0x408b97[_0x54ac('0xb')],'XMF-PATH':_0x4a518d[_0x54ac('0xc')]};return _0x59bc6a;};exports[_0x54ac('0xd')]=function(_0x19e388,_0x221d39){return{'actionid':_0x19e388[_0x54ac('0xe')],'action':_0x54ac('0xf'),'channel':_0x19e388['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0x54ac('0x10'),_0x19e388[_0x54ac('0x11')]?_0x19e388[_0x54ac('0x11')]:'',_0x19e388[_0x54ac('0xb')]),'variable':_0x221d39,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19e388['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4dfb264..fb03b37 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 _0xd693=['getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns'];(function(_0x51a6be,_0x14aead){var _0x341d14=function(_0x13cb47){while(--_0x13cb47){_0x51a6be['push'](_0x51a6be['shift']());}};_0x341d14(++_0x14aead);}(_0xd693,0x194));var _0x3d69=function(_0x131604,_0x475a68){_0x131604=_0x131604-0x0;var _0x4a2aea=_0xd693[_0x131604];return _0x4a2aea;};'use strict';var util=require('util');var moment=require(_0x3d69('0x0'));var server=require(_0x3d69('0x1'));var Realtime=require(_0x3d69('0x2'));var Report=require(_0x3d69('0x3'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x3d69('0x4'));var Preview=require(_0x3d69('0x5'));var Fax=require(_0x3d69('0x6'));var user=require(_0x3d69('0x7'));var voiceQueue=require(_0x3d69('0x8'));var voiceQueueReport=require(_0x3d69('0x9'));var voiceCallReport=require(_0x3d69('0xa'));var trunk=require(_0x3d69('0xb'));var trigger=require(_0x3d69('0xc'));var template=require(_0x3d69('0xd'));var cmHopperHistory=require(_0x3d69('0xe'));var campaign=require(_0x3d69('0xf'));var voiceExtension=require(_0x3d69('0x10'));var faxAccount=require(_0x3d69('0x11'));var zendesk=require(_0x3d69('0x12'));var salesforce=require(_0x3d69('0x13'));var sugarcrm=require(_0x3d69('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x3d69('0x15'));var zoho=require(_0x3d69('0x16'));var vtiger=require(_0x3d69('0x17'));var freshsales=require(_0x3d69('0x18'));var servicenow=require(_0x3d69('0x19'));var dynamics365=require(_0x3d69('0x1a'));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(_0x3d69('0x1b'))(_0x3d69('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3d69('0x1d')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3d69('0x1d')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3d69('0x1e')]()['then'](user[_0x3d69('0x1f')]())[_0x3d69('0x20')](realtime[_0x3d69('0x21')]())[_0x3d69('0x20')](user[_0x3d69('0x22')]())[_0x3d69('0x20')](realtime[_0x3d69('0x23')]())[_0x3d69('0x20')](trunk['getTrunks']())[_0x3d69('0x20')](realtime[_0x3d69('0x24')]())['then'](voiceQueue[_0x3d69('0x25')]())[_0x3d69('0x20')](realtime[_0x3d69('0x26')]())[_0x3d69('0x20')](trigger[_0x3d69('0x27')]())['then'](realtime[_0x3d69('0x28')]())[_0x3d69('0x20')](template[_0x3d69('0x29')]())[_0x3d69('0x20')](realtime[_0x3d69('0x2a')]())[_0x3d69('0x20')](zendesk['getZendeskAccounts']())[_0x3d69('0x20')](realtime[_0x3d69('0x2b')]())['then'](salesforce[_0x3d69('0x2c')]())[_0x3d69('0x20')](realtime[_0x3d69('0x2d')]())['then'](sugarcrm[_0x3d69('0x2e')]())[_0x3d69('0x20')](realtime[_0x3d69('0x2f')]())[_0x3d69('0x20')](freshdesk[_0x3d69('0x30')]())['then'](realtime[_0x3d69('0x31')]())['then'](desk[_0x3d69('0x32')]())[_0x3d69('0x20')](realtime[_0x3d69('0x33')]())['then'](zoho[_0x3d69('0x34')]())['then'](realtime[_0x3d69('0x35')]())['then'](vtiger[_0x3d69('0x36')]())['then'](realtime[_0x3d69('0x37')]())[_0x3d69('0x20')](freshsales[_0x3d69('0x38')]())[_0x3d69('0x20')](realtime[_0x3d69('0x39')]())[_0x3d69('0x20')](servicenow[_0x3d69('0x3a')]())[_0x3d69('0x20')](realtime[_0x3d69('0x3b')]())['then'](dynamics365[_0x3d69('0x3c')]())['then'](realtime[_0x3d69('0x3d')]())[_0x3d69('0x20')](campaign[_0x3d69('0x3e')]())['then'](realtime[_0x3d69('0x3f')]())['then'](voiceExtension[_0x3d69('0x40')]())['then'](realtime[_0x3d69('0x41')]())[_0x3d69('0x20')](faxAccount[_0x3d69('0x42')]())[_0x3d69('0x20')](realtime[_0x3d69('0x43')]())[_0x3d69('0x20')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x3d69('0x20')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())[_0x3d69('0x20')](cmHopperHistory[_0x3d69('0x44')]())[_0x3d69('0x20')](realtime[_0x3d69('0x45')]())[_0x3d69('0x20')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x3d69('0x46')]())[_0x3d69('0x20')](voiceCallReport[_0x3d69('0x47')]())['then'](realtime['initVoiceCallReports']())[_0x3d69('0x48')](function(_0x115d5f){logger[_0x3d69('0x49')](_0x3d69('0x4a'),util[_0x3d69('0x4b')](_0x115d5f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3d69('0x4c')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x3d69('0x20')](function(){return initParams();})['then'](function(){report[_0x3d69('0x4d')]();setInterval(initRealtime,0x1388);})[_0x3d69('0x48')](function(_0x40bba6){logger[_0x3d69('0x49')]('[index.js][main]',util['inspect'](_0x40bba6,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x2f03=['initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','inspect','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','getTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts'];(function(_0x4525b9,_0x5a0570){var _0x1474a9=function(_0x4be23f){while(--_0x4be23f){_0x4525b9['push'](_0x4525b9['shift']());}};_0x1474a9(++_0x5a0570);}(_0x2f03,0x1a7));var _0x32f0=function(_0x4fa077,_0x5b1fcd){_0x4fa077=_0x4fa077-0x0;var _0x1b799f=_0x2f03[_0x4fa077];return _0x1b799f;};'use strict';var util=require(_0x32f0('0x0'));var moment=require(_0x32f0('0x1'));var server=require(_0x32f0('0x2'));var Realtime=require(_0x32f0('0x3'));var Report=require('./report');var Acw=require(_0x32f0('0x4'));var Trigger=require(_0x32f0('0x5'));var Dialer=require(_0x32f0('0x6'));var Preview=require(_0x32f0('0x7'));var Fax=require(_0x32f0('0x8'));var user=require(_0x32f0('0x9'));var voiceQueue=require(_0x32f0('0xa'));var voiceQueueReport=require(_0x32f0('0xb'));var voiceCallReport=require(_0x32f0('0xc'));var trunk=require(_0x32f0('0xd'));var trigger=require(_0x32f0('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x32f0('0xf'));var campaign=require(_0x32f0('0x10'));var voiceExtension=require(_0x32f0('0x11'));var faxAccount=require(_0x32f0('0x12'));var zendesk=require(_0x32f0('0x13'));var salesforce=require(_0x32f0('0x14'));var sugarcrm=require(_0x32f0('0x15'));var freshdesk=require(_0x32f0('0x16'));var desk=require(_0x32f0('0x17'));var zoho=require(_0x32f0('0x18'));var vtiger=require(_0x32f0('0x19'));var freshsales=require(_0x32f0('0x1a'));var servicenow=require(_0x32f0('0x1b'));var dynamics365=require(_0x32f0('0x1c'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x32f0('0x1d'))(_0x32f0('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x32f0('0x1f')](_0x32f0('0x20'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x32f0('0x1f')](_0x32f0('0x20'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x32f0('0x21')]()[_0x32f0('0x22')](user[_0x32f0('0x23')]())[_0x32f0('0x22')](realtime[_0x32f0('0x24')]())[_0x32f0('0x22')](user['getTelephones']())[_0x32f0('0x22')](realtime[_0x32f0('0x25')]())[_0x32f0('0x22')](trunk[_0x32f0('0x26')]())[_0x32f0('0x22')](realtime['initTrunks']())[_0x32f0('0x22')](voiceQueue[_0x32f0('0x27')]())['then'](realtime['initVoiceQueues']())[_0x32f0('0x22')](trigger[_0x32f0('0x28')]())['then'](realtime['initTriggers']())[_0x32f0('0x22')](template['getTemplates']())['then'](realtime['initTemplates']())[_0x32f0('0x22')](zendesk[_0x32f0('0x29')]())['then'](realtime[_0x32f0('0x2a')]())[_0x32f0('0x22')](salesforce[_0x32f0('0x2b')]())[_0x32f0('0x22')](realtime[_0x32f0('0x2c')]())[_0x32f0('0x22')](sugarcrm[_0x32f0('0x2d')]())['then'](realtime['initSugarcrmAccounts']())[_0x32f0('0x22')](freshdesk['getFreshdeskAccounts']())[_0x32f0('0x22')](realtime['initFreshdeskAccounts']())['then'](desk[_0x32f0('0x2e')]())[_0x32f0('0x22')](realtime[_0x32f0('0x2f')]())[_0x32f0('0x22')](zoho[_0x32f0('0x30')]())[_0x32f0('0x22')](realtime[_0x32f0('0x31')]())[_0x32f0('0x22')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x32f0('0x22')](freshsales[_0x32f0('0x32')]())['then'](realtime[_0x32f0('0x33')]())[_0x32f0('0x22')](servicenow['getServicenowAccounts']())[_0x32f0('0x22')](realtime[_0x32f0('0x34')]())[_0x32f0('0x22')](dynamics365['getDynamics365Accounts']())[_0x32f0('0x22')](realtime[_0x32f0('0x35')]())[_0x32f0('0x22')](campaign['getCampaigns']())['then'](realtime[_0x32f0('0x36')]())[_0x32f0('0x22')](voiceExtension['getVoiceExtensions']())[_0x32f0('0x22')](realtime[_0x32f0('0x37')]())[_0x32f0('0x22')](faxAccount[_0x32f0('0x38')]())['then'](realtime['initFaxAccounts']())[_0x32f0('0x22')](function(){return realtime;});}function initParams(){return Promise[_0x32f0('0x21')]()['then'](voiceQueueReport[_0x32f0('0x39')]())[_0x32f0('0x22')](realtime[_0x32f0('0x3a')]())[_0x32f0('0x22')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x32f0('0x22')](realtime[_0x32f0('0x3b')]())[_0x32f0('0x22')](cmHopperHistory[_0x32f0('0x3c')]())[_0x32f0('0x22')](realtime['initCampaignHopperHistory']())[_0x32f0('0x22')](voiceCallReport['getVoiceCallReports']())[_0x32f0('0x22')](realtime[_0x32f0('0x3d')]())[_0x32f0('0x3e')](function(_0x4e5989){logger[_0x32f0('0x3f')](_0x32f0('0x40'),util['inspect'](_0x4e5989,{'showHidden':![],'depth':null}));});}function main(){return server[_0x32f0('0x41')](realtime,preview,fax)[_0x32f0('0x22')](function(){return initRealtime();})[_0x32f0('0x22')](function(){return initParams();})[_0x32f0('0x22')](function(){report[_0x32f0('0x42')]();setInterval(initRealtime,0x1388);})[_0x32f0('0x3e')](function(_0x1b6ca9){logger[_0x32f0('0x3f')]('[index.js][main]',util[_0x32f0('0x43')](_0x1b6ca9,{'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 05837b7..87f83dd 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 _0xb9e0=['user:presence','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','statePause','format','interface','stringify','md5','user:%s','emit','user:ami:update','omit'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb9e0,0x10b));var _0x0b9e=function(_0x471c5e,_0x37a310){_0x471c5e=_0x471c5e-0x0;var _0xd97242=_0xb9e0[_0x471c5e];return _0xd97242;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0b9e('0x0'));config[_0x0b9e('0x1')]=_[_0x0b9e('0x2')](config['redis'],{'host':_0x0b9e('0x3'),'port':0x18eb});var io=require(_0x0b9e('0x4'))(new Redis(config[_0x0b9e('0x1')]));function Agent(_0x4aa296){this['id']=_0x4aa296['id']||0x0;this[_0x0b9e('0x5')]=_0x4aa296[_0x0b9e('0x5')]||'';this[_0x0b9e('0x6')]=_0x4aa296[_0x0b9e('0x6')]||'';this['accountcode']=_0x4aa296[_0x0b9e('0x7')]||'';this[_0x0b9e('0x8')]=_0x4aa296[_0x0b9e('0x8')]||'';this['state']=_0x0b9e('0x9');this[_0x0b9e('0xa')]=0x0;this[_0x0b9e('0xb')]=_0x0b9e('0x9');this[_0x0b9e('0xc')]='';this[_0x0b9e('0xd')]='';this[_0x0b9e('0xe')]='';this['interface']='';this['online']=_0x4aa296[_0x0b9e('0xf')]||![];this[_0x0b9e('0x10')]=_0x0b9e('0x9');this[_0x0b9e('0x11')]=0x0;this[_0x0b9e('0x12')]='';this[_0x0b9e('0x13')]='';this[_0x0b9e('0x14')]=![];this['local']=![];this['md5']='';}Agent[_0x0b9e('0x15')][_0x0b9e('0x16')]=function(_0x3a84d2){var _0x3518dc;if(_0x3a84d2&&_0x3a84d2[_0x0b9e('0x17')]){_0x3518dc=_0x3a84d2[_0x0b9e('0x17')][_0x0b9e('0x18')]();switch(_0x3518dc){case _0x0b9e('0x19'):_0x3518dc=_0x0b9e('0x1a');break;case _0x0b9e('0x1b'):_0x3518dc='talking';break;}}if(_0x3518dc&&this[_0x0b9e('0x10')]!==_0x3518dc||_0x3a84d2[_0x0b9e('0x1c')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x0b9e('0x1d')]('x'));}if(_0x3518dc){this[_0x0b9e('0x10')]=_0x3518dc;}var _0x35fab0={'id':this['id'],'name':this[_0x0b9e('0x5')],'email':this['email'],'accountcode':this[_0x0b9e('0x7')],'fullname':this[_0x0b9e('0x8')],'state':this[_0x0b9e('0x17')],'stateTime':this['stateTime'],'status':this[_0x0b9e('0xb')],'address':this[_0x0b9e('0xc')],'online':this[_0x0b9e('0xf')],'voiceStatus':this[_0x0b9e('0x10')],'voiceStatusTime':this[_0x0b9e('0x11')],'voiceStatusCallerIdNumber':this[_0x0b9e('0x12')],'voiceStatusQueue':this[_0x0b9e('0x13')],'interface':this[_0x0b9e('0x1e')],'onhold':this[_0x0b9e('0x14')]};var _0x29e0b6=md5(JSON[_0x0b9e('0x1f')](_0x35fab0));if(this['md5']!==_0x29e0b6){this[_0x0b9e('0x20')]=_0x29e0b6;io['to'](util['format'](_0x0b9e('0x21'),_0x35fab0['name']))[_0x0b9e('0x22')](_0x0b9e('0x23'),_[_0x0b9e('0x24')](_0x35fab0,[_0x0b9e('0xf')]));io[_0x0b9e('0x22')](_0x0b9e('0x25'),_0x35fab0);}};module['exports']=Agent; \ No newline at end of file +var _0x68ec=['md5','ioredis','../../../config/environment','redis','localhost','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','idle','statePause','toNumber','name','voiceStatusCallerIdNumber','stringify','format','user:%s','user:ami:update','omit','emit','user:presence','lodash','util'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x68ec,0x12e));var _0xc68e=function(_0xe56a81,_0x211068){_0xe56a81=_0xe56a81-0x0;var _0xde5222=_0x68ec[_0xe56a81];return _0xde5222;};'use strict';var _=require(_0xc68e('0x0'));var util=require(_0xc68e('0x1'));var moment=require('moment');var md5=require(_0xc68e('0x2'));var Redis=require(_0xc68e('0x3'));var config=require(_0xc68e('0x4'));config[_0xc68e('0x5')]=_['defaults'](config[_0xc68e('0x5')],{'host':_0xc68e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x4d2504){this['id']=_0x4d2504['id']||0x0;this['name']=_0x4d2504['name']||'';this['email']=_0x4d2504[_0xc68e('0x7')]||'';this['accountcode']=_0x4d2504[_0xc68e('0x8')]||'';this[_0xc68e('0x9')]=_0x4d2504['fullname']||'';this[_0xc68e('0xa')]='unknown';this[_0xc68e('0xb')]=0x0;this[_0xc68e('0xc')]=_0xc68e('0xd');this[_0xc68e('0xe')]='';this[_0xc68e('0xf')]='';this[_0xc68e('0x10')]='';this[_0xc68e('0x11')]='';this[_0xc68e('0x12')]=_0x4d2504[_0xc68e('0x12')]||![];this[_0xc68e('0x13')]='unknown';this[_0xc68e('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xc68e('0x15')]='';this[_0xc68e('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0xc68e('0x17')][_0xc68e('0x18')]=function(_0xa4e8e5){var _0x1ceb7b;if(_0xa4e8e5&&_0xa4e8e5[_0xc68e('0xa')]){_0x1ceb7b=_0xa4e8e5['state'][_0xc68e('0x19')]();switch(_0x1ceb7b){case'not_inuse':_0x1ceb7b=_0xc68e('0x1a');break;case'inuse':_0x1ceb7b='talking';break;}}if(_0x1ceb7b&&this['voiceStatus']!==_0x1ceb7b||_0xa4e8e5[_0xc68e('0x1b')]){this[_0xc68e('0x14')]=_[_0xc68e('0x1c')](moment()['format']('x'));}if(_0x1ceb7b){this[_0xc68e('0x13')]=_0x1ceb7b;}var _0x2e8796={'id':this['id'],'name':this[_0xc68e('0x1d')],'email':this['email'],'accountcode':this[_0xc68e('0x8')],'fullname':this[_0xc68e('0x9')],'state':this[_0xc68e('0xa')],'stateTime':this[_0xc68e('0xb')],'status':this['status'],'address':this[_0xc68e('0xe')],'online':this[_0xc68e('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xc68e('0x14')],'voiceStatusCallerIdNumber':this[_0xc68e('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xc68e('0x11')],'onhold':this[_0xc68e('0x16')]};var _0x3253f3=md5(JSON[_0xc68e('0x1f')](_0x2e8796));if(this[_0xc68e('0x2')]!==_0x3253f3){this[_0xc68e('0x2')]=_0x3253f3;io['to'](util[_0xc68e('0x20')](_0xc68e('0x21'),_0x2e8796[_0xc68e('0x1d')]))['emit'](_0xc68e('0x22'),_[_0xc68e('0x23')](_0x2e8796,[_0xc68e('0x12')]));io[_0xc68e('0x24')](_0xc68e('0x25'),_0x2e8796);}};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 166175b..726c863 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 _0xe71f=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x43d40f,_0x11e85f){var _0xa3f824=function(_0x5ab7f7){while(--_0x5ab7f7){_0x43d40f['push'](_0x43d40f['shift']());}};_0xa3f824(++_0x11e85f);}(_0xe71f,0x143));var _0xfe71=function(_0x2e3272,_0x960823){_0x2e3272=_0x2e3272-0x0;var _0x61dec9=_0xe71f[_0x2e3272];return _0x61dec9;};'use strict';function Campaign(_0x273977){this['id']=_0x273977['id']||0x0;this[_0xfe71('0x0')]=_0x273977['name']||'';this[_0xfe71('0x1')]=_0x273977['type']||_0xfe71('0x2');this[_0xfe71('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xfe71('0x4')]=0x0;this[_0xfe71('0x5')]='';this[_0xfe71('0x6')]=!![];this[_0xfe71('0x7')]=_0x273977['active'];this[_0xfe71('0x8')]=_0x273977['limitCalls'];this['dialTimezone']=_0x273977[_0xfe71('0x9')]||null;this[_0xfe71('0xa')]=_0x273977[_0xfe71('0xa')]?_0x273977[_0xfe71('0xa')]:null;this['dialOriginateCallerIdName']=_0x273977[_0xfe71('0xb')];this[_0xfe71('0xc')]=_0x273977[_0xfe71('0xc')];this[_0xfe71('0xd')]=_0x273977[_0xfe71('0xd')]||0x1e;this[_0xfe71('0xe')]=_0x273977[_0xfe71('0xe')];this[_0xfe71('0xf')]=_0x273977[_0xfe71('0xf')];this[_0xfe71('0x10')]=_0x273977[_0xfe71('0x10')];this['dialBusyRetryFrequency']=_0x273977[_0xfe71('0x11')];this['dialNoAnswerMaxRetry']=_0x273977[_0xfe71('0x12')];this[_0xfe71('0x13')]=_0x273977['dialNoAnswerRetryFrequency'];this[_0xfe71('0x14')]=_0x273977[_0xfe71('0x14')];this[_0xfe71('0x15')]=_0x273977['dialNoSuchNumberMaxRetry']||0x3;this[_0xfe71('0x16')]=_0x273977['dialNoSuchNumberRetryFrequency']||0x96;this[_0xfe71('0x17')]=_0x273977['dialDropMaxRetry']||0x3;this[_0xfe71('0x18')]=_0x273977[_0xfe71('0x18')]||0x96;this[_0xfe71('0x19')]=_0x273977['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x273977[_0xfe71('0x1a')]||0x96;this[_0xfe71('0x1b')]=_0x273977['dialMachineMaxRetry']||0x3;this[_0xfe71('0x1c')]=_0x273977[_0xfe71('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x273977[_0xfe71('0x1d')]||0x3;this[_0xfe71('0x1e')]=_0x273977[_0xfe71('0x1e')]||0x96;this[_0xfe71('0x1f')]=_0x273977['dialOrderByScheduledAt']||_0xfe71('0x20');this[_0xfe71('0x21')]=_0x273977[_0xfe71('0x21')]||undefined;this[_0xfe71('0x22')]=_0x273977[_0xfe71('0x22')]||undefined;this['dialCutDigit']=_0x273977['dialCutDigit']||undefined;this['TrunkBackup']=_0x273977[_0xfe71('0x23')]?_0x273977[_0xfe71('0x23')]:undefined;this[_0xfe71('0x24')]=_0x273977[_0xfe71('0x24')]?_0x273977[_0xfe71('0x24')]:undefined;this[_0xfe71('0x25')]=_0x273977[_0xfe71('0x25')]?_0x273977['Interval']:undefined;this[_0xfe71('0x26')]=_0x273977[_0xfe71('0x26')]?_0x273977['SquareProject']:undefined;this[_0xfe71('0x27')]=_0x273977[_0xfe71('0x26')]?_0x273977[_0xfe71('0x26')][_0xfe71('0x0')]:undefined;this[_0xfe71('0x28')]=_0x273977['dialAMDActive']||![];this[_0xfe71('0x29')]=_0x273977[_0xfe71('0x29')];this['dialAMDGreeting']=_0x273977[_0xfe71('0x2a')];this[_0xfe71('0x2b')]=_0x273977[_0xfe71('0x2b')];this[_0xfe71('0x2c')]=_0x273977['dialAMDTotalAnalysisTime'];this[_0xfe71('0x2d')]=_0x273977[_0xfe71('0x2d')];this[_0xfe71('0x2e')]=_0x273977[_0xfe71('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x273977['dialAMDMaximumNumberOfWords'];this[_0xfe71('0x2f')]=_0x273977[_0xfe71('0x2f')];this[_0xfe71('0x30')]=_0x273977[_0xfe71('0x30')];}module[_0xfe71('0x31')]=Campaign; \ No newline at end of file +var _0xcb9a=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence'];(function(_0x392489,_0x5b9e38){var _0x460a04=function(_0x26fc58){while(--_0x26fc58){_0x392489['push'](_0x392489['shift']());}};_0x460a04(++_0x5b9e38);}(_0xcb9a,0x159));var _0xacb9=function(_0x5db2e5,_0x5ade38){_0x5db2e5=_0x5db2e5-0x0;var _0x40953f=_0xcb9a[_0x5db2e5];return _0x40953f;};'use strict';function Campaign(_0x4d19f5){this['id']=_0x4d19f5['id']||0x0;this['name']=_0x4d19f5['name']||'';this['type']=_0x4d19f5[_0xacb9('0x0')]||'campaign';this[_0xacb9('0x1')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xacb9('0x2')]=0x0;this['message']='';this[_0xacb9('0x3')]=!![];this[_0xacb9('0x4')]=_0x4d19f5[_0xacb9('0x4')];this[_0xacb9('0x5')]=_0x4d19f5[_0xacb9('0x5')];this[_0xacb9('0x6')]=_0x4d19f5[_0xacb9('0x6')]||null;this['dialGlobalInterval']=_0x4d19f5[_0xacb9('0x7')]?_0x4d19f5[_0xacb9('0x7')]:null;this['dialOriginateCallerIdName']=_0x4d19f5[_0xacb9('0x8')];this[_0xacb9('0x9')]=_0x4d19f5[_0xacb9('0x9')];this['dialOriginateTimeout']=_0x4d19f5[_0xacb9('0xa')]||0x1e;this[_0xacb9('0xb')]=_0x4d19f5['dialCongestionMaxRetry'];this[_0xacb9('0xc')]=_0x4d19f5[_0xacb9('0xc')];this['dialBusyMaxRetry']=_0x4d19f5[_0xacb9('0xd')];this[_0xacb9('0xe')]=_0x4d19f5[_0xacb9('0xe')];this['dialNoAnswerMaxRetry']=_0x4d19f5['dialNoAnswerMaxRetry'];this[_0xacb9('0xf')]=_0x4d19f5[_0xacb9('0xf')];this[_0xacb9('0x10')]=_0x4d19f5[_0xacb9('0x10')];this[_0xacb9('0x11')]=_0x4d19f5['dialNoSuchNumberMaxRetry']||0x3;this[_0xacb9('0x12')]=_0x4d19f5[_0xacb9('0x12')]||0x96;this['dialDropMaxRetry']=_0x4d19f5[_0xacb9('0x13')]||0x3;this[_0xacb9('0x14')]=_0x4d19f5['dialDropRetryFrequency']||0x96;this[_0xacb9('0x15')]=_0x4d19f5[_0xacb9('0x15')]||0x3;this[_0xacb9('0x16')]=_0x4d19f5[_0xacb9('0x16')]||0x96;this[_0xacb9('0x17')]=_0x4d19f5['dialMachineMaxRetry']||0x3;this[_0xacb9('0x18')]=_0x4d19f5[_0xacb9('0x18')]||0x96;this[_0xacb9('0x19')]=_0x4d19f5[_0xacb9('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4d19f5['dialAgentRejectRetryFrequency']||0x96;this[_0xacb9('0x1a')]=_0x4d19f5[_0xacb9('0x1a')]||_0xacb9('0x1b');this[_0xacb9('0x1c')]=_0x4d19f5[_0xacb9('0x1c')]||undefined;this[_0xacb9('0x1d')]=_0x4d19f5[_0xacb9('0x1d')]||undefined;this[_0xacb9('0x1e')]=_0x4d19f5['dialCutDigit']||undefined;this[_0xacb9('0x1f')]=_0x4d19f5[_0xacb9('0x1f')]?_0x4d19f5[_0xacb9('0x1f')]:undefined;this['Trunk']=_0x4d19f5[_0xacb9('0x20')]?_0x4d19f5[_0xacb9('0x20')]:undefined;this[_0xacb9('0x21')]=_0x4d19f5['Interval']?_0x4d19f5[_0xacb9('0x21')]:undefined;this[_0xacb9('0x22')]=_0x4d19f5[_0xacb9('0x22')]?_0x4d19f5[_0xacb9('0x22')]:undefined;this[_0xacb9('0x23')]=_0x4d19f5[_0xacb9('0x22')]?_0x4d19f5[_0xacb9('0x22')][_0xacb9('0x24')]:undefined;this['dialAMDActive']=_0x4d19f5[_0xacb9('0x25')]||![];this['dialAMDInitialSilence']=_0x4d19f5[_0xacb9('0x26')];this[_0xacb9('0x27')]=_0x4d19f5[_0xacb9('0x27')];this[_0xacb9('0x28')]=_0x4d19f5[_0xacb9('0x28')];this[_0xacb9('0x29')]=_0x4d19f5['dialAMDTotalAnalysisTime'];this[_0xacb9('0x2a')]=_0x4d19f5['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4d19f5[_0xacb9('0x2b')];this[_0xacb9('0x2c')]=_0x4d19f5[_0xacb9('0x2c')];this[_0xacb9('0x2d')]=_0x4d19f5[_0xacb9('0x2d')];this['dialAMDMaximumWordLength']=_0x4d19f5[_0xacb9('0x2e')];}module[_0xacb9('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ed19eda..c799cc6 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 _0xdf5d=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue'];(function(_0x23bccc,_0x135626){var _0x12db50=function(_0x2f0006){while(--_0x2f0006){_0x23bccc['push'](_0x23bccc['shift']());}};_0x12db50(++_0x135626);}(_0xdf5d,0x126));var _0xddf5=function(_0x23595e,_0x3acc9f){_0x23595e=_0x23595e-0x0;var _0x33f7a4=_0xdf5d[_0x23595e];return _0x33f7a4;};'use strict';function Channel(){this[_0xddf5('0x0')]=null;this[_0xddf5('0x1')]='';this[_0xddf5('0x2')]='';this[_0xddf5('0x3')]=0x0;this[_0xddf5('0x4')]='';this[_0xddf5('0x5')]=undefined;this[_0xddf5('0x6')]=undefined;this[_0xddf5('0x7')]=0x0;this['context']='';this[_0xddf5('0x8')]=0x0;this[_0xddf5('0x9')]=0x0;this[_0xddf5('0xa')]=0x0;this[_0xddf5('0xb')]=![];this[_0xddf5('0xc')]=null;this[_0xddf5('0xd')]=null;this[_0xddf5('0xe')]=![];this[_0xddf5('0xf')]=![];this[_0xddf5('0x10')]='';this[_0xddf5('0x11')]='';this[_0xddf5('0x12')]=0x0;this[_0xddf5('0x13')]=0x0;this[_0xddf5('0x14')]=0x0;this[_0xddf5('0x15')]=null;this[_0xddf5('0x16')]=null;this[_0xddf5('0x17')]=null;this['monitor']=![];this[_0xddf5('0x18')]=null;this[_0xddf5('0x19')]=null;this[_0xddf5('0x1a')]=[];this[_0xddf5('0x1b')]=undefined;this[_0xddf5('0x1c')]=undefined;this[_0xddf5('0x1d')]=undefined;this[_0xddf5('0x1e')]=0x0;}module[_0xddf5('0x1f')]=Channel; \ No newline at end of file +var _0x26b2=['disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','abandoned','lastapplication','lastdata','holdtime','type','tag'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26b2,0xc5));var _0x226b=function(_0x159183,_0x56fa20){_0x159183=_0x159183-0x0;var _0x36e9d4=_0x26b2[_0x159183];return _0x36e9d4;};'use strict';function Channel(){this[_0x226b('0x0')]=null;this[_0x226b('0x1')]='';this[_0x226b('0x2')]='';this['calleridnum']=0x0;this[_0x226b('0x3')]='';this[_0x226b('0x4')]=undefined;this[_0x226b('0x5')]=undefined;this[_0x226b('0x6')]=0x0;this[_0x226b('0x7')]='';this[_0x226b('0x8')]=0x0;this[_0x226b('0x9')]=0x0;this[_0x226b('0xa')]=0x0;this[_0x226b('0xb')]=![];this['answertime']=null;this[_0x226b('0xc')]=null;this['unmanaged']=![];this[_0x226b('0xd')]=![];this[_0x226b('0xe')]='';this[_0x226b('0xf')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x226b('0x10')]=0x0;this[_0x226b('0x11')]=null;this[_0x226b('0x12')]=null;this[_0x226b('0x13')]=null;this[_0x226b('0x14')]=![];this[_0x226b('0x15')]=null;this['queue']=null;this[_0x226b('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x226b('0x17')]=undefined;this[_0x226b('0x18')]=undefined;this[_0x226b('0x19')]=0x0;}module[_0x226b('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index fb6fe33..495dcfa 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 _0x4583=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0x4583,0x181));var _0x3458=function(_0x2d1d19,_0x5f5173){_0x2d1d19=_0x2d1d19-0x0;var _0x31b1fb=_0x4583[_0x2d1d19];return _0x31b1fb;};'use strict';function DeskAccount(_0x1be2db){this['id']=_0x1be2db['id']||0x0;this[_0x3458('0x0')]=_0x1be2db['name']||'';this[_0x3458('0x1')]=_0x1be2db[_0x3458('0x1')]||'';this[_0x3458('0x2')]=_0x1be2db[_0x3458('0x2')]||'';this[_0x3458('0x3')]=_0x1be2db[_0x3458('0x3')]||'';this[_0x3458('0x4')]=_0x1be2db['password']||'';this[_0x3458('0x5')]=_0x1be2db[_0x3458('0x5')]||'';this[_0x3458('0x6')]=_0x1be2db[_0x3458('0x6')]||'';this[_0x3458('0x7')]=_0x1be2db[_0x3458('0x7')]||'';this[_0x3458('0x8')]=_0x1be2db['tokenSecret']||'';this[_0x3458('0x9')]=_0x1be2db['type']||'';this[_0x3458('0xa')]=_0x1be2db[_0x3458('0xa')]||'';this[_0x3458('0xb')]=_0x1be2db['Configurations']||{};}module[_0x3458('0xc')]=DeskAccount; \ No newline at end of file +var _0xde83=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x1c5164,_0x3556a4){var _0x12e023=function(_0x334429){while(--_0x334429){_0x1c5164['push'](_0x1c5164['shift']());}};_0x12e023(++_0x3556a4);}(_0xde83,0x1cf));var _0x3de8=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xde83[_0x379799];return _0x46e431;};'use strict';function DeskAccount(_0x4dee70){this['id']=_0x4dee70['id']||0x0;this[_0x3de8('0x0')]=_0x4dee70[_0x3de8('0x0')]||'';this[_0x3de8('0x1')]=_0x4dee70['username']||'';this['remoteUri']=_0x4dee70[_0x3de8('0x2')]||'';this[_0x3de8('0x3')]=_0x4dee70[_0x3de8('0x3')]||'';this['password']=_0x4dee70[_0x3de8('0x4')]||'';this[_0x3de8('0x5')]=_0x4dee70[_0x3de8('0x5')]||'';this[_0x3de8('0x6')]=_0x4dee70['consumerSecret']||'';this[_0x3de8('0x7')]=_0x4dee70[_0x3de8('0x7')]||'';this['tokenSecret']=_0x4dee70[_0x3de8('0x8')]||'';this['type']=_0x4dee70[_0x3de8('0x9')]||'';this[_0x3de8('0xa')]=_0x4dee70[_0x3de8('0xa')]||'';this[_0x3de8('0xb')]=_0x4dee70['Configurations']||{};}module[_0x3de8('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 9575004..3cfc8ee 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 _0xa718=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x58147a,_0x1c784a){var _0x483843=function(_0x15f03){while(--_0x15f03){_0x58147a['push'](_0x58147a['shift']());}};_0x483843(++_0x1c784a);}(_0xa718,0x14d));var _0x8a71=function(_0x3b6a3d,_0x15f056){_0x3b6a3d=_0x3b6a3d-0x0;var _0x1b5b75=_0xa718[_0x3b6a3d];return _0x1b5b75;};'use strict';function Dynamics365Account(_0x1c9de1){this['id']=_0x1c9de1['id']||0x0;this['name']=_0x1c9de1[_0x8a71('0x0')]||'';this[_0x8a71('0x1')]=_0x1c9de1[_0x8a71('0x1')]||'';this[_0x8a71('0x2')]=_0x1c9de1[_0x8a71('0x2')]||'';this['remoteUri']=_0x1c9de1[_0x8a71('0x3')]||'';this[_0x8a71('0x4')]=_0x1c9de1['tenantId']||'';this[_0x8a71('0x5')]=_0x1c9de1[_0x8a71('0x5')]||'';this['clientSecret']=_0x1c9de1[_0x8a71('0x6')]||{};this[_0x8a71('0x7')]=_0x1c9de1[_0x8a71('0x7')]||'';this[_0x8a71('0x8')]=_0x1c9de1[_0x8a71('0x8')]||![];this['Configurations']=_0x1c9de1[_0x8a71('0x9')]||{};this[_0x8a71('0xa')]=_0x1c9de1[_0x8a71('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x46c6=['remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x174959,_0x332b53){var _0x101dd9=function(_0x2671df){while(--_0x2671df){_0x174959['push'](_0x174959['shift']());}};_0x101dd9(++_0x332b53);}(_0x46c6,0x8c));var _0x646c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46c6[_0x4ae6ef];return _0x3cbb4e;};'use strict';function Dynamics365Account(_0x363abc){this['id']=_0x363abc['id']||0x0;this['name']=_0x363abc[_0x646c('0x0')]||'';this['username']=_0x363abc[_0x646c('0x1')]||'';this[_0x646c('0x2')]=_0x363abc[_0x646c('0x2')]||'';this[_0x646c('0x3')]=_0x363abc['remoteUri']||'';this['tenantId']=_0x363abc['tenantId']||'';this[_0x646c('0x4')]=_0x363abc[_0x646c('0x4')]||'';this[_0x646c('0x5')]=_0x363abc['clientSecret']||{};this[_0x646c('0x6')]=_0x363abc['serverUrl']||'';this[_0x646c('0x7')]=_0x363abc[_0x646c('0x7')]||![];this[_0x646c('0x8')]=_0x363abc[_0x646c('0x8')]||{};this['CloudProvider']=_0x363abc[_0x646c('0x9')]||{};}module[_0x646c('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e15b3f6..b1b3991 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 _0x450b=['headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm'];(function(_0x12db32,_0x3444b2){var _0x691ae3=function(_0x5857c7){while(--_0x5857c7){_0x12db32['push'](_0x12db32['shift']());}};_0x691ae3(++_0x3444b2);}(_0x450b,0x1ae));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x1a9d97){this['id']=_0x1a9d97['id']||0x0;this['name']=_0x1a9d97['name']||'';this[_0xb450('0x0')]=_0x1a9d97[_0xb450('0x0')];this[_0xb450('0x1')]=_0x1a9d97[_0xb450('0x1')];this[_0xb450('0x2')]=_0x1a9d97[_0xb450('0x2')];this['localstationid']=_0x1a9d97['localstationid'];this[_0xb450('0x3')]=_0x1a9d97[_0xb450('0x3')]||0x960;this[_0xb450('0x4')]=_0x1a9d97[_0xb450('0x4')]||0x3840;this[_0xb450('0x5')]=_0x1a9d97[_0xb450('0x5')]||_0xb450('0x6');this[_0xb450('0x7')]=_0x1a9d97[_0xb450('0x7')]||'no';this[_0xb450('0x8')]=_0x1a9d97[_0xb450('0x8')]||'no';this[_0xb450('0x9')]=_0x1a9d97[_0xb450('0x9')]||0x1388;this[_0xb450('0xa')]=_0x1a9d97[_0xb450('0xa')]||_0xb450('0xb');this[_0xb450('0xc')]=_0x1a9d97[_0xb450('0xc')]?_0x1a9d97['Trunk']:undefined;this[_0xb450('0xd')]=_0x1a9d97['ListId'];this[_0xb450('0xe')]=_0x1a9d97['key'];}module[_0xb450('0xf')]=FaxAccount; \ No newline at end of file +var _0xfebb=['tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfebb,0x65));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x179f0c){this['id']=_0x179f0c['id']||0x0;this['name']=_0x179f0c[_0xbfeb('0x0')]||'';this[_0xbfeb('0x1')]=_0x179f0c[_0xbfeb('0x1')];this['ecm']=_0x179f0c[_0xbfeb('0x2')];this[_0xbfeb('0x3')]=_0x179f0c[_0xbfeb('0x3')];this[_0xbfeb('0x4')]=_0x179f0c[_0xbfeb('0x4')];this['minrate']=_0x179f0c[_0xbfeb('0x5')]||0x960;this[_0xbfeb('0x6')]=_0x179f0c[_0xbfeb('0x6')]||0x3840;this[_0xbfeb('0x7')]=_0x179f0c[_0xbfeb('0x7')]||'v17,v27,v29';this[_0xbfeb('0x8')]=_0x179f0c[_0xbfeb('0x8')]||'no';this[_0xbfeb('0x9')]=_0x179f0c[_0xbfeb('0x9')]||'no';this['t38timeout']=_0x179f0c[_0xbfeb('0xa')]||0x1388;this[_0xbfeb('0xb')]=_0x179f0c[_0xbfeb('0xb')]||_0xbfeb('0xc');this[_0xbfeb('0xd')]=_0x179f0c[_0xbfeb('0xd')]?_0x179f0c[_0xbfeb('0xd')]:undefined;this[_0xbfeb('0xe')]=_0x179f0c[_0xbfeb('0xe')];this['key']=_0x179f0c['key'];}module[_0xbfeb('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 f0942b0..418db7f 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 _0x9fdf=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x1e97f6,_0x3b484d){var _0x4dfed4=function(_0x29497d){while(--_0x29497d){_0x1e97f6['push'](_0x1e97f6['shift']());}};_0x4dfed4(++_0x3b484d);}(_0x9fdf,0x1db));var _0xf9fd=function(_0x4c72d5,_0x357269){_0x4c72d5=_0x4c72d5-0x0;var _0x13dbfe=_0x9fdf[_0x4c72d5];return _0x13dbfe;};'use strict';function FreshdeskAccount(_0xb682c4){this['id']=_0xb682c4['id']||0x0;this[_0xf9fd('0x0')]=_0xb682c4[_0xf9fd('0x0')]||'';this[_0xf9fd('0x1')]=_0xb682c4[_0xf9fd('0x1')]||'';this['apiKey']=_0xb682c4['token']||'';this[_0xf9fd('0x2')]=_0xb682c4['remoteUri']||'';this[_0xf9fd('0x3')]=_0xb682c4[_0xf9fd('0x3')]||'';this[_0xf9fd('0x4')]=_0xb682c4['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x9c3e=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x3a96e2,_0x5ecb0f){var _0x2c1e1f=function(_0x1fc4b3){while(--_0x1fc4b3){_0x3a96e2['push'](_0x3a96e2['shift']());}};_0x2c1e1f(++_0x5ecb0f);}(_0x9c3e,0x1ed));var _0xe9c3=function(_0xdcfd77,_0x35df91){_0xdcfd77=_0xdcfd77-0x0;var _0x525851=_0x9c3e[_0xdcfd77];return _0x525851;};'use strict';function FreshdeskAccount(_0x12c6a4){this['id']=_0x12c6a4['id']||0x0;this[_0xe9c3('0x0')]=_0x12c6a4[_0xe9c3('0x0')]||'';this[_0xe9c3('0x1')]=_0x12c6a4[_0xe9c3('0x1')]||'';this[_0xe9c3('0x2')]=_0x12c6a4[_0xe9c3('0x3')]||'';this[_0xe9c3('0x4')]=_0x12c6a4[_0xe9c3('0x4')]||'';this['serverUrl']=_0x12c6a4[_0xe9c3('0x5')]||'';this['Configurations']=_0x12c6a4[_0xe9c3('0x6')]||{};}module[_0xe9c3('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1c9f195..c8bd7b2 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 _0x3dd6=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x1f765f,_0x26d199){var _0x2f4f1f=function(_0x44bcd3){while(--_0x44bcd3){_0x1f765f['push'](_0x1f765f['shift']());}};_0x2f4f1f(++_0x26d199);}(_0x3dd6,0xcf));var _0x63dd=function(_0x38441d,_0x12e5f5){_0x38441d=_0x38441d-0x0;var _0x23c0a0=_0x3dd6[_0x38441d];return _0x23c0a0;};'use strict';function FreshsalesAccount(_0x313714){this['id']=_0x313714['id']||0x0;this['name']=_0x313714['name']||'';this[_0x63dd('0x0')]=_0x313714[_0x63dd('0x0')]||'';this[_0x63dd('0x1')]=_0x313714[_0x63dd('0x2')]||'';this[_0x63dd('0x3')]=_0x313714[_0x63dd('0x3')]||'';this['serverUrl']=_0x313714[_0x63dd('0x4')]||'';this['Configurations']=_0x313714[_0x63dd('0x5')]||{};}module[_0x63dd('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x3561=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x52b758,_0x238dbf){var _0x5d75c6=function(_0x1e273f){while(--_0x1e273f){_0x52b758['push'](_0x52b758['shift']());}};_0x5d75c6(++_0x238dbf);}(_0x3561,0x94));var _0x1356=function(_0x3ea3c0,_0x219832){_0x3ea3c0=_0x3ea3c0-0x0;var _0xbe35f3=_0x3561[_0x3ea3c0];return _0xbe35f3;};'use strict';function FreshsalesAccount(_0x217c29){this['id']=_0x217c29['id']||0x0;this['name']=_0x217c29[_0x1356('0x0')]||'';this[_0x1356('0x1')]=_0x217c29[_0x1356('0x1')]||'';this[_0x1356('0x2')]=_0x217c29[_0x1356('0x3')]||'';this[_0x1356('0x4')]=_0x217c29[_0x1356('0x4')]||'';this[_0x1356('0x5')]=_0x217c29[_0x1356('0x5')]||'';this[_0x1356('0x6')]=_0x217c29[_0x1356('0x6')]||{};}module[_0x1356('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 98e8047..72dd59b 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 _0x3274=['uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound'];(function(_0x3828bc,_0x1851ba){var _0x31e55c=function(_0x1842c3){while(--_0x1842c3){_0x3828bc['push'](_0x3828bc['shift']());}};_0x31e55c(++_0x1851ba);}(_0x3274,0xde));var _0x4327=function(_0x28bca7,_0x49a258){_0x28bca7=_0x28bca7-0x0;var _0x22f119=_0x3274[_0x28bca7];return _0x22f119;};'use strict';function QueueReport(){this[_0x4327('0x0')]=_0x4327('0x1');this[_0x4327('0x2')]='';this['calleridnum']='';this[_0x4327('0x3')]='';this[_0x4327('0x4')]='';this[_0x4327('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x4327('0x6')]=0x1;this[_0x4327('0x7')]=0x1;this[_0x4327('0x8')]=![];this[_0x4327('0x9')]=null;this[_0x4327('0xa')]=![];this[_0x4327('0xb')]=null;this[_0x4327('0xc')]=![];this[_0x4327('0xd')]=null;this[_0x4327('0xe')]=0x1;this['channel']='';this[_0x4327('0xf')]='';this['connectedlinename']='';this[_0x4327('0x10')]='';this[_0x4327('0x11')]='';this[_0x4327('0x12')]='';this[_0x4327('0x13')]='';this[_0x4327('0x14')]=0x0;this[_0x4327('0x15')]=![];this[_0x4327('0x16')]='';this[_0x4327('0x17')]=_0x4327('0x18');this[_0x4327('0x19')]=0x0;this[_0x4327('0x1a')]={};}module[_0x4327('0x1b')]=QueueReport; \ No newline at end of file +var _0x40b6=['calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum'];(function(_0x5a6aa7,_0xff2a57){var _0x316b32=function(_0x1019fc){while(--_0x1019fc){_0x5a6aa7['push'](_0x5a6aa7['shift']());}};_0x316b32(++_0xff2a57);}(_0x40b6,0x19c));var _0x640b=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x40b6[_0x2a276d];return _0x2914cd;};'use strict';function QueueReport(){this[_0x640b('0x0')]=_0x640b('0x1');this[_0x640b('0x2')]='';this[_0x640b('0x3')]='';this[_0x640b('0x4')]='';this['queue']='';this[_0x640b('0x5')]=null;this[_0x640b('0x6')]=null;this[_0x640b('0x7')]=0x1;this[_0x640b('0x8')]=0x1;this[_0x640b('0x9')]=![];this[_0x640b('0xa')]=null;this[_0x640b('0xb')]=![];this[_0x640b('0xc')]=null;this[_0x640b('0xd')]=![];this[_0x640b('0xe')]=null;this[_0x640b('0xf')]=0x1;this['channel']='';this[_0x640b('0x10')]='';this[_0x640b('0x11')]='';this['accountcode']='';this[_0x640b('0x12')]='';this[_0x640b('0x13')]='';this[_0x640b('0x14')]='';this[_0x640b('0x15')]=0x0;this[_0x640b('0x16')]=![];this['lastAssignedTo']='';this[_0x640b('0x17')]='voice';this[_0x640b('0x18')]=0x0;this[_0x640b('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index fd43ef2..555f3f6 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 _0x6eb2=['clientSecret','securityToken','type','serverUrl','Configurations','name','remoteUri','password','clientId'];(function(_0x4971a7,_0x2e9b32){var _0x4c754d=function(_0x9c56dc){while(--_0x9c56dc){_0x4971a7['push'](_0x4971a7['shift']());}};_0x4c754d(++_0x2e9b32);}(_0x6eb2,0x10a));var _0x26eb=function(_0x30e899,_0x127f10){_0x30e899=_0x30e899-0x0;var _0x462e0f=_0x6eb2[_0x30e899];return _0x462e0f;};'use strict';function SalesforceAccount(_0x59dfd5){this['id']=_0x59dfd5['id']||0x0;this['name']=_0x59dfd5[_0x26eb('0x0')]||'';this['username']=_0x59dfd5['username']||'';this[_0x26eb('0x1')]=_0x59dfd5[_0x26eb('0x1')]||'';this[_0x26eb('0x2')]=_0x59dfd5[_0x26eb('0x2')]||'';this[_0x26eb('0x3')]=_0x59dfd5[_0x26eb('0x3')]||'';this[_0x26eb('0x4')]=_0x59dfd5['clientSecret']||'';this[_0x26eb('0x5')]=_0x59dfd5[_0x26eb('0x5')]||'';this[_0x26eb('0x6')]=_0x59dfd5[_0x26eb('0x6')]||'integrationTab';this[_0x26eb('0x7')]=_0x59dfd5['serverUrl']||'';this[_0x26eb('0x8')]=_0x59dfd5[_0x26eb('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xd29f=['name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x4cbf2e,_0x18774b){var _0x54c2aa=function(_0x4ed019){while(--_0x4ed019){_0x4cbf2e['push'](_0x4cbf2e['shift']());}};_0x54c2aa(++_0x18774b);}(_0xd29f,0xc6));var _0xfd29=function(_0x3399bb,_0x5e7c53){_0x3399bb=_0x3399bb-0x0;var _0x1afd51=_0xd29f[_0x3399bb];return _0x1afd51;};'use strict';function SalesforceAccount(_0x3f63fc){this['id']=_0x3f63fc['id']||0x0;this[_0xfd29('0x0')]=_0x3f63fc['name']||'';this['username']=_0x3f63fc[_0xfd29('0x1')]||'';this[_0xfd29('0x2')]=_0x3f63fc[_0xfd29('0x2')]||'';this[_0xfd29('0x3')]=_0x3f63fc[_0xfd29('0x3')]||'';this[_0xfd29('0x4')]=_0x3f63fc[_0xfd29('0x4')]||'';this['clientSecret']=_0x3f63fc['clientSecret']||'';this[_0xfd29('0x5')]=_0x3f63fc[_0xfd29('0x5')]||'';this[_0xfd29('0x6')]=_0x3f63fc['type']||_0xfd29('0x7');this[_0xfd29('0x8')]=_0x3f63fc[_0xfd29('0x8')]||'';this['Configurations']=_0x3f63fc[_0xfd29('0x9')]||{};}module[_0xfd29('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b551ab3..40f66d6 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 _0xe4ea=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1a86e2,_0x29a850){var _0x34731e=function(_0x5a48ee){while(--_0x5a48ee){_0x1a86e2['push'](_0x1a86e2['shift']());}};_0x34731e(++_0x29a850);}(_0xe4ea,0x178));var _0xae4e=function(_0x5637f4,_0x5569f0){_0x5637f4=_0x5637f4-0x0;var _0x379f78=_0xe4ea[_0x5637f4];return _0x379f78;};'use strict';function ServicenowAccount(_0x48aca9){this['id']=_0x48aca9['id']||0x0;this['name']=_0x48aca9[_0xae4e('0x0')]||'';this[_0xae4e('0x1')]=_0x48aca9['username']||'';this[_0xae4e('0x2')]=_0x48aca9[_0xae4e('0x2')]||'';this[_0xae4e('0x3')]=_0x48aca9[_0xae4e('0x3')]||'';this[_0xae4e('0x4')]=_0x48aca9['serverUrl']||'';this['Configurations']=_0x48aca9[_0xae4e('0x5')]||{};}module[_0xae4e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x81fb=['Configurations','exports','name','password','remoteUri','serverUrl'];(function(_0x42fb38,_0x41ad46){var _0x4dd8ba=function(_0x1cfa76){while(--_0x1cfa76){_0x42fb38['push'](_0x42fb38['shift']());}};_0x4dd8ba(++_0x41ad46);}(_0x81fb,0x164));var _0xb81f=function(_0x174b36,_0x40c21c){_0x174b36=_0x174b36-0x0;var _0x33f942=_0x81fb[_0x174b36];return _0x33f942;};'use strict';function ServicenowAccount(_0x571d89){this['id']=_0x571d89['id']||0x0;this[_0xb81f('0x0')]=_0x571d89[_0xb81f('0x0')]||'';this['username']=_0x571d89['username']||'';this[_0xb81f('0x1')]=_0x571d89['password']||'';this[_0xb81f('0x2')]=_0x571d89['remoteUri']||'';this[_0xb81f('0x3')]=_0x571d89['serverUrl']||'';this[_0xb81f('0x4')]=_0x571d89[_0xb81f('0x4')]||{};}module[_0xb81f('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5fd44f7..558d9f7 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 _0x6584=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x6584,0x1b4));var _0x4658=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x6584[_0x166742];return _0xb7814a;};'use strict';function SugarcrmAccount(_0x88be93){this['id']=_0x88be93['id']||0x0;this[_0x4658('0x0')]=_0x88be93[_0x4658('0x0')]||'';this[_0x4658('0x1')]=_0x88be93[_0x4658('0x1')]||'';this[_0x4658('0x2')]=_0x88be93['password']||'';this[_0x4658('0x3')]=_0x88be93[_0x4658('0x3')]||'';this['serverUrl']=_0x88be93[_0x4658('0x4')]||'';this[_0x4658('0x5')]=_0x88be93['Configurations']||{};}module[_0x4658('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xd68d=['exports','name','username','password','serverUrl','Configurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd68d,0x7f));var _0xdd68=function(_0xb0ff1f,_0x34c0bd){_0xb0ff1f=_0xb0ff1f-0x0;var _0x486cf1=_0xd68d[_0xb0ff1f];return _0x486cf1;};'use strict';function SugarcrmAccount(_0x3cfe3d){this['id']=_0x3cfe3d['id']||0x0;this[_0xdd68('0x0')]=_0x3cfe3d['name']||'';this[_0xdd68('0x1')]=_0x3cfe3d[_0xdd68('0x1')]||'';this[_0xdd68('0x2')]=_0x3cfe3d[_0xdd68('0x2')]||'';this['remoteUri']=_0x3cfe3d['remoteUri']||'';this[_0xdd68('0x3')]=_0x3cfe3d[_0xdd68('0x3')]||'';this[_0xdd68('0x4')]=_0x3cfe3d[_0xdd68('0x4')]||{};}module[_0xdd68('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4c8bb17..b6269de 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 _0x90f7=['stateTime','status','name','accountcode','state','unknown'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x90f7,0x1d6));var _0x790f=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x90f7[_0x17823f];return _0x51fc21;};'use strict';function Telephone(_0x540d09){this['id']=_0x540d09['id']||0x0;this[_0x790f('0x0')]=_0x540d09[_0x790f('0x0')]||'';this[_0x790f('0x1')]=_0x540d09[_0x790f('0x1')]||'';this[_0x790f('0x2')]=_0x790f('0x3');this[_0x790f('0x4')]=0x0;this[_0x790f('0x5')]=_0x790f('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0x3c90=['exports','name','accountcode','state','unknown','status','address'];(function(_0x208f7c,_0x190e43){var _0x4715d5=function(_0x4fe521){while(--_0x4fe521){_0x208f7c['push'](_0x208f7c['shift']());}};_0x4715d5(++_0x190e43);}(_0x3c90,0xfd));var _0x03c9=function(_0x8fe0cc,_0x2831fd){_0x8fe0cc=_0x8fe0cc-0x0;var _0x532af3=_0x3c90[_0x8fe0cc];return _0x532af3;};'use strict';function Telephone(_0x278319){this['id']=_0x278319['id']||0x0;this[_0x03c9('0x0')]=_0x278319[_0x03c9('0x0')]||'';this[_0x03c9('0x1')]=_0x278319[_0x03c9('0x1')]||'';this[_0x03c9('0x2')]=_0x03c9('0x3');this['stateTime']=0x0;this[_0x03c9('0x4')]='unknown';this[_0x03c9('0x5')]='';}module[_0x03c9('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 69498c8..0466785 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(_0x1a13d6,_0x149f1c){var _0x11f719=function(_0xebc4b0){while(--_0xebc4b0){_0x1a13d6['push'](_0x1a13d6['shift']());}};_0x11f719(++_0x149f1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0xd854dc,_0x3d254b){var _0x1d3ac2=function(_0x2b6d3d){while(--_0x2b6d3d){_0xd854dc['push'](_0xd854dc['shift']());}};_0x1d3ac2(++_0x3d254b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xb10b[_0x4f4c53];return _0x568ff1;};'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 af3deb6..a9d684b 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x420e23,_0x146cea){var _0x213bcb=function(_0x4675d2){while(--_0x4675d2){_0x420e23['push'](_0x420e23['shift']());}};_0x213bcb(++_0x146cea);}(_0x14a0,0x8e));var _0x014a=function(_0x47de5e,_0x22b91f){_0x47de5e=_0x47de5e-0x0;var _0x190e3e=_0x14a0[_0x47de5e];return _0x190e3e;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1a85,0x178));var _0x51a8=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0x1a85[_0x2ec7f2];return _0x29de00;};'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 f2f5c87..06a4aaf 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 _0x07e6=['domain','domainport','refresh','address','defaultuser','active','name','state','status','unknown','registry','indexOf','split','port'];(function(_0x3f8985,_0x401749){var _0x47e3d3=function(_0x4b7876){while(--_0x4b7876){_0x3f8985['push'](_0x3f8985['shift']());}};_0x47e3d3(++_0x401749);}(_0x07e6,0x147));var _0x607e=function(_0x4cc396,_0xaa4d37){_0x4cc396=_0x4cc396-0x0;var _0x1e346e=_0x07e6[_0x4cc396];return _0x1e346e;};'use strict';function Trunk(_0x4d579a){this['id']=_0x4d579a['id']||0x0;this['active']=_0x4d579a[_0x607e('0x0')]||![];this[_0x607e('0x1')]=_0x4d579a['name']||'';this[_0x607e('0x2')]='unknown';this['stateTime']=0x0;this[_0x607e('0x3')]=_0x607e('0x4');this[_0x607e('0x5')]=_0x4d579a['registry']&&_0x4d579a[_0x607e('0x5')][_0x607e('0x6')](':')?_0x4d579a[_0x607e('0x5')][_0x607e('0x7')](':')[0x0]:'';this['host']='';this[_0x607e('0x8')]='';this[_0x607e('0x9')]='';this[_0x607e('0xa')]='';this[_0x607e('0xb')]='';this['stateRegistry']=_0x607e('0x4');this['registrationtime']='';this[_0x607e('0xc')]='';this[_0x607e('0xd')]=_0x4d579a['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x9ab1=['active','name','unknown','stateTime','status','registry','host','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9ab1,0x138));var _0x19ab=function(_0x29248e,_0x53ec76){_0x29248e=_0x29248e-0x0;var _0x41b128=_0x9ab1[_0x29248e];return _0x41b128;};'use strict';function Trunk(_0x513c97){this['id']=_0x513c97['id']||0x0;this[_0x19ab('0x0')]=_0x513c97[_0x19ab('0x0')]||![];this[_0x19ab('0x1')]=_0x513c97[_0x19ab('0x1')]||'';this['state']=_0x19ab('0x2');this[_0x19ab('0x3')]=0x0;this[_0x19ab('0x4')]=_0x19ab('0x2');this['registry']=_0x513c97[_0x19ab('0x5')]&&_0x513c97[_0x19ab('0x5')]['indexOf'](':')?_0x513c97[_0x19ab('0x5')]['split'](':')[0x0]:'';this[_0x19ab('0x6')]='';this['port']='';this['domain']='';this['domainport']='';this[_0x19ab('0x7')]='';this[_0x19ab('0x8')]='unknown';this['registrationtime']='';this[_0x19ab('0x9')]='';this[_0x19ab('0xa')]=_0x513c97['defaultuser']||'';}module[_0x19ab('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0147df1..bf74e77 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 _0x2173=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x4eb810,_0x3e6a9a){var _0x62a58a=function(_0x451372){while(--_0x451372){_0x4eb810['push'](_0x4eb810['shift']());}};_0x62a58a(++_0x3e6a9a);}(_0x2173,0xbf));var _0x3217=function(_0xf5e35f,_0x271b45){_0xf5e35f=_0xf5e35f-0x0;var _0x2163ad=_0x2173[_0xf5e35f];return _0x2163ad;};'use strict';function voiceExtension(_0x117e3a){this['id']=_0x117e3a['id']||0x0;this[_0x3217('0x0')]=_0x117e3a[_0x3217('0x0')]||'';this[_0x3217('0x1')]=_0x117e3a[_0x3217('0x1')]||_0x3217('0x2');this[_0x3217('0x3')]=_0x117e3a['mandatoryDisposition']||![];}module[_0x3217('0x4')]=voiceExtension; \ No newline at end of file +var _0x2a8a=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x4290b3,_0x48f454){var _0x2d12d9=function(_0x1ece14){while(--_0x1ece14){_0x4290b3['push'](_0x4290b3['shift']());}};_0x2d12d9(++_0x48f454);}(_0x2a8a,0x85));var _0xa2a8=function(_0x3b14eb,_0x5ed7ae){_0x3b14eb=_0x3b14eb-0x0;var _0x2ff419=_0x2a8a[_0x3b14eb];return _0x2ff419;};'use strict';function voiceExtension(_0x234396){this['id']=_0x234396['id']||0x0;this[_0xa2a8('0x0')]=_0x234396[_0xa2a8('0x0')]||'';this[_0xa2a8('0x1')]=_0x234396['recordingFormat']||_0xa2a8('0x2');this[_0xa2a8('0x3')]=_0x234396['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index a5de95e..3cc4860 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 _0xf40b=['pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay'];(function(_0x1e7db3,_0x4fa7e1){var _0x10d4e5=function(_0x3969da){while(--_0x3969da){_0x1e7db3['push'](_0x1e7db3['shift']());}};_0x10d4e5(++_0x4fa7e1);}(_0xf40b,0xb0));var _0xbf40=function(_0x1e55d9,_0x5ce14a){_0x1e55d9=_0x1e55d9-0x0;var _0x6dc799=_0xf40b[_0x1e55d9];return _0x6dc799;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xbf40('0x0'),'gsm':_0xbf40('0x1')};var strategy={'fewestcalls':_0xbf40('0x2'),'leastrecent':_0xbf40('0x3'),'linear':'linear','random':_0xbf40('0x4'),'ringall':_0xbf40('0x5'),'rr':_0xbf40('0x6'),'rrmemory':_0xbf40('0x7'),'rrordered':_0xbf40('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x2e74b5){this['id']=_0x2e74b5['id']||0x0;this[_0xbf40('0x9')]=_0x2e74b5[_0xbf40('0x9')]||'';this[_0xbf40('0xa')]=_0x2e74b5[_0xbf40('0xa')]||'';this['type']=_0x2e74b5[_0xbf40('0xb')]||_0xbf40('0xc');this[_0xbf40('0xd')]=0x0;this[_0xbf40('0xe')]=0x0;this[_0xbf40('0xf')]=0x0;this[_0xbf40('0x10')]=0x0;this[_0xbf40('0x11')]=0x0;this[_0xbf40('0x12')]=0x0;this['unmanaged']=0x0;this[_0xbf40('0x13')]=0x0;this[_0xbf40('0x14')]=0x0;this[_0xbf40('0x15')]=0x0;this[_0xbf40('0x16')]=0x0;this[_0xbf40('0x17')]=0x0;this[_0xbf40('0x18')]=0x0;this[_0xbf40('0x19')]=0x0;this[_0xbf40('0x1a')]=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0xbf40('0x1b')]=0x0;this[_0xbf40('0x1c')]=0x0;this[_0xbf40('0x1d')]=0x0;this[_0xbf40('0x1e')]=0x0;this['acw']=_0x2e74b5[_0xbf40('0x1f')]||![];this[_0xbf40('0x20')]=_0x2e74b5[_0xbf40('0x20')]||0xa;this[_0xbf40('0x21')]=_0x2e74b5[_0xbf40('0x21')]||'no';this[_0xbf40('0x22')]=!![];this[_0xbf40('0x23')]='';this[_0xbf40('0x24')]='';this['originated']=0x0;this[_0xbf40('0x25')]=0x0;this[_0xbf40('0x26')]=_0x2e74b5[_0xbf40('0x26')]||null;this[_0xbf40('0x27')]=_0x2e74b5[_0xbf40('0x27')]?_0x2e74b5[_0xbf40('0x27')]:null;this[_0xbf40('0x28')]=_0x2e74b5[_0xbf40('0x28')];this['dialMethod']=_0x2e74b5[_0xbf40('0x29')]||_0xbf40('0x2a');this[_0xbf40('0x2b')]=_0x2e74b5[_0xbf40('0x2b')]||0x0;this['dialLimitQueue']=_0x2e74b5[_0xbf40('0x2c')]||0x0;this[_0xbf40('0x2d')]=_0x2e74b5[_0xbf40('0x2d')]||0x1;this[_0xbf40('0x2e')]=_0x2e74b5[_0xbf40('0x2e')]||_0xbf40('0x2f');this[_0xbf40('0x30')]=_0x2e74b5[_0xbf40('0x30')]||0.03;this[_0xbf40('0x31')]=_0x2e74b5[_0xbf40('0x31')]||0x258;this[_0xbf40('0x32')]=_0x2e74b5[_0xbf40('0x32')]||_0xbf40('0x33');this[_0xbf40('0x34')]=_0x2e74b5[_0xbf40('0x34')]||_0xbf40('0x33');this['dialOriginateTimeout']=_0x2e74b5[_0xbf40('0x35')]||0x1e;this[_0xbf40('0x36')]=_0x2e74b5[_0xbf40('0x36')]||_0xbf40('0x37');this[_0xbf40('0x38')]=_0x2e74b5[_0xbf40('0x38')]||0x3;this[_0xbf40('0x39')]=_0x2e74b5[_0xbf40('0x39')]||undefined;this[_0xbf40('0x3a')]=_0x2e74b5[_0xbf40('0x3a')]||0x3;this[_0xbf40('0x3b')]=_0x2e74b5[_0xbf40('0x3b')]||0x96;this[_0xbf40('0x3c')]=_0x2e74b5[_0xbf40('0x3c')]||0x3;this['dialBusyRetryFrequency']=_0x2e74b5[_0xbf40('0x3d')]||0x96;this['dialNoAnswerMaxRetry']=_0x2e74b5[_0xbf40('0x3e')]||0x3;this[_0xbf40('0x3f')]=_0x2e74b5[_0xbf40('0x3f')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2e74b5[_0xbf40('0x40')]||0x3;this[_0xbf40('0x41')]=_0x2e74b5[_0xbf40('0x41')]||0x96;this['dialDropMaxRetry']=_0x2e74b5[_0xbf40('0x42')]||0x3;this['dialDropRetryFrequency']=_0x2e74b5[_0xbf40('0x43')]||0x96;this[_0xbf40('0x44')]=_0x2e74b5[_0xbf40('0x44')]||0x3;this['dialAbandonedRetryFrequency']=_0x2e74b5[_0xbf40('0x45')]||0x96;this[_0xbf40('0x46')]=_0x2e74b5[_0xbf40('0x46')]||0x3;this[_0xbf40('0x47')]=_0x2e74b5[_0xbf40('0x47')]||0x96;this[_0xbf40('0x48')]=_0x2e74b5[_0xbf40('0x48')]||0x3;this[_0xbf40('0x49')]=_0x2e74b5[_0xbf40('0x49')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2e74b5[_0xbf40('0x4a')]||0x3;this[_0xbf40('0x4b')]=_0x2e74b5[_0xbf40('0x4b')]||0x4;this[_0xbf40('0x4c')]=_0x2e74b5['Trunk']?_0x2e74b5[_0xbf40('0x4c')]:undefined;this['TrunkBackup']=_0x2e74b5[_0xbf40('0x4d')]?_0x2e74b5[_0xbf40('0x4d')]:undefined;this[_0xbf40('0x4e')]=_0x2e74b5['dialPrefix']||undefined;this[_0xbf40('0x4f')]=_0x2e74b5[_0xbf40('0x4f')]?_0x2e74b5[_0xbf40('0x4f')]:undefined;this[_0xbf40('0x50')]=_0x2e74b5[_0xbf40('0x50')]||'DESC';this[_0xbf40('0x51')]=_0x2e74b5[_0xbf40('0x51')]||undefined;this[_0xbf40('0x52')]=_0x2e74b5['dialCutDigit']||undefined;this[_0xbf40('0x53')]=strategy[_0x2e74b5[_0xbf40('0x53')]];this[_0xbf40('0x54')]=!![];this['dialAMDActive']=_0x2e74b5[_0xbf40('0x55')]||![];this[_0xbf40('0x56')]=_0x2e74b5[_0xbf40('0x56')];this[_0xbf40('0x57')]=_0x2e74b5[_0xbf40('0x57')];this[_0xbf40('0x58')]=_0x2e74b5[_0xbf40('0x58')];this[_0xbf40('0x59')]=_0x2e74b5[_0xbf40('0x59')];this[_0xbf40('0x5a')]=_0x2e74b5[_0xbf40('0x5a')];this[_0xbf40('0x5b')]=_0x2e74b5[_0xbf40('0x5b')];this[_0xbf40('0x5c')]=_0x2e74b5['dialAMDMaximumNumberOfWords'];this[_0xbf40('0x5d')]=_0x2e74b5['dialAMDSilenceThreshold'];this[_0xbf40('0x5e')]=_0x2e74b5[_0xbf40('0x5e')];this[_0xbf40('0x5f')]=0x0;this[_0xbf40('0x60')]=0x0;this[_0xbf40('0x61')]=_0x2e74b5['timeout'];this[_0xbf40('0x62')]=0x0;this[_0xbf40('0x63')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xbf40('0x64')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xbf40('0x65')]=0x0;this[_0xbf40('0x66')]=0x0;this[_0xbf40('0x67')]=0x0;this[_0xbf40('0x68')]=0x0;this[_0xbf40('0x69')]=0x0;this[_0xbf40('0x6a')]=0x0;this[_0xbf40('0x6b')]=0x0;this['outboundReCallsDay']=0x0;this[_0xbf40('0x6c')]=0x0;this[_0xbf40('0x6d')]=undefined;this[_0xbf40('0x6e')]=undefined;this[_0xbf40('0x6f')]=undefined;this[_0xbf40('0x70')]=1.05;this[_0xbf40('0x71')]=0x0;this[_0xbf40('0x72')]=0x0;this[_0xbf40('0x73')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xbf40('0x74')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xbf40('0x75')]=0x0;this[_0xbf40('0x76')]=0x0;this[_0xbf40('0x77')]=_0x2e74b5[_0xbf40('0x78')]||0x14;this['predictiveIntervalMinThreshold']=_0x2e74b5['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbf40('0x79')]=0x0;this[_0xbf40('0x7a')]=0x0;this[_0xbf40('0x7b')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xbf40('0x7c')]=0x0;this['erlangBusyFactor']=0x0;this[_0xbf40('0x7d')]=_0x2e74b5['dialRecallMeTimeout']||0x1e;this[_0xbf40('0x7e')]=_0x2e74b5[_0xbf40('0x7e')]||![];this['dialPreviewAutoRecallMe']=!!_0x2e74b5[_0xbf40('0x7f')]||![];this[_0xbf40('0x80')]=!!_0x2e74b5['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x2e74b5[_0xbf40('0x81')]||undefined;this[_0xbf40('0x82')]=_0x2e74b5['dialAgiAfterHangupClient']||![];this[_0xbf40('0x83')]=_0x2e74b5[_0xbf40('0x83')]||![];this[_0xbf40('0xa')]=monitorFormat[_0x2e74b5[_0xbf40('0xa')]]?monitorFormat[_0x2e74b5[_0xbf40('0xa')]]:undefined;this['mandatoryDisposition']=_0x2e74b5[_0xbf40('0x84')]||![];this[_0xbf40('0x85')]=_0x2e74b5[_0xbf40('0x85')]?_0x2e74b5[_0xbf40('0x85')]:undefined;this[_0xbf40('0x86')]=![];}module[_0xbf40('0x87')]=VoiceQueue; \ No newline at end of file +var _0xbcba=['predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','monitor_format','type','total','answered','sumDuration','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','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','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls'];(function(_0x332f04,_0x30ba54){var _0x430424=function(_0x426142){while(--_0x426142){_0x332f04['push'](_0x332f04['shift']());}};_0x430424(++_0x30ba54);}(_0xbcba,0x198));var _0xabcb=function(_0x30dc94,_0x1fbf9f){_0x30dc94=_0x30dc94-0x0;var _0x270674=_0xbcba[_0x30dc94];return _0x270674;};'use strict';var monitorFormat={'wav':_0xabcb('0x0'),'wav49':_0xabcb('0x1'),'gsm':_0xabcb('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0xabcb('0x3'),'random':'random','ringall':_0xabcb('0x4'),'rr':_0xabcb('0x5'),'rrmemory':_0xabcb('0x6'),'rrordered':_0xabcb('0x7'),'wrandom':_0xabcb('0x8')};function VoiceQueue(_0x4231a2){this['id']=_0x4231a2['id']||0x0;this['name']=_0x4231a2['name']||'';this[_0xabcb('0x9')]=_0x4231a2[_0xabcb('0x9')]||'';this[_0xabcb('0xa')]=_0x4231a2[_0xabcb('0xa')]||'inbound';this['waiting']=0x0;this[_0xabcb('0xb')]=0x0;this[_0xabcb('0xc')]=0x0;this[_0xabcb('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xabcb('0xe')]=0x0;this['unmanaged']=0x0;this[_0xabcb('0xf')]=0x0;this[_0xabcb('0x10')]=0x0;this[_0xabcb('0x11')]=0x0;this[_0xabcb('0x12')]=0x0;this[_0xabcb('0x13')]=0x0;this[_0xabcb('0x14')]=0x0;this[_0xabcb('0x15')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0xabcb('0x16')]=0x0;this[_0xabcb('0x17')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xabcb('0x18')]=_0x4231a2[_0xabcb('0x18')]||![];this[_0xabcb('0x19')]=_0x4231a2['acwTimeout']||0xa;this[_0xabcb('0x1a')]=_0x4231a2[_0xabcb('0x1a')]||'no';this[_0xabcb('0x1b')]=!![];this[_0xabcb('0x1c')]='';this[_0xabcb('0x1d')]='';this[_0xabcb('0x1e')]=0x0;this[_0xabcb('0x1f')]=0x0;this[_0xabcb('0x20')]=_0x4231a2[_0xabcb('0x20')]||null;this[_0xabcb('0x21')]=_0x4231a2['dialGlobalInterval']?_0x4231a2[_0xabcb('0x21')]:null;this[_0xabcb('0x22')]=_0x4231a2[_0xabcb('0x22')];this[_0xabcb('0x23')]=_0x4231a2[_0xabcb('0x23')]||_0xabcb('0x24');this['dialLimitChannel']=_0x4231a2[_0xabcb('0x25')]||0x0;this['dialLimitQueue']=_0x4231a2['dialLimitQueue']||0x0;this[_0xabcb('0x26')]=_0x4231a2[_0xabcb('0x26')]||0x1;this[_0xabcb('0x27')]=_0x4231a2[_0xabcb('0x27')]||_0xabcb('0x28');this[_0xabcb('0x29')]=_0x4231a2[_0xabcb('0x29')]||0.03;this[_0xabcb('0x2a')]=_0x4231a2['dialPredictiveInterval']||0x258;this[_0xabcb('0x2b')]=_0x4231a2['dialOriginateCallerIdName']||_0xabcb('0x2c');this['dialOriginateCallerIdNumber']=_0x4231a2[_0xabcb('0x2d')]||_0xabcb('0x2c');this['dialOriginateTimeout']=_0x4231a2[_0xabcb('0x2e')]||0x1e;this['dialQueueOptions']=_0x4231a2['dialQueueOptions']||_0xabcb('0x2f');this[_0xabcb('0x30')]=_0x4231a2['dialQueueTimeout']||0x3;this[_0xabcb('0x31')]=_0x4231a2[_0xabcb('0x31')]||undefined;this[_0xabcb('0x32')]=_0x4231a2['dialCongestionMaxRetry']||0x3;this[_0xabcb('0x33')]=_0x4231a2[_0xabcb('0x33')]||0x96;this[_0xabcb('0x34')]=_0x4231a2[_0xabcb('0x34')]||0x3;this[_0xabcb('0x35')]=_0x4231a2[_0xabcb('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x4231a2[_0xabcb('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4231a2['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4231a2[_0xabcb('0x37')]||0x3;this[_0xabcb('0x38')]=_0x4231a2[_0xabcb('0x38')]||0x96;this[_0xabcb('0x39')]=_0x4231a2[_0xabcb('0x39')]||0x3;this[_0xabcb('0x3a')]=_0x4231a2[_0xabcb('0x3a')]||0x96;this[_0xabcb('0x3b')]=_0x4231a2[_0xabcb('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x4231a2['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4231a2[_0xabcb('0x3c')]||0x3;this[_0xabcb('0x3d')]=_0x4231a2[_0xabcb('0x3d')]||0x96;this[_0xabcb('0x3e')]=_0x4231a2[_0xabcb('0x3e')]||0x3;this[_0xabcb('0x3f')]=_0x4231a2['dialAgentRejectRetryFrequency']||0x96;this[_0xabcb('0x40')]=_0x4231a2['callAdditionalPhoneAfterMin']||0x3;this[_0xabcb('0x41')]=_0x4231a2[_0xabcb('0x41')]||0x4;this['Trunk']=_0x4231a2[_0xabcb('0x42')]?_0x4231a2['Trunk']:undefined;this[_0xabcb('0x43')]=_0x4231a2[_0xabcb('0x43')]?_0x4231a2[_0xabcb('0x43')]:undefined;this[_0xabcb('0x44')]=_0x4231a2[_0xabcb('0x44')]||undefined;this['Interval']=_0x4231a2[_0xabcb('0x45')]?_0x4231a2[_0xabcb('0x45')]:undefined;this[_0xabcb('0x46')]=_0x4231a2['dialOrderByScheduledAt']||_0xabcb('0x47');this[_0xabcb('0x48')]=_0x4231a2[_0xabcb('0x48')]||undefined;this[_0xabcb('0x49')]=_0x4231a2[_0xabcb('0x49')]||undefined;this['strategy']=strategy[_0x4231a2[_0xabcb('0x4a')]];this[_0xabcb('0x4b')]=!![];this[_0xabcb('0x4c')]=_0x4231a2[_0xabcb('0x4c')]||![];this['dialAMDInitialSilence']=_0x4231a2[_0xabcb('0x4d')];this[_0xabcb('0x4e')]=_0x4231a2[_0xabcb('0x4e')];this[_0xabcb('0x4f')]=_0x4231a2[_0xabcb('0x4f')];this['dialAMDTotalAnalysisTime']=_0x4231a2[_0xabcb('0x50')];this[_0xabcb('0x51')]=_0x4231a2['dialAMDMinWordLength'];this[_0xabcb('0x52')]=_0x4231a2[_0xabcb('0x52')];this[_0xabcb('0x53')]=_0x4231a2[_0xabcb('0x53')];this[_0xabcb('0x54')]=_0x4231a2[_0xabcb('0x54')];this[_0xabcb('0x55')]=_0x4231a2[_0xabcb('0x55')];this[_0xabcb('0x56')]=0x0;this['pTalking']=0x0;this[_0xabcb('0x57')]=_0x4231a2['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xabcb('0x58')]=0x0;this[_0xabcb('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xabcb('0x5a')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xabcb('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xabcb('0x5c')]=0x0;this[_0xabcb('0x5d')]=0x0;this[_0xabcb('0x5e')]=0x0;this[_0xabcb('0x5f')]=0x0;this[_0xabcb('0x60')]=undefined;this[_0xabcb('0x61')]=undefined;this['handlePredictive']=undefined;this[_0xabcb('0x62')]=1.05;this[_0xabcb('0x63')]=0x0;this[_0xabcb('0x64')]=0x0;this[_0xabcb('0x65')]=0x0;this[_0xabcb('0x66')]=0x0;this[_0xabcb('0x67')]=0x0;this[_0xabcb('0x68')]=0x0;this[_0xabcb('0x69')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xabcb('0x6a')]=_0x4231a2[_0xabcb('0x6b')]||0x14;this[_0xabcb('0x6c')]=_0x4231a2[_0xabcb('0x6b')]||0xa;this[_0xabcb('0x6d')]=0x0;this[_0xabcb('0x6e')]=0x0;this[_0xabcb('0x6f')]=0x1;this[_0xabcb('0x70')]=0x0;this[_0xabcb('0x71')]=0x0;this[_0xabcb('0x72')]=0x0;this[_0xabcb('0x73')]=0x0;this[_0xabcb('0x74')]=_0x4231a2[_0xabcb('0x74')]||0x1e;this['dialRecallInQueue']=_0x4231a2[_0xabcb('0x75')]||![];this[_0xabcb('0x76')]=!!_0x4231a2[_0xabcb('0x76')]||![];this[_0xabcb('0x77')]=!!_0x4231a2[_0xabcb('0x77')]||![];this[_0xabcb('0x78')]=_0x4231a2[_0xabcb('0x78')]||undefined;this[_0xabcb('0x79')]=_0x4231a2[_0xabcb('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x4231a2[_0xabcb('0x7a')]||![];this[_0xabcb('0x9')]=monitorFormat[_0x4231a2[_0xabcb('0x9')]]?monitorFormat[_0x4231a2['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4231a2[_0xabcb('0x7b')]||![];this['mandatoryDispositionPause']=_0x4231a2['mandatoryDispositionPause']?_0x4231a2[_0xabcb('0x7c')]:undefined;this[_0xabcb('0x7d')]=![];}module[_0xabcb('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5525ff9..1df05a7 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 _0x1db9=['loggedin','callers','length','online','incall','includes','status','booked','keys','queue','exten','xcally-motion-preview','compareToOutboundQueue','some','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedIn','loggedInDb','paused','ringing','talking','answered','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','ringInUse'];(function(_0x36b40a,_0x3d2bc7){var _0x59b547=function(_0x25f96b){while(--_0x25f96b){_0x36b40a['push'](_0x36b40a['shift']());}};_0x59b547(++_0x3d2bc7);}(_0x1db9,0x176));var _0x91db=function(_0x29fe9c,_0x452ac0){_0x29fe9c=_0x29fe9c-0x0;var _0x47c1f3=_0x1db9[_0x29fe9c];return _0x47c1f3;};'use strict';var INBOUND_COUNTERS=[_0x91db('0x0'),_0x91db('0x1'),_0x91db('0x2'),_0x91db('0x3'),_0x91db('0x4'),_0x91db('0x5'),'waiting'];var OUTBOUND_COUNTERS=[_0x91db('0x0'),_0x91db('0x6'),'inUse','loggedIn',_0x91db('0x2'),'originated','outboundAbandonedCallsDay',_0x91db('0x7'),_0x91db('0x8'),_0x91db('0x9'),_0x91db('0xa'),_0x91db('0xb'),'outboundNoSuchCallsDay',_0x91db('0xc'),'outboundRejectCallsDay',_0x91db('0xd'),_0x91db('0x3'),_0x91db('0xe'),'talking',_0x91db('0xf'),'sumDuration','total','waiting'];function VoiceQueueSummary(_0x14f9ad){this['id']=_0x14f9ad['id'];this[_0x91db('0x10')]=_0x14f9ad['name'];this['strategy']=_0x14f9ad[_0x91db('0x11')];this[_0x91db('0x12')]=_0x14f9ad[_0x91db('0x12')]||0x0;this[_0x91db('0x6')]=_0x14f9ad[_0x91db('0x6')]||0x0;this['available']=_0x14f9ad[_0x91db('0x0')]||0x0;this[_0x91db('0x13')]=_0x14f9ad[_0x91db('0x13')]||0x0;this[_0x91db('0x14')]=_0x14f9ad[_0x91db('0x14')]||0x0;this[_0x91db('0x15')]=_0x14f9ad[_0x91db('0x15')]||0x0;this[_0x91db('0x1')]=_0x14f9ad[_0x91db('0x1')]||0x0;this[_0x91db('0x2')]=_0x14f9ad[_0x91db('0x2')]||0x0;this[_0x91db('0x16')]=_0x14f9ad['onHold']||0x0;this[_0x91db('0x17')]=_0x14f9ad[_0x91db('0x17')]||0x0;this[_0x91db('0x3')]=_0x14f9ad[_0x91db('0x3')]||0x0;this[_0x91db('0x4')]=_0x14f9ad[_0x91db('0x4')]||0x0;this['ringInUse']=_0x14f9ad['ringInUse'];this[_0x91db('0xf')]=_0x14f9ad[_0x91db('0xf')];this[_0x91db('0x18')]=_0x14f9ad[_0x91db('0x18')];this['sumHoldTime']=_0x14f9ad[_0x91db('0x19')]||0x0;this[_0x91db('0x5')]=_0x14f9ad[_0x91db('0x5')]||0x0;this[_0x91db('0x1a')]=_0x14f9ad[_0x91db('0x1a')]||0x0;this[_0x91db('0x1b')]=_0x14f9ad[_0x91db('0x1b')];this[_0x91db('0x1c')]=_0x14f9ad[_0x91db('0x1c')]||0x0;this[_0x91db('0x1d')]=_0x14f9ad['unknown']||0x0;this['unmanaged']=_0x14f9ad[_0x91db('0x1e')]||0x0;this[_0x91db('0x1f')]=_0x14f9ad['waiting']||0x0;if(_0x14f9ad[_0x91db('0x1b')]===_0x91db('0x20')){this[_0x91db('0xe')]=_0x14f9ad[_0x91db('0xe')]||0x0;this[_0x91db('0x21')]=_0x14f9ad['dialActive'];this['dialMethod']=_0x14f9ad[_0x91db('0x22')];this[_0x91db('0x23')]=_0x14f9ad[_0x91db('0x23')];this['dialOriginateCallerIdNumber']=_0x14f9ad[_0x91db('0x24')];this[_0x91db('0x25')]=_0x14f9ad[_0x91db('0x25')];this[_0x91db('0x26')]=_0x14f9ad['dialPrefix'];this[_0x91db('0x27')]=_0x14f9ad[_0x91db('0x27')];this[_0x91db('0x28')]=_0x14f9ad['outboundAnswerAgiCallsDay'];this[_0x91db('0x7')]=_0x14f9ad[_0x91db('0x7')];this[_0x91db('0x8')]=_0x14f9ad[_0x91db('0x8')];this[_0x91db('0x9')]=_0x14f9ad[_0x91db('0x9')];this[_0x91db('0xa')]=_0x14f9ad[_0x91db('0xa')];this[_0x91db('0x29')]=_0x14f9ad[_0x91db('0x29')];this[_0x91db('0x2a')]=_0x14f9ad[_0x91db('0x2a')];this[_0x91db('0x2b')]=_0x14f9ad[_0x91db('0x2b')];this['outboundNoAnswerCallsDay']=_0x14f9ad[_0x91db('0xb')];this[_0x91db('0x2c')]=_0x14f9ad[_0x91db('0x2c')];this[_0x91db('0x2d')]=_0x14f9ad[_0x91db('0x2d')];this['outboundReCallsDay']=_0x14f9ad[_0x91db('0xc')];this[_0x91db('0x2e')]=_0x14f9ad[_0x91db('0x2e')];this['outboundUnknownCallsDay']=_0x14f9ad[_0x91db('0xd')];this['predictiveIntervalAnsweredCalls']=_0x14f9ad[_0x91db('0x2f')];this[_0x91db('0x30')]=_0x14f9ad[_0x91db('0x30')];this[_0x91db('0x31')]=_0x14f9ad['predictiveIntervalAvgTalktime'];this[_0x91db('0x32')]=_0x14f9ad[_0x91db('0x32')];this[_0x91db('0x33')]=_0x14f9ad['predictiveIntervalDroppedCallsTimeout'];this[_0x91db('0x34')]=_0x14f9ad[_0x91db('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x14f9ad[_0x91db('0x35')];this[_0x91db('0x36')]=_0x14f9ad['predictiveIntervalHitRate'];this[_0x91db('0x37')]=_0x14f9ad['predictiveIntervalMultiplicativeFactor'];this[_0x91db('0x38')]=_0x14f9ad[_0x91db('0x38')];this['predictiveIntervalAvailable']=_0x14f9ad['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x14f9ad[_0x91db('0x39')];this[_0x91db('0x3a')]=_0x14f9ad['originated'];this[_0x91db('0x3b')]=_0x14f9ad[_0x91db('0x3b')];this[_0x91db('0x3c')]=_0x14f9ad[_0x91db('0x3c')];this[_0x91db('0x3d')]=_0x14f9ad[_0x91db('0x3d')];this[_0x91db('0x3e')]=_0x14f9ad[_0x91db('0x3e')];this[_0x91db('0x3f')]=_0x14f9ad[_0x91db('0x3f')];this[_0x91db('0x40')]=_0x14f9ad['startProgressive'];this[_0x91db('0x41')]=_0x14f9ad['message'];this[_0x91db('0x42')]=_0x14f9ad[_0x91db('0x42')];}if(_0x14f9ad['Trunk']){this[_0x91db('0x43')]={'id':_0x14f9ad[_0x91db('0x43')]['id'],'name':_0x14f9ad[_0x91db('0x43')][_0x91db('0x10')],'active':_0x14f9ad[_0x91db('0x43')]['active'],'callerid':_0x14f9ad[_0x91db('0x43')][_0x91db('0x44')]};}}VoiceQueueSummary[_0x91db('0x45')]['createReport']=function(_0x4733a4,_0xed543c,_0x3aaf2e,_0x592849){this[_0x91db('0x2')]=0x0;this[_0x91db('0x5')]=0x0;this[_0x91db('0x3')]=0x0;this[_0x91db('0x1d')]=0x0;this[_0x91db('0x17')]=0x0;this['inUse']=0x0;this[_0x91db('0x13')]=0x0;this['invalid']=0x0;this[_0x91db('0x1c')]=0x0;this[_0x91db('0x4')]=0x0;this[_0x91db('0x46')]=0x0;this[_0x91db('0x16')]=0x0;if(_0x3aaf2e){if(_0x3aaf2e[_0x91db('0x0')]){this[_0x91db('0x0')]=Number(_0x3aaf2e[_0x91db('0x0')]);}if(_0x3aaf2e[_0x91db('0x47')]){this[_0x91db('0x1')]=Number(_0x3aaf2e[_0x91db('0x47')]);}if(_0x3aaf2e[_0x91db('0x48')]){this['waiting']=Number(_0x3aaf2e['callers']);}}for(var _0x44ca29=0x0;_0x44ca29<_0x4733a4[_0x91db('0x49')];_0x44ca29++){var _0x2775f6=_0xed543c['SIP/'+_0x4733a4[_0x44ca29][_0x91db('0x10')]];if(_0x2775f6&&_0x2775f6[_0x91db('0x4a')]){this[_0x91db('0x2')]+=0x1;}if(_0x4733a4[_0x44ca29][_0x91db('0x4b')]==='1'){this[_0x91db('0x5')]+=0x1;}if(_0x4733a4[_0x44ca29]['paused']==='1'&&!['2','7','8'][_0x91db('0x4c')](_0x4733a4[_0x44ca29]['status'])){this[_0x91db('0x3')]+=0x1;}switch(_0x4733a4[_0x44ca29][_0x91db('0x4d')]){case'0':this[_0x91db('0x1d')]+=0x1;break;case'1':this[_0x91db('0x17')]+=0x1;break;case'2':this[_0x91db('0x14')]+=0x1;break;case'3':this[_0x91db('0x13')]+=0x1;break;case'4':this[_0x91db('0x15')]+=0x1;break;case'5':this[_0x91db('0x1c')]+=0x1;break;case'6':this[_0x91db('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x91db('0x22')]===_0x91db('0x4e')){var _0x13855b=Object[_0x91db('0x4f')](_0x592849);for(var _0x27e224=0x0;_0x27e224<_0x13855b['length'];_0x27e224++){var _0x272657=_0x13855b[_0x27e224];var _0x3c209e=_0x592849[_0x272657];if(_0x3c209e[_0x91db('0x50')]===this[_0x91db('0x10')]&&_0x3c209e[_0x91db('0x1b')]==='dialer'&&_0x3c209e[_0x91db('0x51')]===_0x91db('0x52')){this[_0x91db('0x5')]+=0x1;}}if(this[_0x91db('0x5')]>this[_0x91db('0x14')]){this[_0x91db('0x5')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x91db('0x45')]['compareToInboundQueue']=function(_0x2283c0){var _0x5d418c=![];if(_0x2283c0){_0x5d418c=INBOUND_COUNTERS['some'](function(_0x2c30ff){return this[_0x2c30ff]!==_0x2283c0[_0x2c30ff];},this);}return _0x5d418c;};VoiceQueueSummary[_0x91db('0x45')][_0x91db('0x53')]=function(_0x515bd5){var _0x2d0da5=![];var _0x462e71=![];var _0x171049=![];if(_0x515bd5){_0x2d0da5=this['dialMethod']!==_0x515bd5['dialMethod']||this[_0x91db('0x21')]!==_0x515bd5[_0x91db('0x21')]||this['message']!==_0x515bd5[_0x91db('0x41')]||this['statusMessage']!==_0x515bd5[_0x91db('0x42')];_0x462e71=OUTBOUND_COUNTERS[_0x91db('0x54')](function(_0x24fa52){return this[_0x24fa52]!==_0x515bd5[_0x24fa52];},this);if(this[_0x91db('0x43')]&&_0x515bd5['Trunk']){_0x171049=this[_0x91db('0x43')][_0x91db('0x10')]!==_0x515bd5[_0x91db('0x43')][_0x91db('0x10')]||this[_0x91db('0x43')][_0x91db('0x55')]!==_0x515bd5[_0x91db('0x43')][_0x91db('0x55')];}}return _0x2d0da5||_0x462e71||_0x171049;};VoiceQueueSummary[_0x91db('0x45')][_0x91db('0x56')]=function(_0x5b127d){this[_0x91db('0x6')]=_0x5b127d[_0x91db('0x6')];this[_0x91db('0x41')]=_0x5b127d[_0x91db('0x41')];this[_0x91db('0x42')]=_0x5b127d['statusMessage'];this[_0x91db('0x3a')]=_0x5b127d['originated'];this[_0x91db('0x57')]=_0x5b127d[_0x91db('0x57')];this['outboundAnswerCallsDay']=_0x5b127d['outboundAnswerCallsDay'];this[_0x91db('0x8')]=_0x5b127d[_0x91db('0x8')];this[_0x91db('0x9')]=_0x5b127d['outboundBusyCallsDay'];this[_0x91db('0xa')]=_0x5b127d[_0x91db('0xa')];this[_0x91db('0xb')]=_0x5b127d[_0x91db('0xb')];this[_0x91db('0x2c')]=_0x5b127d[_0x91db('0x2c')];this['outboundReCallsDay']=_0x5b127d[_0x91db('0xc')];this[_0x91db('0x2e')]=_0x5b127d[_0x91db('0x2e')];this[_0x91db('0xd')]=_0x5b127d[_0x91db('0xd')];this[_0x91db('0xf')]=_0x5b127d[_0x91db('0xf')];this[_0x91db('0x18')]=_0x5b127d[_0x91db('0x18')];this[_0x91db('0x1a')]=_0x5b127d[_0x91db('0x1a')];if(this['dialMethod']===_0x91db('0x58')){this[_0x91db('0xe')]=_0x5b127d['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xe767=['statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','pTalking','sumBillable','name','strategy','abandoned','answered','available','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message'];(function(_0x53ee38,_0x7ccc5c){var _0xa65ff7=function(_0x44707b){while(--_0x44707b){_0x53ee38['push'](_0x53ee38['shift']());}};_0xa65ff7(++_0x7ccc5c);}(_0xe767,0x11e));var _0x7e76=function(_0x1c3ade,_0x611c4c){_0x1c3ade=_0x1c3ade-0x0;var _0x1fbd3f=_0xe767[_0x1c3ade];return _0x1fbd3f;};'use strict';var INBOUND_COUNTERS=['available',_0x7e76('0x0'),_0x7e76('0x1'),_0x7e76('0x2'),_0x7e76('0x3'),_0x7e76('0x4'),_0x7e76('0x5')];var OUTBOUND_COUNTERS=['available','answered',_0x7e76('0x6'),'loggedIn',_0x7e76('0x1'),'originated',_0x7e76('0x7'),_0x7e76('0x8'),_0x7e76('0x9'),_0x7e76('0xa'),_0x7e76('0xb'),_0x7e76('0xc'),_0x7e76('0xd'),'outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused',_0x7e76('0xe'),_0x7e76('0x4'),_0x7e76('0xf'),'sumDuration','total',_0x7e76('0x5')];function VoiceQueueSummary(_0x5127bd){this['id']=_0x5127bd['id'];this[_0x7e76('0x10')]=_0x5127bd[_0x7e76('0x10')];this[_0x7e76('0x11')]=_0x5127bd['strategy'];this[_0x7e76('0x12')]=_0x5127bd[_0x7e76('0x12')]||0x0;this[_0x7e76('0x13')]=_0x5127bd[_0x7e76('0x13')]||0x0;this[_0x7e76('0x14')]=_0x5127bd[_0x7e76('0x14')]||0x0;this[_0x7e76('0x15')]=_0x5127bd[_0x7e76('0x15')]||0x0;this[_0x7e76('0x6')]=_0x5127bd[_0x7e76('0x6')]||0x0;this['invalid']=_0x5127bd[_0x7e76('0x16')]||0x0;this[_0x7e76('0x0')]=_0x5127bd[_0x7e76('0x0')]||0x0;this[_0x7e76('0x1')]=_0x5127bd['loggedInDb']||0x0;this[_0x7e76('0x17')]=_0x5127bd[_0x7e76('0x17')]||0x0;this[_0x7e76('0x18')]=_0x5127bd['notInUse']||0x0;this[_0x7e76('0x2')]=_0x5127bd[_0x7e76('0x2')]||0x0;this[_0x7e76('0x3')]=_0x5127bd['ringing']||0x0;this[_0x7e76('0x19')]=_0x5127bd[_0x7e76('0x19')];this['sumBillable']=_0x5127bd[_0x7e76('0xf')];this['sumDuration']=_0x5127bd[_0x7e76('0x1a')];this[_0x7e76('0x1b')]=_0x5127bd[_0x7e76('0x1b')]||0x0;this[_0x7e76('0x4')]=_0x5127bd[_0x7e76('0x4')]||0x0;this[_0x7e76('0x1c')]=_0x5127bd['total']||0x0;this[_0x7e76('0x1d')]=_0x5127bd['type'];this[_0x7e76('0x1e')]=_0x5127bd[_0x7e76('0x1e')]||0x0;this[_0x7e76('0x1f')]=_0x5127bd['unknown']||0x0;this[_0x7e76('0x20')]=_0x5127bd[_0x7e76('0x20')]||0x0;this['waiting']=_0x5127bd['waiting']||0x0;if(_0x5127bd['type']===_0x7e76('0x21')){this[_0x7e76('0xe')]=_0x5127bd[_0x7e76('0xe')]||0x0;this[_0x7e76('0x22')]=_0x5127bd[_0x7e76('0x22')];this['dialMethod']=_0x5127bd[_0x7e76('0x23')];this[_0x7e76('0x24')]=_0x5127bd[_0x7e76('0x24')];this[_0x7e76('0x25')]=_0x5127bd[_0x7e76('0x25')];this[_0x7e76('0x26')]=_0x5127bd[_0x7e76('0x26')];this['dialPrefix']=_0x5127bd[_0x7e76('0x27')];this['temp']=_0x5127bd[_0x7e76('0x28')];this['outboundAnswerAgiCallsDay']=_0x5127bd['outboundAnswerAgiCallsDay'];this[_0x7e76('0x8')]=_0x5127bd[_0x7e76('0x8')];this['outboundBlacklistCallsDay']=_0x5127bd[_0x7e76('0x9')];this['outboundBusyCallsDay']=_0x5127bd['outboundBusyCallsDay'];this[_0x7e76('0xb')]=_0x5127bd['outboundCongestionCallsDay'];this[_0x7e76('0x29')]=_0x5127bd[_0x7e76('0x29')];this[_0x7e76('0x2a')]=_0x5127bd[_0x7e76('0x2a')];this[_0x7e76('0x2b')]=_0x5127bd['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x5127bd[_0x7e76('0xc')];this['outboundNoSuchCallsDay']=_0x5127bd['outboundNoSuchCallsDay'];this[_0x7e76('0x2c')]=_0x5127bd[_0x7e76('0x2c')];this['outboundReCallsDay']=_0x5127bd[_0x7e76('0x2d')];this[_0x7e76('0x2e')]=_0x5127bd[_0x7e76('0x2e')];this[_0x7e76('0x2f')]=_0x5127bd[_0x7e76('0x2f')];this[_0x7e76('0x30')]=_0x5127bd['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x5127bd[_0x7e76('0x31')];this[_0x7e76('0x32')]=_0x5127bd[_0x7e76('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x5127bd[_0x7e76('0x33')];this[_0x7e76('0x34')]=_0x5127bd[_0x7e76('0x34')];this[_0x7e76('0x35')]=_0x5127bd[_0x7e76('0x35')];this[_0x7e76('0x36')]=_0x5127bd[_0x7e76('0x36')];this['predictiveIntervalHitRate']=_0x5127bd['predictiveIntervalHitRate'];this[_0x7e76('0x37')]=_0x5127bd[_0x7e76('0x37')];this[_0x7e76('0x38')]=_0x5127bd[_0x7e76('0x38')];this['predictiveIntervalAvailable']=_0x5127bd['predictiveIntervalAvailable'];this[_0x7e76('0x39')]=_0x5127bd[_0x7e76('0x39')];this[_0x7e76('0x3a')]=_0x5127bd['originated'];this[_0x7e76('0x3b')]=_0x5127bd[_0x7e76('0x3b')];this[_0x7e76('0x3c')]=_0x5127bd[_0x7e76('0x3c')];this['erlangAbandonmentRate']=_0x5127bd[_0x7e76('0x3d')];this['erlangBusyFactor']=_0x5127bd[_0x7e76('0x3e')];this[_0x7e76('0x3f')]=_0x5127bd[_0x7e76('0x3f')];this[_0x7e76('0x40')]=_0x5127bd[_0x7e76('0x40')];this['message']=_0x5127bd[_0x7e76('0x41')];this[_0x7e76('0x42')]=_0x5127bd[_0x7e76('0x42')];}if(_0x5127bd[_0x7e76('0x43')]){this[_0x7e76('0x43')]={'id':_0x5127bd[_0x7e76('0x43')]['id'],'name':_0x5127bd['Trunk']['name'],'active':_0x5127bd[_0x7e76('0x43')][_0x7e76('0x44')],'callerid':_0x5127bd[_0x7e76('0x43')][_0x7e76('0x45')]};}}VoiceQueueSummary[_0x7e76('0x46')][_0x7e76('0x47')]=function(_0x1cdc00,_0x281620,_0x3aa8ca,_0x2022f6){this[_0x7e76('0x1')]=0x0;this[_0x7e76('0x4')]=0x0;this['paused']=0x0;this[_0x7e76('0x1f')]=0x0;this[_0x7e76('0x18')]=0x0;this[_0x7e76('0x6')]=0x0;this[_0x7e76('0x15')]=0x0;this[_0x7e76('0x16')]=0x0;this['unavailable']=0x0;this[_0x7e76('0x3')]=0x0;this['ringInUse']=0x0;this[_0x7e76('0x17')]=0x0;if(_0x3aa8ca){if(_0x3aa8ca[_0x7e76('0x14')]){this[_0x7e76('0x14')]=Number(_0x3aa8ca[_0x7e76('0x14')]);}if(_0x3aa8ca[_0x7e76('0x48')]){this[_0x7e76('0x0')]=Number(_0x3aa8ca[_0x7e76('0x48')]);}if(_0x3aa8ca[_0x7e76('0x49')]){this[_0x7e76('0x5')]=Number(_0x3aa8ca[_0x7e76('0x49')]);}}for(var _0x3a04a4=0x0;_0x3a04a4<_0x1cdc00[_0x7e76('0x4a')];_0x3a04a4++){var _0x4e6641=_0x281620[_0x7e76('0x4b')+_0x1cdc00[_0x3a04a4][_0x7e76('0x10')]];if(_0x4e6641&&_0x4e6641[_0x7e76('0x4c')]){this[_0x7e76('0x1')]+=0x1;}if(_0x1cdc00[_0x3a04a4][_0x7e76('0x4d')]==='1'){this['talking']+=0x1;}if(_0x1cdc00[_0x3a04a4][_0x7e76('0x2')]==='1'&&!['2','7','8']['includes'](_0x1cdc00[_0x3a04a4]['status'])){this[_0x7e76('0x2')]+=0x1;}switch(_0x1cdc00[_0x3a04a4][_0x7e76('0x4e')]){case'0':this[_0x7e76('0x1f')]+=0x1;break;case'1':this[_0x7e76('0x18')]+=0x1;break;case'2':this[_0x7e76('0x6')]+=0x1;break;case'3':this[_0x7e76('0x15')]+=0x1;break;case'4':this[_0x7e76('0x16')]+=0x1;break;case'5':this[_0x7e76('0x1e')]+=0x1;break;case'6':this[_0x7e76('0x3')]+=0x1;break;case'7':this[_0x7e76('0x19')]+=0x1;break;case'8':this[_0x7e76('0x17')]+=0x1;break;}}if(this[_0x7e76('0x23')]===_0x7e76('0x4f')){var _0x36df82=Object[_0x7e76('0x50')](_0x2022f6);for(var _0x840be7=0x0;_0x840be7<_0x36df82[_0x7e76('0x4a')];_0x840be7++){var _0x2a99dc=_0x36df82[_0x840be7];var _0x518d45=_0x2022f6[_0x2a99dc];if(_0x518d45[_0x7e76('0x51')]===this[_0x7e76('0x10')]&&_0x518d45['type']===_0x7e76('0x52')&&_0x518d45[_0x7e76('0x53')]===_0x7e76('0x54')){this[_0x7e76('0x4')]+=0x1;}}if(this[_0x7e76('0x4')]>this[_0x7e76('0x6')]){this[_0x7e76('0x4')]=this[_0x7e76('0x6')];}this[_0x7e76('0xe')]=0x0;}return this;};VoiceQueueSummary[_0x7e76('0x46')][_0x7e76('0x55')]=function(_0x316840){var _0x33d6d3=![];if(_0x316840){_0x33d6d3=INBOUND_COUNTERS[_0x7e76('0x56')](function(_0x4a1265){return this[_0x4a1265]!==_0x316840[_0x4a1265];},this);}return _0x33d6d3;};VoiceQueueSummary[_0x7e76('0x46')]['compareToOutboundQueue']=function(_0x51daa0){var _0x4b16bb=![];var _0x53012a=![];var _0x125e7e=![];if(_0x51daa0){_0x4b16bb=this[_0x7e76('0x23')]!==_0x51daa0['dialMethod']||this[_0x7e76('0x22')]!==_0x51daa0[_0x7e76('0x22')]||this[_0x7e76('0x41')]!==_0x51daa0['message']||this[_0x7e76('0x42')]!==_0x51daa0[_0x7e76('0x42')];_0x53012a=OUTBOUND_COUNTERS[_0x7e76('0x56')](function(_0xa8b4e0){return this[_0xa8b4e0]!==_0x51daa0[_0xa8b4e0];},this);if(this[_0x7e76('0x43')]&&_0x51daa0[_0x7e76('0x43')]){_0x125e7e=this[_0x7e76('0x43')][_0x7e76('0x10')]!==_0x51daa0[_0x7e76('0x43')][_0x7e76('0x10')]||this[_0x7e76('0x43')][_0x7e76('0x44')]!==_0x51daa0[_0x7e76('0x43')][_0x7e76('0x44')];}}return _0x4b16bb||_0x53012a||_0x125e7e;};VoiceQueueSummary[_0x7e76('0x46')]['updateReportFromOutboundQueue']=function(_0x1b4247){this['answered']=_0x1b4247[_0x7e76('0x13')];this['message']=_0x1b4247[_0x7e76('0x41')];this[_0x7e76('0x42')]=_0x1b4247['statusMessage'];this[_0x7e76('0x3a')]=_0x1b4247[_0x7e76('0x3a')];this[_0x7e76('0x7')]=_0x1b4247['outboundAbandonedCallsDay'];this[_0x7e76('0x8')]=_0x1b4247[_0x7e76('0x8')];this[_0x7e76('0x9')]=_0x1b4247[_0x7e76('0x9')];this['outboundBusyCallsDay']=_0x1b4247[_0x7e76('0xa')];this[_0x7e76('0xb')]=_0x1b4247[_0x7e76('0xb')];this['outboundNoAnswerCallsDay']=_0x1b4247['outboundNoAnswerCallsDay'];this[_0x7e76('0xd')]=_0x1b4247['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1b4247[_0x7e76('0x2d')];this[_0x7e76('0x2e')]=_0x1b4247[_0x7e76('0x2e')];this[_0x7e76('0x2f')]=_0x1b4247[_0x7e76('0x2f')];this['sumBillable']=_0x1b4247[_0x7e76('0xf')];this['sumDuration']=_0x1b4247[_0x7e76('0x1a')];this[_0x7e76('0x1c')]=_0x1b4247['total'];if(this[_0x7e76('0x23')]==='preview'){this['pTalking']=_0x1b4247[_0x7e76('0xe')];}};module[_0x7e76('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 94138fb..2e45669 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 _0xaba6=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x26a10d,_0xe5c001){var _0xf90201=function(_0x48535b){while(--_0x48535b){_0x26a10d['push'](_0x26a10d['shift']());}};_0xf90201(++_0xe5c001);}(_0xaba6,0xb5));var _0x6aba=function(_0x11486a,_0x1860f5){_0x11486a=_0x11486a-0x0;var _0x565ddc=_0xaba6[_0x11486a];return _0x565ddc;};'use strict';function VtigerAccount(_0x268dc0){this['id']=_0x268dc0['id']||0x0;this[_0x6aba('0x0')]=_0x268dc0['name']||'';this[_0x6aba('0x1')]=_0x268dc0[_0x6aba('0x1')]||'';this[_0x6aba('0x2')]=_0x268dc0[_0x6aba('0x2')]||'';this['remoteUri']=_0x268dc0[_0x6aba('0x3')]||'';this[_0x6aba('0x4')]=_0x268dc0[_0x6aba('0x4')]||'';this[_0x6aba('0x5')]=_0x268dc0[_0x6aba('0x5')]||{};}module[_0x6aba('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6230=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0xd07917,_0x55c315){var _0x1bd13c=function(_0x198559){while(--_0x198559){_0xd07917['push'](_0xd07917['shift']());}};_0x1bd13c(++_0x55c315);}(_0x6230,0xcf));var _0x0623=function(_0x3bfbf5,_0x1cd670){_0x3bfbf5=_0x3bfbf5-0x0;var _0x3aaac9=_0x6230[_0x3bfbf5];return _0x3aaac9;};'use strict';function VtigerAccount(_0xf11eff){this['id']=_0xf11eff['id']||0x0;this[_0x0623('0x0')]=_0xf11eff[_0x0623('0x0')]||'';this[_0x0623('0x1')]=_0xf11eff[_0x0623('0x1')]||'';this[_0x0623('0x2')]=_0xf11eff[_0x0623('0x2')]||'';this[_0x0623('0x3')]=_0xf11eff[_0x0623('0x3')]||'';this[_0x0623('0x4')]=_0xf11eff[_0x0623('0x4')]||'';this[_0x0623('0x5')]=_0xf11eff[_0x0623('0x5')]||{};}module[_0x0623('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e2c6ed3..c2a91fe 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 _0x8b38=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x40108a,_0x7f7a5b){var _0x11ecc0=function(_0x3864f1){while(--_0x3864f1){_0x40108a['push'](_0x40108a['shift']());}};_0x11ecc0(++_0x7f7a5b);}(_0x8b38,0x1bf));var _0x88b3=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x8b38[_0x4347ec];return _0x4c8314;};'use strict';function ZendeskAccount(_0x3dea64){this['id']=_0x3dea64['id']||0x0;this[_0x88b3('0x0')]=_0x3dea64[_0x88b3('0x0')]||'';this[_0x88b3('0x1')]=_0x3dea64[_0x88b3('0x1')]||'';this['password']=_0x3dea64['password']||'';this['token']=_0x3dea64['token']||'';this[_0x88b3('0x2')]=_0x3dea64['remoteUri']||'';this[_0x88b3('0x3')]=_0x3dea64['authType']||'';this['type']=_0x3dea64[_0x88b3('0x4')]||_0x88b3('0x5');this[_0x88b3('0x6')]=_0x3dea64[_0x88b3('0x6')]||'';this[_0x88b3('0x7')]=_0x3dea64[_0x88b3('0x7')]||{};}module[_0x88b3('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x53c8=['remoteUri','authType','integrationTab','serverUrl','Configurations','name','username','password','token'];(function(_0x449676,_0x4cd85f){var _0x16f528=function(_0x4dd9c3){while(--_0x4dd9c3){_0x449676['push'](_0x449676['shift']());}};_0x16f528(++_0x4cd85f);}(_0x53c8,0x1e2));var _0x853c=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x53c8[_0x235f49];return _0x551139;};'use strict';function ZendeskAccount(_0x3400ae){this['id']=_0x3400ae['id']||0x0;this[_0x853c('0x0')]=_0x3400ae[_0x853c('0x0')]||'';this[_0x853c('0x1')]=_0x3400ae['username']||'';this[_0x853c('0x2')]=_0x3400ae[_0x853c('0x2')]||'';this[_0x853c('0x3')]=_0x3400ae[_0x853c('0x3')]||'';this[_0x853c('0x4')]=_0x3400ae[_0x853c('0x4')]||'';this[_0x853c('0x5')]=_0x3400ae[_0x853c('0x5')]||'';this['type']=_0x3400ae['type']||_0x853c('0x6');this[_0x853c('0x7')]=_0x3400ae[_0x853c('0x7')]||'';this[_0x853c('0x8')]=_0x3400ae['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f27fb37..39ad2c3 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 _0xa751=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations'];(function(_0x1f9444,_0x2cf9ef){var _0xb7c2da=function(_0x47850d){while(--_0x47850d){_0x1f9444['push'](_0x1f9444['shift']());}};_0xb7c2da(++_0x2cf9ef);}(_0xa751,0xfb));var _0x1a75=function(_0x53cff9,_0x40bd7e){_0x53cff9=_0x53cff9-0x0;var _0x1037a9=_0xa751[_0x53cff9];return _0x1037a9;};'use strict';function ZohoAccount(_0x4a4a71){this['id']=_0x4a4a71['id']||0x0;this[_0x1a75('0x0')]=_0x4a4a71[_0x1a75('0x0')]||'';this[_0x1a75('0x1')]=_0x4a4a71['description']||'';this[_0x1a75('0x2')]=_0x4a4a71['host']||'';this[_0x1a75('0x3')]=_0x4a4a71[_0x1a75('0x3')]||'';this[_0x1a75('0x4')]=_0x4a4a71['clientId']||'';this[_0x1a75('0x5')]=_0x4a4a71[_0x1a75('0x5')]||'';this[_0x1a75('0x6')]=_0x4a4a71[_0x1a75('0x6')]||'';this[_0x1a75('0x7')]=_0x4a4a71[_0x1a75('0x7')]||'';this['refreshToken']=_0x4a4a71['refreshToken']||'';this[_0x1a75('0x8')]=_0x4a4a71['Configurations']||{};}module[_0x1a75('0x9')]=ZohoAccount; \ No newline at end of file +var _0xe263=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2f989f,_0x1f35f4){var _0x1f3617=function(_0x4b3570){while(--_0x4b3570){_0x2f989f['push'](_0x2f989f['shift']());}};_0x1f3617(++_0x1f35f4);}(_0xe263,0x193));var _0x3e26=function(_0x8f4a1f,_0x243855){_0x8f4a1f=_0x8f4a1f-0x0;var _0x4e6a4d=_0xe263[_0x8f4a1f];return _0x4e6a4d;};'use strict';function ZohoAccount(_0x357899){this['id']=_0x357899['id']||0x0;this[_0x3e26('0x0')]=_0x357899[_0x3e26('0x0')]||'';this[_0x3e26('0x1')]=_0x357899[_0x3e26('0x1')]||'';this[_0x3e26('0x2')]=_0x357899[_0x3e26('0x2')]||'';this[_0x3e26('0x3')]=_0x357899[_0x3e26('0x3')]||'';this[_0x3e26('0x4')]=_0x357899[_0x3e26('0x4')]||'';this[_0x3e26('0x5')]=_0x357899['clientSecret']||'';this[_0x3e26('0x6')]=_0x357899[_0x3e26('0x6')]||'';this[_0x3e26('0x7')]=_0x357899[_0x3e26('0x7')]||'';this[_0x3e26('0x8')]=_0x357899[_0x3e26('0x8')]||'';this['Configurations']=_0x357899[_0x3e26('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1d9ccca..1ceb46b 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 _0x4bd3=['name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','queue'];(function(_0x5d26de,_0x323e21){var _0xb204a7=function(_0x3b5349){while(--_0x3b5349){_0x5d26de['push'](_0x5d26de['shift']());}};_0xb204a7(++_0x323e21);}(_0x4bd3,0x174));var _0x34bd=function(_0x54833a,_0x2c5c3f){_0x54833a=_0x54833a-0x0;var _0x4a47bd=_0x4bd3[_0x54833a];return _0x4a47bd;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var moment=require(_0x34bd('0x1'));function checkNameSurname(_0x22a9f9,_0x5369c1,_0x4997bc){var _0x4cad21='';if(!_[_0x34bd('0x2')](_0x5369c1)&&_0x34bd('0x3')===typeof _0x5369c1){_0x4cad21+=_0x5369c1;}if(!_[_0x34bd('0x2')](_0x4997bc)&&'string'===typeof _0x4997bc){_0x4cad21+='\x20'+_0x4997bc;}if(_0x4cad21!==''){return _0x4cad21;}return _0x22a9f9;}function Action(_0x2133c5,_0x2a15a2,_0x5c2a7a,_0x3e8744,_0x213716){this['uniqueid']=_0x5c2a7a||undefined;this[_0x34bd('0x4')]=_0x2133c5['id'];this[_0x34bd('0x5')]=_0x2a15a2[_0x34bd('0x6')];this[_0x34bd('0x7')]=_0x2a15a2[_0x34bd('0x7')];this[_0x34bd('0x8')]='queue';this[_0x34bd('0x9')]=![];this[_0x34bd('0xa')]=_[_0x34bd('0x2')](_0x2133c5[_0x34bd('0xb')])?undefined:_0x2133c5['Agent']['name'];this[_0x34bd('0xc')]=this['membername']?util['format'](_0x34bd('0xd'),this[_0x34bd('0xa')]):_0x3e8744||undefined;this[_0x34bd('0xe')]=checkNameSurname(_0x2133c5[_0x34bd('0xf')][_0x34bd('0x10')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x11')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x12')]);this['active']=_0x2133c5[_0x34bd('0x13')]||![];this['calleridnum']=_0x2133c5['phone'];this[_0x34bd('0x14')]=_0x2133c5[_0x34bd('0x14')];this[_0x34bd('0x15')]=_0x2133c5[_0x34bd('0x15')]||0x0;this[_0x34bd('0x16')]=_0x2133c5[_0x34bd('0x16')]||0x0;this[_0x34bd('0x17')]=_0x2133c5[_0x34bd('0x17')]||0x0;this[_0x34bd('0x18')]=(_0x2133c5[_0x34bd('0x15')]||0x0)+(_0x2133c5[_0x34bd('0x16')]||0x0)+(_0x2133c5['countnoanswerretry']||0x0)+(_0x2133c5[_0x34bd('0x19')]||0x0)+(_0x2133c5[_0x34bd('0x1a')]||0x0)+(_0x2133c5[_0x34bd('0x1b')]||0x0)+(_0x2133c5[_0x34bd('0x1c')]||0x0)+(_0x2133c5[_0x34bd('0x1d')]||0x0);this[_0x34bd('0x19')]=_0x2133c5[_0x34bd('0x19')]||0x0;this[_0x34bd('0x1a')]=_0x2133c5[_0x34bd('0x1a')]||0x0;this['countabandonedretry']=_0x2133c5[_0x34bd('0x1b')]||0x0;this[_0x34bd('0x1c')]=_0x2133c5[_0x34bd('0x1c')]||0x0;this[_0x34bd('0x1d')]=_0x2133c5[_0x34bd('0x1d')]||0x0;this['callback']=_0x2133c5['callback'];this['callbackuniqueid']=_0x2133c5['callbackuniqueid'];this[_0x34bd('0x1e')]=_0x2133c5['callbackat'];this[_0x34bd('0x1f')]=_0x2133c5[_0x34bd('0x1f')];this[_0x34bd('0x20')]=_0x2133c5['ContactId'];this[_0x34bd('0x21')]=_0x2133c5[_0x34bd('0x21')];this[_0x34bd('0x22')]=_[_0x34bd('0x2')](_0x2133c5['Agent'])?_0x2133c5[_0x34bd('0x22')]:_0x2133c5[_0x34bd('0xb')]['id'];this[_0x34bd('0x23')]=_0x2133c5[_0x34bd('0x23')];this['originatecalleridnum']='';this[_0x34bd('0x24')]='';}Action[_0x34bd('0x25')]['getCaller']=function(){return util[_0x34bd('0x26')](_0x34bd('0x27'),this[_0x34bd('0xe')],this[_0x34bd('0x28')]);};module[_0x34bd('0x29')]=Action; \ No newline at end of file +var _0x36ee=['callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','exports','moment','isNil','string','idContact','name','type','queue','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe36e('0x0'));function checkNameSurname(_0x521ff3,_0xf6b517,_0x4018bf){var _0x36c9f6='';if(!_[_0xe36e('0x1')](_0xf6b517)&&_0xe36e('0x2')===typeof _0xf6b517){_0x36c9f6+=_0xf6b517;}if(!_[_0xe36e('0x1')](_0x4018bf)&&_0xe36e('0x2')===typeof _0x4018bf){_0x36c9f6+='\x20'+_0x4018bf;}if(_0x36c9f6!==''){return _0x36c9f6;}return _0x521ff3;}function Action(_0x3f29e1,_0x25a07d,_0x190404,_0x21be0b,_0x1aa596){this['uniqueid']=_0x190404||undefined;this[_0xe36e('0x3')]=_0x3f29e1['id'];this['queue']=_0x25a07d[_0xe36e('0x4')];this[_0xe36e('0x5')]=_0x25a07d[_0xe36e('0x5')];this['campaigntype']=_0xe36e('0x6');this['dialAnswer']=![];this[_0xe36e('0x7')]=_[_0xe36e('0x1')](_0x3f29e1[_0xe36e('0x8')])?undefined:_0x3f29e1[_0xe36e('0x8')][_0xe36e('0x4')];this[_0xe36e('0x9')]=this[_0xe36e('0x7')]?util[_0xe36e('0xa')]('SIP/%s',this[_0xe36e('0x7')]):_0x21be0b||undefined;this[_0xe36e('0xb')]=checkNameSurname(_0x3f29e1[_0xe36e('0xc')][_0xe36e('0xd')],_0x3f29e1['Contact'][_0xe36e('0xe')],_0x3f29e1['Contact']['lastName']);this[_0xe36e('0xf')]=_0x3f29e1[_0xe36e('0xf')]||![];this[_0xe36e('0x10')]=_0x3f29e1[_0xe36e('0xd')];this[_0xe36e('0x11')]=_0x3f29e1[_0xe36e('0x11')];this[_0xe36e('0x12')]=_0x3f29e1[_0xe36e('0x12')]||0x0;this[_0xe36e('0x13')]=_0x3f29e1[_0xe36e('0x13')]||0x0;this['countnoanswerretry']=_0x3f29e1[_0xe36e('0x14')]||0x0;this[_0xe36e('0x15')]=(_0x3f29e1['countbusyretry']||0x0)+(_0x3f29e1[_0xe36e('0x13')]||0x0)+(_0x3f29e1['countnoanswerretry']||0x0)+(_0x3f29e1[_0xe36e('0x16')]||0x0)+(_0x3f29e1[_0xe36e('0x17')]||0x0)+(_0x3f29e1['countabandonedretry']||0x0)+(_0x3f29e1[_0xe36e('0x18')]||0x0)+(_0x3f29e1[_0xe36e('0x19')]||0x0);this[_0xe36e('0x16')]=_0x3f29e1['countnosuchnumberretry']||0x0;this[_0xe36e('0x17')]=_0x3f29e1[_0xe36e('0x17')]||0x0;this[_0xe36e('0x1a')]=_0x3f29e1[_0xe36e('0x1a')]||0x0;this[_0xe36e('0x18')]=_0x3f29e1[_0xe36e('0x18')]||0x0;this['countagentrejectretry']=_0x3f29e1[_0xe36e('0x19')]||0x0;this[_0xe36e('0x1b')]=_0x3f29e1[_0xe36e('0x1b')];this[_0xe36e('0x1c')]=_0x3f29e1[_0xe36e('0x1c')];this['callbackat']=_0x3f29e1['callbackat'];this[_0xe36e('0x1d')]=_0x3f29e1[_0xe36e('0x1d')];this[_0xe36e('0x1e')]=_0x3f29e1[_0xe36e('0x1e')];this[_0xe36e('0x1f')]=_0x3f29e1[_0xe36e('0x1f')];this[_0xe36e('0x20')]=_['isNil'](_0x3f29e1[_0xe36e('0x8')])?_0x3f29e1[_0xe36e('0x20')]:_0x3f29e1[_0xe36e('0x8')]['id'];this[_0xe36e('0x21')]=_0x3f29e1['VoiceQueueId'];this[_0xe36e('0x22')]='';this['originatecalleridname']='';}Action[_0xe36e('0x23')]['getCaller']=function(){return util[_0xe36e('0xa')]('\x22%s\x22\x20<%s>',this[_0xe36e('0xb')],this['number']);};module[_0xe36e('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 147c779..947ccba 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 _0x0023=['isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','syncVarSet','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','./rpcDb','./action','../dialer/utils','redis','localhost','socket.io-emitter','prototype','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','syncCampaigns','dialMethod','preview','booked','outbound','hasOwnProperty','type','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','sequence','enqueue','isNil','info','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','format','uniqueid','custom:agentconnect','connect','acw','complete','answered','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','queueSummaryCountersUpdated','object','isUndefined','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','originated:\x20','[verifyAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','run','unlockContact','execRun','getContactPreview','recallme'];(function(_0x174e99,_0x503ab4){var _0x1733ab=function(_0x16cb0e){while(--_0x16cb0e){_0x174e99['push'](_0x174e99['shift']());}};_0x1733ab(++_0x503ab4);}(_0x0023,0x180));var _0x3002=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x0023[_0x4f217f];return _0x3b583a;};'use strict';var util=require(_0x3002('0x0'));var _=require(_0x3002('0x1'));var uuid=require(_0x3002('0x2'));var moment=require('moment');var Redis=require(_0x3002('0x3'));var config=require('../../../config/environment');var logger=require(_0x3002('0x4'))('preview');var loggerAction=require(_0x3002('0x4'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x3002('0x5'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x3002('0x6'));var ut=require('./util/util');var utils=require(_0x3002('0x7'));config[_0x3002('0x8')]=_['defaults'](config[_0x3002('0x8')],{'host':_0x3002('0x9'),'port':0x18eb});var io=require(_0x3002('0xa'))(new Redis(config[_0x3002('0x8')]));var Sequence=function(){};Sequence[_0x3002('0xb')]['enqueue']=function(_0x146bd1){this[_0x3002('0xc')]=this[_0x3002('0xc')]?this[_0x3002('0xc')][_0x3002('0xd')](_0x146bd1):_0x146bd1();};function Preview(_0x1f4fa7){this['sequence']=new Sequence();this[_0x3002('0xe')]=_0x1f4fa7[_0x3002('0xf')];this[_0x3002('0x10')]=_0x1f4fa7[_0x3002('0x10')];this[_0x3002('0x11')]={};this[_0x3002('0x12')]=_0x1f4fa7[_0x3002('0x12')];this[_0x3002('0x13')]=0x0;ami['on'](_0x3002('0x14'),this[_0x3002('0x15')][_0x3002('0x16')](this));ami['on']('hangup',this[_0x3002('0x17')][_0x3002('0x16')](this));ami['on'](_0x3002('0x18'),this[_0x3002('0x19')][_0x3002('0x16')](this));ami['on'](_0x3002('0x1a'),this['syncDialEnd'][_0x3002('0x16')](this));ami['on'](_0x3002('0x1b'),this['syncNewExten'][_0x3002('0x16')](this));ami['on']('varset',this['syncVarSet'][_0x3002('0x16')](this));ami['on'](_0x3002('0x1c'),this['syncAttendedTransfer'][_0x3002('0x16')](this));ami['on']('blindtransfer',this[_0x3002('0x1d')][_0x3002('0x16')](this));this[_0x3002('0x1e')](this['campaignsPreview']);}function emit(_0x1ad9f8,_0x2fb893,_0xee0f4d){io['to'](_0x1ad9f8)[_0x3002('0x1f')](_0x2fb893,_0xee0f4d);}function emitVoiceQueueChannelRemove(_0x34ba99){logger['info'](_0x3002('0x20'),JSON[_0x3002('0x21')](_0x34ba99));emit(util['format'](_0x3002('0x22'),_0x34ba99[_0x3002('0x23')]),_0x3002('0x24'),_0x34ba99);io[_0x3002('0x1f')](_0x3002('0x25'),_0x34ba99);}function notSendMessagesQueue(_0x3c13cf){if(_0x3c13cf[_0x3002('0x26')]){if(_0x3c13cf[_0x3002('0x27')]===0x0&&_0x3c13cf[_0x3002('0x28')]===0x0){_0x3c13cf[_0x3002('0x26')]=![];_0x3c13cf['available']=0x0;_0x3c13cf[_0x3002('0x29')]=0x0;_0x3c13cf[_0x3002('0x2a')]=utils[_0x3002('0x2b')][_0x3002('0x2c')];ut['logger'](_0x3002('0x2d'),_0x3c13cf[_0x3002('0x23')]+_0x3002('0x2e'));}else{_0x3c13cf['message']=utils[_0x3002('0x2b')][_0x3002('0x2f')];ut[_0x3002('0x30')](_0x3002('0x2d'),_0x3c13cf[_0x3002('0x23')]+'\x20is\x20deactivated');}}}Preview[_0x3002('0xb')]['loopCampaigns']=function(){var _0x286612=this;setInterval(function(){_0x286612[_0x3002('0x31')]();},0x7cf);};Preview[_0x3002('0xb')][_0x3002('0x31')]=function(){var _0x1da893=this[_0x3002('0xe')];this['clockClearZombieChannels']+=0x1;for(var _0x117212 in _0x1da893){if(_0x1da893['hasOwnProperty'](_0x117212)&&(_0x1da893[_0x117212][_0x3002('0x32')]===_0x3002('0x33')||_0x1da893[_0x117212][_0x3002('0x32')]===_0x3002('0x34'))&&_0x1da893[_0x117212]['type']===_0x3002('0x35')){if(this[_0x3002('0x13')]>0x7){this[_0x3002('0x13')]=0x0;this['clearZombieChannels']();}}if(_0x1da893[_0x3002('0x36')](_0x117212)&&_0x1da893[_0x117212]['dialMethod']==='preview'&&_0x1da893[_0x117212][_0x3002('0x37')]===_0x3002('0x35')){if(_0x1da893[_0x117212][_0x3002('0x38')]){this[_0x3002('0x39')](_0x1da893[_0x117212]);if(_0x1da893[_0x117212][_0x3002('0x3a')])this['recallMe'](_0x1da893[_0x117212]);}else{notSendMessagesQueue(_0x1da893[_0x117212]);}}}};Preview[_0x3002('0xb')][_0x3002('0x3b')]=function(_0x255ca9){var _0x94695f=this;this[_0x3002('0x3c')][_0x3002('0x3d')](function(){if(!_[_0x3002('0x3e')](_0x94695f[_0x3002('0x11')][_0x255ca9])){loggerAction[_0x3002('0x3f')]('[clearZombieChannels][talking]',_0x255ca9,_0x3002('0x40'),_0x94695f[_0x3002('0x11')][_0x255ca9]['queue'],'originated:\x20',JSON[_0x3002('0x21')](_0x94695f[_0x3002('0xe')][_0x94695f[_0x3002('0x11')][_0x255ca9][_0x3002('0x41')]][_0x3002('0x27')]),_0x3002('0x42'),JSON[_0x3002('0x21')](_0x94695f[_0x3002('0xe')][_0x94695f[_0x3002('0x11')][_0x255ca9][_0x3002('0x41')]][_0x3002('0x28')]),JSON[_0x3002('0x21')](_0x94695f[_0x3002('0x11')][_0x255ca9][_0x3002('0x43')]),JSON[_0x3002('0x21')](_[_0x3002('0x44')](_0x94695f[_0x3002('0x11')][_0x255ca9],[_0x3002('0x45'),'UserId',_0x3002('0x46'),_0x3002('0x47')])));return ami[_0x3002('0x48')]({'action':_0x3002('0x49'),'channel':_0x94695f[_0x3002('0x11')][_0x255ca9]['channel']})['catch'](function(_0x299be0){if(_0x299be0[_0x3002('0x2a')]===_0x3002('0x4a')){setTimeout(function(){if(_0x94695f['actions'][_0x255ca9]){utils['decrementOriginate'](_0x94695f[_0x3002('0xe')][_0x94695f['actions'][_0x255ca9][_0x3002('0x41')]],'[clearZombieChannel]');if(_0x94695f[_0x3002('0x11')][_0x255ca9][_0x3002('0x43')]===!![]){ut[_0x3002('0x4b')](_0x94695f['campaignsPreview'][_0x94695f[_0x3002('0x11')][_0x255ca9]['queue']],'[clearZombieChannel]');ut[_0x3002('0x4c')](_0x3002('0x4d')+_0x255ca9,_0x94695f[_0x3002('0x11')][_0x255ca9][_0x3002('0x41')]);}ut[_0x3002('0x4c')](_0x3002('0x4e')+_0x255ca9,_0x94695f['actions'][_0x255ca9]['queue']);delete _0x94695f[_0x3002('0x11')][_0x255ca9];}},0x2328);}});}});};Preview[_0x3002('0xb')][_0x3002('0x4f')]=function(){var _0x31f825=this;loggerAction[_0x3002('0x3f')]('[action]',_['size'](this['actions']));for(var _0x27c36d in this['actions']){if(_0x31f825[_0x3002('0x11')][_0x3002('0x36')](_0x27c36d)){_0x31f825[_0x3002('0x3b')](_0x27c36d);}}};Preview[_0x3002('0xb')][_0x3002('0x50')]=function(_0x1cf97f){var _0x584c60=this;rpcDb[_0x3002('0x51')](_0x1cf97f['id'],ut[_0x3002('0x52')](this[_0x3002('0x12')]))[_0x3002('0x53')](function(_0x3ec017){if(!_[_0x3002('0x3e')](_0x3ec017)){for(var _0x5c1806=0x0;_0x5c1806<_0x3ec017[_0x3002('0x54')];_0x5c1806+=0x1){if(ut[_0x3002('0x55')](_0x3ec017[_0x5c1806][_0x3002('0x56')])<_0x1cf97f[_0x3002('0x57')]*0x3c){if(_0x3ec017[_0x5c1806][_0x3002('0x58')]&&!_0x3ec017[_0x5c1806][_0x3002('0x58')][_0x3002('0x59')]){_0x584c60['run'](_0x3ec017[_0x5c1806]['id'])['then'](ut[_0x3002('0x5a')](_0x3002('0x5b')))[_0x3002('0x5c')](ut[_0x3002('0x5a')](_0x3002('0x5b')));}else{rpcDb[_0x3002('0x5d')](_0x3ec017[_0x5c1806]['id']);}}else{var _0x4da134=new Action(_0x3ec017[_0x5c1806],_0x1cf97f);_0x4da134[_0x3002('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1cf97f['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4da134,0x17,_0x3002('0x5f'));if(_0x1cf97f[_0x3002('0x60')]){rpcDb[_0x3002('0x61')](ut[_0x3002('0x62')](_0x3ec017[_0x5c1806]));rpcDb['createCustomerHistory'](_0x4da134,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3002('0x63')](_0x4da134,0x16,_0x3002('0x64'));rpcDb[_0x3002('0x65')](_0x4da134,_0x3002('0x66'));rpcDb[_0x3002('0x67')](_0x4da134,_0x3002('0x66'));}}}}})[_0x3002('0x5c')](ut[_0x3002('0x5a')]('[getContactRecallMe]'));};Preview[_0x3002('0xb')]['setMessage']=function(_0x1487b7){_0x1487b7[_0x3002('0x26')]=!![];if(ut[_0x3002('0x68')](_0x1487b7[_0x3002('0x69')])){_0x1487b7['message']=utils[_0x3002('0x2b')][_0x3002('0x6a')];}else if(!ut[_0x3002('0x6b')](_0x1487b7[_0x3002('0x38')])){_0x1487b7[_0x3002('0x2a')]=utils['CAMPAIGN_STATUS'][_0x3002('0x2c')];}else if(!this['isTrunkReachable'](_0x1487b7[_0x3002('0x6c')])){if(!this[_0x3002('0x6d')](_0x1487b7[_0x3002('0x6e')])){_0x1487b7[_0x3002('0x2a')]=utils[_0x3002('0x2b')][_0x3002('0x6f')];}else{_0x1487b7[_0x3002('0x2a')]=utils[_0x3002('0x2b')][_0x3002('0x70')];}}else{_0x1487b7[_0x3002('0x2a')]=utils['CAMPAIGN_STATUS'][_0x3002('0x70')];}};Preview[_0x3002('0xb')][_0x3002('0x71')]=function(_0x2f31ef,_0x132ccd,_0x47189d){var _0x381c3d=this;var _0x3274b1=this[_0x3002('0x11')][_0x132ccd];var _0x2f8205=this[_0x3002('0xe')][_0x3274b1[_0x3002('0x41')]];var _0x49011d;var _0x539023=![];var _0x2bd830=0x2;var _0x3fff73=0x3;if(_0x2f8205){switch(_0x47189d){case'1':_0x2f8205[_0x3002('0x72')]+=0x1;_0x3274b1[_0x3002('0x73')]+=0x1;_0x3274b1['countglobal']=ut['totalGlobal'](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x0,_0x3002('0x74'));ami['emit'](_0x3002('0x75'),ut[_0x3002('0x76')](_0x3274b1,_0x3002('0x77')));rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0x78'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'0',_0x2f8205)[_0x3002('0x53')](function(_0x8ed07b){_0x539023=_0x8ed07b[_0x3002('0x7a')]==0x1;_0x2bd830=_0x2f8205[_0x3002('0x7b')];_0x3fff73=_0x2f8205['callAdditionalPhoneAfterMin'];if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut['cloneAction'](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0x7f'));}else{if(_0x3274b1[_0x3002('0x73')]>=_0x2f8205['dialNoSuchNumberMaxRetry']){rpcDb[_0x3002('0x67')](_0x3274b1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3002('0x80')](ut[_0x3002('0x81')](_0x3274b1,_0x3002('0x73'),_0x2f8205['dialNoSuchNumberRetryFrequency']),_0x3274b1[_0x3002('0x82')],_0x3274b1['activeContact']);}}delete this[_0x3002('0x11')][_0x2f31ef['linkedid']];}else{_0x3274b1[_0x3002('0x73')]++;logger[_0x3002('0x3f')]('actioncountonusuch',_0x3274b1['countnosuchnumberretry']);logger['info']('id',_0x3274b1[_0x3002('0x83')]);_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1['idContact'],'field':{'countnosuchnumberretry':_0x3274b1['countnosuchnumberretry']}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case _0x3002('0x86'):var _0x4c8a91=moment()[_0x3002('0x87')]('YYYY-MM-DD\x20HH:mm:ss');_0x3274b1['responsetime']=_0x4c8a91;_0x3274b1['answertime']=_0x4c8a91;_0x3274b1[_0x3002('0x43')]=!![];_0x2f8205[_0x3002('0x28')]+=0x1;logger[_0x3002('0x3f')]('[syncHangup][talking][increment]',_0x3274b1[_0x3002('0x88')],'\x20Queue',_0x2f8205['name'],_0x3002('0x42'),_0x2f8205[_0x3002('0x28')]);ami[_0x3002('0x1f')](_0x3002('0x89'),ut[_0x3002('0x76')](_0x3274b1,_0x3002('0x8a'),this[_0x3002('0xe')][_0x3274b1[_0x3002('0x41')]]));if(_0x2f8205[_0x3002('0x8b')]||_0x2f8205['mandatoryDisposition']){ami['emit']('custom:agentConnectPreview',{'queue':_0x3274b1[_0x3002('0x41')],'interface':_0x3274b1['channelAgent'],'uniqueid':_0x3274b1[_0x3002('0x88')]});}break;case'16':ami[_0x3002('0x1f')]('custom:agentcomplete',ut[_0x3002('0x76')](_0x3274b1,'complete',this[_0x3002('0xe')][_0x3274b1['queue']]));emitVoiceQueueChannelRemove(ut[_0x3002('0x76')](_0x3274b1,_0x3002('0x8c')));_0x2f8205['outboundAnswerCallsDay']+=0x1;_0x2f8205['total']+=0x1;_0x2f8205[_0x3002('0x8d')]+=0x1;ut[_0x3002('0x4b')](_0x2f8205,_0x3002('0x8e'));_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x4,'Answer');rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0x90'));rpcDb[_0x3002('0x67')](_0x3274b1,_0x3002('0x91'));rpcDb[_0x3002('0x92')](_0x3274b1);_0x2f8205['sumDuration']+=_0x3274b1['talktime'];_0x2f8205['sumBillable']+=_0x3274b1[_0x3002('0x93')];logger[_0x3002('0x3f')]('[syncHangup][talking][decrement]',_0x3274b1[_0x3002('0x88')],'\x20Queue',_0x2f8205[_0x3002('0x23')],_0x3002('0x42'),_0x2f8205[_0x3002('0x28')]);delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0x94')]];break;case _0x3002('0x95'):_0x2f8205[_0x3002('0x96')]+=0x1;_0x3274b1[_0x3002('0x97')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut['logCustomer'](_0x3274b1,0x5,_0x3002('0x98'));_0x2bd830=_0x2f8205['dialBusyRetryFrequency'];_0x3fff73=_0x2f8205[_0x3002('0x99')];ami[_0x3002('0x1f')](_0x3002('0x9a'),ut[_0x3002('0x76')](_0x3274b1,_0x3002('0x9b')));rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0x9c'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'5',_0x2f8205)[_0x3002('0x53')](function(_0x172b7d){_0x539023=_0x172b7d[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0xf,'Global');rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0x9e'));}else{if(_0x3274b1['countbusyretry']>=_0x2f8205['dialBusyMaxRetry']){rpcDb[_0x3002('0x67')](_0x3274b1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x3002('0x80')](ut[_0x3002('0x81')](_0x3274b1,_0x3002('0x97'),_0x2f8205[_0x3002('0x9f')]),_0x3274b1[_0x3002('0x82')],_0x3274b1[_0x3002('0xa0')]);}}}else{_0x3274b1[_0x3002('0x97')]++;_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1[_0x3002('0x83')],'field':{'countbusyretry':_0x3274b1[_0x3002('0x97')]}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case _0x3002('0xa1'):_0x2f8205[_0x3002('0xa2')]+=0x1;_0x3274b1[_0x3002('0xa3')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut['totalGlobal'](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x3,'NoAnswer');_0x2bd830=_0x2f8205[_0x3002('0xa4')];_0x3fff73=_0x2f8205[_0x3002('0x99')];var _0x3a97f0=ut[_0x3002('0xa5')](_0x3274b1,_0x2f8205);ami[_0x3002('0x1f')](_0x3002('0xa6'),_0x3a97f0);rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0xa7'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'3',_0x2f8205)[_0x3002('0x53')](function(_0x5e46a7){_0x539023=_0x5e46a7[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut['cloneAction'](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xa8'));}else{if(_0x3274b1['countnoanswerretry']>=_0x2f8205[_0x3002('0xa9')]){rpcDb[_0x3002('0x67')](_0x3274b1,_0x3002('0xa7'));}else{rpcDb[_0x3002('0x80')](ut['scheduledAt'](_0x3274b1,_0x3002('0xa3'),_0x2f8205[_0x3002('0xa4')]),_0x3274b1[_0x3002('0x82')],_0x3274b1[_0x3002('0xa0')]);}}}else{_0x3274b1[_0x3002('0xa3')]++;_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1[_0x3002('0x83')],'field':{'countnoanswerretry':_0x3274b1[_0x3002('0xa3')]}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case'CONGESTION':_0x2f8205[_0x3002('0xaa')]+=0x1;_0x3274b1[_0x3002('0xab')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut['totalGlobal'](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x8,_0x3002('0xac'));_0x2bd830=_0x2f8205[_0x3002('0xad')];_0x3fff73=_0x2f8205[_0x3002('0x99')];ami[_0x3002('0x1f')](_0x3002('0xae'),ut[_0x3002('0x76')](_0x3274b1,_0x3002('0xaf')));rpcDb['createCustomerHistory'](_0x3274b1,_0x3002('0xb0'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'8',_0x2f8205)['then'](function(_0x5935b0){_0x539023=_0x5935b0[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xb1'));}else{if(_0x3274b1['countcongestionretry']>=_0x2f8205[_0x3002('0xb2')]){rpcDb['createCustomerFinal'](_0x3274b1,_0x3002('0xb0'));}else{rpcDb[_0x3002('0x80')](ut['scheduledAt'](_0x3274b1,_0x3002('0xab'),_0x2f8205[_0x3002('0x9f')]),_0x3274b1[_0x3002('0x82')],_0x3274b1['activeContact']);}}}else{_0x3274b1['countcongestionretry']++;_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1[_0x3002('0x83')],'field':{'countcongestionretry':_0x3274b1[_0x3002('0xab')]}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case _0x3002('0xb3'):_0x2f8205[_0x3002('0xb4')]+=0x1;_0x3274b1[_0x3002('0xb5')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x14,_0x3002('0xb6'));_0x2bd830=_0x2f8205[_0x3002('0xb7')];_0x3fff73=_0x2f8205['callAdditionalPhoneAfterMin'];ami[_0x3002('0x1f')](_0x3002('0xb8'),ut[_0x3002('0x76')](_0x3274b1,'agentreject'));rpcDb[_0x3002('0x65')](_0x3274b1,'[syncHangupRequest][logAgentReject]');_0x381c3d[_0x3002('0x79')](_0x3274b1,'20',_0x2f8205)[_0x3002('0x53')](function(_0x46e21e){_0x539023=_0x46e21e['additional']==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x49011d,_0x3002('0xb9'));}else{if(_0x3274b1['countagentrejectretry']>=_0x2f8205[_0x3002('0xba')]){rpcDb[_0x3002('0x67')](_0x3274b1,_0x3002('0xb9'));}else{rpcDb[_0x3002('0x80')](ut[_0x3002('0x81')](_0x3274b1,_0x3002('0xb5'),_0x2f8205[_0x3002('0xb7')]),_0x3274b1[_0x3002('0x82')],_0x3274b1[_0x3002('0xa0')]);}}}else{_0x3274b1['countnoanswerretry']++;_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1[_0x3002('0x83')],'field':{'countnoanswerretry':_0x3274b1['countnoanswerretry']}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case _0x3002('0xbb'):_0x2f8205['outboundAbandonedCallsDay']+=0x1;_0x3274b1[_0x3002('0xbc')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0xb,_0x3002('0xbd'));rpcDb[_0x3002('0x65')](_0x3274b1,'[callProgressDetectingCustomer][logAbandoned]');_0x381c3d['verifyAdditionalPhones'](_0x3274b1,'11',_0x2f8205)[_0x3002('0x53')](function(_0x14a8d9){_0x539023=_0x14a8d9[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut['totalGlobal'](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xbe'));}else{if(_0x3274b1[_0x3002('0xbf')]>=_0x2f8205[_0x3002('0xc0')]){rpcDb[_0x3002('0x67')](_0x3274b1,_0x3002('0xbe'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3274b1,'countabandonedretry',_0x2f8205[_0x3002('0xc1')]),_0x3274b1[_0x3002('0x82')],_0x3274b1['activeContact']);}}}else{_0x3274b1[_0x3002('0xa3')]++;_0x381c3d['incrementPreviewCounters']({'id':_0x3274b1[_0x3002('0x83')],'field':{'countnoanswerretry':_0x3274b1['countnoanswerretry']}})[_0x3002('0x53')](function(){_0x381c3d['swapAdditionalPhones'](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});break;case'18':_0x2f8205[_0x3002('0xc2')]+=0x1;_0x3274b1['countmachineretry']+=0x1;_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut['logCustomer'](_0x3274b1,0x12,_0x2f31ef['cause-txt']||_0x2f31ef[_0x3002('0xc3')]);ami[_0x3002('0x1f')](_0x3002('0xc4'),ut['buildObj'](_0x3274b1,'amd'));rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0xc5'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'18',_0x2f8205)[_0x3002('0x53')](function(_0x591d3e){_0x539023=_0x591d3e[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut['totalGlobal'](_0x3274b1)>=_0x2f8205['dialGlobalMaxRetry']){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0x12,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xc5'));}else{rpcDb[_0x3002('0x67')](_0x3274b1,_0x3002('0xc5'));}}else{_0x3274b1[_0x3002('0xa3')]++;_0x381c3d['incrementPreviewCounters']({'id':_0x3274b1[_0x3002('0x83')],'field':{'countnoanswerretry':_0x3274b1[_0x3002('0xa3')]}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0x94')]];break;case'19':_0x2f8205[_0x3002('0xc2')]+=0x1;_0x3274b1[_0x3002('0x8f')]=ut['totalGlobal'](_0x3274b1);ut[_0x3002('0x63')](_0x3274b1,0x13,_0x2f31ef[_0x3002('0xc6')]||_0x2f31ef[_0x3002('0xc3')]);ami['emit']('custom:amd',ut[_0x3002('0x76')](_0x3274b1,_0x3002('0xc7')));rpcDb[_0x3002('0x65')](_0x3274b1,_0x3002('0xc8'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'18',_0x2f8205)[_0x3002('0x53')](function(_0x35514c){_0x539023=_0x35514c[_0x3002('0x7a')]==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xc8'));}else{rpcDb['createCustomerFinal'](_0x3274b1,'[callProgressDetectingCustomer][machine]');}}else{_0x3274b1['countnoanswerretry']++;_0x381c3d[_0x3002('0x84')]({'id':_0x3274b1[_0x3002('0x83')],'field':{'countnoanswerretry':_0x3274b1['countnoanswerretry']}})[_0x3002('0x53')](function(){_0x381c3d[_0x3002('0x85')](_0x3274b1,_0x2bd830,_0x3fff73)[_0x3002('0x53')](function(){});});}});delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0x94')]];break;default:if(_0x3274b1['dialAnswer']){ut[_0x3002('0x4b')](_0x2f8205,_0x3002('0xc9'));ut[_0x3002('0x4c')](_0x3002('0xca')+_0x2f8205['name'],_0x2f31ef);}_0x2f8205['outboundUnknownCallsDay']+=0x1;_0x3274b1[_0x3002('0x8f')]=ut[_0x3002('0x7c')](_0x3274b1);ut['logCustomer'](_0x3274b1,0xc,_0x2f31ef[_0x3002('0xc6')]||_0x2f31ef[_0x3002('0xc3')]);_0x2bd830=_0x2f8205['dialAgentRejectRetryFrequency'];_0x3fff73=_0x2f8205[_0x3002('0x99')];rpcDb['createCustomerHistory'](_0x3274b1,_0x3002('0xcb'));_0x381c3d[_0x3002('0x79')](_0x3274b1,'20',_0x2f8205)[_0x3002('0x53')](function(_0xec21ab){_0x539023=_0xec21ab['additional']==0x1;if(!_0x539023){if(ut[_0x3002('0x7c')](_0x3274b1)>=_0x2f8205[_0x3002('0x7d')]){_0x49011d=ut[_0x3002('0x9d')](_0x3274b1,0xf,_0x3002('0x7e'));rpcDb[_0x3002('0x67')](_0x49011d,_0x3002('0xcc'));}else{rpcDb['createCustomerFinal'](_0x3274b1,_0x3002('0xcc'));}delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0x94')]];}else{_0x381c3d['swapAdditionalPhones'](_0x3274b1,_0x2bd830,_0x3fff73)['then'](function(){});}});}if(!(_0x3274b1[_0x3002('0x43')]&&_0x47189d==='16')){utils[_0x3002('0xcd')](_0x2f8205,_0x3002('0xce'));logger[_0x3002('0x3f')](_0x3002('0xcf'),_0x3274b1['uniqueid'],_0x3002('0xd0'),_0x2f8205[_0x3002('0x23')],'originated:\x20',_0x2f8205[_0x3002('0x27')]);}if(_0x47189d!==_0x3002('0x86')){delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0x94')]];delete this[_0x3002('0x11')][_0x2f31ef[_0x3002('0xd1')]];}_0x2f8205[_0x3002('0xd2')]=!![];}};Preview[_0x3002('0xb')]['callProgressDetectingAgent']=function(_0x8c83f4,_0xba3154,_0x106d16){if(_['isUndefined'](_0xba3154)&&_0x3002('0xd3')!==typeof _0xba3154){return;}if(_[_0x3002('0xd4')](_0x106d16)&&'object'!==typeof _0x106d16){return;}switch(_0x106d16['reason']){case'0':ut[_0x3002('0xd5')](_0x8c83f4,0x0,_0x3002('0x74'));rpcDb['createAgentHistory'](_0x8c83f4,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3002('0xd5')](_0x8c83f4,0x3,_0x3002('0xd6'));rpcDb[_0x3002('0xd7')](_0x8c83f4,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x8c83f4,0x5,'Busy');rpcDb['createAgentHistory'](_0x8c83f4,_0x3002('0xd8'));break;case'8':ut[_0x3002('0xd5')](_0x8c83f4,0x8,_0x3002('0xac'));rpcDb[_0x3002('0xd7')](_0x8c83f4,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3002('0xd5')](_0x8c83f4,0x16,_0x3002('0xd9'));rpcDb[_0x3002('0xd7')](_0x8c83f4,_0x3002('0xda'));break;default:ut[_0x3002('0xd5')](_0x8c83f4,0xc,_0x106d16[_0x3002('0xdb')]);rpcDb[_0x3002('0xd7')](_0x8c83f4,'[callProgressDetectingAgent][logCongestion]');}utils[_0x3002('0xcd')](_0xba3154,'[callProgressDetectingAgent]');logger[_0x3002('0x3f')]('[originated][decrement][callProgressDetectingAgent]',_0x8c83f4[_0x3002('0x88')],_0x3002('0xd0'),_0xba3154[_0x3002('0x23')],_0x3002('0xdc'),_0xba3154[_0x3002('0x27')]);delete this['actions'][_0x8c83f4['uniqueid']];};Preview[_0x3002('0xb')]['verifyAdditionalPhones']=function(_0xf9ba15,_0x206953,_0x5f9932){return cmHopperAdditionalPhone[_0x3002('0x79')](_0xf9ba15,_0x206953,_0x5f9932)[_0x3002('0x5c')](logger[_0x3002('0x3f')](_0x3002('0xdd')));};Preview['prototype'][_0x3002('0x85')]=function(_0x416537,_0x5c730f,_0x3655b3){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x416537,_0x5c730f,_0x3655b3)[_0x3002('0x5c')](logger[_0x3002('0x3f')]('[swapAdditionalPhone]\x20'));};Preview[_0x3002('0xb')][_0x3002('0x84')]=function(_0x3ca82a){return Promise['resolve']()[_0x3002('0x53')](cmHopperAdditionalPhone[_0x3002('0x84')](_0x3ca82a))[_0x3002('0x5c')](logger[_0x3002('0x3f')](_0x3002('0xde')));};Preview[_0x3002('0xb')][_0x3002('0xdf')]=function(_0x5527be,_0x3ae656,_0x957579,_0x623d77,_0x919121){var _0x223b5c=this;return new Promise(function(_0x2db454,_0x2d3e48){if(_[_0x3002('0x3e')](_0x3ae656)||_[_0x3002('0x3e')](_0x3ae656['Contact'])||_['isNil'](_0x3ae656['phone'])||_[_0x3002('0x3e')](_0x3ae656[_0x3002('0x46')])){_0x2d3e48(ut[_0x3002('0x2a')](_0x3002('0xe0'),_0x623d77,_0x919121));return;}var _0x46d1e1=uuid['v4']();var _0x189587=_0x223b5c[_0x3002('0xe')][_0x3ae656[_0x3002('0x40')]['name']];var _0x3376b6=_0x957579?_0x223b5c[_0x3002('0x12')][_0x957579]['id']:undefined;_0x223b5c[_0x3002('0x11')][_0x46d1e1]=new Action(_0x3ae656,_0x189587,_0x46d1e1,_0x957579,_0x3376b6);var _0x167220=_0x223b5c[_0x3002('0x11')][_0x46d1e1];_0x167220[_0x3002('0x82')]=_0x623d77;_0x167220[_0x3002('0xa0')]=_0x919121;_0x167220['lookAgent']=_0x957579;if(_[_0x3002('0xe1')](_0x5527be)){_0x223b5c['execCall'](_0x167220,_0x189587,_0x3ae656,_0x957579)[_0x3002('0x53')](function(_0x377840){logger['info'](_0x3002('0xe2'),_0x3002('0xe3')+_0x167220[_0x3002('0x41')]+_0x3002('0xe4')+_0x167220[_0x3002('0x83')],JSON[_0x3002('0x21')](_0x377840));ami[_0x3002('0x1f')](_0x3002('0xe5'),ut['buildObj'](_0x167220,_0x3002('0xe6'),_0x223b5c[_0x3002('0xe')][_0x167220['queue']]));_0x2db454(ut['message']('Calling'));})[_0x3002('0x5c')](function(_0x49623a){ut[_0x3002('0x30')]('[Preview][execCall][failure]',_0x49623a);_0x2d3e48(ut[_0x3002('0x2a')](_0x3002('0xe7'),_0x623d77,_0x919121));});}else{_0x189587[_0x3002('0xe8')]+=0x1;ut[_0x3002('0xe9')](_0x167220);rpcDb[_0x3002('0xea')](_0x167220,_0x3002('0xeb'));delete _0x223b5c[_0x3002('0x11')][_0x46d1e1];_0x2d3e48(ut[_0x3002('0x2a')](_0x3002('0xec'),_0x623d77,_0x919121));}});};Preview['prototype'][_0x3002('0x6d')]=function(_0x1e9b23){return!_['isNil'](_0x1e9b23)&&!_[_0x3002('0x3e')](_0x1e9b23[_0x3002('0x23')])&&!_[_0x3002('0x3e')](_0x1e9b23[_0x3002('0xed')])&&_0x1e9b23[_0x3002('0xed')]&&!_[_0x3002('0x3e')](this[_0x3002('0x10')][util[_0x3002('0x87')]('SIP/%s',_0x1e9b23[_0x3002('0x23')])])&&!_['isNil'](this[_0x3002('0x10')][util[_0x3002('0x87')](_0x3002('0xee'),_0x1e9b23[_0x3002('0x23')])][_0x3002('0x49')])&&(this[_0x3002('0x10')][util[_0x3002('0x87')]('SIP/%s',_0x1e9b23[_0x3002('0x23')])][_0x3002('0x49')]===_0x3002('0xef')||this[_0x3002('0x10')][util['format'](_0x3002('0xee'),_0x1e9b23[_0x3002('0x23')])][_0x3002('0x49')]===_0x3002('0xf0'));};Preview['prototype'][_0x3002('0xf1')]=function(_0x2e3f90,_0x1d9f27){return this['execRun'](_0x2e3f90,_0x1d9f27)['then'](function(_0x113676){return _[_0x3002('0x44')](_0x113676,[_0x3002('0x2a')]);})[_0x3002('0x5c')](function(_0x34cfbe){if(_0x34cfbe['unlock']){rpcDb[_0x3002('0xf2')](_0x2e3f90);}if(_0x34cfbe[_0x3002('0xed')]){rpcDb[_0x3002('0x5d')](_0x2e3f90);}throw _[_0x3002('0x44')](_0x34cfbe,[_0x3002('0x2a')]);});};Preview[_0x3002('0xb')][_0x3002('0xf3')]=function(_0x2a6646,_0x121e29){var _0x56adc7=this;var _0x39993d,_0x3fc28d;return rpcDb[_0x3002('0xf4')](_0x2a6646)[_0x3002('0x53')](function(_0x4671d7){if(!_[_0x3002('0x3e')](_0x4671d7[0x0])){_0x3fc28d=_0x4671d7[0x0][_0x3002('0xf5')]?![]:!![];_0x39993d=_0x4671d7[0x0][_0x3002('0xf5')]?!![]:![];_0x39993d=_0x121e29?!![]:_0x39993d;}var _0x2edb3e=_0x56adc7['validateContact'](_0x4671d7);if(_0x2edb3e[_0x3002('0xf6')]){rpcDb[_0x3002('0xf7')](_['pick'](_0x4671d7[0x0],[_0x3002('0x46'),_0x3002('0xf8')]))[_0x3002('0x53')](function(_0x13560f){_0x56adc7[_0x3002('0xdf')](_0x13560f,_0x4671d7[0x0],_0x121e29,_0x3fc28d,_0x39993d)[_0x3002('0x53')](function(_0x553868){return _0x553868;})[_0x3002('0x5c')](function(_0x472930){throw _0x472930;});})[_0x3002('0x5c')](function(_0x264849){ut[_0x3002('0x30')](_0x3002('0xf9'),_0x264849);throw ut[_0x3002('0x2a')](_0x3002('0xfa'),_0x3fc28d,_0x39993d);});}else{throw ut['message'](_0x2edb3e[_0x3002('0x2a')],_0x3fc28d,_0x39993d);}})['catch'](function(_0x7787c4){ut[_0x3002('0x30')](_0x3002('0xfb'),_0x7787c4);throw ut[_0x3002('0x2a')](_0x3002('0xfa'),![],!![]);});};Preview[_0x3002('0xb')][_0x3002('0xfc')]=function(_0x12817c){if(_['isNil'](_0x12817c)||_[_0x3002('0xe1')](_0x12817c)||!_[_0x3002('0x3e')](_0x12817c[0x0][_0x3002('0x58')])&&_['isNil'](_0x12817c[0x0]['Agent'][_0x3002('0x23')])){ut[_0x3002('0x30')](_0x3002('0xfd'),_0x12817c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x542752=this[_0x3002('0xe')][_0x12817c[0x0][_0x3002('0x40')]['name']];_0x542752[_0x3002('0x2a')]=utils['CAMPAIGN_STATUS'][_0x3002('0x70')];if(_[_0x3002('0x3e')](_0x542752)){ut[_0x3002('0x30')](_0x3002('0xfe'),_0x542752);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x3002('0x6d')](_0x542752['Trunk'])){ut[_0x3002('0x30')](_0x3002('0xff'),_0x3002('0x100')+_0x542752[_0x3002('0x23')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3002('0x6d')](_0x542752[_0x3002('0x6e')])){ut[_0x3002('0x30')](_0x3002('0xff'),_0x542752[_0x3002('0x23')]+_0x3002('0x101'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x3002('0x6b')](_0x542752[_0x3002('0x38')])){ut[_0x3002('0x30')](_0x3002('0x102'),_0x542752[_0x3002('0x23')]+_0x3002('0x103'));return{'isValid':![],'message':_0x3002('0x100')+_0x542752[_0x3002('0x23')]+_0x3002('0x103')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x3002('0x104')]=function(_0x7d7995,_0x27a8f2,_0x3b3cad,_0x34f85d){var _0x5b63e1=this;return new Promise(function(_0x55fcca,_0x310184){var _0x3cfa7e=_0x7d7995[_0x3002('0x88')];var _0xb86230=_0x5b63e1[_0x3002('0x6d')](_0x27a8f2['Trunk'])?util[_0x3002('0x87')](_0x3002('0x105'),_0x27a8f2['Trunk'][_0x3002('0x23')],_['isNil'](_0x27a8f2[_0x3002('0x106')])?'':_0x27a8f2[_0x3002('0x106')][_0x3002('0x107')]()||'',_0x27a8f2[_0x3002('0x108')]>0x0?_0x3b3cad[_0x3002('0xf8')][_0x3002('0x109')](_0x27a8f2[_0x3002('0x108')]):_0x3b3cad['phone']):util['format'](_0x3002('0x105'),_['isNil'](_0x27a8f2[_0x3002('0x6e')])?_0x27a8f2[_0x3002('0x6c')][_0x3002('0x23')]:_0x27a8f2['TrunkBackup'][_0x3002('0x23')],_[_0x3002('0x3e')](_0x27a8f2[_0x3002('0x106')])?'':_0x27a8f2[_0x3002('0x106')][_0x3002('0x107')]()||'',_0x27a8f2['dialCutDigit']>0x0?_0x3b3cad[_0x3002('0xf8')][_0x3002('0x109')](_0x27a8f2['dialCutDigit']):_0x3b3cad[_0x3002('0xf8')]);var _0xe32808=_0x5b63e1['isTrunkReachable'](_0x27a8f2[_0x3002('0x6c')])?ut[_0x3002('0x10a')](_0x27a8f2[_0x3002('0x6c')][_0x3002('0x10b')],_0x27a8f2['dialOriginateCallerIdName'],_0x27a8f2[_0x3002('0x10c')]>0x0?ut[_0x3002('0x10d')](_0x27a8f2[_0x3002('0x10e')],_0x27a8f2[_0x3002('0x10c')]):_0x27a8f2[_0x3002('0x10e')]):ut[_0x3002('0x10a')](_[_0x3002('0x3e')](_0x27a8f2[_0x3002('0x6e')])?_0x27a8f2[_0x3002('0x6c')][_0x3002('0x10b')]:_0x27a8f2[_0x3002('0x6e')][_0x3002('0x10b')],_0x27a8f2[_0x3002('0x10f')],_0x27a8f2['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x27a8f2['dialOriginateCallerIdNumber'],_0x27a8f2['dialRandomLastDigitCallerIdNumber']):_0x27a8f2[_0x3002('0x10e')]);if(_0xe32808){_0x7d7995[_0x3002('0x110')]=ut[_0x3002('0x111')](_0xe32808);_0x7d7995[_0x3002('0x112')]=ut[_0x3002('0x113')](_0xe32808);}var _0x204622=ut[_0x3002('0x114')](_0x27a8f2,_0x3b3cad,_0xb86230,_0xe32808,_0x3cfa7e,_0x7d7995);var _0x4df1e4=utils[_0x3002('0x115')](_0x3b3cad['Contact']);Object[_0x3002('0x116')](_0x204622,_0x4df1e4);_[_0x3002('0x117')](_0x7d7995,ut[_0x3002('0x118')](_0x204622));_0x7d7995['starttime']=moment()[_0x3002('0x87')](_0x3002('0x119'));_0x27a8f2[_0x3002('0x11a')]=_0x204622;var _0x13fff1=ut[_0x3002('0x11b')](_0x7d7995,_0x27a8f2,_0x204622,_0x7d7995[_0x3002('0xa0')],_0x34f85d);return ami[_0x3002('0x48')](_0x13fff1)[_0x3002('0x53')](function(_0x160c5e){_0x27a8f2[_0x3002('0x27')]+=0x1;logger[_0x3002('0x3f')]('[originated][increment]',_0x3cfa7e,'\x20Queue',_0x27a8f2[_0x3002('0x23')],_0x3002('0xdc'),_0x27a8f2[_0x3002('0x27')]);_0x55fcca(_0x160c5e);})[_0x3002('0x5c')](function(_0x227d27){ut['logAgent'](_0x7d7995,0xe,_0x3002('0x11c'));rpcDb[_0x3002('0xd7')](_0x7d7995,_0x3002('0x11d'));_0x310184(_0x227d27);});});};Preview[_0x3002('0xb')]['syncNewExten']=function(_0x563050){if(this['actions'][_0x563050[_0x3002('0x94')]]){this[_0x3002('0x11')][_0x563050[_0x3002('0x94')]][_0x3002('0x11e')]=_0x563050[_0x3002('0x11e')];}};Preview[_0x3002('0xb')][_0x3002('0x15')]=function(_0x5d3955){var _0x17dd7f=this;var _0x420b8b=this[_0x3002('0x11')][_0x5d3955[_0x3002('0x11f')]];if(_0x420b8b){if(_0x420b8b['lookAgent']&&this[_0x3002('0x12')][_0x420b8b[_0x3002('0x120')]]){ut[_0x3002('0x121')](_0x420b8b,this[_0x3002('0x12')][_0x420b8b['lookAgent']][_0x3002('0x23')],this['agents'][_0x420b8b[_0x3002('0x120')]]['id']);}var _0x13d7ae=_['clone'](_0x420b8b);_0x13d7ae[_0x3002('0x122')]=moment()['format'](_0x3002('0x119'));var _0x9b5796=_0x17dd7f[_0x3002('0xe')][_0x420b8b[_0x3002('0x41')]];if(ut[_0x3002('0x123')](_0x5d3955[_0x3002('0x124')])){if(_0x420b8b['unlockAgent']){rpcDb[_0x3002('0xf2')](_0x420b8b[_0x3002('0x83')]);}if(_0x420b8b[_0x3002('0xa0')]){rpcDb['disableContact'](_0x420b8b[_0x3002('0x83')]);}ami[_0x3002('0x1f')](_0x3002('0x125'),ut[_0x3002('0x76')](_0x420b8b,_0x3002('0x126'),this[_0x3002('0xe')][_0x420b8b[_0x3002('0x41')]]));this[_0x3002('0x127')](_0x13d7ae,_0x9b5796,_0x5d3955);}else{_0x420b8b[_0x3002('0x5e')]=moment()['format'](_0x3002('0x119'));ut['logAgent'](_0x13d7ae,0x4,'Answer');rpcDb[_0x3002('0xd7')](_0x13d7ae,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3002('0xb')]['syncHangup']=function(_0x3c7552){var _0x44e351=this['actions'][_0x3c7552[_0x3002('0x94')]];var _0x48f493;if(_0x44e351){_0x48f493=this[_0x3002('0xe')][_0x44e351[_0x3002('0x41')]];logger[_0x3002('0x3f')](_0x3002('0x128'),_0x3c7552[_0x3002('0x94')],_0x3002('0xd0'),_0x48f493[_0x3002('0x23')],_0x3002('0x42'),_0x48f493[_0x3002('0x28')]);}if(this[_0x3002('0x11')][_0x3c7552['linkedid']]&&_0x3c7552[_0x3002('0x94')]!==_0x3c7552[_0x3002('0x88')]){if(_0x3c7552['cause']==='16'&&this[_0x3002('0x11')][_0x3c7552[_0x3002('0x94')]][_0x3002('0x43')]){this['callProgressDetectingCustomer'](_0x3c7552,_0x3c7552[_0x3002('0x94')],_0x3c7552[_0x3002('0x129')]);}else if(this[_0x3002('0x11')][_0x3c7552[_0x3002('0x94')]][_0x3002('0x43')]){logger[_0x3002('0x3f')](_0x3002('0x12a'),_0x3c7552[_0x3002('0x94')],_0x3c7552[_0x3002('0x129')],_0x3002('0xd0'),_0x48f493['name'],'pTalking:\x20',_0x48f493['pTalking']);this['callProgressDetectingCustomer'](_0x3c7552,_0x3c7552[_0x3002('0x94')],_0x3c7552['cause']);}}else if(_0x44e351&&_[_0x3002('0x3e')](_0x44e351['statedesc'])&&_0x48f493[_0x3002('0x12b')]&&_0x3c7552[_0x3002('0x94')]===_0x3c7552[_0x3002('0x88')]&&_['isNil'](_0x3c7552[_0x3002('0xdb')])&&_0x3c7552['cause']==='16'&&_0x3c7552[_0x3002('0x12c')]==='6'&&_[_0x3002('0xd4')](_0x44e351['transfer'])){if(_0x44e351[_0x3002('0x82')]){rpcDb[_0x3002('0xf2')](_0x44e351[_0x3002('0x83')]);}if(_0x44e351[_0x3002('0xa0')]){rpcDb[_0x3002('0x5d')](_0x44e351[_0x3002('0x83')]);}_0x3c7552['reason']='22';this[_0x3002('0x127')](_0x44e351,_0x48f493,_0x3c7552);}else if(_0x44e351&&_0x44e351[_0x3002('0x12d')]){if(_0x3c7552[_0x3002('0x129')]==='16'&&this[_0x3002('0x11')][_0x3c7552[_0x3002('0x94')]][_0x3002('0x43')]){logger[_0x3002('0x3f')](_0x3002('0x12e'),_0x3c7552[_0x3002('0x94')],_0x3c7552['cause'],_0x3002('0xd0'),_0x48f493[_0x3002('0x23')],'pTalking:\x20',_0x48f493['pTalking']);this[_0x3002('0x71')](_0x3c7552,_0x3c7552[_0x3002('0x94')],_0x3c7552[_0x3002('0x129')]);}else if(this[_0x3002('0x11')][_0x3c7552[_0x3002('0x94')]][_0x3002('0x43')]){logger[_0x3002('0x3f')](_0x3002('0x12a'),_0x3c7552[_0x3002('0x94')],_0x3c7552[_0x3002('0x129')],'\x20Queue',_0x48f493[_0x3002('0x23')],_0x3002('0x42'),_0x48f493[_0x3002('0x28')]);this['callProgressDetectingCustomer'](_0x3c7552,_0x3c7552[_0x3002('0x94')],_0x3c7552[_0x3002('0x129')]);}}};Preview[_0x3002('0xb')]['syncDialEnd']=function(_0x565e86){if(this[_0x3002('0x11')][_0x565e86[_0x3002('0xd1')]]&&_0x565e86['destlinkedid']!==_0x565e86[_0x3002('0x12f')]){this[_0x3002('0x71')](_0x565e86,_0x565e86[_0x3002('0xd1')],_0x565e86[_0x3002('0xc3')]);}};Preview[_0x3002('0xb')][_0x3002('0x19')]=function(_0x355f53){if(this[_0x3002('0x11')][_0x355f53[_0x3002('0x94')]]&&_0x355f53[_0x3002('0x94')]!==_0x355f53['uniqueid']&&!this[_0x3002('0x11')][_0x355f53[_0x3002('0x94')]][_0x3002('0x43')]){if(_0x355f53[_0x3002('0x129')]==='1'){this[_0x3002('0x71')](_0x355f53,_0x355f53['linkedid'],_0x355f53[_0x3002('0x129')]);}}};Preview[_0x3002('0xb')][_0x3002('0x130')]=function(_0x4a2eb2,_0x512e34,_0x233472){if(this['actions'][_0x4a2eb2]){if(_[_0x3002('0x3e')](this[_0x3002('0x11')][_0x4a2eb2]['variables'])){this[_0x3002('0x11')][_0x4a2eb2]['variables']={};}this[_0x3002('0x11')][_0x4a2eb2]['variables'][_0x512e34]=_0x233472;}};Preview[_0x3002('0xb')][_0x3002('0x131')]=function(_0x48d6d9){try{if(!_[_0x3002('0x3e')](_0x48d6d9)){if(ut['filterKey'](_['keys'](_0x48d6d9[_0x3002('0x132')])[0x0])){this['addVariable'](_0x48d6d9[_0x3002('0x88')],_['keys'](_0x48d6d9[_0x3002('0x132')])[0x0],_0x48d6d9[_0x3002('0x133')]);}}}catch(_0x1e3637){logger[_0x3002('0x134')](_0x3002('0x135'),util[_0x3002('0x136')](_0x1e3637,{'showHidden':![],'depth':null}));}};Preview[_0x3002('0xb')][_0x3002('0x137')]=function(_0x328b3e){if(_0x328b3e){if(this['actions'][_0x328b3e[_0x3002('0x138')]]){this[_0x3002('0x11')][_0x328b3e[_0x3002('0x138')]][_0x3002('0x12d')]=!![];}}};Preview[_0x3002('0xb')][_0x3002('0x1d')]=function(_0x447d73){if(_0x447d73){if(this['actions'][_0x447d73[_0x3002('0x139')]]){this['actions'][_0x447d73[_0x3002('0x139')]][_0x3002('0x12d')]=!![];}}};module[_0x3002('0x13a')]=Preview; \ No newline at end of file +var _0x9643=['Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','variable','value','error','transfertargetlinkedid','transfererlinkedid','exports','util','moment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','mandatoryDisposition','channelAgent','uniqueid','buildObj','complete','outboundAnswerCallsDay','total','answered','Answer','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','phone'];(function(_0x100053,_0x4129da){var _0x173aa0=function(_0x4df578){while(--_0x4df578){_0x100053['push'](_0x100053['shift']());}};_0x173aa0(++_0x4129da);}(_0x9643,0x197));var _0x3964=function(_0xe14f19,_0x4b9773){_0xe14f19=_0xe14f19-0x0;var _0x98c20f=_0x9643[_0xe14f19];return _0x98c20f;};'use strict';var util=require(_0x3964('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x3964('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3964('0x2'));var loggerAction=require(_0x3964('0x3'))(_0x3964('0x4'));var ami=require(_0x3964('0x5'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x3964('0x6'));var Action=require(_0x3964('0x7'));var ut=require(_0x3964('0x8'));var utils=require(_0x3964('0x9'));config[_0x3964('0xa')]=_['defaults'](config[_0x3964('0xa')],{'host':_0x3964('0xb'),'port':0x18eb});var io=require(_0x3964('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3964('0xd')][_0x3964('0xe')]=function(_0x5750d3){this[_0x3964('0xf')]=this[_0x3964('0xf')]?this[_0x3964('0xf')][_0x3964('0x10')](_0x5750d3):_0x5750d3();};function Preview(_0x38dbb8){this[_0x3964('0x11')]=new Sequence();this[_0x3964('0x12')]=_0x38dbb8['voiceQueues'];this['trunks']=_0x38dbb8[_0x3964('0x13')];this[_0x3964('0x14')]={};this['agents']=_0x38dbb8[_0x3964('0x15')];this[_0x3964('0x16')]=0x0;ami['on'](_0x3964('0x17'),this[_0x3964('0x18')][_0x3964('0x19')](this));ami['on'](_0x3964('0x1a'),this[_0x3964('0x1b')][_0x3964('0x19')](this));ami['on'](_0x3964('0x1c'),this[_0x3964('0x1d')]['bind'](this));ami['on'](_0x3964('0x1e'),this[_0x3964('0x1f')][_0x3964('0x19')](this));ami['on']('newexten',this[_0x3964('0x20')][_0x3964('0x19')](this));ami['on'](_0x3964('0x21'),this[_0x3964('0x22')][_0x3964('0x19')](this));ami['on'](_0x3964('0x23'),this[_0x3964('0x24')]['bind'](this));ami['on'](_0x3964('0x25'),this[_0x3964('0x26')]['bind'](this));this[_0x3964('0x27')](this['campaignsPreview']);}function emit(_0x2b95c1,_0x8b7161,_0x462e45){io['to'](_0x2b95c1)[_0x3964('0x28')](_0x8b7161,_0x462e45);}function emitVoiceQueueChannelRemove(_0x340031){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3964('0x29')](_0x340031));emit(util[_0x3964('0x2a')]('voice:queue:%s',_0x340031[_0x3964('0x2b')]),_0x3964('0x2c'),_0x340031);io['emit'](_0x3964('0x2d'),_0x340031);}function notSendMessagesQueue(_0x187b04){if(_0x187b04['sendMessageOneNotActive']){if(_0x187b04[_0x3964('0x2e')]===0x0&&_0x187b04[_0x3964('0x2f')]===0x0){_0x187b04[_0x3964('0x30')]=![];_0x187b04['available']=0x0;_0x187b04[_0x3964('0x31')]=0x0;_0x187b04['message']=utils[_0x3964('0x32')]['INACTIVE'];ut[_0x3964('0x33')](_0x3964('0x34'),_0x187b04['name']+_0x3964('0x35'));}else{_0x187b04[_0x3964('0x36')]=utils[_0x3964('0x32')][_0x3964('0x37')];ut[_0x3964('0x33')](_0x3964('0x34'),_0x187b04[_0x3964('0x2b')]+'\x20is\x20deactivated');}}}Preview[_0x3964('0xd')][_0x3964('0x27')]=function(){var _0x5008fc=this;setInterval(function(){_0x5008fc[_0x3964('0x38')]();},0x7cf);};Preview['prototype'][_0x3964('0x38')]=function(){var _0x277f3d=this[_0x3964('0x12')];this[_0x3964('0x16')]+=0x1;for(var _0x54641e in _0x277f3d){if(_0x277f3d[_0x3964('0x39')](_0x54641e)&&(_0x277f3d[_0x54641e][_0x3964('0x3a')]===_0x3964('0x2')||_0x277f3d[_0x54641e]['dialMethod']===_0x3964('0x3b'))&&_0x277f3d[_0x54641e][_0x3964('0x3c')]==='outbound'){if(this[_0x3964('0x16')]>0x7){this[_0x3964('0x16')]=0x0;this[_0x3964('0x3d')]();}}if(_0x277f3d[_0x3964('0x39')](_0x54641e)&&_0x277f3d[_0x54641e]['dialMethod']==='preview'&&_0x277f3d[_0x54641e][_0x3964('0x3c')]==='outbound'){if(_0x277f3d[_0x54641e][_0x3964('0x3e')]){this[_0x3964('0x3f')](_0x277f3d[_0x54641e]);if(_0x277f3d[_0x54641e]['dialPreviewAutoRecallMe'])this[_0x3964('0x40')](_0x277f3d[_0x54641e]);}else{notSendMessagesQueue(_0x277f3d[_0x54641e]);}}}};Preview['prototype'][_0x3964('0x41')]=function(_0x2c8773){var _0x84fc5c=this;this[_0x3964('0x11')][_0x3964('0xe')](function(){if(!_['isNil'](_0x84fc5c[_0x3964('0x14')][_0x2c8773])){loggerAction[_0x3964('0x42')](_0x3964('0x43'),_0x2c8773,'Queue',_0x84fc5c['actions'][_0x2c8773][_0x3964('0x44')],'originated:\x20',JSON['stringify'](_0x84fc5c['campaignsPreview'][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]][_0x3964('0x2e')]),_0x3964('0x45'),JSON[_0x3964('0x29')](_0x84fc5c[_0x3964('0x12')][_0x84fc5c['actions'][_0x2c8773]['queue']][_0x3964('0x2f')]),JSON['stringify'](_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x46')]),JSON[_0x3964('0x29')](_[_0x3964('0x47')](_0x84fc5c[_0x3964('0x14')][_0x2c8773],[_0x3964('0x48'),_0x3964('0x49'),_0x3964('0x4a'),_0x3964('0x4b')])));return ami[_0x3964('0x4c')]({'action':_0x3964('0x4d'),'channel':_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x4e')]})[_0x3964('0x4f')](function(_0xe85c95){if(_0xe85c95['message']===_0x3964('0x50')){setTimeout(function(){if(_0x84fc5c['actions'][_0x2c8773]){utils['decrementOriginate'](_0x84fc5c[_0x3964('0x12')][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]],'[clearZombieChannel]');if(_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x46')]===!![]){ut[_0x3964('0x51')](_0x84fc5c[_0x3964('0x12')][_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]],'[clearZombieChannel]');ut[_0x3964('0x52')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c8773,_0x84fc5c[_0x3964('0x14')][_0x2c8773][_0x3964('0x44')]);}ut['loggerError'](_0x3964('0x53')+_0x2c8773,_0x84fc5c['actions'][_0x2c8773][_0x3964('0x44')]);delete _0x84fc5c['actions'][_0x2c8773];}},0x2328);}});}});};Preview[_0x3964('0xd')][_0x3964('0x3d')]=function(){var _0x3add97=this;loggerAction[_0x3964('0x42')](_0x3964('0x54'),_[_0x3964('0x55')](this[_0x3964('0x14')]));for(var _0x2200f4 in this[_0x3964('0x14')]){if(_0x3add97[_0x3964('0x14')][_0x3964('0x39')](_0x2200f4)){_0x3add97[_0x3964('0x41')](_0x2200f4);}}};Preview['prototype'][_0x3964('0x40')]=function(_0x28b1bb){var _0x155055=this;rpcDb[_0x3964('0x56')](_0x28b1bb['id'],ut[_0x3964('0x57')](this['agents']))[_0x3964('0x58')](function(_0x28133b){if(!_[_0x3964('0x59')](_0x28133b)){for(var _0xf9055=0x0;_0xf9055<_0x28133b['length'];_0xf9055+=0x1){if(ut[_0x3964('0x5a')](_0x28133b[_0xf9055][_0x3964('0x5b')])<_0x28b1bb[_0x3964('0x5c')]*0x3c){if(_0x28133b[_0xf9055][_0x3964('0x5d')]&&!_0x28133b[_0xf9055]['Agent']['voicePause']){_0x155055[_0x3964('0x5e')](_0x28133b[_0xf9055]['id'])[_0x3964('0x58')](ut[_0x3964('0x5f')]('[RecallMe]'))[_0x3964('0x4f')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x3964('0x60')](_0x28133b[_0xf9055]['id']);}}else{var _0x37eab9=new Action(_0x28133b[_0xf9055],_0x28b1bb);_0x37eab9[_0x3964('0x61')]=moment()[_0x3964('0x2a')](_0x3964('0x62'));_0x28b1bb[_0x3964('0x63')]+=0x1;ut[_0x3964('0x64')](_0x37eab9,0x17,'RecallInQueue');if(_0x28b1bb[_0x3964('0x65')]){rpcDb[_0x3964('0x66')](ut[_0x3964('0x67')](_0x28133b[_0xf9055]));rpcDb[_0x3964('0x68')](_0x37eab9,_0x3964('0x69'));}else{ut[_0x3964('0x64')](_0x37eab9,0x16,_0x3964('0x6a'));rpcDb[_0x3964('0x68')](_0x37eab9,_0x3964('0x6b'));rpcDb[_0x3964('0x6c')](_0x37eab9,_0x3964('0x6b'));}}}}})[_0x3964('0x4f')](ut[_0x3964('0x5f')]('[getContactRecallMe]'));};Preview[_0x3964('0xd')]['setMessage']=function(_0x59f224){_0x59f224['sendMessageOneNotActive']=!![];if(ut[_0x3964('0x6d')](_0x59f224[_0x3964('0x6e')])){_0x59f224['message']=utils[_0x3964('0x32')][_0x3964('0x6f')];}else if(!ut[_0x3964('0x70')](_0x59f224[_0x3964('0x3e')])){_0x59f224[_0x3964('0x36')]=utils['CAMPAIGN_STATUS'][_0x3964('0x71')];}else if(!this[_0x3964('0x72')](_0x59f224[_0x3964('0x73')])){if(!this['isTrunkReachable'](_0x59f224[_0x3964('0x74')])){_0x59f224[_0x3964('0x36')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x59f224[_0x3964('0x36')]=utils[_0x3964('0x32')][_0x3964('0x75')];}}else{_0x59f224['message']=utils[_0x3964('0x32')][_0x3964('0x75')];}};Preview[_0x3964('0xd')][_0x3964('0x76')]=function(_0x20f287,_0x4537c2,_0x3b5f84){var _0x52e5ee=this;var _0x1fb401=this[_0x3964('0x14')][_0x4537c2];var _0x53f111=this[_0x3964('0x12')][_0x1fb401['queue']];var _0x52b179;var _0x1c676d=![];var _0x1bf1c4=0x2;var _0x51fe3d=0x3;if(_0x53f111){switch(_0x3b5f84){case'1':_0x53f111[_0x3964('0x77')]+=0x1;_0x1fb401[_0x3964('0x78')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x0,'NoSuchNumber');ami[_0x3964('0x28')](_0x3964('0x7b'),ut['buildObj'](_0x1fb401,_0x3964('0x7c')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0x7d'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'0',_0x53f111)['then'](function(_0x245cc8){_0x1c676d=_0x245cc8[_0x3964('0x7f')]==0x1;_0x1bf1c4=_0x53f111[_0x3964('0x80')];_0x51fe3d=_0x53f111[_0x3964('0x81')];if(!_0x1c676d){if(ut['totalGlobal'](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0x85'));}else{if(_0x1fb401[_0x3964('0x78')]>=_0x53f111[_0x3964('0x86')]){rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3964('0x87')](ut['scheduledAt'](_0x1fb401,_0x3964('0x78'),_0x53f111['dialNoSuchNumberRetryFrequency']),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];}else{_0x1fb401[_0x3964('0x78')]++;logger['info'](_0x3964('0x8a'),_0x1fb401[_0x3964('0x78')]);logger['info']('id',_0x1fb401['idContact']);_0x52e5ee['incrementPreviewCounters']({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnosuchnumberretry':_0x1fb401[_0x3964('0x78')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case'ANSWER':var _0x423d91=moment()['format'](_0x3964('0x62'));_0x1fb401['responsetime']=_0x423d91;_0x1fb401[_0x3964('0x8c')]=_0x423d91;_0x1fb401[_0x3964('0x46')]=!![];_0x53f111[_0x3964('0x2f')]+=0x1;logger[_0x3964('0x42')](_0x3964('0x8d'),_0x1fb401['uniqueid'],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0x45'),_0x53f111['pTalking']);ami[_0x3964('0x28')](_0x3964('0x8f'),ut['buildObj'](_0x1fb401,_0x3964('0x90'),this[_0x3964('0x12')][_0x1fb401['queue']]));if(_0x53f111['acw']||_0x53f111[_0x3964('0x91')]){ami[_0x3964('0x28')]('custom:agentConnectPreview',{'queue':_0x1fb401[_0x3964('0x44')],'interface':_0x1fb401[_0x3964('0x92')],'uniqueid':_0x1fb401[_0x3964('0x93')]});}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0x95'),this[_0x3964('0x12')][_0x1fb401['queue']]));emitVoiceQueueChannelRemove(ut[_0x3964('0x94')](_0x1fb401,_0x3964('0x95')));_0x53f111[_0x3964('0x96')]+=0x1;_0x53f111[_0x3964('0x97')]+=0x1;_0x53f111[_0x3964('0x98')]+=0x1;ut[_0x3964('0x51')](_0x53f111,'[16]');_0x1fb401['countglobal']=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x4,_0x3964('0x99'));rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x3964('0x9a')](_0x1fb401);_0x53f111[_0x3964('0x9b')]+=_0x1fb401[_0x3964('0x9c')];_0x53f111[_0x3964('0x9d')]+=_0x1fb401[_0x3964('0x9c')];logger[_0x3964('0x42')](_0x3964('0x9e'),_0x1fb401['uniqueid'],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0x45'),_0x53f111[_0x3964('0x2f')]);delete this[_0x3964('0x14')][_0x20f287['linkedid']];break;case _0x3964('0x9f'):_0x53f111[_0x3964('0xa0')]+=0x1;_0x1fb401[_0x3964('0xa1')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x5,'Busy');_0x1bf1c4=_0x53f111[_0x3964('0xa2')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami[_0x3964('0x28')]('custom:agentbusy',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xa3')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xa4'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'5',_0x53f111)[_0x3964('0x58')](function(_0x157117){_0x1c676d=_0x157117[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,'Global');rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xa5'));}else{if(_0x1fb401[_0x3964('0xa1')]>=_0x53f111[_0x3964('0xa6')]){rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xa4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1fb401,_0x3964('0xa1'),_0x53f111[_0x3964('0xa2')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401[_0x3964('0xa1')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countbusyretry':_0x1fb401[_0x3964('0xa1')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xaa'):_0x53f111[_0x3964('0xab')]+=0x1;_0x1fb401['countnoanswerretry']+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x3,_0x3964('0xac'));_0x1bf1c4=_0x53f111[_0x3964('0xad')];_0x51fe3d=_0x53f111['callAdditionalPhoneAfterMin'];var _0x541a8e=ut[_0x3964('0xae')](_0x1fb401,_0x53f111);ami['emit'](_0x3964('0xaf'),_0x541a8e);rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logNoAnswer]');_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'3',_0x53f111)[_0x3964('0x58')](function(_0x30f7d4){_0x1c676d=_0x30f7d4['additional']==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,'Global');rpcDb[_0x3964('0x6c')](_0x52b179,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x1fb401[_0x3964('0xb0')]>=_0x53f111[_0x3964('0xb1')]){rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,_0x3964('0xb0'),_0x53f111[_0x3964('0xad')]),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xb3'):_0x53f111[_0x3964('0xb4')]+=0x1;_0x1fb401[_0x3964('0xb5')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x8,_0x3964('0xb6'));_0x1bf1c4=_0x53f111[_0x3964('0xb7')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami[_0x3964('0x28')]('custom:agentcongestion',ut[_0x3964('0x94')](_0x1fb401,'congestion'));rpcDb[_0x3964('0x68')](_0x1fb401,'[callProgressDetectingCustomer][logCongestion]');_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'8',_0x53f111)[_0x3964('0x58')](function(_0x22ba1d){_0x1c676d=_0x22ba1d[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut['totalGlobal'](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xb8'));}else{if(_0x1fb401['countcongestionretry']>=_0x53f111[_0x3964('0xb9')]){rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,_0x3964('0xb5'),_0x53f111[_0x3964('0xa2')]),_0x1fb401['unlockAgent'],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401['countcongestionretry']++;_0x52e5ee['incrementPreviewCounters']({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countcongestionretry':_0x1fb401[_0x3964('0xb5')]}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case _0x3964('0xba'):_0x53f111[_0x3964('0xbb')]+=0x1;_0x1fb401[_0x3964('0xbc')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x14,'AgentReject');_0x1bf1c4=_0x53f111[_0x3964('0xbd')];_0x51fe3d=_0x53f111[_0x3964('0x81')];ami['emit']('custom:agentreject',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xbe')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xbf'));_0x52e5ee['verifyAdditionalPhones'](_0x1fb401,'20',_0x53f111)[_0x3964('0x58')](function(_0x4098aa){_0x1c676d=_0x4098aa['additional']==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0x14,_0x3964('0xc0'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xc1'));}else{if(_0x1fb401[_0x3964('0xbc')]>=_0x53f111[_0x3964('0xc2')]){rpcDb[_0x3964('0x6c')](_0x1fb401,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3964('0x87')](ut[_0x3964('0xb2')](_0x1fb401,'countagentrejectretry',_0x53f111[_0x3964('0xbd')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401['activeContact']);}}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401['idContact'],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)['then'](function(){});});}});break;case'ABANDONED':_0x53f111[_0x3964('0xc3')]+=0x1;_0x1fb401[_0x3964('0xc4')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut['logCustomer'](_0x1fb401,0xb,_0x3964('0xc5'));rpcDb['createCustomerHistory'](_0x1fb401,_0x3964('0xc6'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'11',_0x53f111)['then'](function(_0x5b8815){_0x1c676d=_0x5b8815[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xc6'));}else{if(_0x1fb401[_0x3964('0xc7')]>=_0x53f111[_0x3964('0xc8')]){rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xc6'));}else{rpcDb[_0x3964('0x87')](ut['scheduledAt'](_0x1fb401,'countabandonedretry',_0x53f111[_0x3964('0xc9')]),_0x1fb401[_0x3964('0xa7')],_0x1fb401[_0x3964('0x88')]);}}}else{_0x1fb401[_0x3964('0xb0')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})[_0x3964('0x58')](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});break;case'18':_0x53f111['outboundUnknownCallsDay']+=0x1;_0x1fb401[_0x3964('0xca')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0x12,_0x20f287[_0x3964('0xcb')]||_0x20f287[_0x3964('0xcc')]);ami[_0x3964('0x28')](_0x3964('0xcd'),ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xce')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xcf'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'18',_0x53f111)[_0x3964('0x58')](function(_0x25b5fb){_0x1c676d=_0x25b5fb[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0x12,_0x3964('0x84'));rpcDb[_0x3964('0x6c')](_0x52b179,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x1fb401,_0x3964('0xcf'));}}else{_0x1fb401['countnoanswerretry']++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401['countnoanswerretry']}})[_0x3964('0x58')](function(){_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)['then'](function(){});});}});delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];break;case'19':_0x53f111[_0x3964('0xd0')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut['logCustomer'](_0x1fb401,0x13,_0x20f287[_0x3964('0xcb')]||_0x20f287[_0x3964('0xcc')]);ami[_0x3964('0x28')]('custom:amd',ut[_0x3964('0x94')](_0x1fb401,_0x3964('0xce')));rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xd1'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'18',_0x53f111)[_0x3964('0x58')](function(_0x376b84){_0x1c676d=_0x376b84[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut['cloneAction'](_0x1fb401,0xf,'Global');rpcDb[_0x3964('0x6c')](_0x52b179,_0x3964('0xd1'));}else{rpcDb['createCustomerFinal'](_0x1fb401,'[callProgressDetectingCustomer][machine]');}}else{_0x1fb401[_0x3964('0xb0')]++;_0x52e5ee[_0x3964('0xa8')]({'id':_0x1fb401[_0x3964('0x8b')],'field':{'countnoanswerretry':_0x1fb401[_0x3964('0xb0')]}})['then'](function(){_0x52e5ee['swapAdditionalPhones'](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});});}});delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];break;default:if(_0x1fb401[_0x3964('0x46')]){ut[_0x3964('0x51')](_0x53f111,_0x3964('0xd2'));ut[_0x3964('0x52')](_0x3964('0xd3')+_0x53f111['name'],_0x20f287);}_0x53f111[_0x3964('0xd0')]+=0x1;_0x1fb401[_0x3964('0x79')]=ut[_0x3964('0x7a')](_0x1fb401);ut[_0x3964('0x64')](_0x1fb401,0xc,_0x20f287[_0x3964('0xcb')]||_0x20f287['dialstatus']);_0x1bf1c4=_0x53f111[_0x3964('0xbd')];_0x51fe3d=_0x53f111[_0x3964('0x81')];rpcDb[_0x3964('0x68')](_0x1fb401,_0x3964('0xd4'));_0x52e5ee[_0x3964('0x7e')](_0x1fb401,'20',_0x53f111)[_0x3964('0x58')](function(_0x228ab7){_0x1c676d=_0x228ab7[_0x3964('0x7f')]==0x1;if(!_0x1c676d){if(ut[_0x3964('0x7a')](_0x1fb401)>=_0x53f111[_0x3964('0x82')]){_0x52b179=ut[_0x3964('0x83')](_0x1fb401,0xf,_0x3964('0x84'));rpcDb['createCustomerFinal'](_0x52b179,_0x3964('0xd5'));}else{rpcDb[_0x3964('0x6c')](_0x1fb401,_0x3964('0xd5'));}delete this[_0x3964('0x14')][_0x20f287['linkedid']];}else{_0x52e5ee[_0x3964('0xa9')](_0x1fb401,_0x1bf1c4,_0x51fe3d)[_0x3964('0x58')](function(){});}});}if(!(_0x1fb401['dialAnswer']&&_0x3b5f84==='16')){utils[_0x3964('0xd6')](_0x53f111,_0x3964('0xd7'));logger[_0x3964('0x42')](_0x3964('0xd8'),_0x1fb401[_0x3964('0x93')],_0x3964('0x8e'),_0x53f111[_0x3964('0x2b')],_0x3964('0xd9'),_0x53f111[_0x3964('0x2e')]);}if(_0x3b5f84!==_0x3964('0xda')){delete this[_0x3964('0x14')][_0x20f287[_0x3964('0x89')]];delete this[_0x3964('0x14')][_0x20f287[_0x3964('0xdb')]];}_0x53f111[_0x3964('0xdc')]=!![];}};Preview[_0x3964('0xd')][_0x3964('0xdd')]=function(_0xb346ba,_0x4f40a4,_0x23f437){if(_[_0x3964('0xde')](_0x4f40a4)&&_0x3964('0xdf')!==typeof _0x4f40a4){return;}if(_['isUndefined'](_0x23f437)&&'object'!==typeof _0x23f437){return;}switch(_0x23f437[_0x3964('0xe0')]){case'0':ut[_0x3964('0xe1')](_0xb346ba,0x0,_0x3964('0xe2'));rpcDb[_0x3964('0xe3')](_0xb346ba,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3964('0xe1')](_0xb346ba,0x3,_0x3964('0xac'));rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe4'));break;case'5':ut[_0x3964('0xe1')](_0xb346ba,0x5,_0x3964('0xe5'));rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe6'));break;case'8':ut['logAgent'](_0xb346ba,0x8,_0x3964('0xb6'));rpcDb[_0x3964('0xe3')](_0xb346ba,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0xb346ba,0x16,'AnswerAGI');rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe7'));break;default:ut[_0x3964('0xe1')](_0xb346ba,0xc,_0x23f437[_0x3964('0xe0')]);rpcDb[_0x3964('0xe3')](_0xb346ba,_0x3964('0xe8'));}utils[_0x3964('0xd6')](_0x4f40a4,_0x3964('0xe9'));logger[_0x3964('0x42')]('[originated][decrement][callProgressDetectingAgent]',_0xb346ba['uniqueid'],_0x3964('0x8e'),_0x4f40a4[_0x3964('0x2b')],_0x3964('0xd9'),_0x4f40a4[_0x3964('0x2e')]);delete this[_0x3964('0x14')][_0xb346ba['uniqueid']];};Preview[_0x3964('0xd')]['verifyAdditionalPhones']=function(_0x1cf4aa,_0x3a384e,_0x3e8be0){return cmHopperAdditionalPhone[_0x3964('0x7e')](_0x1cf4aa,_0x3a384e,_0x3e8be0)[_0x3964('0x4f')](logger[_0x3964('0x42')](_0x3964('0xea')));};Preview[_0x3964('0xd')][_0x3964('0xa9')]=function(_0x3be601,_0x308b68,_0x23a388){return cmHopperAdditionalPhone[_0x3964('0xa9')](_0x3be601,_0x308b68,_0x23a388)['catch'](logger[_0x3964('0x42')](_0x3964('0xeb')));};Preview[_0x3964('0xd')][_0x3964('0xa8')]=function(_0x143555){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x3964('0xa8')](_0x143555))[_0x3964('0x4f')](logger[_0x3964('0x42')](_0x3964('0xec')));};Preview[_0x3964('0xd')]['checkInBlack']=function(_0x49c93f,_0x37c83e,_0x47554a,_0x5479c5,_0x23f371){var _0x3110e6=this;return new Promise(function(_0x4409d1,_0x4aaf2d){if(_['isNil'](_0x37c83e)||_['isNil'](_0x37c83e[_0x3964('0xed')])||_[_0x3964('0x59')](_0x37c83e[_0x3964('0xee')])||_[_0x3964('0x59')](_0x37c83e['VoiceQueueId'])){_0x4aaf2d(ut[_0x3964('0x36')](_0x3964('0xef'),_0x5479c5,_0x23f371));return;}var _0x150d6f=uuid['v4']();var _0x318bef=_0x3110e6[_0x3964('0x12')][_0x37c83e['Queue'][_0x3964('0x2b')]];var _0xf6d4d8=_0x47554a?_0x3110e6[_0x3964('0x15')][_0x47554a]['id']:undefined;_0x3110e6[_0x3964('0x14')][_0x150d6f]=new Action(_0x37c83e,_0x318bef,_0x150d6f,_0x47554a,_0xf6d4d8);var _0x67560d=_0x3110e6['actions'][_0x150d6f];_0x67560d[_0x3964('0xa7')]=_0x5479c5;_0x67560d['activeContact']=_0x23f371;_0x67560d['lookAgent']=_0x47554a;if(_['isEmpty'](_0x49c93f)){_0x3110e6[_0x3964('0xf0')](_0x67560d,_0x318bef,_0x37c83e,_0x47554a)[_0x3964('0x58')](function(_0x5d0478){logger[_0x3964('0x42')](_0x3964('0xf1'),'Queue:\x20'+_0x67560d[_0x3964('0x44')]+'\x20IdHopper:\x20'+_0x67560d[_0x3964('0x8b')],JSON['stringify'](_0x5d0478));ami[_0x3964('0x28')](_0x3964('0xf2'),ut[_0x3964('0x94')](_0x67560d,_0x3964('0xf3'),_0x3110e6['campaignsPreview'][_0x67560d['queue']]));_0x4409d1(ut[_0x3964('0x36')](_0x3964('0xf4')));})[_0x3964('0x4f')](function(_0x56a950){ut[_0x3964('0x33')](_0x3964('0xf5'),_0x56a950);_0x4aaf2d(ut[_0x3964('0x36')](_0x3964('0xf6'),_0x5479c5,_0x23f371));});}else{_0x318bef[_0x3964('0xf7')]+=0x1;ut[_0x3964('0xf8')](_0x67560d);rpcDb[_0x3964('0xf9')](_0x67560d,_0x3964('0xfa'));delete _0x3110e6[_0x3964('0x14')][_0x150d6f];_0x4aaf2d(ut[_0x3964('0x36')]('Contact\x20in\x20black\x20List',_0x5479c5,_0x23f371));}});};Preview['prototype'][_0x3964('0x72')]=function(_0x4319c1){return!_[_0x3964('0x59')](_0x4319c1)&&!_[_0x3964('0x59')](_0x4319c1[_0x3964('0x2b')])&&!_[_0x3964('0x59')](_0x4319c1[_0x3964('0xfb')])&&_0x4319c1['active']&&!_['isNil'](this['trunks'][util['format'](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])])&&!_[_0x3964('0x59')](this[_0x3964('0x13')][util[_0x3964('0x2a')](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])]['status'])&&(this['trunks'][util[_0x3964('0x2a')](_0x3964('0xfc'),_0x4319c1[_0x3964('0x2b')])][_0x3964('0x4d')]===_0x3964('0xfd')||this[_0x3964('0x13')][util[_0x3964('0x2a')]('SIP/%s',_0x4319c1['name'])][_0x3964('0x4d')]===_0x3964('0xfe'));};Preview[_0x3964('0xd')][_0x3964('0x5e')]=function(_0x3925a2,_0x27690c){return this['execRun'](_0x3925a2,_0x27690c)['then'](function(_0x3f30cd){return _[_0x3964('0x47')](_0x3f30cd,[_0x3964('0x36')]);})[_0x3964('0x4f')](function(_0x33ed18){if(_0x33ed18[_0x3964('0xff')]){rpcDb[_0x3964('0x100')](_0x3925a2);}if(_0x33ed18['active']){rpcDb[_0x3964('0x60')](_0x3925a2);}throw _[_0x3964('0x47')](_0x33ed18,[_0x3964('0x36')]);});};Preview[_0x3964('0xd')][_0x3964('0x101')]=function(_0x280b65,_0x4c6b61){var _0x4b2b39=this;var _0x2d4dc2,_0x45b277;return rpcDb[_0x3964('0x102')](_0x280b65)[_0x3964('0x58')](function(_0x5d4835){if(!_[_0x3964('0x59')](_0x5d4835[0x0])){_0x45b277=_0x5d4835[0x0][_0x3964('0x103')]?![]:!![];_0x2d4dc2=_0x5d4835[0x0][_0x3964('0x103')]?!![]:![];_0x2d4dc2=_0x4c6b61?!![]:_0x2d4dc2;}var _0x5b55e1=_0x4b2b39[_0x3964('0x104')](_0x5d4835);if(_0x5b55e1[_0x3964('0x105')]){rpcDb['checkIsBlackList'](_[_0x3964('0x47')](_0x5d4835[0x0],[_0x3964('0x4a'),_0x3964('0xee')]))[_0x3964('0x58')](function(_0x55255c){_0x4b2b39[_0x3964('0x106')](_0x55255c,_0x5d4835[0x0],_0x4c6b61,_0x45b277,_0x2d4dc2)[_0x3964('0x58')](function(_0x5bfe08){return _0x5bfe08;})['catch'](function(_0x590e1a){throw _0x590e1a;});})[_0x3964('0x4f')](function(_0xe31e3e){ut[_0x3964('0x33')](_0x3964('0x107'),_0xe31e3e);throw ut[_0x3964('0x36')](_0x3964('0x108'),_0x45b277,_0x2d4dc2);});}else{throw ut['message'](_0x5b55e1[_0x3964('0x36')],_0x45b277,_0x2d4dc2);}})[_0x3964('0x4f')](function(_0x2e4462){ut['logger'](_0x3964('0x109'),_0x2e4462);throw ut[_0x3964('0x36')](_0x3964('0x108'),![],!![]);});};Preview[_0x3964('0xd')][_0x3964('0x104')]=function(_0x223654){if(_[_0x3964('0x59')](_0x223654)||_[_0x3964('0x10a')](_0x223654)||!_[_0x3964('0x59')](_0x223654[0x0]['Agent'])&&_[_0x3964('0x59')](_0x223654[0x0][_0x3964('0x5d')]['name'])){ut['logger'](_0x3964('0x10b'),_0x223654);return{'isValid':![],'message':_0x3964('0x10c')};}var _0x56b0fc=this['campaignsPreview'][_0x223654[0x0][_0x3964('0x10d')][_0x3964('0x2b')]];_0x56b0fc[_0x3964('0x36')]=utils[_0x3964('0x32')]['ACTIVE'];if(_[_0x3964('0x59')](_0x56b0fc)){ut[_0x3964('0x33')](_0x3964('0x10e'),_0x56b0fc);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x56b0fc[_0x3964('0x73')])){ut[_0x3964('0x33')](_0x3964('0x10f'),_0x3964('0x110')+_0x56b0fc[_0x3964('0x2b')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3964('0x72')](_0x56b0fc[_0x3964('0x74')])){ut[_0x3964('0x33')](_0x3964('0x10f'),_0x56b0fc['name']+_0x3964('0x111'));return{'isValid':![],'message':_0x3964('0x112')};}}if(!ut[_0x3964('0x70')](_0x56b0fc[_0x3964('0x3e')])){ut[_0x3964('0x33')](_0x3964('0x113'),_0x56b0fc['name']+_0x3964('0x114'));return{'isValid':![],'message':_0x3964('0x110')+_0x56b0fc['name']+_0x3964('0x114')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x3964('0xd')][_0x3964('0xf0')]=function(_0x3834b2,_0x382999,_0x1833ee,_0x58d881){var _0xcecd44=this;return new Promise(function(_0x515b0c,_0x33454f){var _0x1ff45a=_0x3834b2[_0x3964('0x93')];var _0x4defd7=_0xcecd44[_0x3964('0x72')](_0x382999[_0x3964('0x73')])?util['format'](_0x3964('0x115'),_0x382999[_0x3964('0x73')]['name'],_[_0x3964('0x59')](_0x382999[_0x3964('0x116')])?'':_0x382999['dialPrefix'][_0x3964('0x117')]()||'',_0x382999['dialCutDigit']>0x0?_0x1833ee[_0x3964('0xee')]['substring'](_0x382999[_0x3964('0x118')]):_0x1833ee[_0x3964('0xee')]):util[_0x3964('0x2a')](_0x3964('0x115'),_[_0x3964('0x59')](_0x382999['TrunkBackup'])?_0x382999['Trunk'][_0x3964('0x2b')]:_0x382999['TrunkBackup'][_0x3964('0x2b')],_['isNil'](_0x382999['dialPrefix'])?'':_0x382999['dialPrefix'][_0x3964('0x117')]()||'',_0x382999[_0x3964('0x118')]>0x0?_0x1833ee['phone'][_0x3964('0x119')](_0x382999[_0x3964('0x118')]):_0x1833ee['phone']);var _0x5dfafc=_0xcecd44[_0x3964('0x72')](_0x382999[_0x3964('0x73')])?ut[_0x3964('0x11a')](_0x382999['Trunk'][_0x3964('0x11b')],_0x382999[_0x3964('0x11c')],_0x382999[_0x3964('0x11d')]>0x0?ut[_0x3964('0x11e')](_0x382999[_0x3964('0x11f')],_0x382999['dialRandomLastDigitCallerIdNumber']):_0x382999['dialOriginateCallerIdNumber']):ut[_0x3964('0x11a')](_['isNil'](_0x382999[_0x3964('0x74')])?_0x382999[_0x3964('0x73')][_0x3964('0x11b')]:_0x382999[_0x3964('0x74')][_0x3964('0x11b')],_0x382999['dialOriginateCallerIdName'],_0x382999[_0x3964('0x11d')]>0x0?ut['getCallerIdRandom'](_0x382999[_0x3964('0x11f')],_0x382999[_0x3964('0x11d')]):_0x382999[_0x3964('0x11f')]);if(_0x5dfafc){_0x3834b2['originatecalleridname']=ut['extractCalleridName'](_0x5dfafc);_0x3834b2[_0x3964('0x120')]=ut[_0x3964('0x121')](_0x5dfafc);}var _0x2c2c0a=ut[_0x3964('0x122')](_0x382999,_0x1833ee,_0x4defd7,_0x5dfafc,_0x1ff45a,_0x3834b2);var _0x565d90=utils[_0x3964('0x123')](_0x1833ee[_0x3964('0xed')]);Object[_0x3964('0x124')](_0x2c2c0a,_0x565d90);_[_0x3964('0x125')](_0x3834b2,ut['toLowerVariables'](_0x2c2c0a));_0x3834b2['starttime']=moment()[_0x3964('0x2a')](_0x3964('0x62'));_0x382999[_0x3964('0x126')]=_0x2c2c0a;var _0x30d86e=ut['variablesAction'](_0x3834b2,_0x382999,_0x2c2c0a,_0x3834b2[_0x3964('0x88')],_0x58d881);return ami['Action'](_0x30d86e)[_0x3964('0x58')](function(_0x426f1f){_0x382999[_0x3964('0x2e')]+=0x1;logger[_0x3964('0x42')](_0x3964('0x127'),_0x1ff45a,_0x3964('0x8e'),_0x382999[_0x3964('0x2b')],_0x3964('0xd9'),_0x382999[_0x3964('0x2e')]);_0x515b0c(_0x426f1f);})[_0x3964('0x4f')](function(_0xfb9193){ut[_0x3964('0xe1')](_0x3834b2,0xe,_0x3964('0x128'));rpcDb['createAgentHistory'](_0x3834b2,_0x3964('0x129'));_0x33454f(_0xfb9193);});});};Preview['prototype'][_0x3964('0x20')]=function(_0x5e19f0){if(this[_0x3964('0x14')][_0x5e19f0[_0x3964('0x89')]]){this[_0x3964('0x14')][_0x5e19f0[_0x3964('0x89')]]['channel']=_0x5e19f0[_0x3964('0x4e')];}};Preview[_0x3964('0xd')][_0x3964('0x18')]=function(_0x407f4e){var _0x118ebf=this;var _0x5ddc2b=this[_0x3964('0x14')][_0x407f4e[_0x3964('0x12a')]];if(_0x5ddc2b){if(_0x5ddc2b[_0x3964('0x12b')]&&this['agents'][_0x5ddc2b[_0x3964('0x12b')]]){ut['logLookAgent'](_0x5ddc2b,this[_0x3964('0x15')][_0x5ddc2b[_0x3964('0x12b')]][_0x3964('0x2b')],this[_0x3964('0x15')][_0x5ddc2b[_0x3964('0x12b')]]['id']);}var _0x2f6737=_[_0x3964('0x12c')](_0x5ddc2b);_0x2f6737[_0x3964('0x12d')]=moment()['format'](_0x3964('0x62'));var _0x5e665=_0x118ebf['campaignsPreview'][_0x5ddc2b[_0x3964('0x44')]];if(ut[_0x3964('0x12e')](_0x407f4e[_0x3964('0x12f')])){if(_0x5ddc2b[_0x3964('0xa7')]){rpcDb['unlockContact'](_0x5ddc2b['idContact']);}if(_0x5ddc2b[_0x3964('0x88')]){rpcDb[_0x3964('0x60')](_0x5ddc2b['idContact']);}ami[_0x3964('0x28')](_0x3964('0x130'),ut[_0x3964('0x94')](_0x5ddc2b,_0x3964('0x131'),this[_0x3964('0x12')][_0x5ddc2b[_0x3964('0x44')]]));this[_0x3964('0xdd')](_0x2f6737,_0x5e665,_0x407f4e);}else{_0x5ddc2b[_0x3964('0x61')]=moment()[_0x3964('0x2a')](_0x3964('0x62'));ut[_0x3964('0xe1')](_0x2f6737,0x4,'Answer');rpcDb[_0x3964('0xe3')](_0x2f6737,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3964('0xd')][_0x3964('0x1b')]=function(_0x1e8063){var _0x528ddb=this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]];var _0xf76852;if(_0x528ddb){_0xf76852=this[_0x3964('0x12')][_0x528ddb[_0x3964('0x44')]];logger[_0x3964('0x42')](_0x3964('0x132'),_0x1e8063[_0x3964('0x89')],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852[_0x3964('0x2f')]);}if(this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]]&&_0x1e8063[_0x3964('0x89')]!==_0x1e8063[_0x3964('0x93')]){if(_0x1e8063['cause']==='16'&&this['actions'][_0x1e8063[_0x3964('0x89')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063['cause']);}else if(this[_0x3964('0x14')][_0x1e8063['linkedid']][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x133'),_0x1e8063[_0x3964('0x89')],_0x1e8063['cause'],'\x20Queue',_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852[_0x3964('0x2f')]);this[_0x3964('0x76')](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')]);}}else if(_0x528ddb&&_[_0x3964('0x59')](_0x528ddb[_0x3964('0x135')])&&_0xf76852[_0x3964('0x136')]&&_0x1e8063[_0x3964('0x89')]===_0x1e8063[_0x3964('0x93')]&&_[_0x3964('0x59')](_0x1e8063[_0x3964('0xe0')])&&_0x1e8063[_0x3964('0x134')]==='16'&&_0x1e8063[_0x3964('0x137')]==='6'&&_[_0x3964('0xde')](_0x528ddb[_0x3964('0x138')])){if(_0x528ddb[_0x3964('0xa7')]){rpcDb[_0x3964('0x100')](_0x528ddb[_0x3964('0x8b')]);}if(_0x528ddb[_0x3964('0x88')]){rpcDb[_0x3964('0x60')](_0x528ddb[_0x3964('0x8b')]);}_0x1e8063[_0x3964('0xe0')]='22';this['callProgressDetectingAgent'](_0x528ddb,_0xf76852,_0x1e8063);}else if(_0x528ddb&&_0x528ddb[_0x3964('0x138')]){if(_0x1e8063[_0x3964('0x134')]==='16'&&this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x139'),_0x1e8063[_0x3964('0x89')],_0x1e8063['cause'],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],'pTalking:\x20',_0xf76852['pTalking']);this['callProgressDetectingCustomer'](_0x1e8063,_0x1e8063['linkedid'],_0x1e8063['cause']);}else if(this[_0x3964('0x14')][_0x1e8063[_0x3964('0x89')]][_0x3964('0x46')]){logger[_0x3964('0x42')](_0x3964('0x133'),_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')],_0x3964('0x8e'),_0xf76852[_0x3964('0x2b')],_0x3964('0x45'),_0xf76852[_0x3964('0x2f')]);this[_0x3964('0x76')](_0x1e8063,_0x1e8063[_0x3964('0x89')],_0x1e8063[_0x3964('0x134')]);}}};Preview[_0x3964('0xd')]['syncDialEnd']=function(_0x16ae3a){if(this[_0x3964('0x14')][_0x16ae3a[_0x3964('0xdb')]]&&_0x16ae3a['destlinkedid']!==_0x16ae3a['destuniqueid']){this[_0x3964('0x76')](_0x16ae3a,_0x16ae3a[_0x3964('0xdb')],_0x16ae3a[_0x3964('0xcc')]);}};Preview['prototype'][_0x3964('0x1d')]=function(_0xe7b123){if(this['actions'][_0xe7b123[_0x3964('0x89')]]&&_0xe7b123[_0x3964('0x89')]!==_0xe7b123[_0x3964('0x93')]&&!this['actions'][_0xe7b123['linkedid']][_0x3964('0x46')]){if(_0xe7b123[_0x3964('0x134')]==='1'){this[_0x3964('0x76')](_0xe7b123,_0xe7b123['linkedid'],_0xe7b123[_0x3964('0x134')]);}}};Preview[_0x3964('0xd')][_0x3964('0x13a')]=function(_0x4d6a5f,_0x29fc7c,_0x69d360){if(this['actions'][_0x4d6a5f]){if(_[_0x3964('0x59')](this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')])){this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')]={};}this[_0x3964('0x14')][_0x4d6a5f][_0x3964('0x126')][_0x29fc7c]=_0x69d360;}};Preview[_0x3964('0xd')]['syncVarSet']=function(_0x6fdeb6){try{if(!_[_0x3964('0x59')](_0x6fdeb6)){if(ut[_0x3964('0x13b')](_[_0x3964('0x13c')](_0x6fdeb6['variable'])[0x0])){this['addVariable'](_0x6fdeb6[_0x3964('0x93')],_[_0x3964('0x13c')](_0x6fdeb6[_0x3964('0x13d')])[0x0],_0x6fdeb6[_0x3964('0x13e')]);}}}catch(_0xab8dcc){logger[_0x3964('0x13f')]('[syncVarSet][Preview]',util['inspect'](_0xab8dcc,{'showHidden':![],'depth':null}));}};Preview[_0x3964('0xd')]['syncAttendedTransfer']=function(_0x115254){if(_0x115254){if(this[_0x3964('0x14')][_0x115254['transfertargetlinkedid']]){this[_0x3964('0x14')][_0x115254[_0x3964('0x140')]][_0x3964('0x138')]=!![];}}};Preview[_0x3964('0xd')]['syncBlindTransfer']=function(_0x4b9d99){if(_0x4b9d99){if(this[_0x3964('0x14')][_0x4b9d99[_0x3964('0x141')]]){this[_0x3964('0x14')][_0x4b9d99['transfererlinkedid']][_0x3964('0x138')]=!![];}}};module[_0x3964('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index fc12a40..56020f6 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 _0x89d6=['queue','queuecallerleaveAt','answertime','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','resolve','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','[createHistory]\x20','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname'];(function(_0xf35d37,_0x2881f4){var _0x400ea3=function(_0x1c0ee4){while(--_0x1c0ee4){_0xf35d37['push'](_0xf35d37['shift']());}};_0x400ea3(++_0x2881f4);}(_0x89d6,0x152));var _0x689d=function(_0x3e89d0,_0x160ccb){_0x3e89d0=_0x3e89d0-0x0;var _0x14d7c3=_0x89d6[_0x3e89d0];return _0x14d7c3;};'use strict';var util=require(_0x689d('0x0'));var BPromise=require(_0x689d('0x1'));var logger=require('../../../config/logger')(_0x689d('0x2'));var cmHopper=require(_0x689d('0x3'));var cmHopperHistory=require(_0x689d('0x4'));var cmHopperBlack=require(_0x689d('0x5'));var agentReportPreview=require(_0x689d('0x6'));var voiceQueueReport=require(_0x689d('0x7'));function loggerCatch(_0x859f26){return function(_0x4b3b39){logger[_0x689d('0x8')](_0x859f26,util['inspect'](_0x4b3b39,{'showHidden':![],'depth':null}));};}function create(_0x26ec5a){return cmHopperHistory[_0x689d('0x9')](_0x26ec5a)['catch'](loggerCatch(_0x689d('0xa')));}function createAgent(_0x38a182){return BPromise['resolve']()[_0x689d('0xb')](agentReportPreview[_0x689d('0x9')](_0x38a182))[_0x689d('0xc')](loggerCatch(_0x689d('0xa')));}function moveContact(_0x429ba2){return cmHopper[_0x689d('0xd')](_0x429ba2,!![])[_0x689d('0xc')](loggerCatch(_0x689d('0xe')));}exports[_0x689d('0xf')]=function(_0x181ca2){return cmHopperBlack[_0x689d('0xf')](_0x181ca2)[_0x689d('0xc')](loggerCatch(_0x689d('0x10')));};exports[_0x689d('0x11')]=function(_0x184b05){return BPromise['resolve']()[_0x689d('0xb')](cmHopper[_0x689d('0x11')](_0x184b05))['catch'](loggerCatch(_0x689d('0x12')));};exports[_0x689d('0x9')]=function(_0x2e4d1b,_0x1c7ee6){create(_0x2e4d1b)[_0x689d('0xc')](loggerCatch(_0x1c7ee6));moveContact(_0x2e4d1b)[_0x689d('0xc')](loggerCatch(_0x1c7ee6));};exports['createAgentHistory']=function(_0x17a368,_0x18f575){createAgent(_0x17a368)[_0x689d('0xc')](loggerCatch(_0x18f575));};exports[_0x689d('0x13')]=function(_0x2e5de4,_0x1152b4){create(_0x2e5de4)['catch'](loggerCatch(_0x1152b4));};exports[_0x689d('0x14')]=function(_0x2b9203,_0x5da77c){moveContact(_0x2b9203)[_0x689d('0xc')](loggerCatch(_0x5da77c));};exports['rescheduleContact']=function(_0x8eb4ea,_0x385086,_0x289249){if(_0x385086){_0x8eb4ea[_0x689d('0x15')]=null;}if(_0x289249){_0x8eb4ea[_0x689d('0x16')]=![];}return cmHopper['rescheduleContact'](_0x8eb4ea)[_0x689d('0xc')](loggerCatch(_0x689d('0x17')));};exports[_0x689d('0x18')]=function(_0x36a439){return cmHopper[_0x689d('0x18')](_0x36a439)[_0x689d('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x153b50){return cmHopper[_0x689d('0x19')]({'UserId':null},_0x153b50,0x1)[_0x689d('0xc')](loggerCatch(_0x689d('0x1a')));};exports[_0x689d('0x1b')]=function(_0x319663){return cmHopper['unlockContact']({'active':![]},_0x319663,0x1)[_0x689d('0xc')](loggerCatch(_0x689d('0x1c')));};exports['crateCustomerReportQueue']=function(_0x44b72a){var _0x3a4461={};_0x3a4461[_0x689d('0x1d')]=_0x44b72a[_0x689d('0x1d')];_0x3a4461[_0x689d('0x1e')]=_0x44b72a[_0x689d('0x1e')];_0x3a4461['calleridnum']=_0x44b72a[_0x689d('0x1f')];_0x3a4461[_0x689d('0x20')]=_0x44b72a['calleridname'];_0x3a4461[_0x689d('0x21')]=_0x44b72a[_0x689d('0x21')];_0x3a4461['queuecallerjoinAt']=_0x44b72a['answertime'];_0x3a4461[_0x689d('0x22')]=_0x44b72a[_0x689d('0x23')];_0x3a4461['queuecallercomplete']=0x1;_0x3a4461['queuecallercompleteAt']=_0x44b72a[_0x689d('0x24')];_0x3a4461['connectedlinename']=_0x44b72a[_0x689d('0x25')];_0x3a4461[_0x689d('0x26')]=_0x689d('0x27');_0x3a4461['exten']=_0x689d('0x28');_0x3a4461[_0x689d('0x29')]=0x0;_0x3a4461[_0x689d('0x2a')]=0x1;_0x3a4461[_0x689d('0x2b')]=_0x44b72a['membername'];_0x3a4461[_0x689d('0x2c')]=_0x689d('0x2d');return BPromise[_0x689d('0x2e')]()[_0x689d('0xb')](voiceQueueReport[_0x689d('0x2f')](_0x3a4461))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x689d('0x30')]=function(_0x1e5de2,_0x365a38){return BPromise[_0x689d('0x2e')]()['then'](cmHopper[_0x689d('0x30')](_0x1e5de2,_0x365a38))[_0x689d('0xc')](loggerCatch(_0x689d('0x31')));};exports[_0x689d('0x32')]=function(_0x18a4e2){return cmHopper[_0x689d('0x33')](_0x18a4e2,!![],!![])['catch'](loggerCatch(_0x689d('0x34')));}; \ No newline at end of file +var _0x2095=['createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','catch','[createHistory]\x20','resolve'];(function(_0x4571ce,_0xd51afc){var _0x4a9c6e=function(_0x1b8cc6){while(--_0x1b8cc6){_0x4571ce['push'](_0x4571ce['shift']());}};_0x4a9c6e(++_0xd51afc);}(_0x2095,0x1b6));var _0x5209=function(_0x3931d4,_0x18c56d){_0x3931d4=_0x3931d4-0x0;var _0x3cb411=_0x2095[_0x3931d4];return _0x3cb411;};'use strict';var util=require(_0x5209('0x0'));var BPromise=require(_0x5209('0x1'));var logger=require(_0x5209('0x2'))(_0x5209('0x3'));var cmHopper=require(_0x5209('0x4'));var cmHopperHistory=require(_0x5209('0x5'));var cmHopperBlack=require(_0x5209('0x6'));var agentReportPreview=require(_0x5209('0x7'));var voiceQueueReport=require(_0x5209('0x8'));function loggerCatch(_0x157979){return function(_0x5eb5f4){logger['error'](_0x157979,util['inspect'](_0x5eb5f4,{'showHidden':![],'depth':null}));};}function create(_0xf32cf0){return cmHopperHistory['createHistory'](_0xf32cf0)[_0x5209('0x9')](loggerCatch(_0x5209('0xa')));}function createAgent(_0x5b10ca){return BPromise[_0x5209('0xb')]()['then'](agentReportPreview[_0x5209('0xc')](_0x5b10ca))[_0x5209('0x9')](loggerCatch(_0x5209('0xa')));}function moveContact(_0x3e8d7f){return cmHopper['moveContactManagedDialer'](_0x3e8d7f,!![])['catch'](loggerCatch(_0x5209('0xd')));}exports[_0x5209('0xe')]=function(_0xafaccd){return cmHopperBlack['checkIsBlackList'](_0xafaccd)[_0x5209('0x9')](loggerCatch(_0x5209('0xf')));};exports['getContactPreview']=function(_0x4a9c3c){return BPromise[_0x5209('0xb')]()[_0x5209('0x10')](cmHopper['getContactPreview'](_0x4a9c3c))['catch'](loggerCatch(_0x5209('0x11')));};exports['createHistory']=function(_0x31c3ef,_0x21fb33){create(_0x31c3ef)['catch'](loggerCatch(_0x21fb33));moveContact(_0x31c3ef)['catch'](loggerCatch(_0x21fb33));};exports[_0x5209('0x12')]=function(_0x3acc9a,_0x2d3b5f){createAgent(_0x3acc9a)[_0x5209('0x9')](loggerCatch(_0x2d3b5f));};exports[_0x5209('0x13')]=function(_0xf4f10a,_0x31da9b){create(_0xf4f10a)[_0x5209('0x9')](loggerCatch(_0x31da9b));};exports['createCustomerFinal']=function(_0x11ca6c,_0x30562f){moveContact(_0x11ca6c)[_0x5209('0x9')](loggerCatch(_0x30562f));};exports['rescheduleContact']=function(_0x1edc52,_0x55555a,_0x358c9a){if(_0x55555a){_0x1edc52['UserId']=null;}if(_0x358c9a){_0x1edc52[_0x5209('0x14')]=![];}return cmHopper[_0x5209('0x15')](_0x1edc52)[_0x5209('0x9')](loggerCatch(_0x5209('0x16')));};exports['countReScheduled']=function(_0x592fac){return cmHopper[_0x5209('0x17')](_0x592fac)['catch'](loggerCatch(_0x5209('0x18')));};exports[_0x5209('0x19')]=function(_0x3c3982){return cmHopper['unlockContact']({'UserId':null},_0x3c3982,0x1)[_0x5209('0x9')](loggerCatch(_0x5209('0x1a')));};exports[_0x5209('0x1b')]=function(_0x2aff90){return cmHopper['unlockContact']({'active':![]},_0x2aff90,0x1)[_0x5209('0x9')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x63c49){var _0x189979={};_0x189979[_0x5209('0x1c')]=_0x63c49[_0x5209('0x1c')];_0x189979[_0x5209('0x1d')]=_0x63c49['uniqueid'];_0x189979[_0x5209('0x1e')]=_0x63c49[_0x5209('0x1e')];_0x189979[_0x5209('0x1f')]=_0x63c49[_0x5209('0x1f')];_0x189979[_0x5209('0x20')]=_0x63c49[_0x5209('0x20')];_0x189979[_0x5209('0x21')]=_0x63c49['answertime'];_0x189979[_0x5209('0x22')]=_0x63c49['answertime'];_0x189979['queuecallercomplete']=0x1;_0x189979[_0x5209('0x23')]=_0x63c49[_0x5209('0x24')];_0x189979[_0x5209('0x25')]=_0x63c49[_0x5209('0x26')];_0x189979[_0x5209('0x27')]='from-sip';_0x189979[_0x5209('0x28')]=_0x5209('0x29');_0x189979['holdtime']=0x0;_0x189979[_0x5209('0x2a')]=0x1;_0x189979[_0x5209('0x2b')]=_0x63c49[_0x5209('0x26')];_0x189979[_0x5209('0x2c')]=_0x5209('0x2d');return BPromise[_0x5209('0xb')]()[_0x5209('0x10')](voiceQueueReport[_0x5209('0x2e')](_0x189979))[_0x5209('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x5209('0x2f')]=function(_0xc557d4,_0x5761eb){return BPromise['resolve']()['then'](cmHopper[_0x5209('0x2f')](_0xc557d4,_0x5761eb))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x5209('0x30')]=function(_0x209f95){return cmHopper[_0x5209('0x15')](_0x209f95,!![],!![])[_0x5209('0x9')](loggerCatch(_0x5209('0x31')));}; \ 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 850bb0f..cfe4ab9 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 _0x405c=['\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','error','inspect','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','timeout','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','ListId','VoiceQueueId','decrementTalking','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','isNil','status','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom'];(function(_0x32ab1c,_0x4f9816){var _0x4590a3=function(_0x452206){while(--_0x452206){_0x32ab1c['push'](_0x32ab1c['shift']());}};_0x4590a3(++_0x4f9816);}(_0x405c,0x98));var _0xc405=function(_0x3f2225,_0x370e02){_0x3f2225=_0x3f2225-0x0;var _0x3b311c=_0x405c[_0x3f2225];return _0x3b311c;};'use strict';var util=require('util');var _=require(_0xc405('0x0'));var moment=require(_0xc405('0x1'));var logger=require(_0xc405('0x2'))('preview');var ipAgi=process[_0xc405('0x3')][_0xc405('0x4')]||'127.0.0.1';var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x53957f){return function(_0x4d7e20){logger[_0xc405('0x5')](_0x53957f,util[_0xc405('0x6')](_0x4d7e20,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5de785,_0x44a2e2){logger[_0xc405('0x7')](_0x5de785,util[_0xc405('0x6')](_0x44a2e2,{'showHidden':![],'depth':null}));};exports[_0xc405('0x8')]=function(_0x499a37,_0x190d50){logger['error'](_0x499a37,util['inspect'](_0x190d50,{'showHidden':![],'depth':null}));};exports[_0xc405('0x9')]=function(_0x141d5a){return function(_0xbd0a33){logger[_0xc405('0x7')](_0x141d5a,util['inspect'](_0xbd0a33,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x348846,_0xd5a0d5,_0x1b0cdf){return{'message':_0x348846,'unlock':_0xd5a0d5,'active':_0x1b0cdf};};exports[_0xc405('0xa')]=function(_0x491b4e,_0x18e690,_0x4eb24c){if(!_[_0xc405('0xb')](_0x4eb24c)&&_0xc405('0xc')===typeof _0x4eb24c&&!_[_0xc405('0xd')](_0x4eb24c)){if(!_[_0xc405('0xb')](_0x18e690)&&'string'===typeof _0x18e690&&!_['isEmpty'](_0x18e690)){return util[_0xc405('0xe')](_0xc405('0xf'),_0x18e690,_0x4eb24c);}return util['format'](_0xc405('0xf'),_0x4eb24c,_0x4eb24c);}if(!_['isUndefined'](_0x491b4e)&&_0xc405('0xc')===typeof _0x491b4e&&!_[_0xc405('0xd')](_0x491b4e)){return _0x491b4e;}return _0xc405('0x10');};exports[_0xc405('0x11')]=function(_0x5aa73a){if(_['isNil'](_0x5aa73a)){return![];}return _0x5aa73a;};exports[_0xc405('0x12')]=function(_0x26f221,_0x29df29,_0x39a915,_0x6b5e3b,_0x164213,_0x94d275){var _0x40728f={'XMD-QUEUE':_0x29df29[_0xc405('0x13')]?_0x29df29[_0xc405('0x13')][_0xc405('0x14')]:'','XMD-CALLERID':_0x6b5e3b,'XMD-CALLERID-PREVIEW':_0x94d275?util[_0xc405('0xe')]('\x22%s\x22\x20<%s>',_0x94d275[_0xc405('0x15')],_0x94d275[_0xc405('0x16')]):_0x6b5e3b,'XMD-DIALID':_0x164213,'XMD-CONTACTID':_0x29df29[_0xc405('0x17')],'XMD-CDRTYPE':_0xc405('0x18'),'CALLERID(all)':_0x6b5e3b,'XMD-VOICEQUEUEID':_0x29df29['VoiceQueueId'],'XMD-DIALCHANNEL':_0x39a915,'XMD-DIALTIMEOUT':_0x26f221[_0xc405('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xc405('0xe')](_0xc405('0x1a'),_0x26f221[_0xc405('0x1b')]?'g':'',_[_0xc405('0xd')](_0x26f221[_0xc405('0x1c')])?'':_0xc405('0x1d')),'XMD-DIALURL':_0x26f221[_0xc405('0x1e')]||'','XMD-AGI':_0x26f221['dialQueueProject']?util[_0xc405('0xe')](_0xc405('0x1f'),ipAgi,_0x26f221[_0xc405('0x20')]):_0xc405('0x21'),'XMD-AGIAFTER':_0x26f221[_0xc405('0x1b')]?util['format'](_0xc405('0x1f'),ipAgi,_0x26f221[_0xc405('0x1b')]):_0xc405('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x94d275?_0x94d275[_0xc405('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x94d275?_0x94d275[_0xc405('0x23')]:'','XMD-DESTINATION':_0xc405('0x24'),'SIPADDHEADER':_0xc405('0x25')};if(!_[_0xc405('0xd')](_0x26f221[_0xc405('0x1c')])){_0x40728f[util[_0xc405('0xe')]('%s',_0xc405('0x26'))]=_0x26f221[_0xc405('0x1c')];_0x40728f[util[_0xc405('0xe')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x164213;}return _0x40728f;};exports[_0xc405('0x27')]=function(_0x50b203){var _0x405668={};for(var _0x3760bb in _0x50b203){if(_0x50b203[_0xc405('0x28')](_0x3760bb)){_0x405668[util[_0xc405('0xe')]('%s',_[_0xc405('0x29')](_0x3760bb))]=_0x50b203[_0x3760bb];}}return{'variables':_0x405668};};exports['logBlacklist']=function(_0x4b7774){var _0x4dcdf8=moment()[_0xc405('0xe')](_0xc405('0x2a'));_0x4b7774['state']=0xd;_0x4b7774[_0xc405('0x2b')]='Blacklist';_0x4b7774[_0xc405('0x2c')]=_0x4dcdf8;_0x4b7774[_0xc405('0x2d')]=_0x4dcdf8;_0x4b7774[_0xc405('0x2e')]=_0x4dcdf8;};exports[_0xc405('0x2f')]=function(_0x11d432,_0x888f85,_0x74a381){var _0x50a4ce=moment()[_0xc405('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x11d432[_0xc405('0x30')]=_0x888f85;_0x11d432[_0xc405('0x2b')]=_0x74a381;_0x11d432['responsetime']=_0x50a4ce;_0x11d432[_0xc405('0x31')]=utils[_0xc405('0x32')](_0x11d432[_0xc405('0x2d')],_0x11d432[_0xc405('0x2c')]);};exports[_0xc405('0x33')]=function(_0x4599fb,_0x5de205,_0x1a8e61){_0x4599fb['membername']=_0x5de205;_0x4599fb[_0xc405('0x34')]=_0x1a8e61;};exports[_0xc405('0x35')]=function(_0x7ba046,_0x429630,_0x218d4a){var _0x1e0233=moment()['format'](_0xc405('0x2a'));_0x7ba046[_0xc405('0x30')]=_0x429630;_0x7ba046[_0xc405('0x2b')]=_0x218d4a;_0x7ba046[_0xc405('0x2d')]=_0x7ba046[_0xc405('0x2d')]?_0x7ba046[_0xc405('0x2d')]:_0x1e0233;_0x7ba046[_0xc405('0x2e')]=_0x7ba046['endtime']?_0x7ba046[_0xc405('0x2e')]:_0x1e0233;_0x7ba046['ringtime']=utils[_0xc405('0x32')](_0x7ba046[_0xc405('0x2d')]||0x0,_0x7ba046[_0xc405('0x2c')]||0x0);_0x7ba046[_0xc405('0x36')]=_0x7ba046['answertime']?utils['getSeconds'](_0x7ba046[_0xc405('0x2e')],_0x7ba046[_0xc405('0x37')]):0x0;};exports[_0xc405('0x38')]=function(_0x4e9600){return _0x4e9600===_0xc405('0x39');};exports[_0xc405('0x3a')]=function(_0x496329,_0x4487cd,_0x164d3c,_0x3321c2,_0x3d73b3){var _0xc4a261=_0x3321c2?_0xc405('0x3b'):_0x496329[_0xc405('0x15')];_0xc4a261=_0x3d73b3?_0xc405('0x3c'):_0xc4a261;return{'actionid':_0x496329[_0xc405('0x3d')],'action':'originate','channel':_0x496329[_0xc405('0x3e')],'callerid':util[_0xc405('0xe')](_0xc405('0xf'),_0xc4a261,_0x496329[_0xc405('0x16')]),'Exten':_0xc405('0x24'),'Context':'from-sip','Priority':'1','variable':_0x164d3c,'timeout':(_0x4487cd[_0xc405('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x496329['uniqueid']};};exports[_0xc405('0x40')]=function(_0x5f1f16){return _0x5f1f16['countbusyretry']+_0x5f1f16[_0xc405('0x41')]+_0x5f1f16['countnoanswerretry']+_0x5f1f16[_0xc405('0x42')]+_0x5f1f16[_0xc405('0x43')];};exports['cloneAction']=function(_0x219225){var _0x59a09b=_[_0xc405('0x44')](_0x219225);_0x59a09b[_0xc405('0x30')]=0xf;_0x59a09b[_0xc405('0x2b')]=_0xc405('0x45');return _0x59a09b;};exports['scheduledAt']=function(_0x5d591b,_0x2639b8,_0x1ccaed){var _0x4ef3f4={};_0x4ef3f4[_0x2639b8]=_0x5d591b[_0x2639b8];_0x4ef3f4[_0xc405('0x46')]=![];_0x4ef3f4[_0xc405('0x47')]=moment()[_0xc405('0x48')](_0x1ccaed,'minutes')[_0xc405('0xe')](_0xc405('0x2a'));_0x4ef3f4[_0xc405('0x17')]=_0x5d591b[_0xc405('0x17')];_0x4ef3f4[_0xc405('0x49')]=_0x5d591b[_0xc405('0x49')];_0x4ef3f4[_0xc405('0x4a')]=_0x5d591b['VoiceQueueId']||undefined;return _0x4ef3f4;};exports[_0xc405('0x4b')]=function(_0x3b091d,_0x258606){if(!_['isNil'](_0x3b091d)){if(_0x3b091d[_0xc405('0x4c')]>0x0){_0x3b091d[_0xc405('0x4c')]-=0x1;}else{logger['info'](_0x258606,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc405('0x5')](_0x258606,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0xc405('0x4d')]=function(_0x473384){if(_0x473384<=0x0){return!![];}return![];};function buildObj(_0x5ba62a,_0x147d30,_0x2d823f){_0x5ba62a[_0xc405('0x4e')]=_0x147d30;_0x5ba62a[_0xc405('0x14')]=_0x5ba62a[_0xc405('0x4f')];_0x5ba62a[_0xc405('0x50')]=_0x5ba62a[_0xc405('0x3e')];_0x5ba62a[_0xc405('0x51')]=_0xc405('0x52');if(_0x2d823f){_0x5ba62a[_0xc405('0x53')]=_0x2d823f['mandatoryDisposition'];}return _0x5ba62a;}exports[_0xc405('0x54')]=buildObj;exports[_0xc405('0x55')]=function(_0xc20053){var _0x2aabe1=[];for(var _0x2662da in _0xc20053){if(_0xc20053['hasOwnProperty'](_0x2662da)){if(!_[_0xc405('0x56')](_0xc20053[_0x2662da])&&_0xc20053[_0x2662da][_0xc405('0x30')]==='not_inuse'&&_0xc20053[_0x2662da][_0xc405('0x57')]==='reachable'){_0x2aabe1[_0xc405('0x58')](_0xc20053[_0x2662da]['id']);}}}return _0x2aabe1;};exports[_0xc405('0x59')]=function(_0x20763f){var _0x329fe8=moment()[_0xc405('0x5a')](0x0);var _0x393a13=moment(_0x20763f)[_0xc405('0x5a')](0x0);return _0x329fe8[_0xc405('0x5b')](_0x393a13,_0xc405('0x5c'));};exports['createBody']=function(_0x3b26f5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b26f5[_0xc405('0x17')],'ListId':_0x3b26f5[_0xc405('0x49')],'VoiceQueueId':_0x3b26f5[_0xc405('0x4a')]||undefined,'CampaignId':_0x3b26f5[_0xc405('0x5d')]||undefined};};exports[_0xc405('0x5e')]=function(_0x1e97c3){if(_0x1e97c3==='uniqueid'||_0x1e97c3===_0xc405('0x5f')||_0x1e97c3===_0xc405('0x4f')||_0x1e97c3==='type'||_0x1e97c3===_0xc405('0x60')||_0x1e97c3===_0xc405('0x61')||_0x1e97c3===_0xc405('0x62')||_0x1e97c3===_0xc405('0x3e')||_0x1e97c3==='calleridname'||_0x1e97c3===_0xc405('0x46')||_0x1e97c3==='calleridnum'||_0x1e97c3==='scheduledat'||_0x1e97c3===_0xc405('0x63')||_0x1e97c3==='countcongestionretry'||_0x1e97c3==='countnoanswerretry'||_0x1e97c3===_0xc405('0x64')||_0x1e97c3===_0xc405('0x65')||_0x1e97c3===_0xc405('0x66')||_0x1e97c3===_0xc405('0x67')||_0x1e97c3===_0xc405('0x68')||_0x1e97c3===_0xc405('0x17')||_0x1e97c3==='ListId'||_0x1e97c3===_0xc405('0x34')||_0x1e97c3===_0xc405('0x4a')||_0x1e97c3===_0xc405('0x69')||_0x1e97c3===_0xc405('0x6a')||_0x1e97c3===_0xc405('0x6b')||_0x1e97c3===_0xc405('0x6c')||_0x1e97c3===_0xc405('0x6d')||_0x1e97c3==='xmd-dialurl'||_0x1e97c3===_0xc405('0x6e')||_0x1e97c3==='xmd-dialoptions'||_0x1e97c3===_0xc405('0x6f')||_0x1e97c3===_0xc405('0x70')||_0x1e97c3==='xmd-contactid'||_0x1e97c3===_0xc405('0x71')||_0x1e97c3==='xmd-callerid'||_0x1e97c3===_0xc405('0x72')||_0x1e97c3===_0xc405('0x73')||_0x1e97c3==='rtpaudioqos'||_0x1e97c3===_0xc405('0x74')||_0x1e97c3===_0xc405('0x75')||_0x1e97c3===_0xc405('0x76')||_0x1e97c3===_0xc405('0x77')||_0x1e97c3===_0xc405('0x78')||_0x1e97c3==='rtpaudioqosrtt'||_0x1e97c3===_0xc405('0x79')||_0x1e97c3==='rtpaudioqos'||_0x1e97c3===_0xc405('0x74')||_0x1e97c3===_0xc405('0x75')||_0x1e97c3==='rtpaudioqosjitterbridged'||_0x1e97c3===_0xc405('0x77')||_0x1e97c3===_0xc405('0x78')||_0x1e97c3===_0xc405('0x7a')||_0x1e97c3==='rtpaudioqosrttbridged'||_0x1e97c3===_0xc405('0x7b')||_0x1e97c3===_0xc405('0x7c')||_0x1e97c3===_0xc405('0x30')||_0x1e97c3==='statedesc'){return![];}return!![];};exports[_0xc405('0x7d')]=function(_0x2099d8,_0x292ccc){var _0x5b4c02,_0x3f5da1,_0x3c290b;if(_0x292ccc<=0x0){_0x292ccc=0x1;}_0x5b4c02=new RegExp(_0xc405('0x7e')+_0x292ccc+'}$');_0x3f5da1=Math[_0xc405('0x7f')](0xa,_0x292ccc-0x1);_0x3c290b=Math[_0xc405('0x7f')](0xa,_0x292ccc)-0x1;return util[_0xc405('0xe')]('%s',_[_0xc405('0x80')](_0x2099d8,_0x5b4c02,_[_0xc405('0x81')](_0x3f5da1,_0x3c290b)));};exports[_0xc405('0x82')]=function(_0x1d74c2){var _0x545e96=_0x1d74c2[_0xc405('0x83')](/"(.*?)"/);return _0x545e96?_0x545e96[0x1]:_0x1d74c2;};exports[_0xc405('0x84')]=function(_0x2af098){var _0x455717=_0x2af098[_0xc405('0x83')](/<(.*?)>/);return _0x455717?_0x455717[0x1]:_0x2af098;};function buildNoAnswerEventPayload(_0x3a2d94,_0x4e6a90){var _0xe1fba6=buildObj(_0x3a2d94,_0xc405('0x85'));if(!_['isEmpty'](_0x4e6a90[_0xc405('0x86')])){Object[_0xc405('0x87')](_0x4e6a90[_0xc405('0x86')])[_0xc405('0x88')](function(_0xecaf0){_0xe1fba6[_0xecaf0[_0xc405('0x89')]()]=_0x4e6a90[_0xc405('0x86')][_0xecaf0];});}return _0xe1fba6;}exports[_0xc405('0x8a')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9311=['motionChannel','voice','mandatoryDisposition','buildObj','not_inuse','status','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','campaigntype','calleridname','countcongestionretry','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','error','logger2','inspect','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','addVariables','Queue','name','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','logBlacklist','state','Blacklist','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface'];(function(_0x11c85a,_0x279df0){var _0x51dad4=function(_0x3cff2d){while(--_0x3cff2d){_0x11c85a['push'](_0x11c85a['shift']());}};_0x51dad4(++_0x279df0);}(_0x9311,0x1b7));var _0x1931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9311[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1931('0x0'));var _=require(_0x1931('0x1'));var moment=require(_0x1931('0x2'));var logger=require('../../../../config/logger')(_0x1931('0x3'));var ipAgi=process['env'][_0x1931('0x4')]||_0x1931('0x5');var utils=require(_0x1931('0x6'));exports[_0x1931('0x7')]=function(_0x47f618){return function(_0x16e047){logger['error'](_0x47f618,util['inspect'](_0x16e047,{'showHidden':![],'depth':null}));};};exports[_0x1931('0x8')]=function(_0x505c95,_0x64ca2d){logger[_0x1931('0x9')](_0x505c95,util['inspect'](_0x64ca2d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x200512,_0x4875b6){logger[_0x1931('0xa')](_0x200512,util['inspect'](_0x4875b6,{'showHidden':![],'depth':null}));};exports[_0x1931('0xb')]=function(_0x2edb3d){return function(_0x21a14f){logger[_0x1931('0x9')](_0x2edb3d,util[_0x1931('0xc')](_0x21a14f,{'showHidden':![],'depth':null}));};};exports[_0x1931('0xd')]=function(_0x3d7687,_0x12e945,_0x497bf4){return{'message':_0x3d7687,'unlock':_0x12e945,'active':_0x497bf4};};exports[_0x1931('0xe')]=function(_0x3ceabb,_0x10530e,_0x59b62e){if(!_[_0x1931('0xf')](_0x59b62e)&&_0x1931('0x10')===typeof _0x59b62e&&!_[_0x1931('0x11')](_0x59b62e)){if(!_['isUndefined'](_0x10530e)&&_0x1931('0x10')===typeof _0x10530e&&!_[_0x1931('0x11')](_0x10530e)){return util['format'](_0x1931('0x12'),_0x10530e,_0x59b62e);}return util[_0x1931('0x13')]('\x22%s\x22\x20<%s>',_0x59b62e,_0x59b62e);}if(!_[_0x1931('0xf')](_0x3ceabb)&&_0x1931('0x10')===typeof _0x3ceabb&&!_['isEmpty'](_0x3ceabb)){return _0x3ceabb;}return'\x22\x22\x20<>';};exports[_0x1931('0x14')]=function(_0x39d341){if(_['isNil'](_0x39d341)){return![];}return _0x39d341;};exports[_0x1931('0x15')]=function(_0x3c9e8c,_0x554b5e,_0x2ce25d,_0x1e3ff0,_0x536f71,_0x2605d1){var _0x380869={'XMD-QUEUE':_0x554b5e[_0x1931('0x16')]?_0x554b5e[_0x1931('0x16')][_0x1931('0x17')]:'','XMD-CALLERID':_0x1e3ff0,'XMD-CALLERID-PREVIEW':_0x2605d1?util[_0x1931('0x13')](_0x1931('0x12'),_0x2605d1['calleridname'],_0x2605d1['calleridnum']):_0x1e3ff0,'XMD-DIALID':_0x536f71,'XMD-CONTACTID':_0x554b5e['ContactId'],'XMD-CDRTYPE':_0x1931('0x18'),'CALLERID(all)':_0x1e3ff0,'XMD-VOICEQUEUEID':_0x554b5e[_0x1931('0x19')],'XMD-DIALCHANNEL':_0x2ce25d,'XMD-DIALTIMEOUT':_0x3c9e8c[_0x1931('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x1931('0x13')](_0x1931('0x1b'),_0x3c9e8c[_0x1931('0x1c')]?'g':'',_[_0x1931('0x11')](_0x3c9e8c[_0x1931('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3c9e8c[_0x1931('0x1e')]||'','XMD-AGI':_0x3c9e8c[_0x1931('0x1f')]?util[_0x1931('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c9e8c[_0x1931('0x1f')]):_0x1931('0x20'),'XMD-AGIAFTER':_0x3c9e8c['dialQueueProject2']?util[_0x1931('0x13')](_0x1931('0x21'),ipAgi,_0x3c9e8c[_0x1931('0x1c')]):_0x1931('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x2605d1?_0x2605d1[_0x1931('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2605d1?_0x2605d1['originatecalleridname']:'','XMD-DESTINATION':_0x1931('0x23'),'SIPADDHEADER':_0x1931('0x24')};if(!_[_0x1931('0x11')](_0x3c9e8c[_0x1931('0x1d')])){_0x380869[util[_0x1931('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3c9e8c['monitor_format'];_0x380869[util[_0x1931('0x13')]('%s',_0x1931('0x25'))]=_0x536f71;}return _0x380869;};exports[_0x1931('0x26')]=function(_0x38b642){var _0x273c45={};for(var _0x5dd116 in _0x38b642){if(_0x38b642[_0x1931('0x27')](_0x5dd116)){_0x273c45[util[_0x1931('0x13')]('%s',_['toLower'](_0x5dd116))]=_0x38b642[_0x5dd116];}}return{'variables':_0x273c45};};exports[_0x1931('0x28')]=function(_0x585502){var _0x123e82=moment()[_0x1931('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x585502[_0x1931('0x29')]=0xd;_0x585502['statedesc']=_0x1931('0x2a');_0x585502[_0x1931('0x2b')]=_0x123e82;_0x585502[_0x1931('0x2c')]=_0x123e82;_0x585502['endtime']=_0x123e82;};exports['logAgent']=function(_0x400d3d,_0x291b39,_0x1d33ac){var _0x953af8=moment()['format'](_0x1931('0x2d'));_0x400d3d[_0x1931('0x29')]=_0x291b39;_0x400d3d[_0x1931('0x2e')]=_0x1d33ac;_0x400d3d[_0x1931('0x2c')]=_0x953af8;_0x400d3d[_0x1931('0x2f')]=utils[_0x1931('0x30')](_0x400d3d[_0x1931('0x2c')],_0x400d3d[_0x1931('0x2b')]);};exports[_0x1931('0x31')]=function(_0x1e1e9c,_0xe282e4,_0xcc9849){_0x1e1e9c[_0x1931('0x32')]=_0xe282e4;_0x1e1e9c[_0x1931('0x33')]=_0xcc9849;};exports[_0x1931('0x34')]=function(_0x2c958e,_0x55855c,_0x5a354f){var _0x4fc927=moment()[_0x1931('0x13')](_0x1931('0x2d'));_0x2c958e[_0x1931('0x29')]=_0x55855c;_0x2c958e[_0x1931('0x2e')]=_0x5a354f;_0x2c958e[_0x1931('0x2c')]=_0x2c958e[_0x1931('0x2c')]?_0x2c958e[_0x1931('0x2c')]:_0x4fc927;_0x2c958e[_0x1931('0x35')]=_0x2c958e[_0x1931('0x35')]?_0x2c958e[_0x1931('0x35')]:_0x4fc927;_0x2c958e[_0x1931('0x2f')]=utils['getSeconds'](_0x2c958e[_0x1931('0x2c')]||0x0,_0x2c958e[_0x1931('0x2b')]||0x0);_0x2c958e[_0x1931('0x36')]=_0x2c958e[_0x1931('0x37')]?utils[_0x1931('0x30')](_0x2c958e[_0x1931('0x35')],_0x2c958e[_0x1931('0x37')]):0x0;};exports['isFailure']=function(_0x23f0bd){return _0x23f0bd==='Failure';};exports[_0x1931('0x38')]=function(_0x10cd2c,_0x2fd516,_0x528c83,_0x4a8bb5,_0x3c893f){var _0xaf7efb=_0x4a8bb5?_0x1931('0x39'):_0x10cd2c['calleridname'];_0xaf7efb=_0x3c893f?_0x1931('0x3a'):_0xaf7efb;return{'actionid':_0x10cd2c[_0x1931('0x3b')],'action':_0x1931('0x3c'),'channel':_0x10cd2c[_0x1931('0x3d')],'callerid':util['format'](_0x1931('0x12'),_0xaf7efb,_0x10cd2c[_0x1931('0x3e')]),'Exten':_0x1931('0x23'),'Context':'from-sip','Priority':'1','variable':_0x528c83,'timeout':(_0x2fd516[_0x1931('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10cd2c[_0x1931('0x3b')]};};exports['totalGlobal']=function(_0xf8275c){return _0xf8275c[_0x1931('0x40')]+_0xf8275c['countcongestionretry']+_0xf8275c[_0x1931('0x41')]+_0xf8275c[_0x1931('0x42')]+_0xf8275c[_0x1931('0x43')];};exports[_0x1931('0x44')]=function(_0x92ee98){var _0x6cf8d0=_['clone'](_0x92ee98);_0x6cf8d0[_0x1931('0x29')]=0xf;_0x6cf8d0[_0x1931('0x2e')]=_0x1931('0x45');return _0x6cf8d0;};exports['scheduledAt']=function(_0x33a79d,_0x436748,_0x3241d1){var _0x2f4b6b={};_0x2f4b6b[_0x436748]=_0x33a79d[_0x436748];_0x2f4b6b[_0x1931('0x46')]=![];_0x2f4b6b[_0x1931('0x47')]=moment()[_0x1931('0x48')](_0x3241d1,'minutes')[_0x1931('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f4b6b[_0x1931('0x49')]=_0x33a79d[_0x1931('0x49')];_0x2f4b6b[_0x1931('0x4a')]=_0x33a79d['ListId'];_0x2f4b6b['VoiceQueueId']=_0x33a79d[_0x1931('0x19')]||undefined;return _0x2f4b6b;};exports[_0x1931('0x4b')]=function(_0x37f82d,_0x480c87){if(!_['isNil'](_0x37f82d)){if(_0x37f82d[_0x1931('0x4c')]>0x0){_0x37f82d['pTalking']-=0x1;}else{logger[_0x1931('0x9')](_0x480c87,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x1931('0xa')](_0x480c87,_0x1931('0x4d'));}};exports[_0x1931('0x4e')]=function(_0xa91a85){if(_0xa91a85<=0x0){return!![];}return![];};function buildObj(_0xec657,_0xbdb4f4,_0x33839f){_0xec657['lastevent']=_0xbdb4f4;_0xec657[_0x1931('0x17')]=_0xec657[_0x1931('0x4f')];_0xec657[_0x1931('0x50')]=_0xec657[_0x1931('0x3d')];_0xec657[_0x1931('0x51')]=_0x1931('0x52');if(_0x33839f){_0xec657[_0x1931('0x53')]=_0x33839f[_0x1931('0x53')];}return _0xec657;}exports[_0x1931('0x54')]=buildObj;exports['agentReadyId']=function(_0x5aaab3){var _0x299792=[];for(var _0x143e48 in _0x5aaab3){if(_0x5aaab3[_0x1931('0x27')](_0x143e48)){if(!_['isNil'](_0x5aaab3[_0x143e48])&&_0x5aaab3[_0x143e48][_0x1931('0x29')]===_0x1931('0x55')&&_0x5aaab3[_0x143e48][_0x1931('0x56')]==='reachable'){_0x299792[_0x1931('0x57')](_0x5aaab3[_0x143e48]['id']);}}}return _0x299792;};exports[_0x1931('0x58')]=function(_0x200bf5){var _0x421d1c=moment()['milliseconds'](0x0);var _0x577e7f=moment(_0x200bf5)[_0x1931('0x59')](0x0);return _0x421d1c[_0x1931('0x5a')](_0x577e7f,_0x1931('0x5b'));};exports['createBody']=function(_0x1d3075){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1d3075['ContactId'],'ListId':_0x1d3075['ListId'],'VoiceQueueId':_0x1d3075[_0x1931('0x19')]||undefined,'CampaignId':_0x1d3075[_0x1931('0x5c')]||undefined};};exports[_0x1931('0x5d')]=function(_0x4e9baf){if(_0x4e9baf===_0x1931('0x3b')||_0x4e9baf===_0x1931('0x5e')||_0x4e9baf==='queue'||_0x4e9baf===_0x1931('0x5f')||_0x4e9baf===_0x1931('0x60')||_0x4e9baf==='dialAnswer'||_0x4e9baf==='membername'||_0x4e9baf===_0x1931('0x3d')||_0x4e9baf===_0x1931('0x61')||_0x4e9baf==='active'||_0x4e9baf===_0x1931('0x3e')||_0x4e9baf==='scheduledat'||_0x4e9baf===_0x1931('0x40')||_0x4e9baf===_0x1931('0x62')||_0x4e9baf==='countnoanswerretry'||_0x4e9baf==='countglobal'||_0x4e9baf===_0x1931('0x63')||_0x4e9baf===_0x1931('0x64')||_0x4e9baf===_0x1931('0x65')||_0x4e9baf==='recallme'||_0x4e9baf===_0x1931('0x49')||_0x4e9baf===_0x1931('0x4a')||_0x4e9baf===_0x1931('0x33')||_0x4e9baf===_0x1931('0x19')||_0x4e9baf===_0x1931('0x66')||_0x4e9baf===_0x1931('0x67')||_0x4e9baf===_0x1931('0x68')||_0x4e9baf===_0x1931('0x69')||_0x4e9baf===_0x1931('0x6a')||_0x4e9baf===_0x1931('0x6b')||_0x4e9baf==='xmd-dialtimeout'||_0x4e9baf===_0x1931('0x6c')||_0x4e9baf==='xmd-dialid'||_0x4e9baf===_0x1931('0x6d')||_0x4e9baf==='xmd-contactid'||_0x4e9baf===_0x1931('0x6e')||_0x4e9baf==='xmd-callerid'||_0x4e9baf===_0x1931('0x6f')||_0x4e9baf==='xmd-agi'||_0x4e9baf===_0x1931('0x70')||_0x4e9baf===_0x1931('0x71')||_0x4e9baf==='rtpaudioqosjitter'||_0x4e9baf==='rtpaudioqosjitterbridged'||_0x4e9baf===_0x1931('0x72')||_0x4e9baf==='rtpaudioqoslossbridged'||_0x4e9baf===_0x1931('0x73')||_0x4e9baf===_0x1931('0x74')||_0x4e9baf===_0x1931('0x70')||_0x4e9baf===_0x1931('0x71')||_0x4e9baf===_0x1931('0x75')||_0x4e9baf==='rtpaudioqosjitterbridged'||_0x4e9baf===_0x1931('0x72')||_0x4e9baf===_0x1931('0x76')||_0x4e9baf===_0x1931('0x73')||_0x4e9baf===_0x1931('0x74')||_0x4e9baf===_0x1931('0x77')||_0x4e9baf==='bridgepvtcallid'||_0x4e9baf===_0x1931('0x29')||_0x4e9baf==='statedesc'){return![];}return!![];};exports[_0x1931('0x78')]=function(_0x199528,_0x15ff5c){var _0x1974a8,_0x52427c,_0x2a8f8a;if(_0x15ff5c<=0x0){_0x15ff5c=0x1;}_0x1974a8=new RegExp('\x5cw{0,'+_0x15ff5c+'}$');_0x52427c=Math[_0x1931('0x79')](0xa,_0x15ff5c-0x1);_0x2a8f8a=Math[_0x1931('0x79')](0xa,_0x15ff5c)-0x1;return util[_0x1931('0x13')]('%s',_[_0x1931('0x7a')](_0x199528,_0x1974a8,_[_0x1931('0x7b')](_0x52427c,_0x2a8f8a)));};exports['extractCalleridName']=function(_0x48e34d){var _0x20b378=_0x48e34d[_0x1931('0x7c')](/"(.*?)"/);return _0x20b378?_0x20b378[0x1]:_0x48e34d;};exports[_0x1931('0x7d')]=function(_0x361cc3){var _0x2d8fee=_0x361cc3[_0x1931('0x7c')](/<(.*?)>/);return _0x2d8fee?_0x2d8fee[0x1]:_0x361cc3;};function buildNoAnswerEventPayload(_0x4d8445,_0x1e1aee){var _0x43ecb1=buildObj(_0x4d8445,'noanswer');if(!_[_0x1931('0x11')](_0x1e1aee[_0x1931('0x7e')])){Object[_0x1931('0x7f')](_0x1e1aee[_0x1931('0x7e')])['forEach'](function(_0x50cf37){_0x43ecb1[_0x50cf37[_0x1931('0x80')]()]=_0x1e1aee[_0x1931('0x7e')][_0x50cf37];});}return _0x43ecb1;}exports[_0x1931('0x81')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5a31a37..1de172e 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 _0x6bc9=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','boolean','voicequeuechannel'];(function(_0x26a6b7,_0x225fb5){var _0x32b39c=function(_0x23e357){while(--_0x23e357){_0x26a6b7['push'](_0x26a6b7['shift']());}};_0x32b39c(++_0x225fb5);}(_0x6bc9,0x99));var _0x96bc=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0x6bc9[_0xdad237];return _0x15c575;};'use strict';exports['queueadd']={'queue':{'type':_0x96bc('0x0'),'required':!![]},'interface':{'type':_0x96bc('0x0'),'required':!![]},'membername':{'type':_0x96bc('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x96bc('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x96bc('0x0'),'required':!![]},'paused':{'type':_0x96bc('0x1')},'reason':{'type':_0x96bc('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x96bc('0x0'),'required':![]}};exports[_0x96bc('0x2')]={'uniqueid':{'type':_0x96bc('0x0'),'required':!![]}};exports[_0x96bc('0x3')]={'uniqueid':{'type':_0x96bc('0x0'),'required':!![]},'filename':{'type':_0x96bc('0x0')},'format':{'type':_0x96bc('0x0')},'mixmonitorid':{'type':_0x96bc('0x0')}};exports[_0x96bc('0x4')]={'uniqueid':{'type':_0x96bc('0x0'),'required':!![]}};exports[_0x96bc('0x5')]={'uniqueid':{'type':_0x96bc('0x0'),'required':!![]},'exten':{'type':_0x96bc('0x0'),'required':!![]},'context':{'type':_0x96bc('0x0')}}; \ No newline at end of file +var _0x4cbe=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x4cbe,0xb7));var _0xe4cb=function(_0x4d0e8b,_0x25837e){_0x4d0e8b=_0x4d0e8b-0x0;var _0x1163d3=_0x4cbe[_0x4d0e8b];return _0x1163d3;};'use strict';exports[_0xe4cb('0x0')]={'queue':{'type':_0xe4cb('0x1'),'required':!![]},'interface':{'type':_0xe4cb('0x1'),'required':!![]},'membername':{'type':_0xe4cb('0x1'),'required':!![]},'penalty':{'type':_0xe4cb('0x2'),'required':![]},'paused':{'type':_0xe4cb('0x3'),'required':![]}};exports[_0xe4cb('0x4')]={'queue':{'type':_0xe4cb('0x1'),'required':!![]},'interface':{'type':_0xe4cb('0x1'),'required':!![]}};exports[_0xe4cb('0x5')]={'interface':{'type':_0xe4cb('0x1'),'required':!![]},'paused':{'type':_0xe4cb('0x3')},'reason':{'type':_0xe4cb('0x1'),'required':![]}};exports[_0xe4cb('0x6')]={'module':{'type':_0xe4cb('0x1'),'required':![]}};exports[_0xe4cb('0x7')]={'uniqueid':{'type':_0xe4cb('0x1'),'required':!![]}};exports[_0xe4cb('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xe4cb('0x1')},'mixmonitorid':{'type':_0xe4cb('0x1')}};exports[_0xe4cb('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe4cb('0xa')]={'uniqueid':{'type':_0xe4cb('0x1'),'required':!![]},'exten':{'type':_0xe4cb('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 5595ad0..f59bd93 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x2fcc8e,_0x31eeaa){var _0x2246e6=function(_0x2580ce){while(--_0x2580ce){_0x2fcc8e['push'](_0x2fcc8e['shift']());}};_0x2246e6(++_0x31eeaa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x494ac7,_0x45a5ed){var _0x18f656=function(_0x57905a){while(--_0x57905a){_0x494ac7['push'](_0x494ac7['shift']());}};_0x18f656(++_0x45a5ed);}(_0xadb5,0xad));var _0x5adb=function(_0x4e33d4,_0x26726b){_0x4e33d4=_0x4e33d4-0x0;var _0x16e4cb=_0xadb5[_0x4e33d4];return _0x16e4cb;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 3ecb785..199d545 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 _0xb3e2=['assign','hasOwnProperty'];(function(_0xa39bd4,_0x43722f){var _0x2f9945=function(_0x552e24){while(--_0x552e24){_0xa39bd4['push'](_0xa39bd4['shift']());}};_0x2f9945(++_0x43722f);}(_0xb3e2,0xc2));var _0x2b3e=function(_0x1e49b4,_0xbb2d8f){_0x1e49b4=_0x1e49b4-0x0;var _0xd44780=_0xb3e2[_0x1e49b4];return _0xd44780;};'use strict';function mergeDBDataToRealtime(_0x2f7d4e,_0x276b7d){var _0x240aa6=Object[_0x2b3e('0x0')]({},_0x2f7d4e);for(var _0x5ab343 in _0x276b7d){if(_0x240aa6[_0x2b3e('0x1')](_0x5ab343)){_0x240aa6[_0x5ab343]=_0x276b7d[_0x5ab343];}}return _0x240aa6;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x0260=['mergeDBDataToRealtime','assign'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0x0260,0x125));var _0x0026=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0260[_0x220f3f];return _0x1f170e;};'use strict';function mergeDBDataToRealtime(_0x18108e,_0x42004d){var _0x4c5404=Object[_0x0026('0x0')]({},_0x18108e);for(var _0x40e2b9 in _0x42004d){if(_0x4c5404['hasOwnProperty'](_0x40e2b9)){_0x4c5404[_0x40e2b9]=_0x42004d[_0x40e2b9];}}return _0x4c5404;}exports[_0x0026('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8f89137..3beeb4b 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 _0xff57=['custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','voiceQueueReport','connectedlinenum','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','length','channel','calleridnum','outbound','internal','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','bind','voiceCallReport'];(function(_0xec8901,_0x3b1da0){var _0x28abb5=function(_0x442427){while(--_0x442427){_0xec8901['push'](_0xec8901['shift']());}};_0x28abb5(++_0x3b1da0);}(_0xff57,0xf5));var _0x7ff5=function(_0x1dc82c,_0x4f43eb){_0x1dc82c=_0x1dc82c-0x0;var _0x39b34a=_0xff57[_0x1dc82c];return _0x39b34a;};'use strict';var _=require('lodash');var moment=require(_0x7ff5('0x0'));var util=require(_0x7ff5('0x1'));var config=require(_0x7ff5('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x7ff5('0x3'));var RpcVoiceCallReport=require(_0x7ff5('0x4'));var RpcVoiceDialReport=require(_0x7ff5('0x5'));var RpcMemberReport=require(_0x7ff5('0x6'));var RpcVoiceQueueReport=require(_0x7ff5('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x7ff5('0x8'));var VoiceCallReport=require(_0x7ff5('0x9'));var VoiceAgentReport=require(_0x7ff5('0xa'));var VoiceDialReport=require(_0x7ff5('0xb'));var UserReport=require(_0x7ff5('0xc'));function Report(_0x219cc0){this[_0x7ff5('0xd')]=_0x219cc0;this[_0x7ff5('0xe')]=_0x219cc0[_0x7ff5('0xe')];this[_0x7ff5('0xf')]=_0x219cc0[_0x7ff5('0xf')];}Report[_0x7ff5('0x10')]['sync']=function(_0x27a775){var _0x517a94=new VoiceQueueReport(this['realtime']);var _0x752c6b=new VoiceAgentReport(this['realtime']);var _0x5b6db5=new VoiceDialReport(this['realtime']);var _0x456de3=new VoiceCallReport(this[_0x7ff5('0xd')]);var _0x5cad0e=new UserReport(this[_0x7ff5('0xd')]);if(config[_0x7ff5('0x11')]&&config[_0x7ff5('0x11')][_0x7ff5('0x12')]){ami['on'](_0x7ff5('0x13'),this['voiceQueueReport'][_0x7ff5('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x7ff5('0x15')][_0x7ff5('0x14')](this));ami['on'](_0x7ff5('0x16'),this[_0x7ff5('0x17')]['bind'](this));ami['on'](_0x7ff5('0x18'),this[_0x7ff5('0x19')][_0x7ff5('0x14')](this));ami['on'](_0x7ff5('0x1a'),this[_0x7ff5('0x1b')]['bind'](this));ami['on'](_0x7ff5('0x1c'),this[_0x7ff5('0x1d')][_0x7ff5('0x14')](this));}};Report[_0x7ff5('0x10')][_0x7ff5('0x1e')]=function(_0x1f75f0){var _0x339755;_0x339755=_[_0x7ff5('0x1f')](this[_0x7ff5('0xe')],function(_0x1872c4){return _0x1872c4[_0x7ff5('0x20')]==_0x1f75f0||_0x1872c4[_0x7ff5('0x21')]==_0x1f75f0;});if(_[_0x7ff5('0x22')](_0x339755)){var _0x58a4d6=_[_0x7ff5('0x1f')](this[_0x7ff5('0xf')],function(_0xb3bc5a){return _0xb3bc5a['accountcode']==_0x1f75f0||_0xb3bc5a[_0x7ff5('0x21')]==_0x1f75f0;});if(_0x58a4d6){_0x339755=_[_0x7ff5('0x1f')](this['agents'],function(_0x418bb8){return _0x418bb8[_0x7ff5('0x23')]==util['format']('SIP/%s',_0x58a4d6[_0x7ff5('0x21')]);});}}return _0x339755;};Report[_0x7ff5('0x10')][_0x7ff5('0x24')]=function(_0xbbf602){for(var _0x535605=0x0;_0x535605<_0xbbf602['length'];_0x535605+=0x1){var _0x375a00=this[_0x7ff5('0x1e')](_0xbbf602[_0x535605][_0x7ff5('0x25')]);if(_0x375a00){_0xbbf602[_0x535605][_0x7ff5('0x20')]=_0x375a00[_0x7ff5('0x20')];_0xbbf602[_0x535605]['assigned']=!![];_0xbbf602[_0x535605]['lastAssignedTo']=_0x375a00[_0x7ff5('0x21')];_0xbbf602[_0x535605]['interface']=_[_0x7ff5('0x22')](_0x375a00[_0x7ff5('0x23')])?util[_0x7ff5('0x26')]('SIP/%s',_0x375a00[_0x7ff5('0x21')]):_0x375a00['interface'];if(_0xbbf602[_0x535605]['queuecallercomplete']){_0xbbf602[_0x535605][_0x7ff5('0x27')]=moment()[_0x7ff5('0x26')](_0x7ff5('0x28'));}if(_0xbbf602[_0x535605][_0x7ff5('0x29')]){_0xbbf602[_0x535605][_0x7ff5('0x2a')]=moment()['format'](_0x7ff5('0x28'));}RpcMemberReport[_0x7ff5('0x24')](_0xbbf602[_0x535605]);}RpcVoiceQueueReport[_0x7ff5('0x2b')](_0xbbf602[_0x535605]);}};function extractCalleridNumber(_0x528e3c){var _0x3abda9=_0x528e3c['match'](/<(.*?)>/);return _0x3abda9?_0x3abda9[0x1]:_0x528e3c;}Report[_0x7ff5('0x10')][_0x7ff5('0x2c')]=function(_0x5e66b5){for(var _0x522fac=0x0;_0x522fac','calleridname','transfers','linkedid','uniqueid','blindTransfer','type','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','exten','xcally-motion-dialer','isArray','forEach','voiceDialReport','Local','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','blindtransfer','attendedTransfer','findAgent','find','isNil','name','interface','format','accountcode','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit'];(function(_0xdfbc93,_0x31171b){var _0x24cdde=function(_0x515595){while(--_0x515595){_0xdfbc93['push'](_0xdfbc93['shift']());}};_0x24cdde(++_0x31171b);}(_0xf81e,0x1b3));var _0xef81=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf81e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xef81('0x0'));var moment=require('moment');var util=require(_0xef81('0x1'));var config=require(_0xef81('0x2'));var ami=require(_0xef81('0x3'));var RpcVoiceAgentReport=require(_0xef81('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xef81('0x5'));var RpcMemberReport=require(_0xef81('0x6'));var RpcVoiceQueueReport=require(_0xef81('0x7'));var RpcVoiceRecording=require(_0xef81('0x8'));var RpcVoiceTransferReport=require(_0xef81('0x9'));var VoiceQueueReport=require(_0xef81('0xa'));var VoiceCallReport=require(_0xef81('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xef81('0xc'));function Report(_0x491dc7){this['realtime']=_0x491dc7;this['agents']=_0x491dc7[_0xef81('0xd')];this[_0xef81('0xe')]=_0x491dc7[_0xef81('0xe')];}Report[_0xef81('0xf')][_0xef81('0x10')]=function(_0xd5793c){var _0x53db7c=new VoiceQueueReport(this[_0xef81('0x11')]);var _0x3a8b94=new VoiceAgentReport(this[_0xef81('0x11')]);var _0x75f3b9=new VoiceDialReport(this['realtime']);var _0x3fe40e=new VoiceCallReport(this[_0xef81('0x11')]);var _0x35d262=new UserReport(this['realtime']);if(config[_0xef81('0x12')]&&config[_0xef81('0x12')][_0xef81('0x13')]){ami['on'](_0xef81('0x14'),this[_0xef81('0x15')][_0xef81('0x16')](this));ami['on'](_0xef81('0x17'),this[_0xef81('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xef81('0x19')][_0xef81('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport']['bind'](this));ami['on'](_0xef81('0x1a'),this['blindTransfer'][_0xef81('0x16')](this));ami['on']('attendedtransfer',this[_0xef81('0x1b')][_0xef81('0x16')](this));}};Report['prototype'][_0xef81('0x1c')]=function(_0x5e6aaf){var _0x43a35f;_0x43a35f=_[_0xef81('0x1d')](this['agents'],function(_0x55854d){return _0x55854d['accountcode']==_0x5e6aaf||_0x55854d['name']==_0x5e6aaf;});if(_[_0xef81('0x1e')](_0x43a35f)){var _0x452ebd=_['find'](this[_0xef81('0xe')],function(_0x362cdc){return _0x362cdc['accountcode']==_0x5e6aaf||_0x362cdc[_0xef81('0x1f')]==_0x5e6aaf;});if(_0x452ebd){_0x43a35f=_[_0xef81('0x1d')](this[_0xef81('0xd')],function(_0xaee12f){return _0xaee12f[_0xef81('0x20')]==util[_0xef81('0x21')]('SIP/%s',_0x452ebd[_0xef81('0x1f')]);});}}return _0x43a35f;};Report[_0xef81('0xf')][_0xef81('0x15')]=function(_0x4377ac){for(var _0xbb9640=0x0;_0xbb9640<_0x4377ac['length'];_0xbb9640+=0x1){var _0x16c88c=this[_0xef81('0x1c')](_0x4377ac[_0xbb9640]['connectedlinenum']);if(_0x16c88c){_0x4377ac[_0xbb9640][_0xef81('0x22')]=_0x16c88c[_0xef81('0x22')];_0x4377ac[_0xbb9640]['assigned']=!![];_0x4377ac[_0xbb9640][_0xef81('0x23')]=_0x16c88c[_0xef81('0x1f')];_0x4377ac[_0xbb9640][_0xef81('0x20')]=_[_0xef81('0x1e')](_0x16c88c[_0xef81('0x20')])?util['format']('SIP/%s',_0x16c88c[_0xef81('0x1f')]):_0x16c88c[_0xef81('0x20')];if(_0x4377ac[_0xbb9640][_0xef81('0x24')]){_0x4377ac[_0xbb9640][_0xef81('0x25')]=moment()[_0xef81('0x21')](_0xef81('0x26'));}if(_0x4377ac[_0xbb9640][_0xef81('0x27')]){_0x4377ac[_0xbb9640][_0xef81('0x28')]=moment()[_0xef81('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xef81('0x15')](_0x4377ac[_0xbb9640]);}RpcVoiceQueueReport[_0xef81('0x29')](_0x4377ac[_0xbb9640]);}};function extractCalleridNumber(_0x29bc47){var _0x304aaf=_0x29bc47[_0xef81('0x2a')](/<(.*?)>/);return _0x304aaf?_0x304aaf[0x1]:_0x29bc47;}Report[_0xef81('0xf')]['getAgentByInternal']=function(_0x278637){for(var _0x11cb3e=0x0;_0x11cb3e{delete this[_0x85d4('0xb')][_0x157ee4];},_0x1a88f7);}};module[_0x85d4('0xa0')]=VoiceAgentReport; \ No newline at end of file +var _0x0f88=['event','privilege','emit','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:%s','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','rejected','user:agentringnoanswer','custom:agentringnoanswer','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceChannels','voiceQueues','agents','syncAgentCalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit'];(function(_0x2f2a6f,_0xe63e10){var _0x14441d=function(_0x3ab031){while(--_0x3ab031){_0x2f2a6f['push'](_0x2f2a6f['shift']());}};_0x14441d(++_0xe63e10);}(_0x0f88,0x6c));var _0x80f8=function(_0x13d2a5,_0x5016a4){_0x13d2a5=_0x13d2a5-0x0;var _0x437a87=_0x0f88[_0x13d2a5];return _0x437a87;};'use strict';var _=require(_0x80f8('0x0'));var moment=require(_0x80f8('0x1'));var util=require(_0x80f8('0x2'));var Redis=require('ioredis');var config=require(_0x80f8('0x3'));var logger=require(_0x80f8('0x4'))(_0x80f8('0x5'));var ami=require(_0x80f8('0x6'));config['redis']=_[_0x80f8('0x7')](config['redis'],{'host':_0x80f8('0x8'),'port':0x18eb});var io=require(_0x80f8('0x9'))(new Redis(config[_0x80f8('0xa')]));function VoiceAgentReport(_0x4e93cf){this[_0x80f8('0xb')]={};this[_0x80f8('0xc')]=_0x4e93cf['channels'];this[_0x80f8('0xd')]=_0x4e93cf[_0x80f8('0xd')];this[_0x80f8('0xe')]=_0x4e93cf[_0x80f8('0xe')];this['variables']={};ami['on']('agentcalled',this[_0x80f8('0xf')][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x11'),this[_0x80f8('0x12')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x13'),this['syncQueueCallerAbandon'][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x14'),this[_0x80f8('0x15')][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x16'),this[_0x80f8('0x17')]['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x80f8('0x18'),this[_0x80f8('0x19')]['bind'](this));ami['on'](_0x80f8('0x1a'),this['syncMusicOnHoldStop'][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x1b'),this[_0x80f8('0x1c')][_0x80f8('0x10')](this));ami['on'](_0x80f8('0x1d'),this[_0x80f8('0x1e')]['bind'](this));}VoiceAgentReport[_0x80f8('0x1f')]['emit']=function(_0x298671,_0x6d5ee0,_0x3d23e1){io['to'](_0x298671)['emit'](_0x6d5ee0,_0x3d23e1);};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x20')]=function(_0x562c48){return _0x562c48!==null&&!_[_0x80f8('0x21')](_0x562c48);};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0xf')]=function(_0xbd5054){try{if(this['isNotNull'](_0xbd5054)){logger['info'](_0x80f8('0x22'),_0xbd5054[_0x80f8('0x23')],_0xbd5054['membername'],_0xbd5054[_0x80f8('0x24')]);logger[_0x80f8('0x25')](_0x80f8('0x26'),_0xbd5054[_0x80f8('0x23')],util[_0x80f8('0x27')](_0xbd5054,{'showHidden':![],'depth':null}));if(_[_0x80f8('0x21')](this[_0x80f8('0xb')][_0xbd5054[_0x80f8('0x23')]])){this['channels'][_0xbd5054['uniqueid']]={};}var _0x5daaf2=this['agents'][_0xbd5054[_0x80f8('0x28')]];var _0x531f7b=this[_0x80f8('0xb')][_0xbd5054[_0x80f8('0x23')]][_0xbd5054[_0x80f8('0x24')]];var _0x410a3f=this[_0x80f8('0xd')][_0xbd5054[_0x80f8('0x29')]];var _0x3338e1=this[_0x80f8('0x2a')][_0xbd5054[_0x80f8('0x23')]];if(_['isUndefined'](_0x531f7b)){_0x531f7b={'agentcalledAt':moment()[_0x80f8('0x2b')](_0x80f8('0x2c')),'lastevent':_0x80f8('0x2d'),'mandatoryDisposition':_0x410a3f&&_0x410a3f[_0x80f8('0x2e')]?_0x410a3f[_0x80f8('0x2e')]:![],'type':_0x410a3f&&_0x410a3f['type']?_0x410a3f[_0x80f8('0x2f')]:_0x80f8('0x30'),'variables':_0x3338e1,'motionChannel':_0x80f8('0x31')};}Object[_0x80f8('0x32')](_0x531f7b,_[_0x80f8('0x33')](_0xbd5054,[_0x80f8('0x34'),_0x80f8('0x35')]));this[_0x80f8('0xb')][_0xbd5054['uniqueid']][_0xbd5054[_0x80f8('0x24')]]=_0x531f7b;logger[_0x80f8('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0xbd5054[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x531f7b,{'showHidden':![],'depth':null}));ami[_0x80f8('0x36')](_0x80f8('0x37'),_0x531f7b);var _0x5b2568={'id':_0x5daaf2['id'],'calleridnum':_0x531f7b[_0x80f8('0x38')],'queue':_0x531f7b[_0x80f8('0x29')],'variables':_0x531f7b[_0x80f8('0x2a')],'uniqueid':_0xbd5054['uniqueid']};logger[_0x80f8('0x25')](_0x80f8('0x39'),_0xbd5054[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x5b2568,{'showHidden':![],'depth':null}));this['emit'](util[_0x80f8('0x2b')]('user:%s',_0xbd5054[_0x80f8('0x3a')]),_0x80f8('0x3b'),_0x5b2568);}}catch(_0x5b64a1){logger[_0x80f8('0x3c')](_0x80f8('0x3d'),_0xbd5054[_0x80f8('0x23')],util['inspect'](_0x5b64a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x12')]=function(_0x3492d7){try{if(this['isNotNull'](_0x3492d7)){if(this['channels'][_0x3492d7['uniqueid']]){for(var _0x490922 in this['channels'][_0x3492d7[_0x80f8('0x23')]]){if(this['channels'][_0x3492d7[_0x80f8('0x23')]][_0x80f8('0x3e')](_0x490922)){if(_0x3492d7[_0x80f8('0x24')]===_0x490922){logger[_0x80f8('0x3f')](_0x80f8('0x40'),_0x3492d7['uniqueid'],_0x3492d7['membername'],_0x3492d7['destuniqueid']);this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922]['agentconnectAt']=moment()[_0x80f8('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x80f8('0xb')][_0x3492d7['uniqueid']][_0x490922][_0x80f8('0x41')]=_0x3492d7[_0x80f8('0x41')];this[_0x80f8('0xb')][_0x3492d7['uniqueid']][_0x490922][_0x80f8('0x42')]=_0x3492d7[_0x80f8('0x42')];this['channels'][_0x3492d7['uniqueid']][_0x490922][_0x80f8('0x43')]=_0x3492d7[_0x80f8('0x43')];this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922]['destchannelstatedesc']=_0x3492d7[_0x80f8('0x44')];this['channels'][_0x3492d7['uniqueid']][_0x490922][_0x80f8('0x45')]=_0x3492d7[_0x80f8('0x45')];this['channels'][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x46')]='connect';_[_0x80f8('0x47')](this[_0x80f8('0xe')][_0x3492d7[_0x80f8('0x28')]],_['pick'](_0x3492d7,[_0x80f8('0x29'),_0x80f8('0x48')]));var _0x31226c=this[_0x80f8('0xe')][_0x3492d7['interface']];var _0x32fa51={'id':_0x31226c['id'],'name':_0x31226c[_0x80f8('0x49')],'agentconnected':!![],'destaccountcode':_0x31226c[_0x80f8('0x4a')],'destconnectedlinenum':this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x3492d7[_0x80f8('0x24')]][_0x80f8('0x4b')],'queue':this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x3492d7[_0x80f8('0x24')]]['queue'],'uniqueid':this['channels'][_0x3492d7['uniqueid']][_0x3492d7[_0x80f8('0x24')]]['uniqueid']};ami['emit'](_0x80f8('0x4c'),this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x3492d7[_0x80f8('0x24')]]);this[_0x80f8('0x36')](util['format'](_0x80f8('0x4d'),_0x3492d7[_0x80f8('0x3a')]),'user:agentconnect',_0x32fa51);}else if(!this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x4e')]&&!this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x14')]){logger['info'](_0x80f8('0x4f'),_0x3492d7['uniqueid'],this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x3a')],_0x490922);this['channels'][_0x3492d7['uniqueid']][_0x490922]['agentringnoanswer']=!![];this[_0x80f8('0xb')][_0x3492d7['uniqueid']][_0x490922][_0x80f8('0x50')]=moment()['format'](_0x80f8('0x2c'));this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x51')]=_0x3492d7[_0x80f8('0x24')];this['channels'][_0x3492d7[_0x80f8('0x23')]][_0x490922][_0x80f8('0x52')]=_0x3492d7[_0x80f8('0x3a')];this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922]['lastevent']=_0x80f8('0x53');this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922]['reason']=_0x80f8('0x53');logger[_0x80f8('0x25')](_0x80f8('0x54'),_0x3492d7['uniqueid'],util[_0x80f8('0x27')](this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922],{'showHidden':![],'depth':null}));ami['emit'](_0x80f8('0x55'),this[_0x80f8('0xb')][_0x3492d7[_0x80f8('0x23')]][_0x490922]);}else{logger['debug'](_0x80f8('0x56'),_0x3492d7[_0x80f8('0x23')]);}}}}}}catch(_0x142b7f){logger[_0x80f8('0x3c')](_0x80f8('0x57'),_0x3492d7[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x142b7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')]['syncAgentRingNoAnswer']=function(_0xa47024){try{if(this[_0x80f8('0x20')](_0xa47024)){logger['debug'](_0x80f8('0x58'),_0xa47024[_0x80f8('0x23')],util[_0x80f8('0x27')](_0xa47024,{'showHidden':![],'depth':null}));if(this['channels'][_0xa47024['uniqueid']]&&this['channels'][_0xa47024[_0x80f8('0x23')]][_0xa47024['destuniqueid']]){logger[_0x80f8('0x3f')](_0x80f8('0x59'),_0xa47024[_0x80f8('0x23')],_0xa47024[_0x80f8('0x3a')],_0xa47024['destuniqueid']);var _0x4ef4f6=this['agents'][_0xa47024[_0x80f8('0x28')]];var _0x4d5c30=this[_0x80f8('0xb')][_0xa47024['uniqueid']][_0xa47024['destuniqueid']];_0x4d5c30['agentringnoanswer']=!![];_0x4d5c30[_0x80f8('0x50')]=moment()[_0x80f8('0x2b')](_0x80f8('0x2c'));_0x4d5c30[_0x80f8('0x46')]='rejected';_0x4d5c30[_0x80f8('0x5a')]=_0x80f8('0x5b');var _0xb0f70c={'id':_0x4ef4f6['id'],'name':_0x4ef4f6[_0x80f8('0x49')],'queue':_0x4d5c30['queue'],'uniqueid':_0x4d5c30[_0x80f8('0x23')]};logger[_0x80f8('0x25')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xa47024[_0x80f8('0x23')],util[_0x80f8('0x27')](_0xb0f70c,{'showHidden':![],'depth':null}));this[_0x80f8('0x36')](util[_0x80f8('0x2b')](_0x80f8('0x4d'),_0x4ef4f6['name']),_0x80f8('0x5c'),_0xb0f70c);ami[_0x80f8('0x36')](_0x80f8('0x5d'),_0x4d5c30);this[_0x80f8('0xb')][_0xa47024[_0x80f8('0x23')]][_0xa47024[_0x80f8('0x24')]]=Object[_0x80f8('0x32')]({},_0x4d5c30);}}}catch(_0x39d04a){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0xa47024[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x39d04a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x5e')]=function(_0x1b14e7){try{if(this['isNotNull'](_0x1b14e7)){logger[_0x80f8('0x25')](_0x80f8('0x5f'),_0x1b14e7['uniqueid'],util[_0x80f8('0x27')](_0x1b14e7,{'showHidden':![],'depth':null}));if(this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]]){for(var _0x5c1fe9 in this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]]){if(this['channels'][_0x1b14e7[_0x80f8('0x23')]][_0x80f8('0x3e')](_0x5c1fe9)&&!this['channels'][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9][_0x80f8('0x4e')]&&!this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9][_0x80f8('0x14')]){logger['info'](_0x80f8('0x60'),_0x1b14e7['uniqueid'],this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9][_0x80f8('0x3a')],_0x5c1fe9);this['channels'][_0x1b14e7['uniqueid']][_0x5c1fe9][_0x80f8('0x4e')]=!![];this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9][_0x80f8('0x50')]=moment()[_0x80f8('0x2b')](_0x80f8('0x2c'));this[_0x80f8('0xb')][_0x1b14e7['uniqueid']][_0x5c1fe9]['lastevent']=_0x80f8('0x61');this['channels'][_0x1b14e7['uniqueid']][_0x5c1fe9]['reason']=_0x80f8('0x61');logger[_0x80f8('0x25')](_0x80f8('0x62'),_0x1b14e7[_0x80f8('0x23')],util[_0x80f8('0x27')](this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x80f8('0xb')][_0x1b14e7[_0x80f8('0x23')]][_0x5c1fe9]);}}}}}catch(_0x523f1a){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x1b14e7[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x523f1a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x4c48b2){try{if(this[_0x80f8('0x20')](_0x4c48b2)){logger[_0x80f8('0x25')](_0x80f8('0x63'),_0x4c48b2['uniqueid'],util['inspect'](_0x4c48b2,{'showHidden':![],'depth':null}));if(this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]]){for(var _0x34289b in this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]]){if(this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x80f8('0x3e')](_0x34289b)){if(this['channels'][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x64')]&&!this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x14')]){logger[_0x80f8('0x3f')](_0x80f8('0x65'),_0x4c48b2[_0x80f8('0x23')],this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x3a')],_0x34289b);this['channels'][_0x4c48b2['uniqueid']][_0x34289b][_0x80f8('0x14')]=!![];this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x66')]=moment()[_0x80f8('0x2b')](_0x80f8('0x2c'));this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x46')]=_0x80f8('0x67');this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x5a')]=_0x4c48b2[_0x80f8('0x5a')]=='transfer'?_0x80f8('0x68'):_0x4c48b2[_0x80f8('0x5a')];this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b][_0x80f8('0x69')]=_0x4c48b2[_0x80f8('0x69')];if(this[_0x80f8('0xd')][_0x4c48b2[_0x80f8('0x29')]]&&this['voiceQueues'][_0x4c48b2[_0x80f8('0x29')]][_0x80f8('0x6a')]){this[_0x80f8('0xb')][_0x4c48b2[_0x80f8('0x23')]][_0x34289b]['acwtime']=this[_0x80f8('0xd')][_0x4c48b2[_0x80f8('0x29')]][_0x80f8('0x6b')];this[_0x80f8('0xb')][_0x4c48b2['uniqueid']][_0x34289b][_0x80f8('0x6c')]=!![];}this[_0x80f8('0xe')][_0x4c48b2[_0x80f8('0x28')]]=_[_0x80f8('0x33')](this[_0x80f8('0xe')][_0x4c48b2[_0x80f8('0x28')]],['queue',_0x80f8('0x48')]);logger['debug'](_0x80f8('0x6d'),_0x4c48b2[_0x80f8('0x23')],util[_0x80f8('0x27')](this['channels'][_0x4c48b2[_0x80f8('0x23')]][_0x34289b],{'showHidden':![],'depth':null}));ami[_0x80f8('0x36')](_0x80f8('0x6e'),this['channels'][_0x4c48b2[_0x80f8('0x23')]][_0x34289b]);logger[_0x80f8('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4c48b2[_0x80f8('0x23')],util[_0x80f8('0x27')]({'id':this[_0x80f8('0xe')][_0x4c48b2['interface']]['id'],'destaccountcode':_0x4c48b2['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x80f8('0x36')](util[_0x80f8('0x2b')]('user:%s',_0x4c48b2['membername']),_0x80f8('0x6f'),{'id':this[_0x80f8('0xe')][_0x4c48b2[_0x80f8('0x28')]]['id'],'destaccountcode':Number(_0x4c48b2[_0x80f8('0x70')])});}}}}}}catch(_0x252324){logger['error'](_0x80f8('0x71'),_0x4c48b2[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x252324,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x80f8('0x17')]=function(_0x30ef42){try{if(this[_0x80f8('0x20')](_0x30ef42)){logger[_0x80f8('0x25')](_0x80f8('0x72'),_0x30ef42['uniqueid'],util['inspect'](_0x30ef42,{'showHidden':![],'depth':null}));this[_0x80f8('0x73')](_0x30ef42['uniqueid'],_[_0x80f8('0x74')](_0x30ef42[_0x80f8('0x75')])[0x0],_0x30ef42['value']);if(this['channels'][_0x30ef42['uniqueid']]){for(var _0x4429e2 in this[_0x80f8('0xb')][_0x30ef42[_0x80f8('0x23')]]){if(this[_0x80f8('0xb')][_0x30ef42['uniqueid']]['hasOwnProperty'](_0x4429e2)){logger[_0x80f8('0x3f')](_0x80f8('0x76'),_0x30ef42[_0x80f8('0x23')],_0x4429e2,_['keys'](_0x30ef42[_0x80f8('0x75')])[0x0],_0x30ef42['value']);if(_['isUndefined'](this[_0x80f8('0xb')][_0x30ef42[_0x80f8('0x23')]][_0x4429e2][_0x80f8('0x2a')])){this['channels'][_0x30ef42[_0x80f8('0x23')]][_0x4429e2][_0x80f8('0x2a')]={};}this[_0x80f8('0xb')][_0x30ef42['uniqueid']][_0x4429e2][_0x80f8('0x2a')]=this[_0x80f8('0x2a')][_0x30ef42[_0x80f8('0x23')]];}}}}}catch(_0x1e30c1){logger[_0x80f8('0x3c')]('[%s][voiceAgentReport][varset]',_0x30ef42[_0x80f8('0x23')],util['inspect'](_0x1e30c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x73')]=function(_0x64e39e,_0x3b9081,_0x377562){var _0x431830=['rtpaudioqos',_0x80f8('0x77'),_0x80f8('0x78'),_0x80f8('0x79'),_0x80f8('0x7a'),'rtpaudioqoslossbridged',_0x80f8('0x7b'),'rtpaudioqosrttbridged',_0x80f8('0x7c'),_0x80f8('0x7d'),'bridgepeer',_0x80f8('0x7e'),'membercalls',_0x80f8('0x7f'),_0x80f8('0x80'),_0x80f8('0x81'),_0x80f8('0x3a'),_0x80f8('0x82'),_0x80f8('0x83')];if(!_['isNil'](_0x3b9081)&&!_[_0x80f8('0x84')](_0x431830,_0x3b9081)){if(_['isUndefined'](this[_0x80f8('0x2a')][_0x64e39e])){this[_0x80f8('0x2a')][_0x64e39e]={};}this[_0x80f8('0x2a')][_0x64e39e][_0x3b9081]=_0x377562;}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x85')]=function(_0x4f623f){try{if(this['isNotNull'](_0x4f623f)){logger['debug'](_0x80f8('0x86'),_0x4f623f[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x4f623f,{'showHidden':![],'depth':null}));if(this[_0x80f8('0xb')][_0x4f623f['uniqueid']]){for(var _0x2fd177 in this['channels'][_0x4f623f[_0x80f8('0x23')]]){if(this['channels'][_0x4f623f[_0x80f8('0x23')]]['hasOwnProperty'](_0x2fd177)){if(this[_0x80f8('0xb')][_0x4f623f[_0x80f8('0x23')]][_0x2fd177][_0x80f8('0x5a')]==_0x80f8('0x87')&&this['channels'][_0x4f623f[_0x80f8('0x23')]][_0x2fd177][_0x80f8('0x14')]){logger[_0x80f8('0x3f')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4f623f['uniqueid'],_0x2fd177);this[_0x80f8('0xb')][_0x4f623f[_0x80f8('0x23')]][_0x2fd177][_0x80f8('0x66')]=moment()[_0x80f8('0x2b')](_0x80f8('0x2c'));}}}logger['debug'](_0x80f8('0x88'),_0x4f623f[_0x80f8('0x23')],util[_0x80f8('0x27')](_[_0x80f8('0x89')](this[_0x80f8('0xb')][_0x4f623f['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x80f8('0x36')](_0x80f8('0x8a'),_[_0x80f8('0x89')](this[_0x80f8('0xb')][_0x4f623f[_0x80f8('0x23')]]));this[_0x80f8('0x8b')](_0x4f623f[_0x80f8('0x23')]);}if(this[_0x80f8('0x2a')][_0x4f623f[_0x80f8('0x23')]]){delete this[_0x80f8('0x2a')][_0x4f623f[_0x80f8('0x23')]];}}}catch(_0x5dfe97){logger[_0x80f8('0x3c')](_0x80f8('0x8c'),_0x4f623f[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x5dfe97,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x1c')]=function(_0x51d310){try{if(this['isNotNull'](_0x51d310)){logger[_0x80f8('0x25')](_0x80f8('0x8d'),_0x51d310[_0x80f8('0x23')],util[_0x80f8('0x27')](_0x51d310,{'showHidden':![],'depth':null}));if(this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]]){for(var _0x5470fb in this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]]){if(this[_0x80f8('0xb')][_0x51d310['transfereeuniqueid']][_0x80f8('0x3e')](_0x5470fb)){if(_0x51d310['origtransfereruniqueid']===_0x5470fb){logger[_0x80f8('0x3f')](_0x80f8('0x8f'),_0x51d310[_0x80f8('0x23')],this['channels'][_0x51d310[_0x80f8('0x8e')]][_0x5470fb]['membername'],_0x5470fb);var _0x28a593=moment();this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]][_0x5470fb][_0x80f8('0x14')]=!![];this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]][_0x5470fb][_0x80f8('0x66')]=moment()['format'](_0x80f8('0x2c'));this['channels'][_0x51d310[_0x80f8('0x8e')]][_0x5470fb]['lastevent']=_0x80f8('0x67');this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]][_0x5470fb]['reason']='transfer';this[_0x80f8('0xb')][_0x51d310['transfereeuniqueid']][_0x5470fb][_0x80f8('0x69')]=_0x28a593[_0x80f8('0x90')](this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]][_0x5470fb]['agentconnectAt'],_0x80f8('0x91'));}}}}if(this['channels'][_0x51d310['secondtransfereruniqueid']]){var _0x5a0b59=this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x92')]];this['channels'][_0x51d310[_0x80f8('0x92')]]=this[_0x80f8('0xb')][_0x51d310['transfereeuniqueid']];this[_0x80f8('0xb')][_0x51d310[_0x80f8('0x8e')]]=_0x5a0b59;}}}catch(_0x2f168e){logger[_0x80f8('0x3c')]('[%s][voiceAgentReport][attendedtransfer]',_0x51d310['uniqueid'],util[_0x80f8('0x27')](_0x2f168e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x1e')]=function(_0x56c0cf){try{if(this[_0x80f8('0x20')](_0x56c0cf)){logger[_0x80f8('0x25')](_0x80f8('0x93'),_0x56c0cf[_0x80f8('0x23')],util['inspect'](_0x56c0cf,{'showHidden':![],'depth':null}));if(this['channels'][_0x56c0cf[_0x80f8('0x8e')]]){for(var _0x279e03 in this[_0x80f8('0xb')][_0x56c0cf[_0x80f8('0x8e')]]){if(this['channels'][_0x56c0cf[_0x80f8('0x8e')]][_0x80f8('0x3e')](_0x279e03)){if(_0x56c0cf[_0x80f8('0x94')]===_0x279e03){logger[_0x80f8('0x3f')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x56c0cf[_0x80f8('0x23')],this[_0x80f8('0xb')][_0x56c0cf[_0x80f8('0x8e')]][_0x279e03][_0x80f8('0x3a')],_0x279e03);var _0x216e5f=moment();this[_0x80f8('0xb')][_0x56c0cf[_0x80f8('0x8e')]][_0x279e03][_0x80f8('0x14')]=!![];this['channels'][_0x56c0cf['transfereeuniqueid']][_0x279e03][_0x80f8('0x66')]=_0x216e5f;this['channels'][_0x56c0cf[_0x80f8('0x8e')]][_0x279e03][_0x80f8('0x46')]=_0x80f8('0x67');this[_0x80f8('0xb')][_0x56c0cf[_0x80f8('0x8e')]][_0x279e03]['reason']=_0x80f8('0x87');this['channels'][_0x56c0cf['transfereeuniqueid']][_0x279e03][_0x80f8('0x69')]=_0x216e5f[_0x80f8('0x90')](this[_0x80f8('0xb')][_0x56c0cf[_0x80f8('0x8e')]][_0x279e03][_0x80f8('0x64')],'seconds');}}}}}}catch(_0x36bdac){logger['error'](_0x80f8('0x95'),_0x56c0cf[_0x80f8('0x23')],util['inspect'](_0x36bdac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x19')]=function(_0x5e54e6){var _0xa269a9='';try{if(this[_0x80f8('0x20')](_0x5e54e6)){logger[_0x80f8('0x25')](_0x80f8('0x96'),_0x5e54e6['uniqueid'],util[_0x80f8('0x27')](_0x5e54e6,{'showHidden':![],'depth':null}));if(_0x5e54e6['channel']){_0xa269a9=_0x5e54e6[_0x80f8('0x97')][_0x80f8('0x98')](0x0,_0x5e54e6[_0x80f8('0x97')][_0x80f8('0x99')]('-'));if(this[_0x80f8('0xe')][_0xa269a9]){logger[_0x80f8('0x3f')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x5e54e6[_0x80f8('0x23')],_0xa269a9);this[_0x80f8('0xe')][_0xa269a9][_0x80f8('0x9a')]=!![];}}}}catch(_0x5107c1){logger[_0x80f8('0x3c')](_0x80f8('0x9b'),_0x5e54e6[_0x80f8('0x23')],util['inspect'](_0x5107c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x9c')]=function(_0x1d58a4){var _0x1fc584='';try{if(this[_0x80f8('0x20')](_0x1d58a4)){logger[_0x80f8('0x25')](_0x80f8('0x9d'),_0x1d58a4[_0x80f8('0x23')],util['inspect'](_0x1d58a4,{'showHidden':![],'depth':null}));if(_0x1d58a4['channel']){_0x1fc584=_0x1d58a4[_0x80f8('0x97')][_0x80f8('0x98')](0x0,_0x1d58a4[_0x80f8('0x97')][_0x80f8('0x99')]('-'));if(this[_0x80f8('0xe')][_0x1fc584]){logger[_0x80f8('0x3f')](_0x80f8('0x9e'),_0x1d58a4[_0x80f8('0x23')],_0x1fc584);this[_0x80f8('0xe')][_0x1fc584][_0x80f8('0x9a')]=![];}}}}catch(_0x2497c7){logger[_0x80f8('0x3c')](_0x80f8('0x9f'),_0x1d58a4[_0x80f8('0x23')],util['inspect'](_0x2497c7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x80f8('0x1f')][_0x80f8('0x8b')]=function(_0x1e895a,_0x132382=0x2710){if(this[_0x80f8('0xb')][_0x1e895a]){setTimeout(()=>{delete this[_0x80f8('0xb')][_0x1e895a];},_0x132382);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 878d7a7..da409a3 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 _0xf485=['destinationchannel','UserId','membername','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','length','transferType','then','transferToInternal','isEmpty','stopRecordingOnTransfer','resolve','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','extension','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','ioredis','../../../config/environment','ami','../ami','../model/channel','queue','agi','dial','playback','NO\x20ANSWER','BUSY','FAILED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','bind','newexten','newchannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','context','from-sip','channel','exten','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','syncNewExten','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','disposition','includes','lastapplication','lastdata','set','startsWith','cdr(','match','type','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','seconds','xcally-motion-preview'];(function(_0x144c30,_0x3d1e8b){var _0x193cd0=function(_0x2511c7){while(--_0x2511c7){_0x144c30['push'](_0x144c30['shift']());}};_0x193cd0(++_0x3d1e8b);}(_0xf485,0x122));var _0x5f48=function(_0xb5a49f,_0x1a5d63){_0xb5a49f=_0xb5a49f-0x0;var _0x7dcc3d=_0xf485[_0xb5a49f];return _0x7dcc3d;};'use strict';var _=require('lodash');var moment=require(_0x5f48('0x0'));var util=require('util');var path=require('path');var Redis=require(_0x5f48('0x1'));var config=require(_0x5f48('0x2'));var logger=require('../../../config/logger')(_0x5f48('0x3'));var ami=require(_0x5f48('0x4'));var Channel=require(_0x5f48('0x5'));var RpcSetting=require('../rpc/setting');var applications=['set',_0x5f48('0x6'),_0x5f48('0x7'),_0x5f48('0x8'),_0x5f48('0x9'),'voicemail'];var dispositions=[_0x5f48('0xa'),'FAILED','FAILED',_0x5f48('0xa'),_0x5f48('0xa'),'NO\x20ANSWER','ANSWERED',_0x5f48('0xb'),'FAILED',_0x5f48('0xc'),_0x5f48('0xc')];config[_0x5f48('0xd')]=_[_0x5f48('0xe')](config['redis'],{'host':_0x5f48('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f48('0xd')]));function VoiceCallReport(_0x5be6c6){this['channels']=_0x5be6c6[_0x5f48('0x10')];this['agents']=_0x5be6c6[_0x5f48('0x11')];this[_0x5f48('0x12')]={};ami['on'](_0x5f48('0x13'),this['syncNewExten'][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x15'),this['syncNewExten'][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x16'),this['syncNewChannel'][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x17'),this['syncNewState'][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x18'),this[_0x5f48('0x19')][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x1a'),this[_0x5f48('0x1b')][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x1c'),this[_0x5f48('0x1d')][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x1e'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x5f48('0x1f'),this[_0x5f48('0x20')][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x21'),this[_0x5f48('0x22')][_0x5f48('0x14')](this));ami['on'](_0x5f48('0x23'),this[_0x5f48('0x24')][_0x5f48('0x14')](this));try{logger[_0x5f48('0x25')](_0x5f48('0x26'));ami[_0x5f48('0x27')]();}catch(_0x2ec01f){logger[_0x5f48('0x28')]('[voiceCallReport][coreshowchannels]',util[_0x5f48('0x29')](_0x2ec01f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x2b')]=function(_0x3dbbbb){return _0x3dbbbb!==null&&!_[_0x5f48('0x2c')](_0x3dbbbb);};VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x2d')]=function(_0x407b6b,_0x15b871,_0x241157){io['to'](_0x407b6b)[_0x5f48('0x2d')](_0x15b871,_0x241157);};VoiceCallReport[_0x5f48('0x2a')]['syncNewCallerId']=function(_0x703552){try{if(this[_0x5f48('0x2b')](_0x703552)){logger[_0x5f48('0x25')](_0x5f48('0x2e'),_0x703552[_0x5f48('0x2f')],_0x703552[_0x5f48('0x30')],_0x703552[_0x5f48('0x31')]);logger[_0x5f48('0x32')](_0x5f48('0x33'),_0x703552[_0x5f48('0x2f')],util['inspect'](_0x703552,{'showHidden':![],'depth':null}));if(_0x703552[_0x5f48('0x2f')]===_0x703552[_0x5f48('0x34')]){if(!_['isUndefined'](this[_0x5f48('0x10')][_0x703552['uniqueid']])){_[_0x5f48('0x35')](this['channels'][_0x703552[_0x5f48('0x2f')]],_['pick'](_0x703552,_[_0x5f48('0x36')](this[_0x5f48('0x10')][_0x703552[_0x5f48('0x2f')]])));}}if(_0x703552[_0x5f48('0x37')]===_0x5f48('0x38')){var _0x5810b6=this[_0x5f48('0x11')][_0x703552[_0x5f48('0x39')]['split']('-')[0x0]];if(_0x5810b6){if(_0x703552[_0x5f48('0x3a')]=='xcally-motion-preview'){_0x5810b6[_0x5f48('0x3b')]=_0x703552[_0x5f48('0x3c')];this[_0x5f48('0x2d')](util['format'](_0x5f48('0x3d'),_0x5810b6[_0x5f48('0x3e')]),_0x5f48('0x3f'),{'id':_0x5810b6['id'],'destaccountcode':_0x5810b6[_0x5f48('0x40')],'destconnectedlinenum':_0x703552[_0x5f48('0x3c')]});}}}}}catch(_0x308f6b){logger['error'](_0x5f48('0x41'),_0x703552[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x308f6b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')]['syncNewChannel']=function(_0x21ef30){try{if(this[_0x5f48('0x2b')](_0x21ef30)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x21ef30[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x21ef30,{'showHidden':![],'depth':null}));if(this[_0x5f48('0x10')][_0x21ef30['uniqueid']]){return;}if(_0x21ef30[_0x5f48('0x39')]===_0x5f48('0x42')){return;}if(_0x21ef30[_0x5f48('0x2f')]!==_0x21ef30[_0x5f48('0x34')]&&!this['blindTransfers'][_0x21ef30[_0x5f48('0x34')]]){return;}logger[_0x5f48('0x25')](_0x5f48('0x43'),_0x21ef30['uniqueid'],_0x21ef30[_0x5f48('0x37')],_0x21ef30[_0x5f48('0x3a')]);this[_0x5f48('0x10')][_0x21ef30[_0x5f48('0x2f')]]=new Channel();this[_0x5f48('0x10')][_0x21ef30[_0x5f48('0x2f')]][_0x5f48('0x44')]=moment()[_0x5f48('0x45')](_0x5f48('0x46'));this['channels'][_0x21ef30[_0x5f48('0x2f')]]['disposition']=dispositions[_[_0x5f48('0x47')](_0x21ef30[_0x5f48('0x48')])];_['merge'](this[_0x5f48('0x10')][_0x21ef30[_0x5f48('0x2f')]],_[_0x5f48('0x49')](_0x21ef30,_[_0x5f48('0x36')](this[_0x5f48('0x10')][_0x21ef30[_0x5f48('0x2f')]])));if(_0x21ef30['context']===_0x5f48('0x38')){var _0x1f5d49=this[_0x5f48('0x11')][_0x21ef30[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]];if(_0x1f5d49&&typeof _0x1f5d49[_0x5f48('0x3b')]===_0x5f48('0x4b')){_0x1f5d49['destconnectedlinenum']=_0x21ef30[_0x5f48('0x3a')];logger[_0x5f48('0x32')](_0x5f48('0x4c'),_0x21ef30[_0x5f48('0x2f')],util[_0x5f48('0x29')]({'id':_0x1f5d49['id'],'destaccountcode':_0x1f5d49[_0x5f48('0x40')],'destconnectedlinenum':_0x21ef30[_0x5f48('0x3a')]},{'showHidden':![],'depth':null}));this[_0x5f48('0x2d')](util[_0x5f48('0x45')](_0x5f48('0x3d'),_0x1f5d49[_0x5f48('0x3e')]),_0x5f48('0x3f'),{'id':_0x1f5d49['id'],'destaccountcode':_0x1f5d49[_0x5f48('0x40')],'destconnectedlinenum':_0x21ef30['exten']});}}}}catch(_0x40cdd6){logger[_0x5f48('0x28')](_0x5f48('0x4d'),_0x21ef30['uniqueid'],util[_0x5f48('0x29')](_0x40cdd6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x4e')]=function(_0x583776){try{if(this[_0x5f48('0x2b')](_0x583776)){logger[_0x5f48('0x32')]('[%s][voiceCallReport][newexten]\x20event:',_0x583776[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x583776,{'showHidden':![],'depth':null}));if(_0x583776[_0x5f48('0x39')]===_0x5f48('0x42')||_0x583776['exten']==='h')return;if(_0x583776['uniqueid']===_0x583776[_0x5f48('0x34')]||this[_0x5f48('0x12')][_0x583776[_0x5f48('0x34')]]){_0x583776[_0x5f48('0x4f')]=_0x583776[_0x5f48('0x4f')]?_0x583776['application'][_0x5f48('0x50')]():undefined;_0x583776[_0x5f48('0x51')]=_0x583776['appdata']||_0x583776['applicationdata'];if(_0x583776[_0x5f48('0x52')]&&_0x583776[_0x5f48('0x4f')]!=='queue'){_0x583776['applicationdata']=_0x583776[_0x5f48('0x51')]['toLowerCase']();}logger[_0x5f48('0x25')](_0x5f48('0x53'),_0x583776['uniqueid'],_0x583776[_0x5f48('0x4f')],_0x583776[_0x5f48('0x51')]);if(_[_0x5f48('0x2c')](this['channels'][_0x583776[_0x5f48('0x2f')]])){this['channels'][_0x583776['uniqueid']]=new Channel();this[_0x5f48('0x10')][_0x583776['uniqueid']][_0x5f48('0x44')]=_0x583776[_0x5f48('0x54')]?moment()[_0x5f48('0x55')](moment['duration'](_0x583776[_0x5f48('0x54')])['seconds'](),'seconds')[_0x5f48('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x5f48('0x46'));this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]][_0x5f48('0x56')]=_0x5f48('0xa');}_[_0x5f48('0x35')](this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]],_[_0x5f48('0x49')](_0x583776,_[_0x5f48('0x36')](this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]])));if(_[_0x5f48('0x57')](applications,_0x583776[_0x5f48('0x4f')])){this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]][_0x5f48('0x58')]=_0x583776['application'];this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]][_0x5f48('0x59')]=_0x583776[_0x5f48('0x51')];if(_0x583776['application']===_0x5f48('0x5a')&&_[_0x5f48('0x5b')](_0x583776['applicationdata'][_0x5f48('0x50')](),_0x5f48('0x5c'))){var _0x4847ff=_0x583776[_0x5f48('0x51')][_0x5f48('0x4a')]('=');var _0x159309=_0x4847ff[0x0][_0x5f48('0x50')]()[_0x5f48('0x5d')](/cdr\((.*)\)/);if(_0x159309){if(_0x159309[0x1]===_0x5f48('0x5e')&&!_['isNil'](this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]][_0x159309[0x1]]))return;this[_0x5f48('0x10')][_0x583776[_0x5f48('0x2f')]][_0x159309[0x1]]=_0x4847ff[0x1];}}else if(_0x583776[_0x5f48('0x4f')]===_0x5f48('0x6')){this['channels'][_0x583776['uniqueid']][_0x5f48('0x6')]=_0x583776['applicationdata'][_0x5f48('0x4a')](',')[0x0];}}}}}catch(_0x2afb83){logger['error'](_0x5f48('0x5f'),_0x583776[_0x5f48('0x2f')],util['inspect'](_0x2afb83,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x60')]=function(_0xf08f00){try{if(this['isNotNull'](_0xf08f00)){logger[_0x5f48('0x25')](_0x5f48('0x61'),_0xf08f00[_0x5f48('0x2f')],_0xf08f00['linkedid'],_0xf08f00['calleridname'],_0xf08f00[_0x5f48('0x31')]);logger[_0x5f48('0x32')]('[%s][voiceCallReport][newstate]\x20event:',_0xf08f00['uniqueid'],util[_0x5f48('0x29')](_0xf08f00,{'showHidden':![],'depth':null}));if(_0xf08f00[_0x5f48('0x48')]!=='6')return;var _0x26a7f4=this['agents'][_0xf08f00['channel'][_0x5f48('0x4a')]('-')[0x0]];if(_0xf08f00[_0x5f48('0x2f')]!==_0xf08f00['linkedid']){var _0x3b1f8c=moment();if(this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]]){if(!this['channels'][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x62')]){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x62')]=!![];this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x63')]=_0x3b1f8c['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x44')]){this[_0x5f48('0x10')][_0xf08f00['linkedid']][_0x5f48('0x64')]=_0x3b1f8c[_0x5f48('0x65')](this[_0x5f48('0x10')][_0xf08f00['linkedid']][_0x5f48('0x44')],_0x5f48('0x66'));}}this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x34')]=_0xf08f00['uniqueid'];if(_0xf08f00[_0x5f48('0x31')]!==_0x5f48('0x67')){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x3c')]=_0xf08f00[_0x5f48('0x31')];}this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]]['connectedlinename']=_0xf08f00[_0x5f48('0x30')];this[_0x5f48('0x10')][_0xf08f00['linkedid']][_0x5f48('0x68')]=_0xf08f00[_0x5f48('0x39')];this[_0x5f48('0x10')][_0xf08f00['linkedid']]['disposition']=dispositions[_[_0x5f48('0x47')](_0xf08f00['channelstate'])];if(_0x26a7f4){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x69')]=_0x26a7f4['id'];this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x6a')]=_0x26a7f4[_0x5f48('0x3e')];}}if(this['channels'][_0xf08f00[_0x5f48('0x2f')]]){if(!this[_0x5f48('0x10')][_0xf08f00['uniqueid']]['answered']){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x62')]=!![];this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x63')]=_0x3b1f8c[_0x5f48('0x45')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x44')]){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x64')]=_0x3b1f8c['diff'](this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x44')],_0x5f48('0x66'));}}if(_0xf08f00[_0x5f48('0x31')]!==_0x5f48('0x67')){this[_0x5f48('0x10')][_0xf08f00['uniqueid']]['connectedlinenum']=_0xf08f00[_0x5f48('0x31')];}this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x6b')]=_0xf08f00[_0x5f48('0x30')];this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x68')]=_0xf08f00[_0x5f48('0x39')];this[_0x5f48('0x10')][_0xf08f00['uniqueid']][_0x5f48('0x56')]=dispositions[_['toNumber'](_0xf08f00[_0x5f48('0x48')])];}}else{if(this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]]){if(_0x26a7f4){this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x69')]=_0x26a7f4['id'];this['channels'][_0xf08f00[_0x5f48('0x2f')]][_0x5f48('0x6a')]=_0x26a7f4[_0x5f48('0x3e')];}}}if(_0xf08f00[_0x5f48('0x37')]===_0x5f48('0x38')){if(_0x26a7f4){_0x26a7f4[_0x5f48('0x3b')]=_0xf08f00[_0x5f48('0x3a')];var _0x11f386;if(this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x2f')]]){_0x11f386=this['channels'][_0xf08f00[_0x5f48('0x2f')]]['queue'];}else if(this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]]){_0x11f386=this[_0x5f48('0x10')][_0xf08f00[_0x5f48('0x34')]][_0x5f48('0x6')];}_0x26a7f4[_0x5f48('0x6')]=_0x11f386;var _0x5c91e5={'id':_0x26a7f4['id'],'name':_0x26a7f4[_0x5f48('0x3e')],'agentconnected':!![],'destaccountcode':_0x26a7f4['accountcode'],'destconnectedlinenum':_0xf08f00[_0x5f48('0x3a')],'queue':_0x11f386||undefined,'uniqueid':_0xf08f00['linkedid']};logger[_0x5f48('0x32')](_0x5f48('0x6c'),_0xf08f00[_0x5f48('0x2f')],util['inspect'](_0x5c91e5,{'showHidden':![],'depth':null}));this[_0x5f48('0x2d')](util[_0x5f48('0x45')]('user:%s',_0x26a7f4['name']),_0x5f48('0x3f'),_0x5c91e5);}}}}catch(_0x20c212){logger['error'](_0x5f48('0x6d'),_0xf08f00[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x20c212,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')]['syncMixMonitorFilename']=function(_0x3058d2,_0x381708){try{if(this['channels'][_0x3058d2]){logger[_0x5f48('0x25')](_0x5f48('0x6e'),_0x3058d2,_0x381708);this[_0x5f48('0x10')][_0x3058d2][_0x5f48('0x6f')]=!![];if(_['endsWith'](_0x381708,_0x5f48('0x70'))){_0x381708=_0x381708['replace'](_0x5f48('0x70'),_0x5f48('0x71'));}this['channels'][_0x3058d2][_0x5f48('0x72')]=_0x381708;var _0x2f8072=_['find'](this[_0x5f48('0x10')][_0x3058d2][_0x5f48('0x73')],{'filename':_0x381708});if(_['isNil'](_0x2f8072)){this['channels'][_0x3058d2][_0x5f48('0x73')][_0x5f48('0x74')]({'filename':_0x381708,'createdAt':moment()[_0x5f48('0x45')](_0x5f48('0x46')),'mixmonitorid':'','status':_0x5f48('0x75')});}}}catch(_0x2a14d9){logger['error'](_0x5f48('0x76'),_0x3058d2,util[_0x5f48('0x29')](_0x2a14d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x19')]=function(_0x4195e4){try{if(this['isNotNull'](_0x4195e4)){logger[_0x5f48('0x32')](_0x5f48('0x77'),_0x4195e4[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x4195e4,{'showHidden':![],'depth':null}));if(this[_0x5f48('0x10')][_0x4195e4['uniqueid']]&&_0x4195e4[_0x5f48('0x39')]!='OutgoingSpoolFailed'){if(this[_0x5f48('0x2b')](_0x4195e4['variable'])){if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x79')])){logger['info'](_0x5f48('0x7a'),_0x4195e4[_0x5f48('0x2f')],_0x4195e4['value']);this[_0x5f48('0x7b')](_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')]);}else if(this['isNotNull'](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x7d')])){logger[_0x5f48('0x25')](_0x5f48('0x7e'),_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')]);this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x2f')]][_0x5f48('0x31')]=_0x4195e4[_0x5f48('0x7c')];}else if(this['isNotNull'](_0x4195e4['variable'][_0x5f48('0x7f')])){logger[_0x5f48('0x25')](_0x5f48('0x80'),_0x4195e4[_0x5f48('0x2f')],_0x4195e4['value']);this['channels'][_0x4195e4[_0x5f48('0x2f')]]['callerid']=_0x4195e4[_0x5f48('0x7c')];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x81')])){logger[_0x5f48('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')]);this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x2f')]][_0x5f48('0x5e')]=_0x4195e4[_0x5f48('0x7c')];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')]['xmd-queue'])){logger[_0x5f48('0x25')](_0x5f48('0x82'),_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')][_0x5f48('0x4a')](',')[0x0]);this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x2f')]][_0x5f48('0x6')]=_0x4195e4[_0x5f48('0x7c')][_0x5f48('0x4a')](',')[0x0];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x83')])){logger[_0x5f48('0x25')](_0x5f48('0x84'),_0x4195e4['uniqueid'],_0x4195e4[_0x5f48('0x7c')]);this['channels'][_0x4195e4[_0x5f48('0x2f')]]['originatecalleridnum']=_0x4195e4[_0x5f48('0x7c')];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')]['xmd-destination'])){logger[_0x5f48('0x25')](_0x5f48('0x85'),_0x4195e4['uniqueid'],_0x4195e4[_0x5f48('0x7c')]);this[_0x5f48('0x10')][_0x4195e4['uniqueid']][_0x5f48('0x86')]=_0x4195e4[_0x5f48('0x7c')];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x87')])){logger[_0x5f48('0x25')](_0x5f48('0x88'),_0x4195e4[_0x5f48('0x2f')],_0x4195e4['value']);this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x2f')]]['calleridpreview']=_0x4195e4['value'];}else if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x89')])){logger[_0x5f48('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')]);this[_0x5f48('0x10')][_0x4195e4['uniqueid']][_0x5f48('0x6')]=_0x4195e4[_0x5f48('0x7c')];}else if(this['isNotNull'](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x8a')])){logger[_0x5f48('0x25')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4195e4[_0x5f48('0x2f')],_0x4195e4[_0x5f48('0x7c')]);this['channels'][_0x4195e4[_0x5f48('0x2f')]][_0x5f48('0x8b')]=_0x4195e4[_0x5f48('0x7c')];}}}else if(this[_0x5f48('0x2b')](_0x4195e4['variable']['mixmonitor_filename'])){if(_0x4195e4[_0x5f48('0x7c')]){var _0x4128cc=path[_0x5f48('0x8c')](_0x4195e4['value'])[_0x5f48('0x3e')];logger[_0x5f48('0x25')](_0x5f48('0x7a'),_0x4128cc,_0x4195e4['value']);this[_0x5f48('0x7b')](_0x4128cc,_0x4195e4[_0x5f48('0x7c')]);}}else if(this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x34')]]){if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')])){if(this[_0x5f48('0x2b')](_0x4195e4[_0x5f48('0x78')][_0x5f48('0x8a')])){logger[_0x5f48('0x25')](_0x5f48('0x8d'),_0x4195e4['linkedid'],_0x4195e4[_0x5f48('0x7c')]);this[_0x5f48('0x10')][_0x4195e4[_0x5f48('0x34')]]['sipcalllinkedid']=_0x4195e4[_0x5f48('0x7c')];}}}}}catch(_0x32aec8){logger[_0x5f48('0x28')](_0x5f48('0x8e'),_0x4195e4[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x32aec8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5f48('0x2a')][_0x5f48('0x1b')]=function(_0x3255e0){try{if(this[_0x5f48('0x2b')](_0x3255e0)){logger['debug'](_0x5f48('0x8f'),_0x3255e0[_0x5f48('0x2f')],util[_0x5f48('0x29')](_0x3255e0,{'showHidden':![],'depth':null}));if(this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]]){if(this[_0x5f48('0x10')][this['blindTransfers'][_0x3255e0[_0x5f48('0x34')]]['linkedid']]){this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]][_0x5f48('0x2f')]=_0x3255e0[_0x5f48('0x2f')];this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0['linkedid']][_0x5f48('0x34')]][_0x5f48('0x62')]=this['channels'][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x62')];this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]]['answertime']=this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x63')];this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]][_0x5f48('0x68')]=this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]][_0x5f48('0x39')];this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0['linkedid']]['linkedid']][_0x5f48('0x56')]=this['channels'][_0x3255e0[_0x5f48('0x2f')]]['disposition'];this[_0x5f48('0x10')][_0x3255e0['uniqueid']]=this['channels'][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]];this[_0x5f48('0x90')](this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x34')]);}else if(this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]]['uniqueid']]){this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]]['uniqueid']][_0x5f48('0x2f')]=[this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]][_0x5f48('0x34')],this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]]['uniqueid']][_0x5f48('0x34')]=this[_0x5f48('0x10')][this['blindTransfers'][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]][_0x5f48('0x2f')]][0x0];this[_0x5f48('0x10')][this['blindTransfers'][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]][_0x5f48('0x62')]=this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]]['answered'];this[_0x5f48('0x10')][this['blindTransfers'][_0x3255e0['linkedid']][_0x5f48('0x2f')]][_0x5f48('0x63')]=this[_0x5f48('0x10')][_0x3255e0['uniqueid']][_0x5f48('0x63')];this[_0x5f48('0x10')][this['blindTransfers'][_0x3255e0[_0x5f48('0x34')]]['uniqueid']][_0x5f48('0x68')]=this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]][_0x5f48('0x39')];this['channels'][this['blindTransfers'][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]]['disposition']=this['channels'][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x56')];this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]]=this[_0x5f48('0x10')][this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]];this[_0x5f48('0x90')](this[_0x5f48('0x12')][_0x3255e0[_0x5f48('0x34')]][_0x5f48('0x2f')]);}}if(this['channels'][_0x3255e0[_0x5f48('0x2f')]]){logger[_0x5f48('0x25')](_0x5f48('0x91'),_0x3255e0['uniqueid'],_0x3255e0[_0x5f48('0x92')]);var _0x16a00a=moment();this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x93')]=_0x16a00a[_0x5f48('0x45')](_0x5f48('0x46'));this[_0x5f48('0x10')][_0x3255e0['uniqueid']]['duration']=_0x16a00a['diff'](this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]]['starttime'],_0x5f48('0x66'));if(this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x62')]){this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]][_0x5f48('0x94')]=_0x16a00a[_0x5f48('0x65')](this['channels'][_0x3255e0[_0x5f48('0x2f')]]['answertime'],_0x5f48('0x66'));this[_0x5f48('0x10')][_0x3255e0[_0x5f48('0x2f')]]['holdtime']=this[_0x5f48('0x10')][_0x3255e0['uniqueid']][_0x5f48('0x54')]-this[_0x5f48('0x10')][_0x3255e0['uniqueid']][_0x5f48('0x94')];}if(_0x3255e0[_0x5f48('0x37')]===_0x5f48('0x38')){if(this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]]){this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]]=_[_0x5f48('0x95')](this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]],[_0x5f48('0x3b')]);logger[_0x5f48('0x32')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x3255e0[_0x5f48('0x2f')],util[_0x5f48('0x29')]({'id':this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]][_0x5f48('0x40')]},{'showHidden':![],'depth':null}));this[_0x5f48('0x2d')](util['format']('user:%s',this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]][_0x5f48('0x3e')]),_0x5f48('0x96'),{'id':this[_0x5f48('0x11')][_0x3255e0[_0x5f48('0x39')][_0x5f48('0x4a')]('-')[0x0]]['id'],'destaccountcode':this[_0x5f48('0x11')][_0x3255e0['channel'][_0x5f48('0x4a')]('-')[0x0]][_0x5f48('0x40')]});for(var _0x120447=0x0;_0x120447{delete this[_0x5f48('0x10')][_0x2e85b5];},_0x2c71fe);}};module[_0x5f48('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0xaef4=['ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','error','inspect','prototype','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','isUndefined','pick','keys','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','context','starttime','disposition','toNumber','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','lastapplication','lastdata','startsWith','cdr(','match','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','holdtime','diff','connectedlinename','UserId','answered','answertime','destinationchannel','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','emit','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','transferToInternal','isEmpty','then','stopRecordingOnTransfer','catch','Action','finally','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','transfereecalleridnum','transfereruniqueid','BLIND','BlindTransfer','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xaef4,0x175));var _0x4aef=function(_0x50083f,_0x88b86c){_0x50083f=_0x50083f-0x0;var _0x49d660=_0xaef4[_0x50083f];return _0x49d660;};'use strict';var _=require('lodash');var moment=require(_0x4aef('0x0'));var util=require(_0x4aef('0x1'));var path=require(_0x4aef('0x2'));var Redis=require(_0x4aef('0x3'));var config=require(_0x4aef('0x4'));var logger=require(_0x4aef('0x5'))(_0x4aef('0x6'));var ami=require('../ami');var Channel=require(_0x4aef('0x7'));var RpcSetting=require(_0x4aef('0x8'));var applications=[_0x4aef('0x9'),_0x4aef('0xa'),_0x4aef('0xb'),_0x4aef('0xc'),_0x4aef('0xd'),_0x4aef('0xe')];var dispositions=[_0x4aef('0xf'),_0x4aef('0x10'),_0x4aef('0x10'),_0x4aef('0xf'),'NO\x20ANSWER',_0x4aef('0xf'),_0x4aef('0x11'),_0x4aef('0x12'),_0x4aef('0x10'),_0x4aef('0x10'),_0x4aef('0x10')];config[_0x4aef('0x13')]=_[_0x4aef('0x14')](config['redis'],{'host':_0x4aef('0x15'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x116470){this[_0x4aef('0x16')]=_0x116470[_0x4aef('0x16')];this['agents']=_0x116470[_0x4aef('0x17')];this['blindTransfers']={};ami['on'](_0x4aef('0x18'),this[_0x4aef('0x19')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1b'),this[_0x4aef('0x19')][_0x4aef('0x1a')](this));ami['on']('newchannel',this[_0x4aef('0x1c')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1d'),this[_0x4aef('0x1e')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x1f'),this[_0x4aef('0x20')][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x21'),this[_0x4aef('0x22')]['bind'](this));ami['on'](_0x4aef('0x23'),this['syncNewCallerId'][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x24'),this[_0x4aef('0x25')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4aef('0x1a')](this));ami['on'](_0x4aef('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x4aef('0x27'),this[_0x4aef('0x28')][_0x4aef('0x1a')](this));try{logger[_0x4aef('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x451d9a){logger[_0x4aef('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0x4aef('0x2b')](_0x451d9a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x444dc7){return _0x444dc7!==null&&!_['isUndefined'](_0x444dc7);};VoiceCallReport['prototype']['emit']=function(_0x2d4662,_0x4e073e,_0x187599){io['to'](_0x2d4662)['emit'](_0x4e073e,_0x187599);};VoiceCallReport[_0x4aef('0x2c')][_0x4aef('0x2d')]=function(_0x4ac9b1){try{if(this[_0x4aef('0x2e')](_0x4ac9b1)){logger[_0x4aef('0x29')](_0x4aef('0x2f'),_0x4ac9b1['uniqueid'],_0x4ac9b1[_0x4aef('0x30')],_0x4ac9b1[_0x4aef('0x31')]);logger[_0x4aef('0x32')](_0x4aef('0x33'),_0x4ac9b1['uniqueid'],util[_0x4aef('0x2b')](_0x4ac9b1,{'showHidden':![],'depth':null}));if(_0x4ac9b1[_0x4aef('0x34')]===_0x4ac9b1[_0x4aef('0x35')]){if(!_[_0x4aef('0x36')](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]])){_['merge'](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]],_[_0x4aef('0x37')](_0x4ac9b1,_[_0x4aef('0x38')](this[_0x4aef('0x16')][_0x4ac9b1[_0x4aef('0x34')]])));}}if(_0x4ac9b1['context']===_0x4aef('0x39')){var _0x48a943=this[_0x4aef('0x17')][_0x4ac9b1[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x48a943){if(_0x4ac9b1[_0x4aef('0x3c')]==_0x4aef('0x3d')){_0x48a943['destconnectedlinenum']=_0x4ac9b1[_0x4aef('0x3e')];this['emit'](util[_0x4aef('0x3f')](_0x4aef('0x40'),_0x48a943['name']),_0x4aef('0x41'),{'id':_0x48a943['id'],'destaccountcode':_0x48a943[_0x4aef('0x42')],'destconnectedlinenum':_0x4ac9b1[_0x4aef('0x3e')]});}}}}}catch(_0x9513bb){logger[_0x4aef('0x2a')](_0x4aef('0x43'),_0x4ac9b1[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x9513bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')]['syncNewChannel']=function(_0x2fb79e){try{if(this['isNotNull'](_0x2fb79e)){logger[_0x4aef('0x32')](_0x4aef('0x44'),_0x2fb79e[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x2fb79e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2fb79e['uniqueid']]){return;}if(_0x2fb79e[_0x4aef('0x3a')]===_0x4aef('0x45')){return;}if(_0x2fb79e['uniqueid']!==_0x2fb79e[_0x4aef('0x35')]&&!this[_0x4aef('0x46')][_0x2fb79e['linkedid']]){return;}logger[_0x4aef('0x29')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2fb79e[_0x4aef('0x34')],_0x2fb79e[_0x4aef('0x47')],_0x2fb79e[_0x4aef('0x3c')]);this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]]=new Channel();this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]][_0x4aef('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4aef('0x16')][_0x2fb79e['uniqueid']][_0x4aef('0x49')]=dispositions[_[_0x4aef('0x4a')](_0x2fb79e['channelstate'])];_['merge'](this[_0x4aef('0x16')][_0x2fb79e[_0x4aef('0x34')]],_['pick'](_0x2fb79e,_[_0x4aef('0x38')](this[_0x4aef('0x16')][_0x2fb79e['uniqueid']])));if(_0x2fb79e['context']===_0x4aef('0x39')){var _0x2363a4=this['agents'][_0x2fb79e[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x2363a4&&typeof _0x2363a4[_0x4aef('0x4b')]===_0x4aef('0x4c')){_0x2363a4[_0x4aef('0x4b')]=_0x2fb79e[_0x4aef('0x3c')];logger['debug'](_0x4aef('0x4d'),_0x2fb79e[_0x4aef('0x34')],util[_0x4aef('0x2b')]({'id':_0x2363a4['id'],'destaccountcode':_0x2363a4[_0x4aef('0x42')],'destconnectedlinenum':_0x2fb79e[_0x4aef('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4aef('0x3f')]('user:%s',_0x2363a4[_0x4aef('0x4e')]),_0x4aef('0x41'),{'id':_0x2363a4['id'],'destaccountcode':_0x2363a4[_0x4aef('0x42')],'destconnectedlinenum':_0x2fb79e[_0x4aef('0x3c')]});}}}}catch(_0x5d564c){logger['error'](_0x4aef('0x4f'),_0x2fb79e['uniqueid'],util['inspect'](_0x5d564c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4aef('0x19')]=function(_0x404bea){try{if(this['isNotNull'](_0x404bea)){logger[_0x4aef('0x32')](_0x4aef('0x50'),_0x404bea[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x404bea,{'showHidden':![],'depth':null}));if(_0x404bea[_0x4aef('0x3a')]===_0x4aef('0x45')||_0x404bea[_0x4aef('0x3c')]==='h')return;if(_0x404bea[_0x4aef('0x34')]===_0x404bea[_0x4aef('0x35')]||this['blindTransfers'][_0x404bea[_0x4aef('0x35')]]){_0x404bea[_0x4aef('0x51')]=_0x404bea[_0x4aef('0x51')]?_0x404bea[_0x4aef('0x51')][_0x4aef('0x52')]():undefined;_0x404bea[_0x4aef('0x53')]=_0x404bea[_0x4aef('0x54')]||_0x404bea[_0x4aef('0x53')];if(_0x404bea[_0x4aef('0x54')]&&_0x404bea[_0x4aef('0x51')]!==_0x4aef('0xa')){_0x404bea[_0x4aef('0x53')]=_0x404bea[_0x4aef('0x53')][_0x4aef('0x52')]();}logger[_0x4aef('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x404bea[_0x4aef('0x34')],_0x404bea['application'],_0x404bea['applicationdata']);if(_[_0x4aef('0x36')](this['channels'][_0x404bea[_0x4aef('0x34')]])){this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]]=new Channel();this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x48')]=_0x404bea[_0x4aef('0x55')]?moment()[_0x4aef('0x56')](moment[_0x4aef('0x55')](_0x404bea[_0x4aef('0x55')])[_0x4aef('0x57')](),_0x4aef('0x57'))[_0x4aef('0x3f')](_0x4aef('0x58')):moment()[_0x4aef('0x3f')](_0x4aef('0x58'));this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x49')]=_0x4aef('0xf');}_[_0x4aef('0x59')](this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]],_['pick'](_0x404bea,_[_0x4aef('0x38')](this['channels'][_0x404bea[_0x4aef('0x34')]])));if(_['includes'](applications,_0x404bea[_0x4aef('0x51')])){this['channels'][_0x404bea['uniqueid']][_0x4aef('0x5a')]=_0x404bea[_0x4aef('0x51')];this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x4aef('0x5b')]=_0x404bea['applicationdata'];if(_0x404bea[_0x4aef('0x51')]===_0x4aef('0x9')&&_[_0x4aef('0x5c')](_0x404bea[_0x4aef('0x53')][_0x4aef('0x52')](),_0x4aef('0x5d'))){var _0x4c0084=_0x404bea['applicationdata'][_0x4aef('0x3b')]('=');var _0x993eea=_0x4c0084[0x0][_0x4aef('0x52')]()[_0x4aef('0x5e')](/cdr\((.*)\)/);if(_0x993eea){if(_0x993eea[0x1]==='type'&&!_[_0x4aef('0x5f')](this[_0x4aef('0x16')][_0x404bea[_0x4aef('0x34')]][_0x993eea[0x1]]))return;this['channels'][_0x404bea[_0x4aef('0x34')]][_0x993eea[0x1]]=_0x4c0084[0x1];}}else if(_0x404bea[_0x4aef('0x51')]===_0x4aef('0xa')){this[_0x4aef('0x16')][_0x404bea['uniqueid']][_0x4aef('0xa')]=_0x404bea[_0x4aef('0x53')]['split'](',')[0x0];}}}}}catch(_0x459bd5){logger['error'](_0x4aef('0x60'),_0x404bea[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x459bd5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4aef('0x1e')]=function(_0x17e7d6){try{if(this[_0x4aef('0x2e')](_0x17e7d6)){logger['info'](_0x4aef('0x61'),_0x17e7d6[_0x4aef('0x34')],_0x17e7d6[_0x4aef('0x35')],_0x17e7d6['calleridname'],_0x17e7d6[_0x4aef('0x31')]);logger[_0x4aef('0x32')](_0x4aef('0x62'),_0x17e7d6[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x17e7d6,{'showHidden':![],'depth':null}));if(_0x17e7d6[_0x4aef('0x63')]!=='6')return;var _0x307c54=this[_0x4aef('0x17')][_0x17e7d6[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]];if(_0x17e7d6['uniqueid']!==_0x17e7d6[_0x4aef('0x35')]){var _0xe00502=moment();if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]){if(!this[_0x4aef('0x16')][_0x17e7d6['linkedid']]['answered']){this['channels'][_0x17e7d6[_0x4aef('0x35')]]['answered']=!![];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['answertime']=_0xe00502[_0x4aef('0x3f')](_0x4aef('0x58'));if(this['channels'][_0x17e7d6['linkedid']][_0x4aef('0x48')]){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x64')]=_0xe00502[_0x4aef('0x65')](this['channels'][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x48')],_0x4aef('0x57'));}}this['channels'][_0x17e7d6['linkedid']][_0x4aef('0x35')]=_0x17e7d6[_0x4aef('0x34')];if(_0x17e7d6['calleridnum']!==_0x4aef('0x3d')){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x3e')]=_0x17e7d6[_0x4aef('0x31')];}this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x66')]=_0x17e7d6[_0x4aef('0x30')];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['destinationchannel']=_0x17e7d6[_0x4aef('0x3a')];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x49')]=dispositions[_[_0x4aef('0x4a')](_0x17e7d6[_0x4aef('0x63')])];if(_0x307c54){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]][_0x4aef('0x67')]=_0x307c54['id'];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['membername']=_0x307c54[_0x4aef('0x4e')];}}if(this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]){if(!this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x68')]){this['channels'][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x68')]=!![];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']][_0x4aef('0x69')]=_0xe00502[_0x4aef('0x3f')](_0x4aef('0x58'));if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x48')]){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x64')]=_0xe00502[_0x4aef('0x65')](this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x48')],_0x4aef('0x57'));}}if(_0x17e7d6['calleridnum']!==_0x4aef('0x3d')){this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['connectedlinenum']=_0x17e7d6[_0x4aef('0x31')];}this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x66')]=_0x17e7d6[_0x4aef('0x30')];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']][_0x4aef('0x6a')]=_0x17e7d6[_0x4aef('0x3a')];this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['disposition']=dispositions[_[_0x4aef('0x4a')](_0x17e7d6['channelstate'])];}}else{if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]]){if(_0x307c54){this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x67')]=_0x307c54['id'];this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x34')]][_0x4aef('0x6b')]=_0x307c54[_0x4aef('0x4e')];}}}if(_0x17e7d6[_0x4aef('0x47')]===_0x4aef('0x39')){if(_0x307c54){_0x307c54[_0x4aef('0x4b')]=_0x17e7d6[_0x4aef('0x3c')];var _0x15c2b8;if(this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]){_0x15c2b8=this[_0x4aef('0x16')][_0x17e7d6['uniqueid']]['queue'];}else if(this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]){_0x15c2b8=this[_0x4aef('0x16')][_0x17e7d6[_0x4aef('0x35')]]['queue'];}_0x307c54[_0x4aef('0xa')]=_0x15c2b8;var _0x304a5f={'id':_0x307c54['id'],'name':_0x307c54[_0x4aef('0x4e')],'agentconnected':!![],'destaccountcode':_0x307c54[_0x4aef('0x42')],'destconnectedlinenum':_0x17e7d6[_0x4aef('0x3c')],'queue':_0x15c2b8||undefined,'uniqueid':_0x17e7d6[_0x4aef('0x35')]};logger['debug'](_0x4aef('0x6c'),_0x17e7d6[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x304a5f,{'showHidden':![],'depth':null}));this[_0x4aef('0x6d')](util[_0x4aef('0x3f')](_0x4aef('0x40'),_0x307c54[_0x4aef('0x4e')]),_0x4aef('0x41'),_0x304a5f);}}}}catch(_0x250f97){logger[_0x4aef('0x2a')](_0x4aef('0x6e'),_0x17e7d6[_0x4aef('0x34')],util['inspect'](_0x250f97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')]['syncMixMonitorFilename']=function(_0x3d7d1c,_0xeba0c7){try{if(this[_0x4aef('0x16')][_0x3d7d1c]){logger[_0x4aef('0x29')](_0x4aef('0x6f'),_0x3d7d1c,_0xeba0c7);this[_0x4aef('0x16')][_0x3d7d1c][_0x4aef('0x70')]=!![];if(_[_0x4aef('0x71')](_0xeba0c7,_0x4aef('0x72'))){_0xeba0c7=_0xeba0c7['replace']('.wav49',_0x4aef('0x73'));}this[_0x4aef('0x16')][_0x3d7d1c][_0x4aef('0x74')]=_0xeba0c7;var _0x41f005=_[_0x4aef('0x75')](this['channels'][_0x3d7d1c][_0x4aef('0x76')],{'filename':_0xeba0c7});if(_['isNil'](_0x41f005)){this[_0x4aef('0x16')][_0x3d7d1c]['monitors']['push']({'filename':_0xeba0c7,'createdAt':moment()['format'](_0x4aef('0x58')),'mixmonitorid':'','status':'rec'});}}}catch(_0x43f17c){logger[_0x4aef('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3d7d1c,util[_0x4aef('0x2b')](_0x43f17c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4aef('0x2c')][_0x4aef('0x20')]=function(_0x550f06){try{if(this['isNotNull'](_0x550f06)){logger[_0x4aef('0x32')](_0x4aef('0x77'),_0x550f06['uniqueid'],util['inspect'](_0x550f06,{'showHidden':![],'depth':null}));if(this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]]&&_0x550f06['channel']!=_0x4aef('0x45')){if(this[_0x4aef('0x2e')](_0x550f06['variable'])){if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x79')])){logger[_0x4aef('0x29')](_0x4aef('0x7a'),_0x550f06['uniqueid'],_0x550f06['value']);this[_0x4aef('0x7b')](_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x7d')])){logger[_0x4aef('0x29')](_0x4aef('0x7e'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x31')]=_0x550f06['value'];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x7f')])){logger[_0x4aef('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x80')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x81')])){logger[_0x4aef('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x82')]=_0x550f06[_0x4aef('0x7c')];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')]['xmd-queue'])){logger[_0x4aef('0x29')](_0x4aef('0x83'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')][_0x4aef('0x3b')](',')[0x0]);this[_0x4aef('0x16')][_0x550f06['uniqueid']]['queue']=_0x550f06[_0x4aef('0x7c')][_0x4aef('0x3b')](',')[0x0];}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x550f06['uniqueid'],_0x550f06[_0x4aef('0x7c')]);this['channels'][_0x550f06['uniqueid']][_0x4aef('0x85')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x86')])){logger[_0x4aef('0x29')](_0x4aef('0x87'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x88')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06['variable'][_0x4aef('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]][_0x4aef('0x8a')]=_0x550f06[_0x4aef('0x7c')];}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8b')])){logger[_0x4aef('0x29')](_0x4aef('0x8c'),_0x550f06[_0x4aef('0x34')],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x34')]]['queue']=_0x550f06[_0x4aef('0x7c')];}else if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8d')])){logger[_0x4aef('0x29')](_0x4aef('0x8e'),_0x550f06['uniqueid'],_0x550f06['value']);this['channels'][_0x550f06[_0x4aef('0x34')]]['sipcalluniqueid']=_0x550f06['value'];}}}else if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')][_0x4aef('0x79')])){if(_0x550f06['value']){var _0x3a3f82=path['parse'](_0x550f06[_0x4aef('0x7c')])[_0x4aef('0x4e')];logger[_0x4aef('0x29')](_0x4aef('0x7a'),_0x3a3f82,_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x7b')](_0x3a3f82,_0x550f06[_0x4aef('0x7c')]);}}else if(this[_0x4aef('0x16')][_0x550f06['linkedid']]){if(this[_0x4aef('0x2e')](_0x550f06[_0x4aef('0x78')])){if(this['isNotNull'](_0x550f06[_0x4aef('0x78')][_0x4aef('0x8d')])){logger[_0x4aef('0x29')](_0x4aef('0x8e'),_0x550f06['linkedid'],_0x550f06[_0x4aef('0x7c')]);this[_0x4aef('0x16')][_0x550f06[_0x4aef('0x35')]][_0x4aef('0x8f')]=_0x550f06[_0x4aef('0x7c')];}}}}}catch(_0x551bd0){logger[_0x4aef('0x2a')]('[%s][voiceCallReport][varset]',_0x550f06[_0x4aef('0x34')],util[_0x4aef('0x2b')](_0x551bd0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x8169c4){try{if(this[_0x4aef('0x2e')](_0x8169c4)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x8169c4['uniqueid'],util[_0x4aef('0x2b')](_0x8169c4,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]]){if(this['channels'][this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]]){this['channels'][this['blindTransfers'][_0x8169c4['linkedid']][_0x4aef('0x35')]][_0x4aef('0x34')]=_0x8169c4['uniqueid'];this['channels'][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]][_0x4aef('0x68')]=this[_0x4aef('0x16')][_0x8169c4['uniqueid']]['answered'];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]][_0x4aef('0x69')]=this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['linkedid']][_0x4aef('0x6a')]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['linkedid']][_0x4aef('0x3a')];this['channels'][this[_0x4aef('0x46')][_0x8169c4['linkedid']][_0x4aef('0x35')]][_0x4aef('0x49')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x49')];this[_0x4aef('0x16')][_0x8169c4['uniqueid']]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]];this[_0x4aef('0x90')](this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x35')]);}else if(this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]){this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['uniqueid']=[this[_0x4aef('0x16')][this['blindTransfers'][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['linkedid'],this['channels'][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]][_0x4aef('0x35')]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]][_0x4aef('0x34')]][0x0];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']][_0x4aef('0x68')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x68')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4['linkedid']][_0x4aef('0x34')]][_0x4aef('0x69')]=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']]['destinationchannel']=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['channel'];this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]]['disposition']=this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x49')];this[_0x4aef('0x16')][_0x8169c4['uniqueid']]=this[_0x4aef('0x16')][this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x4aef('0x46')][_0x8169c4[_0x4aef('0x35')]][_0x4aef('0x34')]);}}if(this[_0x4aef('0x16')][_0x8169c4['uniqueid']]){logger[_0x4aef('0x29')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x8169c4[_0x4aef('0x34')],_0x8169c4[_0x4aef('0x91')]);var _0x217e62=moment();this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x92')]=_0x217e62['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4aef('0x16')][_0x8169c4['uniqueid']][_0x4aef('0x55')]=_0x217e62[_0x4aef('0x65')](this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x48')],_0x4aef('0x57'));if(this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x68')]){this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x93')]=_0x217e62[_0x4aef('0x65')](this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x69')],_0x4aef('0x57'));this['channels'][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x64')]=this['channels'][_0x8169c4['uniqueid']]['duration']-this[_0x4aef('0x16')][_0x8169c4[_0x4aef('0x34')]][_0x4aef('0x93')];}if(_0x8169c4[_0x4aef('0x47')]===_0x4aef('0x39')){if(this[_0x4aef('0x17')][_0x8169c4['channel'][_0x4aef('0x3b')]('-')[0x0]]){this['agents'][_0x8169c4['channel']['split']('-')[0x0]]=_[_0x4aef('0x94')](this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')]['split']('-')[0x0]],[_0x4aef('0x4b')]);logger['debug'](_0x4aef('0x95'),_0x8169c4['uniqueid'],util[_0x4aef('0x2b')]({'id':this['agents'][_0x8169c4[_0x4aef('0x3a')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x42')]},{'showHidden':![],'depth':null}));this[_0x4aef('0x6d')](util['format'](_0x4aef('0x40'),this[_0x4aef('0x17')][_0x8169c4['channel'][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x4e')]),_0x4aef('0x96'),{'id':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x4aef('0x17')][_0x8169c4[_0x4aef('0x3a')][_0x4aef('0x3b')]('-')[0x0]][_0x4aef('0x42')]});for(var _0x30745d=0x0;_0x30745d{delete this[_0x4aef('0x16')][_0x318a9e];},_0x211361);}};module[_0x4aef('0xc2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index c8b8b7b..7289b28 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 _0xe0ab=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','cdr(','split','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','inspect','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','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:','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','duration','endtime','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify'];(function(_0x1707fa,_0x170fd0){var _0x25a923=function(_0x3970e5){while(--_0x3970e5){_0x1707fa['push'](_0x1707fa['shift']());}};_0x25a923(++_0x170fd0);}(_0xe0ab,0x106));var _0xbe0a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe0ab[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbe0a('0x0'));var moment=require('moment');var util=require(_0xbe0a('0x1'));var Redis=require(_0xbe0a('0x2'));var config=require(_0xbe0a('0x3'));var logger=require(_0xbe0a('0x4'))(_0xbe0a('0x5'));var ami=require(_0xbe0a('0x6'));config[_0xbe0a('0x7')]=_[_0xbe0a('0x8')](config[_0xbe0a('0x7')],{'host':_0xbe0a('0x9'),'port':0x18eb});var io=require(_0xbe0a('0xa'))(new Redis(config[_0xbe0a('0x7')]));function VoiceDialReport(_0x371a56){this[_0xbe0a('0xb')]=_0x371a56['outboundChannels'];this['outbound']=_0x371a56[_0xbe0a('0xc')];this[_0xbe0a('0xd')]={};this[_0xbe0a('0xe')]={};ami['on'](_0xbe0a('0xf'),this[_0xbe0a('0x10')][_0xbe0a('0x11')](this));ami['on']('dialend',this[_0xbe0a('0x12')][_0xbe0a('0x11')](this));ami['on'](_0xbe0a('0x13'),this[_0xbe0a('0x14')][_0xbe0a('0x11')](this));ami['on'](_0xbe0a('0x15'),this[_0xbe0a('0x16')][_0xbe0a('0x11')](this));}VoiceDialReport[_0xbe0a('0x17')]['isNotNull']=function(_0xf3a3f3){return _0xf3a3f3!==null&&!_[_0xbe0a('0x18')](_0xf3a3f3);};VoiceDialReport['prototype'][_0xbe0a('0x19')]=function(_0x3a3b8a,_0x1757a8,_0x674039){io['to'](_0x3a3b8a)[_0xbe0a('0x19')](_0x1757a8,_0x674039);};VoiceDialReport[_0xbe0a('0x17')]['syncDialBegin']=function(_0x263996){try{if(this[_0xbe0a('0x1a')](_0x263996)){logger[_0xbe0a('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x263996['uniqueid'],util[_0xbe0a('0x1c')](_0x263996,{'showHidden':![],'depth':null}));if(this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]]){_[_0xbe0a('0x1e')](this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]],{'starttime':moment()[_0xbe0a('0x1f')](_0xbe0a('0x20')),'lastevent':_0xbe0a('0x21'),'interface':_0x263996[_0xbe0a('0x22')]['substring'](0x0,_0x263996[_0xbe0a('0x22')][_0xbe0a('0x23')]('-')),'membername':_0x263996[_0xbe0a('0x22')][_0xbe0a('0x24')](_0x263996[_0xbe0a('0x22')][_0xbe0a('0x23')]('/')+0x1,_0x263996[_0xbe0a('0x22')]['lastIndexOf']('-'))},_['omit'](_0x263996,[_0xbe0a('0x25'),_0xbe0a('0x26')]));logger['info'](_0xbe0a('0x27'),_0x263996['uniqueid'],this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]][_0xbe0a('0x28')],this[_0xbe0a('0xb')][_0x263996['uniqueid']][_0xbe0a('0x29')]);logger[_0xbe0a('0x1b')](_0xbe0a('0x2a'),_0x263996['uniqueid'],util[_0xbe0a('0x1c')](this['channels'][_0x263996[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x263996[_0xbe0a('0x1d')]])_[_0xbe0a('0x1e')](this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]],this[_0xbe0a('0xd')][_0x263996[_0xbe0a('0x1d')]]);this[_0xbe0a('0x19')](_0xbe0a('0x2b'),'voice_outbound_channel:save',this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]]);logger[_0xbe0a('0x1b')](_0xbe0a('0x2c'),_0x263996[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xbe0a('0x19')]('custom:dialbegin',this[_0xbe0a('0xb')][_0x263996[_0xbe0a('0x1d')]]);}}}catch(_0x3625f5){logger[_0xbe0a('0x2d')](_0xbe0a('0x2e'),_0x263996[_0xbe0a('0x1d')],util['inspect'](_0x3625f5,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbe0a('0x12')]=function(_0x524756){try{if(this[_0xbe0a('0x1a')](_0x524756)){logger[_0xbe0a('0x1b')](_0xbe0a('0x2f'),_0x524756[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](_0x524756,{'showHidden':![],'depth':null}));if(this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]]){this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]][_0xbe0a('0x30')]=_0x524756[_0xbe0a('0x30')];if(_0x524756[_0xbe0a('0x30')]===_0xbe0a('0x31')){this['channels'][_0x524756[_0xbe0a('0x1d')]][_0xbe0a('0x32')]=_0x524756['connectedlinenum'];this['channels'][_0x524756[_0xbe0a('0x1d')]][_0xbe0a('0x33')]=_0x524756[_0xbe0a('0x33')];this[_0xbe0a('0xb')][_0x524756['uniqueid']][_0xbe0a('0x34')]=moment()['format'](_0xbe0a('0x20'));this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]][_0xbe0a('0x35')]=_0xbe0a('0x36');logger[_0xbe0a('0x37')](_0xbe0a('0x38'),_0x524756[_0xbe0a('0x1d')],_0x524756[_0xbe0a('0x22')][_0xbe0a('0x24')](_0x524756[_0xbe0a('0x22')]['lastIndexOf']('/')+0x1,_0x524756[_0xbe0a('0x22')][_0xbe0a('0x23')]('-')));logger[_0xbe0a('0x1b')](_0xbe0a('0x39'),_0x524756[_0xbe0a('0x1d')],util['inspect'](this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xbe0a('0x19')](_0xbe0a('0x3a'),this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]]);}logger[_0xbe0a('0x1b')](_0xbe0a('0x3b'),_0x524756[_0xbe0a('0x1d')],util['inspect'](this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));this[_0xbe0a('0x19')]('voice:outbound','voice_outbound_channel:save',this[_0xbe0a('0xb')][_0x524756[_0xbe0a('0x1d')]]);}}}catch(_0x370e95){logger[_0xbe0a('0x2d')](_0xbe0a('0x3c'),_0x524756['uniqueid'],util[_0xbe0a('0x1c')](_0x370e95,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbe0a('0x17')][_0xbe0a('0x14')]=function(_0x1170b5){try{if(this['isNotNull'](_0x1170b5)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x1170b5[_0xbe0a('0x1d')],util['inspect'](_0x1170b5,{'showHidden':![],'depth':null}));this[_0xbe0a('0x3d')](_0x1170b5[_0xbe0a('0x1d')],_[_0xbe0a('0x3e')](_0x1170b5[_0xbe0a('0x3f')])[0x0],_0x1170b5[_0xbe0a('0x40')]);if(this['isNotNull'](_0x1170b5[_0xbe0a('0x3f')])&&this[_0xbe0a('0x1a')](_0x1170b5[_0xbe0a('0x3f')][_0xbe0a('0x41')])){if(_['isUndefined'](this[_0xbe0a('0xb')][_0x1170b5[_0xbe0a('0x1d')]])){this[_0xbe0a('0xb')][_0x1170b5['uniqueid']]={'routeId':_0x1170b5[_0xbe0a('0x40')],'variables':this[_0xbe0a('0xe')][_0x1170b5[_0xbe0a('0x1d')]],'motionChannel':_0xbe0a('0x42')};logger[_0xbe0a('0x37')](_0xbe0a('0x43'),_0x1170b5[_0xbe0a('0x1d')],_0x1170b5[_0xbe0a('0x3f')][_0xbe0a('0x41')],_[_0xbe0a('0x3e')](_0x1170b5[_0xbe0a('0x3f')])[0x0],_0x1170b5[_0xbe0a('0x40')]);logger[_0xbe0a('0x1b')](_0xbe0a('0x44'),_0x1170b5[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](this[_0xbe0a('0xb')][_0x1170b5['uniqueid']],{'showHidden':![],'depth':null}));this[_0xbe0a('0x19')](_0xbe0a('0x2b'),_0xbe0a('0x45'),this[_0xbe0a('0xb')][_0x1170b5[_0xbe0a('0x1d')]]);}}}}catch(_0x10c1ae){logger[_0xbe0a('0x2d')](_0xbe0a('0x46'),_0x1170b5[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](_0x10c1ae,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbe0a('0x17')]['addVariable']=function(_0x172422,_0x34d50f,_0x2a6849){var _0x22a537=[_0xbe0a('0x47'),_0xbe0a('0x48'),_0xbe0a('0x49'),_0xbe0a('0x4a'),'rtpaudioqosloss',_0xbe0a('0x4b'),_0xbe0a('0x4c'),_0xbe0a('0x4d'),_0xbe0a('0x4e'),'sipuri',_0xbe0a('0x4f'),_0xbe0a('0x50'),_0xbe0a('0x51'),_0xbe0a('0x52'),'memberinterface',_0xbe0a('0x53'),_0xbe0a('0x28'),_0xbe0a('0x54'),_0xbe0a('0x55')];if(!_[_0xbe0a('0x56')](_0x34d50f)&&!_[_0xbe0a('0x57')](_0x22a537,_0x34d50f)){if(_[_0xbe0a('0x18')](this[_0xbe0a('0xe')][_0x172422])){this[_0xbe0a('0xe')][_0x172422]={};}this['variables'][_0x172422][_0x34d50f]=_0x2a6849;}};VoiceDialReport[_0xbe0a('0x17')][_0xbe0a('0x16')]=function(_0x5d63aa){try{if(this[_0xbe0a('0x1a')](_0x5d63aa)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x5d63aa[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](_0x5d63aa,{'showHidden':![],'depth':null}));if(this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]]){logger[_0xbe0a('0x37')](_0xbe0a('0x58'),_0x5d63aa[_0xbe0a('0x1d')],_0x5d63aa['cause-txt']);this['channels'][_0x5d63aa['uniqueid']]['endtime']=moment()[_0xbe0a('0x1f')](_0xbe0a('0x20'));this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x59')]=moment(this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x5a')])[_0xbe0a('0x5b')](this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x5c')],_0xbe0a('0x5d'));this[_0xbe0a('0xb')][_0x5d63aa['uniqueid']][_0xbe0a('0x35')]='complete';this[_0xbe0a('0xc')][_0xbe0a('0x5e')]+=0x1;if(this['channels'][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x34')]){this['outbound'][_0xbe0a('0x5f')]+=0x1;this['channels'][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x60')]=moment(this['channels'][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x34')])[_0xbe0a('0x5b')](this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x5c')],'seconds');this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x61')]=moment(this['channels'][_0x5d63aa['uniqueid']]['endtime'])[_0xbe0a('0x5b')](this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]]['answertime'],_0xbe0a('0x5d'));this[_0xbe0a('0xc')]['sumHoldTime']+=this['channels'][_0x5d63aa['uniqueid']][_0xbe0a('0x60')]||0x0;this[_0xbe0a('0xc')][_0xbe0a('0x62')]+=this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x61')];}this[_0xbe0a('0xc')][_0xbe0a('0x63')]+=this['channels'][_0x5d63aa[_0xbe0a('0x1d')]][_0xbe0a('0x59')];logger[_0xbe0a('0x1b')](_0xbe0a('0x64'),_0x5d63aa['uniqueid'],util[_0xbe0a('0x1c')](this['channels'][_0x5d63aa[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xbe0a('0x19')]('custom:voiceDialReport',this['channels'][_0x5d63aa['uniqueid']]);logger['debug'](_0xbe0a('0x65'),_0x5d63aa[_0xbe0a('0x1d')],util['inspect'](this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xbe0a('0x19')](_0xbe0a('0x66'),this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]]);logger[_0xbe0a('0x1b')](_0xbe0a('0x67'),_0x5d63aa[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](this[_0xbe0a('0xb')][_0x5d63aa['uniqueid']],{'showHidden':![],'depth':null}));this[_0xbe0a('0x19')](_0xbe0a('0x2b'),_0xbe0a('0x68'),this[_0xbe0a('0xc')]);logger[_0xbe0a('0x37')](_0xbe0a('0x69'),JSON[_0xbe0a('0x6a')](this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]]));logger['debug'](_0xbe0a('0x6b'),_0x5d63aa[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](this['channels'][_0x5d63aa[_0xbe0a('0x1d')]],{'showHidden':![],'depth':null}));this[_0xbe0a('0x19')](_0xbe0a('0x2b'),_0xbe0a('0x6c'),this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x1d')]]);this[_0xbe0a('0x6d')](_0x5d63aa[_0xbe0a('0x1d')]);}else if(this[_0xbe0a('0xb')][_0x5d63aa['linkedid']]){this[_0xbe0a('0xb')][_0x5d63aa[_0xbe0a('0x6e')]][_0xbe0a('0x1d')]=this['channels'][_0x5d63aa['linkedid']]['destuniqueid'];}if(this['variables'][_0x5d63aa[_0xbe0a('0x1d')]]){delete this[_0xbe0a('0xe')][_0x5d63aa[_0xbe0a('0x1d')]];}}}catch(_0x173905){logger[_0xbe0a('0x2d')](_0xbe0a('0x6f'),_0x5d63aa[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](_0x173905,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbe0a('0x17')][_0xbe0a('0x70')]=function(_0x1c4af6){try{if(this[_0xbe0a('0x1a')](_0x1c4af6)){logger[_0xbe0a('0x1b')](_0xbe0a('0x71'),_0x1c4af6['uniqueid'],util[_0xbe0a('0x1c')](_0x1c4af6,{'showHidden':![],'depth':null}));if(_0x1c4af6[_0xbe0a('0x72')][_0xbe0a('0x73')]()==='set'){_0x1c4af6[_0xbe0a('0x74')]=(_0x1c4af6[_0xbe0a('0x75')]||_0x1c4af6[_0xbe0a('0x74')])[_0xbe0a('0x73')]();if(_[_0xbe0a('0x76')](_0x1c4af6[_0xbe0a('0x74')],_0xbe0a('0x77'))){if(_[_0xbe0a('0x18')](this[_0xbe0a('0xd')][_0x1c4af6[_0xbe0a('0x1d')]]))this['applications'][_0x1c4af6[_0xbe0a('0x1d')]]={};logger[_0xbe0a('0x37')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x1c4af6[_0xbe0a('0x1d')],_0x1c4af6['application'],_0x1c4af6[_0xbe0a('0x74')]);var _0x372c7d=_0x1c4af6[_0xbe0a('0x74')][_0xbe0a('0x78')]('=');var _0x9f8297=_0x372c7d[0x0]['match'](/cdr\((.*)\)/);if(_0x9f8297)this[_0xbe0a('0xd')][_0x1c4af6['uniqueid']][_0x9f8297[0x1]]=_0x372c7d[0x1];}}}}catch(_0x524428){logger[_0xbe0a('0x2d')](_0xbe0a('0x79'),_0x1c4af6[_0xbe0a('0x1d')],util[_0xbe0a('0x1c')](_0x524428,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbe0a('0x6d')]=function(_0x5d90c5,_0x349344=0x2710){if(this[_0xbe0a('0xb')][_0x5d90c5]){setTimeout(()=>{delete this[_0xbe0a('0xb')][_0x5d90c5];},_0x349344);}};module[_0xbe0a('0x7a')]=VoiceDialReport; \ No newline at end of file +var _0x1f8d=['answertime','answered','diff','billableseconds','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','keys','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','membercalls','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','complete','total'];(function(_0x35e619,_0x44d9e4){var _0x826de2=function(_0xcf2df9){while(--_0xcf2df9){_0x35e619['push'](_0x35e619['shift']());}};_0x826de2(++_0x44d9e4);}(_0x1f8d,0x17a));var _0xd1f8=function(_0x1c2829,_0x205c81){_0x1c2829=_0x1c2829-0x0;var _0x27341b=_0x1f8d[_0x1c2829];return _0x27341b;};'use strict';var _=require(_0xd1f8('0x0'));var moment=require(_0xd1f8('0x1'));var util=require(_0xd1f8('0x2'));var Redis=require(_0xd1f8('0x3'));var config=require(_0xd1f8('0x4'));var logger=require(_0xd1f8('0x5'))('ami');var ami=require(_0xd1f8('0x6'));config[_0xd1f8('0x7')]=_[_0xd1f8('0x8')](config[_0xd1f8('0x7')],{'host':_0xd1f8('0x9'),'port':0x18eb});var io=require(_0xd1f8('0xa'))(new Redis(config[_0xd1f8('0x7')]));function VoiceDialReport(_0x3a6299){this[_0xd1f8('0xb')]=_0x3a6299[_0xd1f8('0xc')];this[_0xd1f8('0xd')]=_0x3a6299['outbound'];this[_0xd1f8('0xe')]={};this['variables']={};ami['on'](_0xd1f8('0xf'),this[_0xd1f8('0x10')][_0xd1f8('0x11')](this));ami['on']('dialend',this[_0xd1f8('0x12')][_0xd1f8('0x11')](this));ami['on'](_0xd1f8('0x13'),this[_0xd1f8('0x14')][_0xd1f8('0x11')](this));ami['on'](_0xd1f8('0x15'),this[_0xd1f8('0x16')]['bind'](this));}VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x18')]=function(_0x270773){return _0x270773!==null&&!_[_0xd1f8('0x19')](_0x270773);};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x1a')]=function(_0x4d22f0,_0x3a8555,_0x1b0265){io['to'](_0x4d22f0)['emit'](_0x3a8555,_0x1b0265);};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x10')]=function(_0x4fa69a){try{if(this[_0xd1f8('0x18')](_0x4fa69a)){logger[_0xd1f8('0x1b')](_0xd1f8('0x1c'),_0x4fa69a[_0xd1f8('0x1d')],util['inspect'](_0x4fa69a,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]){_[_0xd1f8('0x1e')](this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]],{'starttime':moment()[_0xd1f8('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x4fa69a[_0xd1f8('0x20')]['substring'](0x0,_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x21')]('-')),'membername':_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x22')](_0x4fa69a[_0xd1f8('0x20')]['lastIndexOf']('/')+0x1,_0x4fa69a[_0xd1f8('0x20')][_0xd1f8('0x21')]('-'))},_[_0xd1f8('0x23')](_0x4fa69a,[_0xd1f8('0x24'),_0xd1f8('0x25')]));logger[_0xd1f8('0x26')](_0xd1f8('0x27'),_0x4fa69a['uniqueid'],this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]['membername'],this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]['interface']);logger[_0xd1f8('0x1b')](_0xd1f8('0x28'),_0x4fa69a['uniqueid'],util[_0xd1f8('0x29')](this['channels'][_0x4fa69a[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xe')][_0x4fa69a[_0xd1f8('0x1d')]])_[_0xd1f8('0x1e')](this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]],this[_0xd1f8('0xe')][_0x4fa69a[_0xd1f8('0x1d')]]);this[_0xd1f8('0x1a')]('voice:outbound',_0xd1f8('0x2a'),this['channels'][_0x4fa69a[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x2b'),_0x4fa69a['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x4fa69a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd1f8('0x1a')]('custom:dialbegin',this[_0xd1f8('0xb')][_0x4fa69a[_0xd1f8('0x1d')]]);}}}catch(_0x1e4665){logger[_0xd1f8('0x2c')](_0xd1f8('0x2d'),_0x4fa69a[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x1e4665,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')]['syncDialEnd']=function(_0x5226){try{if(this[_0xd1f8('0x18')](_0x5226)){logger[_0xd1f8('0x1b')](_0xd1f8('0x2e'),_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x5226,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x5226['uniqueid']]){this['channels'][_0x5226['uniqueid']][_0xd1f8('0x2f')]=_0x5226[_0xd1f8('0x2f')];if(_0x5226[_0xd1f8('0x2f')]==='ANSWER'){this['channels'][_0x5226[_0xd1f8('0x1d')]]['connectedlinenum']=_0x5226[_0xd1f8('0x30')];this['channels'][_0x5226[_0xd1f8('0x1d')]][_0xd1f8('0x31')]=_0x5226[_0xd1f8('0x31')];this['channels'][_0x5226[_0xd1f8('0x1d')]]['answertime']=moment()[_0xd1f8('0x1f')](_0xd1f8('0x32'));this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]][_0xd1f8('0x33')]=_0xd1f8('0x34');logger[_0xd1f8('0x26')](_0xd1f8('0x35'),_0x5226[_0xd1f8('0x1d')],_0x5226[_0xd1f8('0x20')][_0xd1f8('0x22')](_0x5226[_0xd1f8('0x20')][_0xd1f8('0x21')]('/')+0x1,_0x5226[_0xd1f8('0x20')]['lastIndexOf']('-')));logger[_0xd1f8('0x1b')](_0xd1f8('0x36'),_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd1f8('0x37'),this[_0xd1f8('0xb')][_0x5226['uniqueid']]);}logger[_0xd1f8('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this['channels'][_0x5226[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));this[_0xd1f8('0x1a')]('voice:outbound',_0xd1f8('0x2a'),this[_0xd1f8('0xb')][_0x5226[_0xd1f8('0x1d')]]);}}}catch(_0x3f3be9){logger['error']('[%s][voiceDialReport][dialend]',_0x5226[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x3f3be9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x14')]=function(_0x19c9ba){try{if(this[_0xd1f8('0x18')](_0x19c9ba)){logger[_0xd1f8('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x19c9ba[_0xd1f8('0x1d')],util['inspect'](_0x19c9ba,{'showHidden':![],'depth':null}));this['addVariable'](_0x19c9ba[_0xd1f8('0x1d')],_[_0xd1f8('0x38')](_0x19c9ba['variable'])[0x0],_0x19c9ba[_0xd1f8('0x39')]);if(this[_0xd1f8('0x18')](_0x19c9ba['variable'])&&this[_0xd1f8('0x18')](_0x19c9ba['variable']['outboundrouteid'])){if(_['isUndefined'](this[_0xd1f8('0xb')][_0x19c9ba['uniqueid']])){this[_0xd1f8('0xb')][_0x19c9ba[_0xd1f8('0x1d')]]={'routeId':_0x19c9ba[_0xd1f8('0x39')],'variables':this[_0xd1f8('0x3a')][_0x19c9ba['uniqueid']],'motionChannel':'voice'};logger[_0xd1f8('0x26')](_0xd1f8('0x3b'),_0x19c9ba['uniqueid'],_0x19c9ba[_0xd1f8('0x3c')]['outboundrouteid'],_[_0xd1f8('0x38')](_0x19c9ba[_0xd1f8('0x3c')])[0x0],_0x19c9ba['value']);logger['debug'](_0xd1f8('0x3d'),_0x19c9ba[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this['channels'][_0x19c9ba['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd1f8('0x1a')](_0xd1f8('0x3e'),_0xd1f8('0x2a'),this['channels'][_0x19c9ba[_0xd1f8('0x1d')]]);}}}}catch(_0x279153){logger[_0xd1f8('0x2c')](_0xd1f8('0x3f'),_0x19c9ba['uniqueid'],util[_0xd1f8('0x29')](_0x279153,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x40')]=function(_0x33db82,_0xb0e42d,_0x44c86d){var _0x572fb3=[_0xd1f8('0x41'),_0xd1f8('0x42'),_0xd1f8('0x43'),_0xd1f8('0x44'),_0xd1f8('0x45'),_0xd1f8('0x46'),'rtpaudioqosrtt',_0xd1f8('0x47'),_0xd1f8('0x48'),'sipuri','bridgepeer','bridgepvtcallid',_0xd1f8('0x49'),'memberdynamic',_0xd1f8('0x4a'),_0xd1f8('0x4b'),'membername','memberpenalty',_0xd1f8('0x4c')];if(!_['isNil'](_0xb0e42d)&&!_[_0xd1f8('0x4d')](_0x572fb3,_0xb0e42d)){if(_[_0xd1f8('0x19')](this[_0xd1f8('0x3a')][_0x33db82])){this[_0xd1f8('0x3a')][_0x33db82]={};}this['variables'][_0x33db82][_0xb0e42d]=_0x44c86d;}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x16')]=function(_0x48249c){try{if(this[_0xd1f8('0x18')](_0x48249c)){logger[_0xd1f8('0x1b')](_0xd1f8('0x4e'),_0x48249c[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x48249c,{'showHidden':![],'depth':null}));if(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]){logger[_0xd1f8('0x26')](_0xd1f8('0x4f'),_0x48249c[_0xd1f8('0x1d')],_0x48249c['cause-txt']);this['channels'][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x50')]=moment()[_0xd1f8('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x51')]=moment(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x50')])['diff'](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x52')],_0xd1f8('0x53'));this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x33')]=_0xd1f8('0x54');this[_0xd1f8('0xd')][_0xd1f8('0x55')]+=0x1;if(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x56')]){this['outbound'][_0xd1f8('0x57')]+=0x1;this[_0xd1f8('0xb')][_0x48249c['uniqueid']]['holdtime']=moment(this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x56')])[_0xd1f8('0x58')](this['channels'][_0x48249c['uniqueid']][_0xd1f8('0x52')],_0xd1f8('0x53'));this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x59')]=moment(this[_0xd1f8('0xb')][_0x48249c['uniqueid']]['endtime'])[_0xd1f8('0x58')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]['answertime'],_0xd1f8('0x53'));this[_0xd1f8('0xd')][_0xd1f8('0x5a')]+=this['channels'][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x5b')]||0x0;this['outbound'][_0xd1f8('0x5c')]+=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]][_0xd1f8('0x59')];}this['outbound']['sumDuration']+=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]['duration'];logger['debug'](_0xd1f8('0x5d'),_0x48249c['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd1f8('0x5e'),this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x5f'),_0x48249c[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xd1f8('0x1a')](_0xd1f8('0x60'),this['channels'][_0x48249c[_0xd1f8('0x1d')]]);logger[_0xd1f8('0x1b')](_0xd1f8('0x61'),_0x48249c[_0xd1f8('0x1d')],util['inspect'](this[_0xd1f8('0xb')][_0x48249c['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xd1f8('0x3e'),'voice_outbound:save',this[_0xd1f8('0xd')]);logger[_0xd1f8('0x26')](_0xd1f8('0x62'),JSON[_0xd1f8('0x63')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]));logger['debug'](_0xd1f8('0x64'),_0x48249c['uniqueid'],util[_0xd1f8('0x29')](this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0xd1f8('0x3e'),'voice_outbound_channel:remove',this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x1d')]]);this[_0xd1f8('0x65')](_0x48249c[_0xd1f8('0x1d')]);}else if(this[_0xd1f8('0xb')][_0x48249c['linkedid']]){this['channels'][_0x48249c[_0xd1f8('0x66')]][_0xd1f8('0x1d')]=this[_0xd1f8('0xb')][_0x48249c[_0xd1f8('0x66')]][_0xd1f8('0x67')];}if(this['variables'][_0x48249c[_0xd1f8('0x1d')]]){delete this[_0xd1f8('0x3a')][_0x48249c[_0xd1f8('0x1d')]];}}}catch(_0x197c21){logger[_0xd1f8('0x2c')]('[%s][voiceDialReport][hangup]',_0x48249c[_0xd1f8('0x1d')],util['inspect'](_0x197c21,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x68')]=function(_0x5f1234){try{if(this[_0xd1f8('0x18')](_0x5f1234)){logger[_0xd1f8('0x1b')](_0xd1f8('0x69'),_0x5f1234[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x5f1234,{'showHidden':![],'depth':null}));if(_0x5f1234[_0xd1f8('0x6a')][_0xd1f8('0x6b')]()===_0xd1f8('0x6c')){_0x5f1234[_0xd1f8('0x6d')]=(_0x5f1234['appdata']||_0x5f1234['applicationdata'])[_0xd1f8('0x6b')]();if(_[_0xd1f8('0x6e')](_0x5f1234[_0xd1f8('0x6d')],_0xd1f8('0x6f'))){if(_['isUndefined'](this['applications'][_0x5f1234['uniqueid']]))this[_0xd1f8('0xe')][_0x5f1234[_0xd1f8('0x1d')]]={};logger[_0xd1f8('0x26')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5f1234[_0xd1f8('0x1d')],_0x5f1234[_0xd1f8('0x6a')],_0x5f1234[_0xd1f8('0x6d')]);var _0x51551a=_0x5f1234[_0xd1f8('0x6d')][_0xd1f8('0x70')]('=');var _0x16e2ef=_0x51551a[0x0][_0xd1f8('0x71')](/cdr\((.*)\)/);if(_0x16e2ef)this['applications'][_0x5f1234[_0xd1f8('0x1d')]][_0x16e2ef[0x1]]=_0x51551a[0x1];}}}}catch(_0x1ea98c){logger[_0xd1f8('0x2c')](_0xd1f8('0x72'),_0x5f1234[_0xd1f8('0x1d')],util[_0xd1f8('0x29')](_0x1ea98c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd1f8('0x17')][_0xd1f8('0x65')]=function(_0x2d2438,_0x2ec88c=0x2710){if(this[_0xd1f8('0xb')][_0x2d2438]){setTimeout(()=>{delete this[_0xd1f8('0xb')][_0x2d2438];},_0x2ec88c);}};module[_0xd1f8('0x73')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 910608f..bc1884a 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 _0x4069=['[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','campaigns','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','debug','name','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','outbound','custom:queuesummary','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','add','seconds','YYYY-MM-DD\x20HH:mm:ss','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','value','variable','TIMEOUT','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','includes','handleHangup','length','sumHoldTime','sumDuration','milliseconds','diff','total','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','syncHangup'];(function(_0x4cd107,_0x205eaa){var _0x95734d=function(_0x5bc5d9){while(--_0x5bc5d9){_0x4cd107['push'](_0x4cd107['shift']());}};_0x95734d(++_0x205eaa);}(_0x4069,0x123));var _0x9406=function(_0x9ec050,_0x32ec72){_0x9ec050=_0x9ec050-0x0;var _0x274462=_0x4069[_0x9ec050];return _0x274462;};'use strict';var _=require('lodash');var moment=require(_0x9406('0x0'));var util=require(_0x9406('0x1'));var Redis=require(_0x9406('0x2'));var config=require('../../../config/environment');var logger=require(_0x9406('0x3'))(_0x9406('0x4'));var ami=require(_0x9406('0x5'));var QueueReport=require(_0x9406('0x6'));var VoiceQueueSummary=require(_0x9406('0x7'));config['redis']=_[_0x9406('0x8')](config['redis'],{'host':_0x9406('0x9'),'port':0x18eb});var io=require(_0x9406('0xa'))(new Redis(config[_0x9406('0xb')]));var Sequence=function(){};Sequence[_0x9406('0xc')][_0x9406('0xd')]=function(_0x419ee7){this[_0x9406('0xe')]=this[_0x9406('0xe')]?this[_0x9406('0xe')][_0x9406('0xf')](_0x419ee7):_0x419ee7();};function VoiceQueueReport(_0x3d8362){this[_0x9406('0x10')]=new Sequence();this[_0x9406('0x11')]={};this[_0x9406('0x12')]=_0x3d8362;this[_0x9406('0x13')]=_0x3d8362['agents'];this[_0x9406('0x14')]=_0x3d8362[_0x9406('0x15')];this['voiceQueues']=_0x3d8362[_0x9406('0x16')];this['campaigns']=_0x3d8362['campaigns'];this[_0x9406('0x17')]=initializeSummary();this[_0x9406('0x18')]={};ami['on'](_0x9406('0x19'),this[_0x9406('0x1a')][_0x9406('0x1b')](this));ami['on']('queuesummarycomplete',this[_0x9406('0x1c')]['bind'](this));ami['on'](_0x9406('0x1d'),this[_0x9406('0x1e')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x1f'),this[_0x9406('0x20')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x21'),this[_0x9406('0x22')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x23'),this[_0x9406('0x24')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x25'),this[_0x9406('0x26')]['bind'](this));ami['on'](_0x9406('0x27'),this[_0x9406('0x28')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x29'),this[_0x9406('0x2a')]['bind'](this));ami['on'](_0x9406('0x2b'),this[_0x9406('0x2c')]['bind'](this));ami['on'](_0x9406('0x2d'),this['syncHangup'][_0x9406('0x1b')](this));ami['on'](_0x9406('0x2e'),this[_0x9406('0x2f')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x30'),this[_0x9406('0x31')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x32'),this[_0x9406('0x33')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x34'),this[_0x9406('0x35')][_0x9406('0x1b')](this));ami['on'](_0x9406('0x36'),this[_0x9406('0x37')][_0x9406('0x1b')](this));this[_0x9406('0x38')]();this[_0x9406('0x39')]();}function clearChannels(_0x2b88ff){if(!_[_0x9406('0x3a')](_0x2b88ff)){for(var _0x459a1b in _0x2b88ff){if(_0x2b88ff[_0x9406('0x3b')](_0x459a1b)){delete _0x2b88ff[_0x459a1b];}}}}function clearCampaigns(_0x28a7e2){if(!_[_0x9406('0x3a')](_0x28a7e2)){for(var _0x1366f5 in _0x28a7e2){if(_0x28a7e2['hasOwnProperty'](_0x1366f5)){_0x28a7e2[_0x1366f5][_0x9406('0x3c')]=0x0;}}}}function clearVoiceQueues(_0x4b08e4){if(!_['isEmpty'](_0x4b08e4)){for(var _0x319d9e in _0x4b08e4){if(_0x4b08e4['hasOwnProperty'](_0x319d9e)){_0x4b08e4[_0x319d9e][_0x9406('0x3c')]=0x0;_0x4b08e4[_0x319d9e][_0x9406('0x3d')]=0x0;_0x4b08e4[_0x319d9e][_0x9406('0x3e')]=0x0;_0x4b08e4[_0x319d9e][_0x9406('0x3f')]=0x0;_0x4b08e4[_0x319d9e][_0x9406('0x40')]=!![];}}}}function clearAgentBooked(_0x40b23d){if(!_['isEmpty'](_0x40b23d)){for(var _0x277619 in _0x40b23d){if(_0x40b23d[_0x9406('0x3b')](_0x277619)){_0x40b23d[_0x277619][_0x9406('0x41')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x3e47eb){return _0x3e47eb[_0x9406('0x42')]||_0x3e47eb[_0x9406('0x23')]||_0x3e47eb[_0x9406('0x43')];}VoiceQueueReport[_0x9406('0xc')]['clearZombieChannels']=function(){var _0x40d06b=this;for(var _0x1e7c3 in this[_0x9406('0x14')]){if(this[_0x9406('0x14')][_0x9406('0x3b')](_0x1e7c3)&&!this[_0x9406('0x14')][_0x1e7c3][_0x9406('0x44')]){this[_0x9406('0x10')]['enqueue'](function(){if(!_[_0x9406('0x45')](_0x40d06b[_0x9406('0x14')][_0x1e7c3])){return ami[_0x9406('0x46')]({'action':_0x9406('0x47'),'channel':_0x40d06b[_0x9406('0x14')][_0x1e7c3][_0x9406('0x48')]})[_0x9406('0x49')](function(_0x1e8dc8){if(_0x1e8dc8[_0x9406('0x4a')]===_0x9406('0x4b')){setTimeout(function(){if(_0x40d06b[_0x9406('0x14')][_0x1e7c3]){delete _0x40d06b[_0x9406('0x14')][_0x1e7c3];logger[_0x9406('0x4c')]('[%s][voiceQueueReport][checkChannel]',_0x1e7c3,util[_0x9406('0x4d')](_0x1e8dc8,{'showHidden':![],'depth':null}));}if(_0x40d06b[_0x9406('0x11')][_0x1e7c3]){delete _0x40d06b[_0x9406('0x11')][_0x1e7c3];logger[_0x9406('0x4c')](_0x9406('0x4e'),_0x1e7c3,util[_0x9406('0x4d')](_0x1e8dc8,{'showHidden':![],'depth':null}));}if(_0x40d06b['variables'][_0x1e7c3]){delete _0x40d06b[_0x9406('0x18')][_0x1e7c3];logger['error'](_0x9406('0x4f'),_0x1e7c3,util[_0x9406('0x4d')](_0x1e8dc8,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9406('0x2f')]=function(){logger[_0x9406('0x4c')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x9406('0x14')]);this[_0x9406('0x50')](this[_0x9406('0x11')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x9406('0x16')]);clearCampaigns(this[_0x9406('0x51')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x50')]=function(_0x52284c){var _0x39d135=this;if(!_[_0x9406('0x3a')](_0x52284c)){for(var _0x31861c in _0x52284c){if(_0x52284c['hasOwnProperty'](_0x31861c)){_0x39d135['emitVoiceQueueChannelRemove'](_0x52284c[_0x31861c],_0x9406('0x52'));delete _0x52284c[_0x31861c];}}}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x53')]=function(_0x5811cd,_0x1bf8b0,_0x1e3781){io['to'](_0x5811cd)[_0x9406('0x53')](_0x1bf8b0,_0x1e3781);};VoiceQueueReport[_0x9406('0xc')]['emitVoiceQueueChannelSave']=function(_0x3725ce,_0x5d8fbb){logger['debug'](_0x9406('0x54')+_0x5d8fbb+_0x9406('0x55'),_0x3725ce['uniqueid'],util[_0x9406('0x4d')](_0x3725ce,{'showHidden':![],'depth':null}));this['emit'](util[_0x9406('0x56')](_0x9406('0x57'),_0x3725ce[_0x9406('0x58')]),_0x9406('0x59'),_0x3725ce);io[_0x9406('0x53')](_0x9406('0x5a'),_0x3725ce);};VoiceQueueReport['prototype'][_0x9406('0x5b')]=function(_0x1b85ca,_0x443cb7){logger['debug'](_0x9406('0x54')+_0x443cb7+_0x9406('0x5c'),_0x1b85ca['uniqueid'],util[_0x9406('0x4d')](_0x1b85ca,{'showHidden':![],'depth':null}));if(_0x1b85ca[_0x9406('0x5d')]===_0x9406('0x5e')){return;}this[_0x9406('0x53')](util['format']('voice:queue:%s',_0x1b85ca[_0x9406('0x58')]),'voice_queue_channel:remove',_0x1b85ca);io['emit'](_0x9406('0x5f'),_0x1b85ca);};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x60')]=function(_0xf3a1ae){if(_0xf3a1ae[_0x9406('0x61')]===_0x9406('0x62')){logger[_0x9406('0x63')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0xf3a1ae,{'showHidden':![],'depth':null}));this[_0x9406('0x53')](util[_0x9406('0x56')](_0x9406('0x57'),_0xf3a1ae[_0x9406('0x64')]),_0x9406('0x65'),_0xf3a1ae);}};VoiceQueueReport[_0x9406('0xc')]['isNotNull']=function(_0x5ec5d2){return _0x5ec5d2!==null&&!_[_0x9406('0x66')](_0x5ec5d2);};VoiceQueueReport['prototype'][_0x9406('0x39')]=function(){var _0x30fc46=this;setInterval(function(){_0x30fc46['clearZombieChannels']();ami[_0x9406('0x46')]({'action':_0x9406('0x67')})[_0x9406('0x49')](function(_0x60c46f){logger['error'](_0x9406('0x68'),util[_0x9406('0x4d')](_0x60c46f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x9406('0x38')]=function(){var _0x58be1e=this;setInterval(function(){if(!_0x58be1e[_0x9406('0x17')][_0x9406('0x69')]){return ami[_0x9406('0x46')]({'action':'queuesummary'})[_0x9406('0x6a')](function(_0xb49624){_0x58be1e[_0x9406('0x17')]['id']=_0xb49624[_0x9406('0x6b')];_0x58be1e['summary'][_0x9406('0x69')]=!![];_0x58be1e[_0x9406('0x17')][_0x9406('0x6c')][_0xb49624['actionid']]={};})[_0x9406('0x49')](function(_0x8247eb){logger[_0x9406('0x4c')](_0x9406('0x6d'),util['inspect'](_0x8247eb,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x6e')]=function(_0x497711,_0x3a5fdc){var _0x5dc24c;if(this[_0x9406('0x17')]&&this['summary'][_0x9406('0x67')]&&this[_0x9406('0x17')][_0x9406('0x67')][_0x497711[_0x9406('0x64')]]){_0x5dc24c=this[_0x9406('0x17')][_0x9406('0x67')][_0x497711[_0x9406('0x64')]]['summaryEvent'];}var _0x38f7eb=new VoiceQueueSummary(_0x497711);return _0x38f7eb[_0x9406('0x6f')](_0x3a5fdc[_0x9406('0x13')],this[_0x9406('0x13')],_0x5dc24c,this[_0x9406('0x12')][_0x9406('0x14')]);};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x70')]=function(_0x950f26,_0x30763f){var _0x1ee219=this['createQueueSummaryReport'](_0x950f26,_0x30763f);var _0x4e5192=![];_0x4e5192=_0x1ee219[_0x9406('0x71')](_0x950f26);if(_0x4e5192){Object[_0x9406('0x72')](_0x950f26,_0x1ee219);this['realtime'][_0x9406('0x16')][_0x950f26[_0x9406('0x64')]]=_0x950f26;this['emitInboundVoiceQueueSummary'](_0x1ee219);}};VoiceQueueReport[_0x9406('0xc')]['syncQueueStatusComplete']=function(_0x1ab377){var _0x3591c0=null;var _0x27ec97=this[_0x9406('0x17')]['id'];if(this[_0x9406('0x17')][_0x9406('0x6c')][_0x27ec97]){_0x3591c0=this[_0x9406('0x17')][_0x9406('0x6c')][_0x27ec97][_0x1ab377[_0x9406('0x6b')]];}if(!_0x3591c0){this[_0x9406('0x17')]=initializeSummary();return;}var _0x580aca=this['voiceQueues'][_0x3591c0[_0x9406('0x58')]];if(_0x580aca[_0x9406('0x61')]===_0x9406('0x62')){this['handleInboundQueueSummaryReport'](_0x580aca,_0x3591c0);}else if(_0x580aca[_0x9406('0x61')]===_0x9406('0x73')){var _0x316ae9=this['createQueueSummaryReport'](_0x580aca,_0x3591c0);ami['emit'](_0x9406('0x74'),_0x316ae9);}this[_0x9406('0x17')][_0x9406('0x75')]-=0x1;var _0x3ab036=this[_0x9406('0x17')][_0x9406('0x75')]>0x0?!![]:![];if(!_0x3ab036){return this['syncQueueSummaryComplete'](this[_0x9406('0x17')][_0x9406('0x76')]);}};VoiceQueueReport[_0x9406('0xc')]['syncQueueMember']=function(_0x112c3c){var _0x53f95b=this[_0x9406('0x17')]['id'];if(this[_0x9406('0x17')]['queuestatus'][_0x53f95b]&&this[_0x9406('0x17')][_0x9406('0x6c')][_0x53f95b][_0x112c3c[_0x9406('0x6b')]]){this[_0x9406('0x17')][_0x9406('0x6c')][_0x53f95b][_0x112c3c['actionid']][_0x9406('0x13')][_0x9406('0x77')](_0x112c3c);}};VoiceQueueReport[_0x9406('0xc')]['syncQueueSummary']=function(_0x483240){var _0x243b19=this;try{if(this['isNotNull'](_0x483240)&&this[_0x9406('0x78')](_0x483240[_0x9406('0x58')])){logger[_0x9406('0x63')](_0x9406('0x79'),util[_0x9406('0x4d')](_0x483240,{'showHidden':![],'depth':null}));var _0x3c73e0=this[_0x9406('0x16')][_0x483240['queue']];if(_0x3c73e0){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x3c73e0[_0x9406('0x64')]);this[_0x9406('0x17')][_0x9406('0x67')][_0x3c73e0['name']]={'summaryEvent':_0x483240};this[_0x9406('0x17')][_0x9406('0x75')]+=0x1;return ami[_0x9406('0x46')]({'action':_0x9406('0x6c'),'queue':_0x3c73e0[_0x9406('0x64')]})[_0x9406('0x6a')](function(_0x161243){if(!_0x243b19[_0x9406('0x17')]['queuestatus'][_0x483240[_0x9406('0x6b')]]){_0x243b19[_0x9406('0x17')]['queuestatus'][_0x483240[_0x9406('0x6b')]]={};}_0x243b19[_0x9406('0x17')]['queuestatus'][_0x483240[_0x9406('0x6b')]][_0x161243['actionid']]={'queue':_0x3c73e0[_0x9406('0x64')],'agents':[]};})['catch'](function(_0x5c5ace){throw _0x5c5ace;});}}}catch(_0x3a9f8b){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x3a9f8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x1c')]=function(_0x3f2077){if(this[_0x9406('0x17')]['statusRequests']>0x0){this[_0x9406('0x17')][_0x9406('0x76')]=_0x3f2077;return;}logger['debug'](_0x9406('0x7a'),util[_0x9406('0x4d')](_0x3f2077,{'showHidden':![],'depth':null}));this[_0x9406('0x17')]=initializeSummary();ami['emit'](_0x9406('0x7b'),{});};VoiceQueueReport[_0x9406('0xc')]['syncQueueCallerJoin']=function(_0x32bdc2){try{if(this[_0x9406('0x78')](_0x32bdc2)){logger[_0x9406('0x63')](_0x9406('0x7c'),_0x32bdc2[_0x9406('0x7d')],util['inspect'](_0x32bdc2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9406('0x11')][_0x32bdc2[_0x9406('0x7d')]])){this[_0x9406('0x11')][_0x32bdc2[_0x9406('0x7d')]]=[];}if(_[_0x9406('0x66')](this['channels'][_0x32bdc2[_0x9406('0x7d')]])){this[_0x9406('0x14')][_0x32bdc2[_0x9406('0x7d')]]={};}var _0x5c21e0=new QueueReport();_0x5c21e0['queue']=_0x32bdc2['queue'];_0x5c21e0[_0x9406('0x61')]=this[_0x9406('0x16')][_0x5c21e0['queue']]&&this[_0x9406('0x16')][_0x5c21e0[_0x9406('0x58')]]['type']?this[_0x9406('0x16')][_0x5c21e0[_0x9406('0x58')]][_0x9406('0x61')]||_0x9406('0x62'):_0x9406('0x62');_0x5c21e0[_0x9406('0x7e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c21e0[_0x9406('0x7f')]=_0x32bdc2[_0x9406('0x7f')];_0x5c21e0[_0x9406('0x80')]=_0x32bdc2[_0x9406('0x80')];_0x5c21e0[_0x9406('0x7d')]=_0x32bdc2[_0x9406('0x7d')];logger[_0x9406('0x81')](_0x9406('0x82'),_0x5c21e0[_0x9406('0x58')],_0x5c21e0[_0x9406('0x61')]);Object[_0x9406('0x72')](_0x5c21e0,_[_0x9406('0x83')](_0x32bdc2,_[_0x9406('0x84')](_0x5c21e0)));this['queueReports'][_0x32bdc2[_0x9406('0x7d')]]['push'](_0x5c21e0);this[_0x9406('0x14')][_0x32bdc2[_0x9406('0x7d')]]=_0x5c21e0;this[_0x9406('0x85')](_0x5c21e0,_0x9406('0x21'));}}catch(_0x20959a){logger[_0x9406('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x32bdc2['uniqueid'],util[_0x9406('0x4d')](_0x20959a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x24')]=function(_0x17b4bd){try{if(this[_0x9406('0x78')](_0x17b4bd)){logger[_0x9406('0x63')](_0x9406('0x86'),_0x17b4bd[_0x9406('0x7d')],util['inspect'](_0x17b4bd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x17b4bd[_0x9406('0x7d')]]){var _0x1b426d=_[_0x9406('0x87')](this[_0x9406('0x11')][_0x17b4bd[_0x9406('0x7d')]]);_0x1b426d['queuecallercomplete']=![];_0x1b426d[_0x9406('0x88')]=null;_0x1b426d[_0x9406('0x89')]=_0x17b4bd[_0x9406('0x89')];_0x1b426d['originalposition']=_0x17b4bd[_0x9406('0x8a')];_0x1b426d[_0x9406('0x23')]=!![];_0x1b426d[_0x9406('0x8b')]=moment()[_0x9406('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b426d[_0x9406('0x5d')]=_0x9406('0x8c');_0x1b426d[_0x9406('0x8d')]=null;logger[_0x9406('0x81')](_0x9406('0x8e'),_0x1b426d['queue'],_0x1b426d[_0x9406('0x61')]);this['channels'][_0x17b4bd[_0x9406('0x7d')]]=_0x1b426d;this[_0x9406('0x5b')](_0x1b426d,_0x9406('0x23'));}}}catch(_0x411982){logger[_0x9406('0x4c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x17b4bd[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x411982,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9406('0x26')]=function(_0x20c8ea){try{if(this[_0x9406('0x78')](_0x20c8ea)){logger[_0x9406('0x63')](_0x9406('0x8f'),_0x20c8ea['uniqueid'],util['inspect'](_0x20c8ea,{'showHidden':![],'depth':null}));if(this[_0x9406('0x11')][_0x20c8ea[_0x9406('0x7d')]]){var _0x4e2fec=_['last'](this[_0x9406('0x11')][_0x20c8ea[_0x9406('0x7d')]]);_0x4e2fec['queuecallerleaveAt']=moment()[_0x9406('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e2fec[_0x9406('0x90')]=_0x20c8ea[_0x9406('0x90')];_0x4e2fec[_0x9406('0x91')]=_0x20c8ea[_0x9406('0x91')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4e2fec[_0x9406('0x58')],_0x4e2fec[_0x9406('0x61')],_0x20c8ea['connectedlinenum'],_0x20c8ea[_0x9406('0x91')]);this[_0x9406('0x14')][_0x20c8ea[_0x9406('0x7d')]]=_0x4e2fec;this[_0x9406('0x85')](_0x4e2fec,_0x9406('0x25'));}}}catch(_0x4e2a93){logger[_0x9406('0x4c')](_0x9406('0x8f'),_0x20c8ea['uniqueid'],util['inspect'](_0x4e2a93,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')]['syncAgentConnect']=function(_0x3b9335){try{if(this[_0x9406('0x78')](_0x3b9335)){logger[_0x9406('0x63')]('[%s][voiceQueueReport][agentconnect]',_0x3b9335[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x3b9335,{'showHidden':![],'depth':null}));if(this[_0x9406('0x11')][_0x3b9335['uniqueid']]){var _0x113978=_[_0x9406('0x87')](this[_0x9406('0x11')][_0x3b9335[_0x9406('0x7d')]]);_0x113978[_0x9406('0x43')]=!![];_0x113978[_0x9406('0x5d')]=_0x9406('0x92');logger[_0x9406('0x81')](_0x9406('0x93'),_0x113978[_0x9406('0x58')],_0x113978[_0x9406('0x61')]);}}}catch(_0x14d7ac){logger['error'](_0x9406('0x94'),_0x3b9335[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x14d7ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0x28')]=function(_0x6a81a){try{if(this[_0x9406('0x78')](_0x6a81a)){logger['debug'](_0x9406('0x95'),_0x6a81a[_0x9406('0x7d')],util['inspect'](_0x6a81a,{'showHidden':![],'depth':null}));if(this[_0x9406('0x11')][_0x6a81a[_0x9406('0x7d')]]){var _0x3e7256=_['last'](this[_0x9406('0x11')][_0x6a81a[_0x9406('0x7d')]]);_0x3e7256[_0x9406('0x23')]=![];_0x3e7256[_0x9406('0x8b')]=null;_0x3e7256[_0x9406('0x96')]=!![];_0x3e7256[_0x9406('0x8d')]=_0x6a81a['membername'];_0x3e7256[_0x9406('0x89')]=_0x6a81a[_0x9406('0x89')];_0x3e7256['queuecallercomplete']=!![];_0x3e7256['queuecallerexit']=![];_0x3e7256[_0x9406('0x97')]=null;if(!_0x3e7256['transfer']){if(_0x6a81a[_0x9406('0x98')]==_0x9406('0x99')){_0x3e7256[_0x9406('0x5d')]=_0x9406('0x9a');logger[_0x9406('0x81')](_0x9406('0x9b'),_0x3e7256[_0x9406('0x58')],_0x3e7256[_0x9406('0x61')]);}else{if(_[_0x9406('0x9c')](_0x6a81a[_0x9406('0x48')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x6a81a[_0x9406('0x9d')]]){var _0xcd7c48=_[_0x9406('0x87')](this['queueReports'][_0x6a81a[_0x9406('0x9d')]]);_0xcd7c48['queuecallercomplete']=![];_0xcd7c48[_0x9406('0x42')]=!![];_0xcd7c48['queuecallerexitAt']=moment(_0x3e7256[_0x9406('0x7e')])[_0x9406('0x9e')](_0x6a81a['holdtime'],_0x9406('0x9f'))['format'](_0x9406('0xa0'));_0xcd7c48[_0x9406('0x5d')]=_0x9406('0xa1');_0xcd7c48[_0x9406('0x99')]=!![];_0xcd7c48[_0x9406('0xa2')]=_0x9406('0xa3');_0xcd7c48['transferexten']=_0x6a81a[_0x9406('0xa4')];_0xcd7c48[_0x9406('0xa5')]=_0x6a81a[_0x9406('0x7d')];logger['info'](_0x9406('0xa6'),_0xcd7c48[_0x9406('0x58')],_0xcd7c48[_0x9406('0x61')]);var _0xd5f191=this[_0x9406('0x11')][_0x6a81a['linkedid']];this[_0x9406('0x11')][_0x6a81a[_0x9406('0x9d')]]=this['queueReports'][_0x6a81a[_0x9406('0x7d')]];this[_0x9406('0x11')][_0x6a81a[_0x9406('0x7d')]]=_0xd5f191;}}else{_0x3e7256[_0x9406('0x5d')]=_0x9406('0xa7')+_0x6a81a[_0x9406('0x98')][_0x9406('0xa8')]();logger[_0x9406('0x81')](_0x9406('0xa9'),_0x3e7256[_0x9406('0x58')],_0x3e7256[_0x9406('0x61')],_0x3e7256[_0x9406('0x5d')]);}}}this[_0x9406('0x14')][_0x6a81a[_0x9406('0x7d')]]=_0x3e7256;}}}catch(_0x1d23d3){logger[_0x9406('0x4c')](_0x9406('0x95'),_0x6a81a[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x1d23d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')]['syncVarSet']=function(_0x2e2907){try{if(this['isNotNull'](_0x2e2907)){logger[_0x9406('0x63')]('[%s][voiceQueueReport][varset]',_0x2e2907[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x2e2907,{'showHidden':![],'depth':null}));this[_0x9406('0xaa')](_0x2e2907[_0x9406('0x7d')],_['keys'](_0x2e2907['variable'])[0x0],_0x2e2907[_0x9406('0xab')]);if(this[_0x9406('0x11')][_0x2e2907[_0x9406('0x7d')]]){var _0x447070=_[_0x9406('0x87')](this[_0x9406('0x11')][_0x2e2907['uniqueid']]);if(_0x447070){if(this[_0x9406('0x78')](_0x2e2907[_0x9406('0xac')])&&this[_0x9406('0x78')](_0x2e2907[_0x9406('0xac')][_0x9406('0x6c')])){switch(_0x2e2907[_0x9406('0xab')]){case'CONTINUE':_0x447070[_0x9406('0x42')]=![];_0x447070[_0x9406('0x97')]=null;break;case _0x9406('0xad'):_0x447070[_0x9406('0xae')]=_0x9406('0xaf');_0x447070[_0x9406('0x42')]=!![];_0x447070[_0x9406('0x97')]=moment()[_0x9406('0x56')](_0x9406('0xa0'));_0x447070[_0x9406('0xb0')]=moment()[_0x9406('0x56')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x9406('0xb1'),_0x2e2907[_0x9406('0x7d')],util[_0x9406('0x4d')](_0x447070,{'showHidden':![],'depth':null}));ami[_0x9406('0x53')](_0x9406('0xb2'),_0x447070);break;default:_0x447070[_0x9406('0x42')]=!![];_0x447070[_0x9406('0x97')]=moment()[_0x9406('0x56')](_0x9406('0xa0'));_0x447070[_0x9406('0xb0')]=moment()[_0x9406('0x56')]('YYYY-MM-DD\x20HH:mm:ss');}_0x447070[_0x9406('0x23')]=![];_0x447070[_0x9406('0x8b')]=null;_0x447070[_0x9406('0x5d')]=_0x2e2907[_0x9406('0xab')];this[_0x9406('0x14')][_0x2e2907[_0x9406('0x7d')]]=_0x447070;this[_0x9406('0x5b')](_0x447070,_0x9406('0x2b'));}else if(this[_0x9406('0x78')](_0x2e2907['variable'])&&this[_0x9406('0x78')](_0x2e2907[_0x9406('0xac')][_0x9406('0xb3')])){if(!_0x447070[_0x9406('0x23')]){_0x447070[_0x9406('0x42')]=!![];_0x447070[_0x9406('0x97')]=moment()[_0x9406('0x56')](_0x9406('0xa0'));_0x447070[_0x9406('0x5d')]=_0x9406('0xb4');_0x447070[_0x9406('0xb0')]=moment()['format'](_0x9406('0xa0'));this[_0x9406('0x14')][_0x2e2907[_0x9406('0x7d')]]=_0x447070;}}logger['info'](_0x9406('0xb5'),_0x2e2907[_0x9406('0x7d')],_0x447070['queue'],_0x447070[_0x9406('0x61')],_[_0x9406('0x84')](_0x2e2907['variable'])[0x0],_0x2e2907['value']);_0x447070[_0x9406('0x18')]=this[_0x9406('0x18')][_0x2e2907['uniqueid']];}}}}catch(_0x204a12){logger[_0x9406('0x4c')](_0x9406('0xb6'),_0x2e2907['uniqueid'],util[_0x9406('0x4d')](_0x204a12,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0xaa')]=function(_0x4e4773,_0x1e215c,_0x86a80a){var _0x5f387a=['rtpaudioqos',_0x9406('0xb7'),_0x9406('0xb8'),'rtpaudioqosjitterbridged',_0x9406('0xb9'),_0x9406('0xba'),_0x9406('0xbb'),'rtpaudioqosrttbridged',_0x9406('0xbc'),_0x9406('0xbd'),_0x9406('0xbe'),_0x9406('0xbf'),'membercalls','memberdynamic',_0x9406('0xc0'),_0x9406('0xc1'),_0x9406('0xc2'),'memberpenalty','memberrealtime'];if(!_[_0x9406('0x45')](_0x1e215c)&&!_[_0x9406('0xc3')](_0x5f387a,_0x1e215c)){if(_[_0x9406('0x66')](this[_0x9406('0x18')][_0x4e4773])){this['variables'][_0x4e4773]={};}this[_0x9406('0x18')][_0x4e4773][_0x1e215c]=_0x86a80a;}};VoiceQueueReport[_0x9406('0xc')][_0x9406('0xc4')]=function(_0x1033a6,_0x57b8ce,_0x12a497){try{var _0x5711e3={};if(this['queueReports'][_0x1033a6]){for(var _0x118bd7=0x0;_0x118bd7{delete this[_0x9406('0x14')][_0x5b08dd];},_0x32f4ac);}};module[_0x9406('0xfb')]=VoiceQueueReport; \ No newline at end of file +var _0x6fe1=['seconds','milliseconds','queuecallerjoinAt','ATTENDEDTRANSFER','total','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','application','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','../../../config/environment','ami','../ami','../model/voiceQueueSummary','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','queueChannels','campaigns','summary','variables','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','queuecallerexit','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','emit','debug','format','queue','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','createReport','compareToInboundQueue','assign','queuestatus','inbound','handleInboundQueueSummaryReport','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','length','sumHoldTime','diff'];(function(_0x30f675,_0x1115ee){var _0x445bde=function(_0x1c1a0d){while(--_0x1c1a0d){_0x30f675['push'](_0x30f675['shift']());}};_0x445bde(++_0x1115ee);}(_0x6fe1,0x12b));var _0x16fe=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x6fe1[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var moment=require(_0x16fe('0x0'));var util=require(_0x16fe('0x1'));var Redis=require('ioredis');var config=require(_0x16fe('0x2'));var logger=require('../../../config/logger')(_0x16fe('0x3'));var ami=require(_0x16fe('0x4'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x16fe('0x5'));config['redis']=_['defaults'](config[_0x16fe('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x16fe('0x7'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x16fe('0x8')][_0x16fe('0x9')]=function(_0x470740){this[_0x16fe('0xa')]=this['tail']?this['tail'][_0x16fe('0xb')](_0x470740):_0x470740();};function VoiceQueueReport(_0x14fa31){this[_0x16fe('0xc')]=new Sequence();this['queueReports']={};this[_0x16fe('0xd')]=_0x14fa31;this['agents']=_0x14fa31[_0x16fe('0xe')];this['channels']=_0x14fa31[_0x16fe('0xf')];this['voiceQueues']=_0x14fa31['voiceQueues'];this[_0x16fe('0x10')]=_0x14fa31[_0x16fe('0x10')];this[_0x16fe('0x11')]=initializeSummary();this[_0x16fe('0x12')]={};ami['on']('queuesummary',this[_0x16fe('0x13')][_0x16fe('0x14')](this));ami['on']('queuesummarycomplete',this[_0x16fe('0x15')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x16'),this[_0x16fe('0x17')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x18'),this[_0x16fe('0x19')]['bind'](this));ami['on'](_0x16fe('0x1a'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0x16fe('0x1b'),this[_0x16fe('0x1c')]['bind'](this));ami['on'](_0x16fe('0x1d'),this[_0x16fe('0x1e')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x1f'),this[_0x16fe('0x20')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x21'),this[_0x16fe('0x22')][_0x16fe('0x14')](this));ami['on']('varset',this[_0x16fe('0x23')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x24'),this[_0x16fe('0x25')]['bind'](this));ami['on'](_0x16fe('0x26'),this[_0x16fe('0x27')][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x28'),this['syncMusicOnHoldStart'][_0x16fe('0x14')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x16fe('0x14')](this));ami['on'](_0x16fe('0x29'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x16fe('0x2a'),this[_0x16fe('0x2b')]['bind'](this));this[_0x16fe('0x2c')]();this[_0x16fe('0x2d')]();}function clearChannels(_0x3925d5){if(!_[_0x16fe('0x2e')](_0x3925d5)){for(var _0x7c2df8 in _0x3925d5){if(_0x3925d5[_0x16fe('0x2f')](_0x7c2df8)){delete _0x3925d5[_0x7c2df8];}}}}function clearCampaigns(_0x2dc0ce){if(!_[_0x16fe('0x2e')](_0x2dc0ce)){for(var _0x1c32f7 in _0x2dc0ce){if(_0x2dc0ce['hasOwnProperty'](_0x1c32f7)){_0x2dc0ce[_0x1c32f7][_0x16fe('0x30')]=0x0;}}}}function clearVoiceQueues(_0x53adf9){if(!_[_0x16fe('0x2e')](_0x53adf9)){for(var _0xf08bf7 in _0x53adf9){if(_0x53adf9[_0x16fe('0x2f')](_0xf08bf7)){_0x53adf9[_0xf08bf7]['originated']=0x0;_0x53adf9[_0xf08bf7][_0x16fe('0x31')]=0x0;_0x53adf9[_0xf08bf7]['pTalking']=0x0;_0x53adf9[_0xf08bf7][_0x16fe('0x32')]=0x0;_0x53adf9[_0xf08bf7]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x14a530){if(!_[_0x16fe('0x2e')](_0x14a530)){for(var _0x150af6 in _0x14a530){if(_0x14a530['hasOwnProperty'](_0x150af6)){_0x14a530[_0x150af6][_0x16fe('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x137c78){return _0x137c78[_0x16fe('0x34')]||_0x137c78['queuecallerabandon']||_0x137c78['queuecallercomplete'];}VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x35')]=function(){var _0x2fdbab=this;for(var _0x3fa277 in this[_0x16fe('0x36')]){if(this[_0x16fe('0x36')][_0x16fe('0x2f')](_0x3fa277)&&!this[_0x16fe('0x36')][_0x3fa277][_0x16fe('0x37')]){this[_0x16fe('0xc')][_0x16fe('0x9')](function(){if(!_[_0x16fe('0x38')](_0x2fdbab[_0x16fe('0x36')][_0x3fa277])){return ami[_0x16fe('0x39')]({'action':_0x16fe('0x3a'),'channel':_0x2fdbab['channels'][_0x3fa277][_0x16fe('0x3b')]})[_0x16fe('0x3c')](function(_0x29ee23){if(_0x29ee23[_0x16fe('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2fdbab[_0x16fe('0x36')][_0x3fa277]){delete _0x2fdbab['channels'][_0x3fa277];logger[_0x16fe('0x3e')](_0x16fe('0x3f'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}if(_0x2fdbab[_0x16fe('0x41')][_0x3fa277]){delete _0x2fdbab[_0x16fe('0x41')][_0x3fa277];logger['error'](_0x16fe('0x42'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}if(_0x2fdbab[_0x16fe('0x12')][_0x3fa277]){delete _0x2fdbab[_0x16fe('0x12')][_0x3fa277];logger[_0x16fe('0x3e')](_0x16fe('0x43'),_0x3fa277,util[_0x16fe('0x40')](_0x29ee23,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x27')]=function(){logger[_0x16fe('0x3e')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x16fe('0x44')](this['queueReports']);clearAgentBooked(this[_0x16fe('0xe')]);clearVoiceQueues(this[_0x16fe('0x45')]);clearCampaigns(this['campaigns']);this[_0x16fe('0x11')]=initializeSummary();};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x44')]=function(_0x2a6e44){var _0x4ed3da=this;if(!_[_0x16fe('0x2e')](_0x2a6e44)){for(var _0x49061e in _0x2a6e44){if(_0x2a6e44[_0x16fe('0x2f')](_0x49061e)){_0x4ed3da[_0x16fe('0x46')](_0x2a6e44[_0x49061e],'clearqueuereport');delete _0x2a6e44[_0x49061e];}}}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x47')]=function(_0x56ca99,_0x3febca,_0x23a101){io['to'](_0x56ca99)[_0x16fe('0x47')](_0x3febca,_0x23a101);};VoiceQueueReport[_0x16fe('0x8')]['emitVoiceQueueChannelSave']=function(_0x19dda7,_0x6e4dc6){logger[_0x16fe('0x48')]('[%s][voiceQueueReport]['+_0x6e4dc6+']\x20sending\x20voice_queue_channel:save\x20event:',_0x19dda7['uniqueid'],util[_0x16fe('0x40')](_0x19dda7,{'showHidden':![],'depth':null}));this[_0x16fe('0x47')](util[_0x16fe('0x49')]('voice:queue:%s',_0x19dda7[_0x16fe('0x4a')]),_0x16fe('0x4b'),_0x19dda7);io[_0x16fe('0x47')](_0x16fe('0x4c'),_0x19dda7);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x46')]=function(_0x4eef95,_0x108b43){logger[_0x16fe('0x48')](_0x16fe('0x4d')+_0x108b43+_0x16fe('0x4e'),_0x4eef95[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x4eef95,{'showHidden':![],'depth':null}));if(_0x4eef95['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x16fe('0x47')](util['format']('voice:queue:%s',_0x4eef95[_0x16fe('0x4a')]),_0x16fe('0x50'),_0x4eef95);io[_0x16fe('0x47')]('voice_queue_presence:remove',_0x4eef95);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x51')]=function(_0x3cd5f7){if(_0x3cd5f7[_0x16fe('0x52')]==='inbound'){logger[_0x16fe('0x48')](_0x16fe('0x53'),util[_0x16fe('0x40')](_0x3cd5f7,{'showHidden':![],'depth':null}));this[_0x16fe('0x47')](util[_0x16fe('0x49')]('voice:queue:%s',_0x3cd5f7['name']),_0x16fe('0x54'),_0x3cd5f7);}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x55')]=function(_0x27d3c5){return _0x27d3c5!==null&&!_[_0x16fe('0x56')](_0x27d3c5);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x2d')]=function(){var _0x4bac8e=this;setInterval(function(){_0x4bac8e['clearZombieChannels']();ami[_0x16fe('0x39')]({'action':_0x16fe('0x57')})[_0x16fe('0x3c')](function(_0x2f5da2){logger[_0x16fe('0x3e')](_0x16fe('0x58'),util['inspect'](_0x2f5da2,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x2c')]=function(){var _0x270ee0=this;setInterval(function(){if(!_0x270ee0[_0x16fe('0x11')][_0x16fe('0x59')]){return ami[_0x16fe('0x39')]({'action':_0x16fe('0x5a')})[_0x16fe('0x5b')](function(_0x155e61){_0x270ee0[_0x16fe('0x11')]['id']=_0x155e61[_0x16fe('0x5c')];_0x270ee0[_0x16fe('0x11')][_0x16fe('0x59')]=!![];_0x270ee0[_0x16fe('0x11')]['queuestatus'][_0x155e61[_0x16fe('0x5c')]]={};})['catch'](function(_0x5a1a2e){logger[_0x16fe('0x3e')](_0x16fe('0x5d'),util[_0x16fe('0x40')](_0x5a1a2e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x5e')]=function(_0x2ef281,_0x3c8c10){var _0x171f81;if(this[_0x16fe('0x11')]&&this[_0x16fe('0x11')]['queues']&&this[_0x16fe('0x11')][_0x16fe('0x57')][_0x2ef281['name']]){_0x171f81=this[_0x16fe('0x11')][_0x16fe('0x57')][_0x2ef281[_0x16fe('0x5f')]]['summaryEvent'];}var _0x100b95=new VoiceQueueSummary(_0x2ef281);return _0x100b95[_0x16fe('0x60')](_0x3c8c10[_0x16fe('0xe')],this[_0x16fe('0xe')],_0x171f81,this[_0x16fe('0xd')][_0x16fe('0x36')]);};VoiceQueueReport[_0x16fe('0x8')]['handleInboundQueueSummaryReport']=function(_0x4168ae,_0x5b494c){var _0x41e59=this[_0x16fe('0x5e')](_0x4168ae,_0x5b494c);var _0x55ac58=![];_0x55ac58=_0x41e59[_0x16fe('0x61')](_0x4168ae);if(_0x55ac58){Object[_0x16fe('0x62')](_0x4168ae,_0x41e59);this[_0x16fe('0xd')][_0x16fe('0x45')][_0x4168ae[_0x16fe('0x5f')]]=_0x4168ae;this[_0x16fe('0x51')](_0x41e59);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x169135){var _0x407f6f=null;var _0x1ae1a4=this['summary']['id'];if(this[_0x16fe('0x11')][_0x16fe('0x63')][_0x1ae1a4]){_0x407f6f=this[_0x16fe('0x11')][_0x16fe('0x63')][_0x1ae1a4][_0x169135['actionid']];}if(!_0x407f6f){this['summary']=initializeSummary();return;}var _0x5a906c=this['voiceQueues'][_0x407f6f[_0x16fe('0x4a')]];if(_0x5a906c[_0x16fe('0x52')]===_0x16fe('0x64')){this[_0x16fe('0x65')](_0x5a906c,_0x407f6f);}else if(_0x5a906c['type']==='outbound'){var _0x101dea=this[_0x16fe('0x5e')](_0x5a906c,_0x407f6f);ami['emit'](_0x16fe('0x66'),_0x101dea);}this[_0x16fe('0x11')][_0x16fe('0x67')]-=0x1;var _0x4ca796=this[_0x16fe('0x11')]['statusRequests']>0x0?!![]:![];if(!_0x4ca796){return this['syncQueueSummaryComplete'](this[_0x16fe('0x11')][_0x16fe('0x68')]);}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x17')]=function(_0x24c6c9){var _0x3d9b22=this[_0x16fe('0x11')]['id'];if(this['summary']['queuestatus'][_0x3d9b22]&&this[_0x16fe('0x11')][_0x16fe('0x63')][_0x3d9b22][_0x24c6c9[_0x16fe('0x5c')]]){this[_0x16fe('0x11')][_0x16fe('0x63')][_0x3d9b22][_0x24c6c9['actionid']][_0x16fe('0xe')][_0x16fe('0x69')](_0x24c6c9);}};VoiceQueueReport[_0x16fe('0x8')]['syncQueueSummary']=function(_0x166b6f){var _0xae9606=this;try{if(this[_0x16fe('0x55')](_0x166b6f)&&this[_0x16fe('0x55')](_0x166b6f[_0x16fe('0x4a')])){logger[_0x16fe('0x48')](_0x16fe('0x6a'),util[_0x16fe('0x40')](_0x166b6f,{'showHidden':![],'depth':null}));var _0x22c357=this['voiceQueues'][_0x166b6f[_0x16fe('0x4a')]];if(_0x22c357){logger[_0x16fe('0x48')](_0x16fe('0x6b'),_0x22c357[_0x16fe('0x5f')]);this[_0x16fe('0x11')]['queues'][_0x22c357[_0x16fe('0x5f')]]={'summaryEvent':_0x166b6f};this['summary'][_0x16fe('0x67')]+=0x1;return ami[_0x16fe('0x39')]({'action':'queuestatus','queue':_0x22c357[_0x16fe('0x5f')]})[_0x16fe('0x5b')](function(_0x3245fe){if(!_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f[_0x16fe('0x5c')]]){_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f['actionid']]={};}_0xae9606[_0x16fe('0x11')][_0x16fe('0x63')][_0x166b6f[_0x16fe('0x5c')]][_0x3245fe[_0x16fe('0x5c')]]={'queue':_0x22c357[_0x16fe('0x5f')],'agents':[]};})['catch'](function(_0x4ca28a){throw _0x4ca28a;});}}}catch(_0x31b3ce){logger['error'](_0x16fe('0x5d'),util['inspect'](_0x31b3ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x15')]=function(_0x473dde){if(this[_0x16fe('0x11')]['statusRequests']>0x0){this['summary']['completeEvent']=_0x473dde;return;}logger[_0x16fe('0x48')](_0x16fe('0x6c'),util[_0x16fe('0x40')](_0x473dde,{'showHidden':![],'depth':null}));this[_0x16fe('0x11')]=initializeSummary();ami[_0x16fe('0x47')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x6d')]=function(_0x88f303){try{if(this[_0x16fe('0x55')](_0x88f303)){logger[_0x16fe('0x48')](_0x16fe('0x6e'),_0x88f303[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x88f303,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]])){this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]]=[];}if(_[_0x16fe('0x56')](this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]])){this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]]={};}var _0x12019a=new QueueReport();_0x12019a['queue']=_0x88f303[_0x16fe('0x4a')];_0x12019a[_0x16fe('0x52')]=this['voiceQueues'][_0x12019a['queue']]&&this[_0x16fe('0x45')][_0x12019a[_0x16fe('0x4a')]][_0x16fe('0x52')]?this[_0x16fe('0x45')][_0x12019a[_0x16fe('0x4a')]][_0x16fe('0x52')]||_0x16fe('0x64'):_0x16fe('0x64');_0x12019a['queuecallerjoinAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x12019a[_0x16fe('0x70')]=_0x88f303[_0x16fe('0x70')];_0x12019a['count']=_0x88f303[_0x16fe('0x71')];_0x12019a[_0x16fe('0x4f')]=_0x88f303[_0x16fe('0x4f')];logger[_0x16fe('0x72')](_0x16fe('0x73'),_0x12019a['queue'],_0x12019a['type']);Object[_0x16fe('0x62')](_0x12019a,_[_0x16fe('0x74')](_0x88f303,_[_0x16fe('0x75')](_0x12019a)));this[_0x16fe('0x41')][_0x88f303[_0x16fe('0x4f')]][_0x16fe('0x69')](_0x12019a);this[_0x16fe('0x36')][_0x88f303[_0x16fe('0x4f')]]=_0x12019a;this[_0x16fe('0x76')](_0x12019a,_0x16fe('0x1a'));}}catch(_0x116e02){logger[_0x16fe('0x3e')](_0x16fe('0x6e'),_0x88f303['uniqueid'],util[_0x16fe('0x40')](_0x116e02,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x1c')]=function(_0x308f1a){try{if(this[_0x16fe('0x55')](_0x308f1a)){logger[_0x16fe('0x48')](_0x16fe('0x77'),_0x308f1a[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x308f1a,{'showHidden':![],'depth':null}));if(this[_0x16fe('0x41')][_0x308f1a[_0x16fe('0x4f')]]){var _0x576cad=_[_0x16fe('0x78')](this['queueReports'][_0x308f1a[_0x16fe('0x4f')]]);_0x576cad[_0x16fe('0x79')]=![];_0x576cad[_0x16fe('0x7a')]=null;_0x576cad['holdtime']=_0x308f1a[_0x16fe('0x7b')];_0x576cad['originalposition']=_0x308f1a[_0x16fe('0x7c')];_0x576cad[_0x16fe('0x1b')]=!![];_0x576cad['queuecallerabandonAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x576cad[_0x16fe('0x7d')]=_0x16fe('0x7e');_0x576cad[_0x16fe('0x7f')]=null;logger[_0x16fe('0x72')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x576cad[_0x16fe('0x4a')],_0x576cad[_0x16fe('0x52')]);this[_0x16fe('0x36')][_0x308f1a['uniqueid']]=_0x576cad;this[_0x16fe('0x46')](_0x576cad,_0x16fe('0x1b'));}}}catch(_0x4007fa){logger[_0x16fe('0x3e')](_0x16fe('0x77'),_0x308f1a['uniqueid'],util[_0x16fe('0x40')](_0x4007fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x1e')]=function(_0x535d0f){try{if(this[_0x16fe('0x55')](_0x535d0f)){logger[_0x16fe('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x535d0f['uniqueid'],util['inspect'](_0x535d0f,{'showHidden':![],'depth':null}));if(this[_0x16fe('0x41')][_0x535d0f[_0x16fe('0x4f')]]){var _0x49e3a4=_[_0x16fe('0x78')](this['queueReports'][_0x535d0f[_0x16fe('0x4f')]]);_0x49e3a4[_0x16fe('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x49e3a4[_0x16fe('0x81')]=_0x535d0f['connectedlinenum'];_0x49e3a4[_0x16fe('0x82')]=_0x535d0f[_0x16fe('0x82')];logger[_0x16fe('0x72')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x49e3a4[_0x16fe('0x4a')],_0x49e3a4[_0x16fe('0x52')],_0x535d0f[_0x16fe('0x81')],_0x535d0f[_0x16fe('0x82')]);this[_0x16fe('0x36')][_0x535d0f[_0x16fe('0x4f')]]=_0x49e3a4;this[_0x16fe('0x76')](_0x49e3a4,_0x16fe('0x1d'));}}}catch(_0x105bca){logger[_0x16fe('0x3e')](_0x16fe('0x83'),_0x535d0f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x105bca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16fe('0x22')]=function(_0x57259f){try{if(this[_0x16fe('0x55')](_0x57259f)){logger[_0x16fe('0x48')](_0x16fe('0x84'),_0x57259f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x57259f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57259f[_0x16fe('0x4f')]]){var _0x3cbd22=_[_0x16fe('0x78')](this[_0x16fe('0x41')][_0x57259f[_0x16fe('0x4f')]]);_0x3cbd22['queuecallercomplete']=!![];_0x3cbd22[_0x16fe('0x7d')]=_0x16fe('0x85');logger['info'](_0x16fe('0x86'),_0x3cbd22[_0x16fe('0x4a')],_0x3cbd22[_0x16fe('0x52')]);}}}catch(_0xeeec1e){logger[_0x16fe('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x57259f[_0x16fe('0x4f')],util['inspect'](_0xeeec1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x20')]=function(_0x5a6894){try{if(this[_0x16fe('0x55')](_0x5a6894)){logger[_0x16fe('0x48')](_0x16fe('0x87'),_0x5a6894[_0x16fe('0x4f')],util['inspect'](_0x5a6894,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5a6894[_0x16fe('0x4f')]]){var _0x48beb9=_[_0x16fe('0x78')](this['queueReports'][_0x5a6894[_0x16fe('0x4f')]]);_0x48beb9[_0x16fe('0x1b')]=![];_0x48beb9[_0x16fe('0x88')]=null;_0x48beb9[_0x16fe('0x89')]=!![];_0x48beb9[_0x16fe('0x7f')]=_0x5a6894[_0x16fe('0x8a')];_0x48beb9[_0x16fe('0x7b')]=_0x5a6894['holdtime'];_0x48beb9[_0x16fe('0x79')]=!![];_0x48beb9[_0x16fe('0x34')]=![];_0x48beb9[_0x16fe('0x8b')]=null;if(!_0x48beb9[_0x16fe('0x8c')]){if(_0x5a6894['reason']==_0x16fe('0x8c')){_0x48beb9['queuecallerexitreason']='COMPLETED';logger[_0x16fe('0x72')](_0x16fe('0x8d'),_0x48beb9[_0x16fe('0x4a')],_0x48beb9[_0x16fe('0x52')]);}else{if(_['startsWith'](_0x5a6894[_0x16fe('0x3b')]['toLowerCase'](),_0x16fe('0x8e'))){if(this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]){var _0x4e3324=_['last'](this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]);_0x4e3324['queuecallercomplete']=![];_0x4e3324[_0x16fe('0x34')]=!![];_0x4e3324['queuecallerexitAt']=moment(_0x48beb9['queuecallerjoinAt'])[_0x16fe('0x90')](_0x5a6894['holdtime'],'seconds')[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e3324[_0x16fe('0x7d')]=_0x16fe('0x91');_0x4e3324[_0x16fe('0x8c')]=!![];_0x4e3324[_0x16fe('0x92')]=_0x16fe('0x93');_0x4e3324[_0x16fe('0x94')]=_0x5a6894[_0x16fe('0x95')];_0x4e3324['transferuniqueid']=_0x5a6894[_0x16fe('0x4f')];logger[_0x16fe('0x72')](_0x16fe('0x96'),_0x4e3324[_0x16fe('0x4a')],_0x4e3324['type']);var _0x1a5ba9=this['queueReports'][_0x5a6894[_0x16fe('0x8f')]];this[_0x16fe('0x41')][_0x5a6894[_0x16fe('0x8f')]]=this['queueReports'][_0x5a6894['uniqueid']];this[_0x16fe('0x41')][_0x5a6894['uniqueid']]=_0x1a5ba9;}}else{_0x48beb9[_0x16fe('0x7d')]=_0x16fe('0x97')+_0x5a6894[_0x16fe('0x98')][_0x16fe('0x99')]();logger[_0x16fe('0x72')](_0x16fe('0x9a'),_0x48beb9['queue'],_0x48beb9[_0x16fe('0x52')],_0x48beb9['queuecallerexitreason']);}}}this[_0x16fe('0x36')][_0x5a6894[_0x16fe('0x4f')]]=_0x48beb9;}}}catch(_0x467626){logger[_0x16fe('0x3e')](_0x16fe('0x87'),_0x5a6894[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x467626,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x23')]=function(_0x199d8f){try{if(this['isNotNull'](_0x199d8f)){logger[_0x16fe('0x48')](_0x16fe('0x9b'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x199d8f,{'showHidden':![],'depth':null}));this[_0x16fe('0x9c')](_0x199d8f[_0x16fe('0x4f')],_[_0x16fe('0x75')](_0x199d8f['variable'])[0x0],_0x199d8f[_0x16fe('0x9d')]);if(this[_0x16fe('0x41')][_0x199d8f[_0x16fe('0x4f')]]){var _0x510dfb=_[_0x16fe('0x78')](this[_0x16fe('0x41')][_0x199d8f[_0x16fe('0x4f')]]);if(_0x510dfb){if(this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')])&&this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')]['queuestatus'])){switch(_0x199d8f[_0x16fe('0x9d')]){case'CONTINUE':_0x510dfb[_0x16fe('0x34')]=![];_0x510dfb[_0x16fe('0x8b')]=null;break;case'TIMEOUT':_0x510dfb[_0x16fe('0x9f')]='timeout';_0x510dfb[_0x16fe('0x34')]=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));_0x510dfb[_0x16fe('0x80')]=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));logger[_0x16fe('0x48')](_0x16fe('0xa0'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x510dfb,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x510dfb);break;default:_0x510dfb['queuecallerexit']=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x510dfb['queuecallerleaveAt']=moment()[_0x16fe('0x49')](_0x16fe('0x6f'));}_0x510dfb[_0x16fe('0x1b')]=![];_0x510dfb[_0x16fe('0x88')]=null;_0x510dfb['queuecallerexitreason']=_0x199d8f['value'];this[_0x16fe('0x36')][_0x199d8f[_0x16fe('0x4f')]]=_0x510dfb;this[_0x16fe('0x46')](_0x510dfb,'varset');}else if(this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')])&&this[_0x16fe('0x55')](_0x199d8f[_0x16fe('0x9e')]['queueposition'])){if(!_0x510dfb['queuecallerabandon']){_0x510dfb[_0x16fe('0x34')]=!![];_0x510dfb[_0x16fe('0x8b')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x510dfb[_0x16fe('0x7d')]='EXITWITHKEY';_0x510dfb[_0x16fe('0x80')]=moment()[_0x16fe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x16fe('0x36')][_0x199d8f[_0x16fe('0x4f')]]=_0x510dfb;}}logger[_0x16fe('0x72')](_0x16fe('0xa1'),_0x199d8f[_0x16fe('0x4f')],_0x510dfb['queue'],_0x510dfb[_0x16fe('0x52')],_['keys'](_0x199d8f['variable'])[0x0],_0x199d8f[_0x16fe('0x9d')]);_0x510dfb[_0x16fe('0x12')]=this[_0x16fe('0x12')][_0x199d8f[_0x16fe('0x4f')]];}}}}catch(_0x5040c0){logger['error'](_0x16fe('0x9b'),_0x199d8f[_0x16fe('0x4f')],util[_0x16fe('0x40')](_0x5040c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16fe('0x8')][_0x16fe('0x9c')]=function(_0x196048,_0x267579,_0x491820){var _0x162ce0=[_0x16fe('0xa2'),_0x16fe('0xa3'),_0x16fe('0xa4'),_0x16fe('0xa5'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x16fe('0xa6'),_0x16fe('0xa7'),'sipcallid',_0x16fe('0xa8'),_0x16fe('0xa9'),'bridgepvtcallid',_0x16fe('0xaa'),_0x16fe('0xab'),_0x16fe('0xac'),_0x16fe('0xad'),_0x16fe('0x8a'),_0x16fe('0xae'),_0x16fe('0xaf')];if(!_[_0x16fe('0x38')](_0x267579)&&!_['includes'](_0x162ce0,_0x267579)){if(_[_0x16fe('0x56')](this[_0x16fe('0x12')][_0x196048])){this['variables'][_0x196048]={};}this[_0x16fe('0x12')][_0x196048][_0x267579]=_0x491820;}};VoiceQueueReport[_0x16fe('0x8')]['handleHangup']=function(_0x3670ce,_0x39590b,_0x3369bc){try{var _0x4c48ad={};if(this[_0x16fe('0x41')][_0x3670ce]){for(var _0x1c3493=0x0;_0x1c3493{delete this[_0x16fe('0x36')][_0x3ba40d];},_0x1d0b9f);}};module[_0x16fe('0xee')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 0dca8d6..eaaf4df 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 _0x2f16=['createHistory','queue','CreateReportAgentPreview','../client'];(function(_0x484e8b,_0x30d464){var _0x1578a6=function(_0x275eff){while(--_0x275eff){_0x484e8b['push'](_0x484e8b['shift']());}};_0x1578a6(++_0x30d464);}(_0x2f16,0x167));var _0x62f1=function(_0x141486,_0x58ed56){_0x141486=_0x141486-0x0;var _0x1b5fb9=_0x2f16[_0x141486];return _0x1b5fb9;};'use strict';var client=require(_0x62f1('0x0'));exports[_0x62f1('0x1')]=function(_0x23fe44){return function(){_0x23fe44['campaign']=_0x23fe44[_0x62f1('0x2')];return client['Request'](_0x62f1('0x3'),{'body':_0x23fe44,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file +var _0x282c=['Request','CreateReportAgentPreview','createHistory','queue'];(function(_0x4ae2c6,_0xb24392){var _0x4d521b=function(_0x543ff5){while(--_0x543ff5){_0x4ae2c6['push'](_0x4ae2c6['shift']());}};_0x4d521b(++_0xb24392);}(_0x282c,0x9e));var _0xc282=function(_0x3a0d65,_0x371f38){_0x3a0d65=_0x3a0d65-0x0;var _0xcb8c8e=_0x282c[_0x3a0d65];return _0xcb8c8e;};'use strict';var client=require('../client');exports[_0xc282('0x0')]=function(_0x59549a){return function(){_0x59549a['campaign']=_0x59549a[_0xc282('0x1')];return client[_0xc282('0x2')](_0xc282('0x3'),{'body':_0x59549a,'log':_0xc282('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 3bd9b1a..9bd24da 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 _0x69a2=['../client','Request','CreateAttachment'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x69a2,0x1a1));var _0x269a=function(_0x55e80b,_0x5dc57a){_0x55e80b=_0x55e80b-0x0;var _0x5da3dc=_0x69a2[_0x55e80b];return _0x5da3dc;};'use strict';var client=require(_0x269a('0x0'));exports['create']=function(_0x3687a1){return client[_0x269a('0x1')](_0x269a('0x2'),{'body':_0x3687a1,'log':_0x269a('0x2')});}; \ No newline at end of file +var _0x94e6=['Request','CreateAttachment','../client'];(function(_0x314813,_0x2f5f74){var _0x3d7b4d=function(_0x268221){while(--_0x268221){_0x314813['push'](_0x314813['shift']());}};_0x3d7b4d(++_0x2f5f74);}(_0x94e6,0x194));var _0x694e=function(_0x5bb110,_0x4e6bb1){_0x5bb110=_0x5bb110-0x0;var _0x2d211c=_0x94e6[_0x5bb110];return _0x2d211c;};'use strict';var client=require(_0x694e('0x0'));exports['create']=function(_0x32423f){return client[_0x694e('0x1')](_0x694e('0x2'),{'body':_0x32423f,'log':_0x694e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 313319a..a38313c 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 _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x4a5cce,_0x34265f){var _0x347252=function(_0x7d6755){while(--_0x7d6755){_0x4a5cce['push'](_0x4a5cce['shift']());}};_0x347252(++_0x34265f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x5044fa,_0x3ea92b){var _0x2427ae=function(_0x29db45){while(--_0x29db45){_0x5044fa['push'](_0x5044fa['shift']());}};_0x2427ae(++_0x3ea92b);}(_0x326f,0xd1));var _0xf326=function(_0x3acf84,_0x55fccf){_0x3acf84=_0x3acf84-0x0;var _0x1ab9c6=_0x326f[_0x3acf84];return _0x1ab9c6;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index b95d09e..04b92a0 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 _0xebcd=['Request','GetCmContact','createContact'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xebcd,0x19a));var _0xdebc=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xebcd[_0x10004e];return _0x5af990;};'use strict';var client=require('../client');exports[_0xdebc('0x0')]=function(_0x5eb2c5){return function(){return client[_0xdebc('0x1')]('CreateCmContact',{'body':_0x5eb2c5,'log':'CreateCmContact'});};};exports['getContacts']=function(_0x469c45){return function(){return client[_0xdebc('0x1')](_0xdebc('0x2'),{'options':_0x469c45,'log':_0xdebc('0x2')});};}; \ No newline at end of file +var _0xac7c=['createContact','getContacts','GetCmContact'];(function(_0x4c5770,_0x48b574){var _0x303251=function(_0x2be7a1){while(--_0x2be7a1){_0x4c5770['push'](_0x4c5770['shift']());}};_0x303251(++_0x48b574);}(_0xac7c,0x126));var _0xcac7=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xac7c[_0x1a8ff0];return _0x3588bf;};'use strict';var client=require('../client');exports[_0xcac7('0x0')]=function(_0x14a247){return function(){return client['Request']('CreateCmContact',{'body':_0x14a247,'log':'CreateCmContact'});};};exports[_0xcac7('0x1')]=function(_0x376590){return function(){return client['Request'](_0xcac7('0x2'),{'options':_0x376590,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index da1ec24..d462074 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 _0x1a8f=['ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','priority','DESC','scheduledat','ASC','getContactDialerIvr','Contact','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ListId','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','VoiceQueue','getCmHopper','unlockContact','GetContactRecallMe','CmContact','User','voicePause','db.CmHopper.UserId','resetActiveCalls'];(function(_0x4d8360,_0xafe12e){var _0x18f154=function(_0x932a4e){while(--_0x932a4e){_0x4d8360['push'](_0x4d8360['shift']());}};_0x18f154(++_0xafe12e);}(_0x1a8f,0x87));var _0xf1a8=function(_0x4e3ac5,_0x18d402){_0x4e3ac5=_0x4e3ac5-0x0;var _0x3b408f=_0x1a8f[_0x4e3ac5];return _0x3b408f;};'use strict';var client=require(_0xf1a8('0x0'));var moment=require('moment');exports[_0xf1a8('0x1')]=function(_0x281b63,_0x3b7a56){return function(){return client[_0xf1a8('0x2')](_0xf1a8('0x3'),{'options':{'where':{'VoiceQueueId':_0x281b63},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x3b7a56,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x3f6889,_0x515ff3,_0x29dc33){return function(){return client['Request'](_0xf1a8('0x4'),{'body':_0x3f6889,'options':{'where':{'VoiceQueueId':_0x515ff3,'scheduledat':{'$lte':moment()['format'](_0xf1a8('0x5'))}},'limit':_0x29dc33},'log':_0xf1a8('0x4')});};};exports[_0xf1a8('0x6')]=function(_0x5887ae){return client[_0xf1a8('0x2')]('UpdateCmHopper',{'body':_0x5887ae,'options':{'where':{'ContactId':_0x5887ae[_0xf1a8('0x7')],'ListId':_0x5887ae['ListId'],'VoiceQueueId':_0x5887ae[_0xf1a8('0x8')],'CampaignId':_0x5887ae[_0xf1a8('0x9')]}},'log':_0xf1a8('0x6')});};exports[_0xf1a8('0xa')]=function(_0x49e1e1,_0x270ea4,_0x548dee){return function(){return client[_0xf1a8('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x49e1e1,'ListId':_0x270ea4,'ContactId':_0x548dee}},'log':_0xf1a8('0xb')});};};exports[_0xf1a8('0xc')]=function(_0xf9f63,_0x1ad08f,_0x2d0965,_0x292f03){return client[_0xf1a8('0x2')](_0xf1a8('0xd'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xf9f63,'active':![],'scheduledat':{'$lte':moment()[_0xf1a8('0xe')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x1ad08f}}]},'order':[[_0xf1a8('0xf'),_0xf1a8('0x10')],[_0xf1a8('0x11'),_0x292f03],['id',_0xf1a8('0x12')]],'raw':!![],'limit':_0x2d0965},'log':_0xf1a8('0xd')});};exports[_0xf1a8('0x13')]=function(_0x671ef3,_0x698cfa,_0x1fa067){return client[_0xf1a8('0x2')](_0xf1a8('0xd'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x671ef3,'active':![],'scheduledat':{'$lte':moment()[_0xf1a8('0xe')](_0xf1a8('0x5'))}},'include':[{'model':'CmContact','as':_0xf1a8('0x14')}],'order':[[_0xf1a8('0xf'),_0xf1a8('0x10')],[_0xf1a8('0x11'),_0x1fa067],['id',_0xf1a8('0x12')]],'raw':!![],'limit':_0x698cfa},'log':'GetContactDialerIvr'});};exports[_0xf1a8('0x15')]=function(_0x5a558a,_0x1205bb){_0x5a558a[_0xf1a8('0x16')]=_0x5a558a[_0xf1a8('0x17')];return client[_0xf1a8('0x2')](_0xf1a8('0x18'),{'body':_0x5a558a,'options':{'where':{'ContactId':_0x5a558a[_0xf1a8('0x7')],'ListId':_0x5a558a[_0xf1a8('0x19')],'VoiceQueueId':_0x5a558a[_0xf1a8('0x8')],'CampaignId':_0x5a558a['CampaignId'],'active':_0x1205bb?undefined:!![]}},'log':_0xf1a8('0x18')});};exports[_0xf1a8('0x1a')]=function(_0x1fa221){return client[_0xf1a8('0x2')](_0xf1a8('0x1b'),{'options':{'where':{'VoiceQueueId':_0x1fa221['id']?_0x1fa221['id']||null:null}},'log':'countReScheduled'});};exports[_0xf1a8('0x1c')]=function(_0x380527){return function(){return client[_0xf1a8('0x2')](_0xf1a8('0x1d'),{'options':{'where':{'id':_0x380527},'include':[{'model':'CmContact','as':_0xf1a8('0x14')},{'model':'User','as':_0xf1a8('0x1e'),'attributes':['id',_0xf1a8('0x1f')]},{'model':_0xf1a8('0x20'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':_0xf1a8('0x21')});};};exports[_0xf1a8('0x22')]=function(_0x2bdc47,_0x53e500,_0xcf038e){return client['Request'](_0xf1a8('0x4'),{'body':_0x2bdc47,'options':{'where':{'id':_0x53e500},'limit':_0xcf038e},'log':_0xf1a8('0x4')});};exports['getContactRecallMe']=function(_0xe6e6e3,_0x4cf9f1){return function(){return client['Request'](_0xf1a8('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xe6e6e3,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf1a8('0xe')](_0xf1a8('0x5'))},'UserId':{'$in':_0x4cf9f1}},'order':[['priority',_0xf1a8('0x10')],[_0xf1a8('0x11'),_0xf1a8('0x10')],['id','ASC']],'include':[{'model':_0xf1a8('0x24'),'as':_0xf1a8('0x14')},{'model':_0xf1a8('0x25'),'as':_0xf1a8('0x1e'),'attributes':['id',_0xf1a8('0x1f'),_0xf1a8('0x26')]}],'group':_0xf1a8('0x27'),'raw':!![]},'log':_0xf1a8('0xd')});};};exports[_0xf1a8('0x28')]=function(_0x2c0382,_0x5e4480){return client[_0xf1a8('0x2')](_0xf1a8('0x29'),{'body':_0x2c0382,'options':_0x5e4480||{},'log':_0xf1a8('0x29')});};exports['handlePreviewRecallNotifications']=function(_0x53788e,_0x12ce19,_0x37826c){return function(){return client[_0xf1a8('0x2')](_0xf1a8('0x2a'),{'body':{'where':{'voiceQueueIds':_0x53788e,'interval':_0x12ce19,'availableAgentsIds':_0x37826c}},'log':_0xf1a8('0x2b')});};}; \ No newline at end of file +var _0x029b=['countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','Queue','getContactRecallMe','GetContactRecallMe','YYYY-MM-DD\x20HH:mm:ss','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','CmContact','updateContacts','Request','format','UpdateCmHopper','ListId','VoiceQueueId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','Contact','GetContactDialerIvr','moveContactManagedDialer','campaign','CampaignId','MoveContactManagedDialer','CountReScheduled'];(function(_0x23829c,_0x504b88){var _0x5b99e3=function(_0x38cf5a){while(--_0x38cf5a){_0x23829c['push'](_0x23829c['shift']());}};_0x5b99e3(++_0x504b88);}(_0x029b,0x66));var _0xb029=function(_0x472987,_0x4e9c48){_0x472987=_0x472987-0x0;var _0x340103=_0x029b[_0x472987];return _0x340103;};'use strict';var client=require(_0xb029('0x0'));var moment=require(_0xb029('0x1'));exports['getContacts']=function(_0x27c0b6,_0x2e71f6){return function(){return client['Request'](_0xb029('0x2'),{'options':{'where':{'VoiceQueueId':_0x27c0b6},'include':[{'model':_0xb029('0x3'),'as':'Contact'}],'limit':_0x2e71f6,'raw':![]},'log':'getCmHopper'});};};exports[_0xb029('0x4')]=function(_0x3f8fe4,_0x7836f0,_0x448fc5){return function(){return client[_0xb029('0x5')]('UpdateCmHopper',{'body':_0x3f8fe4,'options':{'where':{'VoiceQueueId':_0x7836f0,'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x448fc5},'log':_0xb029('0x7')});};};exports['rescheduleContact']=function(_0x2c3772){return client['Request'](_0xb029('0x7'),{'body':_0x2c3772,'options':{'where':{'ContactId':_0x2c3772['ContactId'],'ListId':_0x2c3772[_0xb029('0x8')],'VoiceQueueId':_0x2c3772[_0xb029('0x9')],'CampaignId':_0x2c3772['CampaignId']}},'log':_0xb029('0xa')});};exports[_0xb029('0xb')]=function(_0x2532d4,_0x3abf90,_0x4399d2){return function(){return client['Request'](_0xb029('0xc'),{'options':{'where':{'VoiceQueueId':_0x2532d4,'ListId':_0x3abf90,'ContactId':_0x4399d2}},'log':'DestroyCmHopper'});};};exports[_0xb029('0xd')]=function(_0x3d9ed9,_0x18e228,_0x8dfbf1,_0x5ce391){return client[_0xb029('0x5')](_0xb029('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3d9ed9,'active':![],'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x18e228}}]},'order':[[_0xb029('0xf'),_0xb029('0x10')],[_0xb029('0x11'),_0x5ce391],['id',_0xb029('0x12')]],'raw':!![],'limit':_0x8dfbf1},'log':_0xb029('0xe')});};exports[_0xb029('0x13')]=function(_0x185292,_0x1d54ff,_0x3f91cb){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x185292,'active':![],'scheduledat':{'$lte':moment()[_0xb029('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xb029('0x3'),'as':_0xb029('0x14')}],'order':[[_0xb029('0xf'),'DESC'],['scheduledat',_0x3f91cb],['id',_0xb029('0x12')]],'raw':!![],'limit':_0x1d54ff},'log':_0xb029('0x15')});};exports[_0xb029('0x16')]=function(_0x3381b2,_0x3c4396){_0x3381b2[_0xb029('0x17')]=_0x3381b2['queue'];return client['Request']('MoveContactManagedDialer',{'body':_0x3381b2,'options':{'where':{'ContactId':_0x3381b2['ContactId'],'ListId':_0x3381b2[_0xb029('0x8')],'VoiceQueueId':_0x3381b2[_0xb029('0x9')],'CampaignId':_0x3381b2[_0xb029('0x18')],'active':_0x3c4396?undefined:!![]}},'log':_0xb029('0x19')});};exports['countReScheduled']=function(_0x3642b5){return client[_0xb029('0x5')](_0xb029('0x1a'),{'options':{'where':{'VoiceQueueId':_0x3642b5['id']?_0x3642b5['id']||null:null}},'log':_0xb029('0x1b')});};exports[_0xb029('0x1c')]=function(_0x26bb54){return function(){return client[_0xb029('0x5')](_0xb029('0x1d'),{'options':{'where':{'id':_0x26bb54},'include':[{'model':_0xb029('0x3'),'as':_0xb029('0x14')},{'model':_0xb029('0x1e'),'as':_0xb029('0x1f'),'attributes':['id',_0xb029('0x20')]},{'model':'VoiceQueue','as':_0xb029('0x21'),'attributes':['id',_0xb029('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports['unlockContact']=function(_0x112ce9,_0x3b030a,_0x334ce6){return client[_0xb029('0x5')](_0xb029('0x7'),{'body':_0x112ce9,'options':{'where':{'id':_0x3b030a},'limit':_0x334ce6},'log':'UpdateCmHopper'});};exports[_0xb029('0x22')]=function(_0x4a4100,_0x2b2d98){return function(){return client[_0xb029('0x5')](_0xb029('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4a4100,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xb029('0x24'))},'UserId':{'$in':_0x2b2d98}},'order':[[_0xb029('0xf'),'DESC'],[_0xb029('0x11'),'DESC'],['id',_0xb029('0x12')]],'include':[{'model':'CmContact','as':_0xb029('0x14')},{'model':_0xb029('0x1e'),'as':_0xb029('0x1f'),'attributes':['id',_0xb029('0x20'),_0xb029('0x25')]}],'group':_0xb029('0x26'),'raw':!![]},'log':_0xb029('0xe')});};};exports[_0xb029('0x27')]=function(_0x4d5271,_0x2d87c1){return client[_0xb029('0x5')](_0xb029('0x28'),{'body':_0x4d5271,'options':_0x2d87c1||{},'log':'ResetActiveCalls'});};exports[_0xb029('0x29')]=function(_0x2b0f6b,_0x5f4688,_0x2f17b0){return function(){return client['Request'](_0xb029('0x2a'),{'body':{'where':{'voiceQueueIds':_0x2b0f6b,'interval':_0x5f4688,'availableAgentsIds':_0x2f17b0}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 4512061..22706df 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 _0xf52d=['incrementPreviewCounters','IncrementPreviewCounters','../client','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones'];(function(_0x4dee40,_0x26be92){var _0x4bddeb=function(_0x4aead8){while(--_0x4aead8){_0x4dee40['push'](_0x4dee40['shift']());}};_0x4bddeb(++_0x26be92);}(_0xf52d,0x1a6));var _0xdf52=function(_0x8cb993,_0x34571b){_0x8cb993=_0x8cb993-0x0;var _0x3dac60=_0xf52d[_0x8cb993];return _0x3dac60;};'use strict';var client=require(_0xdf52('0x0'));exports['verifyAdditionalPhones']=function(_0xf79927,_0x1a511e,_0x1134ee){return client[_0xdf52('0x1')](_0xdf52('0x2'),{'body':_0xf79927,'reason':_0x1a511e,'entity':_0x1134ee,'log':_0xdf52('0x2')});};exports[_0xdf52('0x3')]=function(_0xc644ad,_0x260095,_0x12006e){return client[_0xdf52('0x1')](_0xdf52('0x4'),{'body':_0xc644ad,'duration':_0x260095,'waitTime':_0x12006e,'log':_0xdf52('0x4')});};exports[_0xdf52('0x5')]=function(_0x44e39e){return function(){return client['Request'](_0xdf52('0x6'),{'body':_0x44e39e,'log':_0xdf52('0x6')});};}; \ No newline at end of file +var _0x16b8=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x1b9e78,_0x2f63a6){var _0x24b3c6=function(_0x40b848){while(--_0x40b848){_0x1b9e78['push'](_0x1b9e78['shift']());}};_0x24b3c6(++_0x2f63a6);}(_0x16b8,0xe4));var _0x816b=function(_0x2b6e7c,_0xdb7ac4){_0x2b6e7c=_0x2b6e7c-0x0;var _0x29b018=_0x16b8[_0x2b6e7c];return _0x29b018;};'use strict';var client=require(_0x816b('0x0'));exports[_0x816b('0x1')]=function(_0x113b46,_0x14dbe3,_0x28f471){return client[_0x816b('0x2')](_0x816b('0x3'),{'body':_0x113b46,'reason':_0x14dbe3,'entity':_0x28f471,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x2fa1fe,_0x4ee089,_0x5ddf3d){return client[_0x816b('0x2')](_0x816b('0x4'),{'body':_0x2fa1fe,'duration':_0x4ee089,'waitTime':_0x5ddf3d,'log':'SwapAdditionalPhones'});};exports[_0x816b('0x5')]=function(_0x42f79f){return function(){return client[_0x816b('0x2')]('IncrementPreviewCounters',{'body':_0x42f79f,'log':_0x816b('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 5b4d205..23cbc02 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 _0xd2c4=['GetCmHopperBlackIvr','../client','Request','GetCmHopperBlack','VoiceQueueId','phone','CampaignId'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0xd2c4,0x1c1));var _0x4d2c=function(_0x1ea5a1,_0x490472){_0x1ea5a1=_0x1ea5a1-0x0;var _0xd53a86=_0xd2c4[_0x1ea5a1];return _0xd53a86;};'use strict';var client=require(_0x4d2c('0x0'));exports['checkIsBlackList']=function(_0xe5d98c){return client[_0x4d2c('0x1')](_0x4d2c('0x2'),{'options':{'where':{'VoiceQueueId':_0xe5d98c[_0x4d2c('0x3')],'phone':_0xe5d98c[_0x4d2c('0x4')]},'raw':![]},'log':_0x4d2c('0x2')});};exports['checkIsBlackListIvr']=function(_0x5a7b48){return client[_0x4d2c('0x1')](_0x4d2c('0x2'),{'options':{'where':{'CampaignId':_0x5a7b48[_0x4d2c('0x5')],'phone':_0x5a7b48['phone']},'raw':![]},'log':_0x4d2c('0x6')});}; \ No newline at end of file +var _0xc6e1=['GetCmHopperBlack','VoiceQueueId','checkIsBlackListIvr','phone','GetCmHopperBlackIvr','checkIsBlackList','Request'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xc6e1,0x1b7));var _0x1c6e=function(_0x1d16cd,_0x4da176){_0x1d16cd=_0x1d16cd-0x0;var _0x57dbcd=_0xc6e1[_0x1d16cd];return _0x57dbcd;};'use strict';var client=require('../client');exports[_0x1c6e('0x0')]=function(_0x3ecfa9){return client[_0x1c6e('0x1')](_0x1c6e('0x2'),{'options':{'where':{'VoiceQueueId':_0x3ecfa9[_0x1c6e('0x3')],'phone':_0x3ecfa9['phone']},'raw':![]},'log':_0x1c6e('0x2')});};exports[_0x1c6e('0x4')]=function(_0x590804){return client[_0x1c6e('0x1')](_0x1c6e('0x2'),{'options':{'where':{'CampaignId':_0x590804['CampaignId'],'phone':_0x590804[_0x1c6e('0x5')]},'raw':![]},'log':_0x1c6e('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 32f3e02..12c34e0 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 _0xe648=['CreateCmHopperFinal','../client','createContact','campaign','Request'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xe648,0x88));var _0x8e64=function(_0x44e2f1,_0x309b02){_0x44e2f1=_0x44e2f1-0x0;var _0x1d0513=_0xe648[_0x44e2f1];return _0x1d0513;};'use strict';var client=require(_0x8e64('0x0'));exports[_0x8e64('0x1')]=function(_0x4dd7a9){return function(){_0x4dd7a9[_0x8e64('0x2')]=_0x4dd7a9['queue'];return client[_0x8e64('0x3')](_0x8e64('0x4'),{'body':_0x4dd7a9,'log':_0x8e64('0x4')});};}; \ No newline at end of file +var _0xdc0d=['queue','Request','createContact'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xdc0d,0xbf));var _0xddc0=function(_0x14b3d8,_0x520f02){_0x14b3d8=_0x14b3d8-0x0;var _0x51f496=_0xdc0d[_0x14b3d8];return _0x51f496;};'use strict';var client=require('../client');exports[_0xddc0('0x0')]=function(_0x103ee8){return function(){_0x103ee8['campaign']=_0x103ee8[_0xddc0('0x1')];return client[_0xddc0('0x2')]('CreateCmHopperFinal',{'body':_0x103ee8,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 6ed4119..a044644 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 _0xe10c=['campaign','Request','CreateCmHopperHistory','AvgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','startOf','day','format','endOf','queue','GetVoiceQueueHopperHistory','getCampaignHopperHistory','ivr','../client','moment','createHistory'];(function(_0x52487a,_0x15dd93){var _0x4b2037=function(_0x2ccadc){while(--_0x2ccadc){_0x52487a['push'](_0x52487a['shift']());}};_0x4b2037(++_0x15dd93);}(_0xe10c,0x153));var _0xce10=function(_0x5bdb4c,_0x58d7d1){_0x5bdb4c=_0x5bdb4c-0x0;var _0x47e32d=_0xe10c[_0x5bdb4c];return _0x47e32d;};'use strict';var client=require(_0xce10('0x0'));var moment=require(_0xce10('0x1'));exports[_0xce10('0x2')]=function(_0x577838){_0x577838[_0xce10('0x3')]=_0x577838['queue'];return client[_0xce10('0x4')](_0xce10('0x5'),{'body':_0x577838,'log':_0xce10('0x5')});};exports['avgHandleTime']=function(_0x5d72b0){return client[_0xce10('0x4')](_0xce10('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0xce10('0x7')](_0x5d72b0,_0xce10('0x8'))['format'](_0xce10('0x9')),moment()['format'](_0xce10('0x9'))]}},'raw':![]},'log':_0xce10('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xce10('0x4')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xce10('0xb')](_0xce10('0xc'))[_0xce10('0xd')](_0xce10('0x9')),moment()[_0xce10('0xe')](_0xce10('0xc'))[_0xce10('0xd')](_0xce10('0x9'))]},'campaigntype':_0xce10('0xf')},'raw':![]},'log':_0xce10('0x10')});};};exports[_0xce10('0x11')]=function(){return function(){return client[_0xce10('0x4')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xce10('0xc'))[_0xce10('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xce10('0xe')](_0xce10('0xc'))[_0xce10('0xd')](_0xce10('0x9'))]},'campaigntype':_0xce10('0x12')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0x14ec=['startOf','day','endOf','queue','getCampaignHopperHistory','ivr','GetCampaignHopperHistory','moment','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x14ec,0xa7));var _0xc14e=function(_0x4e1cdc,_0x1c5782){_0x4e1cdc=_0x4e1cdc-0x0;var _0x3373f4=_0x14ec[_0x4e1cdc];return _0x3373f4;};'use strict';var client=require('../client');var moment=require(_0xc14e('0x0'));exports['createHistory']=function(_0xef44ca){_0xef44ca[_0xc14e('0x1')]=_0xef44ca['queue'];return client[_0xc14e('0x2')](_0xc14e('0x3'),{'body':_0xef44ca,'log':_0xc14e('0x3')});};exports[_0xc14e('0x4')]=function(_0x2ba9ad){return client[_0xc14e('0x2')](_0xc14e('0x5'),{'options':{'where':{'endtime':{'$between':[moment()[_0xc14e('0x6')](_0x2ba9ad,_0xc14e('0x7'))[_0xc14e('0x8')](_0xc14e('0x9')),moment()[_0xc14e('0x8')](_0xc14e('0x9'))]}},'raw':![]},'log':_0xc14e('0xa')});};exports[_0xc14e('0xb')]=function(){return function(){return client[_0xc14e('0x2')](_0xc14e('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xc14e('0xd')](_0xc14e('0xe'))[_0xc14e('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xc14e('0xf')](_0xc14e('0xe'))[_0xc14e('0x8')](_0xc14e('0x9'))]},'campaigntype':_0xc14e('0x10')},'raw':![]},'log':_0xc14e('0xc')});};};exports[_0xc14e('0x11')]=function(){return function(){return client[_0xc14e('0x2')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xc14e('0xd')](_0xc14e('0xe'))['format'](_0xc14e('0x9')),moment()[_0xc14e('0xf')]('day')[_0xc14e('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xc14e('0x12')},'raw':![]},'log':_0xc14e('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index ddd3344..64094d2 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 _0x9e6d=['tech','TrunkId','ListId','Trunk','callerid','active','NotifyFaxAccount','../client','Request','GetFaxAccount','name','ecm','headerinfo','localstationid','minrate','modem','gateway'];(function(_0x30a04c,_0x5a81db){var _0x19f7bc=function(_0x4ce15c){while(--_0x4ce15c){_0x30a04c['push'](_0x30a04c['shift']());}};_0x19f7bc(++_0x5a81db);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x1469eb,_0xd43486){_0x1469eb=_0x1469eb-0x0;var _0x1ba668=_0x9e6d[_0x1469eb];return _0x1ba668;};'use strict';var client=require(_0xd9e6('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0xd9e6('0x1')](_0xd9e6('0x2'),{'options':{'raw':![],'attributes':['id',_0xd9e6('0x3'),'description',_0xd9e6('0x4'),_0xd9e6('0x5'),_0xd9e6('0x6'),_0xd9e6('0x7'),'maxrate',_0xd9e6('0x8'),_0xd9e6('0x9'),'faxdetect','t38timeout',_0xd9e6('0xa'),_0xd9e6('0xb'),_0xd9e6('0xc'),'key'],'include':[{'model':_0xd9e6('0xd'),'as':_0xd9e6('0xd'),'attributes':['id','name',_0xd9e6('0xe'),_0xd9e6('0xf')]}]},'log':'getFaxAccount'});};};exports['notify']=function(_0xbac70b,_0x32e9e6){return client[_0xd9e6('0x1')](_0xd9e6('0x10'),{'account':{'id':_0xbac70b},'body':_0x32e9e6,'log':_0xd9e6('0x10')});}; \ No newline at end of file +var _0x30d6=['headerinfo','maxrate','modem','gateway','t38timeout','tech','TrunkId','Trunk','name','callerid','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','description','ecm'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x30d6,0x1b0));var _0x630d=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x30d6[_0x389a61];return _0x1acde9;};'use strict';var client=require(_0x630d('0x0'));exports[_0x630d('0x1')]=function(){return function(){return client['Request'](_0x630d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x630d('0x3'),_0x630d('0x4'),_0x630d('0x5'),'localstationid','minrate',_0x630d('0x6'),_0x630d('0x7'),_0x630d('0x8'),'faxdetect',_0x630d('0x9'),_0x630d('0xa'),_0x630d('0xb'),'ListId','key'],'include':[{'model':_0x630d('0xc'),'as':_0x630d('0xc'),'attributes':['id',_0x630d('0xd'),_0x630d('0xe'),'active']}]},'log':_0x630d('0xf')});};};exports[_0x630d('0x10')]=function(_0x2f88fb,_0x2c03da){return client[_0x630d('0x11')](_0x630d('0x12'),{'account':{'id':_0x2f88fb},'body':_0x2c03da,'log':_0x630d('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 30e0f97..836a26d 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 _0x861a=['UpdateFaxMessage','../client','Request'];(function(_0x52d0be,_0xd92470){var _0x44641a=function(_0x252154){while(--_0x252154){_0x52d0be['push'](_0x52d0be['shift']());}};_0x44641a(++_0xd92470);}(_0x861a,0x1ea));var _0xa861=function(_0x48916b,_0x23ee38){_0x48916b=_0x48916b-0x0;var _0x4d7a48=_0x861a[_0x48916b];return _0x4d7a48;};'use strict';var client=require(_0xa861('0x0'));exports['update']=function(_0x546f1d,_0x3723eb){return client[_0xa861('0x1')](_0xa861('0x2'),{'body':_0x3723eb,'options':{'where':{'AttachmentId':_0x546f1d}},'log':_0xa861('0x2')});}; \ No newline at end of file +var _0x48d0=['Request','UpdateFaxMessage','../client'];(function(_0x4a8e42,_0x564a20){var _0x17aed3=function(_0x3e5339){while(--_0x3e5339){_0x4a8e42['push'](_0x4a8e42['shift']());}};_0x17aed3(++_0x564a20);}(_0x48d0,0x1a0));var _0x048d=function(_0x244d99,_0x590cba){_0x244d99=_0x244d99-0x0;var _0x305ce7=_0x48d0[_0x244d99];return _0x305ce7;};'use strict';var client=require(_0x048d('0x0'));exports['update']=function(_0x59ea05,_0x81f0e0){return client[_0x048d('0x1')](_0x048d('0x2'),{'body':_0x81f0e0,'options':{'where':{'AttachmentId':_0x59ea05}},'log':_0x048d('0x2')});}; \ 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 28d8938..cc2e8b6 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 _0xe399=['serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','nameField','Tag','../../client','getDeskAccounts','GetDeskAccount','name','description','username','password','remoteUri','type'];(function(_0x45a7c9,_0x615f2a){var _0x4221fe=function(_0x47ccfc){while(--_0x47ccfc){_0x45a7c9['push'](_0x45a7c9['shift']());}};_0x4221fe(++_0x615f2a);}(_0xe399,0x1ef));var _0x9e39=function(_0x3496c,_0x1bb614){_0x3496c=_0x3496c-0x0;var _0x4569da=_0xe399[_0x3496c];return _0x4569da;};'use strict';var client=require(_0x9e39('0x0'));exports[_0x9e39('0x1')]=function(){return function(_0x5044b6){return client['Request'](_0x9e39('0x2'),{'options':{'raw':![],'attributes':['id',_0x9e39('0x3'),_0x9e39('0x4'),_0x9e39('0x5'),_0x9e39('0x6'),_0x9e39('0x7'),'authType',_0x9e39('0x8'),_0x9e39('0x9')],'include':[{'model':_0x9e39('0xa'),'as':_0x9e39('0xb'),'attributes':['id',_0x9e39('0x3')],'include':[{'model':_0x9e39('0xc'),'as':_0x9e39('0xd'),'attributes':['id',_0x9e39('0x8'),_0x9e39('0xe'),_0x9e39('0xf')],'include':[{'model':_0x9e39('0x10'),'as':'Variable','attributes':['id',_0x9e39('0x3')]}]},{'model':_0x9e39('0xc'),'as':_0x9e39('0x11'),'attributes':['id',_0x9e39('0x8'),_0x9e39('0xe'),'key',_0x9e39('0x12'),_0x9e39('0x13'),_0x9e39('0xf')],'include':[{'model':_0x9e39('0x10'),'as':_0x9e39('0x10'),'attributes':['id',_0x9e39('0x3')]}]},{'model':_0x9e39('0xc'),'as':_0x9e39('0x14'),'attributes':['id',_0x9e39('0x8'),_0x9e39('0xe'),_0x9e39('0x15'),_0x9e39('0x16'),'customField',_0x9e39('0xf')],'include':[{'model':'Variable','as':_0x9e39('0x10'),'attributes':['id',_0x9e39('0x3')]}]},{'model':_0x9e39('0x17'),'as':'Tags','attributes':['id',_0x9e39('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x264a=['content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField'];(function(_0x485034,_0x43f507){var _0x34e386=function(_0x520f8e){while(--_0x520f8e){_0x485034['push'](_0x485034['shift']());}};_0x34e386(++_0x43f507);}(_0x264a,0x135));var _0xa264=function(_0x3c564e,_0x2b8451){_0x3c564e=_0x3c564e-0x0;var _0x52491b=_0x264a[_0x3c564e];return _0x52491b;};'use strict';var client=require(_0xa264('0x0'));exports[_0xa264('0x1')]=function(){return function(_0x15071f){return client[_0xa264('0x2')](_0xa264('0x3'),{'options':{'raw':![],'attributes':['id',_0xa264('0x4'),_0xa264('0x5'),_0xa264('0x6'),_0xa264('0x7'),_0xa264('0x8'),_0xa264('0x9'),_0xa264('0xa'),_0xa264('0xb')],'include':[{'model':_0xa264('0xc'),'as':_0xa264('0xd'),'attributes':['id','name'],'include':[{'model':_0xa264('0xe'),'as':'Subjects','attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x10')],'include':[{'model':_0xa264('0x11'),'as':'Variable','attributes':['id',_0xa264('0x4')]}]},{'model':'DeskField','as':_0xa264('0x12'),'attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x13'),_0xa264('0x14'),_0xa264('0x15'),_0xa264('0x10')],'include':[{'model':'Variable','as':_0xa264('0x11'),'attributes':['id',_0xa264('0x4')]}]},{'model':_0xa264('0xe'),'as':_0xa264('0x16'),'attributes':['id',_0xa264('0xa'),_0xa264('0xf'),_0xa264('0x17'),'nameField',_0xa264('0x18'),_0xa264('0x10')],'include':[{'model':_0xa264('0x11'),'as':_0xa264('0x11'),'attributes':['id','name']}]},{'model':_0xa264('0x19'),'as':_0xa264('0x1a'),'attributes':['id',_0xa264('0x4')]}]}]},'log':'GetDeskAccount'});};}; \ 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 bff09af..0934a5b 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 _0x0833=['GetDynamics365Account','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','moduleCreate','Dynamics365Field','Subjects','type','content','variableName','Variable','name','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','data2','data7','../../client','getDynamics365Accounts','Request'];(function(_0x10d068,_0xec9cc4){var _0x2956ef=function(_0x1983aa){while(--_0x1983aa){_0x10d068['push'](_0x10d068['shift']());}};_0x2956ef(++_0xec9cc4);}(_0x0833,0x1bd));var _0x3083=function(_0x560f54,_0x24be31){_0x560f54=_0x560f54-0x0;var _0x1f7d85=_0x0833[_0x560f54];return _0x1f7d85;};'use strict';var client=require(_0x3083('0x0'));exports[_0x3083('0x1')]=function(){return function(_0x33f231){return client[_0x3083('0x2')](_0x3083('0x3'),{'options':{'raw':![],'attributes':['id','name','username','password',_0x3083('0x4'),'tenantId',_0x3083('0x5'),_0x3083('0x6'),_0x3083('0x7'),'description',_0x3083('0x8')],'include':[{'model':_0x3083('0x9'),'as':'Configurations','attributes':['id','name','ticketType',_0x3083('0xa'),'additionalSearchContact','openNewTab'],'include':[{'model':_0x3083('0xb'),'as':_0x3083('0xc'),'attributes':['id',_0x3083('0xd'),_0x3083('0xe'),_0x3083('0xf')],'include':[{'model':_0x3083('0x10'),'as':_0x3083('0x10'),'attributes':['id',_0x3083('0x11')]}]},{'model':_0x3083('0xb'),'as':_0x3083('0x12'),'attributes':['id',_0x3083('0xd'),_0x3083('0xe'),_0x3083('0x13'),_0x3083('0x14'),_0x3083('0x15'),'variableName'],'include':[{'model':_0x3083('0x10'),'as':_0x3083('0x10'),'attributes':['id','name']}]},{'model':_0x3083('0xb'),'as':_0x3083('0x16'),'attributes':['id','type',_0x3083('0xe'),_0x3083('0x17'),_0x3083('0x18'),_0x3083('0x19'),_0x3083('0xf')],'include':[{'model':_0x3083('0x10'),'as':_0x3083('0x10'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0x3083('0x1a'),'data5',_0x3083('0x1b')]}]},'log':_0x3083('0x3')});};}; \ No newline at end of file +var _0x56bd=['keyType','keyContent','variableName','idField','nameField','customField','CloudProvider','data2','data5','getDynamics365Accounts','Request','name','username','password','remoteUri','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','type','content','Variable','Dynamics365Field','Descriptions','key'];(function(_0x598e64,_0x17bc90){var _0x3e4eba=function(_0x37dd02){while(--_0x37dd02){_0x598e64['push'](_0x598e64['shift']());}};_0x3e4eba(++_0x17bc90);}(_0x56bd,0xe9));var _0xd56b=function(_0x382e66,_0x30c3bf){_0x382e66=_0x382e66-0x0;var _0x5d6e4c=_0x56bd[_0x382e66];return _0x5d6e4c;};'use strict';var client=require('../../client');exports[_0xd56b('0x0')]=function(){return function(_0x2535c1){return client[_0xd56b('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xd56b('0x2'),_0xd56b('0x3'),_0xd56b('0x4'),_0xd56b('0x5'),'tenantId',_0xd56b('0x6'),_0xd56b('0x7'),_0xd56b('0x8'),_0xd56b('0x9'),_0xd56b('0xa')],'include':[{'model':_0xd56b('0xb'),'as':_0xd56b('0xc'),'attributes':['id','name',_0xd56b('0xd'),_0xd56b('0xe'),_0xd56b('0xf'),_0xd56b('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),'variableName'],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':_0xd56b('0x15'),'attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),_0xd56b('0x16'),_0xd56b('0x17'),_0xd56b('0x18'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':'Fields','attributes':['id',_0xd56b('0x11'),'content',_0xd56b('0x1a'),_0xd56b('0x1b'),_0xd56b('0x1c'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]}]},{'model':_0xd56b('0x1d'),'as':_0xd56b('0x1d'),'attributes':['id',_0xd56b('0x1e'),_0xd56b('0x1f'),'data7']}]},'log':'GetDynamics365Account'});};}; \ 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 3aaf24a..f3099e5 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 _0x803f=['type','key','keyType','keyContent','Fields','nameField','customField','GetFreshdeskAccount','../../client','Request','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','content','variableName','Variable','Descriptions'];(function(_0xf79bce,_0x12135c){var _0x528477=function(_0x32c9a0){while(--_0x32c9a0){_0xf79bce['push'](_0xf79bce['shift']());}};_0x528477(++_0x12135c);}(_0x803f,0x64));var _0xf803=function(_0x547999,_0x4e0b21){_0x547999=_0x547999-0x0;var _0x3301ed=_0x803f[_0x547999];return _0x3301ed;};'use strict';var client=require(_0xf803('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x328b90){return client[_0xf803('0x1')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0xf803('0x2'),_0xf803('0x3'),_0xf803('0x4'),_0xf803('0x5'),_0xf803('0x6')],'include':[{'model':'FreshdeskConfiguration','as':_0xf803('0x7'),'attributes':['id',_0xf803('0x2')],'include':[{'model':_0xf803('0x8'),'attributes':['id','name']},{'model':_0xf803('0x9'),'as':_0xf803('0xa'),'attributes':['id','type',_0xf803('0xb'),_0xf803('0xc')],'include':[{'model':_0xf803('0xd'),'as':'Variable','attributes':['id',_0xf803('0x2')]}]},{'model':'FreshdeskField','as':_0xf803('0xe'),'attributes':['id',_0xf803('0xf'),'content',_0xf803('0x10'),_0xf803('0x11'),_0xf803('0x12'),_0xf803('0xc')],'include':[{'model':_0xf803('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0xf803('0x9'),'as':_0xf803('0x13'),'attributes':['id','type',_0xf803('0xb'),'idField',_0xf803('0x14'),_0xf803('0x15'),_0xf803('0xc')],'include':[{'model':_0xf803('0xd'),'as':'Variable','attributes':['id',_0xf803('0x2')]}]}]}]},'log':_0xf803('0x16')});};}; \ No newline at end of file +var _0xab75=['content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','name','username','apiKey','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0x4cab7d,_0xce877){var _0x4e09cd=function(_0x1359d2){while(--_0x1359d2){_0x4cab7d['push'](_0x4cab7d['shift']());}};_0x4e09cd(++_0xce877);}(_0xab75,0x11f));var _0x5ab7=function(_0x4b14bb,_0x4a4b95){_0x4b14bb=_0x4b14bb-0x0;var _0xd720a0=_0xab75[_0x4b14bb];return _0xd720a0;};'use strict';var client=require(_0x5ab7('0x0'));exports[_0x5ab7('0x1')]=function(){return function(_0x2fc46f){return client['Request']('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x5ab7('0x2'),_0x5ab7('0x3'),_0x5ab7('0x4'),'remoteUri',_0x5ab7('0x5')],'include':[{'model':_0x5ab7('0x6'),'as':_0x5ab7('0x7'),'attributes':['id',_0x5ab7('0x2')],'include':[{'model':_0x5ab7('0x8'),'attributes':['id',_0x5ab7('0x2')]},{'model':_0x5ab7('0x9'),'as':_0x5ab7('0xa'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0xd')],'include':[{'model':'Variable','as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]},{'model':'FreshdeskField','as':_0x5ab7('0xf'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0x10'),_0x5ab7('0x11'),'keyContent','variableName'],'include':[{'model':_0x5ab7('0xe'),'as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]},{'model':_0x5ab7('0x9'),'as':_0x5ab7('0x12'),'attributes':['id',_0x5ab7('0xb'),_0x5ab7('0xc'),_0x5ab7('0x13'),_0x5ab7('0x14'),_0x5ab7('0x15'),_0x5ab7('0xd')],'include':[{'model':'Variable','as':_0x5ab7('0xe'),'attributes':['id',_0x5ab7('0x2')]}]}]}]},'log':_0x5ab7('0x16')});};}; \ 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 3b64c1e..f36ca67 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 _0x6ec2=['Variable','Descriptions','type','key','keyType','keyContent','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','content','variableName'];(function(_0x2f1cf4,_0x2c06a9){var _0x29deaa=function(_0x3946c1){while(--_0x3946c1){_0x2f1cf4['push'](_0x2f1cf4['shift']());}};_0x29deaa(++_0x2c06a9);}(_0x6ec2,0x78));var _0x26ec=function(_0x26d560,_0x3f127e){_0x26d560=_0x26d560-0x0;var _0x1613e5=_0x6ec2[_0x26d560];return _0x1613e5;};'use strict';var client=require(_0x26ec('0x0'));exports[_0x26ec('0x1')]=function(){return function(_0x3d8b7c){return client[_0x26ec('0x2')](_0x26ec('0x3'),{'options':{'raw':![],'attributes':['id',_0x26ec('0x4'),'username',_0x26ec('0x5'),_0x26ec('0x6'),_0x26ec('0x7')],'include':[{'model':_0x26ec('0x8'),'as':_0x26ec('0x9'),'attributes':['id','name'],'include':[{'model':_0x26ec('0xa'),'as':'Subjects','attributes':['id','type',_0x26ec('0xb'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':'Variable','attributes':['id',_0x26ec('0x4')]}]},{'model':'FreshsalesField','as':_0x26ec('0xe'),'attributes':['id',_0x26ec('0xf'),_0x26ec('0xb'),_0x26ec('0x10'),_0x26ec('0x11'),_0x26ec('0x12'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':_0x26ec('0xd'),'attributes':['id',_0x26ec('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x0e4b=['getFreshsalesAccounts','GetFreshsalesAccount','serverUrl','FreshsalesConfiguration','name','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x46ba18,_0x51bcbd){_0x46ba18=_0x46ba18-0x0;var _0x68fc4a=_0x0e4b[_0x46ba18];return _0x68fc4a;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(){return function(_0x65d4d1){return client['Request'](_0xb0e4('0x2'),{'options':{'raw':![],'attributes':['id','name','username','apiKey','remoteUri',_0xb0e4('0x3')],'include':[{'model':_0xb0e4('0x4'),'as':'Configurations','attributes':['id',_0xb0e4('0x5')],'include':[{'model':_0xb0e4('0x6'),'as':_0xb0e4('0x7'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),'variableName'],'include':[{'model':'Variable','as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]},{'model':_0xb0e4('0x6'),'as':_0xb0e4('0xb'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),_0xb0e4('0xc'),_0xb0e4('0xd'),_0xb0e4('0xe'),_0xb0e4('0xf')],'include':[{'model':_0xb0e4('0xa'),'as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]}]}]},'log':_0xb0e4('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 23c940b..f91cba4 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 _0x91c5=['moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','name','Descriptions','Fields','getSalesforceAccounts','GetSalesforceAccount','clientId','clientSecret','serverUrl','type','Configurations','moduleSearch'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0x91c5,0x124));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var client=require('../../client');exports[_0x591c('0x0')]=function(){return function(_0x57a35b){return client['Request'](_0x591c('0x1'),{'options':{'raw':![],'attributes':['id','name','username','password','remoteUri',_0x591c('0x2'),_0x591c('0x3'),'securityToken',_0x591c('0x4'),_0x591c('0x5')],'include':[{'model':'SalesforceConfiguration','as':_0x591c('0x6'),'attributes':['id','name',_0x591c('0x7'),_0x591c('0x8'),_0x591c('0x9'),_0x591c('0xa'),_0x591c('0xb'),_0x591c('0xc'),_0x591c('0xd')],'include':[{'model':_0x591c('0xe'),'as':_0x591c('0xf'),'include':[{'model':_0x591c('0x10'),'as':_0x591c('0x10'),'attributes':['id',_0x591c('0x11')]}]},{'model':_0x591c('0xe'),'as':_0x591c('0x12'),'include':[{'model':_0x591c('0x10'),'as':_0x591c('0x10'),'attributes':['id','name']}]},{'model':_0x591c('0xe'),'as':_0x591c('0x13'),'include':[{'model':'Variable','as':_0x591c('0x10'),'attributes':['id',_0x591c('0x11')]}]}]}]},'log':_0x591c('0x1')});};}; \ No newline at end of file +var _0xc1bd=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','remoteUri','clientId','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Variable','Descriptions','Fields'];(function(_0x356f38,_0x45756d){var _0x33a4c8=function(_0x3569d1){while(--_0x3569d1){_0x356f38['push'](_0x356f38['shift']());}};_0x33a4c8(++_0x45756d);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x4106bd,_0x2ca0b0){_0x4106bd=_0x4106bd-0x0;var _0x13757f=_0xc1bd[_0x4106bd];return _0x13757f;};'use strict';var client=require('../../client');exports[_0xdc1b('0x0')]=function(){return function(_0x114a2e){return client[_0xdc1b('0x1')](_0xdc1b('0x2'),{'options':{'raw':![],'attributes':['id',_0xdc1b('0x3'),_0xdc1b('0x4'),'password',_0xdc1b('0x5'),_0xdc1b('0x6'),'clientSecret',_0xdc1b('0x7'),_0xdc1b('0x8'),_0xdc1b('0x9')],'include':[{'model':'SalesforceConfiguration','as':_0xdc1b('0xa'),'attributes':['id',_0xdc1b('0x3'),_0xdc1b('0xb'),_0xdc1b('0xc'),_0xdc1b('0xd'),'leadId',_0xdc1b('0xe'),_0xdc1b('0xf'),_0xdc1b('0x10')],'include':[{'model':_0xdc1b('0x11'),'as':'Subjects','include':[{'model':_0xdc1b('0x12'),'as':'Variable','attributes':['id',_0xdc1b('0x3')]}]},{'model':_0xdc1b('0x11'),'as':_0xdc1b('0x13'),'include':[{'model':_0xdc1b('0x12'),'as':'Variable','attributes':['id',_0xdc1b('0x3')]}]},{'model':_0xdc1b('0x11'),'as':_0xdc1b('0x14'),'include':[{'model':_0xdc1b('0x12'),'as':_0xdc1b('0x12'),'attributes':['id',_0xdc1b('0x3')]}]}]}]},'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 86249aa..9fe75f6 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 _0xda19=['ServicenowConfiguration','Configurations','name','ServicenowField','Subjects','type','Variable','Descriptions','content','key','keyType','keyContent','Fields','nameField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','description','password','email','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda19,0xd5));var _0x9da1=function(_0x6af134,_0x207b8b){_0x6af134=_0x6af134-0x0;var _0x1e8819=_0xda19[_0x6af134];return _0x1e8819;};'use strict';var client=require('../../client');exports[_0x9da1('0x0')]=function(){return function(_0x430d39){return client['Request'](_0x9da1('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x9da1('0x2'),'username',_0x9da1('0x3'),_0x9da1('0x4'),_0x9da1('0x5'),_0x9da1('0x6')],'include':[{'model':_0x9da1('0x7'),'as':_0x9da1('0x8'),'attributes':['id',_0x9da1('0x9')],'include':[{'model':_0x9da1('0xa'),'as':_0x9da1('0xb'),'attributes':['id',_0x9da1('0xc'),'content','variableName'],'include':[{'model':'Variable','as':_0x9da1('0xd'),'attributes':['id','name']}]},{'model':_0x9da1('0xa'),'as':_0x9da1('0xe'),'attributes':['id',_0x9da1('0xc'),_0x9da1('0xf'),_0x9da1('0x10'),_0x9da1('0x11'),_0x9da1('0x12'),'variableName'],'include':[{'model':'Variable','as':_0x9da1('0xd'),'attributes':['id','name']}]},{'model':_0x9da1('0xa'),'as':_0x9da1('0x13'),'attributes':['id',_0x9da1('0xc'),_0x9da1('0xf'),'idField',_0x9da1('0x14'),'customField','variableName'],'include':[{'model':_0x9da1('0xd'),'as':'Variable','attributes':['id',_0x9da1('0x9')]}]}]}]},'log':_0x9da1('0x15')});};}; \ No newline at end of file +var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x469382,_0x4b79bc){var _0x2ca948=function(_0x5dad0f){while(--_0x5dad0f){_0x469382['push'](_0x469382['shift']());}};_0x2ca948(++_0x4b79bc);}(_0xabce,0x103));var _0xeabc=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xabce[_0x45e98e];return _0x374dba;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index ce29960..3d21d9d 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 _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x54f087,_0x3a0041){var _0x430620=function(_0x26fddc){while(--_0x26fddc){_0x54f087['push'](_0x54f087['shift']());}};_0x430620(++_0x3a0041);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file +var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0xef049b,_0x5a7819){var _0x4cec9a=function(_0x306b82){while(--_0x306b82){_0xef049b['push'](_0xef049b['shift']());}};_0x4cec9a(++_0x5a7819);}(_0x2ef3,0xba));var _0x32ef=function(_0x91a9d9,_0x3aee6f){_0x91a9d9=_0x91a9d9-0x0;var _0xe46fe2=_0x2ef3[_0x91a9d9];return _0xe46fe2;};'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 fb2f7a6..a651ae8 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 _0xab83=['VtigerConfiguration','Subjects','content','variableName','Variable','VtigerField','Descriptions','type','idField','nameField','customField','../../client','getVtigerAccounts','Request','name','description','serverUrl'];(function(_0x49c756,_0x37f990){var _0x15fc63=function(_0x563ca0){while(--_0x563ca0){_0x49c756['push'](_0x49c756['shift']());}};_0x15fc63(++_0x37f990);}(_0xab83,0x71));var _0x3ab8=function(_0x3d5f4b,_0x3d208c){_0x3d5f4b=_0x3d5f4b-0x0;var _0x5968ef=_0xab83[_0x3d5f4b];return _0x5968ef;};'use strict';var client=require(_0x3ab8('0x0'));exports[_0x3ab8('0x1')]=function(){return function(_0x1cb9a7){return client[_0x3ab8('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x3ab8('0x3'),_0x3ab8('0x4'),'username','accessKey','remoteUri',_0x3ab8('0x5')],'include':[{'model':_0x3ab8('0x6'),'as':'Configurations','attributes':['id',_0x3ab8('0x3')],'include':[{'model':'VtigerField','as':_0x3ab8('0x7'),'attributes':['id','type',_0x3ab8('0x8'),_0x3ab8('0x9')],'include':[{'model':_0x3ab8('0xa'),'as':'Variable','attributes':['id','name']}]},{'model':_0x3ab8('0xb'),'as':_0x3ab8('0xc'),'attributes':['id',_0x3ab8('0xd'),_0x3ab8('0x8'),'key','keyType','keyContent',_0x3ab8('0x9')],'include':[{'model':_0x3ab8('0xa'),'as':_0x3ab8('0xa'),'attributes':['id','name']}]},{'model':_0x3ab8('0xb'),'as':'Fields','attributes':['id',_0x3ab8('0xd'),_0x3ab8('0x8'),_0x3ab8('0xe'),_0x3ab8('0xf'),_0x3ab8('0x10'),'variableName'],'include':[{'model':_0x3ab8('0xa'),'as':_0x3ab8('0xa'),'attributes':['id','name']}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x834c=['Configurations','VtigerField','Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','customField','Request','GetVtigerAccount','name','username','accessKey','serverUrl','VtigerConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x834c,0x143));var _0xc834=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x834c[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../../client');exports['getVtigerAccounts']=function(){return function(_0x457dc4){return client[_0xc834('0x0')](_0xc834('0x1'),{'options':{'raw':![],'attributes':['id',_0xc834('0x2'),'description',_0xc834('0x3'),_0xc834('0x4'),'remoteUri',_0xc834('0x5')],'include':[{'model':_0xc834('0x6'),'as':_0xc834('0x7'),'attributes':['id',_0xc834('0x2')],'include':[{'model':_0xc834('0x8'),'as':_0xc834('0x9'),'attributes':['id',_0xc834('0xa'),'content',_0xc834('0xb')],'include':[{'model':'Variable','as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]},{'model':_0xc834('0x8'),'as':_0xc834('0xd'),'attributes':['id',_0xc834('0xa'),_0xc834('0xe'),_0xc834('0xf'),_0xc834('0x10'),_0xc834('0x11'),_0xc834('0xb')],'include':[{'model':_0xc834('0xc'),'as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]},{'model':'VtigerField','as':_0xc834('0x12'),'attributes':['id',_0xc834('0xa'),_0xc834('0xe'),_0xc834('0x13'),_0xc834('0x14'),_0xc834('0x15'),_0xc834('0xb')],'include':[{'model':'Variable','as':_0xc834('0xc'),'attributes':['id',_0xc834('0x2')]}]}]}]},'log':'GetVtigerAccount'});};}; \ 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 6566330..689d3a8 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 _0x8568=['type','ZendeskConfiguration','name','ZendeskField','Subjects','content','variableName','Descriptions','key','keyType','keyContent','Variable','idField','nameField','customField','GetZendeskAccount','../../client','Request','username','password','token','authType','serverUrl'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x8568,0x124));var _0x8856=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8568[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x8856('0x0'));exports['getZendeskAccounts']=function(){return function(_0x1c441d){return client[_0x8856('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x8856('0x2'),_0x8856('0x3'),_0x8856('0x4'),'remoteUri',_0x8856('0x5'),_0x8856('0x6'),_0x8856('0x7')],'include':[{'model':_0x8856('0x8'),'as':'Configurations','attributes':['id',_0x8856('0x9')],'include':[{'model':'Tag','attributes':['id','name']},{'model':_0x8856('0xa'),'as':_0x8856('0xb'),'attributes':['id',_0x8856('0x7'),_0x8856('0xc'),_0x8856('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x8856('0xa'),'as':_0x8856('0xe'),'attributes':['id',_0x8856('0x7'),_0x8856('0xc'),_0x8856('0xf'),_0x8856('0x10'),_0x8856('0x11'),_0x8856('0xd')],'include':[{'model':'Variable','as':_0x8856('0x12'),'attributes':['id',_0x8856('0x9')]}]},{'model':_0x8856('0xa'),'as':'Fields','attributes':['id','type',_0x8856('0xc'),_0x8856('0x13'),_0x8856('0x14'),_0x8856('0x15'),'variableName'],'include':[{'model':_0x8856('0x12'),'as':_0x8856('0x12'),'attributes':['id','name']}]}]}]},'log':_0x8856('0x16')});};}; \ No newline at end of file +var _0xe89f=['Request','password','token','ZendeskConfiguration','Configurations','type','content','variableName','Variable','ZendeskField','Descriptions','key','keyType','keyContent','name','Fields','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts'];(function(_0x1dd9b7,_0x2cf490){var _0xc23314=function(_0x1622df){while(--_0x1622df){_0x1dd9b7['push'](_0x1dd9b7['shift']());}};_0xc23314(++_0x2cf490);}(_0xe89f,0xa6));var _0xfe89=function(_0x15de8b,_0xd383a3){_0x15de8b=_0x15de8b-0x0;var _0x1259ac=_0xe89f[_0x15de8b];return _0x1259ac;};'use strict';var client=require(_0xfe89('0x0'));exports[_0xfe89('0x1')]=function(){return function(_0x49ffe8){return client[_0xfe89('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name','username',_0xfe89('0x3'),_0xfe89('0x4'),'remoteUri','authType','serverUrl','type'],'include':[{'model':_0xfe89('0x5'),'as':_0xfe89('0x6'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':'ZendeskField','as':'Subjects','attributes':['id',_0xfe89('0x7'),_0xfe89('0x8'),_0xfe89('0x9')],'include':[{'model':_0xfe89('0xa'),'as':_0xfe89('0xa'),'attributes':['id','name']}]},{'model':_0xfe89('0xb'),'as':_0xfe89('0xc'),'attributes':['id',_0xfe89('0x7'),_0xfe89('0x8'),_0xfe89('0xd'),_0xfe89('0xe'),_0xfe89('0xf'),'variableName'],'include':[{'model':_0xfe89('0xa'),'as':'Variable','attributes':['id',_0xfe89('0x10')]}]},{'model':_0xfe89('0xb'),'as':_0xfe89('0x11'),'attributes':['id','type',_0xfe89('0x8'),'idField',_0xfe89('0x12'),_0xfe89('0x13'),_0xfe89('0x9')],'include':[{'model':_0xfe89('0xa'),'as':'Variable','attributes':['id',_0xfe89('0x10')]}]}]}]},'log':_0xfe89('0x14')});};}; \ 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 2c5c0e7..61184b9 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 _0x4cda=['Variable','type','key','keyContent','ZohoField','content','idField','nameField','customField','variableName','getZohoAccounts','Request','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','Subjects'];(function(_0x160c75,_0x35dabd){var _0x369484=function(_0x4ab5ee){while(--_0x4ab5ee){_0x160c75['push'](_0x160c75['shift']());}};_0x369484(++_0x35dabd);}(_0x4cda,0x1d2));var _0xa4cd=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x4cda[_0x4bfe08];return _0x1f9125;};'use strict';var client=require('../../client');exports[_0xa4cd('0x0')]=function(){return function(_0x1eb865){return client[_0xa4cd('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xa4cd('0x2'),_0xa4cd('0x3'),_0xa4cd('0x4'),_0xa4cd('0x5'),'clientId',_0xa4cd('0x6'),_0xa4cd('0x7'),_0xa4cd('0x8'),_0xa4cd('0x9')],'include':[{'model':_0xa4cd('0xa'),'as':_0xa4cd('0xb'),'attributes':['id',_0xa4cd('0x2'),_0xa4cd('0xc'),'moduleSearch',_0xa4cd('0x3')],'include':[{'model':'ZohoField','as':_0xa4cd('0xd'),'attributes':['id','type','content','variableName'],'include':[{'model':_0xa4cd('0xe'),'as':_0xa4cd('0xe'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Descriptions','attributes':['id',_0xa4cd('0xf'),'content',_0xa4cd('0x10'),'keyType',_0xa4cd('0x11'),'variableName'],'include':[{'model':_0xa4cd('0xe'),'as':_0xa4cd('0xe'),'attributes':['id',_0xa4cd('0x2')]}]},{'model':_0xa4cd('0x12'),'as':'Fields','attributes':['id','type',_0xa4cd('0x13'),_0xa4cd('0x14'),_0xa4cd('0x15'),_0xa4cd('0x16'),_0xa4cd('0x17')],'include':[{'model':_0xa4cd('0xe'),'as':_0xa4cd('0xe'),'attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x5dfd=['moduleSearch','description','ZohoField','Subjects','type','content','variableName','Variable','keyType','keyContent','Fields','idField','nameField','customField','../../client','Request','GetZohoAccount','name','zone','clientId','clientSecret','code','ZohoConfiguration','Configurations','moduleCreate'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5dfd,0x19e));var _0xd5df=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x5dfd[_0x95942];return _0x6d7f81;};'use strict';var client=require(_0xd5df('0x0'));exports['getZohoAccounts']=function(){return function(_0x55dd04){return client[_0xd5df('0x1')](_0xd5df('0x2'),{'options':{'raw':![],'attributes':['id',_0xd5df('0x3'),'description','host',_0xd5df('0x4'),_0xd5df('0x5'),_0xd5df('0x6'),'serverUrl',_0xd5df('0x7'),'refreshToken'],'include':[{'model':_0xd5df('0x8'),'as':_0xd5df('0x9'),'attributes':['id',_0xd5df('0x3'),_0xd5df('0xa'),_0xd5df('0xb'),_0xd5df('0xc')],'include':[{'model':_0xd5df('0xd'),'as':_0xd5df('0xe'),'attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),_0xd5df('0x11')],'include':[{'model':_0xd5df('0x12'),'as':_0xd5df('0x12'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Descriptions','attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),'key',_0xd5df('0x13'),_0xd5df('0x14'),_0xd5df('0x11')],'include':[{'model':_0xd5df('0x12'),'as':'Variable','attributes':['id',_0xd5df('0x3')]}]},{'model':_0xd5df('0xd'),'as':_0xd5df('0x15'),'attributes':['id',_0xd5df('0xf'),_0xd5df('0x10'),_0xd5df('0x16'),_0xd5df('0x17'),_0xd5df('0x18'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xd5df('0x3')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 8de6f4b..c9349f5 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 _0x9628=['resolve','number','every','map','interval','concat','Request','IntervalIftime','intervalIftime','../client','stack','replace','silly','isArray','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9628,0x9f));var _0x8962=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x9628[_0x13ea00];return _0x1f7347;};var logger=require('../../../config/logger')('dialer');var client=require(_0x8962('0x0'));function intervalIftime(_0x1ce469,_0x58a085){const _0x50df78=new Error()[_0x8962('0x1')][_0x8962('0x2')](/^Error/,'')['trim']();logger[_0x8962('0x3')]('intervalIftime\x20called\x20with',_0x1ce469,_0x58a085,_0x50df78);const _0x52d1f1=Array[_0x8962('0x4')](_0x1ce469);if(!_0x1ce469||_0x52d1f1&&_0x1ce469[_0x8962('0x5')]===0x0){return Promise[_0x8962('0x6')](![]);}else{var _0x3f5511=[];var _0x191816=[];var _0x3a8c35=_0x52d1f1?_0x1ce469:[_0x1ce469];var _0x1bede8=_0x3a8c35['every'](function(_0x3abfda){return typeof _0x3abfda===_0x8962('0x7');});var _0x5b9989=_0x3a8c35[_0x8962('0x8')](function(_0x4a5e2b){return typeof _0x4a5e2b==='string';});if(!_0x1bede8&&!_0x5b9989){_0x3f5511=_0x3a8c35[_0x8962('0x9')](function(_0x1b5244){return _0x1b5244['id'];});if(_0x3f5511[_0x8962('0x5')]===0x0){_0x191816=_0x3a8c35[_0x8962('0x9')](function(_0x575382){return _0x575382[_0x8962('0xa')];});}}else{if(_0x1bede8){_0x3f5511=_0x3f5511[_0x8962('0xb')](_0x3a8c35);}if(_0x5b9989){_0x191816=_0x191816[_0x8962('0xb')](_0x3a8c35);}}return client[_0x8962('0xc')](_0x8962('0xd'),{'intervalIds':_0x3f5511,'intervals':_0x191816,'timezone':_0x58a085,'log':_0x8962('0xd')});}}exports[_0x8962('0xe')]=intervalIftime; \ No newline at end of file +var _0xafc9=['isArray','every','number','string','map','length','interval','concat','IntervalIftime','dialer','../client','stack','replace','silly','intervalIftime\x20called\x20with'];(function(_0x140f31,_0x33b999){var _0x243a12=function(_0x5b9676){while(--_0x5b9676){_0x140f31['push'](_0x140f31['shift']());}};_0x243a12(++_0x33b999);}(_0xafc9,0x135));var _0x9afc=function(_0x84f510,_0x12e9cf){_0x84f510=_0x84f510-0x0;var _0x40341c=_0xafc9[_0x84f510];return _0x40341c;};var logger=require('../../../config/logger')(_0x9afc('0x0'));var client=require(_0x9afc('0x1'));function intervalIftime(_0x3bb162,_0x2d686c){const _0x2c0da4=new Error()[_0x9afc('0x2')][_0x9afc('0x3')](/^Error/,'')['trim']();logger[_0x9afc('0x4')](_0x9afc('0x5'),_0x3bb162,_0x2d686c,_0x2c0da4);const _0x183ac8=Array[_0x9afc('0x6')](_0x3bb162);if(!_0x3bb162||_0x183ac8&&_0x3bb162['length']===0x0){return Promise['resolve'](![]);}else{var _0x260669=[];var _0xb4884d=[];var _0x2e8905=_0x183ac8?_0x3bb162:[_0x3bb162];var _0xcf8784=_0x2e8905[_0x9afc('0x7')](function(_0x303058){return typeof _0x303058===_0x9afc('0x8');});var _0x1810e7=_0x2e8905[_0x9afc('0x7')](function(_0x294037){return typeof _0x294037===_0x9afc('0x9');});if(!_0xcf8784&&!_0x1810e7){_0x260669=_0x2e8905[_0x9afc('0xa')](function(_0x55a4e6){return _0x55a4e6['id'];});if(_0x260669[_0x9afc('0xb')]===0x0){_0xb4884d=_0x2e8905[_0x9afc('0xa')](function(_0x56f525){return _0x56f525[_0x9afc('0xc')];});}}else{if(_0xcf8784){_0x260669=_0x260669['concat'](_0x2e8905);}if(_0x1810e7){_0xb4884d=_0xb4884d[_0x9afc('0xd')](_0x2e8905);}}return client['Request'](_0x9afc('0xe'),{'intervalIds':_0x260669,'intervals':_0xb4884d,'timezone':_0x2d686c,'log':'IntervalIftime'});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 6028c9f..51f29ec 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 _0xde29=['moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voice','membername','starttime','endtime','dialstring'];(function(_0x3bce0e,_0x1b0739){var _0x439248=function(_0x338ec6){while(--_0x338ec6){_0x3bce0e['push'](_0x3bce0e['shift']());}};_0x439248(++_0x1b0739);}(_0xde29,0x1ba));var _0x9de2=function(_0x11d10f,_0x275d65){_0x11d10f=_0x11d10f-0x0;var _0x4f3a86=_0xde29[_0x11d10f];return _0x4f3a86;};'use strict';var moment=require(_0x9de2('0x0'));var _=require(_0x9de2('0x1'));var util=require('util');var client=require(_0x9de2('0x2'));exports[_0x9de2('0x3')]=function(_0x17c89e){var _0x573351=_0x17c89e[_0x9de2('0x4')]||_0x17c89e['queuecallerexitAt'];return client[_0x9de2('0x5')](_0x9de2('0x6'),{'body':{'channel':'voice','membername':_0x17c89e[_0x9de2('0x7')],'interface':_['isNil'](_0x17c89e[_0x9de2('0x8')])?util[_0x9de2('0x9')](_0x9de2('0xa'),_0x17c89e[_0x9de2('0x7')]):_0x17c89e['interface'],'type':_0x9de2('0xb'),'enterAt':_0x17c89e[_0x9de2('0xc')],'exitAt':_0x573351,'duration':moment(_0x573351)[_0x9de2('0xd')](_0x17c89e[_0x9de2('0xc')],_0x9de2('0xe')),'data1':'inbound','data2':_0x17c89e[_0x9de2('0xf')],'data3':_0x17c89e[_0x9de2('0x10')],'data4':null,'data5':_0x17c89e['queue'],'role':_0x9de2('0x11'),'internal':_0x17c89e[_0x9de2('0x12')]?_[_0x9de2('0x13')](_0x17c89e[_0x9de2('0x12')]):undefined,'uniqueid':_0x17c89e[_0x9de2('0x14')]},'log':_0x9de2('0x6')});};exports['voiceDialReport']=function(_0x44bf5e){return client[_0x9de2('0x5')]('CreateMemberReport',{'body':{'channel':_0x9de2('0x15'),'membername':_0x44bf5e[_0x9de2('0x16')],'interface':_0x44bf5e[_0x9de2('0x8')],'type':'TALKING','enterAt':_0x44bf5e[_0x9de2('0x17')],'exitAt':_0x44bf5e[_0x9de2('0x18')],'duration':moment(_0x44bf5e['endtime'])['diff'](_0x44bf5e[_0x9de2('0x17')],'seconds')>=0x0?moment(_0x44bf5e[_0x9de2('0x18')])[_0x9de2('0xd')](_0x44bf5e[_0x9de2('0x17')],'seconds'):null,'data1':'outbound','data2':_0x44bf5e[_0x9de2('0x12')],'data3':_0x44bf5e[_0x9de2('0x10')],'data4':_0x44bf5e[_0x9de2('0x19')]||null,'role':'agent','internal':_0x44bf5e[_0x9de2('0x12')]?_[_0x9de2('0x13')](_0x44bf5e['accountcode']):undefined,'uniqueid':_0x44bf5e[_0x9de2('0x14')]},'log':_0x9de2('0x6')});}; \ No newline at end of file +var _0xf696=['uniqueid','voiceDialReport','Request','voice','membername','starttime','endtime','outbound','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber'];(function(_0x85cb49,_0x50a08a){var _0x52f463=function(_0x3e816b){while(--_0x3e816b){_0x85cb49['push'](_0x85cb49['shift']());}};_0x52f463(++_0x50a08a);}(_0xf696,0x10e));var _0x6f69=function(_0x4e7aa7,_0x3ed2b5){_0x4e7aa7=_0x4e7aa7-0x0;var _0x398c74=_0xf696[_0x4e7aa7];return _0x398c74;};'use strict';var moment=require(_0x6f69('0x0'));var _=require('lodash');var util=require(_0x6f69('0x1'));var client=require(_0x6f69('0x2'));exports[_0x6f69('0x3')]=function(_0x4fc3e6){var _0xc1d90f=_0x4fc3e6[_0x6f69('0x4')]||_0x4fc3e6['queuecallerexitAt'];return client['Request'](_0x6f69('0x5'),{'body':{'channel':'voice','membername':_0x4fc3e6[_0x6f69('0x6')],'interface':_['isNil'](_0x4fc3e6[_0x6f69('0x7')])?util[_0x6f69('0x8')](_0x6f69('0x9'),_0x4fc3e6['lastAssignedTo']):_0x4fc3e6[_0x6f69('0x7')],'type':_0x6f69('0xa'),'enterAt':_0x4fc3e6[_0x6f69('0xb')],'exitAt':_0xc1d90f,'duration':moment(_0xc1d90f)[_0x6f69('0xc')](_0x4fc3e6[_0x6f69('0xb')],_0x6f69('0xd')),'data1':'inbound','data2':_0x4fc3e6[_0x6f69('0xe')],'data3':_0x4fc3e6[_0x6f69('0xf')],'data4':null,'data5':_0x4fc3e6[_0x6f69('0x10')],'role':_0x6f69('0x11'),'internal':_0x4fc3e6[_0x6f69('0x12')]?_[_0x6f69('0x13')](_0x4fc3e6[_0x6f69('0x12')]):undefined,'uniqueid':_0x4fc3e6[_0x6f69('0x14')]},'log':'CreateMemberReport'});};exports[_0x6f69('0x15')]=function(_0x7b2d5a){return client[_0x6f69('0x16')](_0x6f69('0x5'),{'body':{'channel':_0x6f69('0x17'),'membername':_0x7b2d5a[_0x6f69('0x18')],'interface':_0x7b2d5a[_0x6f69('0x7')],'type':_0x6f69('0xa'),'enterAt':_0x7b2d5a[_0x6f69('0x19')],'exitAt':_0x7b2d5a['endtime'],'duration':moment(_0x7b2d5a[_0x6f69('0x1a')])['diff'](_0x7b2d5a['starttime'],'seconds')>=0x0?moment(_0x7b2d5a['endtime'])[_0x6f69('0xc')](_0x7b2d5a[_0x6f69('0x19')],'seconds'):null,'data1':_0x6f69('0x1b'),'data2':_0x7b2d5a[_0x6f69('0x12')],'data3':_0x7b2d5a['exten'],'data4':_0x7b2d5a[_0x6f69('0x1c')]||null,'role':_0x6f69('0x11'),'internal':_0x7b2d5a[_0x6f69('0x12')]?_[_0x6f69('0x13')](_0x7b2d5a[_0x6f69('0x12')]):undefined,'uniqueid':_0x7b2d5a[_0x6f69('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 68a3b12..deff401 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 _0xa1aa=['previewRecallmeReminderInterval','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x5b7d94,_0x52df63){var _0x1caaba=function(_0x3e5a89){while(--_0x3e5a89){_0x5b7d94['push'](_0x5b7d94['shift']());}};_0x1caaba(++_0x52df63);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x9a3962,_0x222ab6){_0x9a3962=_0x9a3962-0x0;var _0xae58f0=_0xa1aa[_0x9a3962];return _0xae58f0;};'use strict';var client=require('../client');exports[_0xaa1a('0x0')]=function(){return client[_0xaa1a('0x1')](_0xaa1a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaa1a('0x3'),_0xaa1a('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xe235=['Request','ShowSetting','GetSettings','../client','getSettings'];(function(_0x3f95d2,_0x486845){var _0xa15508=function(_0x3b88ea){while(--_0x3b88ea){_0x3f95d2['push'](_0x3f95d2['shift']());}};_0xa15508(++_0x486845);}(_0xe235,0xe4));var _0x5e23=function(_0x3594d3,_0x521d3c){_0x3594d3=_0x3594d3-0x0;var _0x50a324=_0xe235[_0x3594d3];return _0x50a324;};'use strict';var client=require(_0x5e23('0x0'));exports[_0x5e23('0x1')]=function(){return client[_0x5e23('0x2')](_0x5e23('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x5e23('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 844c8a8..1532d7e 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 _0x36ff=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x36ff,0xb8));var _0xf36f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x36ff[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf36f('0x0'));exports[_0xf36f('0x1')]=function(_0x29dae0){return function(_0x2613bd){return client[_0xf36f('0x2')](_0xf36f('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf36f('0x4'),'html']},'log':_0xf36f('0x3')});};}; \ No newline at end of file +var _0xf34f=['../client','Request','name','html','GetTemplate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf34f,0x64));var _0xff34=function(_0x1d3faa,_0x1aa218){_0x1d3faa=_0x1d3faa-0x0;var _0x230100=_0xf34f[_0x1d3faa];return _0x230100;};'use strict';var client=require(_0xff34('0x0'));exports['getTemplates']=function(_0x40eb8a){return function(_0x5c19c4){return client[_0xff34('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xff34('0x2'),_0xff34('0x3')]},'log':_0xff34('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 317153e..f9271d2 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 _0xa648=['data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x50d0ec,_0x2885a3){var _0x1b36a5=function(_0x5ed7ae){while(--_0x5ed7ae){_0x50d0ec['push'](_0x50d0ec['shift']());}};_0x1b36a5(++_0x2885a3);}(_0xa648,0xca));var _0x8a64=function(_0x1cc51b,_0x48dde7){_0x1cc51b=_0x1cc51b-0x0;var _0x38d844=_0xa648[_0x1cc51b];return _0x38d844;};'use strict';var client=require(_0x8a64('0x0'));exports[_0x8a64('0x1')]=function(_0x5af980){return function(_0x4d780c){return client[_0x8a64('0x2')](_0x8a64('0x3'),{'options':{'raw':![],'attributes':['id',_0x8a64('0x4'),_0x8a64('0x5'),_0x8a64('0x6')],'include':[{'model':_0x8a64('0x7'),'as':_0x8a64('0x8'),'attributes':['id',_0x8a64('0x9'),_0x8a64('0xa'),_0x8a64('0xb')]},{'model':_0x8a64('0x7'),'as':_0x8a64('0xc'),'attributes':['id',_0x8a64('0x9'),'operator',_0x8a64('0xb')]},{'model':_0x8a64('0xd'),'as':_0x8a64('0xe'),'attributes':['id',_0x8a64('0xf'),_0x8a64('0x10'),_0x8a64('0x11'),_0x8a64('0x12'),'data4',_0x8a64('0x13'),_0x8a64('0x14'),_0x8a64('0x15')]}]},'log':_0x8a64('0x3')});};}; \ No newline at end of file +var _0x5667=['Condition','AllConditions','operator','value','AnyConditions','field','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x5667,0x18b));var _0x7566=function(_0x534f8b,_0x224e4d){_0x534f8b=_0x534f8b-0x0;var _0x4b9523=_0x5667[_0x534f8b];return _0x4b9523;};'use strict';var client=require(_0x7566('0x0'));exports[_0x7566('0x1')]=function(_0x357980){return function(_0x330dd8){return client['Request'](_0x7566('0x2'),{'options':{'raw':![],'attributes':['id',_0x7566('0x3'),_0x7566('0x4'),'status'],'include':[{'model':_0x7566('0x5'),'as':_0x7566('0x6'),'attributes':['id','field',_0x7566('0x7'),_0x7566('0x8')]},{'model':'Condition','as':_0x7566('0x9'),'attributes':['id',_0x7566('0xa'),_0x7566('0x7'),_0x7566('0x8')]},{'model':'Action','as':_0x7566('0xb'),'attributes':['id',_0x7566('0xc'),_0x7566('0xd'),_0x7566('0xe'),_0x7566('0xf'),_0x7566('0x10'),_0x7566('0x11'),_0x7566('0x12'),_0x7566('0x13')]}]},'log':_0x7566('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 87be7d7..c33570f 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 _0xa7dc=['Request','name','registry','defaultuser','GetTrunk','../client','getTrunks'];(function(_0x4ebbdd,_0x1bc355){var _0x3246ad=function(_0x22883f){while(--_0x22883f){_0x4ebbdd['push'](_0x4ebbdd['shift']());}};_0x3246ad(++_0x1bc355);}(_0xa7dc,0x11d));var _0xca7d=function(_0x5f1e30,_0x3b853d){_0x5f1e30=_0x5f1e30-0x0;var _0x480cbb=_0xa7dc[_0x5f1e30];return _0x480cbb;};'use strict';var client=require(_0xca7d('0x0'));exports[_0xca7d('0x1')]=function(_0x150001){return function(_0x4ea9c6){return client[_0xca7d('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xca7d('0x3'),_0xca7d('0x4'),_0xca7d('0x5')]},'log':_0xca7d('0x6')});};}; \ No newline at end of file +var _0x7aaf=['name','defaultuser','../client'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x21e7b2,_0x2720f8){_0x21e7b2=_0x21e7b2-0x0;var _0x14e812=_0x7aaf[_0x21e7b2];return _0x14e812;};'use strict';var client=require(_0xf7aa('0x0'));exports['getTrunks']=function(_0x3e729f){return function(_0x32ab7c){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf7aa('0x1'),'registry',_0xf7aa('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b88b989..e43b3ae 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x8e3507,_0x7c734c){_0x8e3507=_0x8e3507-0x0;var _0x48c52b=_0xe706[_0x8e3507];return _0x48c52b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0843ae4..9cff14a 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 _0x9a15=['create','Request','update','UpdateVoiceAgentReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a15,0x1c1));var _0x59a1=function(_0x3d8f21,_0x359d21){_0x3d8f21=_0x3d8f21-0x0;var _0x3cdde5=_0x9a15[_0x3d8f21];return _0x3cdde5;};'use strict';var client=require(_0x59a1('0x0'));exports[_0x59a1('0x1')]=function(_0x432cde){return client[_0x59a1('0x2')]('CreateVoiceAgentReport',{'body':_0x432cde,'log':'CreateVoiceAgentReport'});};exports[_0x59a1('0x3')]=function(_0x5af988,_0x220e5a,_0x2efe0c){return client[_0x59a1('0x2')]('UpdateVoiceAgentReport',{'body':_0x5af988,'options':{'where':{'uniqueid':_0x220e5a,'interface':_0x2efe0c,'agentcomplete':!![]}},'log':_0x59a1('0x4')});}; \ No newline at end of file +var _0xb3a3=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xb3a3,0x73));var _0x3b3a=function(_0xd702f0,_0x50f40c){_0xd702f0=_0xd702f0-0x0;var _0x17bafd=_0xb3a3[_0xd702f0];return _0x17bafd;};'use strict';var client=require(_0x3b3a('0x0'));exports[_0x3b3a('0x1')]=function(_0xc0c452){return client[_0x3b3a('0x2')]('CreateVoiceAgentReport',{'body':_0xc0c452,'log':_0x3b3a('0x3')});};exports[_0x3b3a('0x4')]=function(_0x3cdad9,_0x2b763f,_0x4da3d1){return client[_0x3b3a('0x2')](_0x3b3a('0x5'),{'body':_0x3cdad9,'options':{'where':{'uniqueid':_0x2b763f,'interface':_0x4da3d1,'agentcomplete':!![]}},'log':_0x3b3a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7447949..2158e08 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 _0x9a3f=['GetVoiceCallReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','GetVoiceCallReports','util','../client','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION'];(function(_0x8d928a,_0x141aa8){var _0xaf566f=function(_0x529315){while(--_0x529315){_0x8d928a['push'](_0x8d928a['shift']());}};_0xaf566f(++_0x141aa8);}(_0x9a3f,0x109));var _0xf9a3=function(_0x147007,_0x1f90b6){_0x147007=_0x147007-0x0;var _0x614f59=_0x9a3f[_0x147007];return _0x614f59;};'use strict';var moment=require('moment');var util=require(_0xf9a3('0x0'));var _=require('lodash');var client=require(_0xf9a3('0x1'));exports['create']=function(_0x131f89){return client[_0xf9a3('0x2')](_0xf9a3('0x3'),{'body':_[_0xf9a3('0x4')](_0x131f89,{'source':_0x131f89['calleridnum'],'destinationcontext':_0x131f89['context'],'callerid':_0x131f89[_0xf9a3('0x5')],'amaflags':_0xf9a3('0x6')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xf9a3('0x7'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf9a3('0x8')](_0xf9a3('0x9'))[_0xf9a3('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf9a3('0xb')](_0xf9a3('0x9'))[_0xf9a3('0xa')](_0xf9a3('0xc'))]}},'attributes':['type',_0xf9a3('0xd'),_0xf9a3('0xe'),_0xf9a3('0xf')]},'log':_0xf9a3('0x10')});};}; \ No newline at end of file +var _0x1f1d=['endOf','disposition','duration','billableseconds','moment','lodash','../client','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd71a75,_0x51afd3){var _0x278bf9=function(_0x586b78){while(--_0x586b78){_0xd71a75['push'](_0xd71a75['shift']());}};_0x278bf9(++_0x51afd3);}(_0x1f1d,0x100));var _0xd1f1=function(_0x40060f,_0x5750eb){_0x40060f=_0x40060f-0x0;var _0x15ad40=_0x1f1d[_0x40060f];return _0x15ad40;};'use strict';var moment=require(_0xd1f1('0x0'));var util=require('util');var _=require(_0xd1f1('0x1'));var client=require(_0xd1f1('0x2'));exports['create']=function(_0x40f829){return client['Request'](_0xd1f1('0x3'),{'body':_[_0xd1f1('0x4')](_0x40f829,{'source':_0x40f829['calleridnum'],'destinationcontext':_0x40f829['context'],'callerid':_0x40f829[_0xd1f1('0x5')],'amaflags':_0xd1f1('0x6')}),'log':_0xd1f1('0x3')});};exports[_0xd1f1('0x7')]=function(){return function(){return client[_0xd1f1('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd1f1('0x9')],'createdAt':{'$between':[moment()[_0xd1f1('0xa')](_0xd1f1('0xb'))[_0xd1f1('0xc')](_0xd1f1('0xd')),moment()[_0xd1f1('0xe')]('day')[_0xd1f1('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xd1f1('0xf'),_0xd1f1('0x10'),_0xd1f1('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ef0aefa..823299e 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 _0xa014=['CreateVoiceDialReport','create'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xa014,0x81));var _0x4a01=function(_0x43625a,_0x11ffa1){_0x43625a=_0x43625a-0x0;var _0x41dfb5=_0xa014[_0x43625a];return _0x41dfb5;};'use strict';var client=require('../client');exports[_0x4a01('0x0')]=function(_0x4c839b){return client['Request'](_0x4a01('0x1'),{'body':_0x4c839b,'log':_0x4a01('0x1')});}; \ No newline at end of file +var _0x2498=['create','CreateVoiceDialReport','../client'];(function(_0x4e4228,_0x9c1d93){var _0x219955=function(_0x2f31d6){while(--_0x2f31d6){_0x4e4228['push'](_0x4e4228['shift']());}};_0x219955(++_0x9c1d93);}(_0x2498,0x158));var _0x8249=function(_0x279629,_0x233fde){_0x279629=_0x279629-0x0;var _0x26b2c4=_0x2498[_0x279629];return _0x26b2c4;};'use strict';var client=require(_0x8249('0x0'));exports[_0x8249('0x1')]=function(_0x18642a){return client['Request'](_0x8249('0x2'),{'body':_0x18642a,'log':_0x8249('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index dfed46c..10a4614 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 _0xf46a=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions','../client'];(function(_0x104857,_0x34844c){var _0x5c7d6d=function(_0x1aa95f){while(--_0x1aa95f){_0x104857['push'](_0x104857['shift']());}};_0x5c7d6d(++_0x34844c);}(_0xf46a,0xa4));var _0xaf46=function(_0x23e1c8,_0x45c6c6){_0x23e1c8=_0x23e1c8-0x0;var _0x256457=_0xf46a[_0x23e1c8];return _0x256457;};'use strict';var client=require(_0xaf46('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xaf46('0x1')](_0xaf46('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xaf46('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xaf46('0x4')});};}; \ No newline at end of file +var _0x8eeb=['recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x266cac,_0x76b613){var _0x52ac0b=function(_0x31113b){while(--_0x31113b){_0x266cac['push'](_0x266cac['shift']());}};_0x52ac0b(++_0x76b613);}(_0x8eeb,0x183));var _0xb8ee=function(_0x3c0670,_0xde741a){_0x3c0670=_0x3c0670-0x0;var _0x5293ff=_0x8eeb[_0x3c0670];return _0x5293ff;};'use strict';var client=require(_0xb8ee('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb8ee('0x1')](_0xb8ee('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xb8ee('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb8ee('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5f7efd6..34d6599 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 _0xeb3d=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','../client','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb3d,0x102));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xdeb3('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xdeb3('0x1')](_0xdeb3('0x2'),{'options':{'raw':![],'attributes':['id',_0xdeb3('0x3'),_0xdeb3('0x4'),_0xdeb3('0x5'),'autopause',_0xdeb3('0x6'),_0xdeb3('0x7'),_0xdeb3('0x8'),_0xdeb3('0x9'),'dialLimitChannel',_0xdeb3('0xa'),_0xdeb3('0xb'),_0xdeb3('0xc'),_0xdeb3('0xd'),_0xdeb3('0xe'),_0xdeb3('0xf'),_0xdeb3('0x10'),_0xdeb3('0x11'),_0xdeb3('0x12'),'dialQueueTimeout',_0xdeb3('0x13'),'dialCongestionMaxRetry',_0xdeb3('0x14'),_0xdeb3('0x15'),_0xdeb3('0x16'),'dialNoAnswerMaxRetry',_0xdeb3('0x17'),_0xdeb3('0x18'),_0xdeb3('0x19'),_0xdeb3('0x1a'),'dialPrefix','dialCheckDuplicateType',_0xdeb3('0x1b'),_0xdeb3('0x1c'),'dialAMDGreeting',_0xdeb3('0x1d'),_0xdeb3('0x1e'),_0xdeb3('0x1f'),'dialAMDBetweenWordsSilence',_0xdeb3('0x20'),_0xdeb3('0x21'),_0xdeb3('0x22'),_0xdeb3('0x23'),_0xdeb3('0x24'),'dialRecallInQueue','dialOrderByScheduledAt',_0xdeb3('0x25'),_0xdeb3('0x26'),_0xdeb3('0x27'),_0xdeb3('0x6'),'strategy',_0xdeb3('0x28'),_0xdeb3('0x29'),_0xdeb3('0x2a'),_0xdeb3('0x2b'),'dialDropMaxRetry','dialDropRetryFrequency',_0xdeb3('0x2c'),_0xdeb3('0x2d'),_0xdeb3('0x2e'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xdeb3('0x2f'),_0xdeb3('0x30'),_0xdeb3('0x31'),_0xdeb3('0x32'),'dialPreviewAutoRecallMe',_0xdeb3('0x33')],'include':[{'model':'Trunk','as':_0xdeb3('0x34'),'attributes':['id',_0xdeb3('0x3'),_0xdeb3('0x35'),_0xdeb3('0x36')]},{'model':'Pause','as':_0xdeb3('0x37'),'attributes':['id',_0xdeb3('0x3')]},{'model':_0xdeb3('0x34'),'as':_0xdeb3('0x38'),'attributes':['id',_0xdeb3('0x3'),'callerid',_0xdeb3('0x36')]},{'model':_0xdeb3('0x39'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xdeb3('0x39'),'as':'Intervals','attributes':['id',_0xdeb3('0x3'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x9d3f=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x1233cb,_0x5b57d8){var _0x53c66a=function(_0x1daa8b){while(--_0x1daa8b){_0x1233cb['push'](_0x1233cb['shift']());}};_0x53c66a(++_0x5b57d8);}(_0x9d3f,0x1b8));var _0xf9d3=function(_0x47cd1e,_0x350e38){_0x47cd1e=_0x47cd1e-0x0;var _0x10953e=_0x9d3f[_0x47cd1e];return _0x10953e;};'use strict';var client=require(_0xf9d3('0x0'));exports[_0xf9d3('0x1')]=function(){return function(){return client[_0xf9d3('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf9d3('0x3'),_0xf9d3('0x4'),_0xf9d3('0x5'),'monitor_format',_0xf9d3('0x6'),'dialActive',_0xf9d3('0x7'),'dialLimitChannel','dialLimitQueue',_0xf9d3('0x8'),_0xf9d3('0x9'),_0xf9d3('0xa'),_0xf9d3('0xb'),_0xf9d3('0xc'),'dialOriginateCallerIdNumber',_0xf9d3('0xd'),'dialQueueOptions',_0xf9d3('0xe'),_0xf9d3('0xf'),'dialCongestionMaxRetry',_0xf9d3('0x10'),_0xf9d3('0x11'),_0xf9d3('0x12'),_0xf9d3('0x13'),_0xf9d3('0x14'),_0xf9d3('0x15'),_0xf9d3('0x16'),_0xf9d3('0x17'),_0xf9d3('0x18'),_0xf9d3('0x19'),_0xf9d3('0x1a'),_0xf9d3('0x1b'),_0xf9d3('0x1c'),_0xf9d3('0x1d'),_0xf9d3('0x1e'),_0xf9d3('0x1f'),_0xf9d3('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xf9d3('0x21'),_0xf9d3('0x22'),_0xf9d3('0x23'),'dialRecallInQueue',_0xf9d3('0x24'),_0xf9d3('0x25'),_0xf9d3('0x26'),_0xf9d3('0x27'),_0xf9d3('0x28'),_0xf9d3('0x29'),_0xf9d3('0x2a'),_0xf9d3('0x2b'),_0xf9d3('0x2c'),_0xf9d3('0x2d'),_0xf9d3('0x2e'),_0xf9d3('0x2f'),_0xf9d3('0x30'),_0xf9d3('0x31'),_0xf9d3('0x32'),'dialMachineRetryFrequency',_0xf9d3('0x33'),_0xf9d3('0x34'),_0xf9d3('0x35'),_0xf9d3('0x36'),_0xf9d3('0x37'),_0xf9d3('0x38'),_0xf9d3('0x39')],'include':[{'model':_0xf9d3('0x3a'),'as':'Trunk','attributes':['id',_0xf9d3('0x3b'),_0xf9d3('0x3c'),'active']},{'model':'Pause','as':_0xf9d3('0x3d'),'attributes':['id',_0xf9d3('0x3b')]},{'model':_0xf9d3('0x3a'),'as':_0xf9d3('0x3e'),'attributes':['id','name','callerid',_0xf9d3('0x3f')]},{'model':_0xf9d3('0x40'),'as':'Interval','attributes':['id',_0xf9d3('0x3b')],'include':[{'model':_0xf9d3('0x40'),'as':_0xf9d3('0x41'),'attributes':['id',_0xf9d3('0x3b'),'interval']}]}]},'log':_0xf9d3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7e513e7..29c51c6 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(_0x441bda,_0x3151b6){var _0x118b82=function(_0x5628a7){while(--_0x5628a7){_0x441bda['push'](_0x441bda['shift']());}};_0x118b82(++_0x3151b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x33c44e,_0xd8b852){var _0x43be81=function(_0x23bede){while(--_0x23bede){_0x33c44e['push'](_0x33c44e['shift']());}};_0x43be81(++_0xd8b852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 3b72764..77dcb5d 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 _0x7b02=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x464842,_0x3a0ee9){var _0x550cc6=function(_0x514695){while(--_0x514695){_0x464842['push'](_0x464842['shift']());}};_0x550cc6(++_0x3a0ee9);}(_0x7b02,0xc6));var _0x27b0=function(_0x39401b,_0x394951){_0x39401b=_0x39401b-0x0;var _0x2e7f5b=_0x7b02[_0x39401b];return _0x2e7f5b;};'use strict';var client=require(_0x27b0('0x0'));exports[_0x27b0('0x1')]=function(_0x1298cd){return function(){return client['Request'](_0x27b0('0x2'),{'options':{'where':{'VoiceQueueId':_0x1298cd,'paused':!![]},'raw':!![]},'log':_0x27b0('0x1')});};}; \ No newline at end of file +var _0xc20e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3a0222,_0x291410){var _0x10de41=function(_0x4c9743){while(--_0x4c9743){_0x3a0222['push'](_0x3a0222['shift']());}};_0x10de41(++_0x291410);}(_0xc20e,0xdf));var _0xec20=function(_0x4dc988,_0x442649){_0x4dc988=_0x4dc988-0x0;var _0xbb6d68=_0xc20e[_0x4dc988];return _0xbb6d68;};'use strict';var client=require(_0xec20('0x0'));exports[_0xec20('0x1')]=function(_0x20a0cb){return function(){return client[_0xec20('0x2')](_0xec20('0x3'),{'options':{'where':{'VoiceQueueId':_0x20a0cb,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 2e0120a..fb953c9 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(_0x550e01,_0x175f1f){var _0x5d4a38=function(_0x42fea7){while(--_0x42fea7){_0x550e01['push'](_0x550e01['shift']());}};_0x5d4a38(++_0x175f1f);}(_0x7a54,0x106));var _0x47a5=function(_0x32f05a,_0x154f61){_0x32f05a=_0x32f05a-0x0;var _0x3c79e0=_0x7a54[_0x32f05a];return _0x3c79e0;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3b09c4,_0x199706){var _0x6c98c9=function(_0x43c76f){while(--_0x43c76f){_0x3b09c4['push'](_0x3b09c4['shift']());}};_0x6c98c9(++_0x199706);}(_0x7a54,0x106));var _0x47a5=function(_0x5e4a74,_0x3dcdb9){_0x5e4a74=_0x5e4a74-0x0;var _0x406401=_0x7a54[_0x5e4a74];return _0x406401;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 498cd8f..563e677 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 _0xeac6=['secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','origtransfererexten','attended','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','isexternal','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x2d91f2,_0x4b56ae){var _0x1ba446=function(_0x1668e0){while(--_0x1668e0){_0x2d91f2['push'](_0x2d91f2['shift']());}};_0x1ba446(++_0x4b56ae);}(_0xeac6,0x182));var _0x6eac=function(_0x5a19dd,_0x30c16d){_0x5a19dd=_0x5a19dd-0x0;var _0x361faa=_0xeac6[_0x5a19dd];return _0x361faa;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x6eac('0x0')]=function(_0x386758){return client['Request'](_0x6eac('0x1'),{'body':{'result':_0x386758['result'],'transfererchannel':_0x386758[_0x6eac('0x2')],'transferercalleridnum':_0x386758[_0x6eac('0x3')],'transferercalleridname':_0x386758[_0x6eac('0x4')],'transfererconnectedlinenum':_0x386758[_0x6eac('0x5')],'transfererconnectedlinename':_0x386758['transfererconnectedlinename'],'transfereraccountcode':_0x386758[_0x6eac('0x6')],'transferercontext':_0x386758[_0x6eac('0x7')],'transfererexten':_0x386758[_0x6eac('0x8')],'transfererlinkedid':_0x386758['transfererlinkedid'],'transfereechannel':_0x386758[_0x6eac('0x9')],'transfereecalleridnum':_0x386758['transfereecalleridnum'],'transfereecalleridname':_0x386758['transfereecalleridname'],'transfereeconnectedlinenum':_0x386758[_0x6eac('0xa')],'transfereeconnectedlinename':_0x386758[_0x6eac('0xb')],'transfereeaccountcode':_0x386758[_0x6eac('0xc')],'transfereecontext':_0x386758[_0x6eac('0xd')],'transfereeexten':_0x386758['transfereeexten'],'transfereelinkedid':_0x386758['transfereelinkedid'],'isexternal':_0x386758[_0x6eac('0xe')],'context':_0x386758['context'],'extension':_0x386758['extension'],'type':'blind'},'log':_0x6eac('0x1')});};exports[_0x6eac('0xf')]=function(_0x7b171e){return client[_0x6eac('0x10')](_0x6eac('0x1'),{'body':{'result':_0x7b171e['result'],'transfererchannel':_0x7b171e[_0x6eac('0x11')],'transferercalleridnum':_0x7b171e[_0x6eac('0x12')],'transferercalleridname':_0x7b171e[_0x6eac('0x13')],'transfererconnectedlinenum':_0x7b171e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x7b171e[_0x6eac('0x14')],'transfereraccountcode':_0x7b171e['origtransfereraccountcode'],'transferercontext':_0x7b171e[_0x6eac('0x15')],'transfererexten':_0x7b171e['secondtransfererexten'],'transfererlinkedid':_0x7b171e[_0x6eac('0x16')],'transfereechannel':_0x7b171e['transfertargetchannel'],'transfereecalleridnum':_0x7b171e[_0x6eac('0x17')],'transfereecalleridname':_0x7b171e[_0x6eac('0x18')],'transfereeconnectedlinenum':_0x7b171e[_0x6eac('0x19')],'transfereeconnectedlinename':_0x7b171e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x7b171e['transfertargetaccountcode'],'transfereecontext':_0x7b171e['transfertargetcontext'],'transfereeexten':_0x7b171e[_0x6eac('0x1a')],'transfereelinkedid':_0x7b171e['transfertargetlinkedid'],'isexternal':_0x7b171e['isexternal'],'context':_0x7b171e['origtransferercontext'],'extension':_0x7b171e[_0x6eac('0x1b')],'type':_0x6eac('0x1c')},'log':_0x6eac('0x1')});}; \ No newline at end of file +var _0xb0a5=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0xf3a8b5,_0x716ce){var _0x494211=function(_0x2c6c2e){while(--_0x2c6c2e){_0xf3a8b5['push'](_0xf3a8b5['shift']());}};_0x494211(++_0x716ce);}(_0xb0a5,0xfa));var _0x5b0a=function(_0x1b5f7a,_0x281348){_0x1b5f7a=_0x1b5f7a-0x0;var _0x205dd7=_0xb0a5[_0x1b5f7a];return _0x205dd7;};'use strict';var client=require(_0x5b0a('0x0'));exports[_0x5b0a('0x1')]={};exports[_0x5b0a('0x2')]=function(_0x24fa9b){return client[_0x5b0a('0x3')](_0x5b0a('0x4'),{'body':{'result':_0x24fa9b['result'],'transfererchannel':_0x24fa9b[_0x5b0a('0x5')],'transferercalleridnum':_0x24fa9b[_0x5b0a('0x6')],'transferercalleridname':_0x24fa9b[_0x5b0a('0x7')],'transfererconnectedlinenum':_0x24fa9b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x24fa9b[_0x5b0a('0x8')],'transfereraccountcode':_0x24fa9b[_0x5b0a('0x9')],'transferercontext':_0x24fa9b[_0x5b0a('0xa')],'transfererexten':_0x24fa9b[_0x5b0a('0xb')],'transfererlinkedid':_0x24fa9b[_0x5b0a('0xc')],'transfereechannel':_0x24fa9b[_0x5b0a('0xd')],'transfereecalleridnum':_0x24fa9b['transfereecalleridnum'],'transfereecalleridname':_0x24fa9b[_0x5b0a('0xe')],'transfereeconnectedlinenum':_0x24fa9b[_0x5b0a('0xf')],'transfereeconnectedlinename':_0x24fa9b['transfereeconnectedlinename'],'transfereeaccountcode':_0x24fa9b[_0x5b0a('0x10')],'transfereecontext':_0x24fa9b['transfereecontext'],'transfereeexten':_0x24fa9b[_0x5b0a('0x11')],'transfereelinkedid':_0x24fa9b[_0x5b0a('0x12')],'isexternal':_0x24fa9b[_0x5b0a('0x13')],'context':_0x24fa9b[_0x5b0a('0x14')],'extension':_0x24fa9b[_0x5b0a('0x15')],'type':_0x5b0a('0x16')},'log':_0x5b0a('0x4')});};exports['attendedTransfer']=function(_0x1e7761){return client[_0x5b0a('0x3')](_0x5b0a('0x4'),{'body':{'result':_0x1e7761[_0x5b0a('0x17')],'transfererchannel':_0x1e7761[_0x5b0a('0x18')],'transferercalleridnum':_0x1e7761['origtransferercalleridnum'],'transferercalleridname':_0x1e7761[_0x5b0a('0x19')],'transfererconnectedlinenum':_0x1e7761[_0x5b0a('0x1a')],'transfererconnectedlinename':_0x1e7761[_0x5b0a('0x1b')],'transfereraccountcode':_0x1e7761[_0x5b0a('0x1c')],'transferercontext':_0x1e7761[_0x5b0a('0x1d')],'transfererexten':_0x1e7761[_0x5b0a('0x1e')],'transfererlinkedid':_0x1e7761[_0x5b0a('0x1f')],'transfereechannel':_0x1e7761[_0x5b0a('0x20')],'transfereecalleridnum':_0x1e7761[_0x5b0a('0x21')],'transfereecalleridname':_0x1e7761['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1e7761[_0x5b0a('0x22')],'transfereeconnectedlinename':_0x1e7761[_0x5b0a('0x23')],'transfereeaccountcode':_0x1e7761[_0x5b0a('0x24')],'transfereecontext':_0x1e7761[_0x5b0a('0x25')],'transfereeexten':_0x1e7761['transfertargetexten'],'transfereelinkedid':_0x1e7761['transfertargetlinkedid'],'isexternal':_0x1e7761['isexternal'],'context':_0x1e7761[_0x5b0a('0x26')],'extension':_0x1e7761['origtransfererexten'],'type':_0x5b0a('0x27')},'log':_0x5b0a('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c8c9293..34d15b2 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(_0x194432,_0x3a5a05){var _0x1ef1cf=function(_0xca97c9){while(--_0xca97c9){_0x194432['push'](_0x194432['shift']());}};_0x1ef1cf(++_0x3a5a05);}(_0xb10b,0x12a));var _0xbb10=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xb10b[_0x587ba2];return _0x50ec73;};'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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x267196,_0x213148){var _0x33fe71=function(_0x27f900){while(--_0x27f900){_0x267196['push'](_0x267196['shift']());}};_0x33fe71(++_0x213148);}(_0x7a54,0x106));var _0x47a5=function(_0xcbe108,_0x1ae22e){_0xcbe108=_0xcbe108-0x0;var _0x2d7668=_0x7a54[_0xcbe108];return _0x2d7668;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 ef87b3c..24ee422 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 _0x0852=['name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','map','destcalleridnum','calleridnum','routeId','firstName','mobile','fax','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format'];(function(_0x301613,_0x5d4466){var _0x328cee=function(_0x3c8e20){while(--_0x3c8e20){_0x301613['push'](_0x301613['shift']());}};_0x328cee(++_0x5d4466);}(_0x0852,0xe5));var _0x2085=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0852[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x2085('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2085('0x1'));var util=require(_0x2085('0x2'));var config=require('../../../../config/environment');var logger=require(_0x2085('0x3'))(_0x2085('0x4'));var cmContactRpc=require(_0x2085('0x5'));config[_0x2085('0x6')]=_[_0x2085('0x7')](config['redis'],{'host':_0x2085('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x147b61,_0x38d07d,_0x4b0ccb,_0x26b82c,_0x206694){logger[_0x2085('0x9')](_0x2085('0xa'),_0x147b61,_0x38d07d['id'],_0x4b0ccb,_0x26b82c,JSON[_0x2085('0xb')](_0x206694));io['to'](_0x4b0ccb)[_0x2085('0xc')](_0x26b82c,_0x206694);}exports[_0x2085('0xd')]=function(_0x16b121,_0x318d27,_0x2abbfc,_0x1c3f7d){var _0xdfe40d,_0x4dfdd2;var _0x1490a8={};var _0x58cc32;var _0x3ce6c5=Number(_0x2abbfc[_0x2085('0xe')]);var _0x1908a1=_0x2abbfc[_0x2085('0xf')]?Boolean(Number(_0x2abbfc[_0x2085('0xf')])):![];var _0x1bc4e6;var _0x48cc42=![];if(!_['isNil'](_0x2abbfc[_0x2085('0x10')])){if(_0x2abbfc[_0x2085('0x10')]=='1')_0x48cc42=!![];}if(!_0x48cc42){if(_0x1c3f7d['xmd-contactid']){_0x1490a8['id']=_0x1c3f7d[_0x2085('0x11')];}}if(!_0x1490a8['id']){_0x1490a8[_0x2085('0x12')]=_0x3ce6c5;_0x1bc4e6=_0x2abbfc['data3']&&_0x2abbfc[_0x2085('0x13')]!=='0'?_0x2abbfc[_0x2085('0x13')][_0x2085('0x14')](','):['phone'];_0x1490a8['$or']=_[_0x2085('0x15')](_0x1bc4e6,function(_0x51eccc){var _0x2c82b0={};_0x2c82b0[_0x51eccc]=_0x1c3f7d['routeId']?_0x1c3f7d[_0x2085('0x16')]:_0x1c3f7d[_0x2085('0x17')];return _0x2c82b0;});_0x58cc32=_0x1c3f7d[_0x2085('0x18')]?_0x1c3f7d[_0x2085('0x16')]:_0x1c3f7d[_0x2085('0x17')];}var _0x159522=['id',_0x2085('0x19'),'lastName','phone',_0x2085('0x1a'),_0x2085('0x1b'),'ListId',_0x2085('0x1c'),'scheduledAt',_0x2085('0x1d')];var _0x4e76e5=_[_0x2085('0x1e')](_0x159522,_0x1bc4e6);BPromise[_0x2085('0x1f')]()['then'](cmContactRpc[_0x2085('0x20')]({'attributes':_0x4e76e5,'where':_0x1490a8,'phone':_0x58cc32}))[_0x2085('0x21')](function(_0x10bdae){_0x4dfdd2=_0x10bdae;if(!_[_0x2085('0x22')](_0x4dfdd2)){if(_0x4dfdd2[_0x2085('0x23')]===0x1){_0xdfe40d=_0x4dfdd2[0x0];logger[_0x2085('0x9')](_0x2085('0x24'),_0x1c3f7d['uniqueid'],_0x318d27['id'],_0xdfe40d['id']);}else{logger[_0x2085('0x9')](_0x2085('0x25'),_0x1c3f7d[_0x2085('0x26')],_0x318d27['id'],_['map'](_0x4dfdd2,'id')['join'](','));}return;}else{logger[_0x2085('0x9')](_0x2085('0x27'),_0x1c3f7d[_0x2085('0x26')],_0x318d27['id']);var _0x8231={'ListId':_0x3ce6c5};var _0x37f7ac=_0x2abbfc['data4']&&_0x2abbfc['data4']!=='0'?_0x2abbfc[_0x2085('0x28')]:'phone';if(_0x1908a1){logger[_0x2085('0x9')](_0x2085('0x29'),_0x1c3f7d[_0x2085('0x26')],_0x318d27['id']);_0x8231[_0x37f7ac]=_[_0x2085('0x2a')](_0x1c3f7d[_0x2085('0x18')])?_0x1c3f7d['calleridnum']:_0x1c3f7d[_0x2085('0x16')];if(_[_0x2085('0x2a')](_0x1c3f7d[_0x2085('0x18')])){_0x8231['firstName']=_0x1c3f7d[_0x2085('0x2b')]&&_0x1c3f7d[_0x2085('0x2b')]!==_0x2085('0x2c')?_0x1c3f7d[_0x2085('0x2b')]:_0x2085('0x2d');}else{_0x8231[_0x2085('0x19')]=_0x1c3f7d[_0x2085('0x2e')]&&_0x1c3f7d[_0x2085('0x2e')]!==_0x2085('0x2c')?_0x1c3f7d[_0x2085('0x2e')]:_0x2085('0x2d');}return BPromise[_0x2085('0x1f')]()[_0x2085('0x21')](cmContactRpc[_0x2085('0x2f')](_0x8231))[_0x2085('0x21')](function(_0x18ff72){_0xdfe40d=_0x18ff72;_0x4dfdd2[_0x2085('0x30')](_0x18ff72);if(_0xdfe40d){logger[_0x2085('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1c3f7d[_0x2085('0x26')],_0x318d27['id'],_0xdfe40d['id']);}return;});}else{logger['info'](_0x2085('0x31'),_0x1c3f7d['uniqueid'],_0x318d27['id']);_0x8231[_0x37f7ac]=_[_0x2085('0x2a')](_0x1c3f7d[_0x2085('0x18')])?_0x1c3f7d[_0x2085('0x17')]:_0x1c3f7d[_0x2085('0x16')];if(_['isNil'](_0x1c3f7d[_0x2085('0x18')])){_0x8231[_0x2085('0x19')]=_0x1c3f7d[_0x2085('0x2b')]&&_0x1c3f7d['calleridname']!==_0x2085('0x2c')?_0x1c3f7d[_0x2085('0x2b')]:'Unknown';}else{_0x8231[_0x2085('0x19')]=_0x1c3f7d[_0x2085('0x2e')]&&_0x1c3f7d[_0x2085('0x2e')]!==_0x2085('0x2c')?_0x1c3f7d[_0x2085('0x2e')]:_0x2085('0x2d');}_0xdfe40d=_0x8231;_0x4dfdd2[_0x2085('0x30')](_0x8231);return;}}})[_0x2085('0x21')](function(){if(_0x16b121){emit(_0x1c3f7d[_0x2085('0x26')],_0x318d27,util[_0x2085('0x32')]('user:%s',_0x16b121[_0x2085('0x33')]),util['format'](_0x2085('0x34'),_0x2abbfc[_0x2085('0x35')][_0x2085('0x36')]()),{'evt':_[_0x2085('0x37')](_0x1c3f7d,{'autoCreate':_0x1908a1}),'contact':_0xdfe40d===undefined?{}:_0xdfe40d,'contacts':_0x4dfdd2[_0x2085('0x23')]===0x0?undefined:_0x4dfdd2});}});}; \ No newline at end of file +var _0xf88f=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','name','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xf88f,0x78));var _0xff88=function(_0x36cc1c,_0x3c6bbe){_0x36cc1c=_0x36cc1c-0x0;var _0xd87f4c=_0xf88f[_0x36cc1c];return _0xd87f4c;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var config=require(_0xff88('0x2'));var logger=require('../../../../config/logger')(_0xff88('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xff88('0x4')]=_[_0xff88('0x5')](config[_0xff88('0x4')],{'host':_0xff88('0x6'),'port':0x18eb});var io=require(_0xff88('0x7'))(new Redis(config[_0xff88('0x4')]));function emit(_0x3c209c,_0x51ff91,_0x21fd0a,_0x583acc,_0x4f9893){logger['info']('[CM][%s][%s]',_0x3c209c,_0x51ff91['id'],_0x21fd0a,_0x583acc,JSON['stringify'](_0x4f9893));io['to'](_0x21fd0a)[_0xff88('0x8')](_0x583acc,_0x4f9893);}exports['exec']=function(_0x1047e3,_0x113c89,_0x10d5cc,_0x20fb45){var _0x5e35c5,_0x13ebd6;var _0x58f3dd={};var _0x5ee5d0;var _0xb3e3e5=Number(_0x10d5cc[_0xff88('0x9')]);var _0x4abdf4=_0x10d5cc[_0xff88('0xa')]?Boolean(Number(_0x10d5cc[_0xff88('0xa')])):![];var _0x566d03;var _0x1e6cd5=![];if(!_[_0xff88('0xb')](_0x10d5cc[_0xff88('0xc')])){if(_0x10d5cc[_0xff88('0xc')]=='1')_0x1e6cd5=!![];}if(!_0x1e6cd5){if(_0x20fb45[_0xff88('0xd')]){_0x58f3dd['id']=_0x20fb45['xmd-contactid'];}}if(!_0x58f3dd['id']){_0x58f3dd[_0xff88('0xe')]=_0xb3e3e5;_0x566d03=_0x10d5cc[_0xff88('0xf')]&&_0x10d5cc[_0xff88('0xf')]!=='0'?_0x10d5cc[_0xff88('0xf')][_0xff88('0x10')](','):[_0xff88('0x11')];_0x58f3dd[_0xff88('0x12')]=_[_0xff88('0x13')](_0x566d03,function(_0x2cf132){var _0x44240f={};_0x44240f[_0x2cf132]=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];return _0x44240f;});_0x5ee5d0=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];}var _0x435d3d=['id',_0xff88('0x17'),_0xff88('0x18'),'phone','mobile',_0xff88('0x19'),'ListId',_0xff88('0x1a'),_0xff88('0x1b'),_0xff88('0x1c')];var _0x374a81=_[_0xff88('0x1d')](_0x435d3d,_0x566d03);BPromise[_0xff88('0x1e')]()['then'](cmContactRpc[_0xff88('0x1f')]({'attributes':_0x374a81,'where':_0x58f3dd,'phone':_0x5ee5d0}))[_0xff88('0x20')](function(_0x56ea4c){_0x13ebd6=_0x56ea4c;if(!_[_0xff88('0x21')](_0x13ebd6)){if(_0x13ebd6[_0xff88('0x22')]===0x1){_0x5e35c5=_0x13ebd6[0x0];logger[_0xff88('0x23')](_0xff88('0x24'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}else{logger[_0xff88('0x23')](_0xff88('0x26'),_0x20fb45['uniqueid'],_0x113c89['id'],_[_0xff88('0x13')](_0x13ebd6,'id')['join'](','));}return;}else{logger[_0xff88('0x23')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x20fb45['uniqueid'],_0x113c89['id']);var _0xbbb0b7={'ListId':_0xb3e3e5};var _0x281a61=_0x10d5cc[_0xff88('0x27')]&&_0x10d5cc[_0xff88('0x27')]!=='0'?_0x10d5cc[_0xff88('0x27')]:_0xff88('0x11');if(_0x4abdf4){logger[_0xff88('0x23')](_0xff88('0x28'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7['firstName']=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==''?_0x20fb45['calleridname']:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==''?_0x20fb45['destcalleridname']:_0xff88('0x2a');}return BPromise[_0xff88('0x1e')]()[_0xff88('0x20')](cmContactRpc[_0xff88('0x2c')](_0xbbb0b7))[_0xff88('0x20')](function(_0x55e375){_0x5e35c5=_0x55e375;_0x13ebd6[_0xff88('0x2d')](_0x55e375);if(_0x5e35c5){logger['info'](_0xff88('0x2e'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}return;});}else{logger[_0xff88('0x23')](_0xff88('0x2f'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x29')]:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x2b')]:_0xff88('0x2a');}_0x5e35c5=_0xbbb0b7;_0x13ebd6['push'](_0xbbb0b7);return;}}})[_0xff88('0x20')](function(){if(_0x1047e3){emit(_0x20fb45[_0xff88('0x25')],_0x113c89,util[_0xff88('0x31')]('user:%s',_0x1047e3[_0xff88('0x32')]),util['format'](_0xff88('0x33'),_0x10d5cc[_0xff88('0x34')][_0xff88('0x35')]()),{'evt':_[_0xff88('0x36')](_0x20fb45,{'autoCreate':_0x4abdf4}),'contact':_0x5e35c5===undefined?{}:_0x5e35c5,'contacts':_0x13ebd6[_0xff88('0x22')]===0x0?undefined:_0x13ebd6});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8dc2d98..e220b97 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 _0xb9f4=['./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','undefined','motionChannel','voice','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','Actions','length','action','toLowerCase','contactmanager','data1','data2','html','template\x20not\x20found','uri','buildUri','data3','isNil','location','data4','windowWidth','data5','800','windowHeight','data6','600','render','winArguments','format','user:%s','interface','merge','trigger:%s','exec','integration','routeId','urlforward','script','parse','query','search','channel','AllConditions','checkConditions','AnyConditions','some','evt','chat','ChatWebsiteId','operator','upperFirst','value','AccountId','queue','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','lodash','mustache'];(function(_0x4e7d39,_0x565142){var _0x286740=function(_0x578c8d){while(--_0x578c8d){_0x4e7d39['push'](_0x4e7d39['shift']());}};_0x286740(++_0x565142);}(_0xb9f4,0xf4));var _0x4b9f=function(_0x1fdcfd,_0x4c7574){_0x1fdcfd=_0x1fdcfd-0x0;var _0x438353=_0xb9f4[_0x1fdcfd];return _0x438353;};'use strict';var util=require('util');var _=require(_0x4b9f('0x0'));var url=require('url');var Mustache=require(_0x4b9f('0x1'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x4b9f('0x2'));var cmContact=require(_0x4b9f('0x3'));var script=require(_0x4b9f('0x4'));var config=require(_0x4b9f('0x5'));var logger=require('../../../config/logger')(_0x4b9f('0x6'));var ami=require(_0x4b9f('0x7'));config[_0x4b9f('0x8')]=_[_0x4b9f('0x9')](config[_0x4b9f('0x8')],{'host':_0x4b9f('0xa'),'port':0x18eb});var io=require(_0x4b9f('0xb'))(new Redis(config[_0x4b9f('0x8')]));var operators={'equals':function(_0x34c8ed,_0x47e1e4){return _0x34c8ed==_0x47e1e4;},'not_equals':function(_0x33b5df,_0x1530e5){return _0x33b5df!=_0x1530e5;}};var barAndWebActions=[_0x4b9f('0xc'),_0x4b9f('0xd'),_0x4b9f('0xe')];function Trigger(_0x1a1856){this['triggers']=_0x1a1856[_0x4b9f('0xf')];this[_0x4b9f('0x10')]=_0x1a1856[_0x4b9f('0x10')];this[_0x4b9f('0x11')]=_0x1a1856[_0x4b9f('0x11')];this[_0x4b9f('0x12')]=_0x1a1856[_0x4b9f('0x12')];this[_0x4b9f('0x13')]=_0x1a1856[_0x4b9f('0x13')];this[_0x4b9f('0x14')]=_0x1a1856[_0x4b9f('0x14')];this[_0x4b9f('0x15')]=_0x1a1856['freshdeskAccounts'];this[_0x4b9f('0x16')]=_0x1a1856['salesforceAccounts'];this[_0x4b9f('0x17')]=_0x1a1856[_0x4b9f('0x17')];this[_0x4b9f('0x18')]=_0x1a1856[_0x4b9f('0x18')];this[_0x4b9f('0x19')]=_0x1a1856[_0x4b9f('0x19')];this['vtigerAccounts']=_0x1a1856['vtigerAccounts'];this[_0x4b9f('0x1a')]=_0x1a1856['servicenowAccounts'];this['dynamics365Accounts']=_0x1a1856[_0x4b9f('0x1b')];this['freshsalesAccounts']=_0x1a1856[_0x4b9f('0x1c')];this[_0x4b9f('0x1d')]={'zendesk':this[_0x4b9f('0x14')],'salesforce':this[_0x4b9f('0x16')],'freshdesk':this[_0x4b9f('0x15')],'sugarcrm':this[_0x4b9f('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0x4b9f('0x19')],'vtiger':this[_0x4b9f('0x1e')],'dynamics365':this[_0x4b9f('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x4b9f('0x1a')]};ami['on'](_0x4b9f('0x1f'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on']('custom:agentconnect',this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x22'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x23'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x24'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x25'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x26'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x27'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x28'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x29'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x2a'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x2b'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x2c'),this[_0x4b9f('0x2d')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x2e'),this[_0x4b9f('0x2d')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x2f'),this[_0x4b9f('0x2d')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x30'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x31'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x32'),this['syncCustomEvent'][_0x4b9f('0x21')](this));ami['on']('custom:incomingmessage',this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x4b9f('0x21')](this));ami['on']('custom:acceptmessage',this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x33'),this['syncCustomEvent'][_0x4b9f('0x21')](this));ami['on'](_0x4b9f('0x34'),this[_0x4b9f('0x20')][_0x4b9f('0x21')](this));}Trigger[_0x4b9f('0x35')][_0x4b9f('0x36')]=function(_0x210e43,_0xee07a2,_0x56ebb9){logger[_0x4b9f('0x37')](_0x210e43,_0xee07a2,JSON['stringify'](_0x56ebb9));io['to'](_0x210e43)[_0x4b9f('0x36')](_0xee07a2,_0x56ebb9);};Trigger[_0x4b9f('0x35')][_0x4b9f('0x20')]=function(_0x2d2bbf){var _0x445906=_[_0x4b9f('0x38')](_0x2d2bbf);if(typeof _0x445906['motionChannel']===_0x4b9f('0x39')){_0x445906[_0x4b9f('0x3a')]=_0x4b9f('0x3b');}logger['debug']('syncCustomEvent',util[_0x4b9f('0x3c')](_0x445906,{'showHidden':!![],'depth':null}));this[_0x4b9f('0x3d')](_0x445906);};Trigger[_0x4b9f('0x35')]['syncAgentDial']=function(_0x5eb388){if(this[_0x4b9f('0x10')][_0x5eb388['interface']]){this[_0x4b9f('0x20')](_0x5eb388);}};Trigger[_0x4b9f('0x35')]['checkTriggers']=function(_0x4b99b4){var _0x3d98e;for(var _0x411916 in this[_0x4b9f('0xf')]){if(this[_0x4b9f('0xf')][_0x4b9f('0x3e')](_0x411916)){if(this['triggers'][_0x411916][_0x4b9f('0x3f')]){_0x3d98e=this[_0x4b9f('0x40')](this[_0x4b9f('0xf')][_0x411916],_0x4b99b4);if(_0x3d98e){_['merge'](_0x4b99b4,_0x4b99b4['variables']);for(var _0x3ff13e=0x0,_0x5cecbd,_0x12fe16,_0x2075e7;_0x3ff13e0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x5a48ac,_0x5caf7a){var _0x130c3a=function(_0xc0cba8){while(--_0xc0cba8){_0x5a48ac['push'](_0x5a48ac['shift']());}};_0x130c3a(++_0x5caf7a);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1d5e1d1..55d5392 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 _0xaee0=['phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','username','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','callDirection','queue'];(function(_0x260bcb,_0x496994){var _0x15d45e=function(_0x1fd2c3){while(--_0x1fd2c3){_0x260bcb['push'](_0x260bcb['shift']());}};_0x15d45e(++_0x496994);}(_0xaee0,0x1ca));var _0x0aee=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xaee0[_0x5756c6];return _0x4b5806;};'use strict';var _=require(_0x0aee('0x0'));var rp=require('request-promise');var util=require(_0x0aee('0x1'));var intUtil=require(_0x0aee('0x2'));var md5=require(_0x0aee('0x3'));var Redis=require(_0x0aee('0x4'));var logger=require(_0x0aee('0x5'))(_0x0aee('0x6'));var config=require(_0x0aee('0x7'));config[_0x0aee('0x8')]=_[_0x0aee('0x9')](config[_0x0aee('0x8')],{'host':_0x0aee('0xa'),'port':0x18eb});var io=require(_0x0aee('0xb'))(new Redis(config[_0x0aee('0x8')]));function getAuthToken(_0x3063e7,_0xbbf615,_0x3b558f){if(_0x3063e7['modernAuthentication']){_0x3063e7[_0x0aee('0xc')]=_0x3063e7[_0x0aee('0xd')][_0x0aee('0xe')];_0x3063e7[_0x0aee('0xf')]=_0x3063e7[_0x0aee('0xd')][_0x0aee('0x10')];return Promise['resolve'](_0x3063e7['CloudProvider'][_0x0aee('0x11')]);}var _0x54c7af={'method':_0x0aee('0x12'),'uri':_0xbbf615,'form':{'client_id':_0x3063e7[_0x0aee('0x13')],'resource':_0x3063e7[_0x0aee('0xc')],'username':_0x3063e7[_0x0aee('0x14')],'password':_0x3063e7['password'],'grant_type':'password','client_secret':_0x3063e7['clientSecret']},'json':!![]};return rp(_0x54c7af)[_0x0aee('0x15')](function(_0x2fe74c){return _0x2fe74c[_0x0aee('0x16')];})[_0x0aee('0x17')](function(_0x26c959){logger[_0x0aee('0x18')]('['+[_0x3b558f[_0x0aee('0x19')]()]+_0x0aee('0x1a'));return _0x26c959[_0x0aee('0x1b')];});}function getUser(_0x2d0946,_0x27457e,_0x16d7dc,_0x52f060,_0x33415f,_0x269016){return new Promise(function(_0x2d6ee1,_0x2b1163){return getAuthToken(_0x27457e,_0x52f060,_0x269016)[_0x0aee('0x15')](function(_0x322523){var _0x32c0d9={'method':_0x0aee('0x1c'),'uri':_0x33415f+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x0aee('0x1d')+_0x322523,'OData-Version':_0x0aee('0x1e')},'json':!![]};return rp(_0x32c0d9);})[_0x0aee('0x15')](function(_0x113c2f){var _0x35fec9=_0x113c2f[_0x0aee('0x1f')];var _0x58db3d=![];var _0x189c33=null;if(!_[_0x0aee('0x20')](_0x16d7dc)){if(intUtil[_0x0aee('0x21')](_0x16d7dc[_0x0aee('0x22')])){_0x2d0946[_0x0aee('0x23')]=_0x16d7dc[_0x0aee('0x22')];for(_0x189c33=0x0;_0x189c33<_0x35fec9[_0x0aee('0x24')];_0x189c33++){if(_0x35fec9[_0x189c33]['internalemailaddress']===_0x16d7dc[_0x0aee('0x22')]&&!_0x35fec9[_0x189c33][_0x0aee('0x25')]){_0x58db3d=!![];logger[_0x0aee('0x26')]('['+[_0x269016['toUpperCase']()]+_0x0aee('0x27')+_0x35fec9[_0x189c33][_0x0aee('0x28')]+'!');_0x2d0946[_0x0aee('0x29')]=_0x35fec9[_0x189c33]['systemuserid'];}}}}if(!_0x58db3d){logger['info']('['+[_0x269016[_0x0aee('0x19')]()]+_0x0aee('0x2a'));_0x2d0946[_0x0aee('0x23')]=_0x27457e[_0x0aee('0x14')];for(_0x189c33=0x0;_0x189c33<_0x35fec9[_0x0aee('0x24')];_0x189c33++){if(_0x35fec9[_0x189c33][_0x0aee('0x2b')]===_0x27457e[_0x0aee('0x14')]){_0x2d0946[_0x0aee('0x29')]=_0x35fec9[_0x189c33][_0x0aee('0x28')];}}}_0x2d6ee1(_0x2d0946);})['catch'](function(_0x48357b){_0x2b1163(_0x48357b[_0x0aee('0x1b')]);});});}function createEndUser(_0x2697cf,_0x50ad7a,_0x2a6716,_0x1017c2,_0x2064ea,_0x48c3c6,_0x29cdcc){return new Promise(function(_0x5bfac5,_0x5cfc68){return getAuthToken(_0x50ad7a,_0x2a6716,_0x48c3c6)['then'](function(_0x7cbdb8){var _0x2dd943=_0x48c3c6[_0x0aee('0x2c')]()===_0x0aee('0x2d')?_0x2064ea[_0x0aee('0x2e')]:_0x2064ea[_0x0aee('0x2f')];var _0x86c243={'method':_0x0aee('0x12'),'uri':_0x1017c2+'contacts','body':{'fullname':_0x2dd943,'firstname':_0x2dd943,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0aee('0x30')+_0x2697cf['userId']+')'},'headers':{'Authorization':_0x0aee('0x1d')+_0x7cbdb8,'OData-Version':_0x0aee('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x86c243[_0x0aee('0x31')][_0x29cdcc]=_0x2dd943;return rp(_0x86c243);})[_0x0aee('0x15')](function(_0xbd3c82){var _0x16c95c=_0xbd3c82[_0x0aee('0x32')][_0x0aee('0x33')];var _0x29f00e=_0x16c95c[_0x0aee('0x34')](_0x16c95c['lastIndexOf']('(')+0x1,_0x16c95c[_0x0aee('0x35')](')'));_0x2697cf[_0x0aee('0x36')]=_0x29f00e;_0x5bfac5(_0x2697cf);})[_0x0aee('0x17')](function(_0x42dceb){_0x5cfc68(_0x42dceb[_0x0aee('0x1b')]);});});}function getEndUser(_0x4b232d,_0x5c19e8,_0x198f04,_0x558940,_0x29f3e3,_0x2d7f93,_0x2fa75c,_0x3f4d6f){var _0x73c610=_0x2d7f93['toLowerCase']()==='outbound'?_0x29f3e3[_0x0aee('0x2e')]:_0x29f3e3[_0x0aee('0x2f')];return getAuthToken(_0x5c19e8,_0x198f04,_0x2d7f93)[_0x0aee('0x15')](function(_0x49b473){_0x3f4d6f=_0x3f4d6f?_0x3f4d6f:_0x0aee('0x37');var _0x4d8f32={'method':_0x0aee('0x1c'),'uri':_0x558940+_0x0aee('0x38')+_0x3f4d6f+'&$filter='+_0x3f4d6f+_0x0aee('0x39')+_0x73c610[_0x0aee('0x3a')]('+',_0x0aee('0x3b'))+'\x27','headers':{'Authorization':_0x0aee('0x1d')+_0x49b473,'If-None-Match':null,'OData-Version':_0x0aee('0x1e')},'json':!![]};return rp(_0x4d8f32);})[_0x0aee('0x15')](function(_0x10e7f7){var _0x25d248=![];if(!_0x10e7f7)return _0x25d248;var _0x2d6763=_0x10e7f7['value'];for(var _0x5c997b=0x0;_0x5c997b<_0x2d6763['length'];_0x5c997b++){if(_0x2d6763[_0x5c997b][_0x3f4d6f]===_0x73c610){_0x25d248=!![];_0x4b232d[_0x0aee('0x36')]=_0x2d6763[_0x5c997b][_0x0aee('0x3c')];}}return _0x25d248;})[_0x0aee('0x15')](function(_0x59c63e){if(_0x59c63e)return _0x4b232d;if(_0x2fa75c==='nothing'){logger[_0x0aee('0x26')]('['+[_0x2d7f93[_0x0aee('0x19')]()]+_0x0aee('0x3d'));return _0x4b232d;}return createEndUser(_0x4b232d,_0x5c19e8,_0x198f04,_0x558940,_0x29f3e3,_0x2d7f93,_0x3f4d6f)[_0x0aee('0x15')](function(_0x390f91){logger['info']('['+[_0x2d7f93[_0x0aee('0x19')]()]+_0x0aee('0x3e'),_0x390f91['enduserId']);return _0x390f91;});});}function getCustomFields(_0x5d61fc,_0x1d2226,_0xee0a78){var _0x2aefc8={};if(_0x5d61fc[_0x0aee('0x24')]>0x0){_[_0x0aee('0x3f')](_0x5d61fc,function(_0xdebdc4){if(_['includes']([_0x0aee('0x40'),'picklist'],_0xdebdc4[_0x0aee('0x41')])&&_0xdebdc4[_0x0aee('0x42')]&&!_0xdebdc4[_0x0aee('0x43')]){var _0x18df09=_0xdebdc4[_0x0aee('0x44')][_0x0aee('0x2c')]();var _0x5eed8f=_0x18df09[_0x0aee('0x34')](0x0,_0x18df09[_0x0aee('0x45')]('_'));var _0x7776b4=_0x18df09[_0x0aee('0x34')](_0x18df09[_0x0aee('0x45')]('_')+0x1);if(_0x5eed8f===_0xee0a78){_0x2aefc8[_0x7776b4]=_0xdebdc4[_0x0aee('0x46')];}}});}return _0x2aefc8;}function getTicket(_0x3a0cd3,_0x2b546f,_0x4e4ee3,_0x5ef4c9,_0x12419c,_0x311c12,_0x48b28d){return new Promise(function(_0x1dd290,_0x8ea64a){var _0x5f50ba;return getAuthToken(_0x2b546f,_0x4e4ee3,_0x48b28d)[_0x0aee('0x15')](function(_0x158997){if(_0x311c12[_0x0aee('0x47')]===_0x0aee('0x48')){_0x5f50ba={'method':'POST','uri':_0x5ef4c9+_0x0aee('0x49'),'body':Object[_0x0aee('0x4a')]({},{'title':intUtil['getString'](_0x311c12[_0x0aee('0x4b')],_0x12419c,'\x20'),'description':intUtil[_0x0aee('0x4c')](_0x311c12[_0x0aee('0x4d')],_0x12419c,'\x0a'),'customerid_contact@odata.bind':_0x3a0cd3['enduserId']?_0x0aee('0x4e')+_0x3a0cd3[_0x0aee('0x36')]+')':undefined,'ownerid@odata.bind':_0x0aee('0x30')+_0x3a0cd3[_0x0aee('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x311c12[_0x0aee('0x4f')],_0x12419c,_0x311c12[_0x0aee('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x158997,'OData-Version':_0x0aee('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x311c12[_0x0aee('0x47')]==='phonecall'){var _0x11b8b0=_0x3a0cd3[_0x0aee('0x36')]?[{'partyid_systemuser@odata.bind':_0x0aee('0x30')+_0x3a0cd3[_0x0aee('0x29')]+')','participationtypemask':_0x3a0cd3[_0x0aee('0x50')]===_0x0aee('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0x0aee('0x4e')+_0x3a0cd3['enduserId']+')','participationtypemask':_0x3a0cd3[_0x0aee('0x50')]===_0x0aee('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0aee('0x30')+_0x3a0cd3['userId']+')','participationtypemask':_0x3a0cd3[_0x0aee('0x50')]===_0x0aee('0x51')?0x2:0x1}];_0x5f50ba={'method':_0x0aee('0x12'),'uri':_0x5ef4c9+_0x0aee('0x52'),'body':Object[_0x0aee('0x4a')]({},{'subject':intUtil[_0x0aee('0x4c')](_0x311c12[_0x0aee('0x4b')],_0x12419c,'\x20'),'phonenumber':String(_0x12419c[_0x0aee('0x2f')]),'description':intUtil[_0x0aee('0x4c')](_0x311c12['Descriptions'],_0x12419c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3a0cd3[_0x0aee('0x36')]?_0x0aee('0x4e')+_0x3a0cd3[_0x0aee('0x36')]+')':undefined,'ownerid@odata.bind':_0x0aee('0x30')+_0x3a0cd3[_0x0aee('0x29')]+')','directioncode':_0x3a0cd3['callDirection']===_0x0aee('0x51')?![]:!![],'phonecall_activity_parties':_0x11b8b0},getCustomFields(_0x311c12['Fields'],_0x12419c,_0x311c12[_0x0aee('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x158997,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5f50ba);})[_0x0aee('0x15')](function(_0x5aed51){var _0x4d0fd1=_0x5aed51[_0x0aee('0x32')][_0x0aee('0x33')];var _0x501d43=_0x4d0fd1[_0x0aee('0x34')](_0x4d0fd1['lastIndexOf']('(')+0x1,_0x4d0fd1[_0x0aee('0x35')](')'));_0x3a0cd3[_0x0aee('0x53')]=_0x501d43;_0x1dd290(_0x3a0cd3);})[_0x0aee('0x17')](function(_0x10352b){_0x8ea64a(_0x10352b[_0x0aee('0x1b')]);});});}function emit(_0x41c251,_0x452574,_0x34c531,_0x3b5981){var _0xc7b58f={'uri':util[_0x0aee('0x54')](_0x0aee('0x55'),_0x41c251,_0x34c531,_0x3b5981)};io['to'](util[_0x0aee('0x54')](_0x0aee('0x56'),_0x452574))['emit'](_0x0aee('0x57'),_0xc7b58f);}exports['cs']=function(_0x249797,_0x4afaf1,_0x3b5d48,_0x5daea6,_0x543c7d,_0x246ffd,_0x680cd7,_0x45514a){var _0x4b49f2={};_0x246ffd['remoteUri']=_0x246ffd[_0x0aee('0x58')]?intUtil['stripTrailingSlash'](_0x246ffd[_0x0aee('0xd')]['data7']):intUtil[_0x0aee('0x59')](_0x246ffd['remoteUri']);_0x246ffd[_0x0aee('0x5a')]=intUtil[_0x0aee('0x59')](_0x246ffd[_0x0aee('0x5a')]);_0x4b49f2[_0x0aee('0x50')]=_0x45514a===_0x0aee('0x51')||_0x45514a===_0x0aee('0x5b')?_0x0aee('0x51'):'outbound';var _0x1d9c7c=_0x246ffd[_0x0aee('0x58')]?util[_0x0aee('0x54')](_0x0aee('0x5c'),_0x246ffd[_0x0aee('0xd')][_0x0aee('0xe')]):util[_0x0aee('0x54')](_0x0aee('0x5c'),_0x246ffd['remoteUri']);var _0x46dcfb=util[_0x0aee('0x54')](_0x0aee('0x5d'),_0x246ffd[_0x0aee('0xf')]);var _0x48fbde=util[_0x0aee('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x246ffd[_0x0aee('0x5a')],_0x4afaf1[_0x0aee('0x5e')],md5(_0x4afaf1[_0x0aee('0x5e')]));if(_0x543c7d&&_0x543c7d[_0x0aee('0x5f')]){logger[_0x0aee('0x26')](_0x0aee('0x60'),_0x0aee('0x61'));_0x4afaf1[_0x0aee('0x62')]=_0x48fbde;}else if(_0x680cd7&&_0x680cd7[_0x0aee('0x63')]&&_0x680cd7[_0x0aee('0x63')]!=='none'){logger['info'](_0x0aee('0x64'),_0x0aee('0x61'));_0x4afaf1[_0x0aee('0x62')]=_0x48fbde;}else{_0x4afaf1[_0x0aee('0x62')]='';}return getUser(_0x4b49f2,_0x246ffd,_0x5daea6,_0x46dcfb,_0x1d9c7c,_0x45514a)[_0x0aee('0x15')](function(_0xe7d6c7){logger[_0x0aee('0x26')]('['+_0x45514a['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0xe7d6c7[_0x0aee('0x29')]);logger[_0x0aee('0x26')]('['+_0x45514a[_0x0aee('0x19')]()+_0x0aee('0x65'),_0xe7d6c7[_0x0aee('0x23')]);return getEndUser(_0xe7d6c7,_0x246ffd,_0x46dcfb,_0x1d9c7c,_0x4afaf1,_0x45514a,_0x3b5d48['moduleCreate'],_0x3b5d48['additionalSearchContact']);})[_0x0aee('0x15')](function(_0x1edb71){logger[_0x0aee('0x26')]('['+_0x45514a['toUpperCase']()+_0x0aee('0x66'),_0x1edb71[_0x0aee('0x36')]);logger[_0x0aee('0x26')]('['+_0x45514a[_0x0aee('0x19')]()+_0x0aee('0x67'),_0x4afaf1[_0x0aee('0x2f')]);return getTicket(_0x1edb71,_0x246ffd,_0x46dcfb,_0x1d9c7c,_0x4afaf1,_0x3b5d48,_0x45514a);})[_0x0aee('0x15')](function(_0x3d1326){logger[_0x0aee('0x26')](util[_0x0aee('0x54')]('['+_0x45514a['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3b5d48[_0x0aee('0x47')],_0x3d1326['ticketId']));logger[_0x0aee('0x26')](util['format']('['+_0x45514a['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x45514a));if(_0x45514a!==_0x0aee('0x5b')&&_0x3b5d48[_0x0aee('0x68')]){logger[_0x0aee('0x26')]('['+_0x45514a[_0x0aee('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x246ffd['remoteUri'],_0x5daea6[_0x0aee('0x69')],_0x3b5d48[_0x0aee('0x47')],_0x3d1326['ticketId']);}})['catch'](function(_0x3dcc2f){logger[_0x0aee('0x18')]('['+_0x45514a[_0x0aee('0x19')]()+_0x0aee('0x6a'),_0x3dcc2f[_0x0aee('0x1b')]);console[_0x0aee('0x18')](_0x0aee('0x6b'),_0x3dcc2f);});}; \ No newline at end of file +var _0x5feb=['%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri','tenantId','CloudProvider','resolve','data5','POST','clientId','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','catch','outbound','calleridnum','contacts','/systemusers(','4.0','body','headers','substring','lastIndexOf','toLowerCase','telephone1','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','nameField','customField','indexOf','getString','Subjects','ticketType','phonecall','queue','callDirection','Descriptions','odata-entityid','ticketId','format'];(function(_0x417100,_0xbb639){var _0x471378=function(_0x502c08){while(--_0x502c08){_0x417100['push'](_0x417100['shift']());}};_0x471378(++_0xbb639);}(_0x5feb,0x19e));var _0xb5fe=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x5feb[_0x529abc];return _0x453afa;};'use strict';var _=require(_0xb5fe('0x0'));var rp=require(_0xb5fe('0x1'));var util=require(_0xb5fe('0x2'));var intUtil=require(_0xb5fe('0x3'));var md5=require(_0xb5fe('0x4'));var Redis=require(_0xb5fe('0x5'));var logger=require('../../../../config/logger')(_0xb5fe('0x6'));var config=require(_0xb5fe('0x7'));config['redis']=_[_0xb5fe('0x8')](config['redis'],{'host':_0xb5fe('0x9'),'port':0x18eb});var io=require(_0xb5fe('0xa'))(new Redis(config[_0xb5fe('0xb')]));function getAuthToken(_0x258696,_0x419d18,_0x5e6b16){if(_0x258696[_0xb5fe('0xc')]){_0x258696[_0xb5fe('0xd')]=_0x258696['CloudProvider']['data7'];_0x258696[_0xb5fe('0xe')]=_0x258696[_0xb5fe('0xf')]['data2'];return Promise[_0xb5fe('0x10')](_0x258696['CloudProvider'][_0xb5fe('0x11')]);}var _0x3c325={'method':_0xb5fe('0x12'),'uri':_0x419d18,'form':{'client_id':_0x258696[_0xb5fe('0x13')],'resource':_0x258696[_0xb5fe('0xd')],'username':_0x258696['username'],'password':_0x258696[_0xb5fe('0x14')],'grant_type':'password','client_secret':_0x258696[_0xb5fe('0x15')]},'json':!![]};return rp(_0x3c325)[_0xb5fe('0x16')](function(_0x4b377d){return _0x4b377d[_0xb5fe('0x17')];})['catch'](function(_0x4c6fb5){logger[_0xb5fe('0x18')]('['+[_0x5e6b16[_0xb5fe('0x19')]()]+']\x20Wrong\x20credentials!');return _0x4c6fb5[_0xb5fe('0x1a')];});}function getUser(_0x1689bd,_0x212250,_0x1f39ad,_0x59c51d,_0x47d1cf,_0x41752c){return new Promise(function(_0x468d03,_0x4bef47){return getAuthToken(_0x212250,_0x59c51d,_0x41752c)[_0xb5fe('0x16')](function(_0x13a6af){var _0x4b496d={'method':_0xb5fe('0x1b'),'uri':_0x47d1cf+_0xb5fe('0x1c'),'headers':{'Authorization':_0xb5fe('0x1d')+_0x13a6af,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b496d);})[_0xb5fe('0x16')](function(_0x242a7b){var _0x5a2f3e=_0x242a7b[_0xb5fe('0x1e')];var _0x532daa=![];var _0xe8bcc8=null;if(!_[_0xb5fe('0x1f')](_0x1f39ad)){if(intUtil['validateEmail'](_0x1f39ad[_0xb5fe('0x20')])){_0x1689bd['userEmail']=_0x1f39ad[_0xb5fe('0x20')];for(_0xe8bcc8=0x0;_0xe8bcc8<_0x5a2f3e[_0xb5fe('0x21')];_0xe8bcc8++){if(_0x5a2f3e[_0xe8bcc8][_0xb5fe('0x22')]===_0x1f39ad[_0xb5fe('0x20')]&&!_0x5a2f3e[_0xe8bcc8]['isdisabled']){_0x532daa=!![];logger[_0xb5fe('0x23')]('['+[_0x41752c['toUpperCase']()]+_0xb5fe('0x24')+_0x5a2f3e[_0xe8bcc8][_0xb5fe('0x25')]+'!');_0x1689bd['userId']=_0x5a2f3e[_0xe8bcc8]['systemuserid'];}}}}if(!_0x532daa){logger[_0xb5fe('0x23')]('['+[_0x41752c[_0xb5fe('0x19')]()]+_0xb5fe('0x26'));_0x1689bd[_0xb5fe('0x27')]=_0x212250[_0xb5fe('0x28')];for(_0xe8bcc8=0x0;_0xe8bcc8<_0x5a2f3e[_0xb5fe('0x21')];_0xe8bcc8++){if(_0x5a2f3e[_0xe8bcc8]['internalemailaddress']===_0x212250['username']){_0x1689bd[_0xb5fe('0x29')]=_0x5a2f3e[_0xe8bcc8]['systemuserid'];}}}_0x468d03(_0x1689bd);})[_0xb5fe('0x2a')](function(_0x891d72){_0x4bef47(_0x891d72[_0xb5fe('0x1a')]);});});}function createEndUser(_0x40ad88,_0x16d353,_0x496a45,_0x5e2815,_0x1d2dfa,_0x1161a7,_0xe8b19a){return new Promise(function(_0x4f6e1a,_0x575ceb){return getAuthToken(_0x16d353,_0x496a45,_0x1161a7)[_0xb5fe('0x16')](function(_0x4e9256){var _0x3c9c63=_0x1161a7['toLowerCase']()===_0xb5fe('0x2b')?_0x1d2dfa['destcalleridnum']:_0x1d2dfa[_0xb5fe('0x2c')];var _0x207a11={'method':_0xb5fe('0x12'),'uri':_0x5e2815+_0xb5fe('0x2d'),'body':{'fullname':_0x3c9c63,'firstname':_0x3c9c63,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb5fe('0x2e')+_0x40ad88[_0xb5fe('0x29')]+')'},'headers':{'Authorization':_0xb5fe('0x1d')+_0x4e9256,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};_0x207a11[_0xb5fe('0x30')][_0xe8b19a]=_0x3c9c63;return rp(_0x207a11);})['then'](function(_0x3ef3f6){var _0x1c7173=_0x3ef3f6[_0xb5fe('0x31')]['odata-entityid'];var _0x2b1566=_0x1c7173[_0xb5fe('0x32')](_0x1c7173[_0xb5fe('0x33')]('(')+0x1,_0x1c7173[_0xb5fe('0x33')](')'));_0x40ad88['enduserId']=_0x2b1566;_0x4f6e1a(_0x40ad88);})[_0xb5fe('0x2a')](function(_0x14ddab){_0x575ceb(_0x14ddab[_0xb5fe('0x1a')]);});});}function getEndUser(_0x1995f8,_0x46e4b0,_0x396664,_0x23cb25,_0x8a8a8b,_0xa2d9ac,_0x96054f,_0x4060bf){var _0xa7556d=_0xa2d9ac[_0xb5fe('0x34')]()==='outbound'?_0x8a8a8b['destcalleridnum']:_0x8a8a8b[_0xb5fe('0x2c')];return getAuthToken(_0x46e4b0,_0x396664,_0xa2d9ac)[_0xb5fe('0x16')](function(_0x4eda7a){_0x4060bf=_0x4060bf?_0x4060bf:_0xb5fe('0x35');var _0x5137db={'method':_0xb5fe('0x1b'),'uri':_0x23cb25+'contacts?$select='+_0x4060bf+'&$filter='+_0x4060bf+_0xb5fe('0x36')+_0xa7556d[_0xb5fe('0x37')]('+',_0xb5fe('0x38'))+'\x27','headers':{'Authorization':_0xb5fe('0x1d')+_0x4eda7a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5137db);})[_0xb5fe('0x16')](function(_0x11b3ab){var _0x2a82b1=![];if(!_0x11b3ab)return _0x2a82b1;var _0x3a7875=_0x11b3ab[_0xb5fe('0x1e')];for(var _0x555097=0x0;_0x555097<_0x3a7875[_0xb5fe('0x21')];_0x555097++){if(_0x3a7875[_0x555097][_0x4060bf]===_0xa7556d){_0x2a82b1=!![];_0x1995f8[_0xb5fe('0x39')]=_0x3a7875[_0x555097][_0xb5fe('0x3a')];}}return _0x2a82b1;})['then'](function(_0x158e3b){if(_0x158e3b)return _0x1995f8;if(_0x96054f===_0xb5fe('0x3b')){logger[_0xb5fe('0x23')]('['+[_0xa2d9ac[_0xb5fe('0x19')]()]+_0xb5fe('0x3c'));return _0x1995f8;}return createEndUser(_0x1995f8,_0x46e4b0,_0x396664,_0x23cb25,_0x8a8a8b,_0xa2d9ac,_0x4060bf)[_0xb5fe('0x16')](function(_0x2a0390){logger[_0xb5fe('0x23')]('['+[_0xa2d9ac[_0xb5fe('0x19')]()]+']\x20Enduser\x20created!',_0x2a0390[_0xb5fe('0x39')]);return _0x2a0390;});});}function getCustomFields(_0x187940,_0x3201e7,_0x3c7b7d){var _0x24c864={};if(_0x187940[_0xb5fe('0x21')]>0x0){_[_0xb5fe('0x3d')](_0x187940,function(_0x285340){if(_['includes']([_0xb5fe('0x3e'),'picklist'],_0x285340['type'])&&_0x285340[_0xb5fe('0x3f')]&&!_0x285340[_0xb5fe('0x40')]){var _0x54b9b5=_0x285340['idField'][_0xb5fe('0x34')]();var _0x39bc3a=_0x54b9b5[_0xb5fe('0x32')](0x0,_0x54b9b5[_0xb5fe('0x41')]('_'));var _0x24bc4b=_0x54b9b5['substring'](_0x54b9b5[_0xb5fe('0x41')]('_')+0x1);if(_0x39bc3a===_0x3c7b7d){_0x24c864[_0x24bc4b]=_0x285340['content'];}}});}return _0x24c864;}function getTicket(_0xf69571,_0x412bfe,_0x477f4e,_0x3d67d3,_0x1210b1,_0x5f4ea8,_0x397384){return new Promise(function(_0x2a417d,_0x36dc2f){var _0x209544;return getAuthToken(_0x412bfe,_0x477f4e,_0x397384)[_0xb5fe('0x16')](function(_0x3216f6){if(_0x5f4ea8['ticketType']==='incident'){_0x209544={'method':_0xb5fe('0x12'),'uri':_0x3d67d3+'incidents','body':Object['assign']({},{'title':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x43')],_0x1210b1,'\x20'),'description':intUtil[_0xb5fe('0x42')](_0x5f4ea8['Descriptions'],_0x1210b1,'\x0a'),'customerid_contact@odata.bind':_0xf69571[_0xb5fe('0x39')]?'/contacts('+_0xf69571[_0xb5fe('0x39')]+')':undefined,'ownerid@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x5f4ea8['Fields'],_0x1210b1,_0x5f4ea8[_0xb5fe('0x44')])),'headers':{'Authorization':_0xb5fe('0x1d')+_0x3216f6,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5f4ea8[_0xb5fe('0x44')]===_0xb5fe('0x45')){var _0x3a725f=_0xf69571[_0xb5fe('0x39')]?[{'partyid_systemuser@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','participationtypemask':_0xf69571['callDirection']===_0xb5fe('0x46')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xf69571[_0xb5fe('0x39')]+')','participationtypemask':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xf69571['userId']+')','participationtypemask':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?0x2:0x1}];_0x209544={'method':'POST','uri':_0x3d67d3+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x43')],_0x1210b1,'\x20'),'phonenumber':String(_0x1210b1['calleridnum']),'description':intUtil[_0xb5fe('0x42')](_0x5f4ea8[_0xb5fe('0x48')],_0x1210b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf69571['enduserId']?'/contacts('+_0xf69571[_0xb5fe('0x39')]+')':undefined,'ownerid@odata.bind':_0xb5fe('0x2e')+_0xf69571[_0xb5fe('0x29')]+')','directioncode':_0xf69571[_0xb5fe('0x47')]===_0xb5fe('0x46')?![]:!![],'phonecall_activity_parties':_0x3a725f},getCustomFields(_0x5f4ea8['Fields'],_0x1210b1,_0x5f4ea8[_0xb5fe('0x44')])),'headers':{'Authorization':_0xb5fe('0x1d')+_0x3216f6,'OData-Version':_0xb5fe('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x209544);})[_0xb5fe('0x16')](function(_0x580d96){var _0x11026a=_0x580d96['headers'][_0xb5fe('0x49')];var _0x5f569f=_0x11026a[_0xb5fe('0x32')](_0x11026a['lastIndexOf']('(')+0x1,_0x11026a[_0xb5fe('0x33')](')'));_0xf69571[_0xb5fe('0x4a')]=_0x5f569f;_0x2a417d(_0xf69571);})[_0xb5fe('0x2a')](function(_0x3ec38b){_0x36dc2f(_0x3ec38b['message']);});});}function emit(_0xfa4044,_0x3158fb,_0x41707d,_0x5e155c){var _0x2913ce={'uri':util[_0xb5fe('0x4b')](_0xb5fe('0x4c'),_0xfa4044,_0x41707d,_0x5e155c)};io['to'](util[_0xb5fe('0x4b')](_0xb5fe('0x4d'),_0x3158fb))[_0xb5fe('0x4e')](_0xb5fe('0x4f'),_0x2913ce);}exports['cs']=function(_0x1e6f57,_0x4b69ed,_0x73a87d,_0x29b282,_0x240eac,_0x5222eb,_0x16957d,_0x2e5071){var _0x1b8627={};_0x5222eb[_0xb5fe('0xd')]=_0x5222eb[_0xb5fe('0xc')]?intUtil[_0xb5fe('0x50')](_0x5222eb[_0xb5fe('0xf')][_0xb5fe('0x51')]):intUtil[_0xb5fe('0x50')](_0x5222eb['remoteUri']);_0x5222eb[_0xb5fe('0x52')]=intUtil[_0xb5fe('0x50')](_0x5222eb['serverUrl']);_0x1b8627['callDirection']=_0x2e5071===_0xb5fe('0x46')||_0x2e5071===_0xb5fe('0x53')?_0xb5fe('0x46'):_0xb5fe('0x2b');var _0x29bbee=_0x5222eb[_0xb5fe('0xc')]?util[_0xb5fe('0x4b')](_0xb5fe('0x54'),_0x5222eb[_0xb5fe('0xf')][_0xb5fe('0x51')]):util[_0xb5fe('0x4b')](_0xb5fe('0x54'),_0x5222eb[_0xb5fe('0xd')]);var _0x533d81=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x5222eb[_0xb5fe('0xe')]);var _0x2c91e3=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5222eb[_0xb5fe('0x52')],_0x4b69ed['uniqueid'],md5(_0x4b69ed[_0xb5fe('0x55')]));if(_0x240eac&&_0x240eac['monitor_format']){logger[_0xb5fe('0x23')](_0xb5fe('0x56'),_0xb5fe('0x57'));_0x4b69ed['recordingURL']=_0x2c91e3;}else if(_0x16957d&&_0x16957d[_0xb5fe('0x58')]&&_0x16957d[_0xb5fe('0x58')]!==_0xb5fe('0x59')){logger[_0xb5fe('0x23')](_0xb5fe('0x5a'),_0xb5fe('0x57'));_0x4b69ed[_0xb5fe('0x5b')]=_0x2c91e3;}else{_0x4b69ed[_0xb5fe('0x5b')]='';}return getUser(_0x1b8627,_0x5222eb,_0x29b282,_0x533d81,_0x29bbee,_0x2e5071)['then'](function(_0x23e09c){logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+_0xb5fe('0x5c'),_0x23e09c[_0xb5fe('0x29')]);logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x23e09c[_0xb5fe('0x27')]);return getEndUser(_0x23e09c,_0x5222eb,_0x533d81,_0x29bbee,_0x4b69ed,_0x2e5071,_0x73a87d['moduleCreate'],_0x73a87d['additionalSearchContact']);})[_0xb5fe('0x16')](function(_0x39bb4c){logger[_0xb5fe('0x23')]('['+_0x2e5071['toUpperCase']()+_0xb5fe('0x5d'),_0x39bb4c[_0xb5fe('0x39')]);logger['info']('['+_0x2e5071[_0xb5fe('0x19')]()+_0xb5fe('0x5e'),_0x4b69ed[_0xb5fe('0x2c')]);return getTicket(_0x39bb4c,_0x5222eb,_0x533d81,_0x29bbee,_0x4b69ed,_0x73a87d,_0x2e5071);})[_0xb5fe('0x16')](function(_0x33c96c){logger['info'](util[_0xb5fe('0x4b')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x73a87d[_0xb5fe('0x44')],_0x33c96c[_0xb5fe('0x4a')]));logger[_0xb5fe('0x23')](util[_0xb5fe('0x4b')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20Call\x20direction:\x20%s',_0x2e5071));if(_0x2e5071!=='unmanaged'&&_0x73a87d[_0xb5fe('0x5f')]){logger[_0xb5fe('0x23')]('['+_0x2e5071[_0xb5fe('0x19')]()+']',_0xb5fe('0x60'));emit(_0x5222eb['remoteUri'],_0x29b282['name'],_0x73a87d['ticketType'],_0x33c96c[_0xb5fe('0x4a')]);}})['catch'](function(_0x394c24){logger[_0xb5fe('0x18')]('['+_0x2e5071[_0xb5fe('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x394c24[_0xb5fe('0x1a')]);console[_0xb5fe('0x18')](_0xb5fe('0x61'),_0x394c24);});}; \ 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 1ab13f9..b70f7e0 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 _0x5651=['stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','lastevent','lodash','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','picklist','type','nameField','customField','toLowerCase','string','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]'];(function(_0x1a86c9,_0x51cc3b){var _0xdf85e9=function(_0x5b2811){while(--_0x5b2811){_0x1a86c9['push'](_0x1a86c9['shift']());}};_0xdf85e9(++_0x51cc3b);}(_0x5651,0x69));var _0x1565=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5651[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1565('0x0'));var rp=require('request-promise');var md5=require(_0x1565('0x1'));var util=require(_0x1565('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1565('0x3'));var config=require('../../../../config/environment');var logger=require(_0x1565('0x4'))(_0x1565('0x5'));config[_0x1565('0x6')]=_[_0x1565('0x7')](config['redis'],{'host':_0x1565('0x8'),'port':0x18eb});var io=require(_0x1565('0x9'))(new Redis(config[_0x1565('0x6')]));var headers={'Content-Type':_0x1565('0xa'),'Accept':'application/json'};function emit(_0x1e7345,_0x53021f,_0x25f368){io['to'](_0x1e7345)[_0x1565('0xb')](_0x53021f,_0x25f368);}function getTicket(_0x30a63f,_0x180340,_0x576b9d,_0x52538e,_0x39fa70){logger[_0x1565('0xc')](_0x1565('0xd'));var _0x7634b5=_[_0x1565('0xe')]({'responder_id':_0x180340['id'],'requester_id':_0x576b9d['id'],'name':util[_0x1565('0xf')]('Caller\x20-\x20%s',_0x39fa70[_0x1565('0x10')]),'phone':_0x39fa70['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1565('0x11')](_0x52538e['Subjects'],_0x39fa70,'\x20'),'description':intUtil[_0x1565('0x11')](_0x52538e[_0x1565('0x12')],_0x39fa70,_0x1565('0x13')),'tags':getTags(_0x52538e[_0x1565('0x14')],_0x1565('0x15'))},getCustomFields(_0x52538e['Fields'],_0x39fa70));_0x7634b5[_0x1565('0x16')]=_[_0x1565('0x17')](_[_0x1565('0x18')](_0x7634b5['custom_fields'],'id'),_0x1565('0x19'));return request({'uri':util[_0x1565('0xf')](_0x1565('0x1a'),_0x30a63f[_0x1565('0x1b')]),'method':_0x1565('0x1c'),'body':_0x7634b5})[_0x1565('0x1d')](function(_0x152bd3){logger[_0x1565('0xc')](_0x1565('0x1e'));return _0x152bd3;});}function getUser(_0x4570b4,_0xa8263a){if(intUtil['validateEmail'](_0xa8263a)){return request({'uri':util[_0x1565('0xf')](_0x1565('0x1f'),_0x4570b4[_0x1565('0x1b')]),'qs':{'email':_0xa8263a}})[_0x1565('0x1d')](function(_0x4c8d8c){if(_0x4c8d8c[_0x1565('0x20')]){logger['info'](_0x1565('0x21'));return _[_0x1565('0x22')](_0x4c8d8c,function(_0x83638a){return _0x83638a[_0x1565('0x23')]['email']===_0xa8263a;});}else{logger[_0x1565('0xc')](_0x1565('0x24'));return request({'uri':util['format'](_0x1565('0x25'),_0x4570b4[_0x1565('0x1b')])})[_0x1565('0x1d')](function(_0x1520be){logger[_0x1565('0xc')]('Admin\x20account\x20selected.');return _0x1520be;});}});}else{logger['info'](_0x1565('0x26'));return request({'uri':util[_0x1565('0xf')](_0x1565('0x25'),_0x4570b4[_0x1565('0x1b')])})[_0x1565('0x1d')](function(_0x39e54c){logger[_0x1565('0xc')]('Admin\x20account\x20selected.');return _0x39e54c;});}}function getEndUser(_0x5a91d3,_0x554c32,_0x3650b9){logger[_0x1565('0xc')](_0x1565('0x27'),_0x3650b9);return request({'uri':util[_0x1565('0xf')](_0x1565('0x28'),_0x5a91d3[_0x1565('0x1b')]),'qs':{'phone':_0x3650b9}})['then'](function(_0x29de0c){if(_0x29de0c['length']){logger[_0x1565('0xc')]('Enduser\x20found!');return _[_0x1565('0x22')](_0x29de0c,{'phone':_0x3650b9});}else{logger['info'](_0x1565('0x29'));return request({'uri':util[_0x1565('0xf')](_0x1565('0x28'),_0x5a91d3[_0x1565('0x1b')]),'method':'POST','body':{'name':_0x554c32,'phone':_0x3650b9}})['then'](function(_0x1a0434){logger['info'](_0x1565('0x2a'));return _0x1a0434;});}});}function getAuth(_0x49d1b1){return util[_0x1565('0xf')](_0x1565('0x2b'),new Buffer(_0x49d1b1['apiKey']+':X')[_0x1565('0x2c')](_0x1565('0x2d')));}function request(_0x3d43d7){logger[_0x1565('0x2e')](_0x1565('0x2f'),JSON['stringify'](_0x3d43d7));return rp(_[_0x1565('0x7')](_0x3d43d7,{'method':_0x1565('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2ca99e,_0x42ff9f){var _0x3e938c=[];if(_0x2ca99e&&_0x2ca99e['length']>0x0){_0x3e938c=_[_0x1565('0x31')](_0x2ca99e,_0x42ff9f);}return _0x3e938c;}function getCustomFields(_0x2bcaa1,_0x4e042b){var _0x5a74e2=[];var _0x593de2={'custom_fields':[]};if(_0x2bcaa1[_0x1565('0x20')]>0x0){_['forEach'](_0x2bcaa1,function(_0x119c60){if(_[_0x1565('0x32')](['string',_0x1565('0x33')],_0x119c60[_0x1565('0x34')])&&_0x119c60[_0x1565('0x35')]&&!_0x119c60[_0x1565('0x36')]){_0x593de2[_0x119c60[_0x1565('0x35')][_0x1565('0x37')]()]=_0x119c60['content'][_0x1565('0x2c')]();}else if(_['includes']([_0x1565('0x38'),_0x1565('0x33')],_0x119c60['type'])&&_0x119c60[_0x1565('0x39')]&&_0x119c60[_0x1565('0x36')]){_0x593de2[_0x1565('0x16')][_0x1565('0x3a')]({'id':_0x119c60[_0x1565('0x39')],'value':_0x119c60[_0x1565('0x3b')][_0x1565('0x2c')]()});}else if(_0x119c60[_0x1565('0x34')]===_0x1565('0x3c')&&_0x119c60[_0x1565('0x3d')]&&_0x119c60[_0x1565('0x39')]&&_0x119c60[_0x1565('0x36')]){_0x4e042b[_0x119c60[_0x1565('0x3d')]]&&_0x593de2[_0x1565('0x16')]['push']({'id':_0x119c60[_0x1565('0x39')],'value':_0x4e042b[_0x119c60[_0x1565('0x3d')]]['toString']()});}else if(_0x119c60[_0x1565('0x34')]===_0x1565('0x3e')&&_0x119c60[_0x1565('0x3f')]&&_0x119c60[_0x1565('0x3f')][_0x1565('0x15')]&&_0x119c60[_0x1565('0x39')]&&_0x119c60[_0x1565('0x36')]){_0x4e042b[_0x119c60[_0x1565('0x3f')][_0x1565('0x15')]['toLowerCase']()]&&_0x593de2[_0x1565('0x16')]['push']({'id':_0x119c60['idField'],'value':_0x4e042b[_0x119c60['Variable'][_0x1565('0x15')][_0x1565('0x37')]()]['toString']()});}});}return _0x593de2;}exports[_0x1565('0x40')]=function(_0x34e909,_0x83834a,_0xbc3668,_0x1074a3,_0x1e09af,_0x17dded){var _0x51aa0a,_0x4e69f5;_0x17dded['remoteUri']=intUtil[_0x1565('0x41')](_0x17dded[_0x1565('0x1b')]);_0x17dded['serverUrl']=intUtil[_0x1565('0x41')](_0x17dded[_0x1565('0x42')]);if(_0x1e09af&&_0x1e09af['monitor_format']){logger[_0x1565('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x83834a[_0x1565('0x43')]=util[_0x1565('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17dded[_0x1565('0x42')],_0x83834a['uniqueid'],md5(_0x83834a[_0x1565('0x44')]));}else{_0x83834a[_0x1565('0x43')]='';}headers[_0x1565('0x45')]=getAuth(_0x17dded);return getUser(_0x17dded,_0x1074a3[_0x1565('0x46')])[_0x1565('0x1d')](function(_0x51a269){_0x51aa0a=_0x51a269;logger['info'](_0x1565('0x47'),_0x51aa0a['id']);return getEndUser(_0x17dded,_0x83834a[_0x1565('0x10')],_0x83834a['calleridnum']);})[_0x1565('0x1d')](function(_0x53d56f){_0x4e69f5=_0x53d56f;logger[_0x1565('0xc')](_0x1565('0x48'),_0x4e69f5['id']);return getTicket(_0x17dded,_0x51aa0a,_0x4e69f5,_0xbc3668,_0x83834a);})['then'](function(_0x12865b){if(_0x12865b&&_0x12865b['id']){logger['info']('Ticket\x20created!');logger[_0x1565('0xc')]('The\x20Ticket\x20ID\x20is:',_0x12865b['id']);logger['info']('[QUEUE]',_0x1565('0x49'));emit(util[_0x1565('0xf')](_0x1565('0x4a'),_0x1074a3[_0x1565('0x15')]),_0x1565('0x4b'),{'uri':util[_0x1565('0xf')]('%s/helpdesk/tickets/%d',_0x17dded[_0x1565('0x1b')],_0x12865b['id'])});}})[_0x1565('0x4c')](function(_0x1663fd){logger[_0x1565('0x4d')](_0x1565('0x4e'),JSON[_0x1565('0x4f')](_0x1663fd));});};exports[_0x1565('0x50')]=function(_0x22047b,_0x511331,_0x5b9403,_0x4be230,_0x2fbc31,_0x411e6b,_0x6f05ba){var _0x178588,_0x1ea53b;_0x411e6b[_0x1565('0x1b')]=intUtil[_0x1565('0x41')](_0x411e6b['remoteUri']);_0x411e6b[_0x1565('0x42')]=intUtil[_0x1565('0x41')](_0x411e6b[_0x1565('0x42')]);if(_0x6f05ba&&_0x6f05ba[_0x1565('0x51')]&&_0x6f05ba[_0x1565('0x51')]!==_0x1565('0x52')){logger[_0x1565('0xc')](_0x1565('0x53'),_0x1565('0x54'));_0x511331['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x411e6b[_0x1565('0x42')],_0x511331['uniqueid'],md5(_0x511331[_0x1565('0x44')]));}headers[_0x1565('0x45')]=getAuth(_0x411e6b);return getUser(_0x411e6b,_0x4be230[_0x1565('0x46')])['then'](function(_0x5d0bed){_0x178588=_0x5d0bed;logger[_0x1565('0xc')](_0x1565('0x47'),_0x178588['id']);return getEndUser(_0x411e6b,_0x511331['destcalleridname'],_0x511331[_0x1565('0x55')]);})[_0x1565('0x1d')](function(_0x23a33b){_0x1ea53b=_0x23a33b;logger[_0x1565('0xc')](_0x1565('0x48'),_0x1ea53b['id']);return getTicket(_0x411e6b,_0x178588,_0x1ea53b,_0x5b9403,_0x511331);})[_0x1565('0x1d')](function(_0x3ac52d){if(_0x3ac52d&&_0x3ac52d['id']){logger['info'](_0x1565('0x1e'));logger[_0x1565('0xc')](_0x1565('0x56'),_0x3ac52d['id']);logger[_0x1565('0xc')](_0x1565('0x53'),_0x1565('0x49'));emit(util[_0x1565('0xf')]('user:%s',_0x4be230['name']),_0x1565('0x4b'),{'uri':util[_0x1565('0xf')](_0x1565('0x57'),_0x411e6b[_0x1565('0x1b')],_0x3ac52d['id'])});}})[_0x1565('0x4c')](function(_0xef2e53){logger[_0x1565('0x4d')](_0x1565('0x53'),JSON[_0x1565('0x4f')](_0xef2e53));});};exports['unmanaged']=function(_0x59e992,_0x4e3e92,_0x41960b,_0x2d62b3,_0x2b8d97,_0xb60391){var _0x3feb9d,_0x26d5d0;_0xb60391[_0x1565('0x1b')]=intUtil[_0x1565('0x41')](_0xb60391['remoteUri']);_0xb60391[_0x1565('0x42')]=intUtil[_0x1565('0x41')](_0xb60391['serverUrl']);if(_0x2b8d97&&_0x2b8d97[_0x1565('0x58')]){logger[_0x1565('0xc')]('['+_0x4e3e92['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4e3e92['recordingURL']=util[_0x1565('0xf')](_0x1565('0x59'),_0xb60391[_0x1565('0x42')],_0x4e3e92[_0x1565('0x44')],md5(_0x4e3e92[_0x1565('0x44')]));}else{_0x4e3e92[_0x1565('0x43')]='';}headers[_0x1565('0x45')]=getAuth(_0xb60391);return getUser(_0xb60391,'')[_0x1565('0x1d')](function(_0x2673c2){_0x3feb9d=_0x2673c2;logger[_0x1565('0xc')]('The\x20User\x20ID\x20is:',_0x3feb9d['id']);return getEndUser(_0xb60391,_0x4e3e92[_0x1565('0x10')],_0x4e3e92[_0x1565('0x5a')]);})[_0x1565('0x1d')](function(_0x4cd187){_0x26d5d0=_0x4cd187;logger[_0x1565('0xc')](_0x1565('0x48'),_0x26d5d0['id']);return getTicket(_0xb60391,_0x3feb9d,_0x26d5d0,_0x41960b,_0x4e3e92);})[_0x1565('0x1d')](function(_0x389d83){if(_0x389d83){logger[_0x1565('0xc')](_0x1565('0x1e'));logger[_0x1565('0xc')]('The\x20Ticket\x20ID\x20is:',_0x389d83['id']);}})[_0x1565('0x4c')](function(_0x231fa7){logger['error']('['+_0x4e3e92[_0x1565('0x5b')]['toUpperCase']()+']',JSON[_0x1565('0x4f')](_0x231fa7));});}; \ No newline at end of file +var _0xf30a=['localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','info','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','customField','content','includes','string','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','catch','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf30a,0x11b));var _0xaf30=function(_0x29ccae,_0x5d6f15){_0x29ccae=_0x29ccae-0x0;var _0x1ab868=_0xf30a[_0x29ccae];return _0x1ab868;};'use strict';var _=require('lodash');var rp=require(_0xaf30('0x0'));var md5=require(_0xaf30('0x1'));var util=require(_0xaf30('0x2'));var Redis=require('ioredis');var intUtil=require(_0xaf30('0x3'));var config=require(_0xaf30('0x4'));var logger=require(_0xaf30('0x5'))('freshdesk');config[_0xaf30('0x6')]=_[_0xaf30('0x7')](config[_0xaf30('0x6')],{'host':_0xaf30('0x8'),'port':0x18eb});var io=require(_0xaf30('0x9'))(new Redis(config[_0xaf30('0x6')]));var headers={'Content-Type':_0xaf30('0xa'),'Accept':_0xaf30('0xa')};function emit(_0x50b0c9,_0x36f1e9,_0x3664dd){io['to'](_0x50b0c9)[_0xaf30('0xb')](_0x36f1e9,_0x3664dd);}function getTicket(_0x22de42,_0x4c4028,_0x83e3c2,_0x3dd5d6,_0x2a7506){logger['info'](_0xaf30('0xc'));var _0x3037ae=_[_0xaf30('0xd')]({'responder_id':_0x4c4028['id'],'requester_id':_0x83e3c2['id'],'name':util[_0xaf30('0xe')]('Caller\x20-\x20%s',_0x2a7506[_0xaf30('0xf')]),'phone':_0x2a7506[_0xaf30('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xaf30('0x11')](_0x3dd5d6[_0xaf30('0x12')],_0x2a7506,'\x20'),'description':intUtil[_0xaf30('0x11')](_0x3dd5d6[_0xaf30('0x13')],_0x2a7506,'
'),'tags':getTags(_0x3dd5d6[_0xaf30('0x14')],_0xaf30('0x15'))},getCustomFields(_0x3dd5d6[_0xaf30('0x16')],_0x2a7506));_0x3037ae[_0xaf30('0x17')]=_[_0xaf30('0x18')](_[_0xaf30('0x19')](_0x3037ae[_0xaf30('0x17')],'id'),_0xaf30('0x1a'));return request({'uri':util[_0xaf30('0xe')]('%s/api/v2/tickets',_0x22de42[_0xaf30('0x1b')]),'method':_0xaf30('0x1c'),'body':_0x3037ae})[_0xaf30('0x1d')](function(_0xa28d2a){logger['info'](_0xaf30('0x1e'));return _0xa28d2a;});}function getUser(_0xcf9047,_0x3a62ee){if(intUtil[_0xaf30('0x1f')](_0x3a62ee)){return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x20'),_0xcf9047['remoteUri']),'qs':{'email':_0x3a62ee}})[_0xaf30('0x1d')](function(_0x3ef295){if(_0x3ef295[_0xaf30('0x21')]){logger['info'](_0xaf30('0x22'));return _[_0xaf30('0x23')](_0x3ef295,function(_0xb5be93){return _0xb5be93[_0xaf30('0x24')][_0xaf30('0x25')]===_0x3a62ee;});}else{logger[_0xaf30('0x26')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaf30('0xe')]('%s/api/v2/agents/me',_0xcf9047['remoteUri'])})[_0xaf30('0x1d')](function(_0xa2af42){logger[_0xaf30('0x26')](_0xaf30('0x27'));return _0xa2af42;});}});}else{logger['info'](_0xaf30('0x28'));return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x29'),_0xcf9047[_0xaf30('0x1b')])})['then'](function(_0x44c9b1){logger[_0xaf30('0x26')](_0xaf30('0x27'));return _0x44c9b1;});}}function getEndUser(_0x56bb58,_0x4738a7,_0x3c9ea1){logger[_0xaf30('0x26')](_0xaf30('0x2a'),_0x3c9ea1);return request({'uri':util[_0xaf30('0xe')](_0xaf30('0x2b'),_0x56bb58[_0xaf30('0x1b')]),'qs':{'phone':_0x3c9ea1}})[_0xaf30('0x1d')](function(_0x23973a){if(_0x23973a[_0xaf30('0x21')]){logger['info'](_0xaf30('0x2c'));return _[_0xaf30('0x23')](_0x23973a,{'phone':_0x3c9ea1});}else{logger[_0xaf30('0x26')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xaf30('0x2b'),_0x56bb58[_0xaf30('0x1b')]),'method':_0xaf30('0x1c'),'body':{'name':_0x4738a7,'phone':_0x3c9ea1}})['then'](function(_0x264586){logger['info']('Enduser\x20created.');return _0x264586;});}});}function getAuth(_0x3bdad0){return util[_0xaf30('0xe')](_0xaf30('0x2d'),new Buffer(_0x3bdad0[_0xaf30('0x2e')]+':X')[_0xaf30('0x2f')](_0xaf30('0x30')));}function request(_0x976810){logger[_0xaf30('0x31')](_0xaf30('0x32'),JSON['stringify'](_0x976810));return rp(_['defaults'](_0x976810,{'method':_0xaf30('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2095e5,_0x3cf814){var _0x38914b=[];if(_0x2095e5&&_0x2095e5[_0xaf30('0x21')]>0x0){_0x38914b=_[_0xaf30('0x34')](_0x2095e5,_0x3cf814);}return _0x38914b;}function getCustomFields(_0x34359c,_0x4a6dcc){var _0xce05c=[];var _0x5a7c94={'custom_fields':[]};if(_0x34359c['length']>0x0){_[_0xaf30('0x35')](_0x34359c,function(_0x291423){if(_['includes'](['string',_0xaf30('0x36')],_0x291423[_0xaf30('0x37')])&&_0x291423[_0xaf30('0x38')]&&!_0x291423[_0xaf30('0x39')]){_0x5a7c94[_0x291423['nameField']['toLowerCase']()]=_0x291423[_0xaf30('0x3a')][_0xaf30('0x2f')]();}else if(_[_0xaf30('0x3b')]([_0xaf30('0x3c'),_0xaf30('0x36')],_0x291423[_0xaf30('0x37')])&&_0x291423[_0xaf30('0x3d')]&&_0x291423['customField']){_0x5a7c94[_0xaf30('0x17')]['push']({'id':_0x291423[_0xaf30('0x3d')],'value':_0x291423[_0xaf30('0x3a')][_0xaf30('0x2f')]()});}else if(_0x291423[_0xaf30('0x37')]===_0xaf30('0x3e')&&_0x291423[_0xaf30('0x3f')]&&_0x291423[_0xaf30('0x3d')]&&_0x291423[_0xaf30('0x39')]){_0x4a6dcc[_0x291423[_0xaf30('0x3f')]]&&_0x5a7c94['custom_fields'][_0xaf30('0x40')]({'id':_0x291423[_0xaf30('0x3d')],'value':_0x4a6dcc[_0x291423[_0xaf30('0x3f')]]['toString']()});}else if(_0x291423['type']===_0xaf30('0x41')&&_0x291423[_0xaf30('0x42')]&&_0x291423['Variable']['name']&&_0x291423[_0xaf30('0x3d')]&&_0x291423[_0xaf30('0x39')]){_0x4a6dcc[_0x291423[_0xaf30('0x42')][_0xaf30('0x15')][_0xaf30('0x43')]()]&&_0x5a7c94[_0xaf30('0x17')]['push']({'id':_0x291423[_0xaf30('0x3d')],'value':_0x4a6dcc[_0x291423[_0xaf30('0x42')][_0xaf30('0x15')][_0xaf30('0x43')]()][_0xaf30('0x2f')]()});}});}return _0x5a7c94;}exports[_0xaf30('0x44')]=function(_0x16c26e,_0x59b98b,_0x17f2c6,_0x2b2cc1,_0x2c699a,_0x207546){var _0x50fe0d,_0x43854b;_0x207546[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x207546[_0xaf30('0x1b')]);_0x207546[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x207546['serverUrl']);if(_0x2c699a&&_0x2c699a['monitor_format']){logger[_0xaf30('0x26')](_0xaf30('0x47'),'Recording\x20is\x20enabled!');_0x59b98b[_0xaf30('0x48')]=util['format'](_0xaf30('0x49'),_0x207546['serverUrl'],_0x59b98b[_0xaf30('0x4a')],md5(_0x59b98b[_0xaf30('0x4a')]));}else{_0x59b98b['recordingURL']='';}headers[_0xaf30('0x4b')]=getAuth(_0x207546);return getUser(_0x207546,_0x2b2cc1[_0xaf30('0x25')])[_0xaf30('0x1d')](function(_0x4f9d0e){_0x50fe0d=_0x4f9d0e;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x50fe0d['id']);return getEndUser(_0x207546,_0x59b98b[_0xaf30('0xf')],_0x59b98b['calleridnum']);})[_0xaf30('0x1d')](function(_0xeec81d){_0x43854b=_0xeec81d;logger['info'](_0xaf30('0x4d'),_0x43854b['id']);return getTicket(_0x207546,_0x50fe0d,_0x43854b,_0x17f2c6,_0x59b98b);})[_0xaf30('0x1d')](function(_0x53f977){if(_0x53f977&&_0x53f977['id']){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')]('The\x20Ticket\x20ID\x20is:',_0x53f977['id']);logger[_0xaf30('0x26')](_0xaf30('0x47'),_0xaf30('0x4e'));emit(util[_0xaf30('0xe')](_0xaf30('0x4f'),_0x2b2cc1['name']),_0xaf30('0x50'),{'uri':util[_0xaf30('0xe')](_0xaf30('0x51'),_0x207546[_0xaf30('0x1b')],_0x53f977['id'])});}})['catch'](function(_0x4a4c95){logger[_0xaf30('0x52')](_0xaf30('0x47'),JSON[_0xaf30('0x53')](_0x4a4c95));});};exports[_0xaf30('0x54')]=function(_0x403487,_0x5809bb,_0x3f76ac,_0x31259a,_0x26e767,_0x4b3906,_0x42fa77){var _0x44935a,_0xfcc369;_0x4b3906[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x4b3906[_0xaf30('0x1b')]);_0x4b3906[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x4b3906[_0xaf30('0x46')]);if(_0x42fa77&&_0x42fa77[_0xaf30('0x55')]&&_0x42fa77[_0xaf30('0x55')]!==_0xaf30('0x56')){logger[_0xaf30('0x26')](_0xaf30('0x57'),_0xaf30('0x58'));_0x5809bb[_0xaf30('0x48')]=util[_0xaf30('0xe')](_0xaf30('0x49'),_0x4b3906['serverUrl'],_0x5809bb['uniqueid'],md5(_0x5809bb[_0xaf30('0x4a')]));}headers[_0xaf30('0x4b')]=getAuth(_0x4b3906);return getUser(_0x4b3906,_0x31259a[_0xaf30('0x25')])[_0xaf30('0x1d')](function(_0x19c3cd){_0x44935a=_0x19c3cd;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x44935a['id']);return getEndUser(_0x4b3906,_0x5809bb[_0xaf30('0x59')],_0x5809bb[_0xaf30('0x5a')]);})[_0xaf30('0x1d')](function(_0x410f30){_0xfcc369=_0x410f30;logger[_0xaf30('0x26')](_0xaf30('0x4d'),_0xfcc369['id']);return getTicket(_0x4b3906,_0x44935a,_0xfcc369,_0x3f76ac,_0x5809bb);})[_0xaf30('0x1d')](function(_0x2fcb13){if(_0x2fcb13&&_0x2fcb13['id']){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')](_0xaf30('0x5b'),_0x2fcb13['id']);logger[_0xaf30('0x26')](_0xaf30('0x57'),_0xaf30('0x4e'));emit(util['format'](_0xaf30('0x4f'),_0x31259a[_0xaf30('0x15')]),_0xaf30('0x50'),{'uri':util['format'](_0xaf30('0x51'),_0x4b3906[_0xaf30('0x1b')],_0x2fcb13['id'])});}})['catch'](function(_0x3ffcf4){logger[_0xaf30('0x52')](_0xaf30('0x57'),JSON[_0xaf30('0x53')](_0x3ffcf4));});};exports[_0xaf30('0x5c')]=function(_0x2e86c5,_0xe4b4e7,_0x3542ea,_0x3320b4,_0x19d900,_0x2f8cc9){var _0x3f9c44,_0x50ed0a;_0x2f8cc9[_0xaf30('0x1b')]=intUtil[_0xaf30('0x45')](_0x2f8cc9[_0xaf30('0x1b')]);_0x2f8cc9[_0xaf30('0x46')]=intUtil[_0xaf30('0x45')](_0x2f8cc9[_0xaf30('0x46')]);if(_0x19d900&&_0x19d900[_0xaf30('0x5d')]){logger[_0xaf30('0x26')]('['+_0xe4b4e7[_0xaf30('0x5e')][_0xaf30('0x5f')]()+']',_0xaf30('0x58'));_0xe4b4e7[_0xaf30('0x48')]=util[_0xaf30('0xe')](_0xaf30('0x49'),_0x2f8cc9[_0xaf30('0x46')],_0xe4b4e7[_0xaf30('0x4a')],md5(_0xe4b4e7[_0xaf30('0x4a')]));}else{_0xe4b4e7[_0xaf30('0x48')]='';}headers[_0xaf30('0x4b')]=getAuth(_0x2f8cc9);return getUser(_0x2f8cc9,'')[_0xaf30('0x1d')](function(_0x58bc35){_0x3f9c44=_0x58bc35;logger[_0xaf30('0x26')](_0xaf30('0x4c'),_0x3f9c44['id']);return getEndUser(_0x2f8cc9,_0xe4b4e7[_0xaf30('0xf')],_0xe4b4e7[_0xaf30('0x10')]);})[_0xaf30('0x1d')](function(_0x558df0){_0x50ed0a=_0x558df0;logger[_0xaf30('0x26')](_0xaf30('0x4d'),_0x50ed0a['id']);return getTicket(_0x2f8cc9,_0x3f9c44,_0x50ed0a,_0x3542ea,_0xe4b4e7);})[_0xaf30('0x1d')](function(_0x1e9c4e){if(_0x1e9c4e){logger[_0xaf30('0x26')](_0xaf30('0x1e'));logger[_0xaf30('0x26')](_0xaf30('0x5b'),_0x1e9c4e['id']);}})[_0xaf30('0x60')](function(_0x163a96){logger[_0xaf30('0x52')]('['+_0xe4b4e7['lastevent']['toUpperCase']()+']',JSON[_0xaf30('0x53')](_0x163a96));});}; \ 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 98504bc..7c12a39 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 _0xe30e=['userEmail','userId','User\x20found:','Admin\x20selected','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','headers','then','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email'];(function(_0x17e855,_0x52f6f0){var _0x139583=function(_0x3abf73){while(--_0x3abf73){_0x17e855['push'](_0x17e855['shift']());}};_0x139583(++_0x52f6f0);}(_0xe30e,0xea));var _0xee30=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xe30e[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0xee30('0x0'));var rp=require(_0xee30('0x1'));var md5=require(_0xee30('0x2'));var util=require(_0xee30('0x3'));var moment=require(_0xee30('0x4'));var Promise=require(_0xee30('0x5'));var Redis=require(_0xee30('0x6'));var intUtil=require(_0xee30('0x7'));var config=require(_0xee30('0x8'));var logger=require(_0xee30('0x9'))(_0xee30('0xa'));config['redis']=_[_0xee30('0xb')](config[_0xee30('0xc')],{'host':_0xee30('0xd'),'port':0x18eb});var io=require(_0xee30('0xe'))(new Redis(config[_0xee30('0xc')]));function getAdminId(_0x15b122,_0x51e200,_0x2e979c,_0x2e6286){return new Promise(function(_0x45e60e,_0x5aa84b){var _0x568ad9=![];var _0x2b6d39={'method':_0xee30('0xf'),'uri':_0x2e6286+'/api/selector/owners','json':!![]};_0x2b6d39[_0xee30('0x10')]=_0x2e979c;logger['info']('Getting\x20admin\x20information');return rp(_0x2b6d39)[_0xee30('0x11')](function(_0x50add9){if(_0x50add9){var _0x32fbca=_0x50add9['users'];var _0x5a7d67=null;for(_0x5a7d67=0x0;_0x5a7d67<_0x32fbca[_0xee30('0x12')];_0x5a7d67++){if(_0x32fbca[_0x5a7d67][_0xee30('0x13')]===_0x15b122[_0xee30('0x14')]){_0x15b122['adminId']=_0x32fbca[_0x5a7d67]['id'];_0x568ad9=!![];}}if(_0x568ad9){logger[_0xee30('0x15')](_0xee30('0x16'),_0x15b122[_0xee30('0x17')]);_0x45e60e(_0x15b122);}else{_0x5aa84b({'statusCode':0x194,'message':_0xee30('0x18')});}}else{_0x5aa84b({'statusCode':0x194,'message':_0xee30('0x18')});}})[_0xee30('0x19')](function(_0x19b714){logger[_0xee30('0x1a')]('['+[_0x51e200[_0xee30('0x1b')]()]+']',_0x19b714[_0xee30('0x1c')]);_0x5aa84b(_0x19b714);});});}function getUser(_0x46d5d8,_0x116d43,_0x2614bc){return function(_0x2b2050){return new Promise(function(_0x9fc568,_0x4645f3){var _0x19bca7={'method':_0xee30('0xf'),'uri':_0x2614bc+_0xee30('0x1d'),'json':!![]};_0x19bca7['headers']=_0x116d43;logger['info'](_0xee30('0x1e'));return rp(_0x19bca7)[_0xee30('0x11')](function(_0x204297){if(_0x204297){var _0x4ee9c9=_0x204297['users'];var _0x2ae54f=![];var _0x238d6f=null;if(_0x2b2050[_0xee30('0x1f')]!==null){logger[_0xee30('0x15')](_0xee30('0x20'),_0x2b2050['agentEmail']);_0x2b2050[_0xee30('0x21')]=_0x2b2050[_0xee30('0x1f')];for(_0x238d6f=0x0;_0x238d6f<_0x4ee9c9[_0xee30('0x12')];_0x238d6f++){if(_0x4ee9c9[_0x238d6f][_0xee30('0x13')]===_0x2b2050[_0xee30('0x1f')]){_0x2ae54f=!![];_0x2b2050[_0xee30('0x22')]=_0x4ee9c9[_0x238d6f]['id'];logger[_0xee30('0x15')](_0xee30('0x23'),_0x2b2050[_0xee30('0x22')]);}}}if(!_0x2ae54f){logger[_0xee30('0x15')](_0xee30('0x24'));_0x2b2050['userEmail']=_0x2b2050[_0xee30('0x14')];_0x2b2050['userId']=_0x2b2050[_0xee30('0x17')];_0x2ae54f=!![];}if(_0x2ae54f){_0x9fc568(_0x2b2050);}else{_0x4645f3({'statusCode':0x194,'message':_0xee30('0x18')});}}else{_0x4645f3({'statusCode':0x194,'message':_0xee30('0x18')});}})['catch'](function(_0x4d8812){logger[_0xee30('0x1a')]('['+[_0x46d5d8[_0xee30('0x1b')]()]+']',_0x4d8812[_0xee30('0x1c')]);_0x4645f3(_0x4d8812);});});};}function searchContact(_0x188503,_0x2ce2a8,_0x4cd065,_0x212d84){return new Promise(function(_0x1eada7,_0x1362db){var _0x210032={'method':_0xee30('0xf'),'headers':_0x2ce2a8,'uri':_0x188503+'/api/lookup?q='+_0x212d84+_0xee30('0x25')+_0x4cd065+_0xee30('0x26'),'json':!![]};rp(_0x210032)[_0xee30('0x11')](function(_0x13094f){var _0x12fbd7=_[_0xee30('0x27')](_0x13094f[_0xee30('0x28')][_0xee30('0x28')],[_0x4cd065,_0x212d84]);_0x1eada7(_0x12fbd7);})[_0xee30('0x19')](function(_0x294cfc){_0x1362db(_0x294cfc);});});}function getEndUser(_0x2373c5,_0x3ff008,_0x57b617){return function(_0x919281){return new Promise(function(_0x43ce52,_0x29a976){logger[_0xee30('0x15')](util[_0xee30('0x29')](_0xee30('0x2a'),_0x919281['contactNumber']));searchContact(_0x57b617,_0x3ff008,_0xee30('0x2b'),_0x919281[_0xee30('0x2c')])[_0xee30('0x11')](function(_0x52bde9){if(_0x52bde9){_0x919281[_0xee30('0x2d')]=_0x52bde9['id'];logger[_0xee30('0x15')](_0xee30('0x2e'),_0x919281['endUserId']);return _0x43ce52(_0x919281);}searchContact(_0x57b617,_0x3ff008,_0xee30('0x2f'),_0x919281[_0xee30('0x2c')])[_0xee30('0x11')](function(_0x23a414){if(_0x23a414){_0x919281['endUserId']=_0x23a414['id'];logger[_0xee30('0x15')](_0xee30('0x30'),_0x919281['endUserId']);return _0x43ce52(_0x919281);}createEndUser(_0x919281,_0x2373c5,_0x3ff008,_0x57b617)[_0xee30('0x11')](function(_0x221240){logger['info']('Contact\x20created:',_0x221240['endUserId']);return _0x43ce52(_0x221240);});});})[_0xee30('0x19')](function(_0x6122df){_0x29a976(_0x6122df);});});};}function createEndUser(_0x530e78,_0x37843d,_0x2d7c77,_0x3fa42c){return new Promise(function(_0x105937,_0x1d9426){var _0x3ce07b=moment();var _0x42320f={'method':_0xee30('0x31'),'uri':_0x3fa42c+_0xee30('0x32'),'body':{'contact':{'last_name':_0x530e78[_0xee30('0x2c')],'work_number':_0x530e78[_0xee30('0x2c')],'mobile_number':_0x530e78['contactNumber'],'owner_id':_0x530e78[_0xee30('0x22')],'created_at':_0x3ce07b[_0xee30('0x29')](_0xee30('0x33'))}},'json':!![]};_0x42320f[_0xee30('0x10')]=_0x2d7c77;logger[_0xee30('0x15')](_0xee30('0x34'));return rp(_0x42320f)[_0xee30('0x11')](function(_0x5476de){_0x530e78['endUserId']=_0x5476de[_0xee30('0x35')]['id'];_0x105937(_0x530e78);})[_0xee30('0x19')](function(_0x6fb19b){logger[_0xee30('0x1a')]('['+[_0x37843d[_0xee30('0x1b')]()]+']',_0x6fb19b['message']);_0x1d9426(_0x6fb19b[_0xee30('0x1c')]);});});}function getTicket(_0x3f7fcd,_0x2e0427,_0x4a0cc0,_0x477bf6,_0x4ce318){return function(_0x2fce09){logger[_0xee30('0x15')](_0xee30('0x36'));return new Promise(function(_0x136d01,_0x1d5d71){var _0x431ae0=moment();var _0x3fd634={'method':_0xee30('0x31'),'uri':_0x4a0cc0+_0xee30('0x37'),'body':{'title':intUtil[_0xee30('0x38')](_0x477bf6['Subjects'],_0x4ce318,'\x20'),'description':intUtil[_0xee30('0x38')](_0x477bf6['Descriptions'],_0x4ce318,'\x0a'),'owner_id':_0x2fce09[_0xee30('0x22')],'creater_id':_0x2fce09[_0xee30('0x17')],'targetable_id':_0x2fce09['endUserId'],'targetable_type':_0xee30('0x39'),'created_at':_0x431ae0['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x431ae0[_0xee30('0x3a')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3fd634[_0xee30('0x10')]=_0x2e0427;return rp(_0x3fd634)[_0xee30('0x11')](function(_0x215059){_0x2fce09[_0xee30('0x3b')]=_0x215059[_0xee30('0x3c')]['id'];logger[_0xee30('0x15')](_0xee30('0x3d'),_0x2fce09[_0xee30('0x3b')]);_0x136d01(_0x2fce09);})['catch'](function(_0x4b0b2d){logger[_0xee30('0x1a')]('['+[_0x3f7fcd['toUpperCase']()]+']',_0x4b0b2d[_0xee30('0x1c')]);_0x1d5d71(_0x4b0b2d[_0xee30('0x1c')]);});});};}function emit(_0x488581,_0x3a6700,_0x58e246){var _0x134980={'uri':_0x488581+'/contacts/'+_0x58e246};io['to'](util['format'](_0xee30('0x3e'),_0x3a6700))[_0xee30('0x3f')](_0xee30('0x40'),_0x134980);}exports['cs']=function(_0x183e8a,_0x32e987,_0x315fcc,_0x38392f,_0x5d714b,_0x3c7346,_0x234495,_0x1c63b8){var _0x2f007e={};var _0x2e4168={'Authorization':_0xee30('0x41')+_0x3c7346[_0xee30('0x42')]};_0x3c7346[_0xee30('0x43')]=intUtil[_0xee30('0x44')](_0x3c7346[_0xee30('0x43')]);_0x3c7346[_0xee30('0x45')]=intUtil[_0xee30('0x44')](_0x3c7346[_0xee30('0x45')]);var _0x15cbbe=_0x3c7346['remoteUri'];_0x2f007e[_0xee30('0x14')]=_0x3c7346['username'];_0x2f007e[_0xee30('0x2c')]=_0x1c63b8[_0xee30('0x46')]()==='outbound'?_0x32e987[_0xee30('0x47')]:_0x32e987[_0xee30('0x48')];_0x2f007e[_0xee30('0x49')]=_0x1c63b8===_0xee30('0x4a')||_0x1c63b8===_0xee30('0x4b')?_0xee30('0x4a'):'outbound';if(_0x38392f){_0x2f007e['agentEmail']=_0x38392f[_0xee30('0x13')];}var _0x552df1=util[_0xee30('0x29')](_0xee30('0x4c'),_0x3c7346['serverUrl'],_0x32e987[_0xee30('0x4d')],md5(_0x32e987[_0xee30('0x4d')]));if(_0x5d714b&&_0x5d714b[_0xee30('0x4e')]){logger[_0xee30('0x15')]('[QUEUE]',_0xee30('0x4f'));_0x32e987[_0xee30('0x50')]=_0x552df1;}else if(_0x234495&&_0x234495[_0xee30('0x51')]&&_0x234495[_0xee30('0x51')]!==_0xee30('0x52')){logger['info'](_0xee30('0x53'),_0xee30('0x4f'));_0x32e987[_0xee30('0x50')]=_0x552df1;}else{_0x32e987[_0xee30('0x50')]='';}return getAdminId(_0x2f007e,_0x1c63b8,_0x2e4168,_0x15cbbe)['then'](getUser(_0x1c63b8,_0x2e4168,_0x15cbbe))[_0xee30('0x11')](getEndUser(_0x1c63b8,_0x2e4168,_0x15cbbe))['then'](getTicket(_0x1c63b8,_0x2e4168,_0x15cbbe,_0x315fcc,_0x32e987))['then'](function(_0x2b887e){logger[_0xee30('0x15')](util[_0xee30('0x29')](_0xee30('0x54'),_0x2b887e[_0xee30('0x3b')]));if(_0x1c63b8!==_0xee30('0x4b')){logger[_0xee30('0x15')]('['+[_0x1c63b8[_0xee30('0x1b')]()]+']',_0xee30('0x55'));emit(_0x15cbbe,_0x38392f[_0xee30('0x56')],_0x2b887e['endUserId']);}})['catch'](function(_0x28648b){logger['error']('['+[_0x1c63b8[_0xee30('0x1b')]()]+_0xee30('0x57'),util[_0xee30('0x58')](_0x28648b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1429=['none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20with\x20email','agentEmail','length','User\x20found:','userId','Admin\x20selected','userEmail','toUpperCase','/api/lookup?q=','&entities=contact','find','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','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x27f865,_0x247b9a){var _0x5ae8ed=function(_0x183adb){while(--_0x183adb){_0x27f865['push'](_0x27f865['shift']());}};_0x5ae8ed(++_0x247b9a);}(_0x1429,0x1a0));var _0x9142=function(_0xf47bc8,_0x26ff25){_0xf47bc8=_0xf47bc8-0x0;var _0x11a792=_0x1429[_0xf47bc8];return _0x11a792;};'use strict';var _=require('lodash');var rp=require(_0x9142('0x0'));var md5=require(_0x9142('0x1'));var util=require(_0x9142('0x2'));var moment=require('moment');var Promise=require(_0x9142('0x3'));var Redis=require(_0x9142('0x4'));var intUtil=require('./util');var config=require(_0x9142('0x5'));var logger=require(_0x9142('0x6'))('freshsales');config[_0x9142('0x7')]=_['defaults'](config[_0x9142('0x7')],{'host':_0x9142('0x8'),'port':0x18eb});var io=require(_0x9142('0x9'))(new Redis(config[_0x9142('0x7')]));function getAdminId(_0x5a13e9,_0x3d5e07,_0x15dbbf,_0x101a0f){return new Promise(function(_0xa1d659,_0x14a112){var _0x221e3b=![];var _0x77d70c={'method':_0x9142('0xa'),'uri':_0x101a0f+_0x9142('0xb'),'json':!![]};_0x77d70c[_0x9142('0xc')]=_0x15dbbf;logger[_0x9142('0xd')](_0x9142('0xe'));return rp(_0x77d70c)[_0x9142('0xf')](function(_0x264f1e){if(_0x264f1e){var _0x2639f8=_0x264f1e[_0x9142('0x10')];var _0x4d9a9a=null;for(_0x4d9a9a=0x0;_0x4d9a9a<_0x2639f8['length'];_0x4d9a9a++){if(_0x2639f8[_0x4d9a9a][_0x9142('0x11')]===_0x5a13e9[_0x9142('0x12')]){_0x5a13e9[_0x9142('0x13')]=_0x2639f8[_0x4d9a9a]['id'];_0x221e3b=!![];}}if(_0x221e3b){logger['info']('Admin\x20found:',_0x5a13e9[_0x9142('0x13')]);_0xa1d659(_0x5a13e9);}else{_0x14a112({'statusCode':0x194,'message':_0x9142('0x14')});}}else{_0x14a112({'statusCode':0x194,'message':_0x9142('0x14')});}})[_0x9142('0x15')](function(_0x4e79a0){logger[_0x9142('0x16')]('['+[_0x3d5e07['toUpperCase']()]+']',_0x4e79a0[_0x9142('0x17')]);_0x14a112(_0x4e79a0);});});}function getUser(_0x55a2e3,_0x55d609,_0x1cffde){return function(_0x4a4f73){return new Promise(function(_0x27fff4,_0x317f4a){var _0x89eb76={'method':'GET','uri':_0x1cffde+_0x9142('0xb'),'json':!![]};_0x89eb76[_0x9142('0xc')]=_0x55d609;logger[_0x9142('0xd')]('Getting\x20user\x20list');return rp(_0x89eb76)['then'](function(_0x4770eb){if(_0x4770eb){var _0xaebedd=_0x4770eb['users'];var _0x69dd73=![];var _0x1075c7=null;if(_0x4a4f73['agentEmail']!==null){logger['info'](_0x9142('0x18'),_0x4a4f73[_0x9142('0x19')]);_0x4a4f73['userEmail']=_0x4a4f73[_0x9142('0x19')];for(_0x1075c7=0x0;_0x1075c7<_0xaebedd[_0x9142('0x1a')];_0x1075c7++){if(_0xaebedd[_0x1075c7][_0x9142('0x11')]===_0x4a4f73[_0x9142('0x19')]){_0x69dd73=!![];_0x4a4f73['userId']=_0xaebedd[_0x1075c7]['id'];logger[_0x9142('0xd')](_0x9142('0x1b'),_0x4a4f73[_0x9142('0x1c')]);}}}if(!_0x69dd73){logger[_0x9142('0xd')](_0x9142('0x1d'));_0x4a4f73[_0x9142('0x1e')]=_0x4a4f73[_0x9142('0x12')];_0x4a4f73['userId']=_0x4a4f73['adminId'];_0x69dd73=!![];}if(_0x69dd73){_0x27fff4(_0x4a4f73);}else{_0x317f4a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x317f4a({'statusCode':0x194,'message':_0x9142('0x14')});}})[_0x9142('0x15')](function(_0x579951){logger['error']('['+[_0x55a2e3[_0x9142('0x1f')]()]+']',_0x579951[_0x9142('0x17')]);_0x317f4a(_0x579951);});});};}function searchContact(_0x1cfc85,_0x5ba952,_0x387d3a,_0x32172a){return new Promise(function(_0x40a178,_0x1df23d){var _0x2bc321={'method':_0x9142('0xa'),'headers':_0x5ba952,'uri':_0x1cfc85+_0x9142('0x20')+_0x32172a+'&f='+_0x387d3a+_0x9142('0x21'),'json':!![]};rp(_0x2bc321)['then'](function(_0x5d37cb){var _0x32598c=_[_0x9142('0x22')](_0x5d37cb[_0x9142('0x23')]['contacts'],[_0x387d3a,_0x32172a]);_0x40a178(_0x32598c);})[_0x9142('0x15')](function(_0x457d91){_0x1df23d(_0x457d91);});});}function getEndUser(_0x210048,_0x268ee3,_0x5a47a7){return function(_0x27ea7f){return new Promise(function(_0x31b29a,_0x285177){logger['info'](util[_0x9142('0x24')](_0x9142('0x25'),_0x27ea7f['contactNumber']));searchContact(_0x5a47a7,_0x268ee3,_0x9142('0x26'),_0x27ea7f[_0x9142('0x27')])[_0x9142('0xf')](function(_0x3da510){if(_0x3da510){_0x27ea7f[_0x9142('0x28')]=_0x3da510['id'];logger[_0x9142('0xd')](_0x9142('0x29'),_0x27ea7f[_0x9142('0x28')]);return _0x31b29a(_0x27ea7f);}searchContact(_0x5a47a7,_0x268ee3,_0x9142('0x2a'),_0x27ea7f['contactNumber'])[_0x9142('0xf')](function(_0x21899e){if(_0x21899e){_0x27ea7f[_0x9142('0x28')]=_0x21899e['id'];logger[_0x9142('0xd')](_0x9142('0x2b'),_0x27ea7f[_0x9142('0x28')]);return _0x31b29a(_0x27ea7f);}createEndUser(_0x27ea7f,_0x210048,_0x268ee3,_0x5a47a7)[_0x9142('0xf')](function(_0x394424){logger[_0x9142('0xd')](_0x9142('0x2c'),_0x394424[_0x9142('0x28')]);return _0x31b29a(_0x394424);});});})[_0x9142('0x15')](function(_0x390a6c){_0x285177(_0x390a6c);});});};}function createEndUser(_0x2112c4,_0xda86c2,_0x485cda,_0x7194c7){return new Promise(function(_0xbf7258,_0x2e2285){var _0x6cc3ad=moment();var _0xaf1857={'method':_0x9142('0x2d'),'uri':_0x7194c7+_0x9142('0x2e'),'body':{'contact':{'last_name':_0x2112c4['contactNumber'],'work_number':_0x2112c4[_0x9142('0x27')],'mobile_number':_0x2112c4['contactNumber'],'owner_id':_0x2112c4[_0x9142('0x1c')],'created_at':_0x6cc3ad[_0x9142('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xaf1857[_0x9142('0xc')]=_0x485cda;logger[_0x9142('0xd')](_0x9142('0x2f'));return rp(_0xaf1857)[_0x9142('0xf')](function(_0x3e40c8){_0x2112c4['endUserId']=_0x3e40c8[_0x9142('0x30')]['id'];_0xbf7258(_0x2112c4);})[_0x9142('0x15')](function(_0x18790a){logger[_0x9142('0x16')]('['+[_0xda86c2['toUpperCase']()]+']',_0x18790a[_0x9142('0x17')]);_0x2e2285(_0x18790a[_0x9142('0x17')]);});});}function getTicket(_0x4a1f74,_0x216f6c,_0x27b8b6,_0xbf7229,_0x9247ef){return function(_0x21a058){logger[_0x9142('0xd')](_0x9142('0x31'));return new Promise(function(_0x3689c3,_0x17dc6f){var _0x515118=moment();var _0x42e33e={'method':_0x9142('0x2d'),'uri':_0x27b8b6+_0x9142('0x32'),'body':{'title':intUtil[_0x9142('0x33')](_0xbf7229[_0x9142('0x34')],_0x9247ef,'\x20'),'description':intUtil['getString'](_0xbf7229['Descriptions'],_0x9247ef,'\x0a'),'owner_id':_0x21a058['userId'],'creater_id':_0x21a058['adminId'],'targetable_id':_0x21a058[_0x9142('0x28')],'targetable_type':'Contact','created_at':_0x515118['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x515118['add'](0x1e,'m')[_0x9142('0x24')](_0x9142('0x35'))},'json':!![]};_0x42e33e[_0x9142('0xc')]=_0x216f6c;return rp(_0x42e33e)[_0x9142('0xf')](function(_0xe02f3b){_0x21a058['ticketId']=_0xe02f3b[_0x9142('0x36')]['id'];logger['info'](_0x9142('0x37'),_0x21a058[_0x9142('0x38')]);_0x3689c3(_0x21a058);})['catch'](function(_0x321824){logger['error']('['+[_0x4a1f74[_0x9142('0x1f')]()]+']',_0x321824[_0x9142('0x17')]);_0x17dc6f(_0x321824[_0x9142('0x17')]);});});};}function emit(_0x48f35b,_0x21fe8d,_0x1f6f56){var _0x2421ae={'uri':_0x48f35b+'/contacts/'+_0x1f6f56};io['to'](util[_0x9142('0x24')](_0x9142('0x39'),_0x21fe8d))[_0x9142('0x3a')](_0x9142('0x3b'),_0x2421ae);}exports['cs']=function(_0x228c5d,_0x3b0a07,_0x5e2b74,_0x1ad967,_0x5b9692,_0x1709f8,_0x54d139,_0x426011){var _0x505ead={};var _0x544957={'Authorization':_0x9142('0x3c')+_0x1709f8[_0x9142('0x3d')]};_0x1709f8[_0x9142('0x3e')]=intUtil['stripTrailingSlash'](_0x1709f8[_0x9142('0x3e')]);_0x1709f8[_0x9142('0x3f')]=intUtil['stripTrailingSlash'](_0x1709f8[_0x9142('0x3f')]);var _0x287018=_0x1709f8['remoteUri'];_0x505ead[_0x9142('0x12')]=_0x1709f8[_0x9142('0x40')];_0x505ead[_0x9142('0x27')]=_0x426011['toLowerCase']()===_0x9142('0x41')?_0x3b0a07[_0x9142('0x42')]:_0x3b0a07[_0x9142('0x43')];_0x505ead[_0x9142('0x44')]=_0x426011===_0x9142('0x45')||_0x426011==='unmanaged'?_0x9142('0x45'):'outbound';if(_0x1ad967){_0x505ead[_0x9142('0x19')]=_0x1ad967['email'];}var _0xd74b67=util[_0x9142('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1709f8['serverUrl'],_0x3b0a07[_0x9142('0x46')],md5(_0x3b0a07['uniqueid']));if(_0x5b9692&&_0x5b9692[_0x9142('0x47')]){logger[_0x9142('0xd')](_0x9142('0x48'),_0x9142('0x49'));_0x3b0a07[_0x9142('0x4a')]=_0xd74b67;}else if(_0x54d139&&_0x54d139[_0x9142('0x4b')]&&_0x54d139['recordingFormat']!==_0x9142('0x4c')){logger[_0x9142('0xd')](_0x9142('0x4d'),_0x9142('0x49'));_0x3b0a07[_0x9142('0x4a')]=_0xd74b67;}else{_0x3b0a07[_0x9142('0x4a')]='';}return getAdminId(_0x505ead,_0x426011,_0x544957,_0x287018)[_0x9142('0xf')](getUser(_0x426011,_0x544957,_0x287018))[_0x9142('0xf')](getEndUser(_0x426011,_0x544957,_0x287018))['then'](getTicket(_0x426011,_0x544957,_0x287018,_0x5e2b74,_0x3b0a07))[_0x9142('0xf')](function(_0x4faed3){logger[_0x9142('0xd')](util['format'](_0x9142('0x4e'),_0x4faed3[_0x9142('0x38')]));if(_0x426011!=='unmanaged'){logger[_0x9142('0xd')]('['+[_0x426011[_0x9142('0x1f')]()]+']',_0x9142('0x4f'));emit(_0x287018,_0x1ad967['name'],_0x4faed3[_0x9142('0x28')]);}})[_0x9142('0x15')](function(_0x96ce2d){logger[_0x9142('0x16')]('['+[_0x426011[_0x9142('0x1f')]()]+_0x9142('0x50'),util[_0x9142('0x51')](_0x96ce2d,{'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 9cb1b78..b792169 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 _0xf8f5=['freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zendesk','desk','unknown\x20integration','../../../../config/logger','[EXEC]','format','data3','error','lodash','util','./zendesk','./freshdesk','./zoho','./desk','./vtiger','./freshsales','salesforce','sugarcrm'];(function(_0x149121,_0x536f5a){var _0x1809ba=function(_0x214152){while(--_0x214152){_0x149121['push'](_0x149121['shift']());}};_0x1809ba(++_0x536f5a);}(_0xf8f5,0x15e));var _0x5f8f=function(_0x41986a,_0x2e401e){_0x41986a=_0x41986a-0x0;var _0x117c9e=_0xf8f5[_0x41986a];return _0x117c9e;};'use strict';var _=require(_0x5f8f('0x0'));var util=require(_0x5f8f('0x1'));var zendesk=require(_0x5f8f('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5f8f('0x3'));var zoho=require(_0x5f8f('0x4'));var desk=require(_0x5f8f('0x5'));var vtiger=require(_0x5f8f('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x5f8f('0x7'));var integrations=['zendesk',_0x5f8f('0x8'),_0x5f8f('0x9'),_0x5f8f('0xa'),_0x5f8f('0xb'),'desk',_0x5f8f('0xc'),_0x5f8f('0xd'),_0x5f8f('0xe'),_0x5f8f('0xf')];exports[_0x5f8f('0x10')]=function(_0x2cbaa2,_0xba9916,_0x4c0747,_0x4c0fac,_0x3edf00,_0x18b41a){if(_0x4c0747){if(_[_0x5f8f('0x11')](integrations,_0x2cbaa2['data1'][_0x5f8f('0x12')]())){try{var _0x39c71f=null;var _0x113cd2='';var _0xea859c=_0x4c0747[_0x2cbaa2['data1']['toLowerCase']()];if(_0xea859c){var _0x3d09cf=_0xea859c[_0x2cbaa2['data2']];if(_0x3d09cf){var _0x4db97=_[_0x5f8f('0x13')](_0x3d09cf[_0x5f8f('0x14')],{'id':parseInt(_0x2cbaa2['data3'],0xa)});if(_0x4db97){if(_0x4c0fac){if(_0x3edf00&&_0xba9916[_0x5f8f('0x15')]){_0x113cd2=_0x5f8f('0x15');}else if(_0xba9916[_0x5f8f('0x16')]){_0x113cd2=_0x5f8f('0x17');}else{console[_0x5f8f('0x18')](_0x5f8f('0x19'),_0xba9916);}}else{_0x113cd2=_0x5f8f('0x1a');}switch(_0x2cbaa2[_0x5f8f('0x1b')][_0x5f8f('0x12')]()){case _0x5f8f('0x1c'):zendesk[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0x8'):salesforce[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0x9'):sugarcrm[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0xa'):freshdesk[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0xb'):zoho[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0x1d'):desk[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case _0x5f8f('0xc'):vtiger[_0x113cd2](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a);break;case'freshsales':freshsales['cs'](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a,_0x113cd2);break;case _0x5f8f('0xf'):servicenow['cs'](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a,_0x113cd2);break;case _0x5f8f('0xd'):dynamics365['cs'](_0x2cbaa2,_0xba9916,_0x4db97,_0x4c0fac,_0x3edf00,_0x3d09cf,_0x18b41a,_0x113cd2);break;default:console['log'](_0x5f8f('0x1e'));}}else{_0x39c71f=require(_0x5f8f('0x1f'))(_0x2cbaa2[_0x5f8f('0x1b')][_0x5f8f('0x12')]());_0x39c71f['error'](_0x5f8f('0x20'),util[_0x5f8f('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2cbaa2[_0x5f8f('0x1b')][_0x5f8f('0x12')](),_0x2cbaa2[_0x5f8f('0x22')]));}}else{_0x39c71f=require(_0x5f8f('0x1f'))(_0x2cbaa2[_0x5f8f('0x1b')][_0x5f8f('0x12')]());_0x39c71f[_0x5f8f('0x23')](_0x5f8f('0x20'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2cbaa2['data1']['toLowerCase'](),_0x2cbaa2['data2']));}}else{}}catch(_0xc1aae9){console[_0x5f8f('0x23')](_0xc1aae9);}}}}; \ No newline at end of file +var _0xd9c0=['./sugarcrm','./freshdesk','./zoho','./desk','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk'];(function(_0x223364,_0x4c94a9){var _0x3f627b=function(_0xc48ff9){while(--_0xc48ff9){_0x223364['push'](_0x223364['shift']());}};_0x3f627b(++_0x4c94a9);}(_0xd9c0,0xad));var _0x0d9c=function(_0x3b6450,_0x264ca0){_0x3b6450=_0x3b6450-0x0;var _0x1510ef=_0xd9c0[_0x3b6450];return _0x1510ef;};'use strict';var _=require('lodash');var util=require(_0x0d9c('0x0'));var zendesk=require(_0x0d9c('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x0d9c('0x2'));var freshdesk=require(_0x0d9c('0x3'));var zoho=require(_0x0d9c('0x4'));var desk=require(_0x0d9c('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x0d9c('0x6'),_0x0d9c('0x7'),_0x0d9c('0x8'),'freshdesk',_0x0d9c('0x9'),_0x0d9c('0xa'),_0x0d9c('0xb'),_0x0d9c('0xc'),_0x0d9c('0xd'),'servicenow'];exports['exec']=function(_0x4d67a5,_0x2d070c,_0x5ac85b,_0x4b4f14,_0x730bea,_0x5e0004){if(_0x5ac85b){if(_[_0x0d9c('0xe')](integrations,_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')]())){try{var _0xe436d3=null;var _0x243f3e='';var _0x51fffa=_0x5ac85b[_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')]()];if(_0x51fffa){var _0x504666=_0x51fffa[_0x4d67a5['data2']];if(_0x504666){var _0x29c7bc=_[_0x0d9c('0x11')](_0x504666[_0x0d9c('0x12')],{'id':parseInt(_0x4d67a5[_0x0d9c('0x13')],0xa)});if(_0x29c7bc){if(_0x4b4f14){if(_0x730bea&&_0x2d070c[_0x0d9c('0x14')]){_0x243f3e=_0x0d9c('0x14');}else if(_0x2d070c[_0x0d9c('0x15')]){_0x243f3e=_0x0d9c('0x16');}else{console[_0x0d9c('0x17')](_0x0d9c('0x18'),_0x2d070c);}}else{_0x243f3e=_0x0d9c('0x19');}switch(_0x4d67a5['data1'][_0x0d9c('0x10')]()){case'zendesk':zendesk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0x7'):salesforce[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'sugarcrm':sugarcrm[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0x1a'):freshdesk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'zoho':zoho[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case _0x0d9c('0xa'):desk[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'vtiger':vtiger[_0x243f3e](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004);break;case'freshsales':freshsales['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;case'servicenow':servicenow['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;case _0x0d9c('0xc'):dynamics365['cs'](_0x4d67a5,_0x2d070c,_0x29c7bc,_0x4b4f14,_0x730bea,_0x504666,_0x5e0004,_0x243f3e);break;default:console[_0x0d9c('0x17')](_0x0d9c('0x1b'));}}else{_0xe436d3=require(_0x0d9c('0x1c'))(_0x4d67a5['data1']['toLowerCase']());_0xe436d3[_0x0d9c('0x1d')](_0x0d9c('0x1e'),util[_0x0d9c('0x1f')](_0x0d9c('0x20'),_0x4d67a5['data1']['toLowerCase'](),_0x4d67a5[_0x0d9c('0x13')]));}}else{_0xe436d3=require(_0x0d9c('0x1c'))(_0x4d67a5['data1']['toLowerCase']());_0xe436d3[_0x0d9c('0x1d')](_0x0d9c('0x1e'),util[_0x0d9c('0x1f')](_0x0d9c('0x21'),_0x4d67a5[_0x0d9c('0xf')][_0x0d9c('0x10')](),_0x4d67a5[_0x0d9c('0x22')]));}}else{}}catch(_0x543983){console[_0x0d9c('0x1d')](_0x543983);}}}}; \ 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 e77da4b..6377030 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 _0xf6ed=['toUpperCase','isNil','lastevent',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','find','length','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','then','moduleSearch','additionalSearchContact','merge','$or','Contact','execute','Lead','account_contact_lead','additionalSearchAccount','cloneDeep','additionalSearchLead','contact','Account','first','Name','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','','No\x20Company','create','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','securityToken','remoteUri','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0x2d1dac,_0xa8a71){var _0x31d5f8=function(_0x532e19){while(--_0x532e19){_0x2d1dac['push'](_0x2d1dac['shift']());}};_0x31d5f8(++_0xa8a71);}(_0xf6ed,0xfa));var _0xdf6e=function(_0x46d3d5,_0x211177){_0x46d3d5=_0x46d3d5-0x0;var _0x1f4a21=_0xf6ed[_0x46d3d5];return _0x1f4a21;};'use strict';var _=require(_0xdf6e('0x0'));var rp=require(_0xdf6e('0x1'));var moment=require(_0xdf6e('0x2'));var BPromise=require(_0xdf6e('0x3'));var md5=require(_0xdf6e('0x4'));var jsforce=require(_0xdf6e('0x5'));var util=require(_0xdf6e('0x6'));var Redis=require(_0xdf6e('0x7'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xdf6e('0x8'))('salesforce');config[_0xdf6e('0x9')]=_[_0xdf6e('0xa')](config[_0xdf6e('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdf6e('0xb'))(new Redis(config['redis']));function emit(_0x159d93,_0x1eb4d0,_0x48ac27){io['to'](_0x159d93)[_0xdf6e('0xc')](_0x1eb4d0,_0x48ac27);}function getTicket(_0xcab305,_0x5d5ba5,_0x1a4c4c,_0x5b7575,_0x1e6bf8,_0x5680f8,_0x3aeebb,_0x5c8835){var _0x1f6e1c=Object[_0xdf6e('0xd')]({},{'OwnerId':_0x5d5ba5['id'],'Subject':intUtil[_0xdf6e('0xe')](_0x5b7575['Subjects'],_0x1e6bf8,'\x20'),'Description':intUtil['getString'](_0x5b7575[_0xdf6e('0xf')],_0x1e6bf8,'\x0a')},getCustomFields(_0x5680f8,_0x1e6bf8));if(_0x1a4c4c){if(_0x5b7575['ticketType']===_0xdf6e('0x10')){_0x1f6e1c[_0xdf6e('0x11')]=moment[_0xdf6e('0x12')]();_0x1f6e1c['IsReminderSet']=![];_0x1f6e1c[_0xdf6e('0x13')]=![];if(_0x1a4c4c[_0xdf6e('0x14')]==='contact'||_0x1a4c4c['endUserType']==='lead'){_0x1f6e1c[_0xdf6e('0x15')]=_0x1a4c4c['id'];}else if(_0x1a4c4c['endUserType']===_0xdf6e('0x16')){_0x1f6e1c[_0xdf6e('0x17')]=_0x1a4c4c['id'];}}else if(_0x5b7575[_0xdf6e('0x18')]===_0xdf6e('0x19')){if(_0x1a4c4c[_0xdf6e('0x14')]==='contact'){_0x1f6e1c[_0xdf6e('0x1a')]=_0x1a4c4c['id'];}else if(_0x1a4c4c[_0xdf6e('0x14')]===_0xdf6e('0x16')){_0x1f6e1c[_0xdf6e('0x1b')]=_0x1a4c4c['id'];}else if(_0x1a4c4c['endUserType']===_0xdf6e('0x1c')&&_0x5b7575['leadId']){_0x1f6e1c[_0x5b7575[_0xdf6e('0x1d')]]=_0x1a4c4c['id'];}else{logger[_0xdf6e('0x1e')](_0xdf6e('0x1f'));}}}return _0x3aeebb[_0xdf6e('0x20')](_0x5b7575['ticketType'])['create'](_0x1f6e1c);}function getUser(_0x51dfdd,_0x35b0a9,_0x1c6a2a){if(!_['isNil'](_0x35b0a9)&&intUtil['validateEmail'](_0x35b0a9)){var _0x2fb880={'Email':_0x35b0a9};var _0x12e4d0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1c6a2a[_0xdf6e('0x20')]('User')[_0xdf6e('0x21')](_0x2fb880,_0x12e4d0)['execute']()['then'](function(_0x5e553d){if(_0x5e553d[_0xdf6e('0x22')]){var _0x4b8dc7=_[_0xdf6e('0x21')](_0x5e553d,function(_0x14ab43){return _0x14ab43['Email']===_0x35b0a9;});if(_0x4b8dc7){logger[_0xdf6e('0x1e')]('Agent\x20%s\x20found.',_0x35b0a9);return BPromise[_0xdf6e('0x23')]({'id':_0x4b8dc7['Id'],'name':_0x4b8dc7['Name']});}}else{logger['info'](_0xdf6e('0x24'),_0x35b0a9);return _0x1c6a2a[_0xdf6e('0x25')]()['then'](function(_0x59a8e9){return BPromise[_0xdf6e('0x23')]({'id':_0x59a8e9[_0xdf6e('0x26')],'name':_0x59a8e9['display_name']});});}});}else{logger['info'](_0xdf6e('0x24'),_0x35b0a9);return _0x1c6a2a[_0xdf6e('0x25')]()[_0xdf6e('0x27')](function(_0x237d2c){return BPromise[_0xdf6e('0x23')]({'id':_0x237d2c[_0xdf6e('0x26')],'name':_0x237d2c['display_name']});});}}function getEndUser(_0x385b1e,_0x537aed,_0x1161bd,_0x127dfb,_0x22b176){var _0x3ec0f9={'$or':{'Phone':_0x127dfb}};var _0x16a3fd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xdf6e('0x27')](function(){logger[_0xdf6e('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x127dfb,_0x537aed[_0xdf6e('0x28')]);switch(_0x537aed[_0xdf6e('0x28')]){case'contact_lead':var _0x489c3b=_['cloneDeep'](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x29')]){var _0x146ebe={};_0x146ebe[_0x537aed[_0xdf6e('0x29')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x489c3b[_0xdf6e('0x2b')],_0x146ebe);}return _0x22b176[_0xdf6e('0x20')](_0xdf6e('0x2c'))[_0xdf6e('0x21')](_0x489c3b,_0x16a3fd)[_0xdf6e('0x2d')]()[_0xdf6e('0x27')](function(_0x319dec){if(_0x319dec&&_0x319dec[_0xdf6e('0x22')]){return _0x319dec;}else{var _0x3086b9=_['cloneDeep'](_0x3ec0f9);if(_0x537aed['additionalSearchLead']){var _0x54b9e0={};_0x54b9e0[_0x537aed['additionalSearchLead']]=_0x127dfb;_['merge'](_0x3086b9[_0xdf6e('0x2b')],_0x54b9e0);}return _0x22b176['sobject'](_0xdf6e('0x2e'))[_0xdf6e('0x21')](_0x3086b9,_0x16a3fd);}});case _0xdf6e('0x2f'):var _0x33fe29=_['cloneDeep'](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x30')]){var _0x146ebe={};_0x146ebe[_0x537aed[_0xdf6e('0x30')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x33fe29[_0xdf6e('0x2b')],_0x146ebe);}return _0x22b176[_0xdf6e('0x20')]('Account')['find'](_0x33fe29,_0x16a3fd)['execute']()[_0xdf6e('0x27')](function(_0x5512d8){if(_0x5512d8&&_0x5512d8[_0xdf6e('0x22')]){return _0x5512d8;}else{var _0x3d865b=_[_0xdf6e('0x31')](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x29')]){var _0x54ba5c={};_0x54ba5c[_0x537aed[_0xdf6e('0x29')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x3d865b[_0xdf6e('0x2b')],_0x54ba5c);}return _0x22b176[_0xdf6e('0x20')](_0xdf6e('0x2c'))[_0xdf6e('0x21')](_0x3d865b,_0x16a3fd)[_0xdf6e('0x27')](function(_0x5284a6){if(_0x5284a6&&_0x5284a6[_0xdf6e('0x22')]){return _0x5284a6;}else{var _0x8a82be=_['cloneDeep'](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x32')]){var _0x1a619e={};_0x1a619e[_0x537aed[_0xdf6e('0x32')]]=_0x127dfb;_['merge'](_0x8a82be['$or'],_0x1a619e);}return _0x22b176['sobject']('Lead')[_0xdf6e('0x21')](_0x8a82be,_0x16a3fd);}});}});case _0xdf6e('0x33'):var _0x489c3b=_[_0xdf6e('0x31')](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x29')]){var _0x146ebe={};_0x146ebe[_0x537aed[_0xdf6e('0x29')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x489c3b['$or'],_0x146ebe);}return _0x22b176[_0xdf6e('0x20')](_0xdf6e('0x2c'))[_0xdf6e('0x21')](_0x489c3b,_0x16a3fd)[_0xdf6e('0x2d')]();case _0xdf6e('0x1c'):var _0x4b275b=_[_0xdf6e('0x31')](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x32')]){var _0x146ebe={};_0x146ebe[_0x537aed[_0xdf6e('0x32')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x4b275b['$or'],_0x146ebe);}return _0x22b176['sobject'](_0xdf6e('0x2e'))[_0xdf6e('0x21')](_0x4b275b,_0x16a3fd);case _0xdf6e('0x16'):var _0x33fe29=_['cloneDeep'](_0x3ec0f9);if(_0x537aed[_0xdf6e('0x30')]){var _0x146ebe={};_0x146ebe[_0x537aed[_0xdf6e('0x30')]]=_0x127dfb;_[_0xdf6e('0x2a')](_0x33fe29[_0xdf6e('0x2b')],_0x146ebe);}return _0x22b176['sobject'](_0xdf6e('0x34'))['find'](_0x33fe29,_0x16a3fd);default:return null;}})[_0xdf6e('0x27')](function(_0x1d4f43){if(_0x1d4f43&&_0x1d4f43['length']){var _0x1a3d51=_[_0xdf6e('0x35')](_0x1d4f43);if(_0x1a3d51){return BPromise[_0xdf6e('0x23')]({'id':_0x1a3d51['Id'],'name':_0x1a3d51[_0xdf6e('0x36')],'phone':_0x1a3d51[_0xdf6e('0x37')],'endUserType':_0x1a3d51[_0xdf6e('0x38')][_0xdf6e('0x39')][_0xdf6e('0x3a')]()});}}})['then'](function(_0x54039a){if(_0x54039a){logger[_0xdf6e('0x1e')](_0xdf6e('0x3b'),_0x54039a['endUserType'],_0x127dfb);return BPromise['resolve'](_0x54039a);}else{logger[_0xdf6e('0x1e')](_0xdf6e('0x3c'),_0x127dfb);var _0x3ba7cb={'Phone':_0x127dfb};if(_0x537aed[_0xdf6e('0x3d')]){if(_0x537aed[_0xdf6e('0x3d')]==='contact'){logger[_0xdf6e('0x1e')](_0xdf6e('0x3e'),_0x127dfb,_0x537aed[_0xdf6e('0x3d')]);_0x3ba7cb[_0xdf6e('0x3f')]=_0x1161bd!==''?_0x1161bd:util[_0xdf6e('0x40')](_0xdf6e('0x41'),_0x127dfb);}else if(_0x537aed['moduleCreate']===_0xdf6e('0x1c')){logger[_0xdf6e('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x127dfb,_0x537aed[_0xdf6e('0x3d')]);_0x3ba7cb[_0xdf6e('0x3f')]=_0x1161bd!==_0xdf6e('0x42')?_0x1161bd:util['format'](_0xdf6e('0x41'),_0x127dfb);_0x3ba7cb['Company']=_0xdf6e('0x43');}else if(_0x537aed[_0xdf6e('0x3d')]==='account'){logger[_0xdf6e('0x1e')](_0xdf6e('0x3e'),_0x127dfb,_0x537aed['moduleCreate']);_0x3ba7cb[_0xdf6e('0x36')]=_0x1161bd!==_0xdf6e('0x42')?_0x1161bd:util[_0xdf6e('0x40')](_0xdf6e('0x41'),_0x127dfb);}else{return null;}}return _0x22b176[_0xdf6e('0x20')](_['upperFirst'](_0x537aed['moduleCreate']))[_0xdf6e('0x44')](_0x3ba7cb)[_0xdf6e('0x27')](function(_0x5e642b){return BPromise['resolve']({'id':_0x5e642b['id'],'endUserType':_0x537aed['moduleCreate']});});}});}function getCustomFields(_0x30ea4f,_0x402beb){var _0xb81709={};if(_0x30ea4f[_0xdf6e('0x22')]>0x0){_[_0xdf6e('0x45')](_0x30ea4f,function(_0x5e0cb1){if(_[_0xdf6e('0x46')]([_0xdf6e('0x47'),_0xdf6e('0x48')],_0x5e0cb1[_0xdf6e('0x39')])&&_0x5e0cb1[_0xdf6e('0x49')]){_0xb81709[_0x5e0cb1[_0xdf6e('0x49')]]=_0x5e0cb1[_0xdf6e('0x4a')][_0xdf6e('0x4b')]();}else if(_0x5e0cb1['type']==='variable'&&_0x5e0cb1[_0xdf6e('0x4c')]&&_0x5e0cb1['idField']){_0x402beb[_0x5e0cb1[_0xdf6e('0x4c')]]&&(_0xb81709[_0x5e0cb1[_0xdf6e('0x49')]]=_0x402beb[_0x5e0cb1[_0xdf6e('0x4c')]][_0xdf6e('0x4b')]());}else if(_0x5e0cb1[_0xdf6e('0x39')]===_0xdf6e('0x4d')&&_0x5e0cb1['Variable']&&_0x5e0cb1[_0xdf6e('0x4e')][_0xdf6e('0x4f')]&&_0x5e0cb1[_0xdf6e('0x49')]){_0x402beb[_0x5e0cb1['Variable'][_0xdf6e('0x4f')][_0xdf6e('0x3a')]()]&&(_0xb81709[_0x5e0cb1[_0xdf6e('0x49')]]=_0x402beb[_0x5e0cb1[_0xdf6e('0x4e')][_0xdf6e('0x4f')][_0xdf6e('0x3a')]()][_0xdf6e('0x4b')]());}});}return _0xb81709;}function getConnection(_0x3e4dff){var _0x15966d=_0x3e4dff[_0xdf6e('0x50')]['concat'](_0x3e4dff[_0xdf6e('0x51')]);var _0x149a6c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3e4dff[_0xdf6e('0x52')]||'https://login.salesforce.com','clientId':_0x3e4dff['clientId'],'clientSecret':_0x3e4dff[_0xdf6e('0x53')]}});return _0x149a6c[_0xdf6e('0x54')](_0x3e4dff[_0xdf6e('0x55')],_0x15966d)[_0xdf6e('0x27')](function(){logger[_0xdf6e('0x1e')](_0xdf6e('0x56'));return _0x149a6c;});}exports['queue']=function(_0x5dc718,_0x21ff3c,_0x58922e,_0x310fdd,_0x3e213a,_0x44bddf){var _0x201955,_0xf7f3d9,_0x2652da,_0x16bb73;_0x44bddf[_0xdf6e('0x57')]=intUtil[_0xdf6e('0x58')](_0x44bddf[_0xdf6e('0x57')]);_0x44bddf[_0xdf6e('0x52')]=intUtil[_0xdf6e('0x58')](_0x44bddf[_0xdf6e('0x52')]);if(_0x3e213a&&_0x3e213a['monitor_format']){logger[_0xdf6e('0x1e')]('[QUEUE]',_0xdf6e('0x59'));_0x21ff3c['recordingURL']=util[_0xdf6e('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44bddf['serverUrl'],_0x21ff3c['uniqueid'],md5(_0x21ff3c['uniqueid']));}else{_0x21ff3c['recordingURL']='';}return getConnection(_0x44bddf)[_0xdf6e('0x27')](function(_0x2a7317){_0x16bb73=_0x2a7317;return getUser(_0x44bddf,_0x310fdd[_0xdf6e('0x5a')],_0x16bb73);})[_0xdf6e('0x27')](function(_0x335dea){_0x201955=_0x335dea;return getEndUser(_0x44bddf,_0x58922e,_0x21ff3c[_0xdf6e('0x5b')],_0x21ff3c[_0xdf6e('0x5c')],_0x16bb73);})['then'](function(_0xf1eac6){_0xf7f3d9=_0xf1eac6;return getTicket(_0x44bddf,_0x201955,_0xf7f3d9,_0x58922e,_0x21ff3c,_0x58922e[_0xdf6e('0x5d')],_0x16bb73,_0xdf6e('0x5e'));})['then'](function(_0x17bd51){_0x2652da=_0x17bd51;logger['info'](_0xdf6e('0x5f'),_0x2652da['id']);logger[_0xdf6e('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2652da['id'],_0x310fdd[_0xdf6e('0x4f')],_0x44bddf[_0xdf6e('0x39')]);switch(_0x44bddf[_0xdf6e('0x39')]){case _0xdf6e('0x60'):emit(util[_0xdf6e('0x40')](_0xdf6e('0x61'),_0x310fdd[_0xdf6e('0x4f')]),_0xdf6e('0x62'),{'recordId':_0x2652da['id']});break;case _0xdf6e('0x63'):emit(util[_0xdf6e('0x40')](_0xdf6e('0x61'),_0x310fdd['name']),_0xdf6e('0x64'),{'uri':util['format'](_0xdf6e('0x65'),_0x16bb73[_0xdf6e('0x66')],_0x2652da['id'])});break;default:logger[_0xdf6e('0x67')](_0xdf6e('0x68'));}})[_0xdf6e('0x69')](function(_0x1de25e){logger[_0xdf6e('0x67')](_0xdf6e('0x6a'),_0x1de25e);});};exports['outbound']=function(_0x41b148,_0x5e7e0c,_0x4c7404,_0x307697,_0x4a54cd,_0x149ff7,_0xff710d){var _0x4cf3b4,_0x15939a,_0x48556f,_0x2fdf08;_0x149ff7[_0xdf6e('0x57')]=intUtil['stripTrailingSlash'](_0x149ff7[_0xdf6e('0x57')]);_0x149ff7[_0xdf6e('0x52')]=intUtil[_0xdf6e('0x58')](_0x149ff7[_0xdf6e('0x52')]);if(_0xff710d&&_0xff710d[_0xdf6e('0x6b')]&&_0xff710d[_0xdf6e('0x6b')]!==_0xdf6e('0x6c')){logger['info']('[OUTBOUND]',_0xdf6e('0x59'));_0x5e7e0c[_0xdf6e('0x6d')]=util['format'](_0xdf6e('0x6e'),_0x149ff7[_0xdf6e('0x57')],_0x5e7e0c[_0xdf6e('0x6f')],md5(_0x5e7e0c[_0xdf6e('0x6f')]));}return getConnection(_0x149ff7)[_0xdf6e('0x27')](function(_0x468207){_0x2fdf08=_0x468207;return getUser(_0x149ff7,_0x307697['email'],_0x2fdf08);})[_0xdf6e('0x27')](function(_0x342bec){_0x4cf3b4=_0x342bec;return getEndUser(_0x149ff7,_0x4c7404,_0x5e7e0c[_0xdf6e('0x70')],_0x5e7e0c[_0xdf6e('0x71')],_0x2fdf08);})[_0xdf6e('0x27')](function(_0x4bc4a0){_0x15939a=_0x4bc4a0;return getTicket(_0x149ff7,_0x4cf3b4,_0x15939a,_0x4c7404,_0x5e7e0c,_0x4c7404[_0xdf6e('0x5d')],_0x2fdf08,_0xdf6e('0x72'));})[_0xdf6e('0x27')](function(_0x1d7040){_0x48556f=_0x1d7040;logger[_0xdf6e('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x48556f['id']);logger[_0xdf6e('0x1e')](_0xdf6e('0x73'),_0x48556f['id'],_0x307697[_0xdf6e('0x4f')],_0x149ff7[_0xdf6e('0x39')]);switch(_0x149ff7['type']){case'integrationTab':emit(util['format'](_0xdf6e('0x61'),_0x307697['name']),'trigger:salesforce:display',{'recordId':_0x48556f['id']});break;case _0xdf6e('0x63'):emit(util[_0xdf6e('0x40')]('user:%s',_0x307697[_0xdf6e('0x4f')]),_0xdf6e('0x64'),{'uri':util[_0xdf6e('0x40')](_0xdf6e('0x65'),_0x2fdf08['instanceUrl'],_0x48556f['id'])});break;default:logger[_0xdf6e('0x67')](_0xdf6e('0x74'),_0xdf6e('0x75'));}})[_0xdf6e('0x69')](function(_0x1ebcba){logger[_0xdf6e('0x67')](_0xdf6e('0x74'),_0x1ebcba);});};exports[_0xdf6e('0x76')]=function(_0x19e5f9,_0x58993c,_0x6d3784,_0x51c84f,_0x443b41,_0x3273ba){var _0x44abb4,_0x1190fc,_0x47f4f9,_0x4d29e6;_0x3273ba[_0xdf6e('0x57')]=intUtil[_0xdf6e('0x58')](_0x3273ba['serverUrl']);_0x3273ba[_0xdf6e('0x52')]=intUtil['stripTrailingSlash'](_0x3273ba[_0xdf6e('0x52')]);if(_0x443b41&&_0x443b41['monitor_format']){logger[_0xdf6e('0x1e')]('['+_0x58993c['lastevent'][_0xdf6e('0x77')]()+']',_0xdf6e('0x59'));_0x58993c['recordingURL']=util['format'](_0xdf6e('0x6e'),_0x3273ba[_0xdf6e('0x57')],_0x58993c[_0xdf6e('0x6f')],md5(_0x58993c['uniqueid']));}else{_0x58993c[_0xdf6e('0x6d')]='';}return getConnection(_0x3273ba)[_0xdf6e('0x27')](function(_0x3b5f57){_0x4d29e6=_0x3b5f57;if(!_[_0xdf6e('0x78')](_0x51c84f)){return getUser(_0x3273ba,_0x51c84f['name'],_0x4d29e6);}else{return getUser(_0x3273ba,null,_0x4d29e6);}})[_0xdf6e('0x27')](function(_0x5b53c9){_0x44abb4=_0x5b53c9;return getEndUser(_0x3273ba,_0x6d3784,_0x58993c['calleridname'],_0x58993c['calleridnum'],_0x4d29e6);})[_0xdf6e('0x27')](function(_0x761fe4){_0x1190fc=_0x761fe4;return getTicket(_0x3273ba,_0x44abb4,_0x1190fc,_0x6d3784,_0x58993c,_0x6d3784[_0xdf6e('0x5d')],_0x4d29e6);})['then'](function(_0x1940a3){_0x47f4f9=_0x1940a3;logger[_0xdf6e('0x1e')]('['+_0x58993c[_0xdf6e('0x79')]['toUpperCase']()+_0xdf6e('0x7a'),_0x47f4f9['id']);logger[_0xdf6e('0x1e')]('['+_0x58993c[_0xdf6e('0x79')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x3273ba[_0xdf6e('0x39')]);})[_0xdf6e('0x69')](function(_0x298f44){logger[_0xdf6e('0x67')]('['+_0x58993c[_0xdf6e('0x79')][_0xdf6e('0x77')]()+']',_0x298f44);});}; \ No newline at end of file +var _0x246e=['customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','isNil','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','validateEmail','sobject','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','cloneDeep','contact','first','Name','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','No\x20Company','upperFirst','includes','picklist','idField','content','variableName'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x246e,0x134));var _0xe246=function(_0x506c40,_0xaa4e4c){_0x506c40=_0x506c40-0x0;var _0x408832=_0x246e[_0x506c40];return _0x408832;};'use strict';var _=require('lodash');var rp=require(_0xe246('0x0'));var moment=require('moment');var BPromise=require(_0xe246('0x1'));var md5=require(_0xe246('0x2'));var jsforce=require(_0xe246('0x3'));var util=require('util');var Redis=require(_0xe246('0x4'));var intUtil=require(_0xe246('0x5'));var config=require(_0xe246('0x6'));var logger=require(_0xe246('0x7'))(_0xe246('0x8'));config[_0xe246('0x9')]=_['defaults'](config[_0xe246('0x9')],{'host':_0xe246('0xa'),'port':0x18eb});var io=require(_0xe246('0xb'))(new Redis(config[_0xe246('0x9')]));function emit(_0x37450f,_0x44cce9,_0xb606f7){io['to'](_0x37450f)[_0xe246('0xc')](_0x44cce9,_0xb606f7);}function getTicket(_0x55cfdb,_0x2bdd5e,_0x54a80b,_0x5d1b67,_0x73dbf4,_0x518bf2,_0xd44674,_0x2820a5){var _0x3b1bcb=Object[_0xe246('0xd')]({},{'OwnerId':_0x2bdd5e['id'],'Subject':intUtil['getString'](_0x5d1b67[_0xe246('0xe')],_0x73dbf4,'\x20'),'Description':intUtil[_0xe246('0xf')](_0x5d1b67[_0xe246('0x10')],_0x73dbf4,'\x0a')},getCustomFields(_0x518bf2,_0x73dbf4));if(_0x54a80b){if(_0x5d1b67[_0xe246('0x11')]===_0xe246('0x12')){_0x3b1bcb['ActivityDate']=moment['utc']();_0x3b1bcb[_0xe246('0x13')]=![];_0x3b1bcb[_0xe246('0x14')]=![];if(_0x54a80b[_0xe246('0x15')]==='contact'||_0x54a80b['endUserType']===_0xe246('0x16')){_0x3b1bcb[_0xe246('0x17')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x18')){_0x3b1bcb[_0xe246('0x19')]=_0x54a80b['id'];}}else if(_0x5d1b67['ticketType']===_0xe246('0x1a')){if(_0x54a80b[_0xe246('0x15')]==='contact'){_0x3b1bcb[_0xe246('0x1b')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x18')){_0x3b1bcb[_0xe246('0x1c')]=_0x54a80b['id'];}else if(_0x54a80b[_0xe246('0x15')]===_0xe246('0x16')&&_0x5d1b67[_0xe246('0x1d')]){_0x3b1bcb[_0x5d1b67[_0xe246('0x1d')]]=_0x54a80b['id'];}else{logger[_0xe246('0x1e')](_0xe246('0x1f'));}}}return _0xd44674['sobject'](_0x5d1b67[_0xe246('0x11')])['create'](_0x3b1bcb);}function getUser(_0x45bd40,_0x185850,_0x1a0707){if(!_['isNil'](_0x185850)&&intUtil[_0xe246('0x20')](_0x185850)){var _0x92d32={'Email':_0x185850};var _0x4c8bbd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a0707[_0xe246('0x21')](_0xe246('0x22'))[_0xe246('0x23')](_0x92d32,_0x4c8bbd)['execute']()[_0xe246('0x24')](function(_0x26fc35){if(_0x26fc35[_0xe246('0x25')]){var _0x540e26=_[_0xe246('0x23')](_0x26fc35,function(_0x547bf4){return _0x547bf4[_0xe246('0x26')]===_0x185850;});if(_0x540e26){logger[_0xe246('0x1e')](_0xe246('0x27'),_0x185850);return BPromise[_0xe246('0x28')]({'id':_0x540e26['Id'],'name':_0x540e26['Name']});}}else{logger[_0xe246('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x185850);return _0x1a0707[_0xe246('0x29')]()[_0xe246('0x24')](function(_0x29da0e){return BPromise['resolve']({'id':_0x29da0e[_0xe246('0x2a')],'name':_0x29da0e['display_name']});});}});}else{logger[_0xe246('0x1e')](_0xe246('0x2b'),_0x185850);return _0x1a0707[_0xe246('0x29')]()['then'](function(_0x48265b){return BPromise['resolve']({'id':_0x48265b[_0xe246('0x2a')],'name':_0x48265b[_0xe246('0x2c')]});});}}function getEndUser(_0x41fc48,_0x299a31,_0x5c737e,_0xb05e18,_0x35bc20){var _0x1d8967={'$or':{'Phone':_0xb05e18}};var _0x36a9cd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe246('0x28')]()[_0xe246('0x24')](function(){logger[_0xe246('0x1e')](_0xe246('0x2d'),_0xb05e18,_0x299a31[_0xe246('0x2e')]);switch(_0x299a31[_0xe246('0x2e')]){case'contact_lead':var _0x40d21b=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x2f')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_['merge'](_0x40d21b[_0xe246('0x30')],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x31'))[_0xe246('0x23')](_0x40d21b,_0x36a9cd)[_0xe246('0x32')]()[_0xe246('0x24')](function(_0x4704e2){if(_0x4704e2&&_0x4704e2[_0xe246('0x25')]){return _0x4704e2;}else{var _0x5c6389=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x33')]){var _0x45b5ae={};_0x45b5ae[_0x299a31['additionalSearchLead']]=_0xb05e18;_[_0xe246('0x34')](_0x5c6389['$or'],_0x45b5ae);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x35'))[_0xe246('0x23')](_0x5c6389,_0x36a9cd);}});case'account_contact_lead':var _0x252e7f=_['cloneDeep'](_0x1d8967);if(_0x299a31['additionalSearchAccount']){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x36')]]=_0xb05e18;_[_0xe246('0x34')](_0x252e7f['$or'],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x37'))['find'](_0x252e7f,_0x36a9cd)[_0xe246('0x32')]()['then'](function(_0x7d7b27){if(_0x7d7b27&&_0x7d7b27[_0xe246('0x25')]){return _0x7d7b27;}else{var _0x3a60fa=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31[_0xe246('0x2f')]){var _0x1f5005={};_0x1f5005[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_[_0xe246('0x34')](_0x3a60fa[_0xe246('0x30')],_0x1f5005);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x31'))[_0xe246('0x23')](_0x3a60fa,_0x36a9cd)[_0xe246('0x24')](function(_0x20401b){if(_0x20401b&&_0x20401b[_0xe246('0x25')]){return _0x20401b;}else{var _0x3b1ded=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31['additionalSearchLead']){var _0x489028={};_0x489028[_0x299a31[_0xe246('0x33')]]=_0xb05e18;_[_0xe246('0x34')](_0x3b1ded[_0xe246('0x30')],_0x489028);}return _0x35bc20[_0xe246('0x21')](_0xe246('0x35'))['find'](_0x3b1ded,_0x36a9cd);}});}});case _0xe246('0x39'):var _0x40d21b=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31['additionalSearchContact']){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x2f')]]=_0xb05e18;_[_0xe246('0x34')](_0x40d21b['$or'],_0x4a1fe9);}return _0x35bc20[_0xe246('0x21')]('Contact')[_0xe246('0x23')](_0x40d21b,_0x36a9cd)[_0xe246('0x32')]();case'lead':var _0x84e839=_[_0xe246('0x38')](_0x1d8967);if(_0x299a31[_0xe246('0x33')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31['additionalSearchLead']]=_0xb05e18;_['merge'](_0x84e839['$or'],_0x4a1fe9);}return _0x35bc20['sobject']('Lead')[_0xe246('0x23')](_0x84e839,_0x36a9cd);case'account':var _0x252e7f=_['cloneDeep'](_0x1d8967);if(_0x299a31[_0xe246('0x36')]){var _0x4a1fe9={};_0x4a1fe9[_0x299a31[_0xe246('0x36')]]=_0xb05e18;_['merge'](_0x252e7f['$or'],_0x4a1fe9);}return _0x35bc20['sobject'](_0xe246('0x37'))[_0xe246('0x23')](_0x252e7f,_0x36a9cd);default:return null;}})['then'](function(_0x304452){if(_0x304452&&_0x304452[_0xe246('0x25')]){var _0x54157d=_[_0xe246('0x3a')](_0x304452);if(_0x54157d){return BPromise[_0xe246('0x28')]({'id':_0x54157d['Id'],'name':_0x54157d[_0xe246('0x3b')],'phone':_0x54157d['Phone'],'endUserType':_0x54157d[_0xe246('0x3c')][_0xe246('0x3d')][_0xe246('0x3e')]()});}}})['then'](function(_0x2ffd2e){if(_0x2ffd2e){logger[_0xe246('0x1e')](_0xe246('0x3f'),_0x2ffd2e[_0xe246('0x15')],_0xb05e18);return BPromise['resolve'](_0x2ffd2e);}else{logger[_0xe246('0x1e')](_0xe246('0x40'),_0xb05e18);var _0x25d94d={'Phone':_0xb05e18};if(_0x299a31[_0xe246('0x41')]){if(_0x299a31[_0xe246('0x41')]===_0xe246('0x39')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x43')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util[_0xe246('0x45')](_0xe246('0x46'),_0xb05e18);}else if(_0x299a31['moduleCreate']===_0xe246('0x16')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x43')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util['format'](_0xe246('0x46'),_0xb05e18);_0x25d94d[_0xe246('0x47')]=_0xe246('0x48');}else if(_0x299a31['moduleCreate']===_0xe246('0x18')){logger[_0xe246('0x1e')](_0xe246('0x42'),_0xb05e18,_0x299a31[_0xe246('0x41')]);_0x25d94d[_0xe246('0x3b')]=_0x5c737e!==_0xe246('0x44')?_0x5c737e:util[_0xe246('0x45')](_0xe246('0x46'),_0xb05e18);}else{return null;}}return _0x35bc20[_0xe246('0x21')](_[_0xe246('0x49')](_0x299a31[_0xe246('0x41')]))['create'](_0x25d94d)[_0xe246('0x24')](function(_0x42d240){return BPromise[_0xe246('0x28')]({'id':_0x42d240['id'],'endUserType':_0x299a31[_0xe246('0x41')]});});}});}function getCustomFields(_0xe3eaa4,_0x4eb86d){var _0x2b7a26={};if(_0xe3eaa4[_0xe246('0x25')]>0x0){_['forEach'](_0xe3eaa4,function(_0x329bde){if(_[_0xe246('0x4a')](['string',_0xe246('0x4b')],_0x329bde[_0xe246('0x3d')])&&_0x329bde[_0xe246('0x4c')]){_0x2b7a26[_0x329bde[_0xe246('0x4c')]]=_0x329bde[_0xe246('0x4d')]['toString']();}else if(_0x329bde[_0xe246('0x3d')]==='variable'&&_0x329bde[_0xe246('0x4e')]&&_0x329bde['idField']){_0x4eb86d[_0x329bde[_0xe246('0x4e')]]&&(_0x2b7a26[_0x329bde[_0xe246('0x4c')]]=_0x4eb86d[_0x329bde[_0xe246('0x4e')]]['toString']());}else if(_0x329bde[_0xe246('0x3d')]===_0xe246('0x4f')&&_0x329bde[_0xe246('0x50')]&&_0x329bde['Variable'][_0xe246('0x51')]&&_0x329bde[_0xe246('0x4c')]){_0x4eb86d[_0x329bde[_0xe246('0x50')][_0xe246('0x51')]['toLowerCase']()]&&(_0x2b7a26[_0x329bde['idField']]=_0x4eb86d[_0x329bde[_0xe246('0x50')]['name'][_0xe246('0x3e')]()]['toString']());}});}return _0x2b7a26;}function getConnection(_0xd7024e){var _0x5ccc18=_0xd7024e[_0xe246('0x52')][_0xe246('0x53')](_0xd7024e['securityToken']);var _0x1eab08=new jsforce[(_0xe246('0x54'))]({'oauth2':{'loginUrl':_0xd7024e[_0xe246('0x55')]||_0xe246('0x56'),'clientId':_0xd7024e[_0xe246('0x57')],'clientSecret':_0xd7024e[_0xe246('0x58')]}});return _0x1eab08[_0xe246('0x59')](_0xd7024e[_0xe246('0x5a')],_0x5ccc18)['then'](function(){logger[_0xe246('0x1e')](_0xe246('0x5b'));return _0x1eab08;});}exports['queue']=function(_0x34f737,_0x1fbf86,_0x34ce11,_0x10435e,_0x50ab69,_0x3a6ac4){var _0x15d665,_0x1b2788,_0x19429f,_0x333c8f;_0x3a6ac4[_0xe246('0x5c')]=intUtil[_0xe246('0x5d')](_0x3a6ac4[_0xe246('0x5c')]);_0x3a6ac4[_0xe246('0x55')]=intUtil[_0xe246('0x5d')](_0x3a6ac4[_0xe246('0x55')]);if(_0x50ab69&&_0x50ab69['monitor_format']){logger['info'](_0xe246('0x5e'),_0xe246('0x5f'));_0x1fbf86[_0xe246('0x60')]=util['format'](_0xe246('0x61'),_0x3a6ac4[_0xe246('0x5c')],_0x1fbf86[_0xe246('0x62')],md5(_0x1fbf86[_0xe246('0x62')]));}else{_0x1fbf86[_0xe246('0x60')]='';}return getConnection(_0x3a6ac4)[_0xe246('0x24')](function(_0x97b74c){_0x333c8f=_0x97b74c;return getUser(_0x3a6ac4,_0x10435e['email'],_0x333c8f);})[_0xe246('0x24')](function(_0x4f7a02){_0x15d665=_0x4f7a02;return getEndUser(_0x3a6ac4,_0x34ce11,_0x1fbf86[_0xe246('0x63')],_0x1fbf86[_0xe246('0x64')],_0x333c8f);})[_0xe246('0x24')](function(_0x28b824){_0x1b2788=_0x28b824;return getTicket(_0x3a6ac4,_0x15d665,_0x1b2788,_0x34ce11,_0x1fbf86,_0x34ce11['Fields'],_0x333c8f,_0xe246('0x65'));})[_0xe246('0x24')](function(_0x4ec902){_0x19429f=_0x4ec902;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x19429f['id']);logger[_0xe246('0x1e')](_0xe246('0x66'),_0x19429f['id'],_0x10435e[_0xe246('0x51')],_0x3a6ac4[_0xe246('0x3d')]);switch(_0x3a6ac4[_0xe246('0x3d')]){case _0xe246('0x67'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x10435e[_0xe246('0x51')]),_0xe246('0x69'),{'recordId':_0x19429f['id']});break;case _0xe246('0x6a'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x10435e['name']),_0xe246('0x6b'),{'uri':util[_0xe246('0x45')]('%s/%s/e',_0x333c8f[_0xe246('0x6c')],_0x19429f['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5c9824){logger[_0xe246('0x6d')](_0xe246('0x5e'),_0x5c9824);});};exports[_0xe246('0x6e')]=function(_0x43b628,_0x1923be,_0x13bd5e,_0x1cb71c,_0x24eec4,_0x64d277,_0x4be172){var _0x30de20,_0x16c073,_0x1a92ac,_0x1820a1;_0x64d277[_0xe246('0x5c')]=intUtil['stripTrailingSlash'](_0x64d277[_0xe246('0x5c')]);_0x64d277[_0xe246('0x55')]=intUtil[_0xe246('0x5d')](_0x64d277[_0xe246('0x55')]);if(_0x4be172&&_0x4be172['recordingFormat']&&_0x4be172['recordingFormat']!==_0xe246('0x6f')){logger[_0xe246('0x1e')](_0xe246('0x70'),_0xe246('0x5f'));_0x1923be[_0xe246('0x60')]=util[_0xe246('0x45')](_0xe246('0x61'),_0x64d277['serverUrl'],_0x1923be[_0xe246('0x62')],md5(_0x1923be['uniqueid']));}return getConnection(_0x64d277)[_0xe246('0x24')](function(_0x4ee755){_0x1820a1=_0x4ee755;return getUser(_0x64d277,_0x1cb71c[_0xe246('0x71')],_0x1820a1);})[_0xe246('0x24')](function(_0x59d78c){_0x30de20=_0x59d78c;return getEndUser(_0x64d277,_0x13bd5e,_0x1923be[_0xe246('0x72')],_0x1923be[_0xe246('0x73')],_0x1820a1);})[_0xe246('0x24')](function(_0x46e5e0){_0x16c073=_0x46e5e0;return getTicket(_0x64d277,_0x30de20,_0x16c073,_0x13bd5e,_0x1923be,_0x13bd5e[_0xe246('0x74')],_0x1820a1,_0xe246('0x6e'));})[_0xe246('0x24')](function(_0x4e018f){_0x1a92ac=_0x4e018f;logger[_0xe246('0x1e')](_0xe246('0x75'),_0x1a92ac['id']);logger[_0xe246('0x1e')](_0xe246('0x76'),_0x1a92ac['id'],_0x1cb71c['name'],_0x64d277['type']);switch(_0x64d277[_0xe246('0x3d')]){case _0xe246('0x67'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x1cb71c['name']),_0xe246('0x69'),{'recordId':_0x1a92ac['id']});break;case _0xe246('0x6a'):emit(util[_0xe246('0x45')](_0xe246('0x68'),_0x1cb71c['name']),_0xe246('0x6b'),{'uri':util['format'](_0xe246('0x77'),_0x1820a1[_0xe246('0x6c')],_0x1a92ac['id'])});break;default:logger['error'](_0xe246('0x70'),_0xe246('0x78'));}})[_0xe246('0x79')](function(_0x4a7fec){logger[_0xe246('0x6d')](_0xe246('0x70'),_0x4a7fec);});};exports[_0xe246('0x7a')]=function(_0x5bea84,_0xdb309c,_0xcef577,_0x369a0c,_0x5a047d,_0x4fe7ae){var _0x2fa3af,_0xaf37e7,_0x4894eb,_0x1b4f89;_0x4fe7ae[_0xe246('0x5c')]=intUtil[_0xe246('0x5d')](_0x4fe7ae[_0xe246('0x5c')]);_0x4fe7ae['remoteUri']=intUtil[_0xe246('0x5d')](_0x4fe7ae[_0xe246('0x55')]);if(_0x5a047d&&_0x5a047d[_0xe246('0x7b')]){logger[_0xe246('0x1e')]('['+_0xdb309c[_0xe246('0x7c')]['toUpperCase']()+']',_0xe246('0x5f'));_0xdb309c[_0xe246('0x60')]=util[_0xe246('0x45')](_0xe246('0x61'),_0x4fe7ae[_0xe246('0x5c')],_0xdb309c[_0xe246('0x62')],md5(_0xdb309c[_0xe246('0x62')]));}else{_0xdb309c['recordingURL']='';}return getConnection(_0x4fe7ae)[_0xe246('0x24')](function(_0x19eae6){_0x1b4f89=_0x19eae6;if(!_[_0xe246('0x7d')](_0x369a0c)){return getUser(_0x4fe7ae,_0x369a0c[_0xe246('0x51')],_0x1b4f89);}else{return getUser(_0x4fe7ae,null,_0x1b4f89);}})[_0xe246('0x24')](function(_0x5ecd13){_0x2fa3af=_0x5ecd13;return getEndUser(_0x4fe7ae,_0xcef577,_0xdb309c['calleridname'],_0xdb309c[_0xe246('0x64')],_0x1b4f89);})[_0xe246('0x24')](function(_0x2bc26a){_0xaf37e7=_0x2bc26a;return getTicket(_0x4fe7ae,_0x2fa3af,_0xaf37e7,_0xcef577,_0xdb309c,_0xcef577[_0xe246('0x74')],_0x1b4f89);})[_0xe246('0x24')](function(_0x4504b7){_0x4894eb=_0x4504b7;logger[_0xe246('0x1e')]('['+_0xdb309c[_0xe246('0x7c')][_0xe246('0x7e')]()+_0xe246('0x7f'),_0x4894eb['id']);logger[_0xe246('0x1e')]('['+_0xdb309c['lastevent'][_0xe246('0x7e')]()+_0xe246('0x80'),_0x4fe7ae[_0xe246('0x3d')]);})[_0xe246('0x79')](function(_0x31958d){logger['error']('['+_0xdb309c[_0xe246('0x7c')][_0xe246('0x7e')]()+']',_0x31958d);});}; \ 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 abe393a..8ac2468 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 _0xdb7a=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','variable','variableName','idField','customField','type','Variable','name',']\x20getTicket\x20input\x20crm','outbound','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','push'];(function(_0x7a5cc0,_0x324e0f){var _0x4d3e32=function(_0xc228da){while(--_0xc228da){_0x7a5cc0['push'](_0x7a5cc0['shift']());}};_0x4d3e32(++_0x324e0f);}(_0xdb7a,0x16a));var _0xadb7=function(_0x82be47,_0x18e395){_0x82be47=_0x82be47-0x0;var _0x2e7fe9=_0xdb7a[_0x82be47];return _0x2e7fe9;};'use strict';var _=require(_0xadb7('0x0'));var Promise=require(_0xadb7('0x1'));var rp=require('request-promise');var util=require(_0xadb7('0x2'));var md5=require(_0xadb7('0x3'));var Redis=require(_0xadb7('0x4'));var intUtil=require(_0xadb7('0x5'));var config=require(_0xadb7('0x6'));var logger=require(_0xadb7('0x7'))(_0xadb7('0x8'));config[_0xadb7('0x9')]=_[_0xadb7('0xa')](config['redis'],{'host':_0xadb7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x2705bf,_0x41b26b,_0x1f0042,_0x15ab2b,_0x56abb7,_0x4d152d){return new Promise(function(_0x2c3053,_0x10caa2){var _0x440cba={'method':_0xadb7('0xc'),'uri':_0x15ab2b+_0xadb7('0xd')+'&'+_0x56abb7+'&'+_0x4d152d,'auth':_0x41b26b,'json':!![]};return rp(_0x440cba)[_0xadb7('0xe')](function(_0x38c15c){if(_0x38c15c[_0xadb7('0xf')][_0xadb7('0x10')]>0x0){_0x1f0042[_0xadb7('0x11')]=_0x38c15c[_0xadb7('0xf')][0x0][_0xadb7('0x12')];}logger['info']('['+[_0x2705bf[_0xadb7('0x13')]()]+'],\x20getAdminUser\x20crm',_0x1f0042);_0x2c3053(_0x1f0042);})[_0xadb7('0x14')](function(_0x537ce1){logger['error']('['+[_0x2705bf['toUpperCase']()]+']',_0x537ce1[_0xadb7('0x15')]);_0x10caa2(_0x537ce1['message']);});});}function getUser(_0x22611f,_0x3ac35e,_0x3529e0,_0xf38010,_0x3ddf51){return function(_0xaa9aef){logger[_0xadb7('0x16')]('['+[_0x22611f['toUpperCase']()]+_0xadb7('0x17'),_0xaa9aef);return new Promise(function(_0xd7fd37,_0x27b9ac){if(intUtil[_0xadb7('0x18')](_0xaa9aef['userEmail'])){var _0x5e0488={'method':_0xadb7('0xc'),'uri':_0x3529e0+'sys_user?sysparm_query=email%3D'+_0xaa9aef[_0xadb7('0x19')]+'&'+_0xf38010+'&'+_0x3ddf51,'auth':_0x3ac35e,'json':!![]};logger[_0xadb7('0x16')]('['+[_0x22611f[_0xadb7('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x5e0488);return rp(_0x5e0488)['then'](function(_0x45ab29){logger[_0xadb7('0x16')]('['+[_0x22611f[_0xadb7('0x13')]()]+'],\x20getUser\x20entity',_0x45ab29);if(_0x45ab29['result']['length']>0x0&&String(_0x45ab29['result'][0x0][_0xadb7('0x1a')])===_0xadb7('0x1b')){_0xaa9aef[_0xadb7('0x1c')]=_0x45ab29['result'][0x0][_0xadb7('0x12')];}else{_0xaa9aef[_0xadb7('0x1c')]=_0xaa9aef[_0xadb7('0x11')];_0xaa9aef['userEmail']=_0xaa9aef[_0xadb7('0x1d')];}logger[_0xadb7('0x16')]('['+[_0x22611f['toUpperCase']()]+_0xadb7('0x1e'),_0xaa9aef);_0xd7fd37(_0xaa9aef);})[_0xadb7('0x14')](function(_0x11ed5b){logger[_0xadb7('0x1f')]('['+[_0x22611f[_0xadb7('0x13')]()]+']',_0x11ed5b[_0xadb7('0x15')]);_0x27b9ac(_0x11ed5b['message']);});}else{logger[_0xadb7('0x16')]('['+[_0x22611f['toUpperCase']()]+_0xadb7('0x20'));_0xaa9aef[_0xadb7('0x1c')]=_0xaa9aef[_0xadb7('0x11')];_0xaa9aef[_0xadb7('0x19')]=_0xaa9aef[_0xadb7('0x1d')];_0xd7fd37(_0xaa9aef);}});};}function createEndUser(_0x4a796f,_0x1dfb0b,_0x1b4d42,_0x2621e7,_0x49f222){logger[_0xadb7('0x16')]('['+[_0x4a796f['toUpperCase']()]+_0xadb7('0x21'),_0x1b4d42);return new Promise(function(_0x3f7a98,_0x5caa81){var _0xae1cae={'method':_0xadb7('0x22'),'uri':_0x2621e7+_0xadb7('0x23')+_0x49f222,'body':{'user_name':_0x1b4d42[_0xadb7('0x24')],'roles':'user','first_name':_0x1b4d42[_0xadb7('0x24')],'active':'true','date_format':_0xadb7('0x25'),'phone':_0x1b4d42[_0xadb7('0x24')]},'auth':_0x1dfb0b,'json':!![]};return rp(_0xae1cae)[_0xadb7('0xe')](function(_0x405cba){logger[_0xadb7('0x16')]('['+[_0x4a796f[_0xadb7('0x13')]()]+_0xadb7('0x26'),_0x405cba['result']);_0x1b4d42[_0xadb7('0x27')]=_0x405cba['result'][_0xadb7('0x12')];_0x3f7a98(_0x1b4d42);})[_0xadb7('0x14')](function(_0xa51f1b){logger[_0xadb7('0x1f')]('['+[_0x4a796f[_0xadb7('0x13')]()]+']',_0xa51f1b[_0xadb7('0x15')]);_0x5caa81(_0xa51f1b[_0xadb7('0x15')]);});});}function getEndUser(_0x252925,_0x3aaf61,_0x534958,_0x1bed06,_0x42f51b){return function(_0x2467d6){logger[_0xadb7('0x16')]('['+[_0x252925[_0xadb7('0x13')]()]+_0xadb7('0x28'),_0x2467d6);return new Promise(function(_0x56b262,_0x423ad9){var _0x459789={'method':_0xadb7('0xc'),'uri':_0x534958+_0xadb7('0x29')+_0x2467d6[_0xadb7('0x24')]+'&'+_0x1bed06+'&'+_0x42f51b,'auth':_0x3aaf61,'json':!![]};return rp(_0x459789)['then'](function(_0x4215b2){if(_0x4215b2[_0xadb7('0xf')][_0xadb7('0x10')]>0x0){_0x2467d6[_0xadb7('0x27')]=_0x4215b2[_0xadb7('0xf')][0x0][_0xadb7('0x12')];logger['info']('['+[_0x252925[_0xadb7('0x13')]()]+'],\x20getEndUser\x20crm',_0x2467d6);_0x56b262(_0x2467d6);}else{return createEndUser(_0x252925,_0x3aaf61,_0x2467d6,_0x534958,_0x1bed06)[_0xadb7('0xe')](function(_0xae549d){logger['info']('['+[_0x252925[_0xadb7('0x13')]()]+_0xadb7('0x2a'),_0xae549d);_0x56b262(_0xae549d);});}})[_0xadb7('0x14')](function(_0x7cce89){logger[_0xadb7('0x1f')]('['+[_0x252925[_0xadb7('0x13')]()]+']',_0x7cce89[_0xadb7('0x15')]);_0x423ad9(_0x7cce89['message']);});});};}function getCustomFields(_0x584c0e,_0x5d8ea8){var _0x451621={};if(_0x584c0e[_0xadb7('0x10')]>0x0){_[_0xadb7('0x2b')](_0x584c0e,function(_0x5bb225){if(_[_0xadb7('0x2c')]([_0xadb7('0x2d'),_0xadb7('0x2e')],_0x5bb225['type'])&&_0x5bb225[_0xadb7('0x2f')]&&!_0x5bb225['customField']){_0x451621[_0x5bb225['nameField'][_0xadb7('0x30')]()]=_0x5bb225[_0xadb7('0x31')][_0xadb7('0x32')]();}else if(_[_0xadb7('0x2c')](['string',_0xadb7('0x2e')],_0x5bb225['type'])&&_0x5bb225['idField']&&_0x5bb225['customField']){_0x451621[_0x5bb225['idField'][_0xadb7('0x30')]()]=_0x5bb225['content']['toString']();}else if(_0x5bb225['type']===_0xadb7('0x33')&&_0x5bb225[_0xadb7('0x34')]&&_0x5bb225[_0xadb7('0x35')]&&_0x5bb225[_0xadb7('0x36')]){_0x451621[_0x5bb225[_0xadb7('0x35')]['toLowerCase']()]=_0x5d8ea8[_0x5bb225[_0xadb7('0x34')]][_0xadb7('0x32')]();}else if(_0x5bb225[_0xadb7('0x37')]==='customVariable'&&_0x5bb225[_0xadb7('0x38')]&&_0x5bb225['Variable'][_0xadb7('0x39')]&&_0x5bb225[_0xadb7('0x35')]&&_0x5bb225['customField']){_0x451621[_0x5bb225[_0xadb7('0x35')][_0xadb7('0x30')]()]=_0x5d8ea8[_0x5bb225[_0xadb7('0x38')][_0xadb7('0x39')]['toLowerCase']()][_0xadb7('0x32')]();}});}return _0x451621;}function getTicket(_0x41b074,_0x450e02,_0x4d2b3e,_0x5525d2,_0x21461b,_0x2d07b1){return function(_0x83d69d){logger[_0xadb7('0x16')]('['+[_0x41b074[_0xadb7('0x13')]()]+_0xadb7('0x3a'),_0x83d69d);return new Promise(function(_0x2b5a2e,_0x33fb97){var _0x22ac66=_0x41b074[_0xadb7('0x30')]()===_0xadb7('0x3b')?_0x83d69d[_0xadb7('0x1c')]:_0x83d69d[_0xadb7('0x27')];var _0xff444f={'method':_0xadb7('0x22'),'uri':_0x4d2b3e+'incident'+'?'+_0x2d07b1,'body':Object['assign']({},{'active':_0xadb7('0x1b'),'caller_id':_0x22ac66,'assigned_to':_0x83d69d[_0xadb7('0x1c')],'short_description':intUtil['getString'](_0x5525d2[_0xadb7('0x3c')],_0x21461b,'\x20'),'description':intUtil[_0xadb7('0x3d')](_0x5525d2[_0xadb7('0x3e')],_0x21461b,'\x0a')},getCustomFields(_0x5525d2[_0xadb7('0x3f')],_0x21461b)),'auth':_0x450e02,'json':!![]};return rp(_0xff444f)[_0xadb7('0xe')](function(_0x1cdbb3){logger['info']('['+[_0x41b074[_0xadb7('0x13')]()]+_0xadb7('0x40'),_0x1cdbb3[_0xadb7('0xf')]);_0x83d69d[_0xadb7('0x41')]=_0x1cdbb3['result'][_0xadb7('0x12')];_0x83d69d['ticketNumber']=_0x1cdbb3[_0xadb7('0xf')][_0xadb7('0x42')];logger[_0xadb7('0x16')]('['+[_0x41b074[_0xadb7('0x13')]()]+_0xadb7('0x43'),_0x83d69d);_0x2b5a2e(_0x83d69d);})[_0xadb7('0x14')](function(_0x2c2d67){logger[_0xadb7('0x1f')]('['+[_0x41b074[_0xadb7('0x13')]()]+']',_0x2c2d67[_0xadb7('0x15')]);_0x33fb97(_0x2c2d67[_0xadb7('0x15')]);});});};}function createRemoteTag(_0x31560b,_0x89d71,_0x17f09b,_0x36f5d4){return new Promise(function(_0x3e09a6,_0x32f3a0){var _0x5ec408={'method':_0xadb7('0x22'),'uri':_0x17f09b+'label'+'?'+_0x36f5d4,'body':{'short_description':_0x31560b,'global':!![],'active':!![],'name':_0x31560b},'auth':_0x89d71,'json':!![]};return rp(_0x5ec408)[_0xadb7('0xe')](function(_0x4ee038){var _0x285107=_0x4ee038[_0xadb7('0xf')][_0xadb7('0x12')];_0x3e09a6(_0x285107);});});}function getRemoteTag(_0x26866c,_0x1dd226,_0x28a369,_0xb93ab9,_0x5cb04e){return new Promise(function(_0x3d5f47,_0x40fa1d){var _0x3a7466={'method':_0xadb7('0xc'),'uri':_0x28a369+_0xadb7('0x44')+_0xadb7('0x45')+_0x26866c+'&'+_0xb93ab9,'auth':_0x1dd226,'json':!![]};return rp(_0x3a7466)[_0xadb7('0xe')](function(_0x50d068){if(_0x50d068['result'][_0xadb7('0x10')]>0x0){var _0x4e4026=_0x50d068[_0xadb7('0xf')][0x0][_0xadb7('0x12')];_0x3d5f47(_0x4e4026);}else{return createRemoteTag(_0x26866c,_0x1dd226,_0x28a369,_0xb93ab9)[_0xadb7('0xe')](function(_0x2dec07){_0x3d5f47(_0x2dec07);});}});});}function assignTagToIncident(_0x454087,_0xbfc823,_0x372de7,_0x37647c,_0x5ce2d9){return new Promise(function(_0x7c7bbc,_0x409b16){var _0x394470={'method':_0xadb7('0x22'),'uri':_0x372de7+'label_entry'+'?'+_0x5ce2d9,'body':{'label':_0x454087,'table':'incident','id_type':_0xadb7('0x46'),'table_key':_0x37647c['ticketId'],'title':_0xadb7('0x47')+_0x37647c[_0xadb7('0x48')],'id_display':_0x37647c['ticketNumber']},'auth':_0xbfc823,'json':!![]};return rp(_0x394470)[_0xadb7('0xe')](function(_0x4bf4b5){_0x7c7bbc();})[_0xadb7('0x14')](function(){_0x7c7bbc();});});}function manageTags(_0x399d58,_0x2b38fc,_0x2a7f5c,_0x1b9f85,_0x97650c,_0x1b5e57,_0x294b11){return new Promise(function(_0x584400,_0x329791){var _0x592191=[];_0x2b38fc[_0xadb7('0x2b')](function(_0x5017e7){_0x592191[_0xadb7('0x49')](getRemoteTag(_0x5017e7,_0x2a7f5c,_0x1b9f85,_0x1b5e57,_0x294b11));});return Promise[_0xadb7('0x4a')](_0x592191)[_0xadb7('0xe')](function(_0x34a5f3){if(_0x34a5f3[_0xadb7('0x10')]){logger[_0xadb7('0x16')]('['+[_0x399d58[_0xadb7('0x13')]()]+_0xadb7('0x4b'),_0x34a5f3);var _0x26cbaf=[];_0x34a5f3[_0xadb7('0x2b')](function(_0x49ce14){_0x26cbaf['push'](assignTagToIncident(_0x49ce14,_0x2a7f5c,_0x1b9f85,_0x97650c,_0x1b5e57));});return Promise[_0xadb7('0x4a')](_0x26cbaf)[_0xadb7('0xe')](function(){_0x584400();})['catch'](function(){_0x584400();});}else{_0x584400();}});});}function getTags(_0x301fb4,_0x1a8e99,_0xbb0412,_0x506bea,_0x18b5f1,_0x34aeef){return function(_0x2f7da3){return new Promise(function(_0x5844dd,_0x551ef5){var _0x404716=[];var _0x1bd5fd=_0x506bea[_0xadb7('0x4c')];if(_0x1bd5fd&&_0x1bd5fd[_0xadb7('0x10')]>0x0){_0x404716=_[_0xadb7('0x4d')](_0x1bd5fd,_0xadb7('0x39'));}if(_0x404716[_0xadb7('0x10')]>0x0){return manageTags(_0x301fb4,_0x404716,_0x1a8e99,_0xbb0412,_0x2f7da3,_0x18b5f1,_0x34aeef)['then'](function(){_0x5844dd(_0x2f7da3);});}else{_0x5844dd(_0x2f7da3);}});};}function emit(_0x5622ff,_0x30c7a3,_0x4c1ed2){var _0x376a56=_0xadb7('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xadb7('0x4f')+_0xadb7('0x50');var _0x10cb31={'uri':_0x5622ff+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4c1ed2+_0x376a56};io['to'](util[_0xadb7('0x51')](_0xadb7('0x52'),_0x30c7a3))[_0xadb7('0x53')](_0xadb7('0x54'),_0x10cb31);}exports['cs']=function(_0x5bc682,_0x9ff42,_0x195833,_0x131863,_0x11a2ef,_0x3fa008,_0x227945,_0x2a2743){var _0x20015d={};var _0x56ed18={'user':_0x3fa008[_0xadb7('0x55')],'pass':_0x3fa008[_0xadb7('0x56')]};var _0x1f5d8d=_0xadb7('0x57');var _0x371731=_0xadb7('0x58');_0x3fa008[_0xadb7('0x59')]=intUtil[_0xadb7('0x5a')](_0x3fa008[_0xadb7('0x59')]);_0x3fa008[_0xadb7('0x5b')]=intUtil['stripTrailingSlash'](_0x3fa008[_0xadb7('0x5b')]);var _0xd21bda=util[_0xadb7('0x51')](_0xadb7('0x5c'),_0x3fa008[_0xadb7('0x59')]);_0x20015d[_0xadb7('0x19')]=!_['isNil'](_0x131863)?_0x131863[_0xadb7('0x5d')]:null;_0x20015d[_0xadb7('0x1d')]=_0x3fa008[_0xadb7('0x5d')];_0x20015d[_0xadb7('0x24')]=_0x2a2743[_0xadb7('0x30')]()===_0xadb7('0x3b')?_0x9ff42['destcalleridnum']:_0x9ff42[_0xadb7('0x5e')];_0x20015d[_0xadb7('0x5f')]=_0x2a2743===_0xadb7('0x60')||_0x2a2743===_0xadb7('0x61')?_0xadb7('0x60'):'outbound';var _0xbaac6b=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3fa008[_0xadb7('0x5b')],_0x9ff42[_0xadb7('0x62')],md5(_0x9ff42[_0xadb7('0x62')]));if(_0x11a2ef&&_0x11a2ef['monitor_format']){logger[_0xadb7('0x16')](_0xadb7('0x63'),_0xadb7('0x64'));_0x9ff42[_0xadb7('0x65')]=_0xbaac6b;}else if(_0x227945&&_0x227945[_0xadb7('0x66')]&&_0x227945[_0xadb7('0x66')]!==_0xadb7('0x67')){logger[_0xadb7('0x16')](_0xadb7('0x68'),_0xadb7('0x64'));_0x9ff42['recordingURL']=_0xbaac6b;}else{_0x9ff42[_0xadb7('0x65')]='';}return getAdminUser(_0x2a2743,_0x56ed18,_0x20015d,_0xd21bda,_0x371731,_0x1f5d8d)[_0xadb7('0xe')](getUser(_0x2a2743,_0x56ed18,_0xd21bda,_0x371731,_0x1f5d8d))[_0xadb7('0xe')](getEndUser(_0x2a2743,_0x56ed18,_0xd21bda,_0x371731,_0x1f5d8d))[_0xadb7('0xe')](getTicket(_0x2a2743,_0x56ed18,_0xd21bda,_0x195833,_0x9ff42,_0x371731))[_0xadb7('0xe')](function(_0x2d8f4c){logger[_0xadb7('0x16')](util[_0xadb7('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2d8f4c[_0xadb7('0x41')]));logger[_0xadb7('0x16')](util[_0xadb7('0x51')](_0xadb7('0x69'),_0x2a2743));if(_0x2a2743!==_0xadb7('0x61')){logger['info']('['+[_0x2a2743['toUpperCase']()]+']',_0xadb7('0x6a'));emit(_0x3fa008[_0xadb7('0x59')],_0x131863[_0xadb7('0x39')],_0x2d8f4c[_0xadb7('0x41')]);}})[_0xadb7('0x14')](function(_0x485e4e){logger[_0xadb7('0x1f')]('['+[_0x2a2743[_0xadb7('0x13')]()]+_0xadb7('0x6b'),util[_0xadb7('0x6c')](_0x485e4e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4780=['true','userId','userEmail','adminEmail','],\x20getUser\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','error','forEach','includes','string','picklist','nameField','customField','content','toString','type','variable','variableName','idField','customVariable','Variable','name','toLowerCase',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all','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','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active'];(function(_0x4b5290,_0xda09be){var _0x1342ac=function(_0x778062){while(--_0x778062){_0x4b5290['push'](_0x4b5290['shift']());}};_0x1342ac(++_0xda09be);}(_0x4780,0xbe));var _0x0478=function(_0x19d69c,_0x1619c2){_0x19d69c=_0x19d69c-0x0;var _0x2a3272=_0x4780[_0x19d69c];return _0x2a3272;};'use strict';var _=require(_0x0478('0x0'));var Promise=require(_0x0478('0x1'));var rp=require('request-promise');var util=require(_0x0478('0x2'));var md5=require(_0x0478('0x3'));var Redis=require('ioredis');var intUtil=require(_0x0478('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0478('0x5'))(_0x0478('0x6'));config[_0x0478('0x7')]=_[_0x0478('0x8')](config[_0x0478('0x7')],{'host':_0x0478('0x9'),'port':0x18eb});var io=require(_0x0478('0xa'))(new Redis(config['redis']));function getAdminUser(_0x240b4b,_0x52a056,_0x1ed3e4,_0x21f74,_0x22aa1b,_0x359739){return new Promise(function(_0x4f9a8f,_0x487a32){var _0x496ef7={'method':_0x0478('0xb'),'uri':_0x21f74+_0x0478('0xc')+'&'+_0x22aa1b+'&'+_0x359739,'auth':_0x52a056,'json':!![]};return rp(_0x496ef7)[_0x0478('0xd')](function(_0x5418db){if(_0x5418db['result']['length']>0x0){_0x1ed3e4[_0x0478('0xe')]=_0x5418db[_0x0478('0xf')][0x0][_0x0478('0x10')];}logger[_0x0478('0x11')]('['+[_0x240b4b['toUpperCase']()]+_0x0478('0x12'),_0x1ed3e4);_0x4f9a8f(_0x1ed3e4);})[_0x0478('0x13')](function(_0x1bd52f){logger['error']('['+[_0x240b4b[_0x0478('0x14')]()]+']',_0x1bd52f[_0x0478('0x15')]);_0x487a32(_0x1bd52f[_0x0478('0x15')]);});});}function getUser(_0x474aa9,_0x22e7d4,_0x195a9f,_0x210c49,_0x1a0e1e){return function(_0x56659a){logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x16'),_0x56659a);return new Promise(function(_0x16f49e,_0x2cb597){if(intUtil[_0x0478('0x17')](_0x56659a['userEmail'])){var _0x21a42c={'method':_0x0478('0xb'),'uri':_0x195a9f+'sys_user?sysparm_query=email%3D'+_0x56659a['userEmail']+'&'+_0x210c49+'&'+_0x1a0e1e,'auth':_0x22e7d4,'json':!![]};logger[_0x0478('0x11')]('['+[_0x474aa9['toUpperCase']()]+_0x0478('0x18'),_0x21a42c);return rp(_0x21a42c)['then'](function(_0x511255){logger['info']('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x19'),_0x511255);if(_0x511255[_0x0478('0xf')][_0x0478('0x1a')]>0x0&&String(_0x511255[_0x0478('0xf')][0x0][_0x0478('0x1b')])===_0x0478('0x1c')){_0x56659a[_0x0478('0x1d')]=_0x511255[_0x0478('0xf')][0x0]['sys_id'];}else{_0x56659a[_0x0478('0x1d')]=_0x56659a[_0x0478('0xe')];_0x56659a[_0x0478('0x1e')]=_0x56659a[_0x0478('0x1f')];}logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+_0x0478('0x20'),_0x56659a);_0x16f49e(_0x56659a);})['catch'](function(_0x50a865){logger['error']('['+[_0x474aa9[_0x0478('0x14')]()]+']',_0x50a865[_0x0478('0x15')]);_0x2cb597(_0x50a865[_0x0478('0x15')]);});}else{logger[_0x0478('0x11')]('['+[_0x474aa9[_0x0478('0x14')]()]+']\x20using\x20admin\x20profile');_0x56659a[_0x0478('0x1d')]=_0x56659a[_0x0478('0xe')];_0x56659a[_0x0478('0x1e')]=_0x56659a[_0x0478('0x1f')];_0x16f49e(_0x56659a);}});};}function createEndUser(_0x24501e,_0x2522de,_0x36b6b1,_0xeb51d8,_0x5ba33e){logger['info']('['+[_0x24501e[_0x0478('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x36b6b1);return new Promise(function(_0x220995,_0x4b4b35){var _0x14f970={'method':_0x0478('0x21'),'uri':_0xeb51d8+_0x0478('0x22')+_0x5ba33e,'body':{'user_name':_0x36b6b1['endUserNumber'],'roles':_0x0478('0x23'),'first_name':_0x36b6b1['endUserNumber'],'active':_0x0478('0x1c'),'date_format':_0x0478('0x24'),'phone':_0x36b6b1[_0x0478('0x25')]},'auth':_0x2522de,'json':!![]};return rp(_0x14f970)[_0x0478('0xd')](function(_0x16f387){logger[_0x0478('0x11')]('['+[_0x24501e[_0x0478('0x14')]()]+_0x0478('0x26'),_0x16f387[_0x0478('0xf')]);_0x36b6b1[_0x0478('0x27')]=_0x16f387['result']['sys_id'];_0x220995(_0x36b6b1);})[_0x0478('0x13')](function(_0x56defb){logger['error']('['+[_0x24501e[_0x0478('0x14')]()]+']',_0x56defb[_0x0478('0x15')]);_0x4b4b35(_0x56defb[_0x0478('0x15')]);});});}function getEndUser(_0x56893b,_0x239d1a,_0x33530d,_0x4efc5e,_0x2ba9c4){return function(_0x3ab1ed){logger[_0x0478('0x11')]('['+[_0x56893b['toUpperCase']()]+_0x0478('0x28'),_0x3ab1ed);return new Promise(function(_0x3a68df,_0x2e1655){var _0x21d259={'method':_0x0478('0xb'),'uri':_0x33530d+_0x0478('0x29')+_0x3ab1ed[_0x0478('0x25')]+'&'+_0x4efc5e+'&'+_0x2ba9c4,'auth':_0x239d1a,'json':!![]};return rp(_0x21d259)[_0x0478('0xd')](function(_0x2a6d7a){if(_0x2a6d7a[_0x0478('0xf')]['length']>0x0){_0x3ab1ed[_0x0478('0x27')]=_0x2a6d7a[_0x0478('0xf')][0x0][_0x0478('0x10')];logger[_0x0478('0x11')]('['+[_0x56893b[_0x0478('0x14')]()]+'],\x20getEndUser\x20crm',_0x3ab1ed);_0x3a68df(_0x3ab1ed);}else{return createEndUser(_0x56893b,_0x239d1a,_0x3ab1ed,_0x33530d,_0x4efc5e)['then'](function(_0x429cb2){logger[_0x0478('0x11')]('['+[_0x56893b[_0x0478('0x14')]()]+_0x0478('0x2a'),_0x429cb2);_0x3a68df(_0x429cb2);});}})[_0x0478('0x13')](function(_0x37232f){logger[_0x0478('0x2b')]('['+[_0x56893b[_0x0478('0x14')]()]+']',_0x37232f[_0x0478('0x15')]);_0x2e1655(_0x37232f[_0x0478('0x15')]);});});};}function getCustomFields(_0x1f022a,_0x33d6f6){var _0x189723={};if(_0x1f022a[_0x0478('0x1a')]>0x0){_[_0x0478('0x2c')](_0x1f022a,function(_0xb793c5){if(_[_0x0478('0x2d')]([_0x0478('0x2e'),_0x0478('0x2f')],_0xb793c5['type'])&&_0xb793c5[_0x0478('0x30')]&&!_0xb793c5[_0x0478('0x31')]){_0x189723[_0xb793c5[_0x0478('0x30')]['toLowerCase']()]=_0xb793c5[_0x0478('0x32')][_0x0478('0x33')]();}else if(_[_0x0478('0x2d')]([_0x0478('0x2e'),_0x0478('0x2f')],_0xb793c5[_0x0478('0x34')])&&_0xb793c5['idField']&&_0xb793c5['customField']){_0x189723[_0xb793c5['idField']['toLowerCase']()]=_0xb793c5['content'][_0x0478('0x33')]();}else if(_0xb793c5[_0x0478('0x34')]===_0x0478('0x35')&&_0xb793c5[_0x0478('0x36')]&&_0xb793c5[_0x0478('0x37')]&&_0xb793c5['customField']){_0x189723[_0xb793c5[_0x0478('0x37')]['toLowerCase']()]=_0x33d6f6[_0xb793c5[_0x0478('0x36')]][_0x0478('0x33')]();}else if(_0xb793c5[_0x0478('0x34')]===_0x0478('0x38')&&_0xb793c5[_0x0478('0x39')]&&_0xb793c5['Variable'][_0x0478('0x3a')]&&_0xb793c5[_0x0478('0x37')]&&_0xb793c5[_0x0478('0x31')]){_0x189723[_0xb793c5[_0x0478('0x37')]['toLowerCase']()]=_0x33d6f6[_0xb793c5[_0x0478('0x39')][_0x0478('0x3a')][_0x0478('0x3b')]()][_0x0478('0x33')]();}});}return _0x189723;}function getTicket(_0x480406,_0x1476d4,_0x21bbc6,_0x367fc9,_0x38345c,_0x466256){return function(_0x52a75d){logger['info']('['+[_0x480406['toUpperCase']()]+_0x0478('0x3c'),_0x52a75d);return new Promise(function(_0x5e0781,_0x59efcc){var _0x57a422=_0x480406['toLowerCase']()==='outbound'?_0x52a75d[_0x0478('0x1d')]:_0x52a75d[_0x0478('0x27')];var _0x5bcdf6={'method':'POST','uri':_0x21bbc6+_0x0478('0x3d')+'?'+_0x466256,'body':Object[_0x0478('0x3e')]({},{'active':_0x0478('0x1c'),'caller_id':_0x57a422,'assigned_to':_0x52a75d[_0x0478('0x1d')],'short_description':intUtil[_0x0478('0x3f')](_0x367fc9['Subjects'],_0x38345c,'\x20'),'description':intUtil['getString'](_0x367fc9[_0x0478('0x40')],_0x38345c,'\x0a')},getCustomFields(_0x367fc9[_0x0478('0x41')],_0x38345c)),'auth':_0x1476d4,'json':!![]};return rp(_0x5bcdf6)['then'](function(_0x1f2883){logger['info']('['+[_0x480406['toUpperCase']()]+_0x0478('0x42'),_0x1f2883['result']);_0x52a75d[_0x0478('0x43')]=_0x1f2883['result'][_0x0478('0x10')];_0x52a75d['ticketNumber']=_0x1f2883[_0x0478('0xf')][_0x0478('0x44')];logger[_0x0478('0x11')]('['+[_0x480406[_0x0478('0x14')]()]+_0x0478('0x45'),_0x52a75d);_0x5e0781(_0x52a75d);})[_0x0478('0x13')](function(_0x3fe63c){logger[_0x0478('0x2b')]('['+[_0x480406['toUpperCase']()]+']',_0x3fe63c[_0x0478('0x15')]);_0x59efcc(_0x3fe63c['message']);});});};}function createRemoteTag(_0x1f3776,_0x2f3f42,_0x215529,_0xb3a1b0){return new Promise(function(_0x366f41,_0x53f0ce){var _0x32daca={'method':'POST','uri':_0x215529+_0x0478('0x46')+'?'+_0xb3a1b0,'body':{'short_description':_0x1f3776,'global':!![],'active':!![],'name':_0x1f3776},'auth':_0x2f3f42,'json':!![]};return rp(_0x32daca)[_0x0478('0xd')](function(_0x4fc2d2){var _0x27011d=_0x4fc2d2[_0x0478('0xf')][_0x0478('0x10')];_0x366f41(_0x27011d);});});}function getRemoteTag(_0x144ad1,_0x57d37a,_0x265ba0,_0x41f870,_0x567299){return new Promise(function(_0x7b4868,_0x31732c){var _0x288503={'method':_0x0478('0xb'),'uri':_0x265ba0+_0x0478('0x46')+_0x0478('0x47')+_0x144ad1+'&'+_0x41f870,'auth':_0x57d37a,'json':!![]};return rp(_0x288503)[_0x0478('0xd')](function(_0x3ad3b9){if(_0x3ad3b9[_0x0478('0xf')]['length']>0x0){var _0x1af063=_0x3ad3b9[_0x0478('0xf')][0x0][_0x0478('0x10')];_0x7b4868(_0x1af063);}else{return createRemoteTag(_0x144ad1,_0x57d37a,_0x265ba0,_0x41f870)[_0x0478('0xd')](function(_0x16b637){_0x7b4868(_0x16b637);});}});});}function assignTagToIncident(_0x142860,_0x4ef0b9,_0x404195,_0x5bf82e,_0x2a3081){return new Promise(function(_0x598c7a,_0xaf72d7){var _0x3a39e4={'method':_0x0478('0x21'),'uri':_0x404195+_0x0478('0x48')+'?'+_0x2a3081,'body':{'label':_0x142860,'table':'incident','id_type':'Incident','table_key':_0x5bf82e['ticketId'],'title':_0x0478('0x49')+_0x5bf82e[_0x0478('0x4a')],'id_display':_0x5bf82e[_0x0478('0x4a')]},'auth':_0x4ef0b9,'json':!![]};return rp(_0x3a39e4)[_0x0478('0xd')](function(_0x2a44b1){_0x598c7a();})['catch'](function(){_0x598c7a();});});}function manageTags(_0x5cdf96,_0x5c1799,_0x5d3341,_0x1adb5d,_0xfd3e97,_0x2bbf22,_0x81a1bc){return new Promise(function(_0x45a6ff,_0x2d9381){var _0x5d4662=[];_0x5c1799[_0x0478('0x2c')](function(_0x30af45){_0x5d4662['push'](getRemoteTag(_0x30af45,_0x5d3341,_0x1adb5d,_0x2bbf22,_0x81a1bc));});return Promise['all'](_0x5d4662)[_0x0478('0xd')](function(_0x527842){if(_0x527842[_0x0478('0x1a')]){logger[_0x0478('0x11')]('['+[_0x5cdf96['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x527842);var _0x1e6b30=[];_0x527842[_0x0478('0x2c')](function(_0xe697ed){_0x1e6b30[_0x0478('0x4b')](assignTagToIncident(_0xe697ed,_0x5d3341,_0x1adb5d,_0xfd3e97,_0x2bbf22));});return Promise[_0x0478('0x4c')](_0x1e6b30)[_0x0478('0xd')](function(){_0x45a6ff();})[_0x0478('0x13')](function(){_0x45a6ff();});}else{_0x45a6ff();}});});}function getTags(_0x4df7fa,_0xf06839,_0x3c1a45,_0x2dbc87,_0x585c3d,_0x1dc6c7){return function(_0x16b0a9){return new Promise(function(_0x1c3807,_0x79697b){var _0x455641=[];var _0xa27ccf=_0x2dbc87[_0x0478('0x4d')];if(_0xa27ccf&&_0xa27ccf['length']>0x0){_0x455641=_[_0x0478('0x4e')](_0xa27ccf,_0x0478('0x3a'));}if(_0x455641[_0x0478('0x1a')]>0x0){return manageTags(_0x4df7fa,_0x455641,_0xf06839,_0x3c1a45,_0x16b0a9,_0x585c3d,_0x1dc6c7)[_0x0478('0xd')](function(){_0x1c3807(_0x16b0a9);});}else{_0x1c3807(_0x16b0a9);}});};}function emit(_0x399c94,_0x27e127,_0x4668f3){var _0x119c8a=_0x0478('0x4f')+_0x0478('0x50')+_0x0478('0x51')+_0x0478('0x52');var _0x507a84={'uri':_0x399c94+_0x0478('0x53')+_0x4668f3+_0x119c8a};io['to'](util[_0x0478('0x54')]('user:%s',_0x27e127))['emit'](_0x0478('0x55'),_0x507a84);}exports['cs']=function(_0x470523,_0xa686e2,_0x41d33e,_0x27c2d4,_0x5aa7d8,_0x36c1af,_0x176a53,_0x1f4f01){var _0x551b9c={};var _0x3cf1e3={'user':_0x36c1af['username'],'pass':_0x36c1af[_0x0478('0x56')]};var _0x12b4c3=_0x0478('0x57');var _0x1b6794=_0x0478('0x58');_0x36c1af['remoteUri']=intUtil[_0x0478('0x59')](_0x36c1af[_0x0478('0x5a')]);_0x36c1af[_0x0478('0x5b')]=intUtil['stripTrailingSlash'](_0x36c1af[_0x0478('0x5b')]);var _0x52f954=util[_0x0478('0x54')](_0x0478('0x5c'),_0x36c1af[_0x0478('0x5a')]);_0x551b9c[_0x0478('0x1e')]=!_[_0x0478('0x5d')](_0x27c2d4)?_0x27c2d4[_0x0478('0x5e')]:null;_0x551b9c[_0x0478('0x1f')]=_0x36c1af[_0x0478('0x5e')];_0x551b9c[_0x0478('0x25')]=_0x1f4f01['toLowerCase']()===_0x0478('0x5f')?_0xa686e2[_0x0478('0x60')]:_0xa686e2['calleridnum'];_0x551b9c['callDirection']=_0x1f4f01===_0x0478('0x61')||_0x1f4f01===_0x0478('0x62')?_0x0478('0x61'):'outbound';var _0x2b8d83=util[_0x0478('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36c1af[_0x0478('0x5b')],_0xa686e2[_0x0478('0x63')],md5(_0xa686e2[_0x0478('0x63')]));if(_0x5aa7d8&&_0x5aa7d8[_0x0478('0x64')]){logger[_0x0478('0x11')]('[QUEUE]',_0x0478('0x65'));_0xa686e2[_0x0478('0x66')]=_0x2b8d83;}else if(_0x176a53&&_0x176a53[_0x0478('0x67')]&&_0x176a53[_0x0478('0x67')]!==_0x0478('0x68')){logger['info'](_0x0478('0x69'),_0x0478('0x65'));_0xa686e2[_0x0478('0x66')]=_0x2b8d83;}else{_0xa686e2[_0x0478('0x66')]='';}return getAdminUser(_0x1f4f01,_0x3cf1e3,_0x551b9c,_0x52f954,_0x1b6794,_0x12b4c3)['then'](getUser(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x1b6794,_0x12b4c3))[_0x0478('0xd')](getEndUser(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x1b6794,_0x12b4c3))['then'](getTicket(_0x1f4f01,_0x3cf1e3,_0x52f954,_0x41d33e,_0xa686e2,_0x1b6794))['then'](function(_0x50aa29){logger[_0x0478('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x50aa29[_0x0478('0x43')]));logger['info'](util[_0x0478('0x54')]('call\x20direction:\x20%s',_0x1f4f01));if(_0x1f4f01!==_0x0478('0x62')){logger[_0x0478('0x11')]('['+[_0x1f4f01[_0x0478('0x14')]()]+']',_0x0478('0x6a'));emit(_0x36c1af['remoteUri'],_0x27c2d4[_0x0478('0x3a')],_0x50aa29['ticketId']);}})[_0x0478('0x13')](function(_0x2ff1b6){logger[_0x0478('0x2b')]('['+[_0x1f4f01[_0x0478('0x14')]()]+_0x0478('0x6b'),util[_0x0478('0x6c')](_0x2ff1b6,{'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 96786ab..4ede726 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 _0x7c2a=['lastevent','Inbound','toUpperCase','lodash','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','info','name','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','format','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','first_name','debug','map','type','string','nameField','toLowerCase','content','customField','variable','custom_fields','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','users','unmanaged'];(function(_0xed6ed0,_0x28e1ad){var _0x20a428=function(_0x5b2603){while(--_0x5b2603){_0xed6ed0['push'](_0xed6ed0['shift']());}};_0x20a428(++_0x28e1ad);}(_0x7c2a,0x156));var _0xa7c2=function(_0x452d20,_0x35cb7f){_0x452d20=_0x452d20-0x0;var _0x2b4452=_0x7c2a[_0x452d20];return _0x2b4452;};'use strict';var _=require(_0xa7c2('0x0'));var rp=require('request-promise');var BPromise=require(_0xa7c2('0x1'));var md5=require(_0xa7c2('0x2'));var util=require(_0xa7c2('0x3'));var Redis=require(_0xa7c2('0x4'));var intUtil=require(_0xa7c2('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa7c2('0x6'))(_0xa7c2('0x7'));config[_0xa7c2('0x8')]=_['defaults'](config[_0xa7c2('0x8')],{'host':_0xa7c2('0x9'),'port':0x18eb});var io=require(_0xa7c2('0xa'))(new Redis(config[_0xa7c2('0x8')]));var def={'method':_0xa7c2('0xb'),'json':!![]};function emit(_0x2005b7,_0x321d7d,_0x292956){io['to'](_0x2005b7)['emit'](_0x321d7d,_0x292956);}function getTicket(_0x521656,_0x3fed98,_0x49a41d,_0x1dca83,_0x3acc5d,_0x15d03c,_0x299482,_0x5e2c56){logger[_0xa7c2('0xc')]('Creating\x20new\x20ticket...');var _0x494fe7=new Date();var _0x9e613f=[{'name':_0xa7c2('0xd'),'value':intUtil[_0xa7c2('0xe')](_0x1dca83['Subjects'],_0x3acc5d,'\x20')},{'name':'assigned_user_id','value':_0x3fed98['id']},{'name':'created_by','value':_0x3fed98['id']},{'name':'description','value':intUtil[_0xa7c2('0xe')](_0x1dca83[_0xa7c2('0xf')],_0x3acc5d,'\x0a')},{'name':_0xa7c2('0x10'),'value':_0x494fe7[_0xa7c2('0x11')]()[_0xa7c2('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa7c2('0x13'),'value':'0'},{'name':_0xa7c2('0x14'),'value':'15'},{'name':_0xa7c2('0x15'),'value':_0x49a41d['id']},{'name':_0xa7c2('0x16'),'value':'Contacts'},{'name':_0xa7c2('0x17'),'value':_0x49a41d[_0xa7c2('0xd')]},{'name':'direction','value':_0x5e2c56}];if(_0x15d03c[_0xa7c2('0x18')]){_[_0xa7c2('0x19')](_0x15d03c,function(_0x54a39d){if(_0x3acc5d[_0x54a39d[_0xa7c2('0x1a')]]){_0x9e613f[_0xa7c2('0x1b')]({'name':_0x54a39d[_0xa7c2('0x1c')],'value':_0x3acc5d[_0x54a39d[_0xa7c2('0x1a')]]});}});}return request({'form':{'method':_0xa7c2('0x1d'),'input_type':_0xa7c2('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x299482['id'],'module_name':_0xa7c2('0x1f'),'name_value_list':_0x9e613f})}});}function getAuth(_0x7ac05b){return util['format'](_0xa7c2('0x20'),new Buffer(_0x7ac05b[_0xa7c2('0x21')]+':X')[_0xa7c2('0x22')](_0xa7c2('0x23')));}function getServerInfo(_0x4c4aa6){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xa7c2('0x1e'),'rest_data':JSON[_0xa7c2('0x24')]({'session':_0x4c4aa6['id']})}});}function getUser(_0x5db205,_0x5277bc,_0x1c10d1){if(!_[_0xa7c2('0x25')](_0x5277bc)){logger[_0xa7c2('0xc')](_0xa7c2('0x26'),_0x5277bc);return request({'form':{'method':_0xa7c2('0x27'),'input_type':'JSON','response_type':_0xa7c2('0x1e'),'rest_data':JSON[_0xa7c2('0x24')]({'session':_0x1c10d1['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5277bc),'order_by':'','offset':'0','select_fields':['id',_0xa7c2('0xd'),_0xa7c2('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa7c2('0x29')](function(_0x5be45d){if(_0x5be45d[_0xa7c2('0x2a')]['length']){var _0x53a41e=_['find'](_0x5be45d[_0xa7c2('0x2a')],function(_0x10db92){return _0x10db92['name_value_list'][_0xa7c2('0x28')][_0xa7c2('0x2b')]===_0x5277bc;});if(_0x53a41e){logger[_0xa7c2('0xc')](_0xa7c2('0x2c'));return BPromise[_0xa7c2('0x2d')]({'id':_0x53a41e[_0xa7c2('0x2e')]['id']['value'],'name':_0x53a41e[_0xa7c2('0x2e')][_0xa7c2('0xd')][_0xa7c2('0x2b')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa7c2('0x2d')]({'id':_0x1c10d1[_0xa7c2('0x2e')][_0xa7c2('0x2f')][_0xa7c2('0x2b')],'name':_0x1c10d1[_0xa7c2('0x2e')][_0xa7c2('0x28')][_0xa7c2('0x2b')]});});}else{logger[_0xa7c2('0xc')](_0xa7c2('0x30'));return BPromise['resolve']({'id':_0x1c10d1['name_value_list']['user_id']['value'],'name':_0x1c10d1[_0xa7c2('0x2e')]['user_name']['value']});}}function getEndUser(_0x372a98,_0x11c719,_0xbdfd43,_0x19543d){logger['info'](_0xa7c2('0x31'),_0xbdfd43);return request({'form':{'method':_0xa7c2('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa7c2('0x24')]({'session':_0x19543d['id'],'module_name':_0xa7c2('0x32'),'query':util[_0xa7c2('0x33')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xbdfd43),'order_by':'','offset':'0','select_fields':['id',_0xa7c2('0xd'),_0xa7c2('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa7c2('0x29')](function(_0x36b221){if(_0x36b221[_0xa7c2('0x2a')]['length']){var _0x5765a7=_['find'](_0x36b221['entry_list'],function(_0x2c7e19){return _0x2c7e19[_0xa7c2('0x2e')]['phone_home'][_0xa7c2('0x2b')]===_0xbdfd43;});if(_0x5765a7){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x5765a7[_0xa7c2('0x2e')]['id']['value'],'name':_0x5765a7['name_value_list'][_0xa7c2('0xd')][_0xa7c2('0x2b')],'phone':_0x5765a7[_0xa7c2('0x2e')][_0xa7c2('0x34')]['value']});}}else{logger[_0xa7c2('0xc')](_0xa7c2('0x35'));return request({'form':{'method':_0xa7c2('0x1d'),'input_type':_0xa7c2('0x1e'),'response_type':_0xa7c2('0x1e'),'rest_data':JSON['stringify']({'session':_0x19543d['id'],'module_name':_0xa7c2('0x32'),'name_value_list':[{'name':'first_name','value':_0x11c719!==''?_0x11c719:util[_0xa7c2('0x33')]('Caller\x20-\x20%s',_0xbdfd43)},{'name':_0xa7c2('0x34'),'value':_0xbdfd43}]})}})[_0xa7c2('0x29')](function(_0x4fb0c6){logger[_0xa7c2('0xc')](_0xa7c2('0x36'));return BPromise[_0xa7c2('0x2d')]({'id':_0x4fb0c6['id'],'name':_0x4fb0c6[_0xa7c2('0x2a')][_0xa7c2('0x37')][_0xa7c2('0x2b')],'phone':_0x4fb0c6[_0xa7c2('0x2a')][_0xa7c2('0x34')][_0xa7c2('0x2b')]});});}});}function request(_0x126590){logger[_0xa7c2('0x38')]('[HTTP]',JSON[_0xa7c2('0x24')](_0x126590));return rp(_['merge'](def,_0x126590));}function getTags(_0x132a48,_0xa05548){var _0x4cb82f=[];if(_0x132a48&&_0x132a48[_0xa7c2('0x18')]>0x0){_0x4cb82f=_[_0xa7c2('0x39')](_0x132a48,_0xa05548);}return _0x4cb82f;}function getCustomFields(_0x3192ed,_0x464927){var _0x243b1c=[];var _0x3acc30={'custom_fields':[]};if(_0x3192ed[_0xa7c2('0x18')]>0x0){_[_0xa7c2('0x19')](_0x3192ed,function(_0x506b11){if(_0x506b11[_0xa7c2('0x3a')]===_0xa7c2('0x3b')&&_0x506b11[_0xa7c2('0x3c')]&&!_0x506b11['customField']){_0x3acc30[_0x506b11[_0xa7c2('0x3c')][_0xa7c2('0x3d')]()]=_0x506b11[_0xa7c2('0x3e')]['toString']();}else if(_0x506b11[_0xa7c2('0x3a')]===_0xa7c2('0x3b')&&_0x506b11[_0xa7c2('0x1c')]&&_0x506b11[_0xa7c2('0x3f')]){_0x3acc30['custom_fields'][_0xa7c2('0x1b')]({'id':_0x506b11[_0xa7c2('0x1c')],'value':_0x506b11[_0xa7c2('0x3e')][_0xa7c2('0x22')]()});}else if(_0x506b11[_0xa7c2('0x3a')]===_0xa7c2('0x40')&&_0x506b11[_0xa7c2('0x1a')]&&_0x506b11[_0xa7c2('0x1c')]&&_0x506b11[_0xa7c2('0x3f')]){_0x464927[_0x506b11[_0xa7c2('0x1a')]]&&_0x3acc30[_0xa7c2('0x41')]['push']({'id':_0x506b11[_0xa7c2('0x1c')],'value':_0x464927[_0x506b11[_0xa7c2('0x1a')]][_0xa7c2('0x22')]()});}else if(_0x506b11[_0xa7c2('0x3a')]===_0xa7c2('0x42')&&_0x506b11[_0xa7c2('0x43')]&&_0x506b11[_0xa7c2('0x43')][_0xa7c2('0xd')]&&_0x506b11['idField']&&_0x506b11[_0xa7c2('0x3f')]){_0x464927[_0x506b11[_0xa7c2('0x43')][_0xa7c2('0xd')]['toLowerCase']()]&&_0x3acc30[_0xa7c2('0x41')][_0xa7c2('0x1b')]({'id':_0x506b11[_0xa7c2('0x1c')],'value':_0x464927[_0x506b11['Variable'][_0xa7c2('0xd')][_0xa7c2('0x3d')]()][_0xa7c2('0x22')]()});}});}return _0x3acc30;}function getConnection(_0x8cd7e5){return request({'method':_0xa7c2('0xb'),'form':{'method':_0xa7c2('0x44'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa7c2('0x24')]({'user_auth':{'user_name':_0x8cd7e5[_0xa7c2('0x45')],'password':_0x8cd7e5['password'],'encryption':_0xa7c2('0x46')},'application':_0xa7c2('0x47')})}})[_0xa7c2('0x29')](function(_0x1108d7){var _0x55dfd2=_0x1108d7;if(_0x55dfd2['id']){def[_0xa7c2('0x48')]=_0x55dfd2['id'];return BPromise['resolve'](_0x55dfd2);}else{throw new Error(util[_0xa7c2('0x33')](_0xa7c2('0x49'),_0x8cd7e5['id']));}});}function setRelationship(_0x3fd235,_0x3a4a1f,_0x19b4e4,_0x45334d){return request({'form':{'method':_0xa7c2('0x4a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa7c2('0x24')]({'session':_0x3fd235['id'],'module_name':_0xa7c2('0x1f'),'module_id':_0x19b4e4['id'],'link_field_name':_0x45334d,'related_ids':[_0x3a4a1f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa7c2('0x4b')]=function(_0x4a0c69,_0x28995a,_0xc555f1,_0x3ae0b6,_0x3e1c1e,_0x1fb93a){var _0xbd0fc8,_0x5603f2,_0x3678af,_0x24d4f6;_0x1fb93a[_0xa7c2('0x4c')]=intUtil[_0xa7c2('0x4d')](_0x1fb93a['remoteUri']);_0x1fb93a[_0xa7c2('0x4e')]=intUtil[_0xa7c2('0x4d')](_0x1fb93a[_0xa7c2('0x4e')]);def[_0xa7c2('0x4f')]=util[_0xa7c2('0x33')](_0xa7c2('0x50'),_0x1fb93a['remoteUri']);if(_0x3e1c1e&&_0x3e1c1e[_0xa7c2('0x51')]){logger[_0xa7c2('0xc')](_0xa7c2('0x52'),_0xa7c2('0x53'));_0x28995a['recordingURL']=util[_0xa7c2('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fb93a['serverUrl'],_0x28995a['uniqueid'],md5(_0x28995a[_0xa7c2('0x54')]));}else{_0x28995a['recordingURL']='';}return getConnection(_0x1fb93a)[_0xa7c2('0x29')](function(_0x4301d6){_0x24d4f6=_0x4301d6;return getUser(_0x1fb93a,_0x3ae0b6[_0xa7c2('0xd')],_0x24d4f6);})[_0xa7c2('0x29')](function(_0x5cf8d5){_0xbd0fc8=_0x5cf8d5;logger[_0xa7c2('0xc')](_0xa7c2('0x55'),_0xbd0fc8['id']);return getEndUser(_0x1fb93a,_0x28995a[_0xa7c2('0x56')],_0x28995a[_0xa7c2('0x57')],_0x24d4f6);})[_0xa7c2('0x29')](function(_0x260515){_0x5603f2=_0x260515;logger[_0xa7c2('0xc')](_0xa7c2('0x58'),_0x5603f2['id']);return getTicket(_0x1fb93a,_0xbd0fc8,_0x5603f2,_0xc555f1,_0x28995a,_0xc555f1[_0xa7c2('0x59')],_0x24d4f6,'Inbound');})['then'](function(_0x4c507e){_0x3678af=_0x4c507e;logger[_0xa7c2('0xc')](_0xa7c2('0x5a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3678af['id']);return setRelationship(_0x24d4f6,_0xbd0fc8,_0x3678af,'users');})[_0xa7c2('0x29')](function(){return setRelationship(_0x24d4f6,_0x5603f2,_0x3678af,_0xa7c2('0x5b'));})[_0xa7c2('0x29')](function(){return getServerInfo(_0x24d4f6);})['then'](function(_0x65188){var _0x500236=parseInt(_0x65188[_0xa7c2('0x5c')][_0xa7c2('0x5d')](0x0));var _0x3471b9=util[_0xa7c2('0x33')](_0xa7c2('0x5e'),_0x1fb93a[_0xa7c2('0x4c')],_0x3678af['id']);if(_0x500236>0x6){_0x3471b9=util[_0xa7c2('0x33')](_0xa7c2('0x5f'),_0x1fb93a[_0xa7c2('0x4c')],_0x3678af['id']);}logger['info']('[QUEUE]',_0xa7c2('0x60'));emit(util[_0xa7c2('0x33')](_0xa7c2('0x61'),_0x3ae0b6[_0xa7c2('0xd')]),_0xa7c2('0x62'),{'uri':_0x3471b9});})[_0xa7c2('0x63')](function(_0x2f7be1){logger['error']('[QUEUE]',JSON[_0xa7c2('0x24')](_0x2f7be1));});};exports[_0xa7c2('0x64')]=function(_0x3f9c0b,_0x35f410,_0x3d7072,_0x43adfe,_0x45373f,_0x32d777,_0x509c3f){var _0x47dd42,_0x343920,_0x3aa053,_0x1e9d70;_0x32d777[_0xa7c2('0x4c')]=intUtil[_0xa7c2('0x4d')](_0x32d777[_0xa7c2('0x4c')]);_0x32d777[_0xa7c2('0x4e')]=intUtil[_0xa7c2('0x4d')](_0x32d777[_0xa7c2('0x4e')]);def['uri']=util[_0xa7c2('0x33')](_0xa7c2('0x50'),_0x32d777[_0xa7c2('0x4c')]);if(_0x509c3f&&_0x509c3f[_0xa7c2('0x65')]&&_0x509c3f['recordingFormat']!==_0xa7c2('0x66')){logger['info'](_0xa7c2('0x67'),_0xa7c2('0x53'));_0x35f410[_0xa7c2('0x68')]=util[_0xa7c2('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32d777[_0xa7c2('0x4e')],_0x35f410[_0xa7c2('0x54')],md5(_0x35f410[_0xa7c2('0x54')]));}return getConnection(_0x32d777)['then'](function(_0xde5b38){_0x1e9d70=_0xde5b38;return getUser(_0x32d777,_0x43adfe[_0xa7c2('0xd')],_0x1e9d70);})[_0xa7c2('0x29')](function(_0x1c5c85){_0x47dd42=_0x1c5c85;logger[_0xa7c2('0xc')](_0xa7c2('0x55'),_0x47dd42['id']);return getEndUser(_0x32d777,_0x35f410[_0xa7c2('0x69')],_0x35f410[_0xa7c2('0x6a')],_0x1e9d70);})[_0xa7c2('0x29')](function(_0x3c97b5){_0x343920=_0x3c97b5;logger[_0xa7c2('0xc')](_0xa7c2('0x58'),_0x343920['id']);return getTicket(_0x32d777,_0x47dd42,_0x343920,_0x3d7072,_0x35f410,_0x3d7072[_0xa7c2('0x59')],_0x1e9d70,'Outbound');})[_0xa7c2('0x29')](function(_0x57967e){_0x3aa053=_0x57967e;logger['info'](_0xa7c2('0x5a'));logger[_0xa7c2('0xc')](_0xa7c2('0x6b'),_0x3aa053['id']);return setRelationship(_0x1e9d70,_0x47dd42,_0x3aa053,_0xa7c2('0x6c'));})[_0xa7c2('0x29')](function(){return setRelationship(_0x1e9d70,_0x343920,_0x3aa053,_0xa7c2('0x5b'));})[_0xa7c2('0x29')](function(){return getServerInfo(_0x1e9d70);})[_0xa7c2('0x29')](function(_0x19c48d){var _0x2c513d=parseInt(_0x19c48d[_0xa7c2('0x5c')]['charAt'](0x0));var _0x2d3b2b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x32d777[_0xa7c2('0x4c')],_0x3aa053['id']);if(_0x2c513d>0x6){_0x2d3b2b=util[_0xa7c2('0x33')](_0xa7c2('0x5f'),_0x32d777[_0xa7c2('0x4c')],_0x3aa053['id']);}logger[_0xa7c2('0xc')](_0xa7c2('0x67'),_0xa7c2('0x60'));emit(util[_0xa7c2('0x33')](_0xa7c2('0x61'),_0x43adfe[_0xa7c2('0xd')]),_0xa7c2('0x62'),{'uri':_0x2d3b2b});})[_0xa7c2('0x63')](function(_0x32451a){logger['error'](_0xa7c2('0x67'),JSON['stringify'](_0x32451a));});};exports[_0xa7c2('0x6d')]=function(_0x4ad777,_0x510e4e,_0x48fedd,_0x218f37,_0xeabe03,_0xe6720a){var _0x10fc9e,_0x169a06,_0x502228,_0x2865ae;_0xe6720a[_0xa7c2('0x4c')]=intUtil[_0xa7c2('0x4d')](_0xe6720a[_0xa7c2('0x4c')]);_0xe6720a['serverUrl']=intUtil['stripTrailingSlash'](_0xe6720a[_0xa7c2('0x4e')]);def[_0xa7c2('0x4f')]=util[_0xa7c2('0x33')](_0xa7c2('0x50'),_0xe6720a['remoteUri']);if(_0xeabe03&&_0xeabe03[_0xa7c2('0x51')]){logger[_0xa7c2('0xc')]('['+_0x510e4e[_0xa7c2('0x6e')]['toUpperCase']()+']',_0xa7c2('0x53'));_0x510e4e[_0xa7c2('0x68')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe6720a[_0xa7c2('0x4e')],_0x510e4e[_0xa7c2('0x54')],md5(_0x510e4e[_0xa7c2('0x54')]));}else{_0x510e4e[_0xa7c2('0x68')]='';}return getConnection(_0xe6720a)[_0xa7c2('0x29')](function(_0x1fc95f){_0x2865ae=_0x1fc95f;if(!_[_0xa7c2('0x25')](_0x218f37)){return getUser(_0xe6720a,_0x218f37[_0xa7c2('0xd')],_0x2865ae);}else{return getUser(_0xe6720a,null,_0x2865ae);}})[_0xa7c2('0x29')](function(_0x18ec74){_0x10fc9e=_0x18ec74;logger['info'](_0xa7c2('0x55'),_0x10fc9e['id']);return getEndUser(_0xe6720a,_0x510e4e[_0xa7c2('0x56')],_0x510e4e[_0xa7c2('0x57')],_0x2865ae);})[_0xa7c2('0x29')](function(_0x32d323){_0x169a06=_0x32d323;logger[_0xa7c2('0xc')](_0xa7c2('0x58'),_0x169a06['id']);return getTicket(_0xe6720a,_0x10fc9e,_0x169a06,_0x48fedd,_0x510e4e,_0x48fedd[_0xa7c2('0x59')],_0x2865ae,_0xa7c2('0x6f'));})['then'](function(_0xd1d0f9){_0x502228=_0xd1d0f9;logger[_0xa7c2('0xc')](_0xa7c2('0x5a'));logger[_0xa7c2('0xc')](_0xa7c2('0x6b'),_0x502228['id']);return setRelationship(_0x2865ae,_0x10fc9e,_0x502228,'users');})[_0xa7c2('0x29')](function(){return setRelationship(_0x2865ae,_0x169a06,_0x502228,_0xa7c2('0x5b'));})[_0xa7c2('0x29')](function(){return getServerInfo(_0x2865ae);})[_0xa7c2('0x63')](function(_0x43a325){logger['error']('['+_0x510e4e[_0xa7c2('0x6e')][_0xa7c2('0x70')]()+']',JSON['stringify'](_0x43a325));});}; \ No newline at end of file +var _0xc856=['user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','type','string','nameField','customField','idField','content','variable','custom_fields','Variable','toLowerCase','login','username','password','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','version','unmanaged','lastevent','calleridname','The\x20Ticket\x20ID\x20is:','catch','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','slice','replace','duration_hours','parent_id','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200'];(function(_0x52f2c1,_0x36459f){var _0x5d33c1=function(_0x56cc0a){while(--_0x56cc0a){_0x52f2c1['push'](_0x52f2c1['shift']());}};_0x5d33c1(++_0x36459f);}(_0xc856,0x13c));var _0x6c85=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xc856[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require('lodash');var rp=require(_0x6c85('0x0'));var BPromise=require(_0x6c85('0x1'));var md5=require(_0x6c85('0x2'));var util=require(_0x6c85('0x3'));var Redis=require(_0x6c85('0x4'));var intUtil=require(_0x6c85('0x5'));var config=require(_0x6c85('0x6'));var logger=require(_0x6c85('0x7'))(_0x6c85('0x8'));config[_0x6c85('0x9')]=_[_0x6c85('0xa')](config['redis'],{'host':_0x6c85('0xb'),'port':0x18eb});var io=require(_0x6c85('0xc'))(new Redis(config[_0x6c85('0x9')]));var def={'method':_0x6c85('0xd'),'json':!![]};function emit(_0x117b5f,_0x51663f,_0x43bcff){io['to'](_0x117b5f)[_0x6c85('0xe')](_0x51663f,_0x43bcff);}function getTicket(_0x2242b7,_0x15e384,_0x561010,_0x8b77b7,_0x57340a,_0x291cd9,_0x1deca3,_0x2b5a61){logger[_0x6c85('0xf')](_0x6c85('0x10'));var _0x82e2e8=new Date();var _0x58380e=[{'name':_0x6c85('0x11'),'value':intUtil[_0x6c85('0x12')](_0x8b77b7[_0x6c85('0x13')],_0x57340a,'\x20')},{'name':_0x6c85('0x14'),'value':_0x15e384['id']},{'name':_0x6c85('0x15'),'value':_0x15e384['id']},{'name':_0x6c85('0x16'),'value':intUtil[_0x6c85('0x12')](_0x8b77b7['Descriptions'],_0x57340a,'\x0a')},{'name':_0x6c85('0x17'),'value':_0x82e2e8['toISOString']()[_0x6c85('0x18')](0x0,0x13)[_0x6c85('0x19')]('T','\x20')},{'name':_0x6c85('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x6c85('0x1b'),'value':_0x561010['id']},{'name':'parent_type','value':_0x6c85('0x1c')},{'name':_0x6c85('0x1d'),'value':_0x561010[_0x6c85('0x11')]},{'name':'direction','value':_0x2b5a61}];if(_0x291cd9[_0x6c85('0x1e')]){_['forEach'](_0x291cd9,function(_0x4a4303){if(_0x57340a[_0x4a4303[_0x6c85('0x1f')]]){_0x58380e[_0x6c85('0x20')]({'name':_0x4a4303['idField'],'value':_0x57340a[_0x4a4303[_0x6c85('0x1f')]]});}});}return request({'form':{'method':_0x6c85('0x21'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x1deca3['id'],'module_name':'Calls','name_value_list':_0x58380e})}});}function getAuth(_0x1cd682){return util[_0x6c85('0x24')](_0x6c85('0x25'),new Buffer(_0x1cd682[_0x6c85('0x26')]+':X')[_0x6c85('0x27')]('base64'));}function getServerInfo(_0x5247d2){return request({'form':{'method':_0x6c85('0x28'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x5247d2['id']})}});}function getUser(_0x4fa86a,_0x54ad11,_0x22eca6){if(!_[_0x6c85('0x29')](_0x54ad11)){logger[_0x6c85('0xf')]('Getting\x20agent\x20with\x20name',_0x54ad11);return request({'form':{'method':'get_entry_list','input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON['stringify']({'session':_0x22eca6['id'],'module_name':_0x6c85('0x2a'),'query':util['format'](_0x6c85('0x2b'),_0x54ad11),'order_by':'','offset':'0','select_fields':['id',_0x6c85('0x11'),_0x6c85('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6c85('0x2d')](function(_0x4212d9){if(_0x4212d9[_0x6c85('0x2e')][_0x6c85('0x1e')]){var _0x18d8e5=_[_0x6c85('0x2f')](_0x4212d9[_0x6c85('0x2e')],function(_0x310dc1){return _0x310dc1[_0x6c85('0x30')][_0x6c85('0x2c')][_0x6c85('0x31')]===_0x54ad11;});if(_0x18d8e5){logger[_0x6c85('0xf')]('Agent\x20found!');return BPromise[_0x6c85('0x32')]({'id':_0x18d8e5[_0x6c85('0x30')]['id'][_0x6c85('0x31')],'name':_0x18d8e5[_0x6c85('0x30')][_0x6c85('0x11')]['value']});}}logger[_0x6c85('0xf')](_0x6c85('0x33'));return BPromise[_0x6c85('0x32')]({'id':_0x22eca6['name_value_list'][_0x6c85('0x34')]['value'],'name':_0x22eca6[_0x6c85('0x30')]['user_name'][_0x6c85('0x31')]});});}else{logger[_0x6c85('0xf')](_0x6c85('0x35'));return BPromise[_0x6c85('0x32')]({'id':_0x22eca6[_0x6c85('0x30')][_0x6c85('0x34')][_0x6c85('0x31')],'name':_0x22eca6['name_value_list'][_0x6c85('0x2c')][_0x6c85('0x31')]});}}function getEndUser(_0x51dd74,_0x1f15c7,_0x3cc1da,_0x20e72f){logger[_0x6c85('0xf')](_0x6c85('0x36'),_0x3cc1da);return request({'form':{'method':_0x6c85('0x37'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x20e72f['id'],'module_name':_0x6c85('0x1c'),'query':util[_0x6c85('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3cc1da),'order_by':'','offset':'0','select_fields':['id',_0x6c85('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x41f479){if(_0x41f479[_0x6c85('0x2e')][_0x6c85('0x1e')]){var _0x590378=_[_0x6c85('0x2f')](_0x41f479[_0x6c85('0x2e')],function(_0x536baa){return _0x536baa[_0x6c85('0x30')][_0x6c85('0x38')][_0x6c85('0x31')]===_0x3cc1da;});if(_0x590378){logger[_0x6c85('0xf')](_0x6c85('0x39'));return BPromise[_0x6c85('0x32')]({'id':_0x590378[_0x6c85('0x30')]['id']['value'],'name':_0x590378[_0x6c85('0x30')][_0x6c85('0x11')][_0x6c85('0x31')],'phone':_0x590378[_0x6c85('0x30')][_0x6c85('0x38')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x6c85('0x21'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0x20e72f['id'],'module_name':_0x6c85('0x1c'),'name_value_list':[{'name':_0x6c85('0x3a'),'value':_0x1f15c7!==_0x6c85('0x3b')?_0x1f15c7:util[_0x6c85('0x24')](_0x6c85('0x3c'),_0x3cc1da)},{'name':_0x6c85('0x38'),'value':_0x3cc1da}]})}})['then'](function(_0x4ac33e){logger['info'](_0x6c85('0x3d'));return BPromise[_0x6c85('0x32')]({'id':_0x4ac33e['id'],'name':_0x4ac33e[_0x6c85('0x2e')][_0x6c85('0x3a')][_0x6c85('0x31')],'phone':_0x4ac33e['entry_list'][_0x6c85('0x38')]['value']});});}});}function request(_0x32e6ae){logger[_0x6c85('0x3e')](_0x6c85('0x3f'),JSON['stringify'](_0x32e6ae));return rp(_[_0x6c85('0x40')](def,_0x32e6ae));}function getTags(_0x184709,_0x1834b4){var _0x437bbb=[];if(_0x184709&&_0x184709['length']>0x0){_0x437bbb=_['map'](_0x184709,_0x1834b4);}return _0x437bbb;}function getCustomFields(_0x4acbdd,_0x410c58){var _0x3ca430=[];var _0x4aa029={'custom_fields':[]};if(_0x4acbdd[_0x6c85('0x1e')]>0x0){_[_0x6c85('0x41')](_0x4acbdd,function(_0x3f7b77){if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x43')&&_0x3f7b77[_0x6c85('0x44')]&&!_0x3f7b77[_0x6c85('0x45')]){_0x4aa029[_0x3f7b77[_0x6c85('0x44')]['toLowerCase']()]=_0x3f7b77['content'][_0x6c85('0x27')]();}else if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x43')&&_0x3f7b77[_0x6c85('0x46')]&&_0x3f7b77['customField']){_0x4aa029['custom_fields'][_0x6c85('0x20')]({'id':_0x3f7b77['idField'],'value':_0x3f7b77[_0x6c85('0x47')][_0x6c85('0x27')]()});}else if(_0x3f7b77[_0x6c85('0x42')]===_0x6c85('0x48')&&_0x3f7b77[_0x6c85('0x1f')]&&_0x3f7b77[_0x6c85('0x46')]&&_0x3f7b77['customField']){_0x410c58[_0x3f7b77[_0x6c85('0x1f')]]&&_0x4aa029[_0x6c85('0x49')][_0x6c85('0x20')]({'id':_0x3f7b77[_0x6c85('0x46')],'value':_0x410c58[_0x3f7b77[_0x6c85('0x1f')]][_0x6c85('0x27')]()});}else if(_0x3f7b77[_0x6c85('0x42')]==='customVariable'&&_0x3f7b77[_0x6c85('0x4a')]&&_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')]&&_0x3f7b77['idField']&&_0x3f7b77['customField']){_0x410c58[_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')]['toLowerCase']()]&&_0x4aa029['custom_fields'][_0x6c85('0x20')]({'id':_0x3f7b77['idField'],'value':_0x410c58[_0x3f7b77[_0x6c85('0x4a')][_0x6c85('0x11')][_0x6c85('0x4b')]()][_0x6c85('0x27')]()});}});}return _0x4aa029;}function getConnection(_0x4dacc6){return request({'method':_0x6c85('0xd'),'form':{'method':_0x6c85('0x4c'),'input_type':'JSON','response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'user_auth':{'user_name':_0x4dacc6[_0x6c85('0x4d')],'password':_0x4dacc6[_0x6c85('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x6c85('0x2d')](function(_0x39d378){var _0x4b2838=_0x39d378;if(_0x4b2838['id']){def['sessionID']=_0x4b2838['id'];return BPromise['resolve'](_0x4b2838);}else{throw new Error(util[_0x6c85('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x4dacc6['id']));}});}function setRelationship(_0xcbbdfe,_0x15dd59,_0x36cab5,_0x262d35){return request({'form':{'method':_0x6c85('0x4f'),'input_type':_0x6c85('0x22'),'response_type':_0x6c85('0x22'),'rest_data':JSON[_0x6c85('0x23')]({'session':_0xcbbdfe['id'],'module_name':_0x6c85('0x50'),'module_id':_0x36cab5['id'],'link_field_name':_0x262d35,'related_ids':[_0x15dd59['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6c85('0x51')]=function(_0x1323b0,_0x563aee,_0x4cd2ff,_0x413402,_0x3fcb4b,_0x482468){var _0xb378fa,_0x3b1f2d,_0x34352e,_0x13e6cf;_0x482468['remoteUri']=intUtil[_0x6c85('0x52')](_0x482468[_0x6c85('0x53')]);_0x482468[_0x6c85('0x54')]=intUtil['stripTrailingSlash'](_0x482468[_0x6c85('0x54')]);def[_0x6c85('0x55')]=util[_0x6c85('0x24')](_0x6c85('0x56'),_0x482468['remoteUri']);if(_0x3fcb4b&&_0x3fcb4b[_0x6c85('0x57')]){logger['info'](_0x6c85('0x58'),_0x6c85('0x59'));_0x563aee[_0x6c85('0x5a')]=util[_0x6c85('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x482468[_0x6c85('0x54')],_0x563aee[_0x6c85('0x5b')],md5(_0x563aee[_0x6c85('0x5b')]));}else{_0x563aee['recordingURL']='';}return getConnection(_0x482468)['then'](function(_0x452244){_0x13e6cf=_0x452244;return getUser(_0x482468,_0x413402[_0x6c85('0x11')],_0x13e6cf);})[_0x6c85('0x2d')](function(_0x402ca5){_0xb378fa=_0x402ca5;logger[_0x6c85('0xf')](_0x6c85('0x5c'),_0xb378fa['id']);return getEndUser(_0x482468,_0x563aee['calleridname'],_0x563aee[_0x6c85('0x5d')],_0x13e6cf);})[_0x6c85('0x2d')](function(_0x5735ea){_0x3b1f2d=_0x5735ea;logger['info'](_0x6c85('0x5e'),_0x3b1f2d['id']);return getTicket(_0x482468,_0xb378fa,_0x3b1f2d,_0x4cd2ff,_0x563aee,_0x4cd2ff[_0x6c85('0x5f')],_0x13e6cf,'Inbound');})['then'](function(_0x57403f){_0x34352e=_0x57403f;logger[_0x6c85('0xf')](_0x6c85('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x34352e['id']);return setRelationship(_0x13e6cf,_0xb378fa,_0x34352e,_0x6c85('0x61'));})[_0x6c85('0x2d')](function(){return setRelationship(_0x13e6cf,_0x3b1f2d,_0x34352e,_0x6c85('0x62'));})['then'](function(){return getServerInfo(_0x13e6cf);})[_0x6c85('0x2d')](function(_0xfd04bb){var _0x40fb05=parseInt(_0xfd04bb['version'][_0x6c85('0x63')](0x0));var _0x522ee4=util['format'](_0x6c85('0x64'),_0x482468[_0x6c85('0x53')],_0x34352e['id']);if(_0x40fb05>0x6){_0x522ee4=util['format'](_0x6c85('0x65'),_0x482468[_0x6c85('0x53')],_0x34352e['id']);}logger[_0x6c85('0xf')](_0x6c85('0x58'),_0x6c85('0x66'));emit(util[_0x6c85('0x24')](_0x6c85('0x67'),_0x413402[_0x6c85('0x11')]),_0x6c85('0x68'),{'uri':_0x522ee4});})['catch'](function(_0x91ab11){logger[_0x6c85('0x69')](_0x6c85('0x58'),JSON[_0x6c85('0x23')](_0x91ab11));});};exports[_0x6c85('0x6a')]=function(_0x2b3c87,_0x3712dc,_0x495761,_0x30defe,_0x1f3d26,_0x465c43,_0x50ff7c){var _0x54e23a,_0x1e1c19,_0x2434bc,_0x59b071;_0x465c43[_0x6c85('0x53')]=intUtil['stripTrailingSlash'](_0x465c43[_0x6c85('0x53')]);_0x465c43[_0x6c85('0x54')]=intUtil['stripTrailingSlash'](_0x465c43['serverUrl']);def[_0x6c85('0x55')]=util['format'](_0x6c85('0x56'),_0x465c43[_0x6c85('0x53')]);if(_0x50ff7c&&_0x50ff7c[_0x6c85('0x6b')]&&_0x50ff7c['recordingFormat']!==_0x6c85('0x6c')){logger[_0x6c85('0xf')](_0x6c85('0x6d'),_0x6c85('0x59'));_0x3712dc[_0x6c85('0x5a')]=util[_0x6c85('0x24')](_0x6c85('0x6e'),_0x465c43['serverUrl'],_0x3712dc['uniqueid'],md5(_0x3712dc['uniqueid']));}return getConnection(_0x465c43)['then'](function(_0x4b7db5){_0x59b071=_0x4b7db5;return getUser(_0x465c43,_0x30defe['name'],_0x59b071);})['then'](function(_0x3b2929){_0x54e23a=_0x3b2929;logger[_0x6c85('0xf')](_0x6c85('0x5c'),_0x54e23a['id']);return getEndUser(_0x465c43,_0x3712dc[_0x6c85('0x6f')],_0x3712dc[_0x6c85('0x70')],_0x59b071);})['then'](function(_0x11dd2e){_0x1e1c19=_0x11dd2e;logger['info'](_0x6c85('0x5e'),_0x1e1c19['id']);return getTicket(_0x465c43,_0x54e23a,_0x1e1c19,_0x495761,_0x3712dc,_0x495761[_0x6c85('0x5f')],_0x59b071,'Outbound');})['then'](function(_0x132421){_0x2434bc=_0x132421;logger[_0x6c85('0xf')]('Ticket\x20created!');logger[_0x6c85('0xf')]('The\x20Ticket\x20ID\x20is:',_0x2434bc['id']);return setRelationship(_0x59b071,_0x54e23a,_0x2434bc,'users');})[_0x6c85('0x2d')](function(){return setRelationship(_0x59b071,_0x1e1c19,_0x2434bc,_0x6c85('0x62'));})[_0x6c85('0x2d')](function(){return getServerInfo(_0x59b071);})[_0x6c85('0x2d')](function(_0x1fe793){var _0x485ff5=parseInt(_0x1fe793[_0x6c85('0x71')]['charAt'](0x0));var _0x2e49ec=util['format'](_0x6c85('0x64'),_0x465c43[_0x6c85('0x53')],_0x2434bc['id']);if(_0x485ff5>0x6){_0x2e49ec=util[_0x6c85('0x24')](_0x6c85('0x65'),_0x465c43[_0x6c85('0x53')],_0x2434bc['id']);}logger[_0x6c85('0xf')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c85('0x24')](_0x6c85('0x67'),_0x30defe[_0x6c85('0x11')]),_0x6c85('0x68'),{'uri':_0x2e49ec});})['catch'](function(_0x4036b4){logger[_0x6c85('0x69')](_0x6c85('0x6d'),JSON['stringify'](_0x4036b4));});};exports[_0x6c85('0x72')]=function(_0x96015f,_0x50ba8e,_0x1cfcd4,_0x1c9560,_0x3acac4,_0x30f7fa){var _0x122ee0,_0x1642da,_0x1b447e,_0x578a1e;_0x30f7fa[_0x6c85('0x53')]=intUtil[_0x6c85('0x52')](_0x30f7fa[_0x6c85('0x53')]);_0x30f7fa[_0x6c85('0x54')]=intUtil[_0x6c85('0x52')](_0x30f7fa[_0x6c85('0x54')]);def[_0x6c85('0x55')]=util[_0x6c85('0x24')]('%s/service/v4_1/rest.php',_0x30f7fa[_0x6c85('0x53')]);if(_0x3acac4&&_0x3acac4['monitor_format']){logger['info']('['+_0x50ba8e[_0x6c85('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x50ba8e[_0x6c85('0x5a')]=util[_0x6c85('0x24')](_0x6c85('0x6e'),_0x30f7fa[_0x6c85('0x54')],_0x50ba8e[_0x6c85('0x5b')],md5(_0x50ba8e[_0x6c85('0x5b')]));}else{_0x50ba8e[_0x6c85('0x5a')]='';}return getConnection(_0x30f7fa)['then'](function(_0x186bf9){_0x578a1e=_0x186bf9;if(!_[_0x6c85('0x29')](_0x1c9560)){return getUser(_0x30f7fa,_0x1c9560['name'],_0x578a1e);}else{return getUser(_0x30f7fa,null,_0x578a1e);}})['then'](function(_0x5834a2){_0x122ee0=_0x5834a2;logger['info'](_0x6c85('0x5c'),_0x122ee0['id']);return getEndUser(_0x30f7fa,_0x50ba8e[_0x6c85('0x74')],_0x50ba8e[_0x6c85('0x5d')],_0x578a1e);})['then'](function(_0xcf46bb){_0x1642da=_0xcf46bb;logger['info'](_0x6c85('0x5e'),_0x1642da['id']);return getTicket(_0x30f7fa,_0x122ee0,_0x1642da,_0x1cfcd4,_0x50ba8e,_0x1cfcd4['Fields'],_0x578a1e,'Inbound');})[_0x6c85('0x2d')](function(_0x58354f){_0x1b447e=_0x58354f;logger[_0x6c85('0xf')](_0x6c85('0x60'));logger[_0x6c85('0xf')](_0x6c85('0x75'),_0x1b447e['id']);return setRelationship(_0x578a1e,_0x122ee0,_0x1b447e,_0x6c85('0x61'));})[_0x6c85('0x2d')](function(){return setRelationship(_0x578a1e,_0x1642da,_0x1b447e,_0x6c85('0x62'));})[_0x6c85('0x2d')](function(){return getServerInfo(_0x578a1e);})[_0x6c85('0x76')](function(_0x4ba721){logger[_0x6c85('0x69')]('['+_0x50ba8e['lastevent'][_0x6c85('0x77')]()+']',JSON[_0x6c85('0x23')](_0x4ba721));});}; \ 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 7340ae0..7ee9ae9 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 _0xd978=['string','push','content','variable','variableName','toString','name','Variable','keyValue','keyType','key','format','%s:\x20%s','toLowerCase','join','stripTrailingSlash','lastIndexOf','isNil','test','lodash','util','length','sortBy','type'];(function(_0x32bf18,_0x41b75b){var _0x53dbcd=function(_0xb33ac9){while(--_0xb33ac9){_0x32bf18['push'](_0x32bf18['shift']());}};_0x53dbcd(++_0x41b75b);}(_0xd978,0x73));var _0x8d97=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xd978[_0x1a595a];return _0x33f008;};'use strict';var _=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));exports['getString']=function(_0x2d7a82,_0x3ddb9c,_0x43f353){var _0x4e2b03=[];if(_0x2d7a82[_0x8d97('0x2')]>0x0){var _0x179e25=_[_0x8d97('0x3')](_0x2d7a82,['id']);for(var _0x5601c6=0x0;_0x5601c6<_0x179e25['length'];_0x5601c6++){var _0x5e44ca=_0x179e25[_0x5601c6];if(_0x5e44ca[_0x8d97('0x4')]===_0x8d97('0x5')){_0x4e2b03[_0x8d97('0x6')](_0x5e44ca[_0x8d97('0x7')]);}else if(_0x5e44ca[_0x8d97('0x4')]===_0x8d97('0x8')&&_0x5e44ca[_0x8d97('0x9')]){_0x3ddb9c[_0x5e44ca[_0x8d97('0x9')]]&&_0x4e2b03['push'](_0x3ddb9c[_0x5e44ca[_0x8d97('0x9')]][_0x8d97('0xa')]());}else if(_0x5e44ca['type']==='customVariable'&&_0x5e44ca['Variable']&&_0x5e44ca['Variable']['name']){_0x3ddb9c[_0x5e44ca['Variable'][_0x8d97('0xb')]['toLowerCase']()]&&_0x4e2b03[_0x8d97('0x6')](_0x3ddb9c[_0x5e44ca[_0x8d97('0xc')][_0x8d97('0xb')]['toLowerCase']()][_0x8d97('0xa')]());}else if(_0x5e44ca[_0x8d97('0x4')]===_0x8d97('0xd')){if(_0x5e44ca[_0x8d97('0xe')]===_0x8d97('0x5')&&_0x5e44ca[_0x8d97('0xf')]){_0x4e2b03[_0x8d97('0x6')](util[_0x8d97('0x10')](_0x8d97('0x11'),_0x5e44ca['key'],_0x5e44ca['keyContent']));}else if(_0x5e44ca[_0x8d97('0xe')]===_0x8d97('0x8')&&_0x5e44ca[_0x8d97('0x9')]&&_0x5e44ca[_0x8d97('0xf')]){_0x3ddb9c[_0x5e44ca['variableName']]&&_0x4e2b03[_0x8d97('0x6')](util[_0x8d97('0x10')](_0x8d97('0x11'),_0x5e44ca[_0x8d97('0xf')],_0x3ddb9c[_0x5e44ca[_0x8d97('0x9')]]));}else if(_0x5e44ca[_0x8d97('0xe')]==='customVariable'&&_0x5e44ca[_0x8d97('0xc')]&&_0x5e44ca['Variable'][_0x8d97('0xb')]&&_0x5e44ca[_0x8d97('0xf')]){_0x3ddb9c[_0x5e44ca[_0x8d97('0xc')][_0x8d97('0xb')][_0x8d97('0x12')]()]&&_0x4e2b03[_0x8d97('0x6')](util['format']('%s:\x20%s',_0x5e44ca[_0x8d97('0xf')],_0x3ddb9c[_0x5e44ca[_0x8d97('0xc')][_0x8d97('0xb')][_0x8d97('0x12')]()]));}}}}return _0x4e2b03[_0x8d97('0x13')](_0x43f353);};exports[_0x8d97('0x14')]=function(_0x401b46){var _0x58e73f=_0x401b46['slice'](-0x1);if(_0x58e73f==='/'){_0x401b46=_0x401b46['substring'](0x0,_0x401b46[_0x8d97('0x15')](_0x58e73f));}return _0x401b46;};exports['validateEmail']=function(_0x205db9){if(!_[_0x8d97('0x16')](_0x205db9)&&_0x205db9!==''){var _0x550c8d=/^(([^<>()\[\]\\.,;:\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 _0x550c8d[_0x8d97('0x17')](String(_0x205db9)[_0x8d97('0x12')]());}else{return![];}}; \ No newline at end of file +var _0x0176=['%s:\x20%s','join','slice','lastIndexOf','validateEmail','lodash','util','length','sortBy','push','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','string','key','format','keyContent','keyType'];(function(_0x32f08e,_0x53860c){var _0x1300e5=function(_0x314c51){while(--_0x314c51){_0x32f08e['push'](_0x32f08e['shift']());}};_0x1300e5(++_0x53860c);}(_0x0176,0xdd));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6017('0x0'));var util=require(_0x6017('0x1'));exports['getString']=function(_0x3de91a,_0x5185ff,_0x173a36){var _0x163f29=[];if(_0x3de91a[_0x6017('0x2')]>0x0){var _0x293fb7=_[_0x6017('0x3')](_0x3de91a,['id']);for(var _0x4fe62b=0x0;_0x4fe62b<_0x293fb7[_0x6017('0x2')];_0x4fe62b++){var _0x5a7fb9=_0x293fb7[_0x4fe62b];if(_0x5a7fb9['type']==='string'){_0x163f29[_0x6017('0x4')](_0x5a7fb9['content']);}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0x6')&&_0x5a7fb9['variableName']){_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]&&_0x163f29[_0x6017('0x4')](_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]['toString']());}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0x8')&&_0x5a7fb9[_0x6017('0x9')]&&_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]){_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')][_0x6017('0xb')]()]&&_0x163f29['push'](_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]['toLowerCase']()][_0x6017('0xc')]());}else if(_0x5a7fb9[_0x6017('0x5')]===_0x6017('0xd')){if(_0x5a7fb9['keyType']===_0x6017('0xe')&&_0x5a7fb9[_0x6017('0xf')]){_0x163f29['push'](util[_0x6017('0x10')]('%s:\x20%s',_0x5a7fb9['key'],_0x5a7fb9[_0x6017('0x11')]));}else if(_0x5a7fb9[_0x6017('0x12')]===_0x6017('0x6')&&_0x5a7fb9['variableName']&&_0x5a7fb9[_0x6017('0xf')]){_0x5185ff[_0x5a7fb9[_0x6017('0x7')]]&&_0x163f29[_0x6017('0x4')](util['format'](_0x6017('0x13'),_0x5a7fb9[_0x6017('0xf')],_0x5185ff[_0x5a7fb9['variableName']]));}else if(_0x5a7fb9[_0x6017('0x12')]==='customVariable'&&_0x5a7fb9[_0x6017('0x9')]&&_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]&&_0x5a7fb9['key']){_0x5185ff[_0x5a7fb9['Variable']['name'][_0x6017('0xb')]()]&&_0x163f29[_0x6017('0x4')](util[_0x6017('0x10')](_0x6017('0x13'),_0x5a7fb9[_0x6017('0xf')],_0x5185ff[_0x5a7fb9[_0x6017('0x9')][_0x6017('0xa')]['toLowerCase']()]));}}}}return _0x163f29[_0x6017('0x14')](_0x173a36);};exports['stripTrailingSlash']=function(_0x455465){var _0x191a1d=_0x455465[_0x6017('0x15')](-0x1);if(_0x191a1d==='/'){_0x455465=_0x455465['substring'](0x0,_0x455465[_0x6017('0x16')](_0x191a1d));}return _0x455465;};exports[_0x6017('0x17')]=function(_0x57500e){if(!_['isNil'](_0x57500e)&&_0x57500e!==''){var _0x471c79=/^(([^<>()\[\]\\.,;:\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 _0x471c79['test'](String(_0x57500e)[_0x6017('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 929211a..d3bac53 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x3890fb,_0x118ec1){var _0x309cb2=function(_0x4c5f82){while(--_0x4c5f82){_0x3890fb['push'](_0x3890fb['shift']());}};_0x309cb2(++_0x118ec1);}(_0x34e8,0x12c));var _0x834e=function(_0xfe4c91,_0x29fea8){_0xfe4c91=_0xfe4c91-0x0;var _0x4b5aca=_0x34e8[_0xfe4c91];return _0x4b5aca;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index ab3a4f3..962b1b6 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 _0xf607=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','replace','/api/v2','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','getString','Descriptions','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','results','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','map','string','picklist','type','nameField','customField','content','includes','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl'];(function(_0x5476f6,_0x5ea695){var _0x216cc0=function(_0x28d0d9){while(--_0x28d0d9){_0x5476f6['push'](_0x5476f6['shift']());}};_0x216cc0(++_0x5ea695);}(_0xf607,0x1cc));var _0x7f60=function(_0x5a22b8,_0x4159f7){_0x5a22b8=_0x5a22b8-0x0;var _0xff998e=_0xf607[_0x5a22b8];return _0xff998e;};'use strict';var _=require(_0x7f60('0x0'));var rp=require(_0x7f60('0x1'));var md5=require(_0x7f60('0x2'));var util=require(_0x7f60('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7f60('0x4'));var config=require(_0x7f60('0x5'));var logger=require(_0x7f60('0x6'))(_0x7f60('0x7'));config[_0x7f60('0x8')]=_[_0x7f60('0x9')](config['redis'],{'host':_0x7f60('0xa'),'port':0x18eb});var io=require(_0x7f60('0xb'))(new Redis(config[_0x7f60('0x8')]));function emit(_0x574f0e,_0x438436,_0x4a472f){io['to'](_0x574f0e)['emit'](_0x438436,_0x4a472f);}var headers={'Content-Type':_0x7f60('0xc'),'Accept':_0x7f60('0xc')};function getTicket(_0xbd4dd4,_0x5596dd,_0x19f966,_0x54ff4a,_0x23599c){logger['info'](_0x7f60('0xd'));return request({'uri':util[_0x7f60('0xe')]('%s/tickets.json',_0xbd4dd4['remoteUri']),'method':_0x7f60('0xf'),'body':{'ticket':_[_0x7f60('0x10')]({'requester_id':_0x19f966['id'],'submitter_id':_0x5596dd?_0x5596dd['id']:undefined,'assignee_id':_0x5596dd?_0x5596dd['id']:undefined,'tags':getTags(_0x54ff4a[_0x7f60('0x11')],_0x7f60('0x12')),'subject':intUtil[_0x7f60('0x13')](_0x54ff4a['Subjects'],_0x23599c,'\x20'),'description':intUtil[_0x7f60('0x13')](_0x54ff4a['Descriptions'],_0x23599c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7f60('0x13')](_0x54ff4a[_0x7f60('0x14')],_0x23599c,'\x0a')}},getCustomFields(_0x54ff4a['Fields'],_0x23599c))}})[_0x7f60('0x15')](function(_0x1ed47e){logger[_0x7f60('0x16')]('Ticket\x20created!');return _0x1ed47e[_0x7f60('0x17')];});}function getUser(_0x4e30fb,_0x15b395){if(intUtil[_0x7f60('0x18')](_0x15b395)){logger['info'](_0x7f60('0x19'),_0x15b395);return request({'uri':util['format']('%s/search.json',_0x4e30fb['remoteUri']),'qs':{'query':util[_0x7f60('0xe')]('type:user\x20role:agent\x20email:%s',_0x15b395)}})[_0x7f60('0x15')](function(_0x3f972f){if(_0x3f972f['count']){logger[_0x7f60('0x16')]('Agent\x20found!');return _['find'](_0x3f972f[_0x7f60('0x1a')],{'email':_0x15b395,'role':'agent'});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7f60('0x1b'),_0x4e30fb['remoteUri'])})[_0x7f60('0x15')](function(_0xccd7f4){logger[_0x7f60('0x16')]('Admin\x20account\x20selected.');return _0xccd7f4[_0x7f60('0x1c')];});}});}else{logger[_0x7f60('0x16')](_0x7f60('0x1d'));return request({'uri':util['format']('%s/users/me.json',_0x4e30fb[_0x7f60('0x1e')])})['then'](function(_0x22c75f){logger[_0x7f60('0x16')](_0x7f60('0x1f'));return _0x22c75f[_0x7f60('0x1c')];});}}function getEndUser(_0x2a2c0b,_0x56aa7a,_0x4b3cea){logger[_0x7f60('0x16')](_0x7f60('0x20'),_0x4b3cea);return request({'uri':util['format'](_0x7f60('0x21'),_0x2a2c0b[_0x7f60('0x1e')]),'qs':{'query':util[_0x7f60('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x4b3cea)}})[_0x7f60('0x15')](function(_0x28aaed){var _0x5880be;if(_0x28aaed[_0x7f60('0x1a')][_0x7f60('0x22')]){_0x28aaed[_0x7f60('0x1a')]=_[_0x7f60('0x23')](_0x28aaed[_0x7f60('0x1a')],{'suspended':![],'role':_0x7f60('0x24')});if(_0x28aaed[_0x7f60('0x1a')]['length']){_0x5880be=_['first'](_0x28aaed['results']);}}if(_0x5880be){logger[_0x7f60('0x16')](_0x7f60('0x25'));return _0x5880be;}else{logger[_0x7f60('0x16')](_0x7f60('0x26'));return request({'uri':util['format'](_0x7f60('0x27'),_0x2a2c0b[_0x7f60('0x1e')]),'method':_0x7f60('0xf'),'body':{'user':{'role':_0x7f60('0x24'),'name':util['format'](_0x7f60('0x28'),_0x56aa7a||_0x4b3cea),'phone':_0x4b3cea}}})[_0x7f60('0x15')](function(_0x5de7c4){logger[_0x7f60('0x16')]('Enduser\x20created.');return _0x5de7c4['user'];});}});}function getAuth(_0x4a0509){var _0xe9ce62;if(_0x4a0509[_0x7f60('0x29')]==='password'){_0xe9ce62=util[_0x7f60('0xe')](_0x7f60('0x2a'),_0x4a0509[_0x7f60('0x2b')],_0x4a0509[_0x7f60('0x2c')]);}else if(_0x4a0509[_0x7f60('0x29')]===_0x7f60('0x2d')){_0xe9ce62=util[_0x7f60('0xe')](_0x7f60('0x2e'),_0x4a0509[_0x7f60('0x2b')],_0x4a0509[_0x7f60('0x2d')]);}return util['format'](_0x7f60('0x2f'),new Buffer(_0xe9ce62)[_0x7f60('0x30')](_0x7f60('0x31')));}function request(_0x32508a){logger['debug']('[HTTP]',JSON[_0x7f60('0x32')](_0x32508a));return rp(_[_0x7f60('0x9')](_0x32508a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1f2fa0,_0x59a78b){var _0x420520=[];if(_0x1f2fa0&&_0x1f2fa0[_0x7f60('0x22')]>0x0){_0x420520=_[_0x7f60('0x33')](_0x1f2fa0,_0x59a78b);}return _0x420520;}function getCustomFields(_0x4a5843,_0x49ef1f){var _0x1912f1=[];var _0x192a86={'custom_fields':[]};if(_0x4a5843['length']>0x0){_['forEach'](_0x4a5843,function(_0xce07c9){if(_['includes']([_0x7f60('0x34'),_0x7f60('0x35')],_0xce07c9[_0x7f60('0x36')])&&_0xce07c9[_0x7f60('0x37')]&&!_0xce07c9[_0x7f60('0x38')]){_0x192a86[_0xce07c9[_0x7f60('0x37')]['toLowerCase']()]=_0xce07c9[_0x7f60('0x39')][_0x7f60('0x30')]();}else if(_[_0x7f60('0x3a')]([_0x7f60('0x34'),_0x7f60('0x35')],_0xce07c9[_0x7f60('0x36')])&&_0xce07c9[_0x7f60('0x3b')]&&_0xce07c9[_0x7f60('0x38')]){_0x192a86[_0x7f60('0x3c')][_0x7f60('0x3d')]({'id':_0xce07c9[_0x7f60('0x3b')],'value':_0xce07c9[_0x7f60('0x39')][_0x7f60('0x30')]()});}else if(_0xce07c9[_0x7f60('0x36')]===_0x7f60('0x3e')&&_0xce07c9[_0x7f60('0x3f')]&&_0xce07c9[_0x7f60('0x3b')]&&_0xce07c9['customField']){_0x49ef1f[_0xce07c9[_0x7f60('0x3f')]]&&_0x192a86[_0x7f60('0x3c')][_0x7f60('0x3d')]({'id':_0xce07c9[_0x7f60('0x3b')],'value':_0x49ef1f[_0xce07c9[_0x7f60('0x3f')]][_0x7f60('0x30')]()});}else if(_0xce07c9[_0x7f60('0x36')]===_0x7f60('0x40')&&_0xce07c9[_0x7f60('0x41')]&&_0xce07c9[_0x7f60('0x41')][_0x7f60('0x12')]&&_0xce07c9[_0x7f60('0x3b')]&&_0xce07c9['customField']){_0x49ef1f[_0xce07c9[_0x7f60('0x41')][_0x7f60('0x12')][_0x7f60('0x42')]()]&&_0x192a86[_0x7f60('0x3c')][_0x7f60('0x3d')]({'id':_0xce07c9['idField'],'value':_0x49ef1f[_0xce07c9[_0x7f60('0x41')][_0x7f60('0x12')][_0x7f60('0x42')]()][_0x7f60('0x30')]()});}});}return _0x192a86;}exports[_0x7f60('0x43')]=function(_0x5e7540,_0x25dc5f,_0xfb2eec,_0x2e7c03,_0x4a637b,_0x224cbb){var _0x3a835b,_0x3e525f;_0x224cbb[_0x7f60('0x1e')]=intUtil[_0x7f60('0x44')](_0x224cbb[_0x7f60('0x1e')]);_0x224cbb[_0x7f60('0x45')]=intUtil[_0x7f60('0x44')](_0x224cbb[_0x7f60('0x45')]);if(_0x4a637b&&_0x4a637b[_0x7f60('0x46')]){logger[_0x7f60('0x16')](_0x7f60('0x47'),_0x7f60('0x48'));_0x25dc5f[_0x7f60('0x49')]=util['format'](_0x7f60('0x4a'),_0x224cbb[_0x7f60('0x45')],_0x25dc5f[_0x7f60('0x4b')],md5(_0x25dc5f[_0x7f60('0x4b')]));}else{_0x25dc5f['recordingURL']='';}headers['Authorization']=getAuth(_0x224cbb);return getUser(_0x224cbb,_0x2e7c03[_0x7f60('0x4c')])[_0x7f60('0x15')](function(_0x2e87b8){_0x3a835b=_0x2e87b8;logger[_0x7f60('0x16')](_0x7f60('0x4d'),_0x3a835b['id']);return getEndUser(_0x224cbb,_0x25dc5f[_0x7f60('0x4e')],_0x25dc5f[_0x7f60('0x4f')]);})['then'](function(_0x6d502e){_0x3e525f=_0x6d502e;logger[_0x7f60('0x16')](_0x7f60('0x50'),_0x3e525f['id']);return getTicket(_0x224cbb,_0x3a835b,_0x3e525f,_0xfb2eec,_0x25dc5f);})['then'](function(_0x3f9b73){if(_0x3f9b73){logger[_0x7f60('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3f9b73['id']);switch(_0x224cbb[_0x7f60('0x36')]){case _0x7f60('0x51'):logger[_0x7f60('0x16')](_0x7f60('0x47'),_0x7f60('0x52'));return request({'uri':util[_0x7f60('0xe')](_0x7f60('0x53'),_0x224cbb[_0x7f60('0x1e')],_0x3a835b['id'],_0x3f9b73['id']),'method':_0x7f60('0xf')});case _0x7f60('0x54'):logger[_0x7f60('0x16')](_0x7f60('0x47'),_0x7f60('0x55'));emit(util['format'](_0x7f60('0x56'),_0x2e7c03['name']),_0x7f60('0x57'),{'uri':util[_0x7f60('0xe')](_0x7f60('0x58'),_0x224cbb['remoteUri']['replace']('/api/v2',''),_0x3f9b73['id'])});break;default:logger['error'](_0x7f60('0x47'),_0x7f60('0x59'));}}})[_0x7f60('0x5a')](function(_0x2b8d82){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2b8d82,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2918dc,_0x1923fa,_0x57f120,_0x4afd92,_0x202cdb,_0x34af86,_0xd42009){var _0xfa478e,_0x155297;_0x34af86[_0x7f60('0x1e')]=intUtil[_0x7f60('0x44')](_0x34af86['remoteUri']);_0x34af86['serverUrl']=intUtil[_0x7f60('0x44')](_0x34af86[_0x7f60('0x45')]);if(_0xd42009&&_0xd42009[_0x7f60('0x5b')]&&_0xd42009[_0x7f60('0x5b')]!==_0x7f60('0x5c')){logger[_0x7f60('0x16')](_0x7f60('0x5d'),_0x7f60('0x48'));_0x1923fa[_0x7f60('0x49')]=util[_0x7f60('0xe')](_0x7f60('0x4a'),_0x34af86['serverUrl'],_0x1923fa[_0x7f60('0x4b')],md5(_0x1923fa[_0x7f60('0x4b')]));}headers[_0x7f60('0x5e')]=getAuth(_0x34af86);return getUser(_0x34af86,_0x4afd92[_0x7f60('0x4c')])[_0x7f60('0x15')](function(_0x37d147){_0xfa478e=_0x37d147;logger[_0x7f60('0x16')](_0x7f60('0x4d'),_0xfa478e['id']);return getEndUser(_0x34af86,_0x1923fa['destcalleridname'],_0x1923fa[_0x7f60('0x5f')]);})[_0x7f60('0x15')](function(_0x47ef25){_0x155297=_0x47ef25;logger[_0x7f60('0x16')](_0x7f60('0x50'),_0x155297['id']);return getTicket(_0x34af86,_0xfa478e,_0x155297,_0x57f120,_0x1923fa);})[_0x7f60('0x15')](function(_0x281f6d){if(_0x281f6d){logger['info'](_0x7f60('0x60'),_0x281f6d['id']);switch(_0x34af86[_0x7f60('0x36')]){case _0x7f60('0x51'):logger[_0x7f60('0x16')](_0x7f60('0x5d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7f60('0xe')](_0x7f60('0x53'),_0x34af86[_0x7f60('0x1e')],_0xfa478e['id'],_0x281f6d['id']),'method':_0x7f60('0xf')});case _0x7f60('0x54'):logger[_0x7f60('0x16')](_0x7f60('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7f60('0x56'),_0x4afd92[_0x7f60('0x12')]),_0x7f60('0x57'),{'uri':util[_0x7f60('0xe')](_0x7f60('0x58'),_0x34af86['remoteUri'][_0x7f60('0x61')](_0x7f60('0x62'),''),_0x281f6d['id'])});break;default:logger[_0x7f60('0x63')](_0x7f60('0x5d'),_0x7f60('0x59'));}}})[_0x7f60('0x5a')](function(_0x11a080){logger[_0x7f60('0x63')](_0x7f60('0x64'),util[_0x7f60('0x65')](_0x11a080,{'showHidden':!![],'depth':null}));});};exports[_0x7f60('0x66')]=function(_0x2ff7d0,_0x58d02a,_0x2a16ef,_0x1c0f4a,_0x2757c2,_0x1d1df0){var _0x51aa10,_0x14d290;_0x1d1df0[_0x7f60('0x1e')]=intUtil[_0x7f60('0x44')](_0x1d1df0['remoteUri']);_0x1d1df0[_0x7f60('0x45')]=intUtil[_0x7f60('0x44')](_0x1d1df0[_0x7f60('0x45')]);if(_0x2757c2&&_0x2757c2[_0x7f60('0x46')]){logger['info']('['+_0x58d02a[_0x7f60('0x67')][_0x7f60('0x68')]()+']',_0x7f60('0x48'));_0x58d02a[_0x7f60('0x49')]=util[_0x7f60('0xe')](_0x7f60('0x4a'),_0x1d1df0['serverUrl'],_0x58d02a['uniqueid'],md5(_0x58d02a[_0x7f60('0x4b')]));}else{_0x58d02a[_0x7f60('0x49')]='';}headers[_0x7f60('0x5e')]=getAuth(_0x1d1df0);return getUser(_0x1d1df0)[_0x7f60('0x15')](function(_0x10a4e4){_0x51aa10=_0x10a4e4;logger[_0x7f60('0x16')](_0x7f60('0x4d'),_0x51aa10['id']);return getEndUser(_0x1d1df0,_0x58d02a[_0x7f60('0x4e')],_0x58d02a[_0x7f60('0x4f')]);})[_0x7f60('0x15')](function(_0x33ef4a){_0x14d290=_0x33ef4a;logger[_0x7f60('0x16')]('The\x20Enduser\x20ID\x20is:',_0x14d290['id']);return getTicket(_0x1d1df0,_0x51aa10,_0x14d290,_0x2a16ef,_0x58d02a);})[_0x7f60('0x15')](function(_0x116a87){if(_0x116a87){logger[_0x7f60('0x16')](_0x7f60('0x60'),_0x116a87['id']);}})[_0x7f60('0x5a')](function(_0x54023c){logger[_0x7f60('0x63')]('['+_0x58d02a[_0x7f60('0x67')][_0x7f60('0x68')]()+']'+_0x7f60('0x69'),util[_0x7f60('0x65')](_0x54023c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa255=['count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','username','password','%s/token:%s','base64','debug','[HTTP]','stringify','map','forEach','string','type','customField','toLowerCase','content','toString','custom_fields','push','variable','variableName','idField','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','newTab','replace','unmanaged','monitor_format','lastevent','The\x20User\x20ID\x20is:','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa255,0x12c));var _0x5a25=function(_0x536d70,_0xa88ce3){_0x536d70=_0x536d70-0x0;var _0x455ed3=_0xa255[_0x536d70];return _0x455ed3;};'use strict';var _=require(_0x5a25('0x0'));var rp=require(_0x5a25('0x1'));var md5=require(_0x5a25('0x2'));var util=require(_0x5a25('0x3'));var Redis=require(_0x5a25('0x4'));var intUtil=require(_0x5a25('0x5'));var config=require(_0x5a25('0x6'));var logger=require(_0x5a25('0x7'))('zendesk');config[_0x5a25('0x8')]=_[_0x5a25('0x9')](config[_0x5a25('0x8')],{'host':_0x5a25('0xa'),'port':0x18eb});var io=require(_0x5a25('0xb'))(new Redis(config[_0x5a25('0x8')]));function emit(_0x290a05,_0x15c184,_0x4cf01e){io['to'](_0x290a05)['emit'](_0x15c184,_0x4cf01e);}var headers={'Content-Type':_0x5a25('0xc'),'Accept':_0x5a25('0xc')};function getTicket(_0x391a16,_0x136e74,_0x1bad64,_0x1807bd,_0x29941c){logger[_0x5a25('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x5a25('0xe')](_0x5a25('0xf'),_0x391a16[_0x5a25('0x10')]),'method':_0x5a25('0x11'),'body':{'ticket':_[_0x5a25('0x12')]({'requester_id':_0x1bad64['id'],'submitter_id':_0x136e74?_0x136e74['id']:undefined,'assignee_id':_0x136e74?_0x136e74['id']:undefined,'tags':getTags(_0x1807bd[_0x5a25('0x13')],'name'),'subject':intUtil[_0x5a25('0x14')](_0x1807bd[_0x5a25('0x15')],_0x29941c,'\x20'),'description':intUtil[_0x5a25('0x14')](_0x1807bd[_0x5a25('0x16')],_0x29941c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1807bd[_0x5a25('0x16')],_0x29941c,'\x0a')}},getCustomFields(_0x1807bd[_0x5a25('0x17')],_0x29941c))}})[_0x5a25('0x18')](function(_0x431140){logger[_0x5a25('0xd')](_0x5a25('0x19'));return _0x431140[_0x5a25('0x1a')];});}function getUser(_0x42395c,_0x27257e){if(intUtil[_0x5a25('0x1b')](_0x27257e)){logger['info'](_0x5a25('0x1c'),_0x27257e);return request({'uri':util['format'](_0x5a25('0x1d'),_0x42395c['remoteUri']),'qs':{'query':util[_0x5a25('0xe')]('type:user\x20role:agent\x20email:%s',_0x27257e)}})[_0x5a25('0x18')](function(_0x554f43){if(_0x554f43[_0x5a25('0x1e')]){logger['info'](_0x5a25('0x1f'));return _['find'](_0x554f43[_0x5a25('0x20')],{'email':_0x27257e,'role':_0x5a25('0x21')});}else{logger['info'](_0x5a25('0x22'));return request({'uri':util[_0x5a25('0xe')]('%s/users/me.json',_0x42395c['remoteUri'])})[_0x5a25('0x18')](function(_0x13bee6){logger[_0x5a25('0xd')](_0x5a25('0x23'));return _0x13bee6[_0x5a25('0x24')];});}});}else{logger[_0x5a25('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x42395c['remoteUri'])})[_0x5a25('0x18')](function(_0x1c79c0){logger[_0x5a25('0xd')]('Admin\x20account\x20selected.');return _0x1c79c0[_0x5a25('0x24')];});}}function getEndUser(_0x127f0e,_0x4b9479,_0x2bea51){logger[_0x5a25('0xd')](_0x5a25('0x25'),_0x2bea51);return request({'uri':util['format'](_0x5a25('0x1d'),_0x127f0e['remoteUri']),'qs':{'query':util[_0x5a25('0xe')](_0x5a25('0x26'),_0x2bea51)}})[_0x5a25('0x18')](function(_0x4bf9b4){var _0x67c91b;if(_0x4bf9b4[_0x5a25('0x20')][_0x5a25('0x27')]){_0x4bf9b4[_0x5a25('0x20')]=_[_0x5a25('0x28')](_0x4bf9b4['results'],{'suspended':![],'role':_0x5a25('0x29')});if(_0x4bf9b4[_0x5a25('0x20')][_0x5a25('0x27')]){_0x67c91b=_[_0x5a25('0x2a')](_0x4bf9b4[_0x5a25('0x20')]);}}if(_0x67c91b){logger[_0x5a25('0xd')](_0x5a25('0x2b'));return _0x67c91b;}else{logger[_0x5a25('0xd')](_0x5a25('0x2c'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x2d'),_0x127f0e[_0x5a25('0x10')]),'method':'POST','body':{'user':{'role':_0x5a25('0x29'),'name':util[_0x5a25('0xe')]('Caller\x20-\x20%s',_0x4b9479||_0x2bea51),'phone':_0x2bea51}}})['then'](function(_0x58c270){logger['info'](_0x5a25('0x2e'));return _0x58c270[_0x5a25('0x24')];});}});}function getAuth(_0x484897){var _0x23418b;if(_0x484897[_0x5a25('0x2f')]==='password'){_0x23418b=util[_0x5a25('0xe')](_0x5a25('0x30'),_0x484897[_0x5a25('0x31')],_0x484897[_0x5a25('0x32')]);}else if(_0x484897['authType']==='token'){_0x23418b=util[_0x5a25('0xe')](_0x5a25('0x33'),_0x484897['username'],_0x484897['token']);}return util[_0x5a25('0xe')]('Basic\x20%s',new Buffer(_0x23418b)['toString'](_0x5a25('0x34')));}function request(_0x531e06){logger[_0x5a25('0x35')](_0x5a25('0x36'),JSON[_0x5a25('0x37')](_0x531e06));return rp(_[_0x5a25('0x9')](_0x531e06,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2be5d7,_0x4dbb73){var _0x9eabdf=[];if(_0x2be5d7&&_0x2be5d7[_0x5a25('0x27')]>0x0){_0x9eabdf=_[_0x5a25('0x38')](_0x2be5d7,_0x4dbb73);}return _0x9eabdf;}function getCustomFields(_0x3460ac,_0x2fac06){var _0x4e19ac=[];var _0x239bf6={'custom_fields':[]};if(_0x3460ac[_0x5a25('0x27')]>0x0){_[_0x5a25('0x39')](_0x3460ac,function(_0x48d140){if(_['includes']([_0x5a25('0x3a'),'picklist'],_0x48d140[_0x5a25('0x3b')])&&_0x48d140['nameField']&&!_0x48d140[_0x5a25('0x3c')]){_0x239bf6[_0x48d140['nameField'][_0x5a25('0x3d')]()]=_0x48d140[_0x5a25('0x3e')][_0x5a25('0x3f')]();}else if(_['includes']([_0x5a25('0x3a'),'picklist'],_0x48d140[_0x5a25('0x3b')])&&_0x48d140['idField']&&_0x48d140[_0x5a25('0x3c')]){_0x239bf6[_0x5a25('0x40')][_0x5a25('0x41')]({'id':_0x48d140['idField'],'value':_0x48d140[_0x5a25('0x3e')][_0x5a25('0x3f')]()});}else if(_0x48d140[_0x5a25('0x3b')]===_0x5a25('0x42')&&_0x48d140[_0x5a25('0x43')]&&_0x48d140['idField']&&_0x48d140[_0x5a25('0x3c')]){_0x2fac06[_0x48d140[_0x5a25('0x43')]]&&_0x239bf6['custom_fields']['push']({'id':_0x48d140[_0x5a25('0x44')],'value':_0x2fac06[_0x48d140[_0x5a25('0x43')]]['toString']()});}else if(_0x48d140['type']===_0x5a25('0x45')&&_0x48d140[_0x5a25('0x46')]&&_0x48d140[_0x5a25('0x46')][_0x5a25('0x47')]&&_0x48d140[_0x5a25('0x44')]&&_0x48d140[_0x5a25('0x3c')]){_0x2fac06[_0x48d140[_0x5a25('0x46')]['name'][_0x5a25('0x3d')]()]&&_0x239bf6[_0x5a25('0x40')][_0x5a25('0x41')]({'id':_0x48d140['idField'],'value':_0x2fac06[_0x48d140[_0x5a25('0x46')]['name'][_0x5a25('0x3d')]()]['toString']()});}});}return _0x239bf6;}exports['queue']=function(_0x428746,_0x538dc1,_0x2a1401,_0x117797,_0x250e86,_0x5d9af2){var _0x55627c,_0x55e95b;_0x5d9af2[_0x5a25('0x10')]=intUtil[_0x5a25('0x48')](_0x5d9af2[_0x5a25('0x10')]);_0x5d9af2[_0x5a25('0x49')]=intUtil[_0x5a25('0x48')](_0x5d9af2[_0x5a25('0x49')]);if(_0x250e86&&_0x250e86['monitor_format']){logger[_0x5a25('0xd')](_0x5a25('0x4a'),_0x5a25('0x4b'));_0x538dc1[_0x5a25('0x4c')]=util[_0x5a25('0xe')](_0x5a25('0x4d'),_0x5d9af2['serverUrl'],_0x538dc1[_0x5a25('0x4e')],md5(_0x538dc1[_0x5a25('0x4e')]));}else{_0x538dc1[_0x5a25('0x4c')]='';}headers['Authorization']=getAuth(_0x5d9af2);return getUser(_0x5d9af2,_0x117797[_0x5a25('0x4f')])['then'](function(_0x14d7f9){_0x55627c=_0x14d7f9;logger['info']('The\x20User\x20ID\x20is:',_0x55627c['id']);return getEndUser(_0x5d9af2,_0x538dc1[_0x5a25('0x50')],_0x538dc1['calleridnum']);})[_0x5a25('0x18')](function(_0x39b779){_0x55e95b=_0x39b779;logger[_0x5a25('0xd')](_0x5a25('0x51'),_0x55e95b['id']);return getTicket(_0x5d9af2,_0x55627c,_0x55e95b,_0x2a1401,_0x538dc1);})[_0x5a25('0x18')](function(_0x5760d0){if(_0x5760d0){logger[_0x5a25('0xd')](_0x5a25('0x52'),_0x5760d0['id']);switch(_0x5d9af2[_0x5a25('0x3b')]){case _0x5a25('0x53'):logger['info'](_0x5a25('0x4a'),_0x5a25('0x54'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x55'),_0x5d9af2[_0x5a25('0x10')],_0x55627c['id'],_0x5760d0['id']),'method':_0x5a25('0x11')});case'newTab':logger[_0x5a25('0xd')](_0x5a25('0x4a'),_0x5a25('0x56'));emit(util['format'](_0x5a25('0x57'),_0x117797[_0x5a25('0x47')]),_0x5a25('0x58'),{'uri':util[_0x5a25('0xe')](_0x5a25('0x59'),_0x5d9af2['remoteUri']['replace'](_0x5a25('0x5a'),''),_0x5760d0['id'])});break;default:logger[_0x5a25('0x5b')]('[QUEUE]',_0x5a25('0x5c'));}}})[_0x5a25('0x5d')](function(_0x2f19ee){logger[_0x5a25('0x5b')](_0x5a25('0x5e'),util[_0x5a25('0x5f')](_0x2f19ee,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x44d0d8,_0xdd7ba8,_0x32605a,_0x4401c7,_0x533d70,_0x31bc6b,_0x209083){var _0xbfae0a,_0x3aac7f;_0x31bc6b['remoteUri']=intUtil[_0x5a25('0x48')](_0x31bc6b[_0x5a25('0x10')]);_0x31bc6b['serverUrl']=intUtil['stripTrailingSlash'](_0x31bc6b[_0x5a25('0x49')]);if(_0x209083&&_0x209083[_0x5a25('0x60')]&&_0x209083[_0x5a25('0x60')]!=='none'){logger[_0x5a25('0xd')](_0x5a25('0x61'),_0x5a25('0x4b'));_0xdd7ba8['recordingURL']=util['format'](_0x5a25('0x4d'),_0x31bc6b[_0x5a25('0x49')],_0xdd7ba8['uniqueid'],md5(_0xdd7ba8[_0x5a25('0x4e')]));}headers[_0x5a25('0x62')]=getAuth(_0x31bc6b);return getUser(_0x31bc6b,_0x4401c7[_0x5a25('0x4f')])[_0x5a25('0x18')](function(_0x27afb7){_0xbfae0a=_0x27afb7;logger['info']('The\x20User\x20ID\x20is:',_0xbfae0a['id']);return getEndUser(_0x31bc6b,_0xdd7ba8[_0x5a25('0x63')],_0xdd7ba8[_0x5a25('0x64')]);})['then'](function(_0xcf65ec){_0x3aac7f=_0xcf65ec;logger[_0x5a25('0xd')](_0x5a25('0x51'),_0x3aac7f['id']);return getTicket(_0x31bc6b,_0xbfae0a,_0x3aac7f,_0x32605a,_0xdd7ba8);})['then'](function(_0x4d458d){if(_0x4d458d){logger[_0x5a25('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4d458d['id']);switch(_0x31bc6b[_0x5a25('0x3b')]){case _0x5a25('0x53'):logger[_0x5a25('0xd')](_0x5a25('0x61'),_0x5a25('0x54'));return request({'uri':util[_0x5a25('0xe')](_0x5a25('0x55'),_0x31bc6b['remoteUri'],_0xbfae0a['id'],_0x4d458d['id']),'method':_0x5a25('0x11')});case _0x5a25('0x65'):logger['info'](_0x5a25('0x61'),_0x5a25('0x56'));emit(util['format'](_0x5a25('0x57'),_0x4401c7['name']),_0x5a25('0x58'),{'uri':util[_0x5a25('0xe')](_0x5a25('0x59'),_0x31bc6b['remoteUri'][_0x5a25('0x66')](_0x5a25('0x5a'),''),_0x4d458d['id'])});break;default:logger[_0x5a25('0x5b')]('[OUTBOUND]',_0x5a25('0x5c'));}}})['catch'](function(_0x2a95fc){logger[_0x5a25('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2a95fc,{'showHidden':!![],'depth':null}));});};exports[_0x5a25('0x67')]=function(_0x393931,_0x45693c,_0x4dfd67,_0x5b668a,_0x5d3c96,_0x381111){var _0x1a166e,_0x521090;_0x381111['remoteUri']=intUtil[_0x5a25('0x48')](_0x381111['remoteUri']);_0x381111[_0x5a25('0x49')]=intUtil[_0x5a25('0x48')](_0x381111['serverUrl']);if(_0x5d3c96&&_0x5d3c96[_0x5a25('0x68')]){logger[_0x5a25('0xd')]('['+_0x45693c[_0x5a25('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x45693c[_0x5a25('0x4c')]=util[_0x5a25('0xe')](_0x5a25('0x4d'),_0x381111[_0x5a25('0x49')],_0x45693c[_0x5a25('0x4e')],md5(_0x45693c[_0x5a25('0x4e')]));}else{_0x45693c[_0x5a25('0x4c')]='';}headers[_0x5a25('0x62')]=getAuth(_0x381111);return getUser(_0x381111)['then'](function(_0x3976ed){_0x1a166e=_0x3976ed;logger['info'](_0x5a25('0x6a'),_0x1a166e['id']);return getEndUser(_0x381111,_0x45693c[_0x5a25('0x50')],_0x45693c[_0x5a25('0x6b')]);})[_0x5a25('0x18')](function(_0xae9d95){_0x521090=_0xae9d95;logger['info'](_0x5a25('0x51'),_0x521090['id']);return getTicket(_0x381111,_0x1a166e,_0x521090,_0x4dfd67,_0x45693c);})[_0x5a25('0x18')](function(_0x26bd0c){if(_0x26bd0c){logger[_0x5a25('0xd')](_0x5a25('0x52'),_0x26bd0c['id']);}})[_0x5a25('0x5d')](function(_0x22b580){logger[_0x5a25('0x5b')]('['+_0x45693c[_0x5a25('0x69')][_0x5a25('0x6c')]()+']'+_0x5a25('0x6d'),util[_0x5a25('0x5f')](_0x22b580,{'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 4d991ed..6b2667b 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 _0x793a=['type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','findIndex','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','outbound','starttime','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','stringify','length'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x793a,0x86));var _0xa793=function(_0x591eff,_0x2c4350){_0x591eff=_0x591eff-0x0;var _0x56b615=_0x793a[_0x591eff];return _0x56b615;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0xa793('0x0'));var moment=require(_0xa793('0x1'));var Redis=require(_0xa793('0x2'));var BPromise=require(_0xa793('0x3'));var config=require(_0xa793('0x4'));var logger=require(_0xa793('0x5'))('zoho');config[_0xa793('0x6')]=_[_0xa793('0x7')](config[_0xa793('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa793('0x8'))(new Redis(config[_0xa793('0x6')]));function emit(_0x1fc234,_0x59b523,_0x26fcf9){io['to'](_0x1fc234)[_0xa793('0x9')](_0x59b523,_0x26fcf9);}function request(_0x18c5b1){logger[_0xa793('0xa')]('[HTTP]',JSON[_0xa793('0xb')](_0x18c5b1));return rp(_0x18c5b1);}function getCustomFields(_0x4e48e9,_0xf98e6){var _0x1adc0a={};if(_0x4e48e9[_0xa793('0xc')]>0x0){_['forEach'](_0x4e48e9,function(_0x1c88cb){if(_['includes'](['string','picklist'],_0x1c88cb[_0xa793('0xd')])&&_0x1c88cb[_0xa793('0xe')]){_0x1adc0a[_0x1c88cb[_0xa793('0xe')]]=_0x1c88cb[_0xa793('0xf')]['toString']();}else if(_0x1c88cb[_0xa793('0xd')]===_0xa793('0x10')&&_0x1c88cb[_0xa793('0x11')]&&_0x1c88cb[_0xa793('0xe')]&&_0xf98e6[_0x1c88cb[_0xa793('0x11')]]){_0x1adc0a[_0x1c88cb[_0xa793('0xe')]]=_0xf98e6[_0x1c88cb['variableName']][_0xa793('0x12')]();}else if(_0x1c88cb[_0xa793('0xd')]===_0xa793('0x13')&&_0x1c88cb[_0xa793('0x14')]&&_0x1c88cb[_0xa793('0x14')][_0xa793('0x15')]&&_0x1c88cb[_0xa793('0xe')]&&_0xf98e6[_0x1c88cb[_0xa793('0x14')]['name'][_0xa793('0x16')]()]){_0x1adc0a[_0x1c88cb[_0xa793('0xe')]]=_0xf98e6[_0x1c88cb['Variable'][_0xa793('0x15')][_0xa793('0x16')]()][_0xa793('0x12')]();}});}return _0x1adc0a;}function getName(_0x239e64){if(_0x239e64[_0xa793('0x17')]('\x20')>0x0){var _0x1a614a=_0x239e64['split'](/ (.+)/);if(_0x1a614a[0x1]){return _0x1a614a;}}return[_0x239e64,_0x239e64];}var accountsTokens={};function getAccessToken(_0x3e9781){return new Promise(function(_0x3f6757,_0x11d8f2){if(!_[_0xa793('0x18')](accountsTokens[_0x3e9781['id']])&&!_[_0xa793('0x18')](accountsTokens[_0x3e9781['id']][_0xa793('0x19')])){if(moment()['isBefore'](accountsTokens[_0x3e9781['id']][_0xa793('0x1a')])){_0x3f6757(accountsTokens[_0x3e9781['id']][_0xa793('0x19')]);}}var _0x2ff07f;switch(_0x3e9781[_0xa793('0x1b')]){case'US':_0x2ff07f=_0xa793('0x1c');break;case'AU':_0x2ff07f=_0xa793('0x1d');break;case'EU':_0x2ff07f=_0xa793('0x1e');break;case'IN':_0x2ff07f='https://accounts.zoho.in';break;case'CN':_0x2ff07f=_0xa793('0x1f');break;default:_0x2ff07f=_0xa793('0x1e');break;}var _0x574b67={'method':_0xa793('0x20'),'uri':_0x2ff07f+_0xa793('0x21'),'qs':{'refresh_token':_0x3e9781[_0xa793('0x22')],'client_id':_0x3e9781[_0xa793('0x23')],'client_secret':_0x3e9781[_0xa793('0x24')],'grant_type':_0xa793('0x25')},'json':!![]};return rp(_0x574b67)[_0xa793('0x26')](function(_0x55036e){accountsTokens[_0x3e9781['id']]={'access_token':_0x55036e[_0xa793('0x19')],'expires_in':moment()[_0xa793('0x27')](_0x55036e[_0xa793('0x1a')],'seconds')};_0x3f6757(_0x55036e['access_token']);})[_0xa793('0x28')](function(_0x1c24a8){logger[_0xa793('0x29')](_0xa793('0x2a'),_0x1c24a8[_0xa793('0x2b')]);_0x11d8f2(_0x1c24a8);});});}function getUser(_0x26725d,_0x1466fb,_0x887d9c,_0x40da74){logger[_0xa793('0x2c')](_0xa793('0x2d'));return request({'method':_0xa793('0x2e'),'uri':util[_0xa793('0x2f')](_0xa793('0x30'),_0x1466fb),'qs':{'type':_0xa793('0x31')},'headers':{'Authorization':_0xa793('0x32')+_0x26725d},'json':!![]})[_0xa793('0x26')](function(_0x20e021){if(_0x20e021[_0xa793('0x33')]){var _0x136708=-0x1;if(_[_0xa793('0x34')](_0x20e021[_0xa793('0x33')])){if(!_[_0xa793('0x18')](_0x40da74)){_0x136708=_['findIndex'](_0x20e021['users'],function(_0x3670fc){return _0x3670fc[_0xa793('0x35')]===_0x40da74;});}if(_0x136708>=0x0){logger['info'](_0xa793('0x36'));}else{logger[_0xa793('0x2c')]('Using\x20the\x20admin\x20account!');_0x136708=_[_0xa793('0x37')](_0x20e021['users'],function(_0x418d31){return _0x418d31['profile']['name']===_0xa793('0x38');});}return _0x20e021['users'][_0x136708];}else{if(_0x20e021[_0xa793('0x39')][_0xa793('0x3a')]['name']==='Administrator'){logger[_0xa793('0x2c')](_0xa793('0x3b'));user=_0x20e021['user'];return user;}else{logger[_0xa793('0x29')](_0xa793('0x3c'),JSON[_0xa793('0xb')](_0x20e021));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x20e021));}}}else{logger[_0xa793('0x29')](_0xa793('0x3c'),JSON[_0xa793('0xb')](_0x20e021));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa793('0xb')](_0x20e021));}})[_0xa793('0x28')](function(_0x1ffaa7){console['error'](_0x1ffaa7);});}function getZohoUser(_0x32a0d6,_0x2bb2a6){return new BPromise(function(_0x586f8c,_0x7011af){request(_0x32a0d6)['then'](function(_0x14291b){var _0x3d0495=null;if(_0x14291b){_0x3d0495=_0x14291b[_0xa793('0x3d')][0x0];_0x3d0495[_0xa793('0x3e')]=_0x2bb2a6;}_0x586f8c(_0x3d0495);})[_0xa793('0x28')](function(_0x491997){_0x7011af(_0x491997);});});}function createEndUser(_0x23342c,_0x4bbad2,_0x4ae295,_0x4d6ce6,_0x502cd9,_0x1d99d2){var _0x4ae295=getName(_0x4ae295);return request({'method':_0xa793('0x20'),'uri':_0xa793('0x3f')+_0x4bbad2+'/crm/v2/'+_[_0xa793('0x40')](_0x1d99d2[_0xa793('0x41')])+'s','body':{'data':[{'Last_Name':_0x4ae295[0x1],'First_Name':_0x4ae295[0x0],'Phone':_0x4d6ce6,'Owner':{'name':!_[_0xa793('0x18')](_0x502cd9[_0xa793('0x42')]['name'])?_0x502cd9[_0xa793('0x42')][_0xa793('0x15')]:!_['isNil'](_0x502cd9[_0xa793('0x43')])?_0x502cd9[_0xa793('0x43')]+'\x20'+_0x502cd9[_0xa793('0x44')]:_0x502cd9[_0xa793('0x44')],'id':_0x502cd9['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23342c},'json':!![]})[_0xa793('0x26')](function(_0x4d0923){if(_0x4d0923&&_0x4d0923['data'][0x0][_0xa793('0x45')]===_0xa793('0x46')){var _0x3a3a98=_0x4d0923[_0xa793('0x3d')][0x0][_0xa793('0x47')];_0x3a3a98[_0xa793('0x3e')]=_[_0xa793('0x40')](_0x1d99d2['moduleCreate'])+'s';return _0x3a3a98;}logger['error'](_0xa793('0x3c'),JSON[_0xa793('0xb')](data));throw new Error(_0xa793('0x48')+JSON['stringify'](data));})[_0xa793('0x28')](function(_0xa02145){console['log'](_0xa793('0x49'),_0xa02145);});}function getEndUser(_0x18707f,_0x28edc7,_0x3f112b,_0x40836b,_0x1a2af0,_0x1ab867,_0x3bac2c){var _0x3fe242={'method':_0xa793('0x2e'),'uri':'','headers':{'Authorization':_0xa793('0x32')+_0x18707f},'json':!![]};switch(_0x3bac2c['moduleSearch']){case _0xa793('0x4a'):_0x3fe242['uri']=_0xa793('0x3f')+_0x28edc7+_0xa793('0x4b')+_0x1a2af0+'))';return getZohoUser(_0x3fe242,_0xa793('0x4c'))[_0xa793('0x26')](function(_0xb9098d){if(_0xb9098d)return _0xb9098d;_0x3fe242[_0xa793('0x4d')]=_0xa793('0x3f')+_0x28edc7+_0xa793('0x4e')+_0x1a2af0+'))';return getZohoUser(_0x3fe242,_0xa793('0x4f'))[_0xa793('0x26')](function(_0x49ef97){if(_0x49ef97)return _0x49ef97;if(_0x3bac2c[_0xa793('0x41')]!=_0xa793('0x50')){return createEndUser(_0x18707f,_0x28edc7,_0x40836b,_0x1a2af0,_0x1ab867,_0x3bac2c);}else{return{};}});});break;case'contact':_0x3fe242['uri']=_0xa793('0x3f')+_0x28edc7+_0xa793('0x4b')+_0x1a2af0+'))';return getZohoUser(_0x3fe242,_0xa793('0x4c'))['then'](function(_0x3d8fb3){if(_0x3d8fb3)return _0x3d8fb3;if(_0x3bac2c[_0xa793('0x41')]!=_0xa793('0x50')){return createEndUser(_0x18707f,_0x28edc7,_0x40836b,_0x1a2af0,_0x1ab867,_0x3bac2c);}else{return{};}});break;case'lead':_0x3fe242[_0xa793('0x4d')]=_0xa793('0x3f')+_0x28edc7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a2af0+'))';return getZohoUser(_0x3fe242,_0xa793('0x4f'))[_0xa793('0x26')](function(_0x58d2d7){if(_0x58d2d7)return _0x58d2d7;if(_0x3bac2c[_0xa793('0x41')]!=_0xa793('0x50')){return createEndUser(_0x18707f,_0x28edc7,_0x40836b,_0x1a2af0,_0x1ab867,_0x3bac2c);}else{return{};}});break;}}function getCall(_0x1d3235,_0x580866,_0xb886b7,_0x377102,_0x10b8a5,_0x46f985,_0x47780f,_0x4a8f48){logger['info']('Creating\x20new\x20call...');var _0x448fc5={};_0x448fc5[_0xa793('0x51')]={'name':!_[_0xa793('0x18')](_0x377102['role'][_0xa793('0x15')])&&!_[_0xa793('0x18')](_0x377102[_0xa793('0x3a')][_0xa793('0x15')])&&_0x377102[_0xa793('0x3a')][_0xa793('0x15')]==='administrator'?_0x377102[_0xa793('0x42')][_0xa793('0x15')]:!_[_0xa793('0x18')](_0x377102[_0xa793('0x43')])?_0x377102['first_name']+'\x20'+_0x377102[_0xa793('0x44')]:_0x377102[_0xa793('0x44')],'id':_0x377102['id']};_0x448fc5[_0xa793('0x52')]=intUtil[_0xa793('0x53')](_0x46f985[_0xa793('0x54')],_0x47780f,'\x20');_0x448fc5[_0xa793('0x55')]=intUtil[_0xa793('0x53')](_0x46f985[_0xa793('0x56')],_0x47780f,'\x0a');if(_0x10b8a5[_0xa793('0x3e')]==='Contacts'){_0x448fc5[_0xa793('0x57')]={'name':!_[_0xa793('0x18')](_0x10b8a5[_0xa793('0x58')])?_0x10b8a5['Full_Name']:!_['isNil'](_0x10b8a5[_0xa793('0x59')])?_0x10b8a5[_0xa793('0x59')]+'\x20'+_0x10b8a5[_0xa793('0x5a')]:_0x10b8a5[_0xa793('0x5a')],'id':_0x10b8a5['id']};}if(_0x10b8a5[_0xa793('0x3e')]===_0xa793('0x4f')){_0x448fc5[_0xa793('0x5b')]={'name':!_[_0xa793('0x18')](_0x10b8a5['Full_Name'])?_0x10b8a5[_0xa793('0x58')]:!_['isNil'](_0x10b8a5[_0xa793('0x59')])?_0x10b8a5[_0xa793('0x59')]+'\x20'+_0x10b8a5[_0xa793('0x5a')]:_0x10b8a5[_0xa793('0x5a')],'id':_0x10b8a5['id']};_0x448fc5[_0xa793('0x5c')]=_['startCase'](_0x10b8a5[_0xa793('0x3e')]);}if(_0x47780f['talktime']){_0x448fc5[_0xa793('0x5d')]=moment['utc'](parseInt(_0x47780f[_0xa793('0x5e')])*0x3e8)[_0xa793('0x2f')](_0xa793('0x5f'));}else if(_0x47780f[_0xa793('0x60')]&&_0x47780f['endtime']){_0x448fc5[_0xa793('0x5d')]=moment[_0xa793('0x61')](moment(_0x47780f['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x47780f['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xa793('0x2f')](_0xa793('0x5f'));}switch(_0x47780f[_0xa793('0x62')]){case _0xa793('0x63'):_0x448fc5[_0xa793('0x64')]=_0xa793('0x65');break;case _0xa793('0x66'):case _0xa793('0x67'):_0x448fc5[_0xa793('0x64')]=_0xa793('0x68');break;case'rejected':_0x448fc5[_0xa793('0x64')]=_0xa793('0x69');break;case'abandoned':_0x448fc5[_0xa793('0x64')]=_0xa793('0x6a');break;case _0xa793('0x6b'):_0x448fc5['Call_Result']=_0xa793('0x6c');default:}_0x448fc5['Call_Start_Time']=(_0x4a8f48===_0xa793('0x6d')?moment(_0x47780f[_0xa793('0x6e')])[_0xa793('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x47780f[_0xa793('0x6f')])[_0xa793('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xa793('0x2f')](_0xa793('0x70'));_0x448fc5[_0xa793('0x71')]=_0x4a8f48||_0xa793('0x72');_0x448fc5=_[_0xa793('0x73')](_0x448fc5,getCustomFields(_0x46f985['Fields'],_0x47780f));return request({'method':_0xa793('0x20'),'uri':_0xa793('0x3f')+_0x580866+_0xa793('0x74'),'headers':{'Authorization':_0xa793('0x32')+_0x1d3235},'body':{'data':[_0x448fc5]},'json':!![]})[_0xa793('0x26')](function(_0x1a4e94){if(_0x1a4e94&&_0x1a4e94[_0xa793('0x3d')][0x0][_0xa793('0x45')]===_0xa793('0x46')){logger[_0xa793('0x2c')](_0xa793('0x75'));return{'id':_0x1a4e94[_0xa793('0x3d')][0x0][_0xa793('0x47')]['id']};}})[_0xa793('0x28')](function(_0x5b7978){logger[_0xa793('0x2c')](_0xa793('0x76'),_0x5b7978[_0xa793('0x2b')]);console[_0xa793('0x77')]('err',_0x5b7978);});}exports[_0xa793('0x78')]=function(_0x9fe5aa,_0x44e979,_0x3042a9,_0x4e4c72,_0xbedb05,_0x2fde65){var _0x523e37,_0x3251b2,_0x2417f0;_0x2fde65[_0xa793('0x79')]=intUtil[_0xa793('0x7a')](_0x2fde65['host']);_0x2fde65[_0xa793('0x7b')]=intUtil[_0xa793('0x7a')](_0x2fde65[_0xa793('0x7b')]);if(_0xbedb05&&_0xbedb05[_0xa793('0x7c')]){logger[_0xa793('0x2c')](_0xa793('0x7d'),_0xa793('0x7e'));_0x44e979['recordingURL']=_0x2fde65[_0xa793('0x7b')]+_0xa793('0x7f')+_0x44e979[_0xa793('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x44e979[_0xa793('0x80')]);}else{_0x44e979[_0xa793('0x81')]='';}var _0x4bc390=_0x2fde65['host']==='zoho.eu'?'eu':_0xa793('0x82');return getAccessToken(_0x2fde65)[_0xa793('0x26')](function(_0x14a87c){_0x2417f0=_0x14a87c;return getUser(_0x2417f0,_0x4bc390,_0x2fde65,_0x4e4c72[_0xa793('0x35')]);})[_0xa793('0x26')](function(_0x176424){_0x523e37=_0x176424;logger[_0xa793('0x2c')](_0xa793('0x83'),_0x523e37['id']);return getEndUser(_0x2417f0,_0x4bc390,_0x2fde65,_0x44e979[_0xa793('0x84')],_0x44e979[_0xa793('0x85')],_0x523e37,_0x3042a9);})[_0xa793('0x26')](function(_0x5328bc){_0x3251b2=_0x5328bc;return getCall(_0x2417f0,_0x4bc390,_0x2fde65,_0x523e37,_0x3251b2,_0x3042a9,_0x44e979,'Inbound');})['then'](function(_0x4f5dca){if(_0x4f5dca){logger['info']('The\x20Call\x20ID\x20is:',_0x4f5dca['id']);logger['info'](_0xa793('0x7d'),_0xa793('0x86'));emit(util['format'](_0xa793('0x87'),_0x4e4c72['name']),_0xa793('0x88'),{'uri':_0xa793('0x89')+_0x2fde65['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4f5dca['id']});}})['catch'](function(_0x16097f){logger[_0xa793('0x29')](_0xa793('0x7d'),JSON[_0xa793('0xb')](_0x16097f));});};exports[_0xa793('0x6d')]=function(_0x2fff92,_0x1f5a04,_0x54a95e,_0x121e34,_0x156b8f,_0x1409d8,_0x53fd9){var _0x39ae79,_0x1103a9,_0x3734f1;_0x1409d8[_0xa793('0x79')]=intUtil[_0xa793('0x7a')](_0x1409d8['host']);_0x1409d8[_0xa793('0x7b')]=intUtil[_0xa793('0x7a')](_0x1409d8[_0xa793('0x7b')]);if(_0x53fd9&&_0x53fd9[_0xa793('0x8a')]&&_0x53fd9['recordingFormat']!=='none'){logger[_0xa793('0x2c')](_0xa793('0x8b'),_0xa793('0x7e'));_0x1f5a04['recordingURL']=_0x1409d8['serverUrl']+_0xa793('0x7f')+_0x1f5a04['uniqueid']+_0xa793('0x8c')+md5(_0x1f5a04['uniqueid']);}var _0x2c45eb=_0x1409d8[_0xa793('0x79')]==='zoho.eu'?'eu':_0xa793('0x82');return getAccessToken(_0x1409d8)[_0xa793('0x26')](function(_0xa51cf5){_0x3734f1=_0xa51cf5;return getUser(_0x3734f1,_0x2c45eb,_0x1409d8,_0x121e34[_0xa793('0x35')]);})['then'](function(_0x2a3833){_0x39ae79=_0x2a3833;logger[_0xa793('0x2c')]('The\x20User\x20ID\x20is:',_0x39ae79['id']);return getEndUser(_0x3734f1,_0x2c45eb,_0x1409d8,_0x1f5a04['destcalleridname'],_0x1f5a04[_0xa793('0x8d')],_0x39ae79,_0x54a95e);})[_0xa793('0x26')](function(_0x3e1dfe){_0x1103a9=_0x3e1dfe;return getCall(_0x3734f1,_0x2c45eb,_0x1409d8,_0x39ae79,_0x1103a9,_0x54a95e,_0x1f5a04,_0xa793('0x8e'));})[_0xa793('0x26')](function(_0x583a71){if(_0x583a71){logger['info'](_0xa793('0x8f'),_0x583a71['id']);logger['info'](_0xa793('0x8b'),_0xa793('0x86'));emit(util[_0xa793('0x2f')]('user:%s',_0x121e34[_0xa793('0x15')]),'trigger:browser:url',{'uri':_0xa793('0x89')+_0x1409d8[_0xa793('0x79')]+_0xa793('0x90')+_0x583a71['id']});}})[_0xa793('0x28')](function(_0x20d1c8){logger['error'](_0xa793('0x8b'),JSON[_0xa793('0xb')](_0x20d1c8));});};exports[_0xa793('0x91')]=function(_0x1c5a7c,_0x313390,_0x19bc7d,_0x2ef51b,_0x28a7d7,_0x300d0a){var _0x243f3c,_0x2a2d1f,_0x5ca316;_0x300d0a[_0xa793('0x79')]=intUtil[_0xa793('0x7a')](_0x300d0a[_0xa793('0x79')]);_0x300d0a['serverUrl']=intUtil[_0xa793('0x7a')](_0x300d0a[_0xa793('0x7b')]);if(_0x28a7d7&&_0x28a7d7[_0xa793('0x7c')]){logger[_0xa793('0x2c')]('['+_0x313390[_0xa793('0x62')][_0xa793('0x92')]()+']','Recording\x20is\x20enabled!');_0x313390[_0xa793('0x81')]=_0x300d0a['serverUrl']+_0xa793('0x7f')+_0x313390[_0xa793('0x80')]+_0xa793('0x8c')+md5(_0x313390[_0xa793('0x80')]);}else{_0x313390['recordingURL']='';}var _0xa74f92=_0x300d0a['host']==='zoho.eu'?'eu':_0xa793('0x82');return getAccessToken(_0x300d0a)[_0xa793('0x26')](function(_0x2a487f){_0x5ca316=_0x2a487f;return getUser(_0x5ca316,_0xa74f92,_0x300d0a);})[_0xa793('0x26')](function(_0x5ae487){_0x243f3c=_0x5ae487;logger['info'](_0xa793('0x83'),_0x243f3c['id']);return getEndUser(_0x5ca316,_0xa74f92,_0x300d0a,_0x313390[_0xa793('0x84')],_0x313390[_0xa793('0x85')],_0x243f3c,_0x19bc7d);})['then'](function(_0x4fcab3){_0x2a2d1f=_0x4fcab3;return getCall(_0x5ca316,_0xa74f92,_0x300d0a,_0x243f3c,_0x2a2d1f,_0x19bc7d,_0x313390,_0xa793('0x72'));})[_0xa793('0x26')](function(_0x51ecb4){if(_0x51ecb4){logger[_0xa793('0x2c')]('The\x20Call\x20ID\x20is:',_0x51ecb4['id']);}})['catch'](function(_0xbe20ea){logger[_0xa793('0x29')]('['+_0x313390[_0xa793('0x62')][_0xa793('0x92')]()+']',JSON[_0xa793('0xb')](_0xbe20ea));});}; \ No newline at end of file +var _0xc2cc=['stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','email','Agent\x20found!','users','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','[QUEUE]','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','toUpperCase','request-promise','md5','util','moment','bluebird','../../../../config/logger','redis','localhost','debug','[HTTP]','stringify','length','string','picklist','type','idField','variable','variableName','toString','customVariable','name','toLowerCase','Variable','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token'];(function(_0x2cce4c,_0x1dfd1d){var _0x80f54d=function(_0x549e1f){while(--_0x549e1f){_0x2cce4c['push'](_0x2cce4c['shift']());}};_0x80f54d(++_0x1dfd1d);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var rp=require(_0xcc2c('0x0'));var md5=require(_0xcc2c('0x1'));var util=require(_0xcc2c('0x2'));var intUtil=require('./util');var moment=require(_0xcc2c('0x3'));var Redis=require('ioredis');var BPromise=require(_0xcc2c('0x4'));var config=require('../../../../config/environment');var logger=require(_0xcc2c('0x5'))('zoho');config[_0xcc2c('0x6')]=_['defaults'](config['redis'],{'host':_0xcc2c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc2c('0x6')]));function emit(_0x5a276f,_0x1d311f,_0x58c80c){io['to'](_0x5a276f)['emit'](_0x1d311f,_0x58c80c);}function request(_0x2bde97){logger[_0xcc2c('0x8')](_0xcc2c('0x9'),JSON[_0xcc2c('0xa')](_0x2bde97));return rp(_0x2bde97);}function getCustomFields(_0x2325be,_0x367881){var _0xb51804={};if(_0x2325be[_0xcc2c('0xb')]>0x0){_['forEach'](_0x2325be,function(_0x358306){if(_['includes']([_0xcc2c('0xc'),_0xcc2c('0xd')],_0x358306[_0xcc2c('0xe')])&&_0x358306[_0xcc2c('0xf')]){_0xb51804[_0x358306['idField']]=_0x358306['content']['toString']();}else if(_0x358306[_0xcc2c('0xe')]===_0xcc2c('0x10')&&_0x358306['variableName']&&_0x358306['idField']&&_0x367881[_0x358306[_0xcc2c('0x11')]]){_0xb51804[_0x358306['idField']]=_0x367881[_0x358306[_0xcc2c('0x11')]][_0xcc2c('0x12')]();}else if(_0x358306[_0xcc2c('0xe')]===_0xcc2c('0x13')&&_0x358306['Variable']&&_0x358306['Variable'][_0xcc2c('0x14')]&&_0x358306[_0xcc2c('0xf')]&&_0x367881[_0x358306['Variable'][_0xcc2c('0x14')][_0xcc2c('0x15')]()]){_0xb51804[_0x358306[_0xcc2c('0xf')]]=_0x367881[_0x358306[_0xcc2c('0x16')][_0xcc2c('0x14')][_0xcc2c('0x15')]()][_0xcc2c('0x12')]();}});}return _0xb51804;}function getName(_0x5a1f0a){if(_0x5a1f0a[_0xcc2c('0x17')]('\x20')>0x0){var _0x3acc89=_0x5a1f0a['split'](/ (.+)/);if(_0x3acc89[0x1]){return _0x3acc89;}}return[_0x5a1f0a,_0x5a1f0a];}var accountsTokens={};function getAccessToken(_0x4d22fe){return new Promise(function(_0x4a67f4,_0x15bbd6){if(!_['isNil'](accountsTokens[_0x4d22fe['id']])&&!_[_0xcc2c('0x18')](accountsTokens[_0x4d22fe['id']][_0xcc2c('0x19')])){if(moment()['isBefore'](accountsTokens[_0x4d22fe['id']][_0xcc2c('0x1a')])){_0x4a67f4(accountsTokens[_0x4d22fe['id']][_0xcc2c('0x19')]);}}var _0x5c7c53;switch(_0x4d22fe[_0xcc2c('0x1b')]){case'US':_0x5c7c53='https://accounts.zoho.com';break;case'AU':_0x5c7c53=_0xcc2c('0x1c');break;case'EU':_0x5c7c53='https://accounts.zoho.eu';break;case'IN':_0x5c7c53='https://accounts.zoho.in';break;case'CN':_0x5c7c53=_0xcc2c('0x1d');break;default:_0x5c7c53=_0xcc2c('0x1e');break;}var _0x5e491f={'method':_0xcc2c('0x1f'),'uri':_0x5c7c53+_0xcc2c('0x20'),'qs':{'refresh_token':_0x4d22fe[_0xcc2c('0x21')],'client_id':_0x4d22fe[_0xcc2c('0x22')],'client_secret':_0x4d22fe[_0xcc2c('0x23')],'grant_type':_0xcc2c('0x24')},'json':!![]};return rp(_0x5e491f)['then'](function(_0xaab877){accountsTokens[_0x4d22fe['id']]={'access_token':_0xaab877[_0xcc2c('0x19')],'expires_in':moment()[_0xcc2c('0x25')](_0xaab877[_0xcc2c('0x1a')],_0xcc2c('0x26'))};_0x4a67f4(_0xaab877['access_token']);})['catch'](function(_0x50c32b){logger['error'](_0xcc2c('0x27'),_0x50c32b[_0xcc2c('0x28')]);_0x15bbd6(_0x50c32b);});});}function getUser(_0x406515,_0x2c4ce9,_0x3ad1aa,_0x184de4){logger[_0xcc2c('0x29')](_0xcc2c('0x2a'));return request({'method':_0xcc2c('0x2b'),'uri':util[_0xcc2c('0x2c')](_0xcc2c('0x2d'),_0x2c4ce9),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xcc2c('0x2e')+_0x406515},'json':!![]})['then'](function(_0x4fd79f){if(_0x4fd79f['users']){var _0x31778c=-0x1;if(_[_0xcc2c('0x2f')](_0x4fd79f['users'])){if(!_['isNil'](_0x184de4)){_0x31778c=_[_0xcc2c('0x30')](_0x4fd79f['users'],function(_0x2b7e0c){return _0x2b7e0c[_0xcc2c('0x31')]===_0x184de4;});}if(_0x31778c>=0x0){logger[_0xcc2c('0x29')](_0xcc2c('0x32'));}else{logger[_0xcc2c('0x29')]('Using\x20the\x20admin\x20account!');_0x31778c=_['findIndex'](_0x4fd79f[_0xcc2c('0x33')],function(_0x12863b){return _0x12863b[_0xcc2c('0x34')][_0xcc2c('0x14')]===_0xcc2c('0x35');});}return _0x4fd79f['users'][_0x31778c];}else{if(_0x4fd79f[_0xcc2c('0x36')]['profile'][_0xcc2c('0x14')]===_0xcc2c('0x35')){logger['info'](_0xcc2c('0x37'));user=_0x4fd79f['user'];return user;}else{logger['error'](_0xcc2c('0x38'),JSON['stringify'](_0x4fd79f));throw new Error(_0xcc2c('0x39')+JSON[_0xcc2c('0xa')](_0x4fd79f));}}}else{logger[_0xcc2c('0x3a')]('The\x20failing\x20result\x20is',JSON[_0xcc2c('0xa')](_0x4fd79f));throw new Error(_0xcc2c('0x39')+JSON['stringify'](_0x4fd79f));}})[_0xcc2c('0x3b')](function(_0x5432fb){console[_0xcc2c('0x3a')](_0x5432fb);});}function getZohoUser(_0x4cb5de,_0x29e59f){return new BPromise(function(_0x1b9884,_0x10afa7){request(_0x4cb5de)['then'](function(_0x40509e){var _0x31349b=null;if(_0x40509e){_0x31349b=_0x40509e[_0xcc2c('0x3c')][0x0];_0x31349b[_0xcc2c('0x3d')]=_0x29e59f;}_0x1b9884(_0x31349b);})[_0xcc2c('0x3b')](function(_0xcd9a0b){_0x10afa7(_0xcd9a0b);});});}function createEndUser(_0x5ef1a5,_0x279744,_0x1b4514,_0xd6e808,_0x43afd6,_0x5b6ec6){var _0x1b4514=getName(_0x1b4514);return request({'method':_0xcc2c('0x1f'),'uri':_0xcc2c('0x3e')+_0x279744+_0xcc2c('0x3f')+_[_0xcc2c('0x40')](_0x5b6ec6[_0xcc2c('0x41')])+'s','body':{'data':[{'Last_Name':_0x1b4514[0x1],'First_Name':_0x1b4514[0x0],'Phone':_0xd6e808,'Owner':{'name':!_[_0xcc2c('0x18')](_0x43afd6[_0xcc2c('0x42')][_0xcc2c('0x14')])?_0x43afd6[_0xcc2c('0x42')]['name']:!_[_0xcc2c('0x18')](_0x43afd6[_0xcc2c('0x43')])?_0x43afd6['first_name']+'\x20'+_0x43afd6[_0xcc2c('0x44')]:_0x43afd6[_0xcc2c('0x44')],'id':_0x43afd6['id']}}]},'headers':{'Authorization':_0xcc2c('0x2e')+_0x5ef1a5},'json':!![]})[_0xcc2c('0x45')](function(_0x3a1a80){if(_0x3a1a80&&_0x3a1a80[_0xcc2c('0x3c')][0x0][_0xcc2c('0x46')]==='SUCCESS'){var _0x3c3f29=_0x3a1a80[_0xcc2c('0x3c')][0x0][_0xcc2c('0x47')];_0x3c3f29[_0xcc2c('0x3d')]=_[_0xcc2c('0x40')](_0x5b6ec6[_0xcc2c('0x41')])+'s';return _0x3c3f29;}logger[_0xcc2c('0x3a')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xcc2c('0x48')+JSON[_0xcc2c('0xa')](data));})[_0xcc2c('0x3b')](function(_0x10c07d){console[_0xcc2c('0x49')](_0xcc2c('0x4a'),_0x10c07d);});}function getEndUser(_0x14a522,_0x15f6f0,_0xe5a8db,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440){var _0x1659b3={'method':_0xcc2c('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x14a522},'json':!![]};switch(_0x5b1440[_0xcc2c('0x4b')]){case _0xcc2c('0x4c'):_0x1659b3[_0xcc2c('0x4d')]=_0xcc2c('0x3e')+_0x15f6f0+_0xcc2c('0x4e')+_0x496a0b+'))';return getZohoUser(_0x1659b3,'Contacts')['then'](function(_0x283d10){if(_0x283d10)return _0x283d10;_0x1659b3['uri']='https://www.zohoapis.'+_0x15f6f0+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x496a0b+'))';return getZohoUser(_0x1659b3,_0xcc2c('0x4f'))['then'](function(_0x4f9557){if(_0x4f9557)return _0x4f9557;if(_0x5b1440['moduleCreate']!='nothing'){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});});break;case'contact':_0x1659b3['uri']=_0xcc2c('0x3e')+_0x15f6f0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x496a0b+'))';return getZohoUser(_0x1659b3,_0xcc2c('0x50'))[_0xcc2c('0x45')](function(_0xcd6ccf){if(_0xcd6ccf)return _0xcd6ccf;if(_0x5b1440[_0xcc2c('0x41')]!='nothing'){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});break;case _0xcc2c('0x51'):_0x1659b3[_0xcc2c('0x4d')]=_0xcc2c('0x3e')+_0x15f6f0+_0xcc2c('0x52')+_0x496a0b+'))';return getZohoUser(_0x1659b3,'Leads')[_0xcc2c('0x45')](function(_0x8a4cb1){if(_0x8a4cb1)return _0x8a4cb1;if(_0x5b1440[_0xcc2c('0x41')]!=_0xcc2c('0x53')){return createEndUser(_0x14a522,_0x15f6f0,_0x3bbb34,_0x496a0b,_0x3e9860,_0x5b1440);}else{return{};}});break;}}function getCall(_0x3f7c9f,_0x18b223,_0x455f59,_0x19c04e,_0x113660,_0x298c2d,_0x19176e,_0x46d7e4){logger['info'](_0xcc2c('0x54'));var _0x275268={};_0x275268[_0xcc2c('0x55')]={'name':!_[_0xcc2c('0x18')](_0x19c04e['role'][_0xcc2c('0x14')])&&!_[_0xcc2c('0x18')](_0x19c04e[_0xcc2c('0x34')][_0xcc2c('0x14')])&&_0x19c04e[_0xcc2c('0x34')]['name']===_0xcc2c('0x56')?_0x19c04e[_0xcc2c('0x42')][_0xcc2c('0x14')]:!_['isNil'](_0x19c04e[_0xcc2c('0x43')])?_0x19c04e[_0xcc2c('0x43')]+'\x20'+_0x19c04e[_0xcc2c('0x44')]:_0x19c04e[_0xcc2c('0x44')],'id':_0x19c04e['id']};_0x275268[_0xcc2c('0x57')]=intUtil['getString'](_0x298c2d['Subjects'],_0x19176e,'\x20');_0x275268[_0xcc2c('0x58')]=intUtil['getString'](_0x298c2d[_0xcc2c('0x59')],_0x19176e,'\x0a');if(_0x113660[_0xcc2c('0x3d')]==='Contacts'){_0x275268[_0xcc2c('0x5a')]={'name':!_[_0xcc2c('0x18')](_0x113660[_0xcc2c('0x5b')])?_0x113660[_0xcc2c('0x5b')]:!_[_0xcc2c('0x18')](_0x113660['First_Name'])?_0x113660[_0xcc2c('0x5c')]+'\x20'+_0x113660[_0xcc2c('0x5d')]:_0x113660[_0xcc2c('0x5d')],'id':_0x113660['id']};}if(_0x113660[_0xcc2c('0x3d')]===_0xcc2c('0x4f')){_0x275268['What_Id']={'name':!_[_0xcc2c('0x18')](_0x113660[_0xcc2c('0x5b')])?_0x113660[_0xcc2c('0x5b')]:!_['isNil'](_0x113660[_0xcc2c('0x5c')])?_0x113660[_0xcc2c('0x5c')]+'\x20'+_0x113660[_0xcc2c('0x5d')]:_0x113660[_0xcc2c('0x5d')],'id':_0x113660['id']};_0x275268[_0xcc2c('0x5e')]=_[_0xcc2c('0x40')](_0x113660[_0xcc2c('0x3d')]);}if(_0x19176e['talktime']){_0x275268[_0xcc2c('0x5f')]=moment['utc'](parseInt(_0x19176e[_0xcc2c('0x60')])*0x3e8)[_0xcc2c('0x2c')](_0xcc2c('0x61'));}else if(_0x19176e[_0xcc2c('0x62')]&&_0x19176e[_0xcc2c('0x63')]){_0x275268[_0xcc2c('0x5f')]=moment[_0xcc2c('0x64')](moment(_0x19176e[_0xcc2c('0x63')],_0xcc2c('0x65'))['diff'](moment(_0x19176e[_0xcc2c('0x66')],_0xcc2c('0x65'))))['format'](_0xcc2c('0x61'));}switch(_0x19176e[_0xcc2c('0x67')]){case'called':_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x69');break;case _0xcc2c('0x6a'):case _0xcc2c('0x6b'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x6c');break;case _0xcc2c('0x6d'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x6e');break;case'abandoned':_0x275268['Call_Result']=_0xcc2c('0x6f');break;case _0xcc2c('0x70'):_0x275268[_0xcc2c('0x68')]=_0xcc2c('0x71');default:}_0x275268[_0xcc2c('0x72')]=(_0x46d7e4===_0xcc2c('0x73')?moment(_0x19176e['starttime'])[_0xcc2c('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x19176e['agentcalledAt'])[_0xcc2c('0x2c')](_0xcc2c('0x65')))||moment()['format'](_0xcc2c('0x65'));_0x275268[_0xcc2c('0x74')]=_0x46d7e4||_0xcc2c('0x75');_0x275268=_[_0xcc2c('0x76')](_0x275268,getCustomFields(_0x298c2d[_0xcc2c('0x77')],_0x19176e));return request({'method':_0xcc2c('0x1f'),'uri':_0xcc2c('0x3e')+_0x18b223+_0xcc2c('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3f7c9f},'body':{'data':[_0x275268]},'json':!![]})[_0xcc2c('0x45')](function(_0x16c8cf){if(_0x16c8cf&&_0x16c8cf[_0xcc2c('0x3c')][0x0][_0xcc2c('0x46')]==='SUCCESS'){logger[_0xcc2c('0x29')](_0xcc2c('0x79'));return{'id':_0x16c8cf['data'][0x0]['details']['id']};}})[_0xcc2c('0x3b')](function(_0x1e8121){logger['info'](_0xcc2c('0x7a'),_0x1e8121[_0xcc2c('0x28')]);console['log'](_0xcc2c('0x7a'),_0x1e8121);});}exports[_0xcc2c('0x7b')]=function(_0x57fce7,_0x3650a1,_0x2fb052,_0x583dad,_0x195be0,_0x4f1e89){var _0x56acdf,_0x4cfd41,_0x2b76fb;_0x4f1e89[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x4f1e89[_0xcc2c('0x7c')]);_0x4f1e89[_0xcc2c('0x7e')]=intUtil['stripTrailingSlash'](_0x4f1e89[_0xcc2c('0x7e')]);if(_0x195be0&&_0x195be0[_0xcc2c('0x7f')]){logger[_0xcc2c('0x29')]('[QUEUE]',_0xcc2c('0x80'));_0x3650a1[_0xcc2c('0x81')]=_0x4f1e89[_0xcc2c('0x7e')]+'/api/voice/recordings/'+_0x3650a1[_0xcc2c('0x82')]+_0xcc2c('0x83')+md5(_0x3650a1['uniqueid']);}else{_0x3650a1[_0xcc2c('0x81')]='';}var _0x4ea3b8=_0x4f1e89[_0xcc2c('0x7c')]===_0xcc2c('0x84')?'eu':_0xcc2c('0x85');return getAccessToken(_0x4f1e89)[_0xcc2c('0x45')](function(_0x4dace2){_0x2b76fb=_0x4dace2;return getUser(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x583dad[_0xcc2c('0x31')]);})['then'](function(_0xf9165a){_0x56acdf=_0xf9165a;logger[_0xcc2c('0x29')]('The\x20User\x20ID\x20is:',_0x56acdf['id']);return getEndUser(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x3650a1[_0xcc2c('0x86')],_0x3650a1[_0xcc2c('0x87')],_0x56acdf,_0x2fb052);})[_0xcc2c('0x45')](function(_0x6bb1f6){_0x4cfd41=_0x6bb1f6;return getCall(_0x2b76fb,_0x4ea3b8,_0x4f1e89,_0x56acdf,_0x4cfd41,_0x2fb052,_0x3650a1,_0xcc2c('0x75'));})[_0xcc2c('0x45')](function(_0x29afbc){if(_0x29afbc){logger[_0xcc2c('0x29')]('The\x20Call\x20ID\x20is:',_0x29afbc['id']);logger[_0xcc2c('0x29')](_0xcc2c('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcc2c('0x2c')]('user:%s',_0x583dad[_0xcc2c('0x14')]),_0xcc2c('0x89'),{'uri':_0xcc2c('0x8a')+_0x4f1e89['host']+_0xcc2c('0x8b')+_0x29afbc['id']});}})['catch'](function(_0x376f43){logger['error'](_0xcc2c('0x88'),JSON[_0xcc2c('0xa')](_0x376f43));});};exports[_0xcc2c('0x73')]=function(_0x27913e,_0x5daf98,_0x498e63,_0x5124ac,_0x394097,_0x3336f4,_0x467409){var _0x5b7d0b,_0xcc89f0,_0x35f998;_0x3336f4[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x3336f4['host']);_0x3336f4[_0xcc2c('0x7e')]=intUtil[_0xcc2c('0x7d')](_0x3336f4[_0xcc2c('0x7e')]);if(_0x467409&&_0x467409[_0xcc2c('0x8c')]&&_0x467409['recordingFormat']!==_0xcc2c('0x8d')){logger[_0xcc2c('0x29')](_0xcc2c('0x8e'),_0xcc2c('0x80'));_0x5daf98['recordingURL']=_0x3336f4[_0xcc2c('0x7e')]+_0xcc2c('0x8f')+_0x5daf98[_0xcc2c('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x5daf98['uniqueid']);}var _0x44c167=_0x3336f4['host']==='zoho.eu'?'eu':_0xcc2c('0x85');return getAccessToken(_0x3336f4)[_0xcc2c('0x45')](function(_0x595899){_0x35f998=_0x595899;return getUser(_0x35f998,_0x44c167,_0x3336f4,_0x5124ac[_0xcc2c('0x31')]);})[_0xcc2c('0x45')](function(_0x20e497){_0x5b7d0b=_0x20e497;logger[_0xcc2c('0x29')](_0xcc2c('0x90'),_0x5b7d0b['id']);return getEndUser(_0x35f998,_0x44c167,_0x3336f4,_0x5daf98[_0xcc2c('0x91')],_0x5daf98[_0xcc2c('0x92')],_0x5b7d0b,_0x498e63);})['then'](function(_0x545701){_0xcc89f0=_0x545701;return getCall(_0x35f998,_0x44c167,_0x3336f4,_0x5b7d0b,_0xcc89f0,_0x498e63,_0x5daf98,'Outbound');})[_0xcc2c('0x45')](function(_0x1b65c0){if(_0x1b65c0){logger[_0xcc2c('0x29')](_0xcc2c('0x93'),_0x1b65c0['id']);logger[_0xcc2c('0x29')]('[OUTBOUND]',_0xcc2c('0x94'));emit(util['format'](_0xcc2c('0x95'),_0x5124ac[_0xcc2c('0x14')]),_0xcc2c('0x89'),{'uri':_0xcc2c('0x8a')+_0x3336f4[_0xcc2c('0x7c')]+_0xcc2c('0x8b')+_0x1b65c0['id']});}})[_0xcc2c('0x3b')](function(_0x3d4e51){logger['error'](_0xcc2c('0x8e'),JSON[_0xcc2c('0xa')](_0x3d4e51));});};exports[_0xcc2c('0x96')]=function(_0x4bda0e,_0x51df89,_0x91f874,_0x53ec1f,_0xdd1c41,_0x2426dc){var _0xb77689,_0x581f5a,_0x545d4c;_0x2426dc[_0xcc2c('0x7c')]=intUtil[_0xcc2c('0x7d')](_0x2426dc[_0xcc2c('0x7c')]);_0x2426dc[_0xcc2c('0x7e')]=intUtil[_0xcc2c('0x7d')](_0x2426dc[_0xcc2c('0x7e')]);if(_0xdd1c41&&_0xdd1c41[_0xcc2c('0x7f')]){logger[_0xcc2c('0x29')]('['+_0x51df89[_0xcc2c('0x67')]['toUpperCase']()+']',_0xcc2c('0x80'));_0x51df89['recordingURL']=_0x2426dc[_0xcc2c('0x7e')]+_0xcc2c('0x8f')+_0x51df89[_0xcc2c('0x82')]+_0xcc2c('0x83')+md5(_0x51df89[_0xcc2c('0x82')]);}else{_0x51df89[_0xcc2c('0x81')]='';}var _0x8228d3=_0x2426dc[_0xcc2c('0x7c')]===_0xcc2c('0x84')?'eu':'com';return getAccessToken(_0x2426dc)[_0xcc2c('0x45')](function(_0x562592){_0x545d4c=_0x562592;return getUser(_0x545d4c,_0x8228d3,_0x2426dc);})[_0xcc2c('0x45')](function(_0x224575){_0xb77689=_0x224575;logger[_0xcc2c('0x29')](_0xcc2c('0x90'),_0xb77689['id']);return getEndUser(_0x545d4c,_0x8228d3,_0x2426dc,_0x51df89[_0xcc2c('0x86')],_0x51df89[_0xcc2c('0x87')],_0xb77689,_0x91f874);})['then'](function(_0x17073b){_0x581f5a=_0x17073b;return getCall(_0x545d4c,_0x8228d3,_0x2426dc,_0xb77689,_0x581f5a,_0x91f874,_0x51df89,_0xcc2c('0x75'));})[_0xcc2c('0x45')](function(_0x4c090d){if(_0x4c090d){logger['info'](_0xcc2c('0x93'),_0x4c090d['id']);}})['catch'](function(_0x49f68f){logger[_0xcc2c('0x3a')]('['+_0x51df89['lastevent'][_0xcc2c('0x97')]()+']',JSON[_0xcc2c('0xa')](_0x49f68f));});}; \ 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 3258a00..c8e6616 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 _0x4263=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','trigger','exec','data2','Script','render','data3','error'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0x4263,0x12f));var _0x3426=function(_0x380120,_0x5a7acd){_0x380120=_0x380120-0x0;var _0x5d3ce7=_0x4263[_0x380120];return _0x5d3ce7;};'use strict';var util=require(_0x3426('0x0'));var sh=require('shelljs');var Mustache=require(_0x3426('0x1'));var logger=require('../../../../config/logger')(_0x3426('0x2'));exports[_0x3426('0x3')]=function(_0x4e260f,_0x4591e4){var _0x4cad77=_0x4e260f[_0x3426('0x4')]?_0x4e260f[_0x3426('0x4')]:_0x3426('0x5');var _0x42bb25=_0x4e260f['data3']?Mustache[_0x3426('0x6')](_0x4e260f[_0x3426('0x7')],_0x4591e4):_0x4591e4;sh[_0x3426('0x3')](_0x42bb25,function(_0x11b142,_0x1ba6ea,_0x1abcd5){if(_0x11b142!==0x0){logger[_0x3426('0x8')](util[_0x3426('0x9')](_0x3426('0xa'),_0x4cad77,_0x42bb25,_0x11b142,_0x1abcd5));}else{logger[_0x3426('0xb')](util['format'](_0x3426('0xc'),_0x4cad77,_0x42bb25,_0x1ba6ea));}});}; \ No newline at end of file +var _0xa25b=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','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'];(function(_0x20a95d,_0x2ed7de){var _0xb10938=function(_0x4a6697){while(--_0x4a6697){_0x20a95d['push'](_0x20a95d['shift']());}};_0xb10938(++_0x2ed7de);}(_0xa25b,0x90));var _0xba25=function(_0x1a76a6,_0x5e0c2b){_0x1a76a6=_0x1a76a6-0x0;var _0x577740=_0xa25b[_0x1a76a6];return _0x577740;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0xba25('0x0'));var logger=require(_0xba25('0x1'))(_0xba25('0x2'));exports[_0xba25('0x3')]=function(_0x3339b0,_0x1d1ff9){var _0x1b98e2=_0x3339b0[_0xba25('0x4')]?_0x3339b0[_0xba25('0x4')]:_0xba25('0x5');var _0x43fc99=_0x3339b0[_0xba25('0x6')]?Mustache['render'](_0x3339b0[_0xba25('0x6')],_0x1d1ff9):_0x1d1ff9;sh[_0xba25('0x3')](_0x43fc99,function(_0x370363,_0x411bec,_0xb9fcd9){if(_0x370363!==0x0){logger[_0xba25('0x7')](util[_0xba25('0x8')](_0xba25('0x9'),_0x1b98e2,_0x43fc99,_0x370363,_0xb9fcd9));}else{logger[_0xba25('0xa')](util[_0xba25('0x8')](_0xba25('0xb'),_0x1b98e2,_0x43fc99,_0x411bec));}});}; \ 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 7a8ae74..c35f45a 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 _0x22ac=['toUpperCase','render','data2','data5','data6','parse','error','stack','POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1'];(function(_0x93ac3d,_0x26e9f1){var _0x476ecf=function(_0x61ca7b){while(--_0x61ca7b){_0x93ac3d['push'](_0x93ac3d['shift']());}};_0x476ecf(++_0x26e9f1);}(_0x22ac,0x122));var _0xc22a=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x22ac[_0x37ae26];return _0x1b1902;};'use strict';var rp=require(_0xc22a('0x0'));var util=require(_0xc22a('0x1'));var _=require('lodash');var Mustache=require(_0xc22a('0x2'));var logger=require(_0xc22a('0x3'))(_0xc22a('0x4'));exports[_0xc22a('0x5')]=function(_0xb29cfa,_0x4da251){var _0x5e3af8,_0x915682;var _0x566f55={'method':_0xb29cfa[_0xc22a('0x6')][_0xc22a('0x7')](),'uri':Mustache[_0xc22a('0x8')](_0xb29cfa[_0xc22a('0x9')],_0x4da251),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb29cfa[_0xc22a('0xa')])==='number'&&parseInt(_0xb29cfa['data5'])>=0x1&&parseInt(_0xb29cfa['data5'])<=0xa?parseInt(_0xb29cfa[_0xc22a('0xa')])*0x3e8:0x5*0x3e8};try{_0x566f55['headers']=_0xb29cfa[_0xc22a('0xb')]?JSON[_0xc22a('0xc')](Mustache[_0xc22a('0x8')](_0xb29cfa[_0xc22a('0xb')],_0x4da251)):{};}catch(_0x1f0a90){logger[_0xc22a('0xd')](_0x1f0a90[_0xc22a('0xe')]);}switch(_0xb29cfa['data1'][_0xc22a('0x7')]()){case'GET':case'DELETE':_0x5e3af8=null;_0x566f55['qs']=_0x4da251;break;case _0xc22a('0xf'):case _0xc22a('0x10'):if(_0xb29cfa['data7']){try{_0x5e3af8=JSON[_0xc22a('0xc')](Mustache[_0xc22a('0x8')](_0xb29cfa[_0xc22a('0x11')],_0x4da251));_0x566f55[_0xc22a('0x12')]=_0x5e3af8;}catch(_0x1b158c){logger[_0xc22a('0xd')](_0x1b158c[_0xc22a('0xe')]);logger[_0xc22a('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5e3af8=_0x4da251;_0x566f55[_0xc22a('0x12')]=_0x5e3af8;}break;}logger[_0xc22a('0x13')](util[_0xc22a('0x14')](_0xc22a('0x15'),_0xb29cfa[_0xc22a('0x6')],_0xb29cfa['data2'],JSON[_0xc22a('0x16')](_0x566f55)));rp(_0x566f55)[_0xc22a('0x17')](function(_0x272f1e){_0x5e3af8=!_[_0xc22a('0x18')](_0x5e3af8)?_0xc22a('0x19')+_0x5e3af8:'';_0x915682=typeof _0x272f1e[_0xc22a('0x12')]===_0xc22a('0x1a')?JSON[_0xc22a('0x16')](_0x272f1e[_0xc22a('0x12')]):_0x272f1e[_0xc22a('0x12')];logger['info'](util[_0xc22a('0x14')](_0xc22a('0x1b'),_0xb29cfa[_0xc22a('0x6')],_0xb29cfa[_0xc22a('0x9')],_0x272f1e[_0xc22a('0x1c')],_0x915682));})[_0xc22a('0x1d')](function(_0x5c69aa){logger[_0xc22a('0xd')](util[_0xc22a('0x14')](_0xc22a('0x1e'),_0xb29cfa['data1'],_0xb29cfa['data2'],_0x5c69aa['statusCode'],_0x5c69aa[_0xc22a('0x1f')],_0x5c69aa[_0xc22a('0x20')]));});}; \ No newline at end of file +var _0xc4ca=['mustache','../../../../config/logger','trigger','data1','toUpperCase','render','number','data5','headers','data6','error','stack','GET','POST','PUT','data7','parse','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','info','statusCode','name','message','request-promise','util'];(function(_0x5661cf,_0x3f6960){var _0x2d6c33=function(_0x497e6a){while(--_0x497e6a){_0x5661cf['push'](_0x5661cf['shift']());}};_0x2d6c33(++_0x3f6960);}(_0xc4ca,0x11e));var _0xac4c=function(_0x45d55a,_0x1adad5){_0x45d55a=_0x45d55a-0x0;var _0x3ff504=_0xc4ca[_0x45d55a];return _0x3ff504;};'use strict';var rp=require(_0xac4c('0x0'));var util=require(_0xac4c('0x1'));var _=require('lodash');var Mustache=require(_0xac4c('0x2'));var logger=require(_0xac4c('0x3'))(_0xac4c('0x4'));exports['exec']=function(_0x302222,_0x1ecae7){var _0x505dca,_0x4b3262;var _0x481bde={'method':_0x302222[_0xac4c('0x5')][_0xac4c('0x6')](),'uri':Mustache[_0xac4c('0x7')](_0x302222['data2'],_0x1ecae7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x302222['data5'])===_0xac4c('0x8')&&parseInt(_0x302222[_0xac4c('0x9')])>=0x1&&parseInt(_0x302222['data5'])<=0xa?parseInt(_0x302222[_0xac4c('0x9')])*0x3e8:0x5*0x3e8};try{_0x481bde[_0xac4c('0xa')]=_0x302222[_0xac4c('0xb')]?JSON['parse'](Mustache[_0xac4c('0x7')](_0x302222['data6'],_0x1ecae7)):{};}catch(_0x4d5d3e){logger[_0xac4c('0xc')](_0x4d5d3e[_0xac4c('0xd')]);}switch(_0x302222[_0xac4c('0x5')][_0xac4c('0x6')]()){case _0xac4c('0xe'):case'DELETE':_0x505dca=null;_0x481bde['qs']=_0x1ecae7;break;case _0xac4c('0xf'):case _0xac4c('0x10'):if(_0x302222[_0xac4c('0x11')]){try{_0x505dca=JSON[_0xac4c('0x12')](Mustache['render'](_0x302222['data7'],_0x1ecae7));_0x481bde[_0xac4c('0x13')]=_0x505dca;}catch(_0x3ee796){logger['error'](_0x3ee796['stack']);logger[_0xac4c('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x505dca=_0x1ecae7;_0x481bde[_0xac4c('0x13')]=_0x505dca;}break;}logger['info'](util[_0xac4c('0x14')](_0xac4c('0x15'),_0x302222['data1'],_0x302222[_0xac4c('0x16')],JSON[_0xac4c('0x17')](_0x481bde)));rp(_0x481bde)[_0xac4c('0x18')](function(_0x90ec0f){_0x505dca=!_[_0xac4c('0x19')](_0x505dca)?_0xac4c('0x1a')+_0x505dca:'';_0x4b3262=typeof _0x90ec0f[_0xac4c('0x13')]===_0xac4c('0x1b')?JSON[_0xac4c('0x17')](_0x90ec0f[_0xac4c('0x13')]):_0x90ec0f[_0xac4c('0x13')];logger[_0xac4c('0x1c')](util[_0xac4c('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x302222[_0xac4c('0x5')],_0x302222[_0xac4c('0x16')],_0x90ec0f[_0xac4c('0x1d')],_0x4b3262));})['catch'](function(_0x3a21a0){logger[_0xac4c('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x302222[_0xac4c('0x5')],_0x302222[_0xac4c('0x16')],_0x3a21a0[_0xac4c('0x1d')],_0x3a21a0[_0xac4c('0x1e')],_0x3a21a0[_0xac4c('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 40808d7..0e0854c 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 _0x7074=['bluebird','../../config/logger','routing','client','http','Request','debug','rpc','error','message','result','catch','jayson/promise'];(function(_0x276d02,_0x57b4a6){var _0x26bbf7=function(_0x177da4){while(--_0x177da4){_0x276d02['push'](_0x276d02['shift']());}};_0x26bbf7(++_0x57b4a6);}(_0x7074,0x9b));var _0x4707=function(_0x37b63d,_0x1833d2){_0x37b63d=_0x37b63d-0x0;var _0x50f408=_0x7074[_0x37b63d];return _0x50f408;};'use strict';var jayson=require(_0x4707('0x0'));var BPromise=require(_0x4707('0x1'));var logger=require(_0x4707('0x2'))(_0x4707('0x3'));var client=jayson[_0x4707('0x4')][_0x4707('0x5')]({'port':0x2329});client[_0x4707('0x6')]=function(_0x486828,_0x54626a){return new BPromise(function(_0x370439,_0x27ffdf){return client['request'](_0x486828,_0x54626a)['then'](function(_0x3de9e2){logger[_0x4707('0x7')](_0x4707('0x8'),_0x4707('0x3'),_0x486828,_0x54626a,_0x3de9e2);if(_0x3de9e2[_0x4707('0x9')]){logger['error'](_0x4707('0x8'),_0x4707('0x3'),_0x486828,_0x3de9e2[_0x4707('0x9')]['message'],_0x54626a);return _0x27ffdf(_0x3de9e2[_0x4707('0x9')][_0x4707('0xa')]);}else{return _0x370439(_0x3de9e2[_0x4707('0xb')]);}})[_0x4707('0xc')](function(_0x39e68f){logger[_0x4707('0x9')](_0x4707('0x8'),_0x4707('0x3'),_0x486828,_0x39e68f,_0x54626a);return _0x27ffdf(_0x39e68f);});});};module['exports']=client; \ No newline at end of file +var _0x2741=['rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','error'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x2741,0x18b));var _0x1274=function(_0x291abe,_0x50c04a){_0x291abe=_0x291abe-0x0;var _0x1a7fb6=_0x2741[_0x291abe];return _0x1a7fb6;};'use strict';var jayson=require(_0x1274('0x0'));var BPromise=require(_0x1274('0x1'));var logger=require(_0x1274('0x2'))(_0x1274('0x3'));var client=jayson[_0x1274('0x4')][_0x1274('0x5')]({'port':0x2329});client[_0x1274('0x6')]=function(_0x45f98f,_0x292a1d){return new BPromise(function(_0x1cc11a,_0x2eb413){return client[_0x1274('0x7')](_0x45f98f,_0x292a1d)['then'](function(_0x10dbfd){logger[_0x1274('0x8')]('rpc',_0x1274('0x3'),_0x45f98f,_0x292a1d,_0x10dbfd);if(_0x10dbfd['error']){logger[_0x1274('0x9')](_0x1274('0xa'),_0x1274('0x3'),_0x45f98f,_0x10dbfd[_0x1274('0x9')][_0x1274('0xb')],_0x292a1d);return _0x2eb413(_0x10dbfd['error']['message']);}else{return _0x1cc11a(_0x10dbfd[_0x1274('0xc')]);}})[_0x1274('0xd')](function(_0x5b9dc5){logger[_0x1274('0x9')](_0x1274('0xa'),_0x1274('0x3'),_0x45f98f,_0x5b9dc5,_0x292a1d);return _0x2eb413(_0x5b9dc5);});});};module[_0x1274('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4fce8ac..9113cc9 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 _0x5833=['./realtime','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x1a7ae0,_0x8a2c85){var _0x17d4f3=function(_0x93a1a0){while(--_0x93a1a0){_0x1a7ae0['push'](_0x1a7ae0['shift']());}};_0x17d4f3(++_0x8a2c85);}(_0x5833,0xef));var _0x3583=function(_0x42e731,_0x3bd0f4){_0x42e731=_0x42e731-0x0;var _0x36e058=_0x5833[_0x42e731];return _0x36e058;};'use strict';var server=require(_0x3583('0x0'));var Realtime=require(_0x3583('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x3583('0x2'))(_0x3583('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3583('0x4')]()[_0x3583('0x5')](mailAccount[_0x3583('0x6')]())['then'](realtime[_0x3583('0x7')]())[_0x3583('0x5')](function(){email[_0x3583('0x8')](realtime[_0x3583('0x9')]);return realtime;});}function main(){return server[_0x3583('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0x3583('0x5')](function(){return setting[_0x3583('0xb')]();})[_0x3583('0x5')](function(_0xff3f20){return setInterval(initRealtime,_0xff3f20[_0x3583('0xc')]*0x3e8);})[_0x3583('0xd')](function(_0x282aec){logger[_0x3583('0xe')](_0x3583('0xf'),_0x282aec);});}main(); \ No newline at end of file +var _0xb0b2=['Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','catch'];(function(_0x135893,_0x513d45){var _0x53aca3=function(_0x54551c){while(--_0x54551c){_0x135893['push'](_0x135893['shift']());}};_0x53aca3(++_0x513d45);}(_0xb0b2,0x15f));var _0x2b0b=function(_0x5e8a6c,_0x493d1f){_0x5e8a6c=_0x5e8a6c-0x0;var _0x14b856=_0xb0b2[_0x5e8a6c];return _0x14b856;};'use strict';var server=require(_0x2b0b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x2b0b('0x1'));var mailAccount=require(_0x2b0b('0x2'));var setting=require(_0x2b0b('0x3'));var logger=require(_0x2b0b('0x4'))(_0x2b0b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x2b0b('0x6')](mailAccount[_0x2b0b('0x7')]())[_0x2b0b('0x6')](realtime[_0x2b0b('0x8')]())['then'](function(){email[_0x2b0b('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2b0b('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0x2b0b('0x6')](function(){return setting[_0x2b0b('0xb')]();})['then'](function(_0x14fbcd){return setInterval(initRealtime,_0x14fbcd['loginMailFrequency']*0x3e8);})[_0x2b0b('0xc')](function(_0x45a1ca){logger['error'](_0x2b0b('0xd'),_0x45a1ca);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c5301a0..ec41c29 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 _0xa80a=['active','Imap','messageStatus','total','stringify','refresh','service','provider','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','isNil','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key'];(function(_0x226a53,_0x1d8999){var _0x1fd0b6=function(_0x57a161){while(--_0x57a161){_0x226a53['push'](_0x226a53['shift']());}};_0x1fd0b6(++_0x1d8999);}(_0xa80a,0x127));var _0xaa80=function(_0x5725ba,_0x1c965a){_0x5725ba=_0x5725ba-0x0;var _0x4b5173=_0xa80a[_0x5725ba];return _0x4b5173;};'use strict';var _=require(_0xaa80('0x0'));var moment=require(_0xaa80('0x1'));var BPromise=require('bluebird');var md5=require(_0xaa80('0x2'));var Redis=require(_0xaa80('0x3'));var config=require(_0xaa80('0x4'));var logger=require(_0xaa80('0x5'))(_0xaa80('0x6'));config[_0xaa80('0x7')]=_['defaults'](config[_0xaa80('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa80('0x7')]));var EmailImap=require(_0xaa80('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xf039a8){logger[_0xaa80('0x9')](_0xaa80('0xa'));this[_0xaa80('0xb')]=_0xf039a8[_0xaa80('0xb')];this[_0xaa80('0xc')]={};this[_0xaa80('0xd')]=new EmailSmtp();}EmailChannel[_0xaa80('0xe')][_0xaa80('0xf')]=function(_0x1f6f45){var _0x12ba18=this['mailAccounts'][_0x1f6f45];var _0x415856={'id':_0x12ba18['id'],'name':_0x12ba18['name'],'key':_0x12ba18[_0xaa80('0x10')],'active':_0x12ba18[_0xaa80('0x11')],'Imap':{'status':_0x12ba18[_0xaa80('0x12')]['status'],'messageStatus':_0x12ba18[_0xaa80('0x12')][_0xaa80('0x13')],'total':_0x12ba18['Imap'][_0xaa80('0x14')]}};if(_['isNil'](md5Accounts[_0x1f6f45])){md5Accounts[_0x1f6f45]={};}var _0x3727d6=md5(JSON[_0xaa80('0x15')](_0x415856));if(md5Accounts[_0x1f6f45]['md5']!==_0x3727d6){md5Accounts[_0x1f6f45]['md5']=_0x3727d6;io[_0xaa80('0xf')]('mailAccount:update',_0x415856);}};EmailChannel[_0xaa80('0xe')][_0xaa80('0x16')]=function(_0x273dfa){for(var _0x84f31a in _0x273dfa){if(_0x273dfa['hasOwnProperty'](_0x84f31a)){if(_0x273dfa[_0x84f31a][_0xaa80('0x12')]&&_0x273dfa[_0x84f31a][_0xaa80('0x11')]){var _0x72b63e=_0x273dfa[_0x84f31a][_0xaa80('0x12')];if(!_0x72b63e[_0xaa80('0x17')]&&_0x273dfa[_0x84f31a][_0xaa80('0x18')]!=='custom')_0x72b63e['service']=_0x273dfa[_0x84f31a][_0xaa80('0x18')];if(!this[_0xaa80('0xc')][_0xaa80('0x19')](_0x72b63e['id'])){this[_0xaa80('0xc')][_0x72b63e['id']]=new EmailImap(_0x72b63e,_0x273dfa[_0x84f31a][_0xaa80('0x6')]);this[_0xaa80('0xc')][_0x72b63e['id']]['on'](_0xaa80('0x1a'),this[_0xaa80('0x1b')][_0xaa80('0x1c')](this,_0x84f31a));this[_0xaa80('0xc')][_0x72b63e['id']]['on'](_0xaa80('0x6'),this[_0xaa80('0x1d')][_0xaa80('0x1c')](this,_0x84f31a));this[_0xaa80('0xc')][_0x72b63e['id']]['on'](_0xaa80('0x1e'),this[_0xaa80('0x1f')][_0xaa80('0x1c')](this,_0x84f31a));this['imapAccounts'][_0x72b63e['id']]['on'](_0xaa80('0x20'),this[_0xaa80('0x21')][_0xaa80('0x1c')](this,_0x84f31a));}}else{if(_['isNil'](this[_0xaa80('0xb')][_0x84f31a]['Imap'])){this[_0xaa80('0xb')][_0x84f31a]['Imap']={};}this[_0xaa80('0xb')][_0x84f31a][_0xaa80('0x12')]['status']='disabled';this[_0xaa80('0xb')][_0x84f31a][_0xaa80('0x12')][_0xaa80('0x13')]='';this[_0xaa80('0xf')](_0x84f31a);}}}};EmailChannel['prototype'][_0xaa80('0x1b')]=function(_0x6e14d4,_0x532db7){if(this[_0xaa80('0xb')][_0x6e14d4]){this[_0xaa80('0xb')][_0x6e14d4][_0xaa80('0x12')]['status']='connected';this[_0xaa80('0xb')][_0x6e14d4][_0xaa80('0x12')][_0xaa80('0x13')]=_0x532db7[_0xaa80('0x22')];if(_0x532db7[_0xaa80('0x23')]){this[_0xaa80('0xb')][_0x6e14d4][_0xaa80('0x12')]['total']=_0x532db7[_0xaa80('0x23')][_0xaa80('0x14')];}return this[_0xaa80('0xf')](_0x6e14d4);}};EmailChannel['prototype'][_0xaa80('0x1d')]=function(_0x1fd9bb,_0x5f140d){logger[_0xaa80('0x9')](_0xaa80('0x24'),_0x5f140d[_0xaa80('0x25')],_0x5f140d[_0xaa80('0x26')],_0x5f140d[_0xaa80('0x27')],_0x1fd9bb);if(this[_0xaa80('0xb')][_0x1fd9bb]){return mailAccount[_0xaa80('0x28')](_0x1fd9bb,_0x5f140d)[_0xaa80('0x29')](function(_0x4fc6cc){if(_0x4fc6cc){logger[_0xaa80('0x9')](_0xaa80('0x2a'));}})[_0xaa80('0x2b')](function(_0x3c1096){logger[_0xaa80('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xaa80('0x15')](_0x3c1096));});}};EmailChannel[_0xaa80('0xe')][_0xaa80('0x1f')]=function(_0x5e8fd1){if(this[_0xaa80('0xb')][_0x5e8fd1]&&this['mailAccounts'][_0x5e8fd1][_0xaa80('0x12')]){if(this[_0xaa80('0xc')][this[_0xaa80('0xb')][_0x5e8fd1][_0xaa80('0x12')]['id']]){delete this[_0xaa80('0xc')][this['mailAccounts'][_0x5e8fd1][_0xaa80('0x12')]['id']];}this[_0xaa80('0xb')][_0x5e8fd1]['Imap'][_0xaa80('0x2c')]=moment();this[_0xaa80('0xf')](_0x5e8fd1);}};EmailChannel[_0xaa80('0xe')][_0xaa80('0x21')]=function(_0x199671,_0x2602c7){if(this[_0xaa80('0xb')][_0x199671]){this['mailAccounts'][_0x199671][_0xaa80('0x12')]['status']=_0xaa80('0x20');this[_0xaa80('0xb')][_0x199671][_0xaa80('0x12')][_0xaa80('0x13')]=_0x2602c7;return this[_0xaa80('0xf')](_0x199671);}};EmailChannel[_0xaa80('0xe')][_0xaa80('0x2d')]=function(_0xb4a1c0,_0x47633e){return this[_0xaa80('0xd')][_0xaa80('0x2e')](_0xb4a1c0,_0x47633e);};EmailChannel[_0xaa80('0xe')]['verifySmtp']=function(_0xc68b7){var _0x54716c=this;if(this[_0xaa80('0xb')][_0xc68b7['id']]){if(_[_0xaa80('0x2f')](this['mailAccounts'][_0xc68b7['id']]['Smtp'])){this[_0xaa80('0xb')][_0xc68b7['id']][_0xaa80('0x30')]={};}this['mailAccounts'][_0xc68b7['id']][_0xaa80('0x30')][_0xaa80('0x2c')]=moment();return new BPromise(function(_0x577245,_0xd969e9){return _0x54716c[_0xaa80('0xd')][_0xaa80('0x31')](_0xc68b7)[_0xaa80('0x29')](function(_0x4ef1a1){_0x54716c[_0xaa80('0xb')][_0xc68b7['id']][_0xaa80('0x30')]['status']=_0xaa80('0x32');_0x54716c['mailAccounts'][_0xc68b7['id']][_0xaa80('0x30')][_0xaa80('0x13')]='';_0x54716c[_0xaa80('0xf')](_0xc68b7['id']);_0x577245(_0x4ef1a1);})[_0xaa80('0x2b')](function(_0x5b8dec){_0x54716c['mailAccounts'][_0xc68b7['id']][_0xaa80('0x30')]['status']=_0xaa80('0x20');_0x54716c[_0xaa80('0xb')][_0xc68b7['id']][_0xaa80('0x30')][_0xaa80('0x13')]=_0x5b8dec;_0x54716c[_0xaa80('0xf')](_0xc68b7['id']);_0xd969e9(_0x5b8dec);});});}return this[_0xaa80('0xd')][_0xaa80('0x31')](_0xc68b7);};module[_0xaa80('0x33')]=EmailChannel; \ No newline at end of file +var _0x0a90=['ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','isNil','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','verifySmtp','Smtp','verify','then','lodash','moment','bluebird','md5'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a90,0x17d));var _0x00a9=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0a90[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x00a9('0x0'));var moment=require(_0x00a9('0x1'));var BPromise=require(_0x00a9('0x2'));var md5=require(_0x00a9('0x3'));var Redis=require(_0x00a9('0x4'));var config=require(_0x00a9('0x5'));var logger=require(_0x00a9('0x6'))(_0x00a9('0x7'));config[_0x00a9('0x8')]=_[_0x00a9('0x9')](config[_0x00a9('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00a9('0x8')]));var EmailImap=require(_0x00a9('0xa'));var EmailSmtp=require(_0x00a9('0xb'));var mailAccount=require(_0x00a9('0xc'));var md5Accounts={};function EmailChannel(_0x228b73){logger[_0x00a9('0xd')]('start\x20email\x20channel');this[_0x00a9('0xe')]=_0x228b73[_0x00a9('0xe')];this[_0x00a9('0xf')]={};this[_0x00a9('0x10')]=new EmailSmtp();}EmailChannel[_0x00a9('0x11')][_0x00a9('0x12')]=function(_0x5c7f0c){var _0x2d7722=this[_0x00a9('0xe')][_0x5c7f0c];var _0x2a3919={'id':_0x2d7722['id'],'name':_0x2d7722[_0x00a9('0x13')],'key':_0x2d7722['key'],'active':_0x2d7722[_0x00a9('0x14')],'Imap':{'status':_0x2d7722[_0x00a9('0x15')][_0x00a9('0x16')],'messageStatus':_0x2d7722['Imap'][_0x00a9('0x17')],'total':_0x2d7722[_0x00a9('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x5c7f0c])){md5Accounts[_0x5c7f0c]={};}var _0x12521d=md5(JSON[_0x00a9('0x18')](_0x2a3919));if(md5Accounts[_0x5c7f0c][_0x00a9('0x3')]!==_0x12521d){md5Accounts[_0x5c7f0c][_0x00a9('0x3')]=_0x12521d;io['emit']('mailAccount:update',_0x2a3919);}};EmailChannel['prototype'][_0x00a9('0x19')]=function(_0x27f779){for(var _0x3d776e in _0x27f779){if(_0x27f779[_0x00a9('0x1a')](_0x3d776e)){if(_0x27f779[_0x3d776e]['Imap']&&_0x27f779[_0x3d776e][_0x00a9('0x14')]){var _0x3b759f=_0x27f779[_0x3d776e][_0x00a9('0x15')];if(!_0x3b759f[_0x00a9('0x1b')]&&_0x27f779[_0x3d776e][_0x00a9('0x1c')]!==_0x00a9('0x1d'))_0x3b759f[_0x00a9('0x1b')]=_0x27f779[_0x3d776e]['provider'];if(!this[_0x00a9('0xf')][_0x00a9('0x1a')](_0x3b759f['id'])){this['imapAccounts'][_0x3b759f['id']]=new EmailImap(_0x3b759f,_0x27f779[_0x3d776e][_0x00a9('0x7')]);this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x1e'),this[_0x00a9('0x1f')][_0x00a9('0x20')](this,_0x3d776e));this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x7'),this[_0x00a9('0x21')][_0x00a9('0x20')](this,_0x3d776e));this[_0x00a9('0xf')][_0x3b759f['id']]['on'](_0x00a9('0x22'),this['handleImapEnd'][_0x00a9('0x20')](this,_0x3d776e));this['imapAccounts'][_0x3b759f['id']]['on'](_0x00a9('0x23'),this[_0x00a9('0x24')][_0x00a9('0x20')](this,_0x3d776e));}}else{if(_[_0x00a9('0x25')](this[_0x00a9('0xe')][_0x3d776e][_0x00a9('0x15')])){this[_0x00a9('0xe')][_0x3d776e][_0x00a9('0x15')]={};}this['mailAccounts'][_0x3d776e]['Imap'][_0x00a9('0x16')]=_0x00a9('0x26');this['mailAccounts'][_0x3d776e][_0x00a9('0x15')][_0x00a9('0x17')]='';this['emit'](_0x3d776e);}}}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x1f')]=function(_0x68c8c5,_0x434fc8){if(this[_0x00a9('0xe')][_0x68c8c5]){this[_0x00a9('0xe')][_0x68c8c5][_0x00a9('0x15')][_0x00a9('0x16')]=_0x00a9('0x27');this['mailAccounts'][_0x68c8c5][_0x00a9('0x15')]['messageStatus']=_0x434fc8['name'];if(_0x434fc8[_0x00a9('0x28')]){this['mailAccounts'][_0x68c8c5][_0x00a9('0x15')][_0x00a9('0x29')]=_0x434fc8[_0x00a9('0x28')][_0x00a9('0x29')];}return this[_0x00a9('0x12')](_0x68c8c5);}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x21')]=function(_0x41261f,_0x7bcb1e){logger[_0x00a9('0xd')](_0x00a9('0x2a'),_0x7bcb1e[_0x00a9('0x2b')],_0x7bcb1e[_0x00a9('0x2c')],_0x7bcb1e[_0x00a9('0x2d')],_0x41261f);if(this[_0x00a9('0xe')][_0x41261f]){return mailAccount[_0x00a9('0x2e')](_0x41261f,_0x7bcb1e)['then'](function(_0x1345ad){if(_0x1345ad){logger[_0x00a9('0xd')](_0x00a9('0x2f'));}})[_0x00a9('0x30')](function(_0xe727e8){logger[_0x00a9('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x00a9('0x18')](_0xe727e8));});}};EmailChannel[_0x00a9('0x11')][_0x00a9('0x31')]=function(_0x53faca){if(this[_0x00a9('0xe')][_0x53faca]&&this['mailAccounts'][_0x53faca][_0x00a9('0x15')]){if(this['imapAccounts'][this[_0x00a9('0xe')][_0x53faca][_0x00a9('0x15')]['id']]){delete this[_0x00a9('0xf')][this[_0x00a9('0xe')][_0x53faca]['Imap']['id']];}this[_0x00a9('0xe')][_0x53faca][_0x00a9('0x15')][_0x00a9('0x32')]=moment();this[_0x00a9('0x12')](_0x53faca);}};EmailChannel['prototype']['handleImapError']=function(_0x524fc1,_0x26548b){if(this['mailAccounts'][_0x524fc1]){this[_0x00a9('0xe')][_0x524fc1]['Imap'][_0x00a9('0x16')]='error';this[_0x00a9('0xe')][_0x524fc1]['Imap']['messageStatus']=_0x26548b;return this[_0x00a9('0x12')](_0x524fc1);}};EmailChannel[_0x00a9('0x11')]['sendMail']=function(_0x514b1a,_0x216018){return this[_0x00a9('0x10')]['send'](_0x514b1a,_0x216018);};EmailChannel['prototype'][_0x00a9('0x33')]=function(_0x2993ff){var _0x47a2fc=this;if(this['mailAccounts'][_0x2993ff['id']]){if(_[_0x00a9('0x25')](this['mailAccounts'][_0x2993ff['id']]['Smtp'])){this[_0x00a9('0xe')][_0x2993ff['id']]['Smtp']={};}this[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x32')]=moment();return new BPromise(function(_0x1eda4b,_0x389c91){return _0x47a2fc[_0x00a9('0x10')][_0x00a9('0x35')](_0x2993ff)[_0x00a9('0x36')](function(_0xb95676){_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']]['Smtp'][_0x00a9('0x16')]='verified';_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x17')]='';_0x47a2fc['emit'](_0x2993ff['id']);_0x1eda4b(_0xb95676);})[_0x00a9('0x30')](function(_0x3a7ebb){_0x47a2fc['mailAccounts'][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x16')]=_0x00a9('0x23');_0x47a2fc[_0x00a9('0xe')][_0x2993ff['id']][_0x00a9('0x34')][_0x00a9('0x17')]=_0x3a7ebb;_0x47a2fc[_0x00a9('0x12')](_0x2993ff['id']);_0x389c91(_0x3a7ebb);});});}return this[_0x00a9('0x10')][_0x00a9('0x35')](_0x2993ff);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4a0063c..5cd6e28 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 _0xc7e0=['handleMessageAttributes','handleMessageEnd','handleSimpleParser','html','parser','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','substring','text','handleCloseBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','../../../config/environment','emailMaxHTMLbytesLimit','mailbox','account','getAccount','ready','handleReady','bind','once','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','openBox','handleOpenBox','emit','box','end','readUnseen','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody'];(function(_0x531409,_0x57a1fe){var _0x3e3664=function(_0x35dcc3){while(--_0x35dcc3){_0x531409['push'](_0x531409['shift']());}};_0x3e3664(++_0x57a1fe);}(_0xc7e0,0xa8));var _0x0c7e=function(_0x2f9af1,_0x5ede80){_0x2f9af1=_0x2f9af1-0x0;var _0xf0a156=_0xc7e0[_0x2f9af1];return _0xf0a156;};'use strict';var _=require(_0x0c7e('0x0'));var util=require('util');var Imap=require(_0x0c7e('0x1'));var simpleParser=require(_0x0c7e('0x2'))[_0x0c7e('0x3')];var Iconv=require('iconv')[_0x0c7e('0x4')];var EventEmitter=require(_0x0c7e('0x5'))[_0x0c7e('0x6')];var utils=require(_0x0c7e('0x7'));var logger=require(_0x0c7e('0x8'))(_0x0c7e('0x9'));var config=require(_0x0c7e('0xa'));const MAX_HTML_BYTES_SIZE=config[_0x0c7e('0xb')]||0xee6b2800;function EmailImap(_0x4c65c7,_0x2ff8bb){this[_0x0c7e('0xc')]=_0x4c65c7[_0x0c7e('0xc')];this[_0x0c7e('0xd')]=this[_0x0c7e('0xe')](_0x4c65c7,_0x2ff8bb);this[_0x0c7e('0x1')]=new Imap(this[_0x0c7e('0xd')]);this[_0x0c7e('0x1')]['once'](_0x0c7e('0xf'),this[_0x0c7e('0x10')][_0x0c7e('0x11')](this));this[_0x0c7e('0x1')][_0x0c7e('0x12')]('end',this['handleEnd'][_0x0c7e('0x11')](this));this[_0x0c7e('0x1')]['on'](_0x0c7e('0x13'),this[_0x0c7e('0x14')][_0x0c7e('0x11')](this));this['imap'][_0x0c7e('0x15')]();}util[_0x0c7e('0x16')](EmailImap,EventEmitter);EmailImap[_0x0c7e('0x17')][_0x0c7e('0xe')]=function(_0x586bb7,_0x44ae79){var _0x40808d={'connTimeout':_0x586bb7[_0x0c7e('0x18')]?_0x586bb7[_0x0c7e('0x18')]*0x3e8:0x2710,'authTimeout':_0x586bb7[_0x0c7e('0x19')]?_0x586bb7[_0x0c7e('0x19')]*0x3e8:0x1388};if(_0x586bb7[_0x0c7e('0x1a')]){_0x40808d['user']=_0x586bb7[_0x0c7e('0x1b')];if(_0x586bb7[_0x0c7e('0x1c')]){_0x40808d[_0x0c7e('0x1d')]=utils[_0x0c7e('0x1e')](_0x586bb7[_0x0c7e('0x1f')][_0x0c7e('0x20')],_0x586bb7[_0x0c7e('0x1b')]);}else{_0x40808d[_0x0c7e('0x21')]=_0x586bb7[_0x0c7e('0x21')];}}else{if(_0x586bb7[_0x0c7e('0x22')]){_0x40808d[_0x0c7e('0x1b')]=_0x586bb7['user'];_0x40808d[_0x0c7e('0x21')]=_0x586bb7[_0x0c7e('0x21')];}}_0x40808d['email']=_0x44ae79||_0x586bb7[_0x0c7e('0x1b')]||_0x0c7e('0x23');_0x40808d[_0x0c7e('0x24')]=_0x586bb7['host'];_0x40808d['port']=_0x586bb7[_0x0c7e('0x25')]||0x3e1;if(_0x586bb7[_0x0c7e('0x26')]){_0x40808d[_0x0c7e('0x26')]=!![];}else{_0x40808d['tls']=![];_0x40808d['autotls']='required';}return _0x40808d;};EmailImap[_0x0c7e('0x17')]['handleReady']=function(){this[_0x0c7e('0x1')][_0x0c7e('0x27')](this[_0x0c7e('0xc')],![],this[_0x0c7e('0x28')][_0x0c7e('0x11')](this));};EmailImap[_0x0c7e('0x17')]['handleOpenBox']=function(_0x176840,_0x3330b1){if(_0x176840){this[_0x0c7e('0x14')](_0x176840,!![]);}else{this[_0x0c7e('0x29')](_0x0c7e('0x2a'),_0x3330b1);this['readUnseen']();}};EmailImap[_0x0c7e('0x17')]['handleCloseBox']=function(_0x43b2fb){if(_0x43b2fb){this[_0x0c7e('0x14')](_0x43b2fb,!![]);}else{this[_0x0c7e('0x1')][_0x0c7e('0x2b')]();}};EmailImap['prototype'][_0x0c7e('0x2c')]=function(){this[_0x0c7e('0x1')]['search']([_0x0c7e('0x2d')],this['handleReadUnseen'][_0x0c7e('0x11')](this));};EmailImap[_0x0c7e('0x17')][_0x0c7e('0x2e')]=function(_0xb2960e,_0x168942){if(_0xb2960e){this['handleError'](_0xb2960e,!![]);}else{if(_0x168942[_0x0c7e('0x2f')]){try{var _0x3aac2c=this[_0x0c7e('0x1')][_0x0c7e('0x30')](_0x168942[_0x0c7e('0x31')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x3aac2c['on'](_0x0c7e('0x32'),this['handleFetchMessage'][_0x0c7e('0x11')](this));_0x3aac2c['once'](_0x0c7e('0x13'),this[_0x0c7e('0x33')][_0x0c7e('0x11')](this));_0x3aac2c['once'](_0x0c7e('0x2b'),this[_0x0c7e('0x34')]['bind'](this));}catch(_0x1d3ccc){logger[_0x0c7e('0x13')](_0x1d3ccc);}}else{this['imap'][_0x0c7e('0x35')](!![],this['handleCloseBox'][_0x0c7e('0x11')](this));}}};EmailImap[_0x0c7e('0x17')][_0x0c7e('0x36')]=function(_0x5ac8f4){_0x5ac8f4['on'](_0x0c7e('0x37'),this[_0x0c7e('0x38')][_0x0c7e('0x11')](this));_0x5ac8f4[_0x0c7e('0x12')]('attributes',this[_0x0c7e('0x39')][_0x0c7e('0x11')](this));_0x5ac8f4[_0x0c7e('0x12')](_0x0c7e('0x2b'),this[_0x0c7e('0x3a')][_0x0c7e('0x11')](this));};EmailImap[_0x0c7e('0x17')][_0x0c7e('0x38')]=function(_0x45683c){simpleParser(_0x45683c,{'Iconv':Iconv},this[_0x0c7e('0x3b')][_0x0c7e('0x11')](this));};EmailImap[_0x0c7e('0x17')][_0x0c7e('0x39')]=function(){};EmailImap[_0x0c7e('0x17')][_0x0c7e('0x3a')]=function(){};EmailImap[_0x0c7e('0x17')]['handleSimpleParser']=function(_0x46824f,_0x21b690){if(_0x46824f){logger[_0x0c7e('0x13')](_0x46824f);}else{var _0x250d78=this;const _0x22fa7e=_0x21b690[_0x0c7e('0x3c')][_0x0c7e('0x2f')];if(_0x22fa7eEmpty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','toString','lodash','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ab9,0xfb));var _0x97ab=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x7ab9[_0x191154];return _0x3dcd73;};'use strict';var _=require(_0x97ab('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x97ab('0x1'));var util=require('util');var tnef=require(_0x97ab('0x2'));var logger=require(_0x97ab('0x3'))(_0x97ab('0x4'));var config=require('../../../config/environment');function getAddress(_0xde0a10){var _0x89edfb=_[_0x97ab('0x5')](_0xde0a10[_0x97ab('0x6')]);return _0x89edfb&&_0x89edfb[_0x97ab('0x7')]?_0x89edfb['address']:_0x97ab('0x8')+random[_0x97ab('0x9')](0x6)+_0x97ab('0xa');}function getFirstName(_0x38e084){var _0x54da4d=_[_0x97ab('0x5')](_0x38e084[_0x97ab('0x6')]);if(_0x54da4d&&_0x54da4d[_0x97ab('0xb')]){if(_0x54da4d[_0x97ab('0xb')]==_0x54da4d[_0x97ab('0x7')]){return _0x54da4d[_0x97ab('0xb')][_0x97ab('0xc')](0x0,_0x54da4d['name'][_0x97ab('0xd')]('@'));}var _0x3c1f7d=_0x54da4d[_0x97ab('0xb')][_0x97ab('0xe')](/\s+/);return _0x3c1f7d[_0x97ab('0xf')]>0x1?_0x3c1f7d[_0x97ab('0x10')](0x0,-0x1)[_0x97ab('0x11')]('\x20'):_0x54da4d['name'];}return'Anonymous';}function getLastName(_0x3973da){var _0x58a994=_[_0x97ab('0x5')](_0x3973da[_0x97ab('0x6')]);if(_0x58a994&&_0x58a994['name']){var _0x14d689=_0x58a994[_0x97ab('0xb')][_0x97ab('0xe')](/\s+/);return _0x14d689['length']>0x1?_0x14d689[_0x97ab('0x12')]():'';}return'';}function getMails(_0x5b5052,_0x41e008){var _0x243598='';for(var _0x3d27ba=0x0;_0x3d27ba<_0x41e008[_0x97ab('0x6')]['length'];_0x3d27ba+=0x1){if(_0x41e008['value'][_0x3d27ba][_0x97ab('0x7')]!==_0x5b5052){if(!_[_0x97ab('0x13')](_0x243598)){_0x243598+=',';}_0x243598+=_0x41e008[_0x97ab('0x6')][_0x3d27ba][_0x97ab('0xb')]||_0x41e008[_0x97ab('0x6')][_0x3d27ba][_0x97ab('0x7')]||'';_0x243598+='\x20<';_0x243598+=_0x41e008[_0x97ab('0x6')][_0x3d27ba][_0x97ab('0x7')]?_0x41e008[_0x97ab('0x6')][_0x3d27ba]['address']:_0x97ab('0x8')+random['generate'](0x6)+_0x97ab('0xa');_0x243598+='>';}}return _0x243598;}function parseEmail(_0x400a16,_0x2ba5,_0x461048){if(_0x2ba5[_0x97ab('0x14')]){var _0x51bc77=/)<[^<]*)*<\/script>/gi;while(_0x51bc77[_0x97ab('0x15')](_0x2ba5[_0x97ab('0x14')])){_0x2ba5['html']=_0x2ba5[_0x97ab('0x14')]['replace'](_0x51bc77,'');}if(_0x2ba5[_0x97ab('0x14')][_0x97ab('0x16')](_0x97ab('0x17'))){var _0x244315=[];_0x2ba5[_0x97ab('0x18')][_0x97ab('0x19')](_0x437381=>{_0x244315[_0x97ab('0x1a')](_0x437381[_0x97ab('0x1b')]);});var _0x722c86=/]+>/g;var _0x3b7a07=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x51c1c7=_0x2ba5[_0x97ab('0x14')][_0x97ab('0x1c')](_0x3b7a07,_0x97ab('0x1d'));var _0x5ec2b0=_0x51c1c7[_0x97ab('0x1c')](_0x722c86,_0x97ab('0x1e'));for(let _0x5d5b1b=0x0;_0x5d5b1b<_0x244315['length'];_0x5d5b1b++){var _0x434f8e=_0x5ec2b0['replace'](_0x97ab('0x1e'),_0x97ab('0x1f')+_0x244315[_0x5d5b1b]+_0x97ab('0x20'));_0x5ec2b0=_0x434f8e;}_0x2ba5[_0x97ab('0x14')]=_0x5ec2b0;}_0x461048[_0x97ab('0x21')]=_0x2ba5['html'];}else{_0x461048[_0x97ab('0x21')]=_0x2ba5[_0x97ab('0x22')];}if(_0x461048[_0x97ab('0x21')]){_0x461048['body']=_0x461048['body'][_0x97ab('0x1c')](/0x0){var _0x271d4f=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x97ab('0x34')];for(var _0x52ee01=0x0;_0x52ee01<_0x2ba5[_0x97ab('0x33')][_0x97ab('0xf')];_0x52ee01++){var _0x43888d=_['indexOf'](_0x271d4f,_0x2ba5[_0x97ab('0x33')][_0x52ee01][_0x97ab('0x35')]);if(_0x43888d>=0x0){_0x461048[_0x97ab('0x36')]=!![];}}}return _0x461048;}exports[_0x97ab('0x37')]=function(_0x5904ed,_0x35d5a5,_0x4287c2){var _0xd187fd={'from':getAddress(_0x35d5a5[_0x97ab('0x38')]),'firstName':getFirstName(_0x35d5a5['from']),'lastName':getLastName(_0x35d5a5[_0x97ab('0x38')]),'mapKey':'email','message':{'from':getMails(_0x5904ed[_0x97ab('0x4')],_0x35d5a5[_0x97ab('0x38')]),'to':_0x5904ed[_0x97ab('0x4')],'cc':'','subject':_0x35d5a5[_0x97ab('0x39')]||'','messageId':_0x35d5a5['messageId'],'inReplyTo':_0x35d5a5['inReplyTo'],'sentAt':moment(_0x35d5a5[_0x97ab('0x3a')])[_0x97ab('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x35d5a5[_0x97ab('0x14')]&&!_0x35d5a5[_0x97ab('0x22')]){var _0x2712a8=_[_0x97ab('0x3b')](_0x35d5a5[_0x97ab('0x18')],{'contentType':_0x97ab('0x3c')});if(_0x2712a8['length']){logger['info'](util[_0x97ab('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x35d5a5['messageId']));tnef[_0x97ab('0x3d')](_[_0x97ab('0x3e')](_0x2712a8)[_0x97ab('0x31')],function(_0x92810b,_0x55b4cf){if(_0x55b4cf){_0x35d5a5[_0x97ab('0x14')]=_0x55b4cf[_0x97ab('0x3f')]||_0x97ab('0x40');if(_0x55b4cf[_0x97ab('0x41')]){for(var _0xd33758=0x0;_0xd33758<_0x55b4cf['Attachments'][_0x97ab('0xf')];_0xd33758++){var _0x340247=_0x55b4cf['Attachments'][_0xd33758];_0xd187fd[_0x97ab('0x24')]['attachments'][_0x97ab('0x1a')]({'filename':_0x340247[_0x97ab('0x42')],'content':Buffer[_0x97ab('0x38')](_0x340247[_0x97ab('0x43')])});}}}_0x4287c2(parseEmail(_0x5904ed,_0x35d5a5,_0xd187fd));});}else{_0x35d5a5['html']='

Empty\x20message

';_0x4287c2(parseEmail(_0x5904ed,_0x35d5a5,_0xd187fd));}}else{_0x4287c2(parseEmail(_0x5904ed,_0x35d5a5,_0xd187fd));}};exports[_0x97ab('0x44')]=function(_0x5bfc0f,_0x641dc0){var _0x17e2d8=[_0x97ab('0x45')+(_0x641dc0||''),'auth=Bearer\x20'+_0x5bfc0f,'',''];return Buffer['from'](_0x17e2d8['join'](''),'utf-8')[_0x97ab('0x46')]('base64');}; \ No newline at end of file +var _0xd654=['_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','toString','base64','lodash','moment','randomstring','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','test','html','replace','attachments','push','filename','_SRC'];(function(_0x2567c7,_0xf3cb9f){var _0x45fc2d=function(_0x1929f9){while(--_0x1929f9){_0x2567c7['push'](_0x2567c7['shift']());}};_0x45fc2d(++_0xf3cb9f);}(_0xd654,0xbb));var _0x4d65=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd654[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4d65('0x0'));var moment=require(_0x4d65('0x1'));var random=require(_0x4d65('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4d65('0x3'));var tnef=require('node-tnef');var logger=require(_0x4d65('0x4'))(_0x4d65('0x5'));var config=require(_0x4d65('0x6'));function getAddress(_0x5e5fe1){var _0x27fa5b=_[_0x4d65('0x7')](_0x5e5fe1[_0x4d65('0x8')]);return _0x27fa5b&&_0x27fa5b[_0x4d65('0x9')]?_0x27fa5b['address']:_0x4d65('0xa')+random[_0x4d65('0xb')](0x6)+_0x4d65('0xc');}function getFirstName(_0x31081d){var _0x1001c6=_[_0x4d65('0x7')](_0x31081d[_0x4d65('0x8')]);if(_0x1001c6&&_0x1001c6[_0x4d65('0xd')]){if(_0x1001c6['name']==_0x1001c6[_0x4d65('0x9')]){return _0x1001c6[_0x4d65('0xd')][_0x4d65('0xe')](0x0,_0x1001c6[_0x4d65('0xd')]['indexOf']('@'));}var _0x4d6974=_0x1001c6[_0x4d65('0xd')][_0x4d65('0xf')](/\s+/);return _0x4d6974[_0x4d65('0x10')]>0x1?_0x4d6974[_0x4d65('0x11')](0x0,-0x1)[_0x4d65('0x12')]('\x20'):_0x1001c6[_0x4d65('0xd')];}return _0x4d65('0x13');}function getLastName(_0x3b5da9){var _0x1dacd3=_[_0x4d65('0x7')](_0x3b5da9[_0x4d65('0x8')]);if(_0x1dacd3&&_0x1dacd3[_0x4d65('0xd')]){var _0x3139fa=_0x1dacd3[_0x4d65('0xd')][_0x4d65('0xf')](/\s+/);return _0x3139fa[_0x4d65('0x10')]>0x1?_0x3139fa[_0x4d65('0x14')]():'';}return'';}function getMails(_0x319c9c,_0x4d8011){var _0x3f9f02='';for(var _0xec97f1=0x0;_0xec97f1<_0x4d8011['value'][_0x4d65('0x10')];_0xec97f1+=0x1){if(_0x4d8011['value'][_0xec97f1][_0x4d65('0x9')]!==_0x319c9c){if(!_[_0x4d65('0x15')](_0x3f9f02)){_0x3f9f02+=',';}_0x3f9f02+=_0x4d8011['value'][_0xec97f1][_0x4d65('0xd')]||_0x4d8011[_0x4d65('0x8')][_0xec97f1]['address']||'';_0x3f9f02+='\x20<';_0x3f9f02+=_0x4d8011[_0x4d65('0x8')][_0xec97f1][_0x4d65('0x9')]?_0x4d8011['value'][_0xec97f1][_0x4d65('0x9')]:'anonymous'+random['generate'](0x6)+_0x4d65('0xc');_0x3f9f02+='>';}}return _0x3f9f02;}function parseEmail(_0x317c06,_0x746d97,_0x3e427f){if(_0x746d97['html']){var _0x3875d3=/)<[^<]*)*<\/script>/gi;while(_0x3875d3[_0x4d65('0x16')](_0x746d97[_0x4d65('0x17')])){_0x746d97[_0x4d65('0x17')]=_0x746d97[_0x4d65('0x17')][_0x4d65('0x18')](_0x3875d3,'');}if(_0x746d97['html']['includes']('{_0x5d660f[_0x4d65('0x1a')](_0xcee350[_0x4d65('0x1b')]);});var _0x3b6bd5=/]+>/g;var _0x39c83e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4ccfbe=_0x746d97[_0x4d65('0x17')][_0x4d65('0x18')](_0x39c83e,_0x4d65('0x1c'));var _0x557ca7=_0x4ccfbe[_0x4d65('0x18')](_0x3b6bd5,'_IMG');for(let _0x419437=0x0;_0x419437<_0x5d660f[_0x4d65('0x10')];_0x419437++){var _0x4df405=_0x557ca7['replace'](_0x4d65('0x1d'),_0x4d65('0x1e')+_0x5d660f[_0x419437]+_0x4d65('0x1f'));_0x557ca7=_0x4df405;}_0x746d97[_0x4d65('0x17')]=_0x557ca7;}_0x3e427f[_0x4d65('0x20')]=_0x746d97[_0x4d65('0x17')];}else{_0x3e427f[_0x4d65('0x20')]=_0x746d97[_0x4d65('0x21')];}if(_0x3e427f[_0x4d65('0x20')]){_0x3e427f[_0x4d65('0x20')]=_0x3e427f[_0x4d65('0x20')][_0x4d65('0x18')](/0x0){var _0x449eb5=[_0x4d65('0x31'),_0x4d65('0x32'),_0x4d65('0x33')];for(var _0x2f3733=0x0;_0x2f3733<_0x746d97['headerLines'][_0x4d65('0x10')];_0x2f3733++){var _0x43e361=_[_0x4d65('0x34')](_0x449eb5,_0x746d97['headerLines'][_0x2f3733]['line']);if(_0x43e361>=0x0){_0x3e427f[_0x4d65('0x35')]=!![];}}}return _0x3e427f;}exports[_0x4d65('0x36')]=function(_0x9f48e,_0x272009,_0x27c465){var _0x3a55cd={'from':getAddress(_0x272009[_0x4d65('0x37')]),'firstName':getFirstName(_0x272009[_0x4d65('0x37')]),'lastName':getLastName(_0x272009[_0x4d65('0x37')]),'mapKey':_0x4d65('0x5'),'message':{'from':getMails(_0x9f48e['email'],_0x272009[_0x4d65('0x37')]),'to':_0x9f48e['email'],'cc':'','subject':_0x272009[_0x4d65('0x38')]||'','messageId':_0x272009[_0x4d65('0x39')],'inReplyTo':_0x272009[_0x4d65('0x3a')],'sentAt':moment(_0x272009[_0x4d65('0x3b')])['format'](_0x4d65('0x3c')),'attach':![],'attachments':[]}};if(!_0x272009[_0x4d65('0x17')]&&!_0x272009[_0x4d65('0x21')]){var _0x1ddd79=_['filter'](_0x272009[_0x4d65('0x19')],{'contentType':_0x4d65('0x3d')});if(_0x1ddd79['length']){logger['info'](util['format'](_0x4d65('0x3e'),_0x272009[_0x4d65('0x39')]));tnef[_0x4d65('0x3f')](_[_0x4d65('0x40')](_0x1ddd79)[_0x4d65('0x2f')],function(_0x4747bb,_0x5daf51){if(_0x5daf51){_0x272009[_0x4d65('0x17')]=_0x5daf51['BodyHTML']||_0x4d65('0x41');if(_0x5daf51['Attachments']){for(var _0x45e9d1=0x0;_0x45e9d1<_0x5daf51[_0x4d65('0x42')][_0x4d65('0x10')];_0x45e9d1++){var _0x4fa2f1=_0x5daf51[_0x4d65('0x42')][_0x45e9d1];_0x3a55cd[_0x4d65('0x23')][_0x4d65('0x19')][_0x4d65('0x1a')]({'filename':_0x4fa2f1[_0x4d65('0x43')],'content':Buffer[_0x4d65('0x37')](_0x4fa2f1[_0x4d65('0x44')])});}}}_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));});}else{_0x272009[_0x4d65('0x17')]=_0x4d65('0x41');_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));}}else{_0x27c465(parseEmail(_0x9f48e,_0x272009,_0x3a55cd));}};exports[_0x4d65('0x45')]=function(_0x3865f6,_0x4723f5){var _0x1a623d=['user='+(_0x4723f5||''),'auth=Bearer\x20'+_0x3865f6,'',''];return Buffer[_0x4d65('0x37')](_0x1a623d[_0x4d65('0x12')](''),'utf-8')[_0x4d65('0x46')](_0x4d65('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2b1ade5..38edcd5 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 _0x3eb7=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x3eb7,0x19b));var _0x73eb=function(_0x3525e5,_0x5edcb9){_0x3525e5=_0x3525e5-0x0;var _0x16bee5=_0x3eb7[_0x3525e5];return _0x16bee5;};'use strict';var _=require(_0x73eb('0x0'));function MailAccount(_0x470e99){this['id']=_0x470e99['id']||0x0;this['name']=_0x470e99[_0x73eb('0x1')]||_0x73eb('0x2');this[_0x73eb('0x3')]=_0x470e99[_0x73eb('0x3')]||_0x73eb('0x4');this[_0x73eb('0x5')]=_0x470e99[_0x73eb('0x5')]||![];this['Imap']=_0x470e99[_0x73eb('0x6')]||[];this[_0x73eb('0x7')]=_0x470e99[_0x73eb('0x7')]||[];}module[_0x73eb('0x8')]=MailAccount; \ No newline at end of file +var _0xcbed=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x2c4827,_0x3fc59e){var _0x683ad6=function(_0x3bab78){while(--_0x3bab78){_0x2c4827['push'](_0x2c4827['shift']());}};_0x683ad6(++_0x3fc59e);}(_0xcbed,0xbd));var _0xdcbe=function(_0x420a1c,_0x13ad25){_0x420a1c=_0x420a1c-0x0;var _0x3356c7=_0xcbed[_0x420a1c];return _0x3356c7;};'use strict';var _=require('lodash');function MailAccount(_0x5bb412){this['id']=_0x5bb412['id']||0x0;this[_0xdcbe('0x0')]=_0x5bb412[_0xdcbe('0x0')]||_0xdcbe('0x1');this[_0xdcbe('0x2')]=_0x5bb412['key']||_0xdcbe('0x3');this['active']=_0x5bb412[_0xdcbe('0x4')]||![];this[_0xdcbe('0x5')]=_0x5bb412['Imap']||[];this['Smtp']=_0x5bb412[_0xdcbe('0x6')]||[];}module[_0xdcbe('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 19e28f8..07adfd7 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 _0x5970=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge'];(function(_0x397d6f,_0x2236c2){var _0x1fe666=function(_0x19a252){while(--_0x19a252){_0x397d6f['push'](_0x397d6f['shift']());}};_0x1fe666(++_0x2236c2);}(_0x5970,0xcd));var _0x0597=function(_0x301bbc,_0x434a33){_0x301bbc=_0x301bbc-0x0;var _0x3bd743=_0x5970[_0x301bbc];return _0x3bd743;};'use strict';var _=require(_0x0597('0x0'));var MailAccount=require(_0x0597('0x1'));var Realtime=function(){this[_0x0597('0x2')]={};};function freeIsNotKey(_0x454ca2,_0x19d7bf,_0x5b3ddd){var _0x446a73=_[_0x0597('0x3')](_0x454ca2,function(_0x13e4cd,_0x25f72b){return _0x13e4cd[_0x5b3ddd];});for(var _0xf14774 in _0x19d7bf){if(_0x19d7bf[_0x0597('0x4')](_0xf14774)){if(!_0x446a73[_0xf14774]){delete _0x19d7bf[_0xf14774];}}}}Realtime[_0x0597('0x5')][_0x0597('0x6')]=function(_0x310495,_0x121594){for(var _0x31e09c in _0x121594){if(_0x310495[_0x0597('0x4')](_0x31e09c)){_0x310495[_0x31e09c]=_0x121594[_0x31e09c];}}};Realtime['prototype'][_0x0597('0x7')]=function(){var _0x4a3ae2=this;return function(_0x444a12){if(_0x444a12){freeIsNotKey(_0x444a12,_0x4a3ae2['mailAccounts'],'id');for(var _0x1e7aec=0x0,_0x229c47={},_0x1b6e37={};_0x1e7aec<_0x444a12[_0x0597('0x8')];_0x1e7aec+=0x1){_0x229c47=_0x444a12[_0x1e7aec];if(_[_0x0597('0x9')](_0x4a3ae2[_0x0597('0x2')][_0x229c47['id']])){_0x4a3ae2[_0x0597('0x2')][_0x229c47['id']]=new MailAccount(_0x229c47);}else{_[_0x0597('0xa')](_0x4a3ae2['mailAccounts'][_0x229c47['id']],_0x229c47);}}}return _0x4a3ae2['mailAccounts'];};};module[_0x0597('0xb')]=Realtime; \ No newline at end of file +var _0x3992=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','exports','lodash','../model/mailAccount'];(function(_0x307bf6,_0x55bdd5){var _0x2878fc=function(_0x4fa44f){while(--_0x4fa44f){_0x307bf6['push'](_0x307bf6['shift']());}};_0x2878fc(++_0x55bdd5);}(_0x3992,0x15d));var _0x2399=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3992[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x2399('0x0'));var MailAccount=require(_0x2399('0x1'));var Realtime=function(){this[_0x2399('0x2')]={};};function freeIsNotKey(_0x7aab56,_0x4741db,_0xea24ad){var _0xa0e3ea=_[_0x2399('0x3')](_0x7aab56,function(_0xa09fe6,_0x1576ca){return _0xa09fe6[_0xea24ad];});for(var _0x2993b9 in _0x4741db){if(_0x4741db[_0x2399('0x4')](_0x2993b9)){if(!_0xa0e3ea[_0x2993b9]){delete _0x4741db[_0x2993b9];}}}}Realtime[_0x2399('0x5')][_0x2399('0x6')]=function(_0x5aa4c5,_0x5ee482){for(var _0x277ef2 in _0x5ee482){if(_0x5aa4c5[_0x2399('0x4')](_0x277ef2)){_0x5aa4c5[_0x277ef2]=_0x5ee482[_0x277ef2];}}};Realtime[_0x2399('0x5')]['initMailAccounts']=function(){var _0x315a50=this;return function(_0xed823d){if(_0xed823d){freeIsNotKey(_0xed823d,_0x315a50[_0x2399('0x2')],'id');for(var _0x3cc5ac=0x0,_0x169fa4={},_0x567d7c={};_0x3cc5ac<_0xed823d[_0x2399('0x7')];_0x3cc5ac+=0x1){_0x169fa4=_0xed823d[_0x3cc5ac];if(_['isUndefined'](_0x315a50[_0x2399('0x2')][_0x169fa4['id']])){_0x315a50[_0x2399('0x2')][_0x169fa4['id']]=new MailAccount(_0x169fa4);}else{_['merge'](_0x315a50[_0x2399('0x2')][_0x169fa4['id']],_0x169fa4);}}}return _0x315a50[_0x2399('0x2')];};};module[_0x2399('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 15015a0..c171dc0 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 _0x8561=['type','data5','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','name','service','active','ListId','TemplateId','CloudProvider'];(function(_0x2a573d,_0x284675){var _0x370c3f=function(_0x1ddb31){while(--_0x1ddb31){_0x2a573d['push'](_0x2a573d['shift']());}};_0x370c3f(++_0x284675);}(_0x8561,0x1b2));var _0x1856=function(_0x5aa1e2,_0x2b5adb){_0x5aa1e2=_0x5aa1e2-0x0;var _0x399098=_0x8561[_0x5aa1e2];return _0x399098;};'use strict';var client=require('../client');exports[_0x1856('0x0')]=function(){return function(){return client[_0x1856('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x1856('0x2'),'provider',_0x1856('0x3'),'email',_0x1856('0x4'),'key',_0x1856('0x5'),_0x1856('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x1856('0x7'),'attributes':['id','name','service',_0x1856('0x8'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x1856('0x7'),'attributes':['id',_0x1856('0x2'),'service','type',_0x1856('0x9')],'as':'CloudProvider'}]}]},'log':_0x1856('0xa')});};};exports[_0x1856('0xb')]=function(_0xcf5a16,_0x5bae90){return client[_0x1856('0x1')](_0x1856('0xc'),{'account':{'id':_0xcf5a16},'body':_0x5bae90,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xb1ad=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active'];(function(_0x5333ca,_0x441e75){var _0x316280=function(_0x37f0f9){while(--_0x37f0f9){_0x5333ca['push'](_0x5333ca['shift']());}};_0x316280(++_0x441e75);}(_0xb1ad,0x184));var _0xdb1a=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb1ad[_0x5037ab];return _0x512adb;};'use strict';var client=require(_0xdb1a('0x0'));exports[_0xdb1a('0x1')]=function(){return function(){return client[_0xdb1a('0x2')](_0xdb1a('0x3'),{'options':{'attributes':['id',_0xdb1a('0x4'),_0xdb1a('0x5'),'service',_0xdb1a('0x6'),_0xdb1a('0x7'),_0xdb1a('0x8'),_0xdb1a('0x9'),_0xdb1a('0xa')],'raw':![],'include':[{'model':_0xdb1a('0xb'),'as':_0xdb1a('0xc'),'include':[{'model':_0xdb1a('0xd'),'attributes':['id',_0xdb1a('0x4'),_0xdb1a('0xe'),_0xdb1a('0xf'),_0xdb1a('0x10')],'as':_0xdb1a('0xd')}]},{'model':_0xdb1a('0x11'),'as':_0xdb1a('0x12'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb1a('0x4'),_0xdb1a('0xe'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0xdb1a('0x13')});};};exports[_0xdb1a('0x14')]=function(_0x13082a,_0x18ce2c){return client[_0xdb1a('0x2')](_0xdb1a('0x15'),{'account':{'id':_0x13082a},'body':_0x18ce2c,'log':_0xdb1a('0x15')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 82ee455..804007f 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 _0xe4e9=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x12abc4,_0x4d8ca5){var _0x186cc1=function(_0x207f17){while(--_0x207f17){_0x12abc4['push'](_0x12abc4['shift']());}};_0x186cc1(++_0x4d8ca5);}(_0xe4e9,0x129));var _0x9e4e=function(_0xd3773e,_0x583f02){_0xd3773e=_0xd3773e-0x0;var _0x38eb58=_0xe4e9[_0xd3773e];return _0x38eb58;};'use strict';var client=require(_0x9e4e('0x0'));exports[_0x9e4e('0x1')]=function(){return client['Request'](_0x9e4e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9e4e('0x3')]},'log':_0x9e4e('0x4')});}; \ No newline at end of file +var _0x578c=['loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x27e32e,_0x339fbd){var _0x10f599=function(_0x568ad4){while(--_0x568ad4){_0x27e32e['push'](_0x27e32e['shift']());}};_0x10f599(++_0x339fbd);}(_0x578c,0x18d));var _0xc578=function(_0x171d82,_0x2ea3b7){_0x171d82=_0x171d82-0x0;var _0x1f56b9=_0x578c[_0x171d82];return _0x1f56b9;};'use strict';var client=require(_0xc578('0x0'));exports[_0xc578('0x1')]=function(){return client[_0xc578('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc578('0x3')]},'log':_0xc578('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f1a5780..86ee48f 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 436377e..1c92b18 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 _0x3eb2=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','../../config/environment','createServer','timeout','listen','port','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x3eb2,0xaa));var _0x23eb=function(_0x7b17fe,_0x1233ff){_0x7b17fe=_0x7b17fe-0x0;var _0x5215be=_0x3eb2[_0x7b17fe];return _0x5215be;};'use strict';var _=require(_0x23eb('0x0'));var http=require(_0x23eb('0x1'));var express=require(_0x23eb('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x23eb('0x3'));var app=express();var server=http[_0x23eb('0x4')](app);server[_0x23eb('0x5')]=0xdbba0;if(sticky[_0x23eb('0x6')](server,config[_0x23eb('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0x23eb('0x8')]=_[_0x23eb('0x9')](config['redis'],{'host':_0x23eb('0xa'),'port':0x18eb});socketio[_0x23eb('0xb')](require(_0x23eb('0xc'))({'pubClient':new Redis(config[_0x23eb('0x8')]),'subClient':new Redis(config[_0x23eb('0x8')])}));require(_0x23eb('0xd'))[_0x23eb('0xe')]();require(_0x23eb('0xf'))[_0x23eb('0xe')](socketio);require(_0x23eb('0x10'))[_0x23eb('0xe')](app);require(_0x23eb('0x11'))['default'](app);}else{server[_0x23eb('0x12')](_0x23eb('0x13'),function(){console[_0x23eb('0x14')](_0x23eb('0x15'),config[_0x23eb('0x7')]);});}exports=module[_0x23eb('0x16')]=app; \ No newline at end of file +var _0x9d24=['defaults','localhost','adapter','../../config/triggers','default','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9d24,0x186));var _0x49d2=function(_0x2fbf97,_0x431ccd){_0x2fbf97=_0x2fbf97-0x0;var _0x12d97e=_0x9d24[_0x2fbf97];return _0x12d97e;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x49d2('0x0'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x49d2('0x1'));var app=express();var server=http['createServer'](app);server[_0x49d2('0x2')]=0xdbba0;if(sticky[_0x49d2('0x3')](server,config[_0x49d2('0x4')])){var socketio=require(_0x49d2('0x5'))(server,{'transports':[_0x49d2('0x6'),_0x49d2('0x7')]});config[_0x49d2('0x8')]=_[_0x49d2('0x9')](config[_0x49d2('0x8')],{'host':_0x49d2('0xa'),'port':0x18eb});socketio[_0x49d2('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0x49d2('0x8')]),'subClient':new Redis(config[_0x49d2('0x8')])}));require(_0x49d2('0xc'))[_0x49d2('0xd')]();require('../../config/socketio')['default'](socketio);require(_0x49d2('0xe'))[_0x49d2('0xd')](app);require(_0x49d2('0xf'))['default'](app);}else{server['once']('listening',function(){console[_0x49d2('0x10')](_0x49d2('0x11'),config[_0x49d2('0x4')]);});}exports=module[_0x49d2('0x12')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9fc3e57..a30707b 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 _0xc8eb=['client','http','request','error','rpc','message','result','catch','exports','jayson/promise','bluebird','routing'];(function(_0xe9ed38,_0x540b64){var _0x2b9e06=function(_0x4e0dc4){while(--_0x4e0dc4){_0xe9ed38['push'](_0xe9ed38['shift']());}};_0x2b9e06(++_0x540b64);}(_0xc8eb,0x141));var _0xbc8e=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0xc8eb[_0x5fa520];return _0x1bf6c4;};'use strict';var jayson=require(_0xbc8e('0x0'));var BPromise=require(_0xbc8e('0x1'));var logger=require('../../config/logger')(_0xbc8e('0x2'));var client=jayson[_0xbc8e('0x3')][_0xbc8e('0x4')]({'port':0x2329});client['Request']=function(_0x4d3e2f,_0x386e62){return new BPromise(function(_0x25d768,_0x370ced){return client[_0xbc8e('0x5')](_0x4d3e2f,_0x386e62)['then'](function(_0x186102){logger['debug']('rpc','routing',_0x4d3e2f,_0x386e62,_0x186102);if(_0x186102[_0xbc8e('0x6')]){logger['error'](_0xbc8e('0x7'),_0xbc8e('0x2'),_0x4d3e2f,_0x186102[_0xbc8e('0x6')][_0xbc8e('0x8')],_0x386e62);return _0x370ced(_0x186102[_0xbc8e('0x6')][_0xbc8e('0x8')]);}else{return _0x25d768(_0x186102[_0xbc8e('0x9')]);}})[_0xbc8e('0xa')](function(_0x175e18){logger[_0xbc8e('0x6')]('rpc','routing',_0x4d3e2f,_0x175e18,_0x386e62);return _0x370ced(_0x175e18);});});};module[_0xbc8e('0xb')]=client; \ No newline at end of file +var _0x5197=['rpc','message','result','jayson/promise','../../config/logger','client','http','Request','request','then','routing','error'];(function(_0x5cc892,_0x3b98d1){var _0x221b95=function(_0x308d79){while(--_0x308d79){_0x5cc892['push'](_0x5cc892['shift']());}};_0x221b95(++_0x3b98d1);}(_0x5197,0x9f));var _0x7519=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5197[_0x53ccf2];return _0x5a2964;};'use strict';var jayson=require(_0x7519('0x0'));var BPromise=require('bluebird');var logger=require(_0x7519('0x1'))('routing');var client=jayson[_0x7519('0x2')][_0x7519('0x3')]({'port':0x2329});client[_0x7519('0x4')]=function(_0x29e199,_0x37cbfe){return new BPromise(function(_0x5a73e6,_0x1751e0){return client[_0x7519('0x5')](_0x29e199,_0x37cbfe)[_0x7519('0x6')](function(_0xf3aa6d){logger['debug']('rpc',_0x7519('0x7'),_0x29e199,_0x37cbfe,_0xf3aa6d);if(_0xf3aa6d[_0x7519('0x8')]){logger[_0x7519('0x8')](_0x7519('0x9'),_0x7519('0x7'),_0x29e199,_0xf3aa6d[_0x7519('0x8')][_0x7519('0xa')],_0x37cbfe);return _0x1751e0(_0xf3aa6d[_0x7519('0x8')][_0x7519('0xa')]);}else{return _0x5a73e6(_0xf3aa6d[_0x7519('0xb')]);}})['catch'](function(_0x524653){logger[_0x7519('0x8')](_0x7519('0x9'),_0x7519('0x7'),_0x29e199,_0x524653,_0x37cbfe);return _0x1751e0(_0x524653);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c557367..e24e8d5 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 _0x2db1=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2db1,0x9d));var _0x12db=function(_0x119e6a,_0x12172a){_0x119e6a=_0x119e6a-0x0;var _0x1ec5d7=_0x2db1[_0x119e6a];return _0x1ec5d7;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x12db('0x0'));var user=require(_0x12db('0x1'));var interval=require(_0x12db('0x2'));var openchannelQueue=require(_0x12db('0x3'));var chatQueue=require(_0x12db('0x4'));var smsQueue=require(_0x12db('0x5'));var mailQueue=require(_0x12db('0x6'));var faxQueue=require(_0x12db('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x12db('0x8')]()[_0x12db('0x9')](user['getAgents']())['then'](realtime[_0x12db('0xa')]())['then'](interval[_0x12db('0xb')]())[_0x12db('0x9')](realtime['initIntervals']())[_0x12db('0x9')](openchannelQueue[_0x12db('0xc')]())['then'](realtime[_0x12db('0xd')]())[_0x12db('0x9')](chatQueue[_0x12db('0xe')]())[_0x12db('0x9')](realtime[_0x12db('0xf')]())[_0x12db('0x9')](smsQueue[_0x12db('0x10')]())['then'](realtime[_0x12db('0x11')]())[_0x12db('0x9')](mailQueue[_0x12db('0x12')]())[_0x12db('0x9')](realtime[_0x12db('0x13')]())[_0x12db('0x9')](faxQueue[_0x12db('0x14')]())['then'](realtime[_0x12db('0x15')]())['then'](whatsappQueue[_0x12db('0x16')]())['then'](realtime[_0x12db('0x17')]())[_0x12db('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x12db('0x9')](function(_0x50fd7e){return initRealtime();})[_0x12db('0x9')](function(_0xdd1ded){return setInterval(initRealtime,0x1388);})[_0x12db('0x18')](function(_0x4cd2a6){console['log'](_0x4cd2a6);});}main(); \ No newline at end of file +var _0x9ec7=['bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0xdd4497,_0x472810){var _0x164f5c=function(_0x100d33){while(--_0x100d33){_0xdd4497['push'](_0xdd4497['shift']());}};_0x164f5c(++_0x472810);}(_0x9ec7,0xe0));var _0x79ec=function(_0x13c419,_0x18a7b1){_0x13c419=_0x13c419-0x0;var _0x421bcd=_0x9ec7[_0x13c419];return _0x421bcd;};'use strict';var BPromise=require(_0x79ec('0x0'));var server=require(_0x79ec('0x1'));var Realtime=require(_0x79ec('0x2'));var user=require(_0x79ec('0x3'));var interval=require(_0x79ec('0x4'));var openchannelQueue=require(_0x79ec('0x5'));var chatQueue=require(_0x79ec('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x79ec('0x7'));var faxQueue=require(_0x79ec('0x8'));var whatsappQueue=require(_0x79ec('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x79ec('0xa')]()['then'](user['getAgents']())[_0x79ec('0xb')](realtime[_0x79ec('0xc')]())[_0x79ec('0xb')](interval[_0x79ec('0xd')]())['then'](realtime[_0x79ec('0xe')]())[_0x79ec('0xb')](openchannelQueue[_0x79ec('0xf')]())[_0x79ec('0xb')](realtime[_0x79ec('0x10')]())['then'](chatQueue[_0x79ec('0x11')]())[_0x79ec('0xb')](realtime[_0x79ec('0x12')]())[_0x79ec('0xb')](smsQueue['getSmsQueues']())[_0x79ec('0xb')](realtime[_0x79ec('0x13')]())[_0x79ec('0xb')](mailQueue[_0x79ec('0x14')]())[_0x79ec('0xb')](realtime[_0x79ec('0x15')]())['then'](faxQueue[_0x79ec('0x16')]())['then'](realtime[_0x79ec('0x17')]())[_0x79ec('0xb')](whatsappQueue[_0x79ec('0x18')]())['then'](realtime[_0x79ec('0x19')]())[_0x79ec('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x79ec('0xb')](function(_0x444406){return initRealtime();})[_0x79ec('0xb')](function(_0x4fcc85){return setInterval(initRealtime,0x1388);})[_0x79ec('0x1a')](function(_0x127e7a){console[_0x79ec('0x1b')](_0x127e7a);});}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 6978b09..033e3d5 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x598614,_0x2673d8){var _0x457107=function(_0x5eb4e8){while(--_0x5eb4e8){_0x598614['push'](_0x598614['shift']());}};_0x457107(++_0x2673d8);}(_0x7a54,0x106));var _0x47a5=function(_0x27a094,_0x1c34b4){_0x27a094=_0x27a094-0x0;var _0x4eb8a9=_0x7a54[_0x27a094];return _0x4eb8a9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _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(_0x19ebc9,_0x2a8bcd){var _0x54bb42=function(_0x2d3ee4){while(--_0x2d3ee4){_0x19ebc9['push'](_0x19ebc9['shift']());}};_0x54bb42(++_0x2a8bcd);}(_0x7a54,0x106));var _0x47a5=function(_0x456955,_0x523b2a){_0x456955=_0x456955-0x0;var _0x1060b0=_0x7a54[_0x456955];return _0x1060b0;};'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 734cae0..d5c01ad 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 _0xce31=['error','SendMail','jayson/promise','client','request','then'];(function(_0x398020,_0x574243){var _0x13ba6b=function(_0x40fcfc){while(--_0x40fcfc){_0x398020['push'](_0x398020['shift']());}};_0x13ba6b(++_0x574243);}(_0xce31,0x7a));var _0x1ce3=function(_0x1dedd7,_0x3a2906){_0x1dedd7=_0x1dedd7-0x0;var _0x33f9dc=_0xce31[_0x1dedd7];return _0x33f9dc;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1ce3('0x0'));var client=jayson[_0x1ce3('0x1')]['http']({'port':0x232b});function request(_0x438caa,_0x1d2381){return new BPromise(function(_0x1855b8,_0x203b98){return client[_0x1ce3('0x2')](_0x438caa,_0x1d2381)[_0x1ce3('0x3')](function(_0x521978){if(_0x521978[_0x1ce3('0x4')]){return _0x203b98(_0x521978[_0x1ce3('0x4')]['message']);}else{return _0x1855b8(_0x521978['result']);}})['catch'](function(_0x13a133){return _0x203b98(_0x13a133);});});}exports['sendMailMessage']=function(_0x1c820d,_0x2613cf){return request(_0x1ce3('0x5'),{'account':_0x1c820d,'message':_0x2613cf});}; \ No newline at end of file +var _0xa872=['catch','sendMailMessage','SendMail','bluebird','client','http','request','error','message','result'];(function(_0x325064,_0x35482f){var _0x5d9b73=function(_0x5d064a){while(--_0x5d064a){_0x325064['push'](_0x325064['shift']());}};_0x5d9b73(++_0x35482f);}(_0xa872,0xcb));var _0x2a87=function(_0x1fcf36,_0x3f2539){_0x1fcf36=_0x1fcf36-0x0;var _0x44491f=_0xa872[_0x1fcf36];return _0x44491f;};'use strict';var BPromise=require(_0x2a87('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x2a87('0x1')][_0x2a87('0x2')]({'port':0x232b});function request(_0x352c6a,_0x2df47e){return new BPromise(function(_0x5416bb,_0x3f3323){return client[_0x2a87('0x3')](_0x352c6a,_0x2df47e)['then'](function(_0x1e58bd){if(_0x1e58bd[_0x2a87('0x4')]){return _0x3f3323(_0x1e58bd['error'][_0x2a87('0x5')]);}else{return _0x5416bb(_0x1e58bd[_0x2a87('0x6')]);}})[_0x2a87('0x7')](function(_0x5d6ea3){return _0x3f3323(_0x5d6ea3);});});}exports[_0x2a87('0x8')]=function(_0x1fd50d,_0x1cabf7){return request(_0x2a87('0x9'),{'account':_0x1fd50d,'message':_0x1cabf7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b2ed456..c0ab052 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 _0x33af=['faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','openchannel','whatsapp','length','Status','StatusTime','toNumber','format','openchannelPause','chatCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailCapacity','mailCurrentCapacity'];(function(_0x257751,_0x39ad7a){var _0x3fe46a=function(_0x29e337){while(--_0x29e337){_0x257751['push'](_0x257751['shift']());}};_0x3fe46a(++_0x39ad7a);}(_0x33af,0xec));var _0xf33a=function(_0x4f3da4,_0x121375){_0x4f3da4=_0x4f3da4-0x0;var _0x1df1a1=_0x33af[_0x4f3da4];return _0x1df1a1;};'use strict';var _=require('lodash');var md5=require(_0xf33a('0x0'));var moment=require('moment');var Redis=require(_0xf33a('0x1'));var config=require(_0xf33a('0x2'));config[_0xf33a('0x3')]=_[_0xf33a('0x4')](config[_0xf33a('0x3')],{'host':_0xf33a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf33a('0x3')]));function Agent(_0x44cfa5){this['id']=_0x44cfa5['id']||0x0;this['name']=_0x44cfa5[_0xf33a('0x6')]||'';this[_0xf33a('0x7')]=_0x44cfa5[_0xf33a('0x7')]||!![];this[_0xf33a('0x8')]=_0x44cfa5[_0xf33a('0x8')]||![];this[_0xf33a('0x9')]=_0x44cfa5['chatPause']||![];this[_0xf33a('0xa')]=_0x44cfa5[_0xf33a('0xa')]||![];this[_0xf33a('0xb')]=_0x44cfa5[_0xf33a('0xb')]||![];this[_0xf33a('0xc')]=_0x44cfa5[_0xf33a('0xc')]||![];this['openchannelPause']=_0x44cfa5['openchannelPause']||![];this[_0xf33a('0xd')]=_0xf33a('0xe');this[_0xf33a('0xf')]=0x0;this[_0xf33a('0x10')]=_0x44cfa5[_0xf33a('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xf33a('0x11')]=_0xf33a('0xe');this['mailStatusTime']=0x0;this['mailCapacity']=_0x44cfa5[_0xf33a('0x12')]||0x0;this[_0xf33a('0x13')]=0x0;this[_0xf33a('0x14')]=_0xf33a('0xe');this[_0xf33a('0x15')]=0x0;this[_0xf33a('0x16')]=_0x44cfa5[_0xf33a('0x16')]||0x0;this[_0xf33a('0x17')]=0x0;this['smsStatus']=_0xf33a('0xe');this['smsStatusTime']=0x0;this[_0xf33a('0x18')]=_0x44cfa5[_0xf33a('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xf33a('0x19')]=_0xf33a('0xe');this['whatsappStatusTime']=0x0;this[_0xf33a('0x1a')]=_0x44cfa5[_0xf33a('0x1a')]||0x0;this[_0xf33a('0x1b')]=0x0;this[_0xf33a('0x1c')]='unknown';this[_0xf33a('0x1d')]=0x0;this[_0xf33a('0x1e')]=_0x44cfa5[_0xf33a('0x1e')]||0x0;this[_0xf33a('0x1f')]=0x0;this[_0xf33a('0x20')]=![];this[_0xf33a('0x21')]=undefined;this[_0xf33a('0x0')]='';this[_0xf33a('0x22')]={};this[_0xf33a('0x23')]={};this[_0xf33a('0x24')]={};this['openchannelWaitingInteractions']={};this[_0xf33a('0x25')]={};this[_0xf33a('0x26')]={};this[_0xf33a('0x27')]();}Agent[_0xf33a('0x28')][_0xf33a('0x29')]=function(_0x51d3fd){if(this[_0x51d3fd+_0xf33a('0x2a')]>0x0){if(this[_0x51d3fd+'Capacity']>0x0&&this[_0x51d3fd+_0xf33a('0x2a')]>=this[_0x51d3fd+_0xf33a('0x2b')]){return _0xf33a('0x2c');}else{return _0xf33a('0x2d');}}else{return _0xf33a('0x2e');}};Agent['prototype'][_0xf33a('0x27')]=function(){var _0x393005=['mail','chat',_0xf33a('0x2f'),'fax','sms',_0xf33a('0x30')];for(var _0x4f60a4=0x0;_0x4f60a4<_0x393005[_0xf33a('0x31')];_0x4f60a4+=0x1){var _0x553480=this[_0xf33a('0x29')](_0x393005[_0x4f60a4]);if(this[_0x393005[_0x4f60a4]+_0xf33a('0x32')]!==_0x553480){this[_0x393005[_0x4f60a4]+_0xf33a('0x33')]=_[_0xf33a('0x34')](moment()[_0xf33a('0x35')]('x'));}this[_0x393005[_0x4f60a4]+_0xf33a('0x32')]=_0x553480;}var _0x1d19ee={'id':this['id'],'name':this[_0xf33a('0x6')],'online':this[_0xf33a('0x7')],'voicePause':this[_0xf33a('0x8')],'chatPause':this[_0xf33a('0x9')],'mailPause':this[_0xf33a('0xa')],'smsPause':this[_0xf33a('0xc')],'faxPause':this[_0xf33a('0xb')],'openchannelPause':this[_0xf33a('0x36')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xf33a('0xf')],'chatCapacity':this[_0xf33a('0x10')],'chatCurrentCapacity':this[_0xf33a('0x37')],'mailStatus':this[_0xf33a('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xf33a('0x12')],'mailCurrentCapacity':this[_0xf33a('0x13')],'faxStatus':this[_0xf33a('0x14')],'faxStatusTime':this[_0xf33a('0x15')],'faxCapacity':this[_0xf33a('0x16')],'faxCurrentCapacity':this[_0xf33a('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xf33a('0x38')],'smsCapacity':this[_0xf33a('0x18')],'smsCurrentCapacity':this[_0xf33a('0x39')],'whatsappStatus':this[_0xf33a('0x19')],'whatsappStatusTime':this[_0xf33a('0x3a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xf33a('0x1c')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xf33a('0x20')],'busyQueue':this[_0xf33a('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf33a('0x23')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xf33a('0x3b')],'smsWaitingInteractions':this[_0xf33a('0x25')],'whatsappWaitingInteractions':this[_0xf33a('0x26')]};var _0x2a8e9e=md5(JSON[_0xf33a('0x3c')](_0x1d19ee));if(this[_0xf33a('0x0')]!==_0x2a8e9e){this['md5']=_0x2a8e9e;io[_0xf33a('0x3d')](_0xf33a('0x3e'),_['omit'](_0x1d19ee,[_0xf33a('0x7')]));}};module[_0xf33a('0x3f')]=Agent; \ No newline at end of file +var _0x3e24=['emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatus','faxStatusTime','busy','openchannelWaitingInteractions','stringify'];(function(_0x1efc80,_0x9d5e3b){var _0x15248f=function(_0x2abfe3){while(--_0x2abfe3){_0x1efc80['push'](_0x1efc80['shift']());}};_0x15248f(++_0x9d5e3b);}(_0x3e24,0x167));var _0x43e2=function(_0x54a946,_0x30a84e){_0x54a946=_0x54a946-0x0;var _0x4484af=_0x3e24[_0x54a946];return _0x4484af;};'use strict';var _=require(_0x43e2('0x0'));var md5=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var Redis=require(_0x43e2('0x3'));var config=require(_0x43e2('0x4'));config['redis']=_[_0x43e2('0x5')](config[_0x43e2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x43e2('0x7'))(new Redis(config[_0x43e2('0x6')]));function Agent(_0x1a89fc){this['id']=_0x1a89fc['id']||0x0;this[_0x43e2('0x8')]=_0x1a89fc[_0x43e2('0x8')]||'';this[_0x43e2('0x9')]=_0x1a89fc[_0x43e2('0x9')]||!![];this['voicePause']=_0x1a89fc[_0x43e2('0xa')]||![];this[_0x43e2('0xb')]=_0x1a89fc['chatPause']||![];this[_0x43e2('0xc')]=_0x1a89fc[_0x43e2('0xc')]||![];this['faxPause']=_0x1a89fc[_0x43e2('0xd')]||![];this[_0x43e2('0xe')]=_0x1a89fc['smsPause']||![];this[_0x43e2('0xf')]=_0x1a89fc['openchannelPause']||![];this['chatStatus']='unknown';this[_0x43e2('0x10')]=0x0;this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')]||0x0;this[_0x43e2('0x12')]=0x0;this[_0x43e2('0x13')]=_0x43e2('0x14');this[_0x43e2('0x15')]=0x0;this[_0x43e2('0x16')]=_0x1a89fc[_0x43e2('0x16')]||0x0;this[_0x43e2('0x17')]=0x0;this[_0x43e2('0x18')]=_0x43e2('0x14');this['faxStatusTime']=0x0;this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x19')]||0x0;this[_0x43e2('0x1a')]=0x0;this[_0x43e2('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x43e2('0x1c')]=_0x1a89fc[_0x43e2('0x1c')]||0x0;this[_0x43e2('0x1d')]=0x0;this[_0x43e2('0x1e')]=_0x43e2('0x14');this[_0x43e2('0x1f')]=0x0;this[_0x43e2('0x20')]=_0x1a89fc[_0x43e2('0x20')]||0x0;this[_0x43e2('0x21')]=0x0;this[_0x43e2('0x22')]='unknown';this[_0x43e2('0x23')]=0x0;this[_0x43e2('0x24')]=_0x1a89fc['openchannelCapacity']||0x0;this[_0x43e2('0x25')]=0x0;this['busy']=![];this[_0x43e2('0x26')]=undefined;this[_0x43e2('0x1')]='';this[_0x43e2('0x27')]={};this[_0x43e2('0x28')]={};this[_0x43e2('0x29')]={};this['openchannelWaitingInteractions']={};this[_0x43e2('0x2a')]={};this[_0x43e2('0x2b')]={};this[_0x43e2('0x2c')]();}Agent['prototype'][_0x43e2('0x2d')]=function(_0x32f048){if(this[_0x32f048+_0x43e2('0x2e')]>0x0){if(this[_0x32f048+_0x43e2('0x2f')]>0x0&&this[_0x32f048+'CurrentCapacity']>=this[_0x32f048+_0x43e2('0x2f')]){return _0x43e2('0x30');}else{return _0x43e2('0x31');}}else{return _0x43e2('0x32');}};Agent[_0x43e2('0x33')][_0x43e2('0x2c')]=function(){var _0x3ca16b=[_0x43e2('0x34'),_0x43e2('0x35'),_0x43e2('0x36'),_0x43e2('0x37'),_0x43e2('0x38'),'whatsapp'];for(var _0x430a0e=0x0;_0x430a0e<_0x3ca16b[_0x43e2('0x39')];_0x430a0e+=0x1){var _0x545246=this[_0x43e2('0x2d')](_0x3ca16b[_0x430a0e]);if(this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3a')]!==_0x545246){this[_0x3ca16b[_0x430a0e]+_0x43e2('0x3b')]=_[_0x43e2('0x3c')](moment()[_0x43e2('0x3d')]('x'));}this[_0x3ca16b[_0x430a0e]+'Status']=_0x545246;}var _0x42f495={'id':this['id'],'name':this[_0x43e2('0x8')],'online':this[_0x43e2('0x9')],'voicePause':this[_0x43e2('0xa')],'chatPause':this[_0x43e2('0xb')],'mailPause':this[_0x43e2('0xc')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x43e2('0xf')],'chatStatus':this[_0x43e2('0x3e')],'chatStatusTime':this[_0x43e2('0x10')],'chatCapacity':this[_0x43e2('0x11')],'chatCurrentCapacity':this[_0x43e2('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x43e2('0x15')],'mailCapacity':this[_0x43e2('0x16')],'mailCurrentCapacity':this[_0x43e2('0x17')],'faxStatus':this[_0x43e2('0x18')],'faxStatusTime':this[_0x43e2('0x3f')],'faxCapacity':this[_0x43e2('0x19')],'faxCurrentCapacity':this[_0x43e2('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x43e2('0x1c')],'smsCurrentCapacity':this[_0x43e2('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x43e2('0x1f')],'whatsappCapacity':this[_0x43e2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x43e2('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x43e2('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x43e2('0x27')],'faxWaitingInteractions':this[_0x43e2('0x28')],'mailWaitingInteractions':this[_0x43e2('0x29')],'openchannelWaitingInteractions':this[_0x43e2('0x41')],'smsWaitingInteractions':this[_0x43e2('0x2a')],'whatsappWaitingInteractions':this[_0x43e2('0x2b')]};var _0x1cf8e5=md5(JSON[_0x43e2('0x42')](_0x42f495));if(this[_0x43e2('0x1')]!==_0x1cf8e5){this[_0x43e2('0x1')]=_0x1cf8e5;io[_0x43e2('0x43')](_0x43e2('0x44'),_[_0x43e2('0x45')](_0x42f495,[_0x43e2('0x9')]));}};module[_0x43e2('0x46')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a39e667..92f5660 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 _0x2bb7=['lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','updateRealtime','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit'];(function(_0x494866,_0x5de5f0){var _0x3c8968=function(_0x18f269){while(--_0x18f269){_0x494866['push'](_0x494866['shift']());}};_0x3c8968(++_0x5de5f0);}(_0x2bb7,0xb6));var _0x72bb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2bb7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x72bb('0x0'));var md5=require(_0x72bb('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x72bb('0x2'));config[_0x72bb('0x3')]=_['defaults'](config[_0x72bb('0x3')],{'host':_0x72bb('0x4'),'port':0x18eb});var io=require(_0x72bb('0x5'))(new Redis(config[_0x72bb('0x3')]));function ChatQueue(_0x326c9a){this['id']=_0x326c9a['id']||0x0;this['name']=_0x326c9a[_0x72bb('0x6')]||'';this['timeout']=_0x326c9a[_0x72bb('0x7')]||0xa;this['strategy']=_0x326c9a['strategy']||'beepall';this['Agents']=_0x326c9a[_0x72bb('0x8')];this[_0x72bb('0x9')]={};this[_0x72bb('0xa')]=0x0;this['md5']='';this[_0x72bb('0xb')]();this['updateRealtime']();}ChatQueue['prototype'][_0x72bb('0xb')]=function(){var _0x448827=this[_0x72bb('0x9')]['_rr'];this[_0x72bb('0x9')]=_[_0x72bb('0xc')](this[_0x72bb('0x8')],'id');this['mapAgentsId'][_0x72bb('0xd')]=_0x448827;};ChatQueue[_0x72bb('0xe')][_0x72bb('0xf')]=function(){this['loggedIn']=0x0;this[_0x72bb('0x10')]=0x0;for(var _0x4214a7=0x0;_0x4214a7=0x0?this[_0x72bb('0x14')]:0x0;var _0x27ebb6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x72bb('0x15')],'name':this['name'],'paused':this[_0x72bb('0x10')],'waiting':this[_0x72bb('0xa')]};var _0x4df304=md5(JSON[_0x72bb('0x16')](_0x27ebb6));if(this[_0x72bb('0x1')]!==_0x4df304){this[_0x72bb('0x1')]=_0x4df304;io['to'](util[_0x72bb('0x17')](_0x72bb('0x18'),_0x27ebb6[_0x72bb('0x6')]))[_0x72bb('0x19')]('chat_queue:save',_0x27ebb6);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x5c61=['available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','localhost','redis','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused'];(function(_0x1978f8,_0x5dc5b0){var _0x285d93=function(_0x20656e){while(--_0x20656e){_0x1978f8['push'](_0x1978f8['shift']());}};_0x285d93(++_0x5dc5b0);}(_0x5c61,0x14b));var _0x15c6=function(_0x52f509,_0x9c2ff6){_0x52f509=_0x52f509-0x0;var _0x108ad4=_0x5c61[_0x52f509];return _0x108ad4;};'use strict';var _=require('lodash');var md5=require(_0x15c6('0x0'));var util=require(_0x15c6('0x1'));var Redis=require(_0x15c6('0x2'));var config=require(_0x15c6('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x15c6('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x15c6('0x5')]));function ChatQueue(_0x4f6cef){this['id']=_0x4f6cef['id']||0x0;this[_0x15c6('0x6')]=_0x4f6cef[_0x15c6('0x6')]||'';this['timeout']=_0x4f6cef['timeout']||0xa;this[_0x15c6('0x7')]=_0x4f6cef[_0x15c6('0x7')]||_0x15c6('0x8');this['Agents']=_0x4f6cef[_0x15c6('0x9')];this[_0x15c6('0xa')]={};this['waiting']=0x0;this[_0x15c6('0x0')]='';this[_0x15c6('0xb')]();this[_0x15c6('0xc')]();}ChatQueue[_0x15c6('0xd')][_0x15c6('0xb')]=function(){var _0x1c3559=this[_0x15c6('0xa')][_0x15c6('0xe')];this[_0x15c6('0xa')]=_[_0x15c6('0xf')](this[_0x15c6('0x9')],'id');this[_0x15c6('0xa')][_0x15c6('0xe')]=_0x1c3559;};ChatQueue[_0x15c6('0xd')]['updateRealtime']=function(){this[_0x15c6('0x10')]=0x0;this['paused']=0x0;for(var _0x3b7196=0x0;_0x3b7196=0x0?this[_0x15c6('0x14')]:0x0;var _0x30f9d5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x15c6('0x10')],'name':this[_0x15c6('0x6')],'paused':this[_0x15c6('0x13')],'waiting':this[_0x15c6('0x15')]};var _0x2ef2ea=md5(JSON['stringify'](_0x30f9d5));if(this[_0x15c6('0x0')]!==_0x2ef2ea){this[_0x15c6('0x0')]=_0x2ef2ea;io['to'](util[_0x15c6('0x16')](_0x15c6('0x17'),_0x30f9d5[_0x15c6('0x6')]))[_0x15c6('0x18')](_0x15c6('0x19'),_0x30f9d5);}};module[_0x15c6('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d022038..350f0c1 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 _0xaa0f=['util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','exports'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xaa0f,0xa2));var _0xfaa0=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0xaa0f[_0x3a21c0];return _0x411e84;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xfaa0('0x0'));var Redis=require('ioredis');var config=require(_0xfaa0('0x1'));config[_0xfaa0('0x2')]=_[_0xfaa0('0x3')](config[_0xfaa0('0x2')],{'host':_0xfaa0('0x4'),'port':0x18eb});var io=require(_0xfaa0('0x5'))(new Redis(config[_0xfaa0('0x2')]));function FaxQueue(_0xbbc51){this['id']=_0xbbc51['id']||0x0;this[_0xfaa0('0x6')]=_0xbbc51[_0xfaa0('0x6')]||'';this[_0xfaa0('0x7')]=_0xbbc51['timeout']||0xa;this[_0xfaa0('0x8')]=_0xbbc51['strategy']||_0xfaa0('0x9');this[_0xfaa0('0xa')]=_0xbbc51[_0xfaa0('0xa')];this[_0xfaa0('0xb')]={};this[_0xfaa0('0xc')]=0x0;this[_0xfaa0('0xd')]='';this[_0xfaa0('0xe')]();this['updateRealtime']();}FaxQueue[_0xfaa0('0xf')]['updateRouting']=function(){var _0x331e57=this[_0xfaa0('0xb')][_0xfaa0('0x10')];this[_0xfaa0('0xb')]=_['map'](this[_0xfaa0('0xa')],'id');this[_0xfaa0('0xb')][_0xfaa0('0x10')]=_0x331e57;};FaxQueue[_0xfaa0('0xf')][_0xfaa0('0x11')]=function(){this[_0xfaa0('0x12')]=0x0;this['paused']=0x0;for(var _0x4fa33=0x0;_0x4fa33=0x0?this['available']:0x0;var _0x381f97={'id':this['id'],'available':this[_0xfaa0('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xfaa0('0x6')],'paused':this[_0xfaa0('0x14')],'waiting':this[_0xfaa0('0xc')]};var _0x5d4aaa=md5(JSON[_0xfaa0('0x15')](_0x381f97));if(this[_0xfaa0('0xd')]!==_0x5d4aaa){this[_0xfaa0('0xd')]=_0x5d4aaa;io['to'](util[_0xfaa0('0x16')](_0xfaa0('0x17'),_0x381f97[_0xfaa0('0x6')]))[_0xfaa0('0x18')](_0xfaa0('0x19'),_0x381f97);}};module[_0xfaa0('0x1a')]=FaxQueue; \ No newline at end of file +var _0x8d80=['../../../config/environment','defaults','redis','name','timeout','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save','exports','md5','util','ioredis'];(function(_0x28a600,_0x35f64a){var _0x24c0ed=function(_0x89051){while(--_0x89051){_0x28a600['push'](_0x28a600['shift']());}};_0x24c0ed(++_0x35f64a);}(_0x8d80,0x1f1));var _0x08d8=function(_0x5694d3,_0x2e3008){_0x5694d3=_0x5694d3-0x0;var _0x1ca96e=_0x8d80[_0x5694d3];return _0x1ca96e;};'use strict';var _=require('lodash');var md5=require(_0x08d8('0x0'));var util=require(_0x08d8('0x1'));var Redis=require(_0x08d8('0x2'));var config=require(_0x08d8('0x3'));config['redis']=_[_0x08d8('0x4')](config[_0x08d8('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x08d8('0x5')]));function FaxQueue(_0x57ba58){this['id']=_0x57ba58['id']||0x0;this[_0x08d8('0x6')]=_0x57ba58[_0x08d8('0x6')]||'';this[_0x08d8('0x7')]=_0x57ba58[_0x08d8('0x7')]||0xa;this['strategy']=_0x57ba58['strategy']||'beepall';this['Agents']=_0x57ba58[_0x08d8('0x8')];this['mapAgentsId']={};this[_0x08d8('0x9')]=0x0;this[_0x08d8('0x0')]='';this[_0x08d8('0xa')]();this[_0x08d8('0xb')]();}FaxQueue[_0x08d8('0xc')]['updateRouting']=function(){var _0x234ecc=this[_0x08d8('0xd')][_0x08d8('0xe')];this[_0x08d8('0xd')]=_['map'](this['Agents'],'id');this[_0x08d8('0xd')][_0x08d8('0xe')]=_0x234ecc;};FaxQueue['prototype'][_0x08d8('0xb')]=function(){this[_0x08d8('0xf')]=0x0;this[_0x08d8('0x10')]=0x0;for(var _0x1e3548=0x0;_0x1e3548=0x0?this[_0x08d8('0x14')]:0x0;var _0x2be2ff={'id':this['id'],'available':this[_0x08d8('0x14')],'loggedIn':this[_0x08d8('0xf')],'name':this[_0x08d8('0x6')],'paused':this[_0x08d8('0x10')],'waiting':this[_0x08d8('0x9')]};var _0x433b55=md5(JSON['stringify'](_0x2be2ff));if(this['md5']!==_0x433b55){this['md5']=_0x433b55;io['to'](util[_0x08d8('0x15')]('fax:queue:%s',_0x2be2ff[_0x08d8('0x6')]))[_0x08d8('0x16')](_0x08d8('0x17'),_0x2be2ff);}};module[_0x08d8('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 9cf2605..d5401f5 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 _0x549c=['Intervals','exports','name'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x549c,0x71));var _0xc549=function(_0x240610,_0x3b57eb){_0x240610=_0x240610-0x0;var _0x5303cf=_0x549c[_0x240610];return _0x5303cf;};'use strict';function Interval(_0x437312){this['id']=_0x437312['id']||0x0;this[_0xc549('0x0')]=_0x437312[_0xc549('0x0')]||'';this[_0xc549('0x1')]=_0x437312[_0xc549('0x1')]||{};}module[_0xc549('0x2')]=Interval; \ No newline at end of file +var _0xecca=['Intervals','exports','name'];(function(_0xc564,_0x4e2158){var _0x53b573=function(_0x46801b){while(--_0x46801b){_0xc564['push'](_0xc564['shift']());}};_0x53b573(++_0x4e2158);}(_0xecca,0x152));var _0xaecc=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xecca[_0xd1d19a];return _0x52a79d;};'use strict';function Interval(_0x33fc92){this['id']=_0x33fc92['id']||0x0;this[_0xaecc('0x0')]=_0x33fc92[_0xaecc('0x0')]||'';this[_0xaecc('0x1')]=_0x33fc92[_0xaecc('0x1')]||{};}module[_0xaecc('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 165812c..389674d 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 _0x08a7=['loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x08a7,0xfb));var _0x708a=function(_0x2dad33,_0x314bb4){_0x2dad33=_0x2dad33-0x0;var _0x2dc233=_0x08a7[_0x2dad33];return _0x2dc233;};'use strict';var _=require(_0x708a('0x0'));var md5=require(_0x708a('0x1'));var util=require(_0x708a('0x2'));var Redis=require('ioredis');var config=require(_0x708a('0x3'));config[_0x708a('0x4')]=_[_0x708a('0x5')](config[_0x708a('0x4')],{'host':_0x708a('0x6'),'port':0x18eb});var io=require(_0x708a('0x7'))(new Redis(config['redis']));function MailQueue(_0x192584){this['id']=_0x192584['id']||0x0;this[_0x708a('0x8')]=_0x192584[_0x708a('0x8')]||'';this[_0x708a('0x9')]=_0x192584[_0x708a('0x9')]||0xa;this['strategy']=_0x192584[_0x708a('0xa')]||_0x708a('0xb');this[_0x708a('0xc')]=_0x192584[_0x708a('0xc')];this[_0x708a('0xd')]={};this['waiting']=0x0;this[_0x708a('0x1')]='';this[_0x708a('0xe')]();this[_0x708a('0xf')]();}MailQueue[_0x708a('0x10')][_0x708a('0xe')]=function(){var _0x193e9e=this[_0x708a('0xd')][_0x708a('0x11')];this[_0x708a('0xd')]=_[_0x708a('0x12')](this[_0x708a('0xc')],'id');this[_0x708a('0xd')][_0x708a('0x11')]=_0x193e9e;};MailQueue[_0x708a('0x10')][_0x708a('0xf')]=function(){this[_0x708a('0x13')]=0x0;this[_0x708a('0x14')]=0x0;for(var _0x5b69b7=0x0;_0x5b69b7=0x0?this[_0x708a('0x18')]:0x0;var _0x308ef4={'id':this['id'],'available':this[_0x708a('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x708a('0x8')],'paused':this[_0x708a('0x14')],'waiting':this[_0x708a('0x19')]};var _0x57bb35=md5(JSON[_0x708a('0x1a')](_0x308ef4));if(this['md5']!==_0x57bb35){this[_0x708a('0x1')]=_0x57bb35;io['to'](util[_0x708a('0x1b')](_0x708a('0x1c'),_0x308ef4[_0x708a('0x8')]))[_0x708a('0x1d')]('mail_queue:save',_0x308ef4);}};module['exports']=MailQueue; \ No newline at end of file +var _0x434e=['available','format','mail:queue:%s','emit','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','map','_rr','prototype','loggedIn','online','mailPause','paused'];(function(_0x88ae65,_0x207bd0){var _0x8b6282=function(_0x4bdb47){while(--_0x4bdb47){_0x88ae65['push'](_0x88ae65['shift']());}};_0x8b6282(++_0x207bd0);}(_0x434e,0x1d8));var _0xe434=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x434e[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xe434('0x0'));var md5=require(_0xe434('0x1'));var util=require('util');var Redis=require(_0xe434('0x2'));var config=require(_0xe434('0x3'));config[_0xe434('0x4')]=_['defaults'](config[_0xe434('0x4')],{'host':_0xe434('0x5'),'port':0x18eb});var io=require(_0xe434('0x6'))(new Redis(config['redis']));function MailQueue(_0x3334a4){this['id']=_0x3334a4['id']||0x0;this[_0xe434('0x7')]=_0x3334a4[_0xe434('0x7')]||'';this[_0xe434('0x8')]=_0x3334a4[_0xe434('0x8')]||0xa;this[_0xe434('0x9')]=_0x3334a4[_0xe434('0x9')]||'beepall';this[_0xe434('0xa')]=_0x3334a4[_0xe434('0xa')];this[_0xe434('0xb')]={};this[_0xe434('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xe434('0xd')]();}MailQueue['prototype'][_0xe434('0xe')]=function(){var _0x67cf78=this[_0xe434('0xb')]['_rr'];this[_0xe434('0xb')]=_[_0xe434('0xf')](this[_0xe434('0xa')],'id');this[_0xe434('0xb')][_0xe434('0x10')]=_0x67cf78;};MailQueue[_0xe434('0x11')][_0xe434('0xd')]=function(){this[_0xe434('0x12')]=0x0;this['paused']=0x0;for(var _0x49989a=0x0;_0x49989a=0x0?this[_0xe434('0x16')]:0x0;var _0x42ea2e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe434('0x12')],'name':this[_0xe434('0x7')],'paused':this[_0xe434('0x15')],'waiting':this[_0xe434('0xc')]};var _0x12299d=md5(JSON['stringify'](_0x42ea2e));if(this[_0xe434('0x1')]!==_0x12299d){this[_0xe434('0x1')]=_0x12299d;io['to'](util[_0xe434('0x17')](_0xe434('0x18'),_0x42ea2e[_0xe434('0x7')]))[_0xe434('0x19')]('mail_queue:save',_0x42ea2e);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 77b53c3..b6567ca 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x17d89e,_0x32606d){var _0x15731c=function(_0x159721){while(--_0x159721){_0x17d89e['push'](_0x17d89e['shift']());}};_0x15731c(++_0x32606d);}(_0x814b,0x1a2));var _0xb814=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x814b[_0x5d23be];return _0x4d60a9;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c372620..738cd18 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 _0x6953=['name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','redis','localhost','socket.io-emitter'];(function(_0x594622,_0x7c8ce6){var _0x397608=function(_0x512211){while(--_0x512211){_0x594622['push'](_0x594622['shift']());}};_0x397608(++_0x7c8ce6);}(_0x6953,0x91));var _0x3695=function(_0xd89691,_0x3ff428){_0xd89691=_0xd89691-0x0;var _0x5afbad=_0x6953[_0xd89691];return _0x5afbad;};'use strict';var _=require(_0x3695('0x0'));var md5=require(_0x3695('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3695('0x2')]=_['defaults'](config[_0x3695('0x2')],{'host':_0x3695('0x3'),'port':0x18eb});var io=require(_0x3695('0x4'))(new Redis(config['redis']));function SmsQueue(_0xd0f9a5){this['id']=_0xd0f9a5['id']||0x0;this['name']=_0xd0f9a5[_0x3695('0x5')]||'';this[_0x3695('0x6')]=_0xd0f9a5[_0x3695('0x6')]||0xa;this[_0x3695('0x7')]=_0xd0f9a5[_0x3695('0x7')]||'beepall';this[_0x3695('0x8')]=_0xd0f9a5['Agents'];this[_0x3695('0x9')]={};this['waiting']=0x0;this['md5']='';this[_0x3695('0xa')]();this['updateRealtime']();}SmsQueue[_0x3695('0xb')][_0x3695('0xa')]=function(){var _0x2a7ab7=this[_0x3695('0x9')][_0x3695('0xc')];this[_0x3695('0x9')]=_['map'](this[_0x3695('0x8')],'id');this[_0x3695('0x9')][_0x3695('0xc')]=_0x2a7ab7;};SmsQueue[_0x3695('0xb')][_0x3695('0xd')]=function(){this[_0x3695('0xe')]=0x0;this[_0x3695('0xf')]=0x0;for(var _0x4df429=0x0;_0x4df429=0x0?this['available']:0x0;var _0x1082db={'id':this['id'],'available':this[_0x3695('0x12')],'loggedIn':this[_0x3695('0xe')],'name':this[_0x3695('0x5')],'paused':this[_0x3695('0xf')],'waiting':this['waiting']};var _0x1bb921=md5(JSON[_0x3695('0x13')](_0x1082db));if(this[_0x3695('0x1')]!==_0x1bb921){this[_0x3695('0x1')]=_0x1bb921;io['to'](util[_0x3695('0x14')](_0x3695('0x15'),_0x1082db[_0x3695('0x5')]))[_0x3695('0x16')](_0x3695('0x17'),_0x1082db);}};module[_0x3695('0x18')]=SmsQueue; \ No newline at end of file +var _0xad36=['localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x302421,_0x226244){var _0x419e2a=function(_0xeaf2b5){while(--_0xeaf2b5){_0x302421['push'](_0x302421['shift']());}};_0x419e2a(++_0x226244);}(_0xad36,0x11c));var _0x6ad3=function(_0x5e40b6,_0x2193e9){_0x5e40b6=_0x5e40b6-0x0;var _0x3899c5=_0xad36[_0x5e40b6];return _0x3899c5;};'use strict';var _=require('lodash');var md5=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var Redis=require(_0x6ad3('0x2'));var config=require(_0x6ad3('0x3'));config[_0x6ad3('0x4')]=_[_0x6ad3('0x5')](config[_0x6ad3('0x4')],{'host':_0x6ad3('0x6'),'port':0x18eb});var io=require(_0x6ad3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x2053e8){this['id']=_0x2053e8['id']||0x0;this[_0x6ad3('0x8')]=_0x2053e8[_0x6ad3('0x8')]||'';this[_0x6ad3('0x9')]=_0x2053e8['timeout']||0xa;this['strategy']=_0x2053e8['strategy']||'beepall';this[_0x6ad3('0xa')]=_0x2053e8[_0x6ad3('0xa')];this[_0x6ad3('0xb')]={};this[_0x6ad3('0xc')]=0x0;this[_0x6ad3('0x0')]='';this[_0x6ad3('0xd')]();this[_0x6ad3('0xe')]();}SmsQueue[_0x6ad3('0xf')][_0x6ad3('0xd')]=function(){var _0x4a47d0=this[_0x6ad3('0xb')][_0x6ad3('0x10')];this[_0x6ad3('0xb')]=_[_0x6ad3('0x11')](this[_0x6ad3('0xa')],'id');this[_0x6ad3('0xb')][_0x6ad3('0x10')]=_0x4a47d0;};SmsQueue[_0x6ad3('0xf')]['updateRealtime']=function(){this[_0x6ad3('0x12')]=0x0;this['paused']=0x0;for(var _0x14418f=0x0;_0x14418f=0x0?this['available']:0x0;var _0x358243={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6ad3('0x12')],'name':this[_0x6ad3('0x8')],'paused':this[_0x6ad3('0x16')],'waiting':this[_0x6ad3('0xc')]};var _0x5b20b1=md5(JSON['stringify'](_0x358243));if(this[_0x6ad3('0x0')]!==_0x5b20b1){this[_0x6ad3('0x0')]=_0x5b20b1;io['to'](util[_0x6ad3('0x18')](_0x6ad3('0x19'),_0x358243[_0x6ad3('0x8')]))[_0x6ad3('0x1a')](_0x6ad3('0x1b'),_0x358243);}};module[_0x6ad3('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 73afd72..adbd522 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 _0x8d95=['waiting','stringify','format','whatsapp_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','whatsappPause','available'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0x8d95,0x156));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var md5=require(_0x58d9('0x0'));var util=require(_0x58d9('0x1'));var Redis=require('ioredis');var config=require(_0x58d9('0x2'));config[_0x58d9('0x3')]=_[_0x58d9('0x4')](config[_0x58d9('0x3')],{'host':_0x58d9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58d9('0x3')]));function WhatsappQueue(_0x4aef8e){this['id']=_0x4aef8e['id']||0x0;this['name']=_0x4aef8e[_0x58d9('0x6')]||'';this['timeout']=_0x4aef8e[_0x58d9('0x7')]||0xa;this['strategy']=_0x4aef8e[_0x58d9('0x8')]||_0x58d9('0x9');this[_0x58d9('0xa')]=_0x4aef8e['Agents'];this[_0x58d9('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x58d9('0xc')]();this[_0x58d9('0xd')]();}WhatsappQueue[_0x58d9('0xe')][_0x58d9('0xc')]=function(){var _0x381c37=this[_0x58d9('0xb')][_0x58d9('0xf')];this[_0x58d9('0xb')]=_['map'](this[_0x58d9('0xa')],'id');this[_0x58d9('0xb')][_0x58d9('0xf')]=_0x381c37;};WhatsappQueue[_0x58d9('0xe')][_0x58d9('0xd')]=function(){this['loggedIn']=0x0;this[_0x58d9('0x10')]=0x0;for(var _0x2d7865=0x0;_0x2d7865=0x0?this[_0x58d9('0x15')]:0x0;var _0x1b7b13={'id':this['id'],'available':this[_0x58d9('0x15')],'loggedIn':this[_0x58d9('0x13')],'name':this[_0x58d9('0x6')],'paused':this[_0x58d9('0x10')],'waiting':this[_0x58d9('0x16')]};var _0x4cbe74=md5(JSON[_0x58d9('0x17')](_0x1b7b13));if(this[_0x58d9('0x0')]!==_0x4cbe74){this[_0x58d9('0x0')]=_0x4cbe74;io['to'](util[_0x58d9('0x18')]('whatsapp:queue:%s',_0x1b7b13[_0x58d9('0x6')]))['emit'](_0x58d9('0x19'),_0x1b7b13);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xcfc4=['updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','redis','name','timeout','strategy','Agents','waiting'];(function(_0x819ce,_0xf25f51){var _0x1edcf0=function(_0x192389){while(--_0x192389){_0x819ce['push'](_0x819ce['shift']());}};_0x1edcf0(++_0xf25f51);}(_0xcfc4,0x187));var _0x4cfc=function(_0x139ac3,_0x1470e8){_0x139ac3=_0x139ac3-0x0;var _0x33e0a7=_0xcfc4[_0x139ac3];return _0x33e0a7;};'use strict';var _=require(_0x4cfc('0x0'));var md5=require(_0x4cfc('0x1'));var util=require('util');var Redis=require(_0x4cfc('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4cfc('0x3')]));function WhatsappQueue(_0x97a8b7){this['id']=_0x97a8b7['id']||0x0;this[_0x4cfc('0x4')]=_0x97a8b7[_0x4cfc('0x4')]||'';this[_0x4cfc('0x5')]=_0x97a8b7[_0x4cfc('0x5')]||0xa;this[_0x4cfc('0x6')]=_0x97a8b7[_0x4cfc('0x6')]||'beepall';this[_0x4cfc('0x7')]=_0x97a8b7['Agents'];this['mapAgentsId']={};this[_0x4cfc('0x8')]=0x0;this[_0x4cfc('0x1')]='';this[_0x4cfc('0x9')]();this[_0x4cfc('0xa')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x5ba6f5=this[_0x4cfc('0xb')][_0x4cfc('0xc')];this[_0x4cfc('0xb')]=_[_0x4cfc('0xd')](this['Agents'],'id');this['mapAgentsId'][_0x4cfc('0xc')]=_0x5ba6f5;};WhatsappQueue[_0x4cfc('0xe')][_0x4cfc('0xa')]=function(){this[_0x4cfc('0xf')]=0x0;this[_0x4cfc('0x10')]=0x0;for(var _0x35e79b=0x0;_0x35e79b=0x0?this['available']:0x0;var _0x55e383={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4cfc('0x8')]};var _0x188874=md5(JSON['stringify'](_0x55e383));if(this[_0x4cfc('0x1')]!==_0x188874){this[_0x4cfc('0x1')]=_0x188874;io['to'](util[_0x4cfc('0x15')](_0x4cfc('0x16'),_0x55e383[_0x4cfc('0x4')]))[_0x4cfc('0x17')]('whatsapp_queue:save',_0x55e383);}};module[_0x4cfc('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 86eea44..639d2dd 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x5a9980,_0x4c54a7){var _0x200d99=function(_0x280caf){while(--_0x280caf){_0x5a9980['push'](_0x5a9980['shift']());}};_0x200d99(++_0x4c54a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0xb10b[_0x3d6db1];return _0x5e1cc3;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 1f112e6..ebb9834 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 _0x9927=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction','addTags'];(function(_0x469a2d,_0x53bcbe){var _0x148147=function(_0xe46eea){while(--_0xe46eea){_0x469a2d['push'](_0x469a2d['shift']());}};_0x148147(++_0x53bcbe);}(_0x9927,0x130));var _0x7992=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9927[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x7992('0x0'));exports[_0x7992('0x1')]=function(_0x5379be,_0x5d3597){return client['Request']('UpdateChatInteraction',{'body':_0x5d3597,'options':{'where':{'id':_0x5379be}},'log':_0x7992('0x2')});};exports[_0x7992('0x3')]=function(_0x1e5394,_0xb6b229){return client[_0x7992('0x4')](_0x7992('0x5'),{'body':_0xb6b229,'options':{'where':{'id':_0x1e5394}},'log':_0x7992('0x6')});}; \ No newline at end of file +var _0x290b=['Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x1c1913,_0x1d1b59){var _0x3b352a=function(_0x1f97d0){while(--_0x1f97d0){_0x1c1913['push'](_0x1c1913['shift']());}};_0x3b352a(++_0x1d1b59);}(_0x290b,0x16a));var _0xb290=function(_0x3a4ff3,_0x87bf88){_0x3a4ff3=_0x3a4ff3-0x0;var _0x4d781c=_0x290b[_0x3a4ff3];return _0x4d781c;};'use strict';var client=require(_0xb290('0x0'));exports[_0xb290('0x1')]=function(_0x4b3355,_0x307b55){return client[_0xb290('0x2')](_0xb290('0x3'),{'body':_0x307b55,'options':{'where':{'id':_0x4b3355}},'log':_0xb290('0x4')});};exports[_0xb290('0x5')]=function(_0x540a78,_0x4301f){return client[_0xb290('0x2')]('AddTagsToChatInteraction',{'body':_0x4301f,'options':{'where':{'id':_0x540a78}},'log':_0xb290('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3398d74..63cfe0e 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 _0x57e5=['create','Request','CreateChatMessage','../client'];(function(_0x241d88,_0x5f2c46){var _0x58215e=function(_0x645177){while(--_0x645177){_0x241d88['push'](_0x241d88['shift']());}};_0x58215e(++_0x5f2c46);}(_0x57e5,0x15b));var _0x557e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x57e5[_0x525c7b];return _0x27b33e;};'use strict';var client=require(_0x557e('0x0'));exports[_0x557e('0x1')]=function(_0x8d04a6){return client[_0x557e('0x2')](_0x557e('0x3'),{'body':_0x8d04a6,'log':'createChatMessage'});}; \ No newline at end of file +var _0xfa86=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x13700d,_0x5bfb92){var _0x451421=function(_0xf176f1){while(--_0xf176f1){_0x13700d['push'](_0x13700d['shift']());}};_0x451421(++_0x5bfb92);}(_0xfa86,0x118));var _0x6fa8=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0xfa86[_0x3074f3];return _0x53f112;};'use strict';var client=require('../client');exports[_0x6fa8('0x0')]=function(_0x3c4df2){return client[_0x6fa8('0x1')](_0x6fa8('0x2'),{'body':_0x3c4df2,'log':_0x6fa8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b2c23f6..ff3e0b5 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 _0x9ade=['strategy','User','online','chatPause','../client','getChatQueues','name'];(function(_0x5bf9ec,_0x3bfe56){var _0x28ff9e=function(_0x1819c5){while(--_0x1819c5){_0x5bf9ec['push'](_0x5bf9ec['shift']());}};_0x28ff9e(++_0x3bfe56);}(_0x9ade,0x107));var _0xe9ad=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0x9ade[_0x3c4e4c];return _0x144a87;};'use strict';var client=require(_0xe9ad('0x0'));exports[_0xe9ad('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xe9ad('0x2'),'timeout',_0xe9ad('0x3')],'include':[{'model':_0xe9ad('0x4'),'as':'Agents','attributes':['id','name',_0xe9ad('0x5'),_0xe9ad('0x6')]}]},'log':_0xe9ad('0x1')});};}; \ No newline at end of file +var _0x624c=['name','timeout','User','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x624c,0x1ee));var _0xc624=function(_0x497826,_0x164921){_0x497826=_0x497826-0x0;var _0x4b3ae6=_0x624c[_0x497826];return _0x4b3ae6;};'use strict';var client=require('../client');exports[_0xc624('0x0')]=function(){return function(){return client[_0xc624('0x1')](_0xc624('0x2'),{'options':{'raw':![],'attributes':['id',_0xc624('0x3'),_0xc624('0x4'),'strategy'],'include':[{'model':_0xc624('0x5'),'as':'Agents','attributes':['id',_0xc624('0x3'),'online',_0xc624('0x6')]}]},'log':_0xc624('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3f63220..262b0d7 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 _0xbf83=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','Request'];(function(_0x3c30a4,_0x152fd6){var _0x4f3e14=function(_0x28d11e){while(--_0x28d11e){_0x3c30a4['push'](_0x3c30a4['shift']());}};_0x4f3e14(++_0x152fd6);}(_0xbf83,0x11e));var _0x3bf8=function(_0xfb67f,_0x1665ec){_0xfb67f=_0xfb67f-0x0;var _0x4916b7=_0xbf83[_0xfb67f];return _0x4916b7;};'use strict';var client=require(_0x3bf8('0x0'));exports['create']=function(_0x25cf41){return client[_0x3bf8('0x1')](_0x3bf8('0x2'),{'body':_0x25cf41,'log':_0x3bf8('0x2')});};exports[_0x3bf8('0x3')]=function(_0x488e9a,_0x565784){return client[_0x3bf8('0x1')](_0x3bf8('0x4'),{'body':_0x565784,'options':{'where':{'uniqueid':_0x488e9a},'order':[['id',_0x3bf8('0x5')]],'limit':0x1},'log':_0x3bf8('0x4')});}; \ No newline at end of file +var _0x1bca=['UpdateChatQueueReport','DESC','create','CreateChatQueueReport','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1bca,0xb6));var _0xa1bc=function(_0x55b6a6,_0x1f6235){_0x55b6a6=_0x55b6a6-0x0;var _0x4d7974=_0x1bca[_0x55b6a6];return _0x4d7974;};'use strict';var client=require('../client');exports[_0xa1bc('0x0')]=function(_0x4a2571){return client['Request'](_0xa1bc('0x1'),{'body':_0x4a2571,'log':'CreateChatQueueReport'});};exports[_0xa1bc('0x2')]=function(_0x1fa3d2,_0x3469ad){return client['Request'](_0xa1bc('0x3'),{'body':_0x3469ad,'options':{'where':{'uniqueid':_0x1fa3d2},'order':[['id',_0xa1bc('0x4')]],'limit':0x1},'log':_0xa1bc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d384d37..dafbd27 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x7a54,0x106));var _0x47a5=function(_0x35c509,_0x36000e){_0x35c509=_0x35c509-0x0;var _0x9754bc=_0x7a54[_0x35c509];return _0x9754bc;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x7a54,0x106));var _0x47a5=function(_0x45d7a6,_0x277ed6){_0x45d7a6=_0x45d7a6-0x0;var _0x3758e6=_0x7a54[_0x45d7a6];return _0x3758e6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f046a6d..3a5490a 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 _0x36dc=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x447ca9,_0x5a00e9){var _0x1b3a46=function(_0x27c331){while(--_0x27c331){_0x447ca9['push'](_0x447ca9['shift']());}};_0x1b3a46(++_0x5a00e9);}(_0x36dc,0x1aa));var _0xc36d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x36dc[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xc36d('0x0'));exports[_0xc36d('0x1')]=function(_0x3a2f44){return client[_0xc36d('0x2')](_0xc36d('0x3'),{'body':_0x3a2f44,'log':_0xc36d('0x4')});}; \ No newline at end of file +var _0xaf9d=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x133db1,_0x3eaab6){var _0x5065b7=function(_0x526681){while(--_0x526681){_0x133db1['push'](_0x133db1['shift']());}};_0x5065b7(++_0x3eaab6);}(_0xaf9d,0xbf));var _0xdaf9=function(_0x9bd950,_0x4bfda0){_0x9bd950=_0x9bd950-0x0;var _0x73aaf9=_0xaf9d[_0x9bd950];return _0x73aaf9;};'use strict';var client=require('../client');exports[_0xdaf9('0x0')]=function(_0x5b4d99){return client[_0xdaf9('0x1')](_0xdaf9('0x2'),{'body':_0x5b4d99,'log':_0xdaf9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4c254f3..ac528b5 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 _0xf7ac=['timeout','strategy','User','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x4fade1,_0x11b341){var _0x2c758e=function(_0x35a19d){while(--_0x35a19d){_0x4fade1['push'](_0x4fade1['shift']());}};_0x2c758e(++_0x11b341);}(_0xf7ac,0x161));var _0xcf7a=function(_0x2cac05,_0x3c6cdf){_0x2cac05=_0x2cac05-0x0;var _0x2ea2ef=_0xf7ac[_0x2cac05];return _0x2ea2ef;};'use strict';var client=require(_0xcf7a('0x0'));exports[_0xcf7a('0x1')]=function(){return function(){return client[_0xcf7a('0x2')](_0xcf7a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xcf7a('0x4'),_0xcf7a('0x5')],'include':[{'model':_0xcf7a('0x6'),'as':'Agents','attributes':['id','name','online','faxPause']}]},'log':_0xcf7a('0x1')});};}; \ No newline at end of file +var _0x860d=['online','../client','getFaxQueues','GetFaxQueue','name','strategy','User','Agents'];(function(_0x2331dc,_0x35bc39){var _0x32af23=function(_0x2564d6){while(--_0x2564d6){_0x2331dc['push'](_0x2331dc['shift']());}};_0x32af23(++_0x35bc39);}(_0x860d,0xf1));var _0xd860=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x860d[_0x592d48];return _0x5d789e;};'use strict';var client=require(_0xd860('0x0'));exports[_0xd860('0x1')]=function(){return function(){return client['Request'](_0xd860('0x2'),{'options':{'raw':![],'attributes':['id',_0xd860('0x3'),'timeout',_0xd860('0x4')],'include':[{'model':_0xd860('0x5'),'as':_0xd860('0x6'),'attributes':['id',_0xd860('0x3'),_0xd860('0x7'),'faxPause']}]},'log':_0xd860('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0d6448e..54e69f1 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 _0x5892=['create','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5892,0xfa));var _0x2589=function(_0x5cca59,_0x12cf15){_0x5cca59=_0x5cca59-0x0;var _0x16708a=_0x5892[_0x5cca59];return _0x16708a;};'use strict';var client=require('../client');exports[_0x2589('0x0')]=function(_0x163350){return client['Request'](_0x2589('0x1'),{'body':_0x163350,'log':_0x2589('0x1')});};exports['update']=function(_0x5ed633,_0x3e28dd){return client[_0x2589('0x2')](_0x2589('0x3'),{'body':_0x3e28dd,'options':{'where':{'uniqueid':_0x5ed633},'order':[['id',_0x2589('0x4')]],'limit':0x1},'log':_0x2589('0x3')});}; \ No newline at end of file +var _0x5650=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x51d780,_0x151f65){var _0x37ebad=function(_0x2ddda8){while(--_0x2ddda8){_0x51d780['push'](_0x51d780['shift']());}};_0x37ebad(++_0x151f65);}(_0x5650,0xd8));var _0x0565=function(_0x22395a,_0x4a4fd0){_0x22395a=_0x22395a-0x0;var _0x436c90=_0x5650[_0x22395a];return _0x436c90;};'use strict';var client=require(_0x0565('0x0'));exports[_0x0565('0x1')]=function(_0x4e13e0){return client[_0x0565('0x2')]('CreateFaxQueueReport',{'body':_0x4e13e0,'log':_0x0565('0x3')});};exports['update']=function(_0x2bb63a,_0x16dd62){return client[_0x0565('0x2')](_0x0565('0x4'),{'body':_0x16dd62,'options':{'where':{'uniqueid':_0x2bb63a},'order':[['id',_0x0565('0x5')]],'limit':0x1},'log':_0x0565('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e268803..163a9c9 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 _0x89da=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0xf4fee8,_0x5951ce){var _0x1303d7=function(_0x56e749){while(--_0x56e749){_0xf4fee8['push'](_0xf4fee8['shift']());}};_0x1303d7(++_0x5951ce);}(_0x89da,0x1c9));var _0xa89d=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x89da[_0x2af29a];return _0x5ef02f;};'use strict';var client=require(_0xa89d('0x0'));exports[_0xa89d('0x1')]=function(){return function(){return client['Request'](_0xa89d('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa89d('0x3')],'include':[{'model':_0xa89d('0x4'),'as':_0xa89d('0x5'),'attributes':['id',_0xa89d('0x3'),_0xa89d('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xfbb1=['name','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x2642e9,_0x23363b){var _0x288933=function(_0x1d51ce){while(--_0x1d51ce){_0x2642e9['push'](_0x2642e9['shift']());}};_0x288933(++_0x23363b);}(_0xfbb1,0x73));var _0x1fbb=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xfbb1[_0xe84805];return _0x398efd;};'use strict';var client=require(_0x1fbb('0x0'));exports[_0x1fbb('0x1')]=function(){return function(){return client[_0x1fbb('0x2')](_0x1fbb('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1fbb('0x4')],'include':[{'model':'Interval','as':_0x1fbb('0x5'),'attributes':['id',_0x1fbb('0x4'),_0x1fbb('0x6')]}]},'log':_0x1fbb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index abfb21a..50197e9 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 _0x7096=['AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x465d8c,_0x101ece){var _0x28f93e=function(_0x2584d8){while(--_0x2584d8){_0x465d8c['push'](_0x465d8c['shift']());}};_0x28f93e(++_0x101ece);}(_0x7096,0x10c));var _0x6709=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7096[_0x5608a3];return _0x1ed50a;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file +var _0x0598=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','updateMailInteraction','addTags'];(function(_0x1279b3,_0x559152){var _0x322a62=function(_0x1fed17){while(--_0x1fed17){_0x1279b3['push'](_0x1279b3['shift']());}};_0x322a62(++_0x559152);}(_0x0598,0x92));var _0x8059=function(_0x33ba50,_0x45ac70){_0x33ba50=_0x33ba50-0x0;var _0x107458=_0x0598[_0x33ba50];return _0x107458;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(_0x5c8253,_0x3386f0){return client['Request']('UpdateMailInteraction',{'body':_0x3386f0,'options':{'where':{'id':_0x5c8253}},'log':_0x8059('0x2')});};exports[_0x8059('0x3')]=function(_0x54b9a2,_0x54f42f){return client['Request'](_0x8059('0x4'),{'body':_0x54f42f,'options':{'where':{'id':_0x54b9a2}},'log':_0x8059('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8b3d11f..a1e03fa 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 _0x3e51=['CreateMailMessage','../client','create'];(function(_0x2f0821,_0x474cd4){var _0x29d867=function(_0xaeb8cc){while(--_0xaeb8cc){_0x2f0821['push'](_0x2f0821['shift']());}};_0x29d867(++_0x474cd4);}(_0x3e51,0x1db));var _0x13e5=function(_0x4a2291,_0x1d9584){_0x4a2291=_0x4a2291-0x0;var _0x174162=_0x3e51[_0x4a2291];return _0x174162;};'use strict';var client=require(_0x13e5('0x0'));exports[_0x13e5('0x1')]=function(_0x1fd081){return client['Request'](_0x13e5('0x2'),{'body':_0x1fd081,'log':'createMailMessage'});}; \ No newline at end of file +var _0x1341=['create','createMailMessage'];(function(_0x58c5fe,_0x268459){var _0x6054ad=function(_0x14c7a3){while(--_0x14c7a3){_0x58c5fe['push'](_0x58c5fe['shift']());}};_0x6054ad(++_0x268459);}(_0x1341,0xda));var _0x1134=function(_0x2830a8,_0x2b349f){_0x2830a8=_0x2830a8-0x0;var _0x363f70=_0x1341[_0x2830a8];return _0x363f70;};'use strict';var client=require('../client');exports[_0x1134('0x0')]=function(_0x551ca9){return client['Request']('CreateMailMessage',{'body':_0x551ca9,'log':_0x1134('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 153d223..b2fa0f6 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 _0x8b46=['Request','GetMailQueue','name','strategy','Agents','online','mailPause','../client','getMailQueues'];(function(_0x794edd,_0x45baac){var _0x285a3a=function(_0x4952f7){while(--_0x4952f7){_0x794edd['push'](_0x794edd['shift']());}};_0x285a3a(++_0x45baac);}(_0x8b46,0x154));var _0x68b4=function(_0x5bf5d6,_0x480e73){_0x5bf5d6=_0x5bf5d6-0x0;var _0x1e7509=_0x8b46[_0x5bf5d6];return _0x1e7509;};'use strict';var client=require(_0x68b4('0x0'));exports[_0x68b4('0x1')]=function(){return function(){return client[_0x68b4('0x2')](_0x68b4('0x3'),{'options':{'raw':![],'attributes':['id',_0x68b4('0x4'),'timeout',_0x68b4('0x5')],'include':[{'model':'User','as':_0x68b4('0x6'),'attributes':['id','name',_0x68b4('0x7'),_0x68b4('0x8')]}]},'log':_0x68b4('0x1')});};}; \ No newline at end of file +var _0x1313=['getMailQueues','../client','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x2594a0,_0x2fcd63){var _0x30be9b=function(_0xc7375e){while(--_0xc7375e){_0x2594a0['push'](_0x2594a0['shift']());}};_0x30be9b(++_0x2fcd63);}(_0x1313,0x1e1));var _0x3131=function(_0xc8cb5c,_0x38355d){_0xc8cb5c=_0xc8cb5c-0x0;var _0x1fff99=_0x1313[_0xc8cb5c];return _0x1fff99;};'use strict';var client=require(_0x3131('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x3131('0x1'),{'options':{'raw':![],'attributes':['id',_0x3131('0x2'),_0x3131('0x3'),_0x3131('0x4')],'include':[{'model':'User','as':_0x3131('0x5'),'attributes':['id',_0x3131('0x2'),_0x3131('0x6'),'mailPause']}]},'log':_0x3131('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 790409e..2748cc0 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 _0x3c69=['DESC','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3c69,0x178));var _0x93c6=function(_0x35bdcf,_0x21421c){_0x35bdcf=_0x35bdcf-0x0;var _0x5a4fc7=_0x3c69[_0x35bdcf];return _0x5a4fc7;};'use strict';var client=require('../client');exports['create']=function(_0x551845){return client[_0x93c6('0x0')](_0x93c6('0x1'),{'body':_0x551845,'log':'CreateMailQueueReport'});};exports[_0x93c6('0x2')]=function(_0x56d615,_0x1d84a3){return client[_0x93c6('0x0')](_0x93c6('0x3'),{'body':_0x1d84a3,'options':{'where':{'uniqueid':_0x56d615},'order':[['id',_0x93c6('0x4')]],'limit':0x1},'log':_0x93c6('0x3')});}; \ No newline at end of file +var _0xf86f=['../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x5e832c,_0x5c9cb1){var _0x4d7d1d=function(_0x30021c){while(--_0x30021c){_0x5e832c['push'](_0x5e832c['shift']());}};_0x4d7d1d(++_0x5c9cb1);}(_0xf86f,0x102));var _0xff86=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xf86f[_0x534c8f];return _0x5a57f5;};'use strict';var client=require(_0xff86('0x0'));exports['create']=function(_0xfa983b){return client[_0xff86('0x1')](_0xff86('0x2'),{'body':_0xfa983b,'log':_0xff86('0x2')});};exports[_0xff86('0x3')]=function(_0x1008f2,_0x407c03){return client['Request'](_0xff86('0x4'),{'body':_0x407c03,'options':{'where':{'uniqueid':_0x1008f2},'order':[['id',_0xff86('0x5')]],'limit':0x1},'log':_0xff86('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 82f2538..ad756a4 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 _0x84b2=['addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84b2,0x8e));var _0x284b=function(_0x2bd8db,_0x4f946f){_0x2bd8db=_0x2bd8db-0x0;var _0x327b64=_0x84b2[_0x2bd8db];return _0x327b64;};'use strict';var client=require(_0x284b('0x0'));exports[_0x284b('0x1')]=function(_0x205718,_0x438eb6){return client[_0x284b('0x2')](_0x284b('0x3'),{'body':_0x438eb6,'options':{'where':{'id':_0x205718}},'log':_0x284b('0x4')});};exports[_0x284b('0x5')]=function(_0xb16bbd,_0xbd450a){return client[_0x284b('0x2')](_0x284b('0x6'),{'body':_0xbd450a,'options':{'where':{'id':_0xb16bbd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xdf51=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xdf51,0x11f));var _0x1df5=function(_0x4346c4,_0x53ac29){_0x4346c4=_0x4346c4-0x0;var _0x304289=_0xdf51[_0x4346c4];return _0x304289;};'use strict';var client=require(_0x1df5('0x0'));exports[_0x1df5('0x1')]=function(_0x47d107,_0x126dbe){return client[_0x1df5('0x2')](_0x1df5('0x3'),{'body':_0x126dbe,'options':{'where':{'id':_0x47d107}},'log':_0x1df5('0x4')});};exports['addTags']=function(_0x132b47,_0xe47a13){return client['Request'](_0x1df5('0x5'),{'body':_0xe47a13,'options':{'where':{'id':_0x132b47}},'log':_0x1df5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bd630dc..2e2693e 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 _0x8f88=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f88,0x121));var _0x88f8=function(_0x3e7b5a,_0x4c06fe){_0x3e7b5a=_0x3e7b5a-0x0;var _0x4880aa=_0x8f88[_0x3e7b5a];return _0x4880aa;};'use strict';var client=require('../client');exports[_0x88f8('0x0')]=function(_0x9845f0){return client[_0x88f8('0x1')](_0x88f8('0x2'),{'body':_0x9845f0,'log':_0x88f8('0x3')});}; \ No newline at end of file +var _0xdda9=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x446e63,_0x2ed366){var _0x5e615a=function(_0x5279e0){while(--_0x5279e0){_0x446e63['push'](_0x446e63['shift']());}};_0x5e615a(++_0x2ed366);}(_0xdda9,0x82));var _0x9dda=function(_0x24901e,_0x53f656){_0x24901e=_0x24901e-0x0;var _0xbb2191=_0xdda9[_0x24901e];return _0xbb2191;};'use strict';var client=require(_0x9dda('0x0'));exports[_0x9dda('0x1')]=function(_0x26671e){return client[_0x9dda('0x2')](_0x9dda('0x3'),{'body':_0x26671e,'log':_0x9dda('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4eb6672..3f357b2 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 _0x7657=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x7657,0x18f));var _0x7765=function(_0x465c15,_0x25024b){_0x465c15=_0x465c15-0x0;var _0x502bb2=_0x7657[_0x465c15];return _0x502bb2;};'use strict';var client=require(_0x7765('0x0'));exports[_0x7765('0x1')]=function(){return function(){return client[_0x7765('0x2')](_0x7765('0x3'),{'options':{'raw':![],'attributes':['id',_0x7765('0x4'),_0x7765('0x5'),_0x7765('0x6')],'include':[{'model':_0x7765('0x7'),'as':_0x7765('0x8'),'attributes':['id','name','online',_0x7765('0x9')]}]},'log':_0x7765('0x1')});};}; \ No newline at end of file +var _0xb53b=['openchannelPause','getOpenchannelQueues','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x5b2b9b,_0x1e3ed2){var _0x3a01cd=function(_0x37dd73){while(--_0x37dd73){_0x5b2b9b['push'](_0x5b2b9b['shift']());}};_0x3a01cd(++_0x1e3ed2);}(_0xb53b,0x1d6));var _0xbb53=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb53b[_0x34bc30];return _0x5706de;};'use strict';var client=require(_0xbb53('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xbb53('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xbb53('0x2'),_0xbb53('0x3'),_0xbb53('0x4')],'include':[{'model':_0xbb53('0x5'),'as':_0xbb53('0x6'),'attributes':['id',_0xbb53('0x2'),'online',_0xbb53('0x7')]}]},'log':_0xbb53('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ecdc468..1555d40 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 _0x9af1=['create','CreateOpenchannelQueueReport','update','Request','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x8d5ec2,_0x5ddbdc){var _0x2f69b9=function(_0x380d09){while(--_0x380d09){_0x8d5ec2['push'](_0x8d5ec2['shift']());}};_0x2f69b9(++_0x5ddbdc);}(_0x9af1,0x68));var _0x19af=function(_0x2b7663,_0x17020d){_0x2b7663=_0x2b7663-0x0;var _0x13df95=_0x9af1[_0x2b7663];return _0x13df95;};'use strict';var client=require(_0x19af('0x0'));exports[_0x19af('0x1')]=function(_0x3b9ad7){return client['Request'](_0x19af('0x2'),{'body':_0x3b9ad7,'log':_0x19af('0x2')});};exports[_0x19af('0x3')]=function(_0x48da4d,_0x4a3621){return client[_0x19af('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x4a3621,'options':{'where':{'uniqueid':_0x48da4d},'order':[['id',_0x19af('0x5')]],'limit':0x1},'log':_0x19af('0x6')});}; \ No newline at end of file +var _0xee64=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x5d8232,_0x156279){var _0x5daf30=function(_0x1ef696){while(--_0x1ef696){_0x5d8232['push'](_0x5d8232['shift']());}};_0x5daf30(++_0x156279);}(_0xee64,0x14d));var _0x4ee6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xee64[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x4ee6('0x0'));exports[_0x4ee6('0x1')]=function(_0x3ec814){return client[_0x4ee6('0x2')](_0x4ee6('0x3'),{'body':_0x3ec814,'log':_0x4ee6('0x3')});};exports[_0x4ee6('0x4')]=function(_0xfcc4c8,_0x10c172){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x10c172,'options':{'where':{'uniqueid':_0xfcc4c8},'order':[['id','DESC']],'limit':0x1},'log':_0x4ee6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1c2949c..34d1d6d 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 _0x16cc=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x2d2885,_0x667d70){var _0x2cea6=function(_0x407056){while(--_0x407056){_0x2d2885['push'](_0x2d2885['shift']());}};_0x2cea6(++_0x667d70);}(_0x16cc,0x120));var _0xc16c=function(_0x17fc42,_0x536aac){_0x17fc42=_0x17fc42-0x0;var _0x4f0523=_0x16cc[_0x17fc42];return _0x4f0523;};'use strict';var client=require('../client');exports[_0xc16c('0x0')]=function(_0x2fc94e,_0x4d3ce9){return client[_0xc16c('0x1')](_0xc16c('0x2'),{'body':_0x4d3ce9,'options':{'where':{'id':_0x2fc94e}},'log':_0xc16c('0x3')});};exports[_0xc16c('0x4')]=function(_0x5b0f8b,_0x10c787){return client[_0xc16c('0x1')](_0xc16c('0x5'),{'body':_0x10c787,'options':{'where':{'id':_0x5b0f8b}},'log':_0xc16c('0x6')});}; \ No newline at end of file +var _0x2821=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x2821,0xc3));var _0x1282=function(_0x14339d,_0x483dc3){_0x14339d=_0x14339d-0x0;var _0x515270=_0x2821[_0x14339d];return _0x515270;};'use strict';var client=require(_0x1282('0x0'));exports[_0x1282('0x1')]=function(_0x21120c,_0x24382c){return client[_0x1282('0x2')](_0x1282('0x3'),{'body':_0x24382c,'options':{'where':{'id':_0x21120c}},'log':'updateSmsInteraction'});};exports[_0x1282('0x4')]=function(_0x36f2c2,_0x4b7e46){return client[_0x1282('0x2')](_0x1282('0x5'),{'body':_0x4b7e46,'options':{'where':{'id':_0x36f2c2}},'log':_0x1282('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 926ba2c..c54ab48 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 _0xaccf=['../client','create','Request'];(function(_0x1f0b92,_0x338e57){var _0x46dcd4=function(_0x297247){while(--_0x297247){_0x1f0b92['push'](_0x1f0b92['shift']());}};_0x46dcd4(++_0x338e57);}(_0xaccf,0x10e));var _0xfacc=function(_0x40ce71,_0x28c1d9){_0x40ce71=_0x40ce71-0x0;var _0x2020e8=_0xaccf[_0x40ce71];return _0x2020e8;};'use strict';var client=require(_0xfacc('0x0'));exports[_0xfacc('0x1')]=function(_0x5d00aa){return client[_0xfacc('0x2')]('CreateSmsMessage',{'body':_0x5d00aa,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xee58=['../client','Request','CreateSmsMessage'];(function(_0x542951,_0x11882b){var _0x5d6034=function(_0x3fa8bc){while(--_0x3fa8bc){_0x542951['push'](_0x542951['shift']());}};_0x5d6034(++_0x11882b);}(_0xee58,0x93));var _0x8ee5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xee58[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x8ee5('0x0'));exports['create']=function(_0x2264e6){return client[_0x8ee5('0x1')](_0x8ee5('0x2'),{'body':_0x2264e6,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 692f2cb..8d335c2 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x50c0c2,_0x343cfd){var _0x14acd4=function(_0x30a036){while(--_0x30a036){_0x50c0c2['push'](_0x50c0c2['shift']());}};_0x14acd4(++_0x343cfd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x4e49d7,_0x36fc2d){var _0x1636d2=function(_0x147989){while(--_0x147989){_0x4e49d7['push'](_0x4e49d7['shift']());}};_0x1636d2(++_0x36fc2d);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 368bae2..4d70fec 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x43ded0,_0x11adf2){var _0x4f9466=function(_0x5e1041){while(--_0x5e1041){_0x43ded0['push'](_0x43ded0['shift']());}};_0x4f9466(++_0x11adf2);}(_0x55ca,0x126));var _0xa55c=function(_0x94dd49,_0x2661bc){_0x94dd49=_0x94dd49-0x0;var _0x44571f=_0x55ca[_0x94dd49];return _0x44571f;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2a0e80,_0x379250){var _0x5a3500=function(_0x59248f){while(--_0x59248f){_0x2a0e80['push'](_0x2a0e80['shift']());}};_0x5a3500(++_0x379250);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 18908aa..6c6fc87 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(_0x3b747a,_0xa1205c){var _0x3ff138=function(_0x5d09e0){while(--_0x5d09e0){_0x3b747a['push'](_0x3b747a['shift']());}};_0x3ff138(++_0xa1205c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x356165,_0xd928e){var _0x169c82=function(_0x4ac13b){while(--_0x4ac13b){_0x356165['push'](_0x356165['shift']());}};_0x169c82(++_0xd928e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 eb4378b..17bc988 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 _0x68b3=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x2f9e6c,_0xa4e6f7){_0x2f9e6c=_0x2f9e6c-0x0;var _0x10eb7a=_0x68b3[_0x2f9e6c];return _0x10eb7a;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateWhatsappInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file +var _0x5d17=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x34358f,_0x3e021d){var _0x5c71c1=function(_0x1033bf){while(--_0x1033bf){_0x34358f['push'](_0x34358f['shift']());}};_0x5c71c1(++_0x3e021d);}(_0x5d17,0x114));var _0x75d1=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x5d17[_0xf93076];return _0x33d1da;};'use strict';var client=require(_0x75d1('0x0'));exports[_0x75d1('0x1')]=function(_0x58fb6b,_0x5b3ed3){return client[_0x75d1('0x2')](_0x75d1('0x3'),{'body':_0x5b3ed3,'options':{'where':{'id':_0x58fb6b}},'log':_0x75d1('0x4')});};exports['addTags']=function(_0x177460,_0x45d03a){return client[_0x75d1('0x2')](_0x75d1('0x5'),{'body':_0x45d03a,'options':{'where':{'id':_0x177460}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c43685b..7c0fdd7 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 _0x861c=['createWhatsappMessage','../client','create','Request'];(function(_0x4bad08,_0x1e0c5f){var _0x522870=function(_0x247b34){while(--_0x247b34){_0x4bad08['push'](_0x4bad08['shift']());}};_0x522870(++_0x1e0c5f);}(_0x861c,0x155));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xc861('0x0'));exports[_0xc861('0x1')]=function(_0x4ed016){return client[_0xc861('0x2')]('CreateWhatsappMessage',{'body':_0x4ed016,'log':_0xc861('0x3')});}; \ No newline at end of file +var _0x1af2=['Request','CreateWhatsappMessage','../client','create'];(function(_0x11026e,_0x164422){var _0x334d99=function(_0x1c9568){while(--_0x1c9568){_0x11026e['push'](_0x11026e['shift']());}};_0x334d99(++_0x164422);}(_0x1af2,0xaa));var _0x21af=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0x1af2[_0x285d29];return _0x202256;};'use strict';var client=require(_0x21af('0x0'));exports[_0x21af('0x1')]=function(_0xa949bf){return client[_0x21af('0x2')](_0x21af('0x3'),{'body':_0xa949bf,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 76fea5d..f261fef 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 _0x28d0=['whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x28d0,0x1c4));var _0x028d=function(_0x5a98c9,_0x5ef84f){_0x5a98c9=_0x5a98c9-0x0;var _0xaa62bf=_0x28d0[_0x5a98c9];return _0xaa62bf;};'use strict';var client=require(_0x028d('0x0'));exports[_0x028d('0x1')]=function(){return function(){return client[_0x028d('0x2')](_0x028d('0x3'),{'options':{'raw':![],'attributes':['id',_0x028d('0x4'),_0x028d('0x5'),_0x028d('0x6')],'include':[{'model':_0x028d('0x7'),'as':_0x028d('0x8'),'attributes':['id',_0x028d('0x4'),_0x028d('0x9'),_0x028d('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x0644=['Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x2e1058,_0x535e8c){var _0x3b9d5b=function(_0x4a0a92){while(--_0x4a0a92){_0x2e1058['push'](_0x2e1058['shift']());}};_0x3b9d5b(++_0x535e8c);}(_0x0644,0xfb));var _0x4064=function(_0x652385,_0x20b88c){_0x652385=_0x652385-0x0;var _0x1e6f24=_0x0644[_0x652385];return _0x1e6f24;};'use strict';var client=require(_0x4064('0x0'));exports[_0x4064('0x1')]=function(){return function(){return client[_0x4064('0x2')](_0x4064('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4064('0x4'),_0x4064('0x5')],'include':[{'model':_0x4064('0x6'),'as':_0x4064('0x7'),'attributes':['id',_0x4064('0x8'),_0x4064('0x9'),_0x4064('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7dd4d6a..7845736 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 _0x43b4=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x4dd7bb,_0x409176){var _0xbc91e8=function(_0x28690e){while(--_0x28690e){_0x4dd7bb['push'](_0x4dd7bb['shift']());}};_0xbc91e8(++_0x409176);}(_0x43b4,0xce));var _0x443b=function(_0x49be45,_0x9169e3){_0x49be45=_0x49be45-0x0;var _0x3d7163=_0x43b4[_0x49be45];return _0x3d7163;};'use strict';var client=require(_0x443b('0x0'));exports[_0x443b('0x1')]=function(_0x269658){return client[_0x443b('0x2')](_0x443b('0x3'),{'body':_0x269658,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x4e9cab,_0x43e08c){return client[_0x443b('0x2')]('UpdateWhatsappQueueReport',{'body':_0x43e08c,'options':{'where':{'uniqueid':_0x4e9cab},'order':[['id',_0x443b('0x4')]],'limit':0x1},'log':_0x443b('0x5')});}; \ No newline at end of file +var _0xfefd=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x4bedce,_0x265ebf){var _0x4fd2fb=function(_0x14122b){while(--_0x14122b){_0x4bedce['push'](_0x4bedce['shift']());}};_0x4fd2fb(++_0x265ebf);}(_0xfefd,0x16f));var _0xdfef=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0xfefd[_0x447ef1];return _0x3d72ec;};'use strict';var client=require(_0xdfef('0x0'));exports[_0xdfef('0x1')]=function(_0x6cfbdc){return client[_0xdfef('0x2')](_0xdfef('0x3'),{'body':_0x6cfbdc,'log':_0xdfef('0x3')});};exports[_0xdfef('0x4')]=function(_0x26ca01,_0x33b547){return client[_0xdfef('0x2')](_0xdfef('0x5'),{'body':_0x33b547,'options':{'where':{'uniqueid':_0x26ca01},'order':[['id',_0xdfef('0x6')]],'limit':0x1},'log':_0xdfef('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 1550e3c..63e3c1e 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 _0xfbfe=['next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./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','error','[%s][AGENT]\x20%s','message','join','stop','find','timeout','createQueue','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x27ca98,_0x536336){var _0x246749=function(_0xb35654){while(--_0xb35654){_0x27ca98['push'](_0x27ca98['shift']());}};_0x246749(++_0x536336);}(_0xfbfe,0xcc));var _0xefbf=function(_0x5119c8,_0x5fcb2d){_0x5119c8=_0x5119c8-0x0;var _0x4d9182=_0xfbfe[_0x5119c8];return _0x4d9182;};'use strict';var schema=require(_0xefbf('0x0'));var _=require('lodash');var util=require(_0xefbf('0x1'));var seqqueue=require(_0xefbf('0x2'));var logger=require(_0xefbf('0x3'))(_0xefbf('0x4'));var strategy=require(_0xefbf('0x5'));var queue=schema({'name':{'type':_0xefbf('0x6'),'required':!![],'message':_0xefbf('0x7')},'timeout':{'type':_0xefbf('0x8'),'message':_0xefbf('0x9')}});function writeLog(_0x23e215,_0x240741,_0x445736){return logger[_0xefbf('0xa')](util[_0xefbf('0xb')](_0xefbf('0xc'),_0x23e215,_0x240741[_0xefbf('0xd')],_0x445736));}function handleFindAgent(_0x2f7f16){return function(_0x30c45c){return _0x30c45c[_0xefbf('0xd')]['toLowerCase']()===_0x2f7f16[_0xefbf('0xe')]();};}exports['consequence']=function(_0x4bf39c,_0x28103c,_0x52ca48,_0x4e23a5){return function(_0x1bdfcc){try{var _0x2aaca1={'name':_0x28103c[0x0],'timeout':_0x28103c[0x1]};var _0x4437d0=queue[_0xefbf('0x0')](_0x2aaca1,{'typecast':!![]});if(_0x4437d0['length']){logger[_0xefbf('0xf')](_0xefbf('0x10'),_0x4bf39c,_['map'](_0x4437d0,_0xefbf('0x11'))[_0xefbf('0x12')](',\x20'));_0x1bdfcc[_0xefbf('0x13')]();}else{var _0x4454ac=_[_0xefbf('0x14')](_0x52ca48['agents'],handleFindAgent(_0x2aaca1['name']));if(_0x4454ac){var _0xcbcc9f=(_0x2aaca1[_0xefbf('0x15')]||0xa)*0x3e8;var _0x3775cb,_0x49d106;var _0x50d06f=seqqueue[_0xefbf('0x16')](_0xcbcc9f);_0x50d06f['id']=_0x4bf39c;_0x50d06f['atimeout']=_0xcbcc9f;_0x50d06f['channel']=_0x4e23a5['channel'];writeLog(_0x4bf39c,_0x4454ac,util[_0xefbf('0xb')]('START:%s',_0xcbcc9f));_0x52ca48[_0xefbf('0x17')][_0x4bf39c]['on'](_0xefbf('0x18'),function(){logger[_0xefbf('0xa')](_0xefbf('0x19'),_0x4bf39c);clearTimeout(_0x49d106);_0x49d106=undefined;_0x50d06f[_0xefbf('0x1a')]();if(_0x52ca48['rules'][_0x4bf39c]){delete _0x52ca48[_0xefbf('0x17')][_0x4bf39c];}_0x1bdfcc[_0xefbf('0x13')]();});_0x52ca48['rules'][_0x4bf39c]['on']('complete',function(){if(_0x52ca48[_0xefbf('0x17')][_0x4bf39c]){delete _0x52ca48[_0xefbf('0x17')][_0x4bf39c];}});_0x49d106=setTimeout(function(){logger[_0xefbf('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x4bf39c);clearTimeout(_0x49d106);_0x50d06f[_0xefbf('0x1a')]();_0x1bdfcc[_0xefbf('0x1b')]();},_0xcbcc9f);strategy[_0xefbf('0x1c')](_0x50d06f,_0x4454ac,_0x52ca48,_0x4e23a5);}else{logger[_0xefbf('0xf')](_0xefbf('0x1d'),_0x4bf39c,_0x2aaca1[_0xefbf('0xd')]);_0x1bdfcc[_0xefbf('0x13')]();}}}catch(_0x328be1){console[_0xefbf('0x1e')](_0x328be1);logger[_0xefbf('0xf')](_0xefbf('0x1f'),_0x4bf39c,_0x328be1[_0xefbf('0x20')]);_0x1bdfcc[_0xefbf('0x13')]();}};}; \ No newline at end of file +var _0xb96d=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','map','message','join','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','error','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0x4cbf78,_0x206106){var _0x2ae4f8=function(_0x1dc531){while(--_0x1dc531){_0x4cbf78['push'](_0x4cbf78['shift']());}};_0x2ae4f8(++_0x206106);}(_0xb96d,0xbe));var _0xdb96=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xb96d[_0x52f1e6];return _0x21f104;};'use strict';var schema=require(_0xdb96('0x0'));var _=require(_0xdb96('0x1'));var util=require(_0xdb96('0x2'));var seqqueue=require(_0xdb96('0x3'));var logger=require(_0xdb96('0x4'))(_0xdb96('0x5'));var strategy=require(_0xdb96('0x6'));var queue=schema({'name':{'type':_0xdb96('0x7'),'required':!![],'message':_0xdb96('0x8')},'timeout':{'type':_0xdb96('0x9'),'message':_0xdb96('0xa')}});function writeLog(_0x57ab4e,_0x34fa92,_0x4ad0c3){return logger[_0xdb96('0xb')](util[_0xdb96('0xc')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x57ab4e,_0x34fa92['name'],_0x4ad0c3));}function handleFindAgent(_0x5b1c10){return function(_0x41fe31){return _0x41fe31[_0xdb96('0xd')][_0xdb96('0xe')]()===_0x5b1c10[_0xdb96('0xe')]();};}exports[_0xdb96('0xf')]=function(_0x3db835,_0x38f288,_0x19bc3d,_0x2a0d12){return function(_0x4d6b7c){try{var _0x168e69={'name':_0x38f288[0x0],'timeout':_0x38f288[0x1]};var _0xf2a2f0=queue[_0xdb96('0x0')](_0x168e69,{'typecast':!![]});if(_0xf2a2f0['length']){logger['error']('[%s][AGENT]\x20%s',_0x3db835,_[_0xdb96('0x10')](_0xf2a2f0,_0xdb96('0x11'))[_0xdb96('0x12')](',\x20'));_0x4d6b7c['stop']();}else{var _0x3ec420=_[_0xdb96('0x13')](_0x19bc3d['agents'],handleFindAgent(_0x168e69[_0xdb96('0xd')]));if(_0x3ec420){var _0x48211d=(_0x168e69[_0xdb96('0x14')]||0xa)*0x3e8;var _0x559d6e,_0x2e8694;var _0x4df8b0=seqqueue[_0xdb96('0x15')](_0x48211d);_0x4df8b0['id']=_0x3db835;_0x4df8b0[_0xdb96('0x16')]=_0x48211d;_0x4df8b0['channel']=_0x2a0d12[_0xdb96('0x17')];writeLog(_0x3db835,_0x3ec420,util['format']('START:%s',_0x48211d));_0x19bc3d[_0xdb96('0x18')][_0x3db835]['on'](_0xdb96('0x19'),function(){logger[_0xdb96('0xb')](_0xdb96('0x1a'),_0x3db835);clearTimeout(_0x2e8694);_0x2e8694=undefined;_0x4df8b0['close']();if(_0x19bc3d[_0xdb96('0x18')][_0x3db835]){delete _0x19bc3d['rules'][_0x3db835];}_0x4d6b7c['stop']();});_0x19bc3d[_0xdb96('0x18')][_0x3db835]['on'](_0xdb96('0x1b'),function(){if(_0x19bc3d[_0xdb96('0x18')][_0x3db835]){delete _0x19bc3d['rules'][_0x3db835];}});_0x2e8694=setTimeout(function(){logger[_0xdb96('0xb')]('[%s][AGENT]\x20ROUTING\x20END',_0x3db835);clearTimeout(_0x2e8694);_0x4df8b0['close']();_0x4d6b7c[_0xdb96('0x1c')]();},_0x48211d);strategy['agent'](_0x4df8b0,_0x3ec420,_0x19bc3d,_0x2a0d12);}else{logger['error'](_0xdb96('0x1d'),_0x3db835,_0x168e69[_0xdb96('0xd')]);_0x4d6b7c[_0xdb96('0x1e')]();}}}catch(_0x11433a){console['log'](_0x11433a);logger[_0xdb96('0x1f')](_0xdb96('0x20'),_0x3db835,_0x11433a['stack']);_0x4d6b7c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 026eb4d..1539a9d 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 _0x7d35=['format','out','sms','channel','whatsapp','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','LexRuntime','toString','postText','message','amazonlex','providerName','providerResponse','Failed','catch','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x5f5414,_0x407e8d){var _0xdec9d4=function(_0x248c11){while(--_0x248c11){_0x5f5414['push'](_0x5f5414['shift']());}};_0xdec9d4(++_0x407e8d);}(_0x7d35,0x19e));var _0x57d3=function(_0x3f9ea9,_0x19840d){_0x3f9ea9=_0x3f9ea9-0x0;var _0x291e7f=_0x7d35[_0x3f9ea9];return _0x291e7f;};'use strict';var _=require(_0x57d3('0x0'));var moment=require(_0x57d3('0x1'));var AWS=require(_0x57d3('0x2'));var utils=require(_0x57d3('0x3'));var logger=require(_0x57d3('0x4'))(_0x57d3('0x5'));var rpc={'chatMessage':require(_0x57d3('0x6')),'openchannelMessage':require(_0x57d3('0x7')),'mailMessage':require(_0x57d3('0x8')),'smsMessage':require(_0x57d3('0x9')),'faxMessage':require(_0x57d3('0xa')),'whatsappMessage':require(_0x57d3('0xb'))};exports['consequence']=function(_0x4ac233,_0x3785f2){return function(_0x3716ef){try{if(!_[_0x57d3('0xc')](this['interaction'][_0x57d3('0xd')])){logger[_0x57d3('0xe')](_0x57d3('0xf'),_0x4ac233,_0x57d3('0x10'));return _0x3716ef[_0x57d3('0x11')]();}var _0xf7891b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x57d3('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x57d3('0x13')};if(this['channel']===_0x57d3('0x14')||this[_0x57d3('0x15')]===_0x57d3('0x16')){_0xf7891b['phone']=this[_0x57d3('0x17')]['phone'];}var _0x35e43a=this[_0x57d3('0x15')];if(_0x35e43a===_0x57d3('0x18')){_0xf7891b[_0x57d3('0x19')]=this[_0x57d3('0x1a')]['id'];}else{_0xf7891b[_[_0x57d3('0x1b')](_0x35e43a)+'AccountId']=this[_0x57d3('0x1a')]['id'];}_0xf7891b[_[_0x57d3('0x1b')](_0x35e43a)+_0x57d3('0x1c')]=this[_0x57d3('0x17')]['id'];if(this[_0x57d3('0x17')][_0x57d3('0x1d')]){var _0x19027a=_0x3785f2[0x4];if(!_[_0x57d3('0x1e')](_0x19027a)){_0xf7891b[_0x57d3('0x1f')]=utils[_0x57d3('0x20')](_0x19027a,this);return rpc[_0x35e43a+_0x57d3('0x21')][_0x57d3('0x22')](_0xf7891b)[_0x57d3('0x23')](function(_0x14a678){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4ac233,_0xf7891b['body']);})['catch'](function(_0x2a4d13){logger[_0x57d3('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4ac233,JSON[_0x57d3('0x25')](_0x2a4d13));})['finally'](function(){logger[_0x57d3('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4ac233);_0x3716ef['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4ac233);_0x3716ef['stop']();}}else{var _0x373205=this;var _0xdb3aaa=new AWS[(_0x57d3('0x26'))]({'accessKeyId':_0x3785f2[0x0],'secretAccessKey':_0x3785f2[0x1],'region':_0x3785f2[0x2]});var _0x525e62={'botAlias':'$LATEST','botName':_0x3785f2[0x3],'inputText':this['message'][_0x57d3('0x1f')],'userId':this[_0x57d3('0x15')]+':'+this[_0x57d3('0x17')]['id'][_0x57d3('0x27')]()};_0xdb3aaa[_0x57d3('0x28')](_0x525e62,function(_0x41972d,_0x1e5071){if(_0x41972d){logger['error'](_0x57d3('0xf'),_0x4ac233,_0x41972d[_0x57d3('0x29')]);_0x3716ef[_0x57d3('0x11')]();}else if(_0x1e5071&&_0x1e5071[_0x57d3('0x29')]){_0x373205[_0x57d3('0x1f')][_0x57d3('0x2a')]=_0x1e5071;_0xf7891b['body']=_0x1e5071[_0x57d3('0x29')];_0xf7891b[_0x57d3('0x2b')]=_0x57d3('0x2a');_0xf7891b[_0x57d3('0x2c')]=JSON['stringify'](_0x1e5071);return rpc[_0x35e43a+_0x57d3('0x21')][_0x57d3('0x22')](_0xf7891b)[_0x57d3('0x23')](function(_0x3170ef){logger[_0x57d3('0xe')](_0x57d3('0xf'),_0x4ac233,_0xf7891b['body']);if(_0x1e5071['dialogState']==_0x57d3('0x2d')){_0x3716ef[_0x57d3('0x11')]();}else{_0x3716ef['stop']();}})[_0x57d3('0x2e')](function(_0x43c663){logger[_0x57d3('0x24')](_0x57d3('0xf'),_0x4ac233,JSON['stringify'](_0x43c663));_0x3716ef[_0x57d3('0x11')]();});}else{_0x3716ef[_0x57d3('0x11')]();}});}}catch(_0x39b76a){logger[_0x57d3('0x24')](_0x57d3('0xf'),_0x4ac233,JSON[_0x57d3('0x25')](_0x39b76a));_0x3716ef[_0x57d3('0x2f')]();}};}; \ No newline at end of file +var _0xff0c=['providerResponse','stringify','then','dialogState','Failed','lodash','moment','aws-sdk','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','getMustacheRender','Message','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','postText'];(function(_0x262a68,_0x5a171b){var _0x3e0716=function(_0x4feaa5){while(--_0x4feaa5){_0x262a68['push'](_0x262a68['shift']());}};_0x3e0716(++_0x5a171b);}(_0xff0c,0x67));var _0xcff0=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xff0c[_0x29d2d2];return _0x3f6476;};'use strict';var _=require(_0xcff0('0x0'));var moment=require(_0xcff0('0x1'));var AWS=require(_0xcff0('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xcff0('0x3')),'openchannelMessage':require(_0xcff0('0x4')),'mailMessage':require(_0xcff0('0x5')),'smsMessage':require(_0xcff0('0x6')),'faxMessage':require(_0xcff0('0x7')),'whatsappMessage':require(_0xcff0('0x8'))};exports[_0xcff0('0x9')]=function(_0x241cfd,_0x21b7c3){return function(_0x3d6254){try{if(!_[_0xcff0('0xa')](this['interaction'][_0xcff0('0xb')])){logger[_0xcff0('0xc')](_0xcff0('0xd'),_0x241cfd,_0xcff0('0xe'));return _0x3d6254[_0xcff0('0xf')]();}var _0x3d96dd={'ContactId':this[_0xcff0('0x10')]['id'],'sentAt':moment()[_0xcff0('0x11')](_0xcff0('0x12')),'direction':'out'};if(this[_0xcff0('0x13')]===_0xcff0('0x14')||this[_0xcff0('0x13')]===_0xcff0('0x15')){_0x3d96dd[_0xcff0('0x16')]=this[_0xcff0('0x17')][_0xcff0('0x16')];}var _0x4bfe13=this[_0xcff0('0x13')];if(_0x4bfe13===_0xcff0('0x18')){_0x3d96dd[_0xcff0('0x19')]=this[_0xcff0('0x1a')]['id'];}else{_0x3d96dd[_['upperFirst'](_0x4bfe13)+_0xcff0('0x1b')]=this[_0xcff0('0x1a')]['id'];}_0x3d96dd[_[_0xcff0('0x1c')](_0x4bfe13)+'InteractionId']=this[_0xcff0('0x17')]['id'];if(this[_0xcff0('0x17')][_0xcff0('0x1d')]){var _0x566c00=_0x21b7c3[0x4];if(!_[_0xcff0('0x1e')](_0x566c00)){_0x3d96dd['body']=utils[_0xcff0('0x1f')](_0x566c00,this);return rpc[_0x4bfe13+_0xcff0('0x20')]['create'](_0x3d96dd)['then'](function(_0x3cd91c){logger[_0xcff0('0xc')](_0xcff0('0xd'),_0x241cfd,_0x3d96dd['body']);})['catch'](function(_0x295d09){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON['stringify'](_0x295d09));})[_0xcff0('0x22')](function(){logger['info'](_0xcff0('0x23'),_0x241cfd);_0x3d6254[_0xcff0('0x24')]();});}else{logger['info'](_0xcff0('0x25'),_0x241cfd);_0x3d6254[_0xcff0('0x24')]();}}else{var _0x29aa1f=this;var _0x3eaf85=new AWS[(_0xcff0('0x26'))]({'accessKeyId':_0x21b7c3[0x0],'secretAccessKey':_0x21b7c3[0x1],'region':_0x21b7c3[0x2]});var _0x4c49b9={'botAlias':_0xcff0('0x27'),'botName':_0x21b7c3[0x3],'inputText':this[_0xcff0('0x28')][_0xcff0('0x29')],'userId':this[_0xcff0('0x13')]+':'+this[_0xcff0('0x17')]['id'][_0xcff0('0x2a')]()};_0x3eaf85[_0xcff0('0x2b')](_0x4c49b9,function(_0x22ce91,_0x4605d7){if(_0x22ce91){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,_0x22ce91[_0xcff0('0x28')]);_0x3d6254[_0xcff0('0xf')]();}else if(_0x4605d7&&_0x4605d7[_0xcff0('0x28')]){_0x29aa1f[_0xcff0('0x29')]['amazonlex']=_0x4605d7;_0x3d96dd['body']=_0x4605d7[_0xcff0('0x28')];_0x3d96dd['providerName']='amazonlex';_0x3d96dd[_0xcff0('0x2c')]=JSON[_0xcff0('0x2d')](_0x4605d7);return rpc[_0x4bfe13+_0xcff0('0x20')]['create'](_0x3d96dd)[_0xcff0('0x2e')](function(_0x8edb67){logger[_0xcff0('0xc')]('[%s][AMAZONLEX]\x20%s',_0x241cfd,_0x3d96dd[_0xcff0('0x29')]);if(_0x4605d7[_0xcff0('0x2f')]==_0xcff0('0x30')){_0x3d6254[_0xcff0('0xf')]();}else{_0x3d6254[_0xcff0('0x24')]();}})['catch'](function(_0x40f8fa){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON['stringify'](_0x40f8fa));_0x3d6254[_0xcff0('0xf')]();});}else{_0x3d6254[_0xcff0('0xf')]();}});}}catch(_0x37b3c0){logger[_0xcff0('0x21')](_0xcff0('0xd'),_0x241cfd,JSON[_0xcff0('0x2d')](_0x37b3c0));_0x3d6254[_0xcff0('0x24')]();}};}; \ 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 10877a0..a5d8f9d 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 _0xcf7e=['','replace'];(function(_0x234162,_0x1f335c){var _0x5c481b=function(_0x1557eb){while(--_0x1557eb){_0x234162['push'](_0x234162['shift']());}};_0x5c481b(++_0x1f335c);}(_0xcf7e,0x1e0));var _0xecf7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcf7e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require(_0xecf7('0x0'));var utils=require(_0xecf7('0x1'));var logger=require(_0xecf7('0x2'))(_0xecf7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xecf7('0x4')),'mailMessage':require(_0xecf7('0x5')),'smsMessage':require(_0xecf7('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xecf7('0x7')),'chatInteraction':require(_0xecf7('0x8')),'openchannelInteraction':require(_0xecf7('0x9')),'mailInteraction':require(_0xecf7('0xa')),'smsInteraction':require(_0xecf7('0xb')),'faxInteraction':require(_0xecf7('0xc')),'whatsappInteraction':require(_0xecf7('0xd'))};var mailRpc=require(_0xecf7('0xe'));exports[_0xecf7('0xf')]=function(_0x16bfe5,_0x330146,_0x4a4be9,_0x8d3492){return function(_0xfbf46b){try{var _0x4b597b=this[_0xecf7('0x10')];if(_0x4b597b===_0xecf7('0x11')&&_0x8d3492['body'][_0xecf7('0x12')]){logger[_0xecf7('0x13')](_0xecf7('0x14'),_0x16bfe5,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xfbf46b[_0xecf7('0x15')]();}if(_0x330146[0x0]==='1'&&(_[_0xecf7('0x16')](this['interaction'][_0xecf7('0x17')])||!this[_0xecf7('0x18')][_0xecf7('0x17')])){logger[_0xecf7('0x13')](_0xecf7('0x14'),_0x16bfe5,_0xecf7('0x19'));return _0xfbf46b[_0xecf7('0x15')]();}if(_0x330146[0x0]==='2'&&this[_0xecf7('0x18')][_0xecf7('0x1a')]){logger['info'](_0xecf7('0x1b'),_0x16bfe5,_0xecf7('0x1c'));return _0xfbf46b['next']();}var _0x4a713e={'ContactId':this[_0xecf7('0x1d')]['id'],'sentAt':moment()[_0xecf7('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xecf7('0x1f')};if(this[_0xecf7('0x10')]===_0xecf7('0x11')){_0x4a713e[_0xecf7('0x20')]=utils[_0xecf7('0x21')](_0x330146[0x2],this);}else{_0x4a713e[_0xecf7('0x20')]=utils[_0xecf7('0x21')](_0x330146[0x1],this);}if(this[_0xecf7('0x22')]){_0x4a713e['to']=this['message'][_0xecf7('0x23')]||'';if(this[_0xecf7('0x10')]===_0xecf7('0x11')&&_0x330146[0x1]==='1'){_0x4a713e['cc']=this[_0xecf7('0x22')]['cc']||'';}_0x4a713e[_0xecf7('0x23')]=this[_0xecf7('0x22')]['to']||'';_0x4a713e['phone']=this['message'][_0xecf7('0x24')]||'';_0x4a713e[_0xecf7('0x25')]=!![];if(this[_0xecf7('0x22')]['subject']){_0x4a713e[_0xecf7('0x26')]='';_0x4a713e[_0xecf7('0x26')]+=_[_0xecf7('0x27')](this[_0xecf7('0x22')][_0xecf7('0x26')],'Re:')?'':'Re:\x20';_0x4a713e[_0xecf7('0x26')]+=this['message'][_0xecf7('0x26')];}}if(this['channel']===_0xecf7('0x28')){_0x4a713e['ChatWebsiteId']=this[_0xecf7('0x29')]['id'];}else{_0x4a713e[_[_0xecf7('0x2a')](this['channel'])+'AccountId']=this[_0xecf7('0x29')]['id'];}_0x4a713e[_['upperFirst'](this[_0xecf7('0x10')])+'InteractionId']=this[_0xecf7('0x18')]['id'];var _0x39745a=this[_0xecf7('0x18')];if(rpc[this[_0xecf7('0x10')]+_0xecf7('0x2b')]){if(this[_0xecf7('0x10')]===_0xecf7('0x11')){_0x4a713e['inReplyTo']=this[_0xecf7('0x22')][_0xecf7('0x2c')];_0x4a713e[_0xecf7('0x2d')]=_0xecf7('0x2e')+_[_0xecf7('0x2f')](_0x4a713e[_0xecf7('0x20')],'';_0x4a713e['headers']={'Auto-Submitted':_0xecf7('0x31'),'X-Auto-Response-Suppress':_0xecf7('0x32'),'Precedence':_0xecf7('0x33')};return mailRpc[_0xecf7('0x34')](this['account'][_0xecf7('0x35')],_0x4a713e)[_0xecf7('0x36')](function(_0x51f5f1){logger[_0xecf7('0x13')](_0xecf7('0x37'),_0x16bfe5);_0x4a713e[_0xecf7('0x2c')]=_0x51f5f1[_0xecf7('0x22')][_0xecf7('0x2c')];return rpc[_0x4b597b+'Message'][_0xecf7('0x38')](_0x4a713e);})[_0xecf7('0x36')](function(_0x33e086){logger['info']('[%s][AUTOREPLY]\x20%s',_0x16bfe5,JSON['stringify'](_0x33e086));})['catch'](function(_0x46f8e7){logger[_0xecf7('0x39')](_0xecf7('0x3a'),_0x16bfe5,JSON[_0xecf7('0x3b')](_0x46f8e7));})[_0xecf7('0x3c')](function(){Promise[_0xecf7('0x3d')]()['then'](function(){if(_0x330146[0x0]!=='2'||_0x39745a['autoreplyExecuted'])return;return rpc[_0x4b597b+_0xecf7('0x3e')][_0xecf7('0x3f')](_0x39745a['id'],{'autoreplyExecuted':!![]})[_0xecf7('0x36')](function(_0x54f1f8){logger[_0xecf7('0x13')](_0xecf7('0x1b'),_0x16bfe5,JSON[_0xecf7('0x3b')](_0x54f1f8));})[_0xecf7('0x40')](function(_0x5b6b45){logger[_0xecf7('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x16bfe5,JSON['stringify'](_0x5b6b45));});})[_0xecf7('0x36')](function(){_0xfbf46b['next']();});});}else{return rpc[this['channel']+'Message'][_0xecf7('0x38')](_0x4a713e)[_0xecf7('0x36')](function(){logger[_0xecf7('0x13')](_0xecf7('0x14'),_0x16bfe5,_0x4a713e['body']);})['catch'](function(_0x392d09){logger[_0xecf7('0x39')](_0xecf7('0x14'),_0x16bfe5,JSON[_0xecf7('0x3b')](_0x392d09));})['finally'](function(){Promise[_0xecf7('0x3d')]()[_0xecf7('0x36')](function(){if(_0x330146[0x0]!=='2'||_0x39745a[_0xecf7('0x1a')])return;return rpc[_0x4b597b+'Interaction']['update'](_0x39745a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x44ef68){logger[_0xecf7('0x13')](_0xecf7('0x1b'),_0x16bfe5,JSON['stringify'](_0x44ef68));})['catch'](function(_0x56eac5){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x16bfe5,JSON[_0xecf7('0x3b')](_0x56eac5));});})[_0xecf7('0x36')](function(){_0xfbf46b['next']();});});}}}catch(_0x343d1c){logger[_0xecf7('0x39')](_0xecf7('0x14'),_0x16bfe5,JSON[_0xecf7('0x3b')](_0x343d1c));_0xfbf46b[_0xecf7('0x41')]();}};}; \ No newline at end of file +var _0xe53f=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','error','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','Re:\x20','chat'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xe53f,0x131));var _0xfe53=function(_0x103d58,_0x435b2a){_0x103d58=_0x103d58-0x0;var _0x499c0e=_0xe53f[_0x103d58];return _0x499c0e;};'use strict';var _=require(_0xfe53('0x0'));var moment=require(_0xfe53('0x1'));var utils=require(_0xfe53('0x2'));var logger=require(_0xfe53('0x3'))(_0xfe53('0x4'));var rpc={'chatMessage':require(_0xfe53('0x5')),'openchannelMessage':require(_0xfe53('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfe53('0x7')),'whatsappMessage':require(_0xfe53('0x8')),'chatInteraction':require(_0xfe53('0x9')),'openchannelInteraction':require(_0xfe53('0xa')),'mailInteraction':require(_0xfe53('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xfe53('0xc')),'whatsappInteraction':require(_0xfe53('0xd'))};var mailRpc=require(_0xfe53('0xe'));exports['consequence']=function(_0x457869,_0x5d09b3,_0x127021,_0x27876e){return function(_0x578511){try{var _0x35c843=this['channel'];if(_0x35c843==='mail'&&_0x27876e[_0xfe53('0xf')]['isAutoreply']){logger[_0xfe53('0x10')]('[%s][AUTOREPLY]\x20%s',_0x457869,_0xfe53('0x11'));return _0x578511[_0xfe53('0x12')]();}if(_0x5d09b3[0x0]==='1'&&(_[_0xfe53('0x13')](this['interaction'][_0xfe53('0x14')])||!this[_0xfe53('0x15')][_0xfe53('0x14')])){logger['info'](_0xfe53('0x16'),_0x457869,'Autoreply\x20already\x20sent');return _0x578511[_0xfe53('0x12')]();}if(_0x5d09b3[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0xfe53('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x457869,_0xfe53('0x17'));return _0x578511[_0xfe53('0x12')]();}var _0x4a0e89={'ContactId':this[_0xfe53('0x18')]['id'],'sentAt':moment()[_0xfe53('0x19')](_0xfe53('0x1a')),'direction':_0xfe53('0x1b')};if(this[_0xfe53('0x1c')]==='mail'){_0x4a0e89[_0xfe53('0xf')]=utils[_0xfe53('0x1d')](_0x5d09b3[0x2],this);}else{_0x4a0e89[_0xfe53('0xf')]=utils[_0xfe53('0x1d')](_0x5d09b3[0x1],this);}if(this[_0xfe53('0x1e')]){_0x4a0e89['to']=this[_0xfe53('0x1e')][_0xfe53('0x1f')]||'';if(this[_0xfe53('0x1c')]===_0xfe53('0x20')&&_0x5d09b3[0x1]==='1'){_0x4a0e89['cc']=this['message']['cc']||'';}_0x4a0e89[_0xfe53('0x1f')]=this[_0xfe53('0x1e')]['to']||'';_0x4a0e89[_0xfe53('0x21')]=this[_0xfe53('0x1e')]['phone']||'';_0x4a0e89[_0xfe53('0x22')]=!![];if(this[_0xfe53('0x1e')]['subject']){_0x4a0e89['subject']='';_0x4a0e89[_0xfe53('0x23')]+=_[_0xfe53('0x24')](this['message'][_0xfe53('0x23')],_0xfe53('0x25'))?'':_0xfe53('0x26');_0x4a0e89[_0xfe53('0x23')]+=this[_0xfe53('0x1e')][_0xfe53('0x23')];}}if(this[_0xfe53('0x1c')]===_0xfe53('0x27')){_0x4a0e89[_0xfe53('0x28')]=this[_0xfe53('0x29')]['id'];}else{_0x4a0e89[_[_0xfe53('0x2a')](this[_0xfe53('0x1c')])+_0xfe53('0x2b')]=this['account']['id'];}_0x4a0e89[_['upperFirst'](this['channel'])+_0xfe53('0x2c')]=this[_0xfe53('0x15')]['id'];var _0x39f08a=this[_0xfe53('0x15')];if(rpc[this['channel']+_0xfe53('0x2d')]){if(this[_0xfe53('0x1c')]===_0xfe53('0x20')){_0x4a0e89[_0xfe53('0x2e')]=this[_0xfe53('0x1e')][_0xfe53('0x2f')];_0x4a0e89['html']=''+_['replace'](_0x4a0e89['body'],_0xfe53('0x30'),_0xfe53('0x31'))+_0xfe53('0x32');_0x4a0e89['headers']={'Auto-Submitted':_0xfe53('0x33'),'X-Auto-Response-Suppress':'All','Precedence':_0xfe53('0x34')};return mailRpc[_0xfe53('0x35')](this[_0xfe53('0x29')][_0xfe53('0x36')],_0x4a0e89)[_0xfe53('0x37')](function(_0x4cc280){logger[_0xfe53('0x10')](_0xfe53('0x38'),_0x457869);_0x4a0e89['messageId']=_0x4cc280[_0xfe53('0x1e')][_0xfe53('0x2f')];return rpc[_0x35c843+_0xfe53('0x2d')][_0xfe53('0x39')](_0x4a0e89);})['then'](function(_0x44e5d8){logger['info'](_0xfe53('0x16'),_0x457869,JSON[_0xfe53('0x3a')](_0x44e5d8));})['catch'](function(_0x5a1319){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x5a1319));})[_0xfe53('0x3b')](function(){Promise[_0xfe53('0x3c')]()[_0xfe53('0x37')](function(){if(_0x5d09b3[0x0]!=='2'||_0x39f08a['autoreplyExecuted'])return;return rpc[_0x35c843+_0xfe53('0x3d')][_0xfe53('0x3e')](_0x39f08a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x53119f){logger[_0xfe53('0x10')](_0xfe53('0x3f'),_0x457869,JSON['stringify'](_0x53119f));})[_0xfe53('0x40')](function(_0x3fe404){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x3fe404));});})[_0xfe53('0x37')](function(){_0x578511[_0xfe53('0x12')]();});});}else{return rpc[this['channel']+_0xfe53('0x2d')][_0xfe53('0x39')](_0x4a0e89)['then'](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x457869,_0x4a0e89[_0xfe53('0xf')]);})['catch'](function(_0x173469){logger[_0xfe53('0x41')]('[%s][AUTOREPLY]\x20%s',_0x457869,JSON[_0xfe53('0x3a')](_0x173469));})[_0xfe53('0x3b')](function(){Promise[_0xfe53('0x3c')]()[_0xfe53('0x37')](function(){if(_0x5d09b3[0x0]!=='2'||_0x39f08a[_0xfe53('0x42')])return;return rpc[_0x35c843+_0xfe53('0x3d')][_0xfe53('0x3e')](_0x39f08a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x19d75b){logger[_0xfe53('0x10')](_0xfe53('0x3f'),_0x457869,JSON[_0xfe53('0x3a')](_0x19d75b));})[_0xfe53('0x40')](function(_0x4b4b12){logger['error'](_0xfe53('0x43'),_0x457869,JSON['stringify'](_0x4b4b12));});})['then'](function(){_0x578511['next']();});});}}}catch(_0x3925d5){logger[_0xfe53('0x41')](_0xfe53('0x16'),_0x457869,JSON[_0xfe53('0x3a')](_0x3925d5));_0x578511[_0xfe53('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 252a05f..4353b90 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 _0x7175=['Interaction','channel','update','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58fc11,_0x5a0dfb){var _0x5cf445=function(_0x291009){while(--_0x291009){_0x58fc11['push'](_0x58fc11['shift']());}};_0x5cf445(++_0x5a0dfb);}(_0x7175,0xac));var _0x5717=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0x7175[_0x169790];return _0x4d0f36;};'use strict';var moment=require('moment');var logger=require(_0x5717('0x0'))(_0x5717('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x5717('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5717('0x3')),'whatsappInteraction':require(_0x5717('0x4'))};exports['consequence']=function(_0x17db24,_0x11a43e,_0x23ee95,_0x324338){return function(_0x2770ed){try{logger['info'](_0x5717('0x5'),_0x17db24,_0x11a43e[0x0]);var _0x319d05={'closed':0x1,'closedAt':moment()[_0x5717('0x6')](_0x5717('0x7')),'closeReason':'system','disposition':_0x11a43e[0x0]};if(rpc[_0x324338['channel']+_0x5717('0x8')]){rpc[_0x324338[_0x5717('0x9')]+_0x5717('0x8')][_0x5717('0xa')](_0x324338[_0x5717('0xb')]['id'],_0x319d05)[_0x5717('0xc')](function(_0x4e7ed8){logger[_0x5717('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x17db24,_0x324338[_0x5717('0xb')]['id']);})[_0x5717('0xe')](function(_0x347581){logger[_0x5717('0xf')](_0x5717('0x10'),_0x17db24,JSON[_0x5717('0x11')](_0x347581));})[_0x5717('0x12')](function(){_0x2770ed[_0x5717('0x13')]();});}}catch(_0x3f45ea){logger[_0x5717('0xf')]('[%s][CLOSE]\x20%s',_0x17db24,JSON[_0x5717('0x11')](_0x3f45ea));_0x2770ed['stop']();}};}; \ No newline at end of file +var _0x6058=['../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x197c30,_0xbaa2ee){var _0x4ebaaf=function(_0x3d2d80){while(--_0x3d2d80){_0x197c30['push'](_0x197c30['shift']());}};_0x4ebaaf(++_0xbaa2ee);}(_0x6058,0x176));var _0x8605=function(_0x45e647,_0x2c482c){_0x45e647=_0x45e647-0x0;var _0x2deace=_0x6058[_0x45e647];return _0x2deace;};'use strict';var moment=require('moment');var logger=require(_0x8605('0x0'))(_0x8605('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8605('0x2')),'smsInteraction':require(_0x8605('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8605('0x4')),'whatsappInteraction':require(_0x8605('0x5'))};exports[_0x8605('0x6')]=function(_0x157020,_0x359290,_0xaad6be,_0xe0216a){return function(_0x1b508f){try{logger[_0x8605('0x7')](_0x8605('0x8'),_0x157020,_0x359290[0x0]);var _0x368309={'closed':0x1,'closedAt':moment()[_0x8605('0x9')](_0x8605('0xa')),'closeReason':_0x8605('0xb'),'disposition':_0x359290[0x0]};if(rpc[_0xe0216a[_0x8605('0xc')]+_0x8605('0xd')]){rpc[_0xe0216a['channel']+_0x8605('0xd')][_0x8605('0xe')](_0xe0216a[_0x8605('0xf')]['id'],_0x368309)['then'](function(_0x391dc1){logger['info'](_0x8605('0x10'),_0x157020,_0xe0216a[_0x8605('0xf')]['id']);})['catch'](function(_0x591acd){logger[_0x8605('0x11')](_0x8605('0x12'),_0x157020,JSON[_0x8605('0x13')](_0x591acd));})[_0x8605('0x14')](function(){_0x1b508f[_0x8605('0x15')]();});}}catch(_0x4215b4){logger[_0x8605('0x11')](_0x8605('0x12'),_0x157020,JSON[_0x8605('0x13')](_0x4215b4));_0x1b508f[_0x8605('0x15')]();}};}; \ 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 cc78007..f724e22 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 _0x1696=['phone','account','upperFirst','AccountId','body','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','endConversation','error','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp'];(function(_0x1a5367,_0x52176a){var _0x477997=function(_0x3c2a8b){while(--_0x3c2a8b){_0x1a5367['push'](_0x1a5367['shift']());}};_0x477997(++_0x52176a);}(_0x1696,0x79));var _0x6169=function(_0x467ef0,_0xdde0a2){_0x467ef0=_0x467ef0-0x0;var _0x19294f=_0x1696[_0x467ef0];return _0x19294f;};'use strict';var _=require(_0x6169('0x0'));var moment=require('moment');var apiai=require(_0x6169('0x1'));var md5=require(_0x6169('0x2'));var utils=require(_0x6169('0x3'));var logger=require(_0x6169('0x4'))(_0x6169('0x5'));var rpc={'chatMessage':require(_0x6169('0x6')),'openchannelMessage':require(_0x6169('0x7')),'mailMessage':require(_0x6169('0x8')),'smsMessage':require(_0x6169('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6169('0xa'))};exports[_0x6169('0xb')]=function(_0x277459,_0x6f5cec){return function(_0x289333){try{if(!_[_0x6169('0xc')](this[_0x6169('0xd')]['UserId'])){logger[_0x6169('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x277459,_0x6169('0xf'));return _0x289333[_0x6169('0x10')]();}var _0x5b5f33={'ContactId':this[_0x6169('0x11')]['id'],'sentAt':moment()[_0x6169('0x12')](_0x6169('0x13')),'direction':_0x6169('0x14')};if(this['channel']==='sms'||this[_0x6169('0x15')]===_0x6169('0x16')){_0x5b5f33['phone']=this[_0x6169('0xd')][_0x6169('0x17')];}var _0x3effcd=this['channel'];if(_0x3effcd==='chat'){_0x5b5f33['ChatWebsiteId']=this[_0x6169('0x18')]['id'];}else{_0x5b5f33[_[_0x6169('0x19')](_0x3effcd)+_0x6169('0x1a')]=this[_0x6169('0x18')]['id'];}_0x5b5f33[_[_0x6169('0x19')](_0x3effcd)+'InteractionId']=this[_0x6169('0xd')]['id'];if(this[_0x6169('0xd')]['created']){var _0x5e3312=_0x6f5cec[0x2];if(!_['isEmpty'](_0x5e3312)){_0x5b5f33[_0x6169('0x1b')]=utils[_0x6169('0x1c')](_0x5e3312,this);return rpc[_0x3effcd+'Message'][_0x6169('0x1d')](_0x5b5f33)[_0x6169('0x1e')](function(_0xd47fea){logger[_0x6169('0xe')](_0x6169('0x1f'),_0x277459,_0x5b5f33[_0x6169('0x1b')]);})[_0x6169('0x20')](function(_0x49051d){logger['error'](_0x6169('0x1f'),_0x277459,JSON[_0x6169('0x21')](_0x49051d));})['finally'](function(){logger[_0x6169('0xe')](_0x6169('0x22'),_0x277459);_0x289333[_0x6169('0x23')]();});}else{logger[_0x6169('0xe')](_0x6169('0x24'),_0x277459);_0x289333['stop']();}}else{var _0x2506bb=this;var _0x5579b9=apiai(_0x6f5cec[0x0],{'language':_0x6f5cec[0x1]||'en'});return _0x5579b9[_0x6169('0x25')](this[_0x6169('0x26')][_0x6169('0x1b')],{'sessionId':md5(this['interaction']['id'])})[_0x6169('0x1e')](function(_0x1f90aa){_0x2506bb['body']['dialogflow']=_0x1f90aa;_0x5b5f33[_0x6169('0x1b')]=_0x1f90aa[_0x6169('0x27')][_0x6169('0x28')][_0x6169('0x29')];_0x5b5f33[_0x6169('0x2a')]=_0x6169('0x2b');_0x5b5f33[_0x6169('0x2c')]=JSON[_0x6169('0x21')](_0x1f90aa);return rpc[_0x3effcd+'Message'][_0x6169('0x1d')](_0x5b5f33)['then'](function(_0x5789b1){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x277459,_0x5b5f33[_0x6169('0x1b')]);if(_0x1f90aa['result'][_0x6169('0x2d')][_0x6169('0x2e')]){_0x289333[_0x6169('0x10')]();}else{_0x289333['stop']();}})['catch'](function(_0x544dcc){logger[_0x6169('0x2f')](_0x6169('0x1f'),_0x277459,JSON['stringify'](_0x544dcc));_0x289333['next']();});})[_0x6169('0x20')](function(_0x182502){logger['error'](_0x6169('0x1f'),_0x277459,_0x182502[_0x6169('0x26')]);_0x289333['next']();});}}catch(_0x4d0d73){logger[_0x6169('0x2f')]('[%s][DIALOGFLOW]\x20%s',_0x277459,JSON['stringify'](_0x4d0d73));_0x289333['stop']();}};}; \ No newline at end of file +var _0x6c45=['UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','created','body','getMustacheRender','create','then','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!','textRequest','message','fulfillment','speech','dialogflow','providerResponse','endConversation','next','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction'];(function(_0x267a84,_0x4979cb){var _0x2587e4=function(_0x33608f){while(--_0x33608f){_0x267a84['push'](_0x267a84['shift']());}};_0x2587e4(++_0x4979cb);}(_0x6c45,0xb1));var _0x56c4=function(_0x508b96,_0x555714){_0x508b96=_0x508b96-0x0;var _0x5066d2=_0x6c45[_0x508b96];return _0x5066d2;};'use strict';var _=require(_0x56c4('0x0'));var moment=require(_0x56c4('0x1'));var apiai=require('apiai-promise');var md5=require(_0x56c4('0x2'));var utils=require(_0x56c4('0x3'));var logger=require(_0x56c4('0x4'))(_0x56c4('0x5'));var rpc={'chatMessage':require(_0x56c4('0x6')),'openchannelMessage':require(_0x56c4('0x7')),'mailMessage':require(_0x56c4('0x8')),'smsMessage':require(_0x56c4('0x9')),'faxMessage':require(_0x56c4('0xa')),'whatsappMessage':require(_0x56c4('0xb'))};exports[_0x56c4('0xc')]=function(_0x330e6,_0x1d0b9b){return function(_0x373748){try{if(!_[_0x56c4('0xd')](this[_0x56c4('0xe')][_0x56c4('0xf')])){logger[_0x56c4('0x10')](_0x56c4('0x11'),_0x330e6,_0x56c4('0x12'));return _0x373748['next']();}var _0x2533d7={'ContactId':this[_0x56c4('0x13')]['id'],'sentAt':moment()[_0x56c4('0x14')](_0x56c4('0x15')),'direction':'out'};if(this[_0x56c4('0x16')]===_0x56c4('0x17')||this[_0x56c4('0x16')]===_0x56c4('0x18')){_0x2533d7['phone']=this[_0x56c4('0xe')]['phone'];}var _0x512d7e=this[_0x56c4('0x16')];if(_0x512d7e===_0x56c4('0x19')){_0x2533d7[_0x56c4('0x1a')]=this[_0x56c4('0x1b')]['id'];}else{_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'AccountId']=this[_0x56c4('0x1b')]['id'];}_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'InteractionId']=this[_0x56c4('0xe')]['id'];if(this[_0x56c4('0xe')][_0x56c4('0x1d')]){var _0x2f0bb2=_0x1d0b9b[0x2];if(!_['isEmpty'](_0x2f0bb2)){_0x2533d7[_0x56c4('0x1e')]=utils[_0x56c4('0x1f')](_0x2f0bb2,this);return rpc[_0x512d7e+'Message'][_0x56c4('0x20')](_0x2533d7)[_0x56c4('0x21')](function(_0x110f71){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);})[_0x56c4('0x22')](function(_0x279a1e){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x279a1e));})['finally'](function(){logger['info'](_0x56c4('0x25'),_0x330e6);_0x373748[_0x56c4('0x26')]();});}else{logger['info'](_0x56c4('0x27'),_0x330e6);_0x373748[_0x56c4('0x26')]();}}else{var _0x10eae6=this;var _0x23b11e=apiai(_0x1d0b9b[0x0],{'language':_0x1d0b9b[0x1]||'en'});return _0x23b11e[_0x56c4('0x28')](this[_0x56c4('0x29')][_0x56c4('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0x56c4('0x21')](function(_0x3e1007){_0x10eae6[_0x56c4('0x1e')]['dialogflow']=_0x3e1007;_0x2533d7[_0x56c4('0x1e')]=_0x3e1007['result'][_0x56c4('0x2a')][_0x56c4('0x2b')];_0x2533d7['providerName']=_0x56c4('0x2c');_0x2533d7[_0x56c4('0x2d')]=JSON['stringify'](_0x3e1007);return rpc[_0x512d7e+'Message']['create'](_0x2533d7)[_0x56c4('0x21')](function(_0x2ac814){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);if(_0x3e1007['result']['metadata'][_0x56c4('0x2e')]){_0x373748[_0x56c4('0x2f')]();}else{_0x373748[_0x56c4('0x26')]();}})[_0x56c4('0x22')](function(_0x3f9cc0){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3f9cc0));_0x373748['next']();});})[_0x56c4('0x22')](function(_0x388dee){logger[_0x56c4('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x388dee[_0x56c4('0x29')]);_0x373748[_0x56c4('0x2f')]();});}}catch(_0x3894ba){logger['error'](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3894ba));_0x373748['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index eb7f7d3..be1bc98 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 _0xfb92=['chat','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','then','catch','error','stop','replace','sessionPath','message','length','dialogflowV2','diagnosticInfo','queryResult','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','stack','dialogflow','md5','moment','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','create','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','phone','interaction'];(function(_0x5d0330,_0x1e0803){var _0x20e86c=function(_0x30fe11){while(--_0x30fe11){_0x5d0330['push'](_0x5d0330['shift']());}};_0x20e86c(++_0x1e0803);}(_0xfb92,0x1bf));var _0x2fb9=function(_0x1e9252,_0x5cea39){_0x1e9252=_0x1e9252-0x0;var _0x1e2362=_0xfb92[_0x1e9252];return _0x1e2362;};'use strict';var _=require('lodash');var dialogflow=require(_0x2fb9('0x0'));var md5=require(_0x2fb9('0x1'));var moment=require(_0x2fb9('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x2fb9('0x3'));var utils=require('./utils');var rpc={'chatMessage':require(_0x2fb9('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2fb9('0x5')),'faxMessage':require(_0x2fb9('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x48a057,_0x41c32f,_0xa8031a,_0x24e5d0){return new Promise(function(_0xd3d2a3,_0x101dae){var _0x20a4f7=_[_0x2fb9('0x7')](_0xa8031a);_0x20a4f7[_0x2fb9('0x8')]=_0x24e5d0;return rpc[_0x41c32f+'Message'][_0x2fb9('0x9')](_0x20a4f7)['then'](function(){logger['info'](_0x2fb9('0xa'),_0x48a057,_0x20a4f7['body']);_0xd3d2a3();})['catch'](function(_0x235cdd){logger['error'](_0x2fb9('0xa'),_0x48a057,JSON[_0x2fb9('0xb')](_0x235cdd));_0x101dae(_0x235cdd);});});}exports[_0x2fb9('0xc')]=function(_0x38c2f3,_0x6cbad9){return function(_0xc65c77){try{if(!_[_0x2fb9('0xd')](this['interaction']['UserId'])){logger[_0x2fb9('0xe')](_0x2fb9('0xa'),_0x38c2f3,_0x2fb9('0xf'));return _0xc65c77['next']();}var _0x49f555={'ContactId':this[_0x2fb9('0x10')]['id'],'sentAt':moment()['format'](_0x2fb9('0x11')),'direction':'out'};if(this['channel']===_0x2fb9('0x12')||this[_0x2fb9('0x13')]==='whatsapp'){_0x49f555[_0x2fb9('0x14')]=this[_0x2fb9('0x15')][_0x2fb9('0x14')];}var _0x49ed8e=this[_0x2fb9('0x13')];if(_0x49ed8e===_0x2fb9('0x16')){_0x49f555['ChatWebsiteId']=this[_0x2fb9('0x17')]['id'];}else{_0x49f555[_[_0x2fb9('0x18')](_0x49ed8e)+'AccountId']=this[_0x2fb9('0x17')]['id'];}_0x49f555[_['upperFirst'](_0x49ed8e)+_0x2fb9('0x19')]=this[_0x2fb9('0x15')]['id'];if(this[_0x2fb9('0x15')][_0x2fb9('0x1a')]){var _0x10e31e=_0x6cbad9[0x4];if(!_[_0x2fb9('0x1b')](_0x10e31e)){_0x49f555['body']=utils[_0x2fb9('0x1c')](_0x10e31e,this);return rpc[_0x49ed8e+_0x2fb9('0x1d')]['create'](_0x49f555)[_0x2fb9('0x1e')](function(_0x57321b){logger[_0x2fb9('0xe')](_0x2fb9('0xa'),_0x38c2f3,_0x49f555[_0x2fb9('0x8')]);})[_0x2fb9('0x1f')](function(_0x50af4e){logger[_0x2fb9('0x20')](_0x2fb9('0xa'),_0x38c2f3,JSON[_0x2fb9('0xb')](_0x50af4e));})['finally'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x38c2f3);_0xc65c77[_0x2fb9('0x21')]();});}else{logger[_0x2fb9('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x38c2f3);_0xc65c77[_0x2fb9('0x21')]();}}else{var _0x4e0c27=this;var _0x401d56=_0x6cbad9[0x2][_0x2fb9('0x22')](/\\n/g,'\x0a');var _0xd7e032={'credentials':{'private_key':_0x401d56,'client_email':_0x6cbad9[0x1]}};var _0x2b1ea6=new dialogflow['SessionsClient'](_0xd7e032);var _0x4c21f5=_0x2b1ea6[_0x2fb9('0x23')](_0x6cbad9[0x0],md5(_0x4e0c27[_0x2fb9('0x15')]['id']));var _0x364dc3={'session':_0x4c21f5,'queryInput':{'text':{'text':_0x4e0c27[_0x2fb9('0x24')][_0x2fb9('0x8')],'languageCode':_0x6cbad9[0x3]||'en'}}};return _0x2b1ea6['detectIntent'](_0x364dc3)[_0x2fb9('0x1e')](function(_0x2dd576){if(_0x2dd576&&_0x2dd576[_0x2fb9('0x25')]){_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x26')]=_0x2dd576;var _0x49d35e=_0x2dd576[0x0];var _0x10f84f=_0x49d35e['queryResult'][_0x2fb9('0x27')]&&_0x49d35e[_0x2fb9('0x28')]['diagnosticInfo'][_0x2fb9('0x29')]?_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x27')]['fields']['end_conversation'][_0x2fb9('0x2a')]:![];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x2b')]=_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x2c')];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x2d')]=_0x49d35e['queryResult'][_0x2fb9('0x2e')];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x2f')]=_0x49d35e[_0x2fb9('0x28')]['diagnosticInfo']&&_0x49d35e[_0x2fb9('0x28')]['diagnosticInfo'][_0x2fb9('0x29')]?_0x49d35e[_0x2fb9('0x28')]['diagnosticInfo'][_0x2fb9('0x29')][_0x2fb9('0x30')]['boolValue']:![];_0x4e0c27['body'][_0x2fb9('0x31')]=_0x49d35e['queryResult'][_0x2fb9('0x32')][_0x2fb9('0x33')];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x34')]=_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x32')]['displayName'];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x35')]=_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x32')][_0x2fb9('0x36')];_0x4e0c27['body'][_0x2fb9('0x37')]=_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x38')];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x39')]=_0x49d35e[_0x2fb9('0x28')]['queryText'];_0x4e0c27[_0x2fb9('0x8')][_0x2fb9('0x3a')]=_0x49d35e[_0x2fb9('0x28')][_0x2fb9('0x3b')];_0x49f555[_0x2fb9('0x3c')]=_0x2fb9('0x26');_0x49f555[_0x2fb9('0x3d')]=JSON['stringify'](_0x2dd576);var _0x44e3db=[];for(var _0x4d704c=0x0;_0x4d704c<_0x2dd576[_0x2fb9('0x25')];_0x4d704c++){var _0x24fdee=_0x2dd576[_0x4d704c];if(_0x24fdee&&_0x24fdee[_0x2fb9('0x28')]&&_0x24fdee['queryResult'][_0x2fb9('0x3e')]){_0x44e3db[_0x2fb9('0x3f')](createMessage(_0x38c2f3,_0x49ed8e,_0x49f555,_0x24fdee[_0x2fb9('0x28')][_0x2fb9('0x3e')]));}}return Promise[_0x2fb9('0x40')](_0x44e3db)[_0x2fb9('0x1e')](function(){if(_0x10f84f){_0xc65c77[_0x2fb9('0x41')]();}else{_0xc65c77[_0x2fb9('0x21')]();}})['catch'](function(_0x2da5ae){logger[_0x2fb9('0x20')]('[%s][DIALOGFLOWV2]\x20%s',_0x38c2f3,JSON[_0x2fb9('0xb')](_0x2da5ae));_0xc65c77[_0x2fb9('0x41')]();});}})[_0x2fb9('0x1f')](function(_0x810292){logger['error'](_0x2fb9('0xa'),_0x38c2f3,_0x810292[_0x2fb9('0x24')],_0x810292[_0x2fb9('0x42')]);_0xc65c77[_0x2fb9('0x41')]();});}}catch(_0x396735){logger[_0x2fb9('0x20')](_0x2fb9('0xa'),_0x38c2f3,JSON[_0x2fb9('0xb')](_0x396735));_0xc65c77[_0x2fb9('0x21')]();}};}; \ No newline at end of file +var _0xf771=['isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','stop','message','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','replace','SessionsClient','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT'];(function(_0xd8303e,_0x4ae9af){var _0x2054e5=function(_0x4ab76a){while(--_0x4ab76a){_0xd8303e['push'](_0xd8303e['shift']());}};_0x2054e5(++_0x4ae9af);}(_0xf771,0x1ed));var _0x1f77=function(_0x5d8b46,_0x47b560){_0x5d8b46=_0x5d8b46-0x0;var _0x43808b=_0xf771[_0x5d8b46];return _0x43808b;};'use strict';var _=require(_0x1f77('0x0'));var dialogflow=require(_0x1f77('0x1'));var md5=require(_0x1f77('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x1f77('0x3'))(_0x1f77('0x4'));var utils=require(_0x1f77('0x5'));var rpc={'chatMessage':require(_0x1f77('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1f77('0x7')),'smsMessage':require(_0x1f77('0x8')),'faxMessage':require(_0x1f77('0x9')),'whatsappMessage':require(_0x1f77('0xa'))};function createMessage(_0x15751b,_0x999e6a,_0x56c153,_0x19b64b){return new Promise(function(_0x51c1ec,_0x2bc784){var _0x360616=_[_0x1f77('0xb')](_0x56c153);_0x360616[_0x1f77('0xc')]=_0x19b64b;return rpc[_0x999e6a+'Message'][_0x1f77('0xd')](_0x360616)[_0x1f77('0xe')](function(){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x15751b,_0x360616[_0x1f77('0xc')]);_0x51c1ec();})['catch'](function(_0x249120){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x15751b,JSON[_0x1f77('0x12')](_0x249120));_0x2bc784(_0x249120);});});}exports['consequence']=function(_0x389b34,_0x812171){return function(_0xc820dc){try{if(!_[_0x1f77('0x13')](this[_0x1f77('0x14')]['UserId'])){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x389b34,_0x1f77('0x15'));return _0xc820dc[_0x1f77('0x16')]();}var _0x3c3d83={'ContactId':this[_0x1f77('0x17')]['id'],'sentAt':moment()[_0x1f77('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1f77('0x19')};if(this[_0x1f77('0x1a')]===_0x1f77('0x1b')||this[_0x1f77('0x1a')]===_0x1f77('0x1c')){_0x3c3d83['phone']=this[_0x1f77('0x14')][_0x1f77('0x1d')];}var _0x5795ac=this[_0x1f77('0x1a')];if(_0x5795ac===_0x1f77('0x1e')){_0x3c3d83['ChatWebsiteId']=this[_0x1f77('0x1f')]['id'];}else{_0x3c3d83[_[_0x1f77('0x20')](_0x5795ac)+_0x1f77('0x21')]=this[_0x1f77('0x1f')]['id'];}_0x3c3d83[_['upperFirst'](_0x5795ac)+_0x1f77('0x22')]=this[_0x1f77('0x14')]['id'];if(this[_0x1f77('0x14')][_0x1f77('0x23')]){var _0xd45485=_0x812171[0x4];if(!_[_0x1f77('0x24')](_0xd45485)){_0x3c3d83[_0x1f77('0xc')]=utils[_0x1f77('0x25')](_0xd45485,this);return rpc[_0x5795ac+_0x1f77('0x26')][_0x1f77('0xd')](_0x3c3d83)[_0x1f77('0xe')](function(_0x1fb9ee){logger[_0x1f77('0xf')](_0x1f77('0x10'),_0x389b34,_0x3c3d83[_0x1f77('0xc')]);})[_0x1f77('0x27')](function(_0x2a8648){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,JSON[_0x1f77('0x12')](_0x2a8648));})[_0x1f77('0x28')](function(){logger[_0x1f77('0xf')](_0x1f77('0x29'),_0x389b34);_0xc820dc['stop']();});}else{logger[_0x1f77('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x389b34);_0xc820dc['stop']();}}else{var _0x4b9646=this;var _0x2d7d9b=_0x812171[0x2][_0x1f77('0x2a')](/\\n/g,'\x0a');var _0x1acfe1={'credentials':{'private_key':_0x2d7d9b,'client_email':_0x812171[0x1]}};var _0x4b7b6d=new dialogflow[(_0x1f77('0x2b'))](_0x1acfe1);var _0x55d55a=_0x4b7b6d['sessionPath'](_0x812171[0x0],md5(_0x4b9646[_0x1f77('0x14')]['id']));var _0x5d9c6a={'session':_0x55d55a,'queryInput':{'text':{'text':_0x4b9646['message']['body'],'languageCode':_0x812171[0x3]||'en'}}};return _0x4b7b6d['detectIntent'](_0x5d9c6a)[_0x1f77('0xe')](function(_0x230638){if(_0x230638&&_0x230638[_0x1f77('0x2c')]){_0x4b9646['body'][_0x1f77('0x2d')]=_0x230638;var _0x3bf1d3=_0x230638[0x0];var _0x3eb62b=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')]&&_0x3bf1d3['queryResult'][_0x1f77('0x2f')][_0x1f77('0x30')]?_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')][_0x1f77('0x30')]['end_conversation'][_0x1f77('0x31')]:![];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_ACTION']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x32')];_0x4b9646['body'][_0x1f77('0x33')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x34')];_0x4b9646['body'][_0x1f77('0x35')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')]&&_0x3bf1d3[_0x1f77('0x2e')]['diagnosticInfo'][_0x1f77('0x30')]?_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x2f')][_0x1f77('0x30')][_0x1f77('0x36')][_0x1f77('0x31')]:![];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x37')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x38')]['name'];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x38')][_0x1f77('0x39')];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x3a')]=_0x3bf1d3[_0x1f77('0x2e')]['intent'][_0x1f77('0x3b')];_0x4b9646[_0x1f77('0xc')][_0x1f77('0x3c')]=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x3d')];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_QUERYTEXT']=_0x3bf1d3[_0x1f77('0x2e')]['queryText'];_0x4b9646[_0x1f77('0xc')]['DIALOGFLOWV2_SCORE']=_0x3bf1d3[_0x1f77('0x2e')][_0x1f77('0x3e')];_0x3c3d83['providerName']='dialogflowV2';_0x3c3d83[_0x1f77('0x3f')]=JSON[_0x1f77('0x12')](_0x230638);var _0x4bf975=[];for(var _0x29513a=0x0;_0x29513a<_0x230638[_0x1f77('0x2c')];_0x29513a++){var _0x56132e=_0x230638[_0x29513a];if(_0x56132e&&_0x56132e[_0x1f77('0x2e')]&&_0x56132e[_0x1f77('0x2e')][_0x1f77('0x40')]){_0x4bf975[_0x1f77('0x41')](createMessage(_0x389b34,_0x5795ac,_0x3c3d83,_0x56132e[_0x1f77('0x2e')][_0x1f77('0x40')]));}}return Promise[_0x1f77('0x42')](_0x4bf975)[_0x1f77('0xe')](function(){if(_0x3eb62b){_0xc820dc[_0x1f77('0x16')]();}else{_0xc820dc[_0x1f77('0x43')]();}})[_0x1f77('0x27')](function(_0x2ccfb0){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,JSON['stringify'](_0x2ccfb0));_0xc820dc[_0x1f77('0x16')]();});}})[_0x1f77('0x27')](function(_0x144013){logger[_0x1f77('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x389b34,_0x144013[_0x1f77('0x44')],_0x144013['stack']);_0xc820dc[_0x1f77('0x16')]();});}}catch(_0x59ab42){logger['error'](_0x1f77('0x10'),_0x389b34,JSON[_0x1f77('0x12')](_0x59ab42));_0xc820dc['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index adafc1c..4686db4 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 _0x0ea8=['stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0ea8,0x119));var _0x80ea=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0ea8[_0x4154a6];return _0x3b2786;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x80ea('0x0'));var utils=require(_0x80ea('0x1'));var logger=require(_0x80ea('0x2'))(_0x80ea('0x3'));var gotoif=schema({'condition':{'type':_0x80ea('0x4'),'required':!![],'message':_0x80ea('0x5')},'priorityTrue':{'type':_0x80ea('0x6'),'message':_0x80ea('0x7')},'priorityFalse':{'type':_0x80ea('0x6'),'message':_0x80ea('0x8')}});exports[_0x80ea('0x9')]=function(_0xfeaa13,_0x35c395){return function(_0x25ba15){try{var _0x1d5eae={'condition':htmlToText[_0x80ea('0xa')](utils[_0x80ea('0xb')](_0x35c395[0x0],this),{'wordwrap':![]})[_0x80ea('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x35c395[0x1],'priorityFalse':_0x35c395[0x2]};var _0x3f049a=gotoif['validate'](_0x1d5eae,{'typecast':!![]});if(_0x3f049a[_0x80ea('0xd')]){logger[_0x80ea('0xe')](_0x80ea('0xf'),_0xfeaa13,_[_0x80ea('0x10')](_0x3f049a,_0x80ea('0x11'))[_0x80ea('0x12')](',\x20'));_0x25ba15[_0x80ea('0x13')]();}else{try{var _0x53bd84=eval('('+_0x1d5eae[_0x80ea('0x14')]+')');var _0x2c3835=_0x53bd84?_0x1d5eae[_0x80ea('0x15')]:_0x1d5eae[_0x80ea('0x16')];logger[_0x80ea('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xfeaa13,_0x1d5eae[_0x80ea('0x14')],_0x53bd84,_0x2c3835||'next');if(_0x2c3835){var _0x2e5bd3=_[_0x80ea('0x18')](_0x25ba15[_0x80ea('0x19')](),{'p':_0x2c3835});if(_0x2e5bd3>=0x0){logger['info'](_0x80ea('0x1a'),_0xfeaa13,_0x2c3835||_0x80ea('0x1b'),_0x2e5bd3);_0x25ba15[_0x80ea('0x1b')](_0x2e5bd3);}else{logger[_0x80ea('0x17')](_0x80ea('0x1c'),_0xfeaa13,_0x2c3835||'next');_0x25ba15[_0x80ea('0x13')]();}}else{_0x25ba15[_0x80ea('0x1b')]();}}catch(_0x21804a){logger[_0x80ea('0xe')](_0x80ea('0x1d'),_0xfeaa13,_0x21804a[_0x80ea('0x11')]);_0x25ba15[_0x80ea('0x13')]();}}}catch(_0x58724d){logger['error'](_0x80ea('0xf'),_0xfeaa13,JSON['stringify'](_0x58724d));_0x25ba15['stop']();}};}; \ No newline at end of file +var _0x763e=['consequence','fromString','getMustacheRender','replace','length','error','map','message','join','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','string','number'];(function(_0x5071f8,_0x24ac1d){var _0x59feff=function(_0x53c6e0){while(--_0x53c6e0){_0x5071f8['push'](_0x5071f8['shift']());}};_0x59feff(++_0x24ac1d);}(_0x763e,0x67));var _0xe763=function(_0x1c1f57,_0x4f8f7b){_0x1c1f57=_0x1c1f57-0x0;var _0x2cd7a4=_0x763e[_0x1c1f57];return _0x2cd7a4;};'use strict';var schema=require(_0xe763('0x0'));var _=require('lodash');var htmlToText=require(_0xe763('0x1'));var utils=require(_0xe763('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xe763('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xe763('0x4'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe763('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xe763('0x5')]=function(_0x9d5554,_0x1f2f62){return function(_0x2a69b6){try{var _0x534d07={'condition':htmlToText[_0xe763('0x6')](utils[_0xe763('0x7')](_0x1f2f62[0x0],this),{'wordwrap':![]})[_0xe763('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1f2f62[0x1],'priorityFalse':_0x1f2f62[0x2]};var _0x75df9=gotoif[_0xe763('0x0')](_0x534d07,{'typecast':!![]});if(_0x75df9[_0xe763('0x9')]){logger[_0xe763('0xa')]('[%s][GOTOIF]\x20%s',_0x9d5554,_[_0xe763('0xb')](_0x75df9,_0xe763('0xc'))[_0xe763('0xd')](',\x20'));_0x2a69b6['stop']();}else{try{var _0x5a53eb=eval('('+_0x534d07[_0xe763('0xe')]+')');var _0x46ace5=_0x5a53eb?_0x534d07['priorityTrue']:_0x534d07[_0xe763('0xf')];logger['info'](_0xe763('0x10'),_0x9d5554,_0x534d07[_0xe763('0xe')],_0x5a53eb,_0x46ace5||'next');if(_0x46ace5){var _0x1090e5=_[_0xe763('0x11')](_0x2a69b6[_0xe763('0x12')](),{'p':_0x46ace5});if(_0x1090e5>=0x0){logger[_0xe763('0x13')](_0xe763('0x14'),_0x9d5554,_0x46ace5||_0xe763('0x15'),_0x1090e5);_0x2a69b6[_0xe763('0x15')](_0x1090e5);}else{logger[_0xe763('0x13')](_0xe763('0x16'),_0x9d5554,_0x46ace5||'next');_0x2a69b6[_0xe763('0x17')]();}}else{_0x2a69b6[_0xe763('0x15')]();}}catch(_0x2de120){logger[_0xe763('0xa')](_0xe763('0x18'),_0x9d5554,_0x2de120[_0xe763('0xc')]);_0x2a69b6[_0xe763('0x17')]();}}}catch(_0x48d1d8){logger['error'](_0xe763('0x19'),_0x9d5554,JSON[_0xe763('0x1a')](_0x48d1d8));_0x2a69b6[_0xe763('0x17')]();}};}; \ 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 e1b5ef4..b87fb1e 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 _0x0156=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x9ac5d9,_0xae4a36){var _0x4b2e43=function(_0x7272db){while(--_0x7272db){_0x9ac5d9['push'](_0x9ac5d9['shift']());}};_0x4b2e43(++_0xae4a36);}(_0x0156,0x1bf));var _0x6015=function(_0xc31a9c,_0x15bc44){_0xc31a9c=_0xc31a9c-0x0;var _0x43aa8b=_0x0156[_0xc31a9c];return _0x43aa8b;};'use strict';var schema=require(_0x6015('0x0'));var _=require(_0x6015('0x1'));var logger=require(_0x6015('0x2'))(_0x6015('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x6015('0x4')}});exports[_0x6015('0x5')]=function(_0x2f4430,_0x3f0e08){return function(_0x5e908b){try{var _0x22a341={'priority':_0x3f0e08[0x0]};var _0x4b078f=gotop['validate'](_0x22a341,{'typecast':!![]});if(_0x4b078f[_0x6015('0x6')]){logger[_0x6015('0x7')](_0x6015('0x8'),_0x2f4430,_[_0x6015('0x9')](_0x4b078f,'message')[_0x6015('0xa')](',\x20'));_0x5e908b[_0x6015('0xb')]();}else{logger[_0x6015('0xc')](_0x6015('0xd'),_0x2f4430,_0x22a341['priority']);if(_0x22a341[_0x6015('0xe')]){var _0x1de0f4=_[_0x6015('0xf')](_0x5e908b[_0x6015('0x10')](),{'p':_0x22a341['priority']});if(_0x1de0f4>=0x0){logger[_0x6015('0xc')](_0x6015('0x11'),_0x2f4430,_0x22a341[_0x6015('0xe')]||'next',_0x1de0f4);_0x5e908b[_0x6015('0x12')](_0x1de0f4);}else{logger[_0x6015('0xc')](_0x6015('0x13'),_0x2f4430,_0x22a341[_0x6015('0xe')]||'next');_0x5e908b['stop']();}}else{_0x5e908b[_0x6015('0x12')]();}}}catch(_0xf4a881){logger[_0x6015('0x7')](_0x6015('0x8'),_0x2f4430,JSON[_0x6015('0x14')](_0xf4a881));_0x5e908b['stop']();}};}; \ No newline at end of file +var _0x5b74=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x4648ad,_0x21e389){var _0x504c94=function(_0x5078fa){while(--_0x5078fa){_0x4648ad['push'](_0x4648ad['shift']());}};_0x504c94(++_0x21e389);}(_0x5b74,0x1a4));var _0x45b7=function(_0x39d330,_0x462470){_0x39d330=_0x39d330-0x0;var _0x23b39e=_0x5b74[_0x39d330];return _0x23b39e;};'use strict';var schema=require(_0x45b7('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x45b7('0x1'));var gotop=schema({'priority':{'type':_0x45b7('0x2'),'required':!![],'message':_0x45b7('0x3')}});exports['consequence']=function(_0xf6f4ec,_0x515022){return function(_0x5ebc8f){try{var _0xcad2db={'priority':_0x515022[0x0]};var _0x4ad3c5=gotop[_0x45b7('0x0')](_0xcad2db,{'typecast':!![]});if(_0x4ad3c5['length']){logger[_0x45b7('0x4')](_0x45b7('0x5'),_0xf6f4ec,_[_0x45b7('0x6')](_0x4ad3c5,_0x45b7('0x7'))[_0x45b7('0x8')](',\x20'));_0x5ebc8f['stop']();}else{logger[_0x45b7('0x9')](_0x45b7('0xa'),_0xf6f4ec,_0xcad2db[_0x45b7('0xb')]);if(_0xcad2db[_0x45b7('0xb')]){var _0x242483=_['findIndex'](_0x5ebc8f[_0x45b7('0xc')](),{'p':_0xcad2db[_0x45b7('0xb')]});if(_0x242483>=0x0){logger['info'](_0x45b7('0xd'),_0xf6f4ec,_0xcad2db[_0x45b7('0xb')]||_0x45b7('0xe'),_0x242483);_0x5ebc8f[_0x45b7('0xe')](_0x242483);}else{logger[_0x45b7('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xf6f4ec,_0xcad2db['priority']||'next');_0x5ebc8f[_0x45b7('0xf')]();}}else{_0x5ebc8f[_0x45b7('0xe')]();}}}catch(_0xef2528){logger['error'](_0x45b7('0x5'),_0xf6f4ec,JSON['stringify'](_0xef2528));_0x5ebc8f[_0x45b7('0xf')]();}};}; \ 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 bbee14b..b2d13b5 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 _0xf60a=['upperFirst','account','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','ChatWebsiteId'];(function(_0x4737a0,_0x36520e){var _0x4d558b=function(_0xaa9825){while(--_0xaa9825){_0x4737a0['push'](_0x4737a0['shift']());}};_0x4d558b(++_0x36520e);}(_0xf60a,0x166));var _0xaf60=function(_0x4dd5a3,_0x50e260){_0x4dd5a3=_0x4dd5a3-0x0;var _0x53f20d=_0xf60a[_0x4dd5a3];return _0x53f20d;};'use strict';var _=require('lodash');var utils=require(_0xaf60('0x0'));var logger=require(_0xaf60('0x1'))(_0xaf60('0x2'));var rpc={'chatMessage':require(_0xaf60('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaf60('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaf60('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x13b79e,_0xe86bc8){return function(_0x2bc380){try{var _0x10f7ad={'body':utils[_0xaf60('0x6')](_0xe86bc8[0x0],this),'ContactId':this[_0xaf60('0x7')]['id']};if(this[_0xaf60('0x8')]==='chat'){_0x10f7ad[_0xaf60('0x9')]=this['account']['id'];}else{_0x10f7ad[_[_0xaf60('0xa')](this[_0xaf60('0x8')])+'AccountId']=this[_0xaf60('0xb')]['id'];}_0x10f7ad[_['upperFirst'](this['channel'])+'InteractionId']=this[_0xaf60('0xc')]['id'];if(rpc[this[_0xaf60('0x8')]+_0xaf60('0xd')]){return rpc[this[_0xaf60('0x8')]+_0xaf60('0xd')][_0xaf60('0xe')](_0x10f7ad)[_0xaf60('0xf')](function(_0x8e7e62){logger[_0xaf60('0x10')](_0xaf60('0x11'),_0x13b79e,_0x10f7ad['body']);_0x2bc380[_0xaf60('0x12')]();})[_0xaf60('0x13')](function(_0x969b08){logger['error']('[%s][MESSAGE]\x20%s',_0x13b79e,JSON[_0xaf60('0x14')](_0x969b08));_0x2bc380[_0xaf60('0x15')]();});}}catch(_0x4687f4){logger[_0xaf60('0x16')](_0xaf60('0x11'),_0x13b79e,JSON[_0xaf60('0x14')](_0x4687f4));_0x2bc380[_0xaf60('0x15')]();}};}; \ No newline at end of file +var _0xfac9=['Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stop','lodash','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','ChatWebsiteId','account','upperFirst','channel','InteractionId','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfac9,0x1d0));var _0x9fac=function(_0x872e27,_0x5c0eaa){_0x872e27=_0x872e27-0x0;var _0x4a7db7=_0xfac9[_0x872e27];return _0x4a7db7;};'use strict';var _=require(_0x9fac('0x0'));var utils=require('./utils');var logger=require(_0x9fac('0x1'))(_0x9fac('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9fac('0x3')),'mailMessage':require(_0x9fac('0x4')),'smsMessage':require(_0x9fac('0x5')),'faxMessage':require(_0x9fac('0x6')),'whatsappMessage':require(_0x9fac('0x7'))};exports[_0x9fac('0x8')]=function(_0x2229b4,_0x437b69){return function(_0x170fa6){try{var _0x30c675={'body':utils[_0x9fac('0x9')](_0x437b69[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x30c675[_0x9fac('0xa')]=this[_0x9fac('0xb')]['id'];}else{_0x30c675[_[_0x9fac('0xc')](this[_0x9fac('0xd')])+'AccountId']=this[_0x9fac('0xb')]['id'];}_0x30c675[_[_0x9fac('0xc')](this[_0x9fac('0xd')])+_0x9fac('0xe')]=this[_0x9fac('0xf')]['id'];if(rpc[this['channel']+_0x9fac('0x10')]){return rpc[this[_0x9fac('0xd')]+_0x9fac('0x10')][_0x9fac('0x11')](_0x30c675)[_0x9fac('0x12')](function(_0x514912){logger['info'](_0x9fac('0x13'),_0x2229b4,_0x30c675[_0x9fac('0x14')]);_0x170fa6[_0x9fac('0x15')]();})['catch'](function(_0x56eb73){logger[_0x9fac('0x16')]('[%s][MESSAGE]\x20%s',_0x2229b4,JSON['stringify'](_0x56eb73));_0x170fa6[_0x9fac('0x17')]();});}}catch(_0x44d24e){logger[_0x9fac('0x16')](_0x9fac('0x13'),_0x2229b4,JSON['stringify'](_0x44d24e));_0x170fa6[_0x9fac('0x17')]();}};}; \ 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 aa58ac3..ec09f01 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 _0x6916=['getMustacheRender','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x240437,_0x56e81b){var _0x31fae5=function(_0x449a57){while(--_0x449a57){_0x240437['push'](_0x240437['shift']());}};_0x31fae5(++_0x56e81b);}(_0x6916,0x1bb));var _0x6691=function(_0x208130,_0xf0e34e){_0x208130=_0x208130-0x0;var _0x3aaa4e=_0x6916[_0x208130];return _0x3aaa4e;};'use strict';var utils=require('./utils');var logger=require(_0x6691('0x0'))(_0x6691('0x1'));exports[_0x6691('0x2')]=function(_0x5dda90,_0x4cf519){return function(_0x5c6e7b){try{logger[_0x6691('0x3')](_0x6691('0x4'),_0x5dda90,utils[_0x6691('0x5')](_0x4cf519[0x0],this));_0x5c6e7b['next']();}catch(_0x408d69){logger['error']('[%s][NOOP]\x20%s',_0x5dda90,JSON[_0x6691('0x6')](_0x408d69));_0x5c6e7b[_0x6691('0x7')]();}};}; \ No newline at end of file +var _0x8205=['next','error','stop','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x8205,0x12f));var _0x5820=function(_0x32e2c6,_0x285891){_0x32e2c6=_0x32e2c6-0x0;var _0x5c203f=_0x8205[_0x32e2c6];return _0x5c203f;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5820('0x0'));exports[_0x5820('0x1')]=function(_0x596947,_0x1b9b46){return function(_0x1bfdb7){try{logger['info'](_0x5820('0x2'),_0x596947,utils['getMustacheRender'](_0x1b9b46[0x0],this));_0x1bfdb7[_0x5820('0x3')]();}catch(_0x248f63){logger[_0x5820('0x4')]('[%s][NOOP]\x20%s',_0x596947,JSON['stringify'](_0x248f63));_0x1bfdb7[_0x5820('0x5')]();}};}; \ 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 f42280c..2cfe306 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 _0xa846=['strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','joinAt','clone','queue_id','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','QueueId','upperFirst','channel','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','then','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa846,0x18a));var _0x6a84=function(_0x2f4767,_0x4f317b){_0x2f4767=_0x2f4767-0x0;var _0x3d8aae=_0xa846[_0x2f4767];return _0x3d8aae;};'use strict';var schema=require('validate');var _=require(_0x6a84('0x0'));var util=require(_0x6a84('0x1'));var seqqueue=require(_0x6a84('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6a84('0x3'));var logger=require(_0x6a84('0x4'))(_0x6a84('0x5'));var strategy=require(_0x6a84('0x6'));config[_0x6a84('0x7')]=_[_0x6a84('0x8')](config[_0x6a84('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6a84('0x9'))(new Redis(config[_0x6a84('0x7')]));var attributes=['id','queue_id',_0x6a84('0xa'),_0x6a84('0xb'),'from',_0x6a84('0xc')];function emit(_0x4c752b,_0x55f147,_0x6cd601){io['to'](_0x4c752b)['emit'](_0x55f147,_0x6cd601);}function emitChannelQueueInteraction(_0x18bfbe,_0x330a32,_0xa8c3f1,_0x484440,_0x3741f3,_0x30bd6d,_0x3b6a7e,_0x14afb2){var _0x4724c6=_[_0x6a84('0xd')](_0xa8c3f1);_0x4724c6[_0x6a84('0xe')]=_0x14afb2;_0x4724c6[_0x6a84('0xb')]=_0x330a32;_0x4724c6[_0x6a84('0xa')]=_0x484440;_0x4724c6['id']=_0x3741f3;if(_0x30bd6d){attributes['push'](_['capitalize'](_0x18bfbe)+_0x6a84('0xf'));_0x3b6a7e[util[_0x6a84('0x10')](_0x6a84('0x11'),_0x18bfbe)][_0x3741f3]=_[_0x6a84('0x12')](_0x4724c6,attributes);}else{delete _0x3b6a7e[util[_0x6a84('0x10')]('%sQueuesWaitingInteractions',_0x18bfbe)][_0x3741f3];}emit(util[_0x6a84('0x10')](_0x6a84('0x13'),_0x18bfbe,_0x330a32),util[_0x6a84('0x10')](_0x6a84('0x14'),_0x18bfbe,_0x30bd6d?_0x6a84('0x15'):_0x6a84('0x16')),_[_0x6a84('0x12')](_0x4724c6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6a84('0x17')),'chatQueueReport':require(_0x6a84('0x18')),'smsQueueReport':require(_0x6a84('0x19')),'faxQueueReport':require(_0x6a84('0x1a')),'whatsappQueueReport':require(_0x6a84('0x1b')),'chatInteraction':require(_0x6a84('0x1c')),'faxInteraction':require(_0x6a84('0x1d')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6a84('0x1e')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x6a84('0x1f'),'required':!![],'message':_0x6a84('0x20')},'timeout':{'type':_0x6a84('0x21'),'message':_0x6a84('0x22')}});function startRouting(_0x5eec64,_0x1f45a7,_0x31aeba,_0x3bfdfb){if(_0x5eec64&&_0x1f45a7&&_0x31aeba){_0x1f45a7[_0x6a84('0x23')]+=0x1;var _0x4c86db={'uniqueid':_0x5eec64,'from':_0x31aeba['body']?_0x31aeba[_0x6a84('0x24')]['from']:'','joinAt':moment()[_0x6a84('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31aeba[_0x6a84('0x25')]?_0x31aeba['contact']['id']:null,'ListId':_0x31aeba[_0x6a84('0x26')]?_0x31aeba['list']['id']:null};_0x4c86db[_['upperFirst'](_0x31aeba['channel'])+_0x6a84('0x27')]=_0x1f45a7['id']||null;_0x4c86db[_[_0x6a84('0x28')](_0x31aeba[_0x6a84('0x29')])+_0x6a84('0xf')]=_0x31aeba[_0x6a84('0x2a')]?_0x31aeba[_0x6a84('0x2a')]['id']:null;_0x4c86db[_[_0x6a84('0x28')](_0x31aeba[_0x6a84('0x29')])+'MessageId']=_0x31aeba[_0x6a84('0x2b')]?_0x31aeba[_0x6a84('0x2b')]['id']:null;_0x4c86db[_[_0x6a84('0x28')](_0x31aeba[_0x6a84('0x29')])+(_0x31aeba[_0x6a84('0x29')]!=='chat'?_0x6a84('0x2c'):'WebsiteId')]=_0x31aeba[_0x6a84('0xa')]?_0x31aeba[_0x6a84('0xa')]['id']:null;logger[_0x6a84('0x2d')](util[_0x6a84('0x10')](_0x6a84('0x2e'),_0x5eec64,_0x1f45a7[_0x6a84('0x2f')]));emitChannelQueueInteraction(_0x31aeba[_0x6a84('0x29')],_0x1f45a7[_0x6a84('0x2f')],_0x4c86db,_0x31aeba[_0x6a84('0xa')][_0x6a84('0x2f')],_0x31aeba['message']['id'],!![],_0x3bfdfb,_0x1f45a7['id']);if(rpc[_0x31aeba[_0x6a84('0x29')]+_0x6a84('0x30')]){return rpc[_0x31aeba[_0x6a84('0x29')]+_0x6a84('0x30')][_0x6a84('0x31')](_0x4c86db)[_0x6a84('0x32')](function(_0x765a25){logger[_0x6a84('0x33')](_0x6a84('0x34'),_0x765a25);});}}}function stopRouting(_0x8859e5,_0x22d655,_0x411a34,_0x24ce3f){if(_0x8859e5&&_0x22d655){_0x22d655[_0x6a84('0x23')]-=0x1;var _0x33ee75={'leaveAt':moment()[_0x6a84('0x10')](_0x6a84('0x35')),'acceptAt':moment()[_0x6a84('0x10')](_0x6a84('0x35')),'reason':_0x6a84('0x36')};logger[_0x6a84('0x2d')](util[_0x6a84('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x8859e5,_0x22d655[_0x6a84('0x2f')]));emitChannelQueueInteraction(_0x411a34[_0x6a84('0x29')],_0x22d655[_0x6a84('0x2f')],_0x411a34[_0x6a84('0x24')],_0x411a34['account'][_0x6a84('0x2f')],_0x411a34['message']['id'],![],_0x24ce3f,_0x22d655['id']);return rpc[_0x411a34['channel']+_0x6a84('0x37')][_0x6a84('0x38')](_0x411a34['interaction']['id'],{'queueId':_0x22d655['id']})[_0x6a84('0x39')](function(){if(rpc[_0x411a34[_0x6a84('0x29')]+'QueueReport']){return rpc[_0x411a34[_0x6a84('0x29')]+_0x6a84('0x30')]['update'](_0x8859e5,_0x33ee75)[_0x6a84('0x32')](function(_0xa4e474){logger['error']('update\x20queue\x20report',_0xa4e474);});}});}}function endRouting(_0x3e79b2,_0x5cb0a6,_0x3dbda8,_0x5bcd15){if(_0x3e79b2&&_0x5cb0a6){_0x5cb0a6[_0x6a84('0x23')]-=0x1;var _0x41fb64={'leaveAt':moment()[_0x6a84('0x10')](_0x6a84('0x35')),'exitAt':moment()['format'](_0x6a84('0x35')),'reason':_0x6a84('0x3a')};logger[_0x6a84('0x2d')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3e79b2,_0x5cb0a6[_0x6a84('0x2f')]));emitChannelQueueInteraction(_0x3dbda8[_0x6a84('0x29')],_0x5cb0a6[_0x6a84('0x2f')],_0x3dbda8[_0x6a84('0x24')],_0x3dbda8[_0x6a84('0xa')][_0x6a84('0x2f')],_0x3dbda8[_0x6a84('0x2b')]['id'],![],_0x5bcd15);if(rpc[_0x3dbda8['channel']+_0x6a84('0x30')]){return rpc[_0x3dbda8['channel']+_0x6a84('0x30')][_0x6a84('0x38')](_0x3e79b2,_0x41fb64)['catch'](function(_0x283561){logger[_0x6a84('0x33')]('update\x20queue\x20report',_0x283561);});}}}function handleFindQueue(_0xe47105){return function(_0x32712b){return _0x32712b[_0x6a84('0x2f')][_0x6a84('0x3b')]()===_0xe47105[_0x6a84('0x3b')]();};}exports[_0x6a84('0x3c')]=function(_0x3a296a,_0x577140,_0x4cfff5,_0x2dc1e2){return function(_0x2d5247){try{var _0x3a2f97={'name':_0x577140[0x0],'timeout':_0x577140[0x1]};var _0x2f2c74=queue['validate'](_0x3a2f97,{'typecast':!![]});if(_0x2f2c74['length']){logger[_0x6a84('0x33')](_0x6a84('0x3d'),_0x3a296a,_[_0x6a84('0x3e')](_0x2f2c74,_0x6a84('0x2b'))[_0x6a84('0x3f')](',\x20'));_0x2d5247[_0x6a84('0x40')]();}else{var _0x423116=_['find'](_0x4cfff5[_0x2dc1e2[_0x6a84('0x29')]+_0x6a84('0x41')],handleFindQueue(_0x3a2f97['name']));if(_0x423116){startRouting(_0x3a296a,_0x423116,_0x2dc1e2,_0x4cfff5);var _0x538614=(_0x423116['timeout']||0xa)*0x3e8;var _0xb497a4=(_0x3a2f97[_0x6a84('0x3a')]||0x14)*0x3e8;var _0x264e75;if(_0x538614>_0xb497a4){_0xb497a4=_0x538614;}var _0x16e372=seqqueue[_0x6a84('0x42')](_0x538614);_0x16e372['id']=_0x3a296a;_0x16e372['atimeout']=_0x538614;_0x16e372[_0x6a84('0x43')]=_0xb497a4;_0x16e372[_0x6a84('0x29')]=_0x2dc1e2[_0x6a84('0x29')];_0x4cfff5[_0x6a84('0x44')][_0x3a296a]['on'](_0x6a84('0x45'),function(){logger[_0x6a84('0x2d')](_0x6a84('0x46'),_0x3a296a);stopRouting(_0x3a296a,_0x423116,_0x2dc1e2,_0x4cfff5);clearTimeout(_0x264e75);_0x264e75=undefined;_0x16e372[_0x6a84('0x47')](!![]);if(_0x4cfff5[_0x6a84('0x44')][_0x3a296a]){delete _0x4cfff5[_0x6a84('0x44')][_0x3a296a];}_0x2d5247[_0x6a84('0x40')]();});_0x4cfff5[_0x6a84('0x44')][_0x3a296a]['on'](_0x6a84('0x48'),function(){if(_0x4cfff5[_0x6a84('0x44')][_0x3a296a]){delete _0x4cfff5[_0x6a84('0x44')][_0x3a296a];}});_0x264e75=setTimeout(function(){logger[_0x6a84('0x2d')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3a296a);endRouting(_0x3a296a,_0x423116,_0x2dc1e2,_0x4cfff5);clearTimeout(_0x264e75);_0x16e372['close'](!![]);_0x2d5247[_0x6a84('0x49')]();},_0xb497a4);switch(_0x423116[_0x6a84('0x4a')]){case'rrmemory':strategy[_0x6a84('0x4b')](_0x16e372,_0x423116,_0x4cfff5,_0x2dc1e2);break;default:strategy['beepall'](_0x16e372,_0x423116,_0x4cfff5,_0x2dc1e2);}}else{logger[_0x6a84('0x33')](_0x6a84('0x4c'),_0x3a296a,_0x3a2f97[_0x6a84('0x2f')]);_0x2d5247[_0x6a84('0x40')]();}}}catch(_0x9df22f){logger[_0x6a84('0x33')]('[%s][QUEUE]\x20%s',_0x3a296a,_0x9df22f[_0x6a84('0x4d')]);_0x2d5247['stop']();}};}; \ No newline at end of file +var _0x4200=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','from','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','clone','account','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4200,0x188));var _0x0420=function(_0x2d1b36,_0x5ce609){_0x2d1b36=_0x2d1b36-0x0;var _0x3f6b14=_0x4200[_0x2d1b36];return _0x3f6b14;};'use strict';var schema=require(_0x0420('0x0'));var _=require(_0x0420('0x1'));var util=require(_0x0420('0x2'));var seqqueue=require(_0x0420('0x3'));var moment=require(_0x0420('0x4'));var Redis=require(_0x0420('0x5'));var config=require(_0x0420('0x6'));var logger=require(_0x0420('0x7'))(_0x0420('0x8'));var strategy=require('./strategy');config[_0x0420('0x9')]=_[_0x0420('0xa')](config[_0x0420('0x9')],{'host':_0x0420('0xb'),'port':0x18eb});var io=require(_0x0420('0xc'))(new Redis(config['redis']));var attributes=['id',_0x0420('0xd'),'account',_0x0420('0xe'),'from',_0x0420('0xf')];function emit(_0x192b70,_0x50eb31,_0xd82ab3){io['to'](_0x192b70)['emit'](_0x50eb31,_0xd82ab3);}function emitChannelQueueInteraction(_0x4b3904,_0x27bf8b,_0x474842,_0x45cec6,_0x5a88d4,_0x4b43dc,_0x12609e,_0x12c730){var _0x18cd48=_[_0x0420('0x10')](_0x474842);_0x18cd48[_0x0420('0xd')]=_0x12c730;_0x18cd48[_0x0420('0xe')]=_0x27bf8b;_0x18cd48[_0x0420('0x11')]=_0x45cec6;_0x18cd48['id']=_0x5a88d4;if(_0x4b43dc){attributes[_0x0420('0x12')](_[_0x0420('0x13')](_0x4b3904)+'InteractionId');_0x12609e[util[_0x0420('0x14')](_0x0420('0x15'),_0x4b3904)][_0x5a88d4]=_[_0x0420('0x16')](_0x18cd48,attributes);}else{delete _0x12609e[util[_0x0420('0x14')]('%sQueuesWaitingInteractions',_0x4b3904)][_0x5a88d4];}emit(util[_0x0420('0x14')](_0x0420('0x17'),_0x4b3904,_0x27bf8b),util[_0x0420('0x14')](_0x0420('0x18'),_0x4b3904,_0x4b43dc?_0x0420('0x19'):_0x0420('0x1a')),_['pick'](_0x18cd48,attributes));}var rpc={'openchannelQueueReport':require(_0x0420('0x1b')),'mailQueueReport':require(_0x0420('0x1c')),'chatQueueReport':require(_0x0420('0x1d')),'smsQueueReport':require(_0x0420('0x1e')),'faxQueueReport':require(_0x0420('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0420('0x20')),'faxInteraction':require(_0x0420('0x21')),'mailInteraction':require(_0x0420('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0420('0x23')),'whatsappInteraction':require(_0x0420('0x24'))};var queue=schema({'name':{'type':_0x0420('0x25'),'required':!![],'message':_0x0420('0x26')},'timeout':{'type':_0x0420('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2e05b6,_0x4c75dd,_0x49a230,_0x4c4c51){if(_0x2e05b6&&_0x4c75dd&&_0x49a230){_0x4c75dd[_0x0420('0x28')]+=0x1;var _0x19c9f4={'uniqueid':_0x2e05b6,'from':_0x49a230[_0x0420('0x29')]?_0x49a230[_0x0420('0x29')][_0x0420('0x2a')]:'','joinAt':moment()[_0x0420('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x49a230['contact']?_0x49a230[_0x0420('0x2b')]['id']:null,'ListId':_0x49a230[_0x0420('0x2c')]?_0x49a230['list']['id']:null};_0x19c9f4[_['upperFirst'](_0x49a230['channel'])+'QueueId']=_0x4c75dd['id']||null;_0x19c9f4[_[_0x0420('0x2d')](_0x49a230[_0x0420('0x2e')])+_0x0420('0x2f')]=_0x49a230[_0x0420('0x30')]?_0x49a230[_0x0420('0x30')]['id']:null;_0x19c9f4[_['upperFirst'](_0x49a230['channel'])+_0x0420('0x31')]=_0x49a230[_0x0420('0x32')]?_0x49a230[_0x0420('0x32')]['id']:null;_0x19c9f4[_[_0x0420('0x2d')](_0x49a230[_0x0420('0x2e')])+(_0x49a230[_0x0420('0x2e')]!==_0x0420('0x33')?_0x0420('0x34'):_0x0420('0x35'))]=_0x49a230[_0x0420('0x11')]?_0x49a230[_0x0420('0x11')]['id']:null;logger[_0x0420('0x36')](util[_0x0420('0x14')](_0x0420('0x37'),_0x2e05b6,_0x4c75dd[_0x0420('0x38')]));emitChannelQueueInteraction(_0x49a230[_0x0420('0x2e')],_0x4c75dd[_0x0420('0x38')],_0x19c9f4,_0x49a230['account']['name'],_0x49a230[_0x0420('0x32')]['id'],!![],_0x4c4c51,_0x4c75dd['id']);if(rpc[_0x49a230[_0x0420('0x2e')]+_0x0420('0x39')]){return rpc[_0x49a230[_0x0420('0x2e')]+_0x0420('0x39')]['create'](_0x19c9f4)[_0x0420('0x3a')](function(_0x309298){logger['error'](_0x0420('0x3b'),_0x309298);});}}}function stopRouting(_0x43992c,_0x57fbbb,_0x46b030,_0x13e8a1){if(_0x43992c&&_0x57fbbb){_0x57fbbb['waiting']-=0x1;var _0x111e44={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x0420('0x14')](_0x0420('0x3c')),'reason':_0x0420('0x3d')};logger[_0x0420('0x36')](util[_0x0420('0x14')](_0x0420('0x3e'),_0x43992c,_0x57fbbb['name']));emitChannelQueueInteraction(_0x46b030[_0x0420('0x2e')],_0x57fbbb[_0x0420('0x38')],_0x46b030[_0x0420('0x29')],_0x46b030['account'][_0x0420('0x38')],_0x46b030[_0x0420('0x32')]['id'],![],_0x13e8a1,_0x57fbbb['id']);return rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x3f')]['update'](_0x46b030[_0x0420('0x30')]['id'],{'queueId':_0x57fbbb['id']})['then'](function(){if(rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x39')]){return rpc[_0x46b030[_0x0420('0x2e')]+_0x0420('0x39')][_0x0420('0x40')](_0x43992c,_0x111e44)[_0x0420('0x3a')](function(_0x3a3b54){logger['error']('update\x20queue\x20report',_0x3a3b54);});}});}}function endRouting(_0x2a8b06,_0x36294c,_0x2cfa78,_0x412fcf){if(_0x2a8b06&&_0x36294c){_0x36294c[_0x0420('0x28')]-=0x1;var _0x13ba3b={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0420('0x14')](_0x0420('0x3c')),'reason':_0x0420('0x41')};logger[_0x0420('0x36')](util[_0x0420('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x2a8b06,_0x36294c[_0x0420('0x38')]));emitChannelQueueInteraction(_0x2cfa78['channel'],_0x36294c['name'],_0x2cfa78[_0x0420('0x29')],_0x2cfa78[_0x0420('0x11')][_0x0420('0x38')],_0x2cfa78[_0x0420('0x32')]['id'],![],_0x412fcf);if(rpc[_0x2cfa78[_0x0420('0x2e')]+'QueueReport']){return rpc[_0x2cfa78[_0x0420('0x2e')]+_0x0420('0x39')][_0x0420('0x40')](_0x2a8b06,_0x13ba3b)[_0x0420('0x3a')](function(_0x62641e){logger[_0x0420('0x42')]('update\x20queue\x20report',_0x62641e);});}}}function handleFindQueue(_0x5d3554){return function(_0x3a32fd){return _0x3a32fd['name'][_0x0420('0x43')]()===_0x5d3554[_0x0420('0x43')]();};}exports[_0x0420('0x44')]=function(_0x4a65e5,_0xc7129c,_0x435487,_0x19dff9){return function(_0x1c5669){try{var _0x367dea={'name':_0xc7129c[0x0],'timeout':_0xc7129c[0x1]};var _0x41fa58=queue['validate'](_0x367dea,{'typecast':!![]});if(_0x41fa58[_0x0420('0x45')]){logger[_0x0420('0x42')](_0x0420('0x46'),_0x4a65e5,_[_0x0420('0x47')](_0x41fa58,'message')[_0x0420('0x48')](',\x20'));_0x1c5669[_0x0420('0x49')]();}else{var _0x19783e=_[_0x0420('0x4a')](_0x435487[_0x19dff9[_0x0420('0x2e')]+_0x0420('0x4b')],handleFindQueue(_0x367dea[_0x0420('0x38')]));if(_0x19783e){startRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);var _0x32e1aa=(_0x19783e[_0x0420('0x41')]||0xa)*0x3e8;var _0x516e0d=(_0x367dea[_0x0420('0x41')]||0x14)*0x3e8;var _0x4d6431;if(_0x32e1aa>_0x516e0d){_0x516e0d=_0x32e1aa;}var _0x425e50=seqqueue['createQueue'](_0x32e1aa);_0x425e50['id']=_0x4a65e5;_0x425e50[_0x0420('0x4c')]=_0x32e1aa;_0x425e50[_0x0420('0x4d')]=_0x516e0d;_0x425e50[_0x0420('0x2e')]=_0x19dff9[_0x0420('0x2e')];_0x435487[_0x0420('0x4e')][_0x4a65e5]['on']('end',function(){logger[_0x0420('0x36')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4a65e5);stopRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);clearTimeout(_0x4d6431);_0x4d6431=undefined;_0x425e50[_0x0420('0x4f')](!![]);if(_0x435487['rules'][_0x4a65e5]){delete _0x435487[_0x0420('0x4e')][_0x4a65e5];}_0x1c5669[_0x0420('0x49')]();});_0x435487['rules'][_0x4a65e5]['on']('complete',function(){if(_0x435487[_0x0420('0x4e')][_0x4a65e5]){delete _0x435487['rules'][_0x4a65e5];}});_0x4d6431=setTimeout(function(){logger[_0x0420('0x36')](_0x0420('0x50'),_0x4a65e5);endRouting(_0x4a65e5,_0x19783e,_0x19dff9,_0x435487);clearTimeout(_0x4d6431);_0x425e50['close'](!![]);_0x1c5669[_0x0420('0x51')]();},_0x516e0d);switch(_0x19783e[_0x0420('0x52')]){case _0x0420('0x53'):strategy['rrmemory'](_0x425e50,_0x19783e,_0x435487,_0x19dff9);break;default:strategy['beepall'](_0x425e50,_0x19783e,_0x435487,_0x19dff9);}}else{logger[_0x0420('0x42')](_0x0420('0x54'),_0x4a65e5,_0x367dea[_0x0420('0x38')]);_0x1c5669[_0x0420('0x49')]();}}}catch(_0x5e8174){logger[_0x0420('0x42')]('[%s][QUEUE]\x20%s',_0x4a65e5,_0x5e8174[_0x0420('0x55')]);_0x1c5669['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 5363c66..2536ff8 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 _0x8ef6=['handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','debug','channel','busy','busyQueue','showNotification','RINGING','forcedOwnership',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','handleTimeout','bind','timeout','drained'];(function(_0x4d27f8,_0x1a0842){var _0x457a2e=function(_0x3d222a){while(--_0x3d222a){_0x4d27f8['push'](_0x4d27f8['shift']());}};_0x457a2e(++_0x1a0842);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3f80c6,_0x3e2dbe){_0x3f80c6=_0x3f80c6-0x0;var _0x591e4f=_0x8ef6[_0x3f80c6];return _0x591e4f;};'use strict';var _=require(_0x68ef('0x0'));var uuid=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var logger=require(_0x68ef('0x3'))(_0x68ef('0x4'));var Agent=function(_0x44e0d3,_0x3411a2,_0x4a72b8,_0x27d0af){this[_0x68ef('0x5')]=uuid['v4']();this[_0x68ef('0x6')]=_0x44e0d3;this[_0x68ef('0x7')]=_0x3411a2;this['realtime']=_0x4a72b8;this['routing']=_0x27d0af;this[_0x68ef('0x6')][_0x68ef('0x8')](this[_0x68ef('0x9')]['bind'](this),this[_0x68ef('0xa')][_0x68ef('0xb')](this));this[_0x68ef('0x6')]['on'](_0x68ef('0xc'),this[_0x68ef('0xa')][_0x68ef('0xb')](this));this[_0x68ef('0x6')]['on'](_0x68ef('0xd'),this[_0x68ef('0xe')][_0x68ef('0xb')](this));};Agent[_0x68ef('0xf')][_0x68ef('0x8')]=function(){this['squeue'][_0x68ef('0x8')](this[_0x68ef('0x9')][_0x68ef('0xb')](this),this[_0x68ef('0xa')][_0x68ef('0xb')](this));};Agent[_0x68ef('0xf')]['handleDrained']=function(){this[_0x68ef('0xa')](!![]);};Agent[_0x68ef('0xf')][_0x68ef('0x9')]=function(){logger['debug'](_0x68ef('0x10'),this[_0x68ef('0x6')]['id'],this[_0x68ef('0x7')]['id']);if(_['isNil'](this[_0x68ef('0x11')][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']])){logger[_0x68ef('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x68ef('0x6')]['id'],this['agent']['id']);setTimeout(this['push'][_0x68ef('0xb')](this),0x3e8);}else{if(this[_0x68ef('0x4')]['forcedOwnership']||util['isAgentAvailable'](this[_0x68ef('0x6')]['id'],this[_0x68ef('0x11')][_0x68ef('0x12')][this['agent']['id']],this[_0x68ef('0x6')][_0x68ef('0x14')],![])){this[_0x68ef('0x11')]['agents'][this[_0x68ef('0x7')]['id']][_0x68ef('0x15')]=!![];this['realtime'][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']][_0x68ef('0x16')]=undefined;util['saveWaitingNotification'](this['realtime'],this['routing'],this[_0x68ef('0x7')],this[_0x68ef('0x6')][_0x68ef('0x14')]);util[_0x68ef('0x17')](this[_0x68ef('0x5')],this[_0x68ef('0x6')]['id'],this[_0x68ef('0x11')][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']],null,this[_0x68ef('0x4')]);util['writeLog'](this[_0x68ef('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],_0x68ef('0x18')+(this[_0x68ef('0x4')][_0x68ef('0x19')]?_0x68ef('0x1a'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x68ef('0x6')]['id'],this[_0x68ef('0x7')]['id']);setTimeout(this[_0x68ef('0x8')][_0x68ef('0xb')](this),0x3e8);}}};Agent[_0x68ef('0xf')][_0x68ef('0xa')]=function(_0x26288a){if(_[_0x68ef('0x1b')](this['realtime'][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']])){return logger[_0x68ef('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x68ef('0x6')]['id'],this['agent']['id']);}else{logger[_0x68ef('0x13')](_0x68ef('0x1c'),this['squeue']['id'],this['agent']['id']);util[_0x68ef('0x1d')](this[_0x68ef('0x5')],this['squeue']['id'],this[_0x68ef('0x11')][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']],null,this[_0x68ef('0x4')]);this['realtime'][_0x68ef('0x12')][this[_0x68ef('0x7')]['id']]['busy']=![];this[_0x68ef('0x11')]['agents'][this[_0x68ef('0x7')]['id']][_0x68ef('0x16')]=undefined;util['removeWaitingNotification'](this[_0x68ef('0x11')],this['routing'],this[_0x68ef('0x7')],this['squeue'][_0x68ef('0x14')]);util[_0x68ef('0x1e')](this[_0x68ef('0x6')]['id'],this['realtime'][_0x68ef('0x12')][this['agent']['id']],_0x26288a?_0x68ef('0x1f'):'TIMEOUT');}if(!_0x26288a){setTimeout(this[_0x68ef('0x8')][_0x68ef('0xb')](this),0x3e8);}};function agent(_0x102df9,_0x136f6b,_0x2181d9,_0xefd1d){return new Agent(_0x102df9,_0x136f6b,_0x2181d9,_0xefd1d);}module['exports']=agent; \ No newline at end of file +var _0x0a9a=['writeLog','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','timeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','push','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification'];(function(_0x46b9bf,_0x3c9e5d){var _0xe4b4ac=function(_0x59da47){while(--_0x59da47){_0x46b9bf['push'](_0x46b9bf['shift']());}};_0xe4b4ac(++_0x3c9e5d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x48ba23,_0x45401b){_0x48ba23=_0x48ba23-0x0;var _0x4d39ef=_0x0a9a[_0x48ba23];return _0x4d39ef;};'use strict';var _=require('lodash');var uuid=require(_0xa0a9('0x0'));var util=require('./util');var logger=require(_0xa0a9('0x1'))(_0xa0a9('0x2'));var Agent=function(_0x34801b,_0x49162f,_0x4ba993,_0x317a94){this[_0xa0a9('0x3')]=uuid['v4']();this['squeue']=_0x34801b;this[_0xa0a9('0x4')]=_0x49162f;this[_0xa0a9('0x5')]=_0x4ba993;this[_0xa0a9('0x2')]=_0x317a94;this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on'](_0xa0a9('0xa'),this['handleTimeout'][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on']('drained',this['handleDrained'][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')]['push']=function(){this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')][_0xa0a9('0xc')]=function(){this[_0xa0a9('0x8')](!![]);};Agent['prototype'][_0xa0a9('0x7')]=function(){logger[_0xa0a9('0xd')](_0xa0a9('0xe'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);if(_[_0xa0a9('0xf')](this['realtime'][_0xa0a9('0x10')][this['agent']['id']])){logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')]['bind'](this),0x3e8);}else{if(this[_0xa0a9('0x2')][_0xa0a9('0x13')]||util[_0xa0a9('0x14')](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']],this[_0xa0a9('0x6')][_0xa0a9('0x15')],![])){this['realtime']['agents'][this[_0xa0a9('0x4')]['id']][_0xa0a9('0x16')]=!![];this[_0xa0a9('0x5')]['agents'][this[_0xa0a9('0x4')]['id']]['busyQueue']=undefined;util[_0xa0a9('0x17')](this['realtime'],this[_0xa0a9('0x2')],this[_0xa0a9('0x4')],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util['showNotification'](this[_0xa0a9('0x3')],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);util['writeLog'](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],'RINGING'+(this[_0xa0a9('0x2')][_0xa0a9('0x13')]?_0xa0a9('0x18'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}}};Agent[_0xa0a9('0xb')][_0xa0a9('0x8')]=function(_0x2386c9){if(_[_0xa0a9('0xf')](this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']])){return logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this['agent']['id']);}else{logger[_0xa0a9('0xd')](_0xa0a9('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xa0a9('0x1a')](this['notificationId'],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']]['busy']=![];this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']][_0xa0a9('0x1b')]=undefined;util[_0xa0a9('0x1c')](this[_0xa0a9('0x5')],this['routing'],this['agent'],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util[_0xa0a9('0x1d')](this[_0xa0a9('0x6')]['id'],this['realtime'][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],_0x2386c9?_0xa0a9('0x1e'):'TIMEOUT');}if(!_0x2386c9){setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}};function agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673){return new Agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673);}module[_0xa0a9('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index e2acc00..8791b76 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 _0xfffb=['prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','./util','routing','squeue','queue','handleTimeout','bind','handleDrained','push','handleRun'];(function(_0x281b66,_0x2e584f){var _0x23cfa5=function(_0x4cfe60){while(--_0x4cfe60){_0x281b66['push'](_0x281b66['shift']());}};_0x23cfa5(++_0x2e584f);}(_0xfffb,0x161));var _0xbfff=function(_0x117b2c,_0x263846){_0x117b2c=_0x117b2c-0x0;var _0x4162e6=_0xfffb[_0x117b2c];return _0x4162e6;};'use strict';var _=require(_0xbfff('0x0'));var uuid=require('uuid');var util=require(_0xbfff('0x1'));var logger=require('../../../../../config/logger')(_0xbfff('0x2'));var Beepall=function(_0x5d9772,_0x17d4be,_0x3fde10,_0x1e71f9){this['notificationId']=uuid['v4']();this[_0xbfff('0x3')]=_0x5d9772;this[_0xbfff('0x4')]=_0x17d4be;this['realtime']=_0x3fde10;this[_0xbfff('0x2')]=_0x1e71f9;this['squeue']['push'](this['handleRun']['bind'](this),this[_0xbfff('0x5')][_0xbfff('0x6')](this));this[_0xbfff('0x3')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0xbfff('0x3')]['on']('drained',this[_0xbfff('0x7')][_0xbfff('0x6')](this));};Beepall['prototype']['push']=function(){this[_0xbfff('0x3')][_0xbfff('0x8')](this[_0xbfff('0x9')][_0xbfff('0x6')](this),this['handleTimeout'][_0xbfff('0x6')](this));};Beepall[_0xbfff('0xa')][_0xbfff('0x7')]=function(){this['handleTimeout'](!![]);};Beepall[_0xbfff('0xa')][_0xbfff('0x9')]=function(){var _0x495e68=!![];if(!_[_0xbfff('0xb')](this['queue'])&&!_['isNil'](this[_0xbfff('0x4')][_0xbfff('0xc')])&&this['queue'][_0xbfff('0xc')]['length']>0x0){for(var _0x1e4c42=0x0,_0x150a13;_0x1e4c420x0){for(var _0x56b447=0x0,_0x4c7837;_0x56b4470x0&&_0x192521[_0x2a6620+_0x4577('0x1c')]>=_0x192521[_0x2a6620+_0x4577('0x1d')]){writeLog(_0x54795c,_0x192521,_0x2a6620[_0x4577('0x1e')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x4577('0x1f')]=function(_0xe28e48,_0x261c81,_0x3a0058,_0x38208e,_0x42a2d4){return sendNotification(!![],_0xe28e48,_0x261c81,_0x3a0058,_0x38208e,_0x42a2d4);};exports[_0x4577('0x20')]=function(_0x27778a,_0x500f2b,_0xc98121,_0x34ce52,_0xbfd2a2){return sendNotification(![],_0x27778a,_0x500f2b,_0xc98121,_0x34ce52,_0xbfd2a2);};exports[_0x4577('0x21')]=function(_0x85bd27,_0x4bf8f4,_0x5ec282){var _0x1d097b=_0x4bf8f4[_0x4577('0x22')][_0x4577('0x23')];if(!_0x1d097b&&_0x5ec282){_0x1d097b=_0x5ec282['id'];}var _0xd74b9b=_['some'](_0x85bd27[_0x4bf8f4[_0x4577('0x24')]+_0x4577('0x25')],function(_0x11c2f3){var _0x3f03bf=_[_0x4577('0x26')](_0x4bf8f4['channel'])+_0x4577('0x27');return _0x11c2f3[_0x3f03bf]===_0x4bf8f4[_0x4577('0x22')]['id'];});if(!_0xd74b9b&&_0x1d097b&&_0x85bd27['agents'][_0x1d097b]){_0xd74b9b=_[_0x4577('0x28')](_0x85bd27[_0x4577('0x29')][_0x1d097b][_0x4bf8f4[_0x4577('0x24')]+_0x4577('0x2a')],function(_0x1c38db){return _0x1c38db['id']===_0x4bf8f4[_0x4577('0x22')]['id'];});}return _0xd74b9b;};exports[_0x4577('0x2b')]=function(_0x12d633,_0x319678,_0x1423f0,_0x3f148e){if(_0x1423f0&&_0x1423f0['id']&&_0x12d633[_0x4577('0x29')]&&_0x12d633['agents'][_0x1423f0['id']]){_0x12d633[_0x4577('0x29')][_0x1423f0['id']][_0x3f148e+_0x4577('0x2a')][_0x319678[_0x4577('0x2c')]['id']]={'id':_0x319678[_0x4577('0x22')]['id']};}};exports['removeWaitingNotification']=function(_0x198414,_0x116795,_0x551ff4,_0x451bf6){if(_0x551ff4&&_0x551ff4['id']&&_0x198414['agents']&&_0x198414[_0x4577('0x29')][_0x551ff4['id']]){delete _0x198414[_0x4577('0x29')][_0x551ff4['id']][_0x451bf6+_0x4577('0x2a')][_0x116795[_0x4577('0x2c')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0x3f77=['writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','socket.io-emitter','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','format','message','user:%s','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','name','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','interaction','saveWaitingNotification','removeWaitingNotification'];(function(_0x25e9ff,_0x3f0c8b){var _0x1cc069=function(_0x5e29b1){while(--_0x5e29b1){_0x25e9ff['push'](_0x25e9ff['shift']());}};_0x1cc069(++_0x3f0c8b);}(_0x3f77,0xa0));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73f7('0x0'));var util=require(_0x73f7('0x1'));var utils=require(_0x73f7('0x2'));var Redis=require(_0x73f7('0x3'));var config=require(_0x73f7('0x4'));var logger=require('../../../../../config/logger')(_0x73f7('0x5'));config[_0x73f7('0x6')]=_[_0x73f7('0x7')](config[_0x73f7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x73f7('0x8'))(new Redis(config[_0x73f7('0x6')]));function sendNotification(_0x4fc442,_0x49f742,_0x138a0f,_0x307190,_0x3f7034,_0x1918a6){var _0x1dd431=_0x1918a6||{};var _0x3a9ef6=_0x138a0f['split']('.');var _0xa08a26={'uniqueid':_0x49f742,'channel':_0x3a9ef6[0x0],'id':_0x3a9ef6[0x1],'title':_0x3a9ef6[0x0]+_0x73f7('0x9'),'interactionId':_0x3a9ef6[0x2],'queue':_0x3f7034?_0x3f7034['name']:null,'sound':_0x1dd431[_0x73f7('0xa')][_0x73f7('0xb')],'shake':_0x1dd431[_0x73f7('0xa')][_0x73f7('0xc')]};try{if(!_0x1dd431[_0x73f7('0xd')]){_0x1dd431[_0x73f7('0xd')]={};}if(_0x3f7034){_0x1dd431[_0x73f7('0xd')][_0x73f7('0xe')]=_0x3f7034;}else if(_0x1dd431['body'][_0x73f7('0xe')]){delete _0x1dd431[_0x73f7('0xd')][_0x73f7('0xe')];}_0xa08a26[_0x73f7('0xf')]=utils[_0x73f7('0x10')](_0x1dd431[_0x73f7('0xa')]['notificationTemplate'],_0x1dd431);}catch(_0x5920ce){_0xa08a26[_0x73f7('0xf')]=_0x73f7('0x11');logger['error'](util[_0x73f7('0x12')]('[%s][QUEUE]\x20%s',_0x49f742,_0x5920ce[_0x73f7('0x13')]));}io['to'](util[_0x73f7('0x12')](_0x73f7('0x14'),_0x307190['name']))[_0x73f7('0x15')](util['format'](_0x73f7('0x16'),_0x4fc442?_0x73f7('0x17'):_0x73f7('0x18')),_0xa08a26);}function writeLog(_0x2e0b5d,_0x546cd5,_0x2922fa){return logger[_0x73f7('0x19')](util['format'](_0x73f7('0x1a'),_0x2e0b5d,_0x546cd5[_0x73f7('0x1b')],_0x2922fa));}exports[_0x73f7('0x1c')]=function(_0x43c2b7,_0x2642e5,_0x395a47,_0x30e2d1){if(_0x2642e5[_0x73f7('0x1d')]){writeLog(_0x43c2b7,_0x2642e5,_0x73f7('0x1e'));return![];}if(!_0x2642e5[_0x73f7('0x1f')]){writeLog(_0x43c2b7,_0x2642e5,_0x73f7('0x20'));return![];}if(_0x2642e5[_0x395a47+_0x73f7('0x21')]){writeLog(_0x43c2b7,_0x2642e5,'PAUSE');return![];}if(_0x30e2d1&&_0x2642e5[_0x73f7('0x22')](_0x395a47+'Capacity')&&_0x2642e5[_0x73f7('0x22')](_0x395a47+_0x73f7('0x23'))){if(_0x2642e5[_0x395a47+_0x73f7('0x24')]>0x0&&_0x2642e5[_0x395a47+'CurrentCapacity']>=_0x2642e5[_0x395a47+_0x73f7('0x24')]){writeLog(_0x43c2b7,_0x2642e5,_0x395a47[_0x73f7('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x73f7('0x26')]=function(_0x5a661d,_0x145b7d,_0x14c1c8,_0x3c7939,_0x29db80){return sendNotification(!![],_0x5a661d,_0x145b7d,_0x14c1c8,_0x3c7939,_0x29db80);};exports[_0x73f7('0x27')]=function(_0x389b03,_0x22d87e,_0x1b0c07,_0x50ad07,_0x34265b){return sendNotification(![],_0x389b03,_0x22d87e,_0x1b0c07,_0x50ad07,_0x34265b);};exports[_0x73f7('0x28')]=function(_0x2247ff,_0x330b0d,_0x4318e1){var _0x25445e=_0x330b0d['interaction'][_0x73f7('0x29')];if(!_0x25445e&&_0x4318e1){_0x25445e=_0x4318e1['id'];}var _0xa59252=_[_0x73f7('0x2a')](_0x2247ff[_0x330b0d[_0x73f7('0x2b')]+_0x73f7('0x2c')],function(_0x4d2464){var _0xe4d0ab=_[_0x73f7('0x2d')](_0x330b0d[_0x73f7('0x2b')])+_0x73f7('0x2e');return _0x4d2464[_0xe4d0ab]===_0x330b0d['interaction']['id'];});if(!_0xa59252&&_0x25445e&&_0x2247ff[_0x73f7('0x2f')][_0x25445e]){_0xa59252=_[_0x73f7('0x2a')](_0x2247ff[_0x73f7('0x2f')][_0x25445e][_0x330b0d[_0x73f7('0x2b')]+_0x73f7('0x30')],function(_0x153c02){return _0x153c02['id']===_0x330b0d[_0x73f7('0x31')]['id'];});}return _0xa59252;};exports[_0x73f7('0x32')]=function(_0x2cf695,_0x14a676,_0x18e277,_0x371d7d){if(_0x18e277&&_0x18e277['id']&&_0x2cf695[_0x73f7('0x2f')]&&_0x2cf695['agents'][_0x18e277['id']]){_0x2cf695[_0x73f7('0x2f')][_0x18e277['id']][_0x371d7d+_0x73f7('0x30')][_0x14a676[_0x73f7('0x13')]['id']]={'id':_0x14a676[_0x73f7('0x31')]['id']};}};exports[_0x73f7('0x33')]=function(_0x235826,_0x49fb49,_0x1d997e,_0x5ea9f5){if(_0x1d997e&&_0x1d997e['id']&&_0x235826[_0x73f7('0x2f')]&&_0x235826[_0x73f7('0x2f')][_0x1d997e['id']]){delete _0x235826[_0x73f7('0x2f')][_0x1d997e['id']][_0x5ea9f5+'WaitingInteractions'][_0x49fb49[_0x73f7('0x13')]['id']];}};exports[_0x73f7('0x34')]=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 b78a80c..2ebea96 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 _0xd498=['lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs'];(function(_0x58d5bc,_0x440510){var _0x3e9c74=function(_0x170503){while(--_0x170503){_0x58d5bc['push'](_0x58d5bc['shift']());}};_0x3e9c74(++_0x440510);}(_0xd498,0xa6));var _0x8d49=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xd498[_0x236d24];return _0x1574cf;};'use strict';var schema=require(_0x8d49('0x0'));var sh=require(_0x8d49('0x1'));var _=require(_0x8d49('0x2'));var utils=require(_0x8d49('0x3'));var logger=require(_0x8d49('0x4'))(_0x8d49('0x5'));var system=schema({'command':{'type':_0x8d49('0x6'),'required':!![],'message':_0x8d49('0x7')}});exports[_0x8d49('0x8')]=function(_0x263abc,_0x1ba6a4){return function(_0x5b19a7){try{var _0x540913={'command':_0x1ba6a4[0x0]};var _0x260170=system[_0x8d49('0x0')](_0x540913,{'typecast':!![]});if(_0x260170[_0x8d49('0x9')]){logger[_0x8d49('0xa')](_0x8d49('0xb'),_0x263abc,_[_0x8d49('0xc')](_0x260170,_0x8d49('0xd'))['join'](',\x20'));logger[_0x8d49('0xe')](_0x8d49('0xf'),_0x263abc);_0x5b19a7[_0x8d49('0x10')]();}else{var _0x2c9f60=this;var _0x912715=utils[_0x8d49('0x11')](_0x1ba6a4[0x0],this);logger[_0x8d49('0xe')](_0x8d49('0x12'),_0x263abc,_0x912715);sh[_0x8d49('0x13')](_['trim'](_0x912715),function(_0x5be713,_0x35f8dc){logger[_0x8d49('0xe')](_0x8d49('0x14'),_0x263abc,_0x5be713);if(_0x5be713==0x0){var _0x468780=_0x35f8dc['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8d49('0x15')](_0x1ba6a4[0x1])||_['isEmpty'](_0x1ba6a4[0x1])){logger[_0x8d49('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x263abc);_0x2c9f60[_0x8d49('0x16')][_0x1ba6a4[0x1]]=_0x468780;}else{logger[_0x8d49('0xe')](_0x8d49('0x17'),_0x263abc,_0x1ba6a4[0x1],_0x468780);_0x2c9f60[_0x8d49('0x16')][_0x1ba6a4[0x1]]=_0x468780;}}_0x5b19a7['next']();});}}catch(_0x4f8f69){logger[_0x8d49('0xa')](_0x8d49('0xb'),_0x263abc,_['isObject'](_0x4f8f69)?JSON['stringify'](_0x4f8f69):_0x4f8f69);logger[_0x8d49('0xe')](_0x8d49('0xf'),_0x263abc);_0x5b19a7[_0x8d49('0x10')]();}};}; \ No newline at end of file +var _0x525e=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x46c0a5,_0x2f8b01){var _0x194043=function(_0x1fdba5){while(--_0x1fdba5){_0x46c0a5['push'](_0x46c0a5['shift']());}};_0x194043(++_0x2f8b01);}(_0x525e,0x78));var _0xe525=function(_0x1d6c7e,_0x3c044a){_0x1d6c7e=_0x1d6c7e-0x0;var _0x342331=_0x525e[_0x1d6c7e];return _0x342331;};'use strict';var schema=require(_0xe525('0x0'));var sh=require(_0xe525('0x1'));var _=require(_0xe525('0x2'));var utils=require(_0xe525('0x3'));var logger=require(_0xe525('0x4'))(_0xe525('0x5'));var system=schema({'command':{'type':_0xe525('0x6'),'required':!![],'message':_0xe525('0x7')}});exports['consequence']=function(_0x3d7c66,_0x424039){return function(_0x2c287f){try{var _0x59a6b6={'command':_0x424039[0x0]};var _0x4c68a3=system[_0xe525('0x0')](_0x59a6b6,{'typecast':!![]});if(_0x4c68a3['length']){logger[_0xe525('0x8')](_0xe525('0x9'),_0x3d7c66,_[_0xe525('0xa')](_0x4c68a3,_0xe525('0xb'))[_0xe525('0xc')](',\x20'));logger[_0xe525('0xd')](_0xe525('0xe'),_0x3d7c66);_0x2c287f['next']();}else{var _0x28b499=this;var _0x9b637b=utils[_0xe525('0xf')](_0x424039[0x0],this);logger[_0xe525('0xd')](_0xe525('0x10'),_0x3d7c66,_0x9b637b);sh['exec'](_[_0xe525('0x11')](_0x9b637b),function(_0x1974bb,_0x1bd593){logger[_0xe525('0xd')](_0xe525('0x12'),_0x3d7c66,_0x1974bb);if(_0x1974bb==0x0){var _0x1faf27=_0x1bd593[_0xe525('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xe525('0x14')](_0x424039[0x1])||_[_0xe525('0x15')](_0x424039[0x1])){logger[_0xe525('0xd')](_0xe525('0x16'),_0x3d7c66);_0x28b499['body'][_0x424039[0x1]]=_0x1faf27;}else{logger[_0xe525('0xd')](_0xe525('0x17'),_0x3d7c66,_0x424039[0x1],_0x1faf27);_0x28b499[_0xe525('0x18')][_0x424039[0x1]]=_0x1faf27;}}_0x2c287f['next']();});}}catch(_0x2488b7){logger[_0xe525('0x8')](_0xe525('0x9'),_0x3d7c66,_[_0xe525('0x19')](_0x2488b7)?JSON[_0xe525('0x1a')](_0x2488b7):_0x2488b7);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3d7c66);_0x2c287f[_0xe525('0x1b')]();}};}; \ 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 776e085..1e27091 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 _0x9606=['addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','info','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x9606,0x1a7));var _0x6960=function(_0x5b2ec4,_0x3500cd){_0x5b2ec4=_0x5b2ec4-0x0;var _0x1cc2be=_0x9606[_0x5b2ec4];return _0x1cc2be;};'use strict';var schema=require(_0x6960('0x0'));var _=require(_0x6960('0x1'));var rpc={'chatInteraction':require(_0x6960('0x2')),'openchannelInteraction':require(_0x6960('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6960('0x4')),'faxInteraction':require(_0x6960('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6960('0x6'))('routing');var tag=schema({'tag':{'type':_0x6960('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6960('0x8')]=function(_0x58b2e7,_0x3a9b92,_0x38639b,_0x18d00c){return function(_0x16ac26){try{var _0x201a69={'tag':_0x3a9b92[0x0]};var _0x57e683=tag[_0x6960('0x0')](_0x201a69,{'typecast':!![]});if(_0x57e683['length']){logger[_0x6960('0x9')](_0x6960('0xa'),_0x58b2e7,_[_0x6960('0xb')](_0x57e683,_0x6960('0xc'))[_0x6960('0xd')](',\x20'));logger['info'](_0x6960('0xe'),_0x58b2e7);_0x16ac26['next']();}else{var _0x3fc8eb={'ids':[_0x3a9b92[0x0]]};if(rpc[_0x18d00c[_0x6960('0xf')]+_0x6960('0x10')]){rpc[_0x18d00c[_0x6960('0xf')]+_0x6960('0x10')][_0x6960('0x11')](_0x18d00c[_0x6960('0x12')]['id'],_0x3fc8eb)['then'](function(_0x3cbbfd){logger['info'](_0x6960('0x13'),_0x58b2e7,_0x3a9b92[0x1],_0x18d00c[_0x6960('0xf')],_0x18d00c[_0x6960('0x12')]['id']);})['catch'](function(_0x4239a6){logger[_0x6960('0x9')](_0x6960('0xa'),_0x58b2e7,JSON['stringify'](_0x4239a6));logger[_0x6960('0x14')](_0x6960('0xe'),_0x58b2e7);})[_0x6960('0x15')](function(){_0x16ac26['next']();});}}}catch(_0x1eb6fe){logger[_0x6960('0x9')](_0x6960('0xa'),_0x58b2e7,_['isObject'](_0x1eb6fe)?JSON['stringify'](_0x1eb6fe):_0x1eb6fe);logger[_0x6960('0x14')](_0x6960('0xe'),_0x58b2e7);_0x16ac26['next']();}};}; \ No newline at end of file +var _0xc6b6=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','isObject','next','lodash','../../rpc/openchannelInteraction'];(function(_0x28f323,_0x1ca4c9){var _0x53f649=function(_0x220945){while(--_0x220945){_0x28f323['push'](_0x28f323['shift']());}};_0x53f649(++_0x1ca4c9);}(_0xc6b6,0x1ae));var _0x6c6b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc6b6[_0x19950b];return _0x3c6b41;};'use strict';var schema=require('validate');var _=require(_0x6c6b('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6c6b('0x1')),'smsInteraction':require(_0x6c6b('0x2')),'mailInteraction':require(_0x6c6b('0x3')),'faxInteraction':require(_0x6c6b('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x6c6b('0x5'));var tag=schema({'tag':{'type':_0x6c6b('0x6'),'required':!![],'message':_0x6c6b('0x7')}});exports[_0x6c6b('0x8')]=function(_0x4f6131,_0x561d3d,_0x198030,_0x35652f){return function(_0x5a3592){try{var _0x586ae8={'tag':_0x561d3d[0x0]};var _0x1408f0=tag['validate'](_0x586ae8,{'typecast':!![]});if(_0x1408f0[_0x6c6b('0x9')]){logger[_0x6c6b('0xa')]('[%s][TAG]\x20%s',_0x4f6131,_[_0x6c6b('0xb')](_0x1408f0,_0x6c6b('0xc'))['join'](',\x20'));logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);_0x5a3592['next']();}else{var _0x132237={'ids':[_0x561d3d[0x0]]};if(rpc[_0x35652f[_0x6c6b('0xf')]+'Interaction']){rpc[_0x35652f[_0x6c6b('0xf')]+_0x6c6b('0x10')][_0x6c6b('0x11')](_0x35652f[_0x6c6b('0x12')]['id'],_0x132237)[_0x6c6b('0x13')](function(_0x4c3558){logger[_0x6c6b('0xd')](_0x6c6b('0x14'),_0x4f6131,_0x561d3d[0x1],_0x35652f['channel'],_0x35652f['interaction']['id']);})[_0x6c6b('0x15')](function(_0x2251a7){logger[_0x6c6b('0xa')]('[%s][TAG]\x20%s',_0x4f6131,JSON[_0x6c6b('0x16')](_0x2251a7));logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);})[_0x6c6b('0x17')](function(){_0x5a3592['next']();});}}}catch(_0x1ef0d2){logger[_0x6c6b('0xa')](_0x6c6b('0x18'),_0x4f6131,_[_0x6c6b('0x19')](_0x1ef0d2)?JSON[_0x6c6b('0x16')](_0x1ef0d2):_0x1ef0d2);logger[_0x6c6b('0xd')](_0x6c6b('0xe'),_0x4f6131);_0x5a3592[_0x6c6b('0x1a')]();}};}; \ 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 d9afea7..5d2eb8f 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 _0x3efb=['stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId='];(function(_0x1bd3ad,_0x4dd641){var _0x3213f8=function(_0x45a045){while(--_0x45a045){_0x1bd3ad['push'](_0x1bd3ad['shift']());}};_0x3213f8(++_0x4dd641);}(_0x3efb,0x68));var _0xb3ef=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x3efb[_0x18d631];return _0x50d708;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0xb3ef('0x0'));var _=require(_0xb3ef('0x1'));var arr=[];exports[_0xb3ef('0x2')]=function(_0x40b7f3,_0x869689){return function(_0x579fc0){var _0x1269cb=_0x869689[0xa];var _0x1d941a=_0x869689[0xb];var _0x2d2cd5=_0x869689[0xc];var _0x282ff7=_0x869689[0xd];var _0x3bd962=_0x869689[0xe];var _0x534980=_0x869689[0xf][_0xb3ef('0x3')](/\n/g,_0xb3ef('0x4'));var _0x5ae208=_0x869689[0x10][_0xb3ef('0x3')](/\n/g,'\x20');if(!arr[_0xb3ef('0x5')](_0x1d941a)){arr[_0xb3ef('0x6')](_0x1d941a);var _0x3c961b=_0x869689[0x3];var _0x4ff42d=_0x869689[0x4];var _0x38b2bb=_0x869689[0x1];var _0x2bf91e=_0x869689[0x0];var _0x143a92={};_0x143a92[_0xb3ef('0x7')]=_0x869689[0x8]+_0xb3ef('0x8')+_0x2d2cd5+'|'+_0x1269cb+'|'+_0x282ff7+'|'+_0x1d941a+'|'+_0x3bd962;_0x143a92['urlOnRing']=_0x869689[0x7]+_0xb3ef('0x8')+_0x2d2cd5+'|'+_0x1269cb+'|'+_0x282ff7+'|'+_0x1d941a+'|'+_0x3bd962+'|'+_0x534980+'|'+_0x5ae208;_0x143a92['title']=_0x869689[0x9];var _0x516253={};_0x516253[_0xb3ef('0x9')]=_0xb3ef('0xa');_0x516253[_0xb3ef('0xb')]=_0xb3ef('0xc');var _0x4b6fe8=[];_0x4b6fe8[_0xb3ef('0x6')](_0x869689[0x2]);_0x4b6fe8['push'](_0x869689[0x5]);_0x4b6fe8[_0xb3ef('0x6')](_0x869689[0x6]);_0x516253[_0xb3ef('0xd')]=_0x4b6fe8;_0x516253['id']=0x1;var _0x1fb47f=JSON['stringify'](_0x516253);var _0x4e19ea={'encoding':_0xb3ef('0xe'),'method':_0xb3ef('0xf'),'timeout':0x2710,'url':_0x3c961b,'headers':{'Content-Type':_0xb3ef('0x10')},'body':_0x1fb47f};return rp(_0x4e19ea)[_0xb3ef('0x11')](function(_0x4271cb){const _0x35bfd5=JSON[_0xb3ef('0x12')](_0x4271cb);if(!_0x35bfd5[_0xb3ef('0x13')][_0xb3ef('0x14')]){throw new Error(_0xb3ef('0x15'));}var _0x1b680c=_0x1d941a;var _0x3c2cbc='channelId='+_0x38b2bb+_0xb3ef('0x16')+_0x2bf91e+_0xb3ef('0x17')+_0x1b680c+'&data='+JSON[_0xb3ef('0x18')](_0x143a92);var _0x570299=_0x4ff42d+'?'+_0x3c2cbc;return rp(_0x570299);})[_0xb3ef('0x11')](function(_0xd3eb8d){logger[_0xb3ef('0x19')](_0xb3ef('0x1a'),_0x40b7f3,_0xd3eb8d);_0x579fc0[_0xb3ef('0x1b')]();})['catch'](function(_0xeb2dc){logger[_0xb3ef('0x1c')](_0xb3ef('0x1d'),_0x40b7f3,_[_0xb3ef('0x1e')](_0xeb2dc)?JSON['stringify'](_0xeb2dc):_0xeb2dc);_0x579fc0[_0xb3ef('0x1b')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x40b7f3);_0x579fc0[_0xb3ef('0x1f')]();}};}; \ No newline at end of file +var _0x8be2=['includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','logged','channelId=','&serviceId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','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','replace','\x20-\x20'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8be2,0x1c8));var _0x28be=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x8be2[_0x127c7b];return _0x1708eb;};'use strict';var rp=require(_0x28be('0x0'));var logger=require('../../../../config/logger')(_0x28be('0x1'));var _=require(_0x28be('0x2'));var arr=[];exports[_0x28be('0x3')]=function(_0x4833fe,_0x902b65){return function(_0x358415){var _0x74e122=_0x902b65[0xa];var _0x1f60ef=_0x902b65[0xb];var _0x398d07=_0x902b65[0xc];var _0x213fa7=_0x902b65[0xd];var _0x1659ee=_0x902b65[0xe];var _0xec07ef=_0x902b65[0xf][_0x28be('0x4')](/\n/g,_0x28be('0x5'));var _0x53862d=_0x902b65[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x28be('0x6')](_0x1f60ef)){arr[_0x28be('0x7')](_0x1f60ef);var _0x53dee9=_0x902b65[0x3];var _0x547490=_0x902b65[0x4];var _0x15fbce=_0x902b65[0x1];var _0x3d69a0=_0x902b65[0x0];var _0x3e6e41={};_0x3e6e41['urlOnAnswer']=_0x902b65[0x8]+_0x28be('0x8')+_0x398d07+'|'+_0x74e122+'|'+_0x213fa7+'|'+_0x1f60ef+'|'+_0x1659ee;_0x3e6e41[_0x28be('0x9')]=_0x902b65[0x7]+_0x28be('0x8')+_0x398d07+'|'+_0x74e122+'|'+_0x213fa7+'|'+_0x1f60ef+'|'+_0x1659ee+'|'+_0xec07ef+'|'+_0x53862d;_0x3e6e41[_0x28be('0xa')]=_0x902b65[0x9];var _0x286af0={};_0x286af0[_0x28be('0xb')]=_0x28be('0xc');_0x286af0[_0x28be('0xd')]=_0x28be('0xe');var _0x1b73f9=[];_0x1b73f9['push'](_0x902b65[0x2]);_0x1b73f9[_0x28be('0x7')](_0x902b65[0x5]);_0x1b73f9['push'](_0x902b65[0x6]);_0x286af0[_0x28be('0xf')]=_0x1b73f9;_0x286af0['id']=0x1;var _0x10835f=JSON[_0x28be('0x10')](_0x286af0);var _0x1dfdb0={'encoding':_0x28be('0x11'),'method':_0x28be('0x12'),'timeout':0x2710,'url':_0x53dee9,'headers':{'Content-Type':_0x28be('0x13')},'body':_0x10835f};return rp(_0x1dfdb0)[_0x28be('0x14')](function(_0x2aa8d8){const _0x372e97=JSON['parse'](_0x2aa8d8);if(!_0x372e97['result'][_0x28be('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x2c8ae8=_0x1f60ef;var _0x9c6623=_0x28be('0x16')+_0x15fbce+_0x28be('0x17')+_0x3d69a0+'&sessionId='+_0x2c8ae8+'&data='+JSON[_0x28be('0x10')](_0x3e6e41);var _0x1e3bcd=_0x547490+'?'+_0x9c6623;return rp(_0x1e3bcd);})[_0x28be('0x14')](function(_0x5a09d5){logger['info'](_0x28be('0x18'),_0x4833fe,_0x5a09d5);_0x358415[_0x28be('0x19')]();})[_0x28be('0x1a')](function(_0x24a9ac){logger[_0x28be('0x1b')](_0x28be('0x1c'),_0x4833fe,_[_0x28be('0x1d')](_0x24a9ac)?JSON[_0x28be('0x10')](_0x24a9ac):_0x24a9ac);_0x358415[_0x28be('0x19')]();});}else{logger[_0x28be('0x1e')](_0x28be('0x1f'),_0x4833fe);_0x358415[_0x28be('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index f33ed84..c9198bc 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(_0x5c953e,_0x254eb8){var _0x52632f=function(_0x2825f7){while(--_0x2825f7){_0x5c953e['push'](_0x5c953e['shift']());}};_0x52632f(++_0x254eb8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x18d016,_0x244c4d){var _0x290c9b=function(_0x39cac9){while(--_0x39cac9){_0x18d016['push'](_0x18d016['shift']());}};_0x290c9b(++_0x244c4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6eca06b..82029fd 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 _0xde80=['./applications/','consequence','priority','info','on\x20interval','\x20|\x20','execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','.js','app','toLowerCase','autoreply','appdata','mail','push','slice','join','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition'];(function(_0xb82aff,_0x25a727){var _0x54a3a0=function(_0x45ddad){while(--_0x45ddad){_0xb82aff['push'](_0xb82aff['shift']());}};_0x54a3a0(++_0x25a727);}(_0xde80,0x1d1));var _0x0de8=function(_0x597e5d,_0x2954d5){_0x597e5d=_0x597e5d-0x0;var _0x6a6659=_0xde80[_0x597e5d];return _0x6a6659;};'use strict';var _=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var path=require(_0x0de8('0x2'));var fs=require('fs');var jayson=require(_0x0de8('0x3'));var BPromise=require(_0x0de8('0x4'));var utils=require(_0x0de8('0x5'));var sUtils=require(_0x0de8('0x6'));var logger=require(_0x0de8('0x7'))(_0x0de8('0x8'));var rpc={'openchannelQueueReport':require(_0x0de8('0x9')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0de8('0xa')),'smsQueueReport':require(_0x0de8('0xb')),'faxQueueReport':require(_0x0de8('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x0de8('0xd'));function getId(_0x3b98b1,_0x131f53,_0x46f7bb){return util[_0x0de8('0xe')](_0x0de8('0xf'),_0x3b98b1,_0x131f53||0x0,_0x46f7bb||0x0);}function getIntervals(_0xbe16a6,_0x3750c7){var _0x484dbe=[];if(!_[_0x0de8('0x10')](_0x3750c7[_0x0de8('0x11')])&&!_['isNil'](_0xbe16a6[_0x3750c7['IntervalId']])&&!_['isNil'](_0xbe16a6[_0x3750c7['IntervalId']]['Intervals'])){_0x484dbe=_['map'](_0xbe16a6[_0x3750c7[_0x0de8('0x11')]][_0x0de8('0x12')],'interval');}else if(!_[_0x0de8('0x10')](_0x3750c7[_0x0de8('0x13')])){_0x484dbe=[_0x3750c7['interval']];}return _0x484dbe;}exports[_0x0de8('0x14')]=function(_0x56df50){_0x56df50[_0x0de8('0x15')]={};return new BPromise(function(_0x6a9b24,_0x512541){var _0x5ed903={'Start':function(_0x3ad31a){var _0x22d176=this;return new Promise(function(_0x46441e,_0x520868){if(_0x3ad31a){try{var _0xfa4d8d=[];var _0x49dee9=getId(_0x3ad31a[_0x0de8('0x16')],_0x3ad31a[_0x0de8('0x17')]?_0x3ad31a[_0x0de8('0x17')]['id']:0x0,_0x3ad31a[_0x0de8('0x18')]?_0x3ad31a[_0x0de8('0x18')]['id']:0x0);var _0x2392e3=sUtils[_0x0de8('0x19')](_0x56df50,_0x3ad31a);if(_0x3ad31a[_0x0de8('0x1a')]||!_0x2392e3&&_0x3ad31a[_0x0de8('0x1b')]&&_[_0x0de8('0x1c')](_0x3ad31a[_0x0de8('0x1b')])&&_0x3ad31a[_0x0de8('0x1b')][_0x0de8('0x1d')]){for(var _0x3b5120=0x0;_0x3b5120<_0x3ad31a[_0x0de8('0x1b')]['length'];_0x3b5120+=0x1){var _0x3baa4=_0x3ad31a['applications'][_0x3b5120];if(fs[_0x0de8('0x1e')](path['join'](__dirname,_0x0de8('0x1b'),_0x3baa4['app']+_0x0de8('0x1f')))){var _0x4b7c9e=[];switch(_0x3baa4[_0x0de8('0x20')][_0x0de8('0x21')]()){case _0x0de8('0x22'):var _0x4662a7=_0x3baa4[_0x0de8('0x23')]['split'](',');if(_0x3ad31a[_0x0de8('0x16')]===_0x0de8('0x24')){_0x4b7c9e[_0x0de8('0x25')](_0x4662a7[0x0]);_0x4b7c9e['push'](_0x4662a7[0x1]);_0x4b7c9e[_0x0de8('0x25')](_0x4662a7[_0x0de8('0x26')](0x2,_0x4662a7[_0x0de8('0x1d')])[_0x0de8('0x27')](','));}else{_0x4b7c9e[_0x0de8('0x25')](_0x4662a7[0x0]);_0x4b7c9e[_0x0de8('0x25')](_0x4662a7[_0x0de8('0x26')](0x1,_0x4662a7[_0x0de8('0x1d')])[_0x0de8('0x27')](','));}break;case _0x0de8('0x28'):var _0x47c97c=_0x3baa4['appdata'][_0x0de8('0x29')](',');_0x4b7c9e[_0x0de8('0x25')](_0x47c97c[0x0]);_0x4b7c9e[_0x0de8('0x25')](_0x47c97c[0x1]);_0x4b7c9e['push'](_0x47c97c[_0x0de8('0x26')](0x2,_0x47c97c[_0x0de8('0x1d')])[_0x0de8('0x27')](','));break;case _0x0de8('0x2a'):var _0x418eff=_0x3baa4[_0x0de8('0x23')][_0x0de8('0x29')](',');_0x4b7c9e[_0x0de8('0x25')](_0x418eff[0x0]);_0x4b7c9e['push'](_0x418eff[0x1]);_0x4b7c9e[_0x0de8('0x25')](_0x418eff[0x2]);_0x4b7c9e[_0x0de8('0x25')](_0x418eff[0x3]);_0x4b7c9e[_0x0de8('0x25')](_0x418eff['slice'](0x4,_0x418eff['length'])['join'](','));break;case _0x0de8('0x2b'):var _0x447bb=_0x3baa4[_0x0de8('0x23')][_0x0de8('0x29')](',');_0x4b7c9e[_0x0de8('0x25')](_0x447bb[0x0]);_0x4b7c9e[_0x0de8('0x25')](_0x447bb[0x1]);_0x4b7c9e[_0x0de8('0x25')](_0x447bb[0x2]);_0x4b7c9e[_0x0de8('0x25')](_0x447bb[0x3]);_0x4b7c9e[_0x0de8('0x25')](_0x447bb[_0x0de8('0x26')](0x4,_0x447bb['length'])[_0x0de8('0x27')](','));break;case _0x0de8('0x17'):_0x4b7c9e[_0x0de8('0x25')](_0x3baa4['appdata']);break;case _0x0de8('0x2c'):_0x4b7c9e[_0x0de8('0x25')](_0x3baa4[_0x0de8('0x2d')]);_0x4b7c9e[_0x0de8('0x25')](_0x3baa4['appdata']);break;case _0x0de8('0x2e'):var _0x1d6ea4=utils[_0x0de8('0x2f')](_0x3ad31a[_0x0de8('0x30')][_0x0de8('0x31')],_0x3ad31a);var _0x182a49=_0x3baa4['appdata'][_0x0de8('0x29')](',');_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x0]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x1]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x2]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x3]);_0x4b7c9e['push'](_0x182a49[0x4]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x5]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x6]);_0x4b7c9e['push'](_0x182a49[0x7]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x8]);_0x4b7c9e[_0x0de8('0x25')](_0x182a49[0x9]);_0x4b7c9e['push'](_0x182a49[0xa]);_0x4b7c9e[_0x0de8('0x25')](_0x3ad31a[_0x0de8('0x18')]['id']);_0x4b7c9e[_0x0de8('0x25')](_0x3ad31a[_0x0de8('0x17')]['id']);_0x4b7c9e['push'](_0x3baa4['ChatWebsiteId']);_0x4b7c9e[_0x0de8('0x25')](_0x3ad31a[_0x0de8('0x18')][_0x0de8('0x32')]);_0x4b7c9e[_0x0de8('0x25')](_0x3ad31a['body'][_0x0de8('0x33')]);_0x4b7c9e[_0x0de8('0x25')](_0x1d6ea4);break;default:_0x4b7c9e=_[_0x0de8('0x10')](_0x3baa4[_0x0de8('0x23')])?[]:_0x3baa4[_0x0de8('0x23')][_0x0de8('0x29')](',');}var _0x358368={'id':util[_0x0de8('0xe')](_0x0de8('0x34'),_0x49dee9,_0x3baa4['id'],_0x3baa4[_0x0de8('0x20')]),'condition':require(_0x0de8('0x35'))[_0x0de8('0x36')](_0x49dee9,getIntervals(_0x56df50['intervals'],_0x3baa4),_0x56df50),'consequence':require(_0x0de8('0x37')+_0x3baa4['app'])[_0x0de8('0x38')](_0x49dee9,_0x4b7c9e,_0x56df50,_0x3ad31a),'p':_0x3baa4[_0x0de8('0x39')]||0x0};logger[_0x0de8('0x3a')]('Push\x20new\x20rule',_0x358368['id'],_0x0de8('0x3b'),getIntervals(_0x56df50['intervals'],_0x3baa4)[_0x0de8('0x27')](_0x0de8('0x3c')));_0xfa4d8d[_0x0de8('0x25')](_0x358368);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x0de8('0x27')](__dirname,'applications',_0x3baa4['app']+_0x0de8('0x1f')));}}_0x56df50[_0x0de8('0x15')][_0x49dee9]=new RuleEngine(_0xfa4d8d);_0x56df50[_0x0de8('0x15')][_0x49dee9][_0x0de8('0x3d')](_0x3ad31a,function(_0xe0eab9){logger[_0x0de8('0x3a')](_0x0de8('0x3e'),JSON[_0x0de8('0x3f')](_0xe0eab9[_0x0de8('0x40')]));if(_0x56df50[_0x0de8('0x15')][_0x49dee9]){_0x56df50[_0x0de8('0x15')][_0x49dee9][_0x0de8('0x41')]('complete');}});return _0x46441e({'code':0xc8,'message':_0x3ad31a});}else{if(_0x2392e3){logger['info'](util[_0x0de8('0xe')](_0x0de8('0x42'),_0x49dee9));}else{logger[_0x0de8('0x3a')](_0x0de8('0x43'));}return _0x46441e({'code':0xc8,'message':_0x3ad31a});}}catch(_0x378688){logger[_0x0de8('0x44')](_0x378688[_0x0de8('0x45')]);return _0x520868(_0x22d176[_0x0de8('0x44')](0x1f4,_0x378688));}}return _0x520868('routing\x20is\x20empty');});},'AcceptMessage':function(_0x49b071){var _0x233f1b=this;return new Promise(function(_0x193fa2,_0x36e15b){if(_0x49b071[_0x0de8('0x46')]&&_0x49b071[_0x0de8('0x46')]['id']){if(_0x56df50[_0x0de8('0x47')][_0x49b071[_0x0de8('0x46')]['id']]){_0x56df50['agents'][_0x49b071[_0x0de8('0x46')]['id']]['busy']=![];_0x56df50[_0x0de8('0x47')][_0x49b071[_0x0de8('0x46')]['id']]['busyQueue']=undefined;}}if(_0x49b071[_0x0de8('0x17')]&&_0x49b071[_0x0de8('0x17')]['id']){try{var _0x2eb128=getId(_0x49b071[_0x0de8('0x16')],_0x49b071[_0x0de8('0x17')]?_0x49b071['message']['id']:0x0,_0x49b071['interaction']?_0x49b071[_0x0de8('0x18')]['id']:0x0);if(_0x56df50[_0x0de8('0x15')][_0x2eb128]){_0x56df50[_0x0de8('0x15')][_0x2eb128]['emit'](_0x0de8('0x48'));if(rpc[_0x49b071['channel']+_0x0de8('0x49')]){rpc[_0x49b071[_0x0de8('0x16')]+_0x0de8('0x49')][_0x0de8('0x4a')](_0x2eb128,{'UserId':_0x49b071['message'][_0x0de8('0x4b')]})[_0x0de8('0x4c')](function(){logger[_0x0de8('0x44')](_0x0de8('0x4d'));});}}return _0x193fa2({'code':0xc8,'message':_0x49b071});}catch(_0x1d7dd4){logger[_0x0de8('0x44')](_0x1d7dd4[_0x0de8('0x45')]);return _0x36e15b(_0x233f1b[_0x0de8('0x44')](0x1f4,_0x1d7dd4));}}logger['error']('message\x20is\x20empty');return _0x36e15b(_0x233f1b[_0x0de8('0x44')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1524bc){var _0x337844=this;return new Promise(function(_0x4491b1,_0x1ffc22){if(_0x1524bc[_0x0de8('0x46')]&&_0x1524bc[_0x0de8('0x46')]['id']){try{if(_0x56df50['agents'][_0x1524bc[_0x0de8('0x46')]['id']]){_0x56df50[_0x0de8('0x47')][_0x1524bc[_0x0de8('0x46')]['id']]['busy']=![];_0x56df50[_0x0de8('0x47')][_0x1524bc['agent']['id']]['busyQueue']=undefined;}return _0x4491b1({'code':0xc8,'message':_0x1524bc});}catch(_0x5e148f){logger[_0x0de8('0x44')](_0x5e148f[_0x0de8('0x45')]);return _0x1ffc22(_0x337844[_0x0de8('0x44')](0x1f4,_0x5e148f));}}logger['error'](_0x0de8('0x4e'));return _0x1ffc22(_0x337844[_0x0de8('0x44')](0x1f4,_0x0de8('0x4e')));});},'AbandonInteraction':function(_0x283cc4){var _0xefda9a=this;return new Promise(function(_0x79c445,_0x252e46){if(_0x283cc4[_0x0de8('0x16')]&&_0x283cc4[_0x0de8('0x18')]&&_0x283cc4['interaction']['id']){try{var _0x3657b5=getId(_0x283cc4[_0x0de8('0x16')],_0x283cc4[_0x0de8('0x17')]?_0x283cc4[_0x0de8('0x17')]['id']:0x0,_0x283cc4['interaction']?_0x283cc4[_0x0de8('0x18')]['id']:0x0);if(_0x56df50[_0x0de8('0x15')][_0x3657b5]){_0x56df50[_0x0de8('0x15')][_0x3657b5][_0x0de8('0x41')](_0x0de8('0x48'));}return _0x79c445({'code':0xc8,'message':_0x283cc4});}catch(_0xc51e7a){logger[_0x0de8('0x44')](_0xc51e7a[_0x0de8('0x45')]);return _0x252e46(_0xefda9a['error'](0x1f4,_0xc51e7a));}}logger[_0x0de8('0x44')](_0x0de8('0x4e'));return _0x252e46(_0xefda9a[_0x0de8('0x44')](0x1f4,_0x0de8('0x4e')));});},'AgentCapacity':function(_0x1ad8c1){var _0x42e211=this;return new Promise(function(_0x29ed83,_0x3e45ec){if(_0x56df50[_0x0de8('0x47')][_0x0de8('0x4f')](_0x1ad8c1['id'])){for(var _0x2693fc in _0x1ad8c1[_0x0de8('0x50')]){if(_0x1ad8c1[_0x0de8('0x50')][_0x0de8('0x4f')](_0x2693fc)){if(_0x56df50[_0x0de8('0x47')][_0x1ad8c1['id']][_0x0de8('0x4f')](_0x2693fc+'CurrentCapacity')){_0x56df50[_0x0de8('0x47')][_0x1ad8c1['id']][_0x2693fc+_0x0de8('0x51')]=parseInt(_0x1ad8c1[_0x0de8('0x50')][_0x2693fc],0xa);}}}_0x56df50[_0x0de8('0x47')][_0x1ad8c1['id']]['updateRealtime']();return _0x29ed83({'code':0xc8,'message':_0x56df50[_0x0de8('0x47')][_0x1ad8c1['id']]});}else{return _0x3e45ec(_0x42e211[_0x0de8('0x44')](0x1f4,_0x0de8('0x52')));}});},'Agents':function(_0x49ff3d){return new Promise(function(_0x3f471a){var _0x3e0c94=_[_0x0de8('0x53')](_0x56df50[_0x0de8('0x47')]);if(_0x49ff3d&&_0x49ff3d['id']){var _0x27f0c1=_['find'](_0x3e0c94,function(_0x18b305){return _0x18b305['id']===_0x49ff3d['id'];});_0x3f471a(_0x27f0c1);}else{_0x3f471a({'count':_0x3e0c94[_0x0de8('0x1d')],'rows':_0x3e0c94});}});},'ChatQueues':function(){return new Promise(function(_0x35ac5e){var _0x56e607=[];for(var _0x308e08 in _0x56df50['chatQueues']){if(_0x56df50['chatQueues'][_0x0de8('0x4f')](_0x308e08)){var _0x36028b=_0x56df50[_0x0de8('0x54')][_0x308e08];var _0x5ee829={'id':_0x36028b['id'],'available':_0x36028b[_0x0de8('0x55')],'loggedIn':_0x36028b['loggedIn'],'name':_0x36028b['name'],'paused':_0x36028b[_0x0de8('0x56')],'waiting':_0x36028b[_0x0de8('0x57')]};_0x56e607[_0x0de8('0x25')](_0x5ee829);}}_0x35ac5e({'count':_0x56e607[_0x0de8('0x1d')],'rows':_0x56e607});});},'MailQueues':function(){return new Promise(function(_0x3336c0){var _0x34d98c=[];for(var _0x5c8946 in _0x56df50[_0x0de8('0x58')]){if(_0x56df50[_0x0de8('0x58')][_0x0de8('0x4f')](_0x5c8946)){var _0x2c092e=_0x56df50['mailQueues'][_0x5c8946];var _0xe8ea3c={'id':_0x2c092e['id'],'available':_0x2c092e[_0x0de8('0x55')],'loggedIn':_0x2c092e[_0x0de8('0x59')],'name':_0x2c092e[_0x0de8('0x5a')],'paused':_0x2c092e[_0x0de8('0x56')],'waiting':_0x2c092e[_0x0de8('0x57')]};_0x34d98c[_0x0de8('0x25')](_0xe8ea3c);}}_0x3336c0({'count':_0x34d98c[_0x0de8('0x1d')],'rows':_0x34d98c});});},'OpenchannelQueues':function(){return new Promise(function(_0x399764){var _0x2614a6=[];for(var _0x3a8e44 in _0x56df50[_0x0de8('0x5b')]){if(_0x56df50['openchannelQueues'][_0x0de8('0x4f')](_0x3a8e44)){var _0x4528a4=_0x56df50['openchannelQueues'][_0x3a8e44];var _0xb476e={'id':_0x4528a4['id'],'available':_0x4528a4[_0x0de8('0x55')],'loggedIn':_0x4528a4[_0x0de8('0x59')],'name':_0x4528a4[_0x0de8('0x5a')],'paused':_0x4528a4['paused'],'waiting':_0x4528a4[_0x0de8('0x57')]};_0x2614a6[_0x0de8('0x25')](_0xb476e);}}_0x399764({'count':_0x2614a6[_0x0de8('0x1d')],'rows':_0x2614a6});});},'SmsQueues':function(){return new Promise(function(_0x14f1d9){var _0x3b5a9d=[];for(var _0x390db7 in _0x56df50[_0x0de8('0x5c')]){if(_0x56df50['smsQueues'][_0x0de8('0x4f')](_0x390db7)){var _0x56e0e7=_0x56df50[_0x0de8('0x5c')][_0x390db7];var _0x39000e={'id':_0x56e0e7['id'],'available':_0x56e0e7[_0x0de8('0x55')],'loggedIn':_0x56e0e7[_0x0de8('0x59')],'name':_0x56e0e7[_0x0de8('0x5a')],'paused':_0x56e0e7['paused'],'waiting':_0x56e0e7[_0x0de8('0x57')]};_0x3b5a9d[_0x0de8('0x25')](_0x39000e);}}_0x14f1d9({'count':_0x3b5a9d[_0x0de8('0x1d')],'rows':_0x3b5a9d});});},'FaxQueues':function(){return new Promise(function(_0x5df1ac){var _0x3ff6ad=[];for(var _0x34c6d4 in _0x56df50[_0x0de8('0x5d')]){if(_0x56df50[_0x0de8('0x5d')][_0x0de8('0x4f')](_0x34c6d4)){var _0x5ce9d5=_0x56df50['faxQueues'][_0x34c6d4];var _0x16fc8e={'id':_0x5ce9d5['id'],'available':_0x5ce9d5[_0x0de8('0x55')],'loggedIn':_0x5ce9d5['loggedIn'],'name':_0x5ce9d5[_0x0de8('0x5a')],'paused':_0x5ce9d5[_0x0de8('0x56')],'waiting':_0x5ce9d5[_0x0de8('0x57')]};_0x3ff6ad[_0x0de8('0x25')](_0x16fc8e);}}_0x5df1ac({'count':_0x3ff6ad[_0x0de8('0x1d')],'rows':_0x3ff6ad});});},'WhatsappQueues':function(){return new Promise(function(_0xa1bf30){var _0x511027=[];for(var _0x5ce0b5 in _0x56df50[_0x0de8('0x5e')]){if(_0x56df50['whatsappQueues'][_0x0de8('0x4f')](_0x5ce0b5)){var _0x5c4441=_0x56df50[_0x0de8('0x5e')][_0x5ce0b5];var _0x50a1fe={'id':_0x5c4441['id'],'available':_0x5c4441['available'],'loggedIn':_0x5c4441[_0x0de8('0x59')],'name':_0x5c4441['name'],'paused':_0x5c4441[_0x0de8('0x56')],'waiting':_0x5c4441[_0x0de8('0x57')]};_0x511027[_0x0de8('0x25')](_0x50a1fe);}}_0xa1bf30({'count':_0x511027['length'],'rows':_0x511027});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x159691){var _0x427956=_[_0x0de8('0x53')](_0x56df50[_0x0de8('0x5f')]);_0x159691({'count':_0x427956[_0x0de8('0x1d')],'rows':_0x427956});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2c4b35){var _0x3fe115=_['values'](_0x56df50['mailQueuesWaitingInteractions']);_0x2c4b35({'count':_0x3fe115[_0x0de8('0x1d')],'rows':_0x3fe115});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x32f524){var _0x119ff5=_['values'](_0x56df50[_0x0de8('0x60')]);_0x32f524({'count':_0x119ff5[_0x0de8('0x1d')],'rows':_0x119ff5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x32d668){var _0x726761=_['values'](_0x56df50[_0x0de8('0x61')]);_0x32d668({'count':_0x726761[_0x0de8('0x1d')],'rows':_0x726761});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xd37fb2){var _0x379a51=_[_0x0de8('0x53')](_0x56df50[_0x0de8('0x62')]);_0xd37fb2({'count':_0x379a51['length'],'rows':_0x379a51});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b67f1){var _0x5d86d6=_[_0x0de8('0x53')](_0x56df50[_0x0de8('0x63')]);_0x2b67f1({'count':_0x5d86d6[_0x0de8('0x1d')],'rows':_0x5d86d6});});}};var _0x48b10c=jayson[_0x0de8('0x64')](_0x5ed903)['http']();_0x48b10c['on'](_0x0de8('0x44'),function(_0x4963fa){logger[_0x0de8('0x44')](JSON[_0x0de8('0x3f')](_0x4963fa));return _0x512541(_0x4963fa);});_0x48b10c[_0x0de8('0x14')](0x232c,_0x0de8('0x65'),function(){console['log'](_0x0de8('0x66'),0x232c);return _0x6a9b24(_0x0de8('0x67')+0x232c);});});}; \ No newline at end of file +var _0xc16d=['http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','listen','rules','message','interaction','checkWaitingNotifications','isArray','applications','existsSync','.js','app','toLowerCase','autoreply','split','channel','mail','push','length','join','slice','dialogflow','dialogflowv2','appdata','amazonlex','tag','tvox','getMustacheRender','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','updateRealtime','find','chatQueues','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server'];(function(_0x236a97,_0x2da25a){var _0x4b2fba=function(_0x280ed1){while(--_0x280ed1){_0x236a97['push'](_0x236a97['shift']());}};_0x4b2fba(++_0x2da25a);}(_0xc16d,0x145));var _0xdc16=function(_0x7e3f56,_0x1566e9){_0x7e3f56=_0x7e3f56-0x0;var _0x5758c4=_0xc16d[_0x7e3f56];return _0x5758c4;};'use strict';var _=require(_0xdc16('0x0'));var util=require(_0xdc16('0x1'));var path=require(_0xdc16('0x2'));var fs=require('fs');var jayson=require(_0xdc16('0x3'));var BPromise=require(_0xdc16('0x4'));var utils=require(_0xdc16('0x5'));var sUtils=require(_0xdc16('0x6'));var logger=require('../../../config/logger')(_0xdc16('0x7'));var rpc={'openchannelQueueReport':require(_0xdc16('0x8')),'mailQueueReport':require(_0xdc16('0x9')),'chatQueueReport':require(_0xdc16('0xa')),'smsQueueReport':require(_0xdc16('0xb')),'faxQueueReport':require(_0xdc16('0xc')),'whatsappQueueReport':require(_0xdc16('0xd'))};var RuleEngine=require(_0xdc16('0xe'));function getId(_0x281789,_0x473d25,_0x25bde7){return util[_0xdc16('0xf')](_0xdc16('0x10'),_0x281789,_0x473d25||0x0,_0x25bde7||0x0);}function getIntervals(_0x1c9639,_0x368d23){var _0x430bdc=[];if(!_['isNil'](_0x368d23[_0xdc16('0x11')])&&!_[_0xdc16('0x12')](_0x1c9639[_0x368d23[_0xdc16('0x11')]])&&!_[_0xdc16('0x12')](_0x1c9639[_0x368d23['IntervalId']][_0xdc16('0x13')])){_0x430bdc=_[_0xdc16('0x14')](_0x1c9639[_0x368d23[_0xdc16('0x11')]][_0xdc16('0x13')],'interval');}else if(!_[_0xdc16('0x12')](_0x368d23['interval'])){_0x430bdc=[_0x368d23['interval']];}return _0x430bdc;}exports[_0xdc16('0x15')]=function(_0x50d023){_0x50d023[_0xdc16('0x16')]={};return new BPromise(function(_0x42b482,_0x1a9f4f){var _0x5677a4={'Start':function(_0xd7ff38){var _0x5a2b26=this;return new Promise(function(_0x33d3e7,_0x13742b){if(_0xd7ff38){try{var _0x67b9b0=[];var _0x396bed=getId(_0xd7ff38['channel'],_0xd7ff38[_0xdc16('0x17')]?_0xd7ff38[_0xdc16('0x17')]['id']:0x0,_0xd7ff38['interaction']?_0xd7ff38[_0xdc16('0x18')]['id']:0x0);var _0x3bf134=sUtils[_0xdc16('0x19')](_0x50d023,_0xd7ff38);if(_0xd7ff38['transfer']||!_0x3bf134&&_0xd7ff38['applications']&&_[_0xdc16('0x1a')](_0xd7ff38[_0xdc16('0x1b')])&&_0xd7ff38[_0xdc16('0x1b')]['length']){for(var _0x4b1afb=0x0;_0x4b1afb<_0xd7ff38['applications']['length'];_0x4b1afb+=0x1){var _0x192f74=_0xd7ff38[_0xdc16('0x1b')][_0x4b1afb];if(fs[_0xdc16('0x1c')](path['join'](__dirname,'applications',_0x192f74['app']+_0xdc16('0x1d')))){var _0x50d974=[];switch(_0x192f74[_0xdc16('0x1e')][_0xdc16('0x1f')]()){case _0xdc16('0x20'):var _0x4ae7fc=_0x192f74['appdata'][_0xdc16('0x21')](',');if(_0xd7ff38[_0xdc16('0x22')]===_0xdc16('0x23')){_0x50d974[_0xdc16('0x24')](_0x4ae7fc[0x0]);_0x50d974['push'](_0x4ae7fc[0x1]);_0x50d974['push'](_0x4ae7fc['slice'](0x2,_0x4ae7fc[_0xdc16('0x25')])[_0xdc16('0x26')](','));}else{_0x50d974[_0xdc16('0x24')](_0x4ae7fc[0x0]);_0x50d974[_0xdc16('0x24')](_0x4ae7fc[_0xdc16('0x27')](0x1,_0x4ae7fc[_0xdc16('0x25')])[_0xdc16('0x26')](','));}break;case _0xdc16('0x28'):var _0x5c8970=_0x192f74['appdata'][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x5c8970[0x0]);_0x50d974['push'](_0x5c8970[0x1]);_0x50d974[_0xdc16('0x24')](_0x5c8970['slice'](0x2,_0x5c8970[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x29'):var _0x4c1592=_0x192f74[_0xdc16('0x2a')][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x4c1592[0x0]);_0x50d974['push'](_0x4c1592[0x1]);_0x50d974[_0xdc16('0x24')](_0x4c1592[0x2]);_0x50d974[_0xdc16('0x24')](_0x4c1592[0x3]);_0x50d974[_0xdc16('0x24')](_0x4c1592['slice'](0x4,_0x4c1592[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x2b'):var _0x273359=_0x192f74[_0xdc16('0x2a')]['split'](',');_0x50d974[_0xdc16('0x24')](_0x273359[0x0]);_0x50d974[_0xdc16('0x24')](_0x273359[0x1]);_0x50d974[_0xdc16('0x24')](_0x273359[0x2]);_0x50d974[_0xdc16('0x24')](_0x273359[0x3]);_0x50d974[_0xdc16('0x24')](_0x273359['slice'](0x4,_0x273359[_0xdc16('0x25')])[_0xdc16('0x26')](','));break;case _0xdc16('0x17'):_0x50d974['push'](_0x192f74[_0xdc16('0x2a')]);break;case _0xdc16('0x2c'):_0x50d974[_0xdc16('0x24')](_0x192f74['TagId']);_0x50d974[_0xdc16('0x24')](_0x192f74['appdata']);break;case _0xdc16('0x2d'):var _0x195811=utils[_0xdc16('0x2e')](_0xd7ff38['account']['notificationTemplate'],_0xd7ff38);var _0x55cfb2=_0x192f74['appdata'][_0xdc16('0x21')](',');_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x0]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x1]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x2]);_0x50d974['push'](_0x55cfb2[0x3]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x4]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x5]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x6]);_0x50d974['push'](_0x55cfb2[0x7]);_0x50d974['push'](_0x55cfb2[0x8]);_0x50d974[_0xdc16('0x24')](_0x55cfb2[0x9]);_0x50d974['push'](_0x55cfb2[0xa]);_0x50d974[_0xdc16('0x24')](_0xd7ff38[_0xdc16('0x18')]['id']);_0x50d974[_0xdc16('0x24')](_0xd7ff38[_0xdc16('0x17')]['id']);_0x50d974[_0xdc16('0x24')](_0x192f74[_0xdc16('0x2f')]);_0x50d974[_0xdc16('0x24')](_0xd7ff38['interaction'][_0xdc16('0x30')]);_0x50d974['push'](_0xd7ff38['body'][_0xdc16('0x31')]);_0x50d974['push'](_0x195811);break;default:_0x50d974=_['isNil'](_0x192f74[_0xdc16('0x2a')])?[]:_0x192f74[_0xdc16('0x2a')][_0xdc16('0x21')](',');}var _0x177c30={'id':util[_0xdc16('0xf')](_0xdc16('0x32'),_0x396bed,_0x192f74['id'],_0x192f74[_0xdc16('0x1e')]),'condition':require('./interval')[_0xdc16('0x33')](_0x396bed,getIntervals(_0x50d023['intervals'],_0x192f74),_0x50d023),'consequence':require(_0xdc16('0x34')+_0x192f74['app'])['consequence'](_0x396bed,_0x50d974,_0x50d023,_0xd7ff38),'p':_0x192f74[_0xdc16('0x35')]||0x0};logger[_0xdc16('0x36')](_0xdc16('0x37'),_0x177c30['id'],_0xdc16('0x38'),getIntervals(_0x50d023[_0xdc16('0x39')],_0x192f74)[_0xdc16('0x26')](_0xdc16('0x3a')));_0x67b9b0['push'](_0x177c30);}else{logger['error'](_0xdc16('0x3b'),path[_0xdc16('0x26')](__dirname,_0xdc16('0x1b'),_0x192f74[_0xdc16('0x1e')]+_0xdc16('0x1d')));}}_0x50d023[_0xdc16('0x16')][_0x396bed]=new RuleEngine(_0x67b9b0);_0x50d023[_0xdc16('0x16')][_0x396bed][_0xdc16('0x3c')](_0xd7ff38,function(_0x1d9c7e){logger[_0xdc16('0x36')](_0xdc16('0x3d'),JSON[_0xdc16('0x3e')](_0x1d9c7e[_0xdc16('0x3f')]));if(_0x50d023[_0xdc16('0x16')][_0x396bed]){_0x50d023[_0xdc16('0x16')][_0x396bed][_0xdc16('0x40')]('complete');}});return _0x33d3e7({'code':0xc8,'message':_0xd7ff38});}else{if(_0x3bf134){logger[_0xdc16('0x36')](util['format']('Skipped\x20routing\x20for\x20%s',_0x396bed));}else{logger[_0xdc16('0x36')](_0xdc16('0x41'));}return _0x33d3e7({'code':0xc8,'message':_0xd7ff38});}}catch(_0x16ca3d){logger[_0xdc16('0x42')](_0x16ca3d[_0xdc16('0x43')]);return _0x13742b(_0x5a2b26[_0xdc16('0x42')](0x1f4,_0x16ca3d));}}return _0x13742b(_0xdc16('0x44'));});},'AcceptMessage':function(_0x3be11b){var _0x2752d4=this;return new Promise(function(_0x5c74b3,_0x3b48a5){if(_0x3be11b[_0xdc16('0x45')]&&_0x3be11b[_0xdc16('0x45')]['id']){if(_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']]){_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']]['busy']=![];_0x50d023[_0xdc16('0x46')][_0x3be11b[_0xdc16('0x45')]['id']][_0xdc16('0x47')]=undefined;}}if(_0x3be11b['message']&&_0x3be11b[_0xdc16('0x17')]['id']){try{var _0x215840=getId(_0x3be11b[_0xdc16('0x22')],_0x3be11b['message']?_0x3be11b[_0xdc16('0x17')]['id']:0x0,_0x3be11b[_0xdc16('0x18')]?_0x3be11b['interaction']['id']:0x0);if(_0x50d023[_0xdc16('0x16')][_0x215840]){_0x50d023['rules'][_0x215840][_0xdc16('0x40')](_0xdc16('0x48'));if(rpc[_0x3be11b[_0xdc16('0x22')]+_0xdc16('0x49')]){rpc[_0x3be11b[_0xdc16('0x22')]+_0xdc16('0x49')][_0xdc16('0x4a')](_0x215840,{'UserId':_0x3be11b[_0xdc16('0x17')][_0xdc16('0x4b')]})[_0xdc16('0x4c')](function(){logger[_0xdc16('0x42')](_0xdc16('0x4d'));});}}return _0x5c74b3({'code':0xc8,'message':_0x3be11b});}catch(_0x8e36b0){logger['error'](_0x8e36b0['stack']);return _0x3b48a5(_0x2752d4[_0xdc16('0x42')](0x1f4,_0x8e36b0));}}logger[_0xdc16('0x42')](_0xdc16('0x4e'));return _0x3b48a5(_0x2752d4[_0xdc16('0x42')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x566859){var _0x34486b=this;return new Promise(function(_0x547cb2,_0x1ca4c6){if(_0x566859[_0xdc16('0x45')]&&_0x566859['agent']['id']){try{if(_0x50d023[_0xdc16('0x46')][_0x566859[_0xdc16('0x45')]['id']]){_0x50d023[_0xdc16('0x46')][_0x566859['agent']['id']][_0xdc16('0x4f')]=![];_0x50d023[_0xdc16('0x46')][_0x566859['agent']['id']]['busyQueue']=undefined;}return _0x547cb2({'code':0xc8,'message':_0x566859});}catch(_0x2afc62){logger[_0xdc16('0x42')](_0x2afc62[_0xdc16('0x43')]);return _0x1ca4c6(_0x34486b[_0xdc16('0x42')](0x1f4,_0x2afc62));}}logger['error'](_0xdc16('0x4e'));return _0x1ca4c6(_0x34486b[_0xdc16('0x42')](0x1f4,_0xdc16('0x4e')));});},'AbandonInteraction':function(_0x4d5982){var _0x3fd969=this;return new Promise(function(_0x4ac056,_0x5a4d32){if(_0x4d5982['channel']&&_0x4d5982[_0xdc16('0x18')]&&_0x4d5982[_0xdc16('0x18')]['id']){try{var _0x525a38=getId(_0x4d5982[_0xdc16('0x22')],_0x4d5982['message']?_0x4d5982[_0xdc16('0x17')]['id']:0x0,_0x4d5982[_0xdc16('0x18')]?_0x4d5982[_0xdc16('0x18')]['id']:0x0);if(_0x50d023[_0xdc16('0x16')][_0x525a38]){_0x50d023[_0xdc16('0x16')][_0x525a38][_0xdc16('0x40')](_0xdc16('0x48'));}return _0x4ac056({'code':0xc8,'message':_0x4d5982});}catch(_0x2be044){logger[_0xdc16('0x42')](_0x2be044['stack']);return _0x5a4d32(_0x3fd969[_0xdc16('0x42')](0x1f4,_0x2be044));}}logger[_0xdc16('0x42')]('message\x20is\x20empty');return _0x5a4d32(_0x3fd969[_0xdc16('0x42')](0x1f4,_0xdc16('0x4e')));});},'AgentCapacity':function(_0x13efba){var _0x429dcc=this;return new Promise(function(_0x574ce2,_0x59369c){if(_0x50d023[_0xdc16('0x46')][_0xdc16('0x50')](_0x13efba['id'])){for(var _0x108cc0 in _0x13efba['capacity']){if(_0x13efba[_0xdc16('0x51')]['hasOwnProperty'](_0x108cc0)){if(_0x50d023[_0xdc16('0x46')][_0x13efba['id']][_0xdc16('0x50')](_0x108cc0+'CurrentCapacity')){_0x50d023['agents'][_0x13efba['id']][_0x108cc0+'CurrentCapacity']=parseInt(_0x13efba[_0xdc16('0x51')][_0x108cc0],0xa);}}}_0x50d023[_0xdc16('0x46')][_0x13efba['id']][_0xdc16('0x52')]();return _0x574ce2({'code':0xc8,'message':_0x50d023['agents'][_0x13efba['id']]});}else{return _0x59369c(_0x429dcc['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xff094c){return new Promise(function(_0x4a5ee0){var _0x5f0b0c=_['values'](_0x50d023[_0xdc16('0x46')]);if(_0xff094c&&_0xff094c['id']){var _0x31d406=_[_0xdc16('0x53')](_0x5f0b0c,function(_0x5dfe00){return _0x5dfe00['id']===_0xff094c['id'];});_0x4a5ee0(_0x31d406);}else{_0x4a5ee0({'count':_0x5f0b0c[_0xdc16('0x25')],'rows':_0x5f0b0c});}});},'ChatQueues':function(){return new Promise(function(_0xa05a59){var _0x5d7a1b=[];for(var _0x198702 in _0x50d023['chatQueues']){if(_0x50d023[_0xdc16('0x54')][_0xdc16('0x50')](_0x198702)){var _0x1d1ade=_0x50d023['chatQueues'][_0x198702];var _0x103da2={'id':_0x1d1ade['id'],'available':_0x1d1ade['available'],'loggedIn':_0x1d1ade[_0xdc16('0x55')],'name':_0x1d1ade[_0xdc16('0x56')],'paused':_0x1d1ade[_0xdc16('0x57')],'waiting':_0x1d1ade['waiting']};_0x5d7a1b[_0xdc16('0x24')](_0x103da2);}}_0xa05a59({'count':_0x5d7a1b[_0xdc16('0x25')],'rows':_0x5d7a1b});});},'MailQueues':function(){return new Promise(function(_0x25f2ea){var _0x581680=[];for(var _0x3bd55f in _0x50d023[_0xdc16('0x58')]){if(_0x50d023['mailQueues'][_0xdc16('0x50')](_0x3bd55f)){var _0x4c8cef=_0x50d023['mailQueues'][_0x3bd55f];var _0xe09ab6={'id':_0x4c8cef['id'],'available':_0x4c8cef['available'],'loggedIn':_0x4c8cef['loggedIn'],'name':_0x4c8cef[_0xdc16('0x56')],'paused':_0x4c8cef[_0xdc16('0x57')],'waiting':_0x4c8cef[_0xdc16('0x59')]};_0x581680[_0xdc16('0x24')](_0xe09ab6);}}_0x25f2ea({'count':_0x581680[_0xdc16('0x25')],'rows':_0x581680});});},'OpenchannelQueues':function(){return new Promise(function(_0x353e5f){var _0x310782=[];for(var _0x3c2004 in _0x50d023[_0xdc16('0x5a')]){if(_0x50d023['openchannelQueues'][_0xdc16('0x50')](_0x3c2004)){var _0xcf9b91=_0x50d023[_0xdc16('0x5a')][_0x3c2004];var _0x52936d={'id':_0xcf9b91['id'],'available':_0xcf9b91[_0xdc16('0x5b')],'loggedIn':_0xcf9b91['loggedIn'],'name':_0xcf9b91[_0xdc16('0x56')],'paused':_0xcf9b91[_0xdc16('0x57')],'waiting':_0xcf9b91['waiting']};_0x310782[_0xdc16('0x24')](_0x52936d);}}_0x353e5f({'count':_0x310782['length'],'rows':_0x310782});});},'SmsQueues':function(){return new Promise(function(_0x59d40a){var _0x1abfff=[];for(var _0x5b903e in _0x50d023[_0xdc16('0x5c')]){if(_0x50d023[_0xdc16('0x5c')][_0xdc16('0x50')](_0x5b903e)){var _0xca7bf=_0x50d023[_0xdc16('0x5c')][_0x5b903e];var _0x196c64={'id':_0xca7bf['id'],'available':_0xca7bf[_0xdc16('0x5b')],'loggedIn':_0xca7bf[_0xdc16('0x55')],'name':_0xca7bf[_0xdc16('0x56')],'paused':_0xca7bf['paused'],'waiting':_0xca7bf[_0xdc16('0x59')]};_0x1abfff[_0xdc16('0x24')](_0x196c64);}}_0x59d40a({'count':_0x1abfff[_0xdc16('0x25')],'rows':_0x1abfff});});},'FaxQueues':function(){return new Promise(function(_0x437e01){var _0x2616ee=[];for(var _0x15cd22 in _0x50d023[_0xdc16('0x5d')]){if(_0x50d023[_0xdc16('0x5d')][_0xdc16('0x50')](_0x15cd22)){var _0x1ae0d9=_0x50d023[_0xdc16('0x5d')][_0x15cd22];var _0x3e3ea0={'id':_0x1ae0d9['id'],'available':_0x1ae0d9[_0xdc16('0x5b')],'loggedIn':_0x1ae0d9[_0xdc16('0x55')],'name':_0x1ae0d9['name'],'paused':_0x1ae0d9[_0xdc16('0x57')],'waiting':_0x1ae0d9[_0xdc16('0x59')]};_0x2616ee['push'](_0x3e3ea0);}}_0x437e01({'count':_0x2616ee[_0xdc16('0x25')],'rows':_0x2616ee});});},'WhatsappQueues':function(){return new Promise(function(_0x31f744){var _0x1fa2af=[];for(var _0xe558f4 in _0x50d023['whatsappQueues']){if(_0x50d023[_0xdc16('0x5e')][_0xdc16('0x50')](_0xe558f4)){var _0x4231f7=_0x50d023[_0xdc16('0x5e')][_0xe558f4];var _0x2ddc92={'id':_0x4231f7['id'],'available':_0x4231f7['available'],'loggedIn':_0x4231f7[_0xdc16('0x55')],'name':_0x4231f7[_0xdc16('0x56')],'paused':_0x4231f7['paused'],'waiting':_0x4231f7[_0xdc16('0x59')]};_0x1fa2af[_0xdc16('0x24')](_0x2ddc92);}}_0x31f744({'count':_0x1fa2af['length'],'rows':_0x1fa2af});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2fdd17){var _0x2f7562=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x60')]);_0x2fdd17({'count':_0x2f7562['length'],'rows':_0x2f7562});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1d6431){var _0x3144d0=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x61')]);_0x1d6431({'count':_0x3144d0[_0xdc16('0x25')],'rows':_0x3144d0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1c08c1){var _0x3e511a=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x62')]);_0x1c08c1({'count':_0x3e511a['length'],'rows':_0x3e511a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1da234){var _0x2eb600=_['values'](_0x50d023[_0xdc16('0x63')]);_0x1da234({'count':_0x2eb600[_0xdc16('0x25')],'rows':_0x2eb600});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5f4d1b){var _0x4232f5=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x64')]);_0x5f4d1b({'count':_0x4232f5['length'],'rows':_0x4232f5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x40d199){var _0x58e345=_[_0xdc16('0x5f')](_0x50d023[_0xdc16('0x65')]);_0x40d199({'count':_0x58e345['length'],'rows':_0x58e345});});}};var _0x44c503=jayson[_0xdc16('0x66')](_0x5677a4)[_0xdc16('0x67')]();_0x44c503['on'](_0xdc16('0x42'),function(_0x16fb5b){logger[_0xdc16('0x42')](JSON['stringify'](_0x16fb5b));return _0x1a9f4f(_0x16fb5b);});_0x44c503[_0xdc16('0x15')](0x232c,_0xdc16('0x68'),function(){console['log'](_0xdc16('0x69'),0x232c);return _0x42b482(_0xdc16('0x6a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9f855d0..d8a6521 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 _0xe0d5=['indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','stop','util','bluebird','jayson/promise','../../../config/logger','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0d5,0xf3));var _0x5e0d=function(_0x4c9641,_0x3a78b9){_0x4c9641=_0x4c9641-0x0;var _0x22ef15=_0xe0d5[_0x4c9641];return _0x22ef15;};'use strict';var util=require(_0x5e0d('0x0'));var BPromise=require(_0x5e0d('0x1'));var jayson=require(_0x5e0d('0x2'));var _=require('lodash');var logger=require(_0x5e0d('0x3'))('routing');var client=jayson['client'][_0x5e0d('0x4')]({'port':0x232a});function request(_0x3c8ca7,_0x14d4dd){return new BPromise(function(_0x230beb,_0x1d0ec6){return client['request'](_0x3c8ca7,_0x14d4dd)[_0x5e0d('0x5')](function(_0x5906be){if(_0x5906be[_0x5e0d('0x6')]){return _0x1d0ec6(_0x5906be[_0x5e0d('0x6')][_0x5e0d('0x7')]);}else{return _0x230beb(_0x5906be[_0x5e0d('0x8')]);}})[_0x5e0d('0x9')](function(_0x2ad543){return _0x1d0ec6(_0x2ad543);});});}exports[_0x5e0d('0xa')]=function(_0x5153f9,_0x1b9e75,_0x130620){return function(_0x3e4f1d){if(_0x130620[_0x5e0d('0xb')]&&!_0x130620[_0x5e0d('0xb')][_0x5153f9]){logger[_0x5e0d('0xc')](_0x5e0d('0xd'),_0x5153f9);return _0x3e4f1d['stop']();}var _0x1d2e91=[];for(var _0x25fad6=0x0;_0x25fad6<_0x1b9e75[_0x5e0d('0xe')];_0x25fad6+=0x1){_0x1d2e91[_0x5e0d('0xf')](request(_0x5e0d('0x10'),{'command':util[_0x5e0d('0x11')]('iftime\x20%s',_0x1b9e75[_0x25fad6])})[_0x5e0d('0x5')](function(_0x5f0dcd){return _0x5f0dcd&&_0x5f0dcd[_0x5e0d('0x7')]&&_0x5f0dcd[_0x5e0d('0x7')][_0x5e0d('0x12')](_0x5e0d('0x13'))>=0x0?!![]:![];})[_0x5e0d('0x9')](function(){logger[_0x5e0d('0x6')](_0x5e0d('0x14'),_0x5153f9,_0x1b9e75[_0x25fad6]);}));}BPromise[_0x5e0d('0x15')](_0x1d2e91)[_0x5e0d('0x5')](function(_0x3fc357){var _0x13bf3a=_[_0x5e0d('0x16')](_0x3fc357);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x5153f9,_0x1b9e75[_0x5e0d('0x17')](_0x5e0d('0x18')),_0x13bf3a);_0x3e4f1d[_0x5e0d('0x19')](_0x13bf3a);})[_0x5e0d('0x9')](function(_0x5b6933){logger['error'](_0x5e0d('0x1a'),_0x5153f9,_0x1b9e75[_0x5e0d('0x17')](_0x5e0d('0x18')),_0x5b6933[_0x5e0d('0x1b')]);_0x3e4f1d[_0x5e0d('0x1c')]();});};}; \ No newline at end of file +var _0x8667=['../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','util','bluebird','jayson/promise','lodash'];(function(_0xfe70ca,_0x331c02){var _0x2fa44e=function(_0x262695){while(--_0x262695){_0xfe70ca['push'](_0xfe70ca['shift']());}};_0x2fa44e(++_0x331c02);}(_0x8667,0xf4));var _0x7866=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8667[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x7866('0x0'));var BPromise=require(_0x7866('0x1'));var jayson=require(_0x7866('0x2'));var _=require(_0x7866('0x3'));var logger=require(_0x7866('0x4'))(_0x7866('0x5'));var client=jayson[_0x7866('0x6')][_0x7866('0x7')]({'port':0x232a});function request(_0x36f7b0,_0x39ff39){return new BPromise(function(_0x193554,_0x2842e1){return client[_0x7866('0x8')](_0x36f7b0,_0x39ff39)[_0x7866('0x9')](function(_0x19ebd4){if(_0x19ebd4[_0x7866('0xa')]){return _0x2842e1(_0x19ebd4[_0x7866('0xa')][_0x7866('0xb')]);}else{return _0x193554(_0x19ebd4[_0x7866('0xc')]);}})[_0x7866('0xd')](function(_0x2cf41a){return _0x2842e1(_0x2cf41a);});});}exports[_0x7866('0xe')]=function(_0x7ecf02,_0x5945af,_0x2a108f){return function(_0x5a1442){if(_0x2a108f[_0x7866('0xf')]&&!_0x2a108f[_0x7866('0xf')][_0x7ecf02]){logger[_0x7866('0x10')](_0x7866('0x11'),_0x7ecf02);return _0x5a1442['stop']();}var _0x330a2c=[];for(var _0x406c84=0x0;_0x406c84<_0x5945af['length'];_0x406c84+=0x1){_0x330a2c[_0x7866('0x12')](request(_0x7866('0x13'),{'command':util[_0x7866('0x14')](_0x7866('0x15'),_0x5945af[_0x406c84])})['then'](function(_0x42b940){return _0x42b940&&_0x42b940[_0x7866('0xb')]&&_0x42b940[_0x7866('0xb')]['indexOf'](_0x7866('0x16'))>=0x0?!![]:![];})[_0x7866('0xd')](function(){logger['error'](_0x7866('0x17'),_0x7ecf02,_0x5945af[_0x406c84]);}));}BPromise[_0x7866('0x18')](_0x330a2c)[_0x7866('0x9')](function(_0x15186f){var _0x3dd0db=_[_0x7866('0x19')](_0x15186f);logger[_0x7866('0x10')](_0x7866('0x1a'),_0x7ecf02,_0x5945af[_0x7866('0x1b')](_0x7866('0x1c')),_0x3dd0db);_0x5a1442[_0x7866('0x1d')](_0x3dd0db);})['catch'](function(_0x156aa9){logger[_0x7866('0xa')](_0x7866('0x1a'),_0x7ecf02,_0x5945af[_0x7866('0x1b')](_0x7866('0x1c')),_0x156aa9['stack']);_0x5a1442[_0x7866('0x1e')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7ded8c1..5afcf29 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 _0x2547=['transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x20ab29,_0x4d961a){var _0x512309=function(_0x1906b5){while(--_0x1906b5){_0x20ab29['push'](_0x20ab29['shift']());}};_0x512309(++_0x4d961a);}(_0x2547,0x1cd));var _0x7254=function(_0x3d7201,_0x2ab5ca){_0x3d7201=_0x3d7201-0x0;var _0x2ca3ca=_0x2547[_0x3d7201];return _0x2ca3ca;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var utils=require(_0x7254('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44b692,_0x3ea6e6){utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x4'),_0x44b692[_0x7254('0x5')],_0x44b692['channel'],_0x44b692[_0x7254('0x6')],_0x44b692[_0x7254('0x7')],_0x44b692[_0x7254('0x8')],_0x44b692[_0x7254('0x9')],_0x44b692['connectedlinenum'],_0x44b692[_0x7254('0xa')]));if(_0x44b692[_0x7254('0x6')]){utils[_0x7254('0xb')](_0x44b692['queue'])[_0x7254('0xc')](function(_0x555b2e){if(_0x555b2e){_0x44b692['type']=_0x555b2e['type'];_0x44b692[_0x7254('0xd')]=_0x44b692[_0x7254('0xe')]?_0x555b2e[_0x7254('0xf')]:![];_0x44b692[_0x7254('0x10')]=_0x44b692[_0x7254('0xd')]?_0x555b2e[_0x7254('0x11')]:0x0;}utils['request'](_0x7254('0x12'),_0x44b692);});}else{utils['request'](_0x7254('0x12'),_0x44b692);}if(_0x3ea6e6){delete transfers[_0x44b692['uniqueid']];}else{delete agents[_0x44b692[_0x7254('0x13')]];}}exports[_0x7254('0x14')]=function(_0x348d4e){try{utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x16'),_0x348d4e[_0x7254('0x5')]),_0x348d4e);agents[_0x348d4e[_0x7254('0x13')]]=_0x348d4e;agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x17')]=utils[_0x7254('0x18')]();agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0xa')]='called';agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x19')]=null;agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x1a')]=null;utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x1b'),_0x348d4e['uniqueid'],agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x7')],_0x348d4e[_0x7254('0x13')]));}catch(_0x45aa93){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x16'),_0x348d4e[_0x7254('0x5')]),_0x45aa93);}};exports[_0x7254('0x1d')]=function(_0x3b6cb6){try{if(!_[_0x7254('0x1e')](agents[_0x3b6cb6[_0x7254('0x13')]])){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x1f'),_0x3b6cb6[_0x7254('0x5')]),_0x3b6cb6);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x20'),_0x3b6cb6[_0x7254('0x5')],agents[_0x3b6cb6[_0x7254('0x13')]]['membername'],_0x3b6cb6['destuniqueid']));agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x1d')]=!![];agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x21')]=utils[_0x7254('0x18')]();agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0xa')]='timeout';agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x22')]=_0x7254('0x23');agents[_0x3b6cb6['destuniqueid']][_0x7254('0x24')]=_0x3b6cb6['ringtime']?parseInt(_0x3b6cb6[_0x7254('0x25')])/0x3e8:0x0;agents[_0x3b6cb6[_0x7254('0x13')]]['talktime']=0x0;unanswered[_0x7254('0x26')](_0x3b6cb6[_0x7254('0x13')]);}}catch(_0x4f684c){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x1f'),_0x3b6cb6[_0x7254('0x5')]),_0x4f684c);}};exports[_0x7254('0x27')]=function(_0xfe02ea){try{_['forIn'](agents,function(_0x146028,_0x2dba3f){if(_0x146028['uniqueid']==_0xfe02ea[_0x7254('0x5')]&&!_[_0x7254('0x28')](unanswered,_0x146028[_0x7254('0x13')])){utils['debug'](util[_0x7254('0x3')](_0x7254('0x29'),_0xfe02ea[_0x7254('0x5')]),_0xfe02ea);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x2a'),_0xfe02ea[_0x7254('0x5')],_0x146028['membername'],_0x146028[_0x7254('0x13')]));_0x146028['agentringnoanswer']=!![];_0x146028['agentringnoanswerAt']=utils[_0x7254('0x18')]();_0x146028[_0x7254('0xa')]=_0x7254('0x2b');_0x146028[_0x7254('0x22')]=_0x7254('0x2b');_0x146028[_0x7254('0x24')]=_0xfe02ea[_0x7254('0x24')];_0x146028[_0x7254('0x2c')]=0x0;writeDB(_0x146028);}});}catch(_0x447515){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x29'),_0xfe02ea[_0x7254('0x5')]),_0x447515);}};exports[_0x7254('0x2d')]=function(_0x57a7d4){try{if(agents[_0x57a7d4[_0x7254('0x13')]]){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x2e'),_0x57a7d4[_0x7254('0x5')]),_0x57a7d4);utils['info'](util[_0x7254('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x57a7d4[_0x7254('0x5')],agents[_0x57a7d4[_0x7254('0x13')]][_0x7254('0x7')],_0x57a7d4[_0x7254('0x13')]));agents[_0x57a7d4[_0x7254('0x13')]]['agentconnectAt']=utils[_0x7254('0x18')]();agents[_0x57a7d4['destuniqueid']][_0x7254('0x19')]=_0x57a7d4[_0x7254('0x19')];agents[_0x57a7d4['destuniqueid']][_0x7254('0x1a')]=_0x57a7d4[_0x7254('0x1a')];agents[_0x57a7d4[_0x7254('0x13')]][_0x7254('0x24')]=_0x57a7d4[_0x7254('0x25')];agents[_0x57a7d4[_0x7254('0x13')]]['lastevent']=_0x7254('0x2f');_[_0x7254('0x30')](agents,function(_0x105b8c,_0x4eca7a){if(_0x105b8c[_0x7254('0x13')]!=_0x57a7d4[_0x7254('0x13')]&&_0x105b8c[_0x7254('0x5')]==_0x57a7d4['uniqueid']){_0x105b8c[_0x7254('0x2c')]=0x0;_0x105b8c[_0x7254('0x24')]=_0x57a7d4[_0x7254('0x25')];_0x105b8c[_0x7254('0x1d')]=!![];_0x105b8c[_0x7254('0x21')]=utils['now']();_0x105b8c['lastevent']=_0x7254('0x31');_0x105b8c[_0x7254('0x22')]=_0x7254('0x31');_0x105b8c[_0x7254('0x32')]=_0x57a7d4['destuniqueid'];_0x105b8c['answeredelsewheremembername']=_0x57a7d4[_0x7254('0x7')];writeDB(_0x105b8c);}});}}catch(_0x565cd8){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x2e'),_0x57a7d4[_0x7254('0x5')]),_0x565cd8);}};exports['agentcomplete']=function(_0x4adf34){try{if(!_[_0x7254('0x1e')](agents[_0x4adf34[_0x7254('0x13')]])){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x33'),_0x4adf34['uniqueid']),_0x4adf34);utils['info'](util[_0x7254('0x3')](_0x7254('0x34'),_0x4adf34[_0x7254('0x5')],agents[_0x4adf34['destuniqueid']][_0x7254('0x7')],_0x4adf34[_0x7254('0x13')]));agents[_0x4adf34['destuniqueid']][_0x7254('0xe')]=!![];agents[_0x4adf34[_0x7254('0x13')]][_0x7254('0x35')]=utils[_0x7254('0x18')]();agents[_0x4adf34['destuniqueid']][_0x7254('0x2c')]=utils[_0x7254('0x36')](agents[_0x4adf34['destuniqueid']][_0x7254('0x35')],agents[_0x4adf34[_0x7254('0x13')]][_0x7254('0x37')]);agents[_0x4adf34['destuniqueid']][_0x7254('0x22')]=_0x4adf34[_0x7254('0x22')];agents[_0x4adf34['destuniqueid']]['lastevent']=_0x7254('0x38');writeDB(agents[_0x4adf34['destuniqueid']]);}}catch(_0x2e437c){utils[_0x7254('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x4adf34[_0x7254('0x5')]),_0x2e437c);}};exports[_0x7254('0x39')]=function(_0x38bcd5){try{if(!_[_0x7254('0x1e')](agents[_0x38bcd5[_0x7254('0x3a')]])){utils[_0x7254('0x15')](util['format'](_0x7254('0x3b'),_0x38bcd5['uniqueid']),_0x38bcd5);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x3c'),_0x38bcd5['uniqueid'],agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x7')],agents[_0x38bcd5[_0x7254('0x3a')]]['uniqueid']));agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x3d')]=!![];agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x3e')]=_0x7254('0x3f');agents[_0x38bcd5['transfereruniqueid']]['transferexten']=_0x38bcd5[_0x7254('0x40')];agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x41')]=agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x5')];}}catch(_0x4c6838){utils['error'](util[_0x7254('0x3')](_0x7254('0x3b'),_0x38bcd5[_0x7254('0x5')]),_0x4c6838);}};exports[_0x7254('0x42')]=function(_0x5061be){try{utils[_0x7254('0x15')](util[_0x7254('0x3')]('[%s][agents][attendedtransfer]',_0x5061be[_0x7254('0x43')]),_0x5061be);if(_0x5061be['origtransfereruniqueid']==_0x5061be[_0x7254('0x44')]){if(!_['isNil'](agents[_0x5061be[_0x7254('0x45')]])){utils['info'](util['format'](_0x7254('0x46'),_0x5061be[_0x7254('0x43')],agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x7')]));agents[_0x5061be['secondtransfereruniqueid']][_0x7254('0x3d')]=!![];agents[_0x5061be['secondtransfereruniqueid']][_0x7254('0x3e')]=_0x7254('0x47');agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x48')]=_0x5061be[_0x7254('0x49')];agents[_0x5061be[_0x7254('0x45')]]['transferuniqueid']=_0x5061be[_0x7254('0x43')];}if(_0x5061be[_0x7254('0x4a')]&&agents[_0x5061be[_0x7254('0x4a')]]){agents[_0x5061be[_0x7254('0x4a')]][_0x7254('0x4b')]=0x1;transfers[_0x5061be[_0x7254('0x4a')]]=_['clone'](agents[_0x5061be[_0x7254('0x4a')]]);transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x9')]=agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x9')];transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x4c')]=agents[_0x5061be['secondtransfereruniqueid']]['calleridname'];transfers[_0x5061be[_0x7254('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x37')]=utils[_0x7254('0x18')]();transfers[_0x5061be['transfereeuniqueid']][_0x7254('0x24')]=0x0;transfers[_0x5061be['transfereeuniqueid']][_0x7254('0x4b')]=0x2;}}else if(_0x5061be[_0x7254('0x45')]==_0x5061be[_0x7254('0x4d')]){if(!_[_0x7254('0x1e')](agents[_0x5061be[_0x7254('0x43')]])){utils['info'](util[_0x7254('0x3')](_0x7254('0x46'),_0x5061be[_0x7254('0x43')],agents[_0x5061be[_0x7254('0x43')]]['membername']));agents[_0x5061be['origtransfereruniqueid']][_0x7254('0x3d')]=!![];agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x3e')]=_0x7254('0x47');agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x48')]=_0x5061be[_0x7254('0x4e')];agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x41')]=_0x5061be[_0x7254('0x45')];}if(_0x5061be[_0x7254('0x4f')]&&agents[_0x5061be[_0x7254('0x4f')]]){agents[_0x5061be[_0x7254('0x4f')]]['agententerreason']=0x1;transfers[_0x5061be[_0x7254('0x4f')]]=_[_0x7254('0x50')](agents[_0x5061be[_0x7254('0x4f')]]);transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x9')]=agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x9')];transfers[_0x5061be[_0x7254('0x4f')]]['calleridname']=agents[_0x5061be[_0x7254('0x43')]]['calleridname'];transfers[_0x5061be[_0x7254('0x4f')]][_0x7254('0x17')]=utils[_0x7254('0x18')]();transfers[_0x5061be[_0x7254('0x4f')]]['agentconnectAt']=utils[_0x7254('0x18')]();transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x24')]=0x0;transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x4b')]=0x2;}}}catch(_0x42dc64){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x51'),_0x5061be[_0x7254('0x43')]),_0x42dc64);}};exports[_0x7254('0x52')]=function(_0x23b89a){try{utils['debug'](util[_0x7254('0x3')]('[%s][agents][hangup]',_0x23b89a[_0x7254('0x5')]),_0x23b89a);if(agents[_0x23b89a[_0x7254('0x5')]]&&agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]===_0x7254('0x23')){if(_0x23b89a[_0x7254('0x53')]==='21'){agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]='rejected';agents[_0x23b89a[_0x7254('0x5')]]['lastevent']=_0x7254('0x54');}utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x55'),_0x23b89a[_0x7254('0x5')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x7')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(agents[_0x23b89a[_0x7254('0x5')]]);var _0x3f7be7=unanswered[_0x7254('0x56')](_0x23b89a[_0x7254('0x5')]);if(_0x3f7be7>-0x1){unanswered[_0x7254('0x57')](_0x3f7be7,0x1);}}if(transfers[_0x23b89a[_0x7254('0x5')]]){transfers[_0x23b89a['uniqueid']]['agentcomplete']=!![];transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')]=utils['now']();transfers[_0x23b89a['uniqueid']]['talktime']=utils[_0x7254('0x36')](transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')],transfers[_0x23b89a[_0x7254('0x5')]]['agentconnectAt']);transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]='agent';transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]=_0x7254('0x38');utils['info'](util['format'](_0x7254('0x55'),_0x23b89a[_0x7254('0x5')],transfers[_0x23b89a['uniqueid']][_0x7254('0x7')],transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')],transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(transfers[_0x23b89a['uniqueid']],!![]);}if(agents[_0x23b89a[_0x7254('0x5')]]&&agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x37')]){agents[_0x23b89a['uniqueid']][_0x7254('0xe')]=!![];agents[_0x23b89a['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0x23b89a[_0x7254('0x5')]]['talktime']=utils['diffTime'](agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')],agents[_0x23b89a[_0x7254('0x5')]]['agentconnectAt']);agents[_0x23b89a[_0x7254('0x5')]]['reason']=agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x3d')]?'transfer':_0x7254('0x58');agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]=_0x7254('0x38');utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x55'),_0x23b89a['uniqueid'],agents[_0x23b89a[_0x7254('0x5')]]['membername'],agents[_0x23b89a['uniqueid']][_0x7254('0x22')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(agents[_0x23b89a[_0x7254('0x5')]]);}}catch(_0x54c7d5){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x59'),_0x23b89a[_0x7254('0x5')]),_0x54c7d5);}}; \ No newline at end of file +var _0x2e54=['connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','error','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2c330e,_0x527a5e){_0x2c330e=_0x2c330e-0x0;var _0x496a48=_0x2e54[_0x2c330e];return _0x496a48;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x216de4,_0x23f008){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x3'),_0x216de4[_0x42e5('0x4')],_0x216de4[_0x42e5('0x5')],_0x216de4['queue'],_0x216de4[_0x42e5('0x6')],_0x216de4[_0x42e5('0x7')],_0x216de4[_0x42e5('0x8')],_0x216de4['connectedlinenum'],_0x216de4[_0x42e5('0x9')]));if(_0x216de4['queue']){utils[_0x42e5('0xa')](_0x216de4['queue'])[_0x42e5('0xb')](function(_0x224b11){if(_0x224b11){_0x216de4[_0x42e5('0xc')]=_0x224b11[_0x42e5('0xc')];_0x216de4[_0x42e5('0xd')]=_0x216de4[_0x42e5('0xe')]?_0x224b11[_0x42e5('0xf')]:![];_0x216de4[_0x42e5('0x10')]=_0x216de4[_0x42e5('0xd')]?_0x224b11['acwTimeout']:0x0;}utils[_0x42e5('0x11')](_0x42e5('0x12'),_0x216de4);});}else{utils['request'](_0x42e5('0x12'),_0x216de4);}if(_0x23f008){delete transfers[_0x216de4[_0x42e5('0x4')]];}else{delete agents[_0x216de4[_0x42e5('0x13')]];}}exports[_0x42e5('0x14')]=function(_0x144fb4){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4[_0x42e5('0x4')]),_0x144fb4);agents[_0x144fb4[_0x42e5('0x13')]]=_0x144fb4;agents[_0x144fb4['destuniqueid']][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x19');agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1a')]=null;agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1b')]=null;utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x1c'),_0x144fb4[_0x42e5('0x4')],agents[_0x144fb4[_0x42e5('0x13')]]['membername'],_0x144fb4[_0x42e5('0x13')]));}catch(_0x4a129e){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4['uniqueid']),_0x4a129e);}};exports[_0x42e5('0x1d')]=function(_0x39a3e2){try{if(!_[_0x42e5('0x1e')](agents[_0x39a3e2[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2['uniqueid']),_0x39a3e2);utils['info'](util[_0x42e5('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x39a3e2[_0x42e5('0x4')],agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x6')],_0x39a3e2[_0x42e5('0x13')]));agents[_0x39a3e2[_0x42e5('0x13')]]['agentringnoanswer']=!![];agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x20')]=utils[_0x42e5('0x18')]();agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x9')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x21')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x22')]=_0x39a3e2['ringtime']?parseInt(_0x39a3e2[_0x42e5('0x23')])/0x3e8:0x0;agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x24')]=0x0;unanswered[_0x42e5('0x25')](_0x39a3e2[_0x42e5('0x13')]);}}catch(_0x2f1edc){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2[_0x42e5('0x4')]),_0x2f1edc);}};exports[_0x42e5('0x26')]=function(_0x1d22ba){try{_[_0x42e5('0x27')](agents,function(_0x383e97,_0x282cbf){if(_0x383e97[_0x42e5('0x4')]==_0x1d22ba[_0x42e5('0x4')]&&!_[_0x42e5('0x28')](unanswered,_0x383e97[_0x42e5('0x13')])){utils[_0x42e5('0x15')](util['format'](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x1d22ba);utils[_0x42e5('0x1')](util[_0x42e5('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1d22ba['uniqueid'],_0x383e97[_0x42e5('0x6')],_0x383e97['destuniqueid']));_0x383e97[_0x42e5('0x1d')]=!![];_0x383e97['agentringnoanswerAt']=utils[_0x42e5('0x18')]();_0x383e97[_0x42e5('0x9')]=_0x42e5('0x2a');_0x383e97['reason']=_0x42e5('0x2a');_0x383e97[_0x42e5('0x22')]=_0x1d22ba['holdtime'];_0x383e97[_0x42e5('0x24')]=0x0;writeDB(_0x383e97);}});}catch(_0x57558d){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x57558d);}};exports[_0x42e5('0x2c')]=function(_0x41f891){try{if(agents[_0x41f891[_0x42e5('0x13')]]){utils['debug'](util['format'](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x41f891);utils[_0x42e5('0x1')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x41f891['uniqueid'],agents[_0x41f891['destuniqueid']][_0x42e5('0x6')],_0x41f891[_0x42e5('0x13')]));agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x1a')]=_0x41f891[_0x42e5('0x1a')];agents[_0x41f891['destuniqueid']][_0x42e5('0x1b')]=_0x41f891['connectedlinename'];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x22')]=_0x41f891[_0x42e5('0x23')];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x2f');_[_0x42e5('0x27')](agents,function(_0x5ab9b8,_0x20f372){if(_0x5ab9b8[_0x42e5('0x13')]!=_0x41f891['destuniqueid']&&_0x5ab9b8[_0x42e5('0x4')]==_0x41f891['uniqueid']){_0x5ab9b8['talktime']=0x0;_0x5ab9b8['holdtime']=_0x41f891[_0x42e5('0x23')];_0x5ab9b8[_0x42e5('0x1d')]=!![];_0x5ab9b8[_0x42e5('0x20')]=utils[_0x42e5('0x18')]();_0x5ab9b8[_0x42e5('0x9')]=_0x42e5('0x30');_0x5ab9b8[_0x42e5('0x21')]='answered_elsewhere';_0x5ab9b8[_0x42e5('0x31')]=_0x41f891[_0x42e5('0x13')];_0x5ab9b8['answeredelsewheremembername']=_0x41f891[_0x42e5('0x6')];writeDB(_0x5ab9b8);}});}}catch(_0x1c697a){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x1c697a);}};exports[_0x42e5('0xe')]=function(_0x424304){try{if(!_['isNil'](agents[_0x424304[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x32'),_0x424304['uniqueid']),_0x424304);utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x33'),_0x424304[_0x42e5('0x4')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x6')],_0x424304[_0x42e5('0x13')]));agents[_0x424304[_0x42e5('0x13')]]['agentcomplete']=!![];agents[_0x424304[_0x42e5('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x35')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x2e')]);agents[_0x424304['destuniqueid']][_0x42e5('0x21')]=_0x424304[_0x42e5('0x21')];agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x36');writeDB(agents[_0x424304[_0x42e5('0x13')]]);}}catch(_0x3d910a){utils[_0x42e5('0x2b')](util['format'](_0x42e5('0x32'),_0x424304[_0x42e5('0x4')]),_0x3d910a);}};exports[_0x42e5('0x37')]=function(_0x48757e){try{if(!_[_0x42e5('0x1e')](agents[_0x48757e[_0x42e5('0x38')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e['uniqueid']),_0x48757e);utils[_0x42e5('0x1')](util['format'](_0x42e5('0x3a'),_0x48757e[_0x42e5('0x4')],agents[_0x48757e[_0x42e5('0x38')]]['membername'],agents[_0x48757e['transfereruniqueid']]['uniqueid']));agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3b')]=!![];agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3c')]='blind';agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3d')]=_0x48757e[_0x42e5('0x3e')];agents[_0x48757e['transfereruniqueid']][_0x42e5('0x3f')]=agents[_0x48757e['transfereruniqueid']][_0x42e5('0x4')];}}catch(_0x2583cd){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e[_0x42e5('0x4')]),_0x2583cd);}};exports[_0x42e5('0x40')]=function(_0x24682c){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x41'),_0x24682c[_0x42e5('0x42')]),_0x24682c);if(_0x24682c[_0x42e5('0x42')]==_0x24682c['origtransfererlinkedid']){if(!_[_0x42e5('0x1e')](agents[_0x24682c[_0x42e5('0x43')]])){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x44'),_0x24682c['origtransfereruniqueid'],agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3d')]=_0x24682c['origtransfererexten'];agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3f')]=_0x24682c[_0x42e5('0x42')];}if(_0x24682c[_0x42e5('0x45')]&&agents[_0x24682c[_0x42e5('0x45')]]){agents[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x45')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfereeuniqueid']]);transfers[_0x24682c[_0x42e5('0x45')]]['calleridnum']=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x2e')]=utils['now']();transfers[_0x24682c[_0x42e5('0x45')]]['holdtime']=0x0;transfers[_0x24682c[_0x42e5('0x45')]]['agententerreason']=0x2;}}else if(_0x24682c[_0x42e5('0x43')]==_0x24682c[_0x42e5('0x49')]){if(!_['isNil'](agents[_0x24682c[_0x42e5('0x42')]])){utils[_0x42e5('0x1')](util['format'](_0x42e5('0x44'),_0x24682c[_0x42e5('0x42')],agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x3c')]=_0x42e5('0x4a');agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3d')]=_0x24682c['secondtransfererexten'];agents[_0x24682c[_0x42e5('0x42')]]['transferuniqueid']=_0x24682c[_0x42e5('0x43')];}if(_0x24682c[_0x42e5('0x4b')]&&agents[_0x24682c[_0x42e5('0x4b')]]){agents[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x4b')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfertargetuniqueid']]);transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x8')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x4b')]]['agentcalledAt']=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();transfers[_0x24682c['transfertargetuniqueid']][_0x42e5('0x22')]=0x0;transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x2;}}}catch(_0x3a0942){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x24682c[_0x42e5('0x42')]),_0x3a0942);}};exports[_0x42e5('0x4c')]=function(_0x8c7c57){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57[_0x42e5('0x4')]),_0x8c7c57);if(agents[_0x8c7c57[_0x42e5('0x4')]]&&agents[_0x8c7c57[_0x42e5('0x4')]]['reason']===_0x42e5('0x4e')){if(_0x8c7c57[_0x42e5('0x4f')]==='21'){agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=_0x42e5('0x50');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x50');}utils['info'](util['format'](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57['uniqueid']]['membername'],agents[_0x8c7c57['uniqueid']][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);var _0x3603df=unanswered['indexOf'](_0x8c7c57[_0x42e5('0x4')]);if(_0x3603df>-0x1){unanswered[_0x42e5('0x52')](_0x3603df,0x1);}}if(transfers[_0x8c7c57['uniqueid']]){transfers[_0x8c7c57[_0x42e5('0x4')]]['agentcomplete']=!![];transfers[_0x8c7c57['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils['diffTime'](transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]='agent';transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]='complete';utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],transfers[_0x8c7c57['uniqueid']]['lastevent']));writeDB(transfers[_0x8c7c57['uniqueid']],!![]);}if(agents[_0x8c7c57['uniqueid']]&&agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]){agents[_0x8c7c57['uniqueid']][_0x42e5('0xe')]=!![];agents[_0x8c7c57['uniqueid']][_0x42e5('0x35')]=utils[_0x42e5('0x18')]();agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x3b')]?_0x42e5('0x3b'):_0x42e5('0x53');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x36');utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);}}catch(_0x5777c2){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57['uniqueid']),_0x5777c2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 96da605..b60a85d 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 _0x115a=['duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastdata','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x115a,0x1ca));var _0xa115=function(_0x48b062,_0x3b450d){_0x48b062=_0x48b062-0x0;var _0x2120fe=_0x115a[_0x48b062];return _0x2120fe;};'use strict';var _=require(_0xa115('0x0'));var util=require('util');var utils=require(_0xa115('0x1'));var dispositions=[_0xa115('0x2'),_0xa115('0x3'),'FAILED',_0xa115('0x2'),'NO\x20ANSWER',_0xa115('0x2'),_0xa115('0x4'),'BUSY',_0xa115('0x3'),_0xa115('0x3'),_0xa115('0x3')];var channels={};function writeDB(_0x912165){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x7'),_0x912165['uniqueid'],_0x912165[_0xa115('0x8')],_0x912165[_0xa115('0x9')],_0x912165['membername'],_0x912165[_0xa115('0xa')],_0x912165[_0xa115('0xb')],_0x912165[_0xa115('0xc')],_0x912165[_0xa115('0xd')]));if(_0x912165[_0xa115('0xe')]){utils[_0xa115('0xf')](_0x912165[_0xa115('0xe')])['then'](function(_0x932e4c){if(_0x932e4c){_0x912165['UserId']=_0x932e4c['id'];}utils[_0xa115('0x10')](_0xa115('0x11'),_0x912165);});}else{utils['request'](_0xa115('0x11'),_0x912165);}if(channels[_0x912165[_0xa115('0x12')]]){delete channels[_0x912165[_0xa115('0x12')]];}}exports[_0xa115('0x13')]=function(_0x3a33bd){try{utils['debug'](util['format'](_0xa115('0x14'),_0x3a33bd['uniqueid']),_0x3a33bd);if(_0x3a33bd['uniqueid']==_0x3a33bd['linkedid']&&_0x3a33bd['channel']!='OutgoingSpoolFailed'){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x15'),_0x3a33bd['uniqueid'],_0x3a33bd[_0xa115('0x16')],_0x3a33bd[_0xa115('0x17')]));channels[_0x3a33bd[_0xa115('0x12')]]={'uniqueid':_0x3a33bd[_0xa115('0x12')],'accountcode':_0x3a33bd[_0xa115('0xe')],'source':_0x3a33bd['calleridnum'],'destination':_0x3a33bd[_0xa115('0x17')],'destinationcontext':_0x3a33bd[_0xa115('0x16')],'channel':_0x3a33bd[_0xa115('0x8')],'starttime':utils[_0xa115('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa115('0x2'),'amaflags':_0xa115('0x19')};}}catch(_0x324964){utils[_0xa115('0x1a')](util[_0xa115('0x6')]('[%s][calls][newchannel]',_0x3a33bd['uniqueid']),_0x324964);}};exports[_0xa115('0x1b')]=function(_0x4931eb){try{utils[_0xa115('0x1c')](util['format']('[%s][calls][newstate]',_0x4931eb[_0xa115('0x12')]),_0x4931eb);if(!_['isNil'](channels[_0x4931eb[_0xa115('0x12')]])&&_0x4931eb[_0xa115('0x1d')]==0x6){utils[_0xa115('0x5')](util['format'](_0xa115('0x1e'),_0x4931eb['uniqueid'],_0x4931eb[_0xa115('0x16')],_0x4931eb[_0xa115('0x8')]));if(_[_0xa115('0x1f')](channels[_0x4931eb[_0xa115('0x12')]][_0xa115('0x20')])){channels[_0x4931eb[_0xa115('0x12')]][_0xa115('0x20')]=utils[_0xa115('0x18')]();}}else if(!_[_0xa115('0x1f')](channels[_0x4931eb['linkedid']])&&_0x4931eb[_0xa115('0x1d')]==0x6&&_0x4931eb[_0xa115('0x16')]!=_0xa115('0x21')){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x22'),_0x4931eb[_0xa115('0x12')],_0x4931eb['linkedid'],_0x4931eb[_0xa115('0x16')],_0x4931eb['channel']));channels[_0x4931eb[_0xa115('0x23')]][_0xa115('0xe')]=_0x4931eb[_0xa115('0xe')];channels[_0x4931eb[_0xa115('0x23')]][_0xa115('0x24')]=_0x4931eb[_0xa115('0x8')];if(_[_0xa115('0x1f')](channels[_0x4931eb[_0xa115('0x23')]][_0xa115('0x25')])){channels[_0x4931eb[_0xa115('0x23')]][_0xa115('0x25')]=utils[_0xa115('0x18')]();}channels[_0x4931eb[_0xa115('0x23')]][_0xa115('0x26')]=dispositions[_['toNumber'](_0x4931eb[_0xa115('0x1d')])]||_0xa115('0x4');}}catch(_0x5a1ea2){utils[_0xa115('0x1a')](util['format'](_0xa115('0x27'),_0x4931eb[_0xa115('0x12')]),_0x5a1ea2);}};exports[_0xa115('0x28')]=function(_0x16b882){try{if(!_[_0xa115('0x1f')](channels[_0x16b882[_0xa115('0x12')]])){utils[_0xa115('0x1c')](util['format'](_0xa115('0x29'),_0x16b882[_0xa115('0x12')]),_0x16b882);if(_['isNil'](channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x2a')])){channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x2a')]=_0x16b882[_0xa115('0x2b')]+'\x20<'+_0x16b882[_0xa115('0xb')]+'>';}utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x2c'),_0x16b882[_0xa115('0x12')],channels[_0x16b882['uniqueid']][_0xa115('0x2a')],_0x16b882[_0xa115('0x2d')]));channels[_0x16b882['uniqueid']][_0xa115('0x2e')]=utils[_0xa115('0x18')]();channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x2f')]=utils[_0xa115('0x30')](channels[_0x16b882['uniqueid']][_0xa115('0x2e')],channels[_0x16b882['uniqueid']]['starttime']);channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x31')]=channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x25')]?utils[_0xa115('0x30')](channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x2e')],channels[_0x16b882[_0xa115('0x12')]][_0xa115('0x25')]):0x0;writeDB(channels[_0x16b882[_0xa115('0x12')]]);}}catch(_0x538200){utils['error'](util[_0xa115('0x6')]('[%s][calls][hangup]',_0x16b882[_0xa115('0x12')]),_0x538200);}};exports['attendedtransfer']=function(_0x5bdc95){try{if(!_['isNil'](channels[_0x5bdc95[_0xa115('0x32')]])){utils[_0xa115('0x1c')](util['format'](_0xa115('0x33'),_0x5bdc95[_0xa115('0x34')]),_0x5bdc95);if(channels[_0x5bdc95[_0xa115('0x32')]][_0xa115('0x8')]==_0x5bdc95['transfereechannel']){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x35'),_0x5bdc95['origtransfereruniqueid'],_0x5bdc95[_0xa115('0x32')],_0x5bdc95[_0xa115('0x36')]));channels[_0x5bdc95[_0xa115('0x32')]][_0xa115('0x24')]=_0x5bdc95[_0xa115('0x36')];channels[_0x5bdc95[_0xa115('0x32')]][_0xa115('0x37')]=_0xa115('0x38');}else if(channels[_0x5bdc95['localtwolinkedid']]['channel']=_0x5bdc95[_0xa115('0x39')]){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x35'),_0x5bdc95['origtransfereruniqueid'],_0x5bdc95['localtwolinkedid'],_0x5bdc95[_0xa115('0x3a')]));channels[_0x5bdc95[_0xa115('0x32')]][_0xa115('0x24')]=_0x5bdc95['origtransfererchannel'];channels[_0x5bdc95[_0xa115('0x32')]][_0xa115('0x37')]=_0xa115('0x38');}}}catch(_0x3839b2){utils[_0xa115('0x1a')](util[_0xa115('0x6')](_0xa115('0x33'),_0x5bdc95['origtransfereruniqueid']),_0x3839b2);}};exports['musiconholdstart']=function(_0x38ac39){try{if(!_[_0xa115('0x1f')](channels[_0x38ac39[_0xa115('0x12')]])){utils[_0xa115('0x1c')](util[_0xa115('0x6')](_0xa115('0x3b'),_0x38ac39[_0xa115('0x12')]),_0x38ac39);channels[_0x38ac39[_0xa115('0x12')]][_0xa115('0x3c')]=utils['now']();utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x3d'),_0x38ac39['uniqueid'],channels[_0x38ac39[_0xa115('0x12')]][_0xa115('0x3c')]));}}catch(_0x3e3d3f){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x38ac39[_0xa115('0x12')]),_0x3e3d3f);}};exports['musiconholdstop']=function(_0x10e86d){try{if(!_['isNil'](channels[_0x10e86d['uniqueid']])){utils[_0xa115('0x1c')](util[_0xa115('0x6')](_0xa115('0x3e'),_0x10e86d[_0xa115('0x12')]),_0x10e86d);if(!_[_0xa115('0x1f')](channels[_0x10e86d[_0xa115('0x12')]]['musiconholdstartAt'])){channels[_0x10e86d['uniqueid']][_0xa115('0x3f')]+=utils[_0xa115('0x30')](utils[_0xa115('0x18')](),channels[_0x10e86d[_0xa115('0x12')]][_0xa115('0x3c')]);utils[_0xa115('0x5')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x10e86d['uniqueid'],channels[_0x10e86d[_0xa115('0x12')]][_0xa115('0x3f')]));delete channels[_0x10e86d['uniqueid']][_0xa115('0x3c')];}}}catch(_0x53d47a){utils[_0xa115('0x1a')](util[_0xa115('0x6')]('[%s][calls][musiconholdstop]',_0x10e86d['uniqueid']),_0x53d47a);}};exports[_0xa115('0x40')]=function(_0x5c335d){try{if(!_[_0xa115('0x1f')](channels[_0x5c335d['uniqueid']])){utils[_0xa115('0x1c')](util['format'](_0xa115('0x41'),_0x5c335d['uniqueid']),_0x5c335d);if(!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')][_0xa115('0x43')])){utils[_0xa115('0x5')](util['format'](_0xa115('0x44'),_0x5c335d[_0xa115('0x12')],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]][_0xa115('0x46')]=_0x5c335d['value'];}if(!_[_0xa115('0x1f')](_0x5c335d['variable']['xmd-phone'])){utils[_0xa115('0x5')](util[_0xa115('0x6')](_0xa115('0x47'),_0x5c335d[_0xa115('0x12')],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]][_0xa115('0x48')]=_0x5c335d['value'];channels[_0x5c335d['uniqueid']][_0xa115('0x2a')]='\x22'+_0x5c335d[_0xa115('0x45')]+_0xa115('0x49')+_0x5c335d['value']+'>';}if(!_['isNil'](_0x5c335d[_0xa115('0x42')][_0xa115('0x4a')])||!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')][_0xa115('0x4b')])){utils[_0xa115('0x5')](util[_0xa115('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5c335d['uniqueid'],!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')][_0xa115('0x4a')])?_0xa115('0x4a'):'xmd-callerid',_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]][_0xa115('0x2a')]=_0x5c335d[_0xa115('0x45')];}if(!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')]['xmd-queue'])||!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')][_0xa115('0x4c')])){utils['info'](util[_0xa115('0x6')](_0xa115('0x4d'),_0x5c335d[_0xa115('0x12')],!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')]['xmd-queue'])?'xmd-queue':_0xa115('0x4c'),_0x5c335d['value']));channels[_0x5c335d[_0xa115('0x12')]][_0xa115('0x4e')]=_0xa115('0x4f');channels[_0x5c335d['uniqueid']]['lastdata']=_0x5c335d[_0xa115('0x45')];channels[_0x5c335d['uniqueid']][_0xa115('0x9')]=!![];}if(!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')][_0xa115('0x50')])){utils['info'](util[_0xa115('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5c335d[_0xa115('0x12')],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d['uniqueid']][_0xa115('0x51')]=_0x5c335d[_0xa115('0x45')];}if(!_['isNil'](_0x5c335d[_0xa115('0x42')][_0xa115('0x52')])){utils[_0xa115('0x5')](util['format'](_0xa115('0x53'),_0x5c335d[_0xa115('0x12')],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]]['type']=_0x5c335d[_0xa115('0x45')];}if(!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')]['outboundrouteid'])){utils[_0xa115('0x5')](util[_0xa115('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5c335d[_0xa115('0x12')],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]]['routeid']=_0x5c335d['value'];}if(!_[_0xa115('0x1f')](_0x5c335d[_0xa115('0x42')]['sipcallid'])){utils[_0xa115('0x5')](util[_0xa115('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5c335d['uniqueid'],_0x5c335d[_0xa115('0x45')]));channels[_0x5c335d[_0xa115('0x12')]][_0xa115('0x54')]=_0x5c335d['value'];}}}catch(_0x2abcc1){utils[_0xa115('0x1a')](util[_0xa115('0x6')](_0xa115('0x41'),_0x5c335d[_0xa115('0x12')]),_0x2abcc1);}};exports[_0xa115('0x55')]=function(_0x2d8089){try{if(!_[_0xa115('0x1f')](channels[_0x2d8089[_0xa115('0x12')]])){utils[_0xa115('0x1c')](util[_0xa115('0x6')](_0xa115('0x56'),_0x2d8089[_0xa115('0x12')]),_0x2d8089);utils['info'](util[_0xa115('0x6')](_0xa115('0x57'),_0x2d8089[_0xa115('0x12')],_0x2d8089['application'],_0x2d8089[_0xa115('0x58')]));if(_0x2d8089['application'][_0xa115('0x59')]()==_0xa115('0x5a')&&_['startsWith'](_0x2d8089[_0xa115('0x58')][_0xa115('0x59')](),_0xa115('0x5b'))){var _0x1255ff=_0x2d8089[_0xa115('0x58')][_0xa115('0x5c')]('=');var _0x3f1235=_0x1255ff[0x0][_0xa115('0x5d')](_0x1255ff[0x0][_0xa115('0x5e')]('(')+0x1,_0x1255ff[0x0][_0xa115('0x5e')](')'));var _0x32bb3d=_0x1255ff[0x1];channels[_0x2d8089[_0xa115('0x12')]][_0x3f1235]=_0x32bb3d;}if(!_[_0xa115('0x5f')]([_0xa115('0x28'),_0xa115('0x60'),_0xa115('0x61'),_0xa115('0x5a'),_0xa115('0x62')],_0x2d8089[_0xa115('0x63')][_0xa115('0x59')]())){channels[_0x2d8089[_0xa115('0x12')]]['lastapplication']=_0x2d8089[_0xa115('0x63')];channels[_0x2d8089[_0xa115('0x12')]][_0xa115('0x64')]=_0x2d8089[_0xa115('0x58')];}}}catch(_0x4106b8){utils[_0xa115('0x1a')](util[_0xa115('0x6')](_0xa115('0x56'),_0x2d8089[_0xa115('0x12')]),_0x4106b8);}}; \ No newline at end of file +var _0xa8cd=['hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','variable','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%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','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','uniqueid','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','format','[%s][calls][newchannel]','OutgoingSpoolFailed','context','calleridnum','exten','channel','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber'];(function(_0x419654,_0x27ca4b){var _0x3d69ea=function(_0x13d8a8){while(--_0x13d8a8){_0x419654['push'](_0x419654['shift']());}};_0x3d69ea(++_0x27ca4b);}(_0xa8cd,0xa3));var _0xda8c=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xa8cd[_0x57add2];return _0x4e3670;};'use strict';var _=require('lodash');var util=require(_0xda8c('0x0'));var utils=require(_0xda8c('0x1'));var dispositions=[_0xda8c('0x2'),_0xda8c('0x3'),_0xda8c('0x3'),_0xda8c('0x2'),_0xda8c('0x2'),_0xda8c('0x2'),_0xda8c('0x4'),'BUSY','FAILED',_0xda8c('0x3'),_0xda8c('0x3')];var channels={};function writeDB(_0xa00ddb){utils[_0xda8c('0x5')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xa00ddb[_0xda8c('0x6')],_0xa00ddb['channel'],_0xa00ddb['queue'],_0xa00ddb['membername'],_0xa00ddb[_0xda8c('0x7')],_0xa00ddb['calleridnum'],_0xa00ddb[_0xda8c('0x8')],_0xa00ddb['lastevent']));if(_0xa00ddb[_0xda8c('0x9')]){utils[_0xda8c('0xa')](_0xa00ddb['accountcode'])[_0xda8c('0xb')](function(_0x3ff2ad){if(_0x3ff2ad){_0xa00ddb[_0xda8c('0xc')]=_0x3ff2ad['id'];}utils[_0xda8c('0xd')](_0xda8c('0xe'),_0xa00ddb);});}else{utils['request'](_0xda8c('0xe'),_0xa00ddb);}if(channels[_0xa00ddb[_0xda8c('0x6')]]){delete channels[_0xa00ddb['uniqueid']];}}exports['newchannel']=function(_0x32ee61){try{utils['debug'](util[_0xda8c('0xf')](_0xda8c('0x10'),_0x32ee61[_0xda8c('0x6')]),_0x32ee61);if(_0x32ee61['uniqueid']==_0x32ee61['linkedid']&&_0x32ee61['channel']!=_0xda8c('0x11')){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x32ee61[_0xda8c('0x6')],_0x32ee61[_0xda8c('0x12')],_0x32ee61['exten']));channels[_0x32ee61[_0xda8c('0x6')]]={'uniqueid':_0x32ee61[_0xda8c('0x6')],'accountcode':_0x32ee61[_0xda8c('0x9')],'source':_0x32ee61[_0xda8c('0x13')],'destination':_0x32ee61[_0xda8c('0x14')],'destinationcontext':_0x32ee61[_0xda8c('0x12')],'channel':_0x32ee61[_0xda8c('0x15')],'starttime':utils[_0xda8c('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xda8c('0x2'),'amaflags':_0xda8c('0x17')};}}catch(_0x9b9c5f){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x10'),_0x32ee61['uniqueid']),_0x9b9c5f);}};exports[_0xda8c('0x19')]=function(_0x11c931){try{utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x1b'),_0x11c931[_0xda8c('0x6')]),_0x11c931);if(!_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x6')]])&&_0x11c931[_0xda8c('0x1d')]==0x6){utils['info'](util[_0xda8c('0xf')](_0xda8c('0x1e'),_0x11c931['uniqueid'],_0x11c931[_0xda8c('0x12')],_0x11c931['channel']));if(_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x6')]][_0xda8c('0x1f')])){channels[_0x11c931[_0xda8c('0x6')]][_0xda8c('0x1f')]=utils['now']();}}else if(!_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x20')]])&&_0x11c931[_0xda8c('0x1d')]==0x6&&_0x11c931['context']!=_0xda8c('0x21')){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x22'),_0x11c931[_0xda8c('0x6')],_0x11c931[_0xda8c('0x20')],_0x11c931[_0xda8c('0x12')],_0x11c931[_0xda8c('0x15')]));channels[_0x11c931[_0xda8c('0x20')]]['accountcode']=_0x11c931['accountcode'];channels[_0x11c931[_0xda8c('0x20')]][_0xda8c('0x23')]=_0x11c931[_0xda8c('0x15')];if(_[_0xda8c('0x1c')](channels[_0x11c931[_0xda8c('0x20')]][_0xda8c('0x24')])){channels[_0x11c931['linkedid']][_0xda8c('0x24')]=utils[_0xda8c('0x16')]();}channels[_0x11c931['linkedid']][_0xda8c('0x25')]=dispositions[_[_0xda8c('0x26')](_0x11c931[_0xda8c('0x1d')])]||_0xda8c('0x4');}}catch(_0x56b475){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][newstate]',_0x11c931[_0xda8c('0x6')]),_0x56b475);}};exports[_0xda8c('0x27')]=function(_0x547115){try{if(!_[_0xda8c('0x1c')](channels[_0x547115[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x28'),_0x547115[_0xda8c('0x6')]),_0x547115);if(_[_0xda8c('0x1c')](channels[_0x547115['uniqueid']][_0xda8c('0x29')])){channels[_0x547115[_0xda8c('0x6')]]['callerid']=_0x547115['calleridname']+'\x20<'+_0x547115['calleridnum']+'>';}utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x2a'),_0x547115[_0xda8c('0x6')],channels[_0x547115[_0xda8c('0x6')]]['callerid'],_0x547115[_0xda8c('0x2b')]));channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2c')]=utils[_0xda8c('0x16')]();channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2d')]=utils['diffTime'](channels[_0x547115['uniqueid']]['endtime'],channels[_0x547115[_0xda8c('0x6')]]['starttime']);channels[_0x547115[_0xda8c('0x6')]]['billableseconds']=channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x24')]?utils[_0xda8c('0x2e')](channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x2c')],channels[_0x547115[_0xda8c('0x6')]][_0xda8c('0x24')]):0x0;writeDB(channels[_0x547115[_0xda8c('0x6')]]);}}catch(_0x3e55fe){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][hangup]',_0x547115[_0xda8c('0x6')]),_0x3e55fe);}};exports['attendedtransfer']=function(_0x4a1926){try{if(!_[_0xda8c('0x1c')](channels[_0x4a1926[_0xda8c('0x2f')]])){utils['debug'](util['format'](_0xda8c('0x30'),_0x4a1926[_0xda8c('0x31')]),_0x4a1926);if(channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x15')]==_0x4a1926[_0xda8c('0x32')]){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x33'),_0x4a1926[_0xda8c('0x31')],_0x4a1926[_0xda8c('0x2f')],_0x4a1926[_0xda8c('0x34')]));channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x23')]=_0x4a1926[_0xda8c('0x34')];channels[_0x4a1926['localtwolinkedid']]['userfield']=_0xda8c('0x35');}else if(channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x15')]=_0x4a1926[_0xda8c('0x36')]){utils[_0xda8c('0x5')](util['format'](_0xda8c('0x33'),_0x4a1926[_0xda8c('0x31')],_0x4a1926[_0xda8c('0x2f')],_0x4a1926['origtransfererchannel']));channels[_0x4a1926['localtwolinkedid']][_0xda8c('0x23')]=_0x4a1926[_0xda8c('0x37')];channels[_0x4a1926[_0xda8c('0x2f')]][_0xda8c('0x38')]='_attended';}}}catch(_0x4763a7){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][attendedtransfer]',_0x4a1926[_0xda8c('0x31')]),_0x4763a7);}};exports[_0xda8c('0x39')]=function(_0xa67a8){try{if(!_[_0xda8c('0x1c')](channels[_0xa67a8[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x3a'),_0xa67a8[_0xda8c('0x6')]),_0xa67a8);channels[_0xa67a8[_0xda8c('0x6')]][_0xda8c('0x3b')]=utils[_0xda8c('0x16')]();utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x3c'),_0xa67a8[_0xda8c('0x6')],channels[_0xa67a8[_0xda8c('0x6')]][_0xda8c('0x3b')]));}}catch(_0x3e219b){utils['error'](util[_0xda8c('0xf')]('[%s][calls][musiconholdstart]',_0xa67a8[_0xda8c('0x6')]),_0x3e219b);}};exports['musiconholdstop']=function(_0x46007e){try{if(!_[_0xda8c('0x1c')](channels[_0x46007e[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')](_0xda8c('0x3d'),_0x46007e[_0xda8c('0x6')]),_0x46007e);if(!_[_0xda8c('0x1c')](channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')])){channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3e')]+=utils[_0xda8c('0x2e')](utils[_0xda8c('0x16')](),channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')]);utils['info'](util[_0xda8c('0xf')](_0xda8c('0x3f'),_0x46007e[_0xda8c('0x6')],channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3e')]));delete channels[_0x46007e[_0xda8c('0x6')]][_0xda8c('0x3b')];}}}catch(_0x4cc0e8){utils[_0xda8c('0x18')](util[_0xda8c('0xf')]('[%s][calls][musiconholdstop]',_0x46007e[_0xda8c('0x6')]),_0x4cc0e8);}};exports[_0xda8c('0x40')]=function(_0x5839b9){try{if(!_[_0xda8c('0x1c')](channels[_0x5839b9[_0xda8c('0x6')]])){utils['debug'](util[_0xda8c('0xf')]('[%s][calls][varset]',_0x5839b9['uniqueid']),_0x5839b9);if(!_[_0xda8c('0x1c')](_0x5839b9['variable'][_0xda8c('0x41')])){utils['info'](util['format'](_0xda8c('0x42'),_0x5839b9['uniqueid'],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x44')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9['variable']['xmd-phone'])){utils['info'](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5839b9[_0xda8c('0x6')],_0x5839b9['value']));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x45')]=_0x5839b9['value'];channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x29')]='\x22'+_0x5839b9[_0xda8c('0x43')]+_0xda8c('0x46')+_0x5839b9[_0xda8c('0x43')]+'>';}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['xmd-callerid-preview'])||!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x48')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5839b9[_0xda8c('0x6')],!_[_0xda8c('0x1c')](_0x5839b9['variable'][_0xda8c('0x49')])?'xmd-callerid-preview':_0xda8c('0x48'),_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9['uniqueid']][_0xda8c('0x29')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x4a')])||!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x4b')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x4c'),_0x5839b9[_0xda8c('0x6')],!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['xmd-queue'])?_0xda8c('0x4a'):'xmcs-queue',_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x4d')]=_0xda8c('0x4e');channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x4f')]=_0x5839b9[_0xda8c('0x43')];channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x50')]=!![];}if(!_[_0xda8c('0x1c')](_0x5839b9['variable']['xmd-contactid'])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5839b9['uniqueid'],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x51')]=_0x5839b9[_0xda8c('0x43')];}if(!_['isNil'](_0x5839b9[_0xda8c('0x47')]['xmd-cdrtype'])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x52'),_0x5839b9[_0xda8c('0x6')],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]]['type']=_0x5839b9['value'];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')]['outboundrouteid'])){utils['info'](util[_0xda8c('0xf')](_0xda8c('0x53'),_0x5839b9['uniqueid'],_0x5839b9['value']));channels[_0x5839b9['uniqueid']][_0xda8c('0x54')]=_0x5839b9[_0xda8c('0x43')];}if(!_[_0xda8c('0x1c')](_0x5839b9[_0xda8c('0x47')][_0xda8c('0x55')])){utils[_0xda8c('0x5')](util[_0xda8c('0xf')](_0xda8c('0x56'),_0x5839b9[_0xda8c('0x6')],_0x5839b9[_0xda8c('0x43')]));channels[_0x5839b9[_0xda8c('0x6')]][_0xda8c('0x55')]=_0x5839b9[_0xda8c('0x43')];}}}catch(_0x282919){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x57'),_0x5839b9[_0xda8c('0x6')]),_0x282919);}};exports['newexten']=function(_0x161670){try{if(!_['isNil'](channels[_0x161670[_0xda8c('0x6')]])){utils[_0xda8c('0x1a')](util[_0xda8c('0xf')]('[%s][calls][newexten]',_0x161670[_0xda8c('0x6')]),_0x161670);utils[_0xda8c('0x5')](util['format'](_0xda8c('0x58'),_0x161670[_0xda8c('0x6')],_0x161670['application'],_0x161670[_0xda8c('0x59')]));if(_0x161670['application'][_0xda8c('0x5a')]()==_0xda8c('0x5b')&&_['startsWith'](_0x161670[_0xda8c('0x59')]['toLowerCase'](),_0xda8c('0x5c'))){var _0x440b16=_0x161670['appdata'][_0xda8c('0x5d')]('=');var _0x58c2aa=_0x440b16[0x0][_0xda8c('0x5e')](_0x440b16[0x0]['lastIndexOf']('(')+0x1,_0x440b16[0x0][_0xda8c('0x5f')](')'));var _0x239974=_0x440b16[0x1];channels[_0x161670[_0xda8c('0x6')]][_0x58c2aa]=_0x239974;}if(!_[_0xda8c('0x60')]([_0xda8c('0x27'),_0xda8c('0x61'),_0xda8c('0x62'),_0xda8c('0x5b'),_0xda8c('0x63')],_0x161670['application']['toLowerCase']())){channels[_0x161670['uniqueid']][_0xda8c('0x4d')]=_0x161670['application'];channels[_0x161670['uniqueid']][_0xda8c('0x4f')]=_0x161670['appdata'];}}}catch(_0x22a464){utils[_0xda8c('0x18')](util[_0xda8c('0xf')](_0xda8c('0x64'),_0x161670[_0xda8c('0x6')]),_0x22a464);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index dddae62..b081085 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 _0x4770=['connect','[core]\x20connected','shutdown','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x147c79,_0x45645a){var _0x19c6e7=function(_0x7b15da){while(--_0x7b15da){_0x147c79['push'](_0x147c79['shift']());}};_0x19c6e7(++_0x45645a);}(_0x4770,0xf2));var _0x0477=function(_0xb6d1e5,_0x4296e1){_0xb6d1e5=_0xb6d1e5-0x0;var _0x17491d=_0x4770[_0xb6d1e5];return _0x17491d;};'use strict';var utils=require('./utils');exports[_0x0477('0x0')]=function(){utils['info'](_0x0477('0x1'));};exports[_0x0477('0x2')]=function(){utils['info'](_0x0477('0x3'));};exports['fullybooted']=function(){utils[_0x0477('0x4')](_0x0477('0x5'));};exports[_0x0477('0x6')]=function(_0x3424eb){utils[_0x0477('0x6')](_0x0477('0x7'),_0x3424eb);};exports[_0x0477('0x8')]=function(){utils['info'](_0x0477('0x9'));};exports[_0x0477('0xa')]=function(_0x2c1db6){}; \ No newline at end of file +var _0x255f=['error','[core]\x20error','close','[core]\x20close','./utils','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x5aa6d6,_0x19d2fd){var _0x118a38=function(_0x4bbc0a){while(--_0x4bbc0a){_0x5aa6d6['push'](_0x5aa6d6['shift']());}};_0x118a38(++_0x19d2fd);}(_0x255f,0xea));var _0xf255=function(_0x314a36,_0x321e32){_0x314a36=_0x314a36-0x0;var _0x1172ef=_0x255f[_0x314a36];return _0x1172ef;};'use strict';var utils=require(_0xf255('0x0'));exports['connect']=function(){utils[_0xf255('0x1')]('[core]\x20connected');};exports[_0xf255('0x2')]=function(){utils[_0xf255('0x1')](_0xf255('0x3'));};exports[_0xf255('0x4')]=function(){utils[_0xf255('0x1')](_0xf255('0x5'));};exports[_0xf255('0x6')]=function(_0x4d445a){utils['error'](_0xf255('0x7'),_0x4d445a);};exports[_0xf255('0x8')]=function(){utils[_0xf255('0x1')](_0xf255('0x9'));};exports['managerevent']=function(_0x6731a5){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4df4be3..d11c499 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 _0x9fb2=['diffTime','[%s][dials][hangup]','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','newexten','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','cdr(routeid)','appdata','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','info','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime'];(function(_0x395e56,_0x2ff550){var _0xe4718=function(_0x5960ec){while(--_0x5960ec){_0x395e56['push'](_0x395e56['shift']());}};_0xe4718(++_0x2ff550);}(_0x9fb2,0x1df));var _0x29fb=function(_0x590649,_0x28f93d){_0x590649=_0x590649-0x0;var _0x4e1806=_0x9fb2[_0x590649];return _0x4e1806;};'use strict';var _=require(_0x29fb('0x0'));var util=require('util');var utils=require(_0x29fb('0x1'));var dials={};function writeDB(_0x4a9445){utils['info'](util[_0x29fb('0x2')](_0x29fb('0x3'),_0x4a9445[_0x29fb('0x4')],_0x4a9445[_0x29fb('0x5')],_0x4a9445['dialstring'],_0x4a9445[_0x29fb('0x6')],_0x4a9445[_0x29fb('0x7')],_0x4a9445[_0x29fb('0x8')]));utils[_0x29fb('0x9')]('CreateVoiceDialReport',_0x4a9445);delete dials[_0x4a9445['uniqueid']];}exports[_0x29fb('0xa')]=function(_0x4177c6){try{utils['debug'](util[_0x29fb('0x2')]('[%s][dials][newexten]',_0x4177c6[_0x29fb('0x4')]),_0x4177c6);utils['info'](util['format'](_0x29fb('0xb'),_0x4177c6[_0x29fb('0x4')],_0x4177c6[_0x29fb('0xc')],_0x4177c6['appdata']));if(_0x4177c6[_0x29fb('0xc')]['toLowerCase']()==_0x29fb('0xd')&&_[_0x29fb('0xe')](_0x4177c6['appdata'][_0x29fb('0xf')](),_0x29fb('0x10'))){var _0x15892a=_0x4177c6[_0x29fb('0x11')][_0x29fb('0x12')]('=');dials[_0x4177c6[_0x29fb('0x4')]]={'routeId':_0x15892a[0x1]};}}catch(_0x449917){utils[_0x29fb('0x13')](util[_0x29fb('0x2')](_0x29fb('0x14'),_0x4177c6[_0x29fb('0x4')]),_0x449917);}};exports[_0x29fb('0x15')]=function(_0x2051fa){try{utils[_0x29fb('0x16')](util[_0x29fb('0x2')](_0x29fb('0x17'),_0x2051fa[_0x29fb('0x4')]),_0x2051fa);if(!_[_0x29fb('0x18')](_0x2051fa[_0x29fb('0x19')][_0x29fb('0x1a')])){utils[_0x29fb('0x1b')](util[_0x29fb('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2051fa['uniqueid'],_0x2051fa[_0x29fb('0x1c')]));dials[_0x2051fa[_0x29fb('0x4')]]={'routeId':_0x2051fa[_0x29fb('0x1c')]};}}catch(_0xb37d88){utils[_0x29fb('0x13')](util['format'](_0x29fb('0x17'),_0x2051fa[_0x29fb('0x4')]),_0xb37d88);}};exports[_0x29fb('0x1d')]=function(_0x5880d4){try{if(!_[_0x29fb('0x18')](dials[_0x5880d4['uniqueid']])){utils['debug'](util[_0x29fb('0x2')](_0x29fb('0x1e'),_0x5880d4['uniqueid']),_0x5880d4);dials[_0x5880d4[_0x29fb('0x4')]]=_[_0x29fb('0x1f')](dials[_0x5880d4[_0x29fb('0x4')]],_0x5880d4);dials[_0x5880d4['uniqueid']][_0x29fb('0x20')]=utils[_0x29fb('0x21')]();dials[_0x5880d4[_0x29fb('0x4')]]['lastevent']=_0x29fb('0x22');utils[_0x29fb('0x1b')](util[_0x29fb('0x2')](_0x29fb('0x23'),_0x5880d4['uniqueid'],dials[_0x5880d4[_0x29fb('0x4')]]['starttime']));}}catch(_0x4e3581){utils[_0x29fb('0x13')](util[_0x29fb('0x2')](_0x29fb('0x1e'),_0x5880d4['uniqueid']),_0x4e3581);}};exports[_0x29fb('0x24')]=function(_0x4524b7){try{if(!_[_0x29fb('0x18')](dials[_0x4524b7[_0x29fb('0x4')]])){utils[_0x29fb('0x16')](util[_0x29fb('0x2')](_0x29fb('0x25'),_0x4524b7[_0x29fb('0x4')]),_0x4524b7);dials[_0x4524b7['uniqueid']][_0x29fb('0x8')]=_0x4524b7[_0x29fb('0x8')];if(_0x4524b7[_0x29fb('0x8')]==_0x29fb('0x26')){dials[_0x4524b7[_0x29fb('0x4')]]=_['assign'](dials[_0x4524b7[_0x29fb('0x4')]],_0x4524b7);dials[_0x4524b7[_0x29fb('0x4')]][_0x29fb('0x27')]=utils[_0x29fb('0x21')]();dials[_0x4524b7[_0x29fb('0x4')]][_0x29fb('0x28')]=_0x29fb('0x29');utils[_0x29fb('0x1b')](util[_0x29fb('0x2')](_0x29fb('0x2a'),_0x4524b7['uniqueid'],_0x4524b7['dialstatus'],dials[_0x4524b7[_0x29fb('0x4')]][_0x29fb('0x27')]));}else{utils[_0x29fb('0x1b')](util[_0x29fb('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4524b7[_0x29fb('0x4')],_0x4524b7[_0x29fb('0x8')]));}}}catch(_0x5986bb){utils[_0x29fb('0x13')](util[_0x29fb('0x2')]('[%s][dials][dialend]',_0x4524b7[_0x29fb('0x4')]),_0x5986bb);}};exports[_0x29fb('0x2b')]=function(_0xfb4f4a){try{if(!_['isNil'](dials[_0xfb4f4a[_0x29fb('0x4')]])){utils[_0x29fb('0x16')](util[_0x29fb('0x2')]('[%s][dials][hangup]',_0xfb4f4a[_0x29fb('0x4')]),_0xfb4f4a);utils[_0x29fb('0x1b')](util[_0x29fb('0x2')](_0x29fb('0x2c'),_0xfb4f4a[_0x29fb('0x4')],_0xfb4f4a[_0x29fb('0x6')],_0xfb4f4a[_0x29fb('0x2d')],_0xfb4f4a[_0x29fb('0x2e')]));dials[_0xfb4f4a['uniqueid']]=_[_0x29fb('0x1f')](dials[_0xfb4f4a[_0x29fb('0x4')]],{'endtime':utils[_0x29fb('0x21')](),'lastevent':_0x29fb('0x2f')});dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x30')]=utils['diffTime'](dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x31')],dials[_0xfb4f4a[_0x29fb('0x4')]]['starttime']);dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x32')]=utils[_0x29fb('0x33')](dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x27')]||dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x31')],dials[_0xfb4f4a['uniqueid']][_0x29fb('0x20')]);dials[_0xfb4f4a[_0x29fb('0x4')]]['billableseconds']=dials[_0xfb4f4a[_0x29fb('0x4')]][_0x29fb('0x27')]?utils[_0x29fb('0x33')](dials[_0xfb4f4a[_0x29fb('0x4')]]['endtime'],dials[_0xfb4f4a['uniqueid']][_0x29fb('0x27')]):0x0;writeDB(dials[_0xfb4f4a[_0x29fb('0x4')]]);}}catch(_0x4e33aa){utils['error'](util['format'](_0x29fb('0x34'),_0xfb4f4a[_0x29fb('0x4')]),_0x4e33aa);}}; \ No newline at end of file +var _0xf9b2=['toLowerCase','set','startsWith','cdr(routeid)','split','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','diffTime','endtime','holdtime','starttime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','connectedlinenum','request','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x54887d,_0x28f067){var _0x4965d8=function(_0x2c3a82){while(--_0x2c3a82){_0x54887d['push'](_0x54887d['shift']());}};_0x4965d8(++_0x28f067);}(_0xf9b2,0xea));var _0x2f9b=function(_0x41dc7f,_0x4553fa){_0x41dc7f=_0x41dc7f-0x0;var _0x4f20af=_0xf9b2[_0x41dc7f];return _0x4f20af;};'use strict';var _=require(_0x2f9b('0x0'));var util=require(_0x2f9b('0x1'));var utils=require(_0x2f9b('0x2'));var dials={};function writeDB(_0x345c2a){utils['info'](util[_0x2f9b('0x3')](_0x2f9b('0x4'),_0x345c2a['uniqueid'],_0x345c2a['channel'],_0x345c2a['dialstring'],_0x345c2a[_0x2f9b('0x5')],_0x345c2a[_0x2f9b('0x6')],_0x345c2a['dialstatus']));utils[_0x2f9b('0x7')]('CreateVoiceDialReport',_0x345c2a);delete dials[_0x345c2a[_0x2f9b('0x8')]];}exports[_0x2f9b('0x9')]=function(_0x4cecf3){try{utils[_0x2f9b('0xa')](util['format'](_0x2f9b('0xb'),_0x4cecf3[_0x2f9b('0x8')]),_0x4cecf3);utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0xd'),_0x4cecf3[_0x2f9b('0x8')],_0x4cecf3[_0x2f9b('0xe')],_0x4cecf3[_0x2f9b('0xf')]));if(_0x4cecf3['application'][_0x2f9b('0x10')]()==_0x2f9b('0x11')&&_[_0x2f9b('0x12')](_0x4cecf3[_0x2f9b('0xf')][_0x2f9b('0x10')](),_0x2f9b('0x13'))){var _0x456464=_0x4cecf3['appdata'][_0x2f9b('0x14')]('=');dials[_0x4cecf3['uniqueid']]={'routeId':_0x456464[0x1]};}}catch(_0x44ae55){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0xb'),_0x4cecf3['uniqueid']),_0x44ae55);}};exports['varset']=function(_0x5bf817){try{utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')]('[%s][dials][varset]',_0x5bf817['uniqueid']),_0x5bf817);if(!_[_0x2f9b('0x16')](_0x5bf817[_0x2f9b('0x17')][_0x2f9b('0x18')])){utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x19'),_0x5bf817[_0x2f9b('0x8')],_0x5bf817[_0x2f9b('0x1a')]));dials[_0x5bf817[_0x2f9b('0x8')]]={'routeId':_0x5bf817[_0x2f9b('0x1a')]};}}catch(_0x32cc17){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0x1b'),_0x5bf817['uniqueid']),_0x32cc17);}};exports[_0x2f9b('0x1c')]=function(_0x57d363){try{if(!_['isNil'](dials[_0x57d363[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')](_0x2f9b('0x1d'),_0x57d363['uniqueid']),_0x57d363);dials[_0x57d363['uniqueid']]=_[_0x2f9b('0x1e')](dials[_0x57d363['uniqueid']],_0x57d363);dials[_0x57d363['uniqueid']]['starttime']=utils[_0x2f9b('0x1f')]();dials[_0x57d363['uniqueid']]['lastevent']=_0x2f9b('0x20');utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x21'),_0x57d363[_0x2f9b('0x8')],dials[_0x57d363[_0x2f9b('0x8')]]['starttime']));}}catch(_0x45b55a){utils[_0x2f9b('0x15')](util[_0x2f9b('0x3')](_0x2f9b('0x1d'),_0x57d363[_0x2f9b('0x8')]),_0x45b55a);}};exports['dialend']=function(_0x40c277){try{if(!_['isNil'](dials[_0x40c277[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util[_0x2f9b('0x3')]('[%s][dials][dialend]',_0x40c277[_0x2f9b('0x8')]),_0x40c277);dials[_0x40c277[_0x2f9b('0x8')]]['dialstatus']=_0x40c277[_0x2f9b('0x22')];if(_0x40c277[_0x2f9b('0x22')]==_0x2f9b('0x23')){dials[_0x40c277[_0x2f9b('0x8')]]=_[_0x2f9b('0x1e')](dials[_0x40c277[_0x2f9b('0x8')]],_0x40c277);dials[_0x40c277[_0x2f9b('0x8')]][_0x2f9b('0x24')]=utils['now']();dials[_0x40c277[_0x2f9b('0x8')]]['lastevent']=_0x2f9b('0x25');utils['info'](util[_0x2f9b('0x3')](_0x2f9b('0x26'),_0x40c277[_0x2f9b('0x8')],_0x40c277['dialstatus'],dials[_0x40c277[_0x2f9b('0x8')]][_0x2f9b('0x24')]));}else{utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x27'),_0x40c277['uniqueid'],_0x40c277[_0x2f9b('0x22')]));}}}catch(_0x4ec5e1){utils['error'](util[_0x2f9b('0x3')](_0x2f9b('0x28'),_0x40c277['uniqueid']),_0x4ec5e1);}};exports[_0x2f9b('0x29')]=function(_0x118947){try{if(!_[_0x2f9b('0x16')](dials[_0x118947[_0x2f9b('0x8')]])){utils[_0x2f9b('0xa')](util['format'](_0x2f9b('0x2a'),_0x118947[_0x2f9b('0x8')]),_0x118947);utils[_0x2f9b('0xc')](util[_0x2f9b('0x3')](_0x2f9b('0x2b'),_0x118947[_0x2f9b('0x8')],_0x118947[_0x2f9b('0x5')],_0x118947['calleridname'],_0x118947[_0x2f9b('0x2c')]));dials[_0x118947[_0x2f9b('0x8')]]=_['assign'](dials[_0x118947[_0x2f9b('0x8')]],{'endtime':utils[_0x2f9b('0x1f')](),'lastevent':'complete'});dials[_0x118947[_0x2f9b('0x8')]]['duration']=utils[_0x2f9b('0x2d')](dials[_0x118947['uniqueid']][_0x2f9b('0x2e')],dials[_0x118947['uniqueid']]['starttime']);dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x2f')]=utils[_0x2f9b('0x2d')](dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]||dials[_0x118947['uniqueid']][_0x2f9b('0x2e')],dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x30')]);dials[_0x118947['uniqueid']][_0x2f9b('0x31')]=dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]?utils[_0x2f9b('0x2d')](dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x2e')],dials[_0x118947[_0x2f9b('0x8')]][_0x2f9b('0x24')]):0x0;writeDB(dials[_0x118947[_0x2f9b('0x8')]]);}}catch(_0x393c08){utils[_0x2f9b('0x15')](util['format'](_0x2f9b('0x2a'),_0x118947['uniqueid']),_0x393c08);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b41d39f..b8dbb87 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 _0xd17e=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','queuecallerleave'];(function(_0x329369,_0x1d4817){var _0x319e79=function(_0x3e0eab){while(--_0x3e0eab){_0x329369['push'](_0x329369['shift']());}};_0x319e79(++_0x1d4817);}(_0xd17e,0xa5));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xed17('0x0'));var config=require(_0xed17('0x1'));var utils=require(_0xed17('0x2'));var util=require('util');var isXDREnabled=config[_0xed17('0x3')]&&config[_0xed17('0x3')]['disabled']?!config[_0xed17('0x3')][_0xed17('0x4')]:!![];var isProduction=config['env']===_0xed17('0x5')||![];var isLocalAsterisk=config[_0xed17('0x3')]&&config['xdr'][_0xed17('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xed17('0x7')][_0xed17('0x8')],config[_0xed17('0x7')]['ip'],config['asterisk'][_0xed17('0x9')],config[_0xed17('0x7')][_0xed17('0xa')],!![]);ami[_0xed17('0xb')]();if(!isXDREnabled){utils[_0xed17('0xc')](_0xed17('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xed17('0xc')](_0xed17('0xe'));}else{var agents=require(_0xed17('0xf'));var calls=require(_0xed17('0x10'));var queues=require(_0xed17('0x11'));var recordings=require(_0xed17('0x12'));var members=require('./members.controller');var dials=require(_0xed17('0x13'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on']('connect',core[_0xed17('0x14')]);ami['on'](_0xed17('0x15'),core['shutdown']);ami['on'](_0xed17('0x16'),core[_0xed17('0x16')]);ami['on'](_0xed17('0x17'),core['error']);ami['on'](_0xed17('0x18'),core[_0xed17('0x18')]);ami['on'](_0xed17('0x19'),core[_0xed17('0x19')]);ami['on'](_0xed17('0x1a'),function(_0x63ad51){try{utils['debug'](util[_0xed17('0x1b')](_0xed17('0x1c'),_0x63ad51['device']),_0x63ad51);members[_0xed17('0x1a')](_0x63ad51);}catch(_0x950f45){utils[_0xed17('0x17')](util[_0xed17('0x1b')]('[%s][index][devicestatechange]',_0x63ad51['device']),_0x950f45);}});ami['on'](_0xed17('0x1d'),function(_0x12a47e){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][agentcalled]',_0x12a47e['uniqueid']),_0x12a47e);agents[_0xed17('0x1d')](_0x12a47e);}catch(_0x42ffe4){utils['error'](util[_0xed17('0x1b')](_0xed17('0x1f'),_0x12a47e[_0xed17('0x20')]),_0x42ffe4);}});ami['on'](_0xed17('0x21'),function(_0x55f61b){try{utils[_0xed17('0x1e')](util['format'](_0xed17('0x22'),_0x55f61b[_0xed17('0x20')]),_0x55f61b);agents[_0xed17('0x21')](_0x55f61b);}catch(_0x593aa8){utils[_0xed17('0x17')](util['format'](_0xed17('0x22'),_0x55f61b['uniqueid']),_0x593aa8);}});ami['on'](_0xed17('0x23'),function(_0x299528){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][agentconnect]',_0x299528[_0xed17('0x20')]),_0x299528);agents[_0xed17('0x23')](_0x299528);queues[_0xed17('0x23')](_0x299528);}catch(_0x4352c5){utils[_0xed17('0x17')](util['format'](_0xed17('0x24'),_0x299528[_0xed17('0x20')]),_0x4352c5);}});ami['on'](_0xed17('0x25'),function(_0x1a8673){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][agentcomplete]',_0x1a8673[_0xed17('0x20')]),_0x1a8673);agents[_0xed17('0x25')](_0x1a8673);queues[_0xed17('0x25')](_0x1a8673);members[_0xed17('0x25')](_0x1a8673);}catch(_0x4db0fa){utils[_0xed17('0x17')](util[_0xed17('0x1b')]('[%s][index][agentcomplete]',_0x1a8673[_0xed17('0x20')]),_0x4db0fa);}});ami['on']('queuecallerabandon',function(_0x42374a){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')](_0xed17('0x26'),_0x42374a[_0xed17('0x20')]),_0x42374a);agents['queuecallerabandon'](_0x42374a);queues[_0xed17('0x27')](_0x42374a);}catch(_0x3c6064){utils['error'](util[_0xed17('0x1b')](_0xed17('0x26'),_0x42374a[_0xed17('0x20')]),_0x3c6064);}});ami['on']('queuecallerjoin',function(_0x144852){try{utils['debug'](util[_0xed17('0x1b')]('[%s][index][queuecallerjoin]',_0x144852['uniqueid']),_0x144852);queues[_0xed17('0x28')](_0x144852);recordings['queuecallerjoin'](_0x144852);}catch(_0x1982d6){utils[_0xed17('0x17')](util[_0xed17('0x1b')]('[%s][index][queuecallerjoin]',_0x144852['uniqueid']),_0x1982d6);}});ami['on'](_0xed17('0x29'),function(_0x427ee6){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')](_0xed17('0x2a'),_0x427ee6[_0xed17('0x20')]),_0x427ee6);queues[_0xed17('0x29')](_0x427ee6);}catch(_0x29f0ea){utils['error'](util[_0xed17('0x1b')]('[%s][index][queuecallerleave]',_0x427ee6['uniqueid']),_0x29f0ea);}});ami['on'](_0xed17('0x2b'),function(_0x696478){try{utils[_0xed17('0x1e')](util['format'](_0xed17('0x2c'),_0x696478[_0xed17('0x20')]),_0x696478);queues[_0xed17('0x2b')](_0x696478);calls[_0xed17('0x2b')](_0x696478);}catch(_0x2bdbf8){utils['error'](util[_0xed17('0x1b')](_0xed17('0x2c'),_0x696478[_0xed17('0x20')]),_0x2bdbf8);}});ami['on'](_0xed17('0x2d'),function(_0x2de6bc){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][musiconholdstop]',_0x2de6bc[_0xed17('0x20')]),_0x2de6bc);queues[_0xed17('0x2d')](_0x2de6bc);calls[_0xed17('0x2d')](_0x2de6bc);}catch(_0x194ece){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x2e'),_0x2de6bc[_0xed17('0x20')]),_0x194ece);}});ami['on'](_0xed17('0x2f'),function(_0x329afb){try{utils[_0xed17('0x1e')](util['format']('[%s][index][newstate]',_0x329afb[_0xed17('0x20')]),_0x329afb);calls[_0xed17('0x2f')](_0x329afb);recordings['newstate'](_0x329afb);}catch(_0x34f2b9){utils['error'](util[_0xed17('0x1b')](_0xed17('0x30'),_0x329afb[_0xed17('0x20')]),_0x34f2b9);}});ami['on']('hangup',function(_0x142742){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')](_0xed17('0x31'),_0x142742[_0xed17('0x20')]),_0x142742);calls[_0xed17('0x32')](_0x142742);recordings[_0xed17('0x32')](_0x142742);dials[_0xed17('0x32')](_0x142742);agents['hangup'](_0x142742);queues[_0xed17('0x32')](_0x142742);}catch(_0xb35ccb){utils[_0xed17('0x17')](util[_0xed17('0x1b')]('[%s][index][hangup]',_0x142742[_0xed17('0x20')]),_0xb35ccb);}});ami['on'](_0xed17('0x33'),function(_0x48b4a5){try{utils['debug'](util[_0xed17('0x1b')](_0xed17('0x34'),_0x48b4a5[_0xed17('0x20')]),_0x48b4a5);members[_0xed17('0x33')](_0x48b4a5);}catch(_0x2a0823){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x34'),_0x48b4a5[_0xed17('0x20')]),_0x2a0823);}});ami['on'](_0xed17('0x35'),function(_0x363e0d){try{utils[_0xed17('0x1e')](util['format'](_0xed17('0x36'),_0x363e0d[_0xed17('0x20')]),_0x363e0d);queues[_0xed17('0x35')](_0x363e0d);agents[_0xed17('0x35')](_0x363e0d);transfers[_0xed17('0x35')](_0x363e0d);}catch(_0xdea8be){utils['error'](util[_0xed17('0x1b')](_0xed17('0x36'),_0x363e0d[_0xed17('0x20')]),_0xdea8be);}});ami['on'](_0xed17('0x37'),function(_0x23f10f){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][attendedtransfer]',_0x23f10f[_0xed17('0x38')]),_0x23f10f);queues[_0xed17('0x37')](_0x23f10f);transfers[_0xed17('0x37')](_0x23f10f);agents[_0xed17('0x37')](_0x23f10f);calls['attendedtransfer'](_0x23f10f);}catch(_0x129938){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x39'),_0x23f10f[_0xed17('0x38')]),_0x129938);}});ami['on'](_0xed17('0x3a'),function(_0x1c9409){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')]('[%s][index][varset]',_0x1c9409['uniqueid']),_0x1c9409);queues[_0xed17('0x3a')](_0x1c9409);recordings[_0xed17('0x3a')](_0x1c9409);calls[_0xed17('0x3a')](_0x1c9409);dials[_0xed17('0x3a')](_0x1c9409);}catch(_0x5f1ef5){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x3b'),_0x1c9409[_0xed17('0x20')]),_0x5f1ef5);}});ami['on'](_0xed17('0x3c'),function(_0x11ae7f){try{utils[_0xed17('0x1e')](util['format'](_0xed17('0x3d'),_0x11ae7f['uniqueid']),_0x11ae7f);calls[_0xed17('0x3c')](_0x11ae7f);recordings[_0xed17('0x3c')](_0x11ae7f);dials[_0xed17('0x3c')](_0x11ae7f);}catch(_0x14ccc8){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x3d'),_0x11ae7f[_0xed17('0x20')]),_0x14ccc8);}});ami['on']('newchannel',function(_0x317730){try{utils['debug'](util[_0xed17('0x1b')](_0xed17('0x3e'),_0x317730[_0xed17('0x20')]),_0x317730);calls[_0xed17('0x3f')](_0x317730);recordings['newchannel'](_0x317730);}catch(_0x182127){utils[_0xed17('0x17')](util[_0xed17('0x1b')](_0xed17('0x3e'),_0x317730[_0xed17('0x20')]),_0x182127);}});ami['on'](_0xed17('0x40'),function(_0x3a2939){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')](_0xed17('0x41'),_0x3a2939['uniqueid']),_0x3a2939);dials[_0xed17('0x40')](_0x3a2939);}catch(_0x1345f3){utils['error'](util['format'](_0xed17('0x42'),_0x3a2939[_0xed17('0x20')]),_0x1345f3);}});ami['on'](_0xed17('0x43'),function(_0x5504eb){try{utils[_0xed17('0x1e')](util[_0xed17('0x1b')](_0xed17('0x44'),_0x5504eb[_0xed17('0x20')]),_0x5504eb);dials['dialend'](_0x5504eb);}catch(_0x5a20e2){utils['error'](util['format'](_0xed17('0x44'),_0x5504eb[_0xed17('0x20')]),_0x5a20e2);}});} \ No newline at end of file +var _0x5a75=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','asterisk','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','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x5a75,0x1af));var _0x55a7=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x5a75[_0x4f08dd];return _0x3017ee;};var AsteriskManager=require(_0x55a7('0x0'));var config=require('../../config/environment');var utils=require(_0x55a7('0x1'));var util=require(_0x55a7('0x2'));var isXDREnabled=config['xdr']&&config[_0x55a7('0x3')][_0x55a7('0x4')]?!config[_0x55a7('0x3')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x55a7('0x3')]&&config[_0x55a7('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x55a7('0x5')]['port'],config[_0x55a7('0x5')]['ip'],config[_0x55a7('0x5')]['username'],config[_0x55a7('0x5')][_0x55a7('0x6')],!![]);ami[_0x55a7('0x7')]();if(!isXDREnabled){utils[_0x55a7('0x8')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x55a7('0x8')](_0x55a7('0x9'));}else{var agents=require(_0x55a7('0xa'));var calls=require(_0x55a7('0xb'));var queues=require(_0x55a7('0xc'));var recordings=require(_0x55a7('0xd'));var members=require(_0x55a7('0xe'));var dials=require(_0x55a7('0xf'));var transfers=require(_0x55a7('0x10'));var core=require(_0x55a7('0x11'));ami['on'](_0x55a7('0x12'),core['connect']);ami['on'](_0x55a7('0x13'),core[_0x55a7('0x13')]);ami['on'](_0x55a7('0x14'),core['fullybooted']);ami['on'](_0x55a7('0x15'),core['error']);ami['on'](_0x55a7('0x16'),core[_0x55a7('0x16')]);ami['on'](_0x55a7('0x17'),core[_0x55a7('0x17')]);ami['on'](_0x55a7('0x18'),function(_0x1edccc){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x1b'),_0x1edccc['device']),_0x1edccc);members[_0x55a7('0x18')](_0x1edccc);}catch(_0xf0db0c){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x1b'),_0x1edccc[_0x55a7('0x1c')]),_0xf0db0c);}});ami['on'](_0x55a7('0x1d'),function(_0x6dd328){try{utils['debug'](util['format'](_0x55a7('0x1e'),_0x6dd328[_0x55a7('0x1f')]),_0x6dd328);agents[_0x55a7('0x1d')](_0x6dd328);}catch(_0x2ed9de){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x1e'),_0x6dd328['uniqueid']),_0x2ed9de);}});ami['on']('agentringnoanswer',function(_0x5b874e){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][agentringnoanswer]',_0x5b874e[_0x55a7('0x1f')]),_0x5b874e);agents[_0x55a7('0x20')](_0x5b874e);}catch(_0x4070f5){utils['error'](util['format'](_0x55a7('0x21'),_0x5b874e['uniqueid']),_0x4070f5);}});ami['on'](_0x55a7('0x22'),function(_0x33616a){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x23'),_0x33616a[_0x55a7('0x1f')]),_0x33616a);agents[_0x55a7('0x22')](_0x33616a);queues[_0x55a7('0x22')](_0x33616a);}catch(_0x5d8bb2){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x23'),_0x33616a[_0x55a7('0x1f')]),_0x5d8bb2);}});ami['on'](_0x55a7('0x24'),function(_0x44a294){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x25'),_0x44a294[_0x55a7('0x1f')]),_0x44a294);agents[_0x55a7('0x24')](_0x44a294);queues[_0x55a7('0x24')](_0x44a294);members[_0x55a7('0x24')](_0x44a294);}catch(_0x291cad){utils[_0x55a7('0x15')](util['format']('[%s][index][agentcomplete]',_0x44a294[_0x55a7('0x1f')]),_0x291cad);}});ami['on']('queuecallerabandon',function(_0x421ca8){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][queuecallerabandon]',_0x421ca8[_0x55a7('0x1f')]),_0x421ca8);agents['queuecallerabandon'](_0x421ca8);queues[_0x55a7('0x26')](_0x421ca8);}catch(_0x4912aa){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x27'),_0x421ca8[_0x55a7('0x1f')]),_0x4912aa);}});ami['on'](_0x55a7('0x28'),function(_0x47941e){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x29'),_0x47941e[_0x55a7('0x1f')]),_0x47941e);queues['queuecallerjoin'](_0x47941e);recordings['queuecallerjoin'](_0x47941e);}catch(_0xddd70d){utils['error'](util['format'](_0x55a7('0x29'),_0x47941e[_0x55a7('0x1f')]),_0xddd70d);}});ami['on']('queuecallerleave',function(_0x2cd2bf){try{utils['debug'](util[_0x55a7('0x1a')](_0x55a7('0x2a'),_0x2cd2bf[_0x55a7('0x1f')]),_0x2cd2bf);queues[_0x55a7('0x2b')](_0x2cd2bf);}catch(_0x51ac6e){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')]('[%s][index][queuecallerleave]',_0x2cd2bf[_0x55a7('0x1f')]),_0x51ac6e);}});ami['on'](_0x55a7('0x2c'),function(_0x4375ef){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x2d'),_0x4375ef[_0x55a7('0x1f')]),_0x4375ef);queues[_0x55a7('0x2c')](_0x4375ef);calls[_0x55a7('0x2c')](_0x4375ef);}catch(_0x73911d){utils[_0x55a7('0x15')](util['format']('[%s][index][musiconholdstart]',_0x4375ef[_0x55a7('0x1f')]),_0x73911d);}});ami['on']('musiconholdstop',function(_0x295bfb){try{utils[_0x55a7('0x19')](util['format'](_0x55a7('0x2e'),_0x295bfb['uniqueid']),_0x295bfb);queues[_0x55a7('0x2f')](_0x295bfb);calls[_0x55a7('0x2f')](_0x295bfb);}catch(_0x281e0a){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x2e'),_0x295bfb[_0x55a7('0x1f')]),_0x281e0a);}});ami['on'](_0x55a7('0x30'),function(_0x2dbbf8){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x31'),_0x2dbbf8[_0x55a7('0x1f')]),_0x2dbbf8);calls[_0x55a7('0x30')](_0x2dbbf8);recordings['newstate'](_0x2dbbf8);}catch(_0x232b43){utils['error'](util[_0x55a7('0x1a')](_0x55a7('0x31'),_0x2dbbf8[_0x55a7('0x1f')]),_0x232b43);}});ami['on'](_0x55a7('0x32'),function(_0x21c5ef){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x33'),_0x21c5ef[_0x55a7('0x1f')]),_0x21c5ef);calls['hangup'](_0x21c5ef);recordings[_0x55a7('0x32')](_0x21c5ef);dials[_0x55a7('0x32')](_0x21c5ef);agents['hangup'](_0x21c5ef);queues['hangup'](_0x21c5ef);}catch(_0x4b4e03){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x33'),_0x21c5ef[_0x55a7('0x1f')]),_0x4b4e03);}});ami['on']('cdr',function(_0x175b08){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x34'),_0x175b08['uniqueid']),_0x175b08);members['cdr'](_0x175b08);}catch(_0x2e4fab){utils['error'](util['format'](_0x55a7('0x34'),_0x175b08[_0x55a7('0x1f')]),_0x2e4fab);}});ami['on'](_0x55a7('0x35'),function(_0x775b31){try{utils['debug'](util['format'](_0x55a7('0x36'),_0x775b31[_0x55a7('0x1f')]),_0x775b31);queues[_0x55a7('0x35')](_0x775b31);agents[_0x55a7('0x35')](_0x775b31);transfers[_0x55a7('0x35')](_0x775b31);}catch(_0x5bc7bd){utils['error'](util['format'](_0x55a7('0x36'),_0x775b31[_0x55a7('0x1f')]),_0x5bc7bd);}});ami['on']('attendedtransfer',function(_0x19898c){try{utils[_0x55a7('0x19')](util['format'](_0x55a7('0x37'),_0x19898c[_0x55a7('0x38')]),_0x19898c);queues['attendedtransfer'](_0x19898c);transfers[_0x55a7('0x39')](_0x19898c);agents[_0x55a7('0x39')](_0x19898c);calls[_0x55a7('0x39')](_0x19898c);}catch(_0x52727d){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x37'),_0x19898c[_0x55a7('0x38')]),_0x52727d);}});ami['on'](_0x55a7('0x3a'),function(_0x2f3728){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x3b'),_0x2f3728[_0x55a7('0x1f')]),_0x2f3728);queues['varset'](_0x2f3728);recordings[_0x55a7('0x3a')](_0x2f3728);calls[_0x55a7('0x3a')](_0x2f3728);dials['varset'](_0x2f3728);}catch(_0x2cb7e1){utils[_0x55a7('0x15')](util['format'](_0x55a7('0x3b'),_0x2f3728[_0x55a7('0x1f')]),_0x2cb7e1);}});ami['on']('newexten',function(_0x2bfef9){try{utils['debug'](util['format'](_0x55a7('0x3c'),_0x2bfef9[_0x55a7('0x1f')]),_0x2bfef9);calls[_0x55a7('0x3d')](_0x2bfef9);recordings[_0x55a7('0x3d')](_0x2bfef9);dials['newexten'](_0x2bfef9);}catch(_0x107420){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x3c'),_0x2bfef9['uniqueid']),_0x107420);}});ami['on'](_0x55a7('0x3e'),function(_0x42654c){try{utils['debug'](util[_0x55a7('0x1a')](_0x55a7('0x3f'),_0x42654c['uniqueid']),_0x42654c);calls[_0x55a7('0x3e')](_0x42654c);recordings[_0x55a7('0x3e')](_0x42654c);}catch(_0x5cf039){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')]('[%s][index][newchannel]',_0x42654c[_0x55a7('0x1f')]),_0x5cf039);}});ami['on']('dialbegin',function(_0x322326){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')](_0x55a7('0x40'),_0x322326[_0x55a7('0x1f')]),_0x322326);dials[_0x55a7('0x41')](_0x322326);}catch(_0x5b2039){utils[_0x55a7('0x15')](util[_0x55a7('0x1a')](_0x55a7('0x42'),_0x322326[_0x55a7('0x1f')]),_0x5b2039);}});ami['on'](_0x55a7('0x43'),function(_0x2e64f9){try{utils[_0x55a7('0x19')](util[_0x55a7('0x1a')]('[%s][index][dialend]',_0x2e64f9[_0x55a7('0x1f')]),_0x2e64f9);dials['dialend'](_0x2e64f9);}catch(_0x3d9bf6){utils['error'](util['format'](_0x55a7('0x44'),_0x2e64f9[_0x55a7('0x1f')]),_0x3d9bf6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 526f805..337734e 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 _0xafc1=['util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','membername','internal','request','getUserByName','split','name','CreateMemberReport','catch','format','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','source','destination','data1','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash'];(function(_0x395863,_0x1e655f){var _0xbd9399=function(_0xe77f88){while(--_0xe77f88){_0x395863['push'](_0x395863['shift']());}};_0xbd9399(++_0x1e655f);}(_0xafc1,0x1dc));var _0x1afc=function(_0x131f84,_0x49d320){_0x131f84=_0x131f84-0x0;var _0x1ccd8a=_0xafc1[_0x131f84];return _0x1ccd8a;};'use strict';var _=require(_0x1afc('0x0'));var util=require(_0x1afc('0x1'));var utils=require(_0x1afc('0x2'));var members={};var exclude=[_0x1afc('0x3'),_0x1afc('0x4')];function writeDB(_0xcfb51b){utils[_0x1afc('0x5')](util['format'](_0x1afc('0x6'),_0xcfb51b[_0x1afc('0x7')],_0xcfb51b[_0x1afc('0x8')],_0xcfb51b[_0x1afc('0x9')],_0xcfb51b[_0x1afc('0xa')],_0xcfb51b['membername'],_0xcfb51b[_0x1afc('0xb')]));if(_0xcfb51b[_0x1afc('0x8')]){utils[_0x1afc('0xc')](_0xcfb51b[_0x1afc('0x8')])[_0x1afc('0xd')](function(_0x3180ea){if(_0x3180ea){_0xcfb51b[_0x1afc('0xe')]=_0x3180ea['name'];_0xcfb51b[_0x1afc('0xf')]=_0x3180ea['internal'];utils[_0x1afc('0x10')]('CreateMemberReport',_0xcfb51b);}else{utils[_0x1afc('0x11')](_0xcfb51b[_0x1afc('0x8')][_0x1afc('0x12')]('/')[0x1])[_0x1afc('0xd')](function(_0x2b47a1){if(_0x2b47a1){_0xcfb51b[_0x1afc('0xe')]=_0x2b47a1[_0x1afc('0x13')];_0xcfb51b[_0x1afc('0xf')]=_0x2b47a1['internal'];utils[_0x1afc('0x10')](_0x1afc('0x14'),_0xcfb51b);}});}})[_0x1afc('0x15')](function(_0x58acaa){utils['error'](util[_0x1afc('0x16')]('[%s][members][writeDB]',_0xcfb51b[_0x1afc('0x7')]),_0x58acaa);});}delete members[_0xcfb51b[_0x1afc('0x8')]];}function startsWith(_0x1d3921,_0x44370a){return _['some'](_0x1d3921,function(_0x580e19){return _[_0x1afc('0x17')](_0x44370a,_0x580e19);});}exports['devicestatechange']=function(_0x2f93fa){try{utils[_0x1afc('0x18')](util[_0x1afc('0x16')](_0x1afc('0x19'),members[_0x2f93fa['device']]?members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x7')]:_0x2f93fa[_0x1afc('0x1a')]),_0x2f93fa);utils[_0x1afc('0x5')](util[_0x1afc('0x16')](_0x1afc('0x1b'),members[_0x2f93fa[_0x1afc('0x1a')]]?members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x7')]:_0x2f93fa[_0x1afc('0x1a')],_0x2f93fa['state'],_0x2f93fa['device']));switch(_0x2f93fa[_0x1afc('0x1c')]){case _0x1afc('0x1d'):case _0x1afc('0x1e'):if(!startsWith(exclude,_0x2f93fa['device'])){members[_0x2f93fa[_0x1afc('0x1a')]]={'channel':'voice','interface':_0x2f93fa[_0x1afc('0x1a')],'type':_0x1afc('0x1f'),'enterAt':utils[_0x1afc('0x20')](),'role':_0x1afc('0x21')};}break;case _0x1afc('0x22'):if(!_[_0x1afc('0x23')](members[_0x2f93fa[_0x1afc('0x1a')]])){members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x24')]=utils['now']();members[_0x2f93fa['device']][_0x1afc('0x25')]=utils['diffTime'](members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x24')],members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x26')]);if(members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x7')]){writeDB(members[_0x2f93fa[_0x1afc('0x1a')]]);}}break;default:break;}}catch(_0x4dcd7b){utils[_0x1afc('0x27')](util[_0x1afc('0x16')](_0x1afc('0x19'),members[_0x2f93fa[_0x1afc('0x1a')]]?members[_0x2f93fa[_0x1afc('0x1a')]][_0x1afc('0x7')]:_0x2f93fa[_0x1afc('0x1a')]),_0x4dcd7b);}};exports[_0x1afc('0x28')]=function(_0x2a9242){try{if(!_[_0x1afc('0x23')](members[_0x2a9242[_0x1afc('0x8')]])){utils[_0x1afc('0x18')](util[_0x1afc('0x16')](_0x1afc('0x29'),_0x2a9242[_0x1afc('0x7')]),_0x2a9242);utils[_0x1afc('0x5')](util[_0x1afc('0x16')](_0x1afc('0x2a'),_0x2a9242[_0x1afc('0x7')],_0x2a9242[_0x1afc('0x8')],_0x2a9242['queue']));members[_0x2a9242[_0x1afc('0x8')]]=_[_0x1afc('0x2b')](members[_0x2a9242[_0x1afc('0x8')]],{'data4':_0x2a9242[_0x1afc('0x2c')],'uniqueid':_0x2a9242[_0x1afc('0x7')]});}}catch(_0x578931){utils['error'](util[_0x1afc('0x16')](_0x1afc('0x29'),_0x2a9242[_0x1afc('0x7')]),_0x578931);}};exports[_0x1afc('0x2d')]=function(_0x5925ab){try{utils[_0x1afc('0x18')](util[_0x1afc('0x16')]('[%s][members][cdr]',_0x5925ab[_0x1afc('0x7')]),_0x5925ab);if(_0x5925ab[_0x1afc('0x9')]){var _0x5f18ff=_0x5925ab[_0x1afc('0x9')][_0x1afc('0x12')]('-')[0x0];if(!_['isNil'](members[_0x5f18ff])){members[_0x5f18ff]=_[_0x1afc('0x2b')](members[_0x5f18ff],{'data1':members[_0x5f18ff]['data1']||_0x5925ab[_0x1afc('0xb')],'data2':members[_0x5f18ff][_0x1afc('0xa')]||_0x5925ab[_0x1afc('0x2e')],'data3':members[_0x5f18ff]['data3']||_0x5925ab[_0x1afc('0x2f')],'uniqueid':members[_0x5f18ff][_0x1afc('0x7')]||_0x5925ab[_0x1afc('0x7')]});utils['info'](util[_0x1afc('0x16')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5925ab['uniqueid'],members[_0x5f18ff][_0x1afc('0x30')],members[_0x5f18ff]['data2'],members[_0x5f18ff]['data3']));if(members[_0x5f18ff][_0x1afc('0x24')]){writeDB(members[_0x5f18ff]);}}}if(_0x5925ab[_0x1afc('0x31')]){var _0x98df43=_0x5925ab['destinationchannel'][_0x1afc('0x12')]('-')[0x0];if(!_[_0x1afc('0x23')](members[_0x98df43])){members[_0x98df43]=_[_0x1afc('0x2b')](members[_0x98df43],{'data1':members[_0x98df43][_0x1afc('0x30')]||_0x5925ab[_0x1afc('0xb')],'data2':members[_0x98df43][_0x1afc('0xa')]||_0x5925ab[_0x1afc('0x2e')],'data3':members[_0x98df43][_0x1afc('0x32')]||_0x5925ab[_0x1afc('0x2f')],'uniqueid':members[_0x98df43][_0x1afc('0x7')]||_0x5925ab[_0x1afc('0x7')]});utils[_0x1afc('0x5')](util[_0x1afc('0x16')](_0x1afc('0x33'),_0x5925ab[_0x1afc('0x7')],members[_0x98df43][_0x1afc('0x30')],members[_0x98df43]['data2'],members[_0x98df43]['data3']));if(members[_0x98df43][_0x1afc('0x24')]){writeDB(members[_0x98df43]);}}}}catch(_0x91f10f){utils['error'](util['format'](_0x1afc('0x34'),_0x5925ab[_0x1afc('0x7')]),_0x91f10f);}}; \ No newline at end of file +var _0x8f69=['isNil','exitAt','now','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source','error','lodash','util','./utils','Queue:','info','uniqueid','channel','data2','membername','type','getUserByInterface','interface','then','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','state','INUSE','BUSY','TALKING','agent','NOT_INUSE'];(function(_0x4f6cc2,_0x406ed8){var _0x3c56b3=function(_0x5a6cfb){while(--_0x5a6cfb){_0x4f6cc2['push'](_0x4f6cc2['shift']());}};_0x3c56b3(++_0x406ed8);}(_0x8f69,0xfa));var _0x98f6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8f69[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var utils=require(_0x98f6('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x98f6('0x3')];function writeDB(_0x2641ae){utils[_0x98f6('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2641ae[_0x98f6('0x5')],_0x2641ae['interface'],_0x2641ae[_0x98f6('0x6')],_0x2641ae[_0x98f6('0x7')],_0x2641ae[_0x98f6('0x8')],_0x2641ae[_0x98f6('0x9')]));if(_0x2641ae['interface']){utils[_0x98f6('0xa')](_0x2641ae[_0x98f6('0xb')])[_0x98f6('0xc')](function(_0x1055c9){if(_0x1055c9){_0x2641ae[_0x98f6('0x8')]=_0x1055c9['name'];_0x2641ae[_0x98f6('0xd')]=_0x1055c9[_0x98f6('0xd')];utils[_0x98f6('0xe')](_0x98f6('0xf'),_0x2641ae);}else{utils['getUserByName'](_0x2641ae[_0x98f6('0xb')][_0x98f6('0x10')]('/')[0x1])[_0x98f6('0xc')](function(_0x5c997b){if(_0x5c997b){_0x2641ae[_0x98f6('0x8')]=_0x5c997b['name'];_0x2641ae[_0x98f6('0xd')]=_0x5c997b['internal'];utils[_0x98f6('0xe')](_0x98f6('0xf'),_0x2641ae);}});}})[_0x98f6('0x11')](function(_0x537c00){utils['error'](util['format'](_0x98f6('0x12'),_0x2641ae[_0x98f6('0x5')]),_0x537c00);});}delete members[_0x2641ae[_0x98f6('0xb')]];}function startsWith(_0x274fed,_0x44dfb2){return _[_0x98f6('0x13')](_0x274fed,function(_0x19b67c){return _[_0x98f6('0x14')](_0x44dfb2,_0x19b67c);});}exports[_0x98f6('0x15')]=function(_0x2a7ded){try{utils[_0x98f6('0x16')](util[_0x98f6('0x17')](_0x98f6('0x18'),members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]]['uniqueid']:_0x2a7ded[_0x98f6('0x19')]),_0x2a7ded);utils[_0x98f6('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x5')]:_0x2a7ded[_0x98f6('0x19')],_0x2a7ded[_0x98f6('0x1a')],_0x2a7ded[_0x98f6('0x19')]));switch(_0x2a7ded['state']){case _0x98f6('0x1b'):case _0x98f6('0x1c'):if(!startsWith(exclude,_0x2a7ded[_0x98f6('0x19')])){members[_0x2a7ded['device']]={'channel':'voice','interface':_0x2a7ded[_0x98f6('0x19')],'type':_0x98f6('0x1d'),'enterAt':utils['now'](),'role':_0x98f6('0x1e')};}break;case _0x98f6('0x1f'):if(!_[_0x98f6('0x20')](members[_0x2a7ded[_0x98f6('0x19')]])){members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x21')]=utils[_0x98f6('0x22')]();members[_0x2a7ded[_0x98f6('0x19')]]['duration']=utils[_0x98f6('0x23')](members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x21')],members[_0x2a7ded[_0x98f6('0x19')]]['enterAt']);if(members[_0x2a7ded['device']]['uniqueid']){writeDB(members[_0x2a7ded['device']]);}}break;default:break;}}catch(_0x224c13){utils['error'](util[_0x98f6('0x17')](_0x98f6('0x18'),members[_0x2a7ded[_0x98f6('0x19')]]?members[_0x2a7ded[_0x98f6('0x19')]][_0x98f6('0x5')]:_0x2a7ded[_0x98f6('0x19')]),_0x224c13);}};exports[_0x98f6('0x24')]=function(_0x5877ea){try{if(!_[_0x98f6('0x20')](members[_0x5877ea['interface']])){utils[_0x98f6('0x16')](util[_0x98f6('0x17')](_0x98f6('0x25'),_0x5877ea['uniqueid']),_0x5877ea);utils[_0x98f6('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5877ea[_0x98f6('0x5')],_0x5877ea[_0x98f6('0xb')],_0x5877ea[_0x98f6('0x26')]));members[_0x5877ea[_0x98f6('0xb')]]=_[_0x98f6('0x27')](members[_0x5877ea['interface']],{'data4':_0x5877ea[_0x98f6('0x26')],'uniqueid':_0x5877ea[_0x98f6('0x5')]});}}catch(_0x28ad97){utils['error'](util[_0x98f6('0x17')]('[%s][members][agentcomplete]',_0x5877ea['uniqueid']),_0x28ad97);}};exports[_0x98f6('0x28')]=function(_0x4e27c8){try{utils[_0x98f6('0x16')](util[_0x98f6('0x17')]('[%s][members][cdr]',_0x4e27c8['uniqueid']),_0x4e27c8);if(_0x4e27c8[_0x98f6('0x6')]){var _0x1c3cea=_0x4e27c8['channel'][_0x98f6('0x10')]('-')[0x0];if(!_[_0x98f6('0x20')](members[_0x1c3cea])){members[_0x1c3cea]=_[_0x98f6('0x27')](members[_0x1c3cea],{'data1':members[_0x1c3cea][_0x98f6('0x29')]||_0x4e27c8[_0x98f6('0x9')],'data2':members[_0x1c3cea][_0x98f6('0x7')]||_0x4e27c8['source'],'data3':members[_0x1c3cea][_0x98f6('0x2a')]||_0x4e27c8[_0x98f6('0x2b')],'uniqueid':members[_0x1c3cea][_0x98f6('0x5')]||_0x4e27c8[_0x98f6('0x5')]});utils[_0x98f6('0x4')](util['format'](_0x98f6('0x2c'),_0x4e27c8['uniqueid'],members[_0x1c3cea][_0x98f6('0x29')],members[_0x1c3cea]['data2'],members[_0x1c3cea]['data3']));if(members[_0x1c3cea][_0x98f6('0x21')]){writeDB(members[_0x1c3cea]);}}}if(_0x4e27c8['destinationchannel']){var _0x597b08=_0x4e27c8['destinationchannel'][_0x98f6('0x10')]('-')[0x0];if(!_[_0x98f6('0x20')](members[_0x597b08])){members[_0x597b08]=_['assign'](members[_0x597b08],{'data1':members[_0x597b08][_0x98f6('0x29')]||_0x4e27c8['type'],'data2':members[_0x597b08][_0x98f6('0x7')]||_0x4e27c8[_0x98f6('0x2d')],'data3':members[_0x597b08]['data3']||_0x4e27c8['destination'],'uniqueid':members[_0x597b08][_0x98f6('0x5')]||_0x4e27c8['uniqueid']});utils['info'](util[_0x98f6('0x17')](_0x98f6('0x2c'),_0x4e27c8['uniqueid'],members[_0x597b08][_0x98f6('0x29')],members[_0x597b08][_0x98f6('0x7')],members[_0x597b08][_0x98f6('0x2a')]));if(members[_0x597b08]['exitAt']){writeDB(members[_0x597b08]);}}}}catch(_0x5701eb){utils[_0x98f6('0x2e')](util[_0x98f6('0x17')]('[%s][members][cdr]',_0x4e27c8[_0x98f6('0x5')]),_0x5701eb);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index fab4f9c..28b08b4 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 _0x03e7=['util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','toUpperCase','CONTINUE','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','origtransfererlinkedid','transfereelinkedid','clone','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0x03e7,0x65));var _0x703e=function(_0x38742b,_0x50b2b4){_0x38742b=_0x38742b-0x0;var _0x3b0bbb=_0x03e7[_0x38742b];return _0x3b0bbb;};'use strict';var _=require(_0x703e('0x0'));var util=require(_0x703e('0x1'));var utils=require(_0x703e('0x2'));var queues={};function writeDB(_0x450cff){utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x5'),_0x450cff['uniqueid'],_0x450cff[_0x703e('0x6')],_0x450cff['queue'],_0x450cff[_0x703e('0x7')],_0x450cff[_0x703e('0x8')],_0x450cff[_0x703e('0x9')],_0x450cff[_0x703e('0xa')]));if(_0x450cff[_0x703e('0xb')]){utils['getVoiceQueueByName'](_0x450cff['queue'])['then'](function(_0x39cc9b){if(_0x39cc9b){_0x450cff[_0x703e('0xc')]=_0x39cc9b[_0x703e('0xc')];}utils[_0x703e('0xd')](_0x703e('0xe'),_0x450cff);});}else{utils[_0x703e('0xd')](_0x703e('0xe'),_0x450cff);}if(_0x450cff[_0x703e('0xf')]){delete queues[_0x450cff[_0x703e('0xf')]];}else{delete queues[_0x450cff[_0x703e('0x10')]];}}exports[_0x703e('0x11')]=function(_0x31810a){try{utils['debug'](util[_0x703e('0x4')](_0x703e('0x12'),_0x31810a[_0x703e('0x10')]),_0x31810a);utils['info'](util[_0x703e('0x4')](_0x703e('0x13'),_0x31810a[_0x703e('0x10')],_0x31810a[_0x703e('0xb')],_0x31810a['position']));queues[_0x31810a[_0x703e('0x10')]]=_[_0x703e('0x14')](_0x31810a,{'originalposition':_0x31810a[_0x703e('0x15')],'queuecallerjoinAt':utils[_0x703e('0x16')](),'mohtime':0x0});}catch(_0x2cb918){utils['error'](util['format'](_0x703e('0x12'),_0x31810a[_0x703e('0x10')]),_0x2cb918);}};exports['hangup']=function(_0x35d314){try{if(!_[_0x703e('0x17')](queues[_0x35d314['uniqueid']])){utils[_0x703e('0x18')](util[_0x703e('0x4')](_0x703e('0x19'),_0x35d314[_0x703e('0x10')]),_0x35d314);if(queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1a')]){if(!queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1b')]&&!queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1c')]){queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1d')]=!![];queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1e')]=utils[_0x703e('0x16')]();queues[_0x35d314[_0x703e('0x10')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x703e('0x3')](util[_0x703e('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x35d314[_0x703e('0x10')],queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1f')],queues[_0x35d314[_0x703e('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x35d314[_0x703e('0x10')]]);}else if(queues[_0x35d314['uniqueid']][_0x703e('0xf')]){utils[_0x703e('0x3')](util['format'](_0x703e('0x20'),_0x35d314[_0x703e('0x10')],queues[_0x35d314[_0x703e('0x10')]][_0x703e('0x1f')],queues[_0x35d314['uniqueid']][_0x703e('0xf')]));queues[queues[_0x35d314['uniqueid']]['transfereduniqueid']]=queues[_0x35d314[_0x703e('0x10')]];queues[queues[_0x35d314['uniqueid']]['transfereduniqueid']][_0x703e('0x21')]=0x2;delete queues[_0x35d314[_0x703e('0x10')]];}}}catch(_0x27479c){utils['error'](util['format'](_0x703e('0x19'),_0x35d314[_0x703e('0x10')]),_0x27479c);}};exports[_0x703e('0x22')]=function(_0xaf770b){try{utils['debug'](util[_0x703e('0x4')](_0x703e('0x23'),_0xaf770b[_0x703e('0x10')]),_0xaf770b);if(!_['isNil'](_0xaf770b[_0x703e('0x24')]['queuestatus'])&&_0xaf770b['value'][_0x703e('0x25')]()!==_0x703e('0x26')){if(!_[_0x703e('0x17')](queues[_0xaf770b[_0x703e('0x10')]])){queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x1b')]=![];queues[_0xaf770b[_0x703e('0x10')]]['queuecallerabandonAt']=null;queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x1c')]=!![];queues[_0xaf770b['uniqueid']]['queuecallerexitAt']=utils[_0x703e('0x16')]();queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0xa')]=_0xaf770b[_0x703e('0x27')][_0x703e('0x25')]();utils[_0x703e('0x3')](util['format'](_0x703e('0x28'),_0xaf770b['uniqueid'],queues[_0xaf770b['uniqueid']][_0x703e('0x1f')],_0xaf770b['value'],queues[_0xaf770b[_0x703e('0x10')]]['queuecallerexitreason']));writeDB(queues[_0xaf770b['uniqueid']]);}}else if(!_['isNil'](_0xaf770b[_0x703e('0x24')][_0x703e('0x29')])){if(!_[_0x703e('0x17')](queues[_0xaf770b[_0x703e('0x10')]])&&!queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x1b')]){queues[_0xaf770b['uniqueid']][_0x703e('0x1b')]=![];queues[_0xaf770b[_0x703e('0x10')]]['queuecallerabandonAt']=null;queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x1c')]=!![];queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x2a')]=utils[_0x703e('0x16')]();queues[_0xaf770b['uniqueid']][_0x703e('0xa')]='EXITWITHKEY';utils['info'](util[_0x703e('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xaf770b['uniqueid'],queues[_0xaf770b[_0x703e('0x10')]][_0x703e('0x1f')],_0xaf770b['value'],queues[_0xaf770b[_0x703e('0x10')]]['queuecallerexitreason']));}}}catch(_0x491703){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x23'),_0xaf770b[_0x703e('0x10')]),_0x491703);}};exports[_0x703e('0x1b')]=function(_0x37c244){try{if(!_[_0x703e('0x17')](queues[_0x37c244[_0x703e('0x10')]])){utils[_0x703e('0x18')](util[_0x703e('0x4')](_0x703e('0x2c'),_0x37c244[_0x703e('0x10')]),_0x37c244);queues[_0x37c244[_0x703e('0x10')]]['queuecallerexit']=![];queues[_0x37c244[_0x703e('0x10')]]['queuecallerexitAt']=null;queues[_0x37c244[_0x703e('0x10')]][_0x703e('0x1b')]=!![];queues[_0x37c244[_0x703e('0x10')]]['queuecallerabandonAt']=utils[_0x703e('0x16')]();queues[_0x37c244[_0x703e('0x10')]][_0x703e('0xa')]=_0x703e('0x2d');utils[_0x703e('0x3')](util['format'](_0x703e('0x2e'),_0x37c244[_0x703e('0x10')],queues[_0x37c244['uniqueid']][_0x703e('0x1f')],queues[_0x37c244[_0x703e('0x10')]]['queuecallerexitreason']));}}catch(_0x7dc710){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x2c'),_0x37c244['uniqueid']),_0x7dc710);}};exports['queuecallerleave']=function(_0x1aeeb0){try{if(!_[_0x703e('0x17')](queues[_0x1aeeb0[_0x703e('0x10')]])){utils[_0x703e('0x18')](util['format'](_0x703e('0x2f'),_0x1aeeb0[_0x703e('0x10')]),_0x1aeeb0);utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x30'),_0x1aeeb0[_0x703e('0x10')],queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x1f')],_0x1aeeb0[_0x703e('0x31')],_0x1aeeb0[_0x703e('0x32')]));queues[_0x1aeeb0['uniqueid']][_0x703e('0x33')]=!![];queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x1a')]=utils['now']();queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x34')]=utils[_0x703e('0x35')](queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x1a')],queues[_0x1aeeb0[_0x703e('0x10')]]['queuecallerjoinAt']);queues[_0x1aeeb0[_0x703e('0x10')]]['position']=_0x1aeeb0[_0x703e('0x15')];queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x36')]=_0x1aeeb0[_0x703e('0x36')];queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x31')]=_0x1aeeb0['connectedlinenum'];queues[_0x1aeeb0[_0x703e('0x10')]][_0x703e('0x32')]=_0x1aeeb0['connectedlinename'];}}catch(_0xd7bffc){utils['error'](util['format'](_0x703e('0x2f'),_0x1aeeb0['uniqueid']),_0xd7bffc);}};exports[_0x703e('0x37')]=function(_0x98ab74){try{if(!_[_0x703e('0x17')](queues[_0x98ab74[_0x703e('0x10')]])){utils['debug'](util[_0x703e('0x4')](_0x703e('0x38'),_0x98ab74[_0x703e('0x10')]),_0x98ab74);utils['info'](util[_0x703e('0x4')](_0x703e('0x39'),_0x98ab74['uniqueid'],queues[_0x98ab74['uniqueid']][_0x703e('0x1f')],_0x98ab74[_0x703e('0x3a')],_0x98ab74['destaccountcode']));queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x1b')]=![];queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x1b')]=![];queues[_0x98ab74['uniqueid']]['queuecallerabandonAt']=null;queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x1c')]=![];queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0xa')]=null;queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x2a')]=null;queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x3b')]=!![];queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x9')]=_0x98ab74[_0x703e('0x3c')];queues[_0x98ab74[_0x703e('0x10')]][_0x703e('0x7')]=_0x98ab74[_0x703e('0x3a')];}}catch(_0x4c40f3){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x38'),_0x98ab74[_0x703e('0x10')]),_0x4c40f3);}};exports[_0x703e('0x3d')]=function(_0x1a2b08){try{if(!_['isNil'](queues[_0x1a2b08['uniqueid']])){if(queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0x1a')]){utils['debug'](util[_0x703e('0x4')](_0x703e('0x3e'),_0x1a2b08[_0x703e('0x10')]),_0x1a2b08);queues[_0x1a2b08[_0x703e('0x10')]]['queuecallerabandon']=![];queues[_0x1a2b08['uniqueid']][_0x703e('0x1b')]=![];queues[_0x1a2b08[_0x703e('0x10')]]['queuecallerabandonAt']=null;queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0x1c')]=![];queues[_0x1a2b08['uniqueid']][_0x703e('0x2a')]=null;queues[_0x1a2b08[_0x703e('0x10')]]['assigned']=!![];queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0x7')]=_0x1a2b08[_0x703e('0x3a')];queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0x1d')]=!![];queues[_0x1a2b08['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x1a2b08[_0x703e('0x3f')]==_0x703e('0x40')){if(!queues[_0x1a2b08['uniqueid']][_0x703e('0x40')]){queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0xa')]=_0x703e('0x41');}}else{queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0xa')]=_0x703e('0x42')+_0x1a2b08['reason']['toUpperCase']();}utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x43'),_0x1a2b08['uniqueid'],queues[_0x1a2b08[_0x703e('0x10')]][_0x703e('0x1f')],_0x1a2b08['membername'],queues[_0x1a2b08[_0x703e('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x1a2b08[_0x703e('0x10')]]);}}}catch(_0x5f2a2e){utils[_0x703e('0x2b')](util['format'](_0x703e('0x3e'),_0x1a2b08[_0x703e('0x10')]),_0x5f2a2e);}};exports['blindtransfer']=function(_0x27afee){try{if(!_[_0x703e('0x17')](queues[_0x27afee[_0x703e('0x44')]])){utils[_0x703e('0x18')](util[_0x703e('0x4')](_0x703e('0x45'),_0x27afee['uniqueid']),_0x27afee);queues[_0x27afee[_0x703e('0x44')]][_0x703e('0x40')]=!![];queues[_0x27afee[_0x703e('0x44')]]['transfertype']=_0x703e('0x46');queues[_0x27afee[_0x703e('0x44')]][_0x703e('0x47')]=_0x27afee[_0x703e('0x48')];queues[_0x27afee['transfereeuniqueid']][_0x703e('0x49')]=_0x27afee['transfereeuniqueid'];queues[_0x27afee['transfereeuniqueid']][_0x703e('0xa')]=_0x703e('0x4a');utils[_0x703e('0x3')](util['format'](_0x703e('0x4b'),_0x27afee[_0x703e('0x10')],queues[_0x27afee['transfereeuniqueid']][_0x703e('0x1f')],_0x27afee['transfereeuniqueid'],_0x27afee[_0x703e('0x48')]));}}catch(_0x38f34c){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x45'),_0x27afee['uniqueid']),_0x38f34c);}};exports[_0x703e('0x4c')]=function(_0x4c9202){try{utils[_0x703e('0x18')](util['format'](_0x703e('0x4d'),_0x4c9202[_0x703e('0x4e')]),_0x4c9202);if(_0x4c9202[_0x703e('0x4e')]==_0x4c9202['origtransfererlinkedid']){if(!_[_0x703e('0x17')](queues[_0x4c9202['secondtransfererlinkedid']])){utils[_0x703e('0x3')](util[_0x703e('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x1f')],_0x4c9202[_0x703e('0x50')]));queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x40')]=!![];queues[_0x4c9202['secondtransfererlinkedid']][_0x703e('0x51')]=_0x703e('0x52');queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x47')]=_0x4c9202[_0x703e('0x50')];queues[_0x4c9202['secondtransfererlinkedid']][_0x703e('0x49')]=_0x4c9202[_0x703e('0x4e')];queues[_0x4c9202[_0x703e('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x703e('0x17')](queues[_0x4c9202[_0x703e('0x53')]])){if(_0x4c9202['transfereelinkedid']&&queues[_0x4c9202[_0x703e('0x54')]]){queues[_0x4c9202[_0x703e('0x54')]][_0x703e('0x21')]=0x1;queues[_0x4c9202[_0x703e('0x44')]]=_[_0x703e('0x55')](queues[_0x4c9202['transfereelinkedid']]);queues[_0x4c9202['transfereeuniqueid']][_0x703e('0xf')]=_0x4c9202['transfertargetuniqueid'];queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x21')]=0x2;queues[_0x4c9202[_0x703e('0x44')]]['calleridnum']=queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x8')];queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x56')]=queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x56')];queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x57')]=utils[_0x703e('0x16')]();queues[_0x4c9202['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x703e('0x16')]();queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x34')]=0x0;queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x58')]=0x0;utils['info'](util[_0x703e('0x4')](_0x703e('0x59'),_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202['transfereeuniqueid']]['name'],queues[_0x4c9202[_0x703e('0x44')]][_0x703e('0x8')],queues[_0x4c9202['transfereeuniqueid']][_0x703e('0x56')]));}else{utils[_0x703e('0x3')](util['format'](_0x703e('0x5a'),_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202[_0x703e('0x53')]]['name'],_0x4c9202[_0x703e('0x4f')]));queues[_0x4c9202[_0x703e('0x53')]]['transfereduniqueid']=_0x4c9202[_0x703e('0x4f')];}}}else if(_0x4c9202[_0x703e('0x5b')]==_0x4c9202[_0x703e('0x4f')]){if(!_[_0x703e('0x17')](queues[_0x4c9202[_0x703e('0x53')]])){utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x5c'),_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202[_0x703e('0x53')]][_0x703e('0x1f')],_0x4c9202[_0x703e('0x5b')],_0x4c9202[_0x703e('0x5d')]));queues[_0x4c9202[_0x703e('0x53')]][_0x703e('0x40')]=!![];queues[_0x4c9202['origtransfererlinkedid']][_0x703e('0x51')]=_0x703e('0x52');queues[_0x4c9202[_0x703e('0x53')]][_0x703e('0x47')]=_0x4c9202[_0x703e('0x5d')];queues[_0x4c9202['origtransfererlinkedid']][_0x703e('0x49')]=_0x4c9202[_0x703e('0x5b')];queues[_0x4c9202[_0x703e('0x53')]][_0x703e('0xa')]=_0x703e('0x5e');}if(!_['isNil'](queues[_0x4c9202[_0x703e('0x4f')]])){if(_0x4c9202[_0x703e('0x5f')]&&queues[_0x4c9202[_0x703e('0x5f')]]){queues[_0x4c9202[_0x703e('0x5f')]][_0x703e('0x21')]=0x1;queues[_0x4c9202['transfertargetuniqueid']]=_[_0x703e('0x55')](queues[_0x4c9202[_0x703e('0x5f')]]);queues[_0x4c9202[_0x703e('0x60')]]['transfereduniqueid']=_0x4c9202[_0x703e('0x60')];queues[_0x4c9202['transfertargetuniqueid']][_0x703e('0x21')]=0x2;queues[_0x4c9202['transfertargetuniqueid']][_0x703e('0x8')]=queues[_0x4c9202[_0x703e('0x53')]][_0x703e('0x8')];queues[_0x4c9202[_0x703e('0x60')]]['calleridname']=queues[_0x4c9202['origtransfererlinkedid']][_0x703e('0x56')];queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x57')]=utils[_0x703e('0x16')]();queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x1a')]=utils[_0x703e('0x16')]();queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x34')]=0x0;queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x58')]=0x0;utils['info'](util[_0x703e('0x4')](_0x703e('0x61'),_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x1f')],queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0xf')],queues[_0x4c9202[_0x703e('0x60')]][_0x703e('0x8')],queues[_0x4c9202[_0x703e('0x60')]]['calleridname']));}else{utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x5a'),_0x4c9202[_0x703e('0x4e')],queues[_0x4c9202[_0x703e('0x4f')]][_0x703e('0x1f')],_0x4c9202[_0x703e('0x53')]));queues[_0x4c9202[_0x703e('0x4f')]]['transfereduniqueid']=_0x4c9202['origtransfererlinkedid'];}}}}catch(_0x55da1e){utils[_0x703e('0x2b')](util[_0x703e('0x4')]('[%s][queues][attendedtransfer]',_0x4c9202[_0x703e('0x4e')]),_0x55da1e);}};exports['musiconholdstart']=function(_0x3d00e9){try{if(!_[_0x703e('0x17')](queues[_0x3d00e9[_0x703e('0x10')]])){utils[_0x703e('0x18')](util[_0x703e('0x4')](_0x703e('0x62'),_0x3d00e9['uniqueid']),_0x3d00e9);queues[_0x3d00e9[_0x703e('0x10')]]['musiconholdstartAt']=utils[_0x703e('0x16')]();utils['info'](util[_0x703e('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3d00e9[_0x703e('0x10')],queues[_0x3d00e9['uniqueid']][_0x703e('0x1f')],queues[_0x3d00e9[_0x703e('0x10')]][_0x703e('0x63')]));}}catch(_0x5ab2ad){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x62'),_0x3d00e9[_0x703e('0x10')]),_0x5ab2ad);}};exports['musiconholdstop']=function(_0x23cca0){try{if(!_['isNil'](queues[_0x23cca0[_0x703e('0x10')]])){if(!_[_0x703e('0x17')](queues[_0x23cca0[_0x703e('0x10')]][_0x703e('0x63')])){utils[_0x703e('0x18')](util[_0x703e('0x4')](_0x703e('0x64'),_0x23cca0['uniqueid']),_0x23cca0);queues[_0x23cca0[_0x703e('0x10')]]['mohtime']+=utils['diffTime'](utils[_0x703e('0x16')](),queues[_0x23cca0['uniqueid']][_0x703e('0x63')]);utils[_0x703e('0x3')](util[_0x703e('0x4')](_0x703e('0x65'),_0x23cca0[_0x703e('0x10')],queues[_0x23cca0[_0x703e('0x10')]][_0x703e('0x1f')],queues[_0x23cca0[_0x703e('0x10')]]['mohtime']));delete queues[_0x23cca0[_0x703e('0x10')]]['musiconholdstartAt'];}}}catch(_0x22f80e){utils[_0x703e('0x2b')](util[_0x703e('0x4')](_0x703e('0x64'),_0x23cca0[_0x703e('0x10')]),_0x22f80e);}}; \ No newline at end of file +var _0x76e7=['queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','queuecallerabandonAt','now','EXITWITHKEY','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','destaccountcode','lastAssignedTo','membername','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE'];(function(_0x1ba3b9,_0x5c7c8d){var _0xdfa965=function(_0x735e7c){while(--_0x735e7c){_0x1ba3b9['push'](_0x1ba3b9['shift']());}};_0xdfa965(++_0x5c7c8d);}(_0x76e7,0xa5));var _0x776e=function(_0xb58bc2,_0x3fff5f){_0xb58bc2=_0xb58bc2-0x0;var _0x3902d6=_0x76e7[_0xb58bc2];return _0x3902d6;};'use strict';var _=require(_0x776e('0x0'));var util=require('util');var utils=require(_0x776e('0x1'));var queues={};function writeDB(_0x5403cc){utils['info'](util[_0x776e('0x2')](_0x776e('0x3'),_0x5403cc['uniqueid'],_0x5403cc[_0x776e('0x4')],_0x5403cc['queue'],_0x5403cc['lastAssignedTo'],_0x5403cc[_0x776e('0x5')],_0x5403cc[_0x776e('0x6')],_0x5403cc['queuecallerexitreason']));if(_0x5403cc[_0x776e('0x7')]){utils[_0x776e('0x8')](_0x5403cc['queue'])[_0x776e('0x9')](function(_0x22e0ce){if(_0x22e0ce){_0x5403cc['type']=_0x22e0ce[_0x776e('0xa')];}utils['request']('CreateVoiceQueueReport',_0x5403cc);});}else{utils['request'](_0x776e('0xb'),_0x5403cc);}if(_0x5403cc['transfereduniqueid']){delete queues[_0x5403cc['transfereduniqueid']];}else{delete queues[_0x5403cc[_0x776e('0xc')]];}}exports[_0x776e('0xd')]=function(_0xdf2052){try{utils['debug'](util[_0x776e('0x2')](_0x776e('0xe'),_0xdf2052[_0x776e('0xc')]),_0xdf2052);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x10'),_0xdf2052[_0x776e('0xc')],_0xdf2052[_0x776e('0x7')],_0xdf2052[_0x776e('0x11')]));queues[_0xdf2052['uniqueid']]=_[_0x776e('0x12')](_0xdf2052,{'originalposition':_0xdf2052[_0x776e('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5a57f0){utils[_0x776e('0x13')](util['format'](_0x776e('0xe'),_0xdf2052['uniqueid']),_0x5a57f0);}};exports[_0x776e('0x14')]=function(_0x2eecc7){try{if(!_[_0x776e('0x15')](queues[_0x2eecc7[_0x776e('0xc')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')]('[%s][queues][hangup]',_0x2eecc7[_0x776e('0xc')]),_0x2eecc7);if(queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerleaveAt']){if(!queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerabandon']&&!queues[_0x2eecc7['uniqueid']][_0x776e('0x17')]){queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x18')]=!![];queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x19')]=utils['now']();queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1a')]=_0x776e('0x1b');}utils[_0x776e('0xf')](util['format'](_0x776e('0x1c'),_0x2eecc7['uniqueid'],queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1d')],queues[_0x2eecc7[_0x776e('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x2eecc7[_0x776e('0xc')]]);}else if(queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]){utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x1f'),_0x2eecc7['uniqueid'],queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1d')],queues[_0x2eecc7[_0x776e('0xc')]]['transfereduniqueid']));queues[queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]]=queues[_0x2eecc7[_0x776e('0xc')]];queues[queues[_0x2eecc7[_0x776e('0xc')]][_0x776e('0x1e')]][_0x776e('0x20')]=0x2;delete queues[_0x2eecc7[_0x776e('0xc')]];}}}catch(_0x2f69a1){utils[_0x776e('0x13')](util['format'](_0x776e('0x21'),_0x2eecc7[_0x776e('0xc')]),_0x2f69a1);}};exports[_0x776e('0x22')]=function(_0x497515){try{utils[_0x776e('0x16')](util['format'](_0x776e('0x23'),_0x497515[_0x776e('0xc')]),_0x497515);if(!_[_0x776e('0x15')](_0x497515[_0x776e('0x24')][_0x776e('0x25')])&&_0x497515[_0x776e('0x26')][_0x776e('0x27')]()!==_0x776e('0x28')){if(!_[_0x776e('0x15')](queues[_0x497515[_0x776e('0xc')]])){queues[_0x497515[_0x776e('0xc')]]['queuecallerabandon']=![];queues[_0x497515[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0x497515['uniqueid']]['queuecallerexit']=!![];queues[_0x497515[_0x776e('0xc')]][_0x776e('0x29')]=utils['now']();queues[_0x497515[_0x776e('0xc')]][_0x776e('0x1a')]=_0x497515[_0x776e('0x26')][_0x776e('0x27')]();utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x2a'),_0x497515[_0x776e('0xc')],queues[_0x497515['uniqueid']][_0x776e('0x1d')],_0x497515['value'],queues[_0x497515['uniqueid']][_0x776e('0x1a')]));writeDB(queues[_0x497515[_0x776e('0xc')]]);}}else if(!_[_0x776e('0x15')](_0x497515[_0x776e('0x24')]['queueposition'])){if(!_[_0x776e('0x15')](queues[_0x497515[_0x776e('0xc')]])&&!queues[_0x497515[_0x776e('0xc')]][_0x776e('0x2b')]){queues[_0x497515[_0x776e('0xc')]]['queuecallerabandon']=![];queues[_0x497515['uniqueid']][_0x776e('0x2c')]=null;queues[_0x497515['uniqueid']][_0x776e('0x17')]=!![];queues[_0x497515[_0x776e('0xc')]][_0x776e('0x29')]=utils[_0x776e('0x2d')]();queues[_0x497515['uniqueid']]['queuecallerexitreason']=_0x776e('0x2e');utils[_0x776e('0xf')](util[_0x776e('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x497515['uniqueid'],queues[_0x497515['uniqueid']][_0x776e('0x1d')],_0x497515[_0x776e('0x26')],queues[_0x497515['uniqueid']][_0x776e('0x1a')]));}}}catch(_0x359bf0){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x23'),_0x497515['uniqueid']),_0x359bf0);}};exports[_0x776e('0x2b')]=function(_0x18b16c){try{if(!_['isNil'](queues[_0x18b16c[_0x776e('0xc')]])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x18b16c[_0x776e('0xc')]),_0x18b16c);queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0x18b16c[_0x776e('0xc')]]['queuecallerexitAt']=null;queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x2b')]=!![];queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x2c')]=utils[_0x776e('0x2d')]();queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x1a')]='ABANDONED';utils['info'](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x18b16c['uniqueid'],queues[_0x18b16c['uniqueid']]['name'],queues[_0x18b16c[_0x776e('0xc')]][_0x776e('0x1a')]));}}catch(_0x93043){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x2f'),_0x18b16c[_0x776e('0xc')]),_0x93043);}};exports[_0x776e('0x30')]=function(_0xfc7e40){try{if(!_[_0x776e('0x15')](queues[_0xfc7e40[_0x776e('0xc')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x31'),_0xfc7e40['uniqueid']),_0xfc7e40);utils[_0x776e('0xf')](util[_0x776e('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xfc7e40[_0x776e('0xc')],queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x1d')],_0xfc7e40[_0x776e('0x32')],_0xfc7e40[_0x776e('0x33')]));queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x30')]=!![];queues[_0xfc7e40['uniqueid']][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x35')]=utils[_0x776e('0x36')](queues[_0xfc7e40['uniqueid']][_0x776e('0x34')],queues[_0xfc7e40[_0x776e('0xc')]]['queuecallerjoinAt']);queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x11')]=_0xfc7e40[_0x776e('0x11')];queues[_0xfc7e40[_0x776e('0xc')]]['count']=_0xfc7e40['count'];queues[_0xfc7e40[_0x776e('0xc')]]['connectedlinenum']=_0xfc7e40[_0x776e('0x32')];queues[_0xfc7e40[_0x776e('0xc')]][_0x776e('0x33')]=_0xfc7e40[_0x776e('0x33')];}}catch(_0x3abea7){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x31'),_0xfc7e40['uniqueid']),_0x3abea7);}};exports['agentconnect']=function(_0xb56f11){try{if(!_[_0x776e('0x15')](queues[_0xb56f11['uniqueid']])){utils['debug'](util[_0x776e('0x2')]('[%s][queues][agentconnect]',_0xb56f11[_0x776e('0xc')]),_0xb56f11);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x37'),_0xb56f11[_0x776e('0xc')],queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x1d')],_0xb56f11['membername'],_0xb56f11['destaccountcode']));queues[_0xb56f11['uniqueid']][_0x776e('0x2b')]=![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x2b')]=![];queues[_0xb56f11[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x1a')]=null;queues[_0xb56f11['uniqueid']][_0x776e('0x29')]=null;queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x38')]=!![];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x6')]=_0xb56f11[_0x776e('0x39')];queues[_0xb56f11[_0x776e('0xc')]][_0x776e('0x3a')]=_0xb56f11[_0x776e('0x3b')];}}catch(_0x40f1fe){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x3c'),_0xb56f11['uniqueid']),_0x40f1fe);}};exports['agentcomplete']=function(_0x2c6569){try{if(!_[_0x776e('0x15')](queues[_0x2c6569[_0x776e('0xc')]])){if(queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x34')]){utils['debug'](util['format'](_0x776e('0x3d'),_0x2c6569[_0x776e('0xc')]),_0x2c6569);queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x2b')]=![];queues[_0x2c6569['uniqueid']][_0x776e('0x2b')]=![];queues[_0x2c6569[_0x776e('0xc')]]['queuecallerabandonAt']=null;queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x17')]=![];queues[_0x2c6569['uniqueid']][_0x776e('0x29')]=null;queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x38')]=!![];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x3a')]=_0x2c6569[_0x776e('0x3b')];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x18')]=!![];queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x19')]=utils['now']();if(_0x2c6569[_0x776e('0x3e')]=='transfer'){if(!queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x3f')]){queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]='TRANSFER';}}else{queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]=_0x776e('0x40')+_0x2c6569[_0x776e('0x3e')][_0x776e('0x27')]();}utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x41'),_0x2c6569[_0x776e('0xc')],queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1d')],_0x2c6569[_0x776e('0x3b')],queues[_0x2c6569[_0x776e('0xc')]][_0x776e('0x1a')]));writeDB(queues[_0x2c6569[_0x776e('0xc')]]);}}}catch(_0x111e92){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x3d'),_0x2c6569[_0x776e('0xc')]),_0x111e92);}};exports[_0x776e('0x42')]=function(_0x4cac06){try{if(!_['isNil'](queues[_0x4cac06[_0x776e('0x43')]])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x44'),_0x4cac06[_0x776e('0xc')]),_0x4cac06);queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x3f')]=!![];queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x45')]=_0x776e('0x46');queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x47')]=_0x4cac06[_0x776e('0x48')];queues[_0x4cac06[_0x776e('0x43')]][_0x776e('0x49')]=_0x4cac06['transfereeuniqueid'];queues[_0x4cac06['transfereeuniqueid']][_0x776e('0x1a')]=_0x776e('0x4a');utils['info'](util['format'](_0x776e('0x4b'),_0x4cac06['uniqueid'],queues[_0x4cac06['transfereeuniqueid']][_0x776e('0x1d')],_0x4cac06[_0x776e('0x43')],_0x4cac06['extension']));}}catch(_0x3eb0be){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x4cac06[_0x776e('0xc')]),_0x3eb0be);}};exports[_0x776e('0x4c')]=function(_0x36f6a6){try{utils[_0x776e('0x16')](util[_0x776e('0x2')]('[%s][queues][attendedtransfer]',_0x36f6a6[_0x776e('0x4d')]),_0x36f6a6);if(_0x36f6a6[_0x776e('0x4d')]==_0x36f6a6[_0x776e('0x4e')]){if(!_['isNil'](queues[_0x36f6a6['secondtransfererlinkedid']])){utils['info'](util[_0x776e('0x2')](_0x776e('0x4f'),_0x36f6a6['origtransfereruniqueid'],queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x1d')],_0x36f6a6['origtransfererexten']));queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x3f')]=!![];queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x45')]='ATTENDED';queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x47')]=_0x36f6a6[_0x776e('0x51')];queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x49')]=_0x36f6a6[_0x776e('0x4d')];queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x1a')]=_0x776e('0x52');}if(!_['isNil'](queues[_0x36f6a6[_0x776e('0x4e')]])){if(_0x36f6a6[_0x776e('0x53')]&&queues[_0x36f6a6[_0x776e('0x53')]]){queues[_0x36f6a6[_0x776e('0x53')]]['queuecallerenterreason']=0x1;queues[_0x36f6a6[_0x776e('0x43')]]=_['clone'](queues[_0x36f6a6[_0x776e('0x53')]]);queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x54')];queues[_0x36f6a6['transfereeuniqueid']][_0x776e('0x20')]=0x2;queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x5')]=queues[_0x36f6a6[_0x776e('0x50')]][_0x776e('0x5')];queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x55')]=queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x55')];queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x56')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x35')]=0x0;queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x57')]=0x0;utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x58'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x43')]][_0x776e('0x1d')],queues[_0x36f6a6[_0x776e('0x43')]]['calleridnum'],queues[_0x36f6a6[_0x776e('0x43')]]['calleridname']));}else{utils[_0x776e('0xf')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x1d')],_0x36f6a6[_0x776e('0x50')]));queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x50')];}}}else if(_0x36f6a6[_0x776e('0x59')]==_0x36f6a6[_0x776e('0x50')]){if(!_['isNil'](queues[_0x36f6a6[_0x776e('0x4e')]])){utils[_0x776e('0xf')](util['format'](_0x776e('0x5a'),_0x36f6a6['origtransfereruniqueid'],queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x1d')],_0x36f6a6[_0x776e('0x59')],_0x36f6a6[_0x776e('0x5b')]));queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x3f')]=!![];queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x45')]='ATTENDED';queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x47')]=_0x36f6a6[_0x776e('0x5b')];queues[_0x36f6a6['origtransfererlinkedid']][_0x776e('0x49')]=_0x36f6a6[_0x776e('0x59')];queues[_0x36f6a6[_0x776e('0x4e')]]['queuecallerexitreason']=_0x776e('0x52');}if(!_['isNil'](queues[_0x36f6a6['secondtransfererlinkedid']])){if(_0x36f6a6['transfertargetlinkedid']&&queues[_0x36f6a6[_0x776e('0x5c')]]){queues[_0x36f6a6['transfertargetlinkedid']][_0x776e('0x20')]=0x1;queues[_0x36f6a6[_0x776e('0x54')]]=_[_0x776e('0x5d')](queues[_0x36f6a6['transfertargetlinkedid']]);queues[_0x36f6a6[_0x776e('0x54')]]['transfereduniqueid']=_0x36f6a6[_0x776e('0x54')];queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x20')]=0x2;queues[_0x36f6a6['transfertargetuniqueid']][_0x776e('0x5')]=queues[_0x36f6a6['origtransfererlinkedid']]['calleridnum'];queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x55')]=queues[_0x36f6a6[_0x776e('0x4e')]][_0x776e('0x55')];queues[_0x36f6a6['transfertargetuniqueid']][_0x776e('0x56')]=utils['now']();queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x34')]=utils[_0x776e('0x2d')]();queues[_0x36f6a6[_0x776e('0x54')]]['holdtime']=0x0;queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x57')]=0x0;utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x5e'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x1d')],queues[_0x36f6a6['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x36f6a6[_0x776e('0x54')]]['calleridnum'],queues[_0x36f6a6[_0x776e('0x54')]][_0x776e('0x55')]));}else{utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x5f'),_0x36f6a6[_0x776e('0x4d')],queues[_0x36f6a6[_0x776e('0x50')]]['name'],_0x36f6a6['origtransfererlinkedid']));queues[_0x36f6a6['secondtransfererlinkedid']][_0x776e('0x1e')]=_0x36f6a6[_0x776e('0x4e')];}}}}catch(_0x3c2b3f){utils['error'](util['format'](_0x776e('0x60'),_0x36f6a6[_0x776e('0x4d')]),_0x3c2b3f);}};exports['musiconholdstart']=function(_0x119a81){try{if(!_[_0x776e('0x15')](queues[_0x119a81['uniqueid']])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x61'),_0x119a81[_0x776e('0xc')]),_0x119a81);queues[_0x119a81['uniqueid']][_0x776e('0x62')]=utils[_0x776e('0x2d')]();utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x63'),_0x119a81[_0x776e('0xc')],queues[_0x119a81['uniqueid']][_0x776e('0x1d')],queues[_0x119a81[_0x776e('0xc')]][_0x776e('0x62')]));}}catch(_0x16f0d0){utils[_0x776e('0x13')](util[_0x776e('0x2')](_0x776e('0x61'),_0x119a81[_0x776e('0xc')]),_0x16f0d0);}};exports[_0x776e('0x64')]=function(_0x173cbf){try{if(!_[_0x776e('0x15')](queues[_0x173cbf[_0x776e('0xc')]])){if(!_[_0x776e('0x15')](queues[_0x173cbf[_0x776e('0xc')]]['musiconholdstartAt'])){utils[_0x776e('0x16')](util[_0x776e('0x2')](_0x776e('0x65'),_0x173cbf['uniqueid']),_0x173cbf);queues[_0x173cbf['uniqueid']][_0x776e('0x57')]+=utils[_0x776e('0x36')](utils[_0x776e('0x2d')](),queues[_0x173cbf[_0x776e('0xc')]]['musiconholdstartAt']);utils[_0x776e('0xf')](util[_0x776e('0x2')](_0x776e('0x66'),_0x173cbf['uniqueid'],queues[_0x173cbf[_0x776e('0xc')]]['name'],queues[_0x173cbf[_0x776e('0xc')]][_0x776e('0x57')]));delete queues[_0x173cbf['uniqueid']]['musiconholdstartAt'];}}}catch(_0x53e44e){utils['error'](util[_0x776e('0x2')](_0x776e('0x65'),_0x173cbf[_0x776e('0xc')]),_0x53e44e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 682c8cc..c8f205c 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 _0x4c5a=['util','info','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x4c5a,0x1b9));var _0xa4c5=function(_0x3f6614,_0xefe981){_0x3f6614=_0x3f6614-0x0;var _0x7dc330=_0x4c5a[_0x3f6614];return _0x7dc330;};'use strict';var _=require('lodash');var util=require(_0xa4c5('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x1b9fd8){utils[_0xa4c5('0x1')](util['format']('[%s][recordings][writeDB]',_0x1b9fd8[_0xa4c5('0x2')]));if(_0x1b9fd8[_0xa4c5('0x3')]){utils[_0xa4c5('0x4')](_0x1b9fd8[_0xa4c5('0x3')])[_0xa4c5('0x5')](function(_0x4d4360){if(_0x4d4360){_0x1b9fd8[_0xa4c5('0x6')]=_0x4d4360[_0xa4c5('0x7')];_0x1b9fd8[_0xa4c5('0x8')]=_0x4d4360['id'];}utils['request']('CreateVoiceRecording',_0x1b9fd8);});}else{utils[_0xa4c5('0x9')](_0xa4c5('0xa'),_0x1b9fd8);}}exports[_0xa4c5('0xb')]=function(_0x3aecf8){try{utils[_0xa4c5('0xc')](util['format']('[%s][recordings][newchannel]',_0x3aecf8[_0xa4c5('0x2')]),_0x3aecf8);if(_0x3aecf8[_0xa4c5('0x2')]==_0x3aecf8[_0xa4c5('0xd')]){utils[_0xa4c5('0x1')](util[_0xa4c5('0xe')](_0xa4c5('0xf'),_0x3aecf8[_0xa4c5('0x2')],_0x3aecf8[_0xa4c5('0x10')],_0x3aecf8[_0xa4c5('0x11')]));recordings[_0x3aecf8[_0xa4c5('0x2')]]={'uniqueid':_0x3aecf8[_0xa4c5('0x2')],'accountcode':_0x3aecf8[_0xa4c5('0x3')],'exten':_0x3aecf8['exten'],'context':_0x3aecf8[_0xa4c5('0x10')],'channel':_0x3aecf8[_0xa4c5('0x12')],'monitors':[]};}}catch(_0x4a7a5d){utils[_0xa4c5('0x13')](util[_0xa4c5('0xe')](_0xa4c5('0x14'),_0x3aecf8[_0xa4c5('0x2')]),_0x4a7a5d);}};exports[_0xa4c5('0x15')]=function(_0x3091d9){try{utils[_0xa4c5('0xc')](util[_0xa4c5('0xe')](_0xa4c5('0x16'),_0x3091d9[_0xa4c5('0x2')]),_0x3091d9);if(!_[_0xa4c5('0x17')](recordings[_0x3091d9[_0xa4c5('0x2')]])&&_0x3091d9[_0xa4c5('0x18')]==0x6){utils[_0xa4c5('0x1')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3091d9[_0xa4c5('0x2')],_0x3091d9[_0xa4c5('0x10')],_0x3091d9[_0xa4c5('0x12')]));}else if(!_['isNil'](recordings[_0x3091d9[_0xa4c5('0xd')]])&&_0x3091d9[_0xa4c5('0x18')]==0x6&&_0x3091d9[_0xa4c5('0x10')]!=_0xa4c5('0x19')){utils[_0xa4c5('0x1')](util['format'](_0xa4c5('0x1a'),_0x3091d9[_0xa4c5('0x2')],_0x3091d9[_0xa4c5('0xd')],_0x3091d9['context'],_0x3091d9[_0xa4c5('0x12')]));recordings[_0x3091d9[_0xa4c5('0xd')]]['accountcode']=_0x3091d9[_0xa4c5('0x3')];}}catch(_0x58b1f2){utils[_0xa4c5('0x13')](util['format'](_0xa4c5('0x16'),_0x3091d9['uniqueid']),_0x58b1f2);}};exports[_0xa4c5('0x1b')]=function(_0x46f132){try{if(!_['isNil'](_0x46f132['variable'])&&!_[_0xa4c5('0x17')](_0x46f132[_0xa4c5('0x1c')][_0xa4c5('0x1d')])){utils[_0xa4c5('0xc')](util[_0xa4c5('0xe')](_0xa4c5('0x1e'),_0x46f132[_0xa4c5('0x2')]),_0x46f132);utils[_0xa4c5('0x1')](util[_0xa4c5('0xe')](_0xa4c5('0x1f'),_0x46f132[_0xa4c5('0x2')],_0x46f132[_0xa4c5('0x1c')],_0x46f132[_0xa4c5('0x20')]));if(_[_0xa4c5('0x21')](_0x46f132[_0xa4c5('0x20')],'.wav49')){_0x46f132[_0xa4c5('0x20')]=_0x46f132[_0xa4c5('0x20')]['replace'](_0xa4c5('0x22'),_0xa4c5('0x23'));}if(recordings[_0x46f132[_0xa4c5('0xd')]]){var _0x33f201=_[_0xa4c5('0x24')](recordings[_0x46f132[_0xa4c5('0xd')]]['monitors'],{'value':_0x46f132[_0xa4c5('0x20')]});if(_[_0xa4c5('0x17')](_0x33f201)){recordings[_0x46f132['linkedid']][_0xa4c5('0x25')]['push']({'value':_0x46f132[_0xa4c5('0x20')]});}}}}catch(_0x286933){utils[_0xa4c5('0x13')](util[_0xa4c5('0xe')](_0xa4c5('0x1e'),_0x46f132[_0xa4c5('0x2')]),_0x286933);}};exports[_0xa4c5('0x26')]=function(_0x5472a3){try{if(!_[_0xa4c5('0x17')](recordings[_0x5472a3[_0xa4c5('0x2')]])){utils['debug'](util[_0xa4c5('0xe')]('[%s][recordings][hangup]',_0x5472a3[_0xa4c5('0x2')]),_0x5472a3);utils[_0xa4c5('0x1')](util[_0xa4c5('0xe')](_0xa4c5('0x27'),_0x5472a3[_0xa4c5('0x2')],_0x5472a3['calleridnum'],_0x5472a3[_0xa4c5('0x28')],_0x5472a3[_0xa4c5('0x29')]));recordings[_0x5472a3['uniqueid']]['calleridnum']=_0x5472a3[_0xa4c5('0x2a')];recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x28')]=_0x5472a3[_0xa4c5('0x28')];recordings[_0x5472a3[_0xa4c5('0x2')]]['connectedlinenum']=_0x5472a3[_0xa4c5('0x2b')];recordings[_0x5472a3[_0xa4c5('0x2')]]['connectedlinename']=_0x5472a3[_0xa4c5('0x2c')];if(recordings[_0x5472a3[_0xa4c5('0x2')]]['type']==_0xa4c5('0x2d')&&recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x3')]){recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x2b')]=recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x3')];recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x2c')]='';}recordings[_0x5472a3[_0xa4c5('0x2')]][_0xa4c5('0x25')][_0xa4c5('0x2e')](function(_0x58151a){var _0x4db129=_[_0xa4c5('0x2f')](recordings[_0x5472a3[_0xa4c5('0x2')]]);_0x4db129[_0xa4c5('0x20')]=_0x58151a[_0xa4c5('0x20')];writeDB(_0x4db129);});delete recordings[_0x5472a3['uniqueid']];}}catch(_0x28f776){utils[_0xa4c5('0x13')](util[_0xa4c5('0xe')]('[%s][recordings][hangup]',_0x5472a3[_0xa4c5('0x2')]),_0x28f776);}};exports[_0xa4c5('0x30')]=function(_0x4853b7){try{if(!_[_0xa4c5('0x17')](recordings[_0x4853b7[_0xa4c5('0x2')]])){utils[_0xa4c5('0xc')](util[_0xa4c5('0xe')](_0xa4c5('0x31'),_0x4853b7[_0xa4c5('0x2')]),_0x4853b7);utils[_0xa4c5('0x1')](util[_0xa4c5('0xe')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4853b7[_0xa4c5('0x2')],_0x4853b7[_0xa4c5('0x32')],_0x4853b7['appdata']));if(_0x4853b7['application'][_0xa4c5('0x33')]()==_0xa4c5('0x34')&&_[_0xa4c5('0x35')](_0x4853b7[_0xa4c5('0x36')][_0xa4c5('0x33')](),_0xa4c5('0x37'))){var _0x361209=_0x4853b7['appdata'][_0xa4c5('0x38')]('=');var _0x50ae8b=_0x361209[0x0][_0xa4c5('0x39')](_0x361209[0x0][_0xa4c5('0x3a')]('(')+0x1,_0x361209[0x0]['lastIndexOf'](')'));var _0x4fc768=_0x361209[0x1];recordings[_0x4853b7[_0xa4c5('0x2')]][_0x50ae8b]=_0x4fc768;}}}catch(_0x577332){utils['error'](util[_0xa4c5('0xe')](_0xa4c5('0x31'),_0x4853b7[_0xa4c5('0x2')]),_0x577332);}};exports[_0xa4c5('0x3b')]=function(_0xb401f5){try{if(!_[_0xa4c5('0x17')](recordings[_0xb401f5[_0xa4c5('0x2')]])){utils[_0xa4c5('0xc')](util['format'](_0xa4c5('0x3c'),_0xb401f5['uniqueid']),_0xb401f5);utils[_0xa4c5('0x1')](util[_0xa4c5('0xe')](_0xa4c5('0x3d'),_0xb401f5[_0xa4c5('0x2')],_0xb401f5['queue']));recordings[_0xb401f5['uniqueid']]['queue']=_0xb401f5[_0xa4c5('0x3e')];}}catch(_0x327718){utils['error'](util[_0xa4c5('0xe')](_0xa4c5('0x3c'),_0xb401f5[_0xa4c5('0x2')]),_0x327718);}}; \ No newline at end of file +var _0x3b46=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','exten','context','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','mixmonitor_filename'];(function(_0x2596c6,_0x3be92f){var _0x2e5b0c=function(_0x4159a7){while(--_0x4159a7){_0x2596c6['push'](_0x2596c6['shift']());}};_0x2e5b0c(++_0x3be92f);}(_0x3b46,0x118));var _0x63b4=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x3b46[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var utils=require(_0x63b4('0x2'));var recordings={};function writeDB(_0x435d72){utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x5'),_0x435d72[_0x63b4('0x6')]));if(_0x435d72['accountcode']){utils[_0x63b4('0x7')](_0x435d72[_0x63b4('0x8')])['then'](function(_0x5b08c6){if(_0x5b08c6){_0x435d72[_0x63b4('0x9')]=_0x5b08c6['name'];_0x435d72[_0x63b4('0xa')]=_0x5b08c6['id'];}utils[_0x63b4('0xb')](_0x63b4('0xc'),_0x435d72);});}else{utils[_0x63b4('0xb')](_0x63b4('0xc'),_0x435d72);}}exports['newchannel']=function(_0x2eed79){try{utils[_0x63b4('0xd')](util[_0x63b4('0x4')](_0x63b4('0xe'),_0x2eed79[_0x63b4('0x6')]),_0x2eed79);if(_0x2eed79[_0x63b4('0x6')]==_0x2eed79[_0x63b4('0xf')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2eed79[_0x63b4('0x6')],_0x2eed79['context'],_0x2eed79[_0x63b4('0x10')]));recordings[_0x2eed79[_0x63b4('0x6')]]={'uniqueid':_0x2eed79['uniqueid'],'accountcode':_0x2eed79[_0x63b4('0x8')],'exten':_0x2eed79['exten'],'context':_0x2eed79[_0x63b4('0x11')],'channel':_0x2eed79[_0x63b4('0x12')],'monitors':[]};}}catch(_0x4bb5db){utils['error'](util[_0x63b4('0x4')]('[%s][recordings][newchannel]',_0x2eed79['uniqueid']),_0x4bb5db);}};exports[_0x63b4('0x13')]=function(_0x27de14){try{utils[_0x63b4('0xd')](util['format']('[%s][recordings][newstate]',_0x27de14[_0x63b4('0x6')]),_0x27de14);if(!_[_0x63b4('0x14')](recordings[_0x27de14['uniqueid']])&&_0x27de14[_0x63b4('0x15')]==0x6){utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x16'),_0x27de14[_0x63b4('0x6')],_0x27de14[_0x63b4('0x11')],_0x27de14['channel']));}else if(!_[_0x63b4('0x14')](recordings[_0x27de14[_0x63b4('0xf')]])&&_0x27de14[_0x63b4('0x15')]==0x6&&_0x27de14[_0x63b4('0x11')]!=_0x63b4('0x17')){utils[_0x63b4('0x3')](util['format'](_0x63b4('0x18'),_0x27de14[_0x63b4('0x6')],_0x27de14[_0x63b4('0xf')],_0x27de14[_0x63b4('0x11')],_0x27de14[_0x63b4('0x12')]));recordings[_0x27de14[_0x63b4('0xf')]][_0x63b4('0x8')]=_0x27de14[_0x63b4('0x8')];}}catch(_0x3e798b){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x1a'),_0x27de14['uniqueid']),_0x3e798b);}};exports[_0x63b4('0x1b')]=function(_0x101502){try{if(!_[_0x63b4('0x14')](_0x101502[_0x63b4('0x1c')])&&!_[_0x63b4('0x14')](_0x101502[_0x63b4('0x1c')][_0x63b4('0x1d')])){utils[_0x63b4('0xd')](util['format'](_0x63b4('0x1e'),_0x101502[_0x63b4('0x6')]),_0x101502);utils[_0x63b4('0x3')](util['format'](_0x63b4('0x1f'),_0x101502[_0x63b4('0x6')],_0x101502[_0x63b4('0x1c')],_0x101502[_0x63b4('0x20')]));if(_[_0x63b4('0x21')](_0x101502[_0x63b4('0x20')],_0x63b4('0x22'))){_0x101502[_0x63b4('0x20')]=_0x101502[_0x63b4('0x20')][_0x63b4('0x23')]('.wav49',_0x63b4('0x24'));}if(recordings[_0x101502[_0x63b4('0xf')]]){var _0x148bf2=_[_0x63b4('0x25')](recordings[_0x101502['linkedid']][_0x63b4('0x26')],{'value':_0x101502[_0x63b4('0x20')]});if(_[_0x63b4('0x14')](_0x148bf2)){recordings[_0x101502[_0x63b4('0xf')]][_0x63b4('0x26')]['push']({'value':_0x101502[_0x63b4('0x20')]});}}}}catch(_0x166ba0){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x1e'),_0x101502[_0x63b4('0x6')]),_0x166ba0);}};exports['hangup']=function(_0x3ba531){try{if(!_[_0x63b4('0x14')](recordings[_0x3ba531[_0x63b4('0x6')]])){utils[_0x63b4('0xd')](util['format']('[%s][recordings][hangup]',_0x3ba531[_0x63b4('0x6')]),_0x3ba531);utils['info'](util['format'](_0x63b4('0x27'),_0x3ba531[_0x63b4('0x6')],_0x3ba531[_0x63b4('0x28')],_0x3ba531[_0x63b4('0x29')],_0x3ba531[_0x63b4('0x2a')]));recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x28')]=_0x3ba531['calleridnum'];recordings[_0x3ba531[_0x63b4('0x6')]]['calleridname']=_0x3ba531[_0x63b4('0x29')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2b')]=_0x3ba531[_0x63b4('0x2b')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2c')]=_0x3ba531[_0x63b4('0x2c')];if(recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2d')]==_0x63b4('0x2e')&&recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x8')]){recordings[_0x3ba531['uniqueid']]['connectedlinenum']=recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x8')];recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x2c')]='';}recordings[_0x3ba531[_0x63b4('0x6')]][_0x63b4('0x26')]['forEach'](function(_0x65c556){var _0x1355b7=_['clone'](recordings[_0x3ba531[_0x63b4('0x6')]]);_0x1355b7[_0x63b4('0x20')]=_0x65c556[_0x63b4('0x20')];writeDB(_0x1355b7);});delete recordings[_0x3ba531['uniqueid']];}}catch(_0x53438f){utils[_0x63b4('0x19')](util[_0x63b4('0x4')]('[%s][recordings][hangup]',_0x3ba531[_0x63b4('0x6')]),_0x53438f);}};exports['newexten']=function(_0x127b21){try{if(!_['isNil'](recordings[_0x127b21['uniqueid']])){utils['debug'](util[_0x63b4('0x4')](_0x63b4('0x2f'),_0x127b21[_0x63b4('0x6')]),_0x127b21);utils[_0x63b4('0x3')](util[_0x63b4('0x4')](_0x63b4('0x30'),_0x127b21[_0x63b4('0x6')],_0x127b21[_0x63b4('0x31')],_0x127b21[_0x63b4('0x32')]));if(_0x127b21[_0x63b4('0x31')][_0x63b4('0x33')]()==_0x63b4('0x34')&&_[_0x63b4('0x35')](_0x127b21[_0x63b4('0x32')][_0x63b4('0x33')](),_0x63b4('0x36'))){var _0x4cee78=_0x127b21[_0x63b4('0x32')][_0x63b4('0x37')]('=');var _0x361c5c=_0x4cee78[0x0][_0x63b4('0x38')](_0x4cee78[0x0][_0x63b4('0x39')]('(')+0x1,_0x4cee78[0x0][_0x63b4('0x39')](')'));var _0x54826b=_0x4cee78[0x1];recordings[_0x127b21['uniqueid']][_0x361c5c]=_0x54826b;}}}catch(_0x1eeec5){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x2f'),_0x127b21[_0x63b4('0x6')]),_0x1eeec5);}};exports[_0x63b4('0x3a')]=function(_0x1a0c4d){try{if(!_[_0x63b4('0x14')](recordings[_0x1a0c4d[_0x63b4('0x6')]])){utils[_0x63b4('0xd')](util[_0x63b4('0x4')](_0x63b4('0x3b'),_0x1a0c4d[_0x63b4('0x6')]),_0x1a0c4d);utils['info'](util[_0x63b4('0x4')](_0x63b4('0x3c'),_0x1a0c4d[_0x63b4('0x6')],_0x1a0c4d[_0x63b4('0x3d')]));recordings[_0x1a0c4d['uniqueid']][_0x63b4('0x3d')]=_0x1a0c4d[_0x63b4('0x3d')];}}catch(_0xe3751d){utils[_0x63b4('0x19')](util[_0x63b4('0x4')](_0x63b4('0x3b'),_0x1a0c4d[_0x63b4('0x6')]),_0xe3751d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fa17359..517522b 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 _0x90aa=['info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','lodash','util'];(function(_0xfd19fd,_0x159a76){var _0x38e5e5=function(_0x50b068){while(--_0x50b068){_0xfd19fd['push'](_0xfd19fd['shift']());}};_0x38e5e5(++_0x159a76);}(_0x90aa,0x152));var _0xa90a=function(_0x1deddd,_0x489b57){_0x1deddd=_0x1deddd-0x0;var _0x2146f8=_0x90aa[_0x1deddd];return _0x2146f8;};'use strict';var _=require(_0xa90a('0x0'));var util=require(_0xa90a('0x1'));var utils=require('./utils');function writeDB(_0x8d3d40){utils[_0xa90a('0x2')](util['format'](_0xa90a('0x3'),_0x8d3d40[_0xa90a('0x4')]===_0xa90a('0x5')?_0x8d3d40[_0xa90a('0x6')]:_0x8d3d40[_0xa90a('0x7')],_0x8d3d40[_0xa90a('0x4')]));utils['request'](_0xa90a('0x8'),_0x8d3d40);}exports[_0xa90a('0x9')]=function(_0x3d5e3d){try{utils[_0xa90a('0xa')](util[_0xa90a('0xb')]('[%s][transfers][blindtransfer]',_0x3d5e3d[_0xa90a('0x7')]),_0x3d5e3d);utils[_0xa90a('0x2')](util[_0xa90a('0xb')](_0xa90a('0xc'),_0x3d5e3d[_0xa90a('0x7')],_0x3d5e3d[_0xa90a('0xd')],_0x3d5e3d[_0xa90a('0xe')],_0x3d5e3d[_0xa90a('0xf')],_0x3d5e3d['transfereecalleridname']));_0x3d5e3d[_0xa90a('0x4')]=_0xa90a('0x10');writeDB(_0x3d5e3d);}catch(_0x1f7701){utils[_0xa90a('0x11')](util[_0xa90a('0xb')](_0xa90a('0x12'),_0x3d5e3d[_0xa90a('0x7')]),_0x1f7701);}};exports[_0xa90a('0x13')]=function(_0x142bae){try{utils['debug'](util[_0xa90a('0xb')](_0xa90a('0x14'),_0x142bae[_0xa90a('0x6')]),_0x142bae);utils['info'](util[_0xa90a('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x142bae[_0xa90a('0x6')],_0x142bae[_0xa90a('0x15')],_0x142bae[_0xa90a('0x16')],_0x142bae[_0xa90a('0x17')],_0x142bae[_0xa90a('0x18')]));_0x142bae=_[_0xa90a('0x19')](_0x142bae,{'transfererchannel':_0x142bae['origtransfererchannel'],'transferercalleridnum':_0x142bae[_0xa90a('0x15')],'transferercalleridname':_0x142bae[_0xa90a('0x16')],'transfererconnectedlinenum':_0x142bae[_0xa90a('0x1a')],'transfererconnectedlinename':_0x142bae['secondtransfererconnectedlinename'],'transfereraccountcode':_0x142bae['origtransfereraccountcode'],'transferercontext':_0x142bae['secondtransferercontext'],'transfererexten':_0x142bae[_0xa90a('0x1b')],'transfererlinkedid':_0x142bae['origtransfererlinkedid'],'context':_0x142bae[_0xa90a('0x1c')],'extension':_0x142bae[_0xa90a('0x1d')],'type':_0xa90a('0x5')});if(_[_0xa90a('0x1e')](_0x142bae['transfereechannel'])){_0x142bae=_[_0xa90a('0x19')](_0x142bae,{'transfereechannel':_0x142bae['transfertargetchannel'],'transfereecalleridnum':_0x142bae['transfertargetcalleridnum'],'transfereecalleridname':_0x142bae[_0xa90a('0x18')],'transfereeconnectedlinenum':_0x142bae[_0xa90a('0x1f')],'transfereeconnectedlinename':_0x142bae['transfertargetconnectedlinename'],'transfereeaccountcode':_0x142bae[_0xa90a('0x20')],'transfereecontext':_0x142bae['transfertargetcontext'],'transfereeexten':_0x142bae[_0xa90a('0x21')],'transfereelinkedid':_0x142bae['transfertargetlinkedid']});}writeDB(_0x142bae);}catch(_0x53c8ce){utils[_0xa90a('0x11')](util[_0xa90a('0xb')](_0xa90a('0x14'),_0x142bae['origtransfereruniqueid']),_0x53c8ce);}}; \ No newline at end of file +var _0xe99a=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xe99a,0x1d7));var _0xae99=function(_0x55a838,_0x36f0e3){_0x55a838=_0x55a838-0x0;var _0x246ad2=_0xe99a[_0x55a838];return _0x246ad2;};'use strict';var _=require(_0xae99('0x0'));var util=require(_0xae99('0x1'));var utils=require(_0xae99('0x2'));function writeDB(_0x881a04){utils[_0xae99('0x3')](util[_0xae99('0x4')](_0xae99('0x5'),_0x881a04[_0xae99('0x6')]===_0xae99('0x7')?_0x881a04[_0xae99('0x8')]:_0x881a04[_0xae99('0x9')],_0x881a04[_0xae99('0x6')]));utils[_0xae99('0xa')](_0xae99('0xb'),_0x881a04);}exports[_0xae99('0xc')]=function(_0x361d2d){try{utils['debug'](util['format'](_0xae99('0xd'),_0x361d2d['uniqueid']),_0x361d2d);utils['info'](util[_0xae99('0x4')](_0xae99('0xe'),_0x361d2d[_0xae99('0x9')],_0x361d2d[_0xae99('0xf')],_0x361d2d[_0xae99('0x10')],_0x361d2d[_0xae99('0x11')],_0x361d2d[_0xae99('0x12')]));_0x361d2d['type']=_0xae99('0x13');writeDB(_0x361d2d);}catch(_0x349bd3){utils['error'](util[_0xae99('0x4')](_0xae99('0xd'),_0x361d2d['uniqueid']),_0x349bd3);}};exports[_0xae99('0x14')]=function(_0x484834){try{utils['debug'](util[_0xae99('0x4')](_0xae99('0x15'),_0x484834['origtransfereruniqueid']),_0x484834);utils['info'](util[_0xae99('0x4')](_0xae99('0x16'),_0x484834['origtransfereruniqueid'],_0x484834['origtransferercalleridnum'],_0x484834[_0xae99('0x17')],_0x484834[_0xae99('0x18')],_0x484834[_0xae99('0x19')]));_0x484834=_[_0xae99('0x1a')](_0x484834,{'transfererchannel':_0x484834[_0xae99('0x1b')],'transferercalleridnum':_0x484834['origtransferercalleridnum'],'transferercalleridname':_0x484834['origtransferercalleridname'],'transfererconnectedlinenum':_0x484834['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x484834[_0xae99('0x1c')],'transfereraccountcode':_0x484834['origtransfereraccountcode'],'transferercontext':_0x484834[_0xae99('0x1d')],'transfererexten':_0x484834[_0xae99('0x1e')],'transfererlinkedid':_0x484834[_0xae99('0x1f')],'context':_0x484834['origtransferercontext'],'extension':_0x484834[_0xae99('0x20')],'type':_0xae99('0x7')});if(_[_0xae99('0x21')](_0x484834['transfereechannel'])){_0x484834=_[_0xae99('0x1a')](_0x484834,{'transfereechannel':_0x484834[_0xae99('0x22')],'transfereecalleridnum':_0x484834[_0xae99('0x18')],'transfereecalleridname':_0x484834[_0xae99('0x19')],'transfereeconnectedlinenum':_0x484834[_0xae99('0x23')],'transfereeconnectedlinename':_0x484834[_0xae99('0x24')],'transfereeaccountcode':_0x484834[_0xae99('0x25')],'transfereecontext':_0x484834[_0xae99('0x26')],'transfereeexten':_0x484834[_0xae99('0x27')],'transfereelinkedid':_0x484834['transfertargetlinkedid']});}writeDB(_0x484834);}catch(_0x11d846){utils[_0xae99('0x28')](util[_0xae99('0x4')](_0xae99('0x15'),_0x484834[_0xae99('0x8')]),_0x11d846);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 56f5e9f..ba344f1 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 _0x4137=['now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s','GetUser','internal','interface','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','add','format','subtractTime','seconds','YYYY-MM-DD\x20HH:mm:ss','sumTime'];(function(_0x42e761,_0xe62d7e){var _0x558615=function(_0x5429ed){while(--_0x5429ed){_0x42e761['push'](_0x42e761['shift']());}};_0x558615(++_0xe62d7e);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0x7413('0x0'));var jayson=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var util=require(_0x7413('0x3'));var client=jayson[_0x7413('0x4')][_0x7413('0x5')]({'port':0x2329});var logger=require(_0x7413('0x6'))(_0x7413('0x7'));exports[_0x7413('0x8')]=function(_0x3dc48a,_0x451a96){logger[_0x7413('0x8')](_0x3dc48a,_0x451a96?util['inspect'](_0x451a96,{'showHidden':![],'depth':null}):'');};exports[_0x7413('0x9')]=function(_0x188d89,_0x5b39ac){logger[_0x7413('0x9')](_0x188d89,_0x5b39ac?util['inspect'](_0x5b39ac,{'showHidden':![],'depth':null}):'');};exports[_0x7413('0xa')]=function(_0x120dc2,_0x4e320b){logger[_0x7413('0xa')](_0x120dc2,_0x4e320b?util[_0x7413('0xb')](_0x4e320b,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x29f124,_0x427b3b){return client[_0x7413('0xc')](_0x29f124,{'body':_0x427b3b})[_0x7413('0xd')](function(_0x14212d){logger['debug'](_0x7413('0xe'),_0x29f124,_0x14212d?util[_0x7413('0xb')](_0x14212d,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x18a874){logger[_0x7413('0xa')](_0x7413('0xe'),_0x29f124,_0x18a874?util['inspect'](_0x18a874,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5956b0){return client['request'](_0x7413('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7413('0x10'),'name',_0x7413('0x11')],'where':_0x5956b0,'limit':0x1}})[_0x7413('0xd')](function(_0x4955d3){logger[_0x7413('0x9')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x5956b0),_0x4955d3?util[_0x7413('0xb')](_0x4955d3,{'showHidden':![],'depth':null}):'');return _0x4955d3['result'][_0x7413('0x12')]?_0x4955d3['result'][0x0]:null;});}exports[_0x7413('0x13')]=function(_0x3230d8){return new BPromise(function(_0x19157f,_0x12a01e){if(_0x3230d8){return getUser({'internal':_0x3230d8})[_0x7413('0xd')](function(_0x26dafe){logger['info'](_0x7413('0x14'),_0x3230d8,_0x26dafe?_0x7413('0x15'):_0x7413('0x16'));return _0x19157f(_0x26dafe);})[_0x7413('0x17')](function(_0x5bee15){logger[_0x7413('0xa')](_0x7413('0x18'),_0x5bee15?util[_0x7413('0xb')](_0x5bee15,{'showHidden':![],'depth':null}):'');return _0x19157f(null);});}return _0x19157f(null);});};exports[_0x7413('0x19')]=function(_0x409392){return new BPromise(function(_0x2d220f,_0x4886e3){if(_0x409392){return getUser({'interface':_0x409392})[_0x7413('0xd')](function(_0x56a06a){logger['info'](_0x7413('0x1a'),_0x409392,_0x56a06a?'found':_0x7413('0x16'));return _0x2d220f(_0x56a06a);})[_0x7413('0x17')](function(_0x3b0c81){logger[_0x7413('0xa')](_0x7413('0x1b'),_0x3b0c81?util[_0x7413('0xb')](_0x3b0c81,{'showHidden':![],'depth':null}):'');return _0x2d220f(null);});}return _0x2d220f(null);});};exports[_0x7413('0x1c')]=function(_0x41cb5d){return new BPromise(function(_0x1d455b,_0x5a8329){if(_0x41cb5d){return getUser({'name':_0x41cb5d})['then'](function(_0x11b210){logger['info'](_0x7413('0x1d'),_0x41cb5d,_0x11b210?_0x7413('0x15'):_0x7413('0x16'));return _0x1d455b(_0x11b210);})['catch'](function(_0x35e0fd){logger[_0x7413('0xa')](_0x7413('0x1e'),_0x35e0fd?util[_0x7413('0xb')](_0x35e0fd,{'showHidden':![],'depth':null}):'');return _0x1d455b(null);});}return _0x1d455b(null);});};exports[_0x7413('0x1f')]=function(_0x2e521f){return new BPromise(function(_0x5eb4d9,_0x24dce7){if(_0x2e521f){return client['request'](_0x7413('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7413('0x21'),_0x7413('0x22'),_0x7413('0x23'),_0x7413('0x24')],'where':{'name':_0x2e521f},'limit':0x1}})[_0x7413('0xd')](function(_0x5bb3ea){logger[_0x7413('0x9')](_0x7413('0x25'),_0x2e521f,_0x5bb3ea?util[_0x7413('0xb')](_0x5bb3ea,{'showHidden':![],'depth':null}):'');logger[_0x7413('0x8')](_0x7413('0x26'),_0x2e521f,_0x5bb3ea?_0x7413('0x15'):_0x7413('0x16'));return _0x5eb4d9(_0x5bb3ea['result'][_0x7413('0x12')]?_0x5bb3ea[_0x7413('0x27')][0x0]:null);})[_0x7413('0x17')](function(_0xd373d5){logger[_0x7413('0xa')]('[utils][getVoiceQueueByName]',_0xd373d5?util[_0x7413('0xb')](_0xd373d5,{'showHidden':![],'depth':null}):'');return _0x5eb4d9(null);});}return _0x5eb4d9(null);});};exports['addTime']=function(_0x3cc6c8,_0x126d66){return moment(_0x3cc6c8)[_0x7413('0x28')](_0x126d66,'seconds')[_0x7413('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7413('0x2a')]=function(_0x31c174,_0x591666){return moment(_0x31c174)['subtract'](_0x591666,_0x7413('0x2b'))[_0x7413('0x29')](_0x7413('0x2c'));};exports['diffTime']=function(_0x4dd1ce,_0x409f06){return moment(_0x4dd1ce)['diff'](moment(_0x409f06),'seconds');};exports[_0x7413('0x2d')]=function(_0x575a79,_0x3ad12d){return parseInt(_0x575a79,0xa)+parseInt(_0x3ad12d,0xa);};exports[_0x7413('0x2e')]=function(){return moment()[_0x7413('0x29')](_0x7413('0x2c'));};exports[_0x7413('0x2f')]=function(_0x5142a1,_0xa58bd2){if(_0xa58bd2){return moment(_0x5142a1)[_0x7413('0x2f')](_0xa58bd2);}return!![];};exports[_0x7413('0x30')]=function(_0xfa34ef,_0x245777){if(_0x245777){return moment(_0xfa34ef)[_0x7413('0x30')](_0x245777);}else if(_0xfa34ef){return!![];}return![];}; \ No newline at end of file +var _0xc991=['result','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','stringify','length'];(function(_0x104ac0,_0x43e235){var _0x1b9f18=function(_0x2ac92f){while(--_0x2ac92f){_0x104ac0['push'](_0x104ac0['shift']());}};_0x1b9f18(++_0x43e235);}(_0xc991,0xfc));var _0x1c99=function(_0x183381,_0x541447){_0x183381=_0x183381-0x0;var _0x2d3b77=_0xc991[_0x183381];return _0x2d3b77;};'use strict';var BPromise=require(_0x1c99('0x0'));var jayson=require(_0x1c99('0x1'));var moment=require('moment');var util=require(_0x1c99('0x2'));var client=jayson['client'][_0x1c99('0x3')]({'port':0x2329});var logger=require(_0x1c99('0x4'))('xdr');exports['info']=function(_0x3eae7f,_0x2e581b){logger[_0x1c99('0x5')](_0x3eae7f,_0x2e581b?util['inspect'](_0x2e581b,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x6')]=function(_0x561f40,_0x2d714e){logger[_0x1c99('0x6')](_0x561f40,_0x2d714e?util[_0x1c99('0x7')](_0x2d714e,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x8')]=function(_0x28645d,_0x566bde){logger[_0x1c99('0x8')](_0x28645d,_0x566bde?util[_0x1c99('0x7')](_0x566bde,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x47fbb5,_0x462afc){return client[_0x1c99('0x9')](_0x47fbb5,{'body':_0x462afc})['then'](function(_0x560ccd){logger[_0x1c99('0x6')](_0x1c99('0xa'),_0x47fbb5,_0x560ccd?util[_0x1c99('0x7')](_0x560ccd,{'showHidden':![],'depth':null}):'');})[_0x1c99('0xb')](function(_0xcb2ced){logger[_0x1c99('0x8')](_0x1c99('0xa'),_0x47fbb5,_0xcb2ced?util[_0x1c99('0x7')](_0xcb2ced,{'showHidden':![],'depth':null}):'');});};function getUser(_0x24f4cd){return client[_0x1c99('0x9')](_0x1c99('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x1c99('0xd'),'interface'],'where':_0x24f4cd,'limit':0x1}})[_0x1c99('0xe')](function(_0x13d2f3){logger['debug'](_0x1c99('0xf'),JSON[_0x1c99('0x10')](_0x24f4cd),_0x13d2f3?util[_0x1c99('0x7')](_0x13d2f3,{'showHidden':![],'depth':null}):'');return _0x13d2f3['result'][_0x1c99('0x11')]?_0x13d2f3[_0x1c99('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x23aef0){return new BPromise(function(_0x1ff07f,_0x505e6d){if(_0x23aef0){return getUser({'internal':_0x23aef0})[_0x1c99('0xe')](function(_0x39a8a6){logger[_0x1c99('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x23aef0,_0x39a8a6?'found':_0x1c99('0x13'));return _0x1ff07f(_0x39a8a6);})['catch'](function(_0x2974e2){logger['error'](_0x1c99('0x14'),_0x2974e2?util[_0x1c99('0x7')](_0x2974e2,{'showHidden':![],'depth':null}):'');return _0x1ff07f(null);});}return _0x1ff07f(null);});};exports[_0x1c99('0x15')]=function(_0x3d6a61){return new BPromise(function(_0x4b420d,_0x516d9d){if(_0x3d6a61){return getUser({'interface':_0x3d6a61})['then'](function(_0x440ec5){logger[_0x1c99('0x5')](_0x1c99('0x16'),_0x3d6a61,_0x440ec5?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b420d(_0x440ec5);})[_0x1c99('0xb')](function(_0x2504a9){logger[_0x1c99('0x8')]('[utils][getUserByInterface]',_0x2504a9?util[_0x1c99('0x7')](_0x2504a9,{'showHidden':![],'depth':null}):'');return _0x4b420d(null);});}return _0x4b420d(null);});};exports[_0x1c99('0x18')]=function(_0x364e95){return new BPromise(function(_0x4764b5,_0x52bd5d){if(_0x364e95){return getUser({'name':_0x364e95})[_0x1c99('0xe')](function(_0x513c23){logger[_0x1c99('0x5')](_0x1c99('0x19'),_0x364e95,_0x513c23?'found':_0x1c99('0x13'));return _0x4764b5(_0x513c23);})['catch'](function(_0x1d6c5e){logger['error']('[utils][getUserByName]',_0x1d6c5e?util[_0x1c99('0x7')](_0x1d6c5e,{'showHidden':![],'depth':null}):'');return _0x4764b5(null);});}return _0x4764b5(null);});};exports['getVoiceQueueByName']=function(_0x349bcc){return new BPromise(function(_0x4b1095,_0x24e61e){if(_0x349bcc){return client[_0x1c99('0x9')](_0x1c99('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x1c99('0xd'),_0x1c99('0x1b'),_0x1c99('0x1c'),_0x1c99('0x1d')],'where':{'name':_0x349bcc},'limit':0x1}})[_0x1c99('0xe')](function(_0x2b93e4){logger['debug'](_0x1c99('0x1e'),_0x349bcc,_0x2b93e4?util['inspect'](_0x2b93e4,{'showHidden':![],'depth':null}):'');logger[_0x1c99('0x5')](_0x1c99('0x1f'),_0x349bcc,_0x2b93e4?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b1095(_0x2b93e4[_0x1c99('0x12')]['length']?_0x2b93e4[_0x1c99('0x12')][0x0]:null);})[_0x1c99('0xb')](function(_0xc80968){logger[_0x1c99('0x8')](_0x1c99('0x20'),_0xc80968?util['inspect'](_0xc80968,{'showHidden':![],'depth':null}):'');return _0x4b1095(null);});}return _0x4b1095(null);});};exports[_0x1c99('0x21')]=function(_0xd8e696,_0x24a431){return moment(_0xd8e696)[_0x1c99('0x22')](_0x24a431,'seconds')['format'](_0x1c99('0x23'));};exports[_0x1c99('0x24')]=function(_0x3ab34b,_0x2416a8){return moment(_0x3ab34b)[_0x1c99('0x25')](_0x2416a8,_0x1c99('0x26'))[_0x1c99('0x27')](_0x1c99('0x23'));};exports[_0x1c99('0x28')]=function(_0x5a9dba,_0x39fda0){return moment(_0x5a9dba)[_0x1c99('0x29')](moment(_0x39fda0),_0x1c99('0x26'));};exports[_0x1c99('0x2a')]=function(_0x36c432,_0x14a852){return parseInt(_0x36c432,0xa)+parseInt(_0x14a852,0xa);};exports['now']=function(){return moment()[_0x1c99('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1c99('0x2b')]=function(_0xd3dbab,_0x3aa42b){if(_0x3aa42b){return moment(_0xd3dbab)['isAfter'](_0x3aa42b);}return!![];};exports['isBefore']=function(_0x409f96,_0x2409da){if(_0x2409da){return moment(_0x409f96)[_0x1c99('0x2c')](_0x2409da);}else if(_0x409f96){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 44c4731..6d745a2 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 _0x6c07=['user','no-user','data','error','api','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','url','statusCode','responseTime','role','inspect','device','other','agent_id','agent_name','test','setupLoggers','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','join','log','xcally','client','name','then','catch'];(function(_0x55e821,_0x5ce16e){var _0xed5bfd=function(_0x42dfe4){while(--_0x42dfe4){_0x55e821['push'](_0x55e821['shift']());}};_0xed5bfd(++_0x5ce16e);}(_0x6c07,0xed));var _0x76c0=function(_0x10c2f6,_0x2ed59e){_0x10c2f6=_0x10c2f6-0x0;var _0xd0b1f3=_0x6c07[_0x10c2f6];return _0xd0b1f3;};var fs=require('fs-extra');var _=require(_0x76c0('0x0'));var ewinston=require(_0x76c0('0x1'));var path=require(_0x76c0('0x2'));var util=require(_0x76c0('0x3'));var fileLogger=require(_0x76c0('0x4'))[_0x76c0('0x5')];var safeTemplate=require(_0x76c0('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x76c0('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x5910ff(_0x5a8ee9){var _0x1b21e7=path[_0x76c0('0x8')]('/var',_0x76c0('0x9'),_0x76c0('0xa'));var _0xf52598=path[_0x76c0('0x8')](_0x76c0('0xb'),_0x5a8ee9['role']+'-'+_0x5a8ee9[_0x76c0('0xc')]);return fs['ensureDir'](path['join'](_0x1b21e7,_0xf52598))[_0x76c0('0xd')](function(){var _0x5c33f7=fileLogger(_0x76c0('0xb'),path['join'](_0x1b21e7,_0xf52598));return _0x5c33f7;})[_0x76c0('0xe')](function(_0x6e5e52){throw _0x6e5e52;});}this[_0x76c0('0x9')]=function(_0x54c4a4,_0x398555,_0x94a8de,_0x1866d8){return _0x5910ff(_0x54c4a4[_0x76c0('0xf')])[_0x76c0('0xd')](function(_0x21c734){var _0x5d2835=_0x21c734[_0x398555];return _0x5d2835;})[_0x76c0('0xd')](function(_0x462f11){var _0x3490e5=_0x54c4a4[_0x76c0('0xf')]?_0x54c4a4[_0x76c0('0xf')]['id']:_0x76c0('0x10');var _0x1ac867=_0x1866d8[_0x76c0('0x11')];var _0x1bd999=_0x1866d8['timestamp'];var _0x55b9d4=new Date(Number(_0x1bd999));return _0x462f11(_0x3490e5,_0x55b9d4,_0x94a8de,_0x1ac867);})[_0x76c0('0xe')](function(_0x3399ad){fileLogger(_0x76c0('0xb'))[_0x76c0('0x12')](_0x3399ad);});};}function setupLoggers(_0x235ceb){return new Promise(function(_0x377a70){var _0x4ee112=new ClientSideLogger();var _0x437a3b=fileLogger(_0x76c0('0x13'));var _0x157ba3=fileLogger('auth');_0x235ceb['set'](_0x76c0('0x14'),_0x4ee112);_0x235ceb[_0x76c0('0x15')](ewinston[_0x76c0('0x16')]({'winstonInstance':_0x437a3b,'meta':![],'statusLevels':!![],'msg':function(_0x256617,_0x2bc90d){var _0x10b7c8=_0x76c0('0x17');if(!_[_0x76c0('0x18')](_0x256617[_0x76c0('0x19')])){_0x10b7c8+=_0x76c0('0x1a');var _0x558001=_0x256617[_0x76c0('0x19')];maskSensitiveData(_0x558001);}return safeTemplate(util[_0x76c0('0x1b')](_0x10b7c8,_0x256617['method'],_0x256617[_0x76c0('0x1c')][_0x76c0('0x1d')]?_0x256617[_0x76c0('0x1c')][_0x76c0('0x1d')]:_0x256617[_0x76c0('0x1e')]['remoteAddress']||_0x256617['ip'],_0x256617[_0x76c0('0x1f')],_0x2bc90d[_0x76c0('0x20')],_0x2bc90d[_0x76c0('0x21')],_0x256617[_0x76c0('0xf')]?_0x256617[_0x76c0('0xf')]['id']:null,_0x256617[_0x76c0('0xf')]?_0x256617[_0x76c0('0xf')][_0x76c0('0xc')]:null,_0x256617[_0x76c0('0xf')]?_0x256617[_0x76c0('0xf')][_0x76c0('0x22')]:null,_0x558001?util[_0x76c0('0x23')](_0x558001,![],null):''));}}));_0x235ceb[_0x76c0('0x15')](ewinston['logger']({'winstonInstance':_0x157ba3,'meta':![],'statusLevels':!![],'msg':function(_0x1a9c8e,_0x267fd1){var _0x534904='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1a9c8e[_0x76c0('0x19')]&&_0x1a9c8e['body'][_0x76c0('0x24')]&&_0x1a9c8e[_0x76c0('0x19')]['agent_id']){_0x534904='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x76c0('0x1b')](_0x534904,_0x1a9c8e['method'],_0x1a9c8e[_0x76c0('0x1c')][_0x76c0('0x1d')]?_0x1a9c8e[_0x76c0('0x1c')][_0x76c0('0x1d')]:_0x1a9c8e[_0x76c0('0x1e')]['remoteAddress']||_0x1a9c8e['ip'],_0x1a9c8e[_0x76c0('0x1f')],_0x267fd1[_0x76c0('0x20')],_0x267fd1[_0x76c0('0x21')],_0x1a9c8e['user']?_0x1a9c8e[_0x76c0('0xf')]['id']:null,_0x1a9c8e[_0x76c0('0xf')]?_0x1a9c8e['user']['name']:null,_0x1a9c8e['user']?_0x1a9c8e[_0x76c0('0xf')][_0x76c0('0x22')]:null,_0x1a9c8e[_0x76c0('0x19')]&&_0x1a9c8e['body'][_0x76c0('0x24')]?_0x1a9c8e['body']['device']:_0x76c0('0x25'),_0x1a9c8e[_0x76c0('0x19')]&&_0x1a9c8e[_0x76c0('0x19')][_0x76c0('0x26')]?_0x1a9c8e[_0x76c0('0x19')][_0x76c0('0x26')]:'',_0x1a9c8e[_0x76c0('0x19')]&&_0x1a9c8e[_0x76c0('0x19')]['agent_name']?_0x1a9c8e[_0x76c0('0x19')][_0x76c0('0x27')]:'');},'ignoreRoute':function(_0x317a54){var _0x132462=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x132462[_0x76c0('0x28')](_0x317a54[_0x76c0('0x1f')]);}}));return _0x377a70();});}exports[_0x76c0('0x29')]=setupLoggers; \ No newline at end of file +var _0xefc7=['api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','name','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','ensureDir','then','user','no-user','timestamp','catch','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefc7,0x14f));var _0x7efc=function(_0x557b98,_0xcd3e1f){_0x557b98=_0x557b98-0x0;var _0x1c08f0=_0xefc7[_0x557b98];return _0x1c08f0;};var fs=require(_0x7efc('0x0'));var _=require(_0x7efc('0x1'));var ewinston=require(_0x7efc('0x2'));var path=require(_0x7efc('0x3'));var util=require(_0x7efc('0x4'));var fileLogger=require(_0x7efc('0x5'))['fileLogger'];var safeTemplate=require(_0x7efc('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x7efc('0x7'))[_0x7efc('0x8')];function ClientSideLogger(){function _0x142aca(_0x325e96){var _0x554f47=path['join'](_0x7efc('0x9'),_0x7efc('0xa'),_0x7efc('0xb'));var _0x526f9c=path[_0x7efc('0xc')](_0x7efc('0xd'),_0x325e96[_0x7efc('0xe')]+'-'+_0x325e96['name']);return fs[_0x7efc('0xf')](path[_0x7efc('0xc')](_0x554f47,_0x526f9c))[_0x7efc('0x10')](function(){var _0x2b9aae=fileLogger(_0x7efc('0xd'),path[_0x7efc('0xc')](_0x554f47,_0x526f9c));return _0x2b9aae;})['catch'](function(_0x148521){throw _0x148521;});}this[_0x7efc('0xa')]=function(_0x1f9912,_0x2e4bdb,_0x2a3c67,_0x4e8dc9){return _0x142aca(_0x1f9912['user'])[_0x7efc('0x10')](function(_0x3edc44){var _0x1831a2=_0x3edc44[_0x2e4bdb];return _0x1831a2;})[_0x7efc('0x10')](function(_0x948d17){var _0x5255bb=_0x1f9912[_0x7efc('0x11')]?_0x1f9912[_0x7efc('0x11')]['id']:_0x7efc('0x12');var _0x1e64d9=_0x4e8dc9['data'];var _0x17018e=_0x4e8dc9[_0x7efc('0x13')];var _0x21a6c9=new Date(Number(_0x17018e));return _0x948d17(_0x5255bb,_0x21a6c9,_0x2a3c67,_0x1e64d9);})[_0x7efc('0x14')](function(_0x21ced6){fileLogger(_0x7efc('0xd'))[_0x7efc('0x15')](_0x21ced6);});};}function setupLoggers(_0x6a8e1){return new Promise(function(_0x40d0be){var _0x5b4499=new ClientSideLogger();var _0x1f5856=fileLogger(_0x7efc('0x16'));var _0xa713a2=fileLogger(_0x7efc('0x17'));_0x6a8e1[_0x7efc('0x18')](_0x7efc('0x19'),_0x5b4499);_0x6a8e1[_0x7efc('0x1a')](ewinston[_0x7efc('0x1b')]({'winstonInstance':_0x1f5856,'meta':![],'statusLevels':!![],'msg':function(_0x3c1d69,_0x20bf8b){var _0x42f207=_0x7efc('0x1c');if(!_[_0x7efc('0x1d')](_0x3c1d69[_0x7efc('0x1e')])){_0x42f207+=_0x7efc('0x1f');var _0x5bdad9=_0x3c1d69[_0x7efc('0x1e')];maskSensitiveData(_0x5bdad9);}return safeTemplate(util['format'](_0x42f207,_0x3c1d69['method'],_0x3c1d69[_0x7efc('0x20')][_0x7efc('0x21')]?_0x3c1d69['headers'][_0x7efc('0x21')]:_0x3c1d69['connection'][_0x7efc('0x22')]||_0x3c1d69['ip'],_0x3c1d69[_0x7efc('0x23')],_0x20bf8b[_0x7efc('0x24')],_0x20bf8b[_0x7efc('0x25')],_0x3c1d69[_0x7efc('0x11')]?_0x3c1d69[_0x7efc('0x11')]['id']:null,_0x3c1d69['user']?_0x3c1d69[_0x7efc('0x11')]['name']:null,_0x3c1d69[_0x7efc('0x11')]?_0x3c1d69['user'][_0x7efc('0xe')]:null,_0x5bdad9?util[_0x7efc('0x26')](_0x5bdad9,![],null):''));}}));_0x6a8e1[_0x7efc('0x1a')](ewinston[_0x7efc('0x1b')]({'winstonInstance':_0xa713a2,'meta':![],'statusLevels':!![],'msg':function(_0xf627a1,_0x2ac158){var _0x53f1f0=_0x7efc('0x27');if(_0xf627a1['body']&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]){_0x53f1f0=_0x7efc('0x2a');}return util[_0x7efc('0x2b')](_0x53f1f0,_0xf627a1[_0x7efc('0x2c')],_0xf627a1[_0x7efc('0x20')][_0x7efc('0x21')]?_0xf627a1[_0x7efc('0x20')][_0x7efc('0x21')]:_0xf627a1[_0x7efc('0x2d')][_0x7efc('0x22')]||_0xf627a1['ip'],_0xf627a1[_0x7efc('0x23')],_0x2ac158[_0x7efc('0x24')],_0x2ac158['responseTime'],_0xf627a1['user']?_0xf627a1[_0x7efc('0x11')]['id']:null,_0xf627a1[_0x7efc('0x11')]?_0xf627a1[_0x7efc('0x11')][_0x7efc('0x2e')]:null,_0xf627a1[_0x7efc('0x11')]?_0xf627a1[_0x7efc('0x11')]['role']:null,_0xf627a1[_0x7efc('0x1e')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x28')]:_0x7efc('0x2f'),_0xf627a1[_0x7efc('0x1e')]&&_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x29')]:'',_0xf627a1['body']&&_0xf627a1['body'][_0x7efc('0x30')]?_0xf627a1[_0x7efc('0x1e')][_0x7efc('0x30')]:'');},'ignoreRoute':function(_0x1fb77f){var _0x16369a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x16369a[_0x7efc('0x31')](_0x1fb77f[_0x7efc('0x23')]);}}));return _0x40d0be();});}exports[_0x7efc('0x32')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f7cdcd8..e995024 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2239=['weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','format','MMM','monthCompare','guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale'];(function(_0x25c0fc,_0x2acf37){var _0x1e900a=function(_0x133075){while(--_0x133075){_0x25c0fc['push'](_0x25c0fc['shift']());}};_0x1e900a(++_0x2acf37);}(_0x2239,0xa4));var _0x9223=function(_0x60b8e6,_0x1d8abd){_0x60b8e6=_0x60b8e6-0x0;var _0x3c1566=_0x2239[_0x60b8e6];return _0x3c1566;};var _=require(_0x9223('0x0'));var moment=require(_0x9223('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]['map'](function(_0x267ae1){return _0x267ae1[_0x9223('0x2')];})[_0x9223('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9223('0x4');var EINVALID_DATE=_0x9223('0x5');function throwIfDateNotValid(_0x3a0a70){if(!_0x3a0a70['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xe930b7){var _0x4f998e=_0xe930b7['split'](':')[_0x9223('0x6')](function(_0x7d1612){return parseInt(_0x7d1612,0xa);});var _0x2d7431=_0x4f998e[0x0];var _0x14e414=_0x4f998e[0x1];if(_0x2d7431<0x0||_0x2d7431>0x17||_0x14e414<0x0||_0x14e414>0x3b){throw new Error(EINVALID_DATE);}return[_0x2d7431,_0x14e414];}function circularDoWInterval(_0x539e57,_0x1e66ac){if(_0x539e57===_0x1e66ac){return[_0x539e57];}else{var _0x4dc816=moment[_0x9223('0x7')]();moment['locale']('en');var _0x538637=moment[_0x9223('0x8')]()['map'](function(_0x2f8f53){return _0x2f8f53[_0x9223('0x9')]();});moment[_0x9223('0x7')](_0x4dc816);var _0x137201=_0x538637[_0x9223('0xa')](_0x539e57);var _0x47f8b6=_0x538637[_0x9223('0xa')](_0x1e66ac);if(_0x47f8b6>_0x137201){return _0x538637[_0x9223('0xb')](_0x137201,_0x47f8b6+0x1);}else{var _0x2521d6=_0x538637[_0x9223('0xb')](0x0,_0x47f8b6+0x1);var _0x5d3f51=_0x538637[_0x9223('0xb')](_0x137201);return _0x5d3f51[_0x9223('0xc')](_0x2521d6);}}}module[_0x9223('0xd')][_0x9223('0xe')]=circularDoWInterval;function circularMonthInterval(_0x5eec52,_0x4d1c8f){if(_0x5eec52===_0x4d1c8f){return[_0x5eec52];}else{var _0x310c34=moment[_0x9223('0x7')]();moment[_0x9223('0x7')]('en');var _0x54f545=moment[_0x9223('0xf')]()[_0x9223('0x6')](function(_0x598312){return _0x598312[_0x9223('0x9')]();});moment[_0x9223('0x7')](_0x310c34);var _0x274efa=_0x54f545['indexOf'](_0x5eec52);var _0x410d8a=_0x54f545[_0x9223('0xa')](_0x4d1c8f);if(_0x410d8a>_0x274efa){return _0x54f545[_0x9223('0xb')](_0x274efa,_0x410d8a+0x1);}else{var _0x360220=_0x54f545['slice'](0x0,_0x410d8a+0x1);var _0x2b1403=_0x54f545[_0x9223('0xb')](_0x274efa);return _0x2b1403[_0x9223('0xc')](_0x360220);}}}module[_0x9223('0xd')][_0x9223('0x10')]=circularMonthInterval;function parseDom(_0x13491d){var _0x1daf1b=parseInt(_0x13491d,0xa);if(_0x1daf1b<0x1||_0x1daf1b>0x1f){throw new Error(EINVALID_DATE);}return _0x1daf1b;}function timeCompare(_0x260a04,_0x3ff071,_0x1d0513){var _0x29c559=_0x260a04[_0x9223('0x11')]();var _0xde305d=extractTime(_0x3ff071);var _0x2c1a68=_0xde305d[0x0];var _0x90df0b=_0xde305d[0x1];var _0x4baa20=_0x260a04[_0x9223('0x11')]()['hours'](_0x2c1a68)[_0x9223('0x12')](_0x90df0b);throwIfDateNotValid(_0x4baa20);var _0x1ba218=extractTime(_0x1d0513);var _0x18e946=_0x1ba218[0x0];var _0x550b31=_0x1ba218[0x1];var _0x4e6aca=_0x260a04['clone']()[_0x9223('0x13')](_0x18e946)['minutes'](_0x550b31);throwIfDateNotValid(_0x4e6aca);if(_0x4e6aca[_0x9223('0x14')](_0x4baa20)){var _0x55a6cd=_0x29c559[_0x9223('0x11')]()[_0x9223('0x15')]('day');var _0x1063db=_0x29c559[_0x9223('0x11')]()[_0x9223('0x16')]('day');return _0x29c559[_0x9223('0x17')](_0x4baa20,_0x1063db,undefined,'[]')||_0x29c559['isBetween'](_0x55a6cd,_0x4e6aca,undefined,'[]');}else{return _0x29c559['isBetween'](_0x4baa20,_0x4e6aca,undefined,'[]');}}module['exports'][_0x9223('0x18')]=timeCompare;function dowCompare(_0xe63195,_0x2ecf8e,_0xccb765){var _0x29ee57=_0xe63195[_0x9223('0x7')]('en')['format'](_0x9223('0x19'))[_0x9223('0x9')]();return circularDoWInterval(_0x2ecf8e,_0xccb765)[_0x9223('0x1a')](_0x29ee57);}module['exports'][_0x9223('0x1b')]=dowCompare;function domCompare(_0x2f457a,_0x4a3693,_0x2f7eab){var _0xcb58b7=_0x2f457a[_0x9223('0x1c')]();if(_0x4a3693===_0x2f7eab){return _0xcb58b7===_0x4a3693;}else{var _0x487855=_0x2f457a[_0x9223('0x1d')]();var _0x4fd356=_0x4a3693<_0x2f7eab;let _0x3cc75d=![];var _0x3d0a88=0x0;var _0x40a7c1=0x0;if(_0x4fd356){_0x3d0a88=Math[_0x9223('0x1e')](0x1,_0x4a3693);_0x40a7c1=Math[_0x9223('0x1f')](_0x2f7eab,_0x487855);_0x3cc75d=_0xcb58b7>=_0x3d0a88&&_0xcb58b7<=_0x40a7c1;}else{_0x3d0a88=Math['min'](_0x4a3693,_0x487855);_0x40a7c1=Math[_0x9223('0x1e')](0x1,_0x2f7eab);_0x3cc75d=_0xcb58b7>=_0x3d0a88||_0xcb58b7<=_0x40a7c1;}return _0x3cc75d;}}module['exports'][_0x9223('0x20')]=domCompare;function monthCompare(_0x2480b3,_0x1498cd,_0x2c2807){var _0x2fb4b4=_0x2480b3[_0x9223('0x7')]('en')[_0x9223('0x21')](_0x9223('0x22'))[_0x9223('0x9')]();return circularMonthInterval(_0x1498cd,_0x2c2807)[_0x9223('0x1a')](_0x2fb4b4);}module[_0x9223('0xd')][_0x9223('0x23')]=monthCompare;function iftime(_0x3675d2,_0x94da32=moment['tz'][_0x9223('0x24')](),_0x1bff9f=moment()){if(!validateRx[_0x9223('0x25')](_0x3675d2)){throw new Error(EINVALID_STRING);}else{var _0x25c29d=(moment[_0x9223('0x26')](_0x1bff9f)?_0x1bff9f[_0x9223('0x11')]():moment(_0x1bff9f))['tz'](_0x94da32)['locale']('en');throwIfDateNotValid(_0x25c29d);var _0x59eeb7=_0x3675d2[_0x9223('0x27')](',');var _0x4b2339=_0x59eeb7[0x0];var _0xb8ba9=_0x59eeb7[0x1];var _0x152dd8=_0x59eeb7[0x2];var _0x395559=_0x59eeb7[0x3];let _0x13e22c=!![];if(_0x4b2339!=='*'){var _0x321444=_0x4b2339[_0x9223('0x27')]('-');var _0x4c621f=_[_0x9223('0x28')](_0x321444[0x0],0x5,'0');var _0x51d598=_0x321444[_0x9223('0x29')]===0x2?_[_0x9223('0x28')](_0x321444[0x1],0x5,'0'):_0x4c621f;_0x13e22c=timeCompare(_0x25c29d,_0x4c621f,_0x51d598);}let _0x473983=!![];if(_0xb8ba9!=='*'){var _0x327a2d=_0xb8ba9['split']('-');var _0xd14cb5=_0x327a2d[0x0];var _0xd476f7=_0x327a2d[_0x9223('0x29')]===0x2?_0x327a2d[0x1]:_0xd14cb5;_0x473983=dowCompare(_0x25c29d,_0xd14cb5,_0xd476f7);}let _0x4fe974=!![];if(_0x152dd8!=='*'){var _0x31ce52=_0x152dd8[_0x9223('0x27')]('-');var _0x3d9017=parseDom(_0x31ce52[0x0]);var _0x3fa5e4=_0x31ce52[_0x9223('0x29')]===0x2?parseDom(_0x31ce52[0x1]):_0x3d9017;_0x4fe974=domCompare(_0x25c29d,_0x3d9017,_0x3fa5e4);}let _0x58ec00=!![];if(_0x395559!=='*'){var _0x96c0e3=_0x395559[_0x9223('0x27')]('-');var _0x1b862c=_0x96c0e3[0x0];var _0x3ace41=_0x96c0e3['length']===0x2?_0x96c0e3[0x1]:_0x96c0e3[0x0];_0x58ec00=monthCompare(_0x25c29d,_0x1b862c,_0x3ace41);}return _0x13e22c&&_0x473983&&_0x4fe974&&_0x58ec00;}}module[_0x9223('0xd')][_0x9223('0x2a')]=iftime; \ No newline at end of file +var _0x043a=['isValid','split','map','locale','weekdaysShort','indexOf','slice','exports','circularDoWInterval','toLowerCase','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','isMoment','length','iftime','lodash','moment-timezone','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x043a,0xe0));var _0xa043=function(_0xca7b54,_0xeae67e){_0xca7b54=_0xca7b54-0x0;var _0xb913b8=_0x043a[_0xca7b54];return _0xb913b8;};var _=require(_0xa043('0x0'));var moment=require(_0xa043('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]['map'](function(_0x38a297){return _0x38a297['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa043('0x2');var EINVALID_DATE=_0xa043('0x3');function throwIfDateNotValid(_0x1f6e2d){if(!_0x1f6e2d[_0xa043('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4a7fd0){var _0x312a11=_0x4a7fd0[_0xa043('0x5')](':')[_0xa043('0x6')](function(_0x13cf80){return parseInt(_0x13cf80,0xa);});var _0x4e13b1=_0x312a11[0x0];var _0x3bfce9=_0x312a11[0x1];if(_0x4e13b1<0x0||_0x4e13b1>0x17||_0x3bfce9<0x0||_0x3bfce9>0x3b){throw new Error(EINVALID_DATE);}return[_0x4e13b1,_0x3bfce9];}function circularDoWInterval(_0x1b86f2,_0x419ee3){if(_0x1b86f2===_0x419ee3){return[_0x1b86f2];}else{var _0x29fda4=moment[_0xa043('0x7')]();moment[_0xa043('0x7')]('en');var _0x54db2f=moment[_0xa043('0x8')]()[_0xa043('0x6')](function(_0x43da2a){return _0x43da2a['toLowerCase']();});moment[_0xa043('0x7')](_0x29fda4);var _0x3f47e9=_0x54db2f[_0xa043('0x9')](_0x1b86f2);var _0x44182e=_0x54db2f[_0xa043('0x9')](_0x419ee3);if(_0x44182e>_0x3f47e9){return _0x54db2f[_0xa043('0xa')](_0x3f47e9,_0x44182e+0x1);}else{var _0x150e13=_0x54db2f['slice'](0x0,_0x44182e+0x1);var _0x288630=_0x54db2f[_0xa043('0xa')](_0x3f47e9);return _0x288630['concat'](_0x150e13);}}}module[_0xa043('0xb')][_0xa043('0xc')]=circularDoWInterval;function circularMonthInterval(_0x22a3dc,_0x52c5b9){if(_0x22a3dc===_0x52c5b9){return[_0x22a3dc];}else{var _0x137f7a=moment[_0xa043('0x7')]();moment['locale']('en');var _0xf9c66f=moment['monthsShort']()[_0xa043('0x6')](function(_0x406398){return _0x406398[_0xa043('0xd')]();});moment['locale'](_0x137f7a);var _0x59632f=_0xf9c66f['indexOf'](_0x22a3dc);var _0x4ab671=_0xf9c66f[_0xa043('0x9')](_0x52c5b9);if(_0x4ab671>_0x59632f){return _0xf9c66f[_0xa043('0xa')](_0x59632f,_0x4ab671+0x1);}else{var _0x1c8d05=_0xf9c66f['slice'](0x0,_0x4ab671+0x1);var _0x578eb6=_0xf9c66f[_0xa043('0xa')](_0x59632f);return _0x578eb6[_0xa043('0xe')](_0x1c8d05);}}}module[_0xa043('0xb')][_0xa043('0xf')]=circularMonthInterval;function parseDom(_0x59292d){var _0xdef9f=parseInt(_0x59292d,0xa);if(_0xdef9f<0x1||_0xdef9f>0x1f){throw new Error(EINVALID_DATE);}return _0xdef9f;}function timeCompare(_0x57a603,_0x54e85f,_0x239952){var _0x1b5853=_0x57a603['clone']();var _0xb81e22=extractTime(_0x54e85f);var _0x3158bc=_0xb81e22[0x0];var _0x500fd7=_0xb81e22[0x1];var _0x46b95e=_0x57a603[_0xa043('0x10')]()[_0xa043('0x11')](_0x3158bc)[_0xa043('0x12')](_0x500fd7);throwIfDateNotValid(_0x46b95e);var _0x59cfe4=extractTime(_0x239952);var _0x393a3c=_0x59cfe4[0x0];var _0x306eba=_0x59cfe4[0x1];var _0xbbbc4e=_0x57a603[_0xa043('0x10')]()[_0xa043('0x11')](_0x393a3c)['minutes'](_0x306eba);throwIfDateNotValid(_0xbbbc4e);if(_0xbbbc4e[_0xa043('0x13')](_0x46b95e)){var _0x2153ad=_0x1b5853['clone']()[_0xa043('0x14')](_0xa043('0x15'));var _0x52aa1e=_0x1b5853[_0xa043('0x10')]()[_0xa043('0x16')]('day');return _0x1b5853[_0xa043('0x17')](_0x46b95e,_0x52aa1e,undefined,'[]')||_0x1b5853[_0xa043('0x17')](_0x2153ad,_0xbbbc4e,undefined,'[]');}else{return _0x1b5853[_0xa043('0x17')](_0x46b95e,_0xbbbc4e,undefined,'[]');}}module[_0xa043('0xb')][_0xa043('0x18')]=timeCompare;function dowCompare(_0x480183,_0x588383,_0x2ef55a){var _0x29cf4d=_0x480183[_0xa043('0x7')]('en')[_0xa043('0x19')]('ddd')[_0xa043('0xd')]();return circularDoWInterval(_0x588383,_0x2ef55a)[_0xa043('0x1a')](_0x29cf4d);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x5e33a5,_0x1295bc,_0xd42c3e){var _0x17b840=_0x5e33a5[_0xa043('0x1b')]();if(_0x1295bc===_0xd42c3e){return _0x17b840===_0x1295bc;}else{var _0x4ae269=_0x5e33a5[_0xa043('0x1c')]();var _0x2e0a28=_0x1295bc<_0xd42c3e;let _0x3cbeca=![];var _0x22a8a3=0x0;var _0x2ed3f1=0x0;if(_0x2e0a28){_0x22a8a3=Math[_0xa043('0x1d')](0x1,_0x1295bc);_0x2ed3f1=Math[_0xa043('0x1e')](_0xd42c3e,_0x4ae269);_0x3cbeca=_0x17b840>=_0x22a8a3&&_0x17b840<=_0x2ed3f1;}else{_0x22a8a3=Math[_0xa043('0x1e')](_0x1295bc,_0x4ae269);_0x2ed3f1=Math[_0xa043('0x1d')](0x1,_0xd42c3e);_0x3cbeca=_0x17b840>=_0x22a8a3||_0x17b840<=_0x2ed3f1;}return _0x3cbeca;}}module['exports'][_0xa043('0x1f')]=domCompare;function monthCompare(_0x283a28,_0x44f496,_0x5d596f){var _0x1bad58=_0x283a28['locale']('en')[_0xa043('0x19')](_0xa043('0x20'))[_0xa043('0xd')]();return circularMonthInterval(_0x44f496,_0x5d596f)[_0xa043('0x1a')](_0x1bad58);}module[_0xa043('0xb')][_0xa043('0x21')]=monthCompare;function iftime(_0xca7b81,_0x255bf0=moment['tz'][_0xa043('0x22')](),_0x538fe8=moment()){if(!validateRx['test'](_0xca7b81)){throw new Error(EINVALID_STRING);}else{var _0x4fa169=(moment[_0xa043('0x23')](_0x538fe8)?_0x538fe8[_0xa043('0x10')]():moment(_0x538fe8))['tz'](_0x255bf0)['locale']('en');throwIfDateNotValid(_0x4fa169);var _0x2d60a4=_0xca7b81['split'](',');var _0x16b6c6=_0x2d60a4[0x0];var _0x570e71=_0x2d60a4[0x1];var _0xe80d6c=_0x2d60a4[0x2];var _0x59bd5f=_0x2d60a4[0x3];let _0xd3f052=!![];if(_0x16b6c6!=='*'){var _0x46f049=_0x16b6c6[_0xa043('0x5')]('-');var _0x457e04=_['padStart'](_0x46f049[0x0],0x5,'0');var _0x1fe40f=_0x46f049['length']===0x2?_['padStart'](_0x46f049[0x1],0x5,'0'):_0x457e04;_0xd3f052=timeCompare(_0x4fa169,_0x457e04,_0x1fe40f);}let _0x4e0488=!![];if(_0x570e71!=='*'){var _0x15ccd2=_0x570e71[_0xa043('0x5')]('-');var _0x13b0db=_0x15ccd2[0x0];var _0x5504b3=_0x15ccd2[_0xa043('0x24')]===0x2?_0x15ccd2[0x1]:_0x13b0db;_0x4e0488=dowCompare(_0x4fa169,_0x13b0db,_0x5504b3);}let _0x14ca1c=!![];if(_0xe80d6c!=='*'){var _0x4d2a09=_0xe80d6c[_0xa043('0x5')]('-');var _0x14b40a=parseDom(_0x4d2a09[0x0]);var _0x5d6ca5=_0x4d2a09[_0xa043('0x24')]===0x2?parseDom(_0x4d2a09[0x1]):_0x14b40a;_0x14ca1c=domCompare(_0x4fa169,_0x14b40a,_0x5d6ca5);}let _0x48f569=!![];if(_0x59bd5f!=='*'){var _0x5441a5=_0x59bd5f[_0xa043('0x5')]('-');var _0x5e2c20=_0x5441a5[0x0];var _0x406772=_0x5441a5[_0xa043('0x24')]===0x2?_0x5441a5[0x1]:_0x5441a5[0x0];_0x48f569=monthCompare(_0x4fa169,_0x5e2c20,_0x406772);}return _0xd3f052&&_0x4e0488&&_0x14ca1c&&_0x48f569;}}module[_0xa043('0xb')][_0xa043('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f843f63..bb483fc 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45ab=['toLowerCase','info','redBG\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','error','File','%s-%s','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel'];(function(_0x55be27,_0x57003b){var _0x53b5b9=function(_0x521884){while(--_0x521884){_0x55be27['push'](_0x55be27['shift']());}};_0x53b5b9(++_0x57003b);}(_0x45ab,0x69));var _0xb45a=function(_0x2ac1ca,_0x1e47d4){_0x2ac1ca=_0x2ac1ca-0x0;var _0x596155=_0x45ab[_0x2ac1ca];return _0x596155;};'use strict';var path=require(_0xb45a('0x0'));var util=require(_0xb45a('0x1'));var moment=require(_0xb45a('0x2'));var winston=require(_0xb45a('0x3'));var config=require(_0xb45a('0x4'));var debugLevel=config[_0xb45a('0x5')]?config['debugLevel'][_0xb45a('0x6')]():_0xb45a('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xb45a('0x8'),'error':'red','warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':_0xb45a('0x9'),'http':_0xb45a('0xa'),'verbose':_0xb45a('0xb'),'debug':_0xb45a('0xc'),'silly':_0xb45a('0xd')};winston[_0xb45a('0xe')](XC_LOG_COLORS);function getLogFileName(_0x40bb74,_0x117a0f,_0x2df88d){var _0x1f8c80=_0x40bb74||_0xb45a('0xf');return path['join'](_0x1f8c80,util['format']('%s-%s.log',_0x117a0f,_0x2df88d));}function formatter(_0x84d0f5,_0x13303c){_0x13303c[_0xb45a('0x10')]=_0x13303c[_0xb45a('0x10')][_0xb45a('0x11')](/@@{/g,_0xb45a('0x12'))[_0xb45a('0x11')](/}@@/g,_0xb45a('0x13'))['replace'](/@{/g,'{{')[_0xb45a('0x11')](/}@/g,'}}');return util[_0xb45a('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb45a('0x14')](_0xb45a('0x15')),_0x13303c[_0xb45a('0x16')][_0xb45a('0x17')](),_0x84d0f5,_0x13303c[_0xb45a('0x10')]);}function fileFormat(_0x5dd566,_0x4f719a){_0x4f719a[_0xb45a('0x10')]=_0x4f719a[_0xb45a('0x10')][_0xb45a('0x11')](/@@{/g,_0xb45a('0x12'))[_0xb45a('0x11')](/}@@/g,_0xb45a('0x13'))[_0xb45a('0x11')](/@{/g,'{{')[_0xb45a('0x11')](/}@/g,'}}');var _0x3515f6=_0x4f719a[_0xb45a('0x18')]&&Object[_0xb45a('0x19')](_0x4f719a[_0xb45a('0x18')])[_0xb45a('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x4f719a[_0xb45a('0x18')]):'';return util[_0xb45a('0x14')](_0xb45a('0x1b'),moment()[_0xb45a('0x14')](_0xb45a('0x15')),_0x4f719a['level'][_0xb45a('0x17')](),_0x5dd566,_0x4f719a[_0xb45a('0x10')],_0x3515f6);}function consoleLogger(){var _0x57a339=new winston[(_0xb45a('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb45a('0x1d'))][(_0xb45a('0x1e'))]({'level':_0xb45a('0x1f'),'json':![],'formatter':function(_0x322467){return formatter('',_0x322467);}})]});return _0x57a339;}function fileLogger(_0x2b4a74,_0xd6c8c4){var _0x5f0e2d=new winston[(_0xb45a('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xb45a('0x14')]('%s-%s',_0x2b4a74,_0xb45a('0x20')),'filename':getLogFileName(_0xd6c8c4,_0x2b4a74,_0xb45a('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1dec67){return fileFormat(_0x2b4a74,_0x1dec67);}}),new winston[(_0xb45a('0x1d'))][(_0xb45a('0x21'))]({'name':util[_0xb45a('0x14')](_0xb45a('0x22'),_0x2b4a74,debugLevel),'filename':getLogFileName(_0xd6c8c4,_0x2b4a74,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ddb44){return fileFormat(_0x2b4a74,_0x5ddb44);}}),new winston['transports'][(_0xb45a('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x7d8717){return fileFormat(_0x2b4a74,_0x7d8717);}})]});return _0x5f0e2d;}exports[_0xb45a('0x23')]=consoleLogger;exports[_0xb45a('0x24')]=fileLogger; \ No newline at end of file +var _0xe419=['winston','../config/environment','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe419,0xf3));var _0x9e41=function(_0x13bd5f,_0x24020d){_0x13bd5f=_0x13bd5f-0x0;var _0x99ef07=_0xe419[_0x13bd5f];return _0x99ef07;};'use strict';var path=require(_0x9e41('0x0'));var util=require(_0x9e41('0x1'));var moment=require(_0x9e41('0x2'));var winston=require(_0x9e41('0x3'));var config=require(_0x9e41('0x4'));var debugLevel=config[_0x9e41('0x5')]?config['debugLevel']['toLowerCase']():_0x9e41('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':'redBG\x20white','error':_0x9e41('0x7'),'warn':_0x9e41('0x8'),'info':_0x9e41('0x9'),'print':_0x9e41('0xa'),'success':'bold\x20green','http':'gray','verbose':_0x9e41('0xb'),'debug':_0x9e41('0xc'),'silly':_0x9e41('0xd')};winston[_0x9e41('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1eab5d,_0x2e0068,_0x14fe1d){var _0x329533=_0x1eab5d||_0x9e41('0xf');return path[_0x9e41('0x10')](_0x329533,util[_0x9e41('0x11')](_0x9e41('0x12'),_0x2e0068,_0x14fe1d));}function formatter(_0x4d4daa,_0x5e3a1e){_0x5e3a1e[_0x9e41('0x13')]=_0x5e3a1e[_0x9e41('0x13')][_0x9e41('0x14')](/@@{/g,_0x9e41('0x15'))['replace'](/}@@/g,_0x9e41('0x16'))[_0x9e41('0x14')](/@{/g,'{{')[_0x9e41('0x14')](/}@/g,'}}');return util['format'](_0x9e41('0x17'),moment()[_0x9e41('0x11')](_0x9e41('0x18')),_0x5e3a1e['level']['toUpperCase'](),_0x4d4daa,_0x5e3a1e[_0x9e41('0x13')]);}function fileFormat(_0x3cb8a5,_0x5c8532){_0x5c8532[_0x9e41('0x13')]=_0x5c8532['message'][_0x9e41('0x14')](/@@{/g,'{{{')[_0x9e41('0x14')](/}@@/g,_0x9e41('0x16'))[_0x9e41('0x14')](/@{/g,'{{')[_0x9e41('0x14')](/}@/g,'}}');var _0x41d2ff=_0x5c8532['meta']&&Object[_0x9e41('0x19')](_0x5c8532[_0x9e41('0x1a')])[_0x9e41('0x1b')]?'\x0a\x09'+JSON[_0x9e41('0x1c')](_0x5c8532[_0x9e41('0x1a')]):'';return util[_0x9e41('0x11')](_0x9e41('0x1d'),moment()[_0x9e41('0x11')](_0x9e41('0x18')),_0x5c8532[_0x9e41('0x1e')][_0x9e41('0x1f')](),_0x3cb8a5,_0x5c8532['message'],_0x41d2ff);}function consoleLogger(){var _0x1c5bc8=new winston[(_0x9e41('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9e41('0x21'))][(_0x9e41('0x22'))]({'level':_0x9e41('0x23'),'json':![],'formatter':function(_0x2b84ae){return formatter('',_0x2b84ae);}})]});return _0x1c5bc8;}function fileLogger(_0x3f67ff,_0x23bce7){var _0x43c406=new winston[(_0x9e41('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9e41('0x21'))][(_0x9e41('0x24'))]({'name':util[_0x9e41('0x11')](_0x9e41('0x25'),_0x3f67ff,'error'),'filename':getLogFileName(_0x23bce7,_0x3f67ff,_0x9e41('0x26')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12138e){return fileFormat(_0x3f67ff,_0x12138e);}}),new winston[(_0x9e41('0x21'))][(_0x9e41('0x24'))]({'name':util['format'](_0x9e41('0x25'),_0x3f67ff,debugLevel),'filename':getLogFileName(_0x23bce7,_0x3f67ff,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x466c3c){return fileFormat(_0x3f67ff,_0x466c3c);}}),new winston[(_0x9e41('0x21'))][(_0x9e41('0x22'))]({'level':'warn','json':![],'formatter':function(_0x3fa551){return fileFormat(_0x3f67ff,_0x3fa551);}})]});return _0x43c406;}exports[_0x9e41('0x27')]=consoleLogger;exports[_0x9e41('0x28')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 6f25b7d..be6e6d7 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x38c996,_0x127118){var _0x4aff5c=function(_0x3ce2a6){while(--_0x3ce2a6){_0x38c996['push'](_0x38c996['shift']());}};_0x4aff5c(++_0x127118);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x0b0e[_0x29d2d2];return _0x3f6476;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdb28,0x106));var _0x8db2=function(_0x981e2d,_0x6898cd){_0x981e2d=_0x981e2d-0x0;var _0x2899f4=_0xdb28[_0x981e2d];return _0x2899f4;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 024b17b..1913aab 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['replace','\x5c$&'];(function(_0x492f85,_0x15c832){var _0x1f5234=function(_0x5efdfc){while(--_0x5efdfc){_0x492f85['push'](_0x492f85['shift']());}};_0x1f5234(++_0x15c832);}(_0x1261,0x144));var _0x1126=function(_0x5cb7a8,_0x269783){_0x5cb7a8=_0x5cb7a8-0x0;var _0x2a26df=_0x1261[_0x5cb7a8];return _0x2a26df;};module['exports']={'escapeRegExp'(_0x234ea5,_0x26c6a0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x234ea5[_0x1126('0x0')](_0x26c6a0,_0x1126('0x1'));}}; \ No newline at end of file +var _0xf494=['exports','\x5c$&'];(function(_0x1fdce1,_0x3d8bbd){var _0x4b89f7=function(_0x5b1e2a){while(--_0x5b1e2a){_0x1fdce1['push'](_0x1fdce1['shift']());}};_0x4b89f7(++_0x3d8bbd);}(_0xf494,0x1c6));var _0x4f49=function(_0x3938df,_0x2b8d75){_0x3938df=_0x3938df-0x0;var _0x1bdca1=_0xf494[_0x3938df];return _0x1bdca1;};module[_0x4f49('0x0')]={'escapeRegExp'(_0x32e808,_0x3063f3=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x32e808['replace'](_0x3063f3,_0x4f49('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 18bb429..a13ac66 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 _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x14a0,0x8e));var _0x014a=function(_0x5db709,_0x325d98){_0x5db709=_0x5db709-0x0;var _0x9b6f13=_0x14a0[_0x5db709];return _0x9b6f13;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file +var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x1a3737,_0x3aa3a7){var _0x475b5e=function(_0x3d13ce){while(--_0x3d13ce){_0x1a3737['push'](_0x1a3737['shift']());}};_0x475b5e(++_0x3aa3a7);}(_0xb688,0xcf));var _0x8b68=function(_0x315f3d,_0x3b296e){_0x315f3d=_0x315f3d-0x0;var _0x3f359f=_0xb688[_0x315f3d];return _0x3f359f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b487eb5..3e5e86a 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 _0xfd86=['server/app.json','isArray','apps','findIndex','motion2','NODE_PATH','string','pathExists','then','readJSON','updated','info','writeJSON','resolve','exports','fs-extra','path','root'];(function(_0x2e64d1,_0x169a7f){var _0x170076=function(_0x578f4e){while(--_0x578f4e){_0x2e64d1['push'](_0x2e64d1['shift']());}};_0x170076(++_0x169a7f);}(_0xfd86,0x11d));var _0x6fd8=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xfd86[_0x120376];return _0x28c529;};var fs=require(_0x6fd8('0x0'));var path=require(_0x6fd8('0x1'));var config=require('../config/environment');var root=config[_0x6fd8('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x6fd8('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x562bf4){let _0x51f38f=![];if(Array[_0x6fd8('0x4')](_0x562bf4[_0x6fd8('0x5')])){var _0x28de17=_0x562bf4[_0x6fd8('0x5')][_0x6fd8('0x6')](function(_0x350a3c){return _0x350a3c['name']===_0x6fd8('0x7');});if(_0x28de17>-0x1){var _0x2d19a2=_0x562bf4['apps'][_0x28de17];if(typeof _0x2d19a2['env'][_0x6fd8('0x8')]!==_0x6fd8('0x9')){_0x2d19a2['env'][_0x6fd8('0x8')]=NODEPATH;_0x51f38f=!![];}}return{'appConfig':_0x562bf4,'updated':_0x51f38f};}}function updateAppConfig(_0x39dcca){return fs[_0x6fd8('0xa')](APP_JSON_PATH)[_0x6fd8('0xb')](function(_0x107cb3){if(_0x107cb3){return fs[_0x6fd8('0xc')](APP_JSON_PATH)[_0x6fd8('0xb')](function(_0x3ec743){var _0x29b700=setLegacyLibsNodeEnvPath(_0x3ec743);if(_0x29b700[_0x6fd8('0xd')]){_0x39dcca[_0x6fd8('0xe')]('Updating\x20app.json');return fs[_0x6fd8('0xf')](APP_JSON_PATH,_0x3ec743,{'spaces':0x2});}else{return Promise[_0x6fd8('0x10')]();}});}else{return Promise[_0x6fd8('0x10')]();}});}module[_0x6fd8('0x11')]=updateAppConfig; \ No newline at end of file +var _0xd93e=['then','readJSON','updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','string','env','NODE_PATH','pathExists'];(function(_0x5e99ff,_0x5e7a57){var _0xf9d4b5=function(_0x11d64e){while(--_0x11d64e){_0x5e99ff['push'](_0x5e99ff['shift']());}};_0xf9d4b5(++_0x5e7a57);}(_0xd93e,0x74));var _0xed93=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd93e[_0x321bb2];return _0x9c12ed;};var fs=require(_0xed93('0x0'));var path=require(_0xed93('0x1'));var config=require(_0xed93('0x2'));var root=config[_0xed93('0x3')];var APP_JSON_PATH=path[_0xed93('0x4')](root,_0xed93('0x5'));var NODEPATH=path[_0xed93('0x4')](root,_0xed93('0x6'));function setLegacyLibsNodeEnvPath(_0x328fc8){let _0x357b29=![];if(Array[_0xed93('0x7')](_0x328fc8[_0xed93('0x8')])){var _0x234fcc=_0x328fc8[_0xed93('0x8')][_0xed93('0x9')](function(_0x1cd9d9){return _0x1cd9d9[_0xed93('0xa')]===_0xed93('0xb');});if(_0x234fcc>-0x1){var _0x55927d=_0x328fc8[_0xed93('0x8')][_0x234fcc];if(typeof _0x55927d['env']['NODE_PATH']!==_0xed93('0xc')){_0x55927d[_0xed93('0xd')][_0xed93('0xe')]=NODEPATH;_0x357b29=!![];}}return{'appConfig':_0x328fc8,'updated':_0x357b29};}}function updateAppConfig(_0x2d61c0){return fs[_0xed93('0xf')](APP_JSON_PATH)[_0xed93('0x10')](function(_0x5cb213){if(_0x5cb213){return fs[_0xed93('0x11')](APP_JSON_PATH)[_0xed93('0x10')](function(_0x5991d7){var _0x1c3bd7=setLegacyLibsNodeEnvPath(_0x5991d7);if(_0x1c3bd7[_0xed93('0x12')]){_0x2d61c0[_0xed93('0x13')](_0xed93('0x14'));return fs['writeJSON'](APP_JSON_PATH,_0x5991d7,{'spaces':0x2});}else{return Promise[_0xed93('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xed93('0x15')]=updateAppConfig; \ No newline at end of file